From: support Date: Tue, 27 Dec 2022 08:18:21 +0000 (+0000) Subject: Built motion from commit 2b9af5da.|2.6.26 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=512e0092469400385aaa23b6c047af6e7bfcf313;p=motion2.git Built motion from commit 2b9af5da.|2.6.26 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index eeeff47..49b0978 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-12-23T10:13:49.325Z", + "time": "2022-12-27T08:09:53.734Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a528e64..6ed4507 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-23T10:13:49.325Z", + "time": "2022-12-27T08:09:53.734Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 401aeef..0f313cc 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 _0x60bd=['urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','VIRTUAL','getDataValue','contactManager','integration'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x60bd,0x163));var _0xd60b=function(_0x291f3a,_0x1236c4){_0x291f3a=_0x291f3a-0x0;var _0x5b7ad2=_0x60bd[_0x291f3a];return _0x5b7ad2;};'use strict';var Sequelize=require(_0xd60b('0x0'));module['exports']={'name':{'type':Sequelize[_0xd60b('0x1')],'get':function(_0x47abe0){return this[_0xd60b('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xd60b('0x3'),_0xd60b('0x4'),'motionbar','jscripty',_0xd60b('0x5'),_0xd60b('0x6'),_0xd60b('0x7'),_0xd60b('0x8')]],'msg':_0xd60b('0x9')}},'comment':_0xd60b('0x9')},'data1':{'type':Sequelize[_0xd60b('0xa')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xd60b('0xa')](0x1000),'comment':_0xd60b('0xb')},'data3':{'type':Sequelize[_0xd60b('0xa')](0x1000),'comment':_0xd60b('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xd60b('0xd')},'data6':{'type':Sequelize[_0xd60b('0xa')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xd60b('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xdbbc=['getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize'];(function(_0x50d5ae,_0x22a349){var _0x1e8d74=function(_0xd256a9){while(--_0xd256a9){_0x50d5ae['push'](_0x50d5ae['shift']());}};_0x1e8d74(++_0x22a349);}(_0xdbbc,0x19d));var _0xcdbb=function(_0x136c8a,_0x160dcd){_0x136c8a=_0x136c8a-0x0;var _0x2d18a2=_0xdbbc[_0x136c8a];return _0x2d18a2;};'use strict';var Sequelize=require(_0xcdbb('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x12de67){return this[_0xcdbb('0x1')](_0xcdbb('0x2'));}},'action':{'type':Sequelize[_0xcdbb('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xcdbb('0x4'),_0xcdbb('0x5'),_0xcdbb('0x6'),_0xcdbb('0x7'),_0xcdbb('0x8'),_0xcdbb('0x9'),_0xcdbb('0xa'),_0xcdbb('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xcdbb('0xc')},'data1':{'type':Sequelize[_0xcdbb('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xcdbb('0x3')](0x1000),'comment':_0xcdbb('0xd')},'data3':{'type':Sequelize[_0xcdbb('0x3')](0x1000),'comment':_0xcdbb('0xe')},'data4':{'type':Sequelize[_0xcdbb('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xcdbb('0xf')},'data7':{'type':Sequelize[_0xcdbb('0x10')],'comments':_0xcdbb('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d4555a3..7b11fe0 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 _0x506f=['params','Action','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','body','find'];(function(_0x44a01a,_0x4926fd){var _0x4a92b6=function(_0x2ed857){while(--_0x2ed857){_0x44a01a['push'](_0x44a01a['shift']());}};_0x4a92b6(++_0x4926fd);}(_0x506f,0x123));var _0xf506=function(_0x107531,_0x16502a){_0x107531=_0x107531-0x0;var _0x5314d9=_0x506f[_0x107531];return _0x5314d9;};'use strict';var emlformat=require(_0xf506('0x0'));var rimraf=require(_0xf506('0x1'));var zipdir=require(_0xf506('0x2'));var jsonpatch=require(_0xf506('0x3'));var rp=require(_0xf506('0x4'));var moment=require('moment');var BPromise=require(_0xf506('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf506('0x6'));var sox=require('sox');var csv=require(_0xf506('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf506('0x8'));var _=require(_0xf506('0x9'));var squel=require('squel');var crypto=require(_0xf506('0xa'));var jsforce=require(_0xf506('0xb'));var deskjs=require(_0xf506('0xc'));var toCsv=require(_0xf506('0x7'));var querystring=require('querystring');var Papa=require(_0xf506('0xd'));var Redis=require(_0xf506('0xe'));var authService=require(_0xf506('0xf'));var qs=require(_0xf506('0x10'));var as=require(_0xf506('0x11'));var hardwareService=require(_0xf506('0x12'));var logger=require(_0xf506('0x13'))(_0xf506('0x14'));var utils=require(_0xf506('0x15'));var config=require(_0xf506('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf506('0x17'))['db'];function respondWithStatusCode(_0x13d52e,_0x2af049){_0x2af049=_0x2af049||0xcc;return function(_0x35ccfc){if(_0x35ccfc){return _0x13d52e[_0xf506('0x18')](_0x2af049);}return _0x13d52e['status'](_0x2af049)[_0xf506('0x19')]();};}function respondWithResult(_0x58944f,_0x1b5704){_0x1b5704=_0x1b5704||0xc8;return function(_0x33cf10){if(_0x33cf10){return _0x58944f[_0xf506('0x1a')](_0x1b5704)[_0xf506('0x1b')](_0x33cf10);}};}function respondWithFilteredResult(_0x9e7b5a,_0x5f04d7){return function(_0x2c61b7){if(_0x2c61b7){var _0x393ff2=typeof _0x5f04d7[_0xf506('0x1c')]===_0xf506('0x1d')&&typeof _0x5f04d7[_0xf506('0x1e')]==='undefined';var _0x1d3ed5=_0x2c61b7['count'];var _0x3e8ffa=_0x393ff2?0x0:_0x5f04d7[_0xf506('0x1c')];var _0x249329=_0x393ff2?_0x2c61b7[_0xf506('0x1f')]:_0x5f04d7[_0xf506('0x1c')]+_0x5f04d7[_0xf506('0x1e')];var _0x4c4556;if(_0x249329>=_0x1d3ed5){_0x249329=_0x1d3ed5;_0x4c4556=0xc8;}else{_0x4c4556=0xce;}_0x9e7b5a[_0xf506('0x1a')](_0x4c4556);return _0x9e7b5a[_0xf506('0x20')](_0xf506('0x21'),_0x3e8ffa+'-'+_0x249329+'/'+_0x1d3ed5)['json'](_0x2c61b7);}return null;};}function patchUpdates(_0x54c104){return function(_0x590585){try{jsonpatch[_0xf506('0x22')](_0x590585,_0x54c104,!![]);}catch(_0x3fec5){return BPromise[_0xf506('0x23')](_0x3fec5);}return _0x590585[_0xf506('0x24')]();};}function saveUpdates(_0x1c3578,_0x43de15){return function(_0x35cbf9){if(_0x35cbf9){return _0x35cbf9['update'](_0x1c3578)[_0xf506('0x25')](function(_0x40bb78){return _0x40bb78;});}return null;};}function removeEntity(_0x29de16,_0x21c298){return function(_0x10c3ac){if(_0x10c3ac){return _0x10c3ac[_0xf506('0x26')]()[_0xf506('0x25')](function(){_0x29de16[_0xf506('0x1a')](0xcc)[_0xf506('0x19')]();});}};}function handleEntityNotFound(_0x4606a8,_0x493580){return function(_0x2b279e){if(!_0x2b279e){_0x4606a8['sendStatus'](0x194);}return _0x2b279e;};}function handleError(_0x4dba69,_0x4819e6){_0x4819e6=_0x4819e6||0x1f4;return function(_0x4b707a){logger[_0xf506('0x27')](_0x4b707a[_0xf506('0x28')]);if(_0x4b707a[_0xf506('0x29')]){delete _0x4b707a[_0xf506('0x29')];}_0x4dba69[_0xf506('0x1a')](_0x4819e6)[_0xf506('0x2a')](_0x4b707a);};}exports['update']=function(_0x540bd7,_0x4e59aa){if(_0x540bd7[_0xf506('0x2b')]['id']){delete _0x540bd7[_0xf506('0x2b')]['id'];}return db['Action'][_0xf506('0x2c')]({'where':{'id':_0x540bd7[_0xf506('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4e59aa,null))[_0xf506('0x25')](saveUpdates(_0x540bd7[_0xf506('0x2b')],null))['then'](respondWithResult(_0x4e59aa,null))['catch'](handleError(_0x4e59aa,null));};exports['destroy']=function(_0x1f2e2f,_0x29a35c){return db[_0xf506('0x2e')][_0xf506('0x2c')]({'where':{'id':_0x1f2e2f[_0xf506('0x2d')]['id']}})[_0xf506('0x25')](handleEntityNotFound(_0x29a35c,null))[_0xf506('0x25')](removeEntity(_0x29a35c,null))[_0xf506('0x2f')](handleError(_0x29a35c,null));}; \ No newline at end of file +var _0x5c01=['sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','error','name','send','body','Action','params','catch','destroy','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x36d8d9,_0x17b58a){var _0x1ac3a2=function(_0x392196){while(--_0x392196){_0x36d8d9['push'](_0x36d8d9['shift']());}};_0x1ac3a2(++_0x17b58a);}(_0x5c01,0x9c));var _0x15c0=function(_0x53bce7,_0x45d347){_0x53bce7=_0x53bce7-0x0;var _0x365f9c=_0x5c01[_0x53bce7];return _0x365f9c;};'use strict';var emlformat=require(_0x15c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15c0('0x2'));var moment=require('moment');var BPromise=require(_0x15c0('0x3'));var Mustache=require('mustache');var util=require(_0x15c0('0x4'));var path=require(_0x15c0('0x5'));var sox=require('sox');var csv=require(_0x15c0('0x6'));var ejs=require(_0x15c0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15c0('0x8'));var squel=require(_0x15c0('0x9'));var crypto=require(_0x15c0('0xa'));var jsforce=require(_0x15c0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x15c0('0x6'));var querystring=require(_0x15c0('0xc'));var Papa=require(_0x15c0('0xd'));var Redis=require(_0x15c0('0xe'));var authService=require(_0x15c0('0xf'));var qs=require(_0x15c0('0x10'));var as=require(_0x15c0('0x11'));var hardwareService=require(_0x15c0('0x12'));var logger=require(_0x15c0('0x13'))('api');var utils=require(_0x15c0('0x14'));var config=require(_0x15c0('0x15'));var licenseUtil=require(_0x15c0('0x16'));var db=require(_0x15c0('0x17'))['db'];function respondWithStatusCode(_0x499b15,_0x54fb5b){_0x54fb5b=_0x54fb5b||0xcc;return function(_0x112723){if(_0x112723){return _0x499b15[_0x15c0('0x18')](_0x54fb5b);}return _0x499b15[_0x15c0('0x19')](_0x54fb5b)['end']();};}function respondWithResult(_0x53071b,_0x4d1e43){_0x4d1e43=_0x4d1e43||0xc8;return function(_0x453a38){if(_0x453a38){return _0x53071b[_0x15c0('0x19')](_0x4d1e43)[_0x15c0('0x1a')](_0x453a38);}};}function respondWithFilteredResult(_0x5e6c3c,_0x5f2441){return function(_0x967689){if(_0x967689){var _0x594173=typeof _0x5f2441[_0x15c0('0x1b')]===_0x15c0('0x1c')&&typeof _0x5f2441[_0x15c0('0x1d')]===_0x15c0('0x1c');var _0x2600e2=_0x967689['count'];var _0x447e47=_0x594173?0x0:_0x5f2441[_0x15c0('0x1b')];var _0x3e744d=_0x594173?_0x967689[_0x15c0('0x1e')]:_0x5f2441[_0x15c0('0x1b')]+_0x5f2441[_0x15c0('0x1d')];var _0x489a9b;if(_0x3e744d>=_0x2600e2){_0x3e744d=_0x2600e2;_0x489a9b=0xc8;}else{_0x489a9b=0xce;}_0x5e6c3c[_0x15c0('0x19')](_0x489a9b);return _0x5e6c3c['set'](_0x15c0('0x1f'),_0x447e47+'-'+_0x3e744d+'/'+_0x2600e2)[_0x15c0('0x1a')](_0x967689);}return null;};}function patchUpdates(_0x2b18d4){return function(_0x3d0d54){try{jsonpatch[_0x15c0('0x20')](_0x3d0d54,_0x2b18d4,!![]);}catch(_0x1bdfae){return BPromise[_0x15c0('0x21')](_0x1bdfae);}return _0x3d0d54['save']();};}function saveUpdates(_0xdf58ba,_0x4df91e){return function(_0x322146){if(_0x322146){return _0x322146[_0x15c0('0x22')](_0xdf58ba)['then'](function(_0x28cfba){return _0x28cfba;});}return null;};}function removeEntity(_0x4c7c04,_0x26878d){return function(_0x4af80b){if(_0x4af80b){return _0x4af80b['destroy']()[_0x15c0('0x23')](function(){_0x4c7c04[_0x15c0('0x19')](0xcc)[_0x15c0('0x24')]();});}};}function handleEntityNotFound(_0x1d7129,_0x50528c){return function(_0x722ca1){if(!_0x722ca1){_0x1d7129['sendStatus'](0x194);}return _0x722ca1;};}function handleError(_0x492ae7,_0x362d0f){_0x362d0f=_0x362d0f||0x1f4;return function(_0x36f45c){logger[_0x15c0('0x25')](_0x36f45c['stack']);if(_0x36f45c['name']){delete _0x36f45c[_0x15c0('0x26')];}_0x492ae7['status'](_0x362d0f)[_0x15c0('0x27')](_0x36f45c);};}exports[_0x15c0('0x22')]=function(_0x2c279f,_0x458f78){if(_0x2c279f[_0x15c0('0x28')]['id']){delete _0x2c279f['body']['id'];}return db[_0x15c0('0x29')]['find']({'where':{'id':_0x2c279f[_0x15c0('0x2a')]['id']}})[_0x15c0('0x23')](handleEntityNotFound(_0x458f78,null))[_0x15c0('0x23')](saveUpdates(_0x2c279f[_0x15c0('0x28')],null))['then'](respondWithResult(_0x458f78,null))[_0x15c0('0x2b')](handleError(_0x458f78,null));};exports[_0x15c0('0x2c')]=function(_0x342808,_0x121c26){return db[_0x15c0('0x29')]['find']({'where':{'id':_0x342808[_0x15c0('0x2a')]['id']}})[_0x15c0('0x23')](handleEntityNotFound(_0x121c26,null))[_0x15c0('0x23')](removeEntity(_0x121c26,null))[_0x15c0('0x2b')](handleError(_0x121c26,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 520608e..778c528 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 _0x0d35=['bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x102b9f,_0x661060){var _0x42c57d=function(_0x5500c2){while(--_0x5500c2){_0x102b9f['push'](_0x102b9f['shift']());}};_0x42c57d(++_0x661060);}(_0x0d35,0x8a));var _0x50d3=function(_0x233cb3,_0x4c83af){_0x233cb3=_0x233cb3-0x0;var _0x4209cd=_0x0d35[_0x233cb3];return _0x4209cd;};'use strict';var _=require(_0x50d3('0x0'));var util=require(_0x50d3('0x1'));var logger=require(_0x50d3('0x2'))(_0x50d3('0x3'));var moment=require(_0x50d3('0x4'));var BPromise=require(_0x50d3('0x5'));var rp=require(_0x50d3('0x6'));var fs=require('fs');var path=require(_0x50d3('0x7'));var rimraf=require(_0x50d3('0x8'));var config=require(_0x50d3('0x9'));var attributes=require(_0x50d3('0xa'));module['exports']=function(_0x2baa8b,_0x3caca2){return _0x2baa8b[_0x50d3('0xb')]('Action',attributes,{'tableName':_0x50d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd17e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','Action'];(function(_0x22dd17,_0x3afc41){var _0x56d886=function(_0x28c512){while(--_0x28c512){_0x22dd17['push'](_0x22dd17['shift']());}};_0x56d886(++_0x3afc41);}(_0xd17e,0x16c));var _0xed17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd17e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xed17('0x0'));var util=require(_0xed17('0x1'));var logger=require(_0xed17('0x2'))(_0xed17('0x3'));var moment=require(_0xed17('0x4'));var BPromise=require(_0xed17('0x5'));var rp=require(_0xed17('0x6'));var fs=require('fs');var path=require(_0xed17('0x7'));var rimraf=require(_0xed17('0x8'));var config=require(_0xed17('0x9'));var attributes=require(_0xed17('0xa'));module[_0xed17('0xb')]=function(_0xb652b6,_0x78972e){return _0xb652b6['define'](_0xed17('0xc'),attributes,{'tableName':'tools_actions','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 7473f96..366f60d 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 _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(_0x301bd7,_0x112dad){var _0x2605c9=function(_0x563e1b){while(--_0x563e1b){_0x301bd7['push'](_0x301bd7['shift']());}};_0x2605c9(++_0x112dad);}(_0x5fc3,0xa8));var _0x35fc=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x5fc3[_0x72a33d];return _0x2621d5;};'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 +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x526fd4,_0x1c6bb1){var _0x1f1ae2=function(_0x3c89da){while(--_0x3c89da){_0x526fd4['push'](_0x526fd4['shift']());}};_0x1f1ae2(++_0x1c6bb1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 01c86f9..ce2ae00 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 _0x0c00=['Router','fs-extra','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0c00,0x106));var _0x00c0=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x0c00[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require('multer');var util=require(_0x00c0('0x0'));var path=require(_0x00c0('0x1'));var timeout=require(_0x00c0('0x2'));var express=require(_0x00c0('0x3'));var router=express[_0x00c0('0x4')]();var fs_extra=require(_0x00c0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x00c0('0x6'));var controller=require(_0x00c0('0x7'));router['put'](_0x00c0('0x8'),auth[_0x00c0('0x9')](),controller[_0x00c0('0xa')]);router[_0x00c0('0xb')](_0x00c0('0x8'),auth['isAuthenticated'](),controller[_0x00c0('0xc')]);module[_0x00c0('0xd')]=router; \ No newline at end of file +var _0x9a00=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x9a00,0x1af));var _0x09a0=function(_0x6d8a8f,_0x887e9f){_0x6d8a8f=_0x6d8a8f-0x0;var _0x30b639=_0x9a00[_0x6d8a8f];return _0x30b639;};'use strict';var multer=require(_0x09a0('0x0'));var util=require(_0x09a0('0x1'));var path=require(_0x09a0('0x2'));var timeout=require(_0x09a0('0x3'));var express=require(_0x09a0('0x4'));var router=express[_0x09a0('0x5')]();var fs_extra=require(_0x09a0('0x6'));var auth=require(_0x09a0('0x7'));var interaction=require(_0x09a0('0x8'));var config=require(_0x09a0('0x9'));var controller=require(_0x09a0('0xa'));router[_0x09a0('0xb')]('/:id',auth[_0x09a0('0xc')](),controller[_0x09a0('0xd')]);router[_0x09a0('0xe')](_0x09a0('0xf'),auth['isAuthenticated'](),controller[_0x09a0('0x10')]);module[_0x09a0('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 5569997..56e6550 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(_0x19b50e,_0x481072){var _0x29a4fa=function(_0x915d99){while(--_0x915d99){_0x19b50e['push'](_0x19b50e['shift']());}};_0x29a4fa(++_0x481072);}(_0xac9d,0x14d));var _0xdac9=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0xac9d[_0x232cf2];return _0x463cec;};'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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2416a4,_0x49f357){_0x2416a4=_0x2416a4-0x0;var _0x117415=_0xb4c7[_0x2416a4];return _0x117415;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b9b8e8c..8b6fa0c 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 _0xc8a3=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','AnalyticCustomReport','include','findAll','rows','catch','length','includeAll','find','create','user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','metric','function','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','MIN(%s)','from','table','MetricId','DESC','web','fullPath','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','QueryTypes','SELECT','run','cross_join','IS\x20NOT\x20EMPTY','debug','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc8a3,0x137));var _0x3c8a=function(_0xcf0252,_0x334a66){_0xcf0252=_0xcf0252-0x0;var _0x194a41=_0xc8a3[_0xcf0252];return _0x194a41;};'use strict';var emlformat=require(_0x3c8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c8a('0x1'));var jsonpatch=require(_0x3c8a('0x2'));var rp=require(_0x3c8a('0x3'));var moment=require('moment');var BPromise=require(_0x3c8a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3c8a('0x5'));var sox=require('sox');var csv=require(_0x3c8a('0x6'));var ejs=require(_0x3c8a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3c8a('0x8'));var crypto=require(_0x3c8a('0x9'));var jsforce=require(_0x3c8a('0xa'));var deskjs=require(_0x3c8a('0xb'));var toCsv=require(_0x3c8a('0x6'));var querystring=require(_0x3c8a('0xc'));var Papa=require(_0x3c8a('0xd'));var Redis=require(_0x3c8a('0xe'));var authService=require(_0x3c8a('0xf'));var qs=require(_0x3c8a('0x10'));var as=require(_0x3c8a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c8a('0x12'))(_0x3c8a('0x13'));var utils=require(_0x3c8a('0x14'));var config=require(_0x3c8a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x3c8a('0x16'))[_0x3c8a('0x17')];function respondWithStatusCode(_0x5de041,_0x382e65){_0x382e65=_0x382e65||0xcc;return function(_0x3605a4){if(_0x3605a4){return _0x5de041[_0x3c8a('0x18')](_0x382e65);}return _0x5de041[_0x3c8a('0x19')](_0x382e65)['end']();};}function respondWithResult(_0x382816,_0x43c867){_0x43c867=_0x43c867||0xc8;return function(_0x24aa2d){if(_0x24aa2d){return _0x382816['status'](_0x43c867)['json'](_0x24aa2d);}};}function respondWithFilteredResult(_0x307d63,_0x3a06c3){return function(_0x343159){if(_0x343159){var _0x54eb61=typeof _0x3a06c3[_0x3c8a('0x1a')]==='undefined'&&typeof _0x3a06c3[_0x3c8a('0x1b')]===_0x3c8a('0x1c');var _0x15834d=_0x343159['count'];var _0x6f42b6=_0x54eb61?0x0:_0x3a06c3[_0x3c8a('0x1a')];var _0x191e21=_0x54eb61?_0x343159[_0x3c8a('0x1d')]:_0x3a06c3[_0x3c8a('0x1a')]+_0x3a06c3[_0x3c8a('0x1b')];var _0xd418c5;if(_0x191e21>=_0x15834d){_0x191e21=_0x15834d;_0xd418c5=0xc8;}else{_0xd418c5=0xce;}_0x307d63[_0x3c8a('0x19')](_0xd418c5);return _0x307d63[_0x3c8a('0x1e')](_0x3c8a('0x1f'),_0x6f42b6+'-'+_0x191e21+'/'+_0x15834d)['json'](_0x343159);}return null;};}function patchUpdates(_0x25744f){return function(_0x161d1e){try{jsonpatch[_0x3c8a('0x20')](_0x161d1e,_0x25744f,!![]);}catch(_0x5dde5a){return BPromise[_0x3c8a('0x21')](_0x5dde5a);}return _0x161d1e[_0x3c8a('0x22')]();};}function saveUpdates(_0x10e339,_0x3cb653){return function(_0x41fe54){if(_0x41fe54){return _0x41fe54[_0x3c8a('0x23')](_0x10e339)['then'](function(_0x5261df){return _0x5261df;});}return null;};}function removeEntity(_0x4f9cea,_0x1517b1){return function(_0x35fdf5){if(_0x35fdf5){return _0x35fdf5[_0x3c8a('0x24')]()[_0x3c8a('0x25')](function(){var _0x4b6706=_0x35fdf5[_0x3c8a('0x26')]({'plain':!![]});var _0x2513e9='CustomReports';return db['UserProfileResource'][_0x3c8a('0x24')]({'where':{'type':_0x2513e9,'resourceId':_0x4b6706['id']}})[_0x3c8a('0x25')](function(){return _0x35fdf5;});})[_0x3c8a('0x25')](function(){_0x4f9cea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50aa30,_0x1727ca){return function(_0x2e0f33){if(!_0x2e0f33){_0x50aa30[_0x3c8a('0x18')](0x194);}return _0x2e0f33;};}function handleError(_0x2f664a,_0x1578c3){_0x1578c3=_0x1578c3||0x1f4;return function(_0x343ebd){logger[_0x3c8a('0x27')](_0x343ebd[_0x3c8a('0x28')]);if(_0x343ebd[_0x3c8a('0x29')]){delete _0x343ebd['name'];}_0x2f664a[_0x3c8a('0x19')](_0x1578c3)['send'](_0x343ebd);};}exports[_0x3c8a('0x2a')]=function(_0x500667,_0x21c0ec){var _0x3da438={},_0x403c65={},_0x2de87e={'count':0x0,'rows':[]};var _0x5a1229=_[_0x3c8a('0x2b')](db['AnalyticCustomReport'][_0x3c8a('0x2c')],function(_0xea0700){return{'name':_0xea0700[_0x3c8a('0x2d')],'type':_0xea0700[_0x3c8a('0x2e')][_0x3c8a('0x2f')]};});_0x403c65['model']=_['map'](_0x5a1229,_0x3c8a('0x29'));_0x403c65[_0x3c8a('0x30')]=_[_0x3c8a('0x31')](_0x500667['query']);_0x403c65[_0x3c8a('0x32')]=_[_0x3c8a('0x33')](_0x403c65[_0x3c8a('0x34')],_0x403c65[_0x3c8a('0x30')]);_0x3da438[_0x3c8a('0x35')]=_['intersection'](_0x403c65['model'],qs['fields'](_0x500667[_0x3c8a('0x30')][_0x3c8a('0x36')]));_0x3da438[_0x3c8a('0x35')]=_0x3da438['attributes']['length']?_0x3da438['attributes']:_0x403c65[_0x3c8a('0x34')];if(!_0x500667['query'][_0x3c8a('0x37')]('nolimit')){_0x3da438[_0x3c8a('0x1b')]=qs['limit'](_0x500667[_0x3c8a('0x30')][_0x3c8a('0x1b')]);_0x3da438[_0x3c8a('0x1a')]=qs[_0x3c8a('0x1a')](_0x500667[_0x3c8a('0x30')][_0x3c8a('0x1a')]);}_0x3da438[_0x3c8a('0x38')]=qs[_0x3c8a('0x39')](_0x500667[_0x3c8a('0x30')]['sort']);_0x3da438[_0x3c8a('0x3a')]=qs[_0x3c8a('0x32')](_[_0x3c8a('0x3b')](_0x500667[_0x3c8a('0x30')],_0x403c65[_0x3c8a('0x32')]),_0x5a1229);if(_0x500667[_0x3c8a('0x30')]['filter']){_0x3da438[_0x3c8a('0x3a')]=_['merge'](_0x3da438[_0x3c8a('0x3a')],{'$or':_[_0x3c8a('0x2b')](_0x5a1229,function(_0xb25365){if(_0xb25365['type']!==_0x3c8a('0x3c')){var _0xd8fd47={};_0xd8fd47[_0xb25365[_0x3c8a('0x29')]]={'$like':'%'+_0x500667[_0x3c8a('0x30')][_0x3c8a('0x3d')]+'%'};return _0xd8fd47;}})});}_0x3da438=_[_0x3c8a('0x3e')]({},_0x3da438,_0x500667[_0x3c8a('0x3f')]);var _0x1d9ac3={'where':_0x3da438['where']};return db[_0x3c8a('0x40')][_0x3c8a('0x1d')](_0x1d9ac3)['then'](function(_0x14a4d1){_0x2de87e[_0x3c8a('0x1d')]=_0x14a4d1;if(_0x500667['query']['includeAll']){_0x3da438[_0x3c8a('0x41')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x3c8a('0x42')](_0x3da438);})['then'](function(_0x4fd742){_0x2de87e[_0x3c8a('0x43')]=_0x4fd742;return _0x2de87e;})['then'](respondWithFilteredResult(_0x21c0ec,_0x3da438))[_0x3c8a('0x44')](handleError(_0x21c0ec,null));};exports['show']=function(_0x174ba6,_0xcb0c78){var _0x1e1eed={'raw':![],'where':{'id':_0x174ba6['params']['id']}},_0xc53a84={};_0xc53a84['model']=_[_0x3c8a('0x31')](db[_0x3c8a('0x40')][_0x3c8a('0x2c')]);_0xc53a84['query']=_['keys'](_0x174ba6[_0x3c8a('0x30')]);_0xc53a84[_0x3c8a('0x32')]=_[_0x3c8a('0x33')](_0xc53a84[_0x3c8a('0x34')],_0xc53a84[_0x3c8a('0x30')]);_0x1e1eed[_0x3c8a('0x35')]=_[_0x3c8a('0x33')](_0xc53a84[_0x3c8a('0x34')],qs[_0x3c8a('0x36')](_0x174ba6[_0x3c8a('0x30')][_0x3c8a('0x36')]));_0x1e1eed[_0x3c8a('0x35')]=_0x1e1eed['attributes'][_0x3c8a('0x45')]?_0x1e1eed[_0x3c8a('0x35')]:_0xc53a84['model'];if(_0x174ba6[_0x3c8a('0x30')][_0x3c8a('0x46')]){_0x1e1eed[_0x3c8a('0x41')]=[{'all':!![]}];}_0x1e1eed=_[_0x3c8a('0x3e')]({},_0x1e1eed,_0x174ba6[_0x3c8a('0x3f')]);return db[_0x3c8a('0x40')][_0x3c8a('0x47')](_0x1e1eed)[_0x3c8a('0x25')](handleEntityNotFound(_0xcb0c78,null))['then'](respondWithResult(_0xcb0c78,null))['catch'](handleError(_0xcb0c78,null));};exports['create']=function(_0x2f176f,_0x2b972e){return db[_0x3c8a('0x40')][_0x3c8a('0x48')](_0x2f176f['body'],{})['then'](function(_0x158b33){var _0x5d67a9=_0x2f176f[_0x3c8a('0x49')][_0x3c8a('0x26')]({'plain':!![]});if(!_0x5d67a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d67a9[_0x3c8a('0x4a')]==='user'){var _0x5bca8=_0x158b33['get']({'plain':!![]});var _0x3270bb=_0x3c8a('0x4b');return db[_0x3c8a('0x4c')][_0x3c8a('0x47')]({'where':{'name':_0x3270bb,'userProfileId':_0x5d67a9[_0x3c8a('0x4d')]},'raw':!![]})[_0x3c8a('0x25')](function(_0x4d903a){if(_0x4d903a&&_0x4d903a['autoAssociation']===0x0){return db[_0x3c8a('0x4e')][_0x3c8a('0x48')]({'name':_0x5bca8[_0x3c8a('0x29')],'resourceId':_0x5bca8['id'],'type':_0x3c8a('0x4f'),'sectionId':_0x4d903a['id']},{})[_0x3c8a('0x25')](function(){return _0x158b33;});}else{return _0x158b33;}})['catch'](function(_0x2a4906){logger[_0x3c8a('0x27')](_0x3c8a('0x50'),_0x2a4906);throw _0x2a4906;});}return _0x158b33;})[_0x3c8a('0x25')](respondWithResult(_0x2b972e,0xc9))[_0x3c8a('0x44')](handleError(_0x2b972e,null));};exports['update']=function(_0x53c7af,_0x39a45a){if(_0x53c7af[_0x3c8a('0x51')]['id']){delete _0x53c7af[_0x3c8a('0x51')]['id'];}return db[_0x3c8a('0x40')][_0x3c8a('0x47')]({'where':{'id':_0x53c7af['params']['id']}})[_0x3c8a('0x25')](handleEntityNotFound(_0x39a45a,null))[_0x3c8a('0x25')](saveUpdates(_0x53c7af['body'],null))[_0x3c8a('0x25')](respondWithResult(_0x39a45a,null))[_0x3c8a('0x44')](handleError(_0x39a45a,null));};exports[_0x3c8a('0x24')]=function(_0x33f658,_0x2d4a2e){return db['AnalyticCustomReport'][_0x3c8a('0x47')]({'where':{'id':_0x33f658[_0x3c8a('0x52')]['id']}})[_0x3c8a('0x25')](handleEntityNotFound(_0x2d4a2e,null))[_0x3c8a('0x25')](removeEntity(_0x2d4a2e,null))[_0x3c8a('0x44')](handleError(_0x2d4a2e,null));};exports[_0x3c8a('0x53')]=function(_0x46b53a,_0x2221b8){var _0x5dc16f=0xa;var _0x528642=[_0x3c8a('0x54'),_0x3c8a('0x55'),_0x3c8a('0x56'),'cross_join'];var _0x1717b5={'SUM':_0x3c8a('0x57'),'COUNT':_0x3c8a('0x58'),'COUNT DISTINCT':_0x3c8a('0x59'),'MAX':_0x3c8a('0x5a'),'MIN':'MIN(%s)','AVG':_0x3c8a('0x5b'),'GROUP_CONCAT':_0x3c8a('0x5c'),'GROUP_CONCAT ASC':_0x3c8a('0x5d'),'GROUP_CONCAT DESC':_0x3c8a('0x5e')};var _0x47dd82={'SEC_TO_TIME':_0x3c8a('0x5f'),'DATE':_0x3c8a('0x60'),'HOUR':_0x3c8a('0x61'),'ROUND':_0x3c8a('0x62'),'UNIX_TIMESTAMP':_0x3c8a('0x63')};var _0x18e370=function(_0x29a525){return!_[_0x3c8a('0x64')]([_0x3c8a('0x65'),_0x3c8a('0x66'),_0x3c8a('0x67'),'IS\x20NOT\x20EMPTY'],_0x29a525);};var _0x32448e=function(_0x3434a7){if(!_0x3434a7||!_0x3434a7['rules'][_0x3c8a('0x45')]){return'';}for(var _0x65c6f2='(',_0x891019=0x0;_0x891019<_0x3434a7[_0x3c8a('0x68')]['length'];_0x891019+=0x1){_0x891019>0x0&&(_0x65c6f2+='\x20'+_0x3434a7[_0x3c8a('0x69')]+'\x20');_0x65c6f2+=_0x3434a7['rules'][_0x891019][_0x3c8a('0x6a')]?_0x32448e(_0x3434a7[_0x3c8a('0x68')][_0x891019][_0x3c8a('0x6a')]):_0x3434a7[_0x3c8a('0x68')][_0x891019]['field']+'\x20'+_0x3434a7['rules'][_0x891019][_0x3c8a('0x6b')]+(_0x18e370(_0x3434a7[_0x3c8a('0x68')][_0x891019][_0x3c8a('0x6b')])?'\x20'+_0x3434a7['rules'][_0x891019][_0x3c8a('0x6c')]:'');}return _0x65c6f2+')';};var _0x4365df={'where':{'id':_0x46b53a['params']['id']}},_0x492387,_0x44993b,_0xf77dad,_0x2dabd7,_0x5a49c3;_0x4365df=_[_0x3c8a('0x3e')]({},_0x4365df,_0x46b53a['options']);return db[_0x3c8a('0x40')][_0x3c8a('0x47')](_0x4365df)['then'](function(_0x485e00){if(_0x485e00){_0x492387=_0x485e00;return _0x485e00[_0x3c8a('0x6d')]();}return null;})['then'](function(_0x119252){if(_0x119252){if(!_0x119252[_0x3c8a('0x45')]){throw new db[(_0x3c8a('0x6e'))][(_0x3c8a('0x6f'))](_0x3c8a('0x70'),0x193);}_0x44993b=_0x119252;return db[_0x3c8a('0x71')][_0x3c8a('0x42')]({'raw':!![]});}return null;})['then'](function(_0x48c0a0){if(_0x48c0a0){_0xf77dad=_[_0x3c8a('0x72')](_0x48c0a0,'id');var _0x2e8d49;var _0x4687cb=squel[_0x3c8a('0x73')]();_0x4687cb['from'](_0x492387['table']);for(var _0x47756c=0x0;_0x47756c<_0x44993b[_0x3c8a('0x45')];_0x47756c+=0x1){_0x2e8d49=_0x44993b[_0x47756c]['MetricId']?_0xf77dad[_0x44993b[_0x47756c]['MetricId']][_0x3c8a('0x74')]:_0x44993b[_0x47756c]['field'];_0x2e8d49=_0x44993b[_0x47756c][_0x3c8a('0x75')]?_[_0x3c8a('0x76')](_0x1717b5[_0x44993b[_0x47756c][_0x3c8a('0x75')]],'%s',_0x2e8d49):_0x2e8d49;_0x2e8d49=_0x44993b[_0x47756c][_0x3c8a('0x77')]?_[_0x3c8a('0x76')](_0x47dd82[_0x44993b[_0x47756c][_0x3c8a('0x77')]],'%s',_0x2e8d49):_0x2e8d49;if(_0x44993b[_0x47756c][_0x3c8a('0x78')]){_0x4687cb[_0x3c8a('0x6a')](_0x2e8d49);}_0x44993b[_0x47756c][_0x3c8a('0x79')]&&_0x4687cb[_0x3c8a('0x38')](_0x2e8d49,_0x44993b[_0x47756c][_0x3c8a('0x79')]==='DESC'?![]:!![]);_0x4687cb[_0x3c8a('0x7a')](_0x2e8d49,_0x44993b[_0x47756c][_0x3c8a('0x7b')]||_0x2e8d49);}if(_0x492387[_0x3c8a('0x7c')]){_0x492387[_0x3c8a('0x7c')]=JSON[_0x3c8a('0x7d')](_0x492387[_0x3c8a('0x7c')]);for(var _0x3450ea=0x0;_0x3450ea<_0x492387[_0x3c8a('0x7c')][_0x3c8a('0x45')];_0x3450ea+=0x1){if(_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x2e')]&&_[_0x3c8a('0x64')](_0x528642,_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x2e')])&&_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x7e')]&&_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x7f')]&&_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x80')]){_0x4687cb[_0x492387['joins'][_0x3450ea][_0x3c8a('0x2e')]](_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x7f')],null,util[_0x3c8a('0x77')](_0x3c8a('0x81'),_0x492387['table'],_0x492387[_0x3c8a('0x7c')][_0x3450ea]['parentKey'],_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x7f')],_0x492387[_0x3c8a('0x7c')][_0x3450ea][_0x3c8a('0x80')]));}}}if(_0x492387[_0x3c8a('0x82')]){_0x492387[_0x3c8a('0x82')]=JSON[_0x3c8a('0x7d')](_0x492387[_0x3c8a('0x82')]);_0x4687cb['where'](_0x32448e(_0x492387['conditions'][_0x3c8a('0x6a')]));}_0x5a49c3=_0x4687cb[_0x3c8a('0x83')]();_0x4687cb[_0x3c8a('0x1b')](_0x5dc16f);_0x4687cb['offset'](0x0);logger['debug'](_0x3c8a('0x84'),_0x4687cb[_0x3c8a('0x85')]());return dbH[_0x3c8a('0x86')][_0x3c8a('0x30')](_0x4687cb['toString'](),{'type':dbH[_0x3c8a('0x86')]['QueryTypes']['SELECT']});}})[_0x3c8a('0x25')](respondWithResult(_0x2221b8,null))[_0x3c8a('0x44')](handleError(_0x2221b8,null));};function runReport(_0xe374d0,_0x407a85,_0x2b4c30){var _0x3b6ed3=_0x407a85[_0x3c8a('0x29')];var _0x5ba752=0xa;var _0x1bfdb5=[_0x3c8a('0x54'),'left_join',_0x3c8a('0x56'),'cross_join'];var _0x417bbc={'SUM':_0x3c8a('0x57'),'COUNT':_0x3c8a('0x58'),'COUNT DISTINCT':_0x3c8a('0x59'),'MAX':_0x3c8a('0x5a'),'MIN':_0x3c8a('0x87'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3c8a('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5d6188={'SEC_TO_TIME':_0x3c8a('0x5f'),'DATE':'DATE(%s)','HOUR':_0x3c8a('0x61'),'ROUND':_0x3c8a('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x35ff23=function(_0x40fa87){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x40fa87);};var _0x31f74c=function(_0x44408c){if(!_0x44408c||!_0x44408c[_0x3c8a('0x68')][_0x3c8a('0x45')]){return'';}for(var _0x364d36='(',_0x4fac62=0x0;_0x4fac62<_0x44408c[_0x3c8a('0x68')]['length'];_0x4fac62+=0x1){_0x4fac62>0x0&&(_0x364d36+='\x20'+_0x44408c[_0x3c8a('0x69')]+'\x20');_0x364d36+=_0x44408c[_0x3c8a('0x68')][_0x4fac62][_0x3c8a('0x6a')]?_0x31f74c(_0x44408c[_0x3c8a('0x68')][_0x4fac62][_0x3c8a('0x6a')]):_0x44408c[_0x3c8a('0x68')][_0x4fac62][_0x3c8a('0x7a')]+'\x20'+_0x44408c['rules'][_0x4fac62]['condition']+(_0x35ff23(_0x44408c[_0x3c8a('0x68')][_0x4fac62][_0x3c8a('0x6b')])?'\x20'+_0x44408c[_0x3c8a('0x68')][_0x4fac62][_0x3c8a('0x6c')]:'');}return _0x364d36+')';};var _0x19462b={'where':{'id':_0xe374d0['id']}},_0x3a657c,_0x3e5bae,_0x4ba0e0,_0x15f46e,_0x4209c6;_0x19462b=_[_0x3c8a('0x3e')]({},_0x19462b,_0x2b4c30);return db[_0x3c8a('0x40')][_0x3c8a('0x47')](_0x19462b)[_0x3c8a('0x25')](function(_0x43cec0){if(_0x43cec0){_0x3a657c=_0x43cec0;return _0x43cec0['getFields']();}return null;})[_0x3c8a('0x25')](function(_0x1d44cf){if(_0x1d44cf){if(!_0x1d44cf[_0x3c8a('0x45')]){throw new db['Sequelize'][(_0x3c8a('0x6f'))](_0x3c8a('0x70'),0x193);}_0x3e5bae=_0x1d44cf;return db[_0x3c8a('0x71')]['findAll']({'raw':!![]});}return null;})[_0x3c8a('0x25')](function(_0x49099d){if(_0x49099d){_0x4ba0e0=_['keyBy'](_0x49099d,'id');var _0x5a9b45;var _0x2a64be=squel[_0x3c8a('0x73')]();_0x2a64be[_0x3c8a('0x88')](_0x3a657c[_0x3c8a('0x89')]);for(var _0x1031fd=0x0;_0x1031fd<_0x3e5bae[_0x3c8a('0x45')];_0x1031fd+=0x1){_0x5a9b45=_0x3e5bae[_0x1031fd][_0x3c8a('0x8a')]?_0x4ba0e0[_0x3e5bae[_0x1031fd][_0x3c8a('0x8a')]][_0x3c8a('0x74')]:_0x3e5bae[_0x1031fd][_0x3c8a('0x7a')];_0x5a9b45=_0x3e5bae[_0x1031fd][_0x3c8a('0x75')]?_['replace'](_0x417bbc[_0x3e5bae[_0x1031fd][_0x3c8a('0x75')]],'%s',_0x5a9b45):_0x5a9b45;_0x5a9b45=_0x3e5bae[_0x1031fd][_0x3c8a('0x77')]?_['replace'](_0x5d6188[_0x3e5bae[_0x1031fd]['format']],'%s',_0x5a9b45):_0x5a9b45;if(_0x3e5bae[_0x1031fd]['groupBy']){_0x2a64be['group'](_0x5a9b45);}_0x3e5bae[_0x1031fd][_0x3c8a('0x79')]&&_0x2a64be['order'](_0x5a9b45,_0x3e5bae[_0x1031fd][_0x3c8a('0x79')]===_0x3c8a('0x8b')?![]:!![]);_0x2a64be[_0x3c8a('0x7a')](_0x5a9b45,_0x3e5bae[_0x1031fd][_0x3c8a('0x7b')]||_0x5a9b45);}if(_0x3a657c['joins']){_0x3a657c[_0x3c8a('0x7c')]=JSON[_0x3c8a('0x7d')](_0x3a657c[_0x3c8a('0x7c')]);for(var _0x3241e4=0x0;_0x3241e4<_0x3a657c['joins'][_0x3c8a('0x45')];_0x3241e4+=0x1){if(_0x3a657c[_0x3c8a('0x7c')][_0x3241e4][_0x3c8a('0x2e')]&&_[_0x3c8a('0x64')](_0x1bfdb5,_0x3a657c['joins'][_0x3241e4][_0x3c8a('0x2e')])&&_0x3a657c[_0x3c8a('0x7c')][_0x3241e4]['parentKey']&&_0x3a657c['joins'][_0x3241e4][_0x3c8a('0x7f')]&&_0x3a657c[_0x3c8a('0x7c')][_0x3241e4]['foreignKey']){_0x2a64be[_0x3a657c['joins'][_0x3241e4][_0x3c8a('0x2e')]](_0x3a657c[_0x3c8a('0x7c')][_0x3241e4][_0x3c8a('0x7f')],null,util['format'](_0x3c8a('0x81'),_0x3a657c[_0x3c8a('0x89')],_0x3a657c[_0x3c8a('0x7c')][_0x3241e4]['parentKey'],_0x3a657c['joins'][_0x3241e4][_0x3c8a('0x7f')],_0x3a657c[_0x3c8a('0x7c')][_0x3241e4][_0x3c8a('0x80')]));}}}if(_0x3a657c['conditions']){_0x3a657c[_0x3c8a('0x82')]=JSON[_0x3c8a('0x7d')](_0x3a657c[_0x3c8a('0x82')]);_0x2a64be['where'](_0x31f74c(_0x3a657c[_0x3c8a('0x82')][_0x3c8a('0x6a')]));}_0x4209c6=_0x2a64be[_0x3c8a('0x83')]();_0x2a64be[_0x3c8a('0x1b')](_0x5ba752);_0x2a64be['offset'](0x0);return;}})[_0x3c8a('0x25')](function(){if(_0x407a85['output']===_0x3c8a('0x8c')){return null;}var _0x4ef7cb=_[_0x3c8a('0x3e')](_0x407a85,{'name':_0x407a85[_0x3c8a('0x8d')]||_0x407a85[_0x3c8a('0x29')]||_0x3a657c['name'],'basename':_0x3b6ed3,'savename':util[_0x3c8a('0x77')](_0x3c8a('0x8e'),_0x407a85[_0x3c8a('0x29')]||_0x3a657c[_0x3c8a('0x29')],require(_0x3c8a('0x8f'))['generate'](0x4),_0x407a85['output']||_0x3c8a('0x90')),'reportId':_0x3a657c['id'],'reportType':_0x3c8a('0x91')});return db['AnalyticExtractedReport'][_0x3c8a('0x48')](_0x4ef7cb,{'raw':!![]});})[_0x3c8a('0x25')](function(_0xce672e){if(_0x3a657c[_0x3c8a('0x89')]===_0x3c8a('0x92')){_0x4209c6[_0x3c8a('0x3a')](_0x3a657c[_0x3c8a('0x89')]+_0x3c8a('0x93'),_0x407a85[_0x3c8a('0x94')],_0x407a85[_0x3c8a('0x95')]);}else{_0x4209c6[_0x3c8a('0x3a')](_0x3a657c['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x407a85['startDate'],_0x407a85['endDate']);}if(_0xce672e){logger['info'](_0x3c8a('0x96'),_0x4209c6['toString']());require(_0x3c8a('0x97'))[_0x3c8a('0x98')](path[_0x3c8a('0x54')](__dirname,_0x3c8a('0x99'),_0xce672e[_0x3c8a('0x9a')]),[_0xce672e['id'],_0x4209c6['toString'](),path[_0x3c8a('0x54')](__dirname,_0x3c8a('0x9b'),_0xce672e[_0x3c8a('0x9c')]),_0x3b6ed3]);return _0xce672e;}else{var _0x3227f3=squel[_0x3c8a('0x73')]();_0x3227f3[_0x3c8a('0x88')]('('+_0x4209c6['toString']()+')',_0x3c8a('0x9d'));_0x3227f3[_0x3c8a('0x7a')]('COUNT(*)','count');_0x4209c6['limit'](_0x407a85[_0x3c8a('0x1b')]||_0x5ba752);_0x4209c6['offset'](_0x407a85[_0x3c8a('0x1a')]||0x0);return dbH[_0x3c8a('0x86')][_0x3c8a('0x30')](_0x3227f3[_0x3c8a('0x85')](),{'type':dbH[_0x3c8a('0x86')][_0x3c8a('0x9e')][_0x3c8a('0x9f')]})[_0x3c8a('0x25')](function(_0x3974c2){if(!_0x3974c2[_0x3c8a('0x45')]){_0x15f46e=0x0;}else{_0x15f46e=_0x3974c2[0x0][_0x3c8a('0x1d')]||0x0;}return dbH[_0x3c8a('0x86')]['query'](_0x4209c6[_0x3c8a('0x85')](),{'type':dbH[_0x3c8a('0x86')][_0x3c8a('0x9e')][_0x3c8a('0x9f')]});})[_0x3c8a('0x25')](function(_0x53a0a3){return{'rows':_0x53a0a3||[],'count':_0x15f46e};});}});}exports[_0x3c8a('0xa0')]=function(_0xa5fc8e,_0x23d890){return runReport(_0xa5fc8e['params'],_0xa5fc8e[_0x3c8a('0x30')],_0xa5fc8e[_0x3c8a('0x3f')])[_0x3c8a('0x25')](respondWithResult(_0x23d890,null))[_0x3c8a('0x44')](handleError(_0x23d890,null));};exports['runReport']=runReport;exports[_0x3c8a('0x30')]=function(_0x38d6d0,_0x4d7a46){var _0x1012a4=0xa;var _0x1d8043=[_0x3c8a('0x54'),_0x3c8a('0x55'),_0x3c8a('0x56'),_0x3c8a('0xa1')];var _0x1858d3={'SUM':_0x3c8a('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3c8a('0x59'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x3c8a('0x5b'),'GROUP_CONCAT':_0x3c8a('0x5c'),'GROUP_CONCAT ASC':_0x3c8a('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1d98ae={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3c8a('0x60'),'HOUR':_0x3c8a('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3c8a('0x63')};var _0x596ced=function(_0x480301){return!_[_0x3c8a('0x64')]([_0x3c8a('0x65'),_0x3c8a('0x66'),'IS\x20EMPTY',_0x3c8a('0xa2')],_0x480301);};var _0x1f1eef=function(_0x5befb2){if(!_0x5befb2||!_0x5befb2[_0x3c8a('0x68')]['length']){return'';}for(var _0xca0e6b='(',_0xfa2b21=0x0;_0xfa2b21<_0x5befb2[_0x3c8a('0x68')][_0x3c8a('0x45')];_0xfa2b21+=0x1){_0xfa2b21>0x0&&(_0xca0e6b+='\x20'+_0x5befb2['operator']+'\x20');_0xca0e6b+=_0x5befb2[_0x3c8a('0x68')][_0xfa2b21][_0x3c8a('0x6a')]?_0x1f1eef(_0x5befb2[_0x3c8a('0x68')][_0xfa2b21][_0x3c8a('0x6a')]):_0x5befb2[_0x3c8a('0x68')][_0xfa2b21][_0x3c8a('0x7a')]+'\x20'+_0x5befb2['rules'][_0xfa2b21][_0x3c8a('0x6b')]+(_0x596ced(_0x5befb2[_0x3c8a('0x68')][_0xfa2b21][_0x3c8a('0x6b')])?'\x20'+_0x5befb2[_0x3c8a('0x68')][_0xfa2b21][_0x3c8a('0x6c')]:'');}return _0xca0e6b+')';};var _0x29b6e9={'where':{'id':_0x38d6d0[_0x3c8a('0x52')]['id']}},_0xd3c758,_0x459b02,_0x43ae72,_0x2ba81c,_0x476786;_0x29b6e9=_[_0x3c8a('0x3e')]({},_0x29b6e9,_0x38d6d0[_0x3c8a('0x3f')]);return db[_0x3c8a('0x40')][_0x3c8a('0x47')](_0x29b6e9)['then'](function(_0x411622){if(_0x411622){_0xd3c758=_0x411622;return _0x411622[_0x3c8a('0x6d')]();}return null;})[_0x3c8a('0x25')](function(_0x468239){if(_0x468239){if(!_0x468239[_0x3c8a('0x45')]){throw new db[(_0x3c8a('0x6e'))]['ValidationErrorItem'](_0x3c8a('0x70'),0x193);}_0x459b02=_0x468239;return db[_0x3c8a('0x71')][_0x3c8a('0x42')]({'raw':!![]});}return null;})[_0x3c8a('0x25')](function(_0x1585a7){if(_0x1585a7){_0x43ae72=_[_0x3c8a('0x72')](_0x1585a7,'id');var _0x2caa1f;var _0x13bf0e=squel[_0x3c8a('0x73')]();_0x13bf0e[_0x3c8a('0x88')](_0xd3c758[_0x3c8a('0x89')]);for(var _0x6931dd=0x0;_0x6931dd<_0x459b02['length'];_0x6931dd+=0x1){_0x2caa1f=_0x459b02[_0x6931dd][_0x3c8a('0x8a')]?_0x43ae72[_0x459b02[_0x6931dd]['MetricId']][_0x3c8a('0x74')]:_0x459b02[_0x6931dd][_0x3c8a('0x7a')];_0x2caa1f=_0x459b02[_0x6931dd][_0x3c8a('0x75')]?_['replace'](_0x1858d3[_0x459b02[_0x6931dd][_0x3c8a('0x75')]],'%s',_0x2caa1f):_0x2caa1f;_0x2caa1f=_0x459b02[_0x6931dd][_0x3c8a('0x77')]?_['replace'](_0x1d98ae[_0x459b02[_0x6931dd][_0x3c8a('0x77')]],'%s',_0x2caa1f):_0x2caa1f;if(_0x459b02[_0x6931dd][_0x3c8a('0x78')]){_0x13bf0e['group'](_0x2caa1f);}_0x459b02[_0x6931dd]['orderBy']&&_0x13bf0e[_0x3c8a('0x38')](_0x2caa1f,_0x459b02[_0x6931dd][_0x3c8a('0x79')]===_0x3c8a('0x8b')?![]:!![]);_0x13bf0e['field'](_0x2caa1f,_0x459b02[_0x6931dd]['alias']||_0x2caa1f);}if(_0xd3c758['joins']){_0xd3c758['joins']=JSON[_0x3c8a('0x7d')](_0xd3c758[_0x3c8a('0x7c')]);for(var _0x2d72ff=0x0;_0x2d72ff<_0xd3c758[_0x3c8a('0x7c')][_0x3c8a('0x45')];_0x2d72ff+=0x1){if(_0xd3c758[_0x3c8a('0x7c')][_0x2d72ff][_0x3c8a('0x2e')]&&_[_0x3c8a('0x64')](_0x1d8043,_0xd3c758[_0x3c8a('0x7c')][_0x2d72ff][_0x3c8a('0x2e')])&&_0xd3c758[_0x3c8a('0x7c')][_0x2d72ff][_0x3c8a('0x7e')]&&_0xd3c758['joins'][_0x2d72ff][_0x3c8a('0x7f')]&&_0xd3c758[_0x3c8a('0x7c')][_0x2d72ff]['foreignKey']){_0x13bf0e[_0xd3c758[_0x3c8a('0x7c')][_0x2d72ff][_0x3c8a('0x2e')]](_0xd3c758[_0x3c8a('0x7c')][_0x2d72ff][_0x3c8a('0x7f')],null,util[_0x3c8a('0x77')](_0x3c8a('0x81'),_0xd3c758['table'],_0xd3c758[_0x3c8a('0x7c')][_0x2d72ff][_0x3c8a('0x7e')],_0xd3c758['joins'][_0x2d72ff][_0x3c8a('0x7f')],_0xd3c758['joins'][_0x2d72ff][_0x3c8a('0x80')]));}}}if(_0xd3c758[_0x3c8a('0x82')]){_0xd3c758[_0x3c8a('0x82')]=JSON[_0x3c8a('0x7d')](_0xd3c758['conditions']);_0x13bf0e[_0x3c8a('0x3a')](_0x1f1eef(_0xd3c758[_0x3c8a('0x82')][_0x3c8a('0x6a')]));}_0x476786=_0x13bf0e['clone']();_0x13bf0e[_0x3c8a('0x1b')](_0x1012a4);_0x13bf0e[_0x3c8a('0x1a')](0x0);logger[_0x3c8a('0xa3')](_0x3c8a('0x84'),_0x13bf0e['toString']());return dbH[_0x3c8a('0x86')]['query'](_0x13bf0e[_0x3c8a('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0x3c8a('0x9f')]});}})[_0x3c8a('0x25')](function(){return{'sql':_0x476786['toString']()};})[_0x3c8a('0x25')](respondWithResult(_0x4d7a46,null))[_0x3c8a('0x44')](handleError(_0x4d7a46,null));}; \ No newline at end of file +var _0xb6db=['.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','IS\x20NOT\x20EMPTY','debug','Limited\x20Query:','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','includes','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','clone','toString','sequelize','QueryTypes','SELECT','value','getFields','from','conditions','parse','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr'];(function(_0x3b6801,_0x4cd6ed){var _0x556c21=function(_0x3ff77e){while(--_0x3ff77e){_0x3b6801['push'](_0x3b6801['shift']());}};_0x556c21(++_0x4cd6ed);}(_0xb6db,0x16a));var _0xbb6d=function(_0x4fc88c,_0x1e9f12){_0x4fc88c=_0x4fc88c-0x0;var _0x104b7d=_0xb6db[_0x4fc88c];return _0x104b7d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbb6d('0x0'));var jsonpatch=require(_0xbb6d('0x1'));var rp=require(_0xbb6d('0x2'));var moment=require(_0xbb6d('0x3'));var BPromise=require(_0xbb6d('0x4'));var Mustache=require('mustache');var util=require(_0xbb6d('0x5'));var path=require(_0xbb6d('0x6'));var sox=require(_0xbb6d('0x7'));var csv=require(_0xbb6d('0x8'));var ejs=require(_0xbb6d('0x9'));var fs=require('fs');var fs_extra=require(_0xbb6d('0xa'));var _=require(_0xbb6d('0xb'));var squel=require(_0xbb6d('0xc'));var crypto=require(_0xbb6d('0xd'));var jsforce=require(_0xbb6d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbb6d('0x8'));var querystring=require(_0xbb6d('0xf'));var Papa=require('papaparse');var Redis=require(_0xbb6d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb6d('0x11'));var as=require(_0xbb6d('0x12'));var hardwareService=require(_0xbb6d('0x13'));var logger=require(_0xbb6d('0x14'))(_0xbb6d('0x15'));var utils=require(_0xbb6d('0x16'));var config=require(_0xbb6d('0x17'));var licenseUtil=require(_0xbb6d('0x18'));var db=require(_0xbb6d('0x19'))['db'];var dbH=require(_0xbb6d('0x19'))[_0xbb6d('0x1a')];function respondWithStatusCode(_0x22620b,_0x54b2fc){_0x54b2fc=_0x54b2fc||0xcc;return function(_0x532588){if(_0x532588){return _0x22620b[_0xbb6d('0x1b')](_0x54b2fc);}return _0x22620b['status'](_0x54b2fc)[_0xbb6d('0x1c')]();};}function respondWithResult(_0xe04d72,_0x5006a2){_0x5006a2=_0x5006a2||0xc8;return function(_0x900337){if(_0x900337){return _0xe04d72[_0xbb6d('0x1d')](_0x5006a2)[_0xbb6d('0x1e')](_0x900337);}};}function respondWithFilteredResult(_0x4650fe,_0x595f98){return function(_0xce4804){if(_0xce4804){var _0x48a759=typeof _0x595f98[_0xbb6d('0x1f')]===_0xbb6d('0x20')&&typeof _0x595f98[_0xbb6d('0x21')]===_0xbb6d('0x20');var _0x218385=_0xce4804[_0xbb6d('0x22')];var _0xc157f2=_0x48a759?0x0:_0x595f98[_0xbb6d('0x1f')];var _0xd4aff5=_0x48a759?_0xce4804['count']:_0x595f98['offset']+_0x595f98['limit'];var _0xd61c30;if(_0xd4aff5>=_0x218385){_0xd4aff5=_0x218385;_0xd61c30=0xc8;}else{_0xd61c30=0xce;}_0x4650fe[_0xbb6d('0x1d')](_0xd61c30);return _0x4650fe[_0xbb6d('0x23')](_0xbb6d('0x24'),_0xc157f2+'-'+_0xd4aff5+'/'+_0x218385)[_0xbb6d('0x1e')](_0xce4804);}return null;};}function patchUpdates(_0x853615){return function(_0x14f458){try{jsonpatch[_0xbb6d('0x25')](_0x14f458,_0x853615,!![]);}catch(_0x4a9e1f){return BPromise[_0xbb6d('0x26')](_0x4a9e1f);}return _0x14f458[_0xbb6d('0x27')]();};}function saveUpdates(_0x13dbc1,_0x70df80){return function(_0x3d185b){if(_0x3d185b){return _0x3d185b[_0xbb6d('0x28')](_0x13dbc1)[_0xbb6d('0x29')](function(_0x4c6f89){return _0x4c6f89;});}return null;};}function removeEntity(_0x31259c,_0x5eebda){return function(_0xff8d42){if(_0xff8d42){return _0xff8d42[_0xbb6d('0x2a')]()[_0xbb6d('0x29')](function(){var _0x4ee1af=_0xff8d42[_0xbb6d('0x2b')]({'plain':!![]});var _0x58caa0=_0xbb6d('0x2c');return db[_0xbb6d('0x2d')][_0xbb6d('0x2a')]({'where':{'type':_0x58caa0,'resourceId':_0x4ee1af['id']}})[_0xbb6d('0x29')](function(){return _0xff8d42;});})[_0xbb6d('0x29')](function(){_0x31259c['status'](0xcc)[_0xbb6d('0x1c')]();});}};}function handleEntityNotFound(_0x342482,_0xd6e32a){return function(_0x3165ba){if(!_0x3165ba){_0x342482[_0xbb6d('0x1b')](0x194);}return _0x3165ba;};}function handleError(_0x2dd4fd,_0x4a44f7){_0x4a44f7=_0x4a44f7||0x1f4;return function(_0x2a5818){logger[_0xbb6d('0x2e')](_0x2a5818[_0xbb6d('0x2f')]);if(_0x2a5818[_0xbb6d('0x30')]){delete _0x2a5818[_0xbb6d('0x30')];}_0x2dd4fd[_0xbb6d('0x1d')](_0x4a44f7)['send'](_0x2a5818);};}exports[_0xbb6d('0x31')]=function(_0x23d7e6,_0x5e1354){var _0x54669c={},_0x99ef82={},_0x276cc9={'count':0x0,'rows':[]};var _0x36e3cb=_[_0xbb6d('0x32')](db[_0xbb6d('0x33')][_0xbb6d('0x34')],function(_0x27ad23){return{'name':_0x27ad23[_0xbb6d('0x35')],'type':_0x27ad23[_0xbb6d('0x36')][_0xbb6d('0x37')]};});_0x99ef82[_0xbb6d('0x38')]=_[_0xbb6d('0x32')](_0x36e3cb,_0xbb6d('0x30'));_0x99ef82[_0xbb6d('0x39')]=_[_0xbb6d('0x3a')](_0x23d7e6[_0xbb6d('0x39')]);_0x99ef82[_0xbb6d('0x3b')]=_[_0xbb6d('0x3c')](_0x99ef82[_0xbb6d('0x38')],_0x99ef82[_0xbb6d('0x39')]);_0x54669c['attributes']=_['intersection'](_0x99ef82[_0xbb6d('0x38')],qs[_0xbb6d('0x3d')](_0x23d7e6[_0xbb6d('0x39')][_0xbb6d('0x3d')]));_0x54669c['attributes']=_0x54669c[_0xbb6d('0x3e')]['length']?_0x54669c[_0xbb6d('0x3e')]:_0x99ef82[_0xbb6d('0x38')];if(!_0x23d7e6[_0xbb6d('0x39')][_0xbb6d('0x3f')](_0xbb6d('0x40'))){_0x54669c[_0xbb6d('0x21')]=qs[_0xbb6d('0x21')](_0x23d7e6[_0xbb6d('0x39')]['limit']);_0x54669c[_0xbb6d('0x1f')]=qs['offset'](_0x23d7e6[_0xbb6d('0x39')][_0xbb6d('0x1f')]);}_0x54669c[_0xbb6d('0x41')]=qs[_0xbb6d('0x42')](_0x23d7e6[_0xbb6d('0x39')][_0xbb6d('0x42')]);_0x54669c[_0xbb6d('0x43')]=qs['filters'](_[_0xbb6d('0x44')](_0x23d7e6[_0xbb6d('0x39')],_0x99ef82[_0xbb6d('0x3b')]),_0x36e3cb);if(_0x23d7e6['query'][_0xbb6d('0x45')]){_0x54669c[_0xbb6d('0x43')]=_['merge'](_0x54669c[_0xbb6d('0x43')],{'$or':_['map'](_0x36e3cb,function(_0x5607c7){if(_0x5607c7[_0xbb6d('0x36')]!=='VIRTUAL'){var _0x280f6c={};_0x280f6c[_0x5607c7[_0xbb6d('0x30')]]={'$like':'%'+_0x23d7e6[_0xbb6d('0x39')][_0xbb6d('0x45')]+'%'};return _0x280f6c;}})});}_0x54669c=_[_0xbb6d('0x46')]({},_0x54669c,_0x23d7e6[_0xbb6d('0x47')]);var _0x355b52={'where':_0x54669c[_0xbb6d('0x43')]};return db['AnalyticCustomReport'][_0xbb6d('0x22')](_0x355b52)[_0xbb6d('0x29')](function(_0x49e8cf){_0x276cc9[_0xbb6d('0x22')]=_0x49e8cf;if(_0x23d7e6[_0xbb6d('0x39')][_0xbb6d('0x48')]){_0x54669c[_0xbb6d('0x49')]=[{'all':!![]}];}return db[_0xbb6d('0x33')][_0xbb6d('0x4a')](_0x54669c);})[_0xbb6d('0x29')](function(_0x332ec9){_0x276cc9[_0xbb6d('0x4b')]=_0x332ec9;return _0x276cc9;})['then'](respondWithFilteredResult(_0x5e1354,_0x54669c))[_0xbb6d('0x4c')](handleError(_0x5e1354,null));};exports[_0xbb6d('0x4d')]=function(_0x432e41,_0x3c4bce){var _0x4ff59={'raw':![],'where':{'id':_0x432e41[_0xbb6d('0x4e')]['id']}},_0x11676e={};_0x11676e['model']=_['keys'](db[_0xbb6d('0x33')]['rawAttributes']);_0x11676e[_0xbb6d('0x39')]=_[_0xbb6d('0x3a')](_0x432e41[_0xbb6d('0x39')]);_0x11676e[_0xbb6d('0x3b')]=_[_0xbb6d('0x3c')](_0x11676e[_0xbb6d('0x38')],_0x11676e[_0xbb6d('0x39')]);_0x4ff59[_0xbb6d('0x3e')]=_[_0xbb6d('0x3c')](_0x11676e[_0xbb6d('0x38')],qs[_0xbb6d('0x3d')](_0x432e41[_0xbb6d('0x39')]['fields']));_0x4ff59[_0xbb6d('0x3e')]=_0x4ff59[_0xbb6d('0x3e')][_0xbb6d('0x4f')]?_0x4ff59[_0xbb6d('0x3e')]:_0x11676e[_0xbb6d('0x38')];if(_0x432e41[_0xbb6d('0x39')][_0xbb6d('0x48')]){_0x4ff59[_0xbb6d('0x49')]=[{'all':!![]}];}_0x4ff59=_[_0xbb6d('0x46')]({},_0x4ff59,_0x432e41['options']);return db['AnalyticCustomReport'][_0xbb6d('0x50')](_0x4ff59)[_0xbb6d('0x29')](handleEntityNotFound(_0x3c4bce,null))['then'](respondWithResult(_0x3c4bce,null))[_0xbb6d('0x4c')](handleError(_0x3c4bce,null));};exports[_0xbb6d('0x51')]=function(_0x15a1b1,_0x48b040){return db[_0xbb6d('0x33')][_0xbb6d('0x51')](_0x15a1b1[_0xbb6d('0x52')],{})[_0xbb6d('0x29')](function(_0x455b37){var _0x8187c6=_0x15a1b1[_0xbb6d('0x53')][_0xbb6d('0x2b')]({'plain':!![]});if(!_0x8187c6)throw new Error(_0xbb6d('0x54'));if(_0x8187c6['role']===_0xbb6d('0x53')){var _0x27c7a3=_0x455b37[_0xbb6d('0x2b')]({'plain':!![]});var _0x168219='Reports';return db[_0xbb6d('0x55')][_0xbb6d('0x50')]({'where':{'name':_0x168219,'userProfileId':_0x8187c6[_0xbb6d('0x56')]},'raw':!![]})[_0xbb6d('0x29')](function(_0x3db7d5){if(_0x3db7d5&&_0x3db7d5[_0xbb6d('0x57')]===0x0){return db[_0xbb6d('0x2d')][_0xbb6d('0x51')]({'name':_0x27c7a3['name'],'resourceId':_0x27c7a3['id'],'type':_0xbb6d('0x2c'),'sectionId':_0x3db7d5['id']},{})[_0xbb6d('0x29')](function(){return _0x455b37;});}else{return _0x455b37;}})['catch'](function(_0x3cbc9d){logger[_0xbb6d('0x2e')](_0xbb6d('0x58'),_0x3cbc9d);throw _0x3cbc9d;});}return _0x455b37;})[_0xbb6d('0x29')](respondWithResult(_0x48b040,0xc9))['catch'](handleError(_0x48b040,null));};exports[_0xbb6d('0x28')]=function(_0x17ac84,_0x3d93ff){if(_0x17ac84['body']['id']){delete _0x17ac84[_0xbb6d('0x52')]['id'];}return db[_0xbb6d('0x33')][_0xbb6d('0x50')]({'where':{'id':_0x17ac84[_0xbb6d('0x4e')]['id']}})[_0xbb6d('0x29')](handleEntityNotFound(_0x3d93ff,null))[_0xbb6d('0x29')](saveUpdates(_0x17ac84['body'],null))['then'](respondWithResult(_0x3d93ff,null))['catch'](handleError(_0x3d93ff,null));};exports[_0xbb6d('0x2a')]=function(_0x128dc4,_0x4c340f){return db['AnalyticCustomReport'][_0xbb6d('0x50')]({'where':{'id':_0x128dc4[_0xbb6d('0x4e')]['id']}})[_0xbb6d('0x29')](handleEntityNotFound(_0x4c340f,null))[_0xbb6d('0x29')](removeEntity(_0x4c340f,null))[_0xbb6d('0x4c')](handleError(_0x4c340f,null));};exports[_0xbb6d('0x59')]=function(_0x152a56,_0x2e55d4){var _0x22a577=0xa;var _0x28f785=[_0xbb6d('0x5a'),_0xbb6d('0x5b'),_0xbb6d('0x5c'),_0xbb6d('0x5d')];var _0xc5c35a={'SUM':_0xbb6d('0x5e'),'COUNT':_0xbb6d('0x5f'),'COUNT DISTINCT':_0xbb6d('0x60'),'MAX':_0xbb6d('0x61'),'MIN':_0xbb6d('0x62'),'AVG':_0xbb6d('0x63'),'GROUP_CONCAT':_0xbb6d('0x64'),'GROUP_CONCAT ASC':_0xbb6d('0x65'),'GROUP_CONCAT DESC':_0xbb6d('0x66')};var _0x5bc0cb={'SEC_TO_TIME':_0xbb6d('0x67'),'DATE':_0xbb6d('0x68'),'HOUR':_0xbb6d('0x69'),'ROUND':_0xbb6d('0x6a'),'UNIX_TIMESTAMP':_0xbb6d('0x6b')};var _0x2ccaea=function(_0x4451c6){return!_['includes']([_0xbb6d('0x6c'),_0xbb6d('0x6d'),_0xbb6d('0x6e'),'IS\x20NOT\x20EMPTY'],_0x4451c6);};var _0x18a4e9=function(_0x432036){if(!_0x432036||!_0x432036[_0xbb6d('0x6f')]['length']){return'';}for(var _0x4255d0='(',_0x530617=0x0;_0x530617<_0x432036['rules']['length'];_0x530617+=0x1){_0x530617>0x0&&(_0x4255d0+='\x20'+_0x432036[_0xbb6d('0x70')]+'\x20');_0x4255d0+=_0x432036[_0xbb6d('0x6f')][_0x530617][_0xbb6d('0x71')]?_0x18a4e9(_0x432036[_0xbb6d('0x6f')][_0x530617][_0xbb6d('0x71')]):_0x432036[_0xbb6d('0x6f')][_0x530617][_0xbb6d('0x72')]+'\x20'+_0x432036['rules'][_0x530617][_0xbb6d('0x73')]+(_0x2ccaea(_0x432036['rules'][_0x530617][_0xbb6d('0x73')])?'\x20'+_0x432036[_0xbb6d('0x6f')][_0x530617]['value']:'');}return _0x4255d0+')';};var _0x420886={'where':{'id':_0x152a56[_0xbb6d('0x4e')]['id']}},_0x18e64e,_0x5b4d15,_0x313495,_0xabdab,_0x96bcce;_0x420886=_[_0xbb6d('0x46')]({},_0x420886,_0x152a56[_0xbb6d('0x47')]);return db[_0xbb6d('0x33')][_0xbb6d('0x50')](_0x420886)[_0xbb6d('0x29')](function(_0x11c036){if(_0x11c036){_0x18e64e=_0x11c036;return _0x11c036['getFields']();}return null;})[_0xbb6d('0x29')](function(_0x36ddd3){if(_0x36ddd3){if(!_0x36ddd3['length']){throw new db[(_0xbb6d('0x74'))][(_0xbb6d('0x75'))](_0xbb6d('0x76'),0x193);}_0x5b4d15=_0x36ddd3;return db[_0xbb6d('0x77')][_0xbb6d('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x2af080){if(_0x2af080){_0x313495=_[_0xbb6d('0x78')](_0x2af080,'id');var _0x5781ba;var _0x1bcff3=squel[_0xbb6d('0x79')]();_0x1bcff3['from'](_0x18e64e[_0xbb6d('0x7a')]);for(var _0x7a0c4d=0x0;_0x7a0c4d<_0x5b4d15['length'];_0x7a0c4d+=0x1){_0x5781ba=_0x5b4d15[_0x7a0c4d][_0xbb6d('0x7b')]?_0x313495[_0x5b4d15[_0x7a0c4d][_0xbb6d('0x7b')]]['metric']:_0x5b4d15[_0x7a0c4d][_0xbb6d('0x72')];_0x5781ba=_0x5b4d15[_0x7a0c4d][_0xbb6d('0x7c')]?_[_0xbb6d('0x7d')](_0xc5c35a[_0x5b4d15[_0x7a0c4d][_0xbb6d('0x7c')]],'%s',_0x5781ba):_0x5781ba;_0x5781ba=_0x5b4d15[_0x7a0c4d][_0xbb6d('0x7e')]?_['replace'](_0x5bc0cb[_0x5b4d15[_0x7a0c4d][_0xbb6d('0x7e')]],'%s',_0x5781ba):_0x5781ba;if(_0x5b4d15[_0x7a0c4d][_0xbb6d('0x7f')]){_0x1bcff3['group'](_0x5781ba);}_0x5b4d15[_0x7a0c4d][_0xbb6d('0x80')]&&_0x1bcff3[_0xbb6d('0x41')](_0x5781ba,_0x5b4d15[_0x7a0c4d][_0xbb6d('0x80')]===_0xbb6d('0x81')?![]:!![]);_0x1bcff3[_0xbb6d('0x72')](_0x5781ba,_0x5b4d15[_0x7a0c4d][_0xbb6d('0x82')]||_0x5781ba);}if(_0x18e64e[_0xbb6d('0x83')]){_0x18e64e[_0xbb6d('0x83')]=JSON['parse'](_0x18e64e['joins']);for(var _0x520174=0x0;_0x520174<_0x18e64e[_0xbb6d('0x83')][_0xbb6d('0x4f')];_0x520174+=0x1){if(_0x18e64e[_0xbb6d('0x83')][_0x520174][_0xbb6d('0x36')]&&_[_0xbb6d('0x84')](_0x28f785,_0x18e64e[_0xbb6d('0x83')][_0x520174][_0xbb6d('0x36')])&&_0x18e64e[_0xbb6d('0x83')][_0x520174]['parentKey']&&_0x18e64e['joins'][_0x520174][_0xbb6d('0x85')]&&_0x18e64e[_0xbb6d('0x83')][_0x520174][_0xbb6d('0x86')]){_0x1bcff3[_0x18e64e[_0xbb6d('0x83')][_0x520174][_0xbb6d('0x36')]](_0x18e64e['joins'][_0x520174][_0xbb6d('0x85')],null,util['format'](_0xbb6d('0x87'),_0x18e64e[_0xbb6d('0x7a')],_0x18e64e['joins'][_0x520174][_0xbb6d('0x88')],_0x18e64e[_0xbb6d('0x83')][_0x520174]['foreignTable'],_0x18e64e[_0xbb6d('0x83')][_0x520174]['foreignKey']));}}}if(_0x18e64e['conditions']){_0x18e64e['conditions']=JSON['parse'](_0x18e64e['conditions']);_0x1bcff3[_0xbb6d('0x43')](_0x18a4e9(_0x18e64e['conditions']['group']));}_0x96bcce=_0x1bcff3[_0xbb6d('0x89')]();_0x1bcff3['limit'](_0x22a577);_0x1bcff3[_0xbb6d('0x1f')](0x0);logger['debug']('Limited\x20Query:',_0x1bcff3[_0xbb6d('0x8a')]());return dbH[_0xbb6d('0x8b')]['query'](_0x1bcff3[_0xbb6d('0x8a')](),{'type':dbH[_0xbb6d('0x8b')][_0xbb6d('0x8c')][_0xbb6d('0x8d')]});}})['then'](respondWithResult(_0x2e55d4,null))[_0xbb6d('0x4c')](handleError(_0x2e55d4,null));};function runReport(_0x44207b,_0x567536,_0x5bc306){var _0x32fa82=_0x567536[_0xbb6d('0x30')];var _0x14f524=0xa;var _0x552cfa=[_0xbb6d('0x5a'),'left_join',_0xbb6d('0x5c'),'cross_join'];var _0x4879ae={'SUM':_0xbb6d('0x5e'),'COUNT':_0xbb6d('0x5f'),'COUNT DISTINCT':_0xbb6d('0x60'),'MAX':'MAX(%s)','MIN':_0xbb6d('0x62'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbb6d('0x64'),'GROUP_CONCAT ASC':_0xbb6d('0x65'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5ef868={'SEC_TO_TIME':_0xbb6d('0x67'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xbb6d('0x6a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x41fe7a=function(_0x87594f){return!_[_0xbb6d('0x84')]([_0xbb6d('0x6c'),_0xbb6d('0x6d'),_0xbb6d('0x6e'),'IS\x20NOT\x20EMPTY'],_0x87594f);};var _0xfac475=function(_0x5191b7){if(!_0x5191b7||!_0x5191b7[_0xbb6d('0x6f')][_0xbb6d('0x4f')]){return'';}for(var _0x3ad76c='(',_0x40a1f7=0x0;_0x40a1f7<_0x5191b7[_0xbb6d('0x6f')][_0xbb6d('0x4f')];_0x40a1f7+=0x1){_0x40a1f7>0x0&&(_0x3ad76c+='\x20'+_0x5191b7[_0xbb6d('0x70')]+'\x20');_0x3ad76c+=_0x5191b7[_0xbb6d('0x6f')][_0x40a1f7][_0xbb6d('0x71')]?_0xfac475(_0x5191b7['rules'][_0x40a1f7][_0xbb6d('0x71')]):_0x5191b7[_0xbb6d('0x6f')][_0x40a1f7][_0xbb6d('0x72')]+'\x20'+_0x5191b7[_0xbb6d('0x6f')][_0x40a1f7][_0xbb6d('0x73')]+(_0x41fe7a(_0x5191b7[_0xbb6d('0x6f')][_0x40a1f7][_0xbb6d('0x73')])?'\x20'+_0x5191b7[_0xbb6d('0x6f')][_0x40a1f7][_0xbb6d('0x8e')]:'');}return _0x3ad76c+')';};var _0x281cfd={'where':{'id':_0x44207b['id']}},_0x3435a4,_0x24fffc,_0x17ae9b,_0x880573,_0x2a4c47;_0x281cfd=_[_0xbb6d('0x46')]({},_0x281cfd,_0x5bc306);return db['AnalyticCustomReport']['find'](_0x281cfd)[_0xbb6d('0x29')](function(_0x127cc6){if(_0x127cc6){_0x3435a4=_0x127cc6;return _0x127cc6[_0xbb6d('0x8f')]();}return null;})['then'](function(_0x3d3a98){if(_0x3d3a98){if(!_0x3d3a98[_0xbb6d('0x4f')]){throw new db[(_0xbb6d('0x74'))][(_0xbb6d('0x75'))](_0xbb6d('0x76'),0x193);}_0x24fffc=_0x3d3a98;return db['AnalyticMetric'][_0xbb6d('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x353c59){if(_0x353c59){_0x17ae9b=_[_0xbb6d('0x78')](_0x353c59,'id');var _0x15682a;var _0x3a5af4=squel[_0xbb6d('0x79')]();_0x3a5af4[_0xbb6d('0x90')](_0x3435a4[_0xbb6d('0x7a')]);for(var _0x36de42=0x0;_0x36de42<_0x24fffc[_0xbb6d('0x4f')];_0x36de42+=0x1){_0x15682a=_0x24fffc[_0x36de42][_0xbb6d('0x7b')]?_0x17ae9b[_0x24fffc[_0x36de42]['MetricId']]['metric']:_0x24fffc[_0x36de42][_0xbb6d('0x72')];_0x15682a=_0x24fffc[_0x36de42][_0xbb6d('0x7c')]?_['replace'](_0x4879ae[_0x24fffc[_0x36de42][_0xbb6d('0x7c')]],'%s',_0x15682a):_0x15682a;_0x15682a=_0x24fffc[_0x36de42][_0xbb6d('0x7e')]?_['replace'](_0x5ef868[_0x24fffc[_0x36de42][_0xbb6d('0x7e')]],'%s',_0x15682a):_0x15682a;if(_0x24fffc[_0x36de42][_0xbb6d('0x7f')]){_0x3a5af4[_0xbb6d('0x71')](_0x15682a);}_0x24fffc[_0x36de42][_0xbb6d('0x80')]&&_0x3a5af4[_0xbb6d('0x41')](_0x15682a,_0x24fffc[_0x36de42][_0xbb6d('0x80')]===_0xbb6d('0x81')?![]:!![]);_0x3a5af4[_0xbb6d('0x72')](_0x15682a,_0x24fffc[_0x36de42][_0xbb6d('0x82')]||_0x15682a);}if(_0x3435a4[_0xbb6d('0x83')]){_0x3435a4[_0xbb6d('0x83')]=JSON['parse'](_0x3435a4[_0xbb6d('0x83')]);for(var _0x219bd8=0x0;_0x219bd8<_0x3435a4[_0xbb6d('0x83')]['length'];_0x219bd8+=0x1){if(_0x3435a4[_0xbb6d('0x83')][_0x219bd8][_0xbb6d('0x36')]&&_[_0xbb6d('0x84')](_0x552cfa,_0x3435a4[_0xbb6d('0x83')][_0x219bd8][_0xbb6d('0x36')])&&_0x3435a4[_0xbb6d('0x83')][_0x219bd8]['parentKey']&&_0x3435a4['joins'][_0x219bd8][_0xbb6d('0x85')]&&_0x3435a4['joins'][_0x219bd8][_0xbb6d('0x86')]){_0x3a5af4[_0x3435a4[_0xbb6d('0x83')][_0x219bd8][_0xbb6d('0x36')]](_0x3435a4['joins'][_0x219bd8][_0xbb6d('0x85')],null,util[_0xbb6d('0x7e')]('%s.%s\x20=\x20%s.%s',_0x3435a4[_0xbb6d('0x7a')],_0x3435a4[_0xbb6d('0x83')][_0x219bd8]['parentKey'],_0x3435a4['joins'][_0x219bd8][_0xbb6d('0x85')],_0x3435a4[_0xbb6d('0x83')][_0x219bd8][_0xbb6d('0x86')]));}}}if(_0x3435a4['conditions']){_0x3435a4[_0xbb6d('0x91')]=JSON[_0xbb6d('0x92')](_0x3435a4['conditions']);_0x3a5af4[_0xbb6d('0x43')](_0xfac475(_0x3435a4[_0xbb6d('0x91')]['group']));}_0x2a4c47=_0x3a5af4['clone']();_0x3a5af4[_0xbb6d('0x21')](_0x14f524);_0x3a5af4[_0xbb6d('0x1f')](0x0);return;}})['then'](function(){if(_0x567536[_0xbb6d('0x93')]===_0xbb6d('0x94')){return null;}var _0x5d8a18=_[_0xbb6d('0x46')](_0x567536,{'name':_0x567536[_0xbb6d('0x95')]||_0x567536['name']||_0x3435a4[_0xbb6d('0x30')],'basename':_0x32fa82,'savename':util[_0xbb6d('0x7e')](_0xbb6d('0x96'),_0x567536[_0xbb6d('0x30')]||_0x3435a4[_0xbb6d('0x30')],require(_0xbb6d('0x97'))[_0xbb6d('0x98')](0x4),_0x567536[_0xbb6d('0x93')]||_0xbb6d('0x99')),'reportId':_0x3435a4['id'],'reportType':_0xbb6d('0x9a')});return db[_0xbb6d('0x9b')]['create'](_0x5d8a18,{'raw':!![]});})[_0xbb6d('0x29')](function(_0x498f37){if(_0x3435a4[_0xbb6d('0x7a')]===_0xbb6d('0x9c')){_0x2a4c47['where'](_0x3435a4[_0xbb6d('0x7a')]+_0xbb6d('0x9d'),_0x567536['startDate'],_0x567536[_0xbb6d('0x9e')]);}else{_0x2a4c47['where'](_0x3435a4[_0xbb6d('0x7a')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x567536[_0xbb6d('0x9f')],_0x567536[_0xbb6d('0x9e')]);}if(_0x498f37){logger[_0xbb6d('0xa0')](_0xbb6d('0xa1'),_0x2a4c47['toString']());require(_0xbb6d('0xa2'))[_0xbb6d('0xa3')](path[_0xbb6d('0x5a')](__dirname,_0xbb6d('0xa4'),_0x498f37[_0xbb6d('0x93')]),[_0x498f37['id'],_0x2a4c47[_0xbb6d('0x8a')](),path[_0xbb6d('0x5a')](__dirname,_0xbb6d('0xa5'),_0x498f37[_0xbb6d('0xa6')]),_0x32fa82]);return _0x498f37;}else{var _0x4c35e4=squel['select']();_0x4c35e4[_0xbb6d('0x90')]('('+_0x2a4c47['toString']()+')','countTable');_0x4c35e4['field'](_0xbb6d('0xa7'),_0xbb6d('0x22'));_0x2a4c47['limit'](_0x567536['limit']||_0x14f524);_0x2a4c47['offset'](_0x567536[_0xbb6d('0x1f')]||0x0);return dbH[_0xbb6d('0x8b')]['query'](_0x4c35e4[_0xbb6d('0x8a')](),{'type':dbH[_0xbb6d('0x8b')][_0xbb6d('0x8c')]['SELECT']})[_0xbb6d('0x29')](function(_0xfcdd3b){if(!_0xfcdd3b['length']){_0x880573=0x0;}else{_0x880573=_0xfcdd3b[0x0][_0xbb6d('0x22')]||0x0;}return dbH[_0xbb6d('0x8b')][_0xbb6d('0x39')](_0x2a4c47['toString'](),{'type':dbH[_0xbb6d('0x8b')][_0xbb6d('0x8c')][_0xbb6d('0x8d')]});})[_0xbb6d('0x29')](function(_0x266198){return{'rows':_0x266198||[],'count':_0x880573};});}});}exports[_0xbb6d('0xa8')]=function(_0x42f959,_0x2cd2af){return runReport(_0x42f959[_0xbb6d('0x4e')],_0x42f959['query'],_0x42f959['options'])['then'](respondWithResult(_0x2cd2af,null))[_0xbb6d('0x4c')](handleError(_0x2cd2af,null));};exports[_0xbb6d('0xa9')]=runReport;exports[_0xbb6d('0x39')]=function(_0x269085,_0x2e9055){var _0x34f317=0xa;var _0x286164=[_0xbb6d('0x5a'),_0xbb6d('0x5b'),'right_join',_0xbb6d('0x5d')];var _0x21383f={'SUM':_0xbb6d('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbb6d('0x60'),'MAX':_0xbb6d('0x61'),'MIN':_0xbb6d('0x62'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbb6d('0x64'),'GROUP_CONCAT ASC':_0xbb6d('0x65'),'GROUP_CONCAT DESC':_0xbb6d('0x66')};var _0x47f8b8={'SEC_TO_TIME':_0xbb6d('0x67'),'DATE':_0xbb6d('0x68'),'HOUR':_0xbb6d('0x69'),'ROUND':_0xbb6d('0x6a'),'UNIX_TIMESTAMP':_0xbb6d('0x6b')};var _0x97816c=function(_0x58486b){return!_[_0xbb6d('0x84')]([_0xbb6d('0x6c'),'IS\x20NOT\x20NULL',_0xbb6d('0x6e'),_0xbb6d('0xaa')],_0x58486b);};var _0x45e8b3=function(_0x25f95c){if(!_0x25f95c||!_0x25f95c[_0xbb6d('0x6f')][_0xbb6d('0x4f')]){return'';}for(var _0x37f0cb='(',_0xb27bf8=0x0;_0xb27bf8<_0x25f95c[_0xbb6d('0x6f')][_0xbb6d('0x4f')];_0xb27bf8+=0x1){_0xb27bf8>0x0&&(_0x37f0cb+='\x20'+_0x25f95c[_0xbb6d('0x70')]+'\x20');_0x37f0cb+=_0x25f95c[_0xbb6d('0x6f')][_0xb27bf8][_0xbb6d('0x71')]?_0x45e8b3(_0x25f95c[_0xbb6d('0x6f')][_0xb27bf8]['group']):_0x25f95c[_0xbb6d('0x6f')][_0xb27bf8][_0xbb6d('0x72')]+'\x20'+_0x25f95c['rules'][_0xb27bf8]['condition']+(_0x97816c(_0x25f95c['rules'][_0xb27bf8]['condition'])?'\x20'+_0x25f95c['rules'][_0xb27bf8][_0xbb6d('0x8e')]:'');}return _0x37f0cb+')';};var _0x444509={'where':{'id':_0x269085[_0xbb6d('0x4e')]['id']}},_0x57fcf3,_0xda32cc,_0x902dba,_0x1d869d,_0x4daf39;_0x444509=_[_0xbb6d('0x46')]({},_0x444509,_0x269085[_0xbb6d('0x47')]);return db[_0xbb6d('0x33')][_0xbb6d('0x50')](_0x444509)[_0xbb6d('0x29')](function(_0x1e736c){if(_0x1e736c){_0x57fcf3=_0x1e736c;return _0x1e736c[_0xbb6d('0x8f')]();}return null;})[_0xbb6d('0x29')](function(_0x349d6c){if(_0x349d6c){if(!_0x349d6c[_0xbb6d('0x4f')]){throw new db['Sequelize'][(_0xbb6d('0x75'))](_0xbb6d('0x76'),0x193);}_0xda32cc=_0x349d6c;return db[_0xbb6d('0x77')][_0xbb6d('0x4a')]({'raw':!![]});}return null;})[_0xbb6d('0x29')](function(_0x31c052){if(_0x31c052){_0x902dba=_[_0xbb6d('0x78')](_0x31c052,'id');var _0x281da3;var _0x12fc14=squel[_0xbb6d('0x79')]();_0x12fc14[_0xbb6d('0x90')](_0x57fcf3[_0xbb6d('0x7a')]);for(var _0x3eaa6a=0x0;_0x3eaa6a<_0xda32cc['length'];_0x3eaa6a+=0x1){_0x281da3=_0xda32cc[_0x3eaa6a]['MetricId']?_0x902dba[_0xda32cc[_0x3eaa6a][_0xbb6d('0x7b')]]['metric']:_0xda32cc[_0x3eaa6a][_0xbb6d('0x72')];_0x281da3=_0xda32cc[_0x3eaa6a][_0xbb6d('0x7c')]?_[_0xbb6d('0x7d')](_0x21383f[_0xda32cc[_0x3eaa6a][_0xbb6d('0x7c')]],'%s',_0x281da3):_0x281da3;_0x281da3=_0xda32cc[_0x3eaa6a]['format']?_[_0xbb6d('0x7d')](_0x47f8b8[_0xda32cc[_0x3eaa6a]['format']],'%s',_0x281da3):_0x281da3;if(_0xda32cc[_0x3eaa6a][_0xbb6d('0x7f')]){_0x12fc14[_0xbb6d('0x71')](_0x281da3);}_0xda32cc[_0x3eaa6a][_0xbb6d('0x80')]&&_0x12fc14[_0xbb6d('0x41')](_0x281da3,_0xda32cc[_0x3eaa6a][_0xbb6d('0x80')]===_0xbb6d('0x81')?![]:!![]);_0x12fc14[_0xbb6d('0x72')](_0x281da3,_0xda32cc[_0x3eaa6a][_0xbb6d('0x82')]||_0x281da3);}if(_0x57fcf3[_0xbb6d('0x83')]){_0x57fcf3[_0xbb6d('0x83')]=JSON[_0xbb6d('0x92')](_0x57fcf3[_0xbb6d('0x83')]);for(var _0x527445=0x0;_0x527445<_0x57fcf3[_0xbb6d('0x83')][_0xbb6d('0x4f')];_0x527445+=0x1){if(_0x57fcf3[_0xbb6d('0x83')][_0x527445][_0xbb6d('0x36')]&&_[_0xbb6d('0x84')](_0x286164,_0x57fcf3[_0xbb6d('0x83')][_0x527445][_0xbb6d('0x36')])&&_0x57fcf3[_0xbb6d('0x83')][_0x527445]['parentKey']&&_0x57fcf3[_0xbb6d('0x83')][_0x527445]['foreignTable']&&_0x57fcf3[_0xbb6d('0x83')][_0x527445][_0xbb6d('0x86')]){_0x12fc14[_0x57fcf3[_0xbb6d('0x83')][_0x527445][_0xbb6d('0x36')]](_0x57fcf3[_0xbb6d('0x83')][_0x527445][_0xbb6d('0x85')],null,util[_0xbb6d('0x7e')](_0xbb6d('0x87'),_0x57fcf3['table'],_0x57fcf3[_0xbb6d('0x83')][_0x527445]['parentKey'],_0x57fcf3['joins'][_0x527445][_0xbb6d('0x85')],_0x57fcf3['joins'][_0x527445][_0xbb6d('0x86')]));}}}if(_0x57fcf3[_0xbb6d('0x91')]){_0x57fcf3[_0xbb6d('0x91')]=JSON[_0xbb6d('0x92')](_0x57fcf3['conditions']);_0x12fc14[_0xbb6d('0x43')](_0x45e8b3(_0x57fcf3['conditions'][_0xbb6d('0x71')]));}_0x4daf39=_0x12fc14[_0xbb6d('0x89')]();_0x12fc14[_0xbb6d('0x21')](_0x34f317);_0x12fc14[_0xbb6d('0x1f')](0x0);logger[_0xbb6d('0xab')](_0xbb6d('0xac'),_0x12fc14[_0xbb6d('0x8a')]());return dbH[_0xbb6d('0x8b')][_0xbb6d('0x39')](_0x12fc14[_0xbb6d('0x8a')](),{'type':dbH['sequelize']['QueryTypes'][_0xbb6d('0x8d')]});}})[_0xbb6d('0x29')](function(){return{'sql':_0x4daf39['toString']()};})[_0xbb6d('0x29')](respondWithResult(_0x2e9055,null))[_0xbb6d('0x4c')](handleError(_0x2e9055,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 6a9c5b7..f0069c1 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 _0x1767=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x586c0e,_0x627615){var _0x5d0a28=function(_0x434745){while(--_0x434745){_0x586c0e['push'](_0x586c0e['shift']());}};_0x5d0a28(++_0x627615);}(_0x1767,0x18b));var _0x7176=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x1767[_0x5d6b41];return _0x1c2dd6;};'use strict';var _=require(_0x7176('0x0'));var util=require(_0x7176('0x1'));var logger=require(_0x7176('0x2'))(_0x7176('0x3'));var moment=require(_0x7176('0x4'));var BPromise=require('bluebird');var rp=require(_0x7176('0x5'));var fs=require('fs');var path=require(_0x7176('0x6'));var rimraf=require(_0x7176('0x7'));var config=require('../../config/environment');var attributes=require(_0x7176('0x8'));module[_0x7176('0x9')]=function(_0x32c1cf,_0x550864){return _0x32c1cf[_0x7176('0xa')](_0x7176('0xb'),attributes,{'tableName':_0x7176('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95a2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports'];(function(_0xbbbeae,_0x4a414a){var _0x1cb9c9=function(_0x4db7d0){while(--_0x4db7d0){_0xbbbeae['push'](_0xbbbeae['shift']());}};_0x1cb9c9(++_0x4a414a);}(_0x95a2,0x1ba));var _0x295a=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x95a2[_0x271060];return _0x40540b;};'use strict';var _=require(_0x295a('0x0'));var util=require(_0x295a('0x1'));var logger=require(_0x295a('0x2'))(_0x295a('0x3'));var moment=require(_0x295a('0x4'));var BPromise=require('bluebird');var rp=require(_0x295a('0x5'));var fs=require('fs');var path=require(_0x295a('0x6'));var rimraf=require(_0x295a('0x7'));var config=require(_0x295a('0x8'));var attributes=require(_0x295a('0x9'));module[_0x295a('0xa')]=function(_0x4530ae,_0x1c58e4){return _0x4530ae['define'](_0x295a('0xb'),attributes,{'tableName':_0x295a('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 1a932f7..ad712c9 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 _0x3256=['AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x222115,_0x14b0dd){var _0x922768=function(_0x212a1d){while(--_0x212a1d){_0x222115['push'](_0x222115['shift']());}};_0x922768(++_0x14b0dd);}(_0x3256,0xe5));var _0x6325=function(_0x49d0c7,_0x2f5e64){_0x49d0c7=_0x49d0c7-0x0;var _0x38b752=_0x3256[_0x49d0c7];return _0x38b752;};'use strict';var _=require(_0x6325('0x0'));var util=require(_0x6325('0x1'));var moment=require(_0x6325('0x2'));var BPromise=require(_0x6325('0x3'));var rs=require(_0x6325('0x4'));var fs=require('fs');var Redis=require(_0x6325('0x5'));var db=require(_0x6325('0x6'))['db'];var utils=require(_0x6325('0x7'));var logger=require(_0x6325('0x8'))(_0x6325('0x9'));var config=require(_0x6325('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6325('0xb')][_0x6325('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16433f,_0x46b359,_0x5091cc){return new BPromise(function(_0x35beb8,_0x53d779){return client[_0x6325('0xd')](_0x16433f,_0x5091cc)[_0x6325('0xe')](function(_0x59a37b){logger[_0x6325('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x46b359,'request\x20sent');logger[_0x6325('0x10')](_0x6325('0x11'),_0x46b359,_0x6325('0x12'),JSON['stringify'](_0x59a37b));if(_0x59a37b[_0x6325('0x13')]){if(_0x59a37b[_0x6325('0x13')][_0x6325('0x14')]===0x1f4){logger[_0x6325('0x13')](_0x6325('0x15'),_0x46b359,_0x59a37b[_0x6325('0x13')][_0x6325('0x16')]);return _0x53d779(_0x59a37b[_0x6325('0x13')][_0x6325('0x16')]);}logger[_0x6325('0x13')](_0x6325('0x15'),_0x46b359,_0x59a37b[_0x6325('0x13')][_0x6325('0x16')]);return _0x35beb8(_0x59a37b[_0x6325('0x13')][_0x6325('0x16')]);}else{logger[_0x6325('0xf')](_0x6325('0x15'),_0x46b359,_0x6325('0x12'));_0x35beb8(_0x59a37b[_0x6325('0x17')][_0x6325('0x16')]);}})[_0x6325('0x18')](function(_0x140219){logger[_0x6325('0x13')](_0x6325('0x15'),_0x46b359,_0x140219);_0x53d779(_0x140219);});});} \ No newline at end of file +var _0x9fee=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1f7af5,_0x5902ba){var _0x576a87=function(_0x52bec1){while(--_0x52bec1){_0x1f7af5['push'](_0x1f7af5['shift']());}};_0x576a87(++_0x5902ba);}(_0x9fee,0x19f));var _0xe9fe=function(_0x2a9bdf,_0x5e89ab){_0x2a9bdf=_0x2a9bdf-0x0;var _0x376b83=_0x9fee[_0x2a9bdf];return _0x376b83;};'use strict';var _=require(_0xe9fe('0x0'));var util=require(_0xe9fe('0x1'));var moment=require('moment');var BPromise=require(_0xe9fe('0x2'));var rs=require(_0xe9fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9fe('0x4'))['db'];var utils=require(_0xe9fe('0x5'));var logger=require(_0xe9fe('0x6'))(_0xe9fe('0x7'));var config=require(_0xe9fe('0x8'));var jayson=require(_0xe9fe('0x9'));var client=jayson['client'][_0xe9fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10ca32,_0x1f2780,_0x4530c1){return new BPromise(function(_0x1c8f6f,_0x3af192){return client[_0xe9fe('0xb')](_0x10ca32,_0x4530c1)[_0xe9fe('0xc')](function(_0x2e3c26){logger[_0xe9fe('0xd')](_0xe9fe('0xe'),_0x1f2780,_0xe9fe('0xf'));logger[_0xe9fe('0x10')](_0xe9fe('0x11'),_0x1f2780,_0xe9fe('0xf'),JSON['stringify'](_0x2e3c26));if(_0x2e3c26[_0xe9fe('0x12')]){if(_0x2e3c26[_0xe9fe('0x12')][_0xe9fe('0x13')]===0x1f4){logger[_0xe9fe('0x12')](_0xe9fe('0xe'),_0x1f2780,_0x2e3c26['error'][_0xe9fe('0x14')]);return _0x3af192(_0x2e3c26[_0xe9fe('0x12')][_0xe9fe('0x14')]);}logger['error'](_0xe9fe('0xe'),_0x1f2780,_0x2e3c26[_0xe9fe('0x12')]['message']);return _0x1c8f6f(_0x2e3c26['error'][_0xe9fe('0x14')]);}else{logger[_0xe9fe('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1f2780,_0xe9fe('0xf'));_0x1c8f6f(_0x2e3c26[_0xe9fe('0x15')][_0xe9fe('0x14')]);}})[_0xe9fe('0x16')](function(_0x372f82){logger['error'](_0xe9fe('0xe'),_0x1f2780,_0x372f82);_0x3af192(_0x372f82);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2265ab2..7feed36 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 _0x22bb=['../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xa7b101,_0xb7c30b){var _0x31c277=function(_0x20f526){while(--_0x20f526){_0xa7b101['push'](_0xa7b101['shift']());}};_0x31c277(++_0xb7c30b);}(_0x22bb,0x1c1));var _0xb22b=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x22bb[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0xb22b('0x0'));var util=require(_0xb22b('0x1'));var path=require(_0xb22b('0x2'));var timeout=require(_0xb22b('0x3'));var express=require(_0xb22b('0x4'));var router=express[_0xb22b('0x5')]();var fs_extra=require(_0xb22b('0x6'));var auth=require(_0xb22b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb22b('0x8'));var controller=require(_0xb22b('0x9'));router[_0xb22b('0xa')]('/',auth[_0xb22b('0xb')](),controller[_0xb22b('0xc')]);router[_0xb22b('0xa')](_0xb22b('0xd'),auth[_0xb22b('0xb')](),controller[_0xb22b('0xe')]);router['get'](_0xb22b('0xf'),auth['isAuthenticated'](),controller[_0xb22b('0x10')]);router['get']('/:id/run',auth[_0xb22b('0xb')](),controller[_0xb22b('0x11')]);router['get'](_0xb22b('0x12'),auth[_0xb22b('0xb')](),controller[_0xb22b('0x13')]);router[_0xb22b('0x14')]('/',auth[_0xb22b('0xb')](),controller['create']);router['put']('/:id',auth[_0xb22b('0xb')](),controller[_0xb22b('0x15')]);router['delete'](_0xb22b('0xd'),auth[_0xb22b('0xb')](),controller[_0xb22b('0x16')]);module[_0xb22b('0x17')]=router; \ No newline at end of file +var _0x366b=['delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','create','put'];(function(_0x5bf609,_0x5c1e35){var _0x3c3a74=function(_0x538a50){while(--_0x538a50){_0x5bf609['push'](_0x5bf609['shift']());}};_0x3c3a74(++_0x5c1e35);}(_0x366b,0x128));var _0xb366=function(_0x55d571,_0x1537d8){_0x55d571=_0x55d571-0x0;var _0xfb3e49=_0x366b[_0x55d571];return _0xfb3e49;};'use strict';var multer=require(_0xb366('0x0'));var util=require('util');var path=require(_0xb366('0x1'));var timeout=require('connect-timeout');var express=require(_0xb366('0x2'));var router=express[_0xb366('0x3')]();var fs_extra=require(_0xb366('0x4'));var auth=require(_0xb366('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb366('0x6'));router[_0xb366('0x7')]('/',auth[_0xb366('0x8')](),controller[_0xb366('0x9')]);router['get'](_0xb366('0xa'),auth['isAuthenticated'](),controller[_0xb366('0xb')]);router[_0xb366('0x7')]('/:id/preview',auth[_0xb366('0x8')](),controller[_0xb366('0xc')]);router[_0xb366('0x7')](_0xb366('0xd'),auth[_0xb366('0x8')](),controller[_0xb366('0xe')]);router[_0xb366('0x7')](_0xb366('0xf'),auth['isAuthenticated'](),controller[_0xb366('0x10')]);router['post']('/',auth[_0xb366('0x8')](),controller[_0xb366('0x11')]);router[_0xb366('0x12')]('/:id',auth[_0xb366('0x8')](),controller['update']);router[_0xb366('0x13')]('/:id',auth[_0xb366('0x8')](),controller['destroy']);module[_0xb366('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 3f0bf27..7242157 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 _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x1b8cbd,_0x559883){var _0x4ed1fc=function(_0x208f45){while(--_0x208f45){_0x1b8cbd['push'](_0x1b8cbd['shift']());}};_0x4ed1fc(++_0x559883);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2a63c2,_0xf0796a){_0x2a63c2=_0x2a63c2-0x0;var _0x2ab674=_0x9c5a[_0x2a63c2];return _0x2ab674;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5d17=['sequelize','exports','STRING','TEXT'];(function(_0x40cfd4,_0x203c84){var _0x1d60de=function(_0x19c2dc){while(--_0x19c2dc){_0x40cfd4['push'](_0x40cfd4['shift']());}};_0x1d60de(++_0x203c84);}(_0x5d17,0x114));var _0x75d1=function(_0x3055ab,_0x4d1f74){_0x3055ab=_0x3055ab-0x0;var _0x31d336=_0x5d17[_0x3055ab];return _0x31d336;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x75d1('0x2')]},'table':{'type':Sequelize[_0x75d1('0x2')]},'conditions':{'type':Sequelize[_0x75d1('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index d5a9e6c..b774988 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x526f55,_0x53b0ef){var _0x85cda=function(_0x1379be){while(--_0x1379be){_0x526f55['push'](_0x526f55['shift']());}};_0x85cda(++_0x53b0ef);}(_0x5fab,0x177));var _0xb5fa=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0x5fab[_0x216799];return _0x3661c3;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file +var _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x326f,0xd1));var _0xf326=function(_0x480e57,_0x40eeb0){_0x480e57=_0x480e57-0x0;var _0x5ed5a4=_0x326f[_0x480e57];return _0x5ed5a4;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 36c6d84..8c683f4 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 _0xfef5=['./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x4496ff,_0x4c450a){var _0x5dffd7=function(_0x2e3c12){while(--_0x2e3c12){_0x4496ff['push'](_0x4496ff['shift']());}};_0x5dffd7(++_0x4c450a);}(_0xfef5,0xa9));var _0x5fef=function(_0x16d08d,_0x3136dd){_0x16d08d=_0x16d08d-0x0;var _0x34c2f3=_0xfef5[_0x16d08d];return _0x34c2f3;};'use strict';var _=require(_0x5fef('0x0'));var util=require('util');var logger=require(_0x5fef('0x1'))(_0x5fef('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5fef('0x3'));var fs=require('fs');var path=require(_0x5fef('0x4'));var rimraf=require(_0x5fef('0x5'));var config=require(_0x5fef('0x6'));var attributes=require(_0x5fef('0x7'));module['exports']=function(_0x5b6f50,_0x2c219a){return _0x5b6f50[_0x5fef('0x8')](_0x5fef('0x9'),attributes,{'tableName':_0x5fef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9aa=['AnalyticDefaultReport','analytics_default_reports','../../config/logger','api','moment','request-promise','path','./analyticDefaultReport.attributes','define'];(function(_0x556150,_0x592ae8){var _0x4432fb=function(_0xf8c270){while(--_0xf8c270){_0x556150['push'](_0x556150['shift']());}};_0x4432fb(++_0x592ae8);}(_0xc9aa,0x16a));var _0xac9a=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xc9aa[_0x2080a3];return _0x8d7d17;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xac9a('0x0'))(_0xac9a('0x1'));var moment=require(_0xac9a('0x2'));var BPromise=require('bluebird');var rp=require(_0xac9a('0x3'));var fs=require('fs');var path=require(_0xac9a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac9a('0x5'));module['exports']=function(_0x82e79,_0x50d59f){return _0x82e79[_0xac9a('0x6')](_0xac9a('0x7'),attributes,{'tableName':_0xac9a('0x8'),'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 c9e9e8e..c752c1d 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 _0x3ec4=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','info','AnalyticDefaultReport,\x20%s,\x20%s','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x387eba,_0x123664){var _0x5d2c96=function(_0x227439){while(--_0x227439){_0x387eba['push'](_0x387eba['shift']());}};_0x5d2c96(++_0x123664);}(_0x3ec4,0x1d4));var _0x43ec=function(_0x45e472,_0x38cce3){_0x45e472=_0x45e472-0x0;var _0x8f2117=_0x3ec4[_0x45e472];return _0x8f2117;};'use strict';var _=require('lodash');var util=require(_0x43ec('0x0'));var moment=require('moment');var BPromise=require(_0x43ec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ec('0x2'));var db=require(_0x43ec('0x3'))['db'];var utils=require(_0x43ec('0x4'));var logger=require(_0x43ec('0x5'))(_0x43ec('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x43ec('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3866cc,_0x143d63,_0x363e9c){return new BPromise(function(_0x328a42,_0x3d0e49){return client['request'](_0x3866cc,_0x363e9c)['then'](function(_0x243dcf){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x143d63,_0x43ec('0x8'));logger[_0x43ec('0x9')](_0x43ec('0xa'),_0x143d63,_0x43ec('0x8'),JSON['stringify'](_0x243dcf));if(_0x243dcf[_0x43ec('0xb')]){if(_0x243dcf[_0x43ec('0xb')][_0x43ec('0xc')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x143d63,_0x243dcf[_0x43ec('0xb')][_0x43ec('0xd')]);return _0x3d0e49(_0x243dcf[_0x43ec('0xb')][_0x43ec('0xd')]);}logger[_0x43ec('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x143d63,_0x243dcf[_0x43ec('0xb')][_0x43ec('0xd')]);return _0x328a42(_0x243dcf[_0x43ec('0xb')][_0x43ec('0xd')]);}else{logger[_0x43ec('0xe')](_0x43ec('0xf'),_0x143d63,_0x43ec('0x8'));_0x328a42(_0x243dcf['result'][_0x43ec('0xd')]);}})[_0x43ec('0x10')](function(_0x3ba3ce){logger['error'](_0x43ec('0xf'),_0x143d63,_0x3ba3ce);_0x3d0e49(_0x3ba3ce);});});} \ No newline at end of file +var _0xe91e=['../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1484b1,_0x53ee83){var _0x1b82d9=function(_0x398bb7){while(--_0x398bb7){_0x1484b1['push'](_0x1484b1['shift']());}};_0x1b82d9(++_0x53ee83);}(_0xe91e,0x1d6));var _0xee91=function(_0x3e806a,_0xa4b9fa){_0x3e806a=_0x3e806a-0x0;var _0x477105=_0xe91e[_0x3e806a];return _0x477105;};'use strict';var _=require(_0xee91('0x0'));var util=require(_0xee91('0x1'));var moment=require(_0xee91('0x2'));var BPromise=require(_0xee91('0x3'));var rs=require(_0xee91('0x4'));var fs=require('fs');var Redis=require(_0xee91('0x5'));var db=require(_0xee91('0x6'))['db'];var utils=require(_0xee91('0x7'));var logger=require(_0xee91('0x8'))(_0xee91('0x9'));var config=require(_0xee91('0xa'));var jayson=require(_0xee91('0xb'));var client=jayson[_0xee91('0xc')][_0xee91('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4529c2,_0x1f93e0,_0x1f6faf){return new BPromise(function(_0x2dfc2e,_0x48daca){return client[_0xee91('0xe')](_0x4529c2,_0x1f6faf)['then'](function(_0x26e613){logger[_0xee91('0xf')](_0xee91('0x10'),_0x1f93e0,_0xee91('0x11'));logger[_0xee91('0x12')](_0xee91('0x13'),_0x1f93e0,'request\x20sent',JSON['stringify'](_0x26e613));if(_0x26e613[_0xee91('0x14')]){if(_0x26e613[_0xee91('0x14')][_0xee91('0x15')]===0x1f4){logger[_0xee91('0x14')](_0xee91('0x10'),_0x1f93e0,_0x26e613[_0xee91('0x14')][_0xee91('0x16')]);return _0x48daca(_0x26e613[_0xee91('0x14')][_0xee91('0x16')]);}logger[_0xee91('0x14')](_0xee91('0x10'),_0x1f93e0,_0x26e613[_0xee91('0x14')][_0xee91('0x16')]);return _0x2dfc2e(_0x26e613[_0xee91('0x14')][_0xee91('0x16')]);}else{logger[_0xee91('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1f93e0,_0xee91('0x11'));_0x2dfc2e(_0x26e613['result']['message']);}})[_0xee91('0x17')](function(_0x10e159){logger[_0xee91('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1f93e0,_0x10e159);_0x48daca(_0x10e159);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 53e551c..3bd4f8b 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 _0x78d8=['preview','/:id/run','run','/:id/query','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x36cf8b,_0x488a3f){var _0x143334=function(_0xb5b92c){while(--_0xb5b92c){_0x36cf8b['push'](_0x36cf8b['shift']());}};_0x143334(++_0x488a3f);}(_0x78d8,0x1a7));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x878d('0x0'));var util=require('util');var path=require(_0x878d('0x1'));var timeout=require(_0x878d('0x2'));var express=require(_0x878d('0x3'));var router=express[_0x878d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x878d('0x5'));var interaction=require(_0x878d('0x6'));var config=require(_0x878d('0x7'));var controller=require(_0x878d('0x8'));router[_0x878d('0x9')]('/',auth[_0x878d('0xa')](),controller[_0x878d('0xb')]);router['get'](_0x878d('0xc'),auth[_0x878d('0xa')](),controller[_0x878d('0xd')]);router[_0x878d('0x9')]('/:id/preview',auth[_0x878d('0xa')](),controller[_0x878d('0xe')]);router['get'](_0x878d('0xf'),auth['isAuthenticated'](),controller[_0x878d('0x10')]);router[_0x878d('0x9')](_0x878d('0x11'),auth[_0x878d('0xa')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x878d('0x12')]);router[_0x878d('0x13')](_0x878d('0xc'),auth['isAuthenticated'](),controller[_0x878d('0x14')]);router[_0x878d('0x15')]('/:id',auth[_0x878d('0xa')](),controller[_0x878d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x889c=['query','post','create','put','delete','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','show','/:id/preview','isAuthenticated','preview'];(function(_0xbd3036,_0xfd444f){var _0x4bfb07=function(_0xaf200f){while(--_0xaf200f){_0xbd3036['push'](_0xbd3036['shift']());}};_0x4bfb07(++_0xfd444f);}(_0x889c,0x146));var _0xc889=function(_0x2793a5,_0x2b0f5f){_0x2793a5=_0x2793a5-0x0;var _0x88418f=_0x889c[_0x2793a5];return _0x88418f;};'use strict';var multer=require(_0xc889('0x0'));var util=require(_0xc889('0x1'));var path=require(_0xc889('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc889('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc889('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc889('0x5'));var controller=require(_0xc889('0x6'));router[_0xc889('0x7')]('/',auth['isAuthenticated'](),controller[_0xc889('0x8')]);router[_0xc889('0x7')](_0xc889('0x9'),auth['isAuthenticated'](),controller[_0xc889('0xa')]);router['get'](_0xc889('0xb'),auth[_0xc889('0xc')](),controller[_0xc889('0xd')]);router[_0xc889('0x7')]('/:id/run',auth[_0xc889('0xc')](),controller['run']);router['get']('/:id/query',auth[_0xc889('0xc')](),controller[_0xc889('0xe')]);router[_0xc889('0xf')]('/',auth[_0xc889('0xc')](),controller[_0xc889('0x10')]);router[_0xc889('0x11')](_0xc889('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc889('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc889('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 1692421..aede523 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 _0x5007=['manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','xlsx','csv','DATE'];(function(_0x564b55,_0x349f9c){var _0x35f8e0=function(_0xecc49c){while(--_0xecc49c){_0x564b55['push'](_0x564b55['shift']());}};_0x35f8e0(++_0x349f9c);}(_0x5007,0x137));var _0x7500=function(_0x104533,_0x2bd1ab){_0x104533=_0x104533-0x0;var _0x39908c=_0x5007[_0x104533];return _0x39908c;};'use strict';var Sequelize=require(_0x7500('0x0'));var moment=require(_0x7500('0x1'));module[_0x7500('0x2')]={'name':{'type':Sequelize[_0x7500('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x7500('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x7500('0x4')]('csv','pdf',_0x7500('0x5')),'allowNull':![],'defaultValue':_0x7500('0x6')},'savename':{'type':Sequelize[_0x7500('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7500('0x7')]},'endDate':{'type':Sequelize[_0x7500('0x7')]},'status':{'type':Sequelize[_0x7500('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x7500('0x4')](_0x7500('0x8'),_0x7500('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x7500('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7500('0x3')]}}; \ No newline at end of file +var _0xfd75=['csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM'];(function(_0x480b8b,_0x3540bf){var _0x248ba6=function(_0x2ecb62){while(--_0x2ecb62){_0x480b8b['push'](_0x480b8b['shift']());}};_0x248ba6(++_0x3540bf);}(_0xfd75,0x168));var _0x5fd7=function(_0x250bbc,_0x3297f3){_0x250bbc=_0x250bbc-0x0;var _0x489e34=_0xfd75[_0x250bbc];return _0x489e34;};'use strict';var Sequelize=require(_0x5fd7('0x0'));var moment=require('moment');module[_0x5fd7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x5fd7('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x5fd7('0x3')](_0x5fd7('0x4'),_0x5fd7('0x5'),_0x5fd7('0x6')),'allowNull':![],'defaultValue':_0x5fd7('0x4')},'savename':{'type':Sequelize[_0x5fd7('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5fd7('0x7')]},'endDate':{'type':Sequelize[_0x5fd7('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x5fd7('0x8')},'type':{'type':Sequelize[_0x5fd7('0x3')](_0x5fd7('0x9'),_0x5fd7('0xa')),'allowNull':![],'defaultValue':_0x5fd7('0x9')},'reportId':{'type':Sequelize[_0x5fd7('0xb')](0xb)[_0x5fd7('0xc')]},'reportType':{'type':Sequelize[_0x5fd7('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 919b418..ba1a5a6 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 _0x23aa=['model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','join','server/files/reports','savename','Sequelize','root','%s.%s','output','toLowerCase','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','intersection'];(function(_0x3bd139,_0x52a505){var _0xa9342a=function(_0xb2a913){while(--_0xb2a913){_0x3bd139['push'](_0x3bd139['shift']());}};_0xa9342a(++_0x52a505);}(_0x23aa,0x186));var _0xa23a=function(_0x482499,_0x5e6a2f){_0x482499=_0x482499-0x0;var _0x435049=_0x23aa[_0x482499];return _0x435049;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa23a('0x0'));var rp=require(_0xa23a('0x1'));var moment=require(_0xa23a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa23a('0x3'));var util=require(_0xa23a('0x4'));var path=require('path');var sox=require(_0xa23a('0x5'));var csv=require(_0xa23a('0x6'));var ejs=require(_0xa23a('0x7'));var fs=require('fs');var fs_extra=require(_0xa23a('0x8'));var _=require(_0xa23a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa23a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa23a('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xa23a('0xc'));var as=require(_0xa23a('0xd'));var hardwareService=require(_0xa23a('0xe'));var logger=require(_0xa23a('0xf'))(_0xa23a('0x10'));var utils=require(_0xa23a('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x536695,_0x5b11a9){_0x5b11a9=_0x5b11a9||0xcc;return function(_0x2b8d77){if(_0x2b8d77){return _0x536695[_0xa23a('0x12')](_0x5b11a9);}return _0x536695[_0xa23a('0x13')](_0x5b11a9)[_0xa23a('0x14')]();};}function respondWithResult(_0x39327b,_0x5924bb){_0x5924bb=_0x5924bb||0xc8;return function(_0x30a48e){if(_0x30a48e){return _0x39327b[_0xa23a('0x13')](_0x5924bb)[_0xa23a('0x15')](_0x30a48e);}};}function respondWithFilteredResult(_0xbbb0f4,_0x27b768){return function(_0x311795){if(_0x311795){var _0xe34645=typeof _0x27b768[_0xa23a('0x16')]===_0xa23a('0x17')&&typeof _0x27b768['limit']===_0xa23a('0x17');var _0x48c56d=_0x311795['count'];var _0x14b13a=_0xe34645?0x0:_0x27b768[_0xa23a('0x16')];var _0x56d3d2=_0xe34645?_0x311795['count']:_0x27b768[_0xa23a('0x16')]+_0x27b768[_0xa23a('0x18')];var _0x534997;if(_0x56d3d2>=_0x48c56d){_0x56d3d2=_0x48c56d;_0x534997=0xc8;}else{_0x534997=0xce;}_0xbbb0f4[_0xa23a('0x13')](_0x534997);return _0xbbb0f4[_0xa23a('0x19')]('Content-Range',_0x14b13a+'-'+_0x56d3d2+'/'+_0x48c56d)['json'](_0x311795);}return null;};}function patchUpdates(_0xdf65b){return function(_0x3fc829){try{jsonpatch[_0xa23a('0x1a')](_0x3fc829,_0xdf65b,!![]);}catch(_0xc950dc){return BPromise[_0xa23a('0x1b')](_0xc950dc);}return _0x3fc829[_0xa23a('0x1c')]();};}function saveUpdates(_0xadf8c5,_0x47cdce){return function(_0x4d2b6d){if(_0x4d2b6d){return _0x4d2b6d[_0xa23a('0x1d')](_0xadf8c5)[_0xa23a('0x1e')](function(_0x7f4c7e){return _0x7f4c7e;});}return null;};}function removeEntity(_0x2c31fb,_0xe68498){return function(_0x5acae1){if(_0x5acae1){return _0x5acae1[_0xa23a('0x1f')]()[_0xa23a('0x1e')](function(){var _0x8ac9c9=_0x5acae1['get']({'plain':!![]});var _0x59e7d8=_0xa23a('0x20');return db[_0xa23a('0x21')][_0xa23a('0x1f')]({'where':{'type':_0x59e7d8,'resourceId':_0x8ac9c9['id']}})[_0xa23a('0x1e')](function(){return _0x5acae1;});})[_0xa23a('0x1e')](function(){_0x2c31fb[_0xa23a('0x13')](0xcc)[_0xa23a('0x14')]();});}};}function handleEntityNotFound(_0x3dbeb9,_0x5ea7f1){return function(_0x938663){if(!_0x938663){_0x3dbeb9['sendStatus'](0x194);}return _0x938663;};}function handleError(_0x10ba19,_0x291063){_0x291063=_0x291063||0x1f4;return function(_0x10308b){logger['error'](_0x10308b['stack']);if(_0x10308b[_0xa23a('0x22')]){delete _0x10308b['name'];}_0x10ba19['status'](_0x291063)[_0xa23a('0x23')](_0x10308b);};}exports['index']=function(_0x43e557,_0x1dfa94){var _0x4c33d9={},_0x43265d={},_0x454ca3={'count':0x0,'rows':[]};var _0x4c13c9=_[_0xa23a('0x24')](db[_0xa23a('0x25')][_0xa23a('0x26')],function(_0x29e611){return{'name':_0x29e611[_0xa23a('0x27')],'type':_0x29e611[_0xa23a('0x28')][_0xa23a('0x29')]};});_0x43265d['model']=_[_0xa23a('0x24')](_0x4c13c9,'name');_0x43265d[_0xa23a('0x2a')]=_[_0xa23a('0x2b')](_0x43e557[_0xa23a('0x2a')]);_0x43265d['filters']=_[_0xa23a('0x2c')](_0x43265d[_0xa23a('0x2d')],_0x43265d[_0xa23a('0x2a')]);_0x4c33d9[_0xa23a('0x2e')]=_[_0xa23a('0x2c')](_0x43265d[_0xa23a('0x2d')],qs[_0xa23a('0x2f')](_0x43e557[_0xa23a('0x2a')][_0xa23a('0x2f')]));_0x4c33d9['attributes']=_0x4c33d9['attributes'][_0xa23a('0x30')]?_0x4c33d9['attributes']:_0x43265d[_0xa23a('0x2d')];if(!_0x43e557[_0xa23a('0x2a')]['hasOwnProperty'](_0xa23a('0x31'))){_0x4c33d9[_0xa23a('0x18')]=qs[_0xa23a('0x18')](_0x43e557['query'][_0xa23a('0x18')]);_0x4c33d9[_0xa23a('0x16')]=qs[_0xa23a('0x16')](_0x43e557[_0xa23a('0x2a')][_0xa23a('0x16')]);}_0x4c33d9[_0xa23a('0x32')]=qs[_0xa23a('0x33')](_0x43e557['query'][_0xa23a('0x33')]);_0x4c33d9[_0xa23a('0x34')]=qs[_0xa23a('0x35')](_[_0xa23a('0x36')](_0x43e557['query'],_0x43265d[_0xa23a('0x35')]),_0x4c13c9);if(_0x43e557[_0xa23a('0x2a')][_0xa23a('0x37')]){_0x4c33d9[_0xa23a('0x34')]=_[_0xa23a('0x38')](_0x4c33d9[_0xa23a('0x34')],{'$or':_[_0xa23a('0x24')](_0x4c13c9,function(_0x47d86b){if(_0x47d86b['type']!==_0xa23a('0x39')){var _0x70d47d={};_0x70d47d[_0x47d86b[_0xa23a('0x22')]]={'$like':'%'+_0x43e557[_0xa23a('0x2a')][_0xa23a('0x37')]+'%'};return _0x70d47d;}})});}_0x4c33d9=_[_0xa23a('0x38')]({},_0x4c33d9,_0x43e557[_0xa23a('0x3a')]);var _0x524e67={'where':_0x4c33d9[_0xa23a('0x34')]};return db[_0xa23a('0x25')][_0xa23a('0x3b')](_0x524e67)['then'](function(_0x3fcbcf){_0x454ca3[_0xa23a('0x3b')]=_0x3fcbcf;if(_0x43e557[_0xa23a('0x2a')][_0xa23a('0x3c')]){_0x4c33d9[_0xa23a('0x3d')]=[{'all':!![]}];}return db[_0xa23a('0x25')][_0xa23a('0x3e')](_0x4c33d9);})['then'](function(_0x890202){_0x454ca3[_0xa23a('0x3f')]=_0x890202;return _0x454ca3;})[_0xa23a('0x1e')](respondWithFilteredResult(_0x1dfa94,_0x4c33d9))[_0xa23a('0x40')](handleError(_0x1dfa94,null));};exports[_0xa23a('0x41')]=function(_0x596af5,_0x48df1c){var _0xc14b82={'raw':!![],'where':{'id':_0x596af5[_0xa23a('0x42')]['id']}},_0x13cb4f={};_0x13cb4f[_0xa23a('0x2d')]=_[_0xa23a('0x2b')](db[_0xa23a('0x25')][_0xa23a('0x26')]);_0x13cb4f[_0xa23a('0x2a')]=_[_0xa23a('0x2b')](_0x596af5[_0xa23a('0x2a')]);_0x13cb4f[_0xa23a('0x35')]=_[_0xa23a('0x2c')](_0x13cb4f[_0xa23a('0x2d')],_0x13cb4f['query']);_0xc14b82[_0xa23a('0x2e')]=_[_0xa23a('0x2c')](_0x13cb4f[_0xa23a('0x2d')],qs['fields'](_0x596af5[_0xa23a('0x2a')][_0xa23a('0x2f')]));_0xc14b82[_0xa23a('0x2e')]=_0xc14b82['attributes'][_0xa23a('0x30')]?_0xc14b82[_0xa23a('0x2e')]:_0x13cb4f[_0xa23a('0x2d')];if(_0x596af5[_0xa23a('0x2a')][_0xa23a('0x3c')]){_0xc14b82[_0xa23a('0x3d')]=[{'all':!![]}];}_0xc14b82=_[_0xa23a('0x38')]({},_0xc14b82,_0x596af5[_0xa23a('0x3a')]);return db[_0xa23a('0x25')][_0xa23a('0x43')](_0xc14b82)[_0xa23a('0x1e')](handleEntityNotFound(_0x48df1c,null))[_0xa23a('0x1e')](respondWithResult(_0x48df1c,null))['catch'](handleError(_0x48df1c,null));};exports['create']=function(_0x272ff4,_0x352157){return db[_0xa23a('0x25')][_0xa23a('0x44')](_0x272ff4['body'],{})[_0xa23a('0x1e')](function(_0x12f018){var _0x39a0c9=_0x272ff4[_0xa23a('0x45')][_0xa23a('0x46')]({'plain':!![]});if(!_0x39a0c9)throw new Error(_0xa23a('0x47'));if(_0x39a0c9['role']==='user'){var _0x5289bd=_0x12f018[_0xa23a('0x46')]({'plain':!![]});var _0x4470a8=_0xa23a('0x20');return db[_0xa23a('0x48')][_0xa23a('0x43')]({'where':{'name':_0x4470a8,'userProfileId':_0x39a0c9[_0xa23a('0x49')]},'raw':!![]})[_0xa23a('0x1e')](function(_0x534443){if(_0x534443&&_0x534443['autoAssociation']===0x0){return db[_0xa23a('0x21')][_0xa23a('0x44')]({'name':_0x5289bd['name'],'resourceId':_0x5289bd['id'],'type':_0x534443[_0xa23a('0x22')],'sectionId':_0x534443['id']},{})[_0xa23a('0x1e')](function(){return _0x12f018;});}else{return _0x12f018;}})[_0xa23a('0x40')](function(_0x4322a7){logger[_0xa23a('0x4a')](_0xa23a('0x4b'),_0x4322a7);throw _0x4322a7;});}return _0x12f018;})[_0xa23a('0x1e')](respondWithResult(_0x352157,0xc9))['catch'](handleError(_0x352157,null));};exports[_0xa23a('0x1d')]=function(_0x213989,_0x4ad042){if(_0x213989[_0xa23a('0x4c')]['id']){delete _0x213989[_0xa23a('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0xa23a('0x43')]({'where':{'id':_0x213989[_0xa23a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4ad042,null))[_0xa23a('0x1e')](saveUpdates(_0x213989[_0xa23a('0x4c')],null))[_0xa23a('0x1e')](respondWithResult(_0x4ad042,null))[_0xa23a('0x40')](handleError(_0x4ad042,null));};exports[_0xa23a('0x1f')]=function(_0x2e8f8b,_0x55161c){return db[_0xa23a('0x25')][_0xa23a('0x43')]({'where':{'id':_0x2e8f8b[_0xa23a('0x42')]['id']}})[_0xa23a('0x1e')](handleEntityNotFound(_0x55161c,null))[_0xa23a('0x1e')](removeEntity(_0x55161c,null))[_0xa23a('0x40')](handleError(_0x55161c,null));};exports[_0xa23a('0x4d')]=function(_0x1cafe2,_0x4ad0d9,_0x37fa51){return db[_0xa23a('0x25')][_0xa23a('0x43')]({'where':{'id':_0x1cafe2[_0xa23a('0x42')]['id']},'attributes':[_0xa23a('0x22'),_0xa23a('0x4e'),'savename','output'],'raw':!![]})[_0xa23a('0x1e')](handleEntityNotFound(_0x4ad0d9,null))[_0xa23a('0x1e')](function(_0x387e1d){if(_0x387e1d){if(!fs['existsSync'](path[_0xa23a('0x4f')](config['root'],_0xa23a('0x50'),_0x387e1d[_0xa23a('0x51')]))){throw new db[(_0xa23a('0x52'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x1cafe2[_0xa23a('0x2a')]['exists']){return _0x4ad0d9[_0xa23a('0x12')](0xc8);}return _0x4ad0d9[_0xa23a('0x4d')](path[_0xa23a('0x4f')](config[_0xa23a('0x53')],_0xa23a('0x50'),_0x387e1d[_0xa23a('0x51')]),util['format'](_0xa23a('0x54'),_0x387e1d[_0xa23a('0x4e')]||_0x387e1d['name'],_0x387e1d[_0xa23a('0x55')][_0xa23a('0x56')]()));}})[_0xa23a('0x40')](handleError(_0x4ad0d9,null));}; \ No newline at end of file +var _0xc7f4=['VIRTUAL','options','includeAll','include','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','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/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','end','name','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type'];(function(_0x466f9f,_0x4d1211){var _0x30761a=function(_0x141e6b){while(--_0x141e6b){_0x466f9f['push'](_0x466f9f['shift']());}};_0x30761a(++_0x4d1211);}(_0xc7f4,0x138));var _0x4c7f=function(_0x2c0831,_0xad258e){_0x2c0831=_0x2c0831-0x0;var _0x50f001=_0xc7f4[_0x2c0831];return _0x50f001;};'use strict';var emlformat=require(_0x4c7f('0x0'));var rimraf=require(_0x4c7f('0x1'));var zipdir=require(_0x4c7f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c7f('0x3'));var moment=require(_0x4c7f('0x4'));var BPromise=require(_0x4c7f('0x5'));var Mustache=require(_0x4c7f('0x6'));var util=require(_0x4c7f('0x7'));var path=require('path');var sox=require(_0x4c7f('0x8'));var csv=require('to-csv');var ejs=require(_0x4c7f('0x9'));var fs=require('fs');var fs_extra=require(_0x4c7f('0xa'));var _=require(_0x4c7f('0xb'));var squel=require(_0x4c7f('0xc'));var crypto=require(_0x4c7f('0xd'));var jsforce=require(_0x4c7f('0xe'));var deskjs=require(_0x4c7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c7f('0x10'));var Papa=require('papaparse');var Redis=require(_0x4c7f('0x11'));var authService=require(_0x4c7f('0x12'));var qs=require(_0x4c7f('0x13'));var as=require(_0x4c7f('0x14'));var hardwareService=require(_0x4c7f('0x15'));var logger=require(_0x4c7f('0x16'))(_0x4c7f('0x17'));var utils=require(_0x4c7f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4c7f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dced3,_0x3f403f){_0x3f403f=_0x3f403f||0xcc;return function(_0x52f904){if(_0x52f904){return _0x5dced3[_0x4c7f('0x1a')](_0x3f403f);}return _0x5dced3['status'](_0x3f403f)['end']();};}function respondWithResult(_0x40512a,_0x4636f8){_0x4636f8=_0x4636f8||0xc8;return function(_0x5e84f9){if(_0x5e84f9){return _0x40512a[_0x4c7f('0x1b')](_0x4636f8)[_0x4c7f('0x1c')](_0x5e84f9);}};}function respondWithFilteredResult(_0x480c42,_0x312ef7){return function(_0x3ab1f4){if(_0x3ab1f4){var _0x977a80=typeof _0x312ef7[_0x4c7f('0x1d')]===_0x4c7f('0x1e')&&typeof _0x312ef7[_0x4c7f('0x1f')]===_0x4c7f('0x1e');var _0x200375=_0x3ab1f4[_0x4c7f('0x20')];var _0x5d10b4=_0x977a80?0x0:_0x312ef7[_0x4c7f('0x1d')];var _0x73fe2c=_0x977a80?_0x3ab1f4[_0x4c7f('0x20')]:_0x312ef7[_0x4c7f('0x1d')]+_0x312ef7['limit'];var _0x2c42e3;if(_0x73fe2c>=_0x200375){_0x73fe2c=_0x200375;_0x2c42e3=0xc8;}else{_0x2c42e3=0xce;}_0x480c42['status'](_0x2c42e3);return _0x480c42[_0x4c7f('0x21')](_0x4c7f('0x22'),_0x5d10b4+'-'+_0x73fe2c+'/'+_0x200375)['json'](_0x3ab1f4);}return null;};}function patchUpdates(_0x5835eb){return function(_0x41d548){try{jsonpatch['apply'](_0x41d548,_0x5835eb,!![]);}catch(_0x377ed3){return BPromise[_0x4c7f('0x23')](_0x377ed3);}return _0x41d548[_0x4c7f('0x24')]();};}function saveUpdates(_0x4e0da4,_0x433949){return function(_0x507162){if(_0x507162){return _0x507162[_0x4c7f('0x25')](_0x4e0da4)[_0x4c7f('0x26')](function(_0x39495d){return _0x39495d;});}return null;};}function removeEntity(_0x23143c,_0x393ebb){return function(_0x5aecd3){if(_0x5aecd3){return _0x5aecd3[_0x4c7f('0x27')]()['then'](function(){var _0x3b9145=_0x5aecd3[_0x4c7f('0x28')]({'plain':!![]});var _0x546714=_0x4c7f('0x29');return db['UserProfileResource'][_0x4c7f('0x27')]({'where':{'type':_0x546714,'resourceId':_0x3b9145['id']}})[_0x4c7f('0x26')](function(){return _0x5aecd3;});})[_0x4c7f('0x26')](function(){_0x23143c[_0x4c7f('0x1b')](0xcc)[_0x4c7f('0x2a')]();});}};}function handleEntityNotFound(_0x89d178,_0x1d9b0c){return function(_0x70846f){if(!_0x70846f){_0x89d178['sendStatus'](0x194);}return _0x70846f;};}function handleError(_0x56a65f,_0x4af42f){_0x4af42f=_0x4af42f||0x1f4;return function(_0x304399){logger['error'](_0x304399['stack']);if(_0x304399[_0x4c7f('0x2b')]){delete _0x304399['name'];}_0x56a65f[_0x4c7f('0x1b')](_0x4af42f)['send'](_0x304399);};}exports['index']=function(_0x1bfc80,_0x519c92){var _0x7bdcfb={},_0xbcdeb6={},_0x1265a1={'count':0x0,'rows':[]};var _0x62b5ac=_[_0x4c7f('0x2c')](db[_0x4c7f('0x2d')][_0x4c7f('0x2e')],function(_0xf1a22c){return{'name':_0xf1a22c[_0x4c7f('0x2f')],'type':_0xf1a22c['type'][_0x4c7f('0x30')]};});_0xbcdeb6[_0x4c7f('0x31')]=_[_0x4c7f('0x2c')](_0x62b5ac,_0x4c7f('0x2b'));_0xbcdeb6[_0x4c7f('0x32')]=_[_0x4c7f('0x33')](_0x1bfc80['query']);_0xbcdeb6[_0x4c7f('0x34')]=_[_0x4c7f('0x35')](_0xbcdeb6['model'],_0xbcdeb6[_0x4c7f('0x32')]);_0x7bdcfb[_0x4c7f('0x36')]=_[_0x4c7f('0x35')](_0xbcdeb6['model'],qs[_0x4c7f('0x37')](_0x1bfc80[_0x4c7f('0x32')][_0x4c7f('0x37')]));_0x7bdcfb[_0x4c7f('0x36')]=_0x7bdcfb[_0x4c7f('0x36')]['length']?_0x7bdcfb[_0x4c7f('0x36')]:_0xbcdeb6[_0x4c7f('0x31')];if(!_0x1bfc80[_0x4c7f('0x32')][_0x4c7f('0x38')](_0x4c7f('0x39'))){_0x7bdcfb['limit']=qs[_0x4c7f('0x1f')](_0x1bfc80[_0x4c7f('0x32')][_0x4c7f('0x1f')]);_0x7bdcfb['offset']=qs[_0x4c7f('0x1d')](_0x1bfc80[_0x4c7f('0x32')][_0x4c7f('0x1d')]);}_0x7bdcfb['order']=qs[_0x4c7f('0x3a')](_0x1bfc80[_0x4c7f('0x32')][_0x4c7f('0x3a')]);_0x7bdcfb['where']=qs[_0x4c7f('0x34')](_[_0x4c7f('0x3b')](_0x1bfc80[_0x4c7f('0x32')],_0xbcdeb6[_0x4c7f('0x34')]),_0x62b5ac);if(_0x1bfc80[_0x4c7f('0x32')][_0x4c7f('0x3c')]){_0x7bdcfb['where']=_[_0x4c7f('0x3d')](_0x7bdcfb[_0x4c7f('0x3e')],{'$or':_[_0x4c7f('0x2c')](_0x62b5ac,function(_0x3817ec){if(_0x3817ec[_0x4c7f('0x3f')]!==_0x4c7f('0x40')){var _0x323959={};_0x323959[_0x3817ec[_0x4c7f('0x2b')]]={'$like':'%'+_0x1bfc80[_0x4c7f('0x32')]['filter']+'%'};return _0x323959;}})});}_0x7bdcfb=_[_0x4c7f('0x3d')]({},_0x7bdcfb,_0x1bfc80[_0x4c7f('0x41')]);var _0x335202={'where':_0x7bdcfb[_0x4c7f('0x3e')]};return db[_0x4c7f('0x2d')][_0x4c7f('0x20')](_0x335202)['then'](function(_0x4119cb){_0x1265a1[_0x4c7f('0x20')]=_0x4119cb;if(_0x1bfc80['query'][_0x4c7f('0x42')]){_0x7bdcfb[_0x4c7f('0x43')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x7bdcfb);})['then'](function(_0x11d46b){_0x1265a1['rows']=_0x11d46b;return _0x1265a1;})[_0x4c7f('0x26')](respondWithFilteredResult(_0x519c92,_0x7bdcfb))[_0x4c7f('0x44')](handleError(_0x519c92,null));};exports[_0x4c7f('0x45')]=function(_0x1a00b1,_0x3c3748){var _0x40a3db={'raw':!![],'where':{'id':_0x1a00b1[_0x4c7f('0x46')]['id']}},_0x26c778={};_0x26c778[_0x4c7f('0x31')]=_[_0x4c7f('0x33')](db[_0x4c7f('0x2d')]['rawAttributes']);_0x26c778[_0x4c7f('0x32')]=_[_0x4c7f('0x33')](_0x1a00b1[_0x4c7f('0x32')]);_0x26c778[_0x4c7f('0x34')]=_[_0x4c7f('0x35')](_0x26c778['model'],_0x26c778['query']);_0x40a3db[_0x4c7f('0x36')]=_[_0x4c7f('0x35')](_0x26c778[_0x4c7f('0x31')],qs['fields'](_0x1a00b1['query'][_0x4c7f('0x37')]));_0x40a3db[_0x4c7f('0x36')]=_0x40a3db[_0x4c7f('0x36')][_0x4c7f('0x47')]?_0x40a3db['attributes']:_0x26c778[_0x4c7f('0x31')];if(_0x1a00b1[_0x4c7f('0x32')][_0x4c7f('0x42')]){_0x40a3db['include']=[{'all':!![]}];}_0x40a3db=_[_0x4c7f('0x3d')]({},_0x40a3db,_0x1a00b1[_0x4c7f('0x41')]);return db[_0x4c7f('0x2d')]['find'](_0x40a3db)['then'](handleEntityNotFound(_0x3c3748,null))[_0x4c7f('0x26')](respondWithResult(_0x3c3748,null))['catch'](handleError(_0x3c3748,null));};exports[_0x4c7f('0x48')]=function(_0xfadcc2,_0x1975c4){return db[_0x4c7f('0x2d')][_0x4c7f('0x48')](_0xfadcc2[_0x4c7f('0x49')],{})[_0x4c7f('0x26')](function(_0x4fa949){var _0x5db5b8=_0xfadcc2['user'][_0x4c7f('0x28')]({'plain':!![]});if(!_0x5db5b8)throw new Error(_0x4c7f('0x4a'));if(_0x5db5b8['role']===_0x4c7f('0x4b')){var _0x5bd909=_0x4fa949[_0x4c7f('0x28')]({'plain':!![]});var _0x4b32a4=_0x4c7f('0x29');return db[_0x4c7f('0x4c')][_0x4c7f('0x4d')]({'where':{'name':_0x4b32a4,'userProfileId':_0x5db5b8[_0x4c7f('0x4e')]},'raw':!![]})[_0x4c7f('0x26')](function(_0x2037cd){if(_0x2037cd&&_0x2037cd[_0x4c7f('0x4f')]===0x0){return db[_0x4c7f('0x50')][_0x4c7f('0x48')]({'name':_0x5bd909[_0x4c7f('0x2b')],'resourceId':_0x5bd909['id'],'type':_0x2037cd[_0x4c7f('0x2b')],'sectionId':_0x2037cd['id']},{})[_0x4c7f('0x26')](function(){return _0x4fa949;});}else{return _0x4fa949;}})[_0x4c7f('0x44')](function(_0x3cd839){logger[_0x4c7f('0x51')](_0x4c7f('0x52'),_0x3cd839);throw _0x3cd839;});}return _0x4fa949;})[_0x4c7f('0x26')](respondWithResult(_0x1975c4,0xc9))[_0x4c7f('0x44')](handleError(_0x1975c4,null));};exports[_0x4c7f('0x25')]=function(_0xf8ef71,_0x5ce510){if(_0xf8ef71[_0x4c7f('0x49')]['id']){delete _0xf8ef71[_0x4c7f('0x49')]['id'];}return db[_0x4c7f('0x2d')][_0x4c7f('0x4d')]({'where':{'id':_0xf8ef71[_0x4c7f('0x46')]['id']}})[_0x4c7f('0x26')](handleEntityNotFound(_0x5ce510,null))[_0x4c7f('0x26')](saveUpdates(_0xf8ef71[_0x4c7f('0x49')],null))[_0x4c7f('0x26')](respondWithResult(_0x5ce510,null))[_0x4c7f('0x44')](handleError(_0x5ce510,null));};exports['destroy']=function(_0x3b5cd2,_0x455684){return db['AnalyticExtractedReport'][_0x4c7f('0x4d')]({'where':{'id':_0x3b5cd2[_0x4c7f('0x46')]['id']}})[_0x4c7f('0x26')](handleEntityNotFound(_0x455684,null))[_0x4c7f('0x26')](removeEntity(_0x455684,null))[_0x4c7f('0x44')](handleError(_0x455684,null));};exports['download']=function(_0x582c03,_0x21633f,_0x486164){return db[_0x4c7f('0x2d')]['find']({'where':{'id':_0x582c03[_0x4c7f('0x46')]['id']},'attributes':[_0x4c7f('0x2b'),_0x4c7f('0x53'),_0x4c7f('0x54'),_0x4c7f('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x21633f,null))[_0x4c7f('0x26')](function(_0x38ec3a){if(_0x38ec3a){if(!fs['existsSync'](path[_0x4c7f('0x56')](config[_0x4c7f('0x57')],_0x4c7f('0x58'),_0x38ec3a[_0x4c7f('0x54')]))){throw new db[(_0x4c7f('0x59'))][(_0x4c7f('0x5a'))](_0x4c7f('0x5b'));}if(_0x582c03[_0x4c7f('0x32')][_0x4c7f('0x5c')]){return _0x21633f[_0x4c7f('0x1a')](0xc8);}return _0x21633f['download'](path[_0x4c7f('0x56')](config[_0x4c7f('0x57')],_0x4c7f('0x58'),_0x38ec3a['savename']),util['format']('%s.%s',_0x38ec3a['basename']||_0x38ec3a[_0x4c7f('0x2b')],_0x38ec3a[_0x4c7f('0x55')][_0x4c7f('0x5d')]()));}})[_0x4c7f('0x44')](handleError(_0x21633f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index edf7b77..fe90c0c 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 _0x42b8=['../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x7cf8dd,_0x51047c){var _0x308766=function(_0x3228ec){while(--_0x3228ec){_0x7cf8dd['push'](_0x7cf8dd['shift']());}};_0x308766(++_0x51047c);}(_0x42b8,0xb4));var _0x842b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x42b8[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x842b('0x0'));var logger=require(_0x842b('0x1'))(_0x842b('0x2'));var moment=require('moment');var BPromise=require(_0x842b('0x3'));var rp=require(_0x842b('0x4'));var fs=require('fs');var path=require(_0x842b('0x5'));var rimraf=require(_0x842b('0x6'));var config=require(_0x842b('0x7'));var attributes=require(_0x842b('0x8'));module['exports']=function(_0x182a15,_0x49cde2){return _0x182a15['define'](_0x842b('0x9'),attributes,{'tableName':_0x842b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd872=['path','../../config/environment','./analyticExtractedReport.attributes','define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x494d38,_0x57869a){var _0x47f710=function(_0x3b2a3c){while(--_0x3b2a3c){_0x494d38['push'](_0x494d38['shift']());}};_0x47f710(++_0x57869a);}(_0xd872,0x170));var _0x2d87=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd872[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2d87('0x0'));var util=require(_0x2d87('0x1'));var logger=require(_0x2d87('0x2'))('api');var moment=require(_0x2d87('0x3'));var BPromise=require(_0x2d87('0x4'));var rp=require(_0x2d87('0x5'));var fs=require('fs');var path=require(_0x2d87('0x6'));var rimraf=require('rimraf');var config=require(_0x2d87('0x7'));var attributes=require(_0x2d87('0x8'));module['exports']=function(_0x18df4b,_0x277a9f){return _0x18df4b[_0x2d87('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0x2d87('0xa'),'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 5cb54e1..f48740a 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 _0x2ed3=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x3ad26d,_0x195104){var _0x45fff4=function(_0x4b9a9e){while(--_0x4b9a9e){_0x3ad26d['push'](_0x3ad26d['shift']());}};_0x45fff4(++_0x195104);}(_0x2ed3,0x7c));var _0x32ed=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0x2ed3[_0x3d5351];return _0x1db4db;};'use strict';var _=require(_0x32ed('0x0'));var util=require(_0x32ed('0x1'));var moment=require(_0x32ed('0x2'));var BPromise=require(_0x32ed('0x3'));var rs=require(_0x32ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32ed('0x5'));var logger=require(_0x32ed('0x6'))('rpc');var config=require(_0x32ed('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x32ed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e2df4,_0x3d5a89,_0x3fa0f2){return new BPromise(function(_0x50791c,_0x5cf838){return client[_0x32ed('0x9')](_0x1e2df4,_0x3fa0f2)[_0x32ed('0xa')](function(_0x4ee920){logger['info'](_0x32ed('0xb'),_0x3d5a89,_0x32ed('0xc'));logger[_0x32ed('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3d5a89,_0x32ed('0xc'),JSON[_0x32ed('0xe')](_0x4ee920));if(_0x4ee920['error']){if(_0x4ee920['error'][_0x32ed('0xf')]===0x1f4){logger[_0x32ed('0x10')](_0x32ed('0xb'),_0x3d5a89,_0x4ee920[_0x32ed('0x10')][_0x32ed('0x11')]);return _0x5cf838(_0x4ee920[_0x32ed('0x10')][_0x32ed('0x11')]);}logger[_0x32ed('0x10')](_0x32ed('0xb'),_0x3d5a89,_0x4ee920[_0x32ed('0x10')][_0x32ed('0x11')]);return _0x50791c(_0x4ee920[_0x32ed('0x10')]['message']);}else{logger['info'](_0x32ed('0xb'),_0x3d5a89,_0x32ed('0xc'));_0x50791c(_0x4ee920[_0x32ed('0x12')][_0x32ed('0x11')]);}})[_0x32ed('0x13')](function(_0x551c39){logger[_0x32ed('0x10')](_0x32ed('0xb'),_0x3d5a89,_0x551c39);_0x5cf838(_0x551c39);});});} \ No newline at end of file +var _0x34f9=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash'];(function(_0xcdd18d,_0xba7979){var _0x2c09c7=function(_0x44428f){while(--_0x44428f){_0xcdd18d['push'](_0xcdd18d['shift']());}};_0x2c09c7(++_0xba7979);}(_0x34f9,0xfb));var _0x934f=function(_0x281544,_0x3a9b94){_0x281544=_0x281544-0x0;var _0x3924ff=_0x34f9[_0x281544];return _0x3924ff;};'use strict';var _=require(_0x934f('0x0'));var util=require(_0x934f('0x1'));var moment=require(_0x934f('0x2'));var BPromise=require(_0x934f('0x3'));var rs=require(_0x934f('0x4'));var fs=require('fs');var Redis=require(_0x934f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x934f('0x6'));var logger=require(_0x934f('0x7'))(_0x934f('0x8'));var config=require(_0x934f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x934f('0xa')][_0x934f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3176e7,_0x5db9ff,_0x468168){return new BPromise(function(_0x2b83e4,_0x3e4f4a){return client[_0x934f('0xc')](_0x3176e7,_0x468168)[_0x934f('0xd')](function(_0x6512dc){logger[_0x934f('0xe')](_0x934f('0xf'),_0x5db9ff,_0x934f('0x10'));logger[_0x934f('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x5db9ff,_0x934f('0x10'),JSON['stringify'](_0x6512dc));if(_0x6512dc[_0x934f('0x12')]){if(_0x6512dc[_0x934f('0x12')][_0x934f('0x13')]===0x1f4){logger[_0x934f('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5db9ff,_0x6512dc[_0x934f('0x12')][_0x934f('0x14')]);return _0x3e4f4a(_0x6512dc['error']['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5db9ff,_0x6512dc['error'][_0x934f('0x14')]);return _0x2b83e4(_0x6512dc[_0x934f('0x12')]['message']);}else{logger[_0x934f('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5db9ff,_0x934f('0x10'));_0x2b83e4(_0x6512dc['result'][_0x934f('0x14')]);}})['catch'](function(_0x4b6631){logger['error'](_0x934f('0xf'),_0x5db9ff,_0x4b6631);_0x3e4f4a(_0x4b6631);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 19be6bb..b2297ba 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 _0xa2bd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','/:id/download','download','post','create','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x5bedfd,_0x422984){var _0x1a6a95=function(_0x1b5b8f){while(--_0x1b5b8f){_0x5bedfd['push'](_0x5bedfd['shift']());}};_0x1a6a95(++_0x422984);}(_0xa2bd,0x80));var _0xda2b=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xa2bd[_0xd299c3];return _0x376574;};'use strict';var multer=require(_0xda2b('0x0'));var util=require(_0xda2b('0x1'));var path=require('path');var timeout=require(_0xda2b('0x2'));var express=require(_0xda2b('0x3'));var router=express[_0xda2b('0x4')]();var fs_extra=require(_0xda2b('0x5'));var auth=require(_0xda2b('0x6'));var interaction=require(_0xda2b('0x7'));var config=require(_0xda2b('0x8'));var controller=require(_0xda2b('0x9'));router[_0xda2b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda2b('0xa')](_0xda2b('0xb'),auth[_0xda2b('0xc')](),controller['show']);router['get'](_0xda2b('0xd'),auth[_0xda2b('0xc')](),controller[_0xda2b('0xe')]);router[_0xda2b('0xf')]('/',auth[_0xda2b('0xc')](),controller[_0xda2b('0x10')]);router['put'](_0xda2b('0xb'),auth[_0xda2b('0xc')](),controller['update']);router['delete']('/:id',auth[_0xda2b('0xc')](),controller[_0xda2b('0x11')]);module[_0xda2b('0x12')]=router; \ No newline at end of file +var _0xe56b=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0xe56b,0x160));var _0xbe56=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe56b[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xbe56('0x0'));var util=require(_0xbe56('0x1'));var path=require(_0xbe56('0x2'));var timeout=require(_0xbe56('0x3'));var express=require(_0xbe56('0x4'));var router=express[_0xbe56('0x5')]();var fs_extra=require(_0xbe56('0x6'));var auth=require(_0xbe56('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbe56('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xbe56('0x9')]('/',auth[_0xbe56('0xa')](),controller['index']);router['get'](_0xbe56('0xb'),auth[_0xbe56('0xa')](),controller[_0xbe56('0xc')]);router[_0xbe56('0x9')](_0xbe56('0xd'),auth[_0xbe56('0xa')](),controller[_0xbe56('0xe')]);router['post']('/',auth[_0xbe56('0xa')](),controller[_0xbe56('0xf')]);router[_0xbe56('0x10')](_0xbe56('0xb'),auth[_0xbe56('0xa')](),controller[_0xbe56('0x11')]);router[_0xbe56('0x12')](_0xbe56('0xb'),auth['isAuthenticated'](),controller[_0xbe56('0x13')]);module[_0xbe56('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0b8e850..461d645 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 _0xf7f1=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x5e32f3,_0x3386c1){var _0x4d4e03=function(_0xe86f5){while(--_0xe86f5){_0x5e32f3['push'](_0x5e32f3['shift']());}};_0x4d4e03(++_0x3386c1);}(_0xf7f1,0xd3));var _0x1f7f=function(_0xbaba66,_0x4a8e3c){_0xbaba66=_0xbaba66-0x0;var _0x53b5bc=_0xf7f1[_0xbaba66];return _0x53b5bc;};'use strict';var Sequelize=require(_0x1f7f('0x0'));module[_0x1f7f('0x1')]={'field':{'type':Sequelize[_0x1f7f('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x1f7f('0x3')]},'format':{'type':Sequelize[_0x1f7f('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1f7f('0x3')]},'custom':{'type':Sequelize[_0x1f7f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x83ef=['STRING','BOOLEAN','exports','TEXT'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x83ef,0x1d6));var _0xf83e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x83ef[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xf83e('0x0')]={'field':{'type':Sequelize[_0xf83e('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xf83e('0x2')]},'format':{'type':Sequelize[_0xf83e('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xf83e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b8c6a69..cb093a6 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 _0x88fe=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x88fe,0x161));var _0xe88f=function(_0x186edd,_0x16afae){_0x186edd=_0x186edd-0x0;var _0x447af8=_0x88fe[_0x186edd];return _0x447af8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe88f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe88f('0x1'));var rp=require(_0xe88f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe88f('0x3'));var util=require(_0xe88f('0x4'));var path=require(_0xe88f('0x5'));var sox=require(_0xe88f('0x6'));var csv=require(_0xe88f('0x7'));var ejs=require(_0xe88f('0x8'));var fs=require('fs');var fs_extra=require(_0xe88f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe88f('0xa'));var jsforce=require(_0xe88f('0xb'));var deskjs=require(_0xe88f('0xc'));var toCsv=require(_0xe88f('0x7'));var querystring=require(_0xe88f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe88f('0xe'));var qs=require(_0xe88f('0xf'));var as=require(_0xe88f('0x10'));var hardwareService=require(_0xe88f('0x11'));var logger=require(_0xe88f('0x12'))('api');var utils=require(_0xe88f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe88f('0x14'));var db=require(_0xe88f('0x15'))['db'];function respondWithStatusCode(_0x13e499,_0xc1b926){_0xc1b926=_0xc1b926||0xcc;return function(_0x5f39b3){if(_0x5f39b3){return _0x13e499[_0xe88f('0x16')](_0xc1b926);}return _0x13e499['status'](_0xc1b926)['end']();};}function respondWithResult(_0xc1ff99,_0x2612c2){_0x2612c2=_0x2612c2||0xc8;return function(_0x3331ea){if(_0x3331ea){return _0xc1ff99[_0xe88f('0x17')](_0x2612c2)[_0xe88f('0x18')](_0x3331ea);}};}function respondWithFilteredResult(_0x1502c3,_0x18bec3){return function(_0x13bf83){if(_0x13bf83){var _0x80aa51=typeof _0x18bec3['offset']==='undefined'&&typeof _0x18bec3[_0xe88f('0x19')]===_0xe88f('0x1a');var _0x422ba9=_0x13bf83[_0xe88f('0x1b')];var _0x48eda8=_0x80aa51?0x0:_0x18bec3['offset'];var _0x566d96=_0x80aa51?_0x13bf83[_0xe88f('0x1b')]:_0x18bec3[_0xe88f('0x1c')]+_0x18bec3[_0xe88f('0x19')];var _0x31fd9b;if(_0x566d96>=_0x422ba9){_0x566d96=_0x422ba9;_0x31fd9b=0xc8;}else{_0x31fd9b=0xce;}_0x1502c3[_0xe88f('0x17')](_0x31fd9b);return _0x1502c3['set'](_0xe88f('0x1d'),_0x48eda8+'-'+_0x566d96+'/'+_0x422ba9)['json'](_0x13bf83);}return null;};}function patchUpdates(_0x287f5a){return function(_0x5541a1){try{jsonpatch[_0xe88f('0x1e')](_0x5541a1,_0x287f5a,!![]);}catch(_0x27c1a2){return BPromise['reject'](_0x27c1a2);}return _0x5541a1[_0xe88f('0x1f')]();};}function saveUpdates(_0x21eeea,_0x1f0549){return function(_0x308b5f){if(_0x308b5f){return _0x308b5f[_0xe88f('0x20')](_0x21eeea)[_0xe88f('0x21')](function(_0x1673c3){return _0x1673c3;});}return null;};}function removeEntity(_0xfda875,_0x47a886){return function(_0x2ba396){if(_0x2ba396){return _0x2ba396[_0xe88f('0x22')]()[_0xe88f('0x21')](function(){_0xfda875[_0xe88f('0x17')](0xcc)[_0xe88f('0x23')]();});}};}function handleEntityNotFound(_0x38b0cd,_0x1cbba7){return function(_0x337f8b){if(!_0x337f8b){_0x38b0cd['sendStatus'](0x194);}return _0x337f8b;};}function handleError(_0x455961,_0x10f967){_0x10f967=_0x10f967||0x1f4;return function(_0x21b691){logger['error'](_0x21b691[_0xe88f('0x24')]);if(_0x21b691[_0xe88f('0x25')]){delete _0x21b691[_0xe88f('0x25')];}_0x455961[_0xe88f('0x17')](_0x10f967)[_0xe88f('0x26')](_0x21b691);};}exports[_0xe88f('0x27')]=function(_0x1ad720,_0x486a05){var _0x381717={},_0x54521f={},_0x3593c1={'count':0x0,'rows':[]};var _0x145f5a=_[_0xe88f('0x28')](db[_0xe88f('0x29')][_0xe88f('0x2a')],function(_0xdb301){return{'name':_0xdb301[_0xe88f('0x2b')],'type':_0xdb301[_0xe88f('0x2c')][_0xe88f('0x2d')]};});_0x54521f[_0xe88f('0x2e')]=_[_0xe88f('0x28')](_0x145f5a,'name');_0x54521f[_0xe88f('0x2f')]=_[_0xe88f('0x30')](_0x1ad720[_0xe88f('0x2f')]);_0x54521f[_0xe88f('0x31')]=_[_0xe88f('0x32')](_0x54521f[_0xe88f('0x2e')],_0x54521f[_0xe88f('0x2f')]);_0x381717[_0xe88f('0x33')]=_[_0xe88f('0x32')](_0x54521f[_0xe88f('0x2e')],qs[_0xe88f('0x34')](_0x1ad720[_0xe88f('0x2f')][_0xe88f('0x34')]));_0x381717['attributes']=_0x381717['attributes'][_0xe88f('0x35')]?_0x381717[_0xe88f('0x33')]:_0x54521f['model'];if(!_0x1ad720[_0xe88f('0x2f')][_0xe88f('0x36')](_0xe88f('0x37'))){_0x381717[_0xe88f('0x19')]=qs['limit'](_0x1ad720[_0xe88f('0x2f')]['limit']);_0x381717[_0xe88f('0x1c')]=qs[_0xe88f('0x1c')](_0x1ad720[_0xe88f('0x2f')][_0xe88f('0x1c')]);}_0x381717[_0xe88f('0x38')]=qs['sort'](_0x1ad720[_0xe88f('0x2f')][_0xe88f('0x39')]);_0x381717[_0xe88f('0x3a')]=qs[_0xe88f('0x31')](_[_0xe88f('0x3b')](_0x1ad720[_0xe88f('0x2f')],_0x54521f[_0xe88f('0x31')]),_0x145f5a);if(_0x1ad720[_0xe88f('0x2f')]['filter']){_0x381717['where']=_[_0xe88f('0x3c')](_0x381717['where'],{'$or':_['map'](_0x145f5a,function(_0x5c8e55){if(_0x5c8e55[_0xe88f('0x2c')]!==_0xe88f('0x3d')){var _0x20e4ae={};_0x20e4ae[_0x5c8e55['name']]={'$like':'%'+_0x1ad720['query'][_0xe88f('0x3e')]+'%'};return _0x20e4ae;}})});}_0x381717=_[_0xe88f('0x3c')]({},_0x381717,_0x1ad720[_0xe88f('0x3f')]);var _0x2bb1d2={'where':_0x381717[_0xe88f('0x3a')]};return db['AnalyticFieldReport'][_0xe88f('0x1b')](_0x2bb1d2)[_0xe88f('0x21')](function(_0x53dfe3){_0x3593c1[_0xe88f('0x1b')]=_0x53dfe3;if(_0x1ad720[_0xe88f('0x2f')][_0xe88f('0x40')]){_0x381717[_0xe88f('0x41')]=[{'all':!![]}];}return db[_0xe88f('0x29')][_0xe88f('0x42')](_0x381717);})[_0xe88f('0x21')](function(_0x563aed){_0x3593c1[_0xe88f('0x43')]=_0x563aed;return _0x3593c1;})['then'](respondWithFilteredResult(_0x486a05,_0x381717))[_0xe88f('0x44')](handleError(_0x486a05,null));};exports[_0xe88f('0x45')]=function(_0x3fd52b,_0x277b66){var _0x19d7bb={'raw':![],'where':{'id':_0x3fd52b[_0xe88f('0x46')]['id']}},_0x33de35={};_0x33de35[_0xe88f('0x2e')]=_[_0xe88f('0x30')](db[_0xe88f('0x29')]['rawAttributes']);_0x33de35[_0xe88f('0x2f')]=_[_0xe88f('0x30')](_0x3fd52b['query']);_0x33de35[_0xe88f('0x31')]=_[_0xe88f('0x32')](_0x33de35[_0xe88f('0x2e')],_0x33de35[_0xe88f('0x2f')]);_0x19d7bb[_0xe88f('0x33')]=_[_0xe88f('0x32')](_0x33de35['model'],qs['fields'](_0x3fd52b['query'][_0xe88f('0x34')]));_0x19d7bb[_0xe88f('0x33')]=_0x19d7bb[_0xe88f('0x33')][_0xe88f('0x35')]?_0x19d7bb[_0xe88f('0x33')]:_0x33de35[_0xe88f('0x2e')];if(_0x3fd52b[_0xe88f('0x2f')][_0xe88f('0x40')]){_0x19d7bb[_0xe88f('0x41')]=[{'all':!![]}];}_0x19d7bb=_[_0xe88f('0x3c')]({},_0x19d7bb,_0x3fd52b[_0xe88f('0x3f')]);return db['AnalyticFieldReport'][_0xe88f('0x47')](_0x19d7bb)['then'](handleEntityNotFound(_0x277b66,null))[_0xe88f('0x21')](respondWithResult(_0x277b66,null))[_0xe88f('0x44')](handleError(_0x277b66,null));};exports[_0xe88f('0x48')]=function(_0x1580b2,_0x47c49c){return db['AnalyticFieldReport']['create'](_0x1580b2[_0xe88f('0x49')],{})[_0xe88f('0x21')](respondWithResult(_0x47c49c,0xc9))[_0xe88f('0x44')](handleError(_0x47c49c,null));};exports[_0xe88f('0x4a')]=function(_0x18fcc4,_0x35ef41){return db[_0xe88f('0x29')][_0xe88f('0x4a')](_0x18fcc4['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x35ef41,0xc9))['catch'](handleError(_0x35ef41,null));};exports['update']=function(_0x56005c,_0x535921){if(_0x56005c['body']['id']){delete _0x56005c[_0xe88f('0x49')]['id'];}return db[_0xe88f('0x29')][_0xe88f('0x47')]({'where':{'id':_0x56005c[_0xe88f('0x46')]['id']}})[_0xe88f('0x21')](handleEntityNotFound(_0x535921,null))[_0xe88f('0x21')](saveUpdates(_0x56005c[_0xe88f('0x49')],null))[_0xe88f('0x21')](respondWithResult(_0x535921,null))[_0xe88f('0x44')](handleError(_0x535921,null));};exports[_0xe88f('0x22')]=function(_0x24cf0f,_0xa8f00){return db[_0xe88f('0x29')][_0xe88f('0x47')]({'where':{'id':_0x24cf0f[_0xe88f('0x46')]['id']}})[_0xe88f('0x21')](handleEntityNotFound(_0xa8f00,null))[_0xe88f('0x21')](removeEntity(_0xa8f00,null))['catch'](handleError(_0xa8f00,null));};exports['bulkDestroy']=function(_0x5ae9d7,_0x679e98){return db['AnalyticFieldReport'][_0xe88f('0x22')]({'where':{'id':_0x5ae9d7[_0xe88f('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x679e98,0xcc))[_0xe88f('0x44')](handleError(_0x679e98,null));};exports[_0xe88f('0x4b')]=function(_0x132c18,_0xa08543,_0x3c52a1){return db[_0xe88f('0x4c')][_0xe88f('0x4d')]({'where':{'id':_0x132c18[_0xe88f('0x46')]['id']}})[_0xe88f('0x21')](handleEntityNotFound(_0xa08543,null))['then'](function(_0x5e6055){if(_0x5e6055){return db['sequelize'][_0xe88f('0x4e')](function(_0x27fdcf){return db[_0xe88f('0x29')][_0xe88f('0x22')]({'where':{'CustomReportId':_0x132c18[_0xe88f('0x46')]['id']},'transaction':_0x27fdcf})[_0xe88f('0x21')](function(_0x4b05b5){var _0x598776=_['map'](_0x132c18['body'],function(_0xb1165){delete _0xb1165['id'];_0xb1165[_0xe88f('0x4f')]=_0x132c18[_0xe88f('0x46')]['id'];return _0xb1165;});return db['AnalyticFieldReport'][_0xe88f('0x4a')](_0x598776,{'transaction':_0x27fdcf});});})[_0xe88f('0x21')](function(){return db[_0xe88f('0x29')][_0xe88f('0x42')]({'where':{'CustomReportId':_0x132c18[_0xe88f('0x46')]['id']}});});}})[_0xe88f('0x21')](respondWithResult(_0xa08543,null))[_0xe88f('0x44')](handleError(_0xa08543,null));}; \ No newline at end of file +var _0xf8cb=['CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','body','bulkCreate','find','params','bulkDestroy','AnalyticCustomReport','findOne','transaction'];(function(_0x35d30d,_0x3979c8){var _0x322326=function(_0xacecc3){while(--_0xacecc3){_0x35d30d['push'](_0x35d30d['shift']());}};_0x322326(++_0x3979c8);}(_0xf8cb,0x9d));var _0xbf8c=function(_0xaa1d1d,_0x412084){_0xaa1d1d=_0xaa1d1d-0x0;var _0x27169c=_0xf8cb[_0xaa1d1d];return _0x27169c;};'use strict';var emlformat=require(_0xbf8c('0x0'));var rimraf=require(_0xbf8c('0x1'));var zipdir=require(_0xbf8c('0x2'));var jsonpatch=require(_0xbf8c('0x3'));var rp=require(_0xbf8c('0x4'));var moment=require('moment');var BPromise=require(_0xbf8c('0x5'));var Mustache=require(_0xbf8c('0x6'));var util=require(_0xbf8c('0x7'));var path=require('path');var sox=require(_0xbf8c('0x8'));var csv=require('to-csv');var ejs=require(_0xbf8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbf8c('0xa'));var _=require(_0xbf8c('0xb'));var squel=require(_0xbf8c('0xc'));var crypto=require(_0xbf8c('0xd'));var jsforce=require(_0xbf8c('0xe'));var deskjs=require(_0xbf8c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbf8c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbf8c('0x11'));var qs=require(_0xbf8c('0x12'));var as=require(_0xbf8c('0x13'));var hardwareService=require(_0xbf8c('0x14'));var logger=require(_0xbf8c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbf8c('0x16'));var licenseUtil=require(_0xbf8c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa56fcd,_0x518977){_0x518977=_0x518977||0xcc;return function(_0x4e8d9e){if(_0x4e8d9e){return _0xa56fcd[_0xbf8c('0x18')](_0x518977);}return _0xa56fcd['status'](_0x518977)['end']();};}function respondWithResult(_0x5b1cc3,_0x13132c){_0x13132c=_0x13132c||0xc8;return function(_0x202e30){if(_0x202e30){return _0x5b1cc3[_0xbf8c('0x19')](_0x13132c)[_0xbf8c('0x1a')](_0x202e30);}};}function respondWithFilteredResult(_0x470fcb,_0xec8463){return function(_0x1c3f28){if(_0x1c3f28){var _0x2e893a=typeof _0xec8463[_0xbf8c('0x1b')]===_0xbf8c('0x1c')&&typeof _0xec8463[_0xbf8c('0x1d')]==='undefined';var _0x45955e=_0x1c3f28[_0xbf8c('0x1e')];var _0x38749e=_0x2e893a?0x0:_0xec8463['offset'];var _0x5de504=_0x2e893a?_0x1c3f28[_0xbf8c('0x1e')]:_0xec8463[_0xbf8c('0x1b')]+_0xec8463[_0xbf8c('0x1d')];var _0x28ed03;if(_0x5de504>=_0x45955e){_0x5de504=_0x45955e;_0x28ed03=0xc8;}else{_0x28ed03=0xce;}_0x470fcb[_0xbf8c('0x19')](_0x28ed03);return _0x470fcb['set'](_0xbf8c('0x1f'),_0x38749e+'-'+_0x5de504+'/'+_0x45955e)[_0xbf8c('0x1a')](_0x1c3f28);}return null;};}function patchUpdates(_0x3e9e3c){return function(_0x10c139){try{jsonpatch['apply'](_0x10c139,_0x3e9e3c,!![]);}catch(_0x41bba){return BPromise[_0xbf8c('0x20')](_0x41bba);}return _0x10c139[_0xbf8c('0x21')]();};}function saveUpdates(_0x1c59ad,_0x236922){return function(_0x9127a4){if(_0x9127a4){return _0x9127a4[_0xbf8c('0x22')](_0x1c59ad)[_0xbf8c('0x23')](function(_0x31cad3){return _0x31cad3;});}return null;};}function removeEntity(_0x4b36d0,_0x9f700d){return function(_0x50e66f){if(_0x50e66f){return _0x50e66f[_0xbf8c('0x24')]()[_0xbf8c('0x23')](function(){_0x4b36d0[_0xbf8c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x248994,_0x37f819){return function(_0x2cc4d3){if(!_0x2cc4d3){_0x248994['sendStatus'](0x194);}return _0x2cc4d3;};}function handleError(_0x1d5f14,_0x4d4e89){_0x4d4e89=_0x4d4e89||0x1f4;return function(_0x30bb49){logger[_0xbf8c('0x25')](_0x30bb49[_0xbf8c('0x26')]);if(_0x30bb49[_0xbf8c('0x27')]){delete _0x30bb49[_0xbf8c('0x27')];}_0x1d5f14[_0xbf8c('0x19')](_0x4d4e89)[_0xbf8c('0x28')](_0x30bb49);};}exports[_0xbf8c('0x29')]=function(_0x2d074f,_0x27c967){var _0x47f9b4={},_0x51b3bc={},_0x526aac={'count':0x0,'rows':[]};var _0x33efe1=_[_0xbf8c('0x2a')](db[_0xbf8c('0x2b')][_0xbf8c('0x2c')],function(_0x5184fd){return{'name':_0x5184fd[_0xbf8c('0x2d')],'type':_0x5184fd[_0xbf8c('0x2e')][_0xbf8c('0x2f')]};});_0x51b3bc[_0xbf8c('0x30')]=_[_0xbf8c('0x2a')](_0x33efe1,_0xbf8c('0x27'));_0x51b3bc[_0xbf8c('0x31')]=_[_0xbf8c('0x32')](_0x2d074f[_0xbf8c('0x31')]);_0x51b3bc[_0xbf8c('0x33')]=_[_0xbf8c('0x34')](_0x51b3bc[_0xbf8c('0x30')],_0x51b3bc[_0xbf8c('0x31')]);_0x47f9b4[_0xbf8c('0x35')]=_[_0xbf8c('0x34')](_0x51b3bc['model'],qs[_0xbf8c('0x36')](_0x2d074f[_0xbf8c('0x31')]['fields']));_0x47f9b4[_0xbf8c('0x35')]=_0x47f9b4['attributes'][_0xbf8c('0x37')]?_0x47f9b4[_0xbf8c('0x35')]:_0x51b3bc['model'];if(!_0x2d074f[_0xbf8c('0x31')][_0xbf8c('0x38')](_0xbf8c('0x39'))){_0x47f9b4[_0xbf8c('0x1d')]=qs[_0xbf8c('0x1d')](_0x2d074f[_0xbf8c('0x31')][_0xbf8c('0x1d')]);_0x47f9b4[_0xbf8c('0x1b')]=qs['offset'](_0x2d074f[_0xbf8c('0x31')][_0xbf8c('0x1b')]);}_0x47f9b4['order']=qs[_0xbf8c('0x3a')](_0x2d074f[_0xbf8c('0x31')]['sort']);_0x47f9b4[_0xbf8c('0x3b')]=qs[_0xbf8c('0x33')](_[_0xbf8c('0x3c')](_0x2d074f[_0xbf8c('0x31')],_0x51b3bc[_0xbf8c('0x33')]),_0x33efe1);if(_0x2d074f[_0xbf8c('0x31')]['filter']){_0x47f9b4['where']=_['merge'](_0x47f9b4['where'],{'$or':_[_0xbf8c('0x2a')](_0x33efe1,function(_0x28c1b1){if(_0x28c1b1['type']!=='VIRTUAL'){var _0x53097d={};_0x53097d[_0x28c1b1[_0xbf8c('0x27')]]={'$like':'%'+_0x2d074f[_0xbf8c('0x31')]['filter']+'%'};return _0x53097d;}})});}_0x47f9b4=_[_0xbf8c('0x3d')]({},_0x47f9b4,_0x2d074f[_0xbf8c('0x3e')]);var _0x1f9be5={'where':_0x47f9b4['where']};return db[_0xbf8c('0x2b')][_0xbf8c('0x1e')](_0x1f9be5)[_0xbf8c('0x23')](function(_0x571d9f){_0x526aac[_0xbf8c('0x1e')]=_0x571d9f;if(_0x2d074f[_0xbf8c('0x31')][_0xbf8c('0x3f')]){_0x47f9b4[_0xbf8c('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xbf8c('0x41')](_0x47f9b4);})['then'](function(_0x5ac79b){_0x526aac[_0xbf8c('0x42')]=_0x5ac79b;return _0x526aac;})['then'](respondWithFilteredResult(_0x27c967,_0x47f9b4))[_0xbf8c('0x43')](handleError(_0x27c967,null));};exports[_0xbf8c('0x44')]=function(_0x1536b1,_0x44a60f){var _0x2efcb9={'raw':![],'where':{'id':_0x1536b1['params']['id']}},_0x30bfde={};_0x30bfde[_0xbf8c('0x30')]=_[_0xbf8c('0x32')](db[_0xbf8c('0x2b')]['rawAttributes']);_0x30bfde[_0xbf8c('0x31')]=_['keys'](_0x1536b1['query']);_0x30bfde[_0xbf8c('0x33')]=_['intersection'](_0x30bfde[_0xbf8c('0x30')],_0x30bfde[_0xbf8c('0x31')]);_0x2efcb9[_0xbf8c('0x35')]=_[_0xbf8c('0x34')](_0x30bfde[_0xbf8c('0x30')],qs[_0xbf8c('0x36')](_0x1536b1[_0xbf8c('0x31')][_0xbf8c('0x36')]));_0x2efcb9['attributes']=_0x2efcb9[_0xbf8c('0x35')][_0xbf8c('0x37')]?_0x2efcb9[_0xbf8c('0x35')]:_0x30bfde[_0xbf8c('0x30')];if(_0x1536b1[_0xbf8c('0x31')]['includeAll']){_0x2efcb9[_0xbf8c('0x40')]=[{'all':!![]}];}_0x2efcb9=_['merge']({},_0x2efcb9,_0x1536b1[_0xbf8c('0x3e')]);return db[_0xbf8c('0x2b')]['find'](_0x2efcb9)[_0xbf8c('0x23')](handleEntityNotFound(_0x44a60f,null))[_0xbf8c('0x23')](respondWithResult(_0x44a60f,null))[_0xbf8c('0x43')](handleError(_0x44a60f,null));};exports['create']=function(_0x36f057,_0x4eb77c){return db[_0xbf8c('0x2b')]['create'](_0x36f057[_0xbf8c('0x45')],{})[_0xbf8c('0x23')](respondWithResult(_0x4eb77c,0xc9))['catch'](handleError(_0x4eb77c,null));};exports[_0xbf8c('0x46')]=function(_0x1f6646,_0x16a0d2){return db[_0xbf8c('0x2b')]['bulkCreate'](_0x1f6646['body'],{'raw':![],'individualHooks':!![]})[_0xbf8c('0x23')](respondWithResult(_0x16a0d2,0xc9))[_0xbf8c('0x43')](handleError(_0x16a0d2,null));};exports['update']=function(_0x3d8627,_0x28431e){if(_0x3d8627[_0xbf8c('0x45')]['id']){delete _0x3d8627[_0xbf8c('0x45')]['id'];}return db[_0xbf8c('0x2b')][_0xbf8c('0x47')]({'where':{'id':_0x3d8627[_0xbf8c('0x48')]['id']}})[_0xbf8c('0x23')](handleEntityNotFound(_0x28431e,null))[_0xbf8c('0x23')](saveUpdates(_0x3d8627['body'],null))[_0xbf8c('0x23')](respondWithResult(_0x28431e,null))[_0xbf8c('0x43')](handleError(_0x28431e,null));};exports[_0xbf8c('0x24')]=function(_0x3c58a5,_0x34e991){return db[_0xbf8c('0x2b')][_0xbf8c('0x47')]({'where':{'id':_0x3c58a5[_0xbf8c('0x48')]['id']}})[_0xbf8c('0x23')](handleEntityNotFound(_0x34e991,null))[_0xbf8c('0x23')](removeEntity(_0x34e991,null))[_0xbf8c('0x43')](handleError(_0x34e991,null));};exports[_0xbf8c('0x49')]=function(_0x5bc099,_0x1c2ea6){return db[_0xbf8c('0x2b')]['destroy']({'where':{'id':_0x5bc099[_0xbf8c('0x31')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1c2ea6,0xcc))[_0xbf8c('0x43')](handleError(_0x1c2ea6,null));};exports['addFields']=function(_0x31c880,_0x3d86ba,_0xea0341){return db[_0xbf8c('0x4a')][_0xbf8c('0x4b')]({'where':{'id':_0x31c880[_0xbf8c('0x48')]['id']}})[_0xbf8c('0x23')](handleEntityNotFound(_0x3d86ba,null))[_0xbf8c('0x23')](function(_0x145295){if(_0x145295){return db['sequelize'][_0xbf8c('0x4c')](function(_0x4eb24a){return db[_0xbf8c('0x2b')][_0xbf8c('0x24')]({'where':{'CustomReportId':_0x31c880[_0xbf8c('0x48')]['id']},'transaction':_0x4eb24a})[_0xbf8c('0x23')](function(_0xf128d){var _0x3e6cfb=_['map'](_0x31c880[_0xbf8c('0x45')],function(_0x273920){delete _0x273920['id'];_0x273920[_0xbf8c('0x4d')]=_0x31c880['params']['id'];return _0x273920;});return db[_0xbf8c('0x2b')][_0xbf8c('0x46')](_0x3e6cfb,{'transaction':_0x4eb24a});});})[_0xbf8c('0x23')](function(){return db[_0xbf8c('0x2b')][_0xbf8c('0x41')]({'where':{'CustomReportId':_0x31c880['params']['id']}});});}})[_0xbf8c('0x23')](respondWithResult(_0x3d86ba,null))['catch'](handleError(_0x3d86ba,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e3fd219..ce15d4a 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 _0x8294=['path','rimraf','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5ed46a,_0x1ed3bd){var _0x2eebd3=function(_0x4d3073){while(--_0x4d3073){_0x5ed46a['push'](_0x5ed46a['shift']());}};_0x2eebd3(++_0x1ed3bd);}(_0x8294,0x171));var _0x4829=function(_0x72a777,_0x1de391){_0x72a777=_0x72a777-0x0;var _0x30dff6=_0x8294[_0x72a777];return _0x30dff6;};'use strict';var _=require(_0x4829('0x0'));var util=require(_0x4829('0x1'));var logger=require(_0x4829('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4829('0x3'));var rp=require(_0x4829('0x4'));var fs=require('fs');var path=require(_0x4829('0x5'));var rimraf=require(_0x4829('0x6'));var config=require('../../config/environment');var attributes=require(_0x4829('0x7'));module['exports']=function(_0x47d5a3,_0x1e4918){return _0x47d5a3[_0x4829('0x8')](_0x4829('0x9'),attributes,{'tableName':_0x4829('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e4=['define','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','request-promise','path','./analyticFieldReport.attributes','exports'];(function(_0x1e6c49,_0x172afc){var _0x3db4f1=function(_0x515cf1){while(--_0x515cf1){_0x1e6c49['push'](_0x1e6c49['shift']());}};_0x3db4f1(++_0x172afc);}(_0x70e4,0x157));var _0x470e=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x70e4[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var logger=require(_0x470e('0x2'))(_0x470e('0x3'));var moment=require(_0x470e('0x4'));var BPromise=require('bluebird');var rp=require(_0x470e('0x5'));var fs=require('fs');var path=require(_0x470e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x470e('0x7'));module[_0x470e('0x8')]=function(_0x35e11e,_0x4a5afe){return _0x35e11e[_0x470e('0x9')](_0x470e('0xa'),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 22ccf96..05f2a3a 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 _0x72b8=['http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x72b8,0x107));var _0x872b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x72b8[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x872b('0x0'));var util=require(_0x872b('0x1'));var moment=require(_0x872b('0x2'));var BPromise=require(_0x872b('0x3'));var rs=require(_0x872b('0x4'));var fs=require('fs');var Redis=require(_0x872b('0x5'));var db=require(_0x872b('0x6'))['db'];var utils=require(_0x872b('0x7'));var logger=require(_0x872b('0x8'))(_0x872b('0x9'));var config=require('../../config/environment');var jayson=require(_0x872b('0xa'));var client=jayson[_0x872b('0xb')][_0x872b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17b171,_0x1ed8e,_0x105903){return new BPromise(function(_0x4cd857,_0x1b26b6){return client[_0x872b('0xd')](_0x17b171,_0x105903)[_0x872b('0xe')](function(_0x50d945){logger[_0x872b('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1ed8e,_0x872b('0x10'));logger[_0x872b('0x11')](_0x872b('0x12'),_0x1ed8e,'request\x20sent',JSON[_0x872b('0x13')](_0x50d945));if(_0x50d945[_0x872b('0x14')]){if(_0x50d945[_0x872b('0x14')][_0x872b('0x15')]===0x1f4){logger['error'](_0x872b('0x16'),_0x1ed8e,_0x50d945['error'][_0x872b('0x17')]);return _0x1b26b6(_0x50d945[_0x872b('0x14')][_0x872b('0x17')]);}logger['error'](_0x872b('0x16'),_0x1ed8e,_0x50d945[_0x872b('0x14')][_0x872b('0x17')]);return _0x4cd857(_0x50d945['error']['message']);}else{logger[_0x872b('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1ed8e,_0x872b('0x10'));_0x4cd857(_0x50d945[_0x872b('0x18')][_0x872b('0x17')]);}})['catch'](function(_0x1e408f){logger[_0x872b('0x14')](_0x872b('0x16'),_0x1ed8e,_0x1e408f);_0x1b26b6(_0x1e408f);});});} \ No newline at end of file +var _0x0be3=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x0be3,0xf3));var _0x30be=function(_0x32c6e7,_0x540b99){_0x32c6e7=_0x32c6e7-0x0;var _0x26b6f4=_0x0be3[_0x32c6e7];return _0x26b6f4;};'use strict';var _=require(_0x30be('0x0'));var util=require('util');var moment=require(_0x30be('0x1'));var BPromise=require(_0x30be('0x2'));var rs=require(_0x30be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30be('0x4'))['db'];var utils=require(_0x30be('0x5'));var logger=require('../../config/logger')(_0x30be('0x6'));var config=require('../../config/environment');var jayson=require(_0x30be('0x7'));var client=jayson[_0x30be('0x8')][_0x30be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13a112,_0x38e6ee,_0x5180e1){return new BPromise(function(_0x5ecb67,_0x5eddf8){return client[_0x30be('0xa')](_0x13a112,_0x5180e1)[_0x30be('0xb')](function(_0x45af67){logger[_0x30be('0xc')](_0x30be('0xd'),_0x38e6ee,_0x30be('0xe'));logger[_0x30be('0xf')](_0x30be('0x10'),_0x38e6ee,_0x30be('0xe'),JSON[_0x30be('0x11')](_0x45af67));if(_0x45af67['error']){if(_0x45af67[_0x30be('0x12')][_0x30be('0x13')]===0x1f4){logger[_0x30be('0x12')](_0x30be('0xd'),_0x38e6ee,_0x45af67['error']['message']);return _0x5eddf8(_0x45af67['error'][_0x30be('0x14')]);}logger[_0x30be('0x12')](_0x30be('0xd'),_0x38e6ee,_0x45af67[_0x30be('0x12')][_0x30be('0x14')]);return _0x5ecb67(_0x45af67['error'][_0x30be('0x14')]);}else{logger[_0x30be('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x38e6ee,_0x30be('0xe'));_0x5ecb67(_0x45af67[_0x30be('0x15')][_0x30be('0x14')]);}})[_0x30be('0x16')](function(_0x2533f0){logger['error'](_0x30be('0xd'),_0x38e6ee,_0x2533f0);_0x5eddf8(_0x2533f0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0b10781..bdc5d71 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(_0x2dde7b,_0x2e874c){var _0x14efe9=function(_0x2603f9){while(--_0x2603f9){_0x2dde7b['push'](_0x2dde7b['shift']());}};_0x14efe9(++_0x2e874c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x2919f4,_0x216a8b){var _0x53f2eb=function(_0x5e9eff){while(--_0x5e9eff){_0x2919f4['push'](_0x2919f4['shift']());}};_0x53f2eb(++_0x216a8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 7820827..baa405c 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 _0xbfa6=['sequelize','exports','TEXT','STRING'];(function(_0x1e0c0b,_0x96c277){var _0x177db3=function(_0x660364){while(--_0x660364){_0x1e0c0b['push'](_0x1e0c0b['shift']());}};_0x177db3(++_0x96c277);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xbfa6[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require(_0x6bfa('0x0'));module[_0x6bfa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x6bfa('0x2')]},'description':{'type':Sequelize[_0x6bfa('0x3')]}}; \ No newline at end of file +var _0x5bc5=['STRING','name','TEXT','sequelize','exports'];(function(_0x3fcdf5,_0x503ca0){var _0x2d0786=function(_0x1ee5e2){while(--_0x1ee5e2){_0x3fcdf5['push'](_0x3fcdf5['shift']());}};_0x2d0786(++_0x503ca0);}(_0x5bc5,0xb2));var _0x55bc=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x5bc5[_0x3a607e];return _0x37b106;};'use strict';var Sequelize=require(_0x55bc('0x0'));module[_0x55bc('0x1')]={'name':{'type':Sequelize[_0x55bc('0x2')],'allowNull':![],'unique':_0x55bc('0x3')},'table':{'type':Sequelize[_0x55bc('0x2')]},'metric':{'type':Sequelize[_0x55bc('0x4')]},'description':{'type':Sequelize[_0x55bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5221e41..ed2a7fc 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 _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(_0x429d68,_0x1aa5a2){var _0x172ef0=function(_0x3b7d7d){while(--_0x3b7d7d){_0x429d68['push'](_0x429d68['shift']());}};_0x172ef0(++_0x1aa5a2);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x6107ae,_0x1739b7){_0x6107ae=_0x6107ae-0x0;var _0x7a505f=_0x8d0e[_0x6107ae];return _0x7a505f;};'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 +var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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'];(function(_0x26fe7a,_0x577d90){var _0x27f610=function(_0x291a5c){while(--_0x291a5c){_0x26fe7a['push'](_0x26fe7a['shift']());}};_0x27f610(++_0x577d90);}(_0x3e74,0x175));var _0x43e7=function(_0x388955,_0x1e0491){_0x388955=_0x388955-0x0;var _0x499850=_0x3e74[_0x388955];return _0x499850;};'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(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d719f5d..7b53fc6 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 _0xe08b=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api'];(function(_0x32dce6,_0x23f570){var _0x1191ba=function(_0x58efa8){while(--_0x58efa8){_0x32dce6['push'](_0x32dce6['shift']());}};_0x1191ba(++_0x23f570);}(_0xe08b,0x10e));var _0xbe08=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xe08b[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xbe08('0x0'));var util=require('util');var logger=require(_0xbe08('0x1'))(_0xbe08('0x2'));var moment=require('moment');var BPromise=require(_0xbe08('0x3'));var rp=require(_0xbe08('0x4'));var fs=require('fs');var path=require(_0xbe08('0x5'));var rimraf=require(_0xbe08('0x6'));var config=require(_0xbe08('0x7'));var attributes=require(_0xbe08('0x8'));module[_0xbe08('0x9')]=function(_0x1150ef,_0x212ad5){return _0x1150ef[_0xbe08('0xa')](_0xbe08('0xb'),attributes,{'tableName':_0xbe08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd0a=['analytics_metrics','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x35a5a8,_0x5c5de0){_0x35a5a8=_0x35a5a8-0x0;var _0x117df8=_0xbd0a[_0x35a5a8];return _0x117df8;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var logger=require(_0xabd0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd0('0x2'));var fs=require('fs');var path=require(_0xabd0('0x3'));var rimraf=require(_0xabd0('0x4'));var config=require(_0xabd0('0x5'));var attributes=require(_0xabd0('0x6'));module[_0xabd0('0x7')]=function(_0x221368,_0xb41697){return _0x221368[_0xabd0('0x8')]('AnalyticMetric',attributes,{'tableName':_0xabd0('0x9'),'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 50b24c0..ebcd1e0 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 _0x3909=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x3909,0x65));var _0x9390=function(_0x1ec65c,_0x354923){_0x1ec65c=_0x1ec65c-0x0;var _0x5249c2=_0x3909[_0x1ec65c];return _0x5249c2;};'use strict';var _=require(_0x9390('0x0'));var util=require(_0x9390('0x1'));var moment=require(_0x9390('0x2'));var BPromise=require(_0x9390('0x3'));var rs=require(_0x9390('0x4'));var fs=require('fs');var Redis=require(_0x9390('0x5'));var db=require(_0x9390('0x6'))['db'];var utils=require(_0x9390('0x7'));var logger=require('../../config/logger')(_0x9390('0x8'));var config=require(_0x9390('0x9'));var jayson=require(_0x9390('0xa'));var client=jayson[_0x9390('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea1bf,_0x387c4b,_0x5b3314){return new BPromise(function(_0x1b831e,_0x2e8b45){return client[_0x9390('0xc')](_0x4ea1bf,_0x5b3314)[_0x9390('0xd')](function(_0x3d3e3b){logger['info'](_0x9390('0xe'),_0x387c4b,'request\x20sent');logger[_0x9390('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x387c4b,_0x9390('0x10'),JSON[_0x9390('0x11')](_0x3d3e3b));if(_0x3d3e3b[_0x9390('0x12')]){if(_0x3d3e3b[_0x9390('0x12')][_0x9390('0x13')]===0x1f4){logger[_0x9390('0x12')](_0x9390('0xe'),_0x387c4b,_0x3d3e3b[_0x9390('0x12')]['message']);return _0x2e8b45(_0x3d3e3b[_0x9390('0x12')]['message']);}logger[_0x9390('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x387c4b,_0x3d3e3b[_0x9390('0x12')][_0x9390('0x14')]);return _0x1b831e(_0x3d3e3b['error']['message']);}else{logger[_0x9390('0x15')](_0x9390('0xe'),_0x387c4b,_0x9390('0x10'));_0x1b831e(_0x3d3e3b[_0x9390('0x16')][_0x9390('0x14')]);}})[_0x9390('0x17')](function(_0x490349){logger[_0x9390('0x12')](_0x9390('0xe'),_0x387c4b,_0x490349);_0x2e8b45(_0x490349);});});} \ No newline at end of file +var _0x4ae5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x4a9b09,_0x575e2e){var _0x20cd02=function(_0x26e71e){while(--_0x26e71e){_0x4a9b09['push'](_0x4a9b09['shift']());}};_0x20cd02(++_0x575e2e);}(_0x4ae5,0x9d));var _0x54ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ae5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x54ae('0x0'));var moment=require(_0x54ae('0x1'));var BPromise=require(_0x54ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54ae('0x3'));var logger=require(_0x54ae('0x4'))(_0x54ae('0x5'));var config=require(_0x54ae('0x6'));var jayson=require(_0x54ae('0x7'));var client=jayson[_0x54ae('0x8')][_0x54ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x419942,_0x3b0901,_0x12c63d){return new BPromise(function(_0x45e9b7,_0x42eede){return client['request'](_0x419942,_0x12c63d)['then'](function(_0x490236){logger[_0x54ae('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x3b0901,_0x54ae('0xb'));logger[_0x54ae('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3b0901,_0x54ae('0xb'),JSON[_0x54ae('0xd')](_0x490236));if(_0x490236[_0x54ae('0xe')]){if(_0x490236[_0x54ae('0xe')][_0x54ae('0xf')]===0x1f4){logger[_0x54ae('0xe')](_0x54ae('0x10'),_0x3b0901,_0x490236[_0x54ae('0xe')][_0x54ae('0x11')]);return _0x42eede(_0x490236[_0x54ae('0xe')][_0x54ae('0x11')]);}logger[_0x54ae('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x3b0901,_0x490236[_0x54ae('0xe')][_0x54ae('0x11')]);return _0x45e9b7(_0x490236[_0x54ae('0xe')][_0x54ae('0x11')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3b0901,_0x54ae('0xb'));_0x45e9b7(_0x490236[_0x54ae('0x12')]['message']);}})[_0x54ae('0x13')](function(_0x44e2cc){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3b0901,_0x44e2cc);_0x42eede(_0x44e2cc);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7337a7f..9d2bb2f 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 _0xd8a5=['./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5bce33,_0x4a4b06){var _0x15bc20=function(_0x56c711){while(--_0x56c711){_0x5bce33['push'](_0x5bce33['shift']());}};_0x15bc20(++_0x4a4b06);}(_0xd8a5,0x160));var _0x5d8a=function(_0x29e143,_0x12c1fa){_0x29e143=_0x29e143-0x0;var _0x3d6a52=_0xd8a5[_0x29e143];return _0x3d6a52;};'use strict';var multer=require(_0x5d8a('0x0'));var util=require('util');var path=require(_0x5d8a('0x1'));var timeout=require(_0x5d8a('0x2'));var express=require('express');var router=express[_0x5d8a('0x3')]();var fs_extra=require(_0x5d8a('0x4'));var auth=require(_0x5d8a('0x5'));var interaction=require(_0x5d8a('0x6'));var config=require(_0x5d8a('0x7'));var controller=require(_0x5d8a('0x8'));router[_0x5d8a('0x9')]('/',auth[_0x5d8a('0xa')](),controller[_0x5d8a('0xb')]);router[_0x5d8a('0x9')](_0x5d8a('0xc'),auth[_0x5d8a('0xa')](),controller[_0x5d8a('0xd')]);router['post']('/',auth[_0x5d8a('0xa')](),controller[_0x5d8a('0xe')]);router[_0x5d8a('0xf')](_0x5d8a('0xc'),auth[_0x5d8a('0xa')](),controller['update']);router[_0x5d8a('0x10')](_0x5d8a('0xc'),auth[_0x5d8a('0xa')](),controller[_0x5d8a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1782=['../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service'];(function(_0x4284d4,_0x50a9de){var _0x122183=function(_0x3faf5a){while(--_0x3faf5a){_0x4284d4['push'](_0x4284d4['shift']());}};_0x122183(++_0x50a9de);}(_0x1782,0x188));var _0x2178=function(_0x4d36c4,_0x339889){_0x4d36c4=_0x4d36c4-0x0;var _0x3391a7=_0x1782[_0x4d36c4];return _0x3391a7;};'use strict';var multer=require('multer');var util=require(_0x2178('0x0'));var path=require(_0x2178('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2178('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2178('0x3'));var interaction=require(_0x2178('0x4'));var config=require('../../config/environment');var controller=require(_0x2178('0x5'));router['get']('/',auth[_0x2178('0x6')](),controller[_0x2178('0x7')]);router[_0x2178('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2178('0x9')]);router[_0x2178('0xa')]('/',auth[_0x2178('0x6')](),controller[_0x2178('0xb')]);router[_0x2178('0xc')](_0x2178('0xd'),auth['isAuthenticated'](),controller[_0x2178('0xe')]);router[_0x2178('0xf')](_0x2178('0xd'),auth['isAuthenticated'](),controller[_0x2178('0x10')]);module[_0x2178('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 152953c..d535de3 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 _0xc3f9=['exports','TEXT','sequelize'];(function(_0x9a98,_0x2cb6fd){var _0x1fa743=function(_0x26c0d9){while(--_0x26c0d9){_0x9a98['push'](_0x9a98['shift']());}};_0x1fa743(++_0x2cb6fd);}(_0xc3f9,0x1f1));var _0x9c3f=function(_0x5c3a96,_0x1bfab7){_0x5c3a96=_0x5c3a96-0x0;var _0x4bc7c1=_0xc3f9[_0x5c3a96];return _0x4bc7c1;};'use strict';var Sequelize=require(_0x9c3f('0x0'));module[_0x9c3f('0x1')]={'tree':{'type':Sequelize[_0x9c3f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x75df=['TEXT','sequelize','exports'];(function(_0x3766f4,_0x580673){var _0x183f88=function(_0x4be9ac){while(--_0x4be9ac){_0x3766f4['push'](_0x3766f4['shift']());}};_0x183f88(++_0x580673);}(_0x75df,0x1e1));var _0xf75d=function(_0x2c376d,_0x5e2485){_0x2c376d=_0x2c376d-0x0;var _0x1a7acc=_0x75df[_0x2c376d];return _0x1a7acc;};'use strict';var Sequelize=require(_0xf75d('0x0'));module[_0xf75d('0x1')]={'tree':{'type':Sequelize[_0xf75d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index e9b95d8..5dfe9b3 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 _0x583a=['fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','then','destroy','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model','keys','query','filters','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','intersection','create','update','body','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x51bbf2,_0x38e95a){var _0x2f12f9=function(_0x2087e0){while(--_0x2087e0){_0x51bbf2['push'](_0x51bbf2['shift']());}};_0x2f12f9(++_0x38e95a);}(_0x583a,0x7e));var _0xa583=function(_0x5bccbf,_0x547e42){_0x5bccbf=_0x5bccbf-0x0;var _0x2158c6=_0x583a[_0x5bccbf];return _0x2158c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa583('0x0'));var zipdir=require(_0xa583('0x1'));var jsonpatch=require(_0xa583('0x2'));var rp=require('request-promise');var moment=require(_0xa583('0x3'));var BPromise=require(_0xa583('0x4'));var Mustache=require(_0xa583('0x5'));var util=require(_0xa583('0x6'));var path=require('path');var sox=require(_0xa583('0x7'));var csv=require(_0xa583('0x8'));var ejs=require(_0xa583('0x9'));var fs=require('fs');var fs_extra=require(_0xa583('0xa'));var _=require(_0xa583('0xb'));var squel=require('squel');var crypto=require(_0xa583('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa583('0x8'));var querystring=require('querystring');var Papa=require(_0xa583('0xd'));var Redis=require('ioredis');var authService=require(_0xa583('0xe'));var qs=require(_0xa583('0xf'));var as=require(_0xa583('0x10'));var hardwareService=require(_0xa583('0x11'));var logger=require(_0xa583('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa583('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa583('0x14'))['db'];function respondWithStatusCode(_0xcd8f9c,_0x20cb52){_0x20cb52=_0x20cb52||0xcc;return function(_0xef54d9){if(_0xef54d9){return _0xcd8f9c['sendStatus'](_0x20cb52);}return _0xcd8f9c['status'](_0x20cb52)[_0xa583('0x15')]();};}function respondWithResult(_0x2a20e9,_0x5902e1){_0x5902e1=_0x5902e1||0xc8;return function(_0x3a0dca){if(_0x3a0dca){return _0x2a20e9['status'](_0x5902e1)[_0xa583('0x16')](_0x3a0dca);}};}function respondWithFilteredResult(_0x2f9bbb,_0x579252){return function(_0x521bd0){if(_0x521bd0){var _0x2edabd=typeof _0x579252[_0xa583('0x17')]===_0xa583('0x18')&&typeof _0x579252[_0xa583('0x19')]===_0xa583('0x18');var _0x29cfcf=_0x521bd0[_0xa583('0x1a')];var _0x1248ce=_0x2edabd?0x0:_0x579252['offset'];var _0xa873a6=_0x2edabd?_0x521bd0[_0xa583('0x1a')]:_0x579252[_0xa583('0x17')]+_0x579252[_0xa583('0x19')];var _0x49bfb2;if(_0xa873a6>=_0x29cfcf){_0xa873a6=_0x29cfcf;_0x49bfb2=0xc8;}else{_0x49bfb2=0xce;}_0x2f9bbb[_0xa583('0x1b')](_0x49bfb2);return _0x2f9bbb[_0xa583('0x1c')](_0xa583('0x1d'),_0x1248ce+'-'+_0xa873a6+'/'+_0x29cfcf)[_0xa583('0x16')](_0x521bd0);}return null;};}function patchUpdates(_0x17e8ce){return function(_0x26b2a8){try{jsonpatch['apply'](_0x26b2a8,_0x17e8ce,!![]);}catch(_0x34f51e){return BPromise[_0xa583('0x1e')](_0x34f51e);}return _0x26b2a8[_0xa583('0x1f')]();};}function saveUpdates(_0x306415,_0x3b8024){return function(_0x449d02){if(_0x449d02){return _0x449d02['update'](_0x306415)[_0xa583('0x20')](function(_0x5eebd5){return _0x5eebd5;});}return null;};}function removeEntity(_0x9878ab,_0x59a22c){return function(_0x3474ff){if(_0x3474ff){return _0x3474ff[_0xa583('0x21')]()['then'](function(){_0x9878ab[_0xa583('0x1b')](0xcc)[_0xa583('0x15')]();});}};}function handleEntityNotFound(_0x871d56,_0x486128){return function(_0x38ecb5){if(!_0x38ecb5){_0x871d56['sendStatus'](0x194);}return _0x38ecb5;};}function handleError(_0x14ecc4,_0x402f23){_0x402f23=_0x402f23||0x1f4;return function(_0x2d9988){logger['error'](_0x2d9988['stack']);if(_0x2d9988[_0xa583('0x22')]){delete _0x2d9988[_0xa583('0x22')];}_0x14ecc4['status'](_0x402f23)[_0xa583('0x23')](_0x2d9988);};}exports[_0xa583('0x24')]=function(_0x5192a9,_0x340119){var _0x4f0aa5={},_0x39d5f2={},_0x47238f={'count':0x0,'rows':[]};var _0x2f7f4f=_[_0xa583('0x25')](db[_0xa583('0x26')]['rawAttributes'],function(_0x1c99a4){return{'name':_0x1c99a4[_0xa583('0x27')],'type':_0x1c99a4[_0xa583('0x28')][_0xa583('0x29')]};});_0x39d5f2[_0xa583('0x2a')]=_[_0xa583('0x25')](_0x2f7f4f,_0xa583('0x22'));_0x39d5f2['query']=_[_0xa583('0x2b')](_0x5192a9[_0xa583('0x2c')]);_0x39d5f2[_0xa583('0x2d')]=_['intersection'](_0x39d5f2[_0xa583('0x2a')],_0x39d5f2[_0xa583('0x2c')]);_0x4f0aa5['attributes']=_['intersection'](_0x39d5f2[_0xa583('0x2a')],qs[_0xa583('0x2e')](_0x5192a9[_0xa583('0x2c')][_0xa583('0x2e')]));_0x4f0aa5[_0xa583('0x2f')]=_0x4f0aa5['attributes'][_0xa583('0x30')]?_0x4f0aa5['attributes']:_0x39d5f2['model'];if(!_0x5192a9[_0xa583('0x2c')]['hasOwnProperty']('nolimit')){_0x4f0aa5[_0xa583('0x19')]=qs['limit'](_0x5192a9[_0xa583('0x2c')][_0xa583('0x19')]);_0x4f0aa5[_0xa583('0x17')]=qs[_0xa583('0x17')](_0x5192a9['query']['offset']);}_0x4f0aa5[_0xa583('0x31')]=qs['sort'](_0x5192a9['query'][_0xa583('0x32')]);_0x4f0aa5[_0xa583('0x33')]=qs[_0xa583('0x2d')](_[_0xa583('0x34')](_0x5192a9['query'],_0x39d5f2[_0xa583('0x2d')]),_0x2f7f4f);if(_0x5192a9[_0xa583('0x2c')][_0xa583('0x35')]){_0x4f0aa5['where']=_[_0xa583('0x36')](_0x4f0aa5[_0xa583('0x33')],{'$or':_['map'](_0x2f7f4f,function(_0x2d8dc8){if(_0x2d8dc8[_0xa583('0x28')]!==_0xa583('0x37')){var _0x4271c1={};_0x4271c1[_0x2d8dc8['name']]={'$like':'%'+_0x5192a9[_0xa583('0x2c')]['filter']+'%'};return _0x4271c1;}})});}_0x4f0aa5=_[_0xa583('0x36')]({},_0x4f0aa5,_0x5192a9[_0xa583('0x38')]);var _0xb71be6={'where':_0x4f0aa5[_0xa583('0x33')]};return db[_0xa583('0x26')][_0xa583('0x1a')](_0xb71be6)['then'](function(_0x274734){_0x47238f[_0xa583('0x1a')]=_0x274734;if(_0x5192a9[_0xa583('0x2c')][_0xa583('0x39')]){_0x4f0aa5['include']=[{'all':!![]}];}return db[_0xa583('0x26')]['findAll'](_0x4f0aa5);})[_0xa583('0x20')](function(_0x3b9d91){_0x47238f[_0xa583('0x3a')]=_0x3b9d91;return _0x47238f;})[_0xa583('0x20')](respondWithFilteredResult(_0x340119,_0x4f0aa5))[_0xa583('0x3b')](handleError(_0x340119,null));};exports[_0xa583('0x3c')]=function(_0x710b9a,_0x4e8398){var _0x3443d7={'raw':!![],'where':{'id':_0x710b9a[_0xa583('0x3d')]['id']}},_0x3fddc6={};_0x3fddc6[_0xa583('0x2a')]=_[_0xa583('0x2b')](db[_0xa583('0x26')][_0xa583('0x3e')]);_0x3fddc6['query']=_[_0xa583('0x2b')](_0x710b9a[_0xa583('0x2c')]);_0x3fddc6[_0xa583('0x2d')]=_[_0xa583('0x3f')](_0x3fddc6[_0xa583('0x2a')],_0x3fddc6[_0xa583('0x2c')]);_0x3443d7[_0xa583('0x2f')]=_[_0xa583('0x3f')](_0x3fddc6[_0xa583('0x2a')],qs[_0xa583('0x2e')](_0x710b9a['query'][_0xa583('0x2e')]));_0x3443d7[_0xa583('0x2f')]=_0x3443d7[_0xa583('0x2f')][_0xa583('0x30')]?_0x3443d7[_0xa583('0x2f')]:_0x3fddc6['model'];if(_0x710b9a[_0xa583('0x2c')][_0xa583('0x39')]){_0x3443d7['include']=[{'all':!![]}];}_0x3443d7=_[_0xa583('0x36')]({},_0x3443d7,_0x710b9a[_0xa583('0x38')]);return db[_0xa583('0x26')]['find'](_0x3443d7)['then'](handleEntityNotFound(_0x4e8398,null))[_0xa583('0x20')](respondWithResult(_0x4e8398,null))[_0xa583('0x3b')](handleError(_0x4e8398,null));};exports[_0xa583('0x40')]=function(_0x53211b,_0x567493){return db[_0xa583('0x26')][_0xa583('0x40')](_0x53211b['body'],{})['then'](respondWithResult(_0x567493,0xc9))['catch'](handleError(_0x567493,null));};exports[_0xa583('0x41')]=function(_0x12b313,_0x21524a){if(_0x12b313['body']['id']){delete _0x12b313[_0xa583('0x42')]['id'];}return db[_0xa583('0x26')][_0xa583('0x43')]({'where':{'id':_0x12b313[_0xa583('0x3d')]['id']}})[_0xa583('0x20')](handleEntityNotFound(_0x21524a,null))['then'](saveUpdates(_0x12b313[_0xa583('0x42')],null))[_0xa583('0x20')](respondWithResult(_0x21524a,null))[_0xa583('0x3b')](handleError(_0x21524a,null));};exports[_0xa583('0x21')]=function(_0x32bdc3,_0x5c5d3c){return db['AnalyticTreeReport']['find']({'where':{'id':_0x32bdc3['params']['id']}})[_0xa583('0x20')](handleEntityNotFound(_0x5c5d3c,null))['then'](removeEntity(_0x5c5d3c,null))[_0xa583('0x3b')](handleError(_0x5c5d3c,null));}; \ No newline at end of file +var _0xf7cf=['catch','show','params','rawAttributes','intersection','find','create','body','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll'];(function(_0x28a278,_0x34c998){var _0x5379aa=function(_0x330bb2){while(--_0x330bb2){_0x28a278['push'](_0x28a278['shift']());}};_0x5379aa(++_0x34c998);}(_0xf7cf,0x120));var _0xff7c=function(_0x3feccc,_0x5534c7){_0x3feccc=_0x3feccc-0x0;var _0x2c13b5=_0xf7cf[_0x3feccc];return _0x2c13b5;};'use strict';var emlformat=require(_0xff7c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xff7c('0x1'));var moment=require(_0xff7c('0x2'));var BPromise=require(_0xff7c('0x3'));var Mustache=require(_0xff7c('0x4'));var util=require(_0xff7c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xff7c('0x6'));var ejs=require(_0xff7c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff7c('0x8'));var squel=require(_0xff7c('0x9'));var crypto=require(_0xff7c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xff7c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xff7c('0xc'));var Papa=require(_0xff7c('0xd'));var Redis=require(_0xff7c('0xe'));var authService=require(_0xff7c('0xf'));var qs=require(_0xff7c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff7c('0x11'));var logger=require(_0xff7c('0x12'))('api');var utils=require(_0xff7c('0x13'));var config=require(_0xff7c('0x14'));var licenseUtil=require(_0xff7c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3051f1,_0x336f79){_0x336f79=_0x336f79||0xcc;return function(_0x394d4a){if(_0x394d4a){return _0x3051f1[_0xff7c('0x16')](_0x336f79);}return _0x3051f1['status'](_0x336f79)[_0xff7c('0x17')]();};}function respondWithResult(_0x1bb108,_0x79aff4){_0x79aff4=_0x79aff4||0xc8;return function(_0xbf82ab){if(_0xbf82ab){return _0x1bb108[_0xff7c('0x18')](_0x79aff4)[_0xff7c('0x19')](_0xbf82ab);}};}function respondWithFilteredResult(_0x2f5862,_0x300e12){return function(_0x4f2ae7){if(_0x4f2ae7){var _0x92891f=typeof _0x300e12[_0xff7c('0x1a')]===_0xff7c('0x1b')&&typeof _0x300e12['limit']===_0xff7c('0x1b');var _0x14a18f=_0x4f2ae7[_0xff7c('0x1c')];var _0xe00ea3=_0x92891f?0x0:_0x300e12[_0xff7c('0x1a')];var _0x32383e=_0x92891f?_0x4f2ae7[_0xff7c('0x1c')]:_0x300e12['offset']+_0x300e12[_0xff7c('0x1d')];var _0x21b55d;if(_0x32383e>=_0x14a18f){_0x32383e=_0x14a18f;_0x21b55d=0xc8;}else{_0x21b55d=0xce;}_0x2f5862[_0xff7c('0x18')](_0x21b55d);return _0x2f5862['set'](_0xff7c('0x1e'),_0xe00ea3+'-'+_0x32383e+'/'+_0x14a18f)[_0xff7c('0x19')](_0x4f2ae7);}return null;};}function patchUpdates(_0x1fae25){return function(_0xd32941){try{jsonpatch[_0xff7c('0x1f')](_0xd32941,_0x1fae25,!![]);}catch(_0x15b24e){return BPromise['reject'](_0x15b24e);}return _0xd32941[_0xff7c('0x20')]();};}function saveUpdates(_0x5bc7c4,_0xe18fd){return function(_0x2e545f){if(_0x2e545f){return _0x2e545f[_0xff7c('0x21')](_0x5bc7c4)[_0xff7c('0x22')](function(_0x7b9b10){return _0x7b9b10;});}return null;};}function removeEntity(_0x142f55,_0x1cbae6){return function(_0x59e98e){if(_0x59e98e){return _0x59e98e[_0xff7c('0x23')]()['then'](function(){_0x142f55[_0xff7c('0x18')](0xcc)[_0xff7c('0x17')]();});}};}function handleEntityNotFound(_0x1c7a70,_0x92fbd5){return function(_0x4495b6){if(!_0x4495b6){_0x1c7a70[_0xff7c('0x16')](0x194);}return _0x4495b6;};}function handleError(_0x7cdd53,_0x5d788b){_0x5d788b=_0x5d788b||0x1f4;return function(_0x15358d){logger[_0xff7c('0x24')](_0x15358d['stack']);if(_0x15358d[_0xff7c('0x25')]){delete _0x15358d['name'];}_0x7cdd53['status'](_0x5d788b)[_0xff7c('0x26')](_0x15358d);};}exports[_0xff7c('0x27')]=function(_0x1467b5,_0x10eef2){var _0x2ebbb5={},_0x1a349f={},_0x3fda85={'count':0x0,'rows':[]};var _0x5847f6=_[_0xff7c('0x28')](db[_0xff7c('0x29')]['rawAttributes'],function(_0x5e71a3){return{'name':_0x5e71a3[_0xff7c('0x2a')],'type':_0x5e71a3[_0xff7c('0x2b')]['key']};});_0x1a349f[_0xff7c('0x2c')]=_[_0xff7c('0x28')](_0x5847f6,'name');_0x1a349f[_0xff7c('0x2d')]=_[_0xff7c('0x2e')](_0x1467b5[_0xff7c('0x2d')]);_0x1a349f[_0xff7c('0x2f')]=_['intersection'](_0x1a349f[_0xff7c('0x2c')],_0x1a349f['query']);_0x2ebbb5[_0xff7c('0x30')]=_['intersection'](_0x1a349f[_0xff7c('0x2c')],qs['fields'](_0x1467b5[_0xff7c('0x2d')][_0xff7c('0x31')]));_0x2ebbb5[_0xff7c('0x30')]=_0x2ebbb5['attributes'][_0xff7c('0x32')]?_0x2ebbb5[_0xff7c('0x30')]:_0x1a349f[_0xff7c('0x2c')];if(!_0x1467b5[_0xff7c('0x2d')]['hasOwnProperty'](_0xff7c('0x33'))){_0x2ebbb5[_0xff7c('0x1d')]=qs[_0xff7c('0x1d')](_0x1467b5[_0xff7c('0x2d')][_0xff7c('0x1d')]);_0x2ebbb5[_0xff7c('0x1a')]=qs['offset'](_0x1467b5['query']['offset']);}_0x2ebbb5[_0xff7c('0x34')]=qs[_0xff7c('0x35')](_0x1467b5[_0xff7c('0x2d')]['sort']);_0x2ebbb5['where']=qs['filters'](_[_0xff7c('0x36')](_0x1467b5[_0xff7c('0x2d')],_0x1a349f[_0xff7c('0x2f')]),_0x5847f6);if(_0x1467b5[_0xff7c('0x2d')][_0xff7c('0x37')]){_0x2ebbb5[_0xff7c('0x38')]=_['merge'](_0x2ebbb5[_0xff7c('0x38')],{'$or':_[_0xff7c('0x28')](_0x5847f6,function(_0x1d5236){if(_0x1d5236['type']!=='VIRTUAL'){var _0x50d027={};_0x50d027[_0x1d5236[_0xff7c('0x25')]]={'$like':'%'+_0x1467b5[_0xff7c('0x2d')]['filter']+'%'};return _0x50d027;}})});}_0x2ebbb5=_[_0xff7c('0x39')]({},_0x2ebbb5,_0x1467b5[_0xff7c('0x3a')]);var _0x501b9c={'where':_0x2ebbb5[_0xff7c('0x38')]};return db[_0xff7c('0x29')][_0xff7c('0x1c')](_0x501b9c)[_0xff7c('0x22')](function(_0x32bc78){_0x3fda85[_0xff7c('0x1c')]=_0x32bc78;if(_0x1467b5[_0xff7c('0x2d')][_0xff7c('0x3b')]){_0x2ebbb5[_0xff7c('0x3c')]=[{'all':!![]}];}return db[_0xff7c('0x29')][_0xff7c('0x3d')](_0x2ebbb5);})[_0xff7c('0x22')](function(_0x557693){_0x3fda85['rows']=_0x557693;return _0x3fda85;})['then'](respondWithFilteredResult(_0x10eef2,_0x2ebbb5))[_0xff7c('0x3e')](handleError(_0x10eef2,null));};exports[_0xff7c('0x3f')]=function(_0x23e6df,_0x1434b1){var _0x50f1d5={'raw':!![],'where':{'id':_0x23e6df[_0xff7c('0x40')]['id']}},_0x46c30c={};_0x46c30c['model']=_[_0xff7c('0x2e')](db[_0xff7c('0x29')][_0xff7c('0x41')]);_0x46c30c[_0xff7c('0x2d')]=_[_0xff7c('0x2e')](_0x23e6df['query']);_0x46c30c[_0xff7c('0x2f')]=_[_0xff7c('0x42')](_0x46c30c[_0xff7c('0x2c')],_0x46c30c['query']);_0x50f1d5[_0xff7c('0x30')]=_[_0xff7c('0x42')](_0x46c30c[_0xff7c('0x2c')],qs[_0xff7c('0x31')](_0x23e6df[_0xff7c('0x2d')][_0xff7c('0x31')]));_0x50f1d5['attributes']=_0x50f1d5[_0xff7c('0x30')]['length']?_0x50f1d5['attributes']:_0x46c30c[_0xff7c('0x2c')];if(_0x23e6df['query']['includeAll']){_0x50f1d5[_0xff7c('0x3c')]=[{'all':!![]}];}_0x50f1d5=_[_0xff7c('0x39')]({},_0x50f1d5,_0x23e6df[_0xff7c('0x3a')]);return db['AnalyticTreeReport'][_0xff7c('0x43')](_0x50f1d5)[_0xff7c('0x22')](handleEntityNotFound(_0x1434b1,null))[_0xff7c('0x22')](respondWithResult(_0x1434b1,null))[_0xff7c('0x3e')](handleError(_0x1434b1,null));};exports[_0xff7c('0x44')]=function(_0x36e18c,_0x75673){return db['AnalyticTreeReport'][_0xff7c('0x44')](_0x36e18c[_0xff7c('0x45')],{})['then'](respondWithResult(_0x75673,0xc9))[_0xff7c('0x3e')](handleError(_0x75673,null));};exports[_0xff7c('0x21')]=function(_0x106a57,_0x5bf4f9){if(_0x106a57[_0xff7c('0x45')]['id']){delete _0x106a57[_0xff7c('0x45')]['id'];}return db[_0xff7c('0x29')]['find']({'where':{'id':_0x106a57[_0xff7c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5bf4f9,null))[_0xff7c('0x22')](saveUpdates(_0x106a57[_0xff7c('0x45')],null))[_0xff7c('0x22')](respondWithResult(_0x5bf4f9,null))[_0xff7c('0x3e')](handleError(_0x5bf4f9,null));};exports[_0xff7c('0x23')]=function(_0x55b4a1,_0x4a2bce){return db['AnalyticTreeReport'][_0xff7c('0x43')]({'where':{'id':_0x55b4a1['params']['id']}})[_0xff7c('0x22')](handleEntityNotFound(_0x4a2bce,null))[_0xff7c('0x22')](removeEntity(_0x4a2bce,null))[_0xff7c('0x3e')](handleError(_0x4a2bce,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 2211272..ca4899e 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 _0xdab9=['AnalyticTreeReport','util','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes','exports','define'];(function(_0x41eccf,_0x3ad85a){var _0x57965f=function(_0x5bce52){while(--_0x5bce52){_0x41eccf['push'](_0x41eccf['shift']());}};_0x57965f(++_0x3ad85a);}(_0xdab9,0x187));var _0x9dab=function(_0x14d0b3,_0x37bc6a){_0x14d0b3=_0x14d0b3-0x0;var _0x95ba9f=_0xdab9[_0x14d0b3];return _0x95ba9f;};'use strict';var _=require('lodash');var util=require(_0x9dab('0x0'));var logger=require(_0x9dab('0x1'))('api');var moment=require(_0x9dab('0x2'));var BPromise=require(_0x9dab('0x3'));var rp=require(_0x9dab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9dab('0x5'));var config=require('../../config/environment');var attributes=require(_0x9dab('0x6'));module[_0x9dab('0x7')]=function(_0x1c404a,_0x459552){return _0x1c404a[_0x9dab('0x8')](_0x9dab('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x805d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x1d5daa,_0x452e80){var _0x5d14b1=function(_0x2ae76d){while(--_0x2ae76d){_0x1d5daa['push'](_0x1d5daa['shift']());}};_0x5d14b1(++_0x452e80);}(_0x805d,0x8d));var _0xd805=function(_0x43461b,_0x3fbf05){_0x43461b=_0x43461b-0x0;var _0x18436f=_0x805d[_0x43461b];return _0x18436f;};'use strict';var _=require(_0xd805('0x0'));var util=require(_0xd805('0x1'));var logger=require('../../config/logger')(_0xd805('0x2'));var moment=require(_0xd805('0x3'));var BPromise=require(_0xd805('0x4'));var rp=require(_0xd805('0x5'));var fs=require('fs');var path=require(_0xd805('0x6'));var rimraf=require(_0xd805('0x7'));var config=require(_0xd805('0x8'));var attributes=require(_0xd805('0x9'));module['exports']=function(_0x107c68,_0x3b31ac){return _0x107c68[_0xd805('0xa')](_0xd805('0xb'),attributes,{'tableName':_0xd805('0xc'),'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 eed010e..9f4196c 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x28d2d2,_0x5723e5){var _0x41a8db=function(_0x54bf80){while(--_0x54bf80){_0x28d2d2['push'](_0x28d2d2['shift']());}};_0x41a8db(++_0x5723e5);}(_0x2ef3,0xba));var _0x32ef=function(_0x26026e,_0x5ae89e){_0x26026e=_0x26026e-0x0;var _0x324f2c=_0x2ef3[_0x26026e];return _0x324f2c;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\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','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5712cc,_0x5db7dd){var _0x15561a=function(_0x4bf65d){while(--_0x4bf65d){_0x5712cc['push'](_0x5712cc['shift']());}};_0x15561a(++_0x5db7dd);}(_0x2ef3,0xba));var _0x32ef=function(_0x1a2010,_0x4a2997){_0x1a2010=_0x1a2010-0x0;var _0x535f3c=_0x2ef3[_0x1a2010];return _0x535f3c;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 11bd1d7..9ba5b0c 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 _0xa477=['path','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xa477,0xdc));var _0x7a47=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa477[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x7a47('0x0'));var path=require(_0x7a47('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7a47('0x2')]();var fs_extra=require(_0x7a47('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7a47('0x4'));var controller=require('./analyticTreeReport.controller');router[_0x7a47('0x5')]('/',auth[_0x7a47('0x6')](),controller[_0x7a47('0x7')]);router[_0x7a47('0x5')]('/:id',auth[_0x7a47('0x6')](),controller[_0x7a47('0x8')]);router[_0x7a47('0x9')]('/',auth[_0x7a47('0x6')](),controller[_0x7a47('0xa')]);router[_0x7a47('0xb')](_0x7a47('0xc'),auth[_0x7a47('0x6')](),controller[_0x7a47('0xd')]);router[_0x7a47('0xe')](_0x7a47('0xc'),auth[_0x7a47('0x6')](),controller[_0x7a47('0xf')]);module[_0x7a47('0x10')]=router; \ No newline at end of file +var _0xff04=['post','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xff04,0x74));var _0x4ff0=function(_0x58e942,_0x559725){_0x58e942=_0x58e942-0x0;var _0x1e86cb=_0xff04[_0x58e942];return _0x1e86cb;};'use strict';var multer=require(_0x4ff0('0x0'));var util=require(_0x4ff0('0x1'));var path=require(_0x4ff0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ff0('0x3')]();var fs_extra=require(_0x4ff0('0x4'));var auth=require(_0x4ff0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ff0('0x6'));var controller=require(_0x4ff0('0x7'));router[_0x4ff0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ff0('0x8')](_0x4ff0('0x9'),auth[_0x4ff0('0xa')](),controller[_0x4ff0('0xb')]);router[_0x4ff0('0xc')]('/',auth[_0x4ff0('0xa')](),controller['create']);router[_0x4ff0('0xd')](_0x4ff0('0x9'),auth[_0x4ff0('0xa')](),controller['update']);router['delete'](_0x4ff0('0x9'),auth[_0x4ff0('0xa')](),controller[_0x4ff0('0xe')]);module[_0x4ff0('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6ce8db0..436d8dc 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 _0x9099=['sequelize','STRING'];(function(_0x4686f5,_0x50a394){var _0x64c7f1=function(_0x841e8b){while(--_0x841e8b){_0x4686f5['push'](_0x4686f5['shift']());}};_0x64c7f1(++_0x50a394);}(_0x9099,0x1ac));var _0x9909=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x9099[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require(_0x9909('0x0'));module['exports']={'name':{'type':Sequelize[_0x9909('0x1')]},'basename':{'type':Sequelize[_0x9909('0x1')]},'type':{'type':Sequelize[_0x9909('0x1')]}}; \ No newline at end of file +var _0xed1f=['STRING','sequelize','exports'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xed1f,0x6a));var _0xfed1=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xed1f[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'name':{'type':Sequelize[_0xfed1('0x2')]},'basename':{'type':Sequelize[_0xfed1('0x2')]},'type':{'type':Sequelize[_0xfed1('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8a7bc14..3d1e995 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 _0x5b83=['reject','save','update','then','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','catch','params','keys','includeAll','include','find','updatedAt','omit','body','createdAt','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','join','offline-chat/','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x5b83,0xde));var _0x35b8=function(_0x5f083f,_0xb63d8f){_0x5f083f=_0x5f083f-0x0;var _0x1bd5c9=_0x5b83[_0x5f083f];return _0x1bd5c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35b8('0x1'));var rp=require('request-promise');var moment=require(_0x35b8('0x2'));var BPromise=require(_0x35b8('0x3'));var Mustache=require('mustache');var util=require(_0x35b8('0x4'));var path=require(_0x35b8('0x5'));var sox=require(_0x35b8('0x6'));var csv=require(_0x35b8('0x7'));var ejs=require(_0x35b8('0x8'));var fs=require('fs');var fs_extra=require(_0x35b8('0x9'));var _=require(_0x35b8('0xa'));var squel=require(_0x35b8('0xb'));var crypto=require(_0x35b8('0xc'));var jsforce=require(_0x35b8('0xd'));var deskjs=require(_0x35b8('0xe'));var toCsv=require(_0x35b8('0x7'));var querystring=require(_0x35b8('0xf'));var Papa=require(_0x35b8('0x10'));var Redis=require('ioredis');var authService=require(_0x35b8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35b8('0x12'))('api');var utils=require(_0x35b8('0x13'));var config=require(_0x35b8('0x14'));var licenseUtil=require(_0x35b8('0x15'));var db=require(_0x35b8('0x16'))['db'];function respondWithStatusCode(_0x6a2232,_0x382e6f){_0x382e6f=_0x382e6f||0xcc;return function(_0x39523){if(_0x39523){return _0x6a2232[_0x35b8('0x17')](_0x382e6f);}return _0x6a2232[_0x35b8('0x18')](_0x382e6f)[_0x35b8('0x19')]();};}function respondWithResult(_0x5e6b84,_0x37e5c6){_0x37e5c6=_0x37e5c6||0xc8;return function(_0x1fed47){if(_0x1fed47){return _0x5e6b84[_0x35b8('0x18')](_0x37e5c6)[_0x35b8('0x1a')](_0x1fed47);}};}function respondWithFilteredResult(_0x38a242,_0x1367df){return function(_0x419dc9){if(_0x419dc9){var _0xfdf6cc=typeof _0x1367df[_0x35b8('0x1b')]===_0x35b8('0x1c')&&typeof _0x1367df[_0x35b8('0x1d')]===_0x35b8('0x1c');var _0x2dd43c=_0x419dc9[_0x35b8('0x1e')];var _0x5f19f3=_0xfdf6cc?0x0:_0x1367df['offset'];var _0x5c5115=_0xfdf6cc?_0x419dc9[_0x35b8('0x1e')]:_0x1367df['offset']+_0x1367df[_0x35b8('0x1d')];var _0x57a148;if(_0x5c5115>=_0x2dd43c){_0x5c5115=_0x2dd43c;_0x57a148=0xc8;}else{_0x57a148=0xce;}_0x38a242[_0x35b8('0x18')](_0x57a148);return _0x38a242[_0x35b8('0x1f')](_0x35b8('0x20'),_0x5f19f3+'-'+_0x5c5115+'/'+_0x2dd43c)[_0x35b8('0x1a')](_0x419dc9);}return null;};}function patchUpdates(_0x29e38c){return function(_0x1dbaa7){try{jsonpatch['apply'](_0x1dbaa7,_0x29e38c,!![]);}catch(_0x5866cd){return BPromise[_0x35b8('0x21')](_0x5866cd);}return _0x1dbaa7[_0x35b8('0x22')]();};}function saveUpdates(_0x1edaa8,_0x287916){return function(_0xebd5dd){if(_0xebd5dd){return _0xebd5dd[_0x35b8('0x23')](_0x1edaa8)[_0x35b8('0x24')](function(_0x4af368){return _0x4af368;});}return null;};}function removeEntity(_0x6673b4,_0x5b117b){return function(_0x4f6fb4){if(_0x4f6fb4){return _0x4f6fb4['destroy']()[_0x35b8('0x24')](function(){_0x6673b4[_0x35b8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56abda,_0x273696){return function(_0x3fc790){if(!_0x3fc790){_0x56abda[_0x35b8('0x17')](0x194);}return _0x3fc790;};}function handleError(_0x1fe12d,_0x4210e4){_0x4210e4=_0x4210e4||0x1f4;return function(_0x1b4cc4){logger[_0x35b8('0x25')](_0x1b4cc4[_0x35b8('0x26')]);if(_0x1b4cc4[_0x35b8('0x27')]){delete _0x1b4cc4['name'];}_0x1fe12d[_0x35b8('0x18')](_0x4210e4)[_0x35b8('0x28')](_0x1b4cc4);};}exports[_0x35b8('0x29')]=function(_0x411c70,_0x9178d0){var _0x30ce70={},_0x4597ba={},_0x20de25={'count':0x0,'rows':[]};var _0x16ab4c=_[_0x35b8('0x2a')](db[_0x35b8('0x2b')][_0x35b8('0x2c')],function(_0x39fd80){return{'name':_0x39fd80[_0x35b8('0x2d')],'type':_0x39fd80[_0x35b8('0x2e')][_0x35b8('0x2f')]};});_0x4597ba['model']=_[_0x35b8('0x2a')](_0x16ab4c,_0x35b8('0x27'));_0x4597ba[_0x35b8('0x30')]=_['keys'](_0x411c70[_0x35b8('0x30')]);_0x4597ba['filters']=_['intersection'](_0x4597ba['model'],_0x4597ba[_0x35b8('0x30')]);_0x30ce70['attributes']=_[_0x35b8('0x31')](_0x4597ba[_0x35b8('0x32')],qs[_0x35b8('0x33')](_0x411c70[_0x35b8('0x30')][_0x35b8('0x33')]));_0x30ce70[_0x35b8('0x34')]=_0x30ce70[_0x35b8('0x34')][_0x35b8('0x35')]?_0x30ce70[_0x35b8('0x34')]:_0x4597ba[_0x35b8('0x32')];if(!_0x411c70[_0x35b8('0x30')][_0x35b8('0x36')]('nolimit')){_0x30ce70[_0x35b8('0x1d')]=qs['limit'](_0x411c70[_0x35b8('0x30')][_0x35b8('0x1d')]);_0x30ce70[_0x35b8('0x1b')]=qs[_0x35b8('0x1b')](_0x411c70[_0x35b8('0x30')]['offset']);}_0x30ce70[_0x35b8('0x37')]=qs['sort'](_0x411c70[_0x35b8('0x30')][_0x35b8('0x38')]);_0x30ce70[_0x35b8('0x39')]=qs[_0x35b8('0x3a')](_[_0x35b8('0x3b')](_0x411c70['query'],_0x4597ba[_0x35b8('0x3a')]),_0x16ab4c);if(_0x411c70[_0x35b8('0x30')]['filter']){_0x30ce70[_0x35b8('0x39')]=_[_0x35b8('0x3c')](_0x30ce70[_0x35b8('0x39')],{'$or':_[_0x35b8('0x2a')](_0x16ab4c,function(_0x4c5c31){if(_0x4c5c31[_0x35b8('0x2e')]!==_0x35b8('0x3d')){var _0x491a7b={};_0x491a7b[_0x4c5c31[_0x35b8('0x27')]]={'$like':'%'+_0x411c70[_0x35b8('0x30')][_0x35b8('0x3e')]+'%'};return _0x491a7b;}})});}_0x30ce70=_[_0x35b8('0x3c')]({},_0x30ce70,_0x411c70[_0x35b8('0x3f')]);var _0x237290={'where':_0x30ce70[_0x35b8('0x39')]};return db[_0x35b8('0x2b')][_0x35b8('0x1e')](_0x237290)[_0x35b8('0x24')](function(_0x43addb){_0x20de25['count']=_0x43addb;if(_0x411c70[_0x35b8('0x30')]['includeAll']){_0x30ce70['include']=[{'all':!![]}];}return db[_0x35b8('0x2b')][_0x35b8('0x40')](_0x30ce70);})[_0x35b8('0x24')](function(_0x4713d0){_0x20de25['rows']=_0x4713d0;return _0x20de25;})['then'](respondWithFilteredResult(_0x9178d0,_0x30ce70))[_0x35b8('0x41')](handleError(_0x9178d0,null));};exports['show']=function(_0x42ffcb,_0x2d8a71){var _0x83c427={'raw':!![],'where':{'id':_0x42ffcb[_0x35b8('0x42')]['id']}},_0x585422={};_0x585422['model']=_[_0x35b8('0x43')](db[_0x35b8('0x2b')][_0x35b8('0x2c')]);_0x585422['query']=_[_0x35b8('0x43')](_0x42ffcb[_0x35b8('0x30')]);_0x585422[_0x35b8('0x3a')]=_[_0x35b8('0x31')](_0x585422['model'],_0x585422[_0x35b8('0x30')]);_0x83c427[_0x35b8('0x34')]=_[_0x35b8('0x31')](_0x585422[_0x35b8('0x32')],qs['fields'](_0x42ffcb[_0x35b8('0x30')]['fields']));_0x83c427['attributes']=_0x83c427[_0x35b8('0x34')]['length']?_0x83c427[_0x35b8('0x34')]:_0x585422['model'];if(_0x42ffcb[_0x35b8('0x30')][_0x35b8('0x44')]){_0x83c427[_0x35b8('0x45')]=[{'all':!![]}];}_0x83c427=_[_0x35b8('0x3c')]({},_0x83c427,_0x42ffcb[_0x35b8('0x3f')]);return db[_0x35b8('0x2b')][_0x35b8('0x46')](_0x83c427)['then'](handleEntityNotFound(_0x2d8a71,null))[_0x35b8('0x24')](respondWithResult(_0x2d8a71,null))[_0x35b8('0x41')](handleError(_0x2d8a71,null));};exports['clone']=function(_0x592a62,_0x41d4a1){var _0x5ea957={'where':{'id':_0x592a62[_0x35b8('0x42')]['id']}},_0x36e25b={};_0x36e25b[_0x35b8('0x32')]=_[_0x35b8('0x43')](db[_0x35b8('0x2b')][_0x35b8('0x2c')]);_0x5ea957[_0x35b8('0x34')]=_['intersection'](_0x36e25b[_0x35b8('0x32')],qs[_0x35b8('0x33')](_0x592a62[_0x35b8('0x30')][_0x35b8('0x33')]));_0x5ea957['attributes']=_0x5ea957[_0x35b8('0x34')][_0x35b8('0x35')]?_0x5ea957['attributes']:_0x36e25b['model'];if(_0x592a62['query'][_0x35b8('0x44')]){_0x5ea957[_0x35b8('0x45')]=[{'all':!![]}];}_0x5ea957=_[_0x35b8('0x3c')]({},_0x5ea957,_0x592a62['options']);return db[_0x35b8('0x2b')][_0x35b8('0x46')](_0x5ea957)[_0x35b8('0x24')](handleEntityNotFound(_0x41d4a1,null))[_0x35b8('0x24')](function(_0x3c3a64){if(_0x3c3a64){var _0x58ccd6=_0x3c3a64['get']({'plain':!![]});_0x58ccd6=qs['omit'](_0x58ccd6,['id','createdAt',_0x35b8('0x47')]);_0x592a62['body']=_[_0x35b8('0x48')](_0x592a62[_0x35b8('0x49')],['id',_0x35b8('0x4a'),'updatedAt']);return db[_0x35b8('0x2b')][_0x35b8('0x4b')](_[_0x35b8('0x3c')](_0x58ccd6,_0x592a62[_0x35b8('0x49')]),{'include':_0x592a62['query'][_0x35b8('0x44')]?[{'all':!![]}]:undefined});}})[_0x35b8('0x24')](respondWithResult(_0x41d4a1,0xc9))['catch'](handleError(_0x41d4a1,null));};exports[_0x35b8('0x23')]=function(_0x54b0a6,_0x149e6d){if(_0x54b0a6['body']['id']){delete _0x54b0a6[_0x35b8('0x49')]['id'];}return db[_0x35b8('0x2b')]['find']({'where':{'id':_0x54b0a6[_0x35b8('0x42')]['id']}})['then'](handleEntityNotFound(_0x149e6d,null))[_0x35b8('0x24')](saveUpdates(_0x54b0a6[_0x35b8('0x49')],null))[_0x35b8('0x24')](respondWithResult(_0x149e6d,null))[_0x35b8('0x41')](handleError(_0x149e6d,null));};exports['destroy']=function(_0x1b6b08,_0x568b92){return db['Attachment'][_0x35b8('0x46')]({'where':{'id':_0x1b6b08[_0x35b8('0x42')]['id']}})[_0x35b8('0x24')](handleEntityNotFound(_0x568b92,null))[_0x35b8('0x24')](removeEntity(_0x568b92,null))[_0x35b8('0x41')](handleError(_0x568b92,null));};exports['create']=function(_0x263eaa,_0x2f3bf8,_0x1a1a08){_0x263eaa[_0x35b8('0x49')][_0x35b8('0x27')]=_0x263eaa[_0x35b8('0x4c')][_0x35b8('0x4d')];_0x263eaa['body'][_0x35b8('0x4e')]=_0x263eaa[_0x35b8('0x4c')]['filename'];_0x263eaa['body'][_0x35b8('0x2e')]=_0x263eaa[_0x35b8('0x4c')][_0x35b8('0x4f')];return db[_0x35b8('0x2b')][_0x35b8('0x4b')](_0x263eaa[_0x35b8('0x49')])[_0x35b8('0x24')](respondWithResult(_0x2f3bf8,0xc9))['catch'](handleError(_0x2f3bf8,null));};exports[_0x35b8('0x50')]=function(_0x5d7b3b,_0x27a339,_0x36d62b){return db[_0x35b8('0x2b')][_0x35b8('0x51')]({'where':{'id':_0x5d7b3b['params']['id']},'raw':!![]})[_0x35b8('0x24')](handleEntityNotFound(_0x27a339,null))['then'](function(_0xabbf1d){if(_0xabbf1d){var _0x407e2e=_0xabbf1d[_0x35b8('0x52')]!==null;var _0x542b0e=path['join'](config['root'],'server/files/attachments/');if(_0x407e2e){_0x542b0e=path[_0x35b8('0x53')](_0x542b0e,_0x35b8('0x54'));}var _0x14170e=path[_0x35b8('0x53')](_0x542b0e,_0xabbf1d[_0x35b8('0x4e')]);return _0x27a339[_0x35b8('0x50')](_0x14170e);}})['catch'](handleError(_0x27a339,null));}; \ No newline at end of file +var _0xe42b=['length','includeAll','options','find','catch','clone','omit','createdAt','body','updatedAt','create','file','originalname','basename','filename','download','findOne','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','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','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','end','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','show','params'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0xe42b,0x179));var _0xbe42=function(_0x55841f,_0x487812){_0x55841f=_0x55841f-0x0;var _0x4c5ccf=_0xe42b[_0x55841f];return _0x4c5ccf;};'use strict';var emlformat=require(_0xbe42('0x0'));var rimraf=require(_0xbe42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe42('0x2'));var rp=require(_0xbe42('0x3'));var moment=require(_0xbe42('0x4'));var BPromise=require(_0xbe42('0x5'));var Mustache=require('mustache');var util=require(_0xbe42('0x6'));var path=require(_0xbe42('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe42('0x8'));var _=require('lodash');var squel=require(_0xbe42('0x9'));var crypto=require(_0xbe42('0xa'));var jsforce=require(_0xbe42('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe42('0xc'));var Papa=require(_0xbe42('0xd'));var Redis=require(_0xbe42('0xe'));var authService=require(_0xbe42('0xf'));var qs=require(_0xbe42('0x10'));var as=require(_0xbe42('0x11'));var hardwareService=require(_0xbe42('0x12'));var logger=require('../../config/logger')(_0xbe42('0x13'));var utils=require(_0xbe42('0x14'));var config=require(_0xbe42('0x15'));var licenseUtil=require(_0xbe42('0x16'));var db=require(_0xbe42('0x17'))['db'];function respondWithStatusCode(_0x38ae29,_0x76d68a){_0x76d68a=_0x76d68a||0xcc;return function(_0x132494){if(_0x132494){return _0x38ae29[_0xbe42('0x18')](_0x76d68a);}return _0x38ae29[_0xbe42('0x19')](_0x76d68a)['end']();};}function respondWithResult(_0xbdfaa0,_0x4420c2){_0x4420c2=_0x4420c2||0xc8;return function(_0x2bcf90){if(_0x2bcf90){return _0xbdfaa0[_0xbe42('0x19')](_0x4420c2)[_0xbe42('0x1a')](_0x2bcf90);}};}function respondWithFilteredResult(_0x58f7d9,_0x2ccb2c){return function(_0x2c2685){if(_0x2c2685){var _0x3a86b2=typeof _0x2ccb2c[_0xbe42('0x1b')]===_0xbe42('0x1c')&&typeof _0x2ccb2c['limit']===_0xbe42('0x1c');var _0x3f8bbe=_0x2c2685['count'];var _0x458a3b=_0x3a86b2?0x0:_0x2ccb2c[_0xbe42('0x1b')];var _0x2fcb05=_0x3a86b2?_0x2c2685[_0xbe42('0x1d')]:_0x2ccb2c[_0xbe42('0x1b')]+_0x2ccb2c[_0xbe42('0x1e')];var _0x1034b8;if(_0x2fcb05>=_0x3f8bbe){_0x2fcb05=_0x3f8bbe;_0x1034b8=0xc8;}else{_0x1034b8=0xce;}_0x58f7d9[_0xbe42('0x19')](_0x1034b8);return _0x58f7d9[_0xbe42('0x1f')]('Content-Range',_0x458a3b+'-'+_0x2fcb05+'/'+_0x3f8bbe)[_0xbe42('0x1a')](_0x2c2685);}return null;};}function patchUpdates(_0x193668){return function(_0x2d5688){try{jsonpatch[_0xbe42('0x20')](_0x2d5688,_0x193668,!![]);}catch(_0x160eb1){return BPromise['reject'](_0x160eb1);}return _0x2d5688[_0xbe42('0x21')]();};}function saveUpdates(_0x11164e,_0x5e59d1){return function(_0xc8a47f){if(_0xc8a47f){return _0xc8a47f[_0xbe42('0x22')](_0x11164e)['then'](function(_0x1e6976){return _0x1e6976;});}return null;};}function removeEntity(_0x43ef38,_0x4dce3e){return function(_0x7350ae){if(_0x7350ae){return _0x7350ae[_0xbe42('0x23')]()[_0xbe42('0x24')](function(){_0x43ef38[_0xbe42('0x19')](0xcc)[_0xbe42('0x25')]();});}};}function handleEntityNotFound(_0x38c740,_0x66ddb5){return function(_0x476a64){if(!_0x476a64){_0x38c740[_0xbe42('0x18')](0x194);}return _0x476a64;};}function handleError(_0x21c8e2,_0x2817c1){_0x2817c1=_0x2817c1||0x1f4;return function(_0x1bbecb){logger[_0xbe42('0x26')](_0x1bbecb[_0xbe42('0x27')]);if(_0x1bbecb[_0xbe42('0x28')]){delete _0x1bbecb['name'];}_0x21c8e2[_0xbe42('0x19')](_0x2817c1)['send'](_0x1bbecb);};}exports[_0xbe42('0x29')]=function(_0x85cac2,_0x13e6e6){var _0x40edd0={},_0x279147={},_0x3a8023={'count':0x0,'rows':[]};var _0x832624=_[_0xbe42('0x2a')](db[_0xbe42('0x2b')][_0xbe42('0x2c')],function(_0x4ee5a3){return{'name':_0x4ee5a3[_0xbe42('0x2d')],'type':_0x4ee5a3[_0xbe42('0x2e')][_0xbe42('0x2f')]};});_0x279147[_0xbe42('0x30')]=_[_0xbe42('0x2a')](_0x832624,'name');_0x279147[_0xbe42('0x31')]=_[_0xbe42('0x32')](_0x85cac2[_0xbe42('0x31')]);_0x279147[_0xbe42('0x33')]=_[_0xbe42('0x34')](_0x279147[_0xbe42('0x30')],_0x279147[_0xbe42('0x31')]);_0x40edd0[_0xbe42('0x35')]=_['intersection'](_0x279147[_0xbe42('0x30')],qs[_0xbe42('0x36')](_0x85cac2[_0xbe42('0x31')][_0xbe42('0x36')]));_0x40edd0[_0xbe42('0x35')]=_0x40edd0[_0xbe42('0x35')]['length']?_0x40edd0[_0xbe42('0x35')]:_0x279147['model'];if(!_0x85cac2['query'][_0xbe42('0x37')](_0xbe42('0x38'))){_0x40edd0['limit']=qs[_0xbe42('0x1e')](_0x85cac2[_0xbe42('0x31')]['limit']);_0x40edd0[_0xbe42('0x1b')]=qs[_0xbe42('0x1b')](_0x85cac2[_0xbe42('0x31')][_0xbe42('0x1b')]);}_0x40edd0[_0xbe42('0x39')]=qs[_0xbe42('0x3a')](_0x85cac2['query'][_0xbe42('0x3a')]);_0x40edd0[_0xbe42('0x3b')]=qs[_0xbe42('0x33')](_[_0xbe42('0x3c')](_0x85cac2[_0xbe42('0x31')],_0x279147[_0xbe42('0x33')]),_0x832624);if(_0x85cac2[_0xbe42('0x31')][_0xbe42('0x3d')]){_0x40edd0[_0xbe42('0x3b')]=_[_0xbe42('0x3e')](_0x40edd0['where'],{'$or':_['map'](_0x832624,function(_0x412434){if(_0x412434[_0xbe42('0x2e')]!==_0xbe42('0x3f')){var _0x1b353a={};_0x1b353a[_0x412434[_0xbe42('0x28')]]={'$like':'%'+_0x85cac2[_0xbe42('0x31')]['filter']+'%'};return _0x1b353a;}})});}_0x40edd0=_['merge']({},_0x40edd0,_0x85cac2['options']);var _0x334fc5={'where':_0x40edd0[_0xbe42('0x3b')]};return db['Attachment'][_0xbe42('0x1d')](_0x334fc5)[_0xbe42('0x24')](function(_0x169ee2){_0x3a8023['count']=_0x169ee2;if(_0x85cac2['query']['includeAll']){_0x40edd0[_0xbe42('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x40edd0);})[_0xbe42('0x24')](function(_0xa84f34){_0x3a8023[_0xbe42('0x41')]=_0xa84f34;return _0x3a8023;})[_0xbe42('0x24')](respondWithFilteredResult(_0x13e6e6,_0x40edd0))['catch'](handleError(_0x13e6e6,null));};exports[_0xbe42('0x42')]=function(_0x332dfa,_0x1e3077){var _0x159b32={'raw':!![],'where':{'id':_0x332dfa[_0xbe42('0x43')]['id']}},_0x54c384={};_0x54c384[_0xbe42('0x30')]=_['keys'](db[_0xbe42('0x2b')]['rawAttributes']);_0x54c384['query']=_[_0xbe42('0x32')](_0x332dfa[_0xbe42('0x31')]);_0x54c384[_0xbe42('0x33')]=_[_0xbe42('0x34')](_0x54c384['model'],_0x54c384[_0xbe42('0x31')]);_0x159b32[_0xbe42('0x35')]=_['intersection'](_0x54c384[_0xbe42('0x30')],qs[_0xbe42('0x36')](_0x332dfa[_0xbe42('0x31')][_0xbe42('0x36')]));_0x159b32[_0xbe42('0x35')]=_0x159b32[_0xbe42('0x35')][_0xbe42('0x44')]?_0x159b32[_0xbe42('0x35')]:_0x54c384[_0xbe42('0x30')];if(_0x332dfa[_0xbe42('0x31')][_0xbe42('0x45')]){_0x159b32[_0xbe42('0x40')]=[{'all':!![]}];}_0x159b32=_[_0xbe42('0x3e')]({},_0x159b32,_0x332dfa[_0xbe42('0x46')]);return db[_0xbe42('0x2b')][_0xbe42('0x47')](_0x159b32)['then'](handleEntityNotFound(_0x1e3077,null))[_0xbe42('0x24')](respondWithResult(_0x1e3077,null))[_0xbe42('0x48')](handleError(_0x1e3077,null));};exports[_0xbe42('0x49')]=function(_0x1401a4,_0x2b109e){var _0x25c115={'where':{'id':_0x1401a4[_0xbe42('0x43')]['id']}},_0x4da8e5={};_0x4da8e5['model']=_[_0xbe42('0x32')](db[_0xbe42('0x2b')][_0xbe42('0x2c')]);_0x25c115[_0xbe42('0x35')]=_[_0xbe42('0x34')](_0x4da8e5[_0xbe42('0x30')],qs['fields'](_0x1401a4['query'][_0xbe42('0x36')]));_0x25c115['attributes']=_0x25c115['attributes'][_0xbe42('0x44')]?_0x25c115[_0xbe42('0x35')]:_0x4da8e5['model'];if(_0x1401a4[_0xbe42('0x31')][_0xbe42('0x45')]){_0x25c115[_0xbe42('0x40')]=[{'all':!![]}];}_0x25c115=_['merge']({},_0x25c115,_0x1401a4[_0xbe42('0x46')]);return db[_0xbe42('0x2b')][_0xbe42('0x47')](_0x25c115)[_0xbe42('0x24')](handleEntityNotFound(_0x2b109e,null))[_0xbe42('0x24')](function(_0x5afb38){if(_0x5afb38){var _0x178ca3=_0x5afb38['get']({'plain':!![]});_0x178ca3=qs[_0xbe42('0x4a')](_0x178ca3,['id',_0xbe42('0x4b'),'updatedAt']);_0x1401a4[_0xbe42('0x4c')]=_['omit'](_0x1401a4[_0xbe42('0x4c')],['id',_0xbe42('0x4b'),_0xbe42('0x4d')]);return db[_0xbe42('0x2b')][_0xbe42('0x4e')](_[_0xbe42('0x3e')](_0x178ca3,_0x1401a4[_0xbe42('0x4c')]),{'include':_0x1401a4[_0xbe42('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2b109e,0xc9))[_0xbe42('0x48')](handleError(_0x2b109e,null));};exports[_0xbe42('0x22')]=function(_0x29cf34,_0x28c91){if(_0x29cf34[_0xbe42('0x4c')]['id']){delete _0x29cf34[_0xbe42('0x4c')]['id'];}return db[_0xbe42('0x2b')]['find']({'where':{'id':_0x29cf34['params']['id']}})[_0xbe42('0x24')](handleEntityNotFound(_0x28c91,null))[_0xbe42('0x24')](saveUpdates(_0x29cf34[_0xbe42('0x4c')],null))[_0xbe42('0x24')](respondWithResult(_0x28c91,null))[_0xbe42('0x48')](handleError(_0x28c91,null));};exports[_0xbe42('0x23')]=function(_0x350f04,_0x28d0fc){return db[_0xbe42('0x2b')]['find']({'where':{'id':_0x350f04[_0xbe42('0x43')]['id']}})[_0xbe42('0x24')](handleEntityNotFound(_0x28d0fc,null))['then'](removeEntity(_0x28d0fc,null))['catch'](handleError(_0x28d0fc,null));};exports['create']=function(_0x3cbed6,_0x1af1fd,_0x3b487e){_0x3cbed6[_0xbe42('0x4c')][_0xbe42('0x28')]=_0x3cbed6[_0xbe42('0x4f')][_0xbe42('0x50')];_0x3cbed6[_0xbe42('0x4c')][_0xbe42('0x51')]=_0x3cbed6[_0xbe42('0x4f')][_0xbe42('0x52')];_0x3cbed6[_0xbe42('0x4c')][_0xbe42('0x2e')]=_0x3cbed6[_0xbe42('0x4f')]['mimetype'];return db[_0xbe42('0x2b')][_0xbe42('0x4e')](_0x3cbed6['body'])[_0xbe42('0x24')](respondWithResult(_0x1af1fd,0xc9))[_0xbe42('0x48')](handleError(_0x1af1fd,null));};exports[_0xbe42('0x53')]=function(_0x16cc1b,_0x7c7f3,_0xcbdde){return db[_0xbe42('0x2b')][_0xbe42('0x54')]({'where':{'id':_0x16cc1b['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x7c7f3,null))['then'](function(_0x189fa1){if(_0x189fa1){var _0x12c692=_0x189fa1['ChatOfflineMessageId']!==null;var _0x53f449=path['join'](config[_0xbe42('0x55')],_0xbe42('0x56'));if(_0x12c692){_0x53f449=path[_0xbe42('0x57')](_0x53f449,_0xbe42('0x58'));}var _0x5a8bd3=path['join'](_0x53f449,_0x189fa1[_0xbe42('0x51')]);return _0x7c7f3[_0xbe42('0x53')](_0x5a8bd3);}})[_0xbe42('0x48')](handleError(_0x7c7f3,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4291dd0..b76ab9c 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 _0xf21f=['lodash','../../config/logger','api','moment','request-promise','path','./attachment.attributes','define','Attachment','attachments'];(function(_0x580cf8,_0x26751e){var _0xcc9a9e=function(_0x5a67ad){while(--_0x5a67ad){_0x580cf8['push'](_0x580cf8['shift']());}};_0xcc9a9e(++_0x26751e);}(_0xf21f,0x1e0));var _0xff21=function(_0x48fa3f,_0x700760){_0x48fa3f=_0x48fa3f-0x0;var _0x16037d=_0xf21f[_0x48fa3f];return _0x16037d;};'use strict';var _=require(_0xff21('0x0'));var util=require('util');var logger=require(_0xff21('0x1'))(_0xff21('0x2'));var moment=require(_0xff21('0x3'));var BPromise=require('bluebird');var rp=require(_0xff21('0x4'));var fs=require('fs');var path=require(_0xff21('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xff21('0x6'));module['exports']=function(_0x334de1,_0x18e91d){return _0x334de1[_0xff21('0x7')](_0xff21('0x8'),attributes,{'tableName':_0xff21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x932e=['moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x932e,0xb2));var _0xe932=function(_0x9efc3a,_0x52b1c1){_0x9efc3a=_0x9efc3a-0x0;var _0x350495=_0x932e[_0x9efc3a];return _0x350495;};'use strict';var _=require(_0xe932('0x0'));var util=require(_0xe932('0x1'));var logger=require(_0xe932('0x2'))(_0xe932('0x3'));var moment=require(_0xe932('0x4'));var BPromise=require('bluebird');var rp=require(_0xe932('0x5'));var fs=require('fs');var path=require(_0xe932('0x6'));var rimraf=require(_0xe932('0x7'));var config=require(_0xe932('0x8'));var attributes=require(_0xe932('0x9'));module[_0xe932('0xa')]=function(_0x105561,_0xefd47b){return _0x105561[_0xe932('0xb')](_0xe932('0xc'),attributes,{'tableName':_0xe932('0xd'),'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 c599219..91299ad 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 _0x00bb=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Attachment','body','options','then','CreateAttachment','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Attachment,\x20%s,\x20%s'];(function(_0xea583c,_0x2a89cc){var _0x13dc09=function(_0x13d269){while(--_0x13d269){_0xea583c['push'](_0xea583c['shift']());}};_0x13dc09(++_0x2a89cc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x00bb[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['CreateAttachment']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['create'](_0x2a7231[_0xb00b('0x13')],{'raw':_0x2a7231[_0xb00b('0x14')]?_0x2a7231['options']['raw']===undefined?!![]:![]:!![]})[_0xb00b('0x15')](function(_0x4a334b){logger[_0xb00b('0x9')](_0xb00b('0x16'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x16'),_0x2a7231,JSON['stringify'](_0x4a334b));_0x415f91(_0x4a334b);})[_0xb00b('0x11')](function(_0x4df284){logger[_0xb00b('0xf')](_0xb00b('0x16'),_0x4df284['message'],_0x2a7231);_0x5aa9a0(_0x599347[_0xb00b('0xf')](0x1f4,_0x4df284[_0xb00b('0x10')]));});});}; \ No newline at end of file +var _0xc5ba=['catch','CreateAttachment','Attachment','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x422d27,_0x529e20){var _0x56929a=function(_0xb45b70){while(--_0xb45b70){_0x422d27['push'](_0x422d27['shift']());}};_0x56929a(++_0x529e20);}(_0xc5ba,0xb9));var _0xac5b=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xc5ba[_0x47e93d];return _0xe86c46;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var BPromise=require(_0xac5b('0x3'));var rs=require(_0xac5b('0x4'));var fs=require('fs');var Redis=require(_0xac5b('0x5'));var db=require(_0xac5b('0x6'))['db'];var utils=require(_0xac5b('0x7'));var logger=require(_0xac5b('0x8'))(_0xac5b('0x9'));var config=require(_0xac5b('0xa'));var jayson=require(_0xac5b('0xb'));var client=jayson[_0xac5b('0xc')][_0xac5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38602a,_0xc09fbc,_0xc193a7){return new BPromise(function(_0x4a7fc7,_0x525e20){return client[_0xac5b('0xe')](_0x38602a,_0xc193a7)['then'](function(_0x3c5bd3){logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));logger[_0xac5b('0x12')](_0xac5b('0x13'),_0xc09fbc,_0xac5b('0x11'),JSON[_0xac5b('0x14')](_0x3c5bd3));if(_0x3c5bd3[_0xac5b('0x15')]){if(_0x3c5bd3['error'][_0xac5b('0x16')]===0x1f4){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x525e20(_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);}logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x4a7fc7(_0x3c5bd3[_0xac5b('0x15')]['message']);}else{logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));_0x4a7fc7(_0x3c5bd3[_0xac5b('0x18')][_0xac5b('0x17')]);}})[_0xac5b('0x19')](function(_0x363de5){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x363de5);_0x525e20(_0x363de5);});});}exports[_0xac5b('0x1a')]=function(_0x11e6fa){var _0x551ccf=this;return new Promise(function(_0x2db8d1,_0x4c46e5){return db[_0xac5b('0x1b')]['create'](_0x11e6fa[_0xac5b('0x1c')],{'raw':_0x11e6fa[_0xac5b('0x1d')]?_0x11e6fa['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3dbc5b){logger['info'](_0xac5b('0x1a'),_0x11e6fa);logger[_0xac5b('0x12')](_0xac5b('0x1a'),_0x11e6fa,JSON[_0xac5b('0x14')](_0x3dbc5b));_0x2db8d1(_0x3dbc5b);})[_0xac5b('0x19')](function(_0x5a4b94){logger['error']('CreateAttachment',_0x5a4b94[_0xac5b('0x17')],_0x11e6fa);_0x4c46e5(_0x551ccf['error'](0x1f4,_0x5a4b94[_0xac5b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f41e0db..73fa9a0 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(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x562d29,_0x288494){_0x562d29=_0x562d29-0x0;var _0x27f4d3=_0xdb28[_0x562d29];return _0x27f4d3;};'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('./attachment.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'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index f173d5e..afa4dc4 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 _0xabe7=['../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','disabled','blocked','online','admin','user','then','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x41fe92,_0x3470f7){var _0x4a3f94=function(_0x12bb47){while(--_0x12bb47){_0x41fe92['push'](_0x41fe92['shift']());}};_0x4a3f94(++_0x3470f7);}(_0xabe7,0xce));var _0x7abe=function(_0x4f5661,_0x5c63b7){_0x4f5661=_0x4f5661-0x0;var _0x3a8629=_0xabe7[_0x4f5661];return _0x3a8629;};'use strict';var passport=require(_0x7abe('0x0'));var LocalStrategy=require(_0x7abe('0x1'))[_0x7abe('0x2')];var moment=require(_0x7abe('0x3'));var ActiveDirectory=require(_0x7abe('0x4'));var BPromise=require(_0x7abe('0x5'));var util=require(_0x7abe('0x6'));var db=require(_0x7abe('0x7'))['db'];var authService=require(_0x7abe('0x8'));var utils=require(_0x7abe('0x9'));var config=require(_0x7abe('0xa'));var logger=require(_0x7abe('0xb'))(_0x7abe('0xc'));function isActiveDirectoryConfigured(_0x46fccf){var _0x28fe1b=![];if(typeof _0x46fccf[_0x7abe('0xd')]!==_0x7abe('0xe')){_0x28fe1b=_0x46fccf['activedirectory'][_0x7abe('0xf')]&&_0x46fccf[_0x7abe('0xd')][_0x7abe('0x10')]&&_0x46fccf[_0x7abe('0xd')][_0x7abe('0x11')];}return _0x28fe1b;}function adAuthenticate(_0x25e57e,_0x4ab152,_0x4b2b02){return new BPromise(function(_0x1311b1,_0x26d367){try{var _0x45de0d=new ActiveDirectory(_0x25e57e);_0x45de0d[_0x7abe('0x12')](_0x4ab152,_0x4b2b02,function(_0x3f8664,_0x1a6195){if(_0x3f8664){logger[_0x7abe('0x13')](_0x7abe('0x14'),_0x4ab152,util[_0x7abe('0x15')](_0x3f8664,{'showHidden':![],'depth':null}));_0x26d367(_0x7abe('0x16'));}else if(!_0x1a6195){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x4ab152);_0x26d367('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1311b1(_0x1a6195);}});}catch(_0x346016){_0x26d367(_0x346016);}});}function ActiveDirectoryAuthenticate(_0x4d17d5,_0x3e6063,_0x5b3af3,_0x158e12){var _0x5a8a4e,_0x346e13;if(!isActiveDirectoryConfigured(config)){logger[_0x7abe('0x13')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3e6063);return _0x158e12(null,![],{'message':_0x7abe('0x16')});}return db[_0x7abe('0x17')]['findOne']({'where':{'id':0x1},'attributes':[_0x7abe('0x18'),_0x7abe('0x19')],'raw':!![]})['then'](function(_0x1f02fc){_0x5a8a4e=_0x1f02fc;if(!_0x5a8a4e[_0x7abe('0x18')]){logger[_0x7abe('0x13')](_0x7abe('0x1a'),_0x3e6063);throw new Error(_0x7abe('0x16'));}return _0x4d17d5[_0x7abe('0x1b')]({'attributes':['id',_0x7abe('0x1c'),_0x7abe('0x1d'),_0x7abe('0x1e'),'role',_0x7abe('0x1f'),_0x7abe('0x20'),'blockedAt',_0x7abe('0x21')],'where':{'name':_0x3e6063,'role':{'$or':[_0x7abe('0x22'),_0x7abe('0x23'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x3519ab){if(!_0x3519ab||_0x3519ab&&_0x3519ab['name']!==_0x3e6063){throw new Error(_0x7abe('0x16'));}_0x346e13=_0x3519ab;var _0x32cc56=_0x346e13['name']+'@'+config[_0x7abe('0xd')][_0x7abe('0x11')];return adAuthenticate(config[_0x7abe('0xd')],_0x32cc56,_0x5b3af3);})[_0x7abe('0x24')](function(_0x1f1824){if(_0x346e13['disabled']){throw new Error(_0x7abe('0x16'));}if(_0x5a8a4e[_0x7abe('0x19')]>0x0){if(_0x346e13['blocked']){if(moment(_0x346e13[_0x7abe('0x25')])[_0x7abe('0x26')](_0x5a8a4e[_0x7abe('0x19')],_0x7abe('0x27'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x7abe('0x28')](_0x346e13,0x0,![],null)[_0x7abe('0x24')](function(){return utils[_0x7abe('0x29')](_0x346e13);})['then'](function(){return _0x158e12(null,_0x346e13);});}else{return utils[_0x7abe('0x29')](_0x346e13)['then'](function(){return _0x158e12(null,_0x346e13);});}}else{return utils[_0x7abe('0x29')](_0x346e13)[_0x7abe('0x24')](function(){return _0x158e12(null,_0x346e13);});}})[_0x7abe('0x2a')](function(_0x59a45f){return _0x158e12(null,![],_0x59a45f);});}function handleError(_0x552162,_0x575962,_0x946a2e){return _0x552162[_0x7abe('0x2b')](_0x575962||0x1f4)[_0x7abe('0x2c')]({'message':_0x946a2e?_0x946a2e[_0x7abe('0x2d')]||_0x946a2e:''});}exports[_0x7abe('0x2e')]=function(_0x1dffab,_0x2b217e,_0x4d450d){passport['authenticate']('ad-login',function(_0x4f3c3d,_0x526bd4,_0x242b5d){var _0x5bf489=_0x4f3c3d||_0x242b5d;if(_0x5bf489){return handleError(_0x2b217e,0x191,_0x5bf489);}if(!_0x526bd4){return handleError(_0x2b217e,0x194,{'message':_0x7abe('0x2f')});}else{var _0x12df0a={'payload':{'id':_0x526bd4['id'],'role':_0x526bd4[_0x7abe('0x30')]},'options':{'expiresIn':0x15180}};return authService[_0x7abe('0x31')](_0x12df0a)[_0x7abe('0x24')](function(_0x152c0c){_0x2b217e[_0x7abe('0x32')]({'id':_0x526bd4['id'],'token':_0x152c0c,'statusCall':'','isAlreadyLogged':_0x526bd4['online']});});}})(_0x1dffab,_0x2b217e,_0x4d450d);};passport[_0x7abe('0x33')](_0x7abe('0x34'),new LocalStrategy({'usernameField':_0x7abe('0x1c'),'passwordField':_0x7abe('0x1d')},function(_0x4c4289,_0x51c92b,_0x4124a1){return ActiveDirectoryAuthenticate(db[_0x7abe('0x35')],_0x4c4289,_0x51c92b,_0x4124a1);})); \ No newline at end of file +var _0x5655=['undefined','activedirectory','baseDN','url','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','admin','user','name','domain','add','minutes','getLicense','catch','status','login','authenticate','json','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../components/auth/service','../../config/environment','../../config/logger','api'];(function(_0x5195dc,_0x542fe5){var _0x4440bc=function(_0x514214){while(--_0x514214){_0x5195dc['push'](_0x5195dc['shift']());}};_0x4440bc(++_0x542fe5);}(_0x5655,0x15e));var _0x5565=function(_0x5b3ff2,_0x3ae4d1){_0x5b3ff2=_0x5b3ff2-0x0;var _0xe269cc=_0x5655[_0x5b3ff2];return _0xe269cc;};'use strict';var passport=require(_0x5565('0x0'));var LocalStrategy=require(_0x5565('0x1'))[_0x5565('0x2')];var moment=require(_0x5565('0x3'));var ActiveDirectory=require(_0x5565('0x4'));var BPromise=require(_0x5565('0x5'));var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0x5565('0x6'));var utils=require('../../config/utils');var config=require(_0x5565('0x7'));var logger=require(_0x5565('0x8'))(_0x5565('0x9'));function isActiveDirectoryConfigured(_0x93a8e5){var _0x106d59=![];if(typeof _0x93a8e5['activedirectory']!==_0x5565('0xa')){_0x106d59=_0x93a8e5[_0x5565('0xb')][_0x5565('0xc')]&&_0x93a8e5[_0x5565('0xb')][_0x5565('0xd')]&&_0x93a8e5[_0x5565('0xb')]['domain'];}return _0x106d59;}function adAuthenticate(_0x581dca,_0x367ce8,_0x52db0e){return new BPromise(function(_0x498370,_0x35254d){try{var _0xa0936e=new ActiveDirectory(_0x581dca);_0xa0936e['authenticate'](_0x367ce8,_0x52db0e,function(_0x5670c8,_0x7c79a2){if(_0x5670c8){logger[_0x5565('0xe')](_0x5565('0xf'),_0x367ce8,util[_0x5565('0x10')](_0x5670c8,{'showHidden':![],'depth':null}));_0x35254d(_0x5565('0x11'));}else if(!_0x7c79a2){logger[_0x5565('0xe')](_0x5565('0x12'),_0x367ce8);_0x35254d(_0x5565('0x11'));}else{_0x498370(_0x7c79a2);}});}catch(_0x553b26){_0x35254d(_0x553b26);}});}function ActiveDirectoryAuthenticate(_0x34cd10,_0x10940e,_0x4325f3,_0x199a3c){var _0x57058d,_0x1944db;if(!isActiveDirectoryConfigured(config)){logger[_0x5565('0xe')](_0x5565('0x13'),_0x10940e);return _0x199a3c(null,![],{'message':_0x5565('0x11')});}return db[_0x5565('0x14')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x5565('0x15')],'raw':!![]})[_0x5565('0x16')](function(_0x4f56df){_0x57058d=_0x4f56df;if(!_0x57058d[_0x5565('0x17')]){logger[_0x5565('0xe')](_0x5565('0x18'),_0x10940e);throw new Error(_0x5565('0x11'));}return _0x34cd10['findOne']({'attributes':['id','name',_0x5565('0x19'),_0x5565('0x1a'),_0x5565('0x1b'),_0x5565('0x1c'),_0x5565('0x1d'),_0x5565('0x1e'),'online'],'where':{'name':_0x10940e,'role':{'$or':[_0x5565('0x1f'),_0x5565('0x20'),'agent']},'adSsoEnabled':!![]}});})[_0x5565('0x16')](function(_0x25f8c9){if(!_0x25f8c9||_0x25f8c9&&_0x25f8c9[_0x5565('0x21')]!==_0x10940e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x1944db=_0x25f8c9;var _0x33d6f0=_0x1944db['name']+'@'+config[_0x5565('0xb')][_0x5565('0x22')];return adAuthenticate(config['activedirectory'],_0x33d6f0,_0x4325f3);})['then'](function(_0x3ccdc0){if(_0x1944db[_0x5565('0x1c')]){throw new Error(_0x5565('0x11'));}if(_0x57058d['blockDuration']>0x0){if(_0x1944db['blocked']){if(moment(_0x1944db[_0x5565('0x1e')])[_0x5565('0x23')](_0x57058d['blockDuration'],_0x5565('0x24'))>moment()){throw new Error(_0x5565('0x11'));}return utils['clearBlockUser'](_0x1944db,0x0,![],null)[_0x5565('0x16')](function(){return utils['getLicense'](_0x1944db);})[_0x5565('0x16')](function(){return _0x199a3c(null,_0x1944db);});}else{return utils[_0x5565('0x25')](_0x1944db)[_0x5565('0x16')](function(){return _0x199a3c(null,_0x1944db);});}}else{return utils[_0x5565('0x25')](_0x1944db)[_0x5565('0x16')](function(){return _0x199a3c(null,_0x1944db);});}})[_0x5565('0x26')](function(_0x168f16){return _0x199a3c(null,![],_0x168f16);});}function handleError(_0x33bcb6,_0x7e9c06,_0x4bde60){return _0x33bcb6[_0x5565('0x27')](_0x7e9c06||0x1f4)['send']({'message':_0x4bde60?_0x4bde60['message']||_0x4bde60:''});}exports[_0x5565('0x28')]=function(_0x5b032c,_0x37925a,_0x392579){passport[_0x5565('0x29')]('ad-login',function(_0x55278f,_0x33765b,_0xa2e56f){var _0x14bad0=_0x55278f||_0xa2e56f;if(_0x14bad0){return handleError(_0x37925a,0x191,_0x14bad0);}if(!_0x33765b){return handleError(_0x37925a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x57997e={'payload':{'id':_0x33765b['id'],'role':_0x33765b[_0x5565('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x57997e)[_0x5565('0x16')](function(_0x5b8749){_0x37925a[_0x5565('0x2a')]({'id':_0x33765b['id'],'token':_0x5b8749,'statusCall':'','isAlreadyLogged':_0x33765b['online']});});}})(_0x5b032c,_0x37925a,_0x392579);};passport['use'](_0x5565('0x2b'),new LocalStrategy({'usernameField':_0x5565('0x21'),'passwordField':'password'},function(_0x436351,_0x1cdb32,_0x20ca59){return ActiveDirectoryAuthenticate(db[_0x5565('0x2c')],_0x436351,_0x1cdb32,_0x20ca59);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index ad6fcf8..ca16460 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 _0x28d3=['login','exports','Router','./authActiveDirectory.controller'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x28d3,0xe6));var _0x328d=function(_0x139bb4,_0x26dfad){_0x139bb4=_0x139bb4-0x0;var _0x21adb0=_0x28d3[_0x139bb4];return _0x21adb0;};'use strict';var express=require('express');var router=express[_0x328d('0x0')]();var controller=require(_0x328d('0x1'));router['post']('/',controller[_0x328d('0x2')]);module[_0x328d('0x3')]=router; \ No newline at end of file +var _0x785c=['./authActiveDirectory.controller','post','login','Router'];(function(_0x3f7fd4,_0x4b0891){var _0x4affd7=function(_0x2d8477){while(--_0x2d8477){_0x3f7fd4['push'](_0x3f7fd4['shift']());}};_0x4affd7(++_0x4b0891);}(_0x785c,0x1e3));var _0xc785=function(_0x23bc44,_0x403791){_0x23bc44=_0x23bc44-0x0;var _0x5cf3e0=_0x785c[_0x23bc44];return _0x5cf3e0;};'use strict';var express=require('express');var router=express[_0xc785('0x0')]();var controller=require(_0xc785('0x1'));router[_0xc785('0x2')]('/',controller[_0xc785('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 76ac9c5..6d30d45 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x7a54,0x106));var _0x47a5=function(_0x311308,_0x181c30){_0x311308=_0x311308-0x0;var _0x49228a=_0x7a54[_0x311308];return _0x49228a;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x7a54,0x106));var _0x47a5=function(_0x11027d,_0xb9596b){_0x11027d=_0x11027d-0x0;var _0xf6470c=_0x7a54[_0x11027d];return _0xf6470c;};'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 6244d10..ed9f413 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 _0x6157=['/callback','callback','isMiddleware','login','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x41e605,_0x194672){var _0x32978d=function(_0xf402da){while(--_0xf402da){_0x41e605['push'](_0x41e605['shift']());}};_0x32978d(++_0x194672);}(_0x6157,0xea));var _0x7615=function(_0x3288a2,_0x4ac4be){_0x3288a2=_0x3288a2-0x0;var _0x319f4a=_0x6157[_0x3288a2];return _0x319f4a;};'use strict';var express=require('express');var passport=require(_0x7615('0x0'));var router=express[_0x7615('0x1')]();var controller=require(_0x7615('0x2'));var userController=require(_0x7615('0x3'));var authService=require(_0x7615('0x4'));router['get']('/',controller['login']);router[_0x7615('0x5')](_0x7615('0x6'),controller[_0x7615('0x7')],authService[_0x7615('0x8')],userController[_0x7615('0x9')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x7bea=['exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','setTokenCookie'];(function(_0xc5ff46,_0x341aaa){var _0x311345=function(_0x1c47c6){while(--_0x1c47c6){_0xc5ff46['push'](_0xc5ff46['shift']());}};_0x311345(++_0x341aaa);}(_0x7bea,0xe5));var _0xa7be=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x7bea[_0x90a39a];return _0x2b62f7;};'use strict';var express=require(_0xa7be('0x0'));var passport=require(_0xa7be('0x1'));var router=express[_0xa7be('0x2')]();var controller=require(_0xa7be('0x3'));var userController=require(_0xa7be('0x4'));var authService=require(_0xa7be('0x5'));router['get']('/',controller[_0xa7be('0x6')]);router[_0xa7be('0x7')](_0xa7be('0x8'),controller[_0xa7be('0x9')],authService['isMiddleware'],userController['login'],authService[_0xa7be('0xa')]);module[_0xa7be('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 89b3db8..09a0c23 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 _0x0312=['../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','minutes','getLicense','catch','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','login','local-login','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordHistory','save','util','passport-local','Strategy','lodash'];(function(_0x5a788a,_0x2b2a5b){var _0x37d0e4=function(_0x135f60){while(--_0x135f60){_0x5a788a['push'](_0x5a788a['shift']());}};_0x37d0e4(++_0x2b2a5b);}(_0x0312,0xd4));var _0x2031=function(_0x351f60,_0x513731){_0x351f60=_0x351f60-0x0;var _0x557fac=_0x0312[_0x351f60];return _0x557fac;};'use strict';var util=require(_0x2031('0x0'));var passport=require('passport');var LocalStrategy=require(_0x2031('0x1'))[_0x2031('0x2')];var jayson=require('jayson/promise');var _=require(_0x2031('0x3'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x2031('0x4'));var utils=require(_0x2031('0x5'));var client=jayson['client'][_0x2031('0x6')]({'port':0x232b});function localAuthenticate(_0x76470d,_0x1e490e,_0x3478ff,_0x54e30e){var _0x312e60,_0x3f8065;return db[_0x2031('0x7')][_0x2031('0x8')]({'where':{'id':0x1},'attributes':[_0x2031('0x9'),_0x2031('0xa')],'raw':!![]})[_0x2031('0xb')](function(_0xadc601){_0x312e60=_0xadc601;return _0x76470d['findOne']({'attributes':['id',_0x2031('0xc'),_0x2031('0xd'),_0x2031('0xe'),_0x2031('0xf'),_0x2031('0x10'),_0x2031('0x11'),_0x2031('0x12'),_0x2031('0x13')],'where':{'name':_0x1e490e,'role':{'$or':['admin',_0x2031('0x14'),_0x2031('0x15')]}}});})['then'](function(_0x19732a){if(!_0x19732a||_0x19732a&&_0x19732a['name']!==_0x1e490e){throw new Error(_0x2031('0x16'));}else{_0x3f8065=_0x19732a;return _0x3f8065;}})[_0x2031('0xb')](function(){_0x3f8065[_0x2031('0x17')](_0x3478ff,function(_0xd00923,_0x316d16){var _0x3612b2=_0x3f8065[_0x2031('0x13')]+0x1;if(_0xd00923){return _0x54e30e(_0xd00923);}else if(!_0x316d16){if(_0x3f8065[_0x2031('0x10')]){return _0x54e30e(null,![],{'message':_0x2031('0x16')});}else if(_0x312e60[_0x2031('0x9')]>0x0){if(_0x3f8065[_0x2031('0x11')]){if(_0x312e60[_0x2031('0xa')]>0x0){if(moment(_0x3f8065[_0x2031('0x12')])[_0x2031('0x18')](_0x312e60[_0x2031('0xa')],'minutes')>moment()){return _0x54e30e(null,![],{'message':_0x2031('0x16')});}else{return utils['clearBlockUser'](_0x3f8065,_0x3612b2,![],null)[_0x2031('0xb')](function(){return _0x54e30e(null,![],{'message':_0x2031('0x16')});});}}else{return _0x54e30e(null,![],{'message':_0x2031('0x16')});}}else{if(_0x3612b2>=_0x312e60[_0x2031('0x9')]){return utils['clearBlockUser'](_0x3f8065,0x0,!![],moment())[_0x2031('0xb')](function(){return _0x54e30e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x2031('0x19')](_0x3f8065,_0x3612b2,![],null)[_0x2031('0xb')](function(){return _0x54e30e(null,![],{'message':_0x2031('0x16')});});}}}else{return _0x54e30e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3f8065[_0x2031('0x10')]){return _0x54e30e(null,![],{'message':_0x2031('0x16')});}else if(_0x312e60['allowedLoginAttempts']>0x0){if(_0x3f8065[_0x2031('0x11')]){if(_0x312e60['blockDuration']>0x0){if(moment(_0x3f8065[_0x2031('0x12')])['add'](_0x312e60[_0x2031('0xa')],_0x2031('0x1a'))>moment()){return _0x54e30e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2031('0x19')](_0x3f8065,0x0,![],null)[_0x2031('0xb')](function(){return utils[_0x2031('0x1b')](_0x3f8065);})[_0x2031('0xb')](function(){return _0x54e30e(null,_0x3f8065);});}}else{return _0x54e30e(null,![],{'message':_0x2031('0x16')});}}else{return utils[_0x2031('0x19')](_0x3f8065,0x0,![],null)[_0x2031('0xb')](function(){return utils[_0x2031('0x1b')](_0x3f8065);})[_0x2031('0xb')](function(){return _0x54e30e(null,_0x3f8065);})[_0x2031('0x1c')](function(_0x245a59){return _0x54e30e(null,![],_0x245a59);});}}else{if(_0x3f8065[_0x2031('0x11')]){return _0x54e30e(null,![],{'message':_0x2031('0x16')});}else{return utils[_0x2031('0x1b')](_0x3f8065)[_0x2031('0xb')](function(){return _0x54e30e(null,_0x3f8065);});}}}});})[_0x2031('0x1c')](function(_0x485878){return _0x54e30e(null,![],_0x485878);});}function sendServiceMail(_0x22ff8d){return db['MailAccount'][_0x2031('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x2031('0xc'),_0x2031('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x2031('0x1f'),'include':[{'model':db[_0x2031('0x20')],'as':_0x2031('0x20')}]}]})[_0x2031('0xb')](function(_0x2f7743){if(!_0x2f7743){throw new Error(_0x2031('0x21'));}var _0x58a3a5=_0x2f7743['getSmtpOptions']();var _0x128b5f={'account':_0x58a3a5,'message':_[_0x2031('0x22')]({'from':util['format'](_0x2031('0x23'),_0x2f7743[_0x2031('0xc')],_0x2f7743[_0x2031('0x1e')]||_0x2f7743[_0x2031('0x1f')][_0x2031('0x14')])},_0x22ff8d)};return client[_0x2031('0x24')](_0x2031('0x25'),_0x128b5f);})['then'](function(_0x55d781){if(_0x55d781[_0x2031('0x26')]){throw new Error(util[_0x2031('0x27')](_0x2031('0x28'),_0x55d781[_0x2031('0x26')]['message']||JSON['stringify'](_0x55d781[_0x2031('0x26')])));}return!![];});}function handleError(_0x4b198c,_0x2159a5,_0x3f6c1b){return _0x4b198c[_0x2031('0x29')](_0x2159a5||0x1f4)[_0x2031('0x2a')]({'message':_0x3f6c1b?_0x3f6c1b['message']||_0x3f6c1b:''});}exports[_0x2031('0x2b')]=function(_0x29a7e5,_0x4e7dec,_0x56c0ab){passport['authenticate'](_0x2031('0x2c'),function(_0x395f22,_0x53470b,_0x4d5c0a){var _0x8a9027=_0x395f22||_0x4d5c0a;if(_0x8a9027){return handleError(_0x4e7dec,0x191,_0x8a9027);}if(!_0x53470b){return handleError(_0x4e7dec,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1ec8be={'payload':{'id':_0x53470b['id'],'role':_0x53470b[_0x2031('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x2031('0x2d')](_0x1ec8be)[_0x2031('0xb')](function(_0xfb706c){_0x4e7dec[_0x2031('0x2e')]({'id':_0x53470b['id'],'token':_0xfb706c,'statusCall':'','isAlreadyLogged':_0x53470b[_0x2031('0x2f')]});});}})(_0x29a7e5,_0x4e7dec,_0x56c0ab);};exports['forgot']=function(_0x189bb5,_0x43976b){if(!_0x189bb5[_0x2031('0x30')]['email']){return handleError(_0x43976b,0x1f4,{'message':_0x2031('0x31')});}var _0x551cfc=rs[_0x2031('0x32')]();_0x189bb5[_0x2031('0x30')][_0x2031('0x1e')]=_0x189bb5[_0x2031('0x30')][_0x2031('0x1e')]['trim']()[_0x2031('0x33')]();var _0x21495f;return db[_0x2031('0x7')][_0x2031('0x8')]({'where':{'id':0x1},'attributes':[_0x2031('0x9'),_0x2031('0xa')],'raw':!![]})['then'](function(_0x421733){_0x21495f=_0x421733;return db[_0x2031('0x34')][_0x2031('0x1d')]({'where':{'email':_0x189bb5['body']['email']}});})[_0x2031('0xb')](function(_0x18888a){if(!_0x18888a){throw new Error(_0x2031('0x35'));}if(_0x18888a[_0x2031('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x18888a['blocked']){if(moment(_0x18888a[_0x2031('0x12')])[_0x2031('0x18')](_0x21495f[_0x2031('0xa')],'minutes')>moment()){throw new Error(_0x2031('0x36'));}else{_0x18888a[_0x2031('0x11')]=![];_0x18888a[_0x2031('0x12')]=null;}}_0x18888a[_0x2031('0x37')]=_0x551cfc;_0x18888a[_0x2031('0x38')]=Date[_0x2031('0x39')]()+0x36ee80;return _0x18888a['save']();})['then'](function(){return sendServiceMail({'to':_0x189bb5['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x2031('0x3a')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x2031('0x3b')+_0x189bb5['headers'][_0x2031('0x3c')]+_0x2031('0x3d')+_0x551cfc+'\x0a\x0a'+_0x2031('0x3e')});})['then'](function(){_0x43976b[_0x2031('0x29')](0xc8)[_0x2031('0x2a')]({'message':_0x2031('0x3f')});})[_0x2031('0x1c')](function(_0x10be72){return handleError(_0x43976b,0x1f4,_0x10be72);});};exports[_0x2031('0x40')]=function(_0x17049d,_0x24734a){return db[_0x2031('0x34')][_0x2031('0x1d')]({'where':{'resetPasswordToken':_0x17049d[_0x2031('0x41')][_0x2031('0x42')],'resetPasswordExpires':{'$gt':Date[_0x2031('0x39')]()}}})[_0x2031('0xb')](function(_0xc607fa){if(!_0xc607fa){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x2031('0x8')]({'attributes':['id','securePassword',_0x2031('0x43'),_0x2031('0x44')]})[_0x2031('0xb')](function(_0x36e417){if(_0x36e417[_0x2031('0x45')])authService['validatePasswordPattern'](_0x17049d[_0x2031('0x30')][_0x2031('0xd')]);if(!_0x36e417[_0x2031('0x43')]||!_0xc607fa['previousPasswords'])return _0xc607fa;authService[_0x2031('0x46')](_0x17049d[_0x2031('0x30')][_0x2031('0xd')],_0xc607fa['previousPasswords'],_0x36e417[_0x2031('0x44')]);return _0xc607fa;})[_0x2031('0xb')](function(){_0xc607fa['password']=_0x17049d[_0x2031('0x30')][_0x2031('0xd')];_0xc607fa['resetPasswordToken']=null;_0xc607fa[_0x2031('0x38')]=null;return _0xc607fa[_0x2031('0x47')]();});})['then'](function(){_0x24734a['status'](0xc8)[_0x2031('0x2a')]({'message':'Password\x20reset!'});})[_0x2031('0x1c')](function(_0x45fc57){return handleError(_0x24734a,0x1f4,_0x45fc57);});};passport['use'](_0x2031('0x2c'),new LocalStrategy({'usernameField':_0x2031('0xc'),'passwordField':_0x2031('0xd')},function(_0xb6982c,_0x1ce38f,_0x4620c2){return localAuthenticate(db[_0x2031('0x34')],_0xb6982c,_0x1ce38f,_0x4620c2);})); \ No newline at end of file +var _0x531f=['moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','role','disabled','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','allowedLoginAttempts','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','authenticate','local-login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','randomstring'];(function(_0x4ac358,_0xc014e7){var _0x872e8=function(_0x2d5d8a){while(--_0x2d5d8a){_0x4ac358['push'](_0x4ac358['shift']());}};_0x872e8(++_0xc014e7);}(_0x531f,0x1cf));var _0xf531=function(_0x45050c,_0x2c514e){_0x45050c=_0x45050c-0x0;var _0x43be36=_0x531f[_0x45050c];return _0x43be36;};'use strict';var util=require(_0xf531('0x0'));var passport=require('passport');var LocalStrategy=require(_0xf531('0x1'))[_0xf531('0x2')];var jayson=require(_0xf531('0x3'));var _=require('lodash');var rs=require(_0xf531('0x4'));var moment=require(_0xf531('0x5'));var db=require(_0xf531('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf531('0x7'));var client=jayson[_0xf531('0x8')][_0xf531('0x9')]({'port':0x232b});function localAuthenticate(_0x23df96,_0x361ffe,_0x4ca0e3,_0x369339){var _0x15523c,_0x5d0ab3;return db[_0xf531('0xa')][_0xf531('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf531('0xc')],'raw':!![]})[_0xf531('0xd')](function(_0x5cec98){_0x15523c=_0x5cec98;return _0x23df96[_0xf531('0xb')]({'attributes':['id',_0xf531('0xe'),_0xf531('0xf'),'salt',_0xf531('0x10'),_0xf531('0x11'),'blocked',_0xf531('0x12'),_0xf531('0x13')],'where':{'name':_0x361ffe,'role':{'$or':['admin',_0xf531('0x14'),_0xf531('0x15')]}}});})[_0xf531('0xd')](function(_0x54b678){if(!_0x54b678||_0x54b678&&_0x54b678[_0xf531('0xe')]!==_0x361ffe){throw new Error(_0xf531('0x16'));}else{_0x5d0ab3=_0x54b678;return _0x5d0ab3;}})['then'](function(){_0x5d0ab3['authenticate'](_0x4ca0e3,function(_0x501d49,_0x1e4232){var _0x1737b8=_0x5d0ab3[_0xf531('0x13')]+0x1;if(_0x501d49){return _0x369339(_0x501d49);}else if(!_0x1e4232){if(_0x5d0ab3[_0xf531('0x11')]){return _0x369339(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x15523c['allowedLoginAttempts']>0x0){if(_0x5d0ab3[_0xf531('0x17')]){if(_0x15523c[_0xf531('0xc')]>0x0){if(moment(_0x5d0ab3[_0xf531('0x12')])[_0xf531('0x18')](_0x15523c[_0xf531('0xc')],_0xf531('0x19'))>moment()){return _0x369339(null,![],{'message':_0xf531('0x16')});}else{return utils['clearBlockUser'](_0x5d0ab3,_0x1737b8,![],null)[_0xf531('0xd')](function(){return _0x369339(null,![],{'message':_0xf531('0x16')});});}}else{return _0x369339(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1737b8>=_0x15523c[_0xf531('0x1a')]){return utils[_0xf531('0x1b')](_0x5d0ab3,0x0,!![],moment())[_0xf531('0xd')](function(){return _0x369339(null,![],{'message':_0xf531('0x16')});});}else{return utils[_0xf531('0x1b')](_0x5d0ab3,_0x1737b8,![],null)[_0xf531('0xd')](function(){return _0x369339(null,![],{'message':_0xf531('0x16')});});}}}else{return _0x369339(null,![],{'message':_0xf531('0x16')});}}else{if(_0x5d0ab3[_0xf531('0x11')]){return _0x369339(null,![],{'message':_0xf531('0x16')});}else if(_0x15523c['allowedLoginAttempts']>0x0){if(_0x5d0ab3['blocked']){if(_0x15523c[_0xf531('0xc')]>0x0){if(moment(_0x5d0ab3[_0xf531('0x12')])[_0xf531('0x18')](_0x15523c[_0xf531('0xc')],_0xf531('0x19'))>moment()){return _0x369339(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf531('0x1b')](_0x5d0ab3,0x0,![],null)[_0xf531('0xd')](function(){return utils[_0xf531('0x1c')](_0x5d0ab3);})['then'](function(){return _0x369339(null,_0x5d0ab3);});}}else{return _0x369339(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xf531('0x1b')](_0x5d0ab3,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5d0ab3);})[_0xf531('0xd')](function(){return _0x369339(null,_0x5d0ab3);})[_0xf531('0x1d')](function(_0x3b1def){return _0x369339(null,![],_0x3b1def);});}}else{if(_0x5d0ab3[_0xf531('0x17')]){return _0x369339(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf531('0x1c')](_0x5d0ab3)[_0xf531('0xd')](function(){return _0x369339(null,_0x5d0ab3);});}}}});})[_0xf531('0x1d')](function(_0x19eb5b){return _0x369339(null,![],_0x19eb5b);});}function sendServiceMail(_0x16ebcd){return db[_0xf531('0x1e')][_0xf531('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xf531('0xe'),_0xf531('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xf531('0x21'),'include':[{'model':db['CloudProvider'],'as':_0xf531('0x22')}]}]})[_0xf531('0xd')](function(_0x196491){if(!_0x196491){throw new Error(_0xf531('0x23'));}var _0x2883e9=_0x196491['getSmtpOptions']();var _0x249264={'account':_0x2883e9,'message':_[_0xf531('0x24')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x196491[_0xf531('0xe')],_0x196491[_0xf531('0x20')]||_0x196491['Smtp']['user'])},_0x16ebcd)};return client[_0xf531('0x25')]('SendMail',_0x249264);})[_0xf531('0xd')](function(_0x1df4fa){if(_0x1df4fa[_0xf531('0x26')]){throw new Error(util[_0xf531('0x27')](_0xf531('0x28'),_0x1df4fa[_0xf531('0x26')]['message']||JSON[_0xf531('0x29')](_0x1df4fa['error'])));}return!![];});}function handleError(_0xba1d9e,_0x2433b0,_0x6acd70){return _0xba1d9e[_0xf531('0x2a')](_0x2433b0||0x1f4)[_0xf531('0x2b')]({'message':_0x6acd70?_0x6acd70[_0xf531('0x2c')]||_0x6acd70:''});}exports[_0xf531('0x2d')]=function(_0x10edc7,_0xfe8635,_0x48adf4){passport[_0xf531('0x2e')](_0xf531('0x2f'),function(_0x14625e,_0x4fce47,_0xe12d2a){var _0xce2968=_0x14625e||_0xe12d2a;if(_0xce2968){return handleError(_0xfe8635,0x191,_0xce2968);}if(!_0x4fce47){return handleError(_0xfe8635,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x27ccc5={'payload':{'id':_0x4fce47['id'],'role':_0x4fce47['role']},'options':{'expiresIn':0x15180}};return authService[_0xf531('0x30')](_0x27ccc5)[_0xf531('0xd')](function(_0x5bcb11){_0xfe8635[_0xf531('0x31')]({'id':_0x4fce47['id'],'token':_0x5bcb11,'statusCall':'','isAlreadyLogged':_0x4fce47[_0xf531('0x32')]});});}})(_0x10edc7,_0xfe8635,_0x48adf4);};exports[_0xf531('0x33')]=function(_0x461042,_0x34107a){if(!_0x461042[_0xf531('0x34')][_0xf531('0x20')]){return handleError(_0x34107a,0x1f4,{'message':_0xf531('0x35')});}var _0x10d9da=rs[_0xf531('0x36')]();_0x461042[_0xf531('0x34')][_0xf531('0x20')]=_0x461042['body'][_0xf531('0x20')]['trim']()['toLowerCase']();var _0x53cb1b;return db[_0xf531('0xa')][_0xf531('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf531('0xc')],'raw':!![]})[_0xf531('0xd')](function(_0x303292){_0x53cb1b=_0x303292;return db[_0xf531('0x37')][_0xf531('0x1f')]({'where':{'email':_0x461042[_0xf531('0x34')][_0xf531('0x20')]}});})[_0xf531('0xd')](function(_0x11557c){if(!_0x11557c){throw new Error(_0xf531('0x38'));}if(_0x11557c['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x11557c[_0xf531('0x17')]){if(moment(_0x11557c[_0xf531('0x12')])[_0xf531('0x18')](_0x53cb1b[_0xf531('0xc')],'minutes')>moment()){throw new Error(_0xf531('0x39'));}else{_0x11557c[_0xf531('0x17')]=![];_0x11557c[_0xf531('0x12')]=null;}}_0x11557c[_0xf531('0x3a')]=_0x10d9da;_0x11557c['resetPasswordExpires']=Date[_0xf531('0x3b')]()+0x36ee80;return _0x11557c[_0xf531('0x3c')]();})[_0xf531('0xd')](function(){return sendServiceMail({'to':_0x461042[_0xf531('0x34')][_0xf531('0x20')],'subject':_0xf531('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xf531('0x3e')+_0xf531('0x3f')+_0x461042['headers'][_0xf531('0x40')]+_0xf531('0x41')+_0x10d9da+'\x0a\x0a'+_0xf531('0x42')});})[_0xf531('0xd')](function(){_0x34107a[_0xf531('0x2a')](0xc8)['send']({'message':_0xf531('0x43')});})[_0xf531('0x1d')](function(_0x1e28e0){return handleError(_0x34107a,0x1f4,_0x1e28e0);});};exports[_0xf531('0x44')]=function(_0x3ea02a,_0x50249a){return db[_0xf531('0x37')][_0xf531('0x1f')]({'where':{'resetPasswordToken':_0x3ea02a['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xf531('0x3b')]()}}})['then'](function(_0x392999){if(!_0x392999){throw new Error(_0xf531('0x45'));}return db[_0xf531('0xa')]['findOne']({'attributes':['id',_0xf531('0x46'),_0xf531('0x47'),_0xf531('0x48')]})['then'](function(_0x33172c){if(_0x33172c[_0xf531('0x46')])authService[_0xf531('0x49')](_0x3ea02a[_0xf531('0x34')][_0xf531('0xf')]);if(!_0x33172c[_0xf531('0x47')]||!_0x392999['previousPasswords'])return _0x392999;authService[_0xf531('0x4a')](_0x3ea02a[_0xf531('0x34')]['password'],_0x392999['previousPasswords'],_0x33172c['passwordHistoryLimit']);return _0x392999;})[_0xf531('0xd')](function(){_0x392999[_0xf531('0xf')]=_0x3ea02a[_0xf531('0x34')][_0xf531('0xf')];_0x392999['resetPasswordToken']=null;_0x392999[_0xf531('0x4b')]=null;return _0x392999['save']();});})[_0xf531('0xd')](function(){_0x50249a[_0xf531('0x2a')](0xc8)[_0xf531('0x2b')]({'message':_0xf531('0x4c')});})[_0xf531('0x1d')](function(_0x267006){return handleError(_0x50249a,0x1f4,_0x267006);});};passport[_0xf531('0x4d')](_0xf531('0x2f'),new LocalStrategy({'usernameField':_0xf531('0xe'),'passwordField':_0xf531('0xf')},function(_0x2520d2,_0x568c93,_0x2ef290){return localAuthenticate(db[_0xf531('0x37')],_0x2520d2,_0x568c93,_0x2ef290);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 257993a..67b9a64 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 _0x35d9=['reset','exports','express','Router','./authLocal.controller','login','forgot','post'];(function(_0x15615d,_0x6e3a19){var _0x31cf29=function(_0x5088e6){while(--_0x5088e6){_0x15615d['push'](_0x15615d['shift']());}};_0x31cf29(++_0x6e3a19);}(_0x35d9,0x1ba));var _0x935d=function(_0x2285a0,_0x33910f){_0x2285a0=_0x2285a0-0x0;var _0x181882=_0x35d9[_0x2285a0];return _0x181882;};'use strict';var express=require(_0x935d('0x0'));var router=express[_0x935d('0x1')]();var controller=require(_0x935d('0x2'));router['post']('/',controller[_0x935d('0x3')]);router['post']('/forgot',controller[_0x935d('0x4')]);router[_0x935d('0x5')]('/reset/:token',controller[_0x935d('0x6')]);module[_0x935d('0x7')]=router; \ No newline at end of file +var _0x9912=['exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','reset'];(function(_0x56ffcf,_0xd89c95){var _0x2b6f29=function(_0x8a524c){while(--_0x8a524c){_0x56ffcf['push'](_0x56ffcf['shift']());}};_0x2b6f29(++_0xd89c95);}(_0x9912,0x1e7));var _0x2991=function(_0x2b12dc,_0x451af8){_0x2b12dc=_0x2b12dc-0x0;var _0xf8cf46=_0x9912[_0x2b12dc];return _0xf8cf46;};'use strict';var express=require(_0x2991('0x0'));var router=express[_0x2991('0x1')]();var controller=require(_0x2991('0x2'));router[_0x2991('0x3')]('/',controller[_0x2991('0x4')]);router['post'](_0x2991('0x5'),controller[_0x2991('0x6')]);router[_0x2991('0x3')]('/reset/:token',controller[_0x2991('0x7')]);module[_0x2991('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 281c672..d03433b 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 _0xa994=['exports','STRING'];(function(_0x523d79,_0x158546){var _0x5dfe1f=function(_0x4535ef){while(--_0x4535ef){_0x523d79['push'](_0x523d79['shift']());}};_0x5dfe1f(++_0x158546);}(_0xa994,0xac));var _0x4a99=function(_0x1ca3c6,_0x24f664){_0x1ca3c6=_0x1ca3c6-0x0;var _0x4651c7=_0xa994[_0x1ca3c6];return _0x4651c7;};'use strict';var Sequelize=require('sequelize');module[_0x4a99('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x4a99('0x1')]},'description':{'type':Sequelize[_0x4a99('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x1bea=['STRING','BOOLEAN','INTEGER'];(function(_0x392c3b,_0x5a517d){var _0x2524f0=function(_0x4f59be){while(--_0x4f59be){_0x392c3b['push'](_0x392c3b['shift']());}};_0x2524f0(++_0x5a517d);}(_0x1bea,0x8a));var _0xa1be=function(_0x486e64,_0x1e1eb2){_0x486e64=_0x486e64-0x0;var _0x404b49=_0x1bea[_0x486e64];return _0x404b49;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa1be('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xa1be('0x0')]},'description':{'type':Sequelize[_0xa1be('0x0')]},'status':{'type':Sequelize[_0xa1be('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa1be('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 5f28be4..6eaccda 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 _0x6088=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','Automation','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','body','find','addConditions','Condition','ids','omit','getConditions','order','Action','addActions','getActions','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto'];(function(_0x224c89,_0x18d0e1){var _0x1d3618=function(_0x4dae01){while(--_0x4dae01){_0x224c89['push'](_0x224c89['shift']());}};_0x1d3618(++_0x18d0e1);}(_0x6088,0x180));var _0x8608=function(_0x35a96c,_0x4ccc18){_0x35a96c=_0x35a96c-0x0;var _0x408f1f=_0x6088[_0x35a96c];return _0x408f1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8608('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8608('0x1'));var rp=require('request-promise');var moment=require(_0x8608('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8608('0x3'));var util=require(_0x8608('0x4'));var path=require(_0x8608('0x5'));var sox=require(_0x8608('0x6'));var csv=require('to-csv');var ejs=require(_0x8608('0x7'));var fs=require('fs');var fs_extra=require(_0x8608('0x8'));var _=require('lodash');var squel=require(_0x8608('0x9'));var crypto=require(_0x8608('0xa'));var jsforce=require(_0x8608('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8608('0xc'));var Papa=require(_0x8608('0xd'));var Redis=require(_0x8608('0xe'));var authService=require(_0x8608('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8608('0x10'));var hardwareService=require(_0x8608('0x11'));var logger=require(_0x8608('0x12'))(_0x8608('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e88dc,_0x50f117){_0x50f117=_0x50f117||0xcc;return function(_0x3cf5b4){if(_0x3cf5b4){return _0x1e88dc[_0x8608('0x14')](_0x50f117);}return _0x1e88dc['status'](_0x50f117)[_0x8608('0x15')]();};}function respondWithResult(_0x4b560d,_0x2410f4){_0x2410f4=_0x2410f4||0xc8;return function(_0x560c27){if(_0x560c27){return _0x4b560d[_0x8608('0x16')](_0x2410f4)[_0x8608('0x17')](_0x560c27);}};}function respondWithFilteredResult(_0x3ab624,_0xd7361d){return function(_0x4c256b){if(_0x4c256b){var _0x5acaba=typeof _0xd7361d[_0x8608('0x18')]===_0x8608('0x19')&&typeof _0xd7361d[_0x8608('0x1a')]===_0x8608('0x19');var _0x2f378e=_0x4c256b[_0x8608('0x1b')];var _0x70fbc8=_0x5acaba?0x0:_0xd7361d[_0x8608('0x18')];var _0x5b1071=_0x5acaba?_0x4c256b[_0x8608('0x1b')]:_0xd7361d[_0x8608('0x18')]+_0xd7361d[_0x8608('0x1a')];var _0x4adb17;if(_0x5b1071>=_0x2f378e){_0x5b1071=_0x2f378e;_0x4adb17=0xc8;}else{_0x4adb17=0xce;}_0x3ab624[_0x8608('0x16')](_0x4adb17);return _0x3ab624['set'](_0x8608('0x1c'),_0x70fbc8+'-'+_0x5b1071+'/'+_0x2f378e)[_0x8608('0x17')](_0x4c256b);}return null;};}function patchUpdates(_0xfd758a){return function(_0x14f6c5){try{jsonpatch['apply'](_0x14f6c5,_0xfd758a,!![]);}catch(_0x4c7364){return BPromise[_0x8608('0x1d')](_0x4c7364);}return _0x14f6c5[_0x8608('0x1e')]();};}function saveUpdates(_0x51ad18,_0x13802b){return function(_0x4e204c){if(_0x4e204c){return _0x4e204c[_0x8608('0x1f')](_0x51ad18)[_0x8608('0x20')](function(_0x4a02a3){return _0x4a02a3;});}return null;};}function removeEntity(_0x1f7fb3,_0x2ad1bd){return function(_0x519ea0){if(_0x519ea0){return _0x519ea0[_0x8608('0x21')]()[_0x8608('0x20')](function(){_0x1f7fb3[_0x8608('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c62c,_0x51ba8d){return function(_0x1b5dea){if(!_0x1b5dea){_0x16c62c['sendStatus'](0x194);}return _0x1b5dea;};}function handleError(_0x3a4607,_0x1b4c8e){_0x1b4c8e=_0x1b4c8e||0x1f4;return function(_0x3fff7c){logger[_0x8608('0x22')](_0x3fff7c[_0x8608('0x23')]);if(_0x3fff7c['name']){delete _0x3fff7c['name'];}_0x3a4607['status'](_0x1b4c8e)[_0x8608('0x24')](_0x3fff7c);};}exports[_0x8608('0x25')]=function(_0x2c0b1c,_0xf750a6){var _0x1ecc5c={},_0x32eed7={},_0x3a3699={'count':0x0,'rows':[]};var _0x530514=_[_0x8608('0x26')](db[_0x8608('0x27')]['rawAttributes'],function(_0x55d0d9){return{'name':_0x55d0d9[_0x8608('0x28')],'type':_0x55d0d9[_0x8608('0x29')]['key']};});_0x32eed7[_0x8608('0x2a')]=_['map'](_0x530514,'name');_0x32eed7['query']=_[_0x8608('0x2b')](_0x2c0b1c[_0x8608('0x2c')]);_0x32eed7[_0x8608('0x2d')]=_[_0x8608('0x2e')](_0x32eed7[_0x8608('0x2a')],_0x32eed7[_0x8608('0x2c')]);_0x1ecc5c[_0x8608('0x2f')]=_['intersection'](_0x32eed7[_0x8608('0x2a')],qs[_0x8608('0x30')](_0x2c0b1c[_0x8608('0x2c')][_0x8608('0x30')]));_0x1ecc5c['attributes']=_0x1ecc5c['attributes']['length']?_0x1ecc5c[_0x8608('0x2f')]:_0x32eed7[_0x8608('0x2a')];if(!_0x2c0b1c['query'][_0x8608('0x31')](_0x8608('0x32'))){_0x1ecc5c['limit']=qs[_0x8608('0x1a')](_0x2c0b1c['query'][_0x8608('0x1a')]);_0x1ecc5c[_0x8608('0x18')]=qs[_0x8608('0x18')](_0x2c0b1c[_0x8608('0x2c')]['offset']);}_0x1ecc5c['order']=qs[_0x8608('0x33')](_0x2c0b1c[_0x8608('0x2c')][_0x8608('0x33')]);_0x1ecc5c['where']=qs[_0x8608('0x2d')](_[_0x8608('0x34')](_0x2c0b1c['query'],_0x32eed7[_0x8608('0x2d')]),_0x530514);if(_0x2c0b1c[_0x8608('0x2c')]['filter']){_0x1ecc5c[_0x8608('0x35')]=_['merge'](_0x1ecc5c[_0x8608('0x35')],{'$or':_[_0x8608('0x26')](_0x530514,function(_0x31e88a){if(_0x31e88a[_0x8608('0x29')]!==_0x8608('0x36')){var _0x51d3a6={};_0x51d3a6[_0x31e88a[_0x8608('0x37')]]={'$like':'%'+_0x2c0b1c[_0x8608('0x2c')][_0x8608('0x38')]+'%'};return _0x51d3a6;}})});}_0x1ecc5c=_[_0x8608('0x39')]({},_0x1ecc5c,_0x2c0b1c[_0x8608('0x3a')]);var _0x5ef59f={'where':_0x1ecc5c[_0x8608('0x35')]};return db[_0x8608('0x27')][_0x8608('0x1b')](_0x5ef59f)[_0x8608('0x20')](function(_0x5060a8){_0x3a3699[_0x8608('0x1b')]=_0x5060a8;if(_0x2c0b1c[_0x8608('0x2c')][_0x8608('0x3b')]){_0x1ecc5c[_0x8608('0x3c')]=[{'all':!![]}];}return db[_0x8608('0x27')][_0x8608('0x3d')](_0x1ecc5c);})['then'](function(_0x222f5b){_0x3a3699['rows']=_0x222f5b;return _0x3a3699;})[_0x8608('0x20')](respondWithFilteredResult(_0xf750a6,_0x1ecc5c))[_0x8608('0x3e')](handleError(_0xf750a6,null));};exports[_0x8608('0x3f')]=function(_0xcf4da1,_0x4449ba){var _0x5fdd01={'raw':![],'where':{'id':_0xcf4da1[_0x8608('0x40')]['id']}},_0xbfdaeb={};_0xbfdaeb[_0x8608('0x2a')]=_[_0x8608('0x2b')](db[_0x8608('0x27')][_0x8608('0x41')]);_0xbfdaeb[_0x8608('0x2c')]=_['keys'](_0xcf4da1['query']);_0xbfdaeb[_0x8608('0x2d')]=_['intersection'](_0xbfdaeb[_0x8608('0x2a')],_0xbfdaeb[_0x8608('0x2c')]);_0x5fdd01[_0x8608('0x2f')]=_[_0x8608('0x2e')](_0xbfdaeb[_0x8608('0x2a')],qs[_0x8608('0x30')](_0xcf4da1[_0x8608('0x2c')]['fields']));_0x5fdd01[_0x8608('0x2f')]=_0x5fdd01[_0x8608('0x2f')][_0x8608('0x42')]?_0x5fdd01['attributes']:_0xbfdaeb[_0x8608('0x2a')];if(_0xcf4da1[_0x8608('0x2c')][_0x8608('0x3b')]){_0x5fdd01[_0x8608('0x3c')]=[{'all':!![]}];}_0x5fdd01=_[_0x8608('0x39')]({},_0x5fdd01,_0xcf4da1[_0x8608('0x3a')]);return db[_0x8608('0x27')]['find'](_0x5fdd01)[_0x8608('0x20')](handleEntityNotFound(_0x4449ba,null))[_0x8608('0x20')](respondWithResult(_0x4449ba,null))['catch'](handleError(_0x4449ba,null));};exports[_0x8608('0x43')]=function(_0x46f4cf,_0x5dbd28){return db[_0x8608('0x27')][_0x8608('0x43')](_0x46f4cf[_0x8608('0x44')],{})[_0x8608('0x20')](respondWithResult(_0x5dbd28,0xc9))[_0x8608('0x3e')](handleError(_0x5dbd28,null));};exports[_0x8608('0x1f')]=function(_0x4fee7c,_0x174d14){if(_0x4fee7c['body']['id']){delete _0x4fee7c[_0x8608('0x44')]['id'];}return db[_0x8608('0x27')][_0x8608('0x45')]({'where':{'id':_0x4fee7c[_0x8608('0x40')]['id']}})[_0x8608('0x20')](handleEntityNotFound(_0x174d14,null))[_0x8608('0x20')](saveUpdates(_0x4fee7c[_0x8608('0x44')],null))['then'](respondWithResult(_0x174d14,null))['catch'](handleError(_0x174d14,null));};exports[_0x8608('0x21')]=function(_0x10d566,_0x1e83fc){return db[_0x8608('0x27')][_0x8608('0x45')]({'where':{'id':_0x10d566['params']['id']}})[_0x8608('0x20')](handleEntityNotFound(_0x1e83fc,null))[_0x8608('0x20')](removeEntity(_0x1e83fc,null))['catch'](handleError(_0x1e83fc,null));};exports[_0x8608('0x46')]=function(_0x3247a8,_0x474f11,_0x34eecc){return db[_0x8608('0x47')]['find']({'where':{'id':_0x3247a8[_0x8608('0x40')]['id']}})[_0x8608('0x20')](handleEntityNotFound(_0x474f11,null))[_0x8608('0x20')](function(_0x41766b){if(_0x41766b){return _0x41766b['addConditions'](_0x3247a8['body'][_0x8608('0x48')],_[_0x8608('0x49')](_0x3247a8[_0x8608('0x44')],[_0x8608('0x48'),'id'])||{});}})[_0x8608('0x20')](respondWithResult(_0x474f11,null))[_0x8608('0x3e')](handleError(_0x474f11,null));};exports[_0x8608('0x4a')]=function(_0x33e19b,_0x2bf778,_0x21e8e4){var _0x32e355={};var _0x138882={};var _0x2f8f1b;var _0x9b978f;return db[_0x8608('0x27')]['findOne']({'where':{'id':_0x33e19b[_0x8608('0x40')]['id']}})[_0x8608('0x20')](handleEntityNotFound(_0x2bf778,null))[_0x8608('0x20')](function(_0x16f367){if(_0x16f367){_0x2f8f1b=_0x16f367;_0x138882['model']=_[_0x8608('0x2b')](db[_0x8608('0x47')][_0x8608('0x41')]);_0x138882[_0x8608('0x2c')]=_[_0x8608('0x2b')](_0x33e19b[_0x8608('0x2c')]);_0x138882[_0x8608('0x2d')]=_[_0x8608('0x2e')](_0x138882['model'],_0x138882['query']);_0x32e355['attributes']=_[_0x8608('0x2e')](_0x138882[_0x8608('0x2a')],qs[_0x8608('0x30')](_0x33e19b[_0x8608('0x2c')][_0x8608('0x30')]));_0x32e355[_0x8608('0x2f')]=_0x32e355['attributes'][_0x8608('0x42')]?_0x32e355[_0x8608('0x2f')]:_0x138882[_0x8608('0x2a')];_0x32e355[_0x8608('0x4b')]=qs[_0x8608('0x33')](_0x33e19b[_0x8608('0x2c')][_0x8608('0x33')]);_0x32e355[_0x8608('0x35')]=qs['filters'](_[_0x8608('0x34')](_0x33e19b[_0x8608('0x2c')],_0x138882[_0x8608('0x2d')]));if(_0x33e19b[_0x8608('0x2c')][_0x8608('0x38')]){_0x32e355[_0x8608('0x35')]=_[_0x8608('0x39')](_0x32e355[_0x8608('0x35')],{'$or':_[_0x8608('0x26')](_0x32e355[_0x8608('0x2f')],function(_0x28cbe2){var _0x4b7792={};_0x4b7792[_0x28cbe2]={'$like':'%'+_0x33e19b[_0x8608('0x2c')][_0x8608('0x38')]+'%'};return _0x4b7792;})});}_0x32e355=_[_0x8608('0x39')]({},_0x32e355,_0x33e19b[_0x8608('0x3a')]);return _0x2f8f1b[_0x8608('0x4a')](_0x32e355);}})[_0x8608('0x20')](function(_0x368682){if(_0x368682){_0x9b978f=_0x368682[_0x8608('0x42')];if(!_0x33e19b['query'][_0x8608('0x31')](_0x8608('0x32'))){_0x32e355[_0x8608('0x1a')]=qs[_0x8608('0x1a')](_0x33e19b[_0x8608('0x2c')][_0x8608('0x1a')]);_0x32e355[_0x8608('0x18')]=qs[_0x8608('0x18')](_0x33e19b[_0x8608('0x2c')]['offset']);}return _0x2f8f1b[_0x8608('0x4a')](_0x32e355);}})['then'](function(_0x595090){if(_0x595090){return _0x595090?{'count':_0x9b978f,'rows':_0x595090}:null;}})[_0x8608('0x20')](respondWithResult(_0x2bf778,null))['catch'](handleError(_0x2bf778,null));};exports['addActions']=function(_0x476cab,_0x117d10,_0x396339){return db[_0x8608('0x4c')]['find']({'where':{'id':_0x476cab[_0x8608('0x40')]['id']}})['then'](handleEntityNotFound(_0x117d10,null))[_0x8608('0x20')](function(_0x247984){if(_0x247984){return _0x247984[_0x8608('0x4d')](_0x476cab[_0x8608('0x44')][_0x8608('0x48')],_[_0x8608('0x49')](_0x476cab[_0x8608('0x44')],[_0x8608('0x48'),'id'])||{});}})[_0x8608('0x20')](respondWithResult(_0x117d10,null))[_0x8608('0x3e')](handleError(_0x117d10,null));};exports[_0x8608('0x4e')]=function(_0x3036a9,_0x33071b,_0x3cf8fc){var _0x5b943d={};var _0x429343={};var _0x2c7c0f;var _0x1c701d;return db[_0x8608('0x27')]['findOne']({'where':{'id':_0x3036a9[_0x8608('0x40')]['id']}})[_0x8608('0x20')](handleEntityNotFound(_0x33071b,null))['then'](function(_0x466e09){if(_0x466e09){_0x2c7c0f=_0x466e09;_0x429343[_0x8608('0x2a')]=_['keys'](db['Action'][_0x8608('0x41')]);_0x429343[_0x8608('0x2c')]=_[_0x8608('0x2b')](_0x3036a9['query']);_0x429343[_0x8608('0x2d')]=_[_0x8608('0x2e')](_0x429343['model'],_0x429343[_0x8608('0x2c')]);_0x5b943d[_0x8608('0x2f')]=_[_0x8608('0x2e')](_0x429343[_0x8608('0x2a')],qs[_0x8608('0x30')](_0x3036a9[_0x8608('0x2c')][_0x8608('0x30')]));_0x5b943d[_0x8608('0x2f')]=_0x5b943d[_0x8608('0x2f')][_0x8608('0x42')]?_0x5b943d['attributes']:_0x429343[_0x8608('0x2a')];_0x5b943d[_0x8608('0x4b')]=qs[_0x8608('0x33')](_0x3036a9[_0x8608('0x2c')][_0x8608('0x33')]);_0x5b943d['where']=qs[_0x8608('0x2d')](_['pick'](_0x3036a9[_0x8608('0x2c')],_0x429343[_0x8608('0x2d')]));if(_0x3036a9[_0x8608('0x2c')]['filter']){_0x5b943d[_0x8608('0x35')]=_['merge'](_0x5b943d[_0x8608('0x35')],{'$or':_[_0x8608('0x26')](_0x5b943d[_0x8608('0x2f')],function(_0x52fca6){var _0x3b2d2b={};_0x3b2d2b[_0x52fca6]={'$like':'%'+_0x3036a9['query'][_0x8608('0x38')]+'%'};return _0x3b2d2b;})});}_0x5b943d=_['merge']({},_0x5b943d,_0x3036a9[_0x8608('0x3a')]);return _0x2c7c0f[_0x8608('0x4e')](_0x5b943d);}})[_0x8608('0x20')](function(_0x4b6119){if(_0x4b6119){_0x1c701d=_0x4b6119['length'];if(!_0x3036a9['query'][_0x8608('0x31')](_0x8608('0x32'))){_0x5b943d[_0x8608('0x1a')]=qs['limit'](_0x3036a9[_0x8608('0x2c')]['limit']);_0x5b943d['offset']=qs['offset'](_0x3036a9['query'][_0x8608('0x18')]);}return _0x2c7c0f[_0x8608('0x4e')](_0x5b943d);}})[_0x8608('0x20')](function(_0x1e801f){if(_0x1e801f){return _0x1e801f?{'count':_0x1c701d,'rows':_0x1e801f}:null;}})['then'](respondWithResult(_0x33071b,null))[_0x8608('0x3e')](handleError(_0x33071b,null));}; \ No newline at end of file +var _0x1bef=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','rawAttributes','find','catch','create','body','destroy','addConditions','ids','omit','getConditions','findOne','Condition','nolimit','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x1bef,0x1c1));var _0xf1be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bef[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf1be('0x0'));var jsonpatch=require(_0xf1be('0x1'));var rp=require(_0xf1be('0x2'));var moment=require(_0xf1be('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf1be('0x4'));var sox=require(_0xf1be('0x5'));var csv=require(_0xf1be('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1be('0x7'));var _=require(_0xf1be('0x8'));var squel=require(_0xf1be('0x9'));var crypto=require(_0xf1be('0xa'));var jsforce=require(_0xf1be('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf1be('0x6'));var querystring=require(_0xf1be('0xc'));var Papa=require(_0xf1be('0xd'));var Redis=require(_0xf1be('0xe'));var authService=require(_0xf1be('0xf'));var qs=require(_0xf1be('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf1be('0x11'));var utils=require('../../config/utils');var config=require(_0xf1be('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ed577,_0x1df943){_0x1df943=_0x1df943||0xcc;return function(_0x2dde75){if(_0x2dde75){return _0x4ed577['sendStatus'](_0x1df943);}return _0x4ed577[_0xf1be('0x13')](_0x1df943)[_0xf1be('0x14')]();};}function respondWithResult(_0x5cb56b,_0x1b3f3c){_0x1b3f3c=_0x1b3f3c||0xc8;return function(_0x1edd86){if(_0x1edd86){return _0x5cb56b[_0xf1be('0x13')](_0x1b3f3c)[_0xf1be('0x15')](_0x1edd86);}};}function respondWithFilteredResult(_0x1241fc,_0x500e20){return function(_0x5cf928){if(_0x5cf928){var _0x333425=typeof _0x500e20[_0xf1be('0x16')]===_0xf1be('0x17')&&typeof _0x500e20[_0xf1be('0x18')]===_0xf1be('0x17');var _0x47d752=_0x5cf928[_0xf1be('0x19')];var _0x5eea51=_0x333425?0x0:_0x500e20[_0xf1be('0x16')];var _0x21f027=_0x333425?_0x5cf928[_0xf1be('0x19')]:_0x500e20[_0xf1be('0x16')]+_0x500e20[_0xf1be('0x18')];var _0xc9ffa1;if(_0x21f027>=_0x47d752){_0x21f027=_0x47d752;_0xc9ffa1=0xc8;}else{_0xc9ffa1=0xce;}_0x1241fc['status'](_0xc9ffa1);return _0x1241fc[_0xf1be('0x1a')](_0xf1be('0x1b'),_0x5eea51+'-'+_0x21f027+'/'+_0x47d752)[_0xf1be('0x15')](_0x5cf928);}return null;};}function patchUpdates(_0x1b6db9){return function(_0x4f8c2b){try{jsonpatch['apply'](_0x4f8c2b,_0x1b6db9,!![]);}catch(_0x3dea61){return BPromise[_0xf1be('0x1c')](_0x3dea61);}return _0x4f8c2b[_0xf1be('0x1d')]();};}function saveUpdates(_0x97d83,_0x49e936){return function(_0x56bc71){if(_0x56bc71){return _0x56bc71['update'](_0x97d83)[_0xf1be('0x1e')](function(_0x4724e3){return _0x4724e3;});}return null;};}function removeEntity(_0x40c130,_0x272870){return function(_0x1fea98){if(_0x1fea98){return _0x1fea98['destroy']()[_0xf1be('0x1e')](function(){_0x40c130[_0xf1be('0x13')](0xcc)[_0xf1be('0x14')]();});}};}function handleEntityNotFound(_0x180adb,_0x588b29){return function(_0x21e2d6){if(!_0x21e2d6){_0x180adb['sendStatus'](0x194);}return _0x21e2d6;};}function handleError(_0xd4d6e6,_0x1f76f8){_0x1f76f8=_0x1f76f8||0x1f4;return function(_0x812d15){logger[_0xf1be('0x1f')](_0x812d15[_0xf1be('0x20')]);if(_0x812d15[_0xf1be('0x21')]){delete _0x812d15['name'];}_0xd4d6e6[_0xf1be('0x13')](_0x1f76f8)[_0xf1be('0x22')](_0x812d15);};}exports[_0xf1be('0x23')]=function(_0xff376c,_0x47b1f8){var _0x4534f7={},_0x5bdf71={},_0xba2b3d={'count':0x0,'rows':[]};var _0x3d71c1=_[_0xf1be('0x24')](db[_0xf1be('0x25')]['rawAttributes'],function(_0xf0ded0){return{'name':_0xf0ded0[_0xf1be('0x26')],'type':_0xf0ded0[_0xf1be('0x27')][_0xf1be('0x28')]};});_0x5bdf71[_0xf1be('0x29')]=_['map'](_0x3d71c1,_0xf1be('0x21'));_0x5bdf71[_0xf1be('0x2a')]=_[_0xf1be('0x2b')](_0xff376c[_0xf1be('0x2a')]);_0x5bdf71[_0xf1be('0x2c')]=_['intersection'](_0x5bdf71[_0xf1be('0x29')],_0x5bdf71[_0xf1be('0x2a')]);_0x4534f7['attributes']=_[_0xf1be('0x2d')](_0x5bdf71[_0xf1be('0x29')],qs['fields'](_0xff376c[_0xf1be('0x2a')][_0xf1be('0x2e')]));_0x4534f7[_0xf1be('0x2f')]=_0x4534f7[_0xf1be('0x2f')][_0xf1be('0x30')]?_0x4534f7['attributes']:_0x5bdf71['model'];if(!_0xff376c[_0xf1be('0x2a')][_0xf1be('0x31')]('nolimit')){_0x4534f7[_0xf1be('0x18')]=qs[_0xf1be('0x18')](_0xff376c[_0xf1be('0x2a')]['limit']);_0x4534f7[_0xf1be('0x16')]=qs[_0xf1be('0x16')](_0xff376c[_0xf1be('0x2a')][_0xf1be('0x16')]);}_0x4534f7[_0xf1be('0x32')]=qs['sort'](_0xff376c[_0xf1be('0x2a')][_0xf1be('0x33')]);_0x4534f7[_0xf1be('0x34')]=qs['filters'](_[_0xf1be('0x35')](_0xff376c['query'],_0x5bdf71[_0xf1be('0x2c')]),_0x3d71c1);if(_0xff376c[_0xf1be('0x2a')]['filter']){_0x4534f7[_0xf1be('0x34')]=_[_0xf1be('0x36')](_0x4534f7[_0xf1be('0x34')],{'$or':_[_0xf1be('0x24')](_0x3d71c1,function(_0x431f79){if(_0x431f79[_0xf1be('0x27')]!==_0xf1be('0x37')){var _0x57794a={};_0x57794a[_0x431f79['name']]={'$like':'%'+_0xff376c[_0xf1be('0x2a')][_0xf1be('0x38')]+'%'};return _0x57794a;}})});}_0x4534f7=_[_0xf1be('0x36')]({},_0x4534f7,_0xff376c[_0xf1be('0x39')]);var _0x3b1e27={'where':_0x4534f7[_0xf1be('0x34')]};return db[_0xf1be('0x25')]['count'](_0x3b1e27)[_0xf1be('0x1e')](function(_0x1b3dce){_0xba2b3d[_0xf1be('0x19')]=_0x1b3dce;if(_0xff376c[_0xf1be('0x2a')]['includeAll']){_0x4534f7[_0xf1be('0x3a')]=[{'all':!![]}];}return db[_0xf1be('0x25')][_0xf1be('0x3b')](_0x4534f7);})['then'](function(_0x56f70c){_0xba2b3d['rows']=_0x56f70c;return _0xba2b3d;})['then'](respondWithFilteredResult(_0x47b1f8,_0x4534f7))['catch'](handleError(_0x47b1f8,null));};exports[_0xf1be('0x3c')]=function(_0x116970,_0x43d0a7){var _0x36beca={'raw':![],'where':{'id':_0x116970[_0xf1be('0x3d')]['id']}},_0x58af98={};_0x58af98[_0xf1be('0x29')]=_[_0xf1be('0x2b')](db[_0xf1be('0x25')][_0xf1be('0x3e')]);_0x58af98[_0xf1be('0x2a')]=_[_0xf1be('0x2b')](_0x116970[_0xf1be('0x2a')]);_0x58af98[_0xf1be('0x2c')]=_[_0xf1be('0x2d')](_0x58af98[_0xf1be('0x29')],_0x58af98[_0xf1be('0x2a')]);_0x36beca[_0xf1be('0x2f')]=_[_0xf1be('0x2d')](_0x58af98[_0xf1be('0x29')],qs[_0xf1be('0x2e')](_0x116970['query'][_0xf1be('0x2e')]));_0x36beca[_0xf1be('0x2f')]=_0x36beca[_0xf1be('0x2f')][_0xf1be('0x30')]?_0x36beca[_0xf1be('0x2f')]:_0x58af98[_0xf1be('0x29')];if(_0x116970['query']['includeAll']){_0x36beca[_0xf1be('0x3a')]=[{'all':!![]}];}_0x36beca=_[_0xf1be('0x36')]({},_0x36beca,_0x116970[_0xf1be('0x39')]);return db[_0xf1be('0x25')][_0xf1be('0x3f')](_0x36beca)['then'](handleEntityNotFound(_0x43d0a7,null))[_0xf1be('0x1e')](respondWithResult(_0x43d0a7,null))[_0xf1be('0x40')](handleError(_0x43d0a7,null));};exports[_0xf1be('0x41')]=function(_0x4a16a3,_0x20b98){return db[_0xf1be('0x25')]['create'](_0x4a16a3[_0xf1be('0x42')],{})[_0xf1be('0x1e')](respondWithResult(_0x20b98,0xc9))[_0xf1be('0x40')](handleError(_0x20b98,null));};exports['update']=function(_0xaf6566,_0x2cd94d){if(_0xaf6566[_0xf1be('0x42')]['id']){delete _0xaf6566['body']['id'];}return db[_0xf1be('0x25')][_0xf1be('0x3f')]({'where':{'id':_0xaf6566[_0xf1be('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2cd94d,null))['then'](saveUpdates(_0xaf6566['body'],null))['then'](respondWithResult(_0x2cd94d,null))[_0xf1be('0x40')](handleError(_0x2cd94d,null));};exports[_0xf1be('0x43')]=function(_0x249c78,_0x37dfca){return db[_0xf1be('0x25')][_0xf1be('0x3f')]({'where':{'id':_0x249c78[_0xf1be('0x3d')]['id']}})[_0xf1be('0x1e')](handleEntityNotFound(_0x37dfca,null))['then'](removeEntity(_0x37dfca,null))[_0xf1be('0x40')](handleError(_0x37dfca,null));};exports[_0xf1be('0x44')]=function(_0x35429a,_0x3a1a77,_0xadf48b){return db['Condition'][_0xf1be('0x3f')]({'where':{'id':_0x35429a[_0xf1be('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3a1a77,null))['then'](function(_0x10c574){if(_0x10c574){return _0x10c574[_0xf1be('0x44')](_0x35429a['body'][_0xf1be('0x45')],_[_0xf1be('0x46')](_0x35429a[_0xf1be('0x42')],[_0xf1be('0x45'),'id'])||{});}})[_0xf1be('0x1e')](respondWithResult(_0x3a1a77,null))[_0xf1be('0x40')](handleError(_0x3a1a77,null));};exports[_0xf1be('0x47')]=function(_0xed1661,_0x22821d,_0x5c4765){var _0x2a5ff0={};var _0x853502={};var _0x1532ad;var _0x114768;return db[_0xf1be('0x25')][_0xf1be('0x48')]({'where':{'id':_0xed1661[_0xf1be('0x3d')]['id']}})[_0xf1be('0x1e')](handleEntityNotFound(_0x22821d,null))[_0xf1be('0x1e')](function(_0x4bfdf2){if(_0x4bfdf2){_0x1532ad=_0x4bfdf2;_0x853502[_0xf1be('0x29')]=_[_0xf1be('0x2b')](db[_0xf1be('0x49')][_0xf1be('0x3e')]);_0x853502[_0xf1be('0x2a')]=_[_0xf1be('0x2b')](_0xed1661[_0xf1be('0x2a')]);_0x853502[_0xf1be('0x2c')]=_[_0xf1be('0x2d')](_0x853502[_0xf1be('0x29')],_0x853502[_0xf1be('0x2a')]);_0x2a5ff0[_0xf1be('0x2f')]=_[_0xf1be('0x2d')](_0x853502[_0xf1be('0x29')],qs[_0xf1be('0x2e')](_0xed1661[_0xf1be('0x2a')][_0xf1be('0x2e')]));_0x2a5ff0[_0xf1be('0x2f')]=_0x2a5ff0[_0xf1be('0x2f')]['length']?_0x2a5ff0[_0xf1be('0x2f')]:_0x853502[_0xf1be('0x29')];_0x2a5ff0['order']=qs[_0xf1be('0x33')](_0xed1661[_0xf1be('0x2a')][_0xf1be('0x33')]);_0x2a5ff0[_0xf1be('0x34')]=qs[_0xf1be('0x2c')](_[_0xf1be('0x35')](_0xed1661[_0xf1be('0x2a')],_0x853502[_0xf1be('0x2c')]));if(_0xed1661[_0xf1be('0x2a')]['filter']){_0x2a5ff0[_0xf1be('0x34')]=_[_0xf1be('0x36')](_0x2a5ff0['where'],{'$or':_[_0xf1be('0x24')](_0x2a5ff0[_0xf1be('0x2f')],function(_0x20728e){var _0x48c029={};_0x48c029[_0x20728e]={'$like':'%'+_0xed1661[_0xf1be('0x2a')]['filter']+'%'};return _0x48c029;})});}_0x2a5ff0=_[_0xf1be('0x36')]({},_0x2a5ff0,_0xed1661['options']);return _0x1532ad[_0xf1be('0x47')](_0x2a5ff0);}})[_0xf1be('0x1e')](function(_0x4b96e5){if(_0x4b96e5){_0x114768=_0x4b96e5[_0xf1be('0x30')];if(!_0xed1661[_0xf1be('0x2a')]['hasOwnProperty'](_0xf1be('0x4a'))){_0x2a5ff0['limit']=qs[_0xf1be('0x18')](_0xed1661[_0xf1be('0x2a')][_0xf1be('0x18')]);_0x2a5ff0[_0xf1be('0x16')]=qs[_0xf1be('0x16')](_0xed1661[_0xf1be('0x2a')]['offset']);}return _0x1532ad[_0xf1be('0x47')](_0x2a5ff0);}})['then'](function(_0x4ddb9b){if(_0x4ddb9b){return _0x4ddb9b?{'count':_0x114768,'rows':_0x4ddb9b}:null;}})[_0xf1be('0x1e')](respondWithResult(_0x22821d,null))['catch'](handleError(_0x22821d,null));};exports[_0xf1be('0x4b')]=function(_0x5c75db,_0x4ea1ae,_0x36fdb2){return db[_0xf1be('0x4c')]['find']({'where':{'id':_0x5c75db[_0xf1be('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4ea1ae,null))['then'](function(_0x5681e1){if(_0x5681e1){return _0x5681e1[_0xf1be('0x4b')](_0x5c75db[_0xf1be('0x42')][_0xf1be('0x45')],_[_0xf1be('0x46')](_0x5c75db[_0xf1be('0x42')],['ids','id'])||{});}})[_0xf1be('0x1e')](respondWithResult(_0x4ea1ae,null))[_0xf1be('0x40')](handleError(_0x4ea1ae,null));};exports[_0xf1be('0x4d')]=function(_0x37b247,_0x93be18,_0x4b3087){var _0x33936a={};var _0x2addde={};var _0x10753f;var _0x3318f6;return db[_0xf1be('0x25')][_0xf1be('0x48')]({'where':{'id':_0x37b247['params']['id']}})[_0xf1be('0x1e')](handleEntityNotFound(_0x93be18,null))[_0xf1be('0x1e')](function(_0x1d916d){if(_0x1d916d){_0x10753f=_0x1d916d;_0x2addde[_0xf1be('0x29')]=_[_0xf1be('0x2b')](db[_0xf1be('0x4c')][_0xf1be('0x3e')]);_0x2addde[_0xf1be('0x2a')]=_[_0xf1be('0x2b')](_0x37b247[_0xf1be('0x2a')]);_0x2addde[_0xf1be('0x2c')]=_['intersection'](_0x2addde['model'],_0x2addde[_0xf1be('0x2a')]);_0x33936a[_0xf1be('0x2f')]=_['intersection'](_0x2addde[_0xf1be('0x29')],qs[_0xf1be('0x2e')](_0x37b247[_0xf1be('0x2a')][_0xf1be('0x2e')]));_0x33936a[_0xf1be('0x2f')]=_0x33936a[_0xf1be('0x2f')][_0xf1be('0x30')]?_0x33936a[_0xf1be('0x2f')]:_0x2addde[_0xf1be('0x29')];_0x33936a[_0xf1be('0x32')]=qs[_0xf1be('0x33')](_0x37b247[_0xf1be('0x2a')][_0xf1be('0x33')]);_0x33936a[_0xf1be('0x34')]=qs[_0xf1be('0x2c')](_[_0xf1be('0x35')](_0x37b247['query'],_0x2addde['filters']));if(_0x37b247[_0xf1be('0x2a')]['filter']){_0x33936a[_0xf1be('0x34')]=_[_0xf1be('0x36')](_0x33936a[_0xf1be('0x34')],{'$or':_[_0xf1be('0x24')](_0x33936a[_0xf1be('0x2f')],function(_0x229462){var _0x162f6d={};_0x162f6d[_0x229462]={'$like':'%'+_0x37b247[_0xf1be('0x2a')][_0xf1be('0x38')]+'%'};return _0x162f6d;})});}_0x33936a=_[_0xf1be('0x36')]({},_0x33936a,_0x37b247[_0xf1be('0x39')]);return _0x10753f[_0xf1be('0x4d')](_0x33936a);}})['then'](function(_0x5aa16e){if(_0x5aa16e){_0x3318f6=_0x5aa16e[_0xf1be('0x30')];if(!_0x37b247['query']['hasOwnProperty'](_0xf1be('0x4a'))){_0x33936a['limit']=qs['limit'](_0x37b247['query'][_0xf1be('0x18')]);_0x33936a[_0xf1be('0x16')]=qs['offset'](_0x37b247[_0xf1be('0x2a')][_0xf1be('0x16')]);}return _0x10753f[_0xf1be('0x4d')](_0x33936a);}})['then'](function(_0x2b9f82){if(_0x2b9f82){return _0x2b9f82?{'count':_0x3318f6,'rows':_0x2b9f82}:null;}})[_0xf1be('0x1e')](respondWithResult(_0x93be18,null))[_0xf1be('0x40')](handleError(_0x93be18,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 61dba5a..05a835f 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 _0x992c=['Automation','tools_automations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x2b2c7f,_0x337926){var _0xea3c7=function(_0x514561){while(--_0x514561){_0x2b2c7f['push'](_0x2b2c7f['shift']());}};_0xea3c7(++_0x337926);}(_0x992c,0x12d));var _0xc992=function(_0x11640a,_0x44e37c){_0x11640a=_0x11640a-0x0;var _0xc42368=_0x992c[_0x11640a];return _0xc42368;};'use strict';var _=require('lodash');var util=require(_0xc992('0x0'));var logger=require(_0xc992('0x1'))(_0xc992('0x2'));var moment=require(_0xc992('0x3'));var BPromise=require(_0xc992('0x4'));var rp=require(_0xc992('0x5'));var fs=require('fs');var path=require(_0xc992('0x6'));var rimraf=require(_0xc992('0x7'));var config=require(_0xc992('0x8'));var attributes=require(_0xc992('0x9'));module[_0xc992('0xa')]=function(_0x54847a,_0x37d433){return _0x54847a['define'](_0xc992('0xb'),attributes,{'tableName':_0xc992('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7aeb=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash'];(function(_0x24aae0,_0x299658){var _0x259b88=function(_0x42ef91){while(--_0x42ef91){_0x24aae0['push'](_0x24aae0['shift']());}};_0x259b88(++_0x299658);}(_0x7aeb,0x1a3));var _0xb7ae=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x7aeb[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xb7ae('0x0'));var util=require(_0xb7ae('0x1'));var logger=require(_0xb7ae('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb7ae('0x3'));var rp=require(_0xb7ae('0x4'));var fs=require('fs');var path=require(_0xb7ae('0x5'));var rimraf=require(_0xb7ae('0x6'));var config=require(_0xb7ae('0x7'));var attributes=require(_0xb7ae('0x8'));module['exports']=function(_0x42abe3,_0x532b47){return _0x42abe3[_0xb7ae('0x9')](_0xb7ae('0xa'),attributes,{'tableName':_0xb7ae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c4a2a36..b3048e0 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 _0xcefd=['error','Automation,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e54e6,_0x513aad){var _0x47d180=function(_0x12bdf0){while(--_0x12bdf0){_0x2e54e6['push'](_0x2e54e6['shift']());}};_0x47d180(++_0x513aad);}(_0xcefd,0x1bd));var _0xdcef=function(_0x1951de,_0x173387){_0x1951de=_0x1951de-0x0;var _0x418584=_0xcefd[_0x1951de];return _0x418584;};'use strict';var _=require('lodash');var util=require(_0xdcef('0x0'));var moment=require(_0xdcef('0x1'));var BPromise=require(_0xdcef('0x2'));var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require(_0xdcef('0x6'));var logger=require('../../config/logger')(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require(_0xdcef('0x9'));var client=jayson[_0xdcef('0xa')][_0xdcef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba458,_0x3b9fec,_0x25dfd5){return new BPromise(function(_0x3dc2b0,_0x11a5a6){return client['request'](_0x4ba458,_0x25dfd5)[_0xdcef('0xc')](function(_0xbb7067){logger[_0xdcef('0xd')]('Automation,\x20%s,\x20%s',_0x3b9fec,_0xdcef('0xe'));logger['debug'](_0xdcef('0xf'),_0x3b9fec,_0xdcef('0xe'),JSON[_0xdcef('0x10')](_0xbb7067));if(_0xbb7067[_0xdcef('0x11')]){if(_0xbb7067[_0xdcef('0x11')]['code']===0x1f4){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x3b9fec,_0xbb7067['error'][_0xdcef('0x13')]);return _0x11a5a6(_0xbb7067['error'][_0xdcef('0x13')]);}logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x3b9fec,_0xbb7067[_0xdcef('0x11')]['message']);return _0x3dc2b0(_0xbb7067[_0xdcef('0x11')][_0xdcef('0x13')]);}else{logger['info'](_0xdcef('0x12'),_0x3b9fec,_0xdcef('0xe'));_0x3dc2b0(_0xbb7067[_0xdcef('0x14')]['message']);}})['catch'](function(_0x386368){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x3b9fec,_0x386368);_0x11a5a6(_0x386368);});});} \ No newline at end of file +var _0x9582=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3b92e5,_0x3a52c5){var _0xf537a6=function(_0x14e914){while(--_0x14e914){_0x3b92e5['push'](_0x3b92e5['shift']());}};_0xf537a6(++_0x3a52c5);}(_0x9582,0x95));var _0x2958=function(_0x56a92b,_0x5156fd){_0x56a92b=_0x56a92b-0x0;var _0x586a9f=_0x9582[_0x56a92b];return _0x586a9f;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309525,_0xa385ec,_0x2e571b){return new BPromise(function(_0x56ca85,_0x5ec1b3){return client[_0x2958('0xd')](_0x309525,_0x2e571b)['then'](function(_0x10db1e){logger['info'](_0x2958('0xe'),_0xa385ec,'request\x20sent');logger[_0x2958('0xf')](_0x2958('0x10'),_0xa385ec,_0x2958('0x11'),JSON[_0x2958('0x12')](_0x10db1e));if(_0x10db1e[_0x2958('0x13')]){if(_0x10db1e['error'][_0x2958('0x14')]===0x1f4){logger[_0x2958('0x13')](_0x2958('0xe'),_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x5ec1b3(_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);}logger[_0x2958('0x13')]('Automation,\x20%s,\x20%s',_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x56ca85(_0x10db1e['error']['message']);}else{logger[_0x2958('0x16')](_0x2958('0xe'),_0xa385ec,'request\x20sent');_0x56ca85(_0x10db1e[_0x2958('0x17')]['message']);}})['catch'](function(_0x429d42){logger[_0x2958('0x13')]('Automation,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4556556..587adb7 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 _0xd338=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','getConditions','/:id/actions','post','create','/:id/conditions','addConditions','addActions','put','destroy','exports','multer','path','Router','fs-extra'];(function(_0xa34ad4,_0x120b2d){var _0x3813e2=function(_0x1aa19c){while(--_0x1aa19c){_0xa34ad4['push'](_0xa34ad4['shift']());}};_0x3813e2(++_0x120b2d);}(_0xd338,0x1f4));var _0x8d33=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xd338[_0x3cb152];return _0x4f54c3;};'use strict';var multer=require(_0x8d33('0x0'));var util=require('util');var path=require(_0x8d33('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8d33('0x2')]();var fs_extra=require(_0x8d33('0x3'));var auth=require(_0x8d33('0x4'));var interaction=require(_0x8d33('0x5'));var config=require(_0x8d33('0x6'));var controller=require('./automation.controller');router['get']('/',auth[_0x8d33('0x7')](),controller['index']);router['get'](_0x8d33('0x8'),auth[_0x8d33('0x7')](),controller[_0x8d33('0x9')]);router[_0x8d33('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x8d33('0xb')]);router[_0x8d33('0xa')](_0x8d33('0xc'),auth[_0x8d33('0x7')](),controller['getActions']);router[_0x8d33('0xd')]('/',auth[_0x8d33('0x7')](),controller[_0x8d33('0xe')]);router['post'](_0x8d33('0xf'),auth[_0x8d33('0x7')](),controller[_0x8d33('0x10')]);router[_0x8d33('0xd')](_0x8d33('0xc'),auth[_0x8d33('0x7')](),controller[_0x8d33('0x11')]);router[_0x8d33('0x12')](_0x8d33('0x8'),auth[_0x8d33('0x7')](),controller['update']);router['delete'](_0x8d33('0x8'),auth[_0x8d33('0x7')](),controller[_0x8d33('0x13')]);module[_0x8d33('0x14')]=router; \ No newline at end of file +var _0xe1f0=['/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get','/:id','/:id/conditions'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xe1f0,0x1c2));var _0x0e1f=function(_0x327f3e,_0x25de77){_0x327f3e=_0x327f3e-0x0;var _0xbd21cc=_0xe1f0[_0x327f3e];return _0xbd21cc;};'use strict';var multer=require('multer');var util=require(_0x0e1f('0x0'));var path=require(_0x0e1f('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e1f('0x2'));var router=express[_0x0e1f('0x3')]();var fs_extra=require(_0x0e1f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e1f('0x5'));var config=require(_0x0e1f('0x6'));var controller=require(_0x0e1f('0x7'));router['get']('/',auth[_0x0e1f('0x8')](),controller['index']);router[_0x0e1f('0x9')](_0x0e1f('0xa'),auth[_0x0e1f('0x8')](),controller['show']);router['get'](_0x0e1f('0xb'),auth[_0x0e1f('0x8')](),controller['getConditions']);router[_0x0e1f('0x9')](_0x0e1f('0xc'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0xd')]);router[_0x0e1f('0xe')]('/',auth[_0x0e1f('0x8')](),controller[_0x0e1f('0xf')]);router[_0x0e1f('0xe')](_0x0e1f('0xb'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x10')]);router[_0x0e1f('0xe')]('/:id/actions',auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x11')]);router[_0x0e1f('0x12')](_0x0e1f('0xa'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x13')]);router[_0x0e1f('0x14')](_0x0e1f('0xa'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index dc69657..6a382da 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 _0x3988=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x5a033c,_0x3fd3a4){var _0x1cb486=function(_0x135a83){while(--_0x135a83){_0x5a033c['push'](_0x5a033c['shift']());}};_0x1cb486(++_0x3fd3a4);}(_0x3988,0x1cc));var _0x8398=function(_0xfd710a,_0x3464d3){_0xfd710a=_0xfd710a-0x0;var _0x58b12e=_0x3988[_0xfd710a];return _0x58b12e;};'use strict';var Sequelize=require(_0x8398('0x0'));module[_0x8398('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8398('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8398('0x3')](_0x8398('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8398('0x5')],'defaultValue':0x0,'comment':_0x8398('0x6')},'limitCalls':{'type':Sequelize[_0x8398('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8398('0x8')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8398('0x8')]},'dialOriginateTimeout':{'type':Sequelize[_0x8398('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8398('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8398('0x7')](0x3)[_0x8398('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8398('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)[_0x8398('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8398('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8398('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8398('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8398('0x7')](0x3)[_0x8398('0xa')],'defaultValue':0x3,'comment':_0x8398('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8398('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8398('0x7')](0x3)[_0x8398('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8398('0x10')},'dialTimezone':{'type':Sequelize[_0x8398('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8398('0x3')](_0x8398('0x11'),'never',_0x8398('0x12')),'defaultValue':_0x8398('0x11')},'dialAMDActive':{'type':Sequelize[_0x8398('0x5')],'defaultValue':0x0,'comment':_0x8398('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8398('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x8398('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8398('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8398('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8398('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8398('0x7')](0x9)[_0x8398('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8398('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x8398('0x7')](0x9)[_0x8398('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8398('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8398('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8398('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8398('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8398('0x7')](0x5)[_0x8398('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8398('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8398('0x7')](0x9)[_0x8398('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8398('0x3')](_0x8398('0x1c'),'ASC'),'defaultValue':_0x8398('0x1c')},'dialPrefix':{'type':Sequelize[_0x8398('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8398('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8398('0x1d')},'dialCutDigit':{'type':Sequelize[_0x8398('0x7')](0x3)[_0x8398('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8398('0x7')](0x3)[_0x8398('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)[_0x8398('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8398('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8398('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8398('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)[_0x8398('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8398('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8398('0x7')](0x3)[_0x8398('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8398('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8398('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x8398('0x7')](0x3)[_0x8398('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8398('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)[_0x8398('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8398('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8398('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8398('0x24')}}; \ No newline at end of file +var _0x6d1d=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x6d1d,0x19a));var _0xd6d1=function(_0x16a9da,_0x5746f9){_0x16a9da=_0x16a9da-0x0;var _0x14b6e5=_0x6d1d[_0x16a9da];return _0x14b6e5;};'use strict';var Sequelize=require('sequelize');module[_0xd6d1('0x0')]={'name':{'type':Sequelize[_0xd6d1('0x1')],'unique':_0xd6d1('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0xd6d1('0x3')},'description':{'type':Sequelize[_0xd6d1('0x1')]},'active':{'type':Sequelize[_0xd6d1('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xd6d1('0x5')](0x4)[_0xd6d1('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd6d1('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd6d1('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd6d1('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd6d1('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd6d1('0x5')](0x5)[_0xd6d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd6d1('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0xd6d1('0x5')](0x3)[_0xd6d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd6d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd6d1('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd6d1('0x5')](0x3)[_0xd6d1('0x6')],'defaultValue':0x3,'comment':_0xd6d1('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd6d1('0x5')](0x5)[_0xd6d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd6d1('0xb')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd6d1('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd6d1('0xc')},'dialTimezone':{'type':Sequelize[_0xd6d1('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xd6d1('0xd')](_0xd6d1('0xe'),_0xd6d1('0xf'),_0xd6d1('0x10')),'defaultValue':_0xd6d1('0xe')},'dialAMDActive':{'type':Sequelize[_0xd6d1('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd6d1('0x5')](0x9)[_0xd6d1('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd6d1('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xd6d1('0x5')](0x9)[_0xd6d1('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd6d1('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd6d1('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd6d1('0x5')](0x9)[_0xd6d1('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd6d1('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xd6d1('0x5')](0x9)[_0xd6d1('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd6d1('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd6d1('0x5')](0x9)[_0xd6d1('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd6d1('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd6d1('0x5')](0x9)[_0xd6d1('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd6d1('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd6d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd6d1('0x5')](0x9)[_0xd6d1('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd6d1('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd6d1('0xd')]('DESC','ASC'),'defaultValue':_0xd6d1('0x19')},'dialPrefix':{'type':Sequelize[_0xd6d1('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd6d1('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd6d1('0x1a')},'dialCutDigit':{'type':Sequelize[_0xd6d1('0x5')](0x3)[_0xd6d1('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd6d1('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd6d1('0x5')](0x3)[_0xd6d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd6d1('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd6d1('0x5')](0x5)[_0xd6d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd6d1('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd6d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd6d1('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xd6d1('0x5')](0x5)[_0xd6d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd6d1('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd6d1('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd6d1('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd6d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd6d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd6d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd6d1('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd6d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd6d1('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd6d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd6d1('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 67f5250..f9ea808 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 _0x94c9=['h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','apply','then','destroy','get','IvrCampaigns','UserProfileResource','end','sendStatus','error','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','order','pick','CampaignId','CmHopperHistory','nolimit','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','into','cm_hopper_additional_phones','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0x94c9,0x1b5));var _0x994c=function(_0x3ae452,_0x173661){_0x3ae452=_0x3ae452-0x0;var _0xc4a781=_0x94c9[_0x3ae452];return _0xc4a781;};'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(_0x994c('0x0'));var moment=require('moment');var BPromise=require(_0x994c('0x1'));var Mustache=require(_0x994c('0x2'));var util=require(_0x994c('0x3'));var path=require(_0x994c('0x4'));var sox=require(_0x994c('0x5'));var csv=require(_0x994c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x994c('0x7'));var squel=require(_0x994c('0x8'));var crypto=require('crypto');var jsforce=require(_0x994c('0x9'));var deskjs=require(_0x994c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x994c('0xb'));var Papa=require(_0x994c('0xc'));var Redis=require(_0x994c('0xd'));var authService=require(_0x994c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x994c('0xf'));var hardwareService=require(_0x994c('0x10'));var logger=require(_0x994c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x994c('0x12'));var licenseUtil=require(_0x994c('0x13'));var db=require(_0x994c('0x14'))['db'];function respondWithStatusCode(_0x2ae113,_0x31636d){_0x31636d=_0x31636d||0xcc;return function(_0x257fb1){if(_0x257fb1){return _0x2ae113['sendStatus'](_0x31636d);}return _0x2ae113[_0x994c('0x15')](_0x31636d)['end']();};}function respondWithResult(_0x3d7db1,_0x39fa1d){_0x39fa1d=_0x39fa1d||0xc8;return function(_0x127091){if(_0x127091){return _0x3d7db1['status'](_0x39fa1d)['json'](_0x127091);}};}function respondWithFilteredResult(_0x2ff397,_0x780bcd){return function(_0x25fbef){if(_0x25fbef){var _0x44db3e=typeof _0x780bcd[_0x994c('0x16')]==='undefined'&&typeof _0x780bcd[_0x994c('0x17')]===_0x994c('0x18');var _0x22d40a=_0x25fbef[_0x994c('0x19')];var _0x2264a6=_0x44db3e?0x0:_0x780bcd[_0x994c('0x16')];var _0x4a9f35=_0x44db3e?_0x25fbef[_0x994c('0x19')]:_0x780bcd[_0x994c('0x16')]+_0x780bcd[_0x994c('0x17')];var _0x4f2d41;if(_0x4a9f35>=_0x22d40a){_0x4a9f35=_0x22d40a;_0x4f2d41=0xc8;}else{_0x4f2d41=0xce;}_0x2ff397[_0x994c('0x15')](_0x4f2d41);return _0x2ff397[_0x994c('0x1a')]('Content-Range',_0x2264a6+'-'+_0x4a9f35+'/'+_0x22d40a)['json'](_0x25fbef);}return null;};}function patchUpdates(_0x508886){return function(_0x334a23){try{jsonpatch[_0x994c('0x1b')](_0x334a23,_0x508886,!![]);}catch(_0x3de515){return BPromise['reject'](_0x3de515);}return _0x334a23['save']();};}function saveUpdates(_0x21cf7c,_0x2403d2){return function(_0x34e5bf){if(_0x34e5bf){return _0x34e5bf['update'](_0x21cf7c)[_0x994c('0x1c')](function(_0x320d26){return _0x320d26;});}return null;};}function removeEntity(_0x538a70,_0x52261c){return function(_0x3118fa){if(_0x3118fa){return _0x3118fa[_0x994c('0x1d')]()[_0x994c('0x1c')](function(){var _0x4d341f=_0x3118fa[_0x994c('0x1e')]({'plain':!![]});var _0x5974c5=_0x994c('0x1f');return db[_0x994c('0x20')]['destroy']({'where':{'type':_0x5974c5,'resourceId':_0x4d341f['id']}})[_0x994c('0x1c')](function(){return _0x3118fa;});})[_0x994c('0x1c')](function(){_0x538a70[_0x994c('0x15')](0xcc)[_0x994c('0x21')]();});}};}function handleEntityNotFound(_0x8ff02e,_0x33d8e9){return function(_0x1984f6){if(!_0x1984f6){_0x8ff02e[_0x994c('0x22')](0x194);}return _0x1984f6;};}function handleError(_0x3d52f4,_0x3931e8){_0x3931e8=_0x3931e8||0x1f4;return function(_0x10de08){logger[_0x994c('0x23')](_0x10de08['stack']);if(_0x10de08[_0x994c('0x24')]){delete _0x10de08[_0x994c('0x24')];}_0x3d52f4[_0x994c('0x15')](_0x3931e8)[_0x994c('0x25')](_0x10de08);};}exports[_0x994c('0x26')]=function(_0x327b94,_0x822fd4){var _0x9bb112={},_0x26a27e={},_0xdfab08={'count':0x0,'rows':[]};var _0x238989=_[_0x994c('0x27')](db[_0x994c('0x28')]['rawAttributes'],function(_0x4d3a50){return{'name':_0x4d3a50[_0x994c('0x29')],'type':_0x4d3a50[_0x994c('0x2a')][_0x994c('0x2b')]};});_0x26a27e[_0x994c('0x2c')]=_['map'](_0x238989,_0x994c('0x24'));_0x26a27e[_0x994c('0x2d')]=_[_0x994c('0x2e')](_0x327b94[_0x994c('0x2d')]);_0x26a27e[_0x994c('0x2f')]=_[_0x994c('0x30')](_0x26a27e['model'],_0x26a27e[_0x994c('0x2d')]);_0x9bb112[_0x994c('0x31')]=_[_0x994c('0x30')](_0x26a27e[_0x994c('0x2c')],qs[_0x994c('0x32')](_0x327b94[_0x994c('0x2d')][_0x994c('0x32')]));_0x9bb112[_0x994c('0x31')]=_0x9bb112[_0x994c('0x31')][_0x994c('0x33')]?_0x9bb112[_0x994c('0x31')]:_0x26a27e['model'];if(!_0x327b94[_0x994c('0x2d')][_0x994c('0x34')]('nolimit')){_0x9bb112[_0x994c('0x17')]=qs[_0x994c('0x17')](_0x327b94[_0x994c('0x2d')]['limit']);_0x9bb112[_0x994c('0x16')]=qs[_0x994c('0x16')](_0x327b94[_0x994c('0x2d')][_0x994c('0x16')]);}_0x9bb112['order']=qs[_0x994c('0x35')](_0x327b94[_0x994c('0x2d')][_0x994c('0x35')]);_0x9bb112[_0x994c('0x36')]=qs[_0x994c('0x2f')](_['pick'](_0x327b94[_0x994c('0x2d')],_0x26a27e[_0x994c('0x2f')]),_0x238989);if(_0x327b94[_0x994c('0x2d')][_0x994c('0x37')]){_0x9bb112[_0x994c('0x36')]=_[_0x994c('0x38')](_0x9bb112[_0x994c('0x36')],{'$or':_['map'](_0x238989,function(_0x4b9d6d){if(_0x4b9d6d[_0x994c('0x2a')]!==_0x994c('0x39')){var _0x42f383={};_0x42f383[_0x4b9d6d[_0x994c('0x24')]]={'$like':'%'+_0x327b94[_0x994c('0x2d')][_0x994c('0x37')]+'%'};return _0x42f383;}})});}_0x9bb112=_[_0x994c('0x38')]({},_0x9bb112,_0x327b94[_0x994c('0x3a')]);var _0x10a4d6={'where':_0x9bb112['where']};return db[_0x994c('0x28')][_0x994c('0x19')](_0x10a4d6)[_0x994c('0x1c')](function(_0x51a291){_0xdfab08[_0x994c('0x19')]=_0x51a291;if(_0x327b94['query'][_0x994c('0x3b')]){_0x9bb112[_0x994c('0x3c')]=[{'all':!![]}];}return db[_0x994c('0x28')][_0x994c('0x3d')](_0x9bb112);})[_0x994c('0x1c')](function(_0x347b2d){_0xdfab08[_0x994c('0x3e')]=_0x347b2d;return _0xdfab08;})[_0x994c('0x1c')](respondWithFilteredResult(_0x822fd4,_0x9bb112))['catch'](handleError(_0x822fd4,null));};exports[_0x994c('0x3f')]=function(_0xc106fe,_0x3b26ec){var _0x5adbc6={'raw':![],'where':{'id':_0xc106fe[_0x994c('0x40')]['id']}},_0xa6f632={};_0xa6f632['model']=_[_0x994c('0x2e')](db['Campaign'][_0x994c('0x41')]);_0xa6f632[_0x994c('0x2d')]=_['keys'](_0xc106fe[_0x994c('0x2d')]);_0xa6f632[_0x994c('0x2f')]=_[_0x994c('0x30')](_0xa6f632[_0x994c('0x2c')],_0xa6f632['query']);_0x5adbc6[_0x994c('0x31')]=_[_0x994c('0x30')](_0xa6f632[_0x994c('0x2c')],qs[_0x994c('0x32')](_0xc106fe[_0x994c('0x2d')][_0x994c('0x32')]));_0x5adbc6[_0x994c('0x31')]=_0x5adbc6['attributes'][_0x994c('0x33')]?_0x5adbc6['attributes']:_0xa6f632[_0x994c('0x2c')];if(_0xc106fe[_0x994c('0x2d')][_0x994c('0x3b')]){_0x5adbc6[_0x994c('0x3c')]=[{'all':!![]}];}_0x5adbc6=_['merge']({},_0x5adbc6,_0xc106fe[_0x994c('0x3a')]);return db[_0x994c('0x28')][_0x994c('0x42')](_0x5adbc6)[_0x994c('0x1c')](handleEntityNotFound(_0x3b26ec,null))['then'](respondWithResult(_0x3b26ec,null))[_0x994c('0x43')](handleError(_0x3b26ec,null));};exports[_0x994c('0x44')]=function(_0xc1d383,_0x18667e){return db[_0x994c('0x28')][_0x994c('0x44')](_0xc1d383[_0x994c('0x45')],{})[_0x994c('0x1c')](function(_0x54f01b){var _0x29ca1c=_0xc1d383[_0x994c('0x46')]['get']({'plain':!![]});if(!_0x29ca1c)throw new Error(_0x994c('0x47'));if(_0x29ca1c[_0x994c('0x48')]===_0x994c('0x46')){var _0xc25e99=_0x54f01b[_0x994c('0x1e')]({'plain':!![]});var _0x11a417=_0x994c('0x1f');return db['UserProfileSection'][_0x994c('0x42')]({'where':{'name':_0x11a417,'userProfileId':_0x29ca1c[_0x994c('0x49')]},'raw':!![]})[_0x994c('0x1c')](function(_0x5e02c5){if(_0x5e02c5&&_0x5e02c5[_0x994c('0x4a')]===0x0){return db[_0x994c('0x20')][_0x994c('0x44')]({'name':_0xc25e99[_0x994c('0x24')],'resourceId':_0xc25e99['id'],'type':_0x5e02c5[_0x994c('0x24')],'sectionId':_0x5e02c5['id']},{})['then'](function(){return _0x54f01b;});}else{return _0x54f01b;}})[_0x994c('0x43')](function(_0x5766b2){logger[_0x994c('0x23')](_0x994c('0x4b'),_0x5766b2);throw _0x5766b2;});}return _0x54f01b;})[_0x994c('0x1c')](respondWithResult(_0x18667e,0xc9))['catch'](handleError(_0x18667e,null));};exports[_0x994c('0x4c')]=function(_0x560c37,_0x418b3f){var _0x159b26={'where':{'id':_0x560c37[_0x994c('0x40')]['id']}},_0x3e2e01={};_0x3e2e01[_0x994c('0x2c')]=_[_0x994c('0x2e')](db[_0x994c('0x28')]['rawAttributes']);_0x159b26[_0x994c('0x31')]=_[_0x994c('0x30')](_0x3e2e01['model'],qs[_0x994c('0x32')](_0x560c37[_0x994c('0x2d')]['fields']));_0x159b26[_0x994c('0x31')]=_0x159b26[_0x994c('0x31')]['length']?_0x159b26[_0x994c('0x31')]:_0x3e2e01[_0x994c('0x2c')];if(_0x560c37[_0x994c('0x2d')][_0x994c('0x3b')]){_0x159b26['include']=[{'all':!![]}];}_0x159b26=_['merge']({},_0x159b26,_0x560c37[_0x994c('0x3a')]);return db[_0x994c('0x28')][_0x994c('0x42')](_0x159b26)[_0x994c('0x1c')](handleEntityNotFound(_0x418b3f,null))[_0x994c('0x1c')](function(_0x4294c7){if(_0x4294c7){var _0x4958bb=_0x4294c7['get']({'plain':!![]});_0x4958bb=qs[_0x994c('0x4d')](_0x4958bb,['id','createdAt','updatedAt']);_0x560c37['body']=_[_0x994c('0x4d')](_0x560c37['body'],['id',_0x994c('0x4e'),_0x994c('0x4f')]);return db[_0x994c('0x28')][_0x994c('0x44')](_[_0x994c('0x38')](_0x4958bb,_0x560c37['body']),{'include':_0x560c37[_0x994c('0x2d')][_0x994c('0x3b')]?[{'all':!![]}]:undefined})[_0x994c('0x1c')](function(_0x391756){var _0x419c9d=_0x560c37[_0x994c('0x46')][_0x994c('0x1e')]({'plain':!![]});if(!_0x419c9d)throw new Error(_0x994c('0x47'));if(_0x419c9d[_0x994c('0x48')]===_0x994c('0x46')){var _0x4753c7=_0x391756[_0x994c('0x1e')]({'plain':!![]});var _0x264cd6=_0x994c('0x1f');return db[_0x994c('0x50')]['find']({'where':{'name':_0x264cd6,'userProfileId':_0x419c9d['userProfileId']},'raw':!![]})[_0x994c('0x1c')](function(_0x521c74){if(_0x521c74&&_0x521c74['autoAssociation']===0x0){return db[_0x994c('0x20')]['create']({'name':_0x4753c7[_0x994c('0x24')],'resourceId':_0x4753c7['id'],'type':_0x521c74[_0x994c('0x24')],'sectionId':_0x521c74['id']},{})['then'](function(){return _0x391756;});}else{return _0x391756;}})[_0x994c('0x43')](function(_0x833477){logger[_0x994c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x833477);throw _0x833477;});}return _0x391756;});}})[_0x994c('0x1c')](respondWithResult(_0x418b3f,0xc9))[_0x994c('0x43')](handleError(_0x418b3f,null));};exports[_0x994c('0x51')]=function(_0x224e9c,_0x6fc99f){if(_0x224e9c[_0x994c('0x45')]['id']){delete _0x224e9c[_0x994c('0x45')]['id'];}return db['Campaign']['find']({'where':{'id':_0x224e9c['params']['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x6fc99f,null))[_0x994c('0x1c')](saveUpdates(_0x224e9c[_0x994c('0x45')],null))['then'](respondWithResult(_0x6fc99f,null))[_0x994c('0x43')](handleError(_0x6fc99f,null));};exports[_0x994c('0x1d')]=function(_0x4da13e,_0x48b4d9){return db[_0x994c('0x28')][_0x994c('0x42')]({'where':{'id':_0x4da13e[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x48b4d9,null))[_0x994c('0x1c')](removeEntity(_0x48b4d9,null))[_0x994c('0x43')](handleError(_0x48b4d9,null));};exports[_0x994c('0x52')]=function(_0x3a420,_0x31e6d5,_0x54c6f3){var _0x3c33a8={'raw':!![],'where':{}};var _0x45274a={};var _0x24e60a={'count':0x0,'rows':[]};return db[_0x994c('0x28')][_0x994c('0x53')]({'where':{'id':_0x3a420[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x31e6d5,null))[_0x994c('0x1c')](function(_0x379218){if(_0x379218){_0x45274a[_0x994c('0x2c')]=_[_0x994c('0x2e')](db[_0x994c('0x54')][_0x994c('0x41')]);_0x45274a[_0x994c('0x2d')]=_[_0x994c('0x2e')](_0x3a420[_0x994c('0x2d')]);_0x45274a[_0x994c('0x2f')]=_[_0x994c('0x30')](_0x45274a[_0x994c('0x2c')],_0x45274a[_0x994c('0x2d')]);_0x3c33a8[_0x994c('0x31')]=_[_0x994c('0x30')](_0x45274a[_0x994c('0x2c')],qs[_0x994c('0x32')](_0x3a420[_0x994c('0x2d')][_0x994c('0x32')]));_0x3c33a8[_0x994c('0x31')]=_0x3c33a8[_0x994c('0x31')][_0x994c('0x33')]?_0x3c33a8[_0x994c('0x31')]:_0x45274a[_0x994c('0x2c')];if(!_0x3a420[_0x994c('0x2d')][_0x994c('0x34')]('nolimit')){_0x3c33a8[_0x994c('0x17')]=qs[_0x994c('0x17')](_0x3a420[_0x994c('0x2d')][_0x994c('0x17')]);_0x3c33a8[_0x994c('0x16')]=qs[_0x994c('0x16')](_0x3a420[_0x994c('0x2d')][_0x994c('0x16')]);}_0x3c33a8[_0x994c('0x55')]=qs['sort'](_0x3a420[_0x994c('0x2d')][_0x994c('0x35')]);_0x3c33a8['where']=qs[_0x994c('0x2f')](_[_0x994c('0x56')](_0x3a420[_0x994c('0x2d')],_0x45274a[_0x994c('0x2f')]));_0x3c33a8[_0x994c('0x36')][_0x994c('0x57')]=_0x379218['id'];if(_0x3a420[_0x994c('0x2d')][_0x994c('0x37')]){_0x3c33a8['where']=_['merge'](_0x3c33a8[_0x994c('0x36')],{'$or':_[_0x994c('0x27')](_0x3c33a8[_0x994c('0x31')],function(_0x1a7da5){var _0x2d584c={};_0x2d584c[_0x1a7da5]={'$like':'%'+_0x3a420[_0x994c('0x2d')][_0x994c('0x37')]+'%'};return _0x2d584c;})});}_0x3c33a8=_[_0x994c('0x38')]({},_0x3c33a8,_0x3a420[_0x994c('0x3a')]);return db[_0x994c('0x54')]['count']({'where':_0x3c33a8[_0x994c('0x36')]})[_0x994c('0x1c')](function(_0x7871b){_0x24e60a[_0x994c('0x19')]=_0x7871b;if(_0x3a420['query'][_0x994c('0x3b')]){_0x3c33a8['include']=[{'all':!![]}];}return db[_0x994c('0x54')][_0x994c('0x3d')](_0x3c33a8);})[_0x994c('0x1c')](function(_0x1bb164){_0x24e60a[_0x994c('0x3e')]=_0x1bb164;return _0x24e60a;});}})['then'](respondWithFilteredResult(_0x31e6d5,_0x3c33a8))[_0x994c('0x43')](handleError(_0x31e6d5,null));};exports['getHopperHistories']=function(_0x20eedb,_0x400ed3,_0x25e389){var _0x18be97={'raw':!![],'where':{}};var _0x2700e9={};var _0x131a5b={'count':0x0,'rows':[]};return db[_0x994c('0x28')][_0x994c('0x53')]({'where':{'id':_0x20eedb[_0x994c('0x40')]['id']}})['then'](handleEntityNotFound(_0x400ed3,null))['then'](function(_0x26a15d){if(_0x26a15d){_0x2700e9[_0x994c('0x2c')]=_[_0x994c('0x2e')](db[_0x994c('0x58')]['rawAttributes']);_0x2700e9[_0x994c('0x2d')]=_[_0x994c('0x2e')](_0x20eedb['query']);_0x2700e9[_0x994c('0x2f')]=_[_0x994c('0x30')](_0x2700e9['model'],_0x2700e9['query']);_0x18be97[_0x994c('0x31')]=_[_0x994c('0x30')](_0x2700e9[_0x994c('0x2c')],qs[_0x994c('0x32')](_0x20eedb[_0x994c('0x2d')][_0x994c('0x32')]));_0x18be97['attributes']=_0x18be97[_0x994c('0x31')][_0x994c('0x33')]?_0x18be97[_0x994c('0x31')]:_0x2700e9['model'];if(!_0x20eedb[_0x994c('0x2d')]['hasOwnProperty'](_0x994c('0x59'))){_0x18be97[_0x994c('0x17')]=qs['limit'](_0x20eedb[_0x994c('0x2d')]['limit']);_0x18be97[_0x994c('0x16')]=qs['offset'](_0x20eedb['query'][_0x994c('0x16')]);}_0x18be97[_0x994c('0x55')]=qs[_0x994c('0x35')](_0x20eedb[_0x994c('0x2d')][_0x994c('0x35')]);_0x18be97[_0x994c('0x36')]=qs[_0x994c('0x2f')](_[_0x994c('0x56')](_0x20eedb[_0x994c('0x2d')],_0x2700e9['filters']));_0x18be97[_0x994c('0x36')]['CampaignId']=_0x26a15d['id'];if(_0x20eedb[_0x994c('0x2d')][_0x994c('0x37')]){_0x18be97[_0x994c('0x36')]=_[_0x994c('0x38')](_0x18be97['where'],{'$or':_[_0x994c('0x27')](_0x18be97[_0x994c('0x31')],function(_0x52fee5){var _0x151c16={};_0x151c16[_0x52fee5]={'$like':'%'+_0x20eedb[_0x994c('0x2d')][_0x994c('0x37')]+'%'};return _0x151c16;})});}_0x18be97=_[_0x994c('0x38')]({},_0x18be97,_0x20eedb['options']);return db[_0x994c('0x58')][_0x994c('0x19')]({'where':_0x18be97[_0x994c('0x36')]})[_0x994c('0x1c')](function(_0x284eb9){_0x131a5b['count']=_0x284eb9;if(_0x20eedb[_0x994c('0x2d')][_0x994c('0x3b')]){_0x18be97[_0x994c('0x3c')]=[{'all':!![]}];}return db[_0x994c('0x58')][_0x994c('0x3d')](_0x18be97);})[_0x994c('0x1c')](function(_0x600dea){_0x131a5b[_0x994c('0x3e')]=_0x600dea;return _0x131a5b;});}})[_0x994c('0x1c')](respondWithFilteredResult(_0x400ed3,_0x18be97))[_0x994c('0x43')](handleError(_0x400ed3,null));};exports['getHopperFinals']=function(_0x392b5a,_0xec3f8f,_0x393146){var _0x245790={'raw':!![],'where':{}};var _0x1aeb60={};var _0x5488df={'count':0x0,'rows':[]};return db[_0x994c('0x28')][_0x994c('0x53')]({'where':{'id':_0x392b5a[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0xec3f8f,null))[_0x994c('0x1c')](function(_0x48fbe8){if(_0x48fbe8){_0x1aeb60['model']=_[_0x994c('0x2e')](db[_0x994c('0x5a')][_0x994c('0x41')]);_0x1aeb60['query']=_[_0x994c('0x2e')](_0x392b5a[_0x994c('0x2d')]);_0x1aeb60[_0x994c('0x2f')]=_[_0x994c('0x30')](_0x1aeb60['model'],_0x1aeb60['query']);_0x245790['attributes']=_[_0x994c('0x30')](_0x1aeb60['model'],qs[_0x994c('0x32')](_0x392b5a['query'][_0x994c('0x32')]));_0x245790[_0x994c('0x31')]=_0x245790[_0x994c('0x31')][_0x994c('0x33')]?_0x245790[_0x994c('0x31')]:_0x1aeb60['model'];if(!_0x392b5a[_0x994c('0x2d')][_0x994c('0x34')](_0x994c('0x59'))){_0x245790['limit']=qs[_0x994c('0x17')](_0x392b5a['query'][_0x994c('0x17')]);_0x245790[_0x994c('0x16')]=qs[_0x994c('0x16')](_0x392b5a[_0x994c('0x2d')]['offset']);}_0x245790[_0x994c('0x55')]=qs[_0x994c('0x35')](_0x392b5a['query']['sort']);_0x245790[_0x994c('0x36')]=qs[_0x994c('0x2f')](_[_0x994c('0x56')](_0x392b5a[_0x994c('0x2d')],_0x1aeb60[_0x994c('0x2f')]));_0x245790[_0x994c('0x36')]['CampaignId']=_0x48fbe8['id'];if(_0x392b5a[_0x994c('0x2d')][_0x994c('0x37')]){_0x245790[_0x994c('0x36')]=_[_0x994c('0x38')](_0x245790[_0x994c('0x36')],{'$or':_['map'](_0x245790[_0x994c('0x31')],function(_0x314a9c){var _0x2cb18c={};_0x2cb18c[_0x314a9c]={'$like':'%'+_0x392b5a[_0x994c('0x2d')]['filter']+'%'};return _0x2cb18c;})});}_0x245790=_[_0x994c('0x38')]({},_0x245790,_0x392b5a[_0x994c('0x3a')]);return db[_0x994c('0x5a')][_0x994c('0x19')]({'where':_0x245790[_0x994c('0x36')]})[_0x994c('0x1c')](function(_0x1ceb42){_0x5488df[_0x994c('0x19')]=_0x1ceb42;if(_0x392b5a[_0x994c('0x2d')][_0x994c('0x3b')]){_0x245790[_0x994c('0x3c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x994c('0x3d')](_0x245790);})[_0x994c('0x1c')](function(_0x17d526){_0x5488df[_0x994c('0x3e')]=_0x17d526;return _0x5488df;});}})[_0x994c('0x1c')](respondWithFilteredResult(_0xec3f8f,_0x245790))[_0x994c('0x43')](handleError(_0xec3f8f,null));};exports[_0x994c('0x5b')]=function(_0x4e8a04,_0x13b8d9,_0x314dfc){var _0x517925={'raw':!![],'where':{}};var _0x2a1bb2={};var _0x29feff={'count':0x0,'rows':[]};return db['Campaign'][_0x994c('0x53')]({'where':{'id':_0x4e8a04['params']['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x13b8d9,null))[_0x994c('0x1c')](function(_0x415f3b){if(_0x415f3b){_0x2a1bb2[_0x994c('0x2c')]=_['keys'](db[_0x994c('0x5c')][_0x994c('0x41')]);_0x2a1bb2[_0x994c('0x2d')]=_['keys'](_0x4e8a04[_0x994c('0x2d')]);_0x2a1bb2[_0x994c('0x2f')]=_[_0x994c('0x30')](_0x2a1bb2[_0x994c('0x2c')],_0x2a1bb2[_0x994c('0x2d')]);_0x517925[_0x994c('0x31')]=_[_0x994c('0x30')](_0x2a1bb2[_0x994c('0x2c')],qs[_0x994c('0x32')](_0x4e8a04['query'][_0x994c('0x32')]));_0x517925['attributes']=_0x517925[_0x994c('0x31')][_0x994c('0x33')]?_0x517925[_0x994c('0x31')]:_0x2a1bb2[_0x994c('0x2c')];if(!_0x4e8a04[_0x994c('0x2d')][_0x994c('0x34')](_0x994c('0x59'))){_0x517925[_0x994c('0x17')]=qs['limit'](_0x4e8a04[_0x994c('0x2d')][_0x994c('0x17')]);_0x517925['offset']=qs[_0x994c('0x16')](_0x4e8a04[_0x994c('0x2d')]['offset']);}_0x517925[_0x994c('0x55')]=qs['sort'](_0x4e8a04[_0x994c('0x2d')][_0x994c('0x35')]);_0x517925[_0x994c('0x36')]=qs[_0x994c('0x2f')](_[_0x994c('0x56')](_0x4e8a04[_0x994c('0x2d')],_0x2a1bb2[_0x994c('0x2f')]));_0x517925[_0x994c('0x36')]['CampaignId']=_0x415f3b['id'];if(_0x4e8a04[_0x994c('0x2d')][_0x994c('0x37')]){_0x517925[_0x994c('0x36')]=_['merge'](_0x517925[_0x994c('0x36')],{'$or':_[_0x994c('0x27')](_0x517925['attributes'],function(_0xbfb956){var _0x1f6a5a={};_0x1f6a5a[_0xbfb956]={'$like':'%'+_0x4e8a04[_0x994c('0x2d')][_0x994c('0x37')]+'%'};return _0x1f6a5a;})});}_0x517925=_[_0x994c('0x38')]({},_0x517925,_0x4e8a04[_0x994c('0x3a')]);return db[_0x994c('0x5c')][_0x994c('0x19')]({'where':_0x517925[_0x994c('0x36')]})['then'](function(_0x35b581){_0x29feff[_0x994c('0x19')]=_0x35b581;if(_0x4e8a04[_0x994c('0x2d')][_0x994c('0x3b')]){_0x517925[_0x994c('0x3c')]=[{'all':!![]}];}return db[_0x994c('0x5c')][_0x994c('0x3d')](_0x517925);})[_0x994c('0x1c')](function(_0x57aa10){_0x29feff[_0x994c('0x3e')]=_0x57aa10;return _0x29feff;});}})[_0x994c('0x1c')](respondWithFilteredResult(_0x13b8d9,_0x517925))[_0x994c('0x43')](handleError(_0x13b8d9,null));};exports[_0x994c('0x5d')]=function(_0x4b5e8b,_0x4e2e4,_0x3353ef){var _0x3e8f3c={};var _0xaa6a47={};var _0x552993;var _0x4b58e3;return db[_0x994c('0x28')][_0x994c('0x53')]({'where':{'id':_0x4b5e8b[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x4e2e4,null))['then'](function(_0x1391f9){if(_0x1391f9){_0x552993=_0x1391f9;_0xaa6a47[_0x994c('0x2c')]=_[_0x994c('0x2e')](db[_0x994c('0x5e')][_0x994c('0x41')]);_0xaa6a47[_0x994c('0x2d')]=_['keys'](_0x4b5e8b[_0x994c('0x2d')]);_0xaa6a47[_0x994c('0x2f')]=_[_0x994c('0x30')](_0xaa6a47[_0x994c('0x2c')],_0xaa6a47['query']);_0x3e8f3c['attributes']=_[_0x994c('0x30')](_0xaa6a47[_0x994c('0x2c')],qs['fields'](_0x4b5e8b['query'][_0x994c('0x32')]));_0x3e8f3c['attributes']=_0x3e8f3c[_0x994c('0x31')][_0x994c('0x33')]?_0x3e8f3c[_0x994c('0x31')]:_0xaa6a47[_0x994c('0x2c')];_0x3e8f3c[_0x994c('0x55')]=qs[_0x994c('0x35')](_0x4b5e8b['query']['sort']);_0x3e8f3c[_0x994c('0x36')]=qs['filters'](_[_0x994c('0x56')](_0x4b5e8b[_0x994c('0x2d')],_0xaa6a47[_0x994c('0x2f')]));if(_0x4b5e8b[_0x994c('0x2d')][_0x994c('0x37')]){_0x3e8f3c[_0x994c('0x36')]=_[_0x994c('0x38')](_0x3e8f3c[_0x994c('0x36')],{'$or':_['map'](_0x3e8f3c[_0x994c('0x31')],function(_0x3552d0){var _0x1da2a7={};_0x1da2a7[_0x3552d0]={'$like':'%'+_0x4b5e8b[_0x994c('0x2d')]['filter']+'%'};return _0x1da2a7;})});}_0x3e8f3c=_['merge']({},_0x3e8f3c,_0x4b5e8b[_0x994c('0x3a')]);return _0x552993['getLists'](_0x3e8f3c);}})[_0x994c('0x1c')](function(_0x24bc19){if(_0x24bc19){_0x4b58e3=_0x24bc19[_0x994c('0x33')];if(!_0x4b5e8b['query'][_0x994c('0x34')](_0x994c('0x59'))){_0x3e8f3c[_0x994c('0x17')]=qs[_0x994c('0x17')](_0x4b5e8b['query'][_0x994c('0x17')]);_0x3e8f3c[_0x994c('0x16')]=qs['offset'](_0x4b5e8b[_0x994c('0x2d')][_0x994c('0x16')]);}return _0x552993[_0x994c('0x5d')](_0x3e8f3c);}})[_0x994c('0x1c')](function(_0x3c5cd7){if(_0x3c5cd7){return _0x3c5cd7?{'count':_0x4b58e3,'rows':_0x3c5cd7}:null;}})[_0x994c('0x1c')](respondWithResult(_0x4e2e4,null))[_0x994c('0x43')](handleError(_0x4e2e4,null));};exports[_0x994c('0x5f')]=function(_0x2993a7,_0x165963,_0x56a5b2){var _0x4dcf15,_0x4f5380;var _0x142ad7=[];var _0x481721=moment()[_0x994c('0x60')](_0x994c('0x61'));return db[_0x994c('0x28')][_0x994c('0x42')]({'where':{'id':_0x2993a7['params']['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x165963,null))[_0x994c('0x1c')](function(_0x4d8a95){if(_0x4d8a95){_0x4f5380=_0x4d8a95;return _0x4d8a95[_0x994c('0x5f')](_0x2993a7[_0x994c('0x45')][_0x994c('0x62')],_[_0x994c('0x4d')](_0x2993a7[_0x994c('0x45')],[_0x994c('0x62'),'id'])||{});}return null;})[_0x994c('0x63')](function(_0x4ca1aa){var _0x13b831;var _0x29ffcb;_0x4dcf15=_0x4ca1aa||[];var _0x3c75c9=[];if(_0x4ca1aa){for(var _0x342c97=0x0;_0x342c97<_0x4ca1aa[_0x994c('0x33')];_0x342c97+=0x1){var _0x190e48=_0x4ca1aa[_0x342c97]['get']({'plain':!![]});_0x4f5380[_0x994c('0x64')]=_0x2993a7['body'][_0x994c('0x64')]?_0x2993a7[_0x994c('0x45')][_0x994c('0x64')]:_0x4f5380[_0x994c('0x64')];switch(_0x4f5380[_0x994c('0x64')]){case _0x994c('0x65'):_0x13b831=squel[_0x994c('0x66')]()['into'](_0x994c('0x67'))[_0x994c('0x68')]([_0x994c('0x69'),_0x994c('0x6a'),_0x994c('0x6b'),_0x994c('0x6c'),_0x994c('0x57'),_0x994c('0x4e'),_0x994c('0x4f')],squel['select']()[_0x994c('0x6d')](_0x994c('0x69'),'phone')['field'](_0x994c('0x6e'),'scheduledAt')[_0x994c('0x6d')]('id',_0x994c('0x6b'))[_0x994c('0x6d')](_0x190e48[_0x994c('0x6f')][_0x994c('0x70')](),_0x994c('0x6c'))[_0x994c('0x6d')](_0x2993a7[_0x994c('0x40')]['id'][_0x994c('0x70')](),_0x994c('0x57'))[_0x994c('0x6d')]('\x27'+_0x481721+'\x27',_0x994c('0x4e'))['field']('\x27'+_0x481721+'\x27','updatedAt')['from'](_0x994c('0x71'))['where'](_0x994c('0x72'))['where'](_0x994c('0x73'),_0x190e48['CmListId'][_0x994c('0x70')]())[_0x994c('0x36')](_0x994c('0x74'))[_0x994c('0x36')](_0x994c('0x75'),squel[_0x994c('0x76')]()[_0x994c('0x6d')](_0x994c('0x77'))[_0x994c('0x78')]('cm_hopper_final')[_0x994c('0x36')](_0x994c('0x79'),_0x2993a7['params']['id'][_0x994c('0x70')]()))[_0x994c('0x36')](_0x994c('0x75'),squel[_0x994c('0x76')]()[_0x994c('0x6d')](_0x994c('0x7a'))['from'](_0x994c('0x67'))[_0x994c('0x36')](_0x994c('0x79'),_0x2993a7[_0x994c('0x40')]['id'][_0x994c('0x70')]())))[_0x994c('0x70')]();break;case'onlyIfOpen':_0x13b831=squel[_0x994c('0x66')]()[_0x994c('0x7b')]('cm_hopper')[_0x994c('0x68')]([_0x994c('0x69'),_0x994c('0x6a'),_0x994c('0x6b'),_0x994c('0x6c'),_0x994c('0x57'),_0x994c('0x4e'),_0x994c('0x4f')],squel[_0x994c('0x76')]()[_0x994c('0x6d')](_0x994c('0x69'),_0x994c('0x69'))[_0x994c('0x6d')]('NOW()',_0x994c('0x6a'))[_0x994c('0x6d')]('id',_0x994c('0x6b'))[_0x994c('0x6d')](_0x190e48[_0x994c('0x6f')]['toString'](),_0x994c('0x6c'))['field'](_0x2993a7[_0x994c('0x40')]['id'][_0x994c('0x70')](),'CampaignId')[_0x994c('0x6d')]('\x27'+_0x481721+'\x27',_0x994c('0x4e'))[_0x994c('0x6d')]('\x27'+_0x481721+'\x27','updatedAt')[_0x994c('0x78')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x994c('0x73'),_0x190e48[_0x994c('0x6f')][_0x994c('0x70')]())[_0x994c('0x36')]('phone\x20IS\x20NOT\x20NULL')[_0x994c('0x36')](_0x994c('0x75'),squel[_0x994c('0x76')]()[_0x994c('0x6d')](_0x994c('0x7a'))[_0x994c('0x78')]('cm_hopper')[_0x994c('0x36')](_0x994c('0x79'),_0x2993a7[_0x994c('0x40')]['id'][_0x994c('0x70')]())))[_0x994c('0x70')]();break;default:_0x13b831=squel['insert']()[_0x994c('0x7b')](_0x994c('0x67'))[_0x994c('0x68')](['phone',_0x994c('0x6a'),_0x994c('0x6b'),_0x994c('0x6c'),'CampaignId',_0x994c('0x4e'),'updatedAt'],squel[_0x994c('0x76')]()[_0x994c('0x6d')](_0x994c('0x69'),_0x994c('0x69'))[_0x994c('0x6d')](_0x994c('0x6e'),_0x994c('0x6a'))['field']('id',_0x994c('0x6b'))[_0x994c('0x6d')](_0x190e48[_0x994c('0x6f')][_0x994c('0x70')](),_0x994c('0x6c'))['field'](_0x2993a7['params']['id']['toString'](),_0x994c('0x57'))['field']('\x27'+_0x481721+'\x27',_0x994c('0x4e'))[_0x994c('0x6d')]('\x27'+_0x481721+'\x27',_0x994c('0x4f'))[_0x994c('0x78')](_0x994c('0x71'))[_0x994c('0x36')](_0x994c('0x72'))[_0x994c('0x36')]('ListId\x20=\x20?',_0x190e48[_0x994c('0x6f')]['toString']())[_0x994c('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0x994c('0x70')]();}_0x29ffcb=squel[_0x994c('0x66')]()[_0x994c('0x7b')](_0x994c('0x7c'))['fromQuery'](['cmHopperId',_0x994c('0x6a'),_0x994c('0x69'),'OrderBy',_0x994c('0x4e'),_0x994c('0x4f')],squel[_0x994c('0x76')]()[_0x994c('0x6d')](_0x994c('0x7d'),'id')[_0x994c('0x6d')](_0x994c('0x6e'),_0x994c('0x6a'))['field'](_0x994c('0x7e'),_0x994c('0x69'))[_0x994c('0x6d')](_0x994c('0x7f'),_0x994c('0x80'))[_0x994c('0x6d')]('\x27'+_0x481721+'\x27','createdAt')['field']('\x27'+_0x481721+'\x27',_0x994c('0x4f'))[_0x994c('0x78')](_0x994c('0x81'),'ci')[_0x994c('0x82')](_0x994c('0x67'),'h',_0x994c('0x83'))[_0x994c('0x36')](_0x994c('0x84'),_0x190e48[_0x994c('0x6f')]['toString']())[_0x994c('0x36')]('h.CampaignId=?',_0x2993a7['params']['id'][_0x994c('0x70')]())[_0x994c('0x36')](_0x994c('0x85'),_0x481721))[_0x994c('0x70')]();_0x3c75c9[_0x994c('0x86')](db[_0x994c('0x87')][_0x994c('0x2d')](_0x13b831));_0x142ad7[_0x994c('0x86')](db['sequelize'][_0x994c('0x2d')](_0x29ffcb));}return BPromise[_0x994c('0x88')](_0x3c75c9);}})['then'](function(){return BPromise[_0x994c('0x88')](_0x142ad7);})['then'](function(){return _0x4dcf15;})[_0x994c('0x1c')](respondWithResult(_0x165963,null))[_0x994c('0x43')](handleError(_0x165963,null));};exports[_0x994c('0x89')]=function(_0x11b207,_0x1fdf26,_0x51a493){return db[_0x994c('0x28')][_0x994c('0x42')]({'where':{'id':_0x11b207[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x1fdf26,null))[_0x994c('0x1c')](function(_0x5317fd){if(_0x5317fd){return _0x5317fd[_0x994c('0x89')](_0x11b207['query']['ids']);}})['then'](function(_0x48472b){if(_0x48472b){return db[_0x994c('0x54')][_0x994c('0x1d')]({'where':{'ListId':_0x11b207[_0x994c('0x2d')][_0x994c('0x62')],'CampaignId':_0x11b207['params']['id']}})[_0x994c('0x1c')](function(){return _0x48472b;});}})['then'](respondWithStatusCode(_0x1fdf26,null))[_0x994c('0x43')](handleError(_0x1fdf26,null));};exports[_0x994c('0x8a')]=function(_0x17a8ac,_0x152600,_0x1fe9bd){var _0x782510={};var _0x2bd086={};var _0x5c549f;var _0x2d5a10;return db['Campaign']['findOne']({'where':{'id':_0x17a8ac[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x152600,null))['then'](function(_0x523489){if(_0x523489){_0x5c549f=_0x523489;_0x2bd086[_0x994c('0x2c')]=_['keys'](db[_0x994c('0x5e')]['rawAttributes']);_0x2bd086[_0x994c('0x2d')]=_[_0x994c('0x2e')](_0x17a8ac[_0x994c('0x2d')]);_0x2bd086[_0x994c('0x2f')]=_['intersection'](_0x2bd086[_0x994c('0x2c')],_0x2bd086[_0x994c('0x2d')]);_0x782510[_0x994c('0x31')]=_['intersection'](_0x2bd086[_0x994c('0x2c')],qs[_0x994c('0x32')](_0x17a8ac[_0x994c('0x2d')]['fields']));_0x782510['attributes']=_0x782510[_0x994c('0x31')]['length']?_0x782510[_0x994c('0x31')]:_0x2bd086[_0x994c('0x2c')];_0x782510[_0x994c('0x55')]=qs[_0x994c('0x35')](_0x17a8ac[_0x994c('0x2d')][_0x994c('0x35')]);_0x782510['where']=qs[_0x994c('0x2f')](_[_0x994c('0x56')](_0x17a8ac[_0x994c('0x2d')],_0x2bd086['filters']));if(_0x17a8ac[_0x994c('0x2d')][_0x994c('0x37')]){_0x782510[_0x994c('0x36')]=_[_0x994c('0x38')](_0x782510[_0x994c('0x36')],{'$or':_[_0x994c('0x27')](_0x782510[_0x994c('0x31')],function(_0x502108){var _0x3bdcf0={};_0x3bdcf0[_0x502108]={'$like':'%'+_0x17a8ac[_0x994c('0x2d')][_0x994c('0x37')]+'%'};return _0x3bdcf0;})});}_0x782510=_[_0x994c('0x38')]({},_0x782510,_0x17a8ac[_0x994c('0x3a')]);return _0x5c549f[_0x994c('0x8a')](_0x782510);}})['then'](function(_0x13526e){if(_0x13526e){_0x2d5a10=_0x13526e[_0x994c('0x33')];if(!_0x17a8ac[_0x994c('0x2d')][_0x994c('0x34')](_0x994c('0x59'))){_0x782510[_0x994c('0x17')]=qs[_0x994c('0x17')](_0x17a8ac[_0x994c('0x2d')][_0x994c('0x17')]);_0x782510['offset']=qs[_0x994c('0x16')](_0x17a8ac[_0x994c('0x2d')][_0x994c('0x16')]);}return _0x5c549f['getBlackLists'](_0x782510);}})[_0x994c('0x1c')](function(_0x3e0cbe){if(_0x3e0cbe){return _0x3e0cbe?{'count':_0x2d5a10,'rows':_0x3e0cbe}:null;}})['then'](respondWithResult(_0x152600,null))['catch'](handleError(_0x152600,null));};exports['addBlackLists']=function(_0x549ab6,_0x4b6478,_0x24db91){var _0x28e2eb,_0x362d8e;var _0xa7363e=[];var _0x57c342=moment()[_0x994c('0x60')](_0x994c('0x61'));return db['Campaign']['find']({'where':{'id':_0x549ab6[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x4b6478,null))[_0x994c('0x1c')](function(_0x34bcbf){if(_0x34bcbf){_0x362d8e=_0x34bcbf;return _0x34bcbf[_0x994c('0x8b')](_0x549ab6[_0x994c('0x45')][_0x994c('0x62')],_[_0x994c('0x4d')](_0x549ab6['body'],[_0x994c('0x62'),'id'])||{});}return null;})[_0x994c('0x63')](function(_0x1cbf0d){var _0x555f7c;var _0x2aa484;_0x28e2eb=_0x1cbf0d||[];var _0xeec52e=[];if(_0x1cbf0d){for(var _0x4b1d68=0x0;_0x4b1d68<_0x1cbf0d[_0x994c('0x33')];_0x4b1d68+=0x1){var _0x5eea72=_0x1cbf0d[_0x4b1d68]['get']({'plain':!![]});_0x555f7c=squel[_0x994c('0x66')]()[_0x994c('0x7b')](_0x994c('0x8c'))[_0x994c('0x68')]([_0x994c('0x69'),_0x994c('0x6b'),_0x994c('0x6c'),_0x994c('0x57'),_0x994c('0x4e'),'updatedAt'],squel[_0x994c('0x76')]()['field'](_0x994c('0x69'),_0x994c('0x69'))[_0x994c('0x6d')]('id',_0x994c('0x6b'))['field'](_0x5eea72[_0x994c('0x6f')][_0x994c('0x70')](),'ListId')['field'](_0x549ab6[_0x994c('0x40')]['id'][_0x994c('0x70')](),_0x994c('0x57'))[_0x994c('0x6d')](_0x994c('0x6e'),_0x994c('0x4e'))[_0x994c('0x6d')]('NOW()',_0x994c('0x4f'))[_0x994c('0x78')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x994c('0x36')](_0x994c('0x73'),_0x5eea72['CmListId'][_0x994c('0x70')]())[_0x994c('0x36')](_0x994c('0x74')))[_0x994c('0x70')]();_0xeec52e[_0x994c('0x86')](db[_0x994c('0x87')][_0x994c('0x2d')](_0x555f7c));}return BPromise[_0x994c('0x88')](_0xeec52e);}})[_0x994c('0x1c')](function(){return _0x28e2eb;})[_0x994c('0x1c')](respondWithResult(_0x4b6478,null))[_0x994c('0x43')](handleError(_0x4b6478,null));};exports[_0x994c('0x8d')]=function(_0x4d7d3f,_0x598870,_0x5f1411){return db['Campaign'][_0x994c('0x42')]({'where':{'id':_0x4d7d3f['params']['id']}})[_0x994c('0x1c')](handleEntityNotFound(_0x598870,null))[_0x994c('0x1c')](function(_0x96b2be){if(_0x96b2be){return _0x96b2be[_0x994c('0x8d')](_0x4d7d3f[_0x994c('0x2d')]['ids']);}})[_0x994c('0x1c')](function(_0x6cdbf2){if(_0x6cdbf2){return db[_0x994c('0x5c')]['destroy']({'where':{'ListId':_0x4d7d3f[_0x994c('0x2d')][_0x994c('0x62')],'CampaignId':_0x4d7d3f[_0x994c('0x40')]['id']}})[_0x994c('0x1c')](function(){return _0x6cdbf2;});}})['then'](respondWithStatusCode(_0x598870,null))['catch'](handleError(_0x598870,null));}; \ No newline at end of file +var _0xd1d3=['index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','role','userProfileId','getHoppers','findOne','CmHopper','getHopperHistories','order','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','cm_hopper_additional_phones','cmHopperId','h.id','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','IvrCampaigns','UserProfileResource','sendStatus','error','name'];(function(_0x16b951,_0x38912d){var _0x1cac10=function(_0x43184a){while(--_0x43184a){_0x16b951['push'](_0x16b951['shift']());}};_0x1cac10(++_0x38912d);}(_0xd1d3,0x68));var _0x3d1d=function(_0x14ec43,_0x2dd7a2){_0x14ec43=_0x14ec43-0x0;var _0x5a511b=_0xd1d3[_0x14ec43];return _0x5a511b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d1d('0x0'));var zipdir=require(_0x3d1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d1d('0x2'));var Mustache=require(_0x3d1d('0x3'));var util=require('util');var path=require(_0x3d1d('0x4'));var sox=require(_0x3d1d('0x5'));var csv=require('to-csv');var ejs=require(_0x3d1d('0x6'));var fs=require('fs');var fs_extra=require(_0x3d1d('0x7'));var _=require(_0x3d1d('0x8'));var squel=require('squel');var crypto=require(_0x3d1d('0x9'));var jsforce=require(_0x3d1d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3d1d('0xb'));var querystring=require('querystring');var Papa=require(_0x3d1d('0xc'));var Redis=require('ioredis');var authService=require(_0x3d1d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x3d1d('0xe'));var hardwareService=require(_0x3d1d('0xf'));var logger=require(_0x3d1d('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d1d('0x11'))['db'];function respondWithStatusCode(_0x4a5005,_0xd725fe){_0xd725fe=_0xd725fe||0xcc;return function(_0x1bc123){if(_0x1bc123){return _0x4a5005['sendStatus'](_0xd725fe);}return _0x4a5005[_0x3d1d('0x12')](_0xd725fe)[_0x3d1d('0x13')]();};}function respondWithResult(_0x28e129,_0x374296){_0x374296=_0x374296||0xc8;return function(_0x36aede){if(_0x36aede){return _0x28e129['status'](_0x374296)[_0x3d1d('0x14')](_0x36aede);}};}function respondWithFilteredResult(_0x3e1f54,_0x2614db){return function(_0x3f7fbb){if(_0x3f7fbb){var _0x2453bc=typeof _0x2614db[_0x3d1d('0x15')]===_0x3d1d('0x16')&&typeof _0x2614db['limit']===_0x3d1d('0x16');var _0x3c52ba=_0x3f7fbb[_0x3d1d('0x17')];var _0x630b4a=_0x2453bc?0x0:_0x2614db[_0x3d1d('0x15')];var _0x257dc2=_0x2453bc?_0x3f7fbb[_0x3d1d('0x17')]:_0x2614db[_0x3d1d('0x15')]+_0x2614db[_0x3d1d('0x18')];var _0x5e0cf2;if(_0x257dc2>=_0x3c52ba){_0x257dc2=_0x3c52ba;_0x5e0cf2=0xc8;}else{_0x5e0cf2=0xce;}_0x3e1f54[_0x3d1d('0x12')](_0x5e0cf2);return _0x3e1f54[_0x3d1d('0x19')](_0x3d1d('0x1a'),_0x630b4a+'-'+_0x257dc2+'/'+_0x3c52ba)[_0x3d1d('0x14')](_0x3f7fbb);}return null;};}function patchUpdates(_0xca4143){return function(_0x129b25){try{jsonpatch[_0x3d1d('0x1b')](_0x129b25,_0xca4143,!![]);}catch(_0x568673){return BPromise['reject'](_0x568673);}return _0x129b25[_0x3d1d('0x1c')]();};}function saveUpdates(_0x452929,_0x30fa6f){return function(_0x1cab9a){if(_0x1cab9a){return _0x1cab9a[_0x3d1d('0x1d')](_0x452929)[_0x3d1d('0x1e')](function(_0x4bb782){return _0x4bb782;});}return null;};}function removeEntity(_0x596af5,_0x4420fb){return function(_0x4e3686){if(_0x4e3686){return _0x4e3686[_0x3d1d('0x1f')]()['then'](function(){var _0x265686=_0x4e3686['get']({'plain':!![]});var _0x5c8952=_0x3d1d('0x20');return db[_0x3d1d('0x21')][_0x3d1d('0x1f')]({'where':{'type':_0x5c8952,'resourceId':_0x265686['id']}})['then'](function(){return _0x4e3686;});})[_0x3d1d('0x1e')](function(){_0x596af5[_0x3d1d('0x12')](0xcc)[_0x3d1d('0x13')]();});}};}function handleEntityNotFound(_0x4cc223,_0x4b0e1d){return function(_0x18d7d5){if(!_0x18d7d5){_0x4cc223[_0x3d1d('0x22')](0x194);}return _0x18d7d5;};}function handleError(_0x155486,_0x3beaac){_0x3beaac=_0x3beaac||0x1f4;return function(_0x3b399b){logger[_0x3d1d('0x23')](_0x3b399b['stack']);if(_0x3b399b[_0x3d1d('0x24')]){delete _0x3b399b['name'];}_0x155486['status'](_0x3beaac)['send'](_0x3b399b);};}exports[_0x3d1d('0x25')]=function(_0x42de03,_0x5ee1fd){var _0x215d5e={},_0x1029b6={},_0x330146={'count':0x0,'rows':[]};var _0x35f7f9=_[_0x3d1d('0x26')](db[_0x3d1d('0x27')][_0x3d1d('0x28')],function(_0x4f0d9d){return{'name':_0x4f0d9d[_0x3d1d('0x29')],'type':_0x4f0d9d[_0x3d1d('0x2a')][_0x3d1d('0x2b')]};});_0x1029b6[_0x3d1d('0x2c')]=_[_0x3d1d('0x26')](_0x35f7f9,'name');_0x1029b6[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x42de03[_0x3d1d('0x2d')]);_0x1029b6['filters']=_[_0x3d1d('0x2f')](_0x1029b6[_0x3d1d('0x2c')],_0x1029b6[_0x3d1d('0x2d')]);_0x215d5e['attributes']=_['intersection'](_0x1029b6['model'],qs[_0x3d1d('0x30')](_0x42de03['query'][_0x3d1d('0x30')]));_0x215d5e[_0x3d1d('0x31')]=_0x215d5e[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x215d5e['attributes']:_0x1029b6[_0x3d1d('0x2c')];if(!_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x215d5e[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x215d5e['offset']=qs['offset'](_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x15')]);}_0x215d5e['order']=qs[_0x3d1d('0x35')](_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x35')]);_0x215d5e[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_[_0x3d1d('0x38')](_0x42de03[_0x3d1d('0x2d')],_0x1029b6[_0x3d1d('0x37')]),_0x35f7f9);if(_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x215d5e[_0x3d1d('0x36')]=_['merge'](_0x215d5e[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x35f7f9,function(_0x3b1c01){if(_0x3b1c01[_0x3d1d('0x2a')]!==_0x3d1d('0x3a')){var _0x2b7cbe={};_0x2b7cbe[_0x3b1c01[_0x3d1d('0x24')]]={'$like':'%'+_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x2b7cbe;}})});}_0x215d5e=_[_0x3d1d('0x3b')]({},_0x215d5e,_0x42de03[_0x3d1d('0x3c')]);var _0x2f4caf={'where':_0x215d5e[_0x3d1d('0x36')]};return db[_0x3d1d('0x27')][_0x3d1d('0x17')](_0x2f4caf)['then'](function(_0x4a58d5){_0x330146[_0x3d1d('0x17')]=_0x4a58d5;if(_0x42de03[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x215d5e['include']=[{'all':!![]}];}return db['Campaign'][_0x3d1d('0x3e')](_0x215d5e);})[_0x3d1d('0x1e')](function(_0x326177){_0x330146[_0x3d1d('0x3f')]=_0x326177;return _0x330146;})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x5ee1fd,_0x215d5e))[_0x3d1d('0x40')](handleError(_0x5ee1fd,null));};exports[_0x3d1d('0x41')]=function(_0x15c424,_0x199285){var _0x1edb1b={'raw':![],'where':{'id':_0x15c424[_0x3d1d('0x42')]['id']}},_0x496a8e={};_0x496a8e[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db['Campaign']['rawAttributes']);_0x496a8e[_0x3d1d('0x2d')]=_['keys'](_0x15c424['query']);_0x496a8e['filters']=_[_0x3d1d('0x2f')](_0x496a8e[_0x3d1d('0x2c')],_0x496a8e[_0x3d1d('0x2d')]);_0x1edb1b['attributes']=_['intersection'](_0x496a8e[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x15c424[_0x3d1d('0x2d')]['fields']));_0x1edb1b[_0x3d1d('0x31')]=_0x1edb1b['attributes'][_0x3d1d('0x32')]?_0x1edb1b[_0x3d1d('0x31')]:_0x496a8e[_0x3d1d('0x2c')];if(_0x15c424[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x1edb1b['include']=[{'all':!![]}];}_0x1edb1b=_[_0x3d1d('0x3b')]({},_0x1edb1b,_0x15c424[_0x3d1d('0x3c')]);return db[_0x3d1d('0x27')][_0x3d1d('0x43')](_0x1edb1b)[_0x3d1d('0x1e')](handleEntityNotFound(_0x199285,null))[_0x3d1d('0x1e')](respondWithResult(_0x199285,null))[_0x3d1d('0x40')](handleError(_0x199285,null));};exports[_0x3d1d('0x44')]=function(_0x21c54b,_0x31658b){return db['Campaign']['create'](_0x21c54b[_0x3d1d('0x45')],{})[_0x3d1d('0x1e')](function(_0xbdf332){var _0x2a5a0d=_0x21c54b['user']['get']({'plain':!![]});if(!_0x2a5a0d)throw new Error(_0x3d1d('0x46'));if(_0x2a5a0d['role']===_0x3d1d('0x47')){var _0x1009da=_0xbdf332[_0x3d1d('0x48')]({'plain':!![]});var _0x35c2f9=_0x3d1d('0x20');return db[_0x3d1d('0x49')][_0x3d1d('0x43')]({'where':{'name':_0x35c2f9,'userProfileId':_0x2a5a0d['userProfileId']},'raw':!![]})['then'](function(_0x13c88a){if(_0x13c88a&&_0x13c88a[_0x3d1d('0x4a')]===0x0){return db[_0x3d1d('0x21')][_0x3d1d('0x44')]({'name':_0x1009da[_0x3d1d('0x24')],'resourceId':_0x1009da['id'],'type':_0x13c88a[_0x3d1d('0x24')],'sectionId':_0x13c88a['id']},{})[_0x3d1d('0x1e')](function(){return _0xbdf332;});}else{return _0xbdf332;}})['catch'](function(_0x1db497){logger[_0x3d1d('0x23')](_0x3d1d('0x4b'),_0x1db497);throw _0x1db497;});}return _0xbdf332;})['then'](respondWithResult(_0x31658b,0xc9))[_0x3d1d('0x40')](handleError(_0x31658b,null));};exports[_0x3d1d('0x4c')]=function(_0x11b3a3,_0xdf6a0){var _0x5b1dd2={'where':{'id':_0x11b3a3[_0x3d1d('0x42')]['id']}},_0x4b3b18={};_0x4b3b18[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db[_0x3d1d('0x27')]['rawAttributes']);_0x5b1dd2[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x4b3b18[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x11b3a3[_0x3d1d('0x2d')]['fields']));_0x5b1dd2[_0x3d1d('0x31')]=_0x5b1dd2[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x5b1dd2[_0x3d1d('0x31')]:_0x4b3b18['model'];if(_0x11b3a3[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x5b1dd2[_0x3d1d('0x4d')]=[{'all':!![]}];}_0x5b1dd2=_[_0x3d1d('0x3b')]({},_0x5b1dd2,_0x11b3a3['options']);return db['Campaign'][_0x3d1d('0x43')](_0x5b1dd2)['then'](handleEntityNotFound(_0xdf6a0,null))[_0x3d1d('0x1e')](function(_0x4e2dcb){if(_0x4e2dcb){var _0x9c44ff=_0x4e2dcb['get']({'plain':!![]});_0x9c44ff=qs[_0x3d1d('0x4e')](_0x9c44ff,['id',_0x3d1d('0x4f'),_0x3d1d('0x50')]);_0x11b3a3[_0x3d1d('0x45')]=_[_0x3d1d('0x4e')](_0x11b3a3[_0x3d1d('0x45')],['id',_0x3d1d('0x4f'),_0x3d1d('0x50')]);return db[_0x3d1d('0x27')][_0x3d1d('0x44')](_[_0x3d1d('0x3b')](_0x9c44ff,_0x11b3a3[_0x3d1d('0x45')]),{'include':_0x11b3a3['query'][_0x3d1d('0x3d')]?[{'all':!![]}]:undefined})[_0x3d1d('0x1e')](function(_0x3f5c45){var _0x5452b8=_0x11b3a3[_0x3d1d('0x47')][_0x3d1d('0x48')]({'plain':!![]});if(!_0x5452b8)throw new Error(_0x3d1d('0x46'));if(_0x5452b8[_0x3d1d('0x51')]==='user'){var _0x584387=_0x3f5c45[_0x3d1d('0x48')]({'plain':!![]});var _0x59490a=_0x3d1d('0x20');return db['UserProfileSection'][_0x3d1d('0x43')]({'where':{'name':_0x59490a,'userProfileId':_0x5452b8[_0x3d1d('0x52')]},'raw':!![]})[_0x3d1d('0x1e')](function(_0x2a86f1){if(_0x2a86f1&&_0x2a86f1[_0x3d1d('0x4a')]===0x0){return db[_0x3d1d('0x21')][_0x3d1d('0x44')]({'name':_0x584387[_0x3d1d('0x24')],'resourceId':_0x584387['id'],'type':_0x2a86f1['name'],'sectionId':_0x2a86f1['id']},{})[_0x3d1d('0x1e')](function(){return _0x3f5c45;});}else{return _0x3f5c45;}})['catch'](function(_0x9d219d){logger[_0x3d1d('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9d219d);throw _0x9d219d;});}return _0x3f5c45;});}})[_0x3d1d('0x1e')](respondWithResult(_0xdf6a0,0xc9))[_0x3d1d('0x40')](handleError(_0xdf6a0,null));};exports[_0x3d1d('0x1d')]=function(_0x22fb54,_0x278ad6){if(_0x22fb54[_0x3d1d('0x45')]['id']){delete _0x22fb54[_0x3d1d('0x45')]['id'];}return db['Campaign'][_0x3d1d('0x43')]({'where':{'id':_0x22fb54[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x278ad6,null))['then'](saveUpdates(_0x22fb54[_0x3d1d('0x45')],null))['then'](respondWithResult(_0x278ad6,null))[_0x3d1d('0x40')](handleError(_0x278ad6,null));};exports['destroy']=function(_0x2fe10e,_0x9db056){return db[_0x3d1d('0x27')]['find']({'where':{'id':_0x2fe10e['params']['id']}})['then'](handleEntityNotFound(_0x9db056,null))['then'](removeEntity(_0x9db056,null))[_0x3d1d('0x40')](handleError(_0x9db056,null));};exports[_0x3d1d('0x53')]=function(_0x2f0c5c,_0x1a4f28,_0x4f8f7b){var _0x53eda1={'raw':!![],'where':{}};var _0x21ae9e={};var _0x3ed221={'count':0x0,'rows':[]};return db[_0x3d1d('0x27')][_0x3d1d('0x54')]({'where':{'id':_0x2f0c5c[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a4f28,null))['then'](function(_0x7c771f){if(_0x7c771f){_0x21ae9e['model']=_[_0x3d1d('0x2e')](db[_0x3d1d('0x55')][_0x3d1d('0x28')]);_0x21ae9e[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x2f0c5c[_0x3d1d('0x2d')]);_0x21ae9e['filters']=_['intersection'](_0x21ae9e[_0x3d1d('0x2c')],_0x21ae9e[_0x3d1d('0x2d')]);_0x53eda1[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x21ae9e[_0x3d1d('0x2c')],qs['fields'](_0x2f0c5c['query'][_0x3d1d('0x30')]));_0x53eda1['attributes']=_0x53eda1[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x53eda1[_0x3d1d('0x31')]:_0x21ae9e['model'];if(!_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x33')]('nolimit')){_0x53eda1['limit']=qs[_0x3d1d('0x18')](_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x53eda1[_0x3d1d('0x15')]=qs['offset'](_0x2f0c5c[_0x3d1d('0x2d')]['offset']);}_0x53eda1['order']=qs[_0x3d1d('0x35')](_0x2f0c5c['query'][_0x3d1d('0x35')]);_0x53eda1[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_['pick'](_0x2f0c5c['query'],_0x21ae9e[_0x3d1d('0x37')]));_0x53eda1[_0x3d1d('0x36')]['CampaignId']=_0x7c771f['id'];if(_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x53eda1[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x53eda1[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x53eda1['attributes'],function(_0x4b1629){var _0x41d6d5={};_0x41d6d5[_0x4b1629]={'$like':'%'+_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x41d6d5;})});}_0x53eda1=_[_0x3d1d('0x3b')]({},_0x53eda1,_0x2f0c5c[_0x3d1d('0x3c')]);return db['CmHopper'][_0x3d1d('0x17')]({'where':_0x53eda1[_0x3d1d('0x36')]})[_0x3d1d('0x1e')](function(_0x74eb92){_0x3ed221[_0x3d1d('0x17')]=_0x74eb92;if(_0x2f0c5c[_0x3d1d('0x2d')][_0x3d1d('0x3d')]){_0x53eda1[_0x3d1d('0x4d')]=[{'all':!![]}];}return db[_0x3d1d('0x55')][_0x3d1d('0x3e')](_0x53eda1);})[_0x3d1d('0x1e')](function(_0x15db8a){_0x3ed221['rows']=_0x15db8a;return _0x3ed221;});}})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x1a4f28,_0x53eda1))[_0x3d1d('0x40')](handleError(_0x1a4f28,null));};exports[_0x3d1d('0x56')]=function(_0x1cc57f,_0x2a1f31,_0x54fe64){var _0x4886af={'raw':!![],'where':{}};var _0x54a6df={};var _0x49759d={'count':0x0,'rows':[]};return db['Campaign'][_0x3d1d('0x54')]({'where':{'id':_0x1cc57f[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x2a1f31,null))[_0x3d1d('0x1e')](function(_0x2bc0fc){if(_0x2bc0fc){_0x54a6df[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db['CmHopperHistory'][_0x3d1d('0x28')]);_0x54a6df['query']=_[_0x3d1d('0x2e')](_0x1cc57f[_0x3d1d('0x2d')]);_0x54a6df['filters']=_['intersection'](_0x54a6df[_0x3d1d('0x2c')],_0x54a6df['query']);_0x4886af[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x54a6df[_0x3d1d('0x2c')],qs['fields'](_0x1cc57f['query']['fields']));_0x4886af[_0x3d1d('0x31')]=_0x4886af[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x4886af[_0x3d1d('0x31')]:_0x54a6df[_0x3d1d('0x2c')];if(!_0x1cc57f['query'][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x4886af[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x1cc57f[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x4886af[_0x3d1d('0x15')]=qs['offset'](_0x1cc57f['query'][_0x3d1d('0x15')]);}_0x4886af[_0x3d1d('0x57')]=qs[_0x3d1d('0x35')](_0x1cc57f[_0x3d1d('0x2d')]['sort']);_0x4886af[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_[_0x3d1d('0x38')](_0x1cc57f[_0x3d1d('0x2d')],_0x54a6df[_0x3d1d('0x37')]));_0x4886af[_0x3d1d('0x36')][_0x3d1d('0x58')]=_0x2bc0fc['id'];if(_0x1cc57f[_0x3d1d('0x2d')]['filter']){_0x4886af[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x4886af[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x4886af[_0x3d1d('0x31')],function(_0x2a6530){var _0x42b8e9={};_0x42b8e9[_0x2a6530]={'$like':'%'+_0x1cc57f['query'][_0x3d1d('0x39')]+'%'};return _0x42b8e9;})});}_0x4886af=_[_0x3d1d('0x3b')]({},_0x4886af,_0x1cc57f['options']);return db['CmHopperHistory'][_0x3d1d('0x17')]({'where':_0x4886af[_0x3d1d('0x36')]})[_0x3d1d('0x1e')](function(_0x89f6e1){_0x49759d[_0x3d1d('0x17')]=_0x89f6e1;if(_0x1cc57f['query'][_0x3d1d('0x3d')]){_0x4886af['include']=[{'all':!![]}];}return db[_0x3d1d('0x59')]['findAll'](_0x4886af);})[_0x3d1d('0x1e')](function(_0x1ce410){_0x49759d['rows']=_0x1ce410;return _0x49759d;});}})['then'](respondWithFilteredResult(_0x2a1f31,_0x4886af))[_0x3d1d('0x40')](handleError(_0x2a1f31,null));};exports[_0x3d1d('0x5a')]=function(_0x594e42,_0x12c344,_0x242dd3){var _0x2a6bb5={'raw':!![],'where':{}};var _0x3e3c75={};var _0x4e0e80={'count':0x0,'rows':[]};return db[_0x3d1d('0x27')]['findOne']({'where':{'id':_0x594e42['params']['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x12c344,null))['then'](function(_0x19b723){if(_0x19b723){_0x3e3c75[_0x3d1d('0x2c')]=_['keys'](db[_0x3d1d('0x5b')][_0x3d1d('0x28')]);_0x3e3c75[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x594e42[_0x3d1d('0x2d')]);_0x3e3c75['filters']=_['intersection'](_0x3e3c75['model'],_0x3e3c75[_0x3d1d('0x2d')]);_0x2a6bb5[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x3e3c75[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x594e42['query'][_0x3d1d('0x30')]));_0x2a6bb5[_0x3d1d('0x31')]=_0x2a6bb5[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x2a6bb5[_0x3d1d('0x31')]:_0x3e3c75[_0x3d1d('0x2c')];if(!_0x594e42[_0x3d1d('0x2d')]['hasOwnProperty'](_0x3d1d('0x34'))){_0x2a6bb5[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x2a6bb5['offset']=qs[_0x3d1d('0x15')](_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x15')]);}_0x2a6bb5[_0x3d1d('0x57')]=qs[_0x3d1d('0x35')](_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x35')]);_0x2a6bb5[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_[_0x3d1d('0x38')](_0x594e42[_0x3d1d('0x2d')],_0x3e3c75[_0x3d1d('0x37')]));_0x2a6bb5[_0x3d1d('0x36')][_0x3d1d('0x58')]=_0x19b723['id'];if(_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x2a6bb5[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x2a6bb5[_0x3d1d('0x36')],{'$or':_['map'](_0x2a6bb5[_0x3d1d('0x31')],function(_0x2d0e07){var _0x5f2b37={};_0x5f2b37[_0x2d0e07]={'$like':'%'+_0x594e42[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x5f2b37;})});}_0x2a6bb5=_[_0x3d1d('0x3b')]({},_0x2a6bb5,_0x594e42['options']);return db[_0x3d1d('0x5b')][_0x3d1d('0x17')]({'where':_0x2a6bb5['where']})[_0x3d1d('0x1e')](function(_0x540a95){_0x4e0e80['count']=_0x540a95;if(_0x594e42['query']['includeAll']){_0x2a6bb5[_0x3d1d('0x4d')]=[{'all':!![]}];}return db[_0x3d1d('0x5b')][_0x3d1d('0x3e')](_0x2a6bb5);})[_0x3d1d('0x1e')](function(_0x28027d){_0x4e0e80[_0x3d1d('0x3f')]=_0x28027d;return _0x4e0e80;});}})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x12c344,_0x2a6bb5))[_0x3d1d('0x40')](handleError(_0x12c344,null));};exports[_0x3d1d('0x5c')]=function(_0x316a85,_0x32b24b,_0x3feb37){var _0x3f33be={'raw':!![],'where':{}};var _0x3b24ac={};var _0xd0958f={'count':0x0,'rows':[]};return db['Campaign'][_0x3d1d('0x54')]({'where':{'id':_0x316a85[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x32b24b,null))[_0x3d1d('0x1e')](function(_0x20b64a){if(_0x20b64a){_0x3b24ac[_0x3d1d('0x2c')]=_['keys'](db[_0x3d1d('0x5d')][_0x3d1d('0x28')]);_0x3b24ac[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x316a85[_0x3d1d('0x2d')]);_0x3b24ac[_0x3d1d('0x37')]=_[_0x3d1d('0x2f')](_0x3b24ac[_0x3d1d('0x2c')],_0x3b24ac[_0x3d1d('0x2d')]);_0x3f33be[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x3b24ac[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x316a85[_0x3d1d('0x2d')][_0x3d1d('0x30')]));_0x3f33be[_0x3d1d('0x31')]=_0x3f33be[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x3f33be[_0x3d1d('0x31')]:_0x3b24ac[_0x3d1d('0x2c')];if(!_0x316a85[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x3f33be[_0x3d1d('0x18')]=qs['limit'](_0x316a85[_0x3d1d('0x2d')]['limit']);_0x3f33be['offset']=qs['offset'](_0x316a85[_0x3d1d('0x2d')]['offset']);}_0x3f33be['order']=qs[_0x3d1d('0x35')](_0x316a85['query']['sort']);_0x3f33be[_0x3d1d('0x36')]=qs['filters'](_['pick'](_0x316a85[_0x3d1d('0x2d')],_0x3b24ac[_0x3d1d('0x37')]));_0x3f33be['where'][_0x3d1d('0x58')]=_0x20b64a['id'];if(_0x316a85[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x3f33be[_0x3d1d('0x36')]=_[_0x3d1d('0x3b')](_0x3f33be[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x3f33be[_0x3d1d('0x31')],function(_0x150ffd){var _0x662e3a={};_0x662e3a[_0x150ffd]={'$like':'%'+_0x316a85['query'][_0x3d1d('0x39')]+'%'};return _0x662e3a;})});}_0x3f33be=_[_0x3d1d('0x3b')]({},_0x3f33be,_0x316a85['options']);return db[_0x3d1d('0x5d')][_0x3d1d('0x17')]({'where':_0x3f33be[_0x3d1d('0x36')]})[_0x3d1d('0x1e')](function(_0x105055){_0xd0958f[_0x3d1d('0x17')]=_0x105055;if(_0x316a85['query'][_0x3d1d('0x3d')]){_0x3f33be[_0x3d1d('0x4d')]=[{'all':!![]}];}return db[_0x3d1d('0x5d')]['findAll'](_0x3f33be);})[_0x3d1d('0x1e')](function(_0x3edefb){_0xd0958f[_0x3d1d('0x3f')]=_0x3edefb;return _0xd0958f;});}})[_0x3d1d('0x1e')](respondWithFilteredResult(_0x32b24b,_0x3f33be))[_0x3d1d('0x40')](handleError(_0x32b24b,null));};exports[_0x3d1d('0x5e')]=function(_0x32ecc4,_0x5258b1,_0x478bcb){var _0x3cdbf3={};var _0x585349={};var _0x4583ae;var _0x2f2f0b;return db[_0x3d1d('0x27')]['findOne']({'where':{'id':_0x32ecc4[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x5258b1,null))[_0x3d1d('0x1e')](function(_0x1ab59f){if(_0x1ab59f){_0x4583ae=_0x1ab59f;_0x585349[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db[_0x3d1d('0x5f')][_0x3d1d('0x28')]);_0x585349[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x32ecc4[_0x3d1d('0x2d')]);_0x585349[_0x3d1d('0x37')]=_[_0x3d1d('0x2f')](_0x585349[_0x3d1d('0x2c')],_0x585349[_0x3d1d('0x2d')]);_0x3cdbf3[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x585349[_0x3d1d('0x2c')],qs[_0x3d1d('0x30')](_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x30')]));_0x3cdbf3[_0x3d1d('0x31')]=_0x3cdbf3[_0x3d1d('0x31')][_0x3d1d('0x32')]?_0x3cdbf3['attributes']:_0x585349[_0x3d1d('0x2c')];_0x3cdbf3['order']=qs['sort'](_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x35')]);_0x3cdbf3[_0x3d1d('0x36')]=qs['filters'](_[_0x3d1d('0x38')](_0x32ecc4['query'],_0x585349[_0x3d1d('0x37')]));if(_0x32ecc4[_0x3d1d('0x2d')]['filter']){_0x3cdbf3['where']=_['merge'](_0x3cdbf3['where'],{'$or':_['map'](_0x3cdbf3[_0x3d1d('0x31')],function(_0x210107){var _0x126b6e={};_0x126b6e[_0x210107]={'$like':'%'+_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x39')]+'%'};return _0x126b6e;})});}_0x3cdbf3=_[_0x3d1d('0x3b')]({},_0x3cdbf3,_0x32ecc4[_0x3d1d('0x3c')]);return _0x4583ae[_0x3d1d('0x5e')](_0x3cdbf3);}})['then'](function(_0x589906){if(_0x589906){_0x2f2f0b=_0x589906[_0x3d1d('0x32')];if(!_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x3cdbf3['limit']=qs['limit'](_0x32ecc4[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x3cdbf3['offset']=qs['offset'](_0x32ecc4['query'][_0x3d1d('0x15')]);}return _0x4583ae['getLists'](_0x3cdbf3);}})[_0x3d1d('0x1e')](function(_0x539a00){if(_0x539a00){return _0x539a00?{'count':_0x2f2f0b,'rows':_0x539a00}:null;}})[_0x3d1d('0x1e')](respondWithResult(_0x5258b1,null))['catch'](handleError(_0x5258b1,null));};exports[_0x3d1d('0x60')]=function(_0x5884ac,_0x49c5ee,_0xa28476){var _0xea1882,_0x16366d;var _0xbd17f3=[];var _0x2fe902=moment()['format'](_0x3d1d('0x61'));return db['Campaign'][_0x3d1d('0x43')]({'where':{'id':_0x5884ac[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x49c5ee,null))['then'](function(_0x1cbfe0){if(_0x1cbfe0){_0x16366d=_0x1cbfe0;return _0x1cbfe0[_0x3d1d('0x60')](_0x5884ac[_0x3d1d('0x45')][_0x3d1d('0x62')],_[_0x3d1d('0x4e')](_0x5884ac[_0x3d1d('0x45')],[_0x3d1d('0x62'),'id'])||{});}return null;})['spread'](function(_0x3d0f25){var _0x1afb62;var _0x531884;_0xea1882=_0x3d0f25||[];var _0x4f735b=[];if(_0x3d0f25){for(var _0xf40d69=0x0;_0xf40d69<_0x3d0f25['length'];_0xf40d69+=0x1){var _0x381b9b=_0x3d0f25[_0xf40d69]['get']({'plain':!![]});_0x16366d[_0x3d1d('0x63')]=_0x5884ac[_0x3d1d('0x45')]['dialCheckDuplicateType']?_0x5884ac[_0x3d1d('0x45')]['dialCheckDuplicateType']:_0x16366d['dialCheckDuplicateType'];switch(_0x16366d[_0x3d1d('0x63')]){case _0x3d1d('0x64'):_0x1afb62=squel[_0x3d1d('0x65')]()['into'](_0x3d1d('0x66'))['fromQuery']([_0x3d1d('0x67'),_0x3d1d('0x68'),_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),'createdAt',_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x67'),'phone')['field'](_0x3d1d('0x6d'),'scheduledAt')[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))['field'](_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))['field'](_0x5884ac[_0x3d1d('0x42')]['id']['toString'](),'CampaignId')[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x50'))[_0x3d1d('0x70')](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))[_0x3d1d('0x36')](_0x3d1d('0x73'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())[_0x3d1d('0x36')](_0x3d1d('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3d1d('0x6c')](_0x3d1d('0x75'))[_0x3d1d('0x70')](_0x3d1d('0x76'))[_0x3d1d('0x36')](_0x3d1d('0x77'),_0x5884ac[_0x3d1d('0x42')]['id'][_0x3d1d('0x6f')]()))[_0x3d1d('0x36')](_0x3d1d('0x78'),squel[_0x3d1d('0x6b')]()['field'](_0x3d1d('0x79'))[_0x3d1d('0x70')](_0x3d1d('0x66'))[_0x3d1d('0x36')](_0x3d1d('0x77'),_0x5884ac[_0x3d1d('0x42')]['id']['toString']())))['toString']();break;case _0x3d1d('0x7a'):_0x1afb62=squel['insert']()[_0x3d1d('0x7b')]('cm_hopper')['fromQuery']([_0x3d1d('0x67'),_0x3d1d('0x68'),_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),_0x3d1d('0x4f'),_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x67'),_0x3d1d('0x67'))[_0x3d1d('0x6c')](_0x3d1d('0x6d'),_0x3d1d('0x68'))[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))[_0x3d1d('0x6c')](_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))[_0x3d1d('0x6c')](_0x5884ac[_0x3d1d('0x42')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x50'))[_0x3d1d('0x70')](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))[_0x3d1d('0x36')](_0x3d1d('0x73'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())[_0x3d1d('0x36')](_0x3d1d('0x74'))[_0x3d1d('0x36')](_0x3d1d('0x78'),squel['select']()[_0x3d1d('0x6c')]('COALESCE(phone,\x27\x27)')['from'](_0x3d1d('0x66'))[_0x3d1d('0x36')](_0x3d1d('0x77'),_0x5884ac['params']['id'][_0x3d1d('0x6f')]())))[_0x3d1d('0x6f')]();break;default:_0x1afb62=squel[_0x3d1d('0x65')]()[_0x3d1d('0x7b')]('cm_hopper')[_0x3d1d('0x7c')]([_0x3d1d('0x67'),'scheduledAt',_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),'createdAt','updatedAt'],squel['select']()['field'](_0x3d1d('0x67'),_0x3d1d('0x67'))[_0x3d1d('0x6c')](_0x3d1d('0x6d'),'scheduledAt')[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))[_0x3d1d('0x6c')](_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))[_0x3d1d('0x6c')](_0x5884ac[_0x3d1d('0x42')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27',_0x3d1d('0x50'))['from'](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))['where'](_0x3d1d('0x73'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3d1d('0x6f')]();}_0x531884=squel[_0x3d1d('0x65')]()['into'](_0x3d1d('0x7d'))['fromQuery']([_0x3d1d('0x7e'),_0x3d1d('0x68'),_0x3d1d('0x67'),'OrderBy',_0x3d1d('0x4f'),_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x7f'),'id')[_0x3d1d('0x6c')](_0x3d1d('0x6d'),_0x3d1d('0x68'))[_0x3d1d('0x6c')]('ci.item',_0x3d1d('0x67'))['field']('ci.OrderBY',_0x3d1d('0x80'))['field']('\x27'+_0x2fe902+'\x27',_0x3d1d('0x4f'))[_0x3d1d('0x6c')]('\x27'+_0x2fe902+'\x27','updatedAt')[_0x3d1d('0x70')](_0x3d1d('0x81'),'ci')[_0x3d1d('0x82')](_0x3d1d('0x66'),'h',_0x3d1d('0x83'))[_0x3d1d('0x36')](_0x3d1d('0x84'),_0x381b9b[_0x3d1d('0x6e')][_0x3d1d('0x6f')]())['where']('h.CampaignId=?',_0x5884ac[_0x3d1d('0x42')]['id'][_0x3d1d('0x6f')]())[_0x3d1d('0x36')]('h.createdAt\x20=\x20?',_0x2fe902))[_0x3d1d('0x6f')]();_0x4f735b['push'](db[_0x3d1d('0x85')][_0x3d1d('0x2d')](_0x1afb62));_0xbd17f3[_0x3d1d('0x86')](db[_0x3d1d('0x85')][_0x3d1d('0x2d')](_0x531884));}return BPromise[_0x3d1d('0x87')](_0x4f735b);}})['then'](function(){return BPromise['all'](_0xbd17f3);})['then'](function(){return _0xea1882;})['then'](respondWithResult(_0x49c5ee,null))[_0x3d1d('0x40')](handleError(_0x49c5ee,null));};exports[_0x3d1d('0x88')]=function(_0x5f2417,_0x496606,_0xa25353){return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0x5f2417[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x496606,null))['then'](function(_0x5d9f28){if(_0x5d9f28){return _0x5d9f28[_0x3d1d('0x88')](_0x5f2417[_0x3d1d('0x2d')]['ids']);}})['then'](function(_0x30297a){if(_0x30297a){return db[_0x3d1d('0x55')][_0x3d1d('0x1f')]({'where':{'ListId':_0x5f2417[_0x3d1d('0x2d')][_0x3d1d('0x62')],'CampaignId':_0x5f2417[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](function(){return _0x30297a;});}})[_0x3d1d('0x1e')](respondWithStatusCode(_0x496606,null))[_0x3d1d('0x40')](handleError(_0x496606,null));};exports[_0x3d1d('0x89')]=function(_0x41a7ae,_0x3d2e12,_0x38f0d8){var _0x1e4f67={};var _0x32902b={};var _0x29b234;var _0x6a54c1;return db[_0x3d1d('0x27')][_0x3d1d('0x54')]({'where':{'id':_0x41a7ae[_0x3d1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d2e12,null))[_0x3d1d('0x1e')](function(_0x42e1a6){if(_0x42e1a6){_0x29b234=_0x42e1a6;_0x32902b[_0x3d1d('0x2c')]=_[_0x3d1d('0x2e')](db[_0x3d1d('0x5f')][_0x3d1d('0x28')]);_0x32902b[_0x3d1d('0x2d')]=_[_0x3d1d('0x2e')](_0x41a7ae[_0x3d1d('0x2d')]);_0x32902b[_0x3d1d('0x37')]=_['intersection'](_0x32902b[_0x3d1d('0x2c')],_0x32902b[_0x3d1d('0x2d')]);_0x1e4f67[_0x3d1d('0x31')]=_[_0x3d1d('0x2f')](_0x32902b[_0x3d1d('0x2c')],qs['fields'](_0x41a7ae['query'][_0x3d1d('0x30')]));_0x1e4f67[_0x3d1d('0x31')]=_0x1e4f67['attributes'][_0x3d1d('0x32')]?_0x1e4f67[_0x3d1d('0x31')]:_0x32902b[_0x3d1d('0x2c')];_0x1e4f67[_0x3d1d('0x57')]=qs['sort'](_0x41a7ae['query'][_0x3d1d('0x35')]);_0x1e4f67[_0x3d1d('0x36')]=qs[_0x3d1d('0x37')](_['pick'](_0x41a7ae[_0x3d1d('0x2d')],_0x32902b['filters']));if(_0x41a7ae[_0x3d1d('0x2d')][_0x3d1d('0x39')]){_0x1e4f67['where']=_[_0x3d1d('0x3b')](_0x1e4f67[_0x3d1d('0x36')],{'$or':_[_0x3d1d('0x26')](_0x1e4f67[_0x3d1d('0x31')],function(_0x3635f2){var _0x3e3960={};_0x3e3960[_0x3635f2]={'$like':'%'+_0x41a7ae[_0x3d1d('0x2d')]['filter']+'%'};return _0x3e3960;})});}_0x1e4f67=_[_0x3d1d('0x3b')]({},_0x1e4f67,_0x41a7ae[_0x3d1d('0x3c')]);return _0x29b234[_0x3d1d('0x89')](_0x1e4f67);}})['then'](function(_0x3f8e70){if(_0x3f8e70){_0x6a54c1=_0x3f8e70[_0x3d1d('0x32')];if(!_0x41a7ae[_0x3d1d('0x2d')][_0x3d1d('0x33')](_0x3d1d('0x34'))){_0x1e4f67[_0x3d1d('0x18')]=qs[_0x3d1d('0x18')](_0x41a7ae[_0x3d1d('0x2d')][_0x3d1d('0x18')]);_0x1e4f67[_0x3d1d('0x15')]=qs[_0x3d1d('0x15')](_0x41a7ae[_0x3d1d('0x2d')]['offset']);}return _0x29b234[_0x3d1d('0x89')](_0x1e4f67);}})[_0x3d1d('0x1e')](function(_0x43b94c){if(_0x43b94c){return _0x43b94c?{'count':_0x6a54c1,'rows':_0x43b94c}:null;}})[_0x3d1d('0x1e')](respondWithResult(_0x3d2e12,null))['catch'](handleError(_0x3d2e12,null));};exports[_0x3d1d('0x8a')]=function(_0xa52960,_0x588298,_0x49fc3f){var _0x478363,_0x49e39b;var _0x2a80da=[];var _0x446efb=moment()['format'](_0x3d1d('0x61'));return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0xa52960[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x588298,null))[_0x3d1d('0x1e')](function(_0x29b5d8){if(_0x29b5d8){_0x49e39b=_0x29b5d8;return _0x29b5d8[_0x3d1d('0x8a')](_0xa52960[_0x3d1d('0x45')]['ids'],_[_0x3d1d('0x4e')](_0xa52960[_0x3d1d('0x45')],[_0x3d1d('0x62'),'id'])||{});}return null;})[_0x3d1d('0x8b')](function(_0x2de8c7){var _0x508392;var _0x249b57;_0x478363=_0x2de8c7||[];var _0x376048=[];if(_0x2de8c7){for(var _0x41f231=0x0;_0x41f231<_0x2de8c7[_0x3d1d('0x32')];_0x41f231+=0x1){var _0x881406=_0x2de8c7[_0x41f231][_0x3d1d('0x48')]({'plain':!![]});_0x508392=squel[_0x3d1d('0x65')]()[_0x3d1d('0x7b')]('cm_hopper_black')[_0x3d1d('0x7c')]([_0x3d1d('0x67'),_0x3d1d('0x69'),_0x3d1d('0x6a'),_0x3d1d('0x58'),_0x3d1d('0x4f'),_0x3d1d('0x50')],squel[_0x3d1d('0x6b')]()[_0x3d1d('0x6c')](_0x3d1d('0x67'),_0x3d1d('0x67'))[_0x3d1d('0x6c')]('id',_0x3d1d('0x69'))['field'](_0x881406[_0x3d1d('0x6e')][_0x3d1d('0x6f')](),_0x3d1d('0x6a'))[_0x3d1d('0x6c')](_0xa52960['params']['id'][_0x3d1d('0x6f')](),'CampaignId')['field']('NOW()',_0x3d1d('0x4f'))['field'](_0x3d1d('0x6d'),_0x3d1d('0x50'))['from'](_0x3d1d('0x71'))[_0x3d1d('0x36')](_0x3d1d('0x72'))[_0x3d1d('0x36')](_0x3d1d('0x73'),_0x881406['CmListId'][_0x3d1d('0x6f')]())[_0x3d1d('0x36')](_0x3d1d('0x74')))[_0x3d1d('0x6f')]();_0x376048[_0x3d1d('0x86')](db['sequelize'][_0x3d1d('0x2d')](_0x508392));}return BPromise[_0x3d1d('0x87')](_0x376048);}})[_0x3d1d('0x1e')](function(){return _0x478363;})[_0x3d1d('0x1e')](respondWithResult(_0x588298,null))['catch'](handleError(_0x588298,null));};exports[_0x3d1d('0x8c')]=function(_0x25c087,_0x1865e0,_0x1576f0){return db[_0x3d1d('0x27')][_0x3d1d('0x43')]({'where':{'id':_0x25c087[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](handleEntityNotFound(_0x1865e0,null))['then'](function(_0xf55bf7){if(_0xf55bf7){return _0xf55bf7[_0x3d1d('0x8c')](_0x25c087[_0x3d1d('0x2d')]['ids']);}})['then'](function(_0x1342a7){if(_0x1342a7){return db[_0x3d1d('0x5d')]['destroy']({'where':{'ListId':_0x25c087[_0x3d1d('0x2d')]['ids'],'CampaignId':_0x25c087[_0x3d1d('0x42')]['id']}})[_0x3d1d('0x1e')](function(){return _0x1342a7;});}})[_0x3d1d('0x1e')](respondWithStatusCode(_0x1865e0,null))[_0x3d1d('0x40')](handleError(_0x1865e0,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 885b0f6..60ca540 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(_0x40aa31,_0x175b59){var _0x393c74=function(_0x119817){while(--_0x119817){_0x40aa31['push'](_0x40aa31['shift']());}};_0x393c74(++_0x175b59);}(_0x7a54,0x106));var _0x47a5=function(_0x153c9c,_0x4b283c){_0x153c9c=_0x153c9c-0x0;var _0x26fc69=_0x7a54[_0x153c9c];return _0x26fc69;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x563c9c,_0x3f4699){var _0x3af8d4=function(_0x2d8599){while(--_0x2d8599){_0x563c9c['push'](_0x563c9c['shift']());}};_0x3af8d4(++_0x3f4699);}(_0x7a54,0x106));var _0x47a5=function(_0x1ae117,_0x407db8){_0x1ae117=_0x1ae117-0x0;var _0x3292a0=_0x7a54[_0x1ae117];return _0x3292a0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index b5a8e09..80c5b0f 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 _0xac65=['limit','include','map','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xac65,0x11d));var _0x5ac6=function(_0xa91c1a,_0x1b0fa5){_0xa91c1a=_0xa91c1a-0x0;var _0x387fe1=_0xac65[_0xa91c1a];return _0x387fe1;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var moment=require(_0x5ac6('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ac6('0x3'));var fs=require('fs');var Redis=require(_0x5ac6('0x4'));var db=require(_0x5ac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ac6('0x6'))(_0x5ac6('0x7'));var config=require(_0x5ac6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5ac6('0x9')][_0x5ac6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130661,_0x402f26,_0xa61e6f){return new BPromise(function(_0x932f6f,_0x3a90a6){return client[_0x5ac6('0xb')](_0x130661,_0xa61e6f)[_0x5ac6('0xc')](function(_0x3b04ab){logger[_0x5ac6('0xd')](_0x5ac6('0xe'),_0x402f26,_0x5ac6('0xf'));logger[_0x5ac6('0x10')](_0x5ac6('0x11'),_0x402f26,_0x5ac6('0xf'),JSON[_0x5ac6('0x12')](_0x3b04ab));if(_0x3b04ab[_0x5ac6('0x13')]){if(_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x14')]===0x1f4){logger[_0x5ac6('0x13')](_0x5ac6('0xe'),_0x402f26,_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x15')]);return _0x3a90a6(_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x15')]);}logger['error'](_0x5ac6('0xe'),_0x402f26,_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x15')]);return _0x932f6f(_0x3b04ab['error'][_0x5ac6('0x15')]);}else{logger[_0x5ac6('0xd')](_0x5ac6('0xe'),_0x402f26,_0x5ac6('0xf'));_0x932f6f(_0x3b04ab[_0x5ac6('0x16')]['message']);}})[_0x5ac6('0x17')](function(_0x5e4885){logger['error'](_0x5ac6('0xe'),_0x402f26,_0x5e4885);_0x3a90a6(_0x5e4885);});});}exports[_0x5ac6('0x18')]=function(_0x2e62d9){var _0x3a88a1=this;return new Promise(function(_0x24ccd2,_0x3759dd){return db[_0x5ac6('0x19')][_0x5ac6('0x1a')]({'raw':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9['options'][_0x5ac6('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9[_0x5ac6('0x1b')][_0x5ac6('0x1d')]||null:null,'attributes':_0x2e62d9['options']?_0x2e62d9[_0x5ac6('0x1b')]['attributes']||null:null,'limit':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9['options'][_0x5ac6('0x1e')]||null:null,'include':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9['options'][_0x5ac6('0x1f')]?_[_0x5ac6('0x20')](_0x2e62d9['options'][_0x5ac6('0x1f')],function(_0x4c07d6){return{'model':db[_0x4c07d6[_0x5ac6('0x21')]],'as':_0x4c07d6['as'],'attributes':_0x4c07d6[_0x5ac6('0x22')],'include':_0x4c07d6[_0x5ac6('0x1f')]?_[_0x5ac6('0x20')](_0x4c07d6[_0x5ac6('0x1f')],function(_0x3da323){return{'model':db[_0x3da323[_0x5ac6('0x21')]],'as':_0x3da323['as'],'attributes':_0x3da323['attributes'],'include':_0x3da323[_0x5ac6('0x1f')]?_[_0x5ac6('0x20')](_0x3da323['include'],function(_0x333464){return{'model':db[_0x333464['model']],'as':_0x333464['as'],'attributes':_0x333464[_0x5ac6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5ac6('0xc')](function(_0x51fdf4){logger[_0x5ac6('0xd')]('GetCampaign',_0x2e62d9);logger['debug'](_0x5ac6('0x18'),_0x2e62d9,JSON['stringify'](_0x51fdf4));_0x24ccd2(_0x51fdf4);})[_0x5ac6('0x17')](function(_0x2c02f7){logger['error']('GetCampaign',_0x2c02f7[_0x5ac6('0x15')],_0x2e62d9);_0x3759dd(_0x3a88a1['error'](0x1f4,_0x2c02f7[_0x5ac6('0x15')]));});});}; \ No newline at end of file +var _0x4bc3=['Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x19311a,_0x2d2679){var _0x42617c=function(_0x43227d){while(--_0x43227d){_0x19311a['push'](_0x19311a['shift']());}};_0x42617c(++_0x2d2679);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4bc3[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('Campaign,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('Campaign,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});}exports[_0x34bc('0x17')]=function(_0x3eaedf){var _0x30282b=this;return new Promise(function(_0x239e6c,_0x567eee){return db[_0x34bc('0x18')][_0x34bc('0x19')]({'raw':_0x3eaedf['options']?_0x3eaedf[_0x34bc('0x1a')][_0x34bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x3eaedf['options']?_0x3eaedf[_0x34bc('0x1a')][_0x34bc('0x1c')]||null:null,'attributes':_0x3eaedf[_0x34bc('0x1a')]?_0x3eaedf[_0x34bc('0x1a')][_0x34bc('0x1d')]||null:null,'limit':_0x3eaedf[_0x34bc('0x1a')]?_0x3eaedf['options'][_0x34bc('0x1e')]||null:null,'include':_0x3eaedf[_0x34bc('0x1a')]?_0x3eaedf[_0x34bc('0x1a')]['include']?_['map'](_0x3eaedf[_0x34bc('0x1a')][_0x34bc('0x1f')],function(_0x4263de){return{'model':db[_0x4263de[_0x34bc('0x20')]],'as':_0x4263de['as'],'attributes':_0x4263de[_0x34bc('0x1d')],'include':_0x4263de[_0x34bc('0x1f')]?_[_0x34bc('0x21')](_0x4263de[_0x34bc('0x1f')],function(_0x19472e){return{'model':db[_0x19472e[_0x34bc('0x20')]],'as':_0x19472e['as'],'attributes':_0x19472e[_0x34bc('0x1d')],'include':_0x19472e[_0x34bc('0x1f')]?_['map'](_0x19472e[_0x34bc('0x1f')],function(_0x48ec13){return{'model':db[_0x48ec13['model']],'as':_0x48ec13['as'],'attributes':_0x48ec13[_0x34bc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4082c3){logger[_0x34bc('0xd')](_0x34bc('0x17'),_0x3eaedf);logger['debug'](_0x34bc('0x17'),_0x3eaedf,JSON[_0x34bc('0x22')](_0x4082c3));_0x239e6c(_0x4082c3);})[_0x34bc('0x16')](function(_0x1a83f7){logger[_0x34bc('0x11')](_0x34bc('0x17'),_0x1a83f7['message'],_0x3eaedf);_0x567eee(_0x30282b[_0x34bc('0x11')](0x1f4,_0x1a83f7[_0x34bc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 677ca5f..b35c785 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 _0xf975=['../../config/environment','./campaign.controller','get','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','isAuthenticated','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xf975,0x1c8));var _0x5f97=function(_0x44044a,_0x3a0097){_0x44044a=_0x44044a-0x0;var _0x43bb6e=_0xf975[_0x44044a];return _0x43bb6e;};'use strict';var multer=require('multer');var util=require(_0x5f97('0x0'));var path=require(_0x5f97('0x1'));var timeout=require(_0x5f97('0x2'));var express=require(_0x5f97('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5f97('0x4'));var interaction=require(_0x5f97('0x5'));var config=require(_0x5f97('0x6'));var controller=require(_0x5f97('0x7'));router[_0x5f97('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f97('0x9')]);router[_0x5f97('0x8')](_0x5f97('0xa'),auth['isAuthenticated'](),controller[_0x5f97('0xb')]);router['get'](_0x5f97('0xc'),auth['isAuthenticated'](),controller[_0x5f97('0xd')]);router[_0x5f97('0x8')](_0x5f97('0xe'),auth[_0x5f97('0xf')](),controller['getHopperHistories']);router[_0x5f97('0x8')](_0x5f97('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x5f97('0x8')](_0x5f97('0x11'),auth[_0x5f97('0xf')](),controller[_0x5f97('0x12')]);router[_0x5f97('0x8')](_0x5f97('0x13'),auth[_0x5f97('0xf')](),controller['getLists']);router[_0x5f97('0x8')](_0x5f97('0x14'),auth[_0x5f97('0xf')](),controller['getBlackLists']);router[_0x5f97('0x15')]('/',auth[_0x5f97('0xf')](),controller[_0x5f97('0x16')]);router[_0x5f97('0x15')](_0x5f97('0x17'),auth[_0x5f97('0xf')](),controller['clone']);router[_0x5f97('0x15')](_0x5f97('0x13'),auth[_0x5f97('0xf')](),controller[_0x5f97('0x18')]);router[_0x5f97('0x15')](_0x5f97('0x14'),auth[_0x5f97('0xf')](),controller[_0x5f97('0x19')]);router[_0x5f97('0x1a')]('/:id',auth[_0x5f97('0xf')](),controller[_0x5f97('0x1b')]);router[_0x5f97('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x5f97('0x1d')]);router[_0x5f97('0x1c')]('/:id/lists',auth[_0x5f97('0xf')](),controller[_0x5f97('0x1e')]);router[_0x5f97('0x1c')](_0x5f97('0x14'),auth[_0x5f97('0xf')](),controller[_0x5f97('0x1f')]);module[_0x5f97('0x20')]=router; \ No newline at end of file +var _0x78d8=['clone','addLists','addBlackLists','destroy','delete','removeLists','removeBlackLists','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x501423,_0x21132d){var _0x28d2d2=function(_0x45ed45){while(--_0x45ed45){_0x501423['push'](_0x501423['shift']());}};_0x28d2d2(++_0x21132d);}(_0x78d8,0x15c));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x878d('0x0'));var path=require(_0x878d('0x1'));var timeout=require(_0x878d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x878d('0x3'));var config=require(_0x878d('0x4'));var controller=require(_0x878d('0x5'));router[_0x878d('0x6')]('/',auth[_0x878d('0x7')](),controller[_0x878d('0x8')]);router[_0x878d('0x6')](_0x878d('0x9'),auth[_0x878d('0x7')](),controller[_0x878d('0xa')]);router['get']('/:id/hoppers',auth[_0x878d('0x7')](),controller[_0x878d('0xb')]);router[_0x878d('0x6')](_0x878d('0xc'),auth[_0x878d('0x7')](),controller[_0x878d('0xd')]);router[_0x878d('0x6')]('/:id/hopper_finals',auth[_0x878d('0x7')](),controller[_0x878d('0xe')]);router['get'](_0x878d('0xf'),auth[_0x878d('0x7')](),controller[_0x878d('0x10')]);router['get'](_0x878d('0x11'),auth['isAuthenticated'](),controller[_0x878d('0x12')]);router[_0x878d('0x6')](_0x878d('0x13'),auth['isAuthenticated'](),controller[_0x878d('0x14')]);router[_0x878d('0x15')]('/',auth[_0x878d('0x7')](),controller[_0x878d('0x16')]);router['post'](_0x878d('0x17'),auth[_0x878d('0x7')](),controller[_0x878d('0x18')]);router['post']('/:id/lists',auth[_0x878d('0x7')](),controller[_0x878d('0x19')]);router[_0x878d('0x15')]('/:id/blacklists',auth[_0x878d('0x7')](),controller[_0x878d('0x1a')]);router['put'](_0x878d('0x9'),auth[_0x878d('0x7')](),controller['update']);router['delete'](_0x878d('0x9'),auth[_0x878d('0x7')](),controller[_0x878d('0x1b')]);router[_0x878d('0x1c')](_0x878d('0x11'),auth[_0x878d('0x7')](),controller[_0x878d('0x1d')]);router[_0x878d('0x1c')](_0x878d('0x13'),auth[_0x878d('0x7')](),controller[_0x878d('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c841134..5d01ec8 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 _0x12b8=['exports','TEXT','medium','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x346db1,_0x447295){var _0x35fd54=function(_0x216eb5){while(--_0x216eb5){_0x346db1['push'](_0x346db1['shift']());}};_0x35fd54(++_0x447295);}(_0x12b8,0x18f));var _0x812b=function(_0x32d655,_0x252a9c){_0x32d655=_0x32d655-0x0;var _0x4110e0=_0x12b8[_0x32d655];return _0x4110e0;};'use strict';var Sequelize=require(_0x812b('0x0'));module[_0x812b('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x812b('0x2')],'length':_0x812b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x812b('0x4')]},'name':{'type':Sequelize[_0x812b('0x5')],'get':function(){return this[_0x812b('0x6')](_0x812b('0x7'));}}}; \ No newline at end of file +var _0x7718=['VIRTUAL','getDataValue','key','exports','TEXT','medium','STRING'];(function(_0x37c1ff,_0x5be515){var _0x1a6df2=function(_0x1b42b6){while(--_0x1b42b6){_0x37c1ff['push'](_0x37c1ff['shift']());}};_0x1a6df2(++_0x5be515);}(_0x7718,0xab));var _0x8771=function(_0x37542d,_0x49d3e3){_0x37542d=_0x37542d-0x0;var _0x1574c7=_0x7718[_0x37542d];return _0x1574c7;};'use strict';var Sequelize=require('sequelize');module[_0x8771('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8771('0x1')],'length':_0x8771('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8771('0x3')]},'name':{'type':Sequelize[_0x8771('0x4')],'get':function(){return this[_0x8771('0x5')](_0x8771('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1af4b7e..ca8a2be 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 _0xb0f0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','params','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb0f0,0x161));var _0x0b0f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb0f0[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x0b0f('0x0'));var rimraf=require(_0x0b0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b0f('0x2'));var rp=require(_0x0b0f('0x3'));var moment=require(_0x0b0f('0x4'));var BPromise=require(_0x0b0f('0x5'));var Mustache=require(_0x0b0f('0x6'));var util=require(_0x0b0f('0x7'));var path=require('path');var sox=require(_0x0b0f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b0f('0x9'));var _=require(_0x0b0f('0xa'));var squel=require('squel');var crypto=require(_0x0b0f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0b0f('0xc'));var toCsv=require(_0x0b0f('0xd'));var querystring=require('querystring');var Papa=require(_0x0b0f('0xe'));var Redis=require(_0x0b0f('0xf'));var authService=require(_0x0b0f('0x10'));var qs=require(_0x0b0f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b0f('0x12'));var logger=require(_0x0b0f('0x13'))(_0x0b0f('0x14'));var utils=require(_0x0b0f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32389c,_0x27669a){_0x27669a=_0x27669a||0xcc;return function(_0x1837e0){if(_0x1837e0){return _0x32389c[_0x0b0f('0x16')](_0x27669a);}return _0x32389c[_0x0b0f('0x17')](_0x27669a)[_0x0b0f('0x18')]();};}function respondWithResult(_0x18b31b,_0xa790ac){_0xa790ac=_0xa790ac||0xc8;return function(_0x5d10f5){if(_0x5d10f5){return _0x18b31b['status'](_0xa790ac)[_0x0b0f('0x19')](_0x5d10f5);}};}function respondWithFilteredResult(_0x10df33,_0x217bee){return function(_0x53cedf){if(_0x53cedf){var _0x35d8d5=typeof _0x217bee[_0x0b0f('0x1a')]===_0x0b0f('0x1b')&&typeof _0x217bee[_0x0b0f('0x1c')]===_0x0b0f('0x1b');var _0x2ecdcf=_0x53cedf[_0x0b0f('0x1d')];var _0x13dd31=_0x35d8d5?0x0:_0x217bee[_0x0b0f('0x1a')];var _0xf2fc7d=_0x35d8d5?_0x53cedf[_0x0b0f('0x1d')]:_0x217bee[_0x0b0f('0x1a')]+_0x217bee[_0x0b0f('0x1c')];var _0x2eb645;if(_0xf2fc7d>=_0x2ecdcf){_0xf2fc7d=_0x2ecdcf;_0x2eb645=0xc8;}else{_0x2eb645=0xce;}_0x10df33[_0x0b0f('0x17')](_0x2eb645);return _0x10df33[_0x0b0f('0x1e')](_0x0b0f('0x1f'),_0x13dd31+'-'+_0xf2fc7d+'/'+_0x2ecdcf)[_0x0b0f('0x19')](_0x53cedf);}return null;};}function patchUpdates(_0x1e718d){return function(_0x370816){try{jsonpatch[_0x0b0f('0x20')](_0x370816,_0x1e718d,!![]);}catch(_0x3e00ab){return BPromise[_0x0b0f('0x21')](_0x3e00ab);}return _0x370816[_0x0b0f('0x22')]();};}function saveUpdates(_0x3d3371,_0x41605b){return function(_0x1898fb){if(_0x1898fb){return _0x1898fb['update'](_0x3d3371)[_0x0b0f('0x23')](function(_0x4fda51){return _0x4fda51;});}return null;};}function removeEntity(_0x3eddc9,_0x285cdc){return function(_0x1c84c0){if(_0x1c84c0){return _0x1c84c0[_0x0b0f('0x24')]()[_0x0b0f('0x23')](function(){var _0x49833a=_0x1c84c0[_0x0b0f('0x25')]({'plain':!![]});var _0x47a297=_0x0b0f('0x26');return db[_0x0b0f('0x27')][_0x0b0f('0x24')]({'where':{'type':_0x47a297,'resourceId':_0x49833a['id']}})[_0x0b0f('0x23')](function(){return _0x1c84c0;});})['then'](function(){_0x3eddc9['status'](0xcc)[_0x0b0f('0x18')]();});}};}function handleEntityNotFound(_0x557487,_0x2c42fb){return function(_0x2ad527){if(!_0x2ad527){_0x557487['sendStatus'](0x194);}return _0x2ad527;};}function handleError(_0x7337dc,_0x15570){_0x15570=_0x15570||0x1f4;return function(_0x2cfc0d){logger[_0x0b0f('0x28')](_0x2cfc0d[_0x0b0f('0x29')]);if(_0x2cfc0d[_0x0b0f('0x2a')]){delete _0x2cfc0d[_0x0b0f('0x2a')];}_0x7337dc[_0x0b0f('0x17')](_0x15570)['send'](_0x2cfc0d);};}exports[_0x0b0f('0x2b')]=function(_0x3a61fb,_0x6f1ce7){var _0x1bc6c7={},_0x1685ee={},_0x5180c5={'count':0x0,'rows':[]};var _0x476f1a=_[_0x0b0f('0x2c')](db[_0x0b0f('0x2d')][_0x0b0f('0x2e')],function(_0x85b8df){return{'name':_0x85b8df[_0x0b0f('0x2f')],'type':_0x85b8df[_0x0b0f('0x30')][_0x0b0f('0x31')]};});_0x1685ee['model']=_[_0x0b0f('0x2c')](_0x476f1a,_0x0b0f('0x2a'));_0x1685ee[_0x0b0f('0x32')]=_[_0x0b0f('0x33')](_0x3a61fb[_0x0b0f('0x32')]);_0x1685ee['filters']=_[_0x0b0f('0x34')](_0x1685ee[_0x0b0f('0x35')],_0x1685ee[_0x0b0f('0x32')]);_0x1bc6c7[_0x0b0f('0x36')]=_[_0x0b0f('0x34')](_0x1685ee[_0x0b0f('0x35')],qs[_0x0b0f('0x37')](_0x3a61fb[_0x0b0f('0x32')][_0x0b0f('0x37')]));_0x1bc6c7['attributes']=_0x1bc6c7['attributes'][_0x0b0f('0x38')]?_0x1bc6c7[_0x0b0f('0x36')]:_0x1685ee[_0x0b0f('0x35')];if(!_0x3a61fb['query'][_0x0b0f('0x39')](_0x0b0f('0x3a'))){_0x1bc6c7[_0x0b0f('0x1c')]=qs[_0x0b0f('0x1c')](_0x3a61fb['query'][_0x0b0f('0x1c')]);_0x1bc6c7['offset']=qs[_0x0b0f('0x1a')](_0x3a61fb[_0x0b0f('0x32')]['offset']);}_0x1bc6c7['order']=qs[_0x0b0f('0x3b')](_0x3a61fb[_0x0b0f('0x32')][_0x0b0f('0x3b')]);_0x1bc6c7[_0x0b0f('0x3c')]=qs[_0x0b0f('0x3d')](_[_0x0b0f('0x3e')](_0x3a61fb['query'],_0x1685ee[_0x0b0f('0x3d')]),_0x476f1a);if(_0x3a61fb['query'][_0x0b0f('0x3f')]){_0x1bc6c7['where']=_[_0x0b0f('0x40')](_0x1bc6c7['where'],{'$or':[{'key':{'$like':'%'+_0x3a61fb['query'][_0x0b0f('0x3f')]+'%'}},{'value':{'$like':'%'+_0x3a61fb['query']['filter']+'%'}}]});}_0x1bc6c7=_[_0x0b0f('0x40')]({},_0x1bc6c7,_0x3a61fb[_0x0b0f('0x41')]);var _0x2738aa={'where':_0x1bc6c7[_0x0b0f('0x3c')]};return db[_0x0b0f('0x2d')][_0x0b0f('0x1d')](_0x2738aa)[_0x0b0f('0x23')](function(_0x1fcf0f){_0x5180c5['count']=_0x1fcf0f;if(_0x3a61fb[_0x0b0f('0x32')][_0x0b0f('0x42')]){_0x1bc6c7[_0x0b0f('0x43')]=[{'all':!![]}];}return db[_0x0b0f('0x2d')]['findAll'](_0x1bc6c7);})[_0x0b0f('0x23')](function(_0x10cc75){_0x5180c5[_0x0b0f('0x44')]=_0x10cc75;return _0x5180c5;})[_0x0b0f('0x23')](respondWithFilteredResult(_0x6f1ce7,_0x1bc6c7))[_0x0b0f('0x45')](handleError(_0x6f1ce7,null));};exports['show']=function(_0x231409,_0x2469ca){var _0xb755c7={'raw':!![],'where':{'id':_0x231409[_0x0b0f('0x46')]['id']}},_0x3eb88f={};_0x3eb88f[_0x0b0f('0x35')]=_[_0x0b0f('0x33')](db[_0x0b0f('0x2d')]['rawAttributes']);_0x3eb88f[_0x0b0f('0x32')]=_['keys'](_0x231409[_0x0b0f('0x32')]);_0x3eb88f[_0x0b0f('0x3d')]=_['intersection'](_0x3eb88f[_0x0b0f('0x35')],_0x3eb88f[_0x0b0f('0x32')]);_0xb755c7['attributes']=_[_0x0b0f('0x34')](_0x3eb88f[_0x0b0f('0x35')],qs['fields'](_0x231409[_0x0b0f('0x32')][_0x0b0f('0x37')]));_0xb755c7[_0x0b0f('0x36')]=_0xb755c7['attributes']['length']?_0xb755c7['attributes']:_0x3eb88f['model'];if(_0x231409[_0x0b0f('0x32')][_0x0b0f('0x42')]){_0xb755c7[_0x0b0f('0x43')]=[{'all':!![]}];}_0xb755c7=_[_0x0b0f('0x40')]({},_0xb755c7,_0x231409[_0x0b0f('0x41')]);return db['CannedAnswer'][_0x0b0f('0x47')](_0xb755c7)[_0x0b0f('0x23')](handleEntityNotFound(_0x2469ca,null))[_0x0b0f('0x23')](respondWithResult(_0x2469ca,null))['catch'](handleError(_0x2469ca,null));};exports[_0x0b0f('0x48')]=function(_0x12ba33,_0x2eb57e){if(_0x12ba33[_0x0b0f('0x49')]['id']){delete _0x12ba33[_0x0b0f('0x49')]['id'];}return db[_0x0b0f('0x2d')]['find']({'where':{'id':_0x12ba33[_0x0b0f('0x46')]['id']}})[_0x0b0f('0x23')](handleEntityNotFound(_0x2eb57e,null))['then'](saveUpdates(_0x12ba33['body'],null))[_0x0b0f('0x23')](respondWithResult(_0x2eb57e,null))[_0x0b0f('0x45')](handleError(_0x2eb57e,null));};exports[_0x0b0f('0x24')]=function(_0x3b48f0,_0x542be3){return db[_0x0b0f('0x2d')]['find']({'where':{'id':_0x3b48f0[_0x0b0f('0x46')]['id']}})[_0x0b0f('0x23')](handleEntityNotFound(_0x542be3,null))[_0x0b0f('0x23')](removeEntity(_0x542be3,null))[_0x0b0f('0x45')](handleError(_0x542be3,null));};exports[_0x0b0f('0x4a')]=function(_0xd62d75,_0x55abb7){var _0x11beec={'key':_0xd62d75['body'][_0x0b0f('0x31')]};if(_0xd62d75[_0x0b0f('0x49')][_0x0b0f('0x4b')]){_0x11beec[_0x0b0f('0x4b')]=_0xd62d75[_0x0b0f('0x49')]['MailAccountId'];}else if(_0xd62d75[_0x0b0f('0x49')][_0x0b0f('0x4c')]){_0x11beec[_0x0b0f('0x4c')]=_0xd62d75[_0x0b0f('0x49')]['SmsAccountId'];}else if(_0xd62d75[_0x0b0f('0x49')][_0x0b0f('0x4d')]){_0x11beec[_0x0b0f('0x4d')]=_0xd62d75[_0x0b0f('0x49')][_0x0b0f('0x4d')];}else if(_0xd62d75['body'][_0x0b0f('0x4e')]){_0x11beec[_0x0b0f('0x4e')]=_0xd62d75[_0x0b0f('0x49')]['ChatWebsiteId'];}return db[_0x0b0f('0x2d')][_0x0b0f('0x47')]({'where':_0x11beec})[_0x0b0f('0x23')](function(_0xf11a29){if(_0xf11a29){throw new db['Sequelize'][(_0x0b0f('0x4f'))](_0x0b0f('0x50'));}return db[_0x0b0f('0x2d')][_0x0b0f('0x4a')](_0xd62d75[_0x0b0f('0x49')]);})[_0x0b0f('0x23')](function(_0x1b877d){var _0x5e9b82=_0xd62d75[_0x0b0f('0x51')]['get']({'plain':!![]});if(!_0x5e9b82)throw new Error(_0x0b0f('0x52'));if(_0x5e9b82[_0x0b0f('0x53')]==='user'){var _0x440715=_0x1b877d[_0x0b0f('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x0b0f('0x47')]({'where':{'name':_0x0b0f('0x26'),'userProfileId':_0x5e9b82[_0x0b0f('0x54')]},'raw':!![]})['then'](function(_0x471ff6){if(_0x471ff6&&_0x471ff6[_0x0b0f('0x55')]===0x0){return db['UserProfileResource'][_0x0b0f('0x4a')]({'name':_0x440715['name'],'resourceId':_0x440715['id'],'type':_0x471ff6[_0x0b0f('0x2a')],'sectionId':_0x471ff6['id']},{})[_0x0b0f('0x23')](function(){return _0x1b877d;});}else{return _0x1b877d;}})['catch'](function(_0x2e5368){logger[_0x0b0f('0x28')](_0x0b0f('0x56'),_0x2e5368);throw _0x2e5368;});}return _0x1b877d;})[_0x0b0f('0x23')](respondWithResult(_0x55abb7,0xc9))['catch'](handleError(_0x55abb7,null));}; \ No newline at end of file +var _0x1506=['index','CannedAnswer','fieldName','type','key','model','map','name','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','get','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','then','destroy','CannedAnswers','UserProfileResource','end','error','send'];(function(_0x2594bf,_0x178efa){var _0x288ea8=function(_0x3074a4){while(--_0x3074a4){_0x2594bf['push'](_0x2594bf['shift']());}};_0x288ea8(++_0x178efa);}(_0x1506,0x1a1));var _0x6150=function(_0x1b9836,_0x426a07){_0x1b9836=_0x1b9836-0x0;var _0x2ce12d=_0x1506[_0x1b9836];return _0x2ce12d;};'use strict';var emlformat=require(_0x6150('0x0'));var rimraf=require(_0x6150('0x1'));var zipdir=require(_0x6150('0x2'));var jsonpatch=require(_0x6150('0x3'));var rp=require(_0x6150('0x4'));var moment=require(_0x6150('0x5'));var BPromise=require(_0x6150('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6150('0x7'));var sox=require(_0x6150('0x8'));var csv=require(_0x6150('0x9'));var ejs=require(_0x6150('0xa'));var fs=require('fs');var fs_extra=require(_0x6150('0xb'));var _=require(_0x6150('0xc'));var squel=require(_0x6150('0xd'));var crypto=require(_0x6150('0xe'));var jsforce=require(_0x6150('0xf'));var deskjs=require(_0x6150('0x10'));var toCsv=require(_0x6150('0x9'));var querystring=require(_0x6150('0x11'));var Papa=require(_0x6150('0x12'));var Redis=require(_0x6150('0x13'));var authService=require(_0x6150('0x14'));var qs=require(_0x6150('0x15'));var as=require(_0x6150('0x16'));var hardwareService=require(_0x6150('0x17'));var logger=require(_0x6150('0x18'))(_0x6150('0x19'));var utils=require(_0x6150('0x1a'));var config=require(_0x6150('0x1b'));var licenseUtil=require(_0x6150('0x1c'));var db=require(_0x6150('0x1d'))['db'];function respondWithStatusCode(_0x232f43,_0x393848){_0x393848=_0x393848||0xcc;return function(_0x3b2d5a){if(_0x3b2d5a){return _0x232f43[_0x6150('0x1e')](_0x393848);}return _0x232f43['status'](_0x393848)['end']();};}function respondWithResult(_0xa79e4,_0xdf4876){_0xdf4876=_0xdf4876||0xc8;return function(_0x3f3c61){if(_0x3f3c61){return _0xa79e4['status'](_0xdf4876)[_0x6150('0x1f')](_0x3f3c61);}};}function respondWithFilteredResult(_0x5a07d8,_0x3349f9){return function(_0xdb2b7a){if(_0xdb2b7a){var _0x410042=typeof _0x3349f9[_0x6150('0x20')]===_0x6150('0x21')&&typeof _0x3349f9['limit']==='undefined';var _0x550635=_0xdb2b7a[_0x6150('0x22')];var _0x3f926e=_0x410042?0x0:_0x3349f9[_0x6150('0x20')];var _0x32e538=_0x410042?_0xdb2b7a[_0x6150('0x22')]:_0x3349f9[_0x6150('0x20')]+_0x3349f9[_0x6150('0x23')];var _0x4bebe2;if(_0x32e538>=_0x550635){_0x32e538=_0x550635;_0x4bebe2=0xc8;}else{_0x4bebe2=0xce;}_0x5a07d8[_0x6150('0x24')](_0x4bebe2);return _0x5a07d8[_0x6150('0x25')](_0x6150('0x26'),_0x3f926e+'-'+_0x32e538+'/'+_0x550635)[_0x6150('0x1f')](_0xdb2b7a);}return null;};}function patchUpdates(_0x137bff){return function(_0x563644){try{jsonpatch[_0x6150('0x27')](_0x563644,_0x137bff,!![]);}catch(_0x16fdab){return BPromise[_0x6150('0x28')](_0x16fdab);}return _0x563644['save']();};}function saveUpdates(_0x2463d1,_0x2a79b8){return function(_0x28093b){if(_0x28093b){return _0x28093b['update'](_0x2463d1)[_0x6150('0x29')](function(_0x57fe21){return _0x57fe21;});}return null;};}function removeEntity(_0x3e4a50,_0x3be8a2){return function(_0x2bab48){if(_0x2bab48){return _0x2bab48[_0x6150('0x2a')]()[_0x6150('0x29')](function(){var _0x27a5c4=_0x2bab48['get']({'plain':!![]});var _0x16d193=_0x6150('0x2b');return db[_0x6150('0x2c')]['destroy']({'where':{'type':_0x16d193,'resourceId':_0x27a5c4['id']}})[_0x6150('0x29')](function(){return _0x2bab48;});})[_0x6150('0x29')](function(){_0x3e4a50['status'](0xcc)[_0x6150('0x2d')]();});}};}function handleEntityNotFound(_0x1617f2,_0x336248){return function(_0x46c008){if(!_0x46c008){_0x1617f2[_0x6150('0x1e')](0x194);}return _0x46c008;};}function handleError(_0x4d7d06,_0x199f20){_0x199f20=_0x199f20||0x1f4;return function(_0x1b3e49){logger[_0x6150('0x2e')](_0x1b3e49['stack']);if(_0x1b3e49['name']){delete _0x1b3e49['name'];}_0x4d7d06['status'](_0x199f20)[_0x6150('0x2f')](_0x1b3e49);};}exports[_0x6150('0x30')]=function(_0x48064f,_0x4d3547){var _0x754fe1={},_0x169657={},_0x74e62={'count':0x0,'rows':[]};var _0x202845=_['map'](db[_0x6150('0x31')]['rawAttributes'],function(_0x5e5887){return{'name':_0x5e5887[_0x6150('0x32')],'type':_0x5e5887[_0x6150('0x33')][_0x6150('0x34')]};});_0x169657[_0x6150('0x35')]=_[_0x6150('0x36')](_0x202845,_0x6150('0x37'));_0x169657[_0x6150('0x38')]=_[_0x6150('0x39')](_0x48064f[_0x6150('0x38')]);_0x169657['filters']=_[_0x6150('0x3a')](_0x169657[_0x6150('0x35')],_0x169657[_0x6150('0x38')]);_0x754fe1['attributes']=_[_0x6150('0x3a')](_0x169657[_0x6150('0x35')],qs[_0x6150('0x3b')](_0x48064f[_0x6150('0x38')][_0x6150('0x3b')]));_0x754fe1[_0x6150('0x3c')]=_0x754fe1[_0x6150('0x3c')][_0x6150('0x3d')]?_0x754fe1[_0x6150('0x3c')]:_0x169657['model'];if(!_0x48064f['query']['hasOwnProperty'](_0x6150('0x3e'))){_0x754fe1[_0x6150('0x23')]=qs[_0x6150('0x23')](_0x48064f[_0x6150('0x38')]['limit']);_0x754fe1[_0x6150('0x20')]=qs[_0x6150('0x20')](_0x48064f[_0x6150('0x38')][_0x6150('0x20')]);}_0x754fe1[_0x6150('0x3f')]=qs[_0x6150('0x40')](_0x48064f[_0x6150('0x38')][_0x6150('0x40')]);_0x754fe1[_0x6150('0x41')]=qs[_0x6150('0x42')](_['pick'](_0x48064f[_0x6150('0x38')],_0x169657[_0x6150('0x42')]),_0x202845);if(_0x48064f['query'][_0x6150('0x43')]){_0x754fe1[_0x6150('0x41')]=_['merge'](_0x754fe1[_0x6150('0x41')],{'$or':[{'key':{'$like':'%'+_0x48064f['query']['filter']+'%'}},{'value':{'$like':'%'+_0x48064f[_0x6150('0x38')][_0x6150('0x43')]+'%'}}]});}_0x754fe1=_[_0x6150('0x44')]({},_0x754fe1,_0x48064f[_0x6150('0x45')]);var _0x5d128b={'where':_0x754fe1['where']};return db['CannedAnswer'][_0x6150('0x22')](_0x5d128b)['then'](function(_0x1adfef){_0x74e62[_0x6150('0x22')]=_0x1adfef;if(_0x48064f[_0x6150('0x38')][_0x6150('0x46')]){_0x754fe1[_0x6150('0x47')]=[{'all':!![]}];}return db[_0x6150('0x31')][_0x6150('0x48')](_0x754fe1);})[_0x6150('0x29')](function(_0x3a2f2b){_0x74e62['rows']=_0x3a2f2b;return _0x74e62;})[_0x6150('0x29')](respondWithFilteredResult(_0x4d3547,_0x754fe1))[_0x6150('0x49')](handleError(_0x4d3547,null));};exports[_0x6150('0x4a')]=function(_0x3c898f,_0x41a216){var _0x2e8afa={'raw':!![],'where':{'id':_0x3c898f[_0x6150('0x4b')]['id']}},_0x254fa0={};_0x254fa0[_0x6150('0x35')]=_[_0x6150('0x39')](db['CannedAnswer'][_0x6150('0x4c')]);_0x254fa0[_0x6150('0x38')]=_[_0x6150('0x39')](_0x3c898f[_0x6150('0x38')]);_0x254fa0['filters']=_[_0x6150('0x3a')](_0x254fa0[_0x6150('0x35')],_0x254fa0['query']);_0x2e8afa[_0x6150('0x3c')]=_[_0x6150('0x3a')](_0x254fa0[_0x6150('0x35')],qs[_0x6150('0x3b')](_0x3c898f['query'][_0x6150('0x3b')]));_0x2e8afa['attributes']=_0x2e8afa[_0x6150('0x3c')][_0x6150('0x3d')]?_0x2e8afa[_0x6150('0x3c')]:_0x254fa0[_0x6150('0x35')];if(_0x3c898f[_0x6150('0x38')]['includeAll']){_0x2e8afa[_0x6150('0x47')]=[{'all':!![]}];}_0x2e8afa=_['merge']({},_0x2e8afa,_0x3c898f['options']);return db['CannedAnswer'][_0x6150('0x4d')](_0x2e8afa)[_0x6150('0x29')](handleEntityNotFound(_0x41a216,null))['then'](respondWithResult(_0x41a216,null))[_0x6150('0x49')](handleError(_0x41a216,null));};exports[_0x6150('0x4e')]=function(_0x5c79a2,_0x2df28d){if(_0x5c79a2[_0x6150('0x4f')]['id']){delete _0x5c79a2[_0x6150('0x4f')]['id'];}return db[_0x6150('0x31')][_0x6150('0x4d')]({'where':{'id':_0x5c79a2['params']['id']}})[_0x6150('0x29')](handleEntityNotFound(_0x2df28d,null))['then'](saveUpdates(_0x5c79a2[_0x6150('0x4f')],null))[_0x6150('0x29')](respondWithResult(_0x2df28d,null))[_0x6150('0x49')](handleError(_0x2df28d,null));};exports[_0x6150('0x2a')]=function(_0x45f021,_0x3de1f9){return db[_0x6150('0x31')][_0x6150('0x4d')]({'where':{'id':_0x45f021[_0x6150('0x4b')]['id']}})[_0x6150('0x29')](handleEntityNotFound(_0x3de1f9,null))['then'](removeEntity(_0x3de1f9,null))[_0x6150('0x49')](handleError(_0x3de1f9,null));};exports['create']=function(_0x8c1f72,_0x5e9db7){var _0x4f5235={'key':_0x8c1f72[_0x6150('0x4f')][_0x6150('0x34')]};if(_0x8c1f72['body'][_0x6150('0x50')]){_0x4f5235[_0x6150('0x50')]=_0x8c1f72['body']['MailAccountId'];}else if(_0x8c1f72[_0x6150('0x4f')][_0x6150('0x51')]){_0x4f5235['SmsAccountId']=_0x8c1f72[_0x6150('0x4f')]['SmsAccountId'];}else if(_0x8c1f72['body'][_0x6150('0x52')]){_0x4f5235[_0x6150('0x52')]=_0x8c1f72[_0x6150('0x4f')][_0x6150('0x52')];}else if(_0x8c1f72['body'][_0x6150('0x53')]){_0x4f5235[_0x6150('0x53')]=_0x8c1f72[_0x6150('0x4f')][_0x6150('0x53')];}return db['CannedAnswer'][_0x6150('0x4d')]({'where':_0x4f5235})[_0x6150('0x29')](function(_0x1b3d04){if(_0x1b3d04){throw new db['Sequelize'][(_0x6150('0x54'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x6150('0x31')]['create'](_0x8c1f72[_0x6150('0x4f')]);})[_0x6150('0x29')](function(_0x294345){var _0x4353d5=_0x8c1f72[_0x6150('0x55')][_0x6150('0x56')]({'plain':!![]});if(!_0x4353d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4353d5[_0x6150('0x57')]==='user'){var _0x6d7a3f=_0x294345[_0x6150('0x56')]({'plain':!![]});return db[_0x6150('0x58')][_0x6150('0x4d')]({'where':{'name':_0x6150('0x2b'),'userProfileId':_0x4353d5[_0x6150('0x59')]},'raw':!![]})['then'](function(_0x1ec681){if(_0x1ec681&&_0x1ec681[_0x6150('0x5a')]===0x0){return db[_0x6150('0x2c')][_0x6150('0x5b')]({'name':_0x6d7a3f[_0x6150('0x37')],'resourceId':_0x6d7a3f['id'],'type':_0x1ec681[_0x6150('0x37')],'sectionId':_0x1ec681['id']},{})[_0x6150('0x29')](function(){return _0x294345;});}else{return _0x294345;}})[_0x6150('0x49')](function(_0x28f2dc){logger[_0x6150('0x2e')](_0x6150('0x5c'),_0x28f2dc);throw _0x28f2dc;});}return _0x294345;})[_0x6150('0x29')](respondWithResult(_0x5e9db7,0xc9))[_0x6150('0x49')](handleError(_0x5e9db7,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 888698c..d02f01d 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 _0xd814=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x4f8287,_0x4990df){var _0x1f8d87=function(_0x2d5604){while(--_0x2d5604){_0x4f8287['push'](_0x4f8287['shift']());}};_0x1f8d87(++_0x4990df);}(_0xd814,0x121));var _0x4d81=function(_0x9d29fa,_0x1bfe00){_0x9d29fa=_0x9d29fa-0x0;var _0x2ec4b8=_0xd814[_0x9d29fa];return _0x2ec4b8;};'use strict';var _=require(_0x4d81('0x0'));var util=require(_0x4d81('0x1'));var logger=require(_0x4d81('0x2'))(_0x4d81('0x3'));var moment=require('moment');var BPromise=require(_0x4d81('0x4'));var rp=require(_0x4d81('0x5'));var fs=require('fs');var path=require(_0x4d81('0x6'));var rimraf=require(_0x4d81('0x7'));var config=require(_0x4d81('0x8'));var attributes=require(_0x4d81('0x9'));module[_0x4d81('0xa')]=function(_0xe5fa7d,_0x5d7c7a){return _0xe5fa7d[_0x4d81('0xb')](_0x4d81('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4d81('0xd')});}; \ No newline at end of file +var _0x8eea=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','tools_canned_answers'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x8eea,0xd2));var _0xa8ee=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x8eea[_0x26d6d9];return _0x1b4875;};'use strict';var _=require(_0xa8ee('0x0'));var util=require('util');var logger=require(_0xa8ee('0x1'))(_0xa8ee('0x2'));var moment=require(_0xa8ee('0x3'));var BPromise=require(_0xa8ee('0x4'));var rp=require(_0xa8ee('0x5'));var fs=require('fs');var path=require(_0xa8ee('0x6'));var rimraf=require(_0xa8ee('0x7'));var config=require(_0xa8ee('0x8'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x121281,_0x5aac49){return _0x121281[_0xa8ee('0x9')]('CannedAnswer',attributes,{'tableName':_0xa8ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa8ee('0xb'),'collate':_0xa8ee('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 474d35b..2e2a447 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(_0x1b50e7,_0x47a827){var _0x6fe1a8=function(_0x529aa6){while(--_0x529aa6){_0x1b50e7['push'](_0x1b50e7['shift']());}};_0x6fe1a8(++_0x47a827);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x946307,_0x13b050){var _0x46af54=function(_0x26ab61){while(--_0x26ab61){_0x946307['push'](_0x946307['shift']());}};_0x46af54(++_0x13b050);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index bcdecfa..4f81070 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 _0x8d1e=['util','path','connect-timeout','express','Router','fs-extra','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports'];(function(_0x19f764,_0x1a230b){var _0x17b88f=function(_0x41bafc){while(--_0x41bafc){_0x19f764['push'](_0x19f764['shift']());}};_0x17b88f(++_0x1a230b);}(_0x8d1e,0x1a9));var _0xe8d1=function(_0x38e870,_0x3d2e6a){_0x38e870=_0x38e870-0x0;var _0x2dabbe=_0x8d1e[_0x38e870];return _0x2dabbe;};'use strict';var multer=require('multer');var util=require(_0xe8d1('0x0'));var path=require(_0xe8d1('0x1'));var timeout=require(_0xe8d1('0x2'));var express=require(_0xe8d1('0x3'));var router=express[_0xe8d1('0x4')]();var fs_extra=require(_0xe8d1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe8d1('0x6'));router[_0xe8d1('0x7')]('/',auth[_0xe8d1('0x8')](),controller[_0xe8d1('0x9')]);router['get'](_0xe8d1('0xa'),auth[_0xe8d1('0x8')](),controller['show']);router[_0xe8d1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe8d1('0xc')](_0xe8d1('0xa'),auth[_0xe8d1('0x8')](),controller[_0xe8d1('0xd')]);router[_0xe8d1('0xe')](_0xe8d1('0xa'),auth['isAuthenticated'](),controller[_0xe8d1('0xf')]);module[_0xe8d1('0x10')]=router; \ No newline at end of file +var _0x0253=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','/:id','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x39fc2c,_0x2f50b8){var _0x2cd759=function(_0x4a5629){while(--_0x4a5629){_0x39fc2c['push'](_0x39fc2c['shift']());}};_0x2cd759(++_0x2f50b8);}(_0x0253,0x199));var _0x3025=function(_0x2290d9,_0x5e9740){_0x2290d9=_0x2290d9-0x0;var _0x3cafaa=_0x0253[_0x2290d9];return _0x3cafaa;};'use strict';var multer=require('multer');var util=require(_0x3025('0x0'));var path=require(_0x3025('0x1'));var timeout=require(_0x3025('0x2'));var express=require(_0x3025('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3025('0x4'));var interaction=require(_0x3025('0x5'));var config=require(_0x3025('0x6'));var controller=require(_0x3025('0x7'));router[_0x3025('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3025('0x8')](_0x3025('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3025('0xa')]('/',auth[_0x3025('0xb')](),controller[_0x3025('0xc')]);router[_0x3025('0xd')]('/:id',auth[_0x3025('0xb')](),controller[_0x3025('0xe')]);router[_0x3025('0xf')](_0x3025('0x9'),auth[_0x3025('0xb')](),controller[_0x3025('0x10')]);module[_0x3025('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 9ec8008..bd47fa7 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 _0x9651=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x18d047,_0x4e2cfb){var _0x28c3c2=function(_0xe750e0){while(--_0xe750e0){_0x18d047['push'](_0x18d047['shift']());}};_0x28c3c2(++_0x4e2cfb);}(_0x9651,0x166));var _0x1965=function(_0x387f4e,_0xf5233c){_0x387f4e=_0x387f4e-0x0;var _0x4b7998=_0x9651[_0x387f4e];return _0x4b7998;};'use strict';var Sequelize=require('sequelize');module[_0x1965('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x1965('0x1')},'clid':{'type':Sequelize[_0x1965('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x1965('0x2')]},'dcontext':{'type':Sequelize[_0x1965('0x2')]},'channel':{'type':Sequelize[_0x1965('0x2')]},'dstchannel':{'type':Sequelize[_0x1965('0x2')]},'lastapp':{'type':Sequelize[_0x1965('0x2')]},'lastdata':{'type':Sequelize[_0x1965('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1965('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1965('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x1965('0x2')]},'uniqueid':{'type':Sequelize[_0x1965('0x2')]},'linkedid':{'type':Sequelize[_0x1965('0x2')]},'sequence':{'type':Sequelize[_0x1965('0x2')]},'peeraccount':{'type':Sequelize[_0x1965('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2bb0=['DATE','STRING','INTEGER','sequelize','exports'];(function(_0x28b9fa,_0x25f40a){var _0x1beb5d=function(_0x56dc14){while(--_0x56dc14){_0x28b9fa['push'](_0x28b9fa['shift']());}};_0x1beb5d(++_0x25f40a);}(_0x2bb0,0xf3));var _0x02bb=function(_0x26d1fd,_0x133ab9){_0x26d1fd=_0x26d1fd-0x0;var _0x56c595=_0x2bb0[_0x26d1fd];return _0x56c595;};'use strict';var Sequelize=require(_0x02bb('0x0'));module[_0x02bb('0x1')]={'calldate':{'type':Sequelize[_0x02bb('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x02bb('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x02bb('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x02bb('0x3')]},'lastapp':{'type':Sequelize[_0x02bb('0x3')]},'lastdata':{'type':Sequelize[_0x02bb('0x3')]},'duration':{'type':Sequelize[_0x02bb('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x02bb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x02bb('0x3')]},'amaflags':{'type':Sequelize[_0x02bb('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x02bb('0x3')]},'uniqueid':{'type':Sequelize[_0x02bb('0x3')]},'linkedid':{'type':Sequelize[_0x02bb('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x02bb('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x02bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index fd5dbf9..1dfc6b9 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 _0x425d=['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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x425d,0x1e0));var _0xd425=function(_0x56d5ea,_0x530395){_0x56d5ea=_0x56d5ea-0x0;var _0x3080c=_0x425d[_0x56d5ea];return _0x3080c;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x1908a5,_0x2afcdb){return function(_0x400dd7){if(!_0x400dd7){_0x1908a5[_0xd425('0x1d')](0x194);}return _0x400dd7;};}function handleError(_0x577e4b,_0x12f951){_0x12f951=_0x12f951||0x1f4;return function(_0x177de2){logger[_0xd425('0x2b')](_0x177de2['stack']);if(_0x177de2[_0xd425('0x2c')]){delete _0x177de2[_0xd425('0x2c')];}_0x577e4b[_0xd425('0x1f')](_0x12f951)[_0xd425('0x2d')](_0x177de2);};}exports[_0xd425('0x2e')]=function(_0x185d7e,_0x2fd17a){var _0x37b63c={},_0x24da23={},_0x1cac61={'count':0x0,'rows':[]};var _0x482ba6=_[_0xd425('0x2f')](db[_0xd425('0x30')][_0xd425('0x31')],function(_0x3695dd){return{'name':_0x3695dd[_0xd425('0x32')],'type':_0x3695dd[_0xd425('0x33')][_0xd425('0x34')]};});_0x24da23[_0xd425('0x35')]=_[_0xd425('0x2f')](_0x482ba6,_0xd425('0x2c'));_0x24da23[_0xd425('0x36')]=_['keys'](_0x185d7e[_0xd425('0x36')]);_0x24da23[_0xd425('0x37')]=_[_0xd425('0x38')](_0x24da23[_0xd425('0x35')],_0x24da23[_0xd425('0x36')]);_0x37b63c['attributes']=_[_0xd425('0x38')](_0x24da23[_0xd425('0x35')],qs['fields'](_0x185d7e['query']['fields']));_0x37b63c[_0xd425('0x39')]=_0x37b63c[_0xd425('0x39')][_0xd425('0x3a')]?_0x37b63c[_0xd425('0x39')]:_0x24da23['model'];if(!_0x185d7e[_0xd425('0x36')][_0xd425('0x3b')](_0xd425('0x3c'))){_0x37b63c[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x185d7e[_0xd425('0x36')][_0xd425('0x23')]);_0x37b63c['offset']=qs[_0xd425('0x21')](_0x185d7e['query'][_0xd425('0x21')]);}_0x37b63c[_0xd425('0x3d')]=qs[_0xd425('0x3e')](_0x185d7e['query'][_0xd425('0x3e')]);_0x37b63c[_0xd425('0x3f')]=qs[_0xd425('0x37')](_[_0xd425('0x40')](_0x185d7e['query'],_0x24da23[_0xd425('0x37')]),_0x482ba6);if(_0x185d7e[_0xd425('0x36')]['filter']){_0x37b63c['where']=_['merge'](_0x37b63c[_0xd425('0x3f')],{'$or':_[_0xd425('0x2f')](_0x482ba6,function(_0x1f30c1){if(_0x1f30c1['type']!=='VIRTUAL'){var _0x58ebb1={};_0x58ebb1[_0x1f30c1[_0xd425('0x2c')]]={'$like':'%'+_0x185d7e[_0xd425('0x36')][_0xd425('0x41')]+'%'};return _0x58ebb1;}})});}_0x37b63c=_[_0xd425('0x42')]({},_0x37b63c,_0x185d7e[_0xd425('0x43')]);var _0x14f3be={'where':_0x37b63c[_0xd425('0x3f')]};return db['Cdr'][_0xd425('0x24')](_0x14f3be)[_0xd425('0x2a')](function(_0x1d82ec){_0x1cac61['count']=_0x1d82ec;if(_0x185d7e[_0xd425('0x36')][_0xd425('0x44')]){_0x37b63c[_0xd425('0x45')]=[{'all':!![]}];}return db['Cdr'][_0xd425('0x46')](_0x37b63c);})[_0xd425('0x2a')](function(_0x1c5ba6){_0x1cac61[_0xd425('0x47')]=_0x1c5ba6;return _0x1cac61;})['then'](respondWithFilteredResult(_0x2fd17a,_0x37b63c))[_0xd425('0x48')](handleError(_0x2fd17a,null));};exports[_0xd425('0x49')]=function(_0x2b1149,_0x41b25e){var _0x3f24fb={'raw':!![],'where':{'id':_0x2b1149[_0xd425('0x4a')]['id']}},_0x2f6bf7={};_0x2f6bf7['model']=_[_0xd425('0x4b')](db[_0xd425('0x30')]['rawAttributes']);_0x2f6bf7[_0xd425('0x36')]=_['keys'](_0x2b1149['query']);_0x2f6bf7[_0xd425('0x37')]=_['intersection'](_0x2f6bf7[_0xd425('0x35')],_0x2f6bf7['query']);_0x3f24fb[_0xd425('0x39')]=_[_0xd425('0x38')](_0x2f6bf7[_0xd425('0x35')],qs[_0xd425('0x4c')](_0x2b1149[_0xd425('0x36')]['fields']));_0x3f24fb[_0xd425('0x39')]=_0x3f24fb['attributes'][_0xd425('0x3a')]?_0x3f24fb['attributes']:_0x2f6bf7[_0xd425('0x35')];if(_0x2b1149[_0xd425('0x36')][_0xd425('0x44')]){_0x3f24fb[_0xd425('0x45')]=[{'all':!![]}];}_0x3f24fb=_[_0xd425('0x42')]({},_0x3f24fb,_0x2b1149['options']);return db[_0xd425('0x30')][_0xd425('0x4d')](_0x3f24fb)[_0xd425('0x2a')](handleEntityNotFound(_0x41b25e,null))[_0xd425('0x2a')](respondWithResult(_0x41b25e,null))[_0xd425('0x48')](handleError(_0x41b25e,null));};exports['create']=function(_0x440dc5,_0x177704){return db[_0xd425('0x30')][_0xd425('0x4e')](_0x440dc5[_0xd425('0x4f')],{})[_0xd425('0x2a')](respondWithResult(_0x177704,0xc9))['catch'](handleError(_0x177704,null));};exports[_0xd425('0x29')]=function(_0x128cb3,_0x5bfac6){if(_0x128cb3[_0xd425('0x4f')]['id']){delete _0x128cb3[_0xd425('0x4f')]['id'];}return db[_0xd425('0x30')][_0xd425('0x4d')]({'where':{'id':_0x128cb3['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5bfac6,null))[_0xd425('0x2a')](saveUpdates(_0x128cb3[_0xd425('0x4f')],null))[_0xd425('0x2a')](respondWithResult(_0x5bfac6,null))[_0xd425('0x48')](handleError(_0x5bfac6,null));};exports['destroy']=function(_0x4be6fa,_0x381bdb){return db['Cdr'][_0xd425('0x4d')]({'where':{'id':_0x4be6fa[_0xd425('0x4a')]['id']}})['then'](handleEntityNotFound(_0x381bdb,null))[_0xd425('0x2a')](removeEntity(_0x381bdb,null))['catch'](handleError(_0x381bdb,null));};exports['describe']=function(_0x39f588,_0x111905){return db[_0xd425('0x30')][_0xd425('0x50')]()[_0xd425('0x2a')](respondWithResult(_0x111905,null))[_0xd425('0x48')](handleError(_0x111905,null));}; \ No newline at end of file +var _0xc3b5=['destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then'];(function(_0xbe78f6,_0x55dacb){var _0x5ac298=function(_0x19bb4c){while(--_0x19bb4c){_0xbe78f6['push'](_0xbe78f6['shift']());}};_0x5ac298(++_0x55dacb);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x286123,_0x139ce3){_0x286123=_0x286123-0x0;var _0x398930=_0xc3b5[_0x286123];return _0x398930;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5c3b('0x0'));var jsonpatch=require(_0x5c3b('0x1'));var rp=require(_0x5c3b('0x2'));var moment=require(_0x5c3b('0x3'));var BPromise=require(_0x5c3b('0x4'));var Mustache=require(_0x5c3b('0x5'));var util=require(_0x5c3b('0x6'));var path=require(_0x5c3b('0x7'));var sox=require('sox');var csv=require(_0x5c3b('0x8'));var ejs=require(_0x5c3b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c3b('0xa'));var squel=require(_0x5c3b('0xb'));var crypto=require(_0x5c3b('0xc'));var jsforce=require(_0x5c3b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c3b('0x8'));var querystring=require(_0x5c3b('0xe'));var Papa=require(_0x5c3b('0xf'));var Redis=require(_0x5c3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c3b('0x11'));var as=require(_0x5c3b('0x12'));var hardwareService=require(_0x5c3b('0x13'));var logger=require(_0x5c3b('0x14'))(_0x5c3b('0x15'));var utils=require('../../config/utils');var config=require(_0x5c3b('0x16'));var licenseUtil=require(_0x5c3b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2815,_0x3b953d){_0x3b953d=_0x3b953d||0xcc;return function(_0x507c2e){if(_0x507c2e){return _0x1b2815[_0x5c3b('0x18')](_0x3b953d);}return _0x1b2815[_0x5c3b('0x19')](_0x3b953d)[_0x5c3b('0x1a')]();};}function respondWithResult(_0x2384b9,_0x315e68){_0x315e68=_0x315e68||0xc8;return function(_0x3fef28){if(_0x3fef28){return _0x2384b9[_0x5c3b('0x19')](_0x315e68)['json'](_0x3fef28);}};}function respondWithFilteredResult(_0x2f7ab2,_0x5b55be){return function(_0x4cf80d){if(_0x4cf80d){var _0x195c1e=typeof _0x5b55be[_0x5c3b('0x1b')]===_0x5c3b('0x1c')&&typeof _0x5b55be['limit']===_0x5c3b('0x1c');var _0x229e28=_0x4cf80d[_0x5c3b('0x1d')];var _0x59f71b=_0x195c1e?0x0:_0x5b55be[_0x5c3b('0x1b')];var _0x34144d=_0x195c1e?_0x4cf80d['count']:_0x5b55be[_0x5c3b('0x1b')]+_0x5b55be[_0x5c3b('0x1e')];var _0x2b2307;if(_0x34144d>=_0x229e28){_0x34144d=_0x229e28;_0x2b2307=0xc8;}else{_0x2b2307=0xce;}_0x2f7ab2[_0x5c3b('0x19')](_0x2b2307);return _0x2f7ab2[_0x5c3b('0x1f')](_0x5c3b('0x20'),_0x59f71b+'-'+_0x34144d+'/'+_0x229e28)[_0x5c3b('0x21')](_0x4cf80d);}return null;};}function patchUpdates(_0x1af39c){return function(_0xc63307){try{jsonpatch[_0x5c3b('0x22')](_0xc63307,_0x1af39c,!![]);}catch(_0x4ec8c1){return BPromise['reject'](_0x4ec8c1);}return _0xc63307[_0x5c3b('0x23')]();};}function saveUpdates(_0x143022,_0x5942f1){return function(_0x439d8e){if(_0x439d8e){return _0x439d8e['update'](_0x143022)[_0x5c3b('0x24')](function(_0xb8006){return _0xb8006;});}return null;};}function removeEntity(_0x2bb9dc,_0xe9261d){return function(_0x529c39){if(_0x529c39){return _0x529c39[_0x5c3b('0x25')]()[_0x5c3b('0x24')](function(){_0x2bb9dc['status'](0xcc)[_0x5c3b('0x1a')]();});}};}function handleEntityNotFound(_0x2c8682,_0x3a8141){return function(_0x3c3991){if(!_0x3c3991){_0x2c8682['sendStatus'](0x194);}return _0x3c3991;};}function handleError(_0x15ae38,_0x20469d){_0x20469d=_0x20469d||0x1f4;return function(_0x2099dc){logger[_0x5c3b('0x26')](_0x2099dc[_0x5c3b('0x27')]);if(_0x2099dc[_0x5c3b('0x28')]){delete _0x2099dc['name'];}_0x15ae38['status'](_0x20469d)['send'](_0x2099dc);};}exports[_0x5c3b('0x29')]=function(_0x3e6832,_0x59b640){var _0xd93418={},_0x15044e={},_0x421d96={'count':0x0,'rows':[]};var _0x2a26df=_[_0x5c3b('0x2a')](db[_0x5c3b('0x2b')][_0x5c3b('0x2c')],function(_0x292266){return{'name':_0x292266[_0x5c3b('0x2d')],'type':_0x292266[_0x5c3b('0x2e')][_0x5c3b('0x2f')]};});_0x15044e[_0x5c3b('0x30')]=_['map'](_0x2a26df,_0x5c3b('0x28'));_0x15044e[_0x5c3b('0x31')]=_[_0x5c3b('0x32')](_0x3e6832[_0x5c3b('0x31')]);_0x15044e[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x15044e[_0x5c3b('0x30')],_0x15044e[_0x5c3b('0x31')]);_0xd93418[_0x5c3b('0x35')]=_[_0x5c3b('0x34')](_0x15044e[_0x5c3b('0x30')],qs[_0x5c3b('0x36')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x36')]));_0xd93418[_0x5c3b('0x35')]=_0xd93418[_0x5c3b('0x35')][_0x5c3b('0x37')]?_0xd93418['attributes']:_0x15044e[_0x5c3b('0x30')];if(!_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x38')](_0x5c3b('0x39'))){_0xd93418['limit']=qs[_0x5c3b('0x1e')](_0x3e6832[_0x5c3b('0x31')]['limit']);_0xd93418[_0x5c3b('0x1b')]=qs[_0x5c3b('0x1b')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x1b')]);}_0xd93418[_0x5c3b('0x3a')]=qs[_0x5c3b('0x3b')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x3b')]);_0xd93418[_0x5c3b('0x3c')]=qs['filters'](_[_0x5c3b('0x3d')](_0x3e6832[_0x5c3b('0x31')],_0x15044e['filters']),_0x2a26df);if(_0x3e6832['query'][_0x5c3b('0x3e')]){_0xd93418[_0x5c3b('0x3c')]=_[_0x5c3b('0x3f')](_0xd93418[_0x5c3b('0x3c')],{'$or':_[_0x5c3b('0x2a')](_0x2a26df,function(_0x406bf9){if(_0x406bf9[_0x5c3b('0x2e')]!=='VIRTUAL'){var _0x499335={};_0x499335[_0x406bf9[_0x5c3b('0x28')]]={'$like':'%'+_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x3e')]+'%'};return _0x499335;}})});}_0xd93418=_[_0x5c3b('0x3f')]({},_0xd93418,_0x3e6832['options']);var _0x16400b={'where':_0xd93418['where']};return db[_0x5c3b('0x2b')][_0x5c3b('0x1d')](_0x16400b)[_0x5c3b('0x24')](function(_0xea3ae1){_0x421d96[_0x5c3b('0x1d')]=_0xea3ae1;if(_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x40')]){_0xd93418[_0x5c3b('0x41')]=[{'all':!![]}];}return db[_0x5c3b('0x2b')]['findAll'](_0xd93418);})['then'](function(_0x345149){_0x421d96[_0x5c3b('0x42')]=_0x345149;return _0x421d96;})[_0x5c3b('0x24')](respondWithFilteredResult(_0x59b640,_0xd93418))[_0x5c3b('0x43')](handleError(_0x59b640,null));};exports[_0x5c3b('0x44')]=function(_0x22fd28,_0x2cec5d){var _0x1d9427={'raw':!![],'where':{'id':_0x22fd28['params']['id']}},_0x29ffdc={};_0x29ffdc[_0x5c3b('0x30')]=_[_0x5c3b('0x32')](db[_0x5c3b('0x2b')]['rawAttributes']);_0x29ffdc[_0x5c3b('0x31')]=_[_0x5c3b('0x32')](_0x22fd28[_0x5c3b('0x31')]);_0x29ffdc[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x29ffdc[_0x5c3b('0x30')],_0x29ffdc[_0x5c3b('0x31')]);_0x1d9427[_0x5c3b('0x35')]=_[_0x5c3b('0x34')](_0x29ffdc[_0x5c3b('0x30')],qs[_0x5c3b('0x36')](_0x22fd28['query'][_0x5c3b('0x36')]));_0x1d9427['attributes']=_0x1d9427[_0x5c3b('0x35')][_0x5c3b('0x37')]?_0x1d9427['attributes']:_0x29ffdc[_0x5c3b('0x30')];if(_0x22fd28[_0x5c3b('0x31')][_0x5c3b('0x40')]){_0x1d9427['include']=[{'all':!![]}];}_0x1d9427=_[_0x5c3b('0x3f')]({},_0x1d9427,_0x22fd28['options']);return db[_0x5c3b('0x2b')][_0x5c3b('0x45')](_0x1d9427)[_0x5c3b('0x24')](handleEntityNotFound(_0x2cec5d,null))[_0x5c3b('0x24')](respondWithResult(_0x2cec5d,null))[_0x5c3b('0x43')](handleError(_0x2cec5d,null));};exports[_0x5c3b('0x46')]=function(_0x2dd72c,_0x3d6034){return db[_0x5c3b('0x2b')][_0x5c3b('0x46')](_0x2dd72c[_0x5c3b('0x47')],{})['then'](respondWithResult(_0x3d6034,0xc9))[_0x5c3b('0x43')](handleError(_0x3d6034,null));};exports['update']=function(_0x155b22,_0x11bf0a){if(_0x155b22[_0x5c3b('0x47')]['id']){delete _0x155b22['body']['id'];}return db[_0x5c3b('0x2b')][_0x5c3b('0x45')]({'where':{'id':_0x155b22['params']['id']}})[_0x5c3b('0x24')](handleEntityNotFound(_0x11bf0a,null))[_0x5c3b('0x24')](saveUpdates(_0x155b22[_0x5c3b('0x47')],null))[_0x5c3b('0x24')](respondWithResult(_0x11bf0a,null))[_0x5c3b('0x43')](handleError(_0x11bf0a,null));};exports[_0x5c3b('0x25')]=function(_0x37870f,_0x21e430){return db[_0x5c3b('0x2b')][_0x5c3b('0x45')]({'where':{'id':_0x37870f[_0x5c3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x21e430,null))['then'](removeEntity(_0x21e430,null))['catch'](handleError(_0x21e430,null));};exports[_0x5c3b('0x49')]=function(_0x203ae2,_0x5f14fa){return db[_0x5c3b('0x2b')][_0x5c3b('0x49')]()[_0x5c3b('0x24')](respondWithResult(_0x5f14fa,null))[_0x5c3b('0x43')](handleError(_0x5f14fa,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ec770c1..f8ea33d 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1defc8,_0x277868){var _0x18e89c=function(_0x2ca5da){while(--_0x2ca5da){_0x1defc8['push'](_0x1defc8['shift']());}};_0x18e89c(++_0x277868);}(_0x7a54,0x106));var _0x47a5=function(_0x533fe5,_0x4a188c){_0x533fe5=_0x533fe5-0x0;var _0x4e85ed=_0x7a54[_0x533fe5];return _0x4e85ed;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xd861ec,_0x48b114){var _0x57a4e3=function(_0x156acb){while(--_0x156acb){_0xd861ec['push'](_0xd861ec['shift']());}};_0x57a4e3(++_0x48b114);}(_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 4ee72bd..edf0105 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 _0x7278=['info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x327950,_0x3cb562){var _0xc65218=function(_0x4b0a7d){while(--_0x4b0a7d){_0x327950['push'](_0x327950['shift']());}};_0xc65218(++_0x3cb562);}(_0x7278,0x153));var _0x8727=function(_0x70c0a2,_0x10f58e){_0x70c0a2=_0x70c0a2-0x0;var _0x16a9e0=_0x7278[_0x70c0a2];return _0x16a9e0;};'use strict';var _=require(_0x8727('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8727('0x1'));var rs=require(_0x8727('0x2'));var fs=require('fs');var Redis=require(_0x8727('0x3'));var db=require(_0x8727('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8727('0x5'));var config=require(_0x8727('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8727('0x7')][_0x8727('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5120d3,_0x31d6de,_0xef24){return new BPromise(function(_0x53d067,_0x43b373){return client[_0x8727('0x9')](_0x5120d3,_0xef24)[_0x8727('0xa')](function(_0x51b1af){logger['info'](_0x8727('0xb'),_0x31d6de,_0x8727('0xc'));logger[_0x8727('0xd')](_0x8727('0xe'),_0x31d6de,_0x8727('0xc'),JSON[_0x8727('0xf')](_0x51b1af));if(_0x51b1af['error']){if(_0x51b1af['error']['code']===0x1f4){logger[_0x8727('0x10')](_0x8727('0xb'),_0x31d6de,_0x51b1af[_0x8727('0x10')]['message']);return _0x43b373(_0x51b1af[_0x8727('0x10')]['message']);}logger[_0x8727('0x10')](_0x8727('0xb'),_0x31d6de,_0x51b1af[_0x8727('0x10')][_0x8727('0x11')]);return _0x53d067(_0x51b1af[_0x8727('0x10')][_0x8727('0x11')]);}else{logger[_0x8727('0x12')](_0x8727('0xb'),_0x31d6de,'request\x20sent');_0x53d067(_0x51b1af[_0x8727('0x13')]['message']);}})[_0x8727('0x14')](function(_0x434a32){logger['error'](_0x8727('0xb'),_0x31d6de,_0x434a32);_0x43b373(_0x434a32);});});} \ No newline at end of file +var _0xe013=['../../mysqldb','../../config/logger','../../config/environment','http','request','then','request\x20sent','debug','stringify','error','message','Cdr,\x20%s,\x20%s','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x4aa3fc,_0x2af467){var _0x378dc3=function(_0x30fbe0){while(--_0x30fbe0){_0x4aa3fc['push'](_0x4aa3fc['shift']());}};_0x378dc3(++_0x2af467);}(_0xe013,0x1f4));var _0x3e01=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xe013[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x3e01('0x0'));var util=require('util');var moment=require(_0x3e01('0x1'));var BPromise=require(_0x3e01('0x2'));var rs=require(_0x3e01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e01('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e01('0x5'))('rpc');var config=require(_0x3e01('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e01('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3902ed,_0x154aa4,_0x107031){return new BPromise(function(_0x3ca799,_0x4273d0){return client[_0x3e01('0x8')](_0x3902ed,_0x107031)[_0x3e01('0x9')](function(_0x518067){logger['info']('Cdr,\x20%s,\x20%s',_0x154aa4,_0x3e01('0xa'));logger[_0x3e01('0xb')]('Cdr,\x20%s,\x20%s,\x20%s',_0x154aa4,_0x3e01('0xa'),JSON[_0x3e01('0xc')](_0x518067));if(_0x518067['error']){if(_0x518067['error']['code']===0x1f4){logger[_0x3e01('0xd')]('Cdr,\x20%s,\x20%s',_0x154aa4,_0x518067[_0x3e01('0xd')][_0x3e01('0xe')]);return _0x4273d0(_0x518067[_0x3e01('0xd')][_0x3e01('0xe')]);}logger[_0x3e01('0xd')](_0x3e01('0xf'),_0x154aa4,_0x518067[_0x3e01('0xd')][_0x3e01('0xe')]);return _0x3ca799(_0x518067[_0x3e01('0xd')][_0x3e01('0xe')]);}else{logger[_0x3e01('0x10')](_0x3e01('0xf'),_0x154aa4,_0x3e01('0xa'));_0x3ca799(_0x518067['result'][_0x3e01('0xe')]);}})[_0x3e01('0x11')](function(_0x5d0330){logger[_0x3e01('0xd')](_0x3e01('0xf'),_0x154aa4,_0x5d0330);_0x4273d0(_0x5d0330);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 63803c8..14e433c 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(_0x42182d,_0x125b1a){var _0x26459b=function(_0x1b88ab){while(--_0x1b88ab){_0x42182d['push'](_0x42182d['shift']());}};_0x26459b(++_0x125b1a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 769c6a2..fb14f93 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 _0x0aeb=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x14bee0,_0x834e59){var _0x63acdd=function(_0x2b57e5){while(--_0x2b57e5){_0x14bee0['push'](_0x14bee0['shift']());}};_0x63acdd(++_0x834e59);}(_0x0aeb,0x7c));var _0xb0ae=function(_0x59596e,_0x1bcda7){_0x59596e=_0x59596e-0x0;var _0x4c6021=_0x0aeb[_0x59596e];return _0x4c6021;};'use strict';var Sequelize=require(_0xb0ae('0x0'));module[_0xb0ae('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb0ae('0x2')],'allowNull':![],'defaultValue':_0xb0ae('0x3')},'appdata':{'type':Sequelize[_0xb0ae('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb0ae('0x2')],'defaultValue':_0xb0ae('0x5')}}; \ No newline at end of file +var _0x51f1=['STRING','*,*,*,*','exports'];(function(_0x1218c2,_0x30b941){var _0x2604b3=function(_0x2b5800){while(--_0x2b5800){_0x1218c2['push'](_0x1218c2['shift']());}};_0x2604b3(++_0x30b941);}(_0x51f1,0xad));var _0x151f=function(_0x28c2b2,_0x4df41f){_0x28c2b2=_0x28c2b2-0x0;var _0x2c4e13=_0x51f1[_0x28c2b2];return _0x2c4e13;};'use strict';var Sequelize=require('sequelize');module[_0x151f('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x151f('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x151f('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x151f('0x2')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 67c68ed..a678e40 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 _0xc577=['../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','end','sendStatus','error','name','send','params','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xc577,0x172));var _0x7c57=function(_0x3d13d7,_0x295266){_0x3d13d7=_0x3d13d7-0x0;var _0x34fdde=_0xc577[_0x3d13d7];return _0x34fdde;};'use strict';var emlformat=require(_0x7c57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c57('0x1'));var rp=require(_0x7c57('0x2'));var moment=require(_0x7c57('0x3'));var BPromise=require(_0x7c57('0x4'));var Mustache=require(_0x7c57('0x5'));var util=require(_0x7c57('0x6'));var path=require(_0x7c57('0x7'));var sox=require('sox');var csv=require(_0x7c57('0x8'));var ejs=require(_0x7c57('0x9'));var fs=require('fs');var fs_extra=require(_0x7c57('0xa'));var _=require(_0x7c57('0xb'));var squel=require(_0x7c57('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c57('0x8'));var querystring=require('querystring');var Papa=require(_0x7c57('0xd'));var Redis=require(_0x7c57('0xe'));var authService=require(_0x7c57('0xf'));var qs=require(_0x7c57('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c57('0x11'));var logger=require(_0x7c57('0x12'))('api');var utils=require(_0x7c57('0x13'));var config=require(_0x7c57('0x14'));var licenseUtil=require(_0x7c57('0x15'));var db=require(_0x7c57('0x16'))['db'];function respondWithStatusCode(_0xbd2172,_0x10a675){_0x10a675=_0x10a675||0xcc;return function(_0x296cef){if(_0x296cef){return _0xbd2172['sendStatus'](_0x10a675);}return _0xbd2172['status'](_0x10a675)['end']();};}function respondWithResult(_0x46cae6,_0x373a4b){_0x373a4b=_0x373a4b||0xc8;return function(_0x4c5af2){if(_0x4c5af2){return _0x46cae6[_0x7c57('0x17')](_0x373a4b)[_0x7c57('0x18')](_0x4c5af2);}};}function respondWithFilteredResult(_0x11903b,_0x1ba2d0){return function(_0x14ce67){if(_0x14ce67){var _0x517d8a=typeof _0x1ba2d0['offset']===_0x7c57('0x19')&&typeof _0x1ba2d0[_0x7c57('0x1a')]===_0x7c57('0x19');var _0x3c40d3=_0x14ce67[_0x7c57('0x1b')];var _0x48cf4f=_0x517d8a?0x0:_0x1ba2d0[_0x7c57('0x1c')];var _0x30f5b1=_0x517d8a?_0x14ce67[_0x7c57('0x1b')]:_0x1ba2d0[_0x7c57('0x1c')]+_0x1ba2d0[_0x7c57('0x1a')];var _0x3e2dc0;if(_0x30f5b1>=_0x3c40d3){_0x30f5b1=_0x3c40d3;_0x3e2dc0=0xc8;}else{_0x3e2dc0=0xce;}_0x11903b[_0x7c57('0x17')](_0x3e2dc0);return _0x11903b[_0x7c57('0x1d')](_0x7c57('0x1e'),_0x48cf4f+'-'+_0x30f5b1+'/'+_0x3c40d3)['json'](_0x14ce67);}return null;};}function patchUpdates(_0x45221e){return function(_0x3472b8){try{jsonpatch[_0x7c57('0x1f')](_0x3472b8,_0x45221e,!![]);}catch(_0x373b5b){return BPromise['reject'](_0x373b5b);}return _0x3472b8['save']();};}function saveUpdates(_0x4c4140,_0x140376){return function(_0x368bb6){if(_0x368bb6){return _0x368bb6['update'](_0x4c4140)[_0x7c57('0x20')](function(_0x13f696){return _0x13f696;});}return null;};}function removeEntity(_0x260d58,_0xfb0f2e){return function(_0x4734de){if(_0x4734de){return _0x4734de[_0x7c57('0x21')]()[_0x7c57('0x20')](function(){_0x260d58['status'](0xcc)[_0x7c57('0x22')]();});}};}function handleEntityNotFound(_0x3232f8,_0x16a517){return function(_0x1641f1){if(!_0x1641f1){_0x3232f8[_0x7c57('0x23')](0x194);}return _0x1641f1;};}function handleError(_0x984924,_0x41125b){_0x41125b=_0x41125b||0x1f4;return function(_0x1219f2){logger[_0x7c57('0x24')](_0x1219f2['stack']);if(_0x1219f2['name']){delete _0x1219f2[_0x7c57('0x25')];}_0x984924[_0x7c57('0x17')](_0x41125b)[_0x7c57('0x26')](_0x1219f2);};}exports['show']=function(_0x9b9d1f,_0x59ae2f){var _0x5acc20={'raw':!![],'where':{'id':_0x9b9d1f[_0x7c57('0x27')]['id']}},_0x5ad979={};_0x5ad979[_0x7c57('0x28')]=_['keys'](db[_0x7c57('0x29')][_0x7c57('0x2a')]);_0x5ad979[_0x7c57('0x2b')]=_['keys'](_0x9b9d1f[_0x7c57('0x2b')]);_0x5ad979[_0x7c57('0x2c')]=_[_0x7c57('0x2d')](_0x5ad979['model'],_0x5ad979[_0x7c57('0x2b')]);_0x5acc20[_0x7c57('0x2e')]=_[_0x7c57('0x2d')](_0x5ad979[_0x7c57('0x28')],qs[_0x7c57('0x2f')](_0x9b9d1f[_0x7c57('0x2b')][_0x7c57('0x2f')]));_0x5acc20[_0x7c57('0x2e')]=_0x5acc20[_0x7c57('0x2e')][_0x7c57('0x30')]?_0x5acc20['attributes']:_0x5ad979[_0x7c57('0x28')];if(_0x9b9d1f[_0x7c57('0x2b')]['includeAll']){_0x5acc20[_0x7c57('0x31')]=[{'all':!![]}];}_0x5acc20=_[_0x7c57('0x32')]({},_0x5acc20,_0x9b9d1f[_0x7c57('0x33')]);return db['ChatApplication'][_0x7c57('0x34')](_0x5acc20)[_0x7c57('0x20')](handleEntityNotFound(_0x59ae2f,null))['then'](respondWithResult(_0x59ae2f,null))[_0x7c57('0x35')](handleError(_0x59ae2f,null));};exports[_0x7c57('0x36')]=function(_0x5e8068,_0x170d19){if(_0x5e8068[_0x7c57('0x37')]['id']){delete _0x5e8068[_0x7c57('0x37')]['id'];}return db[_0x7c57('0x29')]['find']({'where':{'id':_0x5e8068[_0x7c57('0x27')]['id']}})['then'](handleEntityNotFound(_0x170d19,null))['then'](saveUpdates(_0x5e8068[_0x7c57('0x37')],null))[_0x7c57('0x20')](respondWithResult(_0x170d19,null))[_0x7c57('0x35')](handleError(_0x170d19,null));};exports[_0x7c57('0x21')]=function(_0x493381,_0x2aebec){return db[_0x7c57('0x29')][_0x7c57('0x34')]({'where':{'id':_0x493381[_0x7c57('0x27')]['id']}})[_0x7c57('0x20')](handleEntityNotFound(_0x2aebec,null))[_0x7c57('0x20')](removeEntity(_0x2aebec,null))[_0x7c57('0x35')](handleError(_0x2aebec,null));}; \ No newline at end of file +var _0x3176=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','keys','ChatApplication','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3856f0,_0x211a99){var _0x3287f1=function(_0xec4b33){while(--_0xec4b33){_0x3856f0['push'](_0x3856f0['shift']());}};_0x3287f1(++_0x211a99);}(_0x3176,0x1d8));var _0x6317=function(_0x4eba38,_0x23078c){_0x4eba38=_0x4eba38-0x0;var _0x2ac0b9=_0x3176[_0x4eba38];return _0x2ac0b9;};'use strict';var emlformat=require(_0x6317('0x0'));var rimraf=require(_0x6317('0x1'));var zipdir=require(_0x6317('0x2'));var jsonpatch=require(_0x6317('0x3'));var rp=require(_0x6317('0x4'));var moment=require(_0x6317('0x5'));var BPromise=require(_0x6317('0x6'));var Mustache=require(_0x6317('0x7'));var util=require(_0x6317('0x8'));var path=require(_0x6317('0x9'));var sox=require(_0x6317('0xa'));var csv=require(_0x6317('0xb'));var ejs=require(_0x6317('0xc'));var fs=require('fs');var fs_extra=require(_0x6317('0xd'));var _=require(_0x6317('0xe'));var squel=require(_0x6317('0xf'));var crypto=require('crypto');var jsforce=require(_0x6317('0x10'));var deskjs=require(_0x6317('0x11'));var toCsv=require(_0x6317('0xb'));var querystring=require('querystring');var Papa=require(_0x6317('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6317('0x13'));var as=require(_0x6317('0x14'));var hardwareService=require(_0x6317('0x15'));var logger=require(_0x6317('0x16'))(_0x6317('0x17'));var utils=require('../../config/utils');var config=require(_0x6317('0x18'));var licenseUtil=require(_0x6317('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x359566,_0x3f64fb){_0x3f64fb=_0x3f64fb||0xcc;return function(_0x4aa69f){if(_0x4aa69f){return _0x359566[_0x6317('0x1a')](_0x3f64fb);}return _0x359566[_0x6317('0x1b')](_0x3f64fb)['end']();};}function respondWithResult(_0x252b7d,_0x1fba31){_0x1fba31=_0x1fba31||0xc8;return function(_0x32ad4a){if(_0x32ad4a){return _0x252b7d[_0x6317('0x1b')](_0x1fba31)[_0x6317('0x1c')](_0x32ad4a);}};}function respondWithFilteredResult(_0x5317b4,_0x54e857){return function(_0x560b77){if(_0x560b77){var _0x1b42b3=typeof _0x54e857['offset']==='undefined'&&typeof _0x54e857[_0x6317('0x1d')]==='undefined';var _0x487bbc=_0x560b77[_0x6317('0x1e')];var _0x1d8497=_0x1b42b3?0x0:_0x54e857['offset'];var _0xc90572=_0x1b42b3?_0x560b77['count']:_0x54e857[_0x6317('0x1f')]+_0x54e857[_0x6317('0x1d')];var _0x164c96;if(_0xc90572>=_0x487bbc){_0xc90572=_0x487bbc;_0x164c96=0xc8;}else{_0x164c96=0xce;}_0x5317b4[_0x6317('0x1b')](_0x164c96);return _0x5317b4['set'](_0x6317('0x20'),_0x1d8497+'-'+_0xc90572+'/'+_0x487bbc)[_0x6317('0x1c')](_0x560b77);}return null;};}function patchUpdates(_0x30c5f1){return function(_0x3687d1){try{jsonpatch[_0x6317('0x21')](_0x3687d1,_0x30c5f1,!![]);}catch(_0x355b66){return BPromise[_0x6317('0x22')](_0x355b66);}return _0x3687d1[_0x6317('0x23')]();};}function saveUpdates(_0x1cd0c7,_0x1e9b7e){return function(_0x4b8b11){if(_0x4b8b11){return _0x4b8b11[_0x6317('0x24')](_0x1cd0c7)['then'](function(_0x1bdf53){return _0x1bdf53;});}return null;};}function removeEntity(_0x4a2e3e,_0x2b7669){return function(_0x2a36ee){if(_0x2a36ee){return _0x2a36ee[_0x6317('0x25')]()[_0x6317('0x26')](function(){_0x4a2e3e[_0x6317('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x674933,_0x14b136){return function(_0x4db284){if(!_0x4db284){_0x674933['sendStatus'](0x194);}return _0x4db284;};}function handleError(_0x336fb1,_0x2b4416){_0x2b4416=_0x2b4416||0x1f4;return function(_0x2ca4e7){logger[_0x6317('0x27')](_0x2ca4e7[_0x6317('0x28')]);if(_0x2ca4e7[_0x6317('0x29')]){delete _0x2ca4e7[_0x6317('0x29')];}_0x336fb1['status'](_0x2b4416)[_0x6317('0x2a')](_0x2ca4e7);};}exports[_0x6317('0x2b')]=function(_0x23d35b,_0x5538d8){var _0x343e56={'raw':!![],'where':{'id':_0x23d35b['params']['id']}},_0x1a3f96={};_0x1a3f96['model']=_[_0x6317('0x2c')](db[_0x6317('0x2d')]['rawAttributes']);_0x1a3f96[_0x6317('0x2e')]=_[_0x6317('0x2c')](_0x23d35b[_0x6317('0x2e')]);_0x1a3f96[_0x6317('0x2f')]=_[_0x6317('0x30')](_0x1a3f96[_0x6317('0x31')],_0x1a3f96[_0x6317('0x2e')]);_0x343e56[_0x6317('0x32')]=_[_0x6317('0x30')](_0x1a3f96[_0x6317('0x31')],qs[_0x6317('0x33')](_0x23d35b[_0x6317('0x2e')]['fields']));_0x343e56[_0x6317('0x32')]=_0x343e56['attributes'][_0x6317('0x34')]?_0x343e56[_0x6317('0x32')]:_0x1a3f96[_0x6317('0x31')];if(_0x23d35b[_0x6317('0x2e')][_0x6317('0x35')]){_0x343e56[_0x6317('0x36')]=[{'all':!![]}];}_0x343e56=_[_0x6317('0x37')]({},_0x343e56,_0x23d35b[_0x6317('0x38')]);return db[_0x6317('0x2d')][_0x6317('0x39')](_0x343e56)[_0x6317('0x26')](handleEntityNotFound(_0x5538d8,null))['then'](respondWithResult(_0x5538d8,null))[_0x6317('0x3a')](handleError(_0x5538d8,null));};exports[_0x6317('0x24')]=function(_0x28091b,_0x2a3cd2){if(_0x28091b[_0x6317('0x3b')]['id']){delete _0x28091b[_0x6317('0x3b')]['id'];}return db[_0x6317('0x2d')][_0x6317('0x39')]({'where':{'id':_0x28091b['params']['id']}})[_0x6317('0x26')](handleEntityNotFound(_0x2a3cd2,null))[_0x6317('0x26')](saveUpdates(_0x28091b['body'],null))[_0x6317('0x26')](respondWithResult(_0x2a3cd2,null))[_0x6317('0x3a')](handleError(_0x2a3cd2,null));};exports[_0x6317('0x25')]=function(_0x2d5f7d,_0x52aab3){return db[_0x6317('0x2d')][_0x6317('0x39')]({'where':{'id':_0x2d5f7d['params']['id']}})[_0x6317('0x26')](handleEntityNotFound(_0x52aab3,null))[_0x6317('0x26')](removeEntity(_0x52aab3,null))[_0x6317('0x3a')](handleError(_0x52aab3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f497b45..7f59223 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 _0xee44=['util','bluebird','rimraf','../../config/environment','exports','define','ChatApplication','utf8mb4_unicode_ci','lodash'];(function(_0x57d074,_0x444670){var _0x1aa706=function(_0x1005ec){while(--_0x1005ec){_0x57d074['push'](_0x57d074['shift']());}};_0x1aa706(++_0x444670);}(_0xee44,0xaa));var _0x4ee4=function(_0x3bcef1,_0x27481c){_0x3bcef1=_0x3bcef1-0x0;var _0x48bfd4=_0xee44[_0x3bcef1];return _0x48bfd4;};'use strict';var _=require(_0x4ee4('0x0'));var util=require(_0x4ee4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4ee4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ee4('0x3'));var config=require(_0x4ee4('0x4'));var attributes=require('./chatApplication.attributes');module[_0x4ee4('0x5')]=function(_0x484ed3,_0x5a28dc){return _0x484ed3[_0x4ee4('0x6')](_0x4ee4('0x7'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4ee4('0x8')});}; \ No newline at end of file +var _0x9164=['../../config/logger','moment','path','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9164,0x1cd));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4916('0x0'));var util=require('util');var logger=require(_0x4916('0x1'))('api');var moment=require(_0x4916('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4916('0x3'));var rimraf=require('rimraf');var config=require(_0x4916('0x4'));var attributes=require('./chatApplication.attributes');module[_0x4916('0x5')]=function(_0x426edc,_0x1ff768){return _0x426edc[_0x4916('0x6')](_0x4916('0x7'),attributes,{'tableName':_0x4916('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4916('0x9'),'collate':_0x4916('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a310174..c6713cd 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 _0x6fef=['ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x43c200,_0x3323e2){var _0x154914=function(_0x4583ab){while(--_0x4583ab){_0x43c200['push'](_0x43c200['shift']());}};_0x154914(++_0x3323e2);}(_0x6fef,0x66));var _0xf6fe=function(_0x28cc27,_0x2f53e6){_0x28cc27=_0x28cc27-0x0;var _0x3bb231=_0x6fef[_0x28cc27];return _0x3bb231;};'use strict';var _=require(_0xf6fe('0x0'));var util=require('util');var moment=require(_0xf6fe('0x1'));var BPromise=require(_0xf6fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6fe('0x3'));var db=require(_0xf6fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf6fe('0x5'));var client=jayson[_0xf6fe('0x6')][_0xf6fe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1baf46,_0x6a4eef,_0x323f4e){return new BPromise(function(_0x2133be,_0x28c359){return client[_0xf6fe('0x8')](_0x1baf46,_0x323f4e)[_0xf6fe('0x9')](function(_0x7412d8){logger[_0xf6fe('0xa')]('ChatApplication,\x20%s,\x20%s',_0x6a4eef,_0xf6fe('0xb'));logger[_0xf6fe('0xc')](_0xf6fe('0xd'),_0x6a4eef,_0xf6fe('0xb'),JSON[_0xf6fe('0xe')](_0x7412d8));if(_0x7412d8[_0xf6fe('0xf')]){if(_0x7412d8[_0xf6fe('0xf')][_0xf6fe('0x10')]===0x1f4){logger[_0xf6fe('0xf')](_0xf6fe('0x11'),_0x6a4eef,_0x7412d8['error'][_0xf6fe('0x12')]);return _0x28c359(_0x7412d8[_0xf6fe('0xf')][_0xf6fe('0x12')]);}logger[_0xf6fe('0xf')](_0xf6fe('0x11'),_0x6a4eef,_0x7412d8[_0xf6fe('0xf')][_0xf6fe('0x12')]);return _0x2133be(_0x7412d8[_0xf6fe('0xf')][_0xf6fe('0x12')]);}else{logger[_0xf6fe('0xa')](_0xf6fe('0x11'),_0x6a4eef,_0xf6fe('0xb'));_0x2133be(_0x7412d8[_0xf6fe('0x13')]['message']);}})[_0xf6fe('0x14')](function(_0xb3e298){logger[_0xf6fe('0xf')](_0xf6fe('0x11'),_0x6a4eef,_0xb3e298);_0x28c359(_0xb3e298);});});} \ No newline at end of file +var _0xa2db=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x214bde,_0x575edb){var _0x14040c=function(_0x347fab){while(--_0x347fab){_0x214bde['push'](_0x214bde['shift']());}};_0x14040c(++_0x575edb);}(_0xa2db,0x170));var _0xba2d=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0xa2db[_0x2b0f81];return _0x5ce74c;};'use strict';var _=require('lodash');var util=require(_0xba2d('0x0'));var moment=require(_0xba2d('0x1'));var BPromise=require(_0xba2d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba2d('0x3'));var db=require(_0xba2d('0x4'))['db'];var utils=require(_0xba2d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xba2d('0x6'));var jayson=require(_0xba2d('0x7'));var client=jayson[_0xba2d('0x8')][_0xba2d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d1fd6,_0x3f92ec,_0x2847c4){return new BPromise(function(_0xfcb3df,_0x22108b){return client[_0xba2d('0xa')](_0x3d1fd6,_0x2847c4)[_0xba2d('0xb')](function(_0x4d4552){logger['info'](_0xba2d('0xc'),_0x3f92ec,_0xba2d('0xd'));logger[_0xba2d('0xe')](_0xba2d('0xf'),_0x3f92ec,'request\x20sent',JSON[_0xba2d('0x10')](_0x4d4552));if(_0x4d4552[_0xba2d('0x11')]){if(_0x4d4552[_0xba2d('0x11')][_0xba2d('0x12')]===0x1f4){logger[_0xba2d('0x11')](_0xba2d('0xc'),_0x3f92ec,_0x4d4552['error'][_0xba2d('0x13')]);return _0x22108b(_0x4d4552[_0xba2d('0x11')][_0xba2d('0x13')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x3f92ec,_0x4d4552[_0xba2d('0x11')][_0xba2d('0x13')]);return _0xfcb3df(_0x4d4552[_0xba2d('0x11')]['message']);}else{logger[_0xba2d('0x14')](_0xba2d('0xc'),_0x3f92ec,'request\x20sent');_0xfcb3df(_0x4d4552[_0xba2d('0x15')][_0xba2d('0x13')]);}})[_0xba2d('0x16')](function(_0x6da73f){logger['error'](_0xba2d('0xc'),_0x3f92ec,_0x6da73f);_0x22108b(_0x6da73f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8a80855..13966a1 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 _0x37a4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37a4,0x165));var _0x437a=function(_0x245d8d,_0x21b490){_0x245d8d=_0x245d8d-0x0;var _0x44325b=_0x37a4[_0x245d8d];return _0x44325b;};'use strict';var multer=require('multer');var util=require(_0x437a('0x0'));var path=require(_0x437a('0x1'));var timeout=require(_0x437a('0x2'));var express=require(_0x437a('0x3'));var router=express[_0x437a('0x4')]();var fs_extra=require(_0x437a('0x5'));var auth=require(_0x437a('0x6'));var interaction=require(_0x437a('0x7'));var config=require(_0x437a('0x8'));var controller=require(_0x437a('0x9'));router[_0x437a('0xa')](_0x437a('0xb'),auth[_0x437a('0xc')](),controller[_0x437a('0xd')]);router[_0x437a('0xe')](_0x437a('0xb'),auth[_0x437a('0xc')](),controller[_0x437a('0xf')]);router['delete'](_0x437a('0xb'),auth[_0x437a('0xc')](),controller[_0x437a('0x10')]);module[_0x437a('0x11')]=router; \ No newline at end of file +var _0x4f74=['isAuthenticated','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','put','/:id'];(function(_0x41eacf,_0x121aa0){var _0x54c753=function(_0x4eaaee){while(--_0x4eaaee){_0x41eacf['push'](_0x41eacf['shift']());}};_0x54c753(++_0x121aa0);}(_0x4f74,0x1d1));var _0x44f7=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x4f74[_0x2ff739];return _0x12dc13;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x44f7('0x0'));var timeout=require('connect-timeout');var express=require(_0x44f7('0x1'));var router=express[_0x44f7('0x2')]();var fs_extra=require(_0x44f7('0x3'));var auth=require(_0x44f7('0x4'));var interaction=require(_0x44f7('0x5'));var config=require(_0x44f7('0x6'));var controller=require('./chatApplication.controller');router[_0x44f7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x44f7('0x8')]);router[_0x44f7('0x9')](_0x44f7('0xa'),auth[_0x44f7('0xb')](),controller['update']);router[_0x44f7('0xc')](_0x44f7('0xa'),auth[_0x44f7('0xb')](),controller['destroy']);module[_0x44f7('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7bc38b8..888c4f0 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 _0x047e=['BOOLEAN','sequelize','STRING'];(function(_0xcf807,_0x4c736b){var _0x2ef9e9=function(_0x33ed42){while(--_0x33ed42){_0xcf807['push'](_0xcf807['shift']());}};_0x2ef9e9(++_0x4c736b);}(_0x047e,0x121));var _0xe047=function(_0x4e20e3,_0x54591a){_0x4e20e3=_0x4e20e3-0x0;var _0x190983=_0x047e[_0x4e20e3];return _0x190983;};'use strict';var Sequelize=require(_0xe047('0x0'));module['exports']={'name':{'type':Sequelize[_0xe047('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe047('0x1')]},'write':{'type':Sequelize[_0xe047('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb49b=['BOOLEAN','exports','STRING'];(function(_0x526621,_0x317acf){var _0x5b6c49=function(_0x24216c){while(--_0x24216c){_0x526621['push'](_0x526621['shift']());}};_0x5b6c49(++_0x317acf);}(_0xb49b,0x1ba));var _0xbb49=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb49b[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0xbb49('0x0')]={'name':{'type':Sequelize[_0xbb49('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbb49('0x1')]},'write':{'type':Sequelize[_0xbb49('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b71bc92..0bfbcd3 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 _0x5a9a=['body','catch','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatGroup.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','create'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x5a9a,0x130));var _0xa5a9=function(_0x18085b,_0x2a515d){_0x18085b=_0x18085b-0x0;var _0x13baf5=_0x5a9a[_0x18085b];return _0x13baf5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa5a9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5a9('0x1'));var moment=require(_0xa5a9('0x2'));var BPromise=require(_0xa5a9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa5a9('0x4'));var sox=require(_0xa5a9('0x5'));var csv=require(_0xa5a9('0x6'));var ejs=require(_0xa5a9('0x7'));var fs=require('fs');var fs_extra=require(_0xa5a9('0x8'));var _=require(_0xa5a9('0x9'));var squel=require('squel');var crypto=require(_0xa5a9('0xa'));var jsforce=require(_0xa5a9('0xb'));var deskjs=require(_0xa5a9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa5a9('0xd'));var Papa=require(_0xa5a9('0xe'));var Redis=require(_0xa5a9('0xf'));var authService=require(_0xa5a9('0x10'));var qs=require(_0xa5a9('0x11'));var as=require(_0xa5a9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa5a9('0x13'));var utils=require(_0xa5a9('0x14'));var config=require(_0xa5a9('0x15'));var licenseUtil=require(_0xa5a9('0x16'));var db=require(_0xa5a9('0x17'))['db'];config[_0xa5a9('0x18')]=_['defaults'](config['redis'],{'host':_0xa5a9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5a9('0x18')]));require(_0xa5a9('0x1a'))['register'](socket);function respondWithStatusCode(_0x5b449c,_0x217674){_0x217674=_0x217674||0xcc;return function(_0x109a01){if(_0x109a01){return _0x5b449c[_0xa5a9('0x1b')](_0x217674);}return _0x5b449c[_0xa5a9('0x1c')](_0x217674)[_0xa5a9('0x1d')]();};}function respondWithResult(_0x18a54f,_0x204858){_0x204858=_0x204858||0xc8;return function(_0x266bd8){if(_0x266bd8){return _0x18a54f[_0xa5a9('0x1c')](_0x204858)[_0xa5a9('0x1e')](_0x266bd8);}};}function respondWithFilteredResult(_0x26b528,_0x23d0d9){return function(_0x5a7fe6){if(_0x5a7fe6){var _0x5892f7=typeof _0x23d0d9['offset']===_0xa5a9('0x1f')&&typeof _0x23d0d9[_0xa5a9('0x20')]===_0xa5a9('0x1f');var _0xde1fd4=_0x5a7fe6[_0xa5a9('0x21')];var _0x522c31=_0x5892f7?0x0:_0x23d0d9[_0xa5a9('0x22')];var _0x18b25c=_0x5892f7?_0x5a7fe6[_0xa5a9('0x21')]:_0x23d0d9['offset']+_0x23d0d9[_0xa5a9('0x20')];var _0x3e8bf7;if(_0x18b25c>=_0xde1fd4){_0x18b25c=_0xde1fd4;_0x3e8bf7=0xc8;}else{_0x3e8bf7=0xce;}_0x26b528['status'](_0x3e8bf7);return _0x26b528[_0xa5a9('0x23')]('Content-Range',_0x522c31+'-'+_0x18b25c+'/'+_0xde1fd4)[_0xa5a9('0x1e')](_0x5a7fe6);}return null;};}function patchUpdates(_0x2251b3){return function(_0x3f5b6d){try{jsonpatch[_0xa5a9('0x24')](_0x3f5b6d,_0x2251b3,!![]);}catch(_0x33538f){return BPromise['reject'](_0x33538f);}return _0x3f5b6d['save']();};}function saveUpdates(_0x355a0d,_0x12369d){return function(_0x3428cf){if(_0x3428cf){return _0x3428cf[_0xa5a9('0x25')](_0x355a0d)[_0xa5a9('0x26')](function(_0x3776bd){return _0x3776bd;});}return null;};}function removeEntity(_0x49f543,_0x114632){return function(_0xc2c343){if(_0xc2c343){return _0xc2c343[_0xa5a9('0x27')]()[_0xa5a9('0x26')](function(){_0x49f543[_0xa5a9('0x1c')](0xcc)[_0xa5a9('0x1d')]();});}};}function handleEntityNotFound(_0x372b7f,_0x2aec70){return function(_0x8bcdc7){if(!_0x8bcdc7){_0x372b7f[_0xa5a9('0x1b')](0x194);}return _0x8bcdc7;};}function handleError(_0x46fe4f,_0x4f33b9){_0x4f33b9=_0x4f33b9||0x1f4;return function(_0x1192a1){logger[_0xa5a9('0x28')](_0x1192a1['stack']);if(_0x1192a1[_0xa5a9('0x29')]){delete _0x1192a1['name'];}_0x46fe4f['status'](_0x4f33b9)[_0xa5a9('0x2a')](_0x1192a1);};}exports[_0xa5a9('0x2b')]=function(_0x281e95,_0x2da06b){var _0x8a3295={},_0x2de91a={},_0x12204f={'count':0x0,'rows':[]};var _0x577fbf=_[_0xa5a9('0x2c')](db[_0xa5a9('0x2d')][_0xa5a9('0x2e')],function(_0x4d93ae){return{'name':_0x4d93ae['fieldName'],'type':_0x4d93ae[_0xa5a9('0x2f')][_0xa5a9('0x30')]};});_0x2de91a[_0xa5a9('0x31')]=_['map'](_0x577fbf,'name');_0x2de91a[_0xa5a9('0x32')]=_[_0xa5a9('0x33')](_0x281e95[_0xa5a9('0x32')]);_0x2de91a['filters']=_[_0xa5a9('0x34')](_0x2de91a[_0xa5a9('0x31')],_0x2de91a[_0xa5a9('0x32')]);_0x8a3295[_0xa5a9('0x35')]=_[_0xa5a9('0x34')](_0x2de91a[_0xa5a9('0x31')],qs['fields'](_0x281e95[_0xa5a9('0x32')][_0xa5a9('0x36')]));_0x8a3295['attributes']=_0x8a3295[_0xa5a9('0x35')][_0xa5a9('0x37')]?_0x8a3295[_0xa5a9('0x35')]:_0x2de91a[_0xa5a9('0x31')];if(!_0x281e95[_0xa5a9('0x32')][_0xa5a9('0x38')](_0xa5a9('0x39'))){_0x8a3295[_0xa5a9('0x20')]=qs[_0xa5a9('0x20')](_0x281e95[_0xa5a9('0x32')][_0xa5a9('0x20')]);_0x8a3295['offset']=qs[_0xa5a9('0x22')](_0x281e95['query']['offset']);}_0x8a3295[_0xa5a9('0x3a')]=qs[_0xa5a9('0x3b')](_0x281e95[_0xa5a9('0x32')][_0xa5a9('0x3b')]);_0x8a3295[_0xa5a9('0x3c')]=qs[_0xa5a9('0x3d')](_['pick'](_0x281e95[_0xa5a9('0x32')],_0x2de91a[_0xa5a9('0x3d')]),_0x577fbf);if(_0x281e95['query'][_0xa5a9('0x3e')]){_0x8a3295[_0xa5a9('0x3c')]=_[_0xa5a9('0x3f')](_0x8a3295[_0xa5a9('0x3c')],{'$or':_[_0xa5a9('0x2c')](_0x577fbf,function(_0x2f8ac1){if(_0x2f8ac1['type']!==_0xa5a9('0x40')){var _0x277932={};_0x277932[_0x2f8ac1[_0xa5a9('0x29')]]={'$like':'%'+_0x281e95[_0xa5a9('0x32')]['filter']+'%'};return _0x277932;}})});}_0x8a3295=_[_0xa5a9('0x3f')]({},_0x8a3295,_0x281e95[_0xa5a9('0x41')]);var _0x123f48={'where':_0x8a3295['where']};return db[_0xa5a9('0x2d')]['count'](_0x123f48)[_0xa5a9('0x26')](function(_0xceb31a){_0x12204f['count']=_0xceb31a;if(_0x281e95['query'][_0xa5a9('0x42')]){_0x8a3295[_0xa5a9('0x43')]=[{'all':!![]}];}return db[_0xa5a9('0x2d')]['findAll'](_0x8a3295);})[_0xa5a9('0x26')](function(_0x268206){_0x12204f[_0xa5a9('0x44')]=_0x268206;return _0x12204f;})['then'](respondWithFilteredResult(_0x2da06b,_0x8a3295))['catch'](handleError(_0x2da06b,null));};exports[_0xa5a9('0x45')]=function(_0x3589f8,_0x2d33a4){var _0x3f0440={'raw':!![],'where':{'id':_0x3589f8[_0xa5a9('0x46')]['id']}},_0x5f090b={};_0x5f090b['model']=_[_0xa5a9('0x33')](db[_0xa5a9('0x2d')][_0xa5a9('0x2e')]);_0x5f090b['query']=_[_0xa5a9('0x33')](_0x3589f8['query']);_0x5f090b[_0xa5a9('0x3d')]=_[_0xa5a9('0x34')](_0x5f090b[_0xa5a9('0x31')],_0x5f090b[_0xa5a9('0x32')]);_0x3f0440['attributes']=_[_0xa5a9('0x34')](_0x5f090b[_0xa5a9('0x31')],qs['fields'](_0x3589f8[_0xa5a9('0x32')][_0xa5a9('0x36')]));_0x3f0440[_0xa5a9('0x35')]=_0x3f0440[_0xa5a9('0x35')]['length']?_0x3f0440['attributes']:_0x5f090b[_0xa5a9('0x31')];if(_0x3589f8[_0xa5a9('0x32')]['includeAll']){_0x3f0440[_0xa5a9('0x43')]=[{'all':!![]}];}_0x3f0440=_[_0xa5a9('0x3f')]({},_0x3f0440,_0x3589f8[_0xa5a9('0x41')]);return db[_0xa5a9('0x2d')]['find'](_0x3f0440)['then'](handleEntityNotFound(_0x2d33a4,null))[_0xa5a9('0x26')](respondWithResult(_0x2d33a4,null))['catch'](handleError(_0x2d33a4,null));};exports[_0xa5a9('0x47')]=function(_0x3ad9e4,_0x17daed){return db[_0xa5a9('0x2d')]['create'](_0x3ad9e4[_0xa5a9('0x48')],{})[_0xa5a9('0x26')](respondWithResult(_0x17daed,0xc9))[_0xa5a9('0x49')](handleError(_0x17daed,null));};exports['update']=function(_0x57b649,_0x59b7ed){if(_0x57b649[_0xa5a9('0x48')]['id']){delete _0x57b649[_0xa5a9('0x48')]['id'];}return db['ChatGroup'][_0xa5a9('0x4a')]({'where':{'id':_0x57b649[_0xa5a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x59b7ed,null))[_0xa5a9('0x26')](saveUpdates(_0x57b649['body'],null))[_0xa5a9('0x26')](respondWithResult(_0x59b7ed,null))[_0xa5a9('0x49')](handleError(_0x59b7ed,null));};exports[_0xa5a9('0x27')]=function(_0x2c2430,_0x45391c){return db[_0xa5a9('0x2d')][_0xa5a9('0x4a')]({'where':{'id':_0x2c2430[_0xa5a9('0x46')]['id']}})[_0xa5a9('0x26')](handleEntityNotFound(_0x45391c,null))[_0xa5a9('0x26')](removeEntity(_0x45391c,null))[_0xa5a9('0x49')](handleError(_0x45391c,null));};exports[_0xa5a9('0x4b')]=function(_0x571358,_0x56ca55){return db[_0xa5a9('0x2d')]['describe']()[_0xa5a9('0x26')](respondWithResult(_0x56ca55,null))[_0xa5a9('0x49')](handleError(_0x56ca55,null));};exports[_0xa5a9('0x4c')]=function(_0x3634fe,_0x2421f6,_0x8d2ff4){return db[_0xa5a9('0x4d')][_0xa5a9('0x21')]({'where':{'ChatGroupId':_0x3634fe[_0xa5a9('0x46')]['id'],'ToId':_0x3634fe['user']['id'],'read':![]}})['then'](function(_0x4bcaeb){return{'id':_[_0xa5a9('0x4e')](_0x3634fe['params']['id']),'count':_0x4bcaeb};})[_0xa5a9('0x26')](respondWithResult(_0x2421f6,null))['catch'](handleError(_0x2421f6,null));};exports[_0xa5a9('0x4f')]=function(_0x11b501,_0x38a617,_0x110e22){return db['ChatGroup'][_0xa5a9('0x4a')]({'where':{'id':_0x11b501[_0xa5a9('0x46')]['id']}})[_0xa5a9('0x26')](handleEntityNotFound(_0x38a617,null))['then'](function(_0x2d5201){if(_0x2d5201){return _0x2d5201['addMembers'](_0x11b501[_0xa5a9('0x48')][_0xa5a9('0x50')],_[_0xa5a9('0x51')](_0x11b501[_0xa5a9('0x48')],[_0xa5a9('0x50'),'id'])||{});}})[_0xa5a9('0x26')](respondWithResult(_0x38a617,null))['catch'](handleError(_0x38a617,null));};exports[_0xa5a9('0x52')]=function(_0x3f973d,_0x152d60,_0x59656f){var _0x194ac9={};var _0x49f17c={};var _0x3f5f04;var _0x50f9ee;return db[_0xa5a9('0x2d')][_0xa5a9('0x53')]({'where':{'id':_0x3f973d[_0xa5a9('0x46')]['id']}})[_0xa5a9('0x26')](handleEntityNotFound(_0x152d60,null))[_0xa5a9('0x26')](function(_0x371605){if(_0x371605){_0x3f5f04=_0x371605;_0x49f17c[_0xa5a9('0x31')]=_[_0xa5a9('0x33')](db[_0xa5a9('0x54')][_0xa5a9('0x2e')]);_0x49f17c[_0xa5a9('0x32')]=_['keys'](_0x3f973d[_0xa5a9('0x32')]);_0x49f17c[_0xa5a9('0x3d')]=_['intersection'](_0x49f17c[_0xa5a9('0x31')],_0x49f17c[_0xa5a9('0x32')]);_0x194ac9[_0xa5a9('0x35')]=_['intersection'](_0x49f17c[_0xa5a9('0x31')],qs[_0xa5a9('0x36')](_0x3f973d[_0xa5a9('0x32')][_0xa5a9('0x36')]));_0x194ac9['attributes']=_0x194ac9['attributes'][_0xa5a9('0x37')]?_0x194ac9[_0xa5a9('0x35')]:_0x49f17c[_0xa5a9('0x31')];_0x194ac9[_0xa5a9('0x3a')]=qs['sort'](_0x3f973d[_0xa5a9('0x32')][_0xa5a9('0x3b')]);_0x194ac9[_0xa5a9('0x3c')]=qs['filters'](_[_0xa5a9('0x55')](_0x3f973d[_0xa5a9('0x32')],_0x49f17c[_0xa5a9('0x3d')]));if(_0x3f973d[_0xa5a9('0x32')][_0xa5a9('0x3e')]){_0x194ac9[_0xa5a9('0x3c')]=_[_0xa5a9('0x3f')](_0x194ac9[_0xa5a9('0x3c')],{'$or':_[_0xa5a9('0x2c')](_0x194ac9[_0xa5a9('0x35')],function(_0x274090){var _0xc8b349={};_0xc8b349[_0x274090]={'$like':'%'+_0x3f973d[_0xa5a9('0x32')][_0xa5a9('0x3e')]+'%'};return _0xc8b349;})});}_0x194ac9=_[_0xa5a9('0x3f')]({},_0x194ac9,_0x3f973d[_0xa5a9('0x41')]);return _0x3f5f04[_0xa5a9('0x52')](_0x194ac9);}})[_0xa5a9('0x26')](function(_0x1262ea){if(_0x1262ea){_0x50f9ee=_0x1262ea[_0xa5a9('0x37')];if(!_0x3f973d[_0xa5a9('0x32')][_0xa5a9('0x38')](_0xa5a9('0x39'))){_0x194ac9['limit']=qs['limit'](_0x3f973d[_0xa5a9('0x32')]['limit']);_0x194ac9['offset']=qs[_0xa5a9('0x22')](_0x3f973d[_0xa5a9('0x32')][_0xa5a9('0x22')]);}return _0x3f5f04['getMembers'](_0x194ac9);}})['then'](function(_0x1512aa){if(_0x1512aa){return _0x1512aa?{'count':_0x50f9ee,'rows':_0x1512aa}:null;}})[_0xa5a9('0x26')](respondWithResult(_0x152d60,null))[_0xa5a9('0x49')](handleError(_0x152d60,null));};exports[_0xa5a9('0x56')]=function(_0x35de07,_0x2c0b2f,_0x128ad1){return db['ChatGroup'][_0xa5a9('0x4a')]({'where':{'id':_0x35de07['params']['id']}})[_0xa5a9('0x26')](handleEntityNotFound(_0x2c0b2f,null))['then'](function(_0x511c86){if(_0x511c86){return _0x511c86['removeMembers'](_0x35de07[_0xa5a9('0x32')][_0xa5a9('0x50')]);}})[_0xa5a9('0x26')](respondWithStatusCode(_0x2c0b2f,null))['catch'](handleError(_0x2c0b2f,null));};exports[_0xa5a9('0x57')]=function(_0xc6d04,_0x3c4493,_0x58e62c){if(_0xc6d04['body']['id']){delete _0xc6d04[_0xa5a9('0x48')]['id'];}return db[_0xa5a9('0x2d')]['find']({'where':{'id':_0xc6d04[_0xa5a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c4493,null))[_0xa5a9('0x26')](function(_0x279911){if(_0x279911){_0xc6d04['body'][_0xa5a9('0x58')]=_0x279911['id'];return db['ChatInternalMessage']['create'](_0xc6d04[_0xa5a9('0x48')]);}})[_0xa5a9('0x26')](respondWithResult(_0x3c4493,null))[_0xa5a9('0x49')](handleError(_0x3c4493,null));};exports[_0xa5a9('0x59')]=function(_0x5b7f1c,_0x3afd88,_0x343b98){var _0x8234c5={};var _0xe62984={};var _0x207928;var _0x18571a;return db[_0xa5a9('0x2d')][_0xa5a9('0x53')]({'where':{'id':_0x5b7f1c[_0xa5a9('0x46')]['id']}})[_0xa5a9('0x26')](handleEntityNotFound(_0x3afd88,null))[_0xa5a9('0x26')](function(_0x51796f){if(_0x51796f){_0x207928=_0x51796f;_0xe62984[_0xa5a9('0x31')]=_[_0xa5a9('0x33')](db[_0xa5a9('0x4d')][_0xa5a9('0x2e')]);_0xe62984[_0xa5a9('0x32')]=_[_0xa5a9('0x33')](_0x5b7f1c['query']);_0xe62984[_0xa5a9('0x3d')]=_[_0xa5a9('0x34')](_0xe62984[_0xa5a9('0x31')],_0xe62984['query']);_0x8234c5[_0xa5a9('0x35')]=_[_0xa5a9('0x34')](_0xe62984[_0xa5a9('0x31')],qs[_0xa5a9('0x36')](_0x5b7f1c['query']['fields']));_0x8234c5[_0xa5a9('0x35')]=_0x8234c5[_0xa5a9('0x35')][_0xa5a9('0x37')]?_0x8234c5['attributes']:_0xe62984[_0xa5a9('0x31')];_0x8234c5[_0xa5a9('0x3a')]=qs[_0xa5a9('0x3b')](_0x5b7f1c[_0xa5a9('0x32')]['sort']);_0x8234c5[_0xa5a9('0x3c')]=qs['filters'](_[_0xa5a9('0x55')](_0x5b7f1c[_0xa5a9('0x32')],_0xe62984[_0xa5a9('0x3d')]));if(_0x5b7f1c[_0xa5a9('0x32')]['filter']){_0x8234c5[_0xa5a9('0x3c')]=_[_0xa5a9('0x3f')](_0x8234c5[_0xa5a9('0x3c')],{'$or':_[_0xa5a9('0x2c')](_0x8234c5[_0xa5a9('0x35')],function(_0x18d1aa){var _0x581575={};_0x581575[_0x18d1aa]={'$like':'%'+_0x5b7f1c[_0xa5a9('0x32')][_0xa5a9('0x3e')]+'%'};return _0x581575;})});}if(_0x5b7f1c['query'][_0xa5a9('0x5a')]){var _0x298342=_0x5b7f1c[_0xa5a9('0x32')][_0xa5a9('0x5a')][_0xa5a9('0x5b')](',');var _0x455817={};_0x455817[_0x298342[0x0]]={'$gte':moment(_0x298342[0x1])[_0xa5a9('0x5c')](_0xa5a9('0x5d'))};_0x8234c5[_0xa5a9('0x3c')]=_[_0xa5a9('0x3f')](_0x8234c5[_0xa5a9('0x3c')],_0x455817);}_0x8234c5=_[_0xa5a9('0x3f')]({},_0x8234c5,_0x5b7f1c[_0xa5a9('0x41')]);return _0x207928['getMessages'](_0x8234c5);}})[_0xa5a9('0x26')](function(_0x5a7151){if(_0x5a7151){_0x18571a=_0x5a7151[_0xa5a9('0x37')];if(!_0x5b7f1c[_0xa5a9('0x32')]['hasOwnProperty']('nolimit')){_0x8234c5[_0xa5a9('0x20')]=qs[_0xa5a9('0x20')](_0x5b7f1c['query'][_0xa5a9('0x20')]);_0x8234c5['offset']=qs['offset'](_0x5b7f1c[_0xa5a9('0x32')]['offset']);}return _0x207928[_0xa5a9('0x59')](_0x8234c5);}})[_0xa5a9('0x26')](function(_0x28cc3b){if(_0x28cc3b){return _0x28cc3b?{'count':_0x18571a,'rows':_0x28cc3b}:null;}})[_0xa5a9('0x26')](respondWithResult(_0x3afd88,null))['catch'](handleError(_0x3afd88,null));}; \ No newline at end of file +var _0xa622=['rawAttributes','order','options','hasOwnProperty','removeMembers','ids','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','getMembers','findOne','User'];(function(_0x4e7dae,_0x29c262){var _0x2124ab=function(_0x3b53ee){while(--_0x3b53ee){_0x4e7dae['push'](_0x4e7dae['shift']());}};_0x2124ab(++_0x29c262);}(_0xa622,0x68));var _0x2a62=function(_0x360eaa,_0x309c59){_0x360eaa=_0x360eaa-0x0;var _0x5eaae3=_0xa622[_0x360eaa];return _0x5eaae3;};'use strict';var emlformat=require(_0x2a62('0x0'));var rimraf=require(_0x2a62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a62('0x2'));var rp=require(_0x2a62('0x3'));var moment=require('moment');var BPromise=require(_0x2a62('0x4'));var Mustache=require(_0x2a62('0x5'));var util=require(_0x2a62('0x6'));var path=require('path');var sox=require(_0x2a62('0x7'));var csv=require(_0x2a62('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2a62('0x9'));var jsforce=require(_0x2a62('0xa'));var deskjs=require(_0x2a62('0xb'));var toCsv=require(_0x2a62('0x8'));var querystring=require('querystring');var Papa=require(_0x2a62('0xc'));var Redis=require(_0x2a62('0xd'));var authService=require(_0x2a62('0xe'));var qs=require(_0x2a62('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a62('0x10'))('api');var utils=require(_0x2a62('0x11'));var config=require(_0x2a62('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a62('0x13'))['db'];config[_0x2a62('0x14')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2a62('0x15'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x2a62('0x16')](socket);function respondWithStatusCode(_0x48511b,_0x389892){_0x389892=_0x389892||0xcc;return function(_0x40d688){if(_0x40d688){return _0x48511b[_0x2a62('0x17')](_0x389892);}return _0x48511b['status'](_0x389892)[_0x2a62('0x18')]();};}function respondWithResult(_0x45d17a,_0x1509f3){_0x1509f3=_0x1509f3||0xc8;return function(_0x4309dd){if(_0x4309dd){return _0x45d17a[_0x2a62('0x19')](_0x1509f3)['json'](_0x4309dd);}};}function respondWithFilteredResult(_0x1ee28f,_0x5a108f){return function(_0x2d9271){if(_0x2d9271){var _0xefa3d9=typeof _0x5a108f['offset']===_0x2a62('0x1a')&&typeof _0x5a108f[_0x2a62('0x1b')]===_0x2a62('0x1a');var _0x3b49ad=_0x2d9271[_0x2a62('0x1c')];var _0x4f1f8b=_0xefa3d9?0x0:_0x5a108f['offset'];var _0x327e6e=_0xefa3d9?_0x2d9271['count']:_0x5a108f['offset']+_0x5a108f[_0x2a62('0x1b')];var _0x16603c;if(_0x327e6e>=_0x3b49ad){_0x327e6e=_0x3b49ad;_0x16603c=0xc8;}else{_0x16603c=0xce;}_0x1ee28f[_0x2a62('0x19')](_0x16603c);return _0x1ee28f[_0x2a62('0x1d')](_0x2a62('0x1e'),_0x4f1f8b+'-'+_0x327e6e+'/'+_0x3b49ad)[_0x2a62('0x1f')](_0x2d9271);}return null;};}function patchUpdates(_0x3bfe3d){return function(_0x48d1a7){try{jsonpatch[_0x2a62('0x20')](_0x48d1a7,_0x3bfe3d,!![]);}catch(_0x25108e){return BPromise[_0x2a62('0x21')](_0x25108e);}return _0x48d1a7[_0x2a62('0x22')]();};}function saveUpdates(_0x2bbcde,_0x3c08de){return function(_0x3532e5){if(_0x3532e5){return _0x3532e5[_0x2a62('0x23')](_0x2bbcde)[_0x2a62('0x24')](function(_0x5e204e){return _0x5e204e;});}return null;};}function removeEntity(_0x7257f8,_0x59d8f7){return function(_0x93081e){if(_0x93081e){return _0x93081e[_0x2a62('0x25')]()['then'](function(){_0x7257f8['status'](0xcc)[_0x2a62('0x18')]();});}};}function handleEntityNotFound(_0x3cd325,_0x59d8f4){return function(_0x592612){if(!_0x592612){_0x3cd325[_0x2a62('0x17')](0x194);}return _0x592612;};}function handleError(_0x5d47e8,_0x2502c9){_0x2502c9=_0x2502c9||0x1f4;return function(_0x4998b3){logger[_0x2a62('0x26')](_0x4998b3[_0x2a62('0x27')]);if(_0x4998b3[_0x2a62('0x28')]){delete _0x4998b3[_0x2a62('0x28')];}_0x5d47e8[_0x2a62('0x19')](_0x2502c9)[_0x2a62('0x29')](_0x4998b3);};}exports['index']=function(_0x20e68d,_0x366ae5){var _0x209979={},_0x1fec59={},_0x4d34e3={'count':0x0,'rows':[]};var _0x454e60=_[_0x2a62('0x2a')](db[_0x2a62('0x2b')]['rawAttributes'],function(_0x29274e){return{'name':_0x29274e[_0x2a62('0x2c')],'type':_0x29274e[_0x2a62('0x2d')][_0x2a62('0x2e')]};});_0x1fec59[_0x2a62('0x2f')]=_[_0x2a62('0x2a')](_0x454e60,_0x2a62('0x28'));_0x1fec59[_0x2a62('0x30')]=_[_0x2a62('0x31')](_0x20e68d[_0x2a62('0x30')]);_0x1fec59[_0x2a62('0x32')]=_[_0x2a62('0x33')](_0x1fec59[_0x2a62('0x2f')],_0x1fec59[_0x2a62('0x30')]);_0x209979[_0x2a62('0x34')]=_[_0x2a62('0x33')](_0x1fec59[_0x2a62('0x2f')],qs[_0x2a62('0x35')](_0x20e68d[_0x2a62('0x30')][_0x2a62('0x35')]));_0x209979[_0x2a62('0x34')]=_0x209979['attributes'][_0x2a62('0x36')]?_0x209979[_0x2a62('0x34')]:_0x1fec59[_0x2a62('0x2f')];if(!_0x20e68d[_0x2a62('0x30')]['hasOwnProperty'](_0x2a62('0x37'))){_0x209979[_0x2a62('0x1b')]=qs[_0x2a62('0x1b')](_0x20e68d[_0x2a62('0x30')]['limit']);_0x209979[_0x2a62('0x38')]=qs['offset'](_0x20e68d[_0x2a62('0x30')]['offset']);}_0x209979['order']=qs[_0x2a62('0x39')](_0x20e68d[_0x2a62('0x30')][_0x2a62('0x39')]);_0x209979[_0x2a62('0x3a')]=qs[_0x2a62('0x32')](_[_0x2a62('0x3b')](_0x20e68d[_0x2a62('0x30')],_0x1fec59[_0x2a62('0x32')]),_0x454e60);if(_0x20e68d[_0x2a62('0x30')][_0x2a62('0x3c')]){_0x209979['where']=_[_0x2a62('0x3d')](_0x209979[_0x2a62('0x3a')],{'$or':_[_0x2a62('0x2a')](_0x454e60,function(_0xa20e3b){if(_0xa20e3b[_0x2a62('0x2d')]!=='VIRTUAL'){var _0x4df85d={};_0x4df85d[_0xa20e3b[_0x2a62('0x28')]]={'$like':'%'+_0x20e68d['query'][_0x2a62('0x3c')]+'%'};return _0x4df85d;}})});}_0x209979=_[_0x2a62('0x3d')]({},_0x209979,_0x20e68d['options']);var _0x4282e4={'where':_0x209979[_0x2a62('0x3a')]};return db[_0x2a62('0x2b')][_0x2a62('0x1c')](_0x4282e4)[_0x2a62('0x24')](function(_0x1a367e){_0x4d34e3[_0x2a62('0x1c')]=_0x1a367e;if(_0x20e68d[_0x2a62('0x30')][_0x2a62('0x3e')]){_0x209979[_0x2a62('0x3f')]=[{'all':!![]}];}return db[_0x2a62('0x2b')][_0x2a62('0x40')](_0x209979);})['then'](function(_0x98a8c0){_0x4d34e3[_0x2a62('0x41')]=_0x98a8c0;return _0x4d34e3;})['then'](respondWithFilteredResult(_0x366ae5,_0x209979))[_0x2a62('0x42')](handleError(_0x366ae5,null));};exports[_0x2a62('0x43')]=function(_0x490806,_0x524c86){var _0x4b87cc={'raw':!![],'where':{'id':_0x490806[_0x2a62('0x44')]['id']}},_0x18432d={};_0x18432d['model']=_[_0x2a62('0x31')](db[_0x2a62('0x2b')]['rawAttributes']);_0x18432d[_0x2a62('0x30')]=_[_0x2a62('0x31')](_0x490806[_0x2a62('0x30')]);_0x18432d[_0x2a62('0x32')]=_[_0x2a62('0x33')](_0x18432d[_0x2a62('0x2f')],_0x18432d[_0x2a62('0x30')]);_0x4b87cc['attributes']=_[_0x2a62('0x33')](_0x18432d[_0x2a62('0x2f')],qs['fields'](_0x490806[_0x2a62('0x30')]['fields']));_0x4b87cc[_0x2a62('0x34')]=_0x4b87cc[_0x2a62('0x34')][_0x2a62('0x36')]?_0x4b87cc[_0x2a62('0x34')]:_0x18432d[_0x2a62('0x2f')];if(_0x490806[_0x2a62('0x30')][_0x2a62('0x3e')]){_0x4b87cc[_0x2a62('0x3f')]=[{'all':!![]}];}_0x4b87cc=_['merge']({},_0x4b87cc,_0x490806['options']);return db[_0x2a62('0x2b')][_0x2a62('0x45')](_0x4b87cc)[_0x2a62('0x24')](handleEntityNotFound(_0x524c86,null))['then'](respondWithResult(_0x524c86,null))[_0x2a62('0x42')](handleError(_0x524c86,null));};exports[_0x2a62('0x46')]=function(_0x3edd91,_0x45379d){return db['ChatGroup']['create'](_0x3edd91[_0x2a62('0x47')],{})[_0x2a62('0x24')](respondWithResult(_0x45379d,0xc9))[_0x2a62('0x42')](handleError(_0x45379d,null));};exports[_0x2a62('0x23')]=function(_0x25a59f,_0x4ea013){if(_0x25a59f[_0x2a62('0x47')]['id']){delete _0x25a59f['body']['id'];}return db[_0x2a62('0x2b')][_0x2a62('0x45')]({'where':{'id':_0x25a59f[_0x2a62('0x44')]['id']}})[_0x2a62('0x24')](handleEntityNotFound(_0x4ea013,null))[_0x2a62('0x24')](saveUpdates(_0x25a59f['body'],null))[_0x2a62('0x24')](respondWithResult(_0x4ea013,null))[_0x2a62('0x42')](handleError(_0x4ea013,null));};exports[_0x2a62('0x25')]=function(_0x53b51b,_0x5a16f7){return db[_0x2a62('0x2b')][_0x2a62('0x45')]({'where':{'id':_0x53b51b['params']['id']}})['then'](handleEntityNotFound(_0x5a16f7,null))[_0x2a62('0x24')](removeEntity(_0x5a16f7,null))['catch'](handleError(_0x5a16f7,null));};exports[_0x2a62('0x48')]=function(_0x233a48,_0x3cb95b){return db[_0x2a62('0x2b')][_0x2a62('0x48')]()['then'](respondWithResult(_0x3cb95b,null))['catch'](handleError(_0x3cb95b,null));};exports[_0x2a62('0x49')]=function(_0x3ef398,_0x46de05,_0x4543a7){return db[_0x2a62('0x4a')][_0x2a62('0x1c')]({'where':{'ChatGroupId':_0x3ef398['params']['id'],'ToId':_0x3ef398[_0x2a62('0x4b')]['id'],'read':![]}})['then'](function(_0x35a16f){return{'id':_[_0x2a62('0x4c')](_0x3ef398['params']['id']),'count':_0x35a16f};})['then'](respondWithResult(_0x46de05,null))['catch'](handleError(_0x46de05,null));};exports[_0x2a62('0x4d')]=function(_0x3eccc0,_0x2a0cdd,_0x225b44){return db[_0x2a62('0x2b')][_0x2a62('0x45')]({'where':{'id':_0x3eccc0[_0x2a62('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a0cdd,null))[_0x2a62('0x24')](function(_0x28fd81){if(_0x28fd81){return _0x28fd81[_0x2a62('0x4d')](_0x3eccc0[_0x2a62('0x47')]['ids'],_[_0x2a62('0x4e')](_0x3eccc0['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2a0cdd,null))[_0x2a62('0x42')](handleError(_0x2a0cdd,null));};exports[_0x2a62('0x4f')]=function(_0x3c65c5,_0x42e294,_0x4a6564){var _0x262c32={};var _0x434dd4={};var _0x41110b;var _0x15a064;return db[_0x2a62('0x2b')][_0x2a62('0x50')]({'where':{'id':_0x3c65c5[_0x2a62('0x44')]['id']}})[_0x2a62('0x24')](handleEntityNotFound(_0x42e294,null))[_0x2a62('0x24')](function(_0x1d9198){if(_0x1d9198){_0x41110b=_0x1d9198;_0x434dd4['model']=_[_0x2a62('0x31')](db[_0x2a62('0x51')][_0x2a62('0x52')]);_0x434dd4[_0x2a62('0x30')]=_[_0x2a62('0x31')](_0x3c65c5['query']);_0x434dd4[_0x2a62('0x32')]=_['intersection'](_0x434dd4[_0x2a62('0x2f')],_0x434dd4['query']);_0x262c32[_0x2a62('0x34')]=_[_0x2a62('0x33')](_0x434dd4[_0x2a62('0x2f')],qs[_0x2a62('0x35')](_0x3c65c5['query'][_0x2a62('0x35')]));_0x262c32[_0x2a62('0x34')]=_0x262c32[_0x2a62('0x34')]['length']?_0x262c32[_0x2a62('0x34')]:_0x434dd4[_0x2a62('0x2f')];_0x262c32[_0x2a62('0x53')]=qs[_0x2a62('0x39')](_0x3c65c5[_0x2a62('0x30')][_0x2a62('0x39')]);_0x262c32['where']=qs[_0x2a62('0x32')](_[_0x2a62('0x3b')](_0x3c65c5['query'],_0x434dd4[_0x2a62('0x32')]));if(_0x3c65c5[_0x2a62('0x30')][_0x2a62('0x3c')]){_0x262c32[_0x2a62('0x3a')]=_['merge'](_0x262c32['where'],{'$or':_[_0x2a62('0x2a')](_0x262c32[_0x2a62('0x34')],function(_0x2167b9){var _0x32884f={};_0x32884f[_0x2167b9]={'$like':'%'+_0x3c65c5[_0x2a62('0x30')][_0x2a62('0x3c')]+'%'};return _0x32884f;})});}_0x262c32=_['merge']({},_0x262c32,_0x3c65c5[_0x2a62('0x54')]);return _0x41110b[_0x2a62('0x4f')](_0x262c32);}})[_0x2a62('0x24')](function(_0x33234a){if(_0x33234a){_0x15a064=_0x33234a[_0x2a62('0x36')];if(!_0x3c65c5[_0x2a62('0x30')][_0x2a62('0x55')]('nolimit')){_0x262c32[_0x2a62('0x1b')]=qs[_0x2a62('0x1b')](_0x3c65c5[_0x2a62('0x30')][_0x2a62('0x1b')]);_0x262c32[_0x2a62('0x38')]=qs[_0x2a62('0x38')](_0x3c65c5[_0x2a62('0x30')][_0x2a62('0x38')]);}return _0x41110b[_0x2a62('0x4f')](_0x262c32);}})[_0x2a62('0x24')](function(_0x3065d3){if(_0x3065d3){return _0x3065d3?{'count':_0x15a064,'rows':_0x3065d3}:null;}})['then'](respondWithResult(_0x42e294,null))[_0x2a62('0x42')](handleError(_0x42e294,null));};exports['removeMembers']=function(_0x42c63b,_0x384ed1,_0x1f5e4a){return db[_0x2a62('0x2b')][_0x2a62('0x45')]({'where':{'id':_0x42c63b[_0x2a62('0x44')]['id']}})[_0x2a62('0x24')](handleEntityNotFound(_0x384ed1,null))[_0x2a62('0x24')](function(_0x37aca9){if(_0x37aca9){return _0x37aca9[_0x2a62('0x56')](_0x42c63b['query'][_0x2a62('0x57')]);}})['then'](respondWithStatusCode(_0x384ed1,null))[_0x2a62('0x42')](handleError(_0x384ed1,null));};exports['addMessage']=function(_0x387087,_0x3677cf,_0x4146c4){if(_0x387087[_0x2a62('0x47')]['id']){delete _0x387087[_0x2a62('0x47')]['id'];}return db[_0x2a62('0x2b')]['find']({'where':{'id':_0x387087[_0x2a62('0x44')]['id']}})['then'](handleEntityNotFound(_0x3677cf,null))['then'](function(_0x5197e3){if(_0x5197e3){_0x387087[_0x2a62('0x47')][_0x2a62('0x58')]=_0x5197e3['id'];return db[_0x2a62('0x4a')][_0x2a62('0x46')](_0x387087['body']);}})[_0x2a62('0x24')](respondWithResult(_0x3677cf,null))['catch'](handleError(_0x3677cf,null));};exports[_0x2a62('0x59')]=function(_0x622593,_0x14d90a,_0x3df038){var _0x5c0ded={};var _0x408077={};var _0x2fbbc3;var _0x32e5dc;return db[_0x2a62('0x2b')][_0x2a62('0x50')]({'where':{'id':_0x622593[_0x2a62('0x44')]['id']}})[_0x2a62('0x24')](handleEntityNotFound(_0x14d90a,null))[_0x2a62('0x24')](function(_0x8e79fc){if(_0x8e79fc){_0x2fbbc3=_0x8e79fc;_0x408077['model']=_[_0x2a62('0x31')](db['ChatInternalMessage'][_0x2a62('0x52')]);_0x408077[_0x2a62('0x30')]=_[_0x2a62('0x31')](_0x622593[_0x2a62('0x30')]);_0x408077[_0x2a62('0x32')]=_[_0x2a62('0x33')](_0x408077[_0x2a62('0x2f')],_0x408077[_0x2a62('0x30')]);_0x5c0ded[_0x2a62('0x34')]=_[_0x2a62('0x33')](_0x408077[_0x2a62('0x2f')],qs[_0x2a62('0x35')](_0x622593[_0x2a62('0x30')][_0x2a62('0x35')]));_0x5c0ded[_0x2a62('0x34')]=_0x5c0ded[_0x2a62('0x34')][_0x2a62('0x36')]?_0x5c0ded[_0x2a62('0x34')]:_0x408077[_0x2a62('0x2f')];_0x5c0ded[_0x2a62('0x53')]=qs['sort'](_0x622593[_0x2a62('0x30')][_0x2a62('0x39')]);_0x5c0ded['where']=qs[_0x2a62('0x32')](_[_0x2a62('0x3b')](_0x622593[_0x2a62('0x30')],_0x408077['filters']));if(_0x622593['query'][_0x2a62('0x3c')]){_0x5c0ded[_0x2a62('0x3a')]=_[_0x2a62('0x3d')](_0x5c0ded[_0x2a62('0x3a')],{'$or':_[_0x2a62('0x2a')](_0x5c0ded[_0x2a62('0x34')],function(_0x209861){var _0x3ef585={};_0x3ef585[_0x209861]={'$like':'%'+_0x622593['query'][_0x2a62('0x3c')]+'%'};return _0x3ef585;})});}if(_0x622593[_0x2a62('0x30')][_0x2a62('0x5a')]){var _0x534525=_0x622593['query'][_0x2a62('0x5a')][_0x2a62('0x5b')](',');var _0xeaeeed={};_0xeaeeed[_0x534525[0x0]]={'$gte':moment(_0x534525[0x1])['format'](_0x2a62('0x5c'))};_0x5c0ded[_0x2a62('0x3a')]=_[_0x2a62('0x3d')](_0x5c0ded[_0x2a62('0x3a')],_0xeaeeed);}_0x5c0ded=_[_0x2a62('0x3d')]({},_0x5c0ded,_0x622593[_0x2a62('0x54')]);return _0x2fbbc3['getMessages'](_0x5c0ded);}})[_0x2a62('0x24')](function(_0x1ac921){if(_0x1ac921){_0x32e5dc=_0x1ac921['length'];if(!_0x622593[_0x2a62('0x30')][_0x2a62('0x55')](_0x2a62('0x37'))){_0x5c0ded[_0x2a62('0x1b')]=qs[_0x2a62('0x1b')](_0x622593[_0x2a62('0x30')][_0x2a62('0x1b')]);_0x5c0ded[_0x2a62('0x38')]=qs[_0x2a62('0x38')](_0x622593['query'][_0x2a62('0x38')]);}return _0x2fbbc3['getMessages'](_0x5c0ded);}})[_0x2a62('0x24')](function(_0x5b202f){if(_0x5b202f){return _0x5b202f?{'count':_0x32e5dc,'rows':_0x5b202f}:null;}})['then'](respondWithResult(_0x14d90a,null))[_0x2a62('0x42')](handleError(_0x14d90a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 76f4b18..5e057da 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 _0xb53e=['exports','events','../../mysqldb','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x13852c,_0x3ecc1a){var _0x1e917f=function(_0x464847){while(--_0x464847){_0x13852c['push'](_0x13852c['shift']());}};_0x1e917f(++_0x3ecc1a);}(_0xb53e,0xa9));var _0xeb53=function(_0x4a7c96,_0x3f4679){_0x4a7c96=_0x4a7c96-0x0;var _0x16663b=_0xb53e[_0x4a7c96];return _0x16663b;};'use strict';var EventEmitter=require(_0xeb53('0x0'));var ChatGroup=require(_0xeb53('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xeb53('0x2')](0x0);var events={'afterCreate':_0xeb53('0x3'),'afterUpdate':'update','afterDestroy':_0xeb53('0x4')};function emitEvent(_0xbce00b){return function(_0x526b45,_0x21ce3d,_0x3b4dd3){ChatGroupEvents['emit'](_0xbce00b+':'+_0x526b45['id'],_0x526b45);ChatGroupEvents['emit'](_0xbce00b,_0x526b45);_0x3b4dd3(null);};}for(var e in events){if(events[_0xeb53('0x5')](e)){var event=events[e];ChatGroup[_0xeb53('0x6')](e,emitEvent(event));}}module[_0xeb53('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x8325=['exports','events','ChatGroup','save','remove','emit','hasOwnProperty','hook'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x8325,0x1f1));var _0x5832=function(_0x18badc,_0x5dc59d){_0x18badc=_0x18badc-0x0;var _0x1bcbc9=_0x8325[_0x18badc];return _0x1bcbc9;};'use strict';var EventEmitter=require(_0x5832('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x5832('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5832('0x2'),'afterUpdate':'update','afterDestroy':_0x5832('0x3')};function emitEvent(_0x39ae55){return function(_0x17bd8b,_0x24e83e,_0x5bfa64){ChatGroupEvents['emit'](_0x39ae55+':'+_0x17bd8b['id'],_0x17bd8b);ChatGroupEvents[_0x5832('0x4')](_0x39ae55,_0x17bd8b);_0x5bfa64(null);};}for(var e in events){if(events[_0x5832('0x5')](e)){var event=events[e];ChatGroup[_0x5832('0x6')](e,emitEvent(event));}}module[_0x5832('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c2dabfe..5a9d9aa 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 _0x2346=['moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api'];(function(_0x4baf91,_0x234eee){var _0x17d802=function(_0x3fd670){while(--_0x3fd670){_0x4baf91['push'](_0x4baf91['shift']());}};_0x17d802(++_0x234eee);}(_0x2346,0xd9));var _0x6234=function(_0x25764f,_0x1db05e){_0x25764f=_0x25764f-0x0;var _0x217e84=_0x2346[_0x25764f];return _0x217e84;};'use strict';var _=require(_0x6234('0x0'));var util=require(_0x6234('0x1'));var logger=require(_0x6234('0x2'))(_0x6234('0x3'));var moment=require(_0x6234('0x4'));var BPromise=require('bluebird');var rp=require(_0x6234('0x5'));var fs=require('fs');var path=require(_0x6234('0x6'));var rimraf=require(_0x6234('0x7'));var config=require(_0x6234('0x8'));var attributes=require('./chatGroup.attributes');module[_0x6234('0x9')]=function(_0x211512,_0x42f126){return _0x211512[_0x6234('0xa')](_0x6234('0xb'),attributes,{'tableName':_0x6234('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6ed=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','request-promise'];(function(_0x532ad7,_0x197de1){var _0x1aefc6=function(_0x3c7999){while(--_0x3c7999){_0x532ad7['push'](_0x532ad7['shift']());}};_0x1aefc6(++_0x197de1);}(_0xe6ed,0x101));var _0xde6e=function(_0x170afb,_0xcfe8fb){_0x170afb=_0x170afb-0x0;var _0xdeee81=_0xe6ed[_0x170afb];return _0xdeee81;};'use strict';var _=require(_0xde6e('0x0'));var util=require(_0xde6e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde6e('0x2'));var fs=require('fs');var path=require(_0xde6e('0x3'));var rimraf=require(_0xde6e('0x4'));var config=require(_0xde6e('0x5'));var attributes=require(_0xde6e('0x6'));module[_0xde6e('0x7')]=function(_0x49126f,_0x129757){return _0x49126f['define'](_0xde6e('0x8'),attributes,{'tableName':_0xde6e('0x9'),'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 b4b41ee..995799e 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 _0x4ab0=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x38054a,_0x32c753){var _0x2e2653=function(_0x317fa9){while(--_0x317fa9){_0x38054a['push'](_0x38054a['shift']());}};_0x2e2653(++_0x32c753);}(_0x4ab0,0xd5));var _0x04ab=function(_0x4c6fc1,_0x492bc1){_0x4c6fc1=_0x4c6fc1-0x0;var _0xe8450f=_0x4ab0[_0x4c6fc1];return _0xe8450f;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var moment=require(_0x04ab('0x1'));var BPromise=require(_0x04ab('0x2'));var rs=require(_0x04ab('0x3'));var fs=require('fs');var Redis=require(_0x04ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04ab('0x5'))(_0x04ab('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ab('0x7'));var client=jayson[_0x04ab('0x8')]['http']({'port':0x232a});config[_0x04ab('0x9')]=_[_0x04ab('0xa')](config[_0x04ab('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x04ab('0xb'))(new Redis(config[_0x04ab('0x9')]));require(_0x04ab('0xc'))[_0x04ab('0xd')](socket);function respondWithRpcPromise(_0x4dc264,_0x252d00,_0x3608b7){return new BPromise(function(_0x3d003a,_0xaa3d){return client['request'](_0x4dc264,_0x3608b7)[_0x04ab('0xe')](function(_0x206539){logger[_0x04ab('0xf')](_0x04ab('0x10'),_0x252d00,_0x04ab('0x11'));logger[_0x04ab('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x252d00,_0x04ab('0x11'),JSON['stringify'](_0x206539));if(_0x206539[_0x04ab('0x13')]){if(_0x206539[_0x04ab('0x13')][_0x04ab('0x14')]===0x1f4){logger[_0x04ab('0x13')]('ChatGroup,\x20%s,\x20%s',_0x252d00,_0x206539['error']['message']);return _0xaa3d(_0x206539[_0x04ab('0x13')][_0x04ab('0x15')]);}logger[_0x04ab('0x13')](_0x04ab('0x10'),_0x252d00,_0x206539[_0x04ab('0x13')][_0x04ab('0x15')]);return _0x3d003a(_0x206539[_0x04ab('0x13')][_0x04ab('0x15')]);}else{logger[_0x04ab('0xf')](_0x04ab('0x10'),_0x252d00,'request\x20sent');_0x3d003a(_0x206539[_0x04ab('0x16')][_0x04ab('0x15')]);}})[_0x04ab('0x17')](function(_0xea243f){logger[_0x04ab('0x13')](_0x04ab('0x10'),_0x252d00,_0xea243f);_0xaa3d(_0xea243f);});});} \ No newline at end of file +var _0x4b68=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b68,0x129));var _0x84b6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4b68[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x84b6('0x0'));var util=require(_0x84b6('0x1'));var moment=require(_0x84b6('0x2'));var BPromise=require(_0x84b6('0x3'));var rs=require(_0x84b6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84b6('0x5'))['db'];var utils=require(_0x84b6('0x6'));var logger=require(_0x84b6('0x7'))(_0x84b6('0x8'));var config=require('../../config/environment');var jayson=require(_0x84b6('0x9'));var client=jayson[_0x84b6('0xa')]['http']({'port':0x232a});config[_0x84b6('0xb')]=_['defaults'](config[_0x84b6('0xb')],{'host':_0x84b6('0xc'),'port':0x18eb});var socket=require(_0x84b6('0xd'))(new Redis(config[_0x84b6('0xb')]));require(_0x84b6('0xe'))[_0x84b6('0xf')](socket);function respondWithRpcPromise(_0x5e93e9,_0x14591b,_0x446432){return new BPromise(function(_0x401671,_0x29066f){return client[_0x84b6('0x10')](_0x5e93e9,_0x446432)['then'](function(_0x2c26ee){logger[_0x84b6('0x11')](_0x84b6('0x12'),_0x14591b,'request\x20sent');logger[_0x84b6('0x13')](_0x84b6('0x14'),_0x14591b,_0x84b6('0x15'),JSON[_0x84b6('0x16')](_0x2c26ee));if(_0x2c26ee[_0x84b6('0x17')]){if(_0x2c26ee[_0x84b6('0x17')]['code']===0x1f4){logger[_0x84b6('0x17')](_0x84b6('0x12'),_0x14591b,_0x2c26ee['error']['message']);return _0x29066f(_0x2c26ee[_0x84b6('0x17')][_0x84b6('0x18')]);}logger[_0x84b6('0x17')]('ChatGroup,\x20%s,\x20%s',_0x14591b,_0x2c26ee['error'][_0x84b6('0x18')]);return _0x401671(_0x2c26ee[_0x84b6('0x17')][_0x84b6('0x18')]);}else{logger[_0x84b6('0x11')]('ChatGroup,\x20%s,\x20%s',_0x14591b,'request\x20sent');_0x401671(_0x2c26ee[_0x84b6('0x19')][_0x84b6('0x18')]);}})[_0x84b6('0x1a')](function(_0x37a6d9){logger['error'](_0x84b6('0x12'),_0x14591b,_0x37a6d9);_0x29066f(_0x37a6d9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 365e831..6f0a3c1 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 _0x544c=['emit','length','chatGroup:','./chatGroup.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544c,0x93));var _0xc544=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0x544c[_0x41b29e];return _0xacd517;};'use strict';var ChatGroupEvents=require(_0xc544('0x0'));var events=['save',_0xc544('0x1'),_0xc544('0x2')];function createListener(_0xf1a28d,_0x594259){return function(_0x2e57a5){_0x594259[_0xc544('0x3')](_0xf1a28d,_0x2e57a5);};}function removeListener(_0x9c1561,_0xb750cb){return function(){ChatGroupEvents['removeListener'](_0x9c1561,_0xb750cb);};}exports['register']=function(_0x3b6421){for(var _0x1a09ea=0x0,_0x5c3e18=events[_0xc544('0x4')];_0x1a09ea<_0x5c3e18;_0x1a09ea++){var _0x1e183e=events[_0x1a09ea];var _0x1701f6=createListener(_0xc544('0x5')+_0x1e183e,_0x3b6421);ChatGroupEvents['on'](_0x1e183e,_0x1701f6);}}; \ No newline at end of file +var _0x0c45=['./chatGroup.events','save','removeListener','chatGroup:'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0c45,0x128));var _0x50c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c45[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x50c4('0x0'));var events=[_0x50c4('0x1'),'remove','update'];function createListener(_0x18e716,_0x2da8ad){return function(_0x17ec86){_0x2da8ad['emit'](_0x18e716,_0x17ec86);};}function removeListener(_0x2f7e7b,_0x2f326c){return function(){ChatGroupEvents[_0x50c4('0x2')](_0x2f7e7b,_0x2f326c);};}exports['register']=function(_0x1a309e){for(var _0x53a5a0=0x0,_0xfa847a=events['length'];_0x53a5a0<_0xfa847a;_0x53a5a0++){var _0x541d0f=events[_0x53a5a0];var _0x9558f9=createListener(_0x50c4('0x3')+_0x541d0f,_0x1a309e);ChatGroupEvents['on'](_0x541d0f,_0x9558f9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 06b30c1..849a69e 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 _0xb78f=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/messages','post','create','addMessage','delete','removeMembers','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb78f,0x90));var _0xfb78=function(_0x30d1f5,_0x46e83e){_0x30d1f5=_0x30d1f5-0x0;var _0x5d5696=_0xb78f[_0x30d1f5];return _0x5d5696;};'use strict';var multer=require(_0xfb78('0x0'));var util=require(_0xfb78('0x1'));var path=require(_0xfb78('0x2'));var timeout=require(_0xfb78('0x3'));var express=require(_0xfb78('0x4'));var router=express[_0xfb78('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfb78('0x6'));var config=require(_0xfb78('0x7'));var controller=require(_0xfb78('0x8'));router[_0xfb78('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfb78('0x9')](_0xfb78('0xa'),auth[_0xfb78('0xb')](),controller[_0xfb78('0xc')]);router[_0xfb78('0x9')](_0xfb78('0xd'),auth[_0xfb78('0xb')](),controller[_0xfb78('0xe')]);router[_0xfb78('0x9')]('/:id/unread',auth['isAuthenticated'](),controller['getUnread']);router[_0xfb78('0x9')](_0xfb78('0xf'),auth['isAuthenticated'](),controller[_0xfb78('0x10')]);router['get'](_0xfb78('0x11'),auth[_0xfb78('0xb')](),controller['getMessages']);router[_0xfb78('0x12')]('/',auth['isAuthenticated'](),controller[_0xfb78('0x13')]);router[_0xfb78('0x12')](_0xfb78('0xf'),auth[_0xfb78('0xb')](),controller['addMembers']);router[_0xfb78('0x12')](_0xfb78('0x11'),auth['isAuthenticated'](),controller[_0xfb78('0x14')]);router['put'](_0xfb78('0xd'),auth[_0xfb78('0xb')](),controller['update']);router['delete']('/:id',auth[_0xfb78('0xb')](),controller['destroy']);router[_0xfb78('0x15')]('/:id/members',auth[_0xfb78('0xb')](),controller[_0xfb78('0x16')]);module[_0xfb78('0x17')]=router; \ No newline at end of file +var _0x701c=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout'];(function(_0x4a865f,_0x2f3c50){var _0x550fa5=function(_0x5d46de){while(--_0x5d46de){_0x4a865f['push'](_0x4a865f['shift']());}};_0x550fa5(++_0x2f3c50);}(_0x701c,0x1a0));var _0xc701=function(_0x47571a,_0x314dde){_0x47571a=_0x47571a-0x0;var _0x154ff8=_0x701c[_0x47571a];return _0x154ff8;};'use strict';var multer=require(_0xc701('0x0'));var util=require(_0xc701('0x1'));var path=require(_0xc701('0x2'));var timeout=require(_0xc701('0x3'));var express=require(_0xc701('0x4'));var router=express[_0xc701('0x5')]();var fs_extra=require(_0xc701('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc701('0x7'));var config=require(_0xc701('0x8'));var controller=require(_0xc701('0x9'));router['get']('/',auth[_0xc701('0xa')](),controller[_0xc701('0xb')]);router['get'](_0xc701('0xc'),auth[_0xc701('0xa')](),controller[_0xc701('0xd')]);router[_0xc701('0xe')](_0xc701('0xf'),auth[_0xc701('0xa')](),controller[_0xc701('0x10')]);router[_0xc701('0xe')](_0xc701('0x11'),auth[_0xc701('0xa')](),controller[_0xc701('0x12')]);router[_0xc701('0xe')](_0xc701('0x13'),auth['isAuthenticated'](),controller[_0xc701('0x14')]);router[_0xc701('0xe')](_0xc701('0x15'),auth[_0xc701('0xa')](),controller['getMessages']);router[_0xc701('0x16')]('/',auth[_0xc701('0xa')](),controller['create']);router[_0xc701('0x16')]('/:id/members',auth[_0xc701('0xa')](),controller['addMembers']);router[_0xc701('0x16')]('/:id/messages',auth[_0xc701('0xa')](),controller[_0xc701('0x17')]);router[_0xc701('0x18')](_0xc701('0xf'),auth[_0xc701('0xa')](),controller[_0xc701('0x19')]);router[_0xc701('0x1a')](_0xc701('0xf'),auth['isAuthenticated'](),controller[_0xc701('0x1b')]);router[_0xc701('0x1a')](_0xc701('0x13'),auth[_0xc701('0xa')](),controller[_0xc701('0x1c')]);module[_0xc701('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 055abe7..ab894b9 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 _0x4eaa=['out','INTEGER','sequelize','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4eaa,0x70));var _0xa4ea=function(_0x52e41f,_0x257d8c){_0x52e41f=_0x52e41f-0x0;var _0x5b2cda=_0x4eaa[_0x52e41f];return _0x5b2cda;};'use strict';var Sequelize=require(_0xa4ea('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa4ea('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa4ea('0x2')](_0xa4ea('0x3'),_0xa4ea('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xa4ea('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xa4ea('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa4ea('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa4ea('0x6')]},'note':{'type':Sequelize[_0xa4ea('0x6')]},'browserName':{'type':Sequelize[_0xa4ea('0x6')]},'browserVersion':{'type':Sequelize[_0xa4ea('0x6')]},'osName':{'type':Sequelize[_0xa4ea('0x6')]},'osVersion':{'type':Sequelize[_0xa4ea('0x6')]},'deviceModel':{'type':Sequelize[_0xa4ea('0x6')]},'deviceVendor':{'type':Sequelize[_0xa4ea('0x6')]},'deviceType':{'type':Sequelize[_0xa4ea('0x6')]},'referer':{'type':Sequelize[_0xa4ea('0x5')]},'customerIp':{'type':Sequelize[_0xa4ea('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xa4ea('0x8'))},'read1stAt':{'type':Sequelize[_0xa4ea('0x7')]},'lastMsgAt':{'type':Sequelize[_0xa4ea('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa4ea('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa4ea('0x6')]},'customerPort':{'type':Sequelize[_0xa4ea('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xa4ea('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa4ea('0xa')]}}; \ No newline at end of file +var _0x5fba=['star','thumb','TEXT','STRING','DATE','long','ENUM','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x5d7005,_0x41f35a){var _0x31ed20=function(_0x3624f8){while(--_0x3624f8){_0x5d7005['push'](_0x5d7005['shift']());}};_0x31ed20(++_0x41f35a);}(_0x5fba,0x1e1));var _0xa5fb=function(_0x48c5bb,_0x5d7066){_0x48c5bb=_0x48c5bb-0x0;var _0x5b5be6=_0x5fba[_0x48c5bb];return _0x5b5be6;};'use strict';var Sequelize=require(_0xa5fb('0x0'));module[_0xa5fb('0x1')]={'closed':{'type':Sequelize[_0xa5fb('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xa5fb('0x3'),_0xa5fb('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xa5fb('0x5')]},'pathTranscript':{'type':Sequelize[_0xa5fb('0x5')]},'mailTranscript':{'type':Sequelize[_0xa5fb('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa5fb('0x7')]},'disposition':{'type':Sequelize[_0xa5fb('0x6')]},'secondDisposition':{'type':Sequelize[_0xa5fb('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xa5fb('0x6')]},'osName':{'type':Sequelize[_0xa5fb('0x6')]},'osVersion':{'type':Sequelize[_0xa5fb('0x6')]},'deviceModel':{'type':Sequelize[_0xa5fb('0x6')]},'deviceVendor':{'type':Sequelize[_0xa5fb('0x6')]},'deviceType':{'type':Sequelize[_0xa5fb('0x6')]},'referer':{'type':Sequelize[_0xa5fb('0x5')]},'customerIp':{'type':Sequelize[_0xa5fb('0x6')]},'formData':{'type':Sequelize[_0xa5fb('0x5')](_0xa5fb('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xa5fb('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xa5fb('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa5fb('0x6')]},'customerPort':{'type':Sequelize[_0xa5fb('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xa5fb('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa5fb('0xa')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5c34f22..4490a10 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 _0x776c=['CloudProvider','Smtp','getSmtpOptions','SendMail','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','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','includeAll','rows','getMyMessages','ChatInteractionId','includeAgent','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','toString','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','update','destroy','name','send','render','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','keys','filters','intersection','model','attributes','fields','length','include','merge','options','find','create','params','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Attachment','attachId','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','transcript-%s.txt','now','pathTranscript','User','ChatWebsite','ContactId','Messages','format','%s%d','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','System','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x776c,0x1ec));var _0xc776=function(_0xbc686e,_0x61eaee){_0xbc686e=_0xbc686e-0x0;var _0x6d01f8=_0x776c[_0xbc686e];return _0x6d01f8;};'use strict';var rimraf=require(_0xc776('0x0'));var zipdir=require(_0xc776('0x1'));var rp=require(_0xc776('0x2'));var moment=require(_0xc776('0x3'));var BPromise=require(_0xc776('0x4'));var Mustache=require(_0xc776('0x5'));var util=require(_0xc776('0x6'));var path=require(_0xc776('0x7'));var ejs=require(_0xc776('0x8'));var fs=require('fs');var _=require(_0xc776('0x9'));var Redis=require('ioredis');var interaction=require(_0xc776('0xa'));var qs=require(_0xc776('0xb'));var pdf=require(_0xc776('0xc'));var logger=require(_0xc776('0xd'))('api');var config=require(_0xc776('0xe'));var db=require('../../mysqldb')['db'];config[_0xc776('0xf')]=_['defaults'](config[_0xc776('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xc776('0x10'))(new Redis(config[_0xc776('0xf')]));require('./chatInteraction.socket')[_0xc776('0x11')](socket);var jayson=require(_0xc776('0x12'));var client=jayson[_0xc776('0x13')]['http']({'port':0x232b});var client9004=jayson[_0xc776('0x13')][_0xc776('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x186786,_0x25cacd,_0x4fc22d,_0x12b88b){return new BPromise(function(_0x8279b1,_0x6c6622){var _0x2f8c84=_0x12b88b||client;return _0x2f8c84[_0xc776('0x15')](_0x186786,_0x4fc22d)[_0xc776('0x16')](function(_0x213b6f){logger[_0xc776('0x17')](_0xc776('0x18'),_0x25cacd,'request\x20sent');logger[_0xc776('0x19')](_0xc776('0x1a'),_0x25cacd,_0xc776('0x1b'),JSON[_0xc776('0x1c')](_0x213b6f));if(_0x213b6f[_0xc776('0x1d')]){if(_0x213b6f[_0xc776('0x1d')][_0xc776('0x1e')]===0x1f4){logger[_0xc776('0x1d')](_0xc776('0x18'),_0x25cacd,_0x213b6f['error'][_0xc776('0x1f')]);return _0x6c6622(_0x213b6f['error']['message']);}logger[_0xc776('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x25cacd,_0x213b6f[_0xc776('0x1d')][_0xc776('0x1f')]);return _0x8279b1(_0x213b6f['error'][_0xc776('0x1f')]);}else{logger['info'](_0xc776('0x18'),_0x25cacd,_0xc776('0x1b'));_0x8279b1(_0x213b6f[_0xc776('0x20')][_0xc776('0x1f')]);}})[_0xc776('0x21')](function(_0x8029c0){logger[_0xc776('0x1d')](_0xc776('0x18'),_0x25cacd,_0x8029c0);_0x6c6622(_0x8029c0);});});}function respondWithStatusCode(_0x4ce140,_0x15cfa5){_0x15cfa5=_0x15cfa5||0xcc;return function(_0x42bf49){if(_0x42bf49){return _0x4ce140[_0xc776('0x22')](_0x15cfa5);}return _0x4ce140[_0xc776('0x23')](_0x15cfa5)['end']();};}function respondWithResult(_0x3dbf0b,_0x1afa0d){_0x1afa0d=_0x1afa0d||0xc8;return function(_0x5dec1f){if(_0x5dec1f){return _0x3dbf0b['status'](_0x1afa0d)[_0xc776('0x24')](_0x5dec1f);}};}function respondWithFilteredResult(_0x308456,_0x5047f2){return function(_0x3516d9){if(_0x3516d9){var _0x4fe76b=typeof _0x5047f2[_0xc776('0x25')]===_0xc776('0x26')&&typeof _0x5047f2[_0xc776('0x27')]===_0xc776('0x26');var _0x39505c=_0x3516d9['count'];var _0x459c83=_0x4fe76b?0x0:_0x5047f2['offset'];var _0x352b94=_0x4fe76b?_0x3516d9['count']:_0x5047f2[_0xc776('0x25')]+_0x5047f2[_0xc776('0x27')];var _0x1414e0;if(_0x352b94>=_0x39505c){_0x352b94=_0x39505c;_0x1414e0=0xc8;}else{_0x1414e0=0xce;}_0x308456[_0xc776('0x23')](_0x1414e0);return _0x308456[_0xc776('0x28')](_0xc776('0x29'),_0x459c83+'-'+_0x352b94+'/'+_0x39505c)[_0xc776('0x24')](_0x3516d9);}return null;};}function saveUpdates(_0x35da14){return function(_0x4c9c48){if(_0x4c9c48){return _0x4c9c48[_0xc776('0x2a')](_0x35da14)[_0xc776('0x16')](function(_0xc30475){return _0xc30475;});}return null;};}function removeEntity(_0x55ca28){return function(_0x167257){if(_0x167257){return _0x167257[_0xc776('0x2b')]()[_0xc776('0x16')](function(){_0x55ca28[_0xc776('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b2dc5){return function(_0x4a3410){if(!_0x4a3410){_0x3b2dc5[_0xc776('0x22')](0x194);}return _0x4a3410;};}function handleError(_0x4c4145,_0x588dd4){_0x588dd4=_0x588dd4||0x1f4;return function(_0x4bf340){logger[_0xc776('0x1d')](_0x4bf340['stack']);if(_0x4bf340[_0xc776('0x2c')]){delete _0x4bf340[_0xc776('0x2c')];}_0x4c4145[_0xc776('0x23')](_0x588dd4)[_0xc776('0x2d')](_0x4bf340);};}function getMustacheRender(_0x28567d,_0x4cf867){return Mustache[_0xc776('0x2e')](_0x28567d,_['merge'](_0x4cf867[_0xc776('0x2f')],{'contact':_0x4cf867['contact'],'message':_0x4cf867[_0xc776('0x1f')],'agent':_0x4cf867[_0xc776('0x30')],'interaction':_0x4cf867[_0xc776('0x31')],'account':_0x4cf867[_0xc776('0x32')]}))||'';}exports[_0xc776('0x33')]=function(_0x40ff66,_0x1cca09){var _0x37e24a={};var _0x4e1852=_[_0xc776('0x34')](db[_0xc776('0x35')][_0xc776('0x36')],function(_0x56d9e4){return{'name':_0x56d9e4[_0xc776('0x37')],'type':_0x56d9e4[_0xc776('0x38')][_0xc776('0x39')]};});_0x37e24a=qs[_0xc776('0x3a')](_0x4e1852,_0x40ff66);return interaction[_0xc776('0x3b')](_0xc776('0x3c'),_0x40ff66[_0xc776('0x3d')],_0x40ff66[_0xc776('0x3e')],_0x37e24a,_0x4e1852)['then'](respondWithFilteredResult(_0x1cca09,_0x37e24a))['catch'](handleError(_0x1cca09,null));};exports['show']=function(_0x16169e,_0x534802){var _0x57c21b={'raw':![],'where':{'id':_0x16169e['params']['id']}},_0x27e5d1={};_0x27e5d1['model']=_[_0xc776('0x3f')](db['ChatInteraction'][_0xc776('0x36')]);_0x27e5d1[_0xc776('0x3d')]=_[_0xc776('0x3f')](_0x16169e[_0xc776('0x3d')]);_0x27e5d1[_0xc776('0x40')]=_[_0xc776('0x41')](_0x27e5d1[_0xc776('0x42')],_0x27e5d1[_0xc776('0x3d')]);_0x57c21b[_0xc776('0x43')]=_['intersection'](_0x27e5d1['model'],qs[_0xc776('0x44')](_0x16169e['query']['fields']));_0x57c21b[_0xc776('0x43')]=_0x57c21b[_0xc776('0x43')][_0xc776('0x45')]?_0x57c21b['attributes']:_0x27e5d1[_0xc776('0x42')];if(_0x16169e[_0xc776('0x3d')]['includeAll']){_0x57c21b[_0xc776('0x46')]=[{'all':!![]}];}_0x57c21b=_[_0xc776('0x47')]({},_0x57c21b,_0x16169e[_0xc776('0x48')]);return db[_0xc776('0x35')][_0xc776('0x49')](_0x57c21b)[_0xc776('0x16')](handleEntityNotFound(_0x534802,null))['then'](respondWithResult(_0x534802,null))[_0xc776('0x21')](handleError(_0x534802,null));};exports['create']=function(_0x57a91a,_0x4b4ce3){return db[_0xc776('0x35')][_0xc776('0x4a')](_0x57a91a[_0xc776('0x2f')],{})[_0xc776('0x16')](respondWithResult(_0x4b4ce3,0xc9))[_0xc776('0x21')](handleError(_0x4b4ce3,null));};exports[_0xc776('0x2a')]=function(_0x4cfcb5,_0x8e92e1){if(_0x4cfcb5[_0xc776('0x2f')]['id']){delete _0x4cfcb5['body']['id'];}return db['ChatInteraction'][_0xc776('0x49')]({'where':{'id':_0x4cfcb5[_0xc776('0x4b')]['id']}})[_0xc776('0x16')](handleEntityNotFound(_0x8e92e1,null))[_0xc776('0x16')](saveUpdates(_0x4cfcb5[_0xc776('0x2f')],null))[_0xc776('0x16')](respondWithResult(_0x8e92e1,null))[_0xc776('0x21')](handleError(_0x8e92e1,null));};exports['destroy']=function(_0x49a650,_0x1b160d){return db[_0xc776('0x35')][_0xc776('0x49')]({'where':{'id':_0x49a650[_0xc776('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1b160d,null))[_0xc776('0x16')](removeEntity(_0x1b160d,null))['catch'](handleError(_0x1b160d,null));};exports[_0xc776('0x4c')]=function(_0x2e606b,_0x3b4b46){return db['ChatInteraction']['describe']()[_0xc776('0x16')](respondWithResult(_0x3b4b46,null))['catch'](handleError(_0x3b4b46,null));};exports[_0xc776('0x4d')]=function(_0x4ae187,_0x46856e){var _0x3a1b19=_0x4ae187[_0xc776('0x4b')]['id'];var _0x1028b2;var _0x1080ef;var _0x1ff2ee;return db[_0xc776('0x35')][_0xc776('0x4e')]({'where':{'id':_0x3a1b19}})[_0xc776('0x16')](function(_0x219c15){_0x1028b2=_0x219c15;return db['ChatWebsite'][_0xc776('0x4e')]({'where':{'id':_0x219c15[_0xc776('0x4f')]},'attributes':['id','vidaooApiKey',_0xc776('0x50'),_0xc776('0x51'),_0xc776('0x52'),_0xc776('0x53')],'raw':!![]});})[_0xc776('0x16')](function(_0x26efe){if(_0x26efe&&_0x26efe[_0xc776('0x54')]&&_0x26efe[_0xc776('0x50')]){_0x1080ef=_0x26efe;var _0x45869b={'interaction':{'id':_0x3a1b19},'agent':{'id':_0x4ae187['user']['id'],'name':_0x4ae187[_0xc776('0x3e')][_0xc776('0x2c')],'fullname':_0x4ae187['user'][_0xc776('0x55')],'email':_0x4ae187['user'][_0xc776('0x56')]},'contact':_0x4ae187[_0xc776('0x2f')][_0xc776('0x57')],'account':_0x4ae187[_0xc776('0x2f')][_0xc776('0x32')]};var _0x3552f4={'rejectUnauthorized':![],'method':_0xc776('0x58'),'url':_0xc776('0x59'),'headers':{'X-APIKEY':_0x26efe[_0xc776('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4ae187[_0xc776('0x3e')]['email']],'buttons':null,'topic':_0x1080ef[_0xc776('0x51')],'note':_['isNull'](_0x1080ef[_0xc776('0x52')])?null:getMustacheRender(_0x1080ef[_0xc776('0x52')],_0x45869b),'metadata':null},'redirect':_0xc776('0x5a'),'json':!![]};try{if(!_['isNull'](_0x1080ef[_0xc776('0x53')])){var _0x4407c3=getMustacheRender(_0x1080ef[_0xc776('0x53')],_0x45869b);var _0x32c9cd=JSON['parse'](_0x4407c3);_0x3552f4['body'][_0xc776('0x5b')]=_0x32c9cd;}}catch(_0x270e95){throw new db[(_0xc776('0x5c'))][(_0xc776('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x3552f4);}else{throw new db[(_0xc776('0x5c'))][(_0xc776('0x5d'))](_0xc776('0x5e'));}})[_0xc776('0x16')](function(_0x592192){_0x1ff2ee=_0x592192;if(_0x1ff2ee['id']){var _0x1cf375={'body':_0x1ff2ee[_0xc776('0x5f')],'ChatWebsiteId':_0x1080ef['id'],'ChatInteractionId':_0x1028b2['id'],'direction':_0xc776('0x60'),'UserId':_0x4ae187[_0xc776('0x3e')]['id']};return db[_0xc776('0x61')][_0xc776('0x4a')](_0x1cf375,{});}else{throw new db['Sequelize'][(_0xc776('0x5d'))](_0xc776('0x62'));}})[_0xc776('0x16')](function(){return _0x1028b2[_0xc776('0x63')]({'vidaooSessionId':_0x1ff2ee['id']});})[_0xc776('0x16')](respondWithResult(_0x46856e,null))['catch'](handleError(_0x46856e,null));};exports['customUpdate']=function(_0x5a9422,_0x47eaa9){if(_0x5a9422[_0xc776('0x2f')]['id']){delete _0x5a9422[_0xc776('0x2f')]['id'];}return db[_0xc776('0x35')][_0xc776('0x49')]({'where':{'id':_0x5a9422['params']['id']},'include':[{'model':db[_0xc776('0x64')],'as':_0xc776('0x65')}]})[_0xc776('0x16')](handleEntityNotFound(_0x47eaa9,null))['then'](saveUpdates(_0x5a9422[_0xc776('0x2f')],null))[_0xc776('0x16')](respondWithResult(_0x47eaa9,null))[_0xc776('0x21')](handleError(_0x47eaa9,null));};exports[_0xc776('0x66')]=function(_0x136e8a,_0x5b4fed){if(_0x136e8a[_0xc776('0x2f')]['id']){delete _0x136e8a[_0xc776('0x2f')]['id'];}return db['ChatInteraction'][_0xc776('0x49')]({'where':{'id':_0x136e8a[_0xc776('0x4b')]['id']}})[_0xc776('0x16')](function(_0x437678){if(!_0x437678){logger[_0xc776('0x1d')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xc776('0x67'));_0x5b4fed[_0xc776('0x22')](0x194);}else{if(_0x437678[_0xc776('0x68')]){throw new db[(_0xc776('0x5c'))][(_0xc776('0x5d'))](_0xc776('0x69'));}}return _0x437678;})[_0xc776('0x16')](function(_0x16b848){if(_0x16b848){return _0x16b848[_0xc776('0x2a')]({'closed':_0x136e8a['body'][_0xc776('0x6a')],'disposition':_0x136e8a[_0xc776('0x2f')][_0xc776('0x6b')]})[_0xc776('0x16')](function(_0x5523c2){return _0x5523c2;});}})[_0xc776('0x16')](function(){return respondWithRpcPromise(_0xc776('0x6c'),_0xc776('0x66'),_0x136e8a[_0xc776('0x2f')],client9004);})[_0xc776('0x16')](respondWithResult(_0x5b4fed,null))['catch'](handleError(_0x5b4fed,null));};exports[_0xc776('0x6d')]=function(_0x547c2b,_0x2971b6){_0x547c2b['body'][_0xc776('0x2c')]=_0x547c2b[_0xc776('0x6e')][_0xc776('0x6f')];_0x547c2b['body'][_0xc776('0x70')]=_0x547c2b[_0xc776('0x6e')][_0xc776('0x71')];_0x547c2b[_0xc776('0x2f')][_0xc776('0x38')]=_0x547c2b[_0xc776('0x6e')][_0xc776('0x72')];return db['Attachment'][_0xc776('0x4a')](_0x547c2b['body'])[_0xc776('0x16')](respondWithResult(_0x2971b6,0xc9))['catch'](handleError(_0x2971b6,null));};exports[_0xc776('0x73')]=function(_0x16c74e,_0x308528){return db[_0xc776('0x35')][_0xc776('0x4e')]({'where':{'id':_0x16c74e[_0xc776('0x4b')]['id']},'raw':!![]})[_0xc776('0x16')](handleEntityNotFound(_0x308528,null))[_0xc776('0x16')](function(_0x37f37b){if(_0x37f37b){if(_0x37f37b[_0xc776('0x6a')]){return _0x308528[_0xc776('0x23')](0x193)[_0xc776('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0xc776('0x74')][_0xc776('0x4e')]({'where':{'id':_0x16c74e[_0xc776('0x3d')][_0xc776('0x75')]},'raw':!![]})[_0xc776('0x16')](handleEntityNotFound(_0x308528,null));}})[_0xc776('0x16')](function(_0x4c20a8){if(_0x4c20a8){var _0x1462c4=_0x4c20a8['ChatOfflineMessageId']!==null;var _0x45527f=path[_0xc776('0x76')](config['root'],_0xc776('0x77'));if(_0x1462c4){_0x45527f=path[_0xc776('0x76')](_0x45527f,_0xc776('0x78'));}var _0x2c6058=path['join'](_0x45527f,_0x4c20a8[_0xc776('0x70')]);return _0x308528[_0xc776('0x79')](_0x2c6058);}})[_0xc776('0x21')](handleError(_0x308528,null));};exports['close']=function(_0x5d425f,_0x195c17){var _0x5e1849=null;var _0x559044=null;var _0x1d91f0=null;if(_0x5d425f[_0xc776('0x2f')]['id']){delete _0x5d425f[_0xc776('0x2f')]['id'];}if(_0x5d425f[_0xc776('0x2f')][_0xc776('0x7a')]){_0x1d91f0=path['join'](config[_0xc776('0x7b')],'server/files/chat/upload/',util['format'](_0xc776('0x7c'),Date[_0xc776('0x7d')]()));_0x5d425f[_0xc776('0x2f')][_0xc776('0x7e')]=_0x1d91f0;}return db['ChatInteraction'][_0xc776('0x49')]({'where':{'id':_0x5d425f[_0xc776('0x4b')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xc776('0x7f')],'as':_0xc776('0x7f')}]}]})[_0xc776('0x16')](handleEntityNotFound(_0x195c17,null))[_0xc776('0x16')](saveUpdates(_0x5d425f[_0xc776('0x2f')],null))[_0xc776('0x16')](function(_0x3c0f5a){if(_0x3c0f5a){_0x5e1849=_0x3c0f5a;return db[_0xc776('0x80')][_0xc776('0x49')]({'where':{'id':_0x5e1849[_0xc776('0x4f')]}});}})[_0xc776('0x16')](function(_0x6a8094){if(_0x6a8094){_0x559044=_0x6a8094;return db[_0xc776('0x64')][_0xc776('0x49')]({'where':{'id':_0x5e1849[_0xc776('0x81')]}});}})['then'](function(_0x1db59c){if(_0x1db59c){if(_0x1d91f0){var _0x3c215e=null;for(var _0xf7a3f3=0x1;_0xf7a3f3<_0x5e1849[_0xc776('0x82')]['length'];++_0xf7a3f3){_0x3c215e=_0x5e1849['Messages'][_0xf7a3f3];var _0x17b04c=_0x3c215e[_0xc776('0x68')]?util[_0xc776('0x83')](_0xc776('0x84'),_0x559044['agentAlias'],_0x3c215e[_0xc776('0x68')]):'System';var _0x2ceaf4=_0x5d425f[_0xc776('0x2f')][_0xc776('0x85')]||util[_0xc776('0x83')]('%s%d',_0xc776('0x86'),_0x3c215e[_0xc776('0x81')]);switch(_0x559044[_0xc776('0x87')]){case _0xc776('0x88'):_0x17b04c=_0x3c215e['UserId']?util['format'](_0xc776('0x84'),_0x559044['agentAlias'],_0x3c215e['UserId']):'System';break;case _0xc776('0x89'):_0x17b04c=_0x3c215e[_0xc776('0x68')]?_0x3c215e[_0xc776('0x7f')][_0xc776('0x8a')]||_0x3c215e[_0xc776('0x7f')]['fullname']:_0xc776('0x8b');break;case _0xc776('0x8c'):_0x17b04c=_0x3c215e[_0xc776('0x68')]?_0x3c215e['User'][_0xc776('0x55')]:_0xc776('0x8b');break;default:_0x17b04c=_0x3c215e['UserId']?util[_0xc776('0x83')]('%s%d',_0x559044[_0xc776('0x8d')],_0x3c215e[_0xc776('0x68')]):_0xc776('0x8b');}var _0x2db9dd=util[_0xc776('0x83')](_0xc776('0x8e'),moment(_0x3c215e[_0xc776('0x8f')])[_0xc776('0x83')]('MM/DD/YYYY\x20HH:mm:ss'),_0x3c215e[_0xc776('0x90')]==='in'?_0x2ceaf4:_0x17b04c,_0x3c215e[_0xc776('0x2f')]);if(!_0x3c215e[_0xc776('0x91')]){fs[_0xc776('0x92')](_0x1d91f0,_0x2db9dd);}}return db['MailAccount'][_0xc776('0x4e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xc776('0x93')],'as':_0xc776('0x93'),'raw':!![]}]}]});}}})[_0xc776('0x16')](function(_0x3f6fa7){if(!_0x3f6fa7||!_0x3f6fa7[_0xc776('0x94')]||!_0x5d425f[_0xc776('0x2f')])return _0x5e1849;var _0x1cd6c6=_0x3f6fa7[_0xc776('0x95')]();return respondWithRpcPromise(_0xc776('0x96'),_0xc776('0x97'),{'account':_0x1cd6c6,'message':{'from':util[_0xc776('0x83')](_0xc776('0x98'),_0x3f6fa7['name'],_0x3f6fa7[_0xc776('0x56')]||_0x3f6fa7['Smtp'][_0xc776('0x3e')]),'to':_0x5d425f['body'][_0xc776('0x7a')],'subject':_0xc776('0x99'),'text':util[_0xc776('0x83')](_0xc776('0x9a'),_0x5d425f['body']['mailTranscript']),'attachments':[{'path':_0x1d91f0}]}})[_0xc776('0x16')](function(){return _0x5e1849;})[_0xc776('0x21')](function(_0xcfb795){logger[_0xc776('0x1d')](_0xcfb795);});})[_0xc776('0x16')](respondWithStatusCode(_0x195c17,0xc8))[_0xc776('0x21')](handleError(_0x195c17,null));};exports[_0xc776('0x9b')]=function(_0x2c47f3,_0x40a26a){return db[_0xc776('0x61')][_0xc776('0x49')]({'where':{'id':_0x2c47f3[_0xc776('0x4b')]['id']}})[_0xc776('0x16')](handleEntityNotFound(_0x40a26a,null))['then'](function(_0x4b2380){if(_0x4b2380){return _0x4b2380['addMessage'](_0x2c47f3[_0xc776('0x2f')][_0xc776('0x9c')],_[_0xc776('0x9d')](_0x2c47f3[_0xc776('0x2f')],[_0xc776('0x9c'),'id'])||{});}})[_0xc776('0x16')](respondWithResult(_0x40a26a,null))[_0xc776('0x21')](handleError(_0x40a26a,null));};exports[_0xc776('0x9e')]=function(_0x54e161,_0xb5c476){var _0x20360d={'raw':![],'where':{}};var _0x815ff6={};var _0x179207={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc776('0x4e')]({'where':{'id':_0x54e161[_0xc776('0x4b')]['id']}})['then'](handleEntityNotFound(_0xb5c476,null))[_0xc776('0x16')](function(_0x5c363b){if(_0x5c363b){_0x815ff6['model']=_[_0xc776('0x3f')](db['ChatMessage'][_0xc776('0x36')]);_0x815ff6[_0xc776('0x3d')]=_[_0xc776('0x3f')](_0x54e161[_0xc776('0x3d')]);_0x815ff6['filters']=_[_0xc776('0x41')](_0x815ff6[_0xc776('0x42')],_0x815ff6[_0xc776('0x3d')]);_0x20360d[_0xc776('0x43')]=_[_0xc776('0x41')](_0x815ff6[_0xc776('0x42')],qs[_0xc776('0x44')](_0x54e161[_0xc776('0x3d')][_0xc776('0x44')]));_0x20360d[_0xc776('0x43')]=_0x20360d['attributes']['length']?_0x20360d[_0xc776('0x43')]:_0x815ff6['model'];if(!_0x54e161['query'][_0xc776('0x9f')](_0xc776('0xa0'))){_0x20360d[_0xc776('0x27')]=qs[_0xc776('0x27')](_0x54e161['query'][_0xc776('0x27')]);_0x20360d[_0xc776('0x25')]=qs[_0xc776('0x25')](_0x54e161[_0xc776('0x3d')][_0xc776('0x25')]);}_0x20360d[_0xc776('0xa1')]=qs[_0xc776('0xa2')](_0x54e161['query'][_0xc776('0xa2')]);_0x20360d[_0xc776('0xa3')]=qs[_0xc776('0x40')](_[_0xc776('0xa4')](_0x54e161['query'],_0x815ff6[_0xc776('0x40')]));_0x20360d[_0xc776('0xa3')]['ChatInteractionId']=_0x5c363b['id'];if(_0x54e161[_0xc776('0x3d')]['filter']){_0x20360d[_0xc776('0xa3')]=_[_0xc776('0x47')](_0x20360d[_0xc776('0xa3')],{'$or':_[_0xc776('0x34')](_0x20360d['attributes'],function(_0x133d83){var _0x354a21={};_0x354a21[_0x133d83]={'$like':'%'+_0x54e161[_0xc776('0x3d')][_0xc776('0xa5')]+'%'};return _0x354a21;})});}if(_0x54e161[_0xc776('0x3d')][_0xc776('0xa6')]){var _0x37026f=_0x54e161[_0xc776('0x3d')][_0xc776('0xa6')][_0xc776('0xa7')](',');var _0x3f7872={};_0x3f7872[_0x37026f[0x0]]={'$gte':moment(_0x37026f[0x1])[_0xc776('0x83')](_0xc776('0xa8'))};_0x20360d[_0xc776('0xa3')]=_[_0xc776('0x47')](_0x20360d['where'],_0x3f7872);}_0x20360d=_[_0xc776('0x47')]({},_0x20360d,_0x54e161[_0xc776('0x48')]);return db['ChatMessage']['count']({'where':_0x20360d[_0xc776('0xa3')]})[_0xc776('0x16')](function(_0x5580e8){_0x179207[_0xc776('0xa9')]=_0x5580e8;if(_0x54e161[_0xc776('0x3d')][_0xc776('0xaa')]){_0x20360d[_0xc776('0x46')]=[{'all':!![]}];}return db[_0xc776('0x61')]['findAll'](_0x20360d);})[_0xc776('0x16')](function(_0x40f06a){_0x179207[_0xc776('0xab')]=_0x40f06a;return _0x179207;});}})[_0xc776('0x16')](respondWithFilteredResult(_0xb5c476,_0x20360d))['catch'](handleError(_0xb5c476,null));};exports[_0xc776('0xac')]=function(_0x4233c3,_0x37f79e){var _0x13366a={'where':{}},_0xb77348={},_0x12a187={'count':0x0,'rows':[]};return db[_0xc776('0x35')][_0xc776('0x4e')]({'where':{'id':_0x4233c3[_0xc776('0x4b')]['id']}})[_0xc776('0x16')](handleEntityNotFound(_0x37f79e,null))['then'](function(_0x1919cb){if(_0x1919cb){_0xb77348[_0xc776('0x42')]=_[_0xc776('0x3f')](db[_0xc776('0x61')]['rawAttributes']);_0xb77348['query']=_['keys'](_0x4233c3[_0xc776('0x3d')]);_0xb77348[_0xc776('0x40')]=_['intersection'](_0xb77348[_0xc776('0x42')],_0xb77348[_0xc776('0x3d')]);_0x13366a['attributes']=_[_0xc776('0x41')](_0xb77348[_0xc776('0x42')],qs['fields'](_0x4233c3['query'][_0xc776('0x44')]));_0x13366a[_0xc776('0x43')]=_0x13366a[_0xc776('0x43')][_0xc776('0x45')]?_0x13366a['attributes']:_0xb77348['model'];if(!_0x4233c3[_0xc776('0x3d')][_0xc776('0x9f')](_0xc776('0xa0'))){_0x13366a[_0xc776('0x27')]=qs[_0xc776('0x27')](_0x4233c3['query'][_0xc776('0x27')]);_0x13366a[_0xc776('0x25')]=qs[_0xc776('0x25')](_0x4233c3[_0xc776('0x3d')][_0xc776('0x25')]);}_0x13366a[_0xc776('0xa1')]=qs[_0xc776('0xa2')](_0x4233c3[_0xc776('0x3d')][_0xc776('0xa2')]);_0x13366a[_0xc776('0xa3')]=qs['filters'](_['pick'](_0x4233c3[_0xc776('0x3d')],_0xb77348[_0xc776('0x40')]));_0x13366a[_0xc776('0xa3')][_0xc776('0xad')]=_0x1919cb['id'];if(_0x4233c3['query']['filter']){_0x13366a[_0xc776('0xa3')]=_[_0xc776('0x47')](_0x13366a[_0xc776('0xa3')],{'$or':_['map'](_0x13366a[_0xc776('0x43')],function(_0x50af7d){var _0x4fb76f={};_0x4fb76f[_0x50af7d]={'$like':'%'+_0x4233c3[_0xc776('0x3d')]['filter']+'%'};return _0x4fb76f;})});}_0x13366a['where']['secret']=![];if(_0x4233c3[_0xc776('0x3d')]['id']){_0x13366a[_0xc776('0xa3')]['id']={'$gt':_0x4233c3['query']['id']};}_0x13366a=_['merge']({},_0x13366a,_0x4233c3[_0xc776('0x48')]);return db['ChatMessage'][_0xc776('0xa9')]({'where':_0x13366a[_0xc776('0xa3')]})[_0xc776('0x16')](function(_0x172412){_0x12a187['count']=_0x172412;_0x13366a[_0xc776('0x46')]=[];if(_0x4233c3[_0xc776('0x3d')][_0xc776('0xae')]){_0x13366a[_0xc776('0x46')][_0xc776('0xaf')]({'model':db[_0xc776('0x7f')],'as':_0xc776('0x7f'),'attributes':['id',_0xc776('0x55'),_0xc776('0x8a')]});}if(_0x4233c3[_0xc776('0x3d')][_0xc776('0xaa')]){_0x13366a[_0xc776('0x46')]=[{'all':!![]}];}return db[_0xc776('0x61')][_0xc776('0x3b')](_0x13366a);})[_0xc776('0x16')](function(_0x2dcb0f){_0x12a187[_0xc776('0xab')]=_0x2dcb0f;return _0x12a187;});}})[_0xc776('0x16')](respondWithFilteredResult(_0x37f79e,_0x13366a))[_0xc776('0x21')](handleError(_0x37f79e,null));};exports[_0xc776('0xb0')]=function(_0x159b98,_0x1426d9){return db['ChatInteraction'][_0xc776('0x49')]({'where':{'id':_0x159b98[_0xc776('0x4b')]['id']}})[_0xc776('0x16')](handleEntityNotFound(_0x1426d9,null))['then'](function(_0x8cf9a8){if(_0x8cf9a8){return _0x8cf9a8[_0xc776('0xb1')](_0x159b98['body']['ids'],_[_0xc776('0x9d')](_0x159b98[_0xc776('0x2f')],[_0xc776('0x9c'),'id'])||{})['spread'](function(){return db[_0xc776('0xb2')][_0xc776('0x3b')]({'attributes':['id',_0xc776('0x2c'),_0xc776('0xb3')],'where':{'id':_0x159b98[_0xc776('0x2f')][_0xc776('0x9c')]}});})['then'](function(_0x31b70e){socket[_0xc776('0xb4')](_0xc776('0xb5'),{'id':Number(_0x159b98[_0xc776('0x4b')]['id']),'tags':_0x31b70e||[]});return{'id':Number(_0x159b98[_0xc776('0x4b')]['id']),'tags':_0x31b70e||[]};});}})[_0xc776('0x16')](respondWithResult(_0x1426d9,null))['catch'](handleError(_0x1426d9,null));};exports[_0xc776('0xb6')]=function(_0x521b2b,_0x483fe2){return db[_0xc776('0x35')][_0xc776('0x49')]({'where':{'id':_0x521b2b[_0xc776('0x4b')]['id']}})[_0xc776('0x16')](handleEntityNotFound(_0x483fe2,null))['then'](function(_0x3755f7){if(_0x3755f7){return _0x3755f7[_0xc776('0xb6')](_0x521b2b[_0xc776('0x3d')][_0xc776('0x9c')]);}})['then'](respondWithStatusCode(_0x483fe2,null))[_0xc776('0x21')](handleError(_0x483fe2,null));};exports[_0xc776('0x79')]=function(_0x146144,_0x4d3c5e){var _0x5245d4=moment()['unix']()[_0xc776('0xb7')]();var _0xe64d99=path[_0xc776('0x76')](config[_0xc776('0x7b')],_0xc776('0xb8'),_0xc776('0xb9'),'tmp');var _0x2d723e=path[_0xc776('0x76')](config['root'],_0xc776('0xb8'),_0xc776('0xb9'),_0xc776('0xba'));var _0x53a19d=path['join'](_0xe64d99,_0x5245d4);var _0x367ec9=util['format'](_0xc776('0xbb'),_0x146144[_0xc776('0x4b')]['id'],_0x5245d4);var _0x1156cc=path['join'](_0xe64d99,_0x367ec9);var _0x404d60=[];_0x404d60['push']({'model':db['User'],'as':_0xc776('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x404d60['push']({'model':db[_0xc776('0x64')],'as':_0xc776('0x65'),'attributes':['id',_0xc776('0xbc'),_0xc776('0xbd')],'raw':!![]});if(_0x146144[_0xc776('0x3d')][_0xc776('0xba')]){_0x404d60['push']({'model':db[_0xc776('0x74')],'as':_0xc776('0x74'),'raw':!![]});}var _0x4f1682=[{'model':db[_0xc776('0x61')],'as':_0xc776('0x82'),'attributes':['id',_0xc776('0x2f'),'createdAt',_0xc776('0x90'),_0xc776('0x91'),_0xc776('0xbe')],'include':_0x404d60}];_0x4f1682[_0xc776('0xaf')]({'model':db[_0xc776('0x80')],'as':_0xc776('0xbf'),'attributes':['id',_0xc776('0x2c')]});_0x4f1682['push']({'model':db[_0xc776('0x7f')],'as':'Owner','attributes':['id',_0xc776('0x55')]});return db[_0xc776('0x35')][_0xc776('0x49')]({'where':{'id':_0x146144[_0xc776('0x4b')]['id']},'include':_0x4f1682})[_0xc776('0x16')](handleEntityNotFound(_0x4d3c5e,null))[_0xc776('0x16')](function(_0x110abd){if(_0x110abd){var _0xea05f3=_0x110abd[_0xc776('0xc0')]({'plain':!![]});fs[_0xc776('0xc1')](_0x53a19d);var _0x52792d={'channel':_0xc776('0xc2'),'account':_0xea05f3[_0xc776('0xbf')][_0xc776('0x2c')],'agent':_0xea05f3[_0xc776('0xc3')]?_0xea05f3[_0xc776('0xc3')][_0xc776('0x55')]:_0xc776('0xc4'),'createdAt':moment(_0xea05f3[_0xc776('0x8f')])[_0xc776('0x83')](_0xc776('0xa8'))['toString'](),'closedAt':_0xea05f3[_0xc776('0x6a')]?moment(_0xea05f3[_0xc776('0xc5')])['format'](_0xc776('0xa8'))[_0xc776('0xb7')]():'','disposition':_0xea05f3[_0xc776('0x6b')],'chatInfo':{'browser':_0xea05f3[_0xc776('0xc6')],'os':_0xea05f3['osName'],'referer':_0xea05f3[_0xc776('0xc7')],'customerIp':_0xea05f3[_0xc776('0xc8')],'customerPort':_0xea05f3[_0xc776('0xc9')]?_0xea05f3['customerPort']:_0xc776('0xc4')},'messages':_(_0xea05f3[_0xc776('0x82')])[_0xc776('0xca')]()[_0xc776('0xa5')]({'secret':![]})[_0xc776('0x34')](function(_0x476c2a){if(_0x476c2a[_0xc776('0x74')]){var _0x184d70=path[_0xc776('0x76')](_0x2d723e,_0x476c2a[_0xc776('0x74')][_0xc776('0x70')]);if(fs[_0xc776('0xcb')](_0x184d70)){fs[_0xc776('0xcc')](_0x184d70)[_0xc776('0xcd')](fs[_0xc776('0xce')](path['join'](_0x53a19d,_0x476c2a['Attachment'][_0xc776('0x70')])));}}return{'date':moment(_0x476c2a[_0xc776('0x8f')])[_0xc776('0x83')](_0xc776('0xa8'))[_0xc776('0xb7')](),'sender':_0x476c2a['direction']==='out'?_0x476c2a[_0xc776('0x7f')]?_0x476c2a[_0xc776('0x7f')][_0xc776('0x55')]:_0xc776('0x8b'):_0x476c2a[_0xc776('0x65')][_0xc776('0xbc')]+(_0x476c2a['Contact']['lastName']?'\x20'+_0x476c2a[_0xc776('0x65')][_0xc776('0xbd')]:''),'body':_0x476c2a['Attachment']?_0x476c2a[_0xc776('0x74')]['basename']:_0x476c2a[_0xc776('0x2f')],'direction':_0x476c2a[_0xc776('0x90')]===_0xc776('0x60')?'A':'C','secret':_0x476c2a[_0xc776('0x91')],'read':_0x476c2a['read'],'attachment':_0x476c2a[_0xc776('0x74')]};})[_0xc776('0xcf')]()};return ejs[_0xc776('0xd0')](path[_0xc776('0x76')](config['root'],'server',_0xc776('0xd1'),_0xc776('0xd2')),{'interaction':_0x52792d})[_0xc776('0x16')](function(_0x58a2f4){var _0x3409e5=path[_0xc776('0x76')](_0x53a19d,_0xc776('0xd3')+_0xea05f3['id']+'-'+_0x5245d4+'.pdf');var _0x7dc4cc={'path':_0x3409e5,'channel':_0xc776('0xc2'),'interactionId':_0xea05f3['id']};return pdf['createPdfFromHTML'](_0x58a2f4,_0x7dc4cc);})[_0xc776('0x16')](function(){return new Promise(function(_0xa2d79b,_0x1320e0){zipdir(_0x53a19d,{'saveTo':_0x1156cc},function(_0x4fc3ec,_0x2290a5){if(_0x4fc3ec)return _0x1320e0(_0x4fc3ec);return _0xa2d79b(_0x2290a5);});})[_0xc776('0x16')](function(){return new BPromise(function(_0xe52fc4,_0xa01da9){rimraf(_0x53a19d,function(_0x20f22a){if(_0x20f22a)_0xa01da9(_0x20f22a);return _0xe52fc4();});});})[_0xc776('0x16')](function(){return _0x4d3c5e[_0xc776('0x79')](_0x1156cc,_0x367ec9,function(_0x4d54d2){if(_0x4d54d2){logger[_0xc776('0x1d')](_0xc776('0xd4'),_0x4d54d2);}else{fs['unlinkSync'](_0x1156cc);}});});});}else{return _0x4d3c5e['sendStatus'](0xc8);}})[_0xc776('0x21')](handleError(_0x4d3c5e,null));}; \ No newline at end of file +var _0x2b85=['json','offset','undefined','limit','count','status','Content-Range','then','destroy','stack','name','send','merge','contact','interaction','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','chat','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','User','ChatWebsite','ChatWebsiteId','Messages','UserId','format','%s%d','System','Visitor','ContactId','agentIdentifier','website_alias','agentAlias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','secret','appendFileSync','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Smtp','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','includeAgent','push','setTags','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','read','Account','Owner','get','mkdirSync','browserName','osName','referer','customerIp','customerPort','N.A.','tail','createReadStream','pipe','createWriteStream','value','renderFile','views','transcript-','.pdf','Chat','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','end'];(function(_0x5b0fad,_0x577006){var _0x54ecd9=function(_0x87be9f){while(--_0x87be9f){_0x5b0fad['push'](_0x5b0fad['shift']());}};_0x54ecd9(++_0x577006);}(_0x2b85,0xab));var _0x52b8=function(_0x41dd85,_0x498a14){_0x41dd85=_0x41dd85-0x0;var _0x1a9886=_0x2b85[_0x41dd85];return _0x1a9886;};'use strict';var rimraf=require(_0x52b8('0x0'));var zipdir=require('zip-dir');var rp=require(_0x52b8('0x1'));var moment=require(_0x52b8('0x2'));var BPromise=require(_0x52b8('0x3'));var Mustache=require(_0x52b8('0x4'));var util=require(_0x52b8('0x5'));var path=require(_0x52b8('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x52b8('0x7'));var Redis=require(_0x52b8('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x52b8('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x52b8('0xa'))(_0x52b8('0xb'));var config=require(_0x52b8('0xc'));var db=require(_0x52b8('0xd'))['db'];config['redis']=_[_0x52b8('0xe')](config[_0x52b8('0xf')],{'host':_0x52b8('0x10'),'port':0x18eb});var socket=require(_0x52b8('0x11'))(new Redis(config[_0x52b8('0xf')]));require(_0x52b8('0x12'))[_0x52b8('0x13')](socket);var jayson=require(_0x52b8('0x14'));var client=jayson[_0x52b8('0x15')]['http']({'port':0x232b});var client9004=jayson['client'][_0x52b8('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x501ed5,_0x2b911f,_0x1ccc31,_0x49e179){return new BPromise(function(_0x1cb431,_0x2d79e4){var _0x30eefa=_0x49e179||client;return _0x30eefa[_0x52b8('0x17')](_0x501ed5,_0x1ccc31)['then'](function(_0x55a961){logger[_0x52b8('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x2b911f,_0x52b8('0x19'));logger[_0x52b8('0x1a')](_0x52b8('0x1b'),_0x2b911f,_0x52b8('0x19'),JSON[_0x52b8('0x1c')](_0x55a961));if(_0x55a961[_0x52b8('0x1d')]){if(_0x55a961[_0x52b8('0x1d')][_0x52b8('0x1e')]===0x1f4){logger[_0x52b8('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x2b911f,_0x55a961[_0x52b8('0x1d')][_0x52b8('0x1f')]);return _0x2d79e4(_0x55a961[_0x52b8('0x1d')][_0x52b8('0x1f')]);}logger[_0x52b8('0x1d')](_0x52b8('0x20'),_0x2b911f,_0x55a961[_0x52b8('0x1d')][_0x52b8('0x1f')]);return _0x1cb431(_0x55a961[_0x52b8('0x1d')][_0x52b8('0x1f')]);}else{logger[_0x52b8('0x18')](_0x52b8('0x20'),_0x2b911f,_0x52b8('0x19'));_0x1cb431(_0x55a961[_0x52b8('0x21')][_0x52b8('0x1f')]);}})[_0x52b8('0x22')](function(_0x2df482){logger['error'](_0x52b8('0x20'),_0x2b911f,_0x2df482);_0x2d79e4(_0x2df482);});});}function respondWithStatusCode(_0xa76d77,_0x44d4e6){_0x44d4e6=_0x44d4e6||0xcc;return function(_0x412209){if(_0x412209){return _0xa76d77[_0x52b8('0x23')](_0x44d4e6);}return _0xa76d77['status'](_0x44d4e6)[_0x52b8('0x24')]();};}function respondWithResult(_0x248069,_0x9fd69b){_0x9fd69b=_0x9fd69b||0xc8;return function(_0x15304d){if(_0x15304d){return _0x248069['status'](_0x9fd69b)[_0x52b8('0x25')](_0x15304d);}};}function respondWithFilteredResult(_0x17252c,_0x19a6e8){return function(_0x250219){if(_0x250219){var _0x32f542=typeof _0x19a6e8[_0x52b8('0x26')]===_0x52b8('0x27')&&typeof _0x19a6e8[_0x52b8('0x28')]===_0x52b8('0x27');var _0x10d22f=_0x250219['count'];var _0x259c22=_0x32f542?0x0:_0x19a6e8['offset'];var _0x12826b=_0x32f542?_0x250219[_0x52b8('0x29')]:_0x19a6e8[_0x52b8('0x26')]+_0x19a6e8[_0x52b8('0x28')];var _0x2557cc;if(_0x12826b>=_0x10d22f){_0x12826b=_0x10d22f;_0x2557cc=0xc8;}else{_0x2557cc=0xce;}_0x17252c[_0x52b8('0x2a')](_0x2557cc);return _0x17252c['set'](_0x52b8('0x2b'),_0x259c22+'-'+_0x12826b+'/'+_0x10d22f)['json'](_0x250219);}return null;};}function saveUpdates(_0x4772ab){return function(_0x177727){if(_0x177727){return _0x177727['update'](_0x4772ab)[_0x52b8('0x2c')](function(_0x3cba87){return _0x3cba87;});}return null;};}function removeEntity(_0xf413c7){return function(_0x1856bf){if(_0x1856bf){return _0x1856bf[_0x52b8('0x2d')]()[_0x52b8('0x2c')](function(){_0xf413c7[_0x52b8('0x2a')](0xcc)[_0x52b8('0x24')]();});}};}function handleEntityNotFound(_0x48b402){return function(_0xab5d5c){if(!_0xab5d5c){_0x48b402['sendStatus'](0x194);}return _0xab5d5c;};}function handleError(_0x47c700,_0x24c79b){_0x24c79b=_0x24c79b||0x1f4;return function(_0x316479){logger[_0x52b8('0x1d')](_0x316479[_0x52b8('0x2e')]);if(_0x316479[_0x52b8('0x2f')]){delete _0x316479['name'];}_0x47c700[_0x52b8('0x2a')](_0x24c79b)[_0x52b8('0x30')](_0x316479);};}function getMustacheRender(_0x572245,_0x5d1c8a){return Mustache['render'](_0x572245,_[_0x52b8('0x31')](_0x5d1c8a['body'],{'contact':_0x5d1c8a[_0x52b8('0x32')],'message':_0x5d1c8a[_0x52b8('0x1f')],'agent':_0x5d1c8a['agent'],'interaction':_0x5d1c8a[_0x52b8('0x33')],'account':_0x5d1c8a['account']}))||'';}exports['index']=function(_0x502bd5,_0x2aa9f1){var _0x350cb3={};var _0x2d668c=_[_0x52b8('0x34')](db[_0x52b8('0x35')][_0x52b8('0x36')],function(_0x3cc628){return{'name':_0x3cc628[_0x52b8('0x37')],'type':_0x3cc628[_0x52b8('0x38')][_0x52b8('0x39')]};});_0x350cb3=qs[_0x52b8('0x3a')](_0x2d668c,_0x502bd5);return interaction['findAll'](_0x52b8('0x3b'),_0x502bd5['query'],_0x502bd5['user'],_0x350cb3,_0x2d668c)[_0x52b8('0x2c')](respondWithFilteredResult(_0x2aa9f1,_0x350cb3))[_0x52b8('0x22')](handleError(_0x2aa9f1,null));};exports[_0x52b8('0x3c')]=function(_0x2e90fb,_0x53881a){var _0xda87e4={'raw':![],'where':{'id':_0x2e90fb[_0x52b8('0x3d')]['id']}},_0x46d153={};_0x46d153[_0x52b8('0x3e')]=_[_0x52b8('0x3f')](db[_0x52b8('0x35')][_0x52b8('0x36')]);_0x46d153[_0x52b8('0x40')]=_[_0x52b8('0x3f')](_0x2e90fb[_0x52b8('0x40')]);_0x46d153[_0x52b8('0x41')]=_[_0x52b8('0x42')](_0x46d153[_0x52b8('0x3e')],_0x46d153[_0x52b8('0x40')]);_0xda87e4['attributes']=_[_0x52b8('0x42')](_0x46d153[_0x52b8('0x3e')],qs[_0x52b8('0x43')](_0x2e90fb[_0x52b8('0x40')]['fields']));_0xda87e4['attributes']=_0xda87e4[_0x52b8('0x44')][_0x52b8('0x45')]?_0xda87e4[_0x52b8('0x44')]:_0x46d153[_0x52b8('0x3e')];if(_0x2e90fb['query'][_0x52b8('0x46')]){_0xda87e4[_0x52b8('0x47')]=[{'all':!![]}];}_0xda87e4=_[_0x52b8('0x31')]({},_0xda87e4,_0x2e90fb[_0x52b8('0x48')]);return db['ChatInteraction'][_0x52b8('0x49')](_0xda87e4)[_0x52b8('0x2c')](handleEntityNotFound(_0x53881a,null))['then'](respondWithResult(_0x53881a,null))[_0x52b8('0x22')](handleError(_0x53881a,null));};exports[_0x52b8('0x4a')]=function(_0x5cf2ca,_0x233a28){return db[_0x52b8('0x35')][_0x52b8('0x4a')](_0x5cf2ca[_0x52b8('0x4b')],{})['then'](respondWithResult(_0x233a28,0xc9))[_0x52b8('0x22')](handleError(_0x233a28,null));};exports['update']=function(_0x24b452,_0x9cff06){if(_0x24b452[_0x52b8('0x4b')]['id']){delete _0x24b452[_0x52b8('0x4b')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x24b452['params']['id']}})[_0x52b8('0x2c')](handleEntityNotFound(_0x9cff06,null))['then'](saveUpdates(_0x24b452[_0x52b8('0x4b')],null))[_0x52b8('0x2c')](respondWithResult(_0x9cff06,null))[_0x52b8('0x22')](handleError(_0x9cff06,null));};exports['destroy']=function(_0x57f24d,_0x33bf84){return db['ChatInteraction'][_0x52b8('0x49')]({'where':{'id':_0x57f24d[_0x52b8('0x3d')]['id']}})[_0x52b8('0x2c')](handleEntityNotFound(_0x33bf84,null))[_0x52b8('0x2c')](removeEntity(_0x33bf84,null))[_0x52b8('0x22')](handleError(_0x33bf84,null));};exports[_0x52b8('0x4c')]=function(_0xdd6c2c,_0x4db3dc){return db[_0x52b8('0x35')]['describe']()['then'](respondWithResult(_0x4db3dc,null))[_0x52b8('0x22')](handleError(_0x4db3dc,null));};exports[_0x52b8('0x4d')]=function(_0x21aa6c,_0x73d794){var _0x2b5be5=_0x21aa6c[_0x52b8('0x3d')]['id'];var _0x592b41;var _0x5c573f;var _0xb31588;return db['ChatInteraction']['findOne']({'where':{'id':_0x2b5be5}})[_0x52b8('0x2c')](function(_0x47e83b){_0x592b41=_0x47e83b;return db['ChatWebsite'][_0x52b8('0x4e')]({'where':{'id':_0x47e83b['ChatWebsiteId']},'attributes':['id',_0x52b8('0x4f'),_0x52b8('0x50'),_0x52b8('0x51'),_0x52b8('0x52'),_0x52b8('0x53')],'raw':!![]});})['then'](function(_0x2e1b54){if(_0x2e1b54&&_0x2e1b54[_0x52b8('0x4f')]&&_0x2e1b54[_0x52b8('0x50')]){_0x5c573f=_0x2e1b54;var _0x25c271={'interaction':{'id':_0x2b5be5},'agent':{'id':_0x21aa6c[_0x52b8('0x54')]['id'],'name':_0x21aa6c[_0x52b8('0x54')][_0x52b8('0x2f')],'fullname':_0x21aa6c[_0x52b8('0x54')]['fullname'],'email':_0x21aa6c[_0x52b8('0x54')][_0x52b8('0x55')]},'contact':_0x21aa6c['body'][_0x52b8('0x32')],'account':_0x21aa6c['body'][_0x52b8('0x56')]};var _0x1541cc={'rejectUnauthorized':![],'method':_0x52b8('0x57'),'url':_0x52b8('0x58'),'headers':{'X-APIKEY':_0x2e1b54[_0x52b8('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x21aa6c[_0x52b8('0x54')][_0x52b8('0x55')]],'buttons':null,'topic':_0x5c573f['vidaooTopic'],'note':_['isNull'](_0x5c573f[_0x52b8('0x52')])?null:getMustacheRender(_0x5c573f[_0x52b8('0x52')],_0x25c271),'metadata':null},'redirect':_0x52b8('0x59'),'json':!![]};try{if(!_[_0x52b8('0x5a')](_0x5c573f[_0x52b8('0x53')])){var _0x1694cb=getMustacheRender(_0x5c573f[_0x52b8('0x53')],_0x25c271);var _0x26eff1=JSON[_0x52b8('0x5b')](_0x1694cb);_0x1541cc[_0x52b8('0x4b')][_0x52b8('0x5c')]=_0x26eff1;}}catch(_0x29389d){throw new db[(_0x52b8('0x5d'))]['ValidationError'](_0x52b8('0x5e'));}return rp(_0x1541cc);}else{throw new db['Sequelize'][(_0x52b8('0x5f'))](_0x52b8('0x60'));}})[_0x52b8('0x2c')](function(_0x28cd6e){_0xb31588=_0x28cd6e;if(_0xb31588['id']){var _0x21add1={'body':_0xb31588[_0x52b8('0x61')],'ChatWebsiteId':_0x5c573f['id'],'ChatInteractionId':_0x592b41['id'],'direction':_0x52b8('0x62'),'UserId':_0x21aa6c['user']['id']};return db[_0x52b8('0x63')]['create'](_0x21add1,{});}else{throw new db['Sequelize'][(_0x52b8('0x5f'))](_0x52b8('0x64'));}})[_0x52b8('0x2c')](function(){return _0x592b41[_0x52b8('0x65')]({'vidaooSessionId':_0xb31588['id']});})[_0x52b8('0x2c')](respondWithResult(_0x73d794,null))[_0x52b8('0x22')](handleError(_0x73d794,null));};exports['customUpdate']=function(_0x2309a1,_0x20d3df){if(_0x2309a1['body']['id']){delete _0x2309a1[_0x52b8('0x4b')]['id'];}return db[_0x52b8('0x35')][_0x52b8('0x49')]({'where':{'id':_0x2309a1[_0x52b8('0x3d')]['id']},'include':[{'model':db[_0x52b8('0x66')],'as':_0x52b8('0x67')}]})['then'](handleEntityNotFound(_0x20d3df,null))[_0x52b8('0x2c')](saveUpdates(_0x2309a1[_0x52b8('0x4b')],null))[_0x52b8('0x2c')](respondWithResult(_0x20d3df,null))[_0x52b8('0x22')](handleError(_0x20d3df,null));};exports[_0x52b8('0x68')]=function(_0x2081e0,_0x4360a7){if(_0x2081e0[_0x52b8('0x4b')]['id']){delete _0x2081e0['body']['id'];}return db[_0x52b8('0x35')][_0x52b8('0x49')]({'where':{'id':_0x2081e0[_0x52b8('0x3d')]['id']}})['then'](function(_0x5ee889){if(!_0x5ee889){logger['error'](_0x52b8('0x69'),_0x52b8('0x68'),0x194,'entity\x20not\x20found');_0x4360a7[_0x52b8('0x23')](0x194);}else{if(_0x5ee889['UserId']){throw new db[(_0x52b8('0x5d'))][(_0x52b8('0x5f'))]('Interaction\x20already\x20assigned');}}return _0x5ee889;})[_0x52b8('0x2c')](function(_0x53f513){if(_0x53f513){return _0x53f513['update']({'closed':_0x2081e0[_0x52b8('0x4b')][_0x52b8('0x6a')],'disposition':_0x2081e0[_0x52b8('0x4b')][_0x52b8('0x6b')]})['then'](function(_0x2007d6){return _0x2007d6;});}})['then'](function(){return respondWithRpcPromise(_0x52b8('0x6c'),_0x52b8('0x68'),_0x2081e0[_0x52b8('0x4b')],client9004);})[_0x52b8('0x2c')](respondWithResult(_0x4360a7,null))['catch'](handleError(_0x4360a7,null));};exports[_0x52b8('0x6d')]=function(_0x19748f,_0x1330a6){_0x19748f[_0x52b8('0x4b')][_0x52b8('0x2f')]=_0x19748f[_0x52b8('0x6e')][_0x52b8('0x6f')];_0x19748f['body']['basename']=_0x19748f[_0x52b8('0x6e')]['filename'];_0x19748f['body'][_0x52b8('0x38')]=_0x19748f[_0x52b8('0x6e')][_0x52b8('0x70')];return db[_0x52b8('0x71')][_0x52b8('0x4a')](_0x19748f[_0x52b8('0x4b')])[_0x52b8('0x2c')](respondWithResult(_0x1330a6,0xc9))['catch'](handleError(_0x1330a6,null));};exports['attachmentDownload']=function(_0x16d230,_0x129432){return db[_0x52b8('0x35')][_0x52b8('0x4e')]({'where':{'id':_0x16d230['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x129432,null))['then'](function(_0x4b27d4){if(_0x4b27d4){if(_0x4b27d4[_0x52b8('0x6a')]){return _0x129432[_0x52b8('0x2a')](0x193)['json']({'status':0x193,'message':_0x52b8('0x72')});}return db[_0x52b8('0x71')][_0x52b8('0x4e')]({'where':{'id':_0x16d230[_0x52b8('0x40')][_0x52b8('0x73')]},'raw':!![]})[_0x52b8('0x2c')](handleEntityNotFound(_0x129432,null));}})['then'](function(_0x188524){if(_0x188524){var _0x4cf06c=_0x188524[_0x52b8('0x74')]!==null;var _0x2cb1b8=path[_0x52b8('0x75')](config[_0x52b8('0x76')],_0x52b8('0x77'));if(_0x4cf06c){_0x2cb1b8=path[_0x52b8('0x75')](_0x2cb1b8,_0x52b8('0x78'));}var _0x112519=path[_0x52b8('0x75')](_0x2cb1b8,_0x188524[_0x52b8('0x79')]);return _0x129432['download'](_0x112519);}})['catch'](handleError(_0x129432,null));};exports['close']=function(_0x124a48,_0x31ff75){var _0x3d18a9=null;var _0x10c180=null;var _0x51a69b=null;if(_0x124a48[_0x52b8('0x4b')]['id']){delete _0x124a48['body']['id'];}if(_0x124a48[_0x52b8('0x4b')][_0x52b8('0x7a')]){_0x51a69b=path['join'](config[_0x52b8('0x76')],_0x52b8('0x7b'),util['format'](_0x52b8('0x7c'),Date[_0x52b8('0x7d')]()));_0x124a48[_0x52b8('0x4b')][_0x52b8('0x7e')]=_0x51a69b;}return db[_0x52b8('0x35')][_0x52b8('0x49')]({'where':{'id':_0x124a48[_0x52b8('0x3d')]['id']},'include':[{'model':db[_0x52b8('0x63')],'as':'Messages','include':[{'model':db[_0x52b8('0x7f')],'as':_0x52b8('0x7f')}]}]})['then'](handleEntityNotFound(_0x31ff75,null))[_0x52b8('0x2c')](saveUpdates(_0x124a48[_0x52b8('0x4b')],null))[_0x52b8('0x2c')](function(_0x1a307a){if(_0x1a307a){_0x3d18a9=_0x1a307a;return db[_0x52b8('0x80')][_0x52b8('0x49')]({'where':{'id':_0x3d18a9[_0x52b8('0x81')]}});}})[_0x52b8('0x2c')](function(_0xf1864f){if(_0xf1864f){_0x10c180=_0xf1864f;return db[_0x52b8('0x66')][_0x52b8('0x49')]({'where':{'id':_0x3d18a9['ContactId']}});}})[_0x52b8('0x2c')](function(_0x26064b){if(_0x26064b){if(_0x51a69b){var _0x16b9a8=null;for(var _0x1b2514=0x1;_0x1b2514<_0x3d18a9['Messages'][_0x52b8('0x45')];++_0x1b2514){_0x16b9a8=_0x3d18a9[_0x52b8('0x82')][_0x1b2514];var _0x31e1a7=_0x16b9a8[_0x52b8('0x83')]?util[_0x52b8('0x84')](_0x52b8('0x85'),_0x10c180['agentAlias'],_0x16b9a8[_0x52b8('0x83')]):_0x52b8('0x86');var _0x52fee5=_0x124a48['body']['customer']||util[_0x52b8('0x84')](_0x52b8('0x85'),_0x52b8('0x87'),_0x16b9a8[_0x52b8('0x88')]);switch(_0x10c180[_0x52b8('0x89')]){case _0x52b8('0x8a'):_0x31e1a7=_0x16b9a8['UserId']?util[_0x52b8('0x84')](_0x52b8('0x85'),_0x10c180[_0x52b8('0x8b')],_0x16b9a8[_0x52b8('0x83')]):_0x52b8('0x86');break;case _0x52b8('0x8c'):_0x31e1a7=_0x16b9a8[_0x52b8('0x83')]?_0x16b9a8['User'][_0x52b8('0x8d')]||_0x16b9a8[_0x52b8('0x7f')]['fullname']:_0x52b8('0x86');break;case'agent_fullname':_0x31e1a7=_0x16b9a8[_0x52b8('0x83')]?_0x16b9a8[_0x52b8('0x7f')][_0x52b8('0x8e')]:_0x52b8('0x86');break;default:_0x31e1a7=_0x16b9a8['UserId']?util[_0x52b8('0x84')](_0x52b8('0x85'),_0x10c180[_0x52b8('0x8b')],_0x16b9a8[_0x52b8('0x83')]):_0x52b8('0x86');}var _0x1bf1bb=util[_0x52b8('0x84')](_0x52b8('0x8f'),moment(_0x16b9a8[_0x52b8('0x90')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x16b9a8['direction']==='in'?_0x52fee5:_0x31e1a7,_0x16b9a8[_0x52b8('0x4b')]);if(!_0x16b9a8[_0x52b8('0x91')]){fs[_0x52b8('0x92')](_0x51a69b,_0x1bf1bb);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x52b8('0x93')],'as':_0x52b8('0x93'),'raw':!![]}]}]});}}})[_0x52b8('0x2c')](function(_0x2dc604){if(!_0x2dc604||!_0x2dc604['Smtp']||!_0x124a48[_0x52b8('0x4b')])return _0x3d18a9;var _0x43aef3=_0x2dc604['getSmtpOptions']();return respondWithRpcPromise(_0x52b8('0x94'),_0x52b8('0x95'),{'account':_0x43aef3,'message':{'from':util[_0x52b8('0x84')](_0x52b8('0x96'),_0x2dc604[_0x52b8('0x2f')],_0x2dc604[_0x52b8('0x55')]||_0x2dc604[_0x52b8('0x97')][_0x52b8('0x54')]),'to':_0x124a48[_0x52b8('0x4b')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format'](_0x52b8('0x98'),_0x124a48[_0x52b8('0x4b')]['mailTranscript']),'attachments':[{'path':_0x51a69b}]}})[_0x52b8('0x2c')](function(){return _0x3d18a9;})['catch'](function(_0x4232ca){logger[_0x52b8('0x1d')](_0x4232ca);});})[_0x52b8('0x2c')](respondWithStatusCode(_0x31ff75,0xc8))[_0x52b8('0x22')](handleError(_0x31ff75,null));};exports['addMessage']=function(_0x1184fe,_0x551f44){return db['ChatMessage'][_0x52b8('0x49')]({'where':{'id':_0x1184fe[_0x52b8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x551f44,null))['then'](function(_0x55a7b9){if(_0x55a7b9){return _0x55a7b9['addMessage'](_0x1184fe[_0x52b8('0x4b')][_0x52b8('0x99')],_['omit'](_0x1184fe['body'],['ids','id'])||{});}})[_0x52b8('0x2c')](respondWithResult(_0x551f44,null))[_0x52b8('0x22')](handleError(_0x551f44,null));};exports[_0x52b8('0x9a')]=function(_0x4b22e9,_0xf510c1){var _0x30b597={'raw':![],'where':{}};var _0x488f13={};var _0xf8d87={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x52b8('0x4e')]({'where':{'id':_0x4b22e9['params']['id']}})[_0x52b8('0x2c')](handleEntityNotFound(_0xf510c1,null))[_0x52b8('0x2c')](function(_0x330b31){if(_0x330b31){_0x488f13[_0x52b8('0x3e')]=_[_0x52b8('0x3f')](db[_0x52b8('0x63')][_0x52b8('0x36')]);_0x488f13[_0x52b8('0x40')]=_['keys'](_0x4b22e9['query']);_0x488f13[_0x52b8('0x41')]=_[_0x52b8('0x42')](_0x488f13['model'],_0x488f13[_0x52b8('0x40')]);_0x30b597[_0x52b8('0x44')]=_['intersection'](_0x488f13[_0x52b8('0x3e')],qs['fields'](_0x4b22e9['query'][_0x52b8('0x43')]));_0x30b597[_0x52b8('0x44')]=_0x30b597[_0x52b8('0x44')][_0x52b8('0x45')]?_0x30b597[_0x52b8('0x44')]:_0x488f13[_0x52b8('0x3e')];if(!_0x4b22e9[_0x52b8('0x40')][_0x52b8('0x9b')](_0x52b8('0x9c'))){_0x30b597[_0x52b8('0x28')]=qs['limit'](_0x4b22e9['query']['limit']);_0x30b597['offset']=qs[_0x52b8('0x26')](_0x4b22e9[_0x52b8('0x40')]['offset']);}_0x30b597[_0x52b8('0x9d')]=qs[_0x52b8('0x9e')](_0x4b22e9[_0x52b8('0x40')][_0x52b8('0x9e')]);_0x30b597[_0x52b8('0x9f')]=qs[_0x52b8('0x41')](_[_0x52b8('0xa0')](_0x4b22e9[_0x52b8('0x40')],_0x488f13['filters']));_0x30b597[_0x52b8('0x9f')]['ChatInteractionId']=_0x330b31['id'];if(_0x4b22e9[_0x52b8('0x40')][_0x52b8('0xa1')]){_0x30b597[_0x52b8('0x9f')]=_[_0x52b8('0x31')](_0x30b597[_0x52b8('0x9f')],{'$or':_[_0x52b8('0x34')](_0x30b597['attributes'],function(_0x59f4e8){var _0x4cfbb4={};_0x4cfbb4[_0x59f4e8]={'$like':'%'+_0x4b22e9['query']['filter']+'%'};return _0x4cfbb4;})});}if(_0x4b22e9['query'][_0x52b8('0xa2')]){var _0x1c5f2c=_0x4b22e9['query'][_0x52b8('0xa2')][_0x52b8('0xa3')](',');var _0x4f8a60={};_0x4f8a60[_0x1c5f2c[0x0]]={'$gte':moment(_0x1c5f2c[0x1])[_0x52b8('0x84')](_0x52b8('0xa4'))};_0x30b597[_0x52b8('0x9f')]=_[_0x52b8('0x31')](_0x30b597[_0x52b8('0x9f')],_0x4f8a60);}_0x30b597=_[_0x52b8('0x31')]({},_0x30b597,_0x4b22e9['options']);return db[_0x52b8('0x63')][_0x52b8('0x29')]({'where':_0x30b597['where']})[_0x52b8('0x2c')](function(_0x151976){_0xf8d87[_0x52b8('0x29')]=_0x151976;if(_0x4b22e9[_0x52b8('0x40')][_0x52b8('0x46')]){_0x30b597[_0x52b8('0x47')]=[{'all':!![]}];}return db[_0x52b8('0x63')][_0x52b8('0xa5')](_0x30b597);})[_0x52b8('0x2c')](function(_0x4e74ad){_0xf8d87['rows']=_0x4e74ad;return _0xf8d87;});}})[_0x52b8('0x2c')](respondWithFilteredResult(_0xf510c1,_0x30b597))[_0x52b8('0x22')](handleError(_0xf510c1,null));};exports['getMyMessages']=function(_0x2b2755,_0x5be680){var _0x17b612={'where':{}},_0x5e14fe={},_0x314b09={'count':0x0,'rows':[]};return db[_0x52b8('0x35')][_0x52b8('0x4e')]({'where':{'id':_0x2b2755[_0x52b8('0x3d')]['id']}})[_0x52b8('0x2c')](handleEntityNotFound(_0x5be680,null))[_0x52b8('0x2c')](function(_0x1dd54b){if(_0x1dd54b){_0x5e14fe[_0x52b8('0x3e')]=_[_0x52b8('0x3f')](db[_0x52b8('0x63')][_0x52b8('0x36')]);_0x5e14fe[_0x52b8('0x40')]=_[_0x52b8('0x3f')](_0x2b2755['query']);_0x5e14fe[_0x52b8('0x41')]=_['intersection'](_0x5e14fe[_0x52b8('0x3e')],_0x5e14fe[_0x52b8('0x40')]);_0x17b612['attributes']=_['intersection'](_0x5e14fe['model'],qs[_0x52b8('0x43')](_0x2b2755[_0x52b8('0x40')][_0x52b8('0x43')]));_0x17b612['attributes']=_0x17b612[_0x52b8('0x44')][_0x52b8('0x45')]?_0x17b612['attributes']:_0x5e14fe[_0x52b8('0x3e')];if(!_0x2b2755[_0x52b8('0x40')]['hasOwnProperty'](_0x52b8('0x9c'))){_0x17b612[_0x52b8('0x28')]=qs[_0x52b8('0x28')](_0x2b2755['query'][_0x52b8('0x28')]);_0x17b612[_0x52b8('0x26')]=qs[_0x52b8('0x26')](_0x2b2755['query'][_0x52b8('0x26')]);}_0x17b612[_0x52b8('0x9d')]=qs[_0x52b8('0x9e')](_0x2b2755[_0x52b8('0x40')][_0x52b8('0x9e')]);_0x17b612[_0x52b8('0x9f')]=qs[_0x52b8('0x41')](_['pick'](_0x2b2755[_0x52b8('0x40')],_0x5e14fe[_0x52b8('0x41')]));_0x17b612[_0x52b8('0x9f')]['ChatInteractionId']=_0x1dd54b['id'];if(_0x2b2755[_0x52b8('0x40')][_0x52b8('0xa1')]){_0x17b612[_0x52b8('0x9f')]=_[_0x52b8('0x31')](_0x17b612['where'],{'$or':_['map'](_0x17b612['attributes'],function(_0x3dc43f){var _0x3c1656={};_0x3c1656[_0x3dc43f]={'$like':'%'+_0x2b2755[_0x52b8('0x40')][_0x52b8('0xa1')]+'%'};return _0x3c1656;})});}_0x17b612[_0x52b8('0x9f')][_0x52b8('0x91')]=![];if(_0x2b2755['query']['id']){_0x17b612[_0x52b8('0x9f')]['id']={'$gt':_0x2b2755[_0x52b8('0x40')]['id']};}_0x17b612=_[_0x52b8('0x31')]({},_0x17b612,_0x2b2755[_0x52b8('0x48')]);return db['ChatMessage']['count']({'where':_0x17b612[_0x52b8('0x9f')]})[_0x52b8('0x2c')](function(_0x5eb94e){_0x314b09['count']=_0x5eb94e;_0x17b612['include']=[];if(_0x2b2755['query'][_0x52b8('0xa6')]){_0x17b612['include'][_0x52b8('0xa7')]({'model':db['User'],'as':'User','attributes':['id',_0x52b8('0x8e'),_0x52b8('0x8d')]});}if(_0x2b2755[_0x52b8('0x40')][_0x52b8('0x46')]){_0x17b612['include']=[{'all':!![]}];}return db[_0x52b8('0x63')][_0x52b8('0xa5')](_0x17b612);})[_0x52b8('0x2c')](function(_0x13a70e){_0x314b09['rows']=_0x13a70e;return _0x314b09;});}})[_0x52b8('0x2c')](respondWithFilteredResult(_0x5be680,_0x17b612))[_0x52b8('0x22')](handleError(_0x5be680,null));};exports['addTags']=function(_0x2c8a42,_0x39e9ac){return db[_0x52b8('0x35')][_0x52b8('0x49')]({'where':{'id':_0x2c8a42['params']['id']}})['then'](handleEntityNotFound(_0x39e9ac,null))[_0x52b8('0x2c')](function(_0x1838e0){if(_0x1838e0){return _0x1838e0[_0x52b8('0xa8')](_0x2c8a42[_0x52b8('0x4b')][_0x52b8('0x99')],_[_0x52b8('0xa9')](_0x2c8a42['body'],[_0x52b8('0x99'),'id'])||{})[_0x52b8('0xaa')](function(){return db[_0x52b8('0xab')][_0x52b8('0xa5')]({'attributes':['id',_0x52b8('0x2f'),'color'],'where':{'id':_0x2c8a42[_0x52b8('0x4b')][_0x52b8('0x99')]}});})[_0x52b8('0x2c')](function(_0x3d8b0){socket[_0x52b8('0xac')](_0x52b8('0xad'),{'id':Number(_0x2c8a42[_0x52b8('0x3d')]['id']),'tags':_0x3d8b0||[]});return{'id':Number(_0x2c8a42[_0x52b8('0x3d')]['id']),'tags':_0x3d8b0||[]};});}})['then'](respondWithResult(_0x39e9ac,null))[_0x52b8('0x22')](handleError(_0x39e9ac,null));};exports['removeTags']=function(_0x4a38cf,_0x40be90){return db[_0x52b8('0x35')][_0x52b8('0x49')]({'where':{'id':_0x4a38cf['params']['id']}})[_0x52b8('0x2c')](handleEntityNotFound(_0x40be90,null))['then'](function(_0x40b9b5){if(_0x40b9b5){return _0x40b9b5[_0x52b8('0xae')](_0x4a38cf[_0x52b8('0x40')][_0x52b8('0x99')]);}})[_0x52b8('0x2c')](respondWithStatusCode(_0x40be90,null))[_0x52b8('0x22')](handleError(_0x40be90,null));};exports[_0x52b8('0xaf')]=function(_0xcafe09,_0x4f588d){var _0x317625=moment()[_0x52b8('0xb0')]()['toString']();var _0x54049c=path[_0x52b8('0x75')](config['root'],_0x52b8('0xb1'),_0x52b8('0xb2'),_0x52b8('0xb3'));var _0x5c21ca=path[_0x52b8('0x75')](config['root'],_0x52b8('0xb1'),_0x52b8('0xb2'),_0x52b8('0xb4'));var _0x66ca25=path[_0x52b8('0x75')](_0x54049c,_0x317625);var _0x1a44d3=util[_0x52b8('0x84')](_0x52b8('0xb5'),_0xcafe09[_0x52b8('0x3d')]['id'],_0x317625);var _0x2db8f7=path[_0x52b8('0x75')](_0x54049c,_0x1a44d3);var _0x5ca3e8=[];_0x5ca3e8[_0x52b8('0xa7')]({'model':db[_0x52b8('0x7f')],'as':_0x52b8('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x5ca3e8[_0x52b8('0xa7')]({'model':db[_0x52b8('0x66')],'as':_0x52b8('0x67'),'attributes':['id',_0x52b8('0xb6'),_0x52b8('0xb7')],'raw':!![]});if(_0xcafe09[_0x52b8('0x40')][_0x52b8('0xb4')]){_0x5ca3e8['push']({'model':db[_0x52b8('0x71')],'as':_0x52b8('0x71'),'raw':!![]});}var _0x2106ba=[{'model':db[_0x52b8('0x63')],'as':_0x52b8('0x82'),'attributes':['id',_0x52b8('0x4b'),'createdAt',_0x52b8('0xb8'),_0x52b8('0x91'),_0x52b8('0xb9')],'include':_0x5ca3e8}];_0x2106ba[_0x52b8('0xa7')]({'model':db[_0x52b8('0x80')],'as':_0x52b8('0xba'),'attributes':['id',_0x52b8('0x2f')]});_0x2106ba[_0x52b8('0xa7')]({'model':db[_0x52b8('0x7f')],'as':_0x52b8('0xbb'),'attributes':['id',_0x52b8('0x8e')]});return db['ChatInteraction'][_0x52b8('0x49')]({'where':{'id':_0xcafe09[_0x52b8('0x3d')]['id']},'include':_0x2106ba})[_0x52b8('0x2c')](handleEntityNotFound(_0x4f588d,null))[_0x52b8('0x2c')](function(_0x42f8f6){if(_0x42f8f6){var _0x2cce84=_0x42f8f6[_0x52b8('0xbc')]({'plain':!![]});fs[_0x52b8('0xbd')](_0x66ca25);var _0x38719={'channel':'Chat','account':_0x2cce84[_0x52b8('0xba')][_0x52b8('0x2f')],'agent':_0x2cce84[_0x52b8('0xbb')]?_0x2cce84[_0x52b8('0xbb')][_0x52b8('0x8e')]:'N.A.','createdAt':moment(_0x2cce84[_0x52b8('0x90')])[_0x52b8('0x84')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2cce84[_0x52b8('0x6a')]?moment(_0x2cce84['closedAt'])[_0x52b8('0x84')](_0x52b8('0xa4'))['toString']():'','disposition':_0x2cce84['disposition'],'chatInfo':{'browser':_0x2cce84[_0x52b8('0xbe')],'os':_0x2cce84[_0x52b8('0xbf')],'referer':_0x2cce84[_0x52b8('0xc0')],'customerIp':_0x2cce84[_0x52b8('0xc1')],'customerPort':_0x2cce84[_0x52b8('0xc2')]?_0x2cce84['customerPort']:_0x52b8('0xc3')},'messages':_(_0x2cce84['Messages'])[_0x52b8('0xc4')]()[_0x52b8('0xa1')]({'secret':![]})[_0x52b8('0x34')](function(_0x1c4518){if(_0x1c4518[_0x52b8('0x71')]){var _0x302541=path[_0x52b8('0x75')](_0x5c21ca,_0x1c4518[_0x52b8('0x71')]['basename']);if(fs['existsSync'](_0x302541)){fs[_0x52b8('0xc5')](_0x302541)[_0x52b8('0xc6')](fs[_0x52b8('0xc7')](path[_0x52b8('0x75')](_0x66ca25,_0x1c4518[_0x52b8('0x71')][_0x52b8('0x79')])));}}return{'date':moment(_0x1c4518[_0x52b8('0x90')])[_0x52b8('0x84')](_0x52b8('0xa4'))['toString'](),'sender':_0x1c4518['direction']===_0x52b8('0x62')?_0x1c4518['User']?_0x1c4518[_0x52b8('0x7f')][_0x52b8('0x8e')]:_0x52b8('0x86'):_0x1c4518['Contact'][_0x52b8('0xb6')]+(_0x1c4518[_0x52b8('0x67')][_0x52b8('0xb7')]?'\x20'+_0x1c4518['Contact'][_0x52b8('0xb7')]:''),'body':_0x1c4518[_0x52b8('0x71')]?_0x1c4518[_0x52b8('0x71')][_0x52b8('0x79')]:_0x1c4518['body'],'direction':_0x1c4518[_0x52b8('0xb8')]===_0x52b8('0x62')?'A':'C','secret':_0x1c4518[_0x52b8('0x91')],'read':_0x1c4518[_0x52b8('0xb9')],'attachment':_0x1c4518[_0x52b8('0x71')]};})[_0x52b8('0xc8')]()};return ejs[_0x52b8('0xc9')](path['join'](config[_0x52b8('0x76')],_0x52b8('0xb1'),_0x52b8('0xca'),'downloadInteraction.ejs'),{'interaction':_0x38719})[_0x52b8('0x2c')](function(_0x44b80a){var _0x2ec732=path['join'](_0x66ca25,_0x52b8('0xcb')+_0x2cce84['id']+'-'+_0x317625+_0x52b8('0xcc'));var _0x420974={'path':_0x2ec732,'channel':_0x52b8('0xcd'),'interactionId':_0x2cce84['id']};return pdf['createPdfFromHTML'](_0x44b80a,_0x420974);})[_0x52b8('0x2c')](function(){return new Promise(function(_0x1c6105,_0x548307){zipdir(_0x66ca25,{'saveTo':_0x2db8f7},function(_0x3d06bf,_0x44435b){if(_0x3d06bf)return _0x548307(_0x3d06bf);return _0x1c6105(_0x44435b);});})[_0x52b8('0x2c')](function(){return new BPromise(function(_0x1620ab,_0x28bc02){rimraf(_0x66ca25,function(_0x440636){if(_0x440636)_0x28bc02(_0x440636);return _0x1620ab();});});})[_0x52b8('0x2c')](function(){return _0x4f588d[_0x52b8('0xaf')](_0x2db8f7,_0x1a44d3,function(_0x3464e7){if(_0x3464e7){logger[_0x52b8('0x1d')](_0x52b8('0xce'),_0x3464e7);}else{fs[_0x52b8('0xcf')](_0x2db8f7);}});});});}else{return _0x4f588d[_0x52b8('0x23')](0xc8);}})[_0x52b8('0x22')](handleError(_0x4f588d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 04c6f36..499f25c 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 _0x73f5=['update','remove','getUsers','then','Users','map','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x73f5,0x19c));var _0x573f=function(_0x2fe704,_0x290c0c){_0x2fe704=_0x2fe704-0x0;var _0x5af2d4=_0x73f5[_0x2fe704];return _0x5af2d4;};'use strict';var EventEmitter=require(_0x573f('0x0'));var ChatInteraction=require(_0x573f('0x1'))['db'][_0x573f('0x2')];var ChatMessage=require(_0x573f('0x1'))['db'][_0x573f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x573f('0x4')](0x0);var events={'afterCreate':_0x573f('0x5'),'afterUpdate':_0x573f('0x6'),'afterDestroy':_0x573f('0x7')};function emitEvent(_0x29c9c8){return function(_0x392bc7,_0x53416a,_0x69664c){_0x392bc7[_0x573f('0x8')]({'attributes':['id'],'raw':!![]})[_0x573f('0x9')](function(_0x333b6c){_0x392bc7['setDataValue'](_0x573f('0xa'),_0x333b6c[_0x573f('0xb')](function(_0x45c7c3){return{'id':_0x45c7c3['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x392bc7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x573f('0x9')](function(_0x57186d){_0x392bc7[_0x573f('0xc')]('unreadMessages',_0x57186d[_0x573f('0xd')]);ChatInteractionEvents['emit'](_0x29c9c8+':'+_0x392bc7['id'],_0x392bc7);ChatInteractionEvents[_0x573f('0xe')](_0x29c9c8,_0x392bc7);_0x69664c(null);})[_0x573f('0xf')](_0x69664c(null));};}for(var e in events){if(events[_0x573f('0x10')](e)){var event=events[e];ChatInteraction[_0x573f('0x11')](e,emitEvent(event));}}module[_0x573f('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x9e59=['ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','ChatInteraction'];(function(_0x558371,_0x3516b9){var _0xfce068=function(_0x1a226a){while(--_0x1a226a){_0x558371['push'](_0x558371['shift']());}};_0xfce068(++_0x3516b9);}(_0x9e59,0x153));var _0x99e5=function(_0x564c14,_0x2b52ba){_0x564c14=_0x564c14-0x0;var _0x502251=_0x9e59[_0x564c14];return _0x502251;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x99e5('0x0')];var ChatMessage=require('../../mysqldb')['db'][_0x99e5('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x99e5('0x2')](0x0);var events={'afterCreate':_0x99e5('0x3'),'afterUpdate':'update','afterDestroy':_0x99e5('0x4')};function emitEvent(_0xd284eb){return function(_0x54b475,_0x101046,_0x1fe8a4){_0x54b475[_0x99e5('0x5')]({'attributes':['id'],'raw':!![]})[_0x99e5('0x6')](function(_0x233bdb){_0x54b475[_0x99e5('0x7')](_0x99e5('0x8'),_0x233bdb[_0x99e5('0x9')](function(_0xa63f27){return{'id':_0xa63f27['id']};}));return ChatMessage[_0x99e5('0xa')]({'where':{'ChatInteractionId':_0x54b475['id'],'direction':'in','read':![]},'raw':!![]});})[_0x99e5('0x6')](function(_0x36b9ab){_0x54b475[_0x99e5('0x7')](_0x99e5('0xb'),_0x36b9ab[_0x99e5('0xc')]);ChatInteractionEvents[_0x99e5('0xd')](_0xd284eb+':'+_0x54b475['id'],_0x54b475);ChatInteractionEvents[_0x99e5('0xd')](_0xd284eb,_0x54b475);_0x1fe8a4(null);})['catch'](_0x1fe8a4(null));};}for(var e in events){if(events[_0x99e5('0xe')](e)){var event=events[e];ChatInteraction[_0x99e5('0xf')](e,emitEvent(event));}}module[_0x99e5('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ca0328f..185b53c 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 _0xc5e8=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closedAt'];(function(_0x55572a,_0x3d75a5){var _0x5b3b99=function(_0x2ec8f8){while(--_0x2ec8f8){_0x55572a['push'](_0x55572a['shift']());}};_0x5b3b99(++_0x3d75a5);}(_0xc5e8,0x1e4));var _0x8c5e=function(_0x2a436d,_0x512231){_0x2a436d=_0x2a436d-0x0;var _0xd5ceda=_0xc5e8[_0x2a436d];return _0xd5ceda;};'use strict';var _=require('lodash');var util=require(_0x8c5e('0x0'));var logger=require(_0x8c5e('0x1'))(_0x8c5e('0x2'));var moment=require(_0x8c5e('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c5e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c5e('0x5'));var attributes=require(_0x8c5e('0x6'));module[_0x8c5e('0x7')]=function(_0x7ad0d,_0x106d80){return _0x7ad0d[_0x8c5e('0x8')](_0x8c5e('0x9'),attributes,{'tableName':_0x8c5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a818e,_0x3c88f1,_0x2659b3){if(_0x2a818e['changed']('closed')){_0x2a818e[_0x8c5e('0xb')]=moment()[_0x8c5e('0xc')](_0x8c5e('0xd'));}_0x2659b3(null,_0x2a818e);}},'charset':_0x8c5e('0xe'),'collate':_0x8c5e('0xf')});}; \ No newline at end of file +var _0x19e2=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x1bfc8e,_0xa42faa){var _0x173e09=function(_0x3dec42){while(--_0x3dec42){_0x1bfc8e['push'](_0x1bfc8e['shift']());}};_0x173e09(++_0xa42faa);}(_0x19e2,0x17c));var _0x219e=function(_0x2be775,_0x292011){_0x2be775=_0x2be775-0x0;var _0x5259dd=_0x19e2[_0x2be775];return _0x5259dd;};'use strict';var _=require(_0x219e('0x0'));var util=require(_0x219e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x219e('0x2'));var BPromise=require(_0x219e('0x3'));var rp=require(_0x219e('0x4'));var fs=require('fs');var path=require(_0x219e('0x5'));var rimraf=require(_0x219e('0x6'));var config=require(_0x219e('0x7'));var attributes=require(_0x219e('0x8'));module[_0x219e('0x9')]=function(_0x2d5d2,_0x52d5f7){return _0x2d5d2['define'](_0x219e('0xa'),attributes,{'tableName':_0x219e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x565e96,_0x10567e,_0x4d15e5){if(_0x565e96[_0x219e('0xc')](_0x219e('0xd'))){_0x565e96[_0x219e('0xe')]=moment()[_0x219e('0xf')](_0x219e('0x10'));}_0x4d15e5(null,_0x565e96);}},'charset':_0x219e('0x11'),'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 4627606..8e9c9d7 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 _0x4c34=['ChatInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','body','ids','omit','AddTags','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x297372,_0x1755f7){var _0x168a57=function(_0x4987ff){while(--_0x4987ff){_0x297372['push'](_0x297372['shift']());}};_0x168a57(++_0x1755f7);}(_0x4c34,0xc0));var _0x44c3=function(_0x1b225a,_0x16f3e9){_0x1b225a=_0x1b225a-0x0;var _0x49ca3b=_0x4c34[_0x1b225a];return _0x49ca3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44c3('0x0'));var BPromise=require(_0x44c3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44c3('0x2'));var db=require(_0x44c3('0x3'))['db'];var utils=require(_0x44c3('0x4'));var logger=require(_0x44c3('0x5'))(_0x44c3('0x6'));var config=require('../../config/environment');var jayson=require(_0x44c3('0x7'));var client=jayson['client'][_0x44c3('0x8')]({'port':0x232a});config[_0x44c3('0x9')]=_[_0x44c3('0xa')](config[_0x44c3('0x9')],{'host':_0x44c3('0xb'),'port':0x18eb});var socket=require(_0x44c3('0xc'))(new Redis(config[_0x44c3('0x9')]));require(_0x44c3('0xd'))[_0x44c3('0xe')](socket);function respondWithRpcPromise(_0x239e92,_0x342fe5,_0x4e4ca6){return new BPromise(function(_0x5681ab,_0x5991f6){return client[_0x44c3('0xf')](_0x239e92,_0x4e4ca6)[_0x44c3('0x10')](function(_0x360b52){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x342fe5,_0x44c3('0x11'));logger[_0x44c3('0x12')](_0x44c3('0x13'),_0x342fe5,_0x44c3('0x11'),JSON[_0x44c3('0x14')](_0x360b52));if(_0x360b52[_0x44c3('0x15')]){if(_0x360b52[_0x44c3('0x15')][_0x44c3('0x16')]===0x1f4){logger[_0x44c3('0x15')](_0x44c3('0x17'),_0x342fe5,_0x360b52['error'][_0x44c3('0x18')]);return _0x5991f6(_0x360b52[_0x44c3('0x15')][_0x44c3('0x18')]);}logger[_0x44c3('0x15')](_0x44c3('0x17'),_0x342fe5,_0x360b52['error'][_0x44c3('0x18')]);return _0x5681ab(_0x360b52['error'][_0x44c3('0x18')]);}else{logger[_0x44c3('0x19')](_0x44c3('0x17'),_0x342fe5,'request\x20sent');_0x5681ab(_0x360b52[_0x44c3('0x1a')]['message']);}})[_0x44c3('0x1b')](function(_0x2a3013){logger[_0x44c3('0x15')](_0x44c3('0x17'),_0x342fe5,_0x2a3013);_0x5991f6(_0x2a3013);});});}exports[_0x44c3('0x1c')]=function(_0x4e71e3){var _0x5de9a6=this;return new Promise(function(_0x20d59d,_0x2afff8){return db[_0x44c3('0x1d')][_0x44c3('0x1e')](_0x4e71e3['body'],{'raw':_0x4e71e3['options']?_0x4e71e3[_0x44c3('0x1f')][_0x44c3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e71e3['options']?_0x4e71e3[_0x44c3('0x1f')][_0x44c3('0x21')]||null:null,'attributes':_0x4e71e3[_0x44c3('0x1f')]?_0x4e71e3[_0x44c3('0x1f')][_0x44c3('0x22')]||null:null,'limit':_0x4e71e3['options']?_0x4e71e3[_0x44c3('0x1f')][_0x44c3('0x23')]||null:null})[_0x44c3('0x10')](function(_0x3d044f){logger[_0x44c3('0x19')]('UpdateChatInteraction',_0x4e71e3);logger[_0x44c3('0x12')](_0x44c3('0x1c'),_0x4e71e3,JSON['stringify'](_0x3d044f));_0x20d59d(_0x3d044f);})['catch'](function(_0x2760d0){logger[_0x44c3('0x15')](_0x44c3('0x1c'),_0x2760d0[_0x44c3('0x18')],_0x4e71e3);_0x2afff8(_0x5de9a6[_0x44c3('0x15')](0x1f4,_0x2760d0['message']));});});};exports[_0x44c3('0x24')]=function(_0x3ec563){return new Promise(function(_0x4be2a5,_0x464995){return db[_0x44c3('0x1d')][_0x44c3('0x25')]({'where':_0x3ec563[_0x44c3('0x1f')]?_0x3ec563['options'][_0x44c3('0x21')]||null:null})['then'](function(_0x5c6ad6){if(_0x5c6ad6){return _0x5c6ad6[_0x44c3('0x26')](_0x3ec563[_0x44c3('0x27')][_0x44c3('0x28')],_[_0x44c3('0x29')](_0x3ec563[_0x44c3('0x27')],[_0x44c3('0x28'),'id'])||{});}})['spread'](function(_0x1062e0){logger['info'](_0x44c3('0x2a'),_0x3ec563);logger['debug'](_0x44c3('0x2a'),_0x3ec563,JSON['stringify'](_0x1062e0));_0x4be2a5(_0x1062e0);})[_0x44c3('0x1b')](function(_0x561f2a){logger[_0x44c3('0x15')]('AddTags',_0x561f2a['message'],_0x3ec563);_0x464995(_this[_0x44c3('0x15')](0x1f4,_0x561f2a[_0x44c3('0x18')]));});});}; \ No newline at end of file +var _0x5f20=['AddTagsToChatInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','message','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit'];(function(_0xa3035d,_0x1ba3b7){var _0x4b9790=function(_0x48597c){while(--_0x48597c){_0xa3035d['push'](_0xa3035d['shift']());}};_0x4b9790(++_0x1ba3b7);}(_0x5f20,0x114));var _0x05f2=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x5f20[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x05f2('0x0'));var util=require(_0x05f2('0x1'));var moment=require(_0x05f2('0x2'));var BPromise=require(_0x05f2('0x3'));var rs=require(_0x05f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05f2('0x5'))['db'];var utils=require(_0x05f2('0x6'));var logger=require(_0x05f2('0x7'))(_0x05f2('0x8'));var config=require(_0x05f2('0x9'));var jayson=require(_0x05f2('0xa'));var client=jayson[_0x05f2('0xb')][_0x05f2('0xc')]({'port':0x232a});config['redis']=_[_0x05f2('0xd')](config[_0x05f2('0xe')],{'host':_0x05f2('0xf'),'port':0x18eb});var socket=require(_0x05f2('0x10'))(new Redis(config[_0x05f2('0xe')]));require(_0x05f2('0x11'))[_0x05f2('0x12')](socket);function respondWithRpcPromise(_0x4ee64a,_0x526031,_0x58c9e1){return new BPromise(function(_0xe58119,_0x4f5393){return client[_0x05f2('0x13')](_0x4ee64a,_0x58c9e1)[_0x05f2('0x14')](function(_0x31c2ed){logger[_0x05f2('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x526031,_0x05f2('0x16'));logger[_0x05f2('0x17')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x526031,_0x05f2('0x16'),JSON[_0x05f2('0x18')](_0x31c2ed));if(_0x31c2ed['error']){if(_0x31c2ed[_0x05f2('0x19')]['code']===0x1f4){logger[_0x05f2('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x526031,_0x31c2ed[_0x05f2('0x19')]['message']);return _0x4f5393(_0x31c2ed[_0x05f2('0x19')][_0x05f2('0x1a')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x526031,_0x31c2ed[_0x05f2('0x19')][_0x05f2('0x1a')]);return _0xe58119(_0x31c2ed[_0x05f2('0x19')][_0x05f2('0x1a')]);}else{logger[_0x05f2('0x15')](_0x05f2('0x1b'),_0x526031,_0x05f2('0x16'));_0xe58119(_0x31c2ed[_0x05f2('0x1c')][_0x05f2('0x1a')]);}})[_0x05f2('0x1d')](function(_0x1f37e9){logger[_0x05f2('0x19')](_0x05f2('0x1b'),_0x526031,_0x1f37e9);_0x4f5393(_0x1f37e9);});});}exports[_0x05f2('0x1e')]=function(_0xba299a){var _0x44a879=this;return new Promise(function(_0x216527,_0x135b59){return db[_0x05f2('0x1f')][_0x05f2('0x20')](_0xba299a[_0x05f2('0x21')],{'raw':_0xba299a[_0x05f2('0x22')]?_0xba299a['options'][_0x05f2('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xba299a[_0x05f2('0x22')]?_0xba299a[_0x05f2('0x22')][_0x05f2('0x24')]||null:null,'attributes':_0xba299a[_0x05f2('0x22')]?_0xba299a[_0x05f2('0x22')][_0x05f2('0x25')]||null:null,'limit':_0xba299a['options']?_0xba299a['options'][_0x05f2('0x26')]||null:null})[_0x05f2('0x14')](function(_0x1ae495){logger[_0x05f2('0x15')](_0x05f2('0x1e'),_0xba299a);logger[_0x05f2('0x17')](_0x05f2('0x1e'),_0xba299a,JSON[_0x05f2('0x18')](_0x1ae495));_0x216527(_0x1ae495);})[_0x05f2('0x1d')](function(_0x10dead){logger[_0x05f2('0x19')](_0x05f2('0x1e'),_0x10dead[_0x05f2('0x1a')],_0xba299a);_0x135b59(_0x44a879[_0x05f2('0x19')](0x1f4,_0x10dead[_0x05f2('0x1a')]));});});};exports[_0x05f2('0x27')]=function(_0x2b2d12){return new Promise(function(_0x4e36b8,_0x125e47){return db[_0x05f2('0x1f')][_0x05f2('0x28')]({'where':_0x2b2d12['options']?_0x2b2d12[_0x05f2('0x22')]['where']||null:null})[_0x05f2('0x14')](function(_0x6f9cfb){if(_0x6f9cfb){return _0x6f9cfb[_0x05f2('0x29')](_0x2b2d12['body']['ids'],_[_0x05f2('0x2a')](_0x2b2d12[_0x05f2('0x21')],[_0x05f2('0x2b'),'id'])||{});}})['spread'](function(_0x45635b){logger['info'](_0x05f2('0x2c'),_0x2b2d12);logger[_0x05f2('0x17')]('AddTags',_0x2b2d12,JSON[_0x05f2('0x18')](_0x45635b));_0x4e36b8(_0x45635b);})['catch'](function(_0x4a2b14){logger[_0x05f2('0x19')](_0x05f2('0x2c'),_0x4a2b14[_0x05f2('0x1a')],_0x2b2d12);_0x125e47(_this['error'](0x1f4,_0x4a2b14[_0x05f2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 410e931..75cda1d 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 _0x6959=['remove','update','register','length','save'];(function(_0x46e4cd,_0x10a676){var _0x35f64a=function(_0x14125b){while(--_0x14125b){_0x46e4cd['push'](_0x46e4cd['shift']());}};_0x35f64a(++_0x10a676);}(_0x6959,0x9a));var _0x9695=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6959[_0x20a584];return _0x4b41a8;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9695('0x0'),_0x9695('0x1'),_0x9695('0x2')];function createListener(_0x541062,_0x33e595){return function(_0x2cf25c){_0x33e595['emit'](_0x541062,_0x2cf25c);};}function removeListener(_0x17f7dd,_0x4eb47b){return function(){ChatInteractionEvents['removeListener'](_0x17f7dd,_0x4eb47b);};}exports[_0x9695('0x3')]=function(_0x373e36){for(var _0x271062=0x0,_0x5668c7=events[_0x9695('0x4')];_0x271062<_0x5668c7;_0x271062++){var _0x82812e=events[_0x271062];var _0x363be5=createListener('chatInteraction:'+_0x82812e,_0x373e36);ChatInteractionEvents['on'](_0x82812e,_0x363be5);}}; \ No newline at end of file +var _0x207c=['length','chatInteraction:','save','remove','update','emit'];(function(_0x10f004,_0x5c561d){var _0xd2a785=function(_0x417c1d){while(--_0x417c1d){_0x10f004['push'](_0x10f004['shift']());}};_0xd2a785(++_0x5c561d);}(_0x207c,0x1e8));var _0xc207=function(_0x102287,_0x1c82dc){_0x102287=_0x102287-0x0;var _0x43d29e=_0x207c[_0x102287];return _0x43d29e;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2')];function createListener(_0xaaba3d,_0x2b40be){return function(_0x12f1f2){_0x2b40be[_0xc207('0x3')](_0xaaba3d,_0x12f1f2);};}function removeListener(_0x4b9daa,_0x38ff02){return function(){ChatInteractionEvents['removeListener'](_0x4b9daa,_0x38ff02);};}exports['register']=function(_0x55023e){for(var _0xc88789=0x0,_0x314561=events[_0xc207('0x4')];_0xc88789<_0x314561;_0xc88789++){var _0x59ff6f=events[_0xc88789];var _0x25cb97=createListener(_0xc207('0x5')+_0x59ff6f,_0x55023e);ChatInteractionEvents['on'](_0x59ff6f,_0x25cb97);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 599861e..dd6de07 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 _0xfc95=['/:id/messages','addMessage','chat','chatinteraction:addtags','addTags','tracked','update','/:id/custom_update','customUpdate','put','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xfc95,0xba));var _0x5fc9=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xfc95[_0x16337a];return _0x422365;};'use strict';var multer=require(_0x5fc9('0x0'));var util=require(_0x5fc9('0x1'));var path=require(_0x5fc9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5fc9('0x3')]();var fs_extra=require(_0x5fc9('0x4'));var auth=require(_0x5fc9('0x5'));var interaction=require(_0x5fc9('0x6'));var config=require(_0x5fc9('0x7'));var controller=require(_0x5fc9('0x8'));router[_0x5fc9('0x9')]('/',auth['isAuthenticated'](),controller[_0x5fc9('0xa')]);router[_0x5fc9('0x9')](_0x5fc9('0xb'),auth[_0x5fc9('0xc')](),controller[_0x5fc9('0xd')]);router[_0x5fc9('0x9')](_0x5fc9('0xe'),auth[_0x5fc9('0xf')](),controller['show']);router[_0x5fc9('0x9')](_0x5fc9('0x10'),auth[_0x5fc9('0xf')](),controller[_0x5fc9('0x11')]);router['get']('/:id/messages',auth[_0x5fc9('0xc')](),controller[_0x5fc9('0x12')]);router[_0x5fc9('0x9')](_0x5fc9('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x5fc9('0x14')]);router[_0x5fc9('0x9')](_0x5fc9('0x15'),auth['isAuthenticated'](),controller[_0x5fc9('0x16')]);router[_0x5fc9('0x17')]('/',auth[_0x5fc9('0xc')](),controller['create']);router['post'](_0x5fc9('0x18'),auth['isAuthenticated'](),controller[_0x5fc9('0x19')]);var upload=multer({'storage':multer[_0x5fc9('0x1a')]({'destination':function(_0x23d9be,_0x5ccadb,_0x5540f5){_0x5540f5(null,path[_0x5fc9('0x1b')](config[_0x5fc9('0x1c')],_0x5fc9('0x1d')));},'filename':function(_0x286a9e,_0x3ea495,_0x146659){_0x146659(null,util['format'](_0x5fc9('0x1e'),Date[_0x5fc9('0x1f')](),_0x3ea495[_0x5fc9('0x20')][_0x5fc9('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5fc9('0x17')](_0x5fc9('0x22'),upload[_0x5fc9('0x23')](_0x5fc9('0x24')),controller[_0x5fc9('0x25')]);router[_0x5fc9('0x17')](_0x5fc9('0x26'),auth[_0x5fc9('0xf')](),controller[_0x5fc9('0x27')]);router[_0x5fc9('0x17')]('/:id/tags',auth[_0x5fc9('0xc')](),interaction['tracked'](_0x5fc9('0x28'),_0x5fc9('0x29')),controller[_0x5fc9('0x2a')]);router['put'](_0x5fc9('0xe'),auth[_0x5fc9('0xc')](),interaction[_0x5fc9('0x2b')]('chat','chatinteraction:update'),controller[_0x5fc9('0x2c')]);router['put'](_0x5fc9('0x2d'),controller[_0x5fc9('0x2e')]);router[_0x5fc9('0x2f')](_0x5fc9('0x30'),auth[_0x5fc9('0xf')](),controller[_0x5fc9('0x31')]);router[_0x5fc9('0x2f')]('/:id/close',controller[_0x5fc9('0x32')]);router[_0x5fc9('0x33')]('/:id',auth[_0x5fc9('0xc')](),interaction[_0x5fc9('0x2b')](_0x5fc9('0x28'),_0x5fc9('0x34')),controller[_0x5fc9('0x35')]);router[_0x5fc9('0x33')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5fc9('0x36')]);module[_0x5fc9('0x37')]=router; \ No newline at end of file +var _0x3605=['customUpdate','close','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','/:id/custom_update'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x3605,0x131));var _0x5360=function(_0x4cd2b4,_0x5e61bc){_0x4cd2b4=_0x4cd2b4-0x0;var _0x3e921a=_0x3605[_0x4cd2b4];return _0x3e921a;};'use strict';var multer=require(_0x5360('0x0'));var util=require(_0x5360('0x1'));var path=require(_0x5360('0x2'));var timeout=require(_0x5360('0x3'));var express=require(_0x5360('0x4'));var router=express[_0x5360('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5360('0x6'));router['get']('/',auth[_0x5360('0x7')](),controller[_0x5360('0x8')]);router[_0x5360('0x9')](_0x5360('0xa'),auth[_0x5360('0x7')](),controller[_0x5360('0xb')]);router[_0x5360('0x9')]('/:id',auth[_0x5360('0xc')](),controller[_0x5360('0xd')]);router['get']('/:id/attachment_download',auth[_0x5360('0xc')](),controller['attachmentDownload']);router[_0x5360('0x9')](_0x5360('0xe'),auth[_0x5360('0x7')](),controller[_0x5360('0xf')]);router['get'](_0x5360('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x5360('0x11')]);router[_0x5360('0x9')](_0x5360('0x12'),auth[_0x5360('0x7')](),controller[_0x5360('0x13')]);router[_0x5360('0x14')]('/',auth[_0x5360('0x7')](),controller[_0x5360('0x15')]);router[_0x5360('0x14')](_0x5360('0x16'),auth['isAuthenticated'](),controller[_0x5360('0x17')]);var upload=multer({'storage':multer[_0x5360('0x18')]({'destination':function(_0x3c22c0,_0x2a0e84,_0x1c0f5d){_0x1c0f5d(null,path[_0x5360('0x19')](config[_0x5360('0x1a')],'server/files/attachments/'));},'filename':function(_0x2d8171,_0xdf7fdb,_0x585a06){_0x585a06(null,util[_0x5360('0x1b')](_0x5360('0x1c'),Date[_0x5360('0x1d')](),_0xdf7fdb[_0x5360('0x1e')][_0x5360('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5360('0x14')]('/:id/attachment_upload',upload[_0x5360('0x20')](_0x5360('0x21')),controller[_0x5360('0x22')]);router[_0x5360('0x14')]('/:id/messages',auth[_0x5360('0xc')](),controller[_0x5360('0x23')]);router[_0x5360('0x14')](_0x5360('0x24'),auth['isAuthenticated'](),interaction[_0x5360('0x25')](_0x5360('0x26'),_0x5360('0x27')),controller[_0x5360('0x28')]);router[_0x5360('0x29')](_0x5360('0x2a'),auth[_0x5360('0x7')](),interaction['tracked'](_0x5360('0x26'),_0x5360('0x2b')),controller['update']);router['put'](_0x5360('0x2c'),controller[_0x5360('0x2d')]);router[_0x5360('0x29')]('/:id/abandon',auth[_0x5360('0xc')](),controller['abandon']);router[_0x5360('0x29')]('/:id/close',controller[_0x5360('0x2e')]);router[_0x5360('0x2f')](_0x5360('0x2a'),auth['isAuthenticated'](),interaction[_0x5360('0x25')]('chat','chatinteraction:destroy'),controller['destroy']);router[_0x5360('0x2f')](_0x5360('0x24'),auth['isAuthenticated'](),controller[_0x5360('0x30')]);module[_0x5360('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 92ceb52..e32914a 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 _0x3da4=['medium','BOOLEAN','sequelize','TEXT'];(function(_0x482e2e,_0x1bbb93){var _0x2a3b5f=function(_0x5fbe38){while(--_0x5fbe38){_0x482e2e['push'](_0x482e2e['shift']());}};_0x2a3b5f(++_0x1bbb93);}(_0x3da4,0x10e));var _0x43da=function(_0x1bbaba,_0x8ebc66){_0x1bbaba=_0x1bbaba-0x0;var _0x1b3790=_0x3da4[_0x1bbaba];return _0x1b3790;};'use strict';var Sequelize=require(_0x43da('0x0'));module['exports']={'body':{'type':Sequelize[_0x43da('0x1')](_0x43da('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x43da('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2b8b=['exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x5da084,_0x193510){var _0x4c7bb6=function(_0x31c5ef){while(--_0x31c5ef){_0x5da084['push'](_0x5da084['shift']());}};_0x4c7bb6(++_0x193510);}(_0x2b8b,0x168));var _0xb2b8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2b8b[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0xb2b8('0x0')]={'body':{'type':Sequelize[_0xb2b8('0x1')](_0xb2b8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb2b8('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb2b8('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index af7f536..90ef1ec 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 _0x1bfd=['all','eml-format','rimraf','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','User','agent','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','length','resourceId','push','FromId','ToId','read','-createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bfd,0xd7));var _0xd1bf=function(_0x4f5b67,_0x3354df){_0x4f5b67=_0x4f5b67-0x0;var _0x53ee0a=_0x1bfd[_0x4f5b67];return _0x53ee0a;};'use strict';var emlformat=require(_0xd1bf('0x0'));var rimraf=require(_0xd1bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd1bf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd1bf('0x3'));var util=require('util');var path=require(_0xd1bf('0x4'));var sox=require(_0xd1bf('0x5'));var csv=require(_0xd1bf('0x6'));var ejs=require(_0xd1bf('0x7'));var fs=require('fs');var fs_extra=require(_0xd1bf('0x8'));var _=require(_0xd1bf('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd1bf('0xa'));var toCsv=require(_0xd1bf('0x6'));var querystring=require(_0xd1bf('0xb'));var Papa=require(_0xd1bf('0xc'));var Redis=require(_0xd1bf('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd1bf('0xe'));var as=require(_0xd1bf('0xf'));var hardwareService=require(_0xd1bf('0x10'));var logger=require(_0xd1bf('0x11'))(_0xd1bf('0x12'));var utils=require(_0xd1bf('0x13'));var config=require(_0xd1bf('0x14'));var licenseUtil=require(_0xd1bf('0x15'));var db=require(_0xd1bf('0x16'))['db'];config[_0xd1bf('0x17')]=_[_0xd1bf('0x18')](config[_0xd1bf('0x17')],{'host':_0xd1bf('0x19'),'port':0x18eb});var socket=require(_0xd1bf('0x1a'))(new Redis(config[_0xd1bf('0x17')]));require(_0xd1bf('0x1b'))[_0xd1bf('0x1c')](socket);function respondWithStatusCode(_0x43584d,_0x4f5bbf){_0x4f5bbf=_0x4f5bbf||0xcc;return function(_0x322b12){if(_0x322b12){return _0x43584d[_0xd1bf('0x1d')](_0x4f5bbf);}return _0x43584d[_0xd1bf('0x1e')](_0x4f5bbf)[_0xd1bf('0x1f')]();};}function respondWithResult(_0x5cb39b,_0x5cbe9a){_0x5cbe9a=_0x5cbe9a||0xc8;return function(_0x46947e){if(_0x46947e){return _0x5cb39b[_0xd1bf('0x1e')](_0x5cbe9a)['json'](_0x46947e);}};}function respondWithFilteredResult(_0xbef287,_0x253a18){return function(_0xdfa993){if(_0xdfa993){var _0x38fa07=typeof _0x253a18[_0xd1bf('0x20')]===_0xd1bf('0x21')&&typeof _0x253a18[_0xd1bf('0x22')]===_0xd1bf('0x21');var _0x250969=_0xdfa993['count'];var _0x43de65=_0x38fa07?0x0:_0x253a18['offset'];var _0x2fbe7e=_0x38fa07?_0xdfa993[_0xd1bf('0x23')]:_0x253a18[_0xd1bf('0x20')]+_0x253a18[_0xd1bf('0x22')];var _0xe283e;if(_0x2fbe7e>=_0x250969){_0x2fbe7e=_0x250969;_0xe283e=0xc8;}else{_0xe283e=0xce;}_0xbef287[_0xd1bf('0x1e')](_0xe283e);return _0xbef287[_0xd1bf('0x24')](_0xd1bf('0x25'),_0x43de65+'-'+_0x2fbe7e+'/'+_0x250969)[_0xd1bf('0x26')](_0xdfa993);}return null;};}function patchUpdates(_0x1631fe){return function(_0x14d8b9){try{jsonpatch[_0xd1bf('0x27')](_0x14d8b9,_0x1631fe,!![]);}catch(_0x558574){return BPromise[_0xd1bf('0x28')](_0x558574);}return _0x14d8b9['save']();};}function saveUpdates(_0x571b89,_0x124400){return function(_0x4d196c){if(_0x4d196c){return _0x4d196c[_0xd1bf('0x29')](_0x571b89)[_0xd1bf('0x2a')](function(_0x27937c){return _0x27937c;});}return null;};}function removeEntity(_0x12374f,_0x481b26){return function(_0x10671a){if(_0x10671a){return _0x10671a[_0xd1bf('0x2b')]()[_0xd1bf('0x2a')](function(){_0x12374f[_0xd1bf('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a1e4e,_0x55c172){return function(_0x35b0da){if(!_0x35b0da){_0x1a1e4e[_0xd1bf('0x1d')](0x194);}return _0x35b0da;};}function handleError(_0x440892,_0x1724bd){_0x1724bd=_0x1724bd||0x1f4;return function(_0x450ada){logger[_0xd1bf('0x2c')](_0x450ada[_0xd1bf('0x2d')]);if(_0x450ada[_0xd1bf('0x2e')]){delete _0x450ada[_0xd1bf('0x2e')];}_0x440892[_0xd1bf('0x1e')](_0x1724bd)[_0xd1bf('0x2f')](_0x450ada);};}exports[_0xd1bf('0x30')]=function(_0x4adbfb,_0x3acc67){var _0x17e755={},_0x2cc2b4={},_0x42b678={'count':0x0,'rows':[]};var _0xfdbaa8=_[_0xd1bf('0x31')](db[_0xd1bf('0x32')]['rawAttributes'],function(_0x1660f7){return{'name':_0x1660f7[_0xd1bf('0x33')],'type':_0x1660f7[_0xd1bf('0x34')]['key']};});_0x2cc2b4[_0xd1bf('0x35')]=_['map'](_0xfdbaa8,'name');_0x2cc2b4[_0xd1bf('0x36')]=_[_0xd1bf('0x37')](_0x4adbfb['query']);_0x2cc2b4[_0xd1bf('0x38')]=_[_0xd1bf('0x39')](_0x2cc2b4['model'],_0x2cc2b4[_0xd1bf('0x36')]);_0x17e755['attributes']=_['intersection'](_0x2cc2b4[_0xd1bf('0x35')],qs['fields'](_0x4adbfb[_0xd1bf('0x36')][_0xd1bf('0x3a')]));_0x17e755['attributes']=_0x17e755[_0xd1bf('0x3b')]['length']?_0x17e755[_0xd1bf('0x3b')]:_0x2cc2b4[_0xd1bf('0x35')];if(!_0x4adbfb['query'][_0xd1bf('0x3c')]('nolimit')){_0x17e755[_0xd1bf('0x22')]=qs['limit'](_0x4adbfb[_0xd1bf('0x36')]['limit']);_0x17e755[_0xd1bf('0x20')]=qs[_0xd1bf('0x20')](_0x4adbfb['query'][_0xd1bf('0x20')]);}_0x17e755[_0xd1bf('0x3d')]=qs[_0xd1bf('0x3e')](_0x4adbfb[_0xd1bf('0x36')][_0xd1bf('0x3e')]);_0x17e755[_0xd1bf('0x3f')]=qs['filters'](_['pick'](_0x4adbfb['query'],_0x2cc2b4['filters']),_0xfdbaa8);if(_0x4adbfb[_0xd1bf('0x36')][_0xd1bf('0x40')]){_0x17e755[_0xd1bf('0x3f')]=_[_0xd1bf('0x41')](_0x17e755['where'],{'$or':_[_0xd1bf('0x31')](_0xfdbaa8,function(_0x98cdb1){if(_0x98cdb1['type']!==_0xd1bf('0x42')){var _0x4eee1d={};_0x4eee1d[_0x98cdb1[_0xd1bf('0x2e')]]={'$like':'%'+_0x4adbfb['query'][_0xd1bf('0x40')]+'%'};return _0x4eee1d;}})});}_0x17e755=_['merge']({},_0x17e755,_0x4adbfb[_0xd1bf('0x43')]);var _0x1772ae={'where':_0x17e755[_0xd1bf('0x3f')]};return db[_0xd1bf('0x32')]['count'](_0x1772ae)[_0xd1bf('0x2a')](function(_0x47cff1){_0x42b678[_0xd1bf('0x23')]=_0x47cff1;if(_0x4adbfb[_0xd1bf('0x36')][_0xd1bf('0x44')]){_0x17e755[_0xd1bf('0x45')]=[{'all':!![]}];}return db[_0xd1bf('0x32')][_0xd1bf('0x46')](_0x17e755);})[_0xd1bf('0x2a')](function(_0x24e047){_0x42b678['rows']=_0x24e047;return _0x42b678;})[_0xd1bf('0x2a')](respondWithFilteredResult(_0x3acc67,_0x17e755))[_0xd1bf('0x47')](handleError(_0x3acc67,null));};exports['show']=function(_0x341534,_0x33a980){var _0x5ce7c8={'raw':!![],'where':{'id':_0x341534[_0xd1bf('0x48')]['id']}},_0x501fea={};_0x501fea['model']=_[_0xd1bf('0x37')](db['ChatInternalMessage']['rawAttributes']);_0x501fea[_0xd1bf('0x36')]=_['keys'](_0x341534[_0xd1bf('0x36')]);_0x501fea[_0xd1bf('0x38')]=_[_0xd1bf('0x39')](_0x501fea[_0xd1bf('0x35')],_0x501fea[_0xd1bf('0x36')]);_0x5ce7c8[_0xd1bf('0x3b')]=_['intersection'](_0x501fea['model'],qs[_0xd1bf('0x3a')](_0x341534[_0xd1bf('0x36')][_0xd1bf('0x3a')]));_0x5ce7c8[_0xd1bf('0x3b')]=_0x5ce7c8[_0xd1bf('0x3b')]['length']?_0x5ce7c8['attributes']:_0x501fea[_0xd1bf('0x35')];if(_0x341534[_0xd1bf('0x36')]['includeAll']){_0x5ce7c8[_0xd1bf('0x45')]=[{'all':!![]}];}_0x5ce7c8=_[_0xd1bf('0x41')]({},_0x5ce7c8,_0x341534[_0xd1bf('0x43')]);return db[_0xd1bf('0x32')]['find'](_0x5ce7c8)[_0xd1bf('0x2a')](handleEntityNotFound(_0x33a980,null))['then'](respondWithResult(_0x33a980,null))[_0xd1bf('0x47')](handleError(_0x33a980,null));};exports[_0xd1bf('0x49')]=function(_0x26d8a2,_0x1b4e03){return db['ChatInternalMessage'][_0xd1bf('0x49')](_0x26d8a2[_0xd1bf('0x4a')],{})[_0xd1bf('0x2a')](respondWithResult(_0x1b4e03,0xc9))['catch'](handleError(_0x1b4e03,null));};exports[_0xd1bf('0x29')]=function(_0x22822f,_0x22cfe7){if(_0x22822f['body']['id']){delete _0x22822f[_0xd1bf('0x4a')]['id'];}return db['ChatInternalMessage'][_0xd1bf('0x4b')]({'where':{'id':_0x22822f[_0xd1bf('0x48')]['id']}})[_0xd1bf('0x2a')](handleEntityNotFound(_0x22cfe7,null))[_0xd1bf('0x2a')](saveUpdates(_0x22822f[_0xd1bf('0x4a')],null))[_0xd1bf('0x2a')](respondWithResult(_0x22cfe7,null))['catch'](handleError(_0x22cfe7,null));};exports[_0xd1bf('0x2b')]=function(_0x448c99,_0x180d83){return db[_0xd1bf('0x32')][_0xd1bf('0x4b')]({'where':{'id':_0x448c99[_0xd1bf('0x48')]['id']}})[_0xd1bf('0x2a')](handleEntityNotFound(_0x180d83,null))[_0xd1bf('0x2a')](removeEntity(_0x180d83,null))[_0xd1bf('0x47')](handleError(_0x180d83,null));};exports['describe']=function(_0x1b17ea,_0x4f28ee){return db['ChatInternalMessage'][_0xd1bf('0x4c')]()[_0xd1bf('0x2a')](respondWithResult(_0x4f28ee,null))[_0xd1bf('0x47')](handleError(_0x4f28ee,null));};function wrapUser(_0x366389){return function(_0x574110){var _0x30c4e0=_0x366389[_0xd1bf('0x4d')]({'plain':!![]});_0x30c4e0[_0xd1bf('0x4e')]=[];if(_0x574110){_0x30c4e0[_0xd1bf('0x4f')]=_0x574110[_0xd1bf('0x50')];_0x30c4e0[_0xd1bf('0x51')]=_0x574110;}else{_0x30c4e0['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x30c4e0['lastMessage']={};}return _0x30c4e0;};}exports['getUsers']=function(_0x565793,_0x3973de,_0x3e4f7a){var _0x4b856f=[];return db[_0xd1bf('0x52')]['findAll']({'where':{'role':[_0xd1bf('0x53'),'admin','user']},'attributes':['id','fullname',_0xd1bf('0x2e'),_0xd1bf('0x54'),_0xd1bf('0x55'),_0xd1bf('0x56'),_0xd1bf('0x57'),_0xd1bf('0x58'),_0xd1bf('0x59'),_0xd1bf('0x5a')],'order':qs['sort']('-online'),'include':[{'model':db[_0xd1bf('0x5b')],'as':_0xd1bf('0x5c'),'attributes':['id',_0xd1bf('0x2e'),'type'],'through':{'attributes':[]}}]})[_0xd1bf('0x2a')](function(_0x1a026f){if(_0x1a026f){var _0x2ac1b2=_0x565793[_0xd1bf('0x5d')][_0xd1bf('0x4d')]({'plain':!![]});if(!_0x2ac1b2)throw new Error(_0xd1bf('0x5e'));if(_0x2ac1b2['role']===_0xd1bf('0x5d')){return db['UserProfileSection'][_0xd1bf('0x4b')]({'where':{'name':_0xd1bf('0x5f'),'userProfileId':_0x2ac1b2[_0xd1bf('0x60')]},'raw':!![]})['then'](function(_0x3bb529){if(_0x3bb529){if(_0x3bb529['autoAssociation']===0x0){return db[_0xd1bf('0x61')]['findAll']({'where':{'sectionId':_0x3bb529['id']},'raw':!![]})['then'](function(_0x45407b){var _0x21d9a9=[];if(_[_0xd1bf('0x62')](_0x45407b)){_0x21d9a9=_[_0xd1bf('0x40')](_0x1a026f,function(_0x544e86){if(_0x544e86[_0xd1bf('0x54')]!==_0xd1bf('0x53')){return _0x544e86;}});return _0x21d9a9;}else{for(var _0x2f7742=0x0;_0x2f7742<_0x1a026f[_0xd1bf('0x63')];_0x2f7742++){var _0x46f03d=_0x1a026f[_0x2f7742];if(_0x46f03d[_0xd1bf('0x54')]==='agent'){var _0x3d997e=_[_0xd1bf('0x4b')](_0x45407b,function(_0x5b7249){return _0x5b7249[_0xd1bf('0x64')]===_0x46f03d['id'];});if(_0x3d997e)_0x21d9a9[_0xd1bf('0x65')](_0x46f03d);}else{_0x21d9a9[_0xd1bf('0x65')](_0x46f03d);}}return _0x21d9a9;}});}else{return _0x1a026f;}}else{var _0x3c6e68=_['filter'](_0x1a026f,function(_0x2efaa0){if(_0x2efaa0[_0xd1bf('0x54')]!==_0xd1bf('0x53')){return _0x2efaa0;}});return _0x3c6e68;}});}else{return _0x1a026f;}}})[_0xd1bf('0x2a')](function(_0x95f2ff){var _0x4ada5e=[];if(_0x95f2ff){_0x4b856f=_0x95f2ff;for(var _0x2e33a0=0x0;_0x2e33a0<_0x95f2ff['length'];_0x2e33a0+=0x1){_0x4b856f[_0x2e33a0]['messages']=[];_0x4ada5e[_0xd1bf('0x65')](db[_0xd1bf('0x32')][_0xd1bf('0x4b')]({'where':{'FromId':[_0x565793[_0xd1bf('0x5d')]['id'],_0x95f2ff[_0x2e33a0]['id']],'ToId':[_0x565793[_0xd1bf('0x5d')]['id'],_0x95f2ff[_0x2e33a0]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xd1bf('0x66'),_0xd1bf('0x67'),_0xd1bf('0x68'),_0xd1bf('0x4a')],'order':qs['sort'](_0xd1bf('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x95f2ff[_0x2e33a0])));}return BPromise[_0xd1bf('0x6a')](_0x4ada5e);}return[];})[_0xd1bf('0x2a')](function(_0x32e9a4){return{'rows':_0x32e9a4,'count':_0x32e9a4['length']};})['then'](respondWithResult(_0x3973de,null))[_0xd1bf('0x47')](handleError(_0x3973de,null));}; \ No newline at end of file +var _0xe546=['index','ChatInternalMessage','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','find','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','user','fullname','role','userpic','lastLoginAt','showWebBar','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','messages','FromId','ToId','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send'];(function(_0x1018c4,_0x413ab0){var _0x49f8cc=function(_0x5acb40){while(--_0x5acb40){_0x1018c4['push'](_0x1018c4['shift']());}};_0x49f8cc(++_0x413ab0);}(_0xe546,0xab));var _0x6e54=function(_0x48ccbe,_0x51a927){_0x48ccbe=_0x48ccbe-0x0;var _0x5011c1=_0xe546[_0x48ccbe];return _0x5011c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e54('0x0'));var zipdir=require(_0x6e54('0x1'));var jsonpatch=require(_0x6e54('0x2'));var rp=require(_0x6e54('0x3'));var moment=require(_0x6e54('0x4'));var BPromise=require(_0x6e54('0x5'));var Mustache=require('mustache');var util=require(_0x6e54('0x6'));var path=require(_0x6e54('0x7'));var sox=require(_0x6e54('0x8'));var csv=require(_0x6e54('0x9'));var ejs=require(_0x6e54('0xa'));var fs=require('fs');var fs_extra=require(_0x6e54('0xb'));var _=require(_0x6e54('0xc'));var squel=require(_0x6e54('0xd'));var crypto=require(_0x6e54('0xe'));var jsforce=require(_0x6e54('0xf'));var deskjs=require(_0x6e54('0x10'));var toCsv=require(_0x6e54('0x9'));var querystring=require(_0x6e54('0x11'));var Papa=require(_0x6e54('0x12'));var Redis=require(_0x6e54('0x13'));var authService=require(_0x6e54('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6e54('0x15'));var hardwareService=require(_0x6e54('0x16'));var logger=require('../../config/logger')(_0x6e54('0x17'));var utils=require(_0x6e54('0x18'));var config=require(_0x6e54('0x19'));var licenseUtil=require(_0x6e54('0x1a'));var db=require(_0x6e54('0x1b'))['db'];config[_0x6e54('0x1c')]=_[_0x6e54('0x1d')](config[_0x6e54('0x1c')],{'host':_0x6e54('0x1e'),'port':0x18eb});var socket=require(_0x6e54('0x1f'))(new Redis(config[_0x6e54('0x1c')]));require(_0x6e54('0x20'))[_0x6e54('0x21')](socket);function respondWithStatusCode(_0x39153d,_0x1d3f7d){_0x1d3f7d=_0x1d3f7d||0xcc;return function(_0x35369a){if(_0x35369a){return _0x39153d[_0x6e54('0x22')](_0x1d3f7d);}return _0x39153d[_0x6e54('0x23')](_0x1d3f7d)[_0x6e54('0x24')]();};}function respondWithResult(_0x41109a,_0x130da4){_0x130da4=_0x130da4||0xc8;return function(_0x400de6){if(_0x400de6){return _0x41109a[_0x6e54('0x23')](_0x130da4)[_0x6e54('0x25')](_0x400de6);}};}function respondWithFilteredResult(_0x1cd831,_0x5aea27){return function(_0x513184){if(_0x513184){var _0x16d455=typeof _0x5aea27[_0x6e54('0x26')]==='undefined'&&typeof _0x5aea27['limit']===_0x6e54('0x27');var _0x400547=_0x513184[_0x6e54('0x28')];var _0x2f5256=_0x16d455?0x0:_0x5aea27['offset'];var _0xa7cada=_0x16d455?_0x513184[_0x6e54('0x28')]:_0x5aea27[_0x6e54('0x26')]+_0x5aea27[_0x6e54('0x29')];var _0x2a2349;if(_0xa7cada>=_0x400547){_0xa7cada=_0x400547;_0x2a2349=0xc8;}else{_0x2a2349=0xce;}_0x1cd831[_0x6e54('0x23')](_0x2a2349);return _0x1cd831[_0x6e54('0x2a')](_0x6e54('0x2b'),_0x2f5256+'-'+_0xa7cada+'/'+_0x400547)[_0x6e54('0x25')](_0x513184);}return null;};}function patchUpdates(_0x57102c){return function(_0x5cb4bb){try{jsonpatch[_0x6e54('0x2c')](_0x5cb4bb,_0x57102c,!![]);}catch(_0xbc7dc9){return BPromise[_0x6e54('0x2d')](_0xbc7dc9);}return _0x5cb4bb[_0x6e54('0x2e')]();};}function saveUpdates(_0x178b50,_0x398cd9){return function(_0x6f9eb9){if(_0x6f9eb9){return _0x6f9eb9['update'](_0x178b50)[_0x6e54('0x2f')](function(_0x162d27){return _0x162d27;});}return null;};}function removeEntity(_0xdbd4e2,_0x54d594){return function(_0x55bea9){if(_0x55bea9){return _0x55bea9[_0x6e54('0x30')]()[_0x6e54('0x2f')](function(){_0xdbd4e2[_0x6e54('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501fa7,_0x49edf1){return function(_0x300a08){if(!_0x300a08){_0x501fa7[_0x6e54('0x22')](0x194);}return _0x300a08;};}function handleError(_0x55b966,_0x453289){_0x453289=_0x453289||0x1f4;return function(_0x47618c){logger['error'](_0x47618c['stack']);if(_0x47618c['name']){delete _0x47618c[_0x6e54('0x31')];}_0x55b966[_0x6e54('0x23')](_0x453289)[_0x6e54('0x32')](_0x47618c);};}exports[_0x6e54('0x33')]=function(_0x7f723,_0xa27f71){var _0x249f0c={},_0x56ed0f={},_0x143a7e={'count':0x0,'rows':[]};var _0x25ebe1=_['map'](db[_0x6e54('0x34')]['rawAttributes'],function(_0x37962c){return{'name':_0x37962c[_0x6e54('0x35')],'type':_0x37962c[_0x6e54('0x36')]['key']};});_0x56ed0f[_0x6e54('0x37')]=_[_0x6e54('0x38')](_0x25ebe1,_0x6e54('0x31'));_0x56ed0f['query']=_[_0x6e54('0x39')](_0x7f723[_0x6e54('0x3a')]);_0x56ed0f[_0x6e54('0x3b')]=_[_0x6e54('0x3c')](_0x56ed0f[_0x6e54('0x37')],_0x56ed0f[_0x6e54('0x3a')]);_0x249f0c['attributes']=_['intersection'](_0x56ed0f[_0x6e54('0x37')],qs[_0x6e54('0x3d')](_0x7f723[_0x6e54('0x3a')][_0x6e54('0x3d')]));_0x249f0c[_0x6e54('0x3e')]=_0x249f0c[_0x6e54('0x3e')][_0x6e54('0x3f')]?_0x249f0c[_0x6e54('0x3e')]:_0x56ed0f[_0x6e54('0x37')];if(!_0x7f723[_0x6e54('0x3a')][_0x6e54('0x40')](_0x6e54('0x41'))){_0x249f0c[_0x6e54('0x29')]=qs['limit'](_0x7f723[_0x6e54('0x3a')][_0x6e54('0x29')]);_0x249f0c[_0x6e54('0x26')]=qs[_0x6e54('0x26')](_0x7f723['query']['offset']);}_0x249f0c[_0x6e54('0x42')]=qs[_0x6e54('0x43')](_0x7f723[_0x6e54('0x3a')][_0x6e54('0x43')]);_0x249f0c[_0x6e54('0x44')]=qs[_0x6e54('0x3b')](_[_0x6e54('0x45')](_0x7f723['query'],_0x56ed0f[_0x6e54('0x3b')]),_0x25ebe1);if(_0x7f723[_0x6e54('0x3a')][_0x6e54('0x46')]){_0x249f0c[_0x6e54('0x44')]=_[_0x6e54('0x47')](_0x249f0c['where'],{'$or':_[_0x6e54('0x38')](_0x25ebe1,function(_0x34050c){if(_0x34050c[_0x6e54('0x36')]!==_0x6e54('0x48')){var _0x11adda={};_0x11adda[_0x34050c['name']]={'$like':'%'+_0x7f723[_0x6e54('0x3a')][_0x6e54('0x46')]+'%'};return _0x11adda;}})});}_0x249f0c=_[_0x6e54('0x47')]({},_0x249f0c,_0x7f723[_0x6e54('0x49')]);var _0x492e65={'where':_0x249f0c[_0x6e54('0x44')]};return db[_0x6e54('0x34')][_0x6e54('0x28')](_0x492e65)[_0x6e54('0x2f')](function(_0x503e55){_0x143a7e[_0x6e54('0x28')]=_0x503e55;if(_0x7f723['query']['includeAll']){_0x249f0c[_0x6e54('0x4a')]=[{'all':!![]}];}return db[_0x6e54('0x34')]['findAll'](_0x249f0c);})['then'](function(_0x3e23b9){_0x143a7e[_0x6e54('0x4b')]=_0x3e23b9;return _0x143a7e;})['then'](respondWithFilteredResult(_0xa27f71,_0x249f0c))[_0x6e54('0x4c')](handleError(_0xa27f71,null));};exports[_0x6e54('0x4d')]=function(_0x49dee5,_0x4eafb0){var _0x302bd1={'raw':!![],'where':{'id':_0x49dee5[_0x6e54('0x4e')]['id']}},_0x197be6={};_0x197be6[_0x6e54('0x37')]=_[_0x6e54('0x39')](db[_0x6e54('0x34')]['rawAttributes']);_0x197be6[_0x6e54('0x3a')]=_[_0x6e54('0x39')](_0x49dee5[_0x6e54('0x3a')]);_0x197be6[_0x6e54('0x3b')]=_[_0x6e54('0x3c')](_0x197be6[_0x6e54('0x37')],_0x197be6['query']);_0x302bd1['attributes']=_['intersection'](_0x197be6[_0x6e54('0x37')],qs[_0x6e54('0x3d')](_0x49dee5[_0x6e54('0x3a')][_0x6e54('0x3d')]));_0x302bd1[_0x6e54('0x3e')]=_0x302bd1[_0x6e54('0x3e')]['length']?_0x302bd1[_0x6e54('0x3e')]:_0x197be6['model'];if(_0x49dee5[_0x6e54('0x3a')][_0x6e54('0x4f')]){_0x302bd1[_0x6e54('0x4a')]=[{'all':!![]}];}_0x302bd1=_[_0x6e54('0x47')]({},_0x302bd1,_0x49dee5[_0x6e54('0x49')]);return db['ChatInternalMessage']['find'](_0x302bd1)[_0x6e54('0x2f')](handleEntityNotFound(_0x4eafb0,null))[_0x6e54('0x2f')](respondWithResult(_0x4eafb0,null))[_0x6e54('0x4c')](handleError(_0x4eafb0,null));};exports[_0x6e54('0x50')]=function(_0x119f18,_0x115b74){return db[_0x6e54('0x34')][_0x6e54('0x50')](_0x119f18[_0x6e54('0x51')],{})[_0x6e54('0x2f')](respondWithResult(_0x115b74,0xc9))[_0x6e54('0x4c')](handleError(_0x115b74,null));};exports['update']=function(_0x1b1e10,_0x54dc5e){if(_0x1b1e10[_0x6e54('0x51')]['id']){delete _0x1b1e10[_0x6e54('0x51')]['id'];}return db[_0x6e54('0x34')][_0x6e54('0x52')]({'where':{'id':_0x1b1e10[_0x6e54('0x4e')]['id']}})[_0x6e54('0x2f')](handleEntityNotFound(_0x54dc5e,null))[_0x6e54('0x2f')](saveUpdates(_0x1b1e10['body'],null))[_0x6e54('0x2f')](respondWithResult(_0x54dc5e,null))[_0x6e54('0x4c')](handleError(_0x54dc5e,null));};exports[_0x6e54('0x30')]=function(_0x27bfdd,_0x51994e){return db[_0x6e54('0x34')]['find']({'where':{'id':_0x27bfdd['params']['id']}})[_0x6e54('0x2f')](handleEntityNotFound(_0x51994e,null))[_0x6e54('0x2f')](removeEntity(_0x51994e,null))['catch'](handleError(_0x51994e,null));};exports[_0x6e54('0x53')]=function(_0x54788b,_0xec338){return db[_0x6e54('0x34')][_0x6e54('0x53')]()[_0x6e54('0x2f')](respondWithResult(_0xec338,null))[_0x6e54('0x4c')](handleError(_0xec338,null));};function wrapUser(_0x11966d){return function(_0xbc40e4){var _0x53163d=_0x11966d[_0x6e54('0x54')]({'plain':!![]});_0x53163d['messages']=[];if(_0xbc40e4){_0x53163d[_0x6e54('0x55')]=_0xbc40e4[_0x6e54('0x56')];_0x53163d[_0x6e54('0x57')]=_0xbc40e4;}else{_0x53163d[_0x6e54('0x55')]=moment(0x0)[_0x6e54('0x58')](_0x6e54('0x59'));_0x53163d['lastMessage']={};}return _0x53163d;};}exports[_0x6e54('0x5a')]=function(_0x5ea2aa,_0x3bf801,_0x2a5f19){var _0x4b8ef2=[];return db[_0x6e54('0x5b')][_0x6e54('0x5c')]({'where':{'role':['agent','admin',_0x6e54('0x5d')]},'attributes':['id',_0x6e54('0x5e'),_0x6e54('0x31'),_0x6e54('0x5f'),_0x6e54('0x60'),'internal','online',_0x6e54('0x61'),'allowmessenger',_0x6e54('0x62')],'order':qs[_0x6e54('0x43')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x6e54('0x31'),_0x6e54('0x36')],'through':{'attributes':[]}}]})[_0x6e54('0x2f')](function(_0x5d98ac){if(_0x5d98ac){var _0xa2d337=_0x5ea2aa[_0x6e54('0x5d')][_0x6e54('0x54')]({'plain':!![]});if(!_0xa2d337)throw new Error(_0x6e54('0x63'));if(_0xa2d337[_0x6e54('0x5f')]===_0x6e54('0x5d')){return db[_0x6e54('0x64')][_0x6e54('0x52')]({'where':{'name':'Agents','userProfileId':_0xa2d337[_0x6e54('0x65')]},'raw':!![]})[_0x6e54('0x2f')](function(_0x2a3219){if(_0x2a3219){if(_0x2a3219['autoAssociation']===0x0){return db[_0x6e54('0x66')][_0x6e54('0x5c')]({'where':{'sectionId':_0x2a3219['id']},'raw':!![]})[_0x6e54('0x2f')](function(_0x3fc43e){var _0x519c00=[];if(_[_0x6e54('0x67')](_0x3fc43e)){_0x519c00=_[_0x6e54('0x46')](_0x5d98ac,function(_0x9b97cd){if(_0x9b97cd[_0x6e54('0x5f')]!=='agent'){return _0x9b97cd;}});return _0x519c00;}else{for(var _0xffcee=0x0;_0xffcee<_0x5d98ac[_0x6e54('0x3f')];_0xffcee++){var _0x246d99=_0x5d98ac[_0xffcee];if(_0x246d99[_0x6e54('0x5f')]===_0x6e54('0x68')){var _0x16e683=_[_0x6e54('0x52')](_0x3fc43e,function(_0x405ac4){return _0x405ac4[_0x6e54('0x69')]===_0x246d99['id'];});if(_0x16e683)_0x519c00[_0x6e54('0x6a')](_0x246d99);}else{_0x519c00['push'](_0x246d99);}}return _0x519c00;}});}else{return _0x5d98ac;}}else{var _0x1c08c7=_[_0x6e54('0x46')](_0x5d98ac,function(_0x113805){if(_0x113805[_0x6e54('0x5f')]!==_0x6e54('0x68')){return _0x113805;}});return _0x1c08c7;}});}else{return _0x5d98ac;}}})['then'](function(_0x3fc411){var _0x2f8d6d=[];if(_0x3fc411){_0x4b8ef2=_0x3fc411;for(var _0x3d83bc=0x0;_0x3d83bc<_0x3fc411[_0x6e54('0x3f')];_0x3d83bc+=0x1){_0x4b8ef2[_0x3d83bc][_0x6e54('0x6b')]=[];_0x2f8d6d[_0x6e54('0x6a')](db[_0x6e54('0x34')][_0x6e54('0x52')]({'where':{'FromId':[_0x5ea2aa[_0x6e54('0x5d')]['id'],_0x3fc411[_0x3d83bc]['id']],'ToId':[_0x5ea2aa[_0x6e54('0x5d')]['id'],_0x3fc411[_0x3d83bc]['id']],'ChatGroupId':null},'attributes':['id',_0x6e54('0x56'),_0x6e54('0x6c'),_0x6e54('0x6d'),'read',_0x6e54('0x51')],'order':qs[_0x6e54('0x43')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3fc411[_0x3d83bc])));}return BPromise[_0x6e54('0x6e')](_0x2f8d6d);}return[];})[_0x6e54('0x2f')](function(_0x16864d){return{'rows':_0x16864d,'count':_0x16864d['length']};})[_0x6e54('0x2f')](respondWithResult(_0x3bf801,null))['catch'](handleError(_0x3bf801,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1f99e43..cb45c9d 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 _0xe3c2=['hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','emit'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xe3c2,0x19a));var _0x2e3c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe3c2[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x2e3c('0x0'));var ChatInternalMessage=require(_0x2e3c('0x1'))['db'][_0x2e3c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e3c('0x3'),'afterUpdate':_0x2e3c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x136e30){return function(_0x472376,_0x4ce03d,_0x255125){ChatInternalMessageEvents[_0x2e3c('0x5')](_0x136e30+':'+_0x472376['id'],_0x472376);ChatInternalMessageEvents[_0x2e3c('0x5')](_0x136e30,_0x472376);_0x255125(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x2e3c('0x6')](e,emitEvent(event));}}module[_0x2e3c('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1691=['save','update','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x55a1cc,_0x2d72ec){var _0x44b08e=function(_0x3a1f66){while(--_0x3a1f66){_0x55a1cc['push'](_0x55a1cc['shift']());}};_0x44b08e(++_0x2d72ec);}(_0x1691,0x1ed));var _0x1169=function(_0x307c66,_0x4beee3){_0x307c66=_0x307c66-0x0;var _0x1d9cc2=_0x1691[_0x307c66];return _0x1d9cc2;};'use strict';var EventEmitter=require(_0x1169('0x0'));var ChatInternalMessage=require(_0x1169('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1169('0x2')](0x0);var events={'afterCreate':_0x1169('0x3'),'afterUpdate':_0x1169('0x4'),'afterDestroy':_0x1169('0x5')};function emitEvent(_0x3f3684){return function(_0xe879ee,_0x28e2df,_0x304321){ChatInternalMessageEvents['emit'](_0x3f3684+':'+_0xe879ee['id'],_0xe879ee);ChatInternalMessageEvents[_0x1169('0x6')](_0x3f3684,_0xe879ee);_0x304321(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x1169('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f425fa8..0178501 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 _0x5910=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b8347,_0x14e3f2){var _0x15e93e=function(_0x2b046b){while(--_0x2b046b){_0x2b8347['push'](_0x2b8347['shift']());}};_0x15e93e(++_0x14e3f2);}(_0x5910,0x1a0));var _0x0591=function(_0x52dd18,_0x3ce595){_0x52dd18=_0x52dd18-0x0;var _0x1965b5=_0x5910[_0x52dd18];return _0x1965b5;};'use strict';var _=require(_0x0591('0x0'));var util=require(_0x0591('0x1'));var logger=require(_0x0591('0x2'))(_0x0591('0x3'));var moment=require(_0x0591('0x4'));var BPromise=require(_0x0591('0x5'));var rp=require(_0x0591('0x6'));var fs=require('fs');var path=require(_0x0591('0x7'));var rimraf=require(_0x0591('0x8'));var config=require(_0x0591('0x9'));var attributes=require(_0x0591('0xa'));module[_0x0591('0xb')]=function(_0x22a6a4,_0x246a2b){return _0x22a6a4[_0x0591('0xc')](_0x0591('0xd'),attributes,{'tableName':_0x0591('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0591('0xf'),'collate':_0x0591('0x10')});}; \ No newline at end of file +var _0xaf8e=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0xaf8e,0x95));var _0xeaf8=function(_0x979991,_0x2001a6){_0x979991=_0x979991-0x0;var _0x6694a2=_0xaf8e[_0x979991];return _0x6694a2;};'use strict';var _=require(_0xeaf8('0x0'));var util=require(_0xeaf8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeaf8('0x2'));var BPromise=require(_0xeaf8('0x3'));var rp=require(_0xeaf8('0x4'));var fs=require('fs');var path=require(_0xeaf8('0x5'));var rimraf=require(_0xeaf8('0x6'));var config=require(_0xeaf8('0x7'));var attributes=require(_0xeaf8('0x8'));module[_0xeaf8('0x9')]=function(_0x48ca7d,_0x458987){return _0x48ca7d[_0xeaf8('0xa')](_0xeaf8('0xb'),attributes,{'tableName':_0xeaf8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xeaf8('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 41784fa..6eacff5 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 _0x6c09=['then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request'];(function(_0x3df3c6,_0x496e1a){var _0x254c43=function(_0x371daa){while(--_0x371daa){_0x3df3c6['push'](_0x3df3c6['shift']());}};_0x254c43(++_0x496e1a);}(_0x6c09,0x110));var _0x96c0=function(_0xaf5789,_0x20f683){_0xaf5789=_0xaf5789-0x0;var _0x15d225=_0x6c09[_0xaf5789];return _0x15d225;};'use strict';var _=require(_0x96c0('0x0'));var util=require(_0x96c0('0x1'));var moment=require(_0x96c0('0x2'));var BPromise=require(_0x96c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x96c0('0x5'));var config=require(_0x96c0('0x6'));var jayson=require(_0x96c0('0x7'));var client=jayson[_0x96c0('0x8')][_0x96c0('0x9')]({'port':0x232a});config[_0x96c0('0xa')]=_[_0x96c0('0xb')](config[_0x96c0('0xa')],{'host':_0x96c0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96c0('0xa')]));require(_0x96c0('0xd'))[_0x96c0('0xe')](socket);function respondWithRpcPromise(_0x5b779b,_0x257c30,_0x304a3a){return new BPromise(function(_0x1c9d9c,_0x37afa2){return client[_0x96c0('0xf')](_0x5b779b,_0x304a3a)[_0x96c0('0x10')](function(_0x353dc7){logger[_0x96c0('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x257c30,_0x96c0('0x12'));logger['debug'](_0x96c0('0x13'),_0x257c30,_0x96c0('0x12'),JSON['stringify'](_0x353dc7));if(_0x353dc7['error']){if(_0x353dc7['error']['code']===0x1f4){logger['error'](_0x96c0('0x14'),_0x257c30,_0x353dc7[_0x96c0('0x15')][_0x96c0('0x16')]);return _0x37afa2(_0x353dc7['error'][_0x96c0('0x16')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x257c30,_0x353dc7[_0x96c0('0x15')][_0x96c0('0x16')]);return _0x1c9d9c(_0x353dc7[_0x96c0('0x15')][_0x96c0('0x16')]);}else{logger[_0x96c0('0x11')](_0x96c0('0x14'),_0x257c30,_0x96c0('0x12'));_0x1c9d9c(_0x353dc7['result']['message']);}})[_0x96c0('0x17')](function(_0x1b85d0){logger[_0x96c0('0x15')](_0x96c0('0x14'),_0x257c30,_0x1b85d0);_0x37afa2(_0x1b85d0);});});} \ No newline at end of file +var _0x3e42=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c9add,_0x37051f){var _0x5c55e1=function(_0x545185){while(--_0x545185){_0x5c9add['push'](_0x5c9add['shift']());}};_0x5c55e1(++_0x37051f);}(_0x3e42,0xf5));var _0x23e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e42[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23e4('0x0'));var util=require('util');var moment=require(_0x23e4('0x1'));var BPromise=require(_0x23e4('0x2'));var rs=require(_0x23e4('0x3'));var fs=require('fs');var Redis=require(_0x23e4('0x4'));var db=require(_0x23e4('0x5'))['db'];var utils=require(_0x23e4('0x6'));var logger=require(_0x23e4('0x7'))(_0x23e4('0x8'));var config=require(_0x23e4('0x9'));var jayson=require(_0x23e4('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x23e4('0xb')]=_[_0x23e4('0xc')](config[_0x23e4('0xb')],{'host':_0x23e4('0xd'),'port':0x18eb});var socket=require(_0x23e4('0xe'))(new Redis(config['redis']));require(_0x23e4('0xf'))['register'](socket);function respondWithRpcPromise(_0x300dc7,_0xd8dd68,_0x348b27){return new BPromise(function(_0x25a996,_0x3663c4){return client[_0x23e4('0x10')](_0x300dc7,_0x348b27)[_0x23e4('0x11')](function(_0x31f0fb){logger[_0x23e4('0x12')](_0x23e4('0x13'),_0xd8dd68,_0x23e4('0x14'));logger[_0x23e4('0x15')](_0x23e4('0x16'),_0xd8dd68,_0x23e4('0x14'),JSON[_0x23e4('0x17')](_0x31f0fb));if(_0x31f0fb[_0x23e4('0x18')]){if(_0x31f0fb['error'][_0x23e4('0x19')]===0x1f4){logger['error'](_0x23e4('0x13'),_0xd8dd68,_0x31f0fb[_0x23e4('0x18')][_0x23e4('0x1a')]);return _0x3663c4(_0x31f0fb['error'][_0x23e4('0x1a')]);}logger[_0x23e4('0x18')](_0x23e4('0x13'),_0xd8dd68,_0x31f0fb[_0x23e4('0x18')][_0x23e4('0x1a')]);return _0x25a996(_0x31f0fb['error']['message']);}else{logger['info'](_0x23e4('0x13'),_0xd8dd68,_0x23e4('0x14'));_0x25a996(_0x31f0fb['result'][_0x23e4('0x1a')]);}})[_0x23e4('0x1b')](function(_0x1d52be){logger[_0x23e4('0x18')](_0x23e4('0x13'),_0xd8dd68,_0x1d52be);_0x3663c4(_0x1d52be);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f0687cd..3f5188b 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 _0x94f9=['length','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x94f9,0x151));var _0x994f=function(_0x9a2618,_0x7fd0c6){_0x9a2618=_0x9a2618-0x0;var _0x44d3a3=_0x94f9[_0x9a2618];return _0x44d3a3;};'use strict';var ChatInternalMessageEvents=require(_0x994f('0x0'));var events=[_0x994f('0x1'),_0x994f('0x2'),_0x994f('0x3')];function createListener(_0x4cd291,_0x819253){return function(_0x1308cf){_0x819253[_0x994f('0x4')](_0x4cd291,_0x1308cf);};}function removeListener(_0x471ee2,_0x47a53b){return function(){ChatInternalMessageEvents[_0x994f('0x5')](_0x471ee2,_0x47a53b);};}exports['register']=function(_0x3ea744){for(var _0x390c6c=0x0,_0x4eaf42=events[_0x994f('0x6')];_0x390c6c<_0x4eaf42;_0x390c6c++){var _0x30ed61=events[_0x390c6c];var _0x55db4f=createListener('chatInternalMessage:'+_0x30ed61,_0x3ea744);ChatInternalMessageEvents['on'](_0x30ed61,_0x55db4f);}}; \ No newline at end of file +var _0xae5b=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','removeListener'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0xae5b,0x195));var _0xbae5=function(_0x110e3e,_0x4185cb){_0x110e3e=_0x110e3e-0x0;var _0xa96cae=_0xae5b[_0x110e3e];return _0xa96cae;};'use strict';var ChatInternalMessageEvents=require(_0xbae5('0x0'));var events=[_0xbae5('0x1'),'remove','update'];function createListener(_0x3ac4b1,_0x15b346){return function(_0x53e33e){_0x15b346['emit'](_0x3ac4b1,_0x53e33e);};}function removeListener(_0x2f02a3,_0x46be6b){return function(){ChatInternalMessageEvents[_0xbae5('0x2')](_0x2f02a3,_0x46be6b);};}exports[_0xbae5('0x3')]=function(_0x20b089){for(var _0x395c1f=0x0,_0xc14b7e=events[_0xbae5('0x4')];_0x395c1f<_0xc14b7e;_0x395c1f++){var _0x91e15e=events[_0x395c1f];var _0x86a767=createListener(_0xbae5('0x5')+_0x91e15e,_0x20b089);ChatInternalMessageEvents['on'](_0x91e15e,_0x86a767);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index de98b80..fc69363 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 _0xe343=['delete','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','getUsers','/:id','post','put'];(function(_0x2e1c10,_0x40d1ae){var _0x584e71=function(_0x49d74e){while(--_0x49d74e){_0x2e1c10['push'](_0x2e1c10['shift']());}};_0x584e71(++_0x40d1ae);}(_0xe343,0x6e));var _0x3e34=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0xe343[_0x3dc089];return _0x34d9d3;};'use strict';var multer=require(_0x3e34('0x0'));var util=require(_0x3e34('0x1'));var path=require(_0x3e34('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e34('0x3'));var router=express[_0x3e34('0x4')]();var fs_extra=require(_0x3e34('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e34('0x6'));var controller=require(_0x3e34('0x7'));router[_0x3e34('0x8')]('/',auth[_0x3e34('0x9')](),controller[_0x3e34('0xa')]);router[_0x3e34('0x8')]('/describe',auth[_0x3e34('0x9')](),controller[_0x3e34('0xb')]);router[_0x3e34('0x8')]('/users',auth[_0x3e34('0x9')](),controller[_0x3e34('0xc')]);router[_0x3e34('0x8')](_0x3e34('0xd'),auth[_0x3e34('0x9')](),controller['show']);router[_0x3e34('0xe')]('/',auth[_0x3e34('0x9')](),controller['create']);router[_0x3e34('0xf')](_0x3e34('0xd'),controller['update']);router[_0x3e34('0x10')](_0x3e34('0xd'),auth['isAuthenticated'](),controller[_0x3e34('0x11')]);module['exports']=router; \ No newline at end of file +var _0x371a=['../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','/:id','show','post','create','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13c947,_0x1db8b8){var _0x57792a=function(_0x3d24c0){while(--_0x3d24c0){_0x13c947['push'](_0x13c947['shift']());}};_0x57792a(++_0x1db8b8);}(_0x371a,0x12c));var _0xa371=function(_0x5db9db,_0x85c0a6){_0x5db9db=_0x5db9db-0x0;var _0x3356aa=_0x371a[_0x5db9db];return _0x3356aa;};'use strict';var multer=require(_0xa371('0x0'));var util=require(_0xa371('0x1'));var path=require(_0xa371('0x2'));var timeout=require('connect-timeout');var express=require(_0xa371('0x3'));var router=express[_0xa371('0x4')]();var fs_extra=require(_0xa371('0x5'));var auth=require(_0xa371('0x6'));var interaction=require(_0xa371('0x7'));var config=require(_0xa371('0x8'));var controller=require(_0xa371('0x9'));router[_0xa371('0xa')]('/',auth[_0xa371('0xb')](),controller[_0xa371('0xc')]);router[_0xa371('0xa')](_0xa371('0xd'),auth[_0xa371('0xb')](),controller[_0xa371('0xe')]);router[_0xa371('0xa')](_0xa371('0xf'),auth['isAuthenticated'](),controller['getUsers']);router['get'](_0xa371('0x10'),auth['isAuthenticated'](),controller[_0xa371('0x11')]);router[_0xa371('0x12')]('/',auth[_0xa371('0xb')](),controller[_0xa371('0x13')]);router['put'](_0xa371('0x10'),controller['update']);router['delete'](_0xa371('0x10'),auth[_0xa371('0xb')](),controller[_0xa371('0x14')]);module[_0xa371('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7b29709..266a183 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 _0x7462=['out','STRING','TEXT','sequelize','exports','BOOLEAN'];(function(_0x419395,_0x1cef6f){var _0x929746=function(_0x3c591f){while(--_0x3c591f){_0x419395['push'](_0x419395['shift']());}};_0x929746(++_0x1cef6f);}(_0x7462,0x165));var _0x2746=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x7462[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x2746('0x0'));module[_0x2746('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2746('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2746('0x3')),'defaultValue':_0x2746('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x2746('0x4')]},'providerResponse':{'type':Sequelize[_0x2746('0x5')]}}; \ No newline at end of file +var _0xe1e3=['DATE','STRING','TEXT','sequelize','exports','medium','ENUM','out'];(function(_0x542eed,_0xee71f8){var _0x1f9e3f=function(_0x34f523){while(--_0x34f523){_0x542eed['push'](_0x542eed['shift']());}};_0x1f9e3f(++_0xee71f8);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x523f37,_0x587f44){_0x523f37=_0x523f37-0x0;var _0x24d275=_0xe1e3[_0x523f37];return _0x24d275;};'use strict';var Sequelize=require(_0x3e1e('0x0'));module[_0x3e1e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3e1e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3e1e('0x3')]('in','out'),'defaultValue':_0x3e1e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3e1e('0x5')]},'providerName':{'type':Sequelize[_0x3e1e('0x6')]},'providerResponse':{'type':Sequelize[_0x3e1e('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b87619c..57ce054 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 _0x86f3=['send','map','ChatMessage','fieldName','type','key','query','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','rawAttributes','fields','find','create','body','update','describe','chat-interactions','chat','read','format','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','manual','interface','channel','motionChannel','accept','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SIP/%s','event','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','name'];(function(_0x40d4ea,_0x5e7cb7){var _0x2ebf50=function(_0x58445b){while(--_0x58445b){_0x40d4ea['push'](_0x40d4ea['shift']());}};_0x2ebf50(++_0x5e7cb7);}(_0x86f3,0x1c6));var _0x386f=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x86f3[_0x1477ef];return _0x164acd;};'use strict';var emlformat=require(_0x386f('0x0'));var rimraf=require(_0x386f('0x1'));var zipdir=require(_0x386f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x386f('0x3'));var moment=require('moment');var BPromise=require(_0x386f('0x4'));var Mustache=require('mustache');var util=require(_0x386f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x386f('0x6'));var ejs=require(_0x386f('0x7'));var fs=require('fs');var fs_extra=require(_0x386f('0x8'));var _=require('lodash');var squel=require(_0x386f('0x9'));var crypto=require(_0x386f('0xa'));var jsforce=require(_0x386f('0xb'));var deskjs=require(_0x386f('0xc'));var toCsv=require(_0x386f('0x6'));var querystring=require(_0x386f('0xd'));var Papa=require(_0x386f('0xe'));var Redis=require(_0x386f('0xf'));var authService=require(_0x386f('0x10'));var qs=require(_0x386f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x386f('0x12'));var logger=require(_0x386f('0x13'))(_0x386f('0x14'));var utils=require(_0x386f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x386f('0x16'));var db=require(_0x386f('0x17'))['db'];config[_0x386f('0x18')]=_[_0x386f('0x19')](config[_0x386f('0x18')],{'host':_0x386f('0x1a'),'port':0x18eb});var socket=require(_0x386f('0x1b'))(new Redis(config[_0x386f('0x18')]));require(_0x386f('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x386f('0x1d')][_0x386f('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x386f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x54a5c3,_0x333973,_0x2e0c46,_0x59004d){return new BPromise(function(_0x1f0290,_0x427321){var _0x1b96f3=_0x59004d||client;return _0x1b96f3['request'](_0x54a5c3,_0x2e0c46)[_0x386f('0x1f')](function(_0x390a4a){logger[_0x386f('0x20')](_0x386f('0x21'),_0x333973,'request\x20sent');logger[_0x386f('0x22')](_0x386f('0x23'),_0x333973,'request\x20sent',JSON['stringify'](_0x390a4a));if(_0x390a4a[_0x386f('0x24')]){if(_0x390a4a[_0x386f('0x24')][_0x386f('0x25')]===0x1f4){logger['error'](_0x386f('0x21'),_0x333973,_0x390a4a[_0x386f('0x24')]['message']);return _0x427321(_0x390a4a['error']['message']);}logger[_0x386f('0x24')](_0x386f('0x21'),_0x333973,_0x390a4a[_0x386f('0x24')][_0x386f('0x26')]);return _0x1f0290(_0x390a4a['error'][_0x386f('0x26')]);}else{logger[_0x386f('0x20')]('ChatMessage,\x20%s,\x20%s',_0x333973,'request\x20sent');_0x1f0290(_0x390a4a[_0x386f('0x27')][_0x386f('0x26')]);}})[_0x386f('0x28')](function(_0x233f2b){logger[_0x386f('0x24')](_0x386f('0x21'),_0x333973,_0x233f2b);_0x427321(_0x233f2b);});});}function respondWithStatusCode(_0xb78de8,_0x3a2a9f){_0x3a2a9f=_0x3a2a9f||0xcc;return function(_0x301430){if(_0x301430){return _0xb78de8[_0x386f('0x29')](_0x3a2a9f);}return _0xb78de8[_0x386f('0x2a')](_0x3a2a9f)[_0x386f('0x2b')]();};}function respondWithResult(_0x487040,_0x425e14){_0x425e14=_0x425e14||0xc8;return function(_0x375bd2){if(_0x375bd2){return _0x487040['status'](_0x425e14)[_0x386f('0x2c')](_0x375bd2);}};}function respondWithFilteredResult(_0x506101,_0x30aa7e){return function(_0x469cbc){if(_0x469cbc){var _0xd91365=typeof _0x30aa7e[_0x386f('0x2d')]===_0x386f('0x2e')&&typeof _0x30aa7e[_0x386f('0x2f')]===_0x386f('0x2e');var _0x43ae60=_0x469cbc[_0x386f('0x30')];var _0x59a360=_0xd91365?0x0:_0x30aa7e[_0x386f('0x2d')];var _0x374c5a=_0xd91365?_0x469cbc[_0x386f('0x30')]:_0x30aa7e[_0x386f('0x2d')]+_0x30aa7e[_0x386f('0x2f')];var _0x37f38c;if(_0x374c5a>=_0x43ae60){_0x374c5a=_0x43ae60;_0x37f38c=0xc8;}else{_0x37f38c=0xce;}_0x506101[_0x386f('0x2a')](_0x37f38c);return _0x506101['set'](_0x386f('0x31'),_0x59a360+'-'+_0x374c5a+'/'+_0x43ae60)[_0x386f('0x2c')](_0x469cbc);}return null;};}function patchUpdates(_0x22559b){return function(_0x3d47d2){try{jsonpatch[_0x386f('0x32')](_0x3d47d2,_0x22559b,!![]);}catch(_0x21a784){return BPromise['reject'](_0x21a784);}return _0x3d47d2[_0x386f('0x33')]();};}function saveUpdates(_0x3a8435,_0x1252e5){return function(_0x1ef879){if(_0x1ef879){return _0x1ef879['update'](_0x3a8435)[_0x386f('0x1f')](function(_0x50fa9f){return _0x50fa9f;});}return null;};}function removeEntity(_0x510ac1,_0x2307d3){return function(_0xbafd0e){if(_0xbafd0e){return _0xbafd0e[_0x386f('0x34')]()[_0x386f('0x1f')](function(){_0x510ac1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dbc75,_0x8ec816){return function(_0x3bff28){if(!_0x3bff28){_0x4dbc75[_0x386f('0x29')](0x194);}return _0x3bff28;};}function handleError(_0x590579,_0x489fd3){_0x489fd3=_0x489fd3||0x1f4;return function(_0x14fad6){logger[_0x386f('0x24')](_0x14fad6['stack']);if(_0x14fad6[_0x386f('0x35')]){delete _0x14fad6[_0x386f('0x35')];}_0x590579['status'](_0x489fd3)[_0x386f('0x36')](_0x14fad6);};}exports['index']=function(_0x3a4266,_0xfd9f1d){var _0x5aed4b={},_0x45ad7f={},_0x1db770={'count':0x0,'rows':[]};var _0x33c765=_[_0x386f('0x37')](db[_0x386f('0x38')]['rawAttributes'],function(_0x2a2cfe){return{'name':_0x2a2cfe[_0x386f('0x39')],'type':_0x2a2cfe[_0x386f('0x3a')][_0x386f('0x3b')]};});_0x45ad7f['model']=_[_0x386f('0x37')](_0x33c765,_0x386f('0x35'));_0x45ad7f[_0x386f('0x3c')]=_['keys'](_0x3a4266[_0x386f('0x3c')]);_0x45ad7f['filters']=_[_0x386f('0x3d')](_0x45ad7f[_0x386f('0x3e')],_0x45ad7f[_0x386f('0x3c')]);_0x5aed4b[_0x386f('0x3f')]=_['intersection'](_0x45ad7f[_0x386f('0x3e')],qs['fields'](_0x3a4266['query']['fields']));_0x5aed4b[_0x386f('0x3f')]=_0x5aed4b['attributes'][_0x386f('0x40')]?_0x5aed4b[_0x386f('0x3f')]:_0x45ad7f[_0x386f('0x3e')];if(!_0x3a4266[_0x386f('0x3c')][_0x386f('0x41')]('nolimit')){_0x5aed4b[_0x386f('0x2f')]=qs[_0x386f('0x2f')](_0x3a4266[_0x386f('0x3c')][_0x386f('0x2f')]);_0x5aed4b['offset']=qs[_0x386f('0x2d')](_0x3a4266[_0x386f('0x3c')][_0x386f('0x2d')]);}_0x5aed4b[_0x386f('0x42')]=qs['sort'](_0x3a4266[_0x386f('0x3c')][_0x386f('0x43')]);_0x5aed4b[_0x386f('0x44')]=qs[_0x386f('0x45')](_[_0x386f('0x46')](_0x3a4266[_0x386f('0x3c')],_0x45ad7f[_0x386f('0x45')]),_0x33c765);if(_0x3a4266['query']['filter']){_0x5aed4b['where']=_[_0x386f('0x47')](_0x5aed4b[_0x386f('0x44')],{'$or':_[_0x386f('0x37')](_0x33c765,function(_0x4da564){if(_0x4da564[_0x386f('0x3a')]!==_0x386f('0x48')){var _0x5b1d04={};_0x5b1d04[_0x4da564[_0x386f('0x35')]]={'$like':'%'+_0x3a4266[_0x386f('0x3c')][_0x386f('0x49')]+'%'};return _0x5b1d04;}})});}_0x5aed4b=_[_0x386f('0x47')]({},_0x5aed4b,_0x3a4266['options']);var _0x40d1d5={'where':_0x5aed4b['where']};return db['ChatMessage']['count'](_0x40d1d5)[_0x386f('0x1f')](function(_0x5e666f){_0x1db770[_0x386f('0x30')]=_0x5e666f;if(_0x3a4266[_0x386f('0x3c')][_0x386f('0x4a')]){_0x5aed4b[_0x386f('0x4b')]=[{'all':!![]}];}return db[_0x386f('0x38')][_0x386f('0x4c')](_0x5aed4b);})[_0x386f('0x1f')](function(_0x3f5c77){_0x1db770[_0x386f('0x4d')]=_0x3f5c77;return _0x1db770;})[_0x386f('0x1f')](respondWithFilteredResult(_0xfd9f1d,_0x5aed4b))[_0x386f('0x28')](handleError(_0xfd9f1d,null));};exports[_0x386f('0x4e')]=function(_0x34cd72,_0x82b6b6){var _0x66a769={'raw':!![],'where':{'id':_0x34cd72[_0x386f('0x4f')]['id']}},_0x602de1={};_0x602de1[_0x386f('0x3e')]=_[_0x386f('0x50')](db['ChatMessage'][_0x386f('0x51')]);_0x602de1[_0x386f('0x3c')]=_[_0x386f('0x50')](_0x34cd72[_0x386f('0x3c')]);_0x602de1[_0x386f('0x45')]=_[_0x386f('0x3d')](_0x602de1[_0x386f('0x3e')],_0x602de1['query']);_0x66a769[_0x386f('0x3f')]=_[_0x386f('0x3d')](_0x602de1['model'],qs[_0x386f('0x52')](_0x34cd72['query']['fields']));_0x66a769['attributes']=_0x66a769[_0x386f('0x3f')]['length']?_0x66a769[_0x386f('0x3f')]:_0x602de1[_0x386f('0x3e')];if(_0x34cd72[_0x386f('0x3c')][_0x386f('0x4a')]){_0x66a769['include']=[{'all':!![]}];}_0x66a769=_[_0x386f('0x47')]({},_0x66a769,_0x34cd72['options']);return db['ChatMessage'][_0x386f('0x53')](_0x66a769)[_0x386f('0x1f')](handleEntityNotFound(_0x82b6b6,null))['then'](respondWithResult(_0x82b6b6,null))[_0x386f('0x28')](handleError(_0x82b6b6,null));};exports['create']=function(_0x311f4e,_0x4c5663){return db['ChatMessage'][_0x386f('0x54')](_0x311f4e[_0x386f('0x55')],{})[_0x386f('0x1f')](respondWithResult(_0x4c5663,0xc9))[_0x386f('0x28')](handleError(_0x4c5663,null));};exports[_0x386f('0x56')]=function(_0x5c18da,_0x538530){if(_0x5c18da[_0x386f('0x55')]['id']){delete _0x5c18da[_0x386f('0x55')]['id'];}return db[_0x386f('0x38')][_0x386f('0x53')]({'where':{'id':_0x5c18da['params']['id']}})[_0x386f('0x1f')](handleEntityNotFound(_0x538530,null))[_0x386f('0x1f')](saveUpdates(_0x5c18da[_0x386f('0x55')],null))[_0x386f('0x1f')](respondWithResult(_0x538530,null))[_0x386f('0x28')](handleError(_0x538530,null));};exports[_0x386f('0x34')]=function(_0x5ebdc1,_0x1e9f66){return db[_0x386f('0x38')]['find']({'where':{'id':_0x5ebdc1[_0x386f('0x4f')]['id']}})[_0x386f('0x1f')](handleEntityNotFound(_0x1e9f66,null))[_0x386f('0x1f')](removeEntity(_0x1e9f66,null))[_0x386f('0x28')](handleError(_0x1e9f66,null));};exports['describe']=function(_0x16dbd2,_0x4df0d7){return db[_0x386f('0x38')][_0x386f('0x57')]()[_0x386f('0x1f')](respondWithResult(_0x4df0d7,null))[_0x386f('0x28')](handleError(_0x4df0d7,null));};var interaction_log=require(_0x386f('0x13'))(_0x386f('0x58'));exports['accept']=function(_0x323534,_0x1df18a,_0x38e2da){var _0x246b18={'agent':{},'channel':_0x386f('0x59')};if(_0x323534['body']['id']){delete _0x323534[_0x386f('0x55')]['id'];}_0x323534['body'][_0x386f('0x5a')]=!![];_0x323534[_0x386f('0x55')]['readAt']=moment()[_0x386f('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x323534[_0x386f('0x55')]['UserId']=_0x323534[_0x386f('0x55')][_0x386f('0x5c')]||_0x323534[_0x386f('0x5d')]['id'];_0x246b18['agent']['id']=_0x323534[_0x386f('0x55')]['UserId'];return db['ChatMessage'][_0x386f('0x53')]({'where':{'id':_0x323534[_0x386f('0x4f')]['id'],'UserId':null}})[_0x386f('0x1f')](handleEntityNotFound(_0x1df18a,null))[_0x386f('0x1f')](saveUpdates(_0x323534[_0x386f('0x55')],null))[_0x386f('0x1f')](function(_0x4a5dca){if(_0x4a5dca){_0x246b18[_0x386f('0x26')]=_0x4a5dca[_0x386f('0x5e')]({'plain':!![]});return db[_0x386f('0x5f')]['find']({'where':{'id':_0x4a5dca[_0x386f('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x1df18a,null))['then'](function(_0x152a4a){if(_0x152a4a){return _0x152a4a['update']({'UserId':_0x323534[_0x386f('0x55')]['UserId'],'read1stAt':_['isNil'](_0x152a4a[_0x386f('0x61')])?moment()[_0x386f('0x5b')](_0x386f('0x62')):undefined});}return null;})[_0x386f('0x1f')](function(_0x5279a8){if(_0x5279a8){_0x246b18[_0x386f('0x63')]=_0x5279a8[_0x386f('0x5e')]({'plain':!![]});interaction_log[_0x386f('0x20')](_0x386f('0x64'),_0x323534['user']['id'],_0x323534[_0x386f('0x5d')][_0x386f('0x35')],_0x323534['user']['role'],_0x246b18[_0x386f('0x63')]['id'],_0x323534[_0x386f('0x55')]?JSON[_0x386f('0x65')](_0x323534[_0x386f('0x55')]):_0x386f('0x66'));return respondWithRpcPromise(_0x386f('0x67'),'acceptMessage',_0x246b18);}return null;})[_0x386f('0x1f')](function(_0x1e5cef){var _0x551d9f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e5cef['message']['ContactId'];return db[_0x386f('0x68')][_0x386f('0x3c')](_0x551d9f,{'type':db[_0x386f('0x69')][_0x386f('0x6a')][_0x386f('0x6b')],'raw':!![]})[_0x386f('0x1f')](function(_0x1ef829){return _0x1ef829;});})[_0x386f('0x1f')](function(_0x34c1f1){if(_0x34c1f1){_0x246b18['message'][_0x386f('0x6c')]=_0x34c1f1[0x0];if(!_0x323534[_0x386f('0x55')][_0x386f('0x5c')])return;return db[_0x386f('0x6d')][_0x386f('0x53')]({'where':{'id':_0x323534['body'][_0x386f('0x5c')],'role':_0x386f('0x6e')},'attributes':['id',_0x386f('0x35'),_0x386f('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x386f('0x1f')](function(_0x443e55){if(!_0x443e55)return null;_0x246b18['message'][_0x386f('0x6e')]=_0x443e55;return _0x246b18;})['then'](function(_0x885743){if(_0x885743){if(_0x323534['body'][_0x386f('0x70')]){_0x246b18[_0x386f('0x26')][_0x386f('0x71')]=util[_0x386f('0x5b')]('SIP/%s',_0x323534[_0x386f('0x5d')]['name']);_0x246b18[_0x386f('0x26')][_0x386f('0x72')]=_0x246b18[_0x386f('0x72')];_0x246b18[_0x386f('0x26')][_0x386f('0x73')]=_0x246b18[_0x386f('0x72')];_0x246b18[_0x386f('0x26')]['event']=_0x386f('0x74');return respondWithRpcPromise(_0x386f('0x75'),_0x386f('0x75'),{'event':_0x386f('0x76'),'message':_[_0x386f('0x47')](_0x246b18[_0x386f('0x26')],JSON[_0x386f('0x77')](_0x246b18[_0x386f('0x63')]['formData']))},client9002)[_0x386f('0x1f')](function(){return _0x246b18;});}return _0x246b18;}return null;})[_0x386f('0x1f')](respondWithResult(_0x1df18a,null))[_0x386f('0x28')](handleError(_0x1df18a,null));};var interaction_log=require(_0x386f('0x13'))(_0x386f('0x58'));exports['reject']=function(_0x2d519f,_0x2731ec,_0x32a9ae){var _0x2d4ddd={'agent':{},'channel':_0x386f('0x59')};if(_0x2d519f[_0x386f('0x55')]['id']){delete _0x2d519f[_0x386f('0x55')]['id'];}_0x2d519f['body'][_0x386f('0x5c')]=_0x2d519f[_0x386f('0x55')][_0x386f('0x5c')]||_0x2d519f[_0x386f('0x5d')]['id'];_0x2d4ddd[_0x386f('0x6e')]['id']=_0x2d519f['body']['UserId'];return db[_0x386f('0x38')][_0x386f('0x53')]({'where':{'id':_0x2d519f[_0x386f('0x4f')]['id'],'UserId':null}})[_0x386f('0x1f')](handleEntityNotFound(_0x2731ec,null))[_0x386f('0x1f')](function(_0x57807e){if(_0x57807e){_0x2d4ddd[_0x386f('0x26')]=_0x57807e[_0x386f('0x5e')]({'plain':!![]});return db[_0x386f('0x5f')][_0x386f('0x53')]({'where':{'id':_0x57807e['ChatInteractionId']}});}return null;})[_0x386f('0x1f')](handleEntityNotFound(_0x2731ec,null))[_0x386f('0x1f')](function(_0x6f61c8){if(_0x6f61c8){_0x2d4ddd['interaction']=_0x6f61c8[_0x386f('0x5e')]({'plain':!![]});interaction_log[_0x386f('0x20')](_0x386f('0x78'),_0x2d519f[_0x386f('0x5d')]['id'],_0x2d519f[_0x386f('0x5d')]['name'],_0x2d519f[_0x386f('0x5d')]['role'],_0x2d4ddd[_0x386f('0x63')]['id'],_0x2d519f[_0x386f('0x55')]?JSON['stringify'](_0x2d519f['body']):_0x386f('0x66'));return respondWithRpcPromise(_0x386f('0x79'),_0x386f('0x7a'),_0x2d4ddd);}return null;})[_0x386f('0x1f')](function(_0x592c2f){var _0x426082=_0x386f('0x7b')+_0x592c2f['message'][_0x386f('0x7c')];return db[_0x386f('0x68')][_0x386f('0x3c')](_0x426082,{'type':db[_0x386f('0x69')][_0x386f('0x6a')]['SELECT'],'raw':!![]})[_0x386f('0x1f')](function(_0x40df78){return _0x40df78;});})[_0x386f('0x1f')](function(_0x5097ee){if(_0x5097ee){_0x2d4ddd[_0x386f('0x26')][_0x386f('0x6c')]=_0x5097ee[0x0];if(!_0x2d519f[_0x386f('0x55')][_0x386f('0x5c')])return;return db[_0x386f('0x6d')]['find']({'where':{'id':_0x2d519f[_0x386f('0x55')][_0x386f('0x5c')],'role':'agent'},'attributes':['id','name',_0x386f('0x6f'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0xdc9b55){if(!_0xdc9b55)return null;_0x2d4ddd[_0x386f('0x26')]['agent']=_0xdc9b55;return _0x2d4ddd;})[_0x386f('0x1f')](function(_0xab38ca){if(_0xab38ca){_0xab38ca[_0x386f('0x26')][_0x386f('0x71')]=util['format'](_0x386f('0x7d'),_0x2d519f['user']['name']);_0xab38ca[_0x386f('0x26')][_0x386f('0x72')]=_0x2d4ddd['channel'];_0xab38ca[_0x386f('0x26')]['motionChannel']=_0x2d4ddd['channel'];_0xab38ca[_0x386f('0x26')][_0x386f('0x7e')]='reject';respondWithRpcPromise('EventManager',_0x386f('0x75'),{'event':'rejectmessage','message':_[_0x386f('0x47')](_0x2d4ddd[_0x386f('0x26')],JSON[_0x386f('0x77')](_0x2d4ddd[_0x386f('0x63')]['formData']))},client9002);return _0x2d4ddd;}return null;})['then'](respondWithResult(_0x2731ec,null))[_0x386f('0x28')](handleError(_0x2731ec,null));}; \ No newline at end of file +var _0xc773=['role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../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','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','debug','error','message','info','request\x20sent','result','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','findAll','show','keys','find','create','body','update','params','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc773,0xa1));var _0x3c77=function(_0x5a1e4c,_0x2d20b2){_0x5a1e4c=_0x5a1e4c-0x0;var _0x348fa7=_0xc773[_0x5a1e4c];return _0x348fa7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c77('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c77('0x1'));var moment=require(_0x3c77('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3c77('0x3'));var path=require(_0x3c77('0x4'));var sox=require('sox');var csv=require(_0x3c77('0x5'));var ejs=require(_0x3c77('0x6'));var fs=require('fs');var fs_extra=require(_0x3c77('0x7'));var _=require(_0x3c77('0x8'));var squel=require(_0x3c77('0x9'));var crypto=require(_0x3c77('0xa'));var jsforce=require(_0x3c77('0xb'));var deskjs=require(_0x3c77('0xc'));var toCsv=require(_0x3c77('0x5'));var querystring=require('querystring');var Papa=require(_0x3c77('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c77('0xe'));var as=require(_0x3c77('0xf'));var hardwareService=require(_0x3c77('0x10'));var logger=require(_0x3c77('0x11'))(_0x3c77('0x12'));var utils=require(_0x3c77('0x13'));var config=require(_0x3c77('0x14'));var licenseUtil=require(_0x3c77('0x15'));var db=require(_0x3c77('0x16'))['db'];config[_0x3c77('0x17')]=_['defaults'](config['redis'],{'host':_0x3c77('0x18'),'port':0x18eb});var socket=require(_0x3c77('0x19'))(new Redis(config[_0x3c77('0x17')]));require(_0x3c77('0x1a'))[_0x3c77('0x1b')](socket);var jayson=require(_0x3c77('0x1c'));var client=jayson[_0x3c77('0x1d')][_0x3c77('0x1e')]({'port':0x232c});var client9002=jayson[_0x3c77('0x1d')][_0x3c77('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5bfaae,_0x380dc9,_0x27d6e2,_0x559681){return new BPromise(function(_0x2b54d7,_0x12d632){var _0x512eff=_0x559681||client;return _0x512eff[_0x3c77('0x1f')](_0x5bfaae,_0x27d6e2)[_0x3c77('0x20')](function(_0x87d18d){logger['info'](_0x3c77('0x21'),_0x380dc9,'request\x20sent');logger[_0x3c77('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x380dc9,'request\x20sent',JSON['stringify'](_0x87d18d));if(_0x87d18d[_0x3c77('0x23')]){if(_0x87d18d[_0x3c77('0x23')]['code']===0x1f4){logger[_0x3c77('0x23')](_0x3c77('0x21'),_0x380dc9,_0x87d18d[_0x3c77('0x23')][_0x3c77('0x24')]);return _0x12d632(_0x87d18d[_0x3c77('0x23')][_0x3c77('0x24')]);}logger['error'](_0x3c77('0x21'),_0x380dc9,_0x87d18d[_0x3c77('0x23')][_0x3c77('0x24')]);return _0x2b54d7(_0x87d18d['error'][_0x3c77('0x24')]);}else{logger[_0x3c77('0x25')](_0x3c77('0x21'),_0x380dc9,_0x3c77('0x26'));_0x2b54d7(_0x87d18d[_0x3c77('0x27')][_0x3c77('0x24')]);}})[_0x3c77('0x28')](function(_0x1a75f2){logger['error'](_0x3c77('0x21'),_0x380dc9,_0x1a75f2);_0x12d632(_0x1a75f2);});});}function respondWithStatusCode(_0x2ea37c,_0x5713ec){_0x5713ec=_0x5713ec||0xcc;return function(_0x5964d3){if(_0x5964d3){return _0x2ea37c[_0x3c77('0x29')](_0x5713ec);}return _0x2ea37c['status'](_0x5713ec)[_0x3c77('0x2a')]();};}function respondWithResult(_0x1b4fa5,_0x1d26a1){_0x1d26a1=_0x1d26a1||0xc8;return function(_0x4fa7dd){if(_0x4fa7dd){return _0x1b4fa5[_0x3c77('0x2b')](_0x1d26a1)[_0x3c77('0x2c')](_0x4fa7dd);}};}function respondWithFilteredResult(_0x174944,_0x5a5533){return function(_0x4fdad6){if(_0x4fdad6){var _0x30188e=typeof _0x5a5533[_0x3c77('0x2d')]===_0x3c77('0x2e')&&typeof _0x5a5533['limit']===_0x3c77('0x2e');var _0x4db430=_0x4fdad6[_0x3c77('0x2f')];var _0x301c31=_0x30188e?0x0:_0x5a5533[_0x3c77('0x2d')];var _0x42f5cc=_0x30188e?_0x4fdad6['count']:_0x5a5533[_0x3c77('0x2d')]+_0x5a5533['limit'];var _0x59e8da;if(_0x42f5cc>=_0x4db430){_0x42f5cc=_0x4db430;_0x59e8da=0xc8;}else{_0x59e8da=0xce;}_0x174944[_0x3c77('0x2b')](_0x59e8da);return _0x174944['set'](_0x3c77('0x30'),_0x301c31+'-'+_0x42f5cc+'/'+_0x4db430)[_0x3c77('0x2c')](_0x4fdad6);}return null;};}function patchUpdates(_0xec6746){return function(_0x37980a){try{jsonpatch[_0x3c77('0x31')](_0x37980a,_0xec6746,!![]);}catch(_0x351622){return BPromise[_0x3c77('0x32')](_0x351622);}return _0x37980a[_0x3c77('0x33')]();};}function saveUpdates(_0x1d93e5,_0x1dc10b){return function(_0x181aae){if(_0x181aae){return _0x181aae['update'](_0x1d93e5)[_0x3c77('0x20')](function(_0x5052c6){return _0x5052c6;});}return null;};}function removeEntity(_0x24bc51,_0x30ae64){return function(_0x35705b){if(_0x35705b){return _0x35705b[_0x3c77('0x34')]()['then'](function(){_0x24bc51[_0x3c77('0x2b')](0xcc)[_0x3c77('0x2a')]();});}};}function handleEntityNotFound(_0x870f0e,_0x532327){return function(_0x66e6f5){if(!_0x66e6f5){_0x870f0e[_0x3c77('0x29')](0x194);}return _0x66e6f5;};}function handleError(_0x33532f,_0x342e8f){_0x342e8f=_0x342e8f||0x1f4;return function(_0x3834aa){logger[_0x3c77('0x23')](_0x3834aa[_0x3c77('0x35')]);if(_0x3834aa[_0x3c77('0x36')]){delete _0x3834aa[_0x3c77('0x36')];}_0x33532f[_0x3c77('0x2b')](_0x342e8f)[_0x3c77('0x37')](_0x3834aa);};}exports[_0x3c77('0x38')]=function(_0x384b76,_0x23fdf7){var _0x1c9c85={},_0x35c21e={},_0x324023={'count':0x0,'rows':[]};var _0x453f8f=_[_0x3c77('0x39')](db['ChatMessage'][_0x3c77('0x3a')],function(_0x400a42){return{'name':_0x400a42['fieldName'],'type':_0x400a42[_0x3c77('0x3b')][_0x3c77('0x3c')]};});_0x35c21e[_0x3c77('0x3d')]=_[_0x3c77('0x39')](_0x453f8f,_0x3c77('0x36'));_0x35c21e[_0x3c77('0x3e')]=_['keys'](_0x384b76[_0x3c77('0x3e')]);_0x35c21e[_0x3c77('0x3f')]=_[_0x3c77('0x40')](_0x35c21e[_0x3c77('0x3d')],_0x35c21e[_0x3c77('0x3e')]);_0x1c9c85['attributes']=_[_0x3c77('0x40')](_0x35c21e[_0x3c77('0x3d')],qs[_0x3c77('0x41')](_0x384b76[_0x3c77('0x3e')]['fields']));_0x1c9c85[_0x3c77('0x42')]=_0x1c9c85[_0x3c77('0x42')][_0x3c77('0x43')]?_0x1c9c85[_0x3c77('0x42')]:_0x35c21e[_0x3c77('0x3d')];if(!_0x384b76[_0x3c77('0x3e')][_0x3c77('0x44')]('nolimit')){_0x1c9c85['limit']=qs[_0x3c77('0x45')](_0x384b76[_0x3c77('0x3e')][_0x3c77('0x45')]);_0x1c9c85[_0x3c77('0x2d')]=qs[_0x3c77('0x2d')](_0x384b76[_0x3c77('0x3e')][_0x3c77('0x2d')]);}_0x1c9c85[_0x3c77('0x46')]=qs[_0x3c77('0x47')](_0x384b76[_0x3c77('0x3e')][_0x3c77('0x47')]);_0x1c9c85[_0x3c77('0x48')]=qs[_0x3c77('0x3f')](_[_0x3c77('0x49')](_0x384b76[_0x3c77('0x3e')],_0x35c21e[_0x3c77('0x3f')]),_0x453f8f);if(_0x384b76[_0x3c77('0x3e')][_0x3c77('0x4a')]){_0x1c9c85[_0x3c77('0x48')]=_[_0x3c77('0x4b')](_0x1c9c85[_0x3c77('0x48')],{'$or':_[_0x3c77('0x39')](_0x453f8f,function(_0x12cbd6){if(_0x12cbd6[_0x3c77('0x3b')]!==_0x3c77('0x4c')){var _0x19eae1={};_0x19eae1[_0x12cbd6[_0x3c77('0x36')]]={'$like':'%'+_0x384b76['query']['filter']+'%'};return _0x19eae1;}})});}_0x1c9c85=_[_0x3c77('0x4b')]({},_0x1c9c85,_0x384b76[_0x3c77('0x4d')]);var _0x1012ed={'where':_0x1c9c85[_0x3c77('0x48')]};return db[_0x3c77('0x4e')]['count'](_0x1012ed)[_0x3c77('0x20')](function(_0x2df9d0){_0x324023['count']=_0x2df9d0;if(_0x384b76[_0x3c77('0x3e')][_0x3c77('0x4f')]){_0x1c9c85[_0x3c77('0x50')]=[{'all':!![]}];}return db[_0x3c77('0x4e')][_0x3c77('0x51')](_0x1c9c85);})[_0x3c77('0x20')](function(_0x2944fa){_0x324023['rows']=_0x2944fa;return _0x324023;})['then'](respondWithFilteredResult(_0x23fdf7,_0x1c9c85))[_0x3c77('0x28')](handleError(_0x23fdf7,null));};exports[_0x3c77('0x52')]=function(_0x1b2c08,_0x5e5475){var _0x210725={'raw':!![],'where':{'id':_0x1b2c08['params']['id']}},_0x3df5b8={};_0x3df5b8[_0x3c77('0x3d')]=_[_0x3c77('0x53')](db[_0x3c77('0x4e')]['rawAttributes']);_0x3df5b8['query']=_['keys'](_0x1b2c08[_0x3c77('0x3e')]);_0x3df5b8[_0x3c77('0x3f')]=_[_0x3c77('0x40')](_0x3df5b8[_0x3c77('0x3d')],_0x3df5b8['query']);_0x210725['attributes']=_[_0x3c77('0x40')](_0x3df5b8[_0x3c77('0x3d')],qs['fields'](_0x1b2c08['query'][_0x3c77('0x41')]));_0x210725['attributes']=_0x210725['attributes'][_0x3c77('0x43')]?_0x210725[_0x3c77('0x42')]:_0x3df5b8[_0x3c77('0x3d')];if(_0x1b2c08['query'][_0x3c77('0x4f')]){_0x210725[_0x3c77('0x50')]=[{'all':!![]}];}_0x210725=_['merge']({},_0x210725,_0x1b2c08[_0x3c77('0x4d')]);return db['ChatMessage'][_0x3c77('0x54')](_0x210725)[_0x3c77('0x20')](handleEntityNotFound(_0x5e5475,null))['then'](respondWithResult(_0x5e5475,null))[_0x3c77('0x28')](handleError(_0x5e5475,null));};exports['create']=function(_0x50a892,_0x85ba9){return db[_0x3c77('0x4e')][_0x3c77('0x55')](_0x50a892[_0x3c77('0x56')],{})['then'](respondWithResult(_0x85ba9,0xc9))[_0x3c77('0x28')](handleError(_0x85ba9,null));};exports[_0x3c77('0x57')]=function(_0x17e7a9,_0x200d19){if(_0x17e7a9[_0x3c77('0x56')]['id']){delete _0x17e7a9[_0x3c77('0x56')]['id'];}return db[_0x3c77('0x4e')][_0x3c77('0x54')]({'where':{'id':_0x17e7a9[_0x3c77('0x58')]['id']}})['then'](handleEntityNotFound(_0x200d19,null))[_0x3c77('0x20')](saveUpdates(_0x17e7a9['body'],null))[_0x3c77('0x20')](respondWithResult(_0x200d19,null))[_0x3c77('0x28')](handleError(_0x200d19,null));};exports['destroy']=function(_0x1ba286,_0x11f8ae){return db['ChatMessage']['find']({'where':{'id':_0x1ba286[_0x3c77('0x58')]['id']}})[_0x3c77('0x20')](handleEntityNotFound(_0x11f8ae,null))[_0x3c77('0x20')](removeEntity(_0x11f8ae,null))[_0x3c77('0x28')](handleError(_0x11f8ae,null));};exports[_0x3c77('0x59')]=function(_0x4197b2,_0x5822fe){return db[_0x3c77('0x4e')][_0x3c77('0x59')]()[_0x3c77('0x20')](respondWithResult(_0x5822fe,null))[_0x3c77('0x28')](handleError(_0x5822fe,null));};var interaction_log=require(_0x3c77('0x11'))(_0x3c77('0x5a'));exports[_0x3c77('0x5b')]=function(_0x186fb7,_0xc53957,_0x36aecb){var _0x523552={'agent':{},'channel':_0x3c77('0x5c')};if(_0x186fb7[_0x3c77('0x56')]['id']){delete _0x186fb7[_0x3c77('0x56')]['id'];}_0x186fb7[_0x3c77('0x56')][_0x3c77('0x5d')]=!![];_0x186fb7[_0x3c77('0x56')][_0x3c77('0x5e')]=moment()[_0x3c77('0x5f')](_0x3c77('0x60'));_0x186fb7[_0x3c77('0x56')]['UserId']=_0x186fb7['body'][_0x3c77('0x61')]||_0x186fb7[_0x3c77('0x62')]['id'];_0x523552[_0x3c77('0x63')]['id']=_0x186fb7[_0x3c77('0x56')][_0x3c77('0x61')];return db[_0x3c77('0x4e')][_0x3c77('0x54')]({'where':{'id':_0x186fb7[_0x3c77('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc53957,null))[_0x3c77('0x20')](saveUpdates(_0x186fb7[_0x3c77('0x56')],null))[_0x3c77('0x20')](function(_0x2ebc36){if(_0x2ebc36){_0x523552[_0x3c77('0x24')]=_0x2ebc36[_0x3c77('0x64')]({'plain':!![]});return db[_0x3c77('0x65')]['find']({'where':{'id':_0x2ebc36[_0x3c77('0x66')]}});}return null;})['then'](handleEntityNotFound(_0xc53957,null))[_0x3c77('0x20')](function(_0x2fbf95){if(_0x2fbf95){return _0x2fbf95[_0x3c77('0x57')]({'UserId':_0x186fb7[_0x3c77('0x56')]['UserId'],'read1stAt':_[_0x3c77('0x67')](_0x2fbf95[_0x3c77('0x68')])?moment()[_0x3c77('0x5f')](_0x3c77('0x60')):undefined});}return null;})[_0x3c77('0x20')](function(_0x267961){if(_0x267961){_0x523552[_0x3c77('0x69')]=_0x267961[_0x3c77('0x64')]({'plain':!![]});interaction_log['info'](_0x3c77('0x6a'),_0x186fb7[_0x3c77('0x62')]['id'],_0x186fb7['user'][_0x3c77('0x36')],_0x186fb7['user'][_0x3c77('0x6b')],_0x523552['interaction']['id'],_0x186fb7[_0x3c77('0x56')]?JSON[_0x3c77('0x6c')](_0x186fb7[_0x3c77('0x56')]):_0x3c77('0x6d'));return respondWithRpcPromise(_0x3c77('0x6e'),_0x3c77('0x6f'),_0x523552);}return null;})[_0x3c77('0x20')](function(_0x1ae4b8){var _0x5528e3=_0x3c77('0x70')+_0x1ae4b8[_0x3c77('0x24')][_0x3c77('0x71')];return db[_0x3c77('0x72')]['query'](_0x5528e3,{'type':db[_0x3c77('0x73')]['QueryTypes'][_0x3c77('0x74')],'raw':!![]})['then'](function(_0x51ca29){return _0x51ca29;});})[_0x3c77('0x20')](function(_0x574f87){if(_0x574f87){_0x523552[_0x3c77('0x24')][_0x3c77('0x75')]=_0x574f87[0x0];if(!_0x186fb7[_0x3c77('0x56')][_0x3c77('0x61')])return;return db[_0x3c77('0x76')][_0x3c77('0x54')]({'where':{'id':_0x186fb7[_0x3c77('0x56')][_0x3c77('0x61')],'role':_0x3c77('0x63')},'attributes':['id',_0x3c77('0x36'),_0x3c77('0x77'),_0x3c77('0x78'),_0x3c77('0x79')],'raw':!![]});}return null;})[_0x3c77('0x20')](function(_0x270cf1){if(!_0x270cf1)return null;_0x523552[_0x3c77('0x24')]['agent']=_0x270cf1;return _0x523552;})[_0x3c77('0x20')](function(_0x72d046){if(_0x72d046){if(_0x186fb7[_0x3c77('0x56')][_0x3c77('0x7a')]){_0x523552[_0x3c77('0x24')][_0x3c77('0x7b')]=util[_0x3c77('0x5f')](_0x3c77('0x7c'),_0x186fb7[_0x3c77('0x62')][_0x3c77('0x36')]);_0x523552[_0x3c77('0x24')][_0x3c77('0x7d')]=_0x523552[_0x3c77('0x7d')];_0x523552['message'][_0x3c77('0x7e')]=_0x523552[_0x3c77('0x7d')];_0x523552[_0x3c77('0x24')][_0x3c77('0x7f')]=_0x3c77('0x5b');return respondWithRpcPromise(_0x3c77('0x80'),_0x3c77('0x80'),{'event':'acceptmessage','message':_[_0x3c77('0x4b')](_0x523552['message'],JSON[_0x3c77('0x81')](_0x523552[_0x3c77('0x69')][_0x3c77('0x82')]))},client9002)['then'](function(){return _0x523552;});}return _0x523552;}return null;})[_0x3c77('0x20')](respondWithResult(_0xc53957,null))['catch'](handleError(_0xc53957,null));};var interaction_log=require(_0x3c77('0x11'))(_0x3c77('0x5a'));exports[_0x3c77('0x32')]=function(_0x583335,_0x4cb909,_0xd81450){var _0x470ee8={'agent':{},'channel':_0x3c77('0x5c')};if(_0x583335[_0x3c77('0x56')]['id']){delete _0x583335[_0x3c77('0x56')]['id'];}_0x583335['body'][_0x3c77('0x61')]=_0x583335[_0x3c77('0x56')]['UserId']||_0x583335[_0x3c77('0x62')]['id'];_0x470ee8[_0x3c77('0x63')]['id']=_0x583335[_0x3c77('0x56')]['UserId'];return db[_0x3c77('0x4e')][_0x3c77('0x54')]({'where':{'id':_0x583335[_0x3c77('0x58')]['id'],'UserId':null}})[_0x3c77('0x20')](handleEntityNotFound(_0x4cb909,null))['then'](function(_0x12b85d){if(_0x12b85d){_0x470ee8[_0x3c77('0x24')]=_0x12b85d['get']({'plain':!![]});return db[_0x3c77('0x65')]['find']({'where':{'id':_0x12b85d[_0x3c77('0x66')]}});}return null;})[_0x3c77('0x20')](handleEntityNotFound(_0x4cb909,null))[_0x3c77('0x20')](function(_0x5635d0){if(_0x5635d0){_0x470ee8['interaction']=_0x5635d0[_0x3c77('0x64')]({'plain':!![]});interaction_log[_0x3c77('0x25')](_0x3c77('0x83'),_0x583335[_0x3c77('0x62')]['id'],_0x583335['user'][_0x3c77('0x36')],_0x583335[_0x3c77('0x62')]['role'],_0x470ee8['interaction']['id'],_0x583335[_0x3c77('0x56')]?JSON['stringify'](_0x583335['body']):'null');return respondWithRpcPromise(_0x3c77('0x84'),'rejectMessage',_0x470ee8);}return null;})[_0x3c77('0x20')](function(_0x492f8e){var _0x2de3d=_0x3c77('0x70')+_0x492f8e[_0x3c77('0x24')][_0x3c77('0x71')];return db[_0x3c77('0x72')][_0x3c77('0x3e')](_0x2de3d,{'type':db[_0x3c77('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3c77('0x20')](function(_0x12d7ff){return _0x12d7ff;});})[_0x3c77('0x20')](function(_0x39d6b1){if(_0x39d6b1){_0x470ee8[_0x3c77('0x24')][_0x3c77('0x75')]=_0x39d6b1[0x0];if(!_0x583335['body'][_0x3c77('0x61')])return;return db[_0x3c77('0x76')][_0x3c77('0x54')]({'where':{'id':_0x583335[_0x3c77('0x56')][_0x3c77('0x61')],'role':_0x3c77('0x63')},'attributes':['id','name',_0x3c77('0x77'),_0x3c77('0x78'),_0x3c77('0x79')],'raw':!![]});}return null;})['then'](function(_0x46a7e1){if(!_0x46a7e1)return null;_0x470ee8[_0x3c77('0x24')][_0x3c77('0x63')]=_0x46a7e1;return _0x470ee8;})[_0x3c77('0x20')](function(_0x34dbdc){if(_0x34dbdc){_0x34dbdc[_0x3c77('0x24')][_0x3c77('0x7b')]=util[_0x3c77('0x5f')](_0x3c77('0x7c'),_0x583335['user'][_0x3c77('0x36')]);_0x34dbdc['message'][_0x3c77('0x7d')]=_0x470ee8[_0x3c77('0x7d')];_0x34dbdc[_0x3c77('0x24')][_0x3c77('0x7e')]=_0x470ee8[_0x3c77('0x7d')];_0x34dbdc[_0x3c77('0x24')][_0x3c77('0x7f')]='reject';respondWithRpcPromise(_0x3c77('0x80'),_0x3c77('0x80'),{'event':_0x3c77('0x85'),'message':_[_0x3c77('0x4b')](_0x470ee8[_0x3c77('0x24')],JSON['parse'](_0x470ee8[_0x3c77('0x69')][_0x3c77('0x82')]))},client9002);return _0x470ee8;}return null;})[_0x3c77('0x20')](respondWithResult(_0x4cb909,null))[_0x3c77('0x28')](handleError(_0x4cb909,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 03cd7b5..5ddec4e 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 _0xf815=['save','update','remove','emit','hasOwnProperty','hook','ChatMessage','setMaxListeners'];(function(_0x3e94ef,_0x47e7a9){var _0xe19621=function(_0x166fa7){while(--_0x166fa7){_0x3e94ef['push'](_0x3e94ef['shift']());}};_0xe19621(++_0x47e7a9);}(_0xf815,0x10e));var _0x5f81=function(_0x332ff9,_0x2a6021){_0x332ff9=_0x332ff9-0x0;var _0x11ca93=_0xf815[_0x332ff9];return _0x11ca93;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x5f81('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5f81('0x1')](0x0);var events={'afterCreate':_0x5f81('0x2'),'afterUpdate':_0x5f81('0x3'),'afterDestroy':_0x5f81('0x4')};function emitEvent(_0x56dc08){return function(_0x3401c0,_0x503636,_0x48ca6c){ChatMessageEvents[_0x5f81('0x5')](_0x56dc08+':'+_0x3401c0['id'],_0x3401c0);ChatMessageEvents[_0x5f81('0x5')](_0x56dc08,_0x3401c0);_0x48ca6c(null);};}for(var e in events){if(events[_0x5f81('0x6')](e)){var event=events[e];ChatMessage[_0x5f81('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x4196=['emit','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x4802b7,_0x4b4d61){var _0x3f1483=function(_0x24d8b5){while(--_0x24d8b5){_0x4802b7['push'](_0x4802b7['shift']());}};_0x3f1483(++_0x4b4d61);}(_0x4196,0x191));var _0x6419=function(_0x59e24f,_0xf78568){_0x59e24f=_0x59e24f-0x0;var _0x163822=_0x4196[_0x59e24f];return _0x163822;};'use strict';var EventEmitter=require(_0x6419('0x0'));var ChatMessage=require(_0x6419('0x1'))['db'][_0x6419('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6419('0x3')](0x0);var events={'afterCreate':_0x6419('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xf322b8){return function(_0x17c164,_0x73590f,_0x52210f){ChatMessageEvents[_0x6419('0x5')](_0xf322b8+':'+_0x17c164['id'],_0x17c164);ChatMessageEvents[_0x6419('0x5')](_0xf322b8,_0x17c164);_0x52210f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x6419('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1506c04..45926ca 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 _0xe644=['UserId','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','body','models','get','toLowerCase','direction','out'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x4e64('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e3246,_0x2ebcfe,_0x43ba47){var _0x4323bb=_0x13fa90[_0x4e64('0xe')];var _0x21d454=_0x4e3246[_0x4e64('0xf')]({'plain':!![]});if(_0x21d454['direction'][_0x4e64('0x10')]()==='in'||_0x21d454[_0x4e64('0x11')]['toLowerCase']()===_0x4e64('0x12')&&!_0x21d454['secret']&&!_['isNil'](_0x21d454[_0x4e64('0x13')])){_0x4323bb['ChatInteraction'][_0x4e64('0x14')]({'where':{'id':_0x21d454[_0x4e64('0x15')]}})[_0x4e64('0x16')](function(_0x2aa800){if(_0x2aa800){_0x2aa800[_0x4e64('0x17')]({'lastMsgAt':_0x21d454[_0x4e64('0x18')],'lastMsgDirection':_0x21d454[_0x4e64('0x11')]['toLowerCase']()});}})[_0x4e64('0x19')](function(_0x5573af){console[_0x4e64('0x1a')](_0x5573af);});}_0x43ba47();}},'charset':'utf8mb4','collate':_0x4e64('0x1b')});}; \ No newline at end of file +var _0xce9b=['ChatMessage','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x27fb50,_0x33a207){var _0x24a89a=function(_0x501e28){while(--_0x501e28){_0x27fb50['push'](_0x27fb50['shift']());}};_0x24a89a(++_0x33a207);}(_0xce9b,0xc6));var _0xbce9=function(_0x5ba8af,_0x489efe){_0x5ba8af=_0x5ba8af-0x0;var _0x1d4ddc=_0xce9b[_0x5ba8af];return _0x1d4ddc;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var logger=require(_0xbce9('0x2'))(_0xbce9('0x3'));var moment=require(_0xbce9('0x4'));var BPromise=require(_0xbce9('0x5'));var rp=require(_0xbce9('0x6'));var fs=require('fs');var path=require(_0xbce9('0x7'));var rimraf=require('rimraf');var config=require(_0xbce9('0x8'));var attributes=require(_0xbce9('0x9'));module[_0xbce9('0xa')]=function(_0x256ce6,_0x1c40fa){return _0x256ce6[_0xbce9('0xb')](_0xbce9('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xbce9('0xd')],'type':_0xbce9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a5542,_0x1f9621,_0x30d742){var _0x572128=_0x256ce6['models'];var _0x2073ea=_0x5a5542[_0xbce9('0xf')]({'plain':!![]});if(_0x2073ea[_0xbce9('0x10')]['toLowerCase']()==='in'||_0x2073ea['direction'][_0xbce9('0x11')]()===_0xbce9('0x12')&&!_0x2073ea[_0xbce9('0x13')]&&!_[_0xbce9('0x14')](_0x2073ea[_0xbce9('0x15')])){_0x572128[_0xbce9('0x16')][_0xbce9('0x17')]({'where':{'id':_0x2073ea[_0xbce9('0x18')]}})[_0xbce9('0x19')](function(_0x2fd585){if(_0x2fd585){_0x2fd585['update']({'lastMsgAt':_0x2073ea[_0xbce9('0x1a')],'lastMsgDirection':_0x2073ea[_0xbce9('0x10')][_0xbce9('0x11')]()});}})[_0xbce9('0x1b')](function(_0x1d8db8){console['error'](_0x1d8db8);});}_0x30d742();}},'charset':_0xbce9('0x1c'),'collate':_0xbce9('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 888d127..fdbd188 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 _0xc6e1=['catch','create','body','options','raw','CreateChatMessage','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','then','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x34ec96,_0x18c868){var _0x3c1b34=function(_0x4a1596){while(--_0x4a1596){_0x34ec96['push'](_0x34ec96['shift']());}};_0x3c1b34(++_0x18c868);}(_0xc6e1,0x164));var _0x1c6e=function(_0x15e331,_0x58939f){_0x15e331=_0x15e331-0x0;var _0xd0e722=_0xc6e1[_0x15e331];return _0xd0e722;};'use strict';var _=require('lodash');var util=require(_0x1c6e('0x0'));var moment=require('moment');var BPromise=require(_0x1c6e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c6e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1c6e('0x3'))(_0x1c6e('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1c6e('0x5')][_0x1c6e('0x6')]({'port':0x232a});config[_0x1c6e('0x7')]=_['defaults'](config[_0x1c6e('0x7')],{'host':_0x1c6e('0x8'),'port':0x18eb});var socket=require(_0x1c6e('0x9'))(new Redis(config[_0x1c6e('0x7')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1da660,_0x2c3a03,_0x2fa333){return new BPromise(function(_0x5c4b11,_0x3ba71f){return client['request'](_0x1da660,_0x2fa333)[_0x1c6e('0xa')](function(_0x5e0c95){logger['info'](_0x1c6e('0xb'),_0x2c3a03,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2c3a03,_0x1c6e('0xc'),JSON[_0x1c6e('0xd')](_0x5e0c95));if(_0x5e0c95[_0x1c6e('0xe')]){if(_0x5e0c95[_0x1c6e('0xe')][_0x1c6e('0xf')]===0x1f4){logger[_0x1c6e('0xe')](_0x1c6e('0xb'),_0x2c3a03,_0x5e0c95[_0x1c6e('0xe')][_0x1c6e('0x10')]);return _0x3ba71f(_0x5e0c95['error']['message']);}logger[_0x1c6e('0xe')](_0x1c6e('0xb'),_0x2c3a03,_0x5e0c95[_0x1c6e('0xe')][_0x1c6e('0x10')]);return _0x5c4b11(_0x5e0c95[_0x1c6e('0xe')][_0x1c6e('0x10')]);}else{logger[_0x1c6e('0x11')]('ChatMessage,\x20%s,\x20%s',_0x2c3a03,_0x1c6e('0xc'));_0x5c4b11(_0x5e0c95[_0x1c6e('0x12')][_0x1c6e('0x10')]);}})[_0x1c6e('0x13')](function(_0x12e017){logger[_0x1c6e('0xe')]('ChatMessage,\x20%s,\x20%s',_0x2c3a03,_0x12e017);_0x3ba71f(_0x12e017);});});}exports['CreateChatMessage']=function(_0x5abc8b){var _0x5c2008=this;return new Promise(function(_0x36b8bb,_0x5af66d){return db['ChatMessage'][_0x1c6e('0x14')](_0x5abc8b[_0x1c6e('0x15')],{'raw':_0x5abc8b[_0x1c6e('0x16')]?_0x5abc8b[_0x1c6e('0x16')][_0x1c6e('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x33f9b1){logger[_0x1c6e('0x11')]('CreateChatMessage',_0x5abc8b);logger['debug'](_0x1c6e('0x18'),_0x5abc8b,JSON[_0x1c6e('0xd')](_0x33f9b1));_0x36b8bb(_0x33f9b1);})[_0x1c6e('0x13')](function(_0x2a698c){logger[_0x1c6e('0xe')](_0x1c6e('0x18'),_0x2a698c[_0x1c6e('0x10')],_0x5abc8b);_0x5af66d(_0x5c2008['error'](0x1f4,_0x2a698c['message']));});});}; \ No newline at end of file +var _0x76f2=['defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0xf5b801,_0x44147e){var _0x5eceba=function(_0x5ae7e9){while(--_0x5ae7e9){_0xf5b801['push'](_0xf5b801['shift']());}};_0x5eceba(++_0x44147e);}(_0x76f2,0x125));var _0x276f=function(_0x190c86,_0x3e8b68){_0x190c86=_0x190c86-0x0;var _0xb2936b=_0x76f2[_0x190c86];return _0xb2936b;};'use strict';var _=require(_0x276f('0x0'));var util=require(_0x276f('0x1'));var moment=require(_0x276f('0x2'));var BPromise=require(_0x276f('0x3'));var rs=require(_0x276f('0x4'));var fs=require('fs');var Redis=require(_0x276f('0x5'));var db=require(_0x276f('0x6'))['db'];var utils=require(_0x276f('0x7'));var logger=require(_0x276f('0x8'))(_0x276f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x276f('0xa')][_0x276f('0xb')]({'port':0x232a});config[_0x276f('0xc')]=_[_0x276f('0xd')](config[_0x276f('0xc')],{'host':_0x276f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x276f('0xc')]));require(_0x276f('0xf'))[_0x276f('0x10')](socket);function respondWithRpcPromise(_0x1cf6dc,_0x178ddb,_0x48d337){return new BPromise(function(_0x43520c,_0x558c35){return client[_0x276f('0x11')](_0x1cf6dc,_0x48d337)[_0x276f('0x12')](function(_0x2f7e11){logger[_0x276f('0x13')](_0x276f('0x14'),_0x178ddb,_0x276f('0x15'));logger['debug'](_0x276f('0x16'),_0x178ddb,_0x276f('0x15'),JSON[_0x276f('0x17')](_0x2f7e11));if(_0x2f7e11[_0x276f('0x18')]){if(_0x2f7e11[_0x276f('0x18')][_0x276f('0x19')]===0x1f4){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x558c35(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}logger[_0x276f('0x18')]('ChatMessage,\x20%s,\x20%s',_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x43520c(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}else{logger['info'](_0x276f('0x14'),_0x178ddb,'request\x20sent');_0x43520c(_0x2f7e11['result']['message']);}})[_0x276f('0x1b')](function(_0x15ba3a){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x15ba3a);_0x558c35(_0x15ba3a);});});}exports[_0x276f('0x1c')]=function(_0x5afc36){var _0xd9a0c1=this;return new Promise(function(_0x27bb24,_0x4c7799){return db[_0x276f('0x1d')][_0x276f('0x1e')](_0x5afc36[_0x276f('0x1f')],{'raw':_0x5afc36[_0x276f('0x20')]?_0x5afc36[_0x276f('0x20')][_0x276f('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xaa6b1f){logger[_0x276f('0x13')](_0x276f('0x1c'),_0x5afc36);logger['debug'](_0x276f('0x1c'),_0x5afc36,JSON[_0x276f('0x17')](_0xaa6b1f));_0x27bb24(_0xaa6b1f);})[_0x276f('0x1b')](function(_0x46777e){logger[_0x276f('0x18')](_0x276f('0x1c'),_0x46777e[_0x276f('0x1a')],_0x5afc36);_0x4c7799(_0xd9a0c1[_0x276f('0x18')](0x1f4,_0x46777e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0ff1ec5..c80e9cf 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 _0xd67b=['chatMessage:','save','update','emit','register','length'];(function(_0x5216dc,_0x2b9407){var _0x4c64e7=function(_0x2056d7){while(--_0x2056d7){_0x5216dc['push'](_0x5216dc['shift']());}};_0x4c64e7(++_0x2b9407);}(_0xd67b,0x133));var _0xbd67=function(_0x1137a1,_0x314a3b){_0x1137a1=_0x1137a1-0x0;var _0x899c10=_0xd67b[_0x1137a1];return _0x899c10;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xbd67('0x0'),'remove',_0xbd67('0x1')];function createListener(_0x280954,_0x317e33){return function(_0x5e967b){_0x317e33[_0xbd67('0x2')](_0x280954,_0x5e967b);};}function removeListener(_0x50da5a,_0x1bf96){return function(){ChatMessageEvents['removeListener'](_0x50da5a,_0x1bf96);};}exports[_0xbd67('0x3')]=function(_0xa5c384){for(var _0x2ad142=0x0,_0x27b016=events[_0xbd67('0x4')];_0x2ad142<_0x27b016;_0x2ad142++){var _0x72f9ac=events[_0x2ad142];var _0x2d4af6=createListener(_0xbd67('0x5')+_0x72f9ac,_0xa5c384);ChatMessageEvents['on'](_0x72f9ac,_0x2d4af6);}}; \ No newline at end of file +var _0xe132=['remove','update','length','chatMessage:','./chatMessage.events'];(function(_0x36f551,_0x29d72d){var _0x15030f=function(_0x27a27a){while(--_0x27a27a){_0x36f551['push'](_0x36f551['shift']());}};_0x15030f(++_0x29d72d);}(_0xe132,0x162));var _0x2e13=function(_0x74077e,_0x302a6e){_0x74077e=_0x74077e-0x0;var _0x2153be=_0xe132[_0x74077e];return _0x2153be;};'use strict';var ChatMessageEvents=require(_0x2e13('0x0'));var events=['save',_0x2e13('0x1'),_0x2e13('0x2')];function createListener(_0x21dfef,_0x2c2bdd){return function(_0x2a5250){_0x2c2bdd['emit'](_0x21dfef,_0x2a5250);};}function removeListener(_0x1ae6a9,_0x3f01fe){return function(){ChatMessageEvents['removeListener'](_0x1ae6a9,_0x3f01fe);};}exports['register']=function(_0x260dc1){for(var _0x2f9d00=0x0,_0x1c670b=events[_0x2e13('0x3')];_0x2f9d00<_0x1c670b;_0x2f9d00++){var _0x3be5dc=events[_0x2f9d00];var _0x2d9487=createListener(_0x2e13('0x4')+_0x3be5dc,_0x260dc1);ChatMessageEvents['on'](_0x3be5dc,_0x2d9487);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 38e147b..d36fce2 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 _0x588c=['./chatMessage.controller','get','isAuthenticated','describe','show','post','create','put','/:id','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x588c,0x134));var _0xc588=function(_0x4f2efe,_0x15a78f){_0x4f2efe=_0x4f2efe-0x0;var _0xc5a597=_0x588c[_0x4f2efe];return _0xc5a597;};'use strict';var multer=require('multer');var util=require(_0xc588('0x0'));var path=require(_0xc588('0x1'));var timeout=require(_0xc588('0x2'));var express=require(_0xc588('0x3'));var router=express[_0xc588('0x4')]();var fs_extra=require(_0xc588('0x5'));var auth=require(_0xc588('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc588('0x7'));router[_0xc588('0x8')]('/',auth[_0xc588('0x9')](),controller['index']);router[_0xc588('0x8')]('/describe',auth[_0xc588('0x9')](),controller[_0xc588('0xa')]);router['get']('/:id',auth[_0xc588('0x9')](),controller[_0xc588('0xb')]);router[_0xc588('0xc')]('/',auth[_0xc588('0x9')](),interaction['tracked']('chat','chatmessage:create'),controller[_0xc588('0xd')]);router[_0xc588('0xe')](_0xc588('0xf'),controller['update']);router[_0xc588('0xe')]('/:id/accept',auth[_0xc588('0x9')](),controller[_0xc588('0x10')]);router[_0xc588('0xe')](_0xc588('0x11'),auth[_0xc588('0x9')](),controller[_0xc588('0x12')]);router['delete'](_0xc588('0xf'),auth['isAuthenticated'](),controller[_0xc588('0x13')]);module[_0xc588('0x14')]=router; \ No newline at end of file +var _0xe40c=['isAuthenticated','index','/describe','/:id','show','tracked','chat','chatmessage:create','create','update','put','/:id/accept','accept','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get'];(function(_0x21f8ee,_0x46da73){var _0x46c824=function(_0x45d041){while(--_0x45d041){_0x21f8ee['push'](_0x21f8ee['shift']());}};_0x46c824(++_0x46da73);}(_0xe40c,0x1b8));var _0xce40=function(_0x159b72,_0x183756){_0x159b72=_0x159b72-0x0;var _0x4fa7b7=_0xe40c[_0x159b72];return _0x4fa7b7;};'use strict';var multer=require(_0xce40('0x0'));var util=require(_0xce40('0x1'));var path=require(_0xce40('0x2'));var timeout=require('connect-timeout');var express=require(_0xce40('0x3'));var router=express[_0xce40('0x4')]();var fs_extra=require(_0xce40('0x5'));var auth=require(_0xce40('0x6'));var interaction=require(_0xce40('0x7'));var config=require('../../config/environment');var controller=require(_0xce40('0x8'));router[_0xce40('0x9')]('/',auth[_0xce40('0xa')](),controller[_0xce40('0xb')]);router[_0xce40('0x9')](_0xce40('0xc'),auth[_0xce40('0xa')](),controller['describe']);router[_0xce40('0x9')](_0xce40('0xd'),auth['isAuthenticated'](),controller[_0xce40('0xe')]);router['post']('/',auth[_0xce40('0xa')](),interaction[_0xce40('0xf')](_0xce40('0x10'),_0xce40('0x11')),controller[_0xce40('0x12')]);router['put'](_0xce40('0xd'),controller[_0xce40('0x13')]);router[_0xce40('0x14')](_0xce40('0x15'),auth[_0xce40('0xa')](),controller[_0xce40('0x16')]);router[_0xce40('0x14')]('/:id/reject',auth[_0xce40('0xa')](),controller['reject']);router[_0xce40('0x17')](_0xce40('0xd'),auth[_0xce40('0xa')](),controller['destroy']);module[_0xce40('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ba3a4f7..9e00fa8 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(_0x4529a1,_0x52c72a){var _0x5bac0d=function(_0x540fe9){while(--_0x540fe9){_0x4529a1['push'](_0x4529a1['shift']());}};_0x5bac0d(++_0x52c72a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x5ee6f7,_0x1ac091){var _0x2413ec=function(_0xa9fdba){while(--_0xa9fdba){_0x5ee6f7['push'](_0x5ee6f7['shift']());}};_0x2413ec(++_0x1ac091);}(_0xb10b,0x12a));var _0xbb10=function(_0x220fa9,_0x4255fb){_0x220fa9=_0x220fa9-0x0;var _0x518ed5=_0xb10b[_0x220fa9];return _0x518ed5;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index db57857..1168590 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(_0x526f01,_0x3f4a18){_0x526f01=_0x526f01-0x0;var _0x29f1c6=_0x7a54[_0x526f01];return _0x29f1c6;};'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(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x7a54,0x106));var _0x47a5=function(_0x158fbb,_0x36bd27){_0x158fbb=_0x158fbb-0x0;var _0xd02396=_0x7a54[_0x158fbb];return _0xd02396;};'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 85d572e..dba07a1 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 _0x7449=['emit','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7449,0x14b));var _0x9744=function(_0xf30d44,_0x3233a7){_0xf30d44=_0xf30d44-0x0;var _0x58cebc=_0x7449[_0xf30d44];return _0x58cebc;};'use strict';var EventEmitter=require(_0x9744('0x0'));var ChatOfflineMessage=require(_0x9744('0x1'))['db'][_0x9744('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9744('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9744('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1243a4){return function(_0x5df42f,_0x31aad8,_0x149ff6){ChatOfflineMessageEvents[_0x9744('0x5')](_0x1243a4+':'+_0x5df42f['id'],_0x5df42f);ChatOfflineMessageEvents[_0x9744('0x5')](_0x1243a4,_0x5df42f);_0x149ff6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x9744('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x811b=['hook','exports','events','setMaxListeners','save','hasOwnProperty'];(function(_0xb7015b,_0x4bb54b){var _0x231a0b=function(_0x57242d){while(--_0x57242d){_0xb7015b['push'](_0xb7015b['shift']());}};_0x231a0b(++_0x4bb54b);}(_0x811b,0xb0));var _0xb811=function(_0x3d66f0,_0x3f4e63){_0x3d66f0=_0x3d66f0-0x0;var _0x4164f3=_0x811b[_0x3d66f0];return _0x4164f3;};'use strict';var EventEmitter=require(_0xb811('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb811('0x1')](0x0);var events={'afterCreate':_0xb811('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35528f){return function(_0x4a3d64,_0x323289,_0x3f980d){ChatOfflineMessageEvents['emit'](_0x35528f+':'+_0x4a3d64['id'],_0x4a3d64);ChatOfflineMessageEvents['emit'](_0x35528f,_0x4a3d64);_0x3f980d(null);};}for(var e in events){if(events[_0xb811('0x3')](e)){var event=events[e];ChatOfflineMessage[_0xb811('0x4')](e,emitEvent(event));}}module[_0xb811('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6ea599d..aa664e2 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 _0x1b04=['define','chat_offline_messages','exports'];(function(_0x13ff7b,_0x14edb1){var _0x25b72c=function(_0x2f9b89){while(--_0x2f9b89){_0x13ff7b['push'](_0x13ff7b['shift']());}};_0x25b72c(++_0x14edb1);}(_0x1b04,0x7d));var _0x41b0=function(_0xe1b523,_0x2bc05b){_0xe1b523=_0xe1b523-0x0;var _0x52c152=_0x1b04[_0xe1b523];return _0x52c152;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x41b0('0x0')]=function(_0x479fb2){return _0x479fb2[_0x41b0('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0x41b0('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8c7b=['ChatOfflineMessage','utf8mb4','./chatOfflineMessage.attributes','exports','define'];(function(_0x1cdc68,_0x21b209){var _0x42acd7=function(_0x1f8956){while(--_0x1f8956){_0x1cdc68['push'](_0x1cdc68['shift']());}};_0x42acd7(++_0x21b209);}(_0x8c7b,0x14c));var _0xb8c7=function(_0xab539e,_0x13b1d8){_0xab539e=_0xab539e-0x0;var _0x4b6bcc=_0x8c7b[_0xab539e];return _0x4b6bcc;};'use strict';var attributes=require(_0xb8c7('0x0'));module[_0xb8c7('0x1')]=function(_0x410096){return _0x410096[_0xb8c7('0x2')](_0xb8c7('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb8c7('0x4'),'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 226c674..be453eb 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 _0x7061=['message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x532127,_0xfd6f56){var _0x29cd22=function(_0x2667ea){while(--_0x2667ea){_0x532127['push'](_0x532127['shift']());}};_0x29cd22(++_0xfd6f56);}(_0x7061,0x12e));var _0x1706=function(_0x4a60eb,_0x463e2b){_0x4a60eb=_0x4a60eb-0x0;var _0x439a36=_0x7061[_0x4a60eb];return _0x439a36;};'use strict';var _=require(_0x1706('0x0'));var util=require(_0x1706('0x1'));var moment=require('moment');var BPromise=require(_0x1706('0x2'));var rs=require(_0x1706('0x3'));var fs=require('fs');var Redis=require(_0x1706('0x4'));var db=require(_0x1706('0x5'))['db'];var utils=require(_0x1706('0x6'));var logger=require(_0x1706('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1706('0x8'));var client=jayson[_0x1706('0x9')][_0x1706('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17d967,_0x18448c,_0x480896){return new BPromise(function(_0x4eb124,_0x2a45c8){return client[_0x1706('0xb')](_0x17d967,_0x480896)[_0x1706('0xc')](function(_0x304c3b){logger['info'](_0x1706('0xd'),_0x18448c,'request\x20sent');logger[_0x1706('0xe')](_0x1706('0xf'),_0x18448c,_0x1706('0x10'),JSON[_0x1706('0x11')](_0x304c3b));if(_0x304c3b['error']){if(_0x304c3b[_0x1706('0x12')][_0x1706('0x13')]===0x1f4){logger[_0x1706('0x12')](_0x1706('0xd'),_0x18448c,_0x304c3b[_0x1706('0x12')]['message']);return _0x2a45c8(_0x304c3b[_0x1706('0x12')][_0x1706('0x14')]);}logger[_0x1706('0x12')](_0x1706('0xd'),_0x18448c,_0x304c3b['error'][_0x1706('0x14')]);return _0x4eb124(_0x304c3b[_0x1706('0x12')][_0x1706('0x14')]);}else{logger[_0x1706('0x15')]('ChatOfflineMessage,\x20%s,\x20%s',_0x18448c,_0x1706('0x10'));_0x4eb124(_0x304c3b['result'][_0x1706('0x14')]);}})[_0x1706('0x16')](function(_0x2c618d){logger['error'](_0x1706('0xd'),_0x18448c,_0x2c618d);_0x2a45c8(_0x2c618d);});});} \ No newline at end of file +var _0x4af7=['message','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2051d9,_0x3fccfd){var _0x401cbc=function(_0x269a73){while(--_0x269a73){_0x2051d9['push'](_0x2051d9['shift']());}};_0x401cbc(++_0x3fccfd);}(_0x4af7,0xfb));var _0x74af=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0x4af7[_0x423097];return _0x3a73f1;};'use strict';var _=require(_0x74af('0x0'));var util=require(_0x74af('0x1'));var moment=require(_0x74af('0x2'));var BPromise=require(_0x74af('0x3'));var rs=require(_0x74af('0x4'));var fs=require('fs');var Redis=require(_0x74af('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74af('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb76837,_0x3fba98,_0x28ba33){return new BPromise(function(_0x405489,_0x133259){return client[_0x74af('0x8')](_0xb76837,_0x28ba33)[_0x74af('0x9')](function(_0x4f6302){logger[_0x74af('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3fba98,'request\x20sent');logger['debug'](_0x74af('0xb'),_0x3fba98,'request\x20sent',JSON[_0x74af('0xc')](_0x4f6302));if(_0x4f6302[_0x74af('0xd')]){if(_0x4f6302['error'][_0x74af('0xe')]===0x1f4){logger[_0x74af('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3fba98,_0x4f6302[_0x74af('0xd')][_0x74af('0xf')]);return _0x133259(_0x4f6302[_0x74af('0xd')][_0x74af('0xf')]);}logger[_0x74af('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3fba98,_0x4f6302[_0x74af('0xd')]['message']);return _0x405489(_0x4f6302[_0x74af('0xd')]['message']);}else{logger[_0x74af('0xa')](_0x74af('0x10'),_0x3fba98,_0x74af('0x11'));_0x405489(_0x4f6302[_0x74af('0x12')][_0x74af('0xf')]);}})['catch'](function(_0x53300c){logger[_0x74af('0xd')](_0x74af('0x10'),_0x3fba98,_0x53300c);_0x133259(_0x53300c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index cc0ebd3..8e94740 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 _0x1cc3=['/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1cc3,0x72));var _0x31cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1cc3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x31cc('0x0'));var path=require(_0x31cc('0x1'));var timeout=require(_0x31cc('0x2'));var express=require(_0x31cc('0x3'));var router=express['Router']();var fs_extra=require(_0x31cc('0x4'));var auth=require(_0x31cc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31cc('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x31cc('0x7')]('/',auth[_0x31cc('0x8')](),controller[_0x31cc('0x9')]);router[_0x31cc('0x7')](_0x31cc('0xa'),auth[_0x31cc('0x8')](),controller[_0x31cc('0xb')]);router['get'](_0x31cc('0xc'),auth[_0x31cc('0x8')](),controller['show']);router[_0x31cc('0xd')]('/',auth[_0x31cc('0x8')](),controller['create']);router[_0x31cc('0xe')](_0x31cc('0xc'),auth[_0x31cc('0x8')](),controller[_0x31cc('0xf')]);router[_0x31cc('0x10')]('/:id',auth[_0x31cc('0x8')](),controller[_0x31cc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7df8=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x16857f,_0x3ad2a7){var _0x2ce1bc=function(_0x3e07b4){while(--_0x3e07b4){_0x16857f['push'](_0x16857f['shift']());}};_0x2ce1bc(++_0x3ad2a7);}(_0x7df8,0x125));var _0x87df=function(_0x31514f,_0x39ef59){_0x31514f=_0x31514f-0x0;var _0x39cb87=_0x7df8[_0x31514f];return _0x39cb87;};'use strict';var multer=require(_0x87df('0x0'));var util=require(_0x87df('0x1'));var path=require(_0x87df('0x2'));var timeout=require(_0x87df('0x3'));var express=require('express');var router=express[_0x87df('0x4')]();var fs_extra=require(_0x87df('0x5'));var auth=require(_0x87df('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x87df('0x7'));router[_0x87df('0x8')]('/',auth[_0x87df('0x9')](),controller[_0x87df('0xa')]);router['get'](_0x87df('0xb'),auth['isAuthenticated'](),controller[_0x87df('0xc')]);router[_0x87df('0x8')](_0x87df('0xd'),auth[_0x87df('0x9')](),controller[_0x87df('0xe')]);router[_0x87df('0xf')]('/',auth[_0x87df('0x9')](),controller['create']);router[_0x87df('0x10')]('/:id',auth[_0x87df('0x9')](),controller[_0x87df('0x11')]);router[_0x87df('0x12')](_0x87df('0xd'),auth[_0x87df('0x9')](),controller[_0x87df('0x13')]);module[_0x87df('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 96d26d7..31f94d3 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 _0xc128=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xc128,0xc3));var _0x8c12=function(_0x388f38,_0x4e18e5){_0x388f38=_0x388f38-0x0;var _0x487fe5=_0xc128[_0x388f38];return _0x487fe5;};'use strict';var Sequelize=require(_0x8c12('0x0'));module[_0x8c12('0x1')]={'name':{'type':Sequelize[_0x8c12('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8c12('0x3')](_0x8c12('0x4'),_0x8c12('0x5')),'defaultValue':_0x8c12('0x4')},'selector':{'type':Sequelize[_0x8c12('0x2')]},'timeout':{'type':Sequelize[_0x8c12('0x6')]}}; \ No newline at end of file +var _0x9692=['timeout','mouseOver','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9692,0x19a));var _0x2969=function(_0x338567,_0x20ac4b){_0x338567=_0x338567-0x0;var _0x4424b5=_0x9692[_0x338567];return _0x4424b5;};'use strict';var Sequelize=require(_0x2969('0x0'));module[_0x2969('0x1')]={'name':{'type':Sequelize[_0x2969('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2969('0x3')]('mouseOver',_0x2969('0x4')),'defaultValue':_0x2969('0x5')},'selector':{'type':Sequelize[_0x2969('0x2')]},'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 007bcd0..15bd5e2 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 _0x9efe=['model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','show','params'];(function(_0x1e526a,_0x5b8ea3){var _0x75534c=function(_0x43dee0){while(--_0x43dee0){_0x1e526a['push'](_0x1e526a['shift']());}};_0x75534c(++_0x5b8ea3);}(_0x9efe,0xca));var _0xe9ef=function(_0x5554c5,_0x4e2cec){_0x5554c5=_0x5554c5-0x0;var _0x359003=_0x9efe[_0x5554c5];return _0x359003;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9ef('0x0'));var zipdir=require(_0xe9ef('0x1'));var jsonpatch=require(_0xe9ef('0x2'));var rp=require(_0xe9ef('0x3'));var moment=require(_0xe9ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9ef('0x5'));var util=require(_0xe9ef('0x6'));var path=require(_0xe9ef('0x7'));var sox=require(_0xe9ef('0x8'));var csv=require(_0xe9ef('0x9'));var ejs=require(_0xe9ef('0xa'));var fs=require('fs');var fs_extra=require(_0xe9ef('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe9ef('0xc'));var deskjs=require(_0xe9ef('0xd'));var toCsv=require(_0xe9ef('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe9ef('0xe'));var as=require(_0xe9ef('0xf'));var hardwareService=require(_0xe9ef('0x10'));var logger=require('../../config/logger')(_0xe9ef('0x11'));var utils=require(_0xe9ef('0x12'));var config=require(_0xe9ef('0x13'));var licenseUtil=require(_0xe9ef('0x14'));var db=require(_0xe9ef('0x15'))['db'];function respondWithStatusCode(_0x28f4e5,_0x58df0a){_0x58df0a=_0x58df0a||0xcc;return function(_0x45ae9a){if(_0x45ae9a){return _0x28f4e5[_0xe9ef('0x16')](_0x58df0a);}return _0x28f4e5[_0xe9ef('0x17')](_0x58df0a)[_0xe9ef('0x18')]();};}function respondWithResult(_0xbe7e,_0x498a53){_0x498a53=_0x498a53||0xc8;return function(_0x1427cb){if(_0x1427cb){return _0xbe7e[_0xe9ef('0x17')](_0x498a53)[_0xe9ef('0x19')](_0x1427cb);}};}function respondWithFilteredResult(_0x1f2698,_0x2c7f15){return function(_0x4c57c3){if(_0x4c57c3){var _0x537d17=typeof _0x2c7f15[_0xe9ef('0x1a')]==='undefined'&&typeof _0x2c7f15[_0xe9ef('0x1b')]===_0xe9ef('0x1c');var _0x3c94c3=_0x4c57c3['count'];var _0x104f82=_0x537d17?0x0:_0x2c7f15[_0xe9ef('0x1a')];var _0x2caa88=_0x537d17?_0x4c57c3[_0xe9ef('0x1d')]:_0x2c7f15['offset']+_0x2c7f15[_0xe9ef('0x1b')];var _0x5d99c2;if(_0x2caa88>=_0x3c94c3){_0x2caa88=_0x3c94c3;_0x5d99c2=0xc8;}else{_0x5d99c2=0xce;}_0x1f2698['status'](_0x5d99c2);return _0x1f2698[_0xe9ef('0x1e')](_0xe9ef('0x1f'),_0x104f82+'-'+_0x2caa88+'/'+_0x3c94c3)['json'](_0x4c57c3);}return null;};}function patchUpdates(_0x3d4780){return function(_0x275012){try{jsonpatch[_0xe9ef('0x20')](_0x275012,_0x3d4780,!![]);}catch(_0x540682){return BPromise[_0xe9ef('0x21')](_0x540682);}return _0x275012[_0xe9ef('0x22')]();};}function saveUpdates(_0x21de44,_0xf54d38){return function(_0x5cdd83){if(_0x5cdd83){return _0x5cdd83['update'](_0x21de44)[_0xe9ef('0x23')](function(_0x2144a2){return _0x2144a2;});}return null;};}function removeEntity(_0x14384b,_0x46e0ae){return function(_0x239f4e){if(_0x239f4e){return _0x239f4e[_0xe9ef('0x24')]()[_0xe9ef('0x23')](function(){_0x14384b['status'](0xcc)[_0xe9ef('0x18')]();});}};}function handleEntityNotFound(_0x54e793,_0x4cbe69){return function(_0x60890b){if(!_0x60890b){_0x54e793[_0xe9ef('0x16')](0x194);}return _0x60890b;};}function handleError(_0x176081,_0x13a500){_0x13a500=_0x13a500||0x1f4;return function(_0x88f390){logger['error'](_0x88f390[_0xe9ef('0x25')]);if(_0x88f390[_0xe9ef('0x26')]){delete _0x88f390[_0xe9ef('0x26')];}_0x176081[_0xe9ef('0x17')](_0x13a500)[_0xe9ef('0x27')](_0x88f390);};}exports[_0xe9ef('0x28')]=function(_0x3866c,_0x837724){var _0x3ae970={'raw':!![],'where':{'id':_0x3866c[_0xe9ef('0x29')]['id']}},_0x20222f={};_0x20222f[_0xe9ef('0x2a')]=_['keys'](db[_0xe9ef('0x2b')][_0xe9ef('0x2c')]);_0x20222f[_0xe9ef('0x2d')]=_[_0xe9ef('0x2e')](_0x3866c[_0xe9ef('0x2d')]);_0x20222f[_0xe9ef('0x2f')]=_[_0xe9ef('0x30')](_0x20222f[_0xe9ef('0x2a')],_0x20222f[_0xe9ef('0x2d')]);_0x3ae970[_0xe9ef('0x31')]=_[_0xe9ef('0x30')](_0x20222f['model'],qs[_0xe9ef('0x32')](_0x3866c['query']['fields']));_0x3ae970[_0xe9ef('0x31')]=_0x3ae970[_0xe9ef('0x31')][_0xe9ef('0x33')]?_0x3ae970[_0xe9ef('0x31')]:_0x20222f[_0xe9ef('0x2a')];if(_0x3866c[_0xe9ef('0x2d')][_0xe9ef('0x34')]){_0x3ae970[_0xe9ef('0x35')]=[{'all':!![]}];}_0x3ae970=_[_0xe9ef('0x36')]({},_0x3ae970,_0x3866c[_0xe9ef('0x37')]);return db[_0xe9ef('0x2b')][_0xe9ef('0x38')](_0x3ae970)['then'](handleEntityNotFound(_0x837724,null))[_0xe9ef('0x23')](respondWithResult(_0x837724,null))[_0xe9ef('0x39')](handleError(_0x837724,null));};exports[_0xe9ef('0x3a')]=function(_0x112cba,_0x483562){return db[_0xe9ef('0x2b')][_0xe9ef('0x3a')](_0x112cba[_0xe9ef('0x3b')],{})[_0xe9ef('0x23')](respondWithResult(_0x483562,0xc9))[_0xe9ef('0x39')](handleError(_0x483562,null));};exports[_0xe9ef('0x3c')]=function(_0x10b3c6,_0x17de02){if(_0x10b3c6[_0xe9ef('0x3b')]['id']){delete _0x10b3c6[_0xe9ef('0x3b')]['id'];}return db[_0xe9ef('0x2b')][_0xe9ef('0x38')]({'where':{'id':_0x10b3c6[_0xe9ef('0x29')]['id']}})[_0xe9ef('0x23')](handleEntityNotFound(_0x17de02,null))[_0xe9ef('0x23')](saveUpdates(_0x10b3c6[_0xe9ef('0x3b')],null))[_0xe9ef('0x23')](respondWithResult(_0x17de02,null))[_0xe9ef('0x39')](handleError(_0x17de02,null));};exports[_0xe9ef('0x24')]=function(_0x1dc514,_0x24dc85){return db[_0xe9ef('0x2b')][_0xe9ef('0x38')]({'where':{'id':_0x1dc514[_0xe9ef('0x29')]['id']}})[_0xe9ef('0x23')](handleEntityNotFound(_0x24dc85,null))['then'](removeEntity(_0x24dc85,null))[_0xe9ef('0x39')](handleError(_0x24dc85,null));}; \ No newline at end of file +var _0x8917=['../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','then','sendStatus','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x5c5c21,_0x52e655){var _0x556200=function(_0x3cdec6){while(--_0x3cdec6){_0x5c5c21['push'](_0x5c5c21['shift']());}};_0x556200(++_0x52e655);}(_0x8917,0x1d7));var _0x7891=function(_0x9f3a12,_0x2093d3){_0x9f3a12=_0x9f3a12-0x0;var _0x3b637d=_0x8917[_0x9f3a12];return _0x3b637d;};'use strict';var emlformat=require(_0x7891('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7891('0x1'));var jsonpatch=require(_0x7891('0x2'));var rp=require(_0x7891('0x3'));var moment=require(_0x7891('0x4'));var BPromise=require(_0x7891('0x5'));var Mustache=require(_0x7891('0x6'));var util=require(_0x7891('0x7'));var path=require(_0x7891('0x8'));var sox=require(_0x7891('0x9'));var csv=require('to-csv');var ejs=require(_0x7891('0xa'));var fs=require('fs');var fs_extra=require(_0x7891('0xb'));var _=require(_0x7891('0xc'));var squel=require(_0x7891('0xd'));var crypto=require(_0x7891('0xe'));var jsforce=require(_0x7891('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7891('0x10'));var querystring=require('querystring');var Papa=require(_0x7891('0x11'));var Redis=require(_0x7891('0x12'));var authService=require(_0x7891('0x13'));var qs=require(_0x7891('0x14'));var as=require(_0x7891('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7891('0x16'))(_0x7891('0x17'));var utils=require(_0x7891('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7891('0x19'));var db=require(_0x7891('0x1a'))['db'];function respondWithStatusCode(_0x1a1dbc,_0x31692f){_0x31692f=_0x31692f||0xcc;return function(_0x1b481e){if(_0x1b481e){return _0x1a1dbc['sendStatus'](_0x31692f);}return _0x1a1dbc[_0x7891('0x1b')](_0x31692f)[_0x7891('0x1c')]();};}function respondWithResult(_0x2517f1,_0xc56bc0){_0xc56bc0=_0xc56bc0||0xc8;return function(_0x71e75c){if(_0x71e75c){return _0x2517f1[_0x7891('0x1b')](_0xc56bc0)['json'](_0x71e75c);}};}function respondWithFilteredResult(_0x1fa45b,_0x21a74f){return function(_0x5bfe12){if(_0x5bfe12){var _0x23286b=typeof _0x21a74f[_0x7891('0x1d')]==='undefined'&&typeof _0x21a74f[_0x7891('0x1e')]===_0x7891('0x1f');var _0x250f65=_0x5bfe12[_0x7891('0x20')];var _0x9ff8c2=_0x23286b?0x0:_0x21a74f[_0x7891('0x1d')];var _0x457f50=_0x23286b?_0x5bfe12[_0x7891('0x20')]:_0x21a74f[_0x7891('0x1d')]+_0x21a74f[_0x7891('0x1e')];var _0x20da1e;if(_0x457f50>=_0x250f65){_0x457f50=_0x250f65;_0x20da1e=0xc8;}else{_0x20da1e=0xce;}_0x1fa45b['status'](_0x20da1e);return _0x1fa45b['set'](_0x7891('0x21'),_0x9ff8c2+'-'+_0x457f50+'/'+_0x250f65)[_0x7891('0x22')](_0x5bfe12);}return null;};}function patchUpdates(_0x30b2ae){return function(_0x4c76fe){try{jsonpatch['apply'](_0x4c76fe,_0x30b2ae,!![]);}catch(_0x19a628){return BPromise[_0x7891('0x23')](_0x19a628);}return _0x4c76fe[_0x7891('0x24')]();};}function saveUpdates(_0x36f66a,_0x155a97){return function(_0xf09f20){if(_0xf09f20){return _0xf09f20[_0x7891('0x25')](_0x36f66a)['then'](function(_0x28a917){return _0x28a917;});}return null;};}function removeEntity(_0xab091c,_0x27f2e0){return function(_0x2de356){if(_0x2de356){return _0x2de356[_0x7891('0x26')]()[_0x7891('0x27')](function(){_0xab091c[_0x7891('0x1b')](0xcc)[_0x7891('0x1c')]();});}};}function handleEntityNotFound(_0x24372f,_0x2acda5){return function(_0x55108b){if(!_0x55108b){_0x24372f[_0x7891('0x28')](0x194);}return _0x55108b;};}function handleError(_0x369740,_0x397d03){_0x397d03=_0x397d03||0x1f4;return function(_0x12ed70){logger['error'](_0x12ed70[_0x7891('0x29')]);if(_0x12ed70['name']){delete _0x12ed70[_0x7891('0x2a')];}_0x369740[_0x7891('0x1b')](_0x397d03)[_0x7891('0x2b')](_0x12ed70);};}exports['show']=function(_0x4009f8,_0x1a6bef){var _0x44442f={'raw':!![],'where':{'id':_0x4009f8[_0x7891('0x2c')]['id']}},_0x263f13={};_0x263f13[_0x7891('0x2d')]=_[_0x7891('0x2e')](db['ChatProactiveAction'][_0x7891('0x2f')]);_0x263f13['query']=_[_0x7891('0x2e')](_0x4009f8[_0x7891('0x30')]);_0x263f13[_0x7891('0x31')]=_[_0x7891('0x32')](_0x263f13[_0x7891('0x2d')],_0x263f13[_0x7891('0x30')]);_0x44442f[_0x7891('0x33')]=_['intersection'](_0x263f13[_0x7891('0x2d')],qs[_0x7891('0x34')](_0x4009f8[_0x7891('0x30')][_0x7891('0x34')]));_0x44442f[_0x7891('0x33')]=_0x44442f[_0x7891('0x33')][_0x7891('0x35')]?_0x44442f['attributes']:_0x263f13['model'];if(_0x4009f8['query']['includeAll']){_0x44442f[_0x7891('0x36')]=[{'all':!![]}];}_0x44442f=_[_0x7891('0x37')]({},_0x44442f,_0x4009f8[_0x7891('0x38')]);return db[_0x7891('0x39')][_0x7891('0x3a')](_0x44442f)[_0x7891('0x27')](handleEntityNotFound(_0x1a6bef,null))['then'](respondWithResult(_0x1a6bef,null))[_0x7891('0x3b')](handleError(_0x1a6bef,null));};exports[_0x7891('0x3c')]=function(_0x19e258,_0x2c1c67){return db[_0x7891('0x39')][_0x7891('0x3c')](_0x19e258[_0x7891('0x3d')],{})['then'](respondWithResult(_0x2c1c67,0xc9))[_0x7891('0x3b')](handleError(_0x2c1c67,null));};exports['update']=function(_0x16ca6d,_0x5ba995){if(_0x16ca6d[_0x7891('0x3d')]['id']){delete _0x16ca6d[_0x7891('0x3d')]['id'];}return db[_0x7891('0x39')][_0x7891('0x3a')]({'where':{'id':_0x16ca6d[_0x7891('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5ba995,null))[_0x7891('0x27')](saveUpdates(_0x16ca6d[_0x7891('0x3d')],null))[_0x7891('0x27')](respondWithResult(_0x5ba995,null))[_0x7891('0x3b')](handleError(_0x5ba995,null));};exports[_0x7891('0x26')]=function(_0x516d5c,_0x4e63ee){return db['ChatProactiveAction'][_0x7891('0x3a')]({'where':{'id':_0x516d5c[_0x7891('0x2c')]['id']}})[_0x7891('0x27')](handleEntityNotFound(_0x4e63ee,null))[_0x7891('0x27')](removeEntity(_0x4e63ee,null))[_0x7891('0x3b')](handleError(_0x4e63ee,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index d8fe02a..ae34207 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 _0xe240=['exports','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x1aee6f,_0x425a26){var _0x1c4bec=function(_0x1f3419){while(--_0x1f3419){_0x1aee6f['push'](_0x1aee6f['shift']());}};_0x1c4bec(++_0x425a26);}(_0xe240,0x6f));var _0x0e24=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe240[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x0e24('0x0'));var util=require(_0x0e24('0x1'));var logger=require(_0x0e24('0x2'))(_0x0e24('0x3'));var moment=require('moment');var BPromise=require(_0x0e24('0x4'));var rp=require(_0x0e24('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e24('0x6'));var config=require(_0x0e24('0x7'));var attributes=require(_0x0e24('0x8'));module[_0x0e24('0x9')]=function(_0x2f0588,_0x205097){return _0x2f0588['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb92=['request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','moment','bluebird'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xbb92,0x1dc));var _0x2bb9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbb92[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2bb9('0x0'));var util=require('util');var logger=require(_0x2bb9('0x1'))('api');var moment=require(_0x2bb9('0x2'));var BPromise=require(_0x2bb9('0x3'));var rp=require(_0x2bb9('0x4'));var fs=require('fs');var path=require(_0x2bb9('0x5'));var rimraf=require(_0x2bb9('0x6'));var config=require('../../config/environment');var attributes=require(_0x2bb9('0x7'));module[_0x2bb9('0x8')]=function(_0x1e437b,_0x25698a){return _0x1e437b[_0x2bb9('0x9')](_0x2bb9('0xa'),attributes,{'tableName':_0x2bb9('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 ae51d84..dcaf96a 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 _0xa528=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0xf867c6,_0xf79088){var _0x350bd7=function(_0x3a9db9){while(--_0x3a9db9){_0xf867c6['push'](_0xf867c6['shift']());}};_0x350bd7(++_0xf79088);}(_0xa528,0x171));var _0x8a52=function(_0x3df21d,_0xa44265){_0x3df21d=_0x3df21d-0x0;var _0x37ab8a=_0xa528[_0x3df21d];return _0x37ab8a;};'use strict';var _=require(_0x8a52('0x0'));var util=require(_0x8a52('0x1'));var moment=require(_0x8a52('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a52('0x3'));var fs=require('fs');var Redis=require(_0x8a52('0x4'));var db=require(_0x8a52('0x5'))['db'];var utils=require(_0x8a52('0x6'));var logger=require(_0x8a52('0x7'))('rpc');var config=require(_0x8a52('0x8'));var jayson=require(_0x8a52('0x9'));var client=jayson[_0x8a52('0xa')][_0x8a52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x586cdf,_0x4d15dc,_0x2db1a7){return new BPromise(function(_0x381a42,_0x3136b1){return client[_0x8a52('0xc')](_0x586cdf,_0x2db1a7)[_0x8a52('0xd')](function(_0x112940){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4d15dc,_0x8a52('0xe'));logger[_0x8a52('0xf')](_0x8a52('0x10'),_0x4d15dc,'request\x20sent',JSON[_0x8a52('0x11')](_0x112940));if(_0x112940[_0x8a52('0x12')]){if(_0x112940['error'][_0x8a52('0x13')]===0x1f4){logger[_0x8a52('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d15dc,_0x112940[_0x8a52('0x12')][_0x8a52('0x14')]);return _0x3136b1(_0x112940[_0x8a52('0x12')][_0x8a52('0x14')]);}logger[_0x8a52('0x12')](_0x8a52('0x15'),_0x4d15dc,_0x112940[_0x8a52('0x12')][_0x8a52('0x14')]);return _0x381a42(_0x112940[_0x8a52('0x12')][_0x8a52('0x14')]);}else{logger['info'](_0x8a52('0x15'),_0x4d15dc,_0x8a52('0xe'));_0x381a42(_0x112940[_0x8a52('0x16')][_0x8a52('0x14')]);}})[_0x8a52('0x17')](function(_0x566dec){logger[_0x8a52('0x12')](_0x8a52('0x15'),_0x4d15dc,_0x566dec);_0x3136b1(_0x566dec);});});} \ No newline at end of file +var _0xa56c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa56c,0x1f4));var _0xca56=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xa56c[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xca56('0x0'));var util=require(_0xca56('0x1'));var moment=require('moment');var BPromise=require(_0xca56('0x2'));var rs=require(_0xca56('0x3'));var fs=require('fs');var Redis=require(_0xca56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xca56('0x5'));var logger=require(_0xca56('0x6'))(_0xca56('0x7'));var config=require(_0xca56('0x8'));var jayson=require(_0xca56('0x9'));var client=jayson[_0xca56('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3366cc,_0xc289c0,_0x180774){return new BPromise(function(_0x35b267,_0x3367e9){return client['request'](_0x3366cc,_0x180774)['then'](function(_0xfe68e3){logger['info'](_0xca56('0xb'),_0xc289c0,_0xca56('0xc'));logger[_0xca56('0xd')](_0xca56('0xe'),_0xc289c0,_0xca56('0xc'),JSON[_0xca56('0xf')](_0xfe68e3));if(_0xfe68e3['error']){if(_0xfe68e3[_0xca56('0x10')][_0xca56('0x11')]===0x1f4){logger[_0xca56('0x10')](_0xca56('0xb'),_0xc289c0,_0xfe68e3['error'][_0xca56('0x12')]);return _0x3367e9(_0xfe68e3['error'][_0xca56('0x12')]);}logger[_0xca56('0x10')](_0xca56('0xb'),_0xc289c0,_0xfe68e3['error'][_0xca56('0x12')]);return _0x35b267(_0xfe68e3[_0xca56('0x10')][_0xca56('0x12')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0xc289c0,_0xca56('0xc'));_0x35b267(_0xfe68e3[_0xca56('0x13')][_0xca56('0x12')]);}})[_0xca56('0x14')](function(_0x50f17a){logger[_0xca56('0x10')](_0xca56('0xb'),_0xc289c0,_0x50f17a);_0x3367e9(_0x50f17a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 6de97d6..de9b5c5 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 _0x2675=['../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','express','Router'];(function(_0x1bd7bb,_0x1ff5d5){var _0x168ba1=function(_0x4921ed){while(--_0x4921ed){_0x1bd7bb['push'](_0x1bd7bb['shift']());}};_0x168ba1(++_0x1ff5d5);}(_0x2675,0x75));var _0x5267=function(_0x919512,_0x189e52){_0x919512=_0x919512-0x0;var _0x38eecf=_0x2675[_0x919512];return _0x38eecf;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller[_0x5267('0x9')]);router[_0x5267('0xa')]('/',auth['isAuthenticated'](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x8')](),controller['update']);router[_0x5267('0xd')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file +var _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x59bb0e,_0x2aa7ab){_0x59bb0e=_0x59bb0e-0x0;var _0x28e70d=_0x8d0e[_0x59bb0e];return _0x28e70d;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 01b5436..0d5245f 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 _0x76f6=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0xf394de,_0x2a8f18){var _0x1251d5=function(_0x4073be){while(--_0x4073be){_0xf394de['push'](_0xf394de['shift']());}};_0x1251d5(++_0x2a8f18);}(_0x76f6,0x11b));var _0x676f=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x76f6[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require(_0x676f('0x0'));module[_0x676f('0x1')]={'name':{'type':Sequelize[_0x676f('0x2')],'unique':_0x676f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x676f('0x2')]},'timeout':{'type':Sequelize[_0x676f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x676f('0x5')](_0x676f('0x6'),'beepall',_0x676f('0x7'))}}; \ No newline at end of file +var _0x4893=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3e27c3,_0x463daf){var _0x49d8ad=function(_0x4a45c1){while(--_0x4a45c1){_0x3e27c3['push'](_0x3e27c3['shift']());}};_0x49d8ad(++_0x463daf);}(_0x4893,0x1df));var _0x3489=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x4893[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x3489('0x0'));module[_0x3489('0x1')]={'name':{'type':Sequelize[_0x3489('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3489('0x2')]},'timeout':{'type':Sequelize[_0x3489('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3489('0x4')](_0x3489('0x5'),_0x3489('0x6'),_0x3489('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a1456c0..ed789a0 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 _0xead3=['each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','squel','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','offset','undefined','limit','count','set','json','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','index','ChatQueue','fieldName','key','getOptions','where','include','query','findAll','catch','show','params','model','rawAttributes','filters','intersection','fields','attributes','includeAll','options','create','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','keys','UserChatQueue','length','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','merge','map','findAndCountAll','UserId','agent','chatPause','createdAt','rows','%s/%s','Team','getTeams','addTeams','ids','User','online','voicePause','interface','sequelize','transaction'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xead3,0x192));var _0x3ead=function(_0x49e734,_0xc04f4f){_0x49e734=_0x49e734-0x0;var _0x2a2d42=_0xead3[_0x49e734];return _0x2a2d42;};'use strict';var BPromise=require(_0x3ead('0x0'));var util=require('util');var _=require(_0x3ead('0x1'));var squel=require(_0x3ead('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3ead('0x3'))(_0x3ead('0x4'));var config=require(_0x3ead('0x5'));var db=require(_0x3ead('0x6'))['db'];config[_0x3ead('0x7')]=_[_0x3ead('0x8')](config[_0x3ead('0x7')],{'host':_0x3ead('0x9'),'port':0x18eb});var socket=require(_0x3ead('0xa'))(new Redis(config[_0x3ead('0x7')]));require(_0x3ead('0xb'))[_0x3ead('0xc')](socket);function respondWithStatusCode(_0x34fc47,_0x2bb576){_0x2bb576=_0x2bb576||0xcc;return function(_0x313040){if(_0x313040){return _0x34fc47['sendStatus'](_0x2bb576);}return _0x34fc47[_0x3ead('0xd')](_0x2bb576)[_0x3ead('0xe')]();};}function respondWithResult(_0x4b1757,_0x30b138){_0x30b138=_0x30b138||0xc8;return function(_0x107358){if(_0x107358){return _0x4b1757[_0x3ead('0xd')](_0x30b138)['json'](_0x107358);}};}function respondWithFilteredResult(_0x259dd5,_0x1163a2){return function(_0x2907a3){if(_0x2907a3){var _0x16764c=typeof _0x1163a2[_0x3ead('0xf')]===_0x3ead('0x10')&&typeof _0x1163a2[_0x3ead('0x11')]===_0x3ead('0x10');var _0x69dc5f=_0x2907a3[_0x3ead('0x12')];var _0x5df426=_0x16764c?0x0:_0x1163a2[_0x3ead('0xf')];var _0x441168=_0x16764c?_0x2907a3[_0x3ead('0x12')]:_0x1163a2[_0x3ead('0xf')]+_0x1163a2[_0x3ead('0x11')];var _0x329d03;if(_0x441168>=_0x69dc5f){_0x441168=_0x69dc5f;_0x329d03=0xc8;}else{_0x329d03=0xce;}_0x259dd5['status'](_0x329d03);return _0x259dd5[_0x3ead('0x13')]('Content-Range',_0x5df426+'-'+_0x441168+'/'+_0x69dc5f)[_0x3ead('0x14')](_0x2907a3);}return null;};}function saveUpdates(_0x42e580){return function(_0x391b0d){if(_0x391b0d){return _0x391b0d['update'](_0x42e580)[_0x3ead('0x15')](function(_0x3e45fa){return _0x3e45fa;});}return null;};}function removeEntity(_0xad139c){return function(_0x24f077){if(_0x24f077){return _0x24f077['destroy']()[_0x3ead('0x15')](function(){var _0x70e43e=_0x24f077[_0x3ead('0x16')]({'plain':!![]});var _0x2922fb='ChatQueues';return db[_0x3ead('0x17')][_0x3ead('0x18')]({'where':{'type':_0x2922fb,'resourceId':_0x70e43e['id']}})[_0x3ead('0x15')](function(){return _0x24f077;});})[_0x3ead('0x15')](function(){_0xad139c[_0x3ead('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52260d){return function(_0x4294bb){if(!_0x4294bb){_0x52260d[_0x3ead('0x19')](0x194);}return _0x4294bb;};}function handleError(_0x55e32e,_0x187efd){_0x187efd=_0x187efd||0x1f4;return function(_0x5d3225){logger[_0x3ead('0x1a')](_0x5d3225[_0x3ead('0x1b')]);if(_0x5d3225[_0x3ead('0x1c')]){delete _0x5d3225[_0x3ead('0x1c')];}_0x55e32e[_0x3ead('0xd')](_0x187efd)['send'](_0x5d3225);};}exports[_0x3ead('0x1d')]=function(_0x1d0ae3,_0x4dc4f9){var _0x4aece3={};var _0x4d6caa={'count':0x0,'rows':[]};var _0x3540e4=_['map'](db[_0x3ead('0x1e')]['rawAttributes'],function(_0x2bfe9b){return{'name':_0x2bfe9b[_0x3ead('0x1f')],'type':_0x2bfe9b['type'][_0x3ead('0x20')]};});_0x4aece3=qs[_0x3ead('0x21')](_0x3540e4,_0x1d0ae3);var _0x400c45={'where':_0x4aece3[_0x3ead('0x22')]};return db[_0x3ead('0x1e')][_0x3ead('0x12')](_0x400c45)[_0x3ead('0x15')](function(_0x3e8f87){_0x4d6caa[_0x3ead('0x12')]=_0x3e8f87;_0x4aece3[_0x3ead('0x23')]=qs[_0x3ead('0x23')](_0x1d0ae3[_0x3ead('0x24')]);return db[_0x3ead('0x1e')][_0x3ead('0x25')](_0x4aece3);})['then'](function(_0x46ec19){_0x4d6caa['rows']=_0x46ec19;return _0x4d6caa;})[_0x3ead('0x15')](respondWithFilteredResult(_0x4dc4f9,_0x4aece3))[_0x3ead('0x26')](handleError(_0x4dc4f9,null));};exports[_0x3ead('0x27')]=function(_0x13fd8a,_0x52a803){var _0x2cdc07={'raw':!![],'where':{'id':_0x13fd8a[_0x3ead('0x28')]['id']}},_0x131c90={};_0x131c90[_0x3ead('0x29')]=_['keys'](db[_0x3ead('0x1e')][_0x3ead('0x2a')]);_0x131c90['query']=_['keys'](_0x13fd8a['query']);_0x131c90[_0x3ead('0x2b')]=_[_0x3ead('0x2c')](_0x131c90['model'],_0x131c90[_0x3ead('0x24')]);_0x2cdc07['attributes']=_[_0x3ead('0x2c')](_0x131c90[_0x3ead('0x29')],qs[_0x3ead('0x2d')](_0x13fd8a[_0x3ead('0x24')]['fields']));_0x2cdc07[_0x3ead('0x2e')]=_0x2cdc07[_0x3ead('0x2e')]['length']?_0x2cdc07[_0x3ead('0x2e')]:_0x131c90[_0x3ead('0x29')];if(_0x13fd8a[_0x3ead('0x24')][_0x3ead('0x2f')]){_0x2cdc07[_0x3ead('0x23')]=[{'all':!![]}];}_0x2cdc07=_['merge']({},_0x2cdc07,_0x13fd8a[_0x3ead('0x30')]);return db[_0x3ead('0x1e')]['find'](_0x2cdc07)[_0x3ead('0x15')](handleEntityNotFound(_0x52a803,null))[_0x3ead('0x15')](respondWithResult(_0x52a803,null))[_0x3ead('0x26')](handleError(_0x52a803,null));};exports[_0x3ead('0x31')]=function(_0x5634ae,_0x770937){return db[_0x3ead('0x1e')][_0x3ead('0x31')](_0x5634ae['body'],{})[_0x3ead('0x15')](function(_0x390923){var _0xec564b=_0x5634ae['user'][_0x3ead('0x16')]({'plain':!![]});if(!_0xec564b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xec564b[_0x3ead('0x32')]===_0x3ead('0x33')){var _0x18b387=_0x390923[_0x3ead('0x16')]({'plain':!![]});var _0x147936='ChatQueues';return db[_0x3ead('0x34')][_0x3ead('0x35')]({'where':{'name':_0x147936,'userProfileId':_0xec564b[_0x3ead('0x36')]},'raw':!![]})[_0x3ead('0x15')](function(_0x43511e){if(_0x43511e&&_0x43511e[_0x3ead('0x37')]===0x0){return db[_0x3ead('0x17')][_0x3ead('0x31')]({'name':_0x18b387['name'],'resourceId':_0x18b387['id'],'type':_0x43511e['name'],'sectionId':_0x43511e['id']},{})[_0x3ead('0x15')](function(){return _0x390923;});}else{return _0x390923;}})[_0x3ead('0x26')](function(_0x6b3e0c){logger[_0x3ead('0x1a')](_0x3ead('0x38'),_0x6b3e0c);throw _0x6b3e0c;});}return _0x390923;})[_0x3ead('0x15')](respondWithResult(_0x770937,0xc9))[_0x3ead('0x26')](handleError(_0x770937,null));};exports[_0x3ead('0x39')]=function(_0x9c2484,_0x2f22b7){if(_0x9c2484[_0x3ead('0x3a')]['id']){delete _0x9c2484['body']['id'];}return db[_0x3ead('0x1e')][_0x3ead('0x35')]({'where':{'id':_0x9c2484['params']['id']}})['then'](handleEntityNotFound(_0x2f22b7,null))[_0x3ead('0x15')](saveUpdates(_0x9c2484['body'],null))[_0x3ead('0x15')](respondWithResult(_0x2f22b7,null))[_0x3ead('0x26')](handleError(_0x2f22b7,null));};exports[_0x3ead('0x18')]=function(_0x2805aa,_0x3eb53a){return db['ChatQueue'][_0x3ead('0x35')]({'where':{'id':_0x2805aa[_0x3ead('0x28')]['id']}})[_0x3ead('0x15')](handleEntityNotFound(_0x3eb53a,null))[_0x3ead('0x15')](removeEntity(_0x3eb53a,null))[_0x3ead('0x26')](handleError(_0x3eb53a,null));};exports[_0x3ead('0x3b')]=function(_0x39407b,_0x206b10){return db[_0x3ead('0x1e')][_0x3ead('0x3b')]()[_0x3ead('0x15')](respondWithResult(_0x206b10,null))[_0x3ead('0x26')](handleError(_0x206b10,null));};exports['getMembers']=function(_0x1c11eb,_0x461ffb){var _0x3b513e={'raw':!![],'where':{}},_0x107e6b={},_0x127244;return db[_0x3ead('0x1e')][_0x3ead('0x3c')]({'where':{'id':_0x1c11eb[_0x3ead('0x28')]['id']}})['then'](handleEntityNotFound(_0x461ffb,null))[_0x3ead('0x15')](function(_0x408c61){if(_0x408c61){_0x127244=_0x408c61['get']({'plain':!![]});_0x107e6b[_0x3ead('0x29')]=_[_0x3ead('0x3d')](db[_0x3ead('0x3e')][_0x3ead('0x2a')]);_0x107e6b[_0x3ead('0x24')]=_[_0x3ead('0x3d')](_0x1c11eb['query']);_0x107e6b[_0x3ead('0x2b')]=_['intersection'](_0x107e6b[_0x3ead('0x29')],_0x107e6b[_0x3ead('0x24')]);_0x3b513e[_0x3ead('0x2e')]=_['intersection'](_0x107e6b[_0x3ead('0x29')],qs[_0x3ead('0x2d')](_0x1c11eb['query'][_0x3ead('0x2d')]));_0x3b513e[_0x3ead('0x2e')]=_0x3b513e[_0x3ead('0x2e')][_0x3ead('0x3f')]?_0x3b513e[_0x3ead('0x2e')]:_0x107e6b[_0x3ead('0x29')];if(!_0x1c11eb[_0x3ead('0x24')][_0x3ead('0x40')](_0x3ead('0x41'))){_0x3b513e[_0x3ead('0x11')]=qs['limit'](_0x1c11eb['query']['limit']);_0x3b513e[_0x3ead('0xf')]=qs[_0x3ead('0xf')](_0x1c11eb[_0x3ead('0x24')][_0x3ead('0xf')]);}_0x3b513e[_0x3ead('0x42')]=qs[_0x3ead('0x43')](_0x1c11eb[_0x3ead('0x24')][_0x3ead('0x43')]);_0x3b513e[_0x3ead('0x22')]=qs[_0x3ead('0x2b')](_[_0x3ead('0x44')](_0x1c11eb[_0x3ead('0x24')],_0x107e6b[_0x3ead('0x2b')]));_0x3b513e['where'][_0x3ead('0x45')]=_0x408c61['id'];if(_0x1c11eb[_0x3ead('0x24')][_0x3ead('0x46')]){_0x3b513e[_0x3ead('0x22')]=_[_0x3ead('0x47')](_0x3b513e['where'],{'$or':_[_0x3ead('0x48')](_0x3b513e[_0x3ead('0x2e')],function(_0x15b0b3){var _0x51a6ca={};_0x51a6ca[_0x15b0b3]={'$like':'%'+_0x1c11eb[_0x3ead('0x24')]['filter']+'%'};return _0x51a6ca;})});}_0x3b513e=_[_0x3ead('0x47')]({},_0x3b513e,_0x1c11eb[_0x3ead('0x30')]);return db[_0x3ead('0x3e')]['findAll'](_0x3b513e);}})[_0x3ead('0x15')](function(_0x1c6c05){if(_0x1c6c05){return db['User'][_0x3ead('0x49')]({'where':{'id':_[_0x3ead('0x48')](_0x1c6c05,_0x3ead('0x4a')),'role':_0x3ead('0x4b')},'attributes':['id',_0x3ead('0x1c'),_0x3ead('0x4c'),'updatedAt',_0x3ead('0x4d')]});}})[_0x3ead('0x15')](function(_0x166c38){if(_0x166c38){return{'count':_0x166c38[_0x3ead('0x12')],'rows':_['map'](_0x166c38[_0x3ead('0x4e')],function(_0x1a441d){return{'membername':_0x1a441d[_0x3ead('0x1c')],'UserId':_0x1a441d['id'],'queue_name':_0x127244[_0x3ead('0x1c')],'ChatQueueId':_0x127244['id'],'interface':util['format'](_0x3ead('0x4f'),'SIP',_0x1a441d[_0x3ead('0x1c')]),'penalty':0x0,'paused':_0x1a441d[_0x3ead('0x4c')],'createdAt':_0x1a441d['createdAt'],'updatedAt':_0x1a441d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x461ffb,_0x3b513e))[_0x3ead('0x26')](handleError(_0x461ffb,null));};exports['getTeams']=function(_0x50d40b,_0x862207){var _0x560279={};var _0x5b74b9={};var _0x1ebd20;var _0x4febd0;return db[_0x3ead('0x1e')][_0x3ead('0x3c')]({'where':{'id':_0x50d40b['params']['id']}})[_0x3ead('0x15')](handleEntityNotFound(_0x862207,null))[_0x3ead('0x15')](function(_0x21aba0){if(_0x21aba0){_0x1ebd20=_0x21aba0;_0x5b74b9[_0x3ead('0x29')]=_[_0x3ead('0x3d')](db[_0x3ead('0x50')][_0x3ead('0x2a')]);_0x5b74b9[_0x3ead('0x24')]=_[_0x3ead('0x3d')](_0x50d40b[_0x3ead('0x24')]);_0x5b74b9[_0x3ead('0x2b')]=_['intersection'](_0x5b74b9[_0x3ead('0x29')],_0x5b74b9[_0x3ead('0x24')]);_0x560279[_0x3ead('0x2e')]=_[_0x3ead('0x2c')](_0x5b74b9[_0x3ead('0x29')],qs[_0x3ead('0x2d')](_0x50d40b['query'][_0x3ead('0x2d')]));_0x560279['attributes']=_0x560279[_0x3ead('0x2e')]['length']?_0x560279[_0x3ead('0x2e')]:_0x5b74b9['model'];_0x560279['order']=qs[_0x3ead('0x43')](_0x50d40b[_0x3ead('0x24')][_0x3ead('0x43')]);_0x560279[_0x3ead('0x22')]=qs[_0x3ead('0x2b')](_['pick'](_0x50d40b['query'],_0x5b74b9[_0x3ead('0x2b')]));if(_0x50d40b[_0x3ead('0x24')][_0x3ead('0x46')]){_0x560279[_0x3ead('0x22')]=_[_0x3ead('0x47')](_0x560279[_0x3ead('0x22')],{'$or':_['map'](_0x560279[_0x3ead('0x2e')],function(_0x1faa3d){var _0x24e714={};_0x24e714[_0x1faa3d]={'$like':'%'+_0x50d40b[_0x3ead('0x24')][_0x3ead('0x46')]+'%'};return _0x24e714;})});}_0x560279=_[_0x3ead('0x47')]({},_0x560279,_0x50d40b[_0x3ead('0x30')]);return _0x1ebd20[_0x3ead('0x51')](_0x560279);}})[_0x3ead('0x15')](function(_0x248cbd){if(_0x248cbd){_0x4febd0=_0x248cbd['length'];if(!_0x50d40b[_0x3ead('0x24')][_0x3ead('0x40')](_0x3ead('0x41'))){_0x560279[_0x3ead('0x11')]=qs[_0x3ead('0x11')](_0x50d40b['query'][_0x3ead('0x11')]);_0x560279['offset']=qs[_0x3ead('0xf')](_0x50d40b['query'][_0x3ead('0xf')]);}return _0x1ebd20['getTeams'](_0x560279);}})[_0x3ead('0x15')](function(_0x27c39f){if(_0x27c39f){return _0x27c39f?{'count':_0x4febd0,'rows':_0x27c39f}:null;}})[_0x3ead('0x15')](respondWithResult(_0x862207,null))[_0x3ead('0x26')](handleError(_0x862207,null));};exports[_0x3ead('0x52')]=function(_0x2d4a95,_0x16cebb){var _0x414c1e=_0x2d4a95['body'][_0x3ead('0x53')];return db['Team'][_0x3ead('0x25')]({'where':{'id':_0x414c1e},'attributes':['id'],'include':[{'model':db[_0x3ead('0x54')],'as':'Agents','attributes':['id',_0x3ead('0x1c'),_0x3ead('0x55'),_0x3ead('0x56'),_0x3ead('0x57')],'raw':!![]}]})[_0x3ead('0x15')](function(_0x499e89){if(_0x499e89){var _0x34091e=_['flatMap'](_0x499e89,function(_0x4809e6){var _0x24ad06=_0x4809e6[_0x3ead('0x16')]({'plain':!![]});return _0x24ad06['Agents'];});return db['ChatQueue'][_0x3ead('0x35')]({'where':{'id':_0x2d4a95[_0x3ead('0x28')]['id']}})[_0x3ead('0x15')](function(_0x166d6d){return db[_0x3ead('0x58')][_0x3ead('0x59')](function(_0x262c41){return _0x166d6d['addTeams'](_0x414c1e,{'transaction':_0x262c41})[_0x3ead('0x15')](function(){return BPromise[_0x3ead('0x5a')](_0x34091e,function(_0x1ebf4d){return db['UserChatQueue'][_0x3ead('0x5b')]({'where':{'UserId':_0x1ebf4d['id'],'ChatQueueId':_0x2d4a95[_0x3ead('0x28')]['id']},'transaction':_0x262c41});});})[_0x3ead('0x15')](function(){_0x34091e[_0x3ead('0x5c')](function(_0x2a74ae){socket[_0x3ead('0x5d')](_0x3ead('0x5e'),{'UserId':_0x2a74ae['id'],'ChatQueueId':_0x166d6d['id']});});});});});}})['then'](respondWithStatusCode(_0x16cebb,null))[_0x3ead('0x26')](handleError(_0x16cebb,null));};exports[_0x3ead('0x5f')]=function(_0xb27907,_0x4173ee){return db['Team']['findAll']({'where':{'id':_0xb27907['query'][_0x3ead('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3ead('0x60'),'attributes':['id'],'raw':!![]}]})[_0x3ead('0x15')](handleEntityNotFound(_0x4173ee,null))['then'](function(_0x375bca){var _0x21911d=_[_0x3ead('0x48')](_0x375bca,'id');var _0x3689a8=[];var _0x3732c4=[];var _0x3ea8aa=squel[_0x3ead('0x61')]();_0x3ea8aa[_0x3ead('0x62')](_0x3ead('0x63'))[_0x3ead('0x64')](_0x3ead('0x65'),'tq')[_0x3ead('0x66')](_0x3ead('0x67'),'ut',_0x3ead('0x68'))[_0x3ead('0x22')]('ChatQueueId\x20=\x20?',_0xb27907[_0x3ead('0x28')]['id']);for(var _0x961565=0x0;_0x961565<_0x375bca[_0x3ead('0x3f')];_0x961565+=0x1){let _0x17898e=_0x375bca[_0x961565];for(var _0x37355c=0x0;_0x37355c<_0x17898e[_0x3ead('0x60')]['length'];_0x37355c+=0x1){let _0x111ef6=_0x17898e[_0x3ead('0x60')][_0x37355c];var _0x29297a=_0x3ea8aa[_0x3ead('0x69')]();_0x29297a[_0x3ead('0x22')](_0x3ead('0x6a'),_0x111ef6['id']);_0x3732c4[_0x3ead('0x6b')](db['sequelize']['query'](_0x29297a[_0x3ead('0x6c')](),{'type':db['sequelize'][_0x3ead('0x6d')][_0x3ead('0x6e')]})['then'](function(_0x137593){if(_0x137593['length']===0x1){return _0x111ef6['id'];}else{var _0x4dd5ce=_[_0x3ead('0x6f')](_[_0x3ead('0x48')](_0x137593,'TeamId'),function(_0x27aec1){return _[_0x3ead('0x70')](_0x21911d,_0x27aec1);});if(_0x4dd5ce){return _0x111ef6['id'];}}}));}}return BPromise['all'](_0x3732c4)[_0x3ead('0x15')](function(_0x411c2a){_0x3689a8=_(_0x3689a8)[_0x3ead('0x71')](_0x411c2a)[_0x3ead('0x72')]()[_0x3ead('0x73')]();return db[_0x3ead('0x1e')][_0x3ead('0x35')]({'where':{'id':_0xb27907[_0x3ead('0x28')]['id']}})[_0x3ead('0x15')](function(_0x54c616){return db[_0x3ead('0x58')][_0x3ead('0x59')](function(_0x156e2e){return _0x54c616['removeTeams'](_0xb27907['query'][_0x3ead('0x53')],{'transaction':_0x156e2e})[_0x3ead('0x15')](function(){if(!_['isEmpty'](_0x3689a8)){return _0x54c616[_0x3ead('0x74')](_0x3689a8,{'transaction':_0x156e2e});}})[_0x3ead('0x15')](function(){_0x3689a8[_0x3ead('0x5c')](function(_0x5e39bb){socket[_0x3ead('0x5d')](_0x3ead('0x75'),{'UserId':_0x5e39bb,'ChatQueueId':_0x54c616['id']});});});});});});})[_0x3ead('0x15')](respondWithStatusCode(_0x4173ee,null))[_0x3ead('0x26')](handleError(_0x4173ee,null));};exports[_0x3ead('0x76')]=function(_0xa09138,_0x5c725d){return db[_0x3ead('0x1e')][_0x3ead('0x35')]({'where':{'id':_0xa09138[_0x3ead('0x28')]['id']}})['then'](handleEntityNotFound(_0x5c725d,null))[_0x3ead('0x15')](function(_0x2d7cb2){if(_0x2d7cb2){return _0x2d7cb2[_0x3ead('0x76')](_0xa09138['body'][_0x3ead('0x53')],_[_0x3ead('0x77')](_0xa09138[_0x3ead('0x3a')],[_0x3ead('0x53'),'id'])||{})[_0x3ead('0x78')](function(_0xbaba7d){for(var _0x4033b3=0x0;_0x4033b3<_0xa09138[_0x3ead('0x3a')][_0x3ead('0x53')][_0x3ead('0x3f')];_0x4033b3+=0x1){socket[_0x3ead('0x5d')](_0x3ead('0x5e'),{'UserId':Number(_0xa09138[_0x3ead('0x3a')]['ids'][_0x4033b3]),'ChatQueueId':Number(_0xa09138[_0x3ead('0x28')]['id'])});}return _0xbaba7d;});}})[_0x3ead('0x15')](respondWithResult(_0x5c725d,null))[_0x3ead('0x26')](handleError(_0x5c725d,null));};exports['removeAgents']=function(_0x3ce110,_0x586a8b){return db[_0x3ead('0x1e')][_0x3ead('0x35')]({'where':{'id':_0x3ce110[_0x3ead('0x28')]['id']}})[_0x3ead('0x15')](handleEntityNotFound(_0x586a8b,null))[_0x3ead('0x15')](function(_0x3d3624){if(_0x3d3624){return _0x3d3624[_0x3ead('0x74')](_0x3ce110['query'][_0x3ead('0x53')])[_0x3ead('0x15')](function(){if(_[_0x3ead('0x79')](_0x3ce110[_0x3ead('0x24')][_0x3ead('0x53')])){for(var _0x5733e5=0x0;_0x5733e5<_0x3ce110[_0x3ead('0x24')][_0x3ead('0x53')][_0x3ead('0x3f')];_0x5733e5+=0x1){socket['emit'](_0x3ead('0x75'),{'UserId':Number(_0x3ce110['query'][_0x3ead('0x53')][_0x5733e5]),'ChatQueueId':Number(_0x3ce110[_0x3ead('0x28')]['id'])});}}else{socket[_0x3ead('0x5d')](_0x3ead('0x75'),{'UserId':Number(_0x3ce110[_0x3ead('0x24')]['ids']),'ChatQueueId':Number(_0x3ce110[_0x3ead('0x28')]['id'])});}});}})[_0x3ead('0x15')](respondWithStatusCode(_0x586a8b,null))[_0x3ead('0x26')](handleError(_0x586a8b,null));};exports[_0x3ead('0x7a')]=function(_0x4c65e1,_0x5ca3ae){var _0x3f6205={};var _0x87753d={};var _0x56e53a;var _0x35ea3d;return db[_0x3ead('0x1e')][_0x3ead('0x3c')]({'where':{'id':_0x4c65e1[_0x3ead('0x28')]['id']}})[_0x3ead('0x15')](handleEntityNotFound(_0x5ca3ae,null))[_0x3ead('0x15')](function(_0x5eb44a){if(_0x5eb44a){_0x56e53a=_0x5eb44a;_0x87753d[_0x3ead('0x29')]=_[_0x3ead('0x3d')](db[_0x3ead('0x54')][_0x3ead('0x2a')]);_0x87753d[_0x3ead('0x24')]=_[_0x3ead('0x3d')](_0x4c65e1[_0x3ead('0x24')]);_0x87753d[_0x3ead('0x2b')]=_[_0x3ead('0x2c')](_0x87753d[_0x3ead('0x29')],_0x87753d[_0x3ead('0x24')]);_0x3f6205[_0x3ead('0x2e')]=_[_0x3ead('0x2c')](_0x87753d['model'],qs[_0x3ead('0x2d')](_0x4c65e1[_0x3ead('0x24')]['fields']));_0x3f6205[_0x3ead('0x2e')]=_0x3f6205[_0x3ead('0x2e')]['length']?_0x3f6205[_0x3ead('0x2e')]:_0x87753d[_0x3ead('0x29')];_0x3f6205[_0x3ead('0x42')]=qs[_0x3ead('0x43')](_0x4c65e1[_0x3ead('0x24')][_0x3ead('0x43')]);_0x3f6205['where']=qs['filters'](_[_0x3ead('0x44')](_0x4c65e1[_0x3ead('0x24')],_0x87753d[_0x3ead('0x2b')]));if(_0x4c65e1[_0x3ead('0x24')][_0x3ead('0x46')]){_0x3f6205[_0x3ead('0x22')]=_[_0x3ead('0x47')](_0x3f6205[_0x3ead('0x22')],{'$or':_[_0x3ead('0x48')](_0x3f6205[_0x3ead('0x2e')],function(_0xcc82c4){var _0x36f1f0={};_0x36f1f0[_0xcc82c4]={'$like':'%'+_0x4c65e1[_0x3ead('0x24')][_0x3ead('0x46')]+'%'};return _0x36f1f0;})});}_0x3f6205=_['merge']({},_0x3f6205,_0x4c65e1['options']);return _0x56e53a['getAgents'](_0x3f6205);}})['then'](function(_0x450ee7){if(_0x450ee7){_0x35ea3d=_0x450ee7[_0x3ead('0x3f')];if(!_0x4c65e1[_0x3ead('0x24')][_0x3ead('0x40')](_0x3ead('0x41'))){_0x3f6205[_0x3ead('0x11')]=qs[_0x3ead('0x11')](_0x4c65e1[_0x3ead('0x24')][_0x3ead('0x11')]);_0x3f6205[_0x3ead('0xf')]=qs[_0x3ead('0xf')](_0x4c65e1[_0x3ead('0x24')][_0x3ead('0xf')]);}return _0x56e53a[_0x3ead('0x7a')](_0x3f6205);}})['then'](function(_0x576d03){if(_0x576d03){return _0x576d03?{'count':_0x35ea3d,'rows':_0x576d03}:null;}})[_0x3ead('0x15')](respondWithResult(_0x5ca3ae,null))[_0x3ead('0x26')](handleError(_0x5ca3ae,null));}; \ No newline at end of file +var _0x84c4=['toString','sequelize','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','ChatQueues','name','send','index','rawAttributes','fieldName','type','key','getOptions','include','ChatQueue','rows','catch','show','keys','query','attributes','intersection','model','fields','length','includeAll','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','find','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','where','map','merge','options','findAll','User','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','params','Team','pick','ids','online','voicePause','Agents','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x5219aa,_0x357da6){var _0x479261=function(_0x552e4e){while(--_0x552e4e){_0x5219aa['push'](_0x5219aa['shift']());}};_0x479261(++_0x357da6);}(_0x84c4,0x184));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x484c('0x0'));var util=require(_0x484c('0x1'));var _=require(_0x484c('0x2'));var squel=require(_0x484c('0x3'));var Redis=require(_0x484c('0x4'));var qs=require(_0x484c('0x5'));var logger=require(_0x484c('0x6'))(_0x484c('0x7'));var config=require(_0x484c('0x8'));var db=require(_0x484c('0x9'))['db'];config[_0x484c('0xa')]=_[_0x484c('0xb')](config[_0x484c('0xa')],{'host':_0x484c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x484c('0xa')]));require(_0x484c('0xd'))[_0x484c('0xe')](socket);function respondWithStatusCode(_0x2a42f9,_0x2e2a6d){_0x2e2a6d=_0x2e2a6d||0xcc;return function(_0x250b16){if(_0x250b16){return _0x2a42f9[_0x484c('0xf')](_0x2e2a6d);}return _0x2a42f9[_0x484c('0x10')](_0x2e2a6d)[_0x484c('0x11')]();};}function respondWithResult(_0x56eab3,_0x32bec3){_0x32bec3=_0x32bec3||0xc8;return function(_0x55b14f){if(_0x55b14f){return _0x56eab3[_0x484c('0x10')](_0x32bec3)[_0x484c('0x12')](_0x55b14f);}};}function respondWithFilteredResult(_0x47e773,_0xf2dd1f){return function(_0x1e34ed){if(_0x1e34ed){var _0x3c5432=typeof _0xf2dd1f[_0x484c('0x13')]==='undefined'&&typeof _0xf2dd1f[_0x484c('0x14')]===_0x484c('0x15');var _0x1fe6c9=_0x1e34ed[_0x484c('0x16')];var _0x150b98=_0x3c5432?0x0:_0xf2dd1f[_0x484c('0x13')];var _0x266f4f=_0x3c5432?_0x1e34ed[_0x484c('0x16')]:_0xf2dd1f[_0x484c('0x13')]+_0xf2dd1f[_0x484c('0x14')];var _0x2c3fb5;if(_0x266f4f>=_0x1fe6c9){_0x266f4f=_0x1fe6c9;_0x2c3fb5=0xc8;}else{_0x2c3fb5=0xce;}_0x47e773[_0x484c('0x10')](_0x2c3fb5);return _0x47e773[_0x484c('0x17')](_0x484c('0x18'),_0x150b98+'-'+_0x266f4f+'/'+_0x1fe6c9)['json'](_0x1e34ed);}return null;};}function saveUpdates(_0x3e94aa){return function(_0x542c0a){if(_0x542c0a){return _0x542c0a[_0x484c('0x19')](_0x3e94aa)[_0x484c('0x1a')](function(_0x3d4b52){return _0x3d4b52;});}return null;};}function removeEntity(_0x3e1560){return function(_0x36403e){if(_0x36403e){return _0x36403e[_0x484c('0x1b')]()[_0x484c('0x1a')](function(){var _0x1901f6=_0x36403e[_0x484c('0x1c')]({'plain':!![]});var _0x46b8e6=_0x484c('0x1d');return db['UserProfileResource'][_0x484c('0x1b')]({'where':{'type':_0x46b8e6,'resourceId':_0x1901f6['id']}})['then'](function(){return _0x36403e;});})[_0x484c('0x1a')](function(){_0x3e1560[_0x484c('0x10')](0xcc)[_0x484c('0x11')]();});}};}function handleEntityNotFound(_0x1e9e93){return function(_0x353f9f){if(!_0x353f9f){_0x1e9e93[_0x484c('0xf')](0x194);}return _0x353f9f;};}function handleError(_0x26a9e9,_0x564c6b){_0x564c6b=_0x564c6b||0x1f4;return function(_0x22c3df){logger['error'](_0x22c3df['stack']);if(_0x22c3df['name']){delete _0x22c3df[_0x484c('0x1e')];}_0x26a9e9[_0x484c('0x10')](_0x564c6b)[_0x484c('0x1f')](_0x22c3df);};}exports[_0x484c('0x20')]=function(_0xdb2785,_0x58a484){var _0x432e4c={};var _0x7c7e7={'count':0x0,'rows':[]};var _0x94c105=_['map'](db['ChatQueue'][_0x484c('0x21')],function(_0x16ee52){return{'name':_0x16ee52[_0x484c('0x22')],'type':_0x16ee52[_0x484c('0x23')][_0x484c('0x24')]};});_0x432e4c=qs[_0x484c('0x25')](_0x94c105,_0xdb2785);var _0xe196a3={'where':_0x432e4c['where']};return db['ChatQueue'][_0x484c('0x16')](_0xe196a3)[_0x484c('0x1a')](function(_0x51a6d3){_0x7c7e7['count']=_0x51a6d3;_0x432e4c[_0x484c('0x26')]=qs[_0x484c('0x26')](_0xdb2785['query']);return db[_0x484c('0x27')]['findAll'](_0x432e4c);})[_0x484c('0x1a')](function(_0x5709a4){_0x7c7e7[_0x484c('0x28')]=_0x5709a4;return _0x7c7e7;})[_0x484c('0x1a')](respondWithFilteredResult(_0x58a484,_0x432e4c))[_0x484c('0x29')](handleError(_0x58a484,null));};exports[_0x484c('0x2a')]=function(_0x1ff876,_0x53d9a6){var _0x4b622e={'raw':!![],'where':{'id':_0x1ff876['params']['id']}},_0x1196ce={};_0x1196ce['model']=_[_0x484c('0x2b')](db['ChatQueue'][_0x484c('0x21')]);_0x1196ce['query']=_[_0x484c('0x2b')](_0x1ff876[_0x484c('0x2c')]);_0x1196ce['filters']=_['intersection'](_0x1196ce['model'],_0x1196ce['query']);_0x4b622e[_0x484c('0x2d')]=_[_0x484c('0x2e')](_0x1196ce[_0x484c('0x2f')],qs[_0x484c('0x30')](_0x1ff876[_0x484c('0x2c')]['fields']));_0x4b622e[_0x484c('0x2d')]=_0x4b622e[_0x484c('0x2d')][_0x484c('0x31')]?_0x4b622e['attributes']:_0x1196ce[_0x484c('0x2f')];if(_0x1ff876[_0x484c('0x2c')][_0x484c('0x32')]){_0x4b622e['include']=[{'all':!![]}];}_0x4b622e=_['merge']({},_0x4b622e,_0x1ff876['options']);return db[_0x484c('0x27')]['find'](_0x4b622e)[_0x484c('0x1a')](handleEntityNotFound(_0x53d9a6,null))[_0x484c('0x1a')](respondWithResult(_0x53d9a6,null))[_0x484c('0x29')](handleError(_0x53d9a6,null));};exports[_0x484c('0x33')]=function(_0x1d764c,_0x5e49e5){return db[_0x484c('0x27')][_0x484c('0x33')](_0x1d764c['body'],{})[_0x484c('0x1a')](function(_0x8d5629){var _0x220d62=_0x1d764c[_0x484c('0x34')][_0x484c('0x1c')]({'plain':!![]});if(!_0x220d62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x220d62[_0x484c('0x35')]===_0x484c('0x34')){var _0x4480d5=_0x8d5629[_0x484c('0x1c')]({'plain':!![]});var _0x11c357=_0x484c('0x1d');return db[_0x484c('0x36')]['find']({'where':{'name':_0x11c357,'userProfileId':_0x220d62[_0x484c('0x37')]},'raw':!![]})[_0x484c('0x1a')](function(_0x3537da){if(_0x3537da&&_0x3537da[_0x484c('0x38')]===0x0){return db[_0x484c('0x39')][_0x484c('0x33')]({'name':_0x4480d5[_0x484c('0x1e')],'resourceId':_0x4480d5['id'],'type':_0x3537da[_0x484c('0x1e')],'sectionId':_0x3537da['id']},{})[_0x484c('0x1a')](function(){return _0x8d5629;});}else{return _0x8d5629;}})[_0x484c('0x29')](function(_0x1335f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1335f6);throw _0x1335f6;});}return _0x8d5629;})[_0x484c('0x1a')](respondWithResult(_0x5e49e5,0xc9))[_0x484c('0x29')](handleError(_0x5e49e5,null));};exports['update']=function(_0x2920e6,_0x4ad9af){if(_0x2920e6[_0x484c('0x3a')]['id']){delete _0x2920e6['body']['id'];}return db[_0x484c('0x27')][_0x484c('0x3b')]({'where':{'id':_0x2920e6['params']['id']}})['then'](handleEntityNotFound(_0x4ad9af,null))[_0x484c('0x1a')](saveUpdates(_0x2920e6[_0x484c('0x3a')],null))['then'](respondWithResult(_0x4ad9af,null))[_0x484c('0x29')](handleError(_0x4ad9af,null));};exports[_0x484c('0x1b')]=function(_0x389662,_0x2777a6){return db[_0x484c('0x27')][_0x484c('0x3b')]({'where':{'id':_0x389662['params']['id']}})[_0x484c('0x1a')](handleEntityNotFound(_0x2777a6,null))[_0x484c('0x1a')](removeEntity(_0x2777a6,null))['catch'](handleError(_0x2777a6,null));};exports[_0x484c('0x3c')]=function(_0x48bb3a,_0xcaec2b){return db[_0x484c('0x27')]['describe']()[_0x484c('0x1a')](respondWithResult(_0xcaec2b,null))[_0x484c('0x29')](handleError(_0xcaec2b,null));};exports[_0x484c('0x3d')]=function(_0x233199,_0x570c87){var _0x4ef934={'raw':!![],'where':{}},_0x285d6e={},_0x17197f;return db['ChatQueue'][_0x484c('0x3e')]({'where':{'id':_0x233199['params']['id']}})[_0x484c('0x1a')](handleEntityNotFound(_0x570c87,null))[_0x484c('0x1a')](function(_0x579aa3){if(_0x579aa3){_0x17197f=_0x579aa3[_0x484c('0x1c')]({'plain':!![]});_0x285d6e[_0x484c('0x2f')]=_[_0x484c('0x2b')](db[_0x484c('0x3f')][_0x484c('0x21')]);_0x285d6e['query']=_[_0x484c('0x2b')](_0x233199[_0x484c('0x2c')]);_0x285d6e[_0x484c('0x40')]=_[_0x484c('0x2e')](_0x285d6e[_0x484c('0x2f')],_0x285d6e['query']);_0x4ef934[_0x484c('0x2d')]=_[_0x484c('0x2e')](_0x285d6e[_0x484c('0x2f')],qs[_0x484c('0x30')](_0x233199[_0x484c('0x2c')][_0x484c('0x30')]));_0x4ef934['attributes']=_0x4ef934[_0x484c('0x2d')][_0x484c('0x31')]?_0x4ef934[_0x484c('0x2d')]:_0x285d6e['model'];if(!_0x233199[_0x484c('0x2c')][_0x484c('0x41')](_0x484c('0x42'))){_0x4ef934[_0x484c('0x14')]=qs[_0x484c('0x14')](_0x233199[_0x484c('0x2c')][_0x484c('0x14')]);_0x4ef934[_0x484c('0x13')]=qs[_0x484c('0x13')](_0x233199[_0x484c('0x2c')][_0x484c('0x13')]);}_0x4ef934[_0x484c('0x43')]=qs['sort'](_0x233199[_0x484c('0x2c')][_0x484c('0x44')]);_0x4ef934['where']=qs[_0x484c('0x40')](_['pick'](_0x233199[_0x484c('0x2c')],_0x285d6e[_0x484c('0x40')]));_0x4ef934['where'][_0x484c('0x45')]=_0x579aa3['id'];if(_0x233199[_0x484c('0x2c')][_0x484c('0x46')]){_0x4ef934[_0x484c('0x47')]=_['merge'](_0x4ef934[_0x484c('0x47')],{'$or':_[_0x484c('0x48')](_0x4ef934[_0x484c('0x2d')],function(_0x27c554){var _0x45f83f={};_0x45f83f[_0x27c554]={'$like':'%'+_0x233199['query']['filter']+'%'};return _0x45f83f;})});}_0x4ef934=_[_0x484c('0x49')]({},_0x4ef934,_0x233199[_0x484c('0x4a')]);return db[_0x484c('0x3f')][_0x484c('0x4b')](_0x4ef934);}})['then'](function(_0x39684e){if(_0x39684e){return db[_0x484c('0x4c')]['findAndCountAll']({'where':{'id':_[_0x484c('0x48')](_0x39684e,'UserId'),'role':_0x484c('0x4d')},'attributes':['id',_0x484c('0x1e'),_0x484c('0x4e'),_0x484c('0x4f'),_0x484c('0x50')]});}})[_0x484c('0x1a')](function(_0x15acc2){if(_0x15acc2){return{'count':_0x15acc2[_0x484c('0x16')],'rows':_['map'](_0x15acc2['rows'],function(_0x56e01d){return{'membername':_0x56e01d['name'],'UserId':_0x56e01d['id'],'queue_name':_0x17197f['name'],'ChatQueueId':_0x17197f['id'],'interface':util[_0x484c('0x51')](_0x484c('0x52'),'SIP',_0x56e01d[_0x484c('0x1e')]),'penalty':0x0,'paused':_0x56e01d[_0x484c('0x4e')],'createdAt':_0x56e01d[_0x484c('0x50')],'updatedAt':_0x56e01d[_0x484c('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x484c('0x1a')](respondWithFilteredResult(_0x570c87,_0x4ef934))[_0x484c('0x29')](handleError(_0x570c87,null));};exports[_0x484c('0x53')]=function(_0x5159b7,_0x1eb78a){var _0x2a295a={};var _0x5b47f5={};var _0x50ec00;var _0xd5e96d;return db[_0x484c('0x27')]['findOne']({'where':{'id':_0x5159b7[_0x484c('0x54')]['id']}})[_0x484c('0x1a')](handleEntityNotFound(_0x1eb78a,null))[_0x484c('0x1a')](function(_0x18b703){if(_0x18b703){_0x50ec00=_0x18b703;_0x5b47f5[_0x484c('0x2f')]=_[_0x484c('0x2b')](db[_0x484c('0x55')][_0x484c('0x21')]);_0x5b47f5[_0x484c('0x2c')]=_['keys'](_0x5159b7['query']);_0x5b47f5[_0x484c('0x40')]=_[_0x484c('0x2e')](_0x5b47f5[_0x484c('0x2f')],_0x5b47f5[_0x484c('0x2c')]);_0x2a295a[_0x484c('0x2d')]=_[_0x484c('0x2e')](_0x5b47f5[_0x484c('0x2f')],qs['fields'](_0x5159b7[_0x484c('0x2c')]['fields']));_0x2a295a['attributes']=_0x2a295a[_0x484c('0x2d')][_0x484c('0x31')]?_0x2a295a[_0x484c('0x2d')]:_0x5b47f5[_0x484c('0x2f')];_0x2a295a[_0x484c('0x43')]=qs['sort'](_0x5159b7[_0x484c('0x2c')][_0x484c('0x44')]);_0x2a295a[_0x484c('0x47')]=qs[_0x484c('0x40')](_[_0x484c('0x56')](_0x5159b7[_0x484c('0x2c')],_0x5b47f5[_0x484c('0x40')]));if(_0x5159b7[_0x484c('0x2c')][_0x484c('0x46')]){_0x2a295a['where']=_['merge'](_0x2a295a[_0x484c('0x47')],{'$or':_[_0x484c('0x48')](_0x2a295a[_0x484c('0x2d')],function(_0x53ac77){var _0x5d9ce4={};_0x5d9ce4[_0x53ac77]={'$like':'%'+_0x5159b7[_0x484c('0x2c')][_0x484c('0x46')]+'%'};return _0x5d9ce4;})});}_0x2a295a=_[_0x484c('0x49')]({},_0x2a295a,_0x5159b7['options']);return _0x50ec00[_0x484c('0x53')](_0x2a295a);}})[_0x484c('0x1a')](function(_0x40850b){if(_0x40850b){_0xd5e96d=_0x40850b[_0x484c('0x31')];if(!_0x5159b7[_0x484c('0x2c')][_0x484c('0x41')](_0x484c('0x42'))){_0x2a295a[_0x484c('0x14')]=qs['limit'](_0x5159b7[_0x484c('0x2c')][_0x484c('0x14')]);_0x2a295a[_0x484c('0x13')]=qs[_0x484c('0x13')](_0x5159b7['query'][_0x484c('0x13')]);}return _0x50ec00[_0x484c('0x53')](_0x2a295a);}})[_0x484c('0x1a')](function(_0x36f2b6){if(_0x36f2b6){return _0x36f2b6?{'count':_0xd5e96d,'rows':_0x36f2b6}:null;}})[_0x484c('0x1a')](respondWithResult(_0x1eb78a,null))[_0x484c('0x29')](handleError(_0x1eb78a,null));};exports['addTeams']=function(_0x36c285,_0x530ca9){var _0x25d0f5=_0x36c285[_0x484c('0x3a')][_0x484c('0x57')];return db[_0x484c('0x55')][_0x484c('0x4b')]({'where':{'id':_0x25d0f5},'attributes':['id'],'include':[{'model':db[_0x484c('0x4c')],'as':'Agents','attributes':['id','name',_0x484c('0x58'),_0x484c('0x59'),'interface'],'raw':!![]}]})[_0x484c('0x1a')](function(_0x5cac3e){if(_0x5cac3e){var _0x5d7aa4=_['flatMap'](_0x5cac3e,function(_0x4c284a){var _0x5d1c8c=_0x4c284a[_0x484c('0x1c')]({'plain':!![]});return _0x5d1c8c[_0x484c('0x5a')];});return db[_0x484c('0x27')][_0x484c('0x3b')]({'where':{'id':_0x36c285[_0x484c('0x54')]['id']}})[_0x484c('0x1a')](function(_0x5dd691){return db['sequelize'][_0x484c('0x5b')](function(_0x3771e4){return _0x5dd691[_0x484c('0x5c')](_0x25d0f5,{'transaction':_0x3771e4})[_0x484c('0x1a')](function(){return BPromise[_0x484c('0x5d')](_0x5d7aa4,function(_0x43fc32){return db[_0x484c('0x3f')][_0x484c('0x5e')]({'where':{'UserId':_0x43fc32['id'],'ChatQueueId':_0x36c285[_0x484c('0x54')]['id']},'transaction':_0x3771e4});});})[_0x484c('0x1a')](function(){_0x5d7aa4[_0x484c('0x5f')](function(_0x11a508){socket[_0x484c('0x60')](_0x484c('0x61'),{'UserId':_0x11a508['id'],'ChatQueueId':_0x5dd691['id']});});});});});}})[_0x484c('0x1a')](respondWithStatusCode(_0x530ca9,null))['catch'](handleError(_0x530ca9,null));};exports[_0x484c('0x62')]=function(_0x45ecad,_0x5a6a73){return db[_0x484c('0x55')][_0x484c('0x4b')]({'where':{'id':_0x45ecad[_0x484c('0x2c')][_0x484c('0x57')]},'attributes':['id'],'include':[{'model':db[_0x484c('0x4c')],'as':_0x484c('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x484c('0x1a')](handleEntityNotFound(_0x5a6a73,null))[_0x484c('0x1a')](function(_0x2d7938){var _0x3067f3=_[_0x484c('0x48')](_0x2d7938,'id');var _0x5c0759=[];var _0x58f398=[];var _0x348f45=squel['select']();_0x348f45[_0x484c('0x63')](_0x484c('0x64'))[_0x484c('0x65')](_0x484c('0x66'),'tq')[_0x484c('0x67')](_0x484c('0x68'),'ut',_0x484c('0x69'))['where'](_0x484c('0x6a'),_0x45ecad['params']['id']);for(var _0x22fc5e=0x0;_0x22fc5e<_0x2d7938['length'];_0x22fc5e+=0x1){let _0x2afb90=_0x2d7938[_0x22fc5e];for(var _0x5540d9=0x0;_0x5540d9<_0x2afb90['Agents'][_0x484c('0x31')];_0x5540d9+=0x1){let _0x539c2b=_0x2afb90[_0x484c('0x5a')][_0x5540d9];var _0x7d66ff=_0x348f45['clone']();_0x7d66ff[_0x484c('0x47')](_0x484c('0x6b'),_0x539c2b['id']);_0x58f398['push'](db['sequelize']['query'](_0x7d66ff[_0x484c('0x6c')](),{'type':db[_0x484c('0x6d')][_0x484c('0x6e')][_0x484c('0x6f')]})[_0x484c('0x1a')](function(_0x4a63b3){if(_0x4a63b3[_0x484c('0x31')]===0x1){return _0x539c2b['id'];}else{var _0x5e5d9f=_['every'](_[_0x484c('0x48')](_0x4a63b3,'TeamId'),function(_0x5df203){return _[_0x484c('0x70')](_0x3067f3,_0x5df203);});if(_0x5e5d9f){return _0x539c2b['id'];}}}));}}return BPromise[_0x484c('0x71')](_0x58f398)[_0x484c('0x1a')](function(_0x3961e7){_0x5c0759=_(_0x5c0759)[_0x484c('0x72')](_0x3961e7)[_0x484c('0x73')]()[_0x484c('0x74')]();return db['ChatQueue'][_0x484c('0x3b')]({'where':{'id':_0x45ecad[_0x484c('0x54')]['id']}})[_0x484c('0x1a')](function(_0x41ba57){return db['sequelize'][_0x484c('0x5b')](function(_0x52add0){return _0x41ba57[_0x484c('0x62')](_0x45ecad[_0x484c('0x2c')]['ids'],{'transaction':_0x52add0})[_0x484c('0x1a')](function(){if(!_[_0x484c('0x75')](_0x5c0759)){return _0x41ba57['removeAgents'](_0x5c0759,{'transaction':_0x52add0});}})[_0x484c('0x1a')](function(){_0x5c0759[_0x484c('0x5f')](function(_0x1e790d){socket[_0x484c('0x60')]('userChatQueue:remove',{'UserId':_0x1e790d,'ChatQueueId':_0x41ba57['id']});});});});});});})[_0x484c('0x1a')](respondWithStatusCode(_0x5a6a73,null))[_0x484c('0x29')](handleError(_0x5a6a73,null));};exports[_0x484c('0x76')]=function(_0x35e468,_0x4e45cc){return db[_0x484c('0x27')][_0x484c('0x3b')]({'where':{'id':_0x35e468[_0x484c('0x54')]['id']}})['then'](handleEntityNotFound(_0x4e45cc,null))[_0x484c('0x1a')](function(_0x4eef67){if(_0x4eef67){return _0x4eef67[_0x484c('0x76')](_0x35e468[_0x484c('0x3a')][_0x484c('0x57')],_[_0x484c('0x77')](_0x35e468[_0x484c('0x3a')],[_0x484c('0x57'),'id'])||{})[_0x484c('0x78')](function(_0xcde722){for(var _0x156c64=0x0;_0x156c64<_0x35e468['body'][_0x484c('0x57')][_0x484c('0x31')];_0x156c64+=0x1){socket[_0x484c('0x60')]('userChatQueue:save',{'UserId':Number(_0x35e468[_0x484c('0x3a')][_0x484c('0x57')][_0x156c64]),'ChatQueueId':Number(_0x35e468[_0x484c('0x54')]['id'])});}return _0xcde722;});}})[_0x484c('0x1a')](respondWithResult(_0x4e45cc,null))[_0x484c('0x29')](handleError(_0x4e45cc,null));};exports[_0x484c('0x79')]=function(_0x4b8cb5,_0x14e57d){return db[_0x484c('0x27')][_0x484c('0x3b')]({'where':{'id':_0x4b8cb5[_0x484c('0x54')]['id']}})['then'](handleEntityNotFound(_0x14e57d,null))[_0x484c('0x1a')](function(_0x28693e){if(_0x28693e){return _0x28693e['removeAgents'](_0x4b8cb5[_0x484c('0x2c')][_0x484c('0x57')])['then'](function(){if(_[_0x484c('0x7a')](_0x4b8cb5[_0x484c('0x2c')][_0x484c('0x57')])){for(var _0xbefe87=0x0;_0xbefe87<_0x4b8cb5[_0x484c('0x2c')]['ids'][_0x484c('0x31')];_0xbefe87+=0x1){socket[_0x484c('0x60')]('userChatQueue:remove',{'UserId':Number(_0x4b8cb5['query'][_0x484c('0x57')][_0xbefe87]),'ChatQueueId':Number(_0x4b8cb5['params']['id'])});}}else{socket[_0x484c('0x60')]('userChatQueue:remove',{'UserId':Number(_0x4b8cb5['query'][_0x484c('0x57')]),'ChatQueueId':Number(_0x4b8cb5[_0x484c('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x14e57d,null))[_0x484c('0x29')](handleError(_0x14e57d,null));};exports['getAgents']=function(_0x18468d,_0x11415c){var _0x16fc63={};var _0x3a8449={};var _0x112b74;var _0x699deb;return db[_0x484c('0x27')][_0x484c('0x3e')]({'where':{'id':_0x18468d[_0x484c('0x54')]['id']}})[_0x484c('0x1a')](handleEntityNotFound(_0x11415c,null))[_0x484c('0x1a')](function(_0x532483){if(_0x532483){_0x112b74=_0x532483;_0x3a8449[_0x484c('0x2f')]=_['keys'](db[_0x484c('0x4c')][_0x484c('0x21')]);_0x3a8449[_0x484c('0x2c')]=_[_0x484c('0x2b')](_0x18468d['query']);_0x3a8449['filters']=_['intersection'](_0x3a8449[_0x484c('0x2f')],_0x3a8449[_0x484c('0x2c')]);_0x16fc63[_0x484c('0x2d')]=_['intersection'](_0x3a8449[_0x484c('0x2f')],qs['fields'](_0x18468d['query'][_0x484c('0x30')]));_0x16fc63['attributes']=_0x16fc63[_0x484c('0x2d')]['length']?_0x16fc63[_0x484c('0x2d')]:_0x3a8449['model'];_0x16fc63[_0x484c('0x43')]=qs['sort'](_0x18468d[_0x484c('0x2c')][_0x484c('0x44')]);_0x16fc63[_0x484c('0x47')]=qs[_0x484c('0x40')](_[_0x484c('0x56')](_0x18468d[_0x484c('0x2c')],_0x3a8449['filters']));if(_0x18468d[_0x484c('0x2c')][_0x484c('0x46')]){_0x16fc63[_0x484c('0x47')]=_['merge'](_0x16fc63[_0x484c('0x47')],{'$or':_['map'](_0x16fc63['attributes'],function(_0x2c7798){var _0x52b5e1={};_0x52b5e1[_0x2c7798]={'$like':'%'+_0x18468d[_0x484c('0x2c')][_0x484c('0x46')]+'%'};return _0x52b5e1;})});}_0x16fc63=_['merge']({},_0x16fc63,_0x18468d['options']);return _0x112b74[_0x484c('0x7b')](_0x16fc63);}})[_0x484c('0x1a')](function(_0x402735){if(_0x402735){_0x699deb=_0x402735[_0x484c('0x31')];if(!_0x18468d['query'][_0x484c('0x41')](_0x484c('0x42'))){_0x16fc63[_0x484c('0x14')]=qs['limit'](_0x18468d[_0x484c('0x2c')][_0x484c('0x14')]);_0x16fc63[_0x484c('0x13')]=qs[_0x484c('0x13')](_0x18468d['query']['offset']);}return _0x112b74[_0x484c('0x7b')](_0x16fc63);}})['then'](function(_0x3e3b22){if(_0x3e3b22){return _0x3e3b22?{'count':_0x699deb,'rows':_0x3e3b22}:null;}})[_0x484c('0x1a')](respondWithResult(_0x11415c,null))[_0x484c('0x29')](handleError(_0x11415c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b456b9a..ab18e7e 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 _0x043d=['hasOwnProperty','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x043d,0x1ba));var _0xd043=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x043d[_0x468b0f];return _0x3e74d9;};'use strict';var EventEmitter=require(_0xd043('0x0'));var ChatQueue=require(_0xd043('0x1'))['db'][_0xd043('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd043('0x3')](0x0);var events={'afterCreate':_0xd043('0x4'),'afterUpdate':_0xd043('0x5'),'afterDestroy':_0xd043('0x6')};function emitEvent(_0x44379f){return function(_0x52b22e,_0x341d09,_0x347239){ChatQueueEvents[_0xd043('0x7')](_0x44379f+':'+_0x52b22e['id'],_0x52b22e);ChatQueueEvents[_0xd043('0x7')](_0x44379f,_0x52b22e);_0x347239(null);};}for(var e in events){if(events[_0xd043('0x8')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xd043('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x848d=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x931bbf,_0x4646cd){var _0x18bcb9=function(_0x4ab01b){while(--_0x4ab01b){_0x931bbf['push'](_0x931bbf['shift']());}};_0x18bcb9(++_0x4646cd);}(_0x848d,0x1d5));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd848('0x0'));var ChatQueue=require(_0xd848('0x1'))['db'][_0xd848('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd848('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7285b8){return function(_0x6bddb8,_0xc0bacc,_0x30130e){ChatQueueEvents[_0xd848('0x4')](_0x7285b8+':'+_0x6bddb8['id'],_0x6bddb8);ChatQueueEvents[_0xd848('0x4')](_0x7285b8,_0x6bddb8);_0x30130e(null);};}for(var e in events){if(events[_0xd848('0x5')](e)){var event=events[e];ChatQueue[_0xd848('0x6')](e,emitEvent(event));}}module[_0xd848('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 a3b9443..09da217 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 _0xdfde=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x46ce21,_0x254327){var _0x4901ba=function(_0x528f1c){while(--_0x528f1c){_0x46ce21['push'](_0x46ce21['shift']());}};_0x4901ba(++_0x254327);}(_0xdfde,0x14b));var _0xedfd=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xdfde[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0xedfd('0x0'));var util=require(_0xedfd('0x1'));var logger=require(_0xedfd('0x2'))(_0xedfd('0x3'));var moment=require('moment');var BPromise=require(_0xedfd('0x4'));var rp=require(_0xedfd('0x5'));var fs=require('fs');var path=require(_0xedfd('0x6'));var rimraf=require('rimraf');var config=require(_0xedfd('0x7'));var attributes=require(_0xedfd('0x8'));module[_0xedfd('0x9')]=function(_0x380cd3,_0x361240){return _0x380cd3[_0xedfd('0xa')](_0xedfd('0xb'),attributes,{'tableName':_0xedfd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa76=['api','moment','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','util','../../config/logger'];(function(_0x33b607,_0x41b281){var _0x48e02e=function(_0x4fdf54){while(--_0x4fdf54){_0x33b607['push'](_0x33b607['shift']());}};_0x48e02e(++_0x41b281);}(_0xfa76,0x69));var _0x6fa7=function(_0x154808,_0x44e73a){_0x154808=_0x154808-0x0;var _0x41333e=_0xfa76[_0x154808];return _0x41333e;};'use strict';var _=require(_0x6fa7('0x0'));var util=require(_0x6fa7('0x1'));var logger=require(_0x6fa7('0x2'))(_0x6fa7('0x3'));var moment=require(_0x6fa7('0x4'));var BPromise=require('bluebird');var rp=require(_0x6fa7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fa7('0x6'));var config=require(_0x6fa7('0x7'));var attributes=require(_0x6fa7('0x8'));module[_0x6fa7('0x9')]=function(_0x5a134c,_0x3611c1){return _0x5a134c[_0x6fa7('0xa')]('ChatQueue',attributes,{'tableName':_0x6fa7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index df739ed..1bb7a08 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 _0x8b6f=['map','model','attributes','debug','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include'];(function(_0x594585,_0x933997){var _0xcd0131=function(_0x5eac7c){while(--_0x5eac7c){_0x594585['push'](_0x594585['shift']());}};_0xcd0131(++_0x933997);}(_0x8b6f,0x177));var _0xf8b6=function(_0x1ea3b1,_0x5bdb4d){_0x1ea3b1=_0x1ea3b1-0x0;var _0x584d88=_0x8b6f[_0x1ea3b1];return _0x584d88;};'use strict';var _=require(_0xf8b6('0x0'));var util=require(_0xf8b6('0x1'));var moment=require(_0xf8b6('0x2'));var BPromise=require(_0xf8b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8b6('0x4'));var db=require(_0xf8b6('0x5'))['db'];var utils=require(_0xf8b6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf8b6('0x7'));var jayson=require(_0xf8b6('0x8'));var client=jayson[_0xf8b6('0x9')][_0xf8b6('0xa')]({'port':0x232a});config[_0xf8b6('0xb')]=_[_0xf8b6('0xc')](config[_0xf8b6('0xb')],{'host':_0xf8b6('0xd'),'port':0x18eb});var socket=require(_0xf8b6('0xe'))(new Redis(config[_0xf8b6('0xb')]));require(_0xf8b6('0xf'))[_0xf8b6('0x10')](socket);function respondWithRpcPromise(_0x4673dc,_0x467f8e,_0x270d9f){return new BPromise(function(_0x1496ba,_0x28899d){return client[_0xf8b6('0x11')](_0x4673dc,_0x270d9f)[_0xf8b6('0x12')](function(_0x4968e5){logger['info'](_0xf8b6('0x13'),_0x467f8e,_0xf8b6('0x14'));logger['debug'](_0xf8b6('0x15'),_0x467f8e,_0xf8b6('0x14'),JSON['stringify'](_0x4968e5));if(_0x4968e5['error']){if(_0x4968e5[_0xf8b6('0x16')][_0xf8b6('0x17')]===0x1f4){logger[_0xf8b6('0x16')](_0xf8b6('0x13'),_0x467f8e,_0x4968e5[_0xf8b6('0x16')]['message']);return _0x28899d(_0x4968e5[_0xf8b6('0x16')]['message']);}logger['error'](_0xf8b6('0x13'),_0x467f8e,_0x4968e5['error'][_0xf8b6('0x18')]);return _0x1496ba(_0x4968e5['error'][_0xf8b6('0x18')]);}else{logger[_0xf8b6('0x19')](_0xf8b6('0x13'),_0x467f8e,_0xf8b6('0x14'));_0x1496ba(_0x4968e5['result']['message']);}})[_0xf8b6('0x1a')](function(_0x58492e){logger[_0xf8b6('0x16')]('ChatQueue,\x20%s,\x20%s',_0x467f8e,_0x58492e);_0x28899d(_0x58492e);});});}exports[_0xf8b6('0x1b')]=function(_0x1cc304){var _0x25e177=this;return new Promise(function(_0x152c95,_0x28c66a){return db[_0xf8b6('0x1c')][_0xf8b6('0x1d')]({'raw':_0x1cc304[_0xf8b6('0x1e')]?_0x1cc304[_0xf8b6('0x1e')][_0xf8b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x1cc304[_0xf8b6('0x1e')]?_0x1cc304['options'][_0xf8b6('0x20')]||null:null,'attributes':_0x1cc304[_0xf8b6('0x1e')]?_0x1cc304[_0xf8b6('0x1e')]['attributes']||null:null,'limit':_0x1cc304[_0xf8b6('0x1e')]?_0x1cc304[_0xf8b6('0x1e')][_0xf8b6('0x21')]||null:null,'include':_0x1cc304[_0xf8b6('0x1e')]?_0x1cc304[_0xf8b6('0x1e')][_0xf8b6('0x22')]?_[_0xf8b6('0x23')](_0x1cc304[_0xf8b6('0x1e')]['include'],function(_0x410c9a){return{'model':db[_0x410c9a[_0xf8b6('0x24')]],'as':_0x410c9a['as'],'attributes':_0x410c9a[_0xf8b6('0x25')],'include':_0x410c9a[_0xf8b6('0x22')]?_[_0xf8b6('0x23')](_0x410c9a[_0xf8b6('0x22')],function(_0x364652){return{'model':db[_0x364652[_0xf8b6('0x24')]],'as':_0x364652['as'],'attributes':_0x364652['attributes'],'include':_0x364652[_0xf8b6('0x22')]?_['map'](_0x364652[_0xf8b6('0x22')],function(_0x4b5c94){return{'model':db[_0x4b5c94[_0xf8b6('0x24')]],'as':_0x4b5c94['as'],'attributes':_0x4b5c94[_0xf8b6('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x770534){logger['info'](_0xf8b6('0x1b'),_0x1cc304);logger[_0xf8b6('0x26')](_0xf8b6('0x1b'),_0x1cc304,JSON['stringify'](_0x770534));_0x152c95(_0x770534);})[_0xf8b6('0x1a')](function(_0x1e73ef){logger[_0xf8b6('0x16')](_0xf8b6('0x1b'),_0x1e73ef[_0xf8b6('0x18')],_0x1cc304);_0x28c66a(_0x25e177[_0xf8b6('0x16')](0x1f4,_0x1e73ef[_0xf8b6('0x18')]));});});};exports['ShowChatQueue']=function(_0x4cc242){var _0x171580=this;return new Promise(function(_0xb6363c,_0x11764e){return db[_0xf8b6('0x1c')][_0xf8b6('0x27')]({'raw':_0x4cc242['options']?_0x4cc242[_0xf8b6('0x1e')][_0xf8b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x4cc242[_0xf8b6('0x1e')]?_0x4cc242['options']['where']||null:null,'attributes':_0x4cc242['options']?_0x4cc242['options'][_0xf8b6('0x25')]||null:null,'include':_0x4cc242[_0xf8b6('0x1e')]?_0x4cc242[_0xf8b6('0x1e')][_0xf8b6('0x22')]?_[_0xf8b6('0x23')](_0x4cc242[_0xf8b6('0x1e')]['include'],function(_0x521888){return{'model':db[_0x521888[_0xf8b6('0x24')]],'as':_0x521888['as'],'attributes':_0x521888['attributes'],'include':_0x521888[_0xf8b6('0x22')]?_[_0xf8b6('0x23')](_0x521888[_0xf8b6('0x22')],function(_0x79b3c){return{'model':db[_0x79b3c[_0xf8b6('0x24')]],'as':_0x79b3c['as'],'attributes':_0x79b3c['attributes'],'include':_0x79b3c[_0xf8b6('0x22')]?_[_0xf8b6('0x23')](_0x79b3c[_0xf8b6('0x22')],function(_0x950494){return{'model':db[_0x950494[_0xf8b6('0x24')]],'as':_0x950494['as'],'attributes':_0x950494[_0xf8b6('0x25')]};}):[]};}):[]};}):[]:[]})[_0xf8b6('0x12')](function(_0x36e86b){logger[_0xf8b6('0x19')]('ShowChatQueue',_0x4cc242);logger['debug'](_0xf8b6('0x28'),_0x4cc242,JSON['stringify'](_0x36e86b));_0xb6363c(_0x36e86b);})[_0xf8b6('0x1a')](function(_0x1b47e3){logger['error'](_0xf8b6('0x28'),_0x1b47e3[_0xf8b6('0x18')],_0x4cc242);_0x11764e(_0x171580['error'](0x1f4,_0x1b47e3['message']));});});}; \ No newline at end of file +var _0x707d=['message','info','result','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowChatQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4efa17,_0x5e3695){var _0x1f0950=function(_0xce7da7){while(--_0xce7da7){_0x4efa17['push'](_0x4efa17['shift']());}};_0x1f0950(++_0x5e3695);}(_0x707d,0x18b));var _0xd707=function(_0x568807,_0x509238){_0x568807=_0x568807-0x0;var _0x13b614=_0x707d[_0x568807];return _0x13b614;};'use strict';var _=require(_0xd707('0x0'));var util=require(_0xd707('0x1'));var moment=require(_0xd707('0x2'));var BPromise=require(_0xd707('0x3'));var rs=require(_0xd707('0x4'));var fs=require('fs');var Redis=require(_0xd707('0x5'));var db=require(_0xd707('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd707('0x7'))(_0xd707('0x8'));var config=require(_0xd707('0x9'));var jayson=require(_0xd707('0xa'));var client=jayson['client'][_0xd707('0xb')]({'port':0x232a});config[_0xd707('0xc')]=_['defaults'](config[_0xd707('0xc')],{'host':_0xd707('0xd'),'port':0x18eb});var socket=require(_0xd707('0xe'))(new Redis(config['redis']));require(_0xd707('0xf'))[_0xd707('0x10')](socket);function respondWithRpcPromise(_0x4eb413,_0x1fcab0,_0x122cb6){return new BPromise(function(_0x588b55,_0x5af991){return client[_0xd707('0x11')](_0x4eb413,_0x122cb6)[_0xd707('0x12')](function(_0x249ede){logger['info'](_0xd707('0x13'),_0x1fcab0,_0xd707('0x14'));logger[_0xd707('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1fcab0,'request\x20sent',JSON[_0xd707('0x16')](_0x249ede));if(_0x249ede[_0xd707('0x17')]){if(_0x249ede['error'][_0xd707('0x18')]===0x1f4){logger[_0xd707('0x17')]('ChatQueue,\x20%s,\x20%s',_0x1fcab0,_0x249ede[_0xd707('0x17')][_0xd707('0x19')]);return _0x5af991(_0x249ede['error']['message']);}logger[_0xd707('0x17')]('ChatQueue,\x20%s,\x20%s',_0x1fcab0,_0x249ede[_0xd707('0x17')][_0xd707('0x19')]);return _0x588b55(_0x249ede['error'][_0xd707('0x19')]);}else{logger[_0xd707('0x1a')](_0xd707('0x13'),_0x1fcab0,_0xd707('0x14'));_0x588b55(_0x249ede[_0xd707('0x1b')][_0xd707('0x19')]);}})['catch'](function(_0x49a6c4){logger[_0xd707('0x17')]('ChatQueue,\x20%s,\x20%s',_0x1fcab0,_0x49a6c4);_0x5af991(_0x49a6c4);});});}exports[_0xd707('0x1c')]=function(_0x20c217){var _0x1c5aba=this;return new Promise(function(_0x4c2e25,_0x5f152e){return db[_0xd707('0x1d')][_0xd707('0x1e')]({'raw':_0x20c217[_0xd707('0x1f')]?_0x20c217[_0xd707('0x1f')][_0xd707('0x20')]===undefined?!![]:![]:!![],'where':_0x20c217[_0xd707('0x1f')]?_0x20c217[_0xd707('0x1f')]['where']||null:null,'attributes':_0x20c217[_0xd707('0x1f')]?_0x20c217['options'][_0xd707('0x21')]||null:null,'limit':_0x20c217['options']?_0x20c217[_0xd707('0x1f')][_0xd707('0x22')]||null:null,'include':_0x20c217[_0xd707('0x1f')]?_0x20c217['options'][_0xd707('0x23')]?_[_0xd707('0x24')](_0x20c217['options'][_0xd707('0x23')],function(_0x472981){return{'model':db[_0x472981[_0xd707('0x25')]],'as':_0x472981['as'],'attributes':_0x472981[_0xd707('0x21')],'include':_0x472981[_0xd707('0x23')]?_[_0xd707('0x24')](_0x472981[_0xd707('0x23')],function(_0x3330e6){return{'model':db[_0x3330e6[_0xd707('0x25')]],'as':_0x3330e6['as'],'attributes':_0x3330e6[_0xd707('0x21')],'include':_0x3330e6[_0xd707('0x23')]?_['map'](_0x3330e6[_0xd707('0x23')],function(_0x340b79){return{'model':db[_0x340b79[_0xd707('0x25')]],'as':_0x340b79['as'],'attributes':_0x340b79[_0xd707('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd707('0x12')](function(_0x5c0310){logger[_0xd707('0x1a')](_0xd707('0x1c'),_0x20c217);logger[_0xd707('0x15')](_0xd707('0x1c'),_0x20c217,JSON[_0xd707('0x16')](_0x5c0310));_0x4c2e25(_0x5c0310);})[_0xd707('0x26')](function(_0x4b6769){logger[_0xd707('0x17')](_0xd707('0x1c'),_0x4b6769[_0xd707('0x19')],_0x20c217);_0x5f152e(_0x1c5aba['error'](0x1f4,_0x4b6769['message']));});});};exports[_0xd707('0x27')]=function(_0x1a4d80){var _0x4bfbb7=this;return new Promise(function(_0x345382,_0x11b05b){return db[_0xd707('0x1d')][_0xd707('0x28')]({'raw':_0x1a4d80['options']?_0x1a4d80['options'][_0xd707('0x20')]===undefined?!![]:![]:!![],'where':_0x1a4d80[_0xd707('0x1f')]?_0x1a4d80['options'][_0xd707('0x29')]||null:null,'attributes':_0x1a4d80[_0xd707('0x1f')]?_0x1a4d80['options']['attributes']||null:null,'include':_0x1a4d80[_0xd707('0x1f')]?_0x1a4d80['options'][_0xd707('0x23')]?_['map'](_0x1a4d80[_0xd707('0x1f')][_0xd707('0x23')],function(_0x4ff823){return{'model':db[_0x4ff823[_0xd707('0x25')]],'as':_0x4ff823['as'],'attributes':_0x4ff823[_0xd707('0x21')],'include':_0x4ff823[_0xd707('0x23')]?_[_0xd707('0x24')](_0x4ff823[_0xd707('0x23')],function(_0x34ab5f){return{'model':db[_0x34ab5f['model']],'as':_0x34ab5f['as'],'attributes':_0x34ab5f[_0xd707('0x21')],'include':_0x34ab5f[_0xd707('0x23')]?_[_0xd707('0x24')](_0x34ab5f[_0xd707('0x23')],function(_0x226d17){return{'model':db[_0x226d17[_0xd707('0x25')]],'as':_0x226d17['as'],'attributes':_0x226d17[_0xd707('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5beb41){logger['info']('ShowChatQueue',_0x1a4d80);logger[_0xd707('0x15')](_0xd707('0x27'),_0x1a4d80,JSON[_0xd707('0x16')](_0x5beb41));_0x345382(_0x5beb41);})[_0xd707('0x26')](function(_0x1de37c){logger['error']('ShowChatQueue',_0x1de37c[_0xd707('0x19')],_0x1a4d80);_0x11b05b(_0x4bfbb7[_0xd707('0x17')](0x1f4,_0x1de37c[_0xd707('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f61e707..4c8b02b 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 _0x80d9=['./chatQueue.events','remove','update','emit','removeListener','chatQueue:'];(function(_0x27d72e,_0xb3d410){var _0x1cd188=function(_0x4217a8){while(--_0x4217a8){_0x27d72e['push'](_0x27d72e['shift']());}};_0x1cd188(++_0xb3d410);}(_0x80d9,0x15c));var _0x980d=function(_0x4b7614,_0x493c23){_0x4b7614=_0x4b7614-0x0;var _0x3c0a9b=_0x80d9[_0x4b7614];return _0x3c0a9b;};'use strict';var ChatQueueEvents=require(_0x980d('0x0'));var events=['save',_0x980d('0x1'),_0x980d('0x2')];function createListener(_0xac96e5,_0x5d4b87){return function(_0x358d0a){_0x5d4b87[_0x980d('0x3')](_0xac96e5,_0x358d0a);};}function removeListener(_0x38d1b9,_0x279d93){return function(){ChatQueueEvents[_0x980d('0x4')](_0x38d1b9,_0x279d93);};}exports['register']=function(_0x4c3533){for(var _0x2fd4b9=0x0,_0x50854e=events['length'];_0x2fd4b9<_0x50854e;_0x2fd4b9++){var _0x7e96f7=events[_0x2fd4b9];var _0x758fc3=createListener(_0x980d('0x5')+_0x7e96f7,_0x4c3533);ChatQueueEvents['on'](_0x7e96f7,_0x758fc3);}}; \ No newline at end of file +var _0xa37e=['chatQueue:','remove','update','emit','removeListener','register'];(function(_0x3143d9,_0x12a290){var _0x295364=function(_0x570ab4){while(--_0x570ab4){_0x3143d9['push'](_0x3143d9['shift']());}};_0x295364(++_0x12a290);}(_0xa37e,0x97));var _0xea37=function(_0x34133b,_0x60e865){_0x34133b=_0x34133b-0x0;var _0x4281be=_0xa37e[_0x34133b];return _0x4281be;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xea37('0x0'),_0xea37('0x1')];function createListener(_0x204a22,_0x475c71){return function(_0x5430aa){_0x475c71[_0xea37('0x2')](_0x204a22,_0x5430aa);};}function removeListener(_0x537c5a,_0x360ed5){return function(){ChatQueueEvents[_0xea37('0x3')](_0x537c5a,_0x360ed5);};}exports[_0xea37('0x4')]=function(_0x4d380b){for(var _0x57135b=0x0,_0x36c489=events['length'];_0x57135b<_0x36c489;_0x57135b++){var _0x4ae081=events[_0x57135b];var _0x2c2890=createListener(_0xea37('0x5')+_0x4ae081,_0x4d380b);ChatQueueEvents['on'](_0x4ae081,_0x2c2890);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0373896..1b4632e 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x5fc3[_0x4358f5];return _0x4d8104;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47a8ca,_0x4b960e){var _0x29e773=function(_0x7c59fb){while(--_0x7c59fb){_0x47a8ca['push'](_0x47a8ca['shift']());}};_0x29e773(++_0x4b960e);}(_0x008c,0x188));var _0xc008=function(_0x11acac,_0x37d55f){_0x11acac=_0x11acac-0x0;var _0x1daa7e=_0x008c[_0x11acac];return _0x1daa7e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 204de52..a11ddf5 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 _0xb9bc=['moment','sequelize','STRING','DATE'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb9bc,0x14c));var _0xcb9b=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb9bc[_0x5f309e];return _0x487b5e;};'use strict';var moment=require(_0xcb9b('0x0'));var Sequelize=require(_0xcb9b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcb9b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcb9b('0x2')]},'joinAt':{'type':Sequelize[_0xcb9b('0x3')]},'leaveAt':{'type':Sequelize[_0xcb9b('0x3')]},'acceptAt':{'type':Sequelize[_0xcb9b('0x3')]},'exitAt':{'type':Sequelize[_0xcb9b('0x3')]},'reason':{'type':Sequelize[_0xcb9b('0x2')]}}; \ No newline at end of file +var _0x0032=['exports','STRING','DATE','sequelize'];(function(_0x5a3fc1,_0x4b85fc){var _0x27a27b=function(_0x4c1d2f){while(--_0x4c1d2f){_0x5a3fc1['push'](_0x5a3fc1['shift']());}};_0x27a27b(++_0x4b85fc);}(_0x0032,0x127));var _0x2003=function(_0x398f66,_0x3acddb){_0x398f66=_0x398f66-0x0;var _0xcde72d=_0x0032[_0x398f66];return _0xcde72d;};'use strict';var moment=require('moment');var Sequelize=require(_0x2003('0x0'));module[_0x2003('0x1')]={'uniqueid':{'type':Sequelize[_0x2003('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2003('0x2')]},'joinAt':{'type':Sequelize[_0x2003('0x3')]},'leaveAt':{'type':Sequelize[_0x2003('0x3')]},'acceptAt':{'type':Sequelize[_0x2003('0x3')]},'exitAt':{'type':Sequelize[_0x2003('0x3')]},'reason':{'type':Sequelize[_0x2003('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 89af923..226d42e 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 _0x5496=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x428e5f,_0x3db2dc){var _0x218a3c=function(_0x3b99ab){while(--_0x3b99ab){_0x428e5f['push'](_0x428e5f['shift']());}};_0x218a3c(++_0x3db2dc);}(_0x5496,0x175));var _0x6549=function(_0x135315,_0x5de693){_0x135315=_0x135315-0x0;var _0x1dd621=_0x5496[_0x135315];return _0x1dd621;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['ChatQueueReport'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));};exports['describe']=function(_0x28af00,_0x4bbc61){return db[_0x6549('0x2b')][_0x6549('0x4e')]()[_0x6549('0x26')](respondWithResult(_0x4bbc61,null))[_0x6549('0x43')](handleError(_0x4bbc61,null));}; \ No newline at end of file +var _0x2dc3=['include','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','ChatQueueReport','fieldName','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll'];(function(_0x21465f,_0x34c11d){var _0x2843ef=function(_0xa15076){while(--_0xa15076){_0x21465f['push'](_0x21465f['shift']());}};_0x2843ef(++_0x34c11d);}(_0x2dc3,0x127));var _0x32dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dc3[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32dc('0x0'));var zipdir=require(_0x32dc('0x1'));var jsonpatch=require(_0x32dc('0x2'));var rp=require(_0x32dc('0x3'));var moment=require(_0x32dc('0x4'));var BPromise=require(_0x32dc('0x5'));var Mustache=require(_0x32dc('0x6'));var util=require(_0x32dc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x32dc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32dc('0x9'));var _=require('lodash');var squel=require(_0x32dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32dc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x32dc('0xc'));var Papa=require(_0x32dc('0xd'));var Redis=require(_0x32dc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32dc('0xf'));var hardwareService=require(_0x32dc('0x10'));var logger=require(_0x32dc('0x11'))(_0x32dc('0x12'));var utils=require(_0x32dc('0x13'));var config=require(_0x32dc('0x14'));var licenseUtil=require(_0x32dc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36ab9f,_0x480027){_0x480027=_0x480027||0xcc;return function(_0x3b163b){if(_0x3b163b){return _0x36ab9f[_0x32dc('0x16')](_0x480027);}return _0x36ab9f[_0x32dc('0x17')](_0x480027)['end']();};}function respondWithResult(_0x355d98,_0x10f169){_0x10f169=_0x10f169||0xc8;return function(_0x5e373a){if(_0x5e373a){return _0x355d98[_0x32dc('0x17')](_0x10f169)['json'](_0x5e373a);}};}function respondWithFilteredResult(_0x2dee08,_0x5954f3){return function(_0x47fe19){if(_0x47fe19){var _0x497b11=typeof _0x5954f3[_0x32dc('0x18')]===_0x32dc('0x19')&&typeof _0x5954f3[_0x32dc('0x1a')]==='undefined';var _0x284dfe=_0x47fe19[_0x32dc('0x1b')];var _0x38064a=_0x497b11?0x0:_0x5954f3['offset'];var _0x36e287=_0x497b11?_0x47fe19[_0x32dc('0x1b')]:_0x5954f3[_0x32dc('0x18')]+_0x5954f3[_0x32dc('0x1a')];var _0x5bbd7c;if(_0x36e287>=_0x284dfe){_0x36e287=_0x284dfe;_0x5bbd7c=0xc8;}else{_0x5bbd7c=0xce;}_0x2dee08[_0x32dc('0x17')](_0x5bbd7c);return _0x2dee08[_0x32dc('0x1c')](_0x32dc('0x1d'),_0x38064a+'-'+_0x36e287+'/'+_0x284dfe)[_0x32dc('0x1e')](_0x47fe19);}return null;};}function patchUpdates(_0x43b4a3){return function(_0x445c79){try{jsonpatch[_0x32dc('0x1f')](_0x445c79,_0x43b4a3,!![]);}catch(_0x33eae0){return BPromise['reject'](_0x33eae0);}return _0x445c79[_0x32dc('0x20')]();};}function saveUpdates(_0x37e2d1,_0xd8dd68){return function(_0x2a4bf9){if(_0x2a4bf9){return _0x2a4bf9['update'](_0x37e2d1)[_0x32dc('0x21')](function(_0x3582af){return _0x3582af;});}return null;};}function removeEntity(_0x36398c,_0x39182b){return function(_0x57e1e3){if(_0x57e1e3){return _0x57e1e3[_0x32dc('0x22')]()[_0x32dc('0x21')](function(){_0x36398c[_0x32dc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51af54,_0x3718e1){return function(_0x4a0e6e){if(!_0x4a0e6e){_0x51af54[_0x32dc('0x16')](0x194);}return _0x4a0e6e;};}function handleError(_0x582651,_0x5a7382){_0x5a7382=_0x5a7382||0x1f4;return function(_0x50ccf4){logger[_0x32dc('0x23')](_0x50ccf4['stack']);if(_0x50ccf4[_0x32dc('0x24')]){delete _0x50ccf4[_0x32dc('0x24')];}_0x582651['status'](_0x5a7382)[_0x32dc('0x25')](_0x50ccf4);};}exports[_0x32dc('0x26')]=function(_0x28beb9,_0xa37191){var _0x287bb2={},_0x41d845={},_0x84c29d={'count':0x0,'rows':[]};var _0x53dd9e=_[_0x32dc('0x27')](db[_0x32dc('0x28')]['rawAttributes'],function(_0x486c19){return{'name':_0x486c19[_0x32dc('0x29')],'type':_0x486c19['type'][_0x32dc('0x2a')]};});_0x41d845['model']=_[_0x32dc('0x27')](_0x53dd9e,_0x32dc('0x24'));_0x41d845['query']=_[_0x32dc('0x2b')](_0x28beb9[_0x32dc('0x2c')]);_0x41d845[_0x32dc('0x2d')]=_['intersection'](_0x41d845[_0x32dc('0x2e')],_0x41d845[_0x32dc('0x2c')]);_0x287bb2[_0x32dc('0x2f')]=_[_0x32dc('0x30')](_0x41d845[_0x32dc('0x2e')],qs[_0x32dc('0x31')](_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x31')]));_0x287bb2[_0x32dc('0x2f')]=_0x287bb2[_0x32dc('0x2f')]['length']?_0x287bb2[_0x32dc('0x2f')]:_0x41d845[_0x32dc('0x2e')];if(!_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x32')](_0x32dc('0x33'))){_0x287bb2['limit']=qs[_0x32dc('0x1a')](_0x28beb9['query'][_0x32dc('0x1a')]);_0x287bb2['offset']=qs[_0x32dc('0x18')](_0x28beb9['query']['offset']);}_0x287bb2[_0x32dc('0x34')]=qs[_0x32dc('0x35')](_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x35')]);_0x287bb2['where']=qs[_0x32dc('0x2d')](_[_0x32dc('0x36')](_0x28beb9[_0x32dc('0x2c')],_0x41d845[_0x32dc('0x2d')]),_0x53dd9e);if(_0x28beb9['query'][_0x32dc('0x37')]){_0x287bb2[_0x32dc('0x38')]=_[_0x32dc('0x39')](_0x287bb2[_0x32dc('0x38')],{'$or':_[_0x32dc('0x27')](_0x53dd9e,function(_0x5718b2){if(_0x5718b2['type']!=='VIRTUAL'){var _0x52b6d8={};_0x52b6d8[_0x5718b2['name']]={'$like':'%'+_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x37')]+'%'};return _0x52b6d8;}})});}_0x287bb2=_['merge']({},_0x287bb2,_0x28beb9[_0x32dc('0x3a')]);var _0x46f049={'where':_0x287bb2['where']};return db[_0x32dc('0x28')][_0x32dc('0x1b')](_0x46f049)[_0x32dc('0x21')](function(_0x4afc95){_0x84c29d['count']=_0x4afc95;if(_0x28beb9[_0x32dc('0x2c')][_0x32dc('0x3b')]){_0x287bb2[_0x32dc('0x3c')]=[{'all':!![]}];}return db[_0x32dc('0x28')][_0x32dc('0x3d')](_0x287bb2);})[_0x32dc('0x21')](function(_0xc54728){_0x84c29d[_0x32dc('0x3e')]=_0xc54728;return _0x84c29d;})[_0x32dc('0x21')](respondWithFilteredResult(_0xa37191,_0x287bb2))[_0x32dc('0x3f')](handleError(_0xa37191,null));};exports[_0x32dc('0x40')]=function(_0x205e71,_0x4411c4){var _0x4d53f1={'raw':!![],'where':{'id':_0x205e71[_0x32dc('0x41')]['id']}},_0x5705fe={};_0x5705fe[_0x32dc('0x2e')]=_[_0x32dc('0x2b')](db[_0x32dc('0x28')]['rawAttributes']);_0x5705fe[_0x32dc('0x2c')]=_[_0x32dc('0x2b')](_0x205e71[_0x32dc('0x2c')]);_0x5705fe['filters']=_[_0x32dc('0x30')](_0x5705fe['model'],_0x5705fe[_0x32dc('0x2c')]);_0x4d53f1[_0x32dc('0x2f')]=_[_0x32dc('0x30')](_0x5705fe[_0x32dc('0x2e')],qs['fields'](_0x205e71[_0x32dc('0x2c')]['fields']));_0x4d53f1[_0x32dc('0x2f')]=_0x4d53f1['attributes'][_0x32dc('0x42')]?_0x4d53f1[_0x32dc('0x2f')]:_0x5705fe[_0x32dc('0x2e')];if(_0x205e71[_0x32dc('0x2c')][_0x32dc('0x3b')]){_0x4d53f1[_0x32dc('0x3c')]=[{'all':!![]}];}_0x4d53f1=_[_0x32dc('0x39')]({},_0x4d53f1,_0x205e71[_0x32dc('0x3a')]);return db[_0x32dc('0x28')][_0x32dc('0x43')](_0x4d53f1)[_0x32dc('0x21')](handleEntityNotFound(_0x4411c4,null))['then'](respondWithResult(_0x4411c4,null))[_0x32dc('0x3f')](handleError(_0x4411c4,null));};exports[_0x32dc('0x44')]=function(_0x265197,_0xdd70f5){return db['ChatQueueReport'][_0x32dc('0x44')](_0x265197['body'],{})[_0x32dc('0x21')](respondWithResult(_0xdd70f5,0xc9))['catch'](handleError(_0xdd70f5,null));};exports['update']=function(_0x79a5b6,_0xdb438c){if(_0x79a5b6[_0x32dc('0x45')]['id']){delete _0x79a5b6[_0x32dc('0x45')]['id'];}return db['ChatQueueReport'][_0x32dc('0x43')]({'where':{'id':_0x79a5b6[_0x32dc('0x41')]['id']}})[_0x32dc('0x21')](handleEntityNotFound(_0xdb438c,null))['then'](saveUpdates(_0x79a5b6['body'],null))[_0x32dc('0x21')](respondWithResult(_0xdb438c,null))['catch'](handleError(_0xdb438c,null));};exports[_0x32dc('0x22')]=function(_0x57ff36,_0x48395d){return db[_0x32dc('0x28')][_0x32dc('0x43')]({'where':{'id':_0x57ff36[_0x32dc('0x41')]['id']}})[_0x32dc('0x21')](handleEntityNotFound(_0x48395d,null))['then'](removeEntity(_0x48395d,null))[_0x32dc('0x3f')](handleError(_0x48395d,null));};exports['describe']=function(_0x2514ff,_0x2056c2){return db[_0x32dc('0x28')][_0x32dc('0x46')]()[_0x32dc('0x21')](respondWithResult(_0x2056c2,null))['catch'](handleError(_0x2056c2,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9ce2e2b..69266f3 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1aaea9,_0x17b611){var _0x3f2b76=function(_0x4a523f){while(--_0x4a523f){_0x1aaea9['push'](_0x1aaea9['shift']());}};_0x3f2b76(++_0x17b611);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xcb91[_0x4c6d6f];return _0x2d4478;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x22a591,_0x248366){var _0x3bef99=function(_0x1d3dbf){while(--_0x1d3dbf){_0x22a591['push'](_0x22a591['shift']());}};_0x3bef99(++_0x248366);}(_0x757a,0xde));var _0xa757=function(_0x2db84e,_0x3be689){_0x2db84e=_0x2db84e-0x0;var _0x1582e0=_0x757a[_0x2db84e];return _0x1582e0;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d8014b4..1486135 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 _0x7db2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','stringify','UpdateChatQueueReport','body','where','attributes','util','moment'];(function(_0x5771a1,_0x3939ef){var _0x5a3ffe=function(_0x59bc39){while(--_0x59bc39){_0x5771a1['push'](_0x5771a1['shift']());}};_0x5a3ffe(++_0x3939ef);}(_0x7db2,0xf6));var _0x27db=function(_0x391050,_0x38fa8b){_0x391050=_0x391050-0x0;var _0xb942d7=_0x7db2[_0x391050];return _0xb942d7;};'use strict';var _=require('lodash');var util=require(_0x27db('0x0'));var moment=require(_0x27db('0x1'));var BPromise=require('bluebird');var rs=require(_0x27db('0x2'));var fs=require('fs');var Redis=require(_0x27db('0x3'));var db=require(_0x27db('0x4'))['db'];var utils=require(_0x27db('0x5'));var logger=require(_0x27db('0x6'))(_0x27db('0x7'));var config=require('../../config/environment');var jayson=require(_0x27db('0x8'));var client=jayson[_0x27db('0x9')][_0x27db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x272a94,_0x3f480e,_0x3386d2){return new BPromise(function(_0x454a5d,_0x1de195){return client['request'](_0x272a94,_0x3386d2)['then'](function(_0x31a859){logger['info'](_0x27db('0xb'),_0x3f480e,_0x27db('0xc'));logger[_0x27db('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3f480e,_0x27db('0xc'),JSON['stringify'](_0x31a859));if(_0x31a859[_0x27db('0xe')]){if(_0x31a859[_0x27db('0xe')][_0x27db('0xf')]===0x1f4){logger[_0x27db('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x3f480e,_0x31a859['error']['message']);return _0x1de195(_0x31a859[_0x27db('0xe')]['message']);}logger[_0x27db('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x3f480e,_0x31a859[_0x27db('0xe')][_0x27db('0x10')]);return _0x454a5d(_0x31a859[_0x27db('0xe')]['message']);}else{logger[_0x27db('0x11')](_0x27db('0xb'),_0x3f480e,_0x27db('0xc'));_0x454a5d(_0x31a859[_0x27db('0x12')][_0x27db('0x10')]);}})[_0x27db('0x13')](function(_0x555bcb){logger[_0x27db('0xe')](_0x27db('0xb'),_0x3f480e,_0x555bcb);_0x1de195(_0x555bcb);});});}exports[_0x27db('0x14')]=function(_0x11bdc4){var _0x440871=this;return new Promise(function(_0x19f026,_0x2cb75e){return db[_0x27db('0x15')][_0x27db('0x16')](_0x11bdc4['body'],{'raw':_0x11bdc4[_0x27db('0x17')]?_0x11bdc4['options'][_0x27db('0x18')]===undefined?!![]:![]:!![]})[_0x27db('0x19')](function(_0x1beadb){logger[_0x27db('0x11')](_0x27db('0x14'),_0x11bdc4);logger[_0x27db('0xd')](_0x27db('0x14'),_0x11bdc4,JSON[_0x27db('0x1a')](_0x1beadb));_0x19f026(_0x1beadb);})['catch'](function(_0x6f8eb2){logger['error'](_0x27db('0x14'),_0x6f8eb2[_0x27db('0x10')],_0x11bdc4);_0x2cb75e(_0x440871['error'](0x1f4,_0x6f8eb2[_0x27db('0x10')]));});});};exports[_0x27db('0x1b')]=function(_0x304d0b){var _0x3a6bb4=this;return new Promise(function(_0xbbcfda,_0x549a2a){return db[_0x27db('0x15')]['update'](_0x304d0b[_0x27db('0x1c')],{'raw':_0x304d0b['options']?_0x304d0b[_0x27db('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x304d0b[_0x27db('0x17')]?_0x304d0b[_0x27db('0x17')][_0x27db('0x1d')]||null:null,'attributes':_0x304d0b[_0x27db('0x17')]?_0x304d0b[_0x27db('0x17')][_0x27db('0x1e')]||null:null,'limit':_0x304d0b[_0x27db('0x17')]?_0x304d0b[_0x27db('0x17')]['limit']||null:null})[_0x27db('0x19')](function(_0x1a99f4){logger[_0x27db('0x11')]('UpdateChatQueueReport',_0x304d0b);logger['debug'](_0x27db('0x1b'),_0x304d0b,JSON['stringify'](_0x1a99f4));_0xbbcfda(_0x1a99f4);})[_0x27db('0x13')](function(_0x3c339d){logger[_0x27db('0xe')]('UpdateChatQueueReport',_0x3c339d['message'],_0x304d0b);_0x549a2a(_0x3a6bb4[_0x27db('0xe')](0x1f4,_0x3c339d['message']));});});}; \ No newline at end of file +var _0x9b87=['raw','then','UpdateChatQueueReport','ChatQueueReport','update','where','limit','lodash','util','randomstring','ioredis','rpc','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','create','body','options'];(function(_0x42f0d1,_0x45fe4a){var _0x43f981=function(_0x5882e8){while(--_0x5882e8){_0x42f0d1['push'](_0x42f0d1['shift']());}};_0x43f981(++_0x45fe4a);}(_0x9b87,0x7f));var _0x79b8=function(_0x1a9456,_0x299738){_0x1a9456=_0x1a9456-0x0;var _0x23beb9=_0x9b87[_0x1a9456];return _0x23beb9;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x79b8('0x2'));var fs=require('fs');var Redis=require(_0x79b8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79b8('0x4'));var config=require('../../config/environment');var jayson=require(_0x79b8('0x5'));var client=jayson[_0x79b8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4549c9,_0x4f79da,_0x918156){return new BPromise(function(_0x5b3a15,_0x4b8e85){return client[_0x79b8('0x7')](_0x4549c9,_0x918156)['then'](function(_0xdbb15c){logger[_0x79b8('0x8')](_0x79b8('0x9'),_0x4f79da,_0x79b8('0xa'));logger[_0x79b8('0xb')](_0x79b8('0xc'),_0x4f79da,_0x79b8('0xa'),JSON[_0x79b8('0xd')](_0xdbb15c));if(_0xdbb15c[_0x79b8('0xe')]){if(_0xdbb15c[_0x79b8('0xe')][_0x79b8('0xf')]===0x1f4){logger[_0x79b8('0xe')](_0x79b8('0x9'),_0x4f79da,_0xdbb15c[_0x79b8('0xe')]['message']);return _0x4b8e85(_0xdbb15c['error'][_0x79b8('0x10')]);}logger[_0x79b8('0xe')](_0x79b8('0x9'),_0x4f79da,_0xdbb15c[_0x79b8('0xe')][_0x79b8('0x10')]);return _0x5b3a15(_0xdbb15c[_0x79b8('0xe')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4f79da,_0x79b8('0xa'));_0x5b3a15(_0xdbb15c[_0x79b8('0x11')][_0x79b8('0x10')]);}})[_0x79b8('0x12')](function(_0x22c1db){logger[_0x79b8('0xe')](_0x79b8('0x9'),_0x4f79da,_0x22c1db);_0x4b8e85(_0x22c1db);});});}exports[_0x79b8('0x13')]=function(_0x373213){var _0x3f202a=this;return new Promise(function(_0x4fea55,_0x31cf71){return db['ChatQueueReport'][_0x79b8('0x14')](_0x373213[_0x79b8('0x15')],{'raw':_0x373213[_0x79b8('0x16')]?_0x373213['options'][_0x79b8('0x17')]===undefined?!![]:![]:!![]})[_0x79b8('0x18')](function(_0x20a41d){logger[_0x79b8('0x8')](_0x79b8('0x13'),_0x373213);logger[_0x79b8('0xb')]('CreateChatQueueReport',_0x373213,JSON[_0x79b8('0xd')](_0x20a41d));_0x4fea55(_0x20a41d);})[_0x79b8('0x12')](function(_0x4db3bd){logger[_0x79b8('0xe')]('CreateChatQueueReport',_0x4db3bd[_0x79b8('0x10')],_0x373213);_0x31cf71(_0x3f202a[_0x79b8('0xe')](0x1f4,_0x4db3bd[_0x79b8('0x10')]));});});};exports[_0x79b8('0x19')]=function(_0x185acb){var _0x418be5=this;return new Promise(function(_0x2a1b08,_0x2c3733){return db[_0x79b8('0x1a')][_0x79b8('0x1b')](_0x185acb['body'],{'raw':_0x185acb[_0x79b8('0x16')]?_0x185acb[_0x79b8('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x185acb[_0x79b8('0x16')]?_0x185acb[_0x79b8('0x16')][_0x79b8('0x1c')]||null:null,'attributes':_0x185acb[_0x79b8('0x16')]?_0x185acb[_0x79b8('0x16')]['attributes']||null:null,'limit':_0x185acb[_0x79b8('0x16')]?_0x185acb[_0x79b8('0x16')][_0x79b8('0x1d')]||null:null})['then'](function(_0x303380){logger['info'](_0x79b8('0x19'),_0x185acb);logger[_0x79b8('0xb')]('UpdateChatQueueReport',_0x185acb,JSON[_0x79b8('0xd')](_0x303380));_0x2a1b08(_0x303380);})[_0x79b8('0x12')](function(_0x54b9ec){logger[_0x79b8('0xe')]('UpdateChatQueueReport',_0x54b9ec[_0x79b8('0x10')],_0x185acb);_0x2c3733(_0x418be5[_0x79b8('0xe')](0x1f4,_0x54b9ec[_0x79b8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d614a55..a5bb299 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 _0xe434=['describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x401484,_0x41e86b){var _0xcd93f8=function(_0x49cf08){while(--_0x49cf08){_0x401484['push'](_0x401484['shift']());}};_0xcd93f8(++_0x41e86b);}(_0xe434,0x148));var _0x4e43=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe434[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x4e43('0x0'));var util=require(_0x4e43('0x1'));var path=require(_0x4e43('0x2'));var timeout=require(_0x4e43('0x3'));var express=require(_0x4e43('0x4'));var router=express['Router']();var fs_extra=require(_0x4e43('0x5'));var auth=require(_0x4e43('0x6'));var interaction=require(_0x4e43('0x7'));var config=require(_0x4e43('0x8'));var controller=require('./chatQueueReport.controller');router[_0x4e43('0x9')]('/',auth[_0x4e43('0xa')](),controller[_0x4e43('0xb')]);router[_0x4e43('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4e43('0xc')]);router[_0x4e43('0x9')](_0x4e43('0xd'),auth[_0x4e43('0xa')](),controller[_0x4e43('0xe')]);router[_0x4e43('0xf')]('/',auth[_0x4e43('0xa')](),controller['create']);router[_0x4e43('0x10')](_0x4e43('0xd'),auth[_0x4e43('0xa')](),controller[_0x4e43('0x11')]);router[_0x4e43('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4e43('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfd1e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','path'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xfd1e,0x12a));var _0xefd1=function(_0x262a3c,_0x526af7){_0x262a3c=_0x262a3c-0x0;var _0x2bc502=_0xfd1e[_0x262a3c];return _0x2bc502;};'use strict';var multer=require(_0xefd1('0x0'));var util=require('util');var path=require(_0xefd1('0x1'));var timeout=require(_0xefd1('0x2'));var express=require(_0xefd1('0x3'));var router=express[_0xefd1('0x4')]();var fs_extra=require(_0xefd1('0x5'));var auth=require(_0xefd1('0x6'));var interaction=require(_0xefd1('0x7'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xefd1('0x8')]);router[_0xefd1('0x9')](_0xefd1('0xa'),auth[_0xefd1('0xb')](),controller[_0xefd1('0xc')]);router[_0xefd1('0x9')](_0xefd1('0xd'),auth[_0xefd1('0xb')](),controller[_0xefd1('0xe')]);router[_0xefd1('0xf')]('/',auth[_0xefd1('0xb')](),controller[_0xefd1('0x10')]);router['put'](_0xefd1('0xd'),auth[_0xefd1('0xb')](),controller[_0xefd1('0x11')]);router[_0xefd1('0x12')]('/:id',auth[_0xefd1('0xb')](),controller['destroy']);module[_0xefd1('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 901b5b9..d964870 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(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2b0b55,_0x456037){_0x2b0b55=_0x2b0b55-0x0;var _0x74f8fc=_0xb43b[_0x2b0b55];return _0x74f8fc;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x44e240,_0x4357a4){var _0x5670cf=function(_0x1c09d3){while(--_0x1c09d3){_0x44e240['push'](_0x44e240['shift']());}};_0x5670cf(++_0x4357a4);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 954cd6f..830b3ee 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 _0x2a4f=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','then','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2dfd86,_0x3cf246){var _0x5b6aa1=function(_0x25b2e1){while(--_0x25b2e1){_0x2dfd86['push'](_0x2dfd86['shift']());}};_0x5b6aa1(++_0x3cf246);}(_0x2a4f,0xfd));var _0xf2a4=function(_0x559e51,_0x2836f7){_0x559e51=_0x559e51-0x0;var _0x3d228c=_0x2a4f[_0x559e51];return _0x3d228c;};'use strict';var emlformat=require(_0xf2a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2a4('0x1'));var jsonpatch=require(_0xf2a4('0x2'));var rp=require('request-promise');var moment=require(_0xf2a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf2a4('0x4'));var util=require('util');var path=require(_0xf2a4('0x5'));var sox=require('sox');var csv=require(_0xf2a4('0x6'));var ejs=require(_0xf2a4('0x7'));var fs=require('fs');var fs_extra=require(_0xf2a4('0x8'));var _=require(_0xf2a4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf2a4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf2a4('0x6'));var querystring=require(_0xf2a4('0xb'));var Papa=require('papaparse');var Redis=require(_0xf2a4('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xf2a4('0xd'));var as=require(_0xf2a4('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2a4('0xf'))(_0xf2a4('0x10'));var utils=require(_0xf2a4('0x11'));var config=require(_0xf2a4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2a4('0x13'))['db'];function respondWithStatusCode(_0x5bfd13,_0x3a5f4b){_0x3a5f4b=_0x3a5f4b||0xcc;return function(_0x21f6c6){if(_0x21f6c6){return _0x5bfd13[_0xf2a4('0x14')](_0x3a5f4b);}return _0x5bfd13[_0xf2a4('0x15')](_0x3a5f4b)[_0xf2a4('0x16')]();};}function respondWithResult(_0x329867,_0x2b30f1){_0x2b30f1=_0x2b30f1||0xc8;return function(_0x4e67a7){if(_0x4e67a7){return _0x329867['status'](_0x2b30f1)['json'](_0x4e67a7);}};}function respondWithFilteredResult(_0x24b4c4,_0x5bd3a0){return function(_0x20cfe9){if(_0x20cfe9){var _0x368443=typeof _0x5bd3a0[_0xf2a4('0x17')]===_0xf2a4('0x18')&&typeof _0x5bd3a0['limit']===_0xf2a4('0x18');var _0xa9da4c=_0x20cfe9[_0xf2a4('0x19')];var _0x95a1cc=_0x368443?0x0:_0x5bd3a0[_0xf2a4('0x17')];var _0x579118=_0x368443?_0x20cfe9[_0xf2a4('0x19')]:_0x5bd3a0[_0xf2a4('0x17')]+_0x5bd3a0[_0xf2a4('0x1a')];var _0x48106a;if(_0x579118>=_0xa9da4c){_0x579118=_0xa9da4c;_0x48106a=0xc8;}else{_0x48106a=0xce;}_0x24b4c4[_0xf2a4('0x15')](_0x48106a);return _0x24b4c4[_0xf2a4('0x1b')]('Content-Range',_0x95a1cc+'-'+_0x579118+'/'+_0xa9da4c)[_0xf2a4('0x1c')](_0x20cfe9);}return null;};}function patchUpdates(_0x36683c){return function(_0x1d3325){try{jsonpatch[_0xf2a4('0x1d')](_0x1d3325,_0x36683c,!![]);}catch(_0x1a2acd){return BPromise['reject'](_0x1a2acd);}return _0x1d3325[_0xf2a4('0x1e')]();};}function saveUpdates(_0xf41b9d,_0xa842ee){return function(_0x2efe80){if(_0x2efe80){return _0x2efe80['update'](_0xf41b9d)['then'](function(_0x332f4d){return _0x332f4d;});}return null;};}function removeEntity(_0x2d9b37,_0x35a834){return function(_0x22ac58){if(_0x22ac58){return _0x22ac58['destroy']()[_0xf2a4('0x1f')](function(){_0x2d9b37[_0xf2a4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x543170,_0x5f6f21){return function(_0x3665b4){if(!_0x3665b4){_0x543170[_0xf2a4('0x14')](0x194);}return _0x3665b4;};}function handleError(_0x4ba744,_0x14efe3){_0x14efe3=_0x14efe3||0x1f4;return function(_0x527c98){logger[_0xf2a4('0x20')](_0x527c98['stack']);if(_0x527c98[_0xf2a4('0x21')]){delete _0x527c98[_0xf2a4('0x21')];}_0x4ba744[_0xf2a4('0x15')](_0x14efe3)[_0xf2a4('0x22')](_0x527c98);};}exports[_0xf2a4('0x23')]=function(_0x39fae2,_0x11aca1){var _0x140912={},_0x5a7224={},_0x2702eb={'count':0x0,'rows':[]};var _0x5cc301=_[_0xf2a4('0x24')](db[_0xf2a4('0x25')][_0xf2a4('0x26')],function(_0x43f4b4){return{'name':_0x43f4b4[_0xf2a4('0x27')],'type':_0x43f4b4[_0xf2a4('0x28')]['key']};});_0x5a7224['model']=_[_0xf2a4('0x24')](_0x5cc301,_0xf2a4('0x21'));_0x5a7224[_0xf2a4('0x29')]=_[_0xf2a4('0x2a')](_0x39fae2['query']);_0x5a7224['filters']=_[_0xf2a4('0x2b')](_0x5a7224[_0xf2a4('0x2c')],_0x5a7224['query']);_0x140912['attributes']=_[_0xf2a4('0x2b')](_0x5a7224['model'],qs[_0xf2a4('0x2d')](_0x39fae2[_0xf2a4('0x29')][_0xf2a4('0x2d')]));_0x140912[_0xf2a4('0x2e')]=_0x140912[_0xf2a4('0x2e')]['length']?_0x140912[_0xf2a4('0x2e')]:_0x5a7224[_0xf2a4('0x2c')];if(!_0x39fae2[_0xf2a4('0x29')]['hasOwnProperty']('nolimit')){_0x140912[_0xf2a4('0x1a')]=qs[_0xf2a4('0x1a')](_0x39fae2['query'][_0xf2a4('0x1a')]);_0x140912[_0xf2a4('0x17')]=qs[_0xf2a4('0x17')](_0x39fae2[_0xf2a4('0x29')][_0xf2a4('0x17')]);}_0x140912['order']=qs['sort'](_0x39fae2[_0xf2a4('0x29')][_0xf2a4('0x2f')]);_0x140912[_0xf2a4('0x30')]=qs[_0xf2a4('0x31')](_[_0xf2a4('0x32')](_0x39fae2[_0xf2a4('0x29')],_0x5a7224[_0xf2a4('0x31')]),_0x5cc301);if(_0x39fae2['query'][_0xf2a4('0x33')]){_0x140912[_0xf2a4('0x30')]=_[_0xf2a4('0x34')](_0x140912[_0xf2a4('0x30')],{'$or':_['map'](_0x5cc301,function(_0x27b3e8){if(_0x27b3e8[_0xf2a4('0x28')]!==_0xf2a4('0x35')){var _0x466d9d={};_0x466d9d[_0x27b3e8[_0xf2a4('0x21')]]={'$like':'%'+_0x39fae2[_0xf2a4('0x29')]['filter']+'%'};return _0x466d9d;}})});}_0x140912=_['merge']({},_0x140912,_0x39fae2[_0xf2a4('0x36')]);var _0x5d22c5={'where':_0x140912[_0xf2a4('0x30')]};return db[_0xf2a4('0x25')][_0xf2a4('0x19')](_0x5d22c5)['then'](function(_0xfef690){_0x2702eb[_0xf2a4('0x19')]=_0xfef690;if(_0x39fae2[_0xf2a4('0x29')][_0xf2a4('0x37')]){_0x140912[_0xf2a4('0x38')]=[{'all':!![]}];}return db[_0xf2a4('0x25')][_0xf2a4('0x39')](_0x140912);})[_0xf2a4('0x1f')](function(_0x5dab3b){_0x2702eb[_0xf2a4('0x3a')]=_0x5dab3b;return _0x2702eb;})[_0xf2a4('0x1f')](respondWithFilteredResult(_0x11aca1,_0x140912))[_0xf2a4('0x3b')](handleError(_0x11aca1,null));};exports['show']=function(_0x577a07,_0x457f5a){var _0x62eb18={'raw':!![],'where':{'id':_0x577a07[_0xf2a4('0x3c')]['id']}},_0x2840e1={};_0x2840e1['model']=_[_0xf2a4('0x2a')](db['ChatTransferReport']['rawAttributes']);_0x2840e1[_0xf2a4('0x29')]=_[_0xf2a4('0x2a')](_0x577a07[_0xf2a4('0x29')]);_0x2840e1[_0xf2a4('0x31')]=_[_0xf2a4('0x2b')](_0x2840e1[_0xf2a4('0x2c')],_0x2840e1[_0xf2a4('0x29')]);_0x62eb18[_0xf2a4('0x2e')]=_[_0xf2a4('0x2b')](_0x2840e1[_0xf2a4('0x2c')],qs[_0xf2a4('0x2d')](_0x577a07['query'][_0xf2a4('0x2d')]));_0x62eb18['attributes']=_0x62eb18['attributes'][_0xf2a4('0x3d')]?_0x62eb18[_0xf2a4('0x2e')]:_0x2840e1['model'];if(_0x577a07[_0xf2a4('0x29')]['includeAll']){_0x62eb18['include']=[{'all':!![]}];}_0x62eb18=_[_0xf2a4('0x34')]({},_0x62eb18,_0x577a07[_0xf2a4('0x36')]);return db['ChatTransferReport'][_0xf2a4('0x3e')](_0x62eb18)[_0xf2a4('0x1f')](handleEntityNotFound(_0x457f5a,null))['then'](respondWithResult(_0x457f5a,null))[_0xf2a4('0x3b')](handleError(_0x457f5a,null));};exports[_0xf2a4('0x3f')]=function(_0x3ed30d,_0x8507d2){return db[_0xf2a4('0x25')][_0xf2a4('0x3f')](_0x3ed30d[_0xf2a4('0x40')],{})[_0xf2a4('0x1f')](respondWithResult(_0x8507d2,0xc9))[_0xf2a4('0x3b')](handleError(_0x8507d2,null));};exports['update']=function(_0xac851f,_0x1f3670){if(_0xac851f['body']['id']){delete _0xac851f[_0xf2a4('0x40')]['id'];}return db['ChatTransferReport'][_0xf2a4('0x3e')]({'where':{'id':_0xac851f[_0xf2a4('0x3c')]['id']}})[_0xf2a4('0x1f')](handleEntityNotFound(_0x1f3670,null))[_0xf2a4('0x1f')](saveUpdates(_0xac851f[_0xf2a4('0x40')],null))[_0xf2a4('0x1f')](respondWithResult(_0x1f3670,null))[_0xf2a4('0x3b')](handleError(_0x1f3670,null));};exports[_0xf2a4('0x41')]=function(_0x5999a3,_0x2d6212){return db[_0xf2a4('0x25')]['find']({'where':{'id':_0x5999a3[_0xf2a4('0x3c')]['id']}})[_0xf2a4('0x1f')](handleEntityNotFound(_0x2d6212,null))[_0xf2a4('0x1f')](removeEntity(_0x2d6212,null))[_0xf2a4('0x3b')](handleError(_0x2d6212,null));};exports[_0xf2a4('0x42')]=function(_0x23a27d,_0x4bc1c0){return db[_0xf2a4('0x25')]['describe']()['then'](respondWithResult(_0x4bc1c0,null))[_0xf2a4('0x3b')](handleError(_0x4bc1c0,null));}; \ No newline at end of file +var _0x0603=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','length','include','create','catch','update','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x4c2d7d,_0x17a1ef){var _0x5220e6=function(_0x1c01ff){while(--_0x1c01ff){_0x4c2d7d['push'](_0x4c2d7d['shift']());}};_0x5220e6(++_0x17a1ef);}(_0x0603,0x1cb));var _0x3060=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x0603[_0x26f702];return _0x11417d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3060('0x0'));var zipdir=require(_0x3060('0x1'));var jsonpatch=require(_0x3060('0x2'));var rp=require('request-promise');var moment=require(_0x3060('0x3'));var BPromise=require(_0x3060('0x4'));var Mustache=require(_0x3060('0x5'));var util=require(_0x3060('0x6'));var path=require(_0x3060('0x7'));var sox=require(_0x3060('0x8'));var csv=require(_0x3060('0x9'));var ejs=require(_0x3060('0xa'));var fs=require('fs');var fs_extra=require(_0x3060('0xb'));var _=require('lodash');var squel=require(_0x3060('0xc'));var crypto=require(_0x3060('0xd'));var jsforce=require(_0x3060('0xe'));var deskjs=require(_0x3060('0xf'));var toCsv=require(_0x3060('0x9'));var querystring=require(_0x3060('0x10'));var Papa=require(_0x3060('0x11'));var Redis=require(_0x3060('0x12'));var authService=require(_0x3060('0x13'));var qs=require(_0x3060('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3060('0x15'));var utils=require(_0x3060('0x16'));var config=require(_0x3060('0x17'));var licenseUtil=require(_0x3060('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7539,_0x5b1e0d){_0x5b1e0d=_0x5b1e0d||0xcc;return function(_0x1b0b23){if(_0x1b0b23){return _0x1f7539[_0x3060('0x19')](_0x5b1e0d);}return _0x1f7539['status'](_0x5b1e0d)[_0x3060('0x1a')]();};}function respondWithResult(_0x218830,_0x32866b){_0x32866b=_0x32866b||0xc8;return function(_0x3911ca){if(_0x3911ca){return _0x218830[_0x3060('0x1b')](_0x32866b)[_0x3060('0x1c')](_0x3911ca);}};}function respondWithFilteredResult(_0x499d54,_0x2227d2){return function(_0x60daa4){if(_0x60daa4){var _0x5be196=typeof _0x2227d2[_0x3060('0x1d')]==='undefined'&&typeof _0x2227d2['limit']===_0x3060('0x1e');var _0x4c9944=_0x60daa4[_0x3060('0x1f')];var _0x30f308=_0x5be196?0x0:_0x2227d2['offset'];var _0x3eb387=_0x5be196?_0x60daa4[_0x3060('0x1f')]:_0x2227d2[_0x3060('0x1d')]+_0x2227d2['limit'];var _0x9cbe01;if(_0x3eb387>=_0x4c9944){_0x3eb387=_0x4c9944;_0x9cbe01=0xc8;}else{_0x9cbe01=0xce;}_0x499d54['status'](_0x9cbe01);return _0x499d54[_0x3060('0x20')](_0x3060('0x21'),_0x30f308+'-'+_0x3eb387+'/'+_0x4c9944)['json'](_0x60daa4);}return null;};}function patchUpdates(_0x210023){return function(_0x58a548){try{jsonpatch[_0x3060('0x22')](_0x58a548,_0x210023,!![]);}catch(_0x4e640a){return BPromise[_0x3060('0x23')](_0x4e640a);}return _0x58a548[_0x3060('0x24')]();};}function saveUpdates(_0xd0bda5,_0x6dbee0){return function(_0x5d6b37){if(_0x5d6b37){return _0x5d6b37['update'](_0xd0bda5)[_0x3060('0x25')](function(_0x5b2bf6){return _0x5b2bf6;});}return null;};}function removeEntity(_0x446fec,_0x414d60){return function(_0x2f56e4){if(_0x2f56e4){return _0x2f56e4[_0x3060('0x26')]()[_0x3060('0x25')](function(){_0x446fec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b195,_0x3372a3){return function(_0x22a637){if(!_0x22a637){_0x28b195['sendStatus'](0x194);}return _0x22a637;};}function handleError(_0xf6fa3c,_0x474a42){_0x474a42=_0x474a42||0x1f4;return function(_0x54245a){logger[_0x3060('0x27')](_0x54245a[_0x3060('0x28')]);if(_0x54245a[_0x3060('0x29')]){delete _0x54245a['name'];}_0xf6fa3c[_0x3060('0x1b')](_0x474a42)['send'](_0x54245a);};}exports[_0x3060('0x2a')]=function(_0xb05d3,_0x2999e4){var _0x7e792f={},_0x144611={},_0x1e8325={'count':0x0,'rows':[]};var _0x15feaa=_[_0x3060('0x2b')](db[_0x3060('0x2c')]['rawAttributes'],function(_0x1c661b){return{'name':_0x1c661b[_0x3060('0x2d')],'type':_0x1c661b[_0x3060('0x2e')][_0x3060('0x2f')]};});_0x144611[_0x3060('0x30')]=_[_0x3060('0x2b')](_0x15feaa,_0x3060('0x29'));_0x144611[_0x3060('0x31')]=_[_0x3060('0x32')](_0xb05d3['query']);_0x144611[_0x3060('0x33')]=_[_0x3060('0x34')](_0x144611[_0x3060('0x30')],_0x144611[_0x3060('0x31')]);_0x7e792f[_0x3060('0x35')]=_[_0x3060('0x34')](_0x144611['model'],qs[_0x3060('0x36')](_0xb05d3[_0x3060('0x31')][_0x3060('0x36')]));_0x7e792f[_0x3060('0x35')]=_0x7e792f[_0x3060('0x35')]['length']?_0x7e792f['attributes']:_0x144611[_0x3060('0x30')];if(!_0xb05d3[_0x3060('0x31')][_0x3060('0x37')](_0x3060('0x38'))){_0x7e792f[_0x3060('0x39')]=qs[_0x3060('0x39')](_0xb05d3['query'][_0x3060('0x39')]);_0x7e792f[_0x3060('0x1d')]=qs[_0x3060('0x1d')](_0xb05d3[_0x3060('0x31')][_0x3060('0x1d')]);}_0x7e792f[_0x3060('0x3a')]=qs['sort'](_0xb05d3['query']['sort']);_0x7e792f[_0x3060('0x3b')]=qs['filters'](_[_0x3060('0x3c')](_0xb05d3[_0x3060('0x31')],_0x144611[_0x3060('0x33')]),_0x15feaa);if(_0xb05d3[_0x3060('0x31')][_0x3060('0x3d')]){_0x7e792f[_0x3060('0x3b')]=_[_0x3060('0x3e')](_0x7e792f[_0x3060('0x3b')],{'$or':_[_0x3060('0x2b')](_0x15feaa,function(_0x3a872a){if(_0x3a872a['type']!==_0x3060('0x3f')){var _0x32250d={};_0x32250d[_0x3a872a[_0x3060('0x29')]]={'$like':'%'+_0xb05d3[_0x3060('0x31')][_0x3060('0x3d')]+'%'};return _0x32250d;}})});}_0x7e792f=_[_0x3060('0x3e')]({},_0x7e792f,_0xb05d3[_0x3060('0x40')]);var _0x8e6c57={'where':_0x7e792f['where']};return db[_0x3060('0x2c')][_0x3060('0x1f')](_0x8e6c57)[_0x3060('0x25')](function(_0x47374b){_0x1e8325[_0x3060('0x1f')]=_0x47374b;if(_0xb05d3['query'][_0x3060('0x41')]){_0x7e792f['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x3060('0x42')](_0x7e792f);})[_0x3060('0x25')](function(_0x341c15){_0x1e8325['rows']=_0x341c15;return _0x1e8325;})[_0x3060('0x25')](respondWithFilteredResult(_0x2999e4,_0x7e792f))['catch'](handleError(_0x2999e4,null));};exports[_0x3060('0x43')]=function(_0x1700a9,_0x53ec5e){var _0x3eb719={'raw':!![],'where':{'id':_0x1700a9[_0x3060('0x44')]['id']}},_0x63013c={};_0x63013c[_0x3060('0x30')]=_['keys'](db[_0x3060('0x2c')][_0x3060('0x45')]);_0x63013c[_0x3060('0x31')]=_[_0x3060('0x32')](_0x1700a9[_0x3060('0x31')]);_0x63013c[_0x3060('0x33')]=_[_0x3060('0x34')](_0x63013c['model'],_0x63013c[_0x3060('0x31')]);_0x3eb719[_0x3060('0x35')]=_['intersection'](_0x63013c[_0x3060('0x30')],qs[_0x3060('0x36')](_0x1700a9[_0x3060('0x31')][_0x3060('0x36')]));_0x3eb719[_0x3060('0x35')]=_0x3eb719['attributes'][_0x3060('0x46')]?_0x3eb719[_0x3060('0x35')]:_0x63013c[_0x3060('0x30')];if(_0x1700a9[_0x3060('0x31')][_0x3060('0x41')]){_0x3eb719[_0x3060('0x47')]=[{'all':!![]}];}_0x3eb719=_['merge']({},_0x3eb719,_0x1700a9[_0x3060('0x40')]);return db[_0x3060('0x2c')]['find'](_0x3eb719)[_0x3060('0x25')](handleEntityNotFound(_0x53ec5e,null))[_0x3060('0x25')](respondWithResult(_0x53ec5e,null))['catch'](handleError(_0x53ec5e,null));};exports[_0x3060('0x48')]=function(_0x58af1c,_0x4e0c61){return db[_0x3060('0x2c')]['create'](_0x58af1c['body'],{})['then'](respondWithResult(_0x4e0c61,0xc9))[_0x3060('0x49')](handleError(_0x4e0c61,null));};exports[_0x3060('0x4a')]=function(_0x19c5a9,_0x50a713){if(_0x19c5a9[_0x3060('0x4b')]['id']){delete _0x19c5a9[_0x3060('0x4b')]['id'];}return db[_0x3060('0x2c')][_0x3060('0x4c')]({'where':{'id':_0x19c5a9[_0x3060('0x44')]['id']}})[_0x3060('0x25')](handleEntityNotFound(_0x50a713,null))[_0x3060('0x25')](saveUpdates(_0x19c5a9[_0x3060('0x4b')],null))[_0x3060('0x25')](respondWithResult(_0x50a713,null))[_0x3060('0x49')](handleError(_0x50a713,null));};exports['destroy']=function(_0x5367dc,_0x20c629){return db['ChatTransferReport'][_0x3060('0x4c')]({'where':{'id':_0x5367dc[_0x3060('0x44')]['id']}})[_0x3060('0x25')](handleEntityNotFound(_0x20c629,null))[_0x3060('0x25')](removeEntity(_0x20c629,null))['catch'](handleError(_0x20c629,null));};exports[_0x3060('0x4d')]=function(_0x5eb90c,_0x33efed){return db[_0x3060('0x2c')]['describe']()[_0x3060('0x25')](respondWithResult(_0x33efed,null))[_0x3060('0x49')](handleError(_0x33efed,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index d31d415..6f91cb4 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 _0x786d=['request-promise','path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x3c9ff9,_0x3255a0){var _0x34a960=function(_0x36e310){while(--_0x36e310){_0x3c9ff9['push'](_0x3c9ff9['shift']());}};_0x34a960(++_0x3255a0);}(_0x786d,0x169));var _0xd786=function(_0x4f1a22,_0x4f17f6){_0x4f1a22=_0x4f1a22-0x0;var _0x4ac7d5=_0x786d[_0x4f1a22];return _0x4ac7d5;};'use strict';var _=require(_0xd786('0x0'));var util=require(_0xd786('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd786('0x2'));var fs=require('fs');var path=require(_0xd786('0x3'));var rimraf=require(_0xd786('0x4'));var config=require('../../config/environment');var attributes=require(_0xd786('0x5'));module[_0xd786('0x6')]=function(_0x2b8e23,_0x225b1c){return _0x2b8e23[_0xd786('0x7')](_0xd786('0x8'),attributes,{'tableName':_0xd786('0x9'),'paranoid':![],'indexes':[{'name':_0xd786('0xa'),'fields':[_0xd786('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8d0=['uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_chat_transfer'];(function(_0x4ded9a,_0x2ed64b){var _0xd73f5c=function(_0x10640a){while(--_0x10640a){_0x4ded9a['push'](_0x4ded9a['shift']());}};_0xd73f5c(++_0x2ed64b);}(_0xd8d0,0xcd));var _0x0d8d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd8d0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0d8d('0x0'));var util=require(_0x0d8d('0x1'));var logger=require('../../config/logger')(_0x0d8d('0x2'));var moment=require(_0x0d8d('0x3'));var BPromise=require(_0x0d8d('0x4'));var rp=require(_0x0d8d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d8d('0x6'));var config=require(_0x0d8d('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0x0d8d('0x8')]=function(_0x3bc488,_0x3b546e){return _0x3bc488[_0x0d8d('0x9')]('ChatTransferReport',attributes,{'tableName':_0x0d8d('0xa'),'paranoid':![],'indexes':[{'name':_0x0d8d('0xb'),'fields':[_0x0d8d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d58d149..892573b 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 _0x0255=['http','request','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0255,0x1d4));var _0x5025=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0255[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5025('0x0'));var util=require(_0x5025('0x1'));var moment=require('moment');var BPromise=require(_0x5025('0x2'));var rs=require(_0x5025('0x3'));var fs=require('fs');var Redis=require(_0x5025('0x4'));var db=require(_0x5025('0x5'))['db'];var utils=require(_0x5025('0x6'));var logger=require(_0x5025('0x7'))(_0x5025('0x8'));var config=require(_0x5025('0x9'));var jayson=require(_0x5025('0xa'));var client=jayson[_0x5025('0xb')][_0x5025('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e1f54,_0x3abbbe,_0x252fd9){return new BPromise(function(_0x3705bb,_0x4a1a99){return client[_0x5025('0xd')](_0x1e1f54,_0x252fd9)[_0x5025('0xe')](function(_0x5d5674){logger[_0x5025('0xf')](_0x5025('0x10'),_0x3abbbe,'request\x20sent');logger['debug'](_0x5025('0x11'),_0x3abbbe,_0x5025('0x12'),JSON[_0x5025('0x13')](_0x5d5674));if(_0x5d5674[_0x5025('0x14')]){if(_0x5d5674[_0x5025('0x14')]['code']===0x1f4){logger['error'](_0x5025('0x10'),_0x3abbbe,_0x5d5674[_0x5025('0x14')][_0x5025('0x15')]);return _0x4a1a99(_0x5d5674['error'][_0x5025('0x15')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3abbbe,_0x5d5674['error'][_0x5025('0x15')]);return _0x3705bb(_0x5d5674[_0x5025('0x14')][_0x5025('0x15')]);}else{logger[_0x5025('0xf')](_0x5025('0x10'),_0x3abbbe,_0x5025('0x12'));_0x3705bb(_0x5d5674[_0x5025('0x16')][_0x5025('0x15')]);}})[_0x5025('0x17')](function(_0xc8c4a7){logger[_0x5025('0x14')](_0x5025('0x10'),_0x3abbbe,_0xc8c4a7);_0x4a1a99(_0xc8c4a7);});});} \ No newline at end of file +var _0x190b=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x1df954,_0x3336ad){var _0x58b973=function(_0x4fbd26){while(--_0x4fbd26){_0x1df954['push'](_0x1df954['shift']());}};_0x58b973(++_0x3336ad);}(_0x190b,0x12b));var _0xb190=function(_0x50ff8a,_0x54d766){_0x50ff8a=_0x50ff8a-0x0;var _0x351f67=_0x190b[_0x50ff8a];return _0x351f67;};'use strict';var _=require(_0xb190('0x0'));var util=require('util');var moment=require(_0xb190('0x1'));var BPromise=require(_0xb190('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb190('0x3'));var db=require(_0xb190('0x4'))['db'];var utils=require(_0xb190('0x5'));var logger=require('../../config/logger')(_0xb190('0x6'));var config=require(_0xb190('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40796d,_0x4f9eda,_0x161a29){return new BPromise(function(_0x4dab73,_0x53cf72){return client[_0xb190('0x8')](_0x40796d,_0x161a29)[_0xb190('0x9')](function(_0x4410bf){logger[_0xb190('0xa')](_0xb190('0xb'),_0x4f9eda,_0xb190('0xc'));logger[_0xb190('0xd')](_0xb190('0xe'),_0x4f9eda,_0xb190('0xc'),JSON[_0xb190('0xf')](_0x4410bf));if(_0x4410bf[_0xb190('0x10')]){if(_0x4410bf[_0xb190('0x10')][_0xb190('0x11')]===0x1f4){logger[_0xb190('0x10')](_0xb190('0xb'),_0x4f9eda,_0x4410bf[_0xb190('0x10')][_0xb190('0x12')]);return _0x53cf72(_0x4410bf[_0xb190('0x10')][_0xb190('0x12')]);}logger[_0xb190('0x10')](_0xb190('0xb'),_0x4f9eda,_0x4410bf[_0xb190('0x10')][_0xb190('0x12')]);return _0x4dab73(_0x4410bf[_0xb190('0x10')][_0xb190('0x12')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4f9eda,_0xb190('0xc'));_0x4dab73(_0x4410bf['result']['message']);}})[_0xb190('0x13')](function(_0x3de203){logger[_0xb190('0x10')](_0xb190('0xb'),_0x4f9eda,_0x3de203);_0x53cf72(_0x3de203);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 51aed5e..221104c 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 _0x9d76=['show','create','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','isAuthenticated','index','describe','get','/:id'];(function(_0x5da51a,_0x1ea7b0){var _0x298b2f=function(_0x4a3910){while(--_0x4a3910){_0x5da51a['push'](_0x5da51a['shift']());}};_0x298b2f(++_0x1ea7b0);}(_0x9d76,0x14f));var _0x69d7=function(_0x13d1d6,_0x629921){_0x13d1d6=_0x13d1d6-0x0;var _0x4ec87b=_0x9d76[_0x13d1d6];return _0x4ec87b;};'use strict';var multer=require('multer');var util=require(_0x69d7('0x0'));var path=require('path');var timeout=require(_0x69d7('0x1'));var express=require(_0x69d7('0x2'));var router=express['Router']();var fs_extra=require(_0x69d7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x69d7('0x4'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x69d7('0x5')](),controller[_0x69d7('0x6')]);router['get']('/describe',auth[_0x69d7('0x5')](),controller[_0x69d7('0x7')]);router[_0x69d7('0x8')](_0x69d7('0x9'),auth['isAuthenticated'](),controller[_0x69d7('0xa')]);router['post']('/',auth[_0x69d7('0x5')](),controller[_0x69d7('0xb')]);router['put']('/:id',auth[_0x69d7('0x5')](),controller[_0x69d7('0xc')]);router[_0x69d7('0xd')](_0x69d7('0x9'),auth[_0x69d7('0x5')](),controller['destroy']);module[_0x69d7('0xe')]=router; \ No newline at end of file +var _0x3046=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy'];(function(_0x3e52b7,_0x44922e){var _0x1edd86=function(_0x457bb8){while(--_0x457bb8){_0x3e52b7['push'](_0x3e52b7['shift']());}};_0x1edd86(++_0x44922e);}(_0x3046,0x1dc));var _0x6304=function(_0x53a8e6,_0x3d4fe8){_0x53a8e6=_0x53a8e6-0x0;var _0x51dd52=_0x3046[_0x53a8e6];return _0x51dd52;};'use strict';var multer=require(_0x6304('0x0'));var util=require(_0x6304('0x1'));var path=require('path');var timeout=require(_0x6304('0x2'));var express=require(_0x6304('0x3'));var router=express['Router']();var fs_extra=require(_0x6304('0x4'));var auth=require(_0x6304('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6304('0x6'));router[_0x6304('0x7')]('/',auth[_0x6304('0x8')](),controller[_0x6304('0x9')]);router[_0x6304('0x7')](_0x6304('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6304('0x7')](_0x6304('0xb'),auth[_0x6304('0x8')](),controller[_0x6304('0xc')]);router[_0x6304('0xd')]('/',auth[_0x6304('0x8')](),controller[_0x6304('0xe')]);router[_0x6304('0xf')](_0x6304('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6304('0x10')](_0x6304('0xb'),auth['isAuthenticated'](),controller[_0x6304('0x11')]);module[_0x6304('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index bd3798e..c68393f 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 _0x3479=['offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','thumb','TEXT','input','name','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x3479,0x17c));var _0x9347=function(_0x11b9be,_0x3a8373){_0x11b9be=_0x11b9be-0x0;var _0x32057d=_0x3479[_0x11b9be];return _0x32057d;};'use strict';var Sequelize=require(_0x9347('0x0'));var rs=require(_0x9347('0x1'));module[_0x9347('0x2')]={'name':{'type':Sequelize[_0x9347('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x9347('0x3')],'allowNull':![],'unique':_0x9347('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x9347('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x6')},'customerAlias':{'type':Sequelize[_0x9347('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9347('0x3')],'allowNull':![],'defaultValue':_0x9347('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x9347('0x3')],'allowNull':![],'defaultValue':_0x9347('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9347('0x3')],'allowNull':![],'defaultValue':_0x9347('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9347('0x3')],'allowNull':![],'defaultValue':_0x9347('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9347('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9347('0x3')]},'animation':{'type':Sequelize[_0x9347('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9347('0xb')](_0x9347('0xc'),_0x9347('0xd')),'defaultValue':_0x9347('0xc')},'header_online':{'type':Sequelize[_0x9347('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0xe')},'offline_chat_button':{'type':Sequelize[_0x9347('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x9347('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x9347('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9347('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x9347('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0x12')},'noteTitle':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x13')},'placeholderMessage':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x14')},'closingMessage':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0x16')},'skipMessageButton':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x17')},'conditionAgreement':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x9347('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x9347('0x18'),_0x9347('0x19')),'defaultValue':_0x9347('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9347('0x1a')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9347('0x1b'),'variable':null,'config':{'placeholder':_0x9347('0x1c'),'type':'text','required':!![]},'props':{'title':_0x9347('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0x9347('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x9347('0x5'),'type':_0x9347('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9347('0x1d')](_0x9347('0x1e'))?JSON[_0x9347('0x1f')](this[_0x9347('0x1d')](_0x9347('0x1e'))):{};},'set':function(_0xd4ece7){return this[_0x9347('0x20')](_0x9347('0x1e'),JSON[_0x9347('0x21')](_0xd4ece7));}},'offlineForm':{'type':Sequelize[_0x9347('0x1a')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9347('0x1b'),'props':{'title':_0x9347('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x9347('0x5'),'type':_0x9347('0x5')},'variable':null},{'type':_0x9347('0x22'),'config':{'placeholder':_0x9347('0x23')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x9347('0x1d')]('offlineForm')?JSON[_0x9347('0x1f')](this['getDataValue'](_0x9347('0x24'))):{};},'set':function(_0x2424d4){return this[_0x9347('0x20')](_0x9347('0x24'),JSON[_0x9347('0x21')](_0x2424d4));}},'token':{'type':Sequelize[_0x9347('0x3')],'defaultValue':function(){return rs[_0x9347('0x25')]();}},'autoclose':{'type':Sequelize[_0x9347('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9347('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0x26')},'waitingMessage':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0x28')},'offlineMessageBody':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x9347('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x9347('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x17')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9347('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9347('0x1a')],'defaultValue':function(){return _0x9347('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9347('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0x2b')},'verticalAlignment':{'type':Sequelize[_0x9347('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x9347('0x2c')},'messagesAlignment':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x2d')},'defaultTitle':{'type':Sequelize[_0x9347('0x3')]},'customerAvatar':{'type':Sequelize[_0x9347('0x1a')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9347('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9347('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9347('0x3')],'defaultValue':_0x9347('0x2e')},'systemAvatar':{'type':Sequelize[_0x9347('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9347('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![],'comment':_0x9347('0x30'),'set':function(_0x34850b){if(!_0x34850b)this[_0x9347('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x9347('0x31'),_0x34850b);}},'vidaooEscalation':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9347('0x3')]},'vidaooTopic':{'type':Sequelize[_0x9347('0x3')],'allowNull':![],'defaultValue':_0x9347('0x32')},'vidaooNote':{'type':Sequelize[_0x9347('0x3')],'defaultValue':function(){return _0x9347('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x9347('0x1a')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9347('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9347('0x1a')]}}; \ No newline at end of file +var _0xd80c=['#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','email','onlineForm','getDataValue','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','Agent','#011F6A'];(function(_0x246bb0,_0x38d5f8){var _0x18adaa=function(_0x2df1f9){while(--_0x2df1f9){_0x246bb0['push'](_0x246bb0['shift']());}};_0x18adaa(++_0x38d5f8);}(_0xd80c,0x1e8));var _0xcd80=function(_0x207a0c,_0x2cc153){_0x207a0c=_0x207a0c-0x0;var _0x5209df=_0xd80c[_0x207a0c];return _0x5209df;};'use strict';var Sequelize=require(_0xcd80('0x0'));var rs=require(_0xcd80('0x1'));module[_0xcd80('0x2')]={'name':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![],'unique':_0xcd80('0x4')},'description':{'type':Sequelize[_0xcd80('0x3')]},'mapKey':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x5')},'customerAlias':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![],'defaultValue':_0xcd80('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![],'defaultValue':_0xcd80('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xcd80('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xcd80('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcd80('0x9')](_0xcd80('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0xb')},'start_chat_button':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0xd')},'download_transcript':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcd80('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xcd80('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x12')},'noteTitle':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x14')},'closingMessageButton':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x16')},'ratingType':{'type':Sequelize[_0xcd80('0x9')](_0xcd80('0x17'),_0xcd80('0x18')),'defaultValue':_0xcd80('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xcd80('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xcd80('0x19')]({'items':[{'type':_0xcd80('0x1a'),'variable':null,'config':{'placeholder':_0xcd80('0x1b'),'type':_0xcd80('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xcd80('0x1d'),'helpText':''},'config':{'required':!![],'placeholder':_0xcd80('0x1d'),'type':_0xcd80('0x1d')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xcd80('0x1e'))?JSON['parse'](this[_0xcd80('0x1f')](_0xcd80('0x1e'))):{};},'set':function(_0x421ab0){return this['setDataValue'](_0xcd80('0x1e'),JSON['stringify'](_0x421ab0));}},'offlineForm':{'type':Sequelize[_0xcd80('0x10')],'defaultValue':function(){return JSON[_0xcd80('0x19')]({'items':[{'type':_0xcd80('0x1a'),'props':{'title':_0xcd80('0x1d'),'helpText':''},'config':{'required':!![],'placeholder':_0xcd80('0x1d'),'type':_0xcd80('0x1d')},'variable':null},{'type':_0xcd80('0x20'),'config':{'placeholder':_0xcd80('0x21')},'props':{'title':_0xcd80('0x21'),'helpText':_0xcd80('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xcd80('0x1f')]('offlineForm')?JSON[_0xcd80('0x23')](this[_0xcd80('0x1f')](_0xcd80('0x24'))):{};},'set':function(_0x3f33e7){return this[_0xcd80('0x25')](_0xcd80('0x24'),JSON[_0xcd80('0x19')](_0x3f33e7));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcd80('0x26')]();}},'autoclose':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xcd80('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xcd80('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x27')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x2b')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xcd80('0x15')},'sendUnmanaged':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x2c')},'enableCustomerAttachment':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xcd80('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xcd80('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcd80('0x10')],'defaultValue':function(){return _0xcd80('0x2d');}},'notificationSound':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize[_0xcd80('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcd80('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xcd80('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x2f')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xcd80('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![],'defaultValue':_0xcd80('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcd80('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcd80('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':_0xcd80('0x31')},'systemAvatar':{'type':Sequelize[_0xcd80('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd80('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![],'comment':_0xcd80('0x32'),'set':function(_0x1a518c){if(!_0x1a518c)this[_0xcd80('0x25')](_0xcd80('0x33'),null);this['setDataValue'](_0xcd80('0x34'),_0x1a518c);}},'vidaooEscalation':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xcd80('0x3')]},'vidaooTopic':{'type':Sequelize[_0xcd80('0x3')],'allowNull':![],'defaultValue':_0xcd80('0x35')},'vidaooNote':{'type':Sequelize[_0xcd80('0x3')],'defaultValue':function(){return _0xcd80('0x36');}},'vidaooMetadata':{'type':Sequelize[_0xcd80('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xcd80('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xcd80('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index a8964f5..a50e8cc 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 _0x437a=['no\x20available\x20attributes','difference','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','originalname','mimetype','subjectOffline','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','addInteraction','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','getSnippet','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','origin','3.8.1','remote','remoteAddress','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','jayson/promise','../../components/parsers/qs','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','UserProfileResource','sendStatus','stack','send','user-agent-parser','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','name','version','format','%s\x20%s','browser','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Sequelize','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmContact','No\x20available\x20attributes','createdAt','updatedAt','ListId','List','Contacts','DESC','Interval','interval','spread','account','applications','orderBy','Applications','priority','asc','list','contact','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','EventManager','offline','files'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x437a,0x184));var _0xa437=function(_0x8ce99,_0xe40fa0){_0x8ce99=_0x8ce99-0x0;var _0x186ca7=_0x437a[_0x8ce99];return _0x186ca7;};'use strict';var Mustache=require(_0xa437('0x0'));var util=require(_0xa437('0x1'));var path=require(_0xa437('0x2'));var ejs=require(_0xa437('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa437('0x4'));var querystring=require(_0xa437('0x5'));var htmlToText=require(_0xa437('0x6'));var Redis=require('ioredis');var jayson=require(_0xa437('0x7'));var url=require('url');var qs=require(_0xa437('0x8'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require(_0xa437('0x9'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xa437('0x9'))[_0xa437('0xa')];var APIHandleError=require(_0xa437('0x9'))[_0xa437('0xb')];var APIConflictError=require(_0xa437('0x9'))[_0xa437('0xc')];var db=require(_0xa437('0xd'))['db'];config['redis']=_[_0xa437('0xe')](config[_0xa437('0xf')],{'host':_0xa437('0x10'),'port':0x18eb});var socket=require(_0xa437('0x11'))(new Redis(config['redis']));require(_0xa437('0x12'))[_0xa437('0x13')](socket);var client=jayson[_0xa437('0x14')][_0xa437('0x15')]({'port':0x232c});var client9002=jayson[_0xa437('0x14')]['http']({'port':0x232a});var client9003=jayson[_0xa437('0x14')][_0xa437('0x15')]({'port':0x232b});var client9001=jayson[_0xa437('0x14')][_0xa437('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x86a5de,_0x42736c,_0x1825ed,_0x40cf6e){return new Promise(function(_0x3d3953,_0x2b1f7d){var _0x3a4e18=_0x40cf6e||client;return _0x3a4e18[_0xa437('0x16')](_0x86a5de,_0x1825ed)[_0xa437('0x17')](function(_0x5134af){logger['info'](_0xa437('0x18'),_0x42736c,_0xa437('0x19'));logger[_0xa437('0x1a')](_0xa437('0x1b'),_0x42736c,_0xa437('0x19'),JSON[_0xa437('0x1c')](_0x5134af));if(_0x5134af[_0xa437('0x1d')]){if(_0x5134af['error'][_0xa437('0x1e')]===0x1f4){logger['error'](_0xa437('0x18'),_0x42736c,_0x5134af[_0xa437('0x1d')][_0xa437('0x1f')]);return _0x2b1f7d(_0x5134af[_0xa437('0x1d')][_0xa437('0x1f')]);}logger[_0xa437('0x1d')](_0xa437('0x18'),_0x42736c,_0x5134af[_0xa437('0x1d')]['message']);return _0x3d3953(_0x5134af[_0xa437('0x1d')]['message']);}else{logger['info'](_0xa437('0x18'),_0x42736c,'request\x20sent');_0x3d3953(_0x5134af['result']['message']);}})[_0xa437('0x20')](function(_0x3750b6){logger['error'](_0xa437('0x18'),_0x42736c,_0x3750b6);_0x2b1f7d(_0x3750b6);});});}function respondWithStatusCode(_0x298eb4,_0x33fe33){_0x33fe33=_0x33fe33||0xcc;return function(_0x2a3d7c){if(_0x2a3d7c){return _0x298eb4['sendStatus'](_0x33fe33);}return _0x298eb4[_0xa437('0x21')](_0x33fe33)[_0xa437('0x22')]();};}function respondWithResult(_0x5d0db5,_0x2cf114){_0x2cf114=_0x2cf114||0xc8;return function(_0x4b5301){if(_0x4b5301){return _0x5d0db5[_0xa437('0x21')](_0x2cf114)[_0xa437('0x23')](_0x4b5301);}};}function respondWithFilteredResult(_0xa0bdca,_0x1f63c8){return function(_0x17b68d){if(_0x17b68d){var _0x2ab33a=typeof _0x1f63c8[_0xa437('0x24')]===_0xa437('0x25')&&typeof _0x1f63c8[_0xa437('0x26')]==='undefined';var _0x9946cf=_0x17b68d[_0xa437('0x27')];var _0x56a014=_0x2ab33a?0x0:_0x1f63c8[_0xa437('0x24')];var _0x2a385d=_0x2ab33a?_0x17b68d[_0xa437('0x27')]:_0x1f63c8[_0xa437('0x24')]+_0x1f63c8[_0xa437('0x26')];var _0x2444c0;if(_0x2a385d>=_0x9946cf){_0x2a385d=_0x9946cf;_0x2444c0=0xc8;}else{_0x2444c0=0xce;}_0xa0bdca[_0xa437('0x21')](_0x2444c0);return _0xa0bdca[_0xa437('0x28')](_0xa437('0x29'),_0x56a014+'-'+_0x2a385d+'/'+_0x9946cf)[_0xa437('0x23')](_0x17b68d);}return null;};}function saveUpdates(_0x30dc3e){return function(_0x2c0e6f){if(_0x2c0e6f){return _0x2c0e6f[_0xa437('0x2a')](_0x30dc3e)[_0xa437('0x17')](function(_0x458128){return _0x458128;});}return null;};}function removeEntity(_0x3259aa){return function(_0x4b95f4){if(_0x4b95f4){return _0x4b95f4[_0xa437('0x2b')]()[_0xa437('0x17')](function(){var _0x363ab7=_0x4b95f4[_0xa437('0x2c')]({'plain':!![]});var _0x187df2='ChatWebsites';return db[_0xa437('0x2d')]['destroy']({'where':{'type':_0x187df2,'resourceId':_0x363ab7['id']}})[_0xa437('0x17')](function(){return _0x4b95f4;});})['then'](function(){_0x3259aa[_0xa437('0x21')](0xcc)[_0xa437('0x22')]();});}};}function handleEntityNotFound(_0x47093d){return function(_0x50db18){if(!_0x50db18){_0x47093d[_0xa437('0x2e')](0x194);}return _0x50db18;};}function handleError(_0x19f8c0,_0x478e16){_0x478e16=_0x478e16||0x1f4;return function(_0x3c1358){logger[_0xa437('0x1d')](_0x3c1358[_0xa437('0x2f')]);if(_0x3c1358['name']){delete _0x3c1358['name'];}_0x19f8c0[_0xa437('0x21')](_0x478e16)[_0xa437('0x30')](_0x3c1358);};}function createInteractionObject(_0x1539cc,_0x1493ec,_0x2a682b,_0x55bf76){var _0xb566cb=require(_0xa437('0x31'));var _0x2a834e=new _0xb566cb();var _0x1b5136=_0x2a834e['setUA'](_0x2a682b['user-agent'])[_0xa437('0x32')]();var _0x1f7af3=_0x1493ec[_0xa437('0x33')];if(_0x2a682b[_0xa437('0x34')]){_0x1f7af3=_0x2a682b['cf-connecting-ip'];}else if(_0x2a682b[_0xa437('0x35')]){_0x1f7af3=_[_0xa437('0x36')](_0x2a682b[_0xa437('0x35')][_0xa437('0x37')](','));}return{'ContactId':_0x55bf76['id'],'ChatWebsiteId':_0x1539cc,'from':(_0x55bf76[_0xa437('0x38')]||'')+'\x20'+(_0x55bf76[_0xa437('0x39')]||''),'customerIp':_0x1f7af3,'customerPort':_0x2a682b[_0xa437('0x3a')]?_0x2a682b[_0xa437('0x3a')]:null,'referer':_0x1493ec[_0xa437('0x3b')],'browserName':_0x1b5136['browser'][_0xa437('0x3c')]&&_0x1b5136['browser'][_0xa437('0x3d')]?util[_0xa437('0x3e')](_0xa437('0x3f'),_0x1b5136[_0xa437('0x40')][_0xa437('0x3c')],_0x1b5136[_0xa437('0x40')][_0xa437('0x3d')]):_0xa437('0x41'),'browserVersion':_0x1b5136[_0xa437('0x40')][_0xa437('0x3d')]||'unknown','osName':util[_0xa437('0x3e')](_0xa437('0x3f'),_0x1b5136['os']['name'],_0x1b5136['os'][_0xa437('0x3d')]),'osVersion':_0x1b5136['os']['version'],'deviceModel':_0x1b5136[_0xa437('0x42')][_0xa437('0x43')]&&_0x1b5136[_0xa437('0x42')][_0xa437('0x44')]?util[_0xa437('0x3e')](_0xa437('0x45'),_0x1b5136[_0xa437('0x42')]['model'],_0x1b5136[_0xa437('0x42')][_0xa437('0x44')],_0x1b5136[_0xa437('0x42')][_0xa437('0x46')]):null,'deviceVendor':_0x1b5136[_0xa437('0x42')][_0xa437('0x44')],'deviceType':_0x1b5136[_0xa437('0x42')]['type'],'formData':JSON[_0xa437('0x1c')](_0x1493ec)};}exports[_0xa437('0x47')]=function(_0x3479df,_0x1494c9){var _0x141346={'include':[{'model':db[_0xa437('0x48')],'as':_0xa437('0x49')}]},_0x4a4499={},_0x3f28f9={'count':0x0,'rows':[]};var _0x542135=_[_0xa437('0x4a')](db[_0xa437('0x4b')][_0xa437('0x4c')],function(_0x18f280){return{'name':_0x18f280[_0xa437('0x4d')],'type':_0x18f280[_0xa437('0x46')][_0xa437('0x4e')]};});_0x4a4499[_0xa437('0x43')]=_['map'](_0x542135,'name');_0x4a4499[_0xa437('0x4f')]=_['keys'](_0x3479df[_0xa437('0x4f')]);_0x4a4499[_0xa437('0x50')]=_['intersection'](_0x4a4499[_0xa437('0x43')],_0x4a4499[_0xa437('0x4f')]);_0x141346['attributes']=_[_0xa437('0x51')](_0x4a4499[_0xa437('0x43')],qs[_0xa437('0x52')](_0x3479df[_0xa437('0x4f')][_0xa437('0x52')]));_0x141346['attributes']=_0x141346[_0xa437('0x53')][_0xa437('0x54')]?_0x141346[_0xa437('0x53')]:_0x4a4499[_0xa437('0x43')];if(!_0x3479df[_0xa437('0x4f')][_0xa437('0x55')](_0xa437('0x56'))){_0x141346[_0xa437('0x26')]=qs[_0xa437('0x26')](_0x3479df[_0xa437('0x4f')][_0xa437('0x26')]);_0x141346[_0xa437('0x24')]=qs[_0xa437('0x24')](_0x3479df[_0xa437('0x4f')][_0xa437('0x24')]);}_0x141346[_0xa437('0x57')]=qs[_0xa437('0x58')](_0x3479df[_0xa437('0x4f')]['sort']);_0x141346['where']=qs['filters'](_[_0xa437('0x59')](_0x3479df[_0xa437('0x4f')],_0x4a4499['filters']),_0x542135);if(_0x3479df[_0xa437('0x4f')]['filter']){_0x141346[_0xa437('0x5a')]=_[_0xa437('0x5b')](_0x141346['where'],{'$or':_['map'](_0x542135,function(_0x410081){if(_0x410081[_0xa437('0x46')]!==_0xa437('0x5c')){var _0x4d90bf={};_0x4d90bf[_0x410081['name']]={'$like':'%'+_0x3479df[_0xa437('0x4f')][_0xa437('0x5d')]+'%'};return _0x4d90bf;}})});}_0x141346=_[_0xa437('0x5b')]({},_0x141346,_0x3479df[_0xa437('0x5e')]);var _0x75061e={'where':_0x141346[_0xa437('0x5a')]};return db[_0xa437('0x4b')][_0xa437('0x27')](_0x75061e)[_0xa437('0x17')](function(_0x343cd5){_0x3f28f9['count']=_0x343cd5;if(_0x3479df['query'][_0xa437('0x5f')]){_0x141346[_0xa437('0x60')]=[{'all':!![]}];}return db[_0xa437('0x4b')][_0xa437('0x61')](_0x141346);})[_0xa437('0x17')](function(_0x2f804e){_0x3f28f9['rows']=_0x2f804e;return _0x3f28f9;})[_0xa437('0x17')](respondWithFilteredResult(_0x1494c9,_0x141346))[_0xa437('0x20')](handleError(_0x1494c9,null));};exports['show']=function(_0x193d4e,_0x4fde91){var _0x432bd8={'raw':![],'where':{'id':_0x193d4e[_0xa437('0x62')]['id']},'include':[{'model':db[_0xa437('0x48')],'as':_0xa437('0x49')}]},_0x245d08={};_0x245d08['model']=_[_0xa437('0x63')](db['ChatWebsite'][_0xa437('0x4c')]);_0x245d08['query']=_[_0xa437('0x63')](_0x193d4e[_0xa437('0x4f')]);_0x245d08[_0xa437('0x50')]=_['intersection'](_0x245d08['model'],_0x245d08[_0xa437('0x4f')]);_0x432bd8['attributes']=_['intersection'](_0x245d08[_0xa437('0x43')],qs[_0xa437('0x52')](_0x193d4e['query'][_0xa437('0x52')]));_0x432bd8[_0xa437('0x53')]=_0x432bd8['attributes'][_0xa437('0x54')]?_0x432bd8[_0xa437('0x53')]:_0x245d08['model'];if(_0x193d4e[_0xa437('0x4f')]['includeAll']){_0x432bd8[_0xa437('0x60')]=[{'all':!![]}];}_0x432bd8=_['merge']({},_0x432bd8,_0x193d4e[_0xa437('0x5e')]);return db['ChatWebsite'][_0xa437('0x64')](_0x432bd8)['then'](handleEntityNotFound(_0x4fde91,null))[_0xa437('0x17')](respondWithResult(_0x4fde91,null))[_0xa437('0x20')](handleError(_0x4fde91,null));};exports[_0xa437('0x65')]=function(_0x305c98,_0x55926f){return db[_0xa437('0x4b')][_0xa437('0x65')](_0x305c98[_0xa437('0x66')],{})[_0xa437('0x17')](function(_0x3c7975){var _0x50494a=_0x305c98[_0xa437('0x67')][_0xa437('0x2c')]({'plain':!![]});if(!_0x50494a)throw new Error(_0xa437('0x68'));if(_0x50494a[_0xa437('0x69')]===_0xa437('0x67')){var _0x29db41=_0x3c7975[_0xa437('0x2c')]({'plain':!![]});var _0x51de64=_0xa437('0x6a');return db[_0xa437('0x6b')][_0xa437('0x64')]({'where':{'name':_0x51de64,'userProfileId':_0x50494a[_0xa437('0x6c')]},'raw':!![]})[_0xa437('0x17')](function(_0x58e47d){if(_0x58e47d&&_0x58e47d[_0xa437('0x6d')]===0x0){return db[_0xa437('0x2d')]['create']({'name':_0x29db41[_0xa437('0x3c')],'resourceId':_0x29db41['id'],'type':_0x58e47d[_0xa437('0x3c')],'sectionId':_0x58e47d['id']},{})[_0xa437('0x17')](function(){return _0x3c7975;});}else{return _0x3c7975;}})[_0xa437('0x20')](function(_0x248c59){logger[_0xa437('0x1d')](_0xa437('0x6e'),_0x248c59);throw _0x248c59;});}return _0x3c7975;})[_0xa437('0x17')](respondWithResult(_0x55926f,0xc9))[_0xa437('0x20')](handleError(_0x55926f,null));};exports[_0xa437('0x2a')]=function(_0x480fa1,_0x4b0fc9){if(_0x480fa1[_0xa437('0x66')]['id']){delete _0x480fa1[_0xa437('0x66')]['id'];}return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0x480fa1[_0xa437('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xa437('0x49')}]})['then'](handleEntityNotFound(_0x4b0fc9,null))['then'](saveUpdates(_0x480fa1['body'],null))['then'](respondWithResult(_0x4b0fc9,null))[_0xa437('0x20')](handleError(_0x4b0fc9,null));};exports[_0xa437('0x2b')]=function(_0xa1eeac,_0x3df6e3){return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0xa1eeac[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x3df6e3,null))[_0xa437('0x17')](removeEntity(_0x3df6e3,null))[_0xa437('0x20')](handleError(_0x3df6e3,null));};exports[_0xa437('0x6f')]=function(_0x2d2faf,_0x48fb58){return db[_0xa437('0x4b')]['describe']()['then'](respondWithResult(_0x48fb58,null))[_0xa437('0x20')](handleError(_0x48fb58,null));};exports['addDisposition']=function(_0xf855a6,_0x44377e){if(_0xf855a6[_0xa437('0x66')]['id']){delete _0xf855a6[_0xa437('0x66')]['id'];}return db['ChatWebsite'][_0xa437('0x64')]({'where':{'id':_0xf855a6[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x44377e,null))['then'](function(_0x24ca15){if(_0x24ca15){_0xf855a6[_0xa437('0x66')][_0xa437('0x70')]=_0x24ca15['id'];return db[_0xa437('0x71')][_0xa437('0x65')](_0xf855a6[_0xa437('0x66')]);}})[_0xa437('0x17')](respondWithResult(_0x44377e,null))['catch'](handleError(_0x44377e,null));};exports[_0xa437('0x72')]=function(_0x49b22f,_0x3e7417){var _0x3c2d0a={'raw':![],'where':{}};var _0x4edd37={};var _0xc06bb7={'count':0x0,'rows':[]};return db[_0xa437('0x4b')][_0xa437('0x73')]({'where':{'id':_0x49b22f[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x3e7417,null))[_0xa437('0x17')](function(_0x513985){if(_0x513985){_0x4edd37[_0xa437('0x43')]=_[_0xa437('0x63')](db[_0xa437('0x71')][_0xa437('0x4c')]);_0x4edd37[_0xa437('0x4f')]=_[_0xa437('0x63')](_0x49b22f[_0xa437('0x4f')]);_0x4edd37['filters']=_[_0xa437('0x51')](_0x4edd37[_0xa437('0x43')],_0x4edd37[_0xa437('0x4f')]);_0x3c2d0a[_0xa437('0x53')]=_[_0xa437('0x51')](_0x4edd37[_0xa437('0x43')],qs[_0xa437('0x52')](_0x49b22f[_0xa437('0x4f')][_0xa437('0x52')]));_0x3c2d0a[_0xa437('0x53')]=_0x3c2d0a[_0xa437('0x53')][_0xa437('0x54')]?_0x3c2d0a[_0xa437('0x53')]:_0x4edd37[_0xa437('0x43')];if(!_0x49b22f['query'][_0xa437('0x55')](_0xa437('0x56'))){_0x3c2d0a['limit']=qs[_0xa437('0x26')](_0x49b22f[_0xa437('0x4f')][_0xa437('0x26')]);_0x3c2d0a[_0xa437('0x24')]=qs[_0xa437('0x24')](_0x49b22f[_0xa437('0x4f')][_0xa437('0x24')]);}_0x3c2d0a['order']=qs[_0xa437('0x58')](_0x49b22f[_0xa437('0x4f')][_0xa437('0x58')]);_0x3c2d0a[_0xa437('0x5a')]=qs[_0xa437('0x50')](_[_0xa437('0x59')](_0x49b22f[_0xa437('0x4f')],_0x4edd37[_0xa437('0x50')]));_0x3c2d0a[_0xa437('0x5a')][_0xa437('0x70')]=_0x513985['id'];if(_0x49b22f['query']['filter']){_0x3c2d0a[_0xa437('0x5a')]=_[_0xa437('0x5b')](_0x3c2d0a[_0xa437('0x5a')],{'$or':_[_0xa437('0x4a')](_0x3c2d0a['attributes'],function(_0x556dcf){var _0x38b742={};_0x38b742[_0x556dcf]={'$like':'%'+_0x49b22f[_0xa437('0x4f')][_0xa437('0x5d')]+'%'};return _0x38b742;})});}_0x3c2d0a=_[_0xa437('0x5b')]({},_0x3c2d0a,_0x49b22f['options']);return db[_0xa437('0x71')][_0xa437('0x27')]({'where':_0x3c2d0a[_0xa437('0x5a')]})[_0xa437('0x17')](function(_0x3ee4c9){_0xc06bb7[_0xa437('0x27')]=_0x3ee4c9;if(_0x49b22f['query'][_0xa437('0x5f')]){_0x3c2d0a['include']=[{'all':!![]}];}return db[_0xa437('0x71')][_0xa437('0x61')](_0x3c2d0a);})['then'](function(_0x21722e){_0xc06bb7[_0xa437('0x74')]=_0x21722e;return _0xc06bb7;});}})['then'](respondWithFilteredResult(_0x3e7417,_0x3c2d0a))['catch'](handleError(_0x3e7417,null));};exports[_0xa437('0x75')]=function(_0xdd9dcc,_0xf61b2d){return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0xdd9dcc[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0xf61b2d,null))[_0xa437('0x17')](function(_0x2d1d58){if(_0x2d1d58){return _0x2d1d58[_0xa437('0x75')](_0xdd9dcc[_0xa437('0x4f')][_0xa437('0x76')]);}})[_0xa437('0x17')](respondWithStatusCode(_0xf61b2d,null))[_0xa437('0x20')](handleError(_0xf61b2d,null));};exports[_0xa437('0x77')]=function(_0x57a8c,_0x5440d8){if(_0x57a8c[_0xa437('0x66')]['id']){delete _0x57a8c['body']['id'];}return db['ChatWebsite'][_0xa437('0x64')]({'where':{'id':_0x57a8c['params']['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x5440d8,null))[_0xa437('0x17')](function(_0x1fad3b){if(_0x1fad3b){_0x57a8c[_0xa437('0x66')][_0xa437('0x70')]=_0x1fad3b['id'];return db[_0xa437('0x78')][_0xa437('0x65')](_0x57a8c[_0xa437('0x66')]);}})[_0xa437('0x17')](respondWithResult(_0x5440d8,null))[_0xa437('0x20')](handleError(_0x5440d8,null));};exports[_0xa437('0x79')]=function(_0xc5d684,_0x3ffd62){var _0x47f271={'raw':![],'where':{}};var _0x2bf8ca={};var _0x4ce704={'count':0x0,'rows':[]};return db[_0xa437('0x4b')][_0xa437('0x73')]({'where':{'id':_0xc5d684[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x3ffd62,null))['then'](function(_0x340743){if(_0x340743){_0x2bf8ca['model']=_[_0xa437('0x63')](db[_0xa437('0x78')][_0xa437('0x4c')]);_0x2bf8ca[_0xa437('0x4f')]=_[_0xa437('0x63')](_0xc5d684['query']);_0x2bf8ca[_0xa437('0x50')]=_[_0xa437('0x51')](_0x2bf8ca[_0xa437('0x43')],_0x2bf8ca[_0xa437('0x4f')]);_0x47f271[_0xa437('0x53')]=_[_0xa437('0x51')](_0x2bf8ca[_0xa437('0x43')],qs['fields'](_0xc5d684[_0xa437('0x4f')][_0xa437('0x52')]));_0x47f271[_0xa437('0x53')]=_0x47f271[_0xa437('0x53')][_0xa437('0x54')]?_0x47f271[_0xa437('0x53')]:_0x2bf8ca[_0xa437('0x43')];if(!_0xc5d684[_0xa437('0x4f')][_0xa437('0x55')](_0xa437('0x56'))){_0x47f271['limit']=qs[_0xa437('0x26')](_0xc5d684['query'][_0xa437('0x26')]);_0x47f271[_0xa437('0x24')]=qs['offset'](_0xc5d684['query']['offset']);}_0x47f271['order']=qs[_0xa437('0x58')](_0xc5d684[_0xa437('0x4f')][_0xa437('0x58')]);_0x47f271[_0xa437('0x5a')]=qs[_0xa437('0x50')](_[_0xa437('0x59')](_0xc5d684[_0xa437('0x4f')],_0x2bf8ca['filters']));_0x47f271[_0xa437('0x5a')][_0xa437('0x70')]=_0x340743['id'];if(_0xc5d684[_0xa437('0x4f')][_0xa437('0x5d')]){_0x47f271[_0xa437('0x5a')]=_[_0xa437('0x5b')](_0x47f271[_0xa437('0x5a')],{'$or':_['map'](_0x47f271[_0xa437('0x53')],function(_0x5e3a8d){var _0x53088d={};_0x53088d[_0x5e3a8d]={'$like':'%'+_0xc5d684[_0xa437('0x4f')][_0xa437('0x5d')]+'%'};return _0x53088d;})});}_0x47f271=_[_0xa437('0x5b')]({},_0x47f271,_0xc5d684[_0xa437('0x5e')]);return db[_0xa437('0x78')][_0xa437('0x27')]({'where':_0x47f271[_0xa437('0x5a')]})['then'](function(_0x17a0e4){_0x4ce704[_0xa437('0x27')]=_0x17a0e4;if(_0xc5d684[_0xa437('0x4f')][_0xa437('0x5f')]){_0x47f271['include']=[{'all':!![]}];}return db[_0xa437('0x78')][_0xa437('0x61')](_0x47f271);})['then'](function(_0x5dce91){_0x4ce704[_0xa437('0x74')]=_0x5dce91;return _0x4ce704;});}})[_0xa437('0x17')](respondWithFilteredResult(_0x3ffd62,_0x47f271))['catch'](handleError(_0x3ffd62,null));};exports[_0xa437('0x7a')]=function(_0x25b959,_0x30906e){return db['ChatWebsite'][_0xa437('0x64')]({'where':{'id':_0x25b959['params']['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x30906e,null))[_0xa437('0x17')](function(_0x2cbff9){if(_0x2cbff9){return _0x2cbff9[_0xa437('0x7a')](_0x25b959['query'][_0xa437('0x76')]);}})[_0xa437('0x17')](respondWithStatusCode(_0x30906e,null))[_0xa437('0x20')](handleError(_0x30906e,null));};exports[_0xa437('0x7b')]=function(_0x18a308,_0x3f6dd4){_0x18a308[_0xa437('0x66')]['sitepic']=_0x18a308[_0xa437('0x7c')][_0xa437('0x7d')];return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0x18a308['params']['id']}})['then'](handleEntityNotFound(_0x3f6dd4,null))[_0xa437('0x17')](saveUpdates(_0x18a308[_0xa437('0x66')],null))['then'](respondWithResult(_0x3f6dd4,null))['catch'](handleError(_0x3f6dd4,null));};exports['addAvatar']=function(_0x393578,_0x4d0f4b){_0x393578['body'][_0xa437('0x7e')]=_0x393578[_0xa437('0x7c')][_0xa437('0x7d')];return db['ChatWebsite'][_0xa437('0x64')]({'where':{'id':_0x393578[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x4d0f4b,null))[_0xa437('0x17')](saveUpdates(_0x393578['body'],null))['then'](respondWithResult(_0x4d0f4b,null))['catch'](handleError(_0x4d0f4b,null));};exports[_0xa437('0x7f')]=function(_0x4b820b,_0x287828){_0x4b820b[_0xa437('0x66')][_0xa437('0x80')]=_0x4b820b['file'][_0xa437('0x7d')];return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0x4b820b[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x287828,null))['then'](saveUpdates(_0x4b820b[_0xa437('0x66')],null))[_0xa437('0x17')](respondWithResult(_0x287828,null))[_0xa437('0x20')](handleError(_0x287828,null));};exports[_0xa437('0x81')]=function(_0x4666fe,_0x41b3ea){_0x4666fe[_0xa437('0x66')][_0xa437('0x82')]=_0x4666fe[_0xa437('0x7c')]['filename'];return db['ChatWebsite'][_0xa437('0x64')]({'where':{'id':_0x4666fe[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x41b3ea,null))[_0xa437('0x17')](saveUpdates(_0x4666fe[_0xa437('0x66')],null))[_0xa437('0x17')](respondWithResult(_0x41b3ea,null))['catch'](handleError(_0x41b3ea,null));};exports[_0xa437('0x83')]=function(_0x1d2b87,_0x516d91){var _0x110e9a=path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0x86'));var _0xa067d5={'where':{'id':_0x1d2b87[_0xa437('0x62')]['id']},'attributes':['id',_0xa437('0x87')],'raw':!![]};var _0x4ab294=![];return require(_0xa437('0x88'))[_0xa437('0x89')]()[_0xa437('0x17')](function(_0x14dce0){if(_0x14dce0){_0x4ab294=_0x14dce0[_0xa437('0x8a')];}})[_0xa437('0x17')](function(){return db[_0xa437('0x4b')]['find'](_0xa067d5);})[_0xa437('0x17')](handleEntityNotFound(_0x516d91,null))[_0xa437('0x17')](function(_0xc08fcf){if(_0xc08fcf){if(!_[_0xa437('0x8b')](_0xc08fcf[_0xa437('0x87')])){if(fs[_0xa437('0x8c')](path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0x8d'),_0xc08fcf[_0xa437('0x87')]))&&_0x4ab294){_0x110e9a=path['join'](config[_0xa437('0x85')],_0xa437('0x8d'),_0xc08fcf[_0xa437('0x87')]);}}return _0x516d91[_0xa437('0x8e')](_0x110e9a);}})[_0xa437('0x20')](handleError(_0x516d91,null));};exports[_0xa437('0x8f')]=function(_0x5b6f0f,_0x519268){var _0x2eba7f=path['join'](config[_0xa437('0x85')],_0xa437('0x90'));var _0x211cf9={'where':{'id':_0x5b6f0f[_0xa437('0x62')]['id']},'attributes':['id',_0xa437('0x7e')],'raw':!![]};return db[_0xa437('0x4b')]['find'](_0x211cf9)['then'](handleEntityNotFound(_0x519268,null))[_0xa437('0x17')](function(_0x18b173){if(_0x18b173){if(!_[_0xa437('0x8b')](_0x18b173[_0xa437('0x7e')])){if(fs[_0xa437('0x8c')](path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0x91'),_0x18b173['agentAvatar']))){_0x2eba7f=path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0x91'),_0x18b173[_0xa437('0x7e')]);}}return _0x519268[_0xa437('0x8e')](_0x2eba7f);}})[_0xa437('0x20')](handleError(_0x519268,null));};exports['getCustomerAvatar']=function(_0x5e6a63,_0x261ecf){var _0x169157=path['join'](config[_0xa437('0x85')],_0xa437('0x92'));var _0x5a4696={'where':{'id':_0x5e6a63['params']['id']},'attributes':['id',_0xa437('0x80'),_0xa437('0x93')],'raw':!![]};return db[_0xa437('0x4b')][_0xa437('0x64')](_0x5a4696)[_0xa437('0x17')](handleEntityNotFound(_0x261ecf,null))['then'](function(_0x521835){if(_0x521835){if(!_['isNil'](_0x521835['customerAvatar'])){if(fs[_0xa437('0x8c')](path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0x91'),_0x521835['customerAvatar']))&&_0x521835[_0xa437('0x93')]){_0x169157=path['join'](config[_0xa437('0x85')],_0xa437('0x91'),_0x521835[_0xa437('0x80')]);}}return _0x261ecf[_0xa437('0x8e')](_0x169157);}})[_0xa437('0x20')](handleError(_0x261ecf,null));};exports[_0xa437('0x94')]=function(_0x16d5ab,_0x34101d){var _0xb7be93=path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0x95'));var _0x594c1d={'where':{'id':_0x16d5ab[_0xa437('0x62')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xa437('0x4b')][_0xa437('0x64')](_0x594c1d)[_0xa437('0x17')](handleEntityNotFound(_0x34101d,null))[_0xa437('0x17')](function(_0x12f733){if(_0x12f733){if(!_[_0xa437('0x8b')](_0x12f733[_0xa437('0x82')])){if(fs['existsSync'](path[_0xa437('0x84')](config['root'],_0xa437('0x91'),_0x12f733[_0xa437('0x82')]))){_0xb7be93=path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0x91'),_0x12f733[_0xa437('0x82')]);}}return _0x34101d['download'](_0xb7be93);}})[_0xa437('0x20')](handleError(_0x34101d,null));};function checkWebsiteInterval(_0x56a882){var _0x458421=_0x56a882['Interval'];if(!_0x458421){return Promise[_0xa437('0x96')](_0x56a882);}var _0xf56d34=_0x56a882['timezone']||undefined;return _0x458421[_0xa437('0x97')](_0xf56d34)[_0xa437('0x17')](function(_0x5881b1){if(!_0x5881b1){throw new APIOutOfIntervalError();}return _0x56a882;});}exports[_0xa437('0x98')]=function(_0x3db00e,_0xe9e633){var _0x7ea1a8={'body':_0x3db00e[_0xa437('0x66')],'channel':_0xa437('0x99')};var _0x2f0945=[];var _0x3b9703=[];var _0x2b8a74={};var _0x4dae9e=![];if(_0x3db00e[_0xa437('0x66')]['id']){delete _0x3db00e[_0xa437('0x66')]['id'];}if(_[_0xa437('0x8b')](_0x3db00e[_0xa437('0x66')][_0xa437('0x9a')])){throw new APIBadRequestError(_0xa437('0x9b'));}if(_[_0xa437('0x8b')](_0x3db00e[_0xa437('0x66')][_0xa437('0x9c')])){throw new APIBadRequestError(_0xa437('0x9d'));}if(_[_0xa437('0x8b')](_0x3db00e[_0xa437('0x66')][_0xa437('0x9c')])){throw new db[(_0xa437('0x9e'))][(_0xa437('0x9f'))](_0xa437('0xa0')+_0x3b9703);}if(!_[_0xa437('0xa1')](_0x3b9703,_0x3db00e[_0xa437('0x66')][_0xa437('0x9c')])){throw new APIBadRequestError(_0xa437('0xa2')+_0x3b9703[_0xa437('0x84')](',\x20'));}var _0x45016f=_0x3db00e[_0xa437('0x66')]['customerIp']&&_0x3db00e['body'][_0xa437('0x3b')];return db[_0xa437('0xa3')][_0xa437('0x6f')]()[_0xa437('0x17')](function(_0x12da04){if(!_0x12da04){throw new Error(_0xa437('0xa4'));}_0x2f0945=Object[_0xa437('0x63')](_0x12da04)[_0xa437('0x5d')](function(_0x5c9720){return![_0xa437('0xa5'),_0xa437('0xa6')]['includes'](_0x5c9720);});_0x3b9703=Object[_0xa437('0x63')](_0x12da04)[_0xa437('0x5d')](function(_0x58909c){return![_0xa437('0xa5'),_0xa437('0xa6'),'CompanyId',_0xa437('0xa7')][_0xa437('0xa1')](_0x58909c);});if(!_['includes'](_0x3b9703,_0x3db00e[_0xa437('0x66')][_0xa437('0x9c')])){throw new APIBadRequestError(_0xa437('0xa2')+_0x3b9703[_0xa437('0x84')](',\x20'));}_0x2b8a74[_0x3db00e[_0xa437('0x66')]['mapKey']]=_0x3db00e[_0xa437('0x66')][_0xa437('0x9a')];})[_0xa437('0x17')](function(){return db['ChatWebsite'][_0xa437('0x64')]({'where':{'id':_0x3db00e['params']['id']},'include':[{'model':db['CmList'],'as':_0xa437('0xa8'),'include':[{'model':db['CmContact'],'as':_0xa437('0xa9'),'where':_0x2b8a74,'limit':0x1,'order':[[_0xa437('0xa6'),_0xa437('0xaa')]]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db[_0xa437('0xab')],'as':_0xa437('0xab'),'include':[{'model':db[_0xa437('0xab')],'as':'Intervals','attributes':['id',_0xa437('0xac')],'raw':!![]}]}]});})[_0xa437('0x17')](function(_0x578af1){if(!_0x578af1){throw new APINotFoundError(util[_0xa437('0x3e')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x3db00e[_0xa437('0x62')]['id']));}if(_0x45016f){return checkWebsiteInterval(_0x578af1);}return _0x578af1;})[_0xa437('0xad')](function(_0x5c0e54,_0x1bad07){if(!_0x1bad07)throw new APIOutOfIntervalError();if(!_0x5c0e54[_0xa437('0xa8')])return;_0x7ea1a8[_0xa437('0xae')]=_0x5c0e54;_0x7ea1a8[_0xa437('0xaf')]=_[_0xa437('0xb0')](_0x5c0e54[_0xa437('0xb1')],[_0xa437('0xb2')],[_0xa437('0xb3')]);if(_0x7ea1a8[_0xa437('0xae')]['Applications']){delete _0x7ea1a8[_0xa437('0xae')][_0xa437('0xb1')];}_0x7ea1a8['list']=_0x5c0e54['List']||{'id':_0x5c0e54[_0xa437('0xa7')]};if(_0x7ea1a8['list']&&_0x7ea1a8[_0xa437('0xb4')][_0xa437('0xa9')][_0xa437('0x54')]){return _0x7ea1a8['list'][_0xa437('0xa9')][0x0];}var _0x2833e3=_['defaults'](_0x3db00e['body'],{'firstName':_0x3db00e['body']['from'],'ListId':_0x5c0e54['ListId']});_0x2833e3[_0x3db00e[_0xa437('0x66')][_0xa437('0x9c')]]=_0x3db00e['body'][_0xa437('0x9a')];return db[_0xa437('0xa3')][_0xa437('0x65')](_0x2833e3,{'fields':_0x2f0945,'raw':!![]});})[_0xa437('0x17')](function(_0x2863ef){_0x7ea1a8[_0xa437('0xb5')]=_0x2863ef;var _0x10ec8e=createInteractionObject(_0x3db00e[_0xa437('0x62')]['id'],_0x3db00e['body'],_0x3db00e[_0xa437('0xb6')],_0x2863ef);var _0x475396={'ChatWebsiteId':_0x3db00e['params']['id']};if(_0x3db00e[_0xa437('0x66')][_0xa437('0xb7')]){_0x475396[_0xa437('0xb7')]=_0x3db00e[_0xa437('0x66')][_0xa437('0xb7')];_0x475396['closed']=![];return db[_0xa437('0xb8')][_0xa437('0x64')]({'where':_0x475396})['then'](function(_0x287f2b){var _0x57a8ed=_0x3db00e[_0xa437('0x66')]['customerIp']&&_0x3db00e[_0xa437('0x66')][_0xa437('0x3b')];if(_0x287f2b){_0x4dae9e=!![];return _0x287f2b;}else if(!_0x57a8ed&&_0x287f2b&&_0x287f2b[_0xa437('0xb9')]){throw new APIConflictError(_0xa437('0xba'));}_0x10ec8e['threadId']=_0x3db00e[_0xa437('0x66')][_0xa437('0xb7')];_0x10ec8e[_0xa437('0xbb')]=_0x3db00e[_0xa437('0x66')][_0xa437('0xbb')];return db[_0xa437('0xb8')][_0xa437('0x65')](_0x10ec8e);});}_0x475396[_0xa437('0xbc')]=_0x2863ef['id'];if(_0x3db00e[_0xa437('0x66')][_0xa437('0xbd')]&&_0x3db00e[_0xa437('0x66')][_0xa437('0xbd')]['id']){_0x475396['id']=_0x3db00e[_0xa437('0x66')][_0xa437('0xbd')]['id'];return db[_0xa437('0xb8')][_0xa437('0x64')]({'where':_0x475396})[_0xa437('0x17')](function(_0x27bdf3){var _0x2297a1=_0x3db00e[_0xa437('0x66')][_0xa437('0x33')]&&_0x3db00e[_0xa437('0x66')][_0xa437('0x3b')];if(!_0x2297a1&&_0x27bdf3&&_0x27bdf3['closed']){throw new APIConflictError(_0xa437('0xba'));}else if(_0x27bdf3){_0x4dae9e=!![];return _0x27bdf3;}else{return db[_0xa437('0xb8')][_0xa437('0x65')](_0x10ec8e);}});}return db[_0xa437('0xb8')][_0xa437('0x65')](_0x10ec8e);})[_0xa437('0x17')](function(_0x414381){if(!_0x4dae9e){return _0x414381;}var _0xd408a1={'from':(_0x7ea1a8[_0xa437('0xb5')][_0xa437('0x38')]||'')+'\x20'+(_0x7ea1a8[_0xa437('0xb5')][_0xa437('0x39')]||'')};if(_0x3db00e[_0xa437('0x66')][_0xa437('0xb7')]&&_0x3db00e[_0xa437('0x66')][_0xa437('0xbe')]&&_0x3db00e[_0xa437('0x66')][_0xa437('0xb7')]!=_0x3db00e[_0xa437('0x66')][_0xa437('0xbe')]){_0xd408a1[_0xa437('0xb7')]=_0x3db00e[_0xa437('0x66')][_0xa437('0xbe')];}return _0x414381[_0xa437('0x2a')](_0xd408a1);})[_0xa437('0x17')](function(_0x855766){_0x7ea1a8[_0xa437('0xbd')]=_0x855766[_0xa437('0x2c')]({'plain':!![]});_0x7ea1a8[_0xa437('0xbd')][_0xa437('0xbf')]=!_0x4dae9e;if(_0x7ea1a8['interaction'][_0xa437('0xbf')]){if(_0x7ea1a8[_0xa437('0xae')][_0xa437('0xc0')]){_0x7ea1a8['applications'][_0xa437('0xc1')]({'id':0x0,'priority':_0x7ea1a8[_0xa437('0xaf')][_0xa437('0x54')]+0x1,'app':_0xa437('0xc2'),'appdata':_0xa437('0xc3'),'interval':_0xa437('0xc4')});}}return db['ChatMessage'][_0xa437('0x65')]({'body':_0x3db00e[_0xa437('0x66')][_0xa437('0x66')],'ChatWebsiteId':_0x3db00e[_0xa437('0x62')]['id'],'ChatInteractionId':_0x855766['id'],'direction':'in','ContactId':_0x7ea1a8['contact']['id'],'AttachmentId':_0x3db00e[_0xa437('0x66')][_0xa437('0xc5')]});})[_0xa437('0x17')](function(_0x584873){_0x7ea1a8['message']=_0x584873;if(!_0x7ea1a8[_0xa437('0xbd')][_0xa437('0xc6')]){return;}return db[_0xa437('0xc7')][_0xa437('0x64')]({'attributes':['id',_0xa437('0x3c')],'where':{'id':_0x7ea1a8['interaction'][_0xa437('0xc6')]}});})[_0xa437('0x17')](function(_0x4aa1a5){if(_0x4aa1a5){_0x7ea1a8[_0xa437('0xaf')][_0xa437('0xc8')]({'id':0x0,'priority':0x0,'app':_0xa437('0xc9'),'appdata':_0x4aa1a5['name']+','+(_0x7ea1a8[_0xa437('0xae')][_0xa437('0xca')]||0xa),'interval':_0xa437('0xc4')});_0x7ea1a8[_0xa437('0xcb')]=!![];}if(!_0x7ea1a8[_0xa437('0xbd')]['queueId']){return;}return db[_0xa437('0xcc')][_0xa437('0x64')]({'attributes':['id',_0xa437('0x3c')],'where':{'id':_0x7ea1a8[_0xa437('0xbd')][_0xa437('0xcd')]}});})['then'](function(_0x16b09f){if(_0x16b09f){_0x7ea1a8[_0xa437('0xaf')][_0xa437('0xc8')]({'id':0x0,'priority':0x1,'app':_0xa437('0xce'),'appdata':_0x16b09f[_0xa437('0x3c')]+','+(_0x7ea1a8[_0xa437('0xae')][_0xa437('0xcf')]||0x12c),'interval':_0xa437('0xc4')});}return respondWithRpcPromise(_0xa437('0xd0'),'startRouting',_0x7ea1a8);})['then'](function(_0x334a56){respondWithRpcPromise(_0xa437('0xd1'),_0xa437('0xd1'),{'event':_0xa437('0x98'),'message':_0x334a56},client9002);return _0x334a56;})[_0xa437('0x17')](respondWithResult(_0xe9e633,null))[_0xa437('0x20')](APIHandleError(_0xe9e633));};exports[_0xa437('0xd2')]=function(_0x365b01,_0x403aca){var _0x30aee7,_0x17b3d9,_0xb82567;var _0xb7eaf6=[];var _0x50967d={};var _0xb6ddbf=_0x365b01[_0xa437('0xd3')]||[];var _0x3c0d04=[];var _0x59a1fd;return db['CmContact'][_0xa437('0x6f')]()['then'](function(_0x43d25d){if(!_0x43d25d){throw new db[(_0xa437('0x9e'))][(_0xa437('0x9f'))](_0xa437('0xd4'));}_0xb7eaf6=_[_0xa437('0xd5')](_[_0xa437('0x63')](_0x43d25d),[_0xa437('0xa5'),_0xa437('0xa6'),'CompanyId','ListId']);if(_0x365b01[_0xa437('0x66')]['id']){delete _0x365b01[_0xa437('0x66')]['id'];}if(_['isNil'](_0x365b01[_0xa437('0x66')][_0xa437('0x9a')])){throw _0x403aca[_0xa437('0x21')](0x1f4)[_0xa437('0x30')](new db[(_0xa437('0x9e'))][(_0xa437('0x9f'))](_0xa437('0xd6')));}if(_['isNil'](_0x365b01[_0xa437('0x66')][_0xa437('0x66')])||_0x365b01[_0xa437('0x66')]['body']===''){throw _0x403aca[_0xa437('0x21')](0x1f4)[_0xa437('0x30')](new db[(_0xa437('0x9e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa437('0x8b')](_0x365b01[_0xa437('0x66')][_0xa437('0xd7')])){throw _0x403aca['status'](0x1f4)[_0xa437('0x30')](new db[(_0xa437('0x9e'))][(_0xa437('0x9f'))](_0xa437('0xd8')+_0xb7eaf6));}if(!_['includes'](_0xb7eaf6,_0x365b01[_0xa437('0x66')][_0xa437('0xd7')])){throw _0x403aca['status'](0x1f4)['send'](new db[(_0xa437('0x9e'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb7eaf6));}_0x50967d[_0x365b01[_0xa437('0x66')][_0xa437('0xd7')]]=_0x365b01[_0xa437('0x66')][_0xa437('0x9a')];})[_0xa437('0x17')](function(){return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0x365b01[_0xa437('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0xa437('0xa8')},{'model':db[_0xa437('0xd9')],'as':'MailAccount'}]});})[_0xa437('0x17')](handleEntityNotFound(_0x403aca,null))[_0xa437('0x17')](function(_0x598b80){if(_0x598b80&&_0x598b80[_0xa437('0xa8')]){_0x17b3d9=_0x598b80;var _0x51f09b=_['defaults'](_0x365b01['body'],{'firstName':_0x365b01[_0xa437('0x66')]['from'],'phone':_0x365b01[_0xa437('0x66')]['from'],'ListId':_0x598b80[_0xa437('0xa7')]});_0x51f09b[_0x365b01[_0xa437('0x66')][_0xa437('0xd7')]]=_0x365b01[_0xa437('0x66')]['from'];return db[_0xa437('0xa3')]['findOrCreate']({'where':_0x50967d,'defaults':_0x51f09b});}})[_0xa437('0xad')](function(_0x28803d){if(_0x28803d){_0xb82567=_0x28803d;var _0x398602=fs[_0xa437('0xda')](path[_0xa437('0x84')](config[_0xa437('0x85')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x54ff01=ejs['render'](_0x398602,{'body':_[_0xa437('0xdb')](_0x365b01[_0xa437('0x66')][_0xa437('0x66')]),'bodyTitle':_0x17b3d9[_0xa437('0xdc')]});return db[_0xa437('0xdd')][_0xa437('0x65')]({'body':_0x54ff01,'plainBody':htmlToText[_0xa437('0xde')](_0x54ff01),'ContactId':_0x28803d['id'],'ChatWebsiteId':_0x17b3d9['id']});}})[_0xa437('0x17')](function(_0x1b6b6b){_0x59a1fd=_0x1b6b6b;if(_0xb6ddbf[_0xa437('0x54')]){var _0x52c2e2=_0xb6ddbf[_0xa437('0x4a')](function(_0x3088df){return{'name':_0x3088df['originalname'],'basename':_0x3088df['filename'],'type':_0x3088df['mimetype'],'ChatOfflineMessageId':_0x1b6b6b['id']};});_0x3c0d04=_0x52c2e2[_0xa437('0x4a')](_0x1de059=>{var _0x1b5597={'filename':_0x1de059[_0xa437('0x3c')],'path':path[_0xa437('0x84')](config[_0xa437('0x85')],_0xa437('0xdf'),_0xa437('0xd3'),_0xa437('0xe0'),'offline-chat',_0x1de059[_0xa437('0xe1')])};return _0x1b5597;});if(!_0x17b3d9[_0xa437('0xe2')]){return db[_0xa437('0xe3')][_0xa437('0xe4')](function(_0x241ce9){return db[_0xa437('0xe5')]['bulkCreate'](_0x52c2e2,{'transaction':_0x241ce9});});}}})['then'](function(){if(_0x59a1fd){_0x30aee7=_0x59a1fd;return db['MailAccount'][_0xa437('0x73')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xa437('0x17')](function(_0x3c1f95){if(_0x3c1f95&&_0x3c1f95[_0xa437('0xe6')]&&_0x17b3d9[_0xa437('0xe7')]&&_0x17b3d9[_0xa437('0xe8')]){var _0x296734=_0x3c1f95[_0xa437('0xe9')]();return respondWithRpcPromise(_0xa437('0xea'),_0xa437('0xeb'),{'account':_0x296734,'message':{'from':util[_0xa437('0x3e')](_0xa437('0xec'),_0x3c1f95[_0xa437('0x3c')],_0x3c1f95[_0xa437('0xed')]||_0x3c1f95[_0xa437('0xe6')]['user']),'to':_0x17b3d9[_0xa437('0xe8')],'subject':_0x17b3d9['offlineMessageSubject'],'html':_0x30aee7['body'],'attachments':_0x3c0d04}},client9003)[_0xa437('0x17')](function(){return _0x30aee7;})['catch'](function(_0x43116c){logger[_0xa437('0x1d')](_0x43116c);});}})['then'](function(){if(_0x17b3d9&&_0x17b3d9[_0xa437('0xe2')]&&_0x17b3d9[_0xa437('0xee')]){var _0x14b417=[];if(_0xb6ddbf[_0xa437('0x54')]){_0x14b417=_0xb6ddbf[_0xa437('0x4a')](function(_0x4694ff){return{'name':_0x4694ff[_0xa437('0xef')],'basename':_0x4694ff[_0xa437('0x7d')],'type':_0x4694ff[_0xa437('0xf0')],'ChatOfflineMessageId':_0x59a1fd['id']};});}var _0x2702bf;if(!_[_0xa437('0x8b')](_0x17b3d9[_0xa437('0xf1')])){var _0x278b6d=_[_0xa437('0x4a')](_0x365b01['body'],function(_0x2d1d84){return _0x2d1d84;});var _0x285138=_['toPairsIn'](_0x278b6d)[0x0];var _0x11a455=_['mapValues'](_0x285138,function(_0x2f6f87){return _0x2f6f87;});_0x2702bf=_0x11a455[0x1][_0x17b3d9['subjectOffline']];}var _0x98eeea={'from':_0xb82567[_0xa437('0xed')],'firstName':_0xb82567[_0xa437('0x38')],'lastName':_0xb82567[_0xa437('0x39')],'mapKey':_0xa437('0xed'),'message':{'from':_0xb82567[_0xa437('0xed')],'to':_0x17b3d9[_0xa437('0xd9')]['email'],'cc':'','subject':_[_0xa437('0x8b')](_0x2702bf)?_0x17b3d9['offlineMessageSubject']:_0x2702bf,'messageId':'','sentAt':new Date(),'attach':_0x14b417[_0xa437('0x54')],'attachments':_0x14b417,'originChannel':_0xa437('0xf2'),'ChatWebsiteId':_0x17b3d9['id'],'ChatOfflineMessageId':_0x30aee7['id'],'originTo':_0x17b3d9['MailAccount'][_0xa437('0xed')]},'body':_0x30aee7['body']};var _0x268f52={'account':{'id':_0x17b3d9[_0xa437('0xee')]},'body':_0x98eeea,'log':_0xa437('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0xa437('0xf4'),_0x268f52,client9001)['then'](function(){return _0x30aee7;})[_0xa437('0x20')](function(_0x261f35){logger[_0xa437('0x1d')](_0x261f35);});}return;})[_0xa437('0x17')](function(){if(_0x30aee7){return _0x30aee7;}})[_0xa437('0x17')](respondWithResult(_0x403aca,null))[_0xa437('0x20')](function(){for(var _0x483c28 of _0xb6ddbf){var _0x48c471=path[_0xa437('0x84')](config['root'],'server',_0xa437('0xd3'),_0xa437('0xe0'),_0xa437('0xf5'),_0x483c28[_0xa437('0x7d')]);fs_extra[_0xa437('0xf6')](_0x48c471)[_0xa437('0x20')](function(_0x99e438){logger[_0xa437('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x48c471,_0x99e438);});}});};exports[_0xa437('0xf7')]=function(_0x16b16a,_0x55727f){return db[_0xa437('0xb8')]['find']({'where':{'id':_0x16b16a[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x55727f,null))['then'](function(_0x37961c){if(_0x37961c){return _0x37961c['addInteraction'](_0x16b16a[_0xa437('0x66')]['ids'],_['omit'](_0x16b16a[_0xa437('0x66')],['ids','id'])||{});}})['then'](respondWithResult(_0x55727f,null))[_0xa437('0x20')](handleError(_0x55727f,null));};exports[_0xa437('0xf8')]=function(_0x120374,_0x51f771){var _0x1e2bde={'raw':![],'where':{}};var _0x5d97fd={};var _0xc16ffc={'count':0x0,'rows':[]};return db[_0xa437('0x4b')][_0xa437('0x73')]({'where':{'id':_0x120374[_0xa437('0x62')]['id']}})['then'](handleEntityNotFound(_0x51f771,null))[_0xa437('0x17')](function(_0x3edcce){if(_0x3edcce){_0x5d97fd[_0xa437('0x43')]=_[_0xa437('0x63')](db[_0xa437('0xb8')][_0xa437('0x4c')]);_0x5d97fd[_0xa437('0x4f')]=_[_0xa437('0x63')](_0x120374['query']);_0x5d97fd[_0xa437('0x50')]=_['intersection'](_0x5d97fd[_0xa437('0x43')],_0x5d97fd[_0xa437('0x4f')]);_0x1e2bde[_0xa437('0x53')]=_[_0xa437('0x51')](_0x5d97fd[_0xa437('0x43')],qs[_0xa437('0x52')](_0x120374['query'][_0xa437('0x52')]));_0x1e2bde[_0xa437('0x53')]=_0x1e2bde['attributes'][_0xa437('0x54')]?_0x1e2bde['attributes']:_0x5d97fd['model'];if(!_0x120374['query'][_0xa437('0x55')](_0xa437('0x56'))){_0x1e2bde[_0xa437('0x26')]=qs[_0xa437('0x26')](_0x120374[_0xa437('0x4f')][_0xa437('0x26')]);_0x1e2bde[_0xa437('0x24')]=qs[_0xa437('0x24')](_0x120374[_0xa437('0x4f')]['offset']);}_0x1e2bde[_0xa437('0x57')]=qs[_0xa437('0x58')](_0x120374['query'][_0xa437('0x58')]);_0x1e2bde[_0xa437('0x5a')]=qs[_0xa437('0x50')](_[_0xa437('0x59')](_0x120374['query'],_0x5d97fd[_0xa437('0x50')]));_0x1e2bde['where']['ChatWebsiteId']=_0x3edcce['id'];if(_0x120374[_0xa437('0x4f')][_0xa437('0x5d')]){_0x1e2bde[_0xa437('0x5a')]=_[_0xa437('0x5b')](_0x1e2bde[_0xa437('0x5a')],{'$or':_[_0xa437('0x4a')](_0x1e2bde[_0xa437('0x53')],function(_0x559134){var _0x217bef={};_0x217bef[_0x559134]={'$like':'%'+_0x120374[_0xa437('0x4f')]['filter']+'%'};return _0x217bef;})});}_0x1e2bde=_[_0xa437('0x5b')]({},_0x1e2bde,_0x120374['options']);return db['ChatInteraction'][_0xa437('0x27')]({'where':_0x1e2bde[_0xa437('0x5a')]})[_0xa437('0x17')](function(_0x5911bd){_0xc16ffc[_0xa437('0x27')]=_0x5911bd;if(_0x120374['query'][_0xa437('0x5f')]){_0x1e2bde[_0xa437('0x60')]=[{'model':db['CmContact'],'as':_0xa437('0xf9'),'required':![]},{'model':db[_0xa437('0xc7')],'as':'Owner','attributes':[_0xa437('0x3c'),_0xa437('0xfa'),_0xa437('0xfb')],'required':![]},{'model':db[_0xa437('0xfc')],'as':_0xa437('0xfd'),'attributes':['id',_0xa437('0x3c'),_0xa437('0xfe')],'where':_0x120374['query'][_0xa437('0xff')]?{'id':_0x120374[_0xa437('0x4f')][_0xa437('0xff')]}:undefined,'required':_0x120374['query']['tag']?!![]:![]}];}return db[_0xa437('0xb8')]['findAll'](_0x1e2bde);})[_0xa437('0x17')](function(_0x3409f6){_0xc16ffc[_0xa437('0x74')]=_0x3409f6;return _0xc16ffc;});}})[_0xa437('0x17')](respondWithFilteredResult(_0x51f771,_0x1e2bde))['catch'](handleError(_0x51f771,null));};exports[_0xa437('0x100')]=function(_0xf8d7b9,_0x28889e){var _0xba5b39=0x0;var _0x3e22b4=0x0;var _0x5bab68=![];var _0xc1bd37;var _0x4afbc9;return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0xf8d7b9[_0xa437('0x62')]['id']},'include':[{'model':db[_0xa437('0xab')],'as':_0xa437('0xab'),'include':[{'model':db[_0xa437('0xab')],'as':_0xa437('0x101'),'attributes':['id','interval']}]}]})[_0xa437('0x17')](handleEntityNotFound(_0x28889e,null))[_0xa437('0x17')](function(_0x97c098){if(_0x97c098){_0xc1bd37=_0x97c098;return _0x97c098[_0xa437('0x102')]({'raw':!![]});}})[_0xa437('0x17')](function(_0x10c5ea){if(_0xc1bd37){if(_0x10c5ea){_0x4afbc9=_0x10c5ea;}}return require(_0xa437('0x88'))['getLicense']();})[_0xa437('0x17')](function(_0x319a90){if(_0x319a90){_0x3e22b4=_0x319a90[_0xa437('0x103')];_0x5bab68=_0x319a90[_0xa437('0x8a')];}})['then'](function(){return db[_0xa437('0xb8')][_0xa437('0x27')]({'where':{'closed':![]}});})['then'](function(_0x53ea07){_0xba5b39=_0x53ea07;if(_0x3e22b4&&_0x53ea07>_0x3e22b4){return db['License'][_0xa437('0x73')]({'where':{'id':0x1}})[_0xa437('0x17')](function(_0x52b456){if(_0x52b456){_0x52b456[_0xa437('0x104')](_0xa437('0x105'));}});}})[_0xa437('0x17')](function(){var _0xdcd3b2=_0xc1bd37[_0xa437('0xab')];var _0x202bcc=_0xc1bd37['timezone']||undefined;return _0xdcd3b2?_0xdcd3b2[_0xa437('0x97')](_0x202bcc):!![];})[_0xa437('0x17')](function(_0x3aeb5d){var _0x192efe=fs[_0xa437('0xda')](path['join'](config['root'],_0xa437('0x106')),_0xa437('0x107'));var _0x3ab0d1=new url['URL'](_0xc1bd37['address'])[_0xa437('0x108')];var _0x46bde0=_0xa437('0x109');var _0x25f1b7=![];var _0x15f48d={'chatVersion':_0x46bde0,'chatWebsiteAddressOrigin':_0x3ab0d1,'remote':_0xc1bd37[_0xa437('0x10a')],'query':querystring['stringify'](_[_0xa437('0x5b')](_0xc1bd37['get']({'plain':!![]}),{'customerIp':_0xf8d7b9[_0xa437('0xb6')]['x-forwarded-for']||_0xf8d7b9[_0xa437('0xb6')]['x-real-ip']||_0xf8d7b9['connection'][_0xa437('0x10b')]||_0xf8d7b9['ip'],'referer':_0xf8d7b9[_0xa437('0xb6')][_0xa437('0x3b')],'openedInteractions':_0xba5b39,'maxInteractions':_0x3e22b4,'virtual':_0x5bab68['virtual'],'online':_0x3aeb5d,'custom':_0x5bab68}))[_0xa437('0x10c')](/'/g,'\x5c\x27')};_0x28889e[_0xa437('0x30')](ejs[_0xa437('0x10d')](Mustache[_0xa437('0x10d')](_0x192efe,_0x15f48d),{'proactiveActions':_0x4afbc9,'alignment':_0xc1bd37[_0xa437('0x10e')],'verticalAlignment':_0xc1bd37[_0xa437('0x10f')],'div_color':_0xc1bd37['color'],'labelText':_0xc1bd37[_0xa437('0x110')],'text_color':_0xc1bd37[_0xa437('0x111')],'text_button_color':_0xc1bd37[_0xa437('0x112')],'button_color':_0xc1bd37['color_button'],'background_color':_0xc1bd37[_0xa437('0x113')],'hideWhenOffline':_0xc1bd37['hideWhenOffline'],'intervalId':_0xc1bd37[_0xa437('0x114')],'isDevelopment':_0x25f1b7,'chatVersion':_0x46bde0}));})[_0xa437('0x20')](handleError(_0x28889e,null));};exports[_0xa437('0x115')]=function(_0x531b67,_0x55ff5c){var _0x34cc5b=_0x531b67[_0xa437('0x62')]['id'];var _0x2b517f=_0x531b67[_0xa437('0x66')];var _0x2d690d=0xc8;var _0x151417=null;return db[_0xa437('0xe3')]['transaction']({'isolationLevel':db[_0xa437('0xe3')][_0xa437('0x116')][_0xa437('0x117')][_0xa437('0x118')]},function(_0x526181){return db['ChatWebsite']['findOne']({'where':{'id':_0x34cc5b},'transaction':_0x526181})[_0xa437('0x17')](function(_0x31708f){if(_0x31708f){return db[_0xa437('0x119')][_0xa437('0x2b')]({'where':{'ChatWebsiteId':_0x34cc5b},'transaction':_0x526181})['then'](function(){var _0x1fe70e=_['map'](_0x2b517f,function(_0x2e4800){_0x2e4800[_0xa437('0x70')]=_0x34cc5b;return _0x2e4800;});return db[_0xa437('0x119')]['bulkCreate'](_0x1fe70e,{'transaction':_0x526181});});}else{_0x2d690d=0x194;_0x151417=[];}});})['then'](function(){if(_0x2d690d!==0x194){return db[_0xa437('0x119')][_0xa437('0x11a')]({'where':{'ChatWebsiteId':_0x34cc5b},'order':_0xa437('0xb2')})[_0xa437('0x17')](function(_0x200fa8){_0x151417=_0x200fa8;});}})['catch'](function(_0xc65cd4){_0x2d690d=0x1f4;logger['error'](_0xc65cd4[_0xa437('0x2f')]);if(_0xc65cd4[_0xa437('0x3c')]){delete _0xc65cd4[_0xa437('0x3c')];}_0x151417=_0xc65cd4;})[_0xa437('0x11b')](function(){if(_0x151417===null){_0x55ff5c[_0xa437('0x2e')](_0x2d690d);}else{if(_0x2d690d===0x1f4){_0x55ff5c[_0xa437('0x21')](_0x2d690d)[_0xa437('0x30')](_0x151417);}else{_0x55ff5c[_0xa437('0x21')](_0x2d690d)[_0xa437('0x23')](_0x151417);}}});};exports[_0xa437('0x11c')]=function(_0x7bec4f,_0x11ca64){var _0x1a9dbb={};var _0x437faa={};var _0x12d138;var _0x203fe5;return db[_0xa437('0x4b')][_0xa437('0x73')]({'where':{'id':_0x7bec4f['params']['id']}})['then'](handleEntityNotFound(_0x11ca64,null))['then'](function(_0x34d52b){if(_0x34d52b){_0x12d138=_0x34d52b;_0x437faa[_0xa437('0x43')]=_['keys'](db[_0xa437('0x119')][_0xa437('0x4c')]);_0x437faa[_0xa437('0x4f')]=_['keys'](_0x7bec4f['query']);_0x437faa['filters']=_[_0xa437('0x51')](_0x437faa['model'],_0x437faa[_0xa437('0x4f')]);_0x1a9dbb[_0xa437('0x53')]=_[_0xa437('0x51')](_0x437faa[_0xa437('0x43')],qs[_0xa437('0x52')](_0x7bec4f[_0xa437('0x4f')]['fields']));_0x1a9dbb[_0xa437('0x53')]=_0x1a9dbb[_0xa437('0x53')][_0xa437('0x54')]?_0x1a9dbb[_0xa437('0x53')]:_0x437faa[_0xa437('0x43')];_0x1a9dbb[_0xa437('0x57')]=qs['sort'](_0x7bec4f[_0xa437('0x4f')][_0xa437('0x58')]);_0x1a9dbb[_0xa437('0x5a')]=qs[_0xa437('0x50')](_['pick'](_0x7bec4f[_0xa437('0x4f')],_0x437faa[_0xa437('0x50')]));if(_0x7bec4f[_0xa437('0x4f')][_0xa437('0x5d')]){_0x1a9dbb[_0xa437('0x5a')]=_['merge'](_0x1a9dbb[_0xa437('0x5a')],{'$or':_[_0xa437('0x4a')](_0x1a9dbb['attributes'],function(_0xd461bc){var _0x556ce9={};_0x556ce9[_0xd461bc]={'$like':'%'+_0x7bec4f[_0xa437('0x4f')][_0xa437('0x5d')]+'%'};return _0x556ce9;})});}_0x1a9dbb=_['merge']({},_0x1a9dbb,_0x7bec4f[_0xa437('0x5e')]);return _0x12d138[_0xa437('0x11c')](_0x1a9dbb);}})[_0xa437('0x17')](function(_0xcbff91){if(_0xcbff91){_0x203fe5=_0xcbff91[_0xa437('0x54')];if(!_0x7bec4f[_0xa437('0x4f')][_0xa437('0x55')](_0xa437('0x56'))){_0x1a9dbb[_0xa437('0x26')]=qs[_0xa437('0x26')](_0x7bec4f['query'][_0xa437('0x26')]);_0x1a9dbb[_0xa437('0x24')]=qs[_0xa437('0x24')](_0x7bec4f[_0xa437('0x4f')][_0xa437('0x24')]);}return _0x12d138[_0xa437('0x11c')](_0x1a9dbb);}})[_0xa437('0x17')](function(_0x22b368){if(_0x22b368){return _0x22b368?{'count':_0x203fe5,'rows':_0x22b368}:null;}})[_0xa437('0x17')](respondWithResult(_0x11ca64,null))[_0xa437('0x20')](handleError(_0x11ca64,null));};exports['addProactiveActions']=function(_0x5a0488,_0x39343d){return db['chatProactiveAction']['find']({'where':{'id':_0x5a0488[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x39343d,null))[_0xa437('0x17')](function(_0x2479f1){if(_0x2479f1){return _0x2479f1[_0xa437('0x11d')](_0x5a0488['body'][_0xa437('0x76')],_['omit'](_0x5a0488[_0xa437('0x66')],['ids','id'])||{});}})['then'](respondWithResult(_0x39343d,null))['catch'](handleError(_0x39343d,null));};exports['getProactiveActions']=function(_0x904934,_0x1a5b22){var _0x6d2f6d={};var _0x4d9ed2={};var _0x2e55ed;var _0x2403fd;return db['ChatWebsite']['findOne']({'where':{'id':_0x904934['params']['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x1a5b22,null))['then'](function(_0x555835){if(_0x555835){_0x2e55ed=_0x555835;_0x4d9ed2['model']=_['keys'](db[_0xa437('0x11e')][_0xa437('0x4c')]);_0x4d9ed2[_0xa437('0x4f')]=_[_0xa437('0x63')](_0x904934[_0xa437('0x4f')]);_0x4d9ed2[_0xa437('0x50')]=_[_0xa437('0x51')](_0x4d9ed2[_0xa437('0x43')],_0x4d9ed2[_0xa437('0x4f')]);_0x6d2f6d[_0xa437('0x53')]=_[_0xa437('0x51')](_0x4d9ed2[_0xa437('0x43')],qs[_0xa437('0x52')](_0x904934[_0xa437('0x4f')][_0xa437('0x52')]));_0x6d2f6d[_0xa437('0x53')]=_0x6d2f6d[_0xa437('0x53')][_0xa437('0x54')]?_0x6d2f6d[_0xa437('0x53')]:_0x4d9ed2[_0xa437('0x43')];_0x6d2f6d[_0xa437('0x57')]=qs[_0xa437('0x58')](_0x904934[_0xa437('0x4f')][_0xa437('0x58')]);_0x6d2f6d[_0xa437('0x5a')]=qs['filters'](_['pick'](_0x904934['query'],_0x4d9ed2[_0xa437('0x50')]));if(_0x904934['query'][_0xa437('0x5d')]){_0x6d2f6d[_0xa437('0x5a')]=_['merge'](_0x6d2f6d[_0xa437('0x5a')],{'$or':_[_0xa437('0x4a')](_0x6d2f6d['attributes'],function(_0x3a2448){var _0x1a9b47={};_0x1a9b47[_0x3a2448]={'$like':'%'+_0x904934[_0xa437('0x4f')][_0xa437('0x5d')]+'%'};return _0x1a9b47;})});}_0x6d2f6d=_[_0xa437('0x5b')]({},_0x6d2f6d,_0x904934[_0xa437('0x5e')]);return _0x2e55ed['getProactiveActions'](_0x6d2f6d);}})[_0xa437('0x17')](function(_0x228726){if(_0x228726){_0x2403fd=_0x228726[_0xa437('0x54')];if(!_0x904934['query'][_0xa437('0x55')](_0xa437('0x56'))){_0x6d2f6d[_0xa437('0x26')]=qs[_0xa437('0x26')](_0x904934['query'][_0xa437('0x26')]);_0x6d2f6d[_0xa437('0x24')]=qs['offset'](_0x904934[_0xa437('0x4f')][_0xa437('0x24')]);}return _0x2e55ed['getProactiveActions'](_0x6d2f6d);}})['then'](function(_0x59a0d5){if(_0x59a0d5){return _0x59a0d5?{'count':_0x2403fd,'rows':_0x59a0d5}:null;}})[_0xa437('0x17')](respondWithResult(_0x1a5b22,null))[_0xa437('0x20')](handleError(_0x1a5b22,null));};exports[_0xa437('0x11f')]=function(_0x1a61b2,_0x802f9e){var _0x3d6bf8=_0x1a61b2['query'][_0xa437('0x120')]===_0xa437('0x121')?_0xa437('0x122'):'onlineForm';return db[_0xa437('0x4b')][_0xa437('0x64')]({'attributes':['id',_0x3d6bf8],'where':{'id':_0x1a61b2[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x802f9e,null))['then'](function(_0x3676bb){if(_0x3676bb){var _0x49f169=_0x3676bb[_0x3d6bf8];var _0x23ae34=_0x49f169&&_0x49f169[_0xa437('0x123')]?_0x49f169['items']:[];_0x802f9e[_0xa437('0x30')]({'fromKey':_[_0xa437('0x8b')](_0x49f169[_0xa437('0x124')])?undefined:_0x49f169['fromKey'],'count':_0x23ae34['length'],'rows':_0x23ae34});}})[_0xa437('0x20')](handleError(_0x802f9e,null));};exports[_0xa437('0x125')]=function(_0x3d83ea,_0x3ca8e3){var _0x3a2538={'raw':![],'where':{}};var _0x40cec7={};var _0x1bebbe={'count':0x0,'rows':[]};return db[_0xa437('0x4b')][_0xa437('0x73')]({'where':{'id':_0x3d83ea[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x3ca8e3,null))[_0xa437('0x17')](function(_0x2d0d03){if(_0x2d0d03){_0x40cec7[_0xa437('0x43')]=_[_0xa437('0x63')](db[_0xa437('0xdd')][_0xa437('0x4c')]);_0x40cec7[_0xa437('0x4f')]=_['keys'](_0x3d83ea[_0xa437('0x4f')]);_0x40cec7[_0xa437('0x50')]=_[_0xa437('0x51')](_0x40cec7[_0xa437('0x43')],_0x40cec7[_0xa437('0x4f')]);_0x3a2538[_0xa437('0x53')]=_[_0xa437('0x51')](_0x40cec7['model'],qs[_0xa437('0x52')](_0x3d83ea['query'][_0xa437('0x52')]));_0x3a2538[_0xa437('0x53')]=_0x3a2538['attributes'][_0xa437('0x54')]?_0x3a2538[_0xa437('0x53')]:_0x40cec7[_0xa437('0x43')];if(!_0x3d83ea[_0xa437('0x4f')]['hasOwnProperty'](_0xa437('0x56'))){_0x3a2538[_0xa437('0x26')]=qs[_0xa437('0x26')](_0x3d83ea[_0xa437('0x4f')][_0xa437('0x26')]);_0x3a2538[_0xa437('0x24')]=qs['offset'](_0x3d83ea[_0xa437('0x4f')][_0xa437('0x24')]);}_0x3a2538[_0xa437('0x57')]=qs[_0xa437('0x58')](_0x3d83ea[_0xa437('0x4f')]['sort']);_0x3a2538['where']=qs[_0xa437('0x50')](_[_0xa437('0x59')](_0x3d83ea['query'],_0x40cec7['filters']));_0x3a2538[_0xa437('0x5a')][_0xa437('0x70')]=_0x2d0d03['id'];if(_0x3d83ea[_0xa437('0x4f')]['filter']){_0x3a2538[_0xa437('0x5a')]=_[_0xa437('0x5b')](_0x3a2538[_0xa437('0x5a')],{'$or':_[_0xa437('0x4a')](_0x3a2538['attributes'],function(_0x5c20e7){var _0x2d35ee={};_0x2d35ee[_0x5c20e7]={'$like':'%'+_0x3d83ea[_0xa437('0x4f')][_0xa437('0x5d')]+'%'};return _0x2d35ee;})});}_0x3a2538=_[_0xa437('0x5b')]({},_0x3a2538,_0x3d83ea[_0xa437('0x5e')]);return db[_0xa437('0xdd')][_0xa437('0x27')]({'where':_0x3a2538[_0xa437('0x5a')]})[_0xa437('0x17')](function(_0x558929){_0x1bebbe['count']=_0x558929;if(_0x3d83ea[_0xa437('0x4f')]['includeAll']){_0x3a2538['include']=[{'all':!![]}];}else{_0x3a2538[_0xa437('0x60')]=[{'model':db['CmContact'],'as':_0xa437('0xf9'),'required':![]},{'model':db[_0xa437('0xe5')],'as':_0xa437('0x126'),'required':![]}];}return db['ChatOfflineMessage'][_0xa437('0x61')](_0x3a2538);})[_0xa437('0x17')](function(_0x1381ec){_0x1bebbe[_0xa437('0x74')]=_0x1381ec;return _0x1bebbe;});}})['then'](respondWithFilteredResult(_0x3ca8e3,_0x3a2538))[_0xa437('0x20')](handleError(_0x3ca8e3,null));};exports[_0xa437('0x127')]=function(_0x6918bc,_0x5e3313){return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0x6918bc['params']['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x5e3313,null))['then'](function(_0x325ad8){if(_0x325ad8){return _0x325ad8[_0xa437('0x127')](_0x6918bc[_0xa437('0x66')][_0xa437('0x76')],_['omit'](_0x6918bc[_0xa437('0x66')],[_0xa437('0x76'),'id'])||{})[_0xa437('0xad')](function(_0x2d31fb){for(var _0x5eb60e=0x0;_0x5eb60e<_0x6918bc[_0xa437('0x66')]['ids'][_0xa437('0x54')];_0x5eb60e+=0x1){socket['emit'](_0xa437('0x128'),{'UserId':Number(_0x6918bc[_0xa437('0x66')]['ids'][_0x5eb60e]),'ChatWebsiteId':Number(_0x6918bc['params']['id'])});}return _0x2d31fb;});}})[_0xa437('0x17')](respondWithResult(_0x5e3313,null))['catch'](handleError(_0x5e3313,null));};exports[_0xa437('0x129')]=function(_0x368814,_0x290430){return db[_0xa437('0x4b')][_0xa437('0x64')]({'where':{'id':_0x368814[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x290430,null))['then'](function(_0x91f07a){if(_0x91f07a){return _0x91f07a[_0xa437('0x129')](_0x368814[_0xa437('0x4f')][_0xa437('0x76')])['then'](function(){if(_['isArray'](_0x368814[_0xa437('0x4f')]['ids'])){for(var _0x35a24e=0x0;_0x35a24e<_0x368814['query'][_0xa437('0x76')]['length'];_0x35a24e+=0x1){socket[_0xa437('0x12a')]('userChatWebsite:remove',{'UserId':Number(_0x368814[_0xa437('0x4f')]['ids'][_0x35a24e]),'ChatWebsiteId':Number(_0x368814[_0xa437('0x62')]['id'])});}}else{socket[_0xa437('0x12a')]('userChatWebsite:remove',{'UserId':Number(_0x368814[_0xa437('0x4f')][_0xa437('0x76')]),'ChatWebsiteId':Number(_0x368814[_0xa437('0x62')]['id'])});}});}})[_0xa437('0x17')](respondWithStatusCode(_0x290430,null))[_0xa437('0x20')](handleError(_0x290430,null));};exports[_0xa437('0x12b')]=function(_0x3a8b57,_0x1f0d9a){var _0x1f8835={};var _0x3dd1e3={};var _0x10b489;var _0x127379;return db[_0xa437('0x4b')][_0xa437('0x73')]({'where':{'id':_0x3a8b57[_0xa437('0x62')]['id']}})[_0xa437('0x17')](handleEntityNotFound(_0x1f0d9a,null))[_0xa437('0x17')](function(_0x506551){if(_0x506551){_0x10b489=_0x506551;_0x3dd1e3['model']=_[_0xa437('0x63')](db[_0xa437('0xc7')][_0xa437('0x4c')]);_0x3dd1e3[_0xa437('0x4f')]=_[_0xa437('0x63')](_0x3a8b57[_0xa437('0x4f')]);_0x3dd1e3['filters']=_[_0xa437('0x51')](_0x3dd1e3['model'],_0x3dd1e3['query']);_0x1f8835[_0xa437('0x53')]=_[_0xa437('0x51')](_0x3dd1e3[_0xa437('0x43')],qs['fields'](_0x3a8b57[_0xa437('0x4f')][_0xa437('0x52')]));_0x1f8835[_0xa437('0x53')]=_0x1f8835[_0xa437('0x53')][_0xa437('0x54')]?_0x1f8835['attributes']:_0x3dd1e3[_0xa437('0x43')];_0x1f8835[_0xa437('0x57')]=qs[_0xa437('0x58')](_0x3a8b57[_0xa437('0x4f')]['sort']);_0x1f8835[_0xa437('0x5a')]=qs[_0xa437('0x50')](_[_0xa437('0x59')](_0x3a8b57['query'],_0x3dd1e3[_0xa437('0x50')]));if(_0x3a8b57[_0xa437('0x4f')][_0xa437('0x5d')]){_0x1f8835[_0xa437('0x5a')]=_['merge'](_0x1f8835[_0xa437('0x5a')],{'$or':_[_0xa437('0x4a')](_0x1f8835[_0xa437('0x53')],function(_0x305321){var _0xf01d1={};_0xf01d1[_0x305321]={'$like':'%'+_0x3a8b57['query'][_0xa437('0x5d')]+'%'};return _0xf01d1;})});}_0x1f8835=_[_0xa437('0x5b')]({},_0x1f8835,_0x3a8b57[_0xa437('0x5e')]);return _0x10b489[_0xa437('0x12b')](_0x1f8835);}})['then'](function(_0x51cb5f){if(_0x51cb5f){_0x127379=_0x51cb5f[_0xa437('0x54')];if(!_0x3a8b57[_0xa437('0x4f')][_0xa437('0x55')](_0xa437('0x56'))){_0x1f8835[_0xa437('0x26')]=qs[_0xa437('0x26')](_0x3a8b57[_0xa437('0x4f')]['limit']);_0x1f8835[_0xa437('0x24')]=qs[_0xa437('0x24')](_0x3a8b57[_0xa437('0x4f')]['offset']);}return _0x10b489['getAgents'](_0x1f8835);}})['then'](function(_0x1acceb){if(_0x1acceb){return _0x1acceb?{'count':_0x127379,'rows':_0x1acceb}:null;}})[_0xa437('0x17')](respondWithResult(_0x1f0d9a,null))[_0xa437('0x20')](handleError(_0x1f0d9a,null));}; \ No newline at end of file +var _0x635e=['download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','MapKey\x20is\x20mandatory','mapKey','Sequelize','ValidationError','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','from','CmList','List','Contacts','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','orderBy','priority','asc','account','list','ListId','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','applications','push','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','waitForTheAssignedQueue','Start','offline','files','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','sequelize','transaction','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','email','user','openNewInteraction','MailAccountId','subjectOffline','mapValues','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','User','Owner','fullname','Tag','Tags','tag','getSnippet','getProactiveActions','virtual','License','increment','server/files/chat/iframe.ejs','URL','address','3.8.1','x-real-ip','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','onlineForm','items','Contact','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','fs-extra','querystring','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','api','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','get','UserProfileResource','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','map','ChatWebsite','rawAttributes','fieldName','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','params','mandatoryDispositionPause','include','options','find','body','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','pick','ChatWebsiteId','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/'];(function(_0x320c99,_0x143d7f){var _0x493055=function(_0x4ddc04){while(--_0x4ddc04){_0x320c99['push'](_0x320c99['shift']());}};_0x493055(++_0x143d7f);}(_0x635e,0x1cb));var _0xe635=function(_0x21aa45,_0x33593a){_0x21aa45=_0x21aa45-0x0;var _0x548b5b=_0x635e[_0x21aa45];return _0x548b5b;};'use strict';var Mustache=require(_0xe635('0x0'));var util=require('util');var path=require(_0xe635('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe635('0x2'));var _=require('lodash');var querystring=require(_0xe635('0x3'));var htmlToText=require(_0xe635('0x4'));var Redis=require(_0xe635('0x5'));var jayson=require(_0xe635('0x6'));var url=require(_0xe635('0x7'));var qs=require(_0xe635('0x8'));var logger=require('../../config/logger')(_0xe635('0x9'));var config=require('../../config/environment');var APIBadRequestError=require(_0xe635('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0xe635('0xa'))[_0xe635('0xb')];var APIOutOfIntervalError=require(_0xe635('0xa'))[_0xe635('0xc')];var APIHandleError=require(_0xe635('0xa'))[_0xe635('0xd')];var APIConflictError=require(_0xe635('0xa'))[_0xe635('0xe')];var db=require(_0xe635('0xf'))['db'];config[_0xe635('0x10')]=_[_0xe635('0x11')](config[_0xe635('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0xe635('0x12'))(new Redis(config['redis']));require(_0xe635('0x13'))[_0xe635('0x14')](socket);var client=jayson[_0xe635('0x15')]['http']({'port':0x232c});var client9002=jayson[_0xe635('0x15')][_0xe635('0x16')]({'port':0x232a});var client9003=jayson[_0xe635('0x15')][_0xe635('0x16')]({'port':0x232b});var client9001=jayson['client'][_0xe635('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x265d44,_0x1bbd41,_0x142b6c,_0x1e209e){return new Promise(function(_0x556526,_0x53c28a){var _0x839071=_0x1e209e||client;return _0x839071[_0xe635('0x17')](_0x265d44,_0x142b6c)[_0xe635('0x18')](function(_0x3bb5dc){logger[_0xe635('0x19')](_0xe635('0x1a'),_0x1bbd41,_0xe635('0x1b'));logger[_0xe635('0x1c')](_0xe635('0x1d'),_0x1bbd41,_0xe635('0x1b'),JSON[_0xe635('0x1e')](_0x3bb5dc));if(_0x3bb5dc[_0xe635('0x1f')]){if(_0x3bb5dc[_0xe635('0x1f')]['code']===0x1f4){logger[_0xe635('0x1f')](_0xe635('0x1a'),_0x1bbd41,_0x3bb5dc[_0xe635('0x1f')][_0xe635('0x20')]);return _0x53c28a(_0x3bb5dc['error'][_0xe635('0x20')]);}logger[_0xe635('0x1f')](_0xe635('0x1a'),_0x1bbd41,_0x3bb5dc['error'][_0xe635('0x20')]);return _0x556526(_0x3bb5dc['error'][_0xe635('0x20')]);}else{logger[_0xe635('0x19')](_0xe635('0x1a'),_0x1bbd41,'request\x20sent');_0x556526(_0x3bb5dc[_0xe635('0x21')][_0xe635('0x20')]);}})['catch'](function(_0x2e80c8){logger['error'](_0xe635('0x1a'),_0x1bbd41,_0x2e80c8);_0x53c28a(_0x2e80c8);});});}function respondWithStatusCode(_0x25d949,_0x40789b){_0x40789b=_0x40789b||0xcc;return function(_0x1a5ca3){if(_0x1a5ca3){return _0x25d949[_0xe635('0x22')](_0x40789b);}return _0x25d949['status'](_0x40789b)[_0xe635('0x23')]();};}function respondWithResult(_0x14caca,_0x5f1e9c){_0x5f1e9c=_0x5f1e9c||0xc8;return function(_0x833c0d){if(_0x833c0d){return _0x14caca[_0xe635('0x24')](_0x5f1e9c)['json'](_0x833c0d);}};}function respondWithFilteredResult(_0xabba83,_0x124a1a){return function(_0x3fa012){if(_0x3fa012){var _0x3796ce=typeof _0x124a1a[_0xe635('0x25')]===_0xe635('0x26')&&typeof _0x124a1a[_0xe635('0x27')]==='undefined';var _0x154996=_0x3fa012[_0xe635('0x28')];var _0x51269e=_0x3796ce?0x0:_0x124a1a[_0xe635('0x25')];var _0x390b72=_0x3796ce?_0x3fa012['count']:_0x124a1a['offset']+_0x124a1a[_0xe635('0x27')];var _0x267305;if(_0x390b72>=_0x154996){_0x390b72=_0x154996;_0x267305=0xc8;}else{_0x267305=0xce;}_0xabba83['status'](_0x267305);return _0xabba83[_0xe635('0x29')](_0xe635('0x2a'),_0x51269e+'-'+_0x390b72+'/'+_0x154996)[_0xe635('0x2b')](_0x3fa012);}return null;};}function saveUpdates(_0x1f2e44){return function(_0x22ae80){if(_0x22ae80){return _0x22ae80[_0xe635('0x2c')](_0x1f2e44)[_0xe635('0x18')](function(_0x1d75b0){return _0x1d75b0;});}return null;};}function removeEntity(_0x176fa5){return function(_0xec9c6){if(_0xec9c6){return _0xec9c6[_0xe635('0x2d')]()[_0xe635('0x18')](function(){var _0x23b2a0=_0xec9c6[_0xe635('0x2e')]({'plain':!![]});var _0x26e351='ChatWebsites';return db[_0xe635('0x2f')][_0xe635('0x2d')]({'where':{'type':_0x26e351,'resourceId':_0x23b2a0['id']}})['then'](function(){return _0xec9c6;});})['then'](function(){_0x176fa5[_0xe635('0x24')](0xcc)[_0xe635('0x23')]();});}};}function handleEntityNotFound(_0x335c48){return function(_0x1b82ac){if(!_0x1b82ac){_0x335c48[_0xe635('0x22')](0x194);}return _0x1b82ac;};}function handleError(_0x7e820e,_0x5315fa){_0x5315fa=_0x5315fa||0x1f4;return function(_0x58343d){logger[_0xe635('0x1f')](_0x58343d[_0xe635('0x30')]);if(_0x58343d[_0xe635('0x31')]){delete _0x58343d[_0xe635('0x31')];}_0x7e820e[_0xe635('0x24')](_0x5315fa)[_0xe635('0x32')](_0x58343d);};}function createInteractionObject(_0x19b2bb,_0x4481a7,_0x282638,_0x3f52ce){var _0x33780c=require(_0xe635('0x33'));var _0x25e76e=new _0x33780c();var _0x352aeb=_0x25e76e[_0xe635('0x34')](_0x282638[_0xe635('0x35')])[_0xe635('0x36')]();var _0x54f374=_0x4481a7[_0xe635('0x37')];if(_0x282638[_0xe635('0x38')]){_0x54f374=_0x282638[_0xe635('0x38')];}else if(_0x282638[_0xe635('0x39')]){_0x54f374=_['first'](_0x282638[_0xe635('0x39')][_0xe635('0x3a')](','));}return{'ContactId':_0x3f52ce['id'],'ChatWebsiteId':_0x19b2bb,'from':(_0x3f52ce['firstName']||'')+'\x20'+(_0x3f52ce[_0xe635('0x3b')]||''),'customerIp':_0x54f374,'customerPort':_0x282638[_0xe635('0x3c')]?_0x282638[_0xe635('0x3c')]:null,'referer':_0x4481a7[_0xe635('0x3d')],'browserName':_0x352aeb[_0xe635('0x3e')][_0xe635('0x31')]&&_0x352aeb['browser'][_0xe635('0x3f')]?util[_0xe635('0x40')](_0xe635('0x41'),_0x352aeb[_0xe635('0x3e')][_0xe635('0x31')],_0x352aeb['browser'][_0xe635('0x3f')]):_0xe635('0x42'),'browserVersion':_0x352aeb[_0xe635('0x3e')][_0xe635('0x3f')]||_0xe635('0x42'),'osName':util[_0xe635('0x40')](_0xe635('0x41'),_0x352aeb['os'][_0xe635('0x31')],_0x352aeb['os']['version']),'osVersion':_0x352aeb['os'][_0xe635('0x3f')],'deviceModel':_0x352aeb[_0xe635('0x43')][_0xe635('0x44')]&&_0x352aeb[_0xe635('0x43')][_0xe635('0x45')]?util[_0xe635('0x40')](_0xe635('0x46'),_0x352aeb[_0xe635('0x43')]['model'],_0x352aeb['device'][_0xe635('0x45')],_0x352aeb['device'][_0xe635('0x47')]):null,'deviceVendor':_0x352aeb[_0xe635('0x43')][_0xe635('0x45')],'deviceType':_0x352aeb['device']['type'],'formData':JSON[_0xe635('0x1e')](_0x4481a7)};}exports[_0xe635('0x48')]=function(_0x1eb64f,_0x347f71){var _0x3763cb={'include':[{'model':db[_0xe635('0x49')],'as':'mandatoryDispositionPause'}]},_0x4eca86={},_0x376b41={'count':0x0,'rows':[]};var _0x34f9d1=_[_0xe635('0x4a')](db[_0xe635('0x4b')][_0xe635('0x4c')],function(_0x444203){return{'name':_0x444203[_0xe635('0x4d')],'type':_0x444203[_0xe635('0x47')]['key']};});_0x4eca86[_0xe635('0x44')]=_[_0xe635('0x4a')](_0x34f9d1,_0xe635('0x31'));_0x4eca86['query']=_[_0xe635('0x4e')](_0x1eb64f[_0xe635('0x4f')]);_0x4eca86['filters']=_[_0xe635('0x50')](_0x4eca86['model'],_0x4eca86[_0xe635('0x4f')]);_0x3763cb[_0xe635('0x51')]=_[_0xe635('0x50')](_0x4eca86[_0xe635('0x44')],qs[_0xe635('0x52')](_0x1eb64f[_0xe635('0x4f')]['fields']));_0x3763cb[_0xe635('0x51')]=_0x3763cb[_0xe635('0x51')][_0xe635('0x53')]?_0x3763cb[_0xe635('0x51')]:_0x4eca86[_0xe635('0x44')];if(!_0x1eb64f[_0xe635('0x4f')][_0xe635('0x54')](_0xe635('0x55'))){_0x3763cb['limit']=qs[_0xe635('0x27')](_0x1eb64f[_0xe635('0x4f')]['limit']);_0x3763cb[_0xe635('0x25')]=qs[_0xe635('0x25')](_0x1eb64f[_0xe635('0x4f')][_0xe635('0x25')]);}_0x3763cb[_0xe635('0x56')]=qs[_0xe635('0x57')](_0x1eb64f[_0xe635('0x4f')][_0xe635('0x57')]);_0x3763cb[_0xe635('0x58')]=qs[_0xe635('0x59')](_['pick'](_0x1eb64f[_0xe635('0x4f')],_0x4eca86[_0xe635('0x59')]),_0x34f9d1);if(_0x1eb64f[_0xe635('0x4f')]['filter']){_0x3763cb['where']=_[_0xe635('0x5a')](_0x3763cb[_0xe635('0x58')],{'$or':_[_0xe635('0x4a')](_0x34f9d1,function(_0x16a4f2){if(_0x16a4f2[_0xe635('0x47')]!==_0xe635('0x5b')){var _0x15f329={};_0x15f329[_0x16a4f2[_0xe635('0x31')]]={'$like':'%'+_0x1eb64f[_0xe635('0x4f')][_0xe635('0x5c')]+'%'};return _0x15f329;}})});}_0x3763cb=_[_0xe635('0x5a')]({},_0x3763cb,_0x1eb64f['options']);var _0x6b499f={'where':_0x3763cb['where']};return db[_0xe635('0x4b')][_0xe635('0x28')](_0x6b499f)[_0xe635('0x18')](function(_0xa06c16){_0x376b41['count']=_0xa06c16;if(_0x1eb64f['query'][_0xe635('0x5d')]){_0x3763cb['include']=[{'all':!![]}];}return db[_0xe635('0x4b')][_0xe635('0x5e')](_0x3763cb);})['then'](function(_0x386e9a){_0x376b41[_0xe635('0x5f')]=_0x386e9a;return _0x376b41;})[_0xe635('0x18')](respondWithFilteredResult(_0x347f71,_0x3763cb))[_0xe635('0x60')](handleError(_0x347f71,null));};exports['show']=function(_0x48cf43,_0x1e3a0e){var _0x16d763={'raw':![],'where':{'id':_0x48cf43[_0xe635('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0xe635('0x62')}]},_0x45a175={};_0x45a175[_0xe635('0x44')]=_[_0xe635('0x4e')](db[_0xe635('0x4b')][_0xe635('0x4c')]);_0x45a175[_0xe635('0x4f')]=_[_0xe635('0x4e')](_0x48cf43[_0xe635('0x4f')]);_0x45a175[_0xe635('0x59')]=_['intersection'](_0x45a175[_0xe635('0x44')],_0x45a175[_0xe635('0x4f')]);_0x16d763[_0xe635('0x51')]=_[_0xe635('0x50')](_0x45a175[_0xe635('0x44')],qs[_0xe635('0x52')](_0x48cf43[_0xe635('0x4f')][_0xe635('0x52')]));_0x16d763['attributes']=_0x16d763[_0xe635('0x51')]['length']?_0x16d763[_0xe635('0x51')]:_0x45a175[_0xe635('0x44')];if(_0x48cf43['query'][_0xe635('0x5d')]){_0x16d763[_0xe635('0x63')]=[{'all':!![]}];}_0x16d763=_[_0xe635('0x5a')]({},_0x16d763,_0x48cf43[_0xe635('0x64')]);return db[_0xe635('0x4b')][_0xe635('0x65')](_0x16d763)[_0xe635('0x18')](handleEntityNotFound(_0x1e3a0e,null))['then'](respondWithResult(_0x1e3a0e,null))[_0xe635('0x60')](handleError(_0x1e3a0e,null));};exports['create']=function(_0x35008b,_0x395f23){return db[_0xe635('0x4b')]['create'](_0x35008b[_0xe635('0x66')],{})['then'](function(_0x4f4651){var _0x36148a=_0x35008b['user'][_0xe635('0x2e')]({'plain':!![]});if(!_0x36148a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36148a['role']==='user'){var _0x4a6576=_0x4f4651[_0xe635('0x2e')]({'plain':!![]});var _0x539763=_0xe635('0x67');return db[_0xe635('0x68')]['find']({'where':{'name':_0x539763,'userProfileId':_0x36148a[_0xe635('0x69')]},'raw':!![]})[_0xe635('0x18')](function(_0x21a618){if(_0x21a618&&_0x21a618[_0xe635('0x6a')]===0x0){return db[_0xe635('0x2f')][_0xe635('0x6b')]({'name':_0x4a6576[_0xe635('0x31')],'resourceId':_0x4a6576['id'],'type':_0x21a618[_0xe635('0x31')],'sectionId':_0x21a618['id']},{})[_0xe635('0x18')](function(){return _0x4f4651;});}else{return _0x4f4651;}})[_0xe635('0x60')](function(_0x1f1cff){logger['error'](_0xe635('0x6c'),_0x1f1cff);throw _0x1f1cff;});}return _0x4f4651;})[_0xe635('0x18')](respondWithResult(_0x395f23,0xc9))[_0xe635('0x60')](handleError(_0x395f23,null));};exports['update']=function(_0x271a67,_0x267f6f){if(_0x271a67['body']['id']){delete _0x271a67[_0xe635('0x66')]['id'];}return db[_0xe635('0x4b')]['find']({'where':{'id':_0x271a67[_0xe635('0x61')]['id']},'include':[{'model':db[_0xe635('0x49')],'as':_0xe635('0x62')}]})['then'](handleEntityNotFound(_0x267f6f,null))[_0xe635('0x18')](saveUpdates(_0x271a67[_0xe635('0x66')],null))[_0xe635('0x18')](respondWithResult(_0x267f6f,null))[_0xe635('0x60')](handleError(_0x267f6f,null));};exports[_0xe635('0x2d')]=function(_0x4dd35,_0x1c848a){return db[_0xe635('0x4b')]['find']({'where':{'id':_0x4dd35[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x1c848a,null))[_0xe635('0x18')](removeEntity(_0x1c848a,null))[_0xe635('0x60')](handleError(_0x1c848a,null));};exports[_0xe635('0x6d')]=function(_0x1eaca5,_0x29be4f){return db[_0xe635('0x4b')][_0xe635('0x6d')]()[_0xe635('0x18')](respondWithResult(_0x29be4f,null))[_0xe635('0x60')](handleError(_0x29be4f,null));};exports[_0xe635('0x6e')]=function(_0x3bfc7f,_0x5aeb1f){if(_0x3bfc7f['body']['id']){delete _0x3bfc7f[_0xe635('0x66')]['id'];}return db['ChatWebsite'][_0xe635('0x65')]({'where':{'id':_0x3bfc7f['params']['id']}})['then'](handleEntityNotFound(_0x5aeb1f,null))['then'](function(_0x400733){if(_0x400733){_0x3bfc7f[_0xe635('0x66')]['ChatWebsiteId']=_0x400733['id'];return db[_0xe635('0x6f')][_0xe635('0x6b')](_0x3bfc7f[_0xe635('0x66')]);}})[_0xe635('0x18')](respondWithResult(_0x5aeb1f,null))[_0xe635('0x60')](handleError(_0x5aeb1f,null));};exports[_0xe635('0x70')]=function(_0x5928f8,_0x5a4d8d){var _0x182333={'raw':![],'where':{}};var _0x24ba3d={};var _0x514bb9={'count':0x0,'rows':[]};return db[_0xe635('0x4b')][_0xe635('0x71')]({'where':{'id':_0x5928f8['params']['id']}})['then'](handleEntityNotFound(_0x5a4d8d,null))[_0xe635('0x18')](function(_0x58da3e){if(_0x58da3e){_0x24ba3d['model']=_[_0xe635('0x4e')](db[_0xe635('0x6f')]['rawAttributes']);_0x24ba3d[_0xe635('0x4f')]=_['keys'](_0x5928f8[_0xe635('0x4f')]);_0x24ba3d[_0xe635('0x59')]=_[_0xe635('0x50')](_0x24ba3d[_0xe635('0x44')],_0x24ba3d[_0xe635('0x4f')]);_0x182333[_0xe635('0x51')]=_[_0xe635('0x50')](_0x24ba3d[_0xe635('0x44')],qs[_0xe635('0x52')](_0x5928f8[_0xe635('0x4f')][_0xe635('0x52')]));_0x182333[_0xe635('0x51')]=_0x182333[_0xe635('0x51')][_0xe635('0x53')]?_0x182333[_0xe635('0x51')]:_0x24ba3d['model'];if(!_0x5928f8[_0xe635('0x4f')][_0xe635('0x54')](_0xe635('0x55'))){_0x182333[_0xe635('0x27')]=qs[_0xe635('0x27')](_0x5928f8['query']['limit']);_0x182333['offset']=qs[_0xe635('0x25')](_0x5928f8[_0xe635('0x4f')][_0xe635('0x25')]);}_0x182333['order']=qs[_0xe635('0x57')](_0x5928f8[_0xe635('0x4f')][_0xe635('0x57')]);_0x182333[_0xe635('0x58')]=qs[_0xe635('0x59')](_[_0xe635('0x72')](_0x5928f8[_0xe635('0x4f')],_0x24ba3d[_0xe635('0x59')]));_0x182333[_0xe635('0x58')][_0xe635('0x73')]=_0x58da3e['id'];if(_0x5928f8[_0xe635('0x4f')][_0xe635('0x5c')]){_0x182333[_0xe635('0x58')]=_['merge'](_0x182333[_0xe635('0x58')],{'$or':_['map'](_0x182333[_0xe635('0x51')],function(_0x52f7e0){var _0x46842d={};_0x46842d[_0x52f7e0]={'$like':'%'+_0x5928f8[_0xe635('0x4f')][_0xe635('0x5c')]+'%'};return _0x46842d;})});}_0x182333=_[_0xe635('0x5a')]({},_0x182333,_0x5928f8[_0xe635('0x64')]);return db['Disposition']['count']({'where':_0x182333[_0xe635('0x58')]})[_0xe635('0x18')](function(_0xc165cb){_0x514bb9['count']=_0xc165cb;if(_0x5928f8[_0xe635('0x4f')]['includeAll']){_0x182333['include']=[{'all':!![]}];}return db['Disposition'][_0xe635('0x5e')](_0x182333);})[_0xe635('0x18')](function(_0x2dccbe){_0x514bb9[_0xe635('0x5f')]=_0x2dccbe;return _0x514bb9;});}})[_0xe635('0x18')](respondWithFilteredResult(_0x5a4d8d,_0x182333))[_0xe635('0x60')](handleError(_0x5a4d8d,null));};exports['removeDispositions']=function(_0x3af976,_0x2111e7){return db[_0xe635('0x4b')][_0xe635('0x65')]({'where':{'id':_0x3af976[_0xe635('0x61')]['id']}})['then'](handleEntityNotFound(_0x2111e7,null))[_0xe635('0x18')](function(_0x430ff7){if(_0x430ff7){return _0x430ff7[_0xe635('0x74')](_0x3af976[_0xe635('0x4f')][_0xe635('0x75')]);}})[_0xe635('0x18')](respondWithStatusCode(_0x2111e7,null))[_0xe635('0x60')](handleError(_0x2111e7,null));};exports['addAnswer']=function(_0x1238ae,_0x40ca4a){if(_0x1238ae[_0xe635('0x66')]['id']){delete _0x1238ae[_0xe635('0x66')]['id'];}return db[_0xe635('0x4b')][_0xe635('0x65')]({'where':{'id':_0x1238ae[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x40ca4a,null))[_0xe635('0x18')](function(_0x3193f6){if(_0x3193f6){_0x1238ae['body']['ChatWebsiteId']=_0x3193f6['id'];return db['CannedAnswer'][_0xe635('0x6b')](_0x1238ae[_0xe635('0x66')]);}})[_0xe635('0x18')](respondWithResult(_0x40ca4a,null))[_0xe635('0x60')](handleError(_0x40ca4a,null));};exports[_0xe635('0x76')]=function(_0x1101c3,_0x32c360){var _0x5c7988={'raw':![],'where':{}};var _0x18f98f={};var _0x45378f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe635('0x71')]({'where':{'id':_0x1101c3[_0xe635('0x61')]['id']}})['then'](handleEntityNotFound(_0x32c360,null))['then'](function(_0x5441fe){if(_0x5441fe){_0x18f98f[_0xe635('0x44')]=_[_0xe635('0x4e')](db[_0xe635('0x77')]['rawAttributes']);_0x18f98f[_0xe635('0x4f')]=_[_0xe635('0x4e')](_0x1101c3[_0xe635('0x4f')]);_0x18f98f['filters']=_[_0xe635('0x50')](_0x18f98f['model'],_0x18f98f[_0xe635('0x4f')]);_0x5c7988['attributes']=_[_0xe635('0x50')](_0x18f98f['model'],qs['fields'](_0x1101c3[_0xe635('0x4f')][_0xe635('0x52')]));_0x5c7988[_0xe635('0x51')]=_0x5c7988['attributes'][_0xe635('0x53')]?_0x5c7988[_0xe635('0x51')]:_0x18f98f[_0xe635('0x44')];if(!_0x1101c3[_0xe635('0x4f')]['hasOwnProperty'](_0xe635('0x55'))){_0x5c7988[_0xe635('0x27')]=qs[_0xe635('0x27')](_0x1101c3['query'][_0xe635('0x27')]);_0x5c7988['offset']=qs[_0xe635('0x25')](_0x1101c3[_0xe635('0x4f')][_0xe635('0x25')]);}_0x5c7988['order']=qs[_0xe635('0x57')](_0x1101c3[_0xe635('0x4f')][_0xe635('0x57')]);_0x5c7988[_0xe635('0x58')]=qs['filters'](_[_0xe635('0x72')](_0x1101c3[_0xe635('0x4f')],_0x18f98f[_0xe635('0x59')]));_0x5c7988[_0xe635('0x58')]['ChatWebsiteId']=_0x5441fe['id'];if(_0x1101c3[_0xe635('0x4f')]['filter']){_0x5c7988[_0xe635('0x58')]=_[_0xe635('0x5a')](_0x5c7988['where'],{'$or':_[_0xe635('0x4a')](_0x5c7988['attributes'],function(_0xdfc8b5){var _0x47e521={};_0x47e521[_0xdfc8b5]={'$like':'%'+_0x1101c3[_0xe635('0x4f')][_0xe635('0x5c')]+'%'};return _0x47e521;})});}_0x5c7988=_['merge']({},_0x5c7988,_0x1101c3[_0xe635('0x64')]);return db[_0xe635('0x77')][_0xe635('0x28')]({'where':_0x5c7988['where']})[_0xe635('0x18')](function(_0xaf2af0){_0x45378f[_0xe635('0x28')]=_0xaf2af0;if(_0x1101c3['query'][_0xe635('0x5d')]){_0x5c7988[_0xe635('0x63')]=[{'all':!![]}];}return db[_0xe635('0x77')][_0xe635('0x5e')](_0x5c7988);})[_0xe635('0x18')](function(_0x58ec08){_0x45378f[_0xe635('0x5f')]=_0x58ec08;return _0x45378f;});}})[_0xe635('0x18')](respondWithFilteredResult(_0x32c360,_0x5c7988))[_0xe635('0x60')](handleError(_0x32c360,null));};exports['removeAnswers']=function(_0x54b6a1,_0x4e49ff){return db[_0xe635('0x4b')][_0xe635('0x65')]({'where':{'id':_0x54b6a1[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x4e49ff,null))['then'](function(_0x29623b){if(_0x29623b){return _0x29623b[_0xe635('0x78')](_0x54b6a1[_0xe635('0x4f')][_0xe635('0x75')]);}})['then'](respondWithStatusCode(_0x4e49ff,null))[_0xe635('0x60')](handleError(_0x4e49ff,null));};exports[_0xe635('0x79')]=function(_0x379d37,_0x11b289){_0x379d37[_0xe635('0x66')][_0xe635('0x7a')]=_0x379d37[_0xe635('0x7b')][_0xe635('0x7c')];return db[_0xe635('0x4b')][_0xe635('0x65')]({'where':{'id':_0x379d37[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x11b289,null))['then'](saveUpdates(_0x379d37[_0xe635('0x66')],null))[_0xe635('0x18')](respondWithResult(_0x11b289,null))[_0xe635('0x60')](handleError(_0x11b289,null));};exports[_0xe635('0x7d')]=function(_0x463087,_0x30a47a){_0x463087[_0xe635('0x66')]['agentAvatar']=_0x463087[_0xe635('0x7b')][_0xe635('0x7c')];return db[_0xe635('0x4b')]['find']({'where':{'id':_0x463087[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x30a47a,null))['then'](saveUpdates(_0x463087[_0xe635('0x66')],null))[_0xe635('0x18')](respondWithResult(_0x30a47a,null))['catch'](handleError(_0x30a47a,null));};exports['addCustomerAvatar']=function(_0x144f9b,_0xe243e7){_0x144f9b['body'][_0xe635('0x7e')]=_0x144f9b['file'][_0xe635('0x7c')];return db[_0xe635('0x4b')][_0xe635('0x65')]({'where':{'id':_0x144f9b[_0xe635('0x61')]['id']}})['then'](handleEntityNotFound(_0xe243e7,null))[_0xe635('0x18')](saveUpdates(_0x144f9b[_0xe635('0x66')],null))[_0xe635('0x18')](respondWithResult(_0xe243e7,null))['catch'](handleError(_0xe243e7,null));};exports[_0xe635('0x7f')]=function(_0x144ee5,_0x2eb3c7){_0x144ee5[_0xe635('0x66')][_0xe635('0x80')]=_0x144ee5[_0xe635('0x7b')]['filename'];return db['ChatWebsite'][_0xe635('0x65')]({'where':{'id':_0x144ee5['params']['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x2eb3c7,null))[_0xe635('0x18')](saveUpdates(_0x144ee5[_0xe635('0x66')],null))[_0xe635('0x18')](respondWithResult(_0x2eb3c7,null))['catch'](handleError(_0x2eb3c7,null));};exports['getLogo']=function(_0x25b6aa,_0x7b0aa1){var _0x4198c9=path[_0xe635('0x81')](config['root'],_0xe635('0x82'));var _0x9737fc={'where':{'id':_0x25b6aa['params']['id']},'attributes':['id',_0xe635('0x7a')],'raw':!![]};var _0x12c220=![];return require(_0xe635('0x83'))[_0xe635('0x84')]()[_0xe635('0x18')](function(_0x1a1b81){if(_0x1a1b81){_0x12c220=_0x1a1b81[_0xe635('0x85')];}})['then'](function(){return db['ChatWebsite']['find'](_0x9737fc);})[_0xe635('0x18')](handleEntityNotFound(_0x7b0aa1,null))[_0xe635('0x18')](function(_0x2f59dd){if(_0x2f59dd){if(!_['isNil'](_0x2f59dd[_0xe635('0x7a')])){if(fs[_0xe635('0x86')](path[_0xe635('0x81')](config[_0xe635('0x87')],_0xe635('0x88'),_0x2f59dd['sitepic']))&&_0x12c220){_0x4198c9=path['join'](config[_0xe635('0x87')],'server/files/images/logos/',_0x2f59dd[_0xe635('0x7a')]);}}return _0x7b0aa1[_0xe635('0x89')](_0x4198c9);}})[_0xe635('0x60')](handleError(_0x7b0aa1,null));};exports[_0xe635('0x8a')]=function(_0x328a60,_0x159e67){var _0x36a661=path['join'](config[_0xe635('0x87')],_0xe635('0x8b'));var _0x205026={'where':{'id':_0x328a60[_0xe635('0x61')]['id']},'attributes':['id',_0xe635('0x8c')],'raw':!![]};return db['ChatWebsite']['find'](_0x205026)[_0xe635('0x18')](handleEntityNotFound(_0x159e67,null))[_0xe635('0x18')](function(_0x2f42aa){if(_0x2f42aa){if(!_[_0xe635('0x8d')](_0x2f42aa[_0xe635('0x8c')])){if(fs[_0xe635('0x86')](path[_0xe635('0x81')](config[_0xe635('0x87')],_0xe635('0x8e'),_0x2f42aa['agentAvatar']))){_0x36a661=path['join'](config[_0xe635('0x87')],_0xe635('0x8e'),_0x2f42aa['agentAvatar']);}}return _0x159e67[_0xe635('0x89')](_0x36a661);}})[_0xe635('0x60')](handleError(_0x159e67,null));};exports['getCustomerAvatar']=function(_0x1ede3d,_0x2cd1bd){var _0x54d534=path[_0xe635('0x81')](config[_0xe635('0x87')],_0xe635('0x8f'));var _0x4302d2={'where':{'id':_0x1ede3d[_0xe635('0x61')]['id']},'attributes':['id',_0xe635('0x7e'),_0xe635('0x90')],'raw':!![]};return db[_0xe635('0x4b')][_0xe635('0x65')](_0x4302d2)[_0xe635('0x18')](handleEntityNotFound(_0x2cd1bd,null))[_0xe635('0x18')](function(_0x33880d){if(_0x33880d){if(!_['isNil'](_0x33880d[_0xe635('0x7e')])){if(fs['existsSync'](path[_0xe635('0x81')](config[_0xe635('0x87')],_0xe635('0x8e'),_0x33880d[_0xe635('0x7e')]))&&_0x33880d[_0xe635('0x90')]){_0x54d534=path['join'](config[_0xe635('0x87')],'server/files/images/avatars/',_0x33880d[_0xe635('0x7e')]);}}return _0x2cd1bd[_0xe635('0x89')](_0x54d534);}})[_0xe635('0x60')](handleError(_0x2cd1bd,null));};exports[_0xe635('0x91')]=function(_0x594af3,_0x51ee81){var _0x447ca5=path[_0xe635('0x81')](config[_0xe635('0x87')],_0xe635('0x92'));var _0x49cfc7={'where':{'id':_0x594af3[_0xe635('0x61')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe635('0x4b')]['find'](_0x49cfc7)[_0xe635('0x18')](handleEntityNotFound(_0x51ee81,null))['then'](function(_0x554c89){if(_0x554c89){if(!_['isNil'](_0x554c89[_0xe635('0x80')])){if(fs[_0xe635('0x86')](path[_0xe635('0x81')](config[_0xe635('0x87')],'server/files/images/avatars/',_0x554c89[_0xe635('0x80')]))){_0x447ca5=path['join'](config[_0xe635('0x87')],_0xe635('0x8e'),_0x554c89[_0xe635('0x80')]);}}return _0x51ee81['download'](_0x447ca5);}})['catch'](handleError(_0x51ee81,null));};function checkWebsiteInterval(_0x49f730){var _0x1790c5=_0x49f730[_0xe635('0x93')];if(!_0x1790c5){return Promise[_0xe635('0x94')](_0x49f730);}var _0x2f4bcc=_0x49f730[_0xe635('0x95')]||undefined;return _0x1790c5[_0xe635('0x96')](_0x2f4bcc)[_0xe635('0x18')](function(_0x166bfa){if(!_0x166bfa){throw new APIOutOfIntervalError();}return _0x49f730;});}exports[_0xe635('0x97')]=function(_0x39230b,_0x5549ab){var _0x31da29={'body':_0x39230b[_0xe635('0x66')],'channel':_0xe635('0x98')};var _0xe1763c=[];var _0x56c42b=[];var _0x3bffa5={};var _0x35fee3=![];if(_0x39230b[_0xe635('0x66')]['id']){delete _0x39230b[_0xe635('0x66')]['id'];}if(_['isNil'](_0x39230b[_0xe635('0x66')]['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xe635('0x8d')](_0x39230b[_0xe635('0x66')]['mapKey'])){throw new APIBadRequestError(_0xe635('0x99'));}if(_['isNil'](_0x39230b[_0xe635('0x66')][_0xe635('0x9a')])){throw new db[(_0xe635('0x9b'))][(_0xe635('0x9c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x56c42b);}if(!_[_0xe635('0x9d')](_0x56c42b,_0x39230b['body'][_0xe635('0x9a')])){throw new APIBadRequestError(_0xe635('0x9e')+_0x56c42b['join'](',\x20'));}var _0x2570a7=_0x39230b[_0xe635('0x66')][_0xe635('0x37')]&&_0x39230b[_0xe635('0x66')][_0xe635('0x3d')];return db[_0xe635('0x9f')][_0xe635('0x6d')]()['then'](function(_0x16f07a){if(!_0x16f07a){throw new Error(_0xe635('0xa0'));}_0xe1763c=Object['keys'](_0x16f07a)['filter'](function(_0x362c1b){return![_0xe635('0xa1'),'updatedAt'][_0xe635('0x9d')](_0x362c1b);});_0x56c42b=Object[_0xe635('0x4e')](_0x16f07a)['filter'](function(_0x3eb594){return!['createdAt',_0xe635('0xa2'),_0xe635('0xa3'),'ListId'][_0xe635('0x9d')](_0x3eb594);});if(!_[_0xe635('0x9d')](_0x56c42b,_0x39230b[_0xe635('0x66')][_0xe635('0x9a')])){throw new APIBadRequestError(_0xe635('0x9e')+_0x56c42b[_0xe635('0x81')](',\x20'));}_0x3bffa5[_0x39230b[_0xe635('0x66')][_0xe635('0x9a')]]=_0x39230b[_0xe635('0x66')][_0xe635('0xa4')];})['then'](function(){return db['ChatWebsite'][_0xe635('0x65')]({'where':{'id':_0x39230b[_0xe635('0x61')]['id']},'include':[{'model':db[_0xe635('0xa5')],'as':_0xe635('0xa6'),'include':[{'model':db[_0xe635('0x9f')],'as':_0xe635('0xa7'),'where':_0x3bffa5,'limit':0x1,'order':[[_0xe635('0xa2'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xe635('0xa8')},{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xe635('0x93')],'as':_0xe635('0xa9'),'attributes':['id',_0xe635('0xaa')],'raw':!![]}]}]});})[_0xe635('0x18')](function(_0x567fd3){if(!_0x567fd3){throw new APINotFoundError(util['format'](_0xe635('0xab'),_0x39230b['params']['id']));}if(_0x2570a7){return checkWebsiteInterval(_0x567fd3);}return _0x567fd3;})[_0xe635('0xac')](function(_0x5c5a9f,_0x42e836){if(!_0x42e836)throw new APIOutOfIntervalError();if(!_0x5c5a9f[_0xe635('0xa6')])return;_0x31da29['account']=_0x5c5a9f;_0x31da29['applications']=_[_0xe635('0xad')](_0x5c5a9f[_0xe635('0xa8')],[_0xe635('0xae')],[_0xe635('0xaf')]);if(_0x31da29[_0xe635('0xb0')][_0xe635('0xa8')]){delete _0x31da29[_0xe635('0xb0')][_0xe635('0xa8')];}_0x31da29[_0xe635('0xb1')]=_0x5c5a9f[_0xe635('0xa6')]||{'id':_0x5c5a9f[_0xe635('0xb2')]};if(_0x31da29[_0xe635('0xb1')]&&_0x31da29[_0xe635('0xb1')][_0xe635('0xa7')][_0xe635('0x53')]){return _0x31da29[_0xe635('0xb1')]['Contacts'][0x0];}var _0x48fe62=_[_0xe635('0x11')](_0x39230b[_0xe635('0x66')],{'firstName':_0x39230b[_0xe635('0x66')]['from'],'ListId':_0x5c5a9f['ListId']});_0x48fe62[_0x39230b[_0xe635('0x66')][_0xe635('0x9a')]]=_0x39230b['body'][_0xe635('0xa4')];return db[_0xe635('0x9f')][_0xe635('0x6b')](_0x48fe62,{'fields':_0xe1763c,'raw':!![]});})[_0xe635('0x18')](function(_0x5ce821){_0x31da29[_0xe635('0xb3')]=_0x5ce821;var _0x195bfa=createInteractionObject(_0x39230b['params']['id'],_0x39230b['body'],_0x39230b[_0xe635('0xb4')],_0x5ce821);var _0x2f06bb={'ChatWebsiteId':_0x39230b[_0xe635('0x61')]['id']};if(_0x39230b[_0xe635('0x66')][_0xe635('0xb5')]){_0x2f06bb['threadId']=_0x39230b['body'][_0xe635('0xb5')];_0x2f06bb[_0xe635('0xb6')]=![];return db[_0xe635('0xb7')][_0xe635('0x65')]({'where':_0x2f06bb})[_0xe635('0x18')](function(_0x2ab283){var _0x5645f8=_0x39230b['body'][_0xe635('0x37')]&&_0x39230b[_0xe635('0x66')][_0xe635('0x3d')];if(_0x2ab283){_0x35fee3=!![];return _0x2ab283;}else if(!_0x5645f8&&_0x2ab283&&_0x2ab283[_0xe635('0xb6')]){throw new APIConflictError(_0xe635('0xb8'));}_0x195bfa['threadId']=_0x39230b['body'][_0xe635('0xb5')];_0x195bfa[_0xe635('0xb9')]=_0x39230b['body'][_0xe635('0xb9')];return db['ChatInteraction'][_0xe635('0x6b')](_0x195bfa);});}_0x2f06bb[_0xe635('0xba')]=_0x5ce821['id'];if(_0x39230b['body'][_0xe635('0xbb')]&&_0x39230b[_0xe635('0x66')][_0xe635('0xbb')]['id']){_0x2f06bb['id']=_0x39230b[_0xe635('0x66')][_0xe635('0xbb')]['id'];return db['ChatInteraction'][_0xe635('0x65')]({'where':_0x2f06bb})['then'](function(_0x5609e5){var _0x5702df=_0x39230b[_0xe635('0x66')]['customerIp']&&_0x39230b['body'][_0xe635('0x3d')];if(!_0x5702df&&_0x5609e5&&_0x5609e5[_0xe635('0xb6')]){throw new APIConflictError(_0xe635('0xb8'));}else if(_0x5609e5){_0x35fee3=!![];return _0x5609e5;}else{return db['ChatInteraction'][_0xe635('0x6b')](_0x195bfa);}});}return db['ChatInteraction']['create'](_0x195bfa);})[_0xe635('0x18')](function(_0x382d7d){if(!_0x35fee3){return _0x382d7d;}var _0x12c5f2={'from':(_0x31da29[_0xe635('0xb3')][_0xe635('0xbc')]||'')+'\x20'+(_0x31da29[_0xe635('0xb3')]['lastName']||'')};if(_0x39230b[_0xe635('0x66')][_0xe635('0xb5')]&&_0x39230b[_0xe635('0x66')][_0xe635('0xbd')]&&_0x39230b['body'][_0xe635('0xb5')]!=_0x39230b['body'][_0xe635('0xbd')]){_0x12c5f2[_0xe635('0xb5')]=_0x39230b[_0xe635('0x66')][_0xe635('0xbd')];}return _0x382d7d[_0xe635('0x2c')](_0x12c5f2);})[_0xe635('0x18')](function(_0x4ef803){_0x31da29[_0xe635('0xbb')]=_0x4ef803['get']({'plain':!![]});_0x31da29[_0xe635('0xbb')]['created']=!_0x35fee3;if(_0x31da29[_0xe635('0xbb')][_0xe635('0xbe')]){if(_0x31da29[_0xe635('0xb0')][_0xe635('0xbf')]){_0x31da29[_0xe635('0xc0')][_0xe635('0xc1')]({'id':0x0,'priority':_0x31da29[_0xe635('0xc0')][_0xe635('0x53')]+0x1,'app':'close','appdata':_0xe635('0xc2'),'interval':'*,*,*,*'});}}return db[_0xe635('0xc3')][_0xe635('0x6b')]({'body':_0x39230b['body'][_0xe635('0x66')],'ChatWebsiteId':_0x39230b[_0xe635('0x61')]['id'],'ChatInteractionId':_0x4ef803['id'],'direction':'in','ContactId':_0x31da29['contact']['id'],'AttachmentId':_0x39230b[_0xe635('0x66')][_0xe635('0xc4')]});})[_0xe635('0x18')](function(_0x5124f1){_0x31da29[_0xe635('0x20')]=_0x5124f1;if(!_0x31da29['interaction'][_0xe635('0xc5')]){return;}return db['User'][_0xe635('0x65')]({'attributes':['id',_0xe635('0x31')],'where':{'id':_0x31da29[_0xe635('0xbb')][_0xe635('0xc5')]}});})[_0xe635('0x18')](function(_0x3907a1){if(_0x3907a1){_0x31da29[_0xe635('0xc0')][_0xe635('0xc6')]({'id':0x0,'priority':0x0,'app':_0xe635('0xc7'),'appdata':_0x3907a1[_0xe635('0x31')]+','+(_0x31da29[_0xe635('0xb0')][_0xe635('0xc8')]||0xa),'interval':_0xe635('0xc9')});_0x31da29[_0xe635('0xca')]=!![];}if(!_0x31da29['interaction'][_0xe635('0xcb')]){return;}return db['ChatQueue'][_0xe635('0x65')]({'attributes':['id','name'],'where':{'id':_0x31da29[_0xe635('0xbb')][_0xe635('0xcb')]}});})[_0xe635('0x18')](function(_0x4f74ea){if(_0x4f74ea){_0x31da29[_0xe635('0xc0')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f74ea[_0xe635('0x31')]+','+(_0x31da29[_0xe635('0xb0')][_0xe635('0xcc')]||0x12c),'interval':_0xe635('0xc9')});}return respondWithRpcPromise(_0xe635('0xcd'),'startRouting',_0x31da29);})[_0xe635('0x18')](function(_0x116d38){respondWithRpcPromise('EventManager','EventManager',{'event':_0xe635('0x97'),'message':_0x116d38},client9002);return _0x116d38;})[_0xe635('0x18')](respondWithResult(_0x5549ab,null))[_0xe635('0x60')](APIHandleError(_0x5549ab));};exports[_0xe635('0xce')]=function(_0x222446,_0x53bdc0){var _0x5a8210,_0x1c00e8,_0x1e6180;var _0x25d11c=[];var _0x196ef7={};var _0x3c97e5=_0x222446[_0xe635('0xcf')]||[];var _0x381872=[];var _0x59ccd5;return db['CmContact']['describe']()[_0xe635('0x18')](function(_0x96506c){if(!_0x96506c){throw new db[(_0xe635('0x9b'))][(_0xe635('0x9c'))](_0xe635('0xd0'));}_0x25d11c=_['difference'](_['keys'](_0x96506c),['createdAt',_0xe635('0xa2'),_0xe635('0xa3'),_0xe635('0xb2')]);if(_0x222446['body']['id']){delete _0x222446[_0xe635('0x66')]['id'];}if(_[_0xe635('0x8d')](_0x222446[_0xe635('0x66')]['from'])){throw _0x53bdc0[_0xe635('0x24')](0x1f4)[_0xe635('0x32')](new db[(_0xe635('0x9b'))][(_0xe635('0x9c'))](_0xe635('0xd1')));}if(_[_0xe635('0x8d')](_0x222446[_0xe635('0x66')][_0xe635('0x66')])||_0x222446[_0xe635('0x66')][_0xe635('0x66')]===''){throw _0x53bdc0[_0xe635('0x24')](0x1f4)[_0xe635('0x32')](new db['Sequelize'][(_0xe635('0x9c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe635('0x8d')](_0x222446[_0xe635('0x66')][_0xe635('0xd2')])){throw _0x53bdc0[_0xe635('0x24')](0x1f4)[_0xe635('0x32')](new db[(_0xe635('0x9b'))]['ValidationError'](_0xe635('0xd3')+_0x25d11c));}if(!_[_0xe635('0x9d')](_0x25d11c,_0x222446[_0xe635('0x66')][_0xe635('0xd2')])){throw _0x53bdc0[_0xe635('0x24')](0x1f4)[_0xe635('0x32')](new db['Sequelize'][(_0xe635('0x9c'))](_0xe635('0xd4')+_0x25d11c));}_0x196ef7[_0x222446['body'][_0xe635('0xd2')]]=_0x222446[_0xe635('0x66')][_0xe635('0xa4')];})[_0xe635('0x18')](function(){return db[_0xe635('0x4b')][_0xe635('0x65')]({'where':{'id':_0x222446[_0xe635('0x61')]['id']},'include':[{'model':db[_0xe635('0xa5')],'as':'List'},{'model':db[_0xe635('0xd5')],'as':_0xe635('0xd5')}]});})[_0xe635('0x18')](handleEntityNotFound(_0x53bdc0,null))[_0xe635('0x18')](function(_0x4acaa2){if(_0x4acaa2&&_0x4acaa2[_0xe635('0xa6')]){_0x1c00e8=_0x4acaa2;var _0x5e4788=_[_0xe635('0x11')](_0x222446[_0xe635('0x66')],{'firstName':_0x222446[_0xe635('0x66')][_0xe635('0xa4')],'phone':_0x222446['body'][_0xe635('0xa4')],'ListId':_0x4acaa2['ListId']});_0x5e4788[_0x222446[_0xe635('0x66')]['mapKeyOffline']]=_0x222446[_0xe635('0x66')][_0xe635('0xa4')];return db['CmContact'][_0xe635('0xd6')]({'where':_0x196ef7,'defaults':_0x5e4788});}})[_0xe635('0xac')](function(_0x15778f){if(_0x15778f){_0x1e6180=_0x15778f;var _0xa22939=fs[_0xe635('0xd7')](path[_0xe635('0x81')](config[_0xe635('0x87')],_0xe635('0xd8')),_0xe635('0xd9'));var _0x2af417=ejs[_0xe635('0xda')](_0xa22939,{'body':_[_0xe635('0xdb')](_0x222446[_0xe635('0x66')][_0xe635('0x66')]),'bodyTitle':_0x1c00e8[_0xe635('0xdc')]});return db[_0xe635('0xdd')]['create']({'body':_0x2af417,'plainBody':htmlToText[_0xe635('0xde')](_0x2af417),'ContactId':_0x15778f['id'],'ChatWebsiteId':_0x1c00e8['id']});}})[_0xe635('0x18')](function(_0x2a829b){_0x59ccd5=_0x2a829b;if(_0x3c97e5[_0xe635('0x53')]){var _0x5c181d=_0x3c97e5[_0xe635('0x4a')](function(_0x5b6321){return{'name':_0x5b6321[_0xe635('0xdf')],'basename':_0x5b6321[_0xe635('0x7c')],'type':_0x5b6321[_0xe635('0xe0')],'ChatOfflineMessageId':_0x2a829b['id']};});_0x381872=_0x5c181d[_0xe635('0x4a')](_0x5af4d4=>{var _0x4adf5a={'filename':_0x5af4d4[_0xe635('0x31')],'path':path[_0xe635('0x81')](config['root'],_0xe635('0xe1'),_0xe635('0xcf'),_0xe635('0xe2'),_0xe635('0xe3'),_0x5af4d4['basename'])};return _0x4adf5a;});if(!_0x1c00e8['openNewInteraction']){return db[_0xe635('0xe4')][_0xe635('0xe5')](function(_0x222213){return db['Attachment']['bulkCreate'](_0x5c181d,{'transaction':_0x222213});});}}})[_0xe635('0x18')](function(){if(_0x59ccd5){_0x5a8210=_0x59ccd5;return db[_0xe635('0xd5')][_0xe635('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0xe635('0xe6')],'as':_0xe635('0xe7'),'raw':!![],'include':[{'model':db[_0xe635('0xe8')],'as':_0xe635('0xe8'),'raw':!![]}]}]});}})['then'](function(_0x3bbe9e){if(_0x3bbe9e&&_0x3bbe9e['Smtp']&&_0x1c00e8[_0xe635('0xe9')]&&_0x1c00e8[_0xe635('0xea')]){var _0x2591c1=_0x3bbe9e[_0xe635('0xeb')]();return respondWithRpcPromise('SendMail',_0xe635('0xec'),{'account':_0x2591c1,'message':{'from':util[_0xe635('0x40')]('\x22%s\x22\x20<%s>',_0x3bbe9e['name'],_0x3bbe9e[_0xe635('0xed')]||_0x3bbe9e[_0xe635('0xe7')][_0xe635('0xee')]),'to':_0x1c00e8[_0xe635('0xea')],'subject':_0x1c00e8['offlineMessageSubject'],'html':_0x5a8210['body'],'attachments':_0x381872}},client9003)[_0xe635('0x18')](function(){return _0x5a8210;})[_0xe635('0x60')](function(_0x1397fd){logger[_0xe635('0x1f')](_0x1397fd);});}})[_0xe635('0x18')](function(){if(_0x1c00e8&&_0x1c00e8[_0xe635('0xef')]&&_0x1c00e8[_0xe635('0xf0')]){var _0x5e9d87=[];if(_0x3c97e5[_0xe635('0x53')]){_0x5e9d87=_0x3c97e5['map'](function(_0x96e23b){return{'name':_0x96e23b[_0xe635('0xdf')],'basename':_0x96e23b[_0xe635('0x7c')],'type':_0x96e23b[_0xe635('0xe0')],'ChatOfflineMessageId':_0x59ccd5['id']};});}var _0x28d228;if(!_[_0xe635('0x8d')](_0x1c00e8[_0xe635('0xf1')])){var _0xaf7247=_['map'](_0x222446['body'],function(_0x2d17f3){return _0x2d17f3;});var _0x27a5a3=_['toPairsIn'](_0xaf7247)[0x0];var _0x25210f=_[_0xe635('0xf2')](_0x27a5a3,function(_0x5d69a6){return _0x5d69a6;});_0x28d228=_0x25210f[0x1][_0x1c00e8[_0xe635('0xf1')]];}var _0x5edf2c={'from':_0x1e6180[_0xe635('0xed')],'firstName':_0x1e6180[_0xe635('0xbc')],'lastName':_0x1e6180['lastName'],'mapKey':_0xe635('0xed'),'message':{'from':_0x1e6180[_0xe635('0xed')],'to':_0x1c00e8['MailAccount'][_0xe635('0xed')],'cc':'','subject':_[_0xe635('0x8d')](_0x28d228)?_0x1c00e8['offlineMessageSubject']:_0x28d228,'messageId':'','sentAt':new Date(),'attach':_0x5e9d87[_0xe635('0x53')],'attachments':_0x5e9d87,'originChannel':'Chat','ChatWebsiteId':_0x1c00e8['id'],'ChatOfflineMessageId':_0x5a8210['id'],'originTo':_0x1c00e8[_0xe635('0xd5')][_0xe635('0xed')]},'body':_0x5a8210[_0xe635('0x66')]};var _0x32d789={'account':{'id':_0x1c00e8[_0xe635('0xf0')]},'body':_0x5edf2c,'log':_0xe635('0xf3')};return respondWithRpcPromise(_0xe635('0xf3'),_0xe635('0xf4'),_0x32d789,client9001)[_0xe635('0x18')](function(){return _0x5a8210;})[_0xe635('0x60')](function(_0x6fb515){logger[_0xe635('0x1f')](_0x6fb515);});}return;})[_0xe635('0x18')](function(){if(_0x5a8210){return _0x5a8210;}})[_0xe635('0x18')](respondWithResult(_0x53bdc0,null))[_0xe635('0x60')](function(){for(var _0x1357fb of _0x3c97e5){var _0x18a25a=path[_0xe635('0x81')](config[_0xe635('0x87')],_0xe635('0xe1'),_0xe635('0xcf'),_0xe635('0xe2'),'offline-chat',_0x1357fb[_0xe635('0x7c')]);fs_extra['remove'](_0x18a25a)[_0xe635('0x60')](function(_0x1e4180){logger['error'](_0xe635('0xf5'),_0x18a25a,_0x1e4180);});}});};exports['addInteraction']=function(_0x25e033,_0x210779){return db[_0xe635('0xb7')][_0xe635('0x65')]({'where':{'id':_0x25e033[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x210779,null))[_0xe635('0x18')](function(_0x2eb57d){if(_0x2eb57d){return _0x2eb57d['addInteraction'](_0x25e033[_0xe635('0x66')][_0xe635('0x75')],_['omit'](_0x25e033['body'],[_0xe635('0x75'),'id'])||{});}})['then'](respondWithResult(_0x210779,null))['catch'](handleError(_0x210779,null));};exports['getInteractions']=function(_0x337427,_0x54a63f){var _0x47793d={'raw':![],'where':{}};var _0x5c4f47={};var _0x31da06={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x337427['params']['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x54a63f,null))[_0xe635('0x18')](function(_0x3826fd){if(_0x3826fd){_0x5c4f47[_0xe635('0x44')]=_[_0xe635('0x4e')](db[_0xe635('0xb7')][_0xe635('0x4c')]);_0x5c4f47[_0xe635('0x4f')]=_[_0xe635('0x4e')](_0x337427[_0xe635('0x4f')]);_0x5c4f47[_0xe635('0x59')]=_[_0xe635('0x50')](_0x5c4f47[_0xe635('0x44')],_0x5c4f47['query']);_0x47793d[_0xe635('0x51')]=_[_0xe635('0x50')](_0x5c4f47['model'],qs[_0xe635('0x52')](_0x337427[_0xe635('0x4f')][_0xe635('0x52')]));_0x47793d['attributes']=_0x47793d[_0xe635('0x51')][_0xe635('0x53')]?_0x47793d[_0xe635('0x51')]:_0x5c4f47[_0xe635('0x44')];if(!_0x337427[_0xe635('0x4f')][_0xe635('0x54')]('nolimit')){_0x47793d['limit']=qs[_0xe635('0x27')](_0x337427['query']['limit']);_0x47793d[_0xe635('0x25')]=qs[_0xe635('0x25')](_0x337427['query'][_0xe635('0x25')]);}_0x47793d[_0xe635('0x56')]=qs[_0xe635('0x57')](_0x337427[_0xe635('0x4f')][_0xe635('0x57')]);_0x47793d['where']=qs['filters'](_[_0xe635('0x72')](_0x337427[_0xe635('0x4f')],_0x5c4f47['filters']));_0x47793d[_0xe635('0x58')][_0xe635('0x73')]=_0x3826fd['id'];if(_0x337427[_0xe635('0x4f')][_0xe635('0x5c')]){_0x47793d['where']=_[_0xe635('0x5a')](_0x47793d[_0xe635('0x58')],{'$or':_[_0xe635('0x4a')](_0x47793d[_0xe635('0x51')],function(_0x27ee40){var _0x4f2ed5={};_0x4f2ed5[_0x27ee40]={'$like':'%'+_0x337427[_0xe635('0x4f')][_0xe635('0x5c')]+'%'};return _0x4f2ed5;})});}_0x47793d=_[_0xe635('0x5a')]({},_0x47793d,_0x337427[_0xe635('0x64')]);return db['ChatInteraction'][_0xe635('0x28')]({'where':_0x47793d[_0xe635('0x58')]})[_0xe635('0x18')](function(_0x241713){_0x31da06['count']=_0x241713;if(_0x337427[_0xe635('0x4f')][_0xe635('0x5d')]){_0x47793d[_0xe635('0x63')]=[{'model':db[_0xe635('0x9f')],'as':'Contact','required':![]},{'model':db[_0xe635('0xf6')],'as':_0xe635('0xf7'),'attributes':[_0xe635('0x31'),_0xe635('0xf8'),'internal'],'required':![]},{'model':db[_0xe635('0xf9')],'as':_0xe635('0xfa'),'attributes':['id',_0xe635('0x31'),'color'],'where':_0x337427[_0xe635('0x4f')][_0xe635('0xfb')]?{'id':_0x337427['query'][_0xe635('0xfb')]}:undefined,'required':_0x337427[_0xe635('0x4f')][_0xe635('0xfb')]?!![]:![]}];}return db[_0xe635('0xb7')][_0xe635('0x5e')](_0x47793d);})['then'](function(_0x4a1b34){_0x31da06['rows']=_0x4a1b34;return _0x31da06;});}})[_0xe635('0x18')](respondWithFilteredResult(_0x54a63f,_0x47793d))['catch'](handleError(_0x54a63f,null));};exports[_0xe635('0xfc')]=function(_0x30e633,_0x147668){var _0x5ded55=0x0;var _0xeeb7cd=0x0;var _0x205aa3=![];var _0x43770f;var _0x441a32;return db['ChatWebsite'][_0xe635('0x65')]({'where':{'id':_0x30e633[_0xe635('0x61')]['id']},'include':[{'model':db['Interval'],'as':_0xe635('0x93'),'include':[{'model':db[_0xe635('0x93')],'as':_0xe635('0xa9'),'attributes':['id',_0xe635('0xaa')]}]}]})[_0xe635('0x18')](handleEntityNotFound(_0x147668,null))[_0xe635('0x18')](function(_0x5c7eee){if(_0x5c7eee){_0x43770f=_0x5c7eee;return _0x5c7eee[_0xe635('0xfd')]({'raw':!![]});}})['then'](function(_0x442678){if(_0x43770f){if(_0x442678){_0x441a32=_0x442678;}}return require(_0xe635('0x83'))[_0xe635('0x84')]();})['then'](function(_0x3ed4a4){if(_0x3ed4a4){_0xeeb7cd=_0x3ed4a4[_0xe635('0xfe')];_0x205aa3=_0x3ed4a4[_0xe635('0x85')];}})[_0xe635('0x18')](function(){return db[_0xe635('0xb7')]['count']({'where':{'closed':![]}});})[_0xe635('0x18')](function(_0x412c32){_0x5ded55=_0x412c32;if(_0xeeb7cd&&_0x412c32>_0xeeb7cd){return db[_0xe635('0xff')][_0xe635('0x71')]({'where':{'id':0x1}})[_0xe635('0x18')](function(_0x5906e5){if(_0x5906e5){_0x5906e5[_0xe635('0x100')]('chatLicenseExceeded');}});}})[_0xe635('0x18')](function(){var _0x498f0e=_0x43770f['Interval'];var _0x316e87=_0x43770f['timezone']||undefined;return _0x498f0e?_0x498f0e['ifTime'](_0x316e87):!![];})[_0xe635('0x18')](function(_0x47a963){var _0x28e0d9=fs[_0xe635('0xd7')](path['join'](config['root'],_0xe635('0x101')),_0xe635('0xd9'));var _0x494d41=new url[(_0xe635('0x102'))](_0x43770f[_0xe635('0x103')])['origin'];var _0x32f68f=_0xe635('0x104');var _0x4b0695=![];var _0x5e5285={'chatVersion':_0x32f68f,'chatWebsiteAddressOrigin':_0x494d41,'remote':_0x43770f['remote'],'query':querystring[_0xe635('0x1e')](_[_0xe635('0x5a')](_0x43770f['get']({'plain':!![]}),{'customerIp':_0x30e633[_0xe635('0xb4')][_0xe635('0x39')]||_0x30e633[_0xe635('0xb4')][_0xe635('0x105')]||_0x30e633['connection']['remoteAddress']||_0x30e633['ip'],'referer':_0x30e633[_0xe635('0xb4')][_0xe635('0x3d')],'openedInteractions':_0x5ded55,'maxInteractions':_0xeeb7cd,'virtual':_0x205aa3['virtual'],'online':_0x47a963,'custom':_0x205aa3}))['replace'](/'/g,'\x5c\x27')};_0x147668['send'](ejs[_0xe635('0xda')](Mustache[_0xe635('0xda')](_0x28e0d9,_0x5e5285),{'proactiveActions':_0x441a32,'alignment':_0x43770f[_0xe635('0x106')],'verticalAlignment':_0x43770f[_0xe635('0x107')],'div_color':_0x43770f[_0xe635('0x108')],'labelText':_0x43770f[_0xe635('0x109')],'text_color':_0x43770f[_0xe635('0x10a')],'text_button_color':_0x43770f[_0xe635('0x10b')],'button_color':_0x43770f[_0xe635('0x10c')],'background_color':_0x43770f[_0xe635('0x10d')],'hideWhenOffline':_0x43770f[_0xe635('0x10e')],'intervalId':_0x43770f[_0xe635('0x10f')],'isDevelopment':_0x4b0695,'chatVersion':_0x32f68f}));})[_0xe635('0x60')](handleError(_0x147668,null));};exports['addApplications']=function(_0x64b319,_0x354878){var _0x50d016=_0x64b319['params']['id'];var _0x2b5531=_0x64b319[_0xe635('0x66')];var _0x32ad3a=0xc8;var _0x593885=null;return db[_0xe635('0xe4')]['transaction']({'isolationLevel':db[_0xe635('0xe4')][_0xe635('0x110')][_0xe635('0x111')][_0xe635('0x112')]},function(_0x4dfaa4){return db[_0xe635('0x4b')]['findOne']({'where':{'id':_0x50d016},'transaction':_0x4dfaa4})[_0xe635('0x18')](function(_0x2d3a04){if(_0x2d3a04){return db[_0xe635('0x113')][_0xe635('0x2d')]({'where':{'ChatWebsiteId':_0x50d016},'transaction':_0x4dfaa4})[_0xe635('0x18')](function(){var _0x1c5bb5=_[_0xe635('0x4a')](_0x2b5531,function(_0x2daf6d){_0x2daf6d[_0xe635('0x73')]=_0x50d016;return _0x2daf6d;});return db[_0xe635('0x113')][_0xe635('0x114')](_0x1c5bb5,{'transaction':_0x4dfaa4});});}else{_0x32ad3a=0x194;_0x593885=[];}});})['then'](function(){if(_0x32ad3a!==0x194){return db['ChatApplication'][_0xe635('0x115')]({'where':{'ChatWebsiteId':_0x50d016},'order':_0xe635('0xae')})[_0xe635('0x18')](function(_0x4634cf){_0x593885=_0x4634cf;});}})['catch'](function(_0x165cee){_0x32ad3a=0x1f4;logger['error'](_0x165cee[_0xe635('0x30')]);if(_0x165cee[_0xe635('0x31')]){delete _0x165cee[_0xe635('0x31')];}_0x593885=_0x165cee;})[_0xe635('0x116')](function(){if(_0x593885===null){_0x354878[_0xe635('0x22')](_0x32ad3a);}else{if(_0x32ad3a===0x1f4){_0x354878[_0xe635('0x24')](_0x32ad3a)[_0xe635('0x32')](_0x593885);}else{_0x354878[_0xe635('0x24')](_0x32ad3a)[_0xe635('0x2b')](_0x593885);}}});};exports[_0xe635('0x117')]=function(_0x30bb46,_0x3695a2){var _0x3290f6={};var _0x27a020={};var _0x53ec78;var _0x85f86;return db[_0xe635('0x4b')][_0xe635('0x71')]({'where':{'id':_0x30bb46[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x3695a2,null))[_0xe635('0x18')](function(_0x4d083c){if(_0x4d083c){_0x53ec78=_0x4d083c;_0x27a020[_0xe635('0x44')]=_[_0xe635('0x4e')](db[_0xe635('0x113')][_0xe635('0x4c')]);_0x27a020[_0xe635('0x4f')]=_['keys'](_0x30bb46[_0xe635('0x4f')]);_0x27a020[_0xe635('0x59')]=_[_0xe635('0x50')](_0x27a020[_0xe635('0x44')],_0x27a020[_0xe635('0x4f')]);_0x3290f6[_0xe635('0x51')]=_[_0xe635('0x50')](_0x27a020[_0xe635('0x44')],qs[_0xe635('0x52')](_0x30bb46[_0xe635('0x4f')][_0xe635('0x52')]));_0x3290f6['attributes']=_0x3290f6['attributes']['length']?_0x3290f6['attributes']:_0x27a020[_0xe635('0x44')];_0x3290f6[_0xe635('0x56')]=qs[_0xe635('0x57')](_0x30bb46[_0xe635('0x4f')][_0xe635('0x57')]);_0x3290f6[_0xe635('0x58')]=qs['filters'](_[_0xe635('0x72')](_0x30bb46[_0xe635('0x4f')],_0x27a020[_0xe635('0x59')]));if(_0x30bb46['query'][_0xe635('0x5c')]){_0x3290f6['where']=_[_0xe635('0x5a')](_0x3290f6[_0xe635('0x58')],{'$or':_[_0xe635('0x4a')](_0x3290f6[_0xe635('0x51')],function(_0x27cfd3){var _0x5169b7={};_0x5169b7[_0x27cfd3]={'$like':'%'+_0x30bb46[_0xe635('0x4f')][_0xe635('0x5c')]+'%'};return _0x5169b7;})});}_0x3290f6=_[_0xe635('0x5a')]({},_0x3290f6,_0x30bb46[_0xe635('0x64')]);return _0x53ec78[_0xe635('0x117')](_0x3290f6);}})[_0xe635('0x18')](function(_0x52a8be){if(_0x52a8be){_0x85f86=_0x52a8be['length'];if(!_0x30bb46[_0xe635('0x4f')][_0xe635('0x54')](_0xe635('0x55'))){_0x3290f6[_0xe635('0x27')]=qs[_0xe635('0x27')](_0x30bb46[_0xe635('0x4f')][_0xe635('0x27')]);_0x3290f6[_0xe635('0x25')]=qs['offset'](_0x30bb46['query']['offset']);}return _0x53ec78['getApplications'](_0x3290f6);}})['then'](function(_0x23618f){if(_0x23618f){return _0x23618f?{'count':_0x85f86,'rows':_0x23618f}:null;}})[_0xe635('0x18')](respondWithResult(_0x3695a2,null))[_0xe635('0x60')](handleError(_0x3695a2,null));};exports[_0xe635('0x118')]=function(_0x56ece9,_0x49104a){return db[_0xe635('0x119')][_0xe635('0x65')]({'where':{'id':_0x56ece9['params']['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x49104a,null))[_0xe635('0x18')](function(_0xd6023a){if(_0xd6023a){return _0xd6023a[_0xe635('0x118')](_0x56ece9['body'][_0xe635('0x75')],_[_0xe635('0x11a')](_0x56ece9['body'],[_0xe635('0x75'),'id'])||{});}})[_0xe635('0x18')](respondWithResult(_0x49104a,null))[_0xe635('0x60')](handleError(_0x49104a,null));};exports['getProactiveActions']=function(_0xf1a51b,_0x3c8881){var _0x381691={};var _0x3ea211={};var _0x9efed3;var _0x2c8d2a;return db['ChatWebsite'][_0xe635('0x71')]({'where':{'id':_0xf1a51b[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x3c8881,null))[_0xe635('0x18')](function(_0x1be208){if(_0x1be208){_0x9efed3=_0x1be208;_0x3ea211[_0xe635('0x44')]=_['keys'](db[_0xe635('0x11b')]['rawAttributes']);_0x3ea211[_0xe635('0x4f')]=_[_0xe635('0x4e')](_0xf1a51b[_0xe635('0x4f')]);_0x3ea211[_0xe635('0x59')]=_[_0xe635('0x50')](_0x3ea211[_0xe635('0x44')],_0x3ea211[_0xe635('0x4f')]);_0x381691[_0xe635('0x51')]=_[_0xe635('0x50')](_0x3ea211[_0xe635('0x44')],qs['fields'](_0xf1a51b['query']['fields']));_0x381691[_0xe635('0x51')]=_0x381691[_0xe635('0x51')][_0xe635('0x53')]?_0x381691[_0xe635('0x51')]:_0x3ea211[_0xe635('0x44')];_0x381691[_0xe635('0x56')]=qs['sort'](_0xf1a51b[_0xe635('0x4f')][_0xe635('0x57')]);_0x381691[_0xe635('0x58')]=qs['filters'](_[_0xe635('0x72')](_0xf1a51b[_0xe635('0x4f')],_0x3ea211[_0xe635('0x59')]));if(_0xf1a51b[_0xe635('0x4f')][_0xe635('0x5c')]){_0x381691['where']=_['merge'](_0x381691['where'],{'$or':_['map'](_0x381691['attributes'],function(_0x5de807){var _0x2f0798={};_0x2f0798[_0x5de807]={'$like':'%'+_0xf1a51b[_0xe635('0x4f')]['filter']+'%'};return _0x2f0798;})});}_0x381691=_[_0xe635('0x5a')]({},_0x381691,_0xf1a51b['options']);return _0x9efed3['getProactiveActions'](_0x381691);}})['then'](function(_0x505551){if(_0x505551){_0x2c8d2a=_0x505551[_0xe635('0x53')];if(!_0xf1a51b[_0xe635('0x4f')]['hasOwnProperty'](_0xe635('0x55'))){_0x381691[_0xe635('0x27')]=qs['limit'](_0xf1a51b[_0xe635('0x4f')][_0xe635('0x27')]);_0x381691[_0xe635('0x25')]=qs['offset'](_0xf1a51b[_0xe635('0x4f')][_0xe635('0x25')]);}return _0x9efed3[_0xe635('0xfd')](_0x381691);}})[_0xe635('0x18')](function(_0x3a0753){if(_0x3a0753){return _0x3a0753?{'count':_0x2c8d2a,'rows':_0x3a0753}:null;}})[_0xe635('0x18')](respondWithResult(_0x3c8881,null))[_0xe635('0x60')](handleError(_0x3c8881,null));};exports[_0xe635('0x11c')]=function(_0x2255ee,_0x104dc9){var _0x12be93=_0x2255ee[_0xe635('0x4f')]['online']===_0xe635('0x11d')?'offlineForm':_0xe635('0x11e');return db[_0xe635('0x4b')][_0xe635('0x65')]({'attributes':['id',_0x12be93],'where':{'id':_0x2255ee['params']['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x104dc9,null))[_0xe635('0x18')](function(_0x5a49ee){if(_0x5a49ee){var _0x124a87=_0x5a49ee[_0x12be93];var _0x169450=_0x124a87&&_0x124a87['items']?_0x124a87[_0xe635('0x11f')]:[];_0x104dc9['send']({'fromKey':_[_0xe635('0x8d')](_0x124a87['fromKey'])?undefined:_0x124a87['fromKey'],'count':_0x169450[_0xe635('0x53')],'rows':_0x169450});}})['catch'](handleError(_0x104dc9,null));};exports['getOfflineMessages']=function(_0x548e9d,_0x2b1222){var _0x236fb5={'raw':![],'where':{}};var _0x355548={};var _0x484f26={'count':0x0,'rows':[]};return db[_0xe635('0x4b')][_0xe635('0x71')]({'where':{'id':_0x548e9d[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x2b1222,null))[_0xe635('0x18')](function(_0x211bc4){if(_0x211bc4){_0x355548[_0xe635('0x44')]=_[_0xe635('0x4e')](db[_0xe635('0xdd')][_0xe635('0x4c')]);_0x355548[_0xe635('0x4f')]=_[_0xe635('0x4e')](_0x548e9d['query']);_0x355548[_0xe635('0x59')]=_[_0xe635('0x50')](_0x355548[_0xe635('0x44')],_0x355548[_0xe635('0x4f')]);_0x236fb5[_0xe635('0x51')]=_['intersection'](_0x355548[_0xe635('0x44')],qs[_0xe635('0x52')](_0x548e9d[_0xe635('0x4f')][_0xe635('0x52')]));_0x236fb5[_0xe635('0x51')]=_0x236fb5[_0xe635('0x51')][_0xe635('0x53')]?_0x236fb5['attributes']:_0x355548[_0xe635('0x44')];if(!_0x548e9d[_0xe635('0x4f')][_0xe635('0x54')](_0xe635('0x55'))){_0x236fb5['limit']=qs[_0xe635('0x27')](_0x548e9d[_0xe635('0x4f')][_0xe635('0x27')]);_0x236fb5['offset']=qs['offset'](_0x548e9d['query'][_0xe635('0x25')]);}_0x236fb5[_0xe635('0x56')]=qs[_0xe635('0x57')](_0x548e9d[_0xe635('0x4f')][_0xe635('0x57')]);_0x236fb5[_0xe635('0x58')]=qs[_0xe635('0x59')](_[_0xe635('0x72')](_0x548e9d[_0xe635('0x4f')],_0x355548[_0xe635('0x59')]));_0x236fb5[_0xe635('0x58')][_0xe635('0x73')]=_0x211bc4['id'];if(_0x548e9d[_0xe635('0x4f')][_0xe635('0x5c')]){_0x236fb5['where']=_[_0xe635('0x5a')](_0x236fb5[_0xe635('0x58')],{'$or':_[_0xe635('0x4a')](_0x236fb5[_0xe635('0x51')],function(_0x4cb053){var _0x1e4814={};_0x1e4814[_0x4cb053]={'$like':'%'+_0x548e9d[_0xe635('0x4f')][_0xe635('0x5c')]+'%'};return _0x1e4814;})});}_0x236fb5=_[_0xe635('0x5a')]({},_0x236fb5,_0x548e9d[_0xe635('0x64')]);return db['ChatOfflineMessage'][_0xe635('0x28')]({'where':_0x236fb5[_0xe635('0x58')]})[_0xe635('0x18')](function(_0x430484){_0x484f26[_0xe635('0x28')]=_0x430484;if(_0x548e9d[_0xe635('0x4f')]['includeAll']){_0x236fb5[_0xe635('0x63')]=[{'all':!![]}];}else{_0x236fb5[_0xe635('0x63')]=[{'model':db['CmContact'],'as':_0xe635('0x120'),'required':![]},{'model':db[_0xe635('0x121')],'as':_0xe635('0x122'),'required':![]}];}return db[_0xe635('0xdd')]['findAll'](_0x236fb5);})[_0xe635('0x18')](function(_0x15d83a){_0x484f26['rows']=_0x15d83a;return _0x484f26;});}})[_0xe635('0x18')](respondWithFilteredResult(_0x2b1222,_0x236fb5))['catch'](handleError(_0x2b1222,null));};exports[_0xe635('0x123')]=function(_0x39abac,_0x52d5a8){return db['ChatWebsite'][_0xe635('0x65')]({'where':{'id':_0x39abac[_0xe635('0x61')]['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x52d5a8,null))['then'](function(_0x35e7b5){if(_0x35e7b5){return _0x35e7b5[_0xe635('0x123')](_0x39abac['body']['ids'],_['omit'](_0x39abac[_0xe635('0x66')],['ids','id'])||{})[_0xe635('0xac')](function(_0x1c8dcc){for(var _0x5aaf70=0x0;_0x5aaf70<_0x39abac[_0xe635('0x66')][_0xe635('0x75')]['length'];_0x5aaf70+=0x1){socket[_0xe635('0x124')](_0xe635('0x125'),{'UserId':Number(_0x39abac[_0xe635('0x66')]['ids'][_0x5aaf70]),'ChatWebsiteId':Number(_0x39abac[_0xe635('0x61')]['id'])});}return _0x1c8dcc;});}})['then'](respondWithResult(_0x52d5a8,null))[_0xe635('0x60')](handleError(_0x52d5a8,null));};exports[_0xe635('0x126')]=function(_0x18b888,_0x52ce01){return db[_0xe635('0x4b')][_0xe635('0x65')]({'where':{'id':_0x18b888['params']['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x52ce01,null))[_0xe635('0x18')](function(_0x3804c0){if(_0x3804c0){return _0x3804c0['removeAgents'](_0x18b888[_0xe635('0x4f')][_0xe635('0x75')])[_0xe635('0x18')](function(){if(_[_0xe635('0x127')](_0x18b888[_0xe635('0x4f')][_0xe635('0x75')])){for(var _0x51ae94=0x0;_0x51ae94<_0x18b888[_0xe635('0x4f')]['ids'][_0xe635('0x53')];_0x51ae94+=0x1){socket[_0xe635('0x124')]('userChatWebsite:remove',{'UserId':Number(_0x18b888[_0xe635('0x4f')][_0xe635('0x75')][_0x51ae94]),'ChatWebsiteId':Number(_0x18b888[_0xe635('0x61')]['id'])});}}else{socket[_0xe635('0x124')](_0xe635('0x128'),{'UserId':Number(_0x18b888[_0xe635('0x4f')][_0xe635('0x75')]),'ChatWebsiteId':Number(_0x18b888['params']['id'])});}});}})[_0xe635('0x18')](respondWithStatusCode(_0x52ce01,null))['catch'](handleError(_0x52ce01,null));};exports[_0xe635('0x129')]=function(_0x35ad7e,_0x35fcc6){var _0x1d32c5={};var _0x417696={};var _0x5cfcf7;var _0x2fa0e7;return db[_0xe635('0x4b')]['findOne']({'where':{'id':_0x35ad7e['params']['id']}})[_0xe635('0x18')](handleEntityNotFound(_0x35fcc6,null))[_0xe635('0x18')](function(_0x410895){if(_0x410895){_0x5cfcf7=_0x410895;_0x417696['model']=_['keys'](db[_0xe635('0xf6')]['rawAttributes']);_0x417696[_0xe635('0x4f')]=_['keys'](_0x35ad7e[_0xe635('0x4f')]);_0x417696['filters']=_[_0xe635('0x50')](_0x417696['model'],_0x417696[_0xe635('0x4f')]);_0x1d32c5[_0xe635('0x51')]=_[_0xe635('0x50')](_0x417696[_0xe635('0x44')],qs[_0xe635('0x52')](_0x35ad7e['query']['fields']));_0x1d32c5[_0xe635('0x51')]=_0x1d32c5[_0xe635('0x51')][_0xe635('0x53')]?_0x1d32c5[_0xe635('0x51')]:_0x417696[_0xe635('0x44')];_0x1d32c5[_0xe635('0x56')]=qs['sort'](_0x35ad7e[_0xe635('0x4f')][_0xe635('0x57')]);_0x1d32c5[_0xe635('0x58')]=qs['filters'](_[_0xe635('0x72')](_0x35ad7e[_0xe635('0x4f')],_0x417696[_0xe635('0x59')]));if(_0x35ad7e[_0xe635('0x4f')]['filter']){_0x1d32c5[_0xe635('0x58')]=_[_0xe635('0x5a')](_0x1d32c5[_0xe635('0x58')],{'$or':_[_0xe635('0x4a')](_0x1d32c5[_0xe635('0x51')],function(_0x4634c2){var _0x3ec5c8={};_0x3ec5c8[_0x4634c2]={'$like':'%'+_0x35ad7e['query'][_0xe635('0x5c')]+'%'};return _0x3ec5c8;})});}_0x1d32c5=_[_0xe635('0x5a')]({},_0x1d32c5,_0x35ad7e[_0xe635('0x64')]);return _0x5cfcf7[_0xe635('0x129')](_0x1d32c5);}})[_0xe635('0x18')](function(_0x52862f){if(_0x52862f){_0x2fa0e7=_0x52862f[_0xe635('0x53')];if(!_0x35ad7e[_0xe635('0x4f')][_0xe635('0x54')](_0xe635('0x55'))){_0x1d32c5['limit']=qs['limit'](_0x35ad7e[_0xe635('0x4f')][_0xe635('0x27')]);_0x1d32c5[_0xe635('0x25')]=qs['offset'](_0x35ad7e[_0xe635('0x4f')][_0xe635('0x25')]);}return _0x5cfcf7[_0xe635('0x129')](_0x1d32c5);}})[_0xe635('0x18')](function(_0x1d0a40){if(_0x1d0a40){return _0x1d0a40?{'count':_0x2fa0e7,'rows':_0x1d0a40}:null;}})[_0xe635('0x18')](respondWithResult(_0x35fcc6,null))['catch'](handleError(_0x35fcc6,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 769fdf5..083d72b 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6631=['ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x33832e,_0x3fa9c4){var _0x24130d=function(_0x173ec5){while(--_0x173ec5){_0x33832e['push'](_0x33832e['shift']());}};_0x24130d(++_0x3fa9c4);}(_0x6631,0x134));var _0x1663=function(_0x456076,_0x54dab2){_0x456076=_0x456076-0x0;var _0x714534=_0x6631[_0x456076];return _0x714534;};'use strict';var EventEmitter=require(_0x1663('0x0'));var ChatWebsite=require(_0x1663('0x1'))['db'][_0x1663('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1663('0x3')](0x0);var events={'afterCreate':_0x1663('0x4'),'afterUpdate':_0x1663('0x5'),'afterDestroy':'remove'};function emitEvent(_0x492d72){return function(_0x1e2fcc,_0x232bfe,_0x2b5af7){ChatWebsiteEvents[_0x1663('0x6')](_0x492d72+':'+_0x1e2fcc['id'],_0x1e2fcc);ChatWebsiteEvents[_0x1663('0x6')](_0x492d72,_0x1e2fcc);_0x2b5af7(null);};}for(var e in events){if(events[_0x1663('0x7')](e)){var event=events[e];ChatWebsite[_0x1663('0x8')](e,emitEvent(event));}}module[_0x1663('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x82f5=['setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite'];(function(_0x29bcd1,_0x321aab){var _0xe7f9cb=function(_0x250661){while(--_0x250661){_0x29bcd1['push'](_0x29bcd1['shift']());}};_0xe7f9cb(++_0x321aab);}(_0x82f5,0x15d));var _0x582f=function(_0x528e57,_0x331ad7){_0x528e57=_0x528e57-0x0;var _0x210a47=_0x82f5[_0x528e57];return _0x210a47;};'use strict';var EventEmitter=require(_0x582f('0x0'));var ChatWebsite=require(_0x582f('0x1'))['db'][_0x582f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x582f('0x3')](0x0);var events={'afterCreate':_0x582f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22c0b1){return function(_0x3f3bde,_0xfc37e0,_0x450f17){ChatWebsiteEvents[_0x582f('0x5')](_0x22c0b1+':'+_0x3f3bde['id'],_0x3f3bde);ChatWebsiteEvents[_0x582f('0x5')](_0x22c0b1,_0x3f3bde);_0x450f17(null);};}for(var e in events){if(events[_0x582f('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x582f('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7390150..dc1e12b 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 _0xc98b=['../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x1cd2dc,_0x165624){var _0x59b619=function(_0x283a32){while(--_0x283a32){_0x1cd2dc['push'](_0x1cd2dc['shift']());}};_0x59b619(++_0x165624);}(_0xc98b,0x1cd));var _0xbc98=function(_0x924424,_0x54a0c4){_0x924424=_0x924424-0x0;var _0x528794=_0xc98b[_0x924424];return _0x528794;};'use strict';var _=require(_0xbc98('0x0'));var util=require(_0xbc98('0x1'));var logger=require('../../config/logger')(_0xbc98('0x2'));var moment=require(_0xbc98('0x3'));var BPromise=require(_0xbc98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc98('0x5'));var rimraf=require(_0xbc98('0x6'));var config=require(_0xbc98('0x7'));var attributes=require(_0xbc98('0x8'));module['exports']=function(_0x8edb9f,_0x2f4cc6){return _0x8edb9f[_0xbc98('0x9')](_0xbc98('0xa'),attributes,{'tableName':_0xbc98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cbb=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x2cbb,0x111));var _0xb2cb=function(_0x8b247d,_0x9401a9){_0x8b247d=_0x8b247d-0x0;var _0x4e10a3=_0x2cbb[_0x8b247d];return _0x4e10a3;};'use strict';var _=require(_0xb2cb('0x0'));var util=require(_0xb2cb('0x1'));var logger=require('../../config/logger')(_0xb2cb('0x2'));var moment=require(_0xb2cb('0x3'));var BPromise=require(_0xb2cb('0x4'));var rp=require(_0xb2cb('0x5'));var fs=require('fs');var path=require(_0xb2cb('0x6'));var rimraf=require(_0xb2cb('0x7'));var config=require(_0xb2cb('0x8'));var attributes=require(_0xb2cb('0x9'));module[_0xb2cb('0xa')]=function(_0x3bf193,_0x138aa7){return _0x3bf193[_0xb2cb('0xb')](_0xb2cb('0xc'),attributes,{'tableName':_0xb2cb('0xd'),'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 2a4d6ba..ef6cc4c 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 _0x814d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x814d,0x127));var _0xd814=function(_0x38cff6,_0x2337aa){_0x38cff6=_0x38cff6-0x0;var _0x160066=_0x814d[_0x38cff6];return _0x160066;};'use strict';var _=require(_0xd814('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd814('0x1'));var rs=require(_0xd814('0x2'));var fs=require('fs');var Redis=require(_0xd814('0x3'));var db=require(_0xd814('0x4'))['db'];var utils=require(_0xd814('0x5'));var logger=require(_0xd814('0x6'))('rpc');var config=require(_0xd814('0x7'));var jayson=require(_0xd814('0x8'));var client=jayson['client'][_0xd814('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd814('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd814('0xb'))[_0xd814('0xc')](socket);function respondWithRpcPromise(_0x5be1a4,_0xa7ef84,_0x2eb9fb){return new BPromise(function(_0x3cd4a0,_0xdee57c){return client[_0xd814('0xd')](_0x5be1a4,_0x2eb9fb)[_0xd814('0xe')](function(_0x3156ad){logger[_0xd814('0xf')](_0xd814('0x10'),_0xa7ef84,_0xd814('0x11'));logger['debug'](_0xd814('0x12'),_0xa7ef84,_0xd814('0x11'),JSON[_0xd814('0x13')](_0x3156ad));if(_0x3156ad[_0xd814('0x14')]){if(_0x3156ad[_0xd814('0x14')][_0xd814('0x15')]===0x1f4){logger[_0xd814('0x14')](_0xd814('0x10'),_0xa7ef84,_0x3156ad[_0xd814('0x14')]['message']);return _0xdee57c(_0x3156ad[_0xd814('0x14')][_0xd814('0x16')]);}logger[_0xd814('0x14')](_0xd814('0x10'),_0xa7ef84,_0x3156ad['error'][_0xd814('0x16')]);return _0x3cd4a0(_0x3156ad[_0xd814('0x14')][_0xd814('0x16')]);}else{logger[_0xd814('0xf')](_0xd814('0x10'),_0xa7ef84,_0xd814('0x11'));_0x3cd4a0(_0x3156ad[_0xd814('0x17')]['message']);}})[_0xd814('0x18')](function(_0x5af747){logger['error'](_0xd814('0x10'),_0xa7ef84,_0x5af747);_0xdee57c(_0x5af747);});});} \ No newline at end of file +var _0xf62a=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0xcc7711,_0x16ee28){var _0x474c5f=function(_0x4931bd){while(--_0x4931bd){_0xcc7711['push'](_0xcc7711['shift']());}};_0x474c5f(++_0x16ee28);}(_0xf62a,0x1ef));var _0xaf62=function(_0x559c0f,_0x4e6c51){_0x559c0f=_0x559c0f-0x0;var _0x1b4463=_0xf62a[_0x559c0f];return _0x1b4463;};'use strict';var _=require(_0xaf62('0x0'));var util=require(_0xaf62('0x1'));var moment=require(_0xaf62('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf62('0x3'));var fs=require('fs');var Redis=require(_0xaf62('0x4'));var db=require(_0xaf62('0x5'))['db'];var utils=require(_0xaf62('0x6'));var logger=require(_0xaf62('0x7'))(_0xaf62('0x8'));var config=require(_0xaf62('0x9'));var jayson=require(_0xaf62('0xa'));var client=jayson[_0xaf62('0xb')]['http']({'port':0x232a});config[_0xaf62('0xc')]=_[_0xaf62('0xd')](config[_0xaf62('0xc')],{'host':_0xaf62('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf62('0xc')]));require(_0xaf62('0xf'))[_0xaf62('0x10')](socket);function respondWithRpcPromise(_0x54fa4d,_0x56204b,_0x36183b){return new BPromise(function(_0x4226a8,_0x24dc4b){return client[_0xaf62('0x11')](_0x54fa4d,_0x36183b)['then'](function(_0x68ea33){logger[_0xaf62('0x12')](_0xaf62('0x13'),_0x56204b,_0xaf62('0x14'));logger[_0xaf62('0x15')](_0xaf62('0x16'),_0x56204b,_0xaf62('0x14'),JSON[_0xaf62('0x17')](_0x68ea33));if(_0x68ea33['error']){if(_0x68ea33['error'][_0xaf62('0x18')]===0x1f4){logger[_0xaf62('0x19')](_0xaf62('0x13'),_0x56204b,_0x68ea33[_0xaf62('0x19')][_0xaf62('0x1a')]);return _0x24dc4b(_0x68ea33[_0xaf62('0x19')][_0xaf62('0x1a')]);}logger['error'](_0xaf62('0x13'),_0x56204b,_0x68ea33['error'][_0xaf62('0x1a')]);return _0x4226a8(_0x68ea33[_0xaf62('0x19')][_0xaf62('0x1a')]);}else{logger[_0xaf62('0x12')](_0xaf62('0x13'),_0x56204b,_0xaf62('0x14'));_0x4226a8(_0x68ea33[_0xaf62('0x1b')][_0xaf62('0x1a')]);}})[_0xaf62('0x1c')](function(_0x1153e1){logger[_0xaf62('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x56204b,_0x1153e1);_0x24dc4b(_0x1153e1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 438241d..f268835 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 _0x42c9=['removeListener','length','chatWebsite:','save','remove','update','emit'];(function(_0x27a9cc,_0x1b1b55){var _0x412f06=function(_0x6edd42){while(--_0x6edd42){_0x27a9cc['push'](_0x27a9cc['shift']());}};_0x412f06(++_0x1b1b55);}(_0x42c9,0x18b));var _0x942c=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0x42c9[_0x838813];return _0x2bd32d;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x942c('0x0'),_0x942c('0x1'),_0x942c('0x2')];function createListener(_0x46678c,_0x3ba745){return function(_0x6816b5){_0x3ba745[_0x942c('0x3')](_0x46678c,_0x6816b5);};}function removeListener(_0x1ba73f,_0x47e30c){return function(){ChatWebsiteEvents[_0x942c('0x4')](_0x1ba73f,_0x47e30c);};}exports['register']=function(_0x2362de){for(var _0x288526=0x0,_0x4fdc69=events[_0x942c('0x5')];_0x288526<_0x4fdc69;_0x288526++){var _0x3449e5=events[_0x288526];var _0x46424d=createListener(_0x942c('0x6')+_0x3449e5,_0x2362de);ChatWebsiteEvents['on'](_0x3449e5,_0x46424d);}}; \ No newline at end of file +var _0x11ca=['./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x37002e,_0x41f2f5){var _0x25d8db=function(_0x46fa9b){while(--_0x46fa9b){_0x37002e['push'](_0x37002e['shift']());}};_0x25d8db(++_0x41f2f5);}(_0x11ca,0x1ec));var _0xa11c=function(_0x2cca77,_0x359f86){_0x2cca77=_0x2cca77-0x0;var _0x1e0d59=_0x11ca[_0x2cca77];return _0x1e0d59;};'use strict';var ChatWebsiteEvents=require(_0xa11c('0x0'));var events=[_0xa11c('0x1'),_0xa11c('0x2'),_0xa11c('0x3')];function createListener(_0x110a06,_0x1ad102){return function(_0x4300b7){_0x1ad102[_0xa11c('0x4')](_0x110a06,_0x4300b7);};}function removeListener(_0x513924,_0x2945c0){return function(){ChatWebsiteEvents[_0xa11c('0x5')](_0x513924,_0x2945c0);};}exports['register']=function(_0x29ab61){for(var _0x7f3ea3=0x0,_0x575851=events['length'];_0x7f3ea3<_0x575851;_0x7f3ea3++){var _0x66ec73=events[_0x7f3ea3];var _0x5237fd=createListener('chatWebsite:'+_0x66ec73,_0x29ab61);ChatWebsiteEvents['on'](_0x66ec73,_0x5237fd);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 0fc22ea..5258bc3 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 _0xfee3=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addAnswer','join','root','server/files/images/logos/','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','%s-%s','now','addAvatar','format','addCustomerAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x962edb,_0x5dd356){var _0x359dcf=function(_0x978f40){while(--_0x978f40){_0x962edb['push'](_0x962edb['shift']());}};_0x359dcf(++_0x5dd356);}(_0xfee3,0x93));var _0x3fee=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xfee3[_0x2dbce7];return _0x3a3ed0;};'use strict';var multer=require(_0x3fee('0x0'));var util=require(_0x3fee('0x1'));var path=require(_0x3fee('0x2'));var timeout=require(_0x3fee('0x3'));var express=require(_0x3fee('0x4'));var router=express[_0x3fee('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3fee('0x6'));var config=require(_0x3fee('0x7'));var controller=require(_0x3fee('0x8'));router[_0x3fee('0x9')]('/',auth[_0x3fee('0xa')](),controller[_0x3fee('0xb')]);router[_0x3fee('0x9')](_0x3fee('0xc'),auth['isAuthenticated'](),controller[_0x3fee('0xd')]);router['get'](_0x3fee('0xe'),auth[_0x3fee('0xa')](),controller[_0x3fee('0xf')]);router[_0x3fee('0x9')](_0x3fee('0x10'),auth[_0x3fee('0xa')](),controller[_0x3fee('0x11')]);router[_0x3fee('0x9')](_0x3fee('0x12'),auth[_0x3fee('0xa')](),controller[_0x3fee('0x13')]);router[_0x3fee('0x9')](_0x3fee('0x14'),controller[_0x3fee('0x15')]);router[_0x3fee('0x9')](_0x3fee('0x16'),controller[_0x3fee('0x17')]);router[_0x3fee('0x9')](_0x3fee('0x18'),controller['getCustomerAvatar']);router[_0x3fee('0x9')](_0x3fee('0x19'),controller[_0x3fee('0x1a')]);router[_0x3fee('0x9')](_0x3fee('0x1b'),auth[_0x3fee('0xa')](),controller[_0x3fee('0x1c')]);router[_0x3fee('0x9')](_0x3fee('0x1d'),controller['getSnippet']);router[_0x3fee('0x9')](_0x3fee('0x1e'),auth[_0x3fee('0xa')](),controller[_0x3fee('0x1f')]);router[_0x3fee('0x9')](_0x3fee('0x20'),auth['isAuthenticated'](),controller[_0x3fee('0x21')]);router['get'](_0x3fee('0x22'),controller[_0x3fee('0x23')]);router[_0x3fee('0x9')](_0x3fee('0x24'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x3fee('0x9')](_0x3fee('0x25'),auth[_0x3fee('0xa')](),controller[_0x3fee('0x26')]);router[_0x3fee('0x27')]('/',auth['isAuthenticated'](),controller[_0x3fee('0x28')]);router[_0x3fee('0x27')](_0x3fee('0x10'),auth[_0x3fee('0xa')](),controller['addDisposition']);router[_0x3fee('0x27')]('/:id/canned_answers',auth[_0x3fee('0xa')](),controller[_0x3fee('0x29')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c963e,_0x22a7ce,_0x5ded1a){_0x5ded1a(null,path[_0x3fee('0x2a')](config[_0x3fee('0x2b')],_0x3fee('0x2c')));},'filename':function(_0x262cf1,_0x516a6a,_0x5839fe){_0x5839fe(null,util['format']('%s-%s',Date['now'](),_0x516a6a[_0x3fee('0x2d')]));}})});router[_0x3fee('0x27')](_0x3fee('0x14'),upload[_0x3fee('0x2e')](_0x3fee('0x2f')),controller[_0x3fee('0x30')]);var upload=multer({'storage':multer[_0x3fee('0x31')]({'destination':function(_0x53c011,_0x59cd0d,_0x4ddd71){_0x4ddd71(null,path[_0x3fee('0x2a')](config[_0x3fee('0x2b')],_0x3fee('0x32')));},'filename':function(_0x5e1739,_0xbc9d29,_0x12f305){_0x12f305(null,util['format'](_0x3fee('0x33'),Date[_0x3fee('0x34')](),_0xbc9d29[_0x3fee('0x2d')]));}})});router[_0x3fee('0x27')](_0x3fee('0x16'),upload[_0x3fee('0x2e')](_0x3fee('0x2f')),controller[_0x3fee('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d277d,_0xac326f,_0x1204bf){_0x1204bf(null,path[_0x3fee('0x2a')](config[_0x3fee('0x2b')],_0x3fee('0x32')));},'filename':function(_0x13acd5,_0x5cd486,_0x2719a9){_0x2719a9(null,util[_0x3fee('0x36')](_0x3fee('0x33'),Date[_0x3fee('0x34')](),_0x5cd486[_0x3fee('0x2d')]));}})});router['post'](_0x3fee('0x18'),upload[_0x3fee('0x2e')]('file'),controller[_0x3fee('0x37')]);var upload=multer({'storage':multer[_0x3fee('0x31')]({'destination':function(_0x1a66e4,_0x2b8438,_0x8ddfa){_0x8ddfa(null,path[_0x3fee('0x2a')](config['root'],_0x3fee('0x32')));},'filename':function(_0x25e048,_0x28225a,_0x23d662){_0x23d662(null,util['format'](_0x3fee('0x33'),Date[_0x3fee('0x34')](),_0x28225a[_0x3fee('0x2d')]));}})});router['post'](_0x3fee('0x19'),upload[_0x3fee('0x2e')](_0x3fee('0x2f')),controller['addSystemAvatar']);router[_0x3fee('0x27')]('/:id/notify',controller[_0x3fee('0x38')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0xdf972a,_0x20a82d,_0x1bec6d){const _0x127769=path[_0x3fee('0x2a')](config[_0x3fee('0x2b')],_0x3fee('0x39'),_0x3fee('0x3a'),_0x3fee('0x3b'));fs_extra[_0x3fee('0x3c')](_0x127769,function(){_0x1bec6d(null,_0x127769);});},'filename':function(_0x4bf850,_0x526234,_0x113ac2){const _0xc1cd59=_0x526234[_0x3fee('0x2d')][_0x3fee('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x111875=path[_0x3fee('0x3e')](_0xc1cd59);const _0x1c01ad=Date[_0x3fee('0x34')]()+'-'+_0xc1cd59[_0x3fee('0x3d')](_0x111875,'')+_0x111875;_0x113ac2(null,_0x1c01ad);}})});router[_0x3fee('0x27')](_0x3fee('0x3f'),offlineUploadMulter[_0x3fee('0x40')](),controller[_0x3fee('0x41')]);router[_0x3fee('0x27')]('/:id/interactions',auth[_0x3fee('0xa')](),controller['addInteraction']);router[_0x3fee('0x27')]('/:id/applications',auth['isAuthenticated'](),controller[_0x3fee('0x42')]);router[_0x3fee('0x27')]('/:id/proactive_actions',auth[_0x3fee('0xa')](),controller[_0x3fee('0x43')]);router[_0x3fee('0x27')](_0x3fee('0x25'),auth['isAuthenticated'](),controller[_0x3fee('0x44')]);router[_0x3fee('0x45')](_0x3fee('0xe'),auth[_0x3fee('0xa')](),controller['update']);router[_0x3fee('0x46')](_0x3fee('0xe'),auth[_0x3fee('0xa')](),controller[_0x3fee('0x47')]);router[_0x3fee('0x46')](_0x3fee('0x10'),auth[_0x3fee('0xa')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x3fee('0xa')](),controller[_0x3fee('0x48')]);router['delete']('/:id/users',auth[_0x3fee('0xa')](),controller[_0x3fee('0x49')]);module[_0x3fee('0x4a')]=router; \ No newline at end of file +var _0xb7c8=['getAvatar','/:id/customer_avatar','getCustomerAvatar','/: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','create','addDisposition','diskStorage','join','root','server/files/images/logos/','now','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','addAvatar','format','addCustomerAvatar','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb7c8,0x15b));var _0x8b7c=function(_0x3f625f,_0x55a23a){_0x3f625f=_0x3f625f-0x0;var _0xdbc1d7=_0xb7c8[_0x3f625f];return _0xdbc1d7;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var fs_extra=require(_0x8b7c('0x5'));var auth=require(_0x8b7c('0x6'));var interaction=require(_0x8b7c('0x7'));var config=require(_0x8b7c('0x8'));var controller=require(_0x8b7c('0x9'));router[_0x8b7c('0xa')]('/',auth['isAuthenticated'](),controller[_0x8b7c('0xb')]);router[_0x8b7c('0xa')](_0x8b7c('0xc'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0xe')]);router[_0x8b7c('0xa')](_0x8b7c('0xf'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x10')]);router['get'](_0x8b7c('0x11'),auth['isAuthenticated'](),controller[_0x8b7c('0x12')]);router[_0x8b7c('0xa')](_0x8b7c('0x13'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x8b7c('0x14'),controller[_0x8b7c('0x15')]);router[_0x8b7c('0xa')](_0x8b7c('0x16'),controller[_0x8b7c('0x17')]);router[_0x8b7c('0xa')](_0x8b7c('0x18'),controller[_0x8b7c('0x19')]);router[_0x8b7c('0xa')](_0x8b7c('0x1a'),controller['getSystemAvatar']);router['get'](_0x8b7c('0x1b'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x1c')]);router[_0x8b7c('0xa')](_0x8b7c('0x1d'),controller[_0x8b7c('0x1e')]);router[_0x8b7c('0xa')](_0x8b7c('0x1f'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x20')]);router[_0x8b7c('0xa')](_0x8b7c('0x21'),auth['isAuthenticated'](),controller[_0x8b7c('0x22')]);router['get']('/:id/fields',controller[_0x8b7c('0x23')]);router[_0x8b7c('0xa')](_0x8b7c('0x24'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x25')]);router[_0x8b7c('0xa')](_0x8b7c('0x26'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x27')]);router[_0x8b7c('0x28')]('/',auth['isAuthenticated'](),controller[_0x8b7c('0x29')]);router['post'](_0x8b7c('0x11'),auth['isAuthenticated'](),controller[_0x8b7c('0x2a')]);router[_0x8b7c('0x28')](_0x8b7c('0x13'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0x8b7c('0x2b')]({'destination':function(_0x136365,_0x331a3a,_0x1f0a07){_0x1f0a07(null,path[_0x8b7c('0x2c')](config[_0x8b7c('0x2d')],_0x8b7c('0x2e')));},'filename':function(_0x24b959,_0x28c229,_0x4aab9f){_0x4aab9f(null,util['format']('%s-%s',Date[_0x8b7c('0x2f')](),_0x28c229[_0x8b7c('0x30')]));}})});router[_0x8b7c('0x28')](_0x8b7c('0x14'),upload[_0x8b7c('0x31')](_0x8b7c('0x32')),controller[_0x8b7c('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x163185,_0x46b085,_0x251c78){_0x251c78(null,path[_0x8b7c('0x2c')](config[_0x8b7c('0x2d')],_0x8b7c('0x34')));},'filename':function(_0x5ae73d,_0x196e24,_0x2253fa){_0x2253fa(null,util['format'](_0x8b7c('0x35'),Date[_0x8b7c('0x2f')](),_0x196e24[_0x8b7c('0x30')]));}})});router[_0x8b7c('0x28')](_0x8b7c('0x16'),upload[_0x8b7c('0x31')]('file'),controller[_0x8b7c('0x36')]);var upload=multer({'storage':multer[_0x8b7c('0x2b')]({'destination':function(_0x42bd4d,_0xf4f35e,_0x4675ea){_0x4675ea(null,path['join'](config[_0x8b7c('0x2d')],_0x8b7c('0x34')));},'filename':function(_0x2b3557,_0xa52292,_0x2d5854){_0x2d5854(null,util[_0x8b7c('0x37')](_0x8b7c('0x35'),Date['now'](),_0xa52292[_0x8b7c('0x30')]));}})});router[_0x8b7c('0x28')](_0x8b7c('0x18'),upload['single'](_0x8b7c('0x32')),controller[_0x8b7c('0x38')]);var upload=multer({'storage':multer[_0x8b7c('0x2b')]({'destination':function(_0xfcda94,_0x7cf92f,_0x7432eb){_0x7432eb(null,path['join'](config[_0x8b7c('0x2d')],_0x8b7c('0x34')));},'filename':function(_0x180317,_0x103fb3,_0x23a208){_0x23a208(null,util['format']('%s-%s',Date[_0x8b7c('0x2f')](),_0x103fb3[_0x8b7c('0x30')]));}})});router['post'](_0x8b7c('0x1a'),upload[_0x8b7c('0x31')]('file'),controller['addSystemAvatar']);router[_0x8b7c('0x28')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x8b7c('0x2b')]({'destination':function(_0x1c5ffe,_0x24a06f,_0x2b6909){const _0x3b70d4=path[_0x8b7c('0x2c')](config[_0x8b7c('0x2d')],_0x8b7c('0x39'),_0x8b7c('0x3a'),_0x8b7c('0x3b'));fs_extra[_0x8b7c('0x3c')](_0x3b70d4,function(){_0x2b6909(null,_0x3b70d4);});},'filename':function(_0x17ac04,_0x549fbb,_0x1512d9){const _0x4a81e6=_0x549fbb[_0x8b7c('0x30')][_0x8b7c('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x557d16=path[_0x8b7c('0x3e')](_0x4a81e6);const _0x302d8e=Date[_0x8b7c('0x2f')]()+'-'+_0x4a81e6[_0x8b7c('0x3d')](_0x557d16,'')+_0x557d16;_0x1512d9(null,_0x302d8e);}})});router[_0x8b7c('0x28')](_0x8b7c('0x3f'),offlineUploadMulter[_0x8b7c('0x40')](),controller[_0x8b7c('0x41')]);router[_0x8b7c('0x28')](_0x8b7c('0x1b'),auth[_0x8b7c('0xd')](),controller['addInteraction']);router[_0x8b7c('0x28')](_0x8b7c('0x1f'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x42')]);router[_0x8b7c('0x28')](_0x8b7c('0x21'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x43')]);router[_0x8b7c('0x28')]('/:id/users',auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x44')]);router[_0x8b7c('0x45')](_0x8b7c('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8b7c('0x46')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x8b7c('0x46')](_0x8b7c('0x11'),auth[_0x8b7c('0xd')](),controller[_0x8b7c('0x47')]);router[_0x8b7c('0x46')](_0x8b7c('0x13'),auth['isAuthenticated'](),controller[_0x8b7c('0x48')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x8b7c('0x49')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 05494b9..5e85a16 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 _0x0cfe=['exports','express','../components/auth/service','env','production','app','get','use','isAuthenticated'];(function(_0x547587,_0x48cbd9){var _0x3d7777=function(_0x3e5075){while(--_0x3e5075){_0x547587['push'](_0x547587['shift']());}};_0x3d7777(++_0x48cbd9);}(_0x0cfe,0xb5));var _0xe0cf=function(_0x265e68,_0x250e40){_0x265e68=_0x265e68-0x0;var _0x16cb4f=_0x0cfe[_0x265e68];return _0x16cb4f;};var beaverLogger=require('beaver-logger/server');var express=require(_0xe0cf('0x0'));var auth=require(_0xe0cf('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0xe0cf('0x2')]===_0xe0cf('0x3')||![];function clientSideLogs(_0x123c4b,_0x4b9836,_0x477f5e){var _0x15539b=_0x123c4b[_0xe0cf('0x4')][_0xe0cf('0x5')]('client-side-logger');if(!_0x15539b){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x15539b,'enableCors':!isProduction})(_0x123c4b,_0x4b9836,_0x477f5e);}router[_0xe0cf('0x6')](auth[_0xe0cf('0x7')](),clientSideLogs);module[_0xe0cf('0x8')]=router; \ No newline at end of file +var _0x0fc0=['use','isAuthenticated','exports','beaver-logger/server','../config/environment','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x0fc0,0x10b));var _0x00fc=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0fc0[_0x5d6456];return _0x4d66c1;};var beaverLogger=require(_0x00fc('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x00fc('0x1'));var router=express['Router']();var isProduction=config[_0x00fc('0x2')]===_0x00fc('0x3')||![];function clientSideLogs(_0x2b3985,_0x35bff2,_0x342dd2){var _0x4573f9=_0x2b3985['app'][_0x00fc('0x4')](_0x00fc('0x5'));if(!_0x4573f9){throw new Error(_0x00fc('0x6'));}return beaverLogger[_0x00fc('0x7')]({'uri':_0x00fc('0x8'),'logger':_0x4573f9,'enableCors':!isProduction})(_0x2b3985,_0x35bff2,_0x342dd2);}router[_0x00fc('0x9')](auth[_0x00fc('0xa')](),clientSideLogs);module[_0x00fc('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 1620ea6..c863b10 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 _0x897a=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','sequelize','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','STRING'];(function(_0x29c56b,_0x2bcb3d){var _0x4854af=function(_0x18c109){while(--_0x18c109){_0x29c56b['push'](_0x29c56b['shift']());}};_0x4854af(++_0x2bcb3d);}(_0x897a,0xe3));var _0xa897=function(_0x5bbf9a,_0x5588bb){_0x5bbf9a=_0x5bbf9a-0x0;var _0xf00f2b=_0x897a[_0x5bbf9a];return _0xf00f2b;};'use strict';var Sequelize=require(_0xa897('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa897('0x1')](_0xa897('0x2'),_0xa897('0x3'),_0xa897('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa897('0x1')]('Outlook365',_0xa897('0x5'))},'data1':{'type':Sequelize[_0xa897('0x6')],'comment':_0xa897('0x7')},'data2':{'type':Sequelize[_0xa897('0x6')],'comment':_0xa897('0x8')},'data3':{'type':Sequelize[_0xa897('0x6')],'comment':_0xa897('0x9')},'data4':{'type':Sequelize[_0xa897('0x6')],'comment':_0xa897('0xa')},'data5':{'type':Sequelize[_0xa897('0xb')],'comment':_0xa897('0xc')},'data6':{'type':Sequelize[_0xa897('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xa897('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x4a19=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x4cc815,_0x1d6f0c){var _0x34731e=function(_0x4a4eec){while(--_0x4a4eec){_0x4cc815['push'](_0x4cc815['shift']());}};_0x34731e(++_0x1d6f0c);}(_0x4a19,0x1b5));var _0x94a1=function(_0x5e7b34,_0x4e3982){_0x5e7b34=_0x5e7b34-0x0;var _0x112391=_0x4a19[_0x5e7b34];return _0x112391;};'use strict';var Sequelize=require(_0x94a1('0x0'));module['exports']={'name':{'type':Sequelize[_0x94a1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x94a1('0x2')]('AmazonAWS',_0x94a1('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x94a1('0x2')](_0x94a1('0x4'),_0x94a1('0x5'))},'data1':{'type':Sequelize[_0x94a1('0x1')],'comment':_0x94a1('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0x94a1('0x7')},'data3':{'type':Sequelize[_0x94a1('0x1')],'comment':_0x94a1('0x8')},'data4':{'type':Sequelize[_0x94a1('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x94a1('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x94a1('0x9')],'comment':_0x94a1('0xa')},'data7':{'type':Sequelize[_0x94a1('0x9')],'comment':_0x94a1('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 457df03..66fbab1 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 _0x94aa=['code','data5','access_token','update','startRefreshInterval','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','sendStatus','end','status','json','offset','undefined','limit','count','set','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x94aa,0x120));var _0xa94a=function(_0x22f058,_0x52eb4f){_0x22f058=_0x22f058-0x0;var _0x5dbc3c=_0x94aa[_0x22f058];return _0x5dbc3c;};'use strict';var _=require(_0xa94a('0x0'));var Redis=require(_0xa94a('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xa94a('0x2'));var config=require('../../config/environment');var logger=require(_0xa94a('0x3'))(_0xa94a('0x4'));var db=require(_0xa94a('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xa94a('0x6')]=_[_0xa94a('0x7')](config[_0xa94a('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa94a('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x15b69c,_0x152cb2){_0x152cb2=_0x152cb2||0xcc;return function(_0x43e6b2){if(_0x43e6b2){return _0x15b69c[_0xa94a('0x8')](_0x152cb2);}return _0x15b69c['status'](_0x152cb2)[_0xa94a('0x9')]();};}function respondWithResult(_0x262f8a,_0x56a86b){_0x56a86b=_0x56a86b||0xc8;return function(_0x5f3161){if(_0x5f3161){return _0x262f8a[_0xa94a('0xa')](_0x56a86b)[_0xa94a('0xb')](_0x5f3161);}};}function respondWithFilteredResult(_0x54b250,_0x57aa1a){return function(_0x476df5){if(_0x476df5){var _0x257127=typeof _0x57aa1a[_0xa94a('0xc')]===_0xa94a('0xd')&&typeof _0x57aa1a[_0xa94a('0xe')]===_0xa94a('0xd');var _0xade301=_0x476df5[_0xa94a('0xf')];var _0x995142=_0x257127?0x0:_0x57aa1a[_0xa94a('0xc')];var _0x33a3e8=_0x257127?_0x476df5[_0xa94a('0xf')]:_0x57aa1a[_0xa94a('0xc')]+_0x57aa1a[_0xa94a('0xe')];var _0xc3515a;if(_0x33a3e8>=_0xade301){_0x33a3e8=_0xade301;_0xc3515a=0xc8;}else{_0xc3515a=0xce;}_0x54b250['status'](_0xc3515a);return _0x54b250[_0xa94a('0x10')]('Content-Range',_0x995142+'-'+_0x33a3e8+'/'+_0xade301)[_0xa94a('0xb')](_0x476df5);}return null;};}function saveUpdates(_0x465269){return function(_0xbb115d){if(_0xbb115d){return _0xbb115d['update'](_0x465269)[_0xa94a('0x11')](function(_0x952fb2){return _0x952fb2;});}return null;};}function removeEntity(_0x332f44){return function(_0xb4e46){if(_0xb4e46){return _0xb4e46[_0xa94a('0x12')]()[_0xa94a('0x11')](function(){_0x332f44['status'](0xcc)[_0xa94a('0x9')]();});}};}function handleEntityNotFound(_0x1bf91e){return function(_0x440945){if(!_0x440945){_0x1bf91e['sendStatus'](0x194);}return _0x440945;};}function handleError(_0x4c80cf,_0x15303f){_0x15303f=_0x15303f||0x1f4;return function(_0x5b3611){logger[_0xa94a('0x13')](_0x5b3611[_0xa94a('0x14')]);if(_0x5b3611[_0xa94a('0x15')]){delete _0x5b3611['name'];}_0x4c80cf[_0xa94a('0xa')](_0x15303f)[_0xa94a('0x16')](_0x5b3611);};}function maskClientSecret(_0x2f573d){return _[_0xa94a('0x17')](_0x2f573d[_0xa94a('0x18')](0x0,0x3),0x14,'*');}exports[_0xa94a('0x19')]=function(_0x200e2f,_0x198ec0){var _0x205213={},_0x53494c={},_0xa36fbf={'count':0x0,'rows':[]};var _0x5c6b84=_[_0xa94a('0x1a')](db[_0xa94a('0x1b')][_0xa94a('0x1c')],function(_0x16a665){return{'name':_0x16a665[_0xa94a('0x1d')],'type':_0x16a665[_0xa94a('0x1e')]['key']};});_0x53494c['model']=_[_0xa94a('0x1a')](_0x5c6b84,_0xa94a('0x15'));_0x53494c[_0xa94a('0x1f')]=_[_0xa94a('0x20')](_0x200e2f[_0xa94a('0x1f')]);_0x53494c[_0xa94a('0x21')]=_[_0xa94a('0x22')](_0x53494c[_0xa94a('0x23')],_0x53494c['query']);_0x205213[_0xa94a('0x24')]=_[_0xa94a('0x22')](_0x53494c[_0xa94a('0x23')],qs['fields'](_0x200e2f[_0xa94a('0x1f')][_0xa94a('0x25')]));_0x205213[_0xa94a('0x24')]=_0x205213[_0xa94a('0x24')][_0xa94a('0x26')]?_0x205213['attributes']:_0x53494c[_0xa94a('0x23')];if(!_0x200e2f[_0xa94a('0x1f')][_0xa94a('0x27')]('nolimit')){_0x205213[_0xa94a('0xe')]=qs[_0xa94a('0xe')](_0x200e2f['query'][_0xa94a('0xe')]);_0x205213[_0xa94a('0xc')]=qs[_0xa94a('0xc')](_0x200e2f[_0xa94a('0x1f')]['offset']);}_0x205213[_0xa94a('0x28')]=qs['sort'](_0x200e2f[_0xa94a('0x1f')]['sort']);_0x205213[_0xa94a('0x29')]=qs[_0xa94a('0x21')](_[_0xa94a('0x2a')](_0x200e2f[_0xa94a('0x1f')],_0x53494c['filters']),_0x5c6b84);if(_0x200e2f[_0xa94a('0x1f')][_0xa94a('0x2b')]){_0x205213['where']=_[_0xa94a('0x2c')](_0x205213['where'],{'$or':_[_0xa94a('0x1a')](_0x5c6b84,function(_0xb6bf96){if(_0xb6bf96[_0xa94a('0x1e')]!==_0xa94a('0x2d')){var _0x7f6e9={};_0x7f6e9[_0xb6bf96[_0xa94a('0x15')]]={'$like':'%'+_0x200e2f['query'][_0xa94a('0x2b')]+'%'};return _0x7f6e9;}})});}_0x205213=_[_0xa94a('0x2c')]({},_0x205213,_0x200e2f[_0xa94a('0x2e')]);var _0x3a6a68={'where':_0x205213['where']};return db[_0xa94a('0x1b')][_0xa94a('0xf')](_0x3a6a68)['then'](function(_0x53a338){_0xa36fbf[_0xa94a('0xf')]=_0x53a338;if(_0x200e2f[_0xa94a('0x1f')][_0xa94a('0x2f')]){_0x205213[_0xa94a('0x30')]=[{'all':!![]}];}return db[_0xa94a('0x1b')][_0xa94a('0x31')](_0x205213);})[_0xa94a('0x11')](function(_0x1c1167){_0xa36fbf[_0xa94a('0x32')]=_[_0xa94a('0x1a')](_0x1c1167,function(_0x348d7d){if(_0x348d7d[_0xa94a('0x33')]===_0xa94a('0x34')){var _0x5dfd88=encryptor[_0xa94a('0x35')](_0x348d7d[_0xa94a('0x36')]);_0x348d7d[_0xa94a('0x36')]=maskClientSecret(_0x5dfd88);}return _0x348d7d;});return _0xa36fbf;})[_0xa94a('0x11')](respondWithFilteredResult(_0x198ec0,_0x205213))[_0xa94a('0x37')](handleError(_0x198ec0,null));};exports[_0xa94a('0x38')]=function(_0x55f414,_0x3ff8ad){var _0x3ba990={'raw':!![],'where':{'id':_0x55f414[_0xa94a('0x39')]['id']}},_0x5e2d57={};_0x5e2d57[_0xa94a('0x23')]=_[_0xa94a('0x20')](db['CloudProvider'][_0xa94a('0x1c')]);_0x5e2d57[_0xa94a('0x1f')]=_[_0xa94a('0x20')](_0x55f414['query']);_0x5e2d57[_0xa94a('0x21')]=_[_0xa94a('0x22')](_0x5e2d57[_0xa94a('0x23')],_0x5e2d57['query']);_0x3ba990[_0xa94a('0x24')]=_['intersection'](_0x5e2d57[_0xa94a('0x23')],qs['fields'](_0x55f414[_0xa94a('0x1f')]['fields']));_0x3ba990['attributes']=_0x3ba990[_0xa94a('0x24')]['length']?_0x3ba990[_0xa94a('0x24')]:_0x5e2d57[_0xa94a('0x23')];if(_0x55f414[_0xa94a('0x1f')][_0xa94a('0x2f')]){_0x3ba990[_0xa94a('0x30')]=[{'all':!![]}];}_0x3ba990=_[_0xa94a('0x2c')]({},_0x3ba990,_0x55f414[_0xa94a('0x2e')]);return db[_0xa94a('0x1b')][_0xa94a('0x3a')](_0x3ba990)[_0xa94a('0x11')](handleEntityNotFound(_0x3ff8ad,null))[_0xa94a('0x11')](function(_0x51ca5b){if(_0x51ca5b[_0xa94a('0x33')]===_0xa94a('0x34')){var _0x5c4915=encryptor['decryptString'](_0x51ca5b[_0xa94a('0x36')]);_0x51ca5b[_0xa94a('0x36')]=maskClientSecret(_0x5c4915);}return _0x51ca5b;})[_0xa94a('0x11')](respondWithResult(_0x3ff8ad,null))[_0xa94a('0x37')](handleError(_0x3ff8ad,null));};exports[_0xa94a('0x3b')]=function(_0x54a3ca,_0x56cf18){if(!_0x54a3ca[_0xa94a('0x3c')][_0xa94a('0x15')])throw new Error(_0xa94a('0x3d'));if(!_0x54a3ca['body'][_0xa94a('0x33')])throw new Error(_0xa94a('0x3e'));var _0x3fb72e=db[_0xa94a('0x1b')][_0xa94a('0x1c')][_0xa94a('0x33')]['values'];if(!_0x3fb72e[_0xa94a('0x3f')](_0x54a3ca['body']['service']))throw new Error(_0xa94a('0x40')+_0x3fb72e[_0xa94a('0x41')](',\x20'));if(_0x54a3ca[_0xa94a('0x3c')][_0xa94a('0x33')]===_0xa94a('0x34')&&_0x54a3ca[_0xa94a('0x3c')][_0xa94a('0x36')]){_0x54a3ca[_0xa94a('0x3c')][_0xa94a('0x36')]=encryptor[_0xa94a('0x42')](_0x54a3ca[_0xa94a('0x3c')][_0xa94a('0x36')]);}return db[_0xa94a('0x1b')][_0xa94a('0x3b')](_0x54a3ca['body'],{})[_0xa94a('0x11')](respondWithResult(_0x56cf18,0xc9))[_0xa94a('0x37')](handleError(_0x56cf18,null));};exports['update']=function(_0x5f4ad3,_0x48217a){if(_0x5f4ad3[_0xa94a('0x3c')]['id']){delete _0x5f4ad3[_0xa94a('0x3c')]['id'];}return db[_0xa94a('0x1b')]['find']({'where':{'id':_0x5f4ad3[_0xa94a('0x39')]['id']}})[_0xa94a('0x11')](handleEntityNotFound(_0x48217a,null))['then'](function(_0x587c91){if(_0x587c91[_0xa94a('0x33')]==='MicrosoftAzure'&&_0x5f4ad3[_0xa94a('0x3c')][_0xa94a('0x36')]){_0x5f4ad3['body'][_0xa94a('0x36')]=encryptor[_0xa94a('0x42')](_0x5f4ad3[_0xa94a('0x3c')][_0xa94a('0x36')]);}return _0x587c91;})['then'](saveUpdates(_0x5f4ad3[_0xa94a('0x3c')],null))[_0xa94a('0x11')](respondWithResult(_0x48217a,null))[_0xa94a('0x37')](handleError(_0x48217a,null));};exports[_0xa94a('0x12')]=function(_0x47b5dd,_0x51a28b){return db[_0xa94a('0x1b')][_0xa94a('0x3a')]({'where':{'id':_0x47b5dd['params']['id']}})[_0xa94a('0x11')](handleEntityNotFound(_0x51a28b,null))[_0xa94a('0x11')](removeEntity(_0x51a28b,null))[_0xa94a('0x37')](handleError(_0x51a28b,null));};exports[_0xa94a('0x43')]=function(_0xb2e52a,_0x4a01c9){return db[_0xa94a('0x1b')][_0xa94a('0x44')]({'where':{'id':_0xb2e52a['params']['id']},'raw':!![]})[_0xa94a('0x11')](function(_0x10291c){if(!_0x10291c)return _0x4a01c9[_0xa94a('0x8')](0x194);return{'url':oauth[_0xa94a('0x45')](_0x10291c,_0xb2e52a[_0xa94a('0x46')]['id'])};})[_0xa94a('0x11')](respondWithResult(_0x4a01c9,null))[_0xa94a('0x37')](handleError(_0x4a01c9,null));};exports[_0xa94a('0x47')]=function(_0x4270f9,_0x588fd2){var _0x2c10e0=_0x4270f9[_0xa94a('0x3c')];var _0x47ac30;var _0x210229;if(_0x2c10e0[_0xa94a('0x13')])throw _0x2c10e0;redis[_0xa94a('0x48')](_0x2c10e0[_0xa94a('0x49')])[_0xa94a('0x11')](function(_0x4e3679){if(!_0x4e3679)throw new Error(_0xa94a('0x4a'));_0x47ac30=JSON[_0xa94a('0x4b')](_0x4e3679);var _0x50a750=Buffer[_0xa94a('0x4c')](_0x2c10e0[_0xa94a('0x49')],_0xa94a('0x4d'))['toString'](_0xa94a('0x4e'));_0x210229=JSON['parse'](_0x50a750);if(!oauth[_0xa94a('0x4f')](_0x2c10e0[_0xa94a('0x50')],_0x47ac30['oauth2Claims']))throw new Error(_0xa94a('0x51'));redis[_0xa94a('0x52')](_0x2c10e0['state']);return oauth[_0xa94a('0x53')](_0x2c10e0[_0xa94a('0x54')],_0x47ac30);})[_0xa94a('0x11')](function(_0x3e5ead){_0x47ac30[_0xa94a('0x55')]=_0x3e5ead[_0xa94a('0x56')];_0x47ac30['data6']=_0x3e5ead['refresh_token'];return db[_0xa94a('0x1b')][_0xa94a('0x57')]({'data5':_0x47ac30['data5'],'data6':_0x47ac30['data6']},{'where':{'id':_0x47ac30['id']}});})[_0xa94a('0x11')](function(){oauth[_0xa94a('0x58')](_0x47ac30);socket['emit'](_0xa94a('0x59'),{'id':_0x210229['id']});return;})[_0xa94a('0x11')](respondWithStatusCode(_0x588fd2,null))['catch'](function(_0x105788){if(_0x210229){socket['emit']('microsoftAuthorization:error',{'id':_0x210229['id']});}if(!_0x47ac30){logger[_0xa94a('0x13')](_0xa94a('0x5a'),_0x105788);return _0x588fd2[_0xa94a('0xa')](0x1f4)[_0xa94a('0x16')](_0x105788['message']);}logger['error'](_0xa94a('0x5b'),_0x47ac30['id'],JSON[_0xa94a('0x5c')](_0x105788));});}; \ No newline at end of file +var _0x1e74=['oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','status','json','limit','undefined','count','offset','set','Content-Range','update','then','end','sendStatus','send','map','CloudProvider','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','name','filter','merge','options','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','params','filters','find','body','Name\x20parameter\x20not\x20specified','values','includes','create','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','from','base64','toString','isValidIdToken'];(function(_0x98cc34,_0x45cb6a){var _0x20f0e2=function(_0x391894){while(--_0x391894){_0x98cc34['push'](_0x98cc34['shift']());}};_0x20f0e2(++_0x45cb6a);}(_0x1e74,0x1c1));var _0x41e7=function(_0x23b186,_0x52ba20){_0x23b186=_0x23b186-0x0;var _0x4f7b29=_0x1e74[_0x23b186];return _0x4f7b29;};'use strict';var _=require('lodash');var Redis=require(_0x41e7('0x0'));var qs=require(_0x41e7('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x41e7('0x2'))(_0x41e7('0x3'));var db=require(_0x41e7('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_['defaults'](config[_0x41e7('0x5')],{'host':_0x41e7('0x6'),'port':0x18eb});var socket=require(_0x41e7('0x7'))(new Redis(config[_0x41e7('0x5')]));var redis=new Redis(config[_0x41e7('0x5')]);function respondWithStatusCode(_0x38fcfe,_0x3069ee){_0x3069ee=_0x3069ee||0xcc;return function(_0x44c0f0){if(_0x44c0f0){return _0x38fcfe['sendStatus'](_0x3069ee);}return _0x38fcfe[_0x41e7('0x8')](_0x3069ee)['end']();};}function respondWithResult(_0x14079b,_0x37795e){_0x37795e=_0x37795e||0xc8;return function(_0x4052b6){if(_0x4052b6){return _0x14079b['status'](_0x37795e)[_0x41e7('0x9')](_0x4052b6);}};}function respondWithFilteredResult(_0x10d8bf,_0xac0ddd){return function(_0x1c41ef){if(_0x1c41ef){var _0x55a1e8=typeof _0xac0ddd['offset']==='undefined'&&typeof _0xac0ddd[_0x41e7('0xa')]===_0x41e7('0xb');var _0x4a3b91=_0x1c41ef[_0x41e7('0xc')];var _0x496c54=_0x55a1e8?0x0:_0xac0ddd[_0x41e7('0xd')];var _0xca85b=_0x55a1e8?_0x1c41ef[_0x41e7('0xc')]:_0xac0ddd[_0x41e7('0xd')]+_0xac0ddd[_0x41e7('0xa')];var _0x12424a;if(_0xca85b>=_0x4a3b91){_0xca85b=_0x4a3b91;_0x12424a=0xc8;}else{_0x12424a=0xce;}_0x10d8bf['status'](_0x12424a);return _0x10d8bf[_0x41e7('0xe')](_0x41e7('0xf'),_0x496c54+'-'+_0xca85b+'/'+_0x4a3b91)['json'](_0x1c41ef);}return null;};}function saveUpdates(_0xe12653){return function(_0x5d829b){if(_0x5d829b){return _0x5d829b[_0x41e7('0x10')](_0xe12653)['then'](function(_0x3d3c20){return _0x3d3c20;});}return null;};}function removeEntity(_0x177aee){return function(_0x2cec0c){if(_0x2cec0c){return _0x2cec0c['destroy']()[_0x41e7('0x11')](function(){_0x177aee['status'](0xcc)[_0x41e7('0x12')]();});}};}function handleEntityNotFound(_0x3e0aa4){return function(_0x51d40d){if(!_0x51d40d){_0x3e0aa4[_0x41e7('0x13')](0x194);}return _0x51d40d;};}function handleError(_0x3bd851,_0x1c3726){_0x1c3726=_0x1c3726||0x1f4;return function(_0x11f308){logger['error'](_0x11f308['stack']);if(_0x11f308['name']){delete _0x11f308['name'];}_0x3bd851[_0x41e7('0x8')](_0x1c3726)[_0x41e7('0x14')](_0x11f308);};}function maskClientSecret(_0x26be93){return _['padEnd'](_0x26be93['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x1514ef,_0x51366f){var _0x1ae375={},_0x2e92e5={},_0x16bb4c={'count':0x0,'rows':[]};var _0x18202d=_[_0x41e7('0x15')](db[_0x41e7('0x16')][_0x41e7('0x17')],function(_0x2a5490){return{'name':_0x2a5490['fieldName'],'type':_0x2a5490[_0x41e7('0x18')][_0x41e7('0x19')]};});_0x2e92e5['model']=_[_0x41e7('0x15')](_0x18202d,'name');_0x2e92e5[_0x41e7('0x1a')]=_[_0x41e7('0x1b')](_0x1514ef[_0x41e7('0x1a')]);_0x2e92e5['filters']=_[_0x41e7('0x1c')](_0x2e92e5[_0x41e7('0x1d')],_0x2e92e5[_0x41e7('0x1a')]);_0x1ae375[_0x41e7('0x1e')]=_[_0x41e7('0x1c')](_0x2e92e5[_0x41e7('0x1d')],qs['fields'](_0x1514ef[_0x41e7('0x1a')][_0x41e7('0x1f')]));_0x1ae375[_0x41e7('0x1e')]=_0x1ae375[_0x41e7('0x1e')][_0x41e7('0x20')]?_0x1ae375[_0x41e7('0x1e')]:_0x2e92e5[_0x41e7('0x1d')];if(!_0x1514ef[_0x41e7('0x1a')][_0x41e7('0x21')](_0x41e7('0x22'))){_0x1ae375['limit']=qs['limit'](_0x1514ef[_0x41e7('0x1a')][_0x41e7('0xa')]);_0x1ae375[_0x41e7('0xd')]=qs[_0x41e7('0xd')](_0x1514ef[_0x41e7('0x1a')][_0x41e7('0xd')]);}_0x1ae375['order']=qs[_0x41e7('0x23')](_0x1514ef[_0x41e7('0x1a')][_0x41e7('0x23')]);_0x1ae375[_0x41e7('0x24')]=qs['filters'](_[_0x41e7('0x25')](_0x1514ef[_0x41e7('0x1a')],_0x2e92e5['filters']),_0x18202d);if(_0x1514ef[_0x41e7('0x1a')]['filter']){_0x1ae375['where']=_['merge'](_0x1ae375[_0x41e7('0x24')],{'$or':_['map'](_0x18202d,function(_0x1180de){if(_0x1180de['type']!==_0x41e7('0x26')){var _0x4cd4e7={};_0x4cd4e7[_0x1180de[_0x41e7('0x27')]]={'$like':'%'+_0x1514ef[_0x41e7('0x1a')][_0x41e7('0x28')]+'%'};return _0x4cd4e7;}})});}_0x1ae375=_[_0x41e7('0x29')]({},_0x1ae375,_0x1514ef[_0x41e7('0x2a')]);var _0x3c957d={'where':_0x1ae375[_0x41e7('0x24')]};return db[_0x41e7('0x16')][_0x41e7('0xc')](_0x3c957d)[_0x41e7('0x11')](function(_0x44b3c4){_0x16bb4c[_0x41e7('0xc')]=_0x44b3c4;if(_0x1514ef[_0x41e7('0x1a')][_0x41e7('0x2b')]){_0x1ae375[_0x41e7('0x2c')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x1ae375);})[_0x41e7('0x11')](function(_0x33e4c6){_0x16bb4c[_0x41e7('0x2d')]=_[_0x41e7('0x15')](_0x33e4c6,function(_0x3303bf){if(_0x3303bf[_0x41e7('0x2e')]===_0x41e7('0x2f')){var _0x27c80e=encryptor[_0x41e7('0x30')](_0x3303bf[_0x41e7('0x31')]);_0x3303bf[_0x41e7('0x31')]=maskClientSecret(_0x27c80e);}return _0x3303bf;});return _0x16bb4c;})['then'](respondWithFilteredResult(_0x51366f,_0x1ae375))[_0x41e7('0x32')](handleError(_0x51366f,null));};exports['show']=function(_0x3fad20,_0x2cbdf7){var _0x5f1129={'raw':!![],'where':{'id':_0x3fad20[_0x41e7('0x33')]['id']}},_0x3a6787={};_0x3a6787[_0x41e7('0x1d')]=_['keys'](db[_0x41e7('0x16')][_0x41e7('0x17')]);_0x3a6787[_0x41e7('0x1a')]=_[_0x41e7('0x1b')](_0x3fad20['query']);_0x3a6787[_0x41e7('0x34')]=_[_0x41e7('0x1c')](_0x3a6787[_0x41e7('0x1d')],_0x3a6787['query']);_0x5f1129[_0x41e7('0x1e')]=_[_0x41e7('0x1c')](_0x3a6787[_0x41e7('0x1d')],qs[_0x41e7('0x1f')](_0x3fad20[_0x41e7('0x1a')]['fields']));_0x5f1129[_0x41e7('0x1e')]=_0x5f1129[_0x41e7('0x1e')][_0x41e7('0x20')]?_0x5f1129[_0x41e7('0x1e')]:_0x3a6787[_0x41e7('0x1d')];if(_0x3fad20[_0x41e7('0x1a')]['includeAll']){_0x5f1129['include']=[{'all':!![]}];}_0x5f1129=_[_0x41e7('0x29')]({},_0x5f1129,_0x3fad20[_0x41e7('0x2a')]);return db['CloudProvider'][_0x41e7('0x35')](_0x5f1129)[_0x41e7('0x11')](handleEntityNotFound(_0x2cbdf7,null))[_0x41e7('0x11')](function(_0x48764e){if(_0x48764e['service']===_0x41e7('0x2f')){var _0x355d50=encryptor[_0x41e7('0x30')](_0x48764e['data3']);_0x48764e[_0x41e7('0x31')]=maskClientSecret(_0x355d50);}return _0x48764e;})['then'](respondWithResult(_0x2cbdf7,null))[_0x41e7('0x32')](handleError(_0x2cbdf7,null));};exports['create']=function(_0x45bde3,_0x43bf0f){if(!_0x45bde3[_0x41e7('0x36')][_0x41e7('0x27')])throw new Error(_0x41e7('0x37'));if(!_0x45bde3['body'][_0x41e7('0x2e')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x1ebc3f=db[_0x41e7('0x16')][_0x41e7('0x17')][_0x41e7('0x2e')][_0x41e7('0x38')];if(!_0x1ebc3f[_0x41e7('0x39')](_0x45bde3['body']['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x1ebc3f['join'](',\x20'));if(_0x45bde3[_0x41e7('0x36')][_0x41e7('0x2e')]===_0x41e7('0x2f')&&_0x45bde3[_0x41e7('0x36')][_0x41e7('0x31')]){_0x45bde3[_0x41e7('0x36')]['data3']=encryptor['encryptString'](_0x45bde3[_0x41e7('0x36')][_0x41e7('0x31')]);}return db[_0x41e7('0x16')][_0x41e7('0x3a')](_0x45bde3[_0x41e7('0x36')],{})['then'](respondWithResult(_0x43bf0f,0xc9))[_0x41e7('0x32')](handleError(_0x43bf0f,null));};exports[_0x41e7('0x10')]=function(_0x504d42,_0x544b2d){if(_0x504d42['body']['id']){delete _0x504d42['body']['id'];}return db[_0x41e7('0x16')][_0x41e7('0x35')]({'where':{'id':_0x504d42['params']['id']}})[_0x41e7('0x11')](handleEntityNotFound(_0x544b2d,null))['then'](function(_0x47a733){if(_0x47a733['service']===_0x41e7('0x2f')&&_0x504d42[_0x41e7('0x36')][_0x41e7('0x31')]){_0x504d42['body'][_0x41e7('0x31')]=encryptor[_0x41e7('0x3b')](_0x504d42[_0x41e7('0x36')][_0x41e7('0x31')]);}return _0x47a733;})[_0x41e7('0x11')](saveUpdates(_0x504d42[_0x41e7('0x36')],null))['then'](respondWithResult(_0x544b2d,null))[_0x41e7('0x32')](handleError(_0x544b2d,null));};exports[_0x41e7('0x3c')]=function(_0x149a5a,_0xb410c){return db[_0x41e7('0x16')][_0x41e7('0x35')]({'where':{'id':_0x149a5a['params']['id']}})[_0x41e7('0x11')](handleEntityNotFound(_0xb410c,null))['then'](removeEntity(_0xb410c,null))[_0x41e7('0x32')](handleError(_0xb410c,null));};exports[_0x41e7('0x3d')]=function(_0x49180f,_0x3f82e9){return db[_0x41e7('0x16')][_0x41e7('0x3e')]({'where':{'id':_0x49180f[_0x41e7('0x33')]['id']},'raw':!![]})['then'](function(_0x3e8075){if(!_0x3e8075)return _0x3f82e9[_0x41e7('0x13')](0x194);return{'url':oauth[_0x41e7('0x3f')](_0x3e8075,_0x49180f[_0x41e7('0x40')]['id'])};})['then'](respondWithResult(_0x3f82e9,null))[_0x41e7('0x32')](handleError(_0x3f82e9,null));};exports[_0x41e7('0x41')]=function(_0x5bdce5,_0x431668){var _0xd457be=_0x5bdce5[_0x41e7('0x36')];var _0x54a480;var _0x5be0c3;if(_0xd457be[_0x41e7('0x42')])throw _0xd457be;redis['get'](_0xd457be[_0x41e7('0x43')])[_0x41e7('0x11')](function(_0x866961){if(!_0x866961)throw new Error(_0x41e7('0x44'));_0x54a480=JSON['parse'](_0x866961);var _0x37db4c=Buffer[_0x41e7('0x45')](_0xd457be['state'],_0x41e7('0x46'))[_0x41e7('0x47')]('ascii');_0x5be0c3=JSON['parse'](_0x37db4c);if(!oauth[_0x41e7('0x48')](_0xd457be['id_token'],_0x54a480[_0x41e7('0x49')]))throw new Error(_0x41e7('0x4a'));redis['del'](_0xd457be['state']);return oauth['getOauth2MicrosoftAccessToken'](_0xd457be[_0x41e7('0x4b')],_0x54a480);})[_0x41e7('0x11')](function(_0x60f150){_0x54a480[_0x41e7('0x4c')]=_0x60f150[_0x41e7('0x4d')];_0x54a480[_0x41e7('0x4e')]=_0x60f150[_0x41e7('0x4f')];return db[_0x41e7('0x16')][_0x41e7('0x10')]({'data5':_0x54a480[_0x41e7('0x4c')],'data6':_0x54a480[_0x41e7('0x4e')]},{'where':{'id':_0x54a480['id']}});})[_0x41e7('0x11')](function(){oauth[_0x41e7('0x50')](_0x54a480);socket[_0x41e7('0x51')](_0x41e7('0x52'),{'id':_0x5be0c3['id']});return;})[_0x41e7('0x11')](respondWithStatusCode(_0x431668,null))[_0x41e7('0x32')](function(_0x5490a1){if(_0x5be0c3){socket[_0x41e7('0x51')]('microsoftAuthorization:error',{'id':_0x5be0c3['id']});}if(!_0x54a480){logger[_0x41e7('0x42')](_0x41e7('0x53'),_0x5490a1);return _0x431668[_0x41e7('0x8')](0x1f4)['send'](_0x5490a1[_0x41e7('0x54')]);}logger[_0x41e7('0x42')](_0x41e7('0x55'),_0x54a480['id'],JSON[_0x41e7('0x56')](_0x5490a1));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2a5f02e..c7590af 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 _0x3f65=['cloud_providers','util','../../config/logger','api','bluebird','path','rimraf','./cloudProvider.attributes','exports','CloudProvider'];(function(_0x552d11,_0x1f9ff6){var _0x11d77e=function(_0x1b0366){while(--_0x1b0366){_0x552d11['push'](_0x552d11['shift']());}};_0x11d77e(++_0x1f9ff6);}(_0x3f65,0xc9));var _0x53f6=function(_0x379bb2,_0x5ad606){_0x379bb2=_0x379bb2-0x0;var _0x1b164d=_0x3f65[_0x379bb2];return _0x1b164d;};'use strict';var _=require('lodash');var util=require(_0x53f6('0x0'));var logger=require(_0x53f6('0x1'))(_0x53f6('0x2'));var moment=require('moment');var BPromise=require(_0x53f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53f6('0x4'));var rimraf=require(_0x53f6('0x5'));var config=require('../../config/environment');var attributes=require(_0x53f6('0x6'));module[_0x53f6('0x7')]=function(_0x31c09e,_0x4bda92){return _0x31c09e['define'](_0x53f6('0x8'),attributes,{'tableName':_0x53f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf8=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','util','../../config/logger'];(function(_0x26f427,_0x19855d){var _0x39e1fd=function(_0x36de34){while(--_0x36de34){_0x26f427['push'](_0x26f427['shift']());}};_0x39e1fd(++_0x19855d);}(_0xdbf8,0x1b5));var _0x8dbf=function(_0x49b00c,_0x3e34f5){_0x49b00c=_0x49b00c-0x0;var _0x348b93=_0xdbf8[_0x49b00c];return _0x348b93;};'use strict';var _=require(_0x8dbf('0x0'));var util=require(_0x8dbf('0x1'));var logger=require(_0x8dbf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8dbf('0x3'));var rp=require(_0x8dbf('0x4'));var fs=require('fs');var path=require(_0x8dbf('0x5'));var rimraf=require(_0x8dbf('0x6'));var config=require(_0x8dbf('0x7'));var attributes=require(_0x8dbf('0x8'));module[_0x8dbf('0x9')]=function(_0x3f3bf5,_0x56cdb7){return _0x3f3bf5['define']('CloudProvider',attributes,{'tableName':_0x8dbf('0xa'),'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 770374c..750f0e5 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 _0xda1a=['profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type','Dynamics365','push','data7','join','Outlook365','{TENANT_ID}','data2','id_token','stringify','toString','base64','randomBytes','hex','data1','data4','response_mode','scope','state','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','decode','iss','issuer','aud','audience','unix','exp','resolve','then','data3','CloudProvider','findOne','data6','data5','access_token','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','findAll','inspect','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid'];(function(_0x1604b0,_0x48d196){var _0xf7ee7e=function(_0x368052){while(--_0x368052){_0x1604b0['push'](_0x1604b0['shift']());}};_0xf7ee7e(++_0x48d196);}(_0xda1a,0x8a));var _0xada1=function(_0x27a019,_0x4a6930){_0x27a019=_0x27a019-0x0;var _0x3dc099=_0xda1a[_0x27a019];return _0x3dc099;};'use strict';var _=require(_0xada1('0x0'));var crypto=require('crypto');var jwt=require(_0xada1('0x1'));var moment=require(_0xada1('0x2'));var Redis=require(_0xada1('0x3'));var rp=require(_0xada1('0x4'));var util=require(_0xada1('0x5'));var encryptor=require(_0xada1('0x6'));var config=require(_0xada1('0x7'));var logger=require(_0xada1('0x8'))(_0xada1('0x9'));var schedule=require(_0xada1('0xa'));var db=require(_0xada1('0xb'))['db'];config['redis']=_[_0xada1('0xc')](config['redis'],{'host':_0xada1('0xd'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xada1('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xada1('0xf'),_0xada1('0x10'),_0xada1('0x11'),_0xada1('0x12'),_0xada1('0x13'),_0xada1('0x14'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xada1('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0xada1('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xc88740){var _0x549449=_[_0xada1('0x17')](AZURE_AUTH_SCOPES[_0xc88740[_0xada1('0x18')]]);if(_0xc88740['type']===_0xada1('0x19'))_0x549449[_0xada1('0x1a')](_0xc88740[_0xada1('0x1b')]+'/.default');return _0x549449[_0xada1('0x1c')]('\x20');}function getAccessTokenScope(_0x14edb8){if(_0x14edb8[_0xada1('0x18')]===_0xada1('0x1d'))return _0xada1('0x13');if(_0x14edb8[_0xada1('0x18')]===_0xada1('0x19'))return _0x14edb8[_0xada1('0x1b')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x367df9,_0x50f6c0){var _0x13cd74=MICROSOFT_AUTH_URL['replace'](_0xada1('0x1e'),_0x367df9[_0xada1('0x1f')]);var _0x15539d=['code',_0xada1('0x20')];var _0x47b53c=Buffer['from'](JSON[_0xada1('0x21')]({'id':_0x50f6c0}))[_0xada1('0x22')](_0xada1('0x23'));var _0x2f9a93=crypto[_0xada1('0x24')](0x10)[_0xada1('0x22')](_0xada1('0x25'));var _0x3d40f4=getAuthorizationScopes(_0x367df9);var _0x2dc6f9=[{'key':'client_id','value':_0x367df9[_0xada1('0x26')]},{'key':'response_type','value':encodeURIComponent(_0x15539d[_0xada1('0x1c')]('\x20'))},{'key':'redirect_uri','value':_0x367df9[_0xada1('0x27')]},{'key':_0xada1('0x28'),'value':'form_post'},{'key':_0xada1('0x29'),'value':encodeURIComponent(_0x3d40f4)},{'key':_0xada1('0x2a'),'value':_0x47b53c},{'key':_0xada1('0x2b'),'value':_0x2f9a93},{'key':_0xada1('0x2c'),'value':_0xada1('0x2d')}];var _0x27e700=_0x13cd74+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2dc6f9,function(_0x35d64e){return _0x35d64e[_0xada1('0x2e')]+'='+_0x35d64e[_0xada1('0x2f')];})['join']('&');_0x367df9[_0xada1('0x30')]={'issuer':_0x13cd74[_0xada1('0x31')](_0xada1('0x32'),''),'audience':_0x367df9[_0xada1('0x26')],'state':_0x47b53c,'nonce':_0x2f9a93};redis['set'](_0x47b53c,JSON[_0xada1('0x21')](_0x367df9));return _0x27e700;}function isValidIdToken(_0x1a5148,_0x1145d9){try{var _0x30734a=jwt[_0xada1('0x33')](_0x1a5148,{'complete':!![]});var _0x2c81fe=_0x30734a['payload'];if(_0x2c81fe[_0xada1('0x34')]!==_0x1145d9[_0xada1('0x35')])return![];if(_0x2c81fe[_0xada1('0x36')]!==_0x1145d9[_0xada1('0x37')])return![];if(_0x2c81fe[_0xada1('0x2b')]!==_0x1145d9['nonce'])return![];if(moment()['isAfter'](moment[_0xada1('0x38')](_0x2c81fe[_0xada1('0x39')])))return![];return!![];}catch(_0x2f548d){throw _0x2f548d;}}function refreshOauth2MicrosoftAccessToken(_0xb20fa3){return Promise[_0xada1('0x3a')]()[_0xada1('0x3b')](function(){if(_0xb20fa3[_0xada1('0x3c')])return _0xb20fa3;return db[_0xada1('0x3d')][_0xada1('0x3e')]({'where':{'id':_0xb20fa3['id']},'raw':!![]});})[_0xada1('0x3b')](function(_0xf8a373){var _0x572567={'grant_type':'refresh_token','refresh_token':_0xf8a373[_0xada1('0x3f')],'scope':getAccessTokenScope(_0xf8a373),'redirect_uri':_0xf8a373[_0xada1('0x27')],'client_id':_0xf8a373[_0xada1('0x26')],'client_secret':encryptor['decryptString'](_0xf8a373[_0xada1('0x3c')])};var _0x27480f={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xada1('0x31')]('{TENANT_ID}',_0xf8a373['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x572567,'json':!![]};return rp(_0x27480f);})[_0xada1('0x3b')](function(_0x2944ed){_0xb20fa3[_0xada1('0x40')]=_0x2944ed[_0xada1('0x41')];_0xb20fa3[_0xada1('0x3f')]=_0x2944ed[_0xada1('0x42')];return db[_0xada1('0x3d')][_0xada1('0x43')]({'data5':_0xb20fa3[_0xada1('0x40')],'data6':_0xb20fa3[_0xada1('0x3f')]},{'where':{'id':_0xb20fa3['id']}});})[_0xada1('0x3b')](function(){return _0xb20fa3;})[_0xada1('0x44')](function(_0x27eafd){logger[_0xada1('0x45')](_0xada1('0x46'),_0xb20fa3['id'],_0x27eafd);});}function getOauth2MicrosoftAccessToken(_0x954963,_0xc6e736){var _0xbc1dd8={'grant_type':_0xada1('0x47'),'code':_0x954963,'scope':getAccessTokenScope(_0xc6e736),'redirect_uri':_0xc6e736[_0xada1('0x27')],'client_id':_0xc6e736[_0xada1('0x26')],'client_secret':encryptor[_0xada1('0x48')](_0xc6e736[_0xada1('0x3c')])};var _0x6cb595={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xada1('0x31')]('{TENANT_ID}',_0xc6e736['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xbc1dd8,'json':!![]};return rp(_0x6cb595);}function startRefreshInterval(_0x2f020c){var _0x322f73=schedule[_0xada1('0x49')];if(_0x322f73[_0x2f020c['id']])clearInterval(_0x322f73[_0x2f020c['id']]);_0x322f73[_0x2f020c['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x2f020c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xada1('0x49')]=_0x322f73;}function startAllRefreshIntervals(){return db[_0xada1('0x3d')][_0xada1('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xada1('0x3b')](function(_0x55ffc8){var _0x3f81a1=_0x55ffc8[_0xada1('0x17')](function(_0xbf035d){return refreshOauth2MicrosoftAccessToken(_0xbf035d)[_0xada1('0x3b')](function(_0x522640){startRefreshInterval(_0x522640);});});return Promise['all'](_0x3f81a1);})[_0xada1('0x44')](function(_0x46155f){var _0x1c3ecd=_0x46155f?util[_0xada1('0x4b')](_0x46155f,{'showHidden':![],'depth':null}):'';logger[_0xada1('0x45')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x1c3ecd);});}module[_0xada1('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x6df8=['https://outlook.office.com/SMTP.Send','type','Dynamics365','data7','/.default','replace','{TENANT_ID}','data2','id_token','stringify','toString','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','map','oauth2/','set','decode','payload','iss','issuer','audience','isAfter','unix','exp','then','CloudProvider','findOne','refresh_token','decryptString','data5','access_token','data6','catch','error','data3','POST','intervals','bind','all','exports','lodash','crypto','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6df8,0x142));var _0x86df=function(_0x4d1fc5,_0x21d2f5){_0x4d1fc5=_0x4d1fc5-0x0;var _0x397db6=_0x6df8[_0x4d1fc5];return _0x397db6;};'use strict';var _=require(_0x86df('0x0'));var crypto=require(_0x86df('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x86df('0x2'));var Redis=require(_0x86df('0x3'));var rp=require(_0x86df('0x4'));var util=require('util');var encryptor=require(_0x86df('0x5'));var config=require(_0x86df('0x6'));var logger=require(_0x86df('0x7'))('api');var schedule=require(_0x86df('0x8'));var db=require(_0x86df('0x9'))['db'];config[_0x86df('0xa')]=_[_0x86df('0xb')](config[_0x86df('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x86df('0xa')]);var MICROSOFT_AUTH_URL=_0x86df('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x86df('0xd'),_0x86df('0xe'),_0x86df('0xf'),_0x86df('0x10'),_0x86df('0x11'),_0x86df('0x12')],'Dynamics365':['openid',_0x86df('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4c3c04){var _0x4d38ca=_['map'](AZURE_AUTH_SCOPES[_0x4c3c04[_0x86df('0x13')]]);if(_0x4c3c04[_0x86df('0x13')]==='Dynamics365')_0x4d38ca['push'](_0x4c3c04['data7']+'/.default');return _0x4d38ca['join']('\x20');}function getAccessTokenScope(_0x1594b3){if(_0x1594b3[_0x86df('0x13')]==='Outlook365')return _0x86df('0x10');if(_0x1594b3['type']===_0x86df('0x14'))return _0x1594b3[_0x86df('0x15')]+_0x86df('0x16');}function generateMicrosoftAuthorizationUrl(_0x3164b2,_0x87a48e){var _0x55edb7=MICROSOFT_AUTH_URL[_0x86df('0x17')](_0x86df('0x18'),_0x3164b2[_0x86df('0x19')]);var _0x3aa574=['code',_0x86df('0x1a')];var _0x158456=Buffer['from'](JSON[_0x86df('0x1b')]({'id':_0x87a48e}))[_0x86df('0x1c')]('base64');var _0x15a810=crypto['randomBytes'](0x10)['toString']('hex');var _0x4ec8f9=getAuthorizationScopes(_0x3164b2);var _0x4277d5=[{'key':_0x86df('0x1d'),'value':_0x3164b2[_0x86df('0x1e')]},{'key':_0x86df('0x1f'),'value':encodeURIComponent(_0x3aa574[_0x86df('0x20')]('\x20'))},{'key':_0x86df('0x21'),'value':_0x3164b2[_0x86df('0x22')]},{'key':_0x86df('0x23'),'value':_0x86df('0x24')},{'key':_0x86df('0x25'),'value':encodeURIComponent(_0x4ec8f9)},{'key':_0x86df('0x26'),'value':_0x158456},{'key':_0x86df('0x27'),'value':_0x15a810},{'key':_0x86df('0x28'),'value':'login'}];var _0x393ec1=_0x55edb7+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x86df('0x29')](_0x4277d5,function(_0x433d22){return _0x433d22['key']+'='+_0x433d22['value'];})[_0x86df('0x20')]('&');_0x3164b2['oauth2Claims']={'issuer':_0x55edb7['replace'](_0x86df('0x2a'),''),'audience':_0x3164b2[_0x86df('0x1e')],'state':_0x158456,'nonce':_0x15a810};redis[_0x86df('0x2b')](_0x158456,JSON['stringify'](_0x3164b2));return _0x393ec1;}function isValidIdToken(_0x27d82d,_0x3f232b){try{var _0x16279f=jwt[_0x86df('0x2c')](_0x27d82d,{'complete':!![]});var _0xf5a5c0=_0x16279f[_0x86df('0x2d')];if(_0xf5a5c0[_0x86df('0x2e')]!==_0x3f232b[_0x86df('0x2f')])return![];if(_0xf5a5c0['aud']!==_0x3f232b[_0x86df('0x30')])return![];if(_0xf5a5c0['nonce']!==_0x3f232b[_0x86df('0x27')])return![];if(moment()[_0x86df('0x31')](moment[_0x86df('0x32')](_0xf5a5c0[_0x86df('0x33')])))return![];return!![];}catch(_0x48b7f7){throw _0x48b7f7;}}function refreshOauth2MicrosoftAccessToken(_0x2f889d){return Promise['resolve']()[_0x86df('0x34')](function(){if(_0x2f889d['data3'])return _0x2f889d;return db[_0x86df('0x35')][_0x86df('0x36')]({'where':{'id':_0x2f889d['id']},'raw':!![]});})[_0x86df('0x34')](function(_0x239e9e){var _0x5624a0={'grant_type':_0x86df('0x37'),'refresh_token':_0x239e9e['data6'],'scope':getAccessTokenScope(_0x239e9e),'redirect_uri':_0x239e9e[_0x86df('0x22')],'client_id':_0x239e9e[_0x86df('0x1e')],'client_secret':encryptor[_0x86df('0x38')](_0x239e9e['data3'])};var _0x56d512={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x86df('0x17')](_0x86df('0x18'),_0x239e9e[_0x86df('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5624a0,'json':!![]};return rp(_0x56d512);})['then'](function(_0x262289){_0x2f889d[_0x86df('0x39')]=_0x262289[_0x86df('0x3a')];_0x2f889d['data6']=_0x262289['refresh_token'];return db['CloudProvider']['update']({'data5':_0x2f889d[_0x86df('0x39')],'data6':_0x2f889d[_0x86df('0x3b')]},{'where':{'id':_0x2f889d['id']}});})['then'](function(){return _0x2f889d;})[_0x86df('0x3c')](function(_0x69097f){logger[_0x86df('0x3d')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x2f889d['id'],_0x69097f);});}function getOauth2MicrosoftAccessToken(_0x50d888,_0x4f17b5){var _0x1f226f={'grant_type':'authorization_code','code':_0x50d888,'scope':getAccessTokenScope(_0x4f17b5),'redirect_uri':_0x4f17b5[_0x86df('0x22')],'client_id':_0x4f17b5['data1'],'client_secret':encryptor[_0x86df('0x38')](_0x4f17b5[_0x86df('0x3e')])};var _0x2f90f6={'method':_0x86df('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x86df('0x17')]('{TENANT_ID}',_0x4f17b5[_0x86df('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1f226f,'json':!![]};return rp(_0x2f90f6);}function startRefreshInterval(_0x89249e){var _0x5e10ef=schedule[_0x86df('0x40')];if(_0x5e10ef[_0x89249e['id']])clearInterval(_0x5e10ef[_0x89249e['id']]);_0x5e10ef[_0x89249e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x86df('0x41')](this,{'id':_0x89249e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x86df('0x40')]=_0x5e10ef;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x86df('0x34')](function(_0x10bf58){var _0x4f064a=_0x10bf58[_0x86df('0x29')](function(_0x24dcaa){return refreshOauth2MicrosoftAccessToken(_0x24dcaa)['then'](function(_0x444e05){startRefreshInterval(_0x444e05);});});return Promise[_0x86df('0x42')](_0x4f064a);})[_0x86df('0x3c')](function(_0x29f1d8){var _0x31bd7e=_0x29f1d8?util['inspect'](_0x29f1d8,{'showHidden':![],'depth':null}):'';logger[_0x86df('0x3d')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x31bd7e);});}module[_0x86df('0x43')]={'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 f60ae5c..9c00f05 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 _0x58cc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4fde9a,_0x5d1eda){var _0x58f321=function(_0x278061){while(--_0x278061){_0x4fde9a['push'](_0x4fde9a['shift']());}};_0x58f321(++_0x5d1eda);}(_0x58cc,0x7a));var _0xc58c=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x58cc[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0xc58c('0x0'));var util=require(_0xc58c('0x1'));var moment=require(_0xc58c('0x2'));var BPromise=require(_0xc58c('0x3'));var rs=require(_0xc58c('0x4'));var fs=require('fs');var Redis=require(_0xc58c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc58c('0x6'));var logger=require(_0xc58c('0x7'))(_0xc58c('0x8'));var config=require(_0xc58c('0x9'));var jayson=require(_0xc58c('0xa'));var client=jayson[_0xc58c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f1b4e,_0x448646,_0x282354){return new BPromise(function(_0x48a9f4,_0x184b6d){return client[_0xc58c('0xc')](_0x4f1b4e,_0x282354)['then'](function(_0x248c8c){logger['info'](_0xc58c('0xd'),_0x448646,_0xc58c('0xe'));logger[_0xc58c('0xf')](_0xc58c('0x10'),_0x448646,_0xc58c('0xe'),JSON[_0xc58c('0x11')](_0x248c8c));if(_0x248c8c['error']){if(_0x248c8c[_0xc58c('0x12')][_0xc58c('0x13')]===0x1f4){logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0x248c8c[_0xc58c('0x12')][_0xc58c('0x14')]);return _0x184b6d(_0x248c8c[_0xc58c('0x12')][_0xc58c('0x14')]);}logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0x248c8c['error'][_0xc58c('0x14')]);return _0x48a9f4(_0x248c8c['error'][_0xc58c('0x14')]);}else{logger[_0xc58c('0x15')](_0xc58c('0xd'),_0x448646,_0xc58c('0xe'));_0x48a9f4(_0x248c8c[_0xc58c('0x16')][_0xc58c('0x14')]);}})[_0xc58c('0x17')](function(_0xf1601f){logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0xf1601f);_0x184b6d(_0xf1601f);});});} \ No newline at end of file +var _0x65c9=['then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0x65c9,0x182));var _0x965c=function(_0x37408e,_0xacc802){_0x37408e=_0x37408e-0x0;var _0x59ef3a=_0x65c9[_0x37408e];return _0x59ef3a;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var moment=require('moment');var BPromise=require(_0x965c('0x2'));var rs=require(_0x965c('0x3'));var fs=require('fs');var Redis=require(_0x965c('0x4'));var db=require(_0x965c('0x5'))['db'];var utils=require(_0x965c('0x6'));var logger=require(_0x965c('0x7'))(_0x965c('0x8'));var config=require(_0x965c('0x9'));var jayson=require(_0x965c('0xa'));var client=jayson[_0x965c('0xb')][_0x965c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x849260,_0x5ec702,_0xd19e57){return new BPromise(function(_0x263652,_0x41d248){return client[_0x965c('0xd')](_0x849260,_0xd19e57)[_0x965c('0xe')](function(_0x26d859){logger[_0x965c('0xf')]('CloudProvider,\x20%s,\x20%s',_0x5ec702,_0x965c('0x10'));logger[_0x965c('0x11')](_0x965c('0x12'),_0x5ec702,_0x965c('0x10'),JSON[_0x965c('0x13')](_0x26d859));if(_0x26d859[_0x965c('0x14')]){if(_0x26d859[_0x965c('0x14')][_0x965c('0x15')]===0x1f4){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x41d248(_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);}logger['error'](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x263652(_0x26d859['error'][_0x965c('0x17')]);}else{logger[_0x965c('0xf')](_0x965c('0x16'),_0x5ec702,'request\x20sent');_0x263652(_0x26d859[_0x965c('0x18')]['message']);}})['catch'](function(_0x542499){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x542499);_0x41d248(_0x542499);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 29938eb..ad00337 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x27d7ae,_0x1fa145){var _0x3f77ba=function(_0x12c98a){while(--_0x12c98a){_0x27d7ae['push'](_0x27d7ae['shift']());}};_0x3f77ba(++_0x1fa145);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x42421d,_0x1039d8){var _0x33310c=function(_0x2cfa5f){while(--_0x2cfa5f){_0x42421d['push'](_0x42421d['shift']());}};_0x33310c(++_0x1039d8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b95f304..6b1c15f 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 _0xa5cf=['sequelize','exports','STRING'];(function(_0x1b1397,_0x3556f0){var _0x514230=function(_0x35b7f0){while(--_0x35b7f0){_0x1b1397['push'](_0x1b1397['shift']());}};_0x514230(++_0x3556f0);}(_0xa5cf,0x12c));var _0xfa5c=function(_0x94e649,_0x2bdfa6){_0x94e649=_0x94e649-0x0;var _0x4e1281=_0xa5cf[_0x94e649];return _0x4e1281;};'use strict';var Sequelize=require(_0xfa5c('0x0'));module[_0xfa5c('0x1')]={'name':{'type':Sequelize[_0xfa5c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfa5c('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xfa5c('0x2')]},'phone':{'type':Sequelize[_0xfa5c('0x2')]},'fax':{'type':Sequelize[_0xfa5c('0x2')]},'type':{'type':Sequelize[_0xfa5c('0x2')]},'street':{'type':Sequelize[_0xfa5c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfa5c('0x2')]},'country':{'type':Sequelize[_0xfa5c('0x2')]},'email':{'type':Sequelize[_0xfa5c('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfa5c('0x2')]},'sStreet':{'type':Sequelize[_0xfa5c('0x2')]},'sPostalCode':{'type':Sequelize[_0xfa5c('0x2')]},'sCity':{'type':Sequelize[_0xfa5c('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfa5c('0x2')]}}; \ No newline at end of file +var _0x1a98=['sequelize','exports','STRING'];(function(_0x2ec6bb,_0x1bb9a4){var _0x517086=function(_0x58ef92){while(--_0x58ef92){_0x2ec6bb['push'](_0x2ec6bb['shift']());}};_0x517086(++_0x1bb9a4);}(_0x1a98,0xd5));var _0x81a9=function(_0x40a740,_0x5e1944){_0x40a740=_0x40a740-0x0;var _0x2b5bbb=_0x1a98[_0x40a740];return _0x2b5bbb;};'use strict';var Sequelize=require(_0x81a9('0x0'));module[_0x81a9('0x1')]={'name':{'type':Sequelize[_0x81a9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x81a9('0x2')]},'companyId':{'type':Sequelize[_0x81a9('0x2')]},'website':{'type':Sequelize[_0x81a9('0x2')]},'phone':{'type':Sequelize[_0x81a9('0x2')]},'fax':{'type':Sequelize[_0x81a9('0x2')]},'type':{'type':Sequelize[_0x81a9('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x81a9('0x2')]},'city':{'type':Sequelize[_0x81a9('0x2')]},'country':{'type':Sequelize[_0x81a9('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x81a9('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x81a9('0x2')]},'sCity':{'type':Sequelize[_0x81a9('0x2')]},'sCountry':{'type':Sequelize[_0x81a9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index bdd46df..b3b8483 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 _0xf70e=['UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','getContacts','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','Companies','destroy','end','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','rows','catch','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x170b2e,_0x4cbf4e){var _0x4a65e7=function(_0x488a72){while(--_0x488a72){_0x170b2e['push'](_0x170b2e['shift']());}};_0x4a65e7(++_0x4cbf4e);}(_0xf70e,0xfe));var _0xef70=function(_0x552c27,_0x478dc2){_0x552c27=_0x552c27-0x0;var _0x2a0922=_0xf70e[_0x552c27];return _0x2a0922;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef70('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef70('0x1'));var moment=require(_0xef70('0x2'));var BPromise=require(_0xef70('0x3'));var Mustache=require('mustache');var util=require(_0xef70('0x4'));var path=require(_0xef70('0x5'));var sox=require(_0xef70('0x6'));var csv=require(_0xef70('0x7'));var ejs=require(_0xef70('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xef70('0x9'));var jsforce=require(_0xef70('0xa'));var deskjs=require(_0xef70('0xb'));var toCsv=require(_0xef70('0x7'));var querystring=require(_0xef70('0xc'));var Papa=require(_0xef70('0xd'));var Redis=require(_0xef70('0xe'));var authService=require(_0xef70('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xef70('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef70('0x11'))(_0xef70('0x12'));var utils=require('../../config/utils');var config=require(_0xef70('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xef70('0x14'))['db'];function respondWithStatusCode(_0x14412f,_0x3636a9){_0x3636a9=_0x3636a9||0xcc;return function(_0xcf7bca){if(_0xcf7bca){return _0x14412f[_0xef70('0x15')](_0x3636a9);}return _0x14412f[_0xef70('0x16')](_0x3636a9)['end']();};}function respondWithResult(_0x1e6131,_0x35c8b6){_0x35c8b6=_0x35c8b6||0xc8;return function(_0x5435d6){if(_0x5435d6){return _0x1e6131[_0xef70('0x16')](_0x35c8b6)[_0xef70('0x17')](_0x5435d6);}};}function respondWithFilteredResult(_0x26f62e,_0x5efb0d){return function(_0x4234ed){if(_0x4234ed){var _0x2483c7=typeof _0x5efb0d[_0xef70('0x18')]==='undefined'&&typeof _0x5efb0d[_0xef70('0x19')]==='undefined';var _0x467663=_0x4234ed[_0xef70('0x1a')];var _0x2ceb35=_0x2483c7?0x0:_0x5efb0d[_0xef70('0x18')];var _0x4dbbf9=_0x2483c7?_0x4234ed[_0xef70('0x1a')]:_0x5efb0d['offset']+_0x5efb0d['limit'];var _0x491989;if(_0x4dbbf9>=_0x467663){_0x4dbbf9=_0x467663;_0x491989=0xc8;}else{_0x491989=0xce;}_0x26f62e['status'](_0x491989);return _0x26f62e[_0xef70('0x1b')](_0xef70('0x1c'),_0x2ceb35+'-'+_0x4dbbf9+'/'+_0x467663)[_0xef70('0x17')](_0x4234ed);}return null;};}function patchUpdates(_0x1c21ea){return function(_0x5bd5e3){try{jsonpatch[_0xef70('0x1d')](_0x5bd5e3,_0x1c21ea,!![]);}catch(_0xe9cb80){return BPromise[_0xef70('0x1e')](_0xe9cb80);}return _0x5bd5e3[_0xef70('0x1f')]();};}function saveUpdates(_0x192354,_0x55c0ee){return function(_0x9822ed){if(_0x9822ed){return _0x9822ed[_0xef70('0x20')](_0x192354)[_0xef70('0x21')](function(_0x4352ac){return _0x4352ac;});}return null;};}function removeEntity(_0x51e762,_0x37e2cc){return function(_0x41d014){if(_0x41d014){return _0x41d014['destroy']()['then'](function(){var _0xba5e73=_0x41d014['get']({'plain':!![]});var _0x2eb4f2=_0xef70('0x22');return db['UserProfileResource'][_0xef70('0x23')]({'where':{'type':_0x2eb4f2,'resourceId':_0xba5e73['id']}})[_0xef70('0x21')](function(){return _0x41d014;});})['then'](function(){_0x51e762['status'](0xcc)[_0xef70('0x24')]();});}};}function handleEntityNotFound(_0x545fe4,_0x35d6f0){return function(_0x571494){if(!_0x571494){_0x545fe4[_0xef70('0x15')](0x194);}return _0x571494;};}function handleError(_0x3fa927,_0x2b8a2b){_0x2b8a2b=_0x2b8a2b||0x1f4;return function(_0x55bec8){logger[_0xef70('0x25')](_0x55bec8[_0xef70('0x26')]);if(_0x55bec8['name']){delete _0x55bec8[_0xef70('0x27')];}_0x3fa927[_0xef70('0x16')](_0x2b8a2b)[_0xef70('0x28')](_0x55bec8);};}exports[_0xef70('0x29')]=function(_0x5cc206,_0x77550e){var _0x41e3bd={},_0x5397c7={},_0x34f3fa={'count':0x0,'rows':[]};return db[_0xef70('0x2a')][_0xef70('0x2b')]()['then'](function(_0x1961ee){_0x5397c7[_0xef70('0x2c')]=_['keys'](_0x1961ee);_0x5397c7[_0xef70('0x2d')]=_[_0xef70('0x2e')](_0x5cc206[_0xef70('0x2d')]);_0x5397c7[_0xef70('0x2f')]=_[_0xef70('0x30')](_0x5397c7[_0xef70('0x2c')],_0x5397c7['query']);_0x41e3bd[_0xef70('0x31')]=_[_0xef70('0x30')](_0x5397c7[_0xef70('0x2c')],qs['fields'](_0x5cc206['query'][_0xef70('0x32')]));_0x41e3bd['attributes']=_0x41e3bd['attributes'][_0xef70('0x33')]?_0x41e3bd['attributes']:_0x5397c7[_0xef70('0x2c')];if(!_0x5cc206[_0xef70('0x2d')][_0xef70('0x34')](_0xef70('0x35'))){_0x41e3bd[_0xef70('0x19')]=qs[_0xef70('0x19')](_0x5cc206[_0xef70('0x2d')][_0xef70('0x19')]);_0x41e3bd[_0xef70('0x18')]=qs[_0xef70('0x18')](_0x5cc206[_0xef70('0x2d')][_0xef70('0x18')]);}_0x41e3bd[_0xef70('0x36')]=qs[_0xef70('0x37')](_0x5cc206['query'][_0xef70('0x37')]);_0x41e3bd[_0xef70('0x38')]=qs['filters'](_[_0xef70('0x39')](_0x5cc206[_0xef70('0x2d')],_0x5397c7[_0xef70('0x2f')]),_0x1961ee);if(_0x5cc206['query']['filter']){_0x41e3bd[_0xef70('0x38')]=_[_0xef70('0x3a')](_0x41e3bd['where'],{'$or':_[_0xef70('0x3b')](_0x41e3bd['attributes'],function(_0x286145){var _0x54a3cb={};_0x54a3cb[_0x286145]={'$like':'%'+_0x5cc206[_0xef70('0x2d')][_0xef70('0x3c')]+'%'};return _0x54a3cb;})});}_0x41e3bd=_[_0xef70('0x3a')]({},_0x41e3bd,_0x5cc206[_0xef70('0x3d')]);var _0x23f703={'where':_0x41e3bd['where']};return db[_0xef70('0x2a')][_0xef70('0x1a')](_0x23f703)[_0xef70('0x21')](function(_0x3ec48f){_0x34f3fa['count']=_0x3ec48f;if(_0x5cc206[_0xef70('0x2d')]['includeAll']){_0x41e3bd['include']=[{'all':!![]}];}return db[_0xef70('0x2a')]['findAll'](_0x41e3bd);})[_0xef70('0x21')](function(_0x18c9a4){_0x34f3fa[_0xef70('0x3e')]=_0x18c9a4;return _0x34f3fa;})[_0xef70('0x21')](respondWithFilteredResult(_0x77550e,_0x41e3bd))[_0xef70('0x3f')](handleError(_0x77550e,null));})['catch'](handleError(_0x77550e,null));};exports[_0xef70('0x40')]=function(_0x24cb19,_0x33c836){var _0x1bd50a={'raw':![],'where':{'id':_0x24cb19[_0xef70('0x41')]['id']}},_0x192b9a={};_0x192b9a[_0xef70('0x2c')]=_[_0xef70('0x2e')](db[_0xef70('0x2a')]['rawAttributes']);_0x192b9a[_0xef70('0x2d')]=_[_0xef70('0x2e')](_0x24cb19['query']);_0x192b9a[_0xef70('0x2f')]=_[_0xef70('0x30')](_0x192b9a[_0xef70('0x2c')],_0x192b9a[_0xef70('0x2d')]);_0x1bd50a[_0xef70('0x31')]=_['intersection'](_0x192b9a[_0xef70('0x2c')],qs['fields'](_0x24cb19[_0xef70('0x2d')]['fields']));_0x1bd50a['attributes']=_0x1bd50a['attributes'][_0xef70('0x33')]?_0x1bd50a[_0xef70('0x31')]:_0x192b9a['model'];if(_0x24cb19[_0xef70('0x2d')][_0xef70('0x42')]){_0x1bd50a[_0xef70('0x43')]=[{'all':!![]}];}_0x1bd50a=_['merge']({},_0x1bd50a,_0x24cb19[_0xef70('0x3d')]);return db[_0xef70('0x2a')]['find'](_0x1bd50a)['then'](handleEntityNotFound(_0x33c836,null))[_0xef70('0x21')](respondWithResult(_0x33c836,null))[_0xef70('0x3f')](handleError(_0x33c836,null));};exports['create']=function(_0x56a04c,_0x485d78){return db[_0xef70('0x2a')][_0xef70('0x44')](_0x56a04c[_0xef70('0x45')],{})[_0xef70('0x21')](function(_0x55bde3){var _0x592b7c=_0x56a04c[_0xef70('0x46')]['get']({'plain':!![]});if(!_0x592b7c)throw new Error(_0xef70('0x47'));if(_0x592b7c[_0xef70('0x48')]===_0xef70('0x46')){var _0x46a87b=_0x55bde3[_0xef70('0x49')]({'plain':!![]});var _0x342e7a='Companies';return db[_0xef70('0x4a')][_0xef70('0x4b')]({'where':{'name':_0x342e7a,'userProfileId':_0x592b7c[_0xef70('0x4c')]},'raw':!![]})[_0xef70('0x21')](function(_0x575f39){if(_0x575f39&&_0x575f39[_0xef70('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x46a87b['name'],'resourceId':_0x46a87b['id'],'type':_0x575f39['name'],'sectionId':_0x575f39['id']},{})[_0xef70('0x21')](function(){return _0x55bde3;});}else{return _0x55bde3;}})[_0xef70('0x3f')](function(_0x30712){logger[_0xef70('0x25')](_0xef70('0x4e'),_0x30712);throw _0x30712;});}return _0x55bde3;})[_0xef70('0x21')](respondWithResult(_0x485d78,0xc9))['catch'](handleError(_0x485d78,null));};exports[_0xef70('0x20')]=function(_0xd22e84,_0x2729e2){if(_0xd22e84['body']['id']){delete _0xd22e84[_0xef70('0x45')]['id'];}return db['CmCompany'][_0xef70('0x4b')]({'where':{'id':_0xd22e84['params']['id']}})[_0xef70('0x21')](handleEntityNotFound(_0x2729e2,null))[_0xef70('0x21')](saveUpdates(_0xd22e84['body'],null))['then'](respondWithResult(_0x2729e2,null))[_0xef70('0x3f')](handleError(_0x2729e2,null));};exports[_0xef70('0x23')]=function(_0x475da2,_0x35cbac){return db['CmCompany'][_0xef70('0x4b')]({'where':{'id':_0x475da2[_0xef70('0x41')]['id']}})[_0xef70('0x21')](handleEntityNotFound(_0x35cbac,null))[_0xef70('0x21')](removeEntity(_0x35cbac,null))['catch'](handleError(_0x35cbac,null));};exports['describe']=function(_0x2775d9,_0x4e196c){return db['CmCompany']['describe']()[_0xef70('0x21')](respondWithResult(_0x4e196c,null))[_0xef70('0x3f')](handleError(_0x4e196c,null));};exports[_0xef70('0x4f')]=function(_0x3892ca,_0xe33d96,_0x5e33a4){return db[_0xef70('0x50')][_0xef70('0x4b')]({'where':{'id':_0x3892ca['params']['id']}})[_0xef70('0x21')](handleEntityNotFound(_0xe33d96,null))['then'](function(_0x2f117d){if(_0x2f117d){return _0x2f117d[_0xef70('0x4f')](_0x3892ca[_0xef70('0x45')]['ids'],_['omit'](_0x3892ca[_0xef70('0x45')],['ids','id'])||{});}})[_0xef70('0x21')](respondWithResult(_0xe33d96,null))[_0xef70('0x3f')](handleError(_0xe33d96,null));};exports[_0xef70('0x51')]=function(_0x8678f6,_0x1b56ad,_0x332254){var _0x3bf494={};var _0x509daf={};var _0x321bba;var _0x46d4ed;return db['CmCompany']['findOne']({'where':{'id':_0x8678f6[_0xef70('0x41')]['id']}})[_0xef70('0x21')](handleEntityNotFound(_0x1b56ad,null))[_0xef70('0x21')](function(_0x1d8cde){if(_0x1d8cde){_0x321bba=_0x1d8cde;_0x509daf[_0xef70('0x2c')]=_[_0xef70('0x2e')](db[_0xef70('0x50')]['rawAttributes']);_0x509daf[_0xef70('0x2d')]=_[_0xef70('0x2e')](_0x8678f6[_0xef70('0x2d')]);_0x509daf[_0xef70('0x2f')]=_[_0xef70('0x30')](_0x509daf['model'],_0x509daf['query']);_0x3bf494[_0xef70('0x31')]=_[_0xef70('0x30')](_0x509daf[_0xef70('0x2c')],qs[_0xef70('0x32')](_0x8678f6[_0xef70('0x2d')][_0xef70('0x32')]));_0x3bf494[_0xef70('0x31')]=_0x3bf494[_0xef70('0x31')]['length']?_0x3bf494[_0xef70('0x31')]:_0x509daf[_0xef70('0x2c')];_0x3bf494['order']=qs[_0xef70('0x37')](_0x8678f6[_0xef70('0x2d')][_0xef70('0x37')]);_0x3bf494[_0xef70('0x38')]=qs[_0xef70('0x2f')](_[_0xef70('0x39')](_0x8678f6[_0xef70('0x2d')],_0x509daf[_0xef70('0x2f')]));if(_0x8678f6['query'][_0xef70('0x3c')]){_0x3bf494[_0xef70('0x38')]=_[_0xef70('0x3a')](_0x3bf494[_0xef70('0x38')],{'$or':_[_0xef70('0x3b')](_0x3bf494[_0xef70('0x31')],function(_0x58365e){var _0x57092e={};_0x57092e[_0x58365e]={'$like':'%'+_0x8678f6[_0xef70('0x2d')]['filter']+'%'};return _0x57092e;})});}_0x3bf494=_[_0xef70('0x3a')]({},_0x3bf494,_0x8678f6[_0xef70('0x3d')]);return _0x321bba['getContacts'](_0x3bf494);}})[_0xef70('0x21')](function(_0x4dc914){if(_0x4dc914){_0x46d4ed=_0x4dc914[_0xef70('0x33')];if(!_0x8678f6[_0xef70('0x2d')][_0xef70('0x34')](_0xef70('0x35'))){_0x3bf494[_0xef70('0x19')]=qs[_0xef70('0x19')](_0x8678f6['query']['limit']);_0x3bf494['offset']=qs[_0xef70('0x18')](_0x8678f6[_0xef70('0x2d')][_0xef70('0x18')]);}return _0x321bba[_0xef70('0x51')](_0x3bf494);}})[_0xef70('0x21')](function(_0x2cd176){if(_0x2cd176){return _0x2cd176?{'count':_0x46d4ed,'rows':_0x2cd176}:null;}})[_0xef70('0x21')](respondWithResult(_0x1b56ad,null))[_0xef70('0x3f')](handleError(_0x1b56ad,null));}; \ No newline at end of file +var _0xb7c5=['body','find','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','Companies','destroy','sendStatus','error','name','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','map','merge','includeAll','include','findAll','catch','params','rawAttributes','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource'];(function(_0x33feca,_0x2bd9ae){var _0x3c558f=function(_0x11bede){while(--_0x11bede){_0x33feca['push'](_0x33feca['shift']());}};_0x3c558f(++_0x2bd9ae);}(_0xb7c5,0x170));var _0x5b7c=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xb7c5[_0x158f01];return _0x5ef74e;};'use strict';var emlformat=require(_0x5b7c('0x0'));var rimraf=require(_0x5b7c('0x1'));var zipdir=require(_0x5b7c('0x2'));var jsonpatch=require(_0x5b7c('0x3'));var rp=require(_0x5b7c('0x4'));var moment=require(_0x5b7c('0x5'));var BPromise=require(_0x5b7c('0x6'));var Mustache=require(_0x5b7c('0x7'));var util=require('util');var path=require(_0x5b7c('0x8'));var sox=require(_0x5b7c('0x9'));var csv=require(_0x5b7c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b7c('0xb'));var _=require(_0x5b7c('0xc'));var squel=require(_0x5b7c('0xd'));var crypto=require(_0x5b7c('0xe'));var jsforce=require(_0x5b7c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b7c('0x10'));var Papa=require(_0x5b7c('0x11'));var Redis=require(_0x5b7c('0x12'));var authService=require(_0x5b7c('0x13'));var qs=require(_0x5b7c('0x14'));var as=require(_0x5b7c('0x15'));var hardwareService=require(_0x5b7c('0x16'));var logger=require(_0x5b7c('0x17'))(_0x5b7c('0x18'));var utils=require(_0x5b7c('0x19'));var config=require(_0x5b7c('0x1a'));var licenseUtil=require(_0x5b7c('0x1b'));var db=require(_0x5b7c('0x1c'))['db'];function respondWithStatusCode(_0x268d23,_0x521562){_0x521562=_0x521562||0xcc;return function(_0x2b1903){if(_0x2b1903){return _0x268d23['sendStatus'](_0x521562);}return _0x268d23[_0x5b7c('0x1d')](_0x521562)[_0x5b7c('0x1e')]();};}function respondWithResult(_0xb40645,_0x4557a6){_0x4557a6=_0x4557a6||0xc8;return function(_0x2e8230){if(_0x2e8230){return _0xb40645[_0x5b7c('0x1d')](_0x4557a6)['json'](_0x2e8230);}};}function respondWithFilteredResult(_0x38d6bf,_0xcb4d12){return function(_0x489676){if(_0x489676){var _0x182589=typeof _0xcb4d12[_0x5b7c('0x1f')]===_0x5b7c('0x20')&&typeof _0xcb4d12['limit']==='undefined';var _0x593a66=_0x489676[_0x5b7c('0x21')];var _0x39e921=_0x182589?0x0:_0xcb4d12[_0x5b7c('0x1f')];var _0x23b7f5=_0x182589?_0x489676[_0x5b7c('0x21')]:_0xcb4d12[_0x5b7c('0x1f')]+_0xcb4d12[_0x5b7c('0x22')];var _0x1ef559;if(_0x23b7f5>=_0x593a66){_0x23b7f5=_0x593a66;_0x1ef559=0xc8;}else{_0x1ef559=0xce;}_0x38d6bf[_0x5b7c('0x1d')](_0x1ef559);return _0x38d6bf[_0x5b7c('0x23')](_0x5b7c('0x24'),_0x39e921+'-'+_0x23b7f5+'/'+_0x593a66)[_0x5b7c('0x25')](_0x489676);}return null;};}function patchUpdates(_0x2dbd07){return function(_0x44f462){try{jsonpatch[_0x5b7c('0x26')](_0x44f462,_0x2dbd07,!![]);}catch(_0x2b164d){return BPromise[_0x5b7c('0x27')](_0x2b164d);}return _0x44f462[_0x5b7c('0x28')]();};}function saveUpdates(_0x17bea7,_0x4fc9c6){return function(_0x1e2dfc){if(_0x1e2dfc){return _0x1e2dfc[_0x5b7c('0x29')](_0x17bea7)[_0x5b7c('0x2a')](function(_0x45916c){return _0x45916c;});}return null;};}function removeEntity(_0x5eb951,_0x31db45){return function(_0x13bc8b){if(_0x13bc8b){return _0x13bc8b['destroy']()[_0x5b7c('0x2a')](function(){var _0x4b78f7=_0x13bc8b[_0x5b7c('0x2b')]({'plain':!![]});var _0x33a15f=_0x5b7c('0x2c');return db['UserProfileResource'][_0x5b7c('0x2d')]({'where':{'type':_0x33a15f,'resourceId':_0x4b78f7['id']}})['then'](function(){return _0x13bc8b;});})[_0x5b7c('0x2a')](function(){_0x5eb951[_0x5b7c('0x1d')](0xcc)[_0x5b7c('0x1e')]();});}};}function handleEntityNotFound(_0xbebc57,_0x9ca9e2){return function(_0x308d1a){if(!_0x308d1a){_0xbebc57[_0x5b7c('0x2e')](0x194);}return _0x308d1a;};}function handleError(_0x42be6b,_0xf9482d){_0xf9482d=_0xf9482d||0x1f4;return function(_0x385fb1){logger[_0x5b7c('0x2f')](_0x385fb1['stack']);if(_0x385fb1[_0x5b7c('0x30')]){delete _0x385fb1[_0x5b7c('0x30')];}_0x42be6b[_0x5b7c('0x1d')](_0xf9482d)['send'](_0x385fb1);};}exports[_0x5b7c('0x31')]=function(_0xcfb104,_0x312ad6){var _0x2127af={},_0x3a4efe={},_0x41de83={'count':0x0,'rows':[]};return db[_0x5b7c('0x32')][_0x5b7c('0x33')]()[_0x5b7c('0x2a')](function(_0x2a9d7b){_0x3a4efe[_0x5b7c('0x34')]=_[_0x5b7c('0x35')](_0x2a9d7b);_0x3a4efe[_0x5b7c('0x36')]=_[_0x5b7c('0x35')](_0xcfb104['query']);_0x3a4efe['filters']=_[_0x5b7c('0x37')](_0x3a4efe[_0x5b7c('0x34')],_0x3a4efe['query']);_0x2127af[_0x5b7c('0x38')]=_[_0x5b7c('0x37')](_0x3a4efe[_0x5b7c('0x34')],qs[_0x5b7c('0x39')](_0xcfb104[_0x5b7c('0x36')][_0x5b7c('0x39')]));_0x2127af[_0x5b7c('0x38')]=_0x2127af[_0x5b7c('0x38')][_0x5b7c('0x3a')]?_0x2127af['attributes']:_0x3a4efe[_0x5b7c('0x34')];if(!_0xcfb104[_0x5b7c('0x36')][_0x5b7c('0x3b')](_0x5b7c('0x3c'))){_0x2127af[_0x5b7c('0x22')]=qs[_0x5b7c('0x22')](_0xcfb104[_0x5b7c('0x36')][_0x5b7c('0x22')]);_0x2127af[_0x5b7c('0x1f')]=qs[_0x5b7c('0x1f')](_0xcfb104[_0x5b7c('0x36')][_0x5b7c('0x1f')]);}_0x2127af['order']=qs[_0x5b7c('0x3d')](_0xcfb104[_0x5b7c('0x36')]['sort']);_0x2127af['where']=qs[_0x5b7c('0x3e')](_[_0x5b7c('0x3f')](_0xcfb104[_0x5b7c('0x36')],_0x3a4efe[_0x5b7c('0x3e')]),_0x2a9d7b);if(_0xcfb104['query'][_0x5b7c('0x40')]){_0x2127af[_0x5b7c('0x41')]=_['merge'](_0x2127af[_0x5b7c('0x41')],{'$or':_[_0x5b7c('0x42')](_0x2127af[_0x5b7c('0x38')],function(_0x2cade1){var _0x2baa7b={};_0x2baa7b[_0x2cade1]={'$like':'%'+_0xcfb104[_0x5b7c('0x36')]['filter']+'%'};return _0x2baa7b;})});}_0x2127af=_[_0x5b7c('0x43')]({},_0x2127af,_0xcfb104['options']);var _0x2dad93={'where':_0x2127af['where']};return db[_0x5b7c('0x32')][_0x5b7c('0x21')](_0x2dad93)[_0x5b7c('0x2a')](function(_0x35e5c3){_0x41de83['count']=_0x35e5c3;if(_0xcfb104[_0x5b7c('0x36')][_0x5b7c('0x44')]){_0x2127af[_0x5b7c('0x45')]=[{'all':!![]}];}return db[_0x5b7c('0x32')][_0x5b7c('0x46')](_0x2127af);})[_0x5b7c('0x2a')](function(_0x7729f9){_0x41de83['rows']=_0x7729f9;return _0x41de83;})['then'](respondWithFilteredResult(_0x312ad6,_0x2127af))[_0x5b7c('0x47')](handleError(_0x312ad6,null));})[_0x5b7c('0x47')](handleError(_0x312ad6,null));};exports['show']=function(_0x304379,_0x2beb30){var _0x41a962={'raw':![],'where':{'id':_0x304379[_0x5b7c('0x48')]['id']}},_0x5bad2c={};_0x5bad2c[_0x5b7c('0x34')]=_['keys'](db[_0x5b7c('0x32')][_0x5b7c('0x49')]);_0x5bad2c['query']=_[_0x5b7c('0x35')](_0x304379[_0x5b7c('0x36')]);_0x5bad2c[_0x5b7c('0x3e')]=_[_0x5b7c('0x37')](_0x5bad2c['model'],_0x5bad2c[_0x5b7c('0x36')]);_0x41a962[_0x5b7c('0x38')]=_[_0x5b7c('0x37')](_0x5bad2c['model'],qs['fields'](_0x304379[_0x5b7c('0x36')][_0x5b7c('0x39')]));_0x41a962['attributes']=_0x41a962[_0x5b7c('0x38')][_0x5b7c('0x3a')]?_0x41a962[_0x5b7c('0x38')]:_0x5bad2c[_0x5b7c('0x34')];if(_0x304379[_0x5b7c('0x36')][_0x5b7c('0x44')]){_0x41a962['include']=[{'all':!![]}];}_0x41a962=_['merge']({},_0x41a962,_0x304379[_0x5b7c('0x4a')]);return db['CmCompany']['find'](_0x41a962)[_0x5b7c('0x2a')](handleEntityNotFound(_0x2beb30,null))[_0x5b7c('0x2a')](respondWithResult(_0x2beb30,null))['catch'](handleError(_0x2beb30,null));};exports[_0x5b7c('0x4b')]=function(_0x2c401a,_0x2fc6d6){return db['CmCompany'][_0x5b7c('0x4b')](_0x2c401a['body'],{})[_0x5b7c('0x2a')](function(_0x53b0e7){var _0x2a6a4c=_0x2c401a['user'][_0x5b7c('0x2b')]({'plain':!![]});if(!_0x2a6a4c)throw new Error(_0x5b7c('0x4c'));if(_0x2a6a4c[_0x5b7c('0x4d')]===_0x5b7c('0x4e')){var _0x33f1ce=_0x53b0e7[_0x5b7c('0x2b')]({'plain':!![]});var _0x4c7546=_0x5b7c('0x2c');return db[_0x5b7c('0x4f')]['find']({'where':{'name':_0x4c7546,'userProfileId':_0x2a6a4c[_0x5b7c('0x50')]},'raw':!![]})[_0x5b7c('0x2a')](function(_0x14cb2a){if(_0x14cb2a&&_0x14cb2a['autoAssociation']===0x0){return db[_0x5b7c('0x51')]['create']({'name':_0x33f1ce[_0x5b7c('0x30')],'resourceId':_0x33f1ce['id'],'type':_0x14cb2a[_0x5b7c('0x30')],'sectionId':_0x14cb2a['id']},{})[_0x5b7c('0x2a')](function(){return _0x53b0e7;});}else{return _0x53b0e7;}})[_0x5b7c('0x47')](function(_0xd297a4){logger[_0x5b7c('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd297a4);throw _0xd297a4;});}return _0x53b0e7;})[_0x5b7c('0x2a')](respondWithResult(_0x2fc6d6,0xc9))['catch'](handleError(_0x2fc6d6,null));};exports[_0x5b7c('0x29')]=function(_0x1a4c24,_0x4bbbea){if(_0x1a4c24['body']['id']){delete _0x1a4c24[_0x5b7c('0x52')]['id'];}return db[_0x5b7c('0x32')]['find']({'where':{'id':_0x1a4c24['params']['id']}})[_0x5b7c('0x2a')](handleEntityNotFound(_0x4bbbea,null))[_0x5b7c('0x2a')](saveUpdates(_0x1a4c24[_0x5b7c('0x52')],null))[_0x5b7c('0x2a')](respondWithResult(_0x4bbbea,null))[_0x5b7c('0x47')](handleError(_0x4bbbea,null));};exports[_0x5b7c('0x2d')]=function(_0x49f75c,_0x1fdd01){return db[_0x5b7c('0x32')][_0x5b7c('0x53')]({'where':{'id':_0x49f75c[_0x5b7c('0x48')]['id']}})[_0x5b7c('0x2a')](handleEntityNotFound(_0x1fdd01,null))[_0x5b7c('0x2a')](removeEntity(_0x1fdd01,null))['catch'](handleError(_0x1fdd01,null));};exports['describe']=function(_0x5776c4,_0x2d3a16){return db[_0x5b7c('0x32')][_0x5b7c('0x33')]()['then'](respondWithResult(_0x2d3a16,null))['catch'](handleError(_0x2d3a16,null));};exports[_0x5b7c('0x54')]=function(_0x4a5905,_0x5a4320,_0x566af3){return db[_0x5b7c('0x55')][_0x5b7c('0x53')]({'where':{'id':_0x4a5905[_0x5b7c('0x48')]['id']}})[_0x5b7c('0x2a')](handleEntityNotFound(_0x5a4320,null))[_0x5b7c('0x2a')](function(_0x17aaad){if(_0x17aaad){return _0x17aaad[_0x5b7c('0x54')](_0x4a5905[_0x5b7c('0x52')][_0x5b7c('0x56')],_[_0x5b7c('0x57')](_0x4a5905[_0x5b7c('0x52')],[_0x5b7c('0x56'),'id'])||{});}})[_0x5b7c('0x2a')](respondWithResult(_0x5a4320,null))[_0x5b7c('0x47')](handleError(_0x5a4320,null));};exports[_0x5b7c('0x58')]=function(_0x46f106,_0x4b9891,_0x367b40){var _0x3fcdcd={};var _0x5b0a1={};var _0x2aae3e;var _0x23e8b4;return db[_0x5b7c('0x32')][_0x5b7c('0x59')]({'where':{'id':_0x46f106['params']['id']}})[_0x5b7c('0x2a')](handleEntityNotFound(_0x4b9891,null))[_0x5b7c('0x2a')](function(_0xf89c14){if(_0xf89c14){_0x2aae3e=_0xf89c14;_0x5b0a1['model']=_[_0x5b7c('0x35')](db['CmContact'][_0x5b7c('0x49')]);_0x5b0a1[_0x5b7c('0x36')]=_[_0x5b7c('0x35')](_0x46f106['query']);_0x5b0a1[_0x5b7c('0x3e')]=_[_0x5b7c('0x37')](_0x5b0a1[_0x5b7c('0x34')],_0x5b0a1[_0x5b7c('0x36')]);_0x3fcdcd[_0x5b7c('0x38')]=_[_0x5b7c('0x37')](_0x5b0a1[_0x5b7c('0x34')],qs[_0x5b7c('0x39')](_0x46f106['query']['fields']));_0x3fcdcd[_0x5b7c('0x38')]=_0x3fcdcd[_0x5b7c('0x38')][_0x5b7c('0x3a')]?_0x3fcdcd[_0x5b7c('0x38')]:_0x5b0a1[_0x5b7c('0x34')];_0x3fcdcd['order']=qs[_0x5b7c('0x3d')](_0x46f106[_0x5b7c('0x36')][_0x5b7c('0x3d')]);_0x3fcdcd[_0x5b7c('0x41')]=qs[_0x5b7c('0x3e')](_[_0x5b7c('0x3f')](_0x46f106['query'],_0x5b0a1[_0x5b7c('0x3e')]));if(_0x46f106[_0x5b7c('0x36')]['filter']){_0x3fcdcd[_0x5b7c('0x41')]=_[_0x5b7c('0x43')](_0x3fcdcd[_0x5b7c('0x41')],{'$or':_[_0x5b7c('0x42')](_0x3fcdcd[_0x5b7c('0x38')],function(_0x19c8a8){var _0x2ea003={};_0x2ea003[_0x19c8a8]={'$like':'%'+_0x46f106[_0x5b7c('0x36')][_0x5b7c('0x40')]+'%'};return _0x2ea003;})});}_0x3fcdcd=_[_0x5b7c('0x43')]({},_0x3fcdcd,_0x46f106['options']);return _0x2aae3e[_0x5b7c('0x58')](_0x3fcdcd);}})['then'](function(_0x1a33df){if(_0x1a33df){_0x23e8b4=_0x1a33df[_0x5b7c('0x3a')];if(!_0x46f106[_0x5b7c('0x36')]['hasOwnProperty'](_0x5b7c('0x3c'))){_0x3fcdcd['limit']=qs[_0x5b7c('0x22')](_0x46f106[_0x5b7c('0x36')]['limit']);_0x3fcdcd[_0x5b7c('0x1f')]=qs[_0x5b7c('0x1f')](_0x46f106[_0x5b7c('0x36')][_0x5b7c('0x1f')]);}return _0x2aae3e[_0x5b7c('0x58')](_0x3fcdcd);}})[_0x5b7c('0x2a')](function(_0x33ab87){if(_0x33ab87){return _0x33ab87?{'count':_0x23e8b4,'rows':_0x33ab87}:null;}})[_0x5b7c('0x2a')](respondWithResult(_0x4b9891,null))[_0x5b7c('0x47')](handleError(_0x4b9891,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7d74f5b..0cf4d4a 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 _0x2034=['api','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','CmCompany','lodash'];(function(_0x54b5bd,_0x133fe1){var _0xcba844=function(_0x4023dc){while(--_0x4023dc){_0x54b5bd['push'](_0x54b5bd['shift']());}};_0xcba844(++_0x133fe1);}(_0x2034,0x15f));var _0x4203=function(_0x33b461,_0x63e84e){_0x33b461=_0x33b461-0x0;var _0x44c4e5=_0x2034[_0x33b461];return _0x44c4e5;};'use strict';var _=require(_0x4203('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4203('0x1'));var moment=require('moment');var BPromise=require(_0x4203('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4203('0x3'));var rimraf=require(_0x4203('0x4'));var config=require(_0x4203('0x5'));var attributes=require(_0x4203('0x6'));module['exports']=function(_0x155b74,_0x4f9348){return _0x155b74['define'](_0x4203('0x7'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x585a=['moment','bluebird','request-promise','path','./cmCompany.attributes','define','CmCompany','lodash','util','api'];(function(_0x406b2a,_0x555a66){var _0x37c91f=function(_0x180789){while(--_0x180789){_0x406b2a['push'](_0x406b2a['shift']());}};_0x37c91f(++_0x555a66);}(_0x585a,0x15b));var _0xa585=function(_0x2f02d4,_0x27b24a){_0x2f02d4=_0x2f02d4-0x0;var _0x4b707d=_0x585a[_0x2f02d4];return _0x4b707d;};'use strict';var _=require(_0xa585('0x0'));var util=require(_0xa585('0x1'));var logger=require('../../config/logger')(_0xa585('0x2'));var moment=require(_0xa585('0x3'));var BPromise=require(_0xa585('0x4'));var rp=require(_0xa585('0x5'));var fs=require('fs');var path=require(_0xa585('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa585('0x7'));module['exports']=function(_0x12b1e1,_0x1d13d4){return _0x12b1e1[_0xa585('0x8')](_0xa585('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 921b35c..cb7e0ef 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 _0x1920=['CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x1920,0x1c1));var _0x0192=function(_0x144bea,_0x1d374b){_0x144bea=_0x144bea-0x0;var _0x2af320=_0x1920[_0x144bea];return _0x2af320;};'use strict';var _=require(_0x0192('0x0'));var util=require(_0x0192('0x1'));var moment=require(_0x0192('0x2'));var BPromise=require(_0x0192('0x3'));var rs=require(_0x0192('0x4'));var fs=require('fs');var Redis=require(_0x0192('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0192('0x6'))(_0x0192('0x7'));var config=require(_0x0192('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0192('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5939a3,_0x1b1be4,_0x496ce6){return new BPromise(function(_0x222c75,_0x4f9501){return client[_0x0192('0xa')](_0x5939a3,_0x496ce6)[_0x0192('0xb')](function(_0x224fbf){logger[_0x0192('0xc')](_0x0192('0xd'),_0x1b1be4,'request\x20sent');logger[_0x0192('0xe')](_0x0192('0xf'),_0x1b1be4,_0x0192('0x10'),JSON[_0x0192('0x11')](_0x224fbf));if(_0x224fbf['error']){if(_0x224fbf[_0x0192('0x12')][_0x0192('0x13')]===0x1f4){logger[_0x0192('0x12')](_0x0192('0xd'),_0x1b1be4,_0x224fbf[_0x0192('0x12')][_0x0192('0x14')]);return _0x4f9501(_0x224fbf[_0x0192('0x12')][_0x0192('0x14')]);}logger['error'](_0x0192('0xd'),_0x1b1be4,_0x224fbf['error']['message']);return _0x222c75(_0x224fbf['error'][_0x0192('0x14')]);}else{logger[_0x0192('0xc')](_0x0192('0xd'),_0x1b1be4,_0x0192('0x10'));_0x222c75(_0x224fbf['result']['message']);}})['catch'](function(_0x5e299f){logger['error']('CmCompany,\x20%s,\x20%s',_0x1b1be4,_0x5e299f);_0x4f9501(_0x5e299f);});});} \ No newline at end of file +var _0xe8be=['request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1be135,_0x5882f5){var _0x3e94b4=function(_0x3faf93){while(--_0x3faf93){_0x1be135['push'](_0x1be135['shift']());}};_0x3e94b4(++_0x5882f5);}(_0xe8be,0x6c));var _0xee8b=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0xe8be[_0x2300f2];return _0x6bd508;};'use strict';var _=require(_0xee8b('0x0'));var util=require(_0xee8b('0x1'));var moment=require(_0xee8b('0x2'));var BPromise=require(_0xee8b('0x3'));var rs=require(_0xee8b('0x4'));var fs=require('fs');var Redis=require(_0xee8b('0x5'));var db=require(_0xee8b('0x6'))['db'];var utils=require(_0xee8b('0x7'));var logger=require('../../config/logger')(_0xee8b('0x8'));var config=require(_0xee8b('0x9'));var jayson=require(_0xee8b('0xa'));var client=jayson[_0xee8b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59a555,_0x2a1234,_0x351e96){return new BPromise(function(_0x39541a,_0x5c104b){return client[_0xee8b('0xc')](_0x59a555,_0x351e96)[_0xee8b('0xd')](function(_0x277070){logger[_0xee8b('0xe')](_0xee8b('0xf'),_0x2a1234,_0xee8b('0x10'));logger[_0xee8b('0x11')](_0xee8b('0x12'),_0x2a1234,_0xee8b('0x10'),JSON['stringify'](_0x277070));if(_0x277070['error']){if(_0x277070[_0xee8b('0x13')][_0xee8b('0x14')]===0x1f4){logger[_0xee8b('0x13')]('CmCompany,\x20%s,\x20%s',_0x2a1234,_0x277070[_0xee8b('0x13')][_0xee8b('0x15')]);return _0x5c104b(_0x277070['error'][_0xee8b('0x15')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x2a1234,_0x277070['error'][_0xee8b('0x15')]);return _0x39541a(_0x277070['error'][_0xee8b('0x15')]);}else{logger[_0xee8b('0xe')](_0xee8b('0xf'),_0x2a1234,_0xee8b('0x10'));_0x39541a(_0x277070[_0xee8b('0x16')][_0xee8b('0x15')]);}})[_0xee8b('0x17')](function(_0x2c03d4){logger['error']('CmCompany,\x20%s,\x20%s',_0x2a1234,_0x2c03d4);_0x5c104b(_0x2c03d4);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 318bb5c..88c7cab 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 _0xe5bf=['util','path','express','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/contacts','getContacts','post','create','update','exports','multer'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe5bf,0xef));var _0xfe5b=function(_0x4c1186,_0x33f15c){_0x4c1186=_0x4c1186-0x0;var _0x1c3dc1=_0xe5bf[_0x4c1186];return _0x1c3dc1;};'use strict';var multer=require(_0xfe5b('0x0'));var util=require(_0xfe5b('0x1'));var path=require(_0xfe5b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe5b('0x3'));var router=express['Router']();var fs_extra=require(_0xfe5b('0x4'));var auth=require(_0xfe5b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe5b('0x6'));var controller=require(_0xfe5b('0x7'));router[_0xfe5b('0x8')]('/',auth['isAuthenticated'](),controller[_0xfe5b('0x9')]);router[_0xfe5b('0x8')](_0xfe5b('0xa'),auth['isAuthenticated'](),controller[_0xfe5b('0xb')]);router[_0xfe5b('0x8')](_0xfe5b('0xc'),auth[_0xfe5b('0xd')](),controller['show']);router[_0xfe5b('0x8')](_0xfe5b('0xe'),auth['isAuthenticated'](),controller[_0xfe5b('0xf')]);router[_0xfe5b('0x10')]('/',auth['isAuthenticated'](),controller[_0xfe5b('0x11')]);router[_0xfe5b('0x10')](_0xfe5b('0xe'),auth[_0xfe5b('0xd')](),controller['addContacts']);router['put']('/:id',auth[_0xfe5b('0xd')](),controller[_0xfe5b('0x12')]);router['delete'](_0xfe5b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xfe5b('0x13')]=router; \ No newline at end of file +var _0x2fa9=['../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','create','addContacts','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2fa9,0x1ee));var _0x92fa=function(_0x4cd6a3,_0x364475){_0x4cd6a3=_0x4cd6a3-0x0;var _0x18a142=_0x2fa9[_0x4cd6a3];return _0x18a142;};'use strict';var multer=require('multer');var util=require(_0x92fa('0x0'));var path=require(_0x92fa('0x1'));var timeout=require(_0x92fa('0x2'));var express=require(_0x92fa('0x3'));var router=express[_0x92fa('0x4')]();var fs_extra=require(_0x92fa('0x5'));var auth=require(_0x92fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92fa('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x92fa('0x8')](),controller['index']);router[_0x92fa('0x9')](_0x92fa('0xa'),auth[_0x92fa('0x8')](),controller[_0x92fa('0xb')]);router[_0x92fa('0x9')](_0x92fa('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x92fa('0x9')]('/:id/contacts',auth[_0x92fa('0x8')](),controller['getContacts']);router[_0x92fa('0xd')]('/',auth['isAuthenticated'](),controller[_0x92fa('0xe')]);router[_0x92fa('0xd')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x92fa('0xf')]);router[_0x92fa('0x10')](_0x92fa('0xc'),auth['isAuthenticated'](),controller[_0x92fa('0x11')]);router[_0x92fa('0x12')](_0x92fa('0xc'),auth[_0x92fa('0x8')](),controller['destroy']);module[_0x92fa('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 648a920..905d425 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 _0x7cfb=['STRING','INTEGER','DATE','NOW','lodash','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7cfb,0x82));var _0xb7cf=function(_0x38ab45,_0x249765){_0x38ab45=_0x38ab45-0x0;var _0x4fe5dc=_0x7cfb[_0x38ab45];return _0x4fe5dc;};'use strict';var _=require(_0xb7cf('0x0'));var Sequelize=require('sequelize');module[_0xb7cf('0x1')]={'firstName':{'type':Sequelize[_0xb7cf('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb7cf('0x2')]},'street':{'type':Sequelize[_0xb7cf('0x2')]},'postalCode':{'type':Sequelize[_0xb7cf('0x2')]},'city':{'type':Sequelize[_0xb7cf('0x2')]},'country':{'type':Sequelize[_0xb7cf('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xb7cf('0x2')]},'fax':{'type':Sequelize[_0xb7cf('0x2')]},'email':{'type':Sequelize[_0xb7cf('0x2')]},'url':{'type':Sequelize[_0xb7cf('0x2')]},'facebook':{'type':Sequelize[_0xb7cf('0x2')]},'fb_data':{'type':Sequelize[_0xb7cf('0x2')]},'twitter':{'type':Sequelize[_0xb7cf('0x2')]},'skype':{'type':Sequelize[_0xb7cf('0x2')]},'teams':{'type':Sequelize[_0xb7cf('0x2')]},'viber':{'type':Sequelize[_0xb7cf('0x2')]},'line':{'type':Sequelize[_0xb7cf('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xb7cf('0x2')]},'UserId':{'type':Sequelize[_0xb7cf('0x3')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb7cf('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb7cf('0x4')],'defaultValue':Sequelize[_0xb7cf('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xb7cf('0x3')]}}; \ No newline at end of file +var _0xac2f=['lodash','exports','STRING','INTEGER','NOW'];(function(_0x27f9f8,_0x586abe){var _0x59ef9a=function(_0x3cb88e){while(--_0x3cb88e){_0x27f9f8['push'](_0x27f9f8['shift']());}};_0x59ef9a(++_0x586abe);}(_0xac2f,0x145));var _0xfac2=function(_0x5de1e9,_0x4defc6){_0x5de1e9=_0x5de1e9-0x0;var _0x51be48=_0xac2f[_0x5de1e9];return _0x51be48;};'use strict';var _=require(_0xfac2('0x0'));var Sequelize=require('sequelize');module[_0xfac2('0x1')]={'firstName':{'type':Sequelize[_0xfac2('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfac2('0x2')]},'postalCode':{'type':Sequelize[_0xfac2('0x2')]},'city':{'type':Sequelize[_0xfac2('0x2')]},'country':{'type':Sequelize[_0xfac2('0x2')]},'dateOfBirth':{'type':Sequelize[_0xfac2('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xfac2('0x2')]},'mobile':{'type':Sequelize[_0xfac2('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xfac2('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xfac2('0x2')]},'skype':{'type':Sequelize[_0xfac2('0x2')]},'teams':{'type':Sequelize[_0xfac2('0x2')]},'viber':{'type':Sequelize[_0xfac2('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfac2('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xfac2('0x2')]},'priority':{'type':Sequelize[_0xfac2('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xfac2('0x4')]},'dialTimezone':{'type':Sequelize[_0xfac2('0x2')]},'utcOffset':{'type':Sequelize[_0xfac2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 08767e0..91fafb1 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 _0xa847=['values','phone','findOne','model','filters','attributes','intersection','order','sort','filter','options','getTags','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','fields','pick','include','rawAttributes','getHopperFinals','ContactId','CmHopperFinal','includeAll','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','file','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','chat','fax','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','source','callerid','endtime','duration','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','Account','closed','closedAt','note','disposition','secondDisposition','key','Tags','customerIp','deviceModel','osName','ratingMessage','ratingType','mail','substatus','openchannel','externalUrl','threadId','Interaction','rows','Owner','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','undefined','limit','count','json','update','then','destroy','end','sendStatus','error','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','alias','custom','type','info','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','ListId','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','$and','omit','format','cf_%d','pickBy','map','isEmpty','cm_contacts','setFields','text'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa847,0x81));var _0x7a84=function(_0x43a9c9,_0x362af4){_0x43a9c9=_0x43a9c9-0x0;var _0x138f32=_0xa847[_0x43a9c9];return _0x138f32;};'use strict';var moment=require(_0x7a84('0x0'));var BPromise=require(_0x7a84('0x1'));var util=require(_0x7a84('0x2'));var path=require(_0x7a84('0x3'));var fs=require('fs');var _=require(_0x7a84('0x4'));var squel=require(_0x7a84('0x5'));var Papa=require(_0x7a84('0x6'));var Redis=require('ioredis');var contacts=require(_0x7a84('0x7'));var qs=require(_0x7a84('0x8'));var logger=require(_0x7a84('0x9'))(_0x7a84('0xa'));var config=require(_0x7a84('0xb'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x7a84('0xc')]=_[_0x7a84('0xd')](config[_0x7a84('0xc')],{'host':_0x7a84('0xe'),'port':0x18eb});var socket=require(_0x7a84('0xf'))(new Redis(config[_0x7a84('0xc')]));require(_0x7a84('0x10'))[_0x7a84('0x11')](socket);function respondWithResult(_0x53763b,_0x47f48c){_0x47f48c=_0x47f48c||0xc8;return function(_0x4a0f60){if(_0x4a0f60){return _0x53763b[_0x7a84('0x12')](_0x47f48c)['json'](_0x4a0f60);}};}function respondWithFilteredResult(_0xde3a7e,_0x176d8a){return function(_0x2a464b){if(_0x2a464b){var _0x4713d1=typeof _0x176d8a[_0x7a84('0x13')]===_0x7a84('0x14')&&typeof _0x176d8a[_0x7a84('0x15')]===_0x7a84('0x14');var _0x43cbc5=_0x2a464b[_0x7a84('0x16')];var _0x1eecac=_0x4713d1?0x0:_0x176d8a['offset'];var _0x13a9c1=_0x4713d1?_0x2a464b[_0x7a84('0x16')]:_0x176d8a[_0x7a84('0x13')]+_0x176d8a[_0x7a84('0x15')];var _0x5cee5d;if(_0x13a9c1>=_0x43cbc5){_0x13a9c1=_0x43cbc5;_0x5cee5d=0xc8;}else{_0x5cee5d=0xce;}_0xde3a7e[_0x7a84('0x12')](_0x5cee5d);return _0xde3a7e['set']('Content-Range',_0x1eecac+'-'+_0x13a9c1+'/'+_0x43cbc5)[_0x7a84('0x17')](_0x2a464b);}return null;};}function saveUpdates(_0x1551bf){return function(_0x32447b){if(_0x32447b){return _0x32447b[_0x7a84('0x18')](_0x1551bf)[_0x7a84('0x19')](function(_0xfc7a91){return _0xfc7a91;});}return null;};}function removeEntity(_0x166e20){return function(_0x16195c){if(_0x16195c){return _0x16195c[_0x7a84('0x1a')]()['then'](function(){_0x166e20[_0x7a84('0x12')](0xcc)[_0x7a84('0x1b')]();});}};}function handleEntityNotFound(_0x2d914e){return function(_0x227658){if(!_0x227658){_0x2d914e[_0x7a84('0x1c')](0x194);}return _0x227658;};}function handleError(_0x3b4480,_0x43e182){_0x43e182=_0x43e182||0x1f4;return function(_0x390ba4){logger[_0x7a84('0x1d')](_0x390ba4['stack']);if(_0x390ba4[_0x7a84('0x1e')]){delete _0x390ba4[_0x7a84('0x1e')];}_0x3b4480['status'](_0x43e182)['send'](_0x390ba4);};}exports['index']=function(_0x5d3525,_0x110dce){var _0x1ad57c={};return contacts[_0x7a84('0x1f')]()[_0x7a84('0x19')](function(_0x2abe9e){_0x1ad57c=qs[_0x7a84('0x20')](_0x2abe9e,_0x5d3525);return contacts[_0x7a84('0x21')](_0x5d3525[_0x7a84('0x22')],_0x5d3525[_0x7a84('0x23')],_0x1ad57c,_0x2abe9e);})[_0x7a84('0x19')](respondWithFilteredResult(_0x110dce,_0x1ad57c))[_0x7a84('0x24')](handleError(_0x110dce,null));};exports[_0x7a84('0x1a')]=function(_0x3df0b2,_0x215c0c){return db[_0x7a84('0x25')][_0x7a84('0x26')]({'where':{'id':_0x3df0b2[_0x7a84('0x27')]['id']}})[_0x7a84('0x19')](handleEntityNotFound(_0x215c0c,null))[_0x7a84('0x19')](removeEntity(_0x215c0c,null))[_0x7a84('0x24')](handleError(_0x215c0c,null));};exports['describe']=function(_0x147a1b,_0x3ebf71){return db[_0x7a84('0x25')]['describe']()[_0x7a84('0x19')](function(_0x51c5e2){delete _0x51c5e2[_0x7a84('0x28')];for(var _0x1a45df=0x0;_0x1a45df0x0){return new Promise(function(_0x407a7a){var _0x26a1f5=[];for(var _0x58c976=0x0;_0x58c976<_0xe23eb4[_0x7a84('0x2a')];_0x58c976++){_0x26a1f5[_0x7a84('0x5e')](insertAdditionalPhones(_0xe23eb4[_0x58c976]['contact'],_0xe23eb4[_0x58c976][_0x7a84('0x5a')]));}Promise[_0x7a84('0x61')](_0x26a1f5)[_0x7a84('0x19')](function(){_0x407a7a(0x1);});})['then'](function(){return{'success':_0x146e8c,'failure':_0x40c1b8,'duplicates':_0x9a1efe};});}else{return{'success':_0x146e8c,'failure':_0x40c1b8,'duplicates':_0x9a1efe};}}})['then'](respondWithResult(_0x505000,0xc9))[_0x7a84('0x24')](handleError(_0x505000,null));};exports[_0x7a84('0x62')]=function(_0x4f4b24,_0xe0e48d){var _0x50ef4d;return db[_0x7a84('0x25')]['describe']()[_0x7a84('0x19')](function(_0x35bc9f){return db[_0x7a84('0x25')][_0x7a84('0x26')]({'where':{'id':_0x4f4b24[_0x7a84('0x27')]['id']},'include':[{'model':db[_0x7a84('0x63')],'as':'Tags','attributes':['id',_0x7a84('0x1e'),_0x7a84('0x64')],'required':_0x4f4b24[_0x7a84('0x22')][_0x7a84('0x65')]?!![]:![]},{'model':db[_0x7a84('0x4b')],'as':_0x7a84('0x66'),'where':{'CmContactId':_0x4f4b24['params']['id']},'required':![],'include':[{'model':db[_0x7a84('0x67')],'as':_0x7a84('0x68')}]}],'order':[db['sequelize'][_0x7a84('0x69')]('Phones.OrderBy')],'attributes':_[_0x7a84('0x29')](_0x35bc9f)});})[_0x7a84('0x19')](function(_0x5353ac){if(!_[_0x7a84('0x56')](_0x5353ac)){_0x50ef4d=_0x5353ac[_0x7a84('0x3a')]({'plain':!![]});var _0x2e8079={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5353ac&&_0x5353ac[_0x7a84('0x5f')]){if(_0x5353ac['ListId']){_0x2e8079[_0x7a84('0x5c')][_0x7a84('0x6a')]['push']({'ListId':{'$ne':_0x5353ac[_0x7a84('0x5f')]}});}}return db[_0x7a84('0x30')][_0x7a84('0x21')](_0x2e8079);}})[_0x7a84('0x19')](function(_0x2810c4){if(!_['isNil'](_0x2810c4)){return _[_0x7a84('0x6b')](_0x50ef4d,_['map'](_0x2810c4,function(_0x4967dd){return util[_0x7a84('0x6c')](_0x7a84('0x6d'),_0x4967dd['id']);}));}})[_0x7a84('0x19')](handleEntityNotFound(_0xe0e48d,null))[_0x7a84('0x19')](respondWithResult(_0xe0e48d,null))[_0x7a84('0x24')](handleError(_0xe0e48d,null));};exports[_0x7a84('0x18')]=function(_0x5bd9a1,_0xe2eb20){var _0x531b9e;if(_0x5bd9a1[_0x7a84('0x38')]['id']){delete _0x5bd9a1['body']['id'];}if(!_[_0x7a84('0x56')](_0x5bd9a1['body'][_0x7a84('0x57')])){var _0x4ef2d2=_0x5bd9a1[_0x7a84('0x38')][_0x7a84('0x57')];if(!_[_0x7a84('0x56')](shared['timezones'][_0x4ef2d2]))_0x5bd9a1[_0x7a84('0x38')][_0x7a84('0x59')]=shared[_0x7a84('0x58')][_0x4ef2d2]['utcOffset'];}return db['CmContact'][_0x7a84('0x26')]({'where':{'id':_0x5bd9a1[_0x7a84('0x27')]['id']}})[_0x7a84('0x19')](handleEntityNotFound(_0xe2eb20,null))[_0x7a84('0x19')](saveUpdates(_0x5bd9a1[_0x7a84('0x38')],null))[_0x7a84('0x19')](function(_0x5702ea){_0x531b9e=_0x5702ea;var _0x2cf811={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5702ea&&_0x5702ea['ListId']){if(_0x5702ea[_0x7a84('0x5f')]){_0x2cf811[_0x7a84('0x5c')]['$and'][_0x7a84('0x5e')]({'ListId':{'$ne':_0x5702ea['ListId']}});}}return db[_0x7a84('0x30')][_0x7a84('0x21')](_0x2cf811);})[_0x7a84('0x19')](function(_0x4f95c1){if(_0x4f95c1){return _['omit'](_[_0x7a84('0x6e')](_0x5bd9a1[_0x7a84('0x38')],function(_0x5970a0,_0x51080c){return _[_0x7a84('0x2b')](_0x51080c,_0x7a84('0x2c'));}),_[_0x7a84('0x6f')](_0x4f95c1,function(_0x4447ab){return util[_0x7a84('0x6c')](_0x7a84('0x6d'),_0x4447ab['id']);}));}})['then'](function(_0x23d060){if(_0x23d060&&!_[_0x7a84('0x70')](_0x23d060)){var _0x2855dc=squel[_0x7a84('0x18')]()['table'](_0x7a84('0x71'))[_0x7a84('0x72')](_0x23d060)[_0x7a84('0x5c')]('id\x20=\x20?',_0x5bd9a1['params']['id'])['toParam']();return db['sequelize'][_0x7a84('0x22')](_0x2855dc[_0x7a84('0x73')],{'replacements':_0x2855dc[_0x7a84('0x74')]});}})[_0x7a84('0x19')](function(){if(_0x5bd9a1[_0x7a84('0x38')]['phone']&&_0x531b9e){return db['CmHopper'][_0x7a84('0x18')]({'phone':_0x5bd9a1['body'][_0x7a84('0x75')],'OrderBy':0x0},{'where':{'ContactId':_0x531b9e['id']}});}})[_0x7a84('0x19')](function(){return _0x531b9e;})['then'](respondWithResult(_0xe2eb20,null))[_0x7a84('0x24')](handleError(_0xe2eb20,null));};exports['getTags']=function(_0x3436ce,_0xbc1868){var _0x5c4199={};var _0x9c6f51={};var _0x4322d7;var _0x6222d3;return db[_0x7a84('0x25')][_0x7a84('0x76')]({'where':{'id':_0x3436ce[_0x7a84('0x27')]['id']}})[_0x7a84('0x19')](handleEntityNotFound(_0xbc1868,null))[_0x7a84('0x19')](function(_0x1fbf66){if(_0x1fbf66){_0x4322d7=_0x1fbf66;_0x9c6f51[_0x7a84('0x77')]=_['keys'](db[_0x7a84('0x63')]['rawAttributes']);_0x9c6f51['query']=_[_0x7a84('0x29')](_0x3436ce[_0x7a84('0x22')]);_0x9c6f51[_0x7a84('0x78')]=_['intersection'](_0x9c6f51[_0x7a84('0x77')],_0x9c6f51[_0x7a84('0x22')]);_0x5c4199[_0x7a84('0x79')]=_[_0x7a84('0x7a')](_0x9c6f51[_0x7a84('0x77')],qs['fields'](_0x3436ce[_0x7a84('0x22')]['fields']));_0x5c4199['attributes']=_0x5c4199['attributes'][_0x7a84('0x2a')]?_0x5c4199['attributes']:_0x9c6f51[_0x7a84('0x77')];_0x5c4199[_0x7a84('0x7b')]=qs[_0x7a84('0x7c')](_0x3436ce['query'][_0x7a84('0x7c')]);_0x5c4199['where']=qs[_0x7a84('0x78')](_['pick'](_0x3436ce['query'],_0x9c6f51[_0x7a84('0x78')]));if(_0x3436ce[_0x7a84('0x22')]['filter']){_0x5c4199[_0x7a84('0x5c')]=_['merge'](_0x5c4199[_0x7a84('0x5c')],{'$or':_['map'](_0x5c4199[_0x7a84('0x79')],function(_0x4e9404){var _0x562c39={};_0x562c39[_0x4e9404]={'$like':'%'+_0x3436ce[_0x7a84('0x22')][_0x7a84('0x7d')]+'%'};return _0x562c39;})});}_0x5c4199=_['merge']({},_0x5c4199,_0x3436ce[_0x7a84('0x7e')]);return _0x4322d7[_0x7a84('0x7f')](_0x5c4199);}})[_0x7a84('0x19')](function(_0x55b292){if(_0x55b292){_0x6222d3=_0x55b292[_0x7a84('0x2a')];if(!_0x3436ce[_0x7a84('0x22')][_0x7a84('0x36')](_0x7a84('0x80'))){_0x5c4199['limit']=qs[_0x7a84('0x15')](_0x3436ce[_0x7a84('0x22')][_0x7a84('0x15')]);_0x5c4199['offset']=qs[_0x7a84('0x13')](_0x3436ce[_0x7a84('0x22')][_0x7a84('0x13')]);}return _0x4322d7[_0x7a84('0x7f')](_0x5c4199);}})[_0x7a84('0x19')](function(_0x238b0){if(_0x238b0){return _0x238b0?{'count':_0x6222d3,'rows':_0x238b0}:null;}})[_0x7a84('0x19')](respondWithResult(_0xbc1868,null))[_0x7a84('0x24')](handleError(_0xbc1868,null));};exports[_0x7a84('0x81')]=function(_0xebd218,_0x46ddc1){if(_0xebd218['body']['id']){delete _0xebd218[_0x7a84('0x38')]['id'];}return db[_0x7a84('0x25')][_0x7a84('0x76')]({'where':{'id':_0xebd218[_0x7a84('0x27')]['id']}})[_0x7a84('0x19')](handleEntityNotFound(_0x46ddc1,null))[_0x7a84('0x19')](function(_0x5a8111){if(_0x5a8111){return _0x5a8111[_0x7a84('0x81')](_0xebd218[_0x7a84('0x38')][_0x7a84('0x82')]||[]);}return null;})[_0x7a84('0x19')](respondWithResult(_0x46ddc1,null))['catch'](handleError(_0x46ddc1,null));};exports[_0x7a84('0x83')]=function(_0x4cdd96,_0x119cce){var _0x195ff1=[];_0x195ff1[_0x7a84('0x5e')](addAdditionalPhones(_0x4cdd96[_0x7a84('0x38')]));Promise['all'](_0x195ff1)[_0x7a84('0x19')](function(){_0x195ff1=[];_0x195ff1[_0x7a84('0x5e')](deleteCmHopperPhones(_0x4cdd96[_0x7a84('0x38')]['id']));_0x195ff1[_0x7a84('0x5e')](addCmHopperPhones(_0x4cdd96[_0x7a84('0x38')]['id']));Promise['all'](_0x195ff1)['then'](function(){return[0x1];})['then'](respondWithResult(_0x119cce,null));});};function addAdditionalPhones(_0x33302b){var _0x304f01;return new Promise(function(_0x18f981){return db[_0x7a84('0x4b')][_0x7a84('0x1a')]({'where':{'CmContactId':_0x33302b['id']}})[_0x7a84('0x19')](function(){db['ContactItemType'][_0x7a84('0x21')]({'raw':!![],'attributes':['id',_0x7a84('0x84')]})[_0x7a84('0x19')](function(_0x25cb60){var _0x4d530b=[];for(var _0x541bc6=0x0;_0x541bc6<_0x33302b[_0x7a84('0x85')][_0x7a84('0x2a')];_0x541bc6++){var _0x5375d4=_0x33302b['item_types']?_['isNil'](_0x33302b['item_types'][_0x541bc6])?'':_0x33302b[_0x7a84('0x86')][_0x541bc6]:_0x33302b[_0x7a84('0x85')][_0x541bc6][_0x7a84('0x87')]?_0x33302b[_0x7a84('0x85')][_0x541bc6][_0x7a84('0x87')]:'';var _0x3761d5=_[_0x7a84('0x56')](_0x33302b[_0x7a84('0x85')][_0x541bc6][_0x7a84('0x88')])?'':_0x33302b[_0x7a84('0x85')][_0x541bc6][_0x7a84('0x88')];var _0x57bad7=_0x5375d4+':'+_0x33302b[_0x7a84('0x85')][_0x541bc6][_0x7a84('0x75')]+'§'+_0x3761d5;if(_[_0x7a84('0x56')](_0x304f01))_0x304f01=_0x57bad7;else _0x304f01+=';'+_0x57bad7;var _0xab947e=null;var _0x2dfb2c=null;if(_0x33302b[_0x7a84('0x86')]){if(!_[_0x7a84('0x56')](_0x33302b[_0x7a84('0x86')][_0x541bc6])){_0x2dfb2c=_['find'](_0x25cb60,function(_0x51038e){return _0x51038e['id']===_0x33302b[_0x7a84('0x86')][_0x541bc6];});if(!_[_0x7a84('0x56')](_0x2dfb2c)){_0xab947e=_0x2dfb2c[_0x7a84('0x84')];}}}else{if(!_[_0x7a84('0x56')](_0x33302b['items'][_0x541bc6])){_0x2dfb2c=_[_0x7a84('0x26')](_0x25cb60,function(_0x20e121){return _0x20e121['id']===_0x33302b[_0x7a84('0x85')][_0x541bc6][_0x7a84('0x87')];});if(!_[_0x7a84('0x56')](_0x2dfb2c)){_0xab947e=_0x541bc6;}}}if(_[_0x7a84('0x56')](_0xab947e)){_0xab947e=0x64;}_0x4d530b[_0x7a84('0x5e')](addAdditionalPhone(_0x33302b['id'],_0x33302b['items'][_0x541bc6]['phone'],_0x33302b[_0x7a84('0x86')]?_[_0x7a84('0x56')](_0x33302b[_0x7a84('0x86')][_0x541bc6])?null:_0x33302b['item_types'][_0x541bc6]:_0x33302b[_0x7a84('0x85')][_0x541bc6][_0x7a84('0x87')]?_0x33302b[_0x7a84('0x85')][_0x541bc6]['ItemTypeId']:null,_0xab947e,_0x3761d5));}Promise['all'](_0x4d530b)[_0x7a84('0x19')](function(){db[_0x7a84('0x25')][_0x7a84('0x18')]({'AdditionalPhones':_0x304f01},{'where':{'id':_0x33302b['id']}})[_0x7a84('0x19')](function(){_0x18f981(0x1);});});});});});}function addAdditionalPhone(_0x500348,_0x271a41,_0x307d5,_0x50cb32,_0x31b986){return db[_0x7a84('0x4b')][_0x7a84('0x26')]({'where':{'CmContactId':_0x500348,'item':_0x271a41}})[_0x7a84('0x19')](function(_0x50a511){if(_0x50a511)logger[_0x7a84('0x34')](_0x7a84('0x89'),_0x50a511);else{db[_0x7a84('0x4b')][_0x7a84('0x40')]({'CmContactId':_0x500348,'item':_0x271a41,'ItemTypeId':_0x307d5,'OrderBy':_0x50cb32,'ItemClass':_0x7a84('0x8a'),'description':_0x31b986});}});}function deleteCmHopperPhones(_0xdf7d66){return new Promise(function(_0x3dfe5f){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xdf7d66}})['then'](function(_0x4e5abf){db[_0x7a84('0x8b')][_0x7a84('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x7a84('0x6f')](_0x4e5abf,'id')}}});})[_0x7a84('0x19')](function(){_0x3dfe5f(0x1);});});}function addCmHopperPhones(_0xbd25ed){return new Promise(function(_0x16198f){return db[_0x7a84('0x3f')][_0x7a84('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xbd25ed}})[_0x7a84('0x19')](function(_0x4ec625){var _0x565383=[];_[_0x7a84('0x6f')](_0x4ec625,function(_0x9265f1){_0x565383['push'](createCmHopperPhone(_0xbd25ed,_0x9265f1['id']));});Promise[_0x7a84('0x61')](_0x565383)[_0x7a84('0x19')](function(){_0x16198f(0x1);});});});}function createCmHopperPhone(_0x1da529,_0x80b75a){return new Promise(function(_0x127755){db[_0x7a84('0x4b')]['findAll']({'raw':!![],'attributes':[_0x7a84('0x8c'),'OrderBy'],'where':{'CmContactId':_0x1da529,'ItemClass':_0x7a84('0x8a')},'include':[{'model':db[_0x7a84('0x67')],'attributes':[_0x7a84('0x84')],'as':'ItemType'}],'order':[_0x7a84('0x84'),db[_0x7a84('0x8d')]['literal'](_0x7a84('0x8e'))]})['then'](function(_0x4021f3){var _0x189ab2=0x1;var _0x44b4c7=_[_0x7a84('0x6f')](_0x4021f3,function(_0x516194){_0x516194[_0x7a84('0x8f')]=_0x80b75a;_0x516194[_0x7a84('0x75')]=_0x516194[_0x7a84('0x8c')];_0x516194[_0x7a84('0x84')]=_0x189ab2;delete _0x516194['ItemType.OrderBy'];_0x189ab2=_0x189ab2+0x1;return _0x516194;});return db[_0x7a84('0x8b')]['bulkCreate'](_0x44b4c7,{});})[_0x7a84('0x19')](function(){_0x127755(0x1);});});}function insertAdditionalPhones(_0x3ccf68,_0x5a3951){return new Promise(function(_0x3d9adb){var _0xb16a6f=[];for(var _0x3846dc=0x0;_0x3846dc<_0x5a3951[_0x7a84('0x2a')];_0x3846dc++){var _0x529a37=_0x5a3951[_0x3846dc];_0xb16a6f[_0x7a84('0x5e')](parseContactItemType(_0x529a37));}Promise['all'](_0xb16a6f)[_0x7a84('0x19')](function(){var _0xfa2a98={'id':_0x3ccf68['id'],'items':_0x5a3951};return addAdditionalPhones(_0xfa2a98)[_0x7a84('0x19')](function(){return addCmHopperPhones(_0x3ccf68['id']);});})['then'](function(){_0x3d9adb(_0x3ccf68);});});}function parseContactItemType(_0x1a58cd){return new Promise(function(_0x490809){if(_0x1a58cd['hasOwnProperty'](_0x7a84('0x87'))){_0x490809(_0x1a58cd);}else{return db[_0x7a84('0x67')][_0x7a84('0x26')]({'where':{'name':_0x1a58cd['ItemType']}})[_0x7a84('0x19')](function(_0x35ba1a){if(_[_0x7a84('0x56')](_0x35ba1a))_0x1a58cd[_0x7a84('0x87')]=null;else _0x1a58cd[_0x7a84('0x87')]=_0x35ba1a['id'];_0x490809(_0x1a58cd);});}});}exports[_0x7a84('0x90')]=function(_0x5911de,_0xe9ab0c){return db[_0x7a84('0x4b')][_0x7a84('0x21')]({'raw':!![],'where':{'CmContactId':_0x5911de['params']['id'],'ItemClass':_0x7a84('0x8a')},'include':[{'model':db[_0x7a84('0x67')],'as':_0x7a84('0x68')}],'order':[[_0x7a84('0x84')],[db[_0x7a84('0x8d')][_0x7a84('0x69')](_0x7a84('0x8e'))]]})['then'](function(_0xca1c2d){return _0xca1c2d;})[_0x7a84('0x19')](respondWithResult(_0xe9ab0c,null))['catch'](handleError(_0xe9ab0c,null));};exports[_0x7a84('0x91')]=function(_0x2dd79e,_0x22983c){return db[_0x7a84('0x4b')][_0x7a84('0x21')]({'raw':!![],'where':{'CmContactId':_0x2dd79e[_0x7a84('0x38')][_0x7a84('0x92')]}})[_0x7a84('0x19')](function(_0x27b738){var _0x3c12c3=_[_0x7a84('0x6f')](_0x27b738,function(_0xc04200){_0xc04200['CmContactId']=_0x2dd79e['body'][_0x7a84('0x93')];return _0xc04200;});return db['CmContactHasItem'][_0x7a84('0x94')](_0x3c12c3,{});})[_0x7a84('0x19')](function(){return addCmHopperPhones(_0x2dd79e['body'][_0x7a84('0x93')]);})[_0x7a84('0x19')](function(){return['ok'];})[_0x7a84('0x19')](respondWithResult(_0x22983c,null))[_0x7a84('0x24')](handleError(_0x22983c,null));};exports[_0x7a84('0x95')]=function(_0x4f8876,_0x5d64df){var _0x510a97=[];_0x510a97[_0x7a84('0x5e')](createCmHopperPhone(_0x4f8876['body']['id'],_0x4f8876[_0x7a84('0x38')]['hopperId']));Promise['all'](_0x510a97)['then'](function(){return[0x1];})[_0x7a84('0x19')](respondWithResult(_0x5d64df,null));};exports['getHoppers']=function(_0x32b884,_0x5aebd1){var _0x28d3a8={'raw':![],'where':{}};var _0x37fd1b={};var _0x1f2b04={'count':0x0,'rows':[]};return db[_0x7a84('0x25')][_0x7a84('0x76')]({'where':{'id':_0x32b884[_0x7a84('0x27')]['id']}})['then'](handleEntityNotFound(_0x5aebd1,null))[_0x7a84('0x19')](function(_0x11792b){if(_0x11792b){_0x37fd1b['model']=_[_0x7a84('0x29')](db[_0x7a84('0x3f')]['rawAttributes']);_0x37fd1b[_0x7a84('0x22')]=_[_0x7a84('0x29')](_0x32b884['query']);_0x37fd1b[_0x7a84('0x78')]=_[_0x7a84('0x7a')](_0x37fd1b[_0x7a84('0x77')],_0x37fd1b[_0x7a84('0x22')]);_0x28d3a8['attributes']=_[_0x7a84('0x7a')](_0x37fd1b[_0x7a84('0x77')],qs[_0x7a84('0x96')](_0x32b884['query'][_0x7a84('0x96')]));_0x28d3a8['attributes']=_0x28d3a8['attributes'][_0x7a84('0x2a')]?_0x28d3a8[_0x7a84('0x79')]:_0x37fd1b['model'];if(!_0x32b884['query'][_0x7a84('0x36')](_0x7a84('0x80'))){_0x28d3a8['limit']=qs[_0x7a84('0x15')](_0x32b884[_0x7a84('0x22')][_0x7a84('0x15')]);_0x28d3a8['offset']=qs[_0x7a84('0x13')](_0x32b884[_0x7a84('0x22')][_0x7a84('0x13')]);}_0x28d3a8[_0x7a84('0x7b')]=qs[_0x7a84('0x7c')](_0x32b884[_0x7a84('0x22')]['sort']);_0x28d3a8[_0x7a84('0x5c')]=qs[_0x7a84('0x78')](_[_0x7a84('0x97')](_0x32b884['query'],_0x37fd1b[_0x7a84('0x78')]));_0x28d3a8[_0x7a84('0x5c')]['ContactId']=_0x11792b['id'];if(_0x32b884['query'][_0x7a84('0x7d')]){_0x28d3a8['where']=_[_0x7a84('0x37')](_0x28d3a8['where'],{'$or':_[_0x7a84('0x6f')](_0x28d3a8[_0x7a84('0x79')],function(_0x10a742){var _0x150d92={};_0x150d92[_0x10a742]={'$like':'%'+_0x32b884[_0x7a84('0x22')]['filter']+'%'};return _0x150d92;})});}_0x28d3a8=_[_0x7a84('0x37')]({},_0x28d3a8,_0x32b884[_0x7a84('0x7e')]);return db[_0x7a84('0x3f')]['count']({'where':_0x28d3a8[_0x7a84('0x5c')]})['then'](function(_0x3e90bb){_0x1f2b04[_0x7a84('0x16')]=_0x3e90bb;if(_0x32b884[_0x7a84('0x22')]['includeAll']){_0x28d3a8[_0x7a84('0x98')]=[{'all':!![]}];}return db[_0x7a84('0x3f')][_0x7a84('0x21')](_0x28d3a8);})[_0x7a84('0x19')](function(_0x1ac623){_0x1f2b04['rows']=_0x1ac623;return _0x1f2b04;});}})[_0x7a84('0x19')](respondWithFilteredResult(_0x5aebd1,_0x28d3a8))[_0x7a84('0x24')](handleError(_0x5aebd1,null));};exports['getHopperHistories']=function(_0x5c8bce,_0x1cfc45){var _0xcd3a9e={'raw':!![],'where':{}};var _0x3e198c={};var _0x591229={'count':0x0,'rows':[]};return db[_0x7a84('0x25')][_0x7a84('0x76')]({'where':{'id':_0x5c8bce['params']['id']}})['then'](handleEntityNotFound(_0x1cfc45,null))[_0x7a84('0x19')](function(_0x595dfe){if(_0x595dfe){_0x3e198c['model']=_[_0x7a84('0x29')](db[_0x7a84('0x4c')][_0x7a84('0x99')]);_0x3e198c['query']=_[_0x7a84('0x29')](_0x5c8bce[_0x7a84('0x22')]);_0x3e198c[_0x7a84('0x78')]=_[_0x7a84('0x7a')](_0x3e198c[_0x7a84('0x77')],_0x3e198c[_0x7a84('0x22')]);_0xcd3a9e[_0x7a84('0x79')]=_[_0x7a84('0x7a')](_0x3e198c['model'],qs[_0x7a84('0x96')](_0x5c8bce[_0x7a84('0x22')]['fields']));_0xcd3a9e[_0x7a84('0x79')]=_0xcd3a9e[_0x7a84('0x79')][_0x7a84('0x2a')]?_0xcd3a9e[_0x7a84('0x79')]:_0x3e198c[_0x7a84('0x77')];if(!_0x5c8bce['query'][_0x7a84('0x36')](_0x7a84('0x80'))){_0xcd3a9e[_0x7a84('0x15')]=qs[_0x7a84('0x15')](_0x5c8bce[_0x7a84('0x22')][_0x7a84('0x15')]);_0xcd3a9e[_0x7a84('0x13')]=qs[_0x7a84('0x13')](_0x5c8bce[_0x7a84('0x22')][_0x7a84('0x13')]);}_0xcd3a9e[_0x7a84('0x7b')]=qs['sort'](_0x5c8bce[_0x7a84('0x22')]['sort']);_0xcd3a9e[_0x7a84('0x5c')]=qs[_0x7a84('0x78')](_[_0x7a84('0x97')](_0x5c8bce[_0x7a84('0x22')],_0x3e198c['filters']));_0xcd3a9e[_0x7a84('0x5c')]['ContactId']=_0x595dfe['id'];if(_0x5c8bce['query'][_0x7a84('0x7d')]){_0xcd3a9e[_0x7a84('0x5c')]=_[_0x7a84('0x37')](_0xcd3a9e[_0x7a84('0x5c')],{'$or':_[_0x7a84('0x6f')](_0xcd3a9e['attributes'],function(_0x5d18e4){var _0x221662={};_0x221662[_0x5d18e4]={'$like':'%'+_0x5c8bce[_0x7a84('0x22')][_0x7a84('0x7d')]+'%'};return _0x221662;})});}_0xcd3a9e=_[_0x7a84('0x37')]({},_0xcd3a9e,_0x5c8bce[_0x7a84('0x7e')]);return db[_0x7a84('0x4c')][_0x7a84('0x16')]({'where':_0xcd3a9e[_0x7a84('0x5c')]})[_0x7a84('0x19')](function(_0x464763){_0x591229[_0x7a84('0x16')]=_0x464763;if(_0x5c8bce[_0x7a84('0x22')]['includeAll']){_0xcd3a9e['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x7a84('0x21')](_0xcd3a9e);})['then'](function(_0x2a25a8){_0x591229['rows']=_0x2a25a8;return _0x591229;});}})[_0x7a84('0x19')](respondWithFilteredResult(_0x1cfc45,_0xcd3a9e))[_0x7a84('0x24')](handleError(_0x1cfc45,null));};exports[_0x7a84('0x9a')]=function(_0x1c7ab8,_0x59f238){var _0x318ec1={'raw':!![],'where':{}};var _0x54c564={};var _0x14f30b={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x1c7ab8[_0x7a84('0x27')]['id']}})['then'](handleEntityNotFound(_0x59f238,null))['then'](function(_0x248ab2){if(_0x248ab2){_0x54c564[_0x7a84('0x77')]=_[_0x7a84('0x29')](db['CmHopperFinal'][_0x7a84('0x99')]);_0x54c564['query']=_['keys'](_0x1c7ab8[_0x7a84('0x22')]);_0x54c564[_0x7a84('0x78')]=_[_0x7a84('0x7a')](_0x54c564[_0x7a84('0x77')],_0x54c564[_0x7a84('0x22')]);_0x318ec1[_0x7a84('0x79')]=_[_0x7a84('0x7a')](_0x54c564[_0x7a84('0x77')],qs[_0x7a84('0x96')](_0x1c7ab8[_0x7a84('0x22')][_0x7a84('0x96')]));_0x318ec1[_0x7a84('0x79')]=_0x318ec1[_0x7a84('0x79')]['length']?_0x318ec1[_0x7a84('0x79')]:_0x54c564[_0x7a84('0x77')];if(!_0x1c7ab8[_0x7a84('0x22')][_0x7a84('0x36')](_0x7a84('0x80'))){_0x318ec1[_0x7a84('0x15')]=qs['limit'](_0x1c7ab8['query'][_0x7a84('0x15')]);_0x318ec1['offset']=qs[_0x7a84('0x13')](_0x1c7ab8[_0x7a84('0x22')][_0x7a84('0x13')]);}_0x318ec1['order']=qs[_0x7a84('0x7c')](_0x1c7ab8[_0x7a84('0x22')]['sort']);_0x318ec1[_0x7a84('0x5c')]=qs['filters'](_[_0x7a84('0x97')](_0x1c7ab8['query'],_0x54c564[_0x7a84('0x78')]));_0x318ec1[_0x7a84('0x5c')][_0x7a84('0x9b')]=_0x248ab2['id'];if(_0x1c7ab8[_0x7a84('0x22')][_0x7a84('0x7d')]){_0x318ec1[_0x7a84('0x5c')]=_[_0x7a84('0x37')](_0x318ec1[_0x7a84('0x5c')],{'$or':_['map'](_0x318ec1['attributes'],function(_0x1a3136){var _0x28989e={};_0x28989e[_0x1a3136]={'$like':'%'+_0x1c7ab8[_0x7a84('0x22')][_0x7a84('0x7d')]+'%'};return _0x28989e;})});}_0x318ec1=_['merge']({},_0x318ec1,_0x1c7ab8[_0x7a84('0x7e')]);return db[_0x7a84('0x9c')][_0x7a84('0x16')]({'where':_0x318ec1['where']})[_0x7a84('0x19')](function(_0x429052){_0x14f30b[_0x7a84('0x16')]=_0x429052;if(_0x1c7ab8[_0x7a84('0x22')][_0x7a84('0x9d')]){_0x318ec1[_0x7a84('0x98')]=[{'all':!![]}];}return db[_0x7a84('0x9c')][_0x7a84('0x21')](_0x318ec1);})['then'](function(_0x7dcd64){_0x14f30b['rows']=_0x7dcd64;return _0x14f30b;});}})[_0x7a84('0x19')](respondWithFilteredResult(_0x59f238,_0x318ec1))[_0x7a84('0x24')](handleError(_0x59f238,null));};exports[_0x7a84('0x9e')]=function(_0x4f5af2,_0x27f1a0){var _0x3cbe38={'raw':!![],'where':{}};var _0x5846e4={};var _0x5e37e6={'count':0x0,'rows':[]};return db[_0x7a84('0x25')][_0x7a84('0x76')]({'where':{'id':_0x4f5af2['params']['id']}})[_0x7a84('0x19')](handleEntityNotFound(_0x27f1a0,null))['then'](function(_0x20917f){if(_0x20917f){_0x5846e4[_0x7a84('0x77')]=_[_0x7a84('0x29')](db[_0x7a84('0x54')][_0x7a84('0x99')]);_0x5846e4[_0x7a84('0x22')]=_[_0x7a84('0x29')](_0x4f5af2[_0x7a84('0x22')]);_0x5846e4[_0x7a84('0x78')]=_[_0x7a84('0x7a')](_0x5846e4[_0x7a84('0x77')],_0x5846e4[_0x7a84('0x22')]);_0x3cbe38[_0x7a84('0x79')]=_[_0x7a84('0x7a')](_0x5846e4[_0x7a84('0x77')],qs['fields'](_0x4f5af2[_0x7a84('0x22')][_0x7a84('0x96')]));_0x3cbe38[_0x7a84('0x79')]=_0x3cbe38[_0x7a84('0x79')][_0x7a84('0x2a')]?_0x3cbe38[_0x7a84('0x79')]:_0x5846e4[_0x7a84('0x77')];if(!_0x4f5af2[_0x7a84('0x22')][_0x7a84('0x36')](_0x7a84('0x80'))){_0x3cbe38[_0x7a84('0x15')]=qs[_0x7a84('0x15')](_0x4f5af2[_0x7a84('0x22')][_0x7a84('0x15')]);_0x3cbe38['offset']=qs['offset'](_0x4f5af2['query'][_0x7a84('0x13')]);}_0x3cbe38['order']=qs[_0x7a84('0x7c')](_0x4f5af2['query'][_0x7a84('0x7c')]);_0x3cbe38[_0x7a84('0x5c')]=qs['filters'](_[_0x7a84('0x97')](_0x4f5af2['query'],_0x5846e4[_0x7a84('0x78')]));_0x3cbe38[_0x7a84('0x5c')][_0x7a84('0x9b')]=_0x20917f['id'];if(_0x4f5af2[_0x7a84('0x22')][_0x7a84('0x7d')]){_0x3cbe38[_0x7a84('0x5c')]=_[_0x7a84('0x37')](_0x3cbe38[_0x7a84('0x5c')],{'$or':_['map'](_0x3cbe38[_0x7a84('0x79')],function(_0x206680){var _0x226ddd={};_0x226ddd[_0x206680]={'$like':'%'+_0x4f5af2[_0x7a84('0x22')][_0x7a84('0x7d')]+'%'};return _0x226ddd;})});}_0x3cbe38=_[_0x7a84('0x37')]({},_0x3cbe38,_0x4f5af2[_0x7a84('0x7e')]);return db['JscriptySessionReport'][_0x7a84('0x16')]({'where':_0x3cbe38['where']})[_0x7a84('0x19')](function(_0x41038a){_0x5e37e6[_0x7a84('0x16')]=_0x41038a;if(_0x4f5af2[_0x7a84('0x22')][_0x7a84('0x9d')]){_0x3cbe38[_0x7a84('0x98')]=[{'all':!![]}];}return db[_0x7a84('0x54')][_0x7a84('0x21')](_0x3cbe38);})['then'](function(_0x102c4d){_0x5e37e6['rows']=_0x102c4d;return _0x5e37e6;});}})[_0x7a84('0x19')](respondWithFilteredResult(_0x27f1a0,_0x3cbe38))[_0x7a84('0x24')](handleError(_0x27f1a0,null));};exports['uploadCsv']=function(_0x2914ea,_0x1980b0){try{if(!_0x2914ea['body'][_0x7a84('0x5f')]){throw new Error(_0x7a84('0x9f'));}if(!_0x2914ea[_0x7a84('0x38')][_0x7a84('0xa0')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x2914ea[_0x7a84('0x38')]['binding_values']){throw new Error(_0x7a84('0xa1'));}if(!_0x2914ea[_0x7a84('0x38')][_0x7a84('0xa2')]){throw new Error(_0x7a84('0xa3'));}var _0x20c50b=_0x2914ea[_0x7a84('0x38')][_0x7a84('0xa0')][_0x7a84('0xa4')](',');var _0x54f444=_0x2914ea[_0x7a84('0x38')][_0x7a84('0xa5')][_0x7a84('0xa4')](',');if(!_0x20c50b[_0x7a84('0x2a')]||!_0x54f444[_0x7a84('0x2a')]||_0x20c50b['length']!==_0x54f444[_0x7a84('0x2a')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x2914ea[_0x7a84('0x38')]['fields']=_[_0x7a84('0xa6')](_0x20c50b,_0x54f444);if(!_0x2914ea[_0x7a84('0x38')]['fields'][_0x7a84('0x75')]){throw new Error(_0x7a84('0xa7'));}if(!_0x2914ea[_0x7a84('0x38')][_0x7a84('0x96')]['firstName']){throw new Error(_0x7a84('0xa8'));}var _0x1004d2=path[_0x7a84('0x3d')](config[_0x7a84('0xa9')],'server/files/tmp',_0x2914ea['file'][_0x7a84('0xaa')]);fs[_0x7a84('0xab')](_0x1004d2,parseInt(_0x7a84('0xac'),0x8));var _0x336ff6=require(_0x7a84('0xad'))[_0x7a84('0xae')](path[_0x7a84('0x3d')](__dirname,'../../components/import/cm/csv'),[_0x1004d2,_0x2914ea['body'][_0x7a84('0xa0')],_0x2914ea[_0x7a84('0x38')][_0x7a84('0xa5')],_0x2914ea[_0x7a84('0x38')][_0x7a84('0x5f')],_0x2914ea[_0x7a84('0x38')][_0x7a84('0xaf')],_0x2914ea[_0x7a84('0x38')][_0x7a84('0x5b')],_0x2914ea['body'][_0x7a84('0xa2')]]);return _0x1980b0[_0x7a84('0x12')](0xc8)[_0x7a84('0x17')]({'message':_0x7a84('0xb0'),'pid':_0x336ff6[_0x7a84('0xb1')]});}catch(_0xcda4d6){return _0x1980b0['status'](0x1f4)[_0x7a84('0xb2')](_0xcda4d6);}};exports['upload']=function(_0x43abc1,_0x4297f2){var _0x3ee53f=fs[_0x7a84('0xb3')](_0x43abc1[_0x7a84('0xb4')]['path']);Papa[_0x7a84('0xb5')](_0x3ee53f,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x50e479){return _0x4297f2[_0x7a84('0x12')](0xc8)['json']({'file':_0x43abc1['file'],'fields':_0x50e479[_0x7a84('0xb6')][_0x7a84('0x96')]});}});};exports[_0x7a84('0xb7')]=function(_0x2c15ab,_0x133936){return db[_0x7a84('0xb8')][_0x7a84('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7a84('0xb9')}})[_0x7a84('0x19')](function(_0x1042d7){var _0x55587a=![];if(!_0x2c15ab[_0x7a84('0x38')][_0x7a84('0x5f')]){throw new Error(_0x7a84('0x9f'));}if(!_0x2c15ab[_0x7a84('0x38')][_0x7a84('0xba')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2c15ab['body'][_0x7a84('0xba')]['firstName']){throw new Error(_0x7a84('0xa8'));}if(!_0x2c15ab[_0x7a84('0x38')][_0x7a84('0xa2')]){throw new Error(_0x7a84('0xa3'));}var _0x12f3eb=require(_0x7a84('0xad'))[_0x7a84('0xae')](path[_0x7a84('0x3d')](__dirname,_0x7a84('0xbb')),[_0x2c15ab[_0x7a84('0x27')]['id'],JSON[_0x7a84('0xbc')](_0x2c15ab[_0x7a84('0x38')]),JSON[_0x7a84('0xbc')](_0x1042d7)]);_0x12f3eb['on'](_0x7a84('0xbd'),function(){_0x55587a=!![];return _0x133936[_0x7a84('0x12')](0xc8)[_0x7a84('0x17')]({'message':_0x7a84('0xbe'),'pid':_0x12f3eb[_0x7a84('0xb1')]});});_0x12f3eb['on'](_0x7a84('0xbf'),function(_0xc11f4d){if(_0xc11f4d&&!_0x55587a){return _0x133936['status'](0x1f4)[_0x7a84('0x17')]({'message':_0x7a84('0xc0'),'pid':_0x12f3eb[_0x7a84('0xb1')]});}});})[_0x7a84('0x24')](handleError(_0x133936,null));};exports[_0x7a84('0xc1')]=function(_0x475f59,_0x4ca786){return db['User'][_0x7a84('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x7a84('0x19')](function(_0x4d1368){var _0x456183=![];if(!_0x475f59['body'][_0x7a84('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x475f59[_0x7a84('0x38')][_0x7a84('0xba')][_0x7a84('0x75')]){throw new Error(_0x7a84('0xa7'));}if(!_0x475f59[_0x7a84('0x38')]['binding']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x475f59[_0x7a84('0x38')][_0x7a84('0xa2')]){throw new Error(_0x7a84('0xa3'));}var _0x1d2bc1=require(_0x7a84('0xad'))[_0x7a84('0xae')](path[_0x7a84('0x3d')](__dirname,'../../components/import/cm/csvUpdates'),[_0x475f59[_0x7a84('0x27')]['id'],JSON[_0x7a84('0xbc')](_0x475f59[_0x7a84('0x38')]),JSON[_0x7a84('0xbc')](_0x4d1368)]);_0x1d2bc1['on'](_0x7a84('0xbd'),function(){_0x456183=!![];return _0x4ca786[_0x7a84('0x12')](0xc8)[_0x7a84('0x17')]({'message':_0x7a84('0xbe'),'pid':_0x1d2bc1['pid']});});_0x1d2bc1['on']('exit',function(_0x2c3c18){if(_0x2c3c18&&!_0x456183){return _0x4ca786['status'](0x1f4)[_0x7a84('0x17')]({'message':_0x7a84('0xc0'),'pid':_0x1d2bc1[_0x7a84('0xb1')]});}});})[_0x7a84('0x24')](handleError(_0x4ca786,null));};exports[_0x7a84('0xc2')]=function(_0x216d15,_0xf29b5){var _0x226210=['mail',_0x7a84('0xc3'),'sms','openchannel',_0x7a84('0xc4'),'whatsapp',_0x7a84('0xc5')];var _0x3c3f60={'offset':0x0,'order':qs['sort'](_0x7a84('0xc6'))},_0x5e5fd8={'count':0x0,'rows':[]};Promise[_0x7a84('0xc7')]()[_0x7a84('0x19')](function(){if(_0x216d15[_0x7a84('0x22')][_0x7a84('0xc8')]){if(!_[_0x7a84('0xc9')](_0x226210,_0x216d15[_0x7a84('0x22')][_0x7a84('0xc8')][_0x7a84('0xca')]())){throw new Error(_0x7a84('0xcb'));}_0x226210=[_0x216d15[_0x7a84('0x22')][_0x7a84('0xc8')]['toLowerCase']()];}if(_0x216d15[_0x7a84('0x22')][_0x7a84('0xcc')]){try{var _0x3c004f=JSON[_0x7a84('0xb5')](_0x216d15[_0x7a84('0x22')]['range']);if(!moment(_0x3c004f['from'])[_0x7a84('0xcd')]()){throw new Error(_0x7a84('0xce'));}if(!moment(_0x3c004f['to'])['isValid']()){throw new Error(_0x7a84('0xcf'));}}catch(_0x96f683){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x216d15['query'][_0x7a84('0x36')]('nolimit')){_0x3c3f60[_0x7a84('0x15')]=qs[_0x7a84('0x15')](_0x216d15['query'][_0x7a84('0x15')]||0xa);_0x3c3f60[_0x7a84('0x13')]=qs[_0x7a84('0x13')](_0x216d15[_0x7a84('0x22')][_0x7a84('0x13')]);}var _0x50133f=_0x226210[_0x7a84('0x6f')](function(_0x2961df){if(_0x2961df===_0x7a84('0xc5')){var _0x1805df={'attributes':['id','uniqueid','type',_0x7a84('0xd0'),'destination',_0x7a84('0xd1'),'starttime',_0x7a84('0xd2'),_0x7a84('0xd3'),'note',_0x7a84('0xd4'),_0x7a84('0xd5'),'userSecondDisposition',_0x7a84('0xd6'),_0x7a84('0xd7')],'where':{'ContactId':_0x216d15['params']['id']},'include':[{'model':db[_0x7a84('0xb8')],'as':_0x7a84('0xb8'),'attributes':['id','name',_0x7a84('0xd8'),_0x7a84('0x31')]}],'order':[[_0x7a84('0xd4'),_0x7a84('0xd9')]]};if(_0x216d15[_0x7a84('0x22')]['range']){_0x1805df[_0x7a84('0x5c')][_0x7a84('0xd4')]={'$gte':_0x3c004f[_0x7a84('0x39')],'$lte':_0x3c004f['to']};}return db[_0x7a84('0x4e')][_0x7a84('0xda')](_0x1805df)[_0x7a84('0x19')](function(_0x26b8c3){_0x5e5fd8[_0x7a84('0x16')]+=_0x26b8c3['count'];return _[_0x7a84('0x6f')](_0x26b8c3['rows'],function(_0x403fb1){var _0x1b0a93=_0x403fb1[_0x7a84('0x3a')]({'plain':!![]});_0x1b0a93[_0x7a84('0xc8')]=_0x2961df;if(_0x1b0a93[_0x7a84('0xb8')]){_0x1b0a93[_0x7a84('0xb8')]={'id':_0x1b0a93['User']['id'],'name':_0x1b0a93['User'][_0x7a84('0x1e')],'fullname':_0x1b0a93[_0x7a84('0xb8')][_0x7a84('0xd8')],'alias':_0x1b0a93[_0x7a84('0xb8')][_0x7a84('0x31')]};}return _0x1b0a93;});});}else{var _0x511cd8=_[_0x7a84('0xdb')](_0x2961df)+(_0x2961df===_0x7a84('0xc3')?'Website':_0x7a84('0xdc'));var _0x3fc81b={'attributes':['id',_0x7a84('0xdd'),_0x7a84('0xde'),'createdAt',_0x7a84('0xdf'),_0x7a84('0xe0'),_0x7a84('0xe1'),'thirdDisposition',_0x7a84('0xd7'),_0x511cd8+'Id'],'where':{'ContactId':_0x216d15[_0x7a84('0x27')]['id']},'include':[{'model':db[_0x511cd8],'as':_0x7a84('0xdc'),'attributes':['id',_0x7a84('0x1e'),_0x7a84('0xe2')]},{'model':db[_0x7a84('0xb8')],'as':'Owner','attributes':['id','name','fullname']},{'model':db['Tag'],'as':_0x7a84('0xe3'),'attributes':['id','name',_0x7a84('0x64')],'through':{'attributes':[]}}],'order':[['createdAt',_0x7a84('0xd9')]]};if(_0x216d15[_0x7a84('0x22')]['range']){_0x3fc81b[_0x7a84('0x5c')][_0x7a84('0xd4')]={'$gte':_0x3c004f[_0x7a84('0x39')],'$lte':_0x3c004f['to']};}switch(_0x2961df){case'chat':_0x3fc81b['attributes'][_0x7a84('0x5e')]('browserName',_0x7a84('0xe4'),'customerPort',_0x7a84('0xe5'),_0x7a84('0xe6'),_0x7a84('0xe7'),_0x7a84('0xe8'),'ratingValue','referer');break;case _0x7a84('0xe9'):_0x3fc81b[_0x7a84('0x79')][_0x7a84('0x5e')]('subject',_0x7a84('0xea'));break;case _0x7a84('0xeb'):_0x3fc81b['attributes']['push'](_0x7a84('0xec'),_0x7a84('0xed'));break;}return db[_[_0x7a84('0xdb')](_0x2961df)+_0x7a84('0xee')]['findAndCountAll'](_0x3fc81b)[_0x7a84('0x19')](function(_0x45aa9c){_0x5e5fd8[_0x7a84('0x16')]+=_0x45aa9c[_0x7a84('0x16')];return _[_0x7a84('0x6f')](_0x45aa9c[_0x7a84('0xef')],function(_0xbbbdf0){var _0x1585cc=_0xbbbdf0[_0x7a84('0x3a')]({'plain':!![]});_0x1585cc[_0x7a84('0xc8')]=_0x2961df;if(_0x1585cc[_0x7a84('0xf0')]){_0x1585cc[_0x7a84('0xf0')]={'id':_0x1585cc[_0x7a84('0xf0')]['id'],'name':_0x1585cc[_0x7a84('0xf0')][_0x7a84('0x1e')],'fullname':_0x1585cc[_0x7a84('0xf0')][_0x7a84('0xd8')]};}return _0x1585cc;});});}});return Promise[_0x7a84('0x61')](_0x50133f);})['then'](function(_0x149408){return _(_0x149408)[_0x7a84('0xf1')]()[_0x7a84('0xf2')](_0x7a84('0xd4'))[_0x7a84('0xf3')]()['value']();})[_0x7a84('0x19')](function(_0x4bb33a){_0x5e5fd8['rows']=_0x3c3f60['limit']?_0x4bb33a[_0x7a84('0xf4')](_0x3c3f60['offset'],_0x3c3f60[_0x7a84('0x13')]+_0x3c3f60['limit']):_0x4bb33a;return _0x5e5fd8;})[_0x7a84('0x19')](respondWithFilteredResult(_0xf29b5,_0x3c3f60))['catch'](handleError(_0xf29b5,null));}; \ No newline at end of file +var _0x90dd=['No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','pid','upload','createReadStream','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','message','mail','chat','openchannel','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','disposition','secondDisposition','key','DESC','customerIp','customerPort','ratingMessage','ratingValue','referer','subject','substatus','threadId','Interaction','Owner','reverse','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','register','json','offset','undefined','limit','set','Content-Range','update','then','destroy','status','end','sendStatus','error','stack','name','send','describe','getOptions','query','user','catch','CmContact','find','params','length','keys','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','all','show','Tag','color','Phones','ContactItemType','ItemType','sequelize','literal','$and','cf_%d','pickBy','startsWith','cf_','map','isEmpty','table','cm_contacts','setFields','text','phone','findOne','rawAttributes','filters','intersection','model','attributes','fields','sort','pick','filter','merge','options','getTags','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','item','`ItemType`.OrderBy','ItemType.OrderBy','CmHopperAdditionalPhone','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','ContactId','count','includeAll','include','rows','getHopperHistories','nolimit','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x90dd,0x14b));var _0xd90d=function(_0x44555c,_0x12e94e){_0x44555c=_0x44555c-0x0;var _0x35d208=_0x90dd[_0x44555c];return _0x35d208;};'use strict';var moment=require(_0xd90d('0x0'));var BPromise=require(_0xd90d('0x1'));var util=require(_0xd90d('0x2'));var path=require(_0xd90d('0x3'));var fs=require('fs');var _=require(_0xd90d('0x4'));var squel=require(_0xd90d('0x5'));var Papa=require(_0xd90d('0x6'));var Redis=require(_0xd90d('0x7'));var contacts=require(_0xd90d('0x8'));var qs=require(_0xd90d('0x9'));var logger=require(_0xd90d('0xa'))(_0xd90d('0xb'));var config=require('../../config/environment');var shared=require(_0xd90d('0xc'));var db=require(_0xd90d('0xd'))['db'];config[_0xd90d('0xe')]=_['defaults'](config[_0xd90d('0xe')],{'host':_0xd90d('0xf'),'port':0x18eb});var socket=require(_0xd90d('0x10'))(new Redis(config['redis']));require('./cmContact.socket')[_0xd90d('0x11')](socket);function respondWithResult(_0x27dd44,_0x1e3288){_0x1e3288=_0x1e3288||0xc8;return function(_0x212c9d){if(_0x212c9d){return _0x27dd44['status'](_0x1e3288)[_0xd90d('0x12')](_0x212c9d);}};}function respondWithFilteredResult(_0x4c6554,_0xf46d5a){return function(_0x196084){if(_0x196084){var _0x281f66=typeof _0xf46d5a[_0xd90d('0x13')]===_0xd90d('0x14')&&typeof _0xf46d5a[_0xd90d('0x15')]==='undefined';var _0x3d593e=_0x196084['count'];var _0x52792e=_0x281f66?0x0:_0xf46d5a[_0xd90d('0x13')];var _0x3e4da9=_0x281f66?_0x196084['count']:_0xf46d5a[_0xd90d('0x13')]+_0xf46d5a[_0xd90d('0x15')];var _0x313812;if(_0x3e4da9>=_0x3d593e){_0x3e4da9=_0x3d593e;_0x313812=0xc8;}else{_0x313812=0xce;}_0x4c6554['status'](_0x313812);return _0x4c6554[_0xd90d('0x16')](_0xd90d('0x17'),_0x52792e+'-'+_0x3e4da9+'/'+_0x3d593e)[_0xd90d('0x12')](_0x196084);}return null;};}function saveUpdates(_0x60d07){return function(_0x46d733){if(_0x46d733){return _0x46d733[_0xd90d('0x18')](_0x60d07)[_0xd90d('0x19')](function(_0x3c99e7){return _0x3c99e7;});}return null;};}function removeEntity(_0x2cd2b3){return function(_0x4f72ef){if(_0x4f72ef){return _0x4f72ef[_0xd90d('0x1a')]()['then'](function(){_0x2cd2b3[_0xd90d('0x1b')](0xcc)[_0xd90d('0x1c')]();});}};}function handleEntityNotFound(_0x3d44e0){return function(_0x3f6a2b){if(!_0x3f6a2b){_0x3d44e0[_0xd90d('0x1d')](0x194);}return _0x3f6a2b;};}function handleError(_0x6754b1,_0x278299){_0x278299=_0x278299||0x1f4;return function(_0x302f1c){logger[_0xd90d('0x1e')](_0x302f1c[_0xd90d('0x1f')]);if(_0x302f1c[_0xd90d('0x20')]){delete _0x302f1c[_0xd90d('0x20')];}_0x6754b1['status'](_0x278299)[_0xd90d('0x21')](_0x302f1c);};}exports['index']=function(_0x50ec45,_0x34f071){var _0x4b949e={};return contacts[_0xd90d('0x22')]()[_0xd90d('0x19')](function(_0x5cfa22){_0x4b949e=qs[_0xd90d('0x23')](_0x5cfa22,_0x50ec45);return contacts['findAll'](_0x50ec45[_0xd90d('0x24')],_0x50ec45[_0xd90d('0x25')],_0x4b949e,_0x5cfa22);})[_0xd90d('0x19')](respondWithFilteredResult(_0x34f071,_0x4b949e))[_0xd90d('0x26')](handleError(_0x34f071,null));};exports[_0xd90d('0x1a')]=function(_0x1b6748,_0x1d63ae){return db[_0xd90d('0x27')][_0xd90d('0x28')]({'where':{'id':_0x1b6748[_0xd90d('0x29')]['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x1d63ae,null))[_0xd90d('0x19')](removeEntity(_0x1d63ae,null))[_0xd90d('0x26')](handleError(_0x1d63ae,null));};exports['describe']=function(_0xfc4749,_0x316825){return db[_0xd90d('0x27')][_0xd90d('0x22')]()[_0xd90d('0x19')](function(_0x2d4f5c){delete _0x2d4f5c['tags'];for(var _0xe52873=0x0;_0xe528730x0){return new Promise(function(_0x30c004){var _0x1e4f5c=[];for(var _0x54d8be=0x0;_0x54d8be<_0x477ffd[_0xd90d('0x2a')];_0x54d8be++){_0x1e4f5c[_0xd90d('0x67')](insertAdditionalPhones(_0x477ffd[_0x54d8be][_0xd90d('0x68')],_0x477ffd[_0x54d8be][_0xd90d('0x5e')]));}Promise[_0xd90d('0x69')](_0x1e4f5c)[_0xd90d('0x19')](function(){_0x30c004(0x1);});})['then'](function(){return{'success':_0x6f5332,'failure':_0x13bc39,'duplicates':_0x104338};});}else{return{'success':_0x6f5332,'failure':_0x13bc39,'duplicates':_0x104338};}}})['then'](respondWithResult(_0x33bb20,0xc9))[_0xd90d('0x26')](handleError(_0x33bb20,null));};exports[_0xd90d('0x6a')]=function(_0x206597,_0x147799){var _0x11f2f8;return db['CmContact'][_0xd90d('0x22')]()['then'](function(_0x429637){return db[_0xd90d('0x27')][_0xd90d('0x28')]({'where':{'id':_0x206597['params']['id']},'include':[{'model':db[_0xd90d('0x6b')],'as':'Tags','attributes':['id',_0xd90d('0x20'),_0xd90d('0x6c')],'required':_0x206597[_0xd90d('0x24')]['tag']?!![]:![]},{'model':db[_0xd90d('0x4e')],'as':_0xd90d('0x6d'),'where':{'CmContactId':_0x206597[_0xd90d('0x29')]['id']},'required':![],'include':[{'model':db[_0xd90d('0x6e')],'as':_0xd90d('0x6f')}]}],'order':[db[_0xd90d('0x70')][_0xd90d('0x71')]('Phones.OrderBy')],'attributes':_[_0xd90d('0x2b')](_0x429637)});})[_0xd90d('0x19')](function(_0x2f346e){if(!_[_0xd90d('0x5a')](_0x2f346e)){_0x11f2f8=_0x2f346e[_0xd90d('0x3a')]({'plain':!![]});var _0x288f55={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f346e&&_0x2f346e[_0xd90d('0x64')]){if(_0x2f346e['ListId']){_0x288f55[_0xd90d('0x62')][_0xd90d('0x72')][_0xd90d('0x67')]({'ListId':{'$ne':_0x2f346e[_0xd90d('0x64')]}});}}return db[_0xd90d('0x2f')][_0xd90d('0x30')](_0x288f55);}})[_0xd90d('0x19')](function(_0x17a4fe){if(!_[_0xd90d('0x5a')](_0x17a4fe)){return _['omit'](_0x11f2f8,_['map'](_0x17a4fe,function(_0x1cc0f8){return util['format'](_0xd90d('0x73'),_0x1cc0f8['id']);}));}})['then'](handleEntityNotFound(_0x147799,null))[_0xd90d('0x19')](respondWithResult(_0x147799,null))[_0xd90d('0x26')](handleError(_0x147799,null));};exports[_0xd90d('0x18')]=function(_0xb1564f,_0x5330dd){var _0x20eada;if(_0xb1564f[_0xd90d('0x38')]['id']){delete _0xb1564f[_0xd90d('0x38')]['id'];}if(!_['isNil'](_0xb1564f[_0xd90d('0x38')]['dialTimezone'])){var _0xc74dcb=_0xb1564f['body'][_0xd90d('0x5b')];if(!_[_0xd90d('0x5a')](shared[_0xd90d('0x5c')][_0xc74dcb]))_0xb1564f[_0xd90d('0x38')][_0xd90d('0x5d')]=shared['timezones'][_0xc74dcb]['utcOffset'];}return db[_0xd90d('0x27')][_0xd90d('0x28')]({'where':{'id':_0xb1564f[_0xd90d('0x29')]['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x5330dd,null))[_0xd90d('0x19')](saveUpdates(_0xb1564f[_0xd90d('0x38')],null))[_0xd90d('0x19')](function(_0x3c508e){_0x20eada=_0x3c508e;var _0x11c267={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3c508e&&_0x3c508e[_0xd90d('0x64')]){if(_0x3c508e[_0xd90d('0x64')]){_0x11c267[_0xd90d('0x62')][_0xd90d('0x72')][_0xd90d('0x67')]({'ListId':{'$ne':_0x3c508e['ListId']}});}}return db[_0xd90d('0x2f')][_0xd90d('0x30')](_0x11c267);})[_0xd90d('0x19')](function(_0x547590){if(_0x547590){return _['omit'](_[_0xd90d('0x74')](_0xb1564f['body'],function(_0x1091b2,_0x770c4){return _[_0xd90d('0x75')](_0x770c4,_0xd90d('0x76'));}),_[_0xd90d('0x77')](_0x547590,function(_0x24457f){return util['format'](_0xd90d('0x73'),_0x24457f['id']);}));}})[_0xd90d('0x19')](function(_0x50f9d0){if(_0x50f9d0&&!_[_0xd90d('0x78')](_0x50f9d0)){var _0x400f1f=squel[_0xd90d('0x18')]()[_0xd90d('0x79')](_0xd90d('0x7a'))[_0xd90d('0x7b')](_0x50f9d0)[_0xd90d('0x62')]('id\x20=\x20?',_0xb1564f[_0xd90d('0x29')]['id'])['toParam']();return db[_0xd90d('0x70')][_0xd90d('0x24')](_0x400f1f[_0xd90d('0x7c')],{'replacements':_0x400f1f[_0xd90d('0x34')]});}})[_0xd90d('0x19')](function(){if(_0xb1564f[_0xd90d('0x38')][_0xd90d('0x7d')]&&_0x20eada){return db[_0xd90d('0x40')][_0xd90d('0x18')]({'phone':_0xb1564f[_0xd90d('0x38')][_0xd90d('0x7d')],'OrderBy':0x0},{'where':{'ContactId':_0x20eada['id']}});}})['then'](function(){return _0x20eada;})['then'](respondWithResult(_0x5330dd,null))[_0xd90d('0x26')](handleError(_0x5330dd,null));};exports['getTags']=function(_0xf601d5,_0x993d89){var _0xa00168={};var _0x2385e3={};var _0x3c6bcc;var _0x5a51c5;return db[_0xd90d('0x27')][_0xd90d('0x7e')]({'where':{'id':_0xf601d5[_0xd90d('0x29')]['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x993d89,null))['then'](function(_0x23e6b9){if(_0x23e6b9){_0x3c6bcc=_0x23e6b9;_0x2385e3['model']=_[_0xd90d('0x2b')](db[_0xd90d('0x6b')][_0xd90d('0x7f')]);_0x2385e3[_0xd90d('0x24')]=_[_0xd90d('0x2b')](_0xf601d5['query']);_0x2385e3[_0xd90d('0x80')]=_[_0xd90d('0x81')](_0x2385e3[_0xd90d('0x82')],_0x2385e3['query']);_0xa00168[_0xd90d('0x83')]=_[_0xd90d('0x81')](_0x2385e3['model'],qs[_0xd90d('0x84')](_0xf601d5[_0xd90d('0x24')]['fields']));_0xa00168['attributes']=_0xa00168[_0xd90d('0x83')][_0xd90d('0x2a')]?_0xa00168[_0xd90d('0x83')]:_0x2385e3[_0xd90d('0x82')];_0xa00168['order']=qs[_0xd90d('0x85')](_0xf601d5['query'][_0xd90d('0x85')]);_0xa00168[_0xd90d('0x62')]=qs[_0xd90d('0x80')](_[_0xd90d('0x86')](_0xf601d5[_0xd90d('0x24')],_0x2385e3['filters']));if(_0xf601d5[_0xd90d('0x24')][_0xd90d('0x87')]){_0xa00168[_0xd90d('0x62')]=_['merge'](_0xa00168[_0xd90d('0x62')],{'$or':_[_0xd90d('0x77')](_0xa00168[_0xd90d('0x83')],function(_0x92257c){var _0x40f68a={};_0x40f68a[_0x92257c]={'$like':'%'+_0xf601d5[_0xd90d('0x24')][_0xd90d('0x87')]+'%'};return _0x40f68a;})});}_0xa00168=_[_0xd90d('0x88')]({},_0xa00168,_0xf601d5[_0xd90d('0x89')]);return _0x3c6bcc[_0xd90d('0x8a')](_0xa00168);}})['then'](function(_0x5dd0b5){if(_0x5dd0b5){_0x5a51c5=_0x5dd0b5[_0xd90d('0x2a')];if(!_0xf601d5['query'][_0xd90d('0x37')]('nolimit')){_0xa00168[_0xd90d('0x15')]=qs['limit'](_0xf601d5[_0xd90d('0x24')]['limit']);_0xa00168[_0xd90d('0x13')]=qs['offset'](_0xf601d5['query'][_0xd90d('0x13')]);}return _0x3c6bcc['getTags'](_0xa00168);}})[_0xd90d('0x19')](function(_0x4234dd){if(_0x4234dd){return _0x4234dd?{'count':_0x5a51c5,'rows':_0x4234dd}:null;}})[_0xd90d('0x19')](respondWithResult(_0x993d89,null))[_0xd90d('0x26')](handleError(_0x993d89,null));};exports[_0xd90d('0x8b')]=function(_0x478013,_0x1c8df0){if(_0x478013[_0xd90d('0x38')]['id']){delete _0x478013['body']['id'];}return db[_0xd90d('0x27')]['findOne']({'where':{'id':_0x478013[_0xd90d('0x29')]['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x1c8df0,null))[_0xd90d('0x19')](function(_0x24ed0d){if(_0x24ed0d){return _0x24ed0d[_0xd90d('0x8b')](_0x478013[_0xd90d('0x38')]['ids']||[]);}return null;})['then'](respondWithResult(_0x1c8df0,null))[_0xd90d('0x26')](handleError(_0x1c8df0,null));};exports[_0xd90d('0x8c')]=function(_0x39cf10,_0x246c32){var _0x5ed2dd=[];_0x5ed2dd['push'](addAdditionalPhones(_0x39cf10[_0xd90d('0x38')]));Promise[_0xd90d('0x69')](_0x5ed2dd)[_0xd90d('0x19')](function(){_0x5ed2dd=[];_0x5ed2dd[_0xd90d('0x67')](deleteCmHopperPhones(_0x39cf10['body']['id']));_0x5ed2dd[_0xd90d('0x67')](addCmHopperPhones(_0x39cf10[_0xd90d('0x38')]['id']));Promise[_0xd90d('0x69')](_0x5ed2dd)[_0xd90d('0x19')](function(){return[0x1];})[_0xd90d('0x19')](respondWithResult(_0x246c32,null));});};function addAdditionalPhones(_0x5350a9){var _0x1d410f;return new Promise(function(_0x395aeb){return db[_0xd90d('0x4e')][_0xd90d('0x1a')]({'where':{'CmContactId':_0x5350a9['id']}})[_0xd90d('0x19')](function(){db[_0xd90d('0x6e')]['findAll']({'raw':!![],'attributes':['id',_0xd90d('0x8d')]})[_0xd90d('0x19')](function(_0x5674f7){var _0x5eeea9=[];for(var _0x5168cf=0x0;_0x5168cf<_0x5350a9[_0xd90d('0x8e')]['length'];_0x5168cf++){var _0x4efcf9=_0x5350a9[_0xd90d('0x8f')]?_[_0xd90d('0x5a')](_0x5350a9[_0xd90d('0x8f')][_0x5168cf])?'':_0x5350a9[_0xd90d('0x8f')][_0x5168cf]:_0x5350a9['items'][_0x5168cf][_0xd90d('0x90')]?_0x5350a9[_0xd90d('0x8e')][_0x5168cf][_0xd90d('0x90')]:'';var _0x5100fe=_[_0xd90d('0x5a')](_0x5350a9[_0xd90d('0x8e')][_0x5168cf][_0xd90d('0x91')])?'':_0x5350a9['items'][_0x5168cf]['description'];var _0x3057d8=_0x4efcf9+':'+_0x5350a9[_0xd90d('0x8e')][_0x5168cf][_0xd90d('0x7d')]+'§'+_0x5100fe;if(_[_0xd90d('0x5a')](_0x1d410f))_0x1d410f=_0x3057d8;else _0x1d410f+=';'+_0x3057d8;var _0x1dfb6c=null;var _0x319c31=null;if(_0x5350a9[_0xd90d('0x8f')]){if(!_[_0xd90d('0x5a')](_0x5350a9['item_types'][_0x5168cf])){_0x319c31=_[_0xd90d('0x28')](_0x5674f7,function(_0x539712){return _0x539712['id']===_0x5350a9[_0xd90d('0x8f')][_0x5168cf];});if(!_[_0xd90d('0x5a')](_0x319c31)){_0x1dfb6c=_0x319c31[_0xd90d('0x8d')];}}}else{if(!_['isNil'](_0x5350a9['items'][_0x5168cf])){_0x319c31=_[_0xd90d('0x28')](_0x5674f7,function(_0x7acb89){return _0x7acb89['id']===_0x5350a9[_0xd90d('0x8e')][_0x5168cf][_0xd90d('0x90')];});if(!_[_0xd90d('0x5a')](_0x319c31)){_0x1dfb6c=_0x5168cf;}}}if(_['isNil'](_0x1dfb6c)){_0x1dfb6c=0x64;}_0x5eeea9[_0xd90d('0x67')](addAdditionalPhone(_0x5350a9['id'],_0x5350a9['items'][_0x5168cf][_0xd90d('0x7d')],_0x5350a9[_0xd90d('0x8f')]?_['isNil'](_0x5350a9[_0xd90d('0x8f')][_0x5168cf])?null:_0x5350a9[_0xd90d('0x8f')][_0x5168cf]:_0x5350a9[_0xd90d('0x8e')][_0x5168cf][_0xd90d('0x90')]?_0x5350a9['items'][_0x5168cf][_0xd90d('0x90')]:null,_0x1dfb6c,_0x5100fe));}Promise[_0xd90d('0x69')](_0x5eeea9)['then'](function(){db[_0xd90d('0x27')][_0xd90d('0x18')]({'AdditionalPhones':_0x1d410f},{'where':{'id':_0x5350a9['id']}})[_0xd90d('0x19')](function(){_0x395aeb(0x1);});});});});});}function addAdditionalPhone(_0x32855c,_0x408f98,_0x3e8f46,_0x18c1d8,_0x133e58){return db['CmContactHasItem'][_0xd90d('0x28')]({'where':{'CmContactId':_0x32855c,'item':_0x408f98}})['then'](function(_0x4dc673){if(_0x4dc673)logger['info']('contact\x20phone\x20exists',_0x4dc673);else{db['CmContactHasItem'][_0xd90d('0x43')]({'CmContactId':_0x32855c,'item':_0x408f98,'ItemTypeId':_0x3e8f46,'OrderBy':_0x18c1d8,'ItemClass':_0xd90d('0x92'),'description':_0x133e58});}});}function deleteCmHopperPhones(_0xdfcc54){return new Promise(function(_0x227120){return db['CmHopper'][_0xd90d('0x30')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xdfcc54}})[_0xd90d('0x19')](function(_0x24458b){db['CmHopperAdditionalPhone'][_0xd90d('0x1a')]({'where':{'CmHopperId':{'$in':_['map'](_0x24458b,'id')}}});})[_0xd90d('0x19')](function(){_0x227120(0x1);});});}function addCmHopperPhones(_0x30b76e){return new Promise(function(_0xcc959e){return db[_0xd90d('0x40')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x30b76e}})[_0xd90d('0x19')](function(_0x2bcc55){var _0x313efd=[];_[_0xd90d('0x77')](_0x2bcc55,function(_0x4a92df){_0x313efd['push'](createCmHopperPhone(_0x30b76e,_0x4a92df['id']));});Promise['all'](_0x313efd)[_0xd90d('0x19')](function(){_0xcc959e(0x1);});});});}function createCmHopperPhone(_0x4a4469,_0x4db487){return new Promise(function(_0x4e65c1){db[_0xd90d('0x4e')][_0xd90d('0x30')]({'raw':!![],'attributes':[_0xd90d('0x93'),'OrderBy'],'where':{'CmContactId':_0x4a4469,'ItemClass':_0xd90d('0x92')},'include':[{'model':db[_0xd90d('0x6e')],'attributes':[_0xd90d('0x8d')],'as':_0xd90d('0x6f')}],'order':['OrderBy',db[_0xd90d('0x70')][_0xd90d('0x71')](_0xd90d('0x94'))]})['then'](function(_0x5ba4eb){var _0x1d344c=0x1;var _0x46dca1=_[_0xd90d('0x77')](_0x5ba4eb,function(_0x16553f){_0x16553f['CmHopperId']=_0x4db487;_0x16553f['phone']=_0x16553f['item'];_0x16553f['OrderBy']=_0x1d344c;delete _0x16553f[_0xd90d('0x95')];_0x1d344c=_0x1d344c+0x1;return _0x16553f;});return db[_0xd90d('0x96')][_0xd90d('0x5f')](_0x46dca1,{});})[_0xd90d('0x19')](function(){_0x4e65c1(0x1);});});}function insertAdditionalPhones(_0x4720c4,_0x33d1fc){return new Promise(function(_0x421061){var _0x268aae=[];for(var _0x44ac41=0x0;_0x44ac41<_0x33d1fc[_0xd90d('0x2a')];_0x44ac41++){var _0x10cb6a=_0x33d1fc[_0x44ac41];_0x268aae['push'](parseContactItemType(_0x10cb6a));}Promise[_0xd90d('0x69')](_0x268aae)[_0xd90d('0x19')](function(){var _0x35c27f={'id':_0x4720c4['id'],'items':_0x33d1fc};return addAdditionalPhones(_0x35c27f)['then'](function(){return addCmHopperPhones(_0x4720c4['id']);});})[_0xd90d('0x19')](function(){_0x421061(_0x4720c4);});});}function parseContactItemType(_0x170d1e){return new Promise(function(_0x5334a0){if(_0x170d1e[_0xd90d('0x37')](_0xd90d('0x90'))){_0x5334a0(_0x170d1e);}else{return db[_0xd90d('0x6e')][_0xd90d('0x28')]({'where':{'name':_0x170d1e[_0xd90d('0x6f')]}})[_0xd90d('0x19')](function(_0x1520ae){if(_[_0xd90d('0x5a')](_0x1520ae))_0x170d1e[_0xd90d('0x90')]=null;else _0x170d1e[_0xd90d('0x90')]=_0x1520ae['id'];_0x5334a0(_0x170d1e);});}});}exports['getAdditionalPhones']=function(_0x1acd04,_0x2a1404){return db[_0xd90d('0x4e')][_0xd90d('0x30')]({'raw':!![],'where':{'CmContactId':_0x1acd04['params']['id'],'ItemClass':_0xd90d('0x92')},'include':[{'model':db[_0xd90d('0x6e')],'as':_0xd90d('0x6f')}],'order':[[_0xd90d('0x8d')],[db[_0xd90d('0x70')][_0xd90d('0x71')]('`ItemType`.OrderBy')]]})[_0xd90d('0x19')](function(_0x1dd5e5){return _0x1dd5e5;})[_0xd90d('0x19')](respondWithResult(_0x2a1404,null))[_0xd90d('0x26')](handleError(_0x2a1404,null));};exports[_0xd90d('0x97')]=function(_0x516ed5,_0x314a8c){return db[_0xd90d('0x4e')][_0xd90d('0x30')]({'raw':!![],'where':{'CmContactId':_0x516ed5[_0xd90d('0x38')][_0xd90d('0x98')]}})[_0xd90d('0x19')](function(_0x467dc6){var _0x4be6dc=_[_0xd90d('0x77')](_0x467dc6,function(_0x4378d4){_0x4378d4[_0xd90d('0x99')]=_0x516ed5[_0xd90d('0x38')][_0xd90d('0x9a')];return _0x4378d4;});return db[_0xd90d('0x4e')][_0xd90d('0x5f')](_0x4be6dc,{});})[_0xd90d('0x19')](function(){return addCmHopperPhones(_0x516ed5[_0xd90d('0x38')][_0xd90d('0x9a')]);})[_0xd90d('0x19')](function(){return['ok'];})['then'](respondWithResult(_0x314a8c,null))['catch'](handleError(_0x314a8c,null));};exports[_0xd90d('0x9b')]=function(_0x3ee569,_0x2a2677){var _0x234715=[];_0x234715[_0xd90d('0x67')](createCmHopperPhone(_0x3ee569[_0xd90d('0x38')]['id'],_0x3ee569[_0xd90d('0x38')][_0xd90d('0x9c')]));Promise['all'](_0x234715)[_0xd90d('0x19')](function(){return[0x1];})[_0xd90d('0x19')](respondWithResult(_0x2a2677,null));};exports[_0xd90d('0x9d')]=function(_0x479a53,_0x3f26dd){var _0x1bff63={'raw':![],'where':{}};var _0x14bee8={};var _0x158fbf={'count':0x0,'rows':[]};return db['CmContact'][_0xd90d('0x7e')]({'where':{'id':_0x479a53[_0xd90d('0x29')]['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x3f26dd,null))['then'](function(_0x415f55){if(_0x415f55){_0x14bee8[_0xd90d('0x82')]=_[_0xd90d('0x2b')](db[_0xd90d('0x40')][_0xd90d('0x7f')]);_0x14bee8[_0xd90d('0x24')]=_[_0xd90d('0x2b')](_0x479a53['query']);_0x14bee8[_0xd90d('0x80')]=_['intersection'](_0x14bee8[_0xd90d('0x82')],_0x14bee8[_0xd90d('0x24')]);_0x1bff63[_0xd90d('0x83')]=_[_0xd90d('0x81')](_0x14bee8[_0xd90d('0x82')],qs[_0xd90d('0x84')](_0x479a53[_0xd90d('0x24')][_0xd90d('0x84')]));_0x1bff63[_0xd90d('0x83')]=_0x1bff63[_0xd90d('0x83')]['length']?_0x1bff63['attributes']:_0x14bee8[_0xd90d('0x82')];if(!_0x479a53[_0xd90d('0x24')][_0xd90d('0x37')]('nolimit')){_0x1bff63[_0xd90d('0x15')]=qs[_0xd90d('0x15')](_0x479a53[_0xd90d('0x24')][_0xd90d('0x15')]);_0x1bff63['offset']=qs['offset'](_0x479a53[_0xd90d('0x24')][_0xd90d('0x13')]);}_0x1bff63[_0xd90d('0x9e')]=qs['sort'](_0x479a53[_0xd90d('0x24')][_0xd90d('0x85')]);_0x1bff63[_0xd90d('0x62')]=qs['filters'](_[_0xd90d('0x86')](_0x479a53[_0xd90d('0x24')],_0x14bee8[_0xd90d('0x80')]));_0x1bff63[_0xd90d('0x62')][_0xd90d('0x9f')]=_0x415f55['id'];if(_0x479a53[_0xd90d('0x24')][_0xd90d('0x87')]){_0x1bff63[_0xd90d('0x62')]=_[_0xd90d('0x88')](_0x1bff63['where'],{'$or':_[_0xd90d('0x77')](_0x1bff63[_0xd90d('0x83')],function(_0x3f98de){var _0x5bc816={};_0x5bc816[_0x3f98de]={'$like':'%'+_0x479a53[_0xd90d('0x24')][_0xd90d('0x87')]+'%'};return _0x5bc816;})});}_0x1bff63=_[_0xd90d('0x88')]({},_0x1bff63,_0x479a53[_0xd90d('0x89')]);return db['CmHopper']['count']({'where':_0x1bff63[_0xd90d('0x62')]})['then'](function(_0x4a60b9){_0x158fbf[_0xd90d('0xa0')]=_0x4a60b9;if(_0x479a53[_0xd90d('0x24')][_0xd90d('0xa1')]){_0x1bff63[_0xd90d('0xa2')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1bff63);})['then'](function(_0x4586b9){_0x158fbf[_0xd90d('0xa3')]=_0x4586b9;return _0x158fbf;});}})[_0xd90d('0x19')](respondWithFilteredResult(_0x3f26dd,_0x1bff63))['catch'](handleError(_0x3f26dd,null));};exports[_0xd90d('0xa4')]=function(_0x462c54,_0x2fc79a){var _0xcec79f={'raw':!![],'where':{}};var _0x310040={};var _0x204dcd={'count':0x0,'rows':[]};return db['CmContact'][_0xd90d('0x7e')]({'where':{'id':_0x462c54[_0xd90d('0x29')]['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x2fc79a,null))[_0xd90d('0x19')](function(_0x1c2cbd){if(_0x1c2cbd){_0x310040[_0xd90d('0x82')]=_[_0xd90d('0x2b')](db[_0xd90d('0x50')][_0xd90d('0x7f')]);_0x310040[_0xd90d('0x24')]=_['keys'](_0x462c54[_0xd90d('0x24')]);_0x310040[_0xd90d('0x80')]=_['intersection'](_0x310040[_0xd90d('0x82')],_0x310040[_0xd90d('0x24')]);_0xcec79f[_0xd90d('0x83')]=_[_0xd90d('0x81')](_0x310040[_0xd90d('0x82')],qs[_0xd90d('0x84')](_0x462c54[_0xd90d('0x24')][_0xd90d('0x84')]));_0xcec79f[_0xd90d('0x83')]=_0xcec79f[_0xd90d('0x83')]['length']?_0xcec79f[_0xd90d('0x83')]:_0x310040[_0xd90d('0x82')];if(!_0x462c54[_0xd90d('0x24')][_0xd90d('0x37')](_0xd90d('0xa5'))){_0xcec79f['limit']=qs[_0xd90d('0x15')](_0x462c54[_0xd90d('0x24')]['limit']);_0xcec79f['offset']=qs['offset'](_0x462c54['query']['offset']);}_0xcec79f['order']=qs[_0xd90d('0x85')](_0x462c54['query']['sort']);_0xcec79f['where']=qs['filters'](_[_0xd90d('0x86')](_0x462c54['query'],_0x310040[_0xd90d('0x80')]));_0xcec79f[_0xd90d('0x62')][_0xd90d('0x9f')]=_0x1c2cbd['id'];if(_0x462c54['query'][_0xd90d('0x87')]){_0xcec79f['where']=_['merge'](_0xcec79f[_0xd90d('0x62')],{'$or':_[_0xd90d('0x77')](_0xcec79f[_0xd90d('0x83')],function(_0x536f91){var _0x1a8147={};_0x1a8147[_0x536f91]={'$like':'%'+_0x462c54[_0xd90d('0x24')]['filter']+'%'};return _0x1a8147;})});}_0xcec79f=_['merge']({},_0xcec79f,_0x462c54[_0xd90d('0x89')]);return db[_0xd90d('0x50')][_0xd90d('0xa0')]({'where':_0xcec79f[_0xd90d('0x62')]})[_0xd90d('0x19')](function(_0x5baa8e){_0x204dcd[_0xd90d('0xa0')]=_0x5baa8e;if(_0x462c54['query'][_0xd90d('0xa1')]){_0xcec79f[_0xd90d('0xa2')]=[{'all':!![]}];}return db[_0xd90d('0x50')][_0xd90d('0x30')](_0xcec79f);})[_0xd90d('0x19')](function(_0x18286c){_0x204dcd[_0xd90d('0xa3')]=_0x18286c;return _0x204dcd;});}})[_0xd90d('0x19')](respondWithFilteredResult(_0x2fc79a,_0xcec79f))[_0xd90d('0x26')](handleError(_0x2fc79a,null));};exports['getHopperFinals']=function(_0x195473,_0x2f24e8){var _0x427809={'raw':!![],'where':{}};var _0x5a3b50={};var _0x82cc72={'count':0x0,'rows':[]};return db[_0xd90d('0x27')][_0xd90d('0x7e')]({'where':{'id':_0x195473['params']['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x2f24e8,null))['then'](function(_0x5a12ec){if(_0x5a12ec){_0x5a3b50[_0xd90d('0x82')]=_[_0xd90d('0x2b')](db[_0xd90d('0x4f')]['rawAttributes']);_0x5a3b50['query']=_[_0xd90d('0x2b')](_0x195473[_0xd90d('0x24')]);_0x5a3b50[_0xd90d('0x80')]=_[_0xd90d('0x81')](_0x5a3b50[_0xd90d('0x82')],_0x5a3b50[_0xd90d('0x24')]);_0x427809[_0xd90d('0x83')]=_[_0xd90d('0x81')](_0x5a3b50[_0xd90d('0x82')],qs[_0xd90d('0x84')](_0x195473[_0xd90d('0x24')][_0xd90d('0x84')]));_0x427809[_0xd90d('0x83')]=_0x427809[_0xd90d('0x83')]['length']?_0x427809[_0xd90d('0x83')]:_0x5a3b50['model'];if(!_0x195473['query'][_0xd90d('0x37')]('nolimit')){_0x427809[_0xd90d('0x15')]=qs[_0xd90d('0x15')](_0x195473[_0xd90d('0x24')][_0xd90d('0x15')]);_0x427809[_0xd90d('0x13')]=qs[_0xd90d('0x13')](_0x195473['query']['offset']);}_0x427809[_0xd90d('0x9e')]=qs['sort'](_0x195473[_0xd90d('0x24')]['sort']);_0x427809[_0xd90d('0x62')]=qs[_0xd90d('0x80')](_[_0xd90d('0x86')](_0x195473['query'],_0x5a3b50['filters']));_0x427809[_0xd90d('0x62')][_0xd90d('0x9f')]=_0x5a12ec['id'];if(_0x195473[_0xd90d('0x24')]['filter']){_0x427809['where']=_[_0xd90d('0x88')](_0x427809['where'],{'$or':_[_0xd90d('0x77')](_0x427809[_0xd90d('0x83')],function(_0x5e17f8){var _0x4a4c8e={};_0x4a4c8e[_0x5e17f8]={'$like':'%'+_0x195473[_0xd90d('0x24')][_0xd90d('0x87')]+'%'};return _0x4a4c8e;})});}_0x427809=_[_0xd90d('0x88')]({},_0x427809,_0x195473[_0xd90d('0x89')]);return db[_0xd90d('0x4f')][_0xd90d('0xa0')]({'where':_0x427809[_0xd90d('0x62')]})[_0xd90d('0x19')](function(_0x21d13f){_0x82cc72[_0xd90d('0xa0')]=_0x21d13f;if(_0x195473[_0xd90d('0x24')]['includeAll']){_0x427809[_0xd90d('0xa2')]=[{'all':!![]}];}return db[_0xd90d('0x4f')][_0xd90d('0x30')](_0x427809);})[_0xd90d('0x19')](function(_0x4af403){_0x82cc72[_0xd90d('0xa3')]=_0x4af403;return _0x82cc72;});}})[_0xd90d('0x19')](respondWithFilteredResult(_0x2f24e8,_0x427809))[_0xd90d('0x26')](handleError(_0x2f24e8,null));};exports[_0xd90d('0xa6')]=function(_0x117483,_0x175105){var _0x52a651={'raw':!![],'where':{}};var _0xd32cde={};var _0x43504e={'count':0x0,'rows':[]};return db[_0xd90d('0x27')][_0xd90d('0x7e')]({'where':{'id':_0x117483[_0xd90d('0x29')]['id']}})[_0xd90d('0x19')](handleEntityNotFound(_0x175105,null))[_0xd90d('0x19')](function(_0x70e9ee){if(_0x70e9ee){_0xd32cde[_0xd90d('0x82')]=_['keys'](db['JscriptySessionReport'][_0xd90d('0x7f')]);_0xd32cde['query']=_[_0xd90d('0x2b')](_0x117483[_0xd90d('0x24')]);_0xd32cde[_0xd90d('0x80')]=_[_0xd90d('0x81')](_0xd32cde[_0xd90d('0x82')],_0xd32cde[_0xd90d('0x24')]);_0x52a651[_0xd90d('0x83')]=_['intersection'](_0xd32cde[_0xd90d('0x82')],qs['fields'](_0x117483['query']['fields']));_0x52a651['attributes']=_0x52a651[_0xd90d('0x83')]['length']?_0x52a651[_0xd90d('0x83')]:_0xd32cde[_0xd90d('0x82')];if(!_0x117483[_0xd90d('0x24')][_0xd90d('0x37')](_0xd90d('0xa5'))){_0x52a651[_0xd90d('0x15')]=qs[_0xd90d('0x15')](_0x117483['query'][_0xd90d('0x15')]);_0x52a651['offset']=qs[_0xd90d('0x13')](_0x117483[_0xd90d('0x24')][_0xd90d('0x13')]);}_0x52a651[_0xd90d('0x9e')]=qs[_0xd90d('0x85')](_0x117483['query'][_0xd90d('0x85')]);_0x52a651[_0xd90d('0x62')]=qs[_0xd90d('0x80')](_[_0xd90d('0x86')](_0x117483[_0xd90d('0x24')],_0xd32cde[_0xd90d('0x80')]));_0x52a651[_0xd90d('0x62')][_0xd90d('0x9f')]=_0x70e9ee['id'];if(_0x117483[_0xd90d('0x24')][_0xd90d('0x87')]){_0x52a651['where']=_[_0xd90d('0x88')](_0x52a651[_0xd90d('0x62')],{'$or':_['map'](_0x52a651['attributes'],function(_0x325c76){var _0x2d683c={};_0x2d683c[_0x325c76]={'$like':'%'+_0x117483[_0xd90d('0x24')][_0xd90d('0x87')]+'%'};return _0x2d683c;})});}_0x52a651=_[_0xd90d('0x88')]({},_0x52a651,_0x117483['options']);return db[_0xd90d('0x57')][_0xd90d('0xa0')]({'where':_0x52a651[_0xd90d('0x62')]})['then'](function(_0x3e1544){_0x43504e['count']=_0x3e1544;if(_0x117483[_0xd90d('0x24')][_0xd90d('0xa1')]){_0x52a651[_0xd90d('0xa2')]=[{'all':!![]}];}return db[_0xd90d('0x57')][_0xd90d('0x30')](_0x52a651);})[_0xd90d('0x19')](function(_0x3c74c7){_0x43504e[_0xd90d('0xa3')]=_0x3c74c7;return _0x43504e;});}})[_0xd90d('0x19')](respondWithFilteredResult(_0x175105,_0x52a651))[_0xd90d('0x26')](handleError(_0x175105,null));};exports[_0xd90d('0xa7')]=function(_0x3b4816,_0x21476f){try{if(!_0x3b4816[_0xd90d('0x38')][_0xd90d('0x64')]){throw new Error(_0xd90d('0xa8'));}if(!_0x3b4816[_0xd90d('0x38')][_0xd90d('0xa9')]){throw new Error(_0xd90d('0xaa'));}if(!_0x3b4816['body'][_0xd90d('0xab')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x3b4816['body'][_0xd90d('0xac')]){throw new Error(_0xd90d('0xad'));}var _0x5d5d21=_0x3b4816[_0xd90d('0x38')]['binding_keys'][_0xd90d('0xae')](',');var _0x42c004=_0x3b4816[_0xd90d('0x38')][_0xd90d('0xab')][_0xd90d('0xae')](',');if(!_0x5d5d21[_0xd90d('0x2a')]||!_0x42c004[_0xd90d('0x2a')]||_0x5d5d21[_0xd90d('0x2a')]!==_0x42c004[_0xd90d('0x2a')]){throw new Error(_0xd90d('0xaf'));}_0x3b4816[_0xd90d('0x38')][_0xd90d('0x84')]=_[_0xd90d('0xb0')](_0x5d5d21,_0x42c004);if(!_0x3b4816[_0xd90d('0x38')]['fields'][_0xd90d('0x7d')]){throw new Error(_0xd90d('0xb1'));}if(!_0x3b4816[_0xd90d('0x38')][_0xd90d('0x84')][_0xd90d('0xb2')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x3c53f9=path[_0xd90d('0x3e')](config[_0xd90d('0xb3')],_0xd90d('0xb4'),_0x3b4816[_0xd90d('0xb5')][_0xd90d('0xb6')]);fs[_0xd90d('0xb7')](_0x3c53f9,parseInt(_0xd90d('0xb8'),0x8));var _0x1e5a89=require(_0xd90d('0xb9'))['fork'](path[_0xd90d('0x3e')](__dirname,_0xd90d('0xba')),[_0x3c53f9,_0x3b4816['body'][_0xd90d('0xa9')],_0x3b4816['body'][_0xd90d('0xab')],_0x3b4816[_0xd90d('0x38')]['ListId'],_0x3b4816[_0xd90d('0x38')][_0xd90d('0xbb')],_0x3b4816[_0xd90d('0x38')][_0xd90d('0x61')],_0x3b4816[_0xd90d('0x38')][_0xd90d('0xac')]]);return _0x21476f[_0xd90d('0x1b')](0xc8)[_0xd90d('0x12')]({'message':'File\x20uploaded\x20correctly!','pid':_0x1e5a89[_0xd90d('0xbc')]});}catch(_0x1bd03d){return _0x21476f[_0xd90d('0x1b')](0x1f4)['send'](_0x1bd03d);}};exports[_0xd90d('0xbd')]=function(_0x473e13,_0x26e35c){var _0x49bc7d=fs[_0xd90d('0xbe')](_0x473e13[_0xd90d('0xb5')][_0xd90d('0x3')]);Papa[_0xd90d('0xbf')](_0x49bc7d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5661f0){return _0x26e35c[_0xd90d('0x1b')](0xc8)[_0xd90d('0x12')]({'file':_0x473e13[_0xd90d('0xb5')],'fields':_0x5661f0[_0xd90d('0xc0')]['fields']});}});};exports[_0xd90d('0xc1')]=function(_0x4a3e27,_0x83d528){return db[_0xd90d('0xc2')][_0xd90d('0x30')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd90d('0xc3')}})[_0xd90d('0x19')](function(_0x25409f){var _0x197cc0=![];if(!_0x4a3e27[_0xd90d('0x38')][_0xd90d('0x64')]){throw new Error(_0xd90d('0xa8'));}if(!_0x4a3e27[_0xd90d('0x38')][_0xd90d('0xc4')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4a3e27['body'][_0xd90d('0xc4')][_0xd90d('0xb2')]){throw new Error(_0xd90d('0xc5'));}if(!_0x4a3e27[_0xd90d('0x38')][_0xd90d('0xac')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5848a5=require(_0xd90d('0xb9'))[_0xd90d('0xc6')](path[_0xd90d('0x3e')](__dirname,_0xd90d('0xc7')),[_0x4a3e27[_0xd90d('0x29')]['id'],JSON[_0xd90d('0xc8')](_0x4a3e27[_0xd90d('0x38')]),JSON['stringify'](_0x25409f)]);_0x5848a5['on']('message',function(){_0x197cc0=!![];return _0x83d528[_0xd90d('0x1b')](0xc8)['json']({'message':_0xd90d('0xc9'),'pid':_0x5848a5['pid']});});_0x5848a5['on'](_0xd90d('0xca'),function(_0x137029){if(_0x137029&&!_0x197cc0){return _0x83d528[_0xd90d('0x1b')](0x1f4)['json']({'message':_0xd90d('0xcb'),'pid':_0x5848a5[_0xd90d('0xbc')]});}});})['catch'](handleError(_0x83d528,null));};exports[_0xd90d('0xcc')]=function(_0x3268bc,_0x1d348a){return db[_0xd90d('0xc2')][_0xd90d('0x30')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd90d('0xc3')}})[_0xd90d('0x19')](function(_0x2eda25){var _0x522e1a=![];if(!_0x3268bc[_0xd90d('0x38')][_0xd90d('0x64')]){throw new Error(_0xd90d('0xa8'));}if(!_0x3268bc[_0xd90d('0x38')][_0xd90d('0xc4')][_0xd90d('0x7d')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x3268bc[_0xd90d('0x38')][_0xd90d('0xc4')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x3268bc[_0xd90d('0x38')][_0xd90d('0xac')]){throw new Error(_0xd90d('0xad'));}var _0x228d7e=require('child_process')[_0xd90d('0xc6')](path[_0xd90d('0x3e')](__dirname,'../../components/import/cm/csvUpdates'),[_0x3268bc[_0xd90d('0x29')]['id'],JSON[_0xd90d('0xc8')](_0x3268bc[_0xd90d('0x38')]),JSON[_0xd90d('0xc8')](_0x2eda25)]);_0x228d7e['on'](_0xd90d('0xcd'),function(){_0x522e1a=!![];return _0x1d348a[_0xd90d('0x1b')](0xc8)[_0xd90d('0x12')]({'message':_0xd90d('0xc9'),'pid':_0x228d7e['pid']});});_0x228d7e['on'](_0xd90d('0xca'),function(_0x153f31){if(_0x153f31&&!_0x522e1a){return _0x1d348a['status'](0x1f4)[_0xd90d('0x12')]({'message':_0xd90d('0xcb'),'pid':_0x228d7e[_0xd90d('0xbc')]});}});})[_0xd90d('0x26')](handleError(_0x1d348a,null));};exports['getJourney']=function(_0x5ba83f,_0x2cd99f){var _0x498f61=[_0xd90d('0xce'),_0xd90d('0xcf'),'sms',_0xd90d('0xd0'),'fax',_0xd90d('0xd1'),_0xd90d('0xd2')];var _0x53a275={'offset':0x0,'order':qs[_0xd90d('0x85')](_0xd90d('0xd3'))},_0x531b23={'count':0x0,'rows':[]};Promise[_0xd90d('0xd4')]()[_0xd90d('0x19')](function(){if(_0x5ba83f[_0xd90d('0x24')]['channel']){if(!_[_0xd90d('0xd5')](_0x498f61,_0x5ba83f[_0xd90d('0x24')][_0xd90d('0xd6')][_0xd90d('0xd7')]())){throw new Error(_0xd90d('0xd8'));}_0x498f61=[_0x5ba83f[_0xd90d('0x24')][_0xd90d('0xd6')]['toLowerCase']()];}if(_0x5ba83f[_0xd90d('0x24')][_0xd90d('0xd9')]){try{var _0x4ce392=JSON['parse'](_0x5ba83f[_0xd90d('0x24')][_0xd90d('0xd9')]);if(!moment(_0x4ce392['from'])[_0xd90d('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4ce392['to'])[_0xd90d('0xda')]()){throw new Error(_0xd90d('0xdb'));}}catch(_0x202b77){throw new Error(_0xd90d('0xdc'));}}if(!_0x5ba83f['query'][_0xd90d('0x37')](_0xd90d('0xa5'))){_0x53a275[_0xd90d('0x15')]=qs[_0xd90d('0x15')](_0x5ba83f['query'][_0xd90d('0x15')]||0xa);_0x53a275[_0xd90d('0x13')]=qs[_0xd90d('0x13')](_0x5ba83f[_0xd90d('0x24')][_0xd90d('0x13')]);}var _0x13502c=_0x498f61[_0xd90d('0x77')](function(_0x3e3c70){if(_0x3e3c70===_0xd90d('0xd2')){var _0x19cb1d={'attributes':['id',_0xd90d('0xdd'),_0xd90d('0x33'),'source','destination',_0xd90d('0xde'),_0xd90d('0xdf'),_0xd90d('0xe0'),_0xd90d('0xe1'),_0xd90d('0xe2'),_0xd90d('0xe3'),_0xd90d('0xe4'),_0xd90d('0xe5'),_0xd90d('0xe6'),_0xd90d('0xe7')],'where':{'ContactId':_0x5ba83f[_0xd90d('0x29')]['id']},'include':[{'model':db['User'],'as':_0xd90d('0xc2'),'attributes':['id',_0xd90d('0x20'),_0xd90d('0xe8'),_0xd90d('0x31')]}],'order':[[_0xd90d('0xe3'),'DESC']]};if(_0x5ba83f[_0xd90d('0x24')][_0xd90d('0xd9')]){_0x19cb1d[_0xd90d('0x62')]['createdAt']={'$gte':_0x4ce392['from'],'$lte':_0x4ce392['to']};}return db[_0xd90d('0x52')][_0xd90d('0xe9')](_0x19cb1d)[_0xd90d('0x19')](function(_0x290680){_0x531b23['count']+=_0x290680[_0xd90d('0xa0')];return _[_0xd90d('0x77')](_0x290680[_0xd90d('0xa3')],function(_0x2c7251){var _0x3d90ae=_0x2c7251[_0xd90d('0x3a')]({'plain':!![]});_0x3d90ae[_0xd90d('0xd6')]=_0x3e3c70;if(_0x3d90ae[_0xd90d('0xc2')]){_0x3d90ae[_0xd90d('0xc2')]={'id':_0x3d90ae['User']['id'],'name':_0x3d90ae[_0xd90d('0xc2')][_0xd90d('0x20')],'fullname':_0x3d90ae['User'][_0xd90d('0xe8')],'alias':_0x3d90ae['User'][_0xd90d('0x31')]};}return _0x3d90ae;});});}else{var _0x52cb9c=_[_0xd90d('0xea')](_0x3e3c70)+(_0x3e3c70===_0xd90d('0xcf')?_0xd90d('0xeb'):_0xd90d('0xec'));var _0x558129={'attributes':['id','closed','closedAt',_0xd90d('0xe3'),'note',_0xd90d('0xed'),_0xd90d('0xee'),'thirdDisposition',_0xd90d('0xe7'),_0x52cb9c+'Id'],'where':{'ContactId':_0x5ba83f[_0xd90d('0x29')]['id']},'include':[{'model':db[_0x52cb9c],'as':_0xd90d('0xec'),'attributes':['id',_0xd90d('0x20'),_0xd90d('0xef')]},{'model':db[_0xd90d('0xc2')],'as':'Owner','attributes':['id',_0xd90d('0x20'),_0xd90d('0xe8')]},{'model':db[_0xd90d('0x6b')],'as':'Tags','attributes':['id',_0xd90d('0x20'),_0xd90d('0x6c')],'through':{'attributes':[]}}],'order':[[_0xd90d('0xe3'),_0xd90d('0xf0')]]};if(_0x5ba83f[_0xd90d('0x24')][_0xd90d('0xd9')]){_0x558129[_0xd90d('0x62')][_0xd90d('0xe3')]={'$gte':_0x4ce392[_0xd90d('0x39')],'$lte':_0x4ce392['to']};}switch(_0x3e3c70){case _0xd90d('0xcf'):_0x558129[_0xd90d('0x83')][_0xd90d('0x67')]('browserName',_0xd90d('0xf1'),_0xd90d('0xf2'),'deviceModel','osName',_0xd90d('0xf3'),'ratingType',_0xd90d('0xf4'),_0xd90d('0xf5'));break;case _0xd90d('0xce'):_0x558129[_0xd90d('0x83')][_0xd90d('0x67')](_0xd90d('0xf6'),_0xd90d('0xf7'));break;case _0xd90d('0xd0'):_0x558129[_0xd90d('0x83')][_0xd90d('0x67')]('externalUrl',_0xd90d('0xf8'));break;}return db[_['startCase'](_0x3e3c70)+_0xd90d('0xf9')][_0xd90d('0xe9')](_0x558129)[_0xd90d('0x19')](function(_0x3c4fc6){_0x531b23['count']+=_0x3c4fc6[_0xd90d('0xa0')];return _[_0xd90d('0x77')](_0x3c4fc6[_0xd90d('0xa3')],function(_0x4e5e90){var _0x83bf98=_0x4e5e90[_0xd90d('0x3a')]({'plain':!![]});_0x83bf98[_0xd90d('0xd6')]=_0x3e3c70;if(_0x83bf98[_0xd90d('0xfa')]){_0x83bf98['Owner']={'id':_0x83bf98[_0xd90d('0xfa')]['id'],'name':_0x83bf98['Owner'][_0xd90d('0x20')],'fullname':_0x83bf98['Owner'][_0xd90d('0xe8')]};}return _0x83bf98;});});}});return Promise[_0xd90d('0x69')](_0x13502c);})[_0xd90d('0x19')](function(_0x407cff){return _(_0x407cff)['flatten']()['sortBy'](_0xd90d('0xe3'))[_0xd90d('0xfb')]()[_0xd90d('0xfc')]();})[_0xd90d('0x19')](function(_0x3fedce){_0x531b23[_0xd90d('0xa3')]=_0x53a275['limit']?_0x3fedce[_0xd90d('0xfd')](_0x53a275[_0xd90d('0x13')],_0x53a275[_0xd90d('0x13')]+_0x53a275[_0xd90d('0x15')]):_0x3fedce;return _0x531b23;})['then'](respondWithFilteredResult(_0x2cd99f,_0x53a275))[_0xd90d('0x26')](handleError(_0x2cd99f,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 2e5f2a7..ebf49a9 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f7c=['setMaxListeners','remove','emit','hook','CmContact'];(function(_0x29db25,_0x457467){var _0x48b1a5=function(_0x5cb05f){while(--_0x5cb05f){_0x29db25['push'](_0x29db25['shift']());}};_0x48b1a5(++_0x457467);}(_0x0f7c,0x81));var _0xc0f7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0f7c[_0x178e48];return _0x440d7e;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0xc0f7('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc0f7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc0f7('0x2')};function emitEvent(_0x4f7bad){return function(_0x5d020e,_0x4e41b1,_0x456041){CmContactEvents[_0xc0f7('0x3')](_0x4f7bad+':'+_0x5d020e['id'],_0x5d020e);CmContactEvents[_0xc0f7('0x3')](_0x4f7bad,_0x5d020e);_0x456041(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xc0f7('0x4')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xe6b7=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0xe6b7,0x1e6));var _0x7e6b=function(_0x5a4dfc,_0x5a3b0c){_0x5a4dfc=_0x5a4dfc-0x0;var _0x127d2b=_0xe6b7[_0x5a4dfc];return _0x127d2b;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x7e6b('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x7e6b('0x1')](0x0);var events={'afterCreate':_0x7e6b('0x2'),'afterUpdate':_0x7e6b('0x3'),'afterDestroy':_0x7e6b('0x4')};function emitEvent(_0x58cf39){return function(_0x502de4,_0x52ccd4,_0x5030cd){CmContactEvents[_0x7e6b('0x5')](_0x58cf39+':'+_0x502de4['id'],_0x502de4);CmContactEvents[_0x7e6b('0x5')](_0x58cf39,_0x502de4);_0x5030cd(null);};}for(var e in events){if(events[_0x7e6b('0x6')](e)){var event=events[e];CmContact[_0x7e6b('0x7')](e,emitEvent(event));}}module[_0x7e6b('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index e4e5189..c5ec1f0 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdafd=['always','onlyIfOpen','VoiceQueue','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','CmList','Lists','List\x20not\x20found','isEmpty','destroy','CampaignId','all','info','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','utf8mb4','models','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','then','dialTimezone','utcOffset','add','minutes','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','length'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xdafd,0x9e));var _0xddaf=function(_0x10ab83,_0x42d0a3){_0x10ab83=_0x10ab83-0x0;var _0xef847b=_0xdafd[_0x10ab83];return _0xef847b;};'use strict';var _=require(_0xddaf('0x0'));var util=require(_0xddaf('0x1'));var logger=require(_0xddaf('0x2'))('api');var moment=require(_0xddaf('0x3'));var BPromise=require(_0xddaf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddaf('0x5'));var rimraf=require(_0xddaf('0x6'));var config=require(_0xddaf('0x7'));var shared=require(_0xddaf('0x8'));var attributes=require(_0xddaf('0x9'));module[_0xddaf('0xa')]=function(_0x2e4bf3,_0x20d225){return _0x2e4bf3['define']('CmContact',attributes,{'tableName':_0xddaf('0xb'),'paranoid':!![],'indexes':[{'name':_0xddaf('0xc'),'fields':[_0xddaf('0xc')]},{'name':_0xddaf('0xd'),'fields':[_0xddaf('0xe'),_0xddaf('0xf'),_0xddaf('0xc'),'mobile',_0xddaf('0x10'),_0xddaf('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xddaf('0x12'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x20c141,_0x9552be,_0x470a82){var _0x421b54=_0x2e4bf3[_0xddaf('0x13')];var _0x1a37af=_0x20c141[_0xddaf('0x14')]({'plain':!![]});function _0x3c8f1e(){return function(_0x438994){logger['error'](_0xddaf('0x15'),_0xddaf('0x16'),util[_0xddaf('0x17')](_0x438994,{'showHidden':![],'depth':null}));};}function _0x3c3ca2(_0x392b49,_0x3b7737){var _0x4dfd10=_0x3b7737[_0xddaf('0x18')]?_0x3b7737[_0xddaf('0x18')]:moment()[_0xddaf('0x19')](_0xddaf('0x1a'));return new BPromise(function(_0x28ef59,_0x191553){if(_[_0xddaf('0x1b')](_0x3b7737['dialTimezone'])){_0x28ef59({'ret':_0x4dfd10});}else{_0x421b54['VoiceQueue']['findOne']({'where':{'id':_0x392b49['id']}})[_0xddaf('0x1c')](function(_0x28e8de){if(!_[_0xddaf('0x1b')](_0x28e8de)){var _0x1cd6ce=_0x28e8de[_0xddaf('0x1d')];if(!_[_0xddaf('0x1b')](_0x1cd6ce)){var _0x10b344=shared['timezones'];var _0x1abf8b=_0x10b344[_0x1cd6ce];var _0x501217=_0x10b344[_0x3b7737[_0xddaf('0x1d')]];if(!_[_0xddaf('0x1b')](_0x1abf8b)&&!_[_0xddaf('0x1b')](_0x501217)){var _0x4a5074=_0x1abf8b[_0xddaf('0x1e')]-_0x501217[_0xddaf('0x1e')];_0x4dfd10=_0x3b7737['scheduledat']?_0x3b7737[_0xddaf('0x18')]:moment();var _0x371bd1=moment(_0x4dfd10)[_0xddaf('0x1f')](_0x4a5074,_0xddaf('0x20'));_0x28ef59({'ret':_0x371bd1['format'](_0xddaf('0x1a'))});}else _0x28ef59({'ret':_0x4dfd10});}else _0x28ef59({'ret':_0x4dfd10});}else{_0x28ef59({'ret':_0x4dfd10});}});}});return 0xa;}var _0x11c6ef=function(_0x17929f){return new BPromise(function(_0x81c668,_0x22d7cc){_0x3c3ca2(_0x17929f,_0x1a37af)[_0xddaf('0x1c')](function(_0x142681){_0x1a37af[_0xddaf('0x18')]=_0x142681[_0xddaf('0x21')];_0x421b54['CmHopper'][_0xddaf('0x22')]({'where':{'phone':_0x1a37af['phone'],'VoiceQueueId':_0x17929f['id']}})[_0xddaf('0x1c')](function(_0x34ac9d){if(!_['isNil'](_0x34ac9d)){throw new Error(_0xddaf('0x23')+_0x1a37af['phone']+_0xddaf('0x24')+_0x17929f['id']);}return _0x421b54[_0xddaf('0x25')][_0xddaf('0x26')]({'phone':_0x1a37af[_0xddaf('0xc')],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af[_0xddaf('0x27')],'priority':_0x1a37af['priority']?_0x1a37af[_0xddaf('0x28')]:0x2,'scheduledat':_0x1a37af[_0xddaf('0x18')]?_0x1a37af[_0xddaf('0x18')]:moment()[_0xddaf('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1a37af[_0xddaf('0x29')]?!![]:![],'callbackuniqueid':_0x1a37af[_0xddaf('0x29')]?_0x1a37af[_0xddaf('0x29')]:undefined,'callbackat':_0x1a37af['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x17929f['id']});})[_0xddaf('0x2a')](function(_0xec00b){_0x22d7cc(_0xec00b);});});});};var _0x53e937=function(_0x5d9d14){return new BPromise(function(_0x35f722,_0x305e4c){_0x3c3ca2(_0x5d9d14,_0x1a37af)[_0xddaf('0x1c')](function(_0x294428){_0x1a37af['scheduledat']=_0x294428[_0xddaf('0x21')];_0x421b54['CmHopper'][_0xddaf('0x22')]({'where':{'phone':_0x1a37af[_0xddaf('0xc')],'VoiceQueueId':_0x5d9d14['id']}})['then'](function(_0x4c982d){if(!_['isNil'](_0x4c982d)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1a37af[_0xddaf('0xc')]+_0xddaf('0x2b')+_0x5d9d14['id']);}return _0x421b54[_0xddaf('0x2c')][_0xddaf('0x22')]({'where':{'calleridnum':_0x1a37af[_0xddaf('0xc')],'VoiceQueueId':_0x5d9d14['id']}});})[_0xddaf('0x1c')](function(_0x459b6e){if(!_['isNil'](_0x459b6e)){throw new Error(_0xddaf('0x2d')+_0x1a37af['phone']+_0xddaf('0x2e')+_0x5d9d14['id']);}return _0x421b54[_0xddaf('0x25')][_0xddaf('0x26')]({'phone':_0x1a37af[_0xddaf('0xc')],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af[_0xddaf('0x27')],'priority':_0x1a37af[_0xddaf('0x28')]?_0x1a37af['priority']:0x2,'scheduledat':_0x1a37af[_0xddaf('0x18')]?_0x1a37af['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1a37af[_0xddaf('0x29')]?!![]:![],'callbackuniqueid':_0x1a37af['callbackUniqueid']?_0x1a37af['callbackUniqueid']:undefined,'callbackat':_0x1a37af[_0xddaf('0x29')]?moment()[_0xddaf('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5d9d14['id']});})[_0xddaf('0x2a')](function(_0x544f16){_0x305e4c(_0x544f16);});});});};function _0x25ac45(){return function(_0x46a15e){logger[_0xddaf('0x2f')](_0xddaf('0x15'),_0xddaf('0x16'),util[_0xddaf('0x17')](_0x46a15e,{'showHidden':![],'depth':null}));};}function _0x321c9d(_0x137815,_0x98e1d4){var _0x111756=_0x98e1d4['scheduledat']?_0x98e1d4[_0xddaf('0x18')]:moment()[_0xddaf('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x211897,_0x261009){if(_[_0xddaf('0x1b')](_0x98e1d4[_0xddaf('0x1d')])){_0x211897({'ret':_0x111756});}else{_0x421b54['Campaign'][_0xddaf('0x22')]({'where':{'id':_0x137815['id']}})[_0xddaf('0x1c')](function(_0x352ac4){if(!_[_0xddaf('0x1b')](_0x352ac4)){var _0x3d305d=_0x352ac4[_0xddaf('0x1d')];if(!_['isNil'](_0x3d305d)){var _0x4d3356=shared[_0xddaf('0x30')];var _0x28d23e=_0x4d3356[_0x3d305d];var _0xc16595=_0x4d3356[_0x98e1d4[_0xddaf('0x1d')]];if(!_[_0xddaf('0x1b')](_0x28d23e)&&!_['isNil'](_0xc16595)){var _0x4180f3=_0x28d23e[_0xddaf('0x1e')]-_0xc16595[_0xddaf('0x1e')];_0x111756=_0x98e1d4[_0xddaf('0x18')]?_0x98e1d4['scheduledat']:moment();var _0x22fecc=moment(_0x111756)[_0xddaf('0x1f')](_0x4180f3,_0xddaf('0x20'));_0x211897({'ret':_0x22fecc[_0xddaf('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x211897({'ret':_0x111756});}else _0x211897({'ret':_0x111756});}else{_0x211897({'ret':_0x111756});}});}});return 0xa;}var _0x3081be=function(_0x12298d){return new BPromise(function(_0x29b943,_0x298f55){_0x321c9d(_0x12298d,_0x1a37af)[_0xddaf('0x1c')](function(_0x415544){_0x1a37af[_0xddaf('0x18')]=_0x415544[_0xddaf('0x21')];_0x421b54[_0xddaf('0x25')][_0xddaf('0x22')]({'where':{'phone':_0x1a37af[_0xddaf('0xc')],'CampaignId':_0x12298d['id']}})[_0xddaf('0x1c')](function(_0x454491){if(!_[_0xddaf('0x1b')](_0x454491)){throw new Error(_0xddaf('0x23')+_0x1a37af[_0xddaf('0xc')]+_0xddaf('0x31')+_0x12298d['id']);}return _0x421b54[_0xddaf('0x25')][_0xddaf('0x26')]({'phone':_0x1a37af[_0xddaf('0xc')],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af[_0xddaf('0x27')],'priority':_0x1a37af[_0xddaf('0x28')]?_0x1a37af[_0xddaf('0x28')]:0x2,'scheduledat':_0x1a37af[_0xddaf('0x18')]?_0x1a37af[_0xddaf('0x18')]:moment()[_0xddaf('0x19')](_0xddaf('0x1a')),'callback':_0x1a37af[_0xddaf('0x29')]?!![]:![],'callbackuniqueid':_0x1a37af[_0xddaf('0x29')]?_0x1a37af[_0xddaf('0x29')]:undefined,'callbackat':_0x1a37af[_0xddaf('0x29')]?moment()[_0xddaf('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x12298d['id']});})[_0xddaf('0x2a')](function(_0x14aed6){_0x298f55(_0x14aed6);});});});};var _0x4d0073=function(_0x9ef7ea){return new BPromise(function(_0x3fb3e6,_0x28b51b){_0x321c9d(_0x9ef7ea,_0x1a37af)['then'](function(_0x3320eb){_0x1a37af[_0xddaf('0x18')]=_0x3320eb[_0xddaf('0x21')];_0x421b54[_0xddaf('0x25')][_0xddaf('0x22')]({'where':{'phone':_0x1a37af[_0xddaf('0xc')],'CampaignId':_0x9ef7ea['id']}})[_0xddaf('0x1c')](function(_0x1efb09){if(!_[_0xddaf('0x1b')](_0x1efb09)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1a37af['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x9ef7ea['id']);}return _0x421b54[_0xddaf('0x2c')][_0xddaf('0x22')]({'where':{'calleridnum':_0x1a37af[_0xddaf('0xc')],'CampaignId':_0x9ef7ea['id']}});})['then'](function(_0x2ff3e0){if(!_[_0xddaf('0x1b')](_0x2ff3e0)){throw new Error(_0xddaf('0x2d')+_0x1a37af['phone']+_0xddaf('0x32')+_0x9ef7ea['id']);}return _0x421b54[_0xddaf('0x25')][_0xddaf('0x26')]({'phone':_0x1a37af['phone'],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af['ListId'],'priority':_0x1a37af[_0xddaf('0x28')]?_0x1a37af[_0xddaf('0x28')]:0x2,'scheduledat':_0x1a37af[_0xddaf('0x18')]?_0x1a37af[_0xddaf('0x18')]:moment()['format'](_0xddaf('0x1a')),'callback':_0x1a37af[_0xddaf('0x29')]?!![]:![],'callbackuniqueid':_0x1a37af[_0xddaf('0x29')]?_0x1a37af[_0xddaf('0x29')]:undefined,'callbackat':_0x1a37af[_0xddaf('0x29')]?moment()[_0xddaf('0x19')](_0xddaf('0x1a')):undefined,'CampaignId':_0x9ef7ea['id']});})['catch'](function(_0x1fa1a1){_0x28b51b(_0x1fa1a1);});});});};if(_0x1a37af[_0xddaf('0x27')]){_0x421b54['VoiceQueue'][_0xddaf('0x33')]({'where':{'type':_0xddaf('0x34')},'attributes':['id',_0xddaf('0x35'),_0xddaf('0x1d')],'include':[{'model':_0x421b54['CmList'],'as':'Lists','where':{'id':_0x1a37af[_0xddaf('0x27')]}}]})[_0xddaf('0x1c')](function(_0x1c7563){if(_0x1c7563){var _0xc156c3=[];for(var _0x5e1313=0x0,_0x26b27c;_0x5e1313<_0x1c7563[_0xddaf('0x36')];_0x5e1313+=0x1){_0x26b27c=_0x1c7563[_0x5e1313][_0xddaf('0x14')]({'plain':!![]});switch(_0x26b27c[_0xddaf('0x35')]){case _0xddaf('0x37'):_0x53e937(_0x26b27c)[_0xddaf('0x2a')](_0x3c8f1e());break;case _0xddaf('0x38'):_0x11c6ef(_0x26b27c)[_0xddaf('0x2a')](_0x3c8f1e());break;default:_0x321c9d(_0x26b27c,_0x1a37af)[_0xddaf('0x1c')](function(_0x1ee59a){_0x1a37af[_0xddaf('0x18')]=_0x1ee59a[_0xddaf('0x21')];_0x421b54[_0xddaf('0x25')]['create']({'phone':_0x1a37af[_0xddaf('0xc')],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af[_0xddaf('0x27')],'scheduledat':_0x1a37af[_0xddaf('0x18')]?_0x1a37af[_0xddaf('0x18')]:moment()['format'](_0xddaf('0x1a')),'priority':_0x1a37af[_0xddaf('0x28')]?_0x1a37af[_0xddaf('0x28')]:0x2,'callback':_0x1a37af[_0xddaf('0x29')]?!![]:![],'callbackuniqueid':_0x1a37af[_0xddaf('0x29')]?_0x1a37af[_0xddaf('0x29')]:undefined,'callbackat':_0x1a37af['callbackUniqueid']?moment()[_0xddaf('0x19')](_0xddaf('0x1a')):undefined,'VoiceQueueId':_0x26b27c['id']})[_0xddaf('0x2a')](_0x3c8f1e());});}}}})[_0xddaf('0x1c')](function(){return _0x421b54[_0xddaf('0x39')][_0xddaf('0x33')]({'where':{'type':_0xddaf('0x34')},'attributes':['id'],'include':[{'model':_0x421b54['CmList'],'as':_0xddaf('0x3a'),'where':{'id':_0x1a37af['ListId']}}]})[_0xddaf('0x1c')](function(_0xa23439){if(_0xa23439){var _0x470d6a=[];for(var _0x58c587=0x0,_0x4e6dcb;_0x58c587<_0xa23439['length'];_0x58c587+=0x1){_0x4e6dcb=_0xa23439[_0x58c587][_0xddaf('0x14')]({'plain':!![]});_0x421b54[_0xddaf('0x3b')][_0xddaf('0x26')]({'phone':_0x1a37af[_0xddaf('0xc')],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af[_0xddaf('0x27')],'VoiceQueueId':_0x4e6dcb['id']})[_0xddaf('0x2a')](function(_0x1f8cad){logger['error'](_0xddaf('0x3c'),_0xddaf('0x16'),_0x1f8cad[_0xddaf('0x3d')]);});}}});})[_0xddaf('0x1c')](function(){return _0x421b54[_0xddaf('0x3e')]['findAll']({'attributes':['id','dialCheckDuplicateType',_0xddaf('0x1d')],'include':[{'model':_0x421b54[_0xddaf('0x3f')],'as':_0xddaf('0x40'),'where':{'id':_0x1a37af[_0xddaf('0x27')]}}]})[_0xddaf('0x1c')](function(_0x2b22b1){if(_0x2b22b1){var _0x5854ae=[];for(var _0x215752=0x0,_0x5085c9;_0x215752<_0x2b22b1[_0xddaf('0x36')];_0x215752+=0x1){_0x5085c9=_0x2b22b1[_0x215752][_0xddaf('0x14')]({'plain':!![]});switch(_0x5085c9['dialCheckDuplicateType']){case'always':_0x4d0073(_0x5085c9)[_0xddaf('0x2a')](_0x25ac45());break;case _0xddaf('0x38'):_0x3081be(_0x5085c9)['catch'](_0x25ac45());break;default:_0x421b54[_0xddaf('0x25')][_0xddaf('0x26')]({'phone':_0x1a37af[_0xddaf('0xc')],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af[_0xddaf('0x27')],'scheduledat':_0x1a37af[_0xddaf('0x18')]?_0x1a37af['scheduledat']:moment()[_0xddaf('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1a37af[_0xddaf('0x28')]?_0x1a37af[_0xddaf('0x28')]:0x2,'callback':_0x1a37af['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1a37af['callbackUniqueid']?_0x1a37af[_0xddaf('0x29')]:undefined,'callbackat':_0x1a37af[_0xddaf('0x29')]?moment()[_0xddaf('0x19')](_0xddaf('0x1a')):undefined,'CampaignId':_0x5085c9['id']})[_0xddaf('0x2a')](_0x25ac45());}}}});})[_0xddaf('0x1c')](function(){return _0x421b54[_0xddaf('0x3e')][_0xddaf('0x33')]({'attributes':['id'],'include':[{'model':_0x421b54[_0xddaf('0x3f')],'as':'BlackLists','where':{'id':_0x1a37af[_0xddaf('0x27')]}}]})[_0xddaf('0x1c')](function(_0x418984){if(_0x418984){var _0x227520=[];for(var _0x11c875=0x0,_0x372907;_0x11c875<_0x418984[_0xddaf('0x36')];_0x11c875+=0x1){_0x372907=_0x418984[_0x11c875][_0xddaf('0x14')]({'plain':!![]});_0x421b54[_0xddaf('0x3b')][_0xddaf('0x26')]({'phone':_0x1a37af[_0xddaf('0xc')],'ContactId':_0x1a37af['id'],'ListId':_0x1a37af[_0xddaf('0x27')],'CampaignId':_0x372907['id']})[_0xddaf('0x2a')](function(_0x47ea9e){logger['error'](_0xddaf('0x3c'),'afterCreate',_0x47ea9e['message']);});}}});})['then'](function(){_0x470a82();})[_0xddaf('0x2a')](function(_0x3bb19b){logger[_0xddaf('0x2f')](_0xddaf('0x3c'),_0xddaf('0x16'),_0x3bb19b[_0xddaf('0x3d')]);_0x470a82(_0x3bb19b);});}else{_0x470a82(new Error(_0xddaf('0x41')));}},'afterDestroy':function(_0x536cb8,_0x251148,_0xbc7662){var _0xd1f8bc=_0x2e4bf3['models'];var _0x4c6570=_0x536cb8[_0xddaf('0x14')]({'plain':!![]});return _0xd1f8bc[_0xddaf('0x25')][_0xddaf('0x33')]({'raw':!![],'where':{'ListId':_0x4c6570[_0xddaf('0x27')],'ContactId':_0x4c6570['id']}})[_0xddaf('0x1c')](function(_0x1aeaca){if(!_[_0xddaf('0x42')](_0x1aeaca)){var _0x38a708=[];for(var _0x1a2d4c=0x0;_0x1a2d4c<_0x1aeaca[_0xddaf('0x36')];_0x1a2d4c+=0x1){var _0x10b670=_0xd1f8bc['CmHopper'][_0xddaf('0x43')]({'where':{'ListId':_0x1aeaca[_0x1a2d4c][_0xddaf('0x27')],'ContactId':_0x1aeaca[_0x1a2d4c]['ContactId'],'VoiceQueueId':_0x1aeaca[_0x1a2d4c]['VoiceQueueId'],'CampaignId':_0x1aeaca[_0x1a2d4c][_0xddaf('0x44')]}});_0x38a708['push'](_0x10b670);}return BPromise[_0xddaf('0x45')](_0x38a708);}})[_0xddaf('0x1c')](function(_0x2c71ff){logger[_0xddaf('0x46')]('[CmContact][afterDestroy][Succesfull]',util[_0xddaf('0x17')](_0x2c71ff,{'showHidden':![],'depth':null}));_0xbc7662();})[_0xddaf('0x2a')](function(_0x1e7ab5){logger[_0xddaf('0x2f')]('[CmContact][afterDestroy][Error]',util[_0xddaf('0x17')](_0x1e7ab5,{'showHidden':![],'depth':null}));_0xbc7662(_0x1e7ab5);});}}});}; \ No newline at end of file +var _0xee7c=['List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','lodash','util','../../config/logger','api','bluebird','path','../../config/environment/shared','./cmContact.attributes','exports','cm_contacts','phone','firstName','lastName','email','utf8mb4','utf8mb4_unicode_ci','models','get','error','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','utcOffset','add','minutes','format','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','afterCreate','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','Lists','length','dialCheckDuplicateType','onlyIfOpen','CmList','BlackLists','cmContact,\x20%s,\x20%s','message','always'];(function(_0x2301be,_0x125d4e){var _0x4d9e16=function(_0x30cf02){while(--_0x30cf02){_0x2301be['push'](_0x2301be['shift']());}};_0x4d9e16(++_0x125d4e);}(_0xee7c,0x90));var _0xcee7=function(_0x4513aa,_0x7e37f0){_0x4513aa=_0x4513aa-0x0;var _0x48b503=_0xee7c[_0x4513aa];return _0x48b503;};'use strict';var _=require(_0xcee7('0x0'));var util=require(_0xcee7('0x1'));var logger=require(_0xcee7('0x2'))(_0xcee7('0x3'));var moment=require('moment');var BPromise=require(_0xcee7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcee7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require(_0xcee7('0x6'));var attributes=require(_0xcee7('0x7'));module[_0xcee7('0x8')]=function(_0x348225,_0x812edc){return _0x348225['define']('CmContact',attributes,{'tableName':_0xcee7('0x9'),'paranoid':!![],'indexes':[{'name':_0xcee7('0xa'),'fields':[_0xcee7('0xa')]},{'name':'fti_cm_contacts','fields':[_0xcee7('0xb'),_0xcee7('0xc'),_0xcee7('0xa'),'mobile','fax',_0xcee7('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xcee7('0xe'),'collate':_0xcee7('0xf'),'hooks':{'afterCreate':function(_0x5a66b6,_0x47e1a1,_0x55e215){var _0x308315=_0x348225[_0xcee7('0x10')];var _0x2afd73=_0x5a66b6[_0xcee7('0x11')]({'plain':!![]});function _0x49f647(){return function(_0x5adad5){logger[_0xcee7('0x12')]('cmContact','afterCreate',util[_0xcee7('0x13')](_0x5adad5,{'showHidden':![],'depth':null}));};}function _0x4e4101(_0x56e5ca,_0xf18ce1){var _0x17bcac=_0xf18ce1['scheduledat']?_0xf18ce1[_0xcee7('0x14')]:moment()['format'](_0xcee7('0x15'));return new BPromise(function(_0x1e802b,_0x54a387){if(_[_0xcee7('0x16')](_0xf18ce1[_0xcee7('0x17')])){_0x1e802b({'ret':_0x17bcac});}else{_0x308315['VoiceQueue'][_0xcee7('0x18')]({'where':{'id':_0x56e5ca['id']}})[_0xcee7('0x19')](function(_0x12ae06){if(!_[_0xcee7('0x16')](_0x12ae06)){var _0x298df6=_0x12ae06[_0xcee7('0x17')];if(!_['isNil'](_0x298df6)){var _0x362174=shared['timezones'];var _0x4fa9b9=_0x362174[_0x298df6];var _0x5b7426=_0x362174[_0xf18ce1['dialTimezone']];if(!_[_0xcee7('0x16')](_0x4fa9b9)&&!_['isNil'](_0x5b7426)){var _0x323ba6=_0x4fa9b9[_0xcee7('0x1a')]-_0x5b7426['utcOffset'];_0x17bcac=_0xf18ce1[_0xcee7('0x14')]?_0xf18ce1[_0xcee7('0x14')]:moment();var _0x47cbf0=moment(_0x17bcac)[_0xcee7('0x1b')](_0x323ba6,_0xcee7('0x1c'));_0x1e802b({'ret':_0x47cbf0[_0xcee7('0x1d')](_0xcee7('0x15'))});}else _0x1e802b({'ret':_0x17bcac});}else _0x1e802b({'ret':_0x17bcac});}else{_0x1e802b({'ret':_0x17bcac});}});}});return 0xa;}var _0x275e95=function(_0x256607){return new BPromise(function(_0xcf33ce,_0x2cdd45){_0x4e4101(_0x256607,_0x2afd73)[_0xcee7('0x19')](function(_0x35af84){_0x2afd73[_0xcee7('0x14')]=_0x35af84[_0xcee7('0x1e')];_0x308315['CmHopper']['findOne']({'where':{'phone':_0x2afd73[_0xcee7('0xa')],'VoiceQueueId':_0x256607['id']}})[_0xcee7('0x19')](function(_0x273f87){if(!_[_0xcee7('0x16')](_0x273f87)){throw new Error(_0xcee7('0x1f')+_0x2afd73[_0xcee7('0xa')]+_0xcee7('0x20')+_0x256607['id']);}return _0x308315['CmHopper']['create']({'phone':_0x2afd73[_0xcee7('0xa')],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73[_0xcee7('0x21')],'priority':_0x2afd73[_0xcee7('0x22')]?_0x2afd73['priority']:0x2,'scheduledat':_0x2afd73[_0xcee7('0x14')]?_0x2afd73[_0xcee7('0x14')]:moment()['format'](_0xcee7('0x15')),'callback':_0x2afd73['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2afd73[_0xcee7('0x23')]?_0x2afd73[_0xcee7('0x23')]:undefined,'callbackat':_0x2afd73[_0xcee7('0x23')]?moment()[_0xcee7('0x1d')](_0xcee7('0x15')):undefined,'VoiceQueueId':_0x256607['id']});})[_0xcee7('0x24')](function(_0x14ce5a){_0x2cdd45(_0x14ce5a);});});});};var _0x45695c=function(_0x2bf73c){return new BPromise(function(_0x5ca1cd,_0x161ea4){_0x4e4101(_0x2bf73c,_0x2afd73)['then'](function(_0x4cb10d){_0x2afd73[_0xcee7('0x14')]=_0x4cb10d[_0xcee7('0x1e')];_0x308315[_0xcee7('0x25')][_0xcee7('0x18')]({'where':{'phone':_0x2afd73[_0xcee7('0xa')],'VoiceQueueId':_0x2bf73c['id']}})[_0xcee7('0x19')](function(_0x3b2074){if(!_[_0xcee7('0x16')](_0x3b2074)){throw new Error(_0xcee7('0x1f')+_0x2afd73[_0xcee7('0xa')]+_0xcee7('0x26')+_0x2bf73c['id']);}return _0x308315['CmHopperFinal'][_0xcee7('0x18')]({'where':{'calleridnum':_0x2afd73[_0xcee7('0xa')],'VoiceQueueId':_0x2bf73c['id']}});})[_0xcee7('0x19')](function(_0x47312f){if(!_[_0xcee7('0x16')](_0x47312f)){throw new Error(_0xcee7('0x27')+_0x2afd73[_0xcee7('0xa')]+_0xcee7('0x28')+_0x2bf73c['id']);}return _0x308315[_0xcee7('0x25')][_0xcee7('0x29')]({'phone':_0x2afd73['phone'],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73[_0xcee7('0x21')],'priority':_0x2afd73[_0xcee7('0x22')]?_0x2afd73['priority']:0x2,'scheduledat':_0x2afd73[_0xcee7('0x14')]?_0x2afd73['scheduledat']:moment()[_0xcee7('0x1d')](_0xcee7('0x15')),'callback':_0x2afd73['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2afd73['callbackUniqueid']?_0x2afd73[_0xcee7('0x23')]:undefined,'callbackat':_0x2afd73['callbackUniqueid']?moment()[_0xcee7('0x1d')](_0xcee7('0x15')):undefined,'VoiceQueueId':_0x2bf73c['id']});})[_0xcee7('0x24')](function(_0x56ac47){_0x161ea4(_0x56ac47);});});});};function _0x5cc943(){return function(_0x112856){logger[_0xcee7('0x12')]('cmContact',_0xcee7('0x2a'),util[_0xcee7('0x13')](_0x112856,{'showHidden':![],'depth':null}));};}function _0x5a675d(_0x4e0455,_0x45a0ec){var _0x38436a=_0x45a0ec[_0xcee7('0x14')]?_0x45a0ec['scheduledat']:moment()[_0xcee7('0x1d')](_0xcee7('0x15'));return new BPromise(function(_0x288dd0,_0x174d03){if(_['isNil'](_0x45a0ec[_0xcee7('0x17')])){_0x288dd0({'ret':_0x38436a});}else{_0x308315[_0xcee7('0x2b')]['findOne']({'where':{'id':_0x4e0455['id']}})[_0xcee7('0x19')](function(_0x2eaa7b){if(!_[_0xcee7('0x16')](_0x2eaa7b)){var _0x9a417f=_0x2eaa7b[_0xcee7('0x17')];if(!_['isNil'](_0x9a417f)){var _0xf3faa9=shared[_0xcee7('0x2c')];var _0x436470=_0xf3faa9[_0x9a417f];var _0x456054=_0xf3faa9[_0x45a0ec[_0xcee7('0x17')]];if(!_['isNil'](_0x436470)&&!_[_0xcee7('0x16')](_0x456054)){var _0x355e27=_0x436470['utcOffset']-_0x456054[_0xcee7('0x1a')];_0x38436a=_0x45a0ec[_0xcee7('0x14')]?_0x45a0ec[_0xcee7('0x14')]:moment();var _0x42256f=moment(_0x38436a)[_0xcee7('0x1b')](_0x355e27,_0xcee7('0x1c'));_0x288dd0({'ret':_0x42256f['format'](_0xcee7('0x15'))});}else _0x288dd0({'ret':_0x38436a});}else _0x288dd0({'ret':_0x38436a});}else{_0x288dd0({'ret':_0x38436a});}});}});return 0xa;}var _0x205ab8=function(_0x44fde1){return new BPromise(function(_0x2248c2,_0x5c06d6){_0x5a675d(_0x44fde1,_0x2afd73)[_0xcee7('0x19')](function(_0x2b160d){_0x2afd73[_0xcee7('0x14')]=_0x2b160d['ret'];_0x308315[_0xcee7('0x25')]['findOne']({'where':{'phone':_0x2afd73[_0xcee7('0xa')],'CampaignId':_0x44fde1['id']}})[_0xcee7('0x19')](function(_0x192c62){if(!_[_0xcee7('0x16')](_0x192c62)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2afd73[_0xcee7('0xa')]+_0xcee7('0x2d')+_0x44fde1['id']);}return _0x308315[_0xcee7('0x25')][_0xcee7('0x29')]({'phone':_0x2afd73['phone'],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73[_0xcee7('0x21')],'priority':_0x2afd73[_0xcee7('0x22')]?_0x2afd73['priority']:0x2,'scheduledat':_0x2afd73[_0xcee7('0x14')]?_0x2afd73[_0xcee7('0x14')]:moment()[_0xcee7('0x1d')](_0xcee7('0x15')),'callback':_0x2afd73[_0xcee7('0x23')]?!![]:![],'callbackuniqueid':_0x2afd73[_0xcee7('0x23')]?_0x2afd73['callbackUniqueid']:undefined,'callbackat':_0x2afd73[_0xcee7('0x23')]?moment()[_0xcee7('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x44fde1['id']});})[_0xcee7('0x24')](function(_0x445057){_0x5c06d6(_0x445057);});});});};var _0x20402d=function(_0x55b354){return new BPromise(function(_0x4b5418,_0x424372){_0x5a675d(_0x55b354,_0x2afd73)['then'](function(_0xa71472){_0x2afd73['scheduledat']=_0xa71472[_0xcee7('0x1e')];_0x308315[_0xcee7('0x25')][_0xcee7('0x18')]({'where':{'phone':_0x2afd73['phone'],'CampaignId':_0x55b354['id']}})['then'](function(_0x323217){if(!_['isNil'](_0x323217)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2afd73[_0xcee7('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x55b354['id']);}return _0x308315[_0xcee7('0x2e')]['findOne']({'where':{'calleridnum':_0x2afd73['phone'],'CampaignId':_0x55b354['id']}});})['then'](function(_0x57f038){if(!_['isNil'](_0x57f038)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2afd73['phone']+_0xcee7('0x2f')+_0x55b354['id']);}return _0x308315[_0xcee7('0x25')][_0xcee7('0x29')]({'phone':_0x2afd73[_0xcee7('0xa')],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73[_0xcee7('0x21')],'priority':_0x2afd73['priority']?_0x2afd73[_0xcee7('0x22')]:0x2,'scheduledat':_0x2afd73[_0xcee7('0x14')]?_0x2afd73['scheduledat']:moment()[_0xcee7('0x1d')](_0xcee7('0x15')),'callback':_0x2afd73['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2afd73[_0xcee7('0x23')]?_0x2afd73[_0xcee7('0x23')]:undefined,'callbackat':_0x2afd73[_0xcee7('0x23')]?moment()[_0xcee7('0x1d')](_0xcee7('0x15')):undefined,'CampaignId':_0x55b354['id']});})[_0xcee7('0x24')](function(_0x4dde6b){_0x424372(_0x4dde6b);});});});};if(_0x2afd73[_0xcee7('0x21')]){_0x308315[_0xcee7('0x30')][_0xcee7('0x31')]({'where':{'type':_0xcee7('0x32')},'attributes':['id','dialCheckDuplicateType',_0xcee7('0x17')],'include':[{'model':_0x308315['CmList'],'as':_0xcee7('0x33'),'where':{'id':_0x2afd73['ListId']}}]})[_0xcee7('0x19')](function(_0x4d1a6d){if(_0x4d1a6d){var _0x3db62e=[];for(var _0x365810=0x0,_0x3dc40a;_0x365810<_0x4d1a6d[_0xcee7('0x34')];_0x365810+=0x1){_0x3dc40a=_0x4d1a6d[_0x365810][_0xcee7('0x11')]({'plain':!![]});switch(_0x3dc40a[_0xcee7('0x35')]){case'always':_0x45695c(_0x3dc40a)[_0xcee7('0x24')](_0x49f647());break;case _0xcee7('0x36'):_0x275e95(_0x3dc40a)['catch'](_0x49f647());break;default:_0x5a675d(_0x3dc40a,_0x2afd73)[_0xcee7('0x19')](function(_0x1e2ddc){_0x2afd73[_0xcee7('0x14')]=_0x1e2ddc['ret'];_0x308315[_0xcee7('0x25')][_0xcee7('0x29')]({'phone':_0x2afd73[_0xcee7('0xa')],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73[_0xcee7('0x21')],'scheduledat':_0x2afd73[_0xcee7('0x14')]?_0x2afd73[_0xcee7('0x14')]:moment()[_0xcee7('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2afd73['priority']?_0x2afd73[_0xcee7('0x22')]:0x2,'callback':_0x2afd73[_0xcee7('0x23')]?!![]:![],'callbackuniqueid':_0x2afd73[_0xcee7('0x23')]?_0x2afd73['callbackUniqueid']:undefined,'callbackat':_0x2afd73[_0xcee7('0x23')]?moment()['format'](_0xcee7('0x15')):undefined,'VoiceQueueId':_0x3dc40a['id']})[_0xcee7('0x24')](_0x49f647());});}}}})[_0xcee7('0x19')](function(){return _0x308315[_0xcee7('0x30')][_0xcee7('0x31')]({'where':{'type':_0xcee7('0x32')},'attributes':['id'],'include':[{'model':_0x308315[_0xcee7('0x37')],'as':_0xcee7('0x38'),'where':{'id':_0x2afd73['ListId']}}]})[_0xcee7('0x19')](function(_0x2d190e){if(_0x2d190e){var _0x20b68d=[];for(var _0x5103bc=0x0,_0x35f307;_0x5103bc<_0x2d190e[_0xcee7('0x34')];_0x5103bc+=0x1){_0x35f307=_0x2d190e[_0x5103bc][_0xcee7('0x11')]({'plain':!![]});_0x308315['CmHopperBlack'][_0xcee7('0x29')]({'phone':_0x2afd73[_0xcee7('0xa')],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73['ListId'],'VoiceQueueId':_0x35f307['id']})[_0xcee7('0x24')](function(_0x4b84be){logger[_0xcee7('0x12')](_0xcee7('0x39'),_0xcee7('0x2a'),_0x4b84be[_0xcee7('0x3a')]);});}}});})[_0xcee7('0x19')](function(){return _0x308315['Campaign'][_0xcee7('0x31')]({'attributes':['id',_0xcee7('0x35'),_0xcee7('0x17')],'include':[{'model':_0x308315[_0xcee7('0x37')],'as':'Lists','where':{'id':_0x2afd73['ListId']}}]})[_0xcee7('0x19')](function(_0xcd42af){if(_0xcd42af){var _0x5e9ac1=[];for(var _0x4fd1e3=0x0,_0x4294d7;_0x4fd1e3<_0xcd42af['length'];_0x4fd1e3+=0x1){_0x4294d7=_0xcd42af[_0x4fd1e3]['get']({'plain':!![]});switch(_0x4294d7[_0xcee7('0x35')]){case _0xcee7('0x3b'):_0x20402d(_0x4294d7)[_0xcee7('0x24')](_0x5cc943());break;case _0xcee7('0x36'):_0x205ab8(_0x4294d7)[_0xcee7('0x24')](_0x5cc943());break;default:_0x308315[_0xcee7('0x25')]['create']({'phone':_0x2afd73[_0xcee7('0xa')],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73[_0xcee7('0x21')],'scheduledat':_0x2afd73[_0xcee7('0x14')]?_0x2afd73[_0xcee7('0x14')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2afd73['priority']?_0x2afd73[_0xcee7('0x22')]:0x2,'callback':_0x2afd73[_0xcee7('0x23')]?!![]:![],'callbackuniqueid':_0x2afd73[_0xcee7('0x23')]?_0x2afd73[_0xcee7('0x23')]:undefined,'callbackat':_0x2afd73[_0xcee7('0x23')]?moment()[_0xcee7('0x1d')](_0xcee7('0x15')):undefined,'CampaignId':_0x4294d7['id']})[_0xcee7('0x24')](_0x5cc943());}}}});})['then'](function(){return _0x308315[_0xcee7('0x2b')][_0xcee7('0x31')]({'attributes':['id'],'include':[{'model':_0x308315['CmList'],'as':'BlackLists','where':{'id':_0x2afd73['ListId']}}]})['then'](function(_0x49e96f){if(_0x49e96f){var _0x5b07e0=[];for(var _0x5a014=0x0,_0xb4aee0;_0x5a014<_0x49e96f[_0xcee7('0x34')];_0x5a014+=0x1){_0xb4aee0=_0x49e96f[_0x5a014][_0xcee7('0x11')]({'plain':!![]});_0x308315['CmHopperBlack'][_0xcee7('0x29')]({'phone':_0x2afd73[_0xcee7('0xa')],'ContactId':_0x2afd73['id'],'ListId':_0x2afd73[_0xcee7('0x21')],'CampaignId':_0xb4aee0['id']})[_0xcee7('0x24')](function(_0x2ccc2b){logger[_0xcee7('0x12')](_0xcee7('0x39'),_0xcee7('0x2a'),_0x2ccc2b['message']);});}}});})['then'](function(){_0x55e215();})[_0xcee7('0x24')](function(_0x3851e3){logger[_0xcee7('0x12')]('cmContact,\x20%s,\x20%s','afterCreate',_0x3851e3[_0xcee7('0x3a')]);_0x55e215(_0x3851e3);});}else{_0x55e215(new Error(_0xcee7('0x3c')));}},'afterDestroy':function(_0x3159d8,_0x38b758,_0x2ebc3e){var _0x240115=_0x348225[_0xcee7('0x10')];var _0x5a557a=_0x3159d8['get']({'plain':!![]});return _0x240115[_0xcee7('0x25')][_0xcee7('0x31')]({'raw':!![],'where':{'ListId':_0x5a557a['ListId'],'ContactId':_0x5a557a['id']}})[_0xcee7('0x19')](function(_0x3ce15b){if(!_[_0xcee7('0x3d')](_0x3ce15b)){var _0x5e1869=[];for(var _0x221360=0x0;_0x221360<_0x3ce15b[_0xcee7('0x34')];_0x221360+=0x1){var _0x5a2c59=_0x240115[_0xcee7('0x25')][_0xcee7('0x3e')]({'where':{'ListId':_0x3ce15b[_0x221360][_0xcee7('0x21')],'ContactId':_0x3ce15b[_0x221360][_0xcee7('0x3f')],'VoiceQueueId':_0x3ce15b[_0x221360][_0xcee7('0x40')],'CampaignId':_0x3ce15b[_0x221360][_0xcee7('0x41')]}});_0x5e1869[_0xcee7('0x42')](_0x5a2c59);}return BPromise[_0xcee7('0x43')](_0x5e1869);}})['then'](function(_0x3be20c){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xcee7('0x13')](_0x3be20c,{'showHidden':![],'depth':null}));_0x2ebc3e();})[_0xcee7('0x24')](function(_0x1368a3){logger[_0xcee7('0x12')]('[CmContact][afterDestroy][Error]',util[_0xcee7('0x13')](_0x1368a3,{'showHidden':![],'depth':null}));_0x2ebc3e(_0x1368a3);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index db5cc8a..03c1d09 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x255789,_0x52303c){var _0x558a71=function(_0x4b44f7){while(--_0x4b44f7){_0x255789['push'](_0x255789['shift']());}};_0x558a71(++_0x52303c);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3c1f66,_0xfe22f9){var _0x5baf06=function(_0x56715b){while(--_0x56715b){_0x3c1f66['push'](_0x3c1f66['shift']());}};_0x5baf06(++_0xfe22f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index db3059d..631b864 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x342b=['INTEGER','STRING','sequelize'];(function(_0x3102c7,_0x290028){var _0x24ba6b=function(_0x1ec515){while(--_0x1ec515){_0x3102c7['push'](_0x3102c7['shift']());}};_0x24ba6b(++_0x290028);}(_0x342b,0xbc));var _0xb342=function(_0x2ac91c,_0x45490d){_0x2ac91c=_0x2ac91c-0x0;var _0x3085cd=_0x342b[_0x2ac91c];return _0x3085cd;};'use strict';var Sequelize=require(_0xb342('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xb342('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb342('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb342('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x3667=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x4833c4,_0x264b18){var _0x3705fc=function(_0x22b223){while(--_0x22b223){_0x4833c4['push'](_0x4833c4['shift']());}};_0x3705fc(++_0x264b18);}(_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')]={'CmContactId':{'type':Sequelize[_0x7366('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7366('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7366('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x7366('0x4')},'OrderBy':{'type':Sequelize[_0x7366('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 33eefb0..0ba0e35 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7967=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','CmContactHasItems','UserProfileResource','destroy','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','params','keys','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x5244bc,_0xbeed11){var _0x3ae51c=function(_0x4f00b9){while(--_0x4f00b9){_0x5244bc['push'](_0x5244bc['shift']());}};_0x3ae51c(++_0xbeed11);}(_0x7967,0x1ce));var _0x7796=function(_0x3d8c18,_0x21b651){_0x3d8c18=_0x3d8c18-0x0;var _0x24c81d=_0x7967[_0x3d8c18];return _0x24c81d;};'use strict';var emlformat=require(_0x7796('0x0'));var rimraf=require(_0x7796('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7796('0x2'));var rp=require(_0x7796('0x3'));var moment=require(_0x7796('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7796('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7796('0x6'));var csv=require(_0x7796('0x7'));var ejs=require(_0x7796('0x8'));var fs=require('fs');var fs_extra=require(_0x7796('0x9'));var _=require(_0x7796('0xa'));var squel=require(_0x7796('0xb'));var crypto=require(_0x7796('0xc'));var jsforce=require(_0x7796('0xd'));var deskjs=require(_0x7796('0xe'));var toCsv=require(_0x7796('0x7'));var querystring=require(_0x7796('0xf'));var Papa=require(_0x7796('0x10'));var Redis=require(_0x7796('0x11'));var authService=require(_0x7796('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7796('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7796('0x14'))(_0x7796('0x15'));var utils=require(_0x7796('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7796('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x382f77,_0x222c95){_0x222c95=_0x222c95||0xcc;return function(_0x36d541){if(_0x36d541){return _0x382f77[_0x7796('0x18')](_0x222c95);}return _0x382f77[_0x7796('0x19')](_0x222c95)[_0x7796('0x1a')]();};}function respondWithResult(_0x2101a0,_0x216b0a){_0x216b0a=_0x216b0a||0xc8;return function(_0x1eb180){if(_0x1eb180){return _0x2101a0[_0x7796('0x19')](_0x216b0a)[_0x7796('0x1b')](_0x1eb180);}};}function respondWithFilteredResult(_0x39487e,_0x201451){return function(_0x1dbd9a){if(_0x1dbd9a){var _0x5f2a04=typeof _0x201451[_0x7796('0x1c')]===_0x7796('0x1d')&&typeof _0x201451[_0x7796('0x1e')]===_0x7796('0x1d');var _0x594b1c=_0x1dbd9a['count'];var _0x4bd9be=_0x5f2a04?0x0:_0x201451[_0x7796('0x1c')];var _0x1ff4dd=_0x5f2a04?_0x1dbd9a[_0x7796('0x1f')]:_0x201451[_0x7796('0x1c')]+_0x201451[_0x7796('0x1e')];var _0x1e308f;if(_0x1ff4dd>=_0x594b1c){_0x1ff4dd=_0x594b1c;_0x1e308f=0xc8;}else{_0x1e308f=0xce;}_0x39487e['status'](_0x1e308f);return _0x39487e['set']('Content-Range',_0x4bd9be+'-'+_0x1ff4dd+'/'+_0x594b1c)['json'](_0x1dbd9a);}return null;};}function patchUpdates(_0x12564b){return function(_0x3be880){try{jsonpatch[_0x7796('0x20')](_0x3be880,_0x12564b,!![]);}catch(_0x3f3778){return BPromise[_0x7796('0x21')](_0x3f3778);}return _0x3be880[_0x7796('0x22')]();};}function saveUpdates(_0xb10a27,_0xeadb43){return function(_0xa6c52d){if(_0xa6c52d){return _0xa6c52d[_0x7796('0x23')](_0xb10a27)[_0x7796('0x24')](function(_0x122a9a){return _0x122a9a;});}return null;};}function removeEntity(_0x494d6c,_0x550019){return function(_0x5e851a){if(_0x5e851a){return _0x5e851a['destroy']()[_0x7796('0x24')](function(){var _0x5e6a49=_0x5e851a['get']({'plain':!![]});var _0x5da2cf=_0x7796('0x25');return db[_0x7796('0x26')][_0x7796('0x27')]({'where':{'type':_0x5da2cf,'resourceId':_0x5e6a49['id']}})[_0x7796('0x24')](function(){return _0x5e851a;});})['then'](function(){_0x494d6c[_0x7796('0x19')](0xcc)[_0x7796('0x1a')]();});}};}function handleEntityNotFound(_0x3e664b,_0x59ed14){return function(_0x56e218){if(!_0x56e218){_0x3e664b[_0x7796('0x18')](0x194);}return _0x56e218;};}function handleError(_0x2a01dd,_0x321b2b){_0x321b2b=_0x321b2b||0x1f4;return function(_0x46f540){logger['error'](_0x46f540[_0x7796('0x28')]);if(_0x46f540['name']){delete _0x46f540[_0x7796('0x29')];}_0x2a01dd['status'](_0x321b2b)[_0x7796('0x2a')](_0x46f540);};}exports[_0x7796('0x2b')]=function(_0x46e52d,_0x944917){var _0x1c641d={},_0xe66ded={},_0x1a5149={'count':0x0,'rows':[]};var _0x139e74=_['map'](db[_0x7796('0x2c')][_0x7796('0x2d')],function(_0x3958ce){return{'name':_0x3958ce[_0x7796('0x2e')],'type':_0x3958ce[_0x7796('0x2f')]['key']};});_0xe66ded[_0x7796('0x30')]=_[_0x7796('0x31')](_0x139e74,'name');_0xe66ded[_0x7796('0x32')]=_['keys'](_0x46e52d[_0x7796('0x32')]);_0xe66ded[_0x7796('0x33')]=_[_0x7796('0x34')](_0xe66ded[_0x7796('0x30')],_0xe66ded[_0x7796('0x32')]);_0x1c641d['attributes']=_[_0x7796('0x34')](_0xe66ded[_0x7796('0x30')],qs['fields'](_0x46e52d['query'][_0x7796('0x35')]));_0x1c641d['attributes']=_0x1c641d['attributes'][_0x7796('0x36')]?_0x1c641d[_0x7796('0x37')]:_0xe66ded['model'];if(!_0x46e52d[_0x7796('0x32')][_0x7796('0x38')]('nolimit')){_0x1c641d['limit']=qs[_0x7796('0x1e')](_0x46e52d[_0x7796('0x32')]['limit']);_0x1c641d[_0x7796('0x1c')]=qs['offset'](_0x46e52d[_0x7796('0x32')][_0x7796('0x1c')]);}_0x1c641d[_0x7796('0x39')]=qs[_0x7796('0x3a')](_0x46e52d[_0x7796('0x32')][_0x7796('0x3a')]);_0x1c641d[_0x7796('0x3b')]=qs[_0x7796('0x33')](_['pick'](_0x46e52d[_0x7796('0x32')],_0xe66ded[_0x7796('0x33')]),_0x139e74);if(_0x46e52d[_0x7796('0x32')][_0x7796('0x3c')]){_0x1c641d[_0x7796('0x3b')]=_[_0x7796('0x3d')](_0x1c641d[_0x7796('0x3b')],{'$or':_[_0x7796('0x31')](_0x139e74,function(_0x2c023){if(_0x2c023[_0x7796('0x2f')]!=='VIRTUAL'){var _0x1cd5ee={};_0x1cd5ee[_0x2c023[_0x7796('0x29')]]={'$like':'%'+_0x46e52d[_0x7796('0x32')]['filter']+'%'};return _0x1cd5ee;}})});}_0x1c641d=_[_0x7796('0x3d')]({},_0x1c641d,_0x46e52d['options']);var _0x45881b={'where':_0x1c641d['where']};return db[_0x7796('0x2c')][_0x7796('0x1f')](_0x45881b)[_0x7796('0x24')](function(_0x14ec31){_0x1a5149[_0x7796('0x1f')]=_0x14ec31;if(_0x46e52d[_0x7796('0x32')][_0x7796('0x3e')]){_0x1c641d['include']=[{'all':!![]}];}return db[_0x7796('0x2c')][_0x7796('0x3f')](_0x1c641d);})[_0x7796('0x24')](function(_0x4b1152){_0x1a5149[_0x7796('0x40')]=_0x4b1152;return _0x1a5149;})[_0x7796('0x24')](respondWithFilteredResult(_0x944917,_0x1c641d))['catch'](handleError(_0x944917,null));};exports['show']=function(_0x545c60,_0x116002){var _0x31b883={'raw':!![],'where':{'id':_0x545c60[_0x7796('0x41')]['id']}},_0x49f669={};_0x49f669['model']=_[_0x7796('0x42')](db['CmContactHasItem'][_0x7796('0x2d')]);_0x49f669[_0x7796('0x32')]=_[_0x7796('0x42')](_0x545c60[_0x7796('0x32')]);_0x49f669[_0x7796('0x33')]=_['intersection'](_0x49f669[_0x7796('0x30')],_0x49f669['query']);_0x31b883[_0x7796('0x37')]=_[_0x7796('0x34')](_0x49f669[_0x7796('0x30')],qs[_0x7796('0x35')](_0x545c60[_0x7796('0x32')][_0x7796('0x35')]));_0x31b883[_0x7796('0x37')]=_0x31b883[_0x7796('0x37')]['length']?_0x31b883[_0x7796('0x37')]:_0x49f669[_0x7796('0x30')];if(_0x545c60[_0x7796('0x32')][_0x7796('0x3e')]){_0x31b883[_0x7796('0x43')]=[{'all':!![]}];}_0x31b883=_[_0x7796('0x3d')]({},_0x31b883,_0x545c60['options']);return db[_0x7796('0x2c')][_0x7796('0x44')](_0x31b883)[_0x7796('0x24')](handleEntityNotFound(_0x116002,null))[_0x7796('0x24')](respondWithResult(_0x116002,null))[_0x7796('0x45')](handleError(_0x116002,null));};exports[_0x7796('0x46')]=function(_0x499fc2,_0x3e94f7){return db['CmContactHasItem'][_0x7796('0x46')](_0x499fc2[_0x7796('0x47')],{})[_0x7796('0x24')](function(_0x2d71ea){var _0x2e63ae=_0x499fc2[_0x7796('0x48')][_0x7796('0x49')]({'plain':!![]});if(!_0x2e63ae)throw new Error(_0x7796('0x4a'));if(_0x2e63ae[_0x7796('0x4b')]===_0x7796('0x48')){var _0x3544e7=_0x2d71ea['get']({'plain':!![]});var _0x37a6f1=_0x7796('0x25');return db['UserProfileSection'][_0x7796('0x44')]({'where':{'name':_0x37a6f1,'userProfileId':_0x2e63ae[_0x7796('0x4c')]},'raw':!![]})[_0x7796('0x24')](function(_0x1b2023){if(_0x1b2023&&_0x1b2023[_0x7796('0x4d')]===0x0){return db[_0x7796('0x26')][_0x7796('0x46')]({'name':_0x3544e7[_0x7796('0x29')],'resourceId':_0x3544e7['id'],'type':_0x1b2023['name'],'sectionId':_0x1b2023['id']},{})[_0x7796('0x24')](function(){return _0x2d71ea;});}else{return _0x2d71ea;}})[_0x7796('0x45')](function(_0x33a6a9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33a6a9);throw _0x33a6a9;});}return _0x2d71ea;})[_0x7796('0x24')](respondWithResult(_0x3e94f7,0xc9))['catch'](handleError(_0x3e94f7,null));};exports[_0x7796('0x23')]=function(_0x2aa1e4,_0x3dd8c1){if(_0x2aa1e4[_0x7796('0x47')]['id']){delete _0x2aa1e4[_0x7796('0x47')]['id'];}return db[_0x7796('0x2c')][_0x7796('0x44')]({'where':{'id':_0x2aa1e4['params']['id']}})['then'](handleEntityNotFound(_0x3dd8c1,null))[_0x7796('0x24')](saveUpdates(_0x2aa1e4['body'],null))[_0x7796('0x24')](respondWithResult(_0x3dd8c1,null))[_0x7796('0x45')](handleError(_0x3dd8c1,null));};exports[_0x7796('0x27')]=function(_0x4b0d9f,_0x2af0ab){return db[_0x7796('0x2c')][_0x7796('0x44')]({'where':{'id':_0x4b0d9f['params']['id']}})[_0x7796('0x24')](handleEntityNotFound(_0x2af0ab,null))['then'](removeEntity(_0x2af0ab,null))[_0x7796('0x45')](handleError(_0x2af0ab,null));}; \ No newline at end of file +var _0x8685=['key','model','map','query','intersection','fields','attributes','length','order','sort','filters','pick','filter','where','merge','include','findAll','rows','catch','show','params','keys','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','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','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','CmContactHasItem','rawAttributes','fieldName','type'];(function(_0x74ffe4,_0x5c69b1){var _0x5b2178=function(_0x4f770a){while(--_0x4f770a){_0x74ffe4['push'](_0x74ffe4['shift']());}};_0x5b2178(++_0x5c69b1);}(_0x8685,0x167));var _0x5868=function(_0xcd4472,_0x322c1a){_0xcd4472=_0xcd4472-0x0;var _0xac3e0f=_0x8685[_0xcd4472];return _0xac3e0f;};'use strict';var emlformat=require(_0x5868('0x0'));var rimraf=require(_0x5868('0x1'));var zipdir=require(_0x5868('0x2'));var jsonpatch=require(_0x5868('0x3'));var rp=require('request-promise');var moment=require(_0x5868('0x4'));var BPromise=require(_0x5868('0x5'));var Mustache=require(_0x5868('0x6'));var util=require('util');var path=require(_0x5868('0x7'));var sox=require('sox');var csv=require(_0x5868('0x8'));var ejs=require(_0x5868('0x9'));var fs=require('fs');var fs_extra=require(_0x5868('0xa'));var _=require(_0x5868('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5868('0xc'));var deskjs=require(_0x5868('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5868('0xe'));var Papa=require(_0x5868('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5868('0x10'));var hardwareService=require(_0x5868('0x11'));var logger=require(_0x5868('0x12'))(_0x5868('0x13'));var utils=require(_0x5868('0x14'));var config=require(_0x5868('0x15'));var licenseUtil=require(_0x5868('0x16'));var db=require(_0x5868('0x17'))['db'];function respondWithStatusCode(_0x151d34,_0x152c85){_0x152c85=_0x152c85||0xcc;return function(_0x49c4a9){if(_0x49c4a9){return _0x151d34['sendStatus'](_0x152c85);}return _0x151d34['status'](_0x152c85)[_0x5868('0x18')]();};}function respondWithResult(_0x2ca2dc,_0xd80d06){_0xd80d06=_0xd80d06||0xc8;return function(_0x42f838){if(_0x42f838){return _0x2ca2dc[_0x5868('0x19')](_0xd80d06)[_0x5868('0x1a')](_0x42f838);}};}function respondWithFilteredResult(_0x496231,_0x3692fa){return function(_0x5d6b89){if(_0x5d6b89){var _0x278851=typeof _0x3692fa[_0x5868('0x1b')]===_0x5868('0x1c')&&typeof _0x3692fa[_0x5868('0x1d')]===_0x5868('0x1c');var _0x392f55=_0x5d6b89[_0x5868('0x1e')];var _0x29eddc=_0x278851?0x0:_0x3692fa[_0x5868('0x1b')];var _0x19d846=_0x278851?_0x5d6b89[_0x5868('0x1e')]:_0x3692fa[_0x5868('0x1b')]+_0x3692fa[_0x5868('0x1d')];var _0x10c483;if(_0x19d846>=_0x392f55){_0x19d846=_0x392f55;_0x10c483=0xc8;}else{_0x10c483=0xce;}_0x496231[_0x5868('0x19')](_0x10c483);return _0x496231[_0x5868('0x1f')](_0x5868('0x20'),_0x29eddc+'-'+_0x19d846+'/'+_0x392f55)[_0x5868('0x1a')](_0x5d6b89);}return null;};}function patchUpdates(_0x4a9f78){return function(_0x5ee27e){try{jsonpatch[_0x5868('0x21')](_0x5ee27e,_0x4a9f78,!![]);}catch(_0x2111d6){return BPromise[_0x5868('0x22')](_0x2111d6);}return _0x5ee27e[_0x5868('0x23')]();};}function saveUpdates(_0x405648,_0x24a329){return function(_0x189d77){if(_0x189d77){return _0x189d77[_0x5868('0x24')](_0x405648)[_0x5868('0x25')](function(_0x2aafa3){return _0x2aafa3;});}return null;};}function removeEntity(_0x472e20,_0x4850d9){return function(_0x3f5719){if(_0x3f5719){return _0x3f5719[_0x5868('0x26')]()[_0x5868('0x25')](function(){var _0x4eceed=_0x3f5719[_0x5868('0x27')]({'plain':!![]});var _0x574441=_0x5868('0x28');return db[_0x5868('0x29')][_0x5868('0x26')]({'where':{'type':_0x574441,'resourceId':_0x4eceed['id']}})['then'](function(){return _0x3f5719;});})[_0x5868('0x25')](function(){_0x472e20['status'](0xcc)[_0x5868('0x18')]();});}};}function handleEntityNotFound(_0x2c8bc9,_0x577944){return function(_0x506885){if(!_0x506885){_0x2c8bc9[_0x5868('0x2a')](0x194);}return _0x506885;};}function handleError(_0x32969f,_0x24adcb){_0x24adcb=_0x24adcb||0x1f4;return function(_0x56ef55){logger[_0x5868('0x2b')](_0x56ef55[_0x5868('0x2c')]);if(_0x56ef55[_0x5868('0x2d')]){delete _0x56ef55['name'];}_0x32969f[_0x5868('0x19')](_0x24adcb)[_0x5868('0x2e')](_0x56ef55);};}exports['index']=function(_0x29887a,_0x4c5788){var _0x512d24={},_0x400175={},_0x2c491d={'count':0x0,'rows':[]};var _0x4a6bc9=_['map'](db[_0x5868('0x2f')][_0x5868('0x30')],function(_0x412dfb){return{'name':_0x412dfb[_0x5868('0x31')],'type':_0x412dfb[_0x5868('0x32')][_0x5868('0x33')]};});_0x400175[_0x5868('0x34')]=_[_0x5868('0x35')](_0x4a6bc9,_0x5868('0x2d'));_0x400175[_0x5868('0x36')]=_['keys'](_0x29887a[_0x5868('0x36')]);_0x400175['filters']=_[_0x5868('0x37')](_0x400175['model'],_0x400175[_0x5868('0x36')]);_0x512d24['attributes']=_[_0x5868('0x37')](_0x400175[_0x5868('0x34')],qs[_0x5868('0x38')](_0x29887a[_0x5868('0x36')][_0x5868('0x38')]));_0x512d24[_0x5868('0x39')]=_0x512d24[_0x5868('0x39')][_0x5868('0x3a')]?_0x512d24[_0x5868('0x39')]:_0x400175['model'];if(!_0x29887a[_0x5868('0x36')]['hasOwnProperty']('nolimit')){_0x512d24['limit']=qs[_0x5868('0x1d')](_0x29887a[_0x5868('0x36')][_0x5868('0x1d')]);_0x512d24[_0x5868('0x1b')]=qs[_0x5868('0x1b')](_0x29887a[_0x5868('0x36')][_0x5868('0x1b')]);}_0x512d24[_0x5868('0x3b')]=qs[_0x5868('0x3c')](_0x29887a[_0x5868('0x36')][_0x5868('0x3c')]);_0x512d24['where']=qs[_0x5868('0x3d')](_[_0x5868('0x3e')](_0x29887a[_0x5868('0x36')],_0x400175[_0x5868('0x3d')]),_0x4a6bc9);if(_0x29887a['query'][_0x5868('0x3f')]){_0x512d24[_0x5868('0x40')]=_[_0x5868('0x41')](_0x512d24[_0x5868('0x40')],{'$or':_[_0x5868('0x35')](_0x4a6bc9,function(_0x310359){if(_0x310359[_0x5868('0x32')]!=='VIRTUAL'){var _0x232af7={};_0x232af7[_0x310359[_0x5868('0x2d')]]={'$like':'%'+_0x29887a['query'][_0x5868('0x3f')]+'%'};return _0x232af7;}})});}_0x512d24=_[_0x5868('0x41')]({},_0x512d24,_0x29887a['options']);var _0x59e1a1={'where':_0x512d24['where']};return db[_0x5868('0x2f')]['count'](_0x59e1a1)['then'](function(_0x4c4432){_0x2c491d[_0x5868('0x1e')]=_0x4c4432;if(_0x29887a[_0x5868('0x36')]['includeAll']){_0x512d24[_0x5868('0x42')]=[{'all':!![]}];}return db[_0x5868('0x2f')][_0x5868('0x43')](_0x512d24);})[_0x5868('0x25')](function(_0xa77109){_0x2c491d[_0x5868('0x44')]=_0xa77109;return _0x2c491d;})[_0x5868('0x25')](respondWithFilteredResult(_0x4c5788,_0x512d24))[_0x5868('0x45')](handleError(_0x4c5788,null));};exports[_0x5868('0x46')]=function(_0x42ef5a,_0x30e913){var _0x49fa8f={'raw':!![],'where':{'id':_0x42ef5a[_0x5868('0x47')]['id']}},_0x472569={};_0x472569[_0x5868('0x34')]=_[_0x5868('0x48')](db[_0x5868('0x2f')][_0x5868('0x30')]);_0x472569[_0x5868('0x36')]=_['keys'](_0x42ef5a[_0x5868('0x36')]);_0x472569[_0x5868('0x3d')]=_[_0x5868('0x37')](_0x472569[_0x5868('0x34')],_0x472569[_0x5868('0x36')]);_0x49fa8f[_0x5868('0x39')]=_[_0x5868('0x37')](_0x472569['model'],qs['fields'](_0x42ef5a[_0x5868('0x36')][_0x5868('0x38')]));_0x49fa8f[_0x5868('0x39')]=_0x49fa8f[_0x5868('0x39')][_0x5868('0x3a')]?_0x49fa8f[_0x5868('0x39')]:_0x472569[_0x5868('0x34')];if(_0x42ef5a[_0x5868('0x36')]['includeAll']){_0x49fa8f[_0x5868('0x42')]=[{'all':!![]}];}_0x49fa8f=_[_0x5868('0x41')]({},_0x49fa8f,_0x42ef5a['options']);return db['CmContactHasItem']['find'](_0x49fa8f)['then'](handleEntityNotFound(_0x30e913,null))['then'](respondWithResult(_0x30e913,null))[_0x5868('0x45')](handleError(_0x30e913,null));};exports[_0x5868('0x49')]=function(_0x30bb8c,_0x237fdf){return db['CmContactHasItem'][_0x5868('0x49')](_0x30bb8c[_0x5868('0x4a')],{})[_0x5868('0x25')](function(_0x893b52){var _0x186426=_0x30bb8c[_0x5868('0x4b')][_0x5868('0x27')]({'plain':!![]});if(!_0x186426)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x186426[_0x5868('0x4c')]===_0x5868('0x4b')){var _0x1721fc=_0x893b52[_0x5868('0x27')]({'plain':!![]});var _0x53006c=_0x5868('0x28');return db[_0x5868('0x4d')][_0x5868('0x4e')]({'where':{'name':_0x53006c,'userProfileId':_0x186426[_0x5868('0x4f')]},'raw':!![]})[_0x5868('0x25')](function(_0x246e45){if(_0x246e45&&_0x246e45[_0x5868('0x50')]===0x0){return db['UserProfileResource'][_0x5868('0x49')]({'name':_0x1721fc[_0x5868('0x2d')],'resourceId':_0x1721fc['id'],'type':_0x246e45[_0x5868('0x2d')],'sectionId':_0x246e45['id']},{})[_0x5868('0x25')](function(){return _0x893b52;});}else{return _0x893b52;}})['catch'](function(_0x2ba048){logger[_0x5868('0x2b')](_0x5868('0x51'),_0x2ba048);throw _0x2ba048;});}return _0x893b52;})[_0x5868('0x25')](respondWithResult(_0x237fdf,0xc9))['catch'](handleError(_0x237fdf,null));};exports['update']=function(_0x35c818,_0x2bb853){if(_0x35c818[_0x5868('0x4a')]['id']){delete _0x35c818[_0x5868('0x4a')]['id'];}return db[_0x5868('0x2f')][_0x5868('0x4e')]({'where':{'id':_0x35c818[_0x5868('0x47')]['id']}})[_0x5868('0x25')](handleEntityNotFound(_0x2bb853,null))[_0x5868('0x25')](saveUpdates(_0x35c818[_0x5868('0x4a')],null))[_0x5868('0x25')](respondWithResult(_0x2bb853,null))[_0x5868('0x45')](handleError(_0x2bb853,null));};exports['destroy']=function(_0x1dd4d1,_0x3c8680){return db[_0x5868('0x2f')][_0x5868('0x4e')]({'where':{'id':_0x1dd4d1[_0x5868('0x47')]['id']}})[_0x5868('0x25')](handleEntityNotFound(_0x3c8680,null))['then'](removeEntity(_0x3c8680,null))[_0x5868('0x45')](handleError(_0x3c8680,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6663244..2c2ad0d 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11dd=['rimraf','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','moment','path'];(function(_0x1dbaf5,_0x136968){var _0x3c627b=function(_0x4d72d2){while(--_0x4d72d2){_0x1dbaf5['push'](_0x1dbaf5['shift']());}};_0x3c627b(++_0x136968);}(_0x11dd,0xe2));var _0xd11d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x11dd[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd11d('0x0'));var util=require('util');var logger=require(_0xd11d('0x1'))('api');var moment=require(_0xd11d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd11d('0x3'));var rimraf=require(_0xd11d('0x4'));var config=require(_0xd11d('0x5'));var attributes=require('./cmContactHasItem.attributes');module[_0xd11d('0x6')]=function(_0x328611,_0x55c91a){return _0x328611[_0xd11d('0x7')](_0xd11d('0x8'),attributes,{'tableName':_0xd11d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0b=['../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x312eff,_0x501165){var _0x5182c0=function(_0x3d11f5){while(--_0x3d11f5){_0x312eff['push'](_0x312eff['shift']());}};_0x5182c0(++_0x501165);}(_0x6f0b,0x94));var _0xb6f0=function(_0x50217f,_0x32f78c){_0x50217f=_0x50217f-0x0;var _0x2c6fed=_0x6f0b[_0x50217f];return _0x2c6fed;};'use strict';var _=require(_0xb6f0('0x0'));var util=require(_0xb6f0('0x1'));var logger=require(_0xb6f0('0x2'))('api');var moment=require(_0xb6f0('0x3'));var BPromise=require(_0xb6f0('0x4'));var rp=require(_0xb6f0('0x5'));var fs=require('fs');var path=require(_0xb6f0('0x6'));var rimraf=require(_0xb6f0('0x7'));var config=require(_0xb6f0('0x8'));var attributes=require('./cmContactHasItem.attributes');module[_0xb6f0('0x9')]=function(_0x3b6e07,_0x470fb5){return _0x3b6e07[_0xb6f0('0xa')](_0xb6f0('0xb'),attributes,{'tableName':_0xb6f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 01168a7..65774e9 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85cc=['code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x85cc,0x1a6));var _0xc85c=function(_0x313454,_0x2f5187){_0x313454=_0x313454-0x0;var _0x338c4c=_0x85cc[_0x313454];return _0x338c4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc85c('0x0'));var BPromise=require(_0xc85c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc85c('0x2'));var db=require(_0xc85c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc85c('0x4'))('rpc');var config=require(_0xc85c('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc85c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x259153,_0x4f02e9,_0x579ab4){return new BPromise(function(_0x120284,_0xb7ddde){return client[_0xc85c('0x7')](_0x259153,_0x579ab4)['then'](function(_0x340707){logger[_0xc85c('0x8')](_0xc85c('0x9'),_0x4f02e9,_0xc85c('0xa'));logger[_0xc85c('0xb')](_0xc85c('0xc'),_0x4f02e9,_0xc85c('0xa'),JSON[_0xc85c('0xd')](_0x340707));if(_0x340707[_0xc85c('0xe')]){if(_0x340707[_0xc85c('0xe')][_0xc85c('0xf')]===0x1f4){logger[_0xc85c('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x4f02e9,_0x340707[_0xc85c('0xe')][_0xc85c('0x10')]);return _0xb7ddde(_0x340707[_0xc85c('0xe')][_0xc85c('0x10')]);}logger[_0xc85c('0xe')](_0xc85c('0x9'),_0x4f02e9,_0x340707[_0xc85c('0xe')][_0xc85c('0x10')]);return _0x120284(_0x340707[_0xc85c('0xe')][_0xc85c('0x10')]);}else{logger[_0xc85c('0x8')](_0xc85c('0x9'),_0x4f02e9,'request\x20sent');_0x120284(_0x340707[_0xc85c('0x11')][_0xc85c('0x10')]);}})[_0xc85c('0x12')](function(_0x579d4b){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4f02e9,_0x579d4b);_0xb7ddde(_0x579d4b);});});} \ No newline at end of file +var _0xc781=['request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0xc781,0x1bd));var _0x1c78=function(_0x113f2b,_0x42336e){_0x113f2b=_0x113f2b-0x0;var _0x42402a=_0xc781[_0x113f2b];return _0x42402a;};'use strict';var _=require(_0x1c78('0x0'));var util=require(_0x1c78('0x1'));var moment=require(_0x1c78('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c78('0x3'));var fs=require('fs');var Redis=require(_0x1c78('0x4'));var db=require(_0x1c78('0x5'))['db'];var utils=require(_0x1c78('0x6'));var logger=require(_0x1c78('0x7'))(_0x1c78('0x8'));var config=require('../../config/environment');var jayson=require(_0x1c78('0x9'));var client=jayson[_0x1c78('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e6563,_0x2bfb4c,_0xf86f46){return new BPromise(function(_0x2e7461,_0x2b9980){return client[_0x1c78('0xb')](_0x3e6563,_0xf86f46)[_0x1c78('0xc')](function(_0x46ef78){logger[_0x1c78('0xd')](_0x1c78('0xe'),_0x2bfb4c,_0x1c78('0xf'));logger[_0x1c78('0x10')](_0x1c78('0x11'),_0x2bfb4c,_0x1c78('0xf'),JSON[_0x1c78('0x12')](_0x46ef78));if(_0x46ef78[_0x1c78('0x13')]){if(_0x46ef78[_0x1c78('0x13')][_0x1c78('0x14')]===0x1f4){logger[_0x1c78('0x13')](_0x1c78('0xe'),_0x2bfb4c,_0x46ef78[_0x1c78('0x13')][_0x1c78('0x15')]);return _0x2b9980(_0x46ef78[_0x1c78('0x13')][_0x1c78('0x15')]);}logger['error'](_0x1c78('0xe'),_0x2bfb4c,_0x46ef78[_0x1c78('0x13')][_0x1c78('0x15')]);return _0x2e7461(_0x46ef78[_0x1c78('0x13')]['message']);}else{logger['info'](_0x1c78('0xe'),_0x2bfb4c,_0x1c78('0xf'));_0x2e7461(_0x46ef78[_0x1c78('0x16')][_0x1c78('0x15')]);}})[_0x1c78('0x17')](function(_0x556281){logger[_0x1c78('0x13')](_0x1c78('0xe'),_0x2bfb4c,_0x556281);_0x2b9980(_0x556281);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5160f14..8c3ce99 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc59f=['post','create','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xc59f,0x6f));var _0xfc59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc59f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfc59('0x0'));var util=require('util');var path=require(_0xfc59('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfc59('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfc59('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfc59('0x4'));router[_0xfc59('0x5')]('/',auth[_0xfc59('0x6')](),controller[_0xfc59('0x7')]);router[_0xfc59('0x5')](_0xfc59('0x8'),auth[_0xfc59('0x6')](),controller['show']);router[_0xfc59('0x9')]('/',auth['isAuthenticated'](),controller[_0xfc59('0xa')]);router['put'](_0xfc59('0x8'),auth[_0xfc59('0x6')](),controller[_0xfc59('0xb')]);router[_0xfc59('0xc')](_0xfc59('0x8'),auth[_0xfc59('0x6')](),controller[_0xfc59('0xd')]);module[_0xfc59('0xe')]=router; \ No newline at end of file +var _0x2eb6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','create','update','delete','multer','util','express'];(function(_0x435dee,_0x130b9c){var _0x98fa3a=function(_0x2e0b91){while(--_0x2e0b91){_0x435dee['push'](_0x435dee['shift']());}};_0x98fa3a(++_0x130b9c);}(_0x2eb6,0x1ce));var _0x62eb=function(_0x570809,_0x5ed325){_0x570809=_0x570809-0x0;var _0x374c05=_0x2eb6[_0x570809];return _0x374c05;};'use strict';var multer=require(_0x62eb('0x0'));var util=require(_0x62eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x62eb('0x2'));var router=express[_0x62eb('0x3')]();var fs_extra=require(_0x62eb('0x4'));var auth=require(_0x62eb('0x5'));var interaction=require(_0x62eb('0x6'));var config=require('../../config/environment');var controller=require(_0x62eb('0x7'));router[_0x62eb('0x8')]('/',auth[_0x62eb('0x9')](),controller['index']);router[_0x62eb('0x8')](_0x62eb('0xa'),auth[_0x62eb('0x9')](),controller[_0x62eb('0xb')]);router['post']('/',auth[_0x62eb('0x9')](),controller[_0x62eb('0xc')]);router['put'](_0x62eb('0xa'),auth[_0x62eb('0x9')](),controller[_0x62eb('0xd')]);router[_0x62eb('0xe')]('/:id',auth[_0x62eb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 59c47d6..20a43aa 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 _0x6056=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','long','type','values','setDataValue','stringify','BOOLEAN','ENUM','voice'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x6056,0x70));var _0x6605=function(_0x1f02db,_0xe21622){_0x1f02db=_0x1f02db-0x0;var _0x42fb35=_0x6056[_0x1f02db];return _0x42fb35;};'use strict';var Sequelize=require(_0x6605('0x0'));var _=require(_0x6605('0x1'));module[_0x6605('0x2')]={'name':{'type':Sequelize[_0x6605('0x3')],'get':function(_0x244874){return this[_0x6605('0x4')](_0x6605('0x5'));}},'alias':{'type':Sequelize[_0x6605('0x6')],'allowNull':![],'set':function(_0xfd7250){this['setDataValue'](_0x6605('0x5'),_0xfd7250?_0xfd7250:this[_0x6605('0x4')]('name'));}},'type':{'type':Sequelize[_0x6605('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x6605('0x7')](_0x6605('0x8')),'get':function(){if(this['getDataValue'](_0x6605('0x9'))==='select'){return JSON['parse'](this['getDataValue'](_0x6605('0xa')));}else{return this[_0x6605('0x4')]('values');}},'set':function(_0x34c228){if(Array['isArray'](_0x34c228)){this[_0x6605('0xb')](_0x6605('0xa'),JSON[_0x6605('0xc')](_0x34c228));}else{this[_0x6605('0xb')](_0x6605('0xa'),_0x34c228);}}},'required':{'type':Sequelize[_0x6605('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6605('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6605('0xe')](_0x6605('0xf'))}}; \ No newline at end of file +var _0x9353=['isArray','stringify','BOOLEAN','voice','sequelize','lodash','getDataValue','alias','setDataValue','name','STRING','TEXT','select','parse','values'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x9353,0x103));var _0x3935=function(_0x1c4582,_0x447920){_0x1c4582=_0x1c4582-0x0;var _0x29ccf7=_0x9353[_0x1c4582];return _0x29ccf7;};'use strict';var Sequelize=require(_0x3935('0x0'));var _=require(_0x3935('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc8f0ea){return this[_0x3935('0x2')](_0x3935('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5ca320){this[_0x3935('0x4')](_0x3935('0x3'),_0x5ca320?_0x5ca320:this['getDataValue'](_0x3935('0x5')));}},'type':{'type':Sequelize[_0x3935('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3935('0x7')]('long'),'get':function(){if(this[_0x3935('0x2')]('type')===_0x3935('0x8')){return JSON[_0x3935('0x9')](this[_0x3935('0x2')](_0x3935('0xa')));}else{return this['getDataValue']('values');}},'set':function(_0x4a712d){if(Array[_0x3935('0xb')](_0x4a712d)){this[_0x3935('0x4')](_0x3935('0xa'),JSON[_0x3935('0xc')](_0x4a712d));}else{this[_0x3935('0x4')](_0x3935('0xa'),_0x4a712d);}}},'required':{'type':Sequelize[_0x3935('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3935('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x3935('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0010918..19a304a 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 _0x6b35=['sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','length','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','CmCustomField','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','fields','attributes','nolimit'];(function(_0x2d0476,_0x20c1fb){var _0xbd4713=function(_0x2df502){while(--_0x2df502){_0x2d0476['push'](_0x2d0476['shift']());}};_0xbd4713(++_0x20c1fb);}(_0x6b35,0x6e));var _0x56b3=function(_0xb45235,_0x545781){_0xb45235=_0xb45235-0x0;var _0x487728=_0x6b35[_0xb45235];return _0x487728;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56b3('0x0'));var zipdir=require(_0x56b3('0x1'));var jsonpatch=require(_0x56b3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x56b3('0x3'));var Mustache=require(_0x56b3('0x4'));var util=require(_0x56b3('0x5'));var path=require(_0x56b3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56b3('0x7'));var squel=require(_0x56b3('0x8'));var crypto=require(_0x56b3('0x9'));var jsforce=require(_0x56b3('0xa'));var deskjs=require(_0x56b3('0xb'));var toCsv=require(_0x56b3('0xc'));var querystring=require(_0x56b3('0xd'));var Papa=require(_0x56b3('0xe'));var Redis=require(_0x56b3('0xf'));var authService=require(_0x56b3('0x10'));var qs=require(_0x56b3('0x11'));var as=require(_0x56b3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x56b3('0x13'));var db=require(_0x56b3('0x14'))['db'];function respondWithStatusCode(_0x176b96,_0xb86d99){_0xb86d99=_0xb86d99||0xcc;return function(_0x193415){if(_0x193415){return _0x176b96[_0x56b3('0x15')](_0xb86d99);}return _0x176b96[_0x56b3('0x16')](_0xb86d99)[_0x56b3('0x17')]();};}function respondWithResult(_0x49f48c,_0x2fb8d9){_0x2fb8d9=_0x2fb8d9||0xc8;return function(_0x2d5461){if(_0x2d5461){return _0x49f48c[_0x56b3('0x16')](_0x2fb8d9)[_0x56b3('0x18')](_0x2d5461);}};}function respondWithFilteredResult(_0x446a58,_0x5bb4a2){return function(_0x24090f){if(_0x24090f){var _0x308eed=typeof _0x5bb4a2[_0x56b3('0x19')]===_0x56b3('0x1a')&&typeof _0x5bb4a2[_0x56b3('0x1b')]===_0x56b3('0x1a');var _0x18bd06=_0x24090f[_0x56b3('0x1c')];var _0x1183c1=_0x308eed?0x0:_0x5bb4a2[_0x56b3('0x19')];var _0xefbf8b=_0x308eed?_0x24090f['count']:_0x5bb4a2['offset']+_0x5bb4a2[_0x56b3('0x1b')];var _0x2fc133;if(_0xefbf8b>=_0x18bd06){_0xefbf8b=_0x18bd06;_0x2fc133=0xc8;}else{_0x2fc133=0xce;}_0x446a58[_0x56b3('0x16')](_0x2fc133);return _0x446a58[_0x56b3('0x1d')]('Content-Range',_0x1183c1+'-'+_0xefbf8b+'/'+_0x18bd06)[_0x56b3('0x18')](_0x24090f);}return null;};}function patchUpdates(_0x1a4f5f){return function(_0x5f03ec){try{jsonpatch[_0x56b3('0x1e')](_0x5f03ec,_0x1a4f5f,!![]);}catch(_0x5a1933){return BPromise[_0x56b3('0x1f')](_0x5a1933);}return _0x5f03ec[_0x56b3('0x20')]();};}function saveUpdates(_0x46271a,_0x1775d6){return function(_0x582560){if(_0x582560){return _0x582560[_0x56b3('0x21')](_0x46271a)[_0x56b3('0x22')](function(_0x8f70db){return _0x8f70db;});}return null;};}function removeEntity(_0x1770bd,_0x587ed0){return function(_0x2c0431){if(_0x2c0431){return _0x2c0431['destroy']()[_0x56b3('0x22')](function(){_0x1770bd['status'](0xcc)[_0x56b3('0x17')]();});}};}function handleEntityNotFound(_0x2e4407,_0x5b7adb){return function(_0x1208f6){if(!_0x1208f6){_0x2e4407[_0x56b3('0x15')](0x194);}return _0x1208f6;};}function handleError(_0x45a11d,_0x2ffabc){_0x2ffabc=_0x2ffabc||0x1f4;return function(_0x313082){logger[_0x56b3('0x23')](_0x313082[_0x56b3('0x24')]);if(_0x313082[_0x56b3('0x25')]){delete _0x313082['name'];}_0x45a11d['status'](_0x2ffabc)['send'](_0x313082);};}exports['index']=function(_0x56b913,_0x57da04){var _0x426548={},_0x2b48d5={},_0x22d83c={'count':0x0,'rows':[]};var _0x3b646f=_['map'](db[_0x56b3('0x26')]['rawAttributes'],function(_0x136019){return{'name':_0x136019[_0x56b3('0x27')],'type':_0x136019[_0x56b3('0x28')][_0x56b3('0x29')]};});_0x2b48d5[_0x56b3('0x2a')]=_[_0x56b3('0x2b')](_[_0x56b3('0x2c')](_0x3b646f,_0x56b3('0x25')),[_0x56b3('0x25')]);_0x2b48d5[_0x56b3('0x2d')]=_[_0x56b3('0x2e')](_0x56b913[_0x56b3('0x2d')]);_0x2b48d5[_0x56b3('0x2f')]=_[_0x56b3('0x30')](_0x2b48d5[_0x56b3('0x2a')],_0x2b48d5[_0x56b3('0x2d')]);_0x426548['attributes']=_[_0x56b3('0x30')](_0x2b48d5['model'],qs[_0x56b3('0x31')](_0x56b913[_0x56b3('0x2d')][_0x56b3('0x31')]));_0x426548[_0x56b3('0x32')]=_0x426548[_0x56b3('0x32')]['length']?_0x426548['attributes']:_0x2b48d5[_0x56b3('0x2a')];if(!_0x56b913[_0x56b3('0x2d')]['hasOwnProperty'](_0x56b3('0x33'))){_0x426548[_0x56b3('0x1b')]=qs[_0x56b3('0x1b')](_0x56b913['query'][_0x56b3('0x1b')]);_0x426548[_0x56b3('0x19')]=qs[_0x56b3('0x19')](_0x56b913['query'][_0x56b3('0x19')]);}_0x426548['order']=qs[_0x56b3('0x34')](_0x56b913[_0x56b3('0x2d')][_0x56b3('0x34')]);_0x426548[_0x56b3('0x35')]=qs[_0x56b3('0x2f')](_[_0x56b3('0x36')](_0x56b913[_0x56b3('0x2d')],_0x2b48d5[_0x56b3('0x2f')]),_0x3b646f);if(_0x56b913[_0x56b3('0x2d')]['filter']){_0x426548[_0x56b3('0x35')]=_['merge'](_0x426548[_0x56b3('0x35')],{'$or':_[_0x56b3('0x2c')](_0x3b646f,function(_0x574afe){if(_0x574afe[_0x56b3('0x28')]!=='VIRTUAL'){var _0x1955fd={};_0x1955fd[_0x574afe[_0x56b3('0x25')]]={'$like':'%'+_0x56b913[_0x56b3('0x2d')][_0x56b3('0x37')]+'%'};return _0x1955fd;}})});}_0x426548=_[_0x56b3('0x38')]({},_0x426548,_0x56b913[_0x56b3('0x39')]);var _0x3bbead={'where':_0x426548[_0x56b3('0x35')]};return db['CmCustomField'][_0x56b3('0x1c')](_0x3bbead)[_0x56b3('0x22')](function(_0x1c06c1){_0x22d83c[_0x56b3('0x1c')]=_0x1c06c1;if(_0x56b913[_0x56b3('0x2d')][_0x56b3('0x3a')]){_0x426548['include']=[{'all':!![]}];}return db[_0x56b3('0x26')][_0x56b3('0x3b')](_0x426548);})[_0x56b3('0x22')](function(_0x1194c8){_0x22d83c[_0x56b3('0x3c')]=_0x1194c8;return _0x22d83c;})[_0x56b3('0x22')](respondWithFilteredResult(_0x57da04,_0x426548))[_0x56b3('0x3d')](handleError(_0x57da04,null));};exports['show']=function(_0x4199a8,_0x406146){var _0xb62908={'raw':!![],'where':{'id':_0x4199a8[_0x56b3('0x3e')]['id']}},_0x13611c={};_0x13611c[_0x56b3('0x2a')]=_[_0x56b3('0x2e')](db[_0x56b3('0x26')]['rawAttributes']);_0x13611c[_0x56b3('0x2d')]=_['keys'](_0x4199a8['query']);_0x13611c['filters']=_[_0x56b3('0x30')](_0x13611c[_0x56b3('0x2a')],_0x13611c[_0x56b3('0x2d')]);_0xb62908['attributes']=_[_0x56b3('0x30')](_0x13611c[_0x56b3('0x2a')],qs[_0x56b3('0x31')](_0x4199a8[_0x56b3('0x2d')][_0x56b3('0x31')]));_0xb62908[_0x56b3('0x32')]=_0xb62908['attributes'][_0x56b3('0x3f')]?_0xb62908[_0x56b3('0x32')]:_0x13611c[_0x56b3('0x2a')];if(_0x4199a8[_0x56b3('0x2d')][_0x56b3('0x3a')]){_0xb62908['include']=[{'all':!![]}];}_0xb62908=_[_0x56b3('0x38')]({},_0xb62908,_0x4199a8['options']);return db['CmCustomField'][_0x56b3('0x40')](_0xb62908)[_0x56b3('0x22')](handleEntityNotFound(_0x406146,null))[_0x56b3('0x22')](respondWithResult(_0x406146,null))[_0x56b3('0x3d')](handleError(_0x406146,null));};exports['update']=function(_0x2a2f77,_0x415569){if(_0x2a2f77[_0x56b3('0x41')]['id']){delete _0x2a2f77[_0x56b3('0x41')]['id'];}return db['CmCustomField'][_0x56b3('0x40')]({'where':{'id':_0x2a2f77[_0x56b3('0x3e')]['id']}})[_0x56b3('0x22')](handleEntityNotFound(_0x415569,null))[_0x56b3('0x22')](saveUpdates(_0x2a2f77['body'],null))['then'](respondWithResult(_0x415569,null))['catch'](handleError(_0x415569,null));};exports[_0x56b3('0x42')]=function(_0x1d7140,_0xb48ac3){return db[_0x56b3('0x26')][_0x56b3('0x40')]({'where':{'id':_0x1d7140[_0x56b3('0x3e')]['id']}})['then'](handleEntityNotFound(_0xb48ac3,null))[_0x56b3('0x22')](removeEntity(_0xb48ac3,null))['catch'](handleError(_0xb48ac3,null));};exports[_0x56b3('0x43')]=function(_0x870314,_0x47f12a){var _0x3e4d8d;return db[_0x56b3('0x44')][_0x56b3('0x45')](function(_0x1f2010){return db[_0x56b3('0x26')][_0x56b3('0x43')](_0x870314[_0x56b3('0x41')],{'transaction':_0x1f2010})[_0x56b3('0x22')](function(_0x3fe73e){_0x3e4d8d=_0x3fe73e;var _0x3f4097={'type':db[_0x56b3('0x46')][_0x56b3('0x47')],'transaction':_0x1f2010};switch(_0x870314[_0x56b3('0x41')][_0x56b3('0x28')]){case'text':_0x3f4097[_0x56b3('0x28')]=db['Sequelize']['TEXT'];break;case _0x56b3('0x48'):_0x3f4097[_0x56b3('0x28')]=db[_0x56b3('0x46')][_0x56b3('0x49')];break;case _0x56b3('0x4a'):_0x3f4097['type']=db['Sequelize'][_0x56b3('0x4b')];_0x3f4097[_0x56b3('0x4c')]=![];break;default:}return db[_0x56b3('0x44')]['queryInterface'][_0x56b3('0x4d')](_0x56b3('0x4e'),util[_0x56b3('0x4f')](_0x56b3('0x50'),_0x3e4d8d['id']),_0x3f4097);})['then'](function(){return _0x3e4d8d;});})[_0x56b3('0x22')](respondWithResult(_0x47f12a,0xc9))[_0x56b3('0x3d')](handleError(_0x47f12a,null));}; \ No newline at end of file +var _0x379e=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','body','destroy','transaction','create','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','cf_%d','eml-format','rimraf','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x379e,0x1a2));var _0xe379=function(_0x26a913,_0x36e9cc){_0x26a913=_0x26a913-0x0;var _0x2de13b=_0x379e[_0x26a913];return _0x2de13b;};'use strict';var emlformat=require(_0xe379('0x0'));var rimraf=require(_0xe379('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe379('0x2'));var rp=require(_0xe379('0x3'));var moment=require(_0xe379('0x4'));var BPromise=require(_0xe379('0x5'));var Mustache=require(_0xe379('0x6'));var util=require(_0xe379('0x7'));var path=require(_0xe379('0x8'));var sox=require(_0xe379('0x9'));var csv=require(_0xe379('0xa'));var ejs=require(_0xe379('0xb'));var fs=require('fs');var fs_extra=require(_0xe379('0xc'));var _=require(_0xe379('0xd'));var squel=require('squel');var crypto=require(_0xe379('0xe'));var jsforce=require(_0xe379('0xf'));var deskjs=require(_0xe379('0x10'));var toCsv=require(_0xe379('0xa'));var querystring=require(_0xe379('0x11'));var Papa=require(_0xe379('0x12'));var Redis=require(_0xe379('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe379('0x14'));var hardwareService=require(_0xe379('0x15'));var logger=require(_0xe379('0x16'))(_0xe379('0x17'));var utils=require(_0xe379('0x18'));var config=require(_0xe379('0x19'));var licenseUtil=require(_0xe379('0x1a'));var db=require(_0xe379('0x1b'))['db'];function respondWithStatusCode(_0x414624,_0x10d75c){_0x10d75c=_0x10d75c||0xcc;return function(_0x4d4ed6){if(_0x4d4ed6){return _0x414624[_0xe379('0x1c')](_0x10d75c);}return _0x414624[_0xe379('0x1d')](_0x10d75c)[_0xe379('0x1e')]();};}function respondWithResult(_0x1b2603,_0x5c1efd){_0x5c1efd=_0x5c1efd||0xc8;return function(_0x15c619){if(_0x15c619){return _0x1b2603[_0xe379('0x1d')](_0x5c1efd)[_0xe379('0x1f')](_0x15c619);}};}function respondWithFilteredResult(_0x54431e,_0x7093b2){return function(_0x931893){if(_0x931893){var _0x44f315=typeof _0x7093b2[_0xe379('0x20')]===_0xe379('0x21')&&typeof _0x7093b2[_0xe379('0x22')]===_0xe379('0x21');var _0x4f8c2d=_0x931893[_0xe379('0x23')];var _0x21bbc2=_0x44f315?0x0:_0x7093b2['offset'];var _0x2c2a20=_0x44f315?_0x931893[_0xe379('0x23')]:_0x7093b2[_0xe379('0x20')]+_0x7093b2[_0xe379('0x22')];var _0x559380;if(_0x2c2a20>=_0x4f8c2d){_0x2c2a20=_0x4f8c2d;_0x559380=0xc8;}else{_0x559380=0xce;}_0x54431e[_0xe379('0x1d')](_0x559380);return _0x54431e[_0xe379('0x24')](_0xe379('0x25'),_0x21bbc2+'-'+_0x2c2a20+'/'+_0x4f8c2d)[_0xe379('0x1f')](_0x931893);}return null;};}function patchUpdates(_0x337f4e){return function(_0x1aac42){try{jsonpatch['apply'](_0x1aac42,_0x337f4e,!![]);}catch(_0x100cf2){return BPromise[_0xe379('0x26')](_0x100cf2);}return _0x1aac42[_0xe379('0x27')]();};}function saveUpdates(_0x2fa8eb,_0x5ab12e){return function(_0xf01548){if(_0xf01548){return _0xf01548['update'](_0x2fa8eb)[_0xe379('0x28')](function(_0x1016bf){return _0x1016bf;});}return null;};}function removeEntity(_0x4415d0,_0x4d0c65){return function(_0x257718){if(_0x257718){return _0x257718['destroy']()[_0xe379('0x28')](function(){_0x4415d0[_0xe379('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3801a2,_0x44b065){return function(_0x5cdd51){if(!_0x5cdd51){_0x3801a2['sendStatus'](0x194);}return _0x5cdd51;};}function handleError(_0x40b911,_0x15a763){_0x15a763=_0x15a763||0x1f4;return function(_0x32abac){logger[_0xe379('0x29')](_0x32abac[_0xe379('0x2a')]);if(_0x32abac[_0xe379('0x2b')]){delete _0x32abac['name'];}_0x40b911[_0xe379('0x1d')](_0x15a763)[_0xe379('0x2c')](_0x32abac);};}exports[_0xe379('0x2d')]=function(_0x538c4f,_0x65de50){var _0x38a04b={},_0x3b8d68={},_0x2258e0={'count':0x0,'rows':[]};var _0x5a6b29=_[_0xe379('0x2e')](db[_0xe379('0x2f')][_0xe379('0x30')],function(_0x379290){return{'name':_0x379290[_0xe379('0x31')],'type':_0x379290[_0xe379('0x32')][_0xe379('0x33')]};});_0x3b8d68[_0xe379('0x34')]=_[_0xe379('0x35')](_['map'](_0x5a6b29,_0xe379('0x2b')),[_0xe379('0x2b')]);_0x3b8d68[_0xe379('0x36')]=_[_0xe379('0x37')](_0x538c4f[_0xe379('0x36')]);_0x3b8d68[_0xe379('0x38')]=_['intersection'](_0x3b8d68[_0xe379('0x34')],_0x3b8d68[_0xe379('0x36')]);_0x38a04b[_0xe379('0x39')]=_[_0xe379('0x3a')](_0x3b8d68[_0xe379('0x34')],qs['fields'](_0x538c4f[_0xe379('0x36')][_0xe379('0x3b')]));_0x38a04b[_0xe379('0x39')]=_0x38a04b[_0xe379('0x39')]['length']?_0x38a04b['attributes']:_0x3b8d68[_0xe379('0x34')];if(!_0x538c4f['query']['hasOwnProperty'](_0xe379('0x3c'))){_0x38a04b[_0xe379('0x22')]=qs[_0xe379('0x22')](_0x538c4f[_0xe379('0x36')][_0xe379('0x22')]);_0x38a04b[_0xe379('0x20')]=qs[_0xe379('0x20')](_0x538c4f[_0xe379('0x36')][_0xe379('0x20')]);}_0x38a04b['order']=qs[_0xe379('0x3d')](_0x538c4f[_0xe379('0x36')][_0xe379('0x3d')]);_0x38a04b[_0xe379('0x3e')]=qs['filters'](_['pick'](_0x538c4f[_0xe379('0x36')],_0x3b8d68['filters']),_0x5a6b29);if(_0x538c4f['query'][_0xe379('0x3f')]){_0x38a04b[_0xe379('0x3e')]=_['merge'](_0x38a04b['where'],{'$or':_[_0xe379('0x2e')](_0x5a6b29,function(_0x240771){if(_0x240771['type']!=='VIRTUAL'){var _0x4241f0={};_0x4241f0[_0x240771[_0xe379('0x2b')]]={'$like':'%'+_0x538c4f[_0xe379('0x36')][_0xe379('0x3f')]+'%'};return _0x4241f0;}})});}_0x38a04b=_[_0xe379('0x40')]({},_0x38a04b,_0x538c4f['options']);var _0x36425d={'where':_0x38a04b['where']};return db[_0xe379('0x2f')][_0xe379('0x23')](_0x36425d)[_0xe379('0x28')](function(_0x4ae832){_0x2258e0[_0xe379('0x23')]=_0x4ae832;if(_0x538c4f['query'][_0xe379('0x41')]){_0x38a04b[_0xe379('0x42')]=[{'all':!![]}];}return db[_0xe379('0x2f')][_0xe379('0x43')](_0x38a04b);})[_0xe379('0x28')](function(_0x10b0c4){_0x2258e0[_0xe379('0x44')]=_0x10b0c4;return _0x2258e0;})[_0xe379('0x28')](respondWithFilteredResult(_0x65de50,_0x38a04b))[_0xe379('0x45')](handleError(_0x65de50,null));};exports['show']=function(_0xa762b4,_0xb8d852){var _0x2f8fc6={'raw':!![],'where':{'id':_0xa762b4[_0xe379('0x46')]['id']}},_0x3ee230={};_0x3ee230['model']=_[_0xe379('0x37')](db[_0xe379('0x2f')][_0xe379('0x30')]);_0x3ee230[_0xe379('0x36')]=_[_0xe379('0x37')](_0xa762b4['query']);_0x3ee230[_0xe379('0x38')]=_[_0xe379('0x3a')](_0x3ee230[_0xe379('0x34')],_0x3ee230[_0xe379('0x36')]);_0x2f8fc6[_0xe379('0x39')]=_[_0xe379('0x3a')](_0x3ee230[_0xe379('0x34')],qs[_0xe379('0x3b')](_0xa762b4[_0xe379('0x36')]['fields']));_0x2f8fc6[_0xe379('0x39')]=_0x2f8fc6[_0xe379('0x39')][_0xe379('0x47')]?_0x2f8fc6['attributes']:_0x3ee230[_0xe379('0x34')];if(_0xa762b4[_0xe379('0x36')][_0xe379('0x41')]){_0x2f8fc6[_0xe379('0x42')]=[{'all':!![]}];}_0x2f8fc6=_[_0xe379('0x40')]({},_0x2f8fc6,_0xa762b4['options']);return db['CmCustomField'][_0xe379('0x48')](_0x2f8fc6)[_0xe379('0x28')](handleEntityNotFound(_0xb8d852,null))['then'](respondWithResult(_0xb8d852,null))[_0xe379('0x45')](handleError(_0xb8d852,null));};exports['update']=function(_0x12e429,_0x3d369c){if(_0x12e429[_0xe379('0x49')]['id']){delete _0x12e429[_0xe379('0x49')]['id'];}return db[_0xe379('0x2f')][_0xe379('0x48')]({'where':{'id':_0x12e429[_0xe379('0x46')]['id']}})[_0xe379('0x28')](handleEntityNotFound(_0x3d369c,null))[_0xe379('0x28')](saveUpdates(_0x12e429[_0xe379('0x49')],null))['then'](respondWithResult(_0x3d369c,null))[_0xe379('0x45')](handleError(_0x3d369c,null));};exports[_0xe379('0x4a')]=function(_0x271785,_0x3732b3){return db['CmCustomField'][_0xe379('0x48')]({'where':{'id':_0x271785[_0xe379('0x46')]['id']}})[_0xe379('0x28')](handleEntityNotFound(_0x3732b3,null))['then'](removeEntity(_0x3732b3,null))['catch'](handleError(_0x3732b3,null));};exports['create']=function(_0x14e80d,_0x5a70ab){var _0x22d9f3;return db['sequelize'][_0xe379('0x4b')](function(_0x3f8ff6){return db['CmCustomField'][_0xe379('0x4c')](_0x14e80d[_0xe379('0x49')],{'transaction':_0x3f8ff6})[_0xe379('0x28')](function(_0x3a34cd){_0x22d9f3=_0x3a34cd;var _0x544b13={'type':db['Sequelize'][_0xe379('0x4d')],'transaction':_0x3f8ff6};switch(_0x14e80d[_0xe379('0x49')]['type']){case _0xe379('0x4e'):_0x544b13[_0xe379('0x32')]=db[_0xe379('0x4f')][_0xe379('0x4d')];break;case _0xe379('0x50'):_0x544b13[_0xe379('0x32')]=db[_0xe379('0x4f')][_0xe379('0x51')];break;case _0xe379('0x52'):_0x544b13[_0xe379('0x32')]=db[_0xe379('0x4f')][_0xe379('0x53')];_0x544b13[_0xe379('0x54')]=![];break;default:}return db[_0xe379('0x55')][_0xe379('0x56')]['addColumn'](_0xe379('0x57'),util['format'](_0xe379('0x58'),_0x22d9f3['id']),_0x544b13);})[_0xe379('0x28')](function(){return _0x22d9f3;});})[_0xe379('0x28')](respondWithResult(_0x5a70ab,0xc9))[_0xe379('0x45')](handleError(_0x5a70ab,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 69502f8..abc2671 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 _0xee58=['cm_custom_fields','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField'];(function(_0x2bf24c,_0x56de40){var _0x4de5a3=function(_0x3de725){while(--_0x3de725){_0x2bf24c['push'](_0x2bf24c['shift']());}};_0x4de5a3(++_0x56de40);}(_0xee58,0xd3));var _0x8ee5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xee58[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x8ee5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8ee5('0x1'));var rp=require(_0x8ee5('0x2'));var fs=require('fs');var path=require(_0x8ee5('0x3'));var rimraf=require(_0x8ee5('0x4'));var config=require(_0x8ee5('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x8ee5('0x6')]=function(_0x295cfb,_0x8c421e){return _0x295cfb[_0x8ee5('0x7')](_0x8ee5('0x8'),attributes,{'tableName':_0x8ee5('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c22=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0xf4add4,_0x5b9cc1){var _0x1c42fb=function(_0x2674c1){while(--_0x2674c1){_0xf4add4['push'](_0xf4add4['shift']());}};_0x1c42fb(++_0x5b9cc1);}(_0x2c22,0xa7));var _0x22c2=function(_0x4ac067,_0x46ac4e){_0x4ac067=_0x4ac067-0x0;var _0x34c2f9=_0x2c22[_0x4ac067];return _0x34c2f9;};'use strict';var _=require(_0x22c2('0x0'));var util=require('util');var logger=require(_0x22c2('0x1'))('api');var moment=require(_0x22c2('0x2'));var BPromise=require(_0x22c2('0x3'));var rp=require(_0x22c2('0x4'));var fs=require('fs');var path=require(_0x22c2('0x5'));var rimraf=require('rimraf');var config=require(_0x22c2('0x6'));var attributes=require(_0x22c2('0x7'));module[_0x22c2('0x8')]=function(_0x2e608e,_0x1d84a9){return _0x2e608e[_0x22c2('0x9')](_0x22c2('0xa'),attributes,{'tableName':_0x22c2('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 373a606..3bc409d 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 _0x064c=['request','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4c5f97,_0x24c4a9){var _0x5ab651=function(_0x54fa80){while(--_0x54fa80){_0x4c5f97['push'](_0x4c5f97['shift']());}};_0x5ab651(++_0x24c4a9);}(_0x064c,0xde));var _0xc064=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x064c[_0x5311a1];return _0x2acb9f;};'use strict';var _=require('lodash');var util=require(_0xc064('0x0'));var moment=require(_0xc064('0x1'));var BPromise=require('bluebird');var rs=require(_0xc064('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc064('0x3'))['db'];var utils=require(_0xc064('0x4'));var logger=require(_0xc064('0x5'))(_0xc064('0x6'));var config=require('../../config/environment');var jayson=require(_0xc064('0x7'));var client=jayson[_0xc064('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10966c,_0x45736a,_0x2dd86f){return new BPromise(function(_0xfb91cb,_0x37bd1b){return client[_0xc064('0x9')](_0x10966c,_0x2dd86f)[_0xc064('0xa')](function(_0x561b3a){logger['info']('CmCustomField,\x20%s,\x20%s',_0x45736a,_0xc064('0xb'));logger[_0xc064('0xc')](_0xc064('0xd'),_0x45736a,'request\x20sent',JSON[_0xc064('0xe')](_0x561b3a));if(_0x561b3a[_0xc064('0xf')]){if(_0x561b3a[_0xc064('0xf')][_0xc064('0x10')]===0x1f4){logger[_0xc064('0xf')](_0xc064('0x11'),_0x45736a,_0x561b3a[_0xc064('0xf')][_0xc064('0x12')]);return _0x37bd1b(_0x561b3a[_0xc064('0xf')][_0xc064('0x12')]);}logger[_0xc064('0xf')]('CmCustomField,\x20%s,\x20%s',_0x45736a,_0x561b3a['error'][_0xc064('0x12')]);return _0xfb91cb(_0x561b3a[_0xc064('0xf')][_0xc064('0x12')]);}else{logger['info'](_0xc064('0x11'),_0x45736a,_0xc064('0xb'));_0xfb91cb(_0x561b3a[_0xc064('0x13')][_0xc064('0x12')]);}})[_0xc064('0x14')](function(_0x466bff){logger[_0xc064('0xf')]('CmCustomField,\x20%s,\x20%s',_0x45736a,_0x466bff);_0x37bd1b(_0x466bff);});});} \ No newline at end of file +var _0x17b9=['info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x44410f,_0x8373c1){var _0x47f91f=function(_0x352a70){while(--_0x352a70){_0x44410f['push'](_0x44410f['shift']());}};_0x47f91f(++_0x8373c1);}(_0x17b9,0xb0));var _0x917b=function(_0x4973af,_0x3003b7){_0x4973af=_0x4973af-0x0;var _0x16748a=_0x17b9[_0x4973af];return _0x16748a;};'use strict';var _=require(_0x917b('0x0'));var util=require(_0x917b('0x1'));var moment=require(_0x917b('0x2'));var BPromise=require(_0x917b('0x3'));var rs=require(_0x917b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x917b('0x5'))['db'];var utils=require(_0x917b('0x6'));var logger=require(_0x917b('0x7'))(_0x917b('0x8'));var config=require(_0x917b('0x9'));var jayson=require(_0x917b('0xa'));var client=jayson[_0x917b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fb180,_0x43f59a,_0xc13fe9){return new BPromise(function(_0x2ae10c,_0x5eb72c){return client[_0x917b('0xc')](_0x3fb180,_0xc13fe9)['then'](function(_0x105152){logger[_0x917b('0xd')](_0x917b('0xe'),_0x43f59a,'request\x20sent');logger[_0x917b('0xf')](_0x917b('0x10'),_0x43f59a,_0x917b('0x11'),JSON['stringify'](_0x105152));if(_0x105152[_0x917b('0x12')]){if(_0x105152[_0x917b('0x12')][_0x917b('0x13')]===0x1f4){logger[_0x917b('0x12')](_0x917b('0xe'),_0x43f59a,_0x105152['error'][_0x917b('0x14')]);return _0x5eb72c(_0x105152[_0x917b('0x12')]['message']);}logger['error'](_0x917b('0xe'),_0x43f59a,_0x105152[_0x917b('0x12')]['message']);return _0x2ae10c(_0x105152[_0x917b('0x12')][_0x917b('0x14')]);}else{logger['info'](_0x917b('0xe'),_0x43f59a,_0x917b('0x11'));_0x2ae10c(_0x105152['result'][_0x917b('0x14')]);}})['catch'](function(_0x462206){logger[_0x917b('0x12')](_0x917b('0xe'),_0x43f59a,_0x462206);_0x5eb72c(_0x462206);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 04e8fb9..9d7a586 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 _0x09b1=['isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x09b1,0xa7));var _0x109b=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x09b1[_0x4c445a];return _0x2f611c;};'use strict';var multer=require(_0x109b('0x0'));var util=require(_0x109b('0x1'));var path=require(_0x109b('0x2'));var timeout=require(_0x109b('0x3'));var express=require(_0x109b('0x4'));var router=express['Router']();var fs_extra=require(_0x109b('0x5'));var auth=require(_0x109b('0x6'));var interaction=require(_0x109b('0x7'));var config=require(_0x109b('0x8'));var controller=require(_0x109b('0x9'));router[_0x109b('0xa')]('/',auth['isAuthenticated'](),controller[_0x109b('0xb')]);router[_0x109b('0xa')](_0x109b('0xc'),auth[_0x109b('0xd')](),controller[_0x109b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x109b('0xf')]);router[_0x109b('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x109b('0x11')](_0x109b('0xc'),auth['isAuthenticated'](),controller[_0x109b('0x12')]);module[_0x109b('0x13')]=router; \ No newline at end of file +var _0x28ff=['put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','index','get','/:id','show','isAuthenticated','create'];(function(_0x139b85,_0x5e0691){var _0x1e833f=function(_0xc97932){while(--_0xc97932){_0x139b85['push'](_0x139b85['shift']());}};_0x1e833f(++_0x5e0691);}(_0x28ff,0x7a));var _0xf28f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x28ff[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xf28f('0x0'));var path=require(_0xf28f('0x1'));var timeout=require(_0xf28f('0x2'));var express=require('express');var router=express[_0xf28f('0x3')]();var fs_extra=require(_0xf28f('0x4'));var auth=require(_0xf28f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf28f('0x6'));var controller=require(_0xf28f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf28f('0x8')]);router[_0xf28f('0x9')](_0xf28f('0xa'),auth['isAuthenticated'](),controller[_0xf28f('0xb')]);router['post']('/',auth[_0xf28f('0xc')](),controller[_0xf28f('0xd')]);router[_0xf28f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf28f('0xf')]);router['delete'](_0xf28f('0xa'),auth[_0xf28f('0xc')](),controller['destroy']);module[_0xf28f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7eb478f..55e6e53 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 _0x9d35=['BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING'];(function(_0xf93a9d,_0x49e1cc){var _0x281a20=function(_0x3afdf5){while(--_0x3afdf5){_0xf93a9d['push'](_0xf93a9d['shift']());}};_0x281a20(++_0x49e1cc);}(_0x9d35,0xfd));var _0x59d3=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0x9d35[_0x4df1f5];return _0x56585b;};'use strict';var moment=require(_0x59d3('0x0'));var Sequelize=require(_0x59d3('0x1'));module['exports']={'phone':{'type':Sequelize[_0x59d3('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x59d3('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x59d3('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59d3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59d3('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x59d3('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59d3('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x59d3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x59d3('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x59d3('0x5')],'unique':_0x59d3('0x7')},'ListId':{'type':Sequelize[_0x59d3('0x5')],'unique':_0x59d3('0x7')},'UserId':{'type':Sequelize[_0x59d3('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x59d3('0x5')],'unique':_0x59d3('0x7')},'CampaignId':{'type':Sequelize[_0x59d3('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x59d3('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59d3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59d3('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59d3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59d3('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x59d3('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x59d3('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x59d3('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xef35=['exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x175ce2,_0x347112){var _0x171021=function(_0x233c82){while(--_0x233c82){_0x175ce2['push'](_0x175ce2['shift']());}};_0x171021(++_0x347112);}(_0xef35,0x142));var _0x5ef3=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xef35[_0x2405bc];return _0x5272d4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5ef3('0x0')]={'phone':{'type':Sequelize[_0x5ef3('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5ef3('0x2')],'defaultValue':moment()['format'](_0x5ef3('0x3'))},'countbusyretry':{'type':Sequelize[_0x5ef3('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5ef3('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5ef3('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5ef3('0x2')]},'priority':{'type':Sequelize[_0x5ef3('0x4')](0x2)[_0x5ef3('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x5ef3('0x6')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5ef3('0x6')},'UserId':{'type':Sequelize[_0x5ef3('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x5ef3('0x4')],'unique':_0x5ef3('0x6')},'CampaignId':{'type':Sequelize[_0x5ef3('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x5ef3('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5ef3('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5ef3('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5ef3('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x5ef3('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5ef3('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 80d69d9..a122939 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 _0x6aa7=['merge','where','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','Campaign','CampaignId','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','prev','hopperIds','scheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','LOCK','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','push','utcOffset','json','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','offset','limit','undefined','count','status','set','Content-Range','update','then','sendStatus','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x5650b9,_0x4d24c7){var _0x7262cd=function(_0x3d89e6){while(--_0x3d89e6){_0x5650b9['push'](_0x5650b9['shift']());}};_0x7262cd(++_0x4d24c7);}(_0x6aa7,0x178));var _0x76aa=function(_0xe078d1,_0x5ba328){_0xe078d1=_0xe078d1-0x0;var _0x4ac779=_0x6aa7[_0xe078d1];return _0x4ac779;};'use strict';var moment=require(_0x76aa('0x0'));var _=require('lodash');var qs=require(_0x76aa('0x1'));var logger=require(_0x76aa('0x2'))(_0x76aa('0x3'));var shared=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x13f62b,_0xef15ef){_0xef15ef=_0xef15ef||0xc8;return function(_0x1d6e04){if(_0x1d6e04){return _0x13f62b['status'](_0xef15ef)['json'](_0x1d6e04);}};}function respondWithFilteredResult(_0x1aceaa,_0x4d53f6){return function(_0x32dee5){if(_0x32dee5){var _0x36d12b=typeof _0x4d53f6[_0x76aa('0x5')]==='undefined'&&typeof _0x4d53f6[_0x76aa('0x6')]===_0x76aa('0x7');var _0x3a3f36=_0x32dee5['count'];var _0xcd99aa=_0x36d12b?0x0:_0x4d53f6[_0x76aa('0x5')];var _0x41643a=_0x36d12b?_0x32dee5[_0x76aa('0x8')]:_0x4d53f6[_0x76aa('0x5')]+_0x4d53f6[_0x76aa('0x6')];var _0x2c5075;if(_0x41643a>=_0x3a3f36){_0x41643a=_0x3a3f36;_0x2c5075=0xc8;}else{_0x2c5075=0xce;}_0x1aceaa[_0x76aa('0x9')](_0x2c5075);return _0x1aceaa[_0x76aa('0xa')](_0x76aa('0xb'),_0xcd99aa+'-'+_0x41643a+'/'+_0x3a3f36)['json'](_0x32dee5);}return null;};}function saveUpdates(_0x112c39,_0x5df49c){return function(_0x226536){if(_0x226536){return _0x226536[_0x76aa('0xc')](_0x112c39)[_0x76aa('0xd')](function(_0x8e44ed){return _0x8e44ed;});}return null;};}function handleEntityNotFound(_0x10432c,_0x4e309f){return function(_0x5f5b59){if(!_0x5f5b59){_0x10432c[_0x76aa('0xe')](0x194);}return _0x5f5b59;};}function handleError(_0x4cfc34,_0x180d92){_0x180d92=_0x180d92||0x1f4;return function(_0x319bf1){logger['error'](_0x319bf1[_0x76aa('0xf')]);if(_0x319bf1['name']){delete _0x319bf1[_0x76aa('0x10')];}_0x4cfc34['status'](_0x180d92)[_0x76aa('0x11')](_0x319bf1);};}exports[_0x76aa('0x12')]=function(_0x2ab30b,_0x21c16d){var _0xa1bc7={},_0x3ead3f={},_0x496902={'count':0x0,'rows':[]};var _0x5d6202=_[_0x76aa('0x13')](db[_0x76aa('0x14')][_0x76aa('0x15')],function(_0x15b931){return{'name':_0x15b931[_0x76aa('0x16')],'type':_0x15b931[_0x76aa('0x17')][_0x76aa('0x18')]};});_0x3ead3f[_0x76aa('0x19')]=_[_0x76aa('0x13')](_0x5d6202,'name');_0x3ead3f[_0x76aa('0x1a')]=_[_0x76aa('0x1b')](_0x2ab30b[_0x76aa('0x1a')]);_0x3ead3f['filters']=_[_0x76aa('0x1c')](_0x3ead3f[_0x76aa('0x19')],_0x3ead3f[_0x76aa('0x1a')]);_0x3ead3f[_0x76aa('0x1d')]=_[_0x76aa('0x1e')](_0x3ead3f[_0x76aa('0x1d')],[_0x76aa('0x1f'),_0x76aa('0x20'),_0x76aa('0x21'),_0x76aa('0x22'),_0x76aa('0x23'),_0x76aa('0x24'),_0x76aa('0x25'),'$eq',_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2b'),'$overlap',_0x76aa('0x2f'),'$contained',_0x76aa('0x30')]);_0xa1bc7[_0x76aa('0x31')]=_[_0x76aa('0x1c')](_0x3ead3f[_0x76aa('0x19')],qs[_0x76aa('0x32')](_0x2ab30b[_0x76aa('0x1a')][_0x76aa('0x32')]));_0xa1bc7[_0x76aa('0x31')]=_0xa1bc7[_0x76aa('0x31')][_0x76aa('0x33')]?_0xa1bc7['attributes']:_0x3ead3f[_0x76aa('0x19')];if(!_0x2ab30b[_0x76aa('0x1a')][_0x76aa('0x34')](_0x76aa('0x35'))){_0xa1bc7[_0x76aa('0x6')]=qs[_0x76aa('0x6')](_0x2ab30b[_0x76aa('0x1a')]['limit']);_0xa1bc7[_0x76aa('0x5')]=qs[_0x76aa('0x5')](_0x2ab30b['query'][_0x76aa('0x5')]);}_0xa1bc7['order']=qs[_0x76aa('0x36')](_0x2ab30b['query'][_0x76aa('0x36')]);_0xa1bc7['where']=qs['filters'](_[_0x76aa('0x37')](_0x2ab30b[_0x76aa('0x1a')],_0x3ead3f[_0x76aa('0x1d')]),_0x5d6202);if(_0x2ab30b[_0x76aa('0x1a')]['filter']){_0xa1bc7['where']=_[_0x76aa('0x38')](_0xa1bc7[_0x76aa('0x39')],{'$or':_[_0x76aa('0x13')](_0x5d6202,function(_0x23e2fd){if(_0x23e2fd[_0x76aa('0x17')]!=='VIRTUAL'){var _0x9ce5f4={};_0x9ce5f4[_0x23e2fd['name']]={'$like':'%'+_0x2ab30b['query'][_0x76aa('0x3a')]+'%'};return _0x9ce5f4;}})});}_0xa1bc7=_[_0x76aa('0x38')]({},_0xa1bc7,_0x2ab30b[_0x76aa('0x3b')]);var _0x127bc4={'where':_0xa1bc7['where']};return db[_0x76aa('0x14')][_0x76aa('0x8')](_0x127bc4)[_0x76aa('0xd')](function(_0x4e131a){_0x496902[_0x76aa('0x8')]=_0x4e131a;if(_0x2ab30b[_0x76aa('0x1a')][_0x76aa('0x3c')]){_0xa1bc7[_0x76aa('0x3d')]=[{'all':!![]}];}return db[_0x76aa('0x14')][_0x76aa('0x3e')](_0xa1bc7);})[_0x76aa('0xd')](function(_0x307d67){_0x496902[_0x76aa('0x3f')]=_0x307d67;return _0x496902;})['then'](respondWithFilteredResult(_0x21c16d,_0xa1bc7))[_0x76aa('0x40')](handleError(_0x21c16d,null));};exports[_0x76aa('0x41')]=function(_0x4a5a96,_0xa824e8){var _0x64612e={'raw':!![],'where':{'id':_0x4a5a96['params']['id']}},_0x2957aa={};_0x2957aa['model']=_[_0x76aa('0x1b')](db[_0x76aa('0x14')][_0x76aa('0x15')]);_0x2957aa[_0x76aa('0x1a')]=_['keys'](_0x4a5a96[_0x76aa('0x1a')]);_0x2957aa[_0x76aa('0x1d')]=_[_0x76aa('0x1c')](_0x2957aa[_0x76aa('0x19')],_0x2957aa[_0x76aa('0x1a')]);_0x64612e['attributes']=_[_0x76aa('0x1c')](_0x2957aa['model'],qs[_0x76aa('0x32')](_0x4a5a96['query']['fields']));_0x64612e['attributes']=_0x64612e[_0x76aa('0x31')]['length']?_0x64612e['attributes']:_0x2957aa['model'];if(_0x4a5a96[_0x76aa('0x1a')][_0x76aa('0x3c')]){_0x64612e[_0x76aa('0x3d')]=[{'all':!![]}];}_0x64612e=_[_0x76aa('0x38')]({},_0x64612e,_0x4a5a96[_0x76aa('0x3b')]);return db['CmHopper'][_0x76aa('0x42')](_0x64612e)[_0x76aa('0xd')](handleEntityNotFound(_0xa824e8,null))[_0x76aa('0xd')](respondWithResult(_0xa824e8,null))[_0x76aa('0x40')](handleError(_0xa824e8,null));};exports[_0x76aa('0x43')]=function(_0x47a308,_0x2f695c){return db[_0x76aa('0x14')]['create'](_0x47a308[_0x76aa('0x44')],{})['then'](respondWithResult(_0x2f695c,0xc9))[_0x76aa('0x40')](handleError(_0x2f695c,null));};exports[_0x76aa('0xc')]=function(_0x31930b,_0x18fd3e){if(_0x31930b[_0x76aa('0x44')]['id']){delete _0x31930b[_0x76aa('0x44')]['id'];}return db[_0x76aa('0x14')][_0x76aa('0x42')]({'where':{'id':_0x31930b[_0x76aa('0x45')]['id']}})[_0x76aa('0xd')](handleEntityNotFound(_0x18fd3e,null))['then'](saveUpdates(_0x31930b[_0x76aa('0x44')],null))['then'](respondWithResult(_0x18fd3e,null))[_0x76aa('0x40')](handleError(_0x18fd3e,null));};exports[_0x76aa('0x46')]=function(_0x5e95f5,_0x156d4e){return db['CmHopper']['describe']()[_0x76aa('0xd')](respondWithResult(_0x156d4e,null))['catch'](handleError(_0x156d4e,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){var _0x2e5633;var _0x30c577=_0x302a0c[_0x76aa('0x45')]['id'];return db['CmHopper']['find']({'where':{'id':_0x302a0c[_0x76aa('0x45')]['id']}})[_0x76aa('0xd')](handleEntityNotFound(_0x4315b3,null))[_0x76aa('0xd')](function(_0x40e8ff){if(_0x40e8ff){return _0x40e8ff[_0x76aa('0x47')]()[_0x76aa('0xd')](function(_0x4c52d5){return _0x4c52d5;});}})[_0x76aa('0xd')](function(_0x2d631e){_0x2e5633=_0x2d631e;if(_0x2d631e){if(_0x2d631e[_0x76aa('0x48')]||_0x2d631e['CampaignId']){return db[_0x2d631e[_0x76aa('0x48')]?'VoiceQueue':_0x76aa('0x49')]['find']({'where':{'id':_0x2d631e[_0x76aa('0x48')]?_0x2d631e[_0x76aa('0x48')]:_0x2d631e[_0x76aa('0x4a')]},'attributes':['id',_0x76aa('0x10')],'raw':!![]});}}})[_0x76aa('0xd')](function(_0x316de3){var _0x953726={};if(_0x316de3){_['merge'](_0x953726,_[_0x76aa('0x4b')](_0x2e5633['dataValues'],[_0x76aa('0x4c'),_0x76aa('0x4d'),'id']));_0x953726[_0x76aa('0x4e')]=0x15;_0x953726[_0x76aa('0x4f')]=_0x76aa('0x50');_0x953726[_0x76aa('0x51')]=_0x316de3[_0x76aa('0x10')];_0x953726['membername']=_0x302a0c[_0x76aa('0x52')][_0x76aa('0x10')];_0x953726[_0x76aa('0x53')]=_0x302a0c[_0x76aa('0x52')]['id'];_0x953726['deleted']=!![];_0x953726[_0x76aa('0x54')]=moment()[_0x76aa('0x55')](_0x76aa('0x56'));_0x953726[_0x76aa('0x57')]=_0x2e5633[_0x76aa('0x58')];_0x953726[_0x76aa('0x59')]=_0x2e5633['VoiceQueueId']?_0x76aa('0x5a'):_0x76aa('0x5b');return db[_0x76aa('0x5c')][_0x76aa('0x42')]({'where':{'id':_0x953726[_0x76aa('0x5d')]},'attributes':[_0x76aa('0x5e'),_0x76aa('0x5f')]})['then'](function(_0x4910fb){if(!_[_0x76aa('0x60')](_0x4315b3)&&!_[_0x76aa('0x60')](_0x4910fb['firstName'])){_0x953726[_0x76aa('0x61')]=_0x4910fb[_0x76aa('0x5e')];if(!_['isNil'](_0x4910fb[_0x76aa('0x5f')])){_0x953726[_0x76aa('0x61')]+='\x20'+_0x4910fb[_0x76aa('0x5f')];}}})[_0x76aa('0x62')](function(){return db[_0x76aa('0x63')][_0x76aa('0x43')](_0x953726);});}})[_0x76aa('0xd')](function(_0x30573a){return db[_0x76aa('0x64')]['destroy']({'where':{'CmHopperId':_0x30c577}});})[_0x76aa('0xd')](function(){return _0x4315b3['status'](0xcc)[_0x76aa('0x65')]();})[_0x76aa('0x40')](handleError(_0x4315b3,null));};exports[_0x76aa('0x66')]=function(_0x16cc85,_0x343cf1){var _0x260ad2=[];return db[_0x76aa('0x5c')][_0x76aa('0x46')]()[_0x76aa('0xd')](function(_0x5eceba){_0x260ad2=_[_0x76aa('0x1b')](_0x5eceba);return _0x16cc85[_0x76aa('0x52')][_0x76aa('0x67')]({'where':{'type':_0x76aa('0x68'),'dialActive':!![],'dialMethod':_0x76aa('0x69')},'attributes':['id',_0x76aa('0x6a'),_0x76aa('0x6b')],'raw':!![]});})[_0x76aa('0xd')](function(_0x5546b6){if(_0x5546b6&&_0x5546b6[_0x76aa('0x33')]){return db['sequelize'][_0x76aa('0x6c')](function(_0x35881c){var _0x3e97f8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x76aa('0x55')](_0x76aa('0x56'))},'VoiceQueueId':{'$in':_[_0x76aa('0x13')](_0x5546b6,'id')},'$or':[{'UserId':null},{'UserId':_0x16cc85[_0x76aa('0x52')]['id']}]};var _0x4a37f1={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5546b6)[_0x76aa('0x3a')]([_0x76aa('0x6b'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x16cc85[_0x76aa('0x52')]['id']}]};var _0x13389d={'$or':[_0x3e97f8,_0x4a37f1]};var _0x5295a7=[];if(_0x16cc85[_0x76aa('0x44')][_0x76aa('0x6d')]&&_0x16cc85[_0x76aa('0x44')]['direction']===_0x76aa('0x6e')){if(!_['isEmpty'](_0x16cc85[_0x76aa('0x44')][_0x76aa('0x6f')])){_0x13389d['id']={'$in':_0x16cc85[_0x76aa('0x44')][_0x76aa('0x6f')]};}_0x5295a7=[['priority','ASC'],[_0x76aa('0x70'),_0x5546b6[0x0]['dialOrderByScheduledAt']===_0x76aa('0x71')?_0x76aa('0x72'):_0x76aa('0x71')],db[_0x76aa('0x73')][_0x76aa('0x74')](_0x76aa('0x75')),['id',_0x76aa('0x72')]];}else{if(!_[_0x76aa('0x76')](_0x16cc85[_0x76aa('0x44')]['hopperIds'])){_0x13389d['id']={'$notIn':_0x16cc85[_0x76aa('0x44')][_0x76aa('0x6f')]};}_0x5295a7=[[_0x76aa('0x77'),_0x76aa('0x72')],['scheduledAt',_0x5546b6[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x76aa('0x74')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x76aa('0x71')]];}return db[_0x76aa('0x14')][_0x76aa('0x78')]({'attributes':['id',_0x76aa('0x79'),'phone',_0x76aa('0x7a')],'where':_0x13389d,'order':_0x5295a7,'transaction':_0x35881c,'lock':_0x35881c['LOCK'][_0x76aa('0x7b')],'include':[{'model':db[_0x76aa('0x5c')],'as':_0x76aa('0x7c'),'attributes':_0x260ad2,'include':[{'model':db[_0x76aa('0x7d')],'as':_0x76aa('0x7e'),'attributes':['id','name']}]},{'model':db[_0x76aa('0x7f')],'as':_0x76aa('0x80'),'attributes':['id',_0x76aa('0x10')]},{'model':db[_0x76aa('0x81')],'as':_0x76aa('0x82'),'attributes':['id',_0x76aa('0x10'),_0x76aa('0x83')]}]})[_0x76aa('0xd')](function(_0x572f75){if(_0x572f75){return _0x572f75[_0x76aa('0xc')]({'UserId':_0x16cc85[_0x76aa('0x52')]['id']},{'transaction':_0x35881c});}});});}})['then'](handleEntityNotFound(_0x343cf1,null))[_0x76aa('0xd')](respondWithResult(_0x343cf1,null))[_0x76aa('0x40')](handleError(_0x343cf1,null));};exports[_0x76aa('0x84')]=function(_0x37cfa1,_0x1ad3c6,_0x51b101){var _0x2eaeb5=[];var _0x5dc923=_0x37cfa1[_0x76aa('0x45')]['id'];var _0x5988a0=_0x37cfa1['user']['id'];return db[_0x76aa('0x5c')][_0x76aa('0x46')]()['then'](function(_0x5d1de1){_0x2eaeb5=_[_0x76aa('0x1b')](_0x5d1de1);return db[_0x76aa('0x73')][_0x76aa('0x6c')](function(_0x588cc5){const _0x57bbc2={'id':_0x5dc923};return db[_0x76aa('0x14')][_0x76aa('0x78')]({'attributes':['id',_0x76aa('0x79'),'recallme'],'where':_0x57bbc2,'transaction':_0x588cc5,'lock':_0x588cc5[_0x76aa('0x85')]['UPDATE'],'include':[{'model':db[_0x76aa('0x5c')],'as':_0x76aa('0x7c'),'attributes':_0x2eaeb5,'include':[{'model':db[_0x76aa('0x7d')],'as':_0x76aa('0x7e'),'attributes':['id',_0x76aa('0x10')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x76aa('0x10')]},{'model':db[_0x76aa('0x81')],'as':_0x76aa('0x82'),'attributes':['id','name',_0x76aa('0x83')]}]})[_0x76aa('0xd')](function(_0x2ce07f){if(_0x2ce07f){return _0x2ce07f[_0x76aa('0xc')]({'UserId':_0x5988a0},{'transaction':_0x588cc5});}});});})[_0x76aa('0xd')](handleEntityNotFound(_0x1ad3c6,null))['then'](respondWithResult(_0x1ad3c6,null))[_0x76aa('0x40')](handleError(_0x1ad3c6,null));};exports['getOpenContacts']=function(_0x213f7f,_0xca8769){return _0x213f7f[_0x76aa('0x52')][_0x76aa('0x67')]({'where':{'type':_0x76aa('0x68'),'dialActive':!![],'dialMethod':_0x76aa('0x69')},'attributes':['id'],'raw':!![]})['then'](function(_0x555682){if(_0x555682&&_0x555682['length']){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x76aa('0x55')](_0x76aa('0x56'))},'VoiceQueueId':{'$in':_['map'](_0x555682,'id')},'$or':[{'UserId':null},{'UserId':_0x213f7f['user']['id']}]}});}return 0x0;})['then'](function(_0x3a6326){if(!_[_0x76aa('0x60')](_0x3a6326)&&_[_0x76aa('0x86')](_0x3a6326)){return _0xca8769['status'](0xc8)['json']({'contacts':_0x3a6326});}else{logger[_0x76aa('0x87')](_0x76aa('0x88'),_0x76aa('0x89'),0x194,_0x76aa('0x8a'));_0xca8769[_0x76aa('0xe')](0x194);}})['catch'](handleError(_0xca8769,null));};exports['getTimezones']=function(_0x465a57,_0x5c18b4){var _0x5d9381=shared['timezones'];var _0x4673e6=[];_[_0x76aa('0x13')](_0x5d9381,function(_0x52d5ce){_0x4673e6[_0x76aa('0x8b')]({'id':_0x52d5ce[_0x76aa('0x10')],'name':_0x52d5ce['name'],'utcOffset':_0x52d5ce[_0x76aa('0x8c')]});});return _0x5c18b4[_0x76aa('0x9')](0xc8)[_0x76aa('0x8d')]({'tz':_0x4673e6});};exports[_0x76aa('0x8e')]=function(_0x1fa86b,_0x458ab9){var _0x1a8b6b=shared[_0x76aa('0x8f')];var _0x2243be={};if(!_['isNil'](_0x1a8b6b[_0x1fa86b[_0x76aa('0x44')]['id']]))_0x2243be=_0x1a8b6b[_0x1fa86b[_0x76aa('0x44')]['id']];return _0x458ab9['status'](0xc8)[_0x76aa('0x8d')](_0x2243be);}; \ No newline at end of file +var _0xe0c3=['$contained','$any','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','LOCK','CmCompany','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','then','sendStatus','error','stack','name','CmHopper','rawAttributes','type','map','query','keys','intersection','filters','concat','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$notLike','$like','$overlap'];(function(_0xb06221,_0x3b47da){var _0x542c06=function(_0x5cd5ff){while(--_0x5cd5ff){_0xb06221['push'](_0xb06221['shift']());}};_0x542c06(++_0x3b47da);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x3e0c('0x0'));var _=require('lodash');var qs=require(_0x3e0c('0x1'));var logger=require(_0x3e0c('0x2'))(_0x3e0c('0x3'));var shared=require(_0x3e0c('0x4'));var db=require(_0x3e0c('0x5'))['db'];function respondWithResult(_0x410ec4,_0x31851c){_0x31851c=_0x31851c||0xc8;return function(_0x26c964){if(_0x26c964){return _0x410ec4[_0x3e0c('0x6')](_0x31851c)['json'](_0x26c964);}};}function respondWithFilteredResult(_0x530ebf,_0x163adf){return function(_0x1e339a){if(_0x1e339a){var _0x3f6607=typeof _0x163adf[_0x3e0c('0x7')]===_0x3e0c('0x8')&&typeof _0x163adf[_0x3e0c('0x9')]===_0x3e0c('0x8');var _0x448907=_0x1e339a[_0x3e0c('0xa')];var _0x35d56f=_0x3f6607?0x0:_0x163adf[_0x3e0c('0x7')];var _0x4f7e71=_0x3f6607?_0x1e339a['count']:_0x163adf[_0x3e0c('0x7')]+_0x163adf[_0x3e0c('0x9')];var _0x13ce3e;if(_0x4f7e71>=_0x448907){_0x4f7e71=_0x448907;_0x13ce3e=0xc8;}else{_0x13ce3e=0xce;}_0x530ebf[_0x3e0c('0x6')](_0x13ce3e);return _0x530ebf[_0x3e0c('0xb')](_0x3e0c('0xc'),_0x35d56f+'-'+_0x4f7e71+'/'+_0x448907)[_0x3e0c('0xd')](_0x1e339a);}return null;};}function saveUpdates(_0x5dc732,_0x38b416){return function(_0x491432){if(_0x491432){return _0x491432[_0x3e0c('0xe')](_0x5dc732)[_0x3e0c('0xf')](function(_0x5d0ab7){return _0x5d0ab7;});}return null;};}function handleEntityNotFound(_0x5f2654,_0x6d9c61){return function(_0x409b2c){if(!_0x409b2c){_0x5f2654[_0x3e0c('0x10')](0x194);}return _0x409b2c;};}function handleError(_0xea4ed,_0x15a269){_0x15a269=_0x15a269||0x1f4;return function(_0x24fcf9){logger[_0x3e0c('0x11')](_0x24fcf9[_0x3e0c('0x12')]);if(_0x24fcf9[_0x3e0c('0x13')]){delete _0x24fcf9[_0x3e0c('0x13')];}_0xea4ed[_0x3e0c('0x6')](_0x15a269)['send'](_0x24fcf9);};}exports['index']=function(_0x20db28,_0x216993){var _0x1b2e17={},_0x41b19f={},_0x108d4a={'count':0x0,'rows':[]};var _0x8825b7=_['map'](db[_0x3e0c('0x14')][_0x3e0c('0x15')],function(_0x95ce16){return{'name':_0x95ce16['fieldName'],'type':_0x95ce16[_0x3e0c('0x16')]['key']};});_0x41b19f['model']=_[_0x3e0c('0x17')](_0x8825b7,_0x3e0c('0x13'));_0x41b19f[_0x3e0c('0x18')]=_[_0x3e0c('0x19')](_0x20db28['query']);_0x41b19f['filters']=_[_0x3e0c('0x1a')](_0x41b19f['model'],_0x41b19f['query']);_0x41b19f[_0x3e0c('0x1b')]=_[_0x3e0c('0x1c')](_0x41b19f[_0x3e0c('0x1b')],['$and',_0x3e0c('0x1d'),_0x3e0c('0x1e'),'$gte',_0x3e0c('0x1f'),_0x3e0c('0x20'),_0x3e0c('0x21'),_0x3e0c('0x22'),'$not',_0x3e0c('0x23'),_0x3e0c('0x24'),_0x3e0c('0x25'),_0x3e0c('0x26'),'$like',_0x3e0c('0x27'),'$iLike','$notILike',_0x3e0c('0x28'),_0x3e0c('0x29'),'$contains',_0x3e0c('0x2a'),_0x3e0c('0x2b')]);_0x1b2e17[_0x3e0c('0x2c')]=_['intersection'](_0x41b19f[_0x3e0c('0x2d')],qs[_0x3e0c('0x2e')](_0x20db28['query'][_0x3e0c('0x2e')]));_0x1b2e17[_0x3e0c('0x2c')]=_0x1b2e17[_0x3e0c('0x2c')][_0x3e0c('0x2f')]?_0x1b2e17['attributes']:_0x41b19f[_0x3e0c('0x2d')];if(!_0x20db28[_0x3e0c('0x18')][_0x3e0c('0x30')]('nolimit')){_0x1b2e17[_0x3e0c('0x9')]=qs[_0x3e0c('0x9')](_0x20db28[_0x3e0c('0x18')]['limit']);_0x1b2e17[_0x3e0c('0x7')]=qs[_0x3e0c('0x7')](_0x20db28[_0x3e0c('0x18')][_0x3e0c('0x7')]);}_0x1b2e17[_0x3e0c('0x31')]=qs[_0x3e0c('0x32')](_0x20db28[_0x3e0c('0x18')][_0x3e0c('0x32')]);_0x1b2e17[_0x3e0c('0x33')]=qs[_0x3e0c('0x1b')](_[_0x3e0c('0x34')](_0x20db28[_0x3e0c('0x18')],_0x41b19f[_0x3e0c('0x1b')]),_0x8825b7);if(_0x20db28[_0x3e0c('0x18')]['filter']){_0x1b2e17[_0x3e0c('0x33')]=_[_0x3e0c('0x35')](_0x1b2e17[_0x3e0c('0x33')],{'$or':_[_0x3e0c('0x17')](_0x8825b7,function(_0xd89af9){if(_0xd89af9[_0x3e0c('0x16')]!==_0x3e0c('0x36')){var _0x2ef238={};_0x2ef238[_0xd89af9['name']]={'$like':'%'+_0x20db28['query'][_0x3e0c('0x37')]+'%'};return _0x2ef238;}})});}_0x1b2e17=_[_0x3e0c('0x35')]({},_0x1b2e17,_0x20db28[_0x3e0c('0x38')]);var _0x319cd4={'where':_0x1b2e17[_0x3e0c('0x33')]};return db[_0x3e0c('0x14')]['count'](_0x319cd4)[_0x3e0c('0xf')](function(_0x168784){_0x108d4a['count']=_0x168784;if(_0x20db28['query']['includeAll']){_0x1b2e17[_0x3e0c('0x39')]=[{'all':!![]}];}return db[_0x3e0c('0x14')][_0x3e0c('0x3a')](_0x1b2e17);})[_0x3e0c('0xf')](function(_0x320bf1){_0x108d4a[_0x3e0c('0x3b')]=_0x320bf1;return _0x108d4a;})[_0x3e0c('0xf')](respondWithFilteredResult(_0x216993,_0x1b2e17))[_0x3e0c('0x3c')](handleError(_0x216993,null));};exports[_0x3e0c('0x3d')]=function(_0xb38f09,_0x427207){var _0x20135d={'raw':!![],'where':{'id':_0xb38f09['params']['id']}},_0x4f0e6c={};_0x4f0e6c['model']=_[_0x3e0c('0x19')](db[_0x3e0c('0x14')]['rawAttributes']);_0x4f0e6c['query']=_[_0x3e0c('0x19')](_0xb38f09[_0x3e0c('0x18')]);_0x4f0e6c[_0x3e0c('0x1b')]=_[_0x3e0c('0x1a')](_0x4f0e6c['model'],_0x4f0e6c[_0x3e0c('0x18')]);_0x20135d[_0x3e0c('0x2c')]=_[_0x3e0c('0x1a')](_0x4f0e6c[_0x3e0c('0x2d')],qs[_0x3e0c('0x2e')](_0xb38f09['query'][_0x3e0c('0x2e')]));_0x20135d['attributes']=_0x20135d[_0x3e0c('0x2c')][_0x3e0c('0x2f')]?_0x20135d['attributes']:_0x4f0e6c['model'];if(_0xb38f09[_0x3e0c('0x18')][_0x3e0c('0x3e')]){_0x20135d['include']=[{'all':!![]}];}_0x20135d=_[_0x3e0c('0x35')]({},_0x20135d,_0xb38f09[_0x3e0c('0x38')]);return db[_0x3e0c('0x14')][_0x3e0c('0x3f')](_0x20135d)[_0x3e0c('0xf')](handleEntityNotFound(_0x427207,null))[_0x3e0c('0xf')](respondWithResult(_0x427207,null))['catch'](handleError(_0x427207,null));};exports[_0x3e0c('0x40')]=function(_0x20a85f,_0xec802a){return db[_0x3e0c('0x14')][_0x3e0c('0x40')](_0x20a85f[_0x3e0c('0x41')],{})['then'](respondWithResult(_0xec802a,0xc9))[_0x3e0c('0x3c')](handleError(_0xec802a,null));};exports[_0x3e0c('0xe')]=function(_0x323246,_0x563251){if(_0x323246[_0x3e0c('0x41')]['id']){delete _0x323246[_0x3e0c('0x41')]['id'];}return db['CmHopper'][_0x3e0c('0x3f')]({'where':{'id':_0x323246[_0x3e0c('0x42')]['id']}})[_0x3e0c('0xf')](handleEntityNotFound(_0x563251,null))['then'](saveUpdates(_0x323246[_0x3e0c('0x41')],null))[_0x3e0c('0xf')](respondWithResult(_0x563251,null))[_0x3e0c('0x3c')](handleError(_0x563251,null));};exports[_0x3e0c('0x43')]=function(_0x109078,_0x2e0a90){return db[_0x3e0c('0x14')][_0x3e0c('0x43')]()[_0x3e0c('0xf')](respondWithResult(_0x2e0a90,null))[_0x3e0c('0x3c')](handleError(_0x2e0a90,null));};exports[_0x3e0c('0x44')]=function(_0x4efbf2,_0x20c9df){var _0x58dac7;var _0x4b2062=_0x4efbf2[_0x3e0c('0x42')]['id'];return db['CmHopper'][_0x3e0c('0x3f')]({'where':{'id':_0x4efbf2[_0x3e0c('0x42')]['id']}})['then'](handleEntityNotFound(_0x20c9df,null))[_0x3e0c('0xf')](function(_0x14b718){if(_0x14b718){return _0x14b718['destroy']()[_0x3e0c('0xf')](function(_0x3e04c9){return _0x3e04c9;});}})[_0x3e0c('0xf')](function(_0x20b0bc){_0x58dac7=_0x20b0bc;if(_0x20b0bc){if(_0x20b0bc[_0x3e0c('0x45')]||_0x20b0bc[_0x3e0c('0x46')]){return db[_0x20b0bc[_0x3e0c('0x45')]?_0x3e0c('0x47'):_0x3e0c('0x48')][_0x3e0c('0x3f')]({'where':{'id':_0x20b0bc['VoiceQueueId']?_0x20b0bc[_0x3e0c('0x45')]:_0x20b0bc[_0x3e0c('0x46')]},'attributes':['id',_0x3e0c('0x13')],'raw':!![]});}}})[_0x3e0c('0xf')](function(_0x1a2cf2){var _0x14299c={};if(_0x1a2cf2){_[_0x3e0c('0x35')](_0x14299c,_[_0x3e0c('0x49')](_0x58dac7[_0x3e0c('0x4a')],[_0x3e0c('0x4b'),_0x3e0c('0x4c'),'id']));_0x14299c[_0x3e0c('0x4d')]=0x15;_0x14299c[_0x3e0c('0x4e')]=_0x3e0c('0x4f');_0x14299c['campaign']=_0x1a2cf2[_0x3e0c('0x13')];_0x14299c[_0x3e0c('0x50')]=_0x4efbf2[_0x3e0c('0x51')]['name'];_0x14299c[_0x3e0c('0x52')]=_0x4efbf2[_0x3e0c('0x51')]['id'];_0x14299c[_0x3e0c('0x4f')]=!![];_0x14299c[_0x3e0c('0x53')]=moment()[_0x3e0c('0x54')](_0x3e0c('0x55'));_0x14299c[_0x3e0c('0x56')]=_0x58dac7[_0x3e0c('0x57')];_0x14299c[_0x3e0c('0x58')]=_0x58dac7[_0x3e0c('0x45')]?'queue':_0x3e0c('0x59');return db[_0x3e0c('0x5a')]['find']({'where':{'id':_0x14299c[_0x3e0c('0x5b')]},'attributes':['firstName',_0x3e0c('0x5c')]})[_0x3e0c('0xf')](function(_0x28b2d5){if(!_[_0x3e0c('0x5d')](_0x20c9df)&&!_[_0x3e0c('0x5d')](_0x28b2d5[_0x3e0c('0x5e')])){_0x14299c[_0x3e0c('0x5f')]=_0x28b2d5[_0x3e0c('0x5e')];if(!_[_0x3e0c('0x5d')](_0x28b2d5[_0x3e0c('0x5c')])){_0x14299c[_0x3e0c('0x5f')]+='\x20'+_0x28b2d5[_0x3e0c('0x5c')];}}})[_0x3e0c('0x60')](function(){return db[_0x3e0c('0x61')][_0x3e0c('0x40')](_0x14299c);});}})[_0x3e0c('0xf')](function(_0x117e2f){return db[_0x3e0c('0x62')][_0x3e0c('0x44')]({'where':{'CmHopperId':_0x4b2062}});})[_0x3e0c('0xf')](function(){return _0x20c9df[_0x3e0c('0x6')](0xcc)[_0x3e0c('0x63')]();})[_0x3e0c('0x3c')](handleError(_0x20c9df,null));};exports[_0x3e0c('0x64')]=function(_0x2f6666,_0xcc965b){var _0x58aa5d=[];return db[_0x3e0c('0x5a')][_0x3e0c('0x43')]()[_0x3e0c('0xf')](function(_0x874b04){_0x58aa5d=_['keys'](_0x874b04);return _0x2f6666[_0x3e0c('0x51')][_0x3e0c('0x65')]({'where':{'type':_0x3e0c('0x66'),'dialActive':!![],'dialMethod':_0x3e0c('0x67')},'attributes':['id',_0x3e0c('0x68'),_0x3e0c('0x69')],'raw':!![]});})['then'](function(_0x3e1c8a){if(_0x3e1c8a&&_0x3e1c8a[_0x3e0c('0x2f')]){return db['sequelize'][_0x3e0c('0x6a')](function(_0x368b04){var _0x2b0eae={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3e0c('0x54')](_0x3e0c('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x3e1c8a,'id')},'$or':[{'UserId':null},{'UserId':_0x2f6666['user']['id']}]};var _0x1b57dd={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3e1c8a)[_0x3e0c('0x37')](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2f6666[_0x3e0c('0x51')]['id']}]};var _0x274fcc={'$or':[_0x2b0eae,_0x1b57dd]};var _0x10e951=[];if(_0x2f6666[_0x3e0c('0x41')][_0x3e0c('0x6b')]&&_0x2f6666[_0x3e0c('0x41')][_0x3e0c('0x6b')]===_0x3e0c('0x6c')){if(!_[_0x3e0c('0x6d')](_0x2f6666[_0x3e0c('0x41')][_0x3e0c('0x6e')])){_0x274fcc['id']={'$in':_0x2f6666[_0x3e0c('0x41')][_0x3e0c('0x6e')]};}_0x10e951=[[_0x3e0c('0x6f'),_0x3e0c('0x70')],[_0x3e0c('0x71'),_0x3e1c8a[0x0][_0x3e0c('0x68')]==='ASC'?_0x3e0c('0x72'):_0x3e0c('0x70')],db[_0x3e0c('0x73')]['literal'](_0x3e0c('0x74')),['id',_0x3e0c('0x72')]];}else{if(!_[_0x3e0c('0x6d')](_0x2f6666[_0x3e0c('0x41')][_0x3e0c('0x6e')])){_0x274fcc['id']={'$notIn':_0x2f6666[_0x3e0c('0x41')][_0x3e0c('0x6e')]};}_0x10e951=[[_0x3e0c('0x6f'),'DESC'],[_0x3e0c('0x71'),_0x3e1c8a[0x0][_0x3e0c('0x68')]],db[_0x3e0c('0x73')]['literal'](_0x3e0c('0x75')),['id',_0x3e0c('0x70')]];}return db['CmHopper'][_0x3e0c('0x76')]({'attributes':['id',_0x3e0c('0x77'),'phone',_0x3e0c('0x78')],'where':_0x274fcc,'order':_0x10e951,'transaction':_0x368b04,'lock':_0x368b04['LOCK'][_0x3e0c('0x79')],'include':[{'model':db[_0x3e0c('0x5a')],'as':_0x3e0c('0x7a'),'attributes':_0x58aa5d,'include':[{'model':db['CmCompany'],'as':_0x3e0c('0x7b'),'attributes':['id',_0x3e0c('0x13')]}]},{'model':db[_0x3e0c('0x7c')],'as':_0x3e0c('0x7d'),'attributes':['id','name']},{'model':db[_0x3e0c('0x47')],'as':_0x3e0c('0x7e'),'attributes':['id','name',_0x3e0c('0x7f')]}]})[_0x3e0c('0xf')](function(_0x13cca3){if(_0x13cca3){return _0x13cca3[_0x3e0c('0xe')]({'UserId':_0x2f6666['user']['id']},{'transaction':_0x368b04});}});});}})[_0x3e0c('0xf')](handleEntityNotFound(_0xcc965b,null))['then'](respondWithResult(_0xcc965b,null))[_0x3e0c('0x3c')](handleError(_0xcc965b,null));};exports[_0x3e0c('0x80')]=function(_0x32f787,_0x7a867b,_0xe2533b){var _0x1474f5=[];var _0x345108=_0x32f787[_0x3e0c('0x42')]['id'];var _0x518f39=_0x32f787['user']['id'];return db[_0x3e0c('0x5a')]['describe']()[_0x3e0c('0xf')](function(_0x573576){_0x1474f5=_[_0x3e0c('0x19')](_0x573576);return db['sequelize'][_0x3e0c('0x6a')](function(_0x2ad053){const _0x383387={'id':_0x345108};return db['CmHopper'][_0x3e0c('0x76')]({'attributes':['id',_0x3e0c('0x77'),_0x3e0c('0x78')],'where':_0x383387,'transaction':_0x2ad053,'lock':_0x2ad053[_0x3e0c('0x81')][_0x3e0c('0x79')],'include':[{'model':db[_0x3e0c('0x5a')],'as':_0x3e0c('0x7a'),'attributes':_0x1474f5,'include':[{'model':db[_0x3e0c('0x82')],'as':_0x3e0c('0x7b'),'attributes':['id','name']}]},{'model':db[_0x3e0c('0x7c')],'as':_0x3e0c('0x7d'),'attributes':['id',_0x3e0c('0x13')]},{'model':db[_0x3e0c('0x47')],'as':'Queue','attributes':['id',_0x3e0c('0x13'),_0x3e0c('0x7f')]}]})[_0x3e0c('0xf')](function(_0x234fae){if(_0x234fae){return _0x234fae['update']({'UserId':_0x518f39},{'transaction':_0x2ad053});}});});})[_0x3e0c('0xf')](handleEntityNotFound(_0x7a867b,null))[_0x3e0c('0xf')](respondWithResult(_0x7a867b,null))[_0x3e0c('0x3c')](handleError(_0x7a867b,null));};exports[_0x3e0c('0x83')]=function(_0x15fc4b,_0xed0325){return _0x15fc4b[_0x3e0c('0x51')][_0x3e0c('0x65')]({'where':{'type':_0x3e0c('0x66'),'dialActive':!![],'dialMethod':_0x3e0c('0x67')},'attributes':['id'],'raw':!![]})[_0x3e0c('0xf')](function(_0x2eec6a){if(_0x2eec6a&&_0x2eec6a[_0x3e0c('0x2f')]){return db[_0x3e0c('0x14')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3e0c('0x54')](_0x3e0c('0x55'))},'VoiceQueueId':{'$in':_[_0x3e0c('0x17')](_0x2eec6a,'id')},'$or':[{'UserId':null},{'UserId':_0x15fc4b[_0x3e0c('0x51')]['id']}]}});}return 0x0;})[_0x3e0c('0xf')](function(_0x11b2d0){if(!_['isNil'](_0x11b2d0)&&_['isNumber'](_0x11b2d0)){return _0xed0325[_0x3e0c('0x6')](0xc8)['json']({'contacts':_0x11b2d0});}else{logger[_0x3e0c('0x11')](_0x3e0c('0x84'),_0x3e0c('0x83'),0x194,_0x3e0c('0x85'));_0xed0325[_0x3e0c('0x10')](0x194);}})[_0x3e0c('0x3c')](handleError(_0xed0325,null));};exports[_0x3e0c('0x86')]=function(_0x4cd2d0,_0x3283d0){var _0x1efb21=shared[_0x3e0c('0x87')];var _0x20dc9c=[];_[_0x3e0c('0x17')](_0x1efb21,function(_0x373b81){_0x20dc9c['push']({'id':_0x373b81[_0x3e0c('0x13')],'name':_0x373b81[_0x3e0c('0x13')],'utcOffset':_0x373b81[_0x3e0c('0x88')]});});return _0x3283d0[_0x3e0c('0x6')](0xc8)['json']({'tz':_0x20dc9c});};exports[_0x3e0c('0x89')]=function(_0x489b45,_0x5f56e9){var _0x181bd8=shared[_0x3e0c('0x87')];var _0xd83a3c={};if(!_[_0x3e0c('0x5d')](_0x181bd8[_0x489b45['body']['id']]))_0xd83a3c=_0x181bd8[_0x489b45['body']['id']];return _0x5f56e9[_0x3e0c('0x6')](0xc8)[_0x3e0c('0xd')](_0xd83a3c);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 928672b..d260743 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 _0x9536=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x9536,0x179));var _0x6953=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x9536[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['scheduledat']},{'name':_0x6953('0xe'),'fields':[_0x6953('0xe')]},{'name':_0x6953('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x40b72b,_0x2247c1){var _0x40cdfa=function(_0x3d681e){while(--_0x3d681e){_0x40b72b['push'](_0x40b72b['shift']());}};_0x40cdfa(++_0x2247c1);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x335f5c,_0xce622c){_0x335f5c=_0x335f5c-0x0;var _0x27458c=_0x3f8a[_0x335f5c];return _0x27458c;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xe')]},{'name':_0xa3f8('0xf'),'fields':[_0xa3f8('0xf')]},{'name':_0xa3f8('0x10'),'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 c3547bf..107656b 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 _0x450f=['CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','length','UserId','includes','push','all','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()'];(function(_0x195a3b,_0x6e9cf1){var _0x3b915f=function(_0x89f215){while(--_0x89f215){_0x195a3b['push'](_0x195a3b['shift']());}};_0x3b915f(++_0x6e9cf1);}(_0x450f,0x1ab));var _0xf450=function(_0x596cd2,_0x1b03b4){_0x596cd2=_0x596cd2-0x0;var _0x4916b6=_0x450f[_0x596cd2];return _0x4916b6;};'use strict';var _=require(_0xf450('0x0'));var util=require(_0xf450('0x1'));var moment=require(_0xf450('0x2'));var BPromise=require(_0xf450('0x3'));var db=require(_0xf450('0x4'))['db'];var logger=require(_0xf450('0x5'))(_0xf450('0x6'));exports[_0xf450('0x7')]=function(_0x18e88f){var _0x46dc3d=this;return new Promise(function(_0x3cf5fc,_0x25cfbd){return db[_0xf450('0x8')][_0xf450('0x9')]({'raw':_0x18e88f['options']?_0x18e88f[_0xf450('0xa')][_0xf450('0xb')]===undefined?!![]:![]:!![],'where':_0x18e88f[_0xf450('0xa')]?_0x18e88f['options'][_0xf450('0xc')]||null:null,'attributes':_0x18e88f[_0xf450('0xa')]?_0x18e88f[_0xf450('0xa')][_0xf450('0xd')]||null:null,'limit':_0x18e88f['options']?_0x18e88f['options'][_0xf450('0xe')]||null:null,'include':_0x18e88f[_0xf450('0xa')]?_0x18e88f[_0xf450('0xa')][_0xf450('0xf')]?_[_0xf450('0x10')](_0x18e88f[_0xf450('0xa')]['include'],function(_0x31c090){return{'model':db[_0x31c090['model']],'as':_0x31c090['as'],'attributes':_0x31c090['attributes'],'include':_0x31c090[_0xf450('0xf')]?_[_0xf450('0x10')](_0x31c090['include'],function(_0x47fce9){return{'model':db[_0x47fce9[_0xf450('0x11')]],'as':_0x47fce9['as'],'attributes':_0x47fce9[_0xf450('0xd')],'include':_0x47fce9[_0xf450('0xf')]?_['map'](_0x47fce9['include'],function(_0x523b6e){return{'model':db[_0x523b6e[_0xf450('0x11')]],'as':_0x523b6e['as'],'attributes':_0x523b6e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf450('0x12')](function(_0x1193bc){logger[_0xf450('0x13')](_0xf450('0x7'),_0x18e88f);logger[_0xf450('0x14')](_0xf450('0x7'),_0x18e88f,JSON[_0xf450('0x15')](_0x1193bc));_0x3cf5fc(_0x1193bc);})[_0xf450('0x16')](function(_0x4433c0){logger[_0xf450('0x17')](_0xf450('0x7'),_0x4433c0[_0xf450('0x18')],_0x18e88f);_0x25cfbd(_0x46dc3d[_0xf450('0x17')](0x1f4,_0x4433c0['message']));});});};exports[_0xf450('0x19')]=function(_0x93810f){var _0x58b8bf=this;return new Promise(function(_0x52b2ba,_0x2a5c27){return db[_0xf450('0x8')][_0xf450('0x1a')]({'raw':_0x93810f[_0xf450('0xa')]?_0x93810f[_0xf450('0xa')][_0xf450('0xb')]===undefined?!![]:![]:!![],'where':_0x93810f['options']?_0x93810f['options'][_0xf450('0xc')]||null:null,'attributes':_0x93810f[_0xf450('0xa')]?_0x93810f['options'][_0xf450('0xd')]||null:null,'include':_0x93810f['options']?_0x93810f[_0xf450('0xa')][_0xf450('0xf')]?_[_0xf450('0x10')](_0x93810f[_0xf450('0xa')]['include'],function(_0x25a659){return{'model':db[_0x25a659[_0xf450('0x11')]],'as':_0x25a659['as'],'attributes':_0x25a659[_0xf450('0xd')],'include':_0x25a659['include']?_[_0xf450('0x10')](_0x25a659['include'],function(_0x2d67b8){return{'model':db[_0x2d67b8[_0xf450('0x11')]],'as':_0x2d67b8['as'],'attributes':_0x2d67b8[_0xf450('0xd')],'include':_0x2d67b8[_0xf450('0xf')]?_[_0xf450('0x10')](_0x2d67b8[_0xf450('0xf')],function(_0x4360b5){return{'model':db[_0x4360b5['model']],'as':_0x4360b5['as'],'attributes':_0x4360b5[_0xf450('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x395670){logger['info'](_0xf450('0x19'),_0x93810f);logger[_0xf450('0x14')](_0xf450('0x19'),_0x93810f,JSON[_0xf450('0x15')](_0x395670));_0x52b2ba(_0x395670);})[_0xf450('0x16')](function(_0x523ace){logger[_0xf450('0x17')](_0xf450('0x19'),_0x523ace[_0xf450('0x18')],_0x93810f);_0x2a5c27(_0x58b8bf[_0xf450('0x17')](0x1f4,_0x523ace[_0xf450('0x18')]));});});};exports['CreateCmHopper']=function(_0x37041f){var _0x44936b=this;return new Promise(function(_0x3e094d,_0x39d1eb){return db[_0xf450('0x8')]['create'](_0x37041f['body'],{'raw':_0x37041f[_0xf450('0xa')]?_0x37041f[_0xf450('0xa')][_0xf450('0xb')]===undefined?!![]:![]:!![]})['then'](function(_0x39a0fd){logger[_0xf450('0x13')](_0xf450('0x1b'),_0x37041f);logger[_0xf450('0x14')](_0xf450('0x1b'),_0x37041f,JSON[_0xf450('0x15')](_0x39a0fd));_0x3e094d(_0x39a0fd);})[_0xf450('0x16')](function(_0x25d45a){logger[_0xf450('0x17')](_0xf450('0x1b'),_0x25d45a[_0xf450('0x18')],_0x37041f);_0x39d1eb(_0x44936b['error'](0x1f4,_0x25d45a[_0xf450('0x18')]));});});};exports[_0xf450('0x1c')]=function(_0x34eedb){var _0x2e5455=this;return new Promise(function(_0x12b850,_0x450552){return db[_0xf450('0x8')][_0xf450('0x1d')](_0x34eedb['body'],{'raw':_0x34eedb[_0xf450('0xa')]?_0x34eedb['options'][_0xf450('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34eedb[_0xf450('0xa')]?_0x34eedb[_0xf450('0xa')][_0xf450('0xc')]||null:null,'attributes':_0x34eedb['options']?_0x34eedb[_0xf450('0xa')][_0xf450('0xd')]||null:null,'limit':_0x34eedb[_0xf450('0xa')]?_0x34eedb[_0xf450('0xa')][_0xf450('0xe')]||null:null})[_0xf450('0x12')](function(_0xdbb33){logger[_0xf450('0x13')](_0xf450('0x1c'),_0x34eedb);logger['info'](_0xf450('0x1e'),JSON[_0xf450('0x15')](_0x34eedb[_0xf450('0xa')]['where']),_0x34eedb[_0xf450('0x1f')][_0xf450('0x20')]);logger[_0xf450('0x14')](_0xf450('0x1c'),_0x34eedb,JSON[_0xf450('0x15')](_0xdbb33));_0x12b850(_0xdbb33);})['catch'](function(_0x619dc){logger[_0xf450('0x17')](_0xf450('0x1c'),_0x619dc[_0xf450('0x18')],_0x34eedb);_0x450552(_0x2e5455[_0xf450('0x17')](0x1f4,_0x619dc['message']));});});};exports['DestroyCmHopper']=function(_0x1f3b4c){var _0x479225=this;return new Promise(function(_0xe246a9,_0x44c41e){return db['CmHopper'][_0xf450('0x21')]({'where':_0x1f3b4c[_0xf450('0xa')]?_0x1f3b4c[_0xf450('0xa')][_0xf450('0xc')]||null:null})['then'](function(_0x34648c){logger['info'](_0xf450('0x22'),_0x1f3b4c);logger[_0xf450('0x14')]('DestroyCmHopper',_0x1f3b4c,JSON['stringify'](_0x34648c));_0xe246a9(_0x34648c);})['catch'](function(_0x4a5819){logger['error'](_0xf450('0x22'),_0x4a5819[_0xf450('0x18')],_0x1f3b4c);_0x44c41e(_0x479225['error'](0x1f4,_0x4a5819['message']));});});};exports[_0xf450('0x23')]=function(_0x4546d3){var _0x356541=this;return new Promise(function(_0xcae46f,_0x79cb26){return db[_0xf450('0x24')][_0xf450('0x25')]()[_0xf450('0x12')](function(_0x5c1b64){return db[_0xf450('0x26')][_0xf450('0x27')](function(_0x5cf4df){return db[_0xf450('0x8')][_0xf450('0x9')]({'where':_0x4546d3['options']?_0x4546d3[_0xf450('0xa')][_0xf450('0xc')]||null:null,'attributes':_0x4546d3['options']?_0x4546d3['options'][_0xf450('0xd')]||null:null,'limit':_0x4546d3[_0xf450('0xa')]?_0x4546d3[_0xf450('0xa')][_0xf450('0xe')]||null:null,'order':_0x4546d3[_0xf450('0xa')]?_0x4546d3[_0xf450('0xa')][_0xf450('0x28')]||null:null,'transaction':_0x5cf4df,'lock':_0x5cf4df[_0xf450('0x29')][_0xf450('0x2a')],'include':[{'model':db[_0xf450('0x24')],'as':_0xf450('0x2b'),'attributes':_[_0xf450('0x2c')](_0x5c1b64)},{'model':db['User'],'as':_0xf450('0x2d'),'attributes':['id',_0xf450('0x2e'),_0xf450('0x2f')]}]})['then'](function(_0x5f1993){var _0x17466b=[];var _0x1e86d8=[];for(var _0x5ad0fd=0x0;_0x5ad0fd<_0x5f1993[_0xf450('0x30')];_0x5ad0fd+=0x1){var _0x581da0=_0x5f1993[_0x5ad0fd][_0xf450('0x31')];if(_0x581da0===null){_0x17466b['push'](_0x5f1993[_0x5ad0fd]['update'](_0x4546d3[_0xf450('0x1f')],{'transaction':_0x5cf4df}));}else if(!_0x1e86d8[_0xf450('0x32')](_0x581da0)){_0x1e86d8[_0xf450('0x33')](_0x581da0);_0x17466b[_0xf450('0x33')](_0x5f1993[_0x5ad0fd][_0xf450('0x1d')](_0x4546d3[_0xf450('0x1f')],{'transaction':_0x5cf4df}));}}return BPromise[_0xf450('0x34')](_0x17466b);});})[_0xf450('0x12')](function(_0x1f63b0){logger['info'](_0xf450('0x23'),_0x4546d3);if(_0x1f63b0[_0xf450('0x30')]>0x0){logger[_0xf450('0x13')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x1f63b0[0x0][_0xf450('0x35')]['id'],_0x1f63b0[0x0][_0xf450('0x35')][_0xf450('0x36')],_0x1f63b0[0x0][_0xf450('0x35')][_0xf450('0x20')]);}logger[_0xf450('0x14')](_0xf450('0x23'),_0x4546d3,JSON[_0xf450('0x15')](_0x1f63b0));_0xcae46f(_0x1f63b0);})[_0xf450('0x16')](function(_0x1feaca){logger[_0xf450('0x17')](_0xf450('0x23'),_0x1feaca[_0xf450('0x18')],_0x4546d3);_0x79cb26(_0x356541['error'](0x1f4,_0x1feaca[_0xf450('0x18')]));});});});};exports[_0xf450('0x37')]=function(_0x47feeb){var _0x264648=this;return new Promise(function(_0x11fa08,_0x1cb128){return db[_0xf450('0x26')][_0xf450('0x27')](function(_0x290a75){return db[_0xf450('0x38')][_0xf450('0x39')](_0x47feeb[_0xf450('0x1f')],{'raw':_0x47feeb[_0xf450('0xa')]?_0x47feeb[_0xf450('0xa')][_0xf450('0xb')]===undefined?!![]:![]:!![],'transaction':_0x290a75})['then'](function(){logger[_0xf450('0x13')](_0xf450('0x3a'),JSON[_0xf450('0x15')](_0x47feeb[_0xf450('0xa')]['where']),_0x47feeb['options'][_0xf450('0xc')][_0xf450('0x20')]);return db[_0xf450('0x8')][_0xf450('0x21')]({'where':_0x47feeb[_0xf450('0xa')]?_0x47feeb['options']['where']||null:null,'transaction':_0x290a75});});})['then'](function(_0x2fccbf){logger['info'](_0xf450('0x37'),_0x47feeb);logger[_0xf450('0x14')](_0xf450('0x37'),_0x47feeb,JSON[_0xf450('0x15')](_0x2fccbf));_0x11fa08(_0x2fccbf);})[_0xf450('0x16')](function(_0x3cc40a){logger[_0xf450('0x17')](_0xf450('0x37'),_0x3cc40a[_0xf450('0x18')],_0x47feeb);_0x1cb128(_0x264648['error'](0x1f4,_0x3cc40a[_0xf450('0x18')]));});});};exports[_0xf450('0x3b')]=function(_0x28312f){var _0x1ae676=this;return new Promise(function(_0x1720b7,_0x25ccec){return db[_0xf450('0x8')]['findAll']({'raw':_0x28312f[_0xf450('0xa')]?_0x28312f[_0xf450('0xa')][_0xf450('0xb')]===undefined?!![]:![]:!![],'where':_0x28312f[_0xf450('0xa')]?_0x28312f[_0xf450('0xa')]['where']||null:null,'attributes':[[db[_0xf450('0x26')]['fn'](_0xf450('0x3c'),db['sequelize']['fn']('IF',db[_0xf450('0x26')][_0xf450('0x3d')]('`scheduledat`\x20>=\x20'+util[_0xf450('0x3e')](_0xf450('0x3f'),moment()[_0xf450('0x3e')](_0xf450('0x40')))+_0xf450('0x41')))),_0xf450('0x42')]]})['then'](function(_0x4067b1){logger[_0xf450('0x13')](_0xf450('0x3b'),_0x28312f);logger[_0xf450('0x14')](_0xf450('0x3b'),_0x28312f,JSON['stringify'](_0x4067b1));_0x1720b7(_0x4067b1);})[_0xf450('0x16')](function(_0x39ae39){logger[_0xf450('0x17')](_0xf450('0x3b'),_0x39ae39[_0xf450('0x18')],_0x28312f);_0x25ccec(_0x1ae676[_0xf450('0x17')](0x1f4,_0x39ae39['message']));});});};exports[_0xf450('0x43')]=function(_0x20e520){var _0x3eeac6=this;return new Promise(function(_0x4c9908,_0x50c92c){return db[_0xf450('0x24')][_0xf450('0x25')]()[_0xf450('0x12')](function(){return db[_0xf450('0x26')]['transaction'](function(_0x3040bc){return db['CmHopper'][_0xf450('0x9')]({'where':_0x20e520[_0xf450('0xa')]?_0x20e520[_0xf450('0xa')][_0xf450('0xc')]||null:null,'attributes':_0x20e520['options']?_0x20e520['options'][_0xf450('0xd')]||null:null,'limit':0x1,'order':_0x20e520[_0xf450('0xa')]?_0x20e520[_0xf450('0xa')]['order']||null:null,'group':db[_0xf450('0x8')]['UserId'],'transaction':_0x3040bc,'lock':_0x3040bc[_0xf450('0x29')][_0xf450('0x2a')],'include':_0x20e520[_0xf450('0xa')]?_0x20e520[_0xf450('0xa')][_0xf450('0xf')]?_['map'](_0x20e520[_0xf450('0xa')][_0xf450('0xf')],function(_0x32fc36){return{'model':db[_0x32fc36[_0xf450('0x11')]],'as':_0x32fc36['as'],'attributes':_0x32fc36[_0xf450('0xd')],'include':_0x32fc36['include']?_[_0xf450('0x10')](_0x32fc36[_0xf450('0xf')],function(_0x2b4c99){return{'model':db[_0x2b4c99['model']],'as':_0x2b4c99['as'],'attributes':_0x2b4c99['attributes'],'include':_0x2b4c99[_0xf450('0xf')]?_[_0xf450('0x10')](_0x2b4c99[_0xf450('0xf')],function(_0x559745){return{'model':db[_0x559745[_0xf450('0x11')]],'as':_0x559745['as'],'attributes':_0x559745[_0xf450('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf450('0x12')](function(_0x4bf7d3){var _0x3761b7=[];for(var _0x29cbd2=0x0;_0x29cbd2<_0x4bf7d3[_0xf450('0x30')];_0x29cbd2+=0x1){_0x3761b7[_0xf450('0x33')](_0x4bf7d3[_0x29cbd2][_0xf450('0x1d')](_0x20e520[_0xf450('0x1f')],{'transaction':_0x3040bc}));}return BPromise['all'](_0x3761b7);});})[_0xf450('0x12')](function(_0x104154){logger[_0xf450('0x13')](_0xf450('0x43'),_0x20e520);logger[_0xf450('0x14')]('GetContactRecallMe',_0x20e520,JSON[_0xf450('0x15')](_0x104154));_0x4c9908(_0x104154);})[_0xf450('0x16')](function(_0x1ca55f){logger[_0xf450('0x17')]('GetContactRecallMe',_0x1ca55f['message'],_0x20e520);_0x50c92c(_0x3eeac6[_0xf450('0x17')](0x1f4,_0x1ca55f[_0xf450('0x18')]));});});});};exports[_0xf450('0x44')]=function(_0x36f04c){var _0x5b2907=this;return new Promise(function(_0x18b7cd,_0x39a36d){db[_0xf450('0x24')][_0xf450('0x25')]()[_0xf450('0x12')](function(_0x1d8b42){return db[_0xf450('0x8')][_0xf450('0x9')]({'raw':_0x36f04c[_0xf450('0xa')]?_0x36f04c[_0xf450('0xa')][_0xf450('0xb')]===undefined?!![]:![]:!![],'where':_0x36f04c['options']?_0x36f04c[_0xf450('0xa')][_0xf450('0xc')]||null:null,'attributes':_0x36f04c[_0xf450('0xa')]?_0x36f04c[_0xf450('0xa')][_0xf450('0xd')]||null:null,'limit':_0x36f04c['options']?_0x36f04c[_0xf450('0xa')][_0xf450('0xe')]||null:null,'include':_0x36f04c[_0xf450('0xa')]?_0x36f04c[_0xf450('0xa')][_0xf450('0xf')]?_[_0xf450('0x10')](_0x36f04c[_0xf450('0xa')][_0xf450('0xf')],function(_0x3e277f){return{'model':db[_0x3e277f[_0xf450('0x11')]],'as':_0x3e277f['as'],'attributes':_0x3e277f['as']==='Contact'?_[_0xf450('0x2c')](_0x1d8b42):_0x3e277f['attributes'],'include':_0x3e277f[_0xf450('0xf')]?_['map'](_0x3e277f[_0xf450('0xf')],function(_0x1742ab){return{'model':db[_0x1742ab['model']],'as':_0x1742ab['as'],'attributes':_0x1742ab['attributes'],'include':_0x1742ab[_0xf450('0xf')]?_[_0xf450('0x10')](_0x1742ab[_0xf450('0xf')],function(_0xb707d8){return{'model':db[_0xb707d8[_0xf450('0x11')]],'as':_0xb707d8['as'],'attributes':_0xb707d8[_0xf450('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf450('0x12')](function(_0x1a583a){logger[_0xf450('0x13')]('GetCmHopper',_0x36f04c);logger[_0xf450('0x14')]('GetCmHopper',_0x36f04c,JSON[_0xf450('0x15')](_0x1a583a));_0x18b7cd(_0x1a583a);})[_0xf450('0x16')](function(_0x159b26){logger[_0xf450('0x17')](_0xf450('0x7'),_0x159b26[_0xf450('0x18')],_0x36f04c);_0x39a36d(_0x5b2907[_0xf450('0x17')](0x1f4,_0x159b26[_0xf450('0x18')]));});});});};exports[_0xf450('0x45')]=function(_0x4c67a8){var _0x13c5e6=this;return new Promise(function(_0x3f6727,_0x2109c6){return db[_0xf450('0x24')][_0xf450('0x46')]({'raw':!![],'where':{'phone':_0x4c67a8['options']['where'][_0xf450('0x47')]},'attributes':['id',_0xf450('0x48')],'order':[['id',_0xf450('0x49')]]})[_0xf450('0x12')](function(_0x37923b){logger[_0xf450('0x13')](_0xf450('0x4a'),_0x4c67a8);logger[_0xf450('0x14')](_0xf450('0x4a'),_0x4c67a8,JSON['stringify'](_0x37923b));_0x3f6727(_0x37923b);})[_0xf450('0x16')](function(_0x562b6c){logger[_0xf450('0x17')]('getContactByPhone',_0x562b6c[_0xf450('0x18')],_0x4c67a8);_0x2109c6(_0x13c5e6['error'](0x1f4,_0x562b6c[_0xf450('0x18')]));});});};exports['ResetActiveCalls']=function(_0x427fe7){var _0xa1f1f5=this;return new Promise(function(_0x464b1b,_0x2d56b4){return db[_0xf450('0x26')][_0xf450('0x27')](function(_0xcb5952){var _0x4f8265=_0x427fe7['options']&&_0x427fe7[_0xf450('0xa')]['where']?_0x427fe7[_0xf450('0xa')][_0xf450('0xc')]:{};return db[_0xf450('0x8')][_0xf450('0x1d')](_0x427fe7[_0xf450('0x1f')],{'where':_0x4f8265,'transaction':_0xcb5952})[_0xf450('0x12')](function(_0x11b763){logger[_0xf450('0x13')](_0xf450('0x4b'),_0x427fe7);logger[_0xf450('0x14')](_0xf450('0x4b'),_0x427fe7,JSON[_0xf450('0x15')](_0x11b763));_0x464b1b(_0x11b763);})[_0xf450('0x16')](function(_0x4b29d7){logger[_0xf450('0x17')](_0xf450('0x4b'),_0x4b29d7[_0xf450('0x18')],_0x427fe7);_0x2d56b4(_0xa1f1f5[_0xf450('0x17')](0x1f4,_0x4b29d7[_0xf450('0x18')]));});});});};exports[_0xf450('0x4c')]=function(_0x28f7b3){var _0x51df0c=this;var _0x2a2dec=_0x28f7b3[_0xf450('0x1f')]['where'][_0xf450('0x4d')];var _0x1491f0=_0x28f7b3['body'][_0xf450('0xc')][_0xf450('0x4e')];var _0x178615=_0x28f7b3[_0xf450('0x1f')][_0xf450('0xc')][_0xf450('0x4f')];return new Promise(function(_0x55d1bc,_0x13c067){return db[_0xf450('0x8')]['findAll']({'where':{'voiceQueueId':{'$in':_0x2a2dec},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xf450('0x26')][_0xf450('0x3d')](_0xf450('0x50')+_0x1491f0+_0xf450('0x51')),'$gt':db[_0xf450('0x26')][_0xf450('0x3d')](_0xf450('0x52'))}},'UserId':{'$in':_0x178615}},'include':[{'model':db[_0xf450('0x24')],'as':_0xf450('0x2b')},{'model':db['User'],'as':'Agent','attributes':['id','name','voicePause']},{'model':db[_0xf450('0x53')],'as':_0xf450('0x54')}]})[_0xf450('0x12')](function(_0x1f93b3){if(_0x1f93b3[_0xf450('0x30')]>0x0){return db[_0xf450('0x26')][_0xf450('0x27')](function(_0xc08885){return db['CmHopper'][_0xf450('0x1d')]({'recallmeNotifiedDate':db[_0xf450('0x26')][_0xf450('0x3d')](_0xf450('0x52'))},{'where':{'id':{'$in':_['map'](_0x1f93b3,'id')}},'transaction':_0xc08885})[_0xf450('0x12')](function(){_0x55d1bc(_0x1f93b3);})[_0xf450('0x16')](function(_0x5f2e1c){logger[_0xf450('0x17')](_0xf450('0x4c'),_0x5f2e1c[_0xf450('0x18')],_0x28f7b3);_0x13c067(_0x51df0c[_0xf450('0x17')](0x1f4,_0x5f2e1c['message']));});})[_0xf450('0x16')](function(_0x3cf4a6){logger[_0xf450('0x17')](_0xf450('0x4c'),_0x3cf4a6[_0xf450('0x18')],_0x28f7b3);_0x13c067(_0x51df0c['error'](0x1f4,_0x3cf4a6[_0xf450('0x18')]));});}else{_0x55d1bc(_0x1f93b3);}});});}; \ No newline at end of file +var _0xe0e2=['length','UserId','push','all','dataValues','ContactId','transaction','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','GetCmHopperPreview','describe','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','util','moment','../../mysqldb','CmHopper','findAll','options','where','attributes','limit','map','include','model','info','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','find','raw','then','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','order','UPDATE','Contact','keys','User','Agent','name','voicePause'];(function(_0x273ac0,_0x18bf58){var _0x2beaee=function(_0x368817){while(--_0x368817){_0x273ac0['push'](_0x273ac0['shift']());}};_0x2beaee(++_0x18bf58);}(_0xe0e2,0x197));var _0x2e0e=function(_0x198885,_0x2f71b6){_0x198885=_0x198885-0x0;var _0x3b0ca0=_0xe0e2[_0x198885];return _0x3b0ca0;};'use strict';var _=require('lodash');var util=require(_0x2e0e('0x0'));var moment=require(_0x2e0e('0x1'));var BPromise=require('bluebird');var db=require(_0x2e0e('0x2'))['db'];var logger=require('../../config/logger')('rpc');exports['GetCmHopper']=function(_0x103ccf){var _0x51c356=this;return new Promise(function(_0x2bbaff,_0x145add){return db[_0x2e0e('0x3')][_0x2e0e('0x4')]({'raw':_0x103ccf[_0x2e0e('0x5')]?_0x103ccf[_0x2e0e('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x103ccf[_0x2e0e('0x5')]?_0x103ccf['options'][_0x2e0e('0x6')]||null:null,'attributes':_0x103ccf[_0x2e0e('0x5')]?_0x103ccf[_0x2e0e('0x5')][_0x2e0e('0x7')]||null:null,'limit':_0x103ccf['options']?_0x103ccf[_0x2e0e('0x5')][_0x2e0e('0x8')]||null:null,'include':_0x103ccf[_0x2e0e('0x5')]?_0x103ccf[_0x2e0e('0x5')]['include']?_[_0x2e0e('0x9')](_0x103ccf[_0x2e0e('0x5')][_0x2e0e('0xa')],function(_0x35bc92){return{'model':db[_0x35bc92[_0x2e0e('0xb')]],'as':_0x35bc92['as'],'attributes':_0x35bc92[_0x2e0e('0x7')],'include':_0x35bc92[_0x2e0e('0xa')]?_['map'](_0x35bc92[_0x2e0e('0xa')],function(_0x56095d){return{'model':db[_0x56095d[_0x2e0e('0xb')]],'as':_0x56095d['as'],'attributes':_0x56095d['attributes'],'include':_0x56095d[_0x2e0e('0xa')]?_[_0x2e0e('0x9')](_0x56095d[_0x2e0e('0xa')],function(_0x1af0fa){return{'model':db[_0x1af0fa['model']],'as':_0x1af0fa['as'],'attributes':_0x1af0fa[_0x2e0e('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd37d){logger[_0x2e0e('0xc')](_0x2e0e('0xd'),_0x103ccf);logger[_0x2e0e('0xe')]('GetCmHopper',_0x103ccf,JSON[_0x2e0e('0xf')](_0x5cd37d));_0x2bbaff(_0x5cd37d);})[_0x2e0e('0x10')](function(_0x48b0f2){logger[_0x2e0e('0x11')](_0x2e0e('0xd'),_0x48b0f2['message'],_0x103ccf);_0x145add(_0x51c356[_0x2e0e('0x11')](0x1f4,_0x48b0f2[_0x2e0e('0x12')]));});});};exports[_0x2e0e('0x13')]=function(_0x4be9dc){var _0x257e2e=this;return new Promise(function(_0x340788,_0x5e2c8c){return db['CmHopper'][_0x2e0e('0x14')]({'raw':_0x4be9dc[_0x2e0e('0x5')]?_0x4be9dc[_0x2e0e('0x5')][_0x2e0e('0x15')]===undefined?!![]:![]:!![],'where':_0x4be9dc[_0x2e0e('0x5')]?_0x4be9dc[_0x2e0e('0x5')][_0x2e0e('0x6')]||null:null,'attributes':_0x4be9dc['options']?_0x4be9dc[_0x2e0e('0x5')]['attributes']||null:null,'include':_0x4be9dc['options']?_0x4be9dc[_0x2e0e('0x5')][_0x2e0e('0xa')]?_[_0x2e0e('0x9')](_0x4be9dc['options'][_0x2e0e('0xa')],function(_0x1a800f){return{'model':db[_0x1a800f[_0x2e0e('0xb')]],'as':_0x1a800f['as'],'attributes':_0x1a800f[_0x2e0e('0x7')],'include':_0x1a800f[_0x2e0e('0xa')]?_['map'](_0x1a800f[_0x2e0e('0xa')],function(_0x53b95a){return{'model':db[_0x53b95a[_0x2e0e('0xb')]],'as':_0x53b95a['as'],'attributes':_0x53b95a[_0x2e0e('0x7')],'include':_0x53b95a[_0x2e0e('0xa')]?_[_0x2e0e('0x9')](_0x53b95a[_0x2e0e('0xa')],function(_0x22faff){return{'model':db[_0x22faff[_0x2e0e('0xb')]],'as':_0x22faff['as'],'attributes':_0x22faff[_0x2e0e('0x7')]};}):[]};}):[]};}):[]:[]})[_0x2e0e('0x16')](function(_0x1a8c48){logger[_0x2e0e('0xc')]('ShowCmHopper',_0x4be9dc);logger[_0x2e0e('0xe')]('ShowCmHopper',_0x4be9dc,JSON[_0x2e0e('0xf')](_0x1a8c48));_0x340788(_0x1a8c48);})[_0x2e0e('0x10')](function(_0x32af75){logger[_0x2e0e('0x11')](_0x2e0e('0x13'),_0x32af75['message'],_0x4be9dc);_0x5e2c8c(_0x257e2e['error'](0x1f4,_0x32af75[_0x2e0e('0x12')]));});});};exports[_0x2e0e('0x17')]=function(_0x14973b){var _0x22a5ca=this;return new Promise(function(_0x59ebb2,_0x5059f0){return db[_0x2e0e('0x3')][_0x2e0e('0x18')](_0x14973b['body'],{'raw':_0x14973b['options']?_0x14973b[_0x2e0e('0x5')][_0x2e0e('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x3dd712){logger[_0x2e0e('0xc')](_0x2e0e('0x17'),_0x14973b);logger[_0x2e0e('0xe')]('CreateCmHopper',_0x14973b,JSON['stringify'](_0x3dd712));_0x59ebb2(_0x3dd712);})[_0x2e0e('0x10')](function(_0x57d973){logger['error'](_0x2e0e('0x17'),_0x57d973[_0x2e0e('0x12')],_0x14973b);_0x5059f0(_0x22a5ca[_0x2e0e('0x11')](0x1f4,_0x57d973['message']));});});};exports[_0x2e0e('0x19')]=function(_0x55b34f){var _0x3fc687=this;return new Promise(function(_0x181484,_0x56aed3){return db['CmHopper'][_0x2e0e('0x1a')](_0x55b34f[_0x2e0e('0x1b')],{'raw':_0x55b34f['options']?_0x55b34f[_0x2e0e('0x5')][_0x2e0e('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55b34f[_0x2e0e('0x5')]?_0x55b34f['options']['where']||null:null,'attributes':_0x55b34f[_0x2e0e('0x5')]?_0x55b34f[_0x2e0e('0x5')][_0x2e0e('0x7')]||null:null,'limit':_0x55b34f[_0x2e0e('0x5')]?_0x55b34f['options'][_0x2e0e('0x8')]||null:null})[_0x2e0e('0x16')](function(_0x1e110c){logger[_0x2e0e('0xc')]('UpdateCmHopper',_0x55b34f);logger[_0x2e0e('0xc')](_0x2e0e('0x1c'),JSON[_0x2e0e('0xf')](_0x55b34f['options']['where']),_0x55b34f[_0x2e0e('0x1b')][_0x2e0e('0x1d')]);logger[_0x2e0e('0xe')](_0x2e0e('0x19'),_0x55b34f,JSON[_0x2e0e('0xf')](_0x1e110c));_0x181484(_0x1e110c);})[_0x2e0e('0x10')](function(_0x2bafa6){logger[_0x2e0e('0x11')](_0x2e0e('0x19'),_0x2bafa6[_0x2e0e('0x12')],_0x55b34f);_0x56aed3(_0x3fc687[_0x2e0e('0x11')](0x1f4,_0x2bafa6['message']));});});};exports[_0x2e0e('0x1e')]=function(_0x1a1a3d){var _0x17b4c3=this;return new Promise(function(_0x58ca64,_0x15265b){return db['CmHopper'][_0x2e0e('0x1f')]({'where':_0x1a1a3d[_0x2e0e('0x5')]?_0x1a1a3d['options'][_0x2e0e('0x6')]||null:null})[_0x2e0e('0x16')](function(_0x4827e6){logger[_0x2e0e('0xc')](_0x2e0e('0x1e'),_0x1a1a3d);logger[_0x2e0e('0xe')](_0x2e0e('0x1e'),_0x1a1a3d,JSON[_0x2e0e('0xf')](_0x4827e6));_0x58ca64(_0x4827e6);})[_0x2e0e('0x10')](function(_0x3a2472){logger[_0x2e0e('0x11')](_0x2e0e('0x1e'),_0x3a2472[_0x2e0e('0x12')],_0x1a1a3d);_0x15265b(_0x17b4c3['error'](0x1f4,_0x3a2472['message']));});});};exports[_0x2e0e('0x20')]=function(_0x23d259){var _0xb37d84=this;return new Promise(function(_0x2b89e6,_0x2aa2a3){return db[_0x2e0e('0x21')]['describe']()[_0x2e0e('0x16')](function(_0x24acda){return db[_0x2e0e('0x22')]['transaction'](function(_0x2a8e39){return db[_0x2e0e('0x3')][_0x2e0e('0x4')]({'where':_0x23d259[_0x2e0e('0x5')]?_0x23d259['options'][_0x2e0e('0x6')]||null:null,'attributes':_0x23d259[_0x2e0e('0x5')]?_0x23d259['options']['attributes']||null:null,'limit':_0x23d259['options']?_0x23d259[_0x2e0e('0x5')][_0x2e0e('0x8')]||null:null,'order':_0x23d259['options']?_0x23d259[_0x2e0e('0x5')][_0x2e0e('0x23')]||null:null,'transaction':_0x2a8e39,'lock':_0x2a8e39['LOCK'][_0x2e0e('0x24')],'include':[{'model':db[_0x2e0e('0x21')],'as':_0x2e0e('0x25'),'attributes':_[_0x2e0e('0x26')](_0x24acda)},{'model':db[_0x2e0e('0x27')],'as':_0x2e0e('0x28'),'attributes':['id',_0x2e0e('0x29'),_0x2e0e('0x2a')]}]})[_0x2e0e('0x16')](function(_0x366365){var _0xeddc05=[];var _0x2ce450=[];for(var _0x1f7b00=0x0;_0x1f7b00<_0x366365[_0x2e0e('0x2b')];_0x1f7b00+=0x1){var _0x328aac=_0x366365[_0x1f7b00][_0x2e0e('0x2c')];if(_0x328aac===null){_0xeddc05[_0x2e0e('0x2d')](_0x366365[_0x1f7b00][_0x2e0e('0x1a')](_0x23d259[_0x2e0e('0x1b')],{'transaction':_0x2a8e39}));}else if(!_0x2ce450['includes'](_0x328aac)){_0x2ce450['push'](_0x328aac);_0xeddc05[_0x2e0e('0x2d')](_0x366365[_0x1f7b00]['update'](_0x23d259[_0x2e0e('0x1b')],{'transaction':_0x2a8e39}));}}return BPromise[_0x2e0e('0x2e')](_0xeddc05);});})[_0x2e0e('0x16')](function(_0x530045){logger[_0x2e0e('0xc')](_0x2e0e('0x20'),_0x23d259);if(_0x530045['length']>0x0){logger[_0x2e0e('0xc')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x530045[0x0][_0x2e0e('0x2f')]['id'],_0x530045[0x0]['dataValues'][_0x2e0e('0x30')],_0x530045[0x0]['dataValues'][_0x2e0e('0x1d')]);}logger[_0x2e0e('0xe')]('GetContactDialer',_0x23d259,JSON[_0x2e0e('0xf')](_0x530045));_0x2b89e6(_0x530045);})[_0x2e0e('0x10')](function(_0x29af3a){logger[_0x2e0e('0x11')](_0x2e0e('0x20'),_0x29af3a[_0x2e0e('0x12')],_0x23d259);_0x2aa2a3(_0xb37d84['error'](0x1f4,_0x29af3a[_0x2e0e('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x1e83d6){var _0x36c1c9=this;return new Promise(function(_0x43a71b,_0x39c842){return db[_0x2e0e('0x22')][_0x2e0e('0x31')](function(_0x457fe8){return db[_0x2e0e('0x32')]['create'](_0x1e83d6[_0x2e0e('0x1b')],{'raw':_0x1e83d6[_0x2e0e('0x5')]?_0x1e83d6['options'][_0x2e0e('0x15')]===undefined?!![]:![]:!![],'transaction':_0x457fe8})[_0x2e0e('0x16')](function(){logger[_0x2e0e('0xc')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x1e83d6[_0x2e0e('0x5')][_0x2e0e('0x6')]),_0x1e83d6[_0x2e0e('0x5')][_0x2e0e('0x6')]['active']);return db['CmHopper'][_0x2e0e('0x1f')]({'where':_0x1e83d6['options']?_0x1e83d6[_0x2e0e('0x5')][_0x2e0e('0x6')]||null:null,'transaction':_0x457fe8});});})[_0x2e0e('0x16')](function(_0x427703){logger[_0x2e0e('0xc')](_0x2e0e('0x33'),_0x1e83d6);logger[_0x2e0e('0xe')](_0x2e0e('0x33'),_0x1e83d6,JSON[_0x2e0e('0xf')](_0x427703));_0x43a71b(_0x427703);})[_0x2e0e('0x10')](function(_0x3933ec){logger['error'](_0x2e0e('0x33'),_0x3933ec[_0x2e0e('0x12')],_0x1e83d6);_0x39c842(_0x36c1c9[_0x2e0e('0x11')](0x1f4,_0x3933ec[_0x2e0e('0x12')]));});});};exports[_0x2e0e('0x34')]=function(_0x24120e){var _0x58e86d=this;return new Promise(function(_0x7f59b4,_0x4c4077){return db[_0x2e0e('0x3')][_0x2e0e('0x4')]({'raw':_0x24120e[_0x2e0e('0x5')]?_0x24120e[_0x2e0e('0x5')][_0x2e0e('0x15')]===undefined?!![]:![]:!![],'where':_0x24120e[_0x2e0e('0x5')]?_0x24120e['options']['where']||null:null,'attributes':[[db[_0x2e0e('0x22')]['fn']('COUNT',db[_0x2e0e('0x22')]['fn']('IF',db[_0x2e0e('0x22')]['literal'](_0x2e0e('0x35')+util[_0x2e0e('0x36')](_0x2e0e('0x37'),moment()['format'](_0x2e0e('0x38')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x2e0e('0x16')](function(_0x3de983){logger['info'](_0x2e0e('0x34'),_0x24120e);logger[_0x2e0e('0xe')](_0x2e0e('0x34'),_0x24120e,JSON[_0x2e0e('0xf')](_0x3de983));_0x7f59b4(_0x3de983);})['catch'](function(_0x1153d3){logger[_0x2e0e('0x11')](_0x2e0e('0x34'),_0x1153d3[_0x2e0e('0x12')],_0x24120e);_0x4c4077(_0x58e86d[_0x2e0e('0x11')](0x1f4,_0x1153d3[_0x2e0e('0x12')]));});});};exports[_0x2e0e('0x39')]=function(_0x16d9a9){var _0x9eaff9=this;return new Promise(function(_0x338972,_0x26820e){return db[_0x2e0e('0x21')]['describe']()['then'](function(){return db['sequelize'][_0x2e0e('0x31')](function(_0x345970){return db['CmHopper'][_0x2e0e('0x4')]({'where':_0x16d9a9[_0x2e0e('0x5')]?_0x16d9a9[_0x2e0e('0x5')][_0x2e0e('0x6')]||null:null,'attributes':_0x16d9a9[_0x2e0e('0x5')]?_0x16d9a9[_0x2e0e('0x5')][_0x2e0e('0x7')]||null:null,'limit':0x1,'order':_0x16d9a9['options']?_0x16d9a9[_0x2e0e('0x5')]['order']||null:null,'group':db[_0x2e0e('0x3')][_0x2e0e('0x2c')],'transaction':_0x345970,'lock':_0x345970['LOCK'][_0x2e0e('0x24')],'include':_0x16d9a9[_0x2e0e('0x5')]?_0x16d9a9[_0x2e0e('0x5')]['include']?_[_0x2e0e('0x9')](_0x16d9a9[_0x2e0e('0x5')][_0x2e0e('0xa')],function(_0x432842){return{'model':db[_0x432842['model']],'as':_0x432842['as'],'attributes':_0x432842['attributes'],'include':_0x432842[_0x2e0e('0xa')]?_[_0x2e0e('0x9')](_0x432842['include'],function(_0x47bd46){return{'model':db[_0x47bd46[_0x2e0e('0xb')]],'as':_0x47bd46['as'],'attributes':_0x47bd46[_0x2e0e('0x7')],'include':_0x47bd46[_0x2e0e('0xa')]?_[_0x2e0e('0x9')](_0x47bd46[_0x2e0e('0xa')],function(_0x33797c){return{'model':db[_0x33797c[_0x2e0e('0xb')]],'as':_0x33797c['as'],'attributes':_0x33797c[_0x2e0e('0x7')]};}):[]};}):[]};}):[]:[]})[_0x2e0e('0x16')](function(_0x16a57d){var _0x1d6ca0=[];for(var _0x2f2fdd=0x0;_0x2f2fdd<_0x16a57d[_0x2e0e('0x2b')];_0x2f2fdd+=0x1){_0x1d6ca0[_0x2e0e('0x2d')](_0x16a57d[_0x2f2fdd][_0x2e0e('0x1a')](_0x16d9a9[_0x2e0e('0x1b')],{'transaction':_0x345970}));}return BPromise[_0x2e0e('0x2e')](_0x1d6ca0);});})['then'](function(_0x1b4f97){logger[_0x2e0e('0xc')](_0x2e0e('0x39'),_0x16d9a9);logger[_0x2e0e('0xe')](_0x2e0e('0x39'),_0x16d9a9,JSON['stringify'](_0x1b4f97));_0x338972(_0x1b4f97);})[_0x2e0e('0x10')](function(_0x13d313){logger[_0x2e0e('0x11')](_0x2e0e('0x39'),_0x13d313[_0x2e0e('0x12')],_0x16d9a9);_0x26820e(_0x9eaff9[_0x2e0e('0x11')](0x1f4,_0x13d313[_0x2e0e('0x12')]));});});});};exports[_0x2e0e('0x3a')]=function(_0x49330d){var _0x7f443e=this;return new Promise(function(_0x2da79a,_0x15737b){db[_0x2e0e('0x21')][_0x2e0e('0x3b')]()['then'](function(_0x1bf176){return db[_0x2e0e('0x3')][_0x2e0e('0x4')]({'raw':_0x49330d['options']?_0x49330d[_0x2e0e('0x5')][_0x2e0e('0x15')]===undefined?!![]:![]:!![],'where':_0x49330d[_0x2e0e('0x5')]?_0x49330d[_0x2e0e('0x5')][_0x2e0e('0x6')]||null:null,'attributes':_0x49330d[_0x2e0e('0x5')]?_0x49330d[_0x2e0e('0x5')][_0x2e0e('0x7')]||null:null,'limit':_0x49330d[_0x2e0e('0x5')]?_0x49330d[_0x2e0e('0x5')][_0x2e0e('0x8')]||null:null,'include':_0x49330d['options']?_0x49330d[_0x2e0e('0x5')][_0x2e0e('0xa')]?_['map'](_0x49330d[_0x2e0e('0x5')]['include'],function(_0x3a9702){return{'model':db[_0x3a9702[_0x2e0e('0xb')]],'as':_0x3a9702['as'],'attributes':_0x3a9702['as']===_0x2e0e('0x25')?_[_0x2e0e('0x26')](_0x1bf176):_0x3a9702['attributes'],'include':_0x3a9702[_0x2e0e('0xa')]?_[_0x2e0e('0x9')](_0x3a9702[_0x2e0e('0xa')],function(_0x12ba45){return{'model':db[_0x12ba45[_0x2e0e('0xb')]],'as':_0x12ba45['as'],'attributes':_0x12ba45['attributes'],'include':_0x12ba45['include']?_[_0x2e0e('0x9')](_0x12ba45[_0x2e0e('0xa')],function(_0x11e9a0){return{'model':db[_0x11e9a0[_0x2e0e('0xb')]],'as':_0x11e9a0['as'],'attributes':_0x11e9a0[_0x2e0e('0x7')]};}):[]};}):[]};}):[]:[]})[_0x2e0e('0x16')](function(_0x554f45){logger[_0x2e0e('0xc')]('GetCmHopper',_0x49330d);logger[_0x2e0e('0xe')]('GetCmHopper',_0x49330d,JSON['stringify'](_0x554f45));_0x2da79a(_0x554f45);})[_0x2e0e('0x10')](function(_0x5264de){logger['error'](_0x2e0e('0xd'),_0x5264de['message'],_0x49330d);_0x15737b(_0x7f443e[_0x2e0e('0x11')](0x1f4,_0x5264de['message']));});});});};exports[_0x2e0e('0x3c')]=function(_0x2531f1){var _0x137107=this;return new Promise(function(_0x24255b,_0x3b1343){return db[_0x2e0e('0x21')][_0x2e0e('0x3d')]({'raw':!![],'where':{'phone':_0x2531f1[_0x2e0e('0x5')]['where'][_0x2e0e('0x3e')]},'attributes':['id','dialTimezone'],'order':[['id',_0x2e0e('0x3f')]]})[_0x2e0e('0x16')](function(_0x2e9d38){logger[_0x2e0e('0xc')](_0x2e0e('0x40'),_0x2531f1);logger['debug'](_0x2e0e('0x40'),_0x2531f1,JSON[_0x2e0e('0xf')](_0x2e9d38));_0x24255b(_0x2e9d38);})['catch'](function(_0x10b140){logger[_0x2e0e('0x11')](_0x2e0e('0x40'),_0x10b140['message'],_0x2531f1);_0x3b1343(_0x137107[_0x2e0e('0x11')](0x1f4,_0x10b140[_0x2e0e('0x12')]));});});};exports[_0x2e0e('0x41')]=function(_0x16592a){var _0x16be00=this;return new Promise(function(_0x546a7b,_0x2deb67){return db[_0x2e0e('0x22')][_0x2e0e('0x31')](function(_0x5243c9){var _0x5288f1=_0x16592a[_0x2e0e('0x5')]&&_0x16592a['options'][_0x2e0e('0x6')]?_0x16592a[_0x2e0e('0x5')][_0x2e0e('0x6')]:{};return db[_0x2e0e('0x3')]['update'](_0x16592a['body'],{'where':_0x5288f1,'transaction':_0x5243c9})[_0x2e0e('0x16')](function(_0x23736c){logger[_0x2e0e('0xc')](_0x2e0e('0x41'),_0x16592a);logger['debug']('ResetActiveCalls',_0x16592a,JSON[_0x2e0e('0xf')](_0x23736c));_0x546a7b(_0x23736c);})[_0x2e0e('0x10')](function(_0x28f9e3){logger[_0x2e0e('0x11')](_0x2e0e('0x41'),_0x28f9e3['message'],_0x16592a);_0x2deb67(_0x16be00[_0x2e0e('0x11')](0x1f4,_0x28f9e3[_0x2e0e('0x12')]));});});});};exports[_0x2e0e('0x42')]=function(_0xcb2dcf){var _0x55a1f7=this;var _0x13bc37=_0xcb2dcf[_0x2e0e('0x1b')][_0x2e0e('0x6')][_0x2e0e('0x43')];var _0x542fde=_0xcb2dcf[_0x2e0e('0x1b')][_0x2e0e('0x6')][_0x2e0e('0x44')];var _0x26e84b=_0xcb2dcf[_0x2e0e('0x1b')][_0x2e0e('0x6')]['availableAgentsIds'];return new Promise(function(_0x2212fd,_0x44102f){return db[_0x2e0e('0x3')][_0x2e0e('0x4')]({'where':{'voiceQueueId':{'$in':_0x13bc37},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x2e0e('0x22')][_0x2e0e('0x45')](_0x2e0e('0x46')+_0x542fde+_0x2e0e('0x47')),'$gt':db[_0x2e0e('0x22')][_0x2e0e('0x45')]('NOW()')}},'UserId':{'$in':_0x26e84b}},'include':[{'model':db[_0x2e0e('0x21')],'as':_0x2e0e('0x25')},{'model':db[_0x2e0e('0x27')],'as':_0x2e0e('0x28'),'attributes':['id','name',_0x2e0e('0x2a')]},{'model':db[_0x2e0e('0x48')],'as':_0x2e0e('0x49')}]})[_0x2e0e('0x16')](function(_0x32c762){if(_0x32c762[_0x2e0e('0x2b')]>0x0){return db[_0x2e0e('0x22')][_0x2e0e('0x31')](function(_0x14952b){return db[_0x2e0e('0x3')][_0x2e0e('0x1a')]({'recallmeNotifiedDate':db[_0x2e0e('0x22')][_0x2e0e('0x45')](_0x2e0e('0x4a'))},{'where':{'id':{'$in':_[_0x2e0e('0x9')](_0x32c762,'id')}},'transaction':_0x14952b})['then'](function(){_0x2212fd(_0x32c762);})[_0x2e0e('0x10')](function(_0x4ce821){logger[_0x2e0e('0x11')]('CmHopperHandlePreviewRecallNotifications',_0x4ce821[_0x2e0e('0x12')],_0xcb2dcf);_0x44102f(_0x55a1f7['error'](0x1f4,_0x4ce821[_0x2e0e('0x12')]));});})[_0x2e0e('0x10')](function(_0x55f636){logger[_0x2e0e('0x11')](_0x2e0e('0x42'),_0x55f636['message'],_0xcb2dcf);_0x44102f(_0x55a1f7[_0x2e0e('0x11')](0x1f4,_0x55f636[_0x2e0e('0x12')]));});}else{_0x2212fd(_0x32c762);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index eb6fce4..22a5e45 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 _0xec30=['/:id/previewrecall','getPreviewRecall','post','create','/preview','getTimezone','put','update','delete','destroy','exports','Router','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','/timezones','/:id','show'];(function(_0x110f5e,_0x3a4d72){var _0x1c9272=function(_0x413100){while(--_0x413100){_0x110f5e['push'](_0x110f5e['shift']());}};_0x1c9272(++_0x3a4d72);}(_0xec30,0x129));var _0x0ec3=function(_0x301112,_0x352b2d){_0x301112=_0x301112-0x0;var _0x429557=_0xec30[_0x301112];return _0x429557;};'use strict';var express=require('express');var router=express[_0x0ec3('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x0ec3('0x1'));router[_0x0ec3('0x2')]('/',auth['isAuthenticated'](),controller[_0x0ec3('0x3')]);router[_0x0ec3('0x2')](_0x0ec3('0x4'),auth[_0x0ec3('0x5')](),controller[_0x0ec3('0x6')]);router[_0x0ec3('0x2')](_0x0ec3('0x7'),auth[_0x0ec3('0x5')](),controller['getOpenContacts']);router[_0x0ec3('0x2')](_0x0ec3('0x8'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x0ec3('0x2')](_0x0ec3('0x9'),auth['isAuthenticated'](),controller[_0x0ec3('0xa')]);router[_0x0ec3('0x2')](_0x0ec3('0xb'),auth['isAuthenticated'](),controller[_0x0ec3('0xc')]);router[_0x0ec3('0xd')]('/',auth[_0x0ec3('0x5')](),controller[_0x0ec3('0xe')]);router[_0x0ec3('0xd')](_0x0ec3('0xf'),auth[_0x0ec3('0x5')](),controller['getPreview']);router[_0x0ec3('0xd')]('/timezone',auth['isAuthenticated'](),controller[_0x0ec3('0x10')]);router[_0x0ec3('0x11')](_0x0ec3('0x9'),auth[_0x0ec3('0x5')](),controller[_0x0ec3('0x12')]);router[_0x0ec3('0x13')](_0x0ec3('0x9'),auth[_0x0ec3('0x5')](),controller[_0x0ec3('0x14')]);module[_0x0ec3('0x15')]=router; \ No newline at end of file +var _0x792f=['/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','post','create','/preview','getPreview','/timezone','getTimezone','update','delete','exports','express','../../components/auth/service','get','index'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x792f,0x6a));var _0xf792=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x792f[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0xf792('0x0'));var router=express['Router']();var auth=require(_0xf792('0x1'));var controller=require('./cmHopper.controller');router[_0xf792('0x2')]('/',auth['isAuthenticated'](),controller[_0xf792('0x3')]);router['get'](_0xf792('0x4'),auth[_0xf792('0x5')](),controller[_0xf792('0x6')]);router[_0xf792('0x2')](_0xf792('0x7'),auth[_0xf792('0x5')](),controller[_0xf792('0x8')]);router[_0xf792('0x2')](_0xf792('0x9'),auth[_0xf792('0x5')](),controller[_0xf792('0xa')]);router[_0xf792('0x2')](_0xf792('0xb'),auth[_0xf792('0x5')](),controller['show']);router[_0xf792('0x2')](_0xf792('0xc'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0xf792('0xd')]('/',auth['isAuthenticated'](),controller[_0xf792('0xe')]);router['post'](_0xf792('0xf'),auth[_0xf792('0x5')](),controller[_0xf792('0x10')]);router[_0xf792('0xd')](_0xf792('0x11'),auth[_0xf792('0x5')](),controller[_0xf792('0x12')]);router['put'](_0xf792('0xb'),auth[_0xf792('0x5')](),controller[_0xf792('0x13')]);router[_0xf792('0x14')]('/:id',auth[_0xf792('0x5')](),controller['destroy']);module[_0xf792('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 4ef7956..c730ef9 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1cc=['moment','INTEGER','STRING','DATE'];(function(_0x58995d,_0x5e0ab5){var _0x2d05c5=function(_0x5ef04e){while(--_0x5ef04e){_0x58995d['push'](_0x58995d['shift']());}};_0x2d05c5(++_0x5e0ab5);}(_0xc1cc,0x1d4));var _0xcc1c=function(_0x55380a,_0x536668){_0x55380a=_0x55380a-0x0;var _0x333037=_0xc1cc[_0x55380a];return _0x333037;};'use strict';var moment=require(_0xcc1c('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xcc1c('0x1')]},'phone':{'type':Sequelize[_0xcc1c('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xcc1c('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xcc1c('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcc1c('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcc1c('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcc1c('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcc1c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x61ee=['format','moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x565f63,_0x52fc7a){var _0x28a672=function(_0x11a674){while(--_0x11a674){_0x565f63['push'](_0x565f63['shift']());}};_0x28a672(++_0x52fc7a);}(_0x61ee,0x189));var _0xe61e=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x61ee[_0x16dbfd];return _0x382254;};'use strict';var moment=require(_0xe61e('0x0'));var Sequelize=require(_0xe61e('0x1'));module[_0xe61e('0x2')]={'CmHopperId':{'type':Sequelize[_0xe61e('0x3')]},'phone':{'type':Sequelize[_0xe61e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xe61e('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe61e('0x5')],'defaultValue':moment()[_0xe61e('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xe61e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe61e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe61e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe61e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe61e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe61e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 9eea72e..467b0db 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf63c=['zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x242556,_0x3ac5e7){var _0x2c7e0b=function(_0x22d240){while(--_0x22d240){_0x242556['push'](_0x242556['shift']());}};_0x2c7e0b(++_0x3ac5e7);}(_0xf63c,0x194));var _0xcf63=function(_0x2c6b14,_0x1e754a){_0x2c6b14=_0x2c6b14-0x0;var _0x19e0c3=_0xf63c[_0x2c6b14];return _0x19e0c3;};'use strict';var emlformat=require(_0xcf63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf63('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf63('0x2'));var Mustache=require(_0xcf63('0x3'));var util=require(_0xcf63('0x4'));var path=require(_0xcf63('0x5'));var sox=require(_0xcf63('0x6'));var csv=require(_0xcf63('0x7'));var ejs=require(_0xcf63('0x8'));var fs=require('fs');var fs_extra=require(_0xcf63('0x9'));var _=require(_0xcf63('0xa'));var squel=require(_0xcf63('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcf63('0xc'));var Papa=require(_0xcf63('0xd'));var Redis=require(_0xcf63('0xe'));var authService=require(_0xcf63('0xf'));var qs=require(_0xcf63('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf63('0x11'));var logger=require('../../config/logger')(_0xcf63('0x12'));var utils=require(_0xcf63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcf63('0x14'));var db=require(_0xcf63('0x15'))['db'];function respondWithStatusCode(_0x2b3783,_0x40e96c){_0x40e96c=_0x40e96c||0xcc;return function(_0x4b3938){if(_0x4b3938){return _0x2b3783[_0xcf63('0x16')](_0x40e96c);}return _0x2b3783['status'](_0x40e96c)[_0xcf63('0x17')]();};}function respondWithResult(_0x4ab95e,_0x51c2f7){_0x51c2f7=_0x51c2f7||0xc8;return function(_0x14c0c4){if(_0x14c0c4){return _0x4ab95e['status'](_0x51c2f7)[_0xcf63('0x18')](_0x14c0c4);}};}function respondWithFilteredResult(_0x40a1aa,_0x4d73a4){return function(_0x52a11e){if(_0x52a11e){var _0x2913fd=typeof _0x4d73a4[_0xcf63('0x19')]==='undefined'&&typeof _0x4d73a4[_0xcf63('0x1a')]===_0xcf63('0x1b');var _0x1e7b3c=_0x52a11e[_0xcf63('0x1c')];var _0x249488=_0x2913fd?0x0:_0x4d73a4[_0xcf63('0x19')];var _0x4b4faa=_0x2913fd?_0x52a11e['count']:_0x4d73a4[_0xcf63('0x19')]+_0x4d73a4[_0xcf63('0x1a')];var _0x1e06d1;if(_0x4b4faa>=_0x1e7b3c){_0x4b4faa=_0x1e7b3c;_0x1e06d1=0xc8;}else{_0x1e06d1=0xce;}_0x40a1aa[_0xcf63('0x1d')](_0x1e06d1);return _0x40a1aa[_0xcf63('0x1e')](_0xcf63('0x1f'),_0x249488+'-'+_0x4b4faa+'/'+_0x1e7b3c)[_0xcf63('0x18')](_0x52a11e);}return null;};}function patchUpdates(_0x11c084){return function(_0x5565f1){try{jsonpatch['apply'](_0x5565f1,_0x11c084,!![]);}catch(_0x24089d){return BPromise['reject'](_0x24089d);}return _0x5565f1[_0xcf63('0x20')]();};}function saveUpdates(_0x5396e4,_0x5385a9){return function(_0x3057d9){if(_0x3057d9){return _0x3057d9[_0xcf63('0x21')](_0x5396e4)[_0xcf63('0x22')](function(_0x359680){return _0x359680;});}return null;};}function removeEntity(_0x12bf79,_0x2c879){return function(_0x45d3f1){if(_0x45d3f1){return _0x45d3f1[_0xcf63('0x23')]()[_0xcf63('0x22')](function(){var _0x1f3682=_0x45d3f1['get']({'plain':!![]});var _0x1d3484=_0xcf63('0x24');return db[_0xcf63('0x25')]['destroy']({'where':{'type':_0x1d3484,'resourceId':_0x1f3682['id']}})[_0xcf63('0x22')](function(){return _0x45d3f1;});})['then'](function(){_0x12bf79[_0xcf63('0x1d')](0xcc)[_0xcf63('0x17')]();});}};}function handleEntityNotFound(_0x9efc50,_0x5e683f){return function(_0x3b9dcf){if(!_0x3b9dcf){_0x9efc50[_0xcf63('0x16')](0x194);}return _0x3b9dcf;};}function handleError(_0x45efbf,_0x4c03f3){_0x4c03f3=_0x4c03f3||0x1f4;return function(_0x4accf0){logger[_0xcf63('0x26')](_0x4accf0[_0xcf63('0x27')]);if(_0x4accf0['name']){delete _0x4accf0[_0xcf63('0x28')];}_0x45efbf[_0xcf63('0x1d')](_0x4c03f3)['send'](_0x4accf0);};}exports['index']=function(_0xddf9ae,_0x32e6ac){var _0x6425ff={},_0x3cb4e6={},_0x5db9c0={'count':0x0,'rows':[]};var _0x2db8c9=_[_0xcf63('0x29')](db[_0xcf63('0x2a')][_0xcf63('0x2b')],function(_0x439c88){return{'name':_0x439c88[_0xcf63('0x2c')],'type':_0x439c88[_0xcf63('0x2d')][_0xcf63('0x2e')]};});_0x3cb4e6[_0xcf63('0x2f')]=_['map'](_0x2db8c9,'name');_0x3cb4e6[_0xcf63('0x30')]=_[_0xcf63('0x31')](_0xddf9ae[_0xcf63('0x30')]);_0x3cb4e6['filters']=_[_0xcf63('0x32')](_0x3cb4e6['model'],_0x3cb4e6[_0xcf63('0x30')]);_0x6425ff[_0xcf63('0x33')]=_['intersection'](_0x3cb4e6[_0xcf63('0x2f')],qs[_0xcf63('0x34')](_0xddf9ae['query'][_0xcf63('0x34')]));_0x6425ff[_0xcf63('0x33')]=_0x6425ff[_0xcf63('0x33')]['length']?_0x6425ff['attributes']:_0x3cb4e6['model'];if(!_0xddf9ae['query'][_0xcf63('0x35')](_0xcf63('0x36'))){_0x6425ff[_0xcf63('0x1a')]=qs['limit'](_0xddf9ae['query'][_0xcf63('0x1a')]);_0x6425ff[_0xcf63('0x19')]=qs[_0xcf63('0x19')](_0xddf9ae['query'][_0xcf63('0x19')]);}_0x6425ff[_0xcf63('0x37')]=qs[_0xcf63('0x38')](_0xddf9ae[_0xcf63('0x30')][_0xcf63('0x38')]);_0x6425ff[_0xcf63('0x39')]=qs[_0xcf63('0x3a')](_['pick'](_0xddf9ae[_0xcf63('0x30')],_0x3cb4e6[_0xcf63('0x3a')]),_0x2db8c9);if(_0xddf9ae[_0xcf63('0x30')][_0xcf63('0x3b')]){_0x6425ff[_0xcf63('0x39')]=_[_0xcf63('0x3c')](_0x6425ff[_0xcf63('0x39')],{'$or':_[_0xcf63('0x29')](_0x2db8c9,function(_0x581426){if(_0x581426[_0xcf63('0x2d')]!==_0xcf63('0x3d')){var _0x2818f5={};_0x2818f5[_0x581426[_0xcf63('0x28')]]={'$like':'%'+_0xddf9ae[_0xcf63('0x30')][_0xcf63('0x3b')]+'%'};return _0x2818f5;}})});}_0x6425ff=_['merge']({},_0x6425ff,_0xddf9ae[_0xcf63('0x3e')]);var _0x345297={'where':_0x6425ff[_0xcf63('0x39')]};return db[_0xcf63('0x2a')]['count'](_0x345297)[_0xcf63('0x22')](function(_0x2a824d){_0x5db9c0[_0xcf63('0x1c')]=_0x2a824d;if(_0xddf9ae[_0xcf63('0x30')]['includeAll']){_0x6425ff[_0xcf63('0x3f')]=[{'all':!![]}];}return db[_0xcf63('0x2a')][_0xcf63('0x40')](_0x6425ff);})[_0xcf63('0x22')](function(_0x399c58){_0x5db9c0[_0xcf63('0x41')]=_0x399c58;return _0x5db9c0;})[_0xcf63('0x22')](respondWithFilteredResult(_0x32e6ac,_0x6425ff))['catch'](handleError(_0x32e6ac,null));};exports[_0xcf63('0x42')]=function(_0x34aa9b,_0x5f5bb0){var _0x5003e1={'raw':!![],'where':{'id':_0x34aa9b[_0xcf63('0x43')]['id']}},_0x2550c9={};_0x2550c9[_0xcf63('0x2f')]=_[_0xcf63('0x31')](db[_0xcf63('0x2a')][_0xcf63('0x2b')]);_0x2550c9[_0xcf63('0x30')]=_[_0xcf63('0x31')](_0x34aa9b[_0xcf63('0x30')]);_0x2550c9['filters']=_[_0xcf63('0x32')](_0x2550c9[_0xcf63('0x2f')],_0x2550c9[_0xcf63('0x30')]);_0x5003e1['attributes']=_['intersection'](_0x2550c9['model'],qs[_0xcf63('0x34')](_0x34aa9b[_0xcf63('0x30')]['fields']));_0x5003e1[_0xcf63('0x33')]=_0x5003e1[_0xcf63('0x33')][_0xcf63('0x44')]?_0x5003e1[_0xcf63('0x33')]:_0x2550c9[_0xcf63('0x2f')];if(_0x34aa9b[_0xcf63('0x30')]['includeAll']){_0x5003e1[_0xcf63('0x3f')]=[{'all':!![]}];}_0x5003e1=_['merge']({},_0x5003e1,_0x34aa9b[_0xcf63('0x3e')]);return db[_0xcf63('0x2a')][_0xcf63('0x45')](_0x5003e1)[_0xcf63('0x22')](handleEntityNotFound(_0x5f5bb0,null))['then'](respondWithResult(_0x5f5bb0,null))[_0xcf63('0x46')](handleError(_0x5f5bb0,null));};exports[_0xcf63('0x47')]=function(_0xb901e4,_0xdbc20c){return db[_0xcf63('0x2a')][_0xcf63('0x47')](_0xb901e4[_0xcf63('0x48')],{})[_0xcf63('0x22')](function(_0x2175dc){var _0x262feb=_0xb901e4[_0xcf63('0x49')][_0xcf63('0x4a')]({'plain':!![]});if(!_0x262feb)throw new Error(_0xcf63('0x4b'));if(_0x262feb[_0xcf63('0x4c')]===_0xcf63('0x49')){var _0x346746=_0x2175dc[_0xcf63('0x4a')]({'plain':!![]});var _0x4f91e5='CmHopperAdditionalPhones';return db[_0xcf63('0x4d')][_0xcf63('0x45')]({'where':{'name':_0x4f91e5,'userProfileId':_0x262feb[_0xcf63('0x4e')]},'raw':!![]})[_0xcf63('0x22')](function(_0x22ce27){if(_0x22ce27&&_0x22ce27[_0xcf63('0x4f')]===0x0){return db[_0xcf63('0x25')]['create']({'name':_0x346746[_0xcf63('0x28')],'resourceId':_0x346746['id'],'type':_0x22ce27[_0xcf63('0x28')],'sectionId':_0x22ce27['id']},{})[_0xcf63('0x22')](function(){return _0x2175dc;});}else{return _0x2175dc;}})[_0xcf63('0x46')](function(_0xfb911c){logger[_0xcf63('0x26')](_0xcf63('0x50'),_0xfb911c);throw _0xfb911c;});}return _0x2175dc;})['then'](respondWithResult(_0xdbc20c,0xc9))['catch'](handleError(_0xdbc20c,null));};exports[_0xcf63('0x21')]=function(_0x5923ee,_0x5121b7){if(_0x5923ee['body']['id']){delete _0x5923ee[_0xcf63('0x48')]['id'];}return db[_0xcf63('0x2a')][_0xcf63('0x45')]({'where':{'id':_0x5923ee[_0xcf63('0x43')]['id']}})['then'](handleEntityNotFound(_0x5121b7,null))['then'](saveUpdates(_0x5923ee[_0xcf63('0x48')],null))[_0xcf63('0x22')](respondWithResult(_0x5121b7,null))[_0xcf63('0x46')](handleError(_0x5121b7,null));};exports[_0xcf63('0x23')]=function(_0x2e6c6d,_0x2c3b07){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2e6c6d[_0xcf63('0x43')]['id']}})[_0xcf63('0x22')](handleEntityNotFound(_0x2c3b07,null))['then'](removeEntity(_0x2c3b07,null))[_0xcf63('0x46')](handleError(_0x2c3b07,null));}; \ No newline at end of file +var _0x2f7b=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x1a00b8,_0x5363fb){var _0x664a54=function(_0xaadc0c){while(--_0xaadc0c){_0x1a00b8['push'](_0x1a00b8['shift']());}};_0x664a54(++_0x5363fb);}(_0x2f7b,0xf6));var _0xb2f7=function(_0x415b55,_0x18b56c){_0x415b55=_0x415b55-0x0;var _0x223b71=_0x2f7b[_0x415b55];return _0x223b71;};'use strict';var emlformat=require(_0xb2f7('0x0'));var rimraf=require(_0xb2f7('0x1'));var zipdir=require(_0xb2f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2f7('0x3'));var moment=require(_0xb2f7('0x4'));var BPromise=require(_0xb2f7('0x5'));var Mustache=require('mustache');var util=require(_0xb2f7('0x6'));var path=require(_0xb2f7('0x7'));var sox=require(_0xb2f7('0x8'));var csv=require(_0xb2f7('0x9'));var ejs=require(_0xb2f7('0xa'));var fs=require('fs');var fs_extra=require(_0xb2f7('0xb'));var _=require(_0xb2f7('0xc'));var squel=require(_0xb2f7('0xd'));var crypto=require('crypto');var jsforce=require(_0xb2f7('0xe'));var deskjs=require(_0xb2f7('0xf'));var toCsv=require(_0xb2f7('0x9'));var querystring=require(_0xb2f7('0x10'));var Papa=require(_0xb2f7('0x11'));var Redis=require(_0xb2f7('0x12'));var authService=require(_0xb2f7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2f7('0x14'));var logger=require('../../config/logger')(_0xb2f7('0x15'));var utils=require(_0xb2f7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb2f7('0x17'));var db=require(_0xb2f7('0x18'))['db'];function respondWithStatusCode(_0x53259e,_0x5e4d98){_0x5e4d98=_0x5e4d98||0xcc;return function(_0x3f408d){if(_0x3f408d){return _0x53259e[_0xb2f7('0x19')](_0x5e4d98);}return _0x53259e['status'](_0x5e4d98)['end']();};}function respondWithResult(_0x25f351,_0x5ce191){_0x5ce191=_0x5ce191||0xc8;return function(_0x5993b6){if(_0x5993b6){return _0x25f351[_0xb2f7('0x1a')](_0x5ce191)[_0xb2f7('0x1b')](_0x5993b6);}};}function respondWithFilteredResult(_0x1da54d,_0x261362){return function(_0x3f47c6){if(_0x3f47c6){var _0x2b17da=typeof _0x261362[_0xb2f7('0x1c')]===_0xb2f7('0x1d')&&typeof _0x261362[_0xb2f7('0x1e')]===_0xb2f7('0x1d');var _0x50ee69=_0x3f47c6[_0xb2f7('0x1f')];var _0x950d9d=_0x2b17da?0x0:_0x261362[_0xb2f7('0x1c')];var _0x54b62e=_0x2b17da?_0x3f47c6[_0xb2f7('0x1f')]:_0x261362[_0xb2f7('0x1c')]+_0x261362[_0xb2f7('0x1e')];var _0x3f6843;if(_0x54b62e>=_0x50ee69){_0x54b62e=_0x50ee69;_0x3f6843=0xc8;}else{_0x3f6843=0xce;}_0x1da54d[_0xb2f7('0x1a')](_0x3f6843);return _0x1da54d[_0xb2f7('0x20')](_0xb2f7('0x21'),_0x950d9d+'-'+_0x54b62e+'/'+_0x50ee69)[_0xb2f7('0x1b')](_0x3f47c6);}return null;};}function patchUpdates(_0x675767){return function(_0x339f60){try{jsonpatch['apply'](_0x339f60,_0x675767,!![]);}catch(_0x14bef8){return BPromise[_0xb2f7('0x22')](_0x14bef8);}return _0x339f60[_0xb2f7('0x23')]();};}function saveUpdates(_0x1113f0,_0x236e56){return function(_0x169c51){if(_0x169c51){return _0x169c51[_0xb2f7('0x24')](_0x1113f0)['then'](function(_0x2fcc8b){return _0x2fcc8b;});}return null;};}function removeEntity(_0xa9c948,_0x3203c9){return function(_0xe96681){if(_0xe96681){return _0xe96681['destroy']()[_0xb2f7('0x25')](function(){var _0x3ccecf=_0xe96681[_0xb2f7('0x26')]({'plain':!![]});var _0x5609d8=_0xb2f7('0x27');return db[_0xb2f7('0x28')]['destroy']({'where':{'type':_0x5609d8,'resourceId':_0x3ccecf['id']}})[_0xb2f7('0x25')](function(){return _0xe96681;});})[_0xb2f7('0x25')](function(){_0xa9c948[_0xb2f7('0x1a')](0xcc)[_0xb2f7('0x29')]();});}};}function handleEntityNotFound(_0x2b8550,_0x178479){return function(_0x2d3777){if(!_0x2d3777){_0x2b8550[_0xb2f7('0x19')](0x194);}return _0x2d3777;};}function handleError(_0x3469c9,_0x3c6ae8){_0x3c6ae8=_0x3c6ae8||0x1f4;return function(_0x6a892e){logger[_0xb2f7('0x2a')](_0x6a892e[_0xb2f7('0x2b')]);if(_0x6a892e[_0xb2f7('0x2c')]){delete _0x6a892e[_0xb2f7('0x2c')];}_0x3469c9['status'](_0x3c6ae8)['send'](_0x6a892e);};}exports[_0xb2f7('0x2d')]=function(_0x40456b,_0x40bd6){var _0x1a4209={},_0x1007b4={},_0x4126e9={'count':0x0,'rows':[]};var _0x4c831e=_[_0xb2f7('0x2e')](db[_0xb2f7('0x2f')][_0xb2f7('0x30')],function(_0x27b9ab){return{'name':_0x27b9ab[_0xb2f7('0x31')],'type':_0x27b9ab[_0xb2f7('0x32')][_0xb2f7('0x33')]};});_0x1007b4[_0xb2f7('0x34')]=_[_0xb2f7('0x2e')](_0x4c831e,'name');_0x1007b4[_0xb2f7('0x35')]=_['keys'](_0x40456b[_0xb2f7('0x35')]);_0x1007b4['filters']=_['intersection'](_0x1007b4[_0xb2f7('0x34')],_0x1007b4[_0xb2f7('0x35')]);_0x1a4209[_0xb2f7('0x36')]=_['intersection'](_0x1007b4[_0xb2f7('0x34')],qs[_0xb2f7('0x37')](_0x40456b[_0xb2f7('0x35')][_0xb2f7('0x37')]));_0x1a4209[_0xb2f7('0x36')]=_0x1a4209[_0xb2f7('0x36')][_0xb2f7('0x38')]?_0x1a4209[_0xb2f7('0x36')]:_0x1007b4[_0xb2f7('0x34')];if(!_0x40456b[_0xb2f7('0x35')][_0xb2f7('0x39')]('nolimit')){_0x1a4209[_0xb2f7('0x1e')]=qs['limit'](_0x40456b['query'][_0xb2f7('0x1e')]);_0x1a4209[_0xb2f7('0x1c')]=qs[_0xb2f7('0x1c')](_0x40456b[_0xb2f7('0x35')]['offset']);}_0x1a4209[_0xb2f7('0x3a')]=qs['sort'](_0x40456b[_0xb2f7('0x35')][_0xb2f7('0x3b')]);_0x1a4209[_0xb2f7('0x3c')]=qs['filters'](_[_0xb2f7('0x3d')](_0x40456b['query'],_0x1007b4[_0xb2f7('0x3e')]),_0x4c831e);if(_0x40456b[_0xb2f7('0x35')][_0xb2f7('0x3f')]){_0x1a4209[_0xb2f7('0x3c')]=_[_0xb2f7('0x40')](_0x1a4209[_0xb2f7('0x3c')],{'$or':_[_0xb2f7('0x2e')](_0x4c831e,function(_0x2aa258){if(_0x2aa258[_0xb2f7('0x32')]!==_0xb2f7('0x41')){var _0x173bb1={};_0x173bb1[_0x2aa258['name']]={'$like':'%'+_0x40456b[_0xb2f7('0x35')][_0xb2f7('0x3f')]+'%'};return _0x173bb1;}})});}_0x1a4209=_[_0xb2f7('0x40')]({},_0x1a4209,_0x40456b[_0xb2f7('0x42')]);var _0x15a1e5={'where':_0x1a4209[_0xb2f7('0x3c')]};return db[_0xb2f7('0x2f')][_0xb2f7('0x1f')](_0x15a1e5)[_0xb2f7('0x25')](function(_0x4f90c0){_0x4126e9['count']=_0x4f90c0;if(_0x40456b[_0xb2f7('0x35')]['includeAll']){_0x1a4209['include']=[{'all':!![]}];}return db[_0xb2f7('0x2f')][_0xb2f7('0x43')](_0x1a4209);})[_0xb2f7('0x25')](function(_0x5c0de9){_0x4126e9[_0xb2f7('0x44')]=_0x5c0de9;return _0x4126e9;})[_0xb2f7('0x25')](respondWithFilteredResult(_0x40bd6,_0x1a4209))[_0xb2f7('0x45')](handleError(_0x40bd6,null));};exports[_0xb2f7('0x46')]=function(_0x410c68,_0x3cb188){var _0xbfae27={'raw':!![],'where':{'id':_0x410c68[_0xb2f7('0x47')]['id']}},_0x37a45d={};_0x37a45d[_0xb2f7('0x34')]=_[_0xb2f7('0x48')](db[_0xb2f7('0x2f')][_0xb2f7('0x30')]);_0x37a45d[_0xb2f7('0x35')]=_[_0xb2f7('0x48')](_0x410c68[_0xb2f7('0x35')]);_0x37a45d[_0xb2f7('0x3e')]=_[_0xb2f7('0x49')](_0x37a45d[_0xb2f7('0x34')],_0x37a45d['query']);_0xbfae27[_0xb2f7('0x36')]=_[_0xb2f7('0x49')](_0x37a45d[_0xb2f7('0x34')],qs[_0xb2f7('0x37')](_0x410c68[_0xb2f7('0x35')][_0xb2f7('0x37')]));_0xbfae27['attributes']=_0xbfae27[_0xb2f7('0x36')][_0xb2f7('0x38')]?_0xbfae27[_0xb2f7('0x36')]:_0x37a45d[_0xb2f7('0x34')];if(_0x410c68['query'][_0xb2f7('0x4a')]){_0xbfae27[_0xb2f7('0x4b')]=[{'all':!![]}];}_0xbfae27=_[_0xb2f7('0x40')]({},_0xbfae27,_0x410c68[_0xb2f7('0x42')]);return db[_0xb2f7('0x2f')][_0xb2f7('0x4c')](_0xbfae27)[_0xb2f7('0x25')](handleEntityNotFound(_0x3cb188,null))[_0xb2f7('0x25')](respondWithResult(_0x3cb188,null))[_0xb2f7('0x45')](handleError(_0x3cb188,null));};exports[_0xb2f7('0x4d')]=function(_0x3374dc,_0x3b177c){return db[_0xb2f7('0x2f')][_0xb2f7('0x4d')](_0x3374dc[_0xb2f7('0x4e')],{})[_0xb2f7('0x25')](function(_0x51ff27){var _0xdc753c=_0x3374dc['user'][_0xb2f7('0x26')]({'plain':!![]});if(!_0xdc753c)throw new Error(_0xb2f7('0x4f'));if(_0xdc753c['role']===_0xb2f7('0x50')){var _0x2a4577=_0x51ff27[_0xb2f7('0x26')]({'plain':!![]});var _0x1a6408=_0xb2f7('0x27');return db[_0xb2f7('0x51')][_0xb2f7('0x4c')]({'where':{'name':_0x1a6408,'userProfileId':_0xdc753c['userProfileId']},'raw':!![]})[_0xb2f7('0x25')](function(_0xf421c2){if(_0xf421c2&&_0xf421c2['autoAssociation']===0x0){return db[_0xb2f7('0x28')][_0xb2f7('0x4d')]({'name':_0x2a4577[_0xb2f7('0x2c')],'resourceId':_0x2a4577['id'],'type':_0xf421c2[_0xb2f7('0x2c')],'sectionId':_0xf421c2['id']},{})['then'](function(){return _0x51ff27;});}else{return _0x51ff27;}})[_0xb2f7('0x45')](function(_0x2a8e67){logger[_0xb2f7('0x2a')](_0xb2f7('0x52'),_0x2a8e67);throw _0x2a8e67;});}return _0x51ff27;})[_0xb2f7('0x25')](respondWithResult(_0x3b177c,0xc9))[_0xb2f7('0x45')](handleError(_0x3b177c,null));};exports[_0xb2f7('0x24')]=function(_0x5e5a7e,_0x38b1b8){if(_0x5e5a7e[_0xb2f7('0x4e')]['id']){delete _0x5e5a7e[_0xb2f7('0x4e')]['id'];}return db[_0xb2f7('0x2f')][_0xb2f7('0x4c')]({'where':{'id':_0x5e5a7e['params']['id']}})['then'](handleEntityNotFound(_0x38b1b8,null))[_0xb2f7('0x25')](saveUpdates(_0x5e5a7e[_0xb2f7('0x4e')],null))['then'](respondWithResult(_0x38b1b8,null))['catch'](handleError(_0x38b1b8,null));};exports['destroy']=function(_0x11993c,_0x1dda9f){return db[_0xb2f7('0x2f')]['find']({'where':{'id':_0x11993c['params']['id']}})[_0xb2f7('0x25')](handleEntityNotFound(_0x1dda9f,null))[_0xb2f7('0x25')](removeEntity(_0x1dda9f,null))[_0xb2f7('0x45')](handleError(_0x1dda9f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 4f37d7f..5f940b1 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cb5=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash'];(function(_0x96f651,_0x39d0a9){var _0x264a5f=function(_0x288e7d){while(--_0x288e7d){_0x96f651['push'](_0x96f651['shift']());}};_0x264a5f(++_0x39d0a9);}(_0x8cb5,0x19f));var _0x58cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8cb5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x58cb('0x0'));var util=require(_0x58cb('0x1'));var logger=require(_0x58cb('0x2'))(_0x58cb('0x3'));var moment=require(_0x58cb('0x4'));var BPromise=require(_0x58cb('0x5'));var rp=require(_0x58cb('0x6'));var fs=require('fs');var path=require(_0x58cb('0x7'));var rimraf=require('rimraf');var config=require(_0x58cb('0x8'));var attributes=require(_0x58cb('0x9'));module[_0x58cb('0xa')]=function(_0x369626,_0x2798de){return _0x369626[_0x58cb('0xb')](_0x58cb('0xc'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc63a=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','path','rimraf','../../config/environment'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xc63a,0x130));var _0xac63=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xc63a[_0x566bdf];return _0x331215;};'use strict';var _=require(_0xac63('0x0'));var util=require(_0xac63('0x1'));var logger=require('../../config/logger')(_0xac63('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xac63('0x3'));var rimraf=require(_0xac63('0x4'));var config=require(_0xac63('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xac63('0x6')]=function(_0x2275f6,_0x25c021){return _0x2275f6[_0xac63('0x7')](_0xac63('0x8'),attributes,{'tableName':_0xac63('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 3b06f9c..4245ead 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa4c=['update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VerifyAdditionalPhones','ContactId','ListId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','findOne','countcongestionretry','countdropretry','SwapAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','sequelize','transaction'];(function(_0x478355,_0x4056d9){var _0x439cdf=function(_0x5479d0){while(--_0x5479d0){_0x478355['push'](_0x478355['shift']());}};_0x439cdf(++_0x4056d9);}(_0xaa4c,0x12a));var _0xcaa4=function(_0x2ceb20,_0x5ab392){_0x2ceb20=_0x2ceb20-0x0;var _0x3b09ff=_0xaa4c[_0x2ceb20];return _0x3b09ff;};'use strict';var _=require(_0xcaa4('0x0'));var util=require(_0xcaa4('0x1'));var moment=require(_0xcaa4('0x2'));var BPromise=require(_0xcaa4('0x3'));var rs=require(_0xcaa4('0x4'));var fs=require('fs');var Redis=require(_0xcaa4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaa4('0x6'));var logger=require(_0xcaa4('0x7'))('rpc');var config=require(_0xcaa4('0x8'));var jayson=require(_0xcaa4('0x9'));var client=jayson[_0xcaa4('0xa')][_0xcaa4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9d8365,_0x3282d2,_0x5c1ccf){return new BPromise(function(_0x3cb279,_0x456e32){return client[_0xcaa4('0xc')](_0x9d8365,_0x5c1ccf)[_0xcaa4('0xd')](function(_0x517a49){logger['info'](_0xcaa4('0xe'),_0x3282d2,_0xcaa4('0xf'));logger[_0xcaa4('0x10')](_0xcaa4('0x11'),_0x3282d2,'request\x20sent',JSON[_0xcaa4('0x12')](_0x517a49));if(_0x517a49['error']){if(_0x517a49[_0xcaa4('0x13')][_0xcaa4('0x14')]===0x1f4){logger[_0xcaa4('0x13')](_0xcaa4('0xe'),_0x3282d2,_0x517a49[_0xcaa4('0x13')][_0xcaa4('0x15')]);return _0x456e32(_0x517a49[_0xcaa4('0x13')][_0xcaa4('0x15')]);}logger[_0xcaa4('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3282d2,_0x517a49['error'][_0xcaa4('0x15')]);return _0x3cb279(_0x517a49[_0xcaa4('0x13')][_0xcaa4('0x15')]);}else{logger[_0xcaa4('0x16')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3282d2,_0xcaa4('0xf'));_0x3cb279(_0x517a49['result'][_0xcaa4('0x15')]);}})[_0xcaa4('0x17')](function(_0x2dc68a){logger[_0xcaa4('0x13')](_0xcaa4('0xe'),_0x3282d2,_0x2dc68a);_0x456e32(_0x2dc68a);});});}exports[_0xcaa4('0x18')]=function(_0x112533){var _0x31c630=this;return new Promise(function(_0x290ea7,_0x3d2d2b){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x112533['body'][_0xcaa4('0x19')],'ListId':_0x112533['body'][_0xcaa4('0x1a')],'VoiceQueueId':_0x112533[_0xcaa4('0x1b')][_0xcaa4('0x1c')]===undefined?null:_0x112533[_0xcaa4('0x1b')][_0xcaa4('0x1c')],'CampaignId':_0x112533[_0xcaa4('0x1b')][_0xcaa4('0x1d')]===undefined?null:_0x112533[_0xcaa4('0x1b')][_0xcaa4('0x1d')]}})[_0xcaa4('0xd')](function(_0x468154){if(_0x468154!=null){return db[_0xcaa4('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x468154['id'],'OrderBy':{'$gt':_0x468154[_0xcaa4('0x1f')]}},'order':[['OrderBy',_0xcaa4('0x20')]]})[_0xcaa4('0xd')](function(_0x302a57){var _0x1eb461=0x0;if(_0x302a57){if(_0x302a57[_0xcaa4('0x21')]+_0x302a57['countcongestionretry']+_0x302a57[_0xcaa4('0x22')]+_0x302a57[_0xcaa4('0x23')]+_0x302a57['countdropretry']+_0x302a57[_0xcaa4('0x24')]+_0x302a57[_0xcaa4('0x25')]+_0x302a57[_0xcaa4('0x26')]<_0x112533[_0xcaa4('0x27')][_0xcaa4('0x28')])_0x1eb461=0x1;_0x290ea7({'additional':_0x1eb461});}else{return db[_0xcaa4('0x1e')][_0xcaa4('0x29')]({'raw':!![],'where':{'CmHopperId':_0x468154['id']},'order':[[_0xcaa4('0x1f'),_0xcaa4('0x20')]]})[_0xcaa4('0xd')](function(_0x53fdcc){var _0x2023f4=0x0;if(_0x53fdcc){if(_0x53fdcc[_0xcaa4('0x21')]+_0x53fdcc[_0xcaa4('0x2a')]+_0x53fdcc['countnoanswerretry']+_0x53fdcc[_0xcaa4('0x23')]+_0x53fdcc[_0xcaa4('0x2b')]+_0x53fdcc[_0xcaa4('0x24')]+_0x53fdcc[_0xcaa4('0x25')]+_0x53fdcc[_0xcaa4('0x26')]<_0x112533[_0xcaa4('0x27')][_0xcaa4('0x28')])_0x2023f4=0x1;_0x290ea7({'additional':_0x2023f4});}else{_0x290ea7({'additional':0x0});}})['catch'](function(_0x35424d){logger[_0xcaa4('0x13')]('VerifyAdditionalPhones',_0x35424d[_0xcaa4('0x15')]);_0x3d2d2b(_0x31c630['error'](0x1f4,_0x35424d['message']));});}})[_0xcaa4('0x17')](function(_0x49edd4){logger[_0xcaa4('0x13')](_0xcaa4('0x18'),_0x49edd4[_0xcaa4('0x15')]);_0x3d2d2b(_0x31c630[_0xcaa4('0x13')](0x1f4,_0x49edd4[_0xcaa4('0x15')]));});}else _0x290ea7({'additional':0x0});});});};exports[_0xcaa4('0x2c')]=function(_0x340bc6){var _0x1a7763=this;return new Promise(function(_0x56f5d0,_0x569efa){return db[_0xcaa4('0x2d')][_0xcaa4('0x29')]({'raw':!![],'where':{'ContactId':_0x340bc6[_0xcaa4('0x1b')][_0xcaa4('0x19')],'ListId':_0x340bc6[_0xcaa4('0x1b')]['ListId'],'VoiceQueueId':_0x340bc6[_0xcaa4('0x1b')]['VoiceQueueId']===undefined?null:_0x340bc6[_0xcaa4('0x1b')][_0xcaa4('0x1c')],'CampaignId':_0x340bc6[_0xcaa4('0x1b')][_0xcaa4('0x1d')]===undefined?null:_0x340bc6[_0xcaa4('0x1b')]['CampaignId']}})[_0xcaa4('0xd')](function(_0x44a929){if(_0x44a929!=null){return db[_0xcaa4('0x1e')][_0xcaa4('0x29')]({'raw':!![],'where':{'CmHopperId':_0x44a929['id'],'OrderBy':{'$gte':_0x44a929[_0xcaa4('0x1f')]}},'order':[[_0xcaa4('0x1f'),_0xcaa4('0x20')]]})[_0xcaa4('0xd')](function(_0x101cde){if(_0x101cde)return activateAdditionalPhone(_0x44a929,_0x340bc6[_0xcaa4('0x1b')],_0x101cde,_0x340bc6[_0xcaa4('0x2e')],_0x340bc6[_0xcaa4('0x2f')])[_0xcaa4('0xd')](function(_0x7a5e2){_0x56f5d0(_0x7a5e2);});else{return db['CmHopperAdditionalPhone'][_0xcaa4('0x29')]({'raw':!![],'where':{'CmHopperId':_0x44a929['id']},'order':[[_0xcaa4('0x1f'),'ASC']]})[_0xcaa4('0xd')](function(_0x41852d){if(_0x41852d)return activateAdditionalPhone(_0x44a929,_0x340bc6[_0xcaa4('0x1b')],_0x41852d,_0x340bc6['duration'],_0x340bc6['waitTime'])[_0xcaa4('0xd')](function(_0x351e4f){_0x56f5d0(_0x351e4f);});else{_0x56f5d0({'id':_0x44a929['id'],'phone':''});}})['catch'](function(_0x220a4b){logger[_0xcaa4('0x13')](_0xcaa4('0x18'),_0x220a4b['message']);_0x569efa(_0x1a7763[_0xcaa4('0x13')](0x1f4,_0x220a4b[_0xcaa4('0x15')]));});}})['catch'](function(_0x40fcd4){logger['error'](_0xcaa4('0x18'),_0x40fcd4['message']);_0x569efa(_0x1a7763['error'](0x1f4,_0x40fcd4[_0xcaa4('0x15')]));});}else _0x56f5d0(0x1);});});};function activateAdditionalPhone(_0x436e07,_0x11352d,_0xd02909,_0x5794ea,_0x431334){return new Promise(function(_0x2c4c68,_0x4d1b0e){var _0x58675f;if(_[_0xcaa4('0x30')](_0xd02909['scheduledat'])){_0xd02909[_0xcaa4('0x31')]=moment();}if(moment()>moment(_0xd02909[_0xcaa4('0x31')])){_0x58675f=moment()[_0xcaa4('0x32')](_0x431334||0x3,_0xcaa4('0x33'));}else{if(_0xd02909['OrderBy']==0x0){_0x58675f=moment(_0xd02909[_0xcaa4('0x31')]);}else{_0x58675f=moment()[_0xcaa4('0x32')](_0x431334||0x3,_0xcaa4('0x33'));}}if(_[_0xcaa4('0x30')](_0x58675f)){_0x58675f=moment()[_0xcaa4('0x32')](_0x431334||0x3,'minutes');}var _0x49b942={'phone':_0x436e07[_0xcaa4('0x34')],'active':0x0,'OrderBy':_[_0xcaa4('0x30')](_0x436e07['OrderBy'])?0x0:_0x436e07[_0xcaa4('0x1f')],'scheduledat':moment()[_0xcaa4('0x32')](_0x5794ea||0x1,_0xcaa4('0x33')),'countbusyretry':_0x11352d['countbusyretry'],'countcongestionretry':_0x11352d[_0xcaa4('0x2a')],'countnoanswerretry':_0x11352d[_0xcaa4('0x22')],'countnosuchnumberretry':_0x11352d[_0xcaa4('0x23')],'countdropretry':_0x11352d['countdropretry'],'countabandonedretry':_0x11352d[_0xcaa4('0x24')],'countmachineretry':_0x11352d[_0xcaa4('0x25')],'countagentrejectretry':_0x11352d[_0xcaa4('0x26')],'createdAt':_0x11352d['createdAt'],'updatedAt':_0x11352d[_0xcaa4('0x35')]};var _0x5abdde={'CmHopperId':_0x436e07['id'],'phone':_0xd02909[_0xcaa4('0x34')],'active':0x0,'OrderBy':_['isNil'](_0xd02909[_0xcaa4('0x1f')])?0x0:_0xd02909[_0xcaa4('0x1f')],'scheduledat':_0x58675f,'countbusyretry':_0xd02909[_0xcaa4('0x21')],'countcongestionretry':_0xd02909['countcongestionretry'],'countnoanswerretry':_0xd02909[_0xcaa4('0x22')],'countnosuchnumberretry':_0xd02909['countnosuchnumberretry'],'countdropretry':_0xd02909[_0xcaa4('0x2b')],'countabandonedretry':_0xd02909[_0xcaa4('0x24')],'countmachineretry':_0xd02909['countmachineretry'],'countagentrejectretry':_0xd02909[_0xcaa4('0x26')],'createdAt':_0xd02909['createdAt'],'updatedAt':_0xd02909[_0xcaa4('0x35')]};return db[_0xcaa4('0x36')][_0xcaa4('0x37')](function(_0xd9892a){return db[_0xcaa4('0x1e')][_0xcaa4('0x38')](_0x49b942,{'where':{'id':_0xd02909['id']}},{'transaction':_0xd9892a})[_0xcaa4('0xd')](function(){return db[_0xcaa4('0x2d')][_0xcaa4('0x38')](_0x5abdde,{'where':{'id':_0x436e07['id']}},{'transaction':_0xd9892a});});})['then'](function(_0x13aa5f){_0x2c4c68({'id':_0x436e07['id'],'phone':_0xd02909[_0xcaa4('0x34')]});})[_0xcaa4('0x17')](function(_0x1a1717){logger[_0xcaa4('0x13')](_0xcaa4('0x39'),_0x1a1717['message']);_0x4d1b0e({'error':_0x1a1717[_0xcaa4('0x15')]});});});}exports[_0xcaa4('0x3a')]=function(_0x532833){var _0x4e9f9e=this;return new Promise(function(_0x4156da,_0x2ad95a){return db[_0xcaa4('0x2d')][_0xcaa4('0x38')](_0x532833[_0xcaa4('0x1b')]['field'],{'where':{'id':_0x532833[_0xcaa4('0x1b')]['id']}})[_0xcaa4('0xd')](function(_0x356def){_0x4156da(_0x356def);})[_0xcaa4('0x17')](function(_0xe047c){logger[_0xcaa4('0x13')](_0xcaa4('0x3a'),_0xe047c[_0xcaa4('0x15')]);_0x2ad95a(_0x4e9f9e['error'](0x1f4,_0xe047c[_0xcaa4('0x15')]));});});}; \ No newline at end of file +var _0x7954=['createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','countabandonedretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','duration','isNil','scheduledat','minutes','add','phone'];(function(_0x3b2cda,_0x2257a7){var _0x59708d=function(_0x161b93){while(--_0x161b93){_0x3b2cda['push'](_0x3b2cda['shift']());}};_0x59708d(++_0x2257a7);}(_0x7954,0xb6));var _0x4795=function(_0x1bc857,_0xc41a81){_0x1bc857=_0x1bc857-0x0;var _0x3a4adc=_0x7954[_0x1bc857];return _0x3a4adc;};'use strict';var _=require(_0x4795('0x0'));var util=require(_0x4795('0x1'));var moment=require(_0x4795('0x2'));var BPromise=require(_0x4795('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4795('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4795('0x5'))('rpc');var config=require(_0x4795('0x6'));var jayson=require(_0x4795('0x7'));var client=jayson[_0x4795('0x8')][_0x4795('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53bed7,_0x2699d3,_0x33b048){return new BPromise(function(_0x593352,_0x39578d){return client[_0x4795('0xa')](_0x53bed7,_0x33b048)['then'](function(_0x1f38a2){logger['info'](_0x4795('0xb'),_0x2699d3,'request\x20sent');logger[_0x4795('0xc')](_0x4795('0xd'),_0x2699d3,'request\x20sent',JSON[_0x4795('0xe')](_0x1f38a2));if(_0x1f38a2['error']){if(_0x1f38a2[_0x4795('0xf')][_0x4795('0x10')]===0x1f4){logger[_0x4795('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2699d3,_0x1f38a2['error'][_0x4795('0x11')]);return _0x39578d(_0x1f38a2['error'][_0x4795('0x11')]);}logger[_0x4795('0xf')](_0x4795('0xb'),_0x2699d3,_0x1f38a2[_0x4795('0xf')][_0x4795('0x11')]);return _0x593352(_0x1f38a2[_0x4795('0xf')][_0x4795('0x11')]);}else{logger['info'](_0x4795('0xb'),_0x2699d3,_0x4795('0x12'));_0x593352(_0x1f38a2[_0x4795('0x13')]['message']);}})[_0x4795('0x14')](function(_0x36f2f6){logger['error'](_0x4795('0xb'),_0x2699d3,_0x36f2f6);_0x39578d(_0x36f2f6);});});}exports['VerifyAdditionalPhones']=function(_0x44828c){var _0x5b3b65=this;return new Promise(function(_0x1ccc87,_0x5f0d46){return db['CmHopper'][_0x4795('0x15')]({'raw':!![],'where':{'ContactId':_0x44828c[_0x4795('0x16')][_0x4795('0x17')],'ListId':_0x44828c[_0x4795('0x16')][_0x4795('0x18')],'VoiceQueueId':_0x44828c[_0x4795('0x16')][_0x4795('0x19')]===undefined?null:_0x44828c[_0x4795('0x16')]['VoiceQueueId'],'CampaignId':_0x44828c['body'][_0x4795('0x1a')]===undefined?null:_0x44828c[_0x4795('0x16')]['CampaignId']}})[_0x4795('0x1b')](function(_0x5bf265){if(_0x5bf265!=null){return db['CmHopperAdditionalPhone'][_0x4795('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5bf265['id'],'OrderBy':{'$gt':_0x5bf265['OrderBy']}},'order':[[_0x4795('0x1c'),_0x4795('0x1d')]]})[_0x4795('0x1b')](function(_0x1d3859){var _0x5638c5=0x0;if(_0x1d3859){if(_0x1d3859[_0x4795('0x1e')]+_0x1d3859['countcongestionretry']+_0x1d3859[_0x4795('0x1f')]+_0x1d3859[_0x4795('0x20')]+_0x1d3859[_0x4795('0x21')]+_0x1d3859['countabandonedretry']+_0x1d3859[_0x4795('0x22')]+_0x1d3859[_0x4795('0x23')]<_0x44828c['entity'][_0x4795('0x24')])_0x5638c5=0x1;_0x1ccc87({'additional':_0x5638c5});}else{return db[_0x4795('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5bf265['id']},'order':[[_0x4795('0x1c'),'ASC']]})[_0x4795('0x1b')](function(_0x320f65){var _0xeed261=0x0;if(_0x320f65){if(_0x320f65[_0x4795('0x1e')]+_0x320f65[_0x4795('0x26')]+_0x320f65[_0x4795('0x1f')]+_0x320f65['countnosuchnumberretry']+_0x320f65[_0x4795('0x21')]+_0x320f65[_0x4795('0x27')]+_0x320f65['countmachineretry']+_0x320f65[_0x4795('0x23')]<_0x44828c[_0x4795('0x28')][_0x4795('0x24')])_0xeed261=0x1;_0x1ccc87({'additional':_0xeed261});}else{_0x1ccc87({'additional':0x0});}})[_0x4795('0x14')](function(_0x4bfa37){logger[_0x4795('0xf')](_0x4795('0x29'),_0x4bfa37['message']);_0x5f0d46(_0x5b3b65[_0x4795('0xf')](0x1f4,_0x4bfa37['message']));});}})['catch'](function(_0x364685){logger[_0x4795('0xf')](_0x4795('0x29'),_0x364685[_0x4795('0x11')]);_0x5f0d46(_0x5b3b65['error'](0x1f4,_0x364685[_0x4795('0x11')]));});}else _0x1ccc87({'additional':0x0});});});};exports[_0x4795('0x2a')]=function(_0x5371dc){var _0x5aad60=this;return new Promise(function(_0x271b71,_0x2fc396){return db[_0x4795('0x2b')][_0x4795('0x15')]({'raw':!![],'where':{'ContactId':_0x5371dc[_0x4795('0x16')][_0x4795('0x17')],'ListId':_0x5371dc[_0x4795('0x16')][_0x4795('0x18')],'VoiceQueueId':_0x5371dc['body'][_0x4795('0x19')]===undefined?null:_0x5371dc[_0x4795('0x16')]['VoiceQueueId'],'CampaignId':_0x5371dc[_0x4795('0x16')][_0x4795('0x1a')]===undefined?null:_0x5371dc[_0x4795('0x16')][_0x4795('0x1a')]}})[_0x4795('0x1b')](function(_0x24f603){if(_0x24f603!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x24f603['id'],'OrderBy':{'$gte':_0x24f603[_0x4795('0x1c')]}},'order':[[_0x4795('0x1c'),'ASC']]})[_0x4795('0x1b')](function(_0x3437e8){if(_0x3437e8)return activateAdditionalPhone(_0x24f603,_0x5371dc[_0x4795('0x16')],_0x3437e8,_0x5371dc[_0x4795('0x2c')],_0x5371dc['waitTime'])['then'](function(_0x4686cf){_0x271b71(_0x4686cf);});else{return db[_0x4795('0x25')][_0x4795('0x15')]({'raw':!![],'where':{'CmHopperId':_0x24f603['id']},'order':[['OrderBy','ASC']]})[_0x4795('0x1b')](function(_0x576f75){if(_0x576f75)return activateAdditionalPhone(_0x24f603,_0x5371dc[_0x4795('0x16')],_0x576f75,_0x5371dc[_0x4795('0x2c')],_0x5371dc['waitTime'])['then'](function(_0xc833a7){_0x271b71(_0xc833a7);});else{_0x271b71({'id':_0x24f603['id'],'phone':''});}})['catch'](function(_0x48d116){logger[_0x4795('0xf')](_0x4795('0x29'),_0x48d116[_0x4795('0x11')]);_0x2fc396(_0x5aad60[_0x4795('0xf')](0x1f4,_0x48d116[_0x4795('0x11')]));});}})[_0x4795('0x14')](function(_0x5a92fe){logger[_0x4795('0xf')](_0x4795('0x29'),_0x5a92fe['message']);_0x2fc396(_0x5aad60[_0x4795('0xf')](0x1f4,_0x5a92fe['message']));});}else _0x271b71(0x1);});});};function activateAdditionalPhone(_0x2b17ff,_0x2a13c9,_0x19cb09,_0x61af61,_0x280408){return new Promise(function(_0x1128a0,_0x1d2af3){var _0x3c73ca;if(_[_0x4795('0x2d')](_0x19cb09[_0x4795('0x2e')])){_0x19cb09[_0x4795('0x2e')]=moment();}if(moment()>moment(_0x19cb09['scheduledat'])){_0x3c73ca=moment()['add'](_0x280408||0x3,_0x4795('0x2f'));}else{if(_0x19cb09[_0x4795('0x1c')]==0x0){_0x3c73ca=moment(_0x19cb09['scheduledat']);}else{_0x3c73ca=moment()['add'](_0x280408||0x3,_0x4795('0x2f'));}}if(_['isNil'](_0x3c73ca)){_0x3c73ca=moment()[_0x4795('0x30')](_0x280408||0x3,_0x4795('0x2f'));}var _0x5c2e49={'phone':_0x2b17ff[_0x4795('0x31')],'active':0x0,'OrderBy':_[_0x4795('0x2d')](_0x2b17ff[_0x4795('0x1c')])?0x0:_0x2b17ff[_0x4795('0x1c')],'scheduledat':moment()[_0x4795('0x30')](_0x61af61||0x1,_0x4795('0x2f')),'countbusyretry':_0x2a13c9['countbusyretry'],'countcongestionretry':_0x2a13c9[_0x4795('0x26')],'countnoanswerretry':_0x2a13c9[_0x4795('0x1f')],'countnosuchnumberretry':_0x2a13c9[_0x4795('0x20')],'countdropretry':_0x2a13c9[_0x4795('0x21')],'countabandonedretry':_0x2a13c9[_0x4795('0x27')],'countmachineretry':_0x2a13c9[_0x4795('0x22')],'countagentrejectretry':_0x2a13c9[_0x4795('0x23')],'createdAt':_0x2a13c9[_0x4795('0x32')],'updatedAt':_0x2a13c9[_0x4795('0x33')]};var _0x74cdf1={'CmHopperId':_0x2b17ff['id'],'phone':_0x19cb09['phone'],'active':0x0,'OrderBy':_[_0x4795('0x2d')](_0x19cb09[_0x4795('0x1c')])?0x0:_0x19cb09[_0x4795('0x1c')],'scheduledat':_0x3c73ca,'countbusyretry':_0x19cb09[_0x4795('0x1e')],'countcongestionretry':_0x19cb09[_0x4795('0x26')],'countnoanswerretry':_0x19cb09['countnoanswerretry'],'countnosuchnumberretry':_0x19cb09[_0x4795('0x20')],'countdropretry':_0x19cb09[_0x4795('0x21')],'countabandonedretry':_0x19cb09[_0x4795('0x27')],'countmachineretry':_0x19cb09[_0x4795('0x22')],'countagentrejectretry':_0x19cb09['countagentrejectretry'],'createdAt':_0x19cb09['createdAt'],'updatedAt':_0x19cb09[_0x4795('0x33')]};return db[_0x4795('0x34')][_0x4795('0x35')](function(_0x5cc4a5){return db['CmHopperAdditionalPhone'][_0x4795('0x36')](_0x5c2e49,{'where':{'id':_0x19cb09['id']}},{'transaction':_0x5cc4a5})['then'](function(){return db[_0x4795('0x2b')][_0x4795('0x36')](_0x74cdf1,{'where':{'id':_0x2b17ff['id']}},{'transaction':_0x5cc4a5});});})[_0x4795('0x1b')](function(_0x4b1163){_0x1128a0({'id':_0x2b17ff['id'],'phone':_0x19cb09[_0x4795('0x31')]});})[_0x4795('0x14')](function(_0x6df09e){logger[_0x4795('0xf')](_0x4795('0x37'),_0x6df09e[_0x4795('0x11')]);_0x1d2af3({'error':_0x6df09e[_0x4795('0x11')]});});});}exports[_0x4795('0x38')]=function(_0x1061e7){var _0x5c85a7=this;return new Promise(function(_0x959b4f,_0x2d5bf1){return db[_0x4795('0x2b')][_0x4795('0x36')](_0x1061e7[_0x4795('0x16')][_0x4795('0x39')],{'where':{'id':_0x1061e7[_0x4795('0x16')]['id']}})[_0x4795('0x1b')](function(_0x21d069){_0x959b4f(_0x21d069);})[_0x4795('0x14')](function(_0xc04ae2){logger[_0x4795('0xf')]('IncrementPreviewCounters',_0xc04ae2['message']);_0x2d5bf1(_0x5c85a7[_0x4795('0xf')](0x1f4,_0xc04ae2[_0x4795('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 38d3d5f..4baf670 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93c1=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','delete','destroy'];(function(_0x240516,_0x522423){var _0x2ab73c=function(_0x3c2fbc){while(--_0x3c2fbc){_0x240516['push'](_0x240516['shift']());}};_0x2ab73c(++_0x522423);}(_0x93c1,0x181));var _0x193c=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x93c1[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x193c('0x0'));var path=require(_0x193c('0x1'));var timeout=require(_0x193c('0x2'));var express=require(_0x193c('0x3'));var router=express[_0x193c('0x4')]();var fs_extra=require(_0x193c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x193c('0x6'));var config=require(_0x193c('0x7'));var controller=require(_0x193c('0x8'));router[_0x193c('0x9')]('/',auth[_0x193c('0xa')](),controller['index']);router[_0x193c('0x9')](_0x193c('0xb'),auth['isAuthenticated'](),controller[_0x193c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x193c('0xb'),auth[_0x193c('0xa')](),controller['update']);router[_0x193c('0xd')](_0x193c('0xb'),auth[_0x193c('0xa')](),controller[_0x193c('0xe')]);module[_0x193c('0xf')]=router; \ No newline at end of file +var _0x21f8=['util','path','connect-timeout','express','Router','fs-extra','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x26f22b,_0x5c77fc){var _0x4bf48f=function(_0x41c49d){while(--_0x41c49d){_0x26f22b['push'](_0x26f22b['shift']());}};_0x4bf48f(++_0x5c77fc);}(_0x21f8,0x71));var _0x821f=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x21f8[_0x1529a3];return _0x1a0d4b;};'use strict';var multer=require(_0x821f('0x0'));var util=require(_0x821f('0x1'));var path=require(_0x821f('0x2'));var timeout=require(_0x821f('0x3'));var express=require(_0x821f('0x4'));var router=express[_0x821f('0x5')]();var fs_extra=require(_0x821f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x821f('0x7'));router[_0x821f('0x8')]('/',auth[_0x821f('0x9')](),controller[_0x821f('0xa')]);router[_0x821f('0x8')](_0x821f('0xb'),auth[_0x821f('0x9')](),controller[_0x821f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x821f('0xd')]);router[_0x821f('0xe')](_0x821f('0xb'),auth['isAuthenticated'](),controller[_0x821f('0xf')]);router[_0x821f('0x10')](_0x821f('0xb'),auth[_0x821f('0x9')](),controller[_0x821f('0x11')]);module[_0x821f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 6ae54ea..e407b82 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 _0x0f9f=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x150322,_0x2199fb){var _0x606a08=function(_0x22cace){while(--_0x22cace){_0x150322['push'](_0x150322['shift']());}};_0x606a08(++_0x2199fb);}(_0x0f9f,0xae));var _0xf0f9=function(_0x2f5fe5,_0x5d78b0){_0x2f5fe5=_0x2f5fe5-0x0;var _0x4e4cf8=_0x0f9f[_0x2f5fe5];return _0x4e4cf8;};'use strict';var moment=require(_0xf0f9('0x0'));var Sequelize=require(_0xf0f9('0x1'));module[_0xf0f9('0x2')]={'phone':{'type':Sequelize[_0xf0f9('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf0f9('0x4')],'unique':_0xf0f9('0x5')},'ListId':{'type':Sequelize[_0xf0f9('0x4')],'unique':_0xf0f9('0x5')},'VoiceQueueId':{'type':Sequelize[_0xf0f9('0x4')],'unique':_0xf0f9('0x5')}}; \ No newline at end of file +var _0x3e6d=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e6d,0x187));var _0xd3e6=function(_0x606122,_0xf6a48f){_0x606122=_0x606122-0x0;var _0x10e24d=_0x3e6d[_0x606122];return _0x10e24d;};'use strict';var moment=require('moment');var Sequelize=require(_0xd3e6('0x0'));module[_0xd3e6('0x1')]={'phone':{'type':Sequelize[_0xd3e6('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd3e6('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd3e6('0x3')],'unique':_0xd3e6('0x4')},'VoiceQueueId':{'type':Sequelize[_0xd3e6('0x3')],'unique':_0xd3e6('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1f2ca16..f2d38a2 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 _0x1ad1=['includeAll','include','rows','show','params','find','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','CmHopperBlack','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x29e89b,_0x236c1f){var _0x38e84c=function(_0x301d74){while(--_0x301d74){_0x29e89b['push'](_0x29e89b['shift']());}};_0x38e84c(++_0x236c1f);}(_0x1ad1,0x139));var _0x11ad=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x1ad1[_0x4d8ed9];return _0x1e2140;};'use strict';var emlformat=require(_0x11ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11ad('0x1'));var jsonpatch=require(_0x11ad('0x2'));var rp=require(_0x11ad('0x3'));var moment=require(_0x11ad('0x4'));var BPromise=require(_0x11ad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x11ad('0x6'));var sox=require(_0x11ad('0x7'));var csv=require(_0x11ad('0x8'));var ejs=require(_0x11ad('0x9'));var fs=require('fs');var fs_extra=require(_0x11ad('0xa'));var _=require(_0x11ad('0xb'));var squel=require(_0x11ad('0xc'));var crypto=require(_0x11ad('0xd'));var jsforce=require(_0x11ad('0xe'));var deskjs=require(_0x11ad('0xf'));var toCsv=require(_0x11ad('0x8'));var querystring=require(_0x11ad('0x10'));var Papa=require(_0x11ad('0x11'));var Redis=require('ioredis');var authService=require(_0x11ad('0x12'));var qs=require(_0x11ad('0x13'));var as=require(_0x11ad('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11ad('0x15'))(_0x11ad('0x16'));var utils=require(_0x11ad('0x17'));var config=require(_0x11ad('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x11ad('0x19'))['db'];function respondWithStatusCode(_0x412bda,_0x15490b){_0x15490b=_0x15490b||0xcc;return function(_0x349593){if(_0x349593){return _0x412bda[_0x11ad('0x1a')](_0x15490b);}return _0x412bda[_0x11ad('0x1b')](_0x15490b)[_0x11ad('0x1c')]();};}function respondWithResult(_0x356fd4,_0xcbfdc){_0xcbfdc=_0xcbfdc||0xc8;return function(_0x237ccf){if(_0x237ccf){return _0x356fd4[_0x11ad('0x1b')](_0xcbfdc)[_0x11ad('0x1d')](_0x237ccf);}};}function respondWithFilteredResult(_0x219e50,_0x2d3ab6){return function(_0x184eb3){if(_0x184eb3){var _0x5b0db0=typeof _0x2d3ab6[_0x11ad('0x1e')]===_0x11ad('0x1f')&&typeof _0x2d3ab6[_0x11ad('0x20')]==='undefined';var _0x169f4d=_0x184eb3[_0x11ad('0x21')];var _0x4f8ec1=_0x5b0db0?0x0:_0x2d3ab6[_0x11ad('0x1e')];var _0x2fcc82=_0x5b0db0?_0x184eb3[_0x11ad('0x21')]:_0x2d3ab6[_0x11ad('0x1e')]+_0x2d3ab6[_0x11ad('0x20')];var _0x3be428;if(_0x2fcc82>=_0x169f4d){_0x2fcc82=_0x169f4d;_0x3be428=0xc8;}else{_0x3be428=0xce;}_0x219e50[_0x11ad('0x1b')](_0x3be428);return _0x219e50[_0x11ad('0x22')](_0x11ad('0x23'),_0x4f8ec1+'-'+_0x2fcc82+'/'+_0x169f4d)[_0x11ad('0x1d')](_0x184eb3);}return null;};}function patchUpdates(_0x461f8c){return function(_0x1c2729){try{jsonpatch[_0x11ad('0x24')](_0x1c2729,_0x461f8c,!![]);}catch(_0x1318cc){return BPromise[_0x11ad('0x25')](_0x1318cc);}return _0x1c2729[_0x11ad('0x26')]();};}function saveUpdates(_0x5cc2f7,_0x49faa0){return function(_0x338eb9){if(_0x338eb9){return _0x338eb9[_0x11ad('0x27')](_0x5cc2f7)[_0x11ad('0x28')](function(_0x503f1a){return _0x503f1a;});}return null;};}function removeEntity(_0x447cd9,_0xf252fc){return function(_0x45adf2){if(_0x45adf2){return _0x45adf2[_0x11ad('0x29')]()[_0x11ad('0x28')](function(){_0x447cd9[_0x11ad('0x1b')](0xcc)[_0x11ad('0x1c')]();});}};}function handleEntityNotFound(_0x1e413c,_0x570320){return function(_0x45207e){if(!_0x45207e){_0x1e413c[_0x11ad('0x1a')](0x194);}return _0x45207e;};}function handleError(_0x2ba252,_0xe05beb){_0xe05beb=_0xe05beb||0x1f4;return function(_0x577aac){logger[_0x11ad('0x2a')](_0x577aac[_0x11ad('0x2b')]);if(_0x577aac['name']){delete _0x577aac[_0x11ad('0x2c')];}_0x2ba252[_0x11ad('0x1b')](_0xe05beb)['send'](_0x577aac);};}exports[_0x11ad('0x2d')]=function(_0x2a6164,_0x30bc0b){var _0x498af={},_0x36ed6e={},_0x172724={'count':0x0,'rows':[]};var _0x21e2bd=_['map'](db[_0x11ad('0x2e')]['rawAttributes'],function(_0x519abc){return{'name':_0x519abc[_0x11ad('0x2f')],'type':_0x519abc[_0x11ad('0x30')][_0x11ad('0x31')]};});_0x36ed6e[_0x11ad('0x32')]=_[_0x11ad('0x33')](_0x21e2bd,_0x11ad('0x2c'));_0x36ed6e[_0x11ad('0x34')]=_[_0x11ad('0x35')](_0x2a6164['query']);_0x36ed6e[_0x11ad('0x36')]=_[_0x11ad('0x37')](_0x36ed6e[_0x11ad('0x32')],_0x36ed6e[_0x11ad('0x34')]);_0x498af[_0x11ad('0x38')]=_[_0x11ad('0x37')](_0x36ed6e[_0x11ad('0x32')],qs[_0x11ad('0x39')](_0x2a6164[_0x11ad('0x34')][_0x11ad('0x39')]));_0x498af['attributes']=_0x498af[_0x11ad('0x38')][_0x11ad('0x3a')]?_0x498af[_0x11ad('0x38')]:_0x36ed6e[_0x11ad('0x32')];if(!_0x2a6164[_0x11ad('0x34')][_0x11ad('0x3b')]('nolimit')){_0x498af['limit']=qs[_0x11ad('0x20')](_0x2a6164['query'][_0x11ad('0x20')]);_0x498af[_0x11ad('0x1e')]=qs['offset'](_0x2a6164[_0x11ad('0x34')]['offset']);}_0x498af['order']=qs[_0x11ad('0x3c')](_0x2a6164[_0x11ad('0x34')]['sort']);_0x498af['where']=qs[_0x11ad('0x36')](_[_0x11ad('0x3d')](_0x2a6164[_0x11ad('0x34')],_0x36ed6e[_0x11ad('0x36')]),_0x21e2bd);if(_0x2a6164[_0x11ad('0x34')][_0x11ad('0x3e')]){_0x498af[_0x11ad('0x3f')]=_[_0x11ad('0x40')](_0x498af[_0x11ad('0x3f')],{'$or':_[_0x11ad('0x33')](_0x21e2bd,function(_0xd7b0fb){if(_0xd7b0fb['type']!==_0x11ad('0x41')){var _0x5e0f0e={};_0x5e0f0e[_0xd7b0fb[_0x11ad('0x2c')]]={'$like':'%'+_0x2a6164[_0x11ad('0x34')][_0x11ad('0x3e')]+'%'};return _0x5e0f0e;}})});}_0x498af=_[_0x11ad('0x40')]({},_0x498af,_0x2a6164[_0x11ad('0x42')]);var _0x13cbc0={'where':_0x498af[_0x11ad('0x3f')]};return db[_0x11ad('0x2e')][_0x11ad('0x21')](_0x13cbc0)[_0x11ad('0x28')](function(_0x2c4792){_0x172724[_0x11ad('0x21')]=_0x2c4792;if(_0x2a6164[_0x11ad('0x34')][_0x11ad('0x43')]){_0x498af[_0x11ad('0x44')]=[{'all':!![]}];}return db[_0x11ad('0x2e')]['findAll'](_0x498af);})[_0x11ad('0x28')](function(_0x4ac552){_0x172724[_0x11ad('0x45')]=_0x4ac552;return _0x172724;})[_0x11ad('0x28')](respondWithFilteredResult(_0x30bc0b,_0x498af))['catch'](handleError(_0x30bc0b,null));};exports[_0x11ad('0x46')]=function(_0x4f8357,_0x9cba2a){var _0x4b21fd={'raw':!![],'where':{'id':_0x4f8357[_0x11ad('0x47')]['id']}},_0x257689={};_0x257689[_0x11ad('0x32')]=_[_0x11ad('0x35')](db[_0x11ad('0x2e')]['rawAttributes']);_0x257689[_0x11ad('0x34')]=_['keys'](_0x4f8357[_0x11ad('0x34')]);_0x257689[_0x11ad('0x36')]=_[_0x11ad('0x37')](_0x257689[_0x11ad('0x32')],_0x257689[_0x11ad('0x34')]);_0x4b21fd['attributes']=_[_0x11ad('0x37')](_0x257689[_0x11ad('0x32')],qs[_0x11ad('0x39')](_0x4f8357[_0x11ad('0x34')][_0x11ad('0x39')]));_0x4b21fd[_0x11ad('0x38')]=_0x4b21fd[_0x11ad('0x38')]['length']?_0x4b21fd[_0x11ad('0x38')]:_0x257689[_0x11ad('0x32')];if(_0x4f8357[_0x11ad('0x34')][_0x11ad('0x43')]){_0x4b21fd[_0x11ad('0x44')]=[{'all':!![]}];}_0x4b21fd=_[_0x11ad('0x40')]({},_0x4b21fd,_0x4f8357[_0x11ad('0x42')]);return db[_0x11ad('0x2e')][_0x11ad('0x48')](_0x4b21fd)[_0x11ad('0x28')](handleEntityNotFound(_0x9cba2a,null))['then'](respondWithResult(_0x9cba2a,null))['catch'](handleError(_0x9cba2a,null));};exports[_0x11ad('0x27')]=function(_0x23e5ad,_0x428661){if(_0x23e5ad['body']['id']){delete _0x23e5ad[_0x11ad('0x49')]['id'];}return db['CmHopperBlack'][_0x11ad('0x48')]({'where':{'id':_0x23e5ad[_0x11ad('0x47')]['id']}})[_0x11ad('0x28')](handleEntityNotFound(_0x428661,null))[_0x11ad('0x28')](saveUpdates(_0x23e5ad[_0x11ad('0x49')],null))['then'](respondWithResult(_0x428661,null))[_0x11ad('0x4a')](handleError(_0x428661,null));};exports[_0x11ad('0x29')]=function(_0x1292f7,_0x575e32){return db['CmHopperBlack'][_0x11ad('0x48')]({'where':{'id':_0x1292f7[_0x11ad('0x47')]['id']}})[_0x11ad('0x28')](handleEntityNotFound(_0x575e32,null))[_0x11ad('0x28')](removeEntity(_0x575e32,null))[_0x11ad('0x4a')](handleError(_0x575e32,null));};exports['describe']=function(_0x2b4725,_0x5261b0){return db['CmHopperBlack'][_0x11ad('0x4b')]()[_0x11ad('0x28')](respondWithResult(_0x5261b0,null))[_0x11ad('0x4a')](handleError(_0x5261b0,null));}; \ No newline at end of file +var _0xccc9=['show','params','options','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch'];(function(_0x3096fd,_0x541ccd){var _0x159725=function(_0x4815b0){while(--_0x4815b0){_0x3096fd['push'](_0x3096fd['shift']());}};_0x159725(++_0x541ccd);}(_0xccc9,0x136));var _0x9ccc=function(_0x112e69,_0x5b5b46){_0x112e69=_0x112e69-0x0;var _0x26d11f=_0xccc9[_0x112e69];return _0x26d11f;};'use strict';var emlformat=require(_0x9ccc('0x0'));var rimraf=require(_0x9ccc('0x1'));var zipdir=require(_0x9ccc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9ccc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9ccc('0x4'));var util=require(_0x9ccc('0x5'));var path=require(_0x9ccc('0x6'));var sox=require(_0x9ccc('0x7'));var csv=require(_0x9ccc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ccc('0x9'));var _=require(_0x9ccc('0xa'));var squel=require(_0x9ccc('0xb'));var crypto=require(_0x9ccc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ccc('0xd'));var Papa=require(_0x9ccc('0xe'));var Redis=require(_0x9ccc('0xf'));var authService=require(_0x9ccc('0x10'));var qs=require(_0x9ccc('0x11'));var as=require(_0x9ccc('0x12'));var hardwareService=require(_0x9ccc('0x13'));var logger=require(_0x9ccc('0x14'))(_0x9ccc('0x15'));var utils=require('../../config/utils');var config=require(_0x9ccc('0x16'));var licenseUtil=require(_0x9ccc('0x17'));var db=require(_0x9ccc('0x18'))['db'];function respondWithStatusCode(_0x3f6e7e,_0x3bf782){_0x3bf782=_0x3bf782||0xcc;return function(_0x31964c){if(_0x31964c){return _0x3f6e7e[_0x9ccc('0x19')](_0x3bf782);}return _0x3f6e7e[_0x9ccc('0x1a')](_0x3bf782)['end']();};}function respondWithResult(_0x2426d2,_0x2fa580){_0x2fa580=_0x2fa580||0xc8;return function(_0x4ea9cb){if(_0x4ea9cb){return _0x2426d2[_0x9ccc('0x1a')](_0x2fa580)[_0x9ccc('0x1b')](_0x4ea9cb);}};}function respondWithFilteredResult(_0x548519,_0x290038){return function(_0x39dec8){if(_0x39dec8){var _0x15285b=typeof _0x290038[_0x9ccc('0x1c')]===_0x9ccc('0x1d')&&typeof _0x290038['limit']==='undefined';var _0xc12ad1=_0x39dec8[_0x9ccc('0x1e')];var _0x363af9=_0x15285b?0x0:_0x290038[_0x9ccc('0x1c')];var _0x5a9d49=_0x15285b?_0x39dec8[_0x9ccc('0x1e')]:_0x290038[_0x9ccc('0x1c')]+_0x290038[_0x9ccc('0x1f')];var _0x4cbd2e;if(_0x5a9d49>=_0xc12ad1){_0x5a9d49=_0xc12ad1;_0x4cbd2e=0xc8;}else{_0x4cbd2e=0xce;}_0x548519[_0x9ccc('0x1a')](_0x4cbd2e);return _0x548519[_0x9ccc('0x20')](_0x9ccc('0x21'),_0x363af9+'-'+_0x5a9d49+'/'+_0xc12ad1)[_0x9ccc('0x1b')](_0x39dec8);}return null;};}function patchUpdates(_0x3dadc0){return function(_0xb24dcc){try{jsonpatch[_0x9ccc('0x22')](_0xb24dcc,_0x3dadc0,!![]);}catch(_0x43f5ed){return BPromise[_0x9ccc('0x23')](_0x43f5ed);}return _0xb24dcc[_0x9ccc('0x24')]();};}function saveUpdates(_0x5d3ed9,_0x4c9562){return function(_0xcec3b6){if(_0xcec3b6){return _0xcec3b6[_0x9ccc('0x25')](_0x5d3ed9)[_0x9ccc('0x26')](function(_0x30f498){return _0x30f498;});}return null;};}function removeEntity(_0x246356,_0x4df3e9){return function(_0x577c6b){if(_0x577c6b){return _0x577c6b['destroy']()[_0x9ccc('0x26')](function(){_0x246356[_0x9ccc('0x1a')](0xcc)[_0x9ccc('0x27')]();});}};}function handleEntityNotFound(_0x80b96f,_0x494052){return function(_0x19abae){if(!_0x19abae){_0x80b96f[_0x9ccc('0x19')](0x194);}return _0x19abae;};}function handleError(_0x1b9790,_0x227b2a){_0x227b2a=_0x227b2a||0x1f4;return function(_0x355335){logger[_0x9ccc('0x28')](_0x355335['stack']);if(_0x355335[_0x9ccc('0x29')]){delete _0x355335[_0x9ccc('0x29')];}_0x1b9790[_0x9ccc('0x1a')](_0x227b2a)[_0x9ccc('0x2a')](_0x355335);};}exports[_0x9ccc('0x2b')]=function(_0xa72084,_0x4009a2){var _0x163321={},_0x53666a={},_0x46f25a={'count':0x0,'rows':[]};var _0x37af0f=_[_0x9ccc('0x2c')](db[_0x9ccc('0x2d')][_0x9ccc('0x2e')],function(_0x24a081){return{'name':_0x24a081[_0x9ccc('0x2f')],'type':_0x24a081[_0x9ccc('0x30')][_0x9ccc('0x31')]};});_0x53666a[_0x9ccc('0x32')]=_[_0x9ccc('0x2c')](_0x37af0f,_0x9ccc('0x29'));_0x53666a['query']=_[_0x9ccc('0x33')](_0xa72084[_0x9ccc('0x34')]);_0x53666a[_0x9ccc('0x35')]=_[_0x9ccc('0x36')](_0x53666a['model'],_0x53666a[_0x9ccc('0x34')]);_0x163321['attributes']=_[_0x9ccc('0x36')](_0x53666a['model'],qs['fields'](_0xa72084[_0x9ccc('0x34')][_0x9ccc('0x37')]));_0x163321[_0x9ccc('0x38')]=_0x163321[_0x9ccc('0x38')][_0x9ccc('0x39')]?_0x163321['attributes']:_0x53666a[_0x9ccc('0x32')];if(!_0xa72084[_0x9ccc('0x34')][_0x9ccc('0x3a')](_0x9ccc('0x3b'))){_0x163321[_0x9ccc('0x1f')]=qs[_0x9ccc('0x1f')](_0xa72084['query'][_0x9ccc('0x1f')]);_0x163321[_0x9ccc('0x1c')]=qs['offset'](_0xa72084[_0x9ccc('0x34')][_0x9ccc('0x1c')]);}_0x163321['order']=qs[_0x9ccc('0x3c')](_0xa72084[_0x9ccc('0x34')]['sort']);_0x163321['where']=qs[_0x9ccc('0x35')](_[_0x9ccc('0x3d')](_0xa72084[_0x9ccc('0x34')],_0x53666a['filters']),_0x37af0f);if(_0xa72084[_0x9ccc('0x34')]['filter']){_0x163321[_0x9ccc('0x3e')]=_[_0x9ccc('0x3f')](_0x163321[_0x9ccc('0x3e')],{'$or':_[_0x9ccc('0x2c')](_0x37af0f,function(_0x30f766){if(_0x30f766['type']!==_0x9ccc('0x40')){var _0x299c29={};_0x299c29[_0x30f766[_0x9ccc('0x29')]]={'$like':'%'+_0xa72084[_0x9ccc('0x34')][_0x9ccc('0x41')]+'%'};return _0x299c29;}})});}_0x163321=_['merge']({},_0x163321,_0xa72084['options']);var _0x400c04={'where':_0x163321[_0x9ccc('0x3e')]};return db[_0x9ccc('0x2d')][_0x9ccc('0x1e')](_0x400c04)[_0x9ccc('0x26')](function(_0x310495){_0x46f25a[_0x9ccc('0x1e')]=_0x310495;if(_0xa72084[_0x9ccc('0x34')][_0x9ccc('0x42')]){_0x163321[_0x9ccc('0x43')]=[{'all':!![]}];}return db[_0x9ccc('0x2d')]['findAll'](_0x163321);})[_0x9ccc('0x26')](function(_0x3b3bfb){_0x46f25a[_0x9ccc('0x44')]=_0x3b3bfb;return _0x46f25a;})['then'](respondWithFilteredResult(_0x4009a2,_0x163321))[_0x9ccc('0x45')](handleError(_0x4009a2,null));};exports[_0x9ccc('0x46')]=function(_0x51ba66,_0x3f1b67){var _0x247c5f={'raw':!![],'where':{'id':_0x51ba66[_0x9ccc('0x47')]['id']}},_0x3be80e={};_0x3be80e[_0x9ccc('0x32')]=_[_0x9ccc('0x33')](db[_0x9ccc('0x2d')][_0x9ccc('0x2e')]);_0x3be80e['query']=_['keys'](_0x51ba66[_0x9ccc('0x34')]);_0x3be80e[_0x9ccc('0x35')]=_['intersection'](_0x3be80e[_0x9ccc('0x32')],_0x3be80e['query']);_0x247c5f[_0x9ccc('0x38')]=_['intersection'](_0x3be80e['model'],qs['fields'](_0x51ba66['query']['fields']));_0x247c5f[_0x9ccc('0x38')]=_0x247c5f['attributes']['length']?_0x247c5f[_0x9ccc('0x38')]:_0x3be80e['model'];if(_0x51ba66[_0x9ccc('0x34')][_0x9ccc('0x42')]){_0x247c5f[_0x9ccc('0x43')]=[{'all':!![]}];}_0x247c5f=_[_0x9ccc('0x3f')]({},_0x247c5f,_0x51ba66[_0x9ccc('0x48')]);return db['CmHopperBlack'][_0x9ccc('0x49')](_0x247c5f)[_0x9ccc('0x26')](handleEntityNotFound(_0x3f1b67,null))['then'](respondWithResult(_0x3f1b67,null))[_0x9ccc('0x45')](handleError(_0x3f1b67,null));};exports[_0x9ccc('0x25')]=function(_0x3cc0ea,_0x2ddbe3){if(_0x3cc0ea[_0x9ccc('0x4a')]['id']){delete _0x3cc0ea[_0x9ccc('0x4a')]['id'];}return db[_0x9ccc('0x2d')][_0x9ccc('0x49')]({'where':{'id':_0x3cc0ea['params']['id']}})[_0x9ccc('0x26')](handleEntityNotFound(_0x2ddbe3,null))[_0x9ccc('0x26')](saveUpdates(_0x3cc0ea['body'],null))[_0x9ccc('0x26')](respondWithResult(_0x2ddbe3,null))[_0x9ccc('0x45')](handleError(_0x2ddbe3,null));};exports['destroy']=function(_0x1ddb1c,_0x3908ec){return db[_0x9ccc('0x2d')][_0x9ccc('0x49')]({'where':{'id':_0x1ddb1c[_0x9ccc('0x47')]['id']}})[_0x9ccc('0x26')](handleEntityNotFound(_0x3908ec,null))[_0x9ccc('0x26')](removeEntity(_0x3908ec,null))[_0x9ccc('0x45')](handleError(_0x3908ec,null));};exports[_0x9ccc('0x4b')]=function(_0x1dc5b8,_0x4c0b16){return db[_0x9ccc('0x2d')][_0x9ccc('0x4b')]()['then'](respondWithResult(_0x4c0b16,null))[_0x9ccc('0x45')](handleError(_0x4c0b16,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6dddc37..bc7ca1e 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 _0x60dd=['moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0x60dd,0x10d));var _0xd60d=function(_0x341591,_0x2ae3a5){_0x341591=_0x341591-0x0;var _0x1adb2c=_0x60dd[_0x341591];return _0x1adb2c;};'use strict';var _=require(_0xd60d('0x0'));var util=require(_0xd60d('0x1'));var logger=require(_0xd60d('0x2'))(_0xd60d('0x3'));var moment=require(_0xd60d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd60d('0x5'));var fs=require('fs');var path=require(_0xd60d('0x6'));var rimraf=require(_0xd60d('0x7'));var config=require(_0xd60d('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0xd60d('0x9')]=function(_0x29b5f9,_0x5ccf16){return _0x29b5f9[_0xd60d('0xa')](_0xd60d('0xb'),attributes,{'tableName':_0xd60d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc994=['define','CmHopperBlack','cm_hopper_black','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x39696f,_0x140c57){var _0x588b02=function(_0x548fc1){while(--_0x548fc1){_0x39696f['push'](_0x39696f['shift']());}};_0x588b02(++_0x140c57);}(_0xc994,0x7c));var _0x4c99=function(_0x5778b5,_0x32c630){_0x5778b5=_0x5778b5-0x0;var _0x174e77=_0xc994[_0x5778b5];return _0x174e77;};'use strict';var _=require(_0x4c99('0x0'));var util=require(_0x4c99('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4c99('0x2'));var rp=require(_0x4c99('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c99('0x4'));var config=require(_0x4c99('0x5'));var attributes=require(_0x4c99('0x6'));module[_0x4c99('0x7')]=function(_0x179423,_0x79f543){return _0x179423[_0x4c99('0x8')](_0x4c99('0x9'),attributes,{'tableName':_0x4c99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index ce18137..3603013 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 _0x6c03=['attributes','limit','include','map','model','then','UpdateCmHopperBlack','update','raw','stringify','destroy','DestroyCmHopperBlack','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where'];(function(_0x3aab4f,_0x2fc299){var _0x3e360d=function(_0x1a4618){while(--_0x1a4618){_0x3aab4f['push'](_0x3aab4f['shift']());}};_0x3e360d(++_0x2fc299);}(_0x6c03,0x134));var _0x36c0=function(_0x28ba2d,_0x164385){_0x28ba2d=_0x28ba2d-0x0;var _0x3dfbfe=_0x6c03[_0x28ba2d];return _0x3dfbfe;};'use strict';var _=require('lodash');var util=require(_0x36c0('0x0'));var moment=require(_0x36c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x36c0('0x2'));var fs=require('fs');var Redis=require(_0x36c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x36c0('0x4'));var logger=require(_0x36c0('0x5'))(_0x36c0('0x6'));var config=require('../../config/environment');var jayson=require(_0x36c0('0x7'));var client=jayson[_0x36c0('0x8')][_0x36c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ac9c0,_0x4dda2b,_0xe30c79){return new BPromise(function(_0x5b300c,_0x379100){return client[_0x36c0('0xa')](_0x2ac9c0,_0xe30c79)['then'](function(_0x563bf0){logger['info'](_0x36c0('0xb'),_0x4dda2b,_0x36c0('0xc'));logger[_0x36c0('0xd')](_0x36c0('0xe'),_0x4dda2b,_0x36c0('0xc'),JSON['stringify'](_0x563bf0));if(_0x563bf0['error']){if(_0x563bf0['error']['code']===0x1f4){logger[_0x36c0('0xf')](_0x36c0('0xb'),_0x4dda2b,_0x563bf0['error'][_0x36c0('0x10')]);return _0x379100(_0x563bf0[_0x36c0('0xf')]['message']);}logger[_0x36c0('0xf')](_0x36c0('0xb'),_0x4dda2b,_0x563bf0[_0x36c0('0xf')][_0x36c0('0x10')]);return _0x5b300c(_0x563bf0[_0x36c0('0xf')][_0x36c0('0x10')]);}else{logger[_0x36c0('0x11')](_0x36c0('0xb'),_0x4dda2b,'request\x20sent');_0x5b300c(_0x563bf0[_0x36c0('0x12')]['message']);}})[_0x36c0('0x13')](function(_0x358e24){logger[_0x36c0('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x4dda2b,_0x358e24);_0x379100(_0x358e24);});});}exports[_0x36c0('0x14')]=function(_0x46ebbb){var _0x4c8fe5=this;return new Promise(function(_0x19c69b,_0x295f98){return db[_0x36c0('0x15')][_0x36c0('0x16')]({'raw':_0x46ebbb['options']?_0x46ebbb[_0x36c0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46ebbb[_0x36c0('0x17')]?_0x46ebbb[_0x36c0('0x17')][_0x36c0('0x18')]||null:null,'attributes':_0x46ebbb[_0x36c0('0x17')]?_0x46ebbb['options'][_0x36c0('0x19')]||null:null,'limit':_0x46ebbb[_0x36c0('0x17')]?_0x46ebbb['options'][_0x36c0('0x1a')]||null:null,'include':_0x46ebbb[_0x36c0('0x17')]?_0x46ebbb['options'][_0x36c0('0x1b')]?_[_0x36c0('0x1c')](_0x46ebbb[_0x36c0('0x17')]['include'],function(_0x509076){return{'model':db[_0x509076['model']],'as':_0x509076['as'],'attributes':_0x509076[_0x36c0('0x19')],'include':_0x509076[_0x36c0('0x1b')]?_[_0x36c0('0x1c')](_0x509076[_0x36c0('0x1b')],function(_0x43d0c2){return{'model':db[_0x43d0c2[_0x36c0('0x1d')]],'as':_0x43d0c2['as'],'attributes':_0x43d0c2[_0x36c0('0x19')],'include':_0x43d0c2[_0x36c0('0x1b')]?_[_0x36c0('0x1c')](_0x43d0c2['include'],function(_0x4fb72d){return{'model':db[_0x4fb72d[_0x36c0('0x1d')]],'as':_0x4fb72d['as'],'attributes':_0x4fb72d['attributes']};}):[]};}):[]};}):[]:[]})[_0x36c0('0x1e')](function(_0xd61df6){logger[_0x36c0('0x11')](_0x36c0('0x14'),_0x46ebbb);logger[_0x36c0('0xd')](_0x36c0('0x14'),_0x46ebbb,JSON['stringify'](_0xd61df6));_0x19c69b(_0xd61df6);})[_0x36c0('0x13')](function(_0x5efaf1){logger[_0x36c0('0xf')]('GetCmHopperBlack',_0x5efaf1['message'],_0x46ebbb);_0x295f98(_0x4c8fe5[_0x36c0('0xf')](0x1f4,_0x5efaf1[_0x36c0('0x10')]));});});};exports[_0x36c0('0x1f')]=function(_0x2fd1ad){var _0x2736d9=this;return new Promise(function(_0x8a88b4,_0x5e0ffe){return db[_0x36c0('0x15')][_0x36c0('0x20')](_0x2fd1ad['body'],{'raw':_0x2fd1ad[_0x36c0('0x17')]?_0x2fd1ad[_0x36c0('0x17')][_0x36c0('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fd1ad[_0x36c0('0x17')]?_0x2fd1ad[_0x36c0('0x17')][_0x36c0('0x18')]||null:null,'attributes':_0x2fd1ad[_0x36c0('0x17')]?_0x2fd1ad[_0x36c0('0x17')][_0x36c0('0x19')]||null:null,'limit':_0x2fd1ad['options']?_0x2fd1ad[_0x36c0('0x17')][_0x36c0('0x1a')]||null:null})[_0x36c0('0x1e')](function(_0x567025){logger['info'](_0x36c0('0x1f'),_0x2fd1ad);logger[_0x36c0('0xd')](_0x36c0('0x1f'),_0x2fd1ad,JSON[_0x36c0('0x22')](_0x567025));_0x8a88b4(_0x567025);})[_0x36c0('0x13')](function(_0x1cff10){logger[_0x36c0('0xf')]('UpdateCmHopperBlack',_0x1cff10[_0x36c0('0x10')],_0x2fd1ad);_0x5e0ffe(_0x2736d9[_0x36c0('0xf')](0x1f4,_0x1cff10[_0x36c0('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x3ed8c3){var _0x23368c=this;return new Promise(function(_0x4bc173,_0x5d43c1){return db[_0x36c0('0x15')][_0x36c0('0x23')]({'where':_0x3ed8c3[_0x36c0('0x17')]?_0x3ed8c3[_0x36c0('0x17')]['where']||null:null})[_0x36c0('0x1e')](function(_0x553812){logger[_0x36c0('0x11')](_0x36c0('0x24'),_0x3ed8c3);logger[_0x36c0('0xd')]('DestroyCmHopperBlack',_0x3ed8c3,JSON['stringify'](_0x553812));_0x4bc173(_0x553812);})[_0x36c0('0x13')](function(_0x3761bc){logger['error'](_0x36c0('0x24'),_0x3761bc[_0x36c0('0x10')],_0x3ed8c3);_0x5d43c1(_0x23368c['error'](0x1f4,_0x3761bc[_0x36c0('0x10')]));});});}; \ No newline at end of file +var _0x3032=['../../config/environment','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','info','UpdateCmHopperBlack','update','body','debug','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x1d2e4f,_0x50b3fc){var _0x333e69=function(_0x2bb234){while(--_0x2bb234){_0x1d2e4f['push'](_0x1d2e4f['shift']());}};_0x333e69(++_0x50b3fc);}(_0x3032,0x1f3));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2303('0x0'));var util=require('util');var moment=require(_0x2303('0x1'));var BPromise=require('bluebird');var rs=require(_0x2303('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2303('0x3'));var logger=require(_0x2303('0x4'))('rpc');var config=require(_0x2303('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2303('0x6')][_0x2303('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7d52e1,_0x3cbf00,_0xece77a){return new BPromise(function(_0x13294a,_0x34897e){return client[_0x2303('0x8')](_0x7d52e1,_0xece77a)[_0x2303('0x9')](function(_0x582e7e){logger['info'](_0x2303('0xa'),_0x3cbf00,_0x2303('0xb'));logger['debug'](_0x2303('0xc'),_0x3cbf00,_0x2303('0xb'),JSON[_0x2303('0xd')](_0x582e7e));if(_0x582e7e[_0x2303('0xe')]){if(_0x582e7e[_0x2303('0xe')]['code']===0x1f4){logger[_0x2303('0xe')](_0x2303('0xa'),_0x3cbf00,_0x582e7e[_0x2303('0xe')][_0x2303('0xf')]);return _0x34897e(_0x582e7e[_0x2303('0xe')][_0x2303('0xf')]);}logger[_0x2303('0xe')](_0x2303('0xa'),_0x3cbf00,_0x582e7e['error'][_0x2303('0xf')]);return _0x13294a(_0x582e7e['error'][_0x2303('0xf')]);}else{logger['info'](_0x2303('0xa'),_0x3cbf00,_0x2303('0xb'));_0x13294a(_0x582e7e[_0x2303('0x10')][_0x2303('0xf')]);}})[_0x2303('0x11')](function(_0x3b1dc5){logger[_0x2303('0xe')](_0x2303('0xa'),_0x3cbf00,_0x3b1dc5);_0x34897e(_0x3b1dc5);});});}exports[_0x2303('0x12')]=function(_0x180b27){var _0x9f8b6d=this;return new Promise(function(_0xad480e,_0x510096){return db[_0x2303('0x13')][_0x2303('0x14')]({'raw':_0x180b27[_0x2303('0x15')]?_0x180b27[_0x2303('0x15')][_0x2303('0x16')]===undefined?!![]:![]:!![],'where':_0x180b27[_0x2303('0x15')]?_0x180b27[_0x2303('0x15')][_0x2303('0x17')]||null:null,'attributes':_0x180b27[_0x2303('0x15')]?_0x180b27[_0x2303('0x15')]['attributes']||null:null,'limit':_0x180b27[_0x2303('0x15')]?_0x180b27['options'][_0x2303('0x18')]||null:null,'include':_0x180b27['options']?_0x180b27[_0x2303('0x15')][_0x2303('0x19')]?_[_0x2303('0x1a')](_0x180b27[_0x2303('0x15')][_0x2303('0x19')],function(_0x480a8a){return{'model':db[_0x480a8a['model']],'as':_0x480a8a['as'],'attributes':_0x480a8a['attributes'],'include':_0x480a8a['include']?_[_0x2303('0x1a')](_0x480a8a[_0x2303('0x19')],function(_0x48aec5){return{'model':db[_0x48aec5[_0x2303('0x1b')]],'as':_0x48aec5['as'],'attributes':_0x48aec5[_0x2303('0x1c')],'include':_0x48aec5['include']?_[_0x2303('0x1a')](_0x48aec5[_0x2303('0x19')],function(_0x390308){return{'model':db[_0x390308[_0x2303('0x1b')]],'as':_0x390308['as'],'attributes':_0x390308[_0x2303('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x272a2a){logger[_0x2303('0x1d')](_0x2303('0x12'),_0x180b27);logger['debug'](_0x2303('0x12'),_0x180b27,JSON[_0x2303('0xd')](_0x272a2a));_0xad480e(_0x272a2a);})[_0x2303('0x11')](function(_0x11b9e8){logger[_0x2303('0xe')]('GetCmHopperBlack',_0x11b9e8[_0x2303('0xf')],_0x180b27);_0x510096(_0x9f8b6d[_0x2303('0xe')](0x1f4,_0x11b9e8[_0x2303('0xf')]));});});};exports[_0x2303('0x1e')]=function(_0x25d584){var _0x3359a2=this;return new Promise(function(_0xabe149,_0x1b4070){return db[_0x2303('0x13')][_0x2303('0x1f')](_0x25d584[_0x2303('0x20')],{'raw':_0x25d584['options']?_0x25d584[_0x2303('0x15')][_0x2303('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25d584[_0x2303('0x15')]?_0x25d584[_0x2303('0x15')][_0x2303('0x17')]||null:null,'attributes':_0x25d584[_0x2303('0x15')]?_0x25d584['options'][_0x2303('0x1c')]||null:null,'limit':_0x25d584[_0x2303('0x15')]?_0x25d584[_0x2303('0x15')][_0x2303('0x18')]||null:null})[_0x2303('0x9')](function(_0x46dc4d){logger[_0x2303('0x1d')](_0x2303('0x1e'),_0x25d584);logger[_0x2303('0x21')](_0x2303('0x1e'),_0x25d584,JSON[_0x2303('0xd')](_0x46dc4d));_0xabe149(_0x46dc4d);})[_0x2303('0x11')](function(_0x1bce38){logger[_0x2303('0xe')]('UpdateCmHopperBlack',_0x1bce38[_0x2303('0xf')],_0x25d584);_0x1b4070(_0x3359a2['error'](0x1f4,_0x1bce38[_0x2303('0xf')]));});});};exports[_0x2303('0x22')]=function(_0x67a8c5){var _0x2d3868=this;return new Promise(function(_0x320de4,_0x52664d){return db[_0x2303('0x13')][_0x2303('0x23')]({'where':_0x67a8c5[_0x2303('0x15')]?_0x67a8c5[_0x2303('0x15')][_0x2303('0x17')]||null:null})[_0x2303('0x9')](function(_0x4b073a){logger[_0x2303('0x1d')](_0x2303('0x22'),_0x67a8c5);logger[_0x2303('0x21')](_0x2303('0x22'),_0x67a8c5,JSON[_0x2303('0xd')](_0x4b073a));_0x320de4(_0x4b073a);})[_0x2303('0x11')](function(_0x7a8fa1){logger[_0x2303('0xe')]('DestroyCmHopperBlack',_0x7a8fa1['message'],_0x67a8c5);_0x52664d(_0x2d3868[_0x2303('0xe')](0x1f4,_0x7a8fa1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a9853bb..7989f01 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 _0xfb11=['show','put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xfb11[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xe')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller['update']);router[_0x1fb1('0xf')]('/:id',auth[_0x1fb1('0x7')](),controller['destroy']);module[_0x1fb1('0x10')]=router; \ No newline at end of file +var _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x208f18,_0x230f4a){var _0x100b5a=function(_0x2386a3){while(--_0x2386a3){_0x208f18['push'](_0x208f18['shift']());}};_0x100b5a(++_0x230f4a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);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 6268b99..9628d18 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 _0x816d=['setDataValue','diff','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','endtime'];(function(_0x2cd8c4,_0x32a297){var _0x5d3704=function(_0xb88c8){while(--_0xb88c8){_0x2cd8c4['push'](_0x2cd8c4['shift']());}};_0x5d3704(++_0x32a297);}(_0x816d,0xea));var _0xd816=function(_0x3f8cf6,_0x335e76){_0x3f8cf6=_0x3f8cf6-0x0;var _0x577168=_0x816d[_0x3f8cf6];return _0x577168;};'use strict';var Sequelize=require(_0xd816('0x0'));var moment=require(_0xd816('0x1'));module['exports']={'state':{'type':Sequelize[_0xd816('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd816('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd816('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd816('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd816('0x3')]},'calleridnum':{'type':Sequelize[_0xd816('0x3')]},'calleridname':{'type':Sequelize[_0xd816('0x3')]},'starttime':{'type':Sequelize[_0xd816('0x4')]},'responsetime':{'type':Sequelize[_0xd816('0x4')]},'answertime':{'type':Sequelize[_0xd816('0x4')]},'droptime':{'type':Sequelize[_0xd816('0x4')]},'endtime':{'type':Sequelize[_0xd816('0x4')]},'ringtime':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd816('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd816('0x3')]},'reason':{'type':Sequelize[_0xd816('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd816('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd816('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1f90d9){var _0x227e2d=this['getDataValue'](_0xd816('0x5'));if(_0x227e2d&&_0x1f90d9){this[_0xd816('0x6')]('followuptime',moment(_0x1f90d9)[_0xd816('0x7')](moment(_0x227e2d),_0xd816('0x8')));}}},'amd':{'type':Sequelize[_0xd816('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd816('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd816('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd816('0x4')]},'callback':{'type':Sequelize[_0xd816('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd816('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd816('0x4')]},'deleted':{'type':Sequelize[_0xd816('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd816('0x4')]},'recallme':{'type':Sequelize[_0xd816('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd816('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd816('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x28c7=['getDataValue','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x1a0e2c,_0x3d609f){var _0x56b608=function(_0x1617d1){while(--_0x1617d1){_0x1a0e2c['push'](_0x1a0e2c['shift']());}};_0x56b608(++_0x3d609f);}(_0x28c7,0x1f4));var _0x728c=function(_0x2e2bd6,_0x539d6e){_0x2e2bd6=_0x2e2bd6-0x0;var _0x35af7e=_0x28c7[_0x2e2bd6];return _0x35af7e;};'use strict';var Sequelize=require(_0x728c('0x0'));var moment=require(_0x728c('0x1'));module[_0x728c('0x2')]={'state':{'type':Sequelize[_0x728c('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x728c('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x728c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x728c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x728c('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x728c('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x728c('0x4')]},'originatecalleridname':{'type':Sequelize[_0x728c('0x4')]},'calleridnum':{'type':Sequelize[_0x728c('0x4')]},'calleridname':{'type':Sequelize[_0x728c('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x728c('0x5')]},'answertime':{'type':Sequelize[_0x728c('0x5')]},'droptime':{'type':Sequelize[_0x728c('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x728c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x728c('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x728c('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x728c('0x4')]},'secondDisposition':{'type':Sequelize[_0x728c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x728c('0x4')]},'dispositionat':{'type':Sequelize[_0x728c('0x5')],'set':function(_0x3ab750){var _0x595423=this[_0x728c('0x6')]('endtime');if(_0x595423&&_0x3ab750){this[_0x728c('0x7')](_0x728c('0x8'),moment(_0x3ab750)[_0x728c('0x9')](moment(_0x595423),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x728c('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x728c('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x728c('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x728c('0x5')]},'callback':{'type':Sequelize[_0x728c('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x728c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x728c('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x728c('0x5')]},'recallme':{'type':Sequelize[_0x728c('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x728c('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x728c('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x728c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x728c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x728c('0x3')],'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 c5dcb39..4fd7634 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 _0x31f0=['sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','select','field','ANY_VALUE(calleridnum)','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','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','ContactId','Campaign','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x31f0,0xb7));var _0x031f=function(_0x20670a,_0x3c2932){_0x20670a=_0x20670a-0x0;var _0x133a24=_0x31f0[_0x20670a];return _0x133a24;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=typeof _0x1f08db[_0x031f('0x1b')]==='undefined'&&typeof _0x1f08db[_0x031f('0x1c')]===_0x031f('0x1d');var _0x5d0c70=_0x3a10aa[_0x031f('0x1e')];var _0x535e70=_0xe4fc1d?0x0:_0x1f08db[_0x031f('0x1b')];var _0x5f2199=_0xe4fc1d?_0x3a10aa[_0x031f('0x1e')]:_0x1f08db[_0x031f('0x1b')]+_0x1f08db[_0x031f('0x1c')];var _0x26cb5e;if(_0x5f2199>=_0x5d0c70){_0x5f2199=_0x5d0c70;_0x26cb5e=0xc8;}else{_0x26cb5e=0xce;}_0x4b7011[_0x031f('0x1a')](_0x26cb5e);return _0x4b7011[_0x031f('0x1f')](_0x031f('0x20'),_0x535e70+'-'+_0x5f2199+'/'+_0x5d0c70)[_0x031f('0x21')](_0x3a10aa);}return null;};}function patchUpdates(_0x29dd6e){return function(_0x48a76e){try{jsonpatch[_0x031f('0x22')](_0x48a76e,_0x29dd6e,!![]);}catch(_0x33926c){return BPromise[_0x031f('0x23')](_0x33926c);}return _0x48a76e['save']();};}function saveUpdates(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x24')](_0x5c4184)['then'](function(_0x54d054){return _0x54d054;});}return null;};}function removeEntity(_0x47d639,_0x971691){return function(_0x12c406){if(_0x12c406){return _0x12c406[_0x031f('0x25')]()[_0x031f('0x26')](function(){_0x47d639['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(!_0x1f5a14){_0x5a64c0[_0x031f('0x18')](0x194);}return _0x1f5a14;};}function handleError(_0x567666,_0x35af16){_0x35af16=_0x35af16||0x1f4;return function(_0x3b2a51){logger['error'](_0x3b2a51[_0x031f('0x27')]);if(_0x3b2a51[_0x031f('0x28')]){delete _0x3b2a51[_0x031f('0x28')];}_0x567666['status'](_0x35af16)[_0x031f('0x29')](_0x3b2a51);};}exports[_0x031f('0x2a')]=function(_0xb6ed6c,_0xaf5bea){var _0xfaa36={},_0x301bd2={},_0x52b544={'count':0x0,'rows':[]};var _0x1f62eb=_[_0x031f('0x2b')](db[_0x031f('0x2c')][_0x031f('0x2d')],function(_0x428ec4){return{'name':_0x428ec4[_0x031f('0x2e')],'type':_0x428ec4[_0x031f('0x2f')][_0x031f('0x30')]};});_0x301bd2[_0x031f('0x31')]=_[_0x031f('0x2b')](_0x1f62eb,_0x031f('0x28'));_0x301bd2['query']=_[_0x031f('0x32')](_0xb6ed6c[_0x031f('0x33')]);_0x301bd2[_0x031f('0x34')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],_0x301bd2[_0x031f('0x33')]);_0xfaa36[_0x031f('0x36')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],qs[_0x031f('0x37')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x37')]));_0xfaa36[_0x031f('0x36')]=_0xfaa36['attributes'][_0x031f('0x38')]?_0xfaa36[_0x031f('0x36')]:_0x301bd2['model'];if(!_0xb6ed6c[_0x031f('0x33')][_0x031f('0x39')]('nolimit')){_0xfaa36[_0x031f('0x1c')]=qs[_0x031f('0x1c')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x1c')]);_0xfaa36['offset']=qs['offset'](_0xb6ed6c[_0x031f('0x33')]['offset']);}_0xfaa36[_0x031f('0x3a')]=qs[_0x031f('0x3b')](_0xb6ed6c[_0x031f('0x33')]['sort']);_0xfaa36['where']=qs[_0x031f('0x34')](_['pick'](_0xb6ed6c['query'],_0x301bd2[_0x031f('0x34')]),_0x1f62eb);if(_0xb6ed6c[_0x031f('0x33')][_0x031f('0x3c')]){_0xfaa36[_0x031f('0x3d')]=_[_0x031f('0x3e')](_0xfaa36[_0x031f('0x3d')],{'$or':_[_0x031f('0x2b')](_0x1f62eb,function(_0x55c85f){if(_0x55c85f[_0x031f('0x2f')]!==_0x031f('0x3f')){var _0xb3b188={};_0xb3b188[_0x55c85f[_0x031f('0x28')]]={'$like':'%'+_0xb6ed6c['query'][_0x031f('0x3c')]+'%'};return _0xb3b188;}})});}_0xfaa36=_[_0x031f('0x3e')]({},_0xfaa36,_0xb6ed6c[_0x031f('0x40')]);var _0x5895f6={'where':_0xfaa36[_0x031f('0x3d')]};return db[_0x031f('0x2c')]['count'](_0x5895f6)[_0x031f('0x26')](function(_0x268dc7){_0x52b544['count']=_0x268dc7;if(_0xb6ed6c['query'][_0x031f('0x41')]){_0xfaa36[_0x031f('0x42')]=[{'all':!![]}];}return db[_0x031f('0x2c')][_0x031f('0x43')](_0xfaa36);})[_0x031f('0x26')](function(_0xf0fb95){_0x52b544[_0x031f('0x44')]=_0xf0fb95;return _0x52b544;})['then'](respondWithFilteredResult(_0xaf5bea,_0xfaa36))[_0x031f('0x45')](handleError(_0xaf5bea,null));};exports[_0x031f('0x46')]=function(_0x4d701e,_0x12279a){var _0x505e93={'raw':!![],'where':{'id':_0x4d701e[_0x031f('0x47')]['id']}},_0x456a98={};_0x456a98['model']=_[_0x031f('0x32')](db[_0x031f('0x2c')][_0x031f('0x2d')]);_0x456a98['query']=_[_0x031f('0x32')](_0x4d701e[_0x031f('0x33')]);_0x456a98[_0x031f('0x34')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],_0x456a98[_0x031f('0x33')]);_0x505e93[_0x031f('0x36')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],qs['fields'](_0x4d701e[_0x031f('0x33')][_0x031f('0x37')]));_0x505e93[_0x031f('0x36')]=_0x505e93[_0x031f('0x36')][_0x031f('0x38')]?_0x505e93[_0x031f('0x36')]:_0x456a98[_0x031f('0x31')];if(_0x4d701e[_0x031f('0x33')][_0x031f('0x41')]){_0x505e93['include']=[{'all':!![]}];}_0x505e93=_[_0x031f('0x3e')]({},_0x505e93,_0x4d701e['options']);return db['CmHopperFinal'][_0x031f('0x48')](_0x505e93)[_0x031f('0x26')](handleEntityNotFound(_0x12279a,null))[_0x031f('0x26')](respondWithResult(_0x12279a,null))[_0x031f('0x45')](handleError(_0x12279a,null));};exports[_0x031f('0x49')]=function(_0x553f01,_0x309642){return db[_0x031f('0x2c')][_0x031f('0x49')]()['then'](respondWithResult(_0x309642,null))[_0x031f('0x45')](handleError(_0x309642,null));};exports[_0x031f('0x24')]=function(_0x2dba78,_0x318829){if(_0x2dba78[_0x031f('0x4a')][_0x031f('0x4b')]){delete _0x2dba78['body']['uniqueid'];}return db[_0x031f('0x2c')]['find']({'where':{'uniqueid':_0x2dba78[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x318829,null))['then'](saveUpdates(_0x2dba78[_0x031f('0x4a')],null))['then'](respondWithResult(_0x318829,null))['catch'](handleError(_0x318829,null));};exports[_0x031f('0x4c')]=function(_0x48ca85,_0x16bade,_0x57e9dc){return db[_0x031f('0x2c')][_0x031f('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x48ca85['params']['id']},'attributes':[[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x4f')))),'noSuchContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0x031f('0x51')],[db['sequelize']['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')](_0x031f('0x52')))),'busyContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x031f('0x53')],[db['sequelize']['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x54')))),_0x031f('0x55')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x56')))),_0x031f('0x57')],[db[_0x031f('0x4d')]['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x58')))),_0x031f('0x59')]]})[_0x031f('0x26')](handleEntityNotFound(_0x16bade,null))[_0x031f('0x26')](respondWithResult(_0x16bade,null))['catch'](handleError(_0x16bade,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4b5db9,_0x4e2d0d,_0x9f76f3){return db[_0x031f('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5db9[_0x031f('0x47')]['id']},'attributes':[[db[_0x031f('0x4d')]['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x4f')))),_0x031f('0x5a')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x5b')))),'noAnswerContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x031f('0x52')))),_0x031f('0x5c')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x031f('0x53')],[db['sequelize']['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x5d')))),_0x031f('0x5e')],[db['sequelize']['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')](_0x031f('0x54')))),'abandonedContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x58')))),_0x031f('0x59')]]})[_0x031f('0x26')](handleEntityNotFound(_0x4e2d0d,null))['then'](respondWithResult(_0x4e2d0d,null))['catch'](handleError(_0x4e2d0d,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5ddf46,_0x2e3582,_0x14b33e){return db[_0x031f('0x5f')]['find']({'where':{'id':_0x5ddf46[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x2e3582,null))['then'](function(_0x76253){var _0x2c15f4;if(_0x76253){_0x2c15f4=squel[_0x031f('0x60')]()[_0x031f('0x61')](_0x031f('0x62'))[_0x031f('0x63')]([_0x031f('0x64'),'scheduledAt','ContactId',_0x031f('0x65'),'VoiceQueueId',_0x031f('0x66'),'updatedAt'],squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x69'),'phone')[_0x031f('0x68')]('NOW()',_0x031f('0x6a'))[_0x031f('0x68')](_0x031f('0x6b'),'ContactId')[_0x031f('0x68')](_0x031f('0x6c'),_0x031f('0x65'))[_0x031f('0x68')](_0x031f('0x6d'),'VoiceQueueId')['field'](_0x031f('0x6e'),_0x031f('0x66'))['field'](_0x031f('0x6e'),'updatedAt')[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46['params']['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x73'),_0x5ddf46['body'][_0x031f('0x74')][_0x031f('0x72')]())['where'](_0x031f('0x75'))[_0x031f('0x3d')](_0x031f('0x76'),squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x64'))[_0x031f('0x6f')]('cm_hopper')[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46[_0x031f('0x47')]['id']['toString']()))['where'](_0x031f('0x76'),squel['select']()['field'](_0x031f('0x77'))[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46[_0x031f('0x47')]['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x78')))[_0x031f('0x79')](_0x031f('0x7a')))['toString']();return db[_0x031f('0x4d')][_0x031f('0x33')](_0x2c15f4);}return[];})[_0x031f('0x26')](respondWithResult(_0x2e3582,null))[_0x031f('0x45')](handleError(_0x2e3582,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x6970f5,_0x5329c2,_0x4a40ad){return db[_0x031f('0x7b')][_0x031f('0x48')]({'where':{'id':_0x6970f5['params']['id']}})['then'](handleEntityNotFound(_0x5329c2,null))[_0x031f('0x26')](function(_0x62016){var _0x1c4561;if(_0x62016){_0x1c4561=squel[_0x031f('0x60')]()[_0x031f('0x61')](_0x031f('0x62'))['fromQuery']([_0x031f('0x64'),_0x031f('0x6a'),'ContactId',_0x031f('0x65'),_0x031f('0x7c'),_0x031f('0x66'),_0x031f('0x7d')],squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x69'),'phone')[_0x031f('0x68')]('NOW()',_0x031f('0x6a'))[_0x031f('0x68')](_0x031f('0x6b'),'ContactId')['field']('ANY_VALUE(ListId)',_0x031f('0x65'))[_0x031f('0x68')](_0x031f('0x7e'),_0x031f('0x7c'))[_0x031f('0x68')](_0x031f('0x6e'),_0x031f('0x66'))['field']('NOW()',_0x031f('0x7d'))[_0x031f('0x6f')]('cm_hopper_final')[_0x031f('0x3d')]('CampaignId\x20=\x20?',_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]())['where'](_0x031f('0x73'),_0x6970f5[_0x031f('0x4a')]['state'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x75'))['where'](_0x031f('0x76'),squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x64'))[_0x031f('0x6f')](_0x031f('0x62'))['where'](_0x031f('0x7f'),_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]()))[_0x031f('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x031f('0x67')]()[_0x031f('0x68')]('calleridnum')[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x7f'),_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x78')))[_0x031f('0x79')](_0x031f('0x7a')))[_0x031f('0x72')]();return db[_0x031f('0x4d')][_0x031f('0x33')](_0x1c4561);}return[];})[_0x031f('0x26')](respondWithResult(_0x5329c2,null))[_0x031f('0x45')](handleError(_0x5329c2,null));};exports['checkContactHopper']=function(_0x1b8494,_0x4368d6,_0xa0c51f){return db[_0x031f('0x80')][_0x031f('0x81')]({'where':{'VoiceQueueId':_0x1b8494[_0x031f('0x4a')]['VoiceQueueId'],'CampaignId':_0x1b8494['body']['CampaignId'],'ContactId':_0x1b8494[_0x031f('0x4a')][_0x031f('0x7a')]}})['then'](handleEntityNotFound(_0x4368d6,null))[_0x031f('0x26')](function(_0x303cfa){if(_0x303cfa){return _0x303cfa;}return null;})[_0x031f('0x26')](respondWithResult(_0x4368d6,null))[_0x031f('0x45')](handleError(_0x4368d6,null));}; \ No newline at end of file +var _0xc6ac=['key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x1f6e3c,_0x568f3e){var _0x3ddd54=function(_0x304dfd){while(--_0x304dfd){_0x1f6e3c['push'](_0x1f6e3c['shift']());}};_0x3ddd54(++_0x568f3e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2fb492,_0x97ccbf){_0x2fb492=_0x2fb492-0x0;var _0x3a432c=_0xc6ac[_0x2fb492];return _0x3a432c;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':!![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 897d807..f04a7a0 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 _0x0e87=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2ab8f5,_0x58d760){var _0x15821c=function(_0x35d27c){while(--_0x35d27c){_0x2ab8f5['push'](_0x2ab8f5['shift']());}};_0x15821c(++_0x58d760);}(_0x0e87,0x1ab));var _0x70e8=function(_0x2226c2,_0x46b004){_0x2226c2=_0x2226c2-0x0;var _0x2af566=_0x0e87[_0x2226c2];return _0x2af566;};'use strict';var _=require(_0x70e8('0x0'));var util=require(_0x70e8('0x1'));var logger=require(_0x70e8('0x2'))(_0x70e8('0x3'));var moment=require(_0x70e8('0x4'));var BPromise=require(_0x70e8('0x5'));var rp=require(_0x70e8('0x6'));var fs=require('fs');var path=require(_0x70e8('0x7'));var rimraf=require(_0x70e8('0x8'));var config=require(_0x70e8('0x9'));var attributes=require('./cmHopperFinal.attributes');module[_0x70e8('0xa')]=function(_0x23c742,_0x31d952){return _0x23c742[_0x70e8('0xb')](_0x70e8('0xc'),attributes,{'tableName':_0x70e8('0xd'),'paranoid':![],'indexes':[{'name':_0x70e8('0xe'),'fields':['calleridnum']},{'name':_0x70e8('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb62d=['define','CmHopperFinal','cm_hopper_final','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xb62d,0x12f));var _0xdb62=function(_0x575b25,_0x578b32){_0x575b25=_0x575b25-0x0;var _0x4f68ee=_0xb62d[_0x575b25];return _0x4f68ee;};'use strict';var _=require('lodash');var util=require(_0xdb62('0x0'));var logger=require(_0xdb62('0x1'))('api');var moment=require(_0xdb62('0x2'));var BPromise=require(_0xdb62('0x3'));var rp=require(_0xdb62('0x4'));var fs=require('fs');var path=require(_0xdb62('0x5'));var rimraf=require(_0xdb62('0x6'));var config=require(_0xdb62('0x7'));var attributes=require(_0xdb62('0x8'));module['exports']=function(_0x3dbf57,_0x157063){return _0x3dbf57[_0xdb62('0x9')](_0xdb62('0xa'),attributes,{'tableName':_0xdb62('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0xdb62('0xc'),'fields':[_0xdb62('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 241541a..9a5dacc 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0xc10955,_0x5a8723){var _0x37e2bd=function(_0x3c3dec){while(--_0x3c3dec){_0xc10955['push'](_0xc10955['shift']());}};_0x37e2bd(++_0x5a8723);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a14d2,_0x22b89a){_0x5a14d2=_0x5a14d2-0x0;var _0xb08187=_0xb10b[_0x5a14d2];return _0xb08187;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5d1e0c,_0x19f687){var _0x31029e=function(_0x11a920){while(--_0x11a920){_0x5d1e0c['push'](_0x5d1e0c['shift']());}};_0x31029e(++_0x19f687);}(_0xb10b,0x12a));var _0xbb10=function(_0x2fbb21,_0x1f3785){_0x2fbb21=_0x2fbb21-0x0;var _0x1caa91=_0xb10b[_0x2fbb21];return _0x1caa91;};'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 3070219..d5fb453 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 _0x15b9=['/voice/campaign/moveContacts/:id','checkContactHopper','put','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post'];(function(_0x4f9458,_0x24f0a0){var _0x92ecd3=function(_0x56cf86){while(--_0x56cf86){_0x4f9458['push'](_0x4f9458['shift']());}};_0x92ecd3(++_0x24f0a0);}(_0x15b9,0xb4));var _0x915b=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x15b9[_0x3207aa];return _0x51758f;};'use strict';var multer=require('multer');var util=require(_0x915b('0x0'));var path=require('path');var timeout=require(_0x915b('0x1'));var express=require(_0x915b('0x2'));var router=express[_0x915b('0x3')]();var fs_extra=require(_0x915b('0x4'));var auth=require(_0x915b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x915b('0x6'));var controller=require(_0x915b('0x7'));router[_0x915b('0x8')]('/',auth[_0x915b('0x9')](),controller[_0x915b('0xa')]);router[_0x915b('0x8')](_0x915b('0xb'),auth[_0x915b('0x9')](),controller['describe']);router[_0x915b('0x8')](_0x915b('0xc'),auth['isAuthenticated'](),controller[_0x915b('0xd')]);router[_0x915b('0x8')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x915b('0xe')]);router['get'](_0x915b('0xf'),auth[_0x915b('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x915b('0x10'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x915b('0x11')](_0x915b('0x12'),auth[_0x915b('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x915b('0x11')]('/checkContactHopper',auth[_0x915b('0x9')](),controller[_0x915b('0x13')]);router[_0x915b('0x14')](_0x915b('0xc'),auth[_0x915b('0x9')](),controller[_0x915b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x60d7=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x60d7,0x149));var _0x760d=function(_0x5817ee,_0x4b96cb){_0x5817ee=_0x5817ee-0x0;var _0x58dccf=_0x60d7[_0x5817ee];return _0x58dccf;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require(_0x760d('0x2'));var timeout=require(_0x760d('0x3'));var express=require(_0x760d('0x4'));var router=express[_0x760d('0x5')]();var fs_extra=require(_0x760d('0x6'));var auth=require(_0x760d('0x7'));var interaction=require(_0x760d('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x760d('0x9')]('/',auth[_0x760d('0xa')](),controller[_0x760d('0xb')]);router[_0x760d('0x9')](_0x760d('0xc'),auth[_0x760d('0xa')](),controller[_0x760d('0xd')]);router[_0x760d('0x9')](_0x760d('0xe'),auth[_0x760d('0xa')](),controller[_0x760d('0xf')]);router[_0x760d('0x9')](_0x760d('0x10'),auth['isAuthenticated'](),controller[_0x760d('0x11')]);router[_0x760d('0x9')](_0x760d('0x12'),auth[_0x760d('0xa')](),controller[_0x760d('0x13')]);router['post'](_0x760d('0x14'),auth[_0x760d('0xa')](),controller[_0x760d('0x15')]);router[_0x760d('0x16')](_0x760d('0x17'),auth[_0x760d('0xa')](),controller[_0x760d('0x18')]);router[_0x760d('0x16')](_0x760d('0x19'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x760d('0x1a')]('/:id',auth[_0x760d('0xa')](),controller['update']);module[_0x760d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 665fb61..41c191c 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 _0xd2f5=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x148285,_0x36e6c1){var _0x5588cc=function(_0x14a39a){while(--_0x14a39a){_0x148285['push'](_0x148285['shift']());}};_0x5588cc(++_0x36e6c1);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x33484b,_0x5173c3){_0x33484b=_0x33484b-0x0;var _0x4faab4=_0xd2f5[_0x33484b];return _0x4faab4;};'use strict';var Sequelize=require(_0x5d2f('0x0'));module[_0x5d2f('0x1')]={'state':{'type':Sequelize[_0x5d2f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5d2f('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5d2f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d2f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d2f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5d2f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5d2f('0x3')]},'calleridname':{'type':Sequelize[_0x5d2f('0x3')]},'starttime':{'type':Sequelize[_0x5d2f('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5d2f('0x4')]},'droptime':{'type':Sequelize[_0x5d2f('0x4')]},'endtime':{'type':Sequelize[_0x5d2f('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d2f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d2f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5d2f('0x3')]},'campaigntype':{'type':Sequelize[_0x5d2f('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5d2f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5d2f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d2f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d2f('0x4')]},'recallme':{'type':Sequelize[_0x5d2f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d2f('0x4')]},'edited':{'type':Sequelize[_0x5d2f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5d2f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d2f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4cad=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4980f0,_0x575758){var _0x4b3d76=function(_0x5182a7){while(--_0x5182a7){_0x4980f0['push'](_0x4980f0['shift']());}};_0x4b3d76(++_0x575758);}(_0x4cad,0x179));var _0xd4ca=function(_0x352063,_0x2e554e){_0x352063=_0x352063-0x0;var _0x17712b=_0x4cad[_0x352063];return _0x17712b;};'use strict';var Sequelize=require(_0xd4ca('0x0'));module[_0xd4ca('0x1')]={'state':{'type':Sequelize[_0xd4ca('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd4ca('0x3')]},'scheduledat':{'type':Sequelize[_0xd4ca('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd4ca('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd4ca('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd4ca('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd4ca('0x4')]},'endtime':{'type':Sequelize[_0xd4ca('0x4')]},'ringtime':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd4ca('0x3')]},'campaigntype':{'type':Sequelize[_0xd4ca('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd4ca('0x3')]},'amd':{'type':Sequelize[_0xd4ca('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xd4ca('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd4ca('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd4ca('0x4')]},'edited':{'type':Sequelize[_0xd4ca('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd4ca('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd4ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1c6e173..4f2b009 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 _0x53d3=['reject','then','sendStatus','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','uniqueid','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply'];(function(_0x2d8b74,_0x1fb46f){var _0x3014d2=function(_0x13d0fc){while(--_0x13d0fc){_0x2d8b74['push'](_0x2d8b74['shift']());}};_0x3014d2(++_0x1fb46f);}(_0x53d3,0xb2));var _0x353d=function(_0x2a1589,_0x4b8cad){_0x2a1589=_0x2a1589-0x0;var _0x38ea0a=_0x53d3[_0x2a1589];return _0x38ea0a;};'use strict';var emlformat=require(_0x353d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x353d('0x1'));var rp=require(_0x353d('0x2'));var moment=require(_0x353d('0x3'));var BPromise=require(_0x353d('0x4'));var Mustache=require('mustache');var util=require(_0x353d('0x5'));var path=require('path');var sox=require(_0x353d('0x6'));var csv=require(_0x353d('0x7'));var ejs=require(_0x353d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x353d('0x9'));var jsforce=require(_0x353d('0xa'));var deskjs=require(_0x353d('0xb'));var toCsv=require(_0x353d('0x7'));var querystring=require('querystring');var Papa=require(_0x353d('0xc'));var Redis=require('ioredis');var authService=require(_0x353d('0xd'));var qs=require(_0x353d('0xe'));var as=require(_0x353d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x353d('0x10'));var utils=require(_0x353d('0x11'));var config=require(_0x353d('0x12'));var licenseUtil=require(_0x353d('0x13'));var db=require(_0x353d('0x14'))['db'];function respondWithStatusCode(_0x1daf89,_0x18e787){_0x18e787=_0x18e787||0xcc;return function(_0x3bbf70){if(_0x3bbf70){return _0x1daf89['sendStatus'](_0x18e787);}return _0x1daf89[_0x353d('0x15')](_0x18e787)[_0x353d('0x16')]();};}function respondWithResult(_0x3ea5d0,_0x3068b1){_0x3068b1=_0x3068b1||0xc8;return function(_0x55d81b){if(_0x55d81b){return _0x3ea5d0[_0x353d('0x15')](_0x3068b1)[_0x353d('0x17')](_0x55d81b);}};}function respondWithFilteredResult(_0x4a2f1b,_0x1d5214){return function(_0x511862){if(_0x511862){var _0x4b3d98=typeof _0x1d5214[_0x353d('0x18')]===_0x353d('0x19')&&typeof _0x1d5214[_0x353d('0x1a')]===_0x353d('0x19');var _0x2ba251=_0x511862['count'];var _0x42ef1a=_0x4b3d98?0x0:_0x1d5214['offset'];var _0x1612ff=_0x4b3d98?_0x511862[_0x353d('0x1b')]:_0x1d5214[_0x353d('0x18')]+_0x1d5214[_0x353d('0x1a')];var _0xa1c8d1;if(_0x1612ff>=_0x2ba251){_0x1612ff=_0x2ba251;_0xa1c8d1=0xc8;}else{_0xa1c8d1=0xce;}_0x4a2f1b['status'](_0xa1c8d1);return _0x4a2f1b['set']('Content-Range',_0x42ef1a+'-'+_0x1612ff+'/'+_0x2ba251)[_0x353d('0x17')](_0x511862);}return null;};}function patchUpdates(_0x57c07c){return function(_0x1c60a7){try{jsonpatch[_0x353d('0x1c')](_0x1c60a7,_0x57c07c,!![]);}catch(_0x48e438){return BPromise[_0x353d('0x1d')](_0x48e438);}return _0x1c60a7['save']();};}function saveUpdates(_0x16a49e,_0x240e7b){return function(_0x5ced3c){if(_0x5ced3c){return _0x5ced3c['update'](_0x16a49e)['then'](function(_0x3ea0cd){return _0x3ea0cd;});}return null;};}function removeEntity(_0x474523,_0x2f8423){return function(_0x193ffc){if(_0x193ffc){return _0x193ffc['destroy']()[_0x353d('0x1e')](function(){_0x474523[_0x353d('0x15')](0xcc)[_0x353d('0x16')]();});}};}function handleEntityNotFound(_0x388fa6,_0x528a48){return function(_0x5a1ee1){if(!_0x5a1ee1){_0x388fa6[_0x353d('0x1f')](0x194);}return _0x5a1ee1;};}function handleError(_0x42804e,_0xecb504){_0xecb504=_0xecb504||0x1f4;return function(_0x57c2b6){logger[_0x353d('0x20')](_0x57c2b6[_0x353d('0x21')]);if(_0x57c2b6[_0x353d('0x22')]){delete _0x57c2b6['name'];}_0x42804e[_0x353d('0x15')](_0xecb504)[_0x353d('0x23')](_0x57c2b6);};}exports[_0x353d('0x24')]=function(_0x4b8943,_0x4cc2bd){var _0x426f98={},_0x37c7df={},_0x3ba22c={'count':0x0,'rows':[]};var _0x4d6b35=_['map'](db[_0x353d('0x25')][_0x353d('0x26')],function(_0xae725f){return{'name':_0xae725f[_0x353d('0x27')],'type':_0xae725f[_0x353d('0x28')]['key']};});_0x37c7df[_0x353d('0x29')]=_[_0x353d('0x2a')](_0x4d6b35,_0x353d('0x22'));_0x37c7df[_0x353d('0x2b')]=_[_0x353d('0x2c')](_0x4b8943['query']);_0x37c7df['filters']=_[_0x353d('0x2d')](_0x37c7df['model'],_0x37c7df['query']);_0x426f98[_0x353d('0x2e')]=_[_0x353d('0x2d')](_0x37c7df[_0x353d('0x29')],qs['fields'](_0x4b8943[_0x353d('0x2b')][_0x353d('0x2f')]));_0x426f98[_0x353d('0x2e')]=_0x426f98[_0x353d('0x2e')][_0x353d('0x30')]?_0x426f98[_0x353d('0x2e')]:_0x37c7df[_0x353d('0x29')];if(!_0x4b8943[_0x353d('0x2b')]['hasOwnProperty'](_0x353d('0x31'))){_0x426f98[_0x353d('0x1a')]=qs[_0x353d('0x1a')](_0x4b8943['query']['limit']);_0x426f98[_0x353d('0x18')]=qs['offset'](_0x4b8943[_0x353d('0x2b')][_0x353d('0x18')]);}_0x426f98[_0x353d('0x32')]=qs[_0x353d('0x33')](_0x4b8943[_0x353d('0x2b')][_0x353d('0x33')]);_0x426f98[_0x353d('0x34')]=qs[_0x353d('0x35')](_['pick'](_0x4b8943[_0x353d('0x2b')],_0x37c7df['filters']),_0x4d6b35);if(_0x4b8943['query'][_0x353d('0x36')]){_0x426f98[_0x353d('0x34')]=_[_0x353d('0x37')](_0x426f98[_0x353d('0x34')],{'$or':_[_0x353d('0x2a')](_0x4d6b35,function(_0x25eb1a){if(_0x25eb1a[_0x353d('0x28')]!==_0x353d('0x38')){var _0x10a61={};_0x10a61[_0x25eb1a[_0x353d('0x22')]]={'$like':'%'+_0x4b8943[_0x353d('0x2b')][_0x353d('0x36')]+'%'};return _0x10a61;}})});}_0x426f98=_[_0x353d('0x37')]({},_0x426f98,_0x4b8943['options']);var _0x40e184={'where':_0x426f98[_0x353d('0x34')]};return db[_0x353d('0x25')][_0x353d('0x1b')](_0x40e184)[_0x353d('0x1e')](function(_0x380baa){_0x3ba22c[_0x353d('0x1b')]=_0x380baa;if(_0x4b8943[_0x353d('0x2b')][_0x353d('0x39')]){_0x426f98[_0x353d('0x3a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x353d('0x3b')](_0x426f98);})[_0x353d('0x1e')](function(_0xfef054){_0x3ba22c[_0x353d('0x3c')]=_0xfef054;return _0x3ba22c;})[_0x353d('0x1e')](respondWithFilteredResult(_0x4cc2bd,_0x426f98))[_0x353d('0x3d')](handleError(_0x4cc2bd,null));};exports['show']=function(_0x5d7bc0,_0x10cdbb){var _0x14bd28={'raw':!![],'where':{'id':_0x5d7bc0[_0x353d('0x3e')]['id']}},_0x3dac3c={};_0x3dac3c[_0x353d('0x29')]=_['keys'](db['CmHopperHistory'][_0x353d('0x26')]);_0x3dac3c[_0x353d('0x2b')]=_[_0x353d('0x2c')](_0x5d7bc0[_0x353d('0x2b')]);_0x3dac3c[_0x353d('0x35')]=_['intersection'](_0x3dac3c['model'],_0x3dac3c['query']);_0x14bd28[_0x353d('0x2e')]=_[_0x353d('0x2d')](_0x3dac3c[_0x353d('0x29')],qs['fields'](_0x5d7bc0['query'][_0x353d('0x2f')]));_0x14bd28[_0x353d('0x2e')]=_0x14bd28[_0x353d('0x2e')][_0x353d('0x30')]?_0x14bd28[_0x353d('0x2e')]:_0x3dac3c[_0x353d('0x29')];if(_0x5d7bc0[_0x353d('0x2b')]['includeAll']){_0x14bd28[_0x353d('0x3a')]=[{'all':!![]}];}_0x14bd28=_[_0x353d('0x37')]({},_0x14bd28,_0x5d7bc0[_0x353d('0x3f')]);return db[_0x353d('0x25')][_0x353d('0x40')](_0x14bd28)[_0x353d('0x1e')](handleEntityNotFound(_0x10cdbb,null))[_0x353d('0x1e')](respondWithResult(_0x10cdbb,null))[_0x353d('0x3d')](handleError(_0x10cdbb,null));};exports[_0x353d('0x41')]=function(_0x24715b,_0x73480c){return db['CmHopperHistory']['create'](_0x24715b[_0x353d('0x42')],{})[_0x353d('0x1e')](respondWithResult(_0x73480c,0xc9))[_0x353d('0x3d')](handleError(_0x73480c,null));};exports['describe']=function(_0x4551cb,_0x900e4){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x900e4,null))['catch'](handleError(_0x900e4,null));};exports[_0x353d('0x43')]=function(_0x304b0d,_0x5aa55e){if(_0x304b0d['body'][_0x353d('0x44')]){delete _0x304b0d[_0x353d('0x42')][_0x353d('0x44')];}return db[_0x353d('0x25')][_0x353d('0x40')]({'where':{'uniqueid':_0x304b0d[_0x353d('0x3e')]['id']}})[_0x353d('0x1e')](handleEntityNotFound(_0x5aa55e,null))[_0x353d('0x1e')](saveUpdates(_0x304b0d[_0x353d('0x42')],null))[_0x353d('0x1e')](respondWithResult(_0x5aa55e,null))[_0x353d('0x3d')](handleError(_0x5aa55e,null));}; \ No newline at end of file +var _0x5ef8=['update','uniqueid','find','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','CmHopperHistory','catch','params','length','create','body','describe'];(function(_0x1c30d6,_0xffa7d9){var _0x51c7c6=function(_0x2d86b0){while(--_0x2d86b0){_0x1c30d6['push'](_0x1c30d6['shift']());}};_0x51c7c6(++_0xffa7d9);}(_0x5ef8,0x11b));var _0x85ef=function(_0x1e8d03,_0x33fae0){_0x1e8d03=_0x1e8d03-0x0;var _0x225ee9=_0x5ef8[_0x1e8d03];return _0x225ee9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85ef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x85ef('0x1'));var moment=require(_0x85ef('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x85ef('0x3'));var util=require(_0x85ef('0x4'));var path=require(_0x85ef('0x5'));var sox=require('sox');var csv=require(_0x85ef('0x6'));var ejs=require(_0x85ef('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ef('0x8'));var squel=require(_0x85ef('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x85ef('0xa'));var toCsv=require(_0x85ef('0x6'));var querystring=require(_0x85ef('0xb'));var Papa=require(_0x85ef('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x85ef('0xd'));var as=require(_0x85ef('0xe'));var hardwareService=require(_0x85ef('0xf'));var logger=require(_0x85ef('0x10'))(_0x85ef('0x11'));var utils=require(_0x85ef('0x12'));var config=require(_0x85ef('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551cb1,_0x57e868){_0x57e868=_0x57e868||0xcc;return function(_0x55ec47){if(_0x55ec47){return _0x551cb1[_0x85ef('0x14')](_0x57e868);}return _0x551cb1[_0x85ef('0x15')](_0x57e868)[_0x85ef('0x16')]();};}function respondWithResult(_0x573b6f,_0x38fc1d){_0x38fc1d=_0x38fc1d||0xc8;return function(_0x44048a){if(_0x44048a){return _0x573b6f['status'](_0x38fc1d)['json'](_0x44048a);}};}function respondWithFilteredResult(_0x2a79c3,_0x33b5fc){return function(_0x273ab8){if(_0x273ab8){var _0x481d19=typeof _0x33b5fc['offset']===_0x85ef('0x17')&&typeof _0x33b5fc[_0x85ef('0x18')]===_0x85ef('0x17');var _0x3746c0=_0x273ab8[_0x85ef('0x19')];var _0x3fc1cc=_0x481d19?0x0:_0x33b5fc[_0x85ef('0x1a')];var _0x2f6478=_0x481d19?_0x273ab8[_0x85ef('0x19')]:_0x33b5fc[_0x85ef('0x1a')]+_0x33b5fc[_0x85ef('0x18')];var _0x2f5d44;if(_0x2f6478>=_0x3746c0){_0x2f6478=_0x3746c0;_0x2f5d44=0xc8;}else{_0x2f5d44=0xce;}_0x2a79c3[_0x85ef('0x15')](_0x2f5d44);return _0x2a79c3[_0x85ef('0x1b')](_0x85ef('0x1c'),_0x3fc1cc+'-'+_0x2f6478+'/'+_0x3746c0)[_0x85ef('0x1d')](_0x273ab8);}return null;};}function patchUpdates(_0x2acc4e){return function(_0x477252){try{jsonpatch[_0x85ef('0x1e')](_0x477252,_0x2acc4e,!![]);}catch(_0x91ca0d){return BPromise[_0x85ef('0x1f')](_0x91ca0d);}return _0x477252['save']();};}function saveUpdates(_0xec42d6,_0x119843){return function(_0x130d6c){if(_0x130d6c){return _0x130d6c['update'](_0xec42d6)[_0x85ef('0x20')](function(_0x3a9c34){return _0x3a9c34;});}return null;};}function removeEntity(_0x1f504c,_0x33dc74){return function(_0x21081a){if(_0x21081a){return _0x21081a[_0x85ef('0x21')]()['then'](function(){_0x1f504c[_0x85ef('0x15')](0xcc)[_0x85ef('0x16')]();});}};}function handleEntityNotFound(_0xde0de4,_0x4a8060){return function(_0xf9d51a){if(!_0xf9d51a){_0xde0de4[_0x85ef('0x14')](0x194);}return _0xf9d51a;};}function handleError(_0x13dd69,_0x134a7c){_0x134a7c=_0x134a7c||0x1f4;return function(_0xb2097c){logger[_0x85ef('0x22')](_0xb2097c[_0x85ef('0x23')]);if(_0xb2097c[_0x85ef('0x24')]){delete _0xb2097c[_0x85ef('0x24')];}_0x13dd69[_0x85ef('0x15')](_0x134a7c)[_0x85ef('0x25')](_0xb2097c);};}exports[_0x85ef('0x26')]=function(_0x2114e0,_0x3d3c5b){var _0x51559e={},_0x31b271={},_0x41b488={'count':0x0,'rows':[]};var _0x105065=_[_0x85ef('0x27')](db['CmHopperHistory'][_0x85ef('0x28')],function(_0x3826cc){return{'name':_0x3826cc['fieldName'],'type':_0x3826cc[_0x85ef('0x29')][_0x85ef('0x2a')]};});_0x31b271[_0x85ef('0x2b')]=_['map'](_0x105065,_0x85ef('0x24'));_0x31b271[_0x85ef('0x2c')]=_[_0x85ef('0x2d')](_0x2114e0['query']);_0x31b271[_0x85ef('0x2e')]=_[_0x85ef('0x2f')](_0x31b271[_0x85ef('0x2b')],_0x31b271[_0x85ef('0x2c')]);_0x51559e[_0x85ef('0x30')]=_[_0x85ef('0x2f')](_0x31b271['model'],qs[_0x85ef('0x31')](_0x2114e0[_0x85ef('0x2c')][_0x85ef('0x31')]));_0x51559e[_0x85ef('0x30')]=_0x51559e[_0x85ef('0x30')]['length']?_0x51559e[_0x85ef('0x30')]:_0x31b271[_0x85ef('0x2b')];if(!_0x2114e0[_0x85ef('0x2c')][_0x85ef('0x32')]('nolimit')){_0x51559e[_0x85ef('0x18')]=qs['limit'](_0x2114e0[_0x85ef('0x2c')]['limit']);_0x51559e['offset']=qs[_0x85ef('0x1a')](_0x2114e0[_0x85ef('0x2c')][_0x85ef('0x1a')]);}_0x51559e[_0x85ef('0x33')]=qs[_0x85ef('0x34')](_0x2114e0[_0x85ef('0x2c')][_0x85ef('0x34')]);_0x51559e[_0x85ef('0x35')]=qs['filters'](_[_0x85ef('0x36')](_0x2114e0[_0x85ef('0x2c')],_0x31b271[_0x85ef('0x2e')]),_0x105065);if(_0x2114e0[_0x85ef('0x2c')][_0x85ef('0x37')]){_0x51559e[_0x85ef('0x35')]=_['merge'](_0x51559e[_0x85ef('0x35')],{'$or':_[_0x85ef('0x27')](_0x105065,function(_0xa5db03){if(_0xa5db03[_0x85ef('0x29')]!=='VIRTUAL'){var _0x106342={};_0x106342[_0xa5db03['name']]={'$like':'%'+_0x2114e0[_0x85ef('0x2c')]['filter']+'%'};return _0x106342;}})});}_0x51559e=_[_0x85ef('0x38')]({},_0x51559e,_0x2114e0[_0x85ef('0x39')]);var _0x121448={'where':_0x51559e['where']};return db['CmHopperHistory'][_0x85ef('0x19')](_0x121448)[_0x85ef('0x20')](function(_0x107b88){_0x41b488[_0x85ef('0x19')]=_0x107b88;if(_0x2114e0['query'][_0x85ef('0x3a')]){_0x51559e[_0x85ef('0x3b')]=[{'all':!![]}];}return db[_0x85ef('0x3c')]['findAll'](_0x51559e);})['then'](function(_0x10269a){_0x41b488['rows']=_0x10269a;return _0x41b488;})['then'](respondWithFilteredResult(_0x3d3c5b,_0x51559e))[_0x85ef('0x3d')](handleError(_0x3d3c5b,null));};exports['show']=function(_0x3c2521,_0x2c010e){var _0x23c1fc={'raw':!![],'where':{'id':_0x3c2521[_0x85ef('0x3e')]['id']}},_0x11e829={};_0x11e829['model']=_['keys'](db[_0x85ef('0x3c')][_0x85ef('0x28')]);_0x11e829[_0x85ef('0x2c')]=_[_0x85ef('0x2d')](_0x3c2521[_0x85ef('0x2c')]);_0x11e829[_0x85ef('0x2e')]=_['intersection'](_0x11e829[_0x85ef('0x2b')],_0x11e829[_0x85ef('0x2c')]);_0x23c1fc[_0x85ef('0x30')]=_[_0x85ef('0x2f')](_0x11e829['model'],qs[_0x85ef('0x31')](_0x3c2521[_0x85ef('0x2c')][_0x85ef('0x31')]));_0x23c1fc['attributes']=_0x23c1fc[_0x85ef('0x30')][_0x85ef('0x3f')]?_0x23c1fc[_0x85ef('0x30')]:_0x11e829['model'];if(_0x3c2521[_0x85ef('0x2c')][_0x85ef('0x3a')]){_0x23c1fc[_0x85ef('0x3b')]=[{'all':!![]}];}_0x23c1fc=_['merge']({},_0x23c1fc,_0x3c2521[_0x85ef('0x39')]);return db[_0x85ef('0x3c')]['find'](_0x23c1fc)[_0x85ef('0x20')](handleEntityNotFound(_0x2c010e,null))['then'](respondWithResult(_0x2c010e,null))[_0x85ef('0x3d')](handleError(_0x2c010e,null));};exports[_0x85ef('0x40')]=function(_0x4dfc0b,_0x25c939){return db[_0x85ef('0x3c')][_0x85ef('0x40')](_0x4dfc0b[_0x85ef('0x41')],{})[_0x85ef('0x20')](respondWithResult(_0x25c939,0xc9))[_0x85ef('0x3d')](handleError(_0x25c939,null));};exports[_0x85ef('0x42')]=function(_0x47afa6,_0x493770){return db['CmHopperHistory'][_0x85ef('0x42')]()[_0x85ef('0x20')](respondWithResult(_0x493770,null))[_0x85ef('0x3d')](handleError(_0x493770,null));};exports[_0x85ef('0x43')]=function(_0x2bbcce,_0x14ade3){if(_0x2bbcce[_0x85ef('0x41')][_0x85ef('0x44')]){delete _0x2bbcce[_0x85ef('0x41')]['uniqueid'];}return db[_0x85ef('0x3c')][_0x85ef('0x45')]({'where':{'uniqueid':_0x2bbcce['params']['id']}})[_0x85ef('0x20')](handleEntityNotFound(_0x14ade3,null))['then'](saveUpdates(_0x2bbcce[_0x85ef('0x41')],null))['then'](respondWithResult(_0x14ade3,null))[_0x85ef('0x3d')](handleError(_0x14ade3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2e259e8..c571861 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 _0x1aab=['request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x5eb62c,_0x29e667){var _0x343dda=function(_0x5b4edb){while(--_0x5b4edb){_0x5eb62c['push'](_0x5eb62c['shift']());}};_0x343dda(++_0x29e667);}(_0x1aab,0x122));var _0xb1aa=function(_0x2766b5,_0x4dd625){_0x2766b5=_0x2766b5-0x0;var _0x4b32d9=_0x1aab[_0x2766b5];return _0x4b32d9;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var logger=require(_0xb1aa('0x2'))('api');var moment=require(_0xb1aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1aa('0x4'));var fs=require('fs');var path=require(_0xb1aa('0x5'));var rimraf=require(_0xb1aa('0x6'));var config=require(_0xb1aa('0x7'));var attributes=require(_0xb1aa('0x8'));module['exports']=function(_0x5eb27f,_0x34e0f4){return _0x5eb27f[_0xb1aa('0x9')](_0xb1aa('0xa'),attributes,{'tableName':_0xb1aa('0xb'),'paranoid':![],'indexes':[{'name':_0xb1aa('0xc'),'fields':[_0xb1aa('0xc')]},{'name':_0xb1aa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa32b=['./cmHopperHistory.attributes','exports','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa32b,0x68));var _0xba32=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xa32b[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var logger=require(_0xba32('0x1'))('api');var moment=require('moment');var BPromise=require(_0xba32('0x2'));var rp=require(_0xba32('0x3'));var fs=require('fs');var path=require(_0xba32('0x4'));var rimraf=require('rimraf');var config=require(_0xba32('0x5'));var attributes=require(_0xba32('0x6'));module[_0xba32('0x7')]=function(_0x312fe7,_0x31dc74){return _0x312fe7['define'](_0xba32('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xba32('0x9'),'fields':[_0xba32('0x9')]},{'name':_0xba32('0xa'),'fields':[_0xba32('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2cf7b64..c16cbea 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 _0x8305=['AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','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','ivrAnswerCallsDay','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit'];(function(_0x293354,_0x1da2f9){var _0x52a85a=function(_0x11bb8d){while(--_0x11bb8d){_0x293354['push'](_0x293354['shift']());}};_0x52a85a(++_0x1da2f9);}(_0x8305,0x1d3));var _0x5830=function(_0xf17e7f,_0x5ee166){_0xf17e7f=_0xf17e7f-0x0;var _0x25d6d9=_0x8305[_0xf17e7f];return _0x25d6d9;};'use strict';var _=require(_0x5830('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5830('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5830('0x2'));var db=require(_0x5830('0x3'))['db'];var utils=require(_0x5830('0x4'));var logger=require(_0x5830('0x5'))(_0x5830('0x6'));var config=require(_0x5830('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5830('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5298fb,_0x51e44f,_0x1dc85c){return new BPromise(function(_0x34809a,_0x4bb686){return client[_0x5830('0x9')](_0x5298fb,_0x1dc85c)[_0x5830('0xa')](function(_0x19b969){logger['info'](_0x5830('0xb'),_0x51e44f,'request\x20sent');logger[_0x5830('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x51e44f,'request\x20sent',JSON['stringify'](_0x19b969));if(_0x19b969[_0x5830('0xd')]){if(_0x19b969[_0x5830('0xd')][_0x5830('0xe')]===0x1f4){logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x4bb686(_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);}logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x34809a(_0x19b969[_0x5830('0xd')]['message']);}else{logger[_0x5830('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x51e44f,_0x5830('0x11'));_0x34809a(_0x19b969['result'][_0x5830('0xf')]);}})[_0x5830('0x12')](function(_0x37a8e2){logger['error'](_0x5830('0xb'),_0x51e44f,_0x37a8e2);_0x4bb686(_0x37a8e2);});});}exports['CreateCmHopperHistory']=function(_0x1d3450){var _0x55f311=this;return new Promise(function(_0x3e5ae3,_0x28b58f){return db[_0x5830('0x13')]['create'](_0x1d3450[_0x5830('0x14')],{'raw':_0x1d3450[_0x5830('0x15')]?_0x1d3450[_0x5830('0x15')][_0x5830('0x16')]===undefined?!![]:![]:!![]})[_0x5830('0xa')](function(_0x155c22){logger[_0x5830('0x10')](_0x5830('0x17'),_0x1d3450);logger[_0x5830('0xc')](_0x5830('0x17'),_0x1d3450,JSON['stringify'](_0x155c22));_0x3e5ae3(_0x155c22);})['catch'](function(_0x283c70){logger[_0x5830('0xd')](_0x5830('0x17'),_0x283c70[_0x5830('0xf')],_0x1d3450);_0x28b58f(_0x55f311[_0x5830('0xd')](0x1f4,_0x283c70[_0x5830('0xf')]));});});};exports[_0x5830('0x18')]=function(_0x3d4197){var _0x2c6787=this;return new Promise(function(_0x3e3499,_0x1fcf2f){return db[_0x5830('0x13')][_0x5830('0x19')]({'raw':_0x3d4197[_0x5830('0x15')]?_0x3d4197[_0x5830('0x15')][_0x5830('0x16')]===undefined?!![]:![]:!![],'where':_0x3d4197[_0x5830('0x15')]?_0x3d4197['options'][_0x5830('0x1a')]||null:null,'attributes':[[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')][_0x5830('0x1d')]('id')),_0x5830('0x1e')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x20')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x21')))),_0x5830('0x22')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db['sequelize'][_0x5830('0x1f')](_0x5830('0x23')))),_0x5830('0x24')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x25'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x26')))),_0x5830('0x27')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x25'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x28')))),_0x5830('0x29')]]})[_0x5830('0xa')](function(_0x174161){logger[_0x5830('0x10')](_0x5830('0x18'),_0x3d4197);logger[_0x5830('0xc')](_0x5830('0x18'),_0x3d4197,JSON[_0x5830('0x2a')](_0x174161));_0x3e3499(_0x174161);})[_0x5830('0x12')](function(_0x5b946d){logger['error'](_0x5830('0x18'),_0x5b946d[_0x5830('0xf')],_0x3d4197);_0x1fcf2f(_0x2c6787[_0x5830('0xd')](0x1f4,_0x5b946d[_0x5830('0xf')]));});});};exports[_0x5830('0x2b')]=function(_0xf2e3a3){var _0x11bf2c=this;return new Promise(function(_0x324e26,_0x3f1fbf){return db[_0x5830('0x13')]['findAll']({'raw':_0xf2e3a3['options']?_0xf2e3a3['options'][_0x5830('0x16')]===undefined?!![]:![]:!![],'where':_0xf2e3a3[_0x5830('0x15')]?_0xf2e3a3['options'][_0x5830('0x1a')]||null:null,'attributes':[[_0x5830('0x2c'),_0x5830('0x2d')],[db['sequelize']['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x5830('0x1f')](_0x5830('0x2e')))),_0x5830('0x2f')],[db[_0x5830('0x1b')]['fn']('COUNT',db[_0x5830('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x5830('0x30')))),_0x5830('0x31')],[db['sequelize']['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x20')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x32')))),_0x5830('0x33')],[db['sequelize']['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5830('0x34')))),_0x5830('0x35')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x5830('0x36')))),_0x5830('0x37')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x38')))),_0x5830('0x39')],[db['sequelize']['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x3a')))),_0x5830('0x3b')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x3c')))),_0x5830('0x3d')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x3e')))),_0x5830('0x3f')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x40')))),_0x5830('0x41')],[db['sequelize']['fn']('COUNT',db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x42')))),_0x5830('0x43')],[db['sequelize']['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x44')))),_0x5830('0x45')]],'group':[_0x5830('0x2c')]})[_0x5830('0xa')](function(_0x49bd9e){logger['info'](_0x5830('0x2b'),_0xf2e3a3);logger['debug'](_0x5830('0x2b'),_0xf2e3a3,JSON['stringify'](_0x49bd9e));_0x324e26(_0x49bd9e);})['catch'](function(_0x5317c0){logger[_0x5830('0xd')]('GetVoiceQueueHopperHistory',_0x5317c0[_0x5830('0xf')],_0xf2e3a3);_0x3f1fbf(_0x11bf2c[_0x5830('0xd')](0x1f4,_0x5317c0[_0x5830('0xf')]));});});};exports[_0x5830('0x46')]=function(_0x428604){var _0x1cdc67=this;return new Promise(function(_0x5089c8,_0x184cf5){return db[_0x5830('0x13')][_0x5830('0x19')]({'raw':_0x428604[_0x5830('0x15')]?_0x428604[_0x5830('0x15')][_0x5830('0x16')]===undefined?!![]:![]:!![],'where':_0x428604['options']?_0x428604['options'][_0x5830('0x1a')]||null:null,'attributes':[[_0x5830('0x2c'),_0x5830('0x2d')],[db[_0x5830('0x1b')]['fn']('COUNT',db[_0x5830('0x1b')][_0x5830('0x1d')]('id')),'ivrTotalCallsDays'],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x20')))),_0x5830('0x47')]],'group':[_0x5830('0x2c')]})[_0x5830('0xa')](function(_0x1f2a92){logger[_0x5830('0x10')]('GetCampaignHopperHistory',_0x428604);logger['debug'](_0x5830('0x46'),_0x428604,JSON[_0x5830('0x2a')](_0x1f2a92));_0x5089c8(_0x1f2a92);})['catch'](function(_0xd7809b){logger['error'](_0x5830('0x46'),_0xd7809b[_0x5830('0xf')],_0x428604);_0x184cf5(_0x1cdc67['error'](0x1f4,_0xd7809b[_0x5830('0xf')]));});});}; \ No newline at end of file +var _0xc302=['request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x5c4d11,_0x3e1fce){var _0x546b4f=function(_0xd47c4c){while(--_0xd47c4c){_0x5c4d11['push'](_0x5c4d11['shift']());}};_0x546b4f(++_0x3e1fce);}(_0xc302,0x17e));var _0x2c30=function(_0x5509eb,_0x594c5b){_0x5509eb=_0x5509eb-0x0;var _0x458667=_0xc302[_0x5509eb];return _0x458667;};'use strict';var _=require(_0x2c30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c30('0x2'));var db=require(_0x2c30('0x3'))['db'];var utils=require(_0x2c30('0x4'));var logger=require(_0x2c30('0x5'))('rpc');var config=require(_0x2c30('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2c30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc9dd1e,_0xb41008,_0x387f98){return new BPromise(function(_0x4c48cd,_0x3fcac2){return client[_0x2c30('0x8')](_0xc9dd1e,_0x387f98)[_0x2c30('0x9')](function(_0xf52da4){logger[_0x2c30('0xa')](_0x2c30('0xb'),_0xb41008,_0x2c30('0xc'));logger[_0x2c30('0xd')](_0x2c30('0xe'),_0xb41008,_0x2c30('0xc'),JSON[_0x2c30('0xf')](_0xf52da4));if(_0xf52da4[_0x2c30('0x10')]){if(_0xf52da4[_0x2c30('0x10')][_0x2c30('0x11')]===0x1f4){logger[_0x2c30('0x10')](_0x2c30('0xb'),_0xb41008,_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);return _0x3fcac2(_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);}logger[_0x2c30('0x10')](_0x2c30('0xb'),_0xb41008,_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);return _0x4c48cd(_0xf52da4[_0x2c30('0x10')][_0x2c30('0x12')]);}else{logger[_0x2c30('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0xb41008,_0x2c30('0xc'));_0x4c48cd(_0xf52da4[_0x2c30('0x13')][_0x2c30('0x12')]);}})[_0x2c30('0x14')](function(_0x24a1f2){logger[_0x2c30('0x10')](_0x2c30('0xb'),_0xb41008,_0x24a1f2);_0x3fcac2(_0x24a1f2);});});}exports[_0x2c30('0x15')]=function(_0x369dab){var _0x3b1914=this;return new Promise(function(_0x4e73d3,_0x164a24){return db[_0x2c30('0x16')][_0x2c30('0x17')](_0x369dab[_0x2c30('0x18')],{'raw':_0x369dab[_0x2c30('0x19')]?_0x369dab[_0x2c30('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2c30('0x9')](function(_0x2ed7d8){logger[_0x2c30('0xa')]('CreateCmHopperHistory',_0x369dab);logger[_0x2c30('0xd')](_0x2c30('0x15'),_0x369dab,JSON[_0x2c30('0xf')](_0x2ed7d8));_0x4e73d3(_0x2ed7d8);})['catch'](function(_0x85e21){logger[_0x2c30('0x10')](_0x2c30('0x15'),_0x85e21[_0x2c30('0x12')],_0x369dab);_0x164a24(_0x3b1914[_0x2c30('0x10')](0x1f4,_0x85e21['message']));});});};exports[_0x2c30('0x1a')]=function(_0x2cae4f){var _0x1aaddf=this;return new Promise(function(_0x15cd29,_0x15dca1){return db[_0x2c30('0x16')][_0x2c30('0x1b')]({'raw':_0x2cae4f[_0x2c30('0x19')]?_0x2cae4f[_0x2c30('0x19')][_0x2c30('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cae4f[_0x2c30('0x19')]?_0x2cae4f[_0x2c30('0x19')][_0x2c30('0x1d')]||null:null,'attributes':[[db[_0x2c30('0x1e')]['fn']('COUNT',db[_0x2c30('0x1e')][_0x2c30('0x1f')]('id')),_0x2c30('0x20')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x23')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x24')))),_0x2c30('0x25')],[db['sequelize']['fn'](_0x2c30('0x26'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')]['literal'](_0x2c30('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x2c30('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x2c30('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x2c30('0x9')](function(_0x20d889){logger['info'](_0x2c30('0x1a'),_0x2cae4f);logger[_0x2c30('0xd')](_0x2c30('0x1a'),_0x2cae4f,JSON['stringify'](_0x20d889));_0x15cd29(_0x20d889);})[_0x2c30('0x14')](function(_0x2c0cd6){logger[_0x2c30('0x10')](_0x2c30('0x1a'),_0x2c0cd6['message'],_0x2cae4f);_0x15dca1(_0x1aaddf[_0x2c30('0x10')](0x1f4,_0x2c0cd6[_0x2c30('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x11f1db){var _0x4cf056=this;return new Promise(function(_0x17d6fd,_0x238f29){return db[_0x2c30('0x16')][_0x2c30('0x1b')]({'raw':_0x11f1db[_0x2c30('0x19')]?_0x11f1db['options'][_0x2c30('0x1c')]===undefined?!![]:![]:!![],'where':_0x11f1db[_0x2c30('0x19')]?_0x11f1db['options'][_0x2c30('0x1d')]||null:null,'attributes':[[_0x2c30('0x28'),_0x2c30('0x29')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x2a')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db[_0x2c30('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x2c30('0x1e')]['fn']('COUNT',db[_0x2c30('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x2c30('0x2b')],[db[_0x2c30('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x2c')))),_0x2c30('0x2d')],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x2e')))),_0x2c30('0x2f')],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x30')))),'outboundDropCallsDayTimeout'],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2c30('0x31')))),_0x2c30('0x32')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x33')))),_0x2c30('0x34')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')](_0x2c30('0x35')))),_0x2c30('0x36')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x2c30('0x37')))),_0x2c30('0x38')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2c30('0x39')))),_0x2c30('0x3a')],[db[_0x2c30('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x2c30('0x3b')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')]['literal'](_0x2c30('0x3c')))),_0x2c30('0x3a')],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x2c30('0x22')](_0x2c30('0x3d')))),_0x2c30('0x3e')]],'group':['campaign']})[_0x2c30('0x9')](function(_0xdde5dc){logger[_0x2c30('0xa')]('GetVoiceQueueHopperHistory',_0x11f1db);logger[_0x2c30('0xd')](_0x2c30('0x3f'),_0x11f1db,JSON[_0x2c30('0xf')](_0xdde5dc));_0x17d6fd(_0xdde5dc);})['catch'](function(_0x36a0c2){logger[_0x2c30('0x10')](_0x2c30('0x3f'),_0x36a0c2[_0x2c30('0x12')],_0x11f1db);_0x238f29(_0x4cf056[_0x2c30('0x10')](0x1f4,_0x36a0c2['message']));});});};exports[_0x2c30('0x40')]=function(_0xe4141a){var _0x3d50aa=this;return new Promise(function(_0x3d8960,_0x395af8){return db[_0x2c30('0x16')]['findAll']({'raw':_0xe4141a[_0x2c30('0x19')]?_0xe4141a[_0x2c30('0x19')][_0x2c30('0x1c')]===undefined?!![]:![]:!![],'where':_0xe4141a[_0x2c30('0x19')]?_0xe4141a[_0x2c30('0x19')][_0x2c30('0x1d')]||null:null,'attributes':[[_0x2c30('0x28'),_0x2c30('0x29')],[db['sequelize']['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')][_0x2c30('0x1f')]('id')),'ivrTotalCallsDays'],[db[_0x2c30('0x1e')]['fn'](_0x2c30('0x21'),db[_0x2c30('0x1e')]['fn']('IF',db[_0x2c30('0x1e')][_0x2c30('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x2c30('0x28')]})[_0x2c30('0x9')](function(_0x3e9299){logger[_0x2c30('0xa')]('GetCampaignHopperHistory',_0xe4141a);logger[_0x2c30('0xd')]('GetCampaignHopperHistory',_0xe4141a,JSON['stringify'](_0x3e9299));_0x3d8960(_0x3e9299);})[_0x2c30('0x14')](function(_0x15d163){logger['error']('GetCampaignHopperHistory',_0x15d163['message'],_0xe4141a);_0x395af8(_0x3d50aa[_0x2c30('0x10')](0x1f4,_0x15d163[_0x2c30('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 1d5aa9b..019c411 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 _0x0697=['get','index','/describe','isAuthenticated','show','create','put','/:id','update','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0xe69da8,_0x308d15){var _0x246bc5=function(_0x4a072b){while(--_0x4a072b){_0xe69da8['push'](_0xe69da8['shift']());}};_0x246bc5(++_0x308d15);}(_0x0697,0x171));var _0x7069=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x0697[_0x23e7c1];return _0x1add43;};'use strict';var multer=require('multer');var util=require(_0x7069('0x0'));var path=require(_0x7069('0x1'));var timeout=require(_0x7069('0x2'));var express=require(_0x7069('0x3'));var router=express['Router']();var fs_extra=require(_0x7069('0x4'));var auth=require(_0x7069('0x5'));var interaction=require(_0x7069('0x6'));var config=require(_0x7069('0x7'));var controller=require(_0x7069('0x8'));router[_0x7069('0x9')]('/',auth['isAuthenticated'](),controller[_0x7069('0xa')]);router[_0x7069('0x9')](_0x7069('0xb'),auth[_0x7069('0xc')](),controller['describe']);router[_0x7069('0x9')]('/:id',auth[_0x7069('0xc')](),controller[_0x7069('0xd')]);router['post']('/',auth[_0x7069('0xc')](),controller[_0x7069('0xe')]);router[_0x7069('0xf')](_0x7069('0x10'),auth[_0x7069('0xc')](),controller[_0x7069('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa857=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','show','post','put','/:id','update','exports','multer','util','path','connect-timeout'];(function(_0x23639f,_0x2d7f88){var _0x16c88b=function(_0x1bee31){while(--_0x1bee31){_0x23639f['push'](_0x23639f['shift']());}};_0x16c88b(++_0x2d7f88);}(_0xa857,0x6e));var _0x7a85=function(_0x3ccdb0,_0x4adc30){_0x3ccdb0=_0x3ccdb0-0x0;var _0x58aa5b=_0xa857[_0x3ccdb0];return _0x58aa5b;};'use strict';var multer=require(_0x7a85('0x0'));var util=require(_0x7a85('0x1'));var path=require(_0x7a85('0x2'));var timeout=require(_0x7a85('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7a85('0x4'));var auth=require(_0x7a85('0x5'));var interaction=require(_0x7a85('0x6'));var config=require(_0x7a85('0x7'));var controller=require(_0x7a85('0x8'));router[_0x7a85('0x9')]('/',auth[_0x7a85('0xa')](),controller[_0x7a85('0xb')]);router['get']('/describe',auth[_0x7a85('0xa')](),controller[_0x7a85('0xc')]);router[_0x7a85('0x9')]('/:id',auth[_0x7a85('0xa')](),controller[_0x7a85('0xd')]);router[_0x7a85('0xe')]('/',auth[_0x7a85('0xa')](),controller['create']);router[_0x7a85('0xf')](_0x7a85('0x10'),auth[_0x7a85('0xa')](),controller[_0x7a85('0x11')]);module[_0x7a85('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4085818..9ddf39c 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 _0x503a=['STRING','sequelize','exports','name'];(function(_0x133e8d,_0x4648f1){var _0x10ce55=function(_0x13e8bd){while(--_0x13e8bd){_0x133e8d['push'](_0x133e8d['shift']());}};_0x10ce55(++_0x4648f1);}(_0x503a,0x19d));var _0xa503=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x503a[_0x142ec2];return _0x45ef4e;};'use strict';var Sequelize=require(_0xa503('0x0'));module[_0xa503('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa503('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xa503('0x3')]}}; \ No newline at end of file +var _0xd58c=['exports','STRING','sequelize'];(function(_0x534fb3,_0x5c3e7f){var _0x217627=function(_0x1c251f){while(--_0x1c251f){_0x534fb3['push'](_0x534fb3['shift']());}};_0x217627(++_0x5c3e7f);}(_0xd58c,0xb6));var _0xcd58=function(_0x2e617d,_0x17c590){_0x2e617d=_0x2e617d-0x0;var _0x34c295=_0xd58c[_0x2e617d];return _0x34c295;};'use strict';var Sequelize=require(_0xcd58('0x0'));module[_0xcd58('0x1')]={'name':{'type':Sequelize[_0xcd58('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcd58('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index da59907..59227b5 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 _0x0010=['send','index','CmList','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','getDispositions','Disposition','nolimit','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','pick','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','item','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','findOne','sequelize','addCustomFields','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:remove','getAgents','User','info','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0x0010,0x1b5));var _0x0001=function(_0x3b9e4e,_0x3db369){_0x3b9e4e=_0x3b9e4e-0x0;var _0x14e6f9=_0x0010[_0x3b9e4e];return _0x14e6f9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0001('0x0'));var jsonpatch=require(_0x0001('0x1'));var rp=require(_0x0001('0x2'));var moment=require(_0x0001('0x3'));var BPromise=require(_0x0001('0x4'));var Mustache=require(_0x0001('0x5'));var util=require('util');var path=require(_0x0001('0x6'));var sox=require(_0x0001('0x7'));var csv=require(_0x0001('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0001('0x9'));var _=require(_0x0001('0xa'));var squel=require(_0x0001('0xb'));var crypto=require(_0x0001('0xc'));var jsforce=require(_0x0001('0xd'));var deskjs=require(_0x0001('0xe'));var toCsv=require(_0x0001('0x8'));var querystring=require(_0x0001('0xf'));var Papa=require('papaparse');var Redis=require(_0x0001('0x10'));var authService=require(_0x0001('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0001('0x12'));var hardwareService=require(_0x0001('0x13'));var logger=require('../../config/logger')(_0x0001('0x14'));var utils=require(_0x0001('0x15'));var config=require(_0x0001('0x16'));var licenseUtil=require(_0x0001('0x17'));var db=require(_0x0001('0x18'))['db'];var csv_results;config[_0x0001('0x19')]=_[_0x0001('0x1a')](config['redis'],{'host':_0x0001('0x1b'),'port':0x18eb});var socket=require(_0x0001('0x1c'))(new Redis(config['redis']));require(_0x0001('0x1d'))[_0x0001('0x1e')](socket);function respondWithStatusCode(_0x51b096,_0x239e99){_0x239e99=_0x239e99||0xcc;return function(_0x298060){if(_0x298060){return _0x51b096[_0x0001('0x1f')](_0x239e99);}return _0x51b096[_0x0001('0x20')](_0x239e99)[_0x0001('0x21')]();};}function respondWithResult(_0x7ae405,_0x32b926){_0x32b926=_0x32b926||0xc8;return function(_0xb3fbd4){if(_0xb3fbd4){return _0x7ae405[_0x0001('0x20')](_0x32b926)[_0x0001('0x22')](_0xb3fbd4);}};}function respondWithFilteredResult(_0x1c73ca,_0x355c24){return function(_0x952ad6){if(_0x952ad6){var _0x3bd705=typeof _0x355c24[_0x0001('0x23')]===_0x0001('0x24')&&typeof _0x355c24[_0x0001('0x25')]===_0x0001('0x24');var _0x58f1fd=_0x952ad6[_0x0001('0x26')];var _0x2e6e3b=_0x3bd705?0x0:_0x355c24[_0x0001('0x23')];var _0x22da72=_0x3bd705?_0x952ad6[_0x0001('0x26')]:_0x355c24[_0x0001('0x23')]+_0x355c24['limit'];var _0x104398;if(_0x22da72>=_0x58f1fd){_0x22da72=_0x58f1fd;_0x104398=0xc8;}else{_0x104398=0xce;}_0x1c73ca[_0x0001('0x20')](_0x104398);return _0x1c73ca[_0x0001('0x27')](_0x0001('0x28'),_0x2e6e3b+'-'+_0x22da72+'/'+_0x58f1fd)[_0x0001('0x22')](_0x952ad6);}return null;};}function patchUpdates(_0x1f0a45){return function(_0x5b77d0){try{jsonpatch['apply'](_0x5b77d0,_0x1f0a45,!![]);}catch(_0x2cd6ef){return BPromise[_0x0001('0x29')](_0x2cd6ef);}return _0x5b77d0[_0x0001('0x2a')]();};}function saveUpdates(_0xd2babb,_0x54063f){return function(_0x808dae){if(_0x808dae){return _0x808dae[_0x0001('0x2b')](_0xd2babb)[_0x0001('0x2c')](function(_0x31b298){return _0x31b298;});}return null;};}function removeEntity(_0x279d14,_0x5d6ea9){return function(_0x1e274c){if(_0x1e274c){return _0x1e274c[_0x0001('0x2d')]()[_0x0001('0x2c')](function(){var _0x29fe6b=_0x1e274c[_0x0001('0x2e')]({'plain':!![]});var _0x1cafcb=_0x0001('0x2f');return db[_0x0001('0x30')][_0x0001('0x2d')]({'where':{'type':_0x1cafcb,'resourceId':_0x29fe6b['id']}})[_0x0001('0x2c')](function(){return _0x1e274c;});})['then'](function(){_0x279d14[_0x0001('0x20')](0xcc)[_0x0001('0x21')]();});}};}function handleEntityNotFound(_0xaa9a4f,_0x46daad){return function(_0x363ace){if(!_0x363ace){_0xaa9a4f[_0x0001('0x1f')](0x194);}return _0x363ace;};}function handleError(_0x12d988,_0x21a1f2){_0x21a1f2=_0x21a1f2||0x1f4;return function(_0x4fd8cb){logger[_0x0001('0x31')](_0x4fd8cb[_0x0001('0x32')]);if(_0x4fd8cb[_0x0001('0x33')]){delete _0x4fd8cb[_0x0001('0x33')];}_0x12d988['status'](_0x21a1f2)[_0x0001('0x34')](_0x4fd8cb);};}exports[_0x0001('0x35')]=function(_0x54201e,_0x5281c2){var _0x494dcc={},_0x189108={},_0x651d0a={'count':0x0,'rows':[]};var _0x32b17a=_['map'](db[_0x0001('0x36')][_0x0001('0x37')],function(_0x11d3b9){return{'name':_0x11d3b9[_0x0001('0x38')],'type':_0x11d3b9[_0x0001('0x39')][_0x0001('0x3a')]};});_0x189108[_0x0001('0x3b')]=_[_0x0001('0x3c')](_0x32b17a,_0x0001('0x33'));_0x189108['query']=_[_0x0001('0x3d')](_0x54201e[_0x0001('0x3e')]);_0x189108[_0x0001('0x3f')]=_['intersection'](_0x189108[_0x0001('0x3b')],_0x189108[_0x0001('0x3e')]);_0x494dcc[_0x0001('0x40')]=_[_0x0001('0x41')](_0x189108[_0x0001('0x3b')],qs[_0x0001('0x42')](_0x54201e[_0x0001('0x3e')][_0x0001('0x42')]));_0x494dcc[_0x0001('0x40')]=_0x494dcc[_0x0001('0x40')][_0x0001('0x43')]?_0x494dcc[_0x0001('0x40')]:_0x189108[_0x0001('0x3b')];if(!_0x54201e[_0x0001('0x3e')][_0x0001('0x44')]('nolimit')){_0x494dcc[_0x0001('0x25')]=qs[_0x0001('0x25')](_0x54201e[_0x0001('0x3e')]['limit']);_0x494dcc['offset']=qs[_0x0001('0x23')](_0x54201e[_0x0001('0x3e')][_0x0001('0x23')]);}_0x494dcc[_0x0001('0x45')]=qs[_0x0001('0x46')](_0x54201e[_0x0001('0x3e')][_0x0001('0x46')]);_0x494dcc[_0x0001('0x47')]=qs[_0x0001('0x3f')](_['pick'](_0x54201e[_0x0001('0x3e')],_0x189108[_0x0001('0x3f')]),_0x32b17a);if(_0x54201e[_0x0001('0x3e')][_0x0001('0x48')]){_0x494dcc[_0x0001('0x47')]=_[_0x0001('0x49')](_0x494dcc['where'],{'$or':_['map'](_0x32b17a,function(_0x5c489c){if(_0x5c489c[_0x0001('0x39')]!==_0x0001('0x4a')){var _0x1e4b37={};_0x1e4b37[_0x5c489c[_0x0001('0x33')]]={'$like':'%'+_0x54201e['query'][_0x0001('0x48')]+'%'};return _0x1e4b37;}})});}_0x494dcc=_['merge']({},_0x494dcc,_0x54201e[_0x0001('0x4b')]);var _0x1fc4cc={'where':_0x494dcc[_0x0001('0x47')]};return db[_0x0001('0x36')][_0x0001('0x26')](_0x1fc4cc)['then'](function(_0x2a8790){_0x651d0a['count']=_0x2a8790;if(_0x54201e[_0x0001('0x3e')]['includeAll']){_0x494dcc[_0x0001('0x4c')]=[{'all':!![]}];}return db[_0x0001('0x36')][_0x0001('0x4d')](_0x494dcc);})[_0x0001('0x2c')](function(_0x432b39){_0x651d0a[_0x0001('0x4e')]=_0x432b39;return _0x651d0a;})[_0x0001('0x2c')](respondWithFilteredResult(_0x5281c2,_0x494dcc))['catch'](handleError(_0x5281c2,null));};exports['show']=function(_0x79e9ea,_0x27bd56){var _0x38a663={'raw':![],'where':{'id':_0x79e9ea[_0x0001('0x4f')]['id']}},_0x4ec367={};_0x4ec367[_0x0001('0x3b')]=_[_0x0001('0x3d')](db[_0x0001('0x36')][_0x0001('0x37')]);_0x4ec367[_0x0001('0x3e')]=_[_0x0001('0x3d')](_0x79e9ea[_0x0001('0x3e')]);_0x4ec367['filters']=_[_0x0001('0x41')](_0x4ec367[_0x0001('0x3b')],_0x4ec367[_0x0001('0x3e')]);_0x38a663[_0x0001('0x40')]=_[_0x0001('0x41')](_0x4ec367['model'],qs[_0x0001('0x42')](_0x79e9ea[_0x0001('0x3e')]['fields']));_0x38a663[_0x0001('0x40')]=_0x38a663[_0x0001('0x40')]['length']?_0x38a663['attributes']:_0x4ec367[_0x0001('0x3b')];if(_0x79e9ea[_0x0001('0x3e')][_0x0001('0x50')]){_0x38a663[_0x0001('0x4c')]=[{'all':!![]}];}_0x38a663=_[_0x0001('0x49')]({},_0x38a663,_0x79e9ea[_0x0001('0x4b')]);return db['CmList'][_0x0001('0x51')](_0x38a663)['then'](handleEntityNotFound(_0x27bd56,null))[_0x0001('0x2c')](respondWithResult(_0x27bd56,null))[_0x0001('0x52')](handleError(_0x27bd56,null));};exports[_0x0001('0x53')]=function(_0x1857d2,_0x475abd){return db[_0x0001('0x36')][_0x0001('0x53')](_0x1857d2[_0x0001('0x54')],{})['then'](function(_0x40cc50){var _0x5d4865=_0x1857d2[_0x0001('0x55')]['get']({'plain':!![]});if(!_0x5d4865)throw new Error(_0x0001('0x56'));if(_0x5d4865[_0x0001('0x57')]==='user'){var _0x3a8c77=_0x40cc50[_0x0001('0x2e')]({'plain':!![]});var _0x49d08d=_0x0001('0x2f');return db['UserProfileSection'][_0x0001('0x51')]({'where':{'name':_0x49d08d,'userProfileId':_0x5d4865[_0x0001('0x58')]},'raw':!![]})[_0x0001('0x2c')](function(_0x5ce041){if(_0x5ce041&&_0x5ce041[_0x0001('0x59')]===0x0){return db[_0x0001('0x30')][_0x0001('0x53')]({'name':_0x3a8c77[_0x0001('0x33')],'resourceId':_0x3a8c77['id'],'type':_0x5ce041[_0x0001('0x33')],'sectionId':_0x5ce041['id']},{})[_0x0001('0x2c')](function(){return _0x40cc50;});}else{return _0x40cc50;}})[_0x0001('0x52')](function(_0x3db25f){logger['error'](_0x0001('0x5a'),_0x3db25f);throw _0x3db25f;});}return _0x40cc50;})[_0x0001('0x2c')](respondWithResult(_0x475abd,0xc9))[_0x0001('0x52')](handleError(_0x475abd,null));};exports[_0x0001('0x2b')]=function(_0x1570c1,_0x13c8d3){if(_0x1570c1[_0x0001('0x54')]['id']){delete _0x1570c1[_0x0001('0x54')]['id'];}return db[_0x0001('0x36')][_0x0001('0x51')]({'where':{'id':_0x1570c1[_0x0001('0x4f')]['id']}})[_0x0001('0x2c')](handleEntityNotFound(_0x13c8d3,null))[_0x0001('0x2c')](saveUpdates(_0x1570c1['body'],null))[_0x0001('0x2c')](respondWithResult(_0x13c8d3,null))[_0x0001('0x52')](handleError(_0x13c8d3,null));};exports[_0x0001('0x2d')]=function(_0x31e864,_0x5a8760){return db[_0x0001('0x36')][_0x0001('0x51')]({'where':{'id':_0x31e864['params']['id']}})['then'](handleEntityNotFound(_0x5a8760,null))[_0x0001('0x2c')](removeEntity(_0x5a8760,null))[_0x0001('0x52')](handleError(_0x5a8760,null));};exports[_0x0001('0x5b')]=function(_0x328426,_0x371a39){return db[_0x0001('0x36')][_0x0001('0x5b')]()[_0x0001('0x2c')](respondWithResult(_0x371a39,null))[_0x0001('0x52')](handleError(_0x371a39,null));};exports['addDisposition']=function(_0x392435,_0x5457b6,_0x14b683){if(_0x392435['body']['id']){delete _0x392435['body']['id'];}return db['CmList']['find']({'where':{'id':_0x392435[_0x0001('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5457b6,null))[_0x0001('0x2c')](function(_0x18123a){if(_0x18123a){_0x392435['body'][_0x0001('0x5c')]=_0x18123a['id'];return db['Disposition']['create'](_0x392435[_0x0001('0x54')]);}})[_0x0001('0x2c')](respondWithResult(_0x5457b6,null))[_0x0001('0x52')](handleError(_0x5457b6,null));};exports[_0x0001('0x5d')]=function(_0x4764af,_0x22014e,_0x44ac4d){var _0x54659e={'raw':![],'where':{}};var _0x247176={};var _0xc3a024={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x4764af[_0x0001('0x4f')]['id']}})[_0x0001('0x2c')](handleEntityNotFound(_0x22014e,null))[_0x0001('0x2c')](function(_0x23d1ff){if(_0x23d1ff){_0x247176['model']=_['keys'](db[_0x0001('0x5e')]['rawAttributes']);_0x247176[_0x0001('0x3e')]=_[_0x0001('0x3d')](_0x4764af[_0x0001('0x3e')]);_0x247176[_0x0001('0x3f')]=_['intersection'](_0x247176[_0x0001('0x3b')],_0x247176[_0x0001('0x3e')]);_0x54659e[_0x0001('0x40')]=_[_0x0001('0x41')](_0x247176[_0x0001('0x3b')],qs[_0x0001('0x42')](_0x4764af[_0x0001('0x3e')][_0x0001('0x42')]));_0x54659e[_0x0001('0x40')]=_0x54659e[_0x0001('0x40')][_0x0001('0x43')]?_0x54659e[_0x0001('0x40')]:_0x247176[_0x0001('0x3b')];if(!_0x4764af['query'][_0x0001('0x44')](_0x0001('0x5f'))){_0x54659e[_0x0001('0x25')]=qs[_0x0001('0x25')](_0x4764af[_0x0001('0x3e')]['limit']);_0x54659e[_0x0001('0x23')]=qs['offset'](_0x4764af[_0x0001('0x3e')][_0x0001('0x23')]);}_0x54659e[_0x0001('0x45')]=qs[_0x0001('0x46')](_0x4764af['query'][_0x0001('0x46')]);_0x54659e['where']=qs['filters'](_['pick'](_0x4764af[_0x0001('0x3e')],_0x247176['filters']));_0x54659e[_0x0001('0x47')][_0x0001('0x5c')]=_0x23d1ff['id'];if(_0x4764af['query']['filter']){_0x54659e[_0x0001('0x47')]=_[_0x0001('0x49')](_0x54659e[_0x0001('0x47')],{'$or':_[_0x0001('0x3c')](_0x54659e[_0x0001('0x40')],function(_0x2eeee7){var _0x39d2e5={};_0x39d2e5[_0x2eeee7]={'$like':'%'+_0x4764af[_0x0001('0x3e')][_0x0001('0x48')]+'%'};return _0x39d2e5;})});}_0x54659e=_['merge']({},_0x54659e,_0x4764af[_0x0001('0x4b')]);return db[_0x0001('0x5e')]['count']({'where':_0x54659e[_0x0001('0x47')]})[_0x0001('0x2c')](function(_0x10c43c){_0xc3a024['count']=_0x10c43c;if(_0x4764af[_0x0001('0x3e')][_0x0001('0x50')]){_0x54659e[_0x0001('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0x0001('0x4d')](_0x54659e);})[_0x0001('0x2c')](function(_0x18e2f8){_0xc3a024['rows']=_0x18e2f8;return _0xc3a024;});}})[_0x0001('0x2c')](respondWithFilteredResult(_0x22014e,_0x54659e))[_0x0001('0x52')](handleError(_0x22014e,null));};exports[_0x0001('0x60')]=function(_0xf8f3e0,_0x28f5a8,_0xbbcd49){return db[_0x0001('0x36')][_0x0001('0x51')]({'where':{'id':_0xf8f3e0[_0x0001('0x4f')]['id']}})[_0x0001('0x2c')](handleEntityNotFound(_0x28f5a8,null))[_0x0001('0x2c')](function(_0x2535bf){if(_0x2535bf){return _0x2535bf[_0x0001('0x60')](_0xf8f3e0[_0x0001('0x3e')][_0x0001('0x61')]);}})[_0x0001('0x2c')](respondWithStatusCode(_0x28f5a8,null))['catch'](handleError(_0x28f5a8,null));};exports[_0x0001('0x62')]=function(_0x51d09d,_0x319ff8,_0x496fd0){return db['CmList'][_0x0001('0x51')]({'where':{'id':_0x51d09d[_0x0001('0x4f')]['id']}})[_0x0001('0x2c')](handleEntityNotFound(_0x319ff8,null))[_0x0001('0x2c')](function(_0x300602){if(_0x300602){var _0x513303=[];var _0x564ea2={'success':[],'errors':[]};return db[_0x0001('0x63')][_0x0001('0x5b')]()[_0x0001('0x2c')](function(_0xe4d2af){if(_0x51d09d[_0x0001('0x54')]['tags']&&_[_0x0001('0x64')](_0x51d09d[_0x0001('0x54')][_0x0001('0x65')])){if(_0x51d09d[_0x0001('0x54')]['tags'][_0x0001('0x43')]){_0x51d09d[_0x0001('0x54')][_0x0001('0x65')]=_0x51d09d[_0x0001('0x54')][_0x0001('0x65')]['join'](';')+';';}else{_0x51d09d[_0x0001('0x54')]['tags']=null;}}else{_0x51d09d[_0x0001('0x54')][_0x0001('0x65')]=null;}if(_0x51d09d[_0x0001('0x54')]&&_['isArray'](_0x51d09d[_0x0001('0x54')])){for(var _0x46d888=0x0;_0x46d888<_0x51d09d[_0x0001('0x54')][_0x0001('0x43')];_0x46d888+=0x1){_0x51d09d[_0x0001('0x54')][_0x46d888][_0x0001('0x5c')]=_0x51d09d[_0x0001('0x4f')]['id'];_0x513303[_0x0001('0x66')](_0x51d09d[_0x0001('0x54')][_0x46d888]);}return BPromise[_0x0001('0x67')](_0x513303,function(_0x5bbc63){return db[_0x0001('0x63')]['create'](_[_0x0001('0x68')](_0x5bbc63,[_0x0001('0x61'),'id'])||{},{'fields':_['keys'](_0xe4d2af),'raw':!![]})[_0x0001('0x2c')](function(_0x137324){_0x564ea2[_0x0001('0x69')][_0x0001('0x66')](_0x137324[_0x0001('0x6a')]);})[_0x0001('0x52')](function(_0x43cc05){_0x564ea2[_0x0001('0x6b')]['push']({'data':_0x5bbc63,'error':_0x43cc05[_0x0001('0x6c')]});});})[_0x0001('0x2c')](function(_0xff843c){return _0x564ea2;})[_0x0001('0x52')](function(_0x3315ad){return _0x3315ad;});}else{_0x319ff8[_0x0001('0x20')](0x190)[_0x0001('0x22')]({'message':_0x0001('0x6d')});}});}})[_0x0001('0x2c')](respondWithResult(_0x319ff8,null))[_0x0001('0x52')](handleError(_0x319ff8,null));};exports[_0x0001('0x6e')]=function(_0x529c8b,_0x4714f6,_0x2994bd){var _0x13c2d0;return db['CmList']['find']({'where':{'id':_0x529c8b[_0x0001('0x4f')]['id']},'include':[{'model':db[_0x0001('0x6f')],'as':_0x0001('0x70')}]})[_0x0001('0x2c')](handleEntityNotFound(_0x4714f6,null))[_0x0001('0x2c')](function(_0x2bec5b){if(_0x2bec5b){_0x13c2d0=_0x2bec5b;return db[_0x0001('0x63')][_0x0001('0x37')];}})[_0x0001('0x2c')](function(_0x51d087){if(_0x51d087){var _0x2e06e4={};var _0x573f07={};_0x573f07[_0x0001('0x3b')]=_[_0x0001('0x71')](_[_0x0001('0x3d')](_0x51d087),_['map'](_0x13c2d0[_0x0001('0x70')],function(_0x51ed0a){return util[_0x0001('0x72')]('cf_%d',_0x51ed0a['id']);}));_0x573f07['query']=_['keys'](_0x529c8b[_0x0001('0x3e')]);_0x573f07[_0x0001('0x3f')]=_[_0x0001('0x41')](_0x573f07[_0x0001('0x3b')],_0x573f07[_0x0001('0x3e')]);_0x2e06e4[_0x0001('0x40')]=_[_0x0001('0x41')](_0x573f07[_0x0001('0x3b')],qs[_0x0001('0x42')](_0x529c8b['query'][_0x0001('0x42')]));_0x2e06e4[_0x0001('0x40')]=_0x2e06e4[_0x0001('0x40')][_0x0001('0x43')]?_0x2e06e4[_0x0001('0x40')]:_0x573f07[_0x0001('0x3b')];if(!_0x529c8b[_0x0001('0x3e')]['hasOwnProperty'](_0x0001('0x5f'))){_0x2e06e4[_0x0001('0x25')]=qs['limit'](_0x529c8b[_0x0001('0x3e')]['limit']);_0x2e06e4[_0x0001('0x23')]=qs[_0x0001('0x23')](_0x529c8b[_0x0001('0x3e')][_0x0001('0x23')]);}_0x2e06e4[_0x0001('0x45')]=qs['sort'](_0x529c8b[_0x0001('0x3e')][_0x0001('0x46')]);_0x2e06e4[_0x0001('0x47')]=qs[_0x0001('0x3f')](_[_0x0001('0x73')](_0x529c8b[_0x0001('0x3e')],_0x573f07[_0x0001('0x3f')]));_0x2e06e4[_0x0001('0x74')]=!![];if(_0x529c8b['query'][_0x0001('0x48')]){_0x2e06e4[_0x0001('0x47')]=_[_0x0001('0x49')](_0x2e06e4[_0x0001('0x47')],{'$or':_[_0x0001('0x3c')](_0x2e06e4[_0x0001('0x40')],function(_0x42cd1f){var _0x18a297={};_0x18a297[_0x42cd1f]={'$like':'%'+_0x529c8b[_0x0001('0x3e')][_0x0001('0x48')]+'%'};return _0x18a297;})});}_0x2e06e4=_['merge']({},_0x2e06e4,_0x529c8b['options']);return _0x13c2d0['getContacts'](_0x2e06e4);}})[_0x0001('0x2c')](respondWithResult(_0x4714f6,null))[_0x0001('0x52')](handleError(_0x4714f6,null));};exports[_0x0001('0x75')]=function(_0xbfffc9,_0x11c491,_0x463ec3){var _0x3b9d34;var _0x5b451b;var _0x47e9ac;var _0x5d4023=_0xbfffc9['params']['id'];csv_results=[];return db[_0x0001('0x76')][_0x0001('0x4d')]({'attributes':['id',_0x0001('0x33')],'raw':!![],'order':[_0x0001('0x77')]})[_0x0001('0x2c')](function(_0x5036fe){_0x3b9d34=_0x5036fe;var _0x3736b8=_['keys'](db[_0x0001('0x63')]['rawAttributes']);return db[_0x0001('0x6f')]['findAll']({'raw':!![],'attributes':['id',_0x0001('0x78')]})['then'](function(_0x2b0e81){_0x5b451b=_0x2b0e81;var _0x365165=squel[_0x0001('0x79')]()[_0x0001('0x42')](_0x3736b8)[_0x0001('0x7a')](_0x0001('0x7b'),'c')['where'](_0x0001('0x7c'),_0x5d4023)[_0x0001('0x47')](_0x0001('0x7d'))['distinct']();for(var _0xd30c71=0x0;_0xd30c71<_0x5b451b['length'];_0xd30c71++){_0x365165[_0x0001('0x7e')]('c.cf_'+_0x5b451b[_0xd30c71]['id'],'customField_'+_0x5b451b[_0xd30c71]['alias']);}for(var _0xd30c71=0x0;_0xd30c71<_0x3b9d34[_0x0001('0x43')];_0xd30c71++){_0x365165[_0x0001('0x7e')](squel['select']()[_0x0001('0x7e')](_0x0001('0x7f'))[_0x0001('0x7a')]('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x3b9d34[_0xd30c71]['id'])[_0x0001('0x47')](_0x0001('0x80')),_0x0001('0x81')+_0x3b9d34[_0xd30c71][_0x0001('0x33')]);_0x365165['field'](squel[_0x0001('0x79')]()[_0x0001('0x7e')](_0x0001('0x82'))[_0x0001('0x7a')]('cm_contact_has_items')[_0x0001('0x47')](_0x0001('0x83'),_0x3b9d34[_0xd30c71]['id'])[_0x0001('0x47')](_0x0001('0x80')),'description_additionalPhone_'+_0x3b9d34[_0xd30c71][_0x0001('0x33')]);}var _0x578d6a=[];_0x578d6a[_0x0001('0x66')](_0x365165[_0x0001('0x84')]());BPromise[_0x0001('0x67')](_0x578d6a,handleQuery)['then'](function(_0x170b1b){handleQuery(_0x365165[_0x0001('0x84')]());var _0x1e8f4a=csv_results[0x0];if(!_[_0x0001('0x85')](_0x1e8f4a)){var _0x516003=toCsv(_0x1e8f4a);var _0x2bcd0c=Date[_0x0001('0x86')]();fs[_0x0001('0x87')](util[_0x0001('0x72')](_0x0001('0x88'),_0x5d4023,_0x2bcd0c),_0x516003);_0x11c491['setHeader'](_0x0001('0x89'),_0x0001('0x8a')+util[_0x0001('0x72')](_0x0001('0x8b'),_0x5d4023,_0x2bcd0c));_0x11c491['setHeader'](_0x0001('0x8c'),_0x0001('0x8d'));return _0x11c491['download'](util['format'](_0x0001('0x88'),_0x5d4023,_0x2bcd0c));}else{return _0x11c491[_0x0001('0x1f')](0xcc);}});});});};exports[_0x0001('0x8e')]=function(_0x74c04f,_0x4811b4,_0x205d72){var _0x499fbc;delete _0x74c04f[_0x0001('0x54')]['id'];return db['CmList'][_0x0001('0x8f')]({'where':{'id':_0x74c04f[_0x0001('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4811b4,null))[_0x0001('0x2c')](function(_0x10855d){if(_0x10855d){return db[_0x0001('0x90')]['transaction'](function(_0x294056){return db[_0x0001('0x6f')][_0x0001('0x53')](_0x74c04f[_0x0001('0x54')],{'transaction':_0x294056})['then'](function(_0x195afe){_0x499fbc=_0x195afe;return _0x10855d[_0x0001('0x91')](_0x195afe,{'transaction':_0x294056});})[_0x0001('0x2c')](function(){var _0x327430={'type':db['Sequelize'][_0x0001('0x92')],'transaction':_0x294056};switch(_0x74c04f[_0x0001('0x54')][_0x0001('0x39')]){case _0x0001('0x93'):_0x327430[_0x0001('0x39')]=db[_0x0001('0x94')]['TEXT'];break;case'number':_0x327430[_0x0001('0x39')]=db[_0x0001('0x94')][_0x0001('0x95')];break;case _0x0001('0x96'):_0x327430['type']=db['Sequelize'][_0x0001('0x97')];_0x327430['defaultValue']=![];break;default:}return db[_0x0001('0x90')]['queryInterface']['addColumn'](_0x0001('0x7b'),util[_0x0001('0x72')](_0x0001('0x98'),_0x499fbc['id']),_0x327430);})['then'](function(){return _0x499fbc;});});}})['then'](respondWithResult(_0x4811b4,null))[_0x0001('0x52')](handleError(_0x4811b4,null));};exports[_0x0001('0x99')]=function(_0x47d573,_0x15e1b5,_0x2b352a){var _0x265a18={};var _0x11a93b={};var _0x44738b;var _0x4737ab;return db['CmList'][_0x0001('0x8f')]({'where':{'id':_0x47d573[_0x0001('0x4f')]['id']}})['then'](handleEntityNotFound(_0x15e1b5,null))['then'](function(_0x271abe){if(_0x271abe){_0x44738b=_0x271abe;_0x11a93b['model']=_['keys'](db[_0x0001('0x6f')][_0x0001('0x37')]);_0x11a93b[_0x0001('0x3e')]=_['keys'](_0x47d573[_0x0001('0x3e')]);_0x11a93b[_0x0001('0x3f')]=_[_0x0001('0x41')](_0x11a93b['model'],_0x11a93b[_0x0001('0x3e')]);_0x265a18[_0x0001('0x40')]=_[_0x0001('0x41')](_0x11a93b[_0x0001('0x3b')],qs['fields'](_0x47d573[_0x0001('0x3e')]['fields']));_0x265a18['attributes']=_0x265a18[_0x0001('0x40')][_0x0001('0x43')]?_0x265a18[_0x0001('0x40')]:_0x11a93b['model'];_0x265a18[_0x0001('0x45')]=qs['sort'](_0x47d573[_0x0001('0x3e')][_0x0001('0x46')]);_0x265a18[_0x0001('0x47')]=qs[_0x0001('0x3f')](_[_0x0001('0x73')](_0x47d573[_0x0001('0x3e')],_0x11a93b[_0x0001('0x3f')]));_0x265a18[_0x0001('0x47')]=_[_0x0001('0x49')](_0x265a18[_0x0001('0x47')],{'$or':[{'ListId':_0x271abe['id']},{'ListId':null}]});if(_0x47d573['query'][_0x0001('0x48')]){_0x265a18['where']=_[_0x0001('0x49')](_0x265a18[_0x0001('0x47')],{'$or':_[_0x0001('0x3c')](_0x265a18[_0x0001('0x40')],function(_0x23fc38){var _0x424c00={};_0x424c00[_0x23fc38]={'$like':'%'+_0x47d573[_0x0001('0x3e')][_0x0001('0x48')]+'%'};return _0x424c00;})});}_0x265a18=_[_0x0001('0x49')]({},_0x265a18,_0x47d573[_0x0001('0x4b')]);return db[_0x0001('0x6f')][_0x0001('0x9a')](_0x265a18);}})['then'](respondWithResult(_0x15e1b5,null))['catch'](handleError(_0x15e1b5,null));};exports[_0x0001('0x9b')]=function(_0x1dd4ef,_0x12a073){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x12a073,null))[_0x0001('0x2c')](function(_0x16209c){return _0x16209c;})['then'](respondWithResult(_0x12a073,null))[_0x0001('0x52')](handleError(_0x12a073,null));};exports['addAgents']=function(_0x5a41f6,_0x1dabc6,_0x5ed115){return db[_0x0001('0x36')]['find']({'where':{'id':_0x5a41f6['params']['id']}})[_0x0001('0x2c')](handleEntityNotFound(_0x1dabc6,null))['then'](function(_0x13323a){if(_0x13323a){return _0x13323a[_0x0001('0x9c')](_0x5a41f6[_0x0001('0x54')][_0x0001('0x61')],_[_0x0001('0x68')](_0x5a41f6['body'],[_0x0001('0x61'),'id'])||{})[_0x0001('0x9d')](function(_0x4b915a){for(var _0x2cc47c=0x0;_0x2cc47c<_0x5a41f6['body'][_0x0001('0x61')][_0x0001('0x43')];_0x2cc47c+=0x1){socket[_0x0001('0x9e')]('userCmList:save',{'UserId':Number(_0x5a41f6[_0x0001('0x54')]['ids'][_0x2cc47c]),'CmListId':Number(_0x5a41f6[_0x0001('0x4f')]['id'])});}return _0x4b915a;});}})[_0x0001('0x2c')](respondWithResult(_0x1dabc6,null))[_0x0001('0x52')](handleError(_0x1dabc6,null));};exports['removeAgents']=function(_0x5a4c9b,_0x1e39ce,_0x1e56e3){return db[_0x0001('0x36')]['find']({'where':{'id':_0x5a4c9b['params']['id']}})[_0x0001('0x2c')](handleEntityNotFound(_0x1e39ce,null))[_0x0001('0x2c')](function(_0x48fb6c){if(_0x48fb6c){return _0x48fb6c['removeAgents'](_0x5a4c9b[_0x0001('0x3e')][_0x0001('0x61')])[_0x0001('0x2c')](function(){if(_[_0x0001('0x64')](_0x5a4c9b[_0x0001('0x3e')][_0x0001('0x61')])){for(var _0x1aa872=0x0;_0x1aa872<_0x5a4c9b['query'][_0x0001('0x61')]['length'];_0x1aa872+=0x1){socket['emit'](_0x0001('0x9f'),{'UserId':Number(_0x5a4c9b['query'][_0x0001('0x61')][_0x1aa872]),'CmListId':Number(_0x5a4c9b[_0x0001('0x4f')]['id'])});}}else{socket['emit'](_0x0001('0x9f'),{'UserId':Number(_0x5a4c9b[_0x0001('0x3e')]['ids']),'CmListId':Number(_0x5a4c9b[_0x0001('0x4f')]['id'])});}});}})[_0x0001('0x2c')](respondWithStatusCode(_0x1e39ce,null))[_0x0001('0x52')](handleError(_0x1e39ce,null));};exports[_0x0001('0xa0')]=function(_0x2ee550,_0x4bfe3a,_0x1a70a4){var _0x378dcc={};var _0x139980={};var _0x558d0f;var _0x568d42;return db['CmList'][_0x0001('0x8f')]({'where':{'id':_0x2ee550[_0x0001('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4bfe3a,null))[_0x0001('0x2c')](function(_0x3d4df0){if(_0x3d4df0){_0x558d0f=_0x3d4df0;_0x139980[_0x0001('0x3b')]=_['keys'](db[_0x0001('0xa1')][_0x0001('0x37')]);_0x139980[_0x0001('0x3e')]=_['keys'](_0x2ee550[_0x0001('0x3e')]);_0x139980[_0x0001('0x3f')]=_[_0x0001('0x41')](_0x139980[_0x0001('0x3b')],_0x139980[_0x0001('0x3e')]);_0x378dcc['attributes']=_['intersection'](_0x139980[_0x0001('0x3b')],qs[_0x0001('0x42')](_0x2ee550[_0x0001('0x3e')][_0x0001('0x42')]));_0x378dcc['attributes']=_0x378dcc['attributes'][_0x0001('0x43')]?_0x378dcc[_0x0001('0x40')]:_0x139980[_0x0001('0x3b')];_0x378dcc[_0x0001('0x45')]=qs[_0x0001('0x46')](_0x2ee550[_0x0001('0x3e')][_0x0001('0x46')]);_0x378dcc['where']=qs[_0x0001('0x3f')](_[_0x0001('0x73')](_0x2ee550[_0x0001('0x3e')],_0x139980[_0x0001('0x3f')]));if(_0x2ee550[_0x0001('0x3e')]['filter']){_0x378dcc['where']=_[_0x0001('0x49')](_0x378dcc[_0x0001('0x47')],{'$or':_[_0x0001('0x3c')](_0x378dcc[_0x0001('0x40')],function(_0x27951b){var _0x3b9bd1={};_0x3b9bd1[_0x27951b]={'$like':'%'+_0x2ee550[_0x0001('0x3e')][_0x0001('0x48')]+'%'};return _0x3b9bd1;})});}_0x378dcc=_[_0x0001('0x49')]({},_0x378dcc,_0x2ee550[_0x0001('0x4b')]);return _0x558d0f[_0x0001('0xa0')](_0x378dcc);}})[_0x0001('0x2c')](function(_0x13e3b4){if(_0x13e3b4){_0x568d42=_0x13e3b4[_0x0001('0x43')];if(!_0x2ee550[_0x0001('0x3e')][_0x0001('0x44')](_0x0001('0x5f'))){_0x378dcc['limit']=qs['limit'](_0x2ee550[_0x0001('0x3e')][_0x0001('0x25')]);_0x378dcc[_0x0001('0x23')]=qs[_0x0001('0x23')](_0x2ee550[_0x0001('0x3e')][_0x0001('0x23')]);}return _0x558d0f[_0x0001('0xa0')](_0x378dcc);}})[_0x0001('0x2c')](function(_0x4cd68e){if(_0x4cd68e){return _0x4cd68e?{'count':_0x568d42,'rows':_0x4cd68e}:null;}})[_0x0001('0x2c')](respondWithResult(_0x4bfe3a,null))[_0x0001('0x52')](handleError(_0x4bfe3a,null));};function handleQuery(_0x4a5ab9){logger[_0x0001('0xa2')](_0x4a5ab9);return db[_0x0001('0x90')][_0x0001('0x3e')](_0x4a5ab9)[_0x0001('0x9d')](function(_0x2963cf){csv_results[_0x0001('0x66')](_0x2963cf);})[_0x0001('0x52')](function(_0x3d88b0){logger[_0x0001('0x31')](_0x3d88b0[_0x0001('0x6c')]);});} \ No newline at end of file +var _0x6eb6=['intersection','attributes','length','model','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','describe','addDisposition','Disposition','findOne','ListId','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','ContactItemType','OrderBy','alias','from','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','each','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','info','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','limit','undefined','count','set','Content-Range','apply','update','then','destroy','get','Lists','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys'];(function(_0x4b800d,_0x499db2){var _0x2d61e1=function(_0x58263e){while(--_0x58263e){_0x4b800d['push'](_0x4b800d['shift']());}};_0x2d61e1(++_0x499db2);}(_0x6eb6,0x1c6));var _0x66eb=function(_0x4bd569,_0x5899ea){_0x4bd569=_0x4bd569-0x0;var _0x2467ef=_0x6eb6[_0x4bd569];return _0x2467ef;};'use strict';var emlformat=require(_0x66eb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66eb('0x1'));var rp=require(_0x66eb('0x2'));var moment=require(_0x66eb('0x3'));var BPromise=require(_0x66eb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x66eb('0x5'));var sox=require(_0x66eb('0x6'));var csv=require(_0x66eb('0x7'));var ejs=require(_0x66eb('0x8'));var fs=require('fs');var fs_extra=require(_0x66eb('0x9'));var _=require('lodash');var squel=require(_0x66eb('0xa'));var crypto=require(_0x66eb('0xb'));var jsforce=require(_0x66eb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x66eb('0x7'));var querystring=require(_0x66eb('0xd'));var Papa=require(_0x66eb('0xe'));var Redis=require(_0x66eb('0xf'));var authService=require(_0x66eb('0x10'));var qs=require(_0x66eb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66eb('0x12'));var logger=require(_0x66eb('0x13'))(_0x66eb('0x14'));var utils=require(_0x66eb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x66eb('0x16'));var db=require(_0x66eb('0x17'))['db'];var csv_results;config[_0x66eb('0x18')]=_[_0x66eb('0x19')](config[_0x66eb('0x18')],{'host':_0x66eb('0x1a'),'port':0x18eb});var socket=require(_0x66eb('0x1b'))(new Redis(config['redis']));require(_0x66eb('0x1c'))[_0x66eb('0x1d')](socket);function respondWithStatusCode(_0x19af62,_0x479626){_0x479626=_0x479626||0xcc;return function(_0x59d143){if(_0x59d143){return _0x19af62[_0x66eb('0x1e')](_0x479626);}return _0x19af62[_0x66eb('0x1f')](_0x479626)['end']();};}function respondWithResult(_0x21911d,_0x64ba18){_0x64ba18=_0x64ba18||0xc8;return function(_0x96f8dc){if(_0x96f8dc){return _0x21911d[_0x66eb('0x1f')](_0x64ba18)[_0x66eb('0x20')](_0x96f8dc);}};}function respondWithFilteredResult(_0x3b42ab,_0x6b28ae){return function(_0x4e8715){if(_0x4e8715){var _0x104689=typeof _0x6b28ae['offset']==='undefined'&&typeof _0x6b28ae[_0x66eb('0x21')]===_0x66eb('0x22');var _0x4f575f=_0x4e8715[_0x66eb('0x23')];var _0x449242=_0x104689?0x0:_0x6b28ae['offset'];var _0x73fb7e=_0x104689?_0x4e8715['count']:_0x6b28ae['offset']+_0x6b28ae[_0x66eb('0x21')];var _0x45703;if(_0x73fb7e>=_0x4f575f){_0x73fb7e=_0x4f575f;_0x45703=0xc8;}else{_0x45703=0xce;}_0x3b42ab[_0x66eb('0x1f')](_0x45703);return _0x3b42ab[_0x66eb('0x24')](_0x66eb('0x25'),_0x449242+'-'+_0x73fb7e+'/'+_0x4f575f)['json'](_0x4e8715);}return null;};}function patchUpdates(_0x25dd72){return function(_0x2fb93b){try{jsonpatch[_0x66eb('0x26')](_0x2fb93b,_0x25dd72,!![]);}catch(_0x3f3fee){return BPromise['reject'](_0x3f3fee);}return _0x2fb93b['save']();};}function saveUpdates(_0x59b8a6,_0x1192a2){return function(_0x568a35){if(_0x568a35){return _0x568a35[_0x66eb('0x27')](_0x59b8a6)[_0x66eb('0x28')](function(_0x20130a){return _0x20130a;});}return null;};}function removeEntity(_0x2cfd4e,_0x4aa3eb){return function(_0x2f9a9d){if(_0x2f9a9d){return _0x2f9a9d[_0x66eb('0x29')]()[_0x66eb('0x28')](function(){var _0x388514=_0x2f9a9d[_0x66eb('0x2a')]({'plain':!![]});var _0x4ee6e6=_0x66eb('0x2b');return db['UserProfileResource'][_0x66eb('0x29')]({'where':{'type':_0x4ee6e6,'resourceId':_0x388514['id']}})[_0x66eb('0x28')](function(){return _0x2f9a9d;});})[_0x66eb('0x28')](function(){_0x2cfd4e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f52af,_0x109a1f){return function(_0x3bb723){if(!_0x3bb723){_0x3f52af['sendStatus'](0x194);}return _0x3bb723;};}function handleError(_0x30cdc5,_0x4f363e){_0x4f363e=_0x4f363e||0x1f4;return function(_0x1f7dab){logger['error'](_0x1f7dab[_0x66eb('0x2c')]);if(_0x1f7dab['name']){delete _0x1f7dab[_0x66eb('0x2d')];}_0x30cdc5[_0x66eb('0x1f')](_0x4f363e)[_0x66eb('0x2e')](_0x1f7dab);};}exports[_0x66eb('0x2f')]=function(_0x3a7d23,_0x3974e8){var _0x46b774={},_0x95e888={},_0x28d153={'count':0x0,'rows':[]};var _0x3d1df5=_[_0x66eb('0x30')](db[_0x66eb('0x31')][_0x66eb('0x32')],function(_0x37a721){return{'name':_0x37a721[_0x66eb('0x33')],'type':_0x37a721[_0x66eb('0x34')][_0x66eb('0x35')]};});_0x95e888['model']=_[_0x66eb('0x30')](_0x3d1df5,_0x66eb('0x2d'));_0x95e888[_0x66eb('0x36')]=_[_0x66eb('0x37')](_0x3a7d23[_0x66eb('0x36')]);_0x95e888['filters']=_[_0x66eb('0x38')](_0x95e888['model'],_0x95e888[_0x66eb('0x36')]);_0x46b774[_0x66eb('0x39')]=_[_0x66eb('0x38')](_0x95e888['model'],qs['fields'](_0x3a7d23['query']['fields']));_0x46b774[_0x66eb('0x39')]=_0x46b774['attributes'][_0x66eb('0x3a')]?_0x46b774[_0x66eb('0x39')]:_0x95e888[_0x66eb('0x3b')];if(!_0x3a7d23[_0x66eb('0x36')][_0x66eb('0x3c')](_0x66eb('0x3d'))){_0x46b774[_0x66eb('0x21')]=qs[_0x66eb('0x21')](_0x3a7d23[_0x66eb('0x36')][_0x66eb('0x21')]);_0x46b774['offset']=qs[_0x66eb('0x3e')](_0x3a7d23['query'][_0x66eb('0x3e')]);}_0x46b774[_0x66eb('0x3f')]=qs[_0x66eb('0x40')](_0x3a7d23[_0x66eb('0x36')]['sort']);_0x46b774[_0x66eb('0x41')]=qs['filters'](_[_0x66eb('0x42')](_0x3a7d23[_0x66eb('0x36')],_0x95e888[_0x66eb('0x43')]),_0x3d1df5);if(_0x3a7d23[_0x66eb('0x36')]['filter']){_0x46b774[_0x66eb('0x41')]=_['merge'](_0x46b774[_0x66eb('0x41')],{'$or':_['map'](_0x3d1df5,function(_0x380da4){if(_0x380da4['type']!==_0x66eb('0x44')){var _0x3029fc={};_0x3029fc[_0x380da4[_0x66eb('0x2d')]]={'$like':'%'+_0x3a7d23[_0x66eb('0x36')][_0x66eb('0x45')]+'%'};return _0x3029fc;}})});}_0x46b774=_[_0x66eb('0x46')]({},_0x46b774,_0x3a7d23[_0x66eb('0x47')]);var _0x5da2ac={'where':_0x46b774['where']};return db['CmList'][_0x66eb('0x23')](_0x5da2ac)['then'](function(_0x4faf09){_0x28d153[_0x66eb('0x23')]=_0x4faf09;if(_0x3a7d23[_0x66eb('0x36')][_0x66eb('0x48')]){_0x46b774[_0x66eb('0x49')]=[{'all':!![]}];}return db[_0x66eb('0x31')][_0x66eb('0x4a')](_0x46b774);})[_0x66eb('0x28')](function(_0x49c1b3){_0x28d153['rows']=_0x49c1b3;return _0x28d153;})[_0x66eb('0x28')](respondWithFilteredResult(_0x3974e8,_0x46b774))['catch'](handleError(_0x3974e8,null));};exports[_0x66eb('0x4b')]=function(_0x249816,_0xf9cc2b){var _0x2e0155={'raw':![],'where':{'id':_0x249816[_0x66eb('0x4c')]['id']}},_0x256f1f={};_0x256f1f[_0x66eb('0x3b')]=_[_0x66eb('0x37')](db[_0x66eb('0x31')][_0x66eb('0x32')]);_0x256f1f[_0x66eb('0x36')]=_[_0x66eb('0x37')](_0x249816[_0x66eb('0x36')]);_0x256f1f[_0x66eb('0x43')]=_[_0x66eb('0x38')](_0x256f1f[_0x66eb('0x3b')],_0x256f1f[_0x66eb('0x36')]);_0x2e0155[_0x66eb('0x39')]=_[_0x66eb('0x38')](_0x256f1f[_0x66eb('0x3b')],qs[_0x66eb('0x4d')](_0x249816['query'][_0x66eb('0x4d')]));_0x2e0155[_0x66eb('0x39')]=_0x2e0155[_0x66eb('0x39')][_0x66eb('0x3a')]?_0x2e0155['attributes']:_0x256f1f['model'];if(_0x249816[_0x66eb('0x36')]['includeAll']){_0x2e0155[_0x66eb('0x49')]=[{'all':!![]}];}_0x2e0155=_['merge']({},_0x2e0155,_0x249816[_0x66eb('0x47')]);return db[_0x66eb('0x31')][_0x66eb('0x4e')](_0x2e0155)[_0x66eb('0x28')](handleEntityNotFound(_0xf9cc2b,null))['then'](respondWithResult(_0xf9cc2b,null))['catch'](handleError(_0xf9cc2b,null));};exports[_0x66eb('0x4f')]=function(_0x596576,_0x15f237){return db[_0x66eb('0x31')][_0x66eb('0x4f')](_0x596576['body'],{})['then'](function(_0x406ae4){var _0x5603ea=_0x596576[_0x66eb('0x50')][_0x66eb('0x2a')]({'plain':!![]});if(!_0x5603ea)throw new Error(_0x66eb('0x51'));if(_0x5603ea[_0x66eb('0x52')]==='user'){var _0x1daded=_0x406ae4[_0x66eb('0x2a')]({'plain':!![]});var _0x208f56='Lists';return db[_0x66eb('0x53')]['find']({'where':{'name':_0x208f56,'userProfileId':_0x5603ea[_0x66eb('0x54')]},'raw':!![]})[_0x66eb('0x28')](function(_0x1b8e4e){if(_0x1b8e4e&&_0x1b8e4e[_0x66eb('0x55')]===0x0){return db[_0x66eb('0x56')][_0x66eb('0x4f')]({'name':_0x1daded['name'],'resourceId':_0x1daded['id'],'type':_0x1b8e4e[_0x66eb('0x2d')],'sectionId':_0x1b8e4e['id']},{})[_0x66eb('0x28')](function(){return _0x406ae4;});}else{return _0x406ae4;}})['catch'](function(_0x1ec1e9){logger[_0x66eb('0x57')](_0x66eb('0x58'),_0x1ec1e9);throw _0x1ec1e9;});}return _0x406ae4;})['then'](respondWithResult(_0x15f237,0xc9))[_0x66eb('0x59')](handleError(_0x15f237,null));};exports[_0x66eb('0x27')]=function(_0x37412c,_0x107fad){if(_0x37412c[_0x66eb('0x5a')]['id']){delete _0x37412c[_0x66eb('0x5a')]['id'];}return db[_0x66eb('0x31')][_0x66eb('0x4e')]({'where':{'id':_0x37412c[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x107fad,null))[_0x66eb('0x28')](saveUpdates(_0x37412c[_0x66eb('0x5a')],null))[_0x66eb('0x28')](respondWithResult(_0x107fad,null))[_0x66eb('0x59')](handleError(_0x107fad,null));};exports[_0x66eb('0x29')]=function(_0x2ce9d9,_0x3a51e4){return db[_0x66eb('0x31')][_0x66eb('0x4e')]({'where':{'id':_0x2ce9d9[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x3a51e4,null))[_0x66eb('0x28')](removeEntity(_0x3a51e4,null))[_0x66eb('0x59')](handleError(_0x3a51e4,null));};exports[_0x66eb('0x5b')]=function(_0xc13361,_0x182dff){return db[_0x66eb('0x31')]['describe']()[_0x66eb('0x28')](respondWithResult(_0x182dff,null))[_0x66eb('0x59')](handleError(_0x182dff,null));};exports[_0x66eb('0x5c')]=function(_0x287f8e,_0x448af8,_0x37761b){if(_0x287f8e[_0x66eb('0x5a')]['id']){delete _0x287f8e[_0x66eb('0x5a')]['id'];}return db[_0x66eb('0x31')][_0x66eb('0x4e')]({'where':{'id':_0x287f8e[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x448af8,null))[_0x66eb('0x28')](function(_0x5e2b62){if(_0x5e2b62){_0x287f8e[_0x66eb('0x5a')]['ListId']=_0x5e2b62['id'];return db[_0x66eb('0x5d')][_0x66eb('0x4f')](_0x287f8e[_0x66eb('0x5a')]);}})['then'](respondWithResult(_0x448af8,null))['catch'](handleError(_0x448af8,null));};exports['getDispositions']=function(_0x3509b4,_0x45e742,_0x14fddb){var _0x105494={'raw':![],'where':{}};var _0xfbbc6f={};var _0x53238f={'count':0x0,'rows':[]};return db[_0x66eb('0x31')][_0x66eb('0x5e')]({'where':{'id':_0x3509b4[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x45e742,null))[_0x66eb('0x28')](function(_0x1d924b){if(_0x1d924b){_0xfbbc6f[_0x66eb('0x3b')]=_['keys'](db[_0x66eb('0x5d')][_0x66eb('0x32')]);_0xfbbc6f[_0x66eb('0x36')]=_[_0x66eb('0x37')](_0x3509b4['query']);_0xfbbc6f[_0x66eb('0x43')]=_['intersection'](_0xfbbc6f[_0x66eb('0x3b')],_0xfbbc6f[_0x66eb('0x36')]);_0x105494['attributes']=_[_0x66eb('0x38')](_0xfbbc6f[_0x66eb('0x3b')],qs[_0x66eb('0x4d')](_0x3509b4['query'][_0x66eb('0x4d')]));_0x105494[_0x66eb('0x39')]=_0x105494[_0x66eb('0x39')][_0x66eb('0x3a')]?_0x105494[_0x66eb('0x39')]:_0xfbbc6f[_0x66eb('0x3b')];if(!_0x3509b4[_0x66eb('0x36')]['hasOwnProperty'](_0x66eb('0x3d'))){_0x105494['limit']=qs[_0x66eb('0x21')](_0x3509b4['query'][_0x66eb('0x21')]);_0x105494[_0x66eb('0x3e')]=qs['offset'](_0x3509b4['query'][_0x66eb('0x3e')]);}_0x105494[_0x66eb('0x3f')]=qs[_0x66eb('0x40')](_0x3509b4['query'][_0x66eb('0x40')]);_0x105494[_0x66eb('0x41')]=qs[_0x66eb('0x43')](_[_0x66eb('0x42')](_0x3509b4[_0x66eb('0x36')],_0xfbbc6f[_0x66eb('0x43')]));_0x105494[_0x66eb('0x41')][_0x66eb('0x5f')]=_0x1d924b['id'];if(_0x3509b4[_0x66eb('0x36')][_0x66eb('0x45')]){_0x105494['where']=_[_0x66eb('0x46')](_0x105494[_0x66eb('0x41')],{'$or':_[_0x66eb('0x30')](_0x105494['attributes'],function(_0x182ec4){var _0x501bbe={};_0x501bbe[_0x182ec4]={'$like':'%'+_0x3509b4[_0x66eb('0x36')][_0x66eb('0x45')]+'%'};return _0x501bbe;})});}_0x105494=_['merge']({},_0x105494,_0x3509b4[_0x66eb('0x47')]);return db[_0x66eb('0x5d')][_0x66eb('0x23')]({'where':_0x105494[_0x66eb('0x41')]})[_0x66eb('0x28')](function(_0x4d4241){_0x53238f['count']=_0x4d4241;if(_0x3509b4[_0x66eb('0x36')][_0x66eb('0x48')]){_0x105494['include']=[{'all':!![]}];}return db[_0x66eb('0x5d')][_0x66eb('0x4a')](_0x105494);})[_0x66eb('0x28')](function(_0x3cfe24){_0x53238f[_0x66eb('0x60')]=_0x3cfe24;return _0x53238f;});}})[_0x66eb('0x28')](respondWithFilteredResult(_0x45e742,_0x105494))[_0x66eb('0x59')](handleError(_0x45e742,null));};exports['removeDispositions']=function(_0x3d048f,_0x377104,_0x43c30f){return db['CmList'][_0x66eb('0x4e')]({'where':{'id':_0x3d048f[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x377104,null))[_0x66eb('0x28')](function(_0x4cf6c3){if(_0x4cf6c3){return _0x4cf6c3[_0x66eb('0x61')](_0x3d048f[_0x66eb('0x36')][_0x66eb('0x62')]);}})[_0x66eb('0x28')](respondWithStatusCode(_0x377104,null))[_0x66eb('0x59')](handleError(_0x377104,null));};exports[_0x66eb('0x63')]=function(_0x2fc17a,_0x580d42,_0x5a69df){return db['CmList'][_0x66eb('0x4e')]({'where':{'id':_0x2fc17a[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x580d42,null))[_0x66eb('0x28')](function(_0x435539){if(_0x435539){var _0x3a982d=[];var _0x3b70cc={'success':[],'errors':[]};return db[_0x66eb('0x64')][_0x66eb('0x5b')]()[_0x66eb('0x28')](function(_0x14f0ac){if(_0x2fc17a[_0x66eb('0x5a')][_0x66eb('0x65')]&&_[_0x66eb('0x66')](_0x2fc17a['body'][_0x66eb('0x65')])){if(_0x2fc17a[_0x66eb('0x5a')][_0x66eb('0x65')][_0x66eb('0x3a')]){_0x2fc17a[_0x66eb('0x5a')]['tags']=_0x2fc17a[_0x66eb('0x5a')]['tags'][_0x66eb('0x67')](';')+';';}else{_0x2fc17a['body'][_0x66eb('0x65')]=null;}}else{_0x2fc17a[_0x66eb('0x5a')]['tags']=null;}if(_0x2fc17a['body']&&_[_0x66eb('0x66')](_0x2fc17a['body'])){for(var _0x8c98d3=0x0;_0x8c98d3<_0x2fc17a['body'][_0x66eb('0x3a')];_0x8c98d3+=0x1){_0x2fc17a[_0x66eb('0x5a')][_0x8c98d3][_0x66eb('0x5f')]=_0x2fc17a[_0x66eb('0x4c')]['id'];_0x3a982d[_0x66eb('0x68')](_0x2fc17a[_0x66eb('0x5a')][_0x8c98d3]);}return BPromise['each'](_0x3a982d,function(_0x21570c){return db[_0x66eb('0x64')][_0x66eb('0x4f')](_[_0x66eb('0x69')](_0x21570c,[_0x66eb('0x62'),'id'])||{},{'fields':_[_0x66eb('0x37')](_0x14f0ac),'raw':!![]})[_0x66eb('0x28')](function(_0x4f5eb9){_0x3b70cc[_0x66eb('0x6a')]['push'](_0x4f5eb9[_0x66eb('0x6b')]);})[_0x66eb('0x59')](function(_0x1b6f70){_0x3b70cc[_0x66eb('0x6c')]['push']({'data':_0x21570c,'error':_0x1b6f70[_0x66eb('0x6d')]});});})[_0x66eb('0x28')](function(_0x4e58e5){return _0x3b70cc;})[_0x66eb('0x59')](function(_0x17bcec){return _0x17bcec;});}else{_0x580d42[_0x66eb('0x1f')](0x190)[_0x66eb('0x20')]({'message':_0x66eb('0x6e')});}});}})[_0x66eb('0x28')](respondWithResult(_0x580d42,null))[_0x66eb('0x59')](handleError(_0x580d42,null));};exports[_0x66eb('0x6f')]=function(_0x3288b2,_0x89cd01,_0x36947c){var _0x16dab3;return db[_0x66eb('0x31')]['find']({'where':{'id':_0x3288b2['params']['id']},'include':[{'model':db[_0x66eb('0x70')],'as':_0x66eb('0x71')}]})[_0x66eb('0x28')](handleEntityNotFound(_0x89cd01,null))[_0x66eb('0x28')](function(_0x39807a){if(_0x39807a){_0x16dab3=_0x39807a;return db[_0x66eb('0x64')]['rawAttributes'];}})[_0x66eb('0x28')](function(_0x37417e){if(_0x37417e){var _0x5bce82={};var _0x66c77d={};_0x66c77d[_0x66eb('0x3b')]=_[_0x66eb('0x72')](_[_0x66eb('0x37')](_0x37417e),_[_0x66eb('0x30')](_0x16dab3[_0x66eb('0x71')],function(_0x37f3a4){return util[_0x66eb('0x73')](_0x66eb('0x74'),_0x37f3a4['id']);}));_0x66c77d[_0x66eb('0x36')]=_[_0x66eb('0x37')](_0x3288b2[_0x66eb('0x36')]);_0x66c77d['filters']=_[_0x66eb('0x38')](_0x66c77d['model'],_0x66c77d[_0x66eb('0x36')]);_0x5bce82[_0x66eb('0x39')]=_[_0x66eb('0x38')](_0x66c77d[_0x66eb('0x3b')],qs[_0x66eb('0x4d')](_0x3288b2[_0x66eb('0x36')][_0x66eb('0x4d')]));_0x5bce82['attributes']=_0x5bce82['attributes']['length']?_0x5bce82[_0x66eb('0x39')]:_0x66c77d[_0x66eb('0x3b')];if(!_0x3288b2[_0x66eb('0x36')][_0x66eb('0x3c')]('nolimit')){_0x5bce82[_0x66eb('0x21')]=qs['limit'](_0x3288b2[_0x66eb('0x36')]['limit']);_0x5bce82[_0x66eb('0x3e')]=qs[_0x66eb('0x3e')](_0x3288b2[_0x66eb('0x36')]['offset']);}_0x5bce82[_0x66eb('0x3f')]=qs['sort'](_0x3288b2['query']['sort']);_0x5bce82[_0x66eb('0x41')]=qs['filters'](_[_0x66eb('0x42')](_0x3288b2[_0x66eb('0x36')],_0x66c77d['filters']));_0x5bce82[_0x66eb('0x75')]=!![];if(_0x3288b2['query'][_0x66eb('0x45')]){_0x5bce82['where']=_['merge'](_0x5bce82[_0x66eb('0x41')],{'$or':_[_0x66eb('0x30')](_0x5bce82[_0x66eb('0x39')],function(_0x4e665b){var _0x41d7e5={};_0x41d7e5[_0x4e665b]={'$like':'%'+_0x3288b2[_0x66eb('0x36')][_0x66eb('0x45')]+'%'};return _0x41d7e5;})});}_0x5bce82=_[_0x66eb('0x46')]({},_0x5bce82,_0x3288b2[_0x66eb('0x47')]);return _0x16dab3[_0x66eb('0x6f')](_0x5bce82);}})[_0x66eb('0x28')](respondWithResult(_0x89cd01,null))[_0x66eb('0x59')](handleError(_0x89cd01,null));};exports['getContactsCsv']=function(_0x29f5a9,_0x1b7607,_0x54e1ef){var _0x461ad4;var _0x246c3c;var _0x468c52;var _0xd3795f=_0x29f5a9[_0x66eb('0x4c')]['id'];csv_results=[];return db[_0x66eb('0x76')]['findAll']({'attributes':['id',_0x66eb('0x2d')],'raw':!![],'order':[_0x66eb('0x77')]})[_0x66eb('0x28')](function(_0x40a7f4){_0x461ad4=_0x40a7f4;var _0x3b9d51=_['keys'](db['CmContact'][_0x66eb('0x32')]);return db[_0x66eb('0x70')][_0x66eb('0x4a')]({'raw':!![],'attributes':['id',_0x66eb('0x78')]})[_0x66eb('0x28')](function(_0x1c30c0){_0x246c3c=_0x1c30c0;var _0x1f30fd=squel['select']()['fields'](_0x3b9d51)[_0x66eb('0x79')]('cm_contacts','c')[_0x66eb('0x41')]('c.ListId\x20=\x20?',_0xd3795f)['where'](_0x66eb('0x7a'))[_0x66eb('0x7b')]();for(var _0x38c72f=0x0;_0x38c72f<_0x246c3c[_0x66eb('0x3a')];_0x38c72f++){_0x1f30fd[_0x66eb('0x7c')](_0x66eb('0x7d')+_0x246c3c[_0x38c72f]['id'],_0x66eb('0x7e')+_0x246c3c[_0x38c72f][_0x66eb('0x78')]);}for(var _0x38c72f=0x0;_0x38c72f<_0x461ad4['length'];_0x38c72f++){_0x1f30fd[_0x66eb('0x7c')](squel[_0x66eb('0x7f')]()[_0x66eb('0x7c')](_0x66eb('0x80'))['from'](_0x66eb('0x81'))['where'](_0x66eb('0x82'),_0x461ad4[_0x38c72f]['id'])[_0x66eb('0x41')]('CmContactId\x20=\x20c.id'),_0x66eb('0x83')+_0x461ad4[_0x38c72f][_0x66eb('0x2d')]);_0x1f30fd[_0x66eb('0x7c')](squel['select']()[_0x66eb('0x7c')](_0x66eb('0x84'))['from'](_0x66eb('0x81'))[_0x66eb('0x41')](_0x66eb('0x82'),_0x461ad4[_0x38c72f]['id'])['where'](_0x66eb('0x85')),_0x66eb('0x86')+_0x461ad4[_0x38c72f]['name']);}var _0x4a74a9=[];_0x4a74a9[_0x66eb('0x68')](_0x1f30fd[_0x66eb('0x87')]());BPromise[_0x66eb('0x88')](_0x4a74a9,handleQuery)['then'](function(_0x1ad070){handleQuery(_0x1f30fd['toString']());var _0x33b8de=csv_results[0x0];if(!_[_0x66eb('0x89')](_0x33b8de)){var _0x44ed6f=toCsv(_0x33b8de);var _0x10ac0a=Date[_0x66eb('0x8a')]();fs[_0x66eb('0x8b')](util[_0x66eb('0x73')](_0x66eb('0x8c'),_0xd3795f,_0x10ac0a),_0x44ed6f);_0x1b7607[_0x66eb('0x8d')]('Content-disposition',_0x66eb('0x8e')+util[_0x66eb('0x73')](_0x66eb('0x8f'),_0xd3795f,_0x10ac0a));_0x1b7607[_0x66eb('0x8d')](_0x66eb('0x90'),'text/csv');return _0x1b7607['download'](util[_0x66eb('0x73')](_0x66eb('0x8c'),_0xd3795f,_0x10ac0a));}else{return _0x1b7607['sendStatus'](0xcc);}});});});};exports[_0x66eb('0x91')]=function(_0xb1a32,_0x58db77,_0x393e9e){var _0x53ec29;delete _0xb1a32[_0x66eb('0x5a')]['id'];return db[_0x66eb('0x31')][_0x66eb('0x5e')]({'where':{'id':_0xb1a32[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x58db77,null))['then'](function(_0x3d7faa){if(_0x3d7faa){return db[_0x66eb('0x92')][_0x66eb('0x93')](function(_0x26b394){return db[_0x66eb('0x70')][_0x66eb('0x4f')](_0xb1a32[_0x66eb('0x5a')],{'transaction':_0x26b394})[_0x66eb('0x28')](function(_0x5a173c){_0x53ec29=_0x5a173c;return _0x3d7faa[_0x66eb('0x94')](_0x5a173c,{'transaction':_0x26b394});})[_0x66eb('0x28')](function(){var _0x4c3f42={'type':db[_0x66eb('0x95')][_0x66eb('0x96')],'transaction':_0x26b394};switch(_0xb1a32[_0x66eb('0x5a')][_0x66eb('0x34')]){case _0x66eb('0x97'):_0x4c3f42[_0x66eb('0x34')]=db[_0x66eb('0x95')][_0x66eb('0x96')];break;case _0x66eb('0x98'):_0x4c3f42['type']=db['Sequelize'][_0x66eb('0x99')];break;case _0x66eb('0x9a'):_0x4c3f42[_0x66eb('0x34')]=db['Sequelize'][_0x66eb('0x9b')];_0x4c3f42[_0x66eb('0x9c')]=![];break;default:}return db[_0x66eb('0x92')][_0x66eb('0x9d')][_0x66eb('0x9e')]('cm_contacts',util['format'](_0x66eb('0x9f'),_0x53ec29['id']),_0x4c3f42);})[_0x66eb('0x28')](function(){return _0x53ec29;});});}})[_0x66eb('0x28')](respondWithResult(_0x58db77,null))[_0x66eb('0x59')](handleError(_0x58db77,null));};exports['getCustomFields']=function(_0x3f7809,_0x41204b,_0x12c049){var _0xf5fa4f={};var _0x2176fb={};var _0x3234e2;var _0x27ed21;return db[_0x66eb('0x31')][_0x66eb('0x5e')]({'where':{'id':_0x3f7809[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x41204b,null))[_0x66eb('0x28')](function(_0x5a84f4){if(_0x5a84f4){_0x3234e2=_0x5a84f4;_0x2176fb[_0x66eb('0x3b')]=_['keys'](db['CmCustomField'][_0x66eb('0x32')]);_0x2176fb['query']=_[_0x66eb('0x37')](_0x3f7809[_0x66eb('0x36')]);_0x2176fb[_0x66eb('0x43')]=_[_0x66eb('0x38')](_0x2176fb[_0x66eb('0x3b')],_0x2176fb[_0x66eb('0x36')]);_0xf5fa4f[_0x66eb('0x39')]=_[_0x66eb('0x38')](_0x2176fb['model'],qs[_0x66eb('0x4d')](_0x3f7809['query'][_0x66eb('0x4d')]));_0xf5fa4f[_0x66eb('0x39')]=_0xf5fa4f[_0x66eb('0x39')][_0x66eb('0x3a')]?_0xf5fa4f[_0x66eb('0x39')]:_0x2176fb[_0x66eb('0x3b')];_0xf5fa4f['order']=qs[_0x66eb('0x40')](_0x3f7809['query'][_0x66eb('0x40')]);_0xf5fa4f[_0x66eb('0x41')]=qs[_0x66eb('0x43')](_[_0x66eb('0x42')](_0x3f7809['query'],_0x2176fb[_0x66eb('0x43')]));_0xf5fa4f['where']=_[_0x66eb('0x46')](_0xf5fa4f['where'],{'$or':[{'ListId':_0x5a84f4['id']},{'ListId':null}]});if(_0x3f7809['query'][_0x66eb('0x45')]){_0xf5fa4f[_0x66eb('0x41')]=_['merge'](_0xf5fa4f[_0x66eb('0x41')],{'$or':_['map'](_0xf5fa4f['attributes'],function(_0x454e88){var _0x2387c1={};_0x2387c1[_0x454e88]={'$like':'%'+_0x3f7809[_0x66eb('0x36')][_0x66eb('0x45')]+'%'};return _0x2387c1;})});}_0xf5fa4f=_[_0x66eb('0x46')]({},_0xf5fa4f,_0x3f7809[_0x66eb('0x47')]);return db[_0x66eb('0x70')][_0x66eb('0xa0')](_0xf5fa4f);}})[_0x66eb('0x28')](respondWithResult(_0x41204b,null))['catch'](handleError(_0x41204b,null));};exports[_0x66eb('0xa1')]=function(_0x230c9d,_0x2a25d2){return db[_0x66eb('0x70')][_0x66eb('0xa0')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x2a25d2,null))[_0x66eb('0x28')](function(_0x47a693){return _0x47a693;})['then'](respondWithResult(_0x2a25d2,null))[_0x66eb('0x59')](handleError(_0x2a25d2,null));};exports[_0x66eb('0xa2')]=function(_0x1d4bf6,_0x4ec5df,_0xc7fea){return db[_0x66eb('0x31')]['find']({'where':{'id':_0x1d4bf6[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x4ec5df,null))[_0x66eb('0x28')](function(_0x4b0dbe){if(_0x4b0dbe){return _0x4b0dbe[_0x66eb('0xa2')](_0x1d4bf6[_0x66eb('0x5a')][_0x66eb('0x62')],_['omit'](_0x1d4bf6['body'],[_0x66eb('0x62'),'id'])||{})[_0x66eb('0xa3')](function(_0x24337b){for(var _0x4d952d=0x0;_0x4d952d<_0x1d4bf6[_0x66eb('0x5a')]['ids'][_0x66eb('0x3a')];_0x4d952d+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x1d4bf6[_0x66eb('0x5a')][_0x66eb('0x62')][_0x4d952d]),'CmListId':Number(_0x1d4bf6[_0x66eb('0x4c')]['id'])});}return _0x24337b;});}})['then'](respondWithResult(_0x4ec5df,null))[_0x66eb('0x59')](handleError(_0x4ec5df,null));};exports[_0x66eb('0xa4')]=function(_0xba36a4,_0x45f1bb,_0x401f24){return db['CmList'][_0x66eb('0x4e')]({'where':{'id':_0xba36a4[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x45f1bb,null))[_0x66eb('0x28')](function(_0x30e5e2){if(_0x30e5e2){return _0x30e5e2[_0x66eb('0xa4')](_0xba36a4['query'][_0x66eb('0x62')])[_0x66eb('0x28')](function(){if(_[_0x66eb('0x66')](_0xba36a4[_0x66eb('0x36')][_0x66eb('0x62')])){for(var _0x2ecb54=0x0;_0x2ecb54<_0xba36a4['query'][_0x66eb('0x62')][_0x66eb('0x3a')];_0x2ecb54+=0x1){socket[_0x66eb('0xa5')](_0x66eb('0xa6'),{'UserId':Number(_0xba36a4['query'][_0x66eb('0x62')][_0x2ecb54]),'CmListId':Number(_0xba36a4[_0x66eb('0x4c')]['id'])});}}else{socket[_0x66eb('0xa5')](_0x66eb('0xa6'),{'UserId':Number(_0xba36a4['query'][_0x66eb('0x62')]),'CmListId':Number(_0xba36a4[_0x66eb('0x4c')]['id'])});}});}})[_0x66eb('0x28')](respondWithStatusCode(_0x45f1bb,null))[_0x66eb('0x59')](handleError(_0x45f1bb,null));};exports[_0x66eb('0xa7')]=function(_0x444260,_0x31e227,_0x411b2b){var _0x4bab45={};var _0x128f6b={};var _0x821d9b;var _0x5aa841;return db[_0x66eb('0x31')][_0x66eb('0x5e')]({'where':{'id':_0x444260[_0x66eb('0x4c')]['id']}})[_0x66eb('0x28')](handleEntityNotFound(_0x31e227,null))[_0x66eb('0x28')](function(_0x458d1e){if(_0x458d1e){_0x821d9b=_0x458d1e;_0x128f6b[_0x66eb('0x3b')]=_[_0x66eb('0x37')](db[_0x66eb('0xa8')][_0x66eb('0x32')]);_0x128f6b['query']=_[_0x66eb('0x37')](_0x444260[_0x66eb('0x36')]);_0x128f6b[_0x66eb('0x43')]=_[_0x66eb('0x38')](_0x128f6b['model'],_0x128f6b['query']);_0x4bab45[_0x66eb('0x39')]=_[_0x66eb('0x38')](_0x128f6b[_0x66eb('0x3b')],qs['fields'](_0x444260['query']['fields']));_0x4bab45[_0x66eb('0x39')]=_0x4bab45[_0x66eb('0x39')]['length']?_0x4bab45[_0x66eb('0x39')]:_0x128f6b[_0x66eb('0x3b')];_0x4bab45[_0x66eb('0x3f')]=qs[_0x66eb('0x40')](_0x444260[_0x66eb('0x36')][_0x66eb('0x40')]);_0x4bab45[_0x66eb('0x41')]=qs[_0x66eb('0x43')](_[_0x66eb('0x42')](_0x444260['query'],_0x128f6b[_0x66eb('0x43')]));if(_0x444260[_0x66eb('0x36')]['filter']){_0x4bab45[_0x66eb('0x41')]=_[_0x66eb('0x46')](_0x4bab45['where'],{'$or':_[_0x66eb('0x30')](_0x4bab45[_0x66eb('0x39')],function(_0x745903){var _0x364f7e={};_0x364f7e[_0x745903]={'$like':'%'+_0x444260[_0x66eb('0x36')][_0x66eb('0x45')]+'%'};return _0x364f7e;})});}_0x4bab45=_[_0x66eb('0x46')]({},_0x4bab45,_0x444260[_0x66eb('0x47')]);return _0x821d9b['getAgents'](_0x4bab45);}})[_0x66eb('0x28')](function(_0x3fbb0e){if(_0x3fbb0e){_0x5aa841=_0x3fbb0e[_0x66eb('0x3a')];if(!_0x444260[_0x66eb('0x36')][_0x66eb('0x3c')]('nolimit')){_0x4bab45[_0x66eb('0x21')]=qs[_0x66eb('0x21')](_0x444260[_0x66eb('0x36')]['limit']);_0x4bab45[_0x66eb('0x3e')]=qs['offset'](_0x444260[_0x66eb('0x36')][_0x66eb('0x3e')]);}return _0x821d9b[_0x66eb('0xa7')](_0x4bab45);}})[_0x66eb('0x28')](function(_0x22b340){if(_0x22b340){return _0x22b340?{'count':_0x5aa841,'rows':_0x22b340}:null;}})[_0x66eb('0x28')](respondWithResult(_0x31e227,null))[_0x66eb('0x59')](handleError(_0x31e227,null));};function handleQuery(_0x14dd4e){logger[_0x66eb('0xa9')](_0x14dd4e);return db[_0x66eb('0x92')][_0x66eb('0x36')](_0x14dd4e)[_0x66eb('0xa3')](function(_0x15b0a1){csv_results[_0x66eb('0x68')](_0x15b0a1);})[_0x66eb('0x59')](function(_0x392529){logger['error'](_0x392529[_0x66eb('0x6d')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f7d7539..b8b2aed 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x337651,_0x2af690){var _0x20893c=function(_0x545dcd){while(--_0x545dcd){_0x337651['push'](_0x337651['shift']());}};_0x20893c(++_0x2af690);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5e88066..ded4f71 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 _0xe5b5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x1202a6,_0x29b04e){var _0x31dc2a=function(_0x9f5c31){while(--_0x9f5c31){_0x1202a6['push'](_0x1202a6['shift']());}};_0x31dc2a(++_0x29b04e);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xe5b5[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x174cca,_0x3f50ab){var _0x1da5a4=function(_0x50fc31){while(--_0x50fc31){_0x174cca['push'](_0x174cca['shift']());}};_0x1da5a4(++_0x3f50ab);}(_0xec56,0x1bd));var _0x6ec5=function(_0x5a8ca2,_0xbd40e9){_0x5a8ca2=_0x5a8ca2-0x0;var _0xdffe53=_0xec56[_0x5a8ca2];return _0xdffe53;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 6753f76..6683933 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 _0x54d4=['result','catch','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','then','request\x20sent','debug','error','code','CmList,\x20%s,\x20%s','message','info'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x54d4,0xa3));var _0x454d=function(_0x4503e6,_0x474583){_0x4503e6=_0x4503e6-0x0;var _0x277c9c=_0x54d4[_0x4503e6];return _0x277c9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x454d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x454d('0x1'));var db=require(_0x454d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x454d('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x454d('0x4'));var client=jayson[_0x454d('0x5')][_0x454d('0x6')]({'port':0x232a});config['redis']=_[_0x454d('0x7')](config[_0x454d('0x8')],{'host':_0x454d('0x9'),'port':0x18eb});var socket=require(_0x454d('0xa'))(new Redis(config[_0x454d('0x8')]));require(_0x454d('0xb'))[_0x454d('0xc')](socket);function respondWithRpcPromise(_0x2e5548,_0xbae7c,_0x203a85){return new BPromise(function(_0x42c185,_0x4bb1a0){return client['request'](_0x2e5548,_0x203a85)[_0x454d('0xd')](function(_0x31902d){logger['info']('CmList,\x20%s,\x20%s',_0xbae7c,_0x454d('0xe'));logger[_0x454d('0xf')]('CmList,\x20%s,\x20%s,\x20%s',_0xbae7c,_0x454d('0xe'),JSON['stringify'](_0x31902d));if(_0x31902d[_0x454d('0x10')]){if(_0x31902d[_0x454d('0x10')][_0x454d('0x11')]===0x1f4){logger[_0x454d('0x10')](_0x454d('0x12'),_0xbae7c,_0x31902d[_0x454d('0x10')][_0x454d('0x13')]);return _0x4bb1a0(_0x31902d['error'][_0x454d('0x13')]);}logger[_0x454d('0x10')](_0x454d('0x12'),_0xbae7c,_0x31902d[_0x454d('0x10')][_0x454d('0x13')]);return _0x42c185(_0x31902d[_0x454d('0x10')][_0x454d('0x13')]);}else{logger[_0x454d('0x14')]('CmList,\x20%s,\x20%s',_0xbae7c,_0x454d('0xe'));_0x42c185(_0x31902d[_0x454d('0x15')]['message']);}})[_0x454d('0x16')](function(_0x59ddcb){logger[_0x454d('0x10')](_0x454d('0x12'),_0xbae7c,_0x59ddcb);_0x4bb1a0(_0x59ddcb);});});} \ No newline at end of file +var _0x2058=['info','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x6b191f,_0xb48c47){var _0x1fdc09=function(_0xfb71cd){while(--_0xfb71cd){_0x6b191f['push'](_0x6b191f['shift']());}};_0x1fdc09(++_0xb48c47);}(_0x2058,0x8d));var _0x8205=function(_0x265c81,_0x4d539a){_0x265c81=_0x265c81-0x0;var _0x3e63d1=_0x2058[_0x265c81];return _0x3e63d1;};'use strict';var _=require('lodash');var util=require(_0x8205('0x0'));var moment=require(_0x8205('0x1'));var BPromise=require(_0x8205('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8205('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8205('0x4'))(_0x8205('0x5'));var config=require('../../config/environment');var jayson=require(_0x8205('0x6'));var client=jayson[_0x8205('0x7')]['http']({'port':0x232a});config[_0x8205('0x8')]=_['defaults'](config[_0x8205('0x8')],{'host':_0x8205('0x9'),'port':0x18eb});var socket=require(_0x8205('0xa'))(new Redis(config[_0x8205('0x8')]));require(_0x8205('0xb'))[_0x8205('0xc')](socket);function respondWithRpcPromise(_0x56ae15,_0x4c60de,_0x5e6dd8){return new BPromise(function(_0x178867,_0x1f19c0){return client[_0x8205('0xd')](_0x56ae15,_0x5e6dd8)['then'](function(_0x2733fe){logger['info'](_0x8205('0xe'),_0x4c60de,_0x8205('0xf'));logger['debug'](_0x8205('0x10'),_0x4c60de,_0x8205('0xf'),JSON[_0x8205('0x11')](_0x2733fe));if(_0x2733fe[_0x8205('0x12')]){if(_0x2733fe['error']['code']===0x1f4){logger[_0x8205('0x12')]('CmList,\x20%s,\x20%s',_0x4c60de,_0x2733fe[_0x8205('0x12')][_0x8205('0x13')]);return _0x1f19c0(_0x2733fe['error'][_0x8205('0x13')]);}logger[_0x8205('0x12')]('CmList,\x20%s,\x20%s',_0x4c60de,_0x2733fe['error'][_0x8205('0x13')]);return _0x178867(_0x2733fe[_0x8205('0x12')][_0x8205('0x13')]);}else{logger[_0x8205('0x14')](_0x8205('0xe'),_0x4c60de,'request\x20sent');_0x178867(_0x2733fe[_0x8205('0x15')][_0x8205('0x13')]);}})[_0x8205('0x16')](function(_0x3b89c7){logger[_0x8205('0x12')](_0x8205('0xe'),_0x4c60de,_0x3b89c7);_0x1f19c0(_0x3b89c7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 114f352..14f8327 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 _0x04a3=['register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x19e0f0,_0x19d493){var _0x23a8e9=function(_0x25e146){while(--_0x25e146){_0x19e0f0['push'](_0x19e0f0['shift']());}};_0x23a8e9(++_0x19d493);}(_0x04a3,0x10d));var _0x304a=function(_0x3c96e9,_0x5a8abd){_0x3c96e9=_0x3c96e9-0x0;var _0x546772=_0x04a3[_0x3c96e9];return _0x546772;};'use strict';var CmListEvents=require(_0x304a('0x0'));var events=[_0x304a('0x1'),_0x304a('0x2'),_0x304a('0x3')];function createListener(_0x4db9a4,_0x4020c0){return function(_0x1602da){_0x4020c0['emit'](_0x4db9a4,_0x1602da);};}function removeListener(_0x5e005a,_0x3b05ff){return function(){CmListEvents['removeListener'](_0x5e005a,_0x3b05ff);};}exports[_0x304a('0x4')]=function(_0x550a9f){for(var _0x45a5e2=0x0,_0x5efed8=events[_0x304a('0x5')];_0x45a5e2<_0x5efed8;_0x45a5e2++){var _0x47ac84=events[_0x45a5e2];var _0x1587c4=createListener(_0x304a('0x6')+_0x47ac84,_0x550a9f);CmListEvents['on'](_0x47ac84,_0x1587c4);}}; \ No newline at end of file +var _0x1dc5=['./cmList.events','save','remove','update','removeListener','register','length'];(function(_0x150bc1,_0x2128ee){var _0x58f44e=function(_0x5c6b70){while(--_0x5c6b70){_0x150bc1['push'](_0x150bc1['shift']());}};_0x58f44e(++_0x2128ee);}(_0x1dc5,0xe7));var _0x51dc=function(_0x279986,_0x1b5b9a){_0x279986=_0x279986-0x0;var _0x110b2a=_0x1dc5[_0x279986];return _0x110b2a;};'use strict';var CmListEvents=require(_0x51dc('0x0'));var events=[_0x51dc('0x1'),_0x51dc('0x2'),_0x51dc('0x3')];function createListener(_0x3abc67,_0x3273a9){return function(_0x2121ac){_0x3273a9['emit'](_0x3abc67,_0x2121ac);};}function removeListener(_0x5eaeda,_0x4f8a00){return function(){CmListEvents[_0x51dc('0x4')](_0x5eaeda,_0x4f8a00);};}exports[_0x51dc('0x5')]=function(_0x5cce32){for(var _0x240f3c=0x0,_0x22c664=events[_0x51dc('0x6')];_0x240f3c<_0x22c664;_0x240f3c++){var _0x169016=events[_0x240f3c];var _0xf0eb1=createListener('cmList:'+_0x169016,_0x5cce32);CmListEvents['on'](_0x169016,_0xf0eb1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7d9c794..d7f4f95 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 _0x481a=['post','create','addDisposition','addContacts','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields'];(function(_0x5486cf,_0x5ee3c1){var _0x39b80f=function(_0x33e621){while(--_0x33e621){_0x5486cf['push'](_0x5486cf['shift']());}};_0x39b80f(++_0x5ee3c1);}(_0x481a,0xbb));var _0xa481=function(_0xaf2c94,_0x142960){_0xaf2c94=_0xaf2c94-0x0;var _0x3b086d=_0x481a[_0xaf2c94];return _0x3b086d;};'use strict';var multer=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var path=require(_0xa481('0x2'));var timeout=require(_0xa481('0x3'));var express=require(_0xa481('0x4'));var router=express['Router']();var fs_extra=require(_0xa481('0x5'));var auth=require(_0xa481('0x6'));var interaction=require(_0xa481('0x7'));var config=require(_0xa481('0x8'));var controller=require(_0xa481('0x9'));router[_0xa481('0xa')]('/',auth['isAuthenticated'](),controller[_0xa481('0xb')]);router[_0xa481('0xa')](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0xe')]);router[_0xa481('0xa')](_0xa481('0xf'),auth[_0xa481('0xd')](),controller['getGlobalCustomFields']);router[_0xa481('0xa')](_0xa481('0x10'),auth[_0xa481('0xd')](),controller['show']);router[_0xa481('0xa')](_0xa481('0x11'),auth[_0xa481('0xd')](),controller[_0xa481('0x12')]);router[_0xa481('0xa')](_0xa481('0x13'),auth[_0xa481('0xd')](),controller[_0xa481('0x14')]);router[_0xa481('0xa')]('/:id/contacts/csv',auth[_0xa481('0xd')](),controller['getContactsCsv']);router[_0xa481('0xa')](_0xa481('0x15'),auth[_0xa481('0xd')](),controller[_0xa481('0x16')]);router[_0xa481('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xa481('0x17')]('/',auth[_0xa481('0xd')](),controller[_0xa481('0x18')]);router['post'](_0xa481('0x11'),auth['isAuthenticated'](),controller[_0xa481('0x19')]);router[_0xa481('0x17')](_0xa481('0x13'),auth['isAuthenticated'](),controller[_0xa481('0x1a')]);router[_0xa481('0x17')](_0xa481('0x15'),auth[_0xa481('0xd')](),controller['addCustomField']);router[_0xa481('0x17')](_0xa481('0x1b'),auth[_0xa481('0xd')](),controller[_0xa481('0x1c')]);router[_0xa481('0x1d')](_0xa481('0x10'),auth['isAuthenticated'](),controller[_0xa481('0x1e')]);router[_0xa481('0x1f')](_0xa481('0x10'),auth[_0xa481('0xd')](),controller[_0xa481('0x20')]);router['delete'](_0xa481('0x11'),auth[_0xa481('0xd')](),controller['removeDispositions']);router[_0xa481('0x1f')](_0xa481('0x1b'),auth['isAuthenticated'](),controller[_0xa481('0x21')]);module[_0xa481('0x22')]=router; \ No newline at end of file +var _0x94db=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','/:id/contacts','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAgents','exports','multer','path'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x94db,0xd6));var _0xb94d=function(_0x3a3179,_0x56bb90){_0x3a3179=_0x3a3179-0x0;var _0x77c725=_0x94db[_0x3a3179];return _0x77c725;};'use strict';var multer=require(_0xb94d('0x0'));var util=require('util');var path=require(_0xb94d('0x1'));var timeout=require('connect-timeout');var express=require(_0xb94d('0x2'));var router=express['Router']();var fs_extra=require(_0xb94d('0x3'));var auth=require(_0xb94d('0x4'));var interaction=require(_0xb94d('0x5'));var config=require(_0xb94d('0x6'));var controller=require(_0xb94d('0x7'));router[_0xb94d('0x8')]('/',auth[_0xb94d('0x9')](),controller[_0xb94d('0xa')]);router[_0xb94d('0x8')](_0xb94d('0xb'),auth[_0xb94d('0x9')](),controller[_0xb94d('0xc')]);router[_0xb94d('0x8')](_0xb94d('0xd'),auth[_0xb94d('0x9')](),controller[_0xb94d('0xe')]);router[_0xb94d('0x8')]('/:id',auth[_0xb94d('0x9')](),controller[_0xb94d('0xf')]);router[_0xb94d('0x8')](_0xb94d('0x10'),auth[_0xb94d('0x9')](),controller['getDispositions']);router[_0xb94d('0x8')]('/:id/contacts',auth[_0xb94d('0x9')](),controller[_0xb94d('0x11')]);router[_0xb94d('0x8')](_0xb94d('0x12'),auth['isAuthenticated'](),controller[_0xb94d('0x13')]);router[_0xb94d('0x8')](_0xb94d('0x14'),auth[_0xb94d('0x9')](),controller[_0xb94d('0x15')]);router[_0xb94d('0x8')](_0xb94d('0x16'),auth[_0xb94d('0x9')](),controller[_0xb94d('0x17')]);router[_0xb94d('0x18')]('/',auth[_0xb94d('0x9')](),controller['create']);router[_0xb94d('0x18')](_0xb94d('0x10'),auth[_0xb94d('0x9')](),controller[_0xb94d('0x19')]);router[_0xb94d('0x18')](_0xb94d('0x1a'),auth['isAuthenticated'](),controller['addContacts']);router['post'](_0xb94d('0x14'),auth[_0xb94d('0x9')](),controller['addCustomField']);router[_0xb94d('0x18')]('/:id/users',auth[_0xb94d('0x9')](),controller[_0xb94d('0x1b')]);router[_0xb94d('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xb94d('0x1d')]);router[_0xb94d('0x1e')](_0xb94d('0x1f'),auth[_0xb94d('0x9')](),controller[_0xb94d('0x20')]);router[_0xb94d('0x1e')](_0xb94d('0x10'),auth['isAuthenticated'](),controller[_0xb94d('0x21')]);router[_0xb94d('0x1e')](_0xb94d('0x16'),auth['isAuthenticated'](),controller[_0xb94d('0x22')]);module[_0xb94d('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6f4cd85..1cf6c9b 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 _0x417a=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x3f0f2d,_0x49d666){var _0x53c7ec=function(_0x1fc05){while(--_0x1fc05){_0x3f0f2d['push'](_0x3f0f2d['shift']());}};_0x53c7ec(++_0x49d666);}(_0x417a,0x18b));var _0xa417=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0x417a[_0x754ab4];return _0x34079a;};'use strict';var Sequelize=require('sequelize');module[_0xa417('0x0')]={'name':{'type':Sequelize[_0xa417('0x1')],'get':function(_0x64e1c5){return this[_0xa417('0x2')](_0xa417('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xa417('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xa417('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xb95b=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x215e41,_0x34baba){var _0x4a692e=function(_0x562d8c){while(--_0x562d8c){_0x215e41['push'](_0x215e41['shift']());}};_0x4a692e(++_0x34baba);}(_0xb95b,0x17a));var _0xbb95=function(_0x3ebb09,_0x427abf){_0x3ebb09=_0x3ebb09-0x0;var _0x431439=_0xb95b[_0x3ebb09];return _0x431439;};'use strict';var Sequelize=require(_0xbb95('0x0'));module[_0xbb95('0x1')]={'name':{'type':Sequelize[_0xbb95('0x2')],'get':function(_0x2b2449){return this[_0xbb95('0x3')]('field');}},'field':{'type':Sequelize[_0xbb95('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xbb95('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xbb95('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index fd61194..802ce93 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(_0x16ae8,_0x3fe24b){var _0x45a0f7=function(_0x78c086){while(--_0x78c086){_0x16ae8['push'](_0x16ae8['shift']());}};_0x45a0f7(++_0x3fe24b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xbed4b4,_0x573073){var _0x1c6607=function(_0x38b06d){while(--_0x38b06d){_0xbed4b4['push'](_0xbed4b4['shift']());}};_0x1c6607(++_0x573073);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5c96e92..8be25ac 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 _0xf4d7=['path','rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf4d7,0xd3));var _0x7f4d=function(_0x42e280,_0x917cbb){_0x42e280=_0x42e280-0x0;var _0x3de5ae=_0xf4d7[_0x42e280];return _0x3de5ae;};'use strict';var _=require(_0x7f4d('0x0'));var util=require('util');var logger=require(_0x7f4d('0x1'))('api');var moment=require(_0x7f4d('0x2'));var BPromise=require(_0x7f4d('0x3'));var rp=require(_0x7f4d('0x4'));var fs=require('fs');var path=require(_0x7f4d('0x5'));var rimraf=require(_0x7f4d('0x6'));var config=require(_0x7f4d('0x7'));var attributes=require(_0x7f4d('0x8'));module['exports']=function(_0x1d1506,_0x503e95){return _0x1d1506[_0x7f4d('0x9')](_0x7f4d('0xa'),attributes,{'tableName':_0x7f4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ac2=['request-promise','rimraf','./condition.attributes','exports','define','Condition','lodash','util','../../config/logger','api','moment'];(function(_0x5b01e5,_0x399a0d){var _0x57b5fa=function(_0x40994d){while(--_0x40994d){_0x5b01e5['push'](_0x5b01e5['shift']());}};_0x57b5fa(++_0x399a0d);}(_0x5ac2,0x1a8));var _0x25ac=function(_0x3306e1,_0x576360){_0x3306e1=_0x3306e1-0x0;var _0xefee38=_0x5ac2[_0x3306e1];return _0xefee38;};'use strict';var _=require(_0x25ac('0x0'));var util=require(_0x25ac('0x1'));var logger=require(_0x25ac('0x2'))(_0x25ac('0x3'));var moment=require(_0x25ac('0x4'));var BPromise=require('bluebird');var rp=require(_0x25ac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ac('0x6'));var config=require('../../config/environment');var attributes=require(_0x25ac('0x7'));module[_0x25ac('0x8')]=function(_0x9dfd15,_0x218c59){return _0x9dfd15[_0x25ac('0x9')](_0x25ac('0xa'),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 eb37297..daee167 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 _0xe940=['request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x39e64b,_0x49f2cf){var _0x3b0b10=function(_0x239ba3){while(--_0x239ba3){_0x39e64b['push'](_0x39e64b['shift']());}};_0x3b0b10(++_0x49f2cf);}(_0xe940,0x1c6));var _0x0e94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe940[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0e94('0x0'));var util=require(_0x0e94('0x1'));var moment=require(_0x0e94('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e94('0x3'));var fs=require('fs');var Redis=require(_0x0e94('0x4'));var db=require(_0x0e94('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0e94('0x6'));var config=require('../../config/environment');var jayson=require(_0x0e94('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x158ca5,_0x59e024,_0x7f496a){return new BPromise(function(_0x437533,_0x40cec5){return client[_0x0e94('0x8')](_0x158ca5,_0x7f496a)[_0x0e94('0x9')](function(_0x23eb19){logger[_0x0e94('0xa')]('Condition,\x20%s,\x20%s',_0x59e024,_0x0e94('0xb'));logger[_0x0e94('0xc')](_0x0e94('0xd'),_0x59e024,_0x0e94('0xb'),JSON[_0x0e94('0xe')](_0x23eb19));if(_0x23eb19[_0x0e94('0xf')]){if(_0x23eb19[_0x0e94('0xf')][_0x0e94('0x10')]===0x1f4){logger[_0x0e94('0xf')](_0x0e94('0x11'),_0x59e024,_0x23eb19[_0x0e94('0xf')][_0x0e94('0x12')]);return _0x40cec5(_0x23eb19[_0x0e94('0xf')][_0x0e94('0x12')]);}logger[_0x0e94('0xf')](_0x0e94('0x11'),_0x59e024,_0x23eb19['error'][_0x0e94('0x12')]);return _0x437533(_0x23eb19['error'][_0x0e94('0x12')]);}else{logger['info'](_0x0e94('0x11'),_0x59e024,_0x0e94('0xb'));_0x437533(_0x23eb19[_0x0e94('0x13')][_0x0e94('0x12')]);}})[_0x0e94('0x14')](function(_0x3e150e){logger['error'](_0x0e94('0x11'),_0x59e024,_0x3e150e);_0x40cec5(_0x3e150e);});});} \ No newline at end of file +var _0xb1b7=['then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2616ce,_0xc13a19){var _0x18b36a=function(_0x132ba7){while(--_0x132ba7){_0x2616ce['push'](_0x2616ce['shift']());}};_0x18b36a(++_0xc13a19);}(_0xb1b7,0x1d8));var _0x7b1b=function(_0x3de8ba,_0x2277d0){_0x3de8ba=_0x3de8ba-0x0;var _0x234dca=_0xb1b7[_0x3de8ba];return _0x234dca;};'use strict';var _=require(_0x7b1b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b1b('0x1'));var rs=require(_0x7b1b('0x2'));var fs=require('fs');var Redis=require(_0x7b1b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b1b('0x4'));var logger=require(_0x7b1b('0x5'))(_0x7b1b('0x6'));var config=require(_0x7b1b('0x7'));var jayson=require(_0x7b1b('0x8'));var client=jayson[_0x7b1b('0x9')][_0x7b1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x313be2,_0x4258bb,_0x1afbf){return new BPromise(function(_0x265e59,_0x1a98bd){return client[_0x7b1b('0xb')](_0x313be2,_0x1afbf)[_0x7b1b('0xc')](function(_0x532930){logger[_0x7b1b('0xd')](_0x7b1b('0xe'),_0x4258bb,_0x7b1b('0xf'));logger[_0x7b1b('0x10')](_0x7b1b('0x11'),_0x4258bb,'request\x20sent',JSON['stringify'](_0x532930));if(_0x532930[_0x7b1b('0x12')]){if(_0x532930[_0x7b1b('0x12')][_0x7b1b('0x13')]===0x1f4){logger[_0x7b1b('0x12')](_0x7b1b('0xe'),_0x4258bb,_0x532930['error']['message']);return _0x1a98bd(_0x532930[_0x7b1b('0x12')][_0x7b1b('0x14')]);}logger['error'](_0x7b1b('0xe'),_0x4258bb,_0x532930[_0x7b1b('0x12')][_0x7b1b('0x14')]);return _0x265e59(_0x532930[_0x7b1b('0x12')]['message']);}else{logger[_0x7b1b('0xd')](_0x7b1b('0xe'),_0x4258bb,_0x7b1b('0xf'));_0x265e59(_0x532930[_0x7b1b('0x15')][_0x7b1b('0x14')]);}})['catch'](function(_0x4e2bfb){logger[_0x7b1b('0x12')](_0x7b1b('0xe'),_0x4258bb,_0x4e2bfb);_0x1a98bd(_0x4e2bfb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8b18f99..034879b 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 _0x73ed=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x73ed,0x115));var _0xd73e=function(_0x5b3819,_0x41b52c){_0x5b3819=_0x5b3819-0x0;var _0x48085e=_0x73ed[_0x5b3819];return _0x48085e;};'use strict';var multer=require('multer');var util=require(_0xd73e('0x0'));var path=require(_0xd73e('0x1'));var timeout=require(_0xd73e('0x2'));var express=require('express');var router=express[_0xd73e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd73e('0x4'));var interaction=require(_0xd73e('0x5'));var config=require(_0xd73e('0x6'));var controller=require('./condition.controller');router[_0xd73e('0x7')](_0xd73e('0x8'),auth[_0xd73e('0x9')](),controller[_0xd73e('0xa')]);router[_0xd73e('0xb')](_0xd73e('0x8'),auth['isAuthenticated'](),controller[_0xd73e('0xc')]);module[_0xd73e('0xd')]=router; \ No newline at end of file +var _0x4fc3=['isAuthenticated','delete','destroy','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x3104d8,_0x3a7027){var _0x542966=function(_0x21dc88){while(--_0x21dc88){_0x3104d8['push'](_0x3104d8['shift']());}};_0x542966(++_0x3a7027);}(_0x4fc3,0xb3));var _0x34fc=function(_0x34930b,_0x21e883){_0x34930b=_0x34930b-0x0;var _0x571cd0=_0x4fc3[_0x34930b];return _0x571cd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x34fc('0x0'));var router=express[_0x34fc('0x1')]();var fs_extra=require(_0x34fc('0x2'));var auth=require(_0x34fc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x34fc('0x4'));var controller=require(_0x34fc('0x5'));router[_0x34fc('0x6')](_0x34fc('0x7'),auth[_0x34fc('0x8')](),controller['update']);router[_0x34fc('0x9')](_0x34fc('0x7'),auth[_0x34fc('0x8')](),controller[_0x34fc('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 6b7fdd2..37174f6 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9edf=['INTEGER','sequelize','STRING','name'];(function(_0x1c1c83,_0x39f701){var _0x3a2650=function(_0xf17943){while(--_0xf17943){_0x1c1c83['push'](_0x1c1c83['shift']());}};_0x3a2650(++_0x39f701);}(_0x9edf,0x15d));var _0xf9ed=function(_0x31d96f,_0x37bcf3){_0x31d96f=_0x31d96f-0x0;var _0x59fb5d=_0x9edf[_0x31d96f];return _0x59fb5d;};'use strict';var Sequelize=require(_0xf9ed('0x0'));module['exports']={'name':{'type':Sequelize[_0xf9ed('0x1')],'allowNull':![],'unique':_0xf9ed('0x2')},'OrderBy':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf9ed('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8158=['INTEGER','sequelize','exports','STRING','name'];(function(_0x606051,_0x3f3122){var _0x12a782=function(_0x26b82d){while(--_0x26b82d){_0x606051['push'](_0x606051['shift']());}};_0x12a782(++_0x3f3122);}(_0x8158,0x1eb));var _0x8815=function(_0x3b3763,_0x506db8){_0x3b3763=_0x3b3763-0x0;var _0x117241=_0x8158[_0x3b3763];return _0x117241;};'use strict';var Sequelize=require(_0x8815('0x0'));module[_0x8815('0x1')]={'name':{'type':Sequelize[_0x8815('0x2')],'allowNull':![],'unique':_0x8815('0x3')},'OrderBy':{'type':Sequelize[_0x8815('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 4d4a870..91af886 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2272=['then','destroy','ContactItemTypes','UserProfileResource','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','ContactItemType','find','create','body','role','user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];function respondWithStatusCode(_0x2e19fb,_0x125c3b){_0x125c3b=_0x125c3b||0xcc;return function(_0x18a2c0){if(_0x18a2c0){return _0x2e19fb['sendStatus'](_0x125c3b);}return _0x2e19fb['status'](_0x125c3b)['end']();};}function respondWithResult(_0x136f6b,_0x571dd1){_0x571dd1=_0x571dd1||0xc8;return function(_0x42f60b){if(_0x42f60b){return _0x136f6b[_0x2227('0x1a')](_0x571dd1)['json'](_0x42f60b);}};}function respondWithFilteredResult(_0x3da09c,_0x4fa23d){return function(_0x1df1ef){if(_0x1df1ef){var _0x43e174=typeof _0x4fa23d[_0x2227('0x1b')]===_0x2227('0x1c')&&typeof _0x4fa23d['limit']===_0x2227('0x1c');var _0x1cf016=_0x1df1ef[_0x2227('0x1d')];var _0x531f75=_0x43e174?0x0:_0x4fa23d[_0x2227('0x1b')];var _0x620012=_0x43e174?_0x1df1ef[_0x2227('0x1d')]:_0x4fa23d[_0x2227('0x1b')]+_0x4fa23d[_0x2227('0x1e')];var _0x28e642;if(_0x620012>=_0x1cf016){_0x620012=_0x1cf016;_0x28e642=0xc8;}else{_0x28e642=0xce;}_0x3da09c[_0x2227('0x1a')](_0x28e642);return _0x3da09c['set'](_0x2227('0x1f'),_0x531f75+'-'+_0x620012+'/'+_0x1cf016)['json'](_0x1df1ef);}return null;};}function patchUpdates(_0x2b26b7){return function(_0x3aed68){try{jsonpatch[_0x2227('0x20')](_0x3aed68,_0x2b26b7,!![]);}catch(_0x1f28ef){return BPromise[_0x2227('0x21')](_0x1f28ef);}return _0x3aed68[_0x2227('0x22')]();};}function saveUpdates(_0x19ab59,_0x10d9ca){return function(_0x3299fd){if(_0x3299fd){return _0x3299fd[_0x2227('0x23')](_0x19ab59)[_0x2227('0x24')](function(_0x5a454f){return _0x5a454f;});}return null;};}function removeEntity(_0x45def5,_0x42d500){return function(_0x5b3a09){if(_0x5b3a09){return _0x5b3a09[_0x2227('0x25')]()[_0x2227('0x24')](function(){var _0x5ea1c3=_0x5b3a09['get']({'plain':!![]});var _0x17c7a4=_0x2227('0x26');return db[_0x2227('0x27')][_0x2227('0x25')]({'where':{'type':_0x17c7a4,'resourceId':_0x5ea1c3['id']}})['then'](function(){return _0x5b3a09;});})[_0x2227('0x24')](function(){_0x45def5[_0x2227('0x1a')](0xcc)[_0x2227('0x28')]();});}};}function handleEntityNotFound(_0x1957ee,_0x5d852f){return function(_0x204def){if(!_0x204def){_0x1957ee[_0x2227('0x29')](0x194);}return _0x204def;};}function handleError(_0xedd3d9,_0x20bd12){_0x20bd12=_0x20bd12||0x1f4;return function(_0x1627d3){logger['error'](_0x1627d3['stack']);if(_0x1627d3['name']){delete _0x1627d3[_0x2227('0x2a')];}_0xedd3d9['status'](_0x20bd12)[_0x2227('0x2b')](_0x1627d3);};}exports[_0x2227('0x2c')]=function(_0x58609e,_0x5916d4){var _0x1f1ba7={},_0x1818ba={},_0x21838a={'count':0x0,'rows':[]};var _0x4cc1e1=_[_0x2227('0x2d')](db['ContactItemType'][_0x2227('0x2e')],function(_0x3f108b){return{'name':_0x3f108b[_0x2227('0x2f')],'type':_0x3f108b[_0x2227('0x30')][_0x2227('0x31')]};});_0x1818ba[_0x2227('0x32')]=_[_0x2227('0x2d')](_0x4cc1e1,_0x2227('0x2a'));_0x1818ba[_0x2227('0x33')]=_[_0x2227('0x34')](_0x58609e[_0x2227('0x33')]);_0x1818ba['filters']=_[_0x2227('0x35')](_0x1818ba[_0x2227('0x32')],_0x1818ba[_0x2227('0x33')]);_0x1f1ba7[_0x2227('0x36')]=_['intersection'](_0x1818ba[_0x2227('0x32')],qs[_0x2227('0x37')](_0x58609e[_0x2227('0x33')][_0x2227('0x37')]));_0x1f1ba7['attributes']=_0x1f1ba7[_0x2227('0x36')][_0x2227('0x38')]?_0x1f1ba7[_0x2227('0x36')]:_0x1818ba['model'];if(!_0x58609e['query'][_0x2227('0x39')](_0x2227('0x3a'))){_0x1f1ba7['limit']=qs[_0x2227('0x1e')](_0x58609e[_0x2227('0x33')]['limit']);_0x1f1ba7[_0x2227('0x1b')]=qs['offset'](_0x58609e[_0x2227('0x33')][_0x2227('0x1b')]);}_0x1f1ba7[_0x2227('0x3b')]=qs[_0x2227('0x3c')](_0x58609e['query'][_0x2227('0x3c')]);_0x1f1ba7['where']=qs[_0x2227('0x3d')](_[_0x2227('0x3e')](_0x58609e[_0x2227('0x33')],_0x1818ba['filters']),_0x4cc1e1);if(_0x58609e[_0x2227('0x33')][_0x2227('0x3f')]){_0x1f1ba7[_0x2227('0x40')]=_[_0x2227('0x41')](_0x1f1ba7[_0x2227('0x40')],{'$or':_['map'](_0x4cc1e1,function(_0x4d9b1d){if(_0x4d9b1d[_0x2227('0x30')]!=='VIRTUAL'){var _0x17137d={};_0x17137d[_0x4d9b1d[_0x2227('0x2a')]]={'$like':'%'+_0x58609e[_0x2227('0x33')][_0x2227('0x3f')]+'%'};return _0x17137d;}})});}_0x1f1ba7=_[_0x2227('0x41')]({},_0x1f1ba7,_0x58609e[_0x2227('0x42')]);var _0x351a6f={'where':_0x1f1ba7[_0x2227('0x40')]};return db['ContactItemType'][_0x2227('0x1d')](_0x351a6f)['then'](function(_0x3c67c6){_0x21838a['count']=_0x3c67c6;if(_0x58609e[_0x2227('0x33')]['includeAll']){_0x1f1ba7[_0x2227('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0x2227('0x44')](_0x1f1ba7);})[_0x2227('0x24')](function(_0x46eb0f){_0x21838a[_0x2227('0x45')]=_0x46eb0f;return _0x21838a;})[_0x2227('0x24')](respondWithFilteredResult(_0x5916d4,_0x1f1ba7))[_0x2227('0x46')](handleError(_0x5916d4,null));};exports['show']=function(_0x5d58a1,_0x42d40d){var _0x4c7458={'raw':!![],'where':{'id':_0x5d58a1['params']['id']}},_0x3552db={};_0x3552db[_0x2227('0x32')]=_[_0x2227('0x34')](db[_0x2227('0x47')][_0x2227('0x2e')]);_0x3552db[_0x2227('0x33')]=_[_0x2227('0x34')](_0x5d58a1['query']);_0x3552db[_0x2227('0x3d')]=_[_0x2227('0x35')](_0x3552db[_0x2227('0x32')],_0x3552db[_0x2227('0x33')]);_0x4c7458[_0x2227('0x36')]=_[_0x2227('0x35')](_0x3552db[_0x2227('0x32')],qs[_0x2227('0x37')](_0x5d58a1['query'][_0x2227('0x37')]));_0x4c7458[_0x2227('0x36')]=_0x4c7458[_0x2227('0x36')][_0x2227('0x38')]?_0x4c7458['attributes']:_0x3552db[_0x2227('0x32')];if(_0x5d58a1[_0x2227('0x33')]['includeAll']){_0x4c7458[_0x2227('0x43')]=[{'all':!![]}];}_0x4c7458=_[_0x2227('0x41')]({},_0x4c7458,_0x5d58a1[_0x2227('0x42')]);return db[_0x2227('0x47')][_0x2227('0x48')](_0x4c7458)[_0x2227('0x24')](handleEntityNotFound(_0x42d40d,null))[_0x2227('0x24')](respondWithResult(_0x42d40d,null))['catch'](handleError(_0x42d40d,null));};exports[_0x2227('0x49')]=function(_0x3155dd,_0x482bf9){return db[_0x2227('0x47')]['create'](_0x3155dd[_0x2227('0x4a')],{})[_0x2227('0x24')](function(_0x31a544){var _0x2e4b92=_0x3155dd['user']['get']({'plain':!![]});if(!_0x2e4b92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e4b92[_0x2227('0x4b')]===_0x2227('0x4c')){var _0x5b0e5b=_0x31a544[_0x2227('0x4d')]({'plain':!![]});var _0x3e5e7b=_0x2227('0x26');return db[_0x2227('0x4e')]['find']({'where':{'name':_0x3e5e7b,'userProfileId':_0x2e4b92['userProfileId']},'raw':!![]})[_0x2227('0x24')](function(_0x1f1f1f){if(_0x1f1f1f&&_0x1f1f1f[_0x2227('0x4f')]===0x0){return db[_0x2227('0x27')]['create']({'name':_0x5b0e5b[_0x2227('0x2a')],'resourceId':_0x5b0e5b['id'],'type':_0x1f1f1f[_0x2227('0x2a')],'sectionId':_0x1f1f1f['id']},{})[_0x2227('0x24')](function(){return _0x31a544;});}else{return _0x31a544;}})[_0x2227('0x46')](function(_0x125fa8){logger[_0x2227('0x50')](_0x2227('0x51'),_0x125fa8);throw _0x125fa8;});}return _0x31a544;})[_0x2227('0x24')](respondWithResult(_0x482bf9,0xc9))[_0x2227('0x46')](handleError(_0x482bf9,null));};exports[_0x2227('0x23')]=function(_0x443dc2,_0x8c8857){if(_0x443dc2[_0x2227('0x4a')]['id']){delete _0x443dc2[_0x2227('0x4a')]['id'];}return db[_0x2227('0x47')][_0x2227('0x48')]({'where':{'id':_0x443dc2['params']['id']}})[_0x2227('0x24')](handleEntityNotFound(_0x8c8857,null))[_0x2227('0x24')](saveUpdates(_0x443dc2['body'],null))[_0x2227('0x24')](respondWithResult(_0x8c8857,null))[_0x2227('0x46')](handleError(_0x8c8857,null));};exports[_0x2227('0x25')]=function(_0x4e8622,_0x523b75){return db['ContactItemType'][_0x2227('0x48')]({'where':{'id':_0x4e8622[_0x2227('0x52')]['id']}})['then'](handleEntityNotFound(_0x523b75,null))[_0x2227('0x24')](db[_0x2227('0x53')][_0x2227('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4e8622['params']['id']}}))[_0x2227('0x24')](removeEntity(_0x523b75,null))[_0x2227('0x46')](handleError(_0x523b75,null));}; \ No newline at end of file +var _0x781d=['find','CmContactHasItem','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','get','stack','name','send','index','ContactItemType','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x31c2ad,_0x5bee22){var _0x27f7ab=function(_0x43be56){while(--_0x43be56){_0x31c2ad['push'](_0x31c2ad['shift']());}};_0x27f7ab(++_0x5bee22);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){var _0x221f14=_0x31bf57[_0xd781('0x27')]({'plain':!![]});var _0x10940b='ContactItemTypes';return db['UserProfileResource'][_0xd781('0x25')]({'where':{'type':_0x10940b,'resourceId':_0x221f14['id']}})[_0xd781('0x26')](function(){return _0x31bf57;});})[_0xd781('0x26')](function(){_0x101480['status'](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x5a431b,_0x47c609){return function(_0x1e29c8){if(!_0x1e29c8){_0x5a431b['sendStatus'](0x194);}return _0x1e29c8;};}function handleError(_0x3e868,_0x123a6a){_0x123a6a=_0x123a6a||0x1f4;return function(_0x5c3848){logger['error'](_0x5c3848[_0xd781('0x28')]);if(_0x5c3848['name']){delete _0x5c3848[_0xd781('0x29')];}_0x3e868['status'](_0x123a6a)[_0xd781('0x2a')](_0x5c3848);};}exports[_0xd781('0x2b')]=function(_0x556127,_0x54521e){var _0x432d14={},_0x29e81a={},_0x1c7d83={'count':0x0,'rows':[]};var _0x5a389c=_['map'](db[_0xd781('0x2c')][_0xd781('0x2d')],function(_0x36a889){return{'name':_0x36a889['fieldName'],'type':_0x36a889['type'][_0xd781('0x2e')]};});_0x29e81a[_0xd781('0x2f')]=_['map'](_0x5a389c,_0xd781('0x29'));_0x29e81a[_0xd781('0x30')]=_['keys'](_0x556127[_0xd781('0x30')]);_0x29e81a[_0xd781('0x31')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],_0x29e81a['query']);_0x432d14[_0xd781('0x33')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x556127['query'][_0xd781('0x34')]));_0x432d14[_0xd781('0x33')]=_0x432d14['attributes'][_0xd781('0x35')]?_0x432d14['attributes']:_0x29e81a[_0xd781('0x2f')];if(!_0x556127[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x36'))){_0x432d14[_0xd781('0x1e')]=qs['limit'](_0x556127[_0xd781('0x30')]['limit']);_0x432d14[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x556127['query'][_0xd781('0x1c')]);}_0x432d14[_0xd781('0x37')]=qs['sort'](_0x556127[_0xd781('0x30')][_0xd781('0x38')]);_0x432d14[_0xd781('0x39')]=qs['filters'](_[_0xd781('0x3a')](_0x556127[_0xd781('0x30')],_0x29e81a[_0xd781('0x31')]),_0x5a389c);if(_0x556127[_0xd781('0x30')][_0xd781('0x3b')]){_0x432d14[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x432d14[_0xd781('0x39')],{'$or':_[_0xd781('0x3d')](_0x5a389c,function(_0x5c6026){if(_0x5c6026[_0xd781('0x3e')]!=='VIRTUAL'){var _0x2504ac={};_0x2504ac[_0x5c6026[_0xd781('0x29')]]={'$like':'%'+_0x556127['query'][_0xd781('0x3b')]+'%'};return _0x2504ac;}})});}_0x432d14=_[_0xd781('0x3c')]({},_0x432d14,_0x556127[_0xd781('0x3f')]);var _0x402c9c={'where':_0x432d14['where']};return db[_0xd781('0x2c')]['count'](_0x402c9c)[_0xd781('0x26')](function(_0xcdaacf){_0x1c7d83['count']=_0xcdaacf;if(_0x556127['query'][_0xd781('0x40')]){_0x432d14[_0xd781('0x41')]=[{'all':!![]}];}return db[_0xd781('0x2c')][_0xd781('0x42')](_0x432d14);})['then'](function(_0x46e7f6){_0x1c7d83[_0xd781('0x43')]=_0x46e7f6;return _0x1c7d83;})['then'](respondWithFilteredResult(_0x54521e,_0x432d14))['catch'](handleError(_0x54521e,null));};exports[_0xd781('0x44')]=function(_0x1d901e,_0xaa552){var _0x4e2eea={'raw':!![],'where':{'id':_0x1d901e[_0xd781('0x45')]['id']}},_0x594f85={};_0x594f85[_0xd781('0x2f')]=_[_0xd781('0x46')](db[_0xd781('0x2c')][_0xd781('0x2d')]);_0x594f85[_0xd781('0x30')]=_['keys'](_0x1d901e['query']);_0x594f85[_0xd781('0x31')]=_[_0xd781('0x32')](_0x594f85[_0xd781('0x2f')],_0x594f85[_0xd781('0x30')]);_0x4e2eea[_0xd781('0x33')]=_['intersection'](_0x594f85[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x1d901e[_0xd781('0x30')]['fields']));_0x4e2eea[_0xd781('0x33')]=_0x4e2eea[_0xd781('0x33')][_0xd781('0x35')]?_0x4e2eea['attributes']:_0x594f85[_0xd781('0x2f')];if(_0x1d901e[_0xd781('0x30')]['includeAll']){_0x4e2eea['include']=[{'all':!![]}];}_0x4e2eea=_[_0xd781('0x3c')]({},_0x4e2eea,_0x1d901e[_0xd781('0x3f')]);return db[_0xd781('0x2c')]['find'](_0x4e2eea)[_0xd781('0x26')](handleEntityNotFound(_0xaa552,null))[_0xd781('0x26')](respondWithResult(_0xaa552,null))[_0xd781('0x47')](handleError(_0xaa552,null));};exports[_0xd781('0x48')]=function(_0x336d30,_0x3828ad){return db[_0xd781('0x2c')]['create'](_0x336d30[_0xd781('0x49')],{})[_0xd781('0x26')](function(_0x1d54bd){var _0x4c7cb6=_0x336d30[_0xd781('0x4a')][_0xd781('0x27')]({'plain':!![]});if(!_0x4c7cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c7cb6[_0xd781('0x4b')]===_0xd781('0x4a')){var _0x41caac=_0x1d54bd[_0xd781('0x27')]({'plain':!![]});var _0x42a2f9='ContactItemTypes';return db[_0xd781('0x4c')]['find']({'where':{'name':_0x42a2f9,'userProfileId':_0x4c7cb6[_0xd781('0x4d')]},'raw':!![]})['then'](function(_0x2ce1f6){if(_0x2ce1f6&&_0x2ce1f6[_0xd781('0x4e')]===0x0){return db['UserProfileResource'][_0xd781('0x48')]({'name':_0x41caac['name'],'resourceId':_0x41caac['id'],'type':_0x2ce1f6['name'],'sectionId':_0x2ce1f6['id']},{})['then'](function(){return _0x1d54bd;});}else{return _0x1d54bd;}})[_0xd781('0x47')](function(_0x174fcd){logger['error'](_0xd781('0x4f'),_0x174fcd);throw _0x174fcd;});}return _0x1d54bd;})['then'](respondWithResult(_0x3828ad,0xc9))[_0xd781('0x47')](handleError(_0x3828ad,null));};exports[_0xd781('0x24')]=function(_0x39d47d,_0x19a6c2){if(_0x39d47d['body']['id']){delete _0x39d47d[_0xd781('0x49')]['id'];}return db['ContactItemType'][_0xd781('0x50')]({'where':{'id':_0x39d47d['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x19a6c2,null))[_0xd781('0x26')](saveUpdates(_0x39d47d['body'],null))[_0xd781('0x26')](respondWithResult(_0x19a6c2,null))[_0xd781('0x47')](handleError(_0x19a6c2,null));};exports[_0xd781('0x25')]=function(_0x32fd9f,_0xfc466c){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x32fd9f['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0xfc466c,null))[_0xd781('0x26')](db[_0xd781('0x51')][_0xd781('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x32fd9f['params']['id']}}))[_0xd781('0x26')](removeEntity(_0xfc466c,null))['catch'](handleError(_0xfc466c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f5c4abb..6ad116f 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb437=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','tools_contact_item_types','lodash'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0xb437,0x128));var _0x7b43=function(_0x5e0761,_0x5a8d69){_0x5e0761=_0x5e0761-0x0;var _0x956f81=_0xb437[_0x5e0761];return _0x956f81;};'use strict';var _=require(_0x7b43('0x0'));var util=require('util');var logger=require(_0x7b43('0x1'))(_0x7b43('0x2'));var moment=require(_0x7b43('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b43('0x4'));var rimraf=require(_0x7b43('0x5'));var config=require(_0x7b43('0x6'));var attributes=require('./contactItemType.attributes');module[_0x7b43('0x7')]=function(_0x4653d8,_0x55b922){return _0x4653d8['define']('ContactItemType',attributes,{'tableName':_0x7b43('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x628f=['api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x36a073,_0x2ce3ce){var _0xc9762b=function(_0x416bfe){while(--_0x416bfe){_0x36a073['push'](_0x36a073['shift']());}};_0xc9762b(++_0x2ce3ce);}(_0x628f,0x177));var _0xf628=function(_0x263f76,_0x2ee49f){_0x263f76=_0x263f76-0x0;var _0x4112de=_0x628f[_0x263f76];return _0x4112de;};'use strict';var _=require(_0xf628('0x0'));var util=require(_0xf628('0x1'));var logger=require(_0xf628('0x2'))(_0xf628('0x3'));var moment=require(_0xf628('0x4'));var BPromise=require('bluebird');var rp=require(_0xf628('0x5'));var fs=require('fs');var path=require(_0xf628('0x6'));var rimraf=require(_0xf628('0x7'));var config=require(_0xf628('0x8'));var attributes=require(_0xf628('0x9'));module[_0xf628('0xa')]=function(_0x51be5f,_0x4ba3c2){return _0x51be5f[_0xf628('0xb')](_0xf628('0xc'),attributes,{'tableName':_0xf628('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index b076d86..dce7dd1 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceb5=['message','request\x20sent','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s'];(function(_0x2a4785,_0x15b79a){var _0x152efa=function(_0x3ddff0){while(--_0x3ddff0){_0x2a4785['push'](_0x2a4785['shift']());}};_0x152efa(++_0x15b79a);}(_0xceb5,0x81));var _0x5ceb=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xceb5[_0x1afabf];return _0x497ff1;};'use strict';var _=require(_0x5ceb('0x0'));var util=require(_0x5ceb('0x1'));var moment=require('moment');var BPromise=require(_0x5ceb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ceb('0x3'));var db=require(_0x5ceb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ceb('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5ceb('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c69d8,_0x1dad3c,_0x3cfdd1){return new BPromise(function(_0x328db3,_0x221605){return client['request'](_0x3c69d8,_0x3cfdd1)[_0x5ceb('0x7')](function(_0x3b1a6d){logger[_0x5ceb('0x8')]('ContactItemType,\x20%s,\x20%s',_0x1dad3c,'request\x20sent');logger[_0x5ceb('0x9')](_0x5ceb('0xa'),_0x1dad3c,'request\x20sent',JSON[_0x5ceb('0xb')](_0x3b1a6d));if(_0x3b1a6d[_0x5ceb('0xc')]){if(_0x3b1a6d[_0x5ceb('0xc')][_0x5ceb('0xd')]===0x1f4){logger[_0x5ceb('0xc')](_0x5ceb('0xe'),_0x1dad3c,_0x3b1a6d[_0x5ceb('0xc')][_0x5ceb('0xf')]);return _0x221605(_0x3b1a6d[_0x5ceb('0xc')][_0x5ceb('0xf')]);}logger[_0x5ceb('0xc')](_0x5ceb('0xe'),_0x1dad3c,_0x3b1a6d[_0x5ceb('0xc')][_0x5ceb('0xf')]);return _0x328db3(_0x3b1a6d[_0x5ceb('0xc')]['message']);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x1dad3c,_0x5ceb('0x10'));_0x328db3(_0x3b1a6d['result'][_0x5ceb('0xf')]);}})[_0x5ceb('0x11')](function(_0x5bc6a0){logger[_0x5ceb('0xc')](_0x5ceb('0xe'),_0x1dad3c,_0x5bc6a0);_0x221605(_0x5bc6a0);});});} \ No newline at end of file +var _0x84b8=['rpc','jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x41f0fb,_0x155b08){var _0x494a7f=function(_0x491c0d){while(--_0x491c0d){_0x41f0fb['push'](_0x41f0fb['shift']());}};_0x494a7f(++_0x155b08);}(_0x84b8,0x19a));var _0x884b=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x84b8[_0x1eda20];return _0x31b953;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x884b('0x0'));var BPromise=require(_0x884b('0x1'));var rs=require(_0x884b('0x2'));var fs=require('fs');var Redis=require(_0x884b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x884b('0x4'));var config=require('../../config/environment');var jayson=require(_0x884b('0x5'));var client=jayson['client'][_0x884b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x172eed,_0x5cdc5b,_0x203f0f){return new BPromise(function(_0x4c1de3,_0x53fd8c){return client[_0x884b('0x7')](_0x172eed,_0x203f0f)[_0x884b('0x8')](function(_0x297bd9){logger['info'](_0x884b('0x9'),_0x5cdc5b,_0x884b('0xa'));logger[_0x884b('0xb')](_0x884b('0xc'),_0x5cdc5b,'request\x20sent',JSON['stringify'](_0x297bd9));if(_0x297bd9[_0x884b('0xd')]){if(_0x297bd9[_0x884b('0xd')]['code']===0x1f4){logger[_0x884b('0xd')](_0x884b('0x9'),_0x5cdc5b,_0x297bd9[_0x884b('0xd')][_0x884b('0xe')]);return _0x53fd8c(_0x297bd9[_0x884b('0xd')][_0x884b('0xe')]);}logger['error'](_0x884b('0x9'),_0x5cdc5b,_0x297bd9[_0x884b('0xd')]['message']);return _0x4c1de3(_0x297bd9[_0x884b('0xd')][_0x884b('0xe')]);}else{logger[_0x884b('0xf')]('ContactItemType,\x20%s,\x20%s',_0x5cdc5b,_0x884b('0xa'));_0x4c1de3(_0x297bd9[_0x884b('0x10')][_0x884b('0xe')]);}})[_0x884b('0x11')](function(_0x3856ef){logger[_0x884b('0xd')]('ContactItemType,\x20%s,\x20%s',_0x5cdc5b,_0x3856ef);_0x53fd8c(_0x3856ef);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index cf3ce08..43eb5c9 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec2c=['show','post','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id'];(function(_0xa1671c,_0x57700d){var _0x2107f0=function(_0x436e27){while(--_0x436e27){_0xa1671c['push'](_0xa1671c['shift']());}};_0x2107f0(++_0x57700d);}(_0xec2c,0xa6));var _0xcec2=function(_0x3f097c,_0x32f99f){_0x3f097c=_0x3f097c-0x0;var _0x524678=_0xec2c[_0x3f097c];return _0x524678;};'use strict';var multer=require(_0xcec2('0x0'));var util=require(_0xcec2('0x1'));var path=require(_0xcec2('0x2'));var timeout=require(_0xcec2('0x3'));var express=require(_0xcec2('0x4'));var router=express[_0xcec2('0x5')]();var fs_extra=require(_0xcec2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcec2('0x7'));var config=require(_0xcec2('0x8'));var controller=require(_0xcec2('0x9'));router[_0xcec2('0xa')]('/',auth[_0xcec2('0xb')](),controller[_0xcec2('0xc')]);router['get'](_0xcec2('0xd'),auth['isAuthenticated'](),controller[_0xcec2('0xe')]);router[_0xcec2('0xf')]('/',auth[_0xcec2('0xb')](),controller['create']);router['put'](_0xcec2('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcec2('0xd'),auth[_0xcec2('0xb')](),controller[_0xcec2('0x10')]);module[_0xcec2('0x11')]=router; \ No newline at end of file +var _0x59d8=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get'];(function(_0x4df29b,_0x595b3b){var _0x159b2a=function(_0x110791){while(--_0x110791){_0x4df29b['push'](_0x4df29b['shift']());}};_0x159b2a(++_0x595b3b);}(_0x59d8,0x119));var _0x859d=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x59d8[_0x685346];return _0x52e15b;};'use strict';var multer=require(_0x859d('0x0'));var util=require('util');var path=require(_0x859d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x859d('0x2')]();var fs_extra=require(_0x859d('0x3'));var auth=require(_0x859d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x859d('0x5'));var controller=require(_0x859d('0x6'));router[_0x859d('0x7')]('/',auth[_0x859d('0x8')](),controller['index']);router[_0x859d('0x7')](_0x859d('0x9'),auth[_0x859d('0x8')](),controller[_0x859d('0xa')]);router[_0x859d('0xb')]('/',auth[_0x859d('0x8')](),controller[_0x859d('0xc')]);router[_0x859d('0xd')]('/:id',auth[_0x859d('0x8')](),controller[_0x859d('0xe')]);router[_0x859d('0xf')]('/:id',auth[_0x859d('0x8')](),controller[_0x859d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1a02784..b67f476 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x2584bc,_0x35d9f5){var _0x405f2c=function(_0x4a1d1e){while(--_0x4a1d1e){_0x2584bc['push'](_0x2584bc['shift']());}};_0x405f2c(++_0x35d9f5);}(_0x757a,0xde));var _0xa757=function(_0x3671c9,_0xd15bf){_0x3671c9=_0x3671c9-0x0;var _0x3f1a34=_0x757a[_0x3671c9];return _0x3f1a34;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x5c41ff,_0x4c06a6){var _0x29c416=function(_0x2072ab){while(--_0x2072ab){_0x5c41ff['push'](_0x5c41ff['shift']());}};_0x29c416(++_0x4c06a6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 284c3d7..43aaf25 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 _0x9826=['nolimit','eml-format','zip-dir','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/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','options','includeAll','include','rows','show','params','merge','find','catch','create','body','user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrFaxAccounts','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','order'];(function(_0x277854,_0xae3fb7){var _0x4da7f9=function(_0x271e87){while(--_0x271e87){_0x277854['push'](_0x277854['shift']());}};_0x4da7f9(++_0xae3fb7);}(_0x9826,0x82));var _0x6982=function(_0x2f5108,_0x1dcd75){_0x2f5108=_0x2f5108-0x0;var _0x5ca71e=_0x9826[_0x2f5108];return _0x5ca71e;};'use strict';var emlformat=require(_0x6982('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6982('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6982('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6982('0x3'));var util=require(_0x6982('0x4'));var path=require(_0x6982('0x5'));var sox=require(_0x6982('0x6'));var csv=require(_0x6982('0x7'));var ejs=require(_0x6982('0x8'));var fs=require('fs');var fs_extra=require(_0x6982('0x9'));var _=require(_0x6982('0xa'));var squel=require(_0x6982('0xb'));var crypto=require(_0x6982('0xc'));var jsforce=require(_0x6982('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6982('0xe'));var Papa=require(_0x6982('0xf'));var Redis=require(_0x6982('0x10'));var authService=require(_0x6982('0x11'));var qs=require(_0x6982('0x12'));var as=require(_0x6982('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6982('0x14'))(_0x6982('0x15'));var utils=require('../../config/utils');var config=require(_0x6982('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6982('0x17'))['db'];config[_0x6982('0x18')]=_['defaults'](config[_0x6982('0x18')],{'host':_0x6982('0x19'),'port':0x18eb});var socket=require(_0x6982('0x1a'))(new Redis(config['redis']));require(_0x6982('0x1b'))[_0x6982('0x1c')](socket);function respondWithStatusCode(_0x264b73,_0x259cdd){_0x259cdd=_0x259cdd||0xcc;return function(_0x3d8609){if(_0x3d8609){return _0x264b73['sendStatus'](_0x259cdd);}return _0x264b73['status'](_0x259cdd)[_0x6982('0x1d')]();};}function respondWithResult(_0xe64c5e,_0x1b5103){_0x1b5103=_0x1b5103||0xc8;return function(_0x370ffb){if(_0x370ffb){return _0xe64c5e[_0x6982('0x1e')](_0x1b5103)[_0x6982('0x1f')](_0x370ffb);}};}function respondWithFilteredResult(_0x216b1c,_0x46b8ac){return function(_0x52daed){if(_0x52daed){var _0x526601=typeof _0x46b8ac[_0x6982('0x20')]===_0x6982('0x21')&&typeof _0x46b8ac[_0x6982('0x22')]==='undefined';var _0x49537b=_0x52daed[_0x6982('0x23')];var _0xc8acc=_0x526601?0x0:_0x46b8ac[_0x6982('0x20')];var _0x255ae8=_0x526601?_0x52daed['count']:_0x46b8ac[_0x6982('0x20')]+_0x46b8ac[_0x6982('0x22')];var _0x2daa18;if(_0x255ae8>=_0x49537b){_0x255ae8=_0x49537b;_0x2daa18=0xc8;}else{_0x2daa18=0xce;}_0x216b1c['status'](_0x2daa18);return _0x216b1c[_0x6982('0x24')]('Content-Range',_0xc8acc+'-'+_0x255ae8+'/'+_0x49537b)['json'](_0x52daed);}return null;};}function patchUpdates(_0x153aed){return function(_0x1b5d6e){try{jsonpatch[_0x6982('0x25')](_0x1b5d6e,_0x153aed,!![]);}catch(_0x172b18){return BPromise[_0x6982('0x26')](_0x172b18);}return _0x1b5d6e[_0x6982('0x27')]();};}function saveUpdates(_0xef5b9b,_0x43c493){return function(_0x3ac7ed){if(_0x3ac7ed){return _0x3ac7ed['update'](_0xef5b9b)[_0x6982('0x28')](function(_0x1737b9){return _0x1737b9;});}return null;};}function removeEntity(_0x201d80,_0x1c34c8){return function(_0x4fe5dd){if(_0x4fe5dd){return _0x4fe5dd[_0x6982('0x29')]()['then'](function(){var _0x3396c7=_0x4fe5dd[_0x6982('0x2a')]({'plain':!![]});var _0x284b6f='CustomDashboards';return db[_0x6982('0x2b')][_0x6982('0x29')]({'where':{'type':_0x284b6f,'resourceId':_0x3396c7['id']}})[_0x6982('0x28')](function(){return _0x4fe5dd;});})[_0x6982('0x28')](function(){_0x201d80[_0x6982('0x1e')](0xcc)[_0x6982('0x1d')]();});}};}function handleEntityNotFound(_0x7d4367,_0x1698bf){return function(_0x4f7353){if(!_0x4f7353){_0x7d4367[_0x6982('0x2c')](0x194);}return _0x4f7353;};}function handleError(_0xff7131,_0x38f2f6){_0x38f2f6=_0x38f2f6||0x1f4;return function(_0x8c82f9){logger[_0x6982('0x2d')](_0x8c82f9[_0x6982('0x2e')]);if(_0x8c82f9[_0x6982('0x2f')]){delete _0x8c82f9[_0x6982('0x2f')];}_0xff7131['status'](_0x38f2f6)[_0x6982('0x30')](_0x8c82f9);};}exports[_0x6982('0x31')]=function(_0x45d50e,_0x974d85){var _0x26bbf2={},_0x26fda6={},_0x91afe={'count':0x0,'rows':[]};var _0x2ac021=_[_0x6982('0x32')](db[_0x6982('0x33')][_0x6982('0x34')],function(_0x330344){return{'name':_0x330344['fieldName'],'type':_0x330344[_0x6982('0x35')][_0x6982('0x36')]};});_0x26fda6['model']=_['map'](_0x2ac021,_0x6982('0x2f'));_0x26fda6[_0x6982('0x37')]=_[_0x6982('0x38')](_0x45d50e[_0x6982('0x37')]);_0x26fda6[_0x6982('0x39')]=_['intersection'](_0x26fda6[_0x6982('0x3a')],_0x26fda6[_0x6982('0x37')]);_0x26bbf2[_0x6982('0x3b')]=_[_0x6982('0x3c')](_0x26fda6[_0x6982('0x3a')],qs[_0x6982('0x3d')](_0x45d50e[_0x6982('0x37')][_0x6982('0x3d')]));_0x26bbf2[_0x6982('0x3b')]=_0x26bbf2[_0x6982('0x3b')][_0x6982('0x3e')]?_0x26bbf2['attributes']:_0x26fda6['model'];if(!_0x45d50e[_0x6982('0x37')][_0x6982('0x3f')]('nolimit')){_0x26bbf2[_0x6982('0x22')]=qs['limit'](_0x45d50e[_0x6982('0x37')][_0x6982('0x22')]);_0x26bbf2['offset']=qs['offset'](_0x45d50e['query'][_0x6982('0x20')]);}_0x26bbf2['order']=qs['sort'](_0x45d50e['query'][_0x6982('0x40')]);_0x26bbf2['where']=qs[_0x6982('0x39')](_[_0x6982('0x41')](_0x45d50e['query'],_0x26fda6[_0x6982('0x39')]),_0x2ac021);if(_0x45d50e[_0x6982('0x37')][_0x6982('0x42')]){_0x26bbf2[_0x6982('0x43')]=_['merge'](_0x26bbf2[_0x6982('0x43')],{'$or':_[_0x6982('0x32')](_0x2ac021,function(_0x3583de){if(_0x3583de['type']!=='VIRTUAL'){var _0x42ffe9={};_0x42ffe9[_0x3583de[_0x6982('0x2f')]]={'$like':'%'+_0x45d50e['query']['filter']+'%'};return _0x42ffe9;}})});}_0x26bbf2=_['merge']({},_0x26bbf2,_0x45d50e[_0x6982('0x44')]);var _0x2e891d={'where':_0x26bbf2[_0x6982('0x43')]};return db[_0x6982('0x33')][_0x6982('0x23')](_0x2e891d)[_0x6982('0x28')](function(_0x5203fc){_0x91afe[_0x6982('0x23')]=_0x5203fc;if(_0x45d50e[_0x6982('0x37')][_0x6982('0x45')]){_0x26bbf2[_0x6982('0x46')]=[{'all':!![]}];}return db[_0x6982('0x33')]['findAll'](_0x26bbf2);})['then'](function(_0x175a6e){_0x91afe[_0x6982('0x47')]=_0x175a6e;return _0x91afe;})[_0x6982('0x28')](respondWithFilteredResult(_0x974d85,_0x26bbf2))['catch'](handleError(_0x974d85,null));};exports[_0x6982('0x48')]=function(_0x2f837f,_0x21e405){var _0x28d7a6={'raw':![],'where':{'id':_0x2f837f[_0x6982('0x49')]['id']}},_0x3afc26={};_0x3afc26['model']=_[_0x6982('0x38')](db[_0x6982('0x33')]['rawAttributes']);_0x3afc26[_0x6982('0x37')]=_[_0x6982('0x38')](_0x2f837f[_0x6982('0x37')]);_0x3afc26['filters']=_[_0x6982('0x3c')](_0x3afc26[_0x6982('0x3a')],_0x3afc26[_0x6982('0x37')]);_0x28d7a6[_0x6982('0x3b')]=_['intersection'](_0x3afc26[_0x6982('0x3a')],qs[_0x6982('0x3d')](_0x2f837f['query'][_0x6982('0x3d')]));_0x28d7a6[_0x6982('0x3b')]=_0x28d7a6[_0x6982('0x3b')][_0x6982('0x3e')]?_0x28d7a6[_0x6982('0x3b')]:_0x3afc26[_0x6982('0x3a')];if(_0x2f837f[_0x6982('0x37')][_0x6982('0x45')]){_0x28d7a6['include']=[{'all':!![]}];}_0x28d7a6=_[_0x6982('0x4a')]({},_0x28d7a6,_0x2f837f[_0x6982('0x44')]);return db['Dashboard'][_0x6982('0x4b')](_0x28d7a6)[_0x6982('0x28')](handleEntityNotFound(_0x21e405,null))[_0x6982('0x28')](respondWithResult(_0x21e405,null))[_0x6982('0x4c')](handleError(_0x21e405,null));};exports[_0x6982('0x4d')]=function(_0x2a0ef1,_0x13f654){return db[_0x6982('0x33')]['create'](_0x2a0ef1[_0x6982('0x4e')],{})[_0x6982('0x28')](function(_0x4f1085){var _0x41c8d3=_0x2a0ef1[_0x6982('0x4f')][_0x6982('0x2a')]({'plain':!![]});if(!_0x41c8d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41c8d3[_0x6982('0x50')]===_0x6982('0x4f')){var _0x3784c4=_0x4f1085[_0x6982('0x2a')]({'plain':!![]});var _0x3b1ba7=_0x6982('0x51');return db[_0x6982('0x52')][_0x6982('0x4b')]({'where':{'name':_0x3b1ba7,'userProfileId':_0x41c8d3[_0x6982('0x53')]},'raw':!![]})[_0x6982('0x28')](function(_0x5516bd){if(_0x5516bd&&_0x5516bd[_0x6982('0x54')]===0x0){return db[_0x6982('0x2b')][_0x6982('0x4d')]({'name':_0x3784c4[_0x6982('0x2f')],'resourceId':_0x3784c4['id'],'type':_0x5516bd[_0x6982('0x2f')],'sectionId':_0x5516bd['id']},{})[_0x6982('0x28')](function(){return _0x4f1085;});}else{return _0x4f1085;}})['catch'](function(_0x5bdc22){logger['error'](_0x6982('0x55'),_0x5bdc22);throw _0x5bdc22;});}return _0x4f1085;})[_0x6982('0x28')](respondWithResult(_0x13f654,0xc9))[_0x6982('0x4c')](handleError(_0x13f654,null));};exports['clone']=function(_0xb3e207,_0x4e73ab){var _0x36c7f0={'where':{'id':_0xb3e207[_0x6982('0x49')]['id']}},_0x5c5a7d={};_0x5c5a7d[_0x6982('0x3a')]=_['keys'](db['Dashboard'][_0x6982('0x34')]);_0x36c7f0[_0x6982('0x3b')]=_['intersection'](_0x5c5a7d[_0x6982('0x3a')],qs[_0x6982('0x3d')](_0xb3e207[_0x6982('0x37')][_0x6982('0x3d')]));_0x36c7f0['attributes']=_0x36c7f0[_0x6982('0x3b')]['length']?_0x36c7f0['attributes']:_0x5c5a7d[_0x6982('0x3a')];if(_0xb3e207[_0x6982('0x37')][_0x6982('0x45')]){_0x36c7f0[_0x6982('0x46')]=[{'all':!![]}];}_0x36c7f0=_[_0x6982('0x4a')]({},_0x36c7f0,_0xb3e207['options']);return db[_0x6982('0x33')][_0x6982('0x4b')](_0x36c7f0)['then'](handleEntityNotFound(_0x4e73ab,null))[_0x6982('0x28')](function(_0x4ff935){if(_0x4ff935){var _0x3a4630=_0x4ff935['get']({'plain':!![]});_0x3a4630=qs['omit'](_0x3a4630,['id',_0x6982('0x56'),_0x6982('0x57')]);_0xb3e207['body']=_[_0x6982('0x58')](_0xb3e207['body'],['id',_0x6982('0x56'),_0x6982('0x57')]);return db[_0x6982('0x33')]['create'](_[_0x6982('0x4a')](_0x3a4630,_0xb3e207[_0x6982('0x4e')]),{'include':_0xb3e207[_0x6982('0x37')][_0x6982('0x45')]?[{'all':!![]}]:undefined})[_0x6982('0x28')](function(_0xad6a1d){var _0x51a127=_0xb3e207[_0x6982('0x4f')][_0x6982('0x2a')]({'plain':!![]});if(!_0x51a127)throw new Error(_0x6982('0x59'));if(_0x51a127[_0x6982('0x50')]===_0x6982('0x4f')){var _0x20f493=_0xad6a1d['get']({'plain':!![]});var _0xc7e6cf='CustomDashboards';return db[_0x6982('0x52')][_0x6982('0x4b')]({'where':{'name':_0xc7e6cf,'userProfileId':_0x51a127[_0x6982('0x53')]},'raw':!![]})[_0x6982('0x28')](function(_0x33b034){if(_0x33b034&&_0x33b034[_0x6982('0x54')]===0x0){return db['UserProfileResource'][_0x6982('0x4d')]({'name':_0x20f493[_0x6982('0x2f')],'resourceId':_0x20f493['id'],'type':_0x33b034['name'],'sectionId':_0x33b034['id']},{})['then'](function(){return _0xad6a1d;});}else{return _0xad6a1d;}})['catch'](function(_0x3410c3){logger[_0x6982('0x2d')](_0x6982('0x55'),_0x3410c3);throw _0x3410c3;});}return _0xad6a1d;});}})[_0x6982('0x28')](respondWithResult(_0x4e73ab,0xc9))['catch'](handleError(_0x4e73ab,null));};exports['update']=function(_0x177f66,_0x5ba25b){if(_0x177f66[_0x6982('0x4e')]['id']){delete _0x177f66['body']['id'];}return db[_0x6982('0x33')][_0x6982('0x4b')]({'where':{'id':_0x177f66[_0x6982('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ba25b,null))['then'](saveUpdates(_0x177f66['body'],null))[_0x6982('0x28')](respondWithResult(_0x5ba25b,null))[_0x6982('0x4c')](handleError(_0x5ba25b,null));};exports[_0x6982('0x29')]=function(_0x537fbd,_0x142ab9){return db['Dashboard'][_0x6982('0x4b')]({'where':{'id':_0x537fbd[_0x6982('0x49')]['id']}})['then'](handleEntityNotFound(_0x142ab9,null))[_0x6982('0x28')](removeEntity(_0x142ab9,null))['catch'](handleError(_0x142ab9,null));};function widgetAttributes(_0x1734e0){try{switch(_0x1734e0['type']){case'iframe':return[{'name':_0x6982('0x5a'),'value':_0x1734e0[_0x6982('0x5a')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x0]?_0x1734e0[_0x6982('0x5b')][0x0][_0x6982('0x5c')]:undefined)||_0x6982('0x5d')}];case'custom':return[{'name':_0x6982('0x5e'),'value':_0x1734e0[_0x6982('0x5e')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x0]?_0x1734e0[_0x6982('0x5b')][0x0][_0x6982('0x5c')]:undefined)||''}];case _0x6982('0x5f'):return[{'name':'attrHourFormat','value':_0x1734e0[_0x6982('0x60')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x0]?_0x1734e0[_0x6982('0x5b')][0x0][_0x6982('0x5c')]:undefined)||_0x6982('0x61')},{'name':_0x6982('0x62'),'value':_0x1734e0[_0x6982('0x62')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x1]?_0x1734e0[_0x6982('0x5b')][0x1][_0x6982('0x5c')]:undefined)||_0x6982('0x63')},{'name':_0x6982('0x64'),'value':_0x1734e0[_0x6982('0x64')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x2]?_0x1734e0['attrs'][0x2][_0x6982('0x5c')]:undefined)||0xc}];case _0x6982('0x65'):return[{'name':_0x6982('0x66'),'value':_0x1734e0['attrMetric']||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0['attrs'][0x0]?_0x1734e0[_0x6982('0x5b')][0x0]['value']:undefined)||_0x6982('0x67')},{'name':_0x6982('0x68'),'value':_0x1734e0[_0x6982('0x68')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x1]?_0x1734e0['attrs'][0x1][_0x6982('0x5c')]:undefined)||[]},{'name':_0x6982('0x64'),'value':_0x1734e0[_0x6982('0x64')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x2]?_0x1734e0['attrs'][0x2][_0x6982('0x5c')]:undefined)||0x14},{'name':_0x6982('0x69'),'value':_0x1734e0[_0x6982('0x69')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x3]?_0x1734e0[_0x6982('0x5b')][0x3][_0x6982('0x5c')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1734e0[_0x6982('0x6a')]||(_0x1734e0['attrs']&&_0x1734e0['attrs'][0x4]?_0x1734e0[_0x6982('0x5b')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x1734e0['attrFaxAccounts']||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x5]?_0x1734e0['attrs'][0x5]['value']:undefined)||''},{'name':_0x6982('0x6b'),'value':_0x1734e0[_0x6982('0x6b')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x6]?_0x1734e0[_0x6982('0x5b')][0x6][_0x6982('0x5c')]:undefined)||''},{'name':_0x6982('0x6c'),'value':_0x1734e0[_0x6982('0x6c')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x7]?_0x1734e0[_0x6982('0x5b')][0x7][_0x6982('0x5c')]:undefined)||''},{'name':_0x6982('0x6d'),'value':_0x1734e0[_0x6982('0x6d')]||(_0x1734e0['attrs']&&_0x1734e0[_0x6982('0x5b')][0x8]?_0x1734e0[_0x6982('0x5b')][0x8][_0x6982('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1734e0['attrChatWebsites']||(_0x1734e0['attrs']&&_0x1734e0[_0x6982('0x5b')][0x9]?_0x1734e0['attrs'][0x9][_0x6982('0x5c')]:undefined)||''}];case _0x6982('0x6e'):case _0x6982('0x6f'):return[{'name':_0x6982('0x70'),'value':_0x1734e0[_0x6982('0x70')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x0]?_0x1734e0[_0x6982('0x5b')][0x0][_0x6982('0x5c')]:undefined)||_0x6982('0x67')},{'name':'attrSerie2','value':_0x1734e0[_0x6982('0x71')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x1]?_0x1734e0[_0x6982('0x5b')][0x1][_0x6982('0x5c')]:undefined)||null},{'name':_0x6982('0x72'),'value':_0x1734e0['attrSerie3']||(_0x1734e0['attrs']&&_0x1734e0[_0x6982('0x5b')][0x2]?_0x1734e0[_0x6982('0x5b')][0x2][_0x6982('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1734e0[_0x6982('0x68')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0['attrs'][0x3]?_0x1734e0[_0x6982('0x5b')][0x3][_0x6982('0x5c')]:undefined)||[]},{'name':_0x6982('0x69'),'value':_0x1734e0[_0x6982('0x69')]||(_0x1734e0['attrs']&&_0x1734e0[_0x6982('0x5b')][0x4]?_0x1734e0['attrs'][0x4][_0x6982('0x5c')]:undefined)||_0x6982('0x73')},{'name':_0x6982('0x6a'),'value':_0x1734e0[_0x6982('0x6a')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x5]?_0x1734e0[_0x6982('0x5b')][0x5][_0x6982('0x5c')]:undefined)||''},{'name':_0x6982('0x74'),'value':_0x1734e0[_0x6982('0x74')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x6]?_0x1734e0['attrs'][0x6][_0x6982('0x5c')]:undefined)||''},{'name':_0x6982('0x6b'),'value':_0x1734e0[_0x6982('0x6b')]||(_0x1734e0['attrs']&&_0x1734e0['attrs'][0x7]?_0x1734e0[_0x6982('0x5b')][0x7][_0x6982('0x5c')]:undefined)||''},{'name':_0x6982('0x6c'),'value':_0x1734e0[_0x6982('0x6c')]||(_0x1734e0['attrs']&&_0x1734e0['attrs'][0x8]?_0x1734e0[_0x6982('0x5b')][0x8][_0x6982('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1734e0[_0x6982('0x6d')]||(_0x1734e0['attrs']&&_0x1734e0[_0x6982('0x5b')][0x9]?_0x1734e0[_0x6982('0x5b')][0x9]['value']:undefined)||''},{'name':_0x6982('0x75'),'value':_0x1734e0[_0x6982('0x75')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0['attrs'][0xa]?_0x1734e0[_0x6982('0x5b')][0xa][_0x6982('0x5c')]:undefined)||''}];case _0x6982('0x76'):return[{'name':_0x6982('0x77'),'type':_0x1734e0[_0x6982('0x78')]||(_0x1734e0['attrs']&&_0x1734e0[_0x6982('0x5b')][0x0]?_0x1734e0[_0x6982('0x5b')][0x0]['type']:undefined)||null,'value':_0x1734e0[_0x6982('0x77')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0['attrs'][0x0]?_0x1734e0['attrs'][0x0][_0x6982('0x5c')]:undefined)||null},{'name':_0x6982('0x79'),'value':_0x1734e0[_0x6982('0x79')]||(_0x1734e0[_0x6982('0x5b')]&&_0x1734e0[_0x6982('0x5b')][0x1]?_0x1734e0[_0x6982('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x47e9a4){logger[_0x6982('0x2d')]('widgetAttributes:\x20%s',JSON['stringify'](_0x47e9a4));return[];}}exports[_0x6982('0x7a')]=function(_0x4f279b,_0x435d6c,_0x5ebf0d){if(_0x4f279b[_0x6982('0x4e')]['id']){delete _0x4f279b[_0x6982('0x4e')]['id'];}return db[_0x6982('0x33')][_0x6982('0x4b')]({'where':{'id':_0x4f279b[_0x6982('0x49')]['id']}})['then'](handleEntityNotFound(_0x435d6c,null))[_0x6982('0x28')](function(_0x347b23){if(_0x347b23){_0x4f279b[_0x6982('0x4e')][_0x6982('0x7b')]=_0x347b23['id'];_0x4f279b['body']['attrs']=widgetAttributes(_0x4f279b['body']);return db[_0x6982('0x7c')][_0x6982('0x4d')](_0x4f279b['body']);}})[_0x6982('0x28')](respondWithResult(_0x435d6c,null))['catch'](handleError(_0x435d6c,null));};exports[_0x6982('0x7d')]=function(_0x3bf44c,_0x42b8c1,_0x49a574){var _0x3089bf={};var _0x38c4ee={};var _0x43a377;var _0x52462c;return db[_0x6982('0x33')][_0x6982('0x7e')]({'where':{'id':_0x3bf44c['params']['id']}})[_0x6982('0x28')](handleEntityNotFound(_0x42b8c1,null))[_0x6982('0x28')](function(_0x199a9f){if(_0x199a9f){_0x43a377=_0x199a9f;_0x38c4ee[_0x6982('0x3a')]=_['keys'](db[_0x6982('0x7c')][_0x6982('0x34')]);_0x38c4ee[_0x6982('0x37')]=_['keys'](_0x3bf44c[_0x6982('0x37')]);_0x38c4ee[_0x6982('0x39')]=_[_0x6982('0x3c')](_0x38c4ee['model'],_0x38c4ee['query']);_0x3089bf[_0x6982('0x3b')]=_[_0x6982('0x3c')](_0x38c4ee['model'],qs['fields'](_0x3bf44c[_0x6982('0x37')][_0x6982('0x3d')]));_0x3089bf[_0x6982('0x3b')]=_0x3089bf[_0x6982('0x3b')][_0x6982('0x3e')]?_0x3089bf[_0x6982('0x3b')]:_0x38c4ee[_0x6982('0x3a')];_0x3089bf[_0x6982('0x7f')]=qs[_0x6982('0x40')](_0x3bf44c[_0x6982('0x37')][_0x6982('0x40')]);_0x3089bf[_0x6982('0x43')]=qs['filters'](_[_0x6982('0x41')](_0x3bf44c[_0x6982('0x37')],_0x38c4ee[_0x6982('0x39')]));if(_0x3bf44c[_0x6982('0x37')][_0x6982('0x42')]){_0x3089bf[_0x6982('0x43')]=_[_0x6982('0x4a')](_0x3089bf[_0x6982('0x43')],{'$or':_[_0x6982('0x32')](_0x3089bf[_0x6982('0x3b')],function(_0x562e99){var _0x137bc7={};_0x137bc7[_0x562e99]={'$like':'%'+_0x3bf44c[_0x6982('0x37')][_0x6982('0x42')]+'%'};return _0x137bc7;})});}_0x3089bf=_[_0x6982('0x4a')]({},_0x3089bf,_0x3bf44c[_0x6982('0x44')]);return _0x43a377['getItems'](_0x3089bf);}})[_0x6982('0x28')](function(_0x5ee49e){if(_0x5ee49e){_0x52462c=_0x5ee49e[_0x6982('0x3e')];if(!_0x3bf44c[_0x6982('0x37')][_0x6982('0x3f')](_0x6982('0x80'))){_0x3089bf['limit']=qs['limit'](_0x3bf44c['query'][_0x6982('0x22')]);_0x3089bf[_0x6982('0x20')]=qs[_0x6982('0x20')](_0x3bf44c[_0x6982('0x37')][_0x6982('0x20')]);}return _0x43a377['getItems'](_0x3089bf);}})['then'](function(_0x57979c){if(_0x57979c){return _0x57979c?{'count':_0x52462c,'rows':_0x57979c}:null;}})[_0x6982('0x28')](respondWithResult(_0x42b8c1,null))['catch'](handleError(_0x42b8c1,null));}; \ No newline at end of file +var _0x43ae=['UserProfileResource','sendStatus','stack','name','send','index','map','Dashboard','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','merge','create','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','json','offset','undefined','count','status','Content-Range','apply','save','update','then','destroy','get','CustomDashboards'];(function(_0x576f7a,_0x40e8a2){var _0x30f99e=function(_0x2c4335){while(--_0x2c4335){_0x576f7a['push'](_0x576f7a['shift']());}};_0x30f99e(++_0x40e8a2);}(_0x43ae,0x1e8));var _0xe43a=function(_0x46bfc8,_0x2ae338){_0x46bfc8=_0x46bfc8-0x0;var _0x374924=_0x43ae[_0x46bfc8];return _0x374924;};'use strict';var emlformat=require(_0xe43a('0x0'));var rimraf=require(_0xe43a('0x1'));var zipdir=require(_0xe43a('0x2'));var jsonpatch=require(_0xe43a('0x3'));var rp=require(_0xe43a('0x4'));var moment=require(_0xe43a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe43a('0x6'));var util=require(_0xe43a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe43a('0x8'));var ejs=require(_0xe43a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe43a('0xa'));var squel=require(_0xe43a('0xb'));var crypto=require(_0xe43a('0xc'));var jsforce=require(_0xe43a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe43a('0xe'));var Papa=require(_0xe43a('0xf'));var Redis=require(_0xe43a('0x10'));var authService=require(_0xe43a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe43a('0x12'));var hardwareService=require(_0xe43a('0x13'));var logger=require(_0xe43a('0x14'))(_0xe43a('0x15'));var utils=require(_0xe43a('0x16'));var config=require(_0xe43a('0x17'));var licenseUtil=require(_0xe43a('0x18'));var db=require(_0xe43a('0x19'))['db'];config['redis']=_[_0xe43a('0x1a')](config[_0xe43a('0x1b')],{'host':_0xe43a('0x1c'),'port':0x18eb});var socket=require(_0xe43a('0x1d'))(new Redis(config[_0xe43a('0x1b')]));require('./dashboard.socket')[_0xe43a('0x1e')](socket);function respondWithStatusCode(_0x34e623,_0x47092a){_0x47092a=_0x47092a||0xcc;return function(_0x87f954){if(_0x87f954){return _0x34e623['sendStatus'](_0x47092a);}return _0x34e623['status'](_0x47092a)['end']();};}function respondWithResult(_0x290237,_0x44ab9e){_0x44ab9e=_0x44ab9e||0xc8;return function(_0x2a7321){if(_0x2a7321){return _0x290237['status'](_0x44ab9e)[_0xe43a('0x1f')](_0x2a7321);}};}function respondWithFilteredResult(_0x89dbe7,_0x4223f7){return function(_0x565d7b){if(_0x565d7b){var _0x419a8b=typeof _0x4223f7[_0xe43a('0x20')]===_0xe43a('0x21')&&typeof _0x4223f7['limit']===_0xe43a('0x21');var _0x28e336=_0x565d7b[_0xe43a('0x22')];var _0x41dd0a=_0x419a8b?0x0:_0x4223f7[_0xe43a('0x20')];var _0x182f89=_0x419a8b?_0x565d7b[_0xe43a('0x22')]:_0x4223f7['offset']+_0x4223f7['limit'];var _0x497f2f;if(_0x182f89>=_0x28e336){_0x182f89=_0x28e336;_0x497f2f=0xc8;}else{_0x497f2f=0xce;}_0x89dbe7[_0xe43a('0x23')](_0x497f2f);return _0x89dbe7['set'](_0xe43a('0x24'),_0x41dd0a+'-'+_0x182f89+'/'+_0x28e336)['json'](_0x565d7b);}return null;};}function patchUpdates(_0x4cc89b){return function(_0x249f7f){try{jsonpatch[_0xe43a('0x25')](_0x249f7f,_0x4cc89b,!![]);}catch(_0x35af1c){return BPromise['reject'](_0x35af1c);}return _0x249f7f[_0xe43a('0x26')]();};}function saveUpdates(_0x7803f8,_0x489712){return function(_0x3277e9){if(_0x3277e9){return _0x3277e9[_0xe43a('0x27')](_0x7803f8)[_0xe43a('0x28')](function(_0x68ae39){return _0x68ae39;});}return null;};}function removeEntity(_0xbc5738,_0x58a916){return function(_0x483046){if(_0x483046){return _0x483046[_0xe43a('0x29')]()['then'](function(){var _0x392993=_0x483046[_0xe43a('0x2a')]({'plain':!![]});var _0x122c20=_0xe43a('0x2b');return db[_0xe43a('0x2c')][_0xe43a('0x29')]({'where':{'type':_0x122c20,'resourceId':_0x392993['id']}})['then'](function(){return _0x483046;});})['then'](function(){_0xbc5738['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff5cf,_0x2f2a99){return function(_0x1fe45a){if(!_0x1fe45a){_0x3ff5cf[_0xe43a('0x2d')](0x194);}return _0x1fe45a;};}function handleError(_0x41307c,_0x27537d){_0x27537d=_0x27537d||0x1f4;return function(_0x3a8f58){logger['error'](_0x3a8f58[_0xe43a('0x2e')]);if(_0x3a8f58['name']){delete _0x3a8f58[_0xe43a('0x2f')];}_0x41307c[_0xe43a('0x23')](_0x27537d)[_0xe43a('0x30')](_0x3a8f58);};}exports[_0xe43a('0x31')]=function(_0x165f0e,_0x463c08){var _0x3a88b1={},_0x10fdeb={},_0x3f4081={'count':0x0,'rows':[]};var _0x52ff6f=_[_0xe43a('0x32')](db[_0xe43a('0x33')]['rawAttributes'],function(_0x378195){return{'name':_0x378195[_0xe43a('0x34')],'type':_0x378195[_0xe43a('0x35')]['key']};});_0x10fdeb[_0xe43a('0x36')]=_[_0xe43a('0x32')](_0x52ff6f,_0xe43a('0x2f'));_0x10fdeb[_0xe43a('0x37')]=_[_0xe43a('0x38')](_0x165f0e[_0xe43a('0x37')]);_0x10fdeb[_0xe43a('0x39')]=_[_0xe43a('0x3a')](_0x10fdeb[_0xe43a('0x36')],_0x10fdeb['query']);_0x3a88b1[_0xe43a('0x3b')]=_['intersection'](_0x10fdeb[_0xe43a('0x36')],qs[_0xe43a('0x3c')](_0x165f0e[_0xe43a('0x37')][_0xe43a('0x3c')]));_0x3a88b1['attributes']=_0x3a88b1[_0xe43a('0x3b')][_0xe43a('0x3d')]?_0x3a88b1['attributes']:_0x10fdeb[_0xe43a('0x36')];if(!_0x165f0e['query'][_0xe43a('0x3e')](_0xe43a('0x3f'))){_0x3a88b1['limit']=qs[_0xe43a('0x40')](_0x165f0e[_0xe43a('0x37')][_0xe43a('0x40')]);_0x3a88b1[_0xe43a('0x20')]=qs[_0xe43a('0x20')](_0x165f0e[_0xe43a('0x37')][_0xe43a('0x20')]);}_0x3a88b1[_0xe43a('0x41')]=qs[_0xe43a('0x42')](_0x165f0e[_0xe43a('0x37')]['sort']);_0x3a88b1[_0xe43a('0x43')]=qs[_0xe43a('0x39')](_[_0xe43a('0x44')](_0x165f0e[_0xe43a('0x37')],_0x10fdeb[_0xe43a('0x39')]),_0x52ff6f);if(_0x165f0e['query'][_0xe43a('0x45')]){_0x3a88b1[_0xe43a('0x43')]=_['merge'](_0x3a88b1[_0xe43a('0x43')],{'$or':_[_0xe43a('0x32')](_0x52ff6f,function(_0xb0dd7a){if(_0xb0dd7a[_0xe43a('0x35')]!==_0xe43a('0x46')){var _0xc04961={};_0xc04961[_0xb0dd7a[_0xe43a('0x2f')]]={'$like':'%'+_0x165f0e[_0xe43a('0x37')][_0xe43a('0x45')]+'%'};return _0xc04961;}})});}_0x3a88b1=_['merge']({},_0x3a88b1,_0x165f0e[_0xe43a('0x47')]);var _0x3731b8={'where':_0x3a88b1['where']};return db[_0xe43a('0x33')][_0xe43a('0x22')](_0x3731b8)[_0xe43a('0x28')](function(_0x3d38c1){_0x3f4081[_0xe43a('0x22')]=_0x3d38c1;if(_0x165f0e['query']['includeAll']){_0x3a88b1[_0xe43a('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0xe43a('0x49')](_0x3a88b1);})[_0xe43a('0x28')](function(_0x5ed8aa){_0x3f4081[_0xe43a('0x4a')]=_0x5ed8aa;return _0x3f4081;})[_0xe43a('0x28')](respondWithFilteredResult(_0x463c08,_0x3a88b1))[_0xe43a('0x4b')](handleError(_0x463c08,null));};exports[_0xe43a('0x4c')]=function(_0x58ef97,_0x29f113){var _0x30b0fe={'raw':![],'where':{'id':_0x58ef97[_0xe43a('0x4d')]['id']}},_0x377009={};_0x377009['model']=_[_0xe43a('0x38')](db[_0xe43a('0x33')][_0xe43a('0x4e')]);_0x377009['query']=_[_0xe43a('0x38')](_0x58ef97[_0xe43a('0x37')]);_0x377009[_0xe43a('0x39')]=_[_0xe43a('0x3a')](_0x377009[_0xe43a('0x36')],_0x377009[_0xe43a('0x37')]);_0x30b0fe[_0xe43a('0x3b')]=_[_0xe43a('0x3a')](_0x377009[_0xe43a('0x36')],qs[_0xe43a('0x3c')](_0x58ef97[_0xe43a('0x37')][_0xe43a('0x3c')]));_0x30b0fe[_0xe43a('0x3b')]=_0x30b0fe[_0xe43a('0x3b')][_0xe43a('0x3d')]?_0x30b0fe[_0xe43a('0x3b')]:_0x377009[_0xe43a('0x36')];if(_0x58ef97[_0xe43a('0x37')][_0xe43a('0x4f')]){_0x30b0fe[_0xe43a('0x48')]=[{'all':!![]}];}_0x30b0fe=_[_0xe43a('0x50')]({},_0x30b0fe,_0x58ef97[_0xe43a('0x47')]);return db[_0xe43a('0x33')]['find'](_0x30b0fe)[_0xe43a('0x28')](handleEntityNotFound(_0x29f113,null))['then'](respondWithResult(_0x29f113,null))[_0xe43a('0x4b')](handleError(_0x29f113,null));};exports['create']=function(_0x538881,_0x208bd3){return db[_0xe43a('0x33')][_0xe43a('0x51')](_0x538881['body'],{})[_0xe43a('0x28')](function(_0x2b3592){var _0x254ebc=_0x538881[_0xe43a('0x52')]['get']({'plain':!![]});if(!_0x254ebc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x254ebc[_0xe43a('0x53')]===_0xe43a('0x52')){var _0x2fbbff=_0x2b3592[_0xe43a('0x2a')]({'plain':!![]});var _0x1fdbe3=_0xe43a('0x2b');return db['UserProfileSection'][_0xe43a('0x54')]({'where':{'name':_0x1fdbe3,'userProfileId':_0x254ebc['userProfileId']},'raw':!![]})[_0xe43a('0x28')](function(_0x1d2731){if(_0x1d2731&&_0x1d2731[_0xe43a('0x55')]===0x0){return db[_0xe43a('0x2c')][_0xe43a('0x51')]({'name':_0x2fbbff['name'],'resourceId':_0x2fbbff['id'],'type':_0x1d2731[_0xe43a('0x2f')],'sectionId':_0x1d2731['id']},{})[_0xe43a('0x28')](function(){return _0x2b3592;});}else{return _0x2b3592;}})[_0xe43a('0x4b')](function(_0x29061b){logger['error'](_0xe43a('0x56'),_0x29061b);throw _0x29061b;});}return _0x2b3592;})[_0xe43a('0x28')](respondWithResult(_0x208bd3,0xc9))[_0xe43a('0x4b')](handleError(_0x208bd3,null));};exports[_0xe43a('0x57')]=function(_0x5de63f,_0x1c2613){var _0x5d8bf7={'where':{'id':_0x5de63f['params']['id']}},_0x453509={};_0x453509[_0xe43a('0x36')]=_[_0xe43a('0x38')](db['Dashboard']['rawAttributes']);_0x5d8bf7['attributes']=_['intersection'](_0x453509[_0xe43a('0x36')],qs[_0xe43a('0x3c')](_0x5de63f[_0xe43a('0x37')]['fields']));_0x5d8bf7['attributes']=_0x5d8bf7[_0xe43a('0x3b')]['length']?_0x5d8bf7[_0xe43a('0x3b')]:_0x453509[_0xe43a('0x36')];if(_0x5de63f[_0xe43a('0x37')][_0xe43a('0x4f')]){_0x5d8bf7[_0xe43a('0x48')]=[{'all':!![]}];}_0x5d8bf7=_[_0xe43a('0x50')]({},_0x5d8bf7,_0x5de63f[_0xe43a('0x47')]);return db['Dashboard']['find'](_0x5d8bf7)[_0xe43a('0x28')](handleEntityNotFound(_0x1c2613,null))[_0xe43a('0x28')](function(_0x2bb485){if(_0x2bb485){var _0x5be866=_0x2bb485[_0xe43a('0x2a')]({'plain':!![]});_0x5be866=qs[_0xe43a('0x58')](_0x5be866,['id',_0xe43a('0x59'),_0xe43a('0x5a')]);_0x5de63f[_0xe43a('0x5b')]=_['omit'](_0x5de63f[_0xe43a('0x5b')],['id',_0xe43a('0x59'),_0xe43a('0x5a')]);return db[_0xe43a('0x33')]['create'](_[_0xe43a('0x50')](_0x5be866,_0x5de63f['body']),{'include':_0x5de63f['query']['includeAll']?[{'all':!![]}]:undefined})[_0xe43a('0x28')](function(_0x396845){var _0xf99dbf=_0x5de63f[_0xe43a('0x52')][_0xe43a('0x2a')]({'plain':!![]});if(!_0xf99dbf)throw new Error(_0xe43a('0x5c'));if(_0xf99dbf[_0xe43a('0x53')]==='user'){var _0x8a0cd4=_0x396845[_0xe43a('0x2a')]({'plain':!![]});var _0x191176=_0xe43a('0x2b');return db[_0xe43a('0x5d')][_0xe43a('0x54')]({'where':{'name':_0x191176,'userProfileId':_0xf99dbf[_0xe43a('0x5e')]},'raw':!![]})[_0xe43a('0x28')](function(_0x1262a7){if(_0x1262a7&&_0x1262a7[_0xe43a('0x55')]===0x0){return db[_0xe43a('0x2c')]['create']({'name':_0x8a0cd4[_0xe43a('0x2f')],'resourceId':_0x8a0cd4['id'],'type':_0x1262a7['name'],'sectionId':_0x1262a7['id']},{})[_0xe43a('0x28')](function(){return _0x396845;});}else{return _0x396845;}})[_0xe43a('0x4b')](function(_0x48e7ff){logger[_0xe43a('0x5f')](_0xe43a('0x56'),_0x48e7ff);throw _0x48e7ff;});}return _0x396845;});}})[_0xe43a('0x28')](respondWithResult(_0x1c2613,0xc9))[_0xe43a('0x4b')](handleError(_0x1c2613,null));};exports[_0xe43a('0x27')]=function(_0x475507,_0x29f949){if(_0x475507[_0xe43a('0x5b')]['id']){delete _0x475507[_0xe43a('0x5b')]['id'];}return db[_0xe43a('0x33')][_0xe43a('0x54')]({'where':{'id':_0x475507[_0xe43a('0x4d')]['id']}})[_0xe43a('0x28')](handleEntityNotFound(_0x29f949,null))['then'](saveUpdates(_0x475507[_0xe43a('0x5b')],null))['then'](respondWithResult(_0x29f949,null))[_0xe43a('0x4b')](handleError(_0x29f949,null));};exports[_0xe43a('0x29')]=function(_0x2d7f26,_0x12fb0d){return db[_0xe43a('0x33')][_0xe43a('0x54')]({'where':{'id':_0x2d7f26['params']['id']}})[_0xe43a('0x28')](handleEntityNotFound(_0x12fb0d,null))[_0xe43a('0x28')](removeEntity(_0x12fb0d,null))['catch'](handleError(_0x12fb0d,null));};function widgetAttributes(_0x56f7f5){try{switch(_0x56f7f5['type']){case _0xe43a('0x60'):return[{'name':_0xe43a('0x61'),'value':_0x56f7f5[_0xe43a('0x61')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x0]?_0x56f7f5['attrs'][0x0][_0xe43a('0x63')]:undefined)||'https://'}];case _0xe43a('0x64'):return[{'name':_0xe43a('0x65'),'value':_0x56f7f5[_0xe43a('0x65')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x0]?_0x56f7f5[_0xe43a('0x62')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xe43a('0x66'),'value':_0x56f7f5[_0xe43a('0x66')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x0]?_0x56f7f5[_0xe43a('0x62')][0x0][_0xe43a('0x63')]:undefined)||_0xe43a('0x67')},{'name':'attrTimezone','value':_0x56f7f5[_0xe43a('0x68')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x1]?_0x56f7f5[_0xe43a('0x62')][0x1][_0xe43a('0x63')]:undefined)||'0.00'},{'name':_0xe43a('0x69'),'value':_0x56f7f5[_0xe43a('0x69')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x2]?_0x56f7f5[_0xe43a('0x62')][0x2]['value']:undefined)||0xc}];case _0xe43a('0x6a'):return[{'name':_0xe43a('0x6b'),'value':_0x56f7f5[_0xe43a('0x6b')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x0]?_0x56f7f5[_0xe43a('0x62')][0x0][_0xe43a('0x63')]:undefined)||_0xe43a('0x6c')},{'name':'attrVoiceQueues','value':_0x56f7f5[_0xe43a('0x6d')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x1]?_0x56f7f5[_0xe43a('0x62')][0x1][_0xe43a('0x63')]:undefined)||[]},{'name':'attrFontSize','value':_0x56f7f5[_0xe43a('0x69')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x2]?_0x56f7f5['attrs'][0x2][_0xe43a('0x63')]:undefined)||0x14},{'name':'attrChannel','value':_0x56f7f5['attrChannel']||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x3]?_0x56f7f5[_0xe43a('0x62')][0x3][_0xe43a('0x63')]:undefined)||_0xe43a('0x6e')},{'name':'attrEmailAccounts','value':_0x56f7f5[_0xe43a('0x6f')]||(_0x56f7f5['attrs']&&_0x56f7f5['attrs'][0x4]?_0x56f7f5[_0xe43a('0x62')][0x4][_0xe43a('0x63')]:undefined)||''},{'name':_0xe43a('0x70'),'value':_0x56f7f5[_0xe43a('0x70')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x5]?_0x56f7f5[_0xe43a('0x62')][0x5]['value']:undefined)||''},{'name':_0xe43a('0x71'),'value':_0x56f7f5[_0xe43a('0x71')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x6]?_0x56f7f5['attrs'][0x6]['value']:undefined)||''},{'name':_0xe43a('0x72'),'value':_0x56f7f5[_0xe43a('0x72')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x7]?_0x56f7f5[_0xe43a('0x62')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x56f7f5[_0xe43a('0x73')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x8]?_0x56f7f5[_0xe43a('0x62')][0x8][_0xe43a('0x63')]:undefined)||''},{'name':_0xe43a('0x74'),'value':_0x56f7f5[_0xe43a('0x74')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x9]?_0x56f7f5[_0xe43a('0x62')][0x9]['value']:undefined)||''}];case _0xe43a('0x75'):case _0xe43a('0x76'):return[{'name':_0xe43a('0x77'),'value':_0x56f7f5[_0xe43a('0x77')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5['attrs'][0x0]?_0x56f7f5[_0xe43a('0x62')][0x0][_0xe43a('0x63')]:undefined)||'total'},{'name':_0xe43a('0x78'),'value':_0x56f7f5[_0xe43a('0x78')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x1]?_0x56f7f5['attrs'][0x1][_0xe43a('0x63')]:undefined)||null},{'name':_0xe43a('0x79'),'value':_0x56f7f5['attrSerie3']||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x2]?_0x56f7f5[_0xe43a('0x62')][0x2]['value']:undefined)||null},{'name':_0xe43a('0x6d'),'value':_0x56f7f5[_0xe43a('0x6d')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5['attrs'][0x3]?_0x56f7f5[_0xe43a('0x62')][0x3][_0xe43a('0x63')]:undefined)||[]},{'name':'attrChannel','value':_0x56f7f5[_0xe43a('0x7a')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x4]?_0x56f7f5[_0xe43a('0x62')][0x4][_0xe43a('0x63')]:undefined)||_0xe43a('0x6e')},{'name':'attrEmailAccounts','value':_0x56f7f5[_0xe43a('0x6f')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x5]?_0x56f7f5[_0xe43a('0x62')][0x5][_0xe43a('0x63')]:undefined)||''},{'name':_0xe43a('0x70'),'value':_0x56f7f5[_0xe43a('0x70')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x6]?_0x56f7f5[_0xe43a('0x62')][0x6]['value']:undefined)||''},{'name':_0xe43a('0x71'),'value':_0x56f7f5[_0xe43a('0x71')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x7]?_0x56f7f5['attrs'][0x7][_0xe43a('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x56f7f5[_0xe43a('0x72')]||(_0x56f7f5['attrs']&&_0x56f7f5['attrs'][0x8]?_0x56f7f5[_0xe43a('0x62')][0x8][_0xe43a('0x63')]:undefined)||''},{'name':_0xe43a('0x73'),'value':_0x56f7f5['attrWhatsappAccounts']||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x9]?_0x56f7f5[_0xe43a('0x62')][0x9]['value']:undefined)||''},{'name':_0xe43a('0x74'),'value':_0x56f7f5[_0xe43a('0x74')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0xa]?_0x56f7f5['attrs'][0xa][_0xe43a('0x63')]:undefined)||''}];case'web-report':return[{'name':_0xe43a('0x7b'),'type':_0x56f7f5[_0xe43a('0x7c')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x0]?_0x56f7f5[_0xe43a('0x62')][0x0][_0xe43a('0x35')]:undefined)||null,'value':_0x56f7f5[_0xe43a('0x7b')]||(_0x56f7f5['attrs']&&_0x56f7f5[_0xe43a('0x62')][0x0]?_0x56f7f5[_0xe43a('0x62')][0x0]['value']:undefined)||null},{'name':_0xe43a('0x7d'),'value':_0x56f7f5[_0xe43a('0x7d')]||(_0x56f7f5[_0xe43a('0x62')]&&_0x56f7f5[_0xe43a('0x62')][0x1]?_0x56f7f5['attrs'][0x1][_0xe43a('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x58c5e8){logger[_0xe43a('0x5f')](_0xe43a('0x7e'),JSON[_0xe43a('0x7f')](_0x58c5e8));return[];}}exports[_0xe43a('0x80')]=function(_0x30b6c5,_0x1341fd,_0x285be4){if(_0x30b6c5['body']['id']){delete _0x30b6c5[_0xe43a('0x5b')]['id'];}return db[_0xe43a('0x33')][_0xe43a('0x54')]({'where':{'id':_0x30b6c5[_0xe43a('0x4d')]['id']}})[_0xe43a('0x28')](handleEntityNotFound(_0x1341fd,null))[_0xe43a('0x28')](function(_0x5bc54b){if(_0x5bc54b){_0x30b6c5[_0xe43a('0x5b')][_0xe43a('0x81')]=_0x5bc54b['id'];_0x30b6c5[_0xe43a('0x5b')][_0xe43a('0x62')]=widgetAttributes(_0x30b6c5[_0xe43a('0x5b')]);return db['DashboardItem'][_0xe43a('0x51')](_0x30b6c5['body']);}})[_0xe43a('0x28')](respondWithResult(_0x1341fd,null))['catch'](handleError(_0x1341fd,null));};exports[_0xe43a('0x82')]=function(_0x2d54ce,_0x36794f,_0x3ef958){var _0x1131ac={};var _0x4578b0={};var _0x311f02;var _0x394411;return db[_0xe43a('0x33')][_0xe43a('0x83')]({'where':{'id':_0x2d54ce['params']['id']}})[_0xe43a('0x28')](handleEntityNotFound(_0x36794f,null))[_0xe43a('0x28')](function(_0x1bc2fe){if(_0x1bc2fe){_0x311f02=_0x1bc2fe;_0x4578b0['model']=_[_0xe43a('0x38')](db[_0xe43a('0x84')][_0xe43a('0x4e')]);_0x4578b0[_0xe43a('0x37')]=_[_0xe43a('0x38')](_0x2d54ce[_0xe43a('0x37')]);_0x4578b0['filters']=_[_0xe43a('0x3a')](_0x4578b0[_0xe43a('0x36')],_0x4578b0[_0xe43a('0x37')]);_0x1131ac[_0xe43a('0x3b')]=_['intersection'](_0x4578b0[_0xe43a('0x36')],qs[_0xe43a('0x3c')](_0x2d54ce[_0xe43a('0x37')][_0xe43a('0x3c')]));_0x1131ac['attributes']=_0x1131ac[_0xe43a('0x3b')][_0xe43a('0x3d')]?_0x1131ac[_0xe43a('0x3b')]:_0x4578b0[_0xe43a('0x36')];_0x1131ac[_0xe43a('0x41')]=qs[_0xe43a('0x42')](_0x2d54ce['query'][_0xe43a('0x42')]);_0x1131ac[_0xe43a('0x43')]=qs[_0xe43a('0x39')](_[_0xe43a('0x44')](_0x2d54ce['query'],_0x4578b0['filters']));if(_0x2d54ce[_0xe43a('0x37')][_0xe43a('0x45')]){_0x1131ac[_0xe43a('0x43')]=_[_0xe43a('0x50')](_0x1131ac[_0xe43a('0x43')],{'$or':_[_0xe43a('0x32')](_0x1131ac['attributes'],function(_0x36a221){var _0x37a335={};_0x37a335[_0x36a221]={'$like':'%'+_0x2d54ce['query'][_0xe43a('0x45')]+'%'};return _0x37a335;})});}_0x1131ac=_[_0xe43a('0x50')]({},_0x1131ac,_0x2d54ce[_0xe43a('0x47')]);return _0x311f02['getItems'](_0x1131ac);}})[_0xe43a('0x28')](function(_0x309bee){if(_0x309bee){_0x394411=_0x309bee[_0xe43a('0x3d')];if(!_0x2d54ce['query'][_0xe43a('0x3e')](_0xe43a('0x3f'))){_0x1131ac[_0xe43a('0x40')]=qs[_0xe43a('0x40')](_0x2d54ce[_0xe43a('0x37')]['limit']);_0x1131ac[_0xe43a('0x20')]=qs['offset'](_0x2d54ce[_0xe43a('0x37')]['offset']);}return _0x311f02['getItems'](_0x1131ac);}})[_0xe43a('0x28')](function(_0x249dd4){if(_0x249dd4){return _0x249dd4?{'count':_0x394411,'rows':_0x249dd4}:null;}})[_0xe43a('0x28')](respondWithResult(_0x36794f,null))[_0xe43a('0x4b')](handleError(_0x36794f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c6ffb69..447314f 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 _0x1c90=['emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard','update','remove'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x1c90,0x104));var _0x01c9=function(_0x41bd00,_0x18bb98){_0x41bd00=_0x41bd00-0x0;var _0x5a8ecc=_0x1c90[_0x41bd00];return _0x5a8ecc;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x01c9('0x0'))['db'][_0x01c9('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x01c9('0x2'),'afterDestroy':_0x01c9('0x3')};function emitEvent(_0x5a84d9){return function(_0x77ec63,_0x3974f8,_0xd81ce7){DashboardEvents['emit'](_0x5a84d9+':'+_0x77ec63['id'],_0x77ec63);DashboardEvents[_0x01c9('0x4')](_0x5a84d9,_0x77ec63);_0xd81ce7(null);};}for(var e in events){if(events[_0x01c9('0x5')](e)){var event=events[e];Dashboard[_0x01c9('0x6')](e,emitEvent(event));}}module[_0x01c9('0x7')]=DashboardEvents; \ No newline at end of file +var _0xbb59=['Dashboard','setMaxListeners','save','update','remove','hook','exports','../../mysqldb'];(function(_0x592d4e,_0x22a38d){var _0x142e08=function(_0x921cf9){while(--_0x921cf9){_0x592d4e['push'](_0x592d4e['shift']());}};_0x142e08(++_0x22a38d);}(_0xbb59,0x167));var _0x9bb5=function(_0x56fa3e,_0x3dfe84){_0x56fa3e=_0x56fa3e-0x0;var _0x41a157=_0xbb59[_0x56fa3e];return _0x41a157;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x9bb5('0x0'))['db'][_0x9bb5('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9bb5('0x2')](0x0);var events={'afterCreate':_0x9bb5('0x3'),'afterUpdate':_0x9bb5('0x4'),'afterDestroy':_0x9bb5('0x5')};function emitEvent(_0x1f288d){return function(_0x304809,_0x35a697,_0x311401){DashboardEvents['emit'](_0x1f288d+':'+_0x304809['id'],_0x304809);DashboardEvents['emit'](_0x1f288d,_0x304809);_0x311401(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9bb5('0x6')](e,emitEvent(event));}}module[_0x9bb5('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 475d7d3..10a11eb 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 _0xefdc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util'];(function(_0x1a25cd,_0x52781f){var _0x288492=function(_0x545931){while(--_0x545931){_0x1a25cd['push'](_0x1a25cd['shift']());}};_0x288492(++_0x52781f);}(_0xefdc,0xc1));var _0xcefd=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xefdc[_0x1b1e76];return _0x3d743a;};'use strict';var _=require(_0xcefd('0x0'));var util=require(_0xcefd('0x1'));var logger=require(_0xcefd('0x2'))(_0xcefd('0x3'));var moment=require(_0xcefd('0x4'));var BPromise=require(_0xcefd('0x5'));var rp=require(_0xcefd('0x6'));var fs=require('fs');var path=require(_0xcefd('0x7'));var rimraf=require(_0xcefd('0x8'));var config=require('../../config/environment');var attributes=require(_0xcefd('0x9'));module[_0xcefd('0xa')]=function(_0x33af18,_0x40aa35){return _0x33af18['define'](_0xcefd('0xb'),attributes,{'tableName':_0xcefd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab4=['dashboards','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x9ab4,0x6f));var _0x49ab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9ab4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x49ab('0x0'));var util=require(_0x49ab('0x1'));var logger=require(_0x49ab('0x2'))(_0x49ab('0x3'));var moment=require('moment');var BPromise=require(_0x49ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49ab('0x5'));var rimraf=require(_0x49ab('0x6'));var config=require(_0x49ab('0x7'));var attributes=require(_0x49ab('0x8'));module[_0x49ab('0x9')]=function(_0x552cf3,_0x275a85){return _0x552cf3['define']('Dashboard',attributes,{'tableName':_0x49ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 2dd2d91..af52bde 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 _0x2cee=['redis','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0xbc0b17,_0x1a9d91){var _0x16a09a=function(_0x57e2e9){while(--_0x57e2e9){_0xbc0b17['push'](_0xbc0b17['shift']());}};_0x16a09a(++_0x1a9d91);}(_0x2cee,0x6d));var _0xe2ce=function(_0x4005c2,_0x5ec010){_0x4005c2=_0x4005c2-0x0;var _0x1233a2=_0x2cee[_0x4005c2];return _0x1233a2;};'use strict';var _=require(_0xe2ce('0x0'));var util=require(_0xe2ce('0x1'));var moment=require(_0xe2ce('0x2'));var BPromise=require(_0xe2ce('0x3'));var rs=require(_0xe2ce('0x4'));var fs=require('fs');var Redis=require(_0xe2ce('0x5'));var db=require(_0xe2ce('0x6'))['db'];var utils=require(_0xe2ce('0x7'));var logger=require(_0xe2ce('0x8'))(_0xe2ce('0x9'));var config=require(_0xe2ce('0xa'));var jayson=require(_0xe2ce('0xb'));var client=jayson[_0xe2ce('0xc')][_0xe2ce('0xd')]({'port':0x232a});config['redis']=_[_0xe2ce('0xe')](config[_0xe2ce('0xf')],{'host':_0xe2ce('0x10'),'port':0x18eb});var socket=require(_0xe2ce('0x11'))(new Redis(config[_0xe2ce('0xf')]));require('./dashboard.socket')[_0xe2ce('0x12')](socket);function respondWithRpcPromise(_0xc4b1a6,_0xdc099e,_0x327778){return new BPromise(function(_0x30588b,_0x48fd0f){return client[_0xe2ce('0x13')](_0xc4b1a6,_0x327778)[_0xe2ce('0x14')](function(_0x58f6f6){logger['info'](_0xe2ce('0x15'),_0xdc099e,_0xe2ce('0x16'));logger[_0xe2ce('0x17')](_0xe2ce('0x18'),_0xdc099e,_0xe2ce('0x16'),JSON['stringify'](_0x58f6f6));if(_0x58f6f6[_0xe2ce('0x19')]){if(_0x58f6f6[_0xe2ce('0x19')][_0xe2ce('0x1a')]===0x1f4){logger[_0xe2ce('0x19')](_0xe2ce('0x15'),_0xdc099e,_0x58f6f6['error'][_0xe2ce('0x1b')]);return _0x48fd0f(_0x58f6f6[_0xe2ce('0x19')]['message']);}logger[_0xe2ce('0x19')]('Dashboard,\x20%s,\x20%s',_0xdc099e,_0x58f6f6['error'][_0xe2ce('0x1b')]);return _0x30588b(_0x58f6f6[_0xe2ce('0x19')][_0xe2ce('0x1b')]);}else{logger[_0xe2ce('0x1c')](_0xe2ce('0x15'),_0xdc099e,_0xe2ce('0x16'));_0x30588b(_0x58f6f6[_0xe2ce('0x1d')]['message']);}})[_0xe2ce('0x1e')](function(_0x5bdecc){logger['error']('Dashboard,\x20%s,\x20%s',_0xdc099e,_0x5bdecc);_0x48fd0f(_0x5bdecc);});});} \ No newline at end of file +var _0x5d30=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x514b7a,_0x525876){var _0x4f3233=function(_0x179446){while(--_0x179446){_0x514b7a['push'](_0x514b7a['shift']());}};_0x4f3233(++_0x525876);}(_0x5d30,0x19d));var _0x05d3=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x5d30[_0x673722];return _0x21249c;};'use strict';var _=require(_0x05d3('0x0'));var util=require(_0x05d3('0x1'));var moment=require(_0x05d3('0x2'));var BPromise=require(_0x05d3('0x3'));var rs=require(_0x05d3('0x4'));var fs=require('fs');var Redis=require(_0x05d3('0x5'));var db=require(_0x05d3('0x6'))['db'];var utils=require(_0x05d3('0x7'));var logger=require('../../config/logger')(_0x05d3('0x8'));var config=require(_0x05d3('0x9'));var jayson=require(_0x05d3('0xa'));var client=jayson['client'][_0x05d3('0xb')]({'port':0x232a});config['redis']=_[_0x05d3('0xc')](config[_0x05d3('0xd')],{'host':_0x05d3('0xe'),'port':0x18eb});var socket=require(_0x05d3('0xf'))(new Redis(config[_0x05d3('0xd')]));require(_0x05d3('0x10'))['register'](socket);function respondWithRpcPromise(_0x51bbe9,_0x56ef4d,_0x265b75){return new BPromise(function(_0x330f59,_0x26e811){return client[_0x05d3('0x11')](_0x51bbe9,_0x265b75)[_0x05d3('0x12')](function(_0x300b7e){logger[_0x05d3('0x13')](_0x05d3('0x14'),_0x56ef4d,_0x05d3('0x15'));logger[_0x05d3('0x16')](_0x05d3('0x17'),_0x56ef4d,_0x05d3('0x15'),JSON[_0x05d3('0x18')](_0x300b7e));if(_0x300b7e[_0x05d3('0x19')]){if(_0x300b7e[_0x05d3('0x19')]['code']===0x1f4){logger[_0x05d3('0x19')](_0x05d3('0x14'),_0x56ef4d,_0x300b7e[_0x05d3('0x19')][_0x05d3('0x1a')]);return _0x26e811(_0x300b7e[_0x05d3('0x19')][_0x05d3('0x1a')]);}logger[_0x05d3('0x19')](_0x05d3('0x14'),_0x56ef4d,_0x300b7e[_0x05d3('0x19')][_0x05d3('0x1a')]);return _0x330f59(_0x300b7e['error'][_0x05d3('0x1a')]);}else{logger[_0x05d3('0x13')](_0x05d3('0x14'),_0x56ef4d,'request\x20sent');_0x330f59(_0x300b7e[_0x05d3('0x1b')]['message']);}})[_0x05d3('0x1c')](function(_0x179d5e){logger[_0x05d3('0x19')](_0x05d3('0x14'),_0x56ef4d,_0x179d5e);_0x26e811(_0x179d5e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8a7fc0d..a6e008a 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 _0x4cc2=['./dashboard.events','save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x23fa19,_0x2ad5af){var _0x5c7a1b=function(_0x4a6532){while(--_0x4a6532){_0x23fa19['push'](_0x23fa19['shift']());}};_0x5c7a1b(++_0x2ad5af);}(_0x4cc2,0xd8));var _0x24cc=function(_0x304cfa,_0x451e2d){_0x304cfa=_0x304cfa-0x0;var _0x5016e2=_0x4cc2[_0x304cfa];return _0x5016e2;};'use strict';var DashboardEvents=require(_0x24cc('0x0'));var events=[_0x24cc('0x1'),_0x24cc('0x2'),_0x24cc('0x3')];function createListener(_0x325431,_0x54e15a){return function(_0x13ce89){_0x54e15a[_0x24cc('0x4')](_0x325431,_0x13ce89);};}function removeListener(_0x22c121,_0x56b364){return function(){DashboardEvents[_0x24cc('0x5')](_0x22c121,_0x56b364);};}exports[_0x24cc('0x6')]=function(_0x3eae60){for(var _0x2aa053=0x0,_0x1ea367=events[_0x24cc('0x7')];_0x2aa053<_0x1ea367;_0x2aa053++){var _0x39de2c=events[_0x2aa053];var _0x14bfe2=createListener(_0x24cc('0x8')+_0x39de2c,_0x3eae60);DashboardEvents['on'](_0x39de2c,_0x14bfe2);}}; \ No newline at end of file +var _0x489e=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x558261,_0x182765){var _0x2c52cb=function(_0x15e30a){while(--_0x15e30a){_0x558261['push'](_0x558261['shift']());}};_0x2c52cb(++_0x182765);}(_0x489e,0x82));var _0xe489=function(_0x5885ef,_0x45a9ca){_0x5885ef=_0x5885ef-0x0;var _0xb48c87=_0x489e[_0x5885ef];return _0xb48c87;};'use strict';var DashboardEvents=require(_0xe489('0x0'));var events=[_0xe489('0x1'),_0xe489('0x2'),_0xe489('0x3')];function createListener(_0x469002,_0x204634){return function(_0x328eb5){_0x204634[_0xe489('0x4')](_0x469002,_0x328eb5);};}function removeListener(_0x2c069e,_0x20d365){return function(){DashboardEvents[_0xe489('0x5')](_0x2c069e,_0x20d365);};}exports[_0xe489('0x6')]=function(_0x21a2d3){for(var _0x1a5add=0x0,_0x547651=events[_0xe489('0x7')];_0x1a5add<_0x547651;_0x1a5add++){var _0x32dfc4=events[_0x1a5add];var _0xd15d23=createListener(_0xe489('0x8')+_0x32dfc4,_0x21a2d3);DashboardEvents['on'](_0x32dfc4,_0xd15d23);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 71017f6..e3492af 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 _0x5439=['./dashboard.controller','get','isAuthenticated','index','/:id/items','getItems','create','post','/:id/clone','clone','update','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x524fd6,_0x3d0065){var _0xe4bd21=function(_0x2dea76){while(--_0x2dea76){_0x524fd6['push'](_0x524fd6['shift']());}};_0xe4bd21(++_0x3d0065);}(_0x5439,0x76));var _0x9543=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5439[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9543('0x0'));var util=require(_0x9543('0x1'));var path=require(_0x9543('0x2'));var timeout=require(_0x9543('0x3'));var express=require(_0x9543('0x4'));var router=express[_0x9543('0x5')]();var fs_extra=require(_0x9543('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9543('0x7'));var config=require('../../config/environment');var controller=require(_0x9543('0x8'));router[_0x9543('0x9')]('/',auth[_0x9543('0xa')](),controller[_0x9543('0xb')]);router[_0x9543('0x9')]('/:id',auth[_0x9543('0xa')](),controller['show']);router[_0x9543('0x9')](_0x9543('0xc'),auth[_0x9543('0xa')](),controller[_0x9543('0xd')]);router['post']('/',auth[_0x9543('0xa')](),controller[_0x9543('0xe')]);router[_0x9543('0xf')](_0x9543('0x10'),auth[_0x9543('0xa')](),controller[_0x9543('0x11')]);router[_0x9543('0xf')](_0x9543('0xc'),auth[_0x9543('0xa')](),controller['addItem']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9543('0x12')]);router['delete'](_0x9543('0x13'),auth[_0x9543('0xa')](),controller['destroy']);module[_0x9543('0x14')]=router; \ No newline at end of file +var _0xda24=['/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','/:id'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0xda24,0x8f));var _0x4da2=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xda24[_0x2ca9d4];return _0x258956;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4da2('0x0'));var timeout=require(_0x4da2('0x1'));var express=require('express');var router=express[_0x4da2('0x2')]();var fs_extra=require(_0x4da2('0x3'));var auth=require(_0x4da2('0x4'));var interaction=require(_0x4da2('0x5'));var config=require(_0x4da2('0x6'));var controller=require(_0x4da2('0x7'));router['get']('/',auth[_0x4da2('0x8')](),controller[_0x4da2('0x9')]);router['get'](_0x4da2('0xa'),auth[_0x4da2('0x8')](),controller['show']);router['get'](_0x4da2('0xb'),auth[_0x4da2('0x8')](),controller[_0x4da2('0xc')]);router[_0x4da2('0xd')]('/',auth[_0x4da2('0x8')](),controller[_0x4da2('0xe')]);router['post'](_0x4da2('0xf'),auth['isAuthenticated'](),controller['clone']);router[_0x4da2('0xd')](_0x4da2('0xb'),auth['isAuthenticated'](),controller[_0x4da2('0x10')]);router[_0x4da2('0x11')]('/:id',auth[_0x4da2('0x8')](),controller[_0x4da2('0x12')]);router[_0x4da2('0x13')](_0x4da2('0xa'),auth['isAuthenticated'](),controller[_0x4da2('0x14')]);module[_0x4da2('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 725fbd1..f454f14 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 _0x2eb2=['STRING','TEXT','parse','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','lodash','exports'];(function(_0x59ee79,_0x49f1c8){var _0x3c9c77=function(_0x398ad1){while(--_0x398ad1){_0x59ee79['push'](_0x59ee79['shift']());}};_0x3c9c77(++_0x49f1c8);}(_0x2eb2,0x19f));var _0x22eb=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x2eb2[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x22eb('0x0'));var _=require(_0x22eb('0x1'));module[_0x22eb('0x2')]={'title':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x22eb('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22eb('0x4')]('long'),'get':function(){try{return JSON[_0x22eb('0x5')](this['getDataValue']('attrs'));}catch(_0x1dfef7){return[];}},'set':function(_0x10e116){try{this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')](_0x10e116));}catch(_0x396806){this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22eb('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x22eb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x22eb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xc4aa=['getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x41d68f,_0x2dfc95){var _0x3e849a=function(_0xbe0c30){while(--_0xbe0c30){_0x41d68f['push'](_0x41d68f['shift']());}};_0x3e849a(++_0x2dfc95);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xac4a('0x0'));var squel=require(_0xac4a('0x1'));var _=require(_0xac4a('0x2'));module[_0xac4a('0x3')]={'title':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xac4a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this[_0xac4a('0x5')](_0xac4a('0x6')));}catch(_0x730a38){return[];}},'set':function(_0x215f39){try{this[_0xac4a('0x7')](_0xac4a('0x6'),JSON[_0xac4a('0x8')](_0x215f39));}catch(_0x10525b){this['setDataValue']('attrs',JSON[_0xac4a('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xac4a('0x9')]},'background':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![],'defaultValue':_0xac4a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xac4a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xac4a('0x9')],'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 e313111..c36c5d7 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 _0x39e6=['name','send','show','keys','DashboardItem','rawAttributes','filters','intersection','model','attributes','fields','query','length','includeAll','include','merge','options','catch','find','type','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','stringify','body','create','params','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy'];(function(_0x4eae5c,_0x36f8bc){var _0x1f6627=function(_0x152361){while(--_0x152361){_0x4eae5c['push'](_0x4eae5c['shift']());}};_0x1f6627(++_0x36f8bc);}(_0x39e6,0x9e));var _0x639e=function(_0x5472fe,_0x59a188){_0x5472fe=_0x5472fe-0x0;var _0x2b1767=_0x39e6[_0x5472fe];return _0x2b1767;};'use strict';var emlformat=require(_0x639e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x639e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x639e('0x2'));var BPromise=require(_0x639e('0x3'));var Mustache=require('mustache');var util=require(_0x639e('0x4'));var path=require(_0x639e('0x5'));var sox=require(_0x639e('0x6'));var csv=require(_0x639e('0x7'));var ejs=require(_0x639e('0x8'));var fs=require('fs');var fs_extra=require(_0x639e('0x9'));var _=require(_0x639e('0xa'));var squel=require(_0x639e('0xb'));var crypto=require(_0x639e('0xc'));var jsforce=require(_0x639e('0xd'));var deskjs=require(_0x639e('0xe'));var toCsv=require(_0x639e('0x7'));var querystring=require(_0x639e('0xf'));var Papa=require(_0x639e('0x10'));var Redis=require(_0x639e('0x11'));var authService=require(_0x639e('0x12'));var qs=require(_0x639e('0x13'));var as=require(_0x639e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x639e('0x15'));var utils=require(_0x639e('0x16'));var config=require(_0x639e('0x17'));var licenseUtil=require(_0x639e('0x18'));var db=require(_0x639e('0x19'))['db'];config[_0x639e('0x1a')]=_[_0x639e('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x639e('0x1c'))(new Redis(config[_0x639e('0x1a')]));require(_0x639e('0x1d'))[_0x639e('0x1e')](socket);function respondWithStatusCode(_0x37b8e2,_0x1c9feb){_0x1c9feb=_0x1c9feb||0xcc;return function(_0x55728e){if(_0x55728e){return _0x37b8e2[_0x639e('0x1f')](_0x1c9feb);}return _0x37b8e2[_0x639e('0x20')](_0x1c9feb)[_0x639e('0x21')]();};}function respondWithResult(_0x4077c5,_0x4fa3fa){_0x4fa3fa=_0x4fa3fa||0xc8;return function(_0x6dd912){if(_0x6dd912){return _0x4077c5['status'](_0x4fa3fa)[_0x639e('0x22')](_0x6dd912);}};}function respondWithFilteredResult(_0x3932a8,_0x391957){return function(_0x20b76f){if(_0x20b76f){var _0x36b75a=typeof _0x391957[_0x639e('0x23')]==='undefined'&&typeof _0x391957[_0x639e('0x24')]===_0x639e('0x25');var _0x36f71d=_0x20b76f[_0x639e('0x26')];var _0x59f772=_0x36b75a?0x0:_0x391957[_0x639e('0x23')];var _0xdf47a5=_0x36b75a?_0x20b76f[_0x639e('0x26')]:_0x391957[_0x639e('0x23')]+_0x391957[_0x639e('0x24')];var _0x50de77;if(_0xdf47a5>=_0x36f71d){_0xdf47a5=_0x36f71d;_0x50de77=0xc8;}else{_0x50de77=0xce;}_0x3932a8[_0x639e('0x20')](_0x50de77);return _0x3932a8[_0x639e('0x27')]('Content-Range',_0x59f772+'-'+_0xdf47a5+'/'+_0x36f71d)[_0x639e('0x22')](_0x20b76f);}return null;};}function patchUpdates(_0x48dce7){return function(_0x574fd8){try{jsonpatch[_0x639e('0x28')](_0x574fd8,_0x48dce7,!![]);}catch(_0x3813f6){return BPromise[_0x639e('0x29')](_0x3813f6);}return _0x574fd8[_0x639e('0x2a')]();};}function saveUpdates(_0x211fcb,_0x5da797){return function(_0x2b699c){if(_0x2b699c){return _0x2b699c[_0x639e('0x2b')](_0x211fcb)[_0x639e('0x2c')](function(_0x2da264){return _0x2da264;});}return null;};}function removeEntity(_0x2df4d1,_0x5f27f6){return function(_0x381554){if(_0x381554){return _0x381554[_0x639e('0x2d')]()[_0x639e('0x2c')](function(){_0x2df4d1[_0x639e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae3b7,_0x282d87){return function(_0x13ef2b){if(!_0x13ef2b){_0x2ae3b7['sendStatus'](0x194);}return _0x13ef2b;};}function handleError(_0xefbf1c,_0x56145c){_0x56145c=_0x56145c||0x1f4;return function(_0x38ce3a){logger['error'](_0x38ce3a['stack']);if(_0x38ce3a[_0x639e('0x2e')]){delete _0x38ce3a[_0x639e('0x2e')];}_0xefbf1c[_0x639e('0x20')](_0x56145c)[_0x639e('0x2f')](_0x38ce3a);};}exports[_0x639e('0x30')]=function(_0xefc97b,_0x5797da){var _0x213b7e={'raw':![],'where':{'id':_0xefc97b['params']['id']}},_0x2bfb5e={};_0x2bfb5e['model']=_[_0x639e('0x31')](db[_0x639e('0x32')][_0x639e('0x33')]);_0x2bfb5e['query']=_[_0x639e('0x31')](_0xefc97b['query']);_0x2bfb5e[_0x639e('0x34')]=_[_0x639e('0x35')](_0x2bfb5e[_0x639e('0x36')],_0x2bfb5e['query']);_0x213b7e[_0x639e('0x37')]=_['intersection'](_0x2bfb5e[_0x639e('0x36')],qs[_0x639e('0x38')](_0xefc97b[_0x639e('0x39')]['fields']));_0x213b7e[_0x639e('0x37')]=_0x213b7e[_0x639e('0x37')][_0x639e('0x3a')]?_0x213b7e['attributes']:_0x2bfb5e[_0x639e('0x36')];if(_0xefc97b['query'][_0x639e('0x3b')]){_0x213b7e[_0x639e('0x3c')]=[{'all':!![]}];}_0x213b7e=_[_0x639e('0x3d')]({},_0x213b7e,_0xefc97b[_0x639e('0x3e')]);return db[_0x639e('0x32')]['find'](_0x213b7e)[_0x639e('0x2c')](handleEntityNotFound(_0x5797da,null))[_0x639e('0x2c')](respondWithResult(_0x5797da,null))[_0x639e('0x3f')](handleError(_0x5797da,null));};exports[_0x639e('0x2d')]=function(_0x4b8a3e,_0x2a30aa){return db[_0x639e('0x32')][_0x639e('0x40')]({'where':{'id':_0x4b8a3e['params']['id']}})[_0x639e('0x2c')](handleEntityNotFound(_0x2a30aa,null))['then'](removeEntity(_0x2a30aa,null))[_0x639e('0x3f')](handleError(_0x2a30aa,null));};function widgetAttributes(_0x22c393){try{switch(_0x22c393[_0x639e('0x41')]){case _0x639e('0x42'):return[{'name':_0x639e('0x43'),'value':_0x22c393[_0x639e('0x43')]||(_0x22c393['attrs']&&_0x22c393[_0x639e('0x44')][0x0]?_0x22c393[_0x639e('0x44')][0x0]['value']:undefined)||_0x639e('0x45')}];case'custom':return[{'name':_0x639e('0x46'),'value':_0x22c393[_0x639e('0x46')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x0]?_0x22c393[_0x639e('0x44')][0x0][_0x639e('0x47')]:undefined)||''}];case _0x639e('0x48'):return[{'name':_0x639e('0x49'),'value':_0x22c393['attrHourFormat']||(_0x22c393['attrs']&&_0x22c393['attrs'][0x0]?_0x22c393['attrs'][0x0][_0x639e('0x47')]:undefined)||_0x639e('0x4a')},{'name':'attrTimezone','value':_0x22c393[_0x639e('0x4b')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x1]?_0x22c393['attrs'][0x1][_0x639e('0x47')]:undefined)||_0x639e('0x4c')},{'name':_0x639e('0x4d'),'value':_0x22c393[_0x639e('0x4d')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x2]?_0x22c393[_0x639e('0x44')][0x2][_0x639e('0x47')]:undefined)||0xc}];case _0x639e('0x4e'):return[{'name':'attrMetric','value':_0x22c393[_0x639e('0x4f')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x0]?_0x22c393[_0x639e('0x44')][0x0][_0x639e('0x47')]:undefined)||_0x639e('0x50')},{'name':'attrVoiceQueues','value':_0x22c393[_0x639e('0x51')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x1]?_0x22c393[_0x639e('0x44')][0x1][_0x639e('0x47')]:undefined)||[]},{'name':_0x639e('0x4d'),'value':_0x22c393[_0x639e('0x4d')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x2]?_0x22c393[_0x639e('0x44')][0x2][_0x639e('0x47')]:undefined)||0x14},{'name':_0x639e('0x52'),'value':_0x22c393['attrChannel']||(_0x22c393[_0x639e('0x44')]&&_0x22c393['attrs'][0x3]?_0x22c393['attrs'][0x3][_0x639e('0x47')]:undefined)||_0x639e('0x53')},{'name':_0x639e('0x54'),'value':_0x22c393[_0x639e('0x54')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393['attrs'][0x4]?_0x22c393[_0x639e('0x44')][0x4][_0x639e('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x22c393[_0x639e('0x55')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x5]?_0x22c393['attrs'][0x5][_0x639e('0x47')]:undefined)||''},{'name':_0x639e('0x56'),'value':_0x22c393[_0x639e('0x56')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393['attrs'][0x6]?_0x22c393[_0x639e('0x44')][0x6]['value']:undefined)||''},{'name':_0x639e('0x57'),'value':_0x22c393['attrOpenchannelAccounts']||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x7]?_0x22c393[_0x639e('0x44')][0x7][_0x639e('0x47')]:undefined)||''},{'name':_0x639e('0x58'),'value':_0x22c393['attrWhatsappAccounts']||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x8]?_0x22c393[_0x639e('0x44')][0x8]['value']:undefined)||''},{'name':_0x639e('0x59'),'value':_0x22c393[_0x639e('0x59')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x9]?_0x22c393['attrs'][0x9][_0x639e('0x47')]:undefined)||''}];case'multibar-chart':case _0x639e('0x5a'):return[{'name':_0x639e('0x5b'),'value':_0x22c393[_0x639e('0x5b')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393['attrs'][0x0]?_0x22c393[_0x639e('0x44')][0x0]['value']:undefined)||'total'},{'name':_0x639e('0x5c'),'value':_0x22c393[_0x639e('0x5c')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x1]?_0x22c393['attrs'][0x1][_0x639e('0x47')]:undefined)||null},{'name':_0x639e('0x5d'),'value':_0x22c393[_0x639e('0x5d')]||(_0x22c393['attrs']&&_0x22c393[_0x639e('0x44')][0x2]?_0x22c393[_0x639e('0x44')][0x2][_0x639e('0x47')]:undefined)||null},{'name':_0x639e('0x51'),'value':_0x22c393[_0x639e('0x51')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x3]?_0x22c393['attrs'][0x3][_0x639e('0x47')]:undefined)||[]},{'name':_0x639e('0x52'),'value':_0x22c393[_0x639e('0x52')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393['attrs'][0x4]?_0x22c393[_0x639e('0x44')][0x4][_0x639e('0x47')]:undefined)||_0x639e('0x53')},{'name':'attrEmailAccounts','value':_0x22c393['attrEmailAccounts']||(_0x22c393['attrs']&&_0x22c393[_0x639e('0x44')][0x5]?_0x22c393[_0x639e('0x44')][0x5]['value']:undefined)||''},{'name':_0x639e('0x55'),'value':_0x22c393[_0x639e('0x55')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x6]?_0x22c393[_0x639e('0x44')][0x6][_0x639e('0x47')]:undefined)||''},{'name':_0x639e('0x56'),'value':_0x22c393[_0x639e('0x56')]||(_0x22c393['attrs']&&_0x22c393[_0x639e('0x44')][0x7]?_0x22c393[_0x639e('0x44')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x22c393[_0x639e('0x57')]||(_0x22c393['attrs']&&_0x22c393[_0x639e('0x44')][0x8]?_0x22c393[_0x639e('0x44')][0x8][_0x639e('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x22c393[_0x639e('0x58')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x9]?_0x22c393[_0x639e('0x44')][0x9]['value']:undefined)||''},{'name':_0x639e('0x59'),'value':_0x22c393[_0x639e('0x59')]||(_0x22c393['attrs']&&_0x22c393[_0x639e('0x44')][0xa]?_0x22c393[_0x639e('0x44')][0xa][_0x639e('0x47')]:undefined)||''}];case _0x639e('0x5e'):return[{'name':_0x639e('0x5f'),'type':_0x22c393['reportType']||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x0]?_0x22c393[_0x639e('0x44')][0x0][_0x639e('0x41')]:undefined)||null,'value':_0x22c393[_0x639e('0x5f')]||(_0x22c393[_0x639e('0x44')]&&_0x22c393[_0x639e('0x44')][0x0]?_0x22c393[_0x639e('0x44')][0x0][_0x639e('0x47')]:undefined)||null},{'name':_0x639e('0x60'),'value':_0x22c393['attrRefresh']||(_0x22c393['attrs']&&_0x22c393[_0x639e('0x44')][0x1]?_0x22c393[_0x639e('0x44')][0x1][_0x639e('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x3ef322){logger[_0x639e('0x61')]('widgetAttributes:\x20%s',JSON[_0x639e('0x62')](_0x3ef322));return[];}}exports['create']=function(_0x6106a1,_0x174758){if(_0x6106a1[_0x639e('0x63')]){_0x6106a1['body']['attrs']=widgetAttributes(_0x6106a1[_0x639e('0x63')]);}return db[_0x639e('0x32')][_0x639e('0x64')](_0x6106a1['body'],{})['then'](respondWithResult(_0x174758,0xc9))[_0x639e('0x3f')](handleError(_0x174758,null));};exports[_0x639e('0x2b')]=function(_0x5e29fb,_0x5b6313){if(_0x5e29fb[_0x639e('0x63')]['id']){delete _0x5e29fb[_0x639e('0x63')]['id'];}_0x5e29fb[_0x639e('0x63')]['attrs']=widgetAttributes(_0x5e29fb[_0x639e('0x63')]);return db[_0x639e('0x32')][_0x639e('0x40')]({'where':{'id':_0x5e29fb[_0x639e('0x65')]['id']}})['then'](handleEntityNotFound(_0x5b6313,null))[_0x639e('0x2c')](saveUpdates(_0x5e29fb[_0x639e('0x63')],null))[_0x639e('0x2c')](respondWithResult(_0x5b6313,null))[_0x639e('0x3f')](handleError(_0x5b6313,null));}; \ No newline at end of file +var _0xdf98=['attrMetric','total','attrVoiceQueues','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','reportType','type','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','status','json','undefined','count','offset','limit','apply','reject','save','update','then','sendStatus','error','stack','name','send','params','model','rawAttributes','query','keys','filters','intersection','attributes','includeAll','include','merge','options','DashboardItem','find','catch','attrUrl','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize'];(function(_0x2ddf02,_0x4f7625){var _0xaf614e=function(_0x1c595f){while(--_0x1c595f){_0x2ddf02['push'](_0x2ddf02['shift']());}};_0xaf614e(++_0x4f7625);}(_0xdf98,0xcf));var _0x8df9=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0xdf98[_0x8e8ca7];return _0x561381;};'use strict';var emlformat=require(_0x8df9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8df9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8df9('0x2'));var BPromise=require(_0x8df9('0x3'));var Mustache=require(_0x8df9('0x4'));var util=require(_0x8df9('0x5'));var path=require(_0x8df9('0x6'));var sox=require(_0x8df9('0x7'));var csv=require(_0x8df9('0x8'));var ejs=require(_0x8df9('0x9'));var fs=require('fs');var fs_extra=require(_0x8df9('0xa'));var _=require('lodash');var squel=require(_0x8df9('0xb'));var crypto=require(_0x8df9('0xc'));var jsforce=require(_0x8df9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8df9('0xe'));var Papa=require('papaparse');var Redis=require(_0x8df9('0xf'));var authService=require(_0x8df9('0x10'));var qs=require(_0x8df9('0x11'));var as=require(_0x8df9('0x12'));var hardwareService=require(_0x8df9('0x13'));var logger=require(_0x8df9('0x14'))(_0x8df9('0x15'));var utils=require(_0x8df9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8df9('0x17'));var db=require(_0x8df9('0x18'))['db'];config[_0x8df9('0x19')]=_['defaults'](config[_0x8df9('0x19')],{'host':_0x8df9('0x1a'),'port':0x18eb});var socket=require(_0x8df9('0x1b'))(new Redis(config[_0x8df9('0x19')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x2dcc1c,_0x304ba3){_0x304ba3=_0x304ba3||0xcc;return function(_0x334a5f){if(_0x334a5f){return _0x2dcc1c['sendStatus'](_0x304ba3);}return _0x2dcc1c[_0x8df9('0x1c')](_0x304ba3)['end']();};}function respondWithResult(_0xcc0419,_0x4cc5be){_0x4cc5be=_0x4cc5be||0xc8;return function(_0x364f93){if(_0x364f93){return _0xcc0419[_0x8df9('0x1c')](_0x4cc5be)[_0x8df9('0x1d')](_0x364f93);}};}function respondWithFilteredResult(_0x218e76,_0x119a88){return function(_0x16e8c4){if(_0x16e8c4){var _0x5e19e5=typeof _0x119a88['offset']===_0x8df9('0x1e')&&typeof _0x119a88['limit']==='undefined';var _0x324dc0=_0x16e8c4[_0x8df9('0x1f')];var _0x3c4b85=_0x5e19e5?0x0:_0x119a88[_0x8df9('0x20')];var _0x10b440=_0x5e19e5?_0x16e8c4[_0x8df9('0x1f')]:_0x119a88['offset']+_0x119a88[_0x8df9('0x21')];var _0x36deb6;if(_0x10b440>=_0x324dc0){_0x10b440=_0x324dc0;_0x36deb6=0xc8;}else{_0x36deb6=0xce;}_0x218e76[_0x8df9('0x1c')](_0x36deb6);return _0x218e76['set']('Content-Range',_0x3c4b85+'-'+_0x10b440+'/'+_0x324dc0)['json'](_0x16e8c4);}return null;};}function patchUpdates(_0x4a6748){return function(_0x5f210e){try{jsonpatch[_0x8df9('0x22')](_0x5f210e,_0x4a6748,!![]);}catch(_0x239b71){return BPromise[_0x8df9('0x23')](_0x239b71);}return _0x5f210e[_0x8df9('0x24')]();};}function saveUpdates(_0x478453,_0x1f9edd){return function(_0x85eff4){if(_0x85eff4){return _0x85eff4[_0x8df9('0x25')](_0x478453)['then'](function(_0x3323dc){return _0x3323dc;});}return null;};}function removeEntity(_0xe662a6,_0x30cc42){return function(_0x59ea73){if(_0x59ea73){return _0x59ea73['destroy']()[_0x8df9('0x26')](function(){_0xe662a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x107639,_0x37efc3){return function(_0x3a43c5){if(!_0x3a43c5){_0x107639[_0x8df9('0x27')](0x194);}return _0x3a43c5;};}function handleError(_0x21ebb9,_0x5bd4b1){_0x5bd4b1=_0x5bd4b1||0x1f4;return function(_0x5a3907){logger[_0x8df9('0x28')](_0x5a3907[_0x8df9('0x29')]);if(_0x5a3907[_0x8df9('0x2a')]){delete _0x5a3907['name'];}_0x21ebb9[_0x8df9('0x1c')](_0x5bd4b1)[_0x8df9('0x2b')](_0x5a3907);};}exports['show']=function(_0xf1759e,_0x1c5065){var _0x4a522f={'raw':![],'where':{'id':_0xf1759e[_0x8df9('0x2c')]['id']}},_0x26b063={};_0x26b063[_0x8df9('0x2d')]=_['keys'](db['DashboardItem'][_0x8df9('0x2e')]);_0x26b063[_0x8df9('0x2f')]=_[_0x8df9('0x30')](_0xf1759e['query']);_0x26b063[_0x8df9('0x31')]=_[_0x8df9('0x32')](_0x26b063[_0x8df9('0x2d')],_0x26b063[_0x8df9('0x2f')]);_0x4a522f['attributes']=_[_0x8df9('0x32')](_0x26b063[_0x8df9('0x2d')],qs['fields'](_0xf1759e[_0x8df9('0x2f')]['fields']));_0x4a522f['attributes']=_0x4a522f['attributes']['length']?_0x4a522f[_0x8df9('0x33')]:_0x26b063[_0x8df9('0x2d')];if(_0xf1759e[_0x8df9('0x2f')][_0x8df9('0x34')]){_0x4a522f[_0x8df9('0x35')]=[{'all':!![]}];}_0x4a522f=_[_0x8df9('0x36')]({},_0x4a522f,_0xf1759e[_0x8df9('0x37')]);return db[_0x8df9('0x38')][_0x8df9('0x39')](_0x4a522f)[_0x8df9('0x26')](handleEntityNotFound(_0x1c5065,null))[_0x8df9('0x26')](respondWithResult(_0x1c5065,null))[_0x8df9('0x3a')](handleError(_0x1c5065,null));};exports['destroy']=function(_0x5b69d5,_0x53767a){return db[_0x8df9('0x38')][_0x8df9('0x39')]({'where':{'id':_0x5b69d5['params']['id']}})[_0x8df9('0x26')](handleEntityNotFound(_0x53767a,null))['then'](removeEntity(_0x53767a,null))[_0x8df9('0x3a')](handleError(_0x53767a,null));};function widgetAttributes(_0x1402f3){try{switch(_0x1402f3['type']){case'iframe':return[{'name':'attrUrl','value':_0x1402f3[_0x8df9('0x3b')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x0]?_0x1402f3['attrs'][0x0]['value']:undefined)||_0x8df9('0x3d')}];case'custom':return[{'name':_0x8df9('0x3e'),'value':_0x1402f3[_0x8df9('0x3e')]||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x0]?_0x1402f3[_0x8df9('0x3c')][0x0][_0x8df9('0x3f')]:undefined)||''}];case'clock':return[{'name':_0x8df9('0x40'),'value':_0x1402f3['attrHourFormat']||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x0]?_0x1402f3[_0x8df9('0x3c')][0x0][_0x8df9('0x3f')]:undefined)||_0x8df9('0x41')},{'name':_0x8df9('0x42'),'value':_0x1402f3[_0x8df9('0x42')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x1]?_0x1402f3[_0x8df9('0x3c')][0x1][_0x8df9('0x3f')]:undefined)||_0x8df9('0x43')},{'name':_0x8df9('0x44'),'value':_0x1402f3['attrFontSize']||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x2]?_0x1402f3['attrs'][0x2][_0x8df9('0x3f')]:undefined)||0xc}];case'counter':return[{'name':_0x8df9('0x45'),'value':_0x1402f3[_0x8df9('0x45')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x0]?_0x1402f3[_0x8df9('0x3c')][0x0][_0x8df9('0x3f')]:undefined)||_0x8df9('0x46')},{'name':_0x8df9('0x47'),'value':_0x1402f3[_0x8df9('0x47')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x1]?_0x1402f3[_0x8df9('0x3c')][0x1]['value']:undefined)||[]},{'name':_0x8df9('0x44'),'value':_0x1402f3[_0x8df9('0x44')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3['attrs'][0x2]?_0x1402f3[_0x8df9('0x3c')][0x2][_0x8df9('0x3f')]:undefined)||0x14},{'name':'attrChannel','value':_0x1402f3['attrChannel']||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x3]?_0x1402f3[_0x8df9('0x3c')][0x3]['value']:undefined)||'voice'},{'name':_0x8df9('0x48'),'value':_0x1402f3['attrEmailAccounts']||(_0x1402f3['attrs']&&_0x1402f3['attrs'][0x4]?_0x1402f3[_0x8df9('0x3c')][0x4][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x49'),'value':_0x1402f3['attrFaxAccounts']||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x5]?_0x1402f3[_0x8df9('0x3c')][0x5][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x4a'),'value':_0x1402f3['attrSmsAccounts']||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x6]?_0x1402f3[_0x8df9('0x3c')][0x6][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x4b'),'value':_0x1402f3['attrOpenchannelAccounts']||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x7]?_0x1402f3[_0x8df9('0x3c')][0x7][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x4c'),'value':_0x1402f3[_0x8df9('0x4c')]||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x8]?_0x1402f3['attrs'][0x8][_0x8df9('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1402f3[_0x8df9('0x4d')]||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x9]?_0x1402f3['attrs'][0x9][_0x8df9('0x3f')]:undefined)||''}];case _0x8df9('0x4e'):case _0x8df9('0x4f'):return[{'name':'attrSerie1','value':_0x1402f3[_0x8df9('0x50')]||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x0]?_0x1402f3[_0x8df9('0x3c')][0x0][_0x8df9('0x3f')]:undefined)||_0x8df9('0x46')},{'name':_0x8df9('0x51'),'value':_0x1402f3[_0x8df9('0x51')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x1]?_0x1402f3[_0x8df9('0x3c')][0x1][_0x8df9('0x3f')]:undefined)||null},{'name':_0x8df9('0x52'),'value':_0x1402f3[_0x8df9('0x52')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x2]?_0x1402f3[_0x8df9('0x3c')][0x2][_0x8df9('0x3f')]:undefined)||null},{'name':_0x8df9('0x47'),'value':_0x1402f3[_0x8df9('0x47')]||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x3]?_0x1402f3['attrs'][0x3][_0x8df9('0x3f')]:undefined)||[]},{'name':_0x8df9('0x53'),'value':_0x1402f3[_0x8df9('0x53')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3['attrs'][0x4]?_0x1402f3[_0x8df9('0x3c')][0x4][_0x8df9('0x3f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1402f3[_0x8df9('0x48')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x5]?_0x1402f3[_0x8df9('0x3c')][0x5][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x49'),'value':_0x1402f3['attrFaxAccounts']||(_0x1402f3['attrs']&&_0x1402f3[_0x8df9('0x3c')][0x6]?_0x1402f3[_0x8df9('0x3c')][0x6][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x4a'),'value':_0x1402f3[_0x8df9('0x4a')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3['attrs'][0x7]?_0x1402f3[_0x8df9('0x3c')][0x7][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x4b'),'value':_0x1402f3[_0x8df9('0x4b')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x8]?_0x1402f3['attrs'][0x8]['value']:undefined)||''},{'name':_0x8df9('0x4c'),'value':_0x1402f3[_0x8df9('0x4c')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3['attrs'][0x9]?_0x1402f3[_0x8df9('0x3c')][0x9][_0x8df9('0x3f')]:undefined)||''},{'name':_0x8df9('0x4d'),'value':_0x1402f3[_0x8df9('0x4d')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0xa]?_0x1402f3['attrs'][0xa]['value']:undefined)||''}];case _0x8df9('0x54'):return[{'name':'attrReport','type':_0x1402f3[_0x8df9('0x55')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3[_0x8df9('0x3c')][0x0]?_0x1402f3[_0x8df9('0x3c')][0x0][_0x8df9('0x56')]:undefined)||null,'value':_0x1402f3[_0x8df9('0x57')]||(_0x1402f3[_0x8df9('0x3c')]&&_0x1402f3['attrs'][0x0]?_0x1402f3[_0x8df9('0x3c')][0x0][_0x8df9('0x3f')]:undefined)||null},{'name':_0x8df9('0x58'),'value':_0x1402f3[_0x8df9('0x58')]||(_0x1402f3['attrs']&&_0x1402f3['attrs'][0x1]?_0x1402f3[_0x8df9('0x3c')][0x1][_0x8df9('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x3c6894){logger[_0x8df9('0x28')](_0x8df9('0x59'),JSON['stringify'](_0x3c6894));return[];}}exports[_0x8df9('0x5a')]=function(_0x1fa5a3,_0x347533){if(_0x1fa5a3[_0x8df9('0x5b')]){_0x1fa5a3[_0x8df9('0x5b')]['attrs']=widgetAttributes(_0x1fa5a3[_0x8df9('0x5b')]);}return db[_0x8df9('0x38')][_0x8df9('0x5a')](_0x1fa5a3[_0x8df9('0x5b')],{})[_0x8df9('0x26')](respondWithResult(_0x347533,0xc9))[_0x8df9('0x3a')](handleError(_0x347533,null));};exports[_0x8df9('0x25')]=function(_0x572d8a,_0x3946dc){if(_0x572d8a['body']['id']){delete _0x572d8a['body']['id'];}_0x572d8a[_0x8df9('0x5b')][_0x8df9('0x3c')]=widgetAttributes(_0x572d8a[_0x8df9('0x5b')]);return db[_0x8df9('0x38')][_0x8df9('0x39')]({'where':{'id':_0x572d8a[_0x8df9('0x2c')]['id']}})[_0x8df9('0x26')](handleEntityNotFound(_0x3946dc,null))[_0x8df9('0x26')](saveUpdates(_0x572d8a[_0x8df9('0x5b')],null))[_0x8df9('0x26')](respondWithResult(_0x3946dc,null))['catch'](handleError(_0x3946dc,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index fda08ef..e7e38c4 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 _0xa2d0=['DashboardItem','setMaxListeners','save','emit','hook','events','../../mysqldb'];(function(_0xd43abd,_0x4350db){var _0x2481e1=function(_0x39453e){while(--_0x39453e){_0xd43abd['push'](_0xd43abd['shift']());}};_0x2481e1(++_0x4350db);}(_0xa2d0,0x194));var _0x0a2d=function(_0x437335,_0x11811b){_0x437335=_0x437335-0x0;var _0x58bcd8=_0xa2d0[_0x437335];return _0x58bcd8;};'use strict';var EventEmitter=require(_0x0a2d('0x0'));var DashboardItem=require(_0x0a2d('0x1'))['db'][_0x0a2d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0a2d('0x3')](0x0);var events={'afterCreate':_0x0a2d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1bdec4){return function(_0x542919,_0x1ad694,_0x29eaa7){DashboardItemEvents[_0x0a2d('0x5')](_0x1bdec4+':'+_0x542919['id'],_0x542919);DashboardItemEvents[_0x0a2d('0x5')](_0x1bdec4,_0x542919);_0x29eaa7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x0a2d('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x94e7=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','DashboardItem'];(function(_0x290e70,_0x109ff8){var _0x55cbcc=function(_0x1437c1){while(--_0x1437c1){_0x290e70['push'](_0x290e70['shift']());}};_0x55cbcc(++_0x109ff8);}(_0x94e7,0x7c));var _0x794e=function(_0x51df27,_0x2a9382){_0x51df27=_0x51df27-0x0;var _0x12832c=_0x94e7[_0x51df27];return _0x12832c;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x794e('0x0'))['db'][_0x794e('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x794e('0x2'),'afterDestroy':_0x794e('0x3')};function emitEvent(_0x411fc5){return function(_0x53871d,_0x21fac0,_0x3cbff2){DashboardItemEvents[_0x794e('0x4')](_0x411fc5+':'+_0x53871d['id'],_0x53871d);DashboardItemEvents[_0x794e('0x4')](_0x411fc5,_0x53871d);_0x3cbff2(null);};}for(var e in events){if(events[_0x794e('0x5')](e)){var event=events[e];DashboardItem[_0x794e('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index eb41655..0b9d11f 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 _0x86d7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DashboardItem','util','../../config/logger','moment'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0x86d7,0x152));var _0x786d=function(_0x4900de,_0x3d9e92){_0x4900de=_0x4900de-0x0;var _0x297061=_0x86d7[_0x4900de];return _0x297061;};'use strict';var _=require('lodash');var util=require(_0x786d('0x0'));var logger=require(_0x786d('0x1'))('api');var moment=require(_0x786d('0x2'));var BPromise=require(_0x786d('0x3'));var rp=require(_0x786d('0x4'));var fs=require('fs');var path=require(_0x786d('0x5'));var rimraf=require(_0x786d('0x6'));var config=require(_0x786d('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x786d('0x8')]=function(_0x2846ca,_0x50b726){return _0x2846ca[_0x786d('0x9')](_0x786d('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x447b=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem'];(function(_0xe1eee8,_0x1ece95){var _0x3351a2=function(_0x26898a){while(--_0x26898a){_0xe1eee8['push'](_0xe1eee8['shift']());}};_0x3351a2(++_0x1ece95);}(_0x447b,0xe4));var _0xb447=function(_0x4eec46,_0x513505){_0x4eec46=_0x4eec46-0x0;var _0x125ca7=_0x447b[_0x4eec46];return _0x125ca7;};'use strict';var _=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var logger=require('../../config/logger')(_0xb447('0x2'));var moment=require(_0xb447('0x3'));var BPromise=require(_0xb447('0x4'));var rp=require(_0xb447('0x5'));var fs=require('fs');var path=require(_0xb447('0x6'));var rimraf=require(_0xb447('0x7'));var config=require(_0xb447('0x8'));var attributes=require(_0xb447('0x9'));module[_0xb447('0xa')]=function(_0x1f132a,_0x514a91){return _0x1f132a['define'](_0xb447('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index ff300bf..97ed622 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 _0xe6be=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe6be,0x100));var _0xee6b=function(_0x23b3ab,_0x40d352){_0x23b3ab=_0x23b3ab-0x0;var _0x112ca3=_0xe6be[_0x23b3ab];return _0x112ca3;};'use strict';var _=require(_0xee6b('0x0'));var util=require('util');var moment=require(_0xee6b('0x1'));var BPromise=require(_0xee6b('0x2'));var rs=require(_0xee6b('0x3'));var fs=require('fs');var Redis=require(_0xee6b('0x4'));var db=require(_0xee6b('0x5'))['db'];var utils=require(_0xee6b('0x6'));var logger=require(_0xee6b('0x7'))(_0xee6b('0x8'));var config=require(_0xee6b('0x9'));var jayson=require(_0xee6b('0xa'));var client=jayson[_0xee6b('0xb')][_0xee6b('0xc')]({'port':0x232a});config[_0xee6b('0xd')]=_[_0xee6b('0xe')](config[_0xee6b('0xd')],{'host':_0xee6b('0xf'),'port':0x18eb});var socket=require(_0xee6b('0x10'))(new Redis(config['redis']));require(_0xee6b('0x11'))[_0xee6b('0x12')](socket);function respondWithRpcPromise(_0x37cf04,_0x16af65,_0x545683){return new BPromise(function(_0x1a33a2,_0xbe7c7){return client['request'](_0x37cf04,_0x545683)[_0xee6b('0x13')](function(_0x2ed771){logger[_0xee6b('0x14')](_0xee6b('0x15'),_0x16af65,_0xee6b('0x16'));logger[_0xee6b('0x17')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x16af65,_0xee6b('0x16'),JSON[_0xee6b('0x18')](_0x2ed771));if(_0x2ed771[_0xee6b('0x19')]){if(_0x2ed771['error'][_0xee6b('0x1a')]===0x1f4){logger[_0xee6b('0x19')]('DashboardItem,\x20%s,\x20%s',_0x16af65,_0x2ed771[_0xee6b('0x19')]['message']);return _0xbe7c7(_0x2ed771['error'][_0xee6b('0x1b')]);}logger[_0xee6b('0x19')]('DashboardItem,\x20%s,\x20%s',_0x16af65,_0x2ed771[_0xee6b('0x19')]['message']);return _0x1a33a2(_0x2ed771[_0xee6b('0x19')][_0xee6b('0x1b')]);}else{logger['info'](_0xee6b('0x15'),_0x16af65,_0xee6b('0x16'));_0x1a33a2(_0x2ed771[_0xee6b('0x1c')][_0xee6b('0x1b')]);}})['catch'](function(_0x5d31f2){logger[_0xee6b('0x19')](_0xee6b('0x15'),_0x16af65,_0x5d31f2);_0xbe7c7(_0x5d31f2);});});} \ No newline at end of file +var _0xc855=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4a15f4,_0x5628f2){var _0x3a3a0b=function(_0x30761d){while(--_0x30761d){_0x4a15f4['push'](_0x4a15f4['shift']());}};_0x3a3a0b(++_0x5628f2);}(_0xc855,0x106));var _0x5c85=function(_0x2494fa,_0x2b3162){_0x2494fa=_0x2494fa-0x0;var _0x140006=_0xc855[_0x2494fa];return _0x140006;};'use strict';var _=require('lodash');var util=require(_0x5c85('0x0'));var moment=require(_0x5c85('0x1'));var BPromise=require(_0x5c85('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c85('0x3'));var db=require(_0x5c85('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c85('0x5'))(_0x5c85('0x6'));var config=require(_0x5c85('0x7'));var jayson=require(_0x5c85('0x8'));var client=jayson['client'][_0x5c85('0x9')]({'port':0x232a});config[_0x5c85('0xa')]=_[_0x5c85('0xb')](config[_0x5c85('0xa')],{'host':_0x5c85('0xc'),'port':0x18eb});var socket=require(_0x5c85('0xd'))(new Redis(config[_0x5c85('0xa')]));require(_0x5c85('0xe'))[_0x5c85('0xf')](socket);function respondWithRpcPromise(_0x536f7d,_0x72f5d7,_0xcb17f){return new BPromise(function(_0x1fc651,_0x6f9d8b){return client['request'](_0x536f7d,_0xcb17f)[_0x5c85('0x10')](function(_0x173189){logger[_0x5c85('0x11')](_0x5c85('0x12'),_0x72f5d7,'request\x20sent');logger[_0x5c85('0x13')](_0x5c85('0x14'),_0x72f5d7,_0x5c85('0x15'),JSON[_0x5c85('0x16')](_0x173189));if(_0x173189[_0x5c85('0x17')]){if(_0x173189['error'][_0x5c85('0x18')]===0x1f4){logger[_0x5c85('0x17')](_0x5c85('0x12'),_0x72f5d7,_0x173189[_0x5c85('0x17')][_0x5c85('0x19')]);return _0x6f9d8b(_0x173189[_0x5c85('0x17')][_0x5c85('0x19')]);}logger[_0x5c85('0x17')](_0x5c85('0x12'),_0x72f5d7,_0x173189['error'][_0x5c85('0x19')]);return _0x1fc651(_0x173189[_0x5c85('0x17')][_0x5c85('0x19')]);}else{logger['info'](_0x5c85('0x12'),_0x72f5d7,'request\x20sent');_0x1fc651(_0x173189['result']['message']);}})[_0x5c85('0x1a')](function(_0x439d76){logger['error']('DashboardItem,\x20%s,\x20%s',_0x72f5d7,_0x439d76);_0x6f9d8b(_0x439d76);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3509509..581e392 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 _0x880c=['save','remove','update','emit','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x509da2,_0xd2f81a){var _0x277535=function(_0x4823bb){while(--_0x4823bb){_0x509da2['push'](_0x509da2['shift']());}};_0x277535(++_0xd2f81a);}(_0x880c,0xe7));var _0xc880=function(_0x4913f3,_0x2a5d34){_0x4913f3=_0x4913f3-0x0;var _0x456ca2=_0x880c[_0x4913f3];return _0x456ca2;};'use strict';var DashboardItemEvents=require(_0xc880('0x0'));var events=[_0xc880('0x1'),_0xc880('0x2'),_0xc880('0x3')];function createListener(_0x1f7b32,_0x163f90){return function(_0x4f9769){_0x163f90[_0xc880('0x4')](_0x1f7b32,_0x4f9769);};}function removeListener(_0x35b74e,_0x51256a){return function(){DashboardItemEvents['removeListener'](_0x35b74e,_0x51256a);};}exports[_0xc880('0x5')]=function(_0x109bdb){for(var _0x4dea7f=0x0,_0x22aa3e=events[_0xc880('0x6')];_0x4dea7f<_0x22aa3e;_0x4dea7f++){var _0x58f749=events[_0x4dea7f];var _0x4201f1=createListener(_0xc880('0x7')+_0x58f749,_0x109bdb);DashboardItemEvents['on'](_0x58f749,_0x4201f1);}}; \ No newline at end of file +var _0xc15c=['./dashboardItem.events','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xc15c,0x188));var _0xcc15=function(_0x4c327a,_0x217d19){_0x4c327a=_0x4c327a-0x0;var _0x492666=_0xc15c[_0x4c327a];return _0x492666;};'use strict';var DashboardItemEvents=require(_0xcc15('0x0'));var events=['save',_0xcc15('0x1'),_0xcc15('0x2')];function createListener(_0x42f0d0,_0x16d8a5){return function(_0xcd6279){_0x16d8a5[_0xcc15('0x3')](_0x42f0d0,_0xcd6279);};}function removeListener(_0x126ccf,_0x1e01aa){return function(){DashboardItemEvents[_0xcc15('0x4')](_0x126ccf,_0x1e01aa);};}exports[_0xcc15('0x5')]=function(_0x157d58){for(var _0x2bb368=0x0,_0xfa0ad4=events[_0xcc15('0x6')];_0x2bb368<_0xfa0ad4;_0x2bb368++){var _0x388c12=events[_0x2bb368];var _0x2f10d1=createListener(_0xcc15('0x7')+_0x388c12,_0x157d58);DashboardItemEvents['on'](_0x388c12,_0x2f10d1);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b230de4..bad162b 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 _0xe4dd=['put','/:id','update','destroy','exports','multer','connect-timeout','express','fs-extra','get','isAuthenticated'];(function(_0x208969,_0x5ea86c){var _0xcfea83=function(_0x43ca17){while(--_0x43ca17){_0x208969['push'](_0x208969['shift']());}};_0xcfea83(++_0x5ea86c);}(_0xe4dd,0xcb));var _0xde4d=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xe4dd[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0xde4d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xde4d('0x1'));var express=require(_0xde4d('0x2'));var router=express['Router']();var fs_extra=require(_0xde4d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xde4d('0x4')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xde4d('0x5')](),controller['create']);router[_0xde4d('0x6')](_0xde4d('0x7'),auth[_0xde4d('0x5')](),controller[_0xde4d('0x8')]);router['delete'](_0xde4d('0x7'),auth[_0xde4d('0x5')](),controller[_0xde4d('0x9')]);module[_0xde4d('0xa')]=router; \ No newline at end of file +var _0x45b7=['../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x48b8e6,_0x2092f6){var _0x3e1879=function(_0x1acefc){while(--_0x1acefc){_0x48b8e6['push'](_0x48b8e6['shift']());}};_0x3e1879(++_0x2092f6);}(_0x45b7,0xd1));var _0x745b=function(_0x41e556,_0x17ca8e){_0x41e556=_0x41e556-0x0;var _0x5c20cb=_0x45b7[_0x41e556];return _0x5c20cb;};'use strict';var multer=require(_0x745b('0x0'));var util=require(_0x745b('0x1'));var path=require(_0x745b('0x2'));var timeout=require(_0x745b('0x3'));var express=require('express');var router=express[_0x745b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x745b('0x5'));var interaction=require(_0x745b('0x6'));var config=require(_0x745b('0x7'));var controller=require(_0x745b('0x8'));router[_0x745b('0x9')](_0x745b('0xa'),auth['isAuthenticated'](),controller[_0x745b('0xb')]);router[_0x745b('0xc')]('/',auth[_0x745b('0xd')](),controller[_0x745b('0xe')]);router[_0x745b('0xf')](_0x745b('0xa'),auth[_0x745b('0xd')](),controller[_0x745b('0x10')]);router[_0x745b('0x11')]('/:id',auth[_0x745b('0xd')](),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 4596eb4..9f37b25 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 _0x4015=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x5e8781,_0x17ac4c){var _0x466bdf=function(_0x29efe4){while(--_0x29efe4){_0x5e8781['push'](_0x5e8781['shift']());}};_0x466bdf(++_0x17ac4c);}(_0x4015,0xe5));var _0x5401=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x4015[_0xe15270];return _0x1e813b;};'use strict';var Sequelize=require(_0x5401('0x0'));module[_0x5401('0x1')]={'name':{'type':Sequelize[_0x5401('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x5401('0x3')](_0x5401('0x4'),_0x5401('0x5'),_0x5401('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x5401('0x2')]}}; \ No newline at end of file +var _0x368f=['ENUM','second','first','exports','STRING'];(function(_0x22638b,_0x342518){var _0x5f5ab0=function(_0x21f457){while(--_0x21f457){_0x22638b['push'](_0x22638b['shift']());}};_0x5f5ab0(++_0x342518);}(_0x368f,0xd5));var _0xf368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf368('0x0')]={'name':{'type':Sequelize[_0xf368('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xf368('0x2')]('first',_0xf368('0x3'),'third'),'allowNull':![],'defaultValue':_0xf368('0x4')},'description':{'type':Sequelize[_0xf368('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index bd6fe71..d4d8f96 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 _0x48f5=['pick','merge','VIRTUAL','filter','options','Disposition','includeAll','include','rows','intersection','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Dispositions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','jsforce','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4dc4bd,_0x490bf0){var _0x22a362=function(_0x1512b1){while(--_0x1512b1){_0x4dc4bd['push'](_0x4dc4bd['shift']());}};_0x22a362(++_0x490bf0);}(_0x48f5,0x68));var _0x548f=function(_0x10e2fc,_0x1f6044){_0x10e2fc=_0x10e2fc-0x0;var _0x22b717=_0x48f5[_0x10e2fc];return _0x22b717;};'use strict';var emlformat=require(_0x548f('0x0'));var rimraf=require(_0x548f('0x1'));var zipdir=require(_0x548f('0x2'));var jsonpatch=require(_0x548f('0x3'));var rp=require(_0x548f('0x4'));var moment=require('moment');var BPromise=require(_0x548f('0x5'));var Mustache=require(_0x548f('0x6'));var util=require(_0x548f('0x7'));var path=require('path');var sox=require(_0x548f('0x8'));var csv=require(_0x548f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x548f('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x548f('0xb'));var Papa=require(_0x548f('0xc'));var Redis=require(_0x548f('0xd'));var authService=require(_0x548f('0xe'));var qs=require(_0x548f('0xf'));var as=require(_0x548f('0x10'));var hardwareService=require(_0x548f('0x11'));var logger=require(_0x548f('0x12'))('api');var utils=require(_0x548f('0x13'));var config=require(_0x548f('0x14'));var licenseUtil=require(_0x548f('0x15'));var db=require(_0x548f('0x16'))['db'];function respondWithStatusCode(_0x499eba,_0x3d3886){_0x3d3886=_0x3d3886||0xcc;return function(_0x1f3e9a){if(_0x1f3e9a){return _0x499eba['sendStatus'](_0x3d3886);}return _0x499eba[_0x548f('0x17')](_0x3d3886)[_0x548f('0x18')]();};}function respondWithResult(_0x55fb62,_0x3568a1){_0x3568a1=_0x3568a1||0xc8;return function(_0x5a1e53){if(_0x5a1e53){return _0x55fb62[_0x548f('0x17')](_0x3568a1)[_0x548f('0x19')](_0x5a1e53);}};}function respondWithFilteredResult(_0x32a3e4,_0x11a86b){return function(_0x5efe6a){if(_0x5efe6a){var _0x5e602a=typeof _0x11a86b[_0x548f('0x1a')]===_0x548f('0x1b')&&typeof _0x11a86b[_0x548f('0x1c')]==='undefined';var _0x37d761=_0x5efe6a[_0x548f('0x1d')];var _0x188911=_0x5e602a?0x0:_0x11a86b[_0x548f('0x1a')];var _0x55515a=_0x5e602a?_0x5efe6a[_0x548f('0x1d')]:_0x11a86b[_0x548f('0x1a')]+_0x11a86b['limit'];var _0x24cf5b;if(_0x55515a>=_0x37d761){_0x55515a=_0x37d761;_0x24cf5b=0xc8;}else{_0x24cf5b=0xce;}_0x32a3e4[_0x548f('0x17')](_0x24cf5b);return _0x32a3e4[_0x548f('0x1e')](_0x548f('0x1f'),_0x188911+'-'+_0x55515a+'/'+_0x37d761)[_0x548f('0x19')](_0x5efe6a);}return null;};}function patchUpdates(_0x1d202c){return function(_0x41c1e9){try{jsonpatch[_0x548f('0x20')](_0x41c1e9,_0x1d202c,!![]);}catch(_0x1983ed){return BPromise[_0x548f('0x21')](_0x1983ed);}return _0x41c1e9['save']();};}function saveUpdates(_0x2eca42,_0x7f8a36){return function(_0x4ff05d){if(_0x4ff05d){return _0x4ff05d[_0x548f('0x22')](_0x2eca42)['then'](function(_0x10169d){return _0x10169d;});}return null;};}function removeEntity(_0x435333,_0x34228a){return function(_0x5f06ac){if(_0x5f06ac){return _0x5f06ac[_0x548f('0x23')]()[_0x548f('0x24')](function(){var _0x33f65f=_0x5f06ac['get']({'plain':!![]});var _0x17a53c='Dispositions';return db[_0x548f('0x25')][_0x548f('0x23')]({'where':{'type':_0x17a53c,'resourceId':_0x33f65f['id']}})['then'](function(){return _0x5f06ac;});})[_0x548f('0x24')](function(){_0x435333['status'](0xcc)[_0x548f('0x18')]();});}};}function handleEntityNotFound(_0x303279,_0x2c10ec){return function(_0x550f9c){if(!_0x550f9c){_0x303279[_0x548f('0x26')](0x194);}return _0x550f9c;};}function handleError(_0x258320,_0x29a662){_0x29a662=_0x29a662||0x1f4;return function(_0xc08fd0){logger[_0x548f('0x27')](_0xc08fd0['stack']);if(_0xc08fd0[_0x548f('0x28')]){delete _0xc08fd0[_0x548f('0x28')];}_0x258320[_0x548f('0x17')](_0x29a662)[_0x548f('0x29')](_0xc08fd0);};}exports['index']=function(_0x162d2b,_0x3eac0a){var _0x23af51={},_0xa84e0={},_0x751031={'count':0x0,'rows':[]};var _0x120cc4=_[_0x548f('0x2a')](db['Disposition'][_0x548f('0x2b')],function(_0x123a4b){return{'name':_0x123a4b[_0x548f('0x2c')],'type':_0x123a4b[_0x548f('0x2d')][_0x548f('0x2e')]};});_0xa84e0[_0x548f('0x2f')]=_['map'](_0x120cc4,_0x548f('0x28'));_0xa84e0[_0x548f('0x30')]=_['keys'](_0x162d2b[_0x548f('0x30')]);_0xa84e0[_0x548f('0x31')]=_['intersection'](_0xa84e0[_0x548f('0x2f')],_0xa84e0[_0x548f('0x30')]);_0x23af51[_0x548f('0x32')]=_['intersection'](_0xa84e0[_0x548f('0x2f')],qs[_0x548f('0x33')](_0x162d2b[_0x548f('0x30')]['fields']));_0x23af51['attributes']=_0x23af51['attributes'][_0x548f('0x34')]?_0x23af51['attributes']:_0xa84e0[_0x548f('0x2f')];if(!_0x162d2b[_0x548f('0x30')][_0x548f('0x35')](_0x548f('0x36'))){_0x23af51[_0x548f('0x1c')]=qs[_0x548f('0x1c')](_0x162d2b['query'][_0x548f('0x1c')]);_0x23af51[_0x548f('0x1a')]=qs['offset'](_0x162d2b[_0x548f('0x30')][_0x548f('0x1a')]);}_0x23af51[_0x548f('0x37')]=qs[_0x548f('0x38')](_0x162d2b[_0x548f('0x30')]['sort']);_0x23af51[_0x548f('0x39')]=qs['filters'](_[_0x548f('0x3a')](_0x162d2b[_0x548f('0x30')],_0xa84e0[_0x548f('0x31')]),_0x120cc4);if(_0x162d2b[_0x548f('0x30')]['filter']){_0x23af51[_0x548f('0x39')]=_[_0x548f('0x3b')](_0x23af51['where'],{'$or':_[_0x548f('0x2a')](_0x120cc4,function(_0x381145){if(_0x381145[_0x548f('0x2d')]!==_0x548f('0x3c')){var _0x2fed77={};_0x2fed77[_0x381145['name']]={'$like':'%'+_0x162d2b[_0x548f('0x30')][_0x548f('0x3d')]+'%'};return _0x2fed77;}})});}_0x23af51=_['merge']({},_0x23af51,_0x162d2b[_0x548f('0x3e')]);var _0x2f79ff={'where':_0x23af51[_0x548f('0x39')]};return db[_0x548f('0x3f')][_0x548f('0x1d')](_0x2f79ff)[_0x548f('0x24')](function(_0x424380){_0x751031[_0x548f('0x1d')]=_0x424380;if(_0x162d2b[_0x548f('0x30')][_0x548f('0x40')]){_0x23af51[_0x548f('0x41')]=[{'all':!![]}];}return db[_0x548f('0x3f')]['findAll'](_0x23af51);})[_0x548f('0x24')](function(_0x341aab){_0x751031[_0x548f('0x42')]=_0x341aab;return _0x751031;})['then'](respondWithFilteredResult(_0x3eac0a,_0x23af51))['catch'](handleError(_0x3eac0a,null));};exports['show']=function(_0xbd8f1f,_0x5ad047){var _0x291a4c={'raw':!![],'where':{'id':_0xbd8f1f['params']['id']}},_0x2b4e3f={};_0x2b4e3f[_0x548f('0x2f')]=_['keys'](db[_0x548f('0x3f')][_0x548f('0x2b')]);_0x2b4e3f[_0x548f('0x30')]=_['keys'](_0xbd8f1f[_0x548f('0x30')]);_0x2b4e3f[_0x548f('0x31')]=_['intersection'](_0x2b4e3f['model'],_0x2b4e3f['query']);_0x291a4c[_0x548f('0x32')]=_[_0x548f('0x43')](_0x2b4e3f[_0x548f('0x2f')],qs[_0x548f('0x33')](_0xbd8f1f[_0x548f('0x30')][_0x548f('0x33')]));_0x291a4c['attributes']=_0x291a4c[_0x548f('0x32')][_0x548f('0x34')]?_0x291a4c[_0x548f('0x32')]:_0x2b4e3f[_0x548f('0x2f')];if(_0xbd8f1f[_0x548f('0x30')][_0x548f('0x40')]){_0x291a4c[_0x548f('0x41')]=[{'all':!![]}];}_0x291a4c=_[_0x548f('0x3b')]({},_0x291a4c,_0xbd8f1f[_0x548f('0x3e')]);return db[_0x548f('0x3f')][_0x548f('0x44')](_0x291a4c)[_0x548f('0x24')](handleEntityNotFound(_0x5ad047,null))['then'](respondWithResult(_0x5ad047,null))[_0x548f('0x45')](handleError(_0x5ad047,null));};exports['create']=function(_0x2556f6,_0x475ca7){return db[_0x548f('0x3f')][_0x548f('0x46')](_0x2556f6[_0x548f('0x47')],{})['then'](function(_0x58fae2){var _0x4f30f7=_0x2556f6['user']['get']({'plain':!![]});if(!_0x4f30f7)throw new Error(_0x548f('0x48'));if(_0x4f30f7[_0x548f('0x49')]===_0x548f('0x4a')){var _0x130c4b=_0x58fae2[_0x548f('0x4b')]({'plain':!![]});var _0x4ecd5b=_0x548f('0x4c');return db[_0x548f('0x4d')][_0x548f('0x44')]({'where':{'name':_0x4ecd5b,'userProfileId':_0x4f30f7['userProfileId']},'raw':!![]})[_0x548f('0x24')](function(_0xfe2525){if(_0xfe2525&&_0xfe2525[_0x548f('0x4e')]===0x0){return db['UserProfileResource'][_0x548f('0x46')]({'name':_0x130c4b[_0x548f('0x28')],'resourceId':_0x130c4b['id'],'type':_0xfe2525[_0x548f('0x28')],'sectionId':_0xfe2525['id']},{})[_0x548f('0x24')](function(){return _0x58fae2;});}else{return _0x58fae2;}})[_0x548f('0x45')](function(_0x487785){logger[_0x548f('0x27')](_0x548f('0x4f'),_0x487785);throw _0x487785;});}return _0x58fae2;})[_0x548f('0x24')](respondWithResult(_0x475ca7,0xc9))['catch'](handleError(_0x475ca7,null));};exports[_0x548f('0x22')]=function(_0x248922,_0x352dbc){if(_0x248922[_0x548f('0x47')]['id']){delete _0x248922[_0x548f('0x47')]['id'];}return db[_0x548f('0x3f')][_0x548f('0x44')]({'where':{'id':_0x248922[_0x548f('0x50')]['id']}})[_0x548f('0x24')](handleEntityNotFound(_0x352dbc,null))[_0x548f('0x24')](saveUpdates(_0x248922['body'],null))[_0x548f('0x24')](respondWithResult(_0x352dbc,null))[_0x548f('0x45')](handleError(_0x352dbc,null));};exports[_0x548f('0x23')]=function(_0x5b7f9f,_0x373641){return db[_0x548f('0x3f')][_0x548f('0x44')]({'where':{'id':_0x5b7f9f[_0x548f('0x50')]['id']}})[_0x548f('0x24')](handleEntityNotFound(_0x373641,null))['then'](removeEntity(_0x373641,null))[_0x548f('0x45')](handleError(_0x373641,null));}; \ No newline at end of file +var _0xe3d7=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','Disposition','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe3d7,0x109));var _0x7e3d=function(_0x3639b6,_0x4bb576){_0x3639b6=_0x3639b6-0x0;var _0x252a97=_0xe3d7[_0x3639b6];return _0x252a97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e3d('0x0'));var zipdir=require(_0x7e3d('0x1'));var jsonpatch=require(_0x7e3d('0x2'));var rp=require(_0x7e3d('0x3'));var moment=require(_0x7e3d('0x4'));var BPromise=require(_0x7e3d('0x5'));var Mustache=require(_0x7e3d('0x6'));var util=require('util');var path=require(_0x7e3d('0x7'));var sox=require(_0x7e3d('0x8'));var csv=require(_0x7e3d('0x9'));var ejs=require(_0x7e3d('0xa'));var fs=require('fs');var fs_extra=require(_0x7e3d('0xb'));var _=require(_0x7e3d('0xc'));var squel=require(_0x7e3d('0xd'));var crypto=require(_0x7e3d('0xe'));var jsforce=require(_0x7e3d('0xf'));var deskjs=require(_0x7e3d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7e3d('0x11'));var Papa=require('papaparse');var Redis=require(_0x7e3d('0x12'));var authService=require(_0x7e3d('0x13'));var qs=require(_0x7e3d('0x14'));var as=require(_0x7e3d('0x15'));var hardwareService=require(_0x7e3d('0x16'));var logger=require(_0x7e3d('0x17'))(_0x7e3d('0x18'));var utils=require(_0x7e3d('0x19'));var config=require(_0x7e3d('0x1a'));var licenseUtil=require(_0x7e3d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x278d44,_0x3a9b6a){_0x3a9b6a=_0x3a9b6a||0xcc;return function(_0x22db79){if(_0x22db79){return _0x278d44[_0x7e3d('0x1c')](_0x3a9b6a);}return _0x278d44['status'](_0x3a9b6a)['end']();};}function respondWithResult(_0x593f60,_0xe6b29f){_0xe6b29f=_0xe6b29f||0xc8;return function(_0x583adc){if(_0x583adc){return _0x593f60[_0x7e3d('0x1d')](_0xe6b29f)['json'](_0x583adc);}};}function respondWithFilteredResult(_0x1fe8aa,_0x95afc1){return function(_0x3cbe12){if(_0x3cbe12){var _0x196abd=typeof _0x95afc1['offset']===_0x7e3d('0x1e')&&typeof _0x95afc1['limit']===_0x7e3d('0x1e');var _0x375c17=_0x3cbe12['count'];var _0x4ef35d=_0x196abd?0x0:_0x95afc1[_0x7e3d('0x1f')];var _0x16cbd4=_0x196abd?_0x3cbe12[_0x7e3d('0x20')]:_0x95afc1[_0x7e3d('0x1f')]+_0x95afc1[_0x7e3d('0x21')];var _0x173ab0;if(_0x16cbd4>=_0x375c17){_0x16cbd4=_0x375c17;_0x173ab0=0xc8;}else{_0x173ab0=0xce;}_0x1fe8aa['status'](_0x173ab0);return _0x1fe8aa[_0x7e3d('0x22')](_0x7e3d('0x23'),_0x4ef35d+'-'+_0x16cbd4+'/'+_0x375c17)['json'](_0x3cbe12);}return null;};}function patchUpdates(_0x1533f0){return function(_0x16db4d){try{jsonpatch[_0x7e3d('0x24')](_0x16db4d,_0x1533f0,!![]);}catch(_0x1d2092){return BPromise[_0x7e3d('0x25')](_0x1d2092);}return _0x16db4d[_0x7e3d('0x26')]();};}function saveUpdates(_0x1fe65e,_0x40f99e){return function(_0x435399){if(_0x435399){return _0x435399[_0x7e3d('0x27')](_0x1fe65e)['then'](function(_0x182507){return _0x182507;});}return null;};}function removeEntity(_0x210e91,_0x447b66){return function(_0xe8ebde){if(_0xe8ebde){return _0xe8ebde[_0x7e3d('0x28')]()['then'](function(){var _0x222f4e=_0xe8ebde[_0x7e3d('0x29')]({'plain':!![]});var _0x4e8398='Dispositions';return db[_0x7e3d('0x2a')][_0x7e3d('0x28')]({'where':{'type':_0x4e8398,'resourceId':_0x222f4e['id']}})[_0x7e3d('0x2b')](function(){return _0xe8ebde;});})[_0x7e3d('0x2b')](function(){_0x210e91['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1e37,_0x2d518f){return function(_0x452364){if(!_0x452364){_0x1b1e37[_0x7e3d('0x1c')](0x194);}return _0x452364;};}function handleError(_0x5037f6,_0x28e325){_0x28e325=_0x28e325||0x1f4;return function(_0x3b1c2d){logger[_0x7e3d('0x2c')](_0x3b1c2d[_0x7e3d('0x2d')]);if(_0x3b1c2d[_0x7e3d('0x2e')]){delete _0x3b1c2d['name'];}_0x5037f6[_0x7e3d('0x1d')](_0x28e325)[_0x7e3d('0x2f')](_0x3b1c2d);};}exports[_0x7e3d('0x30')]=function(_0x21be29,_0x5d982d){var _0x54ed53={},_0x180b82={},_0x47d3c8={'count':0x0,'rows':[]};var _0x412904=_[_0x7e3d('0x31')](db[_0x7e3d('0x32')]['rawAttributes'],function(_0x214a3f){return{'name':_0x214a3f[_0x7e3d('0x33')],'type':_0x214a3f[_0x7e3d('0x34')][_0x7e3d('0x35')]};});_0x180b82[_0x7e3d('0x36')]=_[_0x7e3d('0x31')](_0x412904,'name');_0x180b82[_0x7e3d('0x37')]=_[_0x7e3d('0x38')](_0x21be29['query']);_0x180b82[_0x7e3d('0x39')]=_['intersection'](_0x180b82[_0x7e3d('0x36')],_0x180b82[_0x7e3d('0x37')]);_0x54ed53[_0x7e3d('0x3a')]=_[_0x7e3d('0x3b')](_0x180b82[_0x7e3d('0x36')],qs[_0x7e3d('0x3c')](_0x21be29[_0x7e3d('0x37')][_0x7e3d('0x3c')]));_0x54ed53[_0x7e3d('0x3a')]=_0x54ed53[_0x7e3d('0x3a')][_0x7e3d('0x3d')]?_0x54ed53['attributes']:_0x180b82[_0x7e3d('0x36')];if(!_0x21be29[_0x7e3d('0x37')][_0x7e3d('0x3e')](_0x7e3d('0x3f'))){_0x54ed53[_0x7e3d('0x21')]=qs[_0x7e3d('0x21')](_0x21be29[_0x7e3d('0x37')][_0x7e3d('0x21')]);_0x54ed53[_0x7e3d('0x1f')]=qs[_0x7e3d('0x1f')](_0x21be29[_0x7e3d('0x37')][_0x7e3d('0x1f')]);}_0x54ed53[_0x7e3d('0x40')]=qs[_0x7e3d('0x41')](_0x21be29[_0x7e3d('0x37')]['sort']);_0x54ed53[_0x7e3d('0x42')]=qs[_0x7e3d('0x39')](_['pick'](_0x21be29[_0x7e3d('0x37')],_0x180b82[_0x7e3d('0x39')]),_0x412904);if(_0x21be29['query'][_0x7e3d('0x43')]){_0x54ed53[_0x7e3d('0x42')]=_['merge'](_0x54ed53[_0x7e3d('0x42')],{'$or':_[_0x7e3d('0x31')](_0x412904,function(_0x101e33){if(_0x101e33[_0x7e3d('0x34')]!=='VIRTUAL'){var _0x1c2790={};_0x1c2790[_0x101e33[_0x7e3d('0x2e')]]={'$like':'%'+_0x21be29[_0x7e3d('0x37')][_0x7e3d('0x43')]+'%'};return _0x1c2790;}})});}_0x54ed53=_[_0x7e3d('0x44')]({},_0x54ed53,_0x21be29[_0x7e3d('0x45')]);var _0x25ffbd={'where':_0x54ed53[_0x7e3d('0x42')]};return db['Disposition']['count'](_0x25ffbd)['then'](function(_0x496114){_0x47d3c8[_0x7e3d('0x20')]=_0x496114;if(_0x21be29[_0x7e3d('0x37')][_0x7e3d('0x46')]){_0x54ed53[_0x7e3d('0x47')]=[{'all':!![]}];}return db[_0x7e3d('0x32')][_0x7e3d('0x48')](_0x54ed53);})['then'](function(_0xb5bb18){_0x47d3c8[_0x7e3d('0x49')]=_0xb5bb18;return _0x47d3c8;})['then'](respondWithFilteredResult(_0x5d982d,_0x54ed53))[_0x7e3d('0x4a')](handleError(_0x5d982d,null));};exports[_0x7e3d('0x4b')]=function(_0x470347,_0x42569f){var _0x229076={'raw':!![],'where':{'id':_0x470347[_0x7e3d('0x4c')]['id']}},_0x5760cd={};_0x5760cd[_0x7e3d('0x36')]=_['keys'](db[_0x7e3d('0x32')][_0x7e3d('0x4d')]);_0x5760cd['query']=_['keys'](_0x470347[_0x7e3d('0x37')]);_0x5760cd[_0x7e3d('0x39')]=_['intersection'](_0x5760cd[_0x7e3d('0x36')],_0x5760cd[_0x7e3d('0x37')]);_0x229076[_0x7e3d('0x3a')]=_[_0x7e3d('0x3b')](_0x5760cd[_0x7e3d('0x36')],qs[_0x7e3d('0x3c')](_0x470347[_0x7e3d('0x37')]['fields']));_0x229076[_0x7e3d('0x3a')]=_0x229076[_0x7e3d('0x3a')][_0x7e3d('0x3d')]?_0x229076[_0x7e3d('0x3a')]:_0x5760cd[_0x7e3d('0x36')];if(_0x470347['query'][_0x7e3d('0x46')]){_0x229076['include']=[{'all':!![]}];}_0x229076=_[_0x7e3d('0x44')]({},_0x229076,_0x470347[_0x7e3d('0x45')]);return db[_0x7e3d('0x32')][_0x7e3d('0x4e')](_0x229076)[_0x7e3d('0x2b')](handleEntityNotFound(_0x42569f,null))[_0x7e3d('0x2b')](respondWithResult(_0x42569f,null))[_0x7e3d('0x4a')](handleError(_0x42569f,null));};exports[_0x7e3d('0x4f')]=function(_0x363b0f,_0x349f3e){return db[_0x7e3d('0x32')][_0x7e3d('0x4f')](_0x363b0f[_0x7e3d('0x50')],{})[_0x7e3d('0x2b')](function(_0x2643f4){var _0x48469c=_0x363b0f[_0x7e3d('0x51')][_0x7e3d('0x29')]({'plain':!![]});if(!_0x48469c)throw new Error(_0x7e3d('0x52'));if(_0x48469c['role']===_0x7e3d('0x51')){var _0x3a4eef=_0x2643f4[_0x7e3d('0x29')]({'plain':!![]});var _0x54a357=_0x7e3d('0x53');return db['UserProfileSection'][_0x7e3d('0x4e')]({'where':{'name':_0x54a357,'userProfileId':_0x48469c['userProfileId']},'raw':!![]})[_0x7e3d('0x2b')](function(_0x4c3592){if(_0x4c3592&&_0x4c3592[_0x7e3d('0x54')]===0x0){return db[_0x7e3d('0x2a')][_0x7e3d('0x4f')]({'name':_0x3a4eef['name'],'resourceId':_0x3a4eef['id'],'type':_0x4c3592[_0x7e3d('0x2e')],'sectionId':_0x4c3592['id']},{})[_0x7e3d('0x2b')](function(){return _0x2643f4;});}else{return _0x2643f4;}})[_0x7e3d('0x4a')](function(_0x26eae0){logger[_0x7e3d('0x2c')](_0x7e3d('0x55'),_0x26eae0);throw _0x26eae0;});}return _0x2643f4;})[_0x7e3d('0x2b')](respondWithResult(_0x349f3e,0xc9))['catch'](handleError(_0x349f3e,null));};exports[_0x7e3d('0x27')]=function(_0x8a617b,_0x4b2651){if(_0x8a617b[_0x7e3d('0x50')]['id']){delete _0x8a617b[_0x7e3d('0x50')]['id'];}return db[_0x7e3d('0x32')][_0x7e3d('0x4e')]({'where':{'id':_0x8a617b[_0x7e3d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b2651,null))['then'](saveUpdates(_0x8a617b[_0x7e3d('0x50')],null))[_0x7e3d('0x2b')](respondWithResult(_0x4b2651,null))[_0x7e3d('0x4a')](handleError(_0x4b2651,null));};exports[_0x7e3d('0x28')]=function(_0x22451e,_0x45009f){return db['Disposition']['find']({'where':{'id':_0x22451e[_0x7e3d('0x4c')]['id']}})[_0x7e3d('0x2b')](handleEntityNotFound(_0x45009f,null))[_0x7e3d('0x2b')](removeEntity(_0x45009f,null))['catch'](handleError(_0x45009f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 662a0f0..e024eb8 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 _0xf5d6=['exports','define','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x499175,_0x174690){var _0x25964e=function(_0xfe639b){while(--_0xfe639b){_0x499175['push'](_0x499175['shift']());}};_0x25964e(++_0x174690);}(_0xf5d6,0x7c));var _0x6f5d=function(_0x1dbe01,_0x5c1578){_0x1dbe01=_0x1dbe01-0x0;var _0x472afd=_0xf5d6[_0x1dbe01];return _0x472afd;};'use strict';var _=require(_0x6f5d('0x0'));var util=require('util');var logger=require(_0x6f5d('0x1'))(_0x6f5d('0x2'));var moment=require(_0x6f5d('0x3'));var BPromise=require(_0x6f5d('0x4'));var rp=require(_0x6f5d('0x5'));var fs=require('fs');var path=require(_0x6f5d('0x6'));var rimraf=require(_0x6f5d('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x6f5d('0x8')]=function(_0x32ea9a,_0x1a0050){return _0x32ea9a[_0x6f5d('0x9')](_0x6f5d('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x6f5d('0xb'),'fields':[_0x6f5d('0xc'),_0x6f5d('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x6f5d('0xc'),_0x6f5d('0xe')]},{'unique':!![],'name':_0x6f5d('0xf'),'fields':[_0x6f5d('0xc'),_0x6f5d('0x10')]},{'unique':!![],'name':_0x6f5d('0x11'),'fields':[_0x6f5d('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x6f5d('0x12'),'fields':[_0x6f5d('0xc'),_0x6f5d('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0x6f5d('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0x6f5d('0x14'),'fields':['name',_0x6f5d('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4740=['path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xcf8419,_0x3d07d2){var _0x59849d=function(_0x1409da){while(--_0x1409da){_0xcf8419['push'](_0xcf8419['shift']());}};_0x59849d(++_0x3d07d2);}(_0x4740,0x102));var _0x0474=function(_0x3d1f79,_0x44bcec){_0x3d1f79=_0x3d1f79-0x0;var _0xe93712=_0x4740[_0x3d1f79];return _0xe93712;};'use strict';var _=require(_0x0474('0x0'));var util=require(_0x0474('0x1'));var logger=require(_0x0474('0x2'))(_0x0474('0x3'));var moment=require(_0x0474('0x4'));var BPromise=require(_0x0474('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0474('0x6'));var rimraf=require(_0x0474('0x7'));var config=require(_0x0474('0x8'));var attributes=require(_0x0474('0x9'));module['exports']=function(_0x270892,_0x20547e){return _0x270892[_0x0474('0xa')](_0x0474('0xb'),attributes,{'tableName':_0x0474('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x0474('0xd'),'fields':[_0x0474('0xe'),_0x0474('0xf')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x0474('0x10'),'fields':['name',_0x0474('0x11')]},{'unique':!![],'name':_0x0474('0x12'),'fields':[_0x0474('0xe'),_0x0474('0x13')]},{'unique':!![],'name':_0x0474('0x14'),'fields':[_0x0474('0xe'),_0x0474('0x15')]},{'unique':!![],'name':_0x0474('0x16'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x0474('0x17'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 01a58a4..4d839db 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(_0x2adf72,_0x2338f6){var _0x57ab05=function(_0x2d7c5c){while(--_0x2d7c5c){_0x2adf72['push'](_0x2adf72['shift']());}};_0x57ab05(++_0x2338f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x57aae4,_0x45175e){var _0x1813e8=function(_0x5512db){while(--_0x5512db){_0x57aae4['push'](_0x57aae4['shift']());}};_0x1813e8(++_0x45175e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 6792e65..3cccd58 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 _0xd5bf=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x50b50c,_0x267bcb){var _0x3eaa43=function(_0x2938ab){while(--_0x2938ab){_0x50b50c['push'](_0x50b50c['shift']());}};_0x3eaa43(++_0x267bcb);}(_0xd5bf,0x94));var _0xfd5b=function(_0x35c0ce,_0x2ebb07){_0x35c0ce=_0x35c0ce-0x0;var _0x2b042a=_0xd5bf[_0x35c0ce];return _0x2b042a;};'use strict';var multer=require(_0xfd5b('0x0'));var util=require(_0xfd5b('0x1'));var path=require(_0xfd5b('0x2'));var timeout=require(_0xfd5b('0x3'));var express=require(_0xfd5b('0x4'));var router=express[_0xfd5b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfd5b('0x6'));var interaction=require(_0xfd5b('0x7'));var config=require(_0xfd5b('0x8'));var controller=require('./disposition.controller');router[_0xfd5b('0x9')]('/',auth[_0xfd5b('0xa')](),controller[_0xfd5b('0xb')]);router[_0xfd5b('0x9')](_0xfd5b('0xc'),auth[_0xfd5b('0xa')](),controller[_0xfd5b('0xd')]);router['post']('/',auth[_0xfd5b('0xa')](),controller['create']);router[_0xfd5b('0xe')](_0xfd5b('0xc'),auth[_0xfd5b('0xa')](),controller[_0xfd5b('0xf')]);router[_0xfd5b('0x10')](_0xfd5b('0xc'),auth[_0xfd5b('0xa')](),controller['destroy']);module[_0xfd5b('0x11')]=router; \ No newline at end of file +var _0x98d4=['/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x62366c,_0xd0c813){var _0x5bea15=function(_0x2d5d98){while(--_0x2d5d98){_0x62366c['push'](_0x62366c['shift']());}};_0x5bea15(++_0xd0c813);}(_0x98d4,0x127));var _0x498d=function(_0x20a9e0,_0x5c790e){_0x20a9e0=_0x20a9e0-0x0;var _0x45c98d=_0x98d4[_0x20a9e0];return _0x45c98d;};'use strict';var multer=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var path=require('path');var timeout=require(_0x498d('0x2'));var express=require(_0x498d('0x3'));var router=express[_0x498d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x498d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x498d('0x6')]('/',auth[_0x498d('0x7')](),controller[_0x498d('0x8')]);router[_0x498d('0x6')](_0x498d('0x9'),auth['isAuthenticated'](),controller[_0x498d('0xa')]);router[_0x498d('0xb')]('/',auth[_0x498d('0x7')](),controller['create']);router[_0x498d('0xc')](_0x498d('0x9'),auth[_0x498d('0x7')](),controller[_0x498d('0xd')]);router['delete'](_0x498d('0x9'),auth[_0x498d('0x7')](),controller[_0x498d('0xe')]);module[_0x498d('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6ba542d..07ea040 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 _0x4300=['SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','yes','STRING','xCALLY\x20Motion\x20Fax','ENUM','4800','9600','12000','14400','2400','7200','v17,v27,v29','INTEGER','DADHI','KHOMP'];(function(_0x4ff514,_0xae60c1){var _0x230c00=function(_0x1c7897){while(--_0x1c7897){_0x4ff514['push'](_0x4ff514['shift']());}};_0x230c00(++_0xae60c1);}(_0x4300,0x1a6));var _0x0430=function(_0x74b8ca,_0x373640){_0x74b8ca=_0x74b8ca-0x0;var _0x4f93e7=_0x4300[_0x74b8ca];return _0x4f93e7;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x0430('0x1'),'no'),'defaultValue':_0x0430('0x1')},'headerinfo':{'type':Sequelize[_0x0430('0x2')],'defaultValue':_0x0430('0x3')},'localstationid':{'type':Sequelize[_0x0430('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x0430('0x4')]('2400',_0x0430('0x5'),'7200',_0x0430('0x6'),_0x0430('0x7'),_0x0430('0x8')),'defaultValue':_0x0430('0x5')},'maxrate':{'type':Sequelize[_0x0430('0x4')](_0x0430('0x9'),_0x0430('0x5'),_0x0430('0xa'),_0x0430('0x6'),'12000',_0x0430('0x8')),'defaultValue':_0x0430('0x8')},'modem':{'type':Sequelize[_0x0430('0x2')],'defaultValue':_0x0430('0xb')},'gateway':{'type':Sequelize[_0x0430('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0430('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0430('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0430('0x4')]('SIP','IAX',_0x0430('0xd'),_0x0430('0xe')),'defaultValue':_0x0430('0xf')},'key':{'type':Sequelize[_0x0430('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0430('0x10')],'defaultValue':function(){return _0x0430('0x11');}},'notificationSound':{'type':Sequelize[_0x0430('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0430('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0430('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0430('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a3239){if(!_0x1a3239)this[_0x0430('0x14')](_0x0430('0x15'),null);this[_0x0430('0x14')](_0x0430('0x16'),_0x1a3239);}}}; \ No newline at end of file +var _0x6f47=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','14400','2400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x40a71a,_0x5bf2ab){var _0x1a687b=function(_0x335b19){while(--_0x335b19){_0x40a71a['push'](_0x40a71a['shift']());}};_0x1a687b(++_0x5bf2ab);}(_0x6f47,0xc7));var _0x76f4=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x6f47[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x76f4('0x2')]('yes','no'),'defaultValue':_0x76f4('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x76f4('0x4')},'localstationid':{'type':Sequelize[_0x76f4('0x1')],'unique':_0x76f4('0x5')},'minrate':{'type':Sequelize[_0x76f4('0x2')]('2400',_0x76f4('0x6'),_0x76f4('0x7'),_0x76f4('0x8'),'12000',_0x76f4('0x9')),'defaultValue':_0x76f4('0x6')},'maxrate':{'type':Sequelize[_0x76f4('0x2')](_0x76f4('0xa'),_0x76f4('0x6'),'7200','9600',_0x76f4('0xb'),_0x76f4('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x76f4('0xc')},'gateway':{'type':Sequelize[_0x76f4('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x76f4('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x76f4('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x76f4('0x2')](_0x76f4('0xe'),_0x76f4('0xf'),_0x76f4('0x10'),_0x76f4('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x76f4('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x76f4('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x76f4('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x76f4('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x76f4('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x76f4('0x13')],'defaultValue':![],'comment':_0x76f4('0x15'),'set':function(_0x672960){if(!_0x672960)this[_0x76f4('0x16')](_0x76f4('0x17'),null);this[_0x76f4('0x16')](_0x76f4('0x18'),_0x672960);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 45398d1..39f4021 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 _0xa6e1=['show','params','Pause','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','FaxAccountId','Disposition','getDispositions','findOne','include','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','json','getApplications','context','exten','localstationid','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','updateAccountApplications','update','VoiceExtension','tech','createdAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','stack','name','send','index','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','rows'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa6e1,0x6f));var _0x1a6e=function(_0x1766a4,_0x235329){_0x1766a4=_0x1766a4-0x0;var _0x16d8a6=_0xa6e1[_0x1766a4];return _0x16d8a6;};'use strict';var emlformat=require(_0x1a6e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a6e('0x1'));var rp=require(_0x1a6e('0x2'));var moment=require(_0x1a6e('0x3'));var BPromise=require(_0x1a6e('0x4'));var Mustache=require(_0x1a6e('0x5'));var util=require(_0x1a6e('0x6'));var path=require('path');var sox=require(_0x1a6e('0x7'));var csv=require(_0x1a6e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1a6e('0x9'));var crypto=require(_0x1a6e('0xa'));var jsforce=require(_0x1a6e('0xb'));var deskjs=require(_0x1a6e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1a6e('0xd'));var Papa=require(_0x1a6e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1a6e('0xf'));var as=require(_0x1a6e('0x10'));var hardwareService=require(_0x1a6e('0x11'));var logger=require(_0x1a6e('0x12'))(_0x1a6e('0x13'));var utils=require(_0x1a6e('0x14'));var config=require(_0x1a6e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a6e('0x16'))['db'];config['redis']=_[_0x1a6e('0x17')](config[_0x1a6e('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a6e('0x19'))(new Redis(config[_0x1a6e('0x18')]));require(_0x1a6e('0x1a'))[_0x1a6e('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1a6e('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x1a6e('0x1c')][_0x1a6e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x52a6cb,_0x27d5ec,_0x31d3d8,_0x5c8ab6){return new BPromise(function(_0x3ba7ab,_0x16efba){var _0xc33adf=_0x5c8ab6||client;return _0xc33adf[_0x1a6e('0x1e')](_0x52a6cb,_0x31d3d8)[_0x1a6e('0x1f')](function(_0x58fc02){logger[_0x1a6e('0x20')](_0x1a6e('0x21'),_0x27d5ec,_0x1a6e('0x22'));logger[_0x1a6e('0x23')](_0x1a6e('0x24'),_0x27d5ec,_0x1a6e('0x22'),JSON[_0x1a6e('0x25')](_0x58fc02));if(_0x58fc02[_0x1a6e('0x26')]){if(_0x58fc02[_0x1a6e('0x26')][_0x1a6e('0x27')]===0x1f4){logger['error'](_0x1a6e('0x21'),_0x27d5ec,_0x58fc02[_0x1a6e('0x26')][_0x1a6e('0x28')]);return _0x16efba(_0x58fc02[_0x1a6e('0x26')][_0x1a6e('0x28')]);}logger[_0x1a6e('0x26')](_0x1a6e('0x21'),_0x27d5ec,_0x58fc02[_0x1a6e('0x26')]['message']);return _0x3ba7ab(_0x58fc02[_0x1a6e('0x26')][_0x1a6e('0x28')]);}else{logger['info'](_0x1a6e('0x21'),_0x27d5ec,'request\x20sent');_0x3ba7ab(_0x58fc02[_0x1a6e('0x29')][_0x1a6e('0x28')]);}})['catch'](function(_0x3b6b9a){logger[_0x1a6e('0x26')](_0x1a6e('0x21'),_0x27d5ec,_0x3b6b9a);_0x16efba(_0x3b6b9a);});});}function respondWithStatusCode(_0x55461c,_0x3b4765){_0x3b4765=_0x3b4765||0xcc;return function(_0x3fd0fe){if(_0x3fd0fe){return _0x55461c[_0x1a6e('0x2a')](_0x3b4765);}return _0x55461c[_0x1a6e('0x2b')](_0x3b4765)[_0x1a6e('0x2c')]();};}function respondWithResult(_0x2f9438,_0x5ed87c){_0x5ed87c=_0x5ed87c||0xc8;return function(_0x4c2880){if(_0x4c2880){return _0x2f9438['status'](_0x5ed87c)['json'](_0x4c2880);}};}function respondWithFilteredResult(_0x3b4015,_0x369861){return function(_0x4bbc80){if(_0x4bbc80){var _0x5bee1f=typeof _0x369861[_0x1a6e('0x2d')]===_0x1a6e('0x2e')&&typeof _0x369861[_0x1a6e('0x2f')]===_0x1a6e('0x2e');var _0x5f1eec=_0x4bbc80[_0x1a6e('0x30')];var _0x490c68=_0x5bee1f?0x0:_0x369861[_0x1a6e('0x2d')];var _0x44a67a=_0x5bee1f?_0x4bbc80[_0x1a6e('0x30')]:_0x369861[_0x1a6e('0x2d')]+_0x369861[_0x1a6e('0x2f')];var _0x834819;if(_0x44a67a>=_0x5f1eec){_0x44a67a=_0x5f1eec;_0x834819=0xc8;}else{_0x834819=0xce;}_0x3b4015[_0x1a6e('0x2b')](_0x834819);return _0x3b4015[_0x1a6e('0x31')](_0x1a6e('0x32'),_0x490c68+'-'+_0x44a67a+'/'+_0x5f1eec)['json'](_0x4bbc80);}return null;};}function patchUpdates(_0x56f23e){return function(_0x38433e){try{jsonpatch['apply'](_0x38433e,_0x56f23e,!![]);}catch(_0x2344d4){return BPromise[_0x1a6e('0x33')](_0x2344d4);}return _0x38433e[_0x1a6e('0x34')]();};}function saveUpdates(_0x364ead,_0x576d9c){return function(_0xf9047){if(_0xf9047){return _0xf9047['update'](_0x364ead)[_0x1a6e('0x1f')](function(_0x3c1d67){return _0x3c1d67;});}return null;};}function removeEntity(_0x1489fe,_0x3f5609){return function(_0x42dcb9){if(_0x42dcb9){return _0x42dcb9[_0x1a6e('0x35')]()['then'](function(){var _0x2a696e=_0x42dcb9[_0x1a6e('0x36')]({'plain':!![]});var _0x461b9d='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x461b9d,'resourceId':_0x2a696e['id']}})[_0x1a6e('0x1f')](function(){return _0x42dcb9;});})['then'](function(){_0x1489fe[_0x1a6e('0x2b')](0xcc)[_0x1a6e('0x2c')]();});}};}function handleEntityNotFound(_0x2d4893,_0xd49a8d){return function(_0x527e22){if(!_0x527e22){_0x2d4893[_0x1a6e('0x2a')](0x194);}return _0x527e22;};}function handleError(_0x116d29,_0x521fb3){_0x521fb3=_0x521fb3||0x1f4;return function(_0x463e35){logger[_0x1a6e('0x26')](_0x463e35[_0x1a6e('0x37')]);if(_0x463e35[_0x1a6e('0x38')]){delete _0x463e35[_0x1a6e('0x38')];}_0x116d29[_0x1a6e('0x2b')](_0x521fb3)[_0x1a6e('0x39')](_0x463e35);};}exports[_0x1a6e('0x3a')]=function(_0x2121b5,_0x2bba01){var _0x40ba1f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5791e9={},_0x2fe15d={'count':0x0,'rows':[]};var _0x515632=_[_0x1a6e('0x3b')](db[_0x1a6e('0x3c')][_0x1a6e('0x3d')],function(_0xf7e9a6){return{'name':_0xf7e9a6[_0x1a6e('0x3e')],'type':_0xf7e9a6['type'][_0x1a6e('0x3f')]};});_0x5791e9[_0x1a6e('0x40')]=_['map'](_0x515632,_0x1a6e('0x38'));_0x5791e9[_0x1a6e('0x41')]=_[_0x1a6e('0x42')](_0x2121b5[_0x1a6e('0x41')]);_0x5791e9[_0x1a6e('0x43')]=_[_0x1a6e('0x44')](_0x5791e9[_0x1a6e('0x40')],_0x5791e9[_0x1a6e('0x41')]);_0x40ba1f[_0x1a6e('0x45')]=_[_0x1a6e('0x44')](_0x5791e9[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x2121b5['query'][_0x1a6e('0x46')]));_0x40ba1f['attributes']=_0x40ba1f[_0x1a6e('0x45')][_0x1a6e('0x47')]?_0x40ba1f['attributes']:_0x5791e9[_0x1a6e('0x40')];if(!_0x2121b5[_0x1a6e('0x41')][_0x1a6e('0x48')](_0x1a6e('0x49'))){_0x40ba1f['limit']=qs['limit'](_0x2121b5[_0x1a6e('0x41')][_0x1a6e('0x2f')]);_0x40ba1f['offset']=qs['offset'](_0x2121b5[_0x1a6e('0x41')][_0x1a6e('0x2d')]);}_0x40ba1f[_0x1a6e('0x4a')]=qs[_0x1a6e('0x4b')](_0x2121b5[_0x1a6e('0x41')]['sort']);_0x40ba1f[_0x1a6e('0x4c')]=qs[_0x1a6e('0x43')](_[_0x1a6e('0x4d')](_0x2121b5['query'],_0x5791e9[_0x1a6e('0x43')]),_0x515632);if(_0x2121b5[_0x1a6e('0x41')]['filter']){_0x40ba1f['where']=_[_0x1a6e('0x4e')](_0x40ba1f[_0x1a6e('0x4c')],{'$or':_[_0x1a6e('0x3b')](_0x515632,function(_0x272255){if(_0x272255[_0x1a6e('0x4f')]!==_0x1a6e('0x50')){var _0x4005de={};_0x4005de[_0x272255['name']]={'$like':'%'+_0x2121b5[_0x1a6e('0x41')][_0x1a6e('0x51')]+'%'};return _0x4005de;}})});}_0x40ba1f=_[_0x1a6e('0x4e')]({},_0x40ba1f,_0x2121b5[_0x1a6e('0x52')]);var _0x1f5bf9={'where':_0x40ba1f[_0x1a6e('0x4c')]};return db[_0x1a6e('0x3c')][_0x1a6e('0x30')](_0x1f5bf9)[_0x1a6e('0x1f')](function(_0x46940c){_0x2fe15d['count']=_0x46940c;if(_0x2121b5[_0x1a6e('0x41')]['includeAll']){_0x40ba1f['include']=[{'all':!![]}];}return db[_0x1a6e('0x3c')][_0x1a6e('0x53')](_0x40ba1f);})[_0x1a6e('0x1f')](function(_0x20bec9){_0x2fe15d[_0x1a6e('0x54')]=_0x20bec9;return _0x2fe15d;})[_0x1a6e('0x1f')](respondWithFilteredResult(_0x2bba01,_0x40ba1f))['catch'](handleError(_0x2bba01,null));};exports[_0x1a6e('0x55')]=function(_0x526201,_0x4efc4c){var _0x48ad8e={'raw':![],'where':{'id':_0x526201[_0x1a6e('0x56')]['id']},'include':[{'model':db[_0x1a6e('0x57')],'as':'mandatoryDispositionPause'}]},_0x351673={};_0x351673[_0x1a6e('0x40')]=_[_0x1a6e('0x42')](db[_0x1a6e('0x3c')][_0x1a6e('0x3d')]);_0x351673[_0x1a6e('0x41')]=_[_0x1a6e('0x42')](_0x526201['query']);_0x351673[_0x1a6e('0x43')]=_[_0x1a6e('0x44')](_0x351673['model'],_0x351673[_0x1a6e('0x41')]);_0x48ad8e[_0x1a6e('0x45')]=_[_0x1a6e('0x44')](_0x351673[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x526201[_0x1a6e('0x41')][_0x1a6e('0x46')]));_0x48ad8e[_0x1a6e('0x45')]=_0x48ad8e[_0x1a6e('0x45')][_0x1a6e('0x47')]?_0x48ad8e[_0x1a6e('0x45')]:_0x351673[_0x1a6e('0x40')];if(_0x526201[_0x1a6e('0x41')][_0x1a6e('0x58')]){_0x48ad8e['include']=[{'all':!![]}];}_0x48ad8e=_[_0x1a6e('0x4e')]({},_0x48ad8e,_0x526201['options']);return db[_0x1a6e('0x3c')][_0x1a6e('0x59')](_0x48ad8e)[_0x1a6e('0x1f')](handleEntityNotFound(_0x4efc4c,null))[_0x1a6e('0x1f')](respondWithResult(_0x4efc4c,null))[_0x1a6e('0x5a')](handleError(_0x4efc4c,null));};exports[_0x1a6e('0x5b')]=function(_0x13cbe1,_0x533792){return db[_0x1a6e('0x3c')][_0x1a6e('0x5b')](_0x13cbe1[_0x1a6e('0x5c')],{})[_0x1a6e('0x1f')](function(_0x26c72a){var _0x3ccdb1=_0x13cbe1[_0x1a6e('0x5d')][_0x1a6e('0x36')]({'plain':!![]});if(!_0x3ccdb1)throw new Error(_0x1a6e('0x5e'));if(_0x3ccdb1[_0x1a6e('0x5f')]===_0x1a6e('0x5d')){var _0x19184e=_0x26c72a[_0x1a6e('0x36')]({'plain':!![]});var _0x51b2cf=_0x1a6e('0x60');return db[_0x1a6e('0x61')]['find']({'where':{'name':_0x51b2cf,'userProfileId':_0x3ccdb1[_0x1a6e('0x62')]},'raw':!![]})[_0x1a6e('0x1f')](function(_0x4ae802){if(_0x4ae802&&_0x4ae802[_0x1a6e('0x63')]===0x0){return db['UserProfileResource'][_0x1a6e('0x5b')]({'name':_0x19184e[_0x1a6e('0x38')],'resourceId':_0x19184e['id'],'type':_0x4ae802[_0x1a6e('0x38')],'sectionId':_0x4ae802['id']},{})['then'](function(){return _0x26c72a;});}else{return _0x26c72a;}})[_0x1a6e('0x5a')](function(_0xd0982e){logger[_0x1a6e('0x26')](_0x1a6e('0x64'),_0xd0982e);throw _0xd0982e;});}return _0x26c72a;})['then'](respondWithResult(_0x533792,0xc9))[_0x1a6e('0x5a')](handleError(_0x533792,null));};exports['update']=function(_0x3e18e2,_0x57abc7){if(_0x3e18e2[_0x1a6e('0x5c')]['id']){delete _0x3e18e2[_0x1a6e('0x5c')]['id'];}return db[_0x1a6e('0x3c')][_0x1a6e('0x59')]({'where':{'id':_0x3e18e2[_0x1a6e('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x1a6e('0x65')}]})[_0x1a6e('0x1f')](handleEntityNotFound(_0x57abc7,null))[_0x1a6e('0x1f')](saveUpdates(_0x3e18e2[_0x1a6e('0x5c')],null))[_0x1a6e('0x1f')](respondWithResult(_0x57abc7,null))['catch'](handleError(_0x57abc7,null));};exports['destroy']=function(_0x59a4e3,_0x360490){return db[_0x1a6e('0x3c')]['find']({'where':{'id':_0x59a4e3[_0x1a6e('0x56')]['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x360490,null))[_0x1a6e('0x1f')](removeEntity(_0x360490,null))[_0x1a6e('0x5a')](handleError(_0x360490,null));};exports[_0x1a6e('0x66')]=function(_0x4434e6,_0x2fe5a7){return db[_0x1a6e('0x3c')][_0x1a6e('0x66')]()[_0x1a6e('0x1f')](respondWithResult(_0x2fe5a7,null))[_0x1a6e('0x5a')](handleError(_0x2fe5a7,null));};exports['addDisposition']=function(_0x1e7dfd,_0x183687,_0x298873){if(_0x1e7dfd['body']['id']){delete _0x1e7dfd['body']['id'];}return db[_0x1a6e('0x3c')]['find']({'where':{'id':_0x1e7dfd[_0x1a6e('0x56')]['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x183687,null))[_0x1a6e('0x1f')](function(_0x1b0a8e){if(_0x1b0a8e){_0x1e7dfd[_0x1a6e('0x5c')][_0x1a6e('0x67')]=_0x1b0a8e['id'];return db[_0x1a6e('0x68')][_0x1a6e('0x5b')](_0x1e7dfd[_0x1a6e('0x5c')]);}})['then'](respondWithResult(_0x183687,null))[_0x1a6e('0x5a')](handleError(_0x183687,null));};exports[_0x1a6e('0x69')]=function(_0x450fa5,_0x538d85,_0xc3821d){var _0x4723ea={'raw':![],'where':{}};var _0xa78df2={};var _0x1b018c={'count':0x0,'rows':[]};return db[_0x1a6e('0x3c')][_0x1a6e('0x6a')]({'where':{'id':_0x450fa5[_0x1a6e('0x56')]['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x538d85,null))[_0x1a6e('0x1f')](function(_0xb82fdd){if(_0xb82fdd){_0xa78df2[_0x1a6e('0x40')]=_[_0x1a6e('0x42')](db[_0x1a6e('0x68')][_0x1a6e('0x3d')]);_0xa78df2['query']=_[_0x1a6e('0x42')](_0x450fa5[_0x1a6e('0x41')]);_0xa78df2[_0x1a6e('0x43')]=_[_0x1a6e('0x44')](_0xa78df2[_0x1a6e('0x40')],_0xa78df2[_0x1a6e('0x41')]);_0x4723ea[_0x1a6e('0x45')]=_[_0x1a6e('0x44')](_0xa78df2[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x450fa5['query'][_0x1a6e('0x46')]));_0x4723ea[_0x1a6e('0x45')]=_0x4723ea[_0x1a6e('0x45')][_0x1a6e('0x47')]?_0x4723ea[_0x1a6e('0x45')]:_0xa78df2[_0x1a6e('0x40')];if(!_0x450fa5[_0x1a6e('0x41')][_0x1a6e('0x48')](_0x1a6e('0x49'))){_0x4723ea[_0x1a6e('0x2f')]=qs[_0x1a6e('0x2f')](_0x450fa5['query'][_0x1a6e('0x2f')]);_0x4723ea['offset']=qs[_0x1a6e('0x2d')](_0x450fa5[_0x1a6e('0x41')][_0x1a6e('0x2d')]);}_0x4723ea[_0x1a6e('0x4a')]=qs[_0x1a6e('0x4b')](_0x450fa5['query'][_0x1a6e('0x4b')]);_0x4723ea[_0x1a6e('0x4c')]=qs['filters'](_['pick'](_0x450fa5['query'],_0xa78df2[_0x1a6e('0x43')]));_0x4723ea['where'][_0x1a6e('0x67')]=_0xb82fdd['id'];if(_0x450fa5['query']['filter']){_0x4723ea[_0x1a6e('0x4c')]=_[_0x1a6e('0x4e')](_0x4723ea[_0x1a6e('0x4c')],{'$or':_[_0x1a6e('0x3b')](_0x4723ea[_0x1a6e('0x45')],function(_0x4f7c10){var _0x4e7ff7={};_0x4e7ff7[_0x4f7c10]={'$like':'%'+_0x450fa5[_0x1a6e('0x41')][_0x1a6e('0x51')]+'%'};return _0x4e7ff7;})});}_0x4723ea=_[_0x1a6e('0x4e')]({},_0x4723ea,_0x450fa5[_0x1a6e('0x52')]);return db['Disposition'][_0x1a6e('0x30')]({'where':_0x4723ea[_0x1a6e('0x4c')]})[_0x1a6e('0x1f')](function(_0xba35c5){_0x1b018c['count']=_0xba35c5;if(_0x450fa5['query'][_0x1a6e('0x58')]){_0x4723ea[_0x1a6e('0x6b')]=[{'all':!![]}];}return db[_0x1a6e('0x68')][_0x1a6e('0x53')](_0x4723ea);})[_0x1a6e('0x1f')](function(_0x408678){_0x1b018c[_0x1a6e('0x54')]=_0x408678;return _0x1b018c;});}})[_0x1a6e('0x1f')](respondWithFilteredResult(_0x538d85,_0x4723ea))[_0x1a6e('0x5a')](handleError(_0x538d85,null));};exports[_0x1a6e('0x6c')]=function(_0x32317d,_0x159903,_0x24d63f){return db['FaxAccount'][_0x1a6e('0x59')]({'where':{'id':_0x32317d['params']['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x159903,null))['then'](function(_0x3d0c91){if(_0x3d0c91){return _0x3d0c91[_0x1a6e('0x6c')](_0x32317d[_0x1a6e('0x41')][_0x1a6e('0x6d')]);}})[_0x1a6e('0x1f')](respondWithStatusCode(_0x159903,null))[_0x1a6e('0x5a')](handleError(_0x159903,null));};exports[_0x1a6e('0x6e')]=function(_0x4366c4,_0x32dc08,_0x4b3f6f){if(_0x4366c4['body']['id']){delete _0x4366c4['body']['id'];}return db[_0x1a6e('0x3c')]['find']({'where':{'id':_0x4366c4[_0x1a6e('0x56')]['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x32dc08,null))[_0x1a6e('0x1f')](function(_0x510309){if(_0x510309){_0x4366c4[_0x1a6e('0x5c')]['FaxAccountId']=_0x510309['id'];return db['CannedAnswer']['create'](_0x4366c4['body']);}})[_0x1a6e('0x1f')](respondWithResult(_0x32dc08,null))[_0x1a6e('0x5a')](handleError(_0x32dc08,null));};exports['getAnswers']=function(_0x1c30da,_0x122009,_0x590596){var _0x4f0cad={'raw':![],'where':{}};var _0x1fe506={};var _0x1729f5={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1a6e('0x6a')]({'where':{'id':_0x1c30da[_0x1a6e('0x56')]['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x122009,null))[_0x1a6e('0x1f')](function(_0x325c65){if(_0x325c65){_0x1fe506[_0x1a6e('0x40')]=_['keys'](db['CannedAnswer'][_0x1a6e('0x3d')]);_0x1fe506['query']=_[_0x1a6e('0x42')](_0x1c30da[_0x1a6e('0x41')]);_0x1fe506[_0x1a6e('0x43')]=_[_0x1a6e('0x44')](_0x1fe506[_0x1a6e('0x40')],_0x1fe506[_0x1a6e('0x41')]);_0x4f0cad[_0x1a6e('0x45')]=_['intersection'](_0x1fe506[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x1c30da[_0x1a6e('0x41')]['fields']));_0x4f0cad[_0x1a6e('0x45')]=_0x4f0cad[_0x1a6e('0x45')][_0x1a6e('0x47')]?_0x4f0cad[_0x1a6e('0x45')]:_0x1fe506['model'];if(!_0x1c30da[_0x1a6e('0x41')][_0x1a6e('0x48')]('nolimit')){_0x4f0cad[_0x1a6e('0x2f')]=qs[_0x1a6e('0x2f')](_0x1c30da['query'][_0x1a6e('0x2f')]);_0x4f0cad[_0x1a6e('0x2d')]=qs[_0x1a6e('0x2d')](_0x1c30da['query']['offset']);}_0x4f0cad[_0x1a6e('0x4a')]=qs[_0x1a6e('0x4b')](_0x1c30da[_0x1a6e('0x41')][_0x1a6e('0x4b')]);_0x4f0cad['where']=qs[_0x1a6e('0x43')](_['pick'](_0x1c30da[_0x1a6e('0x41')],_0x1fe506[_0x1a6e('0x43')]));_0x4f0cad[_0x1a6e('0x4c')][_0x1a6e('0x67')]=_0x325c65['id'];if(_0x1c30da[_0x1a6e('0x41')][_0x1a6e('0x51')]){_0x4f0cad[_0x1a6e('0x4c')]=_[_0x1a6e('0x4e')](_0x4f0cad[_0x1a6e('0x4c')],{'$or':_[_0x1a6e('0x3b')](_0x4f0cad[_0x1a6e('0x45')],function(_0x2d930e){var _0x4943c4={};_0x4943c4[_0x2d930e]={'$like':'%'+_0x1c30da[_0x1a6e('0x41')][_0x1a6e('0x51')]+'%'};return _0x4943c4;})});}_0x4f0cad=_[_0x1a6e('0x4e')]({},_0x4f0cad,_0x1c30da['options']);return db['CannedAnswer'][_0x1a6e('0x30')]({'where':_0x4f0cad[_0x1a6e('0x4c')]})[_0x1a6e('0x1f')](function(_0x5a4d51){_0x1729f5[_0x1a6e('0x30')]=_0x5a4d51;if(_0x1c30da[_0x1a6e('0x41')][_0x1a6e('0x58')]){_0x4f0cad[_0x1a6e('0x6b')]=[{'all':!![]}];}return db[_0x1a6e('0x6f')][_0x1a6e('0x53')](_0x4f0cad);})['then'](function(_0x4ede3f){_0x1729f5['rows']=_0x4ede3f;return _0x1729f5;});}})['then'](respondWithFilteredResult(_0x122009,_0x4f0cad))[_0x1a6e('0x5a')](handleError(_0x122009,null));};exports[_0x1a6e('0x70')]=function(_0x420365,_0x324bf8,_0x14bf1e){return db[_0x1a6e('0x3c')][_0x1a6e('0x59')]({'where':{'id':_0x420365['params']['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x324bf8,null))[_0x1a6e('0x1f')](function(_0x2b38cb){if(_0x2b38cb){return _0x2b38cb['removeAnswers'](_0x420365[_0x1a6e('0x41')][_0x1a6e('0x6d')]);}})[_0x1a6e('0x1f')](respondWithStatusCode(_0x324bf8,null))['catch'](handleError(_0x324bf8,null));};exports[_0x1a6e('0x71')]=function(_0x4c6647,_0x35660c,_0xa64349){return db['FaxInteraction']['find']({'where':{'id':_0x4c6647[_0x1a6e('0x56')]['id']}})['then'](handleEntityNotFound(_0x35660c,null))[_0x1a6e('0x1f')](function(_0xb87016){if(_0xb87016){return _0xb87016['addInteraction'](_0x4c6647[_0x1a6e('0x5c')][_0x1a6e('0x6d')],_['omit'](_0x4c6647[_0x1a6e('0x5c')],[_0x1a6e('0x6d'),'id'])||{});}})[_0x1a6e('0x1f')](respondWithResult(_0x35660c,null))[_0x1a6e('0x5a')](handleError(_0x35660c,null));};exports[_0x1a6e('0x72')]=function(_0x2014ab,_0x459978,_0x9ee508){var _0x382f60={'raw':![],'where':{}};var _0x50973c={};var _0x1d55fd={'count':0x0,'rows':[]};return db[_0x1a6e('0x3c')][_0x1a6e('0x6a')]({'where':{'id':_0x2014ab[_0x1a6e('0x56')]['id']}})['then'](handleEntityNotFound(_0x459978,null))[_0x1a6e('0x1f')](function(_0x13c62e){if(_0x13c62e){_0x50973c[_0x1a6e('0x40')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x50973c[_0x1a6e('0x41')]=_[_0x1a6e('0x42')](_0x2014ab[_0x1a6e('0x41')]);_0x50973c[_0x1a6e('0x43')]=_['intersection'](_0x50973c[_0x1a6e('0x40')],_0x50973c[_0x1a6e('0x41')]);_0x382f60[_0x1a6e('0x45')]=_['intersection'](_0x50973c[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x46')]));_0x382f60[_0x1a6e('0x45')]=_0x382f60['attributes']['length']?_0x382f60['attributes']:_0x50973c[_0x1a6e('0x40')];if(!_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x48')](_0x1a6e('0x49'))){_0x382f60[_0x1a6e('0x2f')]=qs[_0x1a6e('0x2f')](_0x2014ab['query']['limit']);_0x382f60[_0x1a6e('0x2d')]=qs[_0x1a6e('0x2d')](_0x2014ab[_0x1a6e('0x41')]['offset']);}_0x382f60[_0x1a6e('0x4a')]=qs[_0x1a6e('0x4b')](_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x4b')]);_0x382f60['where']=qs[_0x1a6e('0x43')](_[_0x1a6e('0x4d')](_0x2014ab[_0x1a6e('0x41')],_0x50973c[_0x1a6e('0x43')]));_0x382f60[_0x1a6e('0x4c')][_0x1a6e('0x67')]=_0x13c62e['id'];if(_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x51')]){_0x382f60['where']=_[_0x1a6e('0x4e')](_0x382f60[_0x1a6e('0x4c')],{'$or':_[_0x1a6e('0x3b')](_0x382f60[_0x1a6e('0x45')],function(_0x3b5894){var _0x57925c={};_0x57925c[_0x3b5894]={'$like':'%'+_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x51')]+'%'};return _0x57925c;})});}_0x382f60=_[_0x1a6e('0x4e')]({},_0x382f60,_0x2014ab[_0x1a6e('0x52')]);return db[_0x1a6e('0x73')][_0x1a6e('0x30')]({'where':_0x382f60[_0x1a6e('0x4c')]})[_0x1a6e('0x1f')](function(_0x22ccd4){_0x1d55fd[_0x1a6e('0x30')]=_0x22ccd4;if(_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x58')]){_0x382f60[_0x1a6e('0x6b')]=[{'model':db[_0x1a6e('0x74')],'as':_0x1a6e('0x75'),'required':![]},{'model':db[_0x1a6e('0x76')],'as':_0x1a6e('0x77'),'attributes':[_0x1a6e('0x38'),_0x1a6e('0x78'),_0x1a6e('0x79')],'required':![]},{'model':db[_0x1a6e('0x7a')],'as':_0x1a6e('0x7b'),'attributes':['id',_0x1a6e('0x38'),_0x1a6e('0x7c')],'where':_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x7d')]?{'id':_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x7d')]}:undefined,'required':_0x2014ab[_0x1a6e('0x41')][_0x1a6e('0x7d')]?!![]:![]}];}return db[_0x1a6e('0x73')][_0x1a6e('0x53')](_0x382f60);})['then'](function(_0x3aa47c){_0x1d55fd[_0x1a6e('0x54')]=_0x3aa47c;return _0x1d55fd;});}})[_0x1a6e('0x1f')](respondWithFilteredResult(_0x459978,_0x382f60))['catch'](handleError(_0x459978,null));};exports[_0x1a6e('0x7e')]=function(_0x20b8e0,_0x577743){var _0x1fcf69=_0x20b8e0[_0x1a6e('0x56')]['id'];var _0x23b8f5=_0x20b8e0['body'];var _0x45e22d=0xc8;var _0x31d448=null;return db[_0x1a6e('0x7f')][_0x1a6e('0x80')]({'isolationLevel':db[_0x1a6e('0x7f')][_0x1a6e('0x81')][_0x1a6e('0x82')][_0x1a6e('0x83')]},function(_0x5b67aa){return db[_0x1a6e('0x3c')][_0x1a6e('0x6a')]({'where':{'id':_0x1fcf69},'transaction':_0x5b67aa})[_0x1a6e('0x1f')](function(_0x5020e0){if(_0x5020e0){return db[_0x1a6e('0x84')][_0x1a6e('0x35')]({'where':{'FaxAccountId':_0x1fcf69},'transaction':_0x5b67aa})[_0x1a6e('0x1f')](function(){var _0x3c68d4=_[_0x1a6e('0x3b')](_0x23b8f5,function(_0x4a3bc0){_0x4a3bc0[_0x1a6e('0x67')]=_0x1fcf69;return _0x4a3bc0;});return db[_0x1a6e('0x84')][_0x1a6e('0x85')](_0x3c68d4,{'transaction':_0x5b67aa});});}else{_0x45e22d=0x194;_0x31d448=[];}});})[_0x1a6e('0x1f')](function(){if(_0x45e22d!==0x194){return db[_0x1a6e('0x84')]['findAndCountAll']({'where':{'FaxAccountId':_0x1fcf69},'order':_0x1a6e('0x86')})[_0x1a6e('0x1f')](function(_0x3b7c32){_0x31d448=_0x3b7c32;});}})[_0x1a6e('0x5a')](function(_0x49ea49){_0x45e22d=0x1f4;logger['error'](_0x49ea49[_0x1a6e('0x37')]);if(_0x49ea49['name']){delete _0x49ea49[_0x1a6e('0x38')];}_0x31d448=_0x49ea49;})['finally'](function(){if(_0x31d448===null){_0x577743['sendStatus'](_0x45e22d);}else{if(_0x45e22d===0x1f4){_0x577743['status'](_0x45e22d)[_0x1a6e('0x39')](_0x31d448);}else{_0x577743[_0x1a6e('0x2b')](_0x45e22d)[_0x1a6e('0x87')](_0x31d448);}}});};exports['getApplications']=function(_0x40fa9d,_0x12a65b,_0x1676ff){var _0x38b2f4={};var _0x1472d9={};var _0x74b659;var _0x2ba886;return db[_0x1a6e('0x3c')]['findOne']({'where':{'id':_0x40fa9d['params']['id']}})['then'](handleEntityNotFound(_0x12a65b,null))['then'](function(_0x1f6470){if(_0x1f6470){_0x74b659=_0x1f6470;_0x1472d9[_0x1a6e('0x40')]=_[_0x1a6e('0x42')](db[_0x1a6e('0x84')][_0x1a6e('0x3d')]);_0x1472d9[_0x1a6e('0x41')]=_[_0x1a6e('0x42')](_0x40fa9d['query']);_0x1472d9['filters']=_[_0x1a6e('0x44')](_0x1472d9[_0x1a6e('0x40')],_0x1472d9['query']);_0x38b2f4[_0x1a6e('0x45')]=_[_0x1a6e('0x44')](_0x1472d9[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x40fa9d['query'][_0x1a6e('0x46')]));_0x38b2f4[_0x1a6e('0x45')]=_0x38b2f4['attributes']['length']?_0x38b2f4[_0x1a6e('0x45')]:_0x1472d9[_0x1a6e('0x40')];_0x38b2f4['order']=qs[_0x1a6e('0x4b')](_0x40fa9d[_0x1a6e('0x41')][_0x1a6e('0x4b')]);_0x38b2f4[_0x1a6e('0x4c')]=qs[_0x1a6e('0x43')](_['pick'](_0x40fa9d[_0x1a6e('0x41')],_0x1472d9['filters']));if(_0x40fa9d['query'][_0x1a6e('0x51')]){_0x38b2f4[_0x1a6e('0x4c')]=_[_0x1a6e('0x4e')](_0x38b2f4[_0x1a6e('0x4c')],{'$or':_['map'](_0x38b2f4[_0x1a6e('0x45')],function(_0x17cea4){var _0x3bf61a={};_0x3bf61a[_0x17cea4]={'$like':'%'+_0x40fa9d[_0x1a6e('0x41')]['filter']+'%'};return _0x3bf61a;})});}_0x38b2f4=_['merge']({},_0x38b2f4,_0x40fa9d['options']);return _0x74b659[_0x1a6e('0x88')](_0x38b2f4);}})[_0x1a6e('0x1f')](function(_0x3e5934){if(_0x3e5934){_0x2ba886=_0x3e5934[_0x1a6e('0x47')];if(!_0x40fa9d['query']['hasOwnProperty'](_0x1a6e('0x49'))){_0x38b2f4[_0x1a6e('0x2f')]=qs[_0x1a6e('0x2f')](_0x40fa9d['query']['limit']);_0x38b2f4['offset']=qs['offset'](_0x40fa9d[_0x1a6e('0x41')][_0x1a6e('0x2d')]);}return _0x74b659[_0x1a6e('0x88')](_0x38b2f4);}})[_0x1a6e('0x1f')](function(_0x4e3be7){if(_0x4e3be7){return _0x4e3be7?{'count':_0x2ba886,'rows':_0x4e3be7}:null;}})[_0x1a6e('0x1f')](respondWithResult(_0x12a65b,null))['catch'](handleError(_0x12a65b,null));};function Extension(_0x1e7446,_0x26fdb5,_0x116a91,_0x30e700){this[_0x1a6e('0x89')]='from-voip-provider';this[_0x1a6e('0x8a')]=_0x1e7446[_0x1a6e('0x8b')];this['app']=_0x30e700;this['type']='system';this[_0x1a6e('0x8c')]=_0x1a6e('0x8d');this[_0x1a6e('0x67')]=_0x1e7446['id'];this[_0x1a6e('0x86')]=_0x26fdb5;this[_0x1a6e('0x8e')]=_0x116a91;}function createExtensionsReciveFax(_0x46b0b1){var _0x1cac65=0x1;var _0x22c2e5=[];_0x22c2e5[_0x1a6e('0x8f')](new Extension(_0x46b0b1,_0x1cac65,'',_0x1a6e('0x90')));_0x1cac65+=0x1;_0x22c2e5[_0x1a6e('0x8f')](new Extension(_0x46b0b1,_0x1cac65,_0x1a6e('0x91'),_0x1a6e('0x92')));_0x1cac65+=0x1;for(var _0x4142a3 in _0x46b0b1){if(_0x46b0b1[_0x1a6e('0x48')](_0x4142a3)&&(_0x4142a3==='ecm'||_0x4142a3==='localstationid'||_0x4142a3==='gateway'||_0x4142a3===_0x1a6e('0x93')||_0x4142a3===_0x1a6e('0x94')||_0x4142a3==='maxrate'||_0x4142a3===_0x1a6e('0x95')||_0x4142a3===_0x1a6e('0x96')||_0x4142a3==='t38timeout')){_0x22c2e5[_0x1a6e('0x8f')](new Extension(_0x46b0b1,_0x1cac65,_0x1a6e('0x97')+_0x4142a3+')='+_0x46b0b1[_0x4142a3],_0x1a6e('0x92')));_0x1cac65+=0x1;}}_0x22c2e5[_0x1a6e('0x8f')](new Extension(_0x46b0b1,_0x1cac65,'6',_0x1a6e('0x98')));_0x1cac65+=0x1;_0x22c2e5[_0x1a6e('0x8f')](new Extension(_0x46b0b1,_0x1cac65,_0x1a6e('0x99'),'ReceiveFax'));_0x1cac65=0x0;return _0x22c2e5;}exports['addAccountApplications']=function(_0x3226ac,_0x50998,_0x25ae36){var _0x33da55;return db[_0x1a6e('0x7f')]['transaction'](function(_0x5fe074){return db[_0x1a6e('0x3c')]['create'](_0x3226ac[_0x1a6e('0x5c')],{'transaction':_0x5fe074})[_0x1a6e('0x1f')](function(_0x52c197){_0x33da55=_0x52c197[_0x1a6e('0x36')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x33da55),{'transaction':_0x5fe074});});})[_0x1a6e('0x1f')](function(){return _0x33da55;})[_0x1a6e('0x1f')](respondWithResult(_0x50998,null))[_0x1a6e('0x5a')](handleError(_0x50998,null));};exports[_0x1a6e('0x9a')]=function(_0x413663,_0x40d3b1,_0x25779b){var _0x10cd4d;return db[_0x1a6e('0x7f')][_0x1a6e('0x80')](function(_0x36f026){return db[_0x1a6e('0x3c')][_0x1a6e('0x9b')](_0x413663[_0x1a6e('0x5c')],{'where':{'id':_0x413663['body']['id']},'transaction':_0x36f026})[_0x1a6e('0x1f')](function(_0x1138ee){return db[_0x1a6e('0x9c')][_0x1a6e('0x35')]({'where':{'FaxAccountId':_0x413663[_0x1a6e('0x5c')]['id']},'transaction':_0x36f026})[_0x1a6e('0x1f')](function(_0x49c523){return db[_0x1a6e('0x9c')][_0x1a6e('0x85')](createExtensionsReciveFax(_['omit'](_0x413663['body'],[_0x1a6e('0x9d'),'key',_0x1a6e('0x9e'),'updatedAt','TrunkId',_0x1a6e('0x9f')])),{'transaction':_0x36f026});});});})[_0x1a6e('0x1f')](function(){return db[_0x1a6e('0x3c')]['findById'](_0x413663[_0x1a6e('0x5c')]['id']);})[_0x1a6e('0x1f')](respondWithResult(_0x40d3b1,null))[_0x1a6e('0x5a')](handleError(_0x40d3b1,null));};exports[_0x1a6e('0xa0')]=function(_0x71be75,_0x558d61,_0x223391){var _0x2f42cc={'raw':!![],'where':{}};var _0x112e7f={};var _0x4b6363={'count':0x0,'rows':[]};return db[_0x1a6e('0x3c')][_0x1a6e('0x6a')]({'where':{'id':_0x71be75[_0x1a6e('0x56')]['id']}})['then'](handleEntityNotFound(_0x558d61,null))[_0x1a6e('0x1f')](function(_0x4bb40c){if(_0x4bb40c){_0x112e7f[_0x1a6e('0x40')]=_[_0x1a6e('0x42')](db[_0x1a6e('0xa1')]['rawAttributes']);_0x112e7f[_0x1a6e('0x41')]=_[_0x1a6e('0x42')](_0x71be75['query']);_0x112e7f[_0x1a6e('0x43')]=_[_0x1a6e('0x44')](_0x112e7f[_0x1a6e('0x40')],_0x112e7f[_0x1a6e('0x41')]);_0x2f42cc[_0x1a6e('0x45')]=_[_0x1a6e('0x44')](_0x112e7f[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x71be75[_0x1a6e('0x41')][_0x1a6e('0x46')]));_0x2f42cc['attributes']=_0x2f42cc['attributes'][_0x1a6e('0x47')]?_0x2f42cc['attributes']:_0x112e7f[_0x1a6e('0x40')];if(!_0x71be75[_0x1a6e('0x41')][_0x1a6e('0x48')]('nolimit')){_0x2f42cc[_0x1a6e('0x2f')]=qs[_0x1a6e('0x2f')](_0x71be75[_0x1a6e('0x41')][_0x1a6e('0x2f')]);_0x2f42cc[_0x1a6e('0x2d')]=qs[_0x1a6e('0x2d')](_0x71be75['query'][_0x1a6e('0x2d')]);}_0x2f42cc[_0x1a6e('0x4a')]=qs[_0x1a6e('0x4b')](_0x71be75[_0x1a6e('0x41')][_0x1a6e('0x4b')]);_0x2f42cc[_0x1a6e('0x4c')]=qs[_0x1a6e('0x43')](_['pick'](_0x71be75[_0x1a6e('0x41')],_0x112e7f[_0x1a6e('0x43')]));_0x2f42cc[_0x1a6e('0x4c')][_0x1a6e('0x67')]=_0x4bb40c['id'];if(_0x71be75['query'][_0x1a6e('0x51')]){_0x2f42cc[_0x1a6e('0x4c')]=_[_0x1a6e('0x4e')](_0x2f42cc[_0x1a6e('0x4c')],{'$or':_['map'](_0x2f42cc[_0x1a6e('0x45')],function(_0x4aa4d6){var _0xdb37d={};_0xdb37d[_0x4aa4d6]={'$like':'%'+_0x71be75[_0x1a6e('0x41')]['filter']+'%'};return _0xdb37d;})});}if(_0x71be75['query'][_0x1a6e('0xa2')]){var _0x42537f=_0x71be75[_0x1a6e('0x41')][_0x1a6e('0xa2')][_0x1a6e('0xa3')](',');var _0x3af10a={};_0x3af10a[_0x42537f[0x0]]={'$gte':moment(_0x42537f[0x1])[_0x1a6e('0xa4')](_0x1a6e('0xa5'))};_0x2f42cc['where']=_[_0x1a6e('0x4e')](_0x2f42cc[_0x1a6e('0x4c')],_0x3af10a);}_0x2f42cc=_['merge']({},_0x2f42cc,_0x71be75[_0x1a6e('0x52')]);return db[_0x1a6e('0xa1')][_0x1a6e('0x30')]({'where':_0x2f42cc[_0x1a6e('0x4c')]})[_0x1a6e('0x1f')](function(_0x32d157){_0x4b6363[_0x1a6e('0x30')]=_0x32d157;if(_0x71be75[_0x1a6e('0x41')][_0x1a6e('0x58')]){_0x2f42cc[_0x1a6e('0x6b')]=[{'all':!![]}];}return db[_0x1a6e('0xa1')][_0x1a6e('0x53')](_0x2f42cc);})[_0x1a6e('0x1f')](function(_0x224f07){_0x4b6363[_0x1a6e('0x54')]=_0x224f07;return _0x4b6363;});}})[_0x1a6e('0x1f')](respondWithFilteredResult(_0x558d61,_0x2f42cc))[_0x1a6e('0x5a')](handleError(_0x558d61,null));};exports[_0x1a6e('0x39')]=function(_0xeb4216,_0x56f83c,_0x3021c8){var _0x26eb3e,_0x2bbb79={},_0x1fb694;if(_0xeb4216[_0x1a6e('0x5c')]['to']){_0x1fb694=_0xeb4216[_0x1a6e('0x5c')]['to'][0x0];}return db[_0x1a6e('0x3c')][_0x1a6e('0x59')]({'where':{'id':_0xeb4216[_0x1a6e('0x56')]['id']},'include':[{'model':db[_0x1a6e('0xa6')],'as':_0x1a6e('0xa7'),'include':[{'model':db[_0x1a6e('0x74')],'as':_0x1a6e('0xa8'),'where':{'fax':_0x1fb694},'limit':0x1,'order':[['updatedAt',_0x1a6e('0xa9')]]}]}]})[_0x1a6e('0x1f')](handleEntityNotFound(_0x56f83c,null))[_0x1a6e('0x1f')](function(_0x255764){_0x26eb3e=_0x255764;if(_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xaa')]&&_0xeb4216['body'][_0x1a6e('0xaa')][_0x1a6e('0x47')]){for(var _0x4c8c3c=0x0;_0x4c8c3c<_0xeb4216['body'][_0x1a6e('0xaa')][_0x1a6e('0x47')];_0x4c8c3c+=0x1){_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xaa')][_0x4c8c3c]={'filename':_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xaa')][_0x4c8c3c]['name'],'id':_0xeb4216[_0x1a6e('0x5c')]['attachments'][_0x4c8c3c]['id'],'path':path['join'](config[_0x1a6e('0xab')],_0x1a6e('0xac'),_0xeb4216[_0x1a6e('0x5c')]['attachments'][_0x4c8c3c][_0x1a6e('0xad')])};}}return respondWithRpcPromise(_0x1a6e('0xae'),'CheckAfterSend',{'FaxAccountId':_[_0x1a6e('0xaf')](_0xeb4216[_0x1a6e('0x56')]['id'])?undefined:_0xeb4216[_0x1a6e('0x56')]['id'],'path':_[_0x1a6e('0xaf')](_0xeb4216[_0x1a6e('0x5c')]['attachments'][0x0][_0x1a6e('0xb0')])?undefined:_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xaa')][0x0][_0x1a6e('0xb0')],'fax':_[_0x1a6e('0xaf')](_0xeb4216[_0x1a6e('0x5c')]['to'][0x0])?undefined:_0xeb4216['body']['to'][0x0]},client9002);})[_0x1a6e('0x1f')](function(){if(_0x26eb3e){if(_['isNil'](_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xb1')])){_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xb1')]=util[_0x1a6e('0xa4')](_0x1a6e('0xb2'),_0x26eb3e[_0x1a6e('0x38')],_0x26eb3e[_0x1a6e('0xb3')]);}if(_0x26eb3e['List']){if(_0x26eb3e[_0x1a6e('0xa7')][_0x1a6e('0xa8')][_0x1a6e('0x47')]){return _0x26eb3e['List'][_0x1a6e('0xa8')][0x0];}else{return db[_0x1a6e('0x74')][_0x1a6e('0x5b')](_[_0x1a6e('0x17')](_0xeb4216['body'],{'firstName':_0xeb4216['body']['to'][0x0],'phone':_0xeb4216[_0x1a6e('0x5c')]['to'][0x0],'fax':_0xeb4216['body']['to'][0x0],'ListId':_0x26eb3e[_0x1a6e('0x9f')]}));}}else{throw new Error(_0x1a6e('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1a6e('0x1f')](function(_0x8571f7){if(_0x8571f7){return db[_0x1a6e('0x73')][_0x1a6e('0x59')]({'where':{'ContactId':_0x8571f7['id'],'closed':![],'FaxAccountId':_0x26eb3e['id']}})['then'](function(_0x4b77f2){if(_0x4b77f2){return[_0x4b77f2,![]];}return db[_0x1a6e('0x73')][_0x1a6e('0x5b')]({'UserId':_0xeb4216[_0x1a6e('0x5d')]['id'],'ContactId':_0x8571f7['id'],'FaxAccountId':_0x26eb3e['id'],'fax':_0xeb4216[_0x1a6e('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x1a6e('0x4e')](_0xeb4216['body'],{'read':![],'body':_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xaa')][0x0]['filename'],'FaxAccountId':_0x26eb3e['id'],'UserId':_0xeb4216['user']['id'],'ContactId':_0x8571f7['id'],'AttachmentId':_0xeb4216['body'][_0x1a6e('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1a6e('0xb5')}]})['then'](function(_0x546fef){return[_0x546fef,!![]];});});}else{throw new Error(_0x1a6e('0xb6'));}})[_0x1a6e('0xb7')](function(_0x9a1f06,_0x2fec2e){if(_0x2fec2e){return _0x9a1f06;}return db[_0x1a6e('0xa1')][_0x1a6e('0x5b')]({'direction':_0x1a6e('0xb8'),'read':![],'body':_0xeb4216[_0x1a6e('0x5c')]['attachments'][0x0][_0x1a6e('0xb9')],'FaxAccountId':_0x26eb3e['id'],'FaxInteractionId':_0x9a1f06['id'],'UserId':_0xeb4216['user']['id'],'ContactId':_0x9a1f06[_0x1a6e('0xba')],'AttachmentId':_0xeb4216[_0x1a6e('0x5c')]['attachments'][0x0]['id']})['then'](function(_0x3c7e12){_0x9a1f06[_0x1a6e('0xbb')][_0x1a6e('0xb5')]=[];_0x9a1f06[_0x1a6e('0xbb')][_0x1a6e('0xb5')][_0x1a6e('0x8f')](_0x3c7e12['dataValues']);return _0x9a1f06;});})[_0x1a6e('0x1f')](function(_0x5f9d43){respondWithRpcPromise(_0x1a6e('0xbc'),_0x1a6e('0xbc'),{'FaxAccountId':_[_0x1a6e('0xaf')](_0xeb4216[_0x1a6e('0x56')]['id'])?undefined:_0xeb4216[_0x1a6e('0x56')]['id'],'path':_[_0x1a6e('0xaf')](_0xeb4216[_0x1a6e('0x5c')]['attachments'][0x0][_0x1a6e('0xb0')])?undefined:_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xaa')][0x0][_0x1a6e('0xb0')],'fax':_[_0x1a6e('0xaf')](_0xeb4216[_0x1a6e('0x5c')]['to'][0x0])?undefined:_0xeb4216['body']['to'][0x0],'AttachmentId':_0xeb4216[_0x1a6e('0x5c')][_0x1a6e('0xaa')][0x0]['id']},client9002)[_0x1a6e('0x1f')](function(_0x373857){logger[_0x1a6e('0x20')]('SendFaxRpc,\x20%s',_0x373857);})['catch'](function(_0xb23a77){logger[_0x1a6e('0x20')](_0x1a6e('0xbd'),_0xb23a77);});return _0x5f9d43;})[_0x1a6e('0x1f')](respondWithResult(_0x56f83c,null))['catch'](handleError(_0x56f83c,null));};exports[_0x1a6e('0xbe')]=function(_0x2bdbc8,_0x452cf3,_0x159490){return db[_0x1a6e('0x3c')][_0x1a6e('0x59')]({'where':{'id':_0x2bdbc8['params']['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x452cf3,null))['then'](function(_0x9fcc3b){if(_0x9fcc3b){return _0x9fcc3b[_0x1a6e('0xbe')](_0x2bdbc8['body']['ids'],_[_0x1a6e('0xbf')](_0x2bdbc8['body'],[_0x1a6e('0x6d'),'id'])||{})[_0x1a6e('0xb7')](function(_0x268931){for(var _0x3afdf0=0x0;_0x3afdf0<_0x2bdbc8[_0x1a6e('0x5c')][_0x1a6e('0x6d')][_0x1a6e('0x47')];_0x3afdf0+=0x1){socket[_0x1a6e('0xc0')]('userFaxAccount:save',{'UserId':Number(_0x2bdbc8['body']['ids'][_0x3afdf0]),'FaxAccountId':Number(_0x2bdbc8[_0x1a6e('0x56')]['id'])});}return _0x268931;});}})[_0x1a6e('0x1f')](respondWithResult(_0x452cf3,null))[_0x1a6e('0x5a')](handleError(_0x452cf3,null));};exports['removeAgents']=function(_0x1a8b44,_0x1e4b41,_0x216a24){return db['FaxAccount'][_0x1a6e('0x59')]({'where':{'id':_0x1a8b44[_0x1a6e('0x56')]['id']}})['then'](handleEntityNotFound(_0x1e4b41,null))['then'](function(_0x72d8b9){if(_0x72d8b9){return _0x72d8b9[_0x1a6e('0xc1')](_0x1a8b44[_0x1a6e('0x41')][_0x1a6e('0x6d')])['then'](function(){if(_['isArray'](_0x1a8b44['query']['ids'])){for(var _0x1975c7=0x0;_0x1975c7<_0x1a8b44[_0x1a6e('0x41')][_0x1a6e('0x6d')][_0x1a6e('0x47')];_0x1975c7+=0x1){socket[_0x1a6e('0xc0')](_0x1a6e('0xc2'),{'UserId':Number(_0x1a8b44[_0x1a6e('0x41')][_0x1a6e('0x6d')][_0x1975c7]),'FaxAccountId':Number(_0x1a8b44[_0x1a6e('0x56')]['id'])});}}else{socket['emit'](_0x1a6e('0xc2'),{'UserId':Number(_0x1a8b44[_0x1a6e('0x41')][_0x1a6e('0x6d')]),'FaxAccountId':Number(_0x1a8b44['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1e4b41,null))[_0x1a6e('0x5a')](handleError(_0x1e4b41,null));};exports[_0x1a6e('0xc3')]=function(_0x432a73,_0x1bd334,_0x861f94){var _0x46c5a7={};var _0x15f424={};var _0x2d6111;var _0x5dd935;return db[_0x1a6e('0x3c')][_0x1a6e('0x6a')]({'where':{'id':_0x432a73['params']['id']}})[_0x1a6e('0x1f')](handleEntityNotFound(_0x1bd334,null))[_0x1a6e('0x1f')](function(_0x405857){if(_0x405857){_0x2d6111=_0x405857;_0x15f424[_0x1a6e('0x40')]=_[_0x1a6e('0x42')](db[_0x1a6e('0x76')][_0x1a6e('0x3d')]);_0x15f424['query']=_[_0x1a6e('0x42')](_0x432a73[_0x1a6e('0x41')]);_0x15f424[_0x1a6e('0x43')]=_[_0x1a6e('0x44')](_0x15f424[_0x1a6e('0x40')],_0x15f424[_0x1a6e('0x41')]);_0x46c5a7[_0x1a6e('0x45')]=_['intersection'](_0x15f424[_0x1a6e('0x40')],qs[_0x1a6e('0x46')](_0x432a73[_0x1a6e('0x41')][_0x1a6e('0x46')]));_0x46c5a7[_0x1a6e('0x45')]=_0x46c5a7['attributes'][_0x1a6e('0x47')]?_0x46c5a7[_0x1a6e('0x45')]:_0x15f424[_0x1a6e('0x40')];_0x46c5a7[_0x1a6e('0x4a')]=qs['sort'](_0x432a73[_0x1a6e('0x41')][_0x1a6e('0x4b')]);_0x46c5a7[_0x1a6e('0x4c')]=qs[_0x1a6e('0x43')](_[_0x1a6e('0x4d')](_0x432a73[_0x1a6e('0x41')],_0x15f424[_0x1a6e('0x43')]));if(_0x432a73['query']['filter']){_0x46c5a7[_0x1a6e('0x4c')]=_[_0x1a6e('0x4e')](_0x46c5a7['where'],{'$or':_[_0x1a6e('0x3b')](_0x46c5a7[_0x1a6e('0x45')],function(_0x1b22ab){var _0x4d9c21={};_0x4d9c21[_0x1b22ab]={'$like':'%'+_0x432a73[_0x1a6e('0x41')][_0x1a6e('0x51')]+'%'};return _0x4d9c21;})});}_0x46c5a7=_[_0x1a6e('0x4e')]({},_0x46c5a7,_0x432a73[_0x1a6e('0x52')]);return _0x2d6111[_0x1a6e('0xc3')](_0x46c5a7);}})[_0x1a6e('0x1f')](function(_0x51c731){if(_0x51c731){_0x5dd935=_0x51c731['length'];if(!_0x432a73[_0x1a6e('0x41')][_0x1a6e('0x48')](_0x1a6e('0x49'))){_0x46c5a7['limit']=qs[_0x1a6e('0x2f')](_0x432a73[_0x1a6e('0x41')]['limit']);_0x46c5a7[_0x1a6e('0x2d')]=qs[_0x1a6e('0x2d')](_0x432a73[_0x1a6e('0x41')][_0x1a6e('0x2d')]);}return _0x2d6111['getAgents'](_0x46c5a7);}})['then'](function(_0x4ec7eb){if(_0x4ec7eb){return _0x4ec7eb?{'count':_0x5dd935,'rows':_0x4ec7eb}:null;}})[_0x1a6e('0x1f')](respondWithResult(_0x1bd334,null))['catch'](handleError(_0x1bd334,null));}; \ No newline at end of file +var _0xab12=['DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','get','FaxAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','bulkCreate','updateAccountApplications','update','VoiceExtension','key','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','CmContact','Contacts'];(function(_0x16a83b,_0x3db981){var _0x2d403a=function(_0x1a9f48){while(--_0x1a9f48){_0x16a83b['push'](_0x16a83b['shift']());}};_0x2d403a(++_0x3db981);}(_0xab12,0x1ae));var _0x2ab1=function(_0x2a516a,_0x36a6d1){_0x2a516a=_0x2a516a-0x0;var _0x1500e6=_0xab12[_0x2a516a];return _0x1500e6;};'use strict';var emlformat=require(_0x2ab1('0x0'));var rimraf=require(_0x2ab1('0x1'));var zipdir=require(_0x2ab1('0x2'));var jsonpatch=require(_0x2ab1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ab1('0x4'));var Mustache=require(_0x2ab1('0x5'));var util=require(_0x2ab1('0x6'));var path=require(_0x2ab1('0x7'));var sox=require(_0x2ab1('0x8'));var csv=require(_0x2ab1('0x9'));var ejs=require(_0x2ab1('0xa'));var fs=require('fs');var fs_extra=require(_0x2ab1('0xb'));var _=require(_0x2ab1('0xc'));var squel=require(_0x2ab1('0xd'));var crypto=require(_0x2ab1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2ab1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2ab1('0x10'));var Redis=require(_0x2ab1('0x11'));var authService=require(_0x2ab1('0x12'));var qs=require(_0x2ab1('0x13'));var as=require(_0x2ab1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ab1('0x15'))('api');var utils=require(_0x2ab1('0x16'));var config=require(_0x2ab1('0x17'));var licenseUtil=require(_0x2ab1('0x18'));var db=require(_0x2ab1('0x19'))['db'];config['redis']=_['defaults'](config[_0x2ab1('0x1a')],{'host':_0x2ab1('0x1b'),'port':0x18eb});var socket=require(_0x2ab1('0x1c'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x2ab1('0x1d')](socket);var jayson=require(_0x2ab1('0x1e'));var client=jayson[_0x2ab1('0x1f')][_0x2ab1('0x20')]({'port':0x232c});var client9002=jayson[_0x2ab1('0x1f')][_0x2ab1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x281b25,_0x358718,_0x2b593e,_0xdce8b4){return new BPromise(function(_0x19ba68,_0x47f8e7){var _0x3b8fa7=_0xdce8b4||client;return _0x3b8fa7[_0x2ab1('0x21')](_0x281b25,_0x2b593e)[_0x2ab1('0x22')](function(_0x3733ff){logger['info'](_0x2ab1('0x23'),_0x358718,_0x2ab1('0x24'));logger[_0x2ab1('0x25')](_0x2ab1('0x26'),_0x358718,'request\x20sent',JSON[_0x2ab1('0x27')](_0x3733ff));if(_0x3733ff[_0x2ab1('0x28')]){if(_0x3733ff[_0x2ab1('0x28')][_0x2ab1('0x29')]===0x1f4){logger[_0x2ab1('0x28')](_0x2ab1('0x23'),_0x358718,_0x3733ff['error'][_0x2ab1('0x2a')]);return _0x47f8e7(_0x3733ff[_0x2ab1('0x28')][_0x2ab1('0x2a')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x358718,_0x3733ff['error'][_0x2ab1('0x2a')]);return _0x19ba68(_0x3733ff['error'][_0x2ab1('0x2a')]);}else{logger[_0x2ab1('0x2b')](_0x2ab1('0x23'),_0x358718,_0x2ab1('0x24'));_0x19ba68(_0x3733ff['result'][_0x2ab1('0x2a')]);}})[_0x2ab1('0x2c')](function(_0xe52915){logger[_0x2ab1('0x28')](_0x2ab1('0x23'),_0x358718,_0xe52915);_0x47f8e7(_0xe52915);});});}function respondWithStatusCode(_0x277747,_0x1b1a5){_0x1b1a5=_0x1b1a5||0xcc;return function(_0x1dbde5){if(_0x1dbde5){return _0x277747[_0x2ab1('0x2d')](_0x1b1a5);}return _0x277747[_0x2ab1('0x2e')](_0x1b1a5)[_0x2ab1('0x2f')]();};}function respondWithResult(_0x160fcc,_0x2724c7){_0x2724c7=_0x2724c7||0xc8;return function(_0x47f04a){if(_0x47f04a){return _0x160fcc[_0x2ab1('0x2e')](_0x2724c7)[_0x2ab1('0x30')](_0x47f04a);}};}function respondWithFilteredResult(_0x1a99b7,_0x5cffcb){return function(_0x5aec9c){if(_0x5aec9c){var _0x1642e7=typeof _0x5cffcb['offset']===_0x2ab1('0x31')&&typeof _0x5cffcb[_0x2ab1('0x32')]==='undefined';var _0x2ed7c5=_0x5aec9c[_0x2ab1('0x33')];var _0x601834=_0x1642e7?0x0:_0x5cffcb[_0x2ab1('0x34')];var _0x115b5d=_0x1642e7?_0x5aec9c[_0x2ab1('0x33')]:_0x5cffcb[_0x2ab1('0x34')]+_0x5cffcb[_0x2ab1('0x32')];var _0x33702a;if(_0x115b5d>=_0x2ed7c5){_0x115b5d=_0x2ed7c5;_0x33702a=0xc8;}else{_0x33702a=0xce;}_0x1a99b7[_0x2ab1('0x2e')](_0x33702a);return _0x1a99b7['set'](_0x2ab1('0x35'),_0x601834+'-'+_0x115b5d+'/'+_0x2ed7c5)[_0x2ab1('0x30')](_0x5aec9c);}return null;};}function patchUpdates(_0x21cb2b){return function(_0x284201){try{jsonpatch[_0x2ab1('0x36')](_0x284201,_0x21cb2b,!![]);}catch(_0x2d1947){return BPromise['reject'](_0x2d1947);}return _0x284201[_0x2ab1('0x37')]();};}function saveUpdates(_0x5ce716,_0x36cacd){return function(_0x51256e){if(_0x51256e){return _0x51256e['update'](_0x5ce716)[_0x2ab1('0x22')](function(_0x5dbf5c){return _0x5dbf5c;});}return null;};}function removeEntity(_0x472a6,_0x5cd0ff){return function(_0x5f2201){if(_0x5f2201){return _0x5f2201[_0x2ab1('0x38')]()[_0x2ab1('0x22')](function(){var _0x263304=_0x5f2201[_0x2ab1('0x39')]({'plain':!![]});var _0x187b33=_0x2ab1('0x3a');return db['UserProfileResource'][_0x2ab1('0x38')]({'where':{'type':_0x187b33,'resourceId':_0x263304['id']}})[_0x2ab1('0x22')](function(){return _0x5f2201;});})['then'](function(){_0x472a6[_0x2ab1('0x2e')](0xcc)[_0x2ab1('0x2f')]();});}};}function handleEntityNotFound(_0x357e0f,_0x39ef96){return function(_0x26eaa7){if(!_0x26eaa7){_0x357e0f['sendStatus'](0x194);}return _0x26eaa7;};}function handleError(_0x22fb2a,_0x33f1a5){_0x33f1a5=_0x33f1a5||0x1f4;return function(_0x491ea2){logger['error'](_0x491ea2[_0x2ab1('0x3b')]);if(_0x491ea2[_0x2ab1('0x3c')]){delete _0x491ea2['name'];}_0x22fb2a[_0x2ab1('0x2e')](_0x33f1a5)[_0x2ab1('0x3d')](_0x491ea2);};}exports[_0x2ab1('0x3e')]=function(_0xf9269c,_0x373e77){var _0x3fea18={'include':[{'model':db[_0x2ab1('0x3f')],'as':_0x2ab1('0x40')}]},_0x4a6cc1={},_0xa10f77={'count':0x0,'rows':[]};var _0x57c3cf=_[_0x2ab1('0x41')](db[_0x2ab1('0x42')][_0x2ab1('0x43')],function(_0x8cb0e2){return{'name':_0x8cb0e2['fieldName'],'type':_0x8cb0e2[_0x2ab1('0x44')]['key']};});_0x4a6cc1[_0x2ab1('0x45')]=_[_0x2ab1('0x41')](_0x57c3cf,_0x2ab1('0x3c'));_0x4a6cc1[_0x2ab1('0x46')]=_[_0x2ab1('0x47')](_0xf9269c['query']);_0x4a6cc1[_0x2ab1('0x48')]=_[_0x2ab1('0x49')](_0x4a6cc1['model'],_0x4a6cc1['query']);_0x3fea18[_0x2ab1('0x4a')]=_[_0x2ab1('0x49')](_0x4a6cc1[_0x2ab1('0x45')],qs[_0x2ab1('0x4b')](_0xf9269c[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0x3fea18[_0x2ab1('0x4a')]=_0x3fea18[_0x2ab1('0x4a')][_0x2ab1('0x4c')]?_0x3fea18[_0x2ab1('0x4a')]:_0x4a6cc1[_0x2ab1('0x45')];if(!_0xf9269c[_0x2ab1('0x46')]['hasOwnProperty'](_0x2ab1('0x4d'))){_0x3fea18[_0x2ab1('0x32')]=qs[_0x2ab1('0x32')](_0xf9269c[_0x2ab1('0x46')]['limit']);_0x3fea18[_0x2ab1('0x34')]=qs[_0x2ab1('0x34')](_0xf9269c[_0x2ab1('0x46')][_0x2ab1('0x34')]);}_0x3fea18[_0x2ab1('0x4e')]=qs[_0x2ab1('0x4f')](_0xf9269c[_0x2ab1('0x46')]['sort']);_0x3fea18[_0x2ab1('0x50')]=qs[_0x2ab1('0x48')](_[_0x2ab1('0x51')](_0xf9269c[_0x2ab1('0x46')],_0x4a6cc1['filters']),_0x57c3cf);if(_0xf9269c[_0x2ab1('0x46')]['filter']){_0x3fea18[_0x2ab1('0x50')]=_['merge'](_0x3fea18[_0x2ab1('0x50')],{'$or':_[_0x2ab1('0x41')](_0x57c3cf,function(_0x3e5a6f){if(_0x3e5a6f[_0x2ab1('0x44')]!==_0x2ab1('0x52')){var _0x2d349f={};_0x2d349f[_0x3e5a6f[_0x2ab1('0x3c')]]={'$like':'%'+_0xf9269c[_0x2ab1('0x46')][_0x2ab1('0x53')]+'%'};return _0x2d349f;}})});}_0x3fea18=_[_0x2ab1('0x54')]({},_0x3fea18,_0xf9269c[_0x2ab1('0x55')]);var _0x19586e={'where':_0x3fea18[_0x2ab1('0x50')]};return db[_0x2ab1('0x42')][_0x2ab1('0x33')](_0x19586e)['then'](function(_0x53229a){_0xa10f77[_0x2ab1('0x33')]=_0x53229a;if(_0xf9269c[_0x2ab1('0x46')][_0x2ab1('0x56')]){_0x3fea18[_0x2ab1('0x57')]=[{'all':!![]}];}return db[_0x2ab1('0x42')][_0x2ab1('0x58')](_0x3fea18);})[_0x2ab1('0x22')](function(_0x5b5cf4){_0xa10f77[_0x2ab1('0x59')]=_0x5b5cf4;return _0xa10f77;})[_0x2ab1('0x22')](respondWithFilteredResult(_0x373e77,_0x3fea18))[_0x2ab1('0x2c')](handleError(_0x373e77,null));};exports[_0x2ab1('0x5a')]=function(_0x311a73,_0x3eadd7){var _0x5e50da={'raw':![],'where':{'id':_0x311a73[_0x2ab1('0x5b')]['id']},'include':[{'model':db[_0x2ab1('0x3f')],'as':_0x2ab1('0x40')}]},_0x3c8bfc={};_0x3c8bfc[_0x2ab1('0x45')]=_[_0x2ab1('0x47')](db['FaxAccount']['rawAttributes']);_0x3c8bfc[_0x2ab1('0x46')]=_['keys'](_0x311a73['query']);_0x3c8bfc[_0x2ab1('0x48')]=_[_0x2ab1('0x49')](_0x3c8bfc[_0x2ab1('0x45')],_0x3c8bfc[_0x2ab1('0x46')]);_0x5e50da[_0x2ab1('0x4a')]=_[_0x2ab1('0x49')](_0x3c8bfc['model'],qs[_0x2ab1('0x4b')](_0x311a73[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0x5e50da[_0x2ab1('0x4a')]=_0x5e50da[_0x2ab1('0x4a')][_0x2ab1('0x4c')]?_0x5e50da['attributes']:_0x3c8bfc[_0x2ab1('0x45')];if(_0x311a73[_0x2ab1('0x46')][_0x2ab1('0x56')]){_0x5e50da[_0x2ab1('0x57')]=[{'all':!![]}];}_0x5e50da=_['merge']({},_0x5e50da,_0x311a73[_0x2ab1('0x55')]);return db['FaxAccount'][_0x2ab1('0x5c')](_0x5e50da)['then'](handleEntityNotFound(_0x3eadd7,null))[_0x2ab1('0x22')](respondWithResult(_0x3eadd7,null))[_0x2ab1('0x2c')](handleError(_0x3eadd7,null));};exports['create']=function(_0x1324e1,_0x5e82d8){return db[_0x2ab1('0x42')][_0x2ab1('0x5d')](_0x1324e1[_0x2ab1('0x5e')],{})[_0x2ab1('0x22')](function(_0xfb2f47){var _0xca836e=_0x1324e1['user'][_0x2ab1('0x39')]({'plain':!![]});if(!_0xca836e)throw new Error(_0x2ab1('0x5f'));if(_0xca836e['role']===_0x2ab1('0x60')){var _0x18583e=_0xfb2f47[_0x2ab1('0x39')]({'plain':!![]});var _0x223701=_0x2ab1('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x223701,'userProfileId':_0xca836e[_0x2ab1('0x61')]},'raw':!![]})['then'](function(_0x2ca47a){if(_0x2ca47a&&_0x2ca47a[_0x2ab1('0x62')]===0x0){return db[_0x2ab1('0x63')][_0x2ab1('0x5d')]({'name':_0x18583e[_0x2ab1('0x3c')],'resourceId':_0x18583e['id'],'type':_0x2ca47a[_0x2ab1('0x3c')],'sectionId':_0x2ca47a['id']},{})['then'](function(){return _0xfb2f47;});}else{return _0xfb2f47;}})['catch'](function(_0x3efaf8){logger['error'](_0x2ab1('0x64'),_0x3efaf8);throw _0x3efaf8;});}return _0xfb2f47;})[_0x2ab1('0x22')](respondWithResult(_0x5e82d8,0xc9))[_0x2ab1('0x2c')](handleError(_0x5e82d8,null));};exports['update']=function(_0x341be9,_0x2a75ef){if(_0x341be9[_0x2ab1('0x5e')]['id']){delete _0x341be9[_0x2ab1('0x5e')]['id'];}return db[_0x2ab1('0x42')]['find']({'where':{'id':_0x341be9[_0x2ab1('0x5b')]['id']},'include':[{'model':db[_0x2ab1('0x3f')],'as':_0x2ab1('0x40')}]})[_0x2ab1('0x22')](handleEntityNotFound(_0x2a75ef,null))[_0x2ab1('0x22')](saveUpdates(_0x341be9[_0x2ab1('0x5e')],null))[_0x2ab1('0x22')](respondWithResult(_0x2a75ef,null))[_0x2ab1('0x2c')](handleError(_0x2a75ef,null));};exports[_0x2ab1('0x38')]=function(_0x395f22,_0x581f83){return db[_0x2ab1('0x42')]['find']({'where':{'id':_0x395f22[_0x2ab1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x581f83,null))[_0x2ab1('0x22')](removeEntity(_0x581f83,null))[_0x2ab1('0x2c')](handleError(_0x581f83,null));};exports[_0x2ab1('0x65')]=function(_0x3aa86c,_0x571057){return db[_0x2ab1('0x42')][_0x2ab1('0x65')]()[_0x2ab1('0x22')](respondWithResult(_0x571057,null))[_0x2ab1('0x2c')](handleError(_0x571057,null));};exports['addDisposition']=function(_0x4e2806,_0x59f8b1,_0x15c3e2){if(_0x4e2806['body']['id']){delete _0x4e2806[_0x2ab1('0x5e')]['id'];}return db[_0x2ab1('0x42')][_0x2ab1('0x5c')]({'where':{'id':_0x4e2806[_0x2ab1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x59f8b1,null))[_0x2ab1('0x22')](function(_0x4aa0da){if(_0x4aa0da){_0x4e2806['body'][_0x2ab1('0x66')]=_0x4aa0da['id'];return db['Disposition'][_0x2ab1('0x5d')](_0x4e2806[_0x2ab1('0x5e')]);}})[_0x2ab1('0x22')](respondWithResult(_0x59f8b1,null))['catch'](handleError(_0x59f8b1,null));};exports[_0x2ab1('0x67')]=function(_0x5b1aad,_0x2d630f,_0x1e0817){var _0x3c95a5={'raw':![],'where':{}};var _0x13cd0c={};var _0x1c96f0={'count':0x0,'rows':[]};return db[_0x2ab1('0x42')][_0x2ab1('0x68')]({'where':{'id':_0x5b1aad[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x2d630f,null))['then'](function(_0x2a2571){if(_0x2a2571){_0x13cd0c[_0x2ab1('0x45')]=_[_0x2ab1('0x47')](db[_0x2ab1('0x69')][_0x2ab1('0x43')]);_0x13cd0c[_0x2ab1('0x46')]=_[_0x2ab1('0x47')](_0x5b1aad[_0x2ab1('0x46')]);_0x13cd0c[_0x2ab1('0x48')]=_[_0x2ab1('0x49')](_0x13cd0c[_0x2ab1('0x45')],_0x13cd0c[_0x2ab1('0x46')]);_0x3c95a5[_0x2ab1('0x4a')]=_[_0x2ab1('0x49')](_0x13cd0c[_0x2ab1('0x45')],qs[_0x2ab1('0x4b')](_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0x3c95a5[_0x2ab1('0x4a')]=_0x3c95a5['attributes']['length']?_0x3c95a5[_0x2ab1('0x4a')]:_0x13cd0c[_0x2ab1('0x45')];if(!_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x6a')](_0x2ab1('0x4d'))){_0x3c95a5[_0x2ab1('0x32')]=qs[_0x2ab1('0x32')](_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x32')]);_0x3c95a5[_0x2ab1('0x34')]=qs[_0x2ab1('0x34')](_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x34')]);}_0x3c95a5[_0x2ab1('0x4e')]=qs[_0x2ab1('0x4f')](_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x4f')]);_0x3c95a5[_0x2ab1('0x50')]=qs[_0x2ab1('0x48')](_[_0x2ab1('0x51')](_0x5b1aad[_0x2ab1('0x46')],_0x13cd0c[_0x2ab1('0x48')]));_0x3c95a5[_0x2ab1('0x50')][_0x2ab1('0x66')]=_0x2a2571['id'];if(_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x53')]){_0x3c95a5[_0x2ab1('0x50')]=_[_0x2ab1('0x54')](_0x3c95a5[_0x2ab1('0x50')],{'$or':_[_0x2ab1('0x41')](_0x3c95a5[_0x2ab1('0x4a')],function(_0x2e6ddb){var _0x4feb93={};_0x4feb93[_0x2e6ddb]={'$like':'%'+_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x53')]+'%'};return _0x4feb93;})});}_0x3c95a5=_[_0x2ab1('0x54')]({},_0x3c95a5,_0x5b1aad['options']);return db[_0x2ab1('0x69')][_0x2ab1('0x33')]({'where':_0x3c95a5[_0x2ab1('0x50')]})[_0x2ab1('0x22')](function(_0x3c2ebe){_0x1c96f0[_0x2ab1('0x33')]=_0x3c2ebe;if(_0x5b1aad[_0x2ab1('0x46')][_0x2ab1('0x56')]){_0x3c95a5[_0x2ab1('0x57')]=[{'all':!![]}];}return db[_0x2ab1('0x69')][_0x2ab1('0x58')](_0x3c95a5);})['then'](function(_0x2c5221){_0x1c96f0['rows']=_0x2c5221;return _0x1c96f0;});}})['then'](respondWithFilteredResult(_0x2d630f,_0x3c95a5))[_0x2ab1('0x2c')](handleError(_0x2d630f,null));};exports[_0x2ab1('0x6b')]=function(_0x2ff64b,_0x1981e7,_0x588701){return db[_0x2ab1('0x42')]['find']({'where':{'id':_0x2ff64b[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x1981e7,null))[_0x2ab1('0x22')](function(_0x2d88e1){if(_0x2d88e1){return _0x2d88e1[_0x2ab1('0x6b')](_0x2ff64b[_0x2ab1('0x46')][_0x2ab1('0x6c')]);}})[_0x2ab1('0x22')](respondWithStatusCode(_0x1981e7,null))[_0x2ab1('0x2c')](handleError(_0x1981e7,null));};exports[_0x2ab1('0x6d')]=function(_0x48cb0f,_0x10c6f6,_0x2cb8d5){if(_0x48cb0f['body']['id']){delete _0x48cb0f[_0x2ab1('0x5e')]['id'];}return db[_0x2ab1('0x42')]['find']({'where':{'id':_0x48cb0f[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x10c6f6,null))['then'](function(_0x1171ca){if(_0x1171ca){_0x48cb0f[_0x2ab1('0x5e')][_0x2ab1('0x66')]=_0x1171ca['id'];return db['CannedAnswer']['create'](_0x48cb0f[_0x2ab1('0x5e')]);}})['then'](respondWithResult(_0x10c6f6,null))[_0x2ab1('0x2c')](handleError(_0x10c6f6,null));};exports['getAnswers']=function(_0x165704,_0x3319a1,_0x56f549){var _0x200b80={'raw':![],'where':{}};var _0x35014b={};var _0x4ae921={'count':0x0,'rows':[]};return db[_0x2ab1('0x42')][_0x2ab1('0x68')]({'where':{'id':_0x165704[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x3319a1,null))[_0x2ab1('0x22')](function(_0x494312){if(_0x494312){_0x35014b[_0x2ab1('0x45')]=_[_0x2ab1('0x47')](db[_0x2ab1('0x6e')]['rawAttributes']);_0x35014b[_0x2ab1('0x46')]=_[_0x2ab1('0x47')](_0x165704[_0x2ab1('0x46')]);_0x35014b[_0x2ab1('0x48')]=_[_0x2ab1('0x49')](_0x35014b[_0x2ab1('0x45')],_0x35014b[_0x2ab1('0x46')]);_0x200b80[_0x2ab1('0x4a')]=_[_0x2ab1('0x49')](_0x35014b[_0x2ab1('0x45')],qs[_0x2ab1('0x4b')](_0x165704[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0x200b80[_0x2ab1('0x4a')]=_0x200b80[_0x2ab1('0x4a')][_0x2ab1('0x4c')]?_0x200b80[_0x2ab1('0x4a')]:_0x35014b[_0x2ab1('0x45')];if(!_0x165704[_0x2ab1('0x46')]['hasOwnProperty']('nolimit')){_0x200b80[_0x2ab1('0x32')]=qs[_0x2ab1('0x32')](_0x165704[_0x2ab1('0x46')][_0x2ab1('0x32')]);_0x200b80[_0x2ab1('0x34')]=qs[_0x2ab1('0x34')](_0x165704[_0x2ab1('0x46')][_0x2ab1('0x34')]);}_0x200b80[_0x2ab1('0x4e')]=qs[_0x2ab1('0x4f')](_0x165704[_0x2ab1('0x46')][_0x2ab1('0x4f')]);_0x200b80[_0x2ab1('0x50')]=qs[_0x2ab1('0x48')](_[_0x2ab1('0x51')](_0x165704[_0x2ab1('0x46')],_0x35014b[_0x2ab1('0x48')]));_0x200b80[_0x2ab1('0x50')]['FaxAccountId']=_0x494312['id'];if(_0x165704['query'][_0x2ab1('0x53')]){_0x200b80[_0x2ab1('0x50')]=_['merge'](_0x200b80[_0x2ab1('0x50')],{'$or':_[_0x2ab1('0x41')](_0x200b80['attributes'],function(_0x88173e){var _0x3a18d0={};_0x3a18d0[_0x88173e]={'$like':'%'+_0x165704[_0x2ab1('0x46')][_0x2ab1('0x53')]+'%'};return _0x3a18d0;})});}_0x200b80=_[_0x2ab1('0x54')]({},_0x200b80,_0x165704[_0x2ab1('0x55')]);return db[_0x2ab1('0x6e')]['count']({'where':_0x200b80['where']})[_0x2ab1('0x22')](function(_0xb8756b){_0x4ae921[_0x2ab1('0x33')]=_0xb8756b;if(_0x165704[_0x2ab1('0x46')][_0x2ab1('0x56')]){_0x200b80[_0x2ab1('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2ab1('0x58')](_0x200b80);})[_0x2ab1('0x22')](function(_0x6cb86b){_0x4ae921['rows']=_0x6cb86b;return _0x4ae921;});}})[_0x2ab1('0x22')](respondWithFilteredResult(_0x3319a1,_0x200b80))[_0x2ab1('0x2c')](handleError(_0x3319a1,null));};exports[_0x2ab1('0x6f')]=function(_0x3d8a56,_0x4cdb9f,_0x1855c2){return db[_0x2ab1('0x42')]['find']({'where':{'id':_0x3d8a56[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x4cdb9f,null))[_0x2ab1('0x22')](function(_0x375c71){if(_0x375c71){return _0x375c71[_0x2ab1('0x6f')](_0x3d8a56[_0x2ab1('0x46')][_0x2ab1('0x6c')]);}})[_0x2ab1('0x22')](respondWithStatusCode(_0x4cdb9f,null))[_0x2ab1('0x2c')](handleError(_0x4cdb9f,null));};exports[_0x2ab1('0x70')]=function(_0x303115,_0x3c6fbd,_0x3f86ff){return db[_0x2ab1('0x71')][_0x2ab1('0x5c')]({'where':{'id':_0x303115['params']['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x3c6fbd,null))[_0x2ab1('0x22')](function(_0x4023c2){if(_0x4023c2){return _0x4023c2[_0x2ab1('0x70')](_0x303115['body'][_0x2ab1('0x6c')],_[_0x2ab1('0x72')](_0x303115[_0x2ab1('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x3c6fbd,null))[_0x2ab1('0x2c')](handleError(_0x3c6fbd,null));};exports[_0x2ab1('0x73')]=function(_0x5560a7,_0x272457,_0x2e07bf){var _0x4f2dd1={'raw':![],'where':{}};var _0x137ab2={};var _0x5cd640={'count':0x0,'rows':[]};return db[_0x2ab1('0x42')]['findOne']({'where':{'id':_0x5560a7[_0x2ab1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x272457,null))[_0x2ab1('0x22')](function(_0x4ed6b9){if(_0x4ed6b9){_0x137ab2['model']=_[_0x2ab1('0x47')](db[_0x2ab1('0x71')][_0x2ab1('0x43')]);_0x137ab2[_0x2ab1('0x46')]=_[_0x2ab1('0x47')](_0x5560a7['query']);_0x137ab2[_0x2ab1('0x48')]=_[_0x2ab1('0x49')](_0x137ab2[_0x2ab1('0x45')],_0x137ab2[_0x2ab1('0x46')]);_0x4f2dd1[_0x2ab1('0x4a')]=_[_0x2ab1('0x49')](_0x137ab2[_0x2ab1('0x45')],qs[_0x2ab1('0x4b')](_0x5560a7[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0x4f2dd1[_0x2ab1('0x4a')]=_0x4f2dd1[_0x2ab1('0x4a')][_0x2ab1('0x4c')]?_0x4f2dd1[_0x2ab1('0x4a')]:_0x137ab2[_0x2ab1('0x45')];if(!_0x5560a7[_0x2ab1('0x46')][_0x2ab1('0x6a')]('nolimit')){_0x4f2dd1[_0x2ab1('0x32')]=qs['limit'](_0x5560a7[_0x2ab1('0x46')][_0x2ab1('0x32')]);_0x4f2dd1[_0x2ab1('0x34')]=qs[_0x2ab1('0x34')](_0x5560a7[_0x2ab1('0x46')][_0x2ab1('0x34')]);}_0x4f2dd1['order']=qs[_0x2ab1('0x4f')](_0x5560a7[_0x2ab1('0x46')]['sort']);_0x4f2dd1['where']=qs[_0x2ab1('0x48')](_['pick'](_0x5560a7[_0x2ab1('0x46')],_0x137ab2[_0x2ab1('0x48')]));_0x4f2dd1[_0x2ab1('0x50')]['FaxAccountId']=_0x4ed6b9['id'];if(_0x5560a7[_0x2ab1('0x46')][_0x2ab1('0x53')]){_0x4f2dd1[_0x2ab1('0x50')]=_[_0x2ab1('0x54')](_0x4f2dd1[_0x2ab1('0x50')],{'$or':_[_0x2ab1('0x41')](_0x4f2dd1[_0x2ab1('0x4a')],function(_0x4ec326){var _0xc1390a={};_0xc1390a[_0x4ec326]={'$like':'%'+_0x5560a7['query'][_0x2ab1('0x53')]+'%'};return _0xc1390a;})});}_0x4f2dd1=_[_0x2ab1('0x54')]({},_0x4f2dd1,_0x5560a7[_0x2ab1('0x55')]);return db[_0x2ab1('0x71')][_0x2ab1('0x33')]({'where':_0x4f2dd1['where']})[_0x2ab1('0x22')](function(_0x3e6c71){_0x5cd640[_0x2ab1('0x33')]=_0x3e6c71;if(_0x5560a7['query']['includeAll']){_0x4f2dd1['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x2ab1('0x74')],'as':_0x2ab1('0x75'),'attributes':[_0x2ab1('0x3c'),_0x2ab1('0x76'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x2ab1('0x77'),'attributes':['id',_0x2ab1('0x3c'),_0x2ab1('0x78')],'where':_0x5560a7[_0x2ab1('0x46')]['tag']?{'id':_0x5560a7['query'][_0x2ab1('0x79')]}:undefined,'required':_0x5560a7[_0x2ab1('0x46')][_0x2ab1('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0x2ab1('0x58')](_0x4f2dd1);})[_0x2ab1('0x22')](function(_0x3176f0){_0x5cd640[_0x2ab1('0x59')]=_0x3176f0;return _0x5cd640;});}})[_0x2ab1('0x22')](respondWithFilteredResult(_0x272457,_0x4f2dd1))[_0x2ab1('0x2c')](handleError(_0x272457,null));};exports[_0x2ab1('0x7a')]=function(_0x5a9d69,_0x21ca00){var _0x119eb7=_0x5a9d69[_0x2ab1('0x5b')]['id'];var _0x434835=_0x5a9d69[_0x2ab1('0x5e')];var _0x53f4fc=0xc8;var _0x45be9c=null;return db[_0x2ab1('0x7b')][_0x2ab1('0x7c')]({'isolationLevel':db['sequelize'][_0x2ab1('0x7d')][_0x2ab1('0x7e')][_0x2ab1('0x7f')]},function(_0x551f68){return db[_0x2ab1('0x42')][_0x2ab1('0x68')]({'where':{'id':_0x119eb7},'transaction':_0x551f68})[_0x2ab1('0x22')](function(_0x3904bf){if(_0x3904bf){return db[_0x2ab1('0x80')][_0x2ab1('0x38')]({'where':{'FaxAccountId':_0x119eb7},'transaction':_0x551f68})[_0x2ab1('0x22')](function(){var _0x3e830d=_[_0x2ab1('0x41')](_0x434835,function(_0x5579fb){_0x5579fb[_0x2ab1('0x66')]=_0x119eb7;return _0x5579fb;});return db[_0x2ab1('0x80')]['bulkCreate'](_0x3e830d,{'transaction':_0x551f68});});}else{_0x53f4fc=0x194;_0x45be9c=[];}});})[_0x2ab1('0x22')](function(){if(_0x53f4fc!==0x194){return db[_0x2ab1('0x80')][_0x2ab1('0x81')]({'where':{'FaxAccountId':_0x119eb7},'order':'priority'})[_0x2ab1('0x22')](function(_0x4da738){_0x45be9c=_0x4da738;});}})[_0x2ab1('0x2c')](function(_0x55a5ef){_0x53f4fc=0x1f4;logger['error'](_0x55a5ef[_0x2ab1('0x3b')]);if(_0x55a5ef[_0x2ab1('0x3c')]){delete _0x55a5ef[_0x2ab1('0x3c')];}_0x45be9c=_0x55a5ef;})[_0x2ab1('0x82')](function(){if(_0x45be9c===null){_0x21ca00['sendStatus'](_0x53f4fc);}else{if(_0x53f4fc===0x1f4){_0x21ca00['status'](_0x53f4fc)['send'](_0x45be9c);}else{_0x21ca00[_0x2ab1('0x2e')](_0x53f4fc)[_0x2ab1('0x30')](_0x45be9c);}}});};exports[_0x2ab1('0x83')]=function(_0x33970c,_0x2ea50e,_0x190196){var _0x3f049c={};var _0x1e3e66={};var _0x35ddb8;var _0x2c9f82;return db[_0x2ab1('0x42')][_0x2ab1('0x68')]({'where':{'id':_0x33970c[_0x2ab1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2ea50e,null))[_0x2ab1('0x22')](function(_0x3583dc){if(_0x3583dc){_0x35ddb8=_0x3583dc;_0x1e3e66[_0x2ab1('0x45')]=_['keys'](db[_0x2ab1('0x80')][_0x2ab1('0x43')]);_0x1e3e66[_0x2ab1('0x46')]=_[_0x2ab1('0x47')](_0x33970c[_0x2ab1('0x46')]);_0x1e3e66[_0x2ab1('0x48')]=_['intersection'](_0x1e3e66[_0x2ab1('0x45')],_0x1e3e66[_0x2ab1('0x46')]);_0x3f049c[_0x2ab1('0x4a')]=_['intersection'](_0x1e3e66[_0x2ab1('0x45')],qs['fields'](_0x33970c[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0x3f049c[_0x2ab1('0x4a')]=_0x3f049c[_0x2ab1('0x4a')][_0x2ab1('0x4c')]?_0x3f049c[_0x2ab1('0x4a')]:_0x1e3e66[_0x2ab1('0x45')];_0x3f049c[_0x2ab1('0x4e')]=qs['sort'](_0x33970c[_0x2ab1('0x46')][_0x2ab1('0x4f')]);_0x3f049c[_0x2ab1('0x50')]=qs[_0x2ab1('0x48')](_[_0x2ab1('0x51')](_0x33970c['query'],_0x1e3e66[_0x2ab1('0x48')]));if(_0x33970c[_0x2ab1('0x46')][_0x2ab1('0x53')]){_0x3f049c[_0x2ab1('0x50')]=_[_0x2ab1('0x54')](_0x3f049c[_0x2ab1('0x50')],{'$or':_[_0x2ab1('0x41')](_0x3f049c[_0x2ab1('0x4a')],function(_0x30dd25){var _0x114e65={};_0x114e65[_0x30dd25]={'$like':'%'+_0x33970c[_0x2ab1('0x46')][_0x2ab1('0x53')]+'%'};return _0x114e65;})});}_0x3f049c=_[_0x2ab1('0x54')]({},_0x3f049c,_0x33970c[_0x2ab1('0x55')]);return _0x35ddb8[_0x2ab1('0x83')](_0x3f049c);}})['then'](function(_0x340902){if(_0x340902){_0x2c9f82=_0x340902[_0x2ab1('0x4c')];if(!_0x33970c[_0x2ab1('0x46')][_0x2ab1('0x6a')]('nolimit')){_0x3f049c[_0x2ab1('0x32')]=qs[_0x2ab1('0x32')](_0x33970c['query'][_0x2ab1('0x32')]);_0x3f049c[_0x2ab1('0x34')]=qs[_0x2ab1('0x34')](_0x33970c[_0x2ab1('0x46')][_0x2ab1('0x34')]);}return _0x35ddb8[_0x2ab1('0x83')](_0x3f049c);}})['then'](function(_0x48f993){if(_0x48f993){return _0x48f993?{'count':_0x2c9f82,'rows':_0x48f993}:null;}})[_0x2ab1('0x22')](respondWithResult(_0x2ea50e,null))['catch'](handleError(_0x2ea50e,null));};function Extension(_0x4ab354,_0x2c8038,_0x14d64d,_0x4c077d){this[_0x2ab1('0x84')]=_0x2ab1('0x85');this[_0x2ab1('0x86')]=_0x4ab354[_0x2ab1('0x87')];this[_0x2ab1('0x88')]=_0x4c077d;this['type']='system';this['description']=_0x2ab1('0x89');this[_0x2ab1('0x66')]=_0x4ab354['id'];this[_0x2ab1('0x8a')]=_0x2c8038;this['appdata']=_0x14d64d;}function createExtensionsReciveFax(_0xc6b6a){var _0x11c47f=0x1;var _0x4c87c6=[];_0x4c87c6[_0x2ab1('0x8b')](new Extension(_0xc6b6a,_0x11c47f,'',_0x2ab1('0x8c')));_0x11c47f+=0x1;_0x4c87c6[_0x2ab1('0x8b')](new Extension(_0xc6b6a,_0x11c47f,_0x2ab1('0x8d'),_0x2ab1('0x8e')));_0x11c47f+=0x1;for(var _0x387dea in _0xc6b6a){if(_0xc6b6a['hasOwnProperty'](_0x387dea)&&(_0x387dea==='ecm'||_0x387dea===_0x2ab1('0x87')||_0x387dea===_0x2ab1('0x8f')||_0x387dea===_0x2ab1('0x90')||_0x387dea===_0x2ab1('0x91')||_0x387dea===_0x2ab1('0x92')||_0x387dea===_0x2ab1('0x93')||_0x387dea===_0x2ab1('0x94')||_0x387dea===_0x2ab1('0x95'))){_0x4c87c6[_0x2ab1('0x8b')](new Extension(_0xc6b6a,_0x11c47f,_0x2ab1('0x96')+_0x387dea+')='+_0xc6b6a[_0x387dea],_0x2ab1('0x8e')));_0x11c47f+=0x1;}}_0x4c87c6[_0x2ab1('0x8b')](new Extension(_0xc6b6a,_0x11c47f,'6','Wait'));_0x11c47f+=0x1;_0x4c87c6[_0x2ab1('0x8b')](new Extension(_0xc6b6a,_0x11c47f,'/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',_0x2ab1('0x97')));_0x11c47f=0x0;return _0x4c87c6;}exports[_0x2ab1('0x98')]=function(_0x58280a,_0x449517,_0x5811ea){var _0x3bcfdc;return db[_0x2ab1('0x7b')][_0x2ab1('0x7c')](function(_0x1aaaa6){return db['FaxAccount'][_0x2ab1('0x5d')](_0x58280a[_0x2ab1('0x5e')],{'transaction':_0x1aaaa6})[_0x2ab1('0x22')](function(_0xad98a9){_0x3bcfdc=_0xad98a9[_0x2ab1('0x39')]({'plain':!![]});return db['VoiceExtension'][_0x2ab1('0x99')](createExtensionsReciveFax(_0x3bcfdc),{'transaction':_0x1aaaa6});});})[_0x2ab1('0x22')](function(){return _0x3bcfdc;})[_0x2ab1('0x22')](respondWithResult(_0x449517,null))['catch'](handleError(_0x449517,null));};exports[_0x2ab1('0x9a')]=function(_0xa74d26,_0xf7fffc,_0xfa7230){var _0x392aa2;return db[_0x2ab1('0x7b')][_0x2ab1('0x7c')](function(_0x2e0b13){return db[_0x2ab1('0x42')][_0x2ab1('0x9b')](_0xa74d26[_0x2ab1('0x5e')],{'where':{'id':_0xa74d26['body']['id']},'transaction':_0x2e0b13})[_0x2ab1('0x22')](function(_0x3e92a6){return db[_0x2ab1('0x9c')][_0x2ab1('0x38')]({'where':{'FaxAccountId':_0xa74d26[_0x2ab1('0x5e')]['id']},'transaction':_0x2e0b13})[_0x2ab1('0x22')](function(_0x28ed13){return db[_0x2ab1('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0x2ab1('0x72')](_0xa74d26[_0x2ab1('0x5e')],['tech',_0x2ab1('0x9d'),_0x2ab1('0x9e'),_0x2ab1('0x9f'),_0x2ab1('0xa0'),'ListId'])),{'transaction':_0x2e0b13});});});})[_0x2ab1('0x22')](function(){return db[_0x2ab1('0x42')][_0x2ab1('0xa1')](_0xa74d26[_0x2ab1('0x5e')]['id']);})[_0x2ab1('0x22')](respondWithResult(_0xf7fffc,null))[_0x2ab1('0x2c')](handleError(_0xf7fffc,null));};exports[_0x2ab1('0xa2')]=function(_0x105d1b,_0x113ee8,_0x1c1c5f){var _0x24f093={'raw':!![],'where':{}};var _0x534549={};var _0x510385={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x105d1b['params']['id']}})['then'](handleEntityNotFound(_0x113ee8,null))[_0x2ab1('0x22')](function(_0x35a570){if(_0x35a570){_0x534549[_0x2ab1('0x45')]=_[_0x2ab1('0x47')](db['FaxMessage'][_0x2ab1('0x43')]);_0x534549[_0x2ab1('0x46')]=_[_0x2ab1('0x47')](_0x105d1b[_0x2ab1('0x46')]);_0x534549[_0x2ab1('0x48')]=_['intersection'](_0x534549[_0x2ab1('0x45')],_0x534549[_0x2ab1('0x46')]);_0x24f093[_0x2ab1('0x4a')]=_['intersection'](_0x534549[_0x2ab1('0x45')],qs[_0x2ab1('0x4b')](_0x105d1b[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0x24f093['attributes']=_0x24f093[_0x2ab1('0x4a')][_0x2ab1('0x4c')]?_0x24f093[_0x2ab1('0x4a')]:_0x534549[_0x2ab1('0x45')];if(!_0x105d1b['query'][_0x2ab1('0x6a')](_0x2ab1('0x4d'))){_0x24f093[_0x2ab1('0x32')]=qs[_0x2ab1('0x32')](_0x105d1b[_0x2ab1('0x46')][_0x2ab1('0x32')]);_0x24f093[_0x2ab1('0x34')]=qs['offset'](_0x105d1b[_0x2ab1('0x46')][_0x2ab1('0x34')]);}_0x24f093[_0x2ab1('0x4e')]=qs[_0x2ab1('0x4f')](_0x105d1b['query']['sort']);_0x24f093[_0x2ab1('0x50')]=qs[_0x2ab1('0x48')](_[_0x2ab1('0x51')](_0x105d1b[_0x2ab1('0x46')],_0x534549[_0x2ab1('0x48')]));_0x24f093['where'][_0x2ab1('0x66')]=_0x35a570['id'];if(_0x105d1b[_0x2ab1('0x46')][_0x2ab1('0x53')]){_0x24f093[_0x2ab1('0x50')]=_[_0x2ab1('0x54')](_0x24f093['where'],{'$or':_[_0x2ab1('0x41')](_0x24f093[_0x2ab1('0x4a')],function(_0x2d786d){var _0x49d971={};_0x49d971[_0x2d786d]={'$like':'%'+_0x105d1b[_0x2ab1('0x46')][_0x2ab1('0x53')]+'%'};return _0x49d971;})});}if(_0x105d1b[_0x2ab1('0x46')][_0x2ab1('0xa3')]){var _0xa48e2d=_0x105d1b['query']['$gte']['split'](',');var _0x2e715d={};_0x2e715d[_0xa48e2d[0x0]]={'$gte':moment(_0xa48e2d[0x1])[_0x2ab1('0xa4')](_0x2ab1('0xa5'))};_0x24f093[_0x2ab1('0x50')]=_['merge'](_0x24f093[_0x2ab1('0x50')],_0x2e715d);}_0x24f093=_[_0x2ab1('0x54')]({},_0x24f093,_0x105d1b[_0x2ab1('0x55')]);return db[_0x2ab1('0xa6')][_0x2ab1('0x33')]({'where':_0x24f093[_0x2ab1('0x50')]})['then'](function(_0x1d6537){_0x510385[_0x2ab1('0x33')]=_0x1d6537;if(_0x105d1b[_0x2ab1('0x46')][_0x2ab1('0x56')]){_0x24f093[_0x2ab1('0x57')]=[{'all':!![]}];}return db[_0x2ab1('0xa6')]['findAll'](_0x24f093);})[_0x2ab1('0x22')](function(_0x4748fb){_0x510385[_0x2ab1('0x59')]=_0x4748fb;return _0x510385;});}})['then'](respondWithFilteredResult(_0x113ee8,_0x24f093))[_0x2ab1('0x2c')](handleError(_0x113ee8,null));};exports['send']=function(_0x3227f8,_0x518afa,_0x592353){var _0x1e806d,_0x1ea665={},_0x583ce3;if(_0x3227f8[_0x2ab1('0x5e')]['to']){_0x583ce3=_0x3227f8[_0x2ab1('0x5e')]['to'][0x0];}return db[_0x2ab1('0x42')][_0x2ab1('0x5c')]({'where':{'id':_0x3227f8[_0x2ab1('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x2ab1('0xa7'),'include':[{'model':db[_0x2ab1('0xa8')],'as':_0x2ab1('0xa9'),'where':{'fax':_0x583ce3},'limit':0x1,'order':[[_0x2ab1('0x9f'),_0x2ab1('0xaa')]]}]}]})[_0x2ab1('0x22')](handleEntityNotFound(_0x518afa,null))[_0x2ab1('0x22')](function(_0x407a52){_0x1e806d=_0x407a52;if(_0x3227f8[_0x2ab1('0x5e')]['attachments']&&_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')]['length']){for(var _0xb2c4db=0x0;_0xb2c4db<_0x3227f8['body']['attachments']['length'];_0xb2c4db+=0x1){_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')][_0xb2c4db]={'filename':_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')][_0xb2c4db][_0x2ab1('0x3c')],'id':_0x3227f8[_0x2ab1('0x5e')]['attachments'][_0xb2c4db]['id'],'path':path[_0x2ab1('0xac')](config[_0x2ab1('0xad')],_0x2ab1('0xae'),_0x3227f8[_0x2ab1('0x5e')]['attachments'][_0xb2c4db][_0x2ab1('0xaf')])};}}return respondWithRpcPromise(_0x2ab1('0xb0'),_0x2ab1('0xb0'),{'FaxAccountId':_[_0x2ab1('0xb1')](_0x3227f8[_0x2ab1('0x5b')]['id'])?undefined:_0x3227f8[_0x2ab1('0x5b')]['id'],'path':_[_0x2ab1('0xb1')](_0x3227f8['body']['attachments'][0x0][_0x2ab1('0x7')])?undefined:_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')][0x0][_0x2ab1('0x7')],'fax':_[_0x2ab1('0xb1')](_0x3227f8[_0x2ab1('0x5e')]['to'][0x0])?undefined:_0x3227f8['body']['to'][0x0]},client9002);})[_0x2ab1('0x22')](function(){if(_0x1e806d){if(_[_0x2ab1('0xb1')](_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xb2')])){_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xb2')]=util[_0x2ab1('0xa4')](_0x2ab1('0xb3'),_0x1e806d[_0x2ab1('0x3c')],_0x1e806d[_0x2ab1('0xb4')]);}if(_0x1e806d[_0x2ab1('0xa7')]){if(_0x1e806d[_0x2ab1('0xa7')]['Contacts'][_0x2ab1('0x4c')]){return _0x1e806d[_0x2ab1('0xa7')][_0x2ab1('0xa9')][0x0];}else{return db['CmContact'][_0x2ab1('0x5d')](_[_0x2ab1('0xb5')](_0x3227f8[_0x2ab1('0x5e')],{'firstName':_0x3227f8[_0x2ab1('0x5e')]['to'][0x0],'phone':_0x3227f8[_0x2ab1('0x5e')]['to'][0x0],'fax':_0x3227f8['body']['to'][0x0],'ListId':_0x1e806d[_0x2ab1('0xb6')]}));}}else{throw new Error(_0x2ab1('0xb7'));}}else{throw new Error(_0x2ab1('0xb8'));}})['then'](function(_0x4e0258){if(_0x4e0258){return db[_0x2ab1('0x71')][_0x2ab1('0x5c')]({'where':{'ContactId':_0x4e0258['id'],'closed':![],'FaxAccountId':_0x1e806d['id']}})[_0x2ab1('0x22')](function(_0x2aaeab){if(_0x2aaeab){return[_0x2aaeab,![]];}return db[_0x2ab1('0x71')][_0x2ab1('0x5d')]({'UserId':_0x3227f8[_0x2ab1('0x60')]['id'],'ContactId':_0x4e0258['id'],'FaxAccountId':_0x1e806d['id'],'fax':_0x3227f8[_0x2ab1('0x5e')]['to'][0x0],'firstMsgDirection':_0x2ab1('0xb9'),'Messages':[_['merge'](_0x3227f8['body'],{'read':![],'body':_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')][0x0]['filename'],'FaxAccountId':_0x1e806d['id'],'UserId':_0x3227f8[_0x2ab1('0x60')]['id'],'ContactId':_0x4e0258['id'],'AttachmentId':_0x3227f8['body'][_0x2ab1('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x2ab1('0xba')}]})[_0x2ab1('0x22')](function(_0x3f130f){return[_0x3f130f,!![]];});});}else{throw new Error(_0x2ab1('0xbb'));}})['spread'](function(_0x50a0bd,_0x3b32ff){if(_0x3b32ff){return _0x50a0bd;}return db[_0x2ab1('0xa6')][_0x2ab1('0x5d')]({'direction':'out','read':![],'body':_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')][0x0][_0x2ab1('0xbc')],'FaxAccountId':_0x1e806d['id'],'FaxInteractionId':_0x50a0bd['id'],'UserId':_0x3227f8[_0x2ab1('0x60')]['id'],'ContactId':_0x50a0bd[_0x2ab1('0xbd')],'AttachmentId':_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')][0x0]['id']})[_0x2ab1('0x22')](function(_0x8e7a84){_0x50a0bd[_0x2ab1('0xbe')][_0x2ab1('0xba')]=[];_0x50a0bd['dataValues'][_0x2ab1('0xba')][_0x2ab1('0x8b')](_0x8e7a84[_0x2ab1('0xbe')]);return _0x50a0bd;});})[_0x2ab1('0x22')](function(_0x4ff5de){respondWithRpcPromise(_0x2ab1('0xbf'),_0x2ab1('0xbf'),{'FaxAccountId':_['isNil'](_0x3227f8[_0x2ab1('0x5b')]['id'])?undefined:_0x3227f8['params']['id'],'path':_[_0x2ab1('0xb1')](_0x3227f8[_0x2ab1('0x5e')]['attachments'][0x0][_0x2ab1('0x7')])?undefined:_0x3227f8[_0x2ab1('0x5e')][_0x2ab1('0xab')][0x0][_0x2ab1('0x7')],'fax':_[_0x2ab1('0xb1')](_0x3227f8['body']['to'][0x0])?undefined:_0x3227f8['body']['to'][0x0],'AttachmentId':_0x3227f8[_0x2ab1('0x5e')]['attachments'][0x0]['id']},client9002)['then'](function(_0x1157c4){logger[_0x2ab1('0x2b')](_0x2ab1('0xc0'),_0x1157c4);})[_0x2ab1('0x2c')](function(_0x3eee32){logger['info'](_0x2ab1('0xc0'),_0x3eee32);});return _0x4ff5de;})[_0x2ab1('0x22')](respondWithResult(_0x518afa,null))[_0x2ab1('0x2c')](handleError(_0x518afa,null));};exports['addAgents']=function(_0x48ee3d,_0x582cee,_0x40a002){return db[_0x2ab1('0x42')][_0x2ab1('0x5c')]({'where':{'id':_0x48ee3d[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x582cee,null))[_0x2ab1('0x22')](function(_0x5bb401){if(_0x5bb401){return _0x5bb401['addAgents'](_0x48ee3d[_0x2ab1('0x5e')][_0x2ab1('0x6c')],_[_0x2ab1('0x72')](_0x48ee3d[_0x2ab1('0x5e')],[_0x2ab1('0x6c'),'id'])||{})[_0x2ab1('0xc1')](function(_0x285553){for(var _0x4ec111=0x0;_0x4ec111<_0x48ee3d[_0x2ab1('0x5e')][_0x2ab1('0x6c')][_0x2ab1('0x4c')];_0x4ec111+=0x1){socket['emit'](_0x2ab1('0xc2'),{'UserId':Number(_0x48ee3d[_0x2ab1('0x5e')][_0x2ab1('0x6c')][_0x4ec111]),'FaxAccountId':Number(_0x48ee3d[_0x2ab1('0x5b')]['id'])});}return _0x285553;});}})[_0x2ab1('0x22')](respondWithResult(_0x582cee,null))[_0x2ab1('0x2c')](handleError(_0x582cee,null));};exports[_0x2ab1('0xc3')]=function(_0x2580dc,_0x19cc64,_0xf7c537){return db['FaxAccount'][_0x2ab1('0x5c')]({'where':{'id':_0x2580dc[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x19cc64,null))[_0x2ab1('0x22')](function(_0x335287){if(_0x335287){return _0x335287[_0x2ab1('0xc3')](_0x2580dc['query']['ids'])['then'](function(){if(_[_0x2ab1('0xc4')](_0x2580dc[_0x2ab1('0x46')][_0x2ab1('0x6c')])){for(var _0x871d29=0x0;_0x871d29<_0x2580dc[_0x2ab1('0x46')][_0x2ab1('0x6c')][_0x2ab1('0x4c')];_0x871d29+=0x1){socket[_0x2ab1('0xc5')](_0x2ab1('0xc6'),{'UserId':Number(_0x2580dc['query'][_0x2ab1('0x6c')][_0x871d29]),'FaxAccountId':Number(_0x2580dc['params']['id'])});}}else{socket[_0x2ab1('0xc5')](_0x2ab1('0xc6'),{'UserId':Number(_0x2580dc['query'][_0x2ab1('0x6c')]),'FaxAccountId':Number(_0x2580dc['params']['id'])});}});}})[_0x2ab1('0x22')](respondWithStatusCode(_0x19cc64,null))[_0x2ab1('0x2c')](handleError(_0x19cc64,null));};exports[_0x2ab1('0xc7')]=function(_0x11506,_0x1bb5c3,_0x5dfc4c){var _0xb99c8f={};var _0x33ea99={};var _0x1169ce;var _0x1b9a45;return db[_0x2ab1('0x42')]['findOne']({'where':{'id':_0x11506[_0x2ab1('0x5b')]['id']}})[_0x2ab1('0x22')](handleEntityNotFound(_0x1bb5c3,null))['then'](function(_0x3ee983){if(_0x3ee983){_0x1169ce=_0x3ee983;_0x33ea99[_0x2ab1('0x45')]=_['keys'](db[_0x2ab1('0x74')][_0x2ab1('0x43')]);_0x33ea99['query']=_[_0x2ab1('0x47')](_0x11506[_0x2ab1('0x46')]);_0x33ea99[_0x2ab1('0x48')]=_[_0x2ab1('0x49')](_0x33ea99['model'],_0x33ea99[_0x2ab1('0x46')]);_0xb99c8f['attributes']=_[_0x2ab1('0x49')](_0x33ea99[_0x2ab1('0x45')],qs['fields'](_0x11506[_0x2ab1('0x46')][_0x2ab1('0x4b')]));_0xb99c8f[_0x2ab1('0x4a')]=_0xb99c8f[_0x2ab1('0x4a')][_0x2ab1('0x4c')]?_0xb99c8f[_0x2ab1('0x4a')]:_0x33ea99[_0x2ab1('0x45')];_0xb99c8f['order']=qs[_0x2ab1('0x4f')](_0x11506[_0x2ab1('0x46')][_0x2ab1('0x4f')]);_0xb99c8f[_0x2ab1('0x50')]=qs[_0x2ab1('0x48')](_['pick'](_0x11506[_0x2ab1('0x46')],_0x33ea99[_0x2ab1('0x48')]));if(_0x11506[_0x2ab1('0x46')][_0x2ab1('0x53')]){_0xb99c8f['where']=_[_0x2ab1('0x54')](_0xb99c8f[_0x2ab1('0x50')],{'$or':_[_0x2ab1('0x41')](_0xb99c8f[_0x2ab1('0x4a')],function(_0x441305){var _0x3be587={};_0x3be587[_0x441305]={'$like':'%'+_0x11506[_0x2ab1('0x46')][_0x2ab1('0x53')]+'%'};return _0x3be587;})});}_0xb99c8f=_[_0x2ab1('0x54')]({},_0xb99c8f,_0x11506['options']);return _0x1169ce[_0x2ab1('0xc7')](_0xb99c8f);}})['then'](function(_0x3c07ae){if(_0x3c07ae){_0x1b9a45=_0x3c07ae['length'];if(!_0x11506['query'][_0x2ab1('0x6a')]('nolimit')){_0xb99c8f[_0x2ab1('0x32')]=qs[_0x2ab1('0x32')](_0x11506['query']['limit']);_0xb99c8f[_0x2ab1('0x34')]=qs['offset'](_0x11506[_0x2ab1('0x46')][_0x2ab1('0x34')]);}return _0x1169ce[_0x2ab1('0xc7')](_0xb99c8f);}})[_0x2ab1('0x22')](function(_0x2104be){if(_0x2104be){return _0x2104be?{'count':_0x1b9a45,'rows':_0x2104be}:null;}})[_0x2ab1('0x22')](respondWithResult(_0x1bb5c3,null))[_0x2ab1('0x2c')](handleError(_0x1bb5c3,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 0ae143c..1d86cda 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 _0x5f3f=['hasOwnProperty','hook','FaxAccount','setMaxListeners','update','emit'];(function(_0x2664af,_0x187abd){var _0x24def2=function(_0x1fca78){while(--_0x1fca78){_0x2664af['push'](_0x2664af['shift']());}};_0x24def2(++_0x187abd);}(_0x5f3f,0x6e));var _0xf5f3=function(_0x348ea7,_0x591405){_0x348ea7=_0x348ea7-0x0;var _0x5eafdf=_0x5f3f[_0x348ea7];return _0x5eafdf;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xf5f3('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf5f3('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf5f3('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3dade4){return function(_0x20d5df,_0x2a4416,_0x149cd1){FaxAccountEvents[_0xf5f3('0x3')](_0x3dade4+':'+_0x20d5df['id'],_0x20d5df);FaxAccountEvents[_0xf5f3('0x3')](_0x3dade4,_0x20d5df);_0x149cd1(null);};}for(var e in events){if(events[_0xf5f3('0x4')](e)){var event=events[e];FaxAccount[_0xf5f3('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xd384=['hook','exports','events','../../mysqldb','FaxAccount','save','update','emit','hasOwnProperty'];(function(_0x2e7a25,_0x1df04f){var _0x1be634=function(_0x5a0ba2){while(--_0x5a0ba2){_0x2e7a25['push'](_0x2e7a25['shift']());}};_0x1be634(++_0x1df04f);}(_0xd384,0x1df));var _0x4d38=function(_0xda06e4,_0x4263f4){_0xda06e4=_0xda06e4-0x0;var _0x303420=_0xd384[_0xda06e4];return _0x303420;};'use strict';var EventEmitter=require(_0x4d38('0x0'));var FaxAccount=require(_0x4d38('0x1'))['db'][_0x4d38('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d38('0x3'),'afterUpdate':_0x4d38('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2aaf00){return function(_0x7f1a75,_0x425f51,_0xa2b93f){FaxAccountEvents[_0x4d38('0x5')](_0x2aaf00+':'+_0x7f1a75['id'],_0x7f1a75);FaxAccountEvents[_0x4d38('0x5')](_0x2aaf00,_0x7f1a75);_0xa2b93f(null);};}for(var e in events){if(events[_0x4d38('0x6')](e)){var event=events[e];FaxAccount[_0x4d38('0x7')](e,emitEvent(event));}}module[_0x4d38('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 36e90be..6a50e46 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 _0x5914=['../../config/environment','./faxAccount.attributes','define','fax_accounts','util','api','moment','bluebird','path','rimraf'];(function(_0x32cea6,_0x2e7a32){var _0x5dcf25=function(_0x3d63c9){while(--_0x3d63c9){_0x32cea6['push'](_0x32cea6['shift']());}};_0x5dcf25(++_0x2e7a32);}(_0x5914,0x130));var _0x4591=function(_0x120a65,_0x434f79){_0x120a65=_0x120a65-0x0;var _0x3a4066=_0x5914[_0x120a65];return _0x3a4066;};'use strict';var _=require('lodash');var util=require(_0x4591('0x0'));var logger=require('../../config/logger')(_0x4591('0x1'));var moment=require(_0x4591('0x2'));var BPromise=require(_0x4591('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4591('0x4'));var rimraf=require(_0x4591('0x5'));var config=require(_0x4591('0x6'));var attributes=require(_0x4591('0x7'));module['exports']=function(_0x2ac257,_0x4d7307){return _0x2ac257[_0x4591('0x8')]('FaxAccount',attributes,{'tableName':_0x4591('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb947=['fax_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb947,0x146));var _0x7b94=function(_0x135f31,_0xf2bafd){_0x135f31=_0x135f31-0x0;var _0x32be18=_0xb947[_0x135f31];return _0x32be18;};'use strict';var _=require('lodash');var util=require(_0x7b94('0x0'));var logger=require(_0x7b94('0x1'))(_0x7b94('0x2'));var moment=require('moment');var BPromise=require(_0x7b94('0x3'));var rp=require(_0x7b94('0x4'));var fs=require('fs');var path=require(_0x7b94('0x5'));var rimraf=require(_0x7b94('0x6'));var config=require(_0x7b94('0x7'));var attributes=require(_0x7b94('0x8'));module[_0x7b94('0x9')]=function(_0x4a2bda,_0x19ae94){return _0x4a2bda[_0x7b94('0xa')](_0x7b94('0xb'),attributes,{'tableName':_0x7b94('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 4e6ca9e..bf8ce48 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 _0x630f=['queue','waitForTheAssignedQueue','*,*,*,*','Start','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','model','include','body','fax','CmContact','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','get','applications','Applications','list','orderBy','priority','length','ListId','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','unmanaged','created','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x630f,0x1d5));var _0xf630=function(_0x5eaaf5,_0x20d65c){_0x5eaaf5=_0x5eaaf5-0x0;var _0x3df207=_0x630f[_0x5eaaf5];return _0x3df207;};'use strict';var _=require(_0xf630('0x0'));var util=require('util');var moment=require(_0xf630('0x1'));var BPromise=require(_0xf630('0x2'));var rs=require(_0xf630('0x3'));var fs=require('fs');var Redis=require(_0xf630('0x4'));var db=require(_0xf630('0x5'))['db'];var utils=require(_0xf630('0x6'));var logger=require(_0xf630('0x7'))(_0xf630('0x8'));var config=require('../../config/environment');var jayson=require(_0xf630('0x9'));var client=jayson[_0xf630('0xa')]['http']({'port':0x232c});config[_0xf630('0xb')]=_['defaults'](config[_0xf630('0xb')],{'host':_0xf630('0xc'),'port':0x18eb});var socket=require(_0xf630('0xd'))(new Redis(config[_0xf630('0xb')]));require('./faxAccount.socket')[_0xf630('0xe')](socket);function respondWithRpcPromise(_0x2448bd,_0x28265a,_0x56e788){return new BPromise(function(_0x13994b,_0x14c712){return client[_0xf630('0xf')](_0x2448bd,_0x56e788)[_0xf630('0x10')](function(_0x518fbb){logger[_0xf630('0x11')](_0xf630('0x12'),_0x28265a,'request\x20sent');logger[_0xf630('0x13')](_0xf630('0x14'),_0x28265a,_0xf630('0x15'),JSON[_0xf630('0x16')](_0x518fbb));if(_0x518fbb[_0xf630('0x17')]){if(_0x518fbb[_0xf630('0x17')][_0xf630('0x18')]===0x1f4){logger[_0xf630('0x17')]('FaxAccount,\x20%s,\x20%s',_0x28265a,_0x518fbb[_0xf630('0x17')]['message']);return _0x14c712(_0x518fbb['error'][_0xf630('0x19')]);}logger['error'](_0xf630('0x12'),_0x28265a,_0x518fbb[_0xf630('0x17')][_0xf630('0x19')]);return _0x13994b(_0x518fbb[_0xf630('0x17')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x28265a,'request\x20sent');_0x13994b(_0x518fbb[_0xf630('0x1a')][_0xf630('0x19')]);}})[_0xf630('0x1b')](function(_0x3c6a2c){logger[_0xf630('0x17')](_0xf630('0x12'),_0x28265a,_0x3c6a2c);_0x14c712(_0x3c6a2c);});});}exports[_0xf630('0x1c')]=function(_0x4063cd){var _0x1cdf30=this;return new Promise(function(_0x3e42d9,_0x4ebcdb){return db[_0xf630('0x1d')][_0xf630('0x1e')]({'raw':_0x4063cd['options']?_0x4063cd[_0xf630('0x1f')][_0xf630('0x20')]===undefined?!![]:![]:!![],'where':_0x4063cd[_0xf630('0x1f')]?_0x4063cd[_0xf630('0x1f')][_0xf630('0x21')]||null:null,'attributes':_0x4063cd['options']?_0x4063cd[_0xf630('0x1f')][_0xf630('0x22')]||null:null,'limit':_0x4063cd[_0xf630('0x1f')]?_0x4063cd[_0xf630('0x1f')][_0xf630('0x23')]||null:null,'include':_0x4063cd[_0xf630('0x1f')]?_0x4063cd[_0xf630('0x1f')]['include']?_[_0xf630('0x24')](_0x4063cd[_0xf630('0x1f')]['include'],function(_0x1bddbd){return{'model':db[_0x1bddbd[_0xf630('0x25')]],'as':_0x1bddbd['as'],'attributes':_0x1bddbd[_0xf630('0x22')],'include':_0x1bddbd[_0xf630('0x26')]?_['map'](_0x1bddbd[_0xf630('0x26')],function(_0x5bb6b9){return{'model':db[_0x5bb6b9['model']],'as':_0x5bb6b9['as'],'attributes':_0x5bb6b9[_0xf630('0x22')],'include':_0x5bb6b9[_0xf630('0x26')]?_['map'](_0x5bb6b9[_0xf630('0x26')],function(_0x461362){return{'model':db[_0x461362[_0xf630('0x25')]],'as':_0x461362['as'],'attributes':_0x461362[_0xf630('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf630('0x10')](function(_0x5c1a30){logger['info'](_0xf630('0x1c'),_0x4063cd);logger[_0xf630('0x13')](_0xf630('0x1c'),_0x4063cd,JSON[_0xf630('0x16')](_0x5c1a30));_0x3e42d9(_0x5c1a30);})[_0xf630('0x1b')](function(_0xa29465){logger[_0xf630('0x17')](_0xf630('0x1c'),_0xa29465['message'],_0x4063cd);_0x4ebcdb(_0x1cdf30[_0xf630('0x17')](0x1f4,_0xa29465['message']));});});};exports['NotifyFaxAccount']=function(_0x3a90e3,_0x3742ee,_0xb21912){var _0x4420a1=this;return new Promise(function(_0x2bd6c1,_0x578416){var _0x425ef6={'body':_0x3a90e3[_0xf630('0x27')],'channel':_0xf630('0x28')};var _0x42c934=[];var _0x37c339=[];var _0x2f1529={};return db[_0xf630('0x29')]['describe']()[_0xf630('0x10')](function(_0x38c1c6){if(!_0x38c1c6){throw new db[(_0xf630('0x2a'))]['ValidationError'](_0xf630('0x2b'));}_0x42c934=_[_0xf630('0x2c')](_[_0xf630('0x2d')](_0x38c1c6),['createdAt',_0xf630('0x2e')]);_0x37c339=_[_0xf630('0x2c')](_[_0xf630('0x2d')](_0x38c1c6),[_0xf630('0x2f'),_0xf630('0x2e'),_0xf630('0x30'),'ListId']);if(_0x3a90e3['body']['id']){delete _0x3a90e3['body']['id'];}if(_[_0xf630('0x31')](_0x3a90e3[_0xf630('0x27')][_0xf630('0x32')])){throw new db[(_0xf630('0x2a'))][(_0xf630('0x33'))](_0xf630('0x34'));}if(_[_0xf630('0x31')](_0x3a90e3['body'][_0xf630('0x27')])||_0x3a90e3[_0xf630('0x27')][_0xf630('0x27')]===''){throw new db['Sequelize']['ValidationError'](_0xf630('0x35'));}if(_['isNil'](_0x3a90e3[_0xf630('0x27')][_0xf630('0x36')])){throw new db[(_0xf630('0x2a'))][(_0xf630('0x33'))](_0xf630('0x37')+_0x37c339);}if(!_[_0xf630('0x38')](_0x37c339,_0x3a90e3['body'][_0xf630('0x36')])){throw new db['Sequelize'][(_0xf630('0x33'))](_0xf630('0x39')+_0x37c339);}_0x2f1529[_0x3a90e3['body']['mapKey']]=_0x3a90e3[_0xf630('0x27')]['from'];})[_0xf630('0x10')](function(){return db[_0xf630('0x1d')]['find']({'where':{'id':_0x3a90e3[_0xf630('0x3a')]['id']},'include':[{'model':db[_0xf630('0x3b')],'as':_0xf630('0x3c'),'include':[{'model':db[_0xf630('0x29')],'as':_0xf630('0x3d'),'where':_0x2f1529,'limit':0x1,'order':[[_0xf630('0x2e'),_0xf630('0x3e')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xf630('0x10')](function(_0x1de63e){if(_0x1de63e&&_0x1de63e[_0xf630('0x3c')]){var _0x2daa22=_0x1de63e[_0xf630('0x3f')]({'plain':!![]});_0x425ef6[_0xf630('0x3a')]=_0x2daa22;_0x425ef6[_0xf630('0x40')]=_0x2daa22[_0xf630('0x41')];_0x425ef6[_0xf630('0x42')]=_0x2daa22[_0xf630('0x3c')];_0x425ef6[_0xf630('0x40')]=_[_0xf630('0x43')](_0x425ef6[_0xf630('0x40')],[_0xf630('0x44')],['asc']);if(_0x425ef6[_0xf630('0x3a')]['Applications']){delete _0x425ef6[_0xf630('0x3a')][_0xf630('0x41')];}if(_0x425ef6[_0xf630('0x3a')][_0xf630('0x3c')]&&_0x425ef6[_0xf630('0x3a')][_0xf630('0x3c')]['Contacts'][_0xf630('0x45')]){return _0x425ef6[_0xf630('0x3a')]['List'][_0xf630('0x3d')][0x0];}var _0x1bf4cc=_['defaults'](_0x3a90e3['body'],{'firstName':_0x3a90e3[_0xf630('0x27')][_0xf630('0x32')],'ListId':_0x2daa22[_0xf630('0x46')]});_0x1bf4cc[_0x3a90e3['body'][_0xf630('0x36')]]=_0x3a90e3[_0xf630('0x27')][_0xf630('0x32')];return db['CmContact'][_0xf630('0x47')](_0x1bf4cc,{'fields':_0x42c934,'raw':!![]});}})[_0xf630('0x10')](function(_0x311459){_0x425ef6[_0xf630('0x48')]=_0x311459;if(_0x311459){var _0x13c0df={'ContactId':_0x311459['id'],'FaxAccountId':_0x3a90e3['account']['id'],'fax':_0x311459['fax']};return db[_0xf630('0x49')][_0xf630('0x4a')]({'where':{'ContactId':_0x311459['id'],'closed':![],'FaxAccountId':_0x3a90e3[_0xf630('0x3a')]['id']}})[_0xf630('0x10')](function(_0x478e76){if(_0x478e76){return[_0x478e76,![]];}return db[_0xf630('0x49')][_0xf630('0x47')](_0x13c0df)[_0xf630('0x10')](function(_0x1e86c8){return[_0x1e86c8,!![]];});});}else{throw new Error(_0xf630('0x4b'));}})[_0xf630('0x4c')](function(_0x3d1a21,_0x39a780){var _0x89879f=_0x3d1a21[_0xf630('0x3f')]({'plain':!![]});if(_0x39a780){if(_0x425ef6[_0xf630('0x3a')][_0xf630('0x4d')]){_0x425ef6[_0xf630('0x40')][_0xf630('0x4e')]({'id':0x0,'priority':_0x425ef6[_0xf630('0x40')][_0xf630('0x45')]+0x1,'app':'close','appdata':_0xf630('0x4f'),'interval':'*,*,*,*'});}_0x89879f[_0xf630('0x50')]=!![];}else{_0x89879f[_0xf630('0x50')]=![];}_0x425ef6['interaction']=_0x89879f;return db['FaxMessage']['create']({'body':_0x3a90e3[_0xf630('0x27')][_0xf630('0x27')],'FaxAccountId':_0x3a90e3[_0xf630('0x3a')]['id'],'FaxInteractionId':_0x3d1a21['id'],'direction':'in','ContactId':_0x3d1a21['ContactId'],'AttachmentId':_0x3a90e3[_0xf630('0x27')]['AttachmentId']});})[_0xf630('0x10')](function(_0x389df4){_0x425ef6[_0xf630('0x19')]=_0x389df4;if(!_0x425ef6[_0xf630('0x51')][_0xf630('0x52')])return;return db[_0xf630('0x53')][_0xf630('0x4a')]({'attributes':['id',_0xf630('0x54')],'where':{'id':_0x425ef6[_0xf630('0x51')][_0xf630('0x52')]}});})[_0xf630('0x10')](function(_0x1d2d24){if(_0x1d2d24){_0x425ef6[_0xf630('0x40')][_0xf630('0x55')]({'id':0x0,'priority':0x0,'app':_0xf630('0x56'),'appdata':_0x1d2d24[_0xf630('0x54')]+','+(_0x425ef6['account'][_0xf630('0x57')]||0xa),'interval':'*,*,*,*'});}if(!_0x425ef6[_0xf630('0x51')][_0xf630('0x58')])return;return db['FaxQueue'][_0xf630('0x4a')]({'attributes':['id','name'],'where':{'id':_0x425ef6[_0xf630('0x51')][_0xf630('0x58')]}});})['then'](function(_0x1ed3a2){if(_0x1ed3a2){_0x425ef6[_0xf630('0x40')][_0xf630('0x55')]({'id':0x0,'priority':0x1,'app':_0xf630('0x59'),'appdata':_0x1ed3a2[_0xf630('0x54')]+','+(_0x425ef6[_0xf630('0x3a')][_0xf630('0x5a')]||0x12c),'interval':_0xf630('0x5b')});}return respondWithRpcPromise(_0xf630('0x5c'),'startRouting',_0x425ef6);})[_0xf630('0x10')](function(_0x17433b){_0x2bd6c1(_0x17433b);})[_0xf630('0x1b')](function(_0x3a57ff){_0x578416(_0x4420a1[_0xf630('0x17')](0x1f4,_0x3a57ff[_0xf630('0x19')]));});});}; \ No newline at end of file +var _0xc700=['CmContact','FaxApplication','Applications','get','list','List','applications','orderBy','asc','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','length','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','FaxQueue','queueId','queue','waitForTheAssignedQueue','startRouting','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include','map','model','attributes','NotifyFaxAccount','body','fax','describe','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account'];(function(_0x4aeb4d,_0x923c0c){var _0x4ec151=function(_0x5a3353){while(--_0x5a3353){_0x4aeb4d['push'](_0x4aeb4d['shift']());}};_0x4ec151(++_0x923c0c);}(_0xc700,0x127));var _0x0c70=function(_0x57fe80,_0x142867){_0x57fe80=_0x57fe80-0x0;var _0x29801e=_0xc700[_0x57fe80];return _0x29801e;};'use strict';var _=require(_0x0c70('0x0'));var util=require(_0x0c70('0x1'));var moment=require('moment');var BPromise=require(_0x0c70('0x2'));var rs=require(_0x0c70('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c70('0x4'));var logger=require(_0x0c70('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0c70('0x6'));var client=jayson[_0x0c70('0x7')][_0x0c70('0x8')]({'port':0x232c});config[_0x0c70('0x9')]=_[_0x0c70('0xa')](config[_0x0c70('0x9')],{'host':_0x0c70('0xb'),'port':0x18eb});var socket=require(_0x0c70('0xc'))(new Redis(config[_0x0c70('0x9')]));require('./faxAccount.socket')[_0x0c70('0xd')](socket);function respondWithRpcPromise(_0x40f911,_0x5988d2,_0x489b62){return new BPromise(function(_0x525bdc,_0x43e885){return client[_0x0c70('0xe')](_0x40f911,_0x489b62)[_0x0c70('0xf')](function(_0x51835b){logger[_0x0c70('0x10')](_0x0c70('0x11'),_0x5988d2,'request\x20sent');logger[_0x0c70('0x12')](_0x0c70('0x13'),_0x5988d2,_0x0c70('0x14'),JSON[_0x0c70('0x15')](_0x51835b));if(_0x51835b[_0x0c70('0x16')]){if(_0x51835b['error'][_0x0c70('0x17')]===0x1f4){logger[_0x0c70('0x16')](_0x0c70('0x11'),_0x5988d2,_0x51835b[_0x0c70('0x16')][_0x0c70('0x18')]);return _0x43e885(_0x51835b[_0x0c70('0x16')]['message']);}logger[_0x0c70('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5988d2,_0x51835b[_0x0c70('0x16')][_0x0c70('0x18')]);return _0x525bdc(_0x51835b[_0x0c70('0x16')][_0x0c70('0x18')]);}else{logger[_0x0c70('0x10')](_0x0c70('0x11'),_0x5988d2,'request\x20sent');_0x525bdc(_0x51835b[_0x0c70('0x19')][_0x0c70('0x18')]);}})[_0x0c70('0x1a')](function(_0x441bfd){logger[_0x0c70('0x16')](_0x0c70('0x11'),_0x5988d2,_0x441bfd);_0x43e885(_0x441bfd);});});}exports[_0x0c70('0x1b')]=function(_0x79c1fd){var _0x397d7c=this;return new Promise(function(_0x1d8a2b,_0x131ccf){return db[_0x0c70('0x1c')][_0x0c70('0x1d')]({'raw':_0x79c1fd[_0x0c70('0x1e')]?_0x79c1fd[_0x0c70('0x1e')][_0x0c70('0x1f')]===undefined?!![]:![]:!![],'where':_0x79c1fd['options']?_0x79c1fd[_0x0c70('0x1e')][_0x0c70('0x20')]||null:null,'attributes':_0x79c1fd['options']?_0x79c1fd[_0x0c70('0x1e')]['attributes']||null:null,'limit':_0x79c1fd['options']?_0x79c1fd['options'][_0x0c70('0x21')]||null:null,'include':_0x79c1fd[_0x0c70('0x1e')]?_0x79c1fd[_0x0c70('0x1e')][_0x0c70('0x22')]?_[_0x0c70('0x23')](_0x79c1fd[_0x0c70('0x1e')][_0x0c70('0x22')],function(_0x130ab6){return{'model':db[_0x130ab6[_0x0c70('0x24')]],'as':_0x130ab6['as'],'attributes':_0x130ab6['attributes'],'include':_0x130ab6[_0x0c70('0x22')]?_[_0x0c70('0x23')](_0x130ab6[_0x0c70('0x22')],function(_0xba86d){return{'model':db[_0xba86d[_0x0c70('0x24')]],'as':_0xba86d['as'],'attributes':_0xba86d['attributes'],'include':_0xba86d['include']?_['map'](_0xba86d[_0x0c70('0x22')],function(_0x5b5a6d){return{'model':db[_0x5b5a6d[_0x0c70('0x24')]],'as':_0x5b5a6d['as'],'attributes':_0x5b5a6d[_0x0c70('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0c70('0xf')](function(_0x3da54b){logger[_0x0c70('0x10')](_0x0c70('0x1b'),_0x79c1fd);logger['debug'](_0x0c70('0x1b'),_0x79c1fd,JSON[_0x0c70('0x15')](_0x3da54b));_0x1d8a2b(_0x3da54b);})[_0x0c70('0x1a')](function(_0x1654e9){logger['error'](_0x0c70('0x1b'),_0x1654e9['message'],_0x79c1fd);_0x131ccf(_0x397d7c[_0x0c70('0x16')](0x1f4,_0x1654e9['message']));});});};exports[_0x0c70('0x26')]=function(_0x5f0d1c,_0x1481c1,_0x4a0321){var _0x1682e7=this;return new Promise(function(_0x4185d1,_0x9423fe){var _0x55ee04={'body':_0x5f0d1c[_0x0c70('0x27')],'channel':_0x0c70('0x28')};var _0xc403a8=[];var _0x2ec9d9=[];var _0x27d435={};return db['CmContact'][_0x0c70('0x29')]()[_0x0c70('0xf')](function(_0x5db9ea){if(!_0x5db9ea){throw new db['Sequelize'][(_0x0c70('0x2a'))]('no\x20available\x20attributes');}_0xc403a8=_[_0x0c70('0x2b')](_[_0x0c70('0x2c')](_0x5db9ea),[_0x0c70('0x2d'),_0x0c70('0x2e')]);_0x2ec9d9=_[_0x0c70('0x2b')](_[_0x0c70('0x2c')](_0x5db9ea),['createdAt',_0x0c70('0x2e'),_0x0c70('0x2f'),'ListId']);if(_0x5f0d1c[_0x0c70('0x27')]['id']){delete _0x5f0d1c[_0x0c70('0x27')]['id'];}if(_[_0x0c70('0x30')](_0x5f0d1c[_0x0c70('0x27')]['from'])){throw new db[(_0x0c70('0x31'))][(_0x0c70('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x0c70('0x30')](_0x5f0d1c[_0x0c70('0x27')]['body'])||_0x5f0d1c[_0x0c70('0x27')][_0x0c70('0x27')]===''){throw new db['Sequelize'][(_0x0c70('0x2a'))](_0x0c70('0x32'));}if(_['isNil'](_0x5f0d1c[_0x0c70('0x27')][_0x0c70('0x33')])){throw new db['Sequelize'][(_0x0c70('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ec9d9);}if(!_[_0x0c70('0x34')](_0x2ec9d9,_0x5f0d1c[_0x0c70('0x27')]['mapKey'])){throw new db[(_0x0c70('0x31'))][(_0x0c70('0x2a'))](_0x0c70('0x35')+_0x2ec9d9);}_0x27d435[_0x5f0d1c[_0x0c70('0x27')]['mapKey']]=_0x5f0d1c[_0x0c70('0x27')][_0x0c70('0x36')];})['then'](function(){return db[_0x0c70('0x1c')][_0x0c70('0x37')]({'where':{'id':_0x5f0d1c[_0x0c70('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0c70('0x39')],'as':'Contacts','where':_0x27d435,'limit':0x1,'order':[[_0x0c70('0x2e'),'DESC']]}]},{'model':db[_0x0c70('0x3a')],'as':_0x0c70('0x3b')}]});})[_0x0c70('0xf')](function(_0x38c804){if(_0x38c804&&_0x38c804['List']){var _0x4254e7=_0x38c804[_0x0c70('0x3c')]({'plain':!![]});_0x55ee04[_0x0c70('0x38')]=_0x4254e7;_0x55ee04['applications']=_0x4254e7[_0x0c70('0x3b')];_0x55ee04[_0x0c70('0x3d')]=_0x4254e7[_0x0c70('0x3e')];_0x55ee04[_0x0c70('0x3f')]=_[_0x0c70('0x40')](_0x55ee04[_0x0c70('0x3f')],['priority'],[_0x0c70('0x41')]);if(_0x55ee04['account'][_0x0c70('0x3b')]){delete _0x55ee04[_0x0c70('0x38')]['Applications'];}if(_0x55ee04[_0x0c70('0x38')]['List']&&_0x55ee04[_0x0c70('0x38')]['List']['Contacts']['length']){return _0x55ee04[_0x0c70('0x38')][_0x0c70('0x3e')]['Contacts'][0x0];}var _0x1695d5=_[_0x0c70('0xa')](_0x5f0d1c[_0x0c70('0x27')],{'firstName':_0x5f0d1c[_0x0c70('0x27')][_0x0c70('0x36')],'ListId':_0x4254e7['ListId']});_0x1695d5[_0x5f0d1c[_0x0c70('0x27')][_0x0c70('0x33')]]=_0x5f0d1c['body'][_0x0c70('0x36')];return db['CmContact'][_0x0c70('0x42')](_0x1695d5,{'fields':_0xc403a8,'raw':!![]});}})['then'](function(_0x28bad4){_0x55ee04[_0x0c70('0x43')]=_0x28bad4;if(_0x28bad4){var _0x57bb9c={'ContactId':_0x28bad4['id'],'FaxAccountId':_0x5f0d1c[_0x0c70('0x38')]['id'],'fax':_0x28bad4[_0x0c70('0x28')]};return db[_0x0c70('0x44')][_0x0c70('0x37')]({'where':{'ContactId':_0x28bad4['id'],'closed':![],'FaxAccountId':_0x5f0d1c[_0x0c70('0x38')]['id']}})[_0x0c70('0xf')](function(_0x453807){if(_0x453807){return[_0x453807,![]];}return db['FaxInteraction'][_0x0c70('0x42')](_0x57bb9c)[_0x0c70('0xf')](function(_0x3851c3){return[_0x3851c3,!![]];});});}else{throw new Error(_0x0c70('0x45'));}})['spread'](function(_0x137bad,_0x6a0689){var _0x1d3bd2=_0x137bad['get']({'plain':!![]});if(_0x6a0689){if(_0x55ee04[_0x0c70('0x38')][_0x0c70('0x46')]){_0x55ee04[_0x0c70('0x3f')]['push']({'id':0x0,'priority':_0x55ee04[_0x0c70('0x3f')][_0x0c70('0x47')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x1d3bd2[_0x0c70('0x48')]=!![];}else{_0x1d3bd2[_0x0c70('0x48')]=![];}_0x55ee04[_0x0c70('0x49')]=_0x1d3bd2;return db[_0x0c70('0x4a')][_0x0c70('0x42')]({'body':_0x5f0d1c[_0x0c70('0x27')][_0x0c70('0x27')],'FaxAccountId':_0x5f0d1c[_0x0c70('0x38')]['id'],'FaxInteractionId':_0x137bad['id'],'direction':'in','ContactId':_0x137bad[_0x0c70('0x4b')],'AttachmentId':_0x5f0d1c[_0x0c70('0x27')][_0x0c70('0x4c')]});})['then'](function(_0xe30543){_0x55ee04[_0x0c70('0x18')]=_0xe30543;if(!_0x55ee04[_0x0c70('0x49')][_0x0c70('0x4d')])return;return db[_0x0c70('0x4e')][_0x0c70('0x37')]({'attributes':['id',_0x0c70('0x4f')],'where':{'id':_0x55ee04['interaction'][_0x0c70('0x4d')]}});})[_0x0c70('0xf')](function(_0xb9aa75){if(_0xb9aa75){_0x55ee04[_0x0c70('0x3f')][_0x0c70('0x50')]({'id':0x0,'priority':0x0,'app':_0x0c70('0x51'),'appdata':_0xb9aa75[_0x0c70('0x4f')]+','+(_0x55ee04[_0x0c70('0x38')][_0x0c70('0x52')]||0xa),'interval':'*,*,*,*'});}if(!_0x55ee04['interaction']['queueId'])return;return db[_0x0c70('0x53')]['find']({'attributes':['id',_0x0c70('0x4f')],'where':{'id':_0x55ee04['interaction'][_0x0c70('0x54')]}});})['then'](function(_0x32cd79){if(_0x32cd79){_0x55ee04[_0x0c70('0x3f')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0c70('0x55'),'appdata':_0x32cd79[_0x0c70('0x4f')]+','+(_0x55ee04['account'][_0x0c70('0x56')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x0c70('0x57'),_0x55ee04);})['then'](function(_0x251a0b){_0x4185d1(_0x251a0b);})[_0x0c70('0x1a')](function(_0x17a9d3){_0x9423fe(_0x1682e7[_0x0c70('0x16')](0x1f4,_0x17a9d3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1fa8827..33f42b1 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 _0x7e26=['length','faxAccount:','./faxAccount.events','remove','emit','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7e26,0x16e));var _0x67e2=function(_0x2d2301,_0x11cf37){_0x2d2301=_0x2d2301-0x0;var _0x2d7f53=_0x7e26[_0x2d2301];return _0x2d7f53;};'use strict';var FaxAccountEvents=require(_0x67e2('0x0'));var events=['save',_0x67e2('0x1'),'update'];function createListener(_0x3c4521,_0x5a2cf6){return function(_0x2c902b){_0x5a2cf6[_0x67e2('0x2')](_0x3c4521,_0x2c902b);};}function removeListener(_0x3c03b8,_0x5ad834){return function(){FaxAccountEvents[_0x67e2('0x3')](_0x3c03b8,_0x5ad834);};}exports[_0x67e2('0x4')]=function(_0x43d1f7){for(var _0x6e036c=0x0,_0x494fef=events[_0x67e2('0x5')];_0x6e036c<_0x494fef;_0x6e036c++){var _0x19d37d=events[_0x6e036c];var _0x558801=createListener(_0x67e2('0x6')+_0x19d37d,_0x43d1f7);FaxAccountEvents['on'](_0x19d37d,_0x558801);}}; \ No newline at end of file +var _0xdc41=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x4e2612,_0x2b533e){var _0x40feb5=function(_0x329fae){while(--_0x329fae){_0x4e2612['push'](_0x4e2612['shift']());}};_0x40feb5(++_0x2b533e);}(_0xdc41,0x9c));var _0x1dc4=function(_0x146ea6,_0x58a67d){_0x146ea6=_0x146ea6-0x0;var _0x58dd0a=_0xdc41[_0x146ea6];return _0x58dd0a;};'use strict';var FaxAccountEvents=require(_0x1dc4('0x0'));var events=[_0x1dc4('0x1'),_0x1dc4('0x2'),_0x1dc4('0x3')];function createListener(_0x32cb3f,_0x3fa393){return function(_0x335fea){_0x3fa393[_0x1dc4('0x4')](_0x32cb3f,_0x335fea);};}function removeListener(_0x26e261,_0x501e71){return function(){FaxAccountEvents[_0x1dc4('0x5')](_0x26e261,_0x501e71);};}exports[_0x1dc4('0x6')]=function(_0x3782e6){for(var _0x36d2f5=0x0,_0x54dc31=events[_0x1dc4('0x7')];_0x36d2f5<_0x54dc31;_0x36d2f5++){var _0xda619a=events[_0x36d2f5];var _0x552e9d=createListener(_0x1dc4('0x8')+_0xda619a,_0x3782e6);FaxAccountEvents['on'](_0xda619a,_0x552e9d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c9fd52e..7835831 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 _0x264c=['/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','addDisposition','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAgents','multer','util','path','Router','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions'];(function(_0x5be2c7,_0x15a6cf){var _0x22ab54=function(_0x9871df){while(--_0x9871df){_0x5be2c7['push'](_0x5be2c7['shift']());}};_0x22ab54(++_0x15a6cf);}(_0x264c,0x119));var _0xc264=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x264c[_0x531d15];return _0x271a18;};'use strict';var multer=require(_0xc264('0x0'));var util=require(_0xc264('0x1'));var path=require(_0xc264('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc264('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc264('0x4'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xc264('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xc264('0x6')](),controller[_0xc264('0x7')]);router['get'](_0xc264('0x8'),auth[_0xc264('0x6')](),controller[_0xc264('0x9')]);router[_0xc264('0x5')](_0xc264('0xa'),auth[_0xc264('0x6')](),controller[_0xc264('0xb')]);router[_0xc264('0x5')](_0xc264('0xc'),auth[_0xc264('0x6')](),controller[_0xc264('0xd')]);router['get']('/:id/interactions',auth[_0xc264('0x6')](),controller[_0xc264('0xe')]);router[_0xc264('0x5')](_0xc264('0xf'),auth[_0xc264('0x6')](),controller[_0xc264('0x10')]);router[_0xc264('0x5')](_0xc264('0x11'),auth['isAuthenticated'](),controller[_0xc264('0x12')]);router[_0xc264('0x5')]('/:id/users',auth['isAuthenticated'](),controller[_0xc264('0x13')]);router['post']('/',auth[_0xc264('0x6')](),controller['create']);router[_0xc264('0x14')](_0xc264('0xa'),auth[_0xc264('0x6')](),controller[_0xc264('0x15')]);router[_0xc264('0x14')](_0xc264('0xc'),auth['isAuthenticated'](),controller[_0xc264('0x16')]);router['post']('/:id/interactions',auth[_0xc264('0x6')](),controller[_0xc264('0x17')]);router[_0xc264('0x14')]('/:id/applications',auth[_0xc264('0x6')](),controller['addApplications']);router[_0xc264('0x14')](_0xc264('0x18'),auth[_0xc264('0x6')](),controller[_0xc264('0x19')]);router['post'](_0xc264('0x1a'),auth[_0xc264('0x6')](),controller[_0xc264('0x1b')]);router[_0xc264('0x14')](_0xc264('0x1c'),auth[_0xc264('0x6')](),controller[_0xc264('0x1d')]);router[_0xc264('0x14')](_0xc264('0x1e'),auth[_0xc264('0x6')](),controller[_0xc264('0x1f')]);router[_0xc264('0x20')](_0xc264('0x8'),auth[_0xc264('0x6')](),controller[_0xc264('0x21')]);router[_0xc264('0x22')](_0xc264('0x8'),auth[_0xc264('0x6')](),controller['destroy']);router[_0xc264('0x22')]('/:id/dispositions',auth[_0xc264('0x6')](),controller[_0xc264('0x23')]);router['delete'](_0xc264('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xc264('0x22')](_0xc264('0x1e'),auth[_0xc264('0x6')](),controller[_0xc264('0x24')]);module['exports']=router; \ No newline at end of file +var _0x3f9f=['/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5660b4,_0x452353){var _0x451402=function(_0x4b2638){while(--_0x4b2638){_0x5660b4['push'](_0x5660b4['shift']());}};_0x451402(++_0x452353);}(_0x3f9f,0xf2));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf3f9('0x0'));var path=require(_0xf3f9('0x1'));var timeout=require(_0xf3f9('0x2'));var express=require(_0xf3f9('0x3'));var router=express[_0xf3f9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf3f9('0x5'));var interaction=require(_0xf3f9('0x6'));var config=require(_0xf3f9('0x7'));var controller=require(_0xf3f9('0x8'));router[_0xf3f9('0x9')]('/',auth[_0xf3f9('0xa')](),controller[_0xf3f9('0xb')]);router[_0xf3f9('0x9')](_0xf3f9('0xc'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0xd')]);router[_0xf3f9('0x9')](_0xf3f9('0xe'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0xf')]);router[_0xf3f9('0x9')](_0xf3f9('0x10'),auth['isAuthenticated'](),controller[_0xf3f9('0x11')]);router[_0xf3f9('0x9')](_0xf3f9('0x12'),auth[_0xf3f9('0xa')](),controller['getAnswers']);router[_0xf3f9('0x9')](_0xf3f9('0x13'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x14')]);router[_0xf3f9('0x9')](_0xf3f9('0x15'),auth['isAuthenticated'](),controller[_0xf3f9('0x16')]);router[_0xf3f9('0x9')]('/:id/messages',auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x17')]);router[_0xf3f9('0x9')](_0xf3f9('0x18'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x19')]);router[_0xf3f9('0x1a')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf3f9('0x1a')](_0xf3f9('0x10'),auth['isAuthenticated'](),controller[_0xf3f9('0x1b')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf3f9('0x1c')]);router[_0xf3f9('0x1a')](_0xf3f9('0x13'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x1d')]);router[_0xf3f9('0x1a')](_0xf3f9('0x15'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x1e')]);router[_0xf3f9('0x1a')](_0xf3f9('0x1f'),auth[_0xf3f9('0xa')](),controller['addAccountApplications']);router[_0xf3f9('0x1a')](_0xf3f9('0x20'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x21')]);router[_0xf3f9('0x1a')](_0xf3f9('0x22'),auth['isAuthenticated'](),controller[_0xf3f9('0x23')]);router[_0xf3f9('0x1a')](_0xf3f9('0x18'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x24')]);router['put'](_0xf3f9('0xe'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x25')]);router[_0xf3f9('0x26')](_0xf3f9('0xe'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x27')]);router['delete']('/:id/dispositions',auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x28')]);router[_0xf3f9('0x26')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf3f9('0x29')]);router[_0xf3f9('0x26')](_0xf3f9('0x18'),auth[_0xf3f9('0xa')](),controller[_0xf3f9('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c079019..26c2a65 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 _0x601a=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x5947fc,_0x133a79){var _0x433918=function(_0x58122e){while(--_0x58122e){_0x5947fc['push'](_0x5947fc['shift']());}};_0x433918(++_0x133a79);}(_0x601a,0xdc));var _0xa601=function(_0x5205d2,_0x220cc8){_0x5205d2=_0x5205d2-0x0;var _0x47f010=_0x601a[_0x5205d2];return _0x47f010;};'use strict';var Sequelize=require(_0xa601('0x0'));module[_0xa601('0x1')]={'priority':{'type':Sequelize[_0xa601('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa601('0x3')],'allowNull':![],'defaultValue':_0xa601('0x4')},'appdata':{'type':Sequelize[_0xa601('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa601('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9cf2=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x203bd1,_0x3bfde0){var _0x4cce27=function(_0x5c6403){while(--_0x5c6403){_0x203bd1['push'](_0x203bd1['shift']());}};_0x4cce27(++_0x3bfde0);}(_0x9cf2,0x150));var _0x29cf=function(_0x3131dd,_0x4b3359){_0x3131dd=_0x3131dd-0x0;var _0x3fe105=_0x9cf2[_0x3131dd];return _0x3fe105;};'use strict';var Sequelize=require(_0x29cf('0x0'));module['exports']={'priority':{'type':Sequelize[_0x29cf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x29cf('0x2')],'allowNull':![],'defaultValue':_0x29cf('0x3')},'appdata':{'type':Sequelize[_0x29cf('0x4')]()},'description':{'type':Sequelize[_0x29cf('0x2')]},'interval':{'type':Sequelize[_0x29cf('0x2')],'defaultValue':_0x29cf('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e88fa40..21b6434 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 _0x92c5=['show','keys','merge','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','pick','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch'];(function(_0x2bf6f9,_0x14c39b){var _0xe910af=function(_0x4f7533){while(--_0x4f7533){_0x2bf6f9['push'](_0x2bf6f9['shift']());}};_0xe910af(++_0x14c39b);}(_0x92c5,0x16a));var _0x592c=function(_0x4b1f16,_0x370723){_0x4b1f16=_0x4b1f16-0x0;var _0x3a81e3=_0x92c5[_0x4b1f16];return _0x3a81e3;};'use strict';var emlformat=require(_0x592c('0x0'));var rimraf=require(_0x592c('0x1'));var zipdir=require(_0x592c('0x2'));var jsonpatch=require(_0x592c('0x3'));var rp=require(_0x592c('0x4'));var moment=require(_0x592c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x592c('0x6'));var path=require('path');var sox=require(_0x592c('0x7'));var csv=require(_0x592c('0x8'));var ejs=require(_0x592c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x592c('0xa'));var squel=require(_0x592c('0xb'));var crypto=require(_0x592c('0xc'));var jsforce=require(_0x592c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x592c('0x8'));var querystring=require(_0x592c('0xe'));var Papa=require(_0x592c('0xf'));var Redis=require(_0x592c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x592c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x592c('0x12'))(_0x592c('0x13'));var utils=require(_0x592c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x592c('0x15'))['db'];function respondWithStatusCode(_0x56c53b,_0x45ac9d){_0x45ac9d=_0x45ac9d||0xcc;return function(_0x30a339){if(_0x30a339){return _0x56c53b[_0x592c('0x16')](_0x45ac9d);}return _0x56c53b['status'](_0x45ac9d)[_0x592c('0x17')]();};}function respondWithResult(_0x38d895,_0x186c4b){_0x186c4b=_0x186c4b||0xc8;return function(_0x1392cb){if(_0x1392cb){return _0x38d895[_0x592c('0x18')](_0x186c4b)[_0x592c('0x19')](_0x1392cb);}};}function respondWithFilteredResult(_0x263d4c,_0x125ba3){return function(_0x49a325){if(_0x49a325){var _0x1122d1=typeof _0x125ba3[_0x592c('0x1a')]==='undefined'&&typeof _0x125ba3[_0x592c('0x1b')]===_0x592c('0x1c');var _0x174c7d=_0x49a325['count'];var _0x40b233=_0x1122d1?0x0:_0x125ba3['offset'];var _0x7d8271=_0x1122d1?_0x49a325[_0x592c('0x1d')]:_0x125ba3['offset']+_0x125ba3['limit'];var _0x205988;if(_0x7d8271>=_0x174c7d){_0x7d8271=_0x174c7d;_0x205988=0xc8;}else{_0x205988=0xce;}_0x263d4c[_0x592c('0x18')](_0x205988);return _0x263d4c[_0x592c('0x1e')](_0x592c('0x1f'),_0x40b233+'-'+_0x7d8271+'/'+_0x174c7d)[_0x592c('0x19')](_0x49a325);}return null;};}function patchUpdates(_0xfefd8a){return function(_0x5a99a7){try{jsonpatch['apply'](_0x5a99a7,_0xfefd8a,!![]);}catch(_0x50ae54){return BPromise[_0x592c('0x20')](_0x50ae54);}return _0x5a99a7[_0x592c('0x21')]();};}function saveUpdates(_0x1ecd1a,_0x570cc5){return function(_0xaece94){if(_0xaece94){return _0xaece94[_0x592c('0x22')](_0x1ecd1a)[_0x592c('0x23')](function(_0x3bdfe4){return _0x3bdfe4;});}return null;};}function removeEntity(_0x1b45c5,_0x107ffd){return function(_0x526d4a){if(_0x526d4a){return _0x526d4a[_0x592c('0x24')]()[_0x592c('0x23')](function(){_0x1b45c5[_0x592c('0x18')](0xcc)[_0x592c('0x17')]();});}};}function handleEntityNotFound(_0x2e8d57,_0x1bce40){return function(_0x18d459){if(!_0x18d459){_0x2e8d57['sendStatus'](0x194);}return _0x18d459;};}function handleError(_0x30bd69,_0x35dfb0){_0x35dfb0=_0x35dfb0||0x1f4;return function(_0x15888d){logger[_0x592c('0x25')](_0x15888d[_0x592c('0x26')]);if(_0x15888d[_0x592c('0x27')]){delete _0x15888d[_0x592c('0x27')];}_0x30bd69['status'](_0x35dfb0)[_0x592c('0x28')](_0x15888d);};}exports[_0x592c('0x29')]=function(_0x224bf2,_0x2bc8c4){var _0x493149={},_0x2bb39d={},_0x3cf8cc={'count':0x0,'rows':[]};var _0x4707b4=_[_0x592c('0x2a')](db[_0x592c('0x2b')]['rawAttributes'],function(_0xdb53c0){return{'name':_0xdb53c0[_0x592c('0x2c')],'type':_0xdb53c0[_0x592c('0x2d')][_0x592c('0x2e')]};});_0x2bb39d['model']=_[_0x592c('0x2a')](_0x4707b4,_0x592c('0x27'));_0x2bb39d[_0x592c('0x2f')]=_['keys'](_0x224bf2[_0x592c('0x2f')]);_0x2bb39d[_0x592c('0x30')]=_['intersection'](_0x2bb39d[_0x592c('0x31')],_0x2bb39d[_0x592c('0x2f')]);_0x493149['attributes']=_[_0x592c('0x32')](_0x2bb39d['model'],qs[_0x592c('0x33')](_0x224bf2[_0x592c('0x2f')][_0x592c('0x33')]));_0x493149[_0x592c('0x34')]=_0x493149[_0x592c('0x34')][_0x592c('0x35')]?_0x493149[_0x592c('0x34')]:_0x2bb39d[_0x592c('0x31')];if(!_0x224bf2[_0x592c('0x2f')]['hasOwnProperty']('nolimit')){_0x493149[_0x592c('0x1b')]=qs[_0x592c('0x1b')](_0x224bf2[_0x592c('0x2f')][_0x592c('0x1b')]);_0x493149[_0x592c('0x1a')]=qs[_0x592c('0x1a')](_0x224bf2['query'][_0x592c('0x1a')]);}_0x493149['order']=qs['sort'](_0x224bf2[_0x592c('0x2f')]['sort']);_0x493149['where']=qs[_0x592c('0x30')](_[_0x592c('0x36')](_0x224bf2[_0x592c('0x2f')],_0x2bb39d['filters']),_0x4707b4);if(_0x224bf2[_0x592c('0x2f')]['filter']){_0x493149['where']=_['merge'](_0x493149['where'],{'$or':_[_0x592c('0x2a')](_0x4707b4,function(_0x2b5346){if(_0x2b5346[_0x592c('0x2d')]!==_0x592c('0x37')){var _0x366ab4={};_0x366ab4[_0x2b5346[_0x592c('0x27')]]={'$like':'%'+_0x224bf2['query'][_0x592c('0x38')]+'%'};return _0x366ab4;}})});}_0x493149=_['merge']({},_0x493149,_0x224bf2[_0x592c('0x39')]);var _0x3cf52a={'where':_0x493149[_0x592c('0x3a')]};return db[_0x592c('0x2b')][_0x592c('0x1d')](_0x3cf52a)[_0x592c('0x23')](function(_0x2a9462){_0x3cf8cc[_0x592c('0x1d')]=_0x2a9462;if(_0x224bf2[_0x592c('0x2f')][_0x592c('0x3b')]){_0x493149[_0x592c('0x3c')]=[{'all':!![]}];}return db[_0x592c('0x2b')][_0x592c('0x3d')](_0x493149);})[_0x592c('0x23')](function(_0x3319e1){_0x3cf8cc[_0x592c('0x3e')]=_0x3319e1;return _0x3cf8cc;})[_0x592c('0x23')](respondWithFilteredResult(_0x2bc8c4,_0x493149))[_0x592c('0x3f')](handleError(_0x2bc8c4,null));};exports[_0x592c('0x40')]=function(_0x2381fa,_0x75fd8){var _0x3e3073={'raw':!![],'where':{'id':_0x2381fa['params']['id']}},_0x35f54b={};_0x35f54b[_0x592c('0x31')]=_[_0x592c('0x41')](db[_0x592c('0x2b')]['rawAttributes']);_0x35f54b[_0x592c('0x2f')]=_[_0x592c('0x41')](_0x2381fa[_0x592c('0x2f')]);_0x35f54b[_0x592c('0x30')]=_[_0x592c('0x32')](_0x35f54b[_0x592c('0x31')],_0x35f54b['query']);_0x3e3073[_0x592c('0x34')]=_['intersection'](_0x35f54b[_0x592c('0x31')],qs['fields'](_0x2381fa[_0x592c('0x2f')][_0x592c('0x33')]));_0x3e3073['attributes']=_0x3e3073[_0x592c('0x34')][_0x592c('0x35')]?_0x3e3073[_0x592c('0x34')]:_0x35f54b['model'];if(_0x2381fa['query']['includeAll']){_0x3e3073[_0x592c('0x3c')]=[{'all':!![]}];}_0x3e3073=_[_0x592c('0x42')]({},_0x3e3073,_0x2381fa['options']);return db['FaxApplication'][_0x592c('0x43')](_0x3e3073)[_0x592c('0x23')](handleEntityNotFound(_0x75fd8,null))['then'](respondWithResult(_0x75fd8,null))[_0x592c('0x3f')](handleError(_0x75fd8,null));};exports[_0x592c('0x44')]=function(_0x59c095,_0x414b9b){return db[_0x592c('0x2b')][_0x592c('0x44')](_0x59c095['body'],{})['then'](respondWithResult(_0x414b9b,0xc9))[_0x592c('0x3f')](handleError(_0x414b9b,null));};exports[_0x592c('0x22')]=function(_0x5ec17b,_0x1536c2){if(_0x5ec17b[_0x592c('0x45')]['id']){delete _0x5ec17b['body']['id'];}return db['FaxApplication'][_0x592c('0x43')]({'where':{'id':_0x5ec17b[_0x592c('0x46')]['id']}})[_0x592c('0x23')](handleEntityNotFound(_0x1536c2,null))['then'](saveUpdates(_0x5ec17b['body'],null))[_0x592c('0x23')](respondWithResult(_0x1536c2,null))[_0x592c('0x3f')](handleError(_0x1536c2,null));};exports[_0x592c('0x24')]=function(_0xe59663,_0x5f0132){return db[_0x592c('0x2b')][_0x592c('0x43')]({'where':{'id':_0xe59663[_0x592c('0x46')]['id']}})[_0x592c('0x23')](handleEntityNotFound(_0x5f0132,null))[_0x592c('0x23')](removeEntity(_0x5f0132,null))['catch'](handleError(_0x5f0132,null));}; \ No newline at end of file +var _0xa388=['querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','include','rows','catch','show','params','rawAttributes','length','find','create','body','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv'];(function(_0x1ec52f,_0x1e4a25){var _0x43400d=function(_0x1c4515){while(--_0x1c4515){_0x1ec52f['push'](_0x1ec52f['shift']());}};_0x43400d(++_0x1e4a25);}(_0xa388,0xc3));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a38('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a38('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a38('0x2'));var Mustache=require(_0x8a38('0x3'));var util=require(_0x8a38('0x4'));var path=require(_0x8a38('0x5'));var sox=require(_0x8a38('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a38('0x7'));var _=require(_0x8a38('0x8'));var squel=require('squel');var crypto=require(_0x8a38('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8a38('0xa'));var toCsv=require(_0x8a38('0xb'));var querystring=require(_0x8a38('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a38('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a38('0xe'));var logger=require('../../config/logger')(_0x8a38('0xf'));var utils=require(_0x8a38('0x10'));var config=require(_0x8a38('0x11'));var licenseUtil=require(_0x8a38('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245c85,_0x493f9f){_0x493f9f=_0x493f9f||0xcc;return function(_0x22ade9){if(_0x22ade9){return _0x245c85[_0x8a38('0x13')](_0x493f9f);}return _0x245c85[_0x8a38('0x14')](_0x493f9f)[_0x8a38('0x15')]();};}function respondWithResult(_0x158560,_0x3c9126){_0x3c9126=_0x3c9126||0xc8;return function(_0x2df07a){if(_0x2df07a){return _0x158560[_0x8a38('0x14')](_0x3c9126)[_0x8a38('0x16')](_0x2df07a);}};}function respondWithFilteredResult(_0x2a95ed,_0x4630d2){return function(_0x303d81){if(_0x303d81){var _0x78aba3=typeof _0x4630d2[_0x8a38('0x17')]===_0x8a38('0x18')&&typeof _0x4630d2['limit']==='undefined';var _0x2107ac=_0x303d81[_0x8a38('0x19')];var _0x5aba17=_0x78aba3?0x0:_0x4630d2[_0x8a38('0x17')];var _0x56db36=_0x78aba3?_0x303d81['count']:_0x4630d2[_0x8a38('0x17')]+_0x4630d2[_0x8a38('0x1a')];var _0x41c180;if(_0x56db36>=_0x2107ac){_0x56db36=_0x2107ac;_0x41c180=0xc8;}else{_0x41c180=0xce;}_0x2a95ed[_0x8a38('0x14')](_0x41c180);return _0x2a95ed['set'](_0x8a38('0x1b'),_0x5aba17+'-'+_0x56db36+'/'+_0x2107ac)['json'](_0x303d81);}return null;};}function patchUpdates(_0x5b5631){return function(_0x37e42c){try{jsonpatch[_0x8a38('0x1c')](_0x37e42c,_0x5b5631,!![]);}catch(_0x252abe){return BPromise[_0x8a38('0x1d')](_0x252abe);}return _0x37e42c[_0x8a38('0x1e')]();};}function saveUpdates(_0x53d559,_0xff6a38){return function(_0x26aa05){if(_0x26aa05){return _0x26aa05[_0x8a38('0x1f')](_0x53d559)[_0x8a38('0x20')](function(_0x4c05d5){return _0x4c05d5;});}return null;};}function removeEntity(_0x343d5d,_0x10f526){return function(_0x14a342){if(_0x14a342){return _0x14a342[_0x8a38('0x21')]()[_0x8a38('0x20')](function(){_0x343d5d['status'](0xcc)[_0x8a38('0x15')]();});}};}function handleEntityNotFound(_0x28cc2e,_0x1a4c52){return function(_0x525f38){if(!_0x525f38){_0x28cc2e['sendStatus'](0x194);}return _0x525f38;};}function handleError(_0x223a11,_0x1fa3f8){_0x1fa3f8=_0x1fa3f8||0x1f4;return function(_0x3bd159){logger[_0x8a38('0x22')](_0x3bd159[_0x8a38('0x23')]);if(_0x3bd159[_0x8a38('0x24')]){delete _0x3bd159[_0x8a38('0x24')];}_0x223a11[_0x8a38('0x14')](_0x1fa3f8)[_0x8a38('0x25')](_0x3bd159);};}exports[_0x8a38('0x26')]=function(_0x5a0e21,_0x3128a2){var _0x53fd8a={},_0x1f142c={},_0x181bd7={'count':0x0,'rows':[]};var _0x5dbe8a=_[_0x8a38('0x27')](db['FaxApplication']['rawAttributes'],function(_0x4ec3d5){return{'name':_0x4ec3d5[_0x8a38('0x28')],'type':_0x4ec3d5['type']['key']};});_0x1f142c[_0x8a38('0x29')]=_[_0x8a38('0x27')](_0x5dbe8a,'name');_0x1f142c[_0x8a38('0x2a')]=_[_0x8a38('0x2b')](_0x5a0e21[_0x8a38('0x2a')]);_0x1f142c[_0x8a38('0x2c')]=_[_0x8a38('0x2d')](_0x1f142c[_0x8a38('0x29')],_0x1f142c[_0x8a38('0x2a')]);_0x53fd8a[_0x8a38('0x2e')]=_[_0x8a38('0x2d')](_0x1f142c[_0x8a38('0x29')],qs[_0x8a38('0x2f')](_0x5a0e21[_0x8a38('0x2a')]['fields']));_0x53fd8a[_0x8a38('0x2e')]=_0x53fd8a[_0x8a38('0x2e')]['length']?_0x53fd8a['attributes']:_0x1f142c['model'];if(!_0x5a0e21[_0x8a38('0x2a')][_0x8a38('0x30')](_0x8a38('0x31'))){_0x53fd8a[_0x8a38('0x1a')]=qs[_0x8a38('0x1a')](_0x5a0e21[_0x8a38('0x2a')][_0x8a38('0x1a')]);_0x53fd8a[_0x8a38('0x17')]=qs[_0x8a38('0x17')](_0x5a0e21['query'][_0x8a38('0x17')]);}_0x53fd8a[_0x8a38('0x32')]=qs[_0x8a38('0x33')](_0x5a0e21[_0x8a38('0x2a')]['sort']);_0x53fd8a[_0x8a38('0x34')]=qs['filters'](_[_0x8a38('0x35')](_0x5a0e21[_0x8a38('0x2a')],_0x1f142c[_0x8a38('0x2c')]),_0x5dbe8a);if(_0x5a0e21[_0x8a38('0x2a')][_0x8a38('0x36')]){_0x53fd8a[_0x8a38('0x34')]=_[_0x8a38('0x37')](_0x53fd8a['where'],{'$or':_[_0x8a38('0x27')](_0x5dbe8a,function(_0x124c0f){if(_0x124c0f['type']!==_0x8a38('0x38')){var _0x75d3f7={};_0x75d3f7[_0x124c0f[_0x8a38('0x24')]]={'$like':'%'+_0x5a0e21[_0x8a38('0x2a')][_0x8a38('0x36')]+'%'};return _0x75d3f7;}})});}_0x53fd8a=_[_0x8a38('0x37')]({},_0x53fd8a,_0x5a0e21[_0x8a38('0x39')]);var _0x1200e8={'where':_0x53fd8a['where']};return db[_0x8a38('0x3a')]['count'](_0x1200e8)[_0x8a38('0x20')](function(_0x2de28f){_0x181bd7[_0x8a38('0x19')]=_0x2de28f;if(_0x5a0e21['query']['includeAll']){_0x53fd8a[_0x8a38('0x3b')]=[{'all':!![]}];}return db[_0x8a38('0x3a')]['findAll'](_0x53fd8a);})['then'](function(_0x39e102){_0x181bd7[_0x8a38('0x3c')]=_0x39e102;return _0x181bd7;})[_0x8a38('0x20')](respondWithFilteredResult(_0x3128a2,_0x53fd8a))[_0x8a38('0x3d')](handleError(_0x3128a2,null));};exports[_0x8a38('0x3e')]=function(_0xb89f80,_0x2165f8){var _0x2f7924={'raw':!![],'where':{'id':_0xb89f80[_0x8a38('0x3f')]['id']}},_0x4066fd={};_0x4066fd[_0x8a38('0x29')]=_[_0x8a38('0x2b')](db['FaxApplication'][_0x8a38('0x40')]);_0x4066fd[_0x8a38('0x2a')]=_[_0x8a38('0x2b')](_0xb89f80[_0x8a38('0x2a')]);_0x4066fd['filters']=_[_0x8a38('0x2d')](_0x4066fd[_0x8a38('0x29')],_0x4066fd['query']);_0x2f7924[_0x8a38('0x2e')]=_[_0x8a38('0x2d')](_0x4066fd[_0x8a38('0x29')],qs[_0x8a38('0x2f')](_0xb89f80['query'][_0x8a38('0x2f')]));_0x2f7924[_0x8a38('0x2e')]=_0x2f7924[_0x8a38('0x2e')][_0x8a38('0x41')]?_0x2f7924[_0x8a38('0x2e')]:_0x4066fd[_0x8a38('0x29')];if(_0xb89f80['query']['includeAll']){_0x2f7924[_0x8a38('0x3b')]=[{'all':!![]}];}_0x2f7924=_[_0x8a38('0x37')]({},_0x2f7924,_0xb89f80[_0x8a38('0x39')]);return db[_0x8a38('0x3a')][_0x8a38('0x42')](_0x2f7924)[_0x8a38('0x20')](handleEntityNotFound(_0x2165f8,null))[_0x8a38('0x20')](respondWithResult(_0x2165f8,null))[_0x8a38('0x3d')](handleError(_0x2165f8,null));};exports['create']=function(_0x7488ce,_0x4c972a){return db[_0x8a38('0x3a')][_0x8a38('0x43')](_0x7488ce[_0x8a38('0x44')],{})[_0x8a38('0x20')](respondWithResult(_0x4c972a,0xc9))[_0x8a38('0x3d')](handleError(_0x4c972a,null));};exports[_0x8a38('0x1f')]=function(_0x1e87ad,_0x1d1d80){if(_0x1e87ad[_0x8a38('0x44')]['id']){delete _0x1e87ad[_0x8a38('0x44')]['id'];}return db[_0x8a38('0x3a')][_0x8a38('0x42')]({'where':{'id':_0x1e87ad[_0x8a38('0x3f')]['id']}})[_0x8a38('0x20')](handleEntityNotFound(_0x1d1d80,null))[_0x8a38('0x20')](saveUpdates(_0x1e87ad[_0x8a38('0x44')],null))['then'](respondWithResult(_0x1d1d80,null))[_0x8a38('0x3d')](handleError(_0x1d1d80,null));};exports[_0x8a38('0x21')]=function(_0x938911,_0x12dc78){return db[_0x8a38('0x3a')][_0x8a38('0x42')]({'where':{'id':_0x938911['params']['id']}})[_0x8a38('0x20')](handleEntityNotFound(_0x12dc78,null))['then'](removeEntity(_0x12dc78,null))[_0x8a38('0x3d')](handleError(_0x12dc78,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 75fe0a5..27e2e50 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 _0x9560=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19cbcc,_0x44384e){var _0x44d405=function(_0x475354){while(--_0x475354){_0x19cbcc['push'](_0x19cbcc['shift']());}};_0x44d405(++_0x44384e);}(_0x9560,0x1b5));var _0x0956=function(_0x36f3df,_0x2b1621){_0x36f3df=_0x36f3df-0x0;var _0xcfb7b7=_0x9560[_0x36f3df];return _0xcfb7b7;};'use strict';var _=require('lodash');var util=require(_0x0956('0x0'));var logger=require(_0x0956('0x1'))(_0x0956('0x2'));var moment=require(_0x0956('0x3'));var BPromise=require(_0x0956('0x4'));var rp=require(_0x0956('0x5'));var fs=require('fs');var path=require(_0x0956('0x6'));var rimraf=require(_0x0956('0x7'));var config=require(_0x0956('0x8'));var attributes=require(_0x0956('0x9'));module[_0x0956('0xa')]=function(_0x27228c,_0x28b160){return _0x27228c[_0x0956('0xb')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x74a6=['moment','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','../../config/logger','api'];(function(_0x2fbba8,_0x4ffe00){var _0xc68a76=function(_0x3b16d4){while(--_0x3b16d4){_0x2fbba8['push'](_0x2fbba8['shift']());}};_0xc68a76(++_0x4ffe00);}(_0x74a6,0x11d));var _0x674a=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x74a6[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x674a('0x0'));var util=require('util');var logger=require(_0x674a('0x1'))(_0x674a('0x2'));var moment=require(_0x674a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x674a('0x4')]=function(_0x22ca5a,_0x22b4a9){return _0x22ca5a[_0x674a('0x5')](_0x674a('0x6'),attributes,{'tableName':_0x674a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x674a('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a0cc006..e94ab51 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 _0xdaf4=['UpdateFaxApplication','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','catch','FaxApplication','options','raw','attributes'];(function(_0xaeee9,_0x59c33f){var _0xd143a6=function(_0x4778e2){while(--_0x4778e2){_0xaeee9['push'](_0xaeee9['shift']());}};_0xd143a6(++_0x59c33f);}(_0xdaf4,0x109));var _0x4daf=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xdaf4[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x4daf('0x0'));var util=require('util');var moment=require(_0x4daf('0x1'));var BPromise=require(_0x4daf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4daf('0x3'));var db=require(_0x4daf('0x4'))['db'];var utils=require(_0x4daf('0x5'));var logger=require('../../config/logger')(_0x4daf('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4daf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10a386,_0x286f8f,_0x507abc){return new BPromise(function(_0x337976,_0x354174){return client[_0x4daf('0x8')](_0x10a386,_0x507abc)[_0x4daf('0x9')](function(_0x852e8){logger[_0x4daf('0xa')]('FaxApplication,\x20%s,\x20%s',_0x286f8f,_0x4daf('0xb'));logger[_0x4daf('0xc')](_0x4daf('0xd'),_0x286f8f,'request\x20sent',JSON[_0x4daf('0xe')](_0x852e8));if(_0x852e8[_0x4daf('0xf')]){if(_0x852e8['error']['code']===0x1f4){logger[_0x4daf('0xf')](_0x4daf('0x10'),_0x286f8f,_0x852e8[_0x4daf('0xf')][_0x4daf('0x11')]);return _0x354174(_0x852e8[_0x4daf('0xf')][_0x4daf('0x11')]);}logger[_0x4daf('0xf')](_0x4daf('0x10'),_0x286f8f,_0x852e8['error'][_0x4daf('0x11')]);return _0x337976(_0x852e8[_0x4daf('0xf')]['message']);}else{logger[_0x4daf('0xa')]('FaxApplication,\x20%s,\x20%s',_0x286f8f,_0x4daf('0xb'));_0x337976(_0x852e8['result'][_0x4daf('0x11')]);}})[_0x4daf('0x12')](function(_0x52e130){logger[_0x4daf('0xf')]('FaxApplication,\x20%s,\x20%s',_0x286f8f,_0x52e130);_0x354174(_0x52e130);});});}exports['UpdateFaxApplication']=function(_0x5f4d98){var _0x3c42ae=this;return new Promise(function(_0x234921,_0x28fa25){return db[_0x4daf('0x13')]['update'](_0x5f4d98['body'],{'raw':_0x5f4d98[_0x4daf('0x14')]?_0x5f4d98[_0x4daf('0x14')][_0x4daf('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f4d98['options']?_0x5f4d98['options']['where']||null:null,'attributes':_0x5f4d98[_0x4daf('0x14')]?_0x5f4d98['options'][_0x4daf('0x16')]||null:null,'limit':_0x5f4d98[_0x4daf('0x14')]?_0x5f4d98[_0x4daf('0x14')]['limit']||null:null})[_0x4daf('0x9')](function(_0x105fd1){logger['info']('UpdateFaxApplication',_0x5f4d98);logger['debug'](_0x4daf('0x17'),_0x5f4d98,JSON['stringify'](_0x105fd1));_0x234921(_0x105fd1);})['catch'](function(_0x4c92f3){logger[_0x4daf('0xf')](_0x4daf('0x17'),_0x4c92f3['message'],_0x5f4d98);_0x28fa25(_0x3c42ae[_0x4daf('0xf')](0x1f4,_0x4c92f3['message']));});});}; \ No newline at end of file +var _0xf7fd=['request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0x3d13bb,_0x262a54){var _0x4b5a1b=function(_0x53417e){while(--_0x53417e){_0x3d13bb['push'](_0x3d13bb['shift']());}};_0x4b5a1b(++_0x262a54);}(_0xf7fd,0xe2));var _0xdf7f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf7fd[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xdf7f('0x0'));var util=require('util');var moment=require(_0xdf7f('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf7f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf7f('0x3'))['db'];var utils=require(_0xdf7f('0x4'));var logger=require('../../config/logger')(_0xdf7f('0x5'));var config=require(_0xdf7f('0x6'));var jayson=require(_0xdf7f('0x7'));var client=jayson[_0xdf7f('0x8')][_0xdf7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e81dd,_0x46ed48,_0x141609){return new BPromise(function(_0x19a633,_0x28406d){return client[_0xdf7f('0xa')](_0x5e81dd,_0x141609)[_0xdf7f('0xb')](function(_0xe99e4b){logger[_0xdf7f('0xc')](_0xdf7f('0xd'),_0x46ed48,_0xdf7f('0xe'));logger[_0xdf7f('0xf')](_0xdf7f('0x10'),_0x46ed48,_0xdf7f('0xe'),JSON[_0xdf7f('0x11')](_0xe99e4b));if(_0xe99e4b[_0xdf7f('0x12')]){if(_0xe99e4b[_0xdf7f('0x12')]['code']===0x1f4){logger[_0xdf7f('0x12')](_0xdf7f('0xd'),_0x46ed48,_0xe99e4b[_0xdf7f('0x12')]['message']);return _0x28406d(_0xe99e4b[_0xdf7f('0x12')]['message']);}logger['error'](_0xdf7f('0xd'),_0x46ed48,_0xe99e4b[_0xdf7f('0x12')]['message']);return _0x19a633(_0xe99e4b[_0xdf7f('0x12')][_0xdf7f('0x13')]);}else{logger[_0xdf7f('0xc')](_0xdf7f('0xd'),_0x46ed48,_0xdf7f('0xe'));_0x19a633(_0xe99e4b[_0xdf7f('0x14')][_0xdf7f('0x13')]);}})[_0xdf7f('0x15')](function(_0x5cde50){logger[_0xdf7f('0x12')](_0xdf7f('0xd'),_0x46ed48,_0x5cde50);_0x28406d(_0x5cde50);});});}exports[_0xdf7f('0x16')]=function(_0x42bd12){var _0x50b1a7=this;return new Promise(function(_0x24fa6f,_0x471847){return db['FaxApplication'][_0xdf7f('0x17')](_0x42bd12[_0xdf7f('0x18')],{'raw':_0x42bd12[_0xdf7f('0x19')]?_0x42bd12[_0xdf7f('0x19')][_0xdf7f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42bd12[_0xdf7f('0x19')]?_0x42bd12['options'][_0xdf7f('0x1b')]||null:null,'attributes':_0x42bd12['options']?_0x42bd12[_0xdf7f('0x19')][_0xdf7f('0x1c')]||null:null,'limit':_0x42bd12['options']?_0x42bd12[_0xdf7f('0x19')][_0xdf7f('0x1d')]||null:null})['then'](function(_0x1ce395){logger[_0xdf7f('0xc')](_0xdf7f('0x16'),_0x42bd12);logger[_0xdf7f('0xf')](_0xdf7f('0x16'),_0x42bd12,JSON[_0xdf7f('0x11')](_0x1ce395));_0x24fa6f(_0x1ce395);})[_0xdf7f('0x15')](function(_0x4e70e1){logger[_0xdf7f('0x12')](_0xdf7f('0x16'),_0x4e70e1[_0xdf7f('0x13')],_0x42bd12);_0x471847(_0x50b1a7[_0xdf7f('0x12')](0x1f4,_0x4e70e1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index f376f9a..a785bdd 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x68c4e3,_0x5b18b0){var _0xaca048=function(_0x485160){while(--_0x485160){_0x68c4e3['push'](_0x68c4e3['shift']());}};_0xaca048(++_0x5b18b0);}(_0xda2d,0x102));var _0xdda2=function(_0x296ab7,_0x4cb178){_0x296ab7=_0x296ab7-0x0;var _0x17ef2c=_0xda2d[_0x296ab7];return _0x17ef2c;};'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 +var _0x80ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x80ed,0x11c));var _0xd80e=function(_0x118d97,_0x472142){_0x118d97=_0x118d97-0x0;var _0x24528c=_0x80ed[_0x118d97];return _0x24528c;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./faxApplication.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0xd')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0xf')](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x10')]);router['delete'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);module[_0xd80e('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 8137dfb..7bb4334 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 _0x32b6=['ENUM','out','INTEGER','sequelize','exports','DATE','STRING'];(function(_0x1c67a2,_0x599648){var _0x4fbd8e=function(_0x2e465b){while(--_0x2e465b){_0x1c67a2['push'](_0x1c67a2['shift']());}};_0x4fbd8e(++_0x599648);}(_0x32b6,0x1d1));var _0x632b=function(_0x151163,_0xcf79b1){_0x151163=_0x151163-0x0;var _0x3f8637=_0x32b6[_0x151163];return _0x3f8637;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x632b('0x2')]},'disposition':{'type':Sequelize[_0x632b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x632b('0x3')]},'read1stAt':{'type':Sequelize[_0x632b('0x2')]},'fax':{'type':Sequelize[_0x632b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x632b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x632b('0x6')]}}; \ No newline at end of file +var _0x7096=['STRING','ENUM','out','INTEGER','exports','DATE'];(function(_0x14d613,_0x253dc8){var _0x341d21=function(_0xac834){while(--_0xac834){_0x14d613['push'](_0x14d613['shift']());}};_0x341d21(++_0x253dc8);}(_0x7096,0x10c));var _0x6709=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7096[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6709('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6709('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6709('0x2')]},'note':{'type':Sequelize[_0x6709('0x2')]},'read1stAt':{'type':Sequelize[_0x6709('0x1')]},'fax':{'type':Sequelize[_0x6709('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6709('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x6709('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index d7c6951..bbbdb96 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 _0x264c=['keys','filters','attributes','intersection','fields','length','include','options','find','create','body','update','describe','addMessage','omit','ids','getMessages','FaxMessage','rawAttributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','includeAll','findAll','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','then','destroy','name','send','index','map','FaxInteraction','type','key','getOptions','query','user','catch','show','params','model'];(function(_0x33fb7e,_0x160ffc){var _0x472f95=function(_0x456cac){while(--_0x456cac){_0x33fb7e['push'](_0x33fb7e['shift']());}};_0x472f95(++_0x160ffc);}(_0x264c,0x1e6));var _0xc264=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x264c[_0x65c0bb];return _0x320bd5;};'use strict';var rimraf=require(_0xc264('0x0'));var zipdir=require(_0xc264('0x1'));var moment=require(_0xc264('0x2'));var BPromise=require(_0xc264('0x3'));var util=require(_0xc264('0x4'));var path=require(_0xc264('0x5'));var fs=require('fs');var _=require(_0xc264('0x6'));var Redis=require(_0xc264('0x7'));var interaction=require(_0xc264('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xc264('0x9'))(_0xc264('0xa'));var config=require(_0xc264('0xb'));var db=require(_0xc264('0xc'))['db'];config['redis']=_[_0xc264('0xd')](config[_0xc264('0xe')],{'host':_0xc264('0xf'),'port':0x18eb});var socket=require(_0xc264('0x10'))(new Redis(config[_0xc264('0xe')]));require(_0xc264('0x11'))[_0xc264('0x12')](socket);function respondWithStatusCode(_0x5f38e0,_0x4c08c9){_0x4c08c9=_0x4c08c9||0xcc;return function(_0x69639c){if(_0x69639c){return _0x5f38e0[_0xc264('0x13')](_0x4c08c9);}return _0x5f38e0[_0xc264('0x14')](_0x4c08c9)[_0xc264('0x15')]();};}function respondWithResult(_0x58e454,_0x1e0276){_0x1e0276=_0x1e0276||0xc8;return function(_0x3708c5){if(_0x3708c5){return _0x58e454['status'](_0x1e0276)[_0xc264('0x16')](_0x3708c5);}};}function respondWithFilteredResult(_0x14a385,_0x1fcc89){return function(_0x41d658){if(_0x41d658){var _0x142f38=typeof _0x1fcc89[_0xc264('0x17')]===_0xc264('0x18')&&typeof _0x1fcc89['limit']===_0xc264('0x18');var _0x230ec0=_0x41d658[_0xc264('0x19')];var _0x2ca421=_0x142f38?0x0:_0x1fcc89['offset'];var _0x388896=_0x142f38?_0x41d658[_0xc264('0x19')]:_0x1fcc89[_0xc264('0x17')]+_0x1fcc89['limit'];var _0x30bf09;if(_0x388896>=_0x230ec0){_0x388896=_0x230ec0;_0x30bf09=0xc8;}else{_0x30bf09=0xce;}_0x14a385[_0xc264('0x14')](_0x30bf09);return _0x14a385[_0xc264('0x1a')](_0xc264('0x1b'),_0x2ca421+'-'+_0x388896+'/'+_0x230ec0)[_0xc264('0x16')](_0x41d658);}return null;};}function saveUpdates(_0x93e7cb){return function(_0x4e204f){if(_0x4e204f){return _0x4e204f['update'](_0x93e7cb)[_0xc264('0x1c')](function(_0x4f5a40){return _0x4f5a40;});}return null;};}function removeEntity(_0x1e0a7c){return function(_0x47ffe1){if(_0x47ffe1){return _0x47ffe1[_0xc264('0x1d')]()['then'](function(){_0x1e0a7c[_0xc264('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f35d5){return function(_0x545d9b){if(!_0x545d9b){_0x1f35d5[_0xc264('0x13')](0x194);}return _0x545d9b;};}function handleError(_0x2aac8b,_0x571807){_0x571807=_0x571807||0x1f4;return function(_0x450d25){logger['error'](_0x450d25['stack']);if(_0x450d25[_0xc264('0x1e')]){delete _0x450d25[_0xc264('0x1e')];}_0x2aac8b[_0xc264('0x14')](_0x571807)[_0xc264('0x1f')](_0x450d25);};}exports[_0xc264('0x20')]=function(_0x3600b0,_0x3ad299){var _0x4cd54d={};var _0x560ffc=_[_0xc264('0x21')](db[_0xc264('0x22')]['rawAttributes'],function(_0x4819b5){return{'name':_0x4819b5['fieldName'],'type':_0x4819b5[_0xc264('0x23')][_0xc264('0x24')]};});_0x4cd54d=qs[_0xc264('0x25')](_0x560ffc,_0x3600b0);return interaction['findAll']('fax',_0x3600b0[_0xc264('0x26')],_0x3600b0[_0xc264('0x27')],_0x4cd54d,_0x560ffc)[_0xc264('0x1c')](respondWithFilteredResult(_0x3ad299,_0x4cd54d))[_0xc264('0x28')](handleError(_0x3ad299,null));};exports[_0xc264('0x29')]=function(_0x2c1742,_0x193208){var _0x297242={'raw':![],'where':{'id':_0x2c1742[_0xc264('0x2a')]['id']}},_0x1fd988={};_0x1fd988[_0xc264('0x2b')]=_[_0xc264('0x2c')](db[_0xc264('0x22')]['rawAttributes']);_0x1fd988[_0xc264('0x26')]=_[_0xc264('0x2c')](_0x2c1742[_0xc264('0x26')]);_0x1fd988[_0xc264('0x2d')]=_['intersection'](_0x1fd988[_0xc264('0x2b')],_0x1fd988[_0xc264('0x26')]);_0x297242[_0xc264('0x2e')]=_[_0xc264('0x2f')](_0x1fd988[_0xc264('0x2b')],qs[_0xc264('0x30')](_0x2c1742[_0xc264('0x26')][_0xc264('0x30')]));_0x297242[_0xc264('0x2e')]=_0x297242[_0xc264('0x2e')][_0xc264('0x31')]?_0x297242[_0xc264('0x2e')]:_0x1fd988[_0xc264('0x2b')];if(_0x2c1742[_0xc264('0x26')]['includeAll']){_0x297242[_0xc264('0x32')]=[{'all':!![]}];}_0x297242=_['merge']({},_0x297242,_0x2c1742[_0xc264('0x33')]);return db['FaxInteraction'][_0xc264('0x34')](_0x297242)[_0xc264('0x1c')](handleEntityNotFound(_0x193208,null))[_0xc264('0x1c')](respondWithResult(_0x193208,null))[_0xc264('0x28')](handleError(_0x193208,null));};exports[_0xc264('0x35')]=function(_0x5b994,_0x1da37b){return db[_0xc264('0x22')][_0xc264('0x35')](_0x5b994[_0xc264('0x36')],{})['then'](respondWithResult(_0x1da37b,0xc9))[_0xc264('0x28')](handleError(_0x1da37b,null));};exports[_0xc264('0x37')]=function(_0x538c21,_0x124620){if(_0x538c21[_0xc264('0x36')]['id']){delete _0x538c21[_0xc264('0x36')]['id'];}return db[_0xc264('0x22')][_0xc264('0x34')]({'where':{'id':_0x538c21[_0xc264('0x2a')]['id']}})[_0xc264('0x1c')](handleEntityNotFound(_0x124620,null))[_0xc264('0x1c')](saveUpdates(_0x538c21['body'],null))[_0xc264('0x1c')](respondWithResult(_0x124620,null))[_0xc264('0x28')](handleError(_0x124620,null));};exports[_0xc264('0x1d')]=function(_0x10641f,_0x14cba3){return db[_0xc264('0x22')][_0xc264('0x34')]({'where':{'id':_0x10641f[_0xc264('0x2a')]['id']}})[_0xc264('0x1c')](handleEntityNotFound(_0x14cba3,null))[_0xc264('0x1c')](removeEntity(_0x14cba3,null))['catch'](handleError(_0x14cba3,null));};exports['describe']=function(_0x50017c,_0x304f4b){return db[_0xc264('0x22')][_0xc264('0x38')]()[_0xc264('0x1c')](respondWithResult(_0x304f4b,null))['catch'](handleError(_0x304f4b,null));};exports[_0xc264('0x39')]=function(_0x53fa0a,_0x360556){return db['FaxMessage']['find']({'where':{'id':_0x53fa0a[_0xc264('0x2a')]['id']}})[_0xc264('0x1c')](handleEntityNotFound(_0x360556,null))[_0xc264('0x1c')](function(_0x5b5a97){if(_0x5b5a97){return _0x5b5a97[_0xc264('0x39')](_0x53fa0a['body']['ids'],_[_0xc264('0x3a')](_0x53fa0a['body'],[_0xc264('0x3b'),'id'])||{});}})[_0xc264('0x1c')](respondWithResult(_0x360556,null))['catch'](handleError(_0x360556,null));};exports[_0xc264('0x3c')]=function(_0x2e90b0,_0xf126f){var _0x1ce91f={'raw':![],'where':{}};var _0x55e632={};var _0x1e65a2={'count':0x0,'rows':[]};return db[_0xc264('0x22')]['findOne']({'where':{'id':_0x2e90b0[_0xc264('0x2a')]['id']}})[_0xc264('0x1c')](handleEntityNotFound(_0xf126f,null))[_0xc264('0x1c')](function(_0x3cc485){if(_0x3cc485){_0x55e632[_0xc264('0x2b')]=_[_0xc264('0x2c')](db[_0xc264('0x3d')][_0xc264('0x3e')]);_0x55e632[_0xc264('0x26')]=_[_0xc264('0x2c')](_0x2e90b0[_0xc264('0x26')]);_0x55e632[_0xc264('0x2d')]=_[_0xc264('0x2f')](_0x55e632[_0xc264('0x2b')],_0x55e632['query']);_0x1ce91f['attributes']=_[_0xc264('0x2f')](_0x55e632[_0xc264('0x2b')],qs[_0xc264('0x30')](_0x2e90b0[_0xc264('0x26')]['fields']));_0x1ce91f[_0xc264('0x2e')]=_0x1ce91f[_0xc264('0x2e')][_0xc264('0x31')]?_0x1ce91f[_0xc264('0x2e')]:_0x55e632[_0xc264('0x2b')];if(!_0x2e90b0['query'][_0xc264('0x3f')](_0xc264('0x40'))){_0x1ce91f[_0xc264('0x41')]=qs['limit'](_0x2e90b0[_0xc264('0x26')][_0xc264('0x41')]);_0x1ce91f[_0xc264('0x17')]=qs[_0xc264('0x17')](_0x2e90b0[_0xc264('0x26')][_0xc264('0x17')]);}_0x1ce91f[_0xc264('0x42')]=qs[_0xc264('0x43')](_0x2e90b0[_0xc264('0x26')][_0xc264('0x43')]);_0x1ce91f['where']=qs['filters'](_[_0xc264('0x44')](_0x2e90b0[_0xc264('0x26')],_0x55e632[_0xc264('0x2d')]));_0x1ce91f[_0xc264('0x45')]['FaxInteractionId']=_0x3cc485['id'];if(_0x2e90b0[_0xc264('0x26')][_0xc264('0x46')]){_0x1ce91f[_0xc264('0x45')]=_['merge'](_0x1ce91f[_0xc264('0x45')],{'$or':_[_0xc264('0x21')](_0x1ce91f[_0xc264('0x2e')],function(_0x5bd05c){var _0x2e3a86={};_0x2e3a86[_0x5bd05c]={'$like':'%'+_0x2e90b0[_0xc264('0x26')][_0xc264('0x46')]+'%'};return _0x2e3a86;})});}if(_0x2e90b0[_0xc264('0x26')][_0xc264('0x47')]){var _0x2788b4=_0x2e90b0[_0xc264('0x26')]['$gte'][_0xc264('0x48')](',');var _0x291f5a={};_0x291f5a[_0x2788b4[0x0]]={'$gte':moment(_0x2788b4[0x1])[_0xc264('0x49')](_0xc264('0x4a'))};_0x1ce91f[_0xc264('0x45')]=_[_0xc264('0x4b')](_0x1ce91f['where'],_0x291f5a);}_0x1ce91f=_[_0xc264('0x4b')]({},_0x1ce91f,_0x2e90b0['options']);return db[_0xc264('0x3d')]['count']({'where':_0x1ce91f[_0xc264('0x45')]})[_0xc264('0x1c')](function(_0x441359){_0x1e65a2[_0xc264('0x19')]=_0x441359;if(_0x2e90b0['query'][_0xc264('0x4c')]){_0x1ce91f[_0xc264('0x32')]=[{'all':!![]}];}return db[_0xc264('0x3d')][_0xc264('0x4d')](_0x1ce91f);})[_0xc264('0x1c')](function(_0x34badf){_0x1e65a2['rows']=_0x34badf;return _0x1e65a2;});}})[_0xc264('0x1c')](respondWithFilteredResult(_0xf126f,_0x1ce91f))[_0xc264('0x28')](handleError(_0xf126f,null));};exports[_0xc264('0x4e')]=function(_0x44dfe1,_0x2c3380){return db[_0xc264('0x22')][_0xc264('0x34')]({'where':{'id':_0x44dfe1[_0xc264('0x2a')]['id']}})[_0xc264('0x1c')](handleEntityNotFound(_0x2c3380,null))[_0xc264('0x1c')](function(_0x301fed){if(_0x301fed){return _0x301fed[_0xc264('0x4f')](_0x44dfe1[_0xc264('0x36')]['ids'],_[_0xc264('0x3a')](_0x44dfe1[_0xc264('0x36')],[_0xc264('0x3b'),'id'])||{})[_0xc264('0x50')](function(){return db[_0xc264('0x51')]['findAll']({'attributes':['id','name',_0xc264('0x52')],'where':{'id':_0x44dfe1[_0xc264('0x36')][_0xc264('0x3b')]}});})[_0xc264('0x1c')](function(_0x3b2a5e){socket['emit'](_0xc264('0x53'),{'id':Number(_0x44dfe1['params']['id']),'tags':_0x3b2a5e||[]});return{'id':Number(_0x44dfe1[_0xc264('0x2a')]['id']),'tags':_0x3b2a5e||[]};});}})[_0xc264('0x1c')](respondWithResult(_0x2c3380,null))[_0xc264('0x28')](handleError(_0x2c3380,null));};exports[_0xc264('0x54')]=function(_0x3e4452,_0x16d047){return db[_0xc264('0x22')][_0xc264('0x34')]({'where':{'id':_0x3e4452['params']['id']}})[_0xc264('0x1c')](handleEntityNotFound(_0x16d047,null))['then'](function(_0x3effd5){if(_0x3effd5){return _0x3effd5[_0xc264('0x54')](_0x3e4452[_0xc264('0x26')][_0xc264('0x3b')]);}})['then'](respondWithStatusCode(_0x16d047,null))[_0xc264('0x28')](handleError(_0x16d047,null));};exports[_0xc264('0x55')]=function(_0x121fb1,_0x27407e){var _0x3742f8=moment()[_0xc264('0x56')]()[_0xc264('0x57')]();var _0x581d73=path[_0xc264('0x58')](config[_0xc264('0x59')],_0xc264('0x5a'),_0xc264('0x5b'),_0xc264('0x5c'));var _0x433b5f=path[_0xc264('0x58')](config[_0xc264('0x59')],_0xc264('0x5a'),_0xc264('0x5b'),_0xc264('0x5d'));var _0x569103=path[_0xc264('0x58')](_0x581d73,_0x3742f8);var _0x17d066=util['format']('transcript-%d-%s.zip',_0x121fb1[_0xc264('0x2a')]['id'],_0x3742f8);var _0x536e82=path[_0xc264('0x58')](_0x581d73,_0x17d066);var _0x300420=[];_0x300420['push']({'model':db[_0xc264('0x5e')],'as':_0xc264('0x5e'),'raw':!![]});var _0x1d1ce4=[{'model':db['FaxMessage'],'as':_0xc264('0x5f'),'attributes':['id',_0xc264('0x36'),_0xc264('0x60')],'include':_0x300420}];return db[_0xc264('0x22')][_0xc264('0x34')]({'where':{'id':_0x121fb1['params']['id']},'include':_0x1d1ce4})['then'](handleEntityNotFound(_0x27407e,null))['then'](function(_0x4e3be7){if(_0x4e3be7&&_0x4e3be7['Messages']){var _0xaa2b2f=_0x4e3be7[_0xc264('0x61')]({'plain':!![]});fs[_0xc264('0x62')](_0x569103);for(var _0x60467c=0x0;_0x60467c<_0xaa2b2f[_0xc264('0x5f')][_0xc264('0x31')];_0x60467c++){var _0x1b3506=_0xaa2b2f[_0xc264('0x5f')][_0x60467c]['Attachment'];if(_0x1b3506){var _0xfd08a0=path[_0xc264('0x58')](_0x433b5f,_0x1b3506[_0xc264('0x63')]);if(fs[_0xc264('0x64')](_0xfd08a0)){fs[_0xc264('0x65')](_0xfd08a0)['pipe'](fs['createWriteStream'](path[_0xc264('0x58')](_0x569103,_0x1b3506[_0xc264('0x63')])));}}}return BPromise[_0xc264('0x66')]()[_0xc264('0x1c')](function(){return new BPromise(function(_0x547d3f,_0x1d96ef){zipdir(_0x569103,{'saveTo':_0x536e82},function(_0x92467f,_0x58807a){if(_0x92467f)return _0x1d96ef(_0x92467f);return _0x547d3f(_0x58807a);});})[_0xc264('0x1c')](function(){return new BPromise(function(_0x3fc34b,_0x4fa73c){rimraf(_0x569103,function(_0x335041){if(_0x335041)_0x4fa73c(_0x335041);return _0x3fc34b();});});})['then'](function(){return _0x27407e[_0xc264('0x55')](_0x536e82,_0x17d066,function(_0x43b07e){if(_0x43b07e){console[_0xc264('0x67')](_0xc264('0x68'),_0x43b07e);}else{fs[_0xc264('0x69')](_0x536e82);}});});});}else{return _0x27407e[_0xc264('0x13')](0xc8);}})['catch'](handleError(_0x27407e,null));}; \ No newline at end of file +var _0x6748=['existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','update','then','destroy','end','name','index','map','FaxInteraction','fieldName','key','getOptions','findAll','fax','query','user','catch','keys','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','body','params','describe','addMessage','FaxMessage','ids','omit','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync'];(function(_0x593ff5,_0x52489c){var _0x1343b3=function(_0x594b8a){while(--_0x594b8a){_0x593ff5['push'](_0x593ff5['shift']());}};_0x1343b3(++_0x52489c);}(_0x6748,0x190));var _0x8674=function(_0x355011,_0x27596a){_0x355011=_0x355011-0x0;var _0x2396a0=_0x6748[_0x355011];return _0x2396a0;};'use strict';var rimraf=require(_0x8674('0x0'));var zipdir=require(_0x8674('0x1'));var moment=require(_0x8674('0x2'));var BPromise=require(_0x8674('0x3'));var util=require(_0x8674('0x4'));var path=require(_0x8674('0x5'));var fs=require('fs');var _=require(_0x8674('0x6'));var Redis=require(_0x8674('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x8674('0x8'));var logger=require(_0x8674('0x9'))(_0x8674('0xa'));var config=require(_0x8674('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8674('0xc')](config['redis'],{'host':_0x8674('0xd'),'port':0x18eb});var socket=require(_0x8674('0xe'))(new Redis(config[_0x8674('0xf')]));require('./faxInteraction.socket')[_0x8674('0x10')](socket);function respondWithStatusCode(_0x524f7c,_0x27a000){_0x27a000=_0x27a000||0xcc;return function(_0x2ff251){if(_0x2ff251){return _0x524f7c[_0x8674('0x11')](_0x27a000);}return _0x524f7c[_0x8674('0x12')](_0x27a000)['end']();};}function respondWithResult(_0x19ad10,_0x38a303){_0x38a303=_0x38a303||0xc8;return function(_0x17c38c){if(_0x17c38c){return _0x19ad10['status'](_0x38a303)['json'](_0x17c38c);}};}function respondWithFilteredResult(_0x56cc81,_0x4dcfcd){return function(_0x4d89ac){if(_0x4d89ac){var _0x3ae1cf=typeof _0x4dcfcd['offset']==='undefined'&&typeof _0x4dcfcd[_0x8674('0x13')]===_0x8674('0x14');var _0x98b6bf=_0x4d89ac[_0x8674('0x15')];var _0x27917f=_0x3ae1cf?0x0:_0x4dcfcd[_0x8674('0x16')];var _0x504c09=_0x3ae1cf?_0x4d89ac[_0x8674('0x15')]:_0x4dcfcd[_0x8674('0x16')]+_0x4dcfcd[_0x8674('0x13')];var _0x2821ff;if(_0x504c09>=_0x98b6bf){_0x504c09=_0x98b6bf;_0x2821ff=0xc8;}else{_0x2821ff=0xce;}_0x56cc81[_0x8674('0x12')](_0x2821ff);return _0x56cc81[_0x8674('0x17')](_0x8674('0x18'),_0x27917f+'-'+_0x504c09+'/'+_0x98b6bf)[_0x8674('0x19')](_0x4d89ac);}return null;};}function saveUpdates(_0x390471){return function(_0x59d71d){if(_0x59d71d){return _0x59d71d[_0x8674('0x1a')](_0x390471)[_0x8674('0x1b')](function(_0x3299d4){return _0x3299d4;});}return null;};}function removeEntity(_0x3c737a){return function(_0x2db3e9){if(_0x2db3e9){return _0x2db3e9[_0x8674('0x1c')]()[_0x8674('0x1b')](function(){_0x3c737a[_0x8674('0x12')](0xcc)[_0x8674('0x1d')]();});}};}function handleEntityNotFound(_0x1559b2){return function(_0x2e9fc6){if(!_0x2e9fc6){_0x1559b2[_0x8674('0x11')](0x194);}return _0x2e9fc6;};}function handleError(_0xcec925,_0x39b0b4){_0x39b0b4=_0x39b0b4||0x1f4;return function(_0x537165){logger['error'](_0x537165['stack']);if(_0x537165[_0x8674('0x1e')]){delete _0x537165[_0x8674('0x1e')];}_0xcec925[_0x8674('0x12')](_0x39b0b4)['send'](_0x537165);};}exports[_0x8674('0x1f')]=function(_0x3a0047,_0x561d10){var _0x1563c4={};var _0x460891=_[_0x8674('0x20')](db[_0x8674('0x21')]['rawAttributes'],function(_0x230d98){return{'name':_0x230d98[_0x8674('0x22')],'type':_0x230d98['type'][_0x8674('0x23')]};});_0x1563c4=qs[_0x8674('0x24')](_0x460891,_0x3a0047);return interaction[_0x8674('0x25')](_0x8674('0x26'),_0x3a0047[_0x8674('0x27')],_0x3a0047[_0x8674('0x28')],_0x1563c4,_0x460891)[_0x8674('0x1b')](respondWithFilteredResult(_0x561d10,_0x1563c4))[_0x8674('0x29')](handleError(_0x561d10,null));};exports['show']=function(_0x5dcd10,_0x3e3dee){var _0x1a0187={'raw':![],'where':{'id':_0x5dcd10['params']['id']}},_0xa121fc={};_0xa121fc['model']=_[_0x8674('0x2a')](db['FaxInteraction']['rawAttributes']);_0xa121fc[_0x8674('0x27')]=_['keys'](_0x5dcd10['query']);_0xa121fc['filters']=_[_0x8674('0x2b')](_0xa121fc[_0x8674('0x2c')],_0xa121fc[_0x8674('0x27')]);_0x1a0187[_0x8674('0x2d')]=_[_0x8674('0x2b')](_0xa121fc[_0x8674('0x2c')],qs[_0x8674('0x2e')](_0x5dcd10['query'][_0x8674('0x2e')]));_0x1a0187[_0x8674('0x2d')]=_0x1a0187['attributes'][_0x8674('0x2f')]?_0x1a0187[_0x8674('0x2d')]:_0xa121fc[_0x8674('0x2c')];if(_0x5dcd10[_0x8674('0x27')][_0x8674('0x30')]){_0x1a0187[_0x8674('0x31')]=[{'all':!![]}];}_0x1a0187=_[_0x8674('0x32')]({},_0x1a0187,_0x5dcd10[_0x8674('0x33')]);return db['FaxInteraction'][_0x8674('0x34')](_0x1a0187)[_0x8674('0x1b')](handleEntityNotFound(_0x3e3dee,null))['then'](respondWithResult(_0x3e3dee,null))[_0x8674('0x29')](handleError(_0x3e3dee,null));};exports['create']=function(_0x60d651,_0x2da5d6){return db[_0x8674('0x21')]['create'](_0x60d651['body'],{})[_0x8674('0x1b')](respondWithResult(_0x2da5d6,0xc9))[_0x8674('0x29')](handleError(_0x2da5d6,null));};exports[_0x8674('0x1a')]=function(_0x3b9296,_0x2c949d){if(_0x3b9296[_0x8674('0x35')]['id']){delete _0x3b9296[_0x8674('0x35')]['id'];}return db['FaxInteraction'][_0x8674('0x34')]({'where':{'id':_0x3b9296[_0x8674('0x36')]['id']}})[_0x8674('0x1b')](handleEntityNotFound(_0x2c949d,null))['then'](saveUpdates(_0x3b9296[_0x8674('0x35')],null))[_0x8674('0x1b')](respondWithResult(_0x2c949d,null))[_0x8674('0x29')](handleError(_0x2c949d,null));};exports[_0x8674('0x1c')]=function(_0x5a78e8,_0x4bbe74){return db[_0x8674('0x21')][_0x8674('0x34')]({'where':{'id':_0x5a78e8[_0x8674('0x36')]['id']}})[_0x8674('0x1b')](handleEntityNotFound(_0x4bbe74,null))[_0x8674('0x1b')](removeEntity(_0x4bbe74,null))['catch'](handleError(_0x4bbe74,null));};exports[_0x8674('0x37')]=function(_0x6efb9c,_0x5dfc48){return db[_0x8674('0x21')][_0x8674('0x37')]()[_0x8674('0x1b')](respondWithResult(_0x5dfc48,null))['catch'](handleError(_0x5dfc48,null));};exports[_0x8674('0x38')]=function(_0xbd26e0,_0x5a6d96){return db[_0x8674('0x39')]['find']({'where':{'id':_0xbd26e0[_0x8674('0x36')]['id']}})['then'](handleEntityNotFound(_0x5a6d96,null))[_0x8674('0x1b')](function(_0x22241c){if(_0x22241c){return _0x22241c['addMessage'](_0xbd26e0[_0x8674('0x35')][_0x8674('0x3a')],_[_0x8674('0x3b')](_0xbd26e0['body'],[_0x8674('0x3a'),'id'])||{});}})[_0x8674('0x1b')](respondWithResult(_0x5a6d96,null))[_0x8674('0x29')](handleError(_0x5a6d96,null));};exports['getMessages']=function(_0x32de93,_0x15f1fb){var _0x919e20={'raw':![],'where':{}};var _0x3012cf={};var _0x4ae60a={'count':0x0,'rows':[]};return db[_0x8674('0x21')]['findOne']({'where':{'id':_0x32de93[_0x8674('0x36')]['id']}})[_0x8674('0x1b')](handleEntityNotFound(_0x15f1fb,null))['then'](function(_0x1d423a){if(_0x1d423a){_0x3012cf[_0x8674('0x2c')]=_[_0x8674('0x2a')](db[_0x8674('0x39')][_0x8674('0x3c')]);_0x3012cf[_0x8674('0x27')]=_[_0x8674('0x2a')](_0x32de93['query']);_0x3012cf[_0x8674('0x3d')]=_[_0x8674('0x2b')](_0x3012cf[_0x8674('0x2c')],_0x3012cf[_0x8674('0x27')]);_0x919e20[_0x8674('0x2d')]=_[_0x8674('0x2b')](_0x3012cf[_0x8674('0x2c')],qs[_0x8674('0x2e')](_0x32de93[_0x8674('0x27')]['fields']));_0x919e20[_0x8674('0x2d')]=_0x919e20['attributes'][_0x8674('0x2f')]?_0x919e20['attributes']:_0x3012cf[_0x8674('0x2c')];if(!_0x32de93[_0x8674('0x27')][_0x8674('0x3e')](_0x8674('0x3f'))){_0x919e20[_0x8674('0x13')]=qs[_0x8674('0x13')](_0x32de93[_0x8674('0x27')]['limit']);_0x919e20['offset']=qs['offset'](_0x32de93[_0x8674('0x27')][_0x8674('0x16')]);}_0x919e20[_0x8674('0x40')]=qs[_0x8674('0x41')](_0x32de93[_0x8674('0x27')][_0x8674('0x41')]);_0x919e20[_0x8674('0x42')]=qs['filters'](_['pick'](_0x32de93['query'],_0x3012cf[_0x8674('0x3d')]));_0x919e20[_0x8674('0x42')][_0x8674('0x43')]=_0x1d423a['id'];if(_0x32de93[_0x8674('0x27')]['filter']){_0x919e20[_0x8674('0x42')]=_['merge'](_0x919e20['where'],{'$or':_['map'](_0x919e20['attributes'],function(_0x1e35e9){var _0x27cf81={};_0x27cf81[_0x1e35e9]={'$like':'%'+_0x32de93[_0x8674('0x27')][_0x8674('0x44')]+'%'};return _0x27cf81;})});}if(_0x32de93[_0x8674('0x27')][_0x8674('0x45')]){var _0x46711f=_0x32de93[_0x8674('0x27')][_0x8674('0x45')][_0x8674('0x46')](',');var _0x182506={};_0x182506[_0x46711f[0x0]]={'$gte':moment(_0x46711f[0x1])['format'](_0x8674('0x47'))};_0x919e20[_0x8674('0x42')]=_[_0x8674('0x32')](_0x919e20[_0x8674('0x42')],_0x182506);}_0x919e20=_['merge']({},_0x919e20,_0x32de93[_0x8674('0x33')]);return db[_0x8674('0x39')][_0x8674('0x15')]({'where':_0x919e20['where']})[_0x8674('0x1b')](function(_0x1fa78b){_0x4ae60a[_0x8674('0x15')]=_0x1fa78b;if(_0x32de93[_0x8674('0x27')][_0x8674('0x30')]){_0x919e20[_0x8674('0x31')]=[{'all':!![]}];}return db[_0x8674('0x39')][_0x8674('0x25')](_0x919e20);})['then'](function(_0x44a4e6){_0x4ae60a[_0x8674('0x48')]=_0x44a4e6;return _0x4ae60a;});}})['then'](respondWithFilteredResult(_0x15f1fb,_0x919e20))[_0x8674('0x29')](handleError(_0x15f1fb,null));};exports['addTags']=function(_0x3377b9,_0x4e463a){return db[_0x8674('0x21')][_0x8674('0x34')]({'where':{'id':_0x3377b9[_0x8674('0x36')]['id']}})['then'](handleEntityNotFound(_0x4e463a,null))[_0x8674('0x1b')](function(_0x245ac5){if(_0x245ac5){return _0x245ac5[_0x8674('0x49')](_0x3377b9[_0x8674('0x35')][_0x8674('0x3a')],_[_0x8674('0x3b')](_0x3377b9[_0x8674('0x35')],[_0x8674('0x3a'),'id'])||{})[_0x8674('0x4a')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8674('0x1e'),'color'],'where':{'id':_0x3377b9['body'][_0x8674('0x3a')]}});})[_0x8674('0x1b')](function(_0x1a3f31){socket['emit']('faxInteractionTags:save',{'id':Number(_0x3377b9[_0x8674('0x36')]['id']),'tags':_0x1a3f31||[]});return{'id':Number(_0x3377b9[_0x8674('0x36')]['id']),'tags':_0x1a3f31||[]};});}})[_0x8674('0x1b')](respondWithResult(_0x4e463a,null))[_0x8674('0x29')](handleError(_0x4e463a,null));};exports[_0x8674('0x4b')]=function(_0x5c2e2a,_0x31b969){return db[_0x8674('0x21')][_0x8674('0x34')]({'where':{'id':_0x5c2e2a[_0x8674('0x36')]['id']}})[_0x8674('0x1b')](handleEntityNotFound(_0x31b969,null))[_0x8674('0x1b')](function(_0x2ac759){if(_0x2ac759){return _0x2ac759[_0x8674('0x4b')](_0x5c2e2a[_0x8674('0x27')][_0x8674('0x3a')]);}})[_0x8674('0x1b')](respondWithStatusCode(_0x31b969,null))[_0x8674('0x29')](handleError(_0x31b969,null));};exports[_0x8674('0x4c')]=function(_0xa36927,_0x27f1b4){var _0xfcd74=moment()['unix']()[_0x8674('0x4d')]();var _0x3c8b78=path[_0x8674('0x4e')](config[_0x8674('0x4f')],_0x8674('0x50'),_0x8674('0x51'),_0x8674('0x52'));var _0x450f97=path['join'](config[_0x8674('0x4f')],_0x8674('0x50'),_0x8674('0x51'),'attachments');var _0x740a86=path['join'](_0x3c8b78,_0xfcd74);var _0x222c30=util['format'](_0x8674('0x53'),_0xa36927[_0x8674('0x36')]['id'],_0xfcd74);var _0x85b1cb=path['join'](_0x3c8b78,_0x222c30);var _0x449ee3=[];_0x449ee3[_0x8674('0x54')]({'model':db[_0x8674('0x55')],'as':_0x8674('0x55'),'raw':!![]});var _0x28b928=[{'model':db[_0x8674('0x39')],'as':'Messages','attributes':['id','body',_0x8674('0x56')],'include':_0x449ee3}];return db['FaxInteraction'][_0x8674('0x34')]({'where':{'id':_0xa36927[_0x8674('0x36')]['id']},'include':_0x28b928})[_0x8674('0x1b')](handleEntityNotFound(_0x27f1b4,null))[_0x8674('0x1b')](function(_0x5d8e9e){if(_0x5d8e9e&&_0x5d8e9e[_0x8674('0x57')]){var _0xc682ca=_0x5d8e9e[_0x8674('0x58')]({'plain':!![]});fs[_0x8674('0x59')](_0x740a86);for(var _0x373dd6=0x0;_0x373dd6<_0xc682ca[_0x8674('0x57')][_0x8674('0x2f')];_0x373dd6++){var _0x112f8c=_0xc682ca[_0x8674('0x57')][_0x373dd6][_0x8674('0x55')];if(_0x112f8c){var _0x23c239=path[_0x8674('0x4e')](_0x450f97,_0x112f8c['basename']);if(fs[_0x8674('0x5a')](_0x23c239)){fs[_0x8674('0x5b')](_0x23c239)[_0x8674('0x5c')](fs[_0x8674('0x5d')](path[_0x8674('0x4e')](_0x740a86,_0x112f8c[_0x8674('0x5e')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x8dd336,_0x1422c5){zipdir(_0x740a86,{'saveTo':_0x85b1cb},function(_0x3470e3,_0xfcaaaf){if(_0x3470e3)return _0x1422c5(_0x3470e3);return _0x8dd336(_0xfcaaaf);});})['then'](function(){return new BPromise(function(_0x584b89,_0x3f0c83){rimraf(_0x740a86,function(_0x5e6325){if(_0x5e6325)_0x3f0c83(_0x5e6325);return _0x584b89();});});})[_0x8674('0x1b')](function(){return _0x27f1b4[_0x8674('0x4c')](_0x85b1cb,_0x222c30,function(_0x3ea398){if(_0x3ea398){console[_0x8674('0x5f')](_0x8674('0x60'),_0x3ea398);}else{fs[_0x8674('0x61')](_0x85b1cb);}});});});}else{return _0x27f1b4['sendStatus'](0xc8);}})['catch'](handleError(_0x27f1b4,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ae97fc4..359c55b 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 _0x6101=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','remove','then'];(function(_0x3fe6f0,_0x440d9e){var _0x535e1a=function(_0x17b71a){while(--_0x17b71a){_0x3fe6f0['push'](_0x3fe6f0['shift']());}};_0x535e1a(++_0x440d9e);}(_0x6101,0x89));var _0x1610=function(_0x257b30,_0x27760e){_0x257b30=_0x257b30-0x0;var _0x2b00a8=_0x6101[_0x257b30];return _0x2b00a8;};'use strict';var EventEmitter=require(_0x1610('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0x1610('0x1'))['db'][_0x1610('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1610('0x3')](0x0);var events={'afterCreate':_0x1610('0x4'),'afterUpdate':'update','afterDestroy':_0x1610('0x5')};function emitEvent(_0xaa85c8){return function(_0x4d8645,_0x264a50,_0x35e756){_0x4d8645['getUsers']({'attributes':['id'],'raw':!![]})[_0x1610('0x6')](function(_0x17564c){_0x4d8645[_0x1610('0x7')](_0x1610('0x8'),_0x17564c[_0x1610('0x9')](function(_0x1286fe){return{'id':_0x1286fe['id']};}));return FaxMessage[_0x1610('0xa')]({'where':{'FaxInteractionId':_0x4d8645['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5c8ae0){_0x4d8645[_0x1610('0x7')](_0x1610('0xb'),_0x5c8ae0[_0x1610('0xc')]);FaxInteractionEvents['emit'](_0xaa85c8+':'+_0x4d8645['id'],_0x4d8645);FaxInteractionEvents[_0x1610('0xd')](_0xaa85c8,_0x4d8645);_0x35e756(null);})[_0x1610('0xe')](_0x35e756(null));};}for(var e in events){if(events[_0x1610('0xf')](e)){var event=events[e];FaxInteraction[_0x1610('0x10')](e,emitEvent(event));}}module[_0x1610('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x679d=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','then','findAll','unreadMessages','length','emit','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x679d,0x146));var _0xd679=function(_0x22d534,_0x53d8c0){_0x22d534=_0x22d534-0x0;var _0x3a207a=_0x679d[_0x22d534];return _0x3a207a;};'use strict';var EventEmitter=require(_0xd679('0x0'));var FaxInteraction=require(_0xd679('0x1'))['db'][_0xd679('0x2')];var FaxMessage=require(_0xd679('0x1'))['db'][_0xd679('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd679('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd679('0x5'),'afterDestroy':_0xd679('0x6')};function emitEvent(_0x5ab3eb){return function(_0xfc8a03,_0x330461,_0x2b24c1){_0xfc8a03[_0xd679('0x7')]({'attributes':['id'],'raw':!![]})[_0xd679('0x8')](function(_0x516177){_0xfc8a03['setDataValue']('Users',_0x516177['map'](function(_0x5f3f03){return{'id':_0x5f3f03['id']};}));return FaxMessage[_0xd679('0x9')]({'where':{'FaxInteractionId':_0xfc8a03['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd679('0x8')](function(_0x12aaf2){_0xfc8a03['setDataValue'](_0xd679('0xa'),_0x12aaf2[_0xd679('0xb')]);FaxInteractionEvents[_0xd679('0xc')](_0x5ab3eb+':'+_0xfc8a03['id'],_0xfc8a03);FaxInteractionEvents[_0xd679('0xc')](_0x5ab3eb,_0xfc8a03);_0x2b24c1(null);})[_0xd679('0xd')](_0x2b24c1(null));};}for(var e in events){if(events[_0xd679('0xe')](e)){var event=events[e];FaxInteraction[_0xd679('0xf')](e,emitEvent(event));}}module[_0xd679('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b63c561..ffadd2a 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 _0x8d72=['exports','define','FaxInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d72,0x13a));var _0x28d7=function(_0x39be62,_0xe8fbd9){_0x39be62=_0x39be62-0x0;var _0x57f227=_0x8d72[_0x39be62];return _0x57f227;};'use strict';var _=require(_0x28d7('0x0'));var util=require(_0x28d7('0x1'));var logger=require(_0x28d7('0x2'))('api');var moment=require(_0x28d7('0x3'));var BPromise=require(_0x28d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x28d7('0x5'));var config=require(_0x28d7('0x6'));var attributes=require(_0x28d7('0x7'));module[_0x28d7('0x8')]=function(_0xa18e48,_0x275f13){return _0xa18e48[_0x28d7('0x9')](_0x28d7('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x294757,_0x1f53db,_0xad6bed){if(_0x294757['changed']('closed')){_0x294757[_0x28d7('0xb')]=moment()[_0x28d7('0xc')](_0x28d7('0xd'));}_0xad6bed(null,_0x294757);}}});}; \ No newline at end of file +var _0x298d=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise','path'];(function(_0x77fbf8,_0x31cf3f){var _0x2df250=function(_0x24b65f){while(--_0x24b65f){_0x77fbf8['push'](_0x77fbf8['shift']());}};_0x2df250(++_0x31cf3f);}(_0x298d,0xcd));var _0xd298=function(_0x15121a,_0x14450){_0x15121a=_0x15121a-0x0;var _0x32cca0=_0x298d[_0x15121a];return _0x32cca0;};'use strict';var _=require(_0xd298('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd298('0x1'));var BPromise=require(_0xd298('0x2'));var rp=require(_0xd298('0x3'));var fs=require('fs');var path=require(_0xd298('0x4'));var rimraf=require(_0xd298('0x5'));var config=require(_0xd298('0x6'));var attributes=require(_0xd298('0x7'));module[_0xd298('0x8')]=function(_0x30ac68,_0x604373){return _0x30ac68[_0xd298('0x9')](_0xd298('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f8561,_0x4a41e8,_0x5d28d6){if(_0x4f8561['changed'](_0xd298('0xb'))){_0x4f8561['closedAt']=moment()[_0xd298('0xc')](_0xd298('0xd'));}_0x5d28d6(null,_0x4f8561);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f117ff4..ccae929 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 _0x7836=['catch','UpdateFaxInteraction','FaxInteraction','body','options','where','limit','AddTagsToFaxInteraction','find','addTags','ids','AddTags','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result'];(function(_0x24e121,_0x38a027){var _0x29a46e=function(_0xcef060){while(--_0xcef060){_0x24e121['push'](_0x24e121['shift']());}};_0x29a46e(++_0x38a027);}(_0x7836,0xc5));var _0x6783=function(_0x18307e,_0x1898e8){_0x18307e=_0x18307e-0x0;var _0x24186b=_0x7836[_0x18307e];return _0x24186b;};'use strict';var _=require('lodash');var util=require(_0x6783('0x0'));var moment=require(_0x6783('0x1'));var BPromise=require(_0x6783('0x2'));var rs=require(_0x6783('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6783('0x4'))('rpc');var config=require(_0x6783('0x5'));var jayson=require(_0x6783('0x6'));var client=jayson[_0x6783('0x7')][_0x6783('0x8')]({'port':0x232a});config[_0x6783('0x9')]=_[_0x6783('0xa')](config[_0x6783('0x9')],{'host':_0x6783('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6783('0x9')]));require(_0x6783('0xc'))[_0x6783('0xd')](socket);function respondWithRpcPromise(_0x3d8347,_0x5c303f,_0x12d7fa){return new BPromise(function(_0x15bcfe,_0xc2adca){return client['request'](_0x3d8347,_0x12d7fa)[_0x6783('0xe')](function(_0x1cc7c7){logger[_0x6783('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x5c303f,_0x6783('0x10'));logger[_0x6783('0x11')](_0x6783('0x12'),_0x5c303f,_0x6783('0x10'),JSON[_0x6783('0x13')](_0x1cc7c7));if(_0x1cc7c7[_0x6783('0x14')]){if(_0x1cc7c7[_0x6783('0x14')][_0x6783('0x15')]===0x1f4){logger[_0x6783('0x14')](_0x6783('0x16'),_0x5c303f,_0x1cc7c7[_0x6783('0x14')][_0x6783('0x17')]);return _0xc2adca(_0x1cc7c7[_0x6783('0x14')][_0x6783('0x17')]);}logger[_0x6783('0x14')](_0x6783('0x16'),_0x5c303f,_0x1cc7c7[_0x6783('0x14')][_0x6783('0x17')]);return _0x15bcfe(_0x1cc7c7[_0x6783('0x14')][_0x6783('0x17')]);}else{logger[_0x6783('0xf')](_0x6783('0x16'),_0x5c303f,_0x6783('0x10'));_0x15bcfe(_0x1cc7c7[_0x6783('0x18')][_0x6783('0x17')]);}})[_0x6783('0x19')](function(_0x335fb7){logger[_0x6783('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x5c303f,_0x335fb7);_0xc2adca(_0x335fb7);});});}exports[_0x6783('0x1a')]=function(_0x1743c7){var _0x15a7bd=this;return new Promise(function(_0x1630a9,_0x4a2870){return db[_0x6783('0x1b')]['update'](_0x1743c7[_0x6783('0x1c')],{'raw':_0x1743c7['options']?_0x1743c7[_0x6783('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1743c7[_0x6783('0x1d')]?_0x1743c7[_0x6783('0x1d')][_0x6783('0x1e')]||null:null,'attributes':_0x1743c7['options']?_0x1743c7[_0x6783('0x1d')]['attributes']||null:null,'limit':_0x1743c7['options']?_0x1743c7[_0x6783('0x1d')][_0x6783('0x1f')]||null:null})[_0x6783('0xe')](function(_0x421422){logger[_0x6783('0xf')](_0x6783('0x1a'),_0x1743c7);logger[_0x6783('0x11')](_0x6783('0x1a'),_0x1743c7,JSON[_0x6783('0x13')](_0x421422));_0x1630a9(_0x421422);})[_0x6783('0x19')](function(_0x582ad3){logger[_0x6783('0x14')](_0x6783('0x1a'),_0x582ad3['message'],_0x1743c7);_0x4a2870(_0x15a7bd[_0x6783('0x14')](0x1f4,_0x582ad3[_0x6783('0x17')]));});});};exports[_0x6783('0x20')]=function(_0x5a0ecf){return new Promise(function(_0x3747c5,_0x5c7dd2){return db[_0x6783('0x1b')][_0x6783('0x21')]({'where':_0x5a0ecf[_0x6783('0x1d')]?_0x5a0ecf['options']['where']||null:null})[_0x6783('0xe')](function(_0x114ea6){if(_0x114ea6){return _0x114ea6[_0x6783('0x22')](_0x5a0ecf[_0x6783('0x1c')][_0x6783('0x23')],_['omit'](_0x5a0ecf[_0x6783('0x1c')],['ids','id'])||{});}})['spread'](function(_0x383eb0){logger[_0x6783('0xf')](_0x6783('0x24'),_0x5a0ecf);logger[_0x6783('0x11')](_0x6783('0x24'),_0x5a0ecf,JSON[_0x6783('0x13')](_0x383eb0));_0x3747c5(_0x383eb0);})[_0x6783('0x19')](function(_0x508c08){logger[_0x6783('0x14')]('AddTags',_0x508c08[_0x6783('0x17')],_0x5a0ecf);_0x5c7dd2(_this['error'](0x1f4,_0x508c08['message']));});});}; \ No newline at end of file +var _0x2f2a=['spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','FaxInteraction','body','options','raw','attributes','limit','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','find','where','omit','ids'];(function(_0x1652b2,_0x33ab8e){var _0x385c1c=function(_0x452da6){while(--_0x452da6){_0x1652b2['push'](_0x1652b2['shift']());}};_0x385c1c(++_0x33ab8e);}(_0x2f2a,0x14a));var _0xa2f2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2f2a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa2f2('0x0'));var util=require(_0xa2f2('0x1'));var moment=require(_0xa2f2('0x2'));var BPromise=require(_0xa2f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa2f2('0x5'))(_0xa2f2('0x6'));var config=require(_0xa2f2('0x7'));var jayson=require(_0xa2f2('0x8'));var client=jayson[_0xa2f2('0x9')][_0xa2f2('0xa')]({'port':0x232a});config[_0xa2f2('0xb')]=_[_0xa2f2('0xc')](config[_0xa2f2('0xb')],{'host':_0xa2f2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2f2('0xb')]));require('./faxInteraction.socket')[_0xa2f2('0xe')](socket);function respondWithRpcPromise(_0x28e2d9,_0x537ff1,_0x9bb150){return new BPromise(function(_0x3c84b7,_0x8d19c8){return client[_0xa2f2('0xf')](_0x28e2d9,_0x9bb150)[_0xa2f2('0x10')](function(_0x4b1ee2){logger[_0xa2f2('0x11')](_0xa2f2('0x12'),_0x537ff1,_0xa2f2('0x13'));logger[_0xa2f2('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x537ff1,_0xa2f2('0x13'),JSON[_0xa2f2('0x15')](_0x4b1ee2));if(_0x4b1ee2[_0xa2f2('0x16')]){if(_0x4b1ee2[_0xa2f2('0x16')][_0xa2f2('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x537ff1,_0x4b1ee2[_0xa2f2('0x16')]['message']);return _0x8d19c8(_0x4b1ee2[_0xa2f2('0x16')][_0xa2f2('0x18')]);}logger[_0xa2f2('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x537ff1,_0x4b1ee2['error']['message']);return _0x3c84b7(_0x4b1ee2[_0xa2f2('0x16')][_0xa2f2('0x18')]);}else{logger['info'](_0xa2f2('0x12'),_0x537ff1,_0xa2f2('0x13'));_0x3c84b7(_0x4b1ee2[_0xa2f2('0x19')]['message']);}})['catch'](function(_0x247a07){logger[_0xa2f2('0x16')](_0xa2f2('0x12'),_0x537ff1,_0x247a07);_0x8d19c8(_0x247a07);});});}exports['UpdateFaxInteraction']=function(_0x55ab8f){var _0x20efb4=this;return new Promise(function(_0xca5350,_0x3685b1){return db[_0xa2f2('0x1a')]['update'](_0x55ab8f[_0xa2f2('0x1b')],{'raw':_0x55ab8f[_0xa2f2('0x1c')]?_0x55ab8f[_0xa2f2('0x1c')][_0xa2f2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55ab8f[_0xa2f2('0x1c')]?_0x55ab8f['options']['where']||null:null,'attributes':_0x55ab8f['options']?_0x55ab8f[_0xa2f2('0x1c')][_0xa2f2('0x1e')]||null:null,'limit':_0x55ab8f[_0xa2f2('0x1c')]?_0x55ab8f[_0xa2f2('0x1c')][_0xa2f2('0x1f')]||null:null})[_0xa2f2('0x10')](function(_0x536db4){logger[_0xa2f2('0x11')](_0xa2f2('0x20'),_0x55ab8f);logger['debug'](_0xa2f2('0x20'),_0x55ab8f,JSON[_0xa2f2('0x15')](_0x536db4));_0xca5350(_0x536db4);})[_0xa2f2('0x21')](function(_0xd0917c){logger[_0xa2f2('0x16')](_0xa2f2('0x20'),_0xd0917c[_0xa2f2('0x18')],_0x55ab8f);_0x3685b1(_0x20efb4[_0xa2f2('0x16')](0x1f4,_0xd0917c[_0xa2f2('0x18')]));});});};exports[_0xa2f2('0x22')]=function(_0x48921b){return new Promise(function(_0xab277c,_0x18a1e6){return db[_0xa2f2('0x1a')][_0xa2f2('0x23')]({'where':_0x48921b['options']?_0x48921b[_0xa2f2('0x1c')][_0xa2f2('0x24')]||null:null})[_0xa2f2('0x10')](function(_0xf29499){if(_0xf29499){return _0xf29499['addTags'](_0x48921b[_0xa2f2('0x1b')]['ids'],_[_0xa2f2('0x25')](_0x48921b[_0xa2f2('0x1b')],[_0xa2f2('0x26'),'id'])||{});}})[_0xa2f2('0x27')](function(_0x12e142){logger[_0xa2f2('0x11')]('AddTags',_0x48921b);logger[_0xa2f2('0x14')](_0xa2f2('0x28'),_0x48921b,JSON['stringify'](_0x12e142));_0xab277c(_0x12e142);})[_0xa2f2('0x21')](function(_0x3e449a){logger[_0xa2f2('0x16')](_0xa2f2('0x28'),_0x3e449a['message'],_0x48921b);_0x18a1e6(_this[_0xa2f2('0x16')](0x1f4,_0x3e449a[_0xa2f2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d638814..bf22596 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 _0x46ad=['length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0x46ad,0x1b8));var _0xd46a=function(_0x134c95,_0x49ed19){_0x134c95=_0x134c95-0x0;var _0x5ac841=_0x46ad[_0x134c95];return _0x5ac841;};'use strict';var FaxInteractionEvents=require(_0xd46a('0x0'));var events=[_0xd46a('0x1'),_0xd46a('0x2'),_0xd46a('0x3')];function createListener(_0x2ebd91,_0x514167){return function(_0x39da46){_0x514167['emit'](_0x2ebd91,_0x39da46);};}function removeListener(_0x2f81d0,_0xb68af5){return function(){FaxInteractionEvents['removeListener'](_0x2f81d0,_0xb68af5);};}exports['register']=function(_0x20e1a7){for(var _0x300cc4=0x0,_0x370324=events[_0xd46a('0x4')];_0x300cc4<_0x370324;_0x300cc4++){var _0x4cfb0d=events[_0x300cc4];var _0x5857d8=createListener(_0xd46a('0x5')+_0x4cfb0d,_0x20e1a7);FaxInteractionEvents['on'](_0x4cfb0d,_0x5857d8);}}; \ No newline at end of file +var _0x2d5a=['save','remove','update','emit','removeListener','register','length','./faxInteraction.events'];(function(_0x28ace8,_0x131557){var _0x3957e0=function(_0x34bffa){while(--_0x34bffa){_0x28ace8['push'](_0x28ace8['shift']());}};_0x3957e0(++_0x131557);}(_0x2d5a,0x1bf));var _0xa2d5=function(_0x1479f9,_0x19b556){_0x1479f9=_0x1479f9-0x0;var _0x43be14=_0x2d5a[_0x1479f9];return _0x43be14;};'use strict';var FaxInteractionEvents=require(_0xa2d5('0x0'));var events=[_0xa2d5('0x1'),_0xa2d5('0x2'),_0xa2d5('0x3')];function createListener(_0x1d25bf,_0x587a4f){return function(_0x430438){_0x587a4f[_0xa2d5('0x4')](_0x1d25bf,_0x430438);};}function removeListener(_0x270fec,_0x2f2e66){return function(){FaxInteractionEvents[_0xa2d5('0x5')](_0x270fec,_0x2f2e66);};}exports[_0xa2d5('0x6')]=function(_0x538bfa){for(var _0x2a0a1c=0x0,_0x3469ab=events[_0xa2d5('0x7')];_0x2a0a1c<_0x3469ab;_0x2a0a1c++){var _0xe161ac=events[_0x2a0a1c];var _0x11ce74=createListener('faxInteraction:'+_0xe161ac,_0x538bfa);FaxInteractionEvents['on'](_0xe161ac,_0x11ce74);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index aae9732..6e9b139 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 _0x5bbd=['isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','fax','faxinteraction:addtags','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./faxInteraction.controller','get'];(function(_0x43e549,_0x10141f){var _0x97e4ec=function(_0x361405){while(--_0x361405){_0x43e549['push'](_0x43e549['shift']());}};_0x97e4ec(++_0x10141f);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var path=require(_0xd5bb('0x2'));var timeout=require(_0xd5bb('0x3'));var express=require(_0xd5bb('0x4'));var router=express[_0xd5bb('0x5')]();var fs_extra=require(_0xd5bb('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd5bb('0x7'));router[_0xd5bb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd5bb('0x8')]('/describe',auth[_0xd5bb('0x9')](),controller[_0xd5bb('0xa')]);router[_0xd5bb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd5bb('0xb')]);router[_0xd5bb('0x8')](_0xd5bb('0xc'),auth['isAuthenticated'](),controller[_0xd5bb('0xd')]);router[_0xd5bb('0x8')](_0xd5bb('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xd5bb('0xf')]('/',auth[_0xd5bb('0x9')](),controller['create']);router[_0xd5bb('0xf')]('/:id/messages',auth[_0xd5bb('0x9')](),controller['addMessage']);router[_0xd5bb('0xf')](_0xd5bb('0x10'),auth['isAuthenticated'](),interaction[_0xd5bb('0x11')](_0xd5bb('0x12'),_0xd5bb('0x13')),controller['addTags']);router['put'](_0xd5bb('0x14'),auth[_0xd5bb('0x9')](),interaction['tracked'](_0xd5bb('0x12'),_0xd5bb('0x15')),controller[_0xd5bb('0x16')]);router[_0xd5bb('0x17')]('/:id',auth[_0xd5bb('0x9')](),interaction[_0xd5bb('0x11')](_0xd5bb('0x12'),_0xd5bb('0x18')),controller[_0xd5bb('0x19')]);router[_0xd5bb('0x17')]('/:id/tags',auth[_0xd5bb('0x9')](),controller[_0xd5bb('0x1a')]);module[_0xd5bb('0x1b')]=router; \ No newline at end of file +var _0x811a=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x42dcf3,_0x443025){var _0x241c50=function(_0x1afa8e){while(--_0x1afa8e){_0x42dcf3['push'](_0x42dcf3['shift']());}};_0x241c50(++_0x443025);}(_0x811a,0xe3));var _0xa811=function(_0x25aa05,_0x4be055){_0x25aa05=_0x25aa05-0x0;var _0x371489=_0x811a[_0x25aa05];return _0x371489;};'use strict';var multer=require(_0xa811('0x0'));var util=require(_0xa811('0x1'));var path=require(_0xa811('0x2'));var timeout=require(_0xa811('0x3'));var express=require('express');var router=express[_0xa811('0x4')]();var fs_extra=require(_0xa811('0x5'));var auth=require(_0xa811('0x6'));var interaction=require(_0xa811('0x7'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0xa811('0x8')]('/',auth[_0xa811('0x9')](),controller[_0xa811('0xa')]);router['get'](_0xa811('0xb'),auth[_0xa811('0x9')](),controller[_0xa811('0xc')]);router['get'](_0xa811('0xd'),auth[_0xa811('0x9')](),controller[_0xa811('0xe')]);router[_0xa811('0x8')](_0xa811('0xf'),auth[_0xa811('0x9')](),controller[_0xa811('0x10')]);router['get']('/:id/download',auth[_0xa811('0x9')](),controller[_0xa811('0x11')]);router[_0xa811('0x12')]('/',auth['isAuthenticated'](),controller[_0xa811('0x13')]);router[_0xa811('0x12')](_0xa811('0xf'),auth[_0xa811('0x9')](),controller['addMessage']);router[_0xa811('0x12')](_0xa811('0x14'),auth[_0xa811('0x9')](),interaction[_0xa811('0x15')](_0xa811('0x16'),_0xa811('0x17')),controller[_0xa811('0x18')]);router['put'](_0xa811('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xa811('0x16'),_0xa811('0x19')),controller[_0xa811('0x1a')]);router[_0xa811('0x1b')]('/:id',auth[_0xa811('0x9')](),interaction[_0xa811('0x15')](_0xa811('0x16'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0xa811('0x14'),auth[_0xa811('0x9')](),controller['removeTags']);module[_0xa811('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8cb7ce0..a27b47c 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 _0x544a=['exports','TEXT','ENUM','out','sequelize'];(function(_0x27fedb,_0x31c693){var _0x58ab78=function(_0x532732){while(--_0x532732){_0x27fedb['push'](_0x27fedb['shift']());}};_0x58ab78(++_0x31c693);}(_0x544a,0xbd));var _0xa544=function(_0x5c073e,_0x1373fe){_0x5c073e=_0x5c073e-0x0;var _0x1279dd=_0x544a[_0x5c073e];return _0x1279dd;};'use strict';var Sequelize=require(_0xa544('0x0'));module[_0xa544('0x1')]={'body':{'type':Sequelize[_0xa544('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa544('0x3')]('in','out'),'defaultValue':_0xa544('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa544('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xa8eb=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x163157,_0x59eea5){var _0x3db535=function(_0x19aae2){while(--_0x19aae2){_0x163157['push'](_0x163157['shift']());}};_0x3db535(++_0x59eea5);}(_0xa8eb,0x179));var _0xba8e=function(_0x41f239,_0x2141fe){_0x41f239=_0x41f239-0x0;var _0x3e6ce7=_0xa8eb[_0x41f239];return _0x3e6ce7;};'use strict';var Sequelize=require(_0xba8e('0x0'));module['exports']={'body':{'type':Sequelize[_0xba8e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xba8e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xba8e('0x3')]('in',_0xba8e('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xba8e('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xba8e('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 10cb920..e268817 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 _0x05d9=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','update','body','params','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','isNil','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','stringify','acceptMessage','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','email','rejectmessage','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','FaxMessage','rawAttributes'];(function(_0x50c3e6,_0x3322fb){var _0x2d64b4=function(_0x531ff7){while(--_0x531ff7){_0x50c3e6['push'](_0x50c3e6['shift']());}};_0x2d64b4(++_0x3322fb);}(_0x05d9,0xdd));var _0x905d=function(_0x330964,_0x26f6dc){_0x330964=_0x330964-0x0;var _0x2d9e8b=_0x05d9[_0x330964];return _0x2d9e8b;};'use strict';var emlformat=require(_0x905d('0x0'));var rimraf=require(_0x905d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x905d('0x2'));var rp=require(_0x905d('0x3'));var moment=require(_0x905d('0x4'));var BPromise=require(_0x905d('0x5'));var Mustache=require(_0x905d('0x6'));var util=require(_0x905d('0x7'));var path=require(_0x905d('0x8'));var sox=require(_0x905d('0x9'));var csv=require(_0x905d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x905d('0xb'));var squel=require(_0x905d('0xc'));var crypto=require('crypto');var jsforce=require(_0x905d('0xd'));var deskjs=require(_0x905d('0xe'));var toCsv=require(_0x905d('0xa'));var querystring=require(_0x905d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x905d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x905d('0x11'));var logger=require(_0x905d('0x12'))(_0x905d('0x13'));var utils=require(_0x905d('0x14'));var config=require(_0x905d('0x15'));var licenseUtil=require(_0x905d('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x905d('0x17')](config[_0x905d('0x18')],{'host':_0x905d('0x19'),'port':0x18eb});var socket=require(_0x905d('0x1a'))(new Redis(config[_0x905d('0x18')]));require(_0x905d('0x1b'))[_0x905d('0x1c')](socket);var jayson=require(_0x905d('0x1d'));var client=jayson[_0x905d('0x1e')][_0x905d('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca1e6,_0x450763,_0x12e9bd,_0x52bd32){return new BPromise(function(_0x2abe4b,_0x3bebd3){var _0x4031b2=_0x52bd32||client;return _0x4031b2['request'](_0x4ca1e6,_0x12e9bd)[_0x905d('0x20')](function(_0x57ff0e){logger[_0x905d('0x21')]('FaxMessage,\x20%s,\x20%s',_0x450763,'request\x20sent');logger['debug'](_0x905d('0x22'),_0x450763,_0x905d('0x23'),JSON['stringify'](_0x57ff0e));if(_0x57ff0e[_0x905d('0x24')]){if(_0x57ff0e[_0x905d('0x24')][_0x905d('0x25')]===0x1f4){logger[_0x905d('0x24')](_0x905d('0x26'),_0x450763,_0x57ff0e[_0x905d('0x24')][_0x905d('0x27')]);return _0x3bebd3(_0x57ff0e[_0x905d('0x24')]['message']);}logger[_0x905d('0x24')](_0x905d('0x26'),_0x450763,_0x57ff0e['error']['message']);return _0x2abe4b(_0x57ff0e[_0x905d('0x24')][_0x905d('0x27')]);}else{logger[_0x905d('0x21')]('FaxMessage,\x20%s,\x20%s',_0x450763,'request\x20sent');_0x2abe4b(_0x57ff0e[_0x905d('0x28')][_0x905d('0x27')]);}})[_0x905d('0x29')](function(_0x599b62){logger[_0x905d('0x24')]('FaxMessage,\x20%s,\x20%s',_0x450763,_0x599b62);_0x3bebd3(_0x599b62);});});}function respondWithStatusCode(_0x52c50e,_0x337d27){_0x337d27=_0x337d27||0xcc;return function(_0x5be52a){if(_0x5be52a){return _0x52c50e[_0x905d('0x2a')](_0x337d27);}return _0x52c50e[_0x905d('0x2b')](_0x337d27)[_0x905d('0x2c')]();};}function respondWithResult(_0xf324b4,_0x32b7d5){_0x32b7d5=_0x32b7d5||0xc8;return function(_0x5314e7){if(_0x5314e7){return _0xf324b4[_0x905d('0x2b')](_0x32b7d5)['json'](_0x5314e7);}};}function respondWithFilteredResult(_0x18977d,_0x4868a1){return function(_0x40cfc4){if(_0x40cfc4){var _0x1401f9=typeof _0x4868a1[_0x905d('0x2d')]===_0x905d('0x2e')&&typeof _0x4868a1[_0x905d('0x2f')]===_0x905d('0x2e');var _0x2fb9a2=_0x40cfc4[_0x905d('0x30')];var _0x5a353e=_0x1401f9?0x0:_0x4868a1[_0x905d('0x2d')];var _0x38ba09=_0x1401f9?_0x40cfc4[_0x905d('0x30')]:_0x4868a1[_0x905d('0x2d')]+_0x4868a1[_0x905d('0x2f')];var _0x286734;if(_0x38ba09>=_0x2fb9a2){_0x38ba09=_0x2fb9a2;_0x286734=0xc8;}else{_0x286734=0xce;}_0x18977d[_0x905d('0x2b')](_0x286734);return _0x18977d[_0x905d('0x31')](_0x905d('0x32'),_0x5a353e+'-'+_0x38ba09+'/'+_0x2fb9a2)[_0x905d('0x33')](_0x40cfc4);}return null;};}function patchUpdates(_0x54eb72){return function(_0x50f60d){try{jsonpatch[_0x905d('0x34')](_0x50f60d,_0x54eb72,!![]);}catch(_0x47b8c6){return BPromise[_0x905d('0x35')](_0x47b8c6);}return _0x50f60d[_0x905d('0x36')]();};}function saveUpdates(_0x2f3ca4,_0x29f2af){return function(_0x596fae){if(_0x596fae){return _0x596fae['update'](_0x2f3ca4)['then'](function(_0x5495c8){return _0x5495c8;});}return null;};}function removeEntity(_0x473550,_0x23dc3c){return function(_0x4b732d){if(_0x4b732d){return _0x4b732d[_0x905d('0x37')]()[_0x905d('0x20')](function(){_0x473550['status'](0xcc)[_0x905d('0x2c')]();});}};}function handleEntityNotFound(_0x556ed5,_0x240dd0){return function(_0x3fb00f){if(!_0x3fb00f){_0x556ed5[_0x905d('0x2a')](0x194);}return _0x3fb00f;};}function handleError(_0x2d83a9,_0x2ad80a){_0x2ad80a=_0x2ad80a||0x1f4;return function(_0x560429){logger[_0x905d('0x24')](_0x560429[_0x905d('0x38')]);if(_0x560429[_0x905d('0x39')]){delete _0x560429[_0x905d('0x39')];}_0x2d83a9[_0x905d('0x2b')](_0x2ad80a)[_0x905d('0x3a')](_0x560429);};}exports[_0x905d('0x3b')]=function(_0x36cfb1,_0x27a9f6){var _0x498627={},_0x1c7a33={},_0x2a6755={'count':0x0,'rows':[]};var _0x53ddd8=_[_0x905d('0x3c')](db[_0x905d('0x3d')][_0x905d('0x3e')],function(_0x106a99){return{'name':_0x106a99[_0x905d('0x3f')],'type':_0x106a99[_0x905d('0x40')]['key']};});_0x1c7a33[_0x905d('0x41')]=_[_0x905d('0x3c')](_0x53ddd8,_0x905d('0x39'));_0x1c7a33[_0x905d('0x42')]=_[_0x905d('0x43')](_0x36cfb1[_0x905d('0x42')]);_0x1c7a33[_0x905d('0x44')]=_[_0x905d('0x45')](_0x1c7a33['model'],_0x1c7a33['query']);_0x498627[_0x905d('0x46')]=_[_0x905d('0x45')](_0x1c7a33[_0x905d('0x41')],qs[_0x905d('0x47')](_0x36cfb1[_0x905d('0x42')][_0x905d('0x47')]));_0x498627[_0x905d('0x46')]=_0x498627['attributes'][_0x905d('0x48')]?_0x498627[_0x905d('0x46')]:_0x1c7a33[_0x905d('0x41')];if(!_0x36cfb1[_0x905d('0x42')]['hasOwnProperty']('nolimit')){_0x498627[_0x905d('0x2f')]=qs[_0x905d('0x2f')](_0x36cfb1[_0x905d('0x42')][_0x905d('0x2f')]);_0x498627[_0x905d('0x2d')]=qs['offset'](_0x36cfb1[_0x905d('0x42')][_0x905d('0x2d')]);}_0x498627['order']=qs[_0x905d('0x49')](_0x36cfb1[_0x905d('0x42')][_0x905d('0x49')]);_0x498627[_0x905d('0x4a')]=qs[_0x905d('0x44')](_[_0x905d('0x4b')](_0x36cfb1['query'],_0x1c7a33['filters']),_0x53ddd8);if(_0x36cfb1[_0x905d('0x42')][_0x905d('0x4c')]){_0x498627[_0x905d('0x4a')]=_[_0x905d('0x4d')](_0x498627[_0x905d('0x4a')],{'$or':_['map'](_0x53ddd8,function(_0x4558f4){if(_0x4558f4['type']!==_0x905d('0x4e')){var _0x12231d={};_0x12231d[_0x4558f4[_0x905d('0x39')]]={'$like':'%'+_0x36cfb1['query'][_0x905d('0x4c')]+'%'};return _0x12231d;}})});}_0x498627=_[_0x905d('0x4d')]({},_0x498627,_0x36cfb1[_0x905d('0x4f')]);var _0x141de3={'where':_0x498627[_0x905d('0x4a')]};return db[_0x905d('0x3d')][_0x905d('0x30')](_0x141de3)['then'](function(_0x4cba92){_0x2a6755[_0x905d('0x30')]=_0x4cba92;if(_0x36cfb1[_0x905d('0x42')][_0x905d('0x50')]){_0x498627[_0x905d('0x51')]=[{'all':!![]}];}return db[_0x905d('0x3d')][_0x905d('0x52')](_0x498627);})['then'](function(_0x232369){_0x2a6755[_0x905d('0x53')]=_0x232369;return _0x2a6755;})[_0x905d('0x20')](respondWithFilteredResult(_0x27a9f6,_0x498627))[_0x905d('0x29')](handleError(_0x27a9f6,null));};exports[_0x905d('0x54')]=function(_0x5c22ae,_0x391777){var _0x5831ea={'raw':!![],'where':{'id':_0x5c22ae['params']['id']}},_0x405041={};_0x405041[_0x905d('0x41')]=_[_0x905d('0x43')](db[_0x905d('0x3d')][_0x905d('0x3e')]);_0x405041[_0x905d('0x42')]=_['keys'](_0x5c22ae[_0x905d('0x42')]);_0x405041[_0x905d('0x44')]=_['intersection'](_0x405041[_0x905d('0x41')],_0x405041[_0x905d('0x42')]);_0x5831ea[_0x905d('0x46')]=_['intersection'](_0x405041[_0x905d('0x41')],qs[_0x905d('0x47')](_0x5c22ae[_0x905d('0x42')][_0x905d('0x47')]));_0x5831ea['attributes']=_0x5831ea[_0x905d('0x46')][_0x905d('0x48')]?_0x5831ea[_0x905d('0x46')]:_0x405041['model'];if(_0x5c22ae['query']['includeAll']){_0x5831ea['include']=[{'all':!![]}];}_0x5831ea=_[_0x905d('0x4d')]({},_0x5831ea,_0x5c22ae[_0x905d('0x4f')]);return db[_0x905d('0x3d')][_0x905d('0x55')](_0x5831ea)[_0x905d('0x20')](handleEntityNotFound(_0x391777,null))[_0x905d('0x20')](respondWithResult(_0x391777,null))['catch'](handleError(_0x391777,null));};exports[_0x905d('0x56')]=function(_0x2138dd,_0x62776e){if(_0x2138dd[_0x905d('0x57')]['id']){delete _0x2138dd['body']['id'];}return db[_0x905d('0x3d')]['find']({'where':{'id':_0x2138dd['params']['id']}})['then'](handleEntityNotFound(_0x62776e,null))[_0x905d('0x20')](saveUpdates(_0x2138dd[_0x905d('0x57')],null))[_0x905d('0x20')](respondWithResult(_0x62776e,null))[_0x905d('0x29')](handleError(_0x62776e,null));};exports[_0x905d('0x37')]=function(_0x55a6b1,_0x13a9c2){return db['FaxMessage']['find']({'where':{'id':_0x55a6b1[_0x905d('0x58')]['id']}})[_0x905d('0x20')](handleEntityNotFound(_0x13a9c2,null))[_0x905d('0x20')](removeEntity(_0x13a9c2,null))[_0x905d('0x29')](handleError(_0x13a9c2,null));};exports['describe']=function(_0x5ebbb3,_0x54486a){return db[_0x905d('0x3d')][_0x905d('0x59')]()[_0x905d('0x20')](respondWithResult(_0x54486a,null))['catch'](handleError(_0x54486a,null));};var interaction_log=require('../../config/logger')(_0x905d('0x5a'));exports['accept']=function(_0x462d7b,_0x81aa25,_0x273426){var _0x4e5f8b={'agent':{},'channel':_0x905d('0x5b')};if(_0x462d7b[_0x905d('0x57')]['id']){delete _0x462d7b['body']['id'];}_0x462d7b[_0x905d('0x57')][_0x905d('0x5c')]=!![];_0x462d7b[_0x905d('0x57')][_0x905d('0x5d')]=moment()[_0x905d('0x5e')](_0x905d('0x5f'));_0x462d7b[_0x905d('0x57')][_0x905d('0x60')]=_0x462d7b[_0x905d('0x57')][_0x905d('0x60')]||_0x462d7b['user']['id'];_0x4e5f8b['agent']['id']=_0x462d7b[_0x905d('0x57')][_0x905d('0x60')];return db[_0x905d('0x3d')][_0x905d('0x55')]({'where':{'id':_0x462d7b[_0x905d('0x58')]['id'],'UserId':null}})[_0x905d('0x20')](handleEntityNotFound(_0x81aa25,null))[_0x905d('0x20')](saveUpdates(_0x462d7b[_0x905d('0x57')],null))[_0x905d('0x20')](function(_0x3d270a){if(_0x3d270a){_0x4e5f8b[_0x905d('0x27')]=_0x3d270a[_0x905d('0x61')]({'plain':!![]});return db[_0x905d('0x62')][_0x905d('0x55')]({'where':{'id':_0x3d270a['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x81aa25,null))['then'](function(_0x25984a){if(_0x25984a){return _0x25984a[_0x905d('0x56')]({'UserId':_0x462d7b[_0x905d('0x57')][_0x905d('0x60')],'read1stAt':_[_0x905d('0x63')](_0x25984a['read1stAt'])?moment()[_0x905d('0x5e')](_0x905d('0x5f')):undefined});}return null;})[_0x905d('0x20')](function(_0x33f49c){if(_0x33f49c){_0x4e5f8b['interaction']=_0x33f49c[_0x905d('0x61')]({'plain':!![]});interaction_log[_0x905d('0x21')](_0x905d('0x64'),_0x462d7b['user']['id'],_0x462d7b[_0x905d('0x65')]['name'],_0x462d7b[_0x905d('0x65')]['role'],_0x4e5f8b[_0x905d('0x66')]['id'],_0x462d7b[_0x905d('0x57')]?JSON[_0x905d('0x67')](_0x462d7b[_0x905d('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0x905d('0x68'),_0x4e5f8b);}return null;})['then'](function(_0x383345){var _0x5d83da='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x383345[_0x905d('0x27')]['ContactId'];return db['sequelize'][_0x905d('0x42')](_0x5d83da,{'type':db[_0x905d('0x69')][_0x905d('0x6a')][_0x905d('0x6b')],'raw':!![]})['then'](function(_0x75cefd){return _0x75cefd;});})['then'](function(_0x27e487){if(_0x27e487){_0x4e5f8b[_0x905d('0x27')][_0x905d('0x6c')]=_0x27e487[0x0];if(!_0x462d7b[_0x905d('0x57')][_0x905d('0x60')])return;return db[_0x905d('0x6d')][_0x905d('0x55')]({'where':{'id':_0x462d7b[_0x905d('0x57')][_0x905d('0x60')],'role':_0x905d('0x6e')},'attributes':['id',_0x905d('0x39'),_0x905d('0x6f'),'email',_0x905d('0x70')],'raw':!![]});}return null;})['then'](function(_0x6285c5){if(!_0x6285c5)return null;_0x4e5f8b[_0x905d('0x27')][_0x905d('0x6e')]=_0x6285c5;return _0x4e5f8b;})[_0x905d('0x20')](function(_0x33f1c3){if(_0x33f1c3){if(_0x462d7b[_0x905d('0x57')][_0x905d('0x71')]){_0x4e5f8b[_0x905d('0x27')][_0x905d('0x72')]=util[_0x905d('0x5e')](_0x905d('0x73'),_0x462d7b[_0x905d('0x65')]['name']);_0x4e5f8b[_0x905d('0x27')][_0x905d('0x74')]=_0x4e5f8b[_0x905d('0x74')];_0x4e5f8b[_0x905d('0x27')][_0x905d('0x75')]=_0x4e5f8b[_0x905d('0x74')];_0x4e5f8b['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x905d('0x76'),{'event':'acceptmessage','message':_0x4e5f8b[_0x905d('0x27')]},client9002)[_0x905d('0x20')](function(){return _0x4e5f8b;});}return _0x4e5f8b;}return null;})[_0x905d('0x20')](respondWithResult(_0x81aa25,null))[_0x905d('0x29')](handleError(_0x81aa25,null));};var interaction_log=require(_0x905d('0x12'))(_0x905d('0x5a'));exports['reject']=function(_0x45c019,_0x2f33cf,_0x330b2b){var _0x12d795={'agent':{},'channel':_0x905d('0x5b')};if(_0x45c019[_0x905d('0x57')]['id']){delete _0x45c019['body']['id'];}_0x45c019[_0x905d('0x57')][_0x905d('0x60')]=_0x45c019[_0x905d('0x57')]['UserId']||_0x45c019[_0x905d('0x65')]['id'];_0x12d795[_0x905d('0x6e')]['id']=_0x45c019['body']['UserId'];return db[_0x905d('0x3d')]['find']({'where':{'id':_0x45c019[_0x905d('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2f33cf,null))['then'](function(_0x5d4e42){if(_0x5d4e42){_0x12d795[_0x905d('0x27')]=_0x5d4e42[_0x905d('0x61')]({'plain':!![]});return db[_0x905d('0x62')][_0x905d('0x55')]({'where':{'id':_0x5d4e42[_0x905d('0x77')]}});}return null;})['then'](handleEntityNotFound(_0x2f33cf,null))[_0x905d('0x20')](function(_0x5e0657){if(_0x5e0657){_0x12d795[_0x905d('0x66')]=_0x5e0657[_0x905d('0x61')]({'plain':!![]});interaction_log['info'](_0x905d('0x78'),_0x45c019[_0x905d('0x65')]['id'],_0x45c019[_0x905d('0x65')][_0x905d('0x39')],_0x45c019[_0x905d('0x65')]['role'],_0x12d795[_0x905d('0x66')]['id'],_0x45c019[_0x905d('0x57')]?JSON[_0x905d('0x67')](_0x45c019[_0x905d('0x57')]):_0x905d('0x79'));return respondWithRpcPromise(_0x905d('0x7a'),_0x905d('0x7b'),_0x12d795);}return null;})['then'](function(_0x167bef){var _0x2aff7f=_0x905d('0x7c')+_0x167bef[_0x905d('0x27')]['ContactId'];return db[_0x905d('0x7d')][_0x905d('0x42')](_0x2aff7f,{'type':db[_0x905d('0x69')][_0x905d('0x6a')][_0x905d('0x6b')],'raw':!![]})[_0x905d('0x20')](function(_0x10cb46){return _0x10cb46;});})[_0x905d('0x20')](function(_0x4bb359){if(_0x4bb359){_0x12d795[_0x905d('0x27')][_0x905d('0x6c')]=_0x4bb359[0x0];if(!_0x45c019[_0x905d('0x57')][_0x905d('0x60')])return;return db[_0x905d('0x6d')]['find']({'where':{'id':_0x45c019[_0x905d('0x57')][_0x905d('0x60')],'role':_0x905d('0x6e')},'attributes':['id',_0x905d('0x39'),'fullname',_0x905d('0x7e'),_0x905d('0x70')],'raw':!![]});}return null;})[_0x905d('0x20')](function(_0x19aa68){if(!_0x19aa68)return null;_0x12d795[_0x905d('0x27')][_0x905d('0x6e')]=_0x19aa68;return _0x12d795;})['then'](function(_0x1820fc){if(_0x1820fc){_0x1820fc[_0x905d('0x27')]['interface']=util['format']('SIP/%s',_0x45c019[_0x905d('0x65')]['name']);_0x1820fc['message']['channel']=_0x12d795[_0x905d('0x74')];_0x1820fc[_0x905d('0x27')][_0x905d('0x75')]=_0x12d795['channel'];_0x1820fc[_0x905d('0x27')]['event']=_0x905d('0x35');respondWithRpcPromise(_0x905d('0x76'),_0x905d('0x76'),{'event':_0x905d('0x7f'),'message':_0x1820fc[_0x905d('0x27')]},client9002);return _0x12d795;}return null;})[_0x905d('0x20')](respondWithResult(_0x2f33cf,null))[_0x905d('0x29')](handleError(_0x2f33cf,null));};exports[_0x905d('0x80')]=function(_0xb7d39c,_0x5b99de){var _0x3a7613;return db[_0x905d('0x3d')]['create'](_0xb7d39c[_0x905d('0x57')],{})['then'](function(_0x230bf5){_0x3a7613=_0x230bf5;return db[_0x905d('0x81')][_0x905d('0x82')]({'where':{'id':_0x3a7613[_0x905d('0x83')]}});})[_0x905d('0x20')](function(_0xe55322){if(_[_0x905d('0x63')](_0xe55322)){return;}else{_0x3a7613[_0x905d('0x5b')]=_0xe55322[_0x905d('0x5b')];return db[_0x905d('0x84')]['findOne']({'where':{'id':_0x3a7613[_0x905d('0x85')]}});}})[_0x905d('0x20')](function(_0x236764){return respondWithRpcPromise(_0x905d('0x86'),_0x905d('0x86'),{'FaxAccountId':_[_0x905d('0x63')](_0xb7d39c[_0x905d('0x57')])?undefined:_0xb7d39c[_0x905d('0x57')][_0x905d('0x87')],'path':_[_0x905d('0x63')](_0x236764)?undefined:util[_0x905d('0x5e')](_0x905d('0x88'),_0x236764[_0x905d('0x89')]),'fax':_[_0x905d('0x63')](_0x3a7613[_0x905d('0x5b')])?undefined:_0x3a7613['fax'],'AttachmentId':_0x3a7613[_0x905d('0x85')]},client9002);})['then'](respondWithResult(_0x5b99de,0xc9))[_0x905d('0x29')](handleError(_0x5b99de,null));};exports[_0x905d('0x8a')]=function(_0x5e04b7,_0x207045){var _0x31e526=path[_0x905d('0x8b')](config['root'],_0x905d('0x8c'),_0x905d('0x8d'),'attachments');return db[_0x905d('0x3d')][_0x905d('0x55')]({'where':{'id':_0x5e04b7[_0x905d('0x58')]['id']},'include':[{'model':db[_0x905d('0x84')],'as':_0x905d('0x84')}]})['then'](handleEntityNotFound(_0x207045,null))[_0x905d('0x20')](function(_0x3c5b15){if(_0x3c5b15){return _0x207045[_0x905d('0x8a')](path[_0x905d('0x8b')](_0x31e526,_0x3c5b15[_0x905d('0x84')][_0x905d('0x89')]));}})[_0x905d('0x29')](handleError(_0x207045,null));}; \ No newline at end of file +var _0x6310=['ContactId','Attachment','AttachmentId','download','root','server','attachments','basename','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./faxMessage.socket','register','client','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','name','send','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','filter','where','map','type','VIRTUAL','merge','options','FaxMessage','includeAll','findAll','show','params','keys','include','find','body','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','internal','SIP/%s','rejectmessage','create','CmContact','findOne'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x6310,0x8e));var _0x0631=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x6310[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0x0631('0x0'));var rimraf=require(_0x0631('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0631('0x2'));var rp=require('request-promise');var moment=require(_0x0631('0x3'));var BPromise=require(_0x0631('0x4'));var Mustache=require(_0x0631('0x5'));var util=require(_0x0631('0x6'));var path=require(_0x0631('0x7'));var sox=require(_0x0631('0x8'));var csv=require(_0x0631('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0631('0xa'));var _=require('lodash');var squel=require(_0x0631('0xb'));var crypto=require(_0x0631('0xc'));var jsforce=require(_0x0631('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0631('0x9'));var querystring=require(_0x0631('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0631('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0631('0x10'));var logger=require(_0x0631('0x11'))(_0x0631('0x12'));var utils=require(_0x0631('0x13'));var config=require(_0x0631('0x14'));var licenseUtil=require(_0x0631('0x15'));var db=require(_0x0631('0x16'))['db'];config['redis']=_[_0x0631('0x17')](config['redis'],{'host':_0x0631('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0631('0x19')]));require(_0x0631('0x1a'))[_0x0631('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0631('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x0631('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10041d,_0x41ec7c,_0x3581f6,_0x7f7e0f){return new BPromise(function(_0x31312b,_0x2bf4d7){var _0x3689b9=_0x7f7e0f||client;return _0x3689b9['request'](_0x10041d,_0x3581f6)[_0x0631('0x1d')](function(_0x2d0f0a){logger[_0x0631('0x1e')](_0x0631('0x1f'),_0x41ec7c,_0x0631('0x20'));logger[_0x0631('0x21')](_0x0631('0x22'),_0x41ec7c,'request\x20sent',JSON[_0x0631('0x23')](_0x2d0f0a));if(_0x2d0f0a['error']){if(_0x2d0f0a[_0x0631('0x24')]['code']===0x1f4){logger['error'](_0x0631('0x1f'),_0x41ec7c,_0x2d0f0a[_0x0631('0x24')][_0x0631('0x25')]);return _0x2bf4d7(_0x2d0f0a[_0x0631('0x24')][_0x0631('0x25')]);}logger[_0x0631('0x24')](_0x0631('0x1f'),_0x41ec7c,_0x2d0f0a['error'][_0x0631('0x25')]);return _0x31312b(_0x2d0f0a[_0x0631('0x24')][_0x0631('0x25')]);}else{logger['info'](_0x0631('0x1f'),_0x41ec7c,_0x0631('0x20'));_0x31312b(_0x2d0f0a[_0x0631('0x26')][_0x0631('0x25')]);}})[_0x0631('0x27')](function(_0x5465c8){logger['error'](_0x0631('0x1f'),_0x41ec7c,_0x5465c8);_0x2bf4d7(_0x5465c8);});});}function respondWithStatusCode(_0x37d1a9,_0x42fc7e){_0x42fc7e=_0x42fc7e||0xcc;return function(_0x33501b){if(_0x33501b){return _0x37d1a9[_0x0631('0x28')](_0x42fc7e);}return _0x37d1a9[_0x0631('0x29')](_0x42fc7e)[_0x0631('0x2a')]();};}function respondWithResult(_0x49d59d,_0x130516){_0x130516=_0x130516||0xc8;return function(_0x904bae){if(_0x904bae){return _0x49d59d[_0x0631('0x29')](_0x130516)[_0x0631('0x2b')](_0x904bae);}};}function respondWithFilteredResult(_0x15c074,_0x38caa4){return function(_0x2afdef){if(_0x2afdef){var _0x5a57db=typeof _0x38caa4['offset']===_0x0631('0x2c')&&typeof _0x38caa4[_0x0631('0x2d')]===_0x0631('0x2c');var _0x70520=_0x2afdef[_0x0631('0x2e')];var _0x5c6f06=_0x5a57db?0x0:_0x38caa4['offset'];var _0x58caaa=_0x5a57db?_0x2afdef[_0x0631('0x2e')]:_0x38caa4[_0x0631('0x2f')]+_0x38caa4[_0x0631('0x2d')];var _0x1bf06d;if(_0x58caaa>=_0x70520){_0x58caaa=_0x70520;_0x1bf06d=0xc8;}else{_0x1bf06d=0xce;}_0x15c074[_0x0631('0x29')](_0x1bf06d);return _0x15c074[_0x0631('0x30')](_0x0631('0x31'),_0x5c6f06+'-'+_0x58caaa+'/'+_0x70520)[_0x0631('0x2b')](_0x2afdef);}return null;};}function patchUpdates(_0x440425){return function(_0x483564){try{jsonpatch['apply'](_0x483564,_0x440425,!![]);}catch(_0x397366){return BPromise[_0x0631('0x32')](_0x397366);}return _0x483564['save']();};}function saveUpdates(_0x8a4998,_0x31ba5b){return function(_0x234c6c){if(_0x234c6c){return _0x234c6c[_0x0631('0x33')](_0x8a4998)['then'](function(_0x2d3d2c){return _0x2d3d2c;});}return null;};}function removeEntity(_0x5a8695,_0x35698c){return function(_0x5db631){if(_0x5db631){return _0x5db631['destroy']()[_0x0631('0x1d')](function(){_0x5a8695['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f1b0,_0x2b7643){return function(_0x3cfbdb){if(!_0x3cfbdb){_0x51f1b0[_0x0631('0x28')](0x194);}return _0x3cfbdb;};}function handleError(_0x4c40ff,_0x2016c2){_0x2016c2=_0x2016c2||0x1f4;return function(_0x40d6c7){logger[_0x0631('0x24')](_0x40d6c7['stack']);if(_0x40d6c7[_0x0631('0x34')]){delete _0x40d6c7[_0x0631('0x34')];}_0x4c40ff[_0x0631('0x29')](_0x2016c2)[_0x0631('0x35')](_0x40d6c7);};}exports['index']=function(_0x73dd2e,_0x4d820d){var _0x1e4516={},_0x650e36={},_0x359b98={'count':0x0,'rows':[]};var _0x43d725=_['map'](db['FaxMessage'][_0x0631('0x36')],function(_0x29ae05){return{'name':_0x29ae05[_0x0631('0x37')],'type':_0x29ae05['type'][_0x0631('0x38')]};});_0x650e36[_0x0631('0x39')]=_['map'](_0x43d725,_0x0631('0x34'));_0x650e36[_0x0631('0x3a')]=_['keys'](_0x73dd2e[_0x0631('0x3a')]);_0x650e36[_0x0631('0x3b')]=_['intersection'](_0x650e36[_0x0631('0x39')],_0x650e36[_0x0631('0x3a')]);_0x1e4516['attributes']=_[_0x0631('0x3c')](_0x650e36[_0x0631('0x39')],qs['fields'](_0x73dd2e['query'][_0x0631('0x3d')]));_0x1e4516[_0x0631('0x3e')]=_0x1e4516[_0x0631('0x3e')][_0x0631('0x3f')]?_0x1e4516[_0x0631('0x3e')]:_0x650e36[_0x0631('0x39')];if(!_0x73dd2e[_0x0631('0x3a')]['hasOwnProperty'](_0x0631('0x40'))){_0x1e4516[_0x0631('0x2d')]=qs[_0x0631('0x2d')](_0x73dd2e[_0x0631('0x3a')][_0x0631('0x2d')]);_0x1e4516[_0x0631('0x2f')]=qs[_0x0631('0x2f')](_0x73dd2e['query'][_0x0631('0x2f')]);}_0x1e4516[_0x0631('0x41')]=qs['sort'](_0x73dd2e['query']['sort']);_0x1e4516['where']=qs[_0x0631('0x3b')](_['pick'](_0x73dd2e[_0x0631('0x3a')],_0x650e36[_0x0631('0x3b')]),_0x43d725);if(_0x73dd2e[_0x0631('0x3a')][_0x0631('0x42')]){_0x1e4516['where']=_['merge'](_0x1e4516[_0x0631('0x43')],{'$or':_[_0x0631('0x44')](_0x43d725,function(_0x18f01f){if(_0x18f01f[_0x0631('0x45')]!==_0x0631('0x46')){var _0x4cda8c={};_0x4cda8c[_0x18f01f[_0x0631('0x34')]]={'$like':'%'+_0x73dd2e[_0x0631('0x3a')][_0x0631('0x42')]+'%'};return _0x4cda8c;}})});}_0x1e4516=_[_0x0631('0x47')]({},_0x1e4516,_0x73dd2e[_0x0631('0x48')]);var _0x669a3e={'where':_0x1e4516[_0x0631('0x43')]};return db[_0x0631('0x49')][_0x0631('0x2e')](_0x669a3e)[_0x0631('0x1d')](function(_0x521983){_0x359b98[_0x0631('0x2e')]=_0x521983;if(_0x73dd2e[_0x0631('0x3a')][_0x0631('0x4a')]){_0x1e4516['include']=[{'all':!![]}];}return db[_0x0631('0x49')][_0x0631('0x4b')](_0x1e4516);})['then'](function(_0x1b0bae){_0x359b98['rows']=_0x1b0bae;return _0x359b98;})[_0x0631('0x1d')](respondWithFilteredResult(_0x4d820d,_0x1e4516))['catch'](handleError(_0x4d820d,null));};exports[_0x0631('0x4c')]=function(_0x30dd55,_0x1d1374){var _0x40ad6b={'raw':!![],'where':{'id':_0x30dd55[_0x0631('0x4d')]['id']}},_0x1a737a={};_0x1a737a['model']=_[_0x0631('0x4e')](db[_0x0631('0x49')]['rawAttributes']);_0x1a737a[_0x0631('0x3a')]=_[_0x0631('0x4e')](_0x30dd55['query']);_0x1a737a[_0x0631('0x3b')]=_[_0x0631('0x3c')](_0x1a737a[_0x0631('0x39')],_0x1a737a[_0x0631('0x3a')]);_0x40ad6b['attributes']=_[_0x0631('0x3c')](_0x1a737a[_0x0631('0x39')],qs[_0x0631('0x3d')](_0x30dd55[_0x0631('0x3a')][_0x0631('0x3d')]));_0x40ad6b[_0x0631('0x3e')]=_0x40ad6b[_0x0631('0x3e')]['length']?_0x40ad6b[_0x0631('0x3e')]:_0x1a737a['model'];if(_0x30dd55[_0x0631('0x3a')]['includeAll']){_0x40ad6b[_0x0631('0x4f')]=[{'all':!![]}];}_0x40ad6b=_[_0x0631('0x47')]({},_0x40ad6b,_0x30dd55['options']);return db[_0x0631('0x49')][_0x0631('0x50')](_0x40ad6b)[_0x0631('0x1d')](handleEntityNotFound(_0x1d1374,null))[_0x0631('0x1d')](respondWithResult(_0x1d1374,null))[_0x0631('0x27')](handleError(_0x1d1374,null));};exports[_0x0631('0x33')]=function(_0x3c477d,_0x17f999){if(_0x3c477d[_0x0631('0x51')]['id']){delete _0x3c477d[_0x0631('0x51')]['id'];}return db['FaxMessage'][_0x0631('0x50')]({'where':{'id':_0x3c477d[_0x0631('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17f999,null))['then'](saveUpdates(_0x3c477d[_0x0631('0x51')],null))[_0x0631('0x1d')](respondWithResult(_0x17f999,null))[_0x0631('0x27')](handleError(_0x17f999,null));};exports['destroy']=function(_0x49cc12,_0x245ddc){return db['FaxMessage'][_0x0631('0x50')]({'where':{'id':_0x49cc12['params']['id']}})[_0x0631('0x1d')](handleEntityNotFound(_0x245ddc,null))[_0x0631('0x1d')](removeEntity(_0x245ddc,null))[_0x0631('0x27')](handleError(_0x245ddc,null));};exports[_0x0631('0x52')]=function(_0x120fbc,_0x164809){return db[_0x0631('0x49')][_0x0631('0x52')]()[_0x0631('0x1d')](respondWithResult(_0x164809,null))['catch'](handleError(_0x164809,null));};var interaction_log=require(_0x0631('0x11'))(_0x0631('0x53'));exports['accept']=function(_0xfd4bf9,_0x5e94ec,_0x4b4d1f){var _0x1d9c14={'agent':{},'channel':'fax'};if(_0xfd4bf9['body']['id']){delete _0xfd4bf9[_0x0631('0x51')]['id'];}_0xfd4bf9[_0x0631('0x51')][_0x0631('0x54')]=!![];_0xfd4bf9[_0x0631('0x51')][_0x0631('0x55')]=moment()[_0x0631('0x56')](_0x0631('0x57'));_0xfd4bf9['body']['UserId']=_0xfd4bf9[_0x0631('0x51')]['UserId']||_0xfd4bf9[_0x0631('0x58')]['id'];_0x1d9c14[_0x0631('0x59')]['id']=_0xfd4bf9[_0x0631('0x51')][_0x0631('0x5a')];return db[_0x0631('0x49')][_0x0631('0x50')]({'where':{'id':_0xfd4bf9[_0x0631('0x4d')]['id'],'UserId':null}})[_0x0631('0x1d')](handleEntityNotFound(_0x5e94ec,null))[_0x0631('0x1d')](saveUpdates(_0xfd4bf9[_0x0631('0x51')],null))[_0x0631('0x1d')](function(_0x519c24){if(_0x519c24){_0x1d9c14['message']=_0x519c24[_0x0631('0x5b')]({'plain':!![]});return db['FaxInteraction'][_0x0631('0x50')]({'where':{'id':_0x519c24[_0x0631('0x5c')]}});}return null;})[_0x0631('0x1d')](handleEntityNotFound(_0x5e94ec,null))['then'](function(_0x158a3d){if(_0x158a3d){return _0x158a3d[_0x0631('0x33')]({'UserId':_0xfd4bf9['body']['UserId'],'read1stAt':_[_0x0631('0x5d')](_0x158a3d['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0631('0x1d')](function(_0x42d973){if(_0x42d973){_0x1d9c14[_0x0631('0x5e')]=_0x42d973[_0x0631('0x5b')]({'plain':!![]});interaction_log[_0x0631('0x1e')](_0x0631('0x5f'),_0xfd4bf9['user']['id'],_0xfd4bf9[_0x0631('0x58')][_0x0631('0x34')],_0xfd4bf9[_0x0631('0x58')]['role'],_0x1d9c14[_0x0631('0x5e')]['id'],_0xfd4bf9[_0x0631('0x51')]?JSON[_0x0631('0x23')](_0xfd4bf9[_0x0631('0x51')]):_0x0631('0x60'));return respondWithRpcPromise(_0x0631('0x61'),_0x0631('0x62'),_0x1d9c14);}return null;})[_0x0631('0x1d')](function(_0x7a330e){var _0x16c40a=_0x0631('0x63')+_0x7a330e[_0x0631('0x25')]['ContactId'];return db[_0x0631('0x64')][_0x0631('0x3a')](_0x16c40a,{'type':db[_0x0631('0x65')]['QueryTypes'][_0x0631('0x66')],'raw':!![]})[_0x0631('0x1d')](function(_0x4dc13a){return _0x4dc13a;});})[_0x0631('0x1d')](function(_0x37d845){if(_0x37d845){_0x1d9c14['message'][_0x0631('0x67')]=_0x37d845[0x0];if(!_0xfd4bf9['body']['UserId'])return;return db['User'][_0x0631('0x50')]({'where':{'id':_0xfd4bf9['body'][_0x0631('0x5a')],'role':_0x0631('0x59')},'attributes':['id','name',_0x0631('0x68'),_0x0631('0x69'),'internal'],'raw':!![]});}return null;})['then'](function(_0xba9468){if(!_0xba9468)return null;_0x1d9c14[_0x0631('0x25')][_0x0631('0x59')]=_0xba9468;return _0x1d9c14;})[_0x0631('0x1d')](function(_0x44b344){if(_0x44b344){if(_0xfd4bf9[_0x0631('0x51')][_0x0631('0x6a')]){_0x1d9c14[_0x0631('0x25')][_0x0631('0x6b')]=util[_0x0631('0x56')]('SIP/%s',_0xfd4bf9[_0x0631('0x58')][_0x0631('0x34')]);_0x1d9c14[_0x0631('0x25')]['channel']=_0x1d9c14[_0x0631('0x6c')];_0x1d9c14[_0x0631('0x25')][_0x0631('0x6d')]=_0x1d9c14[_0x0631('0x6c')];_0x1d9c14[_0x0631('0x25')][_0x0631('0x6e')]='accept';return respondWithRpcPromise(_0x0631('0x6f'),'EventManager',{'event':_0x0631('0x70'),'message':_0x1d9c14['message']},client9002)['then'](function(){return _0x1d9c14;});}return _0x1d9c14;}return null;})[_0x0631('0x1d')](respondWithResult(_0x5e94ec,null))[_0x0631('0x27')](handleError(_0x5e94ec,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x0631('0x32')]=function(_0x4498ac,_0x24cfb4,_0x51d14d){var _0x2e79b4={'agent':{},'channel':_0x0631('0x71')};if(_0x4498ac[_0x0631('0x51')]['id']){delete _0x4498ac['body']['id'];}_0x4498ac['body']['UserId']=_0x4498ac[_0x0631('0x51')][_0x0631('0x5a')]||_0x4498ac[_0x0631('0x58')]['id'];_0x2e79b4[_0x0631('0x59')]['id']=_0x4498ac[_0x0631('0x51')]['UserId'];return db['FaxMessage'][_0x0631('0x50')]({'where':{'id':_0x4498ac[_0x0631('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24cfb4,null))[_0x0631('0x1d')](function(_0x565a2f){if(_0x565a2f){_0x2e79b4[_0x0631('0x25')]=_0x565a2f[_0x0631('0x5b')]({'plain':!![]});return db[_0x0631('0x72')][_0x0631('0x50')]({'where':{'id':_0x565a2f['FaxInteractionId']}});}return null;})[_0x0631('0x1d')](handleEntityNotFound(_0x24cfb4,null))[_0x0631('0x1d')](function(_0x4ff7b9){if(_0x4ff7b9){_0x2e79b4['interaction']=_0x4ff7b9[_0x0631('0x5b')]({'plain':!![]});interaction_log[_0x0631('0x1e')](_0x0631('0x73'),_0x4498ac[_0x0631('0x58')]['id'],_0x4498ac[_0x0631('0x58')]['name'],_0x4498ac[_0x0631('0x58')][_0x0631('0x74')],_0x2e79b4['interaction']['id'],_0x4498ac['body']?JSON[_0x0631('0x23')](_0x4498ac[_0x0631('0x51')]):_0x0631('0x60'));return respondWithRpcPromise(_0x0631('0x75'),_0x0631('0x76'),_0x2e79b4);}return null;})[_0x0631('0x1d')](function(_0x48733b){var _0x45e148=_0x0631('0x63')+_0x48733b[_0x0631('0x25')]['ContactId'];return db[_0x0631('0x64')][_0x0631('0x3a')](_0x45e148,{'type':db[_0x0631('0x65')][_0x0631('0x77')]['SELECT'],'raw':!![]})['then'](function(_0x353cd1){return _0x353cd1;});})[_0x0631('0x1d')](function(_0x4ce7bc){if(_0x4ce7bc){_0x2e79b4['message'][_0x0631('0x67')]=_0x4ce7bc[0x0];if(!_0x4498ac[_0x0631('0x51')][_0x0631('0x5a')])return;return db['User'][_0x0631('0x50')]({'where':{'id':_0x4498ac[_0x0631('0x51')]['UserId'],'role':'agent'},'attributes':['id',_0x0631('0x34'),_0x0631('0x68'),'email',_0x0631('0x78')],'raw':!![]});}return null;})[_0x0631('0x1d')](function(_0x31b196){if(!_0x31b196)return null;_0x2e79b4[_0x0631('0x25')][_0x0631('0x59')]=_0x31b196;return _0x2e79b4;})[_0x0631('0x1d')](function(_0x34d6f9){if(_0x34d6f9){_0x34d6f9['message'][_0x0631('0x6b')]=util[_0x0631('0x56')](_0x0631('0x79'),_0x4498ac[_0x0631('0x58')][_0x0631('0x34')]);_0x34d6f9['message'][_0x0631('0x6c')]=_0x2e79b4[_0x0631('0x6c')];_0x34d6f9['message'][_0x0631('0x6d')]=_0x2e79b4['channel'];_0x34d6f9[_0x0631('0x25')][_0x0631('0x6e')]=_0x0631('0x32');respondWithRpcPromise(_0x0631('0x6f'),_0x0631('0x6f'),{'event':_0x0631('0x7a'),'message':_0x34d6f9[_0x0631('0x25')]},client9002);return _0x2e79b4;}return null;})[_0x0631('0x1d')](respondWithResult(_0x24cfb4,null))['catch'](handleError(_0x24cfb4,null));};exports[_0x0631('0x7b')]=function(_0x1386ad,_0x493b0f){var _0x343ae3;return db[_0x0631('0x49')][_0x0631('0x7b')](_0x1386ad['body'],{})[_0x0631('0x1d')](function(_0x1dbe6c){_0x343ae3=_0x1dbe6c;return db[_0x0631('0x7c')][_0x0631('0x7d')]({'where':{'id':_0x343ae3[_0x0631('0x7e')]}});})['then'](function(_0x14c9ae){if(_[_0x0631('0x5d')](_0x14c9ae)){return;}else{_0x343ae3[_0x0631('0x71')]=_0x14c9ae[_0x0631('0x71')];return db[_0x0631('0x7f')]['findOne']({'where':{'id':_0x343ae3[_0x0631('0x80')]}});}})[_0x0631('0x1d')](function(_0x45498a){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x0631('0x5d')](_0x1386ad[_0x0631('0x51')])?undefined:_0x1386ad[_0x0631('0x51')]['FaxAccountId'],'path':_['isNil'](_0x45498a)?undefined:util[_0x0631('0x56')]('/var/opt/motion2/server/files/attachments/%s',_0x45498a['basename']),'fax':_[_0x0631('0x5d')](_0x343ae3[_0x0631('0x71')])?undefined:_0x343ae3[_0x0631('0x71')],'AttachmentId':_0x343ae3['AttachmentId']},client9002);})[_0x0631('0x1d')](respondWithResult(_0x493b0f,0xc9))[_0x0631('0x27')](handleError(_0x493b0f,null));};exports[_0x0631('0x81')]=function(_0x859142,_0x17d11e){var _0x1de11b=path['join'](config[_0x0631('0x82')],_0x0631('0x83'),'files',_0x0631('0x84'));return db[_0x0631('0x49')]['find']({'where':{'id':_0x859142[_0x0631('0x4d')]['id']},'include':[{'model':db['Attachment'],'as':_0x0631('0x7f')}]})[_0x0631('0x1d')](handleEntityNotFound(_0x17d11e,null))[_0x0631('0x1d')](function(_0x5840d7){if(_0x5840d7){return _0x17d11e[_0x0631('0x81')](path['join'](_0x1de11b,_0x5840d7[_0x0631('0x7f')][_0x0631('0x85')]));}})['catch'](handleError(_0x17d11e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c872b40..80bea9e 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 _0xa786=['exports','events','../../mysqldb','FaxMessage','save','emit','hasOwnProperty'];(function(_0x532cfa,_0x331fae){var _0x2a5339=function(_0x49af0f){while(--_0x49af0f){_0x532cfa['push'](_0x532cfa['shift']());}};_0x2a5339(++_0x331fae);}(_0xa786,0x71));var _0x6a78=function(_0x24b0c8,_0x5f4b2b){_0x24b0c8=_0x24b0c8-0x0;var _0x4f1bb8=_0xa786[_0x24b0c8];return _0x4f1bb8;};'use strict';var EventEmitter=require(_0x6a78('0x0'));var FaxMessage=require(_0x6a78('0x1'))['db'][_0x6a78('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a78('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47d5d5){return function(_0x2b0fed,_0x3b3608,_0x19285c){FaxMessageEvents[_0x6a78('0x4')](_0x47d5d5+':'+_0x2b0fed['id'],_0x2b0fed);FaxMessageEvents[_0x6a78('0x4')](_0x47d5d5,_0x2b0fed);_0x19285c(null);};}for(var e in events){if(events[_0x6a78('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x6a78('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0xd08d=['hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','save','update','remove','emit'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xd08d,0x81));var _0xdd08=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xd08d[_0x1bd323];return _0x13097b;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xdd08('0x0'))['db'][_0xdd08('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdd08('0x2'),'afterUpdate':_0xdd08('0x3'),'afterDestroy':_0xdd08('0x4')};function emitEvent(_0x521652){return function(_0x12efba,_0x5c7eda,_0x3c2175){FaxMessageEvents['emit'](_0x521652+':'+_0x12efba['id'],_0x12efba);FaxMessageEvents[_0xdd08('0x5')](_0x521652,_0x12efba);_0x3c2175(null);};}for(var e in events){if(events[_0xdd08('0x6')](e)){var event=events[e];FaxMessage[_0xdd08('0x7')](e,emitEvent(event));}}module[_0xdd08('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 1bf4447..d340c1a 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 _0xf40a=['get','direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','body','FULLTEXT','models'];(function(_0xdb8376,_0x43d2d4){var _0x5bfe43=function(_0x37c08f){while(--_0x37c08f){_0xdb8376['push'](_0xdb8376['shift']());}};_0x5bfe43(++_0x43d2d4);}(_0xf40a,0x11b));var _0xaf40=function(_0x12a024,_0x5e97e3){_0x12a024=_0x12a024-0x0;var _0x36efad=_0xf40a[_0x12a024];return _0x36efad;};'use strict';var _=require(_0xaf40('0x0'));var util=require(_0xaf40('0x1'));var logger=require(_0xaf40('0x2'))(_0xaf40('0x3'));var moment=require(_0xaf40('0x4'));var BPromise=require(_0xaf40('0x5'));var rp=require(_0xaf40('0x6'));var fs=require('fs');var path=require(_0xaf40('0x7'));var rimraf=require(_0xaf40('0x8'));var config=require(_0xaf40('0x9'));var attributes=require(_0xaf40('0xa'));module[_0xaf40('0xb')]=function(_0x27cec7,_0x314c83){return _0x27cec7['define'](_0xaf40('0xc'),attributes,{'tableName':_0xaf40('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xaf40('0xe')],'type':_0xaf40('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x93cde1,_0x4c338c,_0x53f214){var _0x2dd409=_0x27cec7[_0xaf40('0x10')];var _0xdf1799=_0x93cde1[_0xaf40('0x11')]({'plain':!![]});if(_0xdf1799[_0xaf40('0x12')][_0xaf40('0x13')]()==='in'||_0xdf1799[_0xaf40('0x12')][_0xaf40('0x13')]()===_0xaf40('0x14')&&!_0xdf1799['secret']&&!_[_0xaf40('0x15')](_0xdf1799[_0xaf40('0x16')])){_0x2dd409['FaxInteraction'][_0xaf40('0x17')]({'where':{'id':_0xdf1799[_0xaf40('0x18')]}})['then'](function(_0x1d2d3d){if(_0x1d2d3d){_0x1d2d3d[_0xaf40('0x19')]({'lastMsgAt':_0xdf1799[_0xaf40('0x1a')],'lastMsgDirection':_0xdf1799[_0xaf40('0x12')][_0xaf40('0x13')]()});}})[_0xaf40('0x1b')](function(_0x5d2872){console[_0xaf40('0x1c')](_0x5d2872);});}_0x53f214();}},'charset':'utf8mb4','collate':_0xaf40('0x1d')});}; \ No newline at end of file +var _0xd98a=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','then','update','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4966d6,_0x2b7f02){var _0x11fa89=function(_0x3d3e6b){while(--_0x3d3e6b){_0x4966d6['push'](_0x4966d6['shift']());}};_0x11fa89(++_0x2b7f02);}(_0xd98a,0x12b));var _0xad98=function(_0x15d650,_0x34f327){_0x15d650=_0x15d650-0x0;var _0x451fe8=_0xd98a[_0x15d650];return _0x451fe8;};'use strict';var _=require(_0xad98('0x0'));var util=require(_0xad98('0x1'));var logger=require(_0xad98('0x2'))('api');var moment=require(_0xad98('0x3'));var BPromise=require(_0xad98('0x4'));var rp=require(_0xad98('0x5'));var fs=require('fs');var path=require(_0xad98('0x6'));var rimraf=require(_0xad98('0x7'));var config=require(_0xad98('0x8'));var attributes=require(_0xad98('0x9'));module[_0xad98('0xa')]=function(_0x4192ee,_0x507059){return _0x4192ee['define'](_0xad98('0xb'),attributes,{'tableName':_0xad98('0xc'),'paranoid':![],'indexes':[{'name':_0xad98('0xd'),'fields':[_0xad98('0xe')],'type':_0xad98('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ace6c,_0x350e6c,_0x49689b){var _0x434ab5=_0x4192ee[_0xad98('0x10')];var _0x45c571=_0x5ace6c[_0xad98('0x11')]({'plain':!![]});if(_0x45c571[_0xad98('0x12')]['toLowerCase']()==='in'||_0x45c571[_0xad98('0x12')][_0xad98('0x13')]()===_0xad98('0x14')&&!_0x45c571[_0xad98('0x15')]&&!_[_0xad98('0x16')](_0x45c571[_0xad98('0x17')])){_0x434ab5[_0xad98('0x18')][_0xad98('0x19')]({'where':{'id':_0x45c571['FaxInteractionId']}})[_0xad98('0x1a')](function(_0x56a61f){if(_0x56a61f){_0x56a61f[_0xad98('0x1b')]({'lastMsgAt':_0x45c571['createdAt'],'lastMsgDirection':_0x45c571['direction'][_0xad98('0x13')]()});}})['catch'](function(_0x2d6875){console['error'](_0x2d6875);});}_0x49689b();}},'charset':_0xad98('0x1c'),'collate':_0xad98('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8fee196..c3953ca 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','limit','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxMessage','create'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4338eb,_0x4e16fe){_0x4338eb=_0x4338eb-0x0;var _0xef6651=_0x9bde[_0x4338eb];return _0xef6651;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});config[_0xe9bd('0xa')]=_[_0xe9bd('0xb')](config[_0xe9bd('0xa')],{'host':_0xe9bd('0xc'),'port':0x18eb});var socket=require(_0xe9bd('0xd'))(new Redis(config[_0xe9bd('0xa')]));require(_0xe9bd('0xe'))[_0xe9bd('0xf')](socket);function respondWithRpcPromise(_0x45c7ba,_0x581602,_0x5f36c8){return new BPromise(function(_0x3c8e95,_0x145521){return client[_0xe9bd('0x10')](_0x45c7ba,_0x5f36c8)['then'](function(_0x12c96e){logger[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));logger['debug'](_0xe9bd('0x14'),_0x581602,'request\x20sent',JSON[_0xe9bd('0x15')](_0x12c96e));if(_0x12c96e[_0xe9bd('0x16')]){if(_0x12c96e[_0xe9bd('0x16')]['code']===0x1f4){logger['error'](_0xe9bd('0x12'),_0x581602,_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);return _0x145521(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}logger[_0xe9bd('0x16')](_0xe9bd('0x12'),_0x581602,_0x12c96e['error'][_0xe9bd('0x17')]);return _0x3c8e95(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}else{logger['info'](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));_0x3c8e95(_0x12c96e[_0xe9bd('0x18')][_0xe9bd('0x17')]);}})['catch'](function(_0x20ec32){logger['error'](_0xe9bd('0x12'),_0x581602,_0x20ec32);_0x145521(_0x20ec32);});});}exports['CreateFaxMessage']=function(_0x26aa4a){var _0x417113=this;return new Promise(function(_0x134c4e,_0x3dda13){return db[_0xe9bd('0x19')][_0xe9bd('0x1a')](_0x26aa4a[_0xe9bd('0x1b')],{'raw':_0x26aa4a['options']?_0x26aa4a[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x37aec1){logger['info'](_0xe9bd('0x1e'),_0x26aa4a);logger[_0xe9bd('0x1f')](_0xe9bd('0x1e'),_0x26aa4a,JSON[_0xe9bd('0x15')](_0x37aec1));_0x134c4e(_0x37aec1);})['catch'](function(_0x24cf25){logger[_0xe9bd('0x16')](_0xe9bd('0x1e'),_0x24cf25[_0xe9bd('0x17')],_0x26aa4a);_0x3dda13(_0x417113[_0xe9bd('0x16')](0x1f4,_0x24cf25[_0xe9bd('0x17')]));});});};exports[_0xe9bd('0x20')]=function(_0x43ea90){var _0x1ae889=this;return new Promise(function(_0x5987af,_0x3c211a){return db[_0xe9bd('0x19')]['update'](_0x43ea90[_0xe9bd('0x1b')],{'raw':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')]['where']||null:null,'attributes':_0x43ea90['options']?_0x43ea90[_0xe9bd('0x1c')]['attributes']||null:null,'limit':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x21')]||null:null})[_0xe9bd('0x22')](function(_0x4057df){logger['info']('UpdateFaxMessage',_0x43ea90);logger[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x43ea90,JSON[_0xe9bd('0x15')](_0x4057df));_0x5987af(_0x4057df);})[_0xe9bd('0x23')](function(_0xe2436){logger[_0xe9bd('0x16')](_0xe9bd('0x20'),_0xe2436[_0xe9bd('0x17')],_0x43ea90);_0x3c211a(_0x1ae889[_0xe9bd('0x16')](0x1f4,_0xe2436['message']));});});}; \ No newline at end of file +var _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x47209e,_0x3bee11){var _0x5522b1=function(_0x1afd3d){while(--_0x1afd3d){_0x47209e['push'](_0x47209e['shift']());}};_0x5522b1(++_0x3bee11);}(_0xbec5,0xe5));var _0x5bec=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xbec5[_0x45c48f];return _0xaf5037;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 048eb6b..b7e0948 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 _0x9b17=['save','remove','update','register','length','faxMessage:','./faxMessage.events'];(function(_0x14055a,_0x2b2358){var _0x1b9137=function(_0x5bdc96){while(--_0x5bdc96){_0x14055a['push'](_0x14055a['shift']());}};_0x1b9137(++_0x2b2358);}(_0x9b17,0x1cd));var _0x79b1=function(_0x1eebd1,_0x5960dd){_0x1eebd1=_0x1eebd1-0x0;var _0x3f49e9=_0x9b17[_0x1eebd1];return _0x3f49e9;};'use strict';var FaxMessageEvents=require(_0x79b1('0x0'));var events=[_0x79b1('0x1'),_0x79b1('0x2'),_0x79b1('0x3')];function createListener(_0x32334a,_0x16fb30){return function(_0x3ae31b){_0x16fb30['emit'](_0x32334a,_0x3ae31b);};}function removeListener(_0x3f9f2e,_0x501229){return function(){FaxMessageEvents['removeListener'](_0x3f9f2e,_0x501229);};}exports[_0x79b1('0x4')]=function(_0x31ccfa){for(var _0x413b6a=0x0,_0x5373ff=events[_0x79b1('0x5')];_0x413b6a<_0x5373ff;_0x413b6a++){var _0x207dd3=events[_0x413b6a];var _0x12a3b9=createListener(_0x79b1('0x6')+_0x207dd3,_0x31ccfa);FaxMessageEvents['on'](_0x207dd3,_0x12a3b9);}}; \ No newline at end of file +var _0xc544=['removeListener','register','faxMessage:','./faxMessage.events','save','emit'];(function(_0xd5632,_0x349145){var _0x9cf683=function(_0x12e82f){while(--_0x12e82f){_0xd5632['push'](_0xd5632['shift']());}};_0x9cf683(++_0x349145);}(_0xc544,0x135));var _0x4c54=function(_0x169b0e,_0x33cc00){_0x169b0e=_0x169b0e-0x0;var _0xd1e3a=_0xc544[_0x169b0e];return _0xd1e3a;};'use strict';var FaxMessageEvents=require(_0x4c54('0x0'));var events=[_0x4c54('0x1'),'remove','update'];function createListener(_0x355136,_0x577779){return function(_0x2ba81e){_0x577779[_0x4c54('0x2')](_0x355136,_0x2ba81e);};}function removeListener(_0xc74c98,_0x4ae04a){return function(){FaxMessageEvents[_0x4c54('0x3')](_0xc74c98,_0x4ae04a);};}exports[_0x4c54('0x4')]=function(_0x27b77f){for(var _0x717a3e=0x0,_0x891012=events['length'];_0x717a3e<_0x891012;_0x717a3e++){var _0x23a5e8=events[_0x717a3e];var _0x154111=createListener(_0x4c54('0x5')+_0x23a5e8,_0x27b77f);FaxMessageEvents['on'](_0x23a5e8,_0x154111);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 122d172..7145897 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 _0xe5b5=['fax','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x10cdaa,_0x208cd0){var _0x433c45=function(_0x5be7b7){while(--_0x5be7b7){_0x10cdaa['push'](_0x10cdaa['shift']());}};_0x433c45(++_0x208cd0);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0xe5b5[_0x2f32c4];return _0x95b5dc;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/download',auth[_0x5e5b('0xc')](),controller['download']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x13')](_0x5e5b('0x14'),'faxmessage:create'),controller['create']);router['put'](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x18')]);router['put'](_0x5e5b('0x19'),auth[_0x5e5b('0xc')](),controller['reject']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x5e5b('0x1b')]);module[_0x5e5b('0x1c')]=router; \ No newline at end of file +var _0x579c=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3e3f2e,_0x3398f9){var _0x10738b=function(_0x3c0437){while(--_0x3c0437){_0x3e3f2e['push'](_0x3e3f2e['shift']());}};_0x10738b(++_0x3398f9);}(_0x579c,0xda));var _0xc579=function(_0x46acb5,_0x14c147){_0x46acb5=_0x46acb5-0x0;var _0x3d9d02=_0x579c[_0x46acb5];return _0x3d9d02;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/describe',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0x9')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0x9')](_0xc579('0xf'),auth['isAuthenticated'](),controller[_0xc579('0x10')]);router[_0xc579('0x11')]('/',auth[_0xc579('0xa')](),interaction[_0xc579('0x12')](_0xc579('0x13'),_0xc579('0x14')),controller[_0xc579('0x15')]);router[_0xc579('0x16')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0x17')]);router['put'](_0xc579('0x18'),auth['isAuthenticated'](),controller[_0xc579('0x19')]);router['put'](_0xc579('0x1a'),auth['isAuthenticated'](),controller[_0xc579('0x1b')]);router['delete'](_0xc579('0xd'),auth[_0xc579('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6f31ff6..a9ef8e4 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 _0x070f=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4165cc,_0x1b4780){var _0x5e3a4c=function(_0x38b884){while(--_0x38b884){_0x4165cc['push'](_0x4165cc['shift']());}};_0x5e3a4c(++_0x1b4780);}(_0x070f,0x13a));var _0xf070=function(_0x171ed3,_0xf88e13){_0x171ed3=_0x171ed3-0x0;var _0x521a20=_0x070f[_0x171ed3];return _0x521a20;};'use strict';var Sequelize=require(_0xf070('0x0'));module['exports']={'name':{'type':Sequelize[_0xf070('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf070('0x1')]},'timeout':{'type':Sequelize[_0xf070('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf070('0x3')](_0xf070('0x4'),_0xf070('0x5'),_0xf070('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa8ce=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x1d285e,_0x5df58a){var _0x20ee4d=function(_0x1d592a){while(--_0x1d592a){_0x1d285e['push'](_0x1d285e['shift']());}};_0x20ee4d(++_0x5df58a);}(_0xa8ce,0x1d8));var _0xea8c=function(_0x56c3db,_0x291d21){_0x56c3db=_0x56c3db-0x0;var _0x56d2b7=_0xa8ce[_0x56c3db];return _0x56d2b7;};'use strict';var Sequelize=require('sequelize');module[_0xea8c('0x0')]={'name':{'type':Sequelize[_0xea8c('0x1')],'unique':_0xea8c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea8c('0x1')]},'timeout':{'type':Sequelize[_0xea8c('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea8c('0x4')](_0xea8c('0x5'),_0xea8c('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xea8c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 673de98..a2a33c3 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 _0x7880=['addTeams','findOrCreate','forEach','emit','userFaxQueue:save','select','field','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','ids','omit','spread','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','index','map','FaxQueue','rawAttributes','type','where','include','findAll','show','params','model','keys','query','filters','intersection','fields','attributes','length','merge','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','User','UserId','agent','faxPause','updatedAt','rows','format','%s/%s','SIP','createdAt','Team','Agents','online','voicePause','interface','flatMap'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x7880,0x10f));var _0x0788=function(_0xb4ec3a,_0x2bace0){_0xb4ec3a=_0xb4ec3a-0x0;var _0x1b83db=_0x7880[_0xb4ec3a];return _0x1b83db;};'use strict';var BPromise=require(_0x0788('0x0'));var util=require('util');var _=require(_0x0788('0x1'));var squel=require(_0x0788('0x2'));var Redis=require(_0x0788('0x3'));var qs=require(_0x0788('0x4'));var logger=require(_0x0788('0x5'))('api');var config=require('../../config/environment');var db=require(_0x0788('0x6'))['db'];config['redis']=_[_0x0788('0x7')](config[_0x0788('0x8')],{'host':_0x0788('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0x8')]));require(_0x0788('0xa'))['register'](socket);function respondWithStatusCode(_0x1662a2,_0x466e68){_0x466e68=_0x466e68||0xcc;return function(_0x19918e){if(_0x19918e){return _0x1662a2[_0x0788('0xb')](_0x466e68);}return _0x1662a2[_0x0788('0xc')](_0x466e68)[_0x0788('0xd')]();};}function respondWithResult(_0x13b8f5,_0x40f11d){_0x40f11d=_0x40f11d||0xc8;return function(_0x172cb6){if(_0x172cb6){return _0x13b8f5[_0x0788('0xc')](_0x40f11d)[_0x0788('0xe')](_0x172cb6);}};}function respondWithFilteredResult(_0x51f861,_0x201a6e){return function(_0x47c4fc){if(_0x47c4fc){var _0x423e99=typeof _0x201a6e[_0x0788('0xf')]===_0x0788('0x10')&&typeof _0x201a6e[_0x0788('0x11')]===_0x0788('0x10');var _0x4ee22c=_0x47c4fc[_0x0788('0x12')];var _0x4b379e=_0x423e99?0x0:_0x201a6e[_0x0788('0xf')];var _0x59b405=_0x423e99?_0x47c4fc['count']:_0x201a6e[_0x0788('0xf')]+_0x201a6e[_0x0788('0x11')];var _0x32eae1;if(_0x59b405>=_0x4ee22c){_0x59b405=_0x4ee22c;_0x32eae1=0xc8;}else{_0x32eae1=0xce;}_0x51f861['status'](_0x32eae1);return _0x51f861[_0x0788('0x13')](_0x0788('0x14'),_0x4b379e+'-'+_0x59b405+'/'+_0x4ee22c)['json'](_0x47c4fc);}return null;};}function saveUpdates(_0x334f58){return function(_0x286731){if(_0x286731){return _0x286731[_0x0788('0x15')](_0x334f58)['then'](function(_0x5e9ea6){return _0x5e9ea6;});}return null;};}function removeEntity(_0x1700b5){return function(_0xf82fbc){if(_0xf82fbc){return _0xf82fbc['destroy']()[_0x0788('0x16')](function(){var _0x3e0ad7=_0xf82fbc[_0x0788('0x17')]({'plain':!![]});var _0xd5e0a6=_0x0788('0x18');return db[_0x0788('0x19')][_0x0788('0x1a')]({'where':{'type':_0xd5e0a6,'resourceId':_0x3e0ad7['id']}})[_0x0788('0x16')](function(){return _0xf82fbc;});})['then'](function(){_0x1700b5[_0x0788('0xc')](0xcc)[_0x0788('0xd')]();});}};}function handleEntityNotFound(_0x12aa6a){return function(_0x3f1de2){if(!_0x3f1de2){_0x12aa6a[_0x0788('0xb')](0x194);}return _0x3f1de2;};}function handleError(_0x467856,_0x291844){_0x291844=_0x291844||0x1f4;return function(_0x4c4de1){logger[_0x0788('0x1b')](_0x4c4de1[_0x0788('0x1c')]);if(_0x4c4de1[_0x0788('0x1d')]){delete _0x4c4de1[_0x0788('0x1d')];}_0x467856['status'](_0x291844)['send'](_0x4c4de1);};}exports[_0x0788('0x1e')]=function(_0x40bbaf,_0x4cfd91){var _0xac4f64={};var _0x107b1b={'count':0x0,'rows':[]};var _0x4b99fa=_[_0x0788('0x1f')](db[_0x0788('0x20')][_0x0788('0x21')],function(_0x20da9f){return{'name':_0x20da9f['fieldName'],'type':_0x20da9f[_0x0788('0x22')]['key']};});_0xac4f64=qs['getOptions'](_0x4b99fa,_0x40bbaf);var _0xcd2266={'where':_0xac4f64[_0x0788('0x23')]};return db[_0x0788('0x20')][_0x0788('0x12')](_0xcd2266)['then'](function(_0x54878c){_0x107b1b['count']=_0x54878c;_0xac4f64[_0x0788('0x24')]=qs[_0x0788('0x24')](_0x40bbaf['query']);return db[_0x0788('0x20')][_0x0788('0x25')](_0xac4f64);})['then'](function(_0x29c442){_0x107b1b['rows']=_0x29c442;return _0x107b1b;})[_0x0788('0x16')](respondWithFilteredResult(_0x4cfd91,_0xac4f64))['catch'](handleError(_0x4cfd91,null));};exports[_0x0788('0x26')]=function(_0x3f2a39,_0x2e7be4){var _0x546943={'raw':!![],'where':{'id':_0x3f2a39[_0x0788('0x27')]['id']}},_0x4e337c={};_0x4e337c[_0x0788('0x28')]=_[_0x0788('0x29')](db['FaxQueue'][_0x0788('0x21')]);_0x4e337c['query']=_[_0x0788('0x29')](_0x3f2a39[_0x0788('0x2a')]);_0x4e337c[_0x0788('0x2b')]=_[_0x0788('0x2c')](_0x4e337c[_0x0788('0x28')],_0x4e337c[_0x0788('0x2a')]);_0x546943['attributes']=_[_0x0788('0x2c')](_0x4e337c[_0x0788('0x28')],qs[_0x0788('0x2d')](_0x3f2a39[_0x0788('0x2a')][_0x0788('0x2d')]));_0x546943[_0x0788('0x2e')]=_0x546943[_0x0788('0x2e')][_0x0788('0x2f')]?_0x546943[_0x0788('0x2e')]:_0x4e337c[_0x0788('0x28')];if(_0x3f2a39[_0x0788('0x2a')]['includeAll']){_0x546943[_0x0788('0x24')]=[{'all':!![]}];}_0x546943=_[_0x0788('0x30')]({},_0x546943,_0x3f2a39[_0x0788('0x31')]);return db[_0x0788('0x20')][_0x0788('0x32')](_0x546943)[_0x0788('0x16')](handleEntityNotFound(_0x2e7be4,null))['then'](respondWithResult(_0x2e7be4,null))[_0x0788('0x33')](handleError(_0x2e7be4,null));};exports['create']=function(_0x377ba1,_0x14ccf8){return db[_0x0788('0x20')]['create'](_0x377ba1[_0x0788('0x34')],{})[_0x0788('0x16')](function(_0x5a5196){var _0x14a056=_0x377ba1[_0x0788('0x35')][_0x0788('0x17')]({'plain':!![]});if(!_0x14a056)throw new Error(_0x0788('0x36'));if(_0x14a056[_0x0788('0x37')]===_0x0788('0x35')){var _0x20a91c=_0x5a5196[_0x0788('0x17')]({'plain':!![]});var _0x5dcc20=_0x0788('0x18');return db[_0x0788('0x38')][_0x0788('0x32')]({'where':{'name':_0x5dcc20,'userProfileId':_0x14a056[_0x0788('0x39')]},'raw':!![]})['then'](function(_0x3fb49e){if(_0x3fb49e&&_0x3fb49e[_0x0788('0x3a')]===0x0){return db[_0x0788('0x19')][_0x0788('0x3b')]({'name':_0x20a91c[_0x0788('0x1d')],'resourceId':_0x20a91c['id'],'type':_0x3fb49e['name'],'sectionId':_0x3fb49e['id']},{})[_0x0788('0x16')](function(){return _0x5a5196;});}else{return _0x5a5196;}})['catch'](function(_0x45f948){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45f948);throw _0x45f948;});}return _0x5a5196;})['then'](respondWithResult(_0x14ccf8,0xc9))[_0x0788('0x33')](handleError(_0x14ccf8,null));};exports[_0x0788('0x15')]=function(_0x3e16a0,_0x463b62){if(_0x3e16a0[_0x0788('0x34')]['id']){delete _0x3e16a0[_0x0788('0x34')]['id'];}return db[_0x0788('0x20')][_0x0788('0x32')]({'where':{'id':_0x3e16a0[_0x0788('0x27')]['id']}})[_0x0788('0x16')](handleEntityNotFound(_0x463b62,null))[_0x0788('0x16')](saveUpdates(_0x3e16a0[_0x0788('0x34')],null))[_0x0788('0x16')](respondWithResult(_0x463b62,null))[_0x0788('0x33')](handleError(_0x463b62,null));};exports[_0x0788('0x1a')]=function(_0x28a2cb,_0x458cce){return db[_0x0788('0x20')][_0x0788('0x32')]({'where':{'id':_0x28a2cb[_0x0788('0x27')]['id']}})[_0x0788('0x16')](handleEntityNotFound(_0x458cce,null))['then'](removeEntity(_0x458cce,null))[_0x0788('0x33')](handleError(_0x458cce,null));};exports[_0x0788('0x3c')]=function(_0xb6077,_0x197d12){return db['FaxQueue']['describe']()[_0x0788('0x16')](respondWithResult(_0x197d12,null))[_0x0788('0x33')](handleError(_0x197d12,null));};exports[_0x0788('0x3d')]=function(_0x473c52,_0x166c16){var _0x39a636={'raw':!![],'where':{}},_0xf6b243={},_0x1c0a3d;return db['FaxQueue'][_0x0788('0x3e')]({'where':{'id':_0x473c52[_0x0788('0x27')]['id']}})[_0x0788('0x16')](handleEntityNotFound(_0x166c16,null))['then'](function(_0x48585c){if(_0x48585c){_0x1c0a3d=_0x48585c[_0x0788('0x17')]({'plain':!![]});_0xf6b243[_0x0788('0x28')]=_[_0x0788('0x29')](db['UserFaxQueue']['rawAttributes']);_0xf6b243[_0x0788('0x2a')]=_[_0x0788('0x29')](_0x473c52[_0x0788('0x2a')]);_0xf6b243[_0x0788('0x2b')]=_[_0x0788('0x2c')](_0xf6b243['model'],_0xf6b243[_0x0788('0x2a')]);_0x39a636['attributes']=_[_0x0788('0x2c')](_0xf6b243[_0x0788('0x28')],qs[_0x0788('0x2d')](_0x473c52['query']['fields']));_0x39a636[_0x0788('0x2e')]=_0x39a636[_0x0788('0x2e')]['length']?_0x39a636[_0x0788('0x2e')]:_0xf6b243['model'];if(!_0x473c52[_0x0788('0x2a')][_0x0788('0x3f')](_0x0788('0x40'))){_0x39a636[_0x0788('0x11')]=qs['limit'](_0x473c52[_0x0788('0x2a')][_0x0788('0x11')]);_0x39a636['offset']=qs[_0x0788('0xf')](_0x473c52[_0x0788('0x2a')]['offset']);}_0x39a636[_0x0788('0x41')]=qs[_0x0788('0x42')](_0x473c52['query']['sort']);_0x39a636['where']=qs['filters'](_[_0x0788('0x43')](_0x473c52[_0x0788('0x2a')],_0xf6b243[_0x0788('0x2b')]));_0x39a636['where'][_0x0788('0x44')]=_0x48585c['id'];if(_0x473c52['query'][_0x0788('0x45')]){_0x39a636[_0x0788('0x23')]=_[_0x0788('0x30')](_0x39a636[_0x0788('0x23')],{'$or':_['map'](_0x39a636['attributes'],function(_0x1aeb6e){var _0x1b3ba3={};_0x1b3ba3[_0x1aeb6e]={'$like':'%'+_0x473c52[_0x0788('0x2a')][_0x0788('0x45')]+'%'};return _0x1b3ba3;})});}_0x39a636=_[_0x0788('0x30')]({},_0x39a636,_0x473c52[_0x0788('0x31')]);return db['UserFaxQueue'][_0x0788('0x25')](_0x39a636);}})['then'](function(_0x591cc2){if(_0x591cc2){return db[_0x0788('0x46')]['findAndCountAll']({'where':{'id':_[_0x0788('0x1f')](_0x591cc2,_0x0788('0x47')),'role':_0x0788('0x48')},'attributes':['id','name',_0x0788('0x49'),_0x0788('0x4a'),'createdAt']});}})[_0x0788('0x16')](function(_0x42b532){if(_0x42b532){return{'count':_0x42b532[_0x0788('0x12')],'rows':_[_0x0788('0x1f')](_0x42b532[_0x0788('0x4b')],function(_0x19393c){return{'membername':_0x19393c[_0x0788('0x1d')],'UserId':_0x19393c['id'],'queue_name':_0x1c0a3d[_0x0788('0x1d')],'FaxQueueId':_0x1c0a3d['id'],'interface':util[_0x0788('0x4c')](_0x0788('0x4d'),_0x0788('0x4e'),_0x19393c[_0x0788('0x1d')]),'penalty':0x0,'paused':_0x19393c[_0x0788('0x49')],'createdAt':_0x19393c[_0x0788('0x4f')],'updatedAt':_0x19393c[_0x0788('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0788('0x16')](respondWithFilteredResult(_0x166c16,_0x39a636))['catch'](handleError(_0x166c16,null));};exports['getTeams']=function(_0x471abc,_0x24501c){var _0x3763e3={};var _0x16a343={};var _0x35ff3a;var _0x27666c;return db[_0x0788('0x20')]['findOne']({'where':{'id':_0x471abc[_0x0788('0x27')]['id']}})[_0x0788('0x16')](handleEntityNotFound(_0x24501c,null))['then'](function(_0x4c544b){if(_0x4c544b){_0x35ff3a=_0x4c544b;_0x16a343[_0x0788('0x28')]=_[_0x0788('0x29')](db[_0x0788('0x50')][_0x0788('0x21')]);_0x16a343[_0x0788('0x2a')]=_[_0x0788('0x29')](_0x471abc[_0x0788('0x2a')]);_0x16a343[_0x0788('0x2b')]=_[_0x0788('0x2c')](_0x16a343[_0x0788('0x28')],_0x16a343[_0x0788('0x2a')]);_0x3763e3[_0x0788('0x2e')]=_[_0x0788('0x2c')](_0x16a343[_0x0788('0x28')],qs[_0x0788('0x2d')](_0x471abc[_0x0788('0x2a')]['fields']));_0x3763e3[_0x0788('0x2e')]=_0x3763e3[_0x0788('0x2e')][_0x0788('0x2f')]?_0x3763e3[_0x0788('0x2e')]:_0x16a343['model'];_0x3763e3[_0x0788('0x41')]=qs['sort'](_0x471abc[_0x0788('0x2a')]['sort']);_0x3763e3[_0x0788('0x23')]=qs[_0x0788('0x2b')](_[_0x0788('0x43')](_0x471abc['query'],_0x16a343[_0x0788('0x2b')]));if(_0x471abc[_0x0788('0x2a')][_0x0788('0x45')]){_0x3763e3[_0x0788('0x23')]=_[_0x0788('0x30')](_0x3763e3[_0x0788('0x23')],{'$or':_[_0x0788('0x1f')](_0x3763e3[_0x0788('0x2e')],function(_0x59ed82){var _0x136baa={};_0x136baa[_0x59ed82]={'$like':'%'+_0x471abc[_0x0788('0x2a')][_0x0788('0x45')]+'%'};return _0x136baa;})});}_0x3763e3=_['merge']({},_0x3763e3,_0x471abc[_0x0788('0x31')]);return _0x35ff3a['getTeams'](_0x3763e3);}})[_0x0788('0x16')](function(_0x3bd600){if(_0x3bd600){_0x27666c=_0x3bd600[_0x0788('0x2f')];if(!_0x471abc[_0x0788('0x2a')][_0x0788('0x3f')](_0x0788('0x40'))){_0x3763e3[_0x0788('0x11')]=qs[_0x0788('0x11')](_0x471abc[_0x0788('0x2a')]['limit']);_0x3763e3[_0x0788('0xf')]=qs[_0x0788('0xf')](_0x471abc[_0x0788('0x2a')]['offset']);}return _0x35ff3a['getTeams'](_0x3763e3);}})[_0x0788('0x16')](function(_0xc0c279){if(_0xc0c279){return _0xc0c279?{'count':_0x27666c,'rows':_0xc0c279}:null;}})[_0x0788('0x16')](respondWithResult(_0x24501c,null))[_0x0788('0x33')](handleError(_0x24501c,null));};exports['addTeams']=function(_0x1298bc,_0x41e2c1){var _0x6bf897=_0x1298bc[_0x0788('0x34')]['ids'];return db[_0x0788('0x50')][_0x0788('0x25')]({'where':{'id':_0x6bf897},'attributes':['id'],'include':[{'model':db[_0x0788('0x46')],'as':_0x0788('0x51'),'attributes':['id','name',_0x0788('0x52'),_0x0788('0x53'),_0x0788('0x54')],'raw':!![]}]})['then'](function(_0x481baa){if(_0x481baa){var _0x414251=_[_0x0788('0x55')](_0x481baa,function(_0x26ce0a){var _0x5d9641=_0x26ce0a[_0x0788('0x17')]({'plain':!![]});return _0x5d9641['Agents'];});return db[_0x0788('0x20')][_0x0788('0x32')]({'where':{'id':_0x1298bc[_0x0788('0x27')]['id']}})[_0x0788('0x16')](function(_0x7130c6){return db['sequelize']['transaction'](function(_0x7b9c){return _0x7130c6[_0x0788('0x56')](_0x6bf897,{'transaction':_0x7b9c})[_0x0788('0x16')](function(){return BPromise['each'](_0x414251,function(_0x52b154){return db['UserFaxQueue'][_0x0788('0x57')]({'where':{'UserId':_0x52b154['id'],'FaxQueueId':_0x1298bc[_0x0788('0x27')]['id']},'transaction':_0x7b9c});});})['then'](function(){_0x414251[_0x0788('0x58')](function(_0x8c5023){socket[_0x0788('0x59')](_0x0788('0x5a'),{'UserId':_0x8c5023['id'],'FaxQueueId':_0x7130c6['id']});});});});});}})[_0x0788('0x16')](respondWithStatusCode(_0x41e2c1,null))[_0x0788('0x33')](handleError(_0x41e2c1,null));};exports['removeTeams']=function(_0x3de870,_0x1eebaa){return db[_0x0788('0x50')]['findAll']({'where':{'id':_0x3de870[_0x0788('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0788('0x46')],'as':_0x0788('0x51'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1eebaa,null))['then'](function(_0x3c194e){var _0x10397e=_['map'](_0x3c194e,'id');var _0x3ff084=[];var _0x47269c=[];var _0x2d3919=squel[_0x0788('0x5b')]();_0x2d3919[_0x0788('0x5c')]('tq.TeamId')['from'](_0x0788('0x5d'),'tq')[_0x0788('0x5e')](_0x0788('0x5f'),'ut',_0x0788('0x60'))[_0x0788('0x23')](_0x0788('0x61'),_0x3de870[_0x0788('0x27')]['id']);for(var _0x2b2af0=0x0;_0x2b2af0<_0x3c194e[_0x0788('0x2f')];_0x2b2af0+=0x1){let _0x11a26e=_0x3c194e[_0x2b2af0];for(var _0x5b130f=0x0;_0x5b130f<_0x11a26e[_0x0788('0x51')][_0x0788('0x2f')];_0x5b130f+=0x1){let _0x5b2d88=_0x11a26e['Agents'][_0x5b130f];var _0x335c53=_0x2d3919[_0x0788('0x62')]();_0x335c53[_0x0788('0x23')](_0x0788('0x63'),_0x5b2d88['id']);_0x47269c[_0x0788('0x64')](db[_0x0788('0x65')]['query'](_0x335c53[_0x0788('0x66')](),{'type':db[_0x0788('0x65')][_0x0788('0x67')][_0x0788('0x68')]})[_0x0788('0x16')](function(_0x34c46b){if(_0x34c46b[_0x0788('0x2f')]===0x1){return _0x5b2d88['id'];}else{var _0x2176aa=_[_0x0788('0x69')](_[_0x0788('0x1f')](_0x34c46b,_0x0788('0x6a')),function(_0x59e487){return _[_0x0788('0x6b')](_0x10397e,_0x59e487);});if(_0x2176aa){return _0x5b2d88['id'];}}}));}}return BPromise['all'](_0x47269c)[_0x0788('0x16')](function(_0x1b0f1e){_0x3ff084=_(_0x3ff084)[_0x0788('0x6c')](_0x1b0f1e)['compact']()[_0x0788('0x6d')]();return db['FaxQueue'][_0x0788('0x32')]({'where':{'id':_0x3de870[_0x0788('0x27')]['id']}})[_0x0788('0x16')](function(_0x5ba5f5){return db['sequelize'][_0x0788('0x6e')](function(_0x21da72){return _0x5ba5f5['removeTeams'](_0x3de870['query']['ids'],{'transaction':_0x21da72})[_0x0788('0x16')](function(){if(!_[_0x0788('0x6f')](_0x3ff084)){return _0x5ba5f5[_0x0788('0x70')](_0x3ff084,{'transaction':_0x21da72});}})[_0x0788('0x16')](function(){_0x3ff084[_0x0788('0x58')](function(_0x4b2c9f){socket[_0x0788('0x59')](_0x0788('0x71'),{'UserId':_0x4b2c9f,'FaxQueueId':_0x5ba5f5['id']});});});});});});})[_0x0788('0x16')](respondWithStatusCode(_0x1eebaa,null))[_0x0788('0x33')](handleError(_0x1eebaa,null));};exports[_0x0788('0x72')]=function(_0x2f08e2,_0x5072e3){return db[_0x0788('0x20')][_0x0788('0x32')]({'where':{'id':_0x2f08e2[_0x0788('0x27')]['id']}})[_0x0788('0x16')](handleEntityNotFound(_0x5072e3,null))['then'](function(_0x54ee17){if(_0x54ee17){return _0x54ee17[_0x0788('0x72')](_0x2f08e2['body'][_0x0788('0x73')],_[_0x0788('0x74')](_0x2f08e2[_0x0788('0x34')],[_0x0788('0x73'),'id'])||{})[_0x0788('0x75')](function(_0x160252){for(var _0x3bb4b6=0x0;_0x3bb4b6<_0x2f08e2[_0x0788('0x34')][_0x0788('0x73')][_0x0788('0x2f')];_0x3bb4b6+=0x1){socket[_0x0788('0x59')](_0x0788('0x5a'),{'UserId':Number(_0x2f08e2[_0x0788('0x34')][_0x0788('0x73')][_0x3bb4b6]),'FaxQueueId':Number(_0x2f08e2[_0x0788('0x27')]['id'])});}return _0x160252;});}})['then'](respondWithResult(_0x5072e3,null))['catch'](handleError(_0x5072e3,null));};exports[_0x0788('0x70')]=function(_0x8fb858,_0x826fad){return db[_0x0788('0x20')][_0x0788('0x32')]({'where':{'id':_0x8fb858[_0x0788('0x27')]['id']}})[_0x0788('0x16')](handleEntityNotFound(_0x826fad,null))[_0x0788('0x16')](function(_0x4d59f9){if(_0x4d59f9){return _0x4d59f9[_0x0788('0x70')](_0x8fb858[_0x0788('0x2a')][_0x0788('0x73')])[_0x0788('0x16')](function(){if(_['isArray'](_0x8fb858[_0x0788('0x2a')]['ids'])){for(var _0x4fce9c=0x0;_0x4fce9c<_0x8fb858[_0x0788('0x2a')][_0x0788('0x73')][_0x0788('0x2f')];_0x4fce9c+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x8fb858[_0x0788('0x2a')][_0x0788('0x73')][_0x4fce9c]),'FaxQueueId':Number(_0x8fb858['params']['id'])});}}else{socket[_0x0788('0x59')]('userFaxQueue:remove',{'UserId':Number(_0x8fb858[_0x0788('0x2a')][_0x0788('0x73')]),'FaxQueueId':Number(_0x8fb858[_0x0788('0x27')]['id'])});}});}})[_0x0788('0x16')](respondWithStatusCode(_0x826fad,null))['catch'](handleError(_0x826fad,null));};exports[_0x0788('0x76')]=function(_0x3a5308,_0x27e005){var _0x3a64ad={};var _0x4959ff={};var _0x4fb458;var _0x15e850;return db[_0x0788('0x20')]['findOne']({'where':{'id':_0x3a5308[_0x0788('0x27')]['id']}})[_0x0788('0x16')](handleEntityNotFound(_0x27e005,null))[_0x0788('0x16')](function(_0x1f183e){if(_0x1f183e){_0x4fb458=_0x1f183e;_0x4959ff[_0x0788('0x28')]=_[_0x0788('0x29')](db[_0x0788('0x46')][_0x0788('0x21')]);_0x4959ff['query']=_['keys'](_0x3a5308[_0x0788('0x2a')]);_0x4959ff[_0x0788('0x2b')]=_[_0x0788('0x2c')](_0x4959ff[_0x0788('0x28')],_0x4959ff[_0x0788('0x2a')]);_0x3a64ad[_0x0788('0x2e')]=_['intersection'](_0x4959ff['model'],qs['fields'](_0x3a5308[_0x0788('0x2a')][_0x0788('0x2d')]));_0x3a64ad[_0x0788('0x2e')]=_0x3a64ad['attributes'][_0x0788('0x2f')]?_0x3a64ad[_0x0788('0x2e')]:_0x4959ff[_0x0788('0x28')];_0x3a64ad[_0x0788('0x41')]=qs[_0x0788('0x42')](_0x3a5308[_0x0788('0x2a')][_0x0788('0x42')]);_0x3a64ad['where']=qs[_0x0788('0x2b')](_[_0x0788('0x43')](_0x3a5308[_0x0788('0x2a')],_0x4959ff['filters']));if(_0x3a5308[_0x0788('0x2a')][_0x0788('0x45')]){_0x3a64ad[_0x0788('0x23')]=_[_0x0788('0x30')](_0x3a64ad[_0x0788('0x23')],{'$or':_[_0x0788('0x1f')](_0x3a64ad[_0x0788('0x2e')],function(_0x28a591){var _0x53ab39={};_0x53ab39[_0x28a591]={'$like':'%'+_0x3a5308[_0x0788('0x2a')][_0x0788('0x45')]+'%'};return _0x53ab39;})});}_0x3a64ad=_[_0x0788('0x30')]({},_0x3a64ad,_0x3a5308[_0x0788('0x31')]);return _0x4fb458['getAgents'](_0x3a64ad);}})[_0x0788('0x16')](function(_0x25ad73){if(_0x25ad73){_0x15e850=_0x25ad73[_0x0788('0x2f')];if(!_0x3a5308[_0x0788('0x2a')]['hasOwnProperty'](_0x0788('0x40'))){_0x3a64ad[_0x0788('0x11')]=qs[_0x0788('0x11')](_0x3a5308[_0x0788('0x2a')][_0x0788('0x11')]);_0x3a64ad[_0x0788('0xf')]=qs[_0x0788('0xf')](_0x3a5308[_0x0788('0x2a')][_0x0788('0xf')]);}return _0x4fb458[_0x0788('0x76')](_0x3a64ad);}})[_0x0788('0x16')](function(_0x2df294){if(_0x2df294){return _0x2df294?{'count':_0x15e850,'rows':_0x2df294}:null;}})[_0x0788('0x16')](respondWithResult(_0x27e005,null))['catch'](handleError(_0x27e005,null));}; \ No newline at end of file +var _0x0e4b=['./faxQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','FaxQueues','stack','send','index','map','rawAttributes','fieldName','type','getOptions','where','FaxQueue','include','findAll','rows','catch','show','model','query','filters','intersection','fields','attributes','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','name','error','body','params','describe','getMembers','findOne','length','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','UserFaxQueue','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','keys','Team','pick','addTeams','ids','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','compact','value','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0xf852,_0x4ddd76){var _0x5b2550=function(_0x4811b1){while(--_0x4811b1){_0xf852['push'](_0xf852['shift']());}};_0x5b2550(++_0x4ddd76);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x3ad581,_0x1dcb0e){_0x3ad581=_0x3ad581-0x0;var _0x117d7c=_0x0e4b[_0x3ad581];return _0x117d7c;};'use strict';var BPromise=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var _=require(_0xb0e4('0x2'));var squel=require('squel');var Redis=require(_0xb0e4('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xb0e4('0x4'))['db'];config[_0xb0e4('0x5')]=_['defaults'](config[_0xb0e4('0x5')],{'host':_0xb0e4('0x6'),'port':0x18eb});var socket=require(_0xb0e4('0x7'))(new Redis(config[_0xb0e4('0x5')]));require(_0xb0e4('0x8'))['register'](socket);function respondWithStatusCode(_0x5192f0,_0x101860){_0x101860=_0x101860||0xcc;return function(_0x9d4a99){if(_0x9d4a99){return _0x5192f0[_0xb0e4('0x9')](_0x101860);}return _0x5192f0[_0xb0e4('0xa')](_0x101860)[_0xb0e4('0xb')]();};}function respondWithResult(_0x140b7e,_0x16940b){_0x16940b=_0x16940b||0xc8;return function(_0x232133){if(_0x232133){return _0x140b7e[_0xb0e4('0xa')](_0x16940b)[_0xb0e4('0xc')](_0x232133);}};}function respondWithFilteredResult(_0x598c20,_0x185153){return function(_0x17ab2e){if(_0x17ab2e){var _0x3fdf0f=typeof _0x185153[_0xb0e4('0xd')]==='undefined'&&typeof _0x185153[_0xb0e4('0xe')]===_0xb0e4('0xf');var _0x585441=_0x17ab2e[_0xb0e4('0x10')];var _0x26f664=_0x3fdf0f?0x0:_0x185153[_0xb0e4('0xd')];var _0x460180=_0x3fdf0f?_0x17ab2e[_0xb0e4('0x10')]:_0x185153['offset']+_0x185153['limit'];var _0x17419f;if(_0x460180>=_0x585441){_0x460180=_0x585441;_0x17419f=0xc8;}else{_0x17419f=0xce;}_0x598c20[_0xb0e4('0xa')](_0x17419f);return _0x598c20['set'](_0xb0e4('0x11'),_0x26f664+'-'+_0x460180+'/'+_0x585441)[_0xb0e4('0xc')](_0x17ab2e);}return null;};}function saveUpdates(_0xc12df2){return function(_0xd9cfb6){if(_0xd9cfb6){return _0xd9cfb6[_0xb0e4('0x12')](_0xc12df2)[_0xb0e4('0x13')](function(_0x570886){return _0x570886;});}return null;};}function removeEntity(_0x491a29){return function(_0x4ba49e){if(_0x4ba49e){return _0x4ba49e[_0xb0e4('0x14')]()[_0xb0e4('0x13')](function(){var _0x28d343=_0x4ba49e[_0xb0e4('0x15')]({'plain':!![]});var _0x2ce0c6=_0xb0e4('0x16');return db['UserProfileResource'][_0xb0e4('0x14')]({'where':{'type':_0x2ce0c6,'resourceId':_0x28d343['id']}})[_0xb0e4('0x13')](function(){return _0x4ba49e;});})[_0xb0e4('0x13')](function(){_0x491a29[_0xb0e4('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501668){return function(_0x4f2488){if(!_0x4f2488){_0x501668['sendStatus'](0x194);}return _0x4f2488;};}function handleError(_0x2663f3,_0x2774be){_0x2774be=_0x2774be||0x1f4;return function(_0xe6a9cf){logger['error'](_0xe6a9cf[_0xb0e4('0x17')]);if(_0xe6a9cf['name']){delete _0xe6a9cf['name'];}_0x2663f3[_0xb0e4('0xa')](_0x2774be)[_0xb0e4('0x18')](_0xe6a9cf);};}exports[_0xb0e4('0x19')]=function(_0x26420c,_0x13781c){var _0x248aa5={};var _0x6665e={'count':0x0,'rows':[]};var _0x50fe9e=_[_0xb0e4('0x1a')](db['FaxQueue'][_0xb0e4('0x1b')],function(_0x22033f){return{'name':_0x22033f[_0xb0e4('0x1c')],'type':_0x22033f[_0xb0e4('0x1d')]['key']};});_0x248aa5=qs[_0xb0e4('0x1e')](_0x50fe9e,_0x26420c);var _0x2ccef1={'where':_0x248aa5[_0xb0e4('0x1f')]};return db[_0xb0e4('0x20')][_0xb0e4('0x10')](_0x2ccef1)[_0xb0e4('0x13')](function(_0x1dad0e){_0x6665e[_0xb0e4('0x10')]=_0x1dad0e;_0x248aa5['include']=qs[_0xb0e4('0x21')](_0x26420c['query']);return db[_0xb0e4('0x20')][_0xb0e4('0x22')](_0x248aa5);})['then'](function(_0x2c97aa){_0x6665e[_0xb0e4('0x23')]=_0x2c97aa;return _0x6665e;})[_0xb0e4('0x13')](respondWithFilteredResult(_0x13781c,_0x248aa5))[_0xb0e4('0x24')](handleError(_0x13781c,null));};exports[_0xb0e4('0x25')]=function(_0x3313c6,_0x5e8667){var _0x30d324={'raw':!![],'where':{'id':_0x3313c6['params']['id']}},_0x57339c={};_0x57339c[_0xb0e4('0x26')]=_['keys'](db[_0xb0e4('0x20')]['rawAttributes']);_0x57339c[_0xb0e4('0x27')]=_['keys'](_0x3313c6[_0xb0e4('0x27')]);_0x57339c[_0xb0e4('0x28')]=_[_0xb0e4('0x29')](_0x57339c['model'],_0x57339c[_0xb0e4('0x27')]);_0x30d324['attributes']=_[_0xb0e4('0x29')](_0x57339c[_0xb0e4('0x26')],qs[_0xb0e4('0x2a')](_0x3313c6[_0xb0e4('0x27')][_0xb0e4('0x2a')]));_0x30d324['attributes']=_0x30d324[_0xb0e4('0x2b')]['length']?_0x30d324[_0xb0e4('0x2b')]:_0x57339c[_0xb0e4('0x26')];if(_0x3313c6[_0xb0e4('0x27')]['includeAll']){_0x30d324[_0xb0e4('0x21')]=[{'all':!![]}];}_0x30d324=_[_0xb0e4('0x2c')]({},_0x30d324,_0x3313c6[_0xb0e4('0x2d')]);return db[_0xb0e4('0x20')]['find'](_0x30d324)['then'](handleEntityNotFound(_0x5e8667,null))['then'](respondWithResult(_0x5e8667,null))['catch'](handleError(_0x5e8667,null));};exports[_0xb0e4('0x2e')]=function(_0x4b924d,_0x3beb07){return db['FaxQueue'][_0xb0e4('0x2e')](_0x4b924d['body'],{})[_0xb0e4('0x13')](function(_0x222c3b){var _0x331de4=_0x4b924d[_0xb0e4('0x2f')]['get']({'plain':!![]});if(!_0x331de4)throw new Error(_0xb0e4('0x30'));if(_0x331de4[_0xb0e4('0x31')]==='user'){var _0xa97f7c=_0x222c3b['get']({'plain':!![]});var _0x455b7e=_0xb0e4('0x16');return db['UserProfileSection'][_0xb0e4('0x32')]({'where':{'name':_0x455b7e,'userProfileId':_0x331de4['userProfileId']},'raw':!![]})['then'](function(_0x4ec8c6){if(_0x4ec8c6&&_0x4ec8c6[_0xb0e4('0x33')]===0x0){return db[_0xb0e4('0x34')]['create']({'name':_0xa97f7c[_0xb0e4('0x35')],'resourceId':_0xa97f7c['id'],'type':_0x4ec8c6['name'],'sectionId':_0x4ec8c6['id']},{})[_0xb0e4('0x13')](function(){return _0x222c3b;});}else{return _0x222c3b;}})[_0xb0e4('0x24')](function(_0x2a5c01){logger[_0xb0e4('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a5c01);throw _0x2a5c01;});}return _0x222c3b;})[_0xb0e4('0x13')](respondWithResult(_0x3beb07,0xc9))[_0xb0e4('0x24')](handleError(_0x3beb07,null));};exports[_0xb0e4('0x12')]=function(_0x3e839e,_0x387122){if(_0x3e839e[_0xb0e4('0x37')]['id']){delete _0x3e839e[_0xb0e4('0x37')]['id'];}return db[_0xb0e4('0x20')][_0xb0e4('0x32')]({'where':{'id':_0x3e839e[_0xb0e4('0x38')]['id']}})[_0xb0e4('0x13')](handleEntityNotFound(_0x387122,null))[_0xb0e4('0x13')](saveUpdates(_0x3e839e[_0xb0e4('0x37')],null))[_0xb0e4('0x13')](respondWithResult(_0x387122,null))[_0xb0e4('0x24')](handleError(_0x387122,null));};exports[_0xb0e4('0x14')]=function(_0x5b7448,_0x277cdd){return db[_0xb0e4('0x20')][_0xb0e4('0x32')]({'where':{'id':_0x5b7448[_0xb0e4('0x38')]['id']}})['then'](handleEntityNotFound(_0x277cdd,null))[_0xb0e4('0x13')](removeEntity(_0x277cdd,null))[_0xb0e4('0x24')](handleError(_0x277cdd,null));};exports['describe']=function(_0x28a484,_0x2c1c5c){return db[_0xb0e4('0x20')][_0xb0e4('0x39')]()['then'](respondWithResult(_0x2c1c5c,null))[_0xb0e4('0x24')](handleError(_0x2c1c5c,null));};exports[_0xb0e4('0x3a')]=function(_0x3c30e8,_0x1b1838){var _0x78b898={'raw':!![],'where':{}},_0x2ffb16={},_0x2a5b12;return db[_0xb0e4('0x20')][_0xb0e4('0x3b')]({'where':{'id':_0x3c30e8[_0xb0e4('0x38')]['id']}})[_0xb0e4('0x13')](handleEntityNotFound(_0x1b1838,null))['then'](function(_0x24128c){if(_0x24128c){_0x2a5b12=_0x24128c[_0xb0e4('0x15')]({'plain':!![]});_0x2ffb16['model']=_['keys'](db['UserFaxQueue'][_0xb0e4('0x1b')]);_0x2ffb16[_0xb0e4('0x27')]=_['keys'](_0x3c30e8['query']);_0x2ffb16['filters']=_['intersection'](_0x2ffb16['model'],_0x2ffb16['query']);_0x78b898[_0xb0e4('0x2b')]=_['intersection'](_0x2ffb16[_0xb0e4('0x26')],qs[_0xb0e4('0x2a')](_0x3c30e8[_0xb0e4('0x27')][_0xb0e4('0x2a')]));_0x78b898['attributes']=_0x78b898[_0xb0e4('0x2b')][_0xb0e4('0x3c')]?_0x78b898['attributes']:_0x2ffb16[_0xb0e4('0x26')];if(!_0x3c30e8['query'][_0xb0e4('0x3d')](_0xb0e4('0x3e'))){_0x78b898[_0xb0e4('0xe')]=qs[_0xb0e4('0xe')](_0x3c30e8['query'][_0xb0e4('0xe')]);_0x78b898[_0xb0e4('0xd')]=qs[_0xb0e4('0xd')](_0x3c30e8[_0xb0e4('0x27')]['offset']);}_0x78b898[_0xb0e4('0x3f')]=qs[_0xb0e4('0x40')](_0x3c30e8[_0xb0e4('0x27')]['sort']);_0x78b898['where']=qs['filters'](_['pick'](_0x3c30e8['query'],_0x2ffb16[_0xb0e4('0x28')]));_0x78b898['where'][_0xb0e4('0x41')]=_0x24128c['id'];if(_0x3c30e8[_0xb0e4('0x27')][_0xb0e4('0x42')]){_0x78b898[_0xb0e4('0x1f')]=_['merge'](_0x78b898[_0xb0e4('0x1f')],{'$or':_[_0xb0e4('0x1a')](_0x78b898['attributes'],function(_0x3f9bd4){var _0x54e8f2={};_0x54e8f2[_0x3f9bd4]={'$like':'%'+_0x3c30e8[_0xb0e4('0x27')][_0xb0e4('0x42')]+'%'};return _0x54e8f2;})});}_0x78b898=_[_0xb0e4('0x2c')]({},_0x78b898,_0x3c30e8['options']);return db[_0xb0e4('0x43')][_0xb0e4('0x22')](_0x78b898);}})['then'](function(_0x2b0998){if(_0x2b0998){return db[_0xb0e4('0x44')]['findAndCountAll']({'where':{'id':_['map'](_0x2b0998,_0xb0e4('0x45')),'role':_0xb0e4('0x46')},'attributes':['id',_0xb0e4('0x35'),'faxPause',_0xb0e4('0x47'),_0xb0e4('0x48')]});}})['then'](function(_0x313801){if(_0x313801){return{'count':_0x313801[_0xb0e4('0x10')],'rows':_['map'](_0x313801[_0xb0e4('0x23')],function(_0x305b44){return{'membername':_0x305b44[_0xb0e4('0x35')],'UserId':_0x305b44['id'],'queue_name':_0x2a5b12['name'],'FaxQueueId':_0x2a5b12['id'],'interface':util[_0xb0e4('0x49')](_0xb0e4('0x4a'),_0xb0e4('0x4b'),_0x305b44[_0xb0e4('0x35')]),'penalty':0x0,'paused':_0x305b44['faxPause'],'createdAt':_0x305b44[_0xb0e4('0x48')],'updatedAt':_0x305b44[_0xb0e4('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb0e4('0x13')](respondWithFilteredResult(_0x1b1838,_0x78b898))[_0xb0e4('0x24')](handleError(_0x1b1838,null));};exports[_0xb0e4('0x4c')]=function(_0x1a6254,_0x30150c){var _0x5473d7={};var _0x58cae0={};var _0x46d2f1;var _0x3bcb8d;return db[_0xb0e4('0x20')][_0xb0e4('0x3b')]({'where':{'id':_0x1a6254[_0xb0e4('0x38')]['id']}})[_0xb0e4('0x13')](handleEntityNotFound(_0x30150c,null))[_0xb0e4('0x13')](function(_0x25f452){if(_0x25f452){_0x46d2f1=_0x25f452;_0x58cae0[_0xb0e4('0x26')]=_[_0xb0e4('0x4d')](db[_0xb0e4('0x4e')][_0xb0e4('0x1b')]);_0x58cae0[_0xb0e4('0x27')]=_[_0xb0e4('0x4d')](_0x1a6254[_0xb0e4('0x27')]);_0x58cae0[_0xb0e4('0x28')]=_['intersection'](_0x58cae0['model'],_0x58cae0[_0xb0e4('0x27')]);_0x5473d7[_0xb0e4('0x2b')]=_[_0xb0e4('0x29')](_0x58cae0[_0xb0e4('0x26')],qs[_0xb0e4('0x2a')](_0x1a6254['query']['fields']));_0x5473d7[_0xb0e4('0x2b')]=_0x5473d7[_0xb0e4('0x2b')][_0xb0e4('0x3c')]?_0x5473d7['attributes']:_0x58cae0[_0xb0e4('0x26')];_0x5473d7[_0xb0e4('0x3f')]=qs['sort'](_0x1a6254['query'][_0xb0e4('0x40')]);_0x5473d7['where']=qs[_0xb0e4('0x28')](_[_0xb0e4('0x4f')](_0x1a6254[_0xb0e4('0x27')],_0x58cae0[_0xb0e4('0x28')]));if(_0x1a6254[_0xb0e4('0x27')][_0xb0e4('0x42')]){_0x5473d7[_0xb0e4('0x1f')]=_[_0xb0e4('0x2c')](_0x5473d7[_0xb0e4('0x1f')],{'$or':_[_0xb0e4('0x1a')](_0x5473d7[_0xb0e4('0x2b')],function(_0x4ed98e){var _0x2b3fb8={};_0x2b3fb8[_0x4ed98e]={'$like':'%'+_0x1a6254[_0xb0e4('0x27')][_0xb0e4('0x42')]+'%'};return _0x2b3fb8;})});}_0x5473d7=_[_0xb0e4('0x2c')]({},_0x5473d7,_0x1a6254[_0xb0e4('0x2d')]);return _0x46d2f1[_0xb0e4('0x4c')](_0x5473d7);}})[_0xb0e4('0x13')](function(_0x962df6){if(_0x962df6){_0x3bcb8d=_0x962df6['length'];if(!_0x1a6254[_0xb0e4('0x27')][_0xb0e4('0x3d')](_0xb0e4('0x3e'))){_0x5473d7[_0xb0e4('0xe')]=qs[_0xb0e4('0xe')](_0x1a6254[_0xb0e4('0x27')][_0xb0e4('0xe')]);_0x5473d7[_0xb0e4('0xd')]=qs[_0xb0e4('0xd')](_0x1a6254['query'][_0xb0e4('0xd')]);}return _0x46d2f1['getTeams'](_0x5473d7);}})[_0xb0e4('0x13')](function(_0x56d9e0){if(_0x56d9e0){return _0x56d9e0?{'count':_0x3bcb8d,'rows':_0x56d9e0}:null;}})['then'](respondWithResult(_0x30150c,null))['catch'](handleError(_0x30150c,null));};exports[_0xb0e4('0x50')]=function(_0x3b6ea4,_0x2f39c1){var _0x282398=_0x3b6ea4[_0xb0e4('0x37')][_0xb0e4('0x51')];return db[_0xb0e4('0x4e')]['findAll']({'where':{'id':_0x282398},'attributes':['id'],'include':[{'model':db[_0xb0e4('0x44')],'as':'Agents','attributes':['id',_0xb0e4('0x35'),'online','voicePause',_0xb0e4('0x52')],'raw':!![]}]})['then'](function(_0x4bb7a6){if(_0x4bb7a6){var _0x1ac0b5=_[_0xb0e4('0x53')](_0x4bb7a6,function(_0x27e840){var _0x1ca5d5=_0x27e840['get']({'plain':!![]});return _0x1ca5d5[_0xb0e4('0x54')];});return db[_0xb0e4('0x20')][_0xb0e4('0x32')]({'where':{'id':_0x3b6ea4['params']['id']}})['then'](function(_0xfbf6a9){return db[_0xb0e4('0x55')][_0xb0e4('0x56')](function(_0x143eed){return _0xfbf6a9['addTeams'](_0x282398,{'transaction':_0x143eed})[_0xb0e4('0x13')](function(){return BPromise['each'](_0x1ac0b5,function(_0x219620){return db[_0xb0e4('0x43')][_0xb0e4('0x57')]({'where':{'UserId':_0x219620['id'],'FaxQueueId':_0x3b6ea4[_0xb0e4('0x38')]['id']},'transaction':_0x143eed});});})[_0xb0e4('0x13')](function(){_0x1ac0b5[_0xb0e4('0x58')](function(_0x2e36ec){socket['emit'](_0xb0e4('0x59'),{'UserId':_0x2e36ec['id'],'FaxQueueId':_0xfbf6a9['id']});});});});});}})[_0xb0e4('0x13')](respondWithStatusCode(_0x2f39c1,null))[_0xb0e4('0x24')](handleError(_0x2f39c1,null));};exports[_0xb0e4('0x5a')]=function(_0x130eae,_0x318e9c){return db[_0xb0e4('0x4e')][_0xb0e4('0x22')]({'where':{'id':_0x130eae[_0xb0e4('0x27')][_0xb0e4('0x51')]},'attributes':['id'],'include':[{'model':db[_0xb0e4('0x44')],'as':_0xb0e4('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x318e9c,null))[_0xb0e4('0x13')](function(_0x377d82){var _0x13f2b4=_['map'](_0x377d82,'id');var _0x359148=[];var _0x7af7d2=[];var _0x467277=squel[_0xb0e4('0x5b')]();_0x467277[_0xb0e4('0x5c')](_0xb0e4('0x5d'))[_0xb0e4('0x5e')]('team_has_fax_queues','tq')['join']('user_has_teams','ut',_0xb0e4('0x5f'))[_0xb0e4('0x1f')](_0xb0e4('0x60'),_0x130eae[_0xb0e4('0x38')]['id']);for(var _0x21f79f=0x0;_0x21f79f<_0x377d82[_0xb0e4('0x3c')];_0x21f79f+=0x1){let _0x2592d2=_0x377d82[_0x21f79f];for(var _0x71531b=0x0;_0x71531b<_0x2592d2[_0xb0e4('0x54')][_0xb0e4('0x3c')];_0x71531b+=0x1){let _0x433ea4=_0x2592d2[_0xb0e4('0x54')][_0x71531b];var _0x128f6c=_0x467277[_0xb0e4('0x61')]();_0x128f6c[_0xb0e4('0x1f')](_0xb0e4('0x62'),_0x433ea4['id']);_0x7af7d2['push'](db[_0xb0e4('0x55')][_0xb0e4('0x27')](_0x128f6c['toString'](),{'type':db[_0xb0e4('0x55')][_0xb0e4('0x63')]['SELECT']})[_0xb0e4('0x13')](function(_0x27c4e6){if(_0x27c4e6[_0xb0e4('0x3c')]===0x1){return _0x433ea4['id'];}else{var _0x5cf0cc=_[_0xb0e4('0x64')](_[_0xb0e4('0x1a')](_0x27c4e6,_0xb0e4('0x65')),function(_0x37fed2){return _['includes'](_0x13f2b4,_0x37fed2);});if(_0x5cf0cc){return _0x433ea4['id'];}}}));}}return BPromise[_0xb0e4('0x66')](_0x7af7d2)[_0xb0e4('0x13')](function(_0x47e242){_0x359148=_(_0x359148)[_0xb0e4('0x67')](_0x47e242)[_0xb0e4('0x68')]()[_0xb0e4('0x69')]();return db[_0xb0e4('0x20')]['find']({'where':{'id':_0x130eae[_0xb0e4('0x38')]['id']}})[_0xb0e4('0x13')](function(_0x231c64){return db[_0xb0e4('0x55')][_0xb0e4('0x56')](function(_0x171cbe){return _0x231c64[_0xb0e4('0x5a')](_0x130eae['query'][_0xb0e4('0x51')],{'transaction':_0x171cbe})[_0xb0e4('0x13')](function(){if(!_['isEmpty'](_0x359148)){return _0x231c64[_0xb0e4('0x6a')](_0x359148,{'transaction':_0x171cbe});}})['then'](function(){_0x359148[_0xb0e4('0x58')](function(_0x22a2ef){socket[_0xb0e4('0x6b')](_0xb0e4('0x6c'),{'UserId':_0x22a2ef,'FaxQueueId':_0x231c64['id']});});});});});});})[_0xb0e4('0x13')](respondWithStatusCode(_0x318e9c,null))[_0xb0e4('0x24')](handleError(_0x318e9c,null));};exports[_0xb0e4('0x6d')]=function(_0x1de291,_0x1be0f3){return db[_0xb0e4('0x20')][_0xb0e4('0x32')]({'where':{'id':_0x1de291[_0xb0e4('0x38')]['id']}})[_0xb0e4('0x13')](handleEntityNotFound(_0x1be0f3,null))[_0xb0e4('0x13')](function(_0x4ae034){if(_0x4ae034){return _0x4ae034[_0xb0e4('0x6d')](_0x1de291[_0xb0e4('0x37')][_0xb0e4('0x51')],_[_0xb0e4('0x6e')](_0x1de291['body'],['ids','id'])||{})[_0xb0e4('0x6f')](function(_0x35f8af){for(var _0xf404fa=0x0;_0xf404fa<_0x1de291[_0xb0e4('0x37')][_0xb0e4('0x51')][_0xb0e4('0x3c')];_0xf404fa+=0x1){socket[_0xb0e4('0x6b')](_0xb0e4('0x59'),{'UserId':Number(_0x1de291['body'][_0xb0e4('0x51')][_0xf404fa]),'FaxQueueId':Number(_0x1de291[_0xb0e4('0x38')]['id'])});}return _0x35f8af;});}})['then'](respondWithResult(_0x1be0f3,null))['catch'](handleError(_0x1be0f3,null));};exports['removeAgents']=function(_0x462cb6,_0x4114f6){return db[_0xb0e4('0x20')]['find']({'where':{'id':_0x462cb6[_0xb0e4('0x38')]['id']}})[_0xb0e4('0x13')](handleEntityNotFound(_0x4114f6,null))[_0xb0e4('0x13')](function(_0x60bfb6){if(_0x60bfb6){return _0x60bfb6[_0xb0e4('0x6a')](_0x462cb6['query']['ids'])['then'](function(){if(_[_0xb0e4('0x70')](_0x462cb6['query'][_0xb0e4('0x51')])){for(var _0x59c5ae=0x0;_0x59c5ae<_0x462cb6[_0xb0e4('0x27')][_0xb0e4('0x51')]['length'];_0x59c5ae+=0x1){socket['emit'](_0xb0e4('0x6c'),{'UserId':Number(_0x462cb6[_0xb0e4('0x27')][_0xb0e4('0x51')][_0x59c5ae]),'FaxQueueId':Number(_0x462cb6[_0xb0e4('0x38')]['id'])});}}else{socket[_0xb0e4('0x6b')](_0xb0e4('0x6c'),{'UserId':Number(_0x462cb6[_0xb0e4('0x27')][_0xb0e4('0x51')]),'FaxQueueId':Number(_0x462cb6[_0xb0e4('0x38')]['id'])});}});}})[_0xb0e4('0x13')](respondWithStatusCode(_0x4114f6,null))[_0xb0e4('0x24')](handleError(_0x4114f6,null));};exports['getAgents']=function(_0x5518a9,_0x509c99){var _0x140058={};var _0x3676cc={};var _0x2ff592;var _0x5a2bf3;return db['FaxQueue'][_0xb0e4('0x3b')]({'where':{'id':_0x5518a9[_0xb0e4('0x38')]['id']}})[_0xb0e4('0x13')](handleEntityNotFound(_0x509c99,null))['then'](function(_0x226961){if(_0x226961){_0x2ff592=_0x226961;_0x3676cc[_0xb0e4('0x26')]=_[_0xb0e4('0x4d')](db[_0xb0e4('0x44')][_0xb0e4('0x1b')]);_0x3676cc[_0xb0e4('0x27')]=_[_0xb0e4('0x4d')](_0x5518a9[_0xb0e4('0x27')]);_0x3676cc[_0xb0e4('0x28')]=_['intersection'](_0x3676cc[_0xb0e4('0x26')],_0x3676cc[_0xb0e4('0x27')]);_0x140058[_0xb0e4('0x2b')]=_['intersection'](_0x3676cc['model'],qs[_0xb0e4('0x2a')](_0x5518a9[_0xb0e4('0x27')][_0xb0e4('0x2a')]));_0x140058[_0xb0e4('0x2b')]=_0x140058[_0xb0e4('0x2b')][_0xb0e4('0x3c')]?_0x140058['attributes']:_0x3676cc[_0xb0e4('0x26')];_0x140058[_0xb0e4('0x3f')]=qs[_0xb0e4('0x40')](_0x5518a9[_0xb0e4('0x27')][_0xb0e4('0x40')]);_0x140058[_0xb0e4('0x1f')]=qs[_0xb0e4('0x28')](_[_0xb0e4('0x4f')](_0x5518a9['query'],_0x3676cc[_0xb0e4('0x28')]));if(_0x5518a9[_0xb0e4('0x27')][_0xb0e4('0x42')]){_0x140058[_0xb0e4('0x1f')]=_['merge'](_0x140058['where'],{'$or':_[_0xb0e4('0x1a')](_0x140058[_0xb0e4('0x2b')],function(_0x167c94){var _0x37ce4c={};_0x37ce4c[_0x167c94]={'$like':'%'+_0x5518a9[_0xb0e4('0x27')][_0xb0e4('0x42')]+'%'};return _0x37ce4c;})});}_0x140058=_['merge']({},_0x140058,_0x5518a9['options']);return _0x2ff592['getAgents'](_0x140058);}})[_0xb0e4('0x13')](function(_0x4a2fa4){if(_0x4a2fa4){_0x5a2bf3=_0x4a2fa4[_0xb0e4('0x3c')];if(!_0x5518a9['query'][_0xb0e4('0x3d')](_0xb0e4('0x3e'))){_0x140058[_0xb0e4('0xe')]=qs['limit'](_0x5518a9['query'][_0xb0e4('0xe')]);_0x140058['offset']=qs[_0xb0e4('0xd')](_0x5518a9[_0xb0e4('0x27')]['offset']);}return _0x2ff592[_0xb0e4('0x71')](_0x140058);}})[_0xb0e4('0x13')](function(_0x28f3a4){if(_0x28f3a4){return _0x28f3a4?{'count':_0x5a2bf3,'rows':_0x28f3a4}:null;}})['then'](respondWithResult(_0x509c99,null))[_0xb0e4('0x24')](handleError(_0x509c99,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 30f19bb..fbc8463 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 _0xd219=['remove','emit','events','setMaxListeners','save','update'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd219,0xb6));var _0x9d21=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xd219[_0x31e29a];return _0x32d892;};'use strict';var EventEmitter=require(_0x9d21('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9d21('0x1')](0x0);var events={'afterCreate':_0x9d21('0x2'),'afterUpdate':_0x9d21('0x3'),'afterDestroy':_0x9d21('0x4')};function emitEvent(_0x5adc3a){return function(_0x20bfda,_0x42ced7,_0x523ed0){FaxQueueEvents['emit'](_0x5adc3a+':'+_0x20bfda['id'],_0x20bfda);FaxQueueEvents[_0x9d21('0x5')](_0x5adc3a,_0x20bfda);_0x523ed0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xdd96=['hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xdd96,0x198));var _0x6dd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd96[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6dd9('0x0'))['db'][_0x6dd9('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6dd9('0x2')](0x0);var events={'afterCreate':_0x6dd9('0x3'),'afterUpdate':_0x6dd9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x17391b){return function(_0x3bfbef,_0x747fdf,_0x26be78){FaxQueueEvents[_0x6dd9('0x5')](_0x17391b+':'+_0x3bfbef['id'],_0x3bfbef);FaxQueueEvents[_0x6dd9('0x5')](_0x17391b,_0x3bfbef);_0x26be78(null);};}for(var e in events){if(events[_0x6dd9('0x6')](e)){var event=events[e];FaxQueue[_0x6dd9('0x7')](e,emitEvent(event));}}module[_0x6dd9('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index adb09d1..5b94235 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 _0xd53e=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue'];(function(_0xafe98f,_0x1da2bd){var _0x4f7a06=function(_0x169181){while(--_0x169181){_0xafe98f['push'](_0xafe98f['shift']());}};_0x4f7a06(++_0x1da2bd);}(_0xd53e,0x1c2));var _0xed53=function(_0x3c3721,_0x217df8){_0x3c3721=_0x3c3721-0x0;var _0x3805aa=_0xd53e[_0x3c3721];return _0x3805aa;};'use strict';var _=require(_0xed53('0x0'));var util=require(_0xed53('0x1'));var logger=require('../../config/logger')(_0xed53('0x2'));var moment=require(_0xed53('0x3'));var BPromise=require('bluebird');var rp=require(_0xed53('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed53('0x5'));var config=require(_0xed53('0x6'));var attributes=require(_0xed53('0x7'));module[_0xed53('0x8')]=function(_0x50a425,_0x23b2d8){return _0x50a425['define'](_0xed53('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c5=['fax_queues','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue'];(function(_0x5c0f1a,_0x12f287){var _0x5a6dfb=function(_0x177b03){while(--_0x177b03){_0x5c0f1a['push'](_0x5c0f1a['shift']());}};_0x5a6dfb(++_0x12f287);}(_0xa5c5,0x1f0));var _0x5a5c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa5c5[_0x432682];return _0x463d05;};'use strict';var _=require(_0x5a5c('0x0'));var util=require(_0x5a5c('0x1'));var logger=require(_0x5a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a5c('0x4'));var rimraf=require(_0x5a5c('0x5'));var config=require(_0x5a5c('0x6'));var attributes=require(_0x5a5c('0x7'));module[_0x5a5c('0x8')]=function(_0x1b342a,_0x5a20c2){return _0x1b342a['define'](_0x5a5c('0x9'),attributes,{'tableName':_0x5a5c('0xa'),'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 4e9a85e..1879676 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 _0x9d5f=['client','http','redis','defaults','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','find','ShowFaxQueue','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x200af4,_0x8416e8){var _0x3831b6=function(_0xf139c0){while(--_0xf139c0){_0x200af4['push'](_0x200af4['shift']());}};_0x3831b6(++_0x8416e8);}(_0x9d5f,0x11a));var _0xf9d5=function(_0x4acd4c,_0x13db3d){_0x4acd4c=_0x4acd4c-0x0;var _0x292e0c=_0x9d5f[_0x4acd4c];return _0x292e0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf9d5('0x0'));var BPromise=require(_0xf9d5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9d5('0x2'));var db=require(_0xf9d5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9d5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf9d5('0x5'));var client=jayson[_0xf9d5('0x6')][_0xf9d5('0x7')]({'port':0x232a});config[_0xf9d5('0x8')]=_[_0xf9d5('0x9')](config[_0xf9d5('0x8')],{'host':_0xf9d5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9d5('0x8')]));require(_0xf9d5('0xb'))[_0xf9d5('0xc')](socket);function respondWithRpcPromise(_0x67418d,_0x3f4fc7,_0x31b524){return new BPromise(function(_0x19a41d,_0x4908d0){return client[_0xf9d5('0xd')](_0x67418d,_0x31b524)[_0xf9d5('0xe')](function(_0x4189d2){logger[_0xf9d5('0xf')](_0xf9d5('0x10'),_0x3f4fc7,_0xf9d5('0x11'));logger[_0xf9d5('0x12')](_0xf9d5('0x13'),_0x3f4fc7,_0xf9d5('0x11'),JSON[_0xf9d5('0x14')](_0x4189d2));if(_0x4189d2[_0xf9d5('0x15')]){if(_0x4189d2[_0xf9d5('0x15')][_0xf9d5('0x16')]===0x1f4){logger[_0xf9d5('0x15')](_0xf9d5('0x10'),_0x3f4fc7,_0x4189d2['error']['message']);return _0x4908d0(_0x4189d2[_0xf9d5('0x15')][_0xf9d5('0x17')]);}logger[_0xf9d5('0x15')](_0xf9d5('0x10'),_0x3f4fc7,_0x4189d2[_0xf9d5('0x15')][_0xf9d5('0x17')]);return _0x19a41d(_0x4189d2[_0xf9d5('0x15')][_0xf9d5('0x17')]);}else{logger['info'](_0xf9d5('0x10'),_0x3f4fc7,_0xf9d5('0x11'));_0x19a41d(_0x4189d2['result'][_0xf9d5('0x17')]);}})[_0xf9d5('0x18')](function(_0x4a79b9){logger['error'](_0xf9d5('0x10'),_0x3f4fc7,_0x4a79b9);_0x4908d0(_0x4a79b9);});});}exports[_0xf9d5('0x19')]=function(_0x275bae){var _0xa14ec4=this;return new Promise(function(_0x9f144c,_0x4f6a00){return db[_0xf9d5('0x1a')]['findAll']({'raw':_0x275bae[_0xf9d5('0x1b')]?_0x275bae[_0xf9d5('0x1b')][_0xf9d5('0x1c')]===undefined?!![]:![]:!![],'where':_0x275bae[_0xf9d5('0x1b')]?_0x275bae[_0xf9d5('0x1b')][_0xf9d5('0x1d')]||null:null,'attributes':_0x275bae['options']?_0x275bae[_0xf9d5('0x1b')][_0xf9d5('0x1e')]||null:null,'limit':_0x275bae[_0xf9d5('0x1b')]?_0x275bae[_0xf9d5('0x1b')]['limit']||null:null,'include':_0x275bae[_0xf9d5('0x1b')]?_0x275bae[_0xf9d5('0x1b')][_0xf9d5('0x1f')]?_[_0xf9d5('0x20')](_0x275bae[_0xf9d5('0x1b')]['include'],function(_0x169f06){return{'model':db[_0x169f06['model']],'as':_0x169f06['as'],'attributes':_0x169f06['attributes'],'include':_0x169f06[_0xf9d5('0x1f')]?_[_0xf9d5('0x20')](_0x169f06[_0xf9d5('0x1f')],function(_0x22e42a){return{'model':db[_0x22e42a[_0xf9d5('0x21')]],'as':_0x22e42a['as'],'attributes':_0x22e42a[_0xf9d5('0x1e')],'include':_0x22e42a[_0xf9d5('0x1f')]?_[_0xf9d5('0x20')](_0x22e42a[_0xf9d5('0x1f')],function(_0x34ecda){return{'model':db[_0x34ecda[_0xf9d5('0x21')]],'as':_0x34ecda['as'],'attributes':_0x34ecda[_0xf9d5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf9d5('0xe')](function(_0x4f9954){logger['info'](_0xf9d5('0x19'),_0x275bae);logger['debug'](_0xf9d5('0x19'),_0x275bae,JSON[_0xf9d5('0x14')](_0x4f9954));_0x9f144c(_0x4f9954);})[_0xf9d5('0x18')](function(_0x41fc23){logger['error']('GetFaxQueue',_0x41fc23[_0xf9d5('0x17')],_0x275bae);_0x4f6a00(_0xa14ec4[_0xf9d5('0x15')](0x1f4,_0x41fc23['message']));});});};exports['ShowFaxQueue']=function(_0x22e021){var _0x294644=this;return new Promise(function(_0x2c0fd3,_0x81ea2e){return db[_0xf9d5('0x1a')][_0xf9d5('0x22')]({'raw':_0x22e021['options']?_0x22e021['options'][_0xf9d5('0x1c')]===undefined?!![]:![]:!![],'where':_0x22e021[_0xf9d5('0x1b')]?_0x22e021[_0xf9d5('0x1b')][_0xf9d5('0x1d')]||null:null,'attributes':_0x22e021[_0xf9d5('0x1b')]?_0x22e021[_0xf9d5('0x1b')][_0xf9d5('0x1e')]||null:null,'include':_0x22e021[_0xf9d5('0x1b')]?_0x22e021[_0xf9d5('0x1b')]['include']?_['map'](_0x22e021['options'][_0xf9d5('0x1f')],function(_0x5f286c){return{'model':db[_0x5f286c[_0xf9d5('0x21')]],'as':_0x5f286c['as'],'attributes':_0x5f286c[_0xf9d5('0x1e')],'include':_0x5f286c[_0xf9d5('0x1f')]?_['map'](_0x5f286c[_0xf9d5('0x1f')],function(_0x325c80){return{'model':db[_0x325c80[_0xf9d5('0x21')]],'as':_0x325c80['as'],'attributes':_0x325c80[_0xf9d5('0x1e')],'include':_0x325c80[_0xf9d5('0x1f')]?_['map'](_0x325c80[_0xf9d5('0x1f')],function(_0x4feebe){return{'model':db[_0x4feebe['model']],'as':_0x4feebe['as'],'attributes':_0x4feebe[_0xf9d5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf9d5('0xe')](function(_0x3366fe){logger[_0xf9d5('0xf')](_0xf9d5('0x23'),_0x22e021);logger[_0xf9d5('0x12')](_0xf9d5('0x23'),_0x22e021,JSON[_0xf9d5('0x14')](_0x3366fe));_0x2c0fd3(_0x3366fe);})[_0xf9d5('0x18')](function(_0x502004){logger[_0xf9d5('0x15')](_0xf9d5('0x23'),_0x502004[_0xf9d5('0x17')],_0x22e021);_0x81ea2e(_0x294644[_0xf9d5('0x15')](0x1f4,_0x502004[_0xf9d5('0x17')]));});});}; \ No newline at end of file +var _0x32f2=['error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowFaxQueue','debug','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxQueue.socket','request','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a9122,_0x1ed35d){var _0x48695f=function(_0xb08886){while(--_0xb08886){_0x5a9122['push'](_0x5a9122['shift']());}};_0x48695f(++_0x1ed35d);}(_0x32f2,0x117));var _0x232f=function(_0x1fe835,_0x3b9859){_0x1fe835=_0x1fe835-0x0;var _0x1fc033=_0x32f2[_0x1fe835];return _0x1fc033;};'use strict';var _=require(_0x232f('0x0'));var util=require('util');var moment=require(_0x232f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x232f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x232f('0x3'));var logger=require(_0x232f('0x4'))('rpc');var config=require(_0x232f('0x5'));var jayson=require(_0x232f('0x6'));var client=jayson[_0x232f('0x7')]['http']({'port':0x232a});config[_0x232f('0x8')]=_[_0x232f('0x9')](config['redis'],{'host':_0x232f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x232f('0x8')]));require(_0x232f('0xb'))['register'](socket);function respondWithRpcPromise(_0x3c44f6,_0x5e4b65,_0x1640c0){return new BPromise(function(_0x3adcef,_0x5389a2){return client[_0x232f('0xc')](_0x3c44f6,_0x1640c0)['then'](function(_0x5d2d33){logger[_0x232f('0xd')]('FaxQueue,\x20%s,\x20%s',_0x5e4b65,_0x232f('0xe'));logger['debug'](_0x232f('0xf'),_0x5e4b65,_0x232f('0xe'),JSON[_0x232f('0x10')](_0x5d2d33));if(_0x5d2d33[_0x232f('0x11')]){if(_0x5d2d33[_0x232f('0x11')][_0x232f('0x12')]===0x1f4){logger[_0x232f('0x11')](_0x232f('0x13'),_0x5e4b65,_0x5d2d33[_0x232f('0x11')][_0x232f('0x14')]);return _0x5389a2(_0x5d2d33['error'][_0x232f('0x14')]);}logger[_0x232f('0x11')](_0x232f('0x13'),_0x5e4b65,_0x5d2d33['error'][_0x232f('0x14')]);return _0x3adcef(_0x5d2d33[_0x232f('0x11')][_0x232f('0x14')]);}else{logger[_0x232f('0xd')](_0x232f('0x13'),_0x5e4b65,_0x232f('0xe'));_0x3adcef(_0x5d2d33[_0x232f('0x15')][_0x232f('0x14')]);}})[_0x232f('0x16')](function(_0x1ca7a5){logger[_0x232f('0x11')](_0x232f('0x13'),_0x5e4b65,_0x1ca7a5);_0x5389a2(_0x1ca7a5);});});}exports[_0x232f('0x17')]=function(_0x848326){var _0x2ed6f3=this;return new Promise(function(_0x2090e4,_0x3eb530){return db[_0x232f('0x18')][_0x232f('0x19')]({'raw':_0x848326['options']?_0x848326[_0x232f('0x1a')][_0x232f('0x1b')]===undefined?!![]:![]:!![],'where':_0x848326[_0x232f('0x1a')]?_0x848326[_0x232f('0x1a')][_0x232f('0x1c')]||null:null,'attributes':_0x848326[_0x232f('0x1a')]?_0x848326['options'][_0x232f('0x1d')]||null:null,'limit':_0x848326['options']?_0x848326[_0x232f('0x1a')][_0x232f('0x1e')]||null:null,'include':_0x848326[_0x232f('0x1a')]?_0x848326[_0x232f('0x1a')][_0x232f('0x1f')]?_['map'](_0x848326[_0x232f('0x1a')][_0x232f('0x1f')],function(_0x4c82c1){return{'model':db[_0x4c82c1['model']],'as':_0x4c82c1['as'],'attributes':_0x4c82c1[_0x232f('0x1d')],'include':_0x4c82c1[_0x232f('0x1f')]?_['map'](_0x4c82c1['include'],function(_0x49d759){return{'model':db[_0x49d759[_0x232f('0x20')]],'as':_0x49d759['as'],'attributes':_0x49d759[_0x232f('0x1d')],'include':_0x49d759[_0x232f('0x1f')]?_[_0x232f('0x21')](_0x49d759[_0x232f('0x1f')],function(_0x42e654){return{'model':db[_0x42e654[_0x232f('0x20')]],'as':_0x42e654['as'],'attributes':_0x42e654[_0x232f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x232f('0x22')](function(_0x224c70){logger['info'](_0x232f('0x17'),_0x848326);logger['debug'](_0x232f('0x17'),_0x848326,JSON[_0x232f('0x10')](_0x224c70));_0x2090e4(_0x224c70);})[_0x232f('0x16')](function(_0x201ca7){logger[_0x232f('0x11')](_0x232f('0x17'),_0x201ca7[_0x232f('0x14')],_0x848326);_0x3eb530(_0x2ed6f3[_0x232f('0x11')](0x1f4,_0x201ca7[_0x232f('0x14')]));});});};exports[_0x232f('0x23')]=function(_0x2d6159){var _0x4a32af=this;return new Promise(function(_0x18ee25,_0x5a3935){return db[_0x232f('0x18')]['find']({'raw':_0x2d6159[_0x232f('0x1a')]?_0x2d6159[_0x232f('0x1a')][_0x232f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d6159[_0x232f('0x1a')]?_0x2d6159[_0x232f('0x1a')]['where']||null:null,'attributes':_0x2d6159[_0x232f('0x1a')]?_0x2d6159[_0x232f('0x1a')][_0x232f('0x1d')]||null:null,'include':_0x2d6159[_0x232f('0x1a')]?_0x2d6159[_0x232f('0x1a')][_0x232f('0x1f')]?_[_0x232f('0x21')](_0x2d6159[_0x232f('0x1a')][_0x232f('0x1f')],function(_0x5de712){return{'model':db[_0x5de712[_0x232f('0x20')]],'as':_0x5de712['as'],'attributes':_0x5de712['attributes'],'include':_0x5de712[_0x232f('0x1f')]?_[_0x232f('0x21')](_0x5de712[_0x232f('0x1f')],function(_0x1b2c84){return{'model':db[_0x1b2c84[_0x232f('0x20')]],'as':_0x1b2c84['as'],'attributes':_0x1b2c84[_0x232f('0x1d')],'include':_0x1b2c84['include']?_[_0x232f('0x21')](_0x1b2c84['include'],function(_0x3e34ed){return{'model':db[_0x3e34ed[_0x232f('0x20')]],'as':_0x3e34ed['as'],'attributes':_0x3e34ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x232f('0x22')](function(_0x34c25a){logger[_0x232f('0xd')](_0x232f('0x23'),_0x2d6159);logger[_0x232f('0x24')]('ShowFaxQueue',_0x2d6159,JSON['stringify'](_0x34c25a));_0x18ee25(_0x34c25a);})[_0x232f('0x16')](function(_0x28c347){logger['error']('ShowFaxQueue',_0x28c347[_0x232f('0x14')],_0x2d6159);_0x5a3935(_0x4a32af['error'](0x1f4,_0x28c347[_0x232f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d919b2a..dfa3f4a 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 _0x890c=['removeListener','register','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x17a754,_0x5f1052){var _0x545d3e=function(_0x24ec39){while(--_0x24ec39){_0x17a754['push'](_0x17a754['shift']());}};_0x545d3e(++_0x5f1052);}(_0x890c,0xf1));var _0xc890=function(_0x611761,_0x29bdc7){_0x611761=_0x611761-0x0;var _0x5424e5=_0x890c[_0x611761];return _0x5424e5;};'use strict';var FaxQueueEvents=require(_0xc890('0x0'));var events=[_0xc890('0x1'),'remove',_0xc890('0x2')];function createListener(_0x1d101f,_0x69fcae){return function(_0x239c48){_0x69fcae[_0xc890('0x3')](_0x1d101f,_0x239c48);};}function removeListener(_0x2787d6,_0x2677eb){return function(){FaxQueueEvents[_0xc890('0x4')](_0x2787d6,_0x2677eb);};}exports[_0xc890('0x5')]=function(_0x328773){for(var _0x50172d=0x0,_0x1bd38e=events['length'];_0x50172d<_0x1bd38e;_0x50172d++){var _0x4cfb0b=events[_0x50172d];var _0x58f54e=createListener(_0xc890('0x6')+_0x4cfb0b,_0x328773);FaxQueueEvents['on'](_0x4cfb0b,_0x58f54e);}}; \ No newline at end of file +var _0xa83f=['register','faxQueue:','./faxQueue.events','remove','update','emit'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa83f,0xf8));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0xfa83('0x0'));var events=['save',_0xfa83('0x1'),_0xfa83('0x2')];function createListener(_0x1ffcdf,_0x4a780f){return function(_0x4b1dcd){_0x4a780f[_0xfa83('0x3')](_0x1ffcdf,_0x4b1dcd);};}function removeListener(_0x131b96,_0x5ba4f9){return function(){FaxQueueEvents['removeListener'](_0x131b96,_0x5ba4f9);};}exports[_0xfa83('0x4')]=function(_0x279000){for(var _0x49e34b=0x0,_0x506670=events['length'];_0x49e34b<_0x506670;_0x49e34b++){var _0x237536=events[_0x49e34b];var _0x316e62=createListener(_0xfa83('0x5')+_0x237536,_0x279000);FaxQueueEvents['on'](_0x237536,_0x316e62);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 3f1ac4c..2dc84d9 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 _0x0eeb=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','util','path'];(function(_0x37e0de,_0x435e7e){var _0x1f22db=function(_0x163935){while(--_0x163935){_0x37e0de['push'](_0x37e0de['shift']());}};_0x1f22db(++_0x435e7e);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0eeb[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var path=require(_0xb0ee('0x2'));var timeout=require(_0xb0ee('0x3'));var express=require(_0xb0ee('0x4'));var router=express[_0xb0ee('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var controller=require(_0xb0ee('0x8'));router[_0xb0ee('0x9')]('/',auth[_0xb0ee('0xa')](),controller[_0xb0ee('0xb')]);router[_0xb0ee('0x9')]('/describe',auth[_0xb0ee('0xa')](),controller['describe']);router[_0xb0ee('0x9')](_0xb0ee('0xc'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0xd')]);router[_0xb0ee('0x9')](_0xb0ee('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb0ee('0x9')](_0xb0ee('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb0ee('0x9')](_0xb0ee('0x10'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x11')]);router['post']('/',auth[_0xb0ee('0xa')](),controller['create']);router['post']('/:id/teams',auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x12')]);router['post'](_0xb0ee('0x10'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x13')]);router[_0xb0ee('0x14')](_0xb0ee('0xc'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x15')]);router[_0xb0ee('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb0ee('0x17')]);router['delete'](_0xb0ee('0xf'),auth[_0xb0ee('0xa')](),controller['removeTeams']);router['delete'](_0xb0ee('0x10'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x18')]);module['exports']=router; \ No newline at end of file +var _0x01d9=['post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x5f3f78,_0x10b855){var _0x220867=function(_0xabeaf9){while(--_0xabeaf9){_0x5f3f78['push'](_0x5f3f78['shift']());}};_0x220867(++_0x10b855);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['post']('/',auth[_0x901d('0xd')](),controller[_0x901d('0x17')]);router[_0x901d('0x18')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x19')]);router['post'](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router[_0x901d('0x1b')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x1d')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x1d')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1f')]);router[_0x901d('0x1d')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller['removeAgents']);module[_0x901d('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 9161bd4..2b4a980 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 _0x9b75=['STRING','DATE','moment','sequelize','exports'];(function(_0x2ebfb9,_0x585577){var _0x2111ef=function(_0x4c0fd4){while(--_0x4c0fd4){_0x2ebfb9['push'](_0x2ebfb9['shift']());}};_0x2111ef(++_0x585577);}(_0x9b75,0x1b5));var _0x59b7=function(_0x5847f4,_0x151609){_0x5847f4=_0x5847f4-0x0;var _0x584738=_0x9b75[_0x5847f4];return _0x584738;};'use strict';var moment=require(_0x59b7('0x0'));var Sequelize=require(_0x59b7('0x1'));module[_0x59b7('0x2')]={'uniqueid':{'type':Sequelize[_0x59b7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x59b7('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x59b7('0x4')]},'acceptAt':{'type':Sequelize[_0x59b7('0x4')]},'exitAt':{'type':Sequelize[_0x59b7('0x4')]},'reason':{'type':Sequelize[_0x59b7('0x3')]}}; \ No newline at end of file +var _0x50f2=['DATE','moment','sequelize','exports','STRING'];(function(_0x34b553,_0x809998){var _0x3e983b=function(_0x5ad224){while(--_0x5ad224){_0x34b553['push'](_0x34b553['shift']());}};_0x3e983b(++_0x809998);}(_0x50f2,0x11e));var _0x250f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x50f2[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require(_0x250f('0x0'));var Sequelize=require(_0x250f('0x1'));module[_0x250f('0x2')]={'uniqueid':{'type':Sequelize[_0x250f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x250f('0x3')]},'joinAt':{'type':Sequelize[_0x250f('0x4')]},'leaveAt':{'type':Sequelize[_0x250f('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x250f('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e83fc0c..3881f2a 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 _0x4f6f=['name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','merge','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x389c7e,_0xc6654f){var _0xda780b=function(_0x1a44f4){while(--_0x1a44f4){_0x389c7e['push'](_0x389c7e['shift']());}};_0xda780b(++_0xc6654f);}(_0x4f6f,0x157));var _0xf4f6=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x4f6f[_0x6ca7f4];return _0x494fa6;};'use strict';var emlformat=require(_0xf4f6('0x0'));var rimraf=require(_0xf4f6('0x1'));var zipdir=require(_0xf4f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4f6('0x3'));var moment=require('moment');var BPromise=require(_0xf4f6('0x4'));var Mustache=require(_0xf4f6('0x5'));var util=require('util');var path=require(_0xf4f6('0x6'));var sox=require(_0xf4f6('0x7'));var csv=require('to-csv');var ejs=require(_0xf4f6('0x8'));var fs=require('fs');var fs_extra=require(_0xf4f6('0x9'));var _=require(_0xf4f6('0xa'));var squel=require('squel');var crypto=require(_0xf4f6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4f6('0xc'));var querystring=require(_0xf4f6('0xd'));var Papa=require(_0xf4f6('0xe'));var Redis=require(_0xf4f6('0xf'));var authService=require(_0xf4f6('0x10'));var qs=require(_0xf4f6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f6('0x12'));var logger=require(_0xf4f6('0x13'))(_0xf4f6('0x14'));var utils=require(_0xf4f6('0x15'));var config=require(_0xf4f6('0x16'));var licenseUtil=require(_0xf4f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ea38b,_0x107046){_0x107046=_0x107046||0xcc;return function(_0x4976f5){if(_0x4976f5){return _0x5ea38b['sendStatus'](_0x107046);}return _0x5ea38b[_0xf4f6('0x18')](_0x107046)[_0xf4f6('0x19')]();};}function respondWithResult(_0x33492d,_0x4e623b){_0x4e623b=_0x4e623b||0xc8;return function(_0x3f314c){if(_0x3f314c){return _0x33492d[_0xf4f6('0x18')](_0x4e623b)[_0xf4f6('0x1a')](_0x3f314c);}};}function respondWithFilteredResult(_0x51c4c3,_0xfdf7ae){return function(_0x5ba4c4){if(_0x5ba4c4){var _0x1f06b6=typeof _0xfdf7ae[_0xf4f6('0x1b')]===_0xf4f6('0x1c')&&typeof _0xfdf7ae['limit']===_0xf4f6('0x1c');var _0x310845=_0x5ba4c4[_0xf4f6('0x1d')];var _0x4e1d2a=_0x1f06b6?0x0:_0xfdf7ae[_0xf4f6('0x1b')];var _0x4cb047=_0x1f06b6?_0x5ba4c4[_0xf4f6('0x1d')]:_0xfdf7ae[_0xf4f6('0x1b')]+_0xfdf7ae[_0xf4f6('0x1e')];var _0x4f0d14;if(_0x4cb047>=_0x310845){_0x4cb047=_0x310845;_0x4f0d14=0xc8;}else{_0x4f0d14=0xce;}_0x51c4c3[_0xf4f6('0x18')](_0x4f0d14);return _0x51c4c3[_0xf4f6('0x1f')](_0xf4f6('0x20'),_0x4e1d2a+'-'+_0x4cb047+'/'+_0x310845)[_0xf4f6('0x1a')](_0x5ba4c4);}return null;};}function patchUpdates(_0x112918){return function(_0x794453){try{jsonpatch[_0xf4f6('0x21')](_0x794453,_0x112918,!![]);}catch(_0x30917b){return BPromise[_0xf4f6('0x22')](_0x30917b);}return _0x794453[_0xf4f6('0x23')]();};}function saveUpdates(_0x3a5e24,_0x4d8497){return function(_0x9148f1){if(_0x9148f1){return _0x9148f1[_0xf4f6('0x24')](_0x3a5e24)[_0xf4f6('0x25')](function(_0x55ac8c){return _0x55ac8c;});}return null;};}function removeEntity(_0x1324f3,_0x45b5fb){return function(_0x5bbc9d){if(_0x5bbc9d){return _0x5bbc9d[_0xf4f6('0x26')]()[_0xf4f6('0x25')](function(){_0x1324f3[_0xf4f6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32af7b,_0x224be7){return function(_0x464be1){if(!_0x464be1){_0x32af7b[_0xf4f6('0x27')](0x194);}return _0x464be1;};}function handleError(_0x5f1d69,_0x303e94){_0x303e94=_0x303e94||0x1f4;return function(_0x330ec1){logger[_0xf4f6('0x28')](_0x330ec1[_0xf4f6('0x29')]);if(_0x330ec1[_0xf4f6('0x2a')]){delete _0x330ec1[_0xf4f6('0x2a')];}_0x5f1d69[_0xf4f6('0x18')](_0x303e94)[_0xf4f6('0x2b')](_0x330ec1);};}exports['index']=function(_0x43604d,_0x3fb157){var _0xe13578={},_0x59490b={},_0x3269ac={'count':0x0,'rows':[]};var _0x20faf2=_[_0xf4f6('0x2c')](db[_0xf4f6('0x2d')][_0xf4f6('0x2e')],function(_0x274756){return{'name':_0x274756[_0xf4f6('0x2f')],'type':_0x274756[_0xf4f6('0x30')][_0xf4f6('0x31')]};});_0x59490b['model']=_['map'](_0x20faf2,_0xf4f6('0x2a'));_0x59490b[_0xf4f6('0x32')]=_[_0xf4f6('0x33')](_0x43604d[_0xf4f6('0x32')]);_0x59490b[_0xf4f6('0x34')]=_[_0xf4f6('0x35')](_0x59490b[_0xf4f6('0x36')],_0x59490b[_0xf4f6('0x32')]);_0xe13578[_0xf4f6('0x37')]=_['intersection'](_0x59490b[_0xf4f6('0x36')],qs[_0xf4f6('0x38')](_0x43604d[_0xf4f6('0x32')]['fields']));_0xe13578[_0xf4f6('0x37')]=_0xe13578[_0xf4f6('0x37')][_0xf4f6('0x39')]?_0xe13578[_0xf4f6('0x37')]:_0x59490b[_0xf4f6('0x36')];if(!_0x43604d['query'][_0xf4f6('0x3a')](_0xf4f6('0x3b'))){_0xe13578['limit']=qs[_0xf4f6('0x1e')](_0x43604d[_0xf4f6('0x32')][_0xf4f6('0x1e')]);_0xe13578[_0xf4f6('0x1b')]=qs['offset'](_0x43604d[_0xf4f6('0x32')]['offset']);}_0xe13578[_0xf4f6('0x3c')]=qs[_0xf4f6('0x3d')](_0x43604d[_0xf4f6('0x32')]['sort']);_0xe13578[_0xf4f6('0x3e')]=qs[_0xf4f6('0x34')](_[_0xf4f6('0x3f')](_0x43604d[_0xf4f6('0x32')],_0x59490b['filters']),_0x20faf2);if(_0x43604d[_0xf4f6('0x32')][_0xf4f6('0x40')]){_0xe13578[_0xf4f6('0x3e')]=_['merge'](_0xe13578[_0xf4f6('0x3e')],{'$or':_['map'](_0x20faf2,function(_0x336ef5){if(_0x336ef5[_0xf4f6('0x30')]!==_0xf4f6('0x41')){var _0x4d92ac={};_0x4d92ac[_0x336ef5[_0xf4f6('0x2a')]]={'$like':'%'+_0x43604d[_0xf4f6('0x32')]['filter']+'%'};return _0x4d92ac;}})});}_0xe13578=_['merge']({},_0xe13578,_0x43604d[_0xf4f6('0x42')]);var _0x205fcb={'where':_0xe13578[_0xf4f6('0x3e')]};return db[_0xf4f6('0x2d')][_0xf4f6('0x1d')](_0x205fcb)[_0xf4f6('0x25')](function(_0xaed0b9){_0x3269ac[_0xf4f6('0x1d')]=_0xaed0b9;if(_0x43604d['query'][_0xf4f6('0x43')]){_0xe13578[_0xf4f6('0x44')]=[{'all':!![]}];}return db[_0xf4f6('0x2d')]['findAll'](_0xe13578);})[_0xf4f6('0x25')](function(_0x109f72){_0x3269ac[_0xf4f6('0x45')]=_0x109f72;return _0x3269ac;})['then'](respondWithFilteredResult(_0x3fb157,_0xe13578))[_0xf4f6('0x46')](handleError(_0x3fb157,null));};exports[_0xf4f6('0x47')]=function(_0x5dfd00,_0x1d0f43){var _0x4c4fb1={'raw':!![],'where':{'id':_0x5dfd00['params']['id']}},_0x3e2e13={};_0x3e2e13[_0xf4f6('0x36')]=_[_0xf4f6('0x33')](db[_0xf4f6('0x2d')][_0xf4f6('0x2e')]);_0x3e2e13[_0xf4f6('0x32')]=_[_0xf4f6('0x33')](_0x5dfd00[_0xf4f6('0x32')]);_0x3e2e13[_0xf4f6('0x34')]=_[_0xf4f6('0x35')](_0x3e2e13[_0xf4f6('0x36')],_0x3e2e13[_0xf4f6('0x32')]);_0x4c4fb1[_0xf4f6('0x37')]=_[_0xf4f6('0x35')](_0x3e2e13[_0xf4f6('0x36')],qs['fields'](_0x5dfd00['query']['fields']));_0x4c4fb1[_0xf4f6('0x37')]=_0x4c4fb1[_0xf4f6('0x37')]['length']?_0x4c4fb1[_0xf4f6('0x37')]:_0x3e2e13['model'];if(_0x5dfd00[_0xf4f6('0x32')][_0xf4f6('0x43')]){_0x4c4fb1[_0xf4f6('0x44')]=[{'all':!![]}];}_0x4c4fb1=_[_0xf4f6('0x48')]({},_0x4c4fb1,_0x5dfd00[_0xf4f6('0x42')]);return db['FaxQueueReport'][_0xf4f6('0x49')](_0x4c4fb1)['then'](handleEntityNotFound(_0x1d0f43,null))[_0xf4f6('0x25')](respondWithResult(_0x1d0f43,null))[_0xf4f6('0x46')](handleError(_0x1d0f43,null));};exports['create']=function(_0x42915a,_0x36ad82){return db[_0xf4f6('0x2d')][_0xf4f6('0x4a')](_0x42915a['body'],{})[_0xf4f6('0x25')](respondWithResult(_0x36ad82,0xc9))['catch'](handleError(_0x36ad82,null));};exports[_0xf4f6('0x24')]=function(_0x1c7fb2,_0x23124a){if(_0x1c7fb2['body']['id']){delete _0x1c7fb2['body']['id'];}return db[_0xf4f6('0x2d')][_0xf4f6('0x49')]({'where':{'id':_0x1c7fb2['params']['id']}})[_0xf4f6('0x25')](handleEntityNotFound(_0x23124a,null))['then'](saveUpdates(_0x1c7fb2[_0xf4f6('0x4b')],null))[_0xf4f6('0x25')](respondWithResult(_0x23124a,null))[_0xf4f6('0x46')](handleError(_0x23124a,null));};exports[_0xf4f6('0x26')]=function(_0x195f3e,_0x37480f){return db[_0xf4f6('0x2d')][_0xf4f6('0x49')]({'where':{'id':_0x195f3e[_0xf4f6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37480f,null))[_0xf4f6('0x25')](removeEntity(_0x37480f,null))[_0xf4f6('0x46')](handleError(_0x37480f,null));};exports['describe']=function(_0x4fb5b9,_0x12aa7b){return db[_0xf4f6('0x2d')]['describe']()['then'](respondWithResult(_0x12aa7b,null))['catch'](handleError(_0x12aa7b,null));}; \ No newline at end of file +var _0xbe99=['findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x1864dd,_0x2407ec){var _0x5a7609=function(_0x1d75ce){while(--_0x1d75ce){_0x1864dd['push'](_0x1864dd['shift']());}};_0x5a7609(++_0x2407ec);}(_0xbe99,0x196));var _0x9be9=function(_0x3572b3,_0x593ffe){_0x3572b3=_0x3572b3-0x0;var _0x55e4aa=_0xbe99[_0x3572b3];return _0x55e4aa;};'use strict';var emlformat=require(_0x9be9('0x0'));var rimraf=require(_0x9be9('0x1'));var zipdir=require(_0x9be9('0x2'));var jsonpatch=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var moment=require('moment');var BPromise=require(_0x9be9('0x5'));var Mustache=require('mustache');var util=require(_0x9be9('0x6'));var path=require(_0x9be9('0x7'));var sox=require(_0x9be9('0x8'));var csv=require(_0x9be9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be9('0xa'));var _=require(_0x9be9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9be9('0xc'));var deskjs=require(_0x9be9('0xd'));var toCsv=require(_0x9be9('0x9'));var querystring=require(_0x9be9('0xe'));var Papa=require(_0x9be9('0xf'));var Redis=require(_0x9be9('0x10'));var authService=require(_0x9be9('0x11'));var qs=require(_0x9be9('0x12'));var as=require(_0x9be9('0x13'));var hardwareService=require(_0x9be9('0x14'));var logger=require(_0x9be9('0x15'))(_0x9be9('0x16'));var utils=require(_0x9be9('0x17'));var config=require(_0x9be9('0x18'));var licenseUtil=require(_0x9be9('0x19'));var db=require(_0x9be9('0x1a'))['db'];function respondWithStatusCode(_0x33c2cd,_0x4b6d99){_0x4b6d99=_0x4b6d99||0xcc;return function(_0x1251e4){if(_0x1251e4){return _0x33c2cd[_0x9be9('0x1b')](_0x4b6d99);}return _0x33c2cd[_0x9be9('0x1c')](_0x4b6d99)[_0x9be9('0x1d')]();};}function respondWithResult(_0x2cc374,_0x50a7fb){_0x50a7fb=_0x50a7fb||0xc8;return function(_0x2798bd){if(_0x2798bd){return _0x2cc374[_0x9be9('0x1c')](_0x50a7fb)[_0x9be9('0x1e')](_0x2798bd);}};}function respondWithFilteredResult(_0x5a8a3d,_0x2d3e45){return function(_0x418c1e){if(_0x418c1e){var _0x3c92cc=typeof _0x2d3e45[_0x9be9('0x1f')]===_0x9be9('0x20')&&typeof _0x2d3e45['limit']===_0x9be9('0x20');var _0x1cbff7=_0x418c1e[_0x9be9('0x21')];var _0x5f2612=_0x3c92cc?0x0:_0x2d3e45['offset'];var _0x9a37a0=_0x3c92cc?_0x418c1e[_0x9be9('0x21')]:_0x2d3e45[_0x9be9('0x1f')]+_0x2d3e45['limit'];var _0x5aeca2;if(_0x9a37a0>=_0x1cbff7){_0x9a37a0=_0x1cbff7;_0x5aeca2=0xc8;}else{_0x5aeca2=0xce;}_0x5a8a3d[_0x9be9('0x1c')](_0x5aeca2);return _0x5a8a3d[_0x9be9('0x22')](_0x9be9('0x23'),_0x5f2612+'-'+_0x9a37a0+'/'+_0x1cbff7)[_0x9be9('0x1e')](_0x418c1e);}return null;};}function patchUpdates(_0x1b041b){return function(_0x3761c7){try{jsonpatch[_0x9be9('0x24')](_0x3761c7,_0x1b041b,!![]);}catch(_0x2c1f2f){return BPromise[_0x9be9('0x25')](_0x2c1f2f);}return _0x3761c7[_0x9be9('0x26')]();};}function saveUpdates(_0xd700ff,_0x100637){return function(_0x599429){if(_0x599429){return _0x599429[_0x9be9('0x27')](_0xd700ff)['then'](function(_0x2d543d){return _0x2d543d;});}return null;};}function removeEntity(_0xf87e6d,_0x451e60){return function(_0x3fe959){if(_0x3fe959){return _0x3fe959['destroy']()[_0x9be9('0x28')](function(){_0xf87e6d[_0x9be9('0x1c')](0xcc)[_0x9be9('0x1d')]();});}};}function handleEntityNotFound(_0x42a486,_0x60f1ad){return function(_0x13d557){if(!_0x13d557){_0x42a486[_0x9be9('0x1b')](0x194);}return _0x13d557;};}function handleError(_0x28688c,_0x292581){_0x292581=_0x292581||0x1f4;return function(_0x27be52){logger['error'](_0x27be52[_0x9be9('0x29')]);if(_0x27be52[_0x9be9('0x2a')]){delete _0x27be52[_0x9be9('0x2a')];}_0x28688c[_0x9be9('0x1c')](_0x292581)[_0x9be9('0x2b')](_0x27be52);};}exports['index']=function(_0x22c898,_0x45e200){var _0x49ed5d={},_0x199623={},_0x49e398={'count':0x0,'rows':[]};var _0x3bdcb7=_[_0x9be9('0x2c')](db[_0x9be9('0x2d')][_0x9be9('0x2e')],function(_0x5a527a){return{'name':_0x5a527a[_0x9be9('0x2f')],'type':_0x5a527a[_0x9be9('0x30')][_0x9be9('0x31')]};});_0x199623[_0x9be9('0x32')]=_[_0x9be9('0x2c')](_0x3bdcb7,_0x9be9('0x2a'));_0x199623[_0x9be9('0x33')]=_[_0x9be9('0x34')](_0x22c898['query']);_0x199623['filters']=_[_0x9be9('0x35')](_0x199623['model'],_0x199623[_0x9be9('0x33')]);_0x49ed5d[_0x9be9('0x36')]=_[_0x9be9('0x35')](_0x199623[_0x9be9('0x32')],qs['fields'](_0x22c898[_0x9be9('0x33')][_0x9be9('0x37')]));_0x49ed5d[_0x9be9('0x36')]=_0x49ed5d[_0x9be9('0x36')][_0x9be9('0x38')]?_0x49ed5d['attributes']:_0x199623[_0x9be9('0x32')];if(!_0x22c898['query']['hasOwnProperty']('nolimit')){_0x49ed5d['limit']=qs[_0x9be9('0x39')](_0x22c898[_0x9be9('0x33')]['limit']);_0x49ed5d[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x22c898[_0x9be9('0x33')][_0x9be9('0x1f')]);}_0x49ed5d[_0x9be9('0x3a')]=qs['sort'](_0x22c898[_0x9be9('0x33')][_0x9be9('0x3b')]);_0x49ed5d[_0x9be9('0x3c')]=qs[_0x9be9('0x3d')](_[_0x9be9('0x3e')](_0x22c898[_0x9be9('0x33')],_0x199623[_0x9be9('0x3d')]),_0x3bdcb7);if(_0x22c898[_0x9be9('0x33')][_0x9be9('0x3f')]){_0x49ed5d[_0x9be9('0x3c')]=_[_0x9be9('0x40')](_0x49ed5d[_0x9be9('0x3c')],{'$or':_[_0x9be9('0x2c')](_0x3bdcb7,function(_0x3d117b){if(_0x3d117b[_0x9be9('0x30')]!==_0x9be9('0x41')){var _0x2d657d={};_0x2d657d[_0x3d117b[_0x9be9('0x2a')]]={'$like':'%'+_0x22c898[_0x9be9('0x33')][_0x9be9('0x3f')]+'%'};return _0x2d657d;}})});}_0x49ed5d=_[_0x9be9('0x40')]({},_0x49ed5d,_0x22c898[_0x9be9('0x42')]);var _0x24cc6c={'where':_0x49ed5d[_0x9be9('0x3c')]};return db['FaxQueueReport'][_0x9be9('0x21')](_0x24cc6c)[_0x9be9('0x28')](function(_0x885c95){_0x49e398[_0x9be9('0x21')]=_0x885c95;if(_0x22c898[_0x9be9('0x33')]['includeAll']){_0x49ed5d[_0x9be9('0x43')]=[{'all':!![]}];}return db[_0x9be9('0x2d')][_0x9be9('0x44')](_0x49ed5d);})[_0x9be9('0x28')](function(_0x1f7775){_0x49e398[_0x9be9('0x45')]=_0x1f7775;return _0x49e398;})[_0x9be9('0x28')](respondWithFilteredResult(_0x45e200,_0x49ed5d))[_0x9be9('0x46')](handleError(_0x45e200,null));};exports[_0x9be9('0x47')]=function(_0x486fd9,_0x585809){var _0x3ca323={'raw':!![],'where':{'id':_0x486fd9['params']['id']}},_0x56bf39={};_0x56bf39[_0x9be9('0x32')]=_[_0x9be9('0x34')](db[_0x9be9('0x2d')]['rawAttributes']);_0x56bf39['query']=_[_0x9be9('0x34')](_0x486fd9['query']);_0x56bf39[_0x9be9('0x3d')]=_[_0x9be9('0x35')](_0x56bf39['model'],_0x56bf39[_0x9be9('0x33')]);_0x3ca323[_0x9be9('0x36')]=_[_0x9be9('0x35')](_0x56bf39[_0x9be9('0x32')],qs[_0x9be9('0x37')](_0x486fd9['query'][_0x9be9('0x37')]));_0x3ca323[_0x9be9('0x36')]=_0x3ca323[_0x9be9('0x36')]['length']?_0x3ca323[_0x9be9('0x36')]:_0x56bf39['model'];if(_0x486fd9[_0x9be9('0x33')][_0x9be9('0x48')]){_0x3ca323[_0x9be9('0x43')]=[{'all':!![]}];}_0x3ca323=_[_0x9be9('0x40')]({},_0x3ca323,_0x486fd9['options']);return db['FaxQueueReport'][_0x9be9('0x49')](_0x3ca323)[_0x9be9('0x28')](handleEntityNotFound(_0x585809,null))['then'](respondWithResult(_0x585809,null))[_0x9be9('0x46')](handleError(_0x585809,null));};exports[_0x9be9('0x4a')]=function(_0x2b1a9a,_0x7d0656){return db[_0x9be9('0x2d')][_0x9be9('0x4a')](_0x2b1a9a[_0x9be9('0x4b')],{})[_0x9be9('0x28')](respondWithResult(_0x7d0656,0xc9))[_0x9be9('0x46')](handleError(_0x7d0656,null));};exports[_0x9be9('0x27')]=function(_0x1385ac,_0x31faa8){if(_0x1385ac['body']['id']){delete _0x1385ac[_0x9be9('0x4b')]['id'];}return db[_0x9be9('0x2d')][_0x9be9('0x49')]({'where':{'id':_0x1385ac[_0x9be9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31faa8,null))['then'](saveUpdates(_0x1385ac[_0x9be9('0x4b')],null))[_0x9be9('0x28')](respondWithResult(_0x31faa8,null))[_0x9be9('0x46')](handleError(_0x31faa8,null));};exports[_0x9be9('0x4d')]=function(_0x18450a,_0x5840fc){return db[_0x9be9('0x2d')][_0x9be9('0x49')]({'where':{'id':_0x18450a['params']['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x5840fc,null))[_0x9be9('0x28')](removeEntity(_0x5840fc,null))['catch'](handleError(_0x5840fc,null));};exports[_0x9be9('0x4e')]=function(_0x3ab27b,_0x1ccb41){return db[_0x9be9('0x2d')]['describe']()[_0x9be9('0x28')](respondWithResult(_0x1ccb41,null))[_0x9be9('0x46')](handleError(_0x1ccb41,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 57992d8..c642fbb 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x4beeb3,_0x241641){var _0x11fec9=function(_0x20a191){while(--_0x20a191){_0x4beeb3['push'](_0x4beeb3['shift']());}};_0x11fec9(++_0x241641);}(_0x1261,0x144));var _0x1126=function(_0x561049,_0x330926){_0x561049=_0x561049-0x0;var _0x52f109=_0x1261[_0x561049];return _0x52f109;};'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')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x814b,0x1a2));var _0xb814=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x814b[_0x3dbd6d];return _0x1216f1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e1e0cb4..d06bc2d 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 _0x658f=['stringify','error','message','result','FaxQueueReport','create','options','raw','CreateFaxQueueReport','catch','update','body','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3e981e,_0x547eab){var _0x342825=function(_0x41c6f1){while(--_0x41c6f1){_0x3e981e['push'](_0x3e981e['shift']());}};_0x342825(++_0x547eab);}(_0x658f,0x1de));var _0xf658=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x658f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf658('0x0'));var util=require(_0xf658('0x1'));var moment=require(_0xf658('0x2'));var BPromise=require(_0xf658('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf658('0x4'));var db=require(_0xf658('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf658('0x6'))('rpc');var config=require(_0xf658('0x7'));var jayson=require(_0xf658('0x8'));var client=jayson['client'][_0xf658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a625,_0x34aa3b,_0x3036cf){return new BPromise(function(_0x3b517a,_0x447031){return client[_0xf658('0xa')](_0x32a625,_0x3036cf)[_0xf658('0xb')](function(_0x2d1d73){logger[_0xf658('0xc')](_0xf658('0xd'),_0x34aa3b,_0xf658('0xe'));logger[_0xf658('0xf')](_0xf658('0x10'),_0x34aa3b,_0xf658('0xe'),JSON[_0xf658('0x11')](_0x2d1d73));if(_0x2d1d73[_0xf658('0x12')]){if(_0x2d1d73['error']['code']===0x1f4){logger['error'](_0xf658('0xd'),_0x34aa3b,_0x2d1d73[_0xf658('0x12')][_0xf658('0x13')]);return _0x447031(_0x2d1d73[_0xf658('0x12')][_0xf658('0x13')]);}logger[_0xf658('0x12')](_0xf658('0xd'),_0x34aa3b,_0x2d1d73[_0xf658('0x12')][_0xf658('0x13')]);return _0x3b517a(_0x2d1d73[_0xf658('0x12')][_0xf658('0x13')]);}else{logger[_0xf658('0xc')](_0xf658('0xd'),_0x34aa3b,_0xf658('0xe'));_0x3b517a(_0x2d1d73[_0xf658('0x14')][_0xf658('0x13')]);}})['catch'](function(_0x44b876){logger[_0xf658('0x12')](_0xf658('0xd'),_0x34aa3b,_0x44b876);_0x447031(_0x44b876);});});}exports['CreateFaxQueueReport']=function(_0x47d5ea){var _0x183eab=this;return new Promise(function(_0x1ae913,_0x278df3){return db[_0xf658('0x15')][_0xf658('0x16')](_0x47d5ea['body'],{'raw':_0x47d5ea[_0xf658('0x17')]?_0x47d5ea[_0xf658('0x17')][_0xf658('0x18')]===undefined?!![]:![]:!![]})[_0xf658('0xb')](function(_0x271401){logger[_0xf658('0xc')](_0xf658('0x19'),_0x47d5ea);logger[_0xf658('0xf')]('CreateFaxQueueReport',_0x47d5ea,JSON['stringify'](_0x271401));_0x1ae913(_0x271401);})[_0xf658('0x1a')](function(_0x4368bb){logger['error'](_0xf658('0x19'),_0x4368bb[_0xf658('0x13')],_0x47d5ea);_0x278df3(_0x183eab['error'](0x1f4,_0x4368bb[_0xf658('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x1ca9ec){var _0x17b15e=this;return new Promise(function(_0x1925e7,_0x5193c3){return db['FaxQueueReport'][_0xf658('0x1b')](_0x1ca9ec[_0xf658('0x1c')],{'raw':_0x1ca9ec[_0xf658('0x17')]?_0x1ca9ec[_0xf658('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ca9ec['options']?_0x1ca9ec[_0xf658('0x17')][_0xf658('0x1d')]||null:null,'attributes':_0x1ca9ec['options']?_0x1ca9ec['options'][_0xf658('0x1e')]||null:null,'limit':_0x1ca9ec[_0xf658('0x17')]?_0x1ca9ec[_0xf658('0x17')][_0xf658('0x1f')]||null:null})[_0xf658('0xb')](function(_0x371f52){logger[_0xf658('0xc')](_0xf658('0x20'),_0x1ca9ec);logger['debug'](_0xf658('0x20'),_0x1ca9ec,JSON[_0xf658('0x11')](_0x371f52));_0x1925e7(_0x371f52);})[_0xf658('0x1a')](function(_0x4c26a9){logger[_0xf658('0x12')]('UpdateFaxQueueReport',_0x4c26a9[_0xf658('0x13')],_0x1ca9ec);_0x5193c3(_0x17b15e[_0xf658('0x12')](0x1f4,_0x4c26a9['message']));});});}; \ No newline at end of file +var _0x8ffc=['body','options','then','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create'];(function(_0x4b35d3,_0x5dbcdf){var _0x3d2f4b=function(_0x5810aa){while(--_0x5810aa){_0x4b35d3['push'](_0x4b35d3['shift']());}};_0x3d2f4b(++_0x5dbcdf);}(_0x8ffc,0x1b6));var _0xc8ff=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x8ffc[_0x460150];return _0x340677;};'use strict';var _=require(_0xc8ff('0x0'));var util=require(_0xc8ff('0x1'));var moment=require(_0xc8ff('0x2'));var BPromise=require(_0xc8ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8ff('0x4'));var db=require(_0xc8ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8ff('0x6'))(_0xc8ff('0x7'));var config=require(_0xc8ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc8ff('0x9')][_0xc8ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b76e1,_0x28c202,_0x2033bd){return new BPromise(function(_0x29171a,_0x1a4335){return client[_0xc8ff('0xb')](_0x2b76e1,_0x2033bd)['then'](function(_0xa8d830){logger[_0xc8ff('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x28c202,_0xc8ff('0xd'));logger[_0xc8ff('0xe')](_0xc8ff('0xf'),_0x28c202,_0xc8ff('0xd'),JSON[_0xc8ff('0x10')](_0xa8d830));if(_0xa8d830[_0xc8ff('0x11')]){if(_0xa8d830[_0xc8ff('0x11')]['code']===0x1f4){logger[_0xc8ff('0x11')](_0xc8ff('0x12'),_0x28c202,_0xa8d830[_0xc8ff('0x11')][_0xc8ff('0x13')]);return _0x1a4335(_0xa8d830[_0xc8ff('0x11')]['message']);}logger['error'](_0xc8ff('0x12'),_0x28c202,_0xa8d830[_0xc8ff('0x11')][_0xc8ff('0x13')]);return _0x29171a(_0xa8d830[_0xc8ff('0x11')][_0xc8ff('0x13')]);}else{logger[_0xc8ff('0xc')](_0xc8ff('0x12'),_0x28c202,_0xc8ff('0xd'));_0x29171a(_0xa8d830[_0xc8ff('0x14')][_0xc8ff('0x13')]);}})[_0xc8ff('0x15')](function(_0x19b2bf){logger['error'](_0xc8ff('0x12'),_0x28c202,_0x19b2bf);_0x1a4335(_0x19b2bf);});});}exports[_0xc8ff('0x16')]=function(_0xc895b1){var _0x1882af=this;return new Promise(function(_0x863460,_0x48858c){return db['FaxQueueReport'][_0xc8ff('0x17')](_0xc895b1[_0xc8ff('0x18')],{'raw':_0xc895b1[_0xc8ff('0x19')]?_0xc895b1[_0xc8ff('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xc8ff('0x1a')](function(_0x52fe04){logger['info']('CreateFaxQueueReport',_0xc895b1);logger[_0xc8ff('0xe')](_0xc8ff('0x16'),_0xc895b1,JSON['stringify'](_0x52fe04));_0x863460(_0x52fe04);})[_0xc8ff('0x15')](function(_0x525b9d){logger['error'](_0xc8ff('0x16'),_0x525b9d[_0xc8ff('0x13')],_0xc895b1);_0x48858c(_0x1882af['error'](0x1f4,_0x525b9d[_0xc8ff('0x13')]));});});};exports[_0xc8ff('0x1b')]=function(_0x3e3e15){var _0x5dcf94=this;return new Promise(function(_0x2b08cb,_0x18b7e6){return db[_0xc8ff('0x1c')][_0xc8ff('0x1d')](_0x3e3e15[_0xc8ff('0x18')],{'raw':_0x3e3e15[_0xc8ff('0x19')]?_0x3e3e15[_0xc8ff('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e3e15[_0xc8ff('0x19')]?_0x3e3e15[_0xc8ff('0x19')][_0xc8ff('0x1e')]||null:null,'attributes':_0x3e3e15['options']?_0x3e3e15[_0xc8ff('0x19')][_0xc8ff('0x1f')]||null:null,'limit':_0x3e3e15[_0xc8ff('0x19')]?_0x3e3e15[_0xc8ff('0x19')][_0xc8ff('0x20')]||null:null})[_0xc8ff('0x1a')](function(_0x1d0db4){logger['info'](_0xc8ff('0x1b'),_0x3e3e15);logger[_0xc8ff('0xe')](_0xc8ff('0x1b'),_0x3e3e15,JSON[_0xc8ff('0x10')](_0x1d0db4));_0x2b08cb(_0x1d0db4);})[_0xc8ff('0x15')](function(_0x28c062){logger[_0xc8ff('0x11')]('UpdateFaxQueueReport',_0x28c062[_0xc8ff('0x13')],_0x3e3e15);_0x18b7e6(_0x5dcf94[_0xc8ff('0x11')](0x1f4,_0x28c062['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e99bc0b..7fbc0d9 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 _0xd2f4=['./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','/:id','update','destroy','multer','util','connect-timeout','express','Router'];(function(_0x1563b4,_0x388d31){var _0x4ec558=function(_0x485923){while(--_0x485923){_0x1563b4['push'](_0x1563b4['shift']());}};_0x4ec558(++_0x388d31);}(_0xd2f4,0x10b));var _0x4d2f=function(_0x22ff64,_0x5bd6a3){_0x22ff64=_0x22ff64-0x0;var _0x5496bf=_0xd2f4[_0x22ff64];return _0x5496bf;};'use strict';var multer=require(_0x4d2f('0x0'));var util=require(_0x4d2f('0x1'));var path=require('path');var timeout=require(_0x4d2f('0x2'));var express=require(_0x4d2f('0x3'));var router=express[_0x4d2f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d2f('0x5'));router[_0x4d2f('0x6')]('/',auth['isAuthenticated'](),controller[_0x4d2f('0x7')]);router[_0x4d2f('0x6')](_0x4d2f('0x8'),auth[_0x4d2f('0x9')](),controller[_0x4d2f('0xa')]);router[_0x4d2f('0x6')]('/:id',auth[_0x4d2f('0x9')](),controller[_0x4d2f('0xb')]);router[_0x4d2f('0xc')]('/',auth[_0x4d2f('0x9')](),controller[_0x4d2f('0xd')]);router['put'](_0x4d2f('0xe'),auth[_0x4d2f('0x9')](),controller[_0x4d2f('0xf')]);router['delete']('/:id',auth[_0x4d2f('0x9')](),controller[_0x4d2f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1743=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','index','isAuthenticated','describe','post','put','/:id','update','delete'];(function(_0x583f0c,_0x40f6ec){var _0x5e8d68=function(_0x4cea4b){while(--_0x4cea4b){_0x583f0c['push'](_0x583f0c['shift']());}};_0x5e8d68(++_0x40f6ec);}(_0x1743,0x1ef));var _0x3174=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1743[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3174('0x0'));var util=require(_0x3174('0x1'));var path=require(_0x3174('0x2'));var timeout=require(_0x3174('0x3'));var express=require(_0x3174('0x4'));var router=express['Router']();var fs_extra=require(_0x3174('0x5'));var auth=require(_0x3174('0x6'));var interaction=require(_0x3174('0x7'));var config=require('../../config/environment');var controller=require(_0x3174('0x8'));router[_0x3174('0x9')]('/',auth['isAuthenticated'](),controller[_0x3174('0xa')]);router[_0x3174('0x9')]('/describe',auth[_0x3174('0xb')](),controller[_0x3174('0xc')]);router['get']('/:id',auth[_0x3174('0xb')](),controller['show']);router[_0x3174('0xd')]('/',auth[_0x3174('0xb')](),controller['create']);router[_0x3174('0xe')](_0x3174('0xf'),auth['isAuthenticated'](),controller[_0x3174('0x10')]);router[_0x3174('0x11')](_0x3174('0xf'),auth[_0x3174('0xb')](),controller[_0x3174('0x12')]);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 611732d..d2c25bc 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x327561,_0x246598){var _0x1e7622=function(_0x1445cd){while(--_0x1445cd){_0x327561['push'](_0x327561['shift']());}};_0x1e7622(++_0x246598);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xcb91[_0x166e96];return _0x553d73;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5f5136,_0x2a2551){var _0xb7c073=function(_0x127223){while(--_0x127223){_0x5f5136['push'](_0x5f5136['shift']());}};_0xb7c073(++_0x2a2551);}(_0xf4eb,0xec));var _0xbf4e=function(_0x395f45,_0x5042fe){_0x395f45=_0x395f45-0x0;var _0x2a123c=_0xf4eb[_0x395f45];return _0x2a123c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 0e4b7ae..2211484 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 _0x717b=['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','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','FaxTransferReport','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','jsforce'];(function(_0x83531b,_0x5daca6){var _0x3696f2=function(_0x368b38){while(--_0x368b38){_0x83531b['push'](_0x83531b['shift']());}};_0x3696f2(++_0x5daca6);}(_0x717b,0x1be));var _0xb717=function(_0x1cdf4c,_0x38a3e9){_0x1cdf4c=_0x1cdf4c-0x0;var _0x314c84=_0x717b[_0x1cdf4c];return _0x314c84;};'use strict';var emlformat=require(_0xb717('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb717('0x1'));var rp=require(_0xb717('0x2'));var moment=require('moment');var BPromise=require(_0xb717('0x3'));var Mustache=require('mustache');var util=require(_0xb717('0x4'));var path=require(_0xb717('0x5'));var sox=require(_0xb717('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb717('0x7'));var squel=require(_0xb717('0x8'));var crypto=require('crypto');var jsforce=require(_0xb717('0x9'));var deskjs=require(_0xb717('0xa'));var toCsv=require(_0xb717('0xb'));var querystring=require(_0xb717('0xc'));var Papa=require(_0xb717('0xd'));var Redis=require(_0xb717('0xe'));var authService=require(_0xb717('0xf'));var qs=require(_0xb717('0x10'));var as=require(_0xb717('0x11'));var hardwareService=require(_0xb717('0x12'));var logger=require('../../config/logger')(_0xb717('0x13'));var utils=require(_0xb717('0x14'));var config=require(_0xb717('0x15'));var licenseUtil=require(_0xb717('0x16'));var db=require(_0xb717('0x17'))['db'];function respondWithStatusCode(_0x829d50,_0x200854){_0x200854=_0x200854||0xcc;return function(_0x22d099){if(_0x22d099){return _0x829d50['sendStatus'](_0x200854);}return _0x829d50[_0xb717('0x18')](_0x200854)[_0xb717('0x19')]();};}function respondWithResult(_0x15cbb7,_0x4b2d60){_0x4b2d60=_0x4b2d60||0xc8;return function(_0x2815fd){if(_0x2815fd){return _0x15cbb7[_0xb717('0x18')](_0x4b2d60)[_0xb717('0x1a')](_0x2815fd);}};}function respondWithFilteredResult(_0x1043ec,_0xb2bbce){return function(_0x3b5af0){if(_0x3b5af0){var _0x591f56=typeof _0xb2bbce[_0xb717('0x1b')]==='undefined'&&typeof _0xb2bbce[_0xb717('0x1c')]===_0xb717('0x1d');var _0x5eb76b=_0x3b5af0['count'];var _0x21fd5a=_0x591f56?0x0:_0xb2bbce[_0xb717('0x1b')];var _0x4124de=_0x591f56?_0x3b5af0[_0xb717('0x1e')]:_0xb2bbce[_0xb717('0x1b')]+_0xb2bbce[_0xb717('0x1c')];var _0x3e33f4;if(_0x4124de>=_0x5eb76b){_0x4124de=_0x5eb76b;_0x3e33f4=0xc8;}else{_0x3e33f4=0xce;}_0x1043ec['status'](_0x3e33f4);return _0x1043ec[_0xb717('0x1f')](_0xb717('0x20'),_0x21fd5a+'-'+_0x4124de+'/'+_0x5eb76b)['json'](_0x3b5af0);}return null;};}function patchUpdates(_0x1e2674){return function(_0x150bdf){try{jsonpatch['apply'](_0x150bdf,_0x1e2674,!![]);}catch(_0xe0a6bb){return BPromise[_0xb717('0x21')](_0xe0a6bb);}return _0x150bdf[_0xb717('0x22')]();};}function saveUpdates(_0x460e8b,_0x435357){return function(_0xb55eee){if(_0xb55eee){return _0xb55eee[_0xb717('0x23')](_0x460e8b)[_0xb717('0x24')](function(_0x4372bf){return _0x4372bf;});}return null;};}function removeEntity(_0xf2d156,_0x3b61ae){return function(_0xe159e9){if(_0xe159e9){return _0xe159e9['destroy']()[_0xb717('0x24')](function(){_0xf2d156[_0xb717('0x18')](0xcc)[_0xb717('0x19')]();});}};}function handleEntityNotFound(_0x5c8b80,_0x5dfdb9){return function(_0x1243b1){if(!_0x1243b1){_0x5c8b80[_0xb717('0x25')](0x194);}return _0x1243b1;};}function handleError(_0x37101b,_0x3b2b5c){_0x3b2b5c=_0x3b2b5c||0x1f4;return function(_0xbe9cd3){logger[_0xb717('0x26')](_0xbe9cd3[_0xb717('0x27')]);if(_0xbe9cd3[_0xb717('0x28')]){delete _0xbe9cd3[_0xb717('0x28')];}_0x37101b[_0xb717('0x18')](_0x3b2b5c)[_0xb717('0x29')](_0xbe9cd3);};}exports[_0xb717('0x2a')]=function(_0xf6206d,_0x68b730){var _0x143bd9={},_0x1211e4={},_0x2fc69f={'count':0x0,'rows':[]};var _0x314914=_[_0xb717('0x2b')](db['FaxTransferReport'][_0xb717('0x2c')],function(_0x1bf6f2){return{'name':_0x1bf6f2[_0xb717('0x2d')],'type':_0x1bf6f2[_0xb717('0x2e')][_0xb717('0x2f')]};});_0x1211e4[_0xb717('0x30')]=_['map'](_0x314914,_0xb717('0x28'));_0x1211e4[_0xb717('0x31')]=_[_0xb717('0x32')](_0xf6206d[_0xb717('0x31')]);_0x1211e4[_0xb717('0x33')]=_[_0xb717('0x34')](_0x1211e4[_0xb717('0x30')],_0x1211e4['query']);_0x143bd9[_0xb717('0x35')]=_[_0xb717('0x34')](_0x1211e4[_0xb717('0x30')],qs['fields'](_0xf6206d[_0xb717('0x31')][_0xb717('0x36')]));_0x143bd9[_0xb717('0x35')]=_0x143bd9[_0xb717('0x35')]['length']?_0x143bd9['attributes']:_0x1211e4[_0xb717('0x30')];if(!_0xf6206d[_0xb717('0x31')]['hasOwnProperty'](_0xb717('0x37'))){_0x143bd9['limit']=qs['limit'](_0xf6206d[_0xb717('0x31')]['limit']);_0x143bd9['offset']=qs[_0xb717('0x1b')](_0xf6206d[_0xb717('0x31')]['offset']);}_0x143bd9['order']=qs[_0xb717('0x38')](_0xf6206d['query']['sort']);_0x143bd9['where']=qs[_0xb717('0x33')](_[_0xb717('0x39')](_0xf6206d[_0xb717('0x31')],_0x1211e4['filters']),_0x314914);if(_0xf6206d[_0xb717('0x31')][_0xb717('0x3a')]){_0x143bd9[_0xb717('0x3b')]=_[_0xb717('0x3c')](_0x143bd9[_0xb717('0x3b')],{'$or':_[_0xb717('0x2b')](_0x314914,function(_0x15e6e3){if(_0x15e6e3[_0xb717('0x2e')]!==_0xb717('0x3d')){var _0x4a2c88={};_0x4a2c88[_0x15e6e3[_0xb717('0x28')]]={'$like':'%'+_0xf6206d[_0xb717('0x31')][_0xb717('0x3a')]+'%'};return _0x4a2c88;}})});}_0x143bd9=_[_0xb717('0x3c')]({},_0x143bd9,_0xf6206d['options']);var _0x1503ea={'where':_0x143bd9['where']};return db[_0xb717('0x3e')]['count'](_0x1503ea)[_0xb717('0x24')](function(_0x451da6){_0x2fc69f[_0xb717('0x1e')]=_0x451da6;if(_0xf6206d[_0xb717('0x31')]['includeAll']){_0x143bd9[_0xb717('0x3f')]=[{'all':!![]}];}return db[_0xb717('0x3e')][_0xb717('0x40')](_0x143bd9);})[_0xb717('0x24')](function(_0x13b00d){_0x2fc69f[_0xb717('0x41')]=_0x13b00d;return _0x2fc69f;})[_0xb717('0x24')](respondWithFilteredResult(_0x68b730,_0x143bd9))[_0xb717('0x42')](handleError(_0x68b730,null));};exports[_0xb717('0x43')]=function(_0x128d99,_0x1a9e16){var _0x49770d={'raw':!![],'where':{'id':_0x128d99[_0xb717('0x44')]['id']}},_0x37a0d6={};_0x37a0d6['model']=_[_0xb717('0x32')](db[_0xb717('0x3e')][_0xb717('0x2c')]);_0x37a0d6[_0xb717('0x31')]=_[_0xb717('0x32')](_0x128d99[_0xb717('0x31')]);_0x37a0d6[_0xb717('0x33')]=_[_0xb717('0x34')](_0x37a0d6[_0xb717('0x30')],_0x37a0d6[_0xb717('0x31')]);_0x49770d[_0xb717('0x35')]=_[_0xb717('0x34')](_0x37a0d6[_0xb717('0x30')],qs[_0xb717('0x36')](_0x128d99['query']['fields']));_0x49770d[_0xb717('0x35')]=_0x49770d['attributes'][_0xb717('0x45')]?_0x49770d['attributes']:_0x37a0d6[_0xb717('0x30')];if(_0x128d99['query']['includeAll']){_0x49770d['include']=[{'all':!![]}];}_0x49770d=_['merge']({},_0x49770d,_0x128d99[_0xb717('0x46')]);return db[_0xb717('0x3e')][_0xb717('0x47')](_0x49770d)[_0xb717('0x24')](handleEntityNotFound(_0x1a9e16,null))[_0xb717('0x24')](respondWithResult(_0x1a9e16,null))[_0xb717('0x42')](handleError(_0x1a9e16,null));};exports['create']=function(_0x45e50a,_0x57305b){return db[_0xb717('0x3e')][_0xb717('0x48')](_0x45e50a[_0xb717('0x49')],{})[_0xb717('0x24')](respondWithResult(_0x57305b,0xc9))[_0xb717('0x42')](handleError(_0x57305b,null));};exports[_0xb717('0x23')]=function(_0x58e38f,_0x304795){if(_0x58e38f[_0xb717('0x49')]['id']){delete _0x58e38f[_0xb717('0x49')]['id'];}return db[_0xb717('0x3e')][_0xb717('0x47')]({'where':{'id':_0x58e38f[_0xb717('0x44')]['id']}})[_0xb717('0x24')](handleEntityNotFound(_0x304795,null))['then'](saveUpdates(_0x58e38f[_0xb717('0x49')],null))[_0xb717('0x24')](respondWithResult(_0x304795,null))[_0xb717('0x42')](handleError(_0x304795,null));};exports[_0xb717('0x4a')]=function(_0x1bddde,_0x5adc2f){return db[_0xb717('0x3e')][_0xb717('0x47')]({'where':{'id':_0x1bddde[_0xb717('0x44')]['id']}})[_0xb717('0x24')](handleEntityNotFound(_0x5adc2f,null))[_0xb717('0x24')](removeEntity(_0x5adc2f,null))[_0xb717('0x42')](handleError(_0x5adc2f,null));};exports[_0xb717('0x4b')]=function(_0x31ea97,_0x2b25c4){return db[_0xb717('0x3e')][_0xb717('0x4b')]()[_0xb717('0x24')](respondWithResult(_0x2b25c4,null))[_0xb717('0x42')](handleError(_0x2b25c4,null));}; \ No newline at end of file +var _0x127a=['model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','then','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','end','error','stack','name','send','FaxTransferReport','fieldName','type','key'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x127a,0x13c));var _0xa127=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x127a[_0x39c734];return _0xb2a2f9;};'use strict';var emlformat=require(_0xa127('0x0'));var rimraf=require(_0xa127('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa127('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa127('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa127('0x4'));var sox=require(_0xa127('0x5'));var csv=require(_0xa127('0x6'));var ejs=require(_0xa127('0x7'));var fs=require('fs');var fs_extra=require(_0xa127('0x8'));var _=require('lodash');var squel=require(_0xa127('0x9'));var crypto=require(_0xa127('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa127('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa127('0xc'));var Papa=require(_0xa127('0xd'));var Redis=require(_0xa127('0xe'));var authService=require(_0xa127('0xf'));var qs=require(_0xa127('0x10'));var as=require(_0xa127('0x11'));var hardwareService=require(_0xa127('0x12'));var logger=require(_0xa127('0x13'))(_0xa127('0x14'));var utils=require(_0xa127('0x15'));var config=require(_0xa127('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c0b4,_0x70dbe4){_0x70dbe4=_0x70dbe4||0xcc;return function(_0xa7775b){if(_0xa7775b){return _0x30c0b4[_0xa127('0x17')](_0x70dbe4);}return _0x30c0b4[_0xa127('0x18')](_0x70dbe4)['end']();};}function respondWithResult(_0x56bd7d,_0x5aeadc){_0x5aeadc=_0x5aeadc||0xc8;return function(_0x521d35){if(_0x521d35){return _0x56bd7d[_0xa127('0x18')](_0x5aeadc)['json'](_0x521d35);}};}function respondWithFilteredResult(_0x24f93f,_0xf30f0e){return function(_0x1aea28){if(_0x1aea28){var _0x382cab=typeof _0xf30f0e[_0xa127('0x19')]===_0xa127('0x1a')&&typeof _0xf30f0e[_0xa127('0x1b')]===_0xa127('0x1a');var _0x37b9a3=_0x1aea28[_0xa127('0x1c')];var _0x29c45f=_0x382cab?0x0:_0xf30f0e['offset'];var _0x57cb27=_0x382cab?_0x1aea28['count']:_0xf30f0e[_0xa127('0x19')]+_0xf30f0e[_0xa127('0x1b')];var _0x2322ae;if(_0x57cb27>=_0x37b9a3){_0x57cb27=_0x37b9a3;_0x2322ae=0xc8;}else{_0x2322ae=0xce;}_0x24f93f[_0xa127('0x18')](_0x2322ae);return _0x24f93f['set'](_0xa127('0x1d'),_0x29c45f+'-'+_0x57cb27+'/'+_0x37b9a3)[_0xa127('0x1e')](_0x1aea28);}return null;};}function patchUpdates(_0x23f4b3){return function(_0x2e75e6){try{jsonpatch['apply'](_0x2e75e6,_0x23f4b3,!![]);}catch(_0x1f9e3d){return BPromise[_0xa127('0x1f')](_0x1f9e3d);}return _0x2e75e6[_0xa127('0x20')]();};}function saveUpdates(_0x5e87a0,_0x3cbcc3){return function(_0x5842dd){if(_0x5842dd){return _0x5842dd[_0xa127('0x21')](_0x5e87a0)['then'](function(_0x482178){return _0x482178;});}return null;};}function removeEntity(_0x1adadd,_0x42bb31){return function(_0x189dd8){if(_0x189dd8){return _0x189dd8[_0xa127('0x22')]()['then'](function(){_0x1adadd[_0xa127('0x18')](0xcc)[_0xa127('0x23')]();});}};}function handleEntityNotFound(_0x3e6986,_0x177467){return function(_0x1c6883){if(!_0x1c6883){_0x3e6986[_0xa127('0x17')](0x194);}return _0x1c6883;};}function handleError(_0x1de705,_0x48cf93){_0x48cf93=_0x48cf93||0x1f4;return function(_0x285b77){logger[_0xa127('0x24')](_0x285b77[_0xa127('0x25')]);if(_0x285b77['name']){delete _0x285b77[_0xa127('0x26')];}_0x1de705[_0xa127('0x18')](_0x48cf93)[_0xa127('0x27')](_0x285b77);};}exports['index']=function(_0x158e71,_0xdb9ed){var _0x2cd534={},_0x3b505c={},_0x397f24={'count':0x0,'rows':[]};var _0x107f44=_['map'](db[_0xa127('0x28')]['rawAttributes'],function(_0x24d9e2){return{'name':_0x24d9e2[_0xa127('0x29')],'type':_0x24d9e2[_0xa127('0x2a')][_0xa127('0x2b')]};});_0x3b505c[_0xa127('0x2c')]=_['map'](_0x107f44,'name');_0x3b505c['query']=_['keys'](_0x158e71[_0xa127('0x2d')]);_0x3b505c[_0xa127('0x2e')]=_['intersection'](_0x3b505c[_0xa127('0x2c')],_0x3b505c[_0xa127('0x2d')]);_0x2cd534['attributes']=_[_0xa127('0x2f')](_0x3b505c['model'],qs[_0xa127('0x30')](_0x158e71[_0xa127('0x2d')][_0xa127('0x30')]));_0x2cd534['attributes']=_0x2cd534['attributes'][_0xa127('0x31')]?_0x2cd534[_0xa127('0x32')]:_0x3b505c[_0xa127('0x2c')];if(!_0x158e71[_0xa127('0x2d')][_0xa127('0x33')](_0xa127('0x34'))){_0x2cd534[_0xa127('0x1b')]=qs[_0xa127('0x1b')](_0x158e71[_0xa127('0x2d')][_0xa127('0x1b')]);_0x2cd534[_0xa127('0x19')]=qs[_0xa127('0x19')](_0x158e71[_0xa127('0x2d')][_0xa127('0x19')]);}_0x2cd534['order']=qs[_0xa127('0x35')](_0x158e71[_0xa127('0x2d')]['sort']);_0x2cd534['where']=qs['filters'](_[_0xa127('0x36')](_0x158e71[_0xa127('0x2d')],_0x3b505c[_0xa127('0x2e')]),_0x107f44);if(_0x158e71[_0xa127('0x2d')][_0xa127('0x37')]){_0x2cd534[_0xa127('0x38')]=_[_0xa127('0x39')](_0x2cd534[_0xa127('0x38')],{'$or':_[_0xa127('0x3a')](_0x107f44,function(_0x5ce563){if(_0x5ce563['type']!==_0xa127('0x3b')){var _0x3991f1={};_0x3991f1[_0x5ce563[_0xa127('0x26')]]={'$like':'%'+_0x158e71[_0xa127('0x2d')][_0xa127('0x37')]+'%'};return _0x3991f1;}})});}_0x2cd534=_[_0xa127('0x39')]({},_0x2cd534,_0x158e71[_0xa127('0x3c')]);var _0x1ab2b8={'where':_0x2cd534[_0xa127('0x38')]};return db['FaxTransferReport'][_0xa127('0x1c')](_0x1ab2b8)[_0xa127('0x3d')](function(_0x3ebb30){_0x397f24[_0xa127('0x1c')]=_0x3ebb30;if(_0x158e71[_0xa127('0x2d')]['includeAll']){_0x2cd534[_0xa127('0x3e')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xa127('0x3f')](_0x2cd534);})[_0xa127('0x3d')](function(_0x1c31ba){_0x397f24['rows']=_0x1c31ba;return _0x397f24;})[_0xa127('0x3d')](respondWithFilteredResult(_0xdb9ed,_0x2cd534))[_0xa127('0x40')](handleError(_0xdb9ed,null));};exports[_0xa127('0x41')]=function(_0x43a63a,_0x130318){var _0x51c7cc={'raw':!![],'where':{'id':_0x43a63a[_0xa127('0x42')]['id']}},_0xda255={};_0xda255[_0xa127('0x2c')]=_['keys'](db[_0xa127('0x28')]['rawAttributes']);_0xda255['query']=_[_0xa127('0x43')](_0x43a63a[_0xa127('0x2d')]);_0xda255[_0xa127('0x2e')]=_[_0xa127('0x2f')](_0xda255[_0xa127('0x2c')],_0xda255['query']);_0x51c7cc[_0xa127('0x32')]=_[_0xa127('0x2f')](_0xda255[_0xa127('0x2c')],qs[_0xa127('0x30')](_0x43a63a['query'][_0xa127('0x30')]));_0x51c7cc[_0xa127('0x32')]=_0x51c7cc['attributes'][_0xa127('0x31')]?_0x51c7cc['attributes']:_0xda255[_0xa127('0x2c')];if(_0x43a63a[_0xa127('0x2d')]['includeAll']){_0x51c7cc[_0xa127('0x3e')]=[{'all':!![]}];}_0x51c7cc=_[_0xa127('0x39')]({},_0x51c7cc,_0x43a63a[_0xa127('0x3c')]);return db[_0xa127('0x28')][_0xa127('0x44')](_0x51c7cc)[_0xa127('0x3d')](handleEntityNotFound(_0x130318,null))['then'](respondWithResult(_0x130318,null))[_0xa127('0x40')](handleError(_0x130318,null));};exports['create']=function(_0x4672bc,_0x285734){return db[_0xa127('0x28')][_0xa127('0x45')](_0x4672bc[_0xa127('0x46')],{})[_0xa127('0x3d')](respondWithResult(_0x285734,0xc9))[_0xa127('0x40')](handleError(_0x285734,null));};exports[_0xa127('0x21')]=function(_0x413f9a,_0x56015a){if(_0x413f9a[_0xa127('0x46')]['id']){delete _0x413f9a[_0xa127('0x46')]['id'];}return db[_0xa127('0x28')]['find']({'where':{'id':_0x413f9a[_0xa127('0x42')]['id']}})[_0xa127('0x3d')](handleEntityNotFound(_0x56015a,null))[_0xa127('0x3d')](saveUpdates(_0x413f9a[_0xa127('0x46')],null))[_0xa127('0x3d')](respondWithResult(_0x56015a,null))['catch'](handleError(_0x56015a,null));};exports['destroy']=function(_0x3fed3f,_0x5f00b3){return db[_0xa127('0x28')][_0xa127('0x44')]({'where':{'id':_0x3fed3f[_0xa127('0x42')]['id']}})[_0xa127('0x3d')](handleEntityNotFound(_0x5f00b3,null))[_0xa127('0x3d')](removeEntity(_0x5f00b3,null))[_0xa127('0x40')](handleError(_0x5f00b3,null));};exports[_0xa127('0x47')]=function(_0x577ad3,_0x1b3d08){return db[_0xa127('0x28')]['describe']()['then'](respondWithResult(_0x1b3d08,null))[_0xa127('0x40')](handleError(_0x1b3d08,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 532e09b..99eef54 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 _0xa638=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x21c0b5,_0x3e475f){var _0x27f4e8=function(_0x2811d7){while(--_0x2811d7){_0x21c0b5['push'](_0x21c0b5['shift']());}};_0x27f4e8(++_0x3e475f);}(_0xa638,0x7a));var _0x8a63=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xa638[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x8a63('0x0'));var util=require(_0x8a63('0x1'));var logger=require(_0x8a63('0x2'))(_0x8a63('0x3'));var moment=require(_0x8a63('0x4'));var BPromise=require(_0x8a63('0x5'));var rp=require(_0x8a63('0x6'));var fs=require('fs');var path=require(_0x8a63('0x7'));var rimraf=require(_0x8a63('0x8'));var config=require(_0x8a63('0x9'));var attributes=require('./faxTransferReport.attributes');module[_0x8a63('0xa')]=function(_0x34e331,_0x1ec8fa){return _0x34e331[_0x8a63('0xb')](_0x8a63('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x8a63('0xd'),'fields':[_0x8a63('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8bd=['./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19258d,_0x5f2768){var _0x2239d7=function(_0x1e82ae){while(--_0x1e82ae){_0x19258d['push'](_0x19258d['shift']());}};_0x2239d7(++_0x5f2768);}(_0xc8bd,0xf6));var _0xdc8b=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0xc8bd[_0x33c603];return _0xae96f4;};'use strict';var _=require(_0xdc8b('0x0'));var util=require(_0xdc8b('0x1'));var logger=require(_0xdc8b('0x2'))(_0xdc8b('0x3'));var moment=require(_0xdc8b('0x4'));var BPromise=require(_0xdc8b('0x5'));var rp=require(_0xdc8b('0x6'));var fs=require('fs');var path=require(_0xdc8b('0x7'));var rimraf=require(_0xdc8b('0x8'));var config=require(_0xdc8b('0x9'));var attributes=require(_0xdc8b('0xa'));module[_0xdc8b('0xb')]=function(_0x4e5493,_0x4ccf43){return _0x4e5493[_0xdc8b('0xc')](_0xdc8b('0xd'),attributes,{'tableName':_0xdc8b('0xe'),'paranoid':![],'indexes':[{'name':_0xdc8b('0xf'),'fields':[_0xdc8b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0cc73f2..601655b 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 _0x2c89=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x566dd0,_0x56aaec){var _0x5842fe=function(_0xfd6af6){while(--_0xfd6af6){_0x566dd0['push'](_0x566dd0['shift']());}};_0x5842fe(++_0x56aaec);}(_0x2c89,0x77));var _0x92c8=function(_0x13fd9f,_0x396d90){_0x13fd9f=_0x13fd9f-0x0;var _0xb160a=_0x2c89[_0x13fd9f];return _0xb160a;};'use strict';var _=require(_0x92c8('0x0'));var util=require('util');var moment=require(_0x92c8('0x1'));var BPromise=require(_0x92c8('0x2'));var rs=require(_0x92c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92c8('0x4'))['db'];var utils=require(_0x92c8('0x5'));var logger=require(_0x92c8('0x6'))(_0x92c8('0x7'));var config=require(_0x92c8('0x8'));var jayson=require(_0x92c8('0x9'));var client=jayson[_0x92c8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5148b8,_0x4181f5,_0x23a8c6){return new BPromise(function(_0x43011b,_0x28f1a8){return client[_0x92c8('0xb')](_0x5148b8,_0x23a8c6)['then'](function(_0x832f0e){logger['info'](_0x92c8('0xc'),_0x4181f5,_0x92c8('0xd'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x4181f5,_0x92c8('0xd'),JSON['stringify'](_0x832f0e));if(_0x832f0e[_0x92c8('0xe')]){if(_0x832f0e['error'][_0x92c8('0xf')]===0x1f4){logger[_0x92c8('0xe')](_0x92c8('0xc'),_0x4181f5,_0x832f0e[_0x92c8('0xe')][_0x92c8('0x10')]);return _0x28f1a8(_0x832f0e[_0x92c8('0xe')]['message']);}logger[_0x92c8('0xe')](_0x92c8('0xc'),_0x4181f5,_0x832f0e['error'][_0x92c8('0x10')]);return _0x43011b(_0x832f0e['error'][_0x92c8('0x10')]);}else{logger['info'](_0x92c8('0xc'),_0x4181f5,_0x92c8('0xd'));_0x43011b(_0x832f0e[_0x92c8('0x11')]['message']);}})[_0x92c8('0x12')](function(_0x3b375f){logger[_0x92c8('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x4181f5,_0x3b375f);_0x28f1a8(_0x3b375f);});});} \ No newline at end of file +var _0xe975=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x2c4ff5,_0x44a366){var _0x583b85=function(_0x591f7e){while(--_0x591f7e){_0x2c4ff5['push'](_0x2c4ff5['shift']());}};_0x583b85(++_0x44a366);}(_0xe975,0x1b5));var _0x5e97=function(_0x4c619f,_0x3236b8){_0x4c619f=_0x4c619f-0x0;var _0x1a4277=_0xe975[_0x4c619f];return _0x1a4277;};'use strict';var _=require(_0x5e97('0x0'));var util=require('util');var moment=require(_0x5e97('0x1'));var BPromise=require(_0x5e97('0x2'));var rs=require(_0x5e97('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e97('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e97('0x5'))(_0x5e97('0x6'));var config=require(_0x5e97('0x7'));var jayson=require(_0x5e97('0x8'));var client=jayson[_0x5e97('0x9')][_0x5e97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x400299,_0x222338,_0x3d3f3f){return new BPromise(function(_0x28246b,_0x1a9480){return client[_0x5e97('0xb')](_0x400299,_0x3d3f3f)[_0x5e97('0xc')](function(_0x31f2eb){logger[_0x5e97('0xd')](_0x5e97('0xe'),_0x222338,_0x5e97('0xf'));logger[_0x5e97('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x222338,_0x5e97('0xf'),JSON[_0x5e97('0x11')](_0x31f2eb));if(_0x31f2eb[_0x5e97('0x12')]){if(_0x31f2eb[_0x5e97('0x12')][_0x5e97('0x13')]===0x1f4){logger['error'](_0x5e97('0xe'),_0x222338,_0x31f2eb['error']['message']);return _0x1a9480(_0x31f2eb['error'][_0x5e97('0x14')]);}logger[_0x5e97('0x12')](_0x5e97('0xe'),_0x222338,_0x31f2eb[_0x5e97('0x12')]['message']);return _0x28246b(_0x31f2eb['error'][_0x5e97('0x14')]);}else{logger[_0x5e97('0xd')](_0x5e97('0xe'),_0x222338,_0x5e97('0xf'));_0x28246b(_0x31f2eb[_0x5e97('0x15')][_0x5e97('0x14')]);}})[_0x5e97('0x16')](function(_0x5e9377){logger[_0x5e97('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x222338,_0x5e9377);_0x1a9480(_0x5e9377);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3cf41af..62c3f5a 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 _0x2188=['create','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x2188,0x135));var _0x8218=function(_0x4e02d2,_0x4b080c){_0x4e02d2=_0x4e02d2-0x0;var _0xa41d5c=_0x2188[_0x4e02d2];return _0xa41d5c;};'use strict';var multer=require('multer');var util=require(_0x8218('0x0'));var path=require('path');var timeout=require(_0x8218('0x1'));var express=require(_0x8218('0x2'));var router=express['Router']();var fs_extra=require(_0x8218('0x3'));var auth=require(_0x8218('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8218('0x5'));var controller=require(_0x8218('0x6'));router[_0x8218('0x7')]('/',auth[_0x8218('0x8')](),controller[_0x8218('0x9')]);router[_0x8218('0x7')](_0x8218('0xa'),auth[_0x8218('0x8')](),controller[_0x8218('0xb')]);router[_0x8218('0x7')](_0x8218('0xc'),auth[_0x8218('0x8')](),controller['show']);router[_0x8218('0xd')]('/',auth[_0x8218('0x8')](),controller[_0x8218('0xe')]);router[_0x8218('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8218('0x10')]);router[_0x8218('0x11')](_0x8218('0xc'),auth[_0x8218('0x8')](),controller['destroy']);module[_0x8218('0x12')]=router; \ No newline at end of file +var _0xaaa2=['create','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','index','get','isAuthenticated','describe','/:id','show','post'];(function(_0x4c75f3,_0x112340){var _0x2f6ffc=function(_0x1c58a6){while(--_0x1c58a6){_0x4c75f3['push'](_0x4c75f3['shift']());}};_0x2f6ffc(++_0x112340);}(_0xaaa2,0x1a5));var _0x2aaa=function(_0x4c7ae3,_0x26b78e){_0x4c7ae3=_0x4c7ae3-0x0;var _0x240026=_0xaaa2[_0x4c7ae3];return _0x240026;};'use strict';var multer=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var path=require('path');var timeout=require(_0x2aaa('0x2'));var express=require(_0x2aaa('0x3'));var router=express[_0x2aaa('0x4')]();var fs_extra=require(_0x2aaa('0x5'));var auth=require(_0x2aaa('0x6'));var interaction=require(_0x2aaa('0x7'));var config=require('../../config/environment');var controller=require(_0x2aaa('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2aaa('0x9')]);router[_0x2aaa('0xa')]('/describe',auth[_0x2aaa('0xb')](),controller[_0x2aaa('0xc')]);router[_0x2aaa('0xa')](_0x2aaa('0xd'),auth[_0x2aaa('0xb')](),controller[_0x2aaa('0xe')]);router[_0x2aaa('0xf')]('/',auth[_0x2aaa('0xb')](),controller[_0x2aaa('0x10')]);router['put'](_0x2aaa('0xd'),auth[_0x2aaa('0xb')](),controller['update']);router['delete'](_0x2aaa('0xd'),auth[_0x2aaa('0xb')](),controller[_0x2aaa('0x11')]);module[_0x2aaa('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0477657..c0e510b 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 _0xf6a6=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy'];(function(_0x4ff82e,_0x43cc73){var _0x2017c6=function(_0x5530f2){while(--_0x5530f2){_0x4ff82e['push'](_0x4ff82e['shift']());}};_0x2017c6(++_0x43cc73);}(_0xf6a6,0xdc));var _0x6f6a=function(_0x3cee75,_0x4cce1f){_0x3cee75=_0x3cee75-0x0;var _0x172fb3=_0xf6a6[_0x3cee75];return _0x172fb3;};'use strict';var multer=require(_0x6f6a('0x0'));var util=require('util');var path=require(_0x6f6a('0x1'));var timeout=require(_0x6f6a('0x2'));var express=require(_0x6f6a('0x3'));var router=express[_0x6f6a('0x4')]();var fs_extra=require(_0x6f6a('0x5'));var auth=require(_0x6f6a('0x6'));var interaction=require(_0x6f6a('0x7'));var config=require(_0x6f6a('0x8'));var controller=require(_0x6f6a('0x9'));router[_0x6f6a('0xa')]('/',auth[_0x6f6a('0xb')](),controller['index']);router[_0x6f6a('0xa')](_0x6f6a('0xc'),auth[_0x6f6a('0xb')](),controller[_0x6f6a('0xd')]);router[_0x6f6a('0xa')]('/:id/configurations',auth[_0x6f6a('0xb')](),controller[_0x6f6a('0xe')]);router[_0x6f6a('0xa')](_0x6f6a('0xf'),auth[_0x6f6a('0xb')](),controller[_0x6f6a('0x10')]);router[_0x6f6a('0x11')]('/',auth[_0x6f6a('0xb')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x6f6a('0x12')]);router[_0x6f6a('0x13')]('/:id',auth[_0x6f6a('0xb')](),controller['update']);router[_0x6f6a('0x14')](_0x6f6a('0xc'),auth['isAuthenticated'](),controller[_0x6f6a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8147=['delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','show','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x8147,0x113));var _0x7814=function(_0xb97c39,_0x192015){_0xb97c39=_0xb97c39-0x0;var _0x2addde=_0x8147[_0xb97c39];return _0x2addde;};'use strict';var multer=require('multer');var util=require(_0x7814('0x0'));var path=require(_0x7814('0x1'));var timeout=require('connect-timeout');var express=require(_0x7814('0x2'));var router=express[_0x7814('0x3')]();var fs_extra=require(_0x7814('0x4'));var auth=require(_0x7814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7814('0x6'));var controller=require(_0x7814('0x7'));router[_0x7814('0x8')]('/',auth['isAuthenticated'](),controller[_0x7814('0x9')]);router[_0x7814('0x8')](_0x7814('0xa'),auth['isAuthenticated'](),controller[_0x7814('0xb')]);router[_0x7814('0x8')]('/:id/configurations',auth[_0x7814('0xc')](),controller['getConfigurations']);router[_0x7814('0x8')](_0x7814('0xd'),auth[_0x7814('0xc')](),controller[_0x7814('0xe')]);router[_0x7814('0xf')]('/',auth['isAuthenticated'](),controller[_0x7814('0x10')]);router['post'](_0x7814('0x11'),auth['isAuthenticated'](),controller[_0x7814('0x12')]);router['put']('/:id',auth[_0x7814('0xc')](),controller['update']);router[_0x7814('0x13')](_0x7814('0xa'),auth[_0x7814('0xc')](),controller['destroy']);module[_0x7814('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5ef4f8d..1976690 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 _0x5dd4=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5dd4,0xe2));var _0x45dd=function(_0x488e8e,_0x274c48){_0x488e8e=_0x488e8e-0x0;var _0x2adf54=_0x5dd4[_0x488e8e];return _0x2adf54;};'use strict';var Sequelize=require(_0x45dd('0x0'));module[_0x45dd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x45dd('0x2')]},'username':{'type':Sequelize[_0x45dd('0x2')]},'remoteUri':{'type':Sequelize[_0x45dd('0x2')]},'authType':{'type':Sequelize[_0x45dd('0x3')](_0x45dd('0x4')),'defaultValue':_0x45dd('0x4')},'password':{'type':Sequelize[_0x45dd('0x2')]},'consumerKey':{'type':Sequelize[_0x45dd('0x2')]},'consumerSecret':{'type':Sequelize[_0x45dd('0x2')]},'token':{'type':Sequelize[_0x45dd('0x2')]},'tokenSecret':{'type':Sequelize[_0x45dd('0x2')]},'serverUrl':{'type':Sequelize[_0x45dd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x45dd('0x3')](_0x45dd('0x5'),_0x45dd('0x6')),'defaultValue':_0x45dd('0x5')}}; \ No newline at end of file +var _0xc491=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x40579e,_0x1f4bcc){var _0x406aee=function(_0x149f47){while(--_0x149f47){_0x40579e['push'](_0x40579e['shift']());}};_0x406aee(++_0x1f4bcc);}(_0xc491,0x1b0));var _0x1c49=function(_0x31520d,_0x50046a){_0x31520d=_0x31520d-0x0;var _0x4d0d26=_0xc491[_0x31520d];return _0x4d0d26;};'use strict';var Sequelize=require(_0x1c49('0x0'));module[_0x1c49('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c49('0x2')]},'username':{'type':Sequelize[_0x1c49('0x2')]},'remoteUri':{'type':Sequelize[_0x1c49('0x2')]},'authType':{'type':Sequelize[_0x1c49('0x3')](_0x1c49('0x4')),'defaultValue':_0x1c49('0x4')},'password':{'type':Sequelize[_0x1c49('0x2')]},'consumerKey':{'type':Sequelize[_0x1c49('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1c49('0x2')]},'tokenSecret':{'type':Sequelize[_0x1c49('0x2')]},'serverUrl':{'type':Sequelize[_0x1c49('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1c49('0x3')](_0x1c49('0x5'),_0x1c49('0x6')),'defaultValue':_0x1c49('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 16a78bb..a39624c 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 _0x1bfb=['crypto','desk.js','to-csv','papaparse','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','json','limit','undefined','offset','count','set','Content-Range','apply','save','update','then','end','sendStatus','error','stack','name','index','map','DeskAccount','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','include','rows','catch','params','options','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','sort','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','lastIndexOf','GET','format','%s/custom_fields','basic','headers','Basic\x20%s','%s:%s','toString','concat','_embedded','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','path','sox','fs-extra','lodash','squel'];(function(_0x4660b9,_0x172664){var _0x3d0b6b=function(_0x3632e1){while(--_0x3632e1){_0x4660b9['push'](_0x4660b9['shift']());}};_0x3d0b6b(++_0x172664);}(_0x1bfb,0x12c));var _0xb1bf=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x1bfb[_0x221ba2];return _0x47d08e;};'use strict';var emlformat=require(_0xb1bf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb1bf('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb1bf('0x2'));var Mustache=require(_0xb1bf('0x3'));var util=require('util');var path=require(_0xb1bf('0x4'));var sox=require(_0xb1bf('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1bf('0x6'));var _=require(_0xb1bf('0x7'));var squel=require(_0xb1bf('0x8'));var crypto=require(_0xb1bf('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb1bf('0xa'));var toCsv=require(_0xb1bf('0xb'));var querystring=require('querystring');var Papa=require(_0xb1bf('0xc'));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(_0xb1bf('0xd'));var logger=require('../../config/logger')(_0xb1bf('0xe'));var utils=require(_0xb1bf('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xb1bf('0x10'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d22d6,_0x528804){_0x528804=_0x528804||0xcc;return function(_0x523566){if(_0x523566){return _0x1d22d6['sendStatus'](_0x528804);}return _0x1d22d6[_0xb1bf('0x11')](_0x528804)['end']();};}function respondWithResult(_0x3d1b92,_0x2feb4b){_0x2feb4b=_0x2feb4b||0xc8;return function(_0x58981b){if(_0x58981b){return _0x3d1b92[_0xb1bf('0x11')](_0x2feb4b)[_0xb1bf('0x12')](_0x58981b);}};}function respondWithFilteredResult(_0x46e6fe,_0x2ddff9){return function(_0x148644){if(_0x148644){var _0x2ffeba=typeof _0x2ddff9['offset']==='undefined'&&typeof _0x2ddff9[_0xb1bf('0x13')]===_0xb1bf('0x14');var _0x170e6a=_0x148644['count'];var _0x4de160=_0x2ffeba?0x0:_0x2ddff9[_0xb1bf('0x15')];var _0x13acf3=_0x2ffeba?_0x148644[_0xb1bf('0x16')]:_0x2ddff9['offset']+_0x2ddff9[_0xb1bf('0x13')];var _0x4c4e5c;if(_0x13acf3>=_0x170e6a){_0x13acf3=_0x170e6a;_0x4c4e5c=0xc8;}else{_0x4c4e5c=0xce;}_0x46e6fe[_0xb1bf('0x11')](_0x4c4e5c);return _0x46e6fe[_0xb1bf('0x17')](_0xb1bf('0x18'),_0x4de160+'-'+_0x13acf3+'/'+_0x170e6a)[_0xb1bf('0x12')](_0x148644);}return null;};}function patchUpdates(_0x524b6d){return function(_0x37dcad){try{jsonpatch[_0xb1bf('0x19')](_0x37dcad,_0x524b6d,!![]);}catch(_0x4592c3){return BPromise['reject'](_0x4592c3);}return _0x37dcad[_0xb1bf('0x1a')]();};}function saveUpdates(_0x5e2304,_0x3ae0ef){return function(_0x4d538d){if(_0x4d538d){return _0x4d538d[_0xb1bf('0x1b')](_0x5e2304)[_0xb1bf('0x1c')](function(_0x55d818){return _0x55d818;});}return null;};}function removeEntity(_0x321899,_0x53bc59){return function(_0x1ce7db){if(_0x1ce7db){return _0x1ce7db['destroy']()[_0xb1bf('0x1c')](function(){_0x321899['status'](0xcc)[_0xb1bf('0x1d')]();});}};}function handleEntityNotFound(_0x39cf78,_0x3433d3){return function(_0x1ac5b5){if(!_0x1ac5b5){_0x39cf78[_0xb1bf('0x1e')](0x194);}return _0x1ac5b5;};}function handleError(_0x2f4388,_0x4e6ec5){_0x4e6ec5=_0x4e6ec5||0x1f4;return function(_0x114a7d){logger[_0xb1bf('0x1f')](_0x114a7d[_0xb1bf('0x20')]);if(_0x114a7d[_0xb1bf('0x21')]){delete _0x114a7d[_0xb1bf('0x21')];}_0x2f4388['status'](_0x4e6ec5)['send'](_0x114a7d);};}exports[_0xb1bf('0x22')]=function(_0x14f052,_0x525959){var _0x4a9c2c={},_0x1a57b7={},_0x59ceeb={'count':0x0,'rows':[]};var _0x1e8a05=_[_0xb1bf('0x23')](db[_0xb1bf('0x24')][_0xb1bf('0x25')],function(_0x192226){return{'name':_0x192226['fieldName'],'type':_0x192226[_0xb1bf('0x26')][_0xb1bf('0x27')]};});_0x1a57b7[_0xb1bf('0x28')]=_['map'](_0x1e8a05,_0xb1bf('0x21'));_0x1a57b7['query']=_[_0xb1bf('0x29')](_0x14f052[_0xb1bf('0x2a')]);_0x1a57b7[_0xb1bf('0x2b')]=_['intersection'](_0x1a57b7['model'],_0x1a57b7['query']);_0x4a9c2c['attributes']=_[_0xb1bf('0x2c')](_0x1a57b7[_0xb1bf('0x28')],qs[_0xb1bf('0x2d')](_0x14f052[_0xb1bf('0x2a')][_0xb1bf('0x2d')]));_0x4a9c2c[_0xb1bf('0x2e')]=_0x4a9c2c[_0xb1bf('0x2e')][_0xb1bf('0x2f')]?_0x4a9c2c[_0xb1bf('0x2e')]:_0x1a57b7[_0xb1bf('0x28')];if(!_0x14f052[_0xb1bf('0x2a')][_0xb1bf('0x30')](_0xb1bf('0x31'))){_0x4a9c2c['limit']=qs[_0xb1bf('0x13')](_0x14f052[_0xb1bf('0x2a')]['limit']);_0x4a9c2c[_0xb1bf('0x15')]=qs[_0xb1bf('0x15')](_0x14f052['query'][_0xb1bf('0x15')]);}_0x4a9c2c[_0xb1bf('0x32')]=qs['sort'](_0x14f052['query']['sort']);_0x4a9c2c[_0xb1bf('0x33')]=qs[_0xb1bf('0x2b')](_['pick'](_0x14f052[_0xb1bf('0x2a')],_0x1a57b7['filters']),_0x1e8a05);if(_0x14f052['query'][_0xb1bf('0x34')]){_0x4a9c2c[_0xb1bf('0x33')]=_[_0xb1bf('0x35')](_0x4a9c2c[_0xb1bf('0x33')],{'$or':_[_0xb1bf('0x23')](_0x1e8a05,function(_0x21477e){if(_0x21477e[_0xb1bf('0x26')]!==_0xb1bf('0x36')){var _0xef476c={};_0xef476c[_0x21477e[_0xb1bf('0x21')]]={'$like':'%'+_0x14f052[_0xb1bf('0x2a')][_0xb1bf('0x34')]+'%'};return _0xef476c;}})});}_0x4a9c2c=_[_0xb1bf('0x35')]({},_0x4a9c2c,_0x14f052['options']);var _0x1eb542={'where':_0x4a9c2c[_0xb1bf('0x33')]};return db[_0xb1bf('0x24')][_0xb1bf('0x16')](_0x1eb542)[_0xb1bf('0x1c')](function(_0x48d264){_0x59ceeb[_0xb1bf('0x16')]=_0x48d264;if(_0x14f052[_0xb1bf('0x2a')]['includeAll']){_0x4a9c2c[_0xb1bf('0x37')]=[{'all':!![]}];}return db[_0xb1bf('0x24')]['findAll'](_0x4a9c2c);})['then'](function(_0x2d16e9){_0x59ceeb[_0xb1bf('0x38')]=_0x2d16e9;return _0x59ceeb;})[_0xb1bf('0x1c')](respondWithFilteredResult(_0x525959,_0x4a9c2c))[_0xb1bf('0x39')](handleError(_0x525959,null));};exports['show']=function(_0x4db1e9,_0x53dc87){var _0x135b4d={'raw':![],'where':{'id':_0x4db1e9[_0xb1bf('0x3a')]['id']}},_0x4dbcb6={};_0x4dbcb6['model']=_[_0xb1bf('0x29')](db['DeskAccount'][_0xb1bf('0x25')]);_0x4dbcb6[_0xb1bf('0x2a')]=_[_0xb1bf('0x29')](_0x4db1e9[_0xb1bf('0x2a')]);_0x4dbcb6[_0xb1bf('0x2b')]=_[_0xb1bf('0x2c')](_0x4dbcb6[_0xb1bf('0x28')],_0x4dbcb6[_0xb1bf('0x2a')]);_0x135b4d[_0xb1bf('0x2e')]=_[_0xb1bf('0x2c')](_0x4dbcb6[_0xb1bf('0x28')],qs[_0xb1bf('0x2d')](_0x4db1e9[_0xb1bf('0x2a')][_0xb1bf('0x2d')]));_0x135b4d['attributes']=_0x135b4d[_0xb1bf('0x2e')][_0xb1bf('0x2f')]?_0x135b4d[_0xb1bf('0x2e')]:_0x4dbcb6[_0xb1bf('0x28')];if(_0x4db1e9[_0xb1bf('0x2a')]['includeAll']){_0x135b4d['include']=[{'all':!![]}];}_0x135b4d=_['merge']({},_0x135b4d,_0x4db1e9[_0xb1bf('0x3b')]);return db[_0xb1bf('0x24')][_0xb1bf('0x3c')](_0x135b4d)['then'](handleEntityNotFound(_0x53dc87,null))[_0xb1bf('0x1c')](respondWithResult(_0x53dc87,null))[_0xb1bf('0x39')](handleError(_0x53dc87,null));};exports[_0xb1bf('0x3d')]=function(_0x52de57,_0x40ecca){return db[_0xb1bf('0x24')][_0xb1bf('0x3d')](_0x52de57[_0xb1bf('0x3e')],{})['then'](respondWithResult(_0x40ecca,0xc9))['catch'](handleError(_0x40ecca,null));};exports['update']=function(_0xec2297,_0x25be81){if(_0xec2297[_0xb1bf('0x3e')]['id']){delete _0xec2297[_0xb1bf('0x3e')]['id'];}return db[_0xb1bf('0x24')][_0xb1bf('0x3c')]({'where':{'id':_0xec2297[_0xb1bf('0x3a')]['id']}})[_0xb1bf('0x1c')](handleEntityNotFound(_0x25be81,null))[_0xb1bf('0x1c')](saveUpdates(_0xec2297[_0xb1bf('0x3e')],null))[_0xb1bf('0x1c')](respondWithResult(_0x25be81,null))[_0xb1bf('0x39')](handleError(_0x25be81,null));};exports[_0xb1bf('0x3f')]=function(_0x4239f5,_0x5d0ad2){return db[_0xb1bf('0x24')][_0xb1bf('0x3c')]({'where':{'id':_0x4239f5['params']['id']}})[_0xb1bf('0x1c')](handleEntityNotFound(_0x5d0ad2,null))[_0xb1bf('0x1c')](removeEntity(_0x5d0ad2,null))['catch'](handleError(_0x5d0ad2,null));};exports[_0xb1bf('0x40')]=function(_0x38a443,_0x16844b,_0x21ce01){var _0x12a07f={};var _0x3ecced={};var _0x4fbc87;var _0x35d215;return db['DeskAccount'][_0xb1bf('0x41')]({'where':{'id':_0x38a443[_0xb1bf('0x3a')]['id']}})['then'](handleEntityNotFound(_0x16844b,null))[_0xb1bf('0x1c')](function(_0x379343){if(_0x379343){_0x4fbc87=_0x379343;_0x3ecced[_0xb1bf('0x28')]=_[_0xb1bf('0x29')](db[_0xb1bf('0x42')]['rawAttributes']);_0x3ecced[_0xb1bf('0x2a')]=_[_0xb1bf('0x29')](_0x38a443['query']);_0x3ecced[_0xb1bf('0x2b')]=_[_0xb1bf('0x2c')](_0x3ecced['model'],_0x3ecced['query']);_0x12a07f[_0xb1bf('0x2e')]=_['intersection'](_0x3ecced[_0xb1bf('0x28')],qs[_0xb1bf('0x2d')](_0x38a443[_0xb1bf('0x2a')][_0xb1bf('0x2d')]));_0x12a07f['attributes']=_0x12a07f[_0xb1bf('0x2e')][_0xb1bf('0x2f')]?_0x12a07f['attributes']:_0x3ecced[_0xb1bf('0x28')];_0x12a07f[_0xb1bf('0x32')]=qs[_0xb1bf('0x43')](_0x38a443[_0xb1bf('0x2a')]['sort']);_0x12a07f[_0xb1bf('0x33')]=qs[_0xb1bf('0x2b')](_[_0xb1bf('0x44')](_0x38a443[_0xb1bf('0x2a')],_0x3ecced[_0xb1bf('0x2b')]));if(_0x38a443['query'][_0xb1bf('0x34')]){_0x12a07f[_0xb1bf('0x33')]=_['merge'](_0x12a07f['where'],{'$or':_[_0xb1bf('0x23')](_0x12a07f[_0xb1bf('0x2e')],function(_0x1f4464){var _0x4cc517={};_0x4cc517[_0x1f4464]={'$like':'%'+_0x38a443[_0xb1bf('0x2a')][_0xb1bf('0x34')]+'%'};return _0x4cc517;})});}_0x12a07f=_[_0xb1bf('0x35')]({},_0x12a07f,_0x38a443[_0xb1bf('0x3b')]);return _0x4fbc87['getConfigurations'](_0x12a07f);}})['then'](function(_0x436a10){if(_0x436a10){_0x35d215=_0x436a10[_0xb1bf('0x2f')];if(!_0x38a443['query'][_0xb1bf('0x30')](_0xb1bf('0x31'))){_0x12a07f['limit']=qs[_0xb1bf('0x13')](_0x38a443[_0xb1bf('0x2a')][_0xb1bf('0x13')]);_0x12a07f[_0xb1bf('0x15')]=qs['offset'](_0x38a443[_0xb1bf('0x2a')][_0xb1bf('0x15')]);}return _0x4fbc87['getConfigurations'](_0x12a07f);}})[_0xb1bf('0x1c')](function(_0x43c0b0){if(_0x43c0b0){return _0x43c0b0?{'count':_0x35d215,'rows':_0x43c0b0}:null;}})[_0xb1bf('0x1c')](respondWithResult(_0x16844b,null))['catch'](handleError(_0x16844b,null));};exports[_0xb1bf('0x45')]=function(_0x3c9109,_0x191486,_0x547a54){if(_0x3c9109[_0xb1bf('0x3e')]['id']){delete _0x3c9109[_0xb1bf('0x3e')]['id'];}return db[_0xb1bf('0x24')][_0xb1bf('0x41')]({'where':{'id':_0x3c9109['params']['id']}})[_0xb1bf('0x1c')](handleEntityNotFound(_0x191486,null))[_0xb1bf('0x1c')](function(_0x2a0c9f){if(_0x2a0c9f){_0x3c9109[_0xb1bf('0x3e')][_0xb1bf('0x46')]=_0x2a0c9f['id'];_0x3c9109['body'][_0xb1bf('0x47')]=integrations[_0xb1bf('0x48')](_0x3c9109[_0xb1bf('0x3e')][_0xb1bf('0x49')],_0x3c9109[_0xb1bf('0x3e')][_0xb1bf('0x26')]);_0x3c9109['body'][_0xb1bf('0x4a')]=integrations[_0xb1bf('0x4b')](_0x3c9109['body'][_0xb1bf('0x49')],_0x3c9109[_0xb1bf('0x3e')][_0xb1bf('0x26')]);return db[_0xb1bf('0x42')][_0xb1bf('0x3d')](_0x3c9109[_0xb1bf('0x3e')],{'include':[{'model':db[_0xb1bf('0x4c')],'as':_0xb1bf('0x47')},{'model':db['DeskField'],'as':_0xb1bf('0x4a')}]});}return null;})[_0xb1bf('0x1c')](respondWithResult(_0x191486,null))['catch'](handleError(_0x191486,null));};exports[_0xb1bf('0x4d')]=function(_0x176e8e,_0x555aba,_0x3e7a8e){var _0x33f6f8=[{'name':'priority','label':_0xb1bf('0x4e'),'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 _0x2810fb='';return db['DeskAccount']['findOne']({'where':{'id':_0x176e8e[_0xb1bf('0x3a')]['id']},'attributes':['id','remoteUri',_0xb1bf('0x4f'),'username',_0xb1bf('0x50'),_0xb1bf('0x51'),_0xb1bf('0x52'),_0xb1bf('0x53'),_0xb1bf('0x54')]})['then'](handleEntityNotFound(_0x555aba,null))[_0xb1bf('0x1c')](function(_0x2555d3){if(_0x2555d3){_0x2810fb=_0x2555d3[_0xb1bf('0x55')];var _0x5c423b=_0x2810fb['slice'](-0x1);if(_0x5c423b==='/'){_0x2810fb=_0x2810fb['substring'](0x0,_0x2810fb[_0xb1bf('0x56')](_0x5c423b));}var _0x1bd9ed={'method':_0xb1bf('0x57'),'uri':util[_0xb1bf('0x58')](_0xb1bf('0x59'),_0x2810fb),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x2555d3[_0xb1bf('0x4f')]===_0xb1bf('0x5a')){_0x1bd9ed[_0xb1bf('0x5b')]['Authorization']=util[_0xb1bf('0x58')](_0xb1bf('0x5c'),new Buffer(util[_0xb1bf('0x58')](_0xb1bf('0x5d'),_0x2555d3['username'],_0x2555d3[_0xb1bf('0x50')]))[_0xb1bf('0x5e')]('base64'));}return rp(_0x1bd9ed)[_0xb1bf('0x1c')](function(_0x165620){return _0x33f6f8[_0xb1bf('0x5f')](_[_0xb1bf('0x23')](_0x165620[_0xb1bf('0x60')]['entries'],function(_0xa4d240){return{'id':_0xa4d240['name'],'name':_0xa4d240[_0xb1bf('0x21')],'type':_0xa4d240['type'],'active':_0xa4d240[_0xb1bf('0x61')],'label':_0xa4d240['label'],'custom':!![]};}));});}})['then'](function(_0x2fb62f){return{'count':_0x2fb62f[_0xb1bf('0x2f')],'rows':_0x2fb62f};})[_0xb1bf('0x1c')](respondWithResult(_0x555aba,null))['catch'](function(_0x2e6816){var _0x18b129=_0x176e8e[_0xb1bf('0x2a')][_0xb1bf('0x62')]?0x1f4:_0x2e6816[_0xb1bf('0x63')]||0x1f4;logger[_0xb1bf('0x1f')](_0xb1bf('0x64'),_0xb1bf('0x4d'),_0x18b129,JSON[_0xb1bf('0x65')](_0x2e6816));delete _0x2e6816[_0xb1bf('0x21')];if(_0x18b129===0x191){_0x18b129=0x190;}_0x555aba[_0xb1bf('0x11')](_0x18b129)['send'](_0x176e8e[_0xb1bf('0x2a')][_0xb1bf('0x62')]?{'message':_0xb1bf('0x66'),'statusCode':_0x2e6816[_0xb1bf('0x63')]}:_0x2e6816);});}; \ No newline at end of file +var _0xf805=['hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','authType','username','password','consumerKey','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','headers','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x420a6d,_0x46c52f){var _0x74059a=function(_0x5921d8){while(--_0x5921d8){_0x420a6d['push'](_0x420a6d['shift']());}};_0x74059a(++_0x46c52f);}(_0xf805,0x18e));var _0x5f80=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0xf805[_0x326e79];return _0x37eb89;};'use strict';var emlformat=require(_0x5f80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f80('0x1'));var jsonpatch=require(_0x5f80('0x2'));var rp=require(_0x5f80('0x3'));var moment=require(_0x5f80('0x4'));var BPromise=require(_0x5f80('0x5'));var Mustache=require(_0x5f80('0x6'));var util=require(_0x5f80('0x7'));var path=require(_0x5f80('0x8'));var sox=require(_0x5f80('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f80('0xa'));var _=require(_0x5f80('0xb'));var squel=require(_0x5f80('0xc'));var crypto=require(_0x5f80('0xd'));var jsforce=require(_0x5f80('0xe'));var deskjs=require(_0x5f80('0xf'));var toCsv=require(_0x5f80('0x10'));var querystring=require(_0x5f80('0x11'));var Papa=require('papaparse');var Redis=require(_0x5f80('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5f80('0x13'));var hardwareService=require(_0x5f80('0x14'));var logger=require(_0x5f80('0x15'))('api');var utils=require(_0x5f80('0x16'));var config=require(_0x5f80('0x17'));var licenseUtil=require(_0x5f80('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5f80('0x19'));function respondWithStatusCode(_0x2baf0d,_0x3b5c01){_0x3b5c01=_0x3b5c01||0xcc;return function(_0x55b269){if(_0x55b269){return _0x2baf0d[_0x5f80('0x1a')](_0x3b5c01);}return _0x2baf0d[_0x5f80('0x1b')](_0x3b5c01)[_0x5f80('0x1c')]();};}function respondWithResult(_0x58c5e6,_0x38669e){_0x38669e=_0x38669e||0xc8;return function(_0x3aa6d7){if(_0x3aa6d7){return _0x58c5e6[_0x5f80('0x1b')](_0x38669e)['json'](_0x3aa6d7);}};}function respondWithFilteredResult(_0x1303db,_0x345fb8){return function(_0x35084d){if(_0x35084d){var _0x5ee966=typeof _0x345fb8[_0x5f80('0x1d')]===_0x5f80('0x1e')&&typeof _0x345fb8['limit']===_0x5f80('0x1e');var _0x5063b9=_0x35084d[_0x5f80('0x1f')];var _0x57dc29=_0x5ee966?0x0:_0x345fb8[_0x5f80('0x1d')];var _0x125fd6=_0x5ee966?_0x35084d[_0x5f80('0x1f')]:_0x345fb8[_0x5f80('0x1d')]+_0x345fb8['limit'];var _0x2a13a9;if(_0x125fd6>=_0x5063b9){_0x125fd6=_0x5063b9;_0x2a13a9=0xc8;}else{_0x2a13a9=0xce;}_0x1303db['status'](_0x2a13a9);return _0x1303db['set'](_0x5f80('0x20'),_0x57dc29+'-'+_0x125fd6+'/'+_0x5063b9)[_0x5f80('0x21')](_0x35084d);}return null;};}function patchUpdates(_0x567d78){return function(_0x2ed789){try{jsonpatch['apply'](_0x2ed789,_0x567d78,!![]);}catch(_0x2ae5df){return BPromise[_0x5f80('0x22')](_0x2ae5df);}return _0x2ed789[_0x5f80('0x23')]();};}function saveUpdates(_0x1fe9dd,_0x3aa15c){return function(_0x540b11){if(_0x540b11){return _0x540b11[_0x5f80('0x24')](_0x1fe9dd)[_0x5f80('0x25')](function(_0x22f940){return _0x22f940;});}return null;};}function removeEntity(_0x295a7b,_0x4b0cce){return function(_0x164ea9){if(_0x164ea9){return _0x164ea9[_0x5f80('0x26')]()[_0x5f80('0x25')](function(){_0x295a7b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x179095,_0x5f3c6e){return function(_0x58fedd){if(!_0x58fedd){_0x179095[_0x5f80('0x1a')](0x194);}return _0x58fedd;};}function handleError(_0x4c35ad,_0x55773b){_0x55773b=_0x55773b||0x1f4;return function(_0x3208ff){logger[_0x5f80('0x27')](_0x3208ff[_0x5f80('0x28')]);if(_0x3208ff[_0x5f80('0x29')]){delete _0x3208ff['name'];}_0x4c35ad[_0x5f80('0x1b')](_0x55773b)[_0x5f80('0x2a')](_0x3208ff);};}exports[_0x5f80('0x2b')]=function(_0x5b3e20,_0x322d23){var _0xda9b46={},_0x1071b0={},_0x41c684={'count':0x0,'rows':[]};var _0x44c2ce=_[_0x5f80('0x2c')](db[_0x5f80('0x2d')][_0x5f80('0x2e')],function(_0x38e0ab){return{'name':_0x38e0ab[_0x5f80('0x2f')],'type':_0x38e0ab[_0x5f80('0x30')][_0x5f80('0x31')]};});_0x1071b0['model']=_[_0x5f80('0x2c')](_0x44c2ce,_0x5f80('0x29'));_0x1071b0[_0x5f80('0x32')]=_[_0x5f80('0x33')](_0x5b3e20[_0x5f80('0x32')]);_0x1071b0[_0x5f80('0x34')]=_[_0x5f80('0x35')](_0x1071b0[_0x5f80('0x36')],_0x1071b0[_0x5f80('0x32')]);_0xda9b46[_0x5f80('0x37')]=_['intersection'](_0x1071b0[_0x5f80('0x36')],qs[_0x5f80('0x38')](_0x5b3e20[_0x5f80('0x32')]['fields']));_0xda9b46[_0x5f80('0x37')]=_0xda9b46['attributes'][_0x5f80('0x39')]?_0xda9b46[_0x5f80('0x37')]:_0x1071b0['model'];if(!_0x5b3e20[_0x5f80('0x32')][_0x5f80('0x3a')](_0x5f80('0x3b'))){_0xda9b46[_0x5f80('0x3c')]=qs[_0x5f80('0x3c')](_0x5b3e20[_0x5f80('0x32')]['limit']);_0xda9b46[_0x5f80('0x1d')]=qs[_0x5f80('0x1d')](_0x5b3e20[_0x5f80('0x32')][_0x5f80('0x1d')]);}_0xda9b46[_0x5f80('0x3d')]=qs[_0x5f80('0x3e')](_0x5b3e20[_0x5f80('0x32')][_0x5f80('0x3e')]);_0xda9b46[_0x5f80('0x3f')]=qs[_0x5f80('0x34')](_[_0x5f80('0x40')](_0x5b3e20[_0x5f80('0x32')],_0x1071b0['filters']),_0x44c2ce);if(_0x5b3e20[_0x5f80('0x32')]['filter']){_0xda9b46[_0x5f80('0x3f')]=_['merge'](_0xda9b46[_0x5f80('0x3f')],{'$or':_[_0x5f80('0x2c')](_0x44c2ce,function(_0x452e03){if(_0x452e03[_0x5f80('0x30')]!==_0x5f80('0x41')){var _0xdb9d3b={};_0xdb9d3b[_0x452e03[_0x5f80('0x29')]]={'$like':'%'+_0x5b3e20['query'][_0x5f80('0x42')]+'%'};return _0xdb9d3b;}})});}_0xda9b46=_[_0x5f80('0x43')]({},_0xda9b46,_0x5b3e20[_0x5f80('0x44')]);var _0x47eceb={'where':_0xda9b46[_0x5f80('0x3f')]};return db[_0x5f80('0x2d')]['count'](_0x47eceb)[_0x5f80('0x25')](function(_0xce9dc7){_0x41c684[_0x5f80('0x1f')]=_0xce9dc7;if(_0x5b3e20[_0x5f80('0x32')][_0x5f80('0x45')]){_0xda9b46[_0x5f80('0x46')]=[{'all':!![]}];}return db[_0x5f80('0x2d')][_0x5f80('0x47')](_0xda9b46);})[_0x5f80('0x25')](function(_0x51aa20){_0x41c684[_0x5f80('0x48')]=_0x51aa20;return _0x41c684;})['then'](respondWithFilteredResult(_0x322d23,_0xda9b46))[_0x5f80('0x49')](handleError(_0x322d23,null));};exports[_0x5f80('0x4a')]=function(_0x47c316,_0x184b88){var _0x5c19da={'raw':![],'where':{'id':_0x47c316['params']['id']}},_0x406796={};_0x406796[_0x5f80('0x36')]=_[_0x5f80('0x33')](db[_0x5f80('0x2d')][_0x5f80('0x2e')]);_0x406796[_0x5f80('0x32')]=_[_0x5f80('0x33')](_0x47c316[_0x5f80('0x32')]);_0x406796['filters']=_['intersection'](_0x406796['model'],_0x406796['query']);_0x5c19da[_0x5f80('0x37')]=_['intersection'](_0x406796[_0x5f80('0x36')],qs[_0x5f80('0x38')](_0x47c316['query'][_0x5f80('0x38')]));_0x5c19da['attributes']=_0x5c19da[_0x5f80('0x37')][_0x5f80('0x39')]?_0x5c19da[_0x5f80('0x37')]:_0x406796['model'];if(_0x47c316[_0x5f80('0x32')][_0x5f80('0x45')]){_0x5c19da['include']=[{'all':!![]}];}_0x5c19da=_[_0x5f80('0x43')]({},_0x5c19da,_0x47c316[_0x5f80('0x44')]);return db[_0x5f80('0x2d')][_0x5f80('0x4b')](_0x5c19da)[_0x5f80('0x25')](handleEntityNotFound(_0x184b88,null))[_0x5f80('0x25')](respondWithResult(_0x184b88,null))[_0x5f80('0x49')](handleError(_0x184b88,null));};exports[_0x5f80('0x4c')]=function(_0x3de998,_0x5c53e8){return db[_0x5f80('0x2d')][_0x5f80('0x4c')](_0x3de998[_0x5f80('0x4d')],{})[_0x5f80('0x25')](respondWithResult(_0x5c53e8,0xc9))[_0x5f80('0x49')](handleError(_0x5c53e8,null));};exports['update']=function(_0x3d7800,_0x442e5d){if(_0x3d7800[_0x5f80('0x4d')]['id']){delete _0x3d7800['body']['id'];}return db[_0x5f80('0x2d')][_0x5f80('0x4b')]({'where':{'id':_0x3d7800['params']['id']}})[_0x5f80('0x25')](handleEntityNotFound(_0x442e5d,null))[_0x5f80('0x25')](saveUpdates(_0x3d7800[_0x5f80('0x4d')],null))[_0x5f80('0x25')](respondWithResult(_0x442e5d,null))[_0x5f80('0x49')](handleError(_0x442e5d,null));};exports['destroy']=function(_0x3a1d15,_0x9194c2){return db[_0x5f80('0x2d')]['find']({'where':{'id':_0x3a1d15[_0x5f80('0x4e')]['id']}})[_0x5f80('0x25')](handleEntityNotFound(_0x9194c2,null))[_0x5f80('0x25')](removeEntity(_0x9194c2,null))[_0x5f80('0x49')](handleError(_0x9194c2,null));};exports[_0x5f80('0x4f')]=function(_0x53bcdf,_0x329131,_0x251168){var _0x54486c={};var _0x3fbc3b={};var _0x236a1c;var _0x10675d;return db[_0x5f80('0x2d')][_0x5f80('0x50')]({'where':{'id':_0x53bcdf['params']['id']}})[_0x5f80('0x25')](handleEntityNotFound(_0x329131,null))['then'](function(_0x5a33d2){if(_0x5a33d2){_0x236a1c=_0x5a33d2;_0x3fbc3b[_0x5f80('0x36')]=_[_0x5f80('0x33')](db[_0x5f80('0x51')]['rawAttributes']);_0x3fbc3b[_0x5f80('0x32')]=_[_0x5f80('0x33')](_0x53bcdf['query']);_0x3fbc3b[_0x5f80('0x34')]=_[_0x5f80('0x35')](_0x3fbc3b[_0x5f80('0x36')],_0x3fbc3b[_0x5f80('0x32')]);_0x54486c['attributes']=_[_0x5f80('0x35')](_0x3fbc3b[_0x5f80('0x36')],qs[_0x5f80('0x38')](_0x53bcdf[_0x5f80('0x32')]['fields']));_0x54486c[_0x5f80('0x37')]=_0x54486c['attributes']['length']?_0x54486c[_0x5f80('0x37')]:_0x3fbc3b[_0x5f80('0x36')];_0x54486c['order']=qs[_0x5f80('0x3e')](_0x53bcdf[_0x5f80('0x32')][_0x5f80('0x3e')]);_0x54486c[_0x5f80('0x3f')]=qs['filters'](_[_0x5f80('0x40')](_0x53bcdf['query'],_0x3fbc3b['filters']));if(_0x53bcdf[_0x5f80('0x32')]['filter']){_0x54486c['where']=_[_0x5f80('0x43')](_0x54486c['where'],{'$or':_[_0x5f80('0x2c')](_0x54486c['attributes'],function(_0x519c22){var _0x3beeea={};_0x3beeea[_0x519c22]={'$like':'%'+_0x53bcdf['query'][_0x5f80('0x42')]+'%'};return _0x3beeea;})});}_0x54486c=_[_0x5f80('0x43')]({},_0x54486c,_0x53bcdf[_0x5f80('0x44')]);return _0x236a1c['getConfigurations'](_0x54486c);}})[_0x5f80('0x25')](function(_0x5f3764){if(_0x5f3764){_0x10675d=_0x5f3764[_0x5f80('0x39')];if(!_0x53bcdf['query'][_0x5f80('0x3a')](_0x5f80('0x3b'))){_0x54486c[_0x5f80('0x3c')]=qs[_0x5f80('0x3c')](_0x53bcdf[_0x5f80('0x32')][_0x5f80('0x3c')]);_0x54486c[_0x5f80('0x1d')]=qs[_0x5f80('0x1d')](_0x53bcdf[_0x5f80('0x32')][_0x5f80('0x1d')]);}return _0x236a1c[_0x5f80('0x4f')](_0x54486c);}})[_0x5f80('0x25')](function(_0x43bb79){if(_0x43bb79){return _0x43bb79?{'count':_0x10675d,'rows':_0x43bb79}:null;}})[_0x5f80('0x25')](respondWithResult(_0x329131,null))[_0x5f80('0x49')](handleError(_0x329131,null));};exports['addConfiguration']=function(_0x18f7fb,_0x17e4fc,_0x14d865){if(_0x18f7fb[_0x5f80('0x4d')]['id']){delete _0x18f7fb['body']['id'];}return db[_0x5f80('0x2d')][_0x5f80('0x50')]({'where':{'id':_0x18f7fb[_0x5f80('0x4e')]['id']}})[_0x5f80('0x25')](handleEntityNotFound(_0x17e4fc,null))[_0x5f80('0x25')](function(_0x578879){if(_0x578879){_0x18f7fb[_0x5f80('0x4d')][_0x5f80('0x52')]=_0x578879['id'];_0x18f7fb[_0x5f80('0x4d')][_0x5f80('0x53')]=integrations[_0x5f80('0x54')](_0x18f7fb[_0x5f80('0x4d')][_0x5f80('0x55')],_0x18f7fb[_0x5f80('0x4d')][_0x5f80('0x30')]);_0x18f7fb[_0x5f80('0x4d')][_0x5f80('0x56')]=integrations['getDescriptions'](_0x18f7fb['body'][_0x5f80('0x55')],_0x18f7fb[_0x5f80('0x4d')][_0x5f80('0x30')]);return db[_0x5f80('0x51')][_0x5f80('0x4c')](_0x18f7fb['body'],{'include':[{'model':db[_0x5f80('0x57')],'as':'Subjects'},{'model':db[_0x5f80('0x57')],'as':_0x5f80('0x56')}]});}return null;})[_0x5f80('0x25')](respondWithResult(_0x17e4fc,null))['catch'](handleError(_0x17e4fc,null));};exports[_0x5f80('0x58')]=function(_0x866194,_0x387c2b,_0x1e2951){var _0x4ea0bd=[{'name':_0x5f80('0x59'),'label':_0x5f80('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x25b0b3='';return db['DeskAccount'][_0x5f80('0x50')]({'where':{'id':_0x866194[_0x5f80('0x4e')]['id']},'attributes':['id','remoteUri',_0x5f80('0x5a'),_0x5f80('0x5b'),_0x5f80('0x5c'),_0x5f80('0x5d'),'consumerSecret','token',_0x5f80('0x5e')]})[_0x5f80('0x25')](handleEntityNotFound(_0x387c2b,null))[_0x5f80('0x25')](function(_0x39fc7f){if(_0x39fc7f){_0x25b0b3=_0x39fc7f['remoteUri'];var _0x1be07a=_0x25b0b3['slice'](-0x1);if(_0x1be07a==='/'){_0x25b0b3=_0x25b0b3[_0x5f80('0x5f')](0x0,_0x25b0b3[_0x5f80('0x60')](_0x1be07a));}var _0xb975ad={'method':'GET','uri':util[_0x5f80('0x61')](_0x5f80('0x62'),_0x25b0b3),'headers':{'Content-Type':_0x5f80('0x63'),'Accept':_0x5f80('0x63')},'json':!![]};if(_0x39fc7f[_0x5f80('0x5a')]==='basic'){_0xb975ad[_0x5f80('0x64')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0x5f80('0x61')](_0x5f80('0x65'),_0x39fc7f['username'],_0x39fc7f[_0x5f80('0x5c')]))[_0x5f80('0x66')](_0x5f80('0x67')));}return rp(_0xb975ad)['then'](function(_0x5d9a7d){return _0x4ea0bd[_0x5f80('0x68')](_[_0x5f80('0x2c')](_0x5d9a7d[_0x5f80('0x69')][_0x5f80('0x6a')],function(_0x417762){return{'id':_0x417762[_0x5f80('0x29')],'name':_0x417762[_0x5f80('0x29')],'type':_0x417762[_0x5f80('0x30')],'active':_0x417762[_0x5f80('0x6b')],'label':_0x417762[_0x5f80('0x6c')],'custom':!![]};}));});}})[_0x5f80('0x25')](function(_0x26b548){return{'count':_0x26b548[_0x5f80('0x39')],'rows':_0x26b548};})[_0x5f80('0x25')](respondWithResult(_0x387c2b,null))[_0x5f80('0x49')](function(_0x3e16e4){var _0x3d7ec4=_0x866194['query'][_0x5f80('0x6d')]?0x1f4:_0x3e16e4['statusCode']||0x1f4;logger['error'](_0x5f80('0x6e'),'getFields',_0x3d7ec4,JSON[_0x5f80('0x6f')](_0x3e16e4));delete _0x3e16e4[_0x5f80('0x29')];if(_0x3d7ec4===0x191){_0x3d7ec4=0x190;}_0x387c2b[_0x5f80('0x1b')](_0x3d7ec4)['send'](_0x866194['query'][_0x5f80('0x6d')]?{'message':_0x5f80('0x70'),'statusCode':_0x3e16e4[_0x5f80('0x71')]}:_0x3e16e4);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index aa2d05f..06343c9 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 _0x81a5=['../../config/logger','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','lodash'];(function(_0x48cbd3,_0x41e288){var _0x2ca77a=function(_0x2abca8){while(--_0x2abca8){_0x48cbd3['push'](_0x48cbd3['shift']());}};_0x2ca77a(++_0x41e288);}(_0x81a5,0x170));var _0x581a=function(_0x314582,_0x281a1a){_0x314582=_0x314582-0x0;var _0x1489bf=_0x81a5[_0x314582];return _0x1489bf;};'use strict';var _=require(_0x581a('0x0'));var util=require('util');var logger=require(_0x581a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x581a('0x2'));var rp=require(_0x581a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x581a('0x4'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x581a('0x5'));module[_0x581a('0x6')]=function(_0x40f09e,_0x45f923){return _0x40f09e[_0x581a('0x7')](_0x581a('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d90=['bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x478371,_0x1115ab){var _0x5c7dad=function(_0x69f561){while(--_0x69f561){_0x478371['push'](_0x478371['shift']());}};_0x5c7dad(++_0x1115ab);}(_0x0d90,0x11b));var _0x00d9=function(_0x5802d6,_0xa5f419){_0x5802d6=_0x5802d6-0x0;var _0x1c7d53=_0x0d90[_0x5802d6];return _0x1c7d53;};'use strict';var _=require(_0x00d9('0x0'));var util=require(_0x00d9('0x1'));var logger=require(_0x00d9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x00d9('0x3'));var rp=require(_0x00d9('0x4'));var fs=require('fs');var path=require(_0x00d9('0x5'));var rimraf=require(_0x00d9('0x6'));var config=require('../../config/environment');var attributes=require(_0x00d9('0x7'));var integrations=require(_0x00d9('0x8'));module[_0x00d9('0x9')]=function(_0x4b675b,_0x597b0a){return _0x4b675b[_0x00d9('0xa')](_0x00d9('0xb'),attributes,{'tableName':_0x00d9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 1390ad3..70ad4b7 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 _0x5854=['model','catch','ShowDeskAccount','find','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map'];(function(_0x5c2cd7,_0x56c775){var _0x51af6d=function(_0x5541ef){while(--_0x5541ef){_0x5c2cd7['push'](_0x5c2cd7['shift']());}};_0x51af6d(++_0x56c775);}(_0x5854,0x1d2));var _0x4585=function(_0x484c29,_0x125c79){_0x484c29=_0x484c29-0x0;var _0x28dfb2=_0x5854[_0x484c29];return _0x28dfb2;};'use strict';var _=require('lodash');var util=require(_0x4585('0x0'));var moment=require('moment');var BPromise=require(_0x4585('0x1'));var rs=require(_0x4585('0x2'));var fs=require('fs');var Redis=require(_0x4585('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4585('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4585('0x5'));var jayson=require(_0x4585('0x6'));var client=jayson[_0x4585('0x7')][_0x4585('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fae8a,_0x44ba1d,_0x5ae617){return new BPromise(function(_0x3e08e6,_0x415906){return client[_0x4585('0x9')](_0x3fae8a,_0x5ae617)[_0x4585('0xa')](function(_0x3c9a07){logger[_0x4585('0xb')](_0x4585('0xc'),_0x44ba1d,_0x4585('0xd'));logger[_0x4585('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x44ba1d,_0x4585('0xd'),JSON[_0x4585('0xf')](_0x3c9a07));if(_0x3c9a07[_0x4585('0x10')]){if(_0x3c9a07[_0x4585('0x10')][_0x4585('0x11')]===0x1f4){logger[_0x4585('0x10')]('DeskAccount,\x20%s,\x20%s',_0x44ba1d,_0x3c9a07[_0x4585('0x10')][_0x4585('0x12')]);return _0x415906(_0x3c9a07[_0x4585('0x10')][_0x4585('0x12')]);}logger[_0x4585('0x10')](_0x4585('0xc'),_0x44ba1d,_0x3c9a07[_0x4585('0x10')][_0x4585('0x12')]);return _0x3e08e6(_0x3c9a07[_0x4585('0x10')][_0x4585('0x12')]);}else{logger[_0x4585('0xb')](_0x4585('0xc'),_0x44ba1d,_0x4585('0xd'));_0x3e08e6(_0x3c9a07[_0x4585('0x13')][_0x4585('0x12')]);}})['catch'](function(_0x420ee2){logger[_0x4585('0x10')]('DeskAccount,\x20%s,\x20%s',_0x44ba1d,_0x420ee2);_0x415906(_0x420ee2);});});}exports[_0x4585('0x14')]=function(_0x1c20f3){var _0x114161=this;return new Promise(function(_0x3a7026,_0x16d21f){return db[_0x4585('0x15')][_0x4585('0x16')]({'raw':_0x1c20f3['options']?_0x1c20f3[_0x4585('0x17')][_0x4585('0x18')]===undefined?!![]:![]:!![],'where':_0x1c20f3[_0x4585('0x17')]?_0x1c20f3['options']['where']||null:null,'attributes':_0x1c20f3[_0x4585('0x17')]?_0x1c20f3[_0x4585('0x17')][_0x4585('0x19')]||null:null,'limit':_0x1c20f3[_0x4585('0x17')]?_0x1c20f3[_0x4585('0x17')][_0x4585('0x1a')]||null:null,'include':_0x1c20f3['options']?_0x1c20f3[_0x4585('0x17')][_0x4585('0x1b')]?_[_0x4585('0x1c')](_0x1c20f3[_0x4585('0x17')][_0x4585('0x1b')],function(_0x5b2d27){return{'model':db[_0x5b2d27['model']],'as':_0x5b2d27['as'],'attributes':_0x5b2d27[_0x4585('0x19')],'include':_0x5b2d27[_0x4585('0x1b')]?_[_0x4585('0x1c')](_0x5b2d27['include'],function(_0x171b75){return{'model':db[_0x171b75[_0x4585('0x1d')]],'as':_0x171b75['as'],'attributes':_0x171b75[_0x4585('0x19')],'include':_0x171b75[_0x4585('0x1b')]?_[_0x4585('0x1c')](_0x171b75['include'],function(_0x2a011c){return{'model':db[_0x2a011c[_0x4585('0x1d')]],'as':_0x2a011c['as'],'attributes':_0x2a011c[_0x4585('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4585('0xa')](function(_0x30443b){logger[_0x4585('0xb')](_0x4585('0x14'),_0x1c20f3);logger[_0x4585('0xe')]('GetDeskAccount',_0x1c20f3,JSON[_0x4585('0xf')](_0x30443b));_0x3a7026(_0x30443b);})[_0x4585('0x1e')](function(_0x24e4b6){logger[_0x4585('0x10')](_0x4585('0x14'),_0x24e4b6['message'],_0x1c20f3);_0x16d21f(_0x114161[_0x4585('0x10')](0x1f4,_0x24e4b6[_0x4585('0x12')]));});});};exports[_0x4585('0x1f')]=function(_0x49f140){var _0x3e70e0=this;return new Promise(function(_0x35406c,_0x134b02){return db[_0x4585('0x15')][_0x4585('0x20')]({'raw':_0x49f140['options']?_0x49f140['options']['raw']===undefined?!![]:![]:!![],'where':_0x49f140[_0x4585('0x17')]?_0x49f140['options']['where']||null:null,'attributes':_0x49f140[_0x4585('0x17')]?_0x49f140[_0x4585('0x17')]['attributes']||null:null,'include':_0x49f140[_0x4585('0x17')]?_0x49f140['options'][_0x4585('0x1b')]?_[_0x4585('0x1c')](_0x49f140[_0x4585('0x17')]['include'],function(_0x5b812d){return{'model':db[_0x5b812d[_0x4585('0x1d')]],'as':_0x5b812d['as'],'attributes':_0x5b812d['attributes'],'include':_0x5b812d[_0x4585('0x1b')]?_[_0x4585('0x1c')](_0x5b812d['include'],function(_0x5b55a6){return{'model':db[_0x5b55a6[_0x4585('0x1d')]],'as':_0x5b55a6['as'],'attributes':_0x5b55a6[_0x4585('0x19')],'include':_0x5b55a6[_0x4585('0x1b')]?_[_0x4585('0x1c')](_0x5b55a6[_0x4585('0x1b')],function(_0x1e80eb){return{'model':db[_0x1e80eb['model']],'as':_0x1e80eb['as'],'attributes':_0x1e80eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x4585('0xa')](function(_0x264de9){logger[_0x4585('0xb')](_0x4585('0x1f'),_0x49f140);logger[_0x4585('0xe')]('ShowDeskAccount',_0x49f140,JSON[_0x4585('0xf')](_0x264de9));_0x35406c(_0x264de9);})['catch'](function(_0x1e8080){logger[_0x4585('0x10')](_0x4585('0x1f'),_0x1e8080[_0x4585('0x12')],_0x49f140);_0x134b02(_0x3e70e0[_0x4585('0x10')](0x1f4,_0x1e8080[_0x4585('0x12')]));});});}; \ No newline at end of file +var _0xe680=['result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','model','include','map','debug','stringify','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x44119e,_0x31cdec){var _0x333f74=function(_0x27e67e){while(--_0x27e67e){_0x44119e['push'](_0x44119e['shift']());}};_0x333f74(++_0x31cdec);}(_0xe680,0x1d9));var _0x0e68=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0xe680[_0x585d09];return _0x7d9a14;};'use strict';var _=require(_0x0e68('0x0'));var util=require(_0x0e68('0x1'));var moment=require(_0x0e68('0x2'));var BPromise=require(_0x0e68('0x3'));var rs=require(_0x0e68('0x4'));var fs=require('fs');var Redis=require(_0x0e68('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e68('0x6'));var logger=require(_0x0e68('0x7'))(_0x0e68('0x8'));var config=require(_0x0e68('0x9'));var jayson=require(_0x0e68('0xa'));var client=jayson[_0x0e68('0xb')][_0x0e68('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cf054,_0x17a2be,_0x963dfe){return new BPromise(function(_0x40ff7b,_0x560a10){return client[_0x0e68('0xd')](_0x5cf054,_0x963dfe)[_0x0e68('0xe')](function(_0x208865){logger[_0x0e68('0xf')](_0x0e68('0x10'),_0x17a2be,_0x0e68('0x11'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x17a2be,_0x0e68('0x11'),JSON['stringify'](_0x208865));if(_0x208865['error']){if(_0x208865[_0x0e68('0x12')][_0x0e68('0x13')]===0x1f4){logger['error'](_0x0e68('0x10'),_0x17a2be,_0x208865['error'][_0x0e68('0x14')]);return _0x560a10(_0x208865[_0x0e68('0x12')]['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x17a2be,_0x208865[_0x0e68('0x12')][_0x0e68('0x14')]);return _0x40ff7b(_0x208865[_0x0e68('0x12')][_0x0e68('0x14')]);}else{logger[_0x0e68('0xf')](_0x0e68('0x10'),_0x17a2be,'request\x20sent');_0x40ff7b(_0x208865[_0x0e68('0x15')]['message']);}})[_0x0e68('0x16')](function(_0x30f5aa){logger['error'](_0x0e68('0x10'),_0x17a2be,_0x30f5aa);_0x560a10(_0x30f5aa);});});}exports[_0x0e68('0x17')]=function(_0x43ec0e){var _0x49da43=this;return new Promise(function(_0x549b85,_0x4bb7af){return db[_0x0e68('0x18')][_0x0e68('0x19')]({'raw':_0x43ec0e[_0x0e68('0x1a')]?_0x43ec0e[_0x0e68('0x1a')][_0x0e68('0x1b')]===undefined?!![]:![]:!![],'where':_0x43ec0e[_0x0e68('0x1a')]?_0x43ec0e[_0x0e68('0x1a')][_0x0e68('0x1c')]||null:null,'attributes':_0x43ec0e['options']?_0x43ec0e[_0x0e68('0x1a')][_0x0e68('0x1d')]||null:null,'limit':_0x43ec0e[_0x0e68('0x1a')]?_0x43ec0e[_0x0e68('0x1a')][_0x0e68('0x1e')]||null:null,'include':_0x43ec0e[_0x0e68('0x1a')]?_0x43ec0e[_0x0e68('0x1a')]['include']?_['map'](_0x43ec0e[_0x0e68('0x1a')]['include'],function(_0x442b2d){return{'model':db[_0x442b2d[_0x0e68('0x1f')]],'as':_0x442b2d['as'],'attributes':_0x442b2d[_0x0e68('0x1d')],'include':_0x442b2d[_0x0e68('0x20')]?_['map'](_0x442b2d['include'],function(_0x2a38b5){return{'model':db[_0x2a38b5[_0x0e68('0x1f')]],'as':_0x2a38b5['as'],'attributes':_0x2a38b5[_0x0e68('0x1d')],'include':_0x2a38b5[_0x0e68('0x20')]?_[_0x0e68('0x21')](_0x2a38b5[_0x0e68('0x20')],function(_0x3d306f){return{'model':db[_0x3d306f[_0x0e68('0x1f')]],'as':_0x3d306f['as'],'attributes':_0x3d306f[_0x0e68('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0e68('0xe')](function(_0x54d612){logger[_0x0e68('0xf')](_0x0e68('0x17'),_0x43ec0e);logger[_0x0e68('0x22')](_0x0e68('0x17'),_0x43ec0e,JSON[_0x0e68('0x23')](_0x54d612));_0x549b85(_0x54d612);})[_0x0e68('0x16')](function(_0x22d731){logger['error'](_0x0e68('0x17'),_0x22d731['message'],_0x43ec0e);_0x4bb7af(_0x49da43[_0x0e68('0x12')](0x1f4,_0x22d731[_0x0e68('0x14')]));});});};exports[_0x0e68('0x24')]=function(_0x472e67){var _0xbd98c5=this;return new Promise(function(_0xccd66d,_0x45d86a){return db['DeskAccount'][_0x0e68('0x25')]({'raw':_0x472e67[_0x0e68('0x1a')]?_0x472e67['options'][_0x0e68('0x1b')]===undefined?!![]:![]:!![],'where':_0x472e67['options']?_0x472e67[_0x0e68('0x1a')][_0x0e68('0x1c')]||null:null,'attributes':_0x472e67['options']?_0x472e67['options'][_0x0e68('0x1d')]||null:null,'include':_0x472e67['options']?_0x472e67[_0x0e68('0x1a')][_0x0e68('0x20')]?_['map'](_0x472e67[_0x0e68('0x1a')][_0x0e68('0x20')],function(_0x6a6c9c){return{'model':db[_0x6a6c9c[_0x0e68('0x1f')]],'as':_0x6a6c9c['as'],'attributes':_0x6a6c9c[_0x0e68('0x1d')],'include':_0x6a6c9c['include']?_[_0x0e68('0x21')](_0x6a6c9c[_0x0e68('0x20')],function(_0x140e72){return{'model':db[_0x140e72[_0x0e68('0x1f')]],'as':_0x140e72['as'],'attributes':_0x140e72[_0x0e68('0x1d')],'include':_0x140e72[_0x0e68('0x20')]?_['map'](_0x140e72['include'],function(_0x1686ce){return{'model':db[_0x1686ce[_0x0e68('0x1f')]],'as':_0x1686ce['as'],'attributes':_0x1686ce[_0x0e68('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cf6b6){logger[_0x0e68('0xf')](_0x0e68('0x24'),_0x472e67);logger['debug'](_0x0e68('0x24'),_0x472e67,JSON[_0x0e68('0x23')](_0x1cf6b6));_0xccd66d(_0x1cf6b6);})[_0x0e68('0x16')](function(_0x41c446){logger['error'](_0x0e68('0x24'),_0x41c446[_0x0e68('0x14')],_0x472e67);_0x45d86a(_0xbd98c5[_0x0e68('0x12')](0x1f4,_0x41c446['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f1ee217..9f31865 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x4be3be,_0x3d4560){var _0x481b06=function(_0x323ff1){while(--_0x323ff1){_0x4be3be['push'](_0x4be3be['shift']());}};_0x481b06(++_0x3d4560);}(_0xedd9,0xfc));var _0x9edd=function(_0x13ec9c,_0x59dce5){_0x13ec9c=_0x13ec9c-0x0;var _0x471fc6=_0xedd9[_0x13ec9c];return _0x471fc6;};'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('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('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(_0x2883b8,_0x1fbd08){var _0x5cc52c=function(_0x424ef6){while(--_0x424ef6){_0x2883b8['push'](_0x2883b8['shift']());}};_0x5cc52c(++_0x1fbd08);}(_0x008c,0x188));var _0xc008=function(_0x51244e,_0x24c7e6){_0x51244e=_0x51244e-0x0;var _0x58d71c=_0x008c[_0x51244e];return _0x58d71c;};'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 e108728..ef36f4e 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 _0x2901=['sequelize','STRING'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2901,0x12e));var _0x1290=function(_0x1160e3,_0x5da780){_0x1160e3=_0x1160e3-0x0;var _0x4a067a=_0x2901[_0x1160e3];return _0x4a067a;};'use strict';var Sequelize=require(_0x1290('0x0'));module['exports']={'name':{'type':Sequelize[_0x1290('0x1')]},'description':{'type':Sequelize[_0x1290('0x1')]}}; \ No newline at end of file +var _0xe4a2=['sequelize','exports','STRING'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xe4a2,0xc0));var _0x2e4a=function(_0x448382,_0x160895){_0x448382=_0x448382-0x0;var _0xdd665a=_0xe4a2[_0x448382];return _0xdd665a;};'use strict';var Sequelize=require(_0x2e4a('0x0'));module[_0x2e4a('0x1')]={'name':{'type':Sequelize[_0x2e4a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 742ebb6..0d86793 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 _0x9978=['eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','DeskConfiguration','includeAll','findAll','show','params','keys','include','find','catch','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids'];(function(_0x25929f,_0x1e7561){var _0x2d1664=function(_0x1da58b){while(--_0x1da58b){_0x25929f['push'](_0x25929f['shift']());}};_0x2d1664(++_0x1e7561);}(_0x9978,0xa6));var _0x8997=function(_0x30f4cd,_0x5716f0){_0x30f4cd=_0x30f4cd-0x0;var _0x5eca31=_0x9978[_0x30f4cd];return _0x5eca31;};'use strict';var emlformat=require(_0x8997('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8997('0x1'));var jsonpatch=require(_0x8997('0x2'));var rp=require(_0x8997('0x3'));var moment=require(_0x8997('0x4'));var BPromise=require(_0x8997('0x5'));var Mustache=require(_0x8997('0x6'));var util=require('util');var path=require(_0x8997('0x7'));var sox=require(_0x8997('0x8'));var csv=require('to-csv');var ejs=require(_0x8997('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8997('0xa'));var squel=require(_0x8997('0xb'));var crypto=require(_0x8997('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8997('0xd'));var toCsv=require(_0x8997('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8997('0xf'));var authService=require(_0x8997('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8997('0x11'));var hardwareService=require(_0x8997('0x12'));var logger=require(_0x8997('0x13'))('api');var utils=require(_0x8997('0x14'));var config=require(_0x8997('0x15'));var licenseUtil=require(_0x8997('0x16'));var db=require(_0x8997('0x17'))['db'];function respondWithStatusCode(_0x5e0ce0,_0x730fcd){_0x730fcd=_0x730fcd||0xcc;return function(_0x45cf25){if(_0x45cf25){return _0x5e0ce0['sendStatus'](_0x730fcd);}return _0x5e0ce0[_0x8997('0x18')](_0x730fcd)[_0x8997('0x19')]();};}function respondWithResult(_0x53d26b,_0x49e035){_0x49e035=_0x49e035||0xc8;return function(_0x1f57e3){if(_0x1f57e3){return _0x53d26b[_0x8997('0x18')](_0x49e035)[_0x8997('0x1a')](_0x1f57e3);}};}function respondWithFilteredResult(_0x4cba46,_0x18f240){return function(_0x21c7e1){if(_0x21c7e1){var _0x39b37a=typeof _0x18f240[_0x8997('0x1b')]==='undefined'&&typeof _0x18f240[_0x8997('0x1c')]==='undefined';var _0x157447=_0x21c7e1[_0x8997('0x1d')];var _0x4a7af4=_0x39b37a?0x0:_0x18f240[_0x8997('0x1b')];var _0xa75131=_0x39b37a?_0x21c7e1[_0x8997('0x1d')]:_0x18f240[_0x8997('0x1b')]+_0x18f240[_0x8997('0x1c')];var _0x4365d0;if(_0xa75131>=_0x157447){_0xa75131=_0x157447;_0x4365d0=0xc8;}else{_0x4365d0=0xce;}_0x4cba46[_0x8997('0x18')](_0x4365d0);return _0x4cba46[_0x8997('0x1e')](_0x8997('0x1f'),_0x4a7af4+'-'+_0xa75131+'/'+_0x157447)['json'](_0x21c7e1);}return null;};}function patchUpdates(_0x265e7a){return function(_0x4acce9){try{jsonpatch[_0x8997('0x20')](_0x4acce9,_0x265e7a,!![]);}catch(_0x2c56d7){return BPromise[_0x8997('0x21')](_0x2c56d7);}return _0x4acce9['save']();};}function saveUpdates(_0x35d777,_0x279bf5){return function(_0x145302){if(_0x145302){return _0x145302[_0x8997('0x22')](_0x35d777)['then'](function(_0x5040a9){return _0x5040a9;});}return null;};}function removeEntity(_0x17d5bc,_0x3ce876){return function(_0x13cb81){if(_0x13cb81){return _0x13cb81[_0x8997('0x23')]()[_0x8997('0x24')](function(){_0x17d5bc[_0x8997('0x18')](0xcc)[_0x8997('0x19')]();});}};}function handleEntityNotFound(_0xa32c1d,_0x2943b8){return function(_0x2e17b3){if(!_0x2e17b3){_0xa32c1d[_0x8997('0x25')](0x194);}return _0x2e17b3;};}function handleError(_0x3629be,_0x439912){_0x439912=_0x439912||0x1f4;return function(_0x374488){logger[_0x8997('0x26')](_0x374488[_0x8997('0x27')]);if(_0x374488[_0x8997('0x28')]){delete _0x374488[_0x8997('0x28')];}_0x3629be['status'](_0x439912)[_0x8997('0x29')](_0x374488);};}exports['index']=function(_0xaad2ae,_0x4f37e7){var _0x2ec767={},_0x12b8a3={},_0x39638d={'count':0x0,'rows':[]};var _0x17da4=_[_0x8997('0x2a')](db['DeskConfiguration'][_0x8997('0x2b')],function(_0x3eb0cc){return{'name':_0x3eb0cc[_0x8997('0x2c')],'type':_0x3eb0cc[_0x8997('0x2d')][_0x8997('0x2e')]};});_0x12b8a3[_0x8997('0x2f')]=_['map'](_0x17da4,_0x8997('0x28'));_0x12b8a3[_0x8997('0x30')]=_['keys'](_0xaad2ae[_0x8997('0x30')]);_0x12b8a3['filters']=_['intersection'](_0x12b8a3[_0x8997('0x2f')],_0x12b8a3[_0x8997('0x30')]);_0x2ec767['attributes']=_[_0x8997('0x31')](_0x12b8a3[_0x8997('0x2f')],qs[_0x8997('0x32')](_0xaad2ae[_0x8997('0x30')][_0x8997('0x32')]));_0x2ec767['attributes']=_0x2ec767[_0x8997('0x33')][_0x8997('0x34')]?_0x2ec767[_0x8997('0x33')]:_0x12b8a3['model'];if(!_0xaad2ae[_0x8997('0x30')][_0x8997('0x35')](_0x8997('0x36'))){_0x2ec767[_0x8997('0x1c')]=qs[_0x8997('0x1c')](_0xaad2ae[_0x8997('0x30')]['limit']);_0x2ec767['offset']=qs[_0x8997('0x1b')](_0xaad2ae[_0x8997('0x30')][_0x8997('0x1b')]);}_0x2ec767[_0x8997('0x37')]=qs[_0x8997('0x38')](_0xaad2ae[_0x8997('0x30')][_0x8997('0x38')]);_0x2ec767[_0x8997('0x39')]=qs[_0x8997('0x3a')](_[_0x8997('0x3b')](_0xaad2ae[_0x8997('0x30')],_0x12b8a3[_0x8997('0x3a')]),_0x17da4);if(_0xaad2ae[_0x8997('0x30')][_0x8997('0x3c')]){_0x2ec767[_0x8997('0x39')]=_[_0x8997('0x3d')](_0x2ec767[_0x8997('0x39')],{'$or':_['map'](_0x17da4,function(_0x33b31b){if(_0x33b31b[_0x8997('0x2d')]!=='VIRTUAL'){var _0x5aea16={};_0x5aea16[_0x33b31b['name']]={'$like':'%'+_0xaad2ae[_0x8997('0x30')][_0x8997('0x3c')]+'%'};return _0x5aea16;}})});}_0x2ec767=_[_0x8997('0x3d')]({},_0x2ec767,_0xaad2ae[_0x8997('0x3e')]);var _0x1ba0f0={'where':_0x2ec767[_0x8997('0x39')]};return db[_0x8997('0x3f')][_0x8997('0x1d')](_0x1ba0f0)[_0x8997('0x24')](function(_0x142b10){_0x39638d[_0x8997('0x1d')]=_0x142b10;if(_0xaad2ae[_0x8997('0x30')][_0x8997('0x40')]){_0x2ec767['include']=[{'all':!![]}];}return db[_0x8997('0x3f')][_0x8997('0x41')](_0x2ec767);})['then'](function(_0x3265bc){_0x39638d['rows']=_0x3265bc;return _0x39638d;})[_0x8997('0x24')](respondWithFilteredResult(_0x4f37e7,_0x2ec767))['catch'](handleError(_0x4f37e7,null));};exports[_0x8997('0x42')]=function(_0x373ace,_0x483b6e){var _0xf064f4={'raw':![],'where':{'id':_0x373ace[_0x8997('0x43')]['id']}},_0x338760={};_0x338760['model']=_['keys'](db[_0x8997('0x3f')][_0x8997('0x2b')]);_0x338760[_0x8997('0x30')]=_[_0x8997('0x44')](_0x373ace['query']);_0x338760[_0x8997('0x3a')]=_[_0x8997('0x31')](_0x338760[_0x8997('0x2f')],_0x338760['query']);_0xf064f4[_0x8997('0x33')]=_['intersection'](_0x338760[_0x8997('0x2f')],qs[_0x8997('0x32')](_0x373ace[_0x8997('0x30')][_0x8997('0x32')]));_0xf064f4[_0x8997('0x33')]=_0xf064f4[_0x8997('0x33')][_0x8997('0x34')]?_0xf064f4['attributes']:_0x338760[_0x8997('0x2f')];if(_0x373ace[_0x8997('0x30')][_0x8997('0x40')]){_0xf064f4[_0x8997('0x45')]=[{'all':!![]}];}_0xf064f4=_[_0x8997('0x3d')]({},_0xf064f4,_0x373ace[_0x8997('0x3e')]);return db[_0x8997('0x3f')][_0x8997('0x46')](_0xf064f4)[_0x8997('0x24')](handleEntityNotFound(_0x483b6e,null))[_0x8997('0x24')](respondWithResult(_0x483b6e,null))[_0x8997('0x47')](handleError(_0x483b6e,null));};exports['create']=function(_0x18339c,_0x456a24){return db['DeskConfiguration'][_0x8997('0x48')](_0x18339c['body'],{})[_0x8997('0x24')](respondWithResult(_0x456a24,0xc9))[_0x8997('0x47')](handleError(_0x456a24,null));};exports['update']=function(_0x19da9b,_0x48518c){if(_0x19da9b['body']['id']){delete _0x19da9b[_0x8997('0x49')]['id'];}return db[_0x8997('0x3f')]['find']({'where':{'id':_0x19da9b[_0x8997('0x43')]['id']}})[_0x8997('0x24')](handleEntityNotFound(_0x48518c,null))['then'](saveUpdates(_0x19da9b[_0x8997('0x49')],null))[_0x8997('0x24')](respondWithResult(_0x48518c,null))[_0x8997('0x47')](handleError(_0x48518c,null));};exports[_0x8997('0x23')]=function(_0x1a46d6,_0x10113d){return db['DeskConfiguration'][_0x8997('0x46')]({'where':{'id':_0x1a46d6[_0x8997('0x43')]['id']}})[_0x8997('0x24')](handleEntityNotFound(_0x10113d,null))[_0x8997('0x24')](removeEntity(_0x10113d,null))[_0x8997('0x47')](handleError(_0x10113d,null));};exports[_0x8997('0x4a')]=function(_0x2d3735,_0x1e8d85,_0x4721ad){var _0x9a0472={};var _0x486942={};var _0x31c6dd;var _0x50ce1f;return db[_0x8997('0x3f')][_0x8997('0x4b')]({'where':{'id':_0x2d3735[_0x8997('0x43')]['id']}})[_0x8997('0x24')](handleEntityNotFound(_0x1e8d85,null))[_0x8997('0x24')](function(_0x3ff5fa){if(_0x3ff5fa){_0x31c6dd=_0x3ff5fa;_0x486942[_0x8997('0x2f')]=_['keys'](db[_0x8997('0x4c')][_0x8997('0x2b')]);_0x486942['query']=_['keys'](_0x2d3735[_0x8997('0x30')]);_0x486942[_0x8997('0x3a')]=_[_0x8997('0x31')](_0x486942[_0x8997('0x2f')],_0x486942['query']);_0x9a0472[_0x8997('0x33')]=_[_0x8997('0x31')](_0x486942[_0x8997('0x2f')],qs['fields'](_0x2d3735['query'][_0x8997('0x32')]));_0x9a0472[_0x8997('0x33')]=_0x9a0472['attributes']['length']?_0x9a0472[_0x8997('0x33')]:_0x486942[_0x8997('0x2f')];_0x9a0472[_0x8997('0x37')]=qs[_0x8997('0x38')](_0x2d3735[_0x8997('0x30')][_0x8997('0x38')]);_0x9a0472[_0x8997('0x39')]=qs[_0x8997('0x3a')](_['pick'](_0x2d3735[_0x8997('0x30')],_0x486942[_0x8997('0x3a')]));if(_0x2d3735[_0x8997('0x30')][_0x8997('0x3c')]){_0x9a0472[_0x8997('0x39')]=_[_0x8997('0x3d')](_0x9a0472[_0x8997('0x39')],{'$or':_[_0x8997('0x2a')](_0x9a0472[_0x8997('0x33')],function(_0xfd6d54){var _0x26e000={};_0x26e000[_0xfd6d54]={'$like':'%'+_0x2d3735['query'][_0x8997('0x3c')]+'%'};return _0x26e000;})});}_0x9a0472=_['merge']({},_0x9a0472,_0x2d3735[_0x8997('0x3e')]);return _0x31c6dd['getFields'](_0x9a0472);}})[_0x8997('0x24')](function(_0x3c0567){if(_0x3c0567){_0x50ce1f=_0x3c0567[_0x8997('0x34')];if(!_0x2d3735[_0x8997('0x30')][_0x8997('0x35')](_0x8997('0x36'))){_0x9a0472[_0x8997('0x1c')]=qs['limit'](_0x2d3735[_0x8997('0x30')]['limit']);_0x9a0472[_0x8997('0x1b')]=qs[_0x8997('0x1b')](_0x2d3735['query']['offset']);}return _0x31c6dd[_0x8997('0x4a')](_0x9a0472);}})[_0x8997('0x24')](function(_0xb8674){if(_0xb8674){return _0xb8674?{'count':_0x50ce1f,'rows':_0xb8674}:null;}})[_0x8997('0x24')](respondWithResult(_0x1e8d85,null))[_0x8997('0x47')](handleError(_0x1e8d85,null));};exports[_0x8997('0x4d')]=function(_0x37325b,_0x1e67bf,_0x1d456b){var _0xa21f22={};var _0x29cbc3={};var _0x4e7124;var _0x2a9aa6;return db[_0x8997('0x3f')]['findOne']({'where':{'id':_0x37325b['params']['id']}})[_0x8997('0x24')](handleEntityNotFound(_0x1e67bf,null))[_0x8997('0x24')](function(_0x1316a1){if(_0x1316a1){_0x4e7124=_0x1316a1;_0x29cbc3[_0x8997('0x2f')]=_[_0x8997('0x44')](db['DeskField'][_0x8997('0x2b')]);_0x29cbc3['query']=_['keys'](_0x37325b[_0x8997('0x30')]);_0x29cbc3[_0x8997('0x3a')]=_['intersection'](_0x29cbc3[_0x8997('0x2f')],_0x29cbc3['query']);_0xa21f22['attributes']=_['intersection'](_0x29cbc3['model'],qs[_0x8997('0x32')](_0x37325b[_0x8997('0x30')][_0x8997('0x32')]));_0xa21f22[_0x8997('0x33')]=_0xa21f22[_0x8997('0x33')]['length']?_0xa21f22[_0x8997('0x33')]:_0x29cbc3[_0x8997('0x2f')];_0xa21f22['order']=qs[_0x8997('0x38')](_0x37325b[_0x8997('0x30')][_0x8997('0x38')]);_0xa21f22[_0x8997('0x39')]=qs[_0x8997('0x3a')](_[_0x8997('0x3b')](_0x37325b['query'],_0x29cbc3[_0x8997('0x3a')]));if(_0x37325b[_0x8997('0x30')][_0x8997('0x3c')]){_0xa21f22[_0x8997('0x39')]=_['merge'](_0xa21f22['where'],{'$or':_[_0x8997('0x2a')](_0xa21f22[_0x8997('0x33')],function(_0x582465){var _0x452a74={};_0x452a74[_0x582465]={'$like':'%'+_0x37325b['query'][_0x8997('0x3c')]+'%'};return _0x452a74;})});}_0xa21f22=_[_0x8997('0x3d')]({},_0xa21f22,_0x37325b[_0x8997('0x3e')]);return _0x4e7124[_0x8997('0x4d')](_0xa21f22);}})[_0x8997('0x24')](function(_0x3f2524){if(_0x3f2524){_0x2a9aa6=_0x3f2524[_0x8997('0x34')];if(!_0x37325b[_0x8997('0x30')]['hasOwnProperty']('nolimit')){_0xa21f22[_0x8997('0x1c')]=qs[_0x8997('0x1c')](_0x37325b[_0x8997('0x30')]['limit']);_0xa21f22[_0x8997('0x1b')]=qs['offset'](_0x37325b['query']['offset']);}return _0x4e7124[_0x8997('0x4d')](_0xa21f22);}})[_0x8997('0x24')](function(_0x163680){if(_0x163680){return _0x163680?{'count':_0x2a9aa6,'rows':_0x163680}:null;}})[_0x8997('0x24')](respondWithResult(_0x1e67bf,null))['catch'](handleError(_0x1e67bf,null));};exports['getDescriptions']=function(_0x3c77ff,_0x4ebf28,_0x2a184b){var _0x296933={};var _0x5c33eb={};var _0x137508;var _0x11a88b;return db[_0x8997('0x3f')][_0x8997('0x4b')]({'where':{'id':_0x3c77ff[_0x8997('0x43')]['id']}})[_0x8997('0x24')](handleEntityNotFound(_0x4ebf28,null))[_0x8997('0x24')](function(_0x35e51c){if(_0x35e51c){_0x137508=_0x35e51c;_0x5c33eb[_0x8997('0x2f')]=_[_0x8997('0x44')](db[_0x8997('0x4c')][_0x8997('0x2b')]);_0x5c33eb[_0x8997('0x30')]=_[_0x8997('0x44')](_0x3c77ff['query']);_0x5c33eb[_0x8997('0x3a')]=_[_0x8997('0x31')](_0x5c33eb[_0x8997('0x2f')],_0x5c33eb[_0x8997('0x30')]);_0x296933[_0x8997('0x33')]=_[_0x8997('0x31')](_0x5c33eb['model'],qs[_0x8997('0x32')](_0x3c77ff[_0x8997('0x30')][_0x8997('0x32')]));_0x296933['attributes']=_0x296933[_0x8997('0x33')][_0x8997('0x34')]?_0x296933[_0x8997('0x33')]:_0x5c33eb[_0x8997('0x2f')];_0x296933['order']=qs[_0x8997('0x38')](_0x3c77ff['query'][_0x8997('0x38')]);_0x296933[_0x8997('0x39')]=qs[_0x8997('0x3a')](_[_0x8997('0x3b')](_0x3c77ff['query'],_0x5c33eb[_0x8997('0x3a')]));if(_0x3c77ff[_0x8997('0x30')]['filter']){_0x296933[_0x8997('0x39')]=_['merge'](_0x296933['where'],{'$or':_[_0x8997('0x2a')](_0x296933['attributes'],function(_0x90f1c){var _0xf2329a={};_0xf2329a[_0x90f1c]={'$like':'%'+_0x3c77ff['query'][_0x8997('0x3c')]+'%'};return _0xf2329a;})});}_0x296933=_[_0x8997('0x3d')]({},_0x296933,_0x3c77ff[_0x8997('0x3e')]);return _0x137508[_0x8997('0x4e')](_0x296933);}})[_0x8997('0x24')](function(_0x5d1591){if(_0x5d1591){_0x11a88b=_0x5d1591[_0x8997('0x34')];if(!_0x3c77ff[_0x8997('0x30')][_0x8997('0x35')](_0x8997('0x36'))){_0x296933[_0x8997('0x1c')]=qs[_0x8997('0x1c')](_0x3c77ff[_0x8997('0x30')][_0x8997('0x1c')]);_0x296933[_0x8997('0x1b')]=qs[_0x8997('0x1b')](_0x3c77ff[_0x8997('0x30')]['offset']);}return _0x137508[_0x8997('0x4e')](_0x296933);}})[_0x8997('0x24')](function(_0x2f9993){if(_0x2f9993){return _0x2f9993?{'count':_0x11a88b,'rows':_0x2f9993}:null;}})['then'](respondWithResult(_0x4ebf28,null))[_0x8997('0x47')](handleError(_0x4ebf28,null));};exports[_0x8997('0x4f')]=function(_0x13801c,_0x5c2694,_0x2285bb){var _0x5e9d62={};var _0x3ded3e={};var _0xa5acf1;var _0x5cb354;return db[_0x8997('0x3f')][_0x8997('0x4b')]({'where':{'id':_0x13801c[_0x8997('0x43')]['id']}})[_0x8997('0x24')](handleEntityNotFound(_0x5c2694,null))[_0x8997('0x24')](function(_0x5cd7d1){if(_0x5cd7d1){_0xa5acf1=_0x5cd7d1;_0x3ded3e[_0x8997('0x2f')]=_[_0x8997('0x44')](db[_0x8997('0x50')][_0x8997('0x2b')]);_0x3ded3e['query']=_[_0x8997('0x44')](_0x13801c['query']);_0x3ded3e[_0x8997('0x3a')]=_['intersection'](_0x3ded3e[_0x8997('0x2f')],_0x3ded3e[_0x8997('0x30')]);_0x5e9d62[_0x8997('0x33')]=_[_0x8997('0x31')](_0x3ded3e[_0x8997('0x2f')],qs[_0x8997('0x32')](_0x13801c[_0x8997('0x30')][_0x8997('0x32')]));_0x5e9d62['attributes']=_0x5e9d62[_0x8997('0x33')][_0x8997('0x34')]?_0x5e9d62['attributes']:_0x3ded3e[_0x8997('0x2f')];_0x5e9d62['order']=qs[_0x8997('0x38')](_0x13801c[_0x8997('0x30')][_0x8997('0x38')]);_0x5e9d62['where']=qs['filters'](_[_0x8997('0x3b')](_0x13801c[_0x8997('0x30')],_0x3ded3e[_0x8997('0x3a')]));if(_0x13801c['query'][_0x8997('0x3c')]){_0x5e9d62[_0x8997('0x39')]=_[_0x8997('0x3d')](_0x5e9d62['where'],{'$or':_[_0x8997('0x2a')](_0x5e9d62[_0x8997('0x33')],function(_0x30f5e9){var _0x10302a={};_0x10302a[_0x30f5e9]={'$like':'%'+_0x13801c['query'][_0x8997('0x3c')]+'%'};return _0x10302a;})});}_0x5e9d62=_[_0x8997('0x3d')]({},_0x5e9d62,_0x13801c[_0x8997('0x3e')]);return _0xa5acf1[_0x8997('0x4f')](_0x5e9d62);}})[_0x8997('0x24')](function(_0x129fe1){if(_0x129fe1){_0x5cb354=_0x129fe1[_0x8997('0x34')];if(!_0x13801c[_0x8997('0x30')][_0x8997('0x35')]('nolimit')){_0x5e9d62['limit']=qs[_0x8997('0x1c')](_0x13801c['query'][_0x8997('0x1c')]);_0x5e9d62['offset']=qs[_0x8997('0x1b')](_0x13801c[_0x8997('0x30')]['offset']);}return _0xa5acf1[_0x8997('0x4f')](_0x5e9d62);}})[_0x8997('0x24')](function(_0x53b2c3){if(_0x53b2c3){return _0x53b2c3?{'count':_0x5cb354,'rows':_0x53b2c3}:null;}})['then'](respondWithResult(_0x5c2694,null))[_0x8997('0x47')](handleError(_0x5c2694,null));};exports[_0x8997('0x51')]=function(_0x27f5da,_0x3e9694,_0x5c479e){if(_0x27f5da['body']['id']){delete _0x27f5da['body']['id'];}return db[_0x8997('0x3f')][_0x8997('0x4b')]({'where':{'id':_0x27f5da['params']['id']}})[_0x8997('0x24')](handleEntityNotFound(_0x3e9694,null))[_0x8997('0x24')](function(_0x1ede12){if(_0x1ede12){return _0x1ede12[_0x8997('0x51')](_0x27f5da[_0x8997('0x49')][_0x8997('0x52')]||[]);}return null;})[_0x8997('0x24')](respondWithResult(_0x3e9694,null))[_0x8997('0x47')](handleError(_0x3e9694,null));}; \ No newline at end of file +var _0x7b2e=['length','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','include','findAll','then','catch','show','params','rawAttributes','includeAll','options','find','create','body','getFields','findOne','DeskField'];(function(_0x3f43f0,_0x314b58){var _0x387370=function(_0x4343f7){while(--_0x4343f7){_0x3f43f0['push'](_0x3f43f0['shift']());}};_0x387370(++_0x314b58);}(_0x7b2e,0xb2));var _0xe7b2=function(_0xb66f92,_0x301f99){_0xb66f92=_0xb66f92-0x0;var _0x344d2d=_0x7b2e[_0xb66f92];return _0x344d2d;};'use strict';var emlformat=require(_0xe7b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7b2('0x1'));var jsonpatch=require(_0xe7b2('0x2'));var rp=require(_0xe7b2('0x3'));var moment=require(_0xe7b2('0x4'));var BPromise=require(_0xe7b2('0x5'));var Mustache=require(_0xe7b2('0x6'));var util=require(_0xe7b2('0x7'));var path=require(_0xe7b2('0x8'));var sox=require(_0xe7b2('0x9'));var csv=require(_0xe7b2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7b2('0xb'));var _=require(_0xe7b2('0xc'));var squel=require(_0xe7b2('0xd'));var crypto=require(_0xe7b2('0xe'));var jsforce=require(_0xe7b2('0xf'));var deskjs=require(_0xe7b2('0x10'));var toCsv=require(_0xe7b2('0xa'));var querystring=require(_0xe7b2('0x11'));var Papa=require('papaparse');var Redis=require(_0xe7b2('0x12'));var authService=require(_0xe7b2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe7b2('0x14'));var utils=require(_0xe7b2('0x15'));var config=require(_0xe7b2('0x16'));var licenseUtil=require(_0xe7b2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fa131,_0x44c3e4){_0x44c3e4=_0x44c3e4||0xcc;return function(_0x5b843e){if(_0x5b843e){return _0x4fa131[_0xe7b2('0x18')](_0x44c3e4);}return _0x4fa131[_0xe7b2('0x19')](_0x44c3e4)[_0xe7b2('0x1a')]();};}function respondWithResult(_0x14e046,_0x1478d2){_0x1478d2=_0x1478d2||0xc8;return function(_0x30d762){if(_0x30d762){return _0x14e046['status'](_0x1478d2)[_0xe7b2('0x1b')](_0x30d762);}};}function respondWithFilteredResult(_0x427a1c,_0x49eba0){return function(_0x295b4a){if(_0x295b4a){var _0x2bc3bf=typeof _0x49eba0[_0xe7b2('0x1c')]===_0xe7b2('0x1d')&&typeof _0x49eba0[_0xe7b2('0x1e')]==='undefined';var _0xd88af7=_0x295b4a[_0xe7b2('0x1f')];var _0x2ec8ff=_0x2bc3bf?0x0:_0x49eba0[_0xe7b2('0x1c')];var _0x3a98af=_0x2bc3bf?_0x295b4a['count']:_0x49eba0[_0xe7b2('0x1c')]+_0x49eba0['limit'];var _0x1f255c;if(_0x3a98af>=_0xd88af7){_0x3a98af=_0xd88af7;_0x1f255c=0xc8;}else{_0x1f255c=0xce;}_0x427a1c['status'](_0x1f255c);return _0x427a1c[_0xe7b2('0x20')](_0xe7b2('0x21'),_0x2ec8ff+'-'+_0x3a98af+'/'+_0xd88af7)[_0xe7b2('0x1b')](_0x295b4a);}return null;};}function patchUpdates(_0x10f49c){return function(_0x59a60c){try{jsonpatch[_0xe7b2('0x22')](_0x59a60c,_0x10f49c,!![]);}catch(_0x1e5edf){return BPromise[_0xe7b2('0x23')](_0x1e5edf);}return _0x59a60c['save']();};}function saveUpdates(_0x3e2f2c,_0x52f452){return function(_0x205a01){if(_0x205a01){return _0x205a01[_0xe7b2('0x24')](_0x3e2f2c)['then'](function(_0x3a1701){return _0x3a1701;});}return null;};}function removeEntity(_0x5ce5df,_0x5cb5b5){return function(_0x1c9ff0){if(_0x1c9ff0){return _0x1c9ff0[_0xe7b2('0x25')]()['then'](function(){_0x5ce5df[_0xe7b2('0x19')](0xcc)[_0xe7b2('0x1a')]();});}};}function handleEntityNotFound(_0x5b6c83,_0x55e92a){return function(_0x38ebe8){if(!_0x38ebe8){_0x5b6c83[_0xe7b2('0x18')](0x194);}return _0x38ebe8;};}function handleError(_0x2164b1,_0x31a746){_0x31a746=_0x31a746||0x1f4;return function(_0x3c4791){logger[_0xe7b2('0x26')](_0x3c4791[_0xe7b2('0x27')]);if(_0x3c4791['name']){delete _0x3c4791[_0xe7b2('0x28')];}_0x2164b1[_0xe7b2('0x19')](_0x31a746)[_0xe7b2('0x29')](_0x3c4791);};}exports[_0xe7b2('0x2a')]=function(_0x119c1f,_0x2a51c6){var _0x2a0260={},_0x16c77f={},_0xfee812={'count':0x0,'rows':[]};var _0x203439=_[_0xe7b2('0x2b')](db[_0xe7b2('0x2c')]['rawAttributes'],function(_0xab1660){return{'name':_0xab1660[_0xe7b2('0x2d')],'type':_0xab1660[_0xe7b2('0x2e')][_0xe7b2('0x2f')]};});_0x16c77f[_0xe7b2('0x30')]=_['map'](_0x203439,_0xe7b2('0x28'));_0x16c77f['query']=_[_0xe7b2('0x31')](_0x119c1f[_0xe7b2('0x32')]);_0x16c77f[_0xe7b2('0x33')]=_[_0xe7b2('0x34')](_0x16c77f[_0xe7b2('0x30')],_0x16c77f[_0xe7b2('0x32')]);_0x2a0260[_0xe7b2('0x35')]=_[_0xe7b2('0x34')](_0x16c77f[_0xe7b2('0x30')],qs[_0xe7b2('0x36')](_0x119c1f[_0xe7b2('0x32')][_0xe7b2('0x36')]));_0x2a0260[_0xe7b2('0x35')]=_0x2a0260[_0xe7b2('0x35')]['length']?_0x2a0260['attributes']:_0x16c77f[_0xe7b2('0x30')];if(!_0x119c1f['query']['hasOwnProperty'](_0xe7b2('0x37'))){_0x2a0260['limit']=qs[_0xe7b2('0x1e')](_0x119c1f[_0xe7b2('0x32')][_0xe7b2('0x1e')]);_0x2a0260[_0xe7b2('0x1c')]=qs[_0xe7b2('0x1c')](_0x119c1f[_0xe7b2('0x32')]['offset']);}_0x2a0260[_0xe7b2('0x38')]=qs['sort'](_0x119c1f['query'][_0xe7b2('0x39')]);_0x2a0260['where']=qs[_0xe7b2('0x33')](_['pick'](_0x119c1f['query'],_0x16c77f[_0xe7b2('0x33')]),_0x203439);if(_0x119c1f[_0xe7b2('0x32')]['filter']){_0x2a0260[_0xe7b2('0x3a')]=_[_0xe7b2('0x3b')](_0x2a0260[_0xe7b2('0x3a')],{'$or':_[_0xe7b2('0x2b')](_0x203439,function(_0x469176){if(_0x469176['type']!==_0xe7b2('0x3c')){var _0x2c36f3={};_0x2c36f3[_0x469176['name']]={'$like':'%'+_0x119c1f[_0xe7b2('0x32')][_0xe7b2('0x3d')]+'%'};return _0x2c36f3;}})});}_0x2a0260=_['merge']({},_0x2a0260,_0x119c1f['options']);var _0x3f86b7={'where':_0x2a0260[_0xe7b2('0x3a')]};return db[_0xe7b2('0x2c')][_0xe7b2('0x1f')](_0x3f86b7)['then'](function(_0x4dfc08){_0xfee812['count']=_0x4dfc08;if(_0x119c1f[_0xe7b2('0x32')]['includeAll']){_0x2a0260[_0xe7b2('0x3e')]=[{'all':!![]}];}return db[_0xe7b2('0x2c')][_0xe7b2('0x3f')](_0x2a0260);})[_0xe7b2('0x40')](function(_0x52072d){_0xfee812['rows']=_0x52072d;return _0xfee812;})[_0xe7b2('0x40')](respondWithFilteredResult(_0x2a51c6,_0x2a0260))[_0xe7b2('0x41')](handleError(_0x2a51c6,null));};exports[_0xe7b2('0x42')]=function(_0x3d8b40,_0x4fb644){var _0x54c89f={'raw':![],'where':{'id':_0x3d8b40[_0xe7b2('0x43')]['id']}},_0x233644={};_0x233644['model']=_['keys'](db[_0xe7b2('0x2c')][_0xe7b2('0x44')]);_0x233644['query']=_[_0xe7b2('0x31')](_0x3d8b40[_0xe7b2('0x32')]);_0x233644[_0xe7b2('0x33')]=_[_0xe7b2('0x34')](_0x233644['model'],_0x233644['query']);_0x54c89f[_0xe7b2('0x35')]=_[_0xe7b2('0x34')](_0x233644[_0xe7b2('0x30')],qs[_0xe7b2('0x36')](_0x3d8b40[_0xe7b2('0x32')][_0xe7b2('0x36')]));_0x54c89f[_0xe7b2('0x35')]=_0x54c89f[_0xe7b2('0x35')]['length']?_0x54c89f[_0xe7b2('0x35')]:_0x233644[_0xe7b2('0x30')];if(_0x3d8b40[_0xe7b2('0x32')][_0xe7b2('0x45')]){_0x54c89f[_0xe7b2('0x3e')]=[{'all':!![]}];}_0x54c89f=_[_0xe7b2('0x3b')]({},_0x54c89f,_0x3d8b40[_0xe7b2('0x46')]);return db['DeskConfiguration'][_0xe7b2('0x47')](_0x54c89f)[_0xe7b2('0x40')](handleEntityNotFound(_0x4fb644,null))['then'](respondWithResult(_0x4fb644,null))[_0xe7b2('0x41')](handleError(_0x4fb644,null));};exports[_0xe7b2('0x48')]=function(_0x3692e5,_0x324a61){return db[_0xe7b2('0x2c')][_0xe7b2('0x48')](_0x3692e5[_0xe7b2('0x49')],{})[_0xe7b2('0x40')](respondWithResult(_0x324a61,0xc9))[_0xe7b2('0x41')](handleError(_0x324a61,null));};exports[_0xe7b2('0x24')]=function(_0x4fc401,_0x13fc46){if(_0x4fc401[_0xe7b2('0x49')]['id']){delete _0x4fc401[_0xe7b2('0x49')]['id'];}return db[_0xe7b2('0x2c')]['find']({'where':{'id':_0x4fc401[_0xe7b2('0x43')]['id']}})['then'](handleEntityNotFound(_0x13fc46,null))['then'](saveUpdates(_0x4fc401['body'],null))['then'](respondWithResult(_0x13fc46,null))[_0xe7b2('0x41')](handleError(_0x13fc46,null));};exports[_0xe7b2('0x25')]=function(_0x3fa92f,_0x454ed8){return db[_0xe7b2('0x2c')][_0xe7b2('0x47')]({'where':{'id':_0x3fa92f[_0xe7b2('0x43')]['id']}})[_0xe7b2('0x40')](handleEntityNotFound(_0x454ed8,null))['then'](removeEntity(_0x454ed8,null))[_0xe7b2('0x41')](handleError(_0x454ed8,null));};exports[_0xe7b2('0x4a')]=function(_0xa3c0a3,_0x1f022a,_0x47076d){var _0x466412={};var _0x473c64={};var _0x53408a;var _0x4cf4f6;return db[_0xe7b2('0x2c')][_0xe7b2('0x4b')]({'where':{'id':_0xa3c0a3[_0xe7b2('0x43')]['id']}})[_0xe7b2('0x40')](handleEntityNotFound(_0x1f022a,null))[_0xe7b2('0x40')](function(_0x2087b1){if(_0x2087b1){_0x53408a=_0x2087b1;_0x473c64['model']=_[_0xe7b2('0x31')](db[_0xe7b2('0x4c')][_0xe7b2('0x44')]);_0x473c64[_0xe7b2('0x32')]=_[_0xe7b2('0x31')](_0xa3c0a3[_0xe7b2('0x32')]);_0x473c64[_0xe7b2('0x33')]=_[_0xe7b2('0x34')](_0x473c64[_0xe7b2('0x30')],_0x473c64[_0xe7b2('0x32')]);_0x466412[_0xe7b2('0x35')]=_[_0xe7b2('0x34')](_0x473c64[_0xe7b2('0x30')],qs['fields'](_0xa3c0a3[_0xe7b2('0x32')][_0xe7b2('0x36')]));_0x466412[_0xe7b2('0x35')]=_0x466412[_0xe7b2('0x35')][_0xe7b2('0x4d')]?_0x466412[_0xe7b2('0x35')]:_0x473c64[_0xe7b2('0x30')];_0x466412['order']=qs[_0xe7b2('0x39')](_0xa3c0a3[_0xe7b2('0x32')][_0xe7b2('0x39')]);_0x466412['where']=qs[_0xe7b2('0x33')](_[_0xe7b2('0x4e')](_0xa3c0a3['query'],_0x473c64['filters']));if(_0xa3c0a3[_0xe7b2('0x32')][_0xe7b2('0x3d')]){_0x466412[_0xe7b2('0x3a')]=_[_0xe7b2('0x3b')](_0x466412[_0xe7b2('0x3a')],{'$or':_[_0xe7b2('0x2b')](_0x466412[_0xe7b2('0x35')],function(_0x381dcb){var _0x2e750e={};_0x2e750e[_0x381dcb]={'$like':'%'+_0xa3c0a3[_0xe7b2('0x32')][_0xe7b2('0x3d')]+'%'};return _0x2e750e;})});}_0x466412=_[_0xe7b2('0x3b')]({},_0x466412,_0xa3c0a3[_0xe7b2('0x46')]);return _0x53408a['getFields'](_0x466412);}})[_0xe7b2('0x40')](function(_0x1a0fc3){if(_0x1a0fc3){_0x4cf4f6=_0x1a0fc3['length'];if(!_0xa3c0a3['query'][_0xe7b2('0x4f')](_0xe7b2('0x37'))){_0x466412[_0xe7b2('0x1e')]=qs[_0xe7b2('0x1e')](_0xa3c0a3[_0xe7b2('0x32')][_0xe7b2('0x1e')]);_0x466412[_0xe7b2('0x1c')]=qs[_0xe7b2('0x1c')](_0xa3c0a3['query']['offset']);}return _0x53408a[_0xe7b2('0x4a')](_0x466412);}})['then'](function(_0x536f0f){if(_0x536f0f){return _0x536f0f?{'count':_0x4cf4f6,'rows':_0x536f0f}:null;}})[_0xe7b2('0x40')](respondWithResult(_0x1f022a,null))['catch'](handleError(_0x1f022a,null));};exports[_0xe7b2('0x50')]=function(_0x45e189,_0x555c4f,_0x952b93){var _0x5d1f5a={};var _0xf210bd={};var _0x93ea6d;var _0x2352e9;return db[_0xe7b2('0x2c')][_0xe7b2('0x4b')]({'where':{'id':_0x45e189[_0xe7b2('0x43')]['id']}})['then'](handleEntityNotFound(_0x555c4f,null))[_0xe7b2('0x40')](function(_0x13cf4c){if(_0x13cf4c){_0x93ea6d=_0x13cf4c;_0xf210bd[_0xe7b2('0x30')]=_[_0xe7b2('0x31')](db[_0xe7b2('0x4c')][_0xe7b2('0x44')]);_0xf210bd[_0xe7b2('0x32')]=_[_0xe7b2('0x31')](_0x45e189[_0xe7b2('0x32')]);_0xf210bd[_0xe7b2('0x33')]=_[_0xe7b2('0x34')](_0xf210bd[_0xe7b2('0x30')],_0xf210bd['query']);_0x5d1f5a[_0xe7b2('0x35')]=_[_0xe7b2('0x34')](_0xf210bd[_0xe7b2('0x30')],qs[_0xe7b2('0x36')](_0x45e189[_0xe7b2('0x32')]['fields']));_0x5d1f5a[_0xe7b2('0x35')]=_0x5d1f5a[_0xe7b2('0x35')][_0xe7b2('0x4d')]?_0x5d1f5a['attributes']:_0xf210bd[_0xe7b2('0x30')];_0x5d1f5a[_0xe7b2('0x38')]=qs[_0xe7b2('0x39')](_0x45e189[_0xe7b2('0x32')][_0xe7b2('0x39')]);_0x5d1f5a[_0xe7b2('0x3a')]=qs['filters'](_[_0xe7b2('0x4e')](_0x45e189[_0xe7b2('0x32')],_0xf210bd[_0xe7b2('0x33')]));if(_0x45e189[_0xe7b2('0x32')][_0xe7b2('0x3d')]){_0x5d1f5a[_0xe7b2('0x3a')]=_[_0xe7b2('0x3b')](_0x5d1f5a[_0xe7b2('0x3a')],{'$or':_[_0xe7b2('0x2b')](_0x5d1f5a[_0xe7b2('0x35')],function(_0x2820bb){var _0x2c65c7={};_0x2c65c7[_0x2820bb]={'$like':'%'+_0x45e189['query'][_0xe7b2('0x3d')]+'%'};return _0x2c65c7;})});}_0x5d1f5a=_[_0xe7b2('0x3b')]({},_0x5d1f5a,_0x45e189['options']);return _0x93ea6d[_0xe7b2('0x50')](_0x5d1f5a);}})['then'](function(_0x2b4e04){if(_0x2b4e04){_0x2352e9=_0x2b4e04[_0xe7b2('0x4d')];if(!_0x45e189[_0xe7b2('0x32')][_0xe7b2('0x4f')](_0xe7b2('0x37'))){_0x5d1f5a[_0xe7b2('0x1e')]=qs[_0xe7b2('0x1e')](_0x45e189[_0xe7b2('0x32')][_0xe7b2('0x1e')]);_0x5d1f5a[_0xe7b2('0x1c')]=qs['offset'](_0x45e189[_0xe7b2('0x32')][_0xe7b2('0x1c')]);}return _0x93ea6d[_0xe7b2('0x50')](_0x5d1f5a);}})[_0xe7b2('0x40')](function(_0x3a9cd5){if(_0x3a9cd5){return _0x3a9cd5?{'count':_0x2352e9,'rows':_0x3a9cd5}:null;}})[_0xe7b2('0x40')](respondWithResult(_0x555c4f,null))[_0xe7b2('0x41')](handleError(_0x555c4f,null));};exports[_0xe7b2('0x51')]=function(_0x5c1551,_0x3417a6,_0x4d01fd){var _0x236f1e={};var _0xec3200={};var _0x46859c;var _0x2eda03;return db['DeskConfiguration'][_0xe7b2('0x4b')]({'where':{'id':_0x5c1551[_0xe7b2('0x43')]['id']}})[_0xe7b2('0x40')](handleEntityNotFound(_0x3417a6,null))[_0xe7b2('0x40')](function(_0x22932e){if(_0x22932e){_0x46859c=_0x22932e;_0xec3200[_0xe7b2('0x30')]=_['keys'](db[_0xe7b2('0x4c')][_0xe7b2('0x44')]);_0xec3200['query']=_['keys'](_0x5c1551[_0xe7b2('0x32')]);_0xec3200[_0xe7b2('0x33')]=_[_0xe7b2('0x34')](_0xec3200[_0xe7b2('0x30')],_0xec3200[_0xe7b2('0x32')]);_0x236f1e['attributes']=_['intersection'](_0xec3200[_0xe7b2('0x30')],qs[_0xe7b2('0x36')](_0x5c1551[_0xe7b2('0x32')][_0xe7b2('0x36')]));_0x236f1e[_0xe7b2('0x35')]=_0x236f1e[_0xe7b2('0x35')][_0xe7b2('0x4d')]?_0x236f1e[_0xe7b2('0x35')]:_0xec3200[_0xe7b2('0x30')];_0x236f1e[_0xe7b2('0x38')]=qs[_0xe7b2('0x39')](_0x5c1551[_0xe7b2('0x32')]['sort']);_0x236f1e[_0xe7b2('0x3a')]=qs['filters'](_[_0xe7b2('0x4e')](_0x5c1551[_0xe7b2('0x32')],_0xec3200[_0xe7b2('0x33')]));if(_0x5c1551['query'][_0xe7b2('0x3d')]){_0x236f1e[_0xe7b2('0x3a')]=_[_0xe7b2('0x3b')](_0x236f1e[_0xe7b2('0x3a')],{'$or':_['map'](_0x236f1e[_0xe7b2('0x35')],function(_0x1c8da3){var _0x425ada={};_0x425ada[_0x1c8da3]={'$like':'%'+_0x5c1551[_0xe7b2('0x32')][_0xe7b2('0x3d')]+'%'};return _0x425ada;})});}_0x236f1e=_[_0xe7b2('0x3b')]({},_0x236f1e,_0x5c1551[_0xe7b2('0x46')]);return _0x46859c['getDescriptions'](_0x236f1e);}})[_0xe7b2('0x40')](function(_0x1d3821){if(_0x1d3821){_0x2eda03=_0x1d3821[_0xe7b2('0x4d')];if(!_0x5c1551[_0xe7b2('0x32')][_0xe7b2('0x4f')](_0xe7b2('0x37'))){_0x236f1e[_0xe7b2('0x1e')]=qs[_0xe7b2('0x1e')](_0x5c1551[_0xe7b2('0x32')]['limit']);_0x236f1e[_0xe7b2('0x1c')]=qs[_0xe7b2('0x1c')](_0x5c1551[_0xe7b2('0x32')]['offset']);}return _0x46859c[_0xe7b2('0x51')](_0x236f1e);}})[_0xe7b2('0x40')](function(_0x378c87){if(_0x378c87){return _0x378c87?{'count':_0x2eda03,'rows':_0x378c87}:null;}})[_0xe7b2('0x40')](respondWithResult(_0x3417a6,null))[_0xe7b2('0x41')](handleError(_0x3417a6,null));};exports[_0xe7b2('0x52')]=function(_0x2e85b1,_0x16050e,_0x3ef21c){var _0x35185b={};var _0x3100d4={};var _0x2e8671;var _0x7cf9a;return db[_0xe7b2('0x2c')][_0xe7b2('0x4b')]({'where':{'id':_0x2e85b1[_0xe7b2('0x43')]['id']}})['then'](handleEntityNotFound(_0x16050e,null))[_0xe7b2('0x40')](function(_0x1b86e2){if(_0x1b86e2){_0x2e8671=_0x1b86e2;_0x3100d4[_0xe7b2('0x30')]=_[_0xe7b2('0x31')](db['Tag'][_0xe7b2('0x44')]);_0x3100d4[_0xe7b2('0x32')]=_[_0xe7b2('0x31')](_0x2e85b1[_0xe7b2('0x32')]);_0x3100d4[_0xe7b2('0x33')]=_[_0xe7b2('0x34')](_0x3100d4[_0xe7b2('0x30')],_0x3100d4['query']);_0x35185b[_0xe7b2('0x35')]=_[_0xe7b2('0x34')](_0x3100d4[_0xe7b2('0x30')],qs[_0xe7b2('0x36')](_0x2e85b1[_0xe7b2('0x32')]['fields']));_0x35185b[_0xe7b2('0x35')]=_0x35185b[_0xe7b2('0x35')][_0xe7b2('0x4d')]?_0x35185b[_0xe7b2('0x35')]:_0x3100d4['model'];_0x35185b[_0xe7b2('0x38')]=qs[_0xe7b2('0x39')](_0x2e85b1[_0xe7b2('0x32')][_0xe7b2('0x39')]);_0x35185b['where']=qs[_0xe7b2('0x33')](_[_0xe7b2('0x4e')](_0x2e85b1[_0xe7b2('0x32')],_0x3100d4['filters']));if(_0x2e85b1[_0xe7b2('0x32')][_0xe7b2('0x3d')]){_0x35185b[_0xe7b2('0x3a')]=_[_0xe7b2('0x3b')](_0x35185b[_0xe7b2('0x3a')],{'$or':_[_0xe7b2('0x2b')](_0x35185b[_0xe7b2('0x35')],function(_0x58c7d8){var _0x40891b={};_0x40891b[_0x58c7d8]={'$like':'%'+_0x2e85b1[_0xe7b2('0x32')]['filter']+'%'};return _0x40891b;})});}_0x35185b=_[_0xe7b2('0x3b')]({},_0x35185b,_0x2e85b1[_0xe7b2('0x46')]);return _0x2e8671[_0xe7b2('0x52')](_0x35185b);}})[_0xe7b2('0x40')](function(_0x3e9afc){if(_0x3e9afc){_0x7cf9a=_0x3e9afc['length'];if(!_0x2e85b1['query'][_0xe7b2('0x4f')](_0xe7b2('0x37'))){_0x35185b[_0xe7b2('0x1e')]=qs[_0xe7b2('0x1e')](_0x2e85b1[_0xe7b2('0x32')]['limit']);_0x35185b[_0xe7b2('0x1c')]=qs['offset'](_0x2e85b1[_0xe7b2('0x32')][_0xe7b2('0x1c')]);}return _0x2e8671['getTags'](_0x35185b);}})['then'](function(_0x451bce){if(_0x451bce){return _0x451bce?{'count':_0x7cf9a,'rows':_0x451bce}:null;}})[_0xe7b2('0x40')](respondWithResult(_0x16050e,null))[_0xe7b2('0x41')](handleError(_0x16050e,null));};exports[_0xe7b2('0x53')]=function(_0x2b33fb,_0x1e47e5,_0x3228c7){if(_0x2b33fb['body']['id']){delete _0x2b33fb[_0xe7b2('0x49')]['id'];}return db[_0xe7b2('0x2c')][_0xe7b2('0x4b')]({'where':{'id':_0x2b33fb[_0xe7b2('0x43')]['id']}})[_0xe7b2('0x40')](handleEntityNotFound(_0x1e47e5,null))[_0xe7b2('0x40')](function(_0x5a601c){if(_0x5a601c){return _0x5a601c[_0xe7b2('0x53')](_0x2b33fb['body'][_0xe7b2('0x54')]||[]);}return null;})[_0xe7b2('0x40')](respondWithResult(_0x1e47e5,null))[_0xe7b2('0x41')](handleError(_0x1e47e5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 22b0283..0d2f27f 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 _0xe145=['api','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','define','util','../../config/logger'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xe145,0xd6));var _0x5e14=function(_0x1c65d0,_0x487b70){_0x1c65d0=_0x1c65d0-0x0;var _0x567705=_0xe145[_0x1c65d0];return _0x567705;};'use strict';var _=require('lodash');var util=require(_0x5e14('0x0'));var logger=require(_0x5e14('0x1'))(_0x5e14('0x2'));var moment=require('moment');var BPromise=require(_0x5e14('0x3'));var rp=require(_0x5e14('0x4'));var fs=require('fs');var path=require(_0x5e14('0x5'));var rimraf=require(_0x5e14('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e14('0x7'));module['exports']=function(_0x56fb23,_0xe90629){return _0x56fb23[_0x5e14('0x8')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55f1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x39ed92,_0x229b1f){var _0x1a1ccd=function(_0x263908){while(--_0x263908){_0x39ed92['push'](_0x39ed92['shift']());}};_0x1a1ccd(++_0x229b1f);}(_0x55f1,0x9b));var _0x155f=function(_0x4a2a36,_0x115773){_0x4a2a36=_0x4a2a36-0x0;var _0x2400f8=_0x55f1[_0x4a2a36];return _0x2400f8;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var logger=require(_0x155f('0x1'))(_0x155f('0x2'));var moment=require(_0x155f('0x3'));var BPromise=require(_0x155f('0x4'));var rp=require(_0x155f('0x5'));var fs=require('fs');var path=require(_0x155f('0x6'));var rimraf=require(_0x155f('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x155f('0x8')]=function(_0x4bf0f6,_0x8565ec){return _0x4bf0f6[_0x155f('0x9')](_0x155f('0xa'),attributes,{'tableName':_0x155f('0xb'),'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 0634633..64bf5cd 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 _0xc2f4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x200a68,_0x4045f1){var _0x447c5b=function(_0x3223f8){while(--_0x3223f8){_0x200a68['push'](_0x200a68['shift']());}};_0x447c5b(++_0x4045f1);}(_0xc2f4,0x107));var _0x4c2f=function(_0x2e6c75,_0x1bdbb7){_0x2e6c75=_0x2e6c75-0x0;var _0x13a9ea=_0xc2f4[_0x2e6c75];return _0x13a9ea;};'use strict';var _=require(_0x4c2f('0x0'));var util=require(_0x4c2f('0x1'));var moment=require(_0x4c2f('0x2'));var BPromise=require(_0x4c2f('0x3'));var rs=require(_0x4c2f('0x4'));var fs=require('fs');var Redis=require(_0x4c2f('0x5'));var db=require(_0x4c2f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c2f('0x7'))(_0x4c2f('0x8'));var config=require(_0x4c2f('0x9'));var jayson=require(_0x4c2f('0xa'));var client=jayson[_0x4c2f('0xb')][_0x4c2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ea773,_0x23de10,_0x4a6e8d){return new BPromise(function(_0x59212b,_0x175fc1){return client[_0x4c2f('0xd')](_0x4ea773,_0x4a6e8d)['then'](function(_0x349b7b){logger['info'](_0x4c2f('0xe'),_0x23de10,'request\x20sent');logger[_0x4c2f('0xf')](_0x4c2f('0x10'),_0x23de10,_0x4c2f('0x11'),JSON[_0x4c2f('0x12')](_0x349b7b));if(_0x349b7b[_0x4c2f('0x13')]){if(_0x349b7b[_0x4c2f('0x13')]['code']===0x1f4){logger[_0x4c2f('0x13')](_0x4c2f('0xe'),_0x23de10,_0x349b7b['error'][_0x4c2f('0x14')]);return _0x175fc1(_0x349b7b[_0x4c2f('0x13')][_0x4c2f('0x14')]);}logger[_0x4c2f('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x23de10,_0x349b7b[_0x4c2f('0x13')]['message']);return _0x59212b(_0x349b7b['error'][_0x4c2f('0x14')]);}else{logger[_0x4c2f('0x15')](_0x4c2f('0xe'),_0x23de10,'request\x20sent');_0x59212b(_0x349b7b[_0x4c2f('0x16')][_0x4c2f('0x14')]);}})[_0x4c2f('0x17')](function(_0x5598ac){logger[_0x4c2f('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x23de10,_0x5598ac);_0x175fc1(_0x5598ac);});});} \ No newline at end of file +var _0x6a58=['rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x49bfea,_0x2c4ab0){var _0x133445=function(_0x57f564){while(--_0x57f564){_0x49bfea['push'](_0x49bfea['shift']());}};_0x133445(++_0x2c4ab0);}(_0x6a58,0x120));var _0x86a5=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x6a58[_0x3042c5];return _0x7cd140;};'use strict';var _=require(_0x86a5('0x0'));var util=require(_0x86a5('0x1'));var moment=require('moment');var BPromise=require(_0x86a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86a5('0x4'));var logger=require(_0x86a5('0x5'))(_0x86a5('0x6'));var config=require(_0x86a5('0x7'));var jayson=require(_0x86a5('0x8'));var client=jayson['client'][_0x86a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0a4f4,_0x5749e8,_0x425c8f){return new BPromise(function(_0xe98bdc,_0x43a1a2){return client[_0x86a5('0xa')](_0xd0a4f4,_0x425c8f)[_0x86a5('0xb')](function(_0x3084f3){logger[_0x86a5('0xc')](_0x86a5('0xd'),_0x5749e8,_0x86a5('0xe'));logger[_0x86a5('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5749e8,'request\x20sent',JSON[_0x86a5('0x10')](_0x3084f3));if(_0x3084f3['error']){if(_0x3084f3[_0x86a5('0x11')][_0x86a5('0x12')]===0x1f4){logger['error'](_0x86a5('0xd'),_0x5749e8,_0x3084f3[_0x86a5('0x11')]['message']);return _0x43a1a2(_0x3084f3[_0x86a5('0x11')][_0x86a5('0x13')]);}logger['error'](_0x86a5('0xd'),_0x5749e8,_0x3084f3[_0x86a5('0x11')][_0x86a5('0x13')]);return _0xe98bdc(_0x3084f3[_0x86a5('0x11')][_0x86a5('0x13')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x5749e8,_0x86a5('0xe'));_0xe98bdc(_0x3084f3['result'][_0x86a5('0x13')]);}})[_0x86a5('0x14')](function(_0x69a6ec){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5749e8,_0x69a6ec);_0x43a1a2(_0x69a6ec);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 52faddc..3da4151 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 _0x921e=['/:id','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x921e,0xca));var _0xe921=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x921e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xe921('0x0'));var path=require(_0xe921('0x1'));var timeout=require(_0xe921('0x2'));var express=require('express');var router=express[_0xe921('0x3')]();var fs_extra=require(_0xe921('0x4'));var auth=require(_0xe921('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe921('0x6'));var controller=require('./intDeskField.controller');router[_0xe921('0x7')]('/',auth[_0xe921('0x8')](),controller[_0xe921('0x9')]);router[_0xe921('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe921('0xa')]);router[_0xe921('0xb')]('/',auth['isAuthenticated'](),controller[_0xe921('0xc')]);router[_0xe921('0xd')](_0xe921('0xe'),auth[_0xe921('0x8')](),controller[_0xe921('0xf')]);router[_0xe921('0x10')](_0xe921('0xe'),auth[_0xe921('0x8')](),controller['destroy']);module[_0xe921('0x11')]=router; \ No newline at end of file +var _0x407c=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','show'];(function(_0x5247cd,_0x38af23){var _0xaec71f=function(_0x394073){while(--_0x394073){_0x5247cd['push'](_0x5247cd['shift']());}};_0xaec71f(++_0x38af23);}(_0x407c,0xce));var _0xc407=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x407c[_0x2d2ca2];return _0x48489d;};'use strict';var multer=require(_0xc407('0x0'));var util=require(_0xc407('0x1'));var path=require(_0xc407('0x2'));var timeout=require(_0xc407('0x3'));var express=require(_0xc407('0x4'));var router=express[_0xc407('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc407('0x6'));var interaction=require(_0xc407('0x7'));var config=require(_0xc407('0x8'));var controller=require(_0xc407('0x9'));router['get']('/',auth[_0xc407('0xa')](),controller['index']);router[_0xc407('0xb')](_0xc407('0xc'),auth[_0xc407('0xa')](),controller[_0xc407('0xd')]);router[_0xc407('0xe')]('/',auth[_0xc407('0xa')](),controller[_0xc407('0xf')]);router[_0xc407('0x10')](_0xc407('0xc'),auth[_0xc407('0xa')](),controller[_0xc407('0x11')]);router['delete'](_0xc407('0xc'),auth['isAuthenticated'](),controller[_0xc407('0x12')]);module[_0xc407('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 62bae40..cb2cf4a 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 _0x7664=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x4d5bfd,_0x24c96e){var _0x578dfa=function(_0x5a8314){while(--_0x5a8314){_0x4d5bfd['push'](_0x4d5bfd['shift']());}};_0x578dfa(++_0x24c96e);}(_0x7664,0xd9));var _0x4766=function(_0x3d8be5,_0x4054c1){_0x3d8be5=_0x3d8be5-0x0;var _0x301093=_0x7664[_0x3d8be5];return _0x301093;};'use strict';var Sequelize=require(_0x4766('0x0'));module[_0x4766('0x1')]={'type':{'type':Sequelize[_0x4766('0x2')](_0x4766('0x3'),'variable',_0x4766('0x4'),_0x4766('0x5'),'picklist'),'defaultValue':_0x4766('0x3')},'content':{'type':Sequelize[_0x4766('0x6')]},'key':{'type':Sequelize[_0x4766('0x6')]},'keyType':{'type':Sequelize[_0x4766('0x2')](_0x4766('0x3'),_0x4766('0x7'),_0x4766('0x4'))},'keyContent':{'type':Sequelize[_0x4766('0x6')]},'idField':{'type':Sequelize[_0x4766('0x6')]},'nameField':{'type':Sequelize[_0x4766('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4766('0x6')]}}; \ No newline at end of file +var _0x9821=['customVariable','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x1f06ae,_0x15284c){var _0x3dabae=function(_0x3a111a){while(--_0x3a111a){_0x1f06ae['push'](_0x1f06ae['shift']());}};_0x3dabae(++_0x15284c);}(_0x9821,0x7c));var _0x1982=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x9821[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require('sequelize');module[_0x1982('0x0')]={'type':{'type':Sequelize[_0x1982('0x1')](_0x1982('0x2'),_0x1982('0x3'),_0x1982('0x4'),'keyValue',_0x1982('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1982('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1982('0x2'),_0x1982('0x3'),_0x1982('0x4'))},'keyContent':{'type':Sequelize[_0x1982('0x6')]},'idField':{'type':Sequelize[_0x1982('0x6')]},'nameField':{'type':Sequelize[_0x1982('0x6')]},'customField':{'type':Sequelize[_0x1982('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1982('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b476c2f..d14132a 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 _0x1ad9=['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','end','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','VIRTUAL','merge','options','DeskField','includeAll','include','findAll','rows','catch','keys','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x38a38c,_0x110793){var _0x446895=function(_0x1d65da){while(--_0x1d65da){_0x38a38c['push'](_0x38a38c['shift']());}};_0x446895(++_0x110793);}(_0x1ad9,0xdb));var _0x91ad=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x1ad9[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require(_0x91ad('0x0'));var rimraf=require(_0x91ad('0x1'));var zipdir=require(_0x91ad('0x2'));var jsonpatch=require(_0x91ad('0x3'));var rp=require(_0x91ad('0x4'));var moment=require(_0x91ad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91ad('0x6'));var util=require(_0x91ad('0x7'));var path=require(_0x91ad('0x8'));var sox=require(_0x91ad('0x9'));var csv=require(_0x91ad('0xa'));var ejs=require(_0x91ad('0xb'));var fs=require('fs');var fs_extra=require(_0x91ad('0xc'));var _=require(_0x91ad('0xd'));var squel=require('squel');var crypto=require(_0x91ad('0xe'));var jsforce=require(_0x91ad('0xf'));var deskjs=require(_0x91ad('0x10'));var toCsv=require(_0x91ad('0xa'));var querystring=require(_0x91ad('0x11'));var Papa=require(_0x91ad('0x12'));var Redis=require(_0x91ad('0x13'));var authService=require(_0x91ad('0x14'));var qs=require(_0x91ad('0x15'));var as=require(_0x91ad('0x16'));var hardwareService=require(_0x91ad('0x17'));var logger=require('../../config/logger')(_0x91ad('0x18'));var utils=require(_0x91ad('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x91ad('0x1a'));var db=require(_0x91ad('0x1b'))['db'];function respondWithStatusCode(_0x5d6da1,_0x344b11){_0x344b11=_0x344b11||0xcc;return function(_0xd5d7c1){if(_0xd5d7c1){return _0x5d6da1['sendStatus'](_0x344b11);}return _0x5d6da1['status'](_0x344b11)[_0x91ad('0x1c')]();};}function respondWithResult(_0x42ffc8,_0xe52b0c){_0xe52b0c=_0xe52b0c||0xc8;return function(_0x305a11){if(_0x305a11){return _0x42ffc8[_0x91ad('0x1d')](_0xe52b0c)['json'](_0x305a11);}};}function respondWithFilteredResult(_0x34f580,_0x334874){return function(_0x495185){if(_0x495185){var _0x48cbfa=typeof _0x334874[_0x91ad('0x1e')]===_0x91ad('0x1f')&&typeof _0x334874['limit']===_0x91ad('0x1f');var _0x13cc19=_0x495185[_0x91ad('0x20')];var _0x171559=_0x48cbfa?0x0:_0x334874[_0x91ad('0x1e')];var _0x1c6b4c=_0x48cbfa?_0x495185[_0x91ad('0x20')]:_0x334874[_0x91ad('0x1e')]+_0x334874['limit'];var _0x269501;if(_0x1c6b4c>=_0x13cc19){_0x1c6b4c=_0x13cc19;_0x269501=0xc8;}else{_0x269501=0xce;}_0x34f580[_0x91ad('0x1d')](_0x269501);return _0x34f580['set'](_0x91ad('0x21'),_0x171559+'-'+_0x1c6b4c+'/'+_0x13cc19)[_0x91ad('0x22')](_0x495185);}return null;};}function patchUpdates(_0x3c1e3f){return function(_0x1631d3){try{jsonpatch[_0x91ad('0x23')](_0x1631d3,_0x3c1e3f,!![]);}catch(_0x48cb71){return BPromise[_0x91ad('0x24')](_0x48cb71);}return _0x1631d3[_0x91ad('0x25')]();};}function saveUpdates(_0x41ef9b,_0x431c88){return function(_0x1779e4){if(_0x1779e4){return _0x1779e4[_0x91ad('0x26')](_0x41ef9b)[_0x91ad('0x27')](function(_0x293b00){return _0x293b00;});}return null;};}function removeEntity(_0x241109,_0x2b53e7){return function(_0x3e966f){if(_0x3e966f){return _0x3e966f[_0x91ad('0x28')]()[_0x91ad('0x27')](function(){_0x241109[_0x91ad('0x1d')](0xcc)[_0x91ad('0x1c')]();});}};}function handleEntityNotFound(_0x1d4617,_0x384fc2){return function(_0x1d1123){if(!_0x1d1123){_0x1d4617[_0x91ad('0x29')](0x194);}return _0x1d1123;};}function handleError(_0x21ac35,_0x54d425){_0x54d425=_0x54d425||0x1f4;return function(_0x119931){logger['error'](_0x119931[_0x91ad('0x2a')]);if(_0x119931['name']){delete _0x119931['name'];}_0x21ac35[_0x91ad('0x1d')](_0x54d425)[_0x91ad('0x2b')](_0x119931);};}exports[_0x91ad('0x2c')]=function(_0x229f8f,_0x2f664f){var _0x2b2565={},_0x1393e2={},_0x687737={'count':0x0,'rows':[]};var _0x496649=_[_0x91ad('0x2d')](db['DeskField'][_0x91ad('0x2e')],function(_0x50c2fb){return{'name':_0x50c2fb[_0x91ad('0x2f')],'type':_0x50c2fb[_0x91ad('0x30')][_0x91ad('0x31')]};});_0x1393e2[_0x91ad('0x32')]=_[_0x91ad('0x2d')](_0x496649,_0x91ad('0x33'));_0x1393e2['query']=_['keys'](_0x229f8f[_0x91ad('0x34')]);_0x1393e2[_0x91ad('0x35')]=_[_0x91ad('0x36')](_0x1393e2[_0x91ad('0x32')],_0x1393e2[_0x91ad('0x34')]);_0x2b2565[_0x91ad('0x37')]=_[_0x91ad('0x36')](_0x1393e2['model'],qs['fields'](_0x229f8f['query'][_0x91ad('0x38')]));_0x2b2565[_0x91ad('0x37')]=_0x2b2565[_0x91ad('0x37')][_0x91ad('0x39')]?_0x2b2565[_0x91ad('0x37')]:_0x1393e2[_0x91ad('0x32')];if(!_0x229f8f[_0x91ad('0x34')][_0x91ad('0x3a')]('nolimit')){_0x2b2565['limit']=qs[_0x91ad('0x3b')](_0x229f8f['query'][_0x91ad('0x3b')]);_0x2b2565['offset']=qs['offset'](_0x229f8f[_0x91ad('0x34')]['offset']);}_0x2b2565['order']=qs[_0x91ad('0x3c')](_0x229f8f[_0x91ad('0x34')]['sort']);_0x2b2565['where']=qs[_0x91ad('0x35')](_[_0x91ad('0x3d')](_0x229f8f[_0x91ad('0x34')],_0x1393e2[_0x91ad('0x35')]),_0x496649);if(_0x229f8f[_0x91ad('0x34')][_0x91ad('0x3e')]){_0x2b2565[_0x91ad('0x3f')]=_['merge'](_0x2b2565[_0x91ad('0x3f')],{'$or':_[_0x91ad('0x2d')](_0x496649,function(_0x13d13e){if(_0x13d13e[_0x91ad('0x30')]!==_0x91ad('0x40')){var _0x15edd8={};_0x15edd8[_0x13d13e[_0x91ad('0x33')]]={'$like':'%'+_0x229f8f[_0x91ad('0x34')][_0x91ad('0x3e')]+'%'};return _0x15edd8;}})});}_0x2b2565=_[_0x91ad('0x41')]({},_0x2b2565,_0x229f8f[_0x91ad('0x42')]);var _0x14fe2d={'where':_0x2b2565[_0x91ad('0x3f')]};return db[_0x91ad('0x43')][_0x91ad('0x20')](_0x14fe2d)[_0x91ad('0x27')](function(_0x4eada8){_0x687737['count']=_0x4eada8;if(_0x229f8f[_0x91ad('0x34')][_0x91ad('0x44')]){_0x2b2565[_0x91ad('0x45')]=[{'all':!![]}];}return db['DeskField'][_0x91ad('0x46')](_0x2b2565);})[_0x91ad('0x27')](function(_0x39a474){_0x687737[_0x91ad('0x47')]=_0x39a474;return _0x687737;})['then'](respondWithFilteredResult(_0x2f664f,_0x2b2565))[_0x91ad('0x48')](handleError(_0x2f664f,null));};exports['show']=function(_0x51aabf,_0x32a875){var _0xcf668c={'raw':!![],'where':{'id':_0x51aabf['params']['id']}},_0x9bca9c={};_0x9bca9c[_0x91ad('0x32')]=_['keys'](db[_0x91ad('0x43')][_0x91ad('0x2e')]);_0x9bca9c['query']=_[_0x91ad('0x49')](_0x51aabf['query']);_0x9bca9c['filters']=_[_0x91ad('0x36')](_0x9bca9c[_0x91ad('0x32')],_0x9bca9c[_0x91ad('0x34')]);_0xcf668c['attributes']=_[_0x91ad('0x36')](_0x9bca9c[_0x91ad('0x32')],qs['fields'](_0x51aabf[_0x91ad('0x34')]['fields']));_0xcf668c[_0x91ad('0x37')]=_0xcf668c[_0x91ad('0x37')][_0x91ad('0x39')]?_0xcf668c[_0x91ad('0x37')]:_0x9bca9c[_0x91ad('0x32')];if(_0x51aabf[_0x91ad('0x34')][_0x91ad('0x44')]){_0xcf668c[_0x91ad('0x45')]=[{'all':!![]}];}_0xcf668c=_['merge']({},_0xcf668c,_0x51aabf[_0x91ad('0x42')]);return db[_0x91ad('0x43')]['find'](_0xcf668c)['then'](handleEntityNotFound(_0x32a875,null))[_0x91ad('0x27')](respondWithResult(_0x32a875,null))['catch'](handleError(_0x32a875,null));};exports[_0x91ad('0x4a')]=function(_0x4265c0,_0x276c7e){return db[_0x91ad('0x43')][_0x91ad('0x4a')](_0x4265c0['body'],{})[_0x91ad('0x27')](respondWithResult(_0x276c7e,0xc9))['catch'](handleError(_0x276c7e,null));};exports[_0x91ad('0x26')]=function(_0xc4bddd,_0x4d2c45){if(_0xc4bddd[_0x91ad('0x4b')]['id']){delete _0xc4bddd[_0x91ad('0x4b')]['id'];}return db[_0x91ad('0x43')][_0x91ad('0x4c')]({'where':{'id':_0xc4bddd['params']['id']}})[_0x91ad('0x27')](handleEntityNotFound(_0x4d2c45,null))[_0x91ad('0x27')](saveUpdates(_0xc4bddd[_0x91ad('0x4b')],null))[_0x91ad('0x27')](respondWithResult(_0x4d2c45,null))[_0x91ad('0x48')](handleError(_0x4d2c45,null));};exports[_0x91ad('0x28')]=function(_0x245823,_0x4876d8){return db[_0x91ad('0x43')][_0x91ad('0x4c')]({'where':{'id':_0x245823[_0x91ad('0x4d')]['id']}})[_0x91ad('0x27')](handleEntityNotFound(_0x4876d8,null))[_0x91ad('0x27')](removeEntity(_0x4876d8,null))[_0x91ad('0x48')](handleError(_0x4876d8,null));}; \ No newline at end of file +var _0xf417=['rows','catch','show','params','intersection','find','create','body','update','rimraf','zip-dir','fast-json-patch','moment','util','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','error','stack','send','map','rawAttributes','fieldName','name','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','DeskField','includeAll','include','findAll'];(function(_0x5be986,_0x458f50){var _0x17d2b5=function(_0x38c620){while(--_0x38c620){_0x5be986['push'](_0x5be986['shift']());}};_0x17d2b5(++_0x458f50);}(_0xf417,0x8f));var _0x7f41=function(_0x4c1ae7,_0x44532f){_0x4c1ae7=_0x4c1ae7-0x0;var _0x12f4c5=_0xf417[_0x4c1ae7];return _0x12f4c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f41('0x0'));var zipdir=require(_0x7f41('0x1'));var jsonpatch=require(_0x7f41('0x2'));var rp=require('request-promise');var moment=require(_0x7f41('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f41('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f41('0x5'));var _=require('lodash');var squel=require(_0x7f41('0x6'));var crypto=require(_0x7f41('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x7f41('0x8'));var toCsv=require('to-csv');var querystring=require(_0x7f41('0x9'));var Papa=require('papaparse');var Redis=require(_0x7f41('0xa'));var authService=require(_0x7f41('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f41('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x7f41('0xd'));var config=require(_0x7f41('0xe'));var licenseUtil=require(_0x7f41('0xf'));var db=require(_0x7f41('0x10'))['db'];function respondWithStatusCode(_0x637b2d,_0x46dcfe){_0x46dcfe=_0x46dcfe||0xcc;return function(_0xf2f383){if(_0xf2f383){return _0x637b2d['sendStatus'](_0x46dcfe);}return _0x637b2d['status'](_0x46dcfe)[_0x7f41('0x11')]();};}function respondWithResult(_0x4f5b74,_0x568eea){_0x568eea=_0x568eea||0xc8;return function(_0x466907){if(_0x466907){return _0x4f5b74[_0x7f41('0x12')](_0x568eea)[_0x7f41('0x13')](_0x466907);}};}function respondWithFilteredResult(_0x5a517f,_0x212b28){return function(_0x5ef6a7){if(_0x5ef6a7){var _0x27c0f6=typeof _0x212b28[_0x7f41('0x14')]===_0x7f41('0x15')&&typeof _0x212b28['limit']===_0x7f41('0x15');var _0x1ae462=_0x5ef6a7[_0x7f41('0x16')];var _0x5434d2=_0x27c0f6?0x0:_0x212b28[_0x7f41('0x14')];var _0x26580c=_0x27c0f6?_0x5ef6a7['count']:_0x212b28[_0x7f41('0x14')]+_0x212b28[_0x7f41('0x17')];var _0x1f4af0;if(_0x26580c>=_0x1ae462){_0x26580c=_0x1ae462;_0x1f4af0=0xc8;}else{_0x1f4af0=0xce;}_0x5a517f['status'](_0x1f4af0);return _0x5a517f[_0x7f41('0x18')]('Content-Range',_0x5434d2+'-'+_0x26580c+'/'+_0x1ae462)['json'](_0x5ef6a7);}return null;};}function patchUpdates(_0x3fe620){return function(_0x7de9c2){try{jsonpatch[_0x7f41('0x19')](_0x7de9c2,_0x3fe620,!![]);}catch(_0x21660b){return BPromise[_0x7f41('0x1a')](_0x21660b);}return _0x7de9c2[_0x7f41('0x1b')]();};}function saveUpdates(_0x5e0f8b,_0x5e568d){return function(_0x3e8000){if(_0x3e8000){return _0x3e8000['update'](_0x5e0f8b)['then'](function(_0xb27d9c){return _0xb27d9c;});}return null;};}function removeEntity(_0x388946,_0x4fdd78){return function(_0x3f3ee0){if(_0x3f3ee0){return _0x3f3ee0[_0x7f41('0x1c')]()[_0x7f41('0x1d')](function(){_0x388946[_0x7f41('0x12')](0xcc)[_0x7f41('0x11')]();});}};}function handleEntityNotFound(_0x4cbee7,_0x57a302){return function(_0x4dbed0){if(!_0x4dbed0){_0x4cbee7['sendStatus'](0x194);}return _0x4dbed0;};}function handleError(_0x16b410,_0x183ac7){_0x183ac7=_0x183ac7||0x1f4;return function(_0x55a32a){logger[_0x7f41('0x1e')](_0x55a32a[_0x7f41('0x1f')]);if(_0x55a32a['name']){delete _0x55a32a['name'];}_0x16b410['status'](_0x183ac7)[_0x7f41('0x20')](_0x55a32a);};}exports['index']=function(_0x4ee09e,_0x501076){var _0x3889b1={},_0x379dbe={},_0x4fa7e8={'count':0x0,'rows':[]};var _0x2b93e4=_[_0x7f41('0x21')](db['DeskField'][_0x7f41('0x22')],function(_0x1c33fb){return{'name':_0x1c33fb[_0x7f41('0x23')],'type':_0x1c33fb['type']['key']};});_0x379dbe['model']=_[_0x7f41('0x21')](_0x2b93e4,_0x7f41('0x24'));_0x379dbe[_0x7f41('0x25')]=_[_0x7f41('0x26')](_0x4ee09e[_0x7f41('0x25')]);_0x379dbe[_0x7f41('0x27')]=_['intersection'](_0x379dbe[_0x7f41('0x28')],_0x379dbe[_0x7f41('0x25')]);_0x3889b1[_0x7f41('0x29')]=_['intersection'](_0x379dbe[_0x7f41('0x28')],qs['fields'](_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x2a')]));_0x3889b1[_0x7f41('0x29')]=_0x3889b1['attributes'][_0x7f41('0x2b')]?_0x3889b1[_0x7f41('0x29')]:_0x379dbe[_0x7f41('0x28')];if(!_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x2c')](_0x7f41('0x2d'))){_0x3889b1[_0x7f41('0x17')]=qs[_0x7f41('0x17')](_0x4ee09e['query'][_0x7f41('0x17')]);_0x3889b1[_0x7f41('0x14')]=qs[_0x7f41('0x14')](_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x14')]);}_0x3889b1[_0x7f41('0x2e')]=qs[_0x7f41('0x2f')](_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x2f')]);_0x3889b1[_0x7f41('0x30')]=qs[_0x7f41('0x27')](_[_0x7f41('0x31')](_0x4ee09e['query'],_0x379dbe[_0x7f41('0x27')]),_0x2b93e4);if(_0x4ee09e[_0x7f41('0x25')]['filter']){_0x3889b1[_0x7f41('0x30')]=_['merge'](_0x3889b1[_0x7f41('0x30')],{'$or':_[_0x7f41('0x21')](_0x2b93e4,function(_0x2d2c62){if(_0x2d2c62['type']!==_0x7f41('0x32')){var _0x18ed9a={};_0x18ed9a[_0x2d2c62['name']]={'$like':'%'+_0x4ee09e['query'][_0x7f41('0x33')]+'%'};return _0x18ed9a;}})});}_0x3889b1=_[_0x7f41('0x34')]({},_0x3889b1,_0x4ee09e[_0x7f41('0x35')]);var _0x33f9d5={'where':_0x3889b1[_0x7f41('0x30')]};return db[_0x7f41('0x36')][_0x7f41('0x16')](_0x33f9d5)[_0x7f41('0x1d')](function(_0x2ea20d){_0x4fa7e8['count']=_0x2ea20d;if(_0x4ee09e[_0x7f41('0x25')][_0x7f41('0x37')]){_0x3889b1[_0x7f41('0x38')]=[{'all':!![]}];}return db[_0x7f41('0x36')][_0x7f41('0x39')](_0x3889b1);})[_0x7f41('0x1d')](function(_0x5a2d93){_0x4fa7e8[_0x7f41('0x3a')]=_0x5a2d93;return _0x4fa7e8;})[_0x7f41('0x1d')](respondWithFilteredResult(_0x501076,_0x3889b1))[_0x7f41('0x3b')](handleError(_0x501076,null));};exports[_0x7f41('0x3c')]=function(_0x58235e,_0x51067c){var _0xd4d821={'raw':!![],'where':{'id':_0x58235e[_0x7f41('0x3d')]['id']}},_0x3a87a0={};_0x3a87a0['model']=_[_0x7f41('0x26')](db[_0x7f41('0x36')]['rawAttributes']);_0x3a87a0[_0x7f41('0x25')]=_[_0x7f41('0x26')](_0x58235e[_0x7f41('0x25')]);_0x3a87a0[_0x7f41('0x27')]=_['intersection'](_0x3a87a0[_0x7f41('0x28')],_0x3a87a0['query']);_0xd4d821[_0x7f41('0x29')]=_[_0x7f41('0x3e')](_0x3a87a0[_0x7f41('0x28')],qs[_0x7f41('0x2a')](_0x58235e['query'][_0x7f41('0x2a')]));_0xd4d821[_0x7f41('0x29')]=_0xd4d821[_0x7f41('0x29')]['length']?_0xd4d821[_0x7f41('0x29')]:_0x3a87a0['model'];if(_0x58235e['query'][_0x7f41('0x37')]){_0xd4d821[_0x7f41('0x38')]=[{'all':!![]}];}_0xd4d821=_[_0x7f41('0x34')]({},_0xd4d821,_0x58235e[_0x7f41('0x35')]);return db[_0x7f41('0x36')][_0x7f41('0x3f')](_0xd4d821)[_0x7f41('0x1d')](handleEntityNotFound(_0x51067c,null))[_0x7f41('0x1d')](respondWithResult(_0x51067c,null))[_0x7f41('0x3b')](handleError(_0x51067c,null));};exports[_0x7f41('0x40')]=function(_0x319a90,_0x12d73f){return db['DeskField'][_0x7f41('0x40')](_0x319a90[_0x7f41('0x41')],{})[_0x7f41('0x1d')](respondWithResult(_0x12d73f,0xc9))[_0x7f41('0x3b')](handleError(_0x12d73f,null));};exports[_0x7f41('0x42')]=function(_0x3a0b0a,_0x12ac2d){if(_0x3a0b0a[_0x7f41('0x41')]['id']){delete _0x3a0b0a[_0x7f41('0x41')]['id'];}return db['DeskField'][_0x7f41('0x3f')]({'where':{'id':_0x3a0b0a['params']['id']}})['then'](handleEntityNotFound(_0x12ac2d,null))[_0x7f41('0x1d')](saveUpdates(_0x3a0b0a[_0x7f41('0x41')],null))[_0x7f41('0x1d')](respondWithResult(_0x12ac2d,null))['catch'](handleError(_0x12ac2d,null));};exports[_0x7f41('0x1c')]=function(_0x2d20b2,_0x398e57){return db[_0x7f41('0x36')]['find']({'where':{'id':_0x2d20b2[_0x7f41('0x3d')]['id']}})['then'](handleEntityNotFound(_0x398e57,null))[_0x7f41('0x1d')](removeEntity(_0x398e57,null))[_0x7f41('0x3b')](handleError(_0x398e57,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 18ba08b..7f86ccc 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 _0xebe4=['exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3411c3,_0x33613b){var _0x3337fa=function(_0x221b93){while(--_0x221b93){_0x3411c3['push'](_0x3411c3['shift']());}};_0x3337fa(++_0x33613b);}(_0xebe4,0x147));var _0x4ebe=function(_0x257d7d,_0x3ab378){_0x257d7d=_0x257d7d-0x0;var _0x7c566f=_0xebe4[_0x257d7d];return _0x7c566f;};'use strict';var _=require(_0x4ebe('0x0'));var util=require(_0x4ebe('0x1'));var logger=require(_0x4ebe('0x2'))(_0x4ebe('0x3'));var moment=require('moment');var BPromise=require(_0x4ebe('0x4'));var rp=require(_0x4ebe('0x5'));var fs=require('fs');var path=require(_0x4ebe('0x6'));var rimraf=require(_0x4ebe('0x7'));var config=require(_0x4ebe('0x8'));var attributes=require('./intDeskField.attributes');module[_0x4ebe('0x9')]=function(_0x5a40ad,_0x5f17a8){return _0x5a40ad[_0x4ebe('0xa')](_0x4ebe('0xb'),attributes,{'tableName':_0x4ebe('0xc'),'paranoid':![],'indexes':[{'name':_0x4ebe('0xd'),'fields':[_0x4ebe('0xe'),_0x4ebe('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0e2=['api','request-promise','path','rimraf','../../config/environment','exports','int_desk_fields','desk_unique_index','idField','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb0e2,0x117));var _0x2b0e=function(_0x54bd85,_0x35cf26){_0x54bd85=_0x54bd85-0x0;var _0x346f82=_0xb0e2[_0x54bd85];return _0x346f82;};'use strict';var _=require(_0x2b0e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2b0e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b0e('0x2'));var fs=require('fs');var path=require(_0x2b0e('0x3'));var rimraf=require(_0x2b0e('0x4'));var config=require(_0x2b0e('0x5'));var attributes=require('./intDeskField.attributes');module[_0x2b0e('0x6')]=function(_0x5f1b06,_0x216da8){return _0x5f1b06['define']('DeskField',attributes,{'tableName':_0x2b0e('0x7'),'paranoid':![],'indexes':[{'name':_0x2b0e('0x8'),'fields':[_0x2b0e('0x9'),'FieldId'],'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 b1c1d16..368656e 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 _0x6d65=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis'];(function(_0x40ab41,_0x5d535e){var _0x36962d=function(_0x3300e7){while(--_0x3300e7){_0x40ab41['push'](_0x40ab41['shift']());}};_0x36962d(++_0x5d535e);}(_0x6d65,0x16c));var _0x56d6=function(_0xe8248c,_0x2fc5dd){_0xe8248c=_0xe8248c-0x0;var _0x9db083=_0x6d65[_0xe8248c];return _0x9db083;};'use strict';var _=require('lodash');var util=require(_0x56d6('0x0'));var moment=require('moment');var BPromise=require(_0x56d6('0x1'));var rs=require(_0x56d6('0x2'));var fs=require('fs');var Redis=require(_0x56d6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x56d6('0x4'));var logger=require(_0x56d6('0x5'))(_0x56d6('0x6'));var config=require(_0x56d6('0x7'));var jayson=require(_0x56d6('0x8'));var client=jayson[_0x56d6('0x9')][_0x56d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cd9d7,_0xb37609,_0x57e52a){return new BPromise(function(_0x3e1ecc,_0x54863f){return client[_0x56d6('0xb')](_0x3cd9d7,_0x57e52a)[_0x56d6('0xc')](function(_0x538155){logger[_0x56d6('0xd')](_0x56d6('0xe'),_0xb37609,_0x56d6('0xf'));logger[_0x56d6('0x10')](_0x56d6('0x11'),_0xb37609,_0x56d6('0xf'),JSON[_0x56d6('0x12')](_0x538155));if(_0x538155[_0x56d6('0x13')]){if(_0x538155[_0x56d6('0x13')][_0x56d6('0x14')]===0x1f4){logger[_0x56d6('0x13')]('DeskField,\x20%s,\x20%s',_0xb37609,_0x538155[_0x56d6('0x13')][_0x56d6('0x15')]);return _0x54863f(_0x538155[_0x56d6('0x13')][_0x56d6('0x15')]);}logger['error']('DeskField,\x20%s,\x20%s',_0xb37609,_0x538155['error'][_0x56d6('0x15')]);return _0x3e1ecc(_0x538155[_0x56d6('0x13')][_0x56d6('0x15')]);}else{logger[_0x56d6('0xd')](_0x56d6('0xe'),_0xb37609,_0x56d6('0xf'));_0x3e1ecc(_0x538155[_0x56d6('0x16')][_0x56d6('0x15')]);}})['catch'](function(_0x39a96d){logger[_0x56d6('0x13')]('DeskField,\x20%s,\x20%s',_0xb37609,_0x39a96d);_0x54863f(_0x39a96d);});});} \ No newline at end of file +var _0xad72=['request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','info','DeskField,\x20%s,\x20%s'];(function(_0x388f72,_0x972d0b){var _0x3f4967=function(_0x59225b){while(--_0x59225b){_0x388f72['push'](_0x388f72['shift']());}};_0x3f4967(++_0x972d0b);}(_0xad72,0x1da));var _0x2ad7=function(_0x59fbff,_0xd12a67){_0x59fbff=_0x59fbff-0x0;var _0x220587=_0xad72[_0x59fbff];return _0x220587;};'use strict';var _=require(_0x2ad7('0x0'));var util=require('util');var moment=require(_0x2ad7('0x1'));var BPromise=require(_0x2ad7('0x2'));var rs=require(_0x2ad7('0x3'));var fs=require('fs');var Redis=require(_0x2ad7('0x4'));var db=require(_0x2ad7('0x5'))['db'];var utils=require(_0x2ad7('0x6'));var logger=require(_0x2ad7('0x7'))('rpc');var config=require(_0x2ad7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ad7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9f88,_0x16fceb,_0x287909){return new BPromise(function(_0x50df22,_0x401d62){return client['request'](_0x1b9f88,_0x287909)['then'](function(_0x30fdf1){logger[_0x2ad7('0xa')](_0x2ad7('0xb'),_0x16fceb,_0x2ad7('0xc'));logger['debug'](_0x2ad7('0xd'),_0x16fceb,'request\x20sent',JSON['stringify'](_0x30fdf1));if(_0x30fdf1[_0x2ad7('0xe')]){if(_0x30fdf1[_0x2ad7('0xe')]['code']===0x1f4){logger[_0x2ad7('0xe')](_0x2ad7('0xb'),_0x16fceb,_0x30fdf1[_0x2ad7('0xe')]['message']);return _0x401d62(_0x30fdf1['error'][_0x2ad7('0xf')]);}logger[_0x2ad7('0xe')](_0x2ad7('0xb'),_0x16fceb,_0x30fdf1[_0x2ad7('0xe')]['message']);return _0x50df22(_0x30fdf1[_0x2ad7('0xe')][_0x2ad7('0xf')]);}else{logger[_0x2ad7('0xa')](_0x2ad7('0xb'),_0x16fceb,_0x2ad7('0xc'));_0x50df22(_0x30fdf1[_0x2ad7('0x10')]['message']);}})[_0x2ad7('0x11')](function(_0x40fbfa){logger[_0x2ad7('0xe')]('DeskField,\x20%s,\x20%s',_0x16fceb,_0x40fbfa);_0x401d62(_0x40fbfa);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1452736..076eca8 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 _0xe13e=['get','isAuthenticated','index','/:id','show','getFields','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a2f82,_0x5ef637){var _0x52ba90=function(_0x281df6){while(--_0x281df6){_0x3a2f82['push'](_0x3a2f82['shift']());}};_0x52ba90(++_0x5ef637);}(_0xe13e,0x141));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xee13('0x0'));var util=require(_0xee13('0x1'));var path=require(_0xee13('0x2'));var timeout=require(_0xee13('0x3'));var express=require(_0xee13('0x4'));var router=express[_0xee13('0x5')]();var fs_extra=require(_0xee13('0x6'));var auth=require(_0xee13('0x7'));var interaction=require(_0xee13('0x8'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0xee13('0x9')]('/',auth[_0xee13('0xa')](),controller[_0xee13('0xb')]);router[_0xee13('0x9')](_0xee13('0xc'),auth['isAuthenticated'](),controller[_0xee13('0xd')]);router[_0xee13('0x9')]('/:id/configurations',auth[_0xee13('0xa')](),controller['getConfigurations']);router[_0xee13('0x9')]('/:id/fields',auth[_0xee13('0xa')](),controller[_0xee13('0xe')]);router[_0xee13('0xf')]('/',auth[_0xee13('0xa')](),controller['create']);router[_0xee13('0xf')](_0xee13('0x10'),auth['isAuthenticated'](),controller[_0xee13('0x11')]);router[_0xee13('0x12')](_0xee13('0xc'),auth[_0xee13('0xa')](),controller['update']);router[_0xee13('0x13')](_0xee13('0xc'),auth[_0xee13('0xa')](),controller[_0xee13('0x14')]);module[_0xee13('0x15')]=router; \ No newline at end of file +var _0xe4f9=['addConfiguration','put','update','delete','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xe4f9,0x1bd));var _0x9e4f=function(_0x5157ab,_0x28c05c){_0x5157ab=_0x5157ab-0x0;var _0x4735f6=_0xe4f9[_0x5157ab];return _0x4735f6;};'use strict';var multer=require('multer');var util=require(_0x9e4f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9e4f('0x1'));var router=express[_0x9e4f('0x2')]();var fs_extra=require(_0x9e4f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9e4f('0x4'));var config=require(_0x9e4f('0x5'));var controller=require(_0x9e4f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9e4f('0x7')]);router[_0x9e4f('0x8')](_0x9e4f('0x9'),auth['isAuthenticated'](),controller[_0x9e4f('0xa')]);router[_0x9e4f('0x8')](_0x9e4f('0xb'),auth[_0x9e4f('0xc')](),controller[_0x9e4f('0xd')]);router[_0x9e4f('0x8')](_0x9e4f('0xe'),auth[_0x9e4f('0xc')](),controller[_0x9e4f('0xf')]);router[_0x9e4f('0x10')]('/',auth[_0x9e4f('0xc')](),controller['create']);router[_0x9e4f('0x10')](_0x9e4f('0xb'),auth['isAuthenticated'](),controller[_0x9e4f('0x11')]);router[_0x9e4f('0x12')](_0x9e4f('0x9'),auth['isAuthenticated'](),controller[_0x9e4f('0x13')]);router[_0x9e4f('0x14')](_0x9e4f('0x9'),auth[_0x9e4f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 101755d..f58dc21 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 _0x1354=['exports','STRING','sequelize'];(function(_0x1d8f95,_0xcd1d0e){var _0x4cb618=function(_0xddea13){while(--_0xddea13){_0x1d8f95['push'](_0x1d8f95['shift']());}};_0x4cb618(++_0xcd1d0e);}(_0x1354,0x95));var _0x4135=function(_0x59cf8a,_0x163bb9){_0x59cf8a=_0x59cf8a-0x0;var _0x22dde8=_0x1354[_0x59cf8a];return _0x22dde8;};'use strict';var Sequelize=require(_0x4135('0x0'));module[_0x4135('0x1')]={'name':{'type':Sequelize[_0x4135('0x2')]},'username':{'type':Sequelize[_0x4135('0x2')]},'password':{'type':Sequelize[_0x4135('0x2')]},'remoteUri':{'type':Sequelize[_0x4135('0x2')]},'tenantId':{'type':Sequelize[_0x4135('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x4135('0x2')]},'serverUrl':{'type':Sequelize[_0x4135('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4135('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2975=['exports','STRING','BOOLEAN'];(function(_0x2799d3,_0x1d0f54){var _0x5c5701=function(_0x373ac2){while(--_0x373ac2){_0x2799d3['push'](_0x2799d3['shift']());}};_0x5c5701(++_0x1d0f54);}(_0x2975,0x1c5));var _0x5297=function(_0xf2dcc1,_0x412fba){_0xf2dcc1=_0xf2dcc1-0x0;var _0x48aeae=_0x2975[_0xf2dcc1];return _0x48aeae;};'use strict';var Sequelize=require('sequelize');module[_0x5297('0x0')]={'name':{'type':Sequelize[_0x5297('0x1')]},'username':{'type':Sequelize[_0x5297('0x1')]},'password':{'type':Sequelize[_0x5297('0x1')]},'remoteUri':{'type':Sequelize[_0x5297('0x1')]},'tenantId':{'type':Sequelize[_0x5297('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5297('0x1')]},'modernAuthentication':{'type':Sequelize[_0x5297('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 0873ede..0f75451 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 _0xf2ba=['index','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','params','keys','length','options','create','update','body','find','Dynamics365Configuration','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','customerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','DisplayName',')/Microsoft.Dynamics.CRM.','request-promise','util','../../config/logger','api','offset','undefined','count','limit','status','set','Content-Range','json','destroy','end','sendStatus','error','stack','name','send'];(function(_0x28db86,_0x21d621){var _0x30dcfd=function(_0x65636b){while(--_0x65636b){_0x28db86['push'](_0x28db86['shift']());}};_0x30dcfd(++_0x21d621);}(_0xf2ba,0xab));var _0xaf2b=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0xf2ba[_0x143565];return _0x4dc1d9;};'use strict';var rp=require(_0xaf2b('0x0'));var util=require(_0xaf2b('0x1'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xaf2b('0x2'))(_0xaf2b('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x270bcd,_0x470eae){_0x470eae=_0x470eae||0xc8;return function(_0x2aaf60){if(_0x2aaf60){return _0x270bcd['status'](_0x470eae)['json'](_0x2aaf60);}};}function respondWithFilteredResult(_0x57f9b6,_0x32081f){return function(_0x29cf83){if(_0x29cf83){var _0x59c0e9=typeof _0x32081f[_0xaf2b('0x4')]===_0xaf2b('0x5')&&typeof _0x32081f['limit']==='undefined';var _0x3c3822=_0x29cf83[_0xaf2b('0x6')];var _0x247656=_0x59c0e9?0x0:_0x32081f[_0xaf2b('0x4')];var _0x574715=_0x59c0e9?_0x29cf83[_0xaf2b('0x6')]:_0x32081f[_0xaf2b('0x4')]+_0x32081f[_0xaf2b('0x7')];var _0x55cd90;if(_0x574715>=_0x3c3822){_0x574715=_0x3c3822;_0x55cd90=0xc8;}else{_0x55cd90=0xce;}_0x57f9b6[_0xaf2b('0x8')](_0x55cd90);return _0x57f9b6[_0xaf2b('0x9')](_0xaf2b('0xa'),_0x247656+'-'+_0x574715+'/'+_0x3c3822)[_0xaf2b('0xb')](_0x29cf83);}return null;};}function saveUpdates(_0x4cc827){return function(_0x5ea1a0){if(_0x5ea1a0){return _0x5ea1a0['update'](_0x4cc827)['then'](function(_0x1b1140){return _0x1b1140;});}return null;};}function removeEntity(_0x1f7964){return function(_0x521fe9){if(_0x521fe9){return _0x521fe9[_0xaf2b('0xc')]()['then'](function(){_0x1f7964['status'](0xcc)[_0xaf2b('0xd')]();});}};}function handleEntityNotFound(_0x37461a){return function(_0x1ccaf7){if(!_0x1ccaf7){_0x37461a[_0xaf2b('0xe')](0x194);}return _0x1ccaf7;};}function handleError(_0x5d55c2,_0x4d19af){_0x4d19af=_0x4d19af||0x1f4;return function(_0x24ec4d){logger[_0xaf2b('0xf')](_0x24ec4d[_0xaf2b('0x10')]);if(_0x24ec4d[_0xaf2b('0x11')]){delete _0x24ec4d[_0xaf2b('0x11')];}_0x5d55c2[_0xaf2b('0x8')](_0x4d19af)[_0xaf2b('0x12')](_0x24ec4d);};}exports[_0xaf2b('0x13')]=function(_0xde70f9,_0x257bdb){var _0x595586={},_0x709728={},_0x1c25d3={'count':0x0,'rows':[]};var _0x46eb75=_[_0xaf2b('0x14')](db[_0xaf2b('0x15')][_0xaf2b('0x16')],function(_0x5b3c1d){return{'name':_0x5b3c1d[_0xaf2b('0x17')],'type':_0x5b3c1d['type'][_0xaf2b('0x18')]};});_0x709728[_0xaf2b('0x19')]=_[_0xaf2b('0x14')](_0x46eb75,_0xaf2b('0x11'));_0x709728[_0xaf2b('0x1a')]=_['keys'](_0xde70f9[_0xaf2b('0x1a')]);_0x709728['filters']=_[_0xaf2b('0x1b')](_0x709728[_0xaf2b('0x19')],_0x709728['query']);_0x595586[_0xaf2b('0x1c')]=_['intersection'](_0x709728['model'],qs['fields'](_0xde70f9[_0xaf2b('0x1a')][_0xaf2b('0x1d')]));_0x595586[_0xaf2b('0x1c')]=_0x595586[_0xaf2b('0x1c')]['length']?_0x595586[_0xaf2b('0x1c')]:_0x709728[_0xaf2b('0x19')];if(!_0xde70f9['query'][_0xaf2b('0x1e')]('nolimit')){_0x595586['limit']=qs[_0xaf2b('0x7')](_0xde70f9[_0xaf2b('0x1a')][_0xaf2b('0x7')]);_0x595586[_0xaf2b('0x4')]=qs['offset'](_0xde70f9[_0xaf2b('0x1a')]['offset']);}_0x595586[_0xaf2b('0x1f')]=qs['sort'](_0xde70f9['query'][_0xaf2b('0x20')]);_0x595586[_0xaf2b('0x21')]=qs[_0xaf2b('0x22')](_[_0xaf2b('0x23')](_0xde70f9[_0xaf2b('0x1a')],_0x709728['filters']),_0x46eb75);if(_0xde70f9[_0xaf2b('0x1a')][_0xaf2b('0x24')]){_0x595586[_0xaf2b('0x21')]=_[_0xaf2b('0x25')](_0x595586[_0xaf2b('0x21')],{'$or':_[_0xaf2b('0x14')](_0x46eb75,function(_0x30856a){if(_0x30856a[_0xaf2b('0x26')]!==_0xaf2b('0x27')){var _0x2228ad={};_0x2228ad[_0x30856a[_0xaf2b('0x11')]]={'$like':'%'+_0xde70f9['query'][_0xaf2b('0x24')]+'%'};return _0x2228ad;}})});}_0x595586=_[_0xaf2b('0x25')]({},_0x595586,_0xde70f9['options']);var _0x148dfd={'where':_0x595586[_0xaf2b('0x21')]};return db[_0xaf2b('0x15')][_0xaf2b('0x6')](_0x148dfd)[_0xaf2b('0x28')](function(_0x52f4b5){_0x1c25d3[_0xaf2b('0x6')]=_0x52f4b5;if(_0xde70f9[_0xaf2b('0x1a')][_0xaf2b('0x29')]){_0x595586[_0xaf2b('0x2a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xaf2b('0x2b')](_0x595586);})[_0xaf2b('0x28')](function(_0x1de1ce){_0x1c25d3[_0xaf2b('0x2c')]=_0x1de1ce;return _0x1c25d3;})[_0xaf2b('0x28')](respondWithFilteredResult(_0x257bdb,_0x595586))[_0xaf2b('0x2d')](handleError(_0x257bdb,null));};exports[_0xaf2b('0x2e')]=function(_0x184394,_0x5a07e0){var _0x2af46f={'raw':![],'where':{'id':_0x184394[_0xaf2b('0x2f')]['id']}},_0x477962={};_0x477962[_0xaf2b('0x19')]=_[_0xaf2b('0x30')](db[_0xaf2b('0x15')][_0xaf2b('0x16')]);_0x477962['query']=_['keys'](_0x184394[_0xaf2b('0x1a')]);_0x477962[_0xaf2b('0x22')]=_[_0xaf2b('0x1b')](_0x477962[_0xaf2b('0x19')],_0x477962[_0xaf2b('0x1a')]);_0x2af46f[_0xaf2b('0x1c')]=_[_0xaf2b('0x1b')](_0x477962[_0xaf2b('0x19')],qs[_0xaf2b('0x1d')](_0x184394[_0xaf2b('0x1a')][_0xaf2b('0x1d')]));_0x2af46f[_0xaf2b('0x1c')]=_0x2af46f[_0xaf2b('0x1c')][_0xaf2b('0x31')]?_0x2af46f[_0xaf2b('0x1c')]:_0x477962[_0xaf2b('0x19')];if(_0x184394[_0xaf2b('0x1a')][_0xaf2b('0x29')]){_0x2af46f[_0xaf2b('0x2a')]=[{'all':!![]}];}_0x2af46f=_[_0xaf2b('0x25')]({},_0x2af46f,_0x184394[_0xaf2b('0x32')]);return db[_0xaf2b('0x15')]['find'](_0x2af46f)['then'](handleEntityNotFound(_0x5a07e0,null))[_0xaf2b('0x28')](respondWithResult(_0x5a07e0,null))[_0xaf2b('0x2d')](handleError(_0x5a07e0,null));};exports[_0xaf2b('0x33')]=function(_0x1c099a,_0x11e5c7){return db[_0xaf2b('0x15')][_0xaf2b('0x33')](_0x1c099a['body'],{})[_0xaf2b('0x28')](respondWithResult(_0x11e5c7,0xc9))[_0xaf2b('0x2d')](handleError(_0x11e5c7,null));};exports[_0xaf2b('0x34')]=function(_0x3e82bd,_0x3d882b){if(_0x3e82bd[_0xaf2b('0x35')]['id']){delete _0x3e82bd[_0xaf2b('0x35')]['id'];}return db[_0xaf2b('0x15')][_0xaf2b('0x36')]({'where':{'id':_0x3e82bd[_0xaf2b('0x2f')]['id']}})[_0xaf2b('0x28')](handleEntityNotFound(_0x3d882b,null))[_0xaf2b('0x28')](saveUpdates(_0x3e82bd['body'],null))['then'](respondWithResult(_0x3d882b,null))['catch'](handleError(_0x3d882b,null));};exports[_0xaf2b('0xc')]=function(_0x190303,_0x1fe439){return db[_0xaf2b('0x15')][_0xaf2b('0x36')]({'where':{'id':_0x190303[_0xaf2b('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1fe439,null))[_0xaf2b('0x28')](removeEntity(_0x1fe439,null))[_0xaf2b('0x2d')](handleError(_0x1fe439,null));};exports['getConfigurations']=function(_0x275402,_0x4fa995){var _0x57b31b={};var _0x851220={};var _0x131411;var _0x394524;return db[_0xaf2b('0x15')]['findOne']({'where':{'id':_0x275402[_0xaf2b('0x2f')]['id']}})[_0xaf2b('0x28')](handleEntityNotFound(_0x4fa995,null))[_0xaf2b('0x28')](function(_0x3db2b2){if(_0x3db2b2){_0x131411=_0x3db2b2;_0x851220['model']=_[_0xaf2b('0x30')](db[_0xaf2b('0x37')][_0xaf2b('0x16')]);_0x851220[_0xaf2b('0x1a')]=_[_0xaf2b('0x30')](_0x275402['query']);_0x851220[_0xaf2b('0x22')]=_[_0xaf2b('0x1b')](_0x851220[_0xaf2b('0x19')],_0x851220['query']);_0x57b31b['attributes']=_['intersection'](_0x851220[_0xaf2b('0x19')],qs[_0xaf2b('0x1d')](_0x275402['query'][_0xaf2b('0x1d')]));_0x57b31b[_0xaf2b('0x1c')]=_0x57b31b['attributes'][_0xaf2b('0x31')]?_0x57b31b[_0xaf2b('0x1c')]:_0x851220[_0xaf2b('0x19')];_0x57b31b[_0xaf2b('0x1f')]=qs[_0xaf2b('0x20')](_0x275402[_0xaf2b('0x1a')][_0xaf2b('0x20')]);_0x57b31b['where']=qs[_0xaf2b('0x22')](_['pick'](_0x275402[_0xaf2b('0x1a')],_0x851220['filters']));if(_0x275402[_0xaf2b('0x1a')][_0xaf2b('0x24')]){_0x57b31b[_0xaf2b('0x21')]=_[_0xaf2b('0x25')](_0x57b31b[_0xaf2b('0x21')],{'$or':_[_0xaf2b('0x14')](_0x57b31b['attributes'],function(_0x18b4e9){var _0x8f775e={};_0x8f775e[_0x18b4e9]={'$like':'%'+_0x275402[_0xaf2b('0x1a')]['filter']+'%'};return _0x8f775e;})});}_0x57b31b=_[_0xaf2b('0x25')]({},_0x57b31b,_0x275402['options']);return _0x131411[_0xaf2b('0x38')](_0x57b31b);}})[_0xaf2b('0x28')](function(_0x340388){if(_0x340388){_0x394524=_0x340388[_0xaf2b('0x31')];if(!_0x275402['query'][_0xaf2b('0x1e')]('nolimit')){_0x57b31b[_0xaf2b('0x7')]=qs[_0xaf2b('0x7')](_0x275402['query']['limit']);_0x57b31b['offset']=qs['offset'](_0x275402[_0xaf2b('0x1a')][_0xaf2b('0x4')]);}return _0x131411[_0xaf2b('0x38')](_0x57b31b);}})[_0xaf2b('0x28')](function(_0x2993db){if(_0x2993db){return _0x2993db?{'count':_0x394524,'rows':_0x2993db}:null;}})[_0xaf2b('0x28')](respondWithResult(_0x4fa995,null))[_0xaf2b('0x2d')](handleError(_0x4fa995,null));};exports[_0xaf2b('0x39')]=function(_0x1f5320,_0x1eb354){if(_0x1f5320[_0xaf2b('0x35')]['id']){delete _0x1f5320[_0xaf2b('0x35')]['id'];}return db[_0xaf2b('0x15')][_0xaf2b('0x3a')]({'where':{'id':_0x1f5320['params']['id']}})[_0xaf2b('0x28')](handleEntityNotFound(_0x1eb354,null))[_0xaf2b('0x28')](function(_0x14bbd3){if(_0x14bbd3){_0x1f5320[_0xaf2b('0x35')][_0xaf2b('0x3b')]=_0x14bbd3['id'];_0x1f5320['body']['Subjects']=integrations[_0xaf2b('0x3c')](_0x1f5320[_0xaf2b('0x35')][_0xaf2b('0x3d')],_0x1f5320[_0xaf2b('0x35')][_0xaf2b('0x26')]);_0x1f5320[_0xaf2b('0x35')][_0xaf2b('0x3e')]=integrations[_0xaf2b('0x3f')](_0x1f5320[_0xaf2b('0x35')][_0xaf2b('0x3d')],_0x1f5320[_0xaf2b('0x35')][_0xaf2b('0x26')]);return db[_0xaf2b('0x37')][_0xaf2b('0x33')](_0x1f5320[_0xaf2b('0x35')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xaf2b('0x40')],'as':'Descriptions'}]});}return null;})[_0xaf2b('0x28')](respondWithResult(_0x1eb354,null))['catch'](handleError(_0x1eb354,null));};function sanitizeRemoteUri(_0x377163){var _0x53b8e0=_0x377163[_0xaf2b('0x41')](-0x1);if(_0x53b8e0==='/')return _0x377163[_0xaf2b('0x42')](0x0,_0x377163[_0xaf2b('0x43')](_0x53b8e0));return _0x377163;}function getWebApiUrl(_0x16f41c){return util['format'](_0xaf2b('0x44'),_0x16f41c);}exports[_0xaf2b('0x45')]=function(_0x3f39cb,_0x5bc5fb){var _0x52514f=_0x3f39cb[_0xaf2b('0x1a')][_0xaf2b('0x46')];var _0x415f71=_0x52514f===_0xaf2b('0x47')?_0xaf2b('0x48'):'PhoneCall';var _0x3c7184='';var _0x46504d='';var _0x58caaa='';var _0x4d7a49='';var _0x202ebb='';var _0x37942e='';var _0x218057='';var _0x127910='';var _0x2dac1d=[_0xaf2b('0x49'),_0xaf2b('0x4a'),_0xaf2b('0x4b'),'ownerid','caseorigincode',_0xaf2b('0x4c'),_0xaf2b('0x4d'),_0xaf2b('0x4e'),'directioncode',_0xaf2b('0x4f')];var _0x5c7e4e=[_0xaf2b('0x50'),'accountidyominame','actualserviceunits',_0xaf2b('0x51'),_0xaf2b('0x52'),_0xaf2b('0x53'),_0xaf2b('0x54'),'contractidname',_0xaf2b('0x55'),'createdbyexternalpartyyominame',_0xaf2b('0x56'),_0xaf2b('0x57'),_0xaf2b('0x58'),_0xaf2b('0x59'),_0xaf2b('0x5a'),_0xaf2b('0x5b'),_0xaf2b('0x5c'),_0xaf2b('0x5d'),_0xaf2b('0x5e'),'entitlementidname',_0xaf2b('0x5f'),_0xaf2b('0x60'),'escalatedon',_0xaf2b('0x61'),'firstresponsebykpiidname',_0xaf2b('0x62'),_0xaf2b('0x63'),_0xaf2b('0x64'),'kbarticleidname',_0xaf2b('0x65'),'masteridname',_0xaf2b('0x66'),_0xaf2b('0x67'),_0xaf2b('0x68'),_0xaf2b('0x69'),_0xaf2b('0x6a'),_0xaf2b('0x6b'),_0xaf2b('0x6c'),_0xaf2b('0x6d'),_0xaf2b('0x6e'),'numberofchildincidents',_0xaf2b('0x6f'),_0xaf2b('0x70'),_0xaf2b('0x71'),_0xaf2b('0x72'),'owneridyominame',_0xaf2b('0x73'),_0xaf2b('0x74'),_0xaf2b('0x75'),_0xaf2b('0x76'),_0xaf2b('0x77'),_0xaf2b('0x78'),_0xaf2b('0x79'),'resolvebykpiidname',_0xaf2b('0x7a'),'responsiblecontactidname',_0xaf2b('0x7b'),_0xaf2b('0x7c'),_0xaf2b('0x7d'),_0xaf2b('0x7e'),_0xaf2b('0x7f'),_0xaf2b('0x80'),_0xaf2b('0x81'),_0xaf2b('0x82'),_0xaf2b('0x83'),_0xaf2b('0x84'),_0xaf2b('0x85'),'traversedpath',_0xaf2b('0x86'),_0xaf2b('0x87')];var _0x272aab=_0x2dac1d[_0xaf2b('0x88')](_0x5c7e4e);return db[_0xaf2b('0x15')][_0xaf2b('0x3a')]({'where':{'id':_0x3f39cb[_0xaf2b('0x2f')]['id']},'attributes':['id',_0xaf2b('0x89'),_0xaf2b('0x8a'),_0xaf2b('0x8b'),_0xaf2b('0x8c'),_0xaf2b('0x8d'),_0xaf2b('0x8e'),_0xaf2b('0x8f')],'include':[{'model':db['CloudProvider'],'as':_0xaf2b('0x90'),'attributes':['id',_0xaf2b('0x91'),_0xaf2b('0x92')]}]})[_0xaf2b('0x28')](handleEntityNotFound(_0x5bc5fb,null))['then'](function(_0x28fd1f){if(_0x28fd1f){if(_0x28fd1f[_0xaf2b('0x8f')]){_0x28fd1f[_0xaf2b('0x93')]=_0x28fd1f[_0xaf2b('0x90')][_0xaf2b('0x91')];_0x127910=sanitizeRemoteUri(_0x28fd1f[_0xaf2b('0x90')][_0xaf2b('0x92')]);_0x218057=getWebApiUrl(_0x127910);return _0x28fd1f;}_0x127910=sanitizeRemoteUri(_0x28fd1f[_0xaf2b('0x8b')]);_0x218057=getWebApiUrl(_0x127910);var _0x75d173={'method':_0xaf2b('0x94'),'uri':_0xaf2b('0x95')+_0x28fd1f['tenantId']+_0xaf2b('0x96'),'form':{'client_id':_0x28fd1f[_0xaf2b('0x8d')],'resource':_0x127910,'username':_0x28fd1f[_0xaf2b('0x89')],'password':_0x28fd1f[_0xaf2b('0x8a')],'grant_type':_0xaf2b('0x8a'),'client_secret':_0x28fd1f[_0xaf2b('0x8e')]},'json':!![]};return rp(_0x75d173);}})['then'](function(_0x533f2d){_0x37942e=_0x533f2d[_0xaf2b('0x93')];var _0x57328e={'method':'GET','uri':encodeURI(_0x218057+_0xaf2b('0x97')+_0x415f71+'\x27'),'headers':{'Authorization':_0xaf2b('0x98')+_0x37942e,'If-None-Match':null,'OData-Version':_0xaf2b('0x99')},'json':!![]};return rp(_0x57328e);})['then'](function(_0x5d2d2){var _0x2405b7=_0x5d2d2[_0xaf2b('0x9a')][0x0];var _0x288bdf=_0x2405b7[_0xaf2b('0x9b')];var _0x47fb9f={'method':_0xaf2b('0x9c'),'uri':_0x218057+_0xaf2b('0x9d')+_0x288bdf+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xaf2b('0x98')+_0x37942e,'If-None-Match':null,'OData-Version':_0xaf2b('0x99')},'json':!![]};return rp(_0x47fb9f);})[_0xaf2b('0x28')](function(_0x2b7e50){_0x3c7184=_0x2b7e50;_0x46504d=_0x3c7184[_0xaf2b('0x9e')];_0x46504d=_[_0xaf2b('0x9f')](_0x46504d,function(_0x2731b2){return!_0x272aab[_0xaf2b('0xa0')](_0x2731b2[_0xaf2b('0xa1')]);});var _0x3a2d60=[];var _0x5a909c=[];_0x46504d[_0xaf2b('0xa2')](function(_0x1a8630){if(_0x1a8630[_0xaf2b('0xa3')]){var _0x523767=_0x1a8630['@odata.type']['substring'](_0x1a8630[_0xaf2b('0xa3')][_0xaf2b('0x43')]('.')+0x1);if(_0x523767===_0xaf2b('0xa4')){_0x3a2d60[_0xaf2b('0xa5')](getSelectList(_0x218057,_0x52514f,_0x5a909c,_0x3c7184['MetadataId'],_0x1a8630[_0xaf2b('0x9b')],_0x37942e));}}});return Promise[_0xaf2b('0xa6')](_0x3a2d60);})[_0xaf2b('0x28')](function(_0x4f4c37){_0x58caaa=_0x4f4c37[0x0];var _0x588a7b=[];var _0x402e7e=[];_0x46504d['forEach'](function(_0x12728c){if(!_[_0xaf2b('0xa7')](_0x12728c[_0xaf2b('0xa3')])){var _0x1bc916=_0x12728c['@odata.type'][_0xaf2b('0x42')](_0x12728c[_0xaf2b('0xa3')][_0xaf2b('0x43')]('.')+0x1);if(_0x1bc916==='BooleanAttributeMetadata'){_0x588a7b['push'](getBooleanList(_0x218057,_0x52514f,_0x402e7e,_0x3c7184['MetadataId'],_0x12728c[_0xaf2b('0x9b')],_0x37942e));}}});return Promise[_0xaf2b('0xa6')](_0x588a7b);})[_0xaf2b('0x28')](function(_0x5b9c3f){_0x4d7a49=_0x5b9c3f[0x0];var _0x264cda=[];var _0x49550c=[];_0x46504d['forEach'](function(_0x1a3475){if(_0x1a3475['@odata.type']){var _0x2041aa=_0x1a3475['@odata.type'][_0xaf2b('0x42')](_0x1a3475[_0xaf2b('0xa3')]['lastIndexOf']('.')+0x1);if(_0x2041aa===_0xaf2b('0xa8')||_0x2041aa===_0xaf2b('0xa9')||_0x2041aa===_0xaf2b('0xaa')||_0x2041aa==='IntegerAttributeMetadata'||_0x2041aa===_0xaf2b('0xab')||_0x2041aa===_0xaf2b('0xac')||_0x2041aa===_0xaf2b('0xad')||_0x2041aa===_0xaf2b('0xae')||_0x2041aa===_0xaf2b('0xaf')||_0x2041aa==='DecimalAttributeMetadata'){_0x264cda[_0xaf2b('0xa5')](getInputList(_0x218057,_0x52514f,_0x2041aa,_0x49550c,_0x3c7184['MetadataId'],_0x1a3475['MetadataId'],_0x37942e));}}});return Promise[_0xaf2b('0xa6')](_0x264cda);})[_0xaf2b('0x28')](function(_0x30a200){_0x202ebb=_0x30a200[0x0];var _0x594584=_0x58caaa[_0xaf2b('0x88')](_0x4d7a49)[_0xaf2b('0x88')](_0x202ebb);var _0xcf4d92={'count':_0x594584['length'],'rows':_0x594584};return _0xcf4d92;})[_0xaf2b('0x28')](respondWithResult(_0x5bc5fb,null))[_0xaf2b('0x2d')](function(_0x2fddf5){var _0x339b4f=_0x3f39cb[_0xaf2b('0x1a')][_0xaf2b('0xb0')]?0x1f4:_0x2fddf5['statusCode']||0x1f4;logger[_0xaf2b('0xf')](_0x2fddf5['stack']);delete _0x2fddf5['name'];if(_0x339b4f===0x191){_0x339b4f=0x190;}_0x5bc5fb[_0xaf2b('0x8')](_0x339b4f)['send'](_0x3f39cb[_0xaf2b('0x1a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2fddf5[_0xaf2b('0xb1')]}:_0x2fddf5);});};function getSelectList(_0x639a84,_0x35ea09,_0x264af8,_0x5c8b76,_0x14dd63,_0x33b0ea){var _0x584757={'method':_0xaf2b('0x9c'),'uri':_0x639a84+_0xaf2b('0x9d')+_0x5c8b76+_0xaf2b('0xb2')+_0x14dd63+_0xaf2b('0xb3')+_0xaf2b('0xb4'),'headers':{'Authorization':_0xaf2b('0x98')+_0x33b0ea,'If-None-Match':null,'OData-Version':_0xaf2b('0x99')},'json':!![]};return rp(_0x584757)[_0xaf2b('0x28')](function(_0x477c4c){var _0x599bb5=[];var _0x852825=_0x477c4c[_0xaf2b('0xb5')]['Options'];_0x852825[_0xaf2b('0xa2')](function(_0x1a6b89){_0x599bb5[_0xaf2b('0xa5')]({'name':_0x1a6b89[_0xaf2b('0xb6')][_0xaf2b('0xb7')][_0xaf2b('0xb6')],'value':String(_0x1a6b89[_0xaf2b('0xb8')])});});var _0x155a2b={'id':_0x35ea09+'_'+_0x477c4c[_0xaf2b('0xa1')],'name':_0x477c4c['DisplayName'][_0xaf2b('0xb7')][_0xaf2b('0xb6')],'custom':![],'options':_0x599bb5};_0x264af8[_0xaf2b('0xa5')](_0x155a2b);return _0x264af8;});}function getBooleanList(_0x2fab07,_0x11fd2a,_0x3820d7,_0x35cf13,_0x1727a4,_0x5752cc){var _0x5e52a7={'method':_0xaf2b('0x9c'),'uri':_0x2fab07+_0xaf2b('0x9d')+_0x35cf13+_0xaf2b('0xb2')+_0x1727a4+_0xaf2b('0xb9'),'headers':{'Authorization':_0xaf2b('0x98')+_0x5752cc,'If-None-Match':null,'OData-Version':_0xaf2b('0x99')},'json':!![]};return rp(_0x5e52a7)[_0xaf2b('0x28')](function(_0x1ceea4){var _0x1d9142=[];_0x1d9142[_0xaf2b('0xa5')]({'name':_0x1ceea4['OptionSet'][_0xaf2b('0xba')][_0xaf2b('0xb6')][_0xaf2b('0xb7')][_0xaf2b('0xb6')],'value':_0xaf2b('0xbb')},{'name':_0x1ceea4[_0xaf2b('0xb5')]['FalseOption'][_0xaf2b('0xb6')][_0xaf2b('0xb7')]['Label'],'value':'false'});var _0x117726={'id':_0x11fd2a+'_'+_0x1ceea4['LogicalName'],'name':_0x1ceea4[_0xaf2b('0xbc')][_0xaf2b('0xb7')][_0xaf2b('0xb6')],'custom':![],'options':_0x1d9142};_0x3820d7[_0xaf2b('0xa5')](_0x117726);return _0x3820d7;});}function getInputList(_0x2a4467,_0x2b4d55,_0x55bc5b,_0x1fc142,_0x550a5e,_0x5b84d2,_0x5f138a){var _0x109d74={'method':_0xaf2b('0x9c'),'uri':_0x2a4467+_0xaf2b('0x9d')+_0x550a5e+')/Attributes('+_0x5b84d2+_0xaf2b('0xbd')+_0x55bc5b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xaf2b('0x98')+_0x5f138a,'If-None-Match':null,'OData-Version':_0xaf2b('0x99')},'json':!![]};return rp(_0x109d74)[_0xaf2b('0x28')](function(_0x1cf52a){var _0x337e6e={'id':_0x2b4d55+'_'+_0x1cf52a[_0xaf2b('0xa1')],'name':_0x1cf52a[_0xaf2b('0xbc')]['UserLocalizedLabel']?_0x1cf52a[_0xaf2b('0xbc')][_0xaf2b('0xb7')]['Label']:_0x1cf52a['LogicalName'],'custom':![],'options':[]};_0x1fc142[_0xaf2b('0xa5')](_0x337e6e);return _0x1fc142;});} \ No newline at end of file +var _0x4d4b=['timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','findOne','username','password','remoteUri','tenantId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','OptionSet','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','destroy','then','end','sendStatus','stack','name','send','index','map','Dynamics365Account','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode'];(function(_0x88a45a,_0x430fa9){var _0x56cba4=function(_0x8c0734){while(--_0x8c0734){_0x88a45a['push'](_0x88a45a['shift']());}};_0x56cba4(++_0x430fa9);}(_0x4d4b,0xf5));var _0xb4d4=function(_0x133306,_0x2f9048){_0x133306=_0x133306-0x0;var _0x31f94c=_0x4d4b[_0x133306];return _0x31f94c;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xb4d4('0x0'));var qs=require(_0xb4d4('0x1'));var logger=require(_0xb4d4('0x2'))(_0xb4d4('0x3'));var db=require(_0xb4d4('0x4'))['db'];var integrations=require(_0xb4d4('0x5'));function respondWithResult(_0x299373,_0x1ae142){_0x1ae142=_0x1ae142||0xc8;return function(_0x22b050){if(_0x22b050){return _0x299373[_0xb4d4('0x6')](_0x1ae142)[_0xb4d4('0x7')](_0x22b050);}};}function respondWithFilteredResult(_0x772dc,_0x18612d){return function(_0x19ab48){if(_0x19ab48){var _0x178707=typeof _0x18612d[_0xb4d4('0x8')]==='undefined'&&typeof _0x18612d[_0xb4d4('0x9')]===_0xb4d4('0xa');var _0x1c8c6b=_0x19ab48['count'];var _0x5965f8=_0x178707?0x0:_0x18612d[_0xb4d4('0x8')];var _0x452301=_0x178707?_0x19ab48[_0xb4d4('0xb')]:_0x18612d[_0xb4d4('0x8')]+_0x18612d['limit'];var _0x38dffa;if(_0x452301>=_0x1c8c6b){_0x452301=_0x1c8c6b;_0x38dffa=0xc8;}else{_0x38dffa=0xce;}_0x772dc[_0xb4d4('0x6')](_0x38dffa);return _0x772dc[_0xb4d4('0xc')]('Content-Range',_0x5965f8+'-'+_0x452301+'/'+_0x1c8c6b)[_0xb4d4('0x7')](_0x19ab48);}return null;};}function saveUpdates(_0x1d4ec1){return function(_0x2ebb97){if(_0x2ebb97){return _0x2ebb97['update'](_0x1d4ec1)['then'](function(_0x13e702){return _0x13e702;});}return null;};}function removeEntity(_0x4a8ebe){return function(_0x406c7a){if(_0x406c7a){return _0x406c7a[_0xb4d4('0xd')]()[_0xb4d4('0xe')](function(){_0x4a8ebe[_0xb4d4('0x6')](0xcc)[_0xb4d4('0xf')]();});}};}function handleEntityNotFound(_0x150d7d){return function(_0x325e6e){if(!_0x325e6e){_0x150d7d[_0xb4d4('0x10')](0x194);}return _0x325e6e;};}function handleError(_0x4c62fe,_0x4800c7){_0x4800c7=_0x4800c7||0x1f4;return function(_0x5235f3){logger['error'](_0x5235f3[_0xb4d4('0x11')]);if(_0x5235f3[_0xb4d4('0x12')]){delete _0x5235f3['name'];}_0x4c62fe[_0xb4d4('0x6')](_0x4800c7)[_0xb4d4('0x13')](_0x5235f3);};}exports[_0xb4d4('0x14')]=function(_0x306780,_0x3c9c96){var _0x4468c6={},_0x5ed065={},_0x25d703={'count':0x0,'rows':[]};var _0x3f46fb=_[_0xb4d4('0x15')](db[_0xb4d4('0x16')]['rawAttributes'],function(_0x136202){return{'name':_0x136202['fieldName'],'type':_0x136202[_0xb4d4('0x17')][_0xb4d4('0x18')]};});_0x5ed065[_0xb4d4('0x19')]=_[_0xb4d4('0x15')](_0x3f46fb,_0xb4d4('0x12'));_0x5ed065[_0xb4d4('0x1a')]=_[_0xb4d4('0x1b')](_0x306780[_0xb4d4('0x1a')]);_0x5ed065[_0xb4d4('0x1c')]=_[_0xb4d4('0x1d')](_0x5ed065[_0xb4d4('0x19')],_0x5ed065['query']);_0x4468c6[_0xb4d4('0x1e')]=_[_0xb4d4('0x1d')](_0x5ed065[_0xb4d4('0x19')],qs[_0xb4d4('0x1f')](_0x306780[_0xb4d4('0x1a')]['fields']));_0x4468c6[_0xb4d4('0x1e')]=_0x4468c6[_0xb4d4('0x1e')][_0xb4d4('0x20')]?_0x4468c6[_0xb4d4('0x1e')]:_0x5ed065[_0xb4d4('0x19')];if(!_0x306780[_0xb4d4('0x1a')][_0xb4d4('0x21')]('nolimit')){_0x4468c6['limit']=qs[_0xb4d4('0x9')](_0x306780[_0xb4d4('0x1a')][_0xb4d4('0x9')]);_0x4468c6[_0xb4d4('0x8')]=qs['offset'](_0x306780['query'][_0xb4d4('0x8')]);}_0x4468c6[_0xb4d4('0x22')]=qs['sort'](_0x306780['query'][_0xb4d4('0x23')]);_0x4468c6[_0xb4d4('0x24')]=qs[_0xb4d4('0x1c')](_[_0xb4d4('0x25')](_0x306780[_0xb4d4('0x1a')],_0x5ed065['filters']),_0x3f46fb);if(_0x306780[_0xb4d4('0x1a')][_0xb4d4('0x26')]){_0x4468c6[_0xb4d4('0x24')]=_[_0xb4d4('0x27')](_0x4468c6['where'],{'$or':_[_0xb4d4('0x15')](_0x3f46fb,function(_0x49935d){if(_0x49935d['type']!==_0xb4d4('0x28')){var _0x37c889={};_0x37c889[_0x49935d[_0xb4d4('0x12')]]={'$like':'%'+_0x306780[_0xb4d4('0x1a')]['filter']+'%'};return _0x37c889;}})});}_0x4468c6=_[_0xb4d4('0x27')]({},_0x4468c6,_0x306780[_0xb4d4('0x29')]);var _0x3ca390={'where':_0x4468c6['where']};return db[_0xb4d4('0x16')][_0xb4d4('0xb')](_0x3ca390)[_0xb4d4('0xe')](function(_0x26d81e){_0x25d703[_0xb4d4('0xb')]=_0x26d81e;if(_0x306780[_0xb4d4('0x1a')]['includeAll']){_0x4468c6[_0xb4d4('0x2a')]=[{'all':!![]}];}return db[_0xb4d4('0x16')][_0xb4d4('0x2b')](_0x4468c6);})[_0xb4d4('0xe')](function(_0x474a1d){_0x25d703[_0xb4d4('0x2c')]=_0x474a1d;return _0x25d703;})[_0xb4d4('0xe')](respondWithFilteredResult(_0x3c9c96,_0x4468c6))['catch'](handleError(_0x3c9c96,null));};exports[_0xb4d4('0x2d')]=function(_0x122bec,_0x631eda){var _0x69d70c={'raw':![],'where':{'id':_0x122bec[_0xb4d4('0x2e')]['id']}},_0x2c97fc={};_0x2c97fc[_0xb4d4('0x19')]=_[_0xb4d4('0x1b')](db['Dynamics365Account'][_0xb4d4('0x2f')]);_0x2c97fc[_0xb4d4('0x1a')]=_[_0xb4d4('0x1b')](_0x122bec['query']);_0x2c97fc['filters']=_[_0xb4d4('0x1d')](_0x2c97fc[_0xb4d4('0x19')],_0x2c97fc[_0xb4d4('0x1a')]);_0x69d70c[_0xb4d4('0x1e')]=_['intersection'](_0x2c97fc['model'],qs['fields'](_0x122bec['query']['fields']));_0x69d70c[_0xb4d4('0x1e')]=_0x69d70c['attributes']['length']?_0x69d70c[_0xb4d4('0x1e')]:_0x2c97fc[_0xb4d4('0x19')];if(_0x122bec[_0xb4d4('0x1a')][_0xb4d4('0x30')]){_0x69d70c['include']=[{'all':!![]}];}_0x69d70c=_[_0xb4d4('0x27')]({},_0x69d70c,_0x122bec['options']);return db['Dynamics365Account'][_0xb4d4('0x31')](_0x69d70c)[_0xb4d4('0xe')](handleEntityNotFound(_0x631eda,null))[_0xb4d4('0xe')](respondWithResult(_0x631eda,null))[_0xb4d4('0x32')](handleError(_0x631eda,null));};exports[_0xb4d4('0x33')]=function(_0x51c0b1,_0x191e02){return db[_0xb4d4('0x16')][_0xb4d4('0x33')](_0x51c0b1[_0xb4d4('0x34')],{})['then'](respondWithResult(_0x191e02,0xc9))['catch'](handleError(_0x191e02,null));};exports['update']=function(_0x15065f,_0x3246a7){if(_0x15065f['body']['id']){delete _0x15065f[_0xb4d4('0x34')]['id'];}return db[_0xb4d4('0x16')][_0xb4d4('0x31')]({'where':{'id':_0x15065f[_0xb4d4('0x2e')]['id']}})[_0xb4d4('0xe')](handleEntityNotFound(_0x3246a7,null))['then'](saveUpdates(_0x15065f[_0xb4d4('0x34')],null))[_0xb4d4('0xe')](respondWithResult(_0x3246a7,null))[_0xb4d4('0x32')](handleError(_0x3246a7,null));};exports['destroy']=function(_0x1c19a8,_0x4c2dae){return db['Dynamics365Account'][_0xb4d4('0x31')]({'where':{'id':_0x1c19a8['params']['id']}})[_0xb4d4('0xe')](handleEntityNotFound(_0x4c2dae,null))['then'](removeEntity(_0x4c2dae,null))['catch'](handleError(_0x4c2dae,null));};exports[_0xb4d4('0x35')]=function(_0x4c1d63,_0x54fecf){var _0x38187b={};var _0x1545f8={};var _0x4935b6;var _0xd863f2;return db['Dynamics365Account']['findOne']({'where':{'id':_0x4c1d63['params']['id']}})[_0xb4d4('0xe')](handleEntityNotFound(_0x54fecf,null))['then'](function(_0x4c87f2){if(_0x4c87f2){_0x4935b6=_0x4c87f2;_0x1545f8[_0xb4d4('0x19')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x1545f8['query']=_['keys'](_0x4c1d63['query']);_0x1545f8[_0xb4d4('0x1c')]=_[_0xb4d4('0x1d')](_0x1545f8[_0xb4d4('0x19')],_0x1545f8[_0xb4d4('0x1a')]);_0x38187b[_0xb4d4('0x1e')]=_['intersection'](_0x1545f8[_0xb4d4('0x19')],qs[_0xb4d4('0x1f')](_0x4c1d63['query']['fields']));_0x38187b[_0xb4d4('0x1e')]=_0x38187b['attributes'][_0xb4d4('0x20')]?_0x38187b[_0xb4d4('0x1e')]:_0x1545f8[_0xb4d4('0x19')];_0x38187b[_0xb4d4('0x22')]=qs[_0xb4d4('0x23')](_0x4c1d63[_0xb4d4('0x1a')][_0xb4d4('0x23')]);_0x38187b[_0xb4d4('0x24')]=qs[_0xb4d4('0x1c')](_['pick'](_0x4c1d63['query'],_0x1545f8[_0xb4d4('0x1c')]));if(_0x4c1d63[_0xb4d4('0x1a')][_0xb4d4('0x26')]){_0x38187b[_0xb4d4('0x24')]=_[_0xb4d4('0x27')](_0x38187b[_0xb4d4('0x24')],{'$or':_[_0xb4d4('0x15')](_0x38187b[_0xb4d4('0x1e')],function(_0x30c7bf){var _0x206965={};_0x206965[_0x30c7bf]={'$like':'%'+_0x4c1d63[_0xb4d4('0x1a')]['filter']+'%'};return _0x206965;})});}_0x38187b=_[_0xb4d4('0x27')]({},_0x38187b,_0x4c1d63[_0xb4d4('0x29')]);return _0x4935b6[_0xb4d4('0x35')](_0x38187b);}})[_0xb4d4('0xe')](function(_0xb12f05){if(_0xb12f05){_0xd863f2=_0xb12f05[_0xb4d4('0x20')];if(!_0x4c1d63[_0xb4d4('0x1a')][_0xb4d4('0x21')](_0xb4d4('0x36'))){_0x38187b[_0xb4d4('0x9')]=qs[_0xb4d4('0x9')](_0x4c1d63[_0xb4d4('0x1a')][_0xb4d4('0x9')]);_0x38187b[_0xb4d4('0x8')]=qs['offset'](_0x4c1d63[_0xb4d4('0x1a')][_0xb4d4('0x8')]);}return _0x4935b6['getConfigurations'](_0x38187b);}})[_0xb4d4('0xe')](function(_0x1400cd){if(_0x1400cd){return _0x1400cd?{'count':_0xd863f2,'rows':_0x1400cd}:null;}})[_0xb4d4('0xe')](respondWithResult(_0x54fecf,null))[_0xb4d4('0x32')](handleError(_0x54fecf,null));};exports[_0xb4d4('0x37')]=function(_0x32733a,_0x2ab949){if(_0x32733a[_0xb4d4('0x34')]['id']){delete _0x32733a[_0xb4d4('0x34')]['id'];}return db[_0xb4d4('0x16')]['findOne']({'where':{'id':_0x32733a[_0xb4d4('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2ab949,null))[_0xb4d4('0xe')](function(_0x1c81ca){if(_0x1c81ca){_0x32733a['body'][_0xb4d4('0x38')]=_0x1c81ca['id'];_0x32733a['body']['Subjects']=integrations[_0xb4d4('0x39')](_0x32733a[_0xb4d4('0x34')][_0xb4d4('0x3a')],_0x32733a[_0xb4d4('0x34')][_0xb4d4('0x17')]);_0x32733a[_0xb4d4('0x34')][_0xb4d4('0x3b')]=integrations[_0xb4d4('0x3c')](_0x32733a[_0xb4d4('0x34')]['channel'],_0x32733a[_0xb4d4('0x34')][_0xb4d4('0x17')]);return db[_0xb4d4('0x3d')]['create'](_0x32733a[_0xb4d4('0x34')],{'include':[{'model':db[_0xb4d4('0x3e')],'as':_0xb4d4('0x3f')},{'model':db[_0xb4d4('0x3e')],'as':_0xb4d4('0x3b')}]});}return null;})[_0xb4d4('0xe')](respondWithResult(_0x2ab949,null))[_0xb4d4('0x32')](handleError(_0x2ab949,null));};function sanitizeRemoteUri(_0x52ce38){var _0xaf028f=_0x52ce38[_0xb4d4('0x40')](-0x1);if(_0xaf028f==='/')return _0x52ce38[_0xb4d4('0x41')](0x0,_0x52ce38[_0xb4d4('0x42')](_0xaf028f));return _0x52ce38;}function getWebApiUrl(_0x34a530){return util[_0xb4d4('0x43')](_0xb4d4('0x44'),_0x34a530);}exports[_0xb4d4('0x45')]=function(_0xac3cb7,_0x2738d9){var _0x4c7672=_0xac3cb7[_0xb4d4('0x1a')]['ticketType'];var _0x5de06a=_0x4c7672===_0xb4d4('0x46')?_0xb4d4('0x47'):_0xb4d4('0x48');var _0xd94ddb='';var _0x2d1798='';var _0x2636e2='';var _0x2d9bf6='';var _0x3a0792='';var _0x5ebb75='';var _0x3dd47b='';var _0x5e1064='';var _0xa84923=['title',_0xb4d4('0x49'),_0xb4d4('0x4a'),'ownerid',_0xb4d4('0x4b'),_0xb4d4('0x4c'),_0xb4d4('0x4d'),_0xb4d4('0x4e'),'directioncode',_0xb4d4('0x4f')];var _0x4e2713=[_0xb4d4('0x50'),_0xb4d4('0x51'),_0xb4d4('0x52'),_0xb4d4('0x53'),_0xb4d4('0x54'),'contactidyominame','contractdetailidname',_0xb4d4('0x55'),_0xb4d4('0x56'),_0xb4d4('0x57'),'createdbyname',_0xb4d4('0x58'),_0xb4d4('0x59'),'createdonbehalfbyname',_0xb4d4('0x5a'),_0xb4d4('0x5b'),'customeridtype',_0xb4d4('0x5c'),_0xb4d4('0x5d'),_0xb4d4('0x5e'),_0xb4d4('0x5f'),_0xb4d4('0x60'),'escalatedon',_0xb4d4('0x61'),_0xb4d4('0x62'),_0xb4d4('0x63'),_0xb4d4('0x64'),_0xb4d4('0x65'),_0xb4d4('0x66'),_0xb4d4('0x67'),_0xb4d4('0x68'),_0xb4d4('0x69'),_0xb4d4('0x6a'),'modifiedbyname',_0xb4d4('0x6b'),_0xb4d4('0x6c'),_0xb4d4('0x6d'),_0xb4d4('0x6e'),_0xb4d4('0x6f'),'msdyn_iotalertname',_0xb4d4('0x70'),_0xb4d4('0x71'),_0xb4d4('0x72'),_0xb4d4('0x73'),'owneridtype',_0xb4d4('0x74'),'parentcaseidname',_0xb4d4('0x75'),_0xb4d4('0x76'),'prioritycodename','productidname',_0xb4d4('0x77'),_0xb4d4('0x78'),_0xb4d4('0x79'),_0xb4d4('0x7a'),'responsiblecontactidname',_0xb4d4('0x7b'),_0xb4d4('0x7c'),_0xb4d4('0x7d'),_0xb4d4('0x7e'),_0xb4d4('0x7f'),'statecode',_0xb4d4('0x80'),'subjectidname','ticketnumber',_0xb4d4('0x81'),'transactioncurrencyidname',_0xb4d4('0x82'),_0xb4d4('0x83'),'versionnumber'];var _0x50bb95=_0xa84923[_0xb4d4('0x84')](_0x4e2713);return db[_0xb4d4('0x16')][_0xb4d4('0x85')]({'where':{'id':_0xac3cb7[_0xb4d4('0x2e')]['id']},'attributes':['id',_0xb4d4('0x86'),_0xb4d4('0x87'),_0xb4d4('0x88'),_0xb4d4('0x89'),'clientId',_0xb4d4('0x8a'),'modernAuthentication'],'include':[{'model':db[_0xb4d4('0x8b')],'as':_0xb4d4('0x8b'),'attributes':['id',_0xb4d4('0x8c'),'data7']}]})['then'](handleEntityNotFound(_0x2738d9,null))['then'](function(_0x45e703){if(_0x45e703){if(_0x45e703[_0xb4d4('0x8d')]){_0x45e703[_0xb4d4('0x8e')]=_0x45e703[_0xb4d4('0x8b')]['data5'];_0x5e1064=sanitizeRemoteUri(_0x45e703[_0xb4d4('0x8b')]['data7']);_0x3dd47b=getWebApiUrl(_0x5e1064);return _0x45e703;}_0x5e1064=sanitizeRemoteUri(_0x45e703['remoteUri']);_0x3dd47b=getWebApiUrl(_0x5e1064);var _0x4f0778={'method':_0xb4d4('0x8f'),'uri':_0xb4d4('0x90')+_0x45e703[_0xb4d4('0x89')]+_0xb4d4('0x91'),'form':{'client_id':_0x45e703[_0xb4d4('0x92')],'resource':_0x5e1064,'username':_0x45e703[_0xb4d4('0x86')],'password':_0x45e703[_0xb4d4('0x87')],'grant_type':_0xb4d4('0x87'),'client_secret':_0x45e703['clientSecret']},'json':!![]};return rp(_0x4f0778);}})[_0xb4d4('0xe')](function(_0x39230b){_0x5ebb75=_0x39230b[_0xb4d4('0x8e')];var _0x1dfc7f={'method':_0xb4d4('0x93'),'uri':encodeURI(_0x3dd47b+_0xb4d4('0x94')+_0x5de06a+'\x27'),'headers':{'Authorization':_0xb4d4('0x95')+_0x5ebb75,'If-None-Match':null,'OData-Version':_0xb4d4('0x96')},'json':!![]};return rp(_0x1dfc7f);})[_0xb4d4('0xe')](function(_0x31aada){var _0x49ae78=_0x31aada['value'][0x0];var _0x64da55=_0x49ae78[_0xb4d4('0x97')];var _0x5ce960={'method':_0xb4d4('0x93'),'uri':_0x3dd47b+'EntityDefinitions('+_0x64da55+_0xb4d4('0x98'),'headers':{'Authorization':'Bearer\x20'+_0x5ebb75,'If-None-Match':null,'OData-Version':_0xb4d4('0x96')},'json':!![]};return rp(_0x5ce960);})[_0xb4d4('0xe')](function(_0x3c844e){_0xd94ddb=_0x3c844e;_0x2d1798=_0xd94ddb[_0xb4d4('0x99')];_0x2d1798=_['remove'](_0x2d1798,function(_0x28d27c){return!_0x50bb95[_0xb4d4('0x9a')](_0x28d27c[_0xb4d4('0x9b')]);});var _0x42ba91=[];var _0x178548=[];_0x2d1798[_0xb4d4('0x9c')](function(_0x394813){if(_0x394813[_0xb4d4('0x9d')]){var _0x385bbb=_0x394813[_0xb4d4('0x9d')]['substring'](_0x394813[_0xb4d4('0x9d')][_0xb4d4('0x42')]('.')+0x1);if(_0x385bbb===_0xb4d4('0x9e')){_0x42ba91['push'](getSelectList(_0x3dd47b,_0x4c7672,_0x178548,_0xd94ddb['MetadataId'],_0x394813[_0xb4d4('0x97')],_0x5ebb75));}}});return Promise[_0xb4d4('0x9f')](_0x42ba91);})['then'](function(_0x58794c){_0x2636e2=_0x58794c[0x0];var _0x3bf056=[];var _0x3ddc93=[];_0x2d1798[_0xb4d4('0x9c')](function(_0x37031a){if(!_[_0xb4d4('0xa0')](_0x37031a['@odata.type'])){var _0x1f0f46=_0x37031a[_0xb4d4('0x9d')][_0xb4d4('0x41')](_0x37031a[_0xb4d4('0x9d')]['lastIndexOf']('.')+0x1);if(_0x1f0f46===_0xb4d4('0xa1')){_0x3bf056[_0xb4d4('0xa2')](getBooleanList(_0x3dd47b,_0x4c7672,_0x3ddc93,_0xd94ddb['MetadataId'],_0x37031a[_0xb4d4('0x97')],_0x5ebb75));}}});return Promise['all'](_0x3bf056);})['then'](function(_0xb7b3db){_0x2d9bf6=_0xb7b3db[0x0];var _0x10e1b1=[];var _0x3c7026=[];_0x2d1798[_0xb4d4('0x9c')](function(_0x3e8e96){if(_0x3e8e96[_0xb4d4('0x9d')]){var _0x28ec7f=_0x3e8e96['@odata.type'][_0xb4d4('0x41')](_0x3e8e96['@odata.type'][_0xb4d4('0x42')]('.')+0x1);if(_0x28ec7f===_0xb4d4('0xa3')||_0x28ec7f===_0xb4d4('0xa4')||_0x28ec7f===_0xb4d4('0xa5')||_0x28ec7f===_0xb4d4('0xa6')||_0x28ec7f===_0xb4d4('0xa7')||_0x28ec7f===_0xb4d4('0xa8')||_0x28ec7f===_0xb4d4('0xa9')||_0x28ec7f==='EntityNameAttributeMetadata'||_0x28ec7f===_0xb4d4('0xaa')||_0x28ec7f===_0xb4d4('0xab')){_0x10e1b1[_0xb4d4('0xa2')](getInputList(_0x3dd47b,_0x4c7672,_0x28ec7f,_0x3c7026,_0xd94ddb[_0xb4d4('0x97')],_0x3e8e96['MetadataId'],_0x5ebb75));}}});return Promise[_0xb4d4('0x9f')](_0x10e1b1);})[_0xb4d4('0xe')](function(_0x44ba3b){_0x3a0792=_0x44ba3b[0x0];var _0x4ef629=_0x2636e2[_0xb4d4('0x84')](_0x2d9bf6)[_0xb4d4('0x84')](_0x3a0792);var _0x447278={'count':_0x4ef629['length'],'rows':_0x4ef629};return _0x447278;})[_0xb4d4('0xe')](respondWithResult(_0x2738d9,null))[_0xb4d4('0x32')](function(_0x59e578){var _0x446ac0=_0xac3cb7['query']['test']?0x1f4:_0x59e578[_0xb4d4('0xac')]||0x1f4;logger[_0xb4d4('0xad')](_0x59e578[_0xb4d4('0x11')]);delete _0x59e578[_0xb4d4('0x12')];if(_0x446ac0===0x191){_0x446ac0=0x190;}_0x2738d9[_0xb4d4('0x6')](_0x446ac0)[_0xb4d4('0x13')](_0xac3cb7[_0xb4d4('0x1a')]['test']?{'message':_0xb4d4('0xae'),'statusCode':_0x59e578['statusCode']}:_0x59e578);});};function getSelectList(_0x3dfffd,_0x1a28fa,_0x3086ce,_0x5182cd,_0x46a746,_0x112266){var _0x26d804={'method':'GET','uri':_0x3dfffd+_0xb4d4('0xaf')+_0x5182cd+_0xb4d4('0xb0')+_0x46a746+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xb4d4('0x95')+_0x112266,'If-None-Match':null,'OData-Version':_0xb4d4('0x96')},'json':!![]};return rp(_0x26d804)['then'](function(_0x42200d){var _0x167d59=[];var _0x2f61c3=_0x42200d[_0xb4d4('0xb1')]['Options'];_0x2f61c3['forEach'](function(_0x205782){_0x167d59[_0xb4d4('0xa2')]({'name':_0x205782[_0xb4d4('0xb2')]['UserLocalizedLabel']['Label'],'value':String(_0x205782[_0xb4d4('0xb3')])});});var _0x4ef14c={'id':_0x1a28fa+'_'+_0x42200d[_0xb4d4('0x9b')],'name':_0x42200d['DisplayName'][_0xb4d4('0xb4')]['Label'],'custom':![],'options':_0x167d59};_0x3086ce[_0xb4d4('0xa2')](_0x4ef14c);return _0x3086ce;});}function getBooleanList(_0x4eeadd,_0x342ffe,_0x300e48,_0x4e1f3f,_0x3e8cec,_0x343edc){var _0x453711={'method':_0xb4d4('0x93'),'uri':_0x4eeadd+_0xb4d4('0xaf')+_0x4e1f3f+_0xb4d4('0xb0')+_0x3e8cec+_0xb4d4('0xb5'),'headers':{'Authorization':_0xb4d4('0x95')+_0x343edc,'If-None-Match':null,'OData-Version':_0xb4d4('0x96')},'json':!![]};return rp(_0x453711)['then'](function(_0x39a12e){var _0x38fc21=[];_0x38fc21[_0xb4d4('0xa2')]({'name':_0x39a12e[_0xb4d4('0xb1')][_0xb4d4('0xb6')]['Label'][_0xb4d4('0xb4')][_0xb4d4('0xb2')],'value':'true'},{'name':_0x39a12e[_0xb4d4('0xb1')][_0xb4d4('0xb7')][_0xb4d4('0xb2')][_0xb4d4('0xb4')][_0xb4d4('0xb2')],'value':'false'});var _0x2fde85={'id':_0x342ffe+'_'+_0x39a12e[_0xb4d4('0x9b')],'name':_0x39a12e['DisplayName'][_0xb4d4('0xb4')][_0xb4d4('0xb2')],'custom':![],'options':_0x38fc21};_0x300e48[_0xb4d4('0xa2')](_0x2fde85);return _0x300e48;});}function getInputList(_0xc11b41,_0x333fb3,_0x161338,_0x44e772,_0x3c1d23,_0x1ab1ab,_0x572be8){var _0x326266={'method':'GET','uri':_0xc11b41+_0xb4d4('0xaf')+_0x3c1d23+_0xb4d4('0xb0')+_0x1ab1ab+_0xb4d4('0xb8')+_0x161338+_0xb4d4('0xb9'),'headers':{'Authorization':_0xb4d4('0x95')+_0x572be8,'If-None-Match':null,'OData-Version':_0xb4d4('0x96')},'json':!![]};return rp(_0x326266)['then'](function(_0x535d74){var _0x4e16ed={'id':_0x333fb3+'_'+_0x535d74[_0xb4d4('0x9b')],'name':_0x535d74['DisplayName'][_0xb4d4('0xb4')]?_0x535d74[_0xb4d4('0xba')]['UserLocalizedLabel']['Label']:_0x535d74['LogicalName'],'custom':![],'options':[]};_0x44e772[_0xb4d4('0xa2')](_0x4e16ed);return _0x44e772;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 3691f30..2385e33 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x142726,_0x49d672){var _0x357e36=function(_0x4d2437){while(--_0x4d2437){_0x142726['push'](_0x142726['shift']());}};_0x357e36(++_0x49d672);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 7871b63..61faa90 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 _0x0f0e=['include','attributes','model','GetDynamics365Account','debug','ShowDynamics365Account','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account','findAll','options','raw','where','limit','map'];(function(_0x50a996,_0x8ef17d){var _0x4b716d=function(_0x5d1909){while(--_0x5d1909){_0x50a996['push'](_0x50a996['shift']());}};_0x4b716d(++_0x8ef17d);}(_0x0f0e,0x12f));var _0xe0f0=function(_0x40fa7f,_0x425145){_0x40fa7f=_0x40fa7f-0x0;var _0xba9bec=_0x0f0e[_0x40fa7f];return _0xba9bec;};'use strict';var _=require(_0xe0f0('0x0'));var util=require(_0xe0f0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe0f0('0x2'));var fs=require('fs');var Redis=require(_0xe0f0('0x3'));var db=require(_0xe0f0('0x4'))['db'];var utils=require(_0xe0f0('0x5'));var logger=require('../../config/logger')(_0xe0f0('0x6'));var config=require(_0xe0f0('0x7'));var jayson=require(_0xe0f0('0x8'));var client=jayson[_0xe0f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0c36,_0x23ca95,_0x1f23c3){return new BPromise(function(_0x4ce52c,_0x5ccdcb){return client['request'](_0x2e0c36,_0x1f23c3)[_0xe0f0('0xa')](function(_0x5491d9){logger[_0xe0f0('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x23ca95,_0xe0f0('0xc'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x23ca95,'request\x20sent',JSON[_0xe0f0('0xd')](_0x5491d9));if(_0x5491d9[_0xe0f0('0xe')]){if(_0x5491d9[_0xe0f0('0xe')][_0xe0f0('0xf')]===0x1f4){logger['error'](_0xe0f0('0x10'),_0x23ca95,_0x5491d9['error'][_0xe0f0('0x11')]);return _0x5ccdcb(_0x5491d9['error'][_0xe0f0('0x11')]);}logger[_0xe0f0('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x23ca95,_0x5491d9['error'][_0xe0f0('0x11')]);return _0x4ce52c(_0x5491d9[_0xe0f0('0xe')][_0xe0f0('0x11')]);}else{logger['info'](_0xe0f0('0x10'),_0x23ca95,'request\x20sent');_0x4ce52c(_0x5491d9[_0xe0f0('0x12')][_0xe0f0('0x11')]);}})[_0xe0f0('0x13')](function(_0x58f628){logger[_0xe0f0('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x23ca95,_0x58f628);_0x5ccdcb(_0x58f628);});});}exports['GetDynamics365Account']=function(_0x52e856){var _0x16af5b=this;return new Promise(function(_0x1b6747,_0x31a35a){return db[_0xe0f0('0x14')][_0xe0f0('0x15')]({'raw':_0x52e856[_0xe0f0('0x16')]?_0x52e856[_0xe0f0('0x16')][_0xe0f0('0x17')]===undefined?!![]:![]:!![],'where':_0x52e856[_0xe0f0('0x16')]?_0x52e856['options'][_0xe0f0('0x18')]||null:null,'attributes':_0x52e856['options']?_0x52e856['options']['attributes']||null:null,'limit':_0x52e856[_0xe0f0('0x16')]?_0x52e856[_0xe0f0('0x16')][_0xe0f0('0x19')]||null:null,'include':_0x52e856[_0xe0f0('0x16')]?_0x52e856[_0xe0f0('0x16')]['include']?_[_0xe0f0('0x1a')](_0x52e856['options'][_0xe0f0('0x1b')],function(_0x49f93){return{'model':db[_0x49f93['model']],'as':_0x49f93['as'],'attributes':_0x49f93[_0xe0f0('0x1c')],'include':_0x49f93[_0xe0f0('0x1b')]?_[_0xe0f0('0x1a')](_0x49f93[_0xe0f0('0x1b')],function(_0x33cb67){return{'model':db[_0x33cb67[_0xe0f0('0x1d')]],'as':_0x33cb67['as'],'attributes':_0x33cb67[_0xe0f0('0x1c')],'include':_0x33cb67[_0xe0f0('0x1b')]?_[_0xe0f0('0x1a')](_0x33cb67[_0xe0f0('0x1b')],function(_0x1b2d28){return{'model':db[_0x1b2d28[_0xe0f0('0x1d')]],'as':_0x1b2d28['as'],'attributes':_0x1b2d28[_0xe0f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe0f0('0xa')](function(_0x9b63d2){logger[_0xe0f0('0xb')](_0xe0f0('0x1e'),_0x52e856);logger[_0xe0f0('0x1f')]('GetDynamics365Account',_0x52e856,JSON['stringify'](_0x9b63d2));_0x1b6747(_0x9b63d2);})[_0xe0f0('0x13')](function(_0x1d0a04){logger[_0xe0f0('0xe')]('GetDynamics365Account',_0x1d0a04[_0xe0f0('0x11')],_0x52e856);_0x31a35a(_0x16af5b[_0xe0f0('0xe')](0x1f4,_0x1d0a04[_0xe0f0('0x11')]));});});};exports['ShowDynamics365Account']=function(_0x71c2ca){var _0x2bcede=this;return new Promise(function(_0x5d3e1d,_0x54218f){return db[_0xe0f0('0x14')]['find']({'raw':_0x71c2ca[_0xe0f0('0x16')]?_0x71c2ca[_0xe0f0('0x16')][_0xe0f0('0x17')]===undefined?!![]:![]:!![],'where':_0x71c2ca[_0xe0f0('0x16')]?_0x71c2ca[_0xe0f0('0x16')][_0xe0f0('0x18')]||null:null,'attributes':_0x71c2ca['options']?_0x71c2ca[_0xe0f0('0x16')][_0xe0f0('0x1c')]||null:null,'include':_0x71c2ca['options']?_0x71c2ca['options'][_0xe0f0('0x1b')]?_[_0xe0f0('0x1a')](_0x71c2ca[_0xe0f0('0x16')]['include'],function(_0x335026){return{'model':db[_0x335026[_0xe0f0('0x1d')]],'as':_0x335026['as'],'attributes':_0x335026[_0xe0f0('0x1c')],'include':_0x335026[_0xe0f0('0x1b')]?_[_0xe0f0('0x1a')](_0x335026[_0xe0f0('0x1b')],function(_0x2237d1){return{'model':db[_0x2237d1[_0xe0f0('0x1d')]],'as':_0x2237d1['as'],'attributes':_0x2237d1[_0xe0f0('0x1c')],'include':_0x2237d1[_0xe0f0('0x1b')]?_[_0xe0f0('0x1a')](_0x2237d1[_0xe0f0('0x1b')],function(_0x73aef4){return{'model':db[_0x73aef4[_0xe0f0('0x1d')]],'as':_0x73aef4['as'],'attributes':_0x73aef4[_0xe0f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe0f0('0xa')](function(_0x51d75c){logger[_0xe0f0('0xb')](_0xe0f0('0x20'),_0x71c2ca);logger[_0xe0f0('0x1f')]('ShowDynamics365Account',_0x71c2ca,JSON[_0xe0f0('0xd')](_0x51d75c));_0x5d3e1d(_0x51d75c);})['catch'](function(_0xd63ade){logger['error']('ShowDynamics365Account',_0xd63ade[_0xe0f0('0x11')],_0x71c2ca);_0x54218f(_0x2bcede[_0xe0f0('0xe')](0x1f4,_0xd63ade[_0xe0f0('0x11')]));});});}; \ No newline at end of file +var _0xac05=['raw','where','attributes','limit','include','model','map','then','ShowDynamics365Account','Dynamics365Account','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','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'];(function(_0x46a9b9,_0x23bd18){var _0x459f59=function(_0x15a706){while(--_0x15a706){_0x46a9b9['push'](_0x46a9b9['shift']());}};_0x459f59(++_0x23bd18);}(_0xac05,0x1a2));var _0x5ac0=function(_0x14d831,_0x569ff2){_0x14d831=_0x14d831-0x0;var _0x54c84c=_0xac05[_0x14d831];return _0x54c84c;};'use strict';var _=require(_0x5ac0('0x0'));var util=require(_0x5ac0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac0('0x2'));var db=require(_0x5ac0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ac0('0x4'))('rpc');var config=require(_0x5ac0('0x5'));var jayson=require(_0x5ac0('0x6'));var client=jayson[_0x5ac0('0x7')][_0x5ac0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b2b38,_0x58e096,_0x18c0bb){return new BPromise(function(_0x4b6402,_0x1aa3e2){return client[_0x5ac0('0x9')](_0x2b2b38,_0x18c0bb)['then'](function(_0x5513e8){logger[_0x5ac0('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x58e096,_0x5ac0('0xb'));logger[_0x5ac0('0xc')](_0x5ac0('0xd'),_0x58e096,_0x5ac0('0xb'),JSON[_0x5ac0('0xe')](_0x5513e8));if(_0x5513e8[_0x5ac0('0xf')]){if(_0x5513e8['error'][_0x5ac0('0x10')]===0x1f4){logger[_0x5ac0('0xf')](_0x5ac0('0x11'),_0x58e096,_0x5513e8[_0x5ac0('0xf')][_0x5ac0('0x12')]);return _0x1aa3e2(_0x5513e8[_0x5ac0('0xf')][_0x5ac0('0x12')]);}logger[_0x5ac0('0xf')](_0x5ac0('0x11'),_0x58e096,_0x5513e8[_0x5ac0('0xf')]['message']);return _0x4b6402(_0x5513e8['error'][_0x5ac0('0x12')]);}else{logger[_0x5ac0('0xa')](_0x5ac0('0x11'),_0x58e096,_0x5ac0('0xb'));_0x4b6402(_0x5513e8[_0x5ac0('0x13')]['message']);}})[_0x5ac0('0x14')](function(_0x29afc5){logger['error'](_0x5ac0('0x11'),_0x58e096,_0x29afc5);_0x1aa3e2(_0x29afc5);});});}exports[_0x5ac0('0x15')]=function(_0x2e9eed){var _0x17c4d8=this;return new Promise(function(_0x53d0e6,_0x115ae5){return db['Dynamics365Account'][_0x5ac0('0x16')]({'raw':_0x2e9eed['options']?_0x2e9eed[_0x5ac0('0x17')][_0x5ac0('0x18')]===undefined?!![]:![]:!![],'where':_0x2e9eed[_0x5ac0('0x17')]?_0x2e9eed[_0x5ac0('0x17')][_0x5ac0('0x19')]||null:null,'attributes':_0x2e9eed['options']?_0x2e9eed[_0x5ac0('0x17')][_0x5ac0('0x1a')]||null:null,'limit':_0x2e9eed[_0x5ac0('0x17')]?_0x2e9eed[_0x5ac0('0x17')][_0x5ac0('0x1b')]||null:null,'include':_0x2e9eed['options']?_0x2e9eed[_0x5ac0('0x17')][_0x5ac0('0x1c')]?_['map'](_0x2e9eed['options'][_0x5ac0('0x1c')],function(_0x533605){return{'model':db[_0x533605[_0x5ac0('0x1d')]],'as':_0x533605['as'],'attributes':_0x533605[_0x5ac0('0x1a')],'include':_0x533605[_0x5ac0('0x1c')]?_[_0x5ac0('0x1e')](_0x533605[_0x5ac0('0x1c')],function(_0x1c24e9){return{'model':db[_0x1c24e9[_0x5ac0('0x1d')]],'as':_0x1c24e9['as'],'attributes':_0x1c24e9[_0x5ac0('0x1a')],'include':_0x1c24e9[_0x5ac0('0x1c')]?_[_0x5ac0('0x1e')](_0x1c24e9[_0x5ac0('0x1c')],function(_0x224a25){return{'model':db[_0x224a25[_0x5ac0('0x1d')]],'as':_0x224a25['as'],'attributes':_0x224a25[_0x5ac0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ac0('0x1f')](function(_0x3944b7){logger[_0x5ac0('0xa')](_0x5ac0('0x15'),_0x2e9eed);logger[_0x5ac0('0xc')](_0x5ac0('0x15'),_0x2e9eed,JSON[_0x5ac0('0xe')](_0x3944b7));_0x53d0e6(_0x3944b7);})[_0x5ac0('0x14')](function(_0x420714){logger[_0x5ac0('0xf')](_0x5ac0('0x15'),_0x420714[_0x5ac0('0x12')],_0x2e9eed);_0x115ae5(_0x17c4d8[_0x5ac0('0xf')](0x1f4,_0x420714[_0x5ac0('0x12')]));});});};exports[_0x5ac0('0x20')]=function(_0x4686b0){var _0x36eeee=this;return new Promise(function(_0x415944,_0x202b12){return db[_0x5ac0('0x21')]['find']({'raw':_0x4686b0[_0x5ac0('0x17')]?_0x4686b0[_0x5ac0('0x17')][_0x5ac0('0x18')]===undefined?!![]:![]:!![],'where':_0x4686b0[_0x5ac0('0x17')]?_0x4686b0[_0x5ac0('0x17')][_0x5ac0('0x19')]||null:null,'attributes':_0x4686b0[_0x5ac0('0x17')]?_0x4686b0[_0x5ac0('0x17')][_0x5ac0('0x1a')]||null:null,'include':_0x4686b0[_0x5ac0('0x17')]?_0x4686b0[_0x5ac0('0x17')][_0x5ac0('0x1c')]?_[_0x5ac0('0x1e')](_0x4686b0[_0x5ac0('0x17')]['include'],function(_0x49fd65){return{'model':db[_0x49fd65[_0x5ac0('0x1d')]],'as':_0x49fd65['as'],'attributes':_0x49fd65[_0x5ac0('0x1a')],'include':_0x49fd65[_0x5ac0('0x1c')]?_[_0x5ac0('0x1e')](_0x49fd65[_0x5ac0('0x1c')],function(_0x50f00c){return{'model':db[_0x50f00c['model']],'as':_0x50f00c['as'],'attributes':_0x50f00c[_0x5ac0('0x1a')],'include':_0x50f00c[_0x5ac0('0x1c')]?_[_0x5ac0('0x1e')](_0x50f00c[_0x5ac0('0x1c')],function(_0x5f2ba6){return{'model':db[_0x5f2ba6[_0x5ac0('0x1d')]],'as':_0x5f2ba6['as'],'attributes':_0x5f2ba6[_0x5ac0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ac0('0x1f')](function(_0x54a469){logger[_0x5ac0('0xa')](_0x5ac0('0x20'),_0x4686b0);logger[_0x5ac0('0xc')](_0x5ac0('0x20'),_0x4686b0,JSON[_0x5ac0('0xe')](_0x54a469));_0x415944(_0x54a469);})[_0x5ac0('0x14')](function(_0x1ac692){logger[_0x5ac0('0xf')]('ShowDynamics365Account',_0x1ac692[_0x5ac0('0x12')],_0x4686b0);_0x202b12(_0x36eeee[_0x5ac0('0xf')](0x1f4,_0x1ac692[_0x5ac0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d54dbed..465b941 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 _0x315c=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x185d35,_0x35355b){var _0x296e16=function(_0x3b8381){while(--_0x3b8381){_0x185d35['push'](_0x185d35['shift']());}};_0x296e16(++_0x35355b);}(_0x315c,0xd5));var _0xc315=function(_0xe83c0,_0x4cf8c6){_0xe83c0=_0xe83c0-0x0;var _0x190165=_0x315c[_0xe83c0];return _0x190165;};'use strict';var multer=require(_0xc315('0x0'));var util=require(_0xc315('0x1'));var path=require(_0xc315('0x2'));var timeout=require('connect-timeout');var express=require(_0xc315('0x3'));var router=express[_0xc315('0x4')]();var fs_extra=require(_0xc315('0x5'));var auth=require(_0xc315('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc315('0x7'));var controller=require(_0xc315('0x8'));router[_0xc315('0x9')]('/',auth[_0xc315('0xa')](),controller[_0xc315('0xb')]);router[_0xc315('0x9')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller[_0xc315('0xd')]);router[_0xc315('0x9')](_0xc315('0xe'),auth[_0xc315('0xa')](),controller[_0xc315('0xf')]);router[_0xc315('0x9')](_0xc315('0x10'),auth['isAuthenticated'](),controller[_0xc315('0x11')]);router[_0xc315('0x9')](_0xc315('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc315('0x13')]('/',auth[_0xc315('0xa')](),controller[_0xc315('0x14')]);router[_0xc315('0x15')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller['update']);router[_0xc315('0x16')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller[_0xc315('0x17')]);module[_0xc315('0x18')]=router; \ No newline at end of file +var _0x199c=['index','getFields','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0x199c,0x7b));var _0xc199=function(_0x26cc28,_0x3f1a88){_0x26cc28=_0x26cc28-0x0;var _0x54d965=_0x199c[_0x26cc28];return _0x54d965;};'use strict';var multer=require(_0xc199('0x0'));var util=require(_0xc199('0x1'));var path=require(_0xc199('0x2'));var timeout=require('connect-timeout');var express=require(_0xc199('0x3'));var router=express[_0xc199('0x4')]();var fs_extra=require(_0xc199('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc199('0x6'));var controller=require(_0xc199('0x7'));router[_0xc199('0x8')]('/',auth[_0xc199('0x9')](),controller[_0xc199('0xa')]);router[_0xc199('0x8')]('/:id',auth[_0xc199('0x9')](),controller['show']);router['get']('/:id/fields',auth[_0xc199('0x9')](),controller[_0xc199('0xb')]);router[_0xc199('0x8')]('/:id/subjects',auth[_0xc199('0x9')](),controller[_0xc199('0xc')]);router['get'](_0xc199('0xd'),auth[_0xc199('0x9')](),controller[_0xc199('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc199('0xf')](_0xc199('0x10'),auth[_0xc199('0x9')](),controller[_0xc199('0x11')]);router[_0xc199('0x12')](_0xc199('0x10'),auth[_0xc199('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 826efef..0d87ec0 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 _0x02d8=['exports','STRING','ENUM','incident','phonecall','contact','nothing'];(function(_0x389d00,_0x58a298){var _0xfa57c4=function(_0x4e8b09){while(--_0x4e8b09){_0x389d00['push'](_0x389d00['shift']());}};_0xfa57c4(++_0x58a298);}(_0x02d8,0x150));var _0x802d=function(_0x376160,_0x4852bd){_0x376160=_0x376160-0x0;var _0x48b138=_0x02d8[_0x376160];return _0x48b138;};'use strict';var Sequelize=require('sequelize');module[_0x802d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x802d('0x1')]},'ticketType':{'type':Sequelize[_0x802d('0x2')](_0x802d('0x3'),_0x802d('0x4')),'defaultValue':_0x802d('0x3')},'moduleCreate':{'type':Sequelize[_0x802d('0x2')](_0x802d('0x5'),_0x802d('0x6')),'defaultValue':_0x802d('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x802d('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf0c8=['incident','contact','nothing','sequelize','STRING','ENUM'];(function(_0xf8fb52,_0x3916de){var _0x73235b=function(_0x26247b){while(--_0x26247b){_0xf8fb52['push'](_0xf8fb52['shift']());}};_0x73235b(++_0x3916de);}(_0xf0c8,0xf9));var _0x8f0c=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xf0c8[_0x166e96];return _0x553d73;};'use strict';var Sequelize=require(_0x8f0c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8f0c('0x1')]},'ticketType':{'type':Sequelize[_0x8f0c('0x2')](_0x8f0c('0x3'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x8f0c('0x2')](_0x8f0c('0x4'),_0x8f0c('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8f0c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 828051b..4d0c3ff 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 _0x8538=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','getFields','Dynamics365Field','getSubjects','findOne','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis'];(function(_0x26de0d,_0x4a9f7d){var _0x201f6f=function(_0x3d4d31){while(--_0x3d4d31){_0x26de0d['push'](_0x26de0d['shift']());}};_0x201f6f(++_0x4a9f7d);}(_0x8538,0x8d));var _0x8853=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8538[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8853('0x0'));var rimraf=require(_0x8853('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8853('0x2'));var rp=require(_0x8853('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8853('0x4'));var path=require(_0x8853('0x5'));var sox=require(_0x8853('0x6'));var csv=require(_0x8853('0x7'));var ejs=require(_0x8853('0x8'));var fs=require('fs');var fs_extra=require(_0x8853('0x9'));var _=require(_0x8853('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8853('0xb'));var toCsv=require(_0x8853('0x7'));var querystring=require(_0x8853('0xc'));var Papa=require(_0x8853('0xd'));var Redis=require(_0x8853('0xe'));var authService=require(_0x8853('0xf'));var qs=require(_0x8853('0x10'));var as=require(_0x8853('0x11'));var hardwareService=require(_0x8853('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8853('0x13'));var db=require(_0x8853('0x14'))['db'];function respondWithStatusCode(_0x2f4af2,_0x102462){_0x102462=_0x102462||0xcc;return function(_0x4d44d5){if(_0x4d44d5){return _0x2f4af2[_0x8853('0x15')](_0x102462);}return _0x2f4af2[_0x8853('0x16')](_0x102462)[_0x8853('0x17')]();};}function respondWithResult(_0x1ab03d,_0x353a73){_0x353a73=_0x353a73||0xc8;return function(_0xa88030){if(_0xa88030){return _0x1ab03d[_0x8853('0x16')](_0x353a73)[_0x8853('0x18')](_0xa88030);}};}function respondWithFilteredResult(_0x5339f7,_0x2614db){return function(_0x12cae6){if(_0x12cae6){var _0x33d332=typeof _0x2614db[_0x8853('0x19')]==='undefined'&&typeof _0x2614db[_0x8853('0x1a')]===_0x8853('0x1b');var _0x48cd9c=_0x12cae6[_0x8853('0x1c')];var _0x338909=_0x33d332?0x0:_0x2614db[_0x8853('0x19')];var _0x12e1ef=_0x33d332?_0x12cae6[_0x8853('0x1c')]:_0x2614db['offset']+_0x2614db[_0x8853('0x1a')];var _0x17d853;if(_0x12e1ef>=_0x48cd9c){_0x12e1ef=_0x48cd9c;_0x17d853=0xc8;}else{_0x17d853=0xce;}_0x5339f7['status'](_0x17d853);return _0x5339f7[_0x8853('0x1d')]('Content-Range',_0x338909+'-'+_0x12e1ef+'/'+_0x48cd9c)[_0x8853('0x18')](_0x12cae6);}return null;};}function patchUpdates(_0x243bac){return function(_0x448831){try{jsonpatch[_0x8853('0x1e')](_0x448831,_0x243bac,!![]);}catch(_0x55bd3e){return BPromise[_0x8853('0x1f')](_0x55bd3e);}return _0x448831[_0x8853('0x20')]();};}function saveUpdates(_0x283566,_0x31de59){return function(_0x5af7a1){if(_0x5af7a1){return _0x5af7a1[_0x8853('0x21')](_0x283566)[_0x8853('0x22')](function(_0x2248b0){return _0x2248b0;});}return null;};}function removeEntity(_0x501020,_0x10629c){return function(_0x4f341e){if(_0x4f341e){return _0x4f341e['destroy']()[_0x8853('0x22')](function(){_0x501020[_0x8853('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x471649,_0xa7632a){return function(_0x5dd0e9){if(!_0x5dd0e9){_0x471649[_0x8853('0x15')](0x194);}return _0x5dd0e9;};}function handleError(_0x39df76,_0x106073){_0x106073=_0x106073||0x1f4;return function(_0x1a52c2){logger[_0x8853('0x23')](_0x1a52c2[_0x8853('0x24')]);if(_0x1a52c2[_0x8853('0x25')]){delete _0x1a52c2[_0x8853('0x25')];}_0x39df76[_0x8853('0x16')](_0x106073)[_0x8853('0x26')](_0x1a52c2);};}exports[_0x8853('0x27')]=function(_0x49d0da,_0x2edfa0){var _0x13c662={},_0x4b0fd8={},_0x233b38={'count':0x0,'rows':[]};var _0x532c41=_[_0x8853('0x28')](db[_0x8853('0x29')][_0x8853('0x2a')],function(_0x4abc33){return{'name':_0x4abc33[_0x8853('0x2b')],'type':_0x4abc33[_0x8853('0x2c')]['key']};});_0x4b0fd8[_0x8853('0x2d')]=_[_0x8853('0x28')](_0x532c41,_0x8853('0x25'));_0x4b0fd8['query']=_['keys'](_0x49d0da[_0x8853('0x2e')]);_0x4b0fd8[_0x8853('0x2f')]=_[_0x8853('0x30')](_0x4b0fd8[_0x8853('0x2d')],_0x4b0fd8[_0x8853('0x2e')]);_0x13c662[_0x8853('0x31')]=_[_0x8853('0x30')](_0x4b0fd8[_0x8853('0x2d')],qs[_0x8853('0x32')](_0x49d0da[_0x8853('0x2e')]['fields']));_0x13c662[_0x8853('0x31')]=_0x13c662[_0x8853('0x31')]['length']?_0x13c662[_0x8853('0x31')]:_0x4b0fd8['model'];if(!_0x49d0da[_0x8853('0x2e')][_0x8853('0x33')](_0x8853('0x34'))){_0x13c662[_0x8853('0x1a')]=qs[_0x8853('0x1a')](_0x49d0da[_0x8853('0x2e')][_0x8853('0x1a')]);_0x13c662[_0x8853('0x19')]=qs[_0x8853('0x19')](_0x49d0da[_0x8853('0x2e')][_0x8853('0x19')]);}_0x13c662[_0x8853('0x35')]=qs['sort'](_0x49d0da[_0x8853('0x2e')][_0x8853('0x36')]);_0x13c662[_0x8853('0x37')]=qs[_0x8853('0x2f')](_['pick'](_0x49d0da[_0x8853('0x2e')],_0x4b0fd8[_0x8853('0x2f')]),_0x532c41);if(_0x49d0da[_0x8853('0x2e')][_0x8853('0x38')]){_0x13c662['where']=_[_0x8853('0x39')](_0x13c662[_0x8853('0x37')],{'$or':_[_0x8853('0x28')](_0x532c41,function(_0x18cacd){if(_0x18cacd[_0x8853('0x2c')]!==_0x8853('0x3a')){var _0x352238={};_0x352238[_0x18cacd[_0x8853('0x25')]]={'$like':'%'+_0x49d0da['query'][_0x8853('0x38')]+'%'};return _0x352238;}})});}_0x13c662=_[_0x8853('0x39')]({},_0x13c662,_0x49d0da[_0x8853('0x3b')]);var _0x23a798={'where':_0x13c662[_0x8853('0x37')]};return db[_0x8853('0x29')][_0x8853('0x1c')](_0x23a798)[_0x8853('0x22')](function(_0x4e04f2){_0x233b38[_0x8853('0x1c')]=_0x4e04f2;if(_0x49d0da[_0x8853('0x2e')][_0x8853('0x3c')]){_0x13c662['include']=[{'all':!![]}];}return db[_0x8853('0x29')][_0x8853('0x3d')](_0x13c662);})['then'](function(_0x27c928){_0x233b38[_0x8853('0x3e')]=_0x27c928;return _0x233b38;})[_0x8853('0x22')](respondWithFilteredResult(_0x2edfa0,_0x13c662))[_0x8853('0x3f')](handleError(_0x2edfa0,null));};exports[_0x8853('0x40')]=function(_0x10fb11,_0x511e4a){var _0x5032e5={'raw':![],'where':{'id':_0x10fb11[_0x8853('0x41')]['id']}},_0x4385bc={};_0x4385bc[_0x8853('0x2d')]=_[_0x8853('0x42')](db[_0x8853('0x29')][_0x8853('0x2a')]);_0x4385bc['query']=_[_0x8853('0x42')](_0x10fb11['query']);_0x4385bc['filters']=_[_0x8853('0x30')](_0x4385bc[_0x8853('0x2d')],_0x4385bc[_0x8853('0x2e')]);_0x5032e5[_0x8853('0x31')]=_[_0x8853('0x30')](_0x4385bc[_0x8853('0x2d')],qs['fields'](_0x10fb11[_0x8853('0x2e')][_0x8853('0x32')]));_0x5032e5[_0x8853('0x31')]=_0x5032e5['attributes'][_0x8853('0x43')]?_0x5032e5[_0x8853('0x31')]:_0x4385bc['model'];if(_0x10fb11[_0x8853('0x2e')][_0x8853('0x3c')]){_0x5032e5[_0x8853('0x44')]=[{'all':!![]}];}_0x5032e5=_[_0x8853('0x39')]({},_0x5032e5,_0x10fb11[_0x8853('0x3b')]);return db['Dynamics365Configuration'][_0x8853('0x45')](_0x5032e5)[_0x8853('0x22')](handleEntityNotFound(_0x511e4a,null))[_0x8853('0x22')](respondWithResult(_0x511e4a,null))[_0x8853('0x3f')](handleError(_0x511e4a,null));};exports[_0x8853('0x46')]=function(_0x4e2711,_0x5db2a7){return db[_0x8853('0x29')][_0x8853('0x46')](_0x4e2711['body'],{})[_0x8853('0x22')](respondWithResult(_0x5db2a7,0xc9))[_0x8853('0x3f')](handleError(_0x5db2a7,null));};exports[_0x8853('0x21')]=function(_0x561f36,_0x4b7374){if(_0x561f36[_0x8853('0x47')]['id']){delete _0x561f36[_0x8853('0x47')]['id'];}return db[_0x8853('0x29')][_0x8853('0x45')]({'where':{'id':_0x561f36[_0x8853('0x41')]['id']}})[_0x8853('0x22')](handleEntityNotFound(_0x4b7374,null))[_0x8853('0x22')](saveUpdates(_0x561f36[_0x8853('0x47')],null))[_0x8853('0x22')](respondWithResult(_0x4b7374,null))['catch'](handleError(_0x4b7374,null));};exports['destroy']=function(_0x2a807d,_0x1789d6){return db[_0x8853('0x29')][_0x8853('0x45')]({'where':{'id':_0x2a807d[_0x8853('0x41')]['id']}})[_0x8853('0x22')](handleEntityNotFound(_0x1789d6,null))[_0x8853('0x22')](removeEntity(_0x1789d6,null))[_0x8853('0x3f')](handleError(_0x1789d6,null));};exports[_0x8853('0x48')]=function(_0x31ca66,_0x4c6271,_0x3d9ca7){var _0x548264={};var _0x3ca4f6={};var _0x2da7a3;var _0xfd1a02;return db[_0x8853('0x29')]['findOne']({'where':{'id':_0x31ca66[_0x8853('0x41')]['id']}})[_0x8853('0x22')](handleEntityNotFound(_0x4c6271,null))['then'](function(_0xd16c98){if(_0xd16c98){_0x2da7a3=_0xd16c98;_0x3ca4f6[_0x8853('0x2d')]=_[_0x8853('0x42')](db[_0x8853('0x49')]['rawAttributes']);_0x3ca4f6[_0x8853('0x2e')]=_['keys'](_0x31ca66[_0x8853('0x2e')]);_0x3ca4f6[_0x8853('0x2f')]=_[_0x8853('0x30')](_0x3ca4f6[_0x8853('0x2d')],_0x3ca4f6[_0x8853('0x2e')]);_0x548264['attributes']=_[_0x8853('0x30')](_0x3ca4f6[_0x8853('0x2d')],qs[_0x8853('0x32')](_0x31ca66['query'][_0x8853('0x32')]));_0x548264[_0x8853('0x31')]=_0x548264['attributes'][_0x8853('0x43')]?_0x548264[_0x8853('0x31')]:_0x3ca4f6[_0x8853('0x2d')];_0x548264[_0x8853('0x35')]=qs[_0x8853('0x36')](_0x31ca66[_0x8853('0x2e')][_0x8853('0x36')]);_0x548264[_0x8853('0x37')]=qs[_0x8853('0x2f')](_['pick'](_0x31ca66[_0x8853('0x2e')],_0x3ca4f6[_0x8853('0x2f')]));if(_0x31ca66[_0x8853('0x2e')]['filter']){_0x548264[_0x8853('0x37')]=_['merge'](_0x548264['where'],{'$or':_['map'](_0x548264[_0x8853('0x31')],function(_0x3f18a2){var _0x5ac219={};_0x5ac219[_0x3f18a2]={'$like':'%'+_0x31ca66[_0x8853('0x2e')]['filter']+'%'};return _0x5ac219;})});}_0x548264=_['merge']({},_0x548264,_0x31ca66[_0x8853('0x3b')]);return _0x2da7a3[_0x8853('0x48')](_0x548264);}})[_0x8853('0x22')](function(_0x2b36dc){if(_0x2b36dc){_0xfd1a02=_0x2b36dc['length'];if(!_0x31ca66[_0x8853('0x2e')][_0x8853('0x33')](_0x8853('0x34'))){_0x548264['limit']=qs[_0x8853('0x1a')](_0x31ca66[_0x8853('0x2e')][_0x8853('0x1a')]);_0x548264[_0x8853('0x19')]=qs[_0x8853('0x19')](_0x31ca66[_0x8853('0x2e')][_0x8853('0x19')]);}return _0x2da7a3[_0x8853('0x48')](_0x548264);}})[_0x8853('0x22')](function(_0x46ea66){if(_0x46ea66){return _0x46ea66?{'count':_0xfd1a02,'rows':_0x46ea66}:null;}})[_0x8853('0x22')](respondWithResult(_0x4c6271,null))['catch'](handleError(_0x4c6271,null));};exports[_0x8853('0x4a')]=function(_0x34548b,_0xdf5c88,_0x1baf5d){var _0x2da987={};var _0x14b9d6={};var _0x5c62e2;var _0x3278f3;return db[_0x8853('0x29')][_0x8853('0x4b')]({'where':{'id':_0x34548b[_0x8853('0x41')]['id']}})[_0x8853('0x22')](handleEntityNotFound(_0xdf5c88,null))[_0x8853('0x22')](function(_0x2df495){if(_0x2df495){_0x5c62e2=_0x2df495;_0x14b9d6[_0x8853('0x2d')]=_['keys'](db[_0x8853('0x49')]['rawAttributes']);_0x14b9d6[_0x8853('0x2e')]=_[_0x8853('0x42')](_0x34548b[_0x8853('0x2e')]);_0x14b9d6[_0x8853('0x2f')]=_['intersection'](_0x14b9d6['model'],_0x14b9d6[_0x8853('0x2e')]);_0x2da987[_0x8853('0x31')]=_['intersection'](_0x14b9d6[_0x8853('0x2d')],qs['fields'](_0x34548b['query']['fields']));_0x2da987[_0x8853('0x31')]=_0x2da987['attributes']['length']?_0x2da987[_0x8853('0x31')]:_0x14b9d6['model'];_0x2da987['order']=qs[_0x8853('0x36')](_0x34548b[_0x8853('0x2e')]['sort']);_0x2da987[_0x8853('0x37')]=qs['filters'](_[_0x8853('0x4c')](_0x34548b[_0x8853('0x2e')],_0x14b9d6['filters']));if(_0x34548b[_0x8853('0x2e')]['filter']){_0x2da987[_0x8853('0x37')]=_[_0x8853('0x39')](_0x2da987[_0x8853('0x37')],{'$or':_['map'](_0x2da987['attributes'],function(_0x308dac){var _0x3c12ea={};_0x3c12ea[_0x308dac]={'$like':'%'+_0x34548b[_0x8853('0x2e')][_0x8853('0x38')]+'%'};return _0x3c12ea;})});}_0x2da987=_[_0x8853('0x39')]({},_0x2da987,_0x34548b['options']);return _0x5c62e2[_0x8853('0x4a')](_0x2da987);}})[_0x8853('0x22')](function(_0x5a6f4c){if(_0x5a6f4c){_0x3278f3=_0x5a6f4c['length'];if(!_0x34548b[_0x8853('0x2e')][_0x8853('0x33')](_0x8853('0x34'))){_0x2da987[_0x8853('0x1a')]=qs[_0x8853('0x1a')](_0x34548b[_0x8853('0x2e')][_0x8853('0x1a')]);_0x2da987[_0x8853('0x19')]=qs[_0x8853('0x19')](_0x34548b[_0x8853('0x2e')][_0x8853('0x19')]);}return _0x5c62e2[_0x8853('0x4a')](_0x2da987);}})[_0x8853('0x22')](function(_0x2af257){if(_0x2af257){return _0x2af257?{'count':_0x3278f3,'rows':_0x2af257}:null;}})[_0x8853('0x22')](respondWithResult(_0xdf5c88,null))[_0x8853('0x3f')](handleError(_0xdf5c88,null));};exports['getDescriptions']=function(_0x220565,_0x52335d,_0x55dafd){var _0x552163={};var _0x5edbbb={};var _0x1c4c9f;var _0x5dc389;return db[_0x8853('0x29')][_0x8853('0x4b')]({'where':{'id':_0x220565[_0x8853('0x41')]['id']}})[_0x8853('0x22')](handleEntityNotFound(_0x52335d,null))[_0x8853('0x22')](function(_0x186798){if(_0x186798){_0x1c4c9f=_0x186798;_0x5edbbb[_0x8853('0x2d')]=_[_0x8853('0x42')](db['Dynamics365Field'][_0x8853('0x2a')]);_0x5edbbb[_0x8853('0x2e')]=_[_0x8853('0x42')](_0x220565[_0x8853('0x2e')]);_0x5edbbb['filters']=_[_0x8853('0x30')](_0x5edbbb['model'],_0x5edbbb[_0x8853('0x2e')]);_0x552163['attributes']=_[_0x8853('0x30')](_0x5edbbb[_0x8853('0x2d')],qs[_0x8853('0x32')](_0x220565[_0x8853('0x2e')][_0x8853('0x32')]));_0x552163[_0x8853('0x31')]=_0x552163[_0x8853('0x31')][_0x8853('0x43')]?_0x552163[_0x8853('0x31')]:_0x5edbbb[_0x8853('0x2d')];_0x552163['order']=qs[_0x8853('0x36')](_0x220565['query'][_0x8853('0x36')]);_0x552163[_0x8853('0x37')]=qs[_0x8853('0x2f')](_[_0x8853('0x4c')](_0x220565[_0x8853('0x2e')],_0x5edbbb[_0x8853('0x2f')]));if(_0x220565[_0x8853('0x2e')][_0x8853('0x38')]){_0x552163[_0x8853('0x37')]=_[_0x8853('0x39')](_0x552163[_0x8853('0x37')],{'$or':_[_0x8853('0x28')](_0x552163[_0x8853('0x31')],function(_0x5d358f){var _0x2d82d4={};_0x2d82d4[_0x5d358f]={'$like':'%'+_0x220565[_0x8853('0x2e')]['filter']+'%'};return _0x2d82d4;})});}_0x552163=_[_0x8853('0x39')]({},_0x552163,_0x220565['options']);return _0x1c4c9f[_0x8853('0x4d')](_0x552163);}})[_0x8853('0x22')](function(_0xc6f396){if(_0xc6f396){_0x5dc389=_0xc6f396[_0x8853('0x43')];if(!_0x220565['query']['hasOwnProperty'](_0x8853('0x34'))){_0x552163[_0x8853('0x1a')]=qs['limit'](_0x220565['query'][_0x8853('0x1a')]);_0x552163[_0x8853('0x19')]=qs['offset'](_0x220565[_0x8853('0x2e')][_0x8853('0x19')]);}return _0x1c4c9f[_0x8853('0x4d')](_0x552163);}})[_0x8853('0x22')](function(_0x5933e1){if(_0x5933e1){return _0x5933e1?{'count':_0x5dc389,'rows':_0x5933e1}:null;}})[_0x8853('0x22')](respondWithResult(_0x52335d,null))[_0x8853('0x3f')](handleError(_0x52335d,null));}; \ No newline at end of file +var _0x63b2=['includeAll','find','create','body','getFields','findOne','nolimit','getSubjects','Dynamics365Field','rawAttributes','filter','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','Dynamics365Configuration','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','filters','length'];(function(_0x281594,_0x246818){var _0x485a8b=function(_0x44253b){while(--_0x44253b){_0x281594['push'](_0x281594['shift']());}};_0x485a8b(++_0x246818);}(_0x63b2,0xae));var _0x263b=function(_0x25b763,_0x425c20){_0x25b763=_0x25b763-0x0;var _0x327fd2=_0x63b2[_0x25b763];return _0x327fd2;};'use strict';var emlformat=require(_0x263b('0x0'));var rimraf=require(_0x263b('0x1'));var zipdir=require(_0x263b('0x2'));var jsonpatch=require(_0x263b('0x3'));var rp=require('request-promise');var moment=require(_0x263b('0x4'));var BPromise=require(_0x263b('0x5'));var Mustache=require(_0x263b('0x6'));var util=require(_0x263b('0x7'));var path=require(_0x263b('0x8'));var sox=require(_0x263b('0x9'));var csv=require(_0x263b('0xa'));var ejs=require(_0x263b('0xb'));var fs=require('fs');var fs_extra=require(_0x263b('0xc'));var _=require(_0x263b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x263b('0xe'));var deskjs=require(_0x263b('0xf'));var toCsv=require(_0x263b('0xa'));var querystring=require(_0x263b('0x10'));var Papa=require(_0x263b('0x11'));var Redis=require(_0x263b('0x12'));var authService=require(_0x263b('0x13'));var qs=require(_0x263b('0x14'));var as=require(_0x263b('0x15'));var hardwareService=require(_0x263b('0x16'));var logger=require(_0x263b('0x17'))('api');var utils=require(_0x263b('0x18'));var config=require(_0x263b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5631,_0x53b176){_0x53b176=_0x53b176||0xcc;return function(_0x2bf022){if(_0x2bf022){return _0x1e5631[_0x263b('0x1a')](_0x53b176);}return _0x1e5631['status'](_0x53b176)[_0x263b('0x1b')]();};}function respondWithResult(_0x15a566,_0x214d4f){_0x214d4f=_0x214d4f||0xc8;return function(_0x4bbe6b){if(_0x4bbe6b){return _0x15a566[_0x263b('0x1c')](_0x214d4f)[_0x263b('0x1d')](_0x4bbe6b);}};}function respondWithFilteredResult(_0x4f043a,_0x425492){return function(_0x22c8bc){if(_0x22c8bc){var _0x69243f=typeof _0x425492[_0x263b('0x1e')]==='undefined'&&typeof _0x425492[_0x263b('0x1f')]===_0x263b('0x20');var _0x120dd8=_0x22c8bc['count'];var _0x33a136=_0x69243f?0x0:_0x425492['offset'];var _0x203f77=_0x69243f?_0x22c8bc[_0x263b('0x21')]:_0x425492[_0x263b('0x1e')]+_0x425492[_0x263b('0x1f')];var _0x202814;if(_0x203f77>=_0x120dd8){_0x203f77=_0x120dd8;_0x202814=0xc8;}else{_0x202814=0xce;}_0x4f043a[_0x263b('0x1c')](_0x202814);return _0x4f043a['set'](_0x263b('0x22'),_0x33a136+'-'+_0x203f77+'/'+_0x120dd8)[_0x263b('0x1d')](_0x22c8bc);}return null;};}function patchUpdates(_0xf0a41f){return function(_0x5af22f){try{jsonpatch[_0x263b('0x23')](_0x5af22f,_0xf0a41f,!![]);}catch(_0x1e7ac7){return BPromise[_0x263b('0x24')](_0x1e7ac7);}return _0x5af22f[_0x263b('0x25')]();};}function saveUpdates(_0x123a07,_0x254e8e){return function(_0x4973c2){if(_0x4973c2){return _0x4973c2[_0x263b('0x26')](_0x123a07)[_0x263b('0x27')](function(_0x134d6f){return _0x134d6f;});}return null;};}function removeEntity(_0x385f0f,_0x8315fa){return function(_0x51eed4){if(_0x51eed4){return _0x51eed4[_0x263b('0x28')]()['then'](function(){_0x385f0f['status'](0xcc)[_0x263b('0x1b')]();});}};}function handleEntityNotFound(_0x28df05,_0x49f500){return function(_0x3ebfdf){if(!_0x3ebfdf){_0x28df05[_0x263b('0x1a')](0x194);}return _0x3ebfdf;};}function handleError(_0x40fbc5,_0x1df895){_0x1df895=_0x1df895||0x1f4;return function(_0x3f4895){logger['error'](_0x3f4895[_0x263b('0x29')]);if(_0x3f4895['name']){delete _0x3f4895[_0x263b('0x2a')];}_0x40fbc5['status'](_0x1df895)['send'](_0x3f4895);};}exports[_0x263b('0x2b')]=function(_0x508a2,_0x11d836){var _0x38d8f6={},_0x469d2f={},_0x365bbb={'count':0x0,'rows':[]};var _0x5e4dd1=_[_0x263b('0x2c')](db[_0x263b('0x2d')]['rawAttributes'],function(_0x2f2c48){return{'name':_0x2f2c48[_0x263b('0x2e')],'type':_0x2f2c48[_0x263b('0x2f')]['key']};});_0x469d2f[_0x263b('0x30')]=_[_0x263b('0x2c')](_0x5e4dd1,'name');_0x469d2f[_0x263b('0x31')]=_[_0x263b('0x32')](_0x508a2[_0x263b('0x31')]);_0x469d2f['filters']=_[_0x263b('0x33')](_0x469d2f['model'],_0x469d2f[_0x263b('0x31')]);_0x38d8f6[_0x263b('0x34')]=_[_0x263b('0x33')](_0x469d2f[_0x263b('0x30')],qs['fields'](_0x508a2[_0x263b('0x31')][_0x263b('0x35')]));_0x38d8f6[_0x263b('0x34')]=_0x38d8f6[_0x263b('0x34')]['length']?_0x38d8f6['attributes']:_0x469d2f[_0x263b('0x30')];if(!_0x508a2[_0x263b('0x31')][_0x263b('0x36')]('nolimit')){_0x38d8f6['limit']=qs[_0x263b('0x1f')](_0x508a2[_0x263b('0x31')][_0x263b('0x1f')]);_0x38d8f6[_0x263b('0x1e')]=qs[_0x263b('0x1e')](_0x508a2['query'][_0x263b('0x1e')]);}_0x38d8f6[_0x263b('0x37')]=qs[_0x263b('0x38')](_0x508a2['query'][_0x263b('0x38')]);_0x38d8f6[_0x263b('0x39')]=qs['filters'](_[_0x263b('0x3a')](_0x508a2[_0x263b('0x31')],_0x469d2f['filters']),_0x5e4dd1);if(_0x508a2['query']['filter']){_0x38d8f6[_0x263b('0x39')]=_[_0x263b('0x3b')](_0x38d8f6[_0x263b('0x39')],{'$or':_[_0x263b('0x2c')](_0x5e4dd1,function(_0x2fe081){if(_0x2fe081['type']!==_0x263b('0x3c')){var _0x3882cd={};_0x3882cd[_0x2fe081[_0x263b('0x2a')]]={'$like':'%'+_0x508a2[_0x263b('0x31')]['filter']+'%'};return _0x3882cd;}})});}_0x38d8f6=_[_0x263b('0x3b')]({},_0x38d8f6,_0x508a2[_0x263b('0x3d')]);var _0x28d72d={'where':_0x38d8f6['where']};return db[_0x263b('0x2d')][_0x263b('0x21')](_0x28d72d)['then'](function(_0x2e2561){_0x365bbb[_0x263b('0x21')]=_0x2e2561;if(_0x508a2[_0x263b('0x31')]['includeAll']){_0x38d8f6[_0x263b('0x3e')]=[{'all':!![]}];}return db[_0x263b('0x2d')][_0x263b('0x3f')](_0x38d8f6);})[_0x263b('0x27')](function(_0x56a8c6){_0x365bbb['rows']=_0x56a8c6;return _0x365bbb;})['then'](respondWithFilteredResult(_0x11d836,_0x38d8f6))[_0x263b('0x40')](handleError(_0x11d836,null));};exports[_0x263b('0x41')]=function(_0x48da6d,_0x199e8d){var _0x24f121={'raw':![],'where':{'id':_0x48da6d[_0x263b('0x42')]['id']}},_0x1955ed={};_0x1955ed[_0x263b('0x30')]=_[_0x263b('0x32')](db['Dynamics365Configuration']['rawAttributes']);_0x1955ed[_0x263b('0x31')]=_[_0x263b('0x32')](_0x48da6d[_0x263b('0x31')]);_0x1955ed[_0x263b('0x43')]=_[_0x263b('0x33')](_0x1955ed[_0x263b('0x30')],_0x1955ed['query']);_0x24f121[_0x263b('0x34')]=_[_0x263b('0x33')](_0x1955ed[_0x263b('0x30')],qs[_0x263b('0x35')](_0x48da6d['query']['fields']));_0x24f121[_0x263b('0x34')]=_0x24f121[_0x263b('0x34')][_0x263b('0x44')]?_0x24f121[_0x263b('0x34')]:_0x1955ed[_0x263b('0x30')];if(_0x48da6d[_0x263b('0x31')][_0x263b('0x45')]){_0x24f121[_0x263b('0x3e')]=[{'all':!![]}];}_0x24f121=_[_0x263b('0x3b')]({},_0x24f121,_0x48da6d[_0x263b('0x3d')]);return db['Dynamics365Configuration'][_0x263b('0x46')](_0x24f121)[_0x263b('0x27')](handleEntityNotFound(_0x199e8d,null))[_0x263b('0x27')](respondWithResult(_0x199e8d,null))[_0x263b('0x40')](handleError(_0x199e8d,null));};exports[_0x263b('0x47')]=function(_0x308ec8,_0x2639c0){return db[_0x263b('0x2d')][_0x263b('0x47')](_0x308ec8[_0x263b('0x48')],{})[_0x263b('0x27')](respondWithResult(_0x2639c0,0xc9))[_0x263b('0x40')](handleError(_0x2639c0,null));};exports[_0x263b('0x26')]=function(_0x49d554,_0x539034){if(_0x49d554['body']['id']){delete _0x49d554[_0x263b('0x48')]['id'];}return db[_0x263b('0x2d')][_0x263b('0x46')]({'where':{'id':_0x49d554[_0x263b('0x42')]['id']}})[_0x263b('0x27')](handleEntityNotFound(_0x539034,null))[_0x263b('0x27')](saveUpdates(_0x49d554['body'],null))[_0x263b('0x27')](respondWithResult(_0x539034,null))[_0x263b('0x40')](handleError(_0x539034,null));};exports[_0x263b('0x28')]=function(_0x30bed2,_0x4ada00){return db[_0x263b('0x2d')][_0x263b('0x46')]({'where':{'id':_0x30bed2[_0x263b('0x42')]['id']}})[_0x263b('0x27')](handleEntityNotFound(_0x4ada00,null))[_0x263b('0x27')](removeEntity(_0x4ada00,null))[_0x263b('0x40')](handleError(_0x4ada00,null));};exports[_0x263b('0x49')]=function(_0x41514f,_0x45ee53,_0xfe30d8){var _0x16d7eb={};var _0x3860dd={};var _0x13f7d4;var _0x3068ba;return db[_0x263b('0x2d')][_0x263b('0x4a')]({'where':{'id':_0x41514f[_0x263b('0x42')]['id']}})['then'](handleEntityNotFound(_0x45ee53,null))[_0x263b('0x27')](function(_0x8ca67c){if(_0x8ca67c){_0x13f7d4=_0x8ca67c;_0x3860dd[_0x263b('0x30')]=_[_0x263b('0x32')](db['Dynamics365Field']['rawAttributes']);_0x3860dd[_0x263b('0x31')]=_[_0x263b('0x32')](_0x41514f[_0x263b('0x31')]);_0x3860dd['filters']=_['intersection'](_0x3860dd[_0x263b('0x30')],_0x3860dd['query']);_0x16d7eb[_0x263b('0x34')]=_[_0x263b('0x33')](_0x3860dd[_0x263b('0x30')],qs['fields'](_0x41514f[_0x263b('0x31')][_0x263b('0x35')]));_0x16d7eb[_0x263b('0x34')]=_0x16d7eb[_0x263b('0x34')][_0x263b('0x44')]?_0x16d7eb['attributes']:_0x3860dd[_0x263b('0x30')];_0x16d7eb[_0x263b('0x37')]=qs[_0x263b('0x38')](_0x41514f[_0x263b('0x31')]['sort']);_0x16d7eb[_0x263b('0x39')]=qs[_0x263b('0x43')](_[_0x263b('0x3a')](_0x41514f[_0x263b('0x31')],_0x3860dd['filters']));if(_0x41514f[_0x263b('0x31')]['filter']){_0x16d7eb['where']=_[_0x263b('0x3b')](_0x16d7eb[_0x263b('0x39')],{'$or':_[_0x263b('0x2c')](_0x16d7eb['attributes'],function(_0x5b63b1){var _0x24304f={};_0x24304f[_0x5b63b1]={'$like':'%'+_0x41514f[_0x263b('0x31')]['filter']+'%'};return _0x24304f;})});}_0x16d7eb=_[_0x263b('0x3b')]({},_0x16d7eb,_0x41514f[_0x263b('0x3d')]);return _0x13f7d4['getFields'](_0x16d7eb);}})[_0x263b('0x27')](function(_0x5c6c3b){if(_0x5c6c3b){_0x3068ba=_0x5c6c3b['length'];if(!_0x41514f['query'][_0x263b('0x36')](_0x263b('0x4b'))){_0x16d7eb['limit']=qs['limit'](_0x41514f['query'][_0x263b('0x1f')]);_0x16d7eb['offset']=qs[_0x263b('0x1e')](_0x41514f[_0x263b('0x31')][_0x263b('0x1e')]);}return _0x13f7d4[_0x263b('0x49')](_0x16d7eb);}})[_0x263b('0x27')](function(_0x5e9247){if(_0x5e9247){return _0x5e9247?{'count':_0x3068ba,'rows':_0x5e9247}:null;}})[_0x263b('0x27')](respondWithResult(_0x45ee53,null))['catch'](handleError(_0x45ee53,null));};exports[_0x263b('0x4c')]=function(_0x128fc0,_0x103e45,_0x1003d6){var _0x5bf2c5={};var _0x32574a={};var _0x21f2d0;var _0x258a55;return db[_0x263b('0x2d')][_0x263b('0x4a')]({'where':{'id':_0x128fc0['params']['id']}})[_0x263b('0x27')](handleEntityNotFound(_0x103e45,null))[_0x263b('0x27')](function(_0x3eb697){if(_0x3eb697){_0x21f2d0=_0x3eb697;_0x32574a[_0x263b('0x30')]=_[_0x263b('0x32')](db[_0x263b('0x4d')][_0x263b('0x4e')]);_0x32574a[_0x263b('0x31')]=_[_0x263b('0x32')](_0x128fc0[_0x263b('0x31')]);_0x32574a[_0x263b('0x43')]=_[_0x263b('0x33')](_0x32574a['model'],_0x32574a[_0x263b('0x31')]);_0x5bf2c5[_0x263b('0x34')]=_['intersection'](_0x32574a[_0x263b('0x30')],qs[_0x263b('0x35')](_0x128fc0['query'][_0x263b('0x35')]));_0x5bf2c5[_0x263b('0x34')]=_0x5bf2c5[_0x263b('0x34')][_0x263b('0x44')]?_0x5bf2c5[_0x263b('0x34')]:_0x32574a[_0x263b('0x30')];_0x5bf2c5[_0x263b('0x37')]=qs[_0x263b('0x38')](_0x128fc0['query'][_0x263b('0x38')]);_0x5bf2c5['where']=qs[_0x263b('0x43')](_['pick'](_0x128fc0[_0x263b('0x31')],_0x32574a[_0x263b('0x43')]));if(_0x128fc0['query']['filter']){_0x5bf2c5[_0x263b('0x39')]=_[_0x263b('0x3b')](_0x5bf2c5[_0x263b('0x39')],{'$or':_[_0x263b('0x2c')](_0x5bf2c5[_0x263b('0x34')],function(_0x3eefb2){var _0x57cd2d={};_0x57cd2d[_0x3eefb2]={'$like':'%'+_0x128fc0[_0x263b('0x31')][_0x263b('0x4f')]+'%'};return _0x57cd2d;})});}_0x5bf2c5=_['merge']({},_0x5bf2c5,_0x128fc0[_0x263b('0x3d')]);return _0x21f2d0[_0x263b('0x4c')](_0x5bf2c5);}})['then'](function(_0x50a69f){if(_0x50a69f){_0x258a55=_0x50a69f[_0x263b('0x44')];if(!_0x128fc0[_0x263b('0x31')][_0x263b('0x36')]('nolimit')){_0x5bf2c5[_0x263b('0x1f')]=qs[_0x263b('0x1f')](_0x128fc0['query'][_0x263b('0x1f')]);_0x5bf2c5[_0x263b('0x1e')]=qs[_0x263b('0x1e')](_0x128fc0[_0x263b('0x31')]['offset']);}return _0x21f2d0[_0x263b('0x4c')](_0x5bf2c5);}})[_0x263b('0x27')](function(_0x3e293b){if(_0x3e293b){return _0x3e293b?{'count':_0x258a55,'rows':_0x3e293b}:null;}})[_0x263b('0x27')](respondWithResult(_0x103e45,null))[_0x263b('0x40')](handleError(_0x103e45,null));};exports[_0x263b('0x50')]=function(_0x392dd0,_0x58c7c0,_0x4214ee){var _0x2b7903={};var _0x26eaf8={};var _0x46b963;var _0xc8d591;return db[_0x263b('0x2d')][_0x263b('0x4a')]({'where':{'id':_0x392dd0[_0x263b('0x42')]['id']}})[_0x263b('0x27')](handleEntityNotFound(_0x58c7c0,null))[_0x263b('0x27')](function(_0x29254d){if(_0x29254d){_0x46b963=_0x29254d;_0x26eaf8[_0x263b('0x30')]=_[_0x263b('0x32')](db[_0x263b('0x4d')][_0x263b('0x4e')]);_0x26eaf8[_0x263b('0x31')]=_[_0x263b('0x32')](_0x392dd0['query']);_0x26eaf8[_0x263b('0x43')]=_[_0x263b('0x33')](_0x26eaf8[_0x263b('0x30')],_0x26eaf8[_0x263b('0x31')]);_0x2b7903['attributes']=_[_0x263b('0x33')](_0x26eaf8[_0x263b('0x30')],qs[_0x263b('0x35')](_0x392dd0[_0x263b('0x31')]['fields']));_0x2b7903['attributes']=_0x2b7903['attributes']['length']?_0x2b7903['attributes']:_0x26eaf8[_0x263b('0x30')];_0x2b7903[_0x263b('0x37')]=qs[_0x263b('0x38')](_0x392dd0[_0x263b('0x31')][_0x263b('0x38')]);_0x2b7903[_0x263b('0x39')]=qs[_0x263b('0x43')](_[_0x263b('0x3a')](_0x392dd0[_0x263b('0x31')],_0x26eaf8[_0x263b('0x43')]));if(_0x392dd0[_0x263b('0x31')][_0x263b('0x4f')]){_0x2b7903[_0x263b('0x39')]=_[_0x263b('0x3b')](_0x2b7903['where'],{'$or':_[_0x263b('0x2c')](_0x2b7903[_0x263b('0x34')],function(_0x2fcc06){var _0x1aa584={};_0x1aa584[_0x2fcc06]={'$like':'%'+_0x392dd0[_0x263b('0x31')]['filter']+'%'};return _0x1aa584;})});}_0x2b7903=_[_0x263b('0x3b')]({},_0x2b7903,_0x392dd0['options']);return _0x46b963[_0x263b('0x50')](_0x2b7903);}})[_0x263b('0x27')](function(_0x3cbb87){if(_0x3cbb87){_0xc8d591=_0x3cbb87['length'];if(!_0x392dd0[_0x263b('0x31')][_0x263b('0x36')]('nolimit')){_0x2b7903['limit']=qs['limit'](_0x392dd0[_0x263b('0x31')][_0x263b('0x1f')]);_0x2b7903['offset']=qs['offset'](_0x392dd0[_0x263b('0x31')][_0x263b('0x1e')]);}return _0x46b963['getDescriptions'](_0x2b7903);}})[_0x263b('0x27')](function(_0x472967){if(_0x472967){return _0x472967?{'count':_0xc8d591,'rows':_0x472967}:null;}})[_0x263b('0x27')](respondWithResult(_0x58c7c0,null))[_0x263b('0x40')](handleError(_0x58c7c0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 42b2f84..2479051 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 _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0x4b84[_0x4b4638];return _0x59e92b;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x10cbe4,_0x3a879c){var _0x1406d2=function(_0x126b24){while(--_0x126b24){_0x10cbe4['push'](_0x10cbe4['shift']());}};_0x1406d2(++_0x3a879c);}(_0xa41a,0x6b));var _0xaa41=function(_0x3d35d4,_0x6fd927){_0x3d35d4=_0x3d35d4-0x0;var _0x3e1da7=_0xa41a[_0x3d35d4];return _0x3e1da7;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index e1040f9..4cf5939 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 _0x7c8c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7c8c,0x160));var _0xc7c8=function(_0x2f6e0d,_0x43f2d2){_0x2f6e0d=_0x2f6e0d-0x0;var _0x1e07b6=_0x7c8c[_0x2f6e0d];return _0x1e07b6;};'use strict';var _=require('lodash');var util=require(_0xc7c8('0x0'));var moment=require(_0xc7c8('0x1'));var BPromise=require(_0xc7c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c8('0x3'));var db=require(_0xc7c8('0x4'))['db'];var utils=require(_0xc7c8('0x5'));var logger=require(_0xc7c8('0x6'))(_0xc7c8('0x7'));var config=require(_0xc7c8('0x8'));var jayson=require(_0xc7c8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2961,_0x21ed8e,_0x571d2c){return new BPromise(function(_0x3cf91c,_0x2520fe){return client[_0xc7c8('0xa')](_0x4e2961,_0x571d2c)[_0xc7c8('0xb')](function(_0x1493e7){logger[_0xc7c8('0xc')](_0xc7c8('0xd'),_0x21ed8e,_0xc7c8('0xe'));logger[_0xc7c8('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x21ed8e,_0xc7c8('0xe'),JSON[_0xc7c8('0x10')](_0x1493e7));if(_0x1493e7['error']){if(_0x1493e7[_0xc7c8('0x11')][_0xc7c8('0x12')]===0x1f4){logger[_0xc7c8('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x21ed8e,_0x1493e7['error'][_0xc7c8('0x13')]);return _0x2520fe(_0x1493e7[_0xc7c8('0x11')][_0xc7c8('0x13')]);}logger[_0xc7c8('0x11')](_0xc7c8('0xd'),_0x21ed8e,_0x1493e7[_0xc7c8('0x11')][_0xc7c8('0x13')]);return _0x3cf91c(_0x1493e7[_0xc7c8('0x11')][_0xc7c8('0x13')]);}else{logger['info'](_0xc7c8('0xd'),_0x21ed8e,_0xc7c8('0xe'));_0x3cf91c(_0x1493e7[_0xc7c8('0x14')]['message']);}})[_0xc7c8('0x15')](function(_0x431648){logger['error'](_0xc7c8('0xd'),_0x21ed8e,_0x431648);_0x2520fe(_0x431648);});});} \ No newline at end of file +var _0x7350=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5ea82f,_0x41ef96){var _0x2f38b6=function(_0x5b084e){while(--_0x5b084e){_0x5ea82f['push'](_0x5ea82f['shift']());}};_0x2f38b6(++_0x41ef96);}(_0x7350,0x106));var _0x0735=function(_0x6b17ba,_0x524710){_0x6b17ba=_0x6b17ba-0x0;var _0x5a1c65=_0x7350[_0x6b17ba];return _0x5a1c65;};'use strict';var _=require(_0x0735('0x0'));var util=require(_0x0735('0x1'));var moment=require(_0x0735('0x2'));var BPromise=require(_0x0735('0x3'));var rs=require(_0x0735('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0735('0x5'));var logger=require(_0x0735('0x6'))(_0x0735('0x7'));var config=require('../../config/environment');var jayson=require(_0x0735('0x8'));var client=jayson['client'][_0x0735('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4da6f2,_0x41ef52,_0x20a515){return new BPromise(function(_0x16623c,_0x596269){return client['request'](_0x4da6f2,_0x20a515)[_0x0735('0xa')](function(_0x93606d){logger[_0x0735('0xb')](_0x0735('0xc'),_0x41ef52,_0x0735('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x41ef52,_0x0735('0xd'),JSON[_0x0735('0xe')](_0x93606d));if(_0x93606d['error']){if(_0x93606d['error']['code']===0x1f4){logger[_0x0735('0xf')](_0x0735('0xc'),_0x41ef52,_0x93606d[_0x0735('0xf')][_0x0735('0x10')]);return _0x596269(_0x93606d['error'][_0x0735('0x10')]);}logger[_0x0735('0xf')](_0x0735('0xc'),_0x41ef52,_0x93606d['error'][_0x0735('0x10')]);return _0x16623c(_0x93606d[_0x0735('0xf')][_0x0735('0x10')]);}else{logger[_0x0735('0xb')](_0x0735('0xc'),_0x41ef52,'request\x20sent');_0x16623c(_0x93606d[_0x0735('0x11')]['message']);}})[_0x0735('0x12')](function(_0x23279f){logger['error'](_0x0735('0xc'),_0x41ef52,_0x23279f);_0x596269(_0x23279f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index fb4a7e2..77de82b 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 _0x73f7=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0xc32661,_0x3d9a0a){var _0x346424=function(_0x10473a){while(--_0x10473a){_0xc32661['push'](_0xc32661['shift']());}};_0x346424(++_0x3d9a0a);}(_0x73f7,0x135));var _0x773f=function(_0x522c23,_0x7a7197){_0x522c23=_0x522c23-0x0;var _0x2955a7=_0x73f7[_0x522c23];return _0x2955a7;};'use strict';var multer=require(_0x773f('0x0'));var util=require('util');var path=require(_0x773f('0x1'));var timeout=require(_0x773f('0x2'));var express=require(_0x773f('0x3'));var router=express[_0x773f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x773f('0x5'));var interaction=require(_0x773f('0x6'));var config=require(_0x773f('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x773f('0x8')]('/',auth[_0x773f('0x9')](),controller[_0x773f('0xa')]);router[_0x773f('0x8')](_0x773f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x773f('0xc')]('/',auth[_0x773f('0x9')](),controller[_0x773f('0xd')]);router[_0x773f('0xe')](_0x773f('0xb'),auth[_0x773f('0x9')](),controller[_0x773f('0xf')]);router['delete'](_0x773f('0xb'),auth[_0x773f('0x9')](),controller[_0x773f('0x10')]);module[_0x773f('0x11')]=router; \ No newline at end of file +var _0x6b79=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b79,0xae));var _0x96b7=function(_0x2f8cef,_0x54564f){_0x2f8cef=_0x2f8cef-0x0;var _0x121e74=_0x6b79[_0x2f8cef];return _0x121e74;};'use strict';var multer=require(_0x96b7('0x0'));var util=require(_0x96b7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x96b7('0x2'));var router=express[_0x96b7('0x3')]();var fs_extra=require(_0x96b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x96b7('0x5'));var config=require(_0x96b7('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x96b7('0x7')]('/',auth['isAuthenticated'](),controller[_0x96b7('0x8')]);router[_0x96b7('0x7')](_0x96b7('0x9'),auth[_0x96b7('0xa')](),controller[_0x96b7('0xb')]);router[_0x96b7('0xc')]('/',auth[_0x96b7('0xa')](),controller[_0x96b7('0xd')]);router[_0x96b7('0xe')](_0x96b7('0x9'),auth[_0x96b7('0xa')](),controller[_0x96b7('0xf')]);router[_0x96b7('0x10')](_0x96b7('0x9'),auth['isAuthenticated'](),controller[_0x96b7('0x11')]);module[_0x96b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index b5f6a82..491d02f 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 _0xc5ed=['keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x539709,_0x2c9edd){var _0x73cc7e=function(_0x5d20ea){while(--_0x5d20ea){_0x539709['push'](_0x539709['shift']());}};_0x73cc7e(++_0x2c9edd);}(_0xc5ed,0x68));var _0xdc5e=function(_0x5e63f0,_0x7ad53e){_0x5e63f0=_0x5e63f0-0x0;var _0xb50b7e=_0xc5ed[_0x5e63f0];return _0xb50b7e;};'use strict';var Sequelize=require('sequelize');module[_0xdc5e('0x0')]={'type':{'type':Sequelize['ENUM'](_0xdc5e('0x1'),_0xdc5e('0x2'),_0xdc5e('0x3'),_0xdc5e('0x4'),_0xdc5e('0x5')),'defaultValue':_0xdc5e('0x1')},'content':{'type':Sequelize[_0xdc5e('0x6')]},'key':{'type':Sequelize[_0xdc5e('0x6')]},'keyType':{'type':Sequelize[_0xdc5e('0x7')]('string',_0xdc5e('0x2'),_0xdc5e('0x3'))},'keyContent':{'type':Sequelize[_0xdc5e('0x6')]},'idField':{'type':Sequelize[_0xdc5e('0x6')]},'nameField':{'type':Sequelize[_0xdc5e('0x6')]},'customField':{'type':Sequelize[_0xdc5e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdc5e('0x6')]}}; \ No newline at end of file +var _0xc0b3=['ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x345482,_0x32d1c8){var _0x4d5ae1=function(_0x47e4cd){while(--_0x47e4cd){_0x345482['push'](_0x345482['shift']());}};_0x4d5ae1(++_0x32d1c8);}(_0xc0b3,0x15f));var _0x3c0b=function(_0x558e02,_0x2fb0d3){_0x558e02=_0x558e02-0x0;var _0x1c2db2=_0xc0b3[_0x558e02];return _0x1c2db2;};'use strict';var Sequelize=require('sequelize');module[_0x3c0b('0x0')]={'type':{'type':Sequelize[_0x3c0b('0x1')](_0x3c0b('0x2'),'variable',_0x3c0b('0x3'),_0x3c0b('0x4'),_0x3c0b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3c0b('0x6')]},'keyType':{'type':Sequelize[_0x3c0b('0x1')]('string','variable',_0x3c0b('0x3'))},'keyContent':{'type':Sequelize[_0x3c0b('0x6')]},'idField':{'type':Sequelize[_0x3c0b('0x6')]},'nameField':{'type':Sequelize[_0x3c0b('0x6')]},'customField':{'type':Sequelize[_0x3c0b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c0b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 08ad805..0207148 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 _0xc4cd=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','merge','includeAll','findAll','rows','catch','include','options','create','body','params','destroy','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query'];(function(_0x4fb73c,_0x5a4542){var _0x40f40c=function(_0x3b1592){while(--_0x3b1592){_0x4fb73c['push'](_0x4fb73c['shift']());}};_0x40f40c(++_0x5a4542);}(_0xc4cd,0x159));var _0xdc4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4cd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdc4c('0x0'));var rimraf=require(_0xdc4c('0x1'));var zipdir=require(_0xdc4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc4c('0x3'));var moment=require(_0xdc4c('0x4'));var BPromise=require(_0xdc4c('0x5'));var Mustache=require(_0xdc4c('0x6'));var util=require(_0xdc4c('0x7'));var path=require('path');var sox=require(_0xdc4c('0x8'));var csv=require(_0xdc4c('0x9'));var ejs=require(_0xdc4c('0xa'));var fs=require('fs');var fs_extra=require(_0xdc4c('0xb'));var _=require(_0xdc4c('0xc'));var squel=require(_0xdc4c('0xd'));var crypto=require(_0xdc4c('0xe'));var jsforce=require(_0xdc4c('0xf'));var deskjs=require(_0xdc4c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdc4c('0x11'));var Papa=require('papaparse');var Redis=require(_0xdc4c('0x12'));var authService=require(_0xdc4c('0x13'));var qs=require(_0xdc4c('0x14'));var as=require(_0xdc4c('0x15'));var hardwareService=require(_0xdc4c('0x16'));var logger=require(_0xdc4c('0x17'))('api');var utils=require(_0xdc4c('0x18'));var config=require(_0xdc4c('0x19'));var licenseUtil=require(_0xdc4c('0x1a'));var db=require(_0xdc4c('0x1b'))['db'];function respondWithStatusCode(_0xaa01d1,_0x26ec87){_0x26ec87=_0x26ec87||0xcc;return function(_0x3be0ab){if(_0x3be0ab){return _0xaa01d1[_0xdc4c('0x1c')](_0x26ec87);}return _0xaa01d1[_0xdc4c('0x1d')](_0x26ec87)[_0xdc4c('0x1e')]();};}function respondWithResult(_0x471731,_0x306b65){_0x306b65=_0x306b65||0xc8;return function(_0x201c0b){if(_0x201c0b){return _0x471731[_0xdc4c('0x1d')](_0x306b65)[_0xdc4c('0x1f')](_0x201c0b);}};}function respondWithFilteredResult(_0x55c165,_0x53806f){return function(_0x290470){if(_0x290470){var _0x23a261=typeof _0x53806f['offset']===_0xdc4c('0x20')&&typeof _0x53806f[_0xdc4c('0x21')]==='undefined';var _0x9fa214=_0x290470[_0xdc4c('0x22')];var _0x47a92a=_0x23a261?0x0:_0x53806f[_0xdc4c('0x23')];var _0x25f169=_0x23a261?_0x290470[_0xdc4c('0x22')]:_0x53806f[_0xdc4c('0x23')]+_0x53806f['limit'];var _0x4931af;if(_0x25f169>=_0x9fa214){_0x25f169=_0x9fa214;_0x4931af=0xc8;}else{_0x4931af=0xce;}_0x55c165[_0xdc4c('0x1d')](_0x4931af);return _0x55c165[_0xdc4c('0x24')](_0xdc4c('0x25'),_0x47a92a+'-'+_0x25f169+'/'+_0x9fa214)['json'](_0x290470);}return null;};}function patchUpdates(_0x46d7ae){return function(_0x4d3665){try{jsonpatch[_0xdc4c('0x26')](_0x4d3665,_0x46d7ae,!![]);}catch(_0x304a5b){return BPromise[_0xdc4c('0x27')](_0x304a5b);}return _0x4d3665[_0xdc4c('0x28')]();};}function saveUpdates(_0x1f449a,_0xd09f02){return function(_0x134687){if(_0x134687){return _0x134687[_0xdc4c('0x29')](_0x1f449a)[_0xdc4c('0x2a')](function(_0x23fc30){return _0x23fc30;});}return null;};}function removeEntity(_0x2dd72b,_0x530422){return function(_0x1c5a1e){if(_0x1c5a1e){return _0x1c5a1e['destroy']()[_0xdc4c('0x2a')](function(){_0x2dd72b['status'](0xcc)[_0xdc4c('0x1e')]();});}};}function handleEntityNotFound(_0x5f393a,_0x62b29f){return function(_0xc03277){if(!_0xc03277){_0x5f393a[_0xdc4c('0x1c')](0x194);}return _0xc03277;};}function handleError(_0x4c263b,_0x3c7b0d){_0x3c7b0d=_0x3c7b0d||0x1f4;return function(_0x24c236){logger[_0xdc4c('0x2b')](_0x24c236[_0xdc4c('0x2c')]);if(_0x24c236[_0xdc4c('0x2d')]){delete _0x24c236[_0xdc4c('0x2d')];}_0x4c263b[_0xdc4c('0x1d')](_0x3c7b0d)[_0xdc4c('0x2e')](_0x24c236);};}exports[_0xdc4c('0x2f')]=function(_0x3baf70,_0x28f95a){var _0x5dac4e={},_0xc4572e={},_0x3d6ca6={'count':0x0,'rows':[]};var _0x5e89fb=_[_0xdc4c('0x30')](db[_0xdc4c('0x31')][_0xdc4c('0x32')],function(_0x12b44b){return{'name':_0x12b44b[_0xdc4c('0x33')],'type':_0x12b44b['type'][_0xdc4c('0x34')]};});_0xc4572e[_0xdc4c('0x35')]=_[_0xdc4c('0x30')](_0x5e89fb,_0xdc4c('0x2d'));_0xc4572e[_0xdc4c('0x36')]=_[_0xdc4c('0x37')](_0x3baf70[_0xdc4c('0x36')]);_0xc4572e[_0xdc4c('0x38')]=_[_0xdc4c('0x39')](_0xc4572e[_0xdc4c('0x35')],_0xc4572e['query']);_0x5dac4e[_0xdc4c('0x3a')]=_[_0xdc4c('0x39')](_0xc4572e['model'],qs[_0xdc4c('0x3b')](_0x3baf70[_0xdc4c('0x36')]['fields']));_0x5dac4e['attributes']=_0x5dac4e['attributes'][_0xdc4c('0x3c')]?_0x5dac4e['attributes']:_0xc4572e[_0xdc4c('0x35')];if(!_0x3baf70[_0xdc4c('0x36')][_0xdc4c('0x3d')](_0xdc4c('0x3e'))){_0x5dac4e[_0xdc4c('0x21')]=qs['limit'](_0x3baf70[_0xdc4c('0x36')][_0xdc4c('0x21')]);_0x5dac4e[_0xdc4c('0x23')]=qs['offset'](_0x3baf70[_0xdc4c('0x36')][_0xdc4c('0x23')]);}_0x5dac4e[_0xdc4c('0x3f')]=qs[_0xdc4c('0x40')](_0x3baf70['query'][_0xdc4c('0x40')]);_0x5dac4e[_0xdc4c('0x41')]=qs[_0xdc4c('0x38')](_[_0xdc4c('0x42')](_0x3baf70[_0xdc4c('0x36')],_0xc4572e['filters']),_0x5e89fb);if(_0x3baf70['query']['filter']){_0x5dac4e['where']=_['merge'](_0x5dac4e[_0xdc4c('0x41')],{'$or':_[_0xdc4c('0x30')](_0x5e89fb,function(_0x114cd2){if(_0x114cd2[_0xdc4c('0x43')]!=='VIRTUAL'){var _0x25f9d4={};_0x25f9d4[_0x114cd2[_0xdc4c('0x2d')]]={'$like':'%'+_0x3baf70[_0xdc4c('0x36')]['filter']+'%'};return _0x25f9d4;}})});}_0x5dac4e=_[_0xdc4c('0x44')]({},_0x5dac4e,_0x3baf70['options']);var _0xaa77f9={'where':_0x5dac4e[_0xdc4c('0x41')]};return db[_0xdc4c('0x31')][_0xdc4c('0x22')](_0xaa77f9)[_0xdc4c('0x2a')](function(_0x4da22b){_0x3d6ca6['count']=_0x4da22b;if(_0x3baf70[_0xdc4c('0x36')][_0xdc4c('0x45')]){_0x5dac4e['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xdc4c('0x46')](_0x5dac4e);})[_0xdc4c('0x2a')](function(_0x276483){_0x3d6ca6[_0xdc4c('0x47')]=_0x276483;return _0x3d6ca6;})[_0xdc4c('0x2a')](respondWithFilteredResult(_0x28f95a,_0x5dac4e))[_0xdc4c('0x48')](handleError(_0x28f95a,null));};exports['show']=function(_0x22afa7,_0x6b4a1d){var _0x5ccf6c={'raw':!![],'where':{'id':_0x22afa7['params']['id']}},_0x10823b={};_0x10823b[_0xdc4c('0x35')]=_['keys'](db[_0xdc4c('0x31')][_0xdc4c('0x32')]);_0x10823b[_0xdc4c('0x36')]=_[_0xdc4c('0x37')](_0x22afa7[_0xdc4c('0x36')]);_0x10823b[_0xdc4c('0x38')]=_[_0xdc4c('0x39')](_0x10823b[_0xdc4c('0x35')],_0x10823b[_0xdc4c('0x36')]);_0x5ccf6c[_0xdc4c('0x3a')]=_[_0xdc4c('0x39')](_0x10823b[_0xdc4c('0x35')],qs[_0xdc4c('0x3b')](_0x22afa7[_0xdc4c('0x36')][_0xdc4c('0x3b')]));_0x5ccf6c[_0xdc4c('0x3a')]=_0x5ccf6c['attributes'][_0xdc4c('0x3c')]?_0x5ccf6c['attributes']:_0x10823b[_0xdc4c('0x35')];if(_0x22afa7[_0xdc4c('0x36')]['includeAll']){_0x5ccf6c[_0xdc4c('0x49')]=[{'all':!![]}];}_0x5ccf6c=_['merge']({},_0x5ccf6c,_0x22afa7[_0xdc4c('0x4a')]);return db[_0xdc4c('0x31')]['find'](_0x5ccf6c)[_0xdc4c('0x2a')](handleEntityNotFound(_0x6b4a1d,null))[_0xdc4c('0x2a')](respondWithResult(_0x6b4a1d,null))['catch'](handleError(_0x6b4a1d,null));};exports[_0xdc4c('0x4b')]=function(_0x1714a2,_0x17de7a){return db[_0xdc4c('0x31')][_0xdc4c('0x4b')](_0x1714a2[_0xdc4c('0x4c')],{})['then'](respondWithResult(_0x17de7a,0xc9))[_0xdc4c('0x48')](handleError(_0x17de7a,null));};exports[_0xdc4c('0x29')]=function(_0x3008a5,_0x5d9266){if(_0x3008a5[_0xdc4c('0x4c')]['id']){delete _0x3008a5[_0xdc4c('0x4c')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x3008a5[_0xdc4c('0x4d')]['id']}})[_0xdc4c('0x2a')](handleEntityNotFound(_0x5d9266,null))[_0xdc4c('0x2a')](saveUpdates(_0x3008a5[_0xdc4c('0x4c')],null))['then'](respondWithResult(_0x5d9266,null))[_0xdc4c('0x48')](handleError(_0x5d9266,null));};exports[_0xdc4c('0x4e')]=function(_0xaadfa7,_0x424792){return db[_0xdc4c('0x31')][_0xdc4c('0x4f')]({'where':{'id':_0xaadfa7[_0xdc4c('0x4d')]['id']}})[_0xdc4c('0x2a')](handleEntityNotFound(_0x424792,null))[_0xdc4c('0x2a')](removeEntity(_0x424792,null))[_0xdc4c('0x48')](handleError(_0x424792,null));}; \ No newline at end of file +var _0xb588=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','pick','where','merge','type','VIRTUAL','options','Dynamics365Field','findAll','rows','catch','show','intersection','includeAll','include','find','create','body','params'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb588,0x124));var _0x8b58=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb588[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b58('0x0'));var zipdir=require(_0x8b58('0x1'));var jsonpatch=require(_0x8b58('0x2'));var rp=require(_0x8b58('0x3'));var moment=require(_0x8b58('0x4'));var BPromise=require(_0x8b58('0x5'));var Mustache=require('mustache');var util=require(_0x8b58('0x6'));var path=require(_0x8b58('0x7'));var sox=require('sox');var csv=require(_0x8b58('0x8'));var ejs=require(_0x8b58('0x9'));var fs=require('fs');var fs_extra=require(_0x8b58('0xa'));var _=require('lodash');var squel=require(_0x8b58('0xb'));var crypto=require(_0x8b58('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8b58('0xd'));var Papa=require(_0x8b58('0xe'));var Redis=require(_0x8b58('0xf'));var authService=require(_0x8b58('0x10'));var qs=require(_0x8b58('0x11'));var as=require(_0x8b58('0x12'));var hardwareService=require(_0x8b58('0x13'));var logger=require(_0x8b58('0x14'))(_0x8b58('0x15'));var utils=require('../../config/utils');var config=require(_0x8b58('0x16'));var licenseUtil=require(_0x8b58('0x17'));var db=require(_0x8b58('0x18'))['db'];function respondWithStatusCode(_0x2064e3,_0x47cf80){_0x47cf80=_0x47cf80||0xcc;return function(_0x418016){if(_0x418016){return _0x2064e3[_0x8b58('0x19')](_0x47cf80);}return _0x2064e3[_0x8b58('0x1a')](_0x47cf80)['end']();};}function respondWithResult(_0x1e57da,_0x5a2dc6){_0x5a2dc6=_0x5a2dc6||0xc8;return function(_0x25ecda){if(_0x25ecda){return _0x1e57da['status'](_0x5a2dc6)[_0x8b58('0x1b')](_0x25ecda);}};}function respondWithFilteredResult(_0x200e2c,_0x402ffe){return function(_0x58fbc6){if(_0x58fbc6){var _0x3f3ddd=typeof _0x402ffe[_0x8b58('0x1c')]===_0x8b58('0x1d')&&typeof _0x402ffe[_0x8b58('0x1e')]===_0x8b58('0x1d');var _0x1ad8e0=_0x58fbc6[_0x8b58('0x1f')];var _0xaec8e1=_0x3f3ddd?0x0:_0x402ffe[_0x8b58('0x1c')];var _0x345355=_0x3f3ddd?_0x58fbc6[_0x8b58('0x1f')]:_0x402ffe[_0x8b58('0x1c')]+_0x402ffe['limit'];var _0x1a4bcf;if(_0x345355>=_0x1ad8e0){_0x345355=_0x1ad8e0;_0x1a4bcf=0xc8;}else{_0x1a4bcf=0xce;}_0x200e2c[_0x8b58('0x1a')](_0x1a4bcf);return _0x200e2c[_0x8b58('0x20')](_0x8b58('0x21'),_0xaec8e1+'-'+_0x345355+'/'+_0x1ad8e0)['json'](_0x58fbc6);}return null;};}function patchUpdates(_0x2fd474){return function(_0x2e85d9){try{jsonpatch['apply'](_0x2e85d9,_0x2fd474,!![]);}catch(_0x30b7f4){return BPromise[_0x8b58('0x22')](_0x30b7f4);}return _0x2e85d9[_0x8b58('0x23')]();};}function saveUpdates(_0x5cce11,_0x3b2718){return function(_0xbf0406){if(_0xbf0406){return _0xbf0406[_0x8b58('0x24')](_0x5cce11)[_0x8b58('0x25')](function(_0x5e89a6){return _0x5e89a6;});}return null;};}function removeEntity(_0x1c1544,_0x46bbea){return function(_0x9910c7){if(_0x9910c7){return _0x9910c7[_0x8b58('0x26')]()[_0x8b58('0x25')](function(){_0x1c1544['status'](0xcc)[_0x8b58('0x27')]();});}};}function handleEntityNotFound(_0x57f3c7,_0x55d100){return function(_0xc8ba13){if(!_0xc8ba13){_0x57f3c7['sendStatus'](0x194);}return _0xc8ba13;};}function handleError(_0x56c417,_0x245a06){_0x245a06=_0x245a06||0x1f4;return function(_0x3b279e){logger[_0x8b58('0x28')](_0x3b279e[_0x8b58('0x29')]);if(_0x3b279e[_0x8b58('0x2a')]){delete _0x3b279e['name'];}_0x56c417[_0x8b58('0x1a')](_0x245a06)['send'](_0x3b279e);};}exports[_0x8b58('0x2b')]=function(_0x527630,_0x598175){var _0x44ab33={},_0x4d5391={},_0x112668={'count':0x0,'rows':[]};var _0x20602d=_[_0x8b58('0x2c')](db['Dynamics365Field']['rawAttributes'],function(_0x485af1){return{'name':_0x485af1['fieldName'],'type':_0x485af1['type'][_0x8b58('0x2d')]};});_0x4d5391[_0x8b58('0x2e')]=_[_0x8b58('0x2c')](_0x20602d,_0x8b58('0x2a'));_0x4d5391['query']=_[_0x8b58('0x2f')](_0x527630[_0x8b58('0x30')]);_0x4d5391[_0x8b58('0x31')]=_['intersection'](_0x4d5391[_0x8b58('0x2e')],_0x4d5391[_0x8b58('0x30')]);_0x44ab33[_0x8b58('0x32')]=_['intersection'](_0x4d5391[_0x8b58('0x2e')],qs[_0x8b58('0x33')](_0x527630[_0x8b58('0x30')][_0x8b58('0x33')]));_0x44ab33['attributes']=_0x44ab33[_0x8b58('0x32')][_0x8b58('0x34')]?_0x44ab33[_0x8b58('0x32')]:_0x4d5391[_0x8b58('0x2e')];if(!_0x527630[_0x8b58('0x30')][_0x8b58('0x35')]('nolimit')){_0x44ab33[_0x8b58('0x1e')]=qs[_0x8b58('0x1e')](_0x527630['query']['limit']);_0x44ab33['offset']=qs[_0x8b58('0x1c')](_0x527630[_0x8b58('0x30')][_0x8b58('0x1c')]);}_0x44ab33[_0x8b58('0x36')]=qs['sort'](_0x527630[_0x8b58('0x30')]['sort']);_0x44ab33['where']=qs[_0x8b58('0x31')](_[_0x8b58('0x37')](_0x527630[_0x8b58('0x30')],_0x4d5391[_0x8b58('0x31')]),_0x20602d);if(_0x527630[_0x8b58('0x30')]['filter']){_0x44ab33[_0x8b58('0x38')]=_[_0x8b58('0x39')](_0x44ab33['where'],{'$or':_['map'](_0x20602d,function(_0x523c96){if(_0x523c96[_0x8b58('0x3a')]!==_0x8b58('0x3b')){var _0x199d2c={};_0x199d2c[_0x523c96[_0x8b58('0x2a')]]={'$like':'%'+_0x527630[_0x8b58('0x30')]['filter']+'%'};return _0x199d2c;}})});}_0x44ab33=_[_0x8b58('0x39')]({},_0x44ab33,_0x527630[_0x8b58('0x3c')]);var _0x26e403={'where':_0x44ab33[_0x8b58('0x38')]};return db[_0x8b58('0x3d')]['count'](_0x26e403)['then'](function(_0x126e06){_0x112668[_0x8b58('0x1f')]=_0x126e06;if(_0x527630[_0x8b58('0x30')]['includeAll']){_0x44ab33['include']=[{'all':!![]}];}return db[_0x8b58('0x3d')][_0x8b58('0x3e')](_0x44ab33);})['then'](function(_0x347d69){_0x112668[_0x8b58('0x3f')]=_0x347d69;return _0x112668;})['then'](respondWithFilteredResult(_0x598175,_0x44ab33))[_0x8b58('0x40')](handleError(_0x598175,null));};exports[_0x8b58('0x41')]=function(_0x5a75df,_0x2c5ada){var _0x313be1={'raw':!![],'where':{'id':_0x5a75df['params']['id']}},_0x4ff86a={};_0x4ff86a[_0x8b58('0x2e')]=_[_0x8b58('0x2f')](db[_0x8b58('0x3d')]['rawAttributes']);_0x4ff86a[_0x8b58('0x30')]=_[_0x8b58('0x2f')](_0x5a75df[_0x8b58('0x30')]);_0x4ff86a['filters']=_[_0x8b58('0x42')](_0x4ff86a[_0x8b58('0x2e')],_0x4ff86a[_0x8b58('0x30')]);_0x313be1['attributes']=_[_0x8b58('0x42')](_0x4ff86a[_0x8b58('0x2e')],qs[_0x8b58('0x33')](_0x5a75df['query']['fields']));_0x313be1['attributes']=_0x313be1[_0x8b58('0x32')][_0x8b58('0x34')]?_0x313be1[_0x8b58('0x32')]:_0x4ff86a[_0x8b58('0x2e')];if(_0x5a75df[_0x8b58('0x30')][_0x8b58('0x43')]){_0x313be1[_0x8b58('0x44')]=[{'all':!![]}];}_0x313be1=_[_0x8b58('0x39')]({},_0x313be1,_0x5a75df[_0x8b58('0x3c')]);return db['Dynamics365Field'][_0x8b58('0x45')](_0x313be1)['then'](handleEntityNotFound(_0x2c5ada,null))['then'](respondWithResult(_0x2c5ada,null))[_0x8b58('0x40')](handleError(_0x2c5ada,null));};exports[_0x8b58('0x46')]=function(_0x431282,_0x113623){return db[_0x8b58('0x3d')][_0x8b58('0x46')](_0x431282['body'],{})[_0x8b58('0x25')](respondWithResult(_0x113623,0xc9))[_0x8b58('0x40')](handleError(_0x113623,null));};exports['update']=function(_0x48fd2e,_0x4b5074){if(_0x48fd2e['body']['id']){delete _0x48fd2e[_0x8b58('0x47')]['id'];}return db[_0x8b58('0x3d')][_0x8b58('0x45')]({'where':{'id':_0x48fd2e[_0x8b58('0x48')]['id']}})[_0x8b58('0x25')](handleEntityNotFound(_0x4b5074,null))[_0x8b58('0x25')](saveUpdates(_0x48fd2e[_0x8b58('0x47')],null))[_0x8b58('0x25')](respondWithResult(_0x4b5074,null))[_0x8b58('0x40')](handleError(_0x4b5074,null));};exports[_0x8b58('0x26')]=function(_0x35375e,_0x439760){return db[_0x8b58('0x3d')][_0x8b58('0x45')]({'where':{'id':_0x35375e['params']['id']}})['then'](handleEntityNotFound(_0x439760,null))['then'](removeEntity(_0x439760,null))[_0x8b58('0x40')](handleError(_0x439760,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8692c84..70add33 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 _0x1544=['request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x3b8f12,_0x45daab){var _0x56610d=function(_0x2d6cc3){while(--_0x2d6cc3){_0x3b8f12['push'](_0x3b8f12['shift']());}};_0x56610d(++_0x45daab);}(_0x1544,0x190));var _0x4154=function(_0x447a9f,_0x48619b){_0x447a9f=_0x447a9f-0x0;var _0x1286fc=_0x1544[_0x447a9f];return _0x1286fc;};'use strict';var _=require(_0x4154('0x0'));var util=require(_0x4154('0x1'));var logger=require(_0x4154('0x2'))(_0x4154('0x3'));var moment=require('moment');var BPromise=require(_0x4154('0x4'));var rp=require(_0x4154('0x5'));var fs=require('fs');var path=require(_0x4154('0x6'));var rimraf=require('rimraf');var config=require(_0x4154('0x7'));var attributes=require(_0x4154('0x8'));module[_0x4154('0x9')]=function(_0x4ab130,_0x341776){return _0x4ab130[_0x4154('0xa')](_0x4154('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x4154('0xc'),'fields':[_0x4154('0xd'),_0x4154('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaeb0=['api','moment','bluebird','request-promise','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0xaeb0,0x1cb));var _0x0aeb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaeb0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0aeb('0x0'));var util=require(_0x0aeb('0x1'));var logger=require(_0x0aeb('0x2'))(_0x0aeb('0x3'));var moment=require(_0x0aeb('0x4'));var BPromise=require(_0x0aeb('0x5'));var rp=require(_0x0aeb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x0aeb('0x7')]=function(_0x435810,_0x3e2b7b){return _0x435810[_0x0aeb('0x8')](_0x0aeb('0x9'),attributes,{'tableName':_0x0aeb('0xa'),'paranoid':![],'indexes':[{'name':_0x0aeb('0xb'),'fields':[_0x0aeb('0xc'),_0x0aeb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 780e6da..d8e03c2 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 _0x223f=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x30c52,_0x518d44){var _0xdd5c5=function(_0x3f6ec9){while(--_0x3f6ec9){_0x30c52['push'](_0x30c52['shift']());}};_0xdd5c5(++_0x518d44);}(_0x223f,0x133));var _0xf223=function(_0x4154ec,_0x17bfaf){_0x4154ec=_0x4154ec-0x0;var _0x246367=_0x223f[_0x4154ec];return _0x246367;};'use strict';var _=require(_0xf223('0x0'));var util=require(_0xf223('0x1'));var moment=require(_0xf223('0x2'));var BPromise=require(_0xf223('0x3'));var rs=require(_0xf223('0x4'));var fs=require('fs');var Redis=require(_0xf223('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf223('0x6'));var logger=require(_0xf223('0x7'))(_0xf223('0x8'));var config=require(_0xf223('0x9'));var jayson=require(_0xf223('0xa'));var client=jayson[_0xf223('0xb')][_0xf223('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193a2c,_0x453f66,_0x5dc263){return new BPromise(function(_0x34b7e0,_0xba51a9){return client[_0xf223('0xd')](_0x193a2c,_0x5dc263)[_0xf223('0xe')](function(_0x5ed31a){logger[_0xf223('0xf')](_0xf223('0x10'),_0x453f66,_0xf223('0x11'));logger[_0xf223('0x12')](_0xf223('0x13'),_0x453f66,'request\x20sent',JSON[_0xf223('0x14')](_0x5ed31a));if(_0x5ed31a[_0xf223('0x15')]){if(_0x5ed31a[_0xf223('0x15')]['code']===0x1f4){logger[_0xf223('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x453f66,_0x5ed31a['error'][_0xf223('0x16')]);return _0xba51a9(_0x5ed31a['error'][_0xf223('0x16')]);}logger[_0xf223('0x15')](_0xf223('0x10'),_0x453f66,_0x5ed31a[_0xf223('0x15')][_0xf223('0x16')]);return _0x34b7e0(_0x5ed31a[_0xf223('0x15')][_0xf223('0x16')]);}else{logger[_0xf223('0xf')](_0xf223('0x10'),_0x453f66,_0xf223('0x11'));_0x34b7e0(_0x5ed31a['result'][_0xf223('0x16')]);}})[_0xf223('0x17')](function(_0x5a2477){logger[_0xf223('0x15')](_0xf223('0x10'),_0x453f66,_0x5a2477);_0xba51a9(_0x5a2477);});});} \ No newline at end of file +var _0x12f0=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x29dd1c,_0xec0eb3){var _0x5add97=function(_0x2d7e4f){while(--_0x2d7e4f){_0x29dd1c['push'](_0x29dd1c['shift']());}};_0x5add97(++_0xec0eb3);}(_0x12f0,0x123));var _0x012f=function(_0x4a101b,_0xab31f8){_0x4a101b=_0x4a101b-0x0;var _0x237ac1=_0x12f0[_0x4a101b];return _0x237ac1;};'use strict';var _=require('lodash');var util=require(_0x012f('0x0'));var moment=require(_0x012f('0x1'));var BPromise=require(_0x012f('0x2'));var rs=require(_0x012f('0x3'));var fs=require('fs');var Redis=require(_0x012f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x012f('0x5'));var logger=require(_0x012f('0x6'))(_0x012f('0x7'));var config=require(_0x012f('0x8'));var jayson=require(_0x012f('0x9'));var client=jayson[_0x012f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x341e0f,_0x2127c3,_0x1c3797){return new BPromise(function(_0x3b355e,_0x660116){return client['request'](_0x341e0f,_0x1c3797)[_0x012f('0xb')](function(_0x15ab6c){logger[_0x012f('0xc')](_0x012f('0xd'),_0x2127c3,_0x012f('0xe'));logger['debug'](_0x012f('0xf'),_0x2127c3,_0x012f('0xe'),JSON[_0x012f('0x10')](_0x15ab6c));if(_0x15ab6c[_0x012f('0x11')]){if(_0x15ab6c[_0x012f('0x11')]['code']===0x1f4){logger[_0x012f('0x11')](_0x012f('0xd'),_0x2127c3,_0x15ab6c[_0x012f('0x11')][_0x012f('0x12')]);return _0x660116(_0x15ab6c[_0x012f('0x11')][_0x012f('0x12')]);}logger[_0x012f('0x11')](_0x012f('0xd'),_0x2127c3,_0x15ab6c['error'][_0x012f('0x12')]);return _0x3b355e(_0x15ab6c[_0x012f('0x11')]['message']);}else{logger[_0x012f('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x2127c3,_0x012f('0xe'));_0x3b355e(_0x15ab6c[_0x012f('0x13')][_0x012f('0x12')]);}})[_0x012f('0x14')](function(_0x2190b8){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2127c3,_0x2190b8);_0x660116(_0x2190b8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6e5589b..c6965aa 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 _0x63a0=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf37717,_0x5afacc){var _0x992835=function(_0x1d9e55){while(--_0x1d9e55){_0xf37717['push'](_0xf37717['shift']());}};_0x992835(++_0x5afacc);}(_0x63a0,0x7a));var _0x063a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x63a0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x063a('0x0'));var util=require(_0x063a('0x1'));var path=require(_0x063a('0x2'));var timeout=require(_0x063a('0x3'));var express=require(_0x063a('0x4'));var router=express[_0x063a('0x5')]();var fs_extra=require(_0x063a('0x6'));var auth=require(_0x063a('0x7'));var interaction=require(_0x063a('0x8'));var config=require(_0x063a('0x9'));var controller=require(_0x063a('0xa'));router[_0x063a('0xb')]('/',auth[_0x063a('0xc')](),controller[_0x063a('0xd')]);router[_0x063a('0xb')](_0x063a('0xe'),auth[_0x063a('0xc')](),controller[_0x063a('0xf')]);router[_0x063a('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x063a('0x10')]);router['get']('/:id/fields',auth[_0x063a('0xc')](),controller[_0x063a('0x11')]);router[_0x063a('0x12')]('/',auth['isAuthenticated'](),controller[_0x063a('0x13')]);router[_0x063a('0x12')](_0x063a('0x14'),auth[_0x063a('0xc')](),controller['addConfiguration']);router[_0x063a('0x15')](_0x063a('0xe'),auth[_0x063a('0xc')](),controller[_0x063a('0x16')]);router[_0x063a('0x17')](_0x063a('0xe'),auth[_0x063a('0xc')](),controller[_0x063a('0x18')]);module[_0x063a('0x19')]=router; \ No newline at end of file +var _0x247f=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/:id','show'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x247f,0x121));var _0xf247=function(_0x363552,_0x125738){_0x363552=_0x363552-0x0;var _0x2191dd=_0x247f[_0x363552];return _0x2191dd;};'use strict';var multer=require('multer');var util=require(_0xf247('0x0'));var path=require(_0xf247('0x1'));var timeout=require(_0xf247('0x2'));var express=require(_0xf247('0x3'));var router=express[_0xf247('0x4')]();var fs_extra=require(_0xf247('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xf247('0x6')]('/',auth[_0xf247('0x7')](),controller[_0xf247('0x8')]);router[_0xf247('0x6')](_0xf247('0x9'),auth[_0xf247('0x7')](),controller[_0xf247('0xa')]);router[_0xf247('0x6')](_0xf247('0xb'),auth[_0xf247('0x7')](),controller[_0xf247('0xc')]);router[_0xf247('0x6')](_0xf247('0xd'),auth[_0xf247('0x7')](),controller[_0xf247('0xe')]);router[_0xf247('0xf')]('/',auth[_0xf247('0x7')](),controller['create']);router[_0xf247('0xf')](_0xf247('0xb'),auth['isAuthenticated'](),controller[_0xf247('0x10')]);router['put'](_0xf247('0x9'),auth[_0xf247('0x7')](),controller[_0xf247('0x11')]);router[_0xf247('0x12')](_0xf247('0x9'),auth[_0xf247('0x7')](),controller['destroy']);module[_0xf247('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index cdb0acd..5ecaf72 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 _0xfcbb=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1f04d6,_0x9ada17){var _0x85d832=function(_0x5527a4){while(--_0x5527a4){_0x1f04d6['push'](_0x1f04d6['shift']());}};_0x85d832(++_0x9ada17);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xab1181,_0x5b2fba){_0xab1181=_0xab1181-0x0;var _0xc9b509=_0xfcbb[_0xab1181];return _0xc9b509;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'name':{'type':Sequelize[_0xbfcb('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xbfcb('0x3')},'apiKey':{'type':Sequelize[_0xbfcb('0x2')]},'remoteUri':{'type':Sequelize[_0xbfcb('0x2')],'unique':_0xbfcb('0x4')},'serverUrl':{'type':Sequelize[_0xbfcb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x896e=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5ea7a8,_0x257068){var _0x1b2e3a=function(_0x5d3cfa){while(--_0x5d3cfa){_0x5ea7a8['push'](_0x5ea7a8['shift']());}};_0x1b2e3a(++_0x257068);}(_0x896e,0x1e9));var _0xe896=function(_0x355171,_0x308ffc){_0x355171=_0x355171-0x0;var _0xd9c012=_0x896e[_0x355171];return _0xd9c012;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')]},'description':{'type':Sequelize[_0xe896('0x2')]},'username':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x3')},'apiKey':{'type':Sequelize[_0xe896('0x2')]},'remoteUri':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x4')},'serverUrl':{'type':Sequelize[_0xe896('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 93d107c..c4d3bc4 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 _0x76bc=['%s:X','toString','subject','agent','description','priority','group','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','body','find','params','destroy','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s'];(function(_0x5780fd,_0x39b057){var _0x2d0395=function(_0x365d55){while(--_0x365d55){_0x5780fd['push'](_0x5780fd['shift']());}};_0x2d0395(++_0x39b057);}(_0x76bc,0x17f));var _0xc76b=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x76bc[_0x237f8b];return _0x423f94;};'use strict';var emlformat=require(_0xc76b('0x0'));var rimraf=require(_0xc76b('0x1'));var zipdir=require(_0xc76b('0x2'));var jsonpatch=require(_0xc76b('0x3'));var rp=require(_0xc76b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc76b('0x5'));var util=require(_0xc76b('0x6'));var path=require(_0xc76b('0x7'));var sox=require(_0xc76b('0x8'));var csv=require(_0xc76b('0x9'));var ejs=require(_0xc76b('0xa'));var fs=require('fs');var fs_extra=require(_0xc76b('0xb'));var _=require(_0xc76b('0xc'));var squel=require(_0xc76b('0xd'));var crypto=require(_0xc76b('0xe'));var jsforce=require(_0xc76b('0xf'));var deskjs=require(_0xc76b('0x10'));var toCsv=require(_0xc76b('0x9'));var querystring=require(_0xc76b('0x11'));var Papa=require(_0xc76b('0x12'));var Redis=require(_0xc76b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc76b('0x14'));var as=require(_0xc76b('0x15'));var hardwareService=require(_0xc76b('0x16'));var logger=require(_0xc76b('0x17'))(_0xc76b('0x18'));var utils=require(_0xc76b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc76b('0x1a'));var db=require(_0xc76b('0x1b'))['db'];var integrations=require(_0xc76b('0x1c'));function respondWithStatusCode(_0xc84b2c,_0x4474cd){_0x4474cd=_0x4474cd||0xcc;return function(_0x161f3a){if(_0x161f3a){return _0xc84b2c[_0xc76b('0x1d')](_0x4474cd);}return _0xc84b2c['status'](_0x4474cd)['end']();};}function respondWithResult(_0x38a0f1,_0x25e4a1){_0x25e4a1=_0x25e4a1||0xc8;return function(_0x33e886){if(_0x33e886){return _0x38a0f1[_0xc76b('0x1e')](_0x25e4a1)[_0xc76b('0x1f')](_0x33e886);}};}function respondWithFilteredResult(_0x5d1130,_0x21d99a){return function(_0x2db167){if(_0x2db167){var _0x17c624=typeof _0x21d99a['offset']==='undefined'&&typeof _0x21d99a[_0xc76b('0x20')]===_0xc76b('0x21');var _0x348b6d=_0x2db167[_0xc76b('0x22')];var _0x20e2a3=_0x17c624?0x0:_0x21d99a['offset'];var _0x48f9c0=_0x17c624?_0x2db167['count']:_0x21d99a[_0xc76b('0x23')]+_0x21d99a[_0xc76b('0x20')];var _0x42fff6;if(_0x48f9c0>=_0x348b6d){_0x48f9c0=_0x348b6d;_0x42fff6=0xc8;}else{_0x42fff6=0xce;}_0x5d1130[_0xc76b('0x1e')](_0x42fff6);return _0x5d1130[_0xc76b('0x24')](_0xc76b('0x25'),_0x20e2a3+'-'+_0x48f9c0+'/'+_0x348b6d)[_0xc76b('0x1f')](_0x2db167);}return null;};}function patchUpdates(_0x20aed4){return function(_0x144f6c){try{jsonpatch[_0xc76b('0x26')](_0x144f6c,_0x20aed4,!![]);}catch(_0x48395b){return BPromise[_0xc76b('0x27')](_0x48395b);}return _0x144f6c['save']();};}function saveUpdates(_0x51fafe,_0x3bbede){return function(_0x475432){if(_0x475432){return _0x475432[_0xc76b('0x28')](_0x51fafe)[_0xc76b('0x29')](function(_0x18332d){return _0x18332d;});}return null;};}function removeEntity(_0xa6a862,_0x24ee9a){return function(_0x6c9ee0){if(_0x6c9ee0){return _0x6c9ee0['destroy']()[_0xc76b('0x29')](function(){_0xa6a862[_0xc76b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf43320,_0x2ac9de){return function(_0x161816){if(!_0x161816){_0xf43320[_0xc76b('0x1d')](0x194);}return _0x161816;};}function handleError(_0x369fc1,_0x451ee1){_0x451ee1=_0x451ee1||0x1f4;return function(_0x54e0ec){logger['error'](_0x54e0ec[_0xc76b('0x2a')]);if(_0x54e0ec[_0xc76b('0x2b')]){delete _0x54e0ec[_0xc76b('0x2b')];}_0x369fc1[_0xc76b('0x1e')](_0x451ee1)['send'](_0x54e0ec);};}exports[_0xc76b('0x2c')]=function(_0x26c19b,_0x35d1bc){var _0x4a0918={},_0x24142f={},_0x2cbdb7={'count':0x0,'rows':[]};var _0x368277=_[_0xc76b('0x2d')](db['FreshdeskAccount'][_0xc76b('0x2e')],function(_0x1c06d6){return{'name':_0x1c06d6[_0xc76b('0x2f')],'type':_0x1c06d6[_0xc76b('0x30')][_0xc76b('0x31')]};});_0x24142f['model']=_[_0xc76b('0x2d')](_0x368277,'name');_0x24142f[_0xc76b('0x32')]=_[_0xc76b('0x33')](_0x26c19b[_0xc76b('0x32')]);_0x24142f[_0xc76b('0x34')]=_[_0xc76b('0x35')](_0x24142f[_0xc76b('0x36')],_0x24142f['query']);_0x4a0918['attributes']=_[_0xc76b('0x35')](_0x24142f[_0xc76b('0x36')],qs[_0xc76b('0x37')](_0x26c19b[_0xc76b('0x32')][_0xc76b('0x37')]));_0x4a0918[_0xc76b('0x38')]=_0x4a0918[_0xc76b('0x38')][_0xc76b('0x39')]?_0x4a0918[_0xc76b('0x38')]:_0x24142f[_0xc76b('0x36')];if(!_0x26c19b[_0xc76b('0x32')][_0xc76b('0x3a')](_0xc76b('0x3b'))){_0x4a0918[_0xc76b('0x20')]=qs[_0xc76b('0x20')](_0x26c19b['query'][_0xc76b('0x20')]);_0x4a0918[_0xc76b('0x23')]=qs[_0xc76b('0x23')](_0x26c19b[_0xc76b('0x32')][_0xc76b('0x23')]);}_0x4a0918[_0xc76b('0x3c')]=qs[_0xc76b('0x3d')](_0x26c19b[_0xc76b('0x32')][_0xc76b('0x3d')]);_0x4a0918[_0xc76b('0x3e')]=qs[_0xc76b('0x34')](_[_0xc76b('0x3f')](_0x26c19b[_0xc76b('0x32')],_0x24142f[_0xc76b('0x34')]),_0x368277);if(_0x26c19b['query'][_0xc76b('0x40')]){_0x4a0918['where']=_[_0xc76b('0x41')](_0x4a0918['where'],{'$or':_[_0xc76b('0x2d')](_0x368277,function(_0xaccb61){if(_0xaccb61[_0xc76b('0x30')]!==_0xc76b('0x42')){var _0x11c6f4={};_0x11c6f4[_0xaccb61['name']]={'$like':'%'+_0x26c19b[_0xc76b('0x32')][_0xc76b('0x40')]+'%'};return _0x11c6f4;}})});}_0x4a0918=_[_0xc76b('0x41')]({},_0x4a0918,_0x26c19b[_0xc76b('0x43')]);var _0x92bcd5={'where':_0x4a0918[_0xc76b('0x3e')]};return db[_0xc76b('0x44')][_0xc76b('0x22')](_0x92bcd5)[_0xc76b('0x29')](function(_0x3e9f77){_0x2cbdb7['count']=_0x3e9f77;if(_0x26c19b[_0xc76b('0x32')]['includeAll']){_0x4a0918[_0xc76b('0x45')]=[{'all':!![]}];}return db[_0xc76b('0x44')][_0xc76b('0x46')](_0x4a0918);})[_0xc76b('0x29')](function(_0x81a7ae){_0x2cbdb7[_0xc76b('0x47')]=_0x81a7ae;return _0x2cbdb7;})[_0xc76b('0x29')](respondWithFilteredResult(_0x35d1bc,_0x4a0918))[_0xc76b('0x48')](handleError(_0x35d1bc,null));};exports['show']=function(_0x2b3d36,_0x4ba8a9){var _0x4b3485={'raw':![],'where':{'id':_0x2b3d36['params']['id']}},_0x225dd8={};_0x225dd8[_0xc76b('0x36')]=_[_0xc76b('0x33')](db[_0xc76b('0x44')][_0xc76b('0x2e')]);_0x225dd8[_0xc76b('0x32')]=_['keys'](_0x2b3d36[_0xc76b('0x32')]);_0x225dd8[_0xc76b('0x34')]=_[_0xc76b('0x35')](_0x225dd8[_0xc76b('0x36')],_0x225dd8[_0xc76b('0x32')]);_0x4b3485[_0xc76b('0x38')]=_[_0xc76b('0x35')](_0x225dd8['model'],qs[_0xc76b('0x37')](_0x2b3d36['query'][_0xc76b('0x37')]));_0x4b3485[_0xc76b('0x38')]=_0x4b3485['attributes'][_0xc76b('0x39')]?_0x4b3485[_0xc76b('0x38')]:_0x225dd8['model'];if(_0x2b3d36[_0xc76b('0x32')]['includeAll']){_0x4b3485[_0xc76b('0x45')]=[{'all':!![]}];}_0x4b3485=_['merge']({},_0x4b3485,_0x2b3d36[_0xc76b('0x43')]);return db[_0xc76b('0x44')]['find'](_0x4b3485)[_0xc76b('0x29')](handleEntityNotFound(_0x4ba8a9,null))[_0xc76b('0x29')](respondWithResult(_0x4ba8a9,null))[_0xc76b('0x48')](handleError(_0x4ba8a9,null));};exports['create']=function(_0x43f414,_0x340c8c){return db[_0xc76b('0x44')]['create'](_0x43f414[_0xc76b('0x49')],{})[_0xc76b('0x29')](respondWithResult(_0x340c8c,0xc9))[_0xc76b('0x48')](handleError(_0x340c8c,null));};exports[_0xc76b('0x28')]=function(_0x4d65eb,_0xa0e0f3){if(_0x4d65eb[_0xc76b('0x49')]['id']){delete _0x4d65eb[_0xc76b('0x49')]['id'];}return db[_0xc76b('0x44')][_0xc76b('0x4a')]({'where':{'id':_0x4d65eb[_0xc76b('0x4b')]['id']}})[_0xc76b('0x29')](handleEntityNotFound(_0xa0e0f3,null))[_0xc76b('0x29')](saveUpdates(_0x4d65eb[_0xc76b('0x49')],null))['then'](respondWithResult(_0xa0e0f3,null))[_0xc76b('0x48')](handleError(_0xa0e0f3,null));};exports[_0xc76b('0x4c')]=function(_0x17b009,_0x5b069d){return db[_0xc76b('0x44')][_0xc76b('0x4a')]({'where':{'id':_0x17b009[_0xc76b('0x4b')]['id']}})[_0xc76b('0x29')](handleEntityNotFound(_0x5b069d,null))[_0xc76b('0x29')](removeEntity(_0x5b069d,null))[_0xc76b('0x48')](handleError(_0x5b069d,null));};exports['getConfigurations']=function(_0xddb2ce,_0x91add4,_0x159fec){var _0x36076d={};var _0x55411e={};var _0x3c2f94;var _0x129f78;return db[_0xc76b('0x44')][_0xc76b('0x4d')]({'where':{'id':_0xddb2ce[_0xc76b('0x4b')]['id']}})[_0xc76b('0x29')](handleEntityNotFound(_0x91add4,null))['then'](function(_0x48cfc1){if(_0x48cfc1){_0x3c2f94=_0x48cfc1;_0x55411e[_0xc76b('0x36')]=_['keys'](db[_0xc76b('0x4e')][_0xc76b('0x2e')]);_0x55411e[_0xc76b('0x32')]=_[_0xc76b('0x33')](_0xddb2ce['query']);_0x55411e[_0xc76b('0x34')]=_['intersection'](_0x55411e[_0xc76b('0x36')],_0x55411e[_0xc76b('0x32')]);_0x36076d[_0xc76b('0x38')]=_['intersection'](_0x55411e[_0xc76b('0x36')],qs[_0xc76b('0x37')](_0xddb2ce[_0xc76b('0x32')][_0xc76b('0x37')]));_0x36076d[_0xc76b('0x38')]=_0x36076d[_0xc76b('0x38')][_0xc76b('0x39')]?_0x36076d['attributes']:_0x55411e[_0xc76b('0x36')];_0x36076d[_0xc76b('0x3c')]=qs[_0xc76b('0x3d')](_0xddb2ce[_0xc76b('0x32')][_0xc76b('0x3d')]);_0x36076d[_0xc76b('0x3e')]=qs['filters'](_[_0xc76b('0x3f')](_0xddb2ce[_0xc76b('0x32')],_0x55411e[_0xc76b('0x34')]));if(_0xddb2ce['query'][_0xc76b('0x40')]){_0x36076d[_0xc76b('0x3e')]=_[_0xc76b('0x41')](_0x36076d[_0xc76b('0x3e')],{'$or':_[_0xc76b('0x2d')](_0x36076d[_0xc76b('0x38')],function(_0x42293f){var _0x1bb0a6={};_0x1bb0a6[_0x42293f]={'$like':'%'+_0xddb2ce['query'][_0xc76b('0x40')]+'%'};return _0x1bb0a6;})});}_0x36076d=_[_0xc76b('0x41')]({},_0x36076d,_0xddb2ce[_0xc76b('0x43')]);return _0x3c2f94[_0xc76b('0x4f')](_0x36076d);}})[_0xc76b('0x29')](function(_0x30658c){if(_0x30658c){_0x129f78=_0x30658c[_0xc76b('0x39')];if(!_0xddb2ce[_0xc76b('0x32')][_0xc76b('0x3a')](_0xc76b('0x3b'))){_0x36076d[_0xc76b('0x20')]=qs[_0xc76b('0x20')](_0xddb2ce['query'][_0xc76b('0x20')]);_0x36076d[_0xc76b('0x23')]=qs['offset'](_0xddb2ce['query'][_0xc76b('0x23')]);}return _0x3c2f94['getConfigurations'](_0x36076d);}})[_0xc76b('0x29')](function(_0x3c7608){if(_0x3c7608){return _0x3c7608?{'count':_0x129f78,'rows':_0x3c7608}:null;}})[_0xc76b('0x29')](respondWithResult(_0x91add4,null))[_0xc76b('0x48')](handleError(_0x91add4,null));};exports[_0xc76b('0x50')]=function(_0x3e6ef7,_0x2f1134,_0xc2f197){if(_0x3e6ef7['body']['id']){delete _0x3e6ef7[_0xc76b('0x49')]['id'];}return db['FreshdeskAccount'][_0xc76b('0x4d')]({'where':{'id':_0x3e6ef7['params']['id']}})['then'](handleEntityNotFound(_0x2f1134,null))['then'](function(_0x21aaf4){if(_0x21aaf4){_0x3e6ef7[_0xc76b('0x49')][_0xc76b('0x51')]=_0x21aaf4['id'];_0x3e6ef7[_0xc76b('0x49')][_0xc76b('0x52')]=integrations[_0xc76b('0x53')](_0x3e6ef7[_0xc76b('0x49')][_0xc76b('0x54')],_0x3e6ef7[_0xc76b('0x49')]['type']);_0x3e6ef7[_0xc76b('0x49')][_0xc76b('0x55')]=integrations['getDescriptions'](_0x3e6ef7[_0xc76b('0x49')]['channel'],_0x3e6ef7[_0xc76b('0x49')]['type']);return db[_0xc76b('0x4e')]['create'](_0x3e6ef7[_0xc76b('0x49')],{'include':[{'model':db[_0xc76b('0x56')],'as':_0xc76b('0x52')},{'model':db[_0xc76b('0x56')],'as':_0xc76b('0x55')}]});}return null;})[_0xc76b('0x29')](respondWithResult(_0x2f1134,null))['catch'](handleError(_0x2f1134,null));};exports['getFields']=function(_0x31682f,_0x914127,_0x3d2050){var _0x439814='';return db[_0xc76b('0x44')]['findOne']({'where':{'id':_0x31682f['params']['id']},'attributes':['id',_0xc76b('0x57'),_0xc76b('0x58')]})['then'](handleEntityNotFound(_0x914127,null))[_0xc76b('0x29')](function(_0x429868){if(_0x429868){_0x439814=_0x429868[_0xc76b('0x57')];var _0x2cca0c=_0x439814[_0xc76b('0x59')](-0x1);if(_0x2cca0c==='/'){_0x439814=_0x439814[_0xc76b('0x5a')](0x0,_0x439814[_0xc76b('0x5b')](_0x2cca0c));}return rp({'method':_0xc76b('0x5c'),'uri':util[_0xc76b('0x5d')](_0xc76b('0x5e'),_0x439814,_0xc76b('0x5f')),'headers':{'Authorization':util[_0xc76b('0x5d')](_0xc76b('0x60'),new Buffer(util[_0xc76b('0x5d')](_0xc76b('0x61'),_0x429868[_0xc76b('0x58')]))[_0xc76b('0x62')]('base64'))},'json':!![]});}})[_0xc76b('0x29')](function(_0x208ebc){if(_0x208ebc){var _0x1c63f5=['requester',_0xc76b('0x63'),_0xc76b('0x64'),_0xc76b('0x65'),_0xc76b('0x1e'),_0xc76b('0x66'),_0xc76b('0x67'),'source',_0xc76b('0x68'),'group',_0xc76b('0x69')];_[_0xc76b('0x6a')](_0x208ebc,function(_0x14e737){return _0x1c63f5['includes'](_0x14e737[_0xc76b('0x2b')])||!_0x14e737[_0xc76b('0x6b')]&&_0x14e737[_0xc76b('0x30')]!==_0xc76b('0x6c')&&_0x14e737[_0xc76b('0x30')]!==_0xc76b('0x6d');});return{'count':_0x208ebc['length'],'rows':_['map'](_0x208ebc,function(_0x3c914d){return{'id':_0x3c914d[_0xc76b('0x2b')],'name':_0x3c914d[_0xc76b('0x6e')],'custom':!_0x3c914d[_0xc76b('0x6b')],'options':_0x3c914d['choices']?_['map'](_0x3c914d[_0xc76b('0x6f')],function(_0x3c16b0){return{'name':_['capitalize'](_0x3c16b0),'value':_0x3c16b0};}):[]};})};}})[_0xc76b('0x29')](respondWithResult(_0x914127,null))[_0xc76b('0x48')](function(_0x3af26a){var _0x37617e=_0x31682f[_0xc76b('0x32')][_0xc76b('0x70')]?0x1f4:_0x3af26a[_0xc76b('0x71')]||0x1f4;logger[_0xc76b('0x72')](_0xc76b('0x73'),_0xc76b('0x74'),_0x37617e,JSON[_0xc76b('0x75')](_0x3af26a));delete _0x3af26a['name'];if(_0x37617e===0x191){_0x37617e=0x190;}_0x914127[_0xc76b('0x1e')](_0x37617e)[_0xc76b('0x76')](_0x31682f[_0xc76b('0x32')][_0xc76b('0x70')]?{'message':_0xc76b('0x77'),'statusCode':_0x3af26a[_0xc76b('0x71')]}:_0x3af26a);});}; \ No newline at end of file +var _0x40ca=['save','update','then','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','destroy','getConfigurations','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','Basic\x20%s','%s:X','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','choices','capitalize','statusCode','send','test','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','reject'];(function(_0x2f4523,_0x5896cf){var _0x292bc9=function(_0x411865){while(--_0x411865){_0x2f4523['push'](_0x2f4523['shift']());}};_0x292bc9(++_0x5896cf);}(_0x40ca,0x1a1));var _0xa40c=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x40ca[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0xa40c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa40c('0x1'));var rp=require(_0xa40c('0x2'));var moment=require(_0xa40c('0x3'));var BPromise=require(_0xa40c('0x4'));var Mustache=require('mustache');var util=require(_0xa40c('0x5'));var path=require('path');var sox=require(_0xa40c('0x6'));var csv=require('to-csv');var ejs=require(_0xa40c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa40c('0x8'));var squel=require(_0xa40c('0x9'));var crypto=require(_0xa40c('0xa'));var jsforce=require(_0xa40c('0xb'));var deskjs=require(_0xa40c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa40c('0xd'));var Papa=require(_0xa40c('0xe'));var Redis=require(_0xa40c('0xf'));var authService=require(_0xa40c('0x10'));var qs=require(_0xa40c('0x11'));var as=require(_0xa40c('0x12'));var hardwareService=require(_0xa40c('0x13'));var logger=require(_0xa40c('0x14'))(_0xa40c('0x15'));var utils=require(_0xa40c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa40c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa40c('0x18'));function respondWithStatusCode(_0x15e176,_0x41b25a){_0x41b25a=_0x41b25a||0xcc;return function(_0x1b39b0){if(_0x1b39b0){return _0x15e176[_0xa40c('0x19')](_0x41b25a);}return _0x15e176['status'](_0x41b25a)[_0xa40c('0x1a')]();};}function respondWithResult(_0x16d2fc,_0x4bebe6){_0x4bebe6=_0x4bebe6||0xc8;return function(_0x298242){if(_0x298242){return _0x16d2fc['status'](_0x4bebe6)[_0xa40c('0x1b')](_0x298242);}};}function respondWithFilteredResult(_0x1f7d00,_0x6081b7){return function(_0x50421f){if(_0x50421f){var _0x55ff88=typeof _0x6081b7[_0xa40c('0x1c')]===_0xa40c('0x1d')&&typeof _0x6081b7[_0xa40c('0x1e')]===_0xa40c('0x1d');var _0xa2f9bb=_0x50421f[_0xa40c('0x1f')];var _0x224e78=_0x55ff88?0x0:_0x6081b7[_0xa40c('0x1c')];var _0x41c2bb=_0x55ff88?_0x50421f[_0xa40c('0x1f')]:_0x6081b7[_0xa40c('0x1c')]+_0x6081b7[_0xa40c('0x1e')];var _0x4fed31;if(_0x41c2bb>=_0xa2f9bb){_0x41c2bb=_0xa2f9bb;_0x4fed31=0xc8;}else{_0x4fed31=0xce;}_0x1f7d00[_0xa40c('0x20')](_0x4fed31);return _0x1f7d00[_0xa40c('0x21')]('Content-Range',_0x224e78+'-'+_0x41c2bb+'/'+_0xa2f9bb)['json'](_0x50421f);}return null;};}function patchUpdates(_0xa9fc69){return function(_0x185019){try{jsonpatch['apply'](_0x185019,_0xa9fc69,!![]);}catch(_0x5c3133){return BPromise[_0xa40c('0x22')](_0x5c3133);}return _0x185019[_0xa40c('0x23')]();};}function saveUpdates(_0x26bc3b,_0x2e3020){return function(_0xa93761){if(_0xa93761){return _0xa93761[_0xa40c('0x24')](_0x26bc3b)[_0xa40c('0x25')](function(_0x12324b){return _0x12324b;});}return null;};}function removeEntity(_0x11f17f,_0x2f177d){return function(_0x5bba37){if(_0x5bba37){return _0x5bba37['destroy']()[_0xa40c('0x25')](function(){_0x11f17f[_0xa40c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb5deb,_0xe117f8){return function(_0x990dc1){if(!_0x990dc1){_0xfb5deb['sendStatus'](0x194);}return _0x990dc1;};}function handleError(_0x4d2c3c,_0x383928){_0x383928=_0x383928||0x1f4;return function(_0xe9d08f){logger[_0xa40c('0x26')](_0xe9d08f[_0xa40c('0x27')]);if(_0xe9d08f['name']){delete _0xe9d08f[_0xa40c('0x28')];}_0x4d2c3c[_0xa40c('0x20')](_0x383928)['send'](_0xe9d08f);};}exports[_0xa40c('0x29')]=function(_0x154389,_0x450493){var _0x29e1cd={},_0x8ae47d={},_0x370f56={'count':0x0,'rows':[]};var _0x4bccd9=_[_0xa40c('0x2a')](db[_0xa40c('0x2b')][_0xa40c('0x2c')],function(_0x36d1b4){return{'name':_0x36d1b4[_0xa40c('0x2d')],'type':_0x36d1b4[_0xa40c('0x2e')][_0xa40c('0x2f')]};});_0x8ae47d['model']=_[_0xa40c('0x2a')](_0x4bccd9,_0xa40c('0x28'));_0x8ae47d['query']=_[_0xa40c('0x30')](_0x154389[_0xa40c('0x31')]);_0x8ae47d[_0xa40c('0x32')]=_[_0xa40c('0x33')](_0x8ae47d[_0xa40c('0x34')],_0x8ae47d[_0xa40c('0x31')]);_0x29e1cd[_0xa40c('0x35')]=_[_0xa40c('0x33')](_0x8ae47d[_0xa40c('0x34')],qs[_0xa40c('0x36')](_0x154389[_0xa40c('0x31')]['fields']));_0x29e1cd['attributes']=_0x29e1cd[_0xa40c('0x35')][_0xa40c('0x37')]?_0x29e1cd[_0xa40c('0x35')]:_0x8ae47d[_0xa40c('0x34')];if(!_0x154389[_0xa40c('0x31')][_0xa40c('0x38')](_0xa40c('0x39'))){_0x29e1cd['limit']=qs[_0xa40c('0x1e')](_0x154389[_0xa40c('0x31')][_0xa40c('0x1e')]);_0x29e1cd[_0xa40c('0x1c')]=qs[_0xa40c('0x1c')](_0x154389[_0xa40c('0x31')][_0xa40c('0x1c')]);}_0x29e1cd[_0xa40c('0x3a')]=qs[_0xa40c('0x3b')](_0x154389[_0xa40c('0x31')]['sort']);_0x29e1cd[_0xa40c('0x3c')]=qs[_0xa40c('0x32')](_[_0xa40c('0x3d')](_0x154389[_0xa40c('0x31')],_0x8ae47d['filters']),_0x4bccd9);if(_0x154389[_0xa40c('0x31')]['filter']){_0x29e1cd[_0xa40c('0x3c')]=_['merge'](_0x29e1cd[_0xa40c('0x3c')],{'$or':_[_0xa40c('0x2a')](_0x4bccd9,function(_0xe5f2c2){if(_0xe5f2c2['type']!=='VIRTUAL'){var _0x10e263={};_0x10e263[_0xe5f2c2[_0xa40c('0x28')]]={'$like':'%'+_0x154389[_0xa40c('0x31')][_0xa40c('0x3e')]+'%'};return _0x10e263;}})});}_0x29e1cd=_[_0xa40c('0x3f')]({},_0x29e1cd,_0x154389[_0xa40c('0x40')]);var _0x4b9012={'where':_0x29e1cd[_0xa40c('0x3c')]};return db[_0xa40c('0x2b')][_0xa40c('0x1f')](_0x4b9012)[_0xa40c('0x25')](function(_0x21efc6){_0x370f56['count']=_0x21efc6;if(_0x154389['query'][_0xa40c('0x41')]){_0x29e1cd[_0xa40c('0x42')]=[{'all':!![]}];}return db[_0xa40c('0x2b')][_0xa40c('0x43')](_0x29e1cd);})[_0xa40c('0x25')](function(_0xc3305a){_0x370f56[_0xa40c('0x44')]=_0xc3305a;return _0x370f56;})['then'](respondWithFilteredResult(_0x450493,_0x29e1cd))['catch'](handleError(_0x450493,null));};exports[_0xa40c('0x45')]=function(_0x515c31,_0x57affa){var _0x2808d7={'raw':![],'where':{'id':_0x515c31['params']['id']}},_0x5603b6={};_0x5603b6['model']=_[_0xa40c('0x30')](db[_0xa40c('0x2b')][_0xa40c('0x2c')]);_0x5603b6[_0xa40c('0x31')]=_['keys'](_0x515c31[_0xa40c('0x31')]);_0x5603b6[_0xa40c('0x32')]=_[_0xa40c('0x33')](_0x5603b6[_0xa40c('0x34')],_0x5603b6[_0xa40c('0x31')]);_0x2808d7['attributes']=_[_0xa40c('0x33')](_0x5603b6[_0xa40c('0x34')],qs['fields'](_0x515c31['query'][_0xa40c('0x36')]));_0x2808d7['attributes']=_0x2808d7['attributes']['length']?_0x2808d7[_0xa40c('0x35')]:_0x5603b6[_0xa40c('0x34')];if(_0x515c31[_0xa40c('0x31')][_0xa40c('0x41')]){_0x2808d7['include']=[{'all':!![]}];}_0x2808d7=_['merge']({},_0x2808d7,_0x515c31[_0xa40c('0x40')]);return db[_0xa40c('0x2b')]['find'](_0x2808d7)[_0xa40c('0x25')](handleEntityNotFound(_0x57affa,null))['then'](respondWithResult(_0x57affa,null))[_0xa40c('0x46')](handleError(_0x57affa,null));};exports[_0xa40c('0x47')]=function(_0x49699f,_0x495243){return db['FreshdeskAccount'][_0xa40c('0x47')](_0x49699f[_0xa40c('0x48')],{})[_0xa40c('0x25')](respondWithResult(_0x495243,0xc9))[_0xa40c('0x46')](handleError(_0x495243,null));};exports['update']=function(_0x335c72,_0x5f7899){if(_0x335c72[_0xa40c('0x48')]['id']){delete _0x335c72[_0xa40c('0x48')]['id'];}return db[_0xa40c('0x2b')][_0xa40c('0x49')]({'where':{'id':_0x335c72[_0xa40c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5f7899,null))['then'](saveUpdates(_0x335c72[_0xa40c('0x48')],null))['then'](respondWithResult(_0x5f7899,null))[_0xa40c('0x46')](handleError(_0x5f7899,null));};exports[_0xa40c('0x4b')]=function(_0x7cde92,_0x3b40f9){return db[_0xa40c('0x2b')][_0xa40c('0x49')]({'where':{'id':_0x7cde92['params']['id']}})['then'](handleEntityNotFound(_0x3b40f9,null))['then'](removeEntity(_0x3b40f9,null))['catch'](handleError(_0x3b40f9,null));};exports[_0xa40c('0x4c')]=function(_0xb1504f,_0x420709,_0x26439b){var _0x1f53d2={};var _0x2b85d8={};var _0x46781c;var _0xe25500;return db[_0xa40c('0x2b')][_0xa40c('0x4d')]({'where':{'id':_0xb1504f[_0xa40c('0x4a')]['id']}})[_0xa40c('0x25')](handleEntityNotFound(_0x420709,null))[_0xa40c('0x25')](function(_0x4d8b0b){if(_0x4d8b0b){_0x46781c=_0x4d8b0b;_0x2b85d8[_0xa40c('0x34')]=_[_0xa40c('0x30')](db['FreshdeskConfiguration']['rawAttributes']);_0x2b85d8[_0xa40c('0x31')]=_[_0xa40c('0x30')](_0xb1504f[_0xa40c('0x31')]);_0x2b85d8[_0xa40c('0x32')]=_[_0xa40c('0x33')](_0x2b85d8[_0xa40c('0x34')],_0x2b85d8[_0xa40c('0x31')]);_0x1f53d2[_0xa40c('0x35')]=_[_0xa40c('0x33')](_0x2b85d8['model'],qs[_0xa40c('0x36')](_0xb1504f['query'][_0xa40c('0x36')]));_0x1f53d2['attributes']=_0x1f53d2[_0xa40c('0x35')][_0xa40c('0x37')]?_0x1f53d2['attributes']:_0x2b85d8[_0xa40c('0x34')];_0x1f53d2['order']=qs[_0xa40c('0x3b')](_0xb1504f['query'][_0xa40c('0x3b')]);_0x1f53d2[_0xa40c('0x3c')]=qs[_0xa40c('0x32')](_[_0xa40c('0x3d')](_0xb1504f[_0xa40c('0x31')],_0x2b85d8[_0xa40c('0x32')]));if(_0xb1504f['query'][_0xa40c('0x3e')]){_0x1f53d2[_0xa40c('0x3c')]=_[_0xa40c('0x3f')](_0x1f53d2['where'],{'$or':_[_0xa40c('0x2a')](_0x1f53d2[_0xa40c('0x35')],function(_0xdfce6b){var _0x19203d={};_0x19203d[_0xdfce6b]={'$like':'%'+_0xb1504f[_0xa40c('0x31')][_0xa40c('0x3e')]+'%'};return _0x19203d;})});}_0x1f53d2=_[_0xa40c('0x3f')]({},_0x1f53d2,_0xb1504f[_0xa40c('0x40')]);return _0x46781c[_0xa40c('0x4c')](_0x1f53d2);}})['then'](function(_0xe2c3aa){if(_0xe2c3aa){_0xe25500=_0xe2c3aa[_0xa40c('0x37')];if(!_0xb1504f[_0xa40c('0x31')][_0xa40c('0x38')]('nolimit')){_0x1f53d2['limit']=qs['limit'](_0xb1504f[_0xa40c('0x31')]['limit']);_0x1f53d2['offset']=qs[_0xa40c('0x1c')](_0xb1504f[_0xa40c('0x31')]['offset']);}return _0x46781c[_0xa40c('0x4c')](_0x1f53d2);}})['then'](function(_0x236e95){if(_0x236e95){return _0x236e95?{'count':_0xe25500,'rows':_0x236e95}:null;}})[_0xa40c('0x25')](respondWithResult(_0x420709,null))[_0xa40c('0x46')](handleError(_0x420709,null));};exports['addConfiguration']=function(_0x203b74,_0x131228,_0x10a4e4){if(_0x203b74[_0xa40c('0x48')]['id']){delete _0x203b74[_0xa40c('0x48')]['id'];}return db[_0xa40c('0x2b')]['findOne']({'where':{'id':_0x203b74['params']['id']}})[_0xa40c('0x25')](handleEntityNotFound(_0x131228,null))['then'](function(_0x331029){if(_0x331029){_0x203b74[_0xa40c('0x48')][_0xa40c('0x4e')]=_0x331029['id'];_0x203b74[_0xa40c('0x48')][_0xa40c('0x4f')]=integrations[_0xa40c('0x50')](_0x203b74[_0xa40c('0x48')]['channel'],_0x203b74['body'][_0xa40c('0x2e')]);_0x203b74[_0xa40c('0x48')][_0xa40c('0x51')]=integrations[_0xa40c('0x52')](_0x203b74[_0xa40c('0x48')][_0xa40c('0x53')],_0x203b74[_0xa40c('0x48')][_0xa40c('0x2e')]);return db['FreshdeskConfiguration'][_0xa40c('0x47')](_0x203b74[_0xa40c('0x48')],{'include':[{'model':db[_0xa40c('0x54')],'as':_0xa40c('0x4f')},{'model':db[_0xa40c('0x54')],'as':'Descriptions'}]});}return null;})[_0xa40c('0x25')](respondWithResult(_0x131228,null))[_0xa40c('0x46')](handleError(_0x131228,null));};exports[_0xa40c('0x55')]=function(_0x26a01c,_0x1adc04,_0x3988c8){var _0x6ae658='';return db[_0xa40c('0x2b')][_0xa40c('0x4d')]({'where':{'id':_0x26a01c[_0xa40c('0x4a')]['id']},'attributes':['id',_0xa40c('0x56'),_0xa40c('0x57')]})[_0xa40c('0x25')](handleEntityNotFound(_0x1adc04,null))[_0xa40c('0x25')](function(_0x5d1415){if(_0x5d1415){_0x6ae658=_0x5d1415[_0xa40c('0x56')];var _0x1d1965=_0x6ae658[_0xa40c('0x58')](-0x1);if(_0x1d1965==='/'){_0x6ae658=_0x6ae658[_0xa40c('0x59')](0x0,_0x6ae658[_0xa40c('0x5a')](_0x1d1965));}return rp({'method':'GET','uri':util[_0xa40c('0x5b')](_0xa40c('0x5c'),_0x6ae658,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xa40c('0x5b')](_0xa40c('0x5d'),new Buffer(util['format'](_0xa40c('0x5e'),_0x5d1415[_0xa40c('0x57')]))['toString']('base64'))},'json':!![]});}})['then'](function(_0xe306a1){if(_0xe306a1){var _0x516bb9=[_0xa40c('0x5f'),_0xa40c('0x60'),_0xa40c('0x61'),_0xa40c('0x62'),_0xa40c('0x20'),_0xa40c('0x63'),_0xa40c('0x64'),_0xa40c('0x65'),_0xa40c('0x66'),'group',_0xa40c('0x67')];_[_0xa40c('0x68')](_0xe306a1,function(_0x59077a){return _0x516bb9[_0xa40c('0x69')](_0x59077a['name'])||!_0x59077a[_0xa40c('0x6a')]&&_0x59077a[_0xa40c('0x2e')]!==_0xa40c('0x6b')&&_0x59077a[_0xa40c('0x2e')]!=='custom_dropdown';});return{'count':_0xe306a1[_0xa40c('0x37')],'rows':_[_0xa40c('0x2a')](_0xe306a1,function(_0x526154){return{'id':_0x526154['name'],'name':_0x526154['label'],'custom':!_0x526154[_0xa40c('0x6a')],'options':_0x526154[_0xa40c('0x6c')]?_[_0xa40c('0x2a')](_0x526154[_0xa40c('0x6c')],function(_0xdf72e){return{'name':_[_0xa40c('0x6d')](_0xdf72e),'value':_0xdf72e};}):[]};})};}})[_0xa40c('0x25')](respondWithResult(_0x1adc04,null))[_0xa40c('0x46')](function(_0x13f600){var _0xa10f99=_0x26a01c[_0xa40c('0x31')]['test']?0x1f4:_0x13f600[_0xa40c('0x6e')]||0x1f4;logger[_0xa40c('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xa40c('0x55'),_0xa10f99,JSON['stringify'](_0x13f600));delete _0x13f600['name'];if(_0xa10f99===0x191){_0xa10f99=0x190;}_0x1adc04[_0xa40c('0x20')](_0xa10f99)[_0xa40c('0x6f')](_0x26a01c[_0xa40c('0x31')][_0xa40c('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x13f600[_0xa40c('0x6e')]}:_0x13f600);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index da92661..c8894d9 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 _0x4a7f=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19a0b2,_0x221d10){var _0x33b3aa=function(_0x1fa786){while(--_0x1fa786){_0x19a0b2['push'](_0x19a0b2['shift']());}};_0x33b3aa(++_0x221d10);}(_0x4a7f,0x1a5));var _0xf4a7=function(_0x3e8bce,_0x434f31){_0x3e8bce=_0x3e8bce-0x0;var _0x5c685a=_0x4a7f[_0x3e8bce];return _0x5c685a;};'use strict';var _=require(_0xf4a7('0x0'));var util=require(_0xf4a7('0x1'));var logger=require(_0xf4a7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf4a7('0x3'));var rp=require(_0xf4a7('0x4'));var fs=require('fs');var path=require(_0xf4a7('0x5'));var rimraf=require(_0xf4a7('0x6'));var config=require(_0xf4a7('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xf4a7('0x8'));module[_0xf4a7('0x9')]=function(_0x5aed86,_0x594776){return _0x5aed86[_0xf4a7('0xa')](_0xf4a7('0xb'),attributes,{'tableName':_0xf4a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3709=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0xa7242e,_0x22572b){var _0x55dbc4=function(_0x54d6f6){while(--_0x54d6f6){_0xa7242e['push'](_0xa7242e['shift']());}};_0x55dbc4(++_0x22572b);}(_0x3709,0x1a6));var _0x9370=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3709[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x9370('0x0'));var util=require(_0x9370('0x1'));var logger=require(_0x9370('0x2'))(_0x9370('0x3'));var moment=require('moment');var BPromise=require(_0x9370('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9370('0x5'));var rimraf=require('rimraf');var config=require(_0x9370('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x9370('0x7'));module[_0x9370('0x8')]=function(_0x24f933,_0x328a77){return _0x24f933[_0x9370('0x9')](_0x9370('0xa'),attributes,{'tableName':_0x9370('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 8c61c65..e194e2c 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 _0x2094=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','findAll','options','raw','where','attributes','include','map','model','GetFreshdeskAccount','FreshdeskAccount','find','ShowFreshdeskAccount','lodash','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2094,0x10d));var _0x4209=function(_0x2cf11f,_0x2b7dd2){_0x2cf11f=_0x2cf11f-0x0;var _0x18c84d=_0x2094[_0x2cf11f];return _0x18c84d;};'use strict';var _=require(_0x4209('0x0'));var util=require('util');var moment=require(_0x4209('0x1'));var BPromise=require(_0x4209('0x2'));var rs=require(_0x4209('0x3'));var fs=require('fs');var Redis=require(_0x4209('0x4'));var db=require(_0x4209('0x5'))['db'];var utils=require(_0x4209('0x6'));var logger=require(_0x4209('0x7'))(_0x4209('0x8'));var config=require(_0x4209('0x9'));var jayson=require(_0x4209('0xa'));var client=jayson[_0x4209('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33eb32,_0xd81f56,_0x249c2f){return new BPromise(function(_0x3bcb1a,_0x1dca17){return client[_0x4209('0xc')](_0x33eb32,_0x249c2f)[_0x4209('0xd')](function(_0x4b6d4e){logger[_0x4209('0xe')](_0x4209('0xf'),_0xd81f56,_0x4209('0x10'));logger[_0x4209('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xd81f56,_0x4209('0x10'),JSON[_0x4209('0x12')](_0x4b6d4e));if(_0x4b6d4e['error']){if(_0x4b6d4e[_0x4209('0x13')][_0x4209('0x14')]===0x1f4){logger['error'](_0x4209('0xf'),_0xd81f56,_0x4b6d4e['error'][_0x4209('0x15')]);return _0x1dca17(_0x4b6d4e[_0x4209('0x13')][_0x4209('0x15')]);}logger[_0x4209('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0xd81f56,_0x4b6d4e[_0x4209('0x13')][_0x4209('0x15')]);return _0x3bcb1a(_0x4b6d4e['error'][_0x4209('0x15')]);}else{logger[_0x4209('0xe')](_0x4209('0xf'),_0xd81f56,_0x4209('0x10'));_0x3bcb1a(_0x4b6d4e['result'][_0x4209('0x15')]);}})['catch'](function(_0xcbcb6a){logger[_0x4209('0x13')](_0x4209('0xf'),_0xd81f56,_0xcbcb6a);_0x1dca17(_0xcbcb6a);});});}exports['GetFreshdeskAccount']=function(_0x1f47a2){var _0x4c25a2=this;return new Promise(function(_0x35ab27,_0x301c5e){return db['FreshdeskAccount'][_0x4209('0x16')]({'raw':_0x1f47a2['options']?_0x1f47a2[_0x4209('0x17')][_0x4209('0x18')]===undefined?!![]:![]:!![],'where':_0x1f47a2[_0x4209('0x17')]?_0x1f47a2[_0x4209('0x17')][_0x4209('0x19')]||null:null,'attributes':_0x1f47a2[_0x4209('0x17')]?_0x1f47a2[_0x4209('0x17')][_0x4209('0x1a')]||null:null,'limit':_0x1f47a2['options']?_0x1f47a2['options']['limit']||null:null,'include':_0x1f47a2[_0x4209('0x17')]?_0x1f47a2[_0x4209('0x17')][_0x4209('0x1b')]?_[_0x4209('0x1c')](_0x1f47a2['options'][_0x4209('0x1b')],function(_0x5a4387){return{'model':db[_0x5a4387[_0x4209('0x1d')]],'as':_0x5a4387['as'],'attributes':_0x5a4387[_0x4209('0x1a')],'include':_0x5a4387[_0x4209('0x1b')]?_['map'](_0x5a4387[_0x4209('0x1b')],function(_0x5db3d0){return{'model':db[_0x5db3d0[_0x4209('0x1d')]],'as':_0x5db3d0['as'],'attributes':_0x5db3d0['attributes'],'include':_0x5db3d0[_0x4209('0x1b')]?_[_0x4209('0x1c')](_0x5db3d0[_0x4209('0x1b')],function(_0x505c83){return{'model':db[_0x505c83['model']],'as':_0x505c83['as'],'attributes':_0x505c83['attributes']};}):[]};}):[]};}):[]:[]})[_0x4209('0xd')](function(_0x335f61){logger['info']('GetFreshdeskAccount',_0x1f47a2);logger['debug']('GetFreshdeskAccount',_0x1f47a2,JSON[_0x4209('0x12')](_0x335f61));_0x35ab27(_0x335f61);})['catch'](function(_0x5cb383){logger[_0x4209('0x13')](_0x4209('0x1e'),_0x5cb383[_0x4209('0x15')],_0x1f47a2);_0x301c5e(_0x4c25a2[_0x4209('0x13')](0x1f4,_0x5cb383['message']));});});};exports['ShowFreshdeskAccount']=function(_0x3218d0){var _0x1b02a6=this;return new Promise(function(_0x44a083,_0x375212){return db[_0x4209('0x1f')][_0x4209('0x20')]({'raw':_0x3218d0[_0x4209('0x17')]?_0x3218d0[_0x4209('0x17')][_0x4209('0x18')]===undefined?!![]:![]:!![],'where':_0x3218d0[_0x4209('0x17')]?_0x3218d0['options'][_0x4209('0x19')]||null:null,'attributes':_0x3218d0[_0x4209('0x17')]?_0x3218d0[_0x4209('0x17')][_0x4209('0x1a')]||null:null,'include':_0x3218d0[_0x4209('0x17')]?_0x3218d0['options'][_0x4209('0x1b')]?_['map'](_0x3218d0[_0x4209('0x17')][_0x4209('0x1b')],function(_0x39e912){return{'model':db[_0x39e912[_0x4209('0x1d')]],'as':_0x39e912['as'],'attributes':_0x39e912[_0x4209('0x1a')],'include':_0x39e912[_0x4209('0x1b')]?_[_0x4209('0x1c')](_0x39e912['include'],function(_0x4654e0){return{'model':db[_0x4654e0['model']],'as':_0x4654e0['as'],'attributes':_0x4654e0['attributes'],'include':_0x4654e0['include']?_[_0x4209('0x1c')](_0x4654e0[_0x4209('0x1b')],function(_0x4df963){return{'model':db[_0x4df963[_0x4209('0x1d')]],'as':_0x4df963['as'],'attributes':_0x4df963[_0x4209('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eec9a){logger[_0x4209('0xe')](_0x4209('0x21'),_0x3218d0);logger[_0x4209('0x11')](_0x4209('0x21'),_0x3218d0,JSON[_0x4209('0x12')](_0x5eec9a));_0x44a083(_0x5eec9a);})['catch'](function(_0x35862c){logger[_0x4209('0x13')](_0x4209('0x21'),_0x35862c[_0x4209('0x15')],_0x3218d0);_0x375212(_0x1b02a6[_0x4209('0x13')](0x1f4,_0x35862c[_0x4209('0x15')]));});});}; \ No newline at end of file +var _0x1a94=['info','request\x20sent','result','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFreshdeskAccount','FreshdeskAccount','find','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1a55f6,_0x4a8d78){var _0x45f095=function(_0x55bd04){while(--_0x55bd04){_0x1a55f6['push'](_0x1a55f6['shift']());}};_0x45f095(++_0x4a8d78);}(_0x1a94,0x11a));var _0x41a9=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x1a94[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require(_0x41a9('0x0'));var moment=require(_0x41a9('0x1'));var BPromise=require(_0x41a9('0x2'));var rs=require(_0x41a9('0x3'));var fs=require('fs');var Redis=require(_0x41a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x41a9('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x41a9('0x6'));var client=jayson[_0x41a9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x258a17,_0x54e41e,_0x4bb85d){return new BPromise(function(_0x5a0511,_0x243498){return client[_0x41a9('0x8')](_0x258a17,_0x4bb85d)[_0x41a9('0x9')](function(_0x2c9db2){logger['info'](_0x41a9('0xa'),_0x54e41e,'request\x20sent');logger['debug'](_0x41a9('0xb'),_0x54e41e,'request\x20sent',JSON[_0x41a9('0xc')](_0x2c9db2));if(_0x2c9db2[_0x41a9('0xd')]){if(_0x2c9db2[_0x41a9('0xd')]['code']===0x1f4){logger[_0x41a9('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x54e41e,_0x2c9db2[_0x41a9('0xd')][_0x41a9('0xe')]);return _0x243498(_0x2c9db2[_0x41a9('0xd')][_0x41a9('0xe')]);}logger[_0x41a9('0xd')](_0x41a9('0xa'),_0x54e41e,_0x2c9db2[_0x41a9('0xd')][_0x41a9('0xe')]);return _0x5a0511(_0x2c9db2[_0x41a9('0xd')][_0x41a9('0xe')]);}else{logger[_0x41a9('0xf')](_0x41a9('0xa'),_0x54e41e,_0x41a9('0x10'));_0x5a0511(_0x2c9db2[_0x41a9('0x11')][_0x41a9('0xe')]);}})['catch'](function(_0x2265c9){logger[_0x41a9('0xd')](_0x41a9('0xa'),_0x54e41e,_0x2265c9);_0x243498(_0x2265c9);});});}exports[_0x41a9('0x12')]=function(_0x171b32){var _0x5322ff=this;return new Promise(function(_0x3d2b9b,_0x36234b){return db['FreshdeskAccount'][_0x41a9('0x13')]({'raw':_0x171b32[_0x41a9('0x14')]?_0x171b32[_0x41a9('0x14')][_0x41a9('0x15')]===undefined?!![]:![]:!![],'where':_0x171b32[_0x41a9('0x14')]?_0x171b32[_0x41a9('0x14')][_0x41a9('0x16')]||null:null,'attributes':_0x171b32[_0x41a9('0x14')]?_0x171b32[_0x41a9('0x14')][_0x41a9('0x17')]||null:null,'limit':_0x171b32['options']?_0x171b32[_0x41a9('0x14')][_0x41a9('0x18')]||null:null,'include':_0x171b32[_0x41a9('0x14')]?_0x171b32['options'][_0x41a9('0x19')]?_[_0x41a9('0x1a')](_0x171b32[_0x41a9('0x14')]['include'],function(_0xd6f09f){return{'model':db[_0xd6f09f[_0x41a9('0x1b')]],'as':_0xd6f09f['as'],'attributes':_0xd6f09f[_0x41a9('0x17')],'include':_0xd6f09f['include']?_['map'](_0xd6f09f['include'],function(_0x44f88f){return{'model':db[_0x44f88f[_0x41a9('0x1b')]],'as':_0x44f88f['as'],'attributes':_0x44f88f[_0x41a9('0x17')],'include':_0x44f88f[_0x41a9('0x19')]?_[_0x41a9('0x1a')](_0x44f88f[_0x41a9('0x19')],function(_0x6ae4fd){return{'model':db[_0x6ae4fd['model']],'as':_0x6ae4fd['as'],'attributes':_0x6ae4fd[_0x41a9('0x17')]};}):[]};}):[]};}):[]:[]})[_0x41a9('0x9')](function(_0x3f4ae0){logger['info'](_0x41a9('0x12'),_0x171b32);logger[_0x41a9('0x1c')](_0x41a9('0x12'),_0x171b32,JSON[_0x41a9('0xc')](_0x3f4ae0));_0x3d2b9b(_0x3f4ae0);})['catch'](function(_0x28c28a){logger[_0x41a9('0xd')]('GetFreshdeskAccount',_0x28c28a[_0x41a9('0xe')],_0x171b32);_0x36234b(_0x5322ff['error'](0x1f4,_0x28c28a['message']));});});};exports[_0x41a9('0x1d')]=function(_0x7a25de){var _0x1b9e44=this;return new Promise(function(_0x49ad83,_0x110d5b){return db[_0x41a9('0x1e')][_0x41a9('0x1f')]({'raw':_0x7a25de['options']?_0x7a25de[_0x41a9('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x7a25de[_0x41a9('0x14')]?_0x7a25de[_0x41a9('0x14')][_0x41a9('0x16')]||null:null,'attributes':_0x7a25de['options']?_0x7a25de['options'][_0x41a9('0x17')]||null:null,'include':_0x7a25de[_0x41a9('0x14')]?_0x7a25de['options'][_0x41a9('0x19')]?_[_0x41a9('0x1a')](_0x7a25de[_0x41a9('0x14')][_0x41a9('0x19')],function(_0x3ff3de){return{'model':db[_0x3ff3de['model']],'as':_0x3ff3de['as'],'attributes':_0x3ff3de[_0x41a9('0x17')],'include':_0x3ff3de[_0x41a9('0x19')]?_[_0x41a9('0x1a')](_0x3ff3de['include'],function(_0x144bd7){return{'model':db[_0x144bd7[_0x41a9('0x1b')]],'as':_0x144bd7['as'],'attributes':_0x144bd7['attributes'],'include':_0x144bd7[_0x41a9('0x19')]?_[_0x41a9('0x1a')](_0x144bd7[_0x41a9('0x19')],function(_0x5a844c){return{'model':db[_0x5a844c[_0x41a9('0x1b')]],'as':_0x5a844c['as'],'attributes':_0x5a844c[_0x41a9('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x212055){logger[_0x41a9('0xf')](_0x41a9('0x1d'),_0x7a25de);logger[_0x41a9('0x1c')]('ShowFreshdeskAccount',_0x7a25de,JSON[_0x41a9('0xc')](_0x212055));_0x49ad83(_0x212055);})[_0x41a9('0x20')](function(_0x2120e8){logger[_0x41a9('0xd')](_0x41a9('0x1d'),_0x2120e8[_0x41a9('0xe')],_0x7a25de);_0x110d5b(_0x1b9e44[_0x41a9('0xd')](0x1f4,_0x2120e8[_0x41a9('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c0298e7..8d7964f 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 _0xdf54=['delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','update'];(function(_0x1af3df,_0x7a5dc2){var _0x50eba3=function(_0x553a41){while(--_0x553a41){_0x1af3df['push'](_0x1af3df['shift']());}};_0x50eba3(++_0x7a5dc2);}(_0xdf54,0x72));var _0x4df5=function(_0x4716e4,_0x3b7501){_0x4716e4=_0x4716e4-0x0;var _0x3f33a9=_0xdf54[_0x4716e4];return _0x3f33a9;};'use strict';var multer=require('multer');var util=require(_0x4df5('0x0'));var path=require(_0x4df5('0x1'));var timeout=require(_0x4df5('0x2'));var express=require(_0x4df5('0x3'));var router=express[_0x4df5('0x4')]();var fs_extra=require(_0x4df5('0x5'));var auth=require(_0x4df5('0x6'));var interaction=require(_0x4df5('0x7'));var config=require(_0x4df5('0x8'));var controller=require(_0x4df5('0x9'));router[_0x4df5('0xa')]('/',auth['isAuthenticated'](),controller[_0x4df5('0xb')]);router[_0x4df5('0xa')](_0x4df5('0xc'),auth[_0x4df5('0xd')](),controller[_0x4df5('0xe')]);router['get'](_0x4df5('0xf'),auth[_0x4df5('0xd')](),controller['getFields']);router['get'](_0x4df5('0x10'),auth['isAuthenticated'](),controller[_0x4df5('0x11')]);router[_0x4df5('0xa')](_0x4df5('0x12'),auth[_0x4df5('0xd')](),controller[_0x4df5('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x4df5('0x14')]('/',auth[_0x4df5('0xd')](),controller[_0x4df5('0x15')]);router[_0x4df5('0x14')](_0x4df5('0x16'),auth[_0x4df5('0xd')](),controller[_0x4df5('0x17')]);router[_0x4df5('0x18')](_0x4df5('0xc'),auth['isAuthenticated'](),controller[_0x4df5('0x19')]);router[_0x4df5('0x1a')](_0x4df5('0xc'),auth[_0x4df5('0xd')](),controller['destroy']);module[_0x4df5('0x1b')]=router; \ No newline at end of file +var _0x34f5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy'];(function(_0x344bb9,_0x5022be){var _0x130aef=function(_0x44fab5){while(--_0x44fab5){_0x344bb9['push'](_0x344bb9['shift']());}};_0x130aef(++_0x5022be);}(_0x34f5,0x1b9));var _0x534f=function(_0xecb781,_0x210347){_0xecb781=_0xecb781-0x0;var _0x1138d8=_0x34f5[_0xecb781];return _0x1138d8;};'use strict';var multer=require(_0x534f('0x0'));var util=require(_0x534f('0x1'));var path=require(_0x534f('0x2'));var timeout=require(_0x534f('0x3'));var express=require(_0x534f('0x4'));var router=express[_0x534f('0x5')]();var fs_extra=require(_0x534f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x534f('0x7'));var config=require(_0x534f('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x534f('0x9')]('/',auth[_0x534f('0xa')](),controller[_0x534f('0xb')]);router[_0x534f('0x9')](_0x534f('0xc'),auth[_0x534f('0xa')](),controller[_0x534f('0xd')]);router[_0x534f('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x534f('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x534f('0xe')]);router['get'](_0x534f('0xf'),auth[_0x534f('0xa')](),controller[_0x534f('0x10')]);router[_0x534f('0x9')]('/:id/tags',auth[_0x534f('0xa')](),controller['getTags']);router[_0x534f('0x11')]('/',auth[_0x534f('0xa')](),controller[_0x534f('0x12')]);router['post']('/:id/tags',auth[_0x534f('0xa')](),controller['setTags']);router['put']('/:id',auth[_0x534f('0xa')](),controller['update']);router[_0x534f('0x13')](_0x534f('0xc'),auth[_0x534f('0xa')](),controller[_0x534f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c852863..08a3f9c 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 _0x5923=['STRING','sequelize'];(function(_0x52712a,_0x1e087e){var _0x47c137=function(_0xb4064b){while(--_0xb4064b){_0x52712a['push'](_0x52712a['shift']());}};_0x47c137(++_0x1e087e);}(_0x5923,0xe9));var _0x3592=function(_0x2b1bb9,_0x3f85cc){_0x2b1bb9=_0x2b1bb9-0x0;var _0x59f401=_0x5923[_0x2b1bb9];return _0x59f401;};'use strict';var Sequelize=require(_0x3592('0x0'));module['exports']={'name':{'type':Sequelize[_0x3592('0x1')]},'description':{'type':Sequelize[_0x3592('0x1')]}}; \ No newline at end of file +var _0xa64a=['exports','STRING','sequelize'];(function(_0x5b4972,_0x464200){var _0x6df520=function(_0x377edc){while(--_0x377edc){_0x5b4972['push'](_0x5b4972['shift']());}};_0x6df520(++_0x464200);}(_0xa64a,0x161));var _0xaa64=function(_0x44b568,_0x229838){_0x44b568=_0x44b568-0x0;var _0x15adb2=_0xa64a[_0x44b568];return _0x15adb2;};'use strict';var Sequelize=require(_0xaa64('0x0'));module[_0xaa64('0x1')]={'name':{'type':Sequelize[_0xaa64('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 250e46f..2a4a993 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 _0x3011=['apply','reject','update','destroy','then','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','getFields','findOne','order','nolimit','getSubjects','getDescriptions','FreshdeskField','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x3011,0x139));var _0x1301=function(_0x836533,_0x386bc8){_0x836533=_0x836533-0x0;var _0x4200e7=_0x3011[_0x836533];return _0x4200e7;};'use strict';var emlformat=require(_0x1301('0x0'));var rimraf=require(_0x1301('0x1'));var zipdir=require(_0x1301('0x2'));var jsonpatch=require(_0x1301('0x3'));var rp=require(_0x1301('0x4'));var moment=require('moment');var BPromise=require(_0x1301('0x5'));var Mustache=require(_0x1301('0x6'));var util=require(_0x1301('0x7'));var path=require(_0x1301('0x8'));var sox=require(_0x1301('0x9'));var csv=require(_0x1301('0xa'));var ejs=require(_0x1301('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1301('0xc'));var squel=require(_0x1301('0xd'));var crypto=require(_0x1301('0xe'));var jsforce=require(_0x1301('0xf'));var deskjs=require(_0x1301('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1301('0x11'));var Papa=require(_0x1301('0x12'));var Redis=require('ioredis');var authService=require(_0x1301('0x13'));var qs=require(_0x1301('0x14'));var as=require(_0x1301('0x15'));var hardwareService=require(_0x1301('0x16'));var logger=require(_0x1301('0x17'))(_0x1301('0x18'));var utils=require(_0x1301('0x19'));var config=require(_0x1301('0x1a'));var licenseUtil=require(_0x1301('0x1b'));var db=require(_0x1301('0x1c'))['db'];function respondWithStatusCode(_0x1fe34b,_0x52ea7c){_0x52ea7c=_0x52ea7c||0xcc;return function(_0x1cd049){if(_0x1cd049){return _0x1fe34b[_0x1301('0x1d')](_0x52ea7c);}return _0x1fe34b['status'](_0x52ea7c)[_0x1301('0x1e')]();};}function respondWithResult(_0x4204e0,_0x14feb0){_0x14feb0=_0x14feb0||0xc8;return function(_0x2e9506){if(_0x2e9506){return _0x4204e0[_0x1301('0x1f')](_0x14feb0)[_0x1301('0x20')](_0x2e9506);}};}function respondWithFilteredResult(_0x2a1916,_0x5d6505){return function(_0x55b324){if(_0x55b324){var _0x23731e=typeof _0x5d6505['offset']===_0x1301('0x21')&&typeof _0x5d6505[_0x1301('0x22')]===_0x1301('0x21');var _0x434052=_0x55b324[_0x1301('0x23')];var _0x87aca=_0x23731e?0x0:_0x5d6505['offset'];var _0x39cbd7=_0x23731e?_0x55b324['count']:_0x5d6505[_0x1301('0x24')]+_0x5d6505[_0x1301('0x22')];var _0x424676;if(_0x39cbd7>=_0x434052){_0x39cbd7=_0x434052;_0x424676=0xc8;}else{_0x424676=0xce;}_0x2a1916[_0x1301('0x1f')](_0x424676);return _0x2a1916[_0x1301('0x25')](_0x1301('0x26'),_0x87aca+'-'+_0x39cbd7+'/'+_0x434052)[_0x1301('0x20')](_0x55b324);}return null;};}function patchUpdates(_0x56d106){return function(_0x2bb8d0){try{jsonpatch[_0x1301('0x27')](_0x2bb8d0,_0x56d106,!![]);}catch(_0x2da10d){return BPromise[_0x1301('0x28')](_0x2da10d);}return _0x2bb8d0['save']();};}function saveUpdates(_0x4d1e02,_0x496501){return function(_0x2b01ca){if(_0x2b01ca){return _0x2b01ca[_0x1301('0x29')](_0x4d1e02)['then'](function(_0x34d380){return _0x34d380;});}return null;};}function removeEntity(_0xbd6475,_0x57a214){return function(_0x829d9c){if(_0x829d9c){return _0x829d9c[_0x1301('0x2a')]()[_0x1301('0x2b')](function(){_0xbd6475[_0x1301('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb36136,_0x11d5be){return function(_0x112728){if(!_0x112728){_0xb36136[_0x1301('0x1d')](0x194);}return _0x112728;};}function handleError(_0x5b4ed6,_0x491357){_0x491357=_0x491357||0x1f4;return function(_0x674318){logger[_0x1301('0x2c')](_0x674318['stack']);if(_0x674318[_0x1301('0x2d')]){delete _0x674318[_0x1301('0x2d')];}_0x5b4ed6[_0x1301('0x1f')](_0x491357)[_0x1301('0x2e')](_0x674318);};}exports[_0x1301('0x2f')]=function(_0x3de7cc,_0x5083c7){var _0x2b5983={},_0x5a0d5f={},_0x371b92={'count':0x0,'rows':[]};var _0x2d258c=_[_0x1301('0x30')](db[_0x1301('0x31')][_0x1301('0x32')],function(_0x11638c){return{'name':_0x11638c['fieldName'],'type':_0x11638c['type'][_0x1301('0x33')]};});_0x5a0d5f['model']=_[_0x1301('0x30')](_0x2d258c,_0x1301('0x2d'));_0x5a0d5f[_0x1301('0x34')]=_[_0x1301('0x35')](_0x3de7cc[_0x1301('0x34')]);_0x5a0d5f[_0x1301('0x36')]=_[_0x1301('0x37')](_0x5a0d5f[_0x1301('0x38')],_0x5a0d5f[_0x1301('0x34')]);_0x2b5983['attributes']=_[_0x1301('0x37')](_0x5a0d5f['model'],qs['fields'](_0x3de7cc[_0x1301('0x34')][_0x1301('0x39')]));_0x2b5983['attributes']=_0x2b5983[_0x1301('0x3a')][_0x1301('0x3b')]?_0x2b5983[_0x1301('0x3a')]:_0x5a0d5f[_0x1301('0x38')];if(!_0x3de7cc[_0x1301('0x34')][_0x1301('0x3c')]('nolimit')){_0x2b5983[_0x1301('0x22')]=qs[_0x1301('0x22')](_0x3de7cc[_0x1301('0x34')]['limit']);_0x2b5983[_0x1301('0x24')]=qs[_0x1301('0x24')](_0x3de7cc[_0x1301('0x34')][_0x1301('0x24')]);}_0x2b5983['order']=qs[_0x1301('0x3d')](_0x3de7cc[_0x1301('0x34')][_0x1301('0x3d')]);_0x2b5983[_0x1301('0x3e')]=qs[_0x1301('0x36')](_[_0x1301('0x3f')](_0x3de7cc['query'],_0x5a0d5f[_0x1301('0x36')]),_0x2d258c);if(_0x3de7cc[_0x1301('0x34')][_0x1301('0x40')]){_0x2b5983['where']=_[_0x1301('0x41')](_0x2b5983[_0x1301('0x3e')],{'$or':_[_0x1301('0x30')](_0x2d258c,function(_0x448439){if(_0x448439[_0x1301('0x42')]!==_0x1301('0x43')){var _0xf413a9={};_0xf413a9[_0x448439[_0x1301('0x2d')]]={'$like':'%'+_0x3de7cc[_0x1301('0x34')][_0x1301('0x40')]+'%'};return _0xf413a9;}})});}_0x2b5983=_[_0x1301('0x41')]({},_0x2b5983,_0x3de7cc[_0x1301('0x44')]);var _0x11bc52={'where':_0x2b5983[_0x1301('0x3e')]};return db[_0x1301('0x31')][_0x1301('0x23')](_0x11bc52)[_0x1301('0x2b')](function(_0x38ee6f){_0x371b92['count']=_0x38ee6f;if(_0x3de7cc[_0x1301('0x34')]['includeAll']){_0x2b5983[_0x1301('0x45')]=[{'all':!![]}];}return db[_0x1301('0x31')][_0x1301('0x46')](_0x2b5983);})[_0x1301('0x2b')](function(_0x76385c){_0x371b92[_0x1301('0x47')]=_0x76385c;return _0x371b92;})['then'](respondWithFilteredResult(_0x5083c7,_0x2b5983))[_0x1301('0x48')](handleError(_0x5083c7,null));};exports['show']=function(_0xd8ac8e,_0x2f3ad9){var _0x1afbeb={'raw':![],'where':{'id':_0xd8ac8e[_0x1301('0x49')]['id']}},_0x1abcea={};_0x1abcea[_0x1301('0x38')]=_[_0x1301('0x35')](db[_0x1301('0x31')][_0x1301('0x32')]);_0x1abcea[_0x1301('0x34')]=_['keys'](_0xd8ac8e[_0x1301('0x34')]);_0x1abcea['filters']=_[_0x1301('0x37')](_0x1abcea[_0x1301('0x38')],_0x1abcea['query']);_0x1afbeb[_0x1301('0x3a')]=_['intersection'](_0x1abcea[_0x1301('0x38')],qs['fields'](_0xd8ac8e[_0x1301('0x34')]['fields']));_0x1afbeb['attributes']=_0x1afbeb['attributes'][_0x1301('0x3b')]?_0x1afbeb['attributes']:_0x1abcea[_0x1301('0x38')];if(_0xd8ac8e[_0x1301('0x34')][_0x1301('0x4a')]){_0x1afbeb['include']=[{'all':!![]}];}_0x1afbeb=_[_0x1301('0x41')]({},_0x1afbeb,_0xd8ac8e[_0x1301('0x44')]);return db[_0x1301('0x31')][_0x1301('0x4b')](_0x1afbeb)['then'](handleEntityNotFound(_0x2f3ad9,null))[_0x1301('0x2b')](respondWithResult(_0x2f3ad9,null))[_0x1301('0x48')](handleError(_0x2f3ad9,null));};exports['create']=function(_0x17b3e9,_0x54c4ae){return db[_0x1301('0x31')][_0x1301('0x4c')](_0x17b3e9[_0x1301('0x4d')],{})[_0x1301('0x2b')](respondWithResult(_0x54c4ae,0xc9))[_0x1301('0x48')](handleError(_0x54c4ae,null));};exports[_0x1301('0x29')]=function(_0x4f126b,_0x18c19f){if(_0x4f126b['body']['id']){delete _0x4f126b[_0x1301('0x4d')]['id'];}return db[_0x1301('0x31')][_0x1301('0x4b')]({'where':{'id':_0x4f126b[_0x1301('0x49')]['id']}})[_0x1301('0x2b')](handleEntityNotFound(_0x18c19f,null))[_0x1301('0x2b')](saveUpdates(_0x4f126b[_0x1301('0x4d')],null))[_0x1301('0x2b')](respondWithResult(_0x18c19f,null))[_0x1301('0x48')](handleError(_0x18c19f,null));};exports[_0x1301('0x2a')]=function(_0x365507,_0xb275f6){return db[_0x1301('0x31')][_0x1301('0x4b')]({'where':{'id':_0x365507['params']['id']}})[_0x1301('0x2b')](handleEntityNotFound(_0xb275f6,null))['then'](removeEntity(_0xb275f6,null))[_0x1301('0x48')](handleError(_0xb275f6,null));};exports[_0x1301('0x4e')]=function(_0x205956,_0x37bb58,_0x1aa7e9){var _0x133edc={};var _0xa3e56b={};var _0x380aa7;var _0x58b51a;return db[_0x1301('0x31')][_0x1301('0x4f')]({'where':{'id':_0x205956[_0x1301('0x49')]['id']}})[_0x1301('0x2b')](handleEntityNotFound(_0x37bb58,null))[_0x1301('0x2b')](function(_0x21bed6){if(_0x21bed6){_0x380aa7=_0x21bed6;_0xa3e56b['model']=_[_0x1301('0x35')](db['FreshdeskField'][_0x1301('0x32')]);_0xa3e56b[_0x1301('0x34')]=_[_0x1301('0x35')](_0x205956[_0x1301('0x34')]);_0xa3e56b[_0x1301('0x36')]=_['intersection'](_0xa3e56b[_0x1301('0x38')],_0xa3e56b[_0x1301('0x34')]);_0x133edc[_0x1301('0x3a')]=_[_0x1301('0x37')](_0xa3e56b['model'],qs['fields'](_0x205956[_0x1301('0x34')][_0x1301('0x39')]));_0x133edc[_0x1301('0x3a')]=_0x133edc[_0x1301('0x3a')][_0x1301('0x3b')]?_0x133edc[_0x1301('0x3a')]:_0xa3e56b[_0x1301('0x38')];_0x133edc[_0x1301('0x50')]=qs[_0x1301('0x3d')](_0x205956[_0x1301('0x34')][_0x1301('0x3d')]);_0x133edc[_0x1301('0x3e')]=qs[_0x1301('0x36')](_[_0x1301('0x3f')](_0x205956[_0x1301('0x34')],_0xa3e56b[_0x1301('0x36')]));if(_0x205956['query'][_0x1301('0x40')]){_0x133edc[_0x1301('0x3e')]=_['merge'](_0x133edc[_0x1301('0x3e')],{'$or':_['map'](_0x133edc[_0x1301('0x3a')],function(_0x139ff8){var _0x210191={};_0x210191[_0x139ff8]={'$like':'%'+_0x205956[_0x1301('0x34')]['filter']+'%'};return _0x210191;})});}_0x133edc=_['merge']({},_0x133edc,_0x205956[_0x1301('0x44')]);return _0x380aa7[_0x1301('0x4e')](_0x133edc);}})[_0x1301('0x2b')](function(_0x11e2d8){if(_0x11e2d8){_0x58b51a=_0x11e2d8[_0x1301('0x3b')];if(!_0x205956[_0x1301('0x34')][_0x1301('0x3c')](_0x1301('0x51'))){_0x133edc[_0x1301('0x22')]=qs['limit'](_0x205956[_0x1301('0x34')][_0x1301('0x22')]);_0x133edc[_0x1301('0x24')]=qs['offset'](_0x205956[_0x1301('0x34')][_0x1301('0x24')]);}return _0x380aa7[_0x1301('0x4e')](_0x133edc);}})[_0x1301('0x2b')](function(_0x500d39){if(_0x500d39){return _0x500d39?{'count':_0x58b51a,'rows':_0x500d39}:null;}})[_0x1301('0x2b')](respondWithResult(_0x37bb58,null))[_0x1301('0x48')](handleError(_0x37bb58,null));};exports[_0x1301('0x52')]=function(_0x4ea371,_0x5ab1a0,_0x33bd82){var _0x5b2fae={};var _0xa3511b={};var _0x542e52;var _0x345876;return db['FreshdeskConfiguration'][_0x1301('0x4f')]({'where':{'id':_0x4ea371[_0x1301('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ab1a0,null))[_0x1301('0x2b')](function(_0x49e377){if(_0x49e377){_0x542e52=_0x49e377;_0xa3511b[_0x1301('0x38')]=_['keys'](db['FreshdeskField'][_0x1301('0x32')]);_0xa3511b[_0x1301('0x34')]=_[_0x1301('0x35')](_0x4ea371[_0x1301('0x34')]);_0xa3511b[_0x1301('0x36')]=_[_0x1301('0x37')](_0xa3511b[_0x1301('0x38')],_0xa3511b[_0x1301('0x34')]);_0x5b2fae[_0x1301('0x3a')]=_[_0x1301('0x37')](_0xa3511b[_0x1301('0x38')],qs[_0x1301('0x39')](_0x4ea371[_0x1301('0x34')]['fields']));_0x5b2fae[_0x1301('0x3a')]=_0x5b2fae['attributes'][_0x1301('0x3b')]?_0x5b2fae['attributes']:_0xa3511b['model'];_0x5b2fae[_0x1301('0x50')]=qs['sort'](_0x4ea371[_0x1301('0x34')][_0x1301('0x3d')]);_0x5b2fae[_0x1301('0x3e')]=qs['filters'](_[_0x1301('0x3f')](_0x4ea371[_0x1301('0x34')],_0xa3511b[_0x1301('0x36')]));if(_0x4ea371[_0x1301('0x34')][_0x1301('0x40')]){_0x5b2fae[_0x1301('0x3e')]=_[_0x1301('0x41')](_0x5b2fae['where'],{'$or':_['map'](_0x5b2fae[_0x1301('0x3a')],function(_0x567322){var _0xb04905={};_0xb04905[_0x567322]={'$like':'%'+_0x4ea371[_0x1301('0x34')][_0x1301('0x40')]+'%'};return _0xb04905;})});}_0x5b2fae=_[_0x1301('0x41')]({},_0x5b2fae,_0x4ea371[_0x1301('0x44')]);return _0x542e52[_0x1301('0x52')](_0x5b2fae);}})[_0x1301('0x2b')](function(_0x5a8d90){if(_0x5a8d90){_0x345876=_0x5a8d90[_0x1301('0x3b')];if(!_0x4ea371[_0x1301('0x34')][_0x1301('0x3c')](_0x1301('0x51'))){_0x5b2fae[_0x1301('0x22')]=qs[_0x1301('0x22')](_0x4ea371[_0x1301('0x34')][_0x1301('0x22')]);_0x5b2fae[_0x1301('0x24')]=qs[_0x1301('0x24')](_0x4ea371[_0x1301('0x34')][_0x1301('0x24')]);}return _0x542e52[_0x1301('0x52')](_0x5b2fae);}})['then'](function(_0x4a38df){if(_0x4a38df){return _0x4a38df?{'count':_0x345876,'rows':_0x4a38df}:null;}})[_0x1301('0x2b')](respondWithResult(_0x5ab1a0,null))[_0x1301('0x48')](handleError(_0x5ab1a0,null));};exports[_0x1301('0x53')]=function(_0x35a9f1,_0x1c1d60,_0x24de9c){var _0x53e5a2={};var _0x5efb85={};var _0x3e7a01;var _0x19e8b1;return db[_0x1301('0x31')][_0x1301('0x4f')]({'where':{'id':_0x35a9f1[_0x1301('0x49')]['id']}})[_0x1301('0x2b')](handleEntityNotFound(_0x1c1d60,null))[_0x1301('0x2b')](function(_0x28ad60){if(_0x28ad60){_0x3e7a01=_0x28ad60;_0x5efb85[_0x1301('0x38')]=_[_0x1301('0x35')](db[_0x1301('0x54')][_0x1301('0x32')]);_0x5efb85['query']=_[_0x1301('0x35')](_0x35a9f1[_0x1301('0x34')]);_0x5efb85[_0x1301('0x36')]=_[_0x1301('0x37')](_0x5efb85[_0x1301('0x38')],_0x5efb85['query']);_0x53e5a2[_0x1301('0x3a')]=_[_0x1301('0x37')](_0x5efb85[_0x1301('0x38')],qs[_0x1301('0x39')](_0x35a9f1[_0x1301('0x34')][_0x1301('0x39')]));_0x53e5a2[_0x1301('0x3a')]=_0x53e5a2[_0x1301('0x3a')][_0x1301('0x3b')]?_0x53e5a2[_0x1301('0x3a')]:_0x5efb85[_0x1301('0x38')];_0x53e5a2[_0x1301('0x50')]=qs['sort'](_0x35a9f1[_0x1301('0x34')]['sort']);_0x53e5a2[_0x1301('0x3e')]=qs['filters'](_[_0x1301('0x3f')](_0x35a9f1[_0x1301('0x34')],_0x5efb85[_0x1301('0x36')]));if(_0x35a9f1[_0x1301('0x34')]['filter']){_0x53e5a2[_0x1301('0x3e')]=_[_0x1301('0x41')](_0x53e5a2[_0x1301('0x3e')],{'$or':_[_0x1301('0x30')](_0x53e5a2[_0x1301('0x3a')],function(_0x8689f){var _0x3d4e50={};_0x3d4e50[_0x8689f]={'$like':'%'+_0x35a9f1['query'][_0x1301('0x40')]+'%'};return _0x3d4e50;})});}_0x53e5a2=_[_0x1301('0x41')]({},_0x53e5a2,_0x35a9f1[_0x1301('0x44')]);return _0x3e7a01[_0x1301('0x53')](_0x53e5a2);}})['then'](function(_0x2b9b85){if(_0x2b9b85){_0x19e8b1=_0x2b9b85[_0x1301('0x3b')];if(!_0x35a9f1[_0x1301('0x34')]['hasOwnProperty']('nolimit')){_0x53e5a2['limit']=qs[_0x1301('0x22')](_0x35a9f1[_0x1301('0x34')][_0x1301('0x22')]);_0x53e5a2[_0x1301('0x24')]=qs[_0x1301('0x24')](_0x35a9f1[_0x1301('0x34')][_0x1301('0x24')]);}return _0x3e7a01[_0x1301('0x53')](_0x53e5a2);}})[_0x1301('0x2b')](function(_0x1ae937){if(_0x1ae937){return _0x1ae937?{'count':_0x19e8b1,'rows':_0x1ae937}:null;}})['then'](respondWithResult(_0x1c1d60,null))[_0x1301('0x48')](handleError(_0x1c1d60,null));};exports['getTags']=function(_0x3d9389,_0xcf0f9b,_0x4f5ff6){var _0x51de4d={};var _0x5101c0={};var _0x247eeb;var _0x7d336c;return db[_0x1301('0x31')][_0x1301('0x4f')]({'where':{'id':_0x3d9389[_0x1301('0x49')]['id']}})[_0x1301('0x2b')](handleEntityNotFound(_0xcf0f9b,null))['then'](function(_0x30e48a){if(_0x30e48a){_0x247eeb=_0x30e48a;_0x5101c0[_0x1301('0x38')]=_[_0x1301('0x35')](db[_0x1301('0x55')][_0x1301('0x32')]);_0x5101c0[_0x1301('0x34')]=_[_0x1301('0x35')](_0x3d9389[_0x1301('0x34')]);_0x5101c0[_0x1301('0x36')]=_[_0x1301('0x37')](_0x5101c0[_0x1301('0x38')],_0x5101c0['query']);_0x51de4d['attributes']=_[_0x1301('0x37')](_0x5101c0['model'],qs['fields'](_0x3d9389[_0x1301('0x34')][_0x1301('0x39')]));_0x51de4d[_0x1301('0x3a')]=_0x51de4d[_0x1301('0x3a')]['length']?_0x51de4d[_0x1301('0x3a')]:_0x5101c0[_0x1301('0x38')];_0x51de4d[_0x1301('0x50')]=qs[_0x1301('0x3d')](_0x3d9389[_0x1301('0x34')][_0x1301('0x3d')]);_0x51de4d[_0x1301('0x3e')]=qs[_0x1301('0x36')](_[_0x1301('0x3f')](_0x3d9389[_0x1301('0x34')],_0x5101c0['filters']));if(_0x3d9389[_0x1301('0x34')][_0x1301('0x40')]){_0x51de4d[_0x1301('0x3e')]=_['merge'](_0x51de4d['where'],{'$or':_[_0x1301('0x30')](_0x51de4d[_0x1301('0x3a')],function(_0x2bf958){var _0x3f3182={};_0x3f3182[_0x2bf958]={'$like':'%'+_0x3d9389[_0x1301('0x34')][_0x1301('0x40')]+'%'};return _0x3f3182;})});}_0x51de4d=_[_0x1301('0x41')]({},_0x51de4d,_0x3d9389[_0x1301('0x44')]);return _0x247eeb[_0x1301('0x56')](_0x51de4d);}})[_0x1301('0x2b')](function(_0x59391d){if(_0x59391d){_0x7d336c=_0x59391d[_0x1301('0x3b')];if(!_0x3d9389[_0x1301('0x34')][_0x1301('0x3c')](_0x1301('0x51'))){_0x51de4d['limit']=qs['limit'](_0x3d9389[_0x1301('0x34')][_0x1301('0x22')]);_0x51de4d[_0x1301('0x24')]=qs[_0x1301('0x24')](_0x3d9389[_0x1301('0x34')][_0x1301('0x24')]);}return _0x247eeb[_0x1301('0x56')](_0x51de4d);}})[_0x1301('0x2b')](function(_0x18f794){if(_0x18f794){return _0x18f794?{'count':_0x7d336c,'rows':_0x18f794}:null;}})[_0x1301('0x2b')](respondWithResult(_0xcf0f9b,null))[_0x1301('0x48')](handleError(_0xcf0f9b,null));};exports['setTags']=function(_0x3b3c8c,_0x380ad5,_0x32645e){if(_0x3b3c8c[_0x1301('0x4d')]['id']){delete _0x3b3c8c['body']['id'];}return db[_0x1301('0x31')][_0x1301('0x4f')]({'where':{'id':_0x3b3c8c[_0x1301('0x49')]['id']}})[_0x1301('0x2b')](handleEntityNotFound(_0x380ad5,null))[_0x1301('0x2b')](function(_0x4dea33){if(_0x4dea33){return _0x4dea33[_0x1301('0x57')](_0x3b3c8c[_0x1301('0x4d')]['ids']||[]);}return null;})[_0x1301('0x2b')](respondWithResult(_0x380ad5,null))[_0x1301('0x48')](handleError(_0x380ad5,null));}; \ No newline at end of file +var _0x9b6b=['params','findOne','FreshdeskField','rawAttributes','options','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','include','find','body'];(function(_0x13b974,_0x1dfa8f){var _0x32f044=function(_0x782e65){while(--_0x782e65){_0x13b974['push'](_0x13b974['shift']());}};_0x32f044(++_0x1dfa8f);}(_0x9b6b,0xb2));var _0xb9b6=function(_0x3e95ac,_0x400169){_0x3e95ac=_0x3e95ac-0x0;var _0x5346fd=_0x9b6b[_0x3e95ac];return _0x5346fd;};'use strict';var emlformat=require(_0xb9b6('0x0'));var rimraf=require(_0xb9b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b6('0x2'));var moment=require(_0xb9b6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb9b6('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb9b6('0x5'));var csv=require(_0xb9b6('0x6'));var ejs=require(_0xb9b6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9b6('0x8'));var squel=require('squel');var crypto=require(_0xb9b6('0x9'));var jsforce=require(_0xb9b6('0xa'));var deskjs=require(_0xb9b6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb9b6('0xc'));var Papa=require(_0xb9b6('0xd'));var Redis=require(_0xb9b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9b6('0xf'));var as=require(_0xb9b6('0x10'));var hardwareService=require(_0xb9b6('0x11'));var logger=require(_0xb9b6('0x12'))('api');var utils=require(_0xb9b6('0x13'));var config=require(_0xb9b6('0x14'));var licenseUtil=require(_0xb9b6('0x15'));var db=require(_0xb9b6('0x16'))['db'];function respondWithStatusCode(_0x4c859f,_0x457bf1){_0x457bf1=_0x457bf1||0xcc;return function(_0x423bec){if(_0x423bec){return _0x4c859f[_0xb9b6('0x17')](_0x457bf1);}return _0x4c859f['status'](_0x457bf1)[_0xb9b6('0x18')]();};}function respondWithResult(_0x2a4f33,_0x2bb931){_0x2bb931=_0x2bb931||0xc8;return function(_0x18e37f){if(_0x18e37f){return _0x2a4f33[_0xb9b6('0x19')](_0x2bb931)['json'](_0x18e37f);}};}function respondWithFilteredResult(_0x5ebb85,_0x86860d){return function(_0x53bd3e){if(_0x53bd3e){var _0x6fd5f6=typeof _0x86860d[_0xb9b6('0x1a')]===_0xb9b6('0x1b')&&typeof _0x86860d[_0xb9b6('0x1c')]===_0xb9b6('0x1b');var _0x3ce738=_0x53bd3e['count'];var _0x5010c6=_0x6fd5f6?0x0:_0x86860d['offset'];var _0x28b04f=_0x6fd5f6?_0x53bd3e[_0xb9b6('0x1d')]:_0x86860d[_0xb9b6('0x1a')]+_0x86860d[_0xb9b6('0x1c')];var _0x463f0d;if(_0x28b04f>=_0x3ce738){_0x28b04f=_0x3ce738;_0x463f0d=0xc8;}else{_0x463f0d=0xce;}_0x5ebb85[_0xb9b6('0x19')](_0x463f0d);return _0x5ebb85[_0xb9b6('0x1e')](_0xb9b6('0x1f'),_0x5010c6+'-'+_0x28b04f+'/'+_0x3ce738)[_0xb9b6('0x20')](_0x53bd3e);}return null;};}function patchUpdates(_0x36fcdf){return function(_0x631b04){try{jsonpatch[_0xb9b6('0x21')](_0x631b04,_0x36fcdf,!![]);}catch(_0x206ca1){return BPromise[_0xb9b6('0x22')](_0x206ca1);}return _0x631b04[_0xb9b6('0x23')]();};}function saveUpdates(_0x10df30,_0x1c2875){return function(_0x22b5f1){if(_0x22b5f1){return _0x22b5f1[_0xb9b6('0x24')](_0x10df30)[_0xb9b6('0x25')](function(_0x4ea4b1){return _0x4ea4b1;});}return null;};}function removeEntity(_0x1a518f,_0x3d0b2c){return function(_0x36548a){if(_0x36548a){return _0x36548a[_0xb9b6('0x26')]()[_0xb9b6('0x25')](function(){_0x1a518f[_0xb9b6('0x19')](0xcc)[_0xb9b6('0x18')]();});}};}function handleEntityNotFound(_0x2d8b86,_0x52341d){return function(_0x39d61e){if(!_0x39d61e){_0x2d8b86[_0xb9b6('0x17')](0x194);}return _0x39d61e;};}function handleError(_0x17247c,_0x82ad42){_0x82ad42=_0x82ad42||0x1f4;return function(_0x11e10b){logger[_0xb9b6('0x27')](_0x11e10b[_0xb9b6('0x28')]);if(_0x11e10b['name']){delete _0x11e10b[_0xb9b6('0x29')];}_0x17247c[_0xb9b6('0x19')](_0x82ad42)[_0xb9b6('0x2a')](_0x11e10b);};}exports[_0xb9b6('0x2b')]=function(_0x539145,_0x365d26){var _0x9fb14d={},_0x13defd={},_0x70b33a={'count':0x0,'rows':[]};var _0x2d6e38=_[_0xb9b6('0x2c')](db[_0xb9b6('0x2d')]['rawAttributes'],function(_0x1c380d){return{'name':_0x1c380d[_0xb9b6('0x2e')],'type':_0x1c380d[_0xb9b6('0x2f')]['key']};});_0x13defd[_0xb9b6('0x30')]=_[_0xb9b6('0x2c')](_0x2d6e38,'name');_0x13defd['query']=_[_0xb9b6('0x31')](_0x539145[_0xb9b6('0x32')]);_0x13defd[_0xb9b6('0x33')]=_['intersection'](_0x13defd[_0xb9b6('0x30')],_0x13defd[_0xb9b6('0x32')]);_0x9fb14d[_0xb9b6('0x34')]=_[_0xb9b6('0x35')](_0x13defd[_0xb9b6('0x30')],qs['fields'](_0x539145[_0xb9b6('0x32')][_0xb9b6('0x36')]));_0x9fb14d[_0xb9b6('0x34')]=_0x9fb14d[_0xb9b6('0x34')][_0xb9b6('0x37')]?_0x9fb14d[_0xb9b6('0x34')]:_0x13defd[_0xb9b6('0x30')];if(!_0x539145[_0xb9b6('0x32')][_0xb9b6('0x38')](_0xb9b6('0x39'))){_0x9fb14d[_0xb9b6('0x1c')]=qs[_0xb9b6('0x1c')](_0x539145[_0xb9b6('0x32')]['limit']);_0x9fb14d[_0xb9b6('0x1a')]=qs[_0xb9b6('0x1a')](_0x539145['query'][_0xb9b6('0x1a')]);}_0x9fb14d[_0xb9b6('0x3a')]=qs[_0xb9b6('0x3b')](_0x539145[_0xb9b6('0x32')][_0xb9b6('0x3b')]);_0x9fb14d[_0xb9b6('0x3c')]=qs[_0xb9b6('0x33')](_[_0xb9b6('0x3d')](_0x539145[_0xb9b6('0x32')],_0x13defd['filters']),_0x2d6e38);if(_0x539145[_0xb9b6('0x32')][_0xb9b6('0x3e')]){_0x9fb14d[_0xb9b6('0x3c')]=_[_0xb9b6('0x3f')](_0x9fb14d[_0xb9b6('0x3c')],{'$or':_[_0xb9b6('0x2c')](_0x2d6e38,function(_0x41cfcb){if(_0x41cfcb[_0xb9b6('0x2f')]!==_0xb9b6('0x40')){var _0xd79c7a={};_0xd79c7a[_0x41cfcb[_0xb9b6('0x29')]]={'$like':'%'+_0x539145[_0xb9b6('0x32')][_0xb9b6('0x3e')]+'%'};return _0xd79c7a;}})});}_0x9fb14d=_[_0xb9b6('0x3f')]({},_0x9fb14d,_0x539145['options']);var _0x37e034={'where':_0x9fb14d[_0xb9b6('0x3c')]};return db[_0xb9b6('0x2d')][_0xb9b6('0x1d')](_0x37e034)['then'](function(_0x20411b){_0x70b33a[_0xb9b6('0x1d')]=_0x20411b;if(_0x539145[_0xb9b6('0x32')]['includeAll']){_0x9fb14d['include']=[{'all':!![]}];}return db[_0xb9b6('0x2d')][_0xb9b6('0x41')](_0x9fb14d);})[_0xb9b6('0x25')](function(_0x2eded4){_0x70b33a[_0xb9b6('0x42')]=_0x2eded4;return _0x70b33a;})[_0xb9b6('0x25')](respondWithFilteredResult(_0x365d26,_0x9fb14d))[_0xb9b6('0x43')](handleError(_0x365d26,null));};exports['show']=function(_0x48eca1,_0x5cd5e8){var _0x523d94={'raw':![],'where':{'id':_0x48eca1['params']['id']}},_0x507aa6={};_0x507aa6[_0xb9b6('0x30')]=_[_0xb9b6('0x31')](db[_0xb9b6('0x2d')]['rawAttributes']);_0x507aa6[_0xb9b6('0x32')]=_[_0xb9b6('0x31')](_0x48eca1[_0xb9b6('0x32')]);_0x507aa6[_0xb9b6('0x33')]=_[_0xb9b6('0x35')](_0x507aa6[_0xb9b6('0x30')],_0x507aa6[_0xb9b6('0x32')]);_0x523d94[_0xb9b6('0x34')]=_['intersection'](_0x507aa6[_0xb9b6('0x30')],qs[_0xb9b6('0x36')](_0x48eca1[_0xb9b6('0x32')]['fields']));_0x523d94[_0xb9b6('0x34')]=_0x523d94[_0xb9b6('0x34')]['length']?_0x523d94[_0xb9b6('0x34')]:_0x507aa6[_0xb9b6('0x30')];if(_0x48eca1[_0xb9b6('0x32')]['includeAll']){_0x523d94[_0xb9b6('0x44')]=[{'all':!![]}];}_0x523d94=_[_0xb9b6('0x3f')]({},_0x523d94,_0x48eca1['options']);return db[_0xb9b6('0x2d')][_0xb9b6('0x45')](_0x523d94)[_0xb9b6('0x25')](handleEntityNotFound(_0x5cd5e8,null))[_0xb9b6('0x25')](respondWithResult(_0x5cd5e8,null))['catch'](handleError(_0x5cd5e8,null));};exports['create']=function(_0xfd17e9,_0x5b9340){return db[_0xb9b6('0x2d')]['create'](_0xfd17e9['body'],{})[_0xb9b6('0x25')](respondWithResult(_0x5b9340,0xc9))[_0xb9b6('0x43')](handleError(_0x5b9340,null));};exports[_0xb9b6('0x24')]=function(_0x305b95,_0x516b38){if(_0x305b95['body']['id']){delete _0x305b95[_0xb9b6('0x46')]['id'];}return db[_0xb9b6('0x2d')][_0xb9b6('0x45')]({'where':{'id':_0x305b95[_0xb9b6('0x47')]['id']}})[_0xb9b6('0x25')](handleEntityNotFound(_0x516b38,null))[_0xb9b6('0x25')](saveUpdates(_0x305b95[_0xb9b6('0x46')],null))['then'](respondWithResult(_0x516b38,null))[_0xb9b6('0x43')](handleError(_0x516b38,null));};exports['destroy']=function(_0x4cc3aa,_0x361c24){return db[_0xb9b6('0x2d')][_0xb9b6('0x45')]({'where':{'id':_0x4cc3aa['params']['id']}})[_0xb9b6('0x25')](handleEntityNotFound(_0x361c24,null))[_0xb9b6('0x25')](removeEntity(_0x361c24,null))[_0xb9b6('0x43')](handleError(_0x361c24,null));};exports['getFields']=function(_0x2a9217,_0x45ffb5,_0x7a1b02){var _0x281333={};var _0x157bc6={};var _0x4c617c;var _0x26bad4;return db[_0xb9b6('0x2d')][_0xb9b6('0x48')]({'where':{'id':_0x2a9217[_0xb9b6('0x47')]['id']}})[_0xb9b6('0x25')](handleEntityNotFound(_0x45ffb5,null))[_0xb9b6('0x25')](function(_0x54cdcf){if(_0x54cdcf){_0x4c617c=_0x54cdcf;_0x157bc6[_0xb9b6('0x30')]=_[_0xb9b6('0x31')](db[_0xb9b6('0x49')][_0xb9b6('0x4a')]);_0x157bc6['query']=_[_0xb9b6('0x31')](_0x2a9217[_0xb9b6('0x32')]);_0x157bc6['filters']=_[_0xb9b6('0x35')](_0x157bc6['model'],_0x157bc6['query']);_0x281333[_0xb9b6('0x34')]=_[_0xb9b6('0x35')](_0x157bc6[_0xb9b6('0x30')],qs[_0xb9b6('0x36')](_0x2a9217[_0xb9b6('0x32')][_0xb9b6('0x36')]));_0x281333[_0xb9b6('0x34')]=_0x281333[_0xb9b6('0x34')]['length']?_0x281333['attributes']:_0x157bc6[_0xb9b6('0x30')];_0x281333[_0xb9b6('0x3a')]=qs[_0xb9b6('0x3b')](_0x2a9217[_0xb9b6('0x32')][_0xb9b6('0x3b')]);_0x281333[_0xb9b6('0x3c')]=qs[_0xb9b6('0x33')](_[_0xb9b6('0x3d')](_0x2a9217[_0xb9b6('0x32')],_0x157bc6[_0xb9b6('0x33')]));if(_0x2a9217[_0xb9b6('0x32')][_0xb9b6('0x3e')]){_0x281333[_0xb9b6('0x3c')]=_['merge'](_0x281333[_0xb9b6('0x3c')],{'$or':_[_0xb9b6('0x2c')](_0x281333[_0xb9b6('0x34')],function(_0x5e4574){var _0x375e4b={};_0x375e4b[_0x5e4574]={'$like':'%'+_0x2a9217[_0xb9b6('0x32')]['filter']+'%'};return _0x375e4b;})});}_0x281333=_[_0xb9b6('0x3f')]({},_0x281333,_0x2a9217[_0xb9b6('0x4b')]);return _0x4c617c['getFields'](_0x281333);}})[_0xb9b6('0x25')](function(_0x5f42ea){if(_0x5f42ea){_0x26bad4=_0x5f42ea[_0xb9b6('0x37')];if(!_0x2a9217[_0xb9b6('0x32')]['hasOwnProperty'](_0xb9b6('0x39'))){_0x281333[_0xb9b6('0x1c')]=qs[_0xb9b6('0x1c')](_0x2a9217[_0xb9b6('0x32')][_0xb9b6('0x1c')]);_0x281333[_0xb9b6('0x1a')]=qs[_0xb9b6('0x1a')](_0x2a9217[_0xb9b6('0x32')][_0xb9b6('0x1a')]);}return _0x4c617c[_0xb9b6('0x4c')](_0x281333);}})[_0xb9b6('0x25')](function(_0x1f6aad){if(_0x1f6aad){return _0x1f6aad?{'count':_0x26bad4,'rows':_0x1f6aad}:null;}})[_0xb9b6('0x25')](respondWithResult(_0x45ffb5,null))[_0xb9b6('0x43')](handleError(_0x45ffb5,null));};exports[_0xb9b6('0x4d')]=function(_0x516e3e,_0x488965,_0x40d212){var _0x3f6449={};var _0x2dde0b={};var _0x42c85b;var _0x1bab58;return db[_0xb9b6('0x2d')]['findOne']({'where':{'id':_0x516e3e['params']['id']}})[_0xb9b6('0x25')](handleEntityNotFound(_0x488965,null))[_0xb9b6('0x25')](function(_0x13a42d){if(_0x13a42d){_0x42c85b=_0x13a42d;_0x2dde0b[_0xb9b6('0x30')]=_[_0xb9b6('0x31')](db[_0xb9b6('0x49')][_0xb9b6('0x4a')]);_0x2dde0b[_0xb9b6('0x32')]=_[_0xb9b6('0x31')](_0x516e3e[_0xb9b6('0x32')]);_0x2dde0b[_0xb9b6('0x33')]=_[_0xb9b6('0x35')](_0x2dde0b[_0xb9b6('0x30')],_0x2dde0b[_0xb9b6('0x32')]);_0x3f6449['attributes']=_[_0xb9b6('0x35')](_0x2dde0b[_0xb9b6('0x30')],qs[_0xb9b6('0x36')](_0x516e3e[_0xb9b6('0x32')]['fields']));_0x3f6449[_0xb9b6('0x34')]=_0x3f6449[_0xb9b6('0x34')][_0xb9b6('0x37')]?_0x3f6449['attributes']:_0x2dde0b['model'];_0x3f6449['order']=qs[_0xb9b6('0x3b')](_0x516e3e['query'][_0xb9b6('0x3b')]);_0x3f6449[_0xb9b6('0x3c')]=qs[_0xb9b6('0x33')](_[_0xb9b6('0x3d')](_0x516e3e[_0xb9b6('0x32')],_0x2dde0b['filters']));if(_0x516e3e[_0xb9b6('0x32')][_0xb9b6('0x3e')]){_0x3f6449[_0xb9b6('0x3c')]=_[_0xb9b6('0x3f')](_0x3f6449[_0xb9b6('0x3c')],{'$or':_[_0xb9b6('0x2c')](_0x3f6449[_0xb9b6('0x34')],function(_0x473f54){var _0xf3138d={};_0xf3138d[_0x473f54]={'$like':'%'+_0x516e3e[_0xb9b6('0x32')][_0xb9b6('0x3e')]+'%'};return _0xf3138d;})});}_0x3f6449=_[_0xb9b6('0x3f')]({},_0x3f6449,_0x516e3e['options']);return _0x42c85b[_0xb9b6('0x4d')](_0x3f6449);}})['then'](function(_0x3671ae){if(_0x3671ae){_0x1bab58=_0x3671ae[_0xb9b6('0x37')];if(!_0x516e3e[_0xb9b6('0x32')][_0xb9b6('0x38')](_0xb9b6('0x39'))){_0x3f6449['limit']=qs['limit'](_0x516e3e[_0xb9b6('0x32')][_0xb9b6('0x1c')]);_0x3f6449[_0xb9b6('0x1a')]=qs['offset'](_0x516e3e[_0xb9b6('0x32')]['offset']);}return _0x42c85b[_0xb9b6('0x4d')](_0x3f6449);}})[_0xb9b6('0x25')](function(_0x4d1a26){if(_0x4d1a26){return _0x4d1a26?{'count':_0x1bab58,'rows':_0x4d1a26}:null;}})[_0xb9b6('0x25')](respondWithResult(_0x488965,null))['catch'](handleError(_0x488965,null));};exports['getDescriptions']=function(_0x1a9dc7,_0x67056a,_0x5480f1){var _0x5e453e={};var _0x311265={};var _0x1010d1;var _0x1d7cca;return db['FreshdeskConfiguration'][_0xb9b6('0x48')]({'where':{'id':_0x1a9dc7['params']['id']}})[_0xb9b6('0x25')](handleEntityNotFound(_0x67056a,null))[_0xb9b6('0x25')](function(_0x87d1b3){if(_0x87d1b3){_0x1010d1=_0x87d1b3;_0x311265[_0xb9b6('0x30')]=_['keys'](db[_0xb9b6('0x49')][_0xb9b6('0x4a')]);_0x311265[_0xb9b6('0x32')]=_[_0xb9b6('0x31')](_0x1a9dc7['query']);_0x311265[_0xb9b6('0x33')]=_[_0xb9b6('0x35')](_0x311265['model'],_0x311265['query']);_0x5e453e[_0xb9b6('0x34')]=_[_0xb9b6('0x35')](_0x311265['model'],qs['fields'](_0x1a9dc7[_0xb9b6('0x32')][_0xb9b6('0x36')]));_0x5e453e['attributes']=_0x5e453e['attributes']['length']?_0x5e453e['attributes']:_0x311265[_0xb9b6('0x30')];_0x5e453e[_0xb9b6('0x3a')]=qs[_0xb9b6('0x3b')](_0x1a9dc7[_0xb9b6('0x32')][_0xb9b6('0x3b')]);_0x5e453e[_0xb9b6('0x3c')]=qs[_0xb9b6('0x33')](_[_0xb9b6('0x3d')](_0x1a9dc7[_0xb9b6('0x32')],_0x311265[_0xb9b6('0x33')]));if(_0x1a9dc7[_0xb9b6('0x32')][_0xb9b6('0x3e')]){_0x5e453e['where']=_[_0xb9b6('0x3f')](_0x5e453e[_0xb9b6('0x3c')],{'$or':_['map'](_0x5e453e['attributes'],function(_0x14131b){var _0x4d0288={};_0x4d0288[_0x14131b]={'$like':'%'+_0x1a9dc7[_0xb9b6('0x32')][_0xb9b6('0x3e')]+'%'};return _0x4d0288;})});}_0x5e453e=_[_0xb9b6('0x3f')]({},_0x5e453e,_0x1a9dc7[_0xb9b6('0x4b')]);return _0x1010d1[_0xb9b6('0x4e')](_0x5e453e);}})[_0xb9b6('0x25')](function(_0x167c4e){if(_0x167c4e){_0x1d7cca=_0x167c4e[_0xb9b6('0x37')];if(!_0x1a9dc7[_0xb9b6('0x32')][_0xb9b6('0x38')](_0xb9b6('0x39'))){_0x5e453e['limit']=qs[_0xb9b6('0x1c')](_0x1a9dc7[_0xb9b6('0x32')][_0xb9b6('0x1c')]);_0x5e453e['offset']=qs[_0xb9b6('0x1a')](_0x1a9dc7[_0xb9b6('0x32')][_0xb9b6('0x1a')]);}return _0x1010d1['getDescriptions'](_0x5e453e);}})['then'](function(_0x4d56b6){if(_0x4d56b6){return _0x4d56b6?{'count':_0x1d7cca,'rows':_0x4d56b6}:null;}})[_0xb9b6('0x25')](respondWithResult(_0x67056a,null))[_0xb9b6('0x43')](handleError(_0x67056a,null));};exports[_0xb9b6('0x4f')]=function(_0x4617e1,_0x4fa2d6,_0x3bce71){var _0x4a10b3={};var _0x512677={};var _0x53f462;var _0x221cce;return db['FreshdeskConfiguration'][_0xb9b6('0x48')]({'where':{'id':_0x4617e1[_0xb9b6('0x47')]['id']}})[_0xb9b6('0x25')](handleEntityNotFound(_0x4fa2d6,null))[_0xb9b6('0x25')](function(_0x271bf2){if(_0x271bf2){_0x53f462=_0x271bf2;_0x512677[_0xb9b6('0x30')]=_[_0xb9b6('0x31')](db[_0xb9b6('0x50')]['rawAttributes']);_0x512677[_0xb9b6('0x32')]=_[_0xb9b6('0x31')](_0x4617e1['query']);_0x512677[_0xb9b6('0x33')]=_[_0xb9b6('0x35')](_0x512677[_0xb9b6('0x30')],_0x512677[_0xb9b6('0x32')]);_0x4a10b3[_0xb9b6('0x34')]=_[_0xb9b6('0x35')](_0x512677[_0xb9b6('0x30')],qs[_0xb9b6('0x36')](_0x4617e1[_0xb9b6('0x32')]['fields']));_0x4a10b3[_0xb9b6('0x34')]=_0x4a10b3[_0xb9b6('0x34')][_0xb9b6('0x37')]?_0x4a10b3[_0xb9b6('0x34')]:_0x512677['model'];_0x4a10b3[_0xb9b6('0x3a')]=qs['sort'](_0x4617e1[_0xb9b6('0x32')][_0xb9b6('0x3b')]);_0x4a10b3[_0xb9b6('0x3c')]=qs[_0xb9b6('0x33')](_[_0xb9b6('0x3d')](_0x4617e1[_0xb9b6('0x32')],_0x512677[_0xb9b6('0x33')]));if(_0x4617e1[_0xb9b6('0x32')][_0xb9b6('0x3e')]){_0x4a10b3[_0xb9b6('0x3c')]=_[_0xb9b6('0x3f')](_0x4a10b3[_0xb9b6('0x3c')],{'$or':_[_0xb9b6('0x2c')](_0x4a10b3[_0xb9b6('0x34')],function(_0x48d263){var _0x47e7fc={};_0x47e7fc[_0x48d263]={'$like':'%'+_0x4617e1['query'][_0xb9b6('0x3e')]+'%'};return _0x47e7fc;})});}_0x4a10b3=_[_0xb9b6('0x3f')]({},_0x4a10b3,_0x4617e1[_0xb9b6('0x4b')]);return _0x53f462[_0xb9b6('0x4f')](_0x4a10b3);}})['then'](function(_0x501a42){if(_0x501a42){_0x221cce=_0x501a42['length'];if(!_0x4617e1[_0xb9b6('0x32')]['hasOwnProperty'](_0xb9b6('0x39'))){_0x4a10b3['limit']=qs[_0xb9b6('0x1c')](_0x4617e1['query'][_0xb9b6('0x1c')]);_0x4a10b3[_0xb9b6('0x1a')]=qs['offset'](_0x4617e1[_0xb9b6('0x32')]['offset']);}return _0x53f462[_0xb9b6('0x4f')](_0x4a10b3);}})[_0xb9b6('0x25')](function(_0x2b2708){if(_0x2b2708){return _0x2b2708?{'count':_0x221cce,'rows':_0x2b2708}:null;}})[_0xb9b6('0x25')](respondWithResult(_0x4fa2d6,null))[_0xb9b6('0x43')](handleError(_0x4fa2d6,null));};exports[_0xb9b6('0x51')]=function(_0x515880,_0x2eaa71,_0x266f72){if(_0x515880['body']['id']){delete _0x515880[_0xb9b6('0x46')]['id'];}return db[_0xb9b6('0x2d')][_0xb9b6('0x48')]({'where':{'id':_0x515880[_0xb9b6('0x47')]['id']}})[_0xb9b6('0x25')](handleEntityNotFound(_0x2eaa71,null))['then'](function(_0x3e3ac0){if(_0x3e3ac0){return _0x3e3ac0['setTags'](_0x515880['body'][_0xb9b6('0x52')]||[]);}return null;})[_0xb9b6('0x25')](respondWithResult(_0x2eaa71,null))['catch'](handleError(_0x2eaa71,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 80fe0ce..6604e6b 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 _0x0829=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api','moment','request-promise','rimraf'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x0829,0x12d));var _0x9082=function(_0x16ae6b,_0x39a1a4){_0x16ae6b=_0x16ae6b-0x0;var _0xc63954=_0x0829[_0x16ae6b];return _0xc63954;};'use strict';var _=require(_0x9082('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9082('0x1'));var moment=require(_0x9082('0x2'));var BPromise=require('bluebird');var rp=require(_0x9082('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9082('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x9082('0x5')]=function(_0x4cb72c,_0x9a8c2d){return _0x4cb72c[_0x9082('0x6')](_0x9082('0x7'),attributes,{'tableName':_0x9082('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3869=['api','bluebird','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x44c026,_0x31d7ab){var _0x53e051=function(_0x46fccd){while(--_0x46fccd){_0x44c026['push'](_0x44c026['shift']());}};_0x53e051(++_0x31d7ab);}(_0x3869,0x7f));var _0x9386=function(_0x5a1c85,_0x391fdc){_0x5a1c85=_0x5a1c85-0x0;var _0x1896d8=_0x3869[_0x5a1c85];return _0x1896d8;};'use strict';var _=require(_0x9386('0x0'));var util=require(_0x9386('0x1'));var logger=require(_0x9386('0x2'))(_0x9386('0x3'));var moment=require('moment');var BPromise=require(_0x9386('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9386('0x5'));var rimraf=require(_0x9386('0x6'));var config=require(_0x9386('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x9386('0x8')]=function(_0x16e4be,_0x3b3912){return _0x16e4be[_0x9386('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 38ff14e..a71da4c 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 _0xe78a=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe78a,0x103));var _0xae78=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe78a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xae78('0x0'));var util=require(_0xae78('0x1'));var moment=require('moment');var BPromise=require(_0xae78('0x2'));var rs=require(_0xae78('0x3'));var fs=require('fs');var Redis=require(_0xae78('0x4'));var db=require(_0xae78('0x5'))['db'];var utils=require(_0xae78('0x6'));var logger=require(_0xae78('0x7'))(_0xae78('0x8'));var config=require('../../config/environment');var jayson=require(_0xae78('0x9'));var client=jayson[_0xae78('0xa')][_0xae78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbca8a7,_0x4432cb,_0x3eb4d8){return new BPromise(function(_0x3c6498,_0x3ea2e2){return client[_0xae78('0xc')](_0xbca8a7,_0x3eb4d8)[_0xae78('0xd')](function(_0x524dc9){logger[_0xae78('0xe')](_0xae78('0xf'),_0x4432cb,_0xae78('0x10'));logger[_0xae78('0x11')](_0xae78('0x12'),_0x4432cb,_0xae78('0x10'),JSON[_0xae78('0x13')](_0x524dc9));if(_0x524dc9[_0xae78('0x14')]){if(_0x524dc9[_0xae78('0x14')][_0xae78('0x15')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4432cb,_0x524dc9['error'][_0xae78('0x16')]);return _0x3ea2e2(_0x524dc9[_0xae78('0x14')][_0xae78('0x16')]);}logger['error'](_0xae78('0xf'),_0x4432cb,_0x524dc9[_0xae78('0x14')][_0xae78('0x16')]);return _0x3c6498(_0x524dc9[_0xae78('0x14')]['message']);}else{logger['info'](_0xae78('0xf'),_0x4432cb,_0xae78('0x10'));_0x3c6498(_0x524dc9[_0xae78('0x17')][_0xae78('0x16')]);}})[_0xae78('0x18')](function(_0x3dc6a4){logger['error'](_0xae78('0xf'),_0x4432cb,_0x3dc6a4);_0x3ea2e2(_0x3dc6a4);});});} \ No newline at end of file +var _0xc1b5=['message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc1b5,0xa5));var _0x5c1b=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xc1b5[_0x80d733];return _0x435868;};'use strict';var _=require(_0x5c1b('0x0'));var util=require(_0x5c1b('0x1'));var moment=require(_0x5c1b('0x2'));var BPromise=require(_0x5c1b('0x3'));var rs=require(_0x5c1b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c1b('0x5'))['db'];var utils=require(_0x5c1b('0x6'));var logger=require(_0x5c1b('0x7'))(_0x5c1b('0x8'));var config=require(_0x5c1b('0x9'));var jayson=require(_0x5c1b('0xa'));var client=jayson[_0x5c1b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x221c80,_0x8c36d3,_0x3d62c7){return new BPromise(function(_0x150c1d,_0x31c853){return client['request'](_0x221c80,_0x3d62c7)[_0x5c1b('0xc')](function(_0x4cc1bb){logger[_0x5c1b('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x8c36d3,_0x5c1b('0xe'));logger[_0x5c1b('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x8c36d3,'request\x20sent',JSON[_0x5c1b('0x10')](_0x4cc1bb));if(_0x4cc1bb[_0x5c1b('0x11')]){if(_0x4cc1bb[_0x5c1b('0x11')][_0x5c1b('0x12')]===0x1f4){logger[_0x5c1b('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x8c36d3,_0x4cc1bb[_0x5c1b('0x11')][_0x5c1b('0x13')]);return _0x31c853(_0x4cc1bb[_0x5c1b('0x11')]['message']);}logger[_0x5c1b('0x11')](_0x5c1b('0x14'),_0x8c36d3,_0x4cc1bb['error'][_0x5c1b('0x13')]);return _0x150c1d(_0x4cc1bb['error'][_0x5c1b('0x13')]);}else{logger['info'](_0x5c1b('0x14'),_0x8c36d3,_0x5c1b('0xe'));_0x150c1d(_0x4cc1bb[_0x5c1b('0x15')]['message']);}})[_0x5c1b('0x16')](function(_0x2cd626){logger['error'](_0x5c1b('0x14'),_0x8c36d3,_0x2cd626);_0x31c853(_0x2cd626);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9ed81ce..70912ab 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 _0x94d6=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','multer','util'];(function(_0x474c6f,_0x3415dc){var _0x5e70f9=function(_0x31b88c){while(--_0x31b88c){_0x474c6f['push'](_0x474c6f['shift']());}};_0x5e70f9(++_0x3415dc);}(_0x94d6,0x1d9));var _0x694d=function(_0x261e73,_0x7768f3){_0x261e73=_0x261e73-0x0;var _0x5a1e03=_0x94d6[_0x261e73];return _0x5a1e03;};'use strict';var multer=require(_0x694d('0x0'));var util=require(_0x694d('0x1'));var path=require(_0x694d('0x2'));var timeout=require(_0x694d('0x3'));var express=require(_0x694d('0x4'));var router=express[_0x694d('0x5')]();var fs_extra=require(_0x694d('0x6'));var auth=require(_0x694d('0x7'));var interaction=require(_0x694d('0x8'));var config=require(_0x694d('0x9'));var controller=require('./intFreshdeskField.controller');router[_0x694d('0xa')]('/',auth['isAuthenticated'](),controller[_0x694d('0xb')]);router[_0x694d('0xa')](_0x694d('0xc'),auth[_0x694d('0xd')](),controller['show']);router[_0x694d('0xe')]('/',auth[_0x694d('0xd')](),controller[_0x694d('0xf')]);router[_0x694d('0x10')]('/:id',auth[_0x694d('0xd')](),controller['update']);router[_0x694d('0x11')]('/:id',auth[_0x694d('0xd')](),controller[_0x694d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa7f0=['/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x56894e,_0x267417){var _0x3ab64e=function(_0x467ba8){while(--_0x467ba8){_0x56894e['push'](_0x56894e['shift']());}};_0x3ab64e(++_0x267417);}(_0xa7f0,0x1db));var _0x0a7f=function(_0x2e4490,_0x5d3d11){_0x2e4490=_0x2e4490-0x0;var _0x2b13d=_0xa7f0[_0x2e4490];return _0x2b13d;};'use strict';var multer=require(_0x0a7f('0x0'));var util=require(_0x0a7f('0x1'));var path=require(_0x0a7f('0x2'));var timeout=require(_0x0a7f('0x3'));var express=require(_0x0a7f('0x4'));var router=express[_0x0a7f('0x5')]();var fs_extra=require(_0x0a7f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0a7f('0x7'));var config=require(_0x0a7f('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x0a7f('0x9')]('/',auth[_0x0a7f('0xa')](),controller['index']);router[_0x0a7f('0x9')](_0x0a7f('0xb'),auth['isAuthenticated'](),controller[_0x0a7f('0xc')]);router['post']('/',auth[_0x0a7f('0xa')](),controller[_0x0a7f('0xd')]);router['put'](_0x0a7f('0xb'),auth[_0x0a7f('0xa')](),controller[_0x0a7f('0xe')]);router[_0x0a7f('0xf')](_0x0a7f('0xb'),auth[_0x0a7f('0xa')](),controller[_0x0a7f('0x10')]);module[_0x0a7f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index fe3a6f2..049eb6d 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 _0xbcea=['sequelize','exports','ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xbcea,0x1a7));var _0xabce=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xbcea[_0x2d34d6];return _0x1d3d12;};'use strict';var Sequelize=require(_0xabce('0x0'));module[_0xabce('0x1')]={'type':{'type':Sequelize[_0xabce('0x2')](_0xabce('0x3'),'variable','customVariable',_0xabce('0x4'),'picklist'),'defaultValue':_0xabce('0x3')},'content':{'type':Sequelize[_0xabce('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xabce('0x2')]('string',_0xabce('0x6'),_0xabce('0x7'))},'keyContent':{'type':Sequelize[_0xabce('0x5')]},'idField':{'type':Sequelize[_0xabce('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xabce('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xabce('0x5')]}}; \ No newline at end of file +var _0xbc99=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x489c71,_0x518eca){var _0x22d60c=function(_0x9aa282){while(--_0x9aa282){_0x489c71['push'](_0x489c71['shift']());}};_0x22d60c(++_0x518eca);}(_0xbc99,0x103));var _0x9bc9=function(_0x202357,_0x5f3613){_0x202357=_0x202357-0x0;var _0x9c6167=_0xbc99[_0x202357];return _0x9c6167;};'use strict';var Sequelize=require(_0x9bc9('0x0'));module[_0x9bc9('0x1')]={'type':{'type':Sequelize[_0x9bc9('0x2')](_0x9bc9('0x3'),_0x9bc9('0x4'),_0x9bc9('0x5'),_0x9bc9('0x6'),_0x9bc9('0x7')),'defaultValue':_0x9bc9('0x3')},'content':{'type':Sequelize[_0x9bc9('0x8')]},'key':{'type':Sequelize[_0x9bc9('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x9bc9('0x3'),'variable',_0x9bc9('0x5'))},'keyContent':{'type':Sequelize[_0x9bc9('0x8')]},'idField':{'type':Sequelize[_0x9bc9('0x8')]},'nameField':{'type':Sequelize[_0x9bc9('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9bc9('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c03e5a9..72cd183 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 _0xe28e=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','send','index','map','FreshdeskField','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xe28e,0x1ba));var _0xee28=function(_0x5e56cb,_0x27939b){_0x5e56cb=_0x5e56cb-0x0;var _0x20a1b7=_0xe28e[_0x5e56cb];return _0x20a1b7;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];function respondWithStatusCode(_0x2488cf,_0x267031){_0x267031=_0x267031||0xcc;return function(_0x46e784){if(_0x46e784){return _0x2488cf[_0xee28('0x1a')](_0x267031);}return _0x2488cf['status'](_0x267031)[_0xee28('0x1b')]();};}function respondWithResult(_0x1df69a,_0x555b9c){_0x555b9c=_0x555b9c||0xc8;return function(_0x331b7c){if(_0x331b7c){return _0x1df69a[_0xee28('0x1c')](_0x555b9c)['json'](_0x331b7c);}};}function respondWithFilteredResult(_0x11ac93,_0x17c99a){return function(_0x3d3a5c){if(_0x3d3a5c){var _0x343358=typeof _0x17c99a[_0xee28('0x1d')]===_0xee28('0x1e')&&typeof _0x17c99a['limit']===_0xee28('0x1e');var _0x5de212=_0x3d3a5c[_0xee28('0x1f')];var _0x19472a=_0x343358?0x0:_0x17c99a['offset'];var _0x355b07=_0x343358?_0x3d3a5c['count']:_0x17c99a[_0xee28('0x1d')]+_0x17c99a['limit'];var _0x28da88;if(_0x355b07>=_0x5de212){_0x355b07=_0x5de212;_0x28da88=0xc8;}else{_0x28da88=0xce;}_0x11ac93['status'](_0x28da88);return _0x11ac93[_0xee28('0x20')]('Content-Range',_0x19472a+'-'+_0x355b07+'/'+_0x5de212)[_0xee28('0x21')](_0x3d3a5c);}return null;};}function patchUpdates(_0x2a01ff){return function(_0x96f5db){try{jsonpatch[_0xee28('0x22')](_0x96f5db,_0x2a01ff,!![]);}catch(_0x21ee24){return BPromise[_0xee28('0x23')](_0x21ee24);}return _0x96f5db[_0xee28('0x24')]();};}function saveUpdates(_0x4bda53,_0x342798){return function(_0x44d7ff){if(_0x44d7ff){return _0x44d7ff[_0xee28('0x25')](_0x4bda53)['then'](function(_0x5b500b){return _0x5b500b;});}return null;};}function removeEntity(_0x17d8e4,_0x4a524d){return function(_0x1519ae){if(_0x1519ae){return _0x1519ae[_0xee28('0x26')]()[_0xee28('0x27')](function(){_0x17d8e4[_0xee28('0x1c')](0xcc)[_0xee28('0x1b')]();});}};}function handleEntityNotFound(_0x95d917,_0x2a7c95){return function(_0x733ca8){if(!_0x733ca8){_0x95d917[_0xee28('0x1a')](0x194);}return _0x733ca8;};}function handleError(_0x4ce19b,_0x2c847b){_0x2c847b=_0x2c847b||0x1f4;return function(_0x5b1b1e){logger['error'](_0x5b1b1e['stack']);if(_0x5b1b1e['name']){delete _0x5b1b1e['name'];}_0x4ce19b[_0xee28('0x1c')](_0x2c847b)[_0xee28('0x28')](_0x5b1b1e);};}exports[_0xee28('0x29')]=function(_0x469889,_0x346201){var _0x417840={},_0xbafd67={},_0x4fcc8f={'count':0x0,'rows':[]};var _0x84e0ba=_[_0xee28('0x2a')](db[_0xee28('0x2b')]['rawAttributes'],function(_0x14f7c4){return{'name':_0x14f7c4[_0xee28('0x2c')],'type':_0x14f7c4[_0xee28('0x2d')][_0xee28('0x2e')]};});_0xbafd67[_0xee28('0x2f')]=_[_0xee28('0x2a')](_0x84e0ba,_0xee28('0x30'));_0xbafd67['query']=_[_0xee28('0x31')](_0x469889[_0xee28('0x32')]);_0xbafd67['filters']=_[_0xee28('0x33')](_0xbafd67[_0xee28('0x2f')],_0xbafd67[_0xee28('0x32')]);_0x417840[_0xee28('0x34')]=_[_0xee28('0x33')](_0xbafd67[_0xee28('0x2f')],qs[_0xee28('0x35')](_0x469889['query']['fields']));_0x417840['attributes']=_0x417840[_0xee28('0x34')][_0xee28('0x36')]?_0x417840[_0xee28('0x34')]:_0xbafd67[_0xee28('0x2f')];if(!_0x469889[_0xee28('0x32')][_0xee28('0x37')]('nolimit')){_0x417840[_0xee28('0x38')]=qs[_0xee28('0x38')](_0x469889['query']['limit']);_0x417840[_0xee28('0x1d')]=qs[_0xee28('0x1d')](_0x469889['query']['offset']);}_0x417840[_0xee28('0x39')]=qs[_0xee28('0x3a')](_0x469889['query'][_0xee28('0x3a')]);_0x417840[_0xee28('0x3b')]=qs[_0xee28('0x3c')](_[_0xee28('0x3d')](_0x469889[_0xee28('0x32')],_0xbafd67[_0xee28('0x3c')]),_0x84e0ba);if(_0x469889[_0xee28('0x32')][_0xee28('0x3e')]){_0x417840[_0xee28('0x3b')]=_[_0xee28('0x3f')](_0x417840[_0xee28('0x3b')],{'$or':_[_0xee28('0x2a')](_0x84e0ba,function(_0x486d55){if(_0x486d55[_0xee28('0x2d')]!=='VIRTUAL'){var _0x4b0b75={};_0x4b0b75[_0x486d55[_0xee28('0x30')]]={'$like':'%'+_0x469889['query'][_0xee28('0x3e')]+'%'};return _0x4b0b75;}})});}_0x417840=_['merge']({},_0x417840,_0x469889[_0xee28('0x40')]);var _0x4d096c={'where':_0x417840[_0xee28('0x3b')]};return db[_0xee28('0x2b')][_0xee28('0x1f')](_0x4d096c)[_0xee28('0x27')](function(_0x58ebb5){_0x4fcc8f[_0xee28('0x1f')]=_0x58ebb5;if(_0x469889['query'][_0xee28('0x41')]){_0x417840[_0xee28('0x42')]=[{'all':!![]}];}return db[_0xee28('0x2b')][_0xee28('0x43')](_0x417840);})[_0xee28('0x27')](function(_0x2e046e){_0x4fcc8f[_0xee28('0x44')]=_0x2e046e;return _0x4fcc8f;})['then'](respondWithFilteredResult(_0x346201,_0x417840))['catch'](handleError(_0x346201,null));};exports[_0xee28('0x45')]=function(_0x5c710d,_0x52b666){var _0x4064cf={'raw':!![],'where':{'id':_0x5c710d['params']['id']}},_0x14bd8d={};_0x14bd8d[_0xee28('0x2f')]=_[_0xee28('0x31')](db[_0xee28('0x2b')][_0xee28('0x46')]);_0x14bd8d[_0xee28('0x32')]=_[_0xee28('0x31')](_0x5c710d[_0xee28('0x32')]);_0x14bd8d['filters']=_[_0xee28('0x33')](_0x14bd8d[_0xee28('0x2f')],_0x14bd8d[_0xee28('0x32')]);_0x4064cf[_0xee28('0x34')]=_[_0xee28('0x33')](_0x14bd8d['model'],qs[_0xee28('0x35')](_0x5c710d[_0xee28('0x32')]['fields']));_0x4064cf[_0xee28('0x34')]=_0x4064cf[_0xee28('0x34')][_0xee28('0x36')]?_0x4064cf[_0xee28('0x34')]:_0x14bd8d[_0xee28('0x2f')];if(_0x5c710d[_0xee28('0x32')]['includeAll']){_0x4064cf[_0xee28('0x42')]=[{'all':!![]}];}_0x4064cf=_['merge']({},_0x4064cf,_0x5c710d['options']);return db[_0xee28('0x2b')][_0xee28('0x47')](_0x4064cf)['then'](handleEntityNotFound(_0x52b666,null))[_0xee28('0x27')](respondWithResult(_0x52b666,null))[_0xee28('0x48')](handleError(_0x52b666,null));};exports[_0xee28('0x49')]=function(_0x5d07ed,_0x57e57e){return db[_0xee28('0x2b')][_0xee28('0x49')](_0x5d07ed[_0xee28('0x4a')],{})[_0xee28('0x27')](respondWithResult(_0x57e57e,0xc9))[_0xee28('0x48')](handleError(_0x57e57e,null));};exports[_0xee28('0x25')]=function(_0x2574c5,_0x2b5f36){if(_0x2574c5[_0xee28('0x4a')]['id']){delete _0x2574c5[_0xee28('0x4a')]['id'];}return db['FreshdeskField'][_0xee28('0x47')]({'where':{'id':_0x2574c5['params']['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x2b5f36,null))[_0xee28('0x27')](saveUpdates(_0x2574c5[_0xee28('0x4a')],null))[_0xee28('0x27')](respondWithResult(_0x2b5f36,null))[_0xee28('0x48')](handleError(_0x2b5f36,null));};exports['destroy']=function(_0x5247fe,_0x5ca018){return db[_0xee28('0x2b')]['find']({'where':{'id':_0x5247fe['params']['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x5ca018,null))['then'](removeEntity(_0x5ca018,null))[_0xee28('0x48')](handleError(_0x5ca018,null));}; \ No newline at end of file +var _0x3a25=['end','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0xbee361,_0x432722){var _0x205692=function(_0x3d0fe4){while(--_0x3d0fe4){_0xbee361['push'](_0xbee361['shift']());}};_0x205692(++_0x432722);}(_0x3a25,0x15d));var _0x53a2=function(_0x3a6b61,_0x52def1){_0x3a6b61=_0x3a6b61-0x0;var _0x46ef2e=_0x3a25[_0x3a6b61];return _0x46ef2e;};'use strict';var emlformat=require(_0x53a2('0x0'));var rimraf=require(_0x53a2('0x1'));var zipdir=require(_0x53a2('0x2'));var jsonpatch=require(_0x53a2('0x3'));var rp=require(_0x53a2('0x4'));var moment=require(_0x53a2('0x5'));var BPromise=require(_0x53a2('0x6'));var Mustache=require(_0x53a2('0x7'));var util=require(_0x53a2('0x8'));var path=require(_0x53a2('0x9'));var sox=require(_0x53a2('0xa'));var csv=require(_0x53a2('0xb'));var ejs=require(_0x53a2('0xc'));var fs=require('fs');var fs_extra=require(_0x53a2('0xd'));var _=require(_0x53a2('0xe'));var squel=require('squel');var crypto=require(_0x53a2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x53a2('0x10'));var toCsv=require(_0x53a2('0xb'));var querystring=require(_0x53a2('0x11'));var Papa=require(_0x53a2('0x12'));var Redis=require(_0x53a2('0x13'));var authService=require(_0x53a2('0x14'));var qs=require(_0x53a2('0x15'));var as=require(_0x53a2('0x16'));var hardwareService=require(_0x53a2('0x17'));var logger=require(_0x53a2('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x53a2('0x19'));var licenseUtil=require(_0x53a2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x564ca9,_0x47881a){_0x47881a=_0x47881a||0xcc;return function(_0x410370){if(_0x410370){return _0x564ca9[_0x53a2('0x1b')](_0x47881a);}return _0x564ca9[_0x53a2('0x1c')](_0x47881a)['end']();};}function respondWithResult(_0x58070c,_0x4e2228){_0x4e2228=_0x4e2228||0xc8;return function(_0x9c14b7){if(_0x9c14b7){return _0x58070c[_0x53a2('0x1c')](_0x4e2228)[_0x53a2('0x1d')](_0x9c14b7);}};}function respondWithFilteredResult(_0xf9b589,_0x4d3a40){return function(_0x1779ef){if(_0x1779ef){var _0x3343d3=typeof _0x4d3a40[_0x53a2('0x1e')]===_0x53a2('0x1f')&&typeof _0x4d3a40[_0x53a2('0x20')]==='undefined';var _0x485c4d=_0x1779ef[_0x53a2('0x21')];var _0x446b71=_0x3343d3?0x0:_0x4d3a40[_0x53a2('0x1e')];var _0x104fb6=_0x3343d3?_0x1779ef[_0x53a2('0x21')]:_0x4d3a40[_0x53a2('0x1e')]+_0x4d3a40['limit'];var _0x589666;if(_0x104fb6>=_0x485c4d){_0x104fb6=_0x485c4d;_0x589666=0xc8;}else{_0x589666=0xce;}_0xf9b589[_0x53a2('0x1c')](_0x589666);return _0xf9b589[_0x53a2('0x22')]('Content-Range',_0x446b71+'-'+_0x104fb6+'/'+_0x485c4d)[_0x53a2('0x1d')](_0x1779ef);}return null;};}function patchUpdates(_0x3fb15b){return function(_0x3efc90){try{jsonpatch[_0x53a2('0x23')](_0x3efc90,_0x3fb15b,!![]);}catch(_0x503e9b){return BPromise[_0x53a2('0x24')](_0x503e9b);}return _0x3efc90[_0x53a2('0x25')]();};}function saveUpdates(_0xd9693c,_0x2cda68){return function(_0x42df19){if(_0x42df19){return _0x42df19[_0x53a2('0x26')](_0xd9693c)[_0x53a2('0x27')](function(_0x3a769d){return _0x3a769d;});}return null;};}function removeEntity(_0x4a1a34,_0x579b10){return function(_0x473042){if(_0x473042){return _0x473042[_0x53a2('0x28')]()[_0x53a2('0x27')](function(){_0x4a1a34[_0x53a2('0x1c')](0xcc)[_0x53a2('0x29')]();});}};}function handleEntityNotFound(_0xa39167,_0x4b26a8){return function(_0x2dfa00){if(!_0x2dfa00){_0xa39167[_0x53a2('0x1b')](0x194);}return _0x2dfa00;};}function handleError(_0x111420,_0x397340){_0x397340=_0x397340||0x1f4;return function(_0x323c8a){logger[_0x53a2('0x2a')](_0x323c8a[_0x53a2('0x2b')]);if(_0x323c8a[_0x53a2('0x2c')]){delete _0x323c8a[_0x53a2('0x2c')];}_0x111420[_0x53a2('0x1c')](_0x397340)[_0x53a2('0x2d')](_0x323c8a);};}exports[_0x53a2('0x2e')]=function(_0x262eba,_0x469b0f){var _0x2a6428={},_0xf12019={},_0x437916={'count':0x0,'rows':[]};var _0x5a84de=_[_0x53a2('0x2f')](db[_0x53a2('0x30')][_0x53a2('0x31')],function(_0x23374b){return{'name':_0x23374b[_0x53a2('0x32')],'type':_0x23374b[_0x53a2('0x33')][_0x53a2('0x34')]};});_0xf12019[_0x53a2('0x35')]=_[_0x53a2('0x2f')](_0x5a84de,_0x53a2('0x2c'));_0xf12019[_0x53a2('0x36')]=_['keys'](_0x262eba[_0x53a2('0x36')]);_0xf12019[_0x53a2('0x37')]=_[_0x53a2('0x38')](_0xf12019[_0x53a2('0x35')],_0xf12019[_0x53a2('0x36')]);_0x2a6428[_0x53a2('0x39')]=_[_0x53a2('0x38')](_0xf12019[_0x53a2('0x35')],qs['fields'](_0x262eba[_0x53a2('0x36')][_0x53a2('0x3a')]));_0x2a6428[_0x53a2('0x39')]=_0x2a6428[_0x53a2('0x39')]['length']?_0x2a6428[_0x53a2('0x39')]:_0xf12019[_0x53a2('0x35')];if(!_0x262eba[_0x53a2('0x36')][_0x53a2('0x3b')](_0x53a2('0x3c'))){_0x2a6428[_0x53a2('0x20')]=qs['limit'](_0x262eba[_0x53a2('0x36')][_0x53a2('0x20')]);_0x2a6428[_0x53a2('0x1e')]=qs['offset'](_0x262eba[_0x53a2('0x36')]['offset']);}_0x2a6428[_0x53a2('0x3d')]=qs[_0x53a2('0x3e')](_0x262eba[_0x53a2('0x36')]['sort']);_0x2a6428['where']=qs[_0x53a2('0x37')](_['pick'](_0x262eba[_0x53a2('0x36')],_0xf12019[_0x53a2('0x37')]),_0x5a84de);if(_0x262eba[_0x53a2('0x36')][_0x53a2('0x3f')]){_0x2a6428[_0x53a2('0x40')]=_[_0x53a2('0x41')](_0x2a6428['where'],{'$or':_[_0x53a2('0x2f')](_0x5a84de,function(_0x1252ee){if(_0x1252ee['type']!=='VIRTUAL'){var _0x31e0b1={};_0x31e0b1[_0x1252ee['name']]={'$like':'%'+_0x262eba[_0x53a2('0x36')][_0x53a2('0x3f')]+'%'};return _0x31e0b1;}})});}_0x2a6428=_['merge']({},_0x2a6428,_0x262eba[_0x53a2('0x42')]);var _0x19d28e={'where':_0x2a6428[_0x53a2('0x40')]};return db[_0x53a2('0x30')][_0x53a2('0x21')](_0x19d28e)['then'](function(_0xf02fa){_0x437916[_0x53a2('0x21')]=_0xf02fa;if(_0x262eba['query'][_0x53a2('0x43')]){_0x2a6428[_0x53a2('0x44')]=[{'all':!![]}];}return db['FreshdeskField'][_0x53a2('0x45')](_0x2a6428);})['then'](function(_0xd5bcc8){_0x437916[_0x53a2('0x46')]=_0xd5bcc8;return _0x437916;})[_0x53a2('0x27')](respondWithFilteredResult(_0x469b0f,_0x2a6428))[_0x53a2('0x47')](handleError(_0x469b0f,null));};exports[_0x53a2('0x48')]=function(_0x1aa002,_0x524b6a){var _0x71a339={'raw':!![],'where':{'id':_0x1aa002[_0x53a2('0x49')]['id']}},_0x33238d={};_0x33238d[_0x53a2('0x35')]=_[_0x53a2('0x4a')](db[_0x53a2('0x30')][_0x53a2('0x31')]);_0x33238d[_0x53a2('0x36')]=_[_0x53a2('0x4a')](_0x1aa002[_0x53a2('0x36')]);_0x33238d[_0x53a2('0x37')]=_[_0x53a2('0x38')](_0x33238d[_0x53a2('0x35')],_0x33238d[_0x53a2('0x36')]);_0x71a339[_0x53a2('0x39')]=_[_0x53a2('0x38')](_0x33238d['model'],qs[_0x53a2('0x3a')](_0x1aa002[_0x53a2('0x36')]['fields']));_0x71a339['attributes']=_0x71a339[_0x53a2('0x39')]['length']?_0x71a339['attributes']:_0x33238d[_0x53a2('0x35')];if(_0x1aa002[_0x53a2('0x36')][_0x53a2('0x43')]){_0x71a339[_0x53a2('0x44')]=[{'all':!![]}];}_0x71a339=_['merge']({},_0x71a339,_0x1aa002['options']);return db['FreshdeskField'][_0x53a2('0x4b')](_0x71a339)['then'](handleEntityNotFound(_0x524b6a,null))['then'](respondWithResult(_0x524b6a,null))[_0x53a2('0x47')](handleError(_0x524b6a,null));};exports[_0x53a2('0x4c')]=function(_0x3a384e,_0x32a6fd){return db[_0x53a2('0x30')]['create'](_0x3a384e[_0x53a2('0x4d')],{})['then'](respondWithResult(_0x32a6fd,0xc9))[_0x53a2('0x47')](handleError(_0x32a6fd,null));};exports[_0x53a2('0x26')]=function(_0x5baa46,_0x35fb2b){if(_0x5baa46[_0x53a2('0x4d')]['id']){delete _0x5baa46[_0x53a2('0x4d')]['id'];}return db[_0x53a2('0x30')][_0x53a2('0x4b')]({'where':{'id':_0x5baa46[_0x53a2('0x49')]['id']}})[_0x53a2('0x27')](handleEntityNotFound(_0x35fb2b,null))['then'](saveUpdates(_0x5baa46[_0x53a2('0x4d')],null))[_0x53a2('0x27')](respondWithResult(_0x35fb2b,null))[_0x53a2('0x47')](handleError(_0x35fb2b,null));};exports['destroy']=function(_0x36df41,_0x71dbbf){return db[_0x53a2('0x30')][_0x53a2('0x4b')]({'where':{'id':_0x36df41[_0x53a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x71dbbf,null))['then'](removeEntity(_0x71dbbf,null))[_0x53a2('0x47')](handleError(_0x71dbbf,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index aa4e4f9..777e6a5 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 _0x2a23=['int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x2a23,0x65));var _0x32a2=function(_0x5f3931,_0x4da275){_0x5f3931=_0x5f3931-0x0;var _0x3d04aa=_0x2a23[_0x5f3931];return _0x3d04aa;};'use strict';var _=require(_0x32a2('0x0'));var util=require(_0x32a2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x32a2('0x2'));var BPromise=require(_0x32a2('0x3'));var rp=require(_0x32a2('0x4'));var fs=require('fs');var path=require(_0x32a2('0x5'));var rimraf=require(_0x32a2('0x6'));var config=require(_0x32a2('0x7'));var attributes=require(_0x32a2('0x8'));module['exports']=function(_0x257225,_0x212957){return _0x257225[_0x32a2('0x9')](_0x32a2('0xa'),attributes,{'tableName':_0x32a2('0xb'),'paranoid':![],'indexes':[{'name':_0x32a2('0xc'),'fields':[_0x32a2('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1a2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util'];(function(_0x2aad8,_0x29c47d){var _0x507c68=function(_0x10204f){while(--_0x10204f){_0x2aad8['push'](_0x2aad8['shift']());}};_0x507c68(++_0x29c47d);}(_0xa1a2,0x76));var _0x2a1a=function(_0x111c68,_0x45ff65){_0x111c68=_0x111c68-0x0;var _0x50f5bb=_0xa1a2[_0x111c68];return _0x50f5bb;};'use strict';var _=require(_0x2a1a('0x0'));var util=require(_0x2a1a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2a1a('0x2'));var BPromise=require(_0x2a1a('0x3'));var rp=require(_0x2a1a('0x4'));var fs=require('fs');var path=require(_0x2a1a('0x5'));var rimraf=require(_0x2a1a('0x6'));var config=require(_0x2a1a('0x7'));var attributes=require(_0x2a1a('0x8'));module[_0x2a1a('0x9')]=function(_0x1b62e7,_0x2cd28d){return _0x1b62e7[_0x2a1a('0xa')](_0x2a1a('0xb'),attributes,{'tableName':_0x2a1a('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x2a1a('0xd'),_0x2a1a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 4d30b29..1e60fb6 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 _0x50ad=['request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','FreshdeskField,\x20%s,\x20%s'];(function(_0x5a0870,_0x250f6e){var _0x190c8d=function(_0xe52cc7){while(--_0xe52cc7){_0x5a0870['push'](_0x5a0870['shift']());}};_0x190c8d(++_0x250f6e);}(_0x50ad,0xf0));var _0xd50a=function(_0x3ad1aa,_0x1e5418){_0x3ad1aa=_0x3ad1aa-0x0;var _0x535c08=_0x50ad[_0x3ad1aa];return _0x535c08;};'use strict';var _=require('lodash');var util=require(_0xd50a('0x0'));var moment=require(_0xd50a('0x1'));var BPromise=require(_0xd50a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd50a('0x3'));var db=require(_0xd50a('0x4'))['db'];var utils=require(_0xd50a('0x5'));var logger=require(_0xd50a('0x6'))(_0xd50a('0x7'));var config=require(_0xd50a('0x8'));var jayson=require(_0xd50a('0x9'));var client=jayson[_0xd50a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3693e2,_0x241ed0,_0x4e2b2b){return new BPromise(function(_0x581306,_0xd8e24c){return client['request'](_0x3693e2,_0x4e2b2b)['then'](function(_0x1bdf7d){logger['info'](_0xd50a('0xb'),_0x241ed0,_0xd50a('0xc'));logger[_0xd50a('0xd')](_0xd50a('0xe'),_0x241ed0,_0xd50a('0xc'),JSON[_0xd50a('0xf')](_0x1bdf7d));if(_0x1bdf7d[_0xd50a('0x10')]){if(_0x1bdf7d[_0xd50a('0x10')]['code']===0x1f4){logger['error'](_0xd50a('0xb'),_0x241ed0,_0x1bdf7d[_0xd50a('0x10')][_0xd50a('0x11')]);return _0xd8e24c(_0x1bdf7d[_0xd50a('0x10')][_0xd50a('0x11')]);}logger['error'](_0xd50a('0xb'),_0x241ed0,_0x1bdf7d[_0xd50a('0x10')][_0xd50a('0x11')]);return _0x581306(_0x1bdf7d['error']['message']);}else{logger[_0xd50a('0x12')](_0xd50a('0xb'),_0x241ed0,_0xd50a('0xc'));_0x581306(_0x1bdf7d[_0xd50a('0x13')]['message']);}})[_0xd50a('0x14')](function(_0x2c715d){logger[_0xd50a('0x10')](_0xd50a('0xb'),_0x241ed0,_0x2c715d);_0xd8e24c(_0x2c715d);});});} \ No newline at end of file +var _0x0d88=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x0d88,0x92));var _0x80d8=function(_0x59f2e4,_0xabb0f3){_0x59f2e4=_0x59f2e4-0x0;var _0x33ad50=_0x0d88[_0x59f2e4];return _0x33ad50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x80d8('0x0'));var BPromise=require(_0x80d8('0x1'));var rs=require(_0x80d8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80d8('0x3'))['db'];var utils=require(_0x80d8('0x4'));var logger=require(_0x80d8('0x5'))(_0x80d8('0x6'));var config=require(_0x80d8('0x7'));var jayson=require(_0x80d8('0x8'));var client=jayson[_0x80d8('0x9')][_0x80d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f418f,_0x2032fa,_0x5b6881){return new BPromise(function(_0x5f1051,_0x4ee96a){return client[_0x80d8('0xb')](_0x3f418f,_0x5b6881)['then'](function(_0x38efe1){logger['info'](_0x80d8('0xc'),_0x2032fa,_0x80d8('0xd'));logger[_0x80d8('0xe')](_0x80d8('0xf'),_0x2032fa,'request\x20sent',JSON[_0x80d8('0x10')](_0x38efe1));if(_0x38efe1[_0x80d8('0x11')]){if(_0x38efe1[_0x80d8('0x11')][_0x80d8('0x12')]===0x1f4){logger[_0x80d8('0x11')](_0x80d8('0xc'),_0x2032fa,_0x38efe1[_0x80d8('0x11')][_0x80d8('0x13')]);return _0x4ee96a(_0x38efe1[_0x80d8('0x11')][_0x80d8('0x13')]);}logger[_0x80d8('0x11')](_0x80d8('0xc'),_0x2032fa,_0x38efe1[_0x80d8('0x11')][_0x80d8('0x13')]);return _0x5f1051(_0x38efe1[_0x80d8('0x11')][_0x80d8('0x13')]);}else{logger[_0x80d8('0x14')](_0x80d8('0xc'),_0x2032fa,_0x80d8('0xd'));_0x5f1051(_0x38efe1[_0x80d8('0x15')][_0x80d8('0x13')]);}})[_0x80d8('0x16')](function(_0x58a1c4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2032fa,_0x58a1c4);_0x4ee96a(_0x58a1c4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 707d7d3..9ae409b 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 _0xf45e=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','destroy'];(function(_0x49c049,_0x4bcc9c){var _0x38d57c=function(_0xe859b9){while(--_0xe859b9){_0x49c049['push'](_0x49c049['shift']());}};_0x38d57c(++_0x4bcc9c);}(_0xf45e,0x115));var _0xef45=function(_0x3556a4,_0x8fb37a){_0x3556a4=_0x3556a4-0x0;var _0x6d774d=_0xf45e[_0x3556a4];return _0x6d774d;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/fields',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0x12')]);router[_0xef45('0x11')]('/:id/configurations',auth[_0xef45('0xa')](),controller[_0xef45('0x13')]);router[_0xef45('0x14')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller['update']);router['delete'](_0xef45('0xc'),auth['isAuthenticated'](),controller[_0xef45('0x15')]);module[_0xef45('0x16')]=router; \ No newline at end of file +var _0xc788=['getConfigurations','post','addConfiguration','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x101d8f,_0x43aea0){var _0xd9dc2=function(_0x4169b8){while(--_0x4169b8){_0x101d8f['push'](_0x101d8f['shift']());}};_0xd9dc2(++_0x43aea0);}(_0xc788,0xc4));var _0x8c78=function(_0x46cb35,_0x2b92ab){_0x46cb35=_0x46cb35-0x0;var _0x847507=_0xc788[_0x46cb35];return _0x847507;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/fields',auth[_0x8c78('0x9')](),controller['getFields']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),controller['create']);router[_0x8c78('0xf')](_0x8c78('0xd'),auth['isAuthenticated'](),controller[_0x8c78('0x10')]);router['put']('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x11')]);router[_0x8c78('0x12')](_0x8c78('0xb'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x13')]);module[_0x8c78('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9cde0b6..9c7841a 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 _0x2272=['sequelize','exports','STRING','remoteUri'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'name':{'type':Sequelize[_0x2227('0x2')]},'description':{'type':Sequelize[_0x2227('0x2')]},'username':{'type':Sequelize[_0x2227('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2227('0x2')]},'remoteUri':{'type':Sequelize[_0x2227('0x2')],'unique':_0x2227('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdf55=['exports','STRING','remoteUri','sequelize'];(function(_0x545f76,_0x2c1a8f){var _0x5bafc2=function(_0x42a183){while(--_0x42a183){_0x545f76['push'](_0x545f76['shift']());}};_0x5bafc2(++_0x2c1a8f);}(_0xdf55,0x83));var _0x5df5=function(_0x23945f,_0x9d3e4e){_0x23945f=_0x23945f-0x0;var _0xa38592=_0xdf55[_0x23945f];return _0xa38592;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5df5('0x2')]},'username':{'type':Sequelize[_0x5df5('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x5df5('0x2')]},'remoteUri':{'type':Sequelize[_0x5df5('0x2')],'unique':_0x5df5('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 634b94b..64f7627 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 _0x3cc5=['query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','fields','length','includeAll','include','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys'];(function(_0x4ba627,_0x3f3404){var _0x5b7746=function(_0x20a32f){while(--_0x20a32f){_0x4ba627['push'](_0x4ba627['shift']());}};_0x5b7746(++_0x3f3404);}(_0x3cc5,0x169));var _0x53cc=function(_0x397eb2,_0x3a92f1){_0x397eb2=_0x397eb2-0x0;var _0x183633=_0x3cc5[_0x397eb2];return _0x183633;};'use strict';var emlformat=require(_0x53cc('0x0'));var rimraf=require(_0x53cc('0x1'));var zipdir=require(_0x53cc('0x2'));var jsonpatch=require(_0x53cc('0x3'));var rp=require(_0x53cc('0x4'));var moment=require(_0x53cc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x53cc('0x6'));var util=require(_0x53cc('0x7'));var path=require(_0x53cc('0x8'));var sox=require(_0x53cc('0x9'));var csv=require(_0x53cc('0xa'));var ejs=require(_0x53cc('0xb'));var fs=require('fs');var fs_extra=require(_0x53cc('0xc'));var _=require(_0x53cc('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x53cc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x53cc('0xa'));var querystring=require(_0x53cc('0xf'));var Papa=require(_0x53cc('0x10'));var Redis=require(_0x53cc('0x11'));var authService=require(_0x53cc('0x12'));var qs=require(_0x53cc('0x13'));var as=require(_0x53cc('0x14'));var hardwareService=require(_0x53cc('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x53cc('0x16'));var config=require(_0x53cc('0x17'));var licenseUtil=require(_0x53cc('0x18'));var db=require(_0x53cc('0x19'))['db'];var integrations=require(_0x53cc('0x1a'));function respondWithStatusCode(_0x5e74f4,_0x3aa91b){_0x3aa91b=_0x3aa91b||0xcc;return function(_0x26b509){if(_0x26b509){return _0x5e74f4[_0x53cc('0x1b')](_0x3aa91b);}return _0x5e74f4[_0x53cc('0x1c')](_0x3aa91b)['end']();};}function respondWithResult(_0x3f6c72,_0x5f36db){_0x5f36db=_0x5f36db||0xc8;return function(_0x4b1405){if(_0x4b1405){return _0x3f6c72['status'](_0x5f36db)[_0x53cc('0x1d')](_0x4b1405);}};}function respondWithFilteredResult(_0x300cfc,_0xeef3f7){return function(_0x25842c){if(_0x25842c){var _0x273080=typeof _0xeef3f7[_0x53cc('0x1e')]===_0x53cc('0x1f')&&typeof _0xeef3f7['limit']===_0x53cc('0x1f');var _0x9a0d2=_0x25842c[_0x53cc('0x20')];var _0x528b8c=_0x273080?0x0:_0xeef3f7['offset'];var _0x4c2b91=_0x273080?_0x25842c[_0x53cc('0x20')]:_0xeef3f7['offset']+_0xeef3f7[_0x53cc('0x21')];var _0x4fe077;if(_0x4c2b91>=_0x9a0d2){_0x4c2b91=_0x9a0d2;_0x4fe077=0xc8;}else{_0x4fe077=0xce;}_0x300cfc[_0x53cc('0x1c')](_0x4fe077);return _0x300cfc['set'](_0x53cc('0x22'),_0x528b8c+'-'+_0x4c2b91+'/'+_0x9a0d2)[_0x53cc('0x1d')](_0x25842c);}return null;};}function patchUpdates(_0x10af6d){return function(_0x2b9205){try{jsonpatch[_0x53cc('0x23')](_0x2b9205,_0x10af6d,!![]);}catch(_0x2c8f80){return BPromise[_0x53cc('0x24')](_0x2c8f80);}return _0x2b9205[_0x53cc('0x25')]();};}function saveUpdates(_0x3cc312,_0x662160){return function(_0x4bffa0){if(_0x4bffa0){return _0x4bffa0[_0x53cc('0x26')](_0x3cc312)[_0x53cc('0x27')](function(_0x5a7c80){return _0x5a7c80;});}return null;};}function removeEntity(_0x38c825,_0x4aafcf){return function(_0x9e702){if(_0x9e702){return _0x9e702[_0x53cc('0x28')]()[_0x53cc('0x27')](function(){_0x38c825[_0x53cc('0x1c')](0xcc)[_0x53cc('0x29')]();});}};}function handleEntityNotFound(_0x398b18,_0x39a7ff){return function(_0x30b217){if(!_0x30b217){_0x398b18['sendStatus'](0x194);}return _0x30b217;};}function handleError(_0x55a8c4,_0x38cbee){_0x38cbee=_0x38cbee||0x1f4;return function(_0x42b458){logger[_0x53cc('0x2a')](_0x42b458[_0x53cc('0x2b')]);if(_0x42b458[_0x53cc('0x2c')]){delete _0x42b458[_0x53cc('0x2c')];}_0x55a8c4[_0x53cc('0x1c')](_0x38cbee)[_0x53cc('0x2d')](_0x42b458);};}exports[_0x53cc('0x2e')]=function(_0x3f8f7e,_0x1f2193){var _0xcae511={},_0x439c30={},_0x4e565c={'count':0x0,'rows':[]};var _0x37a2f8=_[_0x53cc('0x2f')](db[_0x53cc('0x30')][_0x53cc('0x31')],function(_0x5d1ebd){return{'name':_0x5d1ebd[_0x53cc('0x32')],'type':_0x5d1ebd[_0x53cc('0x33')][_0x53cc('0x34')]};});_0x439c30[_0x53cc('0x35')]=_['map'](_0x37a2f8,_0x53cc('0x2c'));_0x439c30['query']=_[_0x53cc('0x36')](_0x3f8f7e[_0x53cc('0x37')]);_0x439c30[_0x53cc('0x38')]=_[_0x53cc('0x39')](_0x439c30[_0x53cc('0x35')],_0x439c30[_0x53cc('0x37')]);_0xcae511[_0x53cc('0x3a')]=_[_0x53cc('0x39')](_0x439c30[_0x53cc('0x35')],qs['fields'](_0x3f8f7e[_0x53cc('0x37')]['fields']));_0xcae511[_0x53cc('0x3a')]=_0xcae511[_0x53cc('0x3a')]['length']?_0xcae511[_0x53cc('0x3a')]:_0x439c30['model'];if(!_0x3f8f7e[_0x53cc('0x37')][_0x53cc('0x3b')](_0x53cc('0x3c'))){_0xcae511[_0x53cc('0x21')]=qs[_0x53cc('0x21')](_0x3f8f7e[_0x53cc('0x37')][_0x53cc('0x21')]);_0xcae511['offset']=qs[_0x53cc('0x1e')](_0x3f8f7e[_0x53cc('0x37')][_0x53cc('0x1e')]);}_0xcae511[_0x53cc('0x3d')]=qs['sort'](_0x3f8f7e['query'][_0x53cc('0x3e')]);_0xcae511[_0x53cc('0x3f')]=qs[_0x53cc('0x38')](_[_0x53cc('0x40')](_0x3f8f7e['query'],_0x439c30[_0x53cc('0x38')]),_0x37a2f8);if(_0x3f8f7e[_0x53cc('0x37')][_0x53cc('0x41')]){_0xcae511[_0x53cc('0x3f')]=_['merge'](_0xcae511[_0x53cc('0x3f')],{'$or':_[_0x53cc('0x2f')](_0x37a2f8,function(_0x236a19){if(_0x236a19['type']!==_0x53cc('0x42')){var _0x5e52a4={};_0x5e52a4[_0x236a19[_0x53cc('0x2c')]]={'$like':'%'+_0x3f8f7e['query'][_0x53cc('0x41')]+'%'};return _0x5e52a4;}})});}_0xcae511=_[_0x53cc('0x43')]({},_0xcae511,_0x3f8f7e[_0x53cc('0x44')]);var _0x494466={'where':_0xcae511['where']};return db[_0x53cc('0x30')][_0x53cc('0x20')](_0x494466)[_0x53cc('0x27')](function(_0x17f971){_0x4e565c['count']=_0x17f971;if(_0x3f8f7e['query']['includeAll']){_0xcae511['include']=[{'all':!![]}];}return db[_0x53cc('0x30')][_0x53cc('0x45')](_0xcae511);})[_0x53cc('0x27')](function(_0x7d8862){_0x4e565c[_0x53cc('0x46')]=_0x7d8862;return _0x4e565c;})[_0x53cc('0x27')](respondWithFilteredResult(_0x1f2193,_0xcae511))[_0x53cc('0x47')](handleError(_0x1f2193,null));};exports['show']=function(_0x5547dd,_0x5019b5){var _0x44fcd2={'raw':![],'where':{'id':_0x5547dd[_0x53cc('0x48')]['id']}},_0x9a64f4={};_0x9a64f4[_0x53cc('0x35')]=_[_0x53cc('0x36')](db[_0x53cc('0x30')][_0x53cc('0x31')]);_0x9a64f4['query']=_[_0x53cc('0x36')](_0x5547dd[_0x53cc('0x37')]);_0x9a64f4[_0x53cc('0x38')]=_[_0x53cc('0x39')](_0x9a64f4[_0x53cc('0x35')],_0x9a64f4['query']);_0x44fcd2['attributes']=_['intersection'](_0x9a64f4[_0x53cc('0x35')],qs[_0x53cc('0x49')](_0x5547dd['query'][_0x53cc('0x49')]));_0x44fcd2[_0x53cc('0x3a')]=_0x44fcd2[_0x53cc('0x3a')][_0x53cc('0x4a')]?_0x44fcd2[_0x53cc('0x3a')]:_0x9a64f4[_0x53cc('0x35')];if(_0x5547dd[_0x53cc('0x37')][_0x53cc('0x4b')]){_0x44fcd2[_0x53cc('0x4c')]=[{'all':!![]}];}_0x44fcd2=_[_0x53cc('0x43')]({},_0x44fcd2,_0x5547dd[_0x53cc('0x44')]);return db['FreshsalesAccount'][_0x53cc('0x4d')](_0x44fcd2)['then'](handleEntityNotFound(_0x5019b5,null))[_0x53cc('0x27')](respondWithResult(_0x5019b5,null))[_0x53cc('0x47')](handleError(_0x5019b5,null));};exports['create']=function(_0xc93d3d,_0x49ac8e){return db[_0x53cc('0x30')][_0x53cc('0x4e')](_0xc93d3d[_0x53cc('0x4f')],{})['then'](respondWithResult(_0x49ac8e,0xc9))[_0x53cc('0x47')](handleError(_0x49ac8e,null));};exports[_0x53cc('0x26')]=function(_0x23a7ef,_0x32857d){if(_0x23a7ef[_0x53cc('0x4f')]['id']){delete _0x23a7ef[_0x53cc('0x4f')]['id'];}return db['FreshsalesAccount'][_0x53cc('0x4d')]({'where':{'id':_0x23a7ef[_0x53cc('0x48')]['id']}})['then'](handleEntityNotFound(_0x32857d,null))[_0x53cc('0x27')](saveUpdates(_0x23a7ef[_0x53cc('0x4f')],null))[_0x53cc('0x27')](respondWithResult(_0x32857d,null))[_0x53cc('0x47')](handleError(_0x32857d,null));};exports[_0x53cc('0x28')]=function(_0xe820f0,_0x4208cc){return db[_0x53cc('0x30')][_0x53cc('0x4d')]({'where':{'id':_0xe820f0[_0x53cc('0x48')]['id']}})[_0x53cc('0x27')](handleEntityNotFound(_0x4208cc,null))[_0x53cc('0x27')](removeEntity(_0x4208cc,null))[_0x53cc('0x47')](handleError(_0x4208cc,null));};exports[_0x53cc('0x50')]=function(_0x8ecfe,_0x2711dd,_0x47fefb){var _0x3fd6e9={};var _0x1e348d={};var _0x44f120;var _0x311ce1;return db['FreshsalesAccount'][_0x53cc('0x51')]({'where':{'id':_0x8ecfe[_0x53cc('0x48')]['id']}})[_0x53cc('0x27')](handleEntityNotFound(_0x2711dd,null))['then'](function(_0x5f347e){if(_0x5f347e){_0x44f120=_0x5f347e;_0x1e348d[_0x53cc('0x35')]=_['keys'](db[_0x53cc('0x52')][_0x53cc('0x31')]);_0x1e348d['query']=_['keys'](_0x8ecfe['query']);_0x1e348d[_0x53cc('0x38')]=_['intersection'](_0x1e348d[_0x53cc('0x35')],_0x1e348d[_0x53cc('0x37')]);_0x3fd6e9['attributes']=_[_0x53cc('0x39')](_0x1e348d[_0x53cc('0x35')],qs['fields'](_0x8ecfe[_0x53cc('0x37')][_0x53cc('0x49')]));_0x3fd6e9['attributes']=_0x3fd6e9[_0x53cc('0x3a')]['length']?_0x3fd6e9[_0x53cc('0x3a')]:_0x1e348d[_0x53cc('0x35')];_0x3fd6e9[_0x53cc('0x3d')]=qs[_0x53cc('0x3e')](_0x8ecfe[_0x53cc('0x37')][_0x53cc('0x3e')]);_0x3fd6e9['where']=qs[_0x53cc('0x38')](_[_0x53cc('0x40')](_0x8ecfe[_0x53cc('0x37')],_0x1e348d[_0x53cc('0x38')]));if(_0x8ecfe['query']['filter']){_0x3fd6e9[_0x53cc('0x3f')]=_[_0x53cc('0x43')](_0x3fd6e9[_0x53cc('0x3f')],{'$or':_['map'](_0x3fd6e9[_0x53cc('0x3a')],function(_0x475b83){var _0xedae69={};_0xedae69[_0x475b83]={'$like':'%'+_0x8ecfe[_0x53cc('0x37')][_0x53cc('0x41')]+'%'};return _0xedae69;})});}_0x3fd6e9=_[_0x53cc('0x43')]({},_0x3fd6e9,_0x8ecfe['options']);return _0x44f120[_0x53cc('0x50')](_0x3fd6e9);}})[_0x53cc('0x27')](function(_0x5d5ade){if(_0x5d5ade){_0x311ce1=_0x5d5ade['length'];if(!_0x8ecfe[_0x53cc('0x37')]['hasOwnProperty'](_0x53cc('0x3c'))){_0x3fd6e9[_0x53cc('0x21')]=qs[_0x53cc('0x21')](_0x8ecfe[_0x53cc('0x37')][_0x53cc('0x21')]);_0x3fd6e9[_0x53cc('0x1e')]=qs[_0x53cc('0x1e')](_0x8ecfe['query'][_0x53cc('0x1e')]);}return _0x44f120[_0x53cc('0x50')](_0x3fd6e9);}})['then'](function(_0x3f46e6){if(_0x3f46e6){return _0x3f46e6?{'count':_0x311ce1,'rows':_0x3f46e6}:null;}})[_0x53cc('0x27')](respondWithResult(_0x2711dd,null))[_0x53cc('0x47')](handleError(_0x2711dd,null));};exports[_0x53cc('0x53')]=function(_0x8f88c2,_0x526278,_0x44c341){if(_0x8f88c2['body']['id']){delete _0x8f88c2[_0x53cc('0x4f')]['id'];}return db[_0x53cc('0x30')][_0x53cc('0x51')]({'where':{'id':_0x8f88c2[_0x53cc('0x48')]['id']}})[_0x53cc('0x27')](handleEntityNotFound(_0x526278,null))[_0x53cc('0x27')](function(_0x4c43bc){if(_0x4c43bc){_0x8f88c2[_0x53cc('0x4f')][_0x53cc('0x54')]=_0x4c43bc['id'];_0x8f88c2[_0x53cc('0x4f')][_0x53cc('0x55')]=integrations['getSubjects'](_0x8f88c2['body'][_0x53cc('0x56')],_0x8f88c2['body'][_0x53cc('0x33')]);_0x8f88c2[_0x53cc('0x4f')][_0x53cc('0x57')]=integrations[_0x53cc('0x58')](_0x8f88c2['body'][_0x53cc('0x56')],_0x8f88c2['body'][_0x53cc('0x33')]);return db[_0x53cc('0x52')][_0x53cc('0x4e')](_0x8f88c2[_0x53cc('0x4f')],{'include':[{'model':db[_0x53cc('0x59')],'as':_0x53cc('0x55')},{'model':db[_0x53cc('0x59')],'as':_0x53cc('0x57')}]});}return null;})['then'](respondWithResult(_0x526278,null))[_0x53cc('0x47')](handleError(_0x526278,null));};exports[_0x53cc('0x5a')]=function(_0x37f186,_0x2ad4c7,_0x22e276){var _0x231ddb='';var _0x484f57='';return db[_0x53cc('0x30')][_0x53cc('0x51')]({'where':{'id':_0x37f186[_0x53cc('0x48')]['id']},'attributes':['id',_0x53cc('0x5b'),_0x53cc('0x5c'),_0x53cc('0x5d')]})[_0x53cc('0x27')](handleEntityNotFound(_0x2ad4c7,null))[_0x53cc('0x27')](function(_0x5573ca){if(_0x5573ca){_0x484f57=_0x5573ca[_0x53cc('0x5b')];_0x231ddb=_0x5573ca[_0x53cc('0x5c')];var _0x41ea30=_0x5573ca[_0x53cc('0x5c')]['slice'](-0x1);if(_0x41ea30==='/'){_0x231ddb=_0x231ddb[_0x53cc('0x5e')](0x0,_0x231ddb[_0x53cc('0x5f')](_0x41ea30));}return rp({'method':_0x53cc('0x60'),'uri':util[_0x53cc('0x61')]('%s%s',_0x231ddb,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x5573ca[_0x53cc('0x5d')]},'json':!![]});}})[_0x53cc('0x27')](function(_0x36f496){if(_0x36f496){var _0x42d458=_0x36f496[_0x53cc('0x62')];var _0x13ba05=![];var _0x2e4a80=null;for(_0x2e4a80=0x0;_0x2e4a80<_0x42d458[_0x53cc('0x4a')];_0x2e4a80++){if(_0x42d458[_0x2e4a80]['email']===_0x484f57){_0x13ba05=!![];}}if(_0x13ba05){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x53cc('0x63')});}}})[_0x53cc('0x27')](respondWithResult(_0x2ad4c7,null))[_0x53cc('0x47')](function(_0x36582b){var _0x5ced2e=_0x37f186[_0x53cc('0x37')]['test']?0x1f4:_0x36582b[_0x53cc('0x64')]||0x1f4;logger[_0x53cc('0x2a')](_0x53cc('0x65'),'getFields',_0x5ced2e,JSON['stringify'](_0x36582b));delete _0x36582b['name'];if(_0x5ced2e===0x191){_0x5ced2e=0x190;}_0x2ad4c7[_0x53cc('0x1c')](_0x5ced2e)[_0x53cc('0x2d')](_0x37f186[_0x53cc('0x37')][_0x53cc('0x66')]?{'message':_0x53cc('0x67'),'statusCode':_0x36582b[_0x53cc('0x64')]}:_0x36582b);});}; \ No newline at end of file +var _0x8890=['save','destroy','then','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','options','create','body','find','params','FreshsalesConfiguration','order','getConfigurations','findOne','AccountId','Subjects','channel','Descriptions','FreshsalesField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x475f90,_0x38ecb3){var _0x5006db=function(_0x28acc4){while(--_0x28acc4){_0x475f90['push'](_0x475f90['shift']());}};_0x5006db(++_0x38ecb3);}(_0x8890,0x9b));var _0x0889=function(_0x81783a,_0x2eaafa){_0x81783a=_0x81783a-0x0;var _0x1ff8c5=_0x8890[_0x81783a];return _0x1ff8c5;};'use strict';var emlformat=require(_0x0889('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0889('0x1'));var jsonpatch=require(_0x0889('0x2'));var rp=require('request-promise');var moment=require(_0x0889('0x3'));var BPromise=require(_0x0889('0x4'));var Mustache=require('mustache');var util=require(_0x0889('0x5'));var path=require(_0x0889('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0889('0x7'));var fs=require('fs');var fs_extra=require(_0x0889('0x8'));var _=require(_0x0889('0x9'));var squel=require(_0x0889('0xa'));var crypto=require(_0x0889('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0889('0xc'));var toCsv=require(_0x0889('0xd'));var querystring=require(_0x0889('0xe'));var Papa=require('papaparse');var Redis=require(_0x0889('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0889('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0889('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x0889('0x12'));var licenseUtil=require(_0x0889('0x13'));var db=require(_0x0889('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1772d3,_0x494dee){_0x494dee=_0x494dee||0xcc;return function(_0xd399e9){if(_0xd399e9){return _0x1772d3[_0x0889('0x15')](_0x494dee);}return _0x1772d3['status'](_0x494dee)[_0x0889('0x16')]();};}function respondWithResult(_0x810148,_0x3cff10){_0x3cff10=_0x3cff10||0xc8;return function(_0x24b2c2){if(_0x24b2c2){return _0x810148[_0x0889('0x17')](_0x3cff10)[_0x0889('0x18')](_0x24b2c2);}};}function respondWithFilteredResult(_0x1abece,_0x26b812){return function(_0x1f4a5d){if(_0x1f4a5d){var _0x1e01c8=typeof _0x26b812[_0x0889('0x19')]===_0x0889('0x1a')&&typeof _0x26b812['limit']===_0x0889('0x1a');var _0x2cad0c=_0x1f4a5d['count'];var _0x2815f1=_0x1e01c8?0x0:_0x26b812[_0x0889('0x19')];var _0xa953e8=_0x1e01c8?_0x1f4a5d[_0x0889('0x1b')]:_0x26b812['offset']+_0x26b812[_0x0889('0x1c')];var _0x326609;if(_0xa953e8>=_0x2cad0c){_0xa953e8=_0x2cad0c;_0x326609=0xc8;}else{_0x326609=0xce;}_0x1abece['status'](_0x326609);return _0x1abece[_0x0889('0x1d')](_0x0889('0x1e'),_0x2815f1+'-'+_0xa953e8+'/'+_0x2cad0c)[_0x0889('0x18')](_0x1f4a5d);}return null;};}function patchUpdates(_0x2443ed){return function(_0x43254b){try{jsonpatch[_0x0889('0x1f')](_0x43254b,_0x2443ed,!![]);}catch(_0x56b8d9){return BPromise[_0x0889('0x20')](_0x56b8d9);}return _0x43254b[_0x0889('0x21')]();};}function saveUpdates(_0x31ea14,_0x397f9d){return function(_0x34feda){if(_0x34feda){return _0x34feda['update'](_0x31ea14)['then'](function(_0x5d4d22){return _0x5d4d22;});}return null;};}function removeEntity(_0x121dfc,_0x2e86ad){return function(_0x5d75bb){if(_0x5d75bb){return _0x5d75bb[_0x0889('0x22')]()[_0x0889('0x23')](function(){_0x121dfc[_0x0889('0x17')](0xcc)[_0x0889('0x16')]();});}};}function handleEntityNotFound(_0x5f0a94,_0x15f9f4){return function(_0x527e22){if(!_0x527e22){_0x5f0a94[_0x0889('0x15')](0x194);}return _0x527e22;};}function handleError(_0x34793b,_0x559a22){_0x559a22=_0x559a22||0x1f4;return function(_0x124cfc){logger[_0x0889('0x24')](_0x124cfc[_0x0889('0x25')]);if(_0x124cfc[_0x0889('0x26')]){delete _0x124cfc[_0x0889('0x26')];}_0x34793b[_0x0889('0x17')](_0x559a22)[_0x0889('0x27')](_0x124cfc);};}exports['index']=function(_0xe0a677,_0x5a9920){var _0xbeb923={},_0x2e5543={},_0x3c9fae={'count':0x0,'rows':[]};var _0x376662=_[_0x0889('0x28')](db[_0x0889('0x29')][_0x0889('0x2a')],function(_0xd607ac){return{'name':_0xd607ac[_0x0889('0x2b')],'type':_0xd607ac[_0x0889('0x2c')]['key']};});_0x2e5543['model']=_[_0x0889('0x28')](_0x376662,_0x0889('0x26'));_0x2e5543[_0x0889('0x2d')]=_['keys'](_0xe0a677['query']);_0x2e5543[_0x0889('0x2e')]=_[_0x0889('0x2f')](_0x2e5543[_0x0889('0x30')],_0x2e5543[_0x0889('0x2d')]);_0xbeb923[_0x0889('0x31')]=_[_0x0889('0x2f')](_0x2e5543[_0x0889('0x30')],qs[_0x0889('0x32')](_0xe0a677[_0x0889('0x2d')][_0x0889('0x32')]));_0xbeb923[_0x0889('0x31')]=_0xbeb923[_0x0889('0x31')][_0x0889('0x33')]?_0xbeb923[_0x0889('0x31')]:_0x2e5543[_0x0889('0x30')];if(!_0xe0a677[_0x0889('0x2d')][_0x0889('0x34')]('nolimit')){_0xbeb923[_0x0889('0x1c')]=qs[_0x0889('0x1c')](_0xe0a677['query'][_0x0889('0x1c')]);_0xbeb923['offset']=qs['offset'](_0xe0a677[_0x0889('0x2d')][_0x0889('0x19')]);}_0xbeb923['order']=qs[_0x0889('0x35')](_0xe0a677[_0x0889('0x2d')][_0x0889('0x35')]);_0xbeb923[_0x0889('0x36')]=qs[_0x0889('0x2e')](_[_0x0889('0x37')](_0xe0a677[_0x0889('0x2d')],_0x2e5543['filters']),_0x376662);if(_0xe0a677['query'][_0x0889('0x38')]){_0xbeb923[_0x0889('0x36')]=_['merge'](_0xbeb923[_0x0889('0x36')],{'$or':_[_0x0889('0x28')](_0x376662,function(_0x26b271){if(_0x26b271['type']!==_0x0889('0x39')){var _0x3515b2={};_0x3515b2[_0x26b271[_0x0889('0x26')]]={'$like':'%'+_0xe0a677[_0x0889('0x2d')][_0x0889('0x38')]+'%'};return _0x3515b2;}})});}_0xbeb923=_[_0x0889('0x3a')]({},_0xbeb923,_0xe0a677['options']);var _0x5c0992={'where':_0xbeb923[_0x0889('0x36')]};return db[_0x0889('0x29')]['count'](_0x5c0992)[_0x0889('0x23')](function(_0x23cc6d){_0x3c9fae[_0x0889('0x1b')]=_0x23cc6d;if(_0xe0a677['query'][_0x0889('0x3b')]){_0xbeb923[_0x0889('0x3c')]=[{'all':!![]}];}return db[_0x0889('0x29')][_0x0889('0x3d')](_0xbeb923);})[_0x0889('0x23')](function(_0x1e2593){_0x3c9fae[_0x0889('0x3e')]=_0x1e2593;return _0x3c9fae;})[_0x0889('0x23')](respondWithFilteredResult(_0x5a9920,_0xbeb923))[_0x0889('0x3f')](handleError(_0x5a9920,null));};exports[_0x0889('0x40')]=function(_0x2847c5,_0x24c26d){var _0xd1c132={'raw':![],'where':{'id':_0x2847c5['params']['id']}},_0x195b10={};_0x195b10[_0x0889('0x30')]=_['keys'](db[_0x0889('0x29')][_0x0889('0x2a')]);_0x195b10[_0x0889('0x2d')]=_[_0x0889('0x41')](_0x2847c5[_0x0889('0x2d')]);_0x195b10[_0x0889('0x2e')]=_[_0x0889('0x2f')](_0x195b10[_0x0889('0x30')],_0x195b10['query']);_0xd1c132[_0x0889('0x31')]=_[_0x0889('0x2f')](_0x195b10[_0x0889('0x30')],qs[_0x0889('0x32')](_0x2847c5[_0x0889('0x2d')]['fields']));_0xd1c132['attributes']=_0xd1c132[_0x0889('0x31')]['length']?_0xd1c132[_0x0889('0x31')]:_0x195b10['model'];if(_0x2847c5[_0x0889('0x2d')]['includeAll']){_0xd1c132[_0x0889('0x3c')]=[{'all':!![]}];}_0xd1c132=_[_0x0889('0x3a')]({},_0xd1c132,_0x2847c5[_0x0889('0x42')]);return db[_0x0889('0x29')]['find'](_0xd1c132)[_0x0889('0x23')](handleEntityNotFound(_0x24c26d,null))[_0x0889('0x23')](respondWithResult(_0x24c26d,null))[_0x0889('0x3f')](handleError(_0x24c26d,null));};exports['create']=function(_0x2e1681,_0x3c7604){return db[_0x0889('0x29')][_0x0889('0x43')](_0x2e1681['body'],{})[_0x0889('0x23')](respondWithResult(_0x3c7604,0xc9))[_0x0889('0x3f')](handleError(_0x3c7604,null));};exports['update']=function(_0x1fed54,_0x1e7c4a){if(_0x1fed54[_0x0889('0x44')]['id']){delete _0x1fed54[_0x0889('0x44')]['id'];}return db[_0x0889('0x29')][_0x0889('0x45')]({'where':{'id':_0x1fed54[_0x0889('0x46')]['id']}})[_0x0889('0x23')](handleEntityNotFound(_0x1e7c4a,null))[_0x0889('0x23')](saveUpdates(_0x1fed54[_0x0889('0x44')],null))[_0x0889('0x23')](respondWithResult(_0x1e7c4a,null))[_0x0889('0x3f')](handleError(_0x1e7c4a,null));};exports[_0x0889('0x22')]=function(_0x3e5c00,_0x364446){return db[_0x0889('0x29')][_0x0889('0x45')]({'where':{'id':_0x3e5c00[_0x0889('0x46')]['id']}})['then'](handleEntityNotFound(_0x364446,null))[_0x0889('0x23')](removeEntity(_0x364446,null))[_0x0889('0x3f')](handleError(_0x364446,null));};exports['getConfigurations']=function(_0x2cabf6,_0x20e0a3,_0x4b40a1){var _0x264cd8={};var _0x18415f={};var _0x291dda;var _0x37d4f2;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x2cabf6['params']['id']}})[_0x0889('0x23')](handleEntityNotFound(_0x20e0a3,null))[_0x0889('0x23')](function(_0x159097){if(_0x159097){_0x291dda=_0x159097;_0x18415f['model']=_[_0x0889('0x41')](db[_0x0889('0x47')][_0x0889('0x2a')]);_0x18415f['query']=_['keys'](_0x2cabf6[_0x0889('0x2d')]);_0x18415f[_0x0889('0x2e')]=_[_0x0889('0x2f')](_0x18415f[_0x0889('0x30')],_0x18415f[_0x0889('0x2d')]);_0x264cd8[_0x0889('0x31')]=_['intersection'](_0x18415f[_0x0889('0x30')],qs['fields'](_0x2cabf6[_0x0889('0x2d')][_0x0889('0x32')]));_0x264cd8['attributes']=_0x264cd8[_0x0889('0x31')]['length']?_0x264cd8['attributes']:_0x18415f[_0x0889('0x30')];_0x264cd8[_0x0889('0x48')]=qs['sort'](_0x2cabf6[_0x0889('0x2d')]['sort']);_0x264cd8[_0x0889('0x36')]=qs[_0x0889('0x2e')](_[_0x0889('0x37')](_0x2cabf6['query'],_0x18415f['filters']));if(_0x2cabf6[_0x0889('0x2d')][_0x0889('0x38')]){_0x264cd8['where']=_[_0x0889('0x3a')](_0x264cd8[_0x0889('0x36')],{'$or':_[_0x0889('0x28')](_0x264cd8[_0x0889('0x31')],function(_0x1b0a70){var _0x5c29cf={};_0x5c29cf[_0x1b0a70]={'$like':'%'+_0x2cabf6['query']['filter']+'%'};return _0x5c29cf;})});}_0x264cd8=_['merge']({},_0x264cd8,_0x2cabf6['options']);return _0x291dda[_0x0889('0x49')](_0x264cd8);}})[_0x0889('0x23')](function(_0x2ec944){if(_0x2ec944){_0x37d4f2=_0x2ec944[_0x0889('0x33')];if(!_0x2cabf6[_0x0889('0x2d')][_0x0889('0x34')]('nolimit')){_0x264cd8[_0x0889('0x1c')]=qs['limit'](_0x2cabf6[_0x0889('0x2d')][_0x0889('0x1c')]);_0x264cd8['offset']=qs['offset'](_0x2cabf6[_0x0889('0x2d')][_0x0889('0x19')]);}return _0x291dda[_0x0889('0x49')](_0x264cd8);}})[_0x0889('0x23')](function(_0x1d01e2){if(_0x1d01e2){return _0x1d01e2?{'count':_0x37d4f2,'rows':_0x1d01e2}:null;}})[_0x0889('0x23')](respondWithResult(_0x20e0a3,null))[_0x0889('0x3f')](handleError(_0x20e0a3,null));};exports['addConfiguration']=function(_0x383ade,_0x50201a,_0x20a8ef){if(_0x383ade[_0x0889('0x44')]['id']){delete _0x383ade[_0x0889('0x44')]['id'];}return db[_0x0889('0x29')][_0x0889('0x4a')]({'where':{'id':_0x383ade[_0x0889('0x46')]['id']}})['then'](handleEntityNotFound(_0x50201a,null))['then'](function(_0x583731){if(_0x583731){_0x383ade[_0x0889('0x44')][_0x0889('0x4b')]=_0x583731['id'];_0x383ade['body'][_0x0889('0x4c')]=integrations['getSubjects'](_0x383ade[_0x0889('0x44')][_0x0889('0x4d')],_0x383ade['body'][_0x0889('0x2c')]);_0x383ade[_0x0889('0x44')][_0x0889('0x4e')]=integrations['getDescriptions'](_0x383ade['body'][_0x0889('0x4d')],_0x383ade[_0x0889('0x44')][_0x0889('0x2c')]);return db[_0x0889('0x47')]['create'](_0x383ade[_0x0889('0x44')],{'include':[{'model':db[_0x0889('0x4f')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x0889('0x23')](respondWithResult(_0x50201a,null))[_0x0889('0x3f')](handleError(_0x50201a,null));};exports[_0x0889('0x50')]=function(_0x4a8d51,_0x9ac9a3,_0x58c4ab){var _0x49fa11='';var _0x5b6bbf='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4a8d51[_0x0889('0x46')]['id']},'attributes':['id','username',_0x0889('0x51'),_0x0889('0x52')]})[_0x0889('0x23')](handleEntityNotFound(_0x9ac9a3,null))[_0x0889('0x23')](function(_0x1553eb){if(_0x1553eb){_0x5b6bbf=_0x1553eb['username'];_0x49fa11=_0x1553eb['remoteUri'];var _0xac416d=_0x1553eb[_0x0889('0x51')][_0x0889('0x53')](-0x1);if(_0xac416d==='/'){_0x49fa11=_0x49fa11['substring'](0x0,_0x49fa11[_0x0889('0x54')](_0xac416d));}return rp({'method':_0x0889('0x55'),'uri':util[_0x0889('0x56')]('%s%s',_0x49fa11,_0x0889('0x57')),'headers':{'Authorization':_0x0889('0x58')+_0x1553eb['apiKey']},'json':!![]});}})['then'](function(_0x42fe34){if(_0x42fe34){var _0x2f31b5=_0x42fe34[_0x0889('0x59')];var _0x300974=![];var _0x176136=null;for(_0x176136=0x0;_0x176136<_0x2f31b5[_0x0889('0x33')];_0x176136++){if(_0x2f31b5[_0x176136][_0x0889('0x5a')]===_0x5b6bbf){_0x300974=!![];}}if(_0x300974){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x0889('0x23')](respondWithResult(_0x9ac9a3,null))[_0x0889('0x3f')](function(_0x311113){var _0xf8bbc9=_0x4a8d51[_0x0889('0x2d')][_0x0889('0x5b')]?0x1f4:_0x311113[_0x0889('0x5c')]||0x1f4;logger[_0x0889('0x24')](_0x0889('0x5d'),_0x0889('0x50'),_0xf8bbc9,JSON['stringify'](_0x311113));delete _0x311113['name'];if(_0xf8bbc9===0x191){_0xf8bbc9=0x190;}_0x9ac9a3[_0x0889('0x17')](_0xf8bbc9)['send'](_0x4a8d51[_0x0889('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x311113[_0x0889('0x5c')]}:_0x311113);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 5e24245..96dfb79 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 _0x7ee1=['request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','moment','bluebird'];(function(_0x29e7fb,_0x5b2ff3){var _0x171dad=function(_0x3ddce4){while(--_0x3ddce4){_0x29e7fb['push'](_0x29e7fb['shift']());}};_0x171dad(++_0x5b2ff3);}(_0x7ee1,0x8d));var _0x17ee=function(_0x19ce10,_0x410e36){_0x19ce10=_0x19ce10-0x0;var _0x29eb77=_0x7ee1[_0x19ce10];return _0x29eb77;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));var integrations=require(_0x17ee('0x7'));module['exports']=function(_0x52b1db,_0x29b9eb){return _0x52b1db['define'](_0x17ee('0x8'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d3455,_0xdf4fa6){var _0x2a45c0=function(_0x1e8adf){while(--_0x1e8adf){_0x1d3455['push'](_0x1d3455['shift']());}};_0x2a45c0(++_0xdf4fa6);}(_0x4745,0x1e7));var _0x5474=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x4745[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));var integrations=require(_0x5474('0xb'));module['exports']=function(_0x3d1e1,_0x431f81){return _0x3d1e1['define'](_0x5474('0xc'),attributes,{'tableName':'int_freshsales_accounts','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 283b1ce..ae3b062 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 _0xafc4=['raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetFreshsalesAccount','FreshsalesAccount','options'];(function(_0x5906b6,_0x541824){var _0x2733da=function(_0x46b23f){while(--_0x46b23f){_0x5906b6['push'](_0x5906b6['shift']());}};_0x2733da(++_0x541824);}(_0xafc4,0x69));var _0x4afc=function(_0x97228e,_0x358621){_0x97228e=_0x97228e-0x0;var _0x56704a=_0xafc4[_0x97228e];return _0x56704a;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});}exports[_0x4afc('0x14')]=function(_0x22f809){var _0x3ad418=this;return new Promise(function(_0x16365f,_0x135349){return db[_0x4afc('0x15')]['findAll']({'raw':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x17')]===undefined?!![]:![]:!![],'where':_0x22f809[_0x4afc('0x16')]?_0x22f809['options'][_0x4afc('0x18')]||null:null,'attributes':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x19')]||null:null,'limit':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x1a')]||null:null,'include':_0x22f809['options']?_0x22f809[_0x4afc('0x16')][_0x4afc('0x1b')]?_['map'](_0x22f809[_0x4afc('0x16')]['include'],function(_0x1aa676){return{'model':db[_0x1aa676[_0x4afc('0x1c')]],'as':_0x1aa676['as'],'attributes':_0x1aa676[_0x4afc('0x19')],'include':_0x1aa676[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x1aa676[_0x4afc('0x1b')],function(_0x40a0db){return{'model':db[_0x40a0db[_0x4afc('0x1c')]],'as':_0x40a0db['as'],'attributes':_0x40a0db[_0x4afc('0x19')],'include':_0x40a0db[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x40a0db[_0x4afc('0x1b')],function(_0x35f5b3){return{'model':db[_0x35f5b3['model']],'as':_0x35f5b3['as'],'attributes':_0x35f5b3[_0x4afc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4afc('0xa')](function(_0x2d6112){logger['info']('GetFreshsalesAccount',_0x22f809);logger['debug'](_0x4afc('0x14'),_0x22f809,JSON[_0x4afc('0xe')](_0x2d6112));_0x16365f(_0x2d6112);})['catch'](function(_0xd26d2f){logger[_0x4afc('0xf')]('GetFreshsalesAccount',_0xd26d2f['message'],_0x22f809);_0x135349(_0x3ad418['error'](0x1f4,_0xd26d2f[_0x4afc('0x11')]));});});};exports[_0x4afc('0x1e')]=function(_0x17a43d){var _0x46357b=this;return new Promise(function(_0xc1d91,_0x28cd3e){return db['FreshsalesAccount'][_0x4afc('0x1f')]({'raw':_0x17a43d[_0x4afc('0x16')]?_0x17a43d[_0x4afc('0x16')][_0x4afc('0x17')]===undefined?!![]:![]:!![],'where':_0x17a43d[_0x4afc('0x16')]?_0x17a43d[_0x4afc('0x16')][_0x4afc('0x18')]||null:null,'attributes':_0x17a43d[_0x4afc('0x16')]?_0x17a43d['options'][_0x4afc('0x19')]||null:null,'include':_0x17a43d['options']?_0x17a43d['options'][_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x17a43d[_0x4afc('0x16')][_0x4afc('0x1b')],function(_0x3ec6fa){return{'model':db[_0x3ec6fa[_0x4afc('0x1c')]],'as':_0x3ec6fa['as'],'attributes':_0x3ec6fa['attributes'],'include':_0x3ec6fa[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x3ec6fa[_0x4afc('0x1b')],function(_0x127ac8){return{'model':db[_0x127ac8[_0x4afc('0x1c')]],'as':_0x127ac8['as'],'attributes':_0x127ac8[_0x4afc('0x19')],'include':_0x127ac8['include']?_[_0x4afc('0x1d')](_0x127ac8[_0x4afc('0x1b')],function(_0x91565d){return{'model':db[_0x91565d[_0x4afc('0x1c')]],'as':_0x91565d['as'],'attributes':_0x91565d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43c341){logger[_0x4afc('0xb')](_0x4afc('0x1e'),_0x17a43d);logger['debug']('ShowFreshsalesAccount',_0x17a43d,JSON[_0x4afc('0xe')](_0x43c341));_0xc1d91(_0x43c341);})['catch'](function(_0x5947bb){logger[_0x4afc('0xf')](_0x4afc('0x1e'),_0x5947bb[_0x4afc('0x11')],_0x17a43d);_0x28cd3e(_0x46357b[_0x4afc('0xf')](0x1f4,_0x5947bb[_0x4afc('0x11')]));});});}; \ No newline at end of file +var _0x0a6b=['find','map','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','then','debug','stringify','catch','ShowFreshsalesAccount'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x38ff73,_0x2ff998){_0x38ff73=_0x38ff73-0x0;var _0x3d3901=_0x0a6b[_0x38ff73];return _0x3d3901;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});}exports[_0xb0a6('0x10')]=function(_0x18f994){var _0x10f504=this;return new Promise(function(_0x13a1c8,_0x567dd5){return db[_0xb0a6('0x11')][_0xb0a6('0x12')]({'raw':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x15')]||null:null,'attributes':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'limit':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x17')]||null:null,'include':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x18')]?_['map'](_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4997df){return{'model':db[_0x4997df['model']],'as':_0x4997df['as'],'attributes':_0x4997df[_0xb0a6('0x16')],'include':_0x4997df[_0xb0a6('0x18')]?_['map'](_0x4997df[_0xb0a6('0x18')],function(_0x24574a){return{'model':db[_0x24574a[_0xb0a6('0x19')]],'as':_0x24574a['as'],'attributes':_0x24574a[_0xb0a6('0x16')],'include':_0x24574a['include']?_['map'](_0x24574a[_0xb0a6('0x18')],function(_0x1e9947){return{'model':db[_0x1e9947[_0xb0a6('0x19')]],'as':_0x1e9947['as'],'attributes':_0x1e9947['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x3347ac){logger[_0xb0a6('0x8')](_0xb0a6('0x10'),_0x18f994);logger[_0xb0a6('0x1b')](_0xb0a6('0x10'),_0x18f994,JSON[_0xb0a6('0x1c')](_0x3347ac));_0x13a1c8(_0x3347ac);})[_0xb0a6('0x1d')](function(_0x4255b9){logger['error'](_0xb0a6('0x10'),_0x4255b9[_0xb0a6('0xe')],_0x18f994);_0x567dd5(_0x10f504[_0xb0a6('0xc')](0x1f4,_0x4255b9['message']));});});};exports[_0xb0a6('0x1e')]=function(_0x582fc2){var _0x131e46=this;return new Promise(function(_0x309a91,_0x114f91){return db[_0xb0a6('0x11')][_0xb0a6('0x1f')]({'raw':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')]['where']||null:null,'attributes':_0x582fc2['options']?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'include':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4b0479){return{'model':db[_0x4b0479[_0xb0a6('0x19')]],'as':_0x4b0479['as'],'attributes':_0x4b0479[_0xb0a6('0x16')],'include':_0x4b0479['include']?_[_0xb0a6('0x20')](_0x4b0479[_0xb0a6('0x18')],function(_0x52e397){return{'model':db[_0x52e397['model']],'as':_0x52e397['as'],'attributes':_0x52e397[_0xb0a6('0x16')],'include':_0x52e397[_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x52e397[_0xb0a6('0x18')],function(_0x4310ae){return{'model':db[_0x4310ae[_0xb0a6('0x19')]],'as':_0x4310ae['as'],'attributes':_0x4310ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x5c280e){logger[_0xb0a6('0x8')](_0xb0a6('0x1e'),_0x582fc2);logger['debug']('ShowFreshsalesAccount',_0x582fc2,JSON['stringify'](_0x5c280e));_0x309a91(_0x5c280e);})[_0xb0a6('0x1d')](function(_0xd484f){logger[_0xb0a6('0xc')](_0xb0a6('0x1e'),_0xd484f[_0xb0a6('0xe')],_0x582fc2);_0x114f91(_0x131e46['error'](0x1f4,_0xd484f[_0xb0a6('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e3d4435..74ea6ce 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 _0x34fe=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/fields','getFields','create','put','/:id','update','delete'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0x34fe,0x18c));var _0xe34f=function(_0xb6efe2,_0xf807c7){_0xb6efe2=_0xb6efe2-0x0;var _0x38f952=_0x34fe[_0xb6efe2];return _0x38f952;};'use strict';var multer=require(_0xe34f('0x0'));var util=require(_0xe34f('0x1'));var path=require(_0xe34f('0x2'));var timeout=require(_0xe34f('0x3'));var express=require(_0xe34f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe34f('0x5'));var interaction=require(_0xe34f('0x6'));var config=require(_0xe34f('0x7'));var controller=require(_0xe34f('0x8'));router[_0xe34f('0x9')]('/',auth[_0xe34f('0xa')](),controller[_0xe34f('0xb')]);router[_0xe34f('0x9')]('/:id',auth[_0xe34f('0xa')](),controller[_0xe34f('0xc')]);router[_0xe34f('0x9')](_0xe34f('0xd'),auth['isAuthenticated'](),controller[_0xe34f('0xe')]);router['get']('/:id/descriptions',auth[_0xe34f('0xa')](),controller['getDescriptions']);router[_0xe34f('0x9')](_0xe34f('0xf'),auth[_0xe34f('0xa')](),controller[_0xe34f('0x10')]);router['post']('/',auth[_0xe34f('0xa')](),controller[_0xe34f('0x11')]);router[_0xe34f('0x12')](_0xe34f('0x13'),auth[_0xe34f('0xa')](),controller[_0xe34f('0x14')]);router[_0xe34f('0x15')](_0xe34f('0x13'),auth[_0xe34f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd5ca=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','getDescriptions','getFields','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xd5ca,0x151));var _0xad5c=function(_0x41257f,_0x22ab22){_0x41257f=_0x41257f-0x0;var _0x98ed80=_0xd5ca[_0x41257f];return _0x98ed80;};'use strict';var multer=require(_0xad5c('0x0'));var util=require(_0xad5c('0x1'));var path=require(_0xad5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xad5c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xad5c('0x4'));var interaction=require(_0xad5c('0x5'));var config=require('../../config/environment');var controller=require(_0xad5c('0x6'));router[_0xad5c('0x7')]('/',auth[_0xad5c('0x8')](),controller[_0xad5c('0x9')]);router['get'](_0xad5c('0xa'),auth[_0xad5c('0x8')](),controller['show']);router[_0xad5c('0x7')]('/:id/subjects',auth[_0xad5c('0x8')](),controller[_0xad5c('0xb')]);router[_0xad5c('0x7')]('/:id/descriptions',auth[_0xad5c('0x8')](),controller[_0xad5c('0xc')]);router[_0xad5c('0x7')]('/:id/fields',auth[_0xad5c('0x8')](),controller[_0xad5c('0xd')]);router[_0xad5c('0xe')]('/',auth[_0xad5c('0x8')](),controller[_0xad5c('0xf')]);router[_0xad5c('0x10')](_0xad5c('0xa'),auth[_0xad5c('0x8')](),controller['update']);router[_0xad5c('0x11')](_0xad5c('0xa'),auth['isAuthenticated'](),controller[_0xad5c('0x12')]);module[_0xad5c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 04d6f5a..8386902 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 _0xfec7=['exports','STRING','sequelize'];(function(_0x1482b7,_0xd6d7f4){var _0x48dcbb=function(_0x4e3243){while(--_0x4e3243){_0x1482b7['push'](_0x1482b7['shift']());}};_0x48dcbb(++_0xd6d7f4);}(_0xfec7,0x128));var _0x7fec=function(_0x3a9701,_0x363479){_0x3a9701=_0x3a9701-0x0;var _0xd4ddca=_0xfec7[_0x3a9701];return _0xd4ddca;};'use strict';var Sequelize=require(_0x7fec('0x0'));module[_0x7fec('0x1')]={'name':{'type':Sequelize[_0x7fec('0x2')]},'description':{'type':Sequelize[_0x7fec('0x2')]}}; \ No newline at end of file +var _0x12bc=['sequelize','exports','STRING'];(function(_0x19cba3,_0x4b4a1d){var _0x163911=function(_0xe430a2){while(--_0xe430a2){_0x19cba3['push'](_0x19cba3['shift']());}};_0x163911(++_0x4b4a1d);}(_0x12bc,0x1d7));var _0xc12b=function(_0x40a76e,_0x294bfc){_0x40a76e=_0x40a76e-0x0;var _0xaa0197=_0x12bc[_0x40a76e];return _0xaa0197;};'use strict';var Sequelize=require(_0xc12b('0x0'));module[_0xc12b('0x1')]={'name':{'type':Sequelize[_0xc12b('0x2')]},'description':{'type':Sequelize[_0xc12b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index cb2b717..efdb516 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 _0xa455=['fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','options','include','findAll','rows','show','params','includeAll','find','create','catch','body','findOne','FreshsalesField','order','pick','getSubjects','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4771a8,_0x2c3c9e){var _0x586c04=function(_0x5e54b4){while(--_0x5e54b4){_0x4771a8['push'](_0x4771a8['shift']());}};_0x586c04(++_0x2c3c9e);}(_0xa455,0xe8));var _0x5a45=function(_0x3ac390,_0x3a59e6){_0x3ac390=_0x3ac390-0x0;var _0x5db493=_0xa455[_0x3ac390];return _0x5db493;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a45('0x0'));var zipdir=require(_0x5a45('0x1'));var jsonpatch=require(_0x5a45('0x2'));var rp=require(_0x5a45('0x3'));var moment=require(_0x5a45('0x4'));var BPromise=require(_0x5a45('0x5'));var Mustache=require(_0x5a45('0x6'));var util=require('util');var path=require(_0x5a45('0x7'));var sox=require(_0x5a45('0x8'));var csv=require(_0x5a45('0x9'));var ejs=require(_0x5a45('0xa'));var fs=require('fs');var fs_extra=require(_0x5a45('0xb'));var _=require('lodash');var squel=require(_0x5a45('0xc'));var crypto=require(_0x5a45('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5a45('0xe'));var toCsv=require(_0x5a45('0x9'));var querystring=require(_0x5a45('0xf'));var Papa=require(_0x5a45('0x10'));var Redis=require(_0x5a45('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5a45('0x12'));var as=require(_0x5a45('0x13'));var hardwareService=require(_0x5a45('0x14'));var logger=require(_0x5a45('0x15'))(_0x5a45('0x16'));var utils=require(_0x5a45('0x17'));var config=require(_0x5a45('0x18'));var licenseUtil=require(_0x5a45('0x19'));var db=require(_0x5a45('0x1a'))['db'];function respondWithStatusCode(_0x1929a2,_0x3c4b24){_0x3c4b24=_0x3c4b24||0xcc;return function(_0x1191c5){if(_0x1191c5){return _0x1929a2[_0x5a45('0x1b')](_0x3c4b24);}return _0x1929a2[_0x5a45('0x1c')](_0x3c4b24)[_0x5a45('0x1d')]();};}function respondWithResult(_0x3e7753,_0x2a81a6){_0x2a81a6=_0x2a81a6||0xc8;return function(_0x55d5b6){if(_0x55d5b6){return _0x3e7753[_0x5a45('0x1c')](_0x2a81a6)['json'](_0x55d5b6);}};}function respondWithFilteredResult(_0x44cb3e,_0x49680d){return function(_0xf41f1a){if(_0xf41f1a){var _0x467c84=typeof _0x49680d[_0x5a45('0x1e')]===_0x5a45('0x1f')&&typeof _0x49680d[_0x5a45('0x20')]===_0x5a45('0x1f');var _0x2407eb=_0xf41f1a[_0x5a45('0x21')];var _0x246b5e=_0x467c84?0x0:_0x49680d[_0x5a45('0x1e')];var _0x45525d=_0x467c84?_0xf41f1a[_0x5a45('0x21')]:_0x49680d['offset']+_0x49680d['limit'];var _0x243dcc;if(_0x45525d>=_0x2407eb){_0x45525d=_0x2407eb;_0x243dcc=0xc8;}else{_0x243dcc=0xce;}_0x44cb3e[_0x5a45('0x1c')](_0x243dcc);return _0x44cb3e['set'](_0x5a45('0x22'),_0x246b5e+'-'+_0x45525d+'/'+_0x2407eb)['json'](_0xf41f1a);}return null;};}function patchUpdates(_0x40f4fd){return function(_0x1a6c42){try{jsonpatch[_0x5a45('0x23')](_0x1a6c42,_0x40f4fd,!![]);}catch(_0x59a41b){return BPromise[_0x5a45('0x24')](_0x59a41b);}return _0x1a6c42[_0x5a45('0x25')]();};}function saveUpdates(_0x46e01c,_0x50dee2){return function(_0x137f72){if(_0x137f72){return _0x137f72['update'](_0x46e01c)[_0x5a45('0x26')](function(_0x2f3585){return _0x2f3585;});}return null;};}function removeEntity(_0x39e378,_0x4984b2){return function(_0x2cac28){if(_0x2cac28){return _0x2cac28[_0x5a45('0x27')]()[_0x5a45('0x26')](function(){_0x39e378['status'](0xcc)[_0x5a45('0x1d')]();});}};}function handleEntityNotFound(_0x2285ef,_0x191f6b){return function(_0x5b5bcf){if(!_0x5b5bcf){_0x2285ef['sendStatus'](0x194);}return _0x5b5bcf;};}function handleError(_0x2785a5,_0x3247ee){_0x3247ee=_0x3247ee||0x1f4;return function(_0x22437d){logger[_0x5a45('0x28')](_0x22437d['stack']);if(_0x22437d[_0x5a45('0x29')]){delete _0x22437d[_0x5a45('0x29')];}_0x2785a5['status'](_0x3247ee)['send'](_0x22437d);};}exports[_0x5a45('0x2a')]=function(_0xe9fa7f,_0x59de45){var _0x5ca280={},_0x48b079={},_0x4978d5={'count':0x0,'rows':[]};var _0x265144=_['map'](db[_0x5a45('0x2b')][_0x5a45('0x2c')],function(_0x84cdc8){return{'name':_0x84cdc8[_0x5a45('0x2d')],'type':_0x84cdc8[_0x5a45('0x2e')][_0x5a45('0x2f')]};});_0x48b079[_0x5a45('0x30')]=_[_0x5a45('0x31')](_0x265144,_0x5a45('0x29'));_0x48b079['query']=_[_0x5a45('0x32')](_0xe9fa7f[_0x5a45('0x33')]);_0x48b079['filters']=_[_0x5a45('0x34')](_0x48b079[_0x5a45('0x30')],_0x48b079['query']);_0x5ca280[_0x5a45('0x35')]=_['intersection'](_0x48b079['model'],qs[_0x5a45('0x36')](_0xe9fa7f[_0x5a45('0x33')][_0x5a45('0x36')]));_0x5ca280[_0x5a45('0x35')]=_0x5ca280['attributes'][_0x5a45('0x37')]?_0x5ca280[_0x5a45('0x35')]:_0x48b079[_0x5a45('0x30')];if(!_0xe9fa7f[_0x5a45('0x33')][_0x5a45('0x38')](_0x5a45('0x39'))){_0x5ca280[_0x5a45('0x20')]=qs[_0x5a45('0x20')](_0xe9fa7f[_0x5a45('0x33')][_0x5a45('0x20')]);_0x5ca280[_0x5a45('0x1e')]=qs['offset'](_0xe9fa7f[_0x5a45('0x33')][_0x5a45('0x1e')]);}_0x5ca280['order']=qs[_0x5a45('0x3a')](_0xe9fa7f[_0x5a45('0x33')][_0x5a45('0x3a')]);_0x5ca280['where']=qs[_0x5a45('0x3b')](_['pick'](_0xe9fa7f[_0x5a45('0x33')],_0x48b079['filters']),_0x265144);if(_0xe9fa7f[_0x5a45('0x33')][_0x5a45('0x3c')]){_0x5ca280[_0x5a45('0x3d')]=_[_0x5a45('0x3e')](_0x5ca280[_0x5a45('0x3d')],{'$or':_['map'](_0x265144,function(_0x22426b){if(_0x22426b[_0x5a45('0x2e')]!=='VIRTUAL'){var _0x3b25db={};_0x3b25db[_0x22426b[_0x5a45('0x29')]]={'$like':'%'+_0xe9fa7f['query'][_0x5a45('0x3c')]+'%'};return _0x3b25db;}})});}_0x5ca280=_[_0x5a45('0x3e')]({},_0x5ca280,_0xe9fa7f[_0x5a45('0x3f')]);var _0x42f3d0={'where':_0x5ca280['where']};return db[_0x5a45('0x2b')][_0x5a45('0x21')](_0x42f3d0)[_0x5a45('0x26')](function(_0x45421d){_0x4978d5[_0x5a45('0x21')]=_0x45421d;if(_0xe9fa7f['query']['includeAll']){_0x5ca280[_0x5a45('0x40')]=[{'all':!![]}];}return db[_0x5a45('0x2b')][_0x5a45('0x41')](_0x5ca280);})[_0x5a45('0x26')](function(_0x2a1e3f){_0x4978d5[_0x5a45('0x42')]=_0x2a1e3f;return _0x4978d5;})[_0x5a45('0x26')](respondWithFilteredResult(_0x59de45,_0x5ca280))['catch'](handleError(_0x59de45,null));};exports[_0x5a45('0x43')]=function(_0x587cd2,_0x55ad80){var _0x4bda3c={'raw':![],'where':{'id':_0x587cd2[_0x5a45('0x44')]['id']}},_0x4e7163={};_0x4e7163['model']=_[_0x5a45('0x32')](db[_0x5a45('0x2b')][_0x5a45('0x2c')]);_0x4e7163[_0x5a45('0x33')]=_[_0x5a45('0x32')](_0x587cd2[_0x5a45('0x33')]);_0x4e7163[_0x5a45('0x3b')]=_[_0x5a45('0x34')](_0x4e7163['model'],_0x4e7163['query']);_0x4bda3c['attributes']=_['intersection'](_0x4e7163['model'],qs['fields'](_0x587cd2[_0x5a45('0x33')][_0x5a45('0x36')]));_0x4bda3c[_0x5a45('0x35')]=_0x4bda3c[_0x5a45('0x35')]['length']?_0x4bda3c['attributes']:_0x4e7163[_0x5a45('0x30')];if(_0x587cd2[_0x5a45('0x33')][_0x5a45('0x45')]){_0x4bda3c['include']=[{'all':!![]}];}_0x4bda3c=_[_0x5a45('0x3e')]({},_0x4bda3c,_0x587cd2[_0x5a45('0x3f')]);return db[_0x5a45('0x2b')][_0x5a45('0x46')](_0x4bda3c)[_0x5a45('0x26')](handleEntityNotFound(_0x55ad80,null))[_0x5a45('0x26')](respondWithResult(_0x55ad80,null))['catch'](handleError(_0x55ad80,null));};exports[_0x5a45('0x47')]=function(_0x322d5c,_0x39a144){return db['FreshsalesConfiguration'][_0x5a45('0x47')](_0x322d5c['body'],{})[_0x5a45('0x26')](respondWithResult(_0x39a144,0xc9))[_0x5a45('0x48')](handleError(_0x39a144,null));};exports['update']=function(_0x56e8de,_0x39b119){if(_0x56e8de['body']['id']){delete _0x56e8de[_0x5a45('0x49')]['id'];}return db[_0x5a45('0x2b')]['find']({'where':{'id':_0x56e8de['params']['id']}})[_0x5a45('0x26')](handleEntityNotFound(_0x39b119,null))[_0x5a45('0x26')](saveUpdates(_0x56e8de[_0x5a45('0x49')],null))['then'](respondWithResult(_0x39b119,null))[_0x5a45('0x48')](handleError(_0x39b119,null));};exports['destroy']=function(_0xd729a4,_0x2a3397){return db['FreshsalesConfiguration']['find']({'where':{'id':_0xd729a4['params']['id']}})['then'](handleEntityNotFound(_0x2a3397,null))[_0x5a45('0x26')](removeEntity(_0x2a3397,null))[_0x5a45('0x48')](handleError(_0x2a3397,null));};exports['getSubjects']=function(_0x116a7a,_0x5e8ce0,_0x1cd054){var _0x133258={};var _0x360878={};var _0x5407e9;var _0x114795;return db[_0x5a45('0x2b')][_0x5a45('0x4a')]({'where':{'id':_0x116a7a['params']['id']}})[_0x5a45('0x26')](handleEntityNotFound(_0x5e8ce0,null))[_0x5a45('0x26')](function(_0x1a97b5){if(_0x1a97b5){_0x5407e9=_0x1a97b5;_0x360878[_0x5a45('0x30')]=_['keys'](db[_0x5a45('0x4b')][_0x5a45('0x2c')]);_0x360878[_0x5a45('0x33')]=_[_0x5a45('0x32')](_0x116a7a[_0x5a45('0x33')]);_0x360878[_0x5a45('0x3b')]=_['intersection'](_0x360878['model'],_0x360878[_0x5a45('0x33')]);_0x133258[_0x5a45('0x35')]=_[_0x5a45('0x34')](_0x360878[_0x5a45('0x30')],qs['fields'](_0x116a7a[_0x5a45('0x33')][_0x5a45('0x36')]));_0x133258['attributes']=_0x133258[_0x5a45('0x35')][_0x5a45('0x37')]?_0x133258[_0x5a45('0x35')]:_0x360878[_0x5a45('0x30')];_0x133258[_0x5a45('0x4c')]=qs['sort'](_0x116a7a[_0x5a45('0x33')][_0x5a45('0x3a')]);_0x133258['where']=qs[_0x5a45('0x3b')](_[_0x5a45('0x4d')](_0x116a7a['query'],_0x360878['filters']));if(_0x116a7a['query']['filter']){_0x133258[_0x5a45('0x3d')]=_[_0x5a45('0x3e')](_0x133258[_0x5a45('0x3d')],{'$or':_[_0x5a45('0x31')](_0x133258[_0x5a45('0x35')],function(_0x8ffec){var _0x4af85c={};_0x4af85c[_0x8ffec]={'$like':'%'+_0x116a7a['query'][_0x5a45('0x3c')]+'%'};return _0x4af85c;})});}_0x133258=_[_0x5a45('0x3e')]({},_0x133258,_0x116a7a[_0x5a45('0x3f')]);return _0x5407e9['getSubjects'](_0x133258);}})[_0x5a45('0x26')](function(_0x52b8cb){if(_0x52b8cb){_0x114795=_0x52b8cb[_0x5a45('0x37')];if(!_0x116a7a['query'][_0x5a45('0x38')](_0x5a45('0x39'))){_0x133258[_0x5a45('0x20')]=qs[_0x5a45('0x20')](_0x116a7a['query'][_0x5a45('0x20')]);_0x133258[_0x5a45('0x1e')]=qs[_0x5a45('0x1e')](_0x116a7a[_0x5a45('0x33')][_0x5a45('0x1e')]);}return _0x5407e9[_0x5a45('0x4e')](_0x133258);}})[_0x5a45('0x26')](function(_0x46a899){if(_0x46a899){return _0x46a899?{'count':_0x114795,'rows':_0x46a899}:null;}})['then'](respondWithResult(_0x5e8ce0,null))[_0x5a45('0x48')](handleError(_0x5e8ce0,null));};exports[_0x5a45('0x4f')]=function(_0x57693c,_0x1832b0,_0x7e3729){var _0x37a821={};var _0x4fc9fb={};var _0xa80e1f;var _0x1c2b9f;return db[_0x5a45('0x2b')][_0x5a45('0x4a')]({'where':{'id':_0x57693c[_0x5a45('0x44')]['id']}})[_0x5a45('0x26')](handleEntityNotFound(_0x1832b0,null))[_0x5a45('0x26')](function(_0x57ae56){if(_0x57ae56){_0xa80e1f=_0x57ae56;_0x4fc9fb[_0x5a45('0x30')]=_[_0x5a45('0x32')](db[_0x5a45('0x4b')][_0x5a45('0x2c')]);_0x4fc9fb['query']=_[_0x5a45('0x32')](_0x57693c[_0x5a45('0x33')]);_0x4fc9fb[_0x5a45('0x3b')]=_['intersection'](_0x4fc9fb[_0x5a45('0x30')],_0x4fc9fb[_0x5a45('0x33')]);_0x37a821['attributes']=_[_0x5a45('0x34')](_0x4fc9fb[_0x5a45('0x30')],qs[_0x5a45('0x36')](_0x57693c['query'][_0x5a45('0x36')]));_0x37a821[_0x5a45('0x35')]=_0x37a821[_0x5a45('0x35')][_0x5a45('0x37')]?_0x37a821[_0x5a45('0x35')]:_0x4fc9fb['model'];_0x37a821[_0x5a45('0x4c')]=qs['sort'](_0x57693c['query'][_0x5a45('0x3a')]);_0x37a821[_0x5a45('0x3d')]=qs[_0x5a45('0x3b')](_[_0x5a45('0x4d')](_0x57693c[_0x5a45('0x33')],_0x4fc9fb[_0x5a45('0x3b')]));if(_0x57693c[_0x5a45('0x33')][_0x5a45('0x3c')]){_0x37a821[_0x5a45('0x3d')]=_[_0x5a45('0x3e')](_0x37a821[_0x5a45('0x3d')],{'$or':_[_0x5a45('0x31')](_0x37a821['attributes'],function(_0x1b6f10){var _0x551999={};_0x551999[_0x1b6f10]={'$like':'%'+_0x57693c['query'][_0x5a45('0x3c')]+'%'};return _0x551999;})});}_0x37a821=_[_0x5a45('0x3e')]({},_0x37a821,_0x57693c[_0x5a45('0x3f')]);return _0xa80e1f['getDescriptions'](_0x37a821);}})[_0x5a45('0x26')](function(_0x314e6a){if(_0x314e6a){_0x1c2b9f=_0x314e6a[_0x5a45('0x37')];if(!_0x57693c[_0x5a45('0x33')]['hasOwnProperty'](_0x5a45('0x39'))){_0x37a821[_0x5a45('0x20')]=qs[_0x5a45('0x20')](_0x57693c[_0x5a45('0x33')][_0x5a45('0x20')]);_0x37a821['offset']=qs[_0x5a45('0x1e')](_0x57693c['query'][_0x5a45('0x1e')]);}return _0xa80e1f[_0x5a45('0x4f')](_0x37a821);}})[_0x5a45('0x26')](function(_0xff6426){if(_0xff6426){return _0xff6426?{'count':_0x1c2b9f,'rows':_0xff6426}:null;}})[_0x5a45('0x26')](respondWithResult(_0x1832b0,null))[_0x5a45('0x48')](handleError(_0x1832b0,null));};exports['getFields']=function(_0x919c93,_0x149426,_0x4ae776){var _0x120364={};var _0x200fd3={};var _0x110be8;var _0x1b77eb;return db['FreshsalesConfiguration'][_0x5a45('0x4a')]({'where':{'id':_0x919c93['params']['id']}})[_0x5a45('0x26')](handleEntityNotFound(_0x149426,null))[_0x5a45('0x26')](function(_0x43c104){if(_0x43c104){_0x110be8=_0x43c104;_0x200fd3['model']=_[_0x5a45('0x32')](db[_0x5a45('0x4b')][_0x5a45('0x2c')]);_0x200fd3[_0x5a45('0x33')]=_[_0x5a45('0x32')](_0x919c93[_0x5a45('0x33')]);_0x200fd3[_0x5a45('0x3b')]=_[_0x5a45('0x34')](_0x200fd3['model'],_0x200fd3['query']);_0x120364[_0x5a45('0x35')]=_[_0x5a45('0x34')](_0x200fd3['model'],qs[_0x5a45('0x36')](_0x919c93[_0x5a45('0x33')]['fields']));_0x120364[_0x5a45('0x35')]=_0x120364[_0x5a45('0x35')][_0x5a45('0x37')]?_0x120364[_0x5a45('0x35')]:_0x200fd3[_0x5a45('0x30')];_0x120364['order']=qs[_0x5a45('0x3a')](_0x919c93['query']['sort']);_0x120364['where']=qs[_0x5a45('0x3b')](_['pick'](_0x919c93[_0x5a45('0x33')],_0x200fd3['filters']));if(_0x919c93[_0x5a45('0x33')][_0x5a45('0x3c')]){_0x120364[_0x5a45('0x3d')]=_[_0x5a45('0x3e')](_0x120364['where'],{'$or':_[_0x5a45('0x31')](_0x120364['attributes'],function(_0x3f6d08){var _0x3c9619={};_0x3c9619[_0x3f6d08]={'$like':'%'+_0x919c93[_0x5a45('0x33')][_0x5a45('0x3c')]+'%'};return _0x3c9619;})});}_0x120364=_[_0x5a45('0x3e')]({},_0x120364,_0x919c93[_0x5a45('0x3f')]);return _0x110be8[_0x5a45('0x50')](_0x120364);}})[_0x5a45('0x26')](function(_0x2c266b){if(_0x2c266b){_0x1b77eb=_0x2c266b[_0x5a45('0x37')];if(!_0x919c93[_0x5a45('0x33')][_0x5a45('0x38')]('nolimit')){_0x120364[_0x5a45('0x20')]=qs[_0x5a45('0x20')](_0x919c93['query'][_0x5a45('0x20')]);_0x120364[_0x5a45('0x1e')]=qs[_0x5a45('0x1e')](_0x919c93[_0x5a45('0x33')][_0x5a45('0x1e')]);}return _0x110be8[_0x5a45('0x50')](_0x120364);}})[_0x5a45('0x26')](function(_0x19686b){if(_0x19686b){return _0x19686b?{'count':_0x1b77eb,'rows':_0x19686b}:null;}})['then'](respondWithResult(_0x149426,null))['catch'](handleError(_0x149426,null));}; \ No newline at end of file +var _0xde1c=['merge','filter','then','includeAll','include','rows','show','params','model','length','options','find','catch','create','body','getSubjects','findOne','order','hasOwnProperty','FreshsalesField','getDescriptions','getFields','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','index','FreshsalesConfiguration','rawAttributes','type','key','map','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','where'];(function(_0x2157ba,_0x97f482){var _0x45209d=function(_0x39d34a){while(--_0x39d34a){_0x2157ba['push'](_0x2157ba['shift']());}};_0x45209d(++_0x97f482);}(_0xde1c,0x1a6));var _0xcde1=function(_0x204fdc,_0x3e393b){_0x204fdc=_0x204fdc-0x0;var _0x45b775=_0xde1c[_0x204fdc];return _0x45b775;};'use strict';var emlformat=require(_0xcde1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcde1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcde1('0x2'));var moment=require(_0xcde1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcde1('0x4'));var util=require(_0xcde1('0x5'));var path=require('path');var sox=require(_0xcde1('0x6'));var csv=require(_0xcde1('0x7'));var ejs=require(_0xcde1('0x8'));var fs=require('fs');var fs_extra=require(_0xcde1('0x9'));var _=require(_0xcde1('0xa'));var squel=require(_0xcde1('0xb'));var crypto=require('crypto');var jsforce=require(_0xcde1('0xc'));var deskjs=require(_0xcde1('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcde1('0xe'));var Papa=require(_0xcde1('0xf'));var Redis=require(_0xcde1('0x10'));var authService=require(_0xcde1('0x11'));var qs=require(_0xcde1('0x12'));var as=require(_0xcde1('0x13'));var hardwareService=require(_0xcde1('0x14'));var logger=require('../../config/logger')(_0xcde1('0x15'));var utils=require(_0xcde1('0x16'));var config=require(_0xcde1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcde1('0x18'))['db'];function respondWithStatusCode(_0x18bee5,_0x553775){_0x553775=_0x553775||0xcc;return function(_0x6ec8f9){if(_0x6ec8f9){return _0x18bee5[_0xcde1('0x19')](_0x553775);}return _0x18bee5[_0xcde1('0x1a')](_0x553775)[_0xcde1('0x1b')]();};}function respondWithResult(_0x1b81f9,_0x232e3f){_0x232e3f=_0x232e3f||0xc8;return function(_0x39a664){if(_0x39a664){return _0x1b81f9[_0xcde1('0x1a')](_0x232e3f)['json'](_0x39a664);}};}function respondWithFilteredResult(_0x4b7598,_0x79ec95){return function(_0x53a7e5){if(_0x53a7e5){var _0x2dd7f0=typeof _0x79ec95[_0xcde1('0x1c')]===_0xcde1('0x1d')&&typeof _0x79ec95[_0xcde1('0x1e')]===_0xcde1('0x1d');var _0x112b4b=_0x53a7e5[_0xcde1('0x1f')];var _0x1fb892=_0x2dd7f0?0x0:_0x79ec95['offset'];var _0x5b1685=_0x2dd7f0?_0x53a7e5[_0xcde1('0x1f')]:_0x79ec95['offset']+_0x79ec95['limit'];var _0x826394;if(_0x5b1685>=_0x112b4b){_0x5b1685=_0x112b4b;_0x826394=0xc8;}else{_0x826394=0xce;}_0x4b7598[_0xcde1('0x1a')](_0x826394);return _0x4b7598['set'](_0xcde1('0x20'),_0x1fb892+'-'+_0x5b1685+'/'+_0x112b4b)[_0xcde1('0x21')](_0x53a7e5);}return null;};}function patchUpdates(_0x3042bd){return function(_0x28d2b7){try{jsonpatch[_0xcde1('0x22')](_0x28d2b7,_0x3042bd,!![]);}catch(_0x5642f6){return BPromise[_0xcde1('0x23')](_0x5642f6);}return _0x28d2b7[_0xcde1('0x24')]();};}function saveUpdates(_0x5c7e87,_0x4a4f51){return function(_0x13aca4){if(_0x13aca4){return _0x13aca4[_0xcde1('0x25')](_0x5c7e87)['then'](function(_0x407dbb){return _0x407dbb;});}return null;};}function removeEntity(_0x376c63,_0x4090ff){return function(_0x32c4e4){if(_0x32c4e4){return _0x32c4e4[_0xcde1('0x26')]()['then'](function(){_0x376c63[_0xcde1('0x1a')](0xcc)[_0xcde1('0x1b')]();});}};}function handleEntityNotFound(_0x200e1f,_0x320676){return function(_0x36333f){if(!_0x36333f){_0x200e1f[_0xcde1('0x19')](0x194);}return _0x36333f;};}function handleError(_0x3d0693,_0x232d0b){_0x232d0b=_0x232d0b||0x1f4;return function(_0x175602){logger[_0xcde1('0x27')](_0x175602[_0xcde1('0x28')]);if(_0x175602[_0xcde1('0x29')]){delete _0x175602[_0xcde1('0x29')];}_0x3d0693['status'](_0x232d0b)['send'](_0x175602);};}exports[_0xcde1('0x2a')]=function(_0x2cee2e,_0x1f32c5){var _0x41fe56={},_0xe7124e={},_0x1785dc={'count':0x0,'rows':[]};var _0x3747c6=_['map'](db[_0xcde1('0x2b')][_0xcde1('0x2c')],function(_0xa4a5a4){return{'name':_0xa4a5a4['fieldName'],'type':_0xa4a5a4[_0xcde1('0x2d')][_0xcde1('0x2e')]};});_0xe7124e['model']=_[_0xcde1('0x2f')](_0x3747c6,_0xcde1('0x29'));_0xe7124e[_0xcde1('0x30')]=_[_0xcde1('0x31')](_0x2cee2e['query']);_0xe7124e[_0xcde1('0x32')]=_['intersection'](_0xe7124e['model'],_0xe7124e['query']);_0x41fe56[_0xcde1('0x33')]=_[_0xcde1('0x34')](_0xe7124e['model'],qs[_0xcde1('0x35')](_0x2cee2e['query'][_0xcde1('0x35')]));_0x41fe56[_0xcde1('0x33')]=_0x41fe56[_0xcde1('0x33')]['length']?_0x41fe56[_0xcde1('0x33')]:_0xe7124e['model'];if(!_0x2cee2e['query']['hasOwnProperty'](_0xcde1('0x36'))){_0x41fe56['limit']=qs['limit'](_0x2cee2e[_0xcde1('0x30')][_0xcde1('0x1e')]);_0x41fe56['offset']=qs[_0xcde1('0x1c')](_0x2cee2e[_0xcde1('0x30')][_0xcde1('0x1c')]);}_0x41fe56['order']=qs[_0xcde1('0x37')](_0x2cee2e[_0xcde1('0x30')][_0xcde1('0x37')]);_0x41fe56['where']=qs['filters'](_[_0xcde1('0x38')](_0x2cee2e[_0xcde1('0x30')],_0xe7124e['filters']),_0x3747c6);if(_0x2cee2e['query']['filter']){_0x41fe56[_0xcde1('0x39')]=_[_0xcde1('0x3a')](_0x41fe56[_0xcde1('0x39')],{'$or':_['map'](_0x3747c6,function(_0x90bf1e){if(_0x90bf1e[_0xcde1('0x2d')]!=='VIRTUAL'){var _0x194999={};_0x194999[_0x90bf1e[_0xcde1('0x29')]]={'$like':'%'+_0x2cee2e['query'][_0xcde1('0x3b')]+'%'};return _0x194999;}})});}_0x41fe56=_['merge']({},_0x41fe56,_0x2cee2e['options']);var _0x5c8840={'where':_0x41fe56[_0xcde1('0x39')]};return db[_0xcde1('0x2b')][_0xcde1('0x1f')](_0x5c8840)[_0xcde1('0x3c')](function(_0xc47258){_0x1785dc[_0xcde1('0x1f')]=_0xc47258;if(_0x2cee2e['query'][_0xcde1('0x3d')]){_0x41fe56[_0xcde1('0x3e')]=[{'all':!![]}];}return db[_0xcde1('0x2b')]['findAll'](_0x41fe56);})[_0xcde1('0x3c')](function(_0x2f7ad8){_0x1785dc[_0xcde1('0x3f')]=_0x2f7ad8;return _0x1785dc;})[_0xcde1('0x3c')](respondWithFilteredResult(_0x1f32c5,_0x41fe56))['catch'](handleError(_0x1f32c5,null));};exports[_0xcde1('0x40')]=function(_0x2cd166,_0x2be6e2){var _0x55549d={'raw':![],'where':{'id':_0x2cd166[_0xcde1('0x41')]['id']}},_0x22ad97={};_0x22ad97['model']=_[_0xcde1('0x31')](db[_0xcde1('0x2b')][_0xcde1('0x2c')]);_0x22ad97[_0xcde1('0x30')]=_['keys'](_0x2cd166[_0xcde1('0x30')]);_0x22ad97[_0xcde1('0x32')]=_[_0xcde1('0x34')](_0x22ad97[_0xcde1('0x42')],_0x22ad97['query']);_0x55549d['attributes']=_[_0xcde1('0x34')](_0x22ad97[_0xcde1('0x42')],qs[_0xcde1('0x35')](_0x2cd166[_0xcde1('0x30')]['fields']));_0x55549d['attributes']=_0x55549d[_0xcde1('0x33')][_0xcde1('0x43')]?_0x55549d[_0xcde1('0x33')]:_0x22ad97[_0xcde1('0x42')];if(_0x2cd166[_0xcde1('0x30')]['includeAll']){_0x55549d[_0xcde1('0x3e')]=[{'all':!![]}];}_0x55549d=_[_0xcde1('0x3a')]({},_0x55549d,_0x2cd166[_0xcde1('0x44')]);return db[_0xcde1('0x2b')][_0xcde1('0x45')](_0x55549d)[_0xcde1('0x3c')](handleEntityNotFound(_0x2be6e2,null))[_0xcde1('0x3c')](respondWithResult(_0x2be6e2,null))[_0xcde1('0x46')](handleError(_0x2be6e2,null));};exports[_0xcde1('0x47')]=function(_0x37087d,_0x564e83){return db['FreshsalesConfiguration'][_0xcde1('0x47')](_0x37087d[_0xcde1('0x48')],{})[_0xcde1('0x3c')](respondWithResult(_0x564e83,0xc9))['catch'](handleError(_0x564e83,null));};exports['update']=function(_0x4bf0d8,_0x294614){if(_0x4bf0d8['body']['id']){delete _0x4bf0d8[_0xcde1('0x48')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4bf0d8[_0xcde1('0x41')]['id']}})[_0xcde1('0x3c')](handleEntityNotFound(_0x294614,null))[_0xcde1('0x3c')](saveUpdates(_0x4bf0d8['body'],null))[_0xcde1('0x3c')](respondWithResult(_0x294614,null))[_0xcde1('0x46')](handleError(_0x294614,null));};exports['destroy']=function(_0x57104b,_0xce478d){return db[_0xcde1('0x2b')][_0xcde1('0x45')]({'where':{'id':_0x57104b[_0xcde1('0x41')]['id']}})[_0xcde1('0x3c')](handleEntityNotFound(_0xce478d,null))[_0xcde1('0x3c')](removeEntity(_0xce478d,null))[_0xcde1('0x46')](handleError(_0xce478d,null));};exports[_0xcde1('0x49')]=function(_0x2ce837,_0x594bed,_0x900971){var _0x2a82a7={};var _0x45c2d2={};var _0x5b144a;var _0x50251a;return db['FreshsalesConfiguration'][_0xcde1('0x4a')]({'where':{'id':_0x2ce837[_0xcde1('0x41')]['id']}})[_0xcde1('0x3c')](handleEntityNotFound(_0x594bed,null))[_0xcde1('0x3c')](function(_0x55518b){if(_0x55518b){_0x5b144a=_0x55518b;_0x45c2d2[_0xcde1('0x42')]=_[_0xcde1('0x31')](db['FreshsalesField'][_0xcde1('0x2c')]);_0x45c2d2[_0xcde1('0x30')]=_[_0xcde1('0x31')](_0x2ce837[_0xcde1('0x30')]);_0x45c2d2['filters']=_[_0xcde1('0x34')](_0x45c2d2[_0xcde1('0x42')],_0x45c2d2[_0xcde1('0x30')]);_0x2a82a7[_0xcde1('0x33')]=_[_0xcde1('0x34')](_0x45c2d2[_0xcde1('0x42')],qs[_0xcde1('0x35')](_0x2ce837[_0xcde1('0x30')]['fields']));_0x2a82a7[_0xcde1('0x33')]=_0x2a82a7['attributes'][_0xcde1('0x43')]?_0x2a82a7[_0xcde1('0x33')]:_0x45c2d2['model'];_0x2a82a7[_0xcde1('0x4b')]=qs[_0xcde1('0x37')](_0x2ce837[_0xcde1('0x30')][_0xcde1('0x37')]);_0x2a82a7[_0xcde1('0x39')]=qs[_0xcde1('0x32')](_[_0xcde1('0x38')](_0x2ce837['query'],_0x45c2d2[_0xcde1('0x32')]));if(_0x2ce837[_0xcde1('0x30')][_0xcde1('0x3b')]){_0x2a82a7['where']=_[_0xcde1('0x3a')](_0x2a82a7[_0xcde1('0x39')],{'$or':_[_0xcde1('0x2f')](_0x2a82a7[_0xcde1('0x33')],function(_0x32cd3f){var _0x58663e={};_0x58663e[_0x32cd3f]={'$like':'%'+_0x2ce837[_0xcde1('0x30')][_0xcde1('0x3b')]+'%'};return _0x58663e;})});}_0x2a82a7=_['merge']({},_0x2a82a7,_0x2ce837[_0xcde1('0x44')]);return _0x5b144a[_0xcde1('0x49')](_0x2a82a7);}})[_0xcde1('0x3c')](function(_0x32c7b4){if(_0x32c7b4){_0x50251a=_0x32c7b4['length'];if(!_0x2ce837[_0xcde1('0x30')][_0xcde1('0x4c')](_0xcde1('0x36'))){_0x2a82a7[_0xcde1('0x1e')]=qs[_0xcde1('0x1e')](_0x2ce837['query'][_0xcde1('0x1e')]);_0x2a82a7[_0xcde1('0x1c')]=qs[_0xcde1('0x1c')](_0x2ce837['query']['offset']);}return _0x5b144a['getSubjects'](_0x2a82a7);}})[_0xcde1('0x3c')](function(_0x5cc7a7){if(_0x5cc7a7){return _0x5cc7a7?{'count':_0x50251a,'rows':_0x5cc7a7}:null;}})[_0xcde1('0x3c')](respondWithResult(_0x594bed,null))[_0xcde1('0x46')](handleError(_0x594bed,null));};exports['getDescriptions']=function(_0x46b789,_0x408377,_0x3e7fb9){var _0x5e6a37={};var _0x4e6dcb={};var _0x4a7a9e;var _0x8f2180;return db['FreshsalesConfiguration'][_0xcde1('0x4a')]({'where':{'id':_0x46b789[_0xcde1('0x41')]['id']}})[_0xcde1('0x3c')](handleEntityNotFound(_0x408377,null))[_0xcde1('0x3c')](function(_0x27bfd7){if(_0x27bfd7){_0x4a7a9e=_0x27bfd7;_0x4e6dcb[_0xcde1('0x42')]=_['keys'](db[_0xcde1('0x4d')][_0xcde1('0x2c')]);_0x4e6dcb[_0xcde1('0x30')]=_[_0xcde1('0x31')](_0x46b789['query']);_0x4e6dcb[_0xcde1('0x32')]=_[_0xcde1('0x34')](_0x4e6dcb[_0xcde1('0x42')],_0x4e6dcb[_0xcde1('0x30')]);_0x5e6a37[_0xcde1('0x33')]=_[_0xcde1('0x34')](_0x4e6dcb[_0xcde1('0x42')],qs[_0xcde1('0x35')](_0x46b789[_0xcde1('0x30')][_0xcde1('0x35')]));_0x5e6a37['attributes']=_0x5e6a37[_0xcde1('0x33')][_0xcde1('0x43')]?_0x5e6a37[_0xcde1('0x33')]:_0x4e6dcb[_0xcde1('0x42')];_0x5e6a37[_0xcde1('0x4b')]=qs['sort'](_0x46b789[_0xcde1('0x30')][_0xcde1('0x37')]);_0x5e6a37[_0xcde1('0x39')]=qs[_0xcde1('0x32')](_['pick'](_0x46b789[_0xcde1('0x30')],_0x4e6dcb[_0xcde1('0x32')]));if(_0x46b789[_0xcde1('0x30')][_0xcde1('0x3b')]){_0x5e6a37[_0xcde1('0x39')]=_[_0xcde1('0x3a')](_0x5e6a37[_0xcde1('0x39')],{'$or':_[_0xcde1('0x2f')](_0x5e6a37['attributes'],function(_0x5c475e){var _0x435f6e={};_0x435f6e[_0x5c475e]={'$like':'%'+_0x46b789[_0xcde1('0x30')][_0xcde1('0x3b')]+'%'};return _0x435f6e;})});}_0x5e6a37=_[_0xcde1('0x3a')]({},_0x5e6a37,_0x46b789[_0xcde1('0x44')]);return _0x4a7a9e['getDescriptions'](_0x5e6a37);}})[_0xcde1('0x3c')](function(_0xc57d1f){if(_0xc57d1f){_0x8f2180=_0xc57d1f[_0xcde1('0x43')];if(!_0x46b789[_0xcde1('0x30')][_0xcde1('0x4c')](_0xcde1('0x36'))){_0x5e6a37['limit']=qs[_0xcde1('0x1e')](_0x46b789[_0xcde1('0x30')][_0xcde1('0x1e')]);_0x5e6a37[_0xcde1('0x1c')]=qs[_0xcde1('0x1c')](_0x46b789[_0xcde1('0x30')][_0xcde1('0x1c')]);}return _0x4a7a9e[_0xcde1('0x4e')](_0x5e6a37);}})[_0xcde1('0x3c')](function(_0x1d631f){if(_0x1d631f){return _0x1d631f?{'count':_0x8f2180,'rows':_0x1d631f}:null;}})[_0xcde1('0x3c')](respondWithResult(_0x408377,null))[_0xcde1('0x46')](handleError(_0x408377,null));};exports['getFields']=function(_0x3b245f,_0x3376a8,_0x5c8dfd){var _0x245347={};var _0x5dcbf3={};var _0x3ae285;var _0x57c61b;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3b245f[_0xcde1('0x41')]['id']}})[_0xcde1('0x3c')](handleEntityNotFound(_0x3376a8,null))['then'](function(_0x12a200){if(_0x12a200){_0x3ae285=_0x12a200;_0x5dcbf3['model']=_[_0xcde1('0x31')](db[_0xcde1('0x4d')]['rawAttributes']);_0x5dcbf3[_0xcde1('0x30')]=_['keys'](_0x3b245f[_0xcde1('0x30')]);_0x5dcbf3[_0xcde1('0x32')]=_['intersection'](_0x5dcbf3[_0xcde1('0x42')],_0x5dcbf3[_0xcde1('0x30')]);_0x245347[_0xcde1('0x33')]=_['intersection'](_0x5dcbf3[_0xcde1('0x42')],qs[_0xcde1('0x35')](_0x3b245f['query'][_0xcde1('0x35')]));_0x245347[_0xcde1('0x33')]=_0x245347[_0xcde1('0x33')]['length']?_0x245347[_0xcde1('0x33')]:_0x5dcbf3[_0xcde1('0x42')];_0x245347['order']=qs[_0xcde1('0x37')](_0x3b245f['query'][_0xcde1('0x37')]);_0x245347[_0xcde1('0x39')]=qs['filters'](_['pick'](_0x3b245f[_0xcde1('0x30')],_0x5dcbf3['filters']));if(_0x3b245f[_0xcde1('0x30')]['filter']){_0x245347[_0xcde1('0x39')]=_['merge'](_0x245347['where'],{'$or':_[_0xcde1('0x2f')](_0x245347[_0xcde1('0x33')],function(_0x63773c){var _0x188b3a={};_0x188b3a[_0x63773c]={'$like':'%'+_0x3b245f[_0xcde1('0x30')]['filter']+'%'};return _0x188b3a;})});}_0x245347=_['merge']({},_0x245347,_0x3b245f[_0xcde1('0x44')]);return _0x3ae285[_0xcde1('0x4f')](_0x245347);}})['then'](function(_0x10de28){if(_0x10de28){_0x57c61b=_0x10de28[_0xcde1('0x43')];if(!_0x3b245f[_0xcde1('0x30')][_0xcde1('0x4c')](_0xcde1('0x36'))){_0x245347[_0xcde1('0x1e')]=qs['limit'](_0x3b245f['query']['limit']);_0x245347[_0xcde1('0x1c')]=qs[_0xcde1('0x1c')](_0x3b245f['query'][_0xcde1('0x1c')]);}return _0x3ae285['getFields'](_0x245347);}})[_0xcde1('0x3c')](function(_0x4a2ea9){if(_0x4a2ea9){return _0x4a2ea9?{'count':_0x57c61b,'rows':_0x4a2ea9}:null;}})[_0xcde1('0x3c')](respondWithResult(_0x3376a8,null))[_0xcde1('0x46')](handleError(_0x3376a8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 107ce1e..62d06c5 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 _0xfb60=['path','rimraf','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','moment','bluebird'];(function(_0x46c2fa,_0x4fd8f9){var _0x5f5035=function(_0x5e037d){while(--_0x5e037d){_0x46c2fa['push'](_0x46c2fa['shift']());}};_0x5f5035(++_0x4fd8f9);}(_0xfb60,0xa6));var _0x0fb6=function(_0x1dd7c0,_0x3e00c2){_0x1dd7c0=_0x1dd7c0-0x0;var _0x3e40cf=_0xfb60[_0x1dd7c0];return _0x3e40cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0fb6('0x0'));var BPromise=require(_0x0fb6('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fb6('0x2'));var rimraf=require(_0x0fb6('0x3'));var config=require(_0x0fb6('0x4'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x5ed787,_0x7b957b){return _0x5ed787[_0x0fb6('0x5')](_0x0fb6('0x6'),attributes,{'tableName':_0x0fb6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44bf=['int_freshsales_configurations','api','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x51f5e8,_0x21245a){var _0x51b2c0=function(_0xfc076c){while(--_0xfc076c){_0x51f5e8['push'](_0x51f5e8['shift']());}};_0x51b2c0(++_0x21245a);}(_0x44bf,0x169));var _0xf44b=function(_0x49c0aa,_0xe1de48){_0x49c0aa=_0x49c0aa-0x0;var _0x1fec56=_0x44bf[_0x49c0aa];return _0x1fec56;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf44b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf44b('0x1'));var fs=require('fs');var path=require(_0xf44b('0x2'));var rimraf=require(_0xf44b('0x3'));var config=require('../../config/environment');var attributes=require(_0xf44b('0x4'));module[_0xf44b('0x5')]=function(_0x4e7a5f,_0x2a1314){return _0x4e7a5f[_0xf44b('0x6')](_0xf44b('0x7'),attributes,{'tableName':_0xf44b('0x8'),'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 3288202..66da031 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 _0x04c8=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x51a5c3,_0x4a01a9){var _0x55bfc3=function(_0x4147b3){while(--_0x4147b3){_0x51a5c3['push'](_0x51a5c3['shift']());}};_0x55bfc3(++_0x4a01a9);}(_0x04c8,0xca));var _0x804c=function(_0x5ac24d,_0x40917c){_0x5ac24d=_0x5ac24d-0x0;var _0x37e625=_0x04c8[_0x5ac24d];return _0x37e625;};'use strict';var _=require(_0x804c('0x0'));var util=require(_0x804c('0x1'));var moment=require(_0x804c('0x2'));var BPromise=require(_0x804c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x804c('0x4'));var db=require(_0x804c('0x5'))['db'];var utils=require(_0x804c('0x6'));var logger=require(_0x804c('0x7'))('rpc');var config=require(_0x804c('0x8'));var jayson=require(_0x804c('0x9'));var client=jayson['client'][_0x804c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5377a9,_0x397a63,_0x2e5310){return new BPromise(function(_0x1dccfa,_0x50bc9a){return client[_0x804c('0xb')](_0x5377a9,_0x2e5310)[_0x804c('0xc')](function(_0xccad34){logger[_0x804c('0xd')](_0x804c('0xe'),_0x397a63,'request\x20sent');logger[_0x804c('0xf')](_0x804c('0x10'),_0x397a63,_0x804c('0x11'),JSON[_0x804c('0x12')](_0xccad34));if(_0xccad34['error']){if(_0xccad34['error'][_0x804c('0x13')]===0x1f4){logger['error'](_0x804c('0xe'),_0x397a63,_0xccad34[_0x804c('0x14')]['message']);return _0x50bc9a(_0xccad34['error']['message']);}logger[_0x804c('0x14')](_0x804c('0xe'),_0x397a63,_0xccad34[_0x804c('0x14')][_0x804c('0x15')]);return _0x1dccfa(_0xccad34[_0x804c('0x14')][_0x804c('0x15')]);}else{logger[_0x804c('0xd')](_0x804c('0xe'),_0x397a63,'request\x20sent');_0x1dccfa(_0xccad34['result']['message']);}})[_0x804c('0x16')](function(_0x326f32){logger[_0x804c('0x14')](_0x804c('0xe'),_0x397a63,_0x326f32);_0x50bc9a(_0x326f32);});});} \ No newline at end of file +var _0xaf91=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x4dff61,_0x589c9d){var _0x144042=function(_0x5106d0){while(--_0x5106d0){_0x4dff61['push'](_0x4dff61['shift']());}};_0x144042(++_0x589c9d);}(_0xaf91,0x1d7));var _0x1af9=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0xaf91[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0x1af9('0x0'));var util=require(_0x1af9('0x1'));var moment=require(_0x1af9('0x2'));var BPromise=require('bluebird');var rs=require(_0x1af9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1af9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1af9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1af9('0x6'));var client=jayson[_0x1af9('0x7')][_0x1af9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2643a1,_0x325cf5,_0x42b0f0){return new BPromise(function(_0x40acbd,_0x5410f1){return client[_0x1af9('0x9')](_0x2643a1,_0x42b0f0)[_0x1af9('0xa')](function(_0x41306c){logger[_0x1af9('0xb')](_0x1af9('0xc'),_0x325cf5,_0x1af9('0xd'));logger[_0x1af9('0xe')](_0x1af9('0xf'),_0x325cf5,_0x1af9('0xd'),JSON[_0x1af9('0x10')](_0x41306c));if(_0x41306c[_0x1af9('0x11')]){if(_0x41306c[_0x1af9('0x11')]['code']===0x1f4){logger[_0x1af9('0x11')](_0x1af9('0xc'),_0x325cf5,_0x41306c[_0x1af9('0x11')][_0x1af9('0x12')]);return _0x5410f1(_0x41306c[_0x1af9('0x11')][_0x1af9('0x12')]);}logger[_0x1af9('0x11')](_0x1af9('0xc'),_0x325cf5,_0x41306c[_0x1af9('0x11')][_0x1af9('0x12')]);return _0x40acbd(_0x41306c[_0x1af9('0x11')][_0x1af9('0x12')]);}else{logger[_0x1af9('0xb')](_0x1af9('0xc'),_0x325cf5,_0x1af9('0xd'));_0x40acbd(_0x41306c['result'][_0x1af9('0x12')]);}})[_0x1af9('0x13')](function(_0x62fb54){logger['error'](_0x1af9('0xc'),_0x325cf5,_0x62fb54);_0x5410f1(_0x62fb54);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a6b1823..e925b8d 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 _0xf00e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','delete','destroy','multer','util','path'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xf00e,0x12f));var _0xef00=function(_0x482604,_0x5169df){_0x482604=_0x482604-0x0;var _0x291eac=_0xf00e[_0x482604];return _0x291eac;};'use strict';var multer=require(_0xef00('0x0'));var util=require(_0xef00('0x1'));var path=require(_0xef00('0x2'));var timeout=require(_0xef00('0x3'));var express=require(_0xef00('0x4'));var router=express[_0xef00('0x5')]();var fs_extra=require(_0xef00('0x6'));var auth=require(_0xef00('0x7'));var interaction=require(_0xef00('0x8'));var config=require(_0xef00('0x9'));var controller=require(_0xef00('0xa'));router[_0xef00('0xb')]('/',auth[_0xef00('0xc')](),controller[_0xef00('0xd')]);router[_0xef00('0xb')](_0xef00('0xe'),auth[_0xef00('0xc')](),controller[_0xef00('0xf')]);router['post']('/',auth[_0xef00('0xc')](),controller['create']);router['put'](_0xef00('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xef00('0x10')]('/:id',auth[_0xef00('0xc')](),controller[_0xef00('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9063=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0xdea1ee,_0x2d2841){var _0x96c530=function(_0x4e743b){while(--_0x4e743b){_0xdea1ee['push'](_0xdea1ee['shift']());}};_0x96c530(++_0x2d2841);}(_0x9063,0x1a2));var _0x3906=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x9063[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var path=require(_0x3906('0x2'));var timeout=require(_0x3906('0x3'));var express=require(_0x3906('0x4'));var router=express[_0x3906('0x5')]();var fs_extra=require(_0x3906('0x6'));var auth=require(_0x3906('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3906('0x8'));var controller=require(_0x3906('0x9'));router[_0x3906('0xa')]('/',auth[_0x3906('0xb')](),controller[_0x3906('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3906('0xd')]);router[_0x3906('0xe')]('/',auth[_0x3906('0xb')](),controller['create']);router[_0x3906('0xf')](_0x3906('0x10'),auth['isAuthenticated'](),controller[_0x3906('0x11')]);router[_0x3906('0x12')](_0x3906('0x10'),auth['isAuthenticated'](),controller[_0x3906('0x13')]);module[_0x3906('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6f9a813..ca398dd 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 _0xf88a=['customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x1141b1,_0x1269ec){var _0x596809=function(_0x5a53dc){while(--_0x5a53dc){_0x1141b1['push'](_0x1141b1['shift']());}};_0x596809(++_0x1269ec);}(_0xf88a,0x1eb));var _0xaf88=function(_0x1e5786,_0x1560fc){_0x1e5786=_0x1e5786-0x0;var _0x56daa3=_0xf88a[_0x1e5786];return _0x56daa3;};'use strict';var Sequelize=require(_0xaf88('0x0'));module[_0xaf88('0x1')]={'type':{'type':Sequelize[_0xaf88('0x2')]('string',_0xaf88('0x3'),_0xaf88('0x4'),'keyValue',_0xaf88('0x5')),'defaultValue':_0xaf88('0x6')},'content':{'type':Sequelize[_0xaf88('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaf88('0x2')]('string',_0xaf88('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xaf88('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaf88('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ec9=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4ec9,0x9a));var _0x94ec=function(_0x423797,_0x3d393b){_0x423797=_0x423797-0x0;var _0x57ec0c=_0x4ec9[_0x423797];return _0x57ec0c;};'use strict';var Sequelize=require(_0x94ec('0x0'));module[_0x94ec('0x1')]={'type':{'type':Sequelize[_0x94ec('0x2')](_0x94ec('0x3'),_0x94ec('0x4'),_0x94ec('0x5'),_0x94ec('0x6'),_0x94ec('0x7')),'defaultValue':_0x94ec('0x3')},'content':{'type':Sequelize[_0x94ec('0x8')]},'key':{'type':Sequelize[_0x94ec('0x8')]},'keyType':{'type':Sequelize[_0x94ec('0x2')]('string',_0x94ec('0x4'),_0x94ec('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x94ec('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 862eda2..3481787 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 _0x5aa5=['undefined','limit','count','set','json','apply','save','update','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','include','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset'];(function(_0x7e03c4,_0x2a43f0){var _0xe01f=function(_0x4fb07a){while(--_0x4fb07a){_0x7e03c4['push'](_0x7e03c4['shift']());}};_0xe01f(++_0x2a43f0);}(_0x5aa5,0xbd));var _0x55aa=function(_0x255214,_0x1ea2e4){_0x255214=_0x255214-0x0;var _0x2593b0=_0x5aa5[_0x255214];return _0x2593b0;};'use strict';var emlformat=require(_0x55aa('0x0'));var rimraf=require(_0x55aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55aa('0x2'));var rp=require(_0x55aa('0x3'));var moment=require(_0x55aa('0x4'));var BPromise=require(_0x55aa('0x5'));var Mustache=require(_0x55aa('0x6'));var util=require(_0x55aa('0x7'));var path=require(_0x55aa('0x8'));var sox=require(_0x55aa('0x9'));var csv=require(_0x55aa('0xa'));var ejs=require(_0x55aa('0xb'));var fs=require('fs');var fs_extra=require(_0x55aa('0xc'));var _=require(_0x55aa('0xd'));var squel=require('squel');var crypto=require(_0x55aa('0xe'));var jsforce=require(_0x55aa('0xf'));var deskjs=require(_0x55aa('0x10'));var toCsv=require(_0x55aa('0xa'));var querystring=require(_0x55aa('0x11'));var Papa=require(_0x55aa('0x12'));var Redis=require(_0x55aa('0x13'));var authService=require(_0x55aa('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x55aa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55aa('0x16'))(_0x55aa('0x17'));var utils=require('../../config/utils');var config=require(_0x55aa('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x55aa('0x19'))['db'];function respondWithStatusCode(_0x37d39a,_0x3e5577){_0x3e5577=_0x3e5577||0xcc;return function(_0x27e3ab){if(_0x27e3ab){return _0x37d39a[_0x55aa('0x1a')](_0x3e5577);}return _0x37d39a[_0x55aa('0x1b')](_0x3e5577)[_0x55aa('0x1c')]();};}function respondWithResult(_0x1f7903,_0x4de334){_0x4de334=_0x4de334||0xc8;return function(_0x3b38c2){if(_0x3b38c2){return _0x1f7903[_0x55aa('0x1b')](_0x4de334)['json'](_0x3b38c2);}};}function respondWithFilteredResult(_0xc05c7,_0x1f7a5d){return function(_0x350b23){if(_0x350b23){var _0x48f38f=typeof _0x1f7a5d[_0x55aa('0x1d')]===_0x55aa('0x1e')&&typeof _0x1f7a5d[_0x55aa('0x1f')]===_0x55aa('0x1e');var _0x37001a=_0x350b23['count'];var _0x48093f=_0x48f38f?0x0:_0x1f7a5d[_0x55aa('0x1d')];var _0x7a5291=_0x48f38f?_0x350b23[_0x55aa('0x20')]:_0x1f7a5d[_0x55aa('0x1d')]+_0x1f7a5d['limit'];var _0x4700fe;if(_0x7a5291>=_0x37001a){_0x7a5291=_0x37001a;_0x4700fe=0xc8;}else{_0x4700fe=0xce;}_0xc05c7[_0x55aa('0x1b')](_0x4700fe);return _0xc05c7[_0x55aa('0x21')]('Content-Range',_0x48093f+'-'+_0x7a5291+'/'+_0x37001a)[_0x55aa('0x22')](_0x350b23);}return null;};}function patchUpdates(_0x2a731a){return function(_0x51544b){try{jsonpatch[_0x55aa('0x23')](_0x51544b,_0x2a731a,!![]);}catch(_0x432aea){return BPromise['reject'](_0x432aea);}return _0x51544b[_0x55aa('0x24')]();};}function saveUpdates(_0x1ab851,_0x33d348){return function(_0x2ab107){if(_0x2ab107){return _0x2ab107[_0x55aa('0x25')](_0x1ab851)[_0x55aa('0x26')](function(_0x48bad4){return _0x48bad4;});}return null;};}function removeEntity(_0x22b902,_0x45db10){return function(_0x2f6aa6){if(_0x2f6aa6){return _0x2f6aa6[_0x55aa('0x27')]()[_0x55aa('0x26')](function(){_0x22b902['status'](0xcc)[_0x55aa('0x1c')]();});}};}function handleEntityNotFound(_0x4e15c6,_0x333a96){return function(_0x56cfb1){if(!_0x56cfb1){_0x4e15c6[_0x55aa('0x1a')](0x194);}return _0x56cfb1;};}function handleError(_0x7de3b9,_0x37fe62){_0x37fe62=_0x37fe62||0x1f4;return function(_0xcdf62a){logger[_0x55aa('0x28')](_0xcdf62a[_0x55aa('0x29')]);if(_0xcdf62a[_0x55aa('0x2a')]){delete _0xcdf62a[_0x55aa('0x2a')];}_0x7de3b9[_0x55aa('0x1b')](_0x37fe62)['send'](_0xcdf62a);};}exports[_0x55aa('0x2b')]=function(_0xf4b611,_0x1e098e){var _0x191b62={},_0xef84b2={},_0x5a0a36={'count':0x0,'rows':[]};var _0x2504c0=_[_0x55aa('0x2c')](db[_0x55aa('0x2d')][_0x55aa('0x2e')],function(_0x1eb511){return{'name':_0x1eb511['fieldName'],'type':_0x1eb511[_0x55aa('0x2f')]['key']};});_0xef84b2[_0x55aa('0x30')]=_[_0x55aa('0x2c')](_0x2504c0,_0x55aa('0x2a'));_0xef84b2['query']=_[_0x55aa('0x31')](_0xf4b611[_0x55aa('0x32')]);_0xef84b2[_0x55aa('0x33')]=_[_0x55aa('0x34')](_0xef84b2[_0x55aa('0x30')],_0xef84b2['query']);_0x191b62[_0x55aa('0x35')]=_['intersection'](_0xef84b2[_0x55aa('0x30')],qs['fields'](_0xf4b611['query'][_0x55aa('0x36')]));_0x191b62['attributes']=_0x191b62[_0x55aa('0x35')][_0x55aa('0x37')]?_0x191b62[_0x55aa('0x35')]:_0xef84b2[_0x55aa('0x30')];if(!_0xf4b611[_0x55aa('0x32')]['hasOwnProperty'](_0x55aa('0x38'))){_0x191b62[_0x55aa('0x1f')]=qs['limit'](_0xf4b611[_0x55aa('0x32')]['limit']);_0x191b62['offset']=qs[_0x55aa('0x1d')](_0xf4b611[_0x55aa('0x32')]['offset']);}_0x191b62[_0x55aa('0x39')]=qs[_0x55aa('0x3a')](_0xf4b611[_0x55aa('0x32')][_0x55aa('0x3a')]);_0x191b62['where']=qs['filters'](_[_0x55aa('0x3b')](_0xf4b611[_0x55aa('0x32')],_0xef84b2['filters']),_0x2504c0);if(_0xf4b611[_0x55aa('0x32')][_0x55aa('0x3c')]){_0x191b62[_0x55aa('0x3d')]=_[_0x55aa('0x3e')](_0x191b62['where'],{'$or':_[_0x55aa('0x2c')](_0x2504c0,function(_0x24feb4){if(_0x24feb4[_0x55aa('0x2f')]!==_0x55aa('0x3f')){var _0x3153ee={};_0x3153ee[_0x24feb4[_0x55aa('0x2a')]]={'$like':'%'+_0xf4b611[_0x55aa('0x32')]['filter']+'%'};return _0x3153ee;}})});}_0x191b62=_[_0x55aa('0x3e')]({},_0x191b62,_0xf4b611[_0x55aa('0x40')]);var _0x247e2d={'where':_0x191b62['where']};return db[_0x55aa('0x2d')][_0x55aa('0x20')](_0x247e2d)[_0x55aa('0x26')](function(_0x26535b){_0x5a0a36[_0x55aa('0x20')]=_0x26535b;if(_0xf4b611[_0x55aa('0x32')]['includeAll']){_0x191b62['include']=[{'all':!![]}];}return db[_0x55aa('0x2d')][_0x55aa('0x41')](_0x191b62);})[_0x55aa('0x26')](function(_0x287d7c){_0x5a0a36[_0x55aa('0x42')]=_0x287d7c;return _0x5a0a36;})[_0x55aa('0x26')](respondWithFilteredResult(_0x1e098e,_0x191b62))[_0x55aa('0x43')](handleError(_0x1e098e,null));};exports['show']=function(_0x37189f,_0x21ec4a){var _0x5b65f6={'raw':!![],'where':{'id':_0x37189f['params']['id']}},_0x97734a={};_0x97734a[_0x55aa('0x30')]=_[_0x55aa('0x31')](db[_0x55aa('0x2d')][_0x55aa('0x2e')]);_0x97734a[_0x55aa('0x32')]=_['keys'](_0x37189f['query']);_0x97734a['filters']=_[_0x55aa('0x34')](_0x97734a[_0x55aa('0x30')],_0x97734a['query']);_0x5b65f6['attributes']=_[_0x55aa('0x34')](_0x97734a[_0x55aa('0x30')],qs['fields'](_0x37189f[_0x55aa('0x32')]['fields']));_0x5b65f6[_0x55aa('0x35')]=_0x5b65f6[_0x55aa('0x35')][_0x55aa('0x37')]?_0x5b65f6[_0x55aa('0x35')]:_0x97734a['model'];if(_0x37189f['query']['includeAll']){_0x5b65f6[_0x55aa('0x44')]=[{'all':!![]}];}_0x5b65f6=_['merge']({},_0x5b65f6,_0x37189f['options']);return db[_0x55aa('0x2d')]['find'](_0x5b65f6)[_0x55aa('0x26')](handleEntityNotFound(_0x21ec4a,null))['then'](respondWithResult(_0x21ec4a,null))['catch'](handleError(_0x21ec4a,null));};exports[_0x55aa('0x45')]=function(_0x279ae3,_0x2d2e28){return db['FreshsalesField'][_0x55aa('0x45')](_0x279ae3['body'],{})[_0x55aa('0x26')](respondWithResult(_0x2d2e28,0xc9))['catch'](handleError(_0x2d2e28,null));};exports[_0x55aa('0x25')]=function(_0x33c494,_0x406fe8){if(_0x33c494['body']['id']){delete _0x33c494[_0x55aa('0x46')]['id'];}return db[_0x55aa('0x2d')][_0x55aa('0x47')]({'where':{'id':_0x33c494[_0x55aa('0x48')]['id']}})[_0x55aa('0x26')](handleEntityNotFound(_0x406fe8,null))[_0x55aa('0x26')](saveUpdates(_0x33c494[_0x55aa('0x46')],null))[_0x55aa('0x26')](respondWithResult(_0x406fe8,null))[_0x55aa('0x43')](handleError(_0x406fe8,null));};exports[_0x55aa('0x27')]=function(_0x4cd71d,_0x4eee06){return db[_0x55aa('0x2d')]['find']({'where':{'id':_0x4cd71d[_0x55aa('0x48')]['id']}})['then'](handleEntityNotFound(_0x4eee06,null))['then'](removeEntity(_0x4eee06,null))[_0x55aa('0x43')](handleError(_0x4eee06,null));}; \ No newline at end of file +var _0x2f29=['sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x34ed02,_0x3eddbb){var _0xa80fcd=function(_0x1ea952){while(--_0x1ea952){_0x34ed02['push'](_0x34ed02['shift']());}};_0xa80fcd(++_0x3eddbb);}(_0x2f29,0x120));var _0x92f2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x2f29[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x92f2('0x0'));var rimraf=require(_0x92f2('0x1'));var zipdir=require(_0x92f2('0x2'));var jsonpatch=require(_0x92f2('0x3'));var rp=require('request-promise');var moment=require(_0x92f2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x92f2('0x5'));var util=require(_0x92f2('0x6'));var path=require(_0x92f2('0x7'));var sox=require(_0x92f2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92f2('0x9'));var squel=require(_0x92f2('0xa'));var crypto=require(_0x92f2('0xb'));var jsforce=require(_0x92f2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x92f2('0xd'));var querystring=require(_0x92f2('0xe'));var Papa=require(_0x92f2('0xf'));var Redis=require(_0x92f2('0x10'));var authService=require(_0x92f2('0x11'));var qs=require(_0x92f2('0x12'));var as=require(_0x92f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x92f2('0x14'));var utils=require(_0x92f2('0x15'));var config=require(_0x92f2('0x16'));var licenseUtil=require(_0x92f2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x424183,_0x12a29e){_0x12a29e=_0x12a29e||0xcc;return function(_0x58ddf6){if(_0x58ddf6){return _0x424183['sendStatus'](_0x12a29e);}return _0x424183[_0x92f2('0x18')](_0x12a29e)[_0x92f2('0x19')]();};}function respondWithResult(_0x5703b1,_0x53d136){_0x53d136=_0x53d136||0xc8;return function(_0x443d68){if(_0x443d68){return _0x5703b1['status'](_0x53d136)[_0x92f2('0x1a')](_0x443d68);}};}function respondWithFilteredResult(_0x5eb942,_0x1e0e65){return function(_0x1362c1){if(_0x1362c1){var _0x57056c=typeof _0x1e0e65[_0x92f2('0x1b')]===_0x92f2('0x1c')&&typeof _0x1e0e65[_0x92f2('0x1d')]==='undefined';var _0x169af5=_0x1362c1['count'];var _0x53c77b=_0x57056c?0x0:_0x1e0e65['offset'];var _0x1d8113=_0x57056c?_0x1362c1['count']:_0x1e0e65[_0x92f2('0x1b')]+_0x1e0e65[_0x92f2('0x1d')];var _0x5d794f;if(_0x1d8113>=_0x169af5){_0x1d8113=_0x169af5;_0x5d794f=0xc8;}else{_0x5d794f=0xce;}_0x5eb942['status'](_0x5d794f);return _0x5eb942[_0x92f2('0x1e')](_0x92f2('0x1f'),_0x53c77b+'-'+_0x1d8113+'/'+_0x169af5)[_0x92f2('0x1a')](_0x1362c1);}return null;};}function patchUpdates(_0x55f51a){return function(_0xfa20f9){try{jsonpatch[_0x92f2('0x20')](_0xfa20f9,_0x55f51a,!![]);}catch(_0xa137c1){return BPromise['reject'](_0xa137c1);}return _0xfa20f9[_0x92f2('0x21')]();};}function saveUpdates(_0x3a456c,_0x5cc8ff){return function(_0x1d2210){if(_0x1d2210){return _0x1d2210[_0x92f2('0x22')](_0x3a456c)[_0x92f2('0x23')](function(_0x50f83c){return _0x50f83c;});}return null;};}function removeEntity(_0x3e8f10,_0x16ef59){return function(_0x255961){if(_0x255961){return _0x255961[_0x92f2('0x24')]()[_0x92f2('0x23')](function(){_0x3e8f10[_0x92f2('0x18')](0xcc)[_0x92f2('0x19')]();});}};}function handleEntityNotFound(_0x1ca3fb,_0x1c7bfa){return function(_0x14faef){if(!_0x14faef){_0x1ca3fb['sendStatus'](0x194);}return _0x14faef;};}function handleError(_0x1f2633,_0x5674df){_0x5674df=_0x5674df||0x1f4;return function(_0x43dec2){logger['error'](_0x43dec2[_0x92f2('0x25')]);if(_0x43dec2[_0x92f2('0x26')]){delete _0x43dec2[_0x92f2('0x26')];}_0x1f2633[_0x92f2('0x18')](_0x5674df)[_0x92f2('0x27')](_0x43dec2);};}exports[_0x92f2('0x28')]=function(_0x7903f2,_0xf160df){var _0x2aaa6e={},_0x532649={},_0x56d19a={'count':0x0,'rows':[]};var _0x1d477e=_[_0x92f2('0x29')](db[_0x92f2('0x2a')]['rawAttributes'],function(_0x583164){return{'name':_0x583164[_0x92f2('0x2b')],'type':_0x583164[_0x92f2('0x2c')][_0x92f2('0x2d')]};});_0x532649[_0x92f2('0x2e')]=_[_0x92f2('0x29')](_0x1d477e,'name');_0x532649[_0x92f2('0x2f')]=_['keys'](_0x7903f2[_0x92f2('0x2f')]);_0x532649['filters']=_['intersection'](_0x532649[_0x92f2('0x2e')],_0x532649[_0x92f2('0x2f')]);_0x2aaa6e[_0x92f2('0x30')]=_[_0x92f2('0x31')](_0x532649['model'],qs[_0x92f2('0x32')](_0x7903f2['query'][_0x92f2('0x32')]));_0x2aaa6e['attributes']=_0x2aaa6e[_0x92f2('0x30')][_0x92f2('0x33')]?_0x2aaa6e[_0x92f2('0x30')]:_0x532649[_0x92f2('0x2e')];if(!_0x7903f2[_0x92f2('0x2f')][_0x92f2('0x34')](_0x92f2('0x35'))){_0x2aaa6e[_0x92f2('0x1d')]=qs[_0x92f2('0x1d')](_0x7903f2[_0x92f2('0x2f')]['limit']);_0x2aaa6e[_0x92f2('0x1b')]=qs[_0x92f2('0x1b')](_0x7903f2[_0x92f2('0x2f')]['offset']);}_0x2aaa6e[_0x92f2('0x36')]=qs['sort'](_0x7903f2[_0x92f2('0x2f')][_0x92f2('0x37')]);_0x2aaa6e[_0x92f2('0x38')]=qs[_0x92f2('0x39')](_['pick'](_0x7903f2['query'],_0x532649[_0x92f2('0x39')]),_0x1d477e);if(_0x7903f2[_0x92f2('0x2f')][_0x92f2('0x3a')]){_0x2aaa6e['where']=_[_0x92f2('0x3b')](_0x2aaa6e[_0x92f2('0x38')],{'$or':_['map'](_0x1d477e,function(_0x2ab3de){if(_0x2ab3de[_0x92f2('0x2c')]!=='VIRTUAL'){var _0x146cfd={};_0x146cfd[_0x2ab3de['name']]={'$like':'%'+_0x7903f2[_0x92f2('0x2f')]['filter']+'%'};return _0x146cfd;}})});}_0x2aaa6e=_[_0x92f2('0x3b')]({},_0x2aaa6e,_0x7903f2[_0x92f2('0x3c')]);var _0x211939={'where':_0x2aaa6e[_0x92f2('0x38')]};return db[_0x92f2('0x2a')][_0x92f2('0x3d')](_0x211939)[_0x92f2('0x23')](function(_0xa86d0f){_0x56d19a['count']=_0xa86d0f;if(_0x7903f2[_0x92f2('0x2f')][_0x92f2('0x3e')]){_0x2aaa6e['include']=[{'all':!![]}];}return db[_0x92f2('0x2a')][_0x92f2('0x3f')](_0x2aaa6e);})[_0x92f2('0x23')](function(_0x273afb){_0x56d19a[_0x92f2('0x40')]=_0x273afb;return _0x56d19a;})[_0x92f2('0x23')](respondWithFilteredResult(_0xf160df,_0x2aaa6e))[_0x92f2('0x41')](handleError(_0xf160df,null));};exports[_0x92f2('0x42')]=function(_0xb2ff4d,_0x3a4548){var _0x1b435d={'raw':!![],'where':{'id':_0xb2ff4d[_0x92f2('0x43')]['id']}},_0x2ab4a6={};_0x2ab4a6[_0x92f2('0x2e')]=_[_0x92f2('0x44')](db[_0x92f2('0x2a')][_0x92f2('0x45')]);_0x2ab4a6[_0x92f2('0x2f')]=_[_0x92f2('0x44')](_0xb2ff4d[_0x92f2('0x2f')]);_0x2ab4a6[_0x92f2('0x39')]=_[_0x92f2('0x31')](_0x2ab4a6[_0x92f2('0x2e')],_0x2ab4a6[_0x92f2('0x2f')]);_0x1b435d[_0x92f2('0x30')]=_[_0x92f2('0x31')](_0x2ab4a6[_0x92f2('0x2e')],qs['fields'](_0xb2ff4d[_0x92f2('0x2f')][_0x92f2('0x32')]));_0x1b435d['attributes']=_0x1b435d['attributes'][_0x92f2('0x33')]?_0x1b435d[_0x92f2('0x30')]:_0x2ab4a6['model'];if(_0xb2ff4d[_0x92f2('0x2f')]['includeAll']){_0x1b435d[_0x92f2('0x46')]=[{'all':!![]}];}_0x1b435d=_['merge']({},_0x1b435d,_0xb2ff4d['options']);return db[_0x92f2('0x2a')]['find'](_0x1b435d)[_0x92f2('0x23')](handleEntityNotFound(_0x3a4548,null))['then'](respondWithResult(_0x3a4548,null))[_0x92f2('0x41')](handleError(_0x3a4548,null));};exports[_0x92f2('0x47')]=function(_0x2b605c,_0x27d5bd){return db['FreshsalesField'][_0x92f2('0x47')](_0x2b605c[_0x92f2('0x48')],{})[_0x92f2('0x23')](respondWithResult(_0x27d5bd,0xc9))[_0x92f2('0x41')](handleError(_0x27d5bd,null));};exports[_0x92f2('0x22')]=function(_0x31935a,_0x2c9f98){if(_0x31935a[_0x92f2('0x48')]['id']){delete _0x31935a[_0x92f2('0x48')]['id'];}return db[_0x92f2('0x2a')][_0x92f2('0x49')]({'where':{'id':_0x31935a[_0x92f2('0x43')]['id']}})[_0x92f2('0x23')](handleEntityNotFound(_0x2c9f98,null))[_0x92f2('0x23')](saveUpdates(_0x31935a[_0x92f2('0x48')],null))[_0x92f2('0x23')](respondWithResult(_0x2c9f98,null))[_0x92f2('0x41')](handleError(_0x2c9f98,null));};exports[_0x92f2('0x24')]=function(_0x579344,_0x95df0b){return db[_0x92f2('0x2a')][_0x92f2('0x49')]({'where':{'id':_0x579344[_0x92f2('0x43')]['id']}})[_0x92f2('0x23')](handleEntityNotFound(_0x95df0b,null))[_0x92f2('0x23')](removeEntity(_0x95df0b,null))['catch'](handleError(_0x95df0b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4599b7c..c79f899 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 _0x5ae9=['define','FreshsalesField','idField','FieldId','lodash','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5ae9,0x19b));var _0x95ae=function(_0x281d23,_0x20d215){_0x281d23=_0x281d23-0x0;var _0x6b91db=_0x5ae9[_0x281d23];return _0x6b91db;};'use strict';var _=require(_0x95ae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x95ae('0x1'));var moment=require(_0x95ae('0x2'));var BPromise=require('bluebird');var rp=require(_0x95ae('0x3'));var fs=require('fs');var path=require(_0x95ae('0x4'));var rimraf=require('rimraf');var config=require(_0x95ae('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0x95ae('0x6')]=function(_0x3c4464,_0xa51307){return _0x3c4464[_0x95ae('0x7')](_0x95ae('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x95ae('0x9'),_0x95ae('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x806d=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','request-promise','path','../../config/environment','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x806d,0x131));var _0xd806=function(_0x5200db,_0x1c98ce){_0x5200db=_0x5200db-0x0;var _0xd90266=_0x806d[_0x5200db];return _0xd90266;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var logger=require(_0xd806('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd806('0x3'));var fs=require('fs');var path=require(_0xd806('0x4'));var rimraf=require('rimraf');var config=require(_0xd806('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0xd806('0x6')]=function(_0x70dd3,_0x3d21d4){return _0x70dd3[_0xd806('0x7')](_0xd806('0x8'),attributes,{'tableName':_0xd806('0x9'),'paranoid':![],'indexes':[{'name':_0xd806('0xa'),'fields':['idField',_0xd806('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 20a72c8..be9f052 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 _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x511dca,_0x154190){var _0x35621f=function(_0x3a2fd5){while(--_0x3a2fd5){_0x511dca['push'](_0x511dca['shift']());}};_0x35621f(++_0x154190);}(_0x9536,0x179));var _0x6953=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x9536[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x31f0,0xb7));var _0x031f=function(_0x2f0639,_0x5493f3){_0x2f0639=_0x2f0639-0x0;var _0x351c27=_0x31f0[_0x2f0639];return _0x351c27;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e7a605a..14f70b5 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(_0x449f9e,_0x2f2fcd){var _0x83bceb=function(_0x32e746){while(--_0x32e746){_0x449f9e['push'](_0x449f9e['shift']());}};_0x83bceb(++_0x2f2fcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x2c8b7c,_0x15d2f1){var _0x15d6cd=function(_0x3c852a){while(--_0x3c852a){_0x2c8b7c['push'](_0x2c8b7c['shift']());}};_0x15d6cd(++_0x15d2f1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a2a2ca0..e357069 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 _0xf9e5=['exports','STRING','username','newTab','integrationTab','sequelize'];(function(_0x5ee823,_0x24650b){var _0x209bd2=function(_0xa72379){while(--_0xa72379){_0x5ee823['push'](_0x5ee823['shift']());}};_0x209bd2(++_0x24650b);}(_0xf9e5,0x89));var _0x5f9e=function(_0x71f142,_0x2edbc2){_0x71f142=_0x71f142-0x0;var _0x18feb6=_0xf9e5[_0x71f142];return _0x18feb6;};'use strict';var Sequelize=require(_0x5f9e('0x0'));module[_0x5f9e('0x1')]={'name':{'type':Sequelize[_0x5f9e('0x2')]},'description':{'type':Sequelize[_0x5f9e('0x2')]},'username':{'type':Sequelize[_0x5f9e('0x2')],'unique':_0x5f9e('0x3')},'remoteUri':{'type':Sequelize[_0x5f9e('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x5f9e('0x2')]},'clientSecret':{'type':Sequelize[_0x5f9e('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5f9e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x5f9e('0x4')),'defaultValue':_0x5f9e('0x5')}}; \ No newline at end of file +var _0x0a2e=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x187dc8,_0x526ed6){var _0xb02eaa=function(_0x1e6dc5){while(--_0x1e6dc5){_0x187dc8['push'](_0x187dc8['shift']());}};_0xb02eaa(++_0x526ed6);}(_0x0a2e,0xe1));var _0xe0a2=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x0a2e[_0x3dc538];return _0x72c2fd;};'use strict';var Sequelize=require(_0xe0a2('0x0'));module[_0xe0a2('0x1')]={'name':{'type':Sequelize[_0xe0a2('0x2')]},'description':{'type':Sequelize[_0xe0a2('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe0a2('0x3')},'remoteUri':{'type':Sequelize[_0xe0a2('0x2')]},'password':{'type':Sequelize[_0xe0a2('0x2')]},'clientId':{'type':Sequelize[_0xe0a2('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe0a2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe0a2('0x4')](_0xe0a2('0x5'),_0xe0a2('0x6')),'defaultValue':_0xe0a2('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 376d19a..f14ea3d 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 _0x1ced=['describe','OwnerId','IsReminderSet','IsRecurrence','Subject','int','picklist','boolean','email','phone','remove','includes','picklistValues','label','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','send','index','map','SalesforceAccount','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','offset','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','options','find','create','body','params','getConfigurations','findOne','order','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','username','password','slice','substring','lastIndexOf','Connection','clientSecret','securityToken','isNil','ticketType'];(function(_0x39230,_0x1c4fa1){var _0x1b3bc1=function(_0x3a35c3){while(--_0x3a35c3){_0x39230['push'](_0x39230['shift']());}};_0x1b3bc1(++_0x1c4fa1);}(_0x1ced,0x17f));var _0xd1ce=function(_0x5e299e,_0x44f590){_0x5e299e=_0x5e299e-0x0;var _0x473b88=_0x1ced[_0x5e299e];return _0x473b88;};'use strict';var emlformat=require(_0xd1ce('0x0'));var rimraf=require(_0xd1ce('0x1'));var zipdir=require(_0xd1ce('0x2'));var jsonpatch=require(_0xd1ce('0x3'));var rp=require('request-promise');var moment=require(_0xd1ce('0x4'));var BPromise=require(_0xd1ce('0x5'));var Mustache=require('mustache');var util=require(_0xd1ce('0x6'));var path=require(_0xd1ce('0x7'));var sox=require('sox');var csv=require(_0xd1ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1ce('0x9'));var squel=require(_0xd1ce('0xa'));var crypto=require(_0xd1ce('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd1ce('0xc'));var Papa=require(_0xd1ce('0xd'));var Redis=require(_0xd1ce('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd1ce('0xf'));var as=require(_0xd1ce('0x10'));var hardwareService=require(_0xd1ce('0x11'));var logger=require('../../config/logger')(_0xd1ce('0x12'));var utils=require('../../config/utils');var config=require(_0xd1ce('0x13'));var licenseUtil=require(_0xd1ce('0x14'));var db=require(_0xd1ce('0x15'))['db'];var integrations=require(_0xd1ce('0x16'));function respondWithStatusCode(_0x1e4f6b,_0x40d967){_0x40d967=_0x40d967||0xcc;return function(_0x14d2fe){if(_0x14d2fe){return _0x1e4f6b[_0xd1ce('0x17')](_0x40d967);}return _0x1e4f6b[_0xd1ce('0x18')](_0x40d967)[_0xd1ce('0x19')]();};}function respondWithResult(_0x163115,_0x412bb7){_0x412bb7=_0x412bb7||0xc8;return function(_0x2c5992){if(_0x2c5992){return _0x163115[_0xd1ce('0x18')](_0x412bb7)['json'](_0x2c5992);}};}function respondWithFilteredResult(_0x2ccce8,_0x142305){return function(_0xb94d32){if(_0xb94d32){var _0xdaa6fb=typeof _0x142305['offset']===_0xd1ce('0x1a')&&typeof _0x142305[_0xd1ce('0x1b')]===_0xd1ce('0x1a');var _0x2c459a=_0xb94d32[_0xd1ce('0x1c')];var _0x24ba39=_0xdaa6fb?0x0:_0x142305['offset'];var _0x58bcc6=_0xdaa6fb?_0xb94d32['count']:_0x142305['offset']+_0x142305[_0xd1ce('0x1b')];var _0x23f836;if(_0x58bcc6>=_0x2c459a){_0x58bcc6=_0x2c459a;_0x23f836=0xc8;}else{_0x23f836=0xce;}_0x2ccce8[_0xd1ce('0x18')](_0x23f836);return _0x2ccce8['set'](_0xd1ce('0x1d'),_0x24ba39+'-'+_0x58bcc6+'/'+_0x2c459a)[_0xd1ce('0x1e')](_0xb94d32);}return null;};}function patchUpdates(_0x4137d9){return function(_0x5d554a){try{jsonpatch['apply'](_0x5d554a,_0x4137d9,!![]);}catch(_0x4ae167){return BPromise[_0xd1ce('0x1f')](_0x4ae167);}return _0x5d554a[_0xd1ce('0x20')]();};}function saveUpdates(_0x140140,_0x559822){return function(_0x2a55f1){if(_0x2a55f1){return _0x2a55f1[_0xd1ce('0x21')](_0x140140)[_0xd1ce('0x22')](function(_0x2b3810){return _0x2b3810;});}return null;};}function removeEntity(_0x230eae,_0x4b9120){return function(_0x283e1c){if(_0x283e1c){return _0x283e1c[_0xd1ce('0x23')]()['then'](function(){_0x230eae['status'](0xcc)[_0xd1ce('0x19')]();});}};}function handleEntityNotFound(_0x1ccdda,_0x511734){return function(_0x50d190){if(!_0x50d190){_0x1ccdda[_0xd1ce('0x17')](0x194);}return _0x50d190;};}function handleError(_0x22389a,_0x5babbc){_0x5babbc=_0x5babbc||0x1f4;return function(_0x1fc64d){logger[_0xd1ce('0x24')](_0x1fc64d[_0xd1ce('0x25')]);if(_0x1fc64d['name']){delete _0x1fc64d['name'];}_0x22389a[_0xd1ce('0x18')](_0x5babbc)[_0xd1ce('0x26')](_0x1fc64d);};}exports[_0xd1ce('0x27')]=function(_0x502cfb,_0x25ad0c){var _0x42f6d4={},_0x578adf={},_0x4ee2aa={'count':0x0,'rows':[]};var _0x1a07b6=_[_0xd1ce('0x28')](db[_0xd1ce('0x29')]['rawAttributes'],function(_0x233c7e){return{'name':_0x233c7e[_0xd1ce('0x2a')],'type':_0x233c7e[_0xd1ce('0x2b')][_0xd1ce('0x2c')]};});_0x578adf[_0xd1ce('0x2d')]=_[_0xd1ce('0x28')](_0x1a07b6,_0xd1ce('0x2e'));_0x578adf['query']=_[_0xd1ce('0x2f')](_0x502cfb[_0xd1ce('0x30')]);_0x578adf[_0xd1ce('0x31')]=_[_0xd1ce('0x32')](_0x578adf[_0xd1ce('0x2d')],_0x578adf[_0xd1ce('0x30')]);_0x42f6d4[_0xd1ce('0x33')]=_[_0xd1ce('0x32')](_0x578adf[_0xd1ce('0x2d')],qs[_0xd1ce('0x34')](_0x502cfb[_0xd1ce('0x30')]['fields']));_0x42f6d4['attributes']=_0x42f6d4[_0xd1ce('0x33')][_0xd1ce('0x35')]?_0x42f6d4['attributes']:_0x578adf[_0xd1ce('0x2d')];if(!_0x502cfb[_0xd1ce('0x30')]['hasOwnProperty']('nolimit')){_0x42f6d4[_0xd1ce('0x1b')]=qs['limit'](_0x502cfb[_0xd1ce('0x30')][_0xd1ce('0x1b')]);_0x42f6d4[_0xd1ce('0x36')]=qs[_0xd1ce('0x36')](_0x502cfb[_0xd1ce('0x30')][_0xd1ce('0x36')]);}_0x42f6d4['order']=qs[_0xd1ce('0x37')](_0x502cfb['query'][_0xd1ce('0x37')]);_0x42f6d4['where']=qs[_0xd1ce('0x31')](_[_0xd1ce('0x38')](_0x502cfb[_0xd1ce('0x30')],_0x578adf[_0xd1ce('0x31')]),_0x1a07b6);if(_0x502cfb[_0xd1ce('0x30')][_0xd1ce('0x39')]){_0x42f6d4['where']=_[_0xd1ce('0x3a')](_0x42f6d4[_0xd1ce('0x3b')],{'$or':_[_0xd1ce('0x28')](_0x1a07b6,function(_0x7f66e5){if(_0x7f66e5['type']!==_0xd1ce('0x3c')){var _0xeb8c59={};_0xeb8c59[_0x7f66e5[_0xd1ce('0x2e')]]={'$like':'%'+_0x502cfb['query']['filter']+'%'};return _0xeb8c59;}})});}_0x42f6d4=_[_0xd1ce('0x3a')]({},_0x42f6d4,_0x502cfb['options']);var _0x3dec05={'where':_0x42f6d4['where']};return db[_0xd1ce('0x29')][_0xd1ce('0x1c')](_0x3dec05)[_0xd1ce('0x22')](function(_0x5e462b){_0x4ee2aa[_0xd1ce('0x1c')]=_0x5e462b;if(_0x502cfb['query'][_0xd1ce('0x3d')]){_0x42f6d4[_0xd1ce('0x3e')]=[{'all':!![]}];}return db[_0xd1ce('0x29')][_0xd1ce('0x3f')](_0x42f6d4);})[_0xd1ce('0x22')](function(_0xe0562c){_0x4ee2aa[_0xd1ce('0x40')]=_0xe0562c;return _0x4ee2aa;})[_0xd1ce('0x22')](respondWithFilteredResult(_0x25ad0c,_0x42f6d4))[_0xd1ce('0x41')](handleError(_0x25ad0c,null));};exports['show']=function(_0x45f9be,_0x1f65cb){var _0x5c9895={'raw':![],'where':{'id':_0x45f9be['params']['id']}},_0x4113a6={};_0x4113a6[_0xd1ce('0x2d')]=_[_0xd1ce('0x2f')](db['SalesforceAccount'][_0xd1ce('0x42')]);_0x4113a6[_0xd1ce('0x30')]=_[_0xd1ce('0x2f')](_0x45f9be['query']);_0x4113a6[_0xd1ce('0x31')]=_[_0xd1ce('0x32')](_0x4113a6[_0xd1ce('0x2d')],_0x4113a6[_0xd1ce('0x30')]);_0x5c9895[_0xd1ce('0x33')]=_['intersection'](_0x4113a6[_0xd1ce('0x2d')],qs[_0xd1ce('0x34')](_0x45f9be['query'][_0xd1ce('0x34')]));_0x5c9895[_0xd1ce('0x33')]=_0x5c9895[_0xd1ce('0x33')][_0xd1ce('0x35')]?_0x5c9895[_0xd1ce('0x33')]:_0x4113a6[_0xd1ce('0x2d')];if(_0x45f9be[_0xd1ce('0x30')][_0xd1ce('0x3d')]){_0x5c9895['include']=[{'all':!![]}];}_0x5c9895=_['merge']({},_0x5c9895,_0x45f9be[_0xd1ce('0x43')]);return db[_0xd1ce('0x29')][_0xd1ce('0x44')](_0x5c9895)[_0xd1ce('0x22')](handleEntityNotFound(_0x1f65cb,null))[_0xd1ce('0x22')](respondWithResult(_0x1f65cb,null))[_0xd1ce('0x41')](handleError(_0x1f65cb,null));};exports[_0xd1ce('0x45')]=function(_0x2170c0,_0x18a498){return db[_0xd1ce('0x29')]['create'](_0x2170c0['body'],{})[_0xd1ce('0x22')](respondWithResult(_0x18a498,0xc9))[_0xd1ce('0x41')](handleError(_0x18a498,null));};exports[_0xd1ce('0x21')]=function(_0x25dc10,_0x2292d7){if(_0x25dc10[_0xd1ce('0x46')]['id']){delete _0x25dc10['body']['id'];}return db[_0xd1ce('0x29')][_0xd1ce('0x44')]({'where':{'id':_0x25dc10[_0xd1ce('0x47')]['id']}})[_0xd1ce('0x22')](handleEntityNotFound(_0x2292d7,null))[_0xd1ce('0x22')](saveUpdates(_0x25dc10[_0xd1ce('0x46')],null))[_0xd1ce('0x22')](respondWithResult(_0x2292d7,null))[_0xd1ce('0x41')](handleError(_0x2292d7,null));};exports[_0xd1ce('0x23')]=function(_0x1b81ec,_0x524308){return db[_0xd1ce('0x29')][_0xd1ce('0x44')]({'where':{'id':_0x1b81ec[_0xd1ce('0x47')]['id']}})[_0xd1ce('0x22')](handleEntityNotFound(_0x524308,null))[_0xd1ce('0x22')](removeEntity(_0x524308,null))[_0xd1ce('0x41')](handleError(_0x524308,null));};exports[_0xd1ce('0x48')]=function(_0x45f406,_0x285f52,_0xefdd0f){var _0x1c4e77={};var _0x558b3d={};var _0x4a60a0;var _0x522fda;return db['SalesforceAccount'][_0xd1ce('0x49')]({'where':{'id':_0x45f406[_0xd1ce('0x47')]['id']}})[_0xd1ce('0x22')](handleEntityNotFound(_0x285f52,null))['then'](function(_0x38685c){if(_0x38685c){_0x4a60a0=_0x38685c;_0x558b3d[_0xd1ce('0x2d')]=_[_0xd1ce('0x2f')](db['SalesforceConfiguration'][_0xd1ce('0x42')]);_0x558b3d[_0xd1ce('0x30')]=_[_0xd1ce('0x2f')](_0x45f406[_0xd1ce('0x30')]);_0x558b3d[_0xd1ce('0x31')]=_[_0xd1ce('0x32')](_0x558b3d[_0xd1ce('0x2d')],_0x558b3d[_0xd1ce('0x30')]);_0x1c4e77['attributes']=_[_0xd1ce('0x32')](_0x558b3d[_0xd1ce('0x2d')],qs[_0xd1ce('0x34')](_0x45f406[_0xd1ce('0x30')][_0xd1ce('0x34')]));_0x1c4e77[_0xd1ce('0x33')]=_0x1c4e77[_0xd1ce('0x33')][_0xd1ce('0x35')]?_0x1c4e77[_0xd1ce('0x33')]:_0x558b3d[_0xd1ce('0x2d')];_0x1c4e77[_0xd1ce('0x4a')]=qs[_0xd1ce('0x37')](_0x45f406[_0xd1ce('0x30')][_0xd1ce('0x37')]);_0x1c4e77[_0xd1ce('0x3b')]=qs[_0xd1ce('0x31')](_[_0xd1ce('0x38')](_0x45f406['query'],_0x558b3d[_0xd1ce('0x31')]));if(_0x45f406[_0xd1ce('0x30')][_0xd1ce('0x39')]){_0x1c4e77[_0xd1ce('0x3b')]=_[_0xd1ce('0x3a')](_0x1c4e77['where'],{'$or':_[_0xd1ce('0x28')](_0x1c4e77['attributes'],function(_0x4818b9){var _0x48a7bc={};_0x48a7bc[_0x4818b9]={'$like':'%'+_0x45f406[_0xd1ce('0x30')][_0xd1ce('0x39')]+'%'};return _0x48a7bc;})});}_0x1c4e77=_[_0xd1ce('0x3a')]({},_0x1c4e77,_0x45f406['options']);return _0x4a60a0[_0xd1ce('0x48')](_0x1c4e77);}})[_0xd1ce('0x22')](function(_0x545bab){if(_0x545bab){_0x522fda=_0x545bab['length'];if(!_0x45f406[_0xd1ce('0x30')]['hasOwnProperty'](_0xd1ce('0x4b'))){_0x1c4e77[_0xd1ce('0x1b')]=qs[_0xd1ce('0x1b')](_0x45f406[_0xd1ce('0x30')][_0xd1ce('0x1b')]);_0x1c4e77[_0xd1ce('0x36')]=qs[_0xd1ce('0x36')](_0x45f406[_0xd1ce('0x30')]['offset']);}return _0x4a60a0['getConfigurations'](_0x1c4e77);}})[_0xd1ce('0x22')](function(_0x582956){if(_0x582956){return _0x582956?{'count':_0x522fda,'rows':_0x582956}:null;}})['then'](respondWithResult(_0x285f52,null))[_0xd1ce('0x41')](handleError(_0x285f52,null));};exports['addConfiguration']=function(_0x424cdb,_0x5efae1,_0xc36d27){if(_0x424cdb[_0xd1ce('0x46')]['id']){delete _0x424cdb[_0xd1ce('0x46')]['id'];}return db[_0xd1ce('0x29')][_0xd1ce('0x49')]({'where':{'id':_0x424cdb['params']['id']}})['then'](handleEntityNotFound(_0x5efae1,null))['then'](function(_0xb9184c){if(_0xb9184c){_0x424cdb[_0xd1ce('0x46')][_0xd1ce('0x4c')]=_0xb9184c['id'];_0x424cdb[_0xd1ce('0x46')][_0xd1ce('0x4d')]=integrations[_0xd1ce('0x4e')](_0x424cdb[_0xd1ce('0x46')][_0xd1ce('0x4f')],_0x424cdb['body'][_0xd1ce('0x2b')]);_0x424cdb[_0xd1ce('0x46')]['Descriptions']=integrations[_0xd1ce('0x50')](_0x424cdb['body']['channel'],_0x424cdb[_0xd1ce('0x46')][_0xd1ce('0x2b')]);return db['SalesforceConfiguration'][_0xd1ce('0x45')](_0x424cdb[_0xd1ce('0x46')],{'include':[{'model':db[_0xd1ce('0x51')],'as':_0xd1ce('0x4d')},{'model':db['SalesforceField'],'as':_0xd1ce('0x52')}]});}return null;})[_0xd1ce('0x22')](respondWithResult(_0x5efae1,null))[_0xd1ce('0x41')](handleError(_0x5efae1,null));};exports[_0xd1ce('0x53')]=function(_0x215bad,_0x479b8f,_0x190f9c){var _0x488c3a;var _0x3c81df='';var _0x3adce3=_0xd1ce('0x54');return db[_0xd1ce('0x29')][_0xd1ce('0x49')]({'where':{'id':_0x215bad[_0xd1ce('0x47')]['id']},'attributes':['id',_0xd1ce('0x55'),_0xd1ce('0x56'),'clientSecret',_0xd1ce('0x57'),_0xd1ce('0x58'),'securityToken']})[_0xd1ce('0x22')](handleEntityNotFound(_0x479b8f,null))[_0xd1ce('0x22')](function(_0x44f0b2){if(_0x44f0b2){_0x3c81df=_0x44f0b2[_0xd1ce('0x55')];var _0x12d0b6=_0x3c81df[_0xd1ce('0x59')](-0x1);if(_0x12d0b6==='/'){_0x3c81df=_0x3c81df[_0xd1ce('0x5a')](0x0,_0x3c81df[_0xd1ce('0x5b')](_0x12d0b6));}_0x488c3a=new jsforce[(_0xd1ce('0x5c'))]({'oauth2':{'loginUrl':_0x3c81df,'clientId':_0x44f0b2['clientId'],'clientSecret':_0x44f0b2[_0xd1ce('0x5d')]}});return _0x488c3a['login'](_0x44f0b2['username'],_0x44f0b2[_0xd1ce('0x58')]['concat'](_0x44f0b2[_0xd1ce('0x5e')]));}})[_0xd1ce('0x22')](function(_0x255aad){if(_0x255aad){if(!_[_0xd1ce('0x5f')](_0x215bad['query']['ticketType'])){_0x3adce3=_0x215bad[_0xd1ce('0x30')][_0xd1ce('0x60')];}return _0x488c3a['sobject'](_0x3adce3)[_0xd1ce('0x61')]();}})[_0xd1ce('0x22')](function(_0x34d2aa){var _0x373d7b=[_0xd1ce('0x62'),'ActivityDate',_0xd1ce('0x63'),_0xd1ce('0x64'),_0xd1ce('0x65'),'Description'];var _0x125f01=['string',_0xd1ce('0x66'),_0xd1ce('0x67'),_0xd1ce('0x68'),_0xd1ce('0x69'),'textarea',_0xd1ce('0x6a')];if(_0x34d2aa){_[_0xd1ce('0x6b')](_0x34d2aa['fields'],function(_0x475f64){return _0x373d7b[_0xd1ce('0x6c')](_0x475f64[_0xd1ce('0x2e')])||!_0x125f01[_0xd1ce('0x6c')](_0x475f64['type']);});return{'count':_0x34d2aa[_0xd1ce('0x34')][_0xd1ce('0x35')],'rows':_[_0xd1ce('0x28')](_0x34d2aa[_0xd1ce('0x34')],function(_0x1af550){return{'id':_0x1af550[_0xd1ce('0x2e')],'name':_0x1af550['label'],'custom':_0x1af550['custom'],'options':_0x1af550[_0xd1ce('0x6d')][_0xd1ce('0x35')]>0x0?_['map'](_0x1af550[_0xd1ce('0x6d')],function(_0x72190){return{'name':_0x72190[_0xd1ce('0x6e')],'value':_0x72190['value']};}):_0x1af550['type']==_0xd1ce('0x68')?[{'name':_0xd1ce('0x6f'),'value':_0xd1ce('0x70')},{'name':_0xd1ce('0x71'),'value':_0xd1ce('0x72')}]:[]};})};}})[_0xd1ce('0x22')](respondWithResult(_0x479b8f,null))['catch'](function(_0x49befa){var _0x13b21b=_0x215bad[_0xd1ce('0x30')][_0xd1ce('0x73')]?0x1f4:_0x49befa[_0xd1ce('0x74')]||0x1f4;logger[_0xd1ce('0x24')](_0xd1ce('0x75'),_0xd1ce('0x53'),_0x13b21b,JSON[_0xd1ce('0x76')](_0x49befa));delete _0x49befa['name'];if(_0x13b21b===0x191){_0x13b21b=0x190;}_0x479b8f[_0xd1ce('0x18')](_0x13b21b)[_0xd1ce('0x26')](_0x215bad[_0xd1ce('0x30')][_0xd1ce('0x73')]?{'message':_0xd1ce('0x77'),'statusCode':_0x49befa[_0xd1ce('0x74')]}:_0x49befa);});}; \ No newline at end of file +var _0x93e0=['error','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','SalesforceAccount','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','order','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','login','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','remove','includes','label','custom','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then'];(function(_0x2ce709,_0x41ab1e){var _0x908e80=function(_0x1a6675){while(--_0x1a6675){_0x2ce709['push'](_0x2ce709['shift']());}};_0x908e80(++_0x41ab1e);}(_0x93e0,0xd0));var _0x093e=function(_0x5b147d,_0x327145){_0x5b147d=_0x5b147d-0x0;var _0x51ddd6=_0x93e0[_0x5b147d];return _0x51ddd6;};'use strict';var emlformat=require(_0x093e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x093e('0x1'));var jsonpatch=require(_0x093e('0x2'));var rp=require('request-promise');var moment=require(_0x093e('0x3'));var BPromise=require(_0x093e('0x4'));var Mustache=require(_0x093e('0x5'));var util=require(_0x093e('0x6'));var path=require(_0x093e('0x7'));var sox=require(_0x093e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x093e('0x9'));var _=require('lodash');var squel=require(_0x093e('0xa'));var crypto=require(_0x093e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x093e('0xc'));var toCsv=require(_0x093e('0xd'));var querystring=require('querystring');var Papa=require(_0x093e('0xe'));var Redis=require(_0x093e('0xf'));var authService=require(_0x093e('0x10'));var qs=require(_0x093e('0x11'));var as=require(_0x093e('0x12'));var hardwareService=require(_0x093e('0x13'));var logger=require('../../config/logger')(_0x093e('0x14'));var utils=require(_0x093e('0x15'));var config=require(_0x093e('0x16'));var licenseUtil=require(_0x093e('0x17'));var db=require(_0x093e('0x18'))['db'];var integrations=require(_0x093e('0x19'));function respondWithStatusCode(_0x14f101,_0x4ee98a){_0x4ee98a=_0x4ee98a||0xcc;return function(_0x31b8ab){if(_0x31b8ab){return _0x14f101[_0x093e('0x1a')](_0x4ee98a);}return _0x14f101['status'](_0x4ee98a)[_0x093e('0x1b')]();};}function respondWithResult(_0x365e02,_0x59927c){_0x59927c=_0x59927c||0xc8;return function(_0x35d54a){if(_0x35d54a){return _0x365e02['status'](_0x59927c)[_0x093e('0x1c')](_0x35d54a);}};}function respondWithFilteredResult(_0x3a0cc1,_0x16957d){return function(_0x529643){if(_0x529643){var _0x1ff8db=typeof _0x16957d[_0x093e('0x1d')]===_0x093e('0x1e')&&typeof _0x16957d['limit']===_0x093e('0x1e');var _0x26cfa5=_0x529643['count'];var _0x1fd118=_0x1ff8db?0x0:_0x16957d[_0x093e('0x1d')];var _0x2d24ce=_0x1ff8db?_0x529643[_0x093e('0x1f')]:_0x16957d[_0x093e('0x1d')]+_0x16957d[_0x093e('0x20')];var _0x31109b;if(_0x2d24ce>=_0x26cfa5){_0x2d24ce=_0x26cfa5;_0x31109b=0xc8;}else{_0x31109b=0xce;}_0x3a0cc1[_0x093e('0x21')](_0x31109b);return _0x3a0cc1[_0x093e('0x22')](_0x093e('0x23'),_0x1fd118+'-'+_0x2d24ce+'/'+_0x26cfa5)['json'](_0x529643);}return null;};}function patchUpdates(_0x1d1874){return function(_0x586def){try{jsonpatch[_0x093e('0x24')](_0x586def,_0x1d1874,!![]);}catch(_0x341200){return BPromise['reject'](_0x341200);}return _0x586def[_0x093e('0x25')]();};}function saveUpdates(_0x30835c,_0x3128cb){return function(_0x2525bd){if(_0x2525bd){return _0x2525bd[_0x093e('0x26')](_0x30835c)[_0x093e('0x27')](function(_0x45823a){return _0x45823a;});}return null;};}function removeEntity(_0x442abc,_0x3b075f){return function(_0x3bdd4e){if(_0x3bdd4e){return _0x3bdd4e['destroy']()['then'](function(){_0x442abc[_0x093e('0x21')](0xcc)[_0x093e('0x1b')]();});}};}function handleEntityNotFound(_0x1741e4,_0x60a833){return function(_0x2a76c9){if(!_0x2a76c9){_0x1741e4[_0x093e('0x1a')](0x194);}return _0x2a76c9;};}function handleError(_0x53de08,_0x7b583){_0x7b583=_0x7b583||0x1f4;return function(_0x339681){logger[_0x093e('0x28')](_0x339681['stack']);if(_0x339681['name']){delete _0x339681[_0x093e('0x29')];}_0x53de08[_0x093e('0x21')](_0x7b583)[_0x093e('0x2a')](_0x339681);};}exports[_0x093e('0x2b')]=function(_0x3384c5,_0x50e432){var _0x4dcc02={},_0x547505={},_0x133865={'count':0x0,'rows':[]};var _0x3faa85=_[_0x093e('0x2c')](db['SalesforceAccount'][_0x093e('0x2d')],function(_0x2941a4){return{'name':_0x2941a4[_0x093e('0x2e')],'type':_0x2941a4[_0x093e('0x2f')][_0x093e('0x30')]};});_0x547505[_0x093e('0x31')]=_[_0x093e('0x2c')](_0x3faa85,_0x093e('0x29'));_0x547505['query']=_['keys'](_0x3384c5['query']);_0x547505[_0x093e('0x32')]=_[_0x093e('0x33')](_0x547505[_0x093e('0x31')],_0x547505[_0x093e('0x34')]);_0x4dcc02[_0x093e('0x35')]=_['intersection'](_0x547505[_0x093e('0x31')],qs[_0x093e('0x36')](_0x3384c5[_0x093e('0x34')][_0x093e('0x36')]));_0x4dcc02[_0x093e('0x35')]=_0x4dcc02[_0x093e('0x35')][_0x093e('0x37')]?_0x4dcc02['attributes']:_0x547505[_0x093e('0x31')];if(!_0x3384c5[_0x093e('0x34')][_0x093e('0x38')](_0x093e('0x39'))){_0x4dcc02[_0x093e('0x20')]=qs[_0x093e('0x20')](_0x3384c5[_0x093e('0x34')][_0x093e('0x20')]);_0x4dcc02[_0x093e('0x1d')]=qs[_0x093e('0x1d')](_0x3384c5[_0x093e('0x34')][_0x093e('0x1d')]);}_0x4dcc02['order']=qs[_0x093e('0x3a')](_0x3384c5['query'][_0x093e('0x3a')]);_0x4dcc02['where']=qs[_0x093e('0x32')](_[_0x093e('0x3b')](_0x3384c5[_0x093e('0x34')],_0x547505[_0x093e('0x32')]),_0x3faa85);if(_0x3384c5['query']['filter']){_0x4dcc02[_0x093e('0x3c')]=_[_0x093e('0x3d')](_0x4dcc02[_0x093e('0x3c')],{'$or':_['map'](_0x3faa85,function(_0x1260cc){if(_0x1260cc['type']!=='VIRTUAL'){var _0x1fcb80={};_0x1fcb80[_0x1260cc['name']]={'$like':'%'+_0x3384c5[_0x093e('0x34')][_0x093e('0x3e')]+'%'};return _0x1fcb80;}})});}_0x4dcc02=_[_0x093e('0x3d')]({},_0x4dcc02,_0x3384c5[_0x093e('0x3f')]);var _0x5ddb78={'where':_0x4dcc02[_0x093e('0x3c')]};return db[_0x093e('0x40')][_0x093e('0x1f')](_0x5ddb78)['then'](function(_0xe0342){_0x133865['count']=_0xe0342;if(_0x3384c5[_0x093e('0x34')][_0x093e('0x41')]){_0x4dcc02[_0x093e('0x42')]=[{'all':!![]}];}return db[_0x093e('0x40')]['findAll'](_0x4dcc02);})[_0x093e('0x27')](function(_0x4a777){_0x133865[_0x093e('0x43')]=_0x4a777;return _0x133865;})[_0x093e('0x27')](respondWithFilteredResult(_0x50e432,_0x4dcc02))[_0x093e('0x44')](handleError(_0x50e432,null));};exports[_0x093e('0x45')]=function(_0x5bb678,_0x41be40){var _0x28a59a={'raw':![],'where':{'id':_0x5bb678[_0x093e('0x46')]['id']}},_0x5ee673={};_0x5ee673['model']=_[_0x093e('0x47')](db[_0x093e('0x40')]['rawAttributes']);_0x5ee673['query']=_[_0x093e('0x47')](_0x5bb678[_0x093e('0x34')]);_0x5ee673['filters']=_[_0x093e('0x33')](_0x5ee673['model'],_0x5ee673[_0x093e('0x34')]);_0x28a59a[_0x093e('0x35')]=_[_0x093e('0x33')](_0x5ee673[_0x093e('0x31')],qs[_0x093e('0x36')](_0x5bb678[_0x093e('0x34')][_0x093e('0x36')]));_0x28a59a[_0x093e('0x35')]=_0x28a59a[_0x093e('0x35')][_0x093e('0x37')]?_0x28a59a[_0x093e('0x35')]:_0x5ee673['model'];if(_0x5bb678[_0x093e('0x34')][_0x093e('0x41')]){_0x28a59a[_0x093e('0x42')]=[{'all':!![]}];}_0x28a59a=_['merge']({},_0x28a59a,_0x5bb678[_0x093e('0x3f')]);return db[_0x093e('0x40')][_0x093e('0x48')](_0x28a59a)[_0x093e('0x27')](handleEntityNotFound(_0x41be40,null))[_0x093e('0x27')](respondWithResult(_0x41be40,null))[_0x093e('0x44')](handleError(_0x41be40,null));};exports['create']=function(_0x28a782,_0x260853){return db[_0x093e('0x40')][_0x093e('0x49')](_0x28a782[_0x093e('0x4a')],{})['then'](respondWithResult(_0x260853,0xc9))['catch'](handleError(_0x260853,null));};exports[_0x093e('0x26')]=function(_0x7b52e2,_0x20405b){if(_0x7b52e2[_0x093e('0x4a')]['id']){delete _0x7b52e2[_0x093e('0x4a')]['id'];}return db[_0x093e('0x40')]['find']({'where':{'id':_0x7b52e2[_0x093e('0x46')]['id']}})[_0x093e('0x27')](handleEntityNotFound(_0x20405b,null))[_0x093e('0x27')](saveUpdates(_0x7b52e2[_0x093e('0x4a')],null))['then'](respondWithResult(_0x20405b,null))[_0x093e('0x44')](handleError(_0x20405b,null));};exports[_0x093e('0x4b')]=function(_0x5a0ce4,_0x11f0a0){return db[_0x093e('0x40')]['find']({'where':{'id':_0x5a0ce4['params']['id']}})[_0x093e('0x27')](handleEntityNotFound(_0x11f0a0,null))[_0x093e('0x27')](removeEntity(_0x11f0a0,null))['catch'](handleError(_0x11f0a0,null));};exports[_0x093e('0x4c')]=function(_0x247f43,_0x4bbdeb,_0x132b39){var _0xe879f8={};var _0x1c31fd={};var _0xd2b6de;var _0x4f9e54;return db[_0x093e('0x40')][_0x093e('0x4d')]({'where':{'id':_0x247f43[_0x093e('0x46')]['id']}})[_0x093e('0x27')](handleEntityNotFound(_0x4bbdeb,null))['then'](function(_0x169da4){if(_0x169da4){_0xd2b6de=_0x169da4;_0x1c31fd['model']=_[_0x093e('0x47')](db[_0x093e('0x4e')][_0x093e('0x2d')]);_0x1c31fd[_0x093e('0x34')]=_[_0x093e('0x47')](_0x247f43[_0x093e('0x34')]);_0x1c31fd[_0x093e('0x32')]=_[_0x093e('0x33')](_0x1c31fd[_0x093e('0x31')],_0x1c31fd['query']);_0xe879f8[_0x093e('0x35')]=_[_0x093e('0x33')](_0x1c31fd['model'],qs[_0x093e('0x36')](_0x247f43[_0x093e('0x34')][_0x093e('0x36')]));_0xe879f8['attributes']=_0xe879f8[_0x093e('0x35')][_0x093e('0x37')]?_0xe879f8[_0x093e('0x35')]:_0x1c31fd[_0x093e('0x31')];_0xe879f8[_0x093e('0x4f')]=qs['sort'](_0x247f43[_0x093e('0x34')][_0x093e('0x3a')]);_0xe879f8[_0x093e('0x3c')]=qs[_0x093e('0x32')](_[_0x093e('0x3b')](_0x247f43[_0x093e('0x34')],_0x1c31fd['filters']));if(_0x247f43[_0x093e('0x34')][_0x093e('0x3e')]){_0xe879f8[_0x093e('0x3c')]=_[_0x093e('0x3d')](_0xe879f8[_0x093e('0x3c')],{'$or':_[_0x093e('0x2c')](_0xe879f8[_0x093e('0x35')],function(_0x4d8921){var _0x14a181={};_0x14a181[_0x4d8921]={'$like':'%'+_0x247f43[_0x093e('0x34')]['filter']+'%'};return _0x14a181;})});}_0xe879f8=_[_0x093e('0x3d')]({},_0xe879f8,_0x247f43[_0x093e('0x3f')]);return _0xd2b6de[_0x093e('0x4c')](_0xe879f8);}})[_0x093e('0x27')](function(_0x568661){if(_0x568661){_0x4f9e54=_0x568661[_0x093e('0x37')];if(!_0x247f43[_0x093e('0x34')]['hasOwnProperty']('nolimit')){_0xe879f8[_0x093e('0x20')]=qs[_0x093e('0x20')](_0x247f43[_0x093e('0x34')][_0x093e('0x20')]);_0xe879f8[_0x093e('0x1d')]=qs['offset'](_0x247f43[_0x093e('0x34')][_0x093e('0x1d')]);}return _0xd2b6de[_0x093e('0x4c')](_0xe879f8);}})[_0x093e('0x27')](function(_0x14e5b4){if(_0x14e5b4){return _0x14e5b4?{'count':_0x4f9e54,'rows':_0x14e5b4}:null;}})[_0x093e('0x27')](respondWithResult(_0x4bbdeb,null))[_0x093e('0x44')](handleError(_0x4bbdeb,null));};exports['addConfiguration']=function(_0x4cfc38,_0x32d5bb,_0x5c9a76){if(_0x4cfc38[_0x093e('0x4a')]['id']){delete _0x4cfc38[_0x093e('0x4a')]['id'];}return db['SalesforceAccount'][_0x093e('0x4d')]({'where':{'id':_0x4cfc38['params']['id']}})[_0x093e('0x27')](handleEntityNotFound(_0x32d5bb,null))['then'](function(_0xb86a52){if(_0xb86a52){_0x4cfc38['body'][_0x093e('0x50')]=_0xb86a52['id'];_0x4cfc38['body']['Subjects']=integrations[_0x093e('0x51')](_0x4cfc38[_0x093e('0x4a')][_0x093e('0x52')],_0x4cfc38[_0x093e('0x4a')][_0x093e('0x2f')]);_0x4cfc38[_0x093e('0x4a')][_0x093e('0x53')]=integrations[_0x093e('0x54')](_0x4cfc38[_0x093e('0x4a')][_0x093e('0x52')],_0x4cfc38[_0x093e('0x4a')][_0x093e('0x2f')]);return db[_0x093e('0x4e')][_0x093e('0x49')](_0x4cfc38[_0x093e('0x4a')],{'include':[{'model':db[_0x093e('0x55')],'as':'Subjects'},{'model':db[_0x093e('0x55')],'as':_0x093e('0x53')}]});}return null;})[_0x093e('0x27')](respondWithResult(_0x32d5bb,null))[_0x093e('0x44')](handleError(_0x32d5bb,null));};exports[_0x093e('0x56')]=function(_0x108068,_0x4fb327,_0x2740fe){var _0x3d6010;var _0x53f5ef='';var _0x46e1be='Task';return db[_0x093e('0x40')]['findOne']({'where':{'id':_0x108068[_0x093e('0x46')]['id']},'attributes':['id','remoteUri','clientId',_0x093e('0x57'),_0x093e('0x58'),_0x093e('0x59'),_0x093e('0x5a')]})[_0x093e('0x27')](handleEntityNotFound(_0x4fb327,null))[_0x093e('0x27')](function(_0x904fa){if(_0x904fa){_0x53f5ef=_0x904fa[_0x093e('0x5b')];var _0x32c046=_0x53f5ef[_0x093e('0x5c')](-0x1);if(_0x32c046==='/'){_0x53f5ef=_0x53f5ef[_0x093e('0x5d')](0x0,_0x53f5ef[_0x093e('0x5e')](_0x32c046));}_0x3d6010=new jsforce[(_0x093e('0x5f'))]({'oauth2':{'loginUrl':_0x53f5ef,'clientId':_0x904fa['clientId'],'clientSecret':_0x904fa[_0x093e('0x57')]}});return _0x3d6010[_0x093e('0x60')](_0x904fa[_0x093e('0x58')],_0x904fa[_0x093e('0x59')]['concat'](_0x904fa[_0x093e('0x5a')]));}})[_0x093e('0x27')](function(_0x178593){if(_0x178593){if(!_[_0x093e('0x61')](_0x108068['query']['ticketType'])){_0x46e1be=_0x108068[_0x093e('0x34')][_0x093e('0x62')];}return _0x3d6010['sobject'](_0x46e1be)[_0x093e('0x63')]();}})[_0x093e('0x27')](function(_0x5c2baf){var _0x27b589=[_0x093e('0x64'),_0x093e('0x65'),_0x093e('0x66'),_0x093e('0x67'),_0x093e('0x68'),_0x093e('0x69')];var _0x1ab59e=[_0x093e('0x6a'),_0x093e('0x6b'),_0x093e('0x6c'),_0x093e('0x6d'),_0x093e('0x6e'),'textarea','phone'];if(_0x5c2baf){_[_0x093e('0x6f')](_0x5c2baf[_0x093e('0x36')],function(_0x252e23){return _0x27b589[_0x093e('0x70')](_0x252e23[_0x093e('0x29')])||!_0x1ab59e[_0x093e('0x70')](_0x252e23[_0x093e('0x2f')]);});return{'count':_0x5c2baf[_0x093e('0x36')][_0x093e('0x37')],'rows':_[_0x093e('0x2c')](_0x5c2baf[_0x093e('0x36')],function(_0x38f6c3){return{'id':_0x38f6c3[_0x093e('0x29')],'name':_0x38f6c3[_0x093e('0x71')],'custom':_0x38f6c3[_0x093e('0x72')],'options':_0x38f6c3['picklistValues'][_0x093e('0x37')]>0x0?_['map'](_0x38f6c3['picklistValues'],function(_0x1d7814){return{'name':_0x1d7814[_0x093e('0x71')],'value':_0x1d7814[_0x093e('0x73')]};}):_0x38f6c3[_0x093e('0x2f')]==_0x093e('0x6d')?[{'name':_0x093e('0x74'),'value':_0x093e('0x75')},{'name':_0x093e('0x76'),'value':_0x093e('0x77')}]:[]};})};}})[_0x093e('0x27')](respondWithResult(_0x4fb327,null))['catch'](function(_0x1b121e){var _0x3694c9=_0x108068[_0x093e('0x34')][_0x093e('0x78')]?0x1f4:_0x1b121e[_0x093e('0x79')]||0x1f4;logger[_0x093e('0x28')](_0x093e('0x7a'),'getFields',_0x3694c9,JSON['stringify'](_0x1b121e));delete _0x1b121e['name'];if(_0x3694c9===0x191){_0x3694c9=0x190;}_0x4fb327[_0x093e('0x21')](_0x3694c9)['send'](_0x108068[_0x093e('0x34')][_0x093e('0x78')]?{'message':_0x093e('0x7b'),'statusCode':_0x1b121e[_0x093e('0x79')]}:_0x1b121e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 43e79f9..a7fe60e 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 _0xfb7d=['../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x20f1a9,_0x48e411){var _0x599cbd=function(_0x59f438){while(--_0x59f438){_0x20f1a9['push'](_0x20f1a9['shift']());}};_0x599cbd(++_0x48e411);}(_0xfb7d,0x94));var _0xdfb7=function(_0x16a8c6,_0x40d55){_0x16a8c6=_0x16a8c6-0x0;var _0x3b85f4=_0xfb7d[_0x16a8c6];return _0x3b85f4;};'use strict';var _=require(_0xdfb7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfb7('0x1'));var moment=require(_0xdfb7('0x2'));var BPromise=require('bluebird');var rp=require(_0xdfb7('0x3'));var fs=require('fs');var path=require(_0xdfb7('0x4'));var rimraf=require(_0xdfb7('0x5'));var config=require(_0xdfb7('0x6'));var attributes=require(_0xdfb7('0x7'));var integrations=require(_0xdfb7('0x8'));module['exports']=function(_0x502553,_0x20991a){return _0x502553[_0xdfb7('0x9')](_0xdfb7('0xa'),attributes,{'tableName':_0xdfb7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03da=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x5e4663,_0x251345){var _0x29d885=function(_0x280869){while(--_0x280869){_0x5e4663['push'](_0x5e4663['shift']());}};_0x29d885(++_0x251345);}(_0x03da,0xec));var _0xa03d=function(_0xa2c2e2,_0x535d90){_0xa2c2e2=_0xa2c2e2-0x0;var _0x3d7867=_0x03da[_0xa2c2e2];return _0x3d7867;};'use strict';var _=require(_0xa03d('0x0'));var util=require(_0xa03d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa03d('0x2'));var BPromise=require(_0xa03d('0x3'));var rp=require(_0xa03d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa03d('0x5'));var config=require(_0xa03d('0x6'));var attributes=require(_0xa03d('0x7'));var integrations=require(_0xa03d('0x8'));module['exports']=function(_0x5e8c6c,_0x54d5d9){return _0x5e8c6c['define'](_0xa03d('0x9'),attributes,{'tableName':_0xa03d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e9f2ce1..e20d1cd 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 _0xa039=['request\x20sent','stringify','error','code','message','info','catch','GetSalesforceAccount','findAll','options','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','client','http','then','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x132b71,_0x25f23e){var _0x224664=function(_0x1f9e23){while(--_0x1f9e23){_0x132b71['push'](_0x132b71['shift']());}};_0x224664(++_0x25f23e);}(_0xa039,0x102));var _0x9a03=function(_0x558647,_0xc20447){_0x558647=_0x558647-0x0;var _0x573919=_0xa039[_0x558647];return _0x573919;};'use strict';var _=require(_0x9a03('0x0'));var util=require(_0x9a03('0x1'));var moment=require('moment');var BPromise=require(_0x9a03('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a03('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a03('0x4'));var logger=require(_0x9a03('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a03('0x6')][_0x9a03('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x304b59,_0x28be23,_0x280943){return new BPromise(function(_0x338469,_0x59d253){return client['request'](_0x304b59,_0x280943)[_0x9a03('0x8')](function(_0x229c93){logger['info'](_0x9a03('0x9'),_0x28be23,'request\x20sent');logger[_0x9a03('0xa')](_0x9a03('0xb'),_0x28be23,_0x9a03('0xc'),JSON[_0x9a03('0xd')](_0x229c93));if(_0x229c93[_0x9a03('0xe')]){if(_0x229c93[_0x9a03('0xe')][_0x9a03('0xf')]===0x1f4){logger[_0x9a03('0xe')](_0x9a03('0x9'),_0x28be23,_0x229c93[_0x9a03('0xe')][_0x9a03('0x10')]);return _0x59d253(_0x229c93['error']['message']);}logger[_0x9a03('0xe')](_0x9a03('0x9'),_0x28be23,_0x229c93[_0x9a03('0xe')]['message']);return _0x338469(_0x229c93[_0x9a03('0xe')][_0x9a03('0x10')]);}else{logger[_0x9a03('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x28be23,_0x9a03('0xc'));_0x338469(_0x229c93['result'][_0x9a03('0x10')]);}})[_0x9a03('0x12')](function(_0x406732){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x28be23,_0x406732);_0x59d253(_0x406732);});});}exports[_0x9a03('0x13')]=function(_0x22681f){var _0x468cb6=this;return new Promise(function(_0x201cc8,_0x3115e0){return db['SalesforceAccount'][_0x9a03('0x14')]({'raw':_0x22681f[_0x9a03('0x15')]?_0x22681f['options']['raw']===undefined?!![]:![]:!![],'where':_0x22681f[_0x9a03('0x15')]?_0x22681f[_0x9a03('0x15')][_0x9a03('0x16')]||null:null,'attributes':_0x22681f[_0x9a03('0x15')]?_0x22681f['options'][_0x9a03('0x17')]||null:null,'limit':_0x22681f[_0x9a03('0x15')]?_0x22681f[_0x9a03('0x15')][_0x9a03('0x18')]||null:null,'include':_0x22681f['options']?_0x22681f[_0x9a03('0x15')][_0x9a03('0x19')]?_[_0x9a03('0x1a')](_0x22681f['options'][_0x9a03('0x19')],function(_0x502ab9){return{'model':db[_0x502ab9[_0x9a03('0x1b')]],'as':_0x502ab9['as'],'attributes':_0x502ab9[_0x9a03('0x17')],'include':_0x502ab9[_0x9a03('0x19')]?_[_0x9a03('0x1a')](_0x502ab9[_0x9a03('0x19')],function(_0x5475c1){return{'model':db[_0x5475c1[_0x9a03('0x1b')]],'as':_0x5475c1['as'],'attributes':_0x5475c1[_0x9a03('0x17')],'include':_0x5475c1['include']?_['map'](_0x5475c1[_0x9a03('0x19')],function(_0x9b5441){return{'model':db[_0x9b5441[_0x9a03('0x1b')]],'as':_0x9b5441['as'],'attributes':_0x9b5441['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a03('0x8')](function(_0x27cdb3){logger[_0x9a03('0x11')]('GetSalesforceAccount',_0x22681f);logger[_0x9a03('0xa')](_0x9a03('0x13'),_0x22681f,JSON[_0x9a03('0xd')](_0x27cdb3));_0x201cc8(_0x27cdb3);})[_0x9a03('0x12')](function(_0x403a12){logger['error'](_0x9a03('0x13'),_0x403a12[_0x9a03('0x10')],_0x22681f);_0x3115e0(_0x468cb6[_0x9a03('0xe')](0x1f4,_0x403a12[_0x9a03('0x10')]));});});};exports[_0x9a03('0x1c')]=function(_0x511ac4){var _0x3624ed=this;return new Promise(function(_0x3e7cb0,_0x2e6c26){return db['SalesforceAccount'][_0x9a03('0x1d')]({'raw':_0x511ac4['options']?_0x511ac4[_0x9a03('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x511ac4[_0x9a03('0x15')]?_0x511ac4['options'][_0x9a03('0x16')]||null:null,'attributes':_0x511ac4[_0x9a03('0x15')]?_0x511ac4[_0x9a03('0x15')][_0x9a03('0x17')]||null:null,'include':_0x511ac4['options']?_0x511ac4['options'][_0x9a03('0x19')]?_[_0x9a03('0x1a')](_0x511ac4['options']['include'],function(_0x1d9bff){return{'model':db[_0x1d9bff[_0x9a03('0x1b')]],'as':_0x1d9bff['as'],'attributes':_0x1d9bff['attributes'],'include':_0x1d9bff[_0x9a03('0x19')]?_[_0x9a03('0x1a')](_0x1d9bff[_0x9a03('0x19')],function(_0x45034a){return{'model':db[_0x45034a[_0x9a03('0x1b')]],'as':_0x45034a['as'],'attributes':_0x45034a['attributes'],'include':_0x45034a[_0x9a03('0x19')]?_[_0x9a03('0x1a')](_0x45034a['include'],function(_0xb04aec){return{'model':db[_0xb04aec['model']],'as':_0xb04aec['as'],'attributes':_0xb04aec[_0x9a03('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9a03('0x8')](function(_0x475ae1){logger[_0x9a03('0x11')](_0x9a03('0x1c'),_0x511ac4);logger[_0x9a03('0xa')](_0x9a03('0x1c'),_0x511ac4,JSON[_0x9a03('0xd')](_0x475ae1));_0x3e7cb0(_0x475ae1);})['catch'](function(_0x4b0bed){logger[_0x9a03('0xe')](_0x9a03('0x1c'),_0x4b0bed['message'],_0x511ac4);_0x2e6c26(_0x3624ed[_0x9a03('0xe')](0x1f4,_0x4b0bed[_0x9a03('0x10')]));});});}; \ No newline at end of file +var _0xbd64=['SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','map','include','model','ShowSalesforceAccount','find','raw','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3ead55,_0x22bc51){var _0x3ea16d=function(_0x2a59e0){while(--_0x2a59e0){_0x3ead55['push'](_0x3ead55['shift']());}};_0x3ea16d(++_0x22bc51);}(_0xbd64,0x1cf));var _0x4bd6=function(_0x1ebf28,_0x169829){_0x1ebf28=_0x1ebf28-0x0;var _0x2fcb10=_0xbd64[_0x1ebf28];return _0x2fcb10;};'use strict';var _=require(_0x4bd6('0x0'));var util=require('util');var moment=require(_0x4bd6('0x1'));var BPromise=require(_0x4bd6('0x2'));var rs=require(_0x4bd6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4bd6('0x4'));var logger=require(_0x4bd6('0x5'))(_0x4bd6('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bd6('0x7'));var client=jayson[_0x4bd6('0x8')][_0x4bd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23f02f,_0x3a26ed,_0x33579c){return new BPromise(function(_0x4a6bda,_0x47ff3c){return client[_0x4bd6('0xa')](_0x23f02f,_0x33579c)[_0x4bd6('0xb')](function(_0x591b94){logger[_0x4bd6('0xc')](_0x4bd6('0xd'),_0x3a26ed,_0x4bd6('0xe'));logger[_0x4bd6('0xf')](_0x4bd6('0x10'),_0x3a26ed,'request\x20sent',JSON[_0x4bd6('0x11')](_0x591b94));if(_0x591b94[_0x4bd6('0x12')]){if(_0x591b94[_0x4bd6('0x12')][_0x4bd6('0x13')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3a26ed,_0x591b94['error']['message']);return _0x47ff3c(_0x591b94[_0x4bd6('0x12')][_0x4bd6('0x14')]);}logger[_0x4bd6('0x12')](_0x4bd6('0xd'),_0x3a26ed,_0x591b94['error']['message']);return _0x4a6bda(_0x591b94[_0x4bd6('0x12')][_0x4bd6('0x14')]);}else{logger[_0x4bd6('0xc')](_0x4bd6('0xd'),_0x3a26ed,'request\x20sent');_0x4a6bda(_0x591b94[_0x4bd6('0x15')][_0x4bd6('0x14')]);}})[_0x4bd6('0x16')](function(_0x2d64a2){logger[_0x4bd6('0x12')](_0x4bd6('0xd'),_0x3a26ed,_0x2d64a2);_0x47ff3c(_0x2d64a2);});});}exports[_0x4bd6('0x17')]=function(_0x429e7f){var _0xb5a91b=this;return new Promise(function(_0x4f2425,_0x2a5d6b){return db[_0x4bd6('0x18')][_0x4bd6('0x19')]({'raw':_0x429e7f[_0x4bd6('0x1a')]?_0x429e7f[_0x4bd6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x429e7f[_0x4bd6('0x1a')]?_0x429e7f[_0x4bd6('0x1a')]['where']||null:null,'attributes':_0x429e7f[_0x4bd6('0x1a')]?_0x429e7f[_0x4bd6('0x1a')][_0x4bd6('0x1b')]||null:null,'limit':_0x429e7f['options']?_0x429e7f[_0x4bd6('0x1a')]['limit']||null:null,'include':_0x429e7f[_0x4bd6('0x1a')]?_0x429e7f[_0x4bd6('0x1a')]['include']?_[_0x4bd6('0x1c')](_0x429e7f[_0x4bd6('0x1a')]['include'],function(_0xd91ceb){return{'model':db[_0xd91ceb['model']],'as':_0xd91ceb['as'],'attributes':_0xd91ceb[_0x4bd6('0x1b')],'include':_0xd91ceb[_0x4bd6('0x1d')]?_[_0x4bd6('0x1c')](_0xd91ceb['include'],function(_0x2acc7d){return{'model':db[_0x2acc7d[_0x4bd6('0x1e')]],'as':_0x2acc7d['as'],'attributes':_0x2acc7d[_0x4bd6('0x1b')],'include':_0x2acc7d[_0x4bd6('0x1d')]?_[_0x4bd6('0x1c')](_0x2acc7d['include'],function(_0x2a6347){return{'model':db[_0x2a6347[_0x4bd6('0x1e')]],'as':_0x2a6347['as'],'attributes':_0x2a6347['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x364def){logger[_0x4bd6('0xc')](_0x4bd6('0x17'),_0x429e7f);logger[_0x4bd6('0xf')](_0x4bd6('0x17'),_0x429e7f,JSON[_0x4bd6('0x11')](_0x364def));_0x4f2425(_0x364def);})[_0x4bd6('0x16')](function(_0x255d65){logger[_0x4bd6('0x12')](_0x4bd6('0x17'),_0x255d65['message'],_0x429e7f);_0x2a5d6b(_0xb5a91b[_0x4bd6('0x12')](0x1f4,_0x255d65[_0x4bd6('0x14')]));});});};exports[_0x4bd6('0x1f')]=function(_0x109470){var _0x2725b6=this;return new Promise(function(_0x4f084c,_0x2e9c90){return db[_0x4bd6('0x18')][_0x4bd6('0x20')]({'raw':_0x109470['options']?_0x109470[_0x4bd6('0x1a')][_0x4bd6('0x21')]===undefined?!![]:![]:!![],'where':_0x109470['options']?_0x109470['options']['where']||null:null,'attributes':_0x109470[_0x4bd6('0x1a')]?_0x109470['options']['attributes']||null:null,'include':_0x109470['options']?_0x109470[_0x4bd6('0x1a')][_0x4bd6('0x1d')]?_[_0x4bd6('0x1c')](_0x109470[_0x4bd6('0x1a')]['include'],function(_0x2d9d12){return{'model':db[_0x2d9d12['model']],'as':_0x2d9d12['as'],'attributes':_0x2d9d12[_0x4bd6('0x1b')],'include':_0x2d9d12['include']?_[_0x4bd6('0x1c')](_0x2d9d12[_0x4bd6('0x1d')],function(_0x16dc26){return{'model':db[_0x16dc26[_0x4bd6('0x1e')]],'as':_0x16dc26['as'],'attributes':_0x16dc26[_0x4bd6('0x1b')],'include':_0x16dc26['include']?_[_0x4bd6('0x1c')](_0x16dc26[_0x4bd6('0x1d')],function(_0x3a1f2f){return{'model':db[_0x3a1f2f['model']],'as':_0x3a1f2f['as'],'attributes':_0x3a1f2f[_0x4bd6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x100ac1){logger[_0x4bd6('0xc')](_0x4bd6('0x1f'),_0x109470);logger[_0x4bd6('0xf')](_0x4bd6('0x1f'),_0x109470,JSON['stringify'](_0x100ac1));_0x4f084c(_0x100ac1);})[_0x4bd6('0x16')](function(_0x43daf4){logger[_0x4bd6('0x12')](_0x4bd6('0x1f'),_0x43daf4[_0x4bd6('0x14')],_0x109470);_0x2e9c90(_0x2725b6['error'](0x1f4,_0x43daf4[_0x4bd6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 70013fb..03e3e28 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2d380d,_0x5d6d3a){var _0x5b9c76=function(_0x1fdb96){while(--_0x1fdb96){_0x2d380d['push'](_0x2d380d['shift']());}};_0x5b9c76(++_0x5d6d3a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x1ee271,_0x2ffa6e){var _0x5e66e3=function(_0x465438){while(--_0x465438){_0x1ee271['push'](_0x1ee271['shift']());}};_0x5e66e3(++_0x2ffa6e);}(_0x2ef3,0xba));var _0x32ef=function(_0x3133fb,_0x22f196){_0x3133fb=_0x3133fb-0x0;var _0x3b4f6f=_0x2ef3[_0x3133fb];return _0x3b4f6f;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c7133dd..61e5b6b 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 _0x7ee4=['contact_lead','contact','lead','account','exports','STRING','ENUM','Task'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7ee4,0xac));var _0x47ee=function(_0x50d993,_0x300507){_0x50d993=_0x50d993-0x0;var _0x5483d4=_0x7ee4[_0x50d993];return _0x5483d4;};'use strict';var Sequelize=require('sequelize');module[_0x47ee('0x0')]={'name':{'type':Sequelize[_0x47ee('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x47ee('0x2')]('Task','Case'),'defaultValue':_0x47ee('0x3')},'moduleSearch':{'type':Sequelize[_0x47ee('0x2')](_0x47ee('0x4'),_0x47ee('0x5'),_0x47ee('0x6'),'account_contact_lead','account'),'defaultValue':_0x47ee('0x4')},'moduleCreate':{'type':Sequelize[_0x47ee('0x2')]('nothing',_0x47ee('0x5'),_0x47ee('0x6'),_0x47ee('0x7')),'defaultValue':_0x47ee('0x6')},'leadId':{'type':Sequelize[_0x47ee('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x47ee('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x47ee('0x1')]}}; \ No newline at end of file +var _0x3ec8=['contact','lead','exports','STRING','Task','Case','contact_lead','account_contact_lead','account','ENUM','nothing'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3ec8,0x141));var _0x83ec=function(_0x351c9d,_0x28fa17){_0x351c9d=_0x351c9d-0x0;var _0x2eea15=_0x3ec8[_0x351c9d];return _0x2eea15;};'use strict';var Sequelize=require('sequelize');module[_0x83ec('0x0')]={'name':{'type':Sequelize[_0x83ec('0x1')]},'description':{'type':Sequelize[_0x83ec('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x83ec('0x2'),_0x83ec('0x3')),'defaultValue':_0x83ec('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x83ec('0x4'),'contact','lead',_0x83ec('0x5'),_0x83ec('0x6')),'defaultValue':_0x83ec('0x4')},'moduleCreate':{'type':Sequelize[_0x83ec('0x7')](_0x83ec('0x8'),_0x83ec('0x9'),_0x83ec('0xa'),_0x83ec('0x6')),'defaultValue':_0x83ec('0xa')},'leadId':{'type':Sequelize[_0x83ec('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x83ec('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x83ec('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x83ec('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7a2f6d8..a79ad65 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 _0xf429=['sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','find','getFields','findOne','SalesforceField','filter','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf429,0xd5));var _0x9f42=function(_0x5906a5,_0x48af0a){_0x5906a5=_0x5906a5-0x0;var _0x1b9a31=_0xf429[_0x5906a5];return _0x1b9a31;};'use strict';var emlformat=require(_0x9f42('0x0'));var rimraf=require(_0x9f42('0x1'));var zipdir=require(_0x9f42('0x2'));var jsonpatch=require(_0x9f42('0x3'));var rp=require(_0x9f42('0x4'));var moment=require('moment');var BPromise=require(_0x9f42('0x5'));var Mustache=require(_0x9f42('0x6'));var util=require(_0x9f42('0x7'));var path=require(_0x9f42('0x8'));var sox=require(_0x9f42('0x9'));var csv=require(_0x9f42('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f42('0xb'));var _=require(_0x9f42('0xc'));var squel=require(_0x9f42('0xd'));var crypto=require(_0x9f42('0xe'));var jsforce=require(_0x9f42('0xf'));var deskjs=require(_0x9f42('0x10'));var toCsv=require(_0x9f42('0xa'));var querystring=require(_0x9f42('0x11'));var Papa=require(_0x9f42('0x12'));var Redis=require(_0x9f42('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f42('0x14'));var hardwareService=require(_0x9f42('0x15'));var logger=require('../../config/logger')(_0x9f42('0x16'));var utils=require(_0x9f42('0x17'));var config=require(_0x9f42('0x18'));var licenseUtil=require(_0x9f42('0x19'));var db=require(_0x9f42('0x1a'))['db'];function respondWithStatusCode(_0x2c0400,_0xfbd620){_0xfbd620=_0xfbd620||0xcc;return function(_0x376601){if(_0x376601){return _0x2c0400[_0x9f42('0x1b')](_0xfbd620);}return _0x2c0400[_0x9f42('0x1c')](_0xfbd620)['end']();};}function respondWithResult(_0x1fc886,_0x33ef73){_0x33ef73=_0x33ef73||0xc8;return function(_0x36aaae){if(_0x36aaae){return _0x1fc886['status'](_0x33ef73)[_0x9f42('0x1d')](_0x36aaae);}};}function respondWithFilteredResult(_0x455e28,_0x3ff902){return function(_0xad6af7){if(_0xad6af7){var _0x14e2a9=typeof _0x3ff902[_0x9f42('0x1e')]==='undefined'&&typeof _0x3ff902['limit']===_0x9f42('0x1f');var _0x1a86fc=_0xad6af7[_0x9f42('0x20')];var _0x5a3fe0=_0x14e2a9?0x0:_0x3ff902[_0x9f42('0x1e')];var _0x27460c=_0x14e2a9?_0xad6af7[_0x9f42('0x20')]:_0x3ff902[_0x9f42('0x1e')]+_0x3ff902[_0x9f42('0x21')];var _0x396ae2;if(_0x27460c>=_0x1a86fc){_0x27460c=_0x1a86fc;_0x396ae2=0xc8;}else{_0x396ae2=0xce;}_0x455e28[_0x9f42('0x1c')](_0x396ae2);return _0x455e28['set']('Content-Range',_0x5a3fe0+'-'+_0x27460c+'/'+_0x1a86fc)[_0x9f42('0x1d')](_0xad6af7);}return null;};}function patchUpdates(_0x4fedb5){return function(_0x5e396a){try{jsonpatch[_0x9f42('0x22')](_0x5e396a,_0x4fedb5,!![]);}catch(_0x59f2c2){return BPromise[_0x9f42('0x23')](_0x59f2c2);}return _0x5e396a[_0x9f42('0x24')]();};}function saveUpdates(_0x358c66,_0x316a49){return function(_0x33449c){if(_0x33449c){return _0x33449c[_0x9f42('0x25')](_0x358c66)[_0x9f42('0x26')](function(_0x1da06d){return _0x1da06d;});}return null;};}function removeEntity(_0x19ef02,_0x231f8a){return function(_0x3e9b11){if(_0x3e9b11){return _0x3e9b11[_0x9f42('0x27')]()[_0x9f42('0x26')](function(){_0x19ef02[_0x9f42('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33e0a0,_0x30cbe5){return function(_0x31c164){if(!_0x31c164){_0x33e0a0[_0x9f42('0x1b')](0x194);}return _0x31c164;};}function handleError(_0x20a0d8,_0x449f5d){_0x449f5d=_0x449f5d||0x1f4;return function(_0x1f168f){logger[_0x9f42('0x28')](_0x1f168f[_0x9f42('0x29')]);if(_0x1f168f[_0x9f42('0x2a')]){delete _0x1f168f[_0x9f42('0x2a')];}_0x20a0d8['status'](_0x449f5d)['send'](_0x1f168f);};}exports['index']=function(_0xeb1b59,_0x1838f8){var _0x44eb87={},_0x1639e6={},_0x2d93cb={'count':0x0,'rows':[]};var _0x4389e7=_[_0x9f42('0x2b')](db['SalesforceConfiguration']['rawAttributes'],function(_0x4d0ce2){return{'name':_0x4d0ce2[_0x9f42('0x2c')],'type':_0x4d0ce2[_0x9f42('0x2d')]['key']};});_0x1639e6[_0x9f42('0x2e')]=_[_0x9f42('0x2b')](_0x4389e7,_0x9f42('0x2a'));_0x1639e6[_0x9f42('0x2f')]=_[_0x9f42('0x30')](_0xeb1b59[_0x9f42('0x2f')]);_0x1639e6[_0x9f42('0x31')]=_[_0x9f42('0x32')](_0x1639e6[_0x9f42('0x2e')],_0x1639e6['query']);_0x44eb87[_0x9f42('0x33')]=_[_0x9f42('0x32')](_0x1639e6['model'],qs[_0x9f42('0x34')](_0xeb1b59[_0x9f42('0x2f')][_0x9f42('0x34')]));_0x44eb87[_0x9f42('0x33')]=_0x44eb87[_0x9f42('0x33')][_0x9f42('0x35')]?_0x44eb87[_0x9f42('0x33')]:_0x1639e6[_0x9f42('0x2e')];if(!_0xeb1b59[_0x9f42('0x2f')][_0x9f42('0x36')](_0x9f42('0x37'))){_0x44eb87[_0x9f42('0x21')]=qs[_0x9f42('0x21')](_0xeb1b59['query'][_0x9f42('0x21')]);_0x44eb87[_0x9f42('0x1e')]=qs[_0x9f42('0x1e')](_0xeb1b59[_0x9f42('0x2f')][_0x9f42('0x1e')]);}_0x44eb87[_0x9f42('0x38')]=qs['sort'](_0xeb1b59[_0x9f42('0x2f')][_0x9f42('0x39')]);_0x44eb87[_0x9f42('0x3a')]=qs[_0x9f42('0x31')](_[_0x9f42('0x3b')](_0xeb1b59[_0x9f42('0x2f')],_0x1639e6[_0x9f42('0x31')]),_0x4389e7);if(_0xeb1b59[_0x9f42('0x2f')]['filter']){_0x44eb87[_0x9f42('0x3a')]=_[_0x9f42('0x3c')](_0x44eb87[_0x9f42('0x3a')],{'$or':_[_0x9f42('0x2b')](_0x4389e7,function(_0xc642e4){if(_0xc642e4['type']!=='VIRTUAL'){var _0x3f143d={};_0x3f143d[_0xc642e4[_0x9f42('0x2a')]]={'$like':'%'+_0xeb1b59[_0x9f42('0x2f')]['filter']+'%'};return _0x3f143d;}})});}_0x44eb87=_[_0x9f42('0x3c')]({},_0x44eb87,_0xeb1b59['options']);var _0x25d618={'where':_0x44eb87[_0x9f42('0x3a')]};return db[_0x9f42('0x3d')]['count'](_0x25d618)[_0x9f42('0x26')](function(_0x4c4235){_0x2d93cb['count']=_0x4c4235;if(_0xeb1b59[_0x9f42('0x2f')][_0x9f42('0x3e')]){_0x44eb87[_0x9f42('0x3f')]=[{'all':!![]}];}return db[_0x9f42('0x3d')][_0x9f42('0x40')](_0x44eb87);})['then'](function(_0x1d90a5){_0x2d93cb[_0x9f42('0x41')]=_0x1d90a5;return _0x2d93cb;})[_0x9f42('0x26')](respondWithFilteredResult(_0x1838f8,_0x44eb87))[_0x9f42('0x42')](handleError(_0x1838f8,null));};exports[_0x9f42('0x43')]=function(_0x2a5f01,_0x3967fc){var _0x5d7f7b={'raw':![],'where':{'id':_0x2a5f01['params']['id']}},_0x573885={};_0x573885['model']=_[_0x9f42('0x30')](db[_0x9f42('0x3d')][_0x9f42('0x44')]);_0x573885[_0x9f42('0x2f')]=_[_0x9f42('0x30')](_0x2a5f01[_0x9f42('0x2f')]);_0x573885[_0x9f42('0x31')]=_[_0x9f42('0x32')](_0x573885['model'],_0x573885[_0x9f42('0x2f')]);_0x5d7f7b[_0x9f42('0x33')]=_[_0x9f42('0x32')](_0x573885['model'],qs[_0x9f42('0x34')](_0x2a5f01[_0x9f42('0x2f')][_0x9f42('0x34')]));_0x5d7f7b[_0x9f42('0x33')]=_0x5d7f7b[_0x9f42('0x33')]['length']?_0x5d7f7b[_0x9f42('0x33')]:_0x573885[_0x9f42('0x2e')];if(_0x2a5f01[_0x9f42('0x2f')]['includeAll']){_0x5d7f7b['include']=[{'all':!![]}];}_0x5d7f7b=_[_0x9f42('0x3c')]({},_0x5d7f7b,_0x2a5f01['options']);return db[_0x9f42('0x3d')]['find'](_0x5d7f7b)[_0x9f42('0x26')](handleEntityNotFound(_0x3967fc,null))[_0x9f42('0x26')](respondWithResult(_0x3967fc,null))[_0x9f42('0x42')](handleError(_0x3967fc,null));};exports[_0x9f42('0x45')]=function(_0x31ed4a,_0x296c15){return db[_0x9f42('0x3d')]['create'](_0x31ed4a[_0x9f42('0x46')],{})[_0x9f42('0x26')](respondWithResult(_0x296c15,0xc9))['catch'](handleError(_0x296c15,null));};exports[_0x9f42('0x25')]=function(_0x2af177,_0x4e0275){if(_0x2af177['body']['id']){delete _0x2af177[_0x9f42('0x46')]['id'];}return db[_0x9f42('0x3d')]['find']({'where':{'id':_0x2af177[_0x9f42('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e0275,null))[_0x9f42('0x26')](saveUpdates(_0x2af177[_0x9f42('0x46')],null))[_0x9f42('0x26')](respondWithResult(_0x4e0275,null))['catch'](handleError(_0x4e0275,null));};exports[_0x9f42('0x27')]=function(_0x24450e,_0x10a977){return db[_0x9f42('0x3d')][_0x9f42('0x48')]({'where':{'id':_0x24450e[_0x9f42('0x47')]['id']}})['then'](handleEntityNotFound(_0x10a977,null))[_0x9f42('0x26')](removeEntity(_0x10a977,null))[_0x9f42('0x42')](handleError(_0x10a977,null));};exports[_0x9f42('0x49')]=function(_0x771318,_0x20773f,_0x365f4f){var _0x2925c4={};var _0x36fe33={};var _0x2dd8ad;var _0x5c3da8;return db[_0x9f42('0x3d')][_0x9f42('0x4a')]({'where':{'id':_0x771318[_0x9f42('0x47')]['id']}})['then'](handleEntityNotFound(_0x20773f,null))['then'](function(_0x8ccc6){if(_0x8ccc6){_0x2dd8ad=_0x8ccc6;_0x36fe33[_0x9f42('0x2e')]=_[_0x9f42('0x30')](db[_0x9f42('0x4b')][_0x9f42('0x44')]);_0x36fe33[_0x9f42('0x2f')]=_[_0x9f42('0x30')](_0x771318[_0x9f42('0x2f')]);_0x36fe33['filters']=_[_0x9f42('0x32')](_0x36fe33[_0x9f42('0x2e')],_0x36fe33[_0x9f42('0x2f')]);_0x2925c4[_0x9f42('0x33')]=_[_0x9f42('0x32')](_0x36fe33[_0x9f42('0x2e')],qs[_0x9f42('0x34')](_0x771318[_0x9f42('0x2f')][_0x9f42('0x34')]));_0x2925c4['attributes']=_0x2925c4['attributes'][_0x9f42('0x35')]?_0x2925c4[_0x9f42('0x33')]:_0x36fe33[_0x9f42('0x2e')];_0x2925c4[_0x9f42('0x38')]=qs[_0x9f42('0x39')](_0x771318[_0x9f42('0x2f')][_0x9f42('0x39')]);_0x2925c4['where']=qs[_0x9f42('0x31')](_[_0x9f42('0x3b')](_0x771318['query'],_0x36fe33[_0x9f42('0x31')]));if(_0x771318[_0x9f42('0x2f')][_0x9f42('0x4c')]){_0x2925c4[_0x9f42('0x3a')]=_[_0x9f42('0x3c')](_0x2925c4['where'],{'$or':_[_0x9f42('0x2b')](_0x2925c4['attributes'],function(_0x1fa52c){var _0x243742={};_0x243742[_0x1fa52c]={'$like':'%'+_0x771318['query'][_0x9f42('0x4c')]+'%'};return _0x243742;})});}_0x2925c4=_[_0x9f42('0x3c')]({},_0x2925c4,_0x771318[_0x9f42('0x4d')]);return _0x2dd8ad[_0x9f42('0x49')](_0x2925c4);}})['then'](function(_0x2c89aa){if(_0x2c89aa){_0x5c3da8=_0x2c89aa['length'];if(!_0x771318[_0x9f42('0x2f')][_0x9f42('0x36')](_0x9f42('0x37'))){_0x2925c4[_0x9f42('0x21')]=qs[_0x9f42('0x21')](_0x771318['query']['limit']);_0x2925c4[_0x9f42('0x1e')]=qs[_0x9f42('0x1e')](_0x771318[_0x9f42('0x2f')][_0x9f42('0x1e')]);}return _0x2dd8ad[_0x9f42('0x49')](_0x2925c4);}})[_0x9f42('0x26')](function(_0x2d42a5){if(_0x2d42a5){return _0x2d42a5?{'count':_0x5c3da8,'rows':_0x2d42a5}:null;}})[_0x9f42('0x26')](respondWithResult(_0x20773f,null))[_0x9f42('0x42')](handleError(_0x20773f,null));};exports[_0x9f42('0x4e')]=function(_0x199d07,_0x169e17,_0xf4276a){var _0x266384={};var _0x5c817b={};var _0x362c8c;var _0x34098e;return db['SalesforceConfiguration'][_0x9f42('0x4a')]({'where':{'id':_0x199d07[_0x9f42('0x47')]['id']}})[_0x9f42('0x26')](handleEntityNotFound(_0x169e17,null))[_0x9f42('0x26')](function(_0x236ad){if(_0x236ad){_0x362c8c=_0x236ad;_0x5c817b[_0x9f42('0x2e')]=_['keys'](db[_0x9f42('0x4b')][_0x9f42('0x44')]);_0x5c817b['query']=_[_0x9f42('0x30')](_0x199d07[_0x9f42('0x2f')]);_0x5c817b['filters']=_['intersection'](_0x5c817b[_0x9f42('0x2e')],_0x5c817b[_0x9f42('0x2f')]);_0x266384[_0x9f42('0x33')]=_[_0x9f42('0x32')](_0x5c817b[_0x9f42('0x2e')],qs[_0x9f42('0x34')](_0x199d07[_0x9f42('0x2f')][_0x9f42('0x34')]));_0x266384['attributes']=_0x266384[_0x9f42('0x33')][_0x9f42('0x35')]?_0x266384[_0x9f42('0x33')]:_0x5c817b[_0x9f42('0x2e')];_0x266384[_0x9f42('0x38')]=qs[_0x9f42('0x39')](_0x199d07[_0x9f42('0x2f')][_0x9f42('0x39')]);_0x266384[_0x9f42('0x3a')]=qs['filters'](_['pick'](_0x199d07[_0x9f42('0x2f')],_0x5c817b[_0x9f42('0x31')]));if(_0x199d07[_0x9f42('0x2f')]['filter']){_0x266384['where']=_['merge'](_0x266384[_0x9f42('0x3a')],{'$or':_[_0x9f42('0x2b')](_0x266384[_0x9f42('0x33')],function(_0x320c63){var _0x15aef0={};_0x15aef0[_0x320c63]={'$like':'%'+_0x199d07['query'][_0x9f42('0x4c')]+'%'};return _0x15aef0;})});}_0x266384=_[_0x9f42('0x3c')]({},_0x266384,_0x199d07['options']);return _0x362c8c[_0x9f42('0x4e')](_0x266384);}})[_0x9f42('0x26')](function(_0x2dc854){if(_0x2dc854){_0x34098e=_0x2dc854[_0x9f42('0x35')];if(!_0x199d07[_0x9f42('0x2f')][_0x9f42('0x36')](_0x9f42('0x37'))){_0x266384['limit']=qs[_0x9f42('0x21')](_0x199d07['query'][_0x9f42('0x21')]);_0x266384[_0x9f42('0x1e')]=qs[_0x9f42('0x1e')](_0x199d07[_0x9f42('0x2f')][_0x9f42('0x1e')]);}return _0x362c8c['getSubjects'](_0x266384);}})[_0x9f42('0x26')](function(_0x56a827){if(_0x56a827){return _0x56a827?{'count':_0x34098e,'rows':_0x56a827}:null;}})[_0x9f42('0x26')](respondWithResult(_0x169e17,null))[_0x9f42('0x42')](handleError(_0x169e17,null));};exports[_0x9f42('0x4f')]=function(_0x32a355,_0x1682d9,_0x215909){var _0x3d77ca={};var _0x21e4bc={};var _0x583b72;var _0x50727a;return db['SalesforceConfiguration'][_0x9f42('0x4a')]({'where':{'id':_0x32a355[_0x9f42('0x47')]['id']}})[_0x9f42('0x26')](handleEntityNotFound(_0x1682d9,null))['then'](function(_0x1aa589){if(_0x1aa589){_0x583b72=_0x1aa589;_0x21e4bc[_0x9f42('0x2e')]=_[_0x9f42('0x30')](db[_0x9f42('0x4b')][_0x9f42('0x44')]);_0x21e4bc[_0x9f42('0x2f')]=_['keys'](_0x32a355[_0x9f42('0x2f')]);_0x21e4bc['filters']=_[_0x9f42('0x32')](_0x21e4bc['model'],_0x21e4bc[_0x9f42('0x2f')]);_0x3d77ca[_0x9f42('0x33')]=_[_0x9f42('0x32')](_0x21e4bc[_0x9f42('0x2e')],qs[_0x9f42('0x34')](_0x32a355[_0x9f42('0x2f')][_0x9f42('0x34')]));_0x3d77ca['attributes']=_0x3d77ca[_0x9f42('0x33')]['length']?_0x3d77ca[_0x9f42('0x33')]:_0x21e4bc['model'];_0x3d77ca[_0x9f42('0x38')]=qs[_0x9f42('0x39')](_0x32a355[_0x9f42('0x2f')][_0x9f42('0x39')]);_0x3d77ca[_0x9f42('0x3a')]=qs['filters'](_[_0x9f42('0x3b')](_0x32a355['query'],_0x21e4bc[_0x9f42('0x31')]));if(_0x32a355[_0x9f42('0x2f')]['filter']){_0x3d77ca[_0x9f42('0x3a')]=_[_0x9f42('0x3c')](_0x3d77ca[_0x9f42('0x3a')],{'$or':_['map'](_0x3d77ca[_0x9f42('0x33')],function(_0x397a8a){var _0xc5d327={};_0xc5d327[_0x397a8a]={'$like':'%'+_0x32a355['query'][_0x9f42('0x4c')]+'%'};return _0xc5d327;})});}_0x3d77ca=_[_0x9f42('0x3c')]({},_0x3d77ca,_0x32a355[_0x9f42('0x4d')]);return _0x583b72[_0x9f42('0x4f')](_0x3d77ca);}})['then'](function(_0x4d1b61){if(_0x4d1b61){_0x50727a=_0x4d1b61['length'];if(!_0x32a355[_0x9f42('0x2f')]['hasOwnProperty']('nolimit')){_0x3d77ca[_0x9f42('0x21')]=qs[_0x9f42('0x21')](_0x32a355[_0x9f42('0x2f')]['limit']);_0x3d77ca['offset']=qs[_0x9f42('0x1e')](_0x32a355[_0x9f42('0x2f')]['offset']);}return _0x583b72['getDescriptions'](_0x3d77ca);}})['then'](function(_0x146a84){if(_0x146a84){return _0x146a84?{'count':_0x50727a,'rows':_0x146a84}:null;}})['then'](respondWithResult(_0x1682d9,null))['catch'](handleError(_0x1682d9,null));}; \ No newline at end of file +var _0xf903=['map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index'];(function(_0x2f43f4,_0x2201d3){var _0x32c7fb=function(_0x5012ba){while(--_0x5012ba){_0x2f43f4['push'](_0x2f43f4['shift']());}};_0x32c7fb(++_0x2201d3);}(_0xf903,0x174));var _0x3f90=function(_0x3684ed,_0x194c50){_0x3684ed=_0x3684ed-0x0;var _0x587bac=_0xf903[_0x3684ed];return _0x587bac;};'use strict';var emlformat=require(_0x3f90('0x0'));var rimraf=require(_0x3f90('0x1'));var zipdir=require(_0x3f90('0x2'));var jsonpatch=require(_0x3f90('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f90('0x4'));var Mustache=require(_0x3f90('0x5'));var util=require(_0x3f90('0x6'));var path=require(_0x3f90('0x7'));var sox=require(_0x3f90('0x8'));var csv=require(_0x3f90('0x9'));var ejs=require(_0x3f90('0xa'));var fs=require('fs');var fs_extra=require(_0x3f90('0xb'));var _=require(_0x3f90('0xc'));var squel=require(_0x3f90('0xd'));var crypto=require(_0x3f90('0xe'));var jsforce=require(_0x3f90('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3f90('0x10'));var Redis=require('ioredis');var authService=require(_0x3f90('0x11'));var qs=require(_0x3f90('0x12'));var as=require(_0x3f90('0x13'));var hardwareService=require(_0x3f90('0x14'));var logger=require('../../config/logger')(_0x3f90('0x15'));var utils=require(_0x3f90('0x16'));var config=require(_0x3f90('0x17'));var licenseUtil=require(_0x3f90('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2ebd,_0x2fc9d6){_0x2fc9d6=_0x2fc9d6||0xcc;return function(_0x648b52){if(_0x648b52){return _0x5b2ebd['sendStatus'](_0x2fc9d6);}return _0x5b2ebd[_0x3f90('0x19')](_0x2fc9d6)[_0x3f90('0x1a')]();};}function respondWithResult(_0x244e5e,_0xb69007){_0xb69007=_0xb69007||0xc8;return function(_0x5a8029){if(_0x5a8029){return _0x244e5e[_0x3f90('0x19')](_0xb69007)[_0x3f90('0x1b')](_0x5a8029);}};}function respondWithFilteredResult(_0x13a13a,_0x4aa136){return function(_0x2d65c7){if(_0x2d65c7){var _0x5f95fa=typeof _0x4aa136['offset']==='undefined'&&typeof _0x4aa136[_0x3f90('0x1c')]===_0x3f90('0x1d');var _0x34a6e4=_0x2d65c7[_0x3f90('0x1e')];var _0x554ee3=_0x5f95fa?0x0:_0x4aa136[_0x3f90('0x1f')];var _0x6c0400=_0x5f95fa?_0x2d65c7[_0x3f90('0x1e')]:_0x4aa136[_0x3f90('0x1f')]+_0x4aa136[_0x3f90('0x1c')];var _0x4047dc;if(_0x6c0400>=_0x34a6e4){_0x6c0400=_0x34a6e4;_0x4047dc=0xc8;}else{_0x4047dc=0xce;}_0x13a13a[_0x3f90('0x19')](_0x4047dc);return _0x13a13a[_0x3f90('0x20')](_0x3f90('0x21'),_0x554ee3+'-'+_0x6c0400+'/'+_0x34a6e4)['json'](_0x2d65c7);}return null;};}function patchUpdates(_0xda788a){return function(_0x21548e){try{jsonpatch[_0x3f90('0x22')](_0x21548e,_0xda788a,!![]);}catch(_0x554a57){return BPromise[_0x3f90('0x23')](_0x554a57);}return _0x21548e['save']();};}function saveUpdates(_0x145be8,_0x1f3cfb){return function(_0xa575c2){if(_0xa575c2){return _0xa575c2[_0x3f90('0x24')](_0x145be8)[_0x3f90('0x25')](function(_0x637145){return _0x637145;});}return null;};}function removeEntity(_0x15a196,_0x5a6c03){return function(_0x3793aa){if(_0x3793aa){return _0x3793aa['destroy']()[_0x3f90('0x25')](function(){_0x15a196['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc6353,_0x4895cd){return function(_0xdc7a7a){if(!_0xdc7a7a){_0xfc6353[_0x3f90('0x26')](0x194);}return _0xdc7a7a;};}function handleError(_0x218bda,_0x31702e){_0x31702e=_0x31702e||0x1f4;return function(_0x5a159b){logger[_0x3f90('0x27')](_0x5a159b['stack']);if(_0x5a159b[_0x3f90('0x28')]){delete _0x5a159b['name'];}_0x218bda[_0x3f90('0x19')](_0x31702e)[_0x3f90('0x29')](_0x5a159b);};}exports[_0x3f90('0x2a')]=function(_0x4d05a0,_0x91e65d){var _0x75d816={},_0x5e300f={},_0x5005ab={'count':0x0,'rows':[]};var _0x4ca41a=_[_0x3f90('0x2b')](db[_0x3f90('0x2c')][_0x3f90('0x2d')],function(_0x509264){return{'name':_0x509264[_0x3f90('0x2e')],'type':_0x509264[_0x3f90('0x2f')][_0x3f90('0x30')]};});_0x5e300f[_0x3f90('0x31')]=_[_0x3f90('0x2b')](_0x4ca41a,'name');_0x5e300f['query']=_[_0x3f90('0x32')](_0x4d05a0['query']);_0x5e300f[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x5e300f['model'],_0x5e300f[_0x3f90('0x35')]);_0x75d816[_0x3f90('0x36')]=_[_0x3f90('0x34')](_0x5e300f['model'],qs['fields'](_0x4d05a0[_0x3f90('0x35')][_0x3f90('0x37')]));_0x75d816[_0x3f90('0x36')]=_0x75d816[_0x3f90('0x36')][_0x3f90('0x38')]?_0x75d816[_0x3f90('0x36')]:_0x5e300f[_0x3f90('0x31')];if(!_0x4d05a0[_0x3f90('0x35')][_0x3f90('0x39')](_0x3f90('0x3a'))){_0x75d816[_0x3f90('0x1c')]=qs[_0x3f90('0x1c')](_0x4d05a0[_0x3f90('0x35')]['limit']);_0x75d816[_0x3f90('0x1f')]=qs['offset'](_0x4d05a0[_0x3f90('0x35')][_0x3f90('0x1f')]);}_0x75d816[_0x3f90('0x3b')]=qs[_0x3f90('0x3c')](_0x4d05a0[_0x3f90('0x35')][_0x3f90('0x3c')]);_0x75d816[_0x3f90('0x3d')]=qs['filters'](_[_0x3f90('0x3e')](_0x4d05a0[_0x3f90('0x35')],_0x5e300f['filters']),_0x4ca41a);if(_0x4d05a0[_0x3f90('0x35')][_0x3f90('0x3f')]){_0x75d816[_0x3f90('0x3d')]=_[_0x3f90('0x40')](_0x75d816[_0x3f90('0x3d')],{'$or':_[_0x3f90('0x2b')](_0x4ca41a,function(_0x235d59){if(_0x235d59['type']!==_0x3f90('0x41')){var _0x4092d3={};_0x4092d3[_0x235d59[_0x3f90('0x28')]]={'$like':'%'+_0x4d05a0['query'][_0x3f90('0x3f')]+'%'};return _0x4092d3;}})});}_0x75d816=_[_0x3f90('0x40')]({},_0x75d816,_0x4d05a0[_0x3f90('0x42')]);var _0x49a81c={'where':_0x75d816[_0x3f90('0x3d')]};return db[_0x3f90('0x2c')][_0x3f90('0x1e')](_0x49a81c)[_0x3f90('0x25')](function(_0x1bbba0){_0x5005ab[_0x3f90('0x1e')]=_0x1bbba0;if(_0x4d05a0[_0x3f90('0x35')][_0x3f90('0x43')]){_0x75d816['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x3f90('0x44')](_0x75d816);})[_0x3f90('0x25')](function(_0xec7327){_0x5005ab[_0x3f90('0x45')]=_0xec7327;return _0x5005ab;})[_0x3f90('0x25')](respondWithFilteredResult(_0x91e65d,_0x75d816))[_0x3f90('0x46')](handleError(_0x91e65d,null));};exports[_0x3f90('0x47')]=function(_0x11d8be,_0x49daeb){var _0x35ac48={'raw':![],'where':{'id':_0x11d8be[_0x3f90('0x48')]['id']}},_0x572db4={};_0x572db4[_0x3f90('0x31')]=_[_0x3f90('0x32')](db['SalesforceConfiguration'][_0x3f90('0x2d')]);_0x572db4['query']=_[_0x3f90('0x32')](_0x11d8be[_0x3f90('0x35')]);_0x572db4[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x572db4[_0x3f90('0x31')],_0x572db4['query']);_0x35ac48[_0x3f90('0x36')]=_[_0x3f90('0x34')](_0x572db4[_0x3f90('0x31')],qs[_0x3f90('0x37')](_0x11d8be[_0x3f90('0x35')]['fields']));_0x35ac48[_0x3f90('0x36')]=_0x35ac48['attributes']['length']?_0x35ac48['attributes']:_0x572db4['model'];if(_0x11d8be[_0x3f90('0x35')][_0x3f90('0x43')]){_0x35ac48[_0x3f90('0x49')]=[{'all':!![]}];}_0x35ac48=_['merge']({},_0x35ac48,_0x11d8be['options']);return db[_0x3f90('0x2c')][_0x3f90('0x4a')](_0x35ac48)[_0x3f90('0x25')](handleEntityNotFound(_0x49daeb,null))[_0x3f90('0x25')](respondWithResult(_0x49daeb,null))[_0x3f90('0x46')](handleError(_0x49daeb,null));};exports[_0x3f90('0x4b')]=function(_0x6843da,_0x460af1){return db[_0x3f90('0x2c')][_0x3f90('0x4b')](_0x6843da[_0x3f90('0x4c')],{})['then'](respondWithResult(_0x460af1,0xc9))[_0x3f90('0x46')](handleError(_0x460af1,null));};exports[_0x3f90('0x24')]=function(_0x2463de,_0x474a1d){if(_0x2463de['body']['id']){delete _0x2463de['body']['id'];}return db[_0x3f90('0x2c')][_0x3f90('0x4a')]({'where':{'id':_0x2463de['params']['id']}})['then'](handleEntityNotFound(_0x474a1d,null))[_0x3f90('0x25')](saveUpdates(_0x2463de[_0x3f90('0x4c')],null))[_0x3f90('0x25')](respondWithResult(_0x474a1d,null))[_0x3f90('0x46')](handleError(_0x474a1d,null));};exports[_0x3f90('0x4d')]=function(_0x491f04,_0x2c0ca6){return db['SalesforceConfiguration'][_0x3f90('0x4a')]({'where':{'id':_0x491f04[_0x3f90('0x48')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x2c0ca6,null))[_0x3f90('0x25')](removeEntity(_0x2c0ca6,null))[_0x3f90('0x46')](handleError(_0x2c0ca6,null));};exports[_0x3f90('0x4e')]=function(_0x3f5dfb,_0x805942,_0x500106){var _0x3e5f89={};var _0x4d6253={};var _0x3fb24e;var _0x26648a;return db[_0x3f90('0x2c')][_0x3f90('0x4f')]({'where':{'id':_0x3f5dfb[_0x3f90('0x48')]['id']}})['then'](handleEntityNotFound(_0x805942,null))[_0x3f90('0x25')](function(_0x352c70){if(_0x352c70){_0x3fb24e=_0x352c70;_0x4d6253[_0x3f90('0x31')]=_[_0x3f90('0x32')](db[_0x3f90('0x50')][_0x3f90('0x2d')]);_0x4d6253[_0x3f90('0x35')]=_[_0x3f90('0x32')](_0x3f5dfb[_0x3f90('0x35')]);_0x4d6253['filters']=_[_0x3f90('0x34')](_0x4d6253['model'],_0x4d6253['query']);_0x3e5f89[_0x3f90('0x36')]=_[_0x3f90('0x34')](_0x4d6253[_0x3f90('0x31')],qs[_0x3f90('0x37')](_0x3f5dfb[_0x3f90('0x35')][_0x3f90('0x37')]));_0x3e5f89[_0x3f90('0x36')]=_0x3e5f89['attributes'][_0x3f90('0x38')]?_0x3e5f89[_0x3f90('0x36')]:_0x4d6253[_0x3f90('0x31')];_0x3e5f89[_0x3f90('0x3b')]=qs[_0x3f90('0x3c')](_0x3f5dfb[_0x3f90('0x35')][_0x3f90('0x3c')]);_0x3e5f89[_0x3f90('0x3d')]=qs[_0x3f90('0x33')](_['pick'](_0x3f5dfb[_0x3f90('0x35')],_0x4d6253[_0x3f90('0x33')]));if(_0x3f5dfb[_0x3f90('0x35')]['filter']){_0x3e5f89[_0x3f90('0x3d')]=_['merge'](_0x3e5f89[_0x3f90('0x3d')],{'$or':_[_0x3f90('0x2b')](_0x3e5f89[_0x3f90('0x36')],function(_0x40ede1){var _0x563277={};_0x563277[_0x40ede1]={'$like':'%'+_0x3f5dfb[_0x3f90('0x35')][_0x3f90('0x3f')]+'%'};return _0x563277;})});}_0x3e5f89=_[_0x3f90('0x40')]({},_0x3e5f89,_0x3f5dfb['options']);return _0x3fb24e['getFields'](_0x3e5f89);}})['then'](function(_0x9a259b){if(_0x9a259b){_0x26648a=_0x9a259b[_0x3f90('0x38')];if(!_0x3f5dfb[_0x3f90('0x35')]['hasOwnProperty'](_0x3f90('0x3a'))){_0x3e5f89[_0x3f90('0x1c')]=qs[_0x3f90('0x1c')](_0x3f5dfb[_0x3f90('0x35')][_0x3f90('0x1c')]);_0x3e5f89['offset']=qs[_0x3f90('0x1f')](_0x3f5dfb[_0x3f90('0x35')]['offset']);}return _0x3fb24e['getFields'](_0x3e5f89);}})[_0x3f90('0x25')](function(_0x333ee6){if(_0x333ee6){return _0x333ee6?{'count':_0x26648a,'rows':_0x333ee6}:null;}})['then'](respondWithResult(_0x805942,null))['catch'](handleError(_0x805942,null));};exports[_0x3f90('0x51')]=function(_0x2de4ad,_0x33b1c3,_0x5f15f9){var _0x3c84f2={};var _0x5aa193={};var _0x18dc9c;var _0x120f73;return db[_0x3f90('0x2c')]['findOne']({'where':{'id':_0x2de4ad['params']['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x33b1c3,null))[_0x3f90('0x25')](function(_0x1db10d){if(_0x1db10d){_0x18dc9c=_0x1db10d;_0x5aa193[_0x3f90('0x31')]=_[_0x3f90('0x32')](db['SalesforceField']['rawAttributes']);_0x5aa193[_0x3f90('0x35')]=_[_0x3f90('0x32')](_0x2de4ad[_0x3f90('0x35')]);_0x5aa193[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x5aa193[_0x3f90('0x31')],_0x5aa193[_0x3f90('0x35')]);_0x3c84f2[_0x3f90('0x36')]=_[_0x3f90('0x34')](_0x5aa193[_0x3f90('0x31')],qs[_0x3f90('0x37')](_0x2de4ad[_0x3f90('0x35')][_0x3f90('0x37')]));_0x3c84f2[_0x3f90('0x36')]=_0x3c84f2[_0x3f90('0x36')][_0x3f90('0x38')]?_0x3c84f2['attributes']:_0x5aa193[_0x3f90('0x31')];_0x3c84f2[_0x3f90('0x3b')]=qs['sort'](_0x2de4ad[_0x3f90('0x35')][_0x3f90('0x3c')]);_0x3c84f2[_0x3f90('0x3d')]=qs[_0x3f90('0x33')](_['pick'](_0x2de4ad['query'],_0x5aa193[_0x3f90('0x33')]));if(_0x2de4ad['query']['filter']){_0x3c84f2['where']=_['merge'](_0x3c84f2[_0x3f90('0x3d')],{'$or':_[_0x3f90('0x2b')](_0x3c84f2[_0x3f90('0x36')],function(_0x4bb94b){var _0x51f849={};_0x51f849[_0x4bb94b]={'$like':'%'+_0x2de4ad[_0x3f90('0x35')][_0x3f90('0x3f')]+'%'};return _0x51f849;})});}_0x3c84f2=_[_0x3f90('0x40')]({},_0x3c84f2,_0x2de4ad[_0x3f90('0x42')]);return _0x18dc9c[_0x3f90('0x51')](_0x3c84f2);}})[_0x3f90('0x25')](function(_0x49b2c6){if(_0x49b2c6){_0x120f73=_0x49b2c6[_0x3f90('0x38')];if(!_0x2de4ad[_0x3f90('0x35')]['hasOwnProperty'](_0x3f90('0x3a'))){_0x3c84f2[_0x3f90('0x1c')]=qs[_0x3f90('0x1c')](_0x2de4ad[_0x3f90('0x35')][_0x3f90('0x1c')]);_0x3c84f2[_0x3f90('0x1f')]=qs['offset'](_0x2de4ad[_0x3f90('0x35')]['offset']);}return _0x18dc9c['getSubjects'](_0x3c84f2);}})['then'](function(_0x35102b){if(_0x35102b){return _0x35102b?{'count':_0x120f73,'rows':_0x35102b}:null;}})['then'](respondWithResult(_0x33b1c3,null))[_0x3f90('0x46')](handleError(_0x33b1c3,null));};exports['getDescriptions']=function(_0x5d603e,_0x39ef67,_0x53852b){var _0x308b60={};var _0x28bcbd={};var _0x4cf45b;var _0x3836e5;return db['SalesforceConfiguration'][_0x3f90('0x4f')]({'where':{'id':_0x5d603e[_0x3f90('0x48')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x39ef67,null))[_0x3f90('0x25')](function(_0x6b38d5){if(_0x6b38d5){_0x4cf45b=_0x6b38d5;_0x28bcbd[_0x3f90('0x31')]=_[_0x3f90('0x32')](db[_0x3f90('0x50')][_0x3f90('0x2d')]);_0x28bcbd[_0x3f90('0x35')]=_['keys'](_0x5d603e['query']);_0x28bcbd[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x28bcbd[_0x3f90('0x31')],_0x28bcbd[_0x3f90('0x35')]);_0x308b60[_0x3f90('0x36')]=_[_0x3f90('0x34')](_0x28bcbd[_0x3f90('0x31')],qs[_0x3f90('0x37')](_0x5d603e[_0x3f90('0x35')][_0x3f90('0x37')]));_0x308b60[_0x3f90('0x36')]=_0x308b60[_0x3f90('0x36')][_0x3f90('0x38')]?_0x308b60[_0x3f90('0x36')]:_0x28bcbd[_0x3f90('0x31')];_0x308b60['order']=qs['sort'](_0x5d603e['query']['sort']);_0x308b60[_0x3f90('0x3d')]=qs[_0x3f90('0x33')](_['pick'](_0x5d603e[_0x3f90('0x35')],_0x28bcbd[_0x3f90('0x33')]));if(_0x5d603e['query'][_0x3f90('0x3f')]){_0x308b60[_0x3f90('0x3d')]=_[_0x3f90('0x40')](_0x308b60['where'],{'$or':_[_0x3f90('0x2b')](_0x308b60[_0x3f90('0x36')],function(_0x5f258b){var _0x43262c={};_0x43262c[_0x5f258b]={'$like':'%'+_0x5d603e[_0x3f90('0x35')][_0x3f90('0x3f')]+'%'};return _0x43262c;})});}_0x308b60=_[_0x3f90('0x40')]({},_0x308b60,_0x5d603e[_0x3f90('0x42')]);return _0x4cf45b[_0x3f90('0x52')](_0x308b60);}})['then'](function(_0x29369c){if(_0x29369c){_0x3836e5=_0x29369c[_0x3f90('0x38')];if(!_0x5d603e[_0x3f90('0x35')][_0x3f90('0x39')]('nolimit')){_0x308b60[_0x3f90('0x1c')]=qs['limit'](_0x5d603e['query'][_0x3f90('0x1c')]);_0x308b60[_0x3f90('0x1f')]=qs[_0x3f90('0x1f')](_0x5d603e[_0x3f90('0x35')][_0x3f90('0x1f')]);}return _0x4cf45b[_0x3f90('0x52')](_0x308b60);}})[_0x3f90('0x25')](function(_0x819e7e){if(_0x819e7e){return _0x819e7e?{'count':_0x3836e5,'rows':_0x819e7e}:null;}})[_0x3f90('0x25')](respondWithResult(_0x39ef67,null))[_0x3f90('0x46')](handleError(_0x39ef67,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 312b687..775f934 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 _0x073a=['../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','api','moment','bluebird','path','rimraf'];(function(_0x3dd683,_0x5c7edb){var _0xdf7fd7=function(_0x580b8d){while(--_0x580b8d){_0x3dd683['push'](_0x3dd683['shift']());}};_0xdf7fd7(++_0x5c7edb);}(_0x073a,0x1f4));var _0xa073=function(_0x2a95a3,_0xc295a8){_0x2a95a3=_0x2a95a3-0x0;var _0xf39b49=_0x073a[_0x2a95a3];return _0xf39b49;};'use strict';var _=require('lodash');var util=require(_0xa073('0x0'));var logger=require('../../config/logger')(_0xa073('0x1'));var moment=require(_0xa073('0x2'));var BPromise=require(_0xa073('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa073('0x4'));var rimraf=require(_0xa073('0x5'));var config=require(_0xa073('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xa073('0x7')]=function(_0x108978,_0x4da32c){return _0x108978[_0xa073('0x8')](_0xa073('0x9'),attributes,{'tableName':_0xa073('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0f9=['bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment'];(function(_0x3ed14a,_0x1f2656){var _0x137a99=function(_0x5ce42c){while(--_0x5ce42c){_0x3ed14a['push'](_0x3ed14a['shift']());}};_0x137a99(++_0x1f2656);}(_0xf0f9,0x1cb));var _0x9f0f=function(_0x3dfa53,_0x22fbda){_0x3dfa53=_0x3dfa53-0x0;var _0x4c5212=_0xf0f9[_0x3dfa53];return _0x4c5212;};'use strict';var _=require(_0x9f0f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9f0f('0x1'));var moment=require(_0x9f0f('0x2'));var BPromise=require(_0x9f0f('0x3'));var rp=require(_0x9f0f('0x4'));var fs=require('fs');var path=require(_0x9f0f('0x5'));var rimraf=require('rimraf');var config=require(_0x9f0f('0x6'));var attributes=require(_0x9f0f('0x7'));module[_0x9f0f('0x8')]=function(_0x22050d,_0x438a06){return _0x22050d['define'](_0x9f0f('0x9'),attributes,{'tableName':_0x9f0f('0xa'),'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 bcec5c5..5f6fdeb 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 _0x0d8f=['../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0d8f,0x167));var _0xf0d8=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0x0d8f[_0x164760];return _0x8b91b2;};'use strict';var _=require(_0xf0d8('0x0'));var util=require('util');var moment=require(_0xf0d8('0x1'));var BPromise=require(_0xf0d8('0x2'));var rs=require(_0xf0d8('0x3'));var fs=require('fs');var Redis=require(_0xf0d8('0x4'));var db=require(_0xf0d8('0x5'))['db'];var utils=require(_0xf0d8('0x6'));var logger=require(_0xf0d8('0x7'))(_0xf0d8('0x8'));var config=require(_0xf0d8('0x9'));var jayson=require(_0xf0d8('0xa'));var client=jayson[_0xf0d8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0169,_0x3edb80,_0x857620){return new BPromise(function(_0x53e153,_0x1543d6){return client[_0xf0d8('0xc')](_0x5b0169,_0x857620)[_0xf0d8('0xd')](function(_0xf6d7cd){logger[_0xf0d8('0xe')](_0xf0d8('0xf'),_0x3edb80,_0xf0d8('0x10'));logger[_0xf0d8('0x11')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3edb80,'request\x20sent',JSON['stringify'](_0xf6d7cd));if(_0xf6d7cd[_0xf0d8('0x12')]){if(_0xf6d7cd['error'][_0xf0d8('0x13')]===0x1f4){logger[_0xf0d8('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3edb80,_0xf6d7cd[_0xf0d8('0x12')][_0xf0d8('0x14')]);return _0x1543d6(_0xf6d7cd[_0xf0d8('0x12')][_0xf0d8('0x14')]);}logger[_0xf0d8('0x12')](_0xf0d8('0xf'),_0x3edb80,_0xf6d7cd[_0xf0d8('0x12')][_0xf0d8('0x14')]);return _0x53e153(_0xf6d7cd[_0xf0d8('0x12')][_0xf0d8('0x14')]);}else{logger[_0xf0d8('0xe')](_0xf0d8('0xf'),_0x3edb80,_0xf0d8('0x10'));_0x53e153(_0xf6d7cd[_0xf0d8('0x15')][_0xf0d8('0x14')]);}})[_0xf0d8('0x16')](function(_0x4c43a1){logger[_0xf0d8('0x12')](_0xf0d8('0xf'),_0x3edb80,_0x4c43a1);_0x1543d6(_0x4c43a1);});});} \ No newline at end of file +var _0x7761=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7761,0x1d9));var _0x1776=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7761[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1776('0x0'));var util=require(_0x1776('0x1'));var moment=require(_0x1776('0x2'));var BPromise=require(_0x1776('0x3'));var rs=require(_0x1776('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1776('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1776('0x6'));var config=require(_0x1776('0x7'));var jayson=require(_0x1776('0x8'));var client=jayson[_0x1776('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ef818,_0x7a10c,_0x2b4ab1){return new BPromise(function(_0x59419d,_0x3a11b1){return client[_0x1776('0xa')](_0x1ef818,_0x2b4ab1)[_0x1776('0xb')](function(_0x47bfd3){logger[_0x1776('0xc')](_0x1776('0xd'),_0x7a10c,'request\x20sent');logger[_0x1776('0xe')](_0x1776('0xf'),_0x7a10c,_0x1776('0x10'),JSON['stringify'](_0x47bfd3));if(_0x47bfd3[_0x1776('0x11')]){if(_0x47bfd3[_0x1776('0x11')]['code']===0x1f4){logger[_0x1776('0x11')](_0x1776('0xd'),_0x7a10c,_0x47bfd3[_0x1776('0x11')][_0x1776('0x12')]);return _0x3a11b1(_0x47bfd3[_0x1776('0x11')]['message']);}logger[_0x1776('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x7a10c,_0x47bfd3[_0x1776('0x11')]['message']);return _0x59419d(_0x47bfd3['error'][_0x1776('0x12')]);}else{logger[_0x1776('0xc')](_0x1776('0xd'),_0x7a10c,'request\x20sent');_0x59419d(_0x47bfd3[_0x1776('0x13')][_0x1776('0x12')]);}})[_0x1776('0x14')](function(_0xf875a6){logger['error'](_0x1776('0xd'),_0x7a10c,_0xf875a6);_0x3a11b1(_0xf875a6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 676c135..92850d5 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 _0x6f93=['isAuthenticated','index','/:id','show','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intSalesforceField.controller','get'];(function(_0x21b1d1,_0x5ab574){var _0xc2ba15=function(_0x1e5ed3){while(--_0x1e5ed3){_0x21b1d1['push'](_0x21b1d1['shift']());}};_0xc2ba15(++_0x5ab574);}(_0x6f93,0x88));var _0x36f9=function(_0x150f75,_0xe1f92b){_0x150f75=_0x150f75-0x0;var _0x45e6af=_0x6f93[_0x150f75];return _0x45e6af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x36f9('0x0'));var timeout=require(_0x36f9('0x1'));var express=require('express');var router=express[_0x36f9('0x2')]();var fs_extra=require(_0x36f9('0x3'));var auth=require(_0x36f9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x36f9('0x5'));router[_0x36f9('0x6')]('/',auth[_0x36f9('0x7')](),controller[_0x36f9('0x8')]);router[_0x36f9('0x6')](_0x36f9('0x9'),auth[_0x36f9('0x7')](),controller[_0x36f9('0xa')]);router['post']('/',auth[_0x36f9('0x7')](),controller['create']);router['put'](_0x36f9('0x9'),auth[_0x36f9('0x7')](),controller['update']);router[_0x36f9('0xb')](_0x36f9('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x36f9('0xc')]=router; \ No newline at end of file +var _0xf3d4=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','./intSalesforceField.controller','isAuthenticated','get','/:id','show','post'];(function(_0x3b0565,_0x462418){var _0x1a690a=function(_0x5ae4ba){while(--_0x5ae4ba){_0x3b0565['push'](_0x3b0565['shift']());}};_0x1a690a(++_0x462418);}(_0xf3d4,0x14a));var _0x4f3d=function(_0x144230,_0x1d6afc){_0x144230=_0x144230-0x0;var _0x3fa614=_0xf3d4[_0x144230];return _0x3fa614;};'use strict';var multer=require(_0x4f3d('0x0'));var util=require(_0x4f3d('0x1'));var path=require(_0x4f3d('0x2'));var timeout=require(_0x4f3d('0x3'));var express=require(_0x4f3d('0x4'));var router=express['Router']();var fs_extra=require(_0x4f3d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4f3d('0x6'));router['get']('/',auth[_0x4f3d('0x7')](),controller['index']);router[_0x4f3d('0x8')](_0x4f3d('0x9'),auth[_0x4f3d('0x7')](),controller[_0x4f3d('0xa')]);router[_0x4f3d('0xb')]('/',auth[_0x4f3d('0x7')](),controller[_0x4f3d('0xc')]);router[_0x4f3d('0xd')]('/:id',auth[_0x4f3d('0x7')](),controller[_0x4f3d('0xe')]);router[_0x4f3d('0xf')](_0x4f3d('0x9'),auth[_0x4f3d('0x7')](),controller[_0x4f3d('0x10')]);module[_0x4f3d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 2997e40..07eb2d2 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 _0xb4c3=['ENUM','string','customVariable','STRING','variable','exports'];(function(_0x33d9f1,_0x5301c6){var _0x4f1886=function(_0x132192){while(--_0x132192){_0x33d9f1['push'](_0x33d9f1['shift']());}};_0x4f1886(++_0x5301c6);}(_0xb4c3,0x17f));var _0x3b4c=function(_0x5b76ee,_0x27e336){_0x5b76ee=_0x5b76ee-0x0;var _0x200d85=_0xb4c3[_0x5b76ee];return _0x200d85;};'use strict';var Sequelize=require('sequelize');module[_0x3b4c('0x0')]={'type':{'type':Sequelize[_0x3b4c('0x1')](_0x3b4c('0x2'),'variable',_0x3b4c('0x3'),'keyValue','picklist'),'defaultValue':_0x3b4c('0x2')},'content':{'type':Sequelize[_0x3b4c('0x4')]},'key':{'type':Sequelize[_0x3b4c('0x4')]},'keyType':{'type':Sequelize[_0x3b4c('0x1')]('string',_0x3b4c('0x5'),_0x3b4c('0x3'))},'keyContent':{'type':Sequelize[_0x3b4c('0x4')]},'idField':{'type':Sequelize[_0x3b4c('0x4')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf8e8=['picklist','STRING','variable','exports','ENUM','string','customVariable','keyValue'];(function(_0x23739c,_0x462750){var _0x1e1e2d=function(_0x3ac8ba){while(--_0x3ac8ba){_0x23739c['push'](_0x23739c['shift']());}};_0x1e1e2d(++_0x462750);}(_0xf8e8,0x1e3));var _0x8f8e=function(_0x46ed82,_0x1d893b){_0x46ed82=_0x46ed82-0x0;var _0x4ea2bb=_0xf8e8[_0x46ed82];return _0x4ea2bb;};'use strict';var Sequelize=require('sequelize');module[_0x8f8e('0x0')]={'type':{'type':Sequelize[_0x8f8e('0x1')](_0x8f8e('0x2'),'variable',_0x8f8e('0x3'),_0x8f8e('0x4'),_0x8f8e('0x5')),'defaultValue':_0x8f8e('0x2')},'content':{'type':Sequelize[_0x8f8e('0x6')]},'key':{'type':Sequelize[_0x8f8e('0x6')]},'keyType':{'type':Sequelize[_0x8f8e('0x1')](_0x8f8e('0x2'),_0x8f8e('0x7'),_0x8f8e('0x3'))},'keyContent':{'type':Sequelize[_0x8f8e('0x6')]},'idField':{'type':Sequelize[_0x8f8e('0x6')]},'variableName':{'type':Sequelize[_0x8f8e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 306e9b6..5235da2 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 _0x9a62=['rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','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','set','Content-Range','reject','save','then','destroy','error','name','map','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','SalesforceField','includeAll','findAll','show','params','intersection','include','merge','find','catch','create','body','eml-format'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9a62,0xd1));var _0x29a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9a62[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x29a6('0x0'));var rimraf=require(_0x29a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29a6('0x2'));var rp=require(_0x29a6('0x3'));var moment=require(_0x29a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x29a6('0x5'));var util=require(_0x29a6('0x6'));var path=require(_0x29a6('0x7'));var sox=require(_0x29a6('0x8'));var csv=require(_0x29a6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29a6('0xa'));var squel=require(_0x29a6('0xb'));var crypto=require(_0x29a6('0xc'));var jsforce=require(_0x29a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x29a6('0x9'));var querystring=require(_0x29a6('0xe'));var Papa=require(_0x29a6('0xf'));var Redis=require(_0x29a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x29a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require(_0x29a6('0x16'));var db=require(_0x29a6('0x17'))['db'];function respondWithStatusCode(_0x3cc075,_0x44ca5c){_0x44ca5c=_0x44ca5c||0xcc;return function(_0x34f8d9){if(_0x34f8d9){return _0x3cc075[_0x29a6('0x18')](_0x44ca5c);}return _0x3cc075['status'](_0x44ca5c)[_0x29a6('0x19')]();};}function respondWithResult(_0x1048dd,_0x5e122b){_0x5e122b=_0x5e122b||0xc8;return function(_0x51f280){if(_0x51f280){return _0x1048dd['status'](_0x5e122b)[_0x29a6('0x1a')](_0x51f280);}};}function respondWithFilteredResult(_0x446f0b,_0x1dd301){return function(_0x5ed508){if(_0x5ed508){var _0x3e074e=typeof _0x1dd301[_0x29a6('0x1b')]===_0x29a6('0x1c')&&typeof _0x1dd301[_0x29a6('0x1d')]===_0x29a6('0x1c');var _0x23fc28=_0x5ed508[_0x29a6('0x1e')];var _0x359b5b=_0x3e074e?0x0:_0x1dd301[_0x29a6('0x1b')];var _0x1e94ed=_0x3e074e?_0x5ed508['count']:_0x1dd301[_0x29a6('0x1b')]+_0x1dd301[_0x29a6('0x1d')];var _0x1a0b15;if(_0x1e94ed>=_0x23fc28){_0x1e94ed=_0x23fc28;_0x1a0b15=0xc8;}else{_0x1a0b15=0xce;}_0x446f0b[_0x29a6('0x1f')](_0x1a0b15);return _0x446f0b[_0x29a6('0x20')](_0x29a6('0x21'),_0x359b5b+'-'+_0x1e94ed+'/'+_0x23fc28)['json'](_0x5ed508);}return null;};}function patchUpdates(_0x3dedc0){return function(_0x2ba146){try{jsonpatch['apply'](_0x2ba146,_0x3dedc0,!![]);}catch(_0x30b858){return BPromise[_0x29a6('0x22')](_0x30b858);}return _0x2ba146[_0x29a6('0x23')]();};}function saveUpdates(_0x54aa18,_0x4fac8d){return function(_0x287e87){if(_0x287e87){return _0x287e87['update'](_0x54aa18)[_0x29a6('0x24')](function(_0x353657){return _0x353657;});}return null;};}function removeEntity(_0x39abb1,_0x26c3a4){return function(_0x3c41c6){if(_0x3c41c6){return _0x3c41c6[_0x29a6('0x25')]()[_0x29a6('0x24')](function(){_0x39abb1['status'](0xcc)[_0x29a6('0x19')]();});}};}function handleEntityNotFound(_0x3280ef,_0x91ed1d){return function(_0x3404d5){if(!_0x3404d5){_0x3280ef['sendStatus'](0x194);}return _0x3404d5;};}function handleError(_0x4b912b,_0x10443c){_0x10443c=_0x10443c||0x1f4;return function(_0x1ae721){logger[_0x29a6('0x26')](_0x1ae721['stack']);if(_0x1ae721[_0x29a6('0x27')]){delete _0x1ae721['name'];}_0x4b912b['status'](_0x10443c)['send'](_0x1ae721);};}exports['index']=function(_0xcbbba0,_0x527dd3){var _0x2034b3={},_0xae7eb5={},_0x33c46e={'count':0x0,'rows':[]};var _0x1dc935=_[_0x29a6('0x28')](db['SalesforceField']['rawAttributes'],function(_0x3eff95){return{'name':_0x3eff95['fieldName'],'type':_0x3eff95[_0x29a6('0x29')][_0x29a6('0x2a')]};});_0xae7eb5[_0x29a6('0x2b')]=_[_0x29a6('0x28')](_0x1dc935,_0x29a6('0x27'));_0xae7eb5[_0x29a6('0x2c')]=_[_0x29a6('0x2d')](_0xcbbba0[_0x29a6('0x2c')]);_0xae7eb5['filters']=_['intersection'](_0xae7eb5[_0x29a6('0x2b')],_0xae7eb5[_0x29a6('0x2c')]);_0x2034b3[_0x29a6('0x2e')]=_['intersection'](_0xae7eb5['model'],qs[_0x29a6('0x2f')](_0xcbbba0[_0x29a6('0x2c')]['fields']));_0x2034b3[_0x29a6('0x2e')]=_0x2034b3[_0x29a6('0x2e')][_0x29a6('0x30')]?_0x2034b3['attributes']:_0xae7eb5[_0x29a6('0x2b')];if(!_0xcbbba0['query'][_0x29a6('0x31')](_0x29a6('0x32'))){_0x2034b3['limit']=qs[_0x29a6('0x1d')](_0xcbbba0[_0x29a6('0x2c')][_0x29a6('0x1d')]);_0x2034b3[_0x29a6('0x1b')]=qs['offset'](_0xcbbba0[_0x29a6('0x2c')][_0x29a6('0x1b')]);}_0x2034b3[_0x29a6('0x33')]=qs['sort'](_0xcbbba0[_0x29a6('0x2c')][_0x29a6('0x34')]);_0x2034b3[_0x29a6('0x35')]=qs[_0x29a6('0x36')](_[_0x29a6('0x37')](_0xcbbba0[_0x29a6('0x2c')],_0xae7eb5[_0x29a6('0x36')]),_0x1dc935);if(_0xcbbba0['query'][_0x29a6('0x38')]){_0x2034b3[_0x29a6('0x35')]=_['merge'](_0x2034b3[_0x29a6('0x35')],{'$or':_['map'](_0x1dc935,function(_0x4b3032){if(_0x4b3032[_0x29a6('0x29')]!=='VIRTUAL'){var _0x2c37f3={};_0x2c37f3[_0x4b3032[_0x29a6('0x27')]]={'$like':'%'+_0xcbbba0['query'][_0x29a6('0x38')]+'%'};return _0x2c37f3;}})});}_0x2034b3=_['merge']({},_0x2034b3,_0xcbbba0[_0x29a6('0x39')]);var _0xee131e={'where':_0x2034b3[_0x29a6('0x35')]};return db[_0x29a6('0x3a')]['count'](_0xee131e)[_0x29a6('0x24')](function(_0x92a0a9){_0x33c46e[_0x29a6('0x1e')]=_0x92a0a9;if(_0xcbbba0[_0x29a6('0x2c')][_0x29a6('0x3b')]){_0x2034b3['include']=[{'all':!![]}];}return db[_0x29a6('0x3a')][_0x29a6('0x3c')](_0x2034b3);})[_0x29a6('0x24')](function(_0x25c009){_0x33c46e['rows']=_0x25c009;return _0x33c46e;})['then'](respondWithFilteredResult(_0x527dd3,_0x2034b3))['catch'](handleError(_0x527dd3,null));};exports[_0x29a6('0x3d')]=function(_0x23c9b1,_0x1cdee4){var _0x5e1195={'raw':!![],'where':{'id':_0x23c9b1[_0x29a6('0x3e')]['id']}},_0x3ad1d1={};_0x3ad1d1['model']=_[_0x29a6('0x2d')](db[_0x29a6('0x3a')]['rawAttributes']);_0x3ad1d1[_0x29a6('0x2c')]=_['keys'](_0x23c9b1[_0x29a6('0x2c')]);_0x3ad1d1['filters']=_[_0x29a6('0x3f')](_0x3ad1d1[_0x29a6('0x2b')],_0x3ad1d1[_0x29a6('0x2c')]);_0x5e1195['attributes']=_[_0x29a6('0x3f')](_0x3ad1d1['model'],qs[_0x29a6('0x2f')](_0x23c9b1[_0x29a6('0x2c')][_0x29a6('0x2f')]));_0x5e1195[_0x29a6('0x2e')]=_0x5e1195[_0x29a6('0x2e')][_0x29a6('0x30')]?_0x5e1195['attributes']:_0x3ad1d1[_0x29a6('0x2b')];if(_0x23c9b1[_0x29a6('0x2c')]['includeAll']){_0x5e1195[_0x29a6('0x40')]=[{'all':!![]}];}_0x5e1195=_[_0x29a6('0x41')]({},_0x5e1195,_0x23c9b1['options']);return db['SalesforceField'][_0x29a6('0x42')](_0x5e1195)[_0x29a6('0x24')](handleEntityNotFound(_0x1cdee4,null))[_0x29a6('0x24')](respondWithResult(_0x1cdee4,null))[_0x29a6('0x43')](handleError(_0x1cdee4,null));};exports[_0x29a6('0x44')]=function(_0x2cc63,_0x29b8cd){return db['SalesforceField'][_0x29a6('0x44')](_0x2cc63[_0x29a6('0x45')],{})['then'](respondWithResult(_0x29b8cd,0xc9))['catch'](handleError(_0x29b8cd,null));};exports['update']=function(_0x170c06,_0x2961d3){if(_0x170c06[_0x29a6('0x45')]['id']){delete _0x170c06['body']['id'];}return db[_0x29a6('0x3a')][_0x29a6('0x42')]({'where':{'id':_0x170c06['params']['id']}})[_0x29a6('0x24')](handleEntityNotFound(_0x2961d3,null))[_0x29a6('0x24')](saveUpdates(_0x170c06['body'],null))['then'](respondWithResult(_0x2961d3,null))['catch'](handleError(_0x2961d3,null));};exports[_0x29a6('0x25')]=function(_0x40f536,_0x25d0aa){return db[_0x29a6('0x3a')][_0x29a6('0x42')]({'where':{'id':_0x40f536[_0x29a6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x25d0aa,null))[_0x29a6('0x24')](removeEntity(_0x25d0aa,null))[_0x29a6('0x43')](handleError(_0x25d0aa,null));}; \ No newline at end of file +var _0x1574=['params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SalesforceField','includeAll','include','findAll','rows','options','find','catch','create','body','update'];(function(_0x349246,_0x2990a4){var _0x5f3a4b=function(_0x4ea6b0){while(--_0x4ea6b0){_0x349246['push'](_0x349246['shift']());}};_0x5f3a4b(++_0x2990a4);}(_0x1574,0x178));var _0x4157=function(_0x321981,_0x1e35d1){_0x321981=_0x321981-0x0;var _0x375200=_0x1574[_0x321981];return _0x375200;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4157('0x0'));var zipdir=require(_0x4157('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4157('0x2'));var moment=require(_0x4157('0x3'));var BPromise=require(_0x4157('0x4'));var Mustache=require(_0x4157('0x5'));var util=require('util');var path=require(_0x4157('0x6'));var sox=require('sox');var csv=require(_0x4157('0x7'));var ejs=require(_0x4157('0x8'));var fs=require('fs');var fs_extra=require(_0x4157('0x9'));var _=require(_0x4157('0xa'));var squel=require(_0x4157('0xb'));var crypto=require(_0x4157('0xc'));var jsforce=require(_0x4157('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4157('0x7'));var querystring=require(_0x4157('0xe'));var Papa=require(_0x4157('0xf'));var Redis=require(_0x4157('0x10'));var authService=require(_0x4157('0x11'));var qs=require(_0x4157('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4157('0x13'));var logger=require(_0x4157('0x14'))(_0x4157('0x15'));var utils=require('../../config/utils');var config=require(_0x4157('0x16'));var licenseUtil=require(_0x4157('0x17'));var db=require(_0x4157('0x18'))['db'];function respondWithStatusCode(_0x4a80bd,_0x3ff306){_0x3ff306=_0x3ff306||0xcc;return function(_0x487bf4){if(_0x487bf4){return _0x4a80bd[_0x4157('0x19')](_0x3ff306);}return _0x4a80bd[_0x4157('0x1a')](_0x3ff306)[_0x4157('0x1b')]();};}function respondWithResult(_0x1e93aa,_0x4b2e4f){_0x4b2e4f=_0x4b2e4f||0xc8;return function(_0x377b32){if(_0x377b32){return _0x1e93aa[_0x4157('0x1a')](_0x4b2e4f)['json'](_0x377b32);}};}function respondWithFilteredResult(_0x4c14b7,_0x21996b){return function(_0x23659f){if(_0x23659f){var _0x4b208c=typeof _0x21996b['offset']===_0x4157('0x1c')&&typeof _0x21996b['limit']===_0x4157('0x1c');var _0x26e520=_0x23659f[_0x4157('0x1d')];var _0x366261=_0x4b208c?0x0:_0x21996b[_0x4157('0x1e')];var _0x3fe02d=_0x4b208c?_0x23659f[_0x4157('0x1d')]:_0x21996b['offset']+_0x21996b[_0x4157('0x1f')];var _0x5c0352;if(_0x3fe02d>=_0x26e520){_0x3fe02d=_0x26e520;_0x5c0352=0xc8;}else{_0x5c0352=0xce;}_0x4c14b7[_0x4157('0x1a')](_0x5c0352);return _0x4c14b7['set'](_0x4157('0x20'),_0x366261+'-'+_0x3fe02d+'/'+_0x26e520)[_0x4157('0x21')](_0x23659f);}return null;};}function patchUpdates(_0x43c000){return function(_0x1e8982){try{jsonpatch[_0x4157('0x22')](_0x1e8982,_0x43c000,!![]);}catch(_0x586d82){return BPromise[_0x4157('0x23')](_0x586d82);}return _0x1e8982[_0x4157('0x24')]();};}function saveUpdates(_0x28c6df,_0x433f0d){return function(_0x5870ab){if(_0x5870ab){return _0x5870ab['update'](_0x28c6df)[_0x4157('0x25')](function(_0xe5c541){return _0xe5c541;});}return null;};}function removeEntity(_0x44dd8f,_0x28c2bc){return function(_0x312d46){if(_0x312d46){return _0x312d46[_0x4157('0x26')]()[_0x4157('0x25')](function(){_0x44dd8f[_0x4157('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xec5cde,_0x176e58){return function(_0x1e04ec){if(!_0x1e04ec){_0xec5cde[_0x4157('0x19')](0x194);}return _0x1e04ec;};}function handleError(_0x4907a4,_0x555e74){_0x555e74=_0x555e74||0x1f4;return function(_0x40eb4f){logger['error'](_0x40eb4f['stack']);if(_0x40eb4f['name']){delete _0x40eb4f[_0x4157('0x27')];}_0x4907a4['status'](_0x555e74)[_0x4157('0x28')](_0x40eb4f);};}exports[_0x4157('0x29')]=function(_0x17f0b9,_0x445ea5){var _0x3b709b={},_0x3c51d3={},_0x5c0909={'count':0x0,'rows':[]};var _0xb225db=_[_0x4157('0x2a')](db['SalesforceField'][_0x4157('0x2b')],function(_0x44ba5a){return{'name':_0x44ba5a[_0x4157('0x2c')],'type':_0x44ba5a[_0x4157('0x2d')][_0x4157('0x2e')]};});_0x3c51d3[_0x4157('0x2f')]=_[_0x4157('0x2a')](_0xb225db,_0x4157('0x27'));_0x3c51d3['query']=_[_0x4157('0x30')](_0x17f0b9[_0x4157('0x31')]);_0x3c51d3[_0x4157('0x32')]=_[_0x4157('0x33')](_0x3c51d3['model'],_0x3c51d3['query']);_0x3b709b['attributes']=_[_0x4157('0x33')](_0x3c51d3[_0x4157('0x2f')],qs[_0x4157('0x34')](_0x17f0b9[_0x4157('0x31')][_0x4157('0x34')]));_0x3b709b['attributes']=_0x3b709b[_0x4157('0x35')][_0x4157('0x36')]?_0x3b709b[_0x4157('0x35')]:_0x3c51d3[_0x4157('0x2f')];if(!_0x17f0b9[_0x4157('0x31')]['hasOwnProperty'](_0x4157('0x37'))){_0x3b709b[_0x4157('0x1f')]=qs[_0x4157('0x1f')](_0x17f0b9[_0x4157('0x31')][_0x4157('0x1f')]);_0x3b709b['offset']=qs[_0x4157('0x1e')](_0x17f0b9[_0x4157('0x31')]['offset']);}_0x3b709b[_0x4157('0x38')]=qs[_0x4157('0x39')](_0x17f0b9['query'][_0x4157('0x39')]);_0x3b709b[_0x4157('0x3a')]=qs['filters'](_[_0x4157('0x3b')](_0x17f0b9[_0x4157('0x31')],_0x3c51d3[_0x4157('0x32')]),_0xb225db);if(_0x17f0b9[_0x4157('0x31')][_0x4157('0x3c')]){_0x3b709b[_0x4157('0x3a')]=_[_0x4157('0x3d')](_0x3b709b[_0x4157('0x3a')],{'$or':_[_0x4157('0x2a')](_0xb225db,function(_0x5da869){if(_0x5da869[_0x4157('0x2d')]!==_0x4157('0x3e')){var _0x3f40e2={};_0x3f40e2[_0x5da869[_0x4157('0x27')]]={'$like':'%'+_0x17f0b9[_0x4157('0x31')][_0x4157('0x3c')]+'%'};return _0x3f40e2;}})});}_0x3b709b=_['merge']({},_0x3b709b,_0x17f0b9['options']);var _0x1717fa={'where':_0x3b709b[_0x4157('0x3a')]};return db[_0x4157('0x3f')]['count'](_0x1717fa)[_0x4157('0x25')](function(_0x3d5278){_0x5c0909['count']=_0x3d5278;if(_0x17f0b9['query'][_0x4157('0x40')]){_0x3b709b[_0x4157('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x4157('0x42')](_0x3b709b);})[_0x4157('0x25')](function(_0x236f15){_0x5c0909[_0x4157('0x43')]=_0x236f15;return _0x5c0909;})['then'](respondWithFilteredResult(_0x445ea5,_0x3b709b))['catch'](handleError(_0x445ea5,null));};exports['show']=function(_0x3cc99d,_0x4ada8e){var _0xa094f={'raw':!![],'where':{'id':_0x3cc99d['params']['id']}},_0x47090f={};_0x47090f['model']=_[_0x4157('0x30')](db[_0x4157('0x3f')][_0x4157('0x2b')]);_0x47090f[_0x4157('0x31')]=_[_0x4157('0x30')](_0x3cc99d[_0x4157('0x31')]);_0x47090f[_0x4157('0x32')]=_[_0x4157('0x33')](_0x47090f[_0x4157('0x2f')],_0x47090f[_0x4157('0x31')]);_0xa094f[_0x4157('0x35')]=_[_0x4157('0x33')](_0x47090f['model'],qs[_0x4157('0x34')](_0x3cc99d['query'][_0x4157('0x34')]));_0xa094f[_0x4157('0x35')]=_0xa094f[_0x4157('0x35')][_0x4157('0x36')]?_0xa094f['attributes']:_0x47090f[_0x4157('0x2f')];if(_0x3cc99d[_0x4157('0x31')]['includeAll']){_0xa094f[_0x4157('0x41')]=[{'all':!![]}];}_0xa094f=_[_0x4157('0x3d')]({},_0xa094f,_0x3cc99d[_0x4157('0x44')]);return db[_0x4157('0x3f')][_0x4157('0x45')](_0xa094f)[_0x4157('0x25')](handleEntityNotFound(_0x4ada8e,null))[_0x4157('0x25')](respondWithResult(_0x4ada8e,null))[_0x4157('0x46')](handleError(_0x4ada8e,null));};exports[_0x4157('0x47')]=function(_0x263ce2,_0x5d2b79){return db[_0x4157('0x3f')]['create'](_0x263ce2[_0x4157('0x48')],{})[_0x4157('0x25')](respondWithResult(_0x5d2b79,0xc9))[_0x4157('0x46')](handleError(_0x5d2b79,null));};exports[_0x4157('0x49')]=function(_0x58650d,_0x4ca930){if(_0x58650d[_0x4157('0x48')]['id']){delete _0x58650d['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x58650d[_0x4157('0x4a')]['id']}})[_0x4157('0x25')](handleEntityNotFound(_0x4ca930,null))[_0x4157('0x25')](saveUpdates(_0x58650d[_0x4157('0x48')],null))[_0x4157('0x25')](respondWithResult(_0x4ca930,null))[_0x4157('0x46')](handleError(_0x4ca930,null));};exports[_0x4157('0x26')]=function(_0x3b322a,_0xbd9dc5){return db['SalesforceField'][_0x4157('0x45')]({'where':{'id':_0x3b322a[_0x4157('0x4a')]['id']}})[_0x4157('0x25')](handleEntityNotFound(_0xbd9dc5,null))[_0x4157('0x25')](removeEntity(_0xbd9dc5,null))[_0x4157('0x46')](handleError(_0xbd9dc5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 74d4ab2..3873898 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 _0x49f9=['moment','bluebird','rimraf','../../config/environment','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x34210c,_0xb3dd67){var _0x42544f=function(_0x3bbd66){while(--_0x3bbd66){_0x34210c['push'](_0x34210c['shift']());}};_0x42544f(++_0xb3dd67);}(_0x49f9,0x134));var _0x949f=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x49f9[_0x2e655a];return _0x26f13b;};'use strict';var _=require(_0x949f('0x0'));var util=require(_0x949f('0x1'));var logger=require(_0x949f('0x2'))(_0x949f('0x3'));var moment=require(_0x949f('0x4'));var BPromise=require(_0x949f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x949f('0x6'));var config=require(_0x949f('0x7'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x337856,_0x5c3942){return _0x337856['define'](_0x949f('0x8'),attributes,{'tableName':_0x949f('0x9'),'paranoid':![],'indexes':[{'name':_0x949f('0xa'),'fields':[_0x949f('0xb'),_0x949f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9877=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9877,0x11f));var _0x7987=function(_0x2cbd30,_0x4c5583){_0x2cbd30=_0x2cbd30-0x0;var _0x447c8b=_0x9877[_0x2cbd30];return _0x447c8b;};'use strict';var _=require(_0x7987('0x0'));var util=require(_0x7987('0x1'));var logger=require(_0x7987('0x2'))(_0x7987('0x3'));var moment=require('moment');var BPromise=require(_0x7987('0x4'));var rp=require(_0x7987('0x5'));var fs=require('fs');var path=require(_0x7987('0x6'));var rimraf=require('rimraf');var config=require(_0x7987('0x7'));var attributes=require(_0x7987('0x8'));module['exports']=function(_0x42ed17,_0x44a0b1){return _0x42ed17[_0x7987('0x9')](_0x7987('0xa'),attributes,{'tableName':_0x7987('0xb'),'paranoid':![],'indexes':[{'name':_0x7987('0xc'),'fields':[_0x7987('0xd'),_0x7987('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 2365847..b2b53ad 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 _0xd95d=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','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','catch','lodash'];(function(_0x779fd1,_0x3ee603){var _0x5a0397=function(_0x3673b3){while(--_0x3673b3){_0x779fd1['push'](_0x779fd1['shift']());}};_0x5a0397(++_0x3ee603);}(_0xd95d,0xfc));var _0xdd95=function(_0x385b52,_0xefe1e1){_0x385b52=_0x385b52-0x0;var _0x5697b5=_0xd95d[_0x385b52];return _0x5697b5;};'use strict';var _=require(_0xdd95('0x0'));var util=require(_0xdd95('0x1'));var moment=require('moment');var BPromise=require(_0xdd95('0x2'));var rs=require(_0xdd95('0x3'));var fs=require('fs');var Redis=require(_0xdd95('0x4'));var db=require(_0xdd95('0x5'))['db'];var utils=require(_0xdd95('0x6'));var logger=require(_0xdd95('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd95('0x8'));var client=jayson[_0xdd95('0x9')][_0xdd95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3961a9,_0x438173,_0x44e7ce){return new BPromise(function(_0x4206eb,_0x5a96ac){return client[_0xdd95('0xb')](_0x3961a9,_0x44e7ce)[_0xdd95('0xc')](function(_0x341e50){logger[_0xdd95('0xd')](_0xdd95('0xe'),_0x438173,_0xdd95('0xf'));logger[_0xdd95('0x10')](_0xdd95('0x11'),_0x438173,_0xdd95('0xf'),JSON[_0xdd95('0x12')](_0x341e50));if(_0x341e50[_0xdd95('0x13')]){if(_0x341e50[_0xdd95('0x13')][_0xdd95('0x14')]===0x1f4){logger['error'](_0xdd95('0xe'),_0x438173,_0x341e50['error'][_0xdd95('0x15')]);return _0x5a96ac(_0x341e50[_0xdd95('0x13')][_0xdd95('0x15')]);}logger[_0xdd95('0x13')]('SalesforceField,\x20%s,\x20%s',_0x438173,_0x341e50['error']['message']);return _0x4206eb(_0x341e50[_0xdd95('0x13')][_0xdd95('0x15')]);}else{logger[_0xdd95('0xd')](_0xdd95('0xe'),_0x438173,_0xdd95('0xf'));_0x4206eb(_0x341e50['result'][_0xdd95('0x15')]);}})[_0xdd95('0x16')](function(_0x266bb9){logger[_0xdd95('0x13')]('SalesforceField,\x20%s,\x20%s',_0x438173,_0x266bb9);_0x5a96ac(_0x266bb9);});});} \ No newline at end of file +var _0x1233=['code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x1233,0xab));var _0x3123=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x1233[_0x58965a];return _0x254efc;};'use strict';var _=require(_0x3123('0x0'));var util=require('util');var moment=require(_0x3123('0x1'));var BPromise=require(_0x3123('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3123('0x3'))['db'];var utils=require(_0x3123('0x4'));var logger=require(_0x3123('0x5'))(_0x3123('0x6'));var config=require('../../config/environment');var jayson=require(_0x3123('0x7'));var client=jayson[_0x3123('0x8')][_0x3123('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6013f1,_0x21ab87,_0x406875){return new BPromise(function(_0x1cf132,_0x3dad34){return client[_0x3123('0xa')](_0x6013f1,_0x406875)[_0x3123('0xb')](function(_0x40bc73){logger[_0x3123('0xc')](_0x3123('0xd'),_0x21ab87,_0x3123('0xe'));logger[_0x3123('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x21ab87,_0x3123('0xe'),JSON[_0x3123('0x10')](_0x40bc73));if(_0x40bc73['error']){if(_0x40bc73[_0x3123('0x11')][_0x3123('0x12')]===0x1f4){logger[_0x3123('0x11')](_0x3123('0xd'),_0x21ab87,_0x40bc73[_0x3123('0x11')]['message']);return _0x3dad34(_0x40bc73[_0x3123('0x11')][_0x3123('0x13')]);}logger[_0x3123('0x11')]('SalesforceField,\x20%s,\x20%s',_0x21ab87,_0x40bc73[_0x3123('0x11')][_0x3123('0x13')]);return _0x1cf132(_0x40bc73[_0x3123('0x11')]['message']);}else{logger[_0x3123('0xc')]('SalesforceField,\x20%s,\x20%s',_0x21ab87,_0x3123('0xe'));_0x1cf132(_0x40bc73[_0x3123('0x14')][_0x3123('0x13')]);}})['catch'](function(_0xa57db0){logger[_0x3123('0x11')]('SalesforceField,\x20%s,\x20%s',_0x21ab87,_0xa57db0);_0x3dad34(_0xa57db0);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 8718bca..9092d36 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 _0xdadf=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','create','post','put'];(function(_0x28200c,_0x2ab395){var _0x377778=function(_0x4ac88a){while(--_0x4ac88a){_0x28200c['push'](_0x28200c['shift']());}};_0x377778(++_0x2ab395);}(_0xdadf,0x1e7));var _0xfdad=function(_0x4d9076,_0x3a9c44){_0x4d9076=_0x4d9076-0x0;var _0x127f8d=_0xdadf[_0x4d9076];return _0x127f8d;};'use strict';var multer=require(_0xfdad('0x0'));var util=require(_0xfdad('0x1'));var path=require(_0xfdad('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdad('0x3'));var router=express[_0xfdad('0x4')]();var fs_extra=require(_0xfdad('0x5'));var auth=require(_0xfdad('0x6'));var interaction=require(_0xfdad('0x7'));var config=require(_0xfdad('0x8'));var controller=require(_0xfdad('0x9'));router[_0xfdad('0xa')]('/',auth[_0xfdad('0xb')](),controller['index']);router[_0xfdad('0xa')](_0xfdad('0xc'),auth[_0xfdad('0xb')](),controller['show']);router[_0xfdad('0xa')](_0xfdad('0xd'),auth[_0xfdad('0xb')](),controller[_0xfdad('0xe')]);router[_0xfdad('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xfdad('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfdad('0x10')]);router[_0xfdad('0x11')](_0xfdad('0xd'),auth[_0xfdad('0xb')](),controller['addConfiguration']);router[_0xfdad('0x12')](_0xfdad('0xc'),auth[_0xfdad('0xb')](),controller[_0xfdad('0x13')]);router[_0xfdad('0x14')](_0xfdad('0xc'),auth['isAuthenticated'](),controller[_0xfdad('0x15')]);module['exports']=router; \ No newline at end of file +var _0x6697=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x322ac7,_0x322fe6){var _0xc9e188=function(_0x4f37a3){while(--_0x4f37a3){_0x322ac7['push'](_0x322ac7['shift']());}};_0xc9e188(++_0x322fe6);}(_0x6697,0x1c3));var _0x7669=function(_0x3d20a3,_0x416806){_0x3d20a3=_0x3d20a3-0x0;var _0x44feb5=_0x6697[_0x3d20a3];return _0x44feb5;};'use strict';var multer=require(_0x7669('0x0'));var util=require(_0x7669('0x1'));var path=require(_0x7669('0x2'));var timeout=require(_0x7669('0x3'));var express=require(_0x7669('0x4'));var router=express[_0x7669('0x5')]();var fs_extra=require(_0x7669('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7669('0x7'));var config=require(_0x7669('0x8'));var controller=require(_0x7669('0x9'));router[_0x7669('0xa')]('/',auth[_0x7669('0xb')](),controller['index']);router[_0x7669('0xa')](_0x7669('0xc'),auth[_0x7669('0xb')](),controller[_0x7669('0xd')]);router[_0x7669('0xa')](_0x7669('0xe'),auth[_0x7669('0xb')](),controller[_0x7669('0xf')]);router[_0x7669('0xa')]('/:id/fields',auth[_0x7669('0xb')](),controller[_0x7669('0x10')]);router[_0x7669('0x11')]('/',auth[_0x7669('0xb')](),controller['create']);router[_0x7669('0x11')](_0x7669('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x7669('0x12')](_0x7669('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7669('0x13')]('/:id',auth[_0x7669('0xb')](),controller[_0x7669('0x14')]);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 6f39a48..2728213 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 _0xd6a6=['exports','STRING','username','remoteUri','sequelize'];(function(_0x54e94b,_0x1b3f8c){var _0x2746ff=function(_0x5991c6){while(--_0x5991c6){_0x54e94b['push'](_0x54e94b['shift']());}};_0x2746ff(++_0x1b3f8c);}(_0xd6a6,0x13a));var _0x6d6a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6a6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6d6a('0x0'));module[_0x6d6a('0x1')]={'name':{'type':Sequelize[_0x6d6a('0x2')]},'description':{'type':Sequelize[_0x6d6a('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6d6a('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6d6a('0x2')],'unique':_0x6d6a('0x4')},'serverUrl':{'type':Sequelize[_0x6d6a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x415e=['STRING','username','remoteUri','sequelize'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x415e,0x9b));var _0xe415=function(_0xb2c91a,_0xc61319){_0xb2c91a=_0xb2c91a-0x0;var _0x9a47db=_0x415e[_0xb2c91a];return _0x9a47db;};'use strict';var Sequelize=require(_0xe415('0x0'));module['exports']={'name':{'type':Sequelize[_0xe415('0x1')]},'description':{'type':Sequelize[_0xe415('0x1')]},'username':{'type':Sequelize[_0xe415('0x1')],'unique':_0xe415('0x2')},'password':{'type':Sequelize[_0xe415('0x1')]},'email':{'type':Sequelize[_0xe415('0x1')]},'remoteUri':{'type':Sequelize[_0xe415('0x1')],'unique':_0xe415('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 b79e162..a749039 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 _0x7cbc=['approval','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','false','inactive','value','rimraf','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','findAll','then','catch','show','params','includeAll','include','find','create','body','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','hold_reason','knowledge','subcategory','notify','severity','caused_by','watch_list','sys_updated_on','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments'];(function(_0x56ecad,_0x40b4c7){var _0x1f2e02=function(_0x11822f){while(--_0x11822f){_0x56ecad['push'](_0x56ecad['shift']());}};_0x1f2e02(++_0x40b4c7);}(_0x7cbc,0xd9));var _0xc7cb=function(_0x176a04,_0x2b5354){_0x176a04=_0x176a04-0x0;var _0x554b8d=_0x7cbc[_0x176a04];return _0x554b8d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7cb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc7cb('0x1'));var moment=require(_0xc7cb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc7cb('0x3'));var util=require(_0xc7cb('0x4'));var path=require(_0xc7cb('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7cb('0x6'));var _=require(_0xc7cb('0x7'));var squel=require(_0xc7cb('0x8'));var crypto=require(_0xc7cb('0x9'));var jsforce=require(_0xc7cb('0xa'));var deskjs=require(_0xc7cb('0xb'));var toCsv=require(_0xc7cb('0xc'));var querystring=require(_0xc7cb('0xd'));var Papa=require(_0xc7cb('0xe'));var Redis=require(_0xc7cb('0xf'));var authService=require(_0xc7cb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc7cb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7cb('0x12'))(_0xc7cb('0x13'));var utils=require('../../config/utils');var config=require(_0xc7cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f7564,_0x4abfb7){_0x4abfb7=_0x4abfb7||0xcc;return function(_0x32c4d9){if(_0x32c4d9){return _0x4f7564[_0xc7cb('0x15')](_0x4abfb7);}return _0x4f7564[_0xc7cb('0x16')](_0x4abfb7)[_0xc7cb('0x17')]();};}function respondWithResult(_0x38deda,_0x3de17d){_0x3de17d=_0x3de17d||0xc8;return function(_0x4ceb27){if(_0x4ceb27){return _0x38deda[_0xc7cb('0x16')](_0x3de17d)[_0xc7cb('0x18')](_0x4ceb27);}};}function respondWithFilteredResult(_0x424dd2,_0x4edc0d){return function(_0x1d93c5){if(_0x1d93c5){var _0x259e89=typeof _0x4edc0d[_0xc7cb('0x19')]===_0xc7cb('0x1a')&&typeof _0x4edc0d[_0xc7cb('0x1b')]===_0xc7cb('0x1a');var _0x370005=_0x1d93c5['count'];var _0x9ce991=_0x259e89?0x0:_0x4edc0d[_0xc7cb('0x19')];var _0x389707=_0x259e89?_0x1d93c5[_0xc7cb('0x1c')]:_0x4edc0d['offset']+_0x4edc0d[_0xc7cb('0x1b')];var _0x519079;if(_0x389707>=_0x370005){_0x389707=_0x370005;_0x519079=0xc8;}else{_0x519079=0xce;}_0x424dd2[_0xc7cb('0x16')](_0x519079);return _0x424dd2[_0xc7cb('0x1d')]('Content-Range',_0x9ce991+'-'+_0x389707+'/'+_0x370005)['json'](_0x1d93c5);}return null;};}function patchUpdates(_0x783a86){return function(_0x93d8fb){try{jsonpatch[_0xc7cb('0x1e')](_0x93d8fb,_0x783a86,!![]);}catch(_0x384880){return BPromise['reject'](_0x384880);}return _0x93d8fb[_0xc7cb('0x1f')]();};}function saveUpdates(_0x5cb651,_0x160e72){return function(_0x2086f4){if(_0x2086f4){return _0x2086f4[_0xc7cb('0x20')](_0x5cb651)['then'](function(_0x185cb1){return _0x185cb1;});}return null;};}function removeEntity(_0x2bd0d9,_0x524b49){return function(_0x4268fb){if(_0x4268fb){return _0x4268fb[_0xc7cb('0x21')]()['then'](function(){_0x2bd0d9[_0xc7cb('0x16')](0xcc)[_0xc7cb('0x17')]();});}};}function handleEntityNotFound(_0x39da0b,_0x1e8823){return function(_0x572105){if(!_0x572105){_0x39da0b[_0xc7cb('0x15')](0x194);}return _0x572105;};}function handleError(_0x5f58ca,_0x432d95){_0x432d95=_0x432d95||0x1f4;return function(_0x5a1362){logger[_0xc7cb('0x22')](_0x5a1362[_0xc7cb('0x23')]);if(_0x5a1362[_0xc7cb('0x24')]){delete _0x5a1362['name'];}_0x5f58ca[_0xc7cb('0x16')](_0x432d95)[_0xc7cb('0x25')](_0x5a1362);};}exports['index']=function(_0x35f6ce,_0x1e50b6){var _0x5114df={},_0x20f096={},_0x4a479a={'count':0x0,'rows':[]};var _0x35f799=_[_0xc7cb('0x26')](db[_0xc7cb('0x27')][_0xc7cb('0x28')],function(_0x2d1f88){return{'name':_0x2d1f88['fieldName'],'type':_0x2d1f88['type'][_0xc7cb('0x29')]};});_0x20f096['model']=_[_0xc7cb('0x26')](_0x35f799,_0xc7cb('0x24'));_0x20f096[_0xc7cb('0x2a')]=_[_0xc7cb('0x2b')](_0x35f6ce['query']);_0x20f096['filters']=_[_0xc7cb('0x2c')](_0x20f096['model'],_0x20f096[_0xc7cb('0x2a')]);_0x5114df[_0xc7cb('0x2d')]=_[_0xc7cb('0x2c')](_0x20f096[_0xc7cb('0x2e')],qs[_0xc7cb('0x2f')](_0x35f6ce[_0xc7cb('0x2a')][_0xc7cb('0x2f')]));_0x5114df['attributes']=_0x5114df[_0xc7cb('0x2d')][_0xc7cb('0x30')]?_0x5114df[_0xc7cb('0x2d')]:_0x20f096[_0xc7cb('0x2e')];if(!_0x35f6ce[_0xc7cb('0x2a')][_0xc7cb('0x31')](_0xc7cb('0x32'))){_0x5114df[_0xc7cb('0x1b')]=qs['limit'](_0x35f6ce[_0xc7cb('0x2a')][_0xc7cb('0x1b')]);_0x5114df[_0xc7cb('0x19')]=qs[_0xc7cb('0x19')](_0x35f6ce['query']['offset']);}_0x5114df[_0xc7cb('0x33')]=qs[_0xc7cb('0x34')](_0x35f6ce[_0xc7cb('0x2a')][_0xc7cb('0x34')]);_0x5114df[_0xc7cb('0x35')]=qs[_0xc7cb('0x36')](_['pick'](_0x35f6ce[_0xc7cb('0x2a')],_0x20f096[_0xc7cb('0x36')]),_0x35f799);if(_0x35f6ce[_0xc7cb('0x2a')][_0xc7cb('0x37')]){_0x5114df['where']=_['merge'](_0x5114df[_0xc7cb('0x35')],{'$or':_[_0xc7cb('0x26')](_0x35f799,function(_0x2dcd8b){if(_0x2dcd8b[_0xc7cb('0x38')]!==_0xc7cb('0x39')){var _0x56b8c2={};_0x56b8c2[_0x2dcd8b[_0xc7cb('0x24')]]={'$like':'%'+_0x35f6ce[_0xc7cb('0x2a')][_0xc7cb('0x37')]+'%'};return _0x56b8c2;}})});}_0x5114df=_[_0xc7cb('0x3a')]({},_0x5114df,_0x35f6ce[_0xc7cb('0x3b')]);var _0x495971={'where':_0x5114df[_0xc7cb('0x35')]};return db['ServicenowAccount']['count'](_0x495971)['then'](function(_0x44a3c0){_0x4a479a[_0xc7cb('0x1c')]=_0x44a3c0;if(_0x35f6ce[_0xc7cb('0x2a')]['includeAll']){_0x5114df['include']=[{'all':!![]}];}return db[_0xc7cb('0x27')][_0xc7cb('0x3c')](_0x5114df);})[_0xc7cb('0x3d')](function(_0x5828b6){_0x4a479a['rows']=_0x5828b6;return _0x4a479a;})['then'](respondWithFilteredResult(_0x1e50b6,_0x5114df))[_0xc7cb('0x3e')](handleError(_0x1e50b6,null));};exports[_0xc7cb('0x3f')]=function(_0x30b55e,_0x350f40){var _0x3a7b53={'raw':![],'where':{'id':_0x30b55e[_0xc7cb('0x40')]['id']}},_0x20130c={};_0x20130c[_0xc7cb('0x2e')]=_[_0xc7cb('0x2b')](db[_0xc7cb('0x27')][_0xc7cb('0x28')]);_0x20130c[_0xc7cb('0x2a')]=_[_0xc7cb('0x2b')](_0x30b55e[_0xc7cb('0x2a')]);_0x20130c[_0xc7cb('0x36')]=_['intersection'](_0x20130c[_0xc7cb('0x2e')],_0x20130c[_0xc7cb('0x2a')]);_0x3a7b53[_0xc7cb('0x2d')]=_[_0xc7cb('0x2c')](_0x20130c[_0xc7cb('0x2e')],qs['fields'](_0x30b55e[_0xc7cb('0x2a')][_0xc7cb('0x2f')]));_0x3a7b53[_0xc7cb('0x2d')]=_0x3a7b53[_0xc7cb('0x2d')]['length']?_0x3a7b53[_0xc7cb('0x2d')]:_0x20130c['model'];if(_0x30b55e[_0xc7cb('0x2a')][_0xc7cb('0x41')]){_0x3a7b53[_0xc7cb('0x42')]=[{'all':!![]}];}_0x3a7b53=_['merge']({},_0x3a7b53,_0x30b55e[_0xc7cb('0x3b')]);return db[_0xc7cb('0x27')][_0xc7cb('0x43')](_0x3a7b53)['then'](handleEntityNotFound(_0x350f40,null))[_0xc7cb('0x3d')](respondWithResult(_0x350f40,null))[_0xc7cb('0x3e')](handleError(_0x350f40,null));};exports[_0xc7cb('0x44')]=function(_0x183db5,_0x2ee2c2){return db[_0xc7cb('0x27')][_0xc7cb('0x44')](_0x183db5[_0xc7cb('0x45')],{})[_0xc7cb('0x3d')](respondWithResult(_0x2ee2c2,0xc9))['catch'](handleError(_0x2ee2c2,null));};exports['update']=function(_0x5e79cc,_0x24b511){if(_0x5e79cc['body']['id']){delete _0x5e79cc['body']['id'];}return db['ServicenowAccount'][_0xc7cb('0x43')]({'where':{'id':_0x5e79cc[_0xc7cb('0x40')]['id']}})[_0xc7cb('0x3d')](handleEntityNotFound(_0x24b511,null))[_0xc7cb('0x3d')](saveUpdates(_0x5e79cc['body'],null))['then'](respondWithResult(_0x24b511,null))['catch'](handleError(_0x24b511,null));};exports[_0xc7cb('0x21')]=function(_0x52caec,_0x2d76ce){return db['ServicenowAccount'][_0xc7cb('0x43')]({'where':{'id':_0x52caec[_0xc7cb('0x40')]['id']}})[_0xc7cb('0x3d')](handleEntityNotFound(_0x2d76ce,null))[_0xc7cb('0x3d')](removeEntity(_0x2d76ce,null))[_0xc7cb('0x3e')](handleError(_0x2d76ce,null));};exports['getConfigurations']=function(_0x464da0,_0x31d6f5,_0x1378e2){var _0x29ab4c={};var _0x43b5c6={};var _0x4d263a;var _0x3fab3f;return db['ServicenowAccount'][_0xc7cb('0x46')]({'where':{'id':_0x464da0[_0xc7cb('0x40')]['id']}})[_0xc7cb('0x3d')](handleEntityNotFound(_0x31d6f5,null))[_0xc7cb('0x3d')](function(_0x3d2dbc){if(_0x3d2dbc){_0x4d263a=_0x3d2dbc;_0x43b5c6[_0xc7cb('0x2e')]=_[_0xc7cb('0x2b')](db[_0xc7cb('0x47')][_0xc7cb('0x28')]);_0x43b5c6[_0xc7cb('0x2a')]=_[_0xc7cb('0x2b')](_0x464da0[_0xc7cb('0x2a')]);_0x43b5c6[_0xc7cb('0x36')]=_[_0xc7cb('0x2c')](_0x43b5c6[_0xc7cb('0x2e')],_0x43b5c6[_0xc7cb('0x2a')]);_0x29ab4c[_0xc7cb('0x2d')]=_['intersection'](_0x43b5c6['model'],qs['fields'](_0x464da0['query'][_0xc7cb('0x2f')]));_0x29ab4c['attributes']=_0x29ab4c[_0xc7cb('0x2d')]['length']?_0x29ab4c[_0xc7cb('0x2d')]:_0x43b5c6[_0xc7cb('0x2e')];_0x29ab4c[_0xc7cb('0x33')]=qs[_0xc7cb('0x34')](_0x464da0[_0xc7cb('0x2a')][_0xc7cb('0x34')]);_0x29ab4c[_0xc7cb('0x35')]=qs['filters'](_[_0xc7cb('0x48')](_0x464da0[_0xc7cb('0x2a')],_0x43b5c6[_0xc7cb('0x36')]));if(_0x464da0[_0xc7cb('0x2a')]['filter']){_0x29ab4c['where']=_[_0xc7cb('0x3a')](_0x29ab4c[_0xc7cb('0x35')],{'$or':_[_0xc7cb('0x26')](_0x29ab4c[_0xc7cb('0x2d')],function(_0x3de819){var _0x195111={};_0x195111[_0x3de819]={'$like':'%'+_0x464da0[_0xc7cb('0x2a')]['filter']+'%'};return _0x195111;})});}_0x29ab4c=_[_0xc7cb('0x3a')]({},_0x29ab4c,_0x464da0[_0xc7cb('0x3b')]);return _0x4d263a[_0xc7cb('0x49')](_0x29ab4c);}})[_0xc7cb('0x3d')](function(_0x15f3ce){if(_0x15f3ce){_0x3fab3f=_0x15f3ce[_0xc7cb('0x30')];if(!_0x464da0[_0xc7cb('0x2a')][_0xc7cb('0x31')](_0xc7cb('0x32'))){_0x29ab4c[_0xc7cb('0x1b')]=qs['limit'](_0x464da0['query'][_0xc7cb('0x1b')]);_0x29ab4c[_0xc7cb('0x19')]=qs[_0xc7cb('0x19')](_0x464da0[_0xc7cb('0x2a')][_0xc7cb('0x19')]);}return _0x4d263a[_0xc7cb('0x49')](_0x29ab4c);}})[_0xc7cb('0x3d')](function(_0x278cab){if(_0x278cab){return _0x278cab?{'count':_0x3fab3f,'rows':_0x278cab}:null;}})['then'](respondWithResult(_0x31d6f5,null))['catch'](handleError(_0x31d6f5,null));};exports[_0xc7cb('0x4a')]=function(_0x18932d,_0x180873,_0x5916a3){if(_0x18932d[_0xc7cb('0x45')]['id']){delete _0x18932d[_0xc7cb('0x45')]['id'];}return db[_0xc7cb('0x27')]['findOne']({'where':{'id':_0x18932d[_0xc7cb('0x40')]['id']}})[_0xc7cb('0x3d')](handleEntityNotFound(_0x180873,null))[_0xc7cb('0x3d')](function(_0x51ca91){if(_0x51ca91){_0x18932d[_0xc7cb('0x45')][_0xc7cb('0x4b')]=_0x51ca91['id'];_0x18932d[_0xc7cb('0x45')][_0xc7cb('0x4c')]=integrations[_0xc7cb('0x4d')](_0x18932d['body'][_0xc7cb('0x4e')],_0x18932d[_0xc7cb('0x45')][_0xc7cb('0x38')]);_0x18932d[_0xc7cb('0x45')]['Descriptions']=integrations['getDescriptions'](_0x18932d[_0xc7cb('0x45')][_0xc7cb('0x4e')],_0x18932d[_0xc7cb('0x45')]['type']);return db[_0xc7cb('0x47')]['create'](_0x18932d[_0xc7cb('0x45')],{'include':[{'model':db['ServicenowField'],'as':_0xc7cb('0x4c')},{'model':db['ServicenowField'],'as':_0xc7cb('0x4f')}]});}return null;})['then'](respondWithResult(_0x180873,null))[_0xc7cb('0x3e')](handleError(_0x180873,null));};exports[_0xc7cb('0x50')]=function(_0x4346af,_0x4edf75,_0x4475db){var _0x10e498=['made_sla',_0xc7cb('0x51'),_0xc7cb('0x52'),_0xc7cb('0x53'),'close_code',_0xc7cb('0x54'),'incident_state',_0xc7cb('0x55'),'category'];var _0x49d4af=['parent','made_sla',_0xc7cb('0x56'),_0xc7cb('0x57'),'upon_reject',_0xc7cb('0x58'),'child_incidents',_0xc7cb('0x51'),'approval_history',_0xc7cb('0x59'),_0xc7cb('0x5a'),_0xc7cb('0x5b'),'opened_by',_0xc7cb('0x5c'),_0xc7cb('0x5d'),_0xc7cb('0x5e'),'state',_0xc7cb('0x5f'),_0xc7cb('0x52'),_0xc7cb('0x33'),_0xc7cb('0x60'),_0xc7cb('0x61'),_0xc7cb('0x62'),'delivery_plan',_0xc7cb('0x63'),_0xc7cb('0x64'),'work_notes_list','business_service',_0xc7cb('0x65'),_0xc7cb('0x66'),_0xc7cb('0x67'),_0xc7cb('0x68'),_0xc7cb('0x69'),_0xc7cb('0x6a'),_0xc7cb('0x6b'),_0xc7cb('0x6c'),_0xc7cb('0x6d'),_0xc7cb('0x6e'),_0xc7cb('0x6f'),_0xc7cb('0x70'),_0xc7cb('0x71'),_0xc7cb('0x53'),'work_notes',_0xc7cb('0x72'),_0xc7cb('0x73'),_0xc7cb('0x74'),_0xc7cb('0x75'),_0xc7cb('0x76'),_0xc7cb('0x77'),_0xc7cb('0x78'),_0xc7cb('0x79'),_0xc7cb('0x7a'),_0xc7cb('0x7b'),_0xc7cb('0x54'),_0xc7cb('0x7c'),'close_notes',_0xc7cb('0x7d'),_0xc7cb('0x7e'),'parent_incident','sys_id','contact_type',_0xc7cb('0x7f'),'incident_state',_0xc7cb('0x80'),_0xc7cb('0x81'),_0xc7cb('0x82'),_0xc7cb('0x83'),_0xc7cb('0x84'),_0xc7cb('0x85'),_0xc7cb('0x55'),_0xc7cb('0x86'),'sla_due',_0xc7cb('0x87'),'comments_and_work_notes','due_date',_0xc7cb('0x88'),_0xc7cb('0x89'),_0xc7cb('0x8a'),_0xc7cb('0x8b'),_0xc7cb('0x8c'),'correlation_id','location',_0xc7cb('0x8d')];var _0x15d9e7='';var _0x3afca2='';var _0x28bb3e=[];var _0x138636='';var _0x3e9f7b='';var _0x27c250=[];var _0x193979='';var _0x1c3ed3='';var _0x3fff53={};var _0x2cb859='';return db[_0xc7cb('0x27')][_0xc7cb('0x46')]({'where':{'id':_0x4346af[_0xc7cb('0x40')]['id']},'attributes':['id',_0xc7cb('0x8e'),_0xc7cb('0x8f'),_0xc7cb('0x90'),_0xc7cb('0x91'),_0xc7cb('0x92')]})[_0xc7cb('0x3d')](handleEntityNotFound(_0x4edf75,null))[_0xc7cb('0x3d')](function(_0x5fa9eb){if(_0x5fa9eb){_0x2cb859=_0x5fa9eb[_0xc7cb('0x91')];var _0x4fb5e2=_0x2cb859[_0xc7cb('0x93')](-0x1);if(_0x4fb5e2==='/'){_0x2cb859=_0x2cb859[_0xc7cb('0x94')](0x0,_0x2cb859[_0xc7cb('0x95')](_0x4fb5e2));}_0x1c3ed3=util[_0xc7cb('0x96')]('%s/api/now/doc/table/schema/',_0x2cb859);_0x193979=util[_0xc7cb('0x96')](_0xc7cb('0x97'),_0x2cb859);_0x3fff53={'user':_0x5fa9eb[_0xc7cb('0x8e')],'pass':_0x5fa9eb[_0xc7cb('0x8f')]};var _0x39bdbc={'method':_0xc7cb('0x98'),'uri':_0x1c3ed3+'incident?sysparm_display_value=all','auth':_0x3fff53,'json':!![]};return rp(_0x39bdbc);}})[_0xc7cb('0x3d')](function(_0x1dcbc3){if(_0x1dcbc3[_0xc7cb('0x99')][_0xc7cb('0x30')]>0x0){_0x15d9e7=_0x1dcbc3[_0xc7cb('0x99')];}console[_0xc7cb('0x9a')](_0xc7cb('0x9b'),_0x15d9e7);_0x27c250=[];_0x3afca2=Object[_0xc7cb('0x9c')]([],_0x15d9e7);_[_0xc7cb('0x9d')](_0x3afca2,function(_0xa15f54){return!_0x10e498['includes'](_0xa15f54[_0xc7cb('0x24')]);});_0x3afca2[_0xc7cb('0x9e')](function(_0x453d86){var _0x3928dc=createFieldObject(_0x193979,_0x3fff53,_0x453d86[_0xc7cb('0x9f')],_0x453d86[_0xc7cb('0x24')],_0x453d86[_0xc7cb('0xa0')],![]);_0x27c250[_0xc7cb('0xa1')](_0x3928dc);});return Promise[_0xc7cb('0xa2')](_0x27c250);})[_0xc7cb('0x3d')](function(_0x430167){_0x28bb3e=_0x430167;_0x138636=Object[_0xc7cb('0x9c')]([],_0x15d9e7);console[_0xc7cb('0x9a')](_0xc7cb('0xa3'),_0x15d9e7);_[_0xc7cb('0x9d')](_0x138636,function(_0x16cec4){return _0x49d4af[_0xc7cb('0xa4')](_0x16cec4['name']);});console['log'](_0xc7cb('0xa5'),_0x138636);_0x27c250=[];_0x138636['forEach'](function(_0x9f4d3e){var _0x3cd918=createFieldObject(_0x193979,_0x3fff53,_0x9f4d3e[_0xc7cb('0x9f')],_0x9f4d3e[_0xc7cb('0x24')],_0x9f4d3e[_0xc7cb('0xa0')],!![]);_0x27c250[_0xc7cb('0xa1')](_0x3cd918);});return Promise[_0xc7cb('0xa2')](_0x27c250);})[_0xc7cb('0x3d')](function(_0x11687c){_0x3e9f7b=_0x11687c;var _0x12a36b=_0x28bb3e[_0xc7cb('0xa6')](_0x3e9f7b);return{'count':_0x12a36b['length'],'rows':_0x12a36b};})['then'](respondWithResult(_0x4edf75,null))[_0xc7cb('0x3e')](function(_0x20a215){console[_0xc7cb('0x9a')](_0xc7cb('0xa7')+_0x20a215);var _0x3412c7=_0x4346af[_0xc7cb('0x2a')][_0xc7cb('0xa8')]?0x1f4:_0x20a215['statusCode']||0x1f4;logger[_0xc7cb('0x22')](_0x20a215['stack']);delete _0x20a215['name'];if(_0x3412c7===0x191){_0x3412c7=0x190;}_0x4edf75[_0xc7cb('0x16')](_0x3412c7)[_0xc7cb('0x25')](_0x4346af['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x20a215[_0xc7cb('0xa9')]}:_0x20a215);});};function createFieldObject(_0x51767a,_0x2ca73d,_0x397707,_0xf1d01c,_0x2e4850,_0x49a196){return new Promise(function(_0x51ce25,_0x26388f){var _0x32b345={'id':_0xf1d01c,'name':_0x2e4850,'custom':_0x49a196};if(_0x397707===_0xc7cb('0xaa')){_0x32b345[_0xc7cb('0x3b')]=[{'name':'True','value':_0xc7cb('0xab')},{'name':_0xc7cb('0xac'),'value':_0xc7cb('0xad')}];_0x51ce25(_0x32b345);}else{var _0xbdd45a={'method':'GET','uri':_0x51767a+'sys_choice?sysparm_query=name=incident^element='+_0xf1d01c,'auth':_0x2ca73d,'json':!![]};return rp(_0xbdd45a)['then'](function(_0x19c014){var _0x256a2f=[];if(_0x19c014['result'][_0xc7cb('0x30')]>0x0){_0x19c014[_0xc7cb('0x99')][_0xc7cb('0x9e')](function(_0x30d005){if(_0x30d005[_0xc7cb('0xae')]===_0xc7cb('0xad')){var _0x4cb713={'name':_0x30d005['label'],'value':_0x30d005[_0xc7cb('0xaf')]};_0x256a2f[_0xc7cb('0xa1')](_0x4cb713);}});}_0x32b345[_0xc7cb('0x3b')]=_0x256a2f;if(_0x32b345[_0xc7cb('0x3b')]['length']>0x0){_0x51ce25(_0x32b345);}else{if(_0x49a196==![]){_0x51ce25();}else{_0x51ce25(_0x32b345);}}});}});} \ No newline at end of file +var _0x93c3=['parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','test','error','stack','Wrong\x20credentials','statusCode','boolean','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','ServicenowAccount','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy','getConfigurations','ServicenowConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','notify','incident_state','severity','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','short_description','close_code','correlation_display','delivery_task','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0x93c3,0x1b5));var _0x393c=function(_0x42f074,_0x477165){_0x42f074=_0x42f074-0x0;var _0x3b3e8c=_0x93c3[_0x42f074];return _0x3b3e8c;};'use strict';var emlformat=require(_0x393c('0x0'));var rimraf=require(_0x393c('0x1'));var zipdir=require(_0x393c('0x2'));var jsonpatch=require(_0x393c('0x3'));var rp=require('request-promise');var moment=require(_0x393c('0x4'));var BPromise=require(_0x393c('0x5'));var Mustache=require(_0x393c('0x6'));var util=require(_0x393c('0x7'));var path=require(_0x393c('0x8'));var sox=require(_0x393c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x393c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x393c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x393c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x393c('0xd'));var Papa=require(_0x393c('0xe'));var Redis=require(_0x393c('0xf'));var authService=require(_0x393c('0x10'));var qs=require(_0x393c('0x11'));var as=require(_0x393c('0x12'));var hardwareService=require(_0x393c('0x13'));var logger=require('../../config/logger')(_0x393c('0x14'));var utils=require(_0x393c('0x15'));var config=require(_0x393c('0x16'));var licenseUtil=require(_0x393c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1db2af,_0x26f55a){_0x26f55a=_0x26f55a||0xcc;return function(_0xba80bf){if(_0xba80bf){return _0x1db2af[_0x393c('0x18')](_0x26f55a);}return _0x1db2af[_0x393c('0x19')](_0x26f55a)[_0x393c('0x1a')]();};}function respondWithResult(_0x48f929,_0x2e920f){_0x2e920f=_0x2e920f||0xc8;return function(_0x53e6cd){if(_0x53e6cd){return _0x48f929[_0x393c('0x19')](_0x2e920f)[_0x393c('0x1b')](_0x53e6cd);}};}function respondWithFilteredResult(_0x4aedef,_0x4b0c7e){return function(_0x3da074){if(_0x3da074){var _0x57bc60=typeof _0x4b0c7e['offset']===_0x393c('0x1c')&&typeof _0x4b0c7e[_0x393c('0x1d')]==='undefined';var _0x2f6e8e=_0x3da074[_0x393c('0x1e')];var _0x1e14a3=_0x57bc60?0x0:_0x4b0c7e[_0x393c('0x1f')];var _0x3a6be3=_0x57bc60?_0x3da074['count']:_0x4b0c7e['offset']+_0x4b0c7e[_0x393c('0x1d')];var _0x4046a3;if(_0x3a6be3>=_0x2f6e8e){_0x3a6be3=_0x2f6e8e;_0x4046a3=0xc8;}else{_0x4046a3=0xce;}_0x4aedef[_0x393c('0x19')](_0x4046a3);return _0x4aedef[_0x393c('0x20')](_0x393c('0x21'),_0x1e14a3+'-'+_0x3a6be3+'/'+_0x2f6e8e)[_0x393c('0x1b')](_0x3da074);}return null;};}function patchUpdates(_0x33259a){return function(_0x29df69){try{jsonpatch['apply'](_0x29df69,_0x33259a,!![]);}catch(_0x529884){return BPromise[_0x393c('0x22')](_0x529884);}return _0x29df69[_0x393c('0x23')]();};}function saveUpdates(_0x35f5eb,_0x4e56ba){return function(_0x4b5498){if(_0x4b5498){return _0x4b5498[_0x393c('0x24')](_0x35f5eb)[_0x393c('0x25')](function(_0x494001){return _0x494001;});}return null;};}function removeEntity(_0x377a9b,_0x5186cf){return function(_0x1a3228){if(_0x1a3228){return _0x1a3228['destroy']()[_0x393c('0x25')](function(){_0x377a9b[_0x393c('0x19')](0xcc)[_0x393c('0x1a')]();});}};}function handleEntityNotFound(_0x4011f2,_0x58654a){return function(_0xe6de8a){if(!_0xe6de8a){_0x4011f2[_0x393c('0x18')](0x194);}return _0xe6de8a;};}function handleError(_0x479bcf,_0x53588a){_0x53588a=_0x53588a||0x1f4;return function(_0x5d67f1){logger['error'](_0x5d67f1['stack']);if(_0x5d67f1[_0x393c('0x26')]){delete _0x5d67f1[_0x393c('0x26')];}_0x479bcf['status'](_0x53588a)[_0x393c('0x27')](_0x5d67f1);};}exports[_0x393c('0x28')]=function(_0xa09e1b,_0x21dbd3){var _0x125219={},_0x5c4cbd={},_0x5bfe85={'count':0x0,'rows':[]};var _0x16e153=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x6733e5){return{'name':_0x6733e5[_0x393c('0x29')],'type':_0x6733e5[_0x393c('0x2a')][_0x393c('0x2b')]};});_0x5c4cbd[_0x393c('0x2c')]=_['map'](_0x16e153,'name');_0x5c4cbd[_0x393c('0x2d')]=_[_0x393c('0x2e')](_0xa09e1b[_0x393c('0x2d')]);_0x5c4cbd[_0x393c('0x2f')]=_[_0x393c('0x30')](_0x5c4cbd[_0x393c('0x2c')],_0x5c4cbd[_0x393c('0x2d')]);_0x125219[_0x393c('0x31')]=_['intersection'](_0x5c4cbd['model'],qs[_0x393c('0x32')](_0xa09e1b['query']['fields']));_0x125219['attributes']=_0x125219['attributes'][_0x393c('0x33')]?_0x125219[_0x393c('0x31')]:_0x5c4cbd[_0x393c('0x2c')];if(!_0xa09e1b['query'][_0x393c('0x34')]('nolimit')){_0x125219[_0x393c('0x1d')]=qs[_0x393c('0x1d')](_0xa09e1b[_0x393c('0x2d')][_0x393c('0x1d')]);_0x125219[_0x393c('0x1f')]=qs[_0x393c('0x1f')](_0xa09e1b[_0x393c('0x2d')][_0x393c('0x1f')]);}_0x125219[_0x393c('0x35')]=qs[_0x393c('0x36')](_0xa09e1b['query'][_0x393c('0x36')]);_0x125219['where']=qs[_0x393c('0x2f')](_[_0x393c('0x37')](_0xa09e1b['query'],_0x5c4cbd[_0x393c('0x2f')]),_0x16e153);if(_0xa09e1b[_0x393c('0x2d')][_0x393c('0x38')]){_0x125219[_0x393c('0x39')]=_[_0x393c('0x3a')](_0x125219[_0x393c('0x39')],{'$or':_[_0x393c('0x3b')](_0x16e153,function(_0x52ed9e){if(_0x52ed9e[_0x393c('0x2a')]!==_0x393c('0x3c')){var _0x1fb8a6={};_0x1fb8a6[_0x52ed9e['name']]={'$like':'%'+_0xa09e1b[_0x393c('0x2d')][_0x393c('0x38')]+'%'};return _0x1fb8a6;}})});}_0x125219=_[_0x393c('0x3a')]({},_0x125219,_0xa09e1b[_0x393c('0x3d')]);var _0x3a2981={'where':_0x125219[_0x393c('0x39')]};return db['ServicenowAccount'][_0x393c('0x1e')](_0x3a2981)[_0x393c('0x25')](function(_0x2252dc){_0x5bfe85[_0x393c('0x1e')]=_0x2252dc;if(_0xa09e1b[_0x393c('0x2d')][_0x393c('0x3e')]){_0x125219[_0x393c('0x3f')]=[{'all':!![]}];}return db[_0x393c('0x40')][_0x393c('0x41')](_0x125219);})['then'](function(_0x446d3f){_0x5bfe85[_0x393c('0x42')]=_0x446d3f;return _0x5bfe85;})[_0x393c('0x25')](respondWithFilteredResult(_0x21dbd3,_0x125219))[_0x393c('0x43')](handleError(_0x21dbd3,null));};exports[_0x393c('0x44')]=function(_0x2921ad,_0xa102a8){var _0x5ef400={'raw':![],'where':{'id':_0x2921ad[_0x393c('0x45')]['id']}},_0x2b6637={};_0x2b6637[_0x393c('0x2c')]=_[_0x393c('0x2e')](db[_0x393c('0x40')][_0x393c('0x46')]);_0x2b6637['query']=_[_0x393c('0x2e')](_0x2921ad['query']);_0x2b6637['filters']=_[_0x393c('0x30')](_0x2b6637[_0x393c('0x2c')],_0x2b6637['query']);_0x5ef400['attributes']=_[_0x393c('0x30')](_0x2b6637[_0x393c('0x2c')],qs[_0x393c('0x32')](_0x2921ad[_0x393c('0x2d')][_0x393c('0x32')]));_0x5ef400[_0x393c('0x31')]=_0x5ef400[_0x393c('0x31')][_0x393c('0x33')]?_0x5ef400[_0x393c('0x31')]:_0x2b6637['model'];if(_0x2921ad[_0x393c('0x2d')][_0x393c('0x3e')]){_0x5ef400['include']=[{'all':!![]}];}_0x5ef400=_[_0x393c('0x3a')]({},_0x5ef400,_0x2921ad['options']);return db[_0x393c('0x40')]['find'](_0x5ef400)[_0x393c('0x25')](handleEntityNotFound(_0xa102a8,null))[_0x393c('0x25')](respondWithResult(_0xa102a8,null))['catch'](handleError(_0xa102a8,null));};exports[_0x393c('0x47')]=function(_0x25d255,_0x183011){return db[_0x393c('0x40')][_0x393c('0x47')](_0x25d255[_0x393c('0x48')],{})[_0x393c('0x25')](respondWithResult(_0x183011,0xc9))[_0x393c('0x43')](handleError(_0x183011,null));};exports[_0x393c('0x24')]=function(_0x4cee97,_0x5bcb82){if(_0x4cee97[_0x393c('0x48')]['id']){delete _0x4cee97[_0x393c('0x48')]['id'];}return db[_0x393c('0x40')][_0x393c('0x49')]({'where':{'id':_0x4cee97['params']['id']}})[_0x393c('0x25')](handleEntityNotFound(_0x5bcb82,null))['then'](saveUpdates(_0x4cee97[_0x393c('0x48')],null))[_0x393c('0x25')](respondWithResult(_0x5bcb82,null))[_0x393c('0x43')](handleError(_0x5bcb82,null));};exports[_0x393c('0x4a')]=function(_0xa818ec,_0xaeb46b){return db[_0x393c('0x40')][_0x393c('0x49')]({'where':{'id':_0xa818ec[_0x393c('0x45')]['id']}})[_0x393c('0x25')](handleEntityNotFound(_0xaeb46b,null))[_0x393c('0x25')](removeEntity(_0xaeb46b,null))[_0x393c('0x43')](handleError(_0xaeb46b,null));};exports[_0x393c('0x4b')]=function(_0x4f124f,_0x59ee98,_0x3a448e){var _0x2a9570={};var _0x46c89f={};var _0xd31508;var _0x1c9c91;return db[_0x393c('0x40')]['findOne']({'where':{'id':_0x4f124f['params']['id']}})[_0x393c('0x25')](handleEntityNotFound(_0x59ee98,null))[_0x393c('0x25')](function(_0x29f7fb){if(_0x29f7fb){_0xd31508=_0x29f7fb;_0x46c89f[_0x393c('0x2c')]=_[_0x393c('0x2e')](db[_0x393c('0x4c')][_0x393c('0x46')]);_0x46c89f[_0x393c('0x2d')]=_[_0x393c('0x2e')](_0x4f124f[_0x393c('0x2d')]);_0x46c89f['filters']=_['intersection'](_0x46c89f[_0x393c('0x2c')],_0x46c89f[_0x393c('0x2d')]);_0x2a9570[_0x393c('0x31')]=_['intersection'](_0x46c89f[_0x393c('0x2c')],qs['fields'](_0x4f124f['query'][_0x393c('0x32')]));_0x2a9570[_0x393c('0x31')]=_0x2a9570['attributes'][_0x393c('0x33')]?_0x2a9570[_0x393c('0x31')]:_0x46c89f[_0x393c('0x2c')];_0x2a9570[_0x393c('0x35')]=qs[_0x393c('0x36')](_0x4f124f[_0x393c('0x2d')][_0x393c('0x36')]);_0x2a9570[_0x393c('0x39')]=qs[_0x393c('0x2f')](_[_0x393c('0x37')](_0x4f124f[_0x393c('0x2d')],_0x46c89f[_0x393c('0x2f')]));if(_0x4f124f['query'][_0x393c('0x38')]){_0x2a9570[_0x393c('0x39')]=_['merge'](_0x2a9570['where'],{'$or':_[_0x393c('0x3b')](_0x2a9570[_0x393c('0x31')],function(_0x33619c){var _0x54a21d={};_0x54a21d[_0x33619c]={'$like':'%'+_0x4f124f['query'][_0x393c('0x38')]+'%'};return _0x54a21d;})});}_0x2a9570=_['merge']({},_0x2a9570,_0x4f124f[_0x393c('0x3d')]);return _0xd31508[_0x393c('0x4b')](_0x2a9570);}})['then'](function(_0x936d6a){if(_0x936d6a){_0x1c9c91=_0x936d6a['length'];if(!_0x4f124f[_0x393c('0x2d')][_0x393c('0x34')](_0x393c('0x4d'))){_0x2a9570['limit']=qs[_0x393c('0x1d')](_0x4f124f[_0x393c('0x2d')]['limit']);_0x2a9570['offset']=qs['offset'](_0x4f124f['query'][_0x393c('0x1f')]);}return _0xd31508['getConfigurations'](_0x2a9570);}})[_0x393c('0x25')](function(_0x419830){if(_0x419830){return _0x419830?{'count':_0x1c9c91,'rows':_0x419830}:null;}})[_0x393c('0x25')](respondWithResult(_0x59ee98,null))['catch'](handleError(_0x59ee98,null));};exports[_0x393c('0x4e')]=function(_0x57964a,_0x3f8729,_0x5565af){if(_0x57964a['body']['id']){delete _0x57964a[_0x393c('0x48')]['id'];}return db[_0x393c('0x40')][_0x393c('0x4f')]({'where':{'id':_0x57964a[_0x393c('0x45')]['id']}})[_0x393c('0x25')](handleEntityNotFound(_0x3f8729,null))[_0x393c('0x25')](function(_0x21436c){if(_0x21436c){_0x57964a[_0x393c('0x48')][_0x393c('0x50')]=_0x21436c['id'];_0x57964a['body'][_0x393c('0x51')]=integrations[_0x393c('0x52')](_0x57964a[_0x393c('0x48')][_0x393c('0x53')],_0x57964a[_0x393c('0x48')][_0x393c('0x2a')]);_0x57964a[_0x393c('0x48')]['Descriptions']=integrations[_0x393c('0x54')](_0x57964a['body'][_0x393c('0x53')],_0x57964a[_0x393c('0x48')][_0x393c('0x2a')]);return db[_0x393c('0x4c')][_0x393c('0x47')](_0x57964a['body'],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x393c('0x55')],'as':_0x393c('0x56')}]});}return null;})[_0x393c('0x25')](respondWithResult(_0x3f8729,null))[_0x393c('0x43')](handleError(_0x3f8729,null));};exports[_0x393c('0x57')]=function(_0x4a4d33,_0x26862f,_0x4ed3dd){var _0x4dc6b9=['made_sla',_0x393c('0x58'),_0x393c('0x59'),_0x393c('0x5a'),'close_code',_0x393c('0x5b'),_0x393c('0x5c'),_0x393c('0x5d'),'category'];var _0x359bee=[_0x393c('0x5e'),_0x393c('0x5f'),_0x393c('0x60'),_0x393c('0x61'),_0x393c('0x62'),_0x393c('0x63'),_0x393c('0x64'),_0x393c('0x58'),_0x393c('0x65'),'number',_0x393c('0x66'),'sys_updated_by',_0x393c('0x67'),_0x393c('0x68'),'sys_created_on',_0x393c('0x69'),_0x393c('0x6a'),_0x393c('0x6b'),_0x393c('0x59'),_0x393c('0x35'),_0x393c('0x6c'),_0x393c('0x6d'),_0x393c('0x6e'),_0x393c('0x6f'),_0x393c('0x70'),'active',_0x393c('0x71'),_0x393c('0x72'),_0x393c('0x73'),_0x393c('0x74'),_0x393c('0x75'),_0x393c('0x76'),_0x393c('0x77'),'opened_at',_0x393c('0x78'),_0x393c('0x79'),'work_end','reopened_time','resolved_at','caller_id','approval_set',_0x393c('0x5a'),'work_notes',_0x393c('0x7a'),_0x393c('0x7b'),_0x393c('0x7c'),_0x393c('0x7d'),'work_start','assignment_group',_0x393c('0x7e'),_0x393c('0x7f'),_0x393c('0x80'),'calendar_duration',_0x393c('0x5b'),_0x393c('0x81'),_0x393c('0x82'),_0x393c('0x83'),_0x393c('0x84'),_0x393c('0x85'),'sys_id',_0x393c('0x86'),_0x393c('0x87'),_0x393c('0x5c'),_0x393c('0x88'),_0x393c('0x89'),_0x393c('0x8a'),_0x393c('0x8b'),_0x393c('0x8c'),_0x393c('0x8d'),_0x393c('0x5d'),_0x393c('0x8e'),_0x393c('0x8f'),_0x393c('0x90'),'comments_and_work_notes',_0x393c('0x91'),_0x393c('0x92'),_0x393c('0x93'),_0x393c('0x94'),_0x393c('0x95'),_0x393c('0x96'),_0x393c('0x97'),_0x393c('0x98'),_0x393c('0x99')];var _0x399508='';var _0x135815='';var _0xed44cb=[];var _0x30c106='';var _0x36b604='';var _0x1a3607=[];var _0x5a3685='';var _0x224863='';var _0x9a52c0={};var _0x189488='';return db[_0x393c('0x40')]['findOne']({'where':{'id':_0x4a4d33[_0x393c('0x45')]['id']},'attributes':['id',_0x393c('0x9a'),_0x393c('0x9b'),'email',_0x393c('0x9c'),_0x393c('0x9d')]})[_0x393c('0x25')](handleEntityNotFound(_0x26862f,null))[_0x393c('0x25')](function(_0x152439){if(_0x152439){_0x189488=_0x152439['remoteUri'];var _0x4ad9e4=_0x189488[_0x393c('0x9e')](-0x1);if(_0x4ad9e4==='/'){_0x189488=_0x189488[_0x393c('0x9f')](0x0,_0x189488[_0x393c('0xa0')](_0x4ad9e4));}_0x224863=util['format'](_0x393c('0xa1'),_0x189488);_0x5a3685=util[_0x393c('0xa2')]('%s/api/now/table/',_0x189488);_0x9a52c0={'user':_0x152439['username'],'pass':_0x152439[_0x393c('0x9b')]};var _0x433524={'method':_0x393c('0xa3'),'uri':_0x224863+_0x393c('0xa4'),'auth':_0x9a52c0,'json':!![]};return rp(_0x433524);}})[_0x393c('0x25')](function(_0x24981f){if(_0x24981f[_0x393c('0xa5')][_0x393c('0x33')]>0x0){_0x399508=_0x24981f[_0x393c('0xa5')];}console[_0x393c('0xa6')](_0x393c('0xa7'),_0x399508);_0x1a3607=[];_0x135815=Object[_0x393c('0xa8')]([],_0x399508);_[_0x393c('0xa9')](_0x135815,function(_0x55d5c3){return!_0x4dc6b9[_0x393c('0xaa')](_0x55d5c3[_0x393c('0x26')]);});_0x135815[_0x393c('0xab')](function(_0x4f0e96){var _0x3bdd8a=createFieldObject(_0x5a3685,_0x9a52c0,_0x4f0e96[_0x393c('0xac')],_0x4f0e96[_0x393c('0x26')],_0x4f0e96['label'],![]);_0x1a3607[_0x393c('0xad')](_0x3bdd8a);});return Promise[_0x393c('0xae')](_0x1a3607);})[_0x393c('0x25')](function(_0x34b811){_0xed44cb=_0x34b811;_0x30c106=Object[_0x393c('0xa8')]([],_0x399508);console[_0x393c('0xa6')](_0x393c('0xaf'),_0x399508);_[_0x393c('0xa9')](_0x30c106,function(_0x43c5a5){return _0x359bee[_0x393c('0xaa')](_0x43c5a5[_0x393c('0x26')]);});console[_0x393c('0xa6')](_0x393c('0xb0'),_0x30c106);_0x1a3607=[];_0x30c106[_0x393c('0xab')](function(_0x48e7e4){var _0x100841=createFieldObject(_0x5a3685,_0x9a52c0,_0x48e7e4[_0x393c('0xac')],_0x48e7e4[_0x393c('0x26')],_0x48e7e4[_0x393c('0xb1')],!![]);_0x1a3607[_0x393c('0xad')](_0x100841);});return Promise['all'](_0x1a3607);})[_0x393c('0x25')](function(_0x5bad8b){_0x36b604=_0x5bad8b;var _0xa4563d=_0xed44cb['concat'](_0x36b604);return{'count':_0xa4563d[_0x393c('0x33')],'rows':_0xa4563d};})[_0x393c('0x25')](respondWithResult(_0x26862f,null))[_0x393c('0x43')](function(_0x284c44){console[_0x393c('0xa6')](_0x393c('0xb2')+_0x284c44);var _0x3b29f8=_0x4a4d33['query'][_0x393c('0xb3')]?0x1f4:_0x284c44['statusCode']||0x1f4;logger[_0x393c('0xb4')](_0x284c44[_0x393c('0xb5')]);delete _0x284c44[_0x393c('0x26')];if(_0x3b29f8===0x191){_0x3b29f8=0x190;}_0x26862f[_0x393c('0x19')](_0x3b29f8)[_0x393c('0x27')](_0x4a4d33[_0x393c('0x2d')]['test']?{'message':_0x393c('0xb6'),'statusCode':_0x284c44[_0x393c('0xb7')]}:_0x284c44);});};function createFieldObject(_0x4c0baa,_0x4f60f1,_0x12a9fb,_0x53b9ab,_0x2306a3,_0x45c2fc){return new Promise(function(_0x220379,_0x41f9da){var _0x294bfc={'id':_0x53b9ab,'name':_0x2306a3,'custom':_0x45c2fc};if(_0x12a9fb===_0x393c('0xb8')){_0x294bfc[_0x393c('0x3d')]=[{'name':'True','value':_0x393c('0xb9')},{'name':'False','value':'false'}];_0x220379(_0x294bfc);}else{var _0x21d0fb={'method':_0x393c('0xa3'),'uri':_0x4c0baa+_0x393c('0xba')+_0x53b9ab,'auth':_0x4f60f1,'json':!![]};return rp(_0x21d0fb)['then'](function(_0x1bab79){var _0x1590ba=[];if(_0x1bab79[_0x393c('0xa5')][_0x393c('0x33')]>0x0){_0x1bab79['result']['forEach'](function(_0x19a1f8){if(_0x19a1f8[_0x393c('0xbb')]===_0x393c('0xbc')){var _0x116391={'name':_0x19a1f8[_0x393c('0xb1')],'value':_0x19a1f8[_0x393c('0xbd')]};_0x1590ba[_0x393c('0xad')](_0x116391);}});}_0x294bfc[_0x393c('0x3d')]=_0x1590ba;if(_0x294bfc[_0x393c('0x3d')]['length']>0x0){_0x220379(_0x294bfc);}else{if(_0x45c2fc==![]){_0x220379();}else{_0x220379(_0x294bfc);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index aca222e..004a872 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 _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x58f763,_0x2d9fd3){var _0x1cdeb3=function(_0x501f22){while(--_0x501f22){_0x58f763['push'](_0x58f763['shift']());}};_0x1cdeb3(++_0x2d9fd3);}(_0x687b,0x14a));var _0xb687=function(_0x4f140e,_0x574bee){_0x4f140e=_0x4f140e-0x0;var _0x357343=_0x687b[_0x4f140e];return _0x357343;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x8d68ce,_0x135a7f){var _0x2e1f64=function(_0x1e8aed){while(--_0x1e8aed){_0x8d68ce['push'](_0x8d68ce['shift']());}};_0x2e1f64(++_0x135a7f);}(_0x1883,0xab));var _0x3188=function(_0x65589e,_0x5a5205){_0x65589e=_0x65589e-0x0;var _0x52aec8=_0x1883[_0x65589e];return _0x52aec8;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index b8709f3..5d3d90f 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 _0x4c81=['raw','where','attributes','limit','include','map','model','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4c81,0x194));var _0x14c8=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4c81[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x14c8('0x0'));var util=require(_0x14c8('0x1'));var moment=require(_0x14c8('0x2'));var BPromise=require(_0x14c8('0x3'));var rs=require(_0x14c8('0x4'));var fs=require('fs');var Redis=require(_0x14c8('0x5'));var db=require(_0x14c8('0x6'))['db'];var utils=require(_0x14c8('0x7'));var logger=require(_0x14c8('0x8'))(_0x14c8('0x9'));var config=require('../../config/environment');var jayson=require(_0x14c8('0xa'));var client=jayson[_0x14c8('0xb')][_0x14c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fa895,_0x480ceb,_0x2475ec){return new BPromise(function(_0x4fe9f5,_0x24d97f){return client['request'](_0x2fa895,_0x2475ec)[_0x14c8('0xd')](function(_0x25c8b4){logger[_0x14c8('0xe')](_0x14c8('0xf'),_0x480ceb,_0x14c8('0x10'));logger[_0x14c8('0x11')](_0x14c8('0x12'),_0x480ceb,_0x14c8('0x10'),JSON[_0x14c8('0x13')](_0x25c8b4));if(_0x25c8b4[_0x14c8('0x14')]){if(_0x25c8b4['error'][_0x14c8('0x15')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x480ceb,_0x25c8b4[_0x14c8('0x14')]['message']);return _0x24d97f(_0x25c8b4['error']['message']);}logger[_0x14c8('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x480ceb,_0x25c8b4[_0x14c8('0x14')][_0x14c8('0x16')]);return _0x4fe9f5(_0x25c8b4[_0x14c8('0x14')][_0x14c8('0x16')]);}else{logger[_0x14c8('0xe')](_0x14c8('0xf'),_0x480ceb,_0x14c8('0x10'));_0x4fe9f5(_0x25c8b4['result'][_0x14c8('0x16')]);}})[_0x14c8('0x17')](function(_0x2743b6){logger['error'](_0x14c8('0xf'),_0x480ceb,_0x2743b6);_0x24d97f(_0x2743b6);});});}exports[_0x14c8('0x18')]=function(_0x520c54){var _0x241de7=this;return new Promise(function(_0x38e7a1,_0x261325){return db[_0x14c8('0x19')][_0x14c8('0x1a')]({'raw':_0x520c54[_0x14c8('0x1b')]?_0x520c54[_0x14c8('0x1b')][_0x14c8('0x1c')]===undefined?!![]:![]:!![],'where':_0x520c54['options']?_0x520c54[_0x14c8('0x1b')][_0x14c8('0x1d')]||null:null,'attributes':_0x520c54[_0x14c8('0x1b')]?_0x520c54[_0x14c8('0x1b')][_0x14c8('0x1e')]||null:null,'limit':_0x520c54['options']?_0x520c54['options'][_0x14c8('0x1f')]||null:null,'include':_0x520c54[_0x14c8('0x1b')]?_0x520c54['options'][_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x520c54[_0x14c8('0x1b')]['include'],function(_0x18f334){return{'model':db[_0x18f334['model']],'as':_0x18f334['as'],'attributes':_0x18f334[_0x14c8('0x1e')],'include':_0x18f334[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x18f334['include'],function(_0x4e69f0){return{'model':db[_0x4e69f0[_0x14c8('0x22')]],'as':_0x4e69f0['as'],'attributes':_0x4e69f0['attributes'],'include':_0x4e69f0[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x4e69f0[_0x14c8('0x20')],function(_0x1e0b1a){return{'model':db[_0x1e0b1a[_0x14c8('0x22')]],'as':_0x1e0b1a['as'],'attributes':_0x1e0b1a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x221367){logger[_0x14c8('0xe')](_0x14c8('0x18'),_0x520c54);logger['debug'](_0x14c8('0x18'),_0x520c54,JSON[_0x14c8('0x13')](_0x221367));_0x38e7a1(_0x221367);})[_0x14c8('0x17')](function(_0x5d78fe){logger[_0x14c8('0x14')](_0x14c8('0x18'),_0x5d78fe[_0x14c8('0x16')],_0x520c54);_0x261325(_0x241de7[_0x14c8('0x14')](0x1f4,_0x5d78fe[_0x14c8('0x16')]));});});};exports[_0x14c8('0x23')]=function(_0x58eb8f){var _0x24239b=this;return new Promise(function(_0x14b1ef,_0x35f88a){return db[_0x14c8('0x19')]['find']({'raw':_0x58eb8f[_0x14c8('0x1b')]?_0x58eb8f[_0x14c8('0x1b')][_0x14c8('0x1c')]===undefined?!![]:![]:!![],'where':_0x58eb8f['options']?_0x58eb8f[_0x14c8('0x1b')]['where']||null:null,'attributes':_0x58eb8f[_0x14c8('0x1b')]?_0x58eb8f[_0x14c8('0x1b')][_0x14c8('0x1e')]||null:null,'include':_0x58eb8f[_0x14c8('0x1b')]?_0x58eb8f['options'][_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x58eb8f[_0x14c8('0x1b')][_0x14c8('0x20')],function(_0x207854){return{'model':db[_0x207854[_0x14c8('0x22')]],'as':_0x207854['as'],'attributes':_0x207854[_0x14c8('0x1e')],'include':_0x207854[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x207854[_0x14c8('0x20')],function(_0x6279c4){return{'model':db[_0x6279c4[_0x14c8('0x22')]],'as':_0x6279c4['as'],'attributes':_0x6279c4['attributes'],'include':_0x6279c4[_0x14c8('0x20')]?_[_0x14c8('0x21')](_0x6279c4[_0x14c8('0x20')],function(_0x25b0c2){return{'model':db[_0x25b0c2[_0x14c8('0x22')]],'as':_0x25b0c2['as'],'attributes':_0x25b0c2[_0x14c8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14c8('0xd')](function(_0x4b4f03){logger['info'](_0x14c8('0x23'),_0x58eb8f);logger[_0x14c8('0x11')]('ShowServicenowAccount',_0x58eb8f,JSON[_0x14c8('0x13')](_0x4b4f03));_0x14b1ef(_0x4b4f03);})['catch'](function(_0x5f2233){logger[_0x14c8('0x14')](_0x14c8('0x23'),_0x5f2233[_0x14c8('0x16')],_0x58eb8f);_0x35f88a(_0x24239b[_0x14c8('0x14')](0x1f4,_0x5f2233[_0x14c8('0x16')]));});});}; \ No newline at end of file +var _0x2243=['options','raw','attributes','limit','map','include','model','catch','ShowServicenowAccount','find','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount'];(function(_0x1bc089,_0x5ab38){var _0x5382be=function(_0x5e5062){while(--_0x5e5062){_0x1bc089['push'](_0x1bc089['shift']());}};_0x5382be(++_0x5ab38);}(_0x2243,0xb4));var _0x3224=function(_0x12a8af,_0x340805){_0x12a8af=_0x12a8af-0x0;var _0x247600=_0x2243[_0x12a8af];return _0x247600;};'use strict';var _=require(_0x3224('0x0'));var util=require(_0x3224('0x1'));var moment=require('moment');var BPromise=require(_0x3224('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3224('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3224('0x4'));var logger=require(_0x3224('0x5'))(_0x3224('0x6'));var config=require(_0x3224('0x7'));var jayson=require(_0x3224('0x8'));var client=jayson[_0x3224('0x9')][_0x3224('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59f0ca,_0x359c11,_0x9acb55){return new BPromise(function(_0x5c7ce1,_0x522422){return client[_0x3224('0xb')](_0x59f0ca,_0x9acb55)[_0x3224('0xc')](function(_0x129a9c){logger[_0x3224('0xd')](_0x3224('0xe'),_0x359c11,_0x3224('0xf'));logger['debug'](_0x3224('0x10'),_0x359c11,_0x3224('0xf'),JSON[_0x3224('0x11')](_0x129a9c));if(_0x129a9c['error']){if(_0x129a9c[_0x3224('0x12')][_0x3224('0x13')]===0x1f4){logger[_0x3224('0x12')](_0x3224('0xe'),_0x359c11,_0x129a9c[_0x3224('0x12')]['message']);return _0x522422(_0x129a9c['error'][_0x3224('0x14')]);}logger[_0x3224('0x12')](_0x3224('0xe'),_0x359c11,_0x129a9c[_0x3224('0x12')][_0x3224('0x14')]);return _0x5c7ce1(_0x129a9c[_0x3224('0x12')]['message']);}else{logger['info'](_0x3224('0xe'),_0x359c11,'request\x20sent');_0x5c7ce1(_0x129a9c[_0x3224('0x15')][_0x3224('0x14')]);}})['catch'](function(_0x1ef553){logger[_0x3224('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x359c11,_0x1ef553);_0x522422(_0x1ef553);});});}exports[_0x3224('0x16')]=function(_0xd14073){var _0x133915=this;return new Promise(function(_0x1ee9be,_0x1ff9a6){return db[_0x3224('0x17')]['findAll']({'raw':_0xd14073[_0x3224('0x18')]?_0xd14073[_0x3224('0x18')][_0x3224('0x19')]===undefined?!![]:![]:!![],'where':_0xd14073['options']?_0xd14073[_0x3224('0x18')]['where']||null:null,'attributes':_0xd14073[_0x3224('0x18')]?_0xd14073[_0x3224('0x18')][_0x3224('0x1a')]||null:null,'limit':_0xd14073[_0x3224('0x18')]?_0xd14073[_0x3224('0x18')][_0x3224('0x1b')]||null:null,'include':_0xd14073[_0x3224('0x18')]?_0xd14073[_0x3224('0x18')]['include']?_[_0x3224('0x1c')](_0xd14073[_0x3224('0x18')][_0x3224('0x1d')],function(_0x3f0429){return{'model':db[_0x3f0429[_0x3224('0x1e')]],'as':_0x3f0429['as'],'attributes':_0x3f0429[_0x3224('0x1a')],'include':_0x3f0429['include']?_[_0x3224('0x1c')](_0x3f0429['include'],function(_0x4ea4b3){return{'model':db[_0x4ea4b3[_0x3224('0x1e')]],'as':_0x4ea4b3['as'],'attributes':_0x4ea4b3[_0x3224('0x1a')],'include':_0x4ea4b3[_0x3224('0x1d')]?_['map'](_0x4ea4b3[_0x3224('0x1d')],function(_0x47ab94){return{'model':db[_0x47ab94[_0x3224('0x1e')]],'as':_0x47ab94['as'],'attributes':_0x47ab94[_0x3224('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3224('0xc')](function(_0x3f34ef){logger[_0x3224('0xd')](_0x3224('0x16'),_0xd14073);logger['debug']('GetServicenowAccount',_0xd14073,JSON['stringify'](_0x3f34ef));_0x1ee9be(_0x3f34ef);})[_0x3224('0x1f')](function(_0x52bd62){logger[_0x3224('0x12')](_0x3224('0x16'),_0x52bd62['message'],_0xd14073);_0x1ff9a6(_0x133915[_0x3224('0x12')](0x1f4,_0x52bd62[_0x3224('0x14')]));});});};exports[_0x3224('0x20')]=function(_0x10c8f0){var _0x4c135e=this;return new Promise(function(_0x2838e6,_0x4f44fb){return db[_0x3224('0x17')][_0x3224('0x21')]({'raw':_0x10c8f0[_0x3224('0x18')]?_0x10c8f0[_0x3224('0x18')][_0x3224('0x19')]===undefined?!![]:![]:!![],'where':_0x10c8f0['options']?_0x10c8f0[_0x3224('0x18')]['where']||null:null,'attributes':_0x10c8f0['options']?_0x10c8f0[_0x3224('0x18')]['attributes']||null:null,'include':_0x10c8f0[_0x3224('0x18')]?_0x10c8f0['options'][_0x3224('0x1d')]?_[_0x3224('0x1c')](_0x10c8f0[_0x3224('0x18')][_0x3224('0x1d')],function(_0x4ee4c9){return{'model':db[_0x4ee4c9['model']],'as':_0x4ee4c9['as'],'attributes':_0x4ee4c9[_0x3224('0x1a')],'include':_0x4ee4c9['include']?_[_0x3224('0x1c')](_0x4ee4c9[_0x3224('0x1d')],function(_0x8afb11){return{'model':db[_0x8afb11[_0x3224('0x1e')]],'as':_0x8afb11['as'],'attributes':_0x8afb11[_0x3224('0x1a')],'include':_0x8afb11[_0x3224('0x1d')]?_[_0x3224('0x1c')](_0x8afb11['include'],function(_0x1a2486){return{'model':db[_0x1a2486[_0x3224('0x1e')]],'as':_0x1a2486['as'],'attributes':_0x1a2486[_0x3224('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3224('0xc')](function(_0x1f7b82){logger['info'](_0x3224('0x20'),_0x10c8f0);logger['debug'](_0x3224('0x20'),_0x10c8f0,JSON[_0x3224('0x11')](_0x1f7b82));_0x2838e6(_0x1f7b82);})['catch'](function(_0x48d151){logger['error'](_0x3224('0x20'),_0x48d151[_0x3224('0x14')],_0x10c8f0);_0x4f44fb(_0x4c135e[_0x3224('0x12')](0x1f4,_0x48d151[_0x3224('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8a3e0f7..21c54e5 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 _0x9bb3=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x9bb3,0x104));var _0x39bb=function(_0x2283a5,_0xed8ae6){_0x2283a5=_0x2283a5-0x0;var _0x1b7eb2=_0x9bb3[_0x2283a5];return _0x1b7eb2;};'use strict';var multer=require(_0x39bb('0x0'));var util=require('util');var path=require(_0x39bb('0x1'));var timeout=require(_0x39bb('0x2'));var express=require(_0x39bb('0x3'));var router=express[_0x39bb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x39bb('0x5'));var config=require(_0x39bb('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x39bb('0x7')]('/',auth[_0x39bb('0x8')](),controller[_0x39bb('0x9')]);router[_0x39bb('0x7')](_0x39bb('0xa'),auth[_0x39bb('0x8')](),controller[_0x39bb('0xb')]);router[_0x39bb('0x7')](_0x39bb('0xc'),auth[_0x39bb('0x8')](),controller[_0x39bb('0xd')]);router[_0x39bb('0x7')]('/:id/subjects',auth[_0x39bb('0x8')](),controller['getSubjects']);router[_0x39bb('0x7')](_0x39bb('0xe'),auth[_0x39bb('0x8')](),controller[_0x39bb('0xf')]);router[_0x39bb('0x10')]('/',auth[_0x39bb('0x8')](),controller[_0x39bb('0x11')]);router['put']('/:id',auth[_0x39bb('0x8')](),controller[_0x39bb('0x12')]);router[_0x39bb('0x13')](_0x39bb('0xa'),auth['isAuthenticated'](),controller[_0x39bb('0x14')]);module[_0x39bb('0x15')]=router; \ No newline at end of file +var _0x4a2a=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x4a2a,0x15e));var _0xa4a2=function(_0x592f31,_0x421448){_0x592f31=_0x592f31-0x0;var _0x5b5653=_0x4a2a[_0x592f31];return _0x5b5653;};'use strict';var multer=require(_0xa4a2('0x0'));var util=require('util');var path=require(_0xa4a2('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4a2('0x2'));var router=express[_0xa4a2('0x3')]();var fs_extra=require(_0xa4a2('0x4'));var auth=require(_0xa4a2('0x5'));var interaction=require(_0xa4a2('0x6'));var config=require(_0xa4a2('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xa4a2('0x8')]('/',auth[_0xa4a2('0x9')](),controller[_0xa4a2('0xa')]);router[_0xa4a2('0x8')](_0xa4a2('0xb'),auth['isAuthenticated'](),controller[_0xa4a2('0xc')]);router['get'](_0xa4a2('0xd'),auth[_0xa4a2('0x9')](),controller[_0xa4a2('0xe')]);router[_0xa4a2('0x8')](_0xa4a2('0xf'),auth[_0xa4a2('0x9')](),controller[_0xa4a2('0x10')]);router['get'](_0xa4a2('0x11'),auth[_0xa4a2('0x9')](),controller[_0xa4a2('0x12')]);router[_0xa4a2('0x13')]('/',auth[_0xa4a2('0x9')](),controller[_0xa4a2('0x14')]);router[_0xa4a2('0x15')](_0xa4a2('0xb'),auth[_0xa4a2('0x9')](),controller[_0xa4a2('0x16')]);router[_0xa4a2('0x17')]('/:id',auth[_0xa4a2('0x9')](),controller[_0xa4a2('0x18')]);module[_0xa4a2('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 787c686..c425720 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 _0x38e7=['STRING','sequelize','exports'];(function(_0x31b47c,_0x58181a){var _0x294e7f=function(_0x4733fa){while(--_0x4733fa){_0x31b47c['push'](_0x31b47c['shift']());}};_0x294e7f(++_0x58181a);}(_0x38e7,0xf7));var _0x738e=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x38e7[_0xbc1a4b];return _0x108b87;};'use strict';var Sequelize=require(_0x738e('0x0'));module[_0x738e('0x1')]={'name':{'type':Sequelize[_0x738e('0x2')]},'description':{'type':Sequelize[_0x738e('0x2')]}}; \ No newline at end of file +var _0xa106=['sequelize','STRING'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa106,0x198));var _0x6a10=function(_0x2460d9,_0x15da87){_0x2460d9=_0x2460d9-0x0;var _0x4bc204=_0xa106[_0x2460d9];return _0x4bc204;};'use strict';var Sequelize=require(_0x6a10('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a10('0x1')]},'description':{'type':Sequelize[_0x6a10('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index fcb325a..b7b677b 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 _0xc18d=['reject','save','then','destroy','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','key','map','query','keys','filters','model','intersection','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','fields','includeAll','create','body','catch','update','find','params','getFields','ServicenowField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x400b64,_0x5eb1bf){var _0x1d615d=function(_0x57e8ac){while(--_0x57e8ac){_0x400b64['push'](_0x400b64['shift']());}};_0x1d615d(++_0x5eb1bf);}(_0xc18d,0x1c8));var _0xdc18=function(_0x26c5b1,_0x3e70fc){_0x26c5b1=_0x26c5b1-0x0;var _0x819386=_0xc18d[_0x26c5b1];return _0x819386;};'use strict';var emlformat=require(_0xdc18('0x0'));var rimraf=require(_0xdc18('0x1'));var zipdir=require(_0xdc18('0x2'));var jsonpatch=require(_0xdc18('0x3'));var rp=require(_0xdc18('0x4'));var moment=require(_0xdc18('0x5'));var BPromise=require(_0xdc18('0x6'));var Mustache=require(_0xdc18('0x7'));var util=require(_0xdc18('0x8'));var path=require(_0xdc18('0x9'));var sox=require('sox');var csv=require(_0xdc18('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc18('0xb'));var _=require(_0xdc18('0xc'));var squel=require(_0xdc18('0xd'));var crypto=require(_0xdc18('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdc18('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdc18('0x10'));var Papa=require('papaparse');var Redis=require(_0xdc18('0x11'));var authService=require(_0xdc18('0x12'));var qs=require(_0xdc18('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc18('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xdc18('0x15'));var config=require(_0xdc18('0x16'));var licenseUtil=require(_0xdc18('0x17'));var db=require(_0xdc18('0x18'))['db'];function respondWithStatusCode(_0x2300ac,_0x9ee4){_0x9ee4=_0x9ee4||0xcc;return function(_0x59c7b1){if(_0x59c7b1){return _0x2300ac[_0xdc18('0x19')](_0x9ee4);}return _0x2300ac[_0xdc18('0x1a')](_0x9ee4)[_0xdc18('0x1b')]();};}function respondWithResult(_0x4d3c5e,_0xb1af3){_0xb1af3=_0xb1af3||0xc8;return function(_0x1e4eb0){if(_0x1e4eb0){return _0x4d3c5e['status'](_0xb1af3)[_0xdc18('0x1c')](_0x1e4eb0);}};}function respondWithFilteredResult(_0x23e8a7,_0x56b18f){return function(_0x38fc07){if(_0x38fc07){var _0x506895=typeof _0x56b18f[_0xdc18('0x1d')]===_0xdc18('0x1e')&&typeof _0x56b18f['limit']==='undefined';var _0x9a28f8=_0x38fc07[_0xdc18('0x1f')];var _0x502af9=_0x506895?0x0:_0x56b18f[_0xdc18('0x1d')];var _0x5ba064=_0x506895?_0x38fc07[_0xdc18('0x1f')]:_0x56b18f[_0xdc18('0x1d')]+_0x56b18f[_0xdc18('0x20')];var _0x1f1ade;if(_0x5ba064>=_0x9a28f8){_0x5ba064=_0x9a28f8;_0x1f1ade=0xc8;}else{_0x1f1ade=0xce;}_0x23e8a7[_0xdc18('0x1a')](_0x1f1ade);return _0x23e8a7[_0xdc18('0x21')](_0xdc18('0x22'),_0x502af9+'-'+_0x5ba064+'/'+_0x9a28f8)[_0xdc18('0x1c')](_0x38fc07);}return null;};}function patchUpdates(_0xe8d94a){return function(_0x582563){try{jsonpatch[_0xdc18('0x23')](_0x582563,_0xe8d94a,!![]);}catch(_0x1119b6){return BPromise[_0xdc18('0x24')](_0x1119b6);}return _0x582563[_0xdc18('0x25')]();};}function saveUpdates(_0x481514,_0x5f4a9c){return function(_0x3205bb){if(_0x3205bb){return _0x3205bb['update'](_0x481514)[_0xdc18('0x26')](function(_0x1ac1d9){return _0x1ac1d9;});}return null;};}function removeEntity(_0x29c4da,_0x5816cd){return function(_0x36f22a){if(_0x36f22a){return _0x36f22a[_0xdc18('0x27')]()[_0xdc18('0x26')](function(){_0x29c4da['status'](0xcc)[_0xdc18('0x1b')]();});}};}function handleEntityNotFound(_0x5acfb2,_0xe5b326){return function(_0x39a4af){if(!_0x39a4af){_0x5acfb2[_0xdc18('0x19')](0x194);}return _0x39a4af;};}function handleError(_0x2a86a5,_0x43e6f6){_0x43e6f6=_0x43e6f6||0x1f4;return function(_0x4270ea){logger['error'](_0x4270ea[_0xdc18('0x28')]);if(_0x4270ea[_0xdc18('0x29')]){delete _0x4270ea[_0xdc18('0x29')];}_0x2a86a5[_0xdc18('0x1a')](_0x43e6f6)[_0xdc18('0x2a')](_0x4270ea);};}exports['index']=function(_0x409003,_0x5d926c){var _0x59362b={},_0x33ff16={},_0x3a139f={'count':0x0,'rows':[]};var _0x348b55=_['map'](db[_0xdc18('0x2b')][_0xdc18('0x2c')],function(_0x33edbe){return{'name':_0x33edbe[_0xdc18('0x2d')],'type':_0x33edbe['type'][_0xdc18('0x2e')]};});_0x33ff16['model']=_[_0xdc18('0x2f')](_0x348b55,_0xdc18('0x29'));_0x33ff16[_0xdc18('0x30')]=_[_0xdc18('0x31')](_0x409003['query']);_0x33ff16[_0xdc18('0x32')]=_['intersection'](_0x33ff16[_0xdc18('0x33')],_0x33ff16[_0xdc18('0x30')]);_0x59362b['attributes']=_[_0xdc18('0x34')](_0x33ff16[_0xdc18('0x33')],qs['fields'](_0x409003['query']['fields']));_0x59362b['attributes']=_0x59362b['attributes'][_0xdc18('0x35')]?_0x59362b[_0xdc18('0x36')]:_0x33ff16[_0xdc18('0x33')];if(!_0x409003[_0xdc18('0x30')][_0xdc18('0x37')](_0xdc18('0x38'))){_0x59362b[_0xdc18('0x20')]=qs[_0xdc18('0x20')](_0x409003['query'][_0xdc18('0x20')]);_0x59362b[_0xdc18('0x1d')]=qs[_0xdc18('0x1d')](_0x409003[_0xdc18('0x30')]['offset']);}_0x59362b[_0xdc18('0x39')]=qs['sort'](_0x409003[_0xdc18('0x30')][_0xdc18('0x3a')]);_0x59362b[_0xdc18('0x3b')]=qs[_0xdc18('0x32')](_[_0xdc18('0x3c')](_0x409003['query'],_0x33ff16[_0xdc18('0x32')]),_0x348b55);if(_0x409003[_0xdc18('0x30')][_0xdc18('0x3d')]){_0x59362b['where']=_[_0xdc18('0x3e')](_0x59362b[_0xdc18('0x3b')],{'$or':_[_0xdc18('0x2f')](_0x348b55,function(_0x14fa77){if(_0x14fa77['type']!==_0xdc18('0x3f')){var _0x10982e={};_0x10982e[_0x14fa77['name']]={'$like':'%'+_0x409003[_0xdc18('0x30')][_0xdc18('0x3d')]+'%'};return _0x10982e;}})});}_0x59362b=_[_0xdc18('0x3e')]({},_0x59362b,_0x409003[_0xdc18('0x40')]);var _0x55a7c3={'where':_0x59362b[_0xdc18('0x3b')]};return db[_0xdc18('0x2b')][_0xdc18('0x1f')](_0x55a7c3)[_0xdc18('0x26')](function(_0x324d50){_0x3a139f[_0xdc18('0x1f')]=_0x324d50;if(_0x409003['query']['includeAll']){_0x59362b[_0xdc18('0x41')]=[{'all':!![]}];}return db[_0xdc18('0x2b')][_0xdc18('0x42')](_0x59362b);})[_0xdc18('0x26')](function(_0x288d25){_0x3a139f[_0xdc18('0x43')]=_0x288d25;return _0x3a139f;})[_0xdc18('0x26')](respondWithFilteredResult(_0x5d926c,_0x59362b))['catch'](handleError(_0x5d926c,null));};exports[_0xdc18('0x44')]=function(_0x2b2955,_0x39c9bc){var _0x565b58={'raw':![],'where':{'id':_0x2b2955['params']['id']}},_0x597e6b={};_0x597e6b[_0xdc18('0x33')]=_['keys'](db[_0xdc18('0x2b')][_0xdc18('0x2c')]);_0x597e6b['query']=_[_0xdc18('0x31')](_0x2b2955[_0xdc18('0x30')]);_0x597e6b[_0xdc18('0x32')]=_[_0xdc18('0x34')](_0x597e6b[_0xdc18('0x33')],_0x597e6b[_0xdc18('0x30')]);_0x565b58[_0xdc18('0x36')]=_['intersection'](_0x597e6b[_0xdc18('0x33')],qs[_0xdc18('0x45')](_0x2b2955[_0xdc18('0x30')]['fields']));_0x565b58[_0xdc18('0x36')]=_0x565b58[_0xdc18('0x36')][_0xdc18('0x35')]?_0x565b58[_0xdc18('0x36')]:_0x597e6b[_0xdc18('0x33')];if(_0x2b2955[_0xdc18('0x30')][_0xdc18('0x46')]){_0x565b58['include']=[{'all':!![]}];}_0x565b58=_[_0xdc18('0x3e')]({},_0x565b58,_0x2b2955[_0xdc18('0x40')]);return db[_0xdc18('0x2b')]['find'](_0x565b58)['then'](handleEntityNotFound(_0x39c9bc,null))[_0xdc18('0x26')](respondWithResult(_0x39c9bc,null))['catch'](handleError(_0x39c9bc,null));};exports[_0xdc18('0x47')]=function(_0x33c10b,_0x529f04){return db['ServicenowConfiguration'][_0xdc18('0x47')](_0x33c10b[_0xdc18('0x48')],{})[_0xdc18('0x26')](respondWithResult(_0x529f04,0xc9))[_0xdc18('0x49')](handleError(_0x529f04,null));};exports[_0xdc18('0x4a')]=function(_0x4c9b13,_0x5cba84){if(_0x4c9b13[_0xdc18('0x48')]['id']){delete _0x4c9b13[_0xdc18('0x48')]['id'];}return db[_0xdc18('0x2b')]['find']({'where':{'id':_0x4c9b13['params']['id']}})[_0xdc18('0x26')](handleEntityNotFound(_0x5cba84,null))['then'](saveUpdates(_0x4c9b13[_0xdc18('0x48')],null))[_0xdc18('0x26')](respondWithResult(_0x5cba84,null))['catch'](handleError(_0x5cba84,null));};exports[_0xdc18('0x27')]=function(_0x338650,_0x28c408){return db[_0xdc18('0x2b')][_0xdc18('0x4b')]({'where':{'id':_0x338650[_0xdc18('0x4c')]['id']}})[_0xdc18('0x26')](handleEntityNotFound(_0x28c408,null))[_0xdc18('0x26')](removeEntity(_0x28c408,null))[_0xdc18('0x49')](handleError(_0x28c408,null));};exports[_0xdc18('0x4d')]=function(_0x44eaf6,_0x3368c3,_0x886406){var _0x227bdf={};var _0x434a0f={};var _0xb36829;var _0x506571;return db[_0xdc18('0x2b')]['findOne']({'where':{'id':_0x44eaf6[_0xdc18('0x4c')]['id']}})[_0xdc18('0x26')](handleEntityNotFound(_0x3368c3,null))[_0xdc18('0x26')](function(_0x53e414){if(_0x53e414){_0xb36829=_0x53e414;_0x434a0f['model']=_[_0xdc18('0x31')](db[_0xdc18('0x4e')][_0xdc18('0x2c')]);_0x434a0f[_0xdc18('0x30')]=_[_0xdc18('0x31')](_0x44eaf6['query']);_0x434a0f[_0xdc18('0x32')]=_['intersection'](_0x434a0f['model'],_0x434a0f[_0xdc18('0x30')]);_0x227bdf['attributes']=_[_0xdc18('0x34')](_0x434a0f[_0xdc18('0x33')],qs[_0xdc18('0x45')](_0x44eaf6[_0xdc18('0x30')][_0xdc18('0x45')]));_0x227bdf[_0xdc18('0x36')]=_0x227bdf[_0xdc18('0x36')][_0xdc18('0x35')]?_0x227bdf[_0xdc18('0x36')]:_0x434a0f[_0xdc18('0x33')];_0x227bdf[_0xdc18('0x39')]=qs[_0xdc18('0x3a')](_0x44eaf6[_0xdc18('0x30')]['sort']);_0x227bdf['where']=qs[_0xdc18('0x32')](_[_0xdc18('0x3c')](_0x44eaf6[_0xdc18('0x30')],_0x434a0f[_0xdc18('0x32')]));if(_0x44eaf6[_0xdc18('0x30')]['filter']){_0x227bdf[_0xdc18('0x3b')]=_[_0xdc18('0x3e')](_0x227bdf[_0xdc18('0x3b')],{'$or':_['map'](_0x227bdf[_0xdc18('0x36')],function(_0x1fda7c){var _0x180aec={};_0x180aec[_0x1fda7c]={'$like':'%'+_0x44eaf6['query']['filter']+'%'};return _0x180aec;})});}_0x227bdf=_[_0xdc18('0x3e')]({},_0x227bdf,_0x44eaf6['options']);return _0xb36829[_0xdc18('0x4d')](_0x227bdf);}})[_0xdc18('0x26')](function(_0x13cf24){if(_0x13cf24){_0x506571=_0x13cf24[_0xdc18('0x35')];if(!_0x44eaf6['query'][_0xdc18('0x37')](_0xdc18('0x38'))){_0x227bdf[_0xdc18('0x20')]=qs[_0xdc18('0x20')](_0x44eaf6[_0xdc18('0x30')][_0xdc18('0x20')]);_0x227bdf[_0xdc18('0x1d')]=qs[_0xdc18('0x1d')](_0x44eaf6['query'][_0xdc18('0x1d')]);}return _0xb36829['getFields'](_0x227bdf);}})['then'](function(_0x3089f3){if(_0x3089f3){return _0x3089f3?{'count':_0x506571,'rows':_0x3089f3}:null;}})[_0xdc18('0x26')](respondWithResult(_0x3368c3,null))[_0xdc18('0x49')](handleError(_0x3368c3,null));};exports[_0xdc18('0x4f')]=function(_0x1313ec,_0x4c5d4b,_0x35a3c3){var _0x1534ea={};var _0x4eb3b0={};var _0x920b8;var _0x455d0f;return db['ServicenowConfiguration'][_0xdc18('0x50')]({'where':{'id':_0x1313ec[_0xdc18('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c5d4b,null))[_0xdc18('0x26')](function(_0xbaeee3){if(_0xbaeee3){_0x920b8=_0xbaeee3;_0x4eb3b0[_0xdc18('0x33')]=_[_0xdc18('0x31')](db[_0xdc18('0x4e')]['rawAttributes']);_0x4eb3b0[_0xdc18('0x30')]=_[_0xdc18('0x31')](_0x1313ec[_0xdc18('0x30')]);_0x4eb3b0[_0xdc18('0x32')]=_[_0xdc18('0x34')](_0x4eb3b0['model'],_0x4eb3b0[_0xdc18('0x30')]);_0x1534ea[_0xdc18('0x36')]=_['intersection'](_0x4eb3b0[_0xdc18('0x33')],qs['fields'](_0x1313ec[_0xdc18('0x30')][_0xdc18('0x45')]));_0x1534ea['attributes']=_0x1534ea['attributes'][_0xdc18('0x35')]?_0x1534ea['attributes']:_0x4eb3b0[_0xdc18('0x33')];_0x1534ea[_0xdc18('0x39')]=qs[_0xdc18('0x3a')](_0x1313ec[_0xdc18('0x30')]['sort']);_0x1534ea[_0xdc18('0x3b')]=qs['filters'](_[_0xdc18('0x3c')](_0x1313ec[_0xdc18('0x30')],_0x4eb3b0[_0xdc18('0x32')]));if(_0x1313ec[_0xdc18('0x30')]['filter']){_0x1534ea['where']=_[_0xdc18('0x3e')](_0x1534ea[_0xdc18('0x3b')],{'$or':_[_0xdc18('0x2f')](_0x1534ea[_0xdc18('0x36')],function(_0xc6162a){var _0x2bf587={};_0x2bf587[_0xc6162a]={'$like':'%'+_0x1313ec[_0xdc18('0x30')][_0xdc18('0x3d')]+'%'};return _0x2bf587;})});}_0x1534ea=_[_0xdc18('0x3e')]({},_0x1534ea,_0x1313ec[_0xdc18('0x40')]);return _0x920b8[_0xdc18('0x4f')](_0x1534ea);}})[_0xdc18('0x26')](function(_0x1c76f2){if(_0x1c76f2){_0x455d0f=_0x1c76f2['length'];if(!_0x1313ec[_0xdc18('0x30')][_0xdc18('0x37')](_0xdc18('0x38'))){_0x1534ea[_0xdc18('0x20')]=qs[_0xdc18('0x20')](_0x1313ec[_0xdc18('0x30')][_0xdc18('0x20')]);_0x1534ea[_0xdc18('0x1d')]=qs[_0xdc18('0x1d')](_0x1313ec['query'][_0xdc18('0x1d')]);}return _0x920b8[_0xdc18('0x4f')](_0x1534ea);}})[_0xdc18('0x26')](function(_0x87b89c){if(_0x87b89c){return _0x87b89c?{'count':_0x455d0f,'rows':_0x87b89c}:null;}})[_0xdc18('0x26')](respondWithResult(_0x4c5d4b,null))[_0xdc18('0x49')](handleError(_0x4c5d4b,null));};exports[_0xdc18('0x51')]=function(_0x314d6c,_0x49aaae,_0x2075f1){var _0x3004b4={};var _0x4d2ae9={};var _0x3cd8a6;var _0x1b339c;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x314d6c[_0xdc18('0x4c')]['id']}})[_0xdc18('0x26')](handleEntityNotFound(_0x49aaae,null))[_0xdc18('0x26')](function(_0x14dbc0){if(_0x14dbc0){_0x3cd8a6=_0x14dbc0;_0x4d2ae9['model']=_[_0xdc18('0x31')](db[_0xdc18('0x4e')][_0xdc18('0x2c')]);_0x4d2ae9[_0xdc18('0x30')]=_[_0xdc18('0x31')](_0x314d6c[_0xdc18('0x30')]);_0x4d2ae9[_0xdc18('0x32')]=_[_0xdc18('0x34')](_0x4d2ae9[_0xdc18('0x33')],_0x4d2ae9[_0xdc18('0x30')]);_0x3004b4[_0xdc18('0x36')]=_[_0xdc18('0x34')](_0x4d2ae9[_0xdc18('0x33')],qs[_0xdc18('0x45')](_0x314d6c[_0xdc18('0x30')][_0xdc18('0x45')]));_0x3004b4[_0xdc18('0x36')]=_0x3004b4[_0xdc18('0x36')]['length']?_0x3004b4[_0xdc18('0x36')]:_0x4d2ae9['model'];_0x3004b4[_0xdc18('0x39')]=qs[_0xdc18('0x3a')](_0x314d6c[_0xdc18('0x30')][_0xdc18('0x3a')]);_0x3004b4[_0xdc18('0x3b')]=qs['filters'](_[_0xdc18('0x3c')](_0x314d6c[_0xdc18('0x30')],_0x4d2ae9['filters']));if(_0x314d6c[_0xdc18('0x30')]['filter']){_0x3004b4['where']=_[_0xdc18('0x3e')](_0x3004b4['where'],{'$or':_[_0xdc18('0x2f')](_0x3004b4[_0xdc18('0x36')],function(_0x29637b){var _0x43fa62={};_0x43fa62[_0x29637b]={'$like':'%'+_0x314d6c['query'][_0xdc18('0x3d')]+'%'};return _0x43fa62;})});}_0x3004b4=_[_0xdc18('0x3e')]({},_0x3004b4,_0x314d6c[_0xdc18('0x40')]);return _0x3cd8a6[_0xdc18('0x51')](_0x3004b4);}})[_0xdc18('0x26')](function(_0x556ebd){if(_0x556ebd){_0x1b339c=_0x556ebd[_0xdc18('0x35')];if(!_0x314d6c['query']['hasOwnProperty'](_0xdc18('0x38'))){_0x3004b4[_0xdc18('0x20')]=qs[_0xdc18('0x20')](_0x314d6c['query'][_0xdc18('0x20')]);_0x3004b4[_0xdc18('0x1d')]=qs[_0xdc18('0x1d')](_0x314d6c[_0xdc18('0x30')][_0xdc18('0x1d')]);}return _0x3cd8a6['getDescriptions'](_0x3004b4);}})['then'](function(_0x4d2c99){if(_0x4d2c99){return _0x4d2c99?{'count':_0x1b339c,'rows':_0x4d2c99}:null;}})[_0xdc18('0x26')](respondWithResult(_0x49aaae,null))['catch'](handleError(_0x49aaae,null));}; \ No newline at end of file +var _0xb370=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','rows','catch','show','find','create','body','params','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x2ed4e2,_0x4578e9){var _0x41bf38=function(_0x410c78){while(--_0x410c78){_0x2ed4e2['push'](_0x2ed4e2['shift']());}};_0x41bf38(++_0x4578e9);}(_0xb370,0x1c4));var _0x0b37=function(_0x2c24ec,_0x557c6d){_0x2c24ec=_0x2c24ec-0x0;var _0x171b19=_0xb370[_0x2c24ec];return _0x171b19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0b37('0x1'));var moment=require(_0x0b37('0x2'));var BPromise=require(_0x0b37('0x3'));var Mustache=require('mustache');var util=require(_0x0b37('0x4'));var path=require(_0x0b37('0x5'));var sox=require(_0x0b37('0x6'));var csv=require('to-csv');var ejs=require(_0x0b37('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b37('0x8'));var squel=require('squel');var crypto=require(_0x0b37('0x9'));var jsforce=require(_0x0b37('0xa'));var deskjs=require(_0x0b37('0xb'));var toCsv=require(_0x0b37('0xc'));var querystring=require(_0x0b37('0xd'));var Papa=require(_0x0b37('0xe'));var Redis=require(_0x0b37('0xf'));var authService=require(_0x0b37('0x10'));var qs=require(_0x0b37('0x11'));var as=require(_0x0b37('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b37('0x13'))('api');var utils=require(_0x0b37('0x14'));var config=require(_0x0b37('0x15'));var licenseUtil=require(_0x0b37('0x16'));var db=require(_0x0b37('0x17'))['db'];function respondWithStatusCode(_0x596009,_0x37ac3d){_0x37ac3d=_0x37ac3d||0xcc;return function(_0x2599b0){if(_0x2599b0){return _0x596009[_0x0b37('0x18')](_0x37ac3d);}return _0x596009['status'](_0x37ac3d)['end']();};}function respondWithResult(_0x20b7c1,_0x4a9c94){_0x4a9c94=_0x4a9c94||0xc8;return function(_0x286843){if(_0x286843){return _0x20b7c1[_0x0b37('0x19')](_0x4a9c94)['json'](_0x286843);}};}function respondWithFilteredResult(_0x4710bf,_0xff58aa){return function(_0x65804){if(_0x65804){var _0x547fa2=typeof _0xff58aa[_0x0b37('0x1a')]===_0x0b37('0x1b')&&typeof _0xff58aa[_0x0b37('0x1c')]===_0x0b37('0x1b');var _0x18811e=_0x65804[_0x0b37('0x1d')];var _0x2ddff6=_0x547fa2?0x0:_0xff58aa[_0x0b37('0x1a')];var _0x3791d2=_0x547fa2?_0x65804['count']:_0xff58aa[_0x0b37('0x1a')]+_0xff58aa[_0x0b37('0x1c')];var _0x49d8d9;if(_0x3791d2>=_0x18811e){_0x3791d2=_0x18811e;_0x49d8d9=0xc8;}else{_0x49d8d9=0xce;}_0x4710bf[_0x0b37('0x19')](_0x49d8d9);return _0x4710bf[_0x0b37('0x1e')](_0x0b37('0x1f'),_0x2ddff6+'-'+_0x3791d2+'/'+_0x18811e)['json'](_0x65804);}return null;};}function patchUpdates(_0x510dd6){return function(_0x57d194){try{jsonpatch[_0x0b37('0x20')](_0x57d194,_0x510dd6,!![]);}catch(_0x3caeda){return BPromise[_0x0b37('0x21')](_0x3caeda);}return _0x57d194[_0x0b37('0x22')]();};}function saveUpdates(_0x270e4a,_0x2d5ddd){return function(_0xd0e4c2){if(_0xd0e4c2){return _0xd0e4c2[_0x0b37('0x23')](_0x270e4a)[_0x0b37('0x24')](function(_0x7a7f4c){return _0x7a7f4c;});}return null;};}function removeEntity(_0x75f563,_0x35e068){return function(_0x5ea9e7){if(_0x5ea9e7){return _0x5ea9e7['destroy']()[_0x0b37('0x24')](function(){_0x75f563[_0x0b37('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52cb52,_0xa60263){return function(_0x1ea732){if(!_0x1ea732){_0x52cb52[_0x0b37('0x18')](0x194);}return _0x1ea732;};}function handleError(_0x1e3aaf,_0x41917a){_0x41917a=_0x41917a||0x1f4;return function(_0x3e1bc3){logger[_0x0b37('0x25')](_0x3e1bc3['stack']);if(_0x3e1bc3[_0x0b37('0x26')]){delete _0x3e1bc3['name'];}_0x1e3aaf[_0x0b37('0x19')](_0x41917a)[_0x0b37('0x27')](_0x3e1bc3);};}exports[_0x0b37('0x28')]=function(_0x4a418a,_0x4e7875){var _0x252290={},_0x1e9d6a={},_0x35e861={'count':0x0,'rows':[]};var _0x4c5b51=_[_0x0b37('0x29')](db['ServicenowConfiguration'][_0x0b37('0x2a')],function(_0x5cea92){return{'name':_0x5cea92[_0x0b37('0x2b')],'type':_0x5cea92[_0x0b37('0x2c')]['key']};});_0x1e9d6a[_0x0b37('0x2d')]=_['map'](_0x4c5b51,'name');_0x1e9d6a[_0x0b37('0x2e')]=_[_0x0b37('0x2f')](_0x4a418a['query']);_0x1e9d6a[_0x0b37('0x30')]=_[_0x0b37('0x31')](_0x1e9d6a[_0x0b37('0x2d')],_0x1e9d6a[_0x0b37('0x2e')]);_0x252290['attributes']=_[_0x0b37('0x31')](_0x1e9d6a[_0x0b37('0x2d')],qs[_0x0b37('0x32')](_0x4a418a[_0x0b37('0x2e')][_0x0b37('0x32')]));_0x252290[_0x0b37('0x33')]=_0x252290[_0x0b37('0x33')][_0x0b37('0x34')]?_0x252290[_0x0b37('0x33')]:_0x1e9d6a[_0x0b37('0x2d')];if(!_0x4a418a['query'][_0x0b37('0x35')](_0x0b37('0x36'))){_0x252290[_0x0b37('0x1c')]=qs[_0x0b37('0x1c')](_0x4a418a['query']['limit']);_0x252290[_0x0b37('0x1a')]=qs['offset'](_0x4a418a[_0x0b37('0x2e')][_0x0b37('0x1a')]);}_0x252290[_0x0b37('0x37')]=qs[_0x0b37('0x38')](_0x4a418a[_0x0b37('0x2e')][_0x0b37('0x38')]);_0x252290[_0x0b37('0x39')]=qs[_0x0b37('0x30')](_[_0x0b37('0x3a')](_0x4a418a[_0x0b37('0x2e')],_0x1e9d6a[_0x0b37('0x30')]),_0x4c5b51);if(_0x4a418a[_0x0b37('0x2e')]['filter']){_0x252290[_0x0b37('0x39')]=_[_0x0b37('0x3b')](_0x252290[_0x0b37('0x39')],{'$or':_[_0x0b37('0x29')](_0x4c5b51,function(_0x3a192d){if(_0x3a192d[_0x0b37('0x2c')]!==_0x0b37('0x3c')){var _0x41f6fe={};_0x41f6fe[_0x3a192d[_0x0b37('0x26')]]={'$like':'%'+_0x4a418a[_0x0b37('0x2e')][_0x0b37('0x3d')]+'%'};return _0x41f6fe;}})});}_0x252290=_[_0x0b37('0x3b')]({},_0x252290,_0x4a418a[_0x0b37('0x3e')]);var _0x3ac97c={'where':_0x252290[_0x0b37('0x39')]};return db[_0x0b37('0x3f')][_0x0b37('0x1d')](_0x3ac97c)[_0x0b37('0x24')](function(_0x3f64a1){_0x35e861[_0x0b37('0x1d')]=_0x3f64a1;if(_0x4a418a[_0x0b37('0x2e')][_0x0b37('0x40')]){_0x252290['include']=[{'all':!![]}];}return db[_0x0b37('0x3f')]['findAll'](_0x252290);})[_0x0b37('0x24')](function(_0x504b21){_0x35e861[_0x0b37('0x41')]=_0x504b21;return _0x35e861;})[_0x0b37('0x24')](respondWithFilteredResult(_0x4e7875,_0x252290))[_0x0b37('0x42')](handleError(_0x4e7875,null));};exports[_0x0b37('0x43')]=function(_0x3735be,_0x18c0cb){var _0x60fca0={'raw':![],'where':{'id':_0x3735be['params']['id']}},_0x5ac464={};_0x5ac464[_0x0b37('0x2d')]=_[_0x0b37('0x2f')](db[_0x0b37('0x3f')][_0x0b37('0x2a')]);_0x5ac464[_0x0b37('0x2e')]=_['keys'](_0x3735be[_0x0b37('0x2e')]);_0x5ac464['filters']=_['intersection'](_0x5ac464[_0x0b37('0x2d')],_0x5ac464[_0x0b37('0x2e')]);_0x60fca0[_0x0b37('0x33')]=_['intersection'](_0x5ac464[_0x0b37('0x2d')],qs[_0x0b37('0x32')](_0x3735be['query'][_0x0b37('0x32')]));_0x60fca0['attributes']=_0x60fca0[_0x0b37('0x33')][_0x0b37('0x34')]?_0x60fca0['attributes']:_0x5ac464[_0x0b37('0x2d')];if(_0x3735be['query'][_0x0b37('0x40')]){_0x60fca0['include']=[{'all':!![]}];}_0x60fca0=_['merge']({},_0x60fca0,_0x3735be[_0x0b37('0x3e')]);return db['ServicenowConfiguration'][_0x0b37('0x44')](_0x60fca0)['then'](handleEntityNotFound(_0x18c0cb,null))['then'](respondWithResult(_0x18c0cb,null))['catch'](handleError(_0x18c0cb,null));};exports[_0x0b37('0x45')]=function(_0xdc6a76,_0x2afb10){return db['ServicenowConfiguration'][_0x0b37('0x45')](_0xdc6a76[_0x0b37('0x46')],{})[_0x0b37('0x24')](respondWithResult(_0x2afb10,0xc9))[_0x0b37('0x42')](handleError(_0x2afb10,null));};exports[_0x0b37('0x23')]=function(_0x280291,_0x59021d){if(_0x280291['body']['id']){delete _0x280291[_0x0b37('0x46')]['id'];}return db[_0x0b37('0x3f')]['find']({'where':{'id':_0x280291[_0x0b37('0x47')]['id']}})[_0x0b37('0x24')](handleEntityNotFound(_0x59021d,null))['then'](saveUpdates(_0x280291['body'],null))[_0x0b37('0x24')](respondWithResult(_0x59021d,null))['catch'](handleError(_0x59021d,null));};exports[_0x0b37('0x48')]=function(_0xf674a8,_0x115a53){return db[_0x0b37('0x3f')]['find']({'where':{'id':_0xf674a8[_0x0b37('0x47')]['id']}})[_0x0b37('0x24')](handleEntityNotFound(_0x115a53,null))[_0x0b37('0x24')](removeEntity(_0x115a53,null))[_0x0b37('0x42')](handleError(_0x115a53,null));};exports[_0x0b37('0x49')]=function(_0x49c480,_0xef93c2,_0x41862e){var _0x10225e={};var _0x2f4e74={};var _0x23114f;var _0x386d0a;return db[_0x0b37('0x3f')][_0x0b37('0x4a')]({'where':{'id':_0x49c480[_0x0b37('0x47')]['id']}})[_0x0b37('0x24')](handleEntityNotFound(_0xef93c2,null))['then'](function(_0x43d069){if(_0x43d069){_0x23114f=_0x43d069;_0x2f4e74[_0x0b37('0x2d')]=_[_0x0b37('0x2f')](db[_0x0b37('0x4b')]['rawAttributes']);_0x2f4e74[_0x0b37('0x2e')]=_[_0x0b37('0x2f')](_0x49c480['query']);_0x2f4e74[_0x0b37('0x30')]=_[_0x0b37('0x31')](_0x2f4e74[_0x0b37('0x2d')],_0x2f4e74[_0x0b37('0x2e')]);_0x10225e[_0x0b37('0x33')]=_['intersection'](_0x2f4e74[_0x0b37('0x2d')],qs['fields'](_0x49c480['query'][_0x0b37('0x32')]));_0x10225e['attributes']=_0x10225e[_0x0b37('0x33')][_0x0b37('0x34')]?_0x10225e[_0x0b37('0x33')]:_0x2f4e74['model'];_0x10225e['order']=qs[_0x0b37('0x38')](_0x49c480[_0x0b37('0x2e')]['sort']);_0x10225e['where']=qs[_0x0b37('0x30')](_['pick'](_0x49c480[_0x0b37('0x2e')],_0x2f4e74[_0x0b37('0x30')]));if(_0x49c480[_0x0b37('0x2e')][_0x0b37('0x3d')]){_0x10225e[_0x0b37('0x39')]=_[_0x0b37('0x3b')](_0x10225e[_0x0b37('0x39')],{'$or':_[_0x0b37('0x29')](_0x10225e['attributes'],function(_0x2ea1d1){var _0x2a24a2={};_0x2a24a2[_0x2ea1d1]={'$like':'%'+_0x49c480['query']['filter']+'%'};return _0x2a24a2;})});}_0x10225e=_[_0x0b37('0x3b')]({},_0x10225e,_0x49c480[_0x0b37('0x3e')]);return _0x23114f[_0x0b37('0x49')](_0x10225e);}})['then'](function(_0x5adb13){if(_0x5adb13){_0x386d0a=_0x5adb13[_0x0b37('0x34')];if(!_0x49c480['query'][_0x0b37('0x35')](_0x0b37('0x36'))){_0x10225e[_0x0b37('0x1c')]=qs[_0x0b37('0x1c')](_0x49c480[_0x0b37('0x2e')][_0x0b37('0x1c')]);_0x10225e[_0x0b37('0x1a')]=qs[_0x0b37('0x1a')](_0x49c480[_0x0b37('0x2e')]['offset']);}return _0x23114f[_0x0b37('0x49')](_0x10225e);}})[_0x0b37('0x24')](function(_0x13dc33){if(_0x13dc33){return _0x13dc33?{'count':_0x386d0a,'rows':_0x13dc33}:null;}})[_0x0b37('0x24')](respondWithResult(_0xef93c2,null))[_0x0b37('0x42')](handleError(_0xef93c2,null));};exports['getSubjects']=function(_0xc6df1d,_0xfaab53,_0x463b60){var _0x147c1b={};var _0x9e8f72={};var _0x37e28b;var _0x314d6e;return db[_0x0b37('0x3f')][_0x0b37('0x4a')]({'where':{'id':_0xc6df1d[_0x0b37('0x47')]['id']}})[_0x0b37('0x24')](handleEntityNotFound(_0xfaab53,null))['then'](function(_0x370d41){if(_0x370d41){_0x37e28b=_0x370d41;_0x9e8f72['model']=_['keys'](db[_0x0b37('0x4b')][_0x0b37('0x2a')]);_0x9e8f72[_0x0b37('0x2e')]=_[_0x0b37('0x2f')](_0xc6df1d['query']);_0x9e8f72[_0x0b37('0x30')]=_['intersection'](_0x9e8f72[_0x0b37('0x2d')],_0x9e8f72[_0x0b37('0x2e')]);_0x147c1b['attributes']=_[_0x0b37('0x31')](_0x9e8f72[_0x0b37('0x2d')],qs[_0x0b37('0x32')](_0xc6df1d[_0x0b37('0x2e')][_0x0b37('0x32')]));_0x147c1b['attributes']=_0x147c1b[_0x0b37('0x33')][_0x0b37('0x34')]?_0x147c1b[_0x0b37('0x33')]:_0x9e8f72['model'];_0x147c1b[_0x0b37('0x37')]=qs['sort'](_0xc6df1d[_0x0b37('0x2e')][_0x0b37('0x38')]);_0x147c1b['where']=qs[_0x0b37('0x30')](_[_0x0b37('0x3a')](_0xc6df1d[_0x0b37('0x2e')],_0x9e8f72['filters']));if(_0xc6df1d[_0x0b37('0x2e')][_0x0b37('0x3d')]){_0x147c1b[_0x0b37('0x39')]=_['merge'](_0x147c1b['where'],{'$or':_[_0x0b37('0x29')](_0x147c1b[_0x0b37('0x33')],function(_0x25622b){var _0x5c01aa={};_0x5c01aa[_0x25622b]={'$like':'%'+_0xc6df1d[_0x0b37('0x2e')][_0x0b37('0x3d')]+'%'};return _0x5c01aa;})});}_0x147c1b=_[_0x0b37('0x3b')]({},_0x147c1b,_0xc6df1d[_0x0b37('0x3e')]);return _0x37e28b['getSubjects'](_0x147c1b);}})[_0x0b37('0x24')](function(_0x3f77a2){if(_0x3f77a2){_0x314d6e=_0x3f77a2[_0x0b37('0x34')];if(!_0xc6df1d[_0x0b37('0x2e')][_0x0b37('0x35')](_0x0b37('0x36'))){_0x147c1b[_0x0b37('0x1c')]=qs[_0x0b37('0x1c')](_0xc6df1d[_0x0b37('0x2e')][_0x0b37('0x1c')]);_0x147c1b['offset']=qs[_0x0b37('0x1a')](_0xc6df1d[_0x0b37('0x2e')][_0x0b37('0x1a')]);}return _0x37e28b[_0x0b37('0x4c')](_0x147c1b);}})[_0x0b37('0x24')](function(_0x29f37b){if(_0x29f37b){return _0x29f37b?{'count':_0x314d6e,'rows':_0x29f37b}:null;}})[_0x0b37('0x24')](respondWithResult(_0xfaab53,null))[_0x0b37('0x42')](handleError(_0xfaab53,null));};exports[_0x0b37('0x4d')]=function(_0x587bad,_0x328455,_0x11b4b9){var _0x578e54={};var _0x4558f9={};var _0x375c5a;var _0x3b026c;return db[_0x0b37('0x3f')][_0x0b37('0x4a')]({'where':{'id':_0x587bad['params']['id']}})[_0x0b37('0x24')](handleEntityNotFound(_0x328455,null))[_0x0b37('0x24')](function(_0x2c8a40){if(_0x2c8a40){_0x375c5a=_0x2c8a40;_0x4558f9[_0x0b37('0x2d')]=_[_0x0b37('0x2f')](db[_0x0b37('0x4b')]['rawAttributes']);_0x4558f9[_0x0b37('0x2e')]=_[_0x0b37('0x2f')](_0x587bad[_0x0b37('0x2e')]);_0x4558f9[_0x0b37('0x30')]=_[_0x0b37('0x31')](_0x4558f9[_0x0b37('0x2d')],_0x4558f9[_0x0b37('0x2e')]);_0x578e54[_0x0b37('0x33')]=_[_0x0b37('0x31')](_0x4558f9['model'],qs[_0x0b37('0x32')](_0x587bad['query'][_0x0b37('0x32')]));_0x578e54[_0x0b37('0x33')]=_0x578e54[_0x0b37('0x33')][_0x0b37('0x34')]?_0x578e54[_0x0b37('0x33')]:_0x4558f9['model'];_0x578e54['order']=qs[_0x0b37('0x38')](_0x587bad[_0x0b37('0x2e')][_0x0b37('0x38')]);_0x578e54[_0x0b37('0x39')]=qs[_0x0b37('0x30')](_[_0x0b37('0x3a')](_0x587bad['query'],_0x4558f9[_0x0b37('0x30')]));if(_0x587bad[_0x0b37('0x2e')]['filter']){_0x578e54[_0x0b37('0x39')]=_['merge'](_0x578e54['where'],{'$or':_[_0x0b37('0x29')](_0x578e54[_0x0b37('0x33')],function(_0x406799){var _0x5351f6={};_0x5351f6[_0x406799]={'$like':'%'+_0x587bad[_0x0b37('0x2e')][_0x0b37('0x3d')]+'%'};return _0x5351f6;})});}_0x578e54=_[_0x0b37('0x3b')]({},_0x578e54,_0x587bad[_0x0b37('0x3e')]);return _0x375c5a[_0x0b37('0x4d')](_0x578e54);}})[_0x0b37('0x24')](function(_0x47e120){if(_0x47e120){_0x3b026c=_0x47e120['length'];if(!_0x587bad[_0x0b37('0x2e')][_0x0b37('0x35')]('nolimit')){_0x578e54[_0x0b37('0x1c')]=qs[_0x0b37('0x1c')](_0x587bad['query'][_0x0b37('0x1c')]);_0x578e54[_0x0b37('0x1a')]=qs['offset'](_0x587bad[_0x0b37('0x2e')][_0x0b37('0x1a')]);}return _0x375c5a['getDescriptions'](_0x578e54);}})[_0x0b37('0x24')](function(_0x48c58b){if(_0x48c58b){return _0x48c58b?{'count':_0x3b026c,'rows':_0x48c58b}:null;}})[_0x0b37('0x24')](respondWithResult(_0x328455,null))[_0x0b37('0x42')](handleError(_0x328455,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c7179d4..914148d 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 _0x8caf=['request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x494d4e,_0x2af882){var _0x5c42e8=function(_0x412c67){while(--_0x412c67){_0x494d4e['push'](_0x494d4e['shift']());}};_0x5c42e8(++_0x2af882);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0x8caf[_0x513119];return _0x587511;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var logger=require(_0xf8ca('0x1'))(_0xf8ca('0x2'));var moment=require(_0xf8ca('0x3'));var BPromise=require(_0xf8ca('0x4'));var rp=require(_0xf8ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8ca('0x6'));var config=require(_0xf8ca('0x7'));var attributes=require(_0xf8ca('0x8'));module[_0xf8ca('0x9')]=function(_0x1e2888,_0x20c10a){return _0x1e2888['define'](_0xf8ca('0xa'),attributes,{'tableName':_0xf8ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf79e=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util'];(function(_0x34f14f,_0x4169d0){var _0x47f9db=function(_0x27d839){while(--_0x27d839){_0x34f14f['push'](_0x34f14f['shift']());}};_0x47f9db(++_0x4169d0);}(_0xf79e,0x185));var _0xef79=function(_0x41464b,_0x80f89c){_0x41464b=_0x41464b-0x0;var _0x5187e0=_0xf79e[_0x41464b];return _0x5187e0;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var logger=require(_0xef79('0x1'))(_0xef79('0x2'));var moment=require('moment');var BPromise=require(_0xef79('0x3'));var rp=require(_0xef79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef79('0x5'));var attributes=require(_0xef79('0x6'));module[_0xef79('0x7')]=function(_0x22b3c2,_0x396c51){return _0x22b3c2[_0xef79('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xef79('0x9'),'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 6113e6f..9380cea 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 _0xbd9e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','moment','randomstring'];(function(_0x53d941,_0x25c3ea){var _0xa50d46=function(_0x2777cd){while(--_0x2777cd){_0x53d941['push'](_0x53d941['shift']());}};_0xa50d46(++_0x25c3ea);}(_0xbd9e,0x108));var _0xebd9=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xbd9e[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebd9('0x0'));var BPromise=require('bluebird');var rs=require(_0xebd9('0x1'));var fs=require('fs');var Redis=require(_0xebd9('0x2'));var db=require(_0xebd9('0x3'))['db'];var utils=require(_0xebd9('0x4'));var logger=require(_0xebd9('0x5'))('rpc');var config=require(_0xebd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xebd9('0x7')][_0xebd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe1bf09,_0x23c503,_0x285c28){return new BPromise(function(_0x1f7734,_0x55e858){return client[_0xebd9('0x9')](_0xe1bf09,_0x285c28)[_0xebd9('0xa')](function(_0x12d27a){logger[_0xebd9('0xb')](_0xebd9('0xc'),_0x23c503,'request\x20sent');logger[_0xebd9('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x23c503,_0xebd9('0xe'),JSON['stringify'](_0x12d27a));if(_0x12d27a[_0xebd9('0xf')]){if(_0x12d27a[_0xebd9('0xf')]['code']===0x1f4){logger[_0xebd9('0xf')](_0xebd9('0xc'),_0x23c503,_0x12d27a['error'][_0xebd9('0x10')]);return _0x55e858(_0x12d27a[_0xebd9('0xf')][_0xebd9('0x10')]);}logger[_0xebd9('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x23c503,_0x12d27a[_0xebd9('0xf')][_0xebd9('0x10')]);return _0x1f7734(_0x12d27a[_0xebd9('0xf')][_0xebd9('0x10')]);}else{logger[_0xebd9('0xb')](_0xebd9('0xc'),_0x23c503,_0xebd9('0xe'));_0x1f7734(_0x12d27a[_0xebd9('0x11')][_0xebd9('0x10')]);}})[_0xebd9('0x12')](function(_0x37cdf3){logger[_0xebd9('0xf')](_0xebd9('0xc'),_0x23c503,_0x37cdf3);_0x55e858(_0x37cdf3);});});} \ No newline at end of file +var _0x61f1=['jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x92ca95,_0xb686ab){var _0x469cc2=function(_0x52715c){while(--_0x52715c){_0x92ca95['push'](_0x92ca95['shift']());}};_0x469cc2(++_0xb686ab);}(_0x61f1,0x18a));var _0x161f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x61f1[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x161f('0x0'));var moment=require('moment');var BPromise=require(_0x161f('0x1'));var rs=require(_0x161f('0x2'));var fs=require('fs');var Redis=require(_0x161f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x161f('0x4'))(_0x161f('0x5'));var config=require('../../config/environment');var jayson=require(_0x161f('0x6'));var client=jayson[_0x161f('0x7')][_0x161f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf8174c,_0xd1ad5d,_0x4ff5e1){return new BPromise(function(_0x910af4,_0x31f44e){return client[_0x161f('0x9')](_0xf8174c,_0x4ff5e1)[_0x161f('0xa')](function(_0x24bc8a){logger[_0x161f('0xb')](_0x161f('0xc'),_0xd1ad5d,_0x161f('0xd'));logger[_0x161f('0xe')](_0x161f('0xf'),_0xd1ad5d,_0x161f('0xd'),JSON['stringify'](_0x24bc8a));if(_0x24bc8a[_0x161f('0x10')]){if(_0x24bc8a[_0x161f('0x10')][_0x161f('0x11')]===0x1f4){logger[_0x161f('0x10')](_0x161f('0xc'),_0xd1ad5d,_0x24bc8a['error'][_0x161f('0x12')]);return _0x31f44e(_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);}logger[_0x161f('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0xd1ad5d,_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);return _0x910af4(_0x24bc8a[_0x161f('0x10')][_0x161f('0x12')]);}else{logger[_0x161f('0xb')](_0x161f('0xc'),_0xd1ad5d,'request\x20sent');_0x910af4(_0x24bc8a['result'][_0x161f('0x12')]);}})[_0x161f('0x13')](function(_0x189a95){logger['error'](_0x161f('0xc'),_0xd1ad5d,_0x189a95);_0x31f44e(_0x189a95);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4039c89..3e7d05f 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 _0x4b1f=['../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14ec75,_0x56a3d4){var _0x40b9e9=function(_0x4d2f39){while(--_0x4d2f39){_0x14ec75['push'](_0x14ec75['shift']());}};_0x40b9e9(++_0x56a3d4);}(_0x4b1f,0x13e));var _0xf4b1=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4b1f[_0x344a3f];return _0x264712;};'use strict';var multer=require('multer');var util=require(_0xf4b1('0x0'));var path=require(_0xf4b1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf4b1('0x2')]();var fs_extra=require(_0xf4b1('0x3'));var auth=require(_0xf4b1('0x4'));var interaction=require(_0xf4b1('0x5'));var config=require(_0xf4b1('0x6'));var controller=require(_0xf4b1('0x7'));router['get']('/',auth[_0xf4b1('0x8')](),controller[_0xf4b1('0x9')]);router[_0xf4b1('0xa')](_0xf4b1('0xb'),auth[_0xf4b1('0x8')](),controller[_0xf4b1('0xc')]);router[_0xf4b1('0xd')]('/',auth[_0xf4b1('0x8')](),controller['create']);router['put'](_0xf4b1('0xb'),auth[_0xf4b1('0x8')](),controller[_0xf4b1('0xe')]);router[_0xf4b1('0xf')]('/:id',auth[_0xf4b1('0x8')](),controller[_0xf4b1('0x10')]);module[_0xf4b1('0x11')]=router; \ No newline at end of file +var _0x5659=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x510d80,_0x7670a){var _0x210d23=function(_0x531648){while(--_0x531648){_0x510d80['push'](_0x510d80['shift']());}};_0x210d23(++_0x7670a);}(_0x5659,0xb8));var _0x9565=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0x5659[_0x38cb7c];return _0x2a5f5e;};'use strict';var multer=require(_0x9565('0x0'));var util=require(_0x9565('0x1'));var path=require(_0x9565('0x2'));var timeout=require(_0x9565('0x3'));var express=require(_0x9565('0x4'));var router=express[_0x9565('0x5')]();var fs_extra=require(_0x9565('0x6'));var auth=require(_0x9565('0x7'));var interaction=require(_0x9565('0x8'));var config=require(_0x9565('0x9'));var controller=require(_0x9565('0xa'));router[_0x9565('0xb')]('/',auth[_0x9565('0xc')](),controller[_0x9565('0xd')]);router['get'](_0x9565('0xe'),auth[_0x9565('0xc')](),controller[_0x9565('0xf')]);router[_0x9565('0x10')]('/',auth[_0x9565('0xc')](),controller['create']);router[_0x9565('0x11')](_0x9565('0xe'),auth[_0x9565('0xc')](),controller[_0x9565('0x12')]);router[_0x9565('0x13')]('/:id',auth[_0x9565('0xc')](),controller[_0x9565('0x14')]);module[_0x9565('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 44469c0..f1a3505 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 _0x102c=['keyValue','picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable'];(function(_0x361f49,_0x59b649){var _0x5e6516=function(_0x744327){while(--_0x744327){_0x361f49['push'](_0x361f49['shift']());}};_0x5e6516(++_0x59b649);}(_0x102c,0x1a2));var _0xc102=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x102c[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0xc102('0x0'));module[_0xc102('0x1')]={'type':{'type':Sequelize[_0xc102('0x2')](_0xc102('0x3'),'variable',_0xc102('0x4'),_0xc102('0x5'),_0xc102('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc102('0x7')]},'keyType':{'type':Sequelize[_0xc102('0x2')](_0xc102('0x3'),_0xc102('0x8'),_0xc102('0x4'))},'keyContent':{'type':Sequelize[_0xc102('0x7')]},'idField':{'type':Sequelize[_0xc102('0x7')]},'nameField':{'type':Sequelize[_0xc102('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc102('0x7')]}}; \ No newline at end of file +var _0x4fa2=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2e551e,_0x49beb9){var _0x220cb1=function(_0x36a46b){while(--_0x36a46b){_0x2e551e['push'](_0x2e551e['shift']());}};_0x220cb1(++_0x49beb9);}(_0x4fa2,0xa3));var _0x24fa=function(_0x3e2c1e,_0x1e8d40){_0x3e2c1e=_0x3e2c1e-0x0;var _0x1c6666=_0x4fa2[_0x3e2c1e];return _0x1c6666;};'use strict';var Sequelize=require(_0x24fa('0x0'));module[_0x24fa('0x1')]={'type':{'type':Sequelize[_0x24fa('0x2')](_0x24fa('0x3'),_0x24fa('0x4'),_0x24fa('0x5'),_0x24fa('0x6'),_0x24fa('0x7')),'defaultValue':_0x24fa('0x3')},'content':{'type':Sequelize[_0x24fa('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x24fa('0x2')](_0x24fa('0x3'),_0x24fa('0x4'),_0x24fa('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x24fa('0x8')]},'nameField':{'type':Sequelize[_0x24fa('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x24fa('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a57bdcf..6298b79 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 _0x8e9d=['show','rawAttributes','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','name','send','index','ServicenowField','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8e9d,0x133));var _0xd8e9=function(_0x1fe071,_0x40acdb){_0x1fe071=_0x1fe071-0x0;var _0x187691=_0x8e9d[_0x1fe071];return _0x187691;};'use strict';var emlformat=require(_0xd8e9('0x0'));var rimraf=require(_0xd8e9('0x1'));var zipdir=require(_0xd8e9('0x2'));var jsonpatch=require(_0xd8e9('0x3'));var rp=require(_0xd8e9('0x4'));var moment=require(_0xd8e9('0x5'));var BPromise=require(_0xd8e9('0x6'));var Mustache=require('mustache');var util=require(_0xd8e9('0x7'));var path=require(_0xd8e9('0x8'));var sox=require(_0xd8e9('0x9'));var csv=require(_0xd8e9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8e9('0xb'));var crypto=require(_0xd8e9('0xc'));var jsforce=require(_0xd8e9('0xd'));var deskjs=require(_0xd8e9('0xe'));var toCsv=require(_0xd8e9('0xa'));var querystring=require('querystring');var Papa=require(_0xd8e9('0xf'));var Redis=require(_0xd8e9('0x10'));var authService=require(_0xd8e9('0x11'));var qs=require(_0xd8e9('0x12'));var as=require(_0xd8e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8e9('0x14'))(_0xd8e9('0x15'));var utils=require(_0xd8e9('0x16'));var config=require(_0xd8e9('0x17'));var licenseUtil=require(_0xd8e9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b589,_0x14c1d1){_0x14c1d1=_0x14c1d1||0xcc;return function(_0x378415){if(_0x378415){return _0x38b589[_0xd8e9('0x19')](_0x14c1d1);}return _0x38b589[_0xd8e9('0x1a')](_0x14c1d1)[_0xd8e9('0x1b')]();};}function respondWithResult(_0x132c19,_0x2a77f6){_0x2a77f6=_0x2a77f6||0xc8;return function(_0x2a624a){if(_0x2a624a){return _0x132c19[_0xd8e9('0x1a')](_0x2a77f6)[_0xd8e9('0x1c')](_0x2a624a);}};}function respondWithFilteredResult(_0x5ca04e,_0x167cc5){return function(_0x55b7be){if(_0x55b7be){var _0x24ecc=typeof _0x167cc5[_0xd8e9('0x1d')]===_0xd8e9('0x1e')&&typeof _0x167cc5[_0xd8e9('0x1f')]===_0xd8e9('0x1e');var _0x60a384=_0x55b7be[_0xd8e9('0x20')];var _0x3ee320=_0x24ecc?0x0:_0x167cc5[_0xd8e9('0x1d')];var _0x15b3cf=_0x24ecc?_0x55b7be[_0xd8e9('0x20')]:_0x167cc5['offset']+_0x167cc5[_0xd8e9('0x1f')];var _0x55ec00;if(_0x15b3cf>=_0x60a384){_0x15b3cf=_0x60a384;_0x55ec00=0xc8;}else{_0x55ec00=0xce;}_0x5ca04e[_0xd8e9('0x1a')](_0x55ec00);return _0x5ca04e[_0xd8e9('0x21')](_0xd8e9('0x22'),_0x3ee320+'-'+_0x15b3cf+'/'+_0x60a384)[_0xd8e9('0x1c')](_0x55b7be);}return null;};}function patchUpdates(_0x34c9b3){return function(_0x3a2b9){try{jsonpatch['apply'](_0x3a2b9,_0x34c9b3,!![]);}catch(_0x2e0685){return BPromise[_0xd8e9('0x23')](_0x2e0685);}return _0x3a2b9['save']();};}function saveUpdates(_0x2da188,_0x318ee5){return function(_0x2b0339){if(_0x2b0339){return _0x2b0339['update'](_0x2da188)[_0xd8e9('0x24')](function(_0x1c76ee){return _0x1c76ee;});}return null;};}function removeEntity(_0x1b6d5e,_0x28bb5c){return function(_0x3363f3){if(_0x3363f3){return _0x3363f3[_0xd8e9('0x25')]()[_0xd8e9('0x24')](function(){_0x1b6d5e[_0xd8e9('0x1a')](0xcc)[_0xd8e9('0x1b')]();});}};}function handleEntityNotFound(_0x34adfe,_0x16f150){return function(_0x3865de){if(!_0x3865de){_0x34adfe[_0xd8e9('0x19')](0x194);}return _0x3865de;};}function handleError(_0x55916c,_0x349c64){_0x349c64=_0x349c64||0x1f4;return function(_0x54583c){logger[_0xd8e9('0x26')](_0x54583c['stack']);if(_0x54583c['name']){delete _0x54583c[_0xd8e9('0x27')];}_0x55916c[_0xd8e9('0x1a')](_0x349c64)[_0xd8e9('0x28')](_0x54583c);};}exports[_0xd8e9('0x29')]=function(_0x1b95ab,_0x2f8b6c){var _0x1094ab={},_0x291c69={},_0x5c3272={'count':0x0,'rows':[]};var _0x5a074c=_['map'](db[_0xd8e9('0x2a')]['rawAttributes'],function(_0x8af568){return{'name':_0x8af568[_0xd8e9('0x2b')],'type':_0x8af568[_0xd8e9('0x2c')][_0xd8e9('0x2d')]};});_0x291c69['model']=_[_0xd8e9('0x2e')](_0x5a074c,_0xd8e9('0x27'));_0x291c69[_0xd8e9('0x2f')]=_[_0xd8e9('0x30')](_0x1b95ab[_0xd8e9('0x2f')]);_0x291c69[_0xd8e9('0x31')]=_[_0xd8e9('0x32')](_0x291c69[_0xd8e9('0x33')],_0x291c69['query']);_0x1094ab[_0xd8e9('0x34')]=_[_0xd8e9('0x32')](_0x291c69[_0xd8e9('0x33')],qs[_0xd8e9('0x35')](_0x1b95ab[_0xd8e9('0x2f')][_0xd8e9('0x35')]));_0x1094ab[_0xd8e9('0x34')]=_0x1094ab['attributes'][_0xd8e9('0x36')]?_0x1094ab[_0xd8e9('0x34')]:_0x291c69['model'];if(!_0x1b95ab[_0xd8e9('0x2f')][_0xd8e9('0x37')]('nolimit')){_0x1094ab[_0xd8e9('0x1f')]=qs['limit'](_0x1b95ab['query'][_0xd8e9('0x1f')]);_0x1094ab[_0xd8e9('0x1d')]=qs[_0xd8e9('0x1d')](_0x1b95ab[_0xd8e9('0x2f')][_0xd8e9('0x1d')]);}_0x1094ab[_0xd8e9('0x38')]=qs['sort'](_0x1b95ab[_0xd8e9('0x2f')][_0xd8e9('0x39')]);_0x1094ab['where']=qs[_0xd8e9('0x31')](_[_0xd8e9('0x3a')](_0x1b95ab[_0xd8e9('0x2f')],_0x291c69[_0xd8e9('0x31')]),_0x5a074c);if(_0x1b95ab['query'][_0xd8e9('0x3b')]){_0x1094ab[_0xd8e9('0x3c')]=_[_0xd8e9('0x3d')](_0x1094ab[_0xd8e9('0x3c')],{'$or':_[_0xd8e9('0x2e')](_0x5a074c,function(_0x136093){if(_0x136093['type']!=='VIRTUAL'){var _0x257b04={};_0x257b04[_0x136093['name']]={'$like':'%'+_0x1b95ab[_0xd8e9('0x2f')][_0xd8e9('0x3b')]+'%'};return _0x257b04;}})});}_0x1094ab=_[_0xd8e9('0x3d')]({},_0x1094ab,_0x1b95ab[_0xd8e9('0x3e')]);var _0x19e69c={'where':_0x1094ab[_0xd8e9('0x3c')]};return db[_0xd8e9('0x2a')][_0xd8e9('0x20')](_0x19e69c)[_0xd8e9('0x24')](function(_0x329f8c){_0x5c3272[_0xd8e9('0x20')]=_0x329f8c;if(_0x1b95ab['query'][_0xd8e9('0x3f')]){_0x1094ab[_0xd8e9('0x40')]=[{'all':!![]}];}return db[_0xd8e9('0x2a')][_0xd8e9('0x41')](_0x1094ab);})[_0xd8e9('0x24')](function(_0x59781f){_0x5c3272[_0xd8e9('0x42')]=_0x59781f;return _0x5c3272;})[_0xd8e9('0x24')](respondWithFilteredResult(_0x2f8b6c,_0x1094ab))[_0xd8e9('0x43')](handleError(_0x2f8b6c,null));};exports[_0xd8e9('0x44')]=function(_0x459ea8,_0x41af54){var _0x1ac012={'raw':!![],'where':{'id':_0x459ea8['params']['id']}},_0x252047={};_0x252047[_0xd8e9('0x33')]=_['keys'](db[_0xd8e9('0x2a')][_0xd8e9('0x45')]);_0x252047[_0xd8e9('0x2f')]=_[_0xd8e9('0x30')](_0x459ea8[_0xd8e9('0x2f')]);_0x252047[_0xd8e9('0x31')]=_[_0xd8e9('0x32')](_0x252047['model'],_0x252047['query']);_0x1ac012['attributes']=_[_0xd8e9('0x32')](_0x252047[_0xd8e9('0x33')],qs[_0xd8e9('0x35')](_0x459ea8[_0xd8e9('0x2f')][_0xd8e9('0x35')]));_0x1ac012[_0xd8e9('0x34')]=_0x1ac012[_0xd8e9('0x34')][_0xd8e9('0x36')]?_0x1ac012['attributes']:_0x252047[_0xd8e9('0x33')];if(_0x459ea8['query'][_0xd8e9('0x3f')]){_0x1ac012[_0xd8e9('0x40')]=[{'all':!![]}];}_0x1ac012=_['merge']({},_0x1ac012,_0x459ea8[_0xd8e9('0x3e')]);return db[_0xd8e9('0x2a')][_0xd8e9('0x46')](_0x1ac012)[_0xd8e9('0x24')](handleEntityNotFound(_0x41af54,null))['then'](respondWithResult(_0x41af54,null))[_0xd8e9('0x43')](handleError(_0x41af54,null));};exports[_0xd8e9('0x47')]=function(_0x4de500,_0x49a559){return db[_0xd8e9('0x2a')][_0xd8e9('0x47')](_0x4de500[_0xd8e9('0x48')],{})['then'](respondWithResult(_0x49a559,0xc9))[_0xd8e9('0x43')](handleError(_0x49a559,null));};exports[_0xd8e9('0x49')]=function(_0x2d7e97,_0x5abb59){if(_0x2d7e97['body']['id']){delete _0x2d7e97[_0xd8e9('0x48')]['id'];}return db[_0xd8e9('0x2a')]['find']({'where':{'id':_0x2d7e97[_0xd8e9('0x4a')]['id']}})[_0xd8e9('0x24')](handleEntityNotFound(_0x5abb59,null))['then'](saveUpdates(_0x2d7e97[_0xd8e9('0x48')],null))[_0xd8e9('0x24')](respondWithResult(_0x5abb59,null))[_0xd8e9('0x43')](handleError(_0x5abb59,null));};exports[_0xd8e9('0x25')]=function(_0x531c38,_0x204ada){return db['ServicenowField']['find']({'where':{'id':_0x531c38[_0xd8e9('0x4a')]['id']}})[_0xd8e9('0x24')](handleEntityNotFound(_0x204ada,null))[_0xd8e9('0x24')](removeEntity(_0x204ada,null))[_0xd8e9('0x43')](handleError(_0x204ada,null));}; \ No newline at end of file +var _0x7a18=['nolimit','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','intersection','attributes','find','create','body','destroy','eml-format','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','keys','filters','query','fields','length'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x7a18,0x134));var _0x87a1=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x7a18[_0xf55e73];return _0x116b99;};'use strict';var emlformat=require(_0x87a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x87a1('0x2'));var BPromise=require(_0x87a1('0x3'));var Mustache=require(_0x87a1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x87a1('0x5'));var csv=require(_0x87a1('0x6'));var ejs=require(_0x87a1('0x7'));var fs=require('fs');var fs_extra=require(_0x87a1('0x8'));var _=require(_0x87a1('0x9'));var squel=require(_0x87a1('0xa'));var crypto=require(_0x87a1('0xb'));var jsforce=require(_0x87a1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x87a1('0x6'));var querystring=require('querystring');var Papa=require(_0x87a1('0xd'));var Redis=require(_0x87a1('0xe'));var authService=require(_0x87a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x87a1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87a1('0x11'))('api');var utils=require(_0x87a1('0x12'));var config=require(_0x87a1('0x13'));var licenseUtil=require(_0x87a1('0x14'));var db=require(_0x87a1('0x15'))['db'];function respondWithStatusCode(_0x1456c1,_0x4eb0e7){_0x4eb0e7=_0x4eb0e7||0xcc;return function(_0x4e2e35){if(_0x4e2e35){return _0x1456c1['sendStatus'](_0x4eb0e7);}return _0x1456c1['status'](_0x4eb0e7)[_0x87a1('0x16')]();};}function respondWithResult(_0x140bdb,_0x2ae480){_0x2ae480=_0x2ae480||0xc8;return function(_0x22ac36){if(_0x22ac36){return _0x140bdb[_0x87a1('0x17')](_0x2ae480)['json'](_0x22ac36);}};}function respondWithFilteredResult(_0xa7fa6a,_0x56e705){return function(_0x5de958){if(_0x5de958){var _0x420c82=typeof _0x56e705[_0x87a1('0x18')]==='undefined'&&typeof _0x56e705[_0x87a1('0x19')]===_0x87a1('0x1a');var _0x326ddc=_0x5de958[_0x87a1('0x1b')];var _0x318c6f=_0x420c82?0x0:_0x56e705['offset'];var _0x110b39=_0x420c82?_0x5de958[_0x87a1('0x1b')]:_0x56e705[_0x87a1('0x18')]+_0x56e705[_0x87a1('0x19')];var _0x5bfe4b;if(_0x110b39>=_0x326ddc){_0x110b39=_0x326ddc;_0x5bfe4b=0xc8;}else{_0x5bfe4b=0xce;}_0xa7fa6a[_0x87a1('0x17')](_0x5bfe4b);return _0xa7fa6a[_0x87a1('0x1c')](_0x87a1('0x1d'),_0x318c6f+'-'+_0x110b39+'/'+_0x326ddc)[_0x87a1('0x1e')](_0x5de958);}return null;};}function patchUpdates(_0x38a5f0){return function(_0x5a6fc7){try{jsonpatch[_0x87a1('0x1f')](_0x5a6fc7,_0x38a5f0,!![]);}catch(_0x4583c8){return BPromise[_0x87a1('0x20')](_0x4583c8);}return _0x5a6fc7[_0x87a1('0x21')]();};}function saveUpdates(_0x32a8f9,_0x42f45f){return function(_0x474387){if(_0x474387){return _0x474387['update'](_0x32a8f9)[_0x87a1('0x22')](function(_0x471a3a){return _0x471a3a;});}return null;};}function removeEntity(_0x3bc70f,_0x3b63b4){return function(_0x1f74df){if(_0x1f74df){return _0x1f74df['destroy']()[_0x87a1('0x22')](function(){_0x3bc70f[_0x87a1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x441301,_0xbb6516){return function(_0xe9b680){if(!_0xe9b680){_0x441301[_0x87a1('0x23')](0x194);}return _0xe9b680;};}function handleError(_0x8833ce,_0xb4a5c6){_0xb4a5c6=_0xb4a5c6||0x1f4;return function(_0x3d7ec7){logger[_0x87a1('0x24')](_0x3d7ec7[_0x87a1('0x25')]);if(_0x3d7ec7[_0x87a1('0x26')]){delete _0x3d7ec7[_0x87a1('0x26')];}_0x8833ce[_0x87a1('0x17')](_0xb4a5c6)[_0x87a1('0x27')](_0x3d7ec7);};}exports[_0x87a1('0x28')]=function(_0x688ec2,_0x5b9ab6){var _0x533b99={},_0x4f8e45={},_0x4b67aa={'count':0x0,'rows':[]};var _0x4e9697=_[_0x87a1('0x29')](db[_0x87a1('0x2a')][_0x87a1('0x2b')],function(_0x155eaf){return{'name':_0x155eaf[_0x87a1('0x2c')],'type':_0x155eaf['type'][_0x87a1('0x2d')]};});_0x4f8e45[_0x87a1('0x2e')]=_[_0x87a1('0x29')](_0x4e9697,_0x87a1('0x26'));_0x4f8e45['query']=_[_0x87a1('0x2f')](_0x688ec2['query']);_0x4f8e45[_0x87a1('0x30')]=_['intersection'](_0x4f8e45['model'],_0x4f8e45[_0x87a1('0x31')]);_0x533b99['attributes']=_['intersection'](_0x4f8e45[_0x87a1('0x2e')],qs[_0x87a1('0x32')](_0x688ec2[_0x87a1('0x31')][_0x87a1('0x32')]));_0x533b99['attributes']=_0x533b99['attributes'][_0x87a1('0x33')]?_0x533b99['attributes']:_0x4f8e45[_0x87a1('0x2e')];if(!_0x688ec2['query']['hasOwnProperty'](_0x87a1('0x34'))){_0x533b99[_0x87a1('0x19')]=qs['limit'](_0x688ec2[_0x87a1('0x31')]['limit']);_0x533b99[_0x87a1('0x18')]=qs[_0x87a1('0x18')](_0x688ec2[_0x87a1('0x31')][_0x87a1('0x18')]);}_0x533b99['order']=qs[_0x87a1('0x35')](_0x688ec2[_0x87a1('0x31')][_0x87a1('0x35')]);_0x533b99['where']=qs[_0x87a1('0x30')](_['pick'](_0x688ec2['query'],_0x4f8e45[_0x87a1('0x30')]),_0x4e9697);if(_0x688ec2[_0x87a1('0x31')][_0x87a1('0x36')]){_0x533b99[_0x87a1('0x37')]=_[_0x87a1('0x38')](_0x533b99[_0x87a1('0x37')],{'$or':_[_0x87a1('0x29')](_0x4e9697,function(_0x4ad7b8){if(_0x4ad7b8[_0x87a1('0x39')]!=='VIRTUAL'){var _0x4794b7={};_0x4794b7[_0x4ad7b8[_0x87a1('0x26')]]={'$like':'%'+_0x688ec2['query'][_0x87a1('0x36')]+'%'};return _0x4794b7;}})});}_0x533b99=_[_0x87a1('0x38')]({},_0x533b99,_0x688ec2[_0x87a1('0x3a')]);var _0xce9e8f={'where':_0x533b99[_0x87a1('0x37')]};return db[_0x87a1('0x2a')][_0x87a1('0x1b')](_0xce9e8f)[_0x87a1('0x22')](function(_0x55c36a){_0x4b67aa[_0x87a1('0x1b')]=_0x55c36a;if(_0x688ec2[_0x87a1('0x31')][_0x87a1('0x3b')]){_0x533b99[_0x87a1('0x3c')]=[{'all':!![]}];}return db[_0x87a1('0x2a')][_0x87a1('0x3d')](_0x533b99);})[_0x87a1('0x22')](function(_0x322e4c){_0x4b67aa[_0x87a1('0x3e')]=_0x322e4c;return _0x4b67aa;})[_0x87a1('0x22')](respondWithFilteredResult(_0x5b9ab6,_0x533b99))[_0x87a1('0x3f')](handleError(_0x5b9ab6,null));};exports[_0x87a1('0x40')]=function(_0x256f39,_0x13126e){var _0x9b35f3={'raw':!![],'where':{'id':_0x256f39[_0x87a1('0x41')]['id']}},_0x2453b0={};_0x2453b0[_0x87a1('0x2e')]=_[_0x87a1('0x2f')](db[_0x87a1('0x2a')][_0x87a1('0x2b')]);_0x2453b0[_0x87a1('0x31')]=_[_0x87a1('0x2f')](_0x256f39['query']);_0x2453b0[_0x87a1('0x30')]=_[_0x87a1('0x42')](_0x2453b0[_0x87a1('0x2e')],_0x2453b0[_0x87a1('0x31')]);_0x9b35f3[_0x87a1('0x43')]=_[_0x87a1('0x42')](_0x2453b0[_0x87a1('0x2e')],qs[_0x87a1('0x32')](_0x256f39['query']['fields']));_0x9b35f3['attributes']=_0x9b35f3[_0x87a1('0x43')]['length']?_0x9b35f3['attributes']:_0x2453b0[_0x87a1('0x2e')];if(_0x256f39[_0x87a1('0x31')][_0x87a1('0x3b')]){_0x9b35f3[_0x87a1('0x3c')]=[{'all':!![]}];}_0x9b35f3=_[_0x87a1('0x38')]({},_0x9b35f3,_0x256f39[_0x87a1('0x3a')]);return db[_0x87a1('0x2a')][_0x87a1('0x44')](_0x9b35f3)[_0x87a1('0x22')](handleEntityNotFound(_0x13126e,null))[_0x87a1('0x22')](respondWithResult(_0x13126e,null))['catch'](handleError(_0x13126e,null));};exports[_0x87a1('0x45')]=function(_0x46f8e7,_0x28fd9f){return db[_0x87a1('0x2a')][_0x87a1('0x45')](_0x46f8e7[_0x87a1('0x46')],{})[_0x87a1('0x22')](respondWithResult(_0x28fd9f,0xc9))[_0x87a1('0x3f')](handleError(_0x28fd9f,null));};exports['update']=function(_0x2e43a0,_0x26e8f5){if(_0x2e43a0[_0x87a1('0x46')]['id']){delete _0x2e43a0[_0x87a1('0x46')]['id'];}return db['ServicenowField'][_0x87a1('0x44')]({'where':{'id':_0x2e43a0[_0x87a1('0x41')]['id']}})[_0x87a1('0x22')](handleEntityNotFound(_0x26e8f5,null))['then'](saveUpdates(_0x2e43a0[_0x87a1('0x46')],null))['then'](respondWithResult(_0x26e8f5,null))[_0x87a1('0x3f')](handleError(_0x26e8f5,null));};exports[_0x87a1('0x47')]=function(_0x43f436,_0x150ac7){return db['ServicenowField'][_0x87a1('0x44')]({'where':{'id':_0x43f436[_0x87a1('0x41')]['id']}})[_0x87a1('0x22')](handleEntityNotFound(_0x150ac7,null))[_0x87a1('0x22')](removeEntity(_0x150ac7,null))[_0x87a1('0x3f')](handleError(_0x150ac7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 29cf5aa..637490d 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 _0x4607=['util','../../config/logger','moment','bluebird','request-promise','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x27d57a,_0x1f1c02){var _0x4e99a5=function(_0x173ad6){while(--_0x173ad6){_0x27d57a['push'](_0x27d57a['shift']());}};_0x4e99a5(++_0x1f1c02);}(_0x4607,0x1df));var _0x7460=function(_0x165512,_0x4bb88e){_0x165512=_0x165512-0x0;var _0x57ee7f=_0x4607[_0x165512];return _0x57ee7f;};'use strict';var _=require(_0x7460('0x0'));var util=require(_0x7460('0x1'));var logger=require(_0x7460('0x2'))('api');var moment=require(_0x7460('0x3'));var BPromise=require(_0x7460('0x4'));var rp=require(_0x7460('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x7460('0x6')]=function(_0x3957fa,_0x3bb850){return _0x3957fa[_0x7460('0x7')]('ServicenowField',attributes,{'tableName':_0x7460('0x8'),'paranoid':![],'indexes':[{'name':_0x7460('0x9'),'fields':[_0x7460('0xa'),_0x7460('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb80c=['bluebird','request-promise','rimraf','../../config/environment','exports','define','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x1acde2,_0x4cd189){var _0x4ccd31=function(_0x3a2379){while(--_0x3a2379){_0x1acde2['push'](_0x1acde2['shift']());}};_0x4ccd31(++_0x4cd189);}(_0xb80c,0x81));var _0xcb80=function(_0x388833,_0x51e3f0){_0x388833=_0x388833-0x0;var _0x8fce38=_0xb80c[_0x388833];return _0x8fce38;};'use strict';var _=require(_0xcb80('0x0'));var util=require(_0xcb80('0x1'));var logger=require(_0xcb80('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcb80('0x3'));var rp=require(_0xcb80('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb80('0x5'));var config=require(_0xcb80('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xcb80('0x7')]=function(_0x4fe31a,_0x39879b){return _0x4fe31a[_0xcb80('0x8')]('ServicenowField',attributes,{'tableName':_0xcb80('0x9'),'paranoid':![],'indexes':[{'name':_0xcb80('0xa'),'fields':['idField',_0xcb80('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 84bf837..e1ebadd 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 _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(_0x235d85,_0x2db080){_0x235d85=_0x235d85-0x0;var _0x559ead=_0xbdb7[_0x235d85];return _0x559ead;};'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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x14dd10,_0x4900d6){var _0x5cb641=function(_0x499124){while(--_0x499124){_0x14dd10['push'](_0x14dd10['shift']());}};_0x5cb641(++_0x4900d6);}(_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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 82a5c0e..c51ef24 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x543061,_0x159e2b){var _0x580e4a=function(_0x4afa82){while(--_0x4afa82){_0x543061['push'](_0x543061['shift']());}};_0x580e4a(++_0x159e2b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x59fb83,_0x2a3509){var _0x4c4458=function(_0x4364cb){while(--_0x4364cb){_0x59fb83['push'](_0x59fb83['shift']());}};_0x4c4458(++_0x2a3509);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 57f81fd..c79ca2a 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(_0x586817,_0x16764e){var _0x133de3=function(_0xfdc6e8){while(--_0xfdc6e8){_0x586817['push'](_0x586817['shift']());}};_0x133de3(++_0x16764e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x324327,_0x3b24d3){var _0x2b24eb=function(_0x5cdac4){while(--_0x5cdac4){_0x324327['push'](_0x324327['shift']());}};_0x2b24eb(++_0x3b24d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 2ea326f..a3c6a17 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 _0x89c8=['parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','values','remove','includes','label','endsWith','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','keys','find','create','update','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x89c8,0x1e1));var _0x889c=function(_0x15dc7c,_0x3cd9b0){_0x15dc7c=_0x15dc7c-0x0;var _0x1372ce=_0x89c8[_0x15dc7c];return _0x1372ce;};'use strict';var emlformat=require(_0x889c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x889c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x889c('0x2'));var moment=require(_0x889c('0x3'));var BPromise=require(_0x889c('0x4'));var Mustache=require(_0x889c('0x5'));var util=require(_0x889c('0x6'));var path=require(_0x889c('0x7'));var sox=require('sox');var csv=require(_0x889c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x889c('0x9'));var squel=require(_0x889c('0xa'));var crypto=require(_0x889c('0xb'));var jsforce=require(_0x889c('0xc'));var deskjs=require(_0x889c('0xd'));var toCsv=require(_0x889c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x889c('0xe'));var authService=require(_0x889c('0xf'));var qs=require(_0x889c('0x10'));var as=require(_0x889c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x889c('0x12'));var utils=require(_0x889c('0x13'));var config=require(_0x889c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x889c('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x15a0cc,_0xd92f4c){_0xd92f4c=_0xd92f4c||0xcc;return function(_0x24fa8f){if(_0x24fa8f){return _0x15a0cc[_0x889c('0x16')](_0xd92f4c);}return _0x15a0cc[_0x889c('0x17')](_0xd92f4c)['end']();};}function respondWithResult(_0x48f32d,_0x72cd48){_0x72cd48=_0x72cd48||0xc8;return function(_0x2341a0){if(_0x2341a0){return _0x48f32d[_0x889c('0x17')](_0x72cd48)[_0x889c('0x18')](_0x2341a0);}};}function respondWithFilteredResult(_0x53bce3,_0x5d778e){return function(_0x4170e8){if(_0x4170e8){var _0x33cdcd=typeof _0x5d778e[_0x889c('0x19')]===_0x889c('0x1a')&&typeof _0x5d778e[_0x889c('0x1b')]==='undefined';var _0x25bf3f=_0x4170e8[_0x889c('0x1c')];var _0x22547c=_0x33cdcd?0x0:_0x5d778e[_0x889c('0x19')];var _0x3ddbea=_0x33cdcd?_0x4170e8['count']:_0x5d778e[_0x889c('0x19')]+_0x5d778e[_0x889c('0x1b')];var _0x5ed2a6;if(_0x3ddbea>=_0x25bf3f){_0x3ddbea=_0x25bf3f;_0x5ed2a6=0xc8;}else{_0x5ed2a6=0xce;}_0x53bce3[_0x889c('0x17')](_0x5ed2a6);return _0x53bce3[_0x889c('0x1d')](_0x889c('0x1e'),_0x22547c+'-'+_0x3ddbea+'/'+_0x25bf3f)[_0x889c('0x18')](_0x4170e8);}return null;};}function patchUpdates(_0x1f3138){return function(_0x37a290){try{jsonpatch[_0x889c('0x1f')](_0x37a290,_0x1f3138,!![]);}catch(_0x32ef57){return BPromise[_0x889c('0x20')](_0x32ef57);}return _0x37a290[_0x889c('0x21')]();};}function saveUpdates(_0x5c41e6,_0x2a025e){return function(_0x2428cb){if(_0x2428cb){return _0x2428cb['update'](_0x5c41e6)[_0x889c('0x22')](function(_0x110819){return _0x110819;});}return null;};}function removeEntity(_0x55d19d,_0x39ab35){return function(_0x711687){if(_0x711687){return _0x711687[_0x889c('0x23')]()[_0x889c('0x22')](function(){_0x55d19d[_0x889c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5538ca,_0x4c5530){return function(_0x4a5bc2){if(!_0x4a5bc2){_0x5538ca[_0x889c('0x16')](0x194);}return _0x4a5bc2;};}function handleError(_0x392805,_0xabfa91){_0xabfa91=_0xabfa91||0x1f4;return function(_0x3d7fdf){logger['error'](_0x3d7fdf[_0x889c('0x24')]);if(_0x3d7fdf[_0x889c('0x25')]){delete _0x3d7fdf[_0x889c('0x25')];}_0x392805[_0x889c('0x17')](_0xabfa91)[_0x889c('0x26')](_0x3d7fdf);};}exports[_0x889c('0x27')]=function(_0x5629c4,_0x5ac7e5){var _0x18723d={},_0x1a67fb={},_0x3ee947={'count':0x0,'rows':[]};var _0x76bd5=_[_0x889c('0x28')](db[_0x889c('0x29')]['rawAttributes'],function(_0x174fa7){return{'name':_0x174fa7[_0x889c('0x2a')],'type':_0x174fa7[_0x889c('0x2b')][_0x889c('0x2c')]};});_0x1a67fb[_0x889c('0x2d')]=_[_0x889c('0x28')](_0x76bd5,_0x889c('0x25'));_0x1a67fb[_0x889c('0x2e')]=_['keys'](_0x5629c4[_0x889c('0x2e')]);_0x1a67fb[_0x889c('0x2f')]=_[_0x889c('0x30')](_0x1a67fb[_0x889c('0x2d')],_0x1a67fb[_0x889c('0x2e')]);_0x18723d[_0x889c('0x31')]=_[_0x889c('0x30')](_0x1a67fb[_0x889c('0x2d')],qs[_0x889c('0x32')](_0x5629c4['query'][_0x889c('0x32')]));_0x18723d[_0x889c('0x31')]=_0x18723d[_0x889c('0x31')][_0x889c('0x33')]?_0x18723d[_0x889c('0x31')]:_0x1a67fb[_0x889c('0x2d')];if(!_0x5629c4['query']['hasOwnProperty'](_0x889c('0x34'))){_0x18723d[_0x889c('0x1b')]=qs[_0x889c('0x1b')](_0x5629c4[_0x889c('0x2e')][_0x889c('0x1b')]);_0x18723d['offset']=qs[_0x889c('0x19')](_0x5629c4[_0x889c('0x2e')][_0x889c('0x19')]);}_0x18723d[_0x889c('0x35')]=qs[_0x889c('0x36')](_0x5629c4[_0x889c('0x2e')][_0x889c('0x36')]);_0x18723d[_0x889c('0x37')]=qs[_0x889c('0x2f')](_['pick'](_0x5629c4[_0x889c('0x2e')],_0x1a67fb[_0x889c('0x2f')]),_0x76bd5);if(_0x5629c4[_0x889c('0x2e')]['filter']){_0x18723d['where']=_[_0x889c('0x38')](_0x18723d[_0x889c('0x37')],{'$or':_['map'](_0x76bd5,function(_0x2fbed8){if(_0x2fbed8[_0x889c('0x2b')]!==_0x889c('0x39')){var _0x12fee8={};_0x12fee8[_0x2fbed8[_0x889c('0x25')]]={'$like':'%'+_0x5629c4[_0x889c('0x2e')][_0x889c('0x3a')]+'%'};return _0x12fee8;}})});}_0x18723d=_[_0x889c('0x38')]({},_0x18723d,_0x5629c4[_0x889c('0x3b')]);var _0x222d63={'where':_0x18723d[_0x889c('0x37')]};return db[_0x889c('0x29')][_0x889c('0x1c')](_0x222d63)[_0x889c('0x22')](function(_0x27b09c){_0x3ee947[_0x889c('0x1c')]=_0x27b09c;if(_0x5629c4[_0x889c('0x2e')][_0x889c('0x3c')]){_0x18723d['include']=[{'all':!![]}];}return db[_0x889c('0x29')]['findAll'](_0x18723d);})[_0x889c('0x22')](function(_0x2a4963){_0x3ee947[_0x889c('0x3d')]=_0x2a4963;return _0x3ee947;})[_0x889c('0x22')](respondWithFilteredResult(_0x5ac7e5,_0x18723d))[_0x889c('0x3e')](handleError(_0x5ac7e5,null));};exports['show']=function(_0x3d5dca,_0x1b747b){var _0x3fef8c={'raw':![],'where':{'id':_0x3d5dca[_0x889c('0x3f')]['id']}},_0x3ab28e={};_0x3ab28e['model']=_['keys'](db[_0x889c('0x29')]['rawAttributes']);_0x3ab28e[_0x889c('0x2e')]=_[_0x889c('0x40')](_0x3d5dca[_0x889c('0x2e')]);_0x3ab28e[_0x889c('0x2f')]=_[_0x889c('0x30')](_0x3ab28e['model'],_0x3ab28e[_0x889c('0x2e')]);_0x3fef8c[_0x889c('0x31')]=_['intersection'](_0x3ab28e['model'],qs[_0x889c('0x32')](_0x3d5dca['query']['fields']));_0x3fef8c[_0x889c('0x31')]=_0x3fef8c[_0x889c('0x31')][_0x889c('0x33')]?_0x3fef8c[_0x889c('0x31')]:_0x3ab28e[_0x889c('0x2d')];if(_0x3d5dca['query'][_0x889c('0x3c')]){_0x3fef8c['include']=[{'all':!![]}];}_0x3fef8c=_[_0x889c('0x38')]({},_0x3fef8c,_0x3d5dca[_0x889c('0x3b')]);return db[_0x889c('0x29')][_0x889c('0x41')](_0x3fef8c)[_0x889c('0x22')](handleEntityNotFound(_0x1b747b,null))[_0x889c('0x22')](respondWithResult(_0x1b747b,null))[_0x889c('0x3e')](handleError(_0x1b747b,null));};exports[_0x889c('0x42')]=function(_0x2e6026,_0x2fea10){return db[_0x889c('0x29')][_0x889c('0x42')](_0x2e6026['body'],{})[_0x889c('0x22')](respondWithResult(_0x2fea10,0xc9))[_0x889c('0x3e')](handleError(_0x2fea10,null));};exports[_0x889c('0x43')]=function(_0x2df6d1,_0x2598d7){if(_0x2df6d1['body']['id']){delete _0x2df6d1[_0x889c('0x44')]['id'];}return db[_0x889c('0x29')][_0x889c('0x41')]({'where':{'id':_0x2df6d1[_0x889c('0x3f')]['id']}})[_0x889c('0x22')](handleEntityNotFound(_0x2598d7,null))['then'](saveUpdates(_0x2df6d1[_0x889c('0x44')],null))[_0x889c('0x22')](respondWithResult(_0x2598d7,null))['catch'](handleError(_0x2598d7,null));};exports[_0x889c('0x23')]=function(_0x482961,_0x38a9fe){return db['SugarcrmAccount'][_0x889c('0x41')]({'where':{'id':_0x482961[_0x889c('0x3f')]['id']}})[_0x889c('0x22')](handleEntityNotFound(_0x38a9fe,null))['then'](removeEntity(_0x38a9fe,null))[_0x889c('0x3e')](handleError(_0x38a9fe,null));};exports[_0x889c('0x45')]=function(_0x254c5a,_0x9d3cc2,_0x502d88){var _0x29430a={};var _0x4e647e={};var _0x313524;var _0x25c1d0;return db[_0x889c('0x29')][_0x889c('0x46')]({'where':{'id':_0x254c5a[_0x889c('0x3f')]['id']}})[_0x889c('0x22')](handleEntityNotFound(_0x9d3cc2,null))[_0x889c('0x22')](function(_0x14a9f9){if(_0x14a9f9){_0x313524=_0x14a9f9;_0x4e647e[_0x889c('0x2d')]=_[_0x889c('0x40')](db[_0x889c('0x47')]['rawAttributes']);_0x4e647e[_0x889c('0x2e')]=_[_0x889c('0x40')](_0x254c5a[_0x889c('0x2e')]);_0x4e647e[_0x889c('0x2f')]=_['intersection'](_0x4e647e[_0x889c('0x2d')],_0x4e647e[_0x889c('0x2e')]);_0x29430a[_0x889c('0x31')]=_[_0x889c('0x30')](_0x4e647e[_0x889c('0x2d')],qs[_0x889c('0x32')](_0x254c5a[_0x889c('0x2e')][_0x889c('0x32')]));_0x29430a[_0x889c('0x31')]=_0x29430a[_0x889c('0x31')]['length']?_0x29430a[_0x889c('0x31')]:_0x4e647e[_0x889c('0x2d')];_0x29430a[_0x889c('0x35')]=qs['sort'](_0x254c5a['query'][_0x889c('0x36')]);_0x29430a[_0x889c('0x37')]=qs[_0x889c('0x2f')](_['pick'](_0x254c5a[_0x889c('0x2e')],_0x4e647e['filters']));if(_0x254c5a[_0x889c('0x2e')][_0x889c('0x3a')]){_0x29430a[_0x889c('0x37')]=_['merge'](_0x29430a[_0x889c('0x37')],{'$or':_[_0x889c('0x28')](_0x29430a[_0x889c('0x31')],function(_0x34084e){var _0x10145e={};_0x10145e[_0x34084e]={'$like':'%'+_0x254c5a[_0x889c('0x2e')][_0x889c('0x3a')]+'%'};return _0x10145e;})});}_0x29430a=_[_0x889c('0x38')]({},_0x29430a,_0x254c5a['options']);return _0x313524[_0x889c('0x45')](_0x29430a);}})[_0x889c('0x22')](function(_0x4940d1){if(_0x4940d1){_0x25c1d0=_0x4940d1['length'];if(!_0x254c5a[_0x889c('0x2e')]['hasOwnProperty'](_0x889c('0x34'))){_0x29430a[_0x889c('0x1b')]=qs['limit'](_0x254c5a[_0x889c('0x2e')][_0x889c('0x1b')]);_0x29430a[_0x889c('0x19')]=qs[_0x889c('0x19')](_0x254c5a['query'][_0x889c('0x19')]);}return _0x313524['getConfigurations'](_0x29430a);}})[_0x889c('0x22')](function(_0x988013){if(_0x988013){return _0x988013?{'count':_0x25c1d0,'rows':_0x988013}:null;}})[_0x889c('0x22')](respondWithResult(_0x9d3cc2,null))['catch'](handleError(_0x9d3cc2,null));};exports[_0x889c('0x48')]=function(_0x241cdc,_0x232b52,_0x25b101){if(_0x241cdc[_0x889c('0x44')]['id']){delete _0x241cdc[_0x889c('0x44')]['id'];}return db[_0x889c('0x29')]['findOne']({'where':{'id':_0x241cdc[_0x889c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x232b52,null))[_0x889c('0x22')](function(_0x428df8){if(_0x428df8){_0x241cdc['body'][_0x889c('0x49')]=_0x428df8['id'];_0x241cdc[_0x889c('0x44')][_0x889c('0x4a')]=integrations[_0x889c('0x4b')](_0x241cdc[_0x889c('0x44')][_0x889c('0x4c')],_0x241cdc[_0x889c('0x44')][_0x889c('0x2b')]);_0x241cdc[_0x889c('0x44')]['Descriptions']=integrations[_0x889c('0x4d')](_0x241cdc['body']['channel'],_0x241cdc[_0x889c('0x44')]['type']);return db[_0x889c('0x47')]['create'](_0x241cdc[_0x889c('0x44')],{'include':[{'model':db[_0x889c('0x4e')],'as':_0x889c('0x4a')},{'model':db[_0x889c('0x4e')],'as':'Descriptions'}]});}return null;})[_0x889c('0x22')](respondWithResult(_0x232b52,null))[_0x889c('0x3e')](handleError(_0x232b52,null));};exports[_0x889c('0x4f')]=function(_0x19b5f0,_0x1164a5,_0x1dd912){var _0x129041='';var _0x466e09=['id',_0x889c('0x25'),_0x889c('0x50'),_0x889c('0x51'),_0x889c('0x52'),'date_start','duration_hours',_0x889c('0x53'),_0x889c('0x54'),'parent_type',_0x889c('0x55'),_0x889c('0x56')];return db[_0x889c('0x29')][_0x889c('0x46')]({'where':{'id':_0x19b5f0[_0x889c('0x3f')]['id']},'attributes':['id',_0x889c('0x57'),_0x889c('0x58'),_0x889c('0x59')]})[_0x889c('0x22')](handleEntityNotFound(_0x1164a5,null))['then'](function(_0x50a7d5){if(_0x50a7d5){_0x129041=_0x50a7d5[_0x889c('0x59')];var _0x55a84b=_0x129041[_0x889c('0x5a')](-0x1);if(_0x55a84b==='/'){_0x129041=_0x129041[_0x889c('0x5b')](0x0,_0x129041[_0x889c('0x5c')](_0x55a84b));}return rp({'method':_0x889c('0x5d'),'uri':util[_0x889c('0x5e')](_0x889c('0x5f'),_0x129041,_0x889c('0x60')),'json':!![],'form':{'method':_0x889c('0x61'),'input_type':'JSON','response_type':_0x889c('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x50a7d5[_0x889c('0x57')],'password':_0x50a7d5[_0x889c('0x58')],'encryption':_0x889c('0x63')},'application':_0x889c('0x64')})}});}})[_0x889c('0x22')](function(_0x375a08){if(_0x375a08&&_0x375a08['name']!=='Invalid\x20Login'&&_0x375a08[_0x889c('0x25')]!==_0x889c('0x65')){return rp({'method':_0x889c('0x5d'),'uri':util['format'](_0x889c('0x5f'),_0x129041,_0x889c('0x60')),'json':!![],'form':{'method':_0x889c('0x66'),'input_type':_0x889c('0x62'),'response_type':_0x889c('0x62'),'rest_data':JSON['stringify']({'session':_0x375a08['id'],'module_name':'Calls'})}})[_0x889c('0x22')](function(_0x2cf5bc){if(_0x2cf5bc){var _0xc3ee77=_[_0x889c('0x67')](_0x2cf5bc['module_fields']);_[_0x889c('0x68')](_0xc3ee77,function(_0xaab200){return _0x466e09[_0x889c('0x69')](_0xaab200[_0x889c('0x25')]);});return{'count':_0xc3ee77[_0x889c('0x33')],'rows':_[_0x889c('0x28')](_0xc3ee77,function(_0x687f0d){return{'id':_0x687f0d['name'],'name':_0x687f0d[_0x889c('0x6a')],'custom':_[_0x889c('0x6b')](_0x687f0d[_0x889c('0x25')],'_c')?!![]:![],'options':_0x687f0d[_0x889c('0x3b')]?_[_0x889c('0x28')](_[_0x889c('0x67')](_0x687f0d[_0x889c('0x3b')]),function(_0x50cec7){return{'name':_0x50cec7['value'],'value':_0x50cec7[_0x889c('0x25')]};}):[]};})};}})['then'](respondWithResult(_0x1164a5,null))[_0x889c('0x3e')](function(_0x3bd6f1){var _0x36f685=_0x19b5f0[_0x889c('0x2e')][_0x889c('0x6c')]?0x1f4:_0x3bd6f1[_0x889c('0x6d')]||0x1f4;logger[_0x889c('0x6e')](_0x889c('0x6f'),_0x889c('0x4f'),_0x36f685,JSON['stringify'](_0x3bd6f1));delete _0x3bd6f1[_0x889c('0x25')];if(_0x36f685===0x191){_0x36f685=0x190;}_0x1164a5[_0x889c('0x17')](_0x36f685)[_0x889c('0x26')](_0x19b5f0['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3bd6f1[_0x889c('0x6d')]}:_0x3bd6f1);});}else{var _0x349b52=0x1f4;_0x1164a5[_0x889c('0x17')](_0x349b52)[_0x889c('0x26')]({'message':_0x889c('0x70'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xa9ab=['Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','JSON','Calls','values','module_fields','remove','length','endsWith','value','statusCode','error','Wrong\x20credentials','eml-format','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','destroy','then','name','send','index','map','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','SugarcrmAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','filter','addConfiguration'];(function(_0x348652,_0x1ab849){var _0x18a9ea=function(_0x3fd540){while(--_0x3fd540){_0x348652['push'](_0x348652['shift']());}};_0x18a9ea(++_0x1ab849);}(_0xa9ab,0x1f1));var _0xba9a=function(_0x547279,_0x31efe4){_0x547279=_0x547279-0x0;var _0x38e498=_0xa9ab[_0x547279];return _0x38e498;};'use strict';var emlformat=require(_0xba9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xba9a('0x1'));var moment=require('moment');var BPromise=require(_0xba9a('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xba9a('0x3'));var sox=require(_0xba9a('0x4'));var csv=require(_0xba9a('0x5'));var ejs=require(_0xba9a('0x6'));var fs=require('fs');var fs_extra=require(_0xba9a('0x7'));var _=require(_0xba9a('0x8'));var squel=require('squel');var crypto=require(_0xba9a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xba9a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba9a('0xb'));var Redis=require('ioredis');var authService=require(_0xba9a('0xc'));var qs=require(_0xba9a('0xd'));var as=require(_0xba9a('0xe'));var hardwareService=require(_0xba9a('0xf'));var logger=require(_0xba9a('0x10'))(_0xba9a('0x11'));var utils=require(_0xba9a('0x12'));var config=require(_0xba9a('0x13'));var licenseUtil=require(_0xba9a('0x14'));var db=require(_0xba9a('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1db6bf,_0x5d142f){_0x5d142f=_0x5d142f||0xcc;return function(_0x56aec3){if(_0x56aec3){return _0x1db6bf[_0xba9a('0x16')](_0x5d142f);}return _0x1db6bf[_0xba9a('0x17')](_0x5d142f)[_0xba9a('0x18')]();};}function respondWithResult(_0x5157d7,_0x1deeab){_0x1deeab=_0x1deeab||0xc8;return function(_0x2e6f97){if(_0x2e6f97){return _0x5157d7[_0xba9a('0x17')](_0x1deeab)[_0xba9a('0x19')](_0x2e6f97);}};}function respondWithFilteredResult(_0x27bbac,_0x9b7817){return function(_0x1cf474){if(_0x1cf474){var _0x33299c=typeof _0x9b7817[_0xba9a('0x1a')]==='undefined'&&typeof _0x9b7817[_0xba9a('0x1b')]==='undefined';var _0x3415db=_0x1cf474['count'];var _0x3b49d7=_0x33299c?0x0:_0x9b7817['offset'];var _0x6a29bb=_0x33299c?_0x1cf474[_0xba9a('0x1c')]:_0x9b7817[_0xba9a('0x1a')]+_0x9b7817[_0xba9a('0x1b')];var _0x1374d1;if(_0x6a29bb>=_0x3415db){_0x6a29bb=_0x3415db;_0x1374d1=0xc8;}else{_0x1374d1=0xce;}_0x27bbac[_0xba9a('0x17')](_0x1374d1);return _0x27bbac[_0xba9a('0x1d')](_0xba9a('0x1e'),_0x3b49d7+'-'+_0x6a29bb+'/'+_0x3415db)[_0xba9a('0x19')](_0x1cf474);}return null;};}function patchUpdates(_0x5cac1e){return function(_0x287aa3){try{jsonpatch['apply'](_0x287aa3,_0x5cac1e,!![]);}catch(_0x598633){return BPromise[_0xba9a('0x1f')](_0x598633);}return _0x287aa3['save']();};}function saveUpdates(_0x5d71b6,_0x4d91d1){return function(_0x5ccfe7){if(_0x5ccfe7){return _0x5ccfe7[_0xba9a('0x20')](_0x5d71b6)['then'](function(_0x3fa71b){return _0x3fa71b;});}return null;};}function removeEntity(_0x14153a,_0x536499){return function(_0x151133){if(_0x151133){return _0x151133[_0xba9a('0x21')]()[_0xba9a('0x22')](function(){_0x14153a[_0xba9a('0x17')](0xcc)[_0xba9a('0x18')]();});}};}function handleEntityNotFound(_0x2cac3d,_0x34a7d3){return function(_0xcea5){if(!_0xcea5){_0x2cac3d[_0xba9a('0x16')](0x194);}return _0xcea5;};}function handleError(_0x129356,_0x4e76d2){_0x4e76d2=_0x4e76d2||0x1f4;return function(_0x421015){logger['error'](_0x421015['stack']);if(_0x421015[_0xba9a('0x23')]){delete _0x421015['name'];}_0x129356[_0xba9a('0x17')](_0x4e76d2)[_0xba9a('0x24')](_0x421015);};}exports[_0xba9a('0x25')]=function(_0x55f03a,_0x46a66e){var _0xf4ab23={},_0x3126ca={},_0x3d7e4f={'count':0x0,'rows':[]};var _0x3dc2c6=_[_0xba9a('0x26')](db['SugarcrmAccount']['rawAttributes'],function(_0x5c00fa){return{'name':_0x5c00fa['fieldName'],'type':_0x5c00fa['type'][_0xba9a('0x27')]};});_0x3126ca['model']=_[_0xba9a('0x26')](_0x3dc2c6,_0xba9a('0x23'));_0x3126ca[_0xba9a('0x28')]=_[_0xba9a('0x29')](_0x55f03a[_0xba9a('0x28')]);_0x3126ca[_0xba9a('0x2a')]=_['intersection'](_0x3126ca['model'],_0x3126ca[_0xba9a('0x28')]);_0xf4ab23[_0xba9a('0x2b')]=_[_0xba9a('0x2c')](_0x3126ca[_0xba9a('0x2d')],qs[_0xba9a('0x2e')](_0x55f03a[_0xba9a('0x28')]['fields']));_0xf4ab23[_0xba9a('0x2b')]=_0xf4ab23[_0xba9a('0x2b')]['length']?_0xf4ab23[_0xba9a('0x2b')]:_0x3126ca[_0xba9a('0x2d')];if(!_0x55f03a['query'][_0xba9a('0x2f')](_0xba9a('0x30'))){_0xf4ab23[_0xba9a('0x1b')]=qs[_0xba9a('0x1b')](_0x55f03a[_0xba9a('0x28')][_0xba9a('0x1b')]);_0xf4ab23['offset']=qs[_0xba9a('0x1a')](_0x55f03a['query']['offset']);}_0xf4ab23[_0xba9a('0x31')]=qs[_0xba9a('0x32')](_0x55f03a[_0xba9a('0x28')]['sort']);_0xf4ab23[_0xba9a('0x33')]=qs['filters'](_[_0xba9a('0x34')](_0x55f03a[_0xba9a('0x28')],_0x3126ca['filters']),_0x3dc2c6);if(_0x55f03a[_0xba9a('0x28')]['filter']){_0xf4ab23['where']=_[_0xba9a('0x35')](_0xf4ab23[_0xba9a('0x33')],{'$or':_[_0xba9a('0x26')](_0x3dc2c6,function(_0x4ebf7f){if(_0x4ebf7f[_0xba9a('0x36')]!==_0xba9a('0x37')){var _0xf920fe={};_0xf920fe[_0x4ebf7f['name']]={'$like':'%'+_0x55f03a[_0xba9a('0x28')]['filter']+'%'};return _0xf920fe;}})});}_0xf4ab23=_[_0xba9a('0x35')]({},_0xf4ab23,_0x55f03a[_0xba9a('0x38')]);var _0x388e03={'where':_0xf4ab23[_0xba9a('0x33')]};return db[_0xba9a('0x39')][_0xba9a('0x1c')](_0x388e03)[_0xba9a('0x22')](function(_0x59cf9f){_0x3d7e4f[_0xba9a('0x1c')]=_0x59cf9f;if(_0x55f03a[_0xba9a('0x28')]['includeAll']){_0xf4ab23[_0xba9a('0x3a')]=[{'all':!![]}];}return db[_0xba9a('0x39')][_0xba9a('0x3b')](_0xf4ab23);})['then'](function(_0xccdeff){_0x3d7e4f[_0xba9a('0x3c')]=_0xccdeff;return _0x3d7e4f;})[_0xba9a('0x22')](respondWithFilteredResult(_0x46a66e,_0xf4ab23))[_0xba9a('0x3d')](handleError(_0x46a66e,null));};exports['show']=function(_0x53ba35,_0x53e6cf){var _0x3c9b66={'raw':![],'where':{'id':_0x53ba35[_0xba9a('0x3e')]['id']}},_0x25d533={};_0x25d533[_0xba9a('0x2d')]=_[_0xba9a('0x29')](db['SugarcrmAccount'][_0xba9a('0x3f')]);_0x25d533[_0xba9a('0x28')]=_[_0xba9a('0x29')](_0x53ba35['query']);_0x25d533['filters']=_[_0xba9a('0x2c')](_0x25d533[_0xba9a('0x2d')],_0x25d533[_0xba9a('0x28')]);_0x3c9b66[_0xba9a('0x2b')]=_[_0xba9a('0x2c')](_0x25d533['model'],qs[_0xba9a('0x2e')](_0x53ba35[_0xba9a('0x28')]['fields']));_0x3c9b66[_0xba9a('0x2b')]=_0x3c9b66[_0xba9a('0x2b')]['length']?_0x3c9b66[_0xba9a('0x2b')]:_0x25d533[_0xba9a('0x2d')];if(_0x53ba35[_0xba9a('0x28')][_0xba9a('0x40')]){_0x3c9b66['include']=[{'all':!![]}];}_0x3c9b66=_['merge']({},_0x3c9b66,_0x53ba35[_0xba9a('0x38')]);return db[_0xba9a('0x39')]['find'](_0x3c9b66)[_0xba9a('0x22')](handleEntityNotFound(_0x53e6cf,null))[_0xba9a('0x22')](respondWithResult(_0x53e6cf,null))[_0xba9a('0x3d')](handleError(_0x53e6cf,null));};exports[_0xba9a('0x41')]=function(_0x4722fa,_0x486d69){return db[_0xba9a('0x39')]['create'](_0x4722fa['body'],{})[_0xba9a('0x22')](respondWithResult(_0x486d69,0xc9))['catch'](handleError(_0x486d69,null));};exports[_0xba9a('0x20')]=function(_0x20dfb6,_0x21635c){if(_0x20dfb6[_0xba9a('0x42')]['id']){delete _0x20dfb6['body']['id'];}return db[_0xba9a('0x39')][_0xba9a('0x43')]({'where':{'id':_0x20dfb6['params']['id']}})[_0xba9a('0x22')](handleEntityNotFound(_0x21635c,null))[_0xba9a('0x22')](saveUpdates(_0x20dfb6['body'],null))[_0xba9a('0x22')](respondWithResult(_0x21635c,null))['catch'](handleError(_0x21635c,null));};exports[_0xba9a('0x21')]=function(_0x2a8eb1,_0x34d7dc){return db[_0xba9a('0x39')][_0xba9a('0x43')]({'where':{'id':_0x2a8eb1[_0xba9a('0x3e')]['id']}})[_0xba9a('0x22')](handleEntityNotFound(_0x34d7dc,null))[_0xba9a('0x22')](removeEntity(_0x34d7dc,null))[_0xba9a('0x3d')](handleError(_0x34d7dc,null));};exports[_0xba9a('0x44')]=function(_0x524787,_0x3967a5,_0x5e7f9e){var _0x3a9cdd={};var _0x46c4aa={};var _0x460534;var _0x206618;return db[_0xba9a('0x39')][_0xba9a('0x45')]({'where':{'id':_0x524787[_0xba9a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3967a5,null))[_0xba9a('0x22')](function(_0x2bb34c){if(_0x2bb34c){_0x460534=_0x2bb34c;_0x46c4aa[_0xba9a('0x2d')]=_[_0xba9a('0x29')](db[_0xba9a('0x46')][_0xba9a('0x3f')]);_0x46c4aa[_0xba9a('0x28')]=_[_0xba9a('0x29')](_0x524787[_0xba9a('0x28')]);_0x46c4aa[_0xba9a('0x2a')]=_[_0xba9a('0x2c')](_0x46c4aa[_0xba9a('0x2d')],_0x46c4aa[_0xba9a('0x28')]);_0x3a9cdd['attributes']=_[_0xba9a('0x2c')](_0x46c4aa[_0xba9a('0x2d')],qs['fields'](_0x524787[_0xba9a('0x28')][_0xba9a('0x2e')]));_0x3a9cdd[_0xba9a('0x2b')]=_0x3a9cdd[_0xba9a('0x2b')]['length']?_0x3a9cdd['attributes']:_0x46c4aa[_0xba9a('0x2d')];_0x3a9cdd['order']=qs[_0xba9a('0x32')](_0x524787[_0xba9a('0x28')]['sort']);_0x3a9cdd['where']=qs[_0xba9a('0x2a')](_['pick'](_0x524787['query'],_0x46c4aa[_0xba9a('0x2a')]));if(_0x524787[_0xba9a('0x28')][_0xba9a('0x47')]){_0x3a9cdd[_0xba9a('0x33')]=_[_0xba9a('0x35')](_0x3a9cdd[_0xba9a('0x33')],{'$or':_[_0xba9a('0x26')](_0x3a9cdd[_0xba9a('0x2b')],function(_0x58bc54){var _0xa8b623={};_0xa8b623[_0x58bc54]={'$like':'%'+_0x524787[_0xba9a('0x28')][_0xba9a('0x47')]+'%'};return _0xa8b623;})});}_0x3a9cdd=_[_0xba9a('0x35')]({},_0x3a9cdd,_0x524787['options']);return _0x460534[_0xba9a('0x44')](_0x3a9cdd);}})['then'](function(_0x351c91){if(_0x351c91){_0x206618=_0x351c91['length'];if(!_0x524787[_0xba9a('0x28')][_0xba9a('0x2f')](_0xba9a('0x30'))){_0x3a9cdd[_0xba9a('0x1b')]=qs[_0xba9a('0x1b')](_0x524787['query'][_0xba9a('0x1b')]);_0x3a9cdd[_0xba9a('0x1a')]=qs[_0xba9a('0x1a')](_0x524787[_0xba9a('0x28')]['offset']);}return _0x460534[_0xba9a('0x44')](_0x3a9cdd);}})['then'](function(_0x1f6b4a){if(_0x1f6b4a){return _0x1f6b4a?{'count':_0x206618,'rows':_0x1f6b4a}:null;}})['then'](respondWithResult(_0x3967a5,null))[_0xba9a('0x3d')](handleError(_0x3967a5,null));};exports[_0xba9a('0x48')]=function(_0x37ac53,_0x36e6fc,_0x2379c8){if(_0x37ac53[_0xba9a('0x42')]['id']){delete _0x37ac53['body']['id'];}return db[_0xba9a('0x39')][_0xba9a('0x45')]({'where':{'id':_0x37ac53[_0xba9a('0x3e')]['id']}})[_0xba9a('0x22')](handleEntityNotFound(_0x36e6fc,null))[_0xba9a('0x22')](function(_0x2f3d3a){if(_0x2f3d3a){_0x37ac53[_0xba9a('0x42')]['AccountId']=_0x2f3d3a['id'];_0x37ac53['body'][_0xba9a('0x49')]=integrations[_0xba9a('0x4a')](_0x37ac53['body'][_0xba9a('0x4b')],_0x37ac53[_0xba9a('0x42')][_0xba9a('0x36')]);_0x37ac53['body'][_0xba9a('0x4c')]=integrations[_0xba9a('0x4d')](_0x37ac53['body'][_0xba9a('0x4b')],_0x37ac53[_0xba9a('0x42')]['type']);return db['SugarcrmConfiguration']['create'](_0x37ac53[_0xba9a('0x42')],{'include':[{'model':db['SugarcrmField'],'as':_0xba9a('0x49')},{'model':db[_0xba9a('0x4e')],'as':_0xba9a('0x4c')}]});}return null;})[_0xba9a('0x22')](respondWithResult(_0x36e6fc,null))[_0xba9a('0x3d')](handleError(_0x36e6fc,null));};exports[_0xba9a('0x4f')]=function(_0x351be5,_0x5170c9,_0x356f1e){var _0x3f0d2b='';var _0xa63353=['id','name','assigned_user_id',_0xba9a('0x50'),_0xba9a('0x51'),'date_start',_0xba9a('0x52'),_0xba9a('0x53'),'parent_id',_0xba9a('0x54'),_0xba9a('0x55'),_0xba9a('0x56')];return db['SugarcrmAccount'][_0xba9a('0x45')]({'where':{'id':_0x351be5[_0xba9a('0x3e')]['id']},'attributes':['id',_0xba9a('0x57'),_0xba9a('0x58'),_0xba9a('0x59')]})[_0xba9a('0x22')](handleEntityNotFound(_0x5170c9,null))[_0xba9a('0x22')](function(_0x359d42){if(_0x359d42){_0x3f0d2b=_0x359d42[_0xba9a('0x59')];var _0x1c228e=_0x3f0d2b[_0xba9a('0x5a')](-0x1);if(_0x1c228e==='/'){_0x3f0d2b=_0x3f0d2b[_0xba9a('0x5b')](0x0,_0x3f0d2b['lastIndexOf'](_0x1c228e));}return rp({'method':_0xba9a('0x5c'),'uri':util[_0xba9a('0x5d')]('%s%s',_0x3f0d2b,_0xba9a('0x5e')),'json':!![],'form':{'method':_0xba9a('0x5f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xba9a('0x60')]({'user_auth':{'user_name':_0x359d42[_0xba9a('0x57')],'password':_0x359d42[_0xba9a('0x58')],'encryption':_0xba9a('0x61')},'application':_0xba9a('0x62')})}});}})['then'](function(_0x3b65a8){if(_0x3b65a8&&_0x3b65a8[_0xba9a('0x23')]!==_0xba9a('0x63')&&_0x3b65a8[_0xba9a('0x23')]!==_0xba9a('0x64')){return rp({'method':'POST','uri':util['format'](_0xba9a('0x65'),_0x3f0d2b,_0xba9a('0x5e')),'json':!![],'form':{'method':_0xba9a('0x66'),'input_type':_0xba9a('0x67'),'response_type':_0xba9a('0x67'),'rest_data':JSON[_0xba9a('0x60')]({'session':_0x3b65a8['id'],'module_name':_0xba9a('0x68')})}})['then'](function(_0x56642c){if(_0x56642c){var _0x520d4c=_[_0xba9a('0x69')](_0x56642c[_0xba9a('0x6a')]);_[_0xba9a('0x6b')](_0x520d4c,function(_0x4cbe22){return _0xa63353['includes'](_0x4cbe22[_0xba9a('0x23')]);});return{'count':_0x520d4c[_0xba9a('0x6c')],'rows':_[_0xba9a('0x26')](_0x520d4c,function(_0x2b3612){return{'id':_0x2b3612[_0xba9a('0x23')],'name':_0x2b3612['label'],'custom':_[_0xba9a('0x6d')](_0x2b3612['name'],'_c')?!![]:![],'options':_0x2b3612[_0xba9a('0x38')]?_['map'](_[_0xba9a('0x69')](_0x2b3612[_0xba9a('0x38')]),function(_0x376a1e){return{'name':_0x376a1e[_0xba9a('0x6e')],'value':_0x376a1e[_0xba9a('0x23')]};}):[]};})};}})[_0xba9a('0x22')](respondWithResult(_0x5170c9,null))[_0xba9a('0x3d')](function(_0x363f87){var _0x3427b5=_0x351be5[_0xba9a('0x28')]['test']?0x1f4:_0x363f87[_0xba9a('0x6f')]||0x1f4;logger[_0xba9a('0x70')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3427b5,JSON[_0xba9a('0x60')](_0x363f87));delete _0x363f87['name'];if(_0x3427b5===0x191){_0x3427b5=0x190;}_0x5170c9[_0xba9a('0x17')](_0x3427b5)[_0xba9a('0x24')](_0x351be5['query']['test']?{'message':_0xba9a('0x71'),'statusCode':_0x363f87[_0xba9a('0x6f')]}:_0x363f87);});}else{var _0xf7da87=0x1f4;_0x5170c9[_0xba9a('0x17')](_0xf7da87)[_0xba9a('0x24')]({'message':_0xba9a('0x71'),'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 dc9cacf..1506c7f 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 _0xd089=['int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0xd089,0x156));var _0x9d08=function(_0x303da0,_0x5d48d0){_0x303da0=_0x303da0-0x0;var _0x28d36f=_0xd089[_0x303da0];return _0x28d36f;};'use strict';var _=require(_0x9d08('0x0'));var util=require('util');var logger=require(_0x9d08('0x1'))(_0x9d08('0x2'));var moment=require(_0x9d08('0x3'));var BPromise=require(_0x9d08('0x4'));var rp=require(_0x9d08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d08('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x9d08('0x7')]=function(_0x113d1f,_0x3bec63){return _0x113d1f[_0x9d08('0x8')](_0x9d08('0x9'),attributes,{'tableName':_0x9d08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf019=['rimraf','../../config/environment','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x48341d,_0x183a78){var _0x1d73df=function(_0x57ed67){while(--_0x57ed67){_0x48341d['push'](_0x48341d['shift']());}};_0x1d73df(++_0x183a78);}(_0xf019,0x7b));var _0x9f01=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf019[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x9f01('0x0'));var util=require(_0x9f01('0x1'));var logger=require(_0x9f01('0x2'))(_0x9f01('0x3'));var moment=require('moment');var BPromise=require(_0x9f01('0x4'));var rp=require(_0x9f01('0x5'));var fs=require('fs');var path=require(_0x9f01('0x6'));var rimraf=require(_0x9f01('0x7'));var config=require(_0x9f01('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9f01('0x9')]=function(_0x593d7d,_0x1f6724){return _0x593d7d[_0x9f01('0xa')](_0x9f01('0xb'),attributes,{'tableName':_0x9f01('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 9847874..5affe78 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 _0xe12d=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','findAll','options','attributes','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','find','raw','lodash','util'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0xe12d,0xfa));var _0xde12=function(_0x2928ea,_0x4a554f){_0x2928ea=_0x2928ea-0x0;var _0x367c68=_0xe12d[_0x2928ea];return _0x367c68;};'use strict';var _=require(_0xde12('0x0'));var util=require(_0xde12('0x1'));var moment=require(_0xde12('0x2'));var BPromise=require(_0xde12('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde12('0x4'));var db=require(_0xde12('0x5'))['db'];var utils=require(_0xde12('0x6'));var logger=require(_0xde12('0x7'))(_0xde12('0x8'));var config=require(_0xde12('0x9'));var jayson=require(_0xde12('0xa'));var client=jayson[_0xde12('0xb')][_0xde12('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40fa22,_0x56aacf,_0x1881e3){return new BPromise(function(_0x55869b,_0x8f46c6){return client[_0xde12('0xd')](_0x40fa22,_0x1881e3)[_0xde12('0xe')](function(_0x423fbd){logger[_0xde12('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x56aacf,_0xde12('0x10'));logger[_0xde12('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x56aacf,_0xde12('0x10'),JSON[_0xde12('0x12')](_0x423fbd));if(_0x423fbd[_0xde12('0x13')]){if(_0x423fbd[_0xde12('0x13')][_0xde12('0x14')]===0x1f4){logger[_0xde12('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x56aacf,_0x423fbd[_0xde12('0x13')]['message']);return _0x8f46c6(_0x423fbd[_0xde12('0x13')]['message']);}logger['error'](_0xde12('0x15'),_0x56aacf,_0x423fbd[_0xde12('0x13')][_0xde12('0x16')]);return _0x55869b(_0x423fbd[_0xde12('0x13')][_0xde12('0x16')]);}else{logger[_0xde12('0xf')](_0xde12('0x15'),_0x56aacf,'request\x20sent');_0x55869b(_0x423fbd[_0xde12('0x17')][_0xde12('0x16')]);}})[_0xde12('0x18')](function(_0x1b46ed){logger['error'](_0xde12('0x15'),_0x56aacf,_0x1b46ed);_0x8f46c6(_0x1b46ed);});});}exports[_0xde12('0x19')]=function(_0x57d1d9){var _0x4d8548=this;return new Promise(function(_0x562cb1,_0x28b4a4){return db['SugarcrmAccount'][_0xde12('0x1a')]({'raw':_0x57d1d9['options']?_0x57d1d9[_0xde12('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x57d1d9[_0xde12('0x1b')]?_0x57d1d9[_0xde12('0x1b')]['where']||null:null,'attributes':_0x57d1d9[_0xde12('0x1b')]?_0x57d1d9[_0xde12('0x1b')][_0xde12('0x1c')]||null:null,'limit':_0x57d1d9[_0xde12('0x1b')]?_0x57d1d9[_0xde12('0x1b')]['limit']||null:null,'include':_0x57d1d9[_0xde12('0x1b')]?_0x57d1d9[_0xde12('0x1b')][_0xde12('0x1d')]?_[_0xde12('0x1e')](_0x57d1d9[_0xde12('0x1b')][_0xde12('0x1d')],function(_0x558850){return{'model':db[_0x558850[_0xde12('0x1f')]],'as':_0x558850['as'],'attributes':_0x558850['attributes'],'include':_0x558850['include']?_['map'](_0x558850[_0xde12('0x1d')],function(_0x4fe892){return{'model':db[_0x4fe892[_0xde12('0x1f')]],'as':_0x4fe892['as'],'attributes':_0x4fe892[_0xde12('0x1c')],'include':_0x4fe892[_0xde12('0x1d')]?_[_0xde12('0x1e')](_0x4fe892[_0xde12('0x1d')],function(_0x48d4c8){return{'model':db[_0x48d4c8['model']],'as':_0x48d4c8['as'],'attributes':_0x48d4c8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a0012){logger[_0xde12('0xf')](_0xde12('0x19'),_0x57d1d9);logger[_0xde12('0x11')](_0xde12('0x19'),_0x57d1d9,JSON['stringify'](_0x3a0012));_0x562cb1(_0x3a0012);})[_0xde12('0x18')](function(_0x4e6fa6){logger[_0xde12('0x13')]('GetSugarcrmAccount',_0x4e6fa6['message'],_0x57d1d9);_0x28b4a4(_0x4d8548[_0xde12('0x13')](0x1f4,_0x4e6fa6['message']));});});};exports[_0xde12('0x20')]=function(_0x5e097a){var _0x4a1dc7=this;return new Promise(function(_0x14e905,_0x3c01f0){return db[_0xde12('0x21')][_0xde12('0x22')]({'raw':_0x5e097a[_0xde12('0x1b')]?_0x5e097a[_0xde12('0x1b')][_0xde12('0x23')]===undefined?!![]:![]:!![],'where':_0x5e097a['options']?_0x5e097a[_0xde12('0x1b')]['where']||null:null,'attributes':_0x5e097a[_0xde12('0x1b')]?_0x5e097a['options'][_0xde12('0x1c')]||null:null,'include':_0x5e097a[_0xde12('0x1b')]?_0x5e097a[_0xde12('0x1b')][_0xde12('0x1d')]?_[_0xde12('0x1e')](_0x5e097a['options']['include'],function(_0x19912b){return{'model':db[_0x19912b[_0xde12('0x1f')]],'as':_0x19912b['as'],'attributes':_0x19912b[_0xde12('0x1c')],'include':_0x19912b[_0xde12('0x1d')]?_[_0xde12('0x1e')](_0x19912b[_0xde12('0x1d')],function(_0x9dec24){return{'model':db[_0x9dec24['model']],'as':_0x9dec24['as'],'attributes':_0x9dec24['attributes'],'include':_0x9dec24[_0xde12('0x1d')]?_[_0xde12('0x1e')](_0x9dec24['include'],function(_0x2d6430){return{'model':db[_0x2d6430[_0xde12('0x1f')]],'as':_0x2d6430['as'],'attributes':_0x2d6430[_0xde12('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xde12('0xe')](function(_0x2972fd){logger['info'](_0xde12('0x20'),_0x5e097a);logger[_0xde12('0x11')]('ShowSugarcrmAccount',_0x5e097a,JSON[_0xde12('0x12')](_0x2972fd));_0x14e905(_0x2972fd);})[_0xde12('0x18')](function(_0x4d8f99){logger[_0xde12('0x13')](_0xde12('0x20'),_0x4d8f99['message'],_0x5e097a);_0x3c01f0(_0x4a1dc7[_0xde12('0x13')](0x1f4,_0x4d8f99['message']));});});}; \ No newline at end of file +var _0x9629=['debug','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowSugarcrmAccount','find'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9629,0x161));var _0x9962=function(_0x1551e3,_0x4dc0ee){_0x1551e3=_0x1551e3-0x0;var _0x35bdfb=_0x9629[_0x1551e3];return _0x35bdfb;};'use strict';var _=require(_0x9962('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9962('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9962('0x2'));var logger=require(_0x9962('0x3'))(_0x9962('0x4'));var config=require(_0x9962('0x5'));var jayson=require(_0x9962('0x6'));var client=jayson['client'][_0x9962('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ded1d,_0x1f52db,_0x1f5cb8){return new BPromise(function(_0x5755d0,_0x236510){return client[_0x9962('0x8')](_0x4ded1d,_0x1f5cb8)[_0x9962('0x9')](function(_0x5db8c2){logger[_0x9962('0xa')](_0x9962('0xb'),_0x1f52db,_0x9962('0xc'));logger['debug'](_0x9962('0xd'),_0x1f52db,_0x9962('0xc'),JSON[_0x9962('0xe')](_0x5db8c2));if(_0x5db8c2[_0x9962('0xf')]){if(_0x5db8c2['error']['code']===0x1f4){logger[_0x9962('0xf')](_0x9962('0xb'),_0x1f52db,_0x5db8c2[_0x9962('0xf')][_0x9962('0x10')]);return _0x236510(_0x5db8c2[_0x9962('0xf')][_0x9962('0x10')]);}logger[_0x9962('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f52db,_0x5db8c2[_0x9962('0xf')][_0x9962('0x10')]);return _0x5755d0(_0x5db8c2[_0x9962('0xf')]['message']);}else{logger['info'](_0x9962('0xb'),_0x1f52db,'request\x20sent');_0x5755d0(_0x5db8c2[_0x9962('0x11')][_0x9962('0x10')]);}})['catch'](function(_0x4c9b2a){logger[_0x9962('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f52db,_0x4c9b2a);_0x236510(_0x4c9b2a);});});}exports[_0x9962('0x12')]=function(_0x32ab2f){var _0x589da7=this;return new Promise(function(_0x1d4c53,_0x49336e){return db[_0x9962('0x13')]['findAll']({'raw':_0x32ab2f[_0x9962('0x14')]?_0x32ab2f[_0x9962('0x14')][_0x9962('0x15')]===undefined?!![]:![]:!![],'where':_0x32ab2f[_0x9962('0x14')]?_0x32ab2f[_0x9962('0x14')][_0x9962('0x16')]||null:null,'attributes':_0x32ab2f[_0x9962('0x14')]?_0x32ab2f[_0x9962('0x14')][_0x9962('0x17')]||null:null,'limit':_0x32ab2f[_0x9962('0x14')]?_0x32ab2f[_0x9962('0x14')][_0x9962('0x18')]||null:null,'include':_0x32ab2f[_0x9962('0x14')]?_0x32ab2f[_0x9962('0x14')][_0x9962('0x19')]?_[_0x9962('0x1a')](_0x32ab2f[_0x9962('0x14')][_0x9962('0x19')],function(_0x38b9a9){return{'model':db[_0x38b9a9['model']],'as':_0x38b9a9['as'],'attributes':_0x38b9a9['attributes'],'include':_0x38b9a9[_0x9962('0x19')]?_[_0x9962('0x1a')](_0x38b9a9[_0x9962('0x19')],function(_0x4cf628){return{'model':db[_0x4cf628[_0x9962('0x1b')]],'as':_0x4cf628['as'],'attributes':_0x4cf628[_0x9962('0x17')],'include':_0x4cf628[_0x9962('0x19')]?_[_0x9962('0x1a')](_0x4cf628['include'],function(_0x193550){return{'model':db[_0x193550[_0x9962('0x1b')]],'as':_0x193550['as'],'attributes':_0x193550[_0x9962('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9962('0x9')](function(_0x38f645){logger[_0x9962('0xa')](_0x9962('0x12'),_0x32ab2f);logger['debug'](_0x9962('0x12'),_0x32ab2f,JSON['stringify'](_0x38f645));_0x1d4c53(_0x38f645);})[_0x9962('0x1c')](function(_0x4ef987){logger['error'](_0x9962('0x12'),_0x4ef987[_0x9962('0x10')],_0x32ab2f);_0x49336e(_0x589da7[_0x9962('0xf')](0x1f4,_0x4ef987[_0x9962('0x10')]));});});};exports[_0x9962('0x1d')]=function(_0x2dbc5c){var _0x530b79=this;return new Promise(function(_0x451d72,_0x3d7174){return db[_0x9962('0x13')][_0x9962('0x1e')]({'raw':_0x2dbc5c['options']?_0x2dbc5c[_0x9962('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2dbc5c[_0x9962('0x14')]?_0x2dbc5c[_0x9962('0x14')][_0x9962('0x16')]||null:null,'attributes':_0x2dbc5c[_0x9962('0x14')]?_0x2dbc5c[_0x9962('0x14')]['attributes']||null:null,'include':_0x2dbc5c[_0x9962('0x14')]?_0x2dbc5c[_0x9962('0x14')]['include']?_['map'](_0x2dbc5c[_0x9962('0x14')][_0x9962('0x19')],function(_0x64bf6b){return{'model':db[_0x64bf6b[_0x9962('0x1b')]],'as':_0x64bf6b['as'],'attributes':_0x64bf6b[_0x9962('0x17')],'include':_0x64bf6b[_0x9962('0x19')]?_[_0x9962('0x1a')](_0x64bf6b[_0x9962('0x19')],function(_0x2d787c){return{'model':db[_0x2d787c[_0x9962('0x1b')]],'as':_0x2d787c['as'],'attributes':_0x2d787c['attributes'],'include':_0x2d787c[_0x9962('0x19')]?_['map'](_0x2d787c[_0x9962('0x19')],function(_0x2d5af5){return{'model':db[_0x2d5af5['model']],'as':_0x2d5af5['as'],'attributes':_0x2d5af5[_0x9962('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9962('0x9')](function(_0x30d5c1){logger[_0x9962('0xa')](_0x9962('0x1d'),_0x2dbc5c);logger[_0x9962('0x1f')](_0x9962('0x1d'),_0x2dbc5c,JSON[_0x9962('0xe')](_0x30d5c1));_0x451d72(_0x30d5c1);})[_0x9962('0x1c')](function(_0x20020f){logger['error'](_0x9962('0x1d'),_0x20020f[_0x9962('0x10')],_0x2dbc5c);_0x3d7174(_0x530b79['error'](0x1f4,_0x20020f[_0x9962('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1e731bd..770992e 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 _0x4dfc=['/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x5c7384,_0x243984){var _0x3e8c1d=function(_0x487a5c){while(--_0x487a5c){_0x5c7384['push'](_0x5c7384['shift']());}};_0x3e8c1d(++_0x243984);}(_0x4dfc,0x1e0));var _0xc4df=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x4dfc[_0x382e89];return _0x3a1318;};'use strict';var multer=require(_0xc4df('0x0'));var util=require('util');var path=require(_0xc4df('0x1'));var timeout=require(_0xc4df('0x2'));var express=require(_0xc4df('0x3'));var router=express[_0xc4df('0x4')]();var fs_extra=require(_0xc4df('0x5'));var auth=require(_0xc4df('0x6'));var interaction=require(_0xc4df('0x7'));var config=require(_0xc4df('0x8'));var controller=require(_0xc4df('0x9'));router[_0xc4df('0xa')]('/',auth[_0xc4df('0xb')](),controller[_0xc4df('0xc')]);router[_0xc4df('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc4df('0xd')]);router[_0xc4df('0xa')](_0xc4df('0xe'),auth[_0xc4df('0xb')](),controller[_0xc4df('0xf')]);router[_0xc4df('0xa')]('/:id/subjects',auth[_0xc4df('0xb')](),controller[_0xc4df('0x10')]);router[_0xc4df('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xc4df('0x11')]);router[_0xc4df('0x12')]('/',auth[_0xc4df('0xb')](),controller[_0xc4df('0x13')]);router[_0xc4df('0x14')](_0xc4df('0x15'),auth[_0xc4df('0xb')](),controller[_0xc4df('0x16')]);router[_0xc4df('0x17')](_0xc4df('0x15'),auth[_0xc4df('0xb')](),controller[_0xc4df('0x18')]);module[_0xc4df('0x19')]=router; \ No newline at end of file +var _0x01f6=['delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x3ccac1,_0x5cc7ea){var _0x10b20b=function(_0x4ed4f5){while(--_0x4ed4f5){_0x3ccac1['push'](_0x3ccac1['shift']());}};_0x10b20b(++_0x5cc7ea);}(_0x01f6,0x1e5));var _0x601f=function(_0x590ef3,_0x3b2dd2){_0x590ef3=_0x590ef3-0x0;var _0x4502be=_0x01f6[_0x590ef3];return _0x4502be;};'use strict';var multer=require(_0x601f('0x0'));var util=require(_0x601f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x601f('0x2'));var router=express[_0x601f('0x3')]();var fs_extra=require(_0x601f('0x4'));var auth=require(_0x601f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x601f('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x601f('0x7')]('/',auth[_0x601f('0x8')](),controller['index']);router[_0x601f('0x7')](_0x601f('0x9'),auth['isAuthenticated'](),controller[_0x601f('0xa')]);router[_0x601f('0x7')](_0x601f('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x601f('0x7')](_0x601f('0xc'),auth[_0x601f('0x8')](),controller[_0x601f('0xd')]);router[_0x601f('0x7')](_0x601f('0xe'),auth[_0x601f('0x8')](),controller[_0x601f('0xf')]);router[_0x601f('0x10')]('/',auth[_0x601f('0x8')](),controller[_0x601f('0x11')]);router['put'](_0x601f('0x9'),auth['isAuthenticated'](),controller[_0x601f('0x12')]);router[_0x601f('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x601f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9b65121..cd81232 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 _0xca53=['STRING','sequelize','exports'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0xca53,0x88));var _0x3ca5=function(_0x5cb4f0,_0xb16665){_0x5cb4f0=_0x5cb4f0-0x0;var _0x22208=_0xca53[_0x5cb4f0];return _0x22208;};'use strict';var Sequelize=require(_0x3ca5('0x0'));module[_0x3ca5('0x1')]={'name':{'type':Sequelize[_0x3ca5('0x2')]},'description':{'type':Sequelize[_0x3ca5('0x2')]}}; \ No newline at end of file +var _0xfaf1=['exports','STRING','sequelize'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xfaf1,0x1f1));var _0x1faf=function(_0x5620c0,_0x49a8aa){_0x5620c0=_0x5620c0-0x0;var _0x3eaea0=_0xfaf1[_0x5620c0];return _0x3eaea0;};'use strict';var Sequelize=require(_0x1faf('0x0'));module[_0x1faf('0x1')]={'name':{'type':Sequelize[_0x1faf('0x2')]},'description':{'type':Sequelize[_0x1faf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f20de18..b0bd9b3 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 _0x5c2e=['util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','SugarcrmConfiguration','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','create','body','find','destroy','getFields','SugarcrmField','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x2587b6,_0x77b30d){var _0x465a2b=function(_0x288f70){while(--_0x288f70){_0x2587b6['push'](_0x2587b6['shift']());}};_0x465a2b(++_0x77b30d);}(_0x5c2e,0x190));var _0xe5c2=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x5c2e[_0x1ba43c];return _0x2f60eb;};'use strict';var emlformat=require(_0xe5c2('0x0'));var rimraf=require(_0xe5c2('0x1'));var zipdir=require(_0xe5c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5c2('0x3'));var moment=require(_0xe5c2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe5c2('0x5'));var path=require(_0xe5c2('0x6'));var sox=require(_0xe5c2('0x7'));var csv=require(_0xe5c2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5c2('0x9'));var _=require('lodash');var squel=require(_0xe5c2('0xa'));var crypto=require('crypto');var jsforce=require(_0xe5c2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe5c2('0x8'));var querystring=require(_0xe5c2('0xc'));var Papa=require(_0xe5c2('0xd'));var Redis=require('ioredis');var authService=require(_0xe5c2('0xe'));var qs=require(_0xe5c2('0xf'));var as=require(_0xe5c2('0x10'));var hardwareService=require(_0xe5c2('0x11'));var logger=require(_0xe5c2('0x12'))(_0xe5c2('0x13'));var utils=require('../../config/utils');var config=require(_0xe5c2('0x14'));var licenseUtil=require(_0xe5c2('0x15'));var db=require(_0xe5c2('0x16'))['db'];function respondWithStatusCode(_0xc49bb5,_0x37f1d5){_0x37f1d5=_0x37f1d5||0xcc;return function(_0x15550f){if(_0x15550f){return _0xc49bb5[_0xe5c2('0x17')](_0x37f1d5);}return _0xc49bb5[_0xe5c2('0x18')](_0x37f1d5)[_0xe5c2('0x19')]();};}function respondWithResult(_0x1c984b,_0x326291){_0x326291=_0x326291||0xc8;return function(_0x2d23ff){if(_0x2d23ff){return _0x1c984b[_0xe5c2('0x18')](_0x326291)['json'](_0x2d23ff);}};}function respondWithFilteredResult(_0x5189b0,_0x358fff){return function(_0x5d36a9){if(_0x5d36a9){var _0xc17e69=typeof _0x358fff[_0xe5c2('0x1a')]===_0xe5c2('0x1b')&&typeof _0x358fff[_0xe5c2('0x1c')]==='undefined';var _0x91d274=_0x5d36a9[_0xe5c2('0x1d')];var _0x282933=_0xc17e69?0x0:_0x358fff[_0xe5c2('0x1a')];var _0x3f6b64=_0xc17e69?_0x5d36a9[_0xe5c2('0x1d')]:_0x358fff[_0xe5c2('0x1a')]+_0x358fff[_0xe5c2('0x1c')];var _0x4dcc76;if(_0x3f6b64>=_0x91d274){_0x3f6b64=_0x91d274;_0x4dcc76=0xc8;}else{_0x4dcc76=0xce;}_0x5189b0[_0xe5c2('0x18')](_0x4dcc76);return _0x5189b0[_0xe5c2('0x1e')](_0xe5c2('0x1f'),_0x282933+'-'+_0x3f6b64+'/'+_0x91d274)[_0xe5c2('0x20')](_0x5d36a9);}return null;};}function patchUpdates(_0x376edd){return function(_0x176403){try{jsonpatch[_0xe5c2('0x21')](_0x176403,_0x376edd,!![]);}catch(_0x56f6ad){return BPromise[_0xe5c2('0x22')](_0x56f6ad);}return _0x176403[_0xe5c2('0x23')]();};}function saveUpdates(_0x5355dd,_0x862353){return function(_0x2bcdd8){if(_0x2bcdd8){return _0x2bcdd8[_0xe5c2('0x24')](_0x5355dd)[_0xe5c2('0x25')](function(_0x13f4f9){return _0x13f4f9;});}return null;};}function removeEntity(_0x2a3179,_0x349420){return function(_0x233056){if(_0x233056){return _0x233056['destroy']()[_0xe5c2('0x25')](function(){_0x2a3179[_0xe5c2('0x18')](0xcc)[_0xe5c2('0x19')]();});}};}function handleEntityNotFound(_0x11bbb7,_0x4dd0bc){return function(_0x2eca57){if(!_0x2eca57){_0x11bbb7['sendStatus'](0x194);}return _0x2eca57;};}function handleError(_0x5ce7bc,_0x39ae12){_0x39ae12=_0x39ae12||0x1f4;return function(_0x5c3532){logger[_0xe5c2('0x26')](_0x5c3532[_0xe5c2('0x27')]);if(_0x5c3532[_0xe5c2('0x28')]){delete _0x5c3532[_0xe5c2('0x28')];}_0x5ce7bc[_0xe5c2('0x18')](_0x39ae12)[_0xe5c2('0x29')](_0x5c3532);};}exports[_0xe5c2('0x2a')]=function(_0x54624d,_0x23aa73){var _0x225a66={},_0x16ad7e={},_0x393908={'count':0x0,'rows':[]};var _0x8751b9=_['map'](db[_0xe5c2('0x2b')]['rawAttributes'],function(_0x574cdf){return{'name':_0x574cdf[_0xe5c2('0x2c')],'type':_0x574cdf[_0xe5c2('0x2d')][_0xe5c2('0x2e')]};});_0x16ad7e['model']=_['map'](_0x8751b9,_0xe5c2('0x28'));_0x16ad7e[_0xe5c2('0x2f')]=_[_0xe5c2('0x30')](_0x54624d[_0xe5c2('0x2f')]);_0x16ad7e['filters']=_[_0xe5c2('0x31')](_0x16ad7e['model'],_0x16ad7e[_0xe5c2('0x2f')]);_0x225a66[_0xe5c2('0x32')]=_['intersection'](_0x16ad7e[_0xe5c2('0x33')],qs[_0xe5c2('0x34')](_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x34')]));_0x225a66[_0xe5c2('0x32')]=_0x225a66[_0xe5c2('0x32')][_0xe5c2('0x35')]?_0x225a66[_0xe5c2('0x32')]:_0x16ad7e['model'];if(!_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x36')](_0xe5c2('0x37'))){_0x225a66[_0xe5c2('0x1c')]=qs[_0xe5c2('0x1c')](_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x1c')]);_0x225a66[_0xe5c2('0x1a')]=qs[_0xe5c2('0x1a')](_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x1a')]);}_0x225a66['order']=qs[_0xe5c2('0x38')](_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x38')]);_0x225a66[_0xe5c2('0x39')]=qs[_0xe5c2('0x3a')](_[_0xe5c2('0x3b')](_0x54624d['query'],_0x16ad7e[_0xe5c2('0x3a')]),_0x8751b9);if(_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x3c')]){_0x225a66[_0xe5c2('0x39')]=_['merge'](_0x225a66[_0xe5c2('0x39')],{'$or':_[_0xe5c2('0x3d')](_0x8751b9,function(_0x5b17ba){if(_0x5b17ba['type']!=='VIRTUAL'){var _0x5d7802={};_0x5d7802[_0x5b17ba[_0xe5c2('0x28')]]={'$like':'%'+_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x3c')]+'%'};return _0x5d7802;}})});}_0x225a66=_[_0xe5c2('0x3e')]({},_0x225a66,_0x54624d['options']);var _0x43f571={'where':_0x225a66['where']};return db[_0xe5c2('0x2b')]['count'](_0x43f571)[_0xe5c2('0x25')](function(_0x1d25bc){_0x393908[_0xe5c2('0x1d')]=_0x1d25bc;if(_0x54624d[_0xe5c2('0x2f')][_0xe5c2('0x3f')]){_0x225a66[_0xe5c2('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x225a66);})[_0xe5c2('0x25')](function(_0x4284c5){_0x393908[_0xe5c2('0x41')]=_0x4284c5;return _0x393908;})[_0xe5c2('0x25')](respondWithFilteredResult(_0x23aa73,_0x225a66))[_0xe5c2('0x42')](handleError(_0x23aa73,null));};exports[_0xe5c2('0x43')]=function(_0x30ef11,_0x38a96e){var _0x12e0cb={'raw':![],'where':{'id':_0x30ef11[_0xe5c2('0x44')]['id']}},_0x163437={};_0x163437['model']=_[_0xe5c2('0x30')](db[_0xe5c2('0x2b')][_0xe5c2('0x45')]);_0x163437[_0xe5c2('0x2f')]=_[_0xe5c2('0x30')](_0x30ef11[_0xe5c2('0x2f')]);_0x163437[_0xe5c2('0x3a')]=_[_0xe5c2('0x31')](_0x163437[_0xe5c2('0x33')],_0x163437[_0xe5c2('0x2f')]);_0x12e0cb[_0xe5c2('0x32')]=_['intersection'](_0x163437[_0xe5c2('0x33')],qs['fields'](_0x30ef11['query'][_0xe5c2('0x34')]));_0x12e0cb[_0xe5c2('0x32')]=_0x12e0cb[_0xe5c2('0x32')][_0xe5c2('0x35')]?_0x12e0cb[_0xe5c2('0x32')]:_0x163437[_0xe5c2('0x33')];if(_0x30ef11[_0xe5c2('0x2f')][_0xe5c2('0x3f')]){_0x12e0cb[_0xe5c2('0x40')]=[{'all':!![]}];}_0x12e0cb=_['merge']({},_0x12e0cb,_0x30ef11[_0xe5c2('0x46')]);return db['SugarcrmConfiguration']['find'](_0x12e0cb)['then'](handleEntityNotFound(_0x38a96e,null))[_0xe5c2('0x25')](respondWithResult(_0x38a96e,null))[_0xe5c2('0x42')](handleError(_0x38a96e,null));};exports[_0xe5c2('0x47')]=function(_0xc816f,_0xb792f1){return db['SugarcrmConfiguration'][_0xe5c2('0x47')](_0xc816f['body'],{})['then'](respondWithResult(_0xb792f1,0xc9))[_0xe5c2('0x42')](handleError(_0xb792f1,null));};exports['update']=function(_0x2f355e,_0x1ee6b3){if(_0x2f355e[_0xe5c2('0x48')]['id']){delete _0x2f355e['body']['id'];}return db['SugarcrmConfiguration'][_0xe5c2('0x49')]({'where':{'id':_0x2f355e[_0xe5c2('0x44')]['id']}})[_0xe5c2('0x25')](handleEntityNotFound(_0x1ee6b3,null))[_0xe5c2('0x25')](saveUpdates(_0x2f355e[_0xe5c2('0x48')],null))[_0xe5c2('0x25')](respondWithResult(_0x1ee6b3,null))['catch'](handleError(_0x1ee6b3,null));};exports[_0xe5c2('0x4a')]=function(_0x261637,_0xf34806){return db['SugarcrmConfiguration'][_0xe5c2('0x49')]({'where':{'id':_0x261637[_0xe5c2('0x44')]['id']}})[_0xe5c2('0x25')](handleEntityNotFound(_0xf34806,null))[_0xe5c2('0x25')](removeEntity(_0xf34806,null))[_0xe5c2('0x42')](handleError(_0xf34806,null));};exports[_0xe5c2('0x4b')]=function(_0x9973cf,_0x87df2c,_0x170497){var _0x1b3e87={};var _0x486add={};var _0x227042;var _0x1fa390;return db[_0xe5c2('0x2b')]['findOne']({'where':{'id':_0x9973cf[_0xe5c2('0x44')]['id']}})[_0xe5c2('0x25')](handleEntityNotFound(_0x87df2c,null))[_0xe5c2('0x25')](function(_0x1457f1){if(_0x1457f1){_0x227042=_0x1457f1;_0x486add[_0xe5c2('0x33')]=_['keys'](db[_0xe5c2('0x4c')][_0xe5c2('0x45')]);_0x486add[_0xe5c2('0x2f')]=_[_0xe5c2('0x30')](_0x9973cf[_0xe5c2('0x2f')]);_0x486add[_0xe5c2('0x3a')]=_[_0xe5c2('0x31')](_0x486add['model'],_0x486add[_0xe5c2('0x2f')]);_0x1b3e87[_0xe5c2('0x32')]=_[_0xe5c2('0x31')](_0x486add[_0xe5c2('0x33')],qs[_0xe5c2('0x34')](_0x9973cf[_0xe5c2('0x2f')]['fields']));_0x1b3e87[_0xe5c2('0x32')]=_0x1b3e87['attributes'][_0xe5c2('0x35')]?_0x1b3e87['attributes']:_0x486add[_0xe5c2('0x33')];_0x1b3e87[_0xe5c2('0x4d')]=qs[_0xe5c2('0x38')](_0x9973cf[_0xe5c2('0x2f')][_0xe5c2('0x38')]);_0x1b3e87['where']=qs[_0xe5c2('0x3a')](_['pick'](_0x9973cf[_0xe5c2('0x2f')],_0x486add[_0xe5c2('0x3a')]));if(_0x9973cf[_0xe5c2('0x2f')][_0xe5c2('0x3c')]){_0x1b3e87[_0xe5c2('0x39')]=_[_0xe5c2('0x3e')](_0x1b3e87[_0xe5c2('0x39')],{'$or':_[_0xe5c2('0x3d')](_0x1b3e87[_0xe5c2('0x32')],function(_0x2e93c1){var _0x5c419a={};_0x5c419a[_0x2e93c1]={'$like':'%'+_0x9973cf['query']['filter']+'%'};return _0x5c419a;})});}_0x1b3e87=_['merge']({},_0x1b3e87,_0x9973cf[_0xe5c2('0x46')]);return _0x227042[_0xe5c2('0x4b')](_0x1b3e87);}})[_0xe5c2('0x25')](function(_0x1b5256){if(_0x1b5256){_0x1fa390=_0x1b5256['length'];if(!_0x9973cf['query'][_0xe5c2('0x36')](_0xe5c2('0x37'))){_0x1b3e87[_0xe5c2('0x1c')]=qs[_0xe5c2('0x1c')](_0x9973cf[_0xe5c2('0x2f')][_0xe5c2('0x1c')]);_0x1b3e87[_0xe5c2('0x1a')]=qs[_0xe5c2('0x1a')](_0x9973cf['query'][_0xe5c2('0x1a')]);}return _0x227042['getFields'](_0x1b3e87);}})[_0xe5c2('0x25')](function(_0x58cf49){if(_0x58cf49){return _0x58cf49?{'count':_0x1fa390,'rows':_0x58cf49}:null;}})['then'](respondWithResult(_0x87df2c,null))[_0xe5c2('0x42')](handleError(_0x87df2c,null));};exports[_0xe5c2('0x4e')]=function(_0x41ba4f,_0x240ffe,_0x615650){var _0x229e4f={};var _0x1c2a14={};var _0x3ca80a;var _0x142b13;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x41ba4f['params']['id']}})[_0xe5c2('0x25')](handleEntityNotFound(_0x240ffe,null))['then'](function(_0x221af6){if(_0x221af6){_0x3ca80a=_0x221af6;_0x1c2a14[_0xe5c2('0x33')]=_['keys'](db[_0xe5c2('0x4c')][_0xe5c2('0x45')]);_0x1c2a14['query']=_['keys'](_0x41ba4f[_0xe5c2('0x2f')]);_0x1c2a14[_0xe5c2('0x3a')]=_[_0xe5c2('0x31')](_0x1c2a14[_0xe5c2('0x33')],_0x1c2a14[_0xe5c2('0x2f')]);_0x229e4f[_0xe5c2('0x32')]=_[_0xe5c2('0x31')](_0x1c2a14[_0xe5c2('0x33')],qs[_0xe5c2('0x34')](_0x41ba4f[_0xe5c2('0x2f')][_0xe5c2('0x34')]));_0x229e4f[_0xe5c2('0x32')]=_0x229e4f[_0xe5c2('0x32')][_0xe5c2('0x35')]?_0x229e4f[_0xe5c2('0x32')]:_0x1c2a14[_0xe5c2('0x33')];_0x229e4f['order']=qs[_0xe5c2('0x38')](_0x41ba4f['query']['sort']);_0x229e4f[_0xe5c2('0x39')]=qs[_0xe5c2('0x3a')](_[_0xe5c2('0x3b')](_0x41ba4f[_0xe5c2('0x2f')],_0x1c2a14[_0xe5c2('0x3a')]));if(_0x41ba4f[_0xe5c2('0x2f')][_0xe5c2('0x3c')]){_0x229e4f['where']=_[_0xe5c2('0x3e')](_0x229e4f[_0xe5c2('0x39')],{'$or':_['map'](_0x229e4f[_0xe5c2('0x32')],function(_0x1e4e15){var _0x24fb4a={};_0x24fb4a[_0x1e4e15]={'$like':'%'+_0x41ba4f[_0xe5c2('0x2f')][_0xe5c2('0x3c')]+'%'};return _0x24fb4a;})});}_0x229e4f=_[_0xe5c2('0x3e')]({},_0x229e4f,_0x41ba4f[_0xe5c2('0x46')]);return _0x3ca80a[_0xe5c2('0x4e')](_0x229e4f);}})[_0xe5c2('0x25')](function(_0x1e91bd){if(_0x1e91bd){_0x142b13=_0x1e91bd[_0xe5c2('0x35')];if(!_0x41ba4f[_0xe5c2('0x2f')][_0xe5c2('0x36')](_0xe5c2('0x37'))){_0x229e4f[_0xe5c2('0x1c')]=qs['limit'](_0x41ba4f[_0xe5c2('0x2f')]['limit']);_0x229e4f[_0xe5c2('0x1a')]=qs[_0xe5c2('0x1a')](_0x41ba4f['query'][_0xe5c2('0x1a')]);}return _0x3ca80a[_0xe5c2('0x4e')](_0x229e4f);}})[_0xe5c2('0x25')](function(_0x92a0cc){if(_0x92a0cc){return _0x92a0cc?{'count':_0x142b13,'rows':_0x92a0cc}:null;}})[_0xe5c2('0x25')](respondWithResult(_0x240ffe,null))[_0xe5c2('0x42')](handleError(_0x240ffe,null));};exports['getDescriptions']=function(_0x2180c1,_0x442ecd,_0x3f3604){var _0x43cc3d={};var _0x342078={};var _0x388d54;var _0xc764b9;return db[_0xe5c2('0x2b')][_0xe5c2('0x4f')]({'where':{'id':_0x2180c1[_0xe5c2('0x44')]['id']}})[_0xe5c2('0x25')](handleEntityNotFound(_0x442ecd,null))[_0xe5c2('0x25')](function(_0x5428a4){if(_0x5428a4){_0x388d54=_0x5428a4;_0x342078[_0xe5c2('0x33')]=_[_0xe5c2('0x30')](db[_0xe5c2('0x4c')][_0xe5c2('0x45')]);_0x342078[_0xe5c2('0x2f')]=_['keys'](_0x2180c1[_0xe5c2('0x2f')]);_0x342078['filters']=_[_0xe5c2('0x31')](_0x342078['model'],_0x342078[_0xe5c2('0x2f')]);_0x43cc3d['attributes']=_[_0xe5c2('0x31')](_0x342078[_0xe5c2('0x33')],qs['fields'](_0x2180c1['query']['fields']));_0x43cc3d[_0xe5c2('0x32')]=_0x43cc3d['attributes'][_0xe5c2('0x35')]?_0x43cc3d[_0xe5c2('0x32')]:_0x342078['model'];_0x43cc3d[_0xe5c2('0x4d')]=qs[_0xe5c2('0x38')](_0x2180c1[_0xe5c2('0x2f')][_0xe5c2('0x38')]);_0x43cc3d[_0xe5c2('0x39')]=qs[_0xe5c2('0x3a')](_['pick'](_0x2180c1['query'],_0x342078[_0xe5c2('0x3a')]));if(_0x2180c1[_0xe5c2('0x2f')][_0xe5c2('0x3c')]){_0x43cc3d[_0xe5c2('0x39')]=_[_0xe5c2('0x3e')](_0x43cc3d[_0xe5c2('0x39')],{'$or':_[_0xe5c2('0x3d')](_0x43cc3d[_0xe5c2('0x32')],function(_0x57f9be){var _0x246951={};_0x246951[_0x57f9be]={'$like':'%'+_0x2180c1[_0xe5c2('0x2f')]['filter']+'%'};return _0x246951;})});}_0x43cc3d=_[_0xe5c2('0x3e')]({},_0x43cc3d,_0x2180c1['options']);return _0x388d54[_0xe5c2('0x50')](_0x43cc3d);}})['then'](function(_0x1f8224){if(_0x1f8224){_0xc764b9=_0x1f8224[_0xe5c2('0x35')];if(!_0x2180c1[_0xe5c2('0x2f')][_0xe5c2('0x36')](_0xe5c2('0x37'))){_0x43cc3d[_0xe5c2('0x1c')]=qs[_0xe5c2('0x1c')](_0x2180c1['query'][_0xe5c2('0x1c')]);_0x43cc3d['offset']=qs[_0xe5c2('0x1a')](_0x2180c1[_0xe5c2('0x2f')][_0xe5c2('0x1a')]);}return _0x388d54[_0xe5c2('0x50')](_0x43cc3d);}})['then'](function(_0x491242){if(_0x491242){return _0x491242?{'count':_0xc764b9,'rows':_0x491242}:null;}})[_0xe5c2('0x25')](respondWithResult(_0x442ecd,null))['catch'](handleError(_0x442ecd,null));}; \ No newline at end of file +var _0x47b9=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','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','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','map','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','SugarcrmField','getFields','getSubjects','findOne','getDescriptions'];(function(_0x1e0764,_0x2fd8d5){var _0x307faf=function(_0x284540){while(--_0x284540){_0x1e0764['push'](_0x1e0764['shift']());}};_0x307faf(++_0x2fd8d5);}(_0x47b9,0xa2));var _0x947b=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x47b9[_0x221b8c];return _0x3fab9f;};'use strict';var emlformat=require(_0x947b('0x0'));var rimraf=require(_0x947b('0x1'));var zipdir=require(_0x947b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x947b('0x3'));var moment=require(_0x947b('0x4'));var BPromise=require(_0x947b('0x5'));var Mustache=require('mustache');var util=require(_0x947b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x947b('0x7'));var fs=require('fs');var fs_extra=require(_0x947b('0x8'));var _=require(_0x947b('0x9'));var squel=require(_0x947b('0xa'));var crypto=require(_0x947b('0xb'));var jsforce=require(_0x947b('0xc'));var deskjs=require(_0x947b('0xd'));var toCsv=require(_0x947b('0xe'));var querystring=require(_0x947b('0xf'));var Papa=require(_0x947b('0x10'));var Redis=require(_0x947b('0x11'));var authService=require(_0x947b('0x12'));var qs=require(_0x947b('0x13'));var as=require(_0x947b('0x14'));var hardwareService=require(_0x947b('0x15'));var logger=require(_0x947b('0x16'))('api');var utils=require(_0x947b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x947b('0x18'))['db'];function respondWithStatusCode(_0x19d7c9,_0x347b9d){_0x347b9d=_0x347b9d||0xcc;return function(_0x1d5971){if(_0x1d5971){return _0x19d7c9['sendStatus'](_0x347b9d);}return _0x19d7c9[_0x947b('0x19')](_0x347b9d)[_0x947b('0x1a')]();};}function respondWithResult(_0x3f7e80,_0x3893ef){_0x3893ef=_0x3893ef||0xc8;return function(_0x1bea2a){if(_0x1bea2a){return _0x3f7e80[_0x947b('0x19')](_0x3893ef)[_0x947b('0x1b')](_0x1bea2a);}};}function respondWithFilteredResult(_0x285b89,_0x1776a9){return function(_0x2c8c78){if(_0x2c8c78){var _0x2bbb56=typeof _0x1776a9['offset']===_0x947b('0x1c')&&typeof _0x1776a9[_0x947b('0x1d')]===_0x947b('0x1c');var _0x5205a2=_0x2c8c78[_0x947b('0x1e')];var _0x1d296e=_0x2bbb56?0x0:_0x1776a9[_0x947b('0x1f')];var _0x292a6d=_0x2bbb56?_0x2c8c78[_0x947b('0x1e')]:_0x1776a9[_0x947b('0x1f')]+_0x1776a9['limit'];var _0x21f804;if(_0x292a6d>=_0x5205a2){_0x292a6d=_0x5205a2;_0x21f804=0xc8;}else{_0x21f804=0xce;}_0x285b89[_0x947b('0x19')](_0x21f804);return _0x285b89[_0x947b('0x20')](_0x947b('0x21'),_0x1d296e+'-'+_0x292a6d+'/'+_0x5205a2)[_0x947b('0x1b')](_0x2c8c78);}return null;};}function patchUpdates(_0x1014ed){return function(_0x19a2c6){try{jsonpatch[_0x947b('0x22')](_0x19a2c6,_0x1014ed,!![]);}catch(_0x4afc9a){return BPromise[_0x947b('0x23')](_0x4afc9a);}return _0x19a2c6[_0x947b('0x24')]();};}function saveUpdates(_0x1a64a0,_0x278af7){return function(_0x39d4b4){if(_0x39d4b4){return _0x39d4b4[_0x947b('0x25')](_0x1a64a0)[_0x947b('0x26')](function(_0x59cf14){return _0x59cf14;});}return null;};}function removeEntity(_0x29cb5e,_0x2b04f7){return function(_0x331f20){if(_0x331f20){return _0x331f20[_0x947b('0x27')]()[_0x947b('0x26')](function(){_0x29cb5e['status'](0xcc)[_0x947b('0x1a')]();});}};}function handleEntityNotFound(_0x12e8b7,_0x406b2c){return function(_0x34cd05){if(!_0x34cd05){_0x12e8b7[_0x947b('0x28')](0x194);}return _0x34cd05;};}function handleError(_0x31845d,_0x28270c){_0x28270c=_0x28270c||0x1f4;return function(_0xe45d69){logger['error'](_0xe45d69[_0x947b('0x29')]);if(_0xe45d69['name']){delete _0xe45d69['name'];}_0x31845d[_0x947b('0x19')](_0x28270c)[_0x947b('0x2a')](_0xe45d69);};}exports['index']=function(_0x3d2593,_0x636bb7){var _0x1e39b9={},_0x380d8a={},_0x133ebd={'count':0x0,'rows':[]};var _0x45cc3c=_[_0x947b('0x2b')](db['SugarcrmConfiguration'][_0x947b('0x2c')],function(_0x41c436){return{'name':_0x41c436[_0x947b('0x2d')],'type':_0x41c436[_0x947b('0x2e')]['key']};});_0x380d8a[_0x947b('0x2f')]=_['map'](_0x45cc3c,_0x947b('0x30'));_0x380d8a[_0x947b('0x31')]=_[_0x947b('0x32')](_0x3d2593['query']);_0x380d8a[_0x947b('0x33')]=_['intersection'](_0x380d8a[_0x947b('0x2f')],_0x380d8a[_0x947b('0x31')]);_0x1e39b9['attributes']=_['intersection'](_0x380d8a['model'],qs[_0x947b('0x34')](_0x3d2593[_0x947b('0x31')][_0x947b('0x34')]));_0x1e39b9['attributes']=_0x1e39b9[_0x947b('0x35')]['length']?_0x1e39b9[_0x947b('0x35')]:_0x380d8a[_0x947b('0x2f')];if(!_0x3d2593[_0x947b('0x31')][_0x947b('0x36')](_0x947b('0x37'))){_0x1e39b9[_0x947b('0x1d')]=qs[_0x947b('0x1d')](_0x3d2593[_0x947b('0x31')][_0x947b('0x1d')]);_0x1e39b9[_0x947b('0x1f')]=qs[_0x947b('0x1f')](_0x3d2593[_0x947b('0x31')]['offset']);}_0x1e39b9[_0x947b('0x38')]=qs[_0x947b('0x39')](_0x3d2593[_0x947b('0x31')]['sort']);_0x1e39b9[_0x947b('0x3a')]=qs['filters'](_[_0x947b('0x3b')](_0x3d2593[_0x947b('0x31')],_0x380d8a[_0x947b('0x33')]),_0x45cc3c);if(_0x3d2593['query'][_0x947b('0x3c')]){_0x1e39b9[_0x947b('0x3a')]=_[_0x947b('0x3d')](_0x1e39b9[_0x947b('0x3a')],{'$or':_[_0x947b('0x2b')](_0x45cc3c,function(_0xe69183){if(_0xe69183[_0x947b('0x2e')]!=='VIRTUAL'){var _0x1af519={};_0x1af519[_0xe69183[_0x947b('0x30')]]={'$like':'%'+_0x3d2593[_0x947b('0x31')][_0x947b('0x3c')]+'%'};return _0x1af519;}})});}_0x1e39b9=_[_0x947b('0x3d')]({},_0x1e39b9,_0x3d2593[_0x947b('0x3e')]);var _0x10a9db={'where':_0x1e39b9[_0x947b('0x3a')]};return db[_0x947b('0x3f')][_0x947b('0x1e')](_0x10a9db)[_0x947b('0x26')](function(_0x7399b2){_0x133ebd[_0x947b('0x1e')]=_0x7399b2;if(_0x3d2593[_0x947b('0x31')][_0x947b('0x40')]){_0x1e39b9[_0x947b('0x41')]=[{'all':!![]}];}return db[_0x947b('0x3f')][_0x947b('0x42')](_0x1e39b9);})[_0x947b('0x26')](function(_0x59a9da){_0x133ebd[_0x947b('0x43')]=_0x59a9da;return _0x133ebd;})['then'](respondWithFilteredResult(_0x636bb7,_0x1e39b9))['catch'](handleError(_0x636bb7,null));};exports[_0x947b('0x44')]=function(_0x5ee8db,_0x448496){var _0xe5c8ec={'raw':![],'where':{'id':_0x5ee8db[_0x947b('0x45')]['id']}},_0x411710={};_0x411710[_0x947b('0x2f')]=_['keys'](db[_0x947b('0x3f')][_0x947b('0x2c')]);_0x411710[_0x947b('0x31')]=_[_0x947b('0x32')](_0x5ee8db['query']);_0x411710['filters']=_[_0x947b('0x46')](_0x411710[_0x947b('0x2f')],_0x411710['query']);_0xe5c8ec[_0x947b('0x35')]=_['intersection'](_0x411710[_0x947b('0x2f')],qs['fields'](_0x5ee8db[_0x947b('0x31')][_0x947b('0x34')]));_0xe5c8ec['attributes']=_0xe5c8ec[_0x947b('0x35')][_0x947b('0x47')]?_0xe5c8ec[_0x947b('0x35')]:_0x411710[_0x947b('0x2f')];if(_0x5ee8db[_0x947b('0x31')][_0x947b('0x40')]){_0xe5c8ec[_0x947b('0x41')]=[{'all':!![]}];}_0xe5c8ec=_[_0x947b('0x3d')]({},_0xe5c8ec,_0x5ee8db['options']);return db[_0x947b('0x3f')][_0x947b('0x48')](_0xe5c8ec)[_0x947b('0x26')](handleEntityNotFound(_0x448496,null))[_0x947b('0x26')](respondWithResult(_0x448496,null))[_0x947b('0x49')](handleError(_0x448496,null));};exports[_0x947b('0x4a')]=function(_0x40b87f,_0x406f68){return db['SugarcrmConfiguration']['create'](_0x40b87f[_0x947b('0x4b')],{})[_0x947b('0x26')](respondWithResult(_0x406f68,0xc9))[_0x947b('0x49')](handleError(_0x406f68,null));};exports['update']=function(_0x58f6d9,_0x1abc52){if(_0x58f6d9[_0x947b('0x4b')]['id']){delete _0x58f6d9[_0x947b('0x4b')]['id'];}return db['SugarcrmConfiguration'][_0x947b('0x48')]({'where':{'id':_0x58f6d9[_0x947b('0x45')]['id']}})['then'](handleEntityNotFound(_0x1abc52,null))['then'](saveUpdates(_0x58f6d9[_0x947b('0x4b')],null))[_0x947b('0x26')](respondWithResult(_0x1abc52,null))[_0x947b('0x49')](handleError(_0x1abc52,null));};exports[_0x947b('0x27')]=function(_0x129145,_0x266d93){return db[_0x947b('0x3f')]['find']({'where':{'id':_0x129145[_0x947b('0x45')]['id']}})[_0x947b('0x26')](handleEntityNotFound(_0x266d93,null))[_0x947b('0x26')](removeEntity(_0x266d93,null))['catch'](handleError(_0x266d93,null));};exports['getFields']=function(_0x3c1939,_0x3321d5,_0x19fca2){var _0x518f1b={};var _0x278b19={};var _0x5149ab;var _0x248e03;return db[_0x947b('0x3f')]['findOne']({'where':{'id':_0x3c1939['params']['id']}})[_0x947b('0x26')](handleEntityNotFound(_0x3321d5,null))[_0x947b('0x26')](function(_0x485aec){if(_0x485aec){_0x5149ab=_0x485aec;_0x278b19[_0x947b('0x2f')]=_[_0x947b('0x32')](db[_0x947b('0x4c')][_0x947b('0x2c')]);_0x278b19[_0x947b('0x31')]=_[_0x947b('0x32')](_0x3c1939[_0x947b('0x31')]);_0x278b19[_0x947b('0x33')]=_[_0x947b('0x46')](_0x278b19[_0x947b('0x2f')],_0x278b19['query']);_0x518f1b[_0x947b('0x35')]=_[_0x947b('0x46')](_0x278b19[_0x947b('0x2f')],qs[_0x947b('0x34')](_0x3c1939[_0x947b('0x31')][_0x947b('0x34')]));_0x518f1b[_0x947b('0x35')]=_0x518f1b['attributes']['length']?_0x518f1b[_0x947b('0x35')]:_0x278b19[_0x947b('0x2f')];_0x518f1b[_0x947b('0x38')]=qs['sort'](_0x3c1939['query'][_0x947b('0x39')]);_0x518f1b[_0x947b('0x3a')]=qs[_0x947b('0x33')](_[_0x947b('0x3b')](_0x3c1939['query'],_0x278b19['filters']));if(_0x3c1939[_0x947b('0x31')][_0x947b('0x3c')]){_0x518f1b[_0x947b('0x3a')]=_[_0x947b('0x3d')](_0x518f1b[_0x947b('0x3a')],{'$or':_[_0x947b('0x2b')](_0x518f1b['attributes'],function(_0x13f657){var _0xd38f0a={};_0xd38f0a[_0x13f657]={'$like':'%'+_0x3c1939['query'][_0x947b('0x3c')]+'%'};return _0xd38f0a;})});}_0x518f1b=_[_0x947b('0x3d')]({},_0x518f1b,_0x3c1939[_0x947b('0x3e')]);return _0x5149ab[_0x947b('0x4d')](_0x518f1b);}})[_0x947b('0x26')](function(_0xf446a7){if(_0xf446a7){_0x248e03=_0xf446a7[_0x947b('0x47')];if(!_0x3c1939['query'][_0x947b('0x36')](_0x947b('0x37'))){_0x518f1b[_0x947b('0x1d')]=qs[_0x947b('0x1d')](_0x3c1939[_0x947b('0x31')][_0x947b('0x1d')]);_0x518f1b[_0x947b('0x1f')]=qs[_0x947b('0x1f')](_0x3c1939[_0x947b('0x31')][_0x947b('0x1f')]);}return _0x5149ab[_0x947b('0x4d')](_0x518f1b);}})[_0x947b('0x26')](function(_0x3540c1){if(_0x3540c1){return _0x3540c1?{'count':_0x248e03,'rows':_0x3540c1}:null;}})['then'](respondWithResult(_0x3321d5,null))[_0x947b('0x49')](handleError(_0x3321d5,null));};exports[_0x947b('0x4e')]=function(_0x447c31,_0x59024c,_0x484e12){var _0x5d4392={};var _0x3989cb={};var _0x4e0748;var _0x1191ec;return db[_0x947b('0x3f')][_0x947b('0x4f')]({'where':{'id':_0x447c31[_0x947b('0x45')]['id']}})[_0x947b('0x26')](handleEntityNotFound(_0x59024c,null))['then'](function(_0x4a6a05){if(_0x4a6a05){_0x4e0748=_0x4a6a05;_0x3989cb[_0x947b('0x2f')]=_[_0x947b('0x32')](db[_0x947b('0x4c')]['rawAttributes']);_0x3989cb['query']=_[_0x947b('0x32')](_0x447c31['query']);_0x3989cb[_0x947b('0x33')]=_[_0x947b('0x46')](_0x3989cb[_0x947b('0x2f')],_0x3989cb['query']);_0x5d4392['attributes']=_['intersection'](_0x3989cb[_0x947b('0x2f')],qs[_0x947b('0x34')](_0x447c31[_0x947b('0x31')][_0x947b('0x34')]));_0x5d4392[_0x947b('0x35')]=_0x5d4392[_0x947b('0x35')][_0x947b('0x47')]?_0x5d4392[_0x947b('0x35')]:_0x3989cb[_0x947b('0x2f')];_0x5d4392[_0x947b('0x38')]=qs[_0x947b('0x39')](_0x447c31[_0x947b('0x31')][_0x947b('0x39')]);_0x5d4392[_0x947b('0x3a')]=qs[_0x947b('0x33')](_[_0x947b('0x3b')](_0x447c31[_0x947b('0x31')],_0x3989cb['filters']));if(_0x447c31['query'][_0x947b('0x3c')]){_0x5d4392[_0x947b('0x3a')]=_[_0x947b('0x3d')](_0x5d4392['where'],{'$or':_['map'](_0x5d4392[_0x947b('0x35')],function(_0x2f420c){var _0x3d1046={};_0x3d1046[_0x2f420c]={'$like':'%'+_0x447c31[_0x947b('0x31')]['filter']+'%'};return _0x3d1046;})});}_0x5d4392=_[_0x947b('0x3d')]({},_0x5d4392,_0x447c31[_0x947b('0x3e')]);return _0x4e0748[_0x947b('0x4e')](_0x5d4392);}})[_0x947b('0x26')](function(_0x17098d){if(_0x17098d){_0x1191ec=_0x17098d[_0x947b('0x47')];if(!_0x447c31[_0x947b('0x31')]['hasOwnProperty'](_0x947b('0x37'))){_0x5d4392[_0x947b('0x1d')]=qs[_0x947b('0x1d')](_0x447c31[_0x947b('0x31')][_0x947b('0x1d')]);_0x5d4392[_0x947b('0x1f')]=qs[_0x947b('0x1f')](_0x447c31[_0x947b('0x31')][_0x947b('0x1f')]);}return _0x4e0748[_0x947b('0x4e')](_0x5d4392);}})[_0x947b('0x26')](function(_0x1a76dc){if(_0x1a76dc){return _0x1a76dc?{'count':_0x1191ec,'rows':_0x1a76dc}:null;}})[_0x947b('0x26')](respondWithResult(_0x59024c,null))['catch'](handleError(_0x59024c,null));};exports[_0x947b('0x50')]=function(_0x8ab782,_0xd1cee5,_0x4eff1a){var _0x2b50e8={};var _0x1f4be0={};var _0x47f20e;var _0x2d80ec;return db[_0x947b('0x3f')][_0x947b('0x4f')]({'where':{'id':_0x8ab782[_0x947b('0x45')]['id']}})[_0x947b('0x26')](handleEntityNotFound(_0xd1cee5,null))[_0x947b('0x26')](function(_0x1a14ef){if(_0x1a14ef){_0x47f20e=_0x1a14ef;_0x1f4be0[_0x947b('0x2f')]=_[_0x947b('0x32')](db['SugarcrmField']['rawAttributes']);_0x1f4be0[_0x947b('0x31')]=_[_0x947b('0x32')](_0x8ab782[_0x947b('0x31')]);_0x1f4be0[_0x947b('0x33')]=_['intersection'](_0x1f4be0[_0x947b('0x2f')],_0x1f4be0[_0x947b('0x31')]);_0x2b50e8[_0x947b('0x35')]=_[_0x947b('0x46')](_0x1f4be0[_0x947b('0x2f')],qs[_0x947b('0x34')](_0x8ab782[_0x947b('0x31')]['fields']));_0x2b50e8[_0x947b('0x35')]=_0x2b50e8[_0x947b('0x35')][_0x947b('0x47')]?_0x2b50e8[_0x947b('0x35')]:_0x1f4be0[_0x947b('0x2f')];_0x2b50e8[_0x947b('0x38')]=qs[_0x947b('0x39')](_0x8ab782[_0x947b('0x31')][_0x947b('0x39')]);_0x2b50e8[_0x947b('0x3a')]=qs['filters'](_[_0x947b('0x3b')](_0x8ab782[_0x947b('0x31')],_0x1f4be0[_0x947b('0x33')]));if(_0x8ab782['query'][_0x947b('0x3c')]){_0x2b50e8[_0x947b('0x3a')]=_[_0x947b('0x3d')](_0x2b50e8[_0x947b('0x3a')],{'$or':_[_0x947b('0x2b')](_0x2b50e8[_0x947b('0x35')],function(_0x22e6b6){var _0x46a310={};_0x46a310[_0x22e6b6]={'$like':'%'+_0x8ab782[_0x947b('0x31')][_0x947b('0x3c')]+'%'};return _0x46a310;})});}_0x2b50e8=_[_0x947b('0x3d')]({},_0x2b50e8,_0x8ab782['options']);return _0x47f20e[_0x947b('0x50')](_0x2b50e8);}})['then'](function(_0x352a18){if(_0x352a18){_0x2d80ec=_0x352a18[_0x947b('0x47')];if(!_0x8ab782['query']['hasOwnProperty'](_0x947b('0x37'))){_0x2b50e8[_0x947b('0x1d')]=qs[_0x947b('0x1d')](_0x8ab782[_0x947b('0x31')][_0x947b('0x1d')]);_0x2b50e8[_0x947b('0x1f')]=qs[_0x947b('0x1f')](_0x8ab782[_0x947b('0x31')][_0x947b('0x1f')]);}return _0x47f20e[_0x947b('0x50')](_0x2b50e8);}})[_0x947b('0x26')](function(_0x411904){if(_0x411904){return _0x411904?{'count':_0x2d80ec,'rows':_0x411904}:null;}})['then'](respondWithResult(_0xd1cee5,null))[_0x947b('0x49')](handleError(_0xd1cee5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index efbde64..b41a8ee 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 _0x07d7=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0x07d7,0x85));var _0x707d=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x07d7[_0x47568e];return _0x33815b;};'use strict';var _=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var logger=require(_0x707d('0x2'))(_0x707d('0x3'));var moment=require(_0x707d('0x4'));var BPromise=require(_0x707d('0x5'));var rp=require(_0x707d('0x6'));var fs=require('fs');var path=require(_0x707d('0x7'));var rimraf=require(_0x707d('0x8'));var config=require(_0x707d('0x9'));var attributes=require(_0x707d('0xa'));module[_0x707d('0xb')]=function(_0x1808da,_0x1456bd){return _0x1808da[_0x707d('0xc')](_0x707d('0xd'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a19=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xa3afad,_0x350415){var _0x19ed6d=function(_0x5101cd){while(--_0x5101cd){_0xa3afad['push'](_0xa3afad['shift']());}};_0x19ed6d(++_0x350415);}(_0x2a19,0x14a));var _0x92a1=function(_0x2de77d,_0xd35bcc){_0x2de77d=_0x2de77d-0x0;var _0x2e23e7=_0x2a19[_0x2de77d];return _0x2e23e7;};'use strict';var _=require(_0x92a1('0x0'));var util=require('util');var logger=require(_0x92a1('0x1'))(_0x92a1('0x2'));var moment=require(_0x92a1('0x3'));var BPromise=require(_0x92a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x92a1('0x5'));var config=require(_0x92a1('0x6'));var attributes=require(_0x92a1('0x7'));module[_0x92a1('0x8')]=function(_0x4afef1,_0x3a8c65){return _0x4afef1[_0x92a1('0x9')](_0x92a1('0xa'),attributes,{'tableName':_0x92a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 6a4ca27..ce581c9 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 _0xf0ad=['error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xf0ad,0x181));var _0xdf0a=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xf0ad[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xdf0a('0x0'));var util=require(_0xdf0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdf0a('0x2'));var fs=require('fs');var Redis=require(_0xdf0a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf0a('0x4'));var logger=require(_0xdf0a('0x5'))('rpc');var config=require(_0xdf0a('0x6'));var jayson=require(_0xdf0a('0x7'));var client=jayson[_0xdf0a('0x8')][_0xdf0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d27ca,_0x3492f7,_0x55eabb){return new BPromise(function(_0x39e5ad,_0x51e31f){return client['request'](_0x2d27ca,_0x55eabb)['then'](function(_0x3becfd){logger[_0xdf0a('0xa')](_0xdf0a('0xb'),_0x3492f7,_0xdf0a('0xc'));logger['debug'](_0xdf0a('0xd'),_0x3492f7,_0xdf0a('0xc'),JSON[_0xdf0a('0xe')](_0x3becfd));if(_0x3becfd[_0xdf0a('0xf')]){if(_0x3becfd['error'][_0xdf0a('0x10')]===0x1f4){logger[_0xdf0a('0xf')](_0xdf0a('0xb'),_0x3492f7,_0x3becfd[_0xdf0a('0xf')][_0xdf0a('0x11')]);return _0x51e31f(_0x3becfd['error'][_0xdf0a('0x11')]);}logger[_0xdf0a('0xf')](_0xdf0a('0xb'),_0x3492f7,_0x3becfd[_0xdf0a('0xf')]['message']);return _0x39e5ad(_0x3becfd[_0xdf0a('0xf')]['message']);}else{logger[_0xdf0a('0xa')](_0xdf0a('0xb'),_0x3492f7,_0xdf0a('0xc'));_0x39e5ad(_0x3becfd[_0xdf0a('0x12')][_0xdf0a('0x11')]);}})[_0xdf0a('0x13')](function(_0x5f1f65){logger[_0xdf0a('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3492f7,_0x5f1f65);_0x51e31f(_0x5f1f65);});});} \ No newline at end of file +var _0x7858=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7858,0x18a));var _0x8785=function(_0x14b957,_0x59034d){_0x14b957=_0x14b957-0x0;var _0xa3bd18=_0x7858[_0x14b957];return _0xa3bd18;};'use strict';var _=require(_0x8785('0x0'));var util=require(_0x8785('0x1'));var moment=require(_0x8785('0x2'));var BPromise=require(_0x8785('0x3'));var rs=require(_0x8785('0x4'));var fs=require('fs');var Redis=require(_0x8785('0x5'));var db=require(_0x8785('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8785('0x7'));var config=require('../../config/environment');var jayson=require(_0x8785('0x8'));var client=jayson['client'][_0x8785('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbc0647,_0x1589c6,_0x2afc4c){return new BPromise(function(_0x21d51d,_0x261f63){return client['request'](_0xbc0647,_0x2afc4c)['then'](function(_0x21d1b7){logger[_0x8785('0xa')](_0x8785('0xb'),_0x1589c6,_0x8785('0xc'));logger['debug'](_0x8785('0xd'),_0x1589c6,_0x8785('0xc'),JSON[_0x8785('0xe')](_0x21d1b7));if(_0x21d1b7[_0x8785('0xf')]){if(_0x21d1b7[_0x8785('0xf')]['code']===0x1f4){logger[_0x8785('0xf')](_0x8785('0xb'),_0x1589c6,_0x21d1b7[_0x8785('0xf')]['message']);return _0x261f63(_0x21d1b7[_0x8785('0xf')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1589c6,_0x21d1b7[_0x8785('0xf')]['message']);return _0x21d51d(_0x21d1b7[_0x8785('0xf')][_0x8785('0x10')]);}else{logger[_0x8785('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1589c6,_0x8785('0xc'));_0x21d51d(_0x21d1b7['result'][_0x8785('0x10')]);}})[_0x8785('0x11')](function(_0x24914f){logger[_0x8785('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1589c6,_0x24914f);_0x261f63(_0x24914f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 0d9c93e..10f8b9a 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 _0x5980=['../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5980,0xb0));var _0x0598=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5980[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x0598('0x0'));var util=require('util');var path=require(_0x0598('0x1'));var timeout=require(_0x0598('0x2'));var express=require('express');var router=express[_0x0598('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0598('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0598('0x5'));var controller=require(_0x0598('0x6'));router[_0x0598('0x7')]('/',auth[_0x0598('0x8')](),controller[_0x0598('0x9')]);router['get']('/:id',auth[_0x0598('0x8')](),controller[_0x0598('0xa')]);router[_0x0598('0xb')]('/',auth[_0x0598('0x8')](),controller[_0x0598('0xc')]);router[_0x0598('0xd')](_0x0598('0xe'),auth['isAuthenticated'](),controller[_0x0598('0xf')]);router[_0x0598('0x10')](_0x0598('0xe'),auth[_0x0598('0x8')](),controller['destroy']);module[_0x0598('0x11')]=router; \ No newline at end of file +var _0x12c4=['../../config/environment','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29aa6a,_0x337825){var _0x10d518=function(_0x3cd73a){while(--_0x3cd73a){_0x29aa6a['push'](_0x29aa6a['shift']());}};_0x10d518(++_0x337825);}(_0x12c4,0x64));var _0x412c=function(_0x4a81ee,_0x3014c4){_0x4a81ee=_0x4a81ee-0x0;var _0x101da6=_0x12c4[_0x4a81ee];return _0x101da6;};'use strict';var multer=require(_0x412c('0x0'));var util=require(_0x412c('0x1'));var path=require(_0x412c('0x2'));var timeout=require('connect-timeout');var express=require(_0x412c('0x3'));var router=express[_0x412c('0x4')]();var fs_extra=require(_0x412c('0x5'));var auth=require(_0x412c('0x6'));var interaction=require(_0x412c('0x7'));var config=require(_0x412c('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x412c('0x9')]('/',auth[_0x412c('0xa')](),controller['index']);router['get'](_0x412c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x412c('0xc')]('/',auth['isAuthenticated'](),controller[_0x412c('0xd')]);router[_0x412c('0xe')]('/:id',auth[_0x412c('0xa')](),controller['update']);router[_0x412c('0xf')](_0x412c('0xb'),auth[_0x412c('0xa')](),controller[_0x412c('0x10')]);module[_0x412c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a2d1362..77b178d 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 _0x0a77=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0a77,0xc4));var _0x70a7=function(_0x20d8bd,_0x1fe317){_0x20d8bd=_0x20d8bd-0x0;var _0x1a0fd0=_0x0a77[_0x20d8bd];return _0x1a0fd0;};'use strict';var Sequelize=require(_0x70a7('0x0'));module[_0x70a7('0x1')]={'type':{'type':Sequelize[_0x70a7('0x2')](_0x70a7('0x3'),'variable',_0x70a7('0x4'),'keyValue',_0x70a7('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x70a7('0x6')]},'key':{'type':Sequelize[_0x70a7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x70a7('0x3'),_0x70a7('0x7'),_0x70a7('0x4'))},'keyContent':{'type':Sequelize[_0x70a7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x70a7('0x6')]},'customField':{'type':Sequelize[_0x70a7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbc66=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x11131a,_0x104f7a){var _0x167154=function(_0x5b8eaf){while(--_0x5b8eaf){_0x11131a['push'](_0x11131a['shift']());}};_0x167154(++_0x104f7a);}(_0xbc66,0x112));var _0x6bc6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbc66[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x6bc6('0x0')]={'type':{'type':Sequelize[_0x6bc6('0x1')](_0x6bc6('0x2'),_0x6bc6('0x3'),_0x6bc6('0x4'),_0x6bc6('0x5'),_0x6bc6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6bc6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6bc6('0x1')](_0x6bc6('0x2'),'variable',_0x6bc6('0x4'))},'keyContent':{'type':Sequelize[_0x6bc6('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6bc6('0x7')]},'customField':{'type':Sequelize[_0x6bc6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6bc6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 216f400..eabd611 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 _0x2866=['order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','body','find','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../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','apply','save','update','then','name','send','index','SugarcrmField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2866,0x15c));var _0x6286=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0x2866[_0xd73d53];return _0x560148;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6286('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6286('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6286('0x2'));var Mustache=require(_0x6286('0x3'));var util=require(_0x6286('0x4'));var path=require(_0x6286('0x5'));var sox=require(_0x6286('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6286('0x7'));var _=require('lodash');var squel=require(_0x6286('0x8'));var crypto=require(_0x6286('0x9'));var jsforce=require(_0x6286('0xa'));var deskjs=require(_0x6286('0xb'));var toCsv=require(_0x6286('0xc'));var querystring=require('querystring');var Papa=require(_0x6286('0xd'));var Redis=require('ioredis');var authService=require(_0x6286('0xe'));var qs=require(_0x6286('0xf'));var as=require(_0x6286('0x10'));var hardwareService=require(_0x6286('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6286('0x12'));var config=require(_0x6286('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6286('0x14'))['db'];function respondWithStatusCode(_0x185476,_0x13a878){_0x13a878=_0x13a878||0xcc;return function(_0x153f4d){if(_0x153f4d){return _0x185476[_0x6286('0x15')](_0x13a878);}return _0x185476[_0x6286('0x16')](_0x13a878)[_0x6286('0x17')]();};}function respondWithResult(_0xc58c54,_0x1f7311){_0x1f7311=_0x1f7311||0xc8;return function(_0x2acb8e){if(_0x2acb8e){return _0xc58c54[_0x6286('0x16')](_0x1f7311)[_0x6286('0x18')](_0x2acb8e);}};}function respondWithFilteredResult(_0x1b94a4,_0x531d5d){return function(_0x2c456b){if(_0x2c456b){var _0x221f50=typeof _0x531d5d[_0x6286('0x19')]===_0x6286('0x1a')&&typeof _0x531d5d[_0x6286('0x1b')]==='undefined';var _0x2bafe9=_0x2c456b[_0x6286('0x1c')];var _0x3e0235=_0x221f50?0x0:_0x531d5d['offset'];var _0x330050=_0x221f50?_0x2c456b[_0x6286('0x1c')]:_0x531d5d[_0x6286('0x19')]+_0x531d5d[_0x6286('0x1b')];var _0x575971;if(_0x330050>=_0x2bafe9){_0x330050=_0x2bafe9;_0x575971=0xc8;}else{_0x575971=0xce;}_0x1b94a4[_0x6286('0x16')](_0x575971);return _0x1b94a4['set']('Content-Range',_0x3e0235+'-'+_0x330050+'/'+_0x2bafe9)[_0x6286('0x18')](_0x2c456b);}return null;};}function patchUpdates(_0x271669){return function(_0x5d3372){try{jsonpatch[_0x6286('0x1d')](_0x5d3372,_0x271669,!![]);}catch(_0x399509){return BPromise['reject'](_0x399509);}return _0x5d3372[_0x6286('0x1e')]();};}function saveUpdates(_0x1ab3d5,_0x517411){return function(_0x95237d){if(_0x95237d){return _0x95237d[_0x6286('0x1f')](_0x1ab3d5)[_0x6286('0x20')](function(_0x5b6d93){return _0x5b6d93;});}return null;};}function removeEntity(_0x3992ae,_0x28f512){return function(_0x492443){if(_0x492443){return _0x492443['destroy']()[_0x6286('0x20')](function(){_0x3992ae[_0x6286('0x16')](0xcc)[_0x6286('0x17')]();});}};}function handleEntityNotFound(_0x142e86,_0x271445){return function(_0x4499fa){if(!_0x4499fa){_0x142e86['sendStatus'](0x194);}return _0x4499fa;};}function handleError(_0x319d31,_0x16336a){_0x16336a=_0x16336a||0x1f4;return function(_0x360855){logger['error'](_0x360855['stack']);if(_0x360855[_0x6286('0x21')]){delete _0x360855[_0x6286('0x21')];}_0x319d31[_0x6286('0x16')](_0x16336a)[_0x6286('0x22')](_0x360855);};}exports[_0x6286('0x23')]=function(_0x54edfc,_0x3dbb6c){var _0x4baa06={},_0x1e7f4d={},_0xd03111={'count':0x0,'rows':[]};var _0x38fbc2=_['map'](db[_0x6286('0x24')][_0x6286('0x25')],function(_0x10784c){return{'name':_0x10784c[_0x6286('0x26')],'type':_0x10784c['type'][_0x6286('0x27')]};});_0x1e7f4d[_0x6286('0x28')]=_[_0x6286('0x29')](_0x38fbc2,_0x6286('0x21'));_0x1e7f4d[_0x6286('0x2a')]=_[_0x6286('0x2b')](_0x54edfc[_0x6286('0x2a')]);_0x1e7f4d[_0x6286('0x2c')]=_[_0x6286('0x2d')](_0x1e7f4d[_0x6286('0x28')],_0x1e7f4d['query']);_0x4baa06[_0x6286('0x2e')]=_[_0x6286('0x2d')](_0x1e7f4d[_0x6286('0x28')],qs[_0x6286('0x2f')](_0x54edfc[_0x6286('0x2a')]['fields']));_0x4baa06[_0x6286('0x2e')]=_0x4baa06[_0x6286('0x2e')]['length']?_0x4baa06[_0x6286('0x2e')]:_0x1e7f4d['model'];if(!_0x54edfc[_0x6286('0x2a')]['hasOwnProperty']('nolimit')){_0x4baa06[_0x6286('0x1b')]=qs['limit'](_0x54edfc[_0x6286('0x2a')][_0x6286('0x1b')]);_0x4baa06[_0x6286('0x19')]=qs['offset'](_0x54edfc[_0x6286('0x2a')]['offset']);}_0x4baa06[_0x6286('0x30')]=qs['sort'](_0x54edfc[_0x6286('0x2a')][_0x6286('0x31')]);_0x4baa06[_0x6286('0x32')]=qs['filters'](_[_0x6286('0x33')](_0x54edfc[_0x6286('0x2a')],_0x1e7f4d[_0x6286('0x2c')]),_0x38fbc2);if(_0x54edfc[_0x6286('0x2a')][_0x6286('0x34')]){_0x4baa06[_0x6286('0x32')]=_[_0x6286('0x35')](_0x4baa06[_0x6286('0x32')],{'$or':_[_0x6286('0x29')](_0x38fbc2,function(_0x23977d){if(_0x23977d['type']!==_0x6286('0x36')){var _0x1596f3={};_0x1596f3[_0x23977d[_0x6286('0x21')]]={'$like':'%'+_0x54edfc[_0x6286('0x2a')][_0x6286('0x34')]+'%'};return _0x1596f3;}})});}_0x4baa06=_[_0x6286('0x35')]({},_0x4baa06,_0x54edfc['options']);var _0x5ab750={'where':_0x4baa06[_0x6286('0x32')]};return db[_0x6286('0x24')][_0x6286('0x1c')](_0x5ab750)[_0x6286('0x20')](function(_0x4439e2){_0xd03111['count']=_0x4439e2;if(_0x54edfc['query'][_0x6286('0x37')]){_0x4baa06[_0x6286('0x38')]=[{'all':!![]}];}return db[_0x6286('0x24')][_0x6286('0x39')](_0x4baa06);})[_0x6286('0x20')](function(_0x9b53f4){_0xd03111[_0x6286('0x3a')]=_0x9b53f4;return _0xd03111;})[_0x6286('0x20')](respondWithFilteredResult(_0x3dbb6c,_0x4baa06))[_0x6286('0x3b')](handleError(_0x3dbb6c,null));};exports[_0x6286('0x3c')]=function(_0x3bcd85,_0x4aa24a){var _0x4d9880={'raw':!![],'where':{'id':_0x3bcd85[_0x6286('0x3d')]['id']}},_0x2437e5={};_0x2437e5[_0x6286('0x28')]=_[_0x6286('0x2b')](db[_0x6286('0x24')]['rawAttributes']);_0x2437e5['query']=_[_0x6286('0x2b')](_0x3bcd85[_0x6286('0x2a')]);_0x2437e5[_0x6286('0x2c')]=_[_0x6286('0x2d')](_0x2437e5[_0x6286('0x28')],_0x2437e5['query']);_0x4d9880[_0x6286('0x2e')]=_['intersection'](_0x2437e5[_0x6286('0x28')],qs[_0x6286('0x2f')](_0x3bcd85[_0x6286('0x2a')]['fields']));_0x4d9880[_0x6286('0x2e')]=_0x4d9880['attributes'][_0x6286('0x3e')]?_0x4d9880[_0x6286('0x2e')]:_0x2437e5['model'];if(_0x3bcd85[_0x6286('0x2a')][_0x6286('0x37')]){_0x4d9880['include']=[{'all':!![]}];}_0x4d9880=_['merge']({},_0x4d9880,_0x3bcd85[_0x6286('0x3f')]);return db[_0x6286('0x24')]['find'](_0x4d9880)[_0x6286('0x20')](handleEntityNotFound(_0x4aa24a,null))['then'](respondWithResult(_0x4aa24a,null))['catch'](handleError(_0x4aa24a,null));};exports['create']=function(_0x5df35a,_0x53d241){return db[_0x6286('0x24')]['create'](_0x5df35a[_0x6286('0x40')],{})[_0x6286('0x20')](respondWithResult(_0x53d241,0xc9))[_0x6286('0x3b')](handleError(_0x53d241,null));};exports[_0x6286('0x1f')]=function(_0x47bf3c,_0x5e8e24){if(_0x47bf3c[_0x6286('0x40')]['id']){delete _0x47bf3c[_0x6286('0x40')]['id'];}return db[_0x6286('0x24')]['find']({'where':{'id':_0x47bf3c[_0x6286('0x3d')]['id']}})[_0x6286('0x20')](handleEntityNotFound(_0x5e8e24,null))['then'](saveUpdates(_0x47bf3c[_0x6286('0x40')],null))['then'](respondWithResult(_0x5e8e24,null))[_0x6286('0x3b')](handleError(_0x5e8e24,null));};exports['destroy']=function(_0x2091ad,_0x53f229){return db[_0x6286('0x24')][_0x6286('0x41')]({'where':{'id':_0x2091ad[_0x6286('0x3d')]['id']}})[_0x6286('0x20')](handleEntityNotFound(_0x53f229,null))[_0x6286('0x20')](removeEntity(_0x53f229,null))[_0x6286('0x3b')](handleError(_0x53f229,null));}; \ No newline at end of file +var _0x69b1=['to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','SugarcrmField','includeAll','include','findAll','rows','catch','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0x69b1,0x1ba));var _0x169b=function(_0x3f652c,_0x38409f){_0x3f652c=_0x3f652c-0x0;var _0x13240d=_0x69b1[_0x3f652c];return _0x13240d;};'use strict';var emlformat=require(_0x169b('0x0'));var rimraf=require(_0x169b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x169b('0x2'));var rp=require(_0x169b('0x3'));var moment=require('moment');var BPromise=require(_0x169b('0x4'));var Mustache=require(_0x169b('0x5'));var util=require(_0x169b('0x6'));var path=require(_0x169b('0x7'));var sox=require('sox');var csv=require(_0x169b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x169b('0x9'));var _=require('lodash');var squel=require(_0x169b('0xa'));var crypto=require(_0x169b('0xb'));var jsforce=require(_0x169b('0xc'));var deskjs=require(_0x169b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x169b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x169b('0xf'));var qs=require(_0x169b('0x10'));var as=require(_0x169b('0x11'));var hardwareService=require(_0x169b('0x12'));var logger=require(_0x169b('0x13'))('api');var utils=require(_0x169b('0x14'));var config=require(_0x169b('0x15'));var licenseUtil=require(_0x169b('0x16'));var db=require(_0x169b('0x17'))['db'];function respondWithStatusCode(_0x1334fb,_0x4a33ed){_0x4a33ed=_0x4a33ed||0xcc;return function(_0x3f5814){if(_0x3f5814){return _0x1334fb[_0x169b('0x18')](_0x4a33ed);}return _0x1334fb[_0x169b('0x19')](_0x4a33ed)[_0x169b('0x1a')]();};}function respondWithResult(_0x18524b,_0x45cfe9){_0x45cfe9=_0x45cfe9||0xc8;return function(_0x10dab8){if(_0x10dab8){return _0x18524b['status'](_0x45cfe9)[_0x169b('0x1b')](_0x10dab8);}};}function respondWithFilteredResult(_0x2dbb3c,_0x411137){return function(_0x398222){if(_0x398222){var _0x4ed344=typeof _0x411137['offset']===_0x169b('0x1c')&&typeof _0x411137[_0x169b('0x1d')]===_0x169b('0x1c');var _0x5af3b7=_0x398222[_0x169b('0x1e')];var _0x3750b5=_0x4ed344?0x0:_0x411137[_0x169b('0x1f')];var _0x380e4d=_0x4ed344?_0x398222['count']:_0x411137[_0x169b('0x1f')]+_0x411137['limit'];var _0x3fb2b4;if(_0x380e4d>=_0x5af3b7){_0x380e4d=_0x5af3b7;_0x3fb2b4=0xc8;}else{_0x3fb2b4=0xce;}_0x2dbb3c['status'](_0x3fb2b4);return _0x2dbb3c[_0x169b('0x20')](_0x169b('0x21'),_0x3750b5+'-'+_0x380e4d+'/'+_0x5af3b7)[_0x169b('0x1b')](_0x398222);}return null;};}function patchUpdates(_0x132dd5){return function(_0x13a65a){try{jsonpatch[_0x169b('0x22')](_0x13a65a,_0x132dd5,!![]);}catch(_0x9a4783){return BPromise[_0x169b('0x23')](_0x9a4783);}return _0x13a65a[_0x169b('0x24')]();};}function saveUpdates(_0x3db161,_0x32088d){return function(_0x576e6c){if(_0x576e6c){return _0x576e6c[_0x169b('0x25')](_0x3db161)[_0x169b('0x26')](function(_0x469aac){return _0x469aac;});}return null;};}function removeEntity(_0x7a3905,_0xdc4613){return function(_0x2c3dd6){if(_0x2c3dd6){return _0x2c3dd6[_0x169b('0x27')]()[_0x169b('0x26')](function(){_0x7a3905[_0x169b('0x19')](0xcc)[_0x169b('0x1a')]();});}};}function handleEntityNotFound(_0x3eb6ab,_0x195ed3){return function(_0x54ec62){if(!_0x54ec62){_0x3eb6ab[_0x169b('0x18')](0x194);}return _0x54ec62;};}function handleError(_0x23bdad,_0x3b65fb){_0x3b65fb=_0x3b65fb||0x1f4;return function(_0x140b1f){logger[_0x169b('0x28')](_0x140b1f[_0x169b('0x29')]);if(_0x140b1f[_0x169b('0x2a')]){delete _0x140b1f[_0x169b('0x2a')];}_0x23bdad[_0x169b('0x19')](_0x3b65fb)['send'](_0x140b1f);};}exports[_0x169b('0x2b')]=function(_0x4d40cf,_0x5bb720){var _0x5e7d6d={},_0x306f4e={},_0x270305={'count':0x0,'rows':[]};var _0x2b89ac=_[_0x169b('0x2c')](db['SugarcrmField'][_0x169b('0x2d')],function(_0x21bc28){return{'name':_0x21bc28['fieldName'],'type':_0x21bc28['type'][_0x169b('0x2e')]};});_0x306f4e[_0x169b('0x2f')]=_[_0x169b('0x2c')](_0x2b89ac,_0x169b('0x2a'));_0x306f4e[_0x169b('0x30')]=_[_0x169b('0x31')](_0x4d40cf[_0x169b('0x30')]);_0x306f4e[_0x169b('0x32')]=_[_0x169b('0x33')](_0x306f4e[_0x169b('0x2f')],_0x306f4e[_0x169b('0x30')]);_0x5e7d6d['attributes']=_[_0x169b('0x33')](_0x306f4e[_0x169b('0x2f')],qs[_0x169b('0x34')](_0x4d40cf['query'][_0x169b('0x34')]));_0x5e7d6d[_0x169b('0x35')]=_0x5e7d6d[_0x169b('0x35')][_0x169b('0x36')]?_0x5e7d6d['attributes']:_0x306f4e['model'];if(!_0x4d40cf[_0x169b('0x30')][_0x169b('0x37')](_0x169b('0x38'))){_0x5e7d6d[_0x169b('0x1d')]=qs[_0x169b('0x1d')](_0x4d40cf['query']['limit']);_0x5e7d6d[_0x169b('0x1f')]=qs[_0x169b('0x1f')](_0x4d40cf[_0x169b('0x30')]['offset']);}_0x5e7d6d['order']=qs[_0x169b('0x39')](_0x4d40cf[_0x169b('0x30')]['sort']);_0x5e7d6d[_0x169b('0x3a')]=qs[_0x169b('0x32')](_[_0x169b('0x3b')](_0x4d40cf[_0x169b('0x30')],_0x306f4e[_0x169b('0x32')]),_0x2b89ac);if(_0x4d40cf['query'][_0x169b('0x3c')]){_0x5e7d6d[_0x169b('0x3a')]=_[_0x169b('0x3d')](_0x5e7d6d['where'],{'$or':_['map'](_0x2b89ac,function(_0x55ba92){if(_0x55ba92[_0x169b('0x3e')]!==_0x169b('0x3f')){var _0x345d04={};_0x345d04[_0x55ba92['name']]={'$like':'%'+_0x4d40cf['query'][_0x169b('0x3c')]+'%'};return _0x345d04;}})});}_0x5e7d6d=_['merge']({},_0x5e7d6d,_0x4d40cf['options']);var _0x43ca60={'where':_0x5e7d6d[_0x169b('0x3a')]};return db[_0x169b('0x40')][_0x169b('0x1e')](_0x43ca60)[_0x169b('0x26')](function(_0x22d276){_0x270305[_0x169b('0x1e')]=_0x22d276;if(_0x4d40cf[_0x169b('0x30')][_0x169b('0x41')]){_0x5e7d6d[_0x169b('0x42')]=[{'all':!![]}];}return db[_0x169b('0x40')][_0x169b('0x43')](_0x5e7d6d);})[_0x169b('0x26')](function(_0x418029){_0x270305[_0x169b('0x44')]=_0x418029;return _0x270305;})[_0x169b('0x26')](respondWithFilteredResult(_0x5bb720,_0x5e7d6d))[_0x169b('0x45')](handleError(_0x5bb720,null));};exports['show']=function(_0x22a297,_0x42124d){var _0x15e05b={'raw':!![],'where':{'id':_0x22a297['params']['id']}},_0xaeee0c={};_0xaeee0c[_0x169b('0x2f')]=_[_0x169b('0x31')](db[_0x169b('0x40')][_0x169b('0x2d')]);_0xaeee0c[_0x169b('0x30')]=_['keys'](_0x22a297['query']);_0xaeee0c['filters']=_[_0x169b('0x33')](_0xaeee0c[_0x169b('0x2f')],_0xaeee0c[_0x169b('0x30')]);_0x15e05b[_0x169b('0x35')]=_[_0x169b('0x33')](_0xaeee0c[_0x169b('0x2f')],qs['fields'](_0x22a297[_0x169b('0x30')][_0x169b('0x34')]));_0x15e05b['attributes']=_0x15e05b[_0x169b('0x35')][_0x169b('0x36')]?_0x15e05b[_0x169b('0x35')]:_0xaeee0c['model'];if(_0x22a297[_0x169b('0x30')][_0x169b('0x41')]){_0x15e05b[_0x169b('0x42')]=[{'all':!![]}];}_0x15e05b=_[_0x169b('0x3d')]({},_0x15e05b,_0x22a297[_0x169b('0x46')]);return db['SugarcrmField'][_0x169b('0x47')](_0x15e05b)[_0x169b('0x26')](handleEntityNotFound(_0x42124d,null))[_0x169b('0x26')](respondWithResult(_0x42124d,null))[_0x169b('0x45')](handleError(_0x42124d,null));};exports[_0x169b('0x48')]=function(_0x3c63db,_0x54ecf4){return db[_0x169b('0x40')][_0x169b('0x48')](_0x3c63db[_0x169b('0x49')],{})['then'](respondWithResult(_0x54ecf4,0xc9))[_0x169b('0x45')](handleError(_0x54ecf4,null));};exports['update']=function(_0x2d4d7d,_0xf71afe){if(_0x2d4d7d['body']['id']){delete _0x2d4d7d['body']['id'];}return db['SugarcrmField'][_0x169b('0x47')]({'where':{'id':_0x2d4d7d['params']['id']}})[_0x169b('0x26')](handleEntityNotFound(_0xf71afe,null))['then'](saveUpdates(_0x2d4d7d[_0x169b('0x49')],null))[_0x169b('0x26')](respondWithResult(_0xf71afe,null))[_0x169b('0x45')](handleError(_0xf71afe,null));};exports[_0x169b('0x27')]=function(_0x39b9a0,_0x2f294f){return db['SugarcrmField'][_0x169b('0x47')]({'where':{'id':_0x39b9a0[_0x169b('0x4a')]['id']}})[_0x169b('0x26')](handleEntityNotFound(_0x2f294f,null))['then'](removeEntity(_0x2f294f,null))[_0x169b('0x45')](handleError(_0x2f294f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c415f3a..b9443cd 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 _0x3933=['SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3933,0x1e0));var _0x3393=function(_0x43b834,_0x2b85eb){_0x43b834=_0x43b834-0x0;var _0x1cd7c8=_0x3933[_0x43b834];return _0x1cd7c8;};'use strict';var _=require(_0x3393('0x0'));var util=require(_0x3393('0x1'));var logger=require(_0x3393('0x2'))(_0x3393('0x3'));var moment=require(_0x3393('0x4'));var BPromise=require(_0x3393('0x5'));var rp=require(_0x3393('0x6'));var fs=require('fs');var path=require(_0x3393('0x7'));var rimraf=require(_0x3393('0x8'));var config=require(_0x3393('0x9'));var attributes=require(_0x3393('0xa'));module[_0x3393('0xb')]=function(_0x108f93,_0x20a558){return _0x108f93[_0x3393('0xc')](_0x3393('0xd'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x3393('0xe'),'fields':[_0x3393('0xf'),_0x3393('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef0a=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x4e9252,_0x22f77a){var _0x249eb0=function(_0xe96502){while(--_0xe96502){_0x4e9252['push'](_0x4e9252['shift']());}};_0x249eb0(++_0x22f77a);}(_0xef0a,0x1ac));var _0xaef0=function(_0x296bcd,_0x115fbd){_0x296bcd=_0x296bcd-0x0;var _0x13523e=_0xef0a[_0x296bcd];return _0x13523e;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var logger=require(_0xaef0('0x2'))(_0xaef0('0x3'));var moment=require(_0xaef0('0x4'));var BPromise=require(_0xaef0('0x5'));var rp=require(_0xaef0('0x6'));var fs=require('fs');var path=require(_0xaef0('0x7'));var rimraf=require(_0xaef0('0x8'));var config=require('../../config/environment');var attributes=require(_0xaef0('0x9'));module[_0xaef0('0xa')]=function(_0x3e7bf6,_0x4c2bbf){return _0x3e7bf6[_0xaef0('0xb')]('SugarcrmField',attributes,{'tableName':_0xaef0('0xc'),'paranoid':![],'indexes':[{'name':_0xaef0('0xd'),'fields':[_0xaef0('0xe'),_0xaef0('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index f2b88ec..79a3302 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 _0x9150=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a70f4,_0x4e5c15){var _0x2a4762=function(_0x2c3d54){while(--_0x2c3d54){_0x4a70f4['push'](_0x4a70f4['shift']());}};_0x2a4762(++_0x4e5c15);}(_0x9150,0x8f));var _0x0915=function(_0xfd35ab,_0x250618){_0xfd35ab=_0xfd35ab-0x0;var _0x567821=_0x9150[_0xfd35ab];return _0x567821;};'use strict';var _=require('lodash');var util=require(_0x0915('0x0'));var moment=require('moment');var BPromise=require(_0x0915('0x1'));var rs=require(_0x0915('0x2'));var fs=require('fs');var Redis=require(_0x0915('0x3'));var db=require(_0x0915('0x4'))['db'];var utils=require(_0x0915('0x5'));var logger=require(_0x0915('0x6'))(_0x0915('0x7'));var config=require(_0x0915('0x8'));var jayson=require(_0x0915('0x9'));var client=jayson[_0x0915('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9024,_0x510081,_0xbcc0d6){return new BPromise(function(_0x1e1f52,_0x1980f9){return client[_0x0915('0xb')](_0x1b9024,_0xbcc0d6)[_0x0915('0xc')](function(_0x46a9b1){logger[_0x0915('0xd')](_0x0915('0xe'),_0x510081,_0x0915('0xf'));logger[_0x0915('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x510081,_0x0915('0xf'),JSON[_0x0915('0x11')](_0x46a9b1));if(_0x46a9b1[_0x0915('0x12')]){if(_0x46a9b1[_0x0915('0x12')][_0x0915('0x13')]===0x1f4){logger[_0x0915('0x12')](_0x0915('0xe'),_0x510081,_0x46a9b1[_0x0915('0x12')][_0x0915('0x14')]);return _0x1980f9(_0x46a9b1[_0x0915('0x12')][_0x0915('0x14')]);}logger[_0x0915('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x510081,_0x46a9b1['error'][_0x0915('0x14')]);return _0x1e1f52(_0x46a9b1[_0x0915('0x12')][_0x0915('0x14')]);}else{logger[_0x0915('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x510081,'request\x20sent');_0x1e1f52(_0x46a9b1[_0x0915('0x15')][_0x0915('0x14')]);}})['catch'](function(_0x2208db){logger[_0x0915('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x510081,_0x2208db);_0x1980f9(_0x2208db);});});} \ No newline at end of file +var _0x64f5=['jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','util','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0xdca162,_0x31779c){var _0x468c80=function(_0x45f6ae){while(--_0x45f6ae){_0xdca162['push'](_0xdca162['shift']());}};_0x468c80(++_0x31779c);}(_0x64f5,0xc7));var _0x564f=function(_0x374e3c,_0x2f0485){_0x374e3c=_0x374e3c-0x0;var _0x213f94=_0x64f5[_0x374e3c];return _0x213f94;};'use strict';var _=require('lodash');var util=require(_0x564f('0x0'));var moment=require('moment');var BPromise=require(_0x564f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x564f('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x564f('0x3'))('rpc');var config=require(_0x564f('0x4'));var jayson=require(_0x564f('0x5'));var client=jayson['client'][_0x564f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x12c6e2,_0x5612b8,_0x103d3b){return new BPromise(function(_0x479a9c,_0x282923){return client[_0x564f('0x7')](_0x12c6e2,_0x103d3b)[_0x564f('0x8')](function(_0x15f747){logger['info'](_0x564f('0x9'),_0x5612b8,'request\x20sent');logger[_0x564f('0xa')](_0x564f('0xb'),_0x5612b8,'request\x20sent',JSON['stringify'](_0x15f747));if(_0x15f747['error']){if(_0x15f747[_0x564f('0xc')]['code']===0x1f4){logger[_0x564f('0xc')](_0x564f('0x9'),_0x5612b8,_0x15f747[_0x564f('0xc')][_0x564f('0xd')]);return _0x282923(_0x15f747[_0x564f('0xc')][_0x564f('0xd')]);}logger[_0x564f('0xc')](_0x564f('0x9'),_0x5612b8,_0x15f747[_0x564f('0xc')][_0x564f('0xd')]);return _0x479a9c(_0x15f747['error'][_0x564f('0xd')]);}else{logger[_0x564f('0xe')](_0x564f('0x9'),_0x5612b8,_0x564f('0xf'));_0x479a9c(_0x15f747[_0x564f('0x10')][_0x564f('0xd')]);}})['catch'](function(_0x367a1c){logger[_0x564f('0xc')](_0x564f('0x9'),_0x5612b8,_0x367a1c);_0x282923(_0x367a1c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 42642c6..06e8aa9 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 _0xb38a=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb38a,0x77));var _0xab38=function(_0x349689,_0x7017b){_0x349689=_0x349689-0x0;var _0x562d59=_0xb38a[_0x349689];return _0x562d59;};'use strict';var multer=require(_0xab38('0x0'));var util=require(_0xab38('0x1'));var path=require(_0xab38('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab38('0x3')]();var fs_extra=require(_0xab38('0x4'));var auth=require(_0xab38('0x5'));var interaction=require(_0xab38('0x6'));var config=require(_0xab38('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xab38('0x8')]('/',auth[_0xab38('0x9')](),controller[_0xab38('0xa')]);router['get'](_0xab38('0xb'),auth[_0xab38('0x9')](),controller[_0xab38('0xc')]);router[_0xab38('0x8')]('/:id/configurations',auth[_0xab38('0x9')](),controller[_0xab38('0xd')]);router[_0xab38('0x8')](_0xab38('0xe'),auth[_0xab38('0x9')](),controller[_0xab38('0xf')]);router[_0xab38('0x10')]('/',auth[_0xab38('0x9')](),controller[_0xab38('0x11')]);router[_0xab38('0x10')](_0xab38('0x12'),auth[_0xab38('0x9')](),controller[_0xab38('0x13')]);router[_0xab38('0x14')](_0xab38('0xb'),auth['isAuthenticated'](),controller[_0xab38('0x15')]);router[_0xab38('0x16')](_0xab38('0xb'),auth[_0xab38('0x9')](),controller['destroy']);module[_0xab38('0x17')]=router; \ No newline at end of file +var _0x3ffb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5d2367,_0x487465){var _0x4fffd1=function(_0xcc6b08){while(--_0xcc6b08){_0x5d2367['push'](_0x5d2367['shift']());}};_0x4fffd1(++_0x487465);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x5ea273,_0x475acb){_0x5ea273=_0x5ea273-0x0;var _0x56cce9=_0x3ffb[_0x5ea273];return _0x56cce9;};'use strict';var multer=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var path=require(_0xb3ff('0x2'));var timeout=require(_0xb3ff('0x3'));var express=require(_0xb3ff('0x4'));var router=express['Router']();var fs_extra=require(_0xb3ff('0x5'));var auth=require(_0xb3ff('0x6'));var interaction=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var controller=require(_0xb3ff('0x9'));router[_0xb3ff('0xa')]('/',auth[_0xb3ff('0xb')](),controller['index']);router[_0xb3ff('0xa')](_0xb3ff('0xc'),auth[_0xb3ff('0xb')](),controller[_0xb3ff('0xd')]);router['get']('/:id/configurations',auth[_0xb3ff('0xb')](),controller[_0xb3ff('0xe')]);router[_0xb3ff('0xa')](_0xb3ff('0xf'),auth['isAuthenticated'](),controller[_0xb3ff('0x10')]);router[_0xb3ff('0x11')]('/',auth['isAuthenticated'](),controller[_0xb3ff('0x12')]);router[_0xb3ff('0x11')](_0xb3ff('0x13'),auth[_0xb3ff('0xb')](),controller[_0xb3ff('0x14')]);router[_0xb3ff('0x15')](_0xb3ff('0xc'),auth[_0xb3ff('0xb')](),controller['update']);router[_0xb3ff('0x16')](_0xb3ff('0xc'),auth[_0xb3ff('0xb')](),controller[_0xb3ff('0x17')]);module[_0xb3ff('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 82623a3..a0ff245 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 _0x1223=['HelpDesk','exports','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1223,0x1cc));var _0x3122=function(_0x4a0df6,_0x46de51){_0x4a0df6=_0x4a0df6-0x0;var _0x5a603f=_0x1223[_0x4a0df6];return _0x5a603f;};'use strict';var Sequelize=require('sequelize');module[_0x3122('0x0')]={'name':{'type':Sequelize[_0x3122('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3122('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3122('0x1')],'allowNull':![],'defaultValue':_0x3122('0x2')},'remoteUri':{'type':Sequelize[_0x3122('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3122('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb237=['exports','STRING','HelpDesk','sequelize'];(function(_0xd5500e,_0x2bd4c2){var _0x533971=function(_0x48e5ef){while(--_0x48e5ef){_0xd5500e['push'](_0xd5500e['shift']());}};_0x533971(++_0x2bd4c2);}(_0xb237,0xa3));var _0x7b23=function(_0x5ab184,_0x25d46b){_0x5ab184=_0x5ab184-0x0;var _0x22fe50=_0xb237[_0x5ab184];return _0x22fe50;};'use strict';var Sequelize=require(_0x7b23('0x0'));module[_0x7b23('0x1')]={'name':{'type':Sequelize[_0x7b23('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b23('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7b23('0x2')],'allowNull':![],'defaultValue':_0x7b23('0x3')},'remoteUri':{'type':Sequelize[_0x7b23('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7b23('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7b23('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1b4823d..09ac706 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 _0x6dbd=['moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','username','success','POST','login','result','token','describe','reference','owner','includes','remove','editable','cf_','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','index','map','VtigerAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','params','keys','find','catch','create','body','findOne','order','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','description'];(function(_0xc9eee,_0x22438c){var _0x4ae810=function(_0x24c813){while(--_0x24c813){_0xc9eee['push'](_0xc9eee['shift']());}};_0x4ae810(++_0x22438c);}(_0x6dbd,0x16b));var _0xd6db=function(_0x5379a7,_0x4b15e7){_0x5379a7=_0x5379a7-0x0;var _0xe6ab16=_0x6dbd[_0x5379a7];return _0xe6ab16;};'use strict';var emlformat=require(_0xd6db('0x0'));var rimraf=require(_0xd6db('0x1'));var zipdir=require(_0xd6db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6db('0x3'));var moment=require(_0xd6db('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6db('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd6db('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6db('0x7'));var _=require(_0xd6db('0x8'));var squel=require('squel');var crypto=require(_0xd6db('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd6db('0xa'));var toCsv=require(_0xd6db('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd6db('0xc'));var authService=require(_0xd6db('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6db('0xe'))('api');var utils=require(_0xd6db('0xf'));var config=require(_0xd6db('0x10'));var licenseUtil=require(_0xd6db('0x11'));var db=require(_0xd6db('0x12'))['db'];var integrations=require(_0xd6db('0x13'));function respondWithStatusCode(_0x2b62dc,_0x305a5a){_0x305a5a=_0x305a5a||0xcc;return function(_0xe4d213){if(_0xe4d213){return _0x2b62dc[_0xd6db('0x14')](_0x305a5a);}return _0x2b62dc['status'](_0x305a5a)[_0xd6db('0x15')]();};}function respondWithResult(_0x43f9ae,_0x37f18b){_0x37f18b=_0x37f18b||0xc8;return function(_0x5ded09){if(_0x5ded09){return _0x43f9ae[_0xd6db('0x16')](_0x37f18b)[_0xd6db('0x17')](_0x5ded09);}};}function respondWithFilteredResult(_0x1a4941,_0x1e0905){return function(_0x63850e){if(_0x63850e){var _0xe86d87=typeof _0x1e0905['offset']===_0xd6db('0x18')&&typeof _0x1e0905[_0xd6db('0x19')]===_0xd6db('0x18');var _0xbcbbad=_0x63850e[_0xd6db('0x1a')];var _0x3f39fd=_0xe86d87?0x0:_0x1e0905[_0xd6db('0x1b')];var _0x3fa237=_0xe86d87?_0x63850e[_0xd6db('0x1a')]:_0x1e0905[_0xd6db('0x1b')]+_0x1e0905[_0xd6db('0x19')];var _0x5e7e77;if(_0x3fa237>=_0xbcbbad){_0x3fa237=_0xbcbbad;_0x5e7e77=0xc8;}else{_0x5e7e77=0xce;}_0x1a4941[_0xd6db('0x16')](_0x5e7e77);return _0x1a4941[_0xd6db('0x1c')]('Content-Range',_0x3f39fd+'-'+_0x3fa237+'/'+_0xbcbbad)[_0xd6db('0x17')](_0x63850e);}return null;};}function patchUpdates(_0x1eaf20){return function(_0x30dfb8){try{jsonpatch[_0xd6db('0x1d')](_0x30dfb8,_0x1eaf20,!![]);}catch(_0x353258){return BPromise[_0xd6db('0x1e')](_0x353258);}return _0x30dfb8['save']();};}function saveUpdates(_0x27f1b4,_0x394707){return function(_0xc519d4){if(_0xc519d4){return _0xc519d4[_0xd6db('0x1f')](_0x27f1b4)[_0xd6db('0x20')](function(_0x3dcc12){return _0x3dcc12;});}return null;};}function removeEntity(_0x4a3b06,_0xb0fa99){return function(_0x4812f1){if(_0x4812f1){return _0x4812f1[_0xd6db('0x21')]()[_0xd6db('0x20')](function(){_0x4a3b06[_0xd6db('0x16')](0xcc)[_0xd6db('0x15')]();});}};}function handleEntityNotFound(_0x3c27cf,_0x48d755){return function(_0x3d1090){if(!_0x3d1090){_0x3c27cf[_0xd6db('0x14')](0x194);}return _0x3d1090;};}function handleError(_0x307430,_0x1fa666){_0x1fa666=_0x1fa666||0x1f4;return function(_0x20a541){logger[_0xd6db('0x22')](_0x20a541[_0xd6db('0x23')]);if(_0x20a541[_0xd6db('0x24')]){delete _0x20a541[_0xd6db('0x24')];}_0x307430[_0xd6db('0x16')](_0x1fa666)['send'](_0x20a541);};}exports[_0xd6db('0x25')]=function(_0x2adbd8,_0x2e7b48){var _0x46df1c={},_0x466ac5={},_0x20e076={'count':0x0,'rows':[]};var _0x4d0464=_[_0xd6db('0x26')](db[_0xd6db('0x27')]['rawAttributes'],function(_0x3320f1){return{'name':_0x3320f1[_0xd6db('0x28')],'type':_0x3320f1[_0xd6db('0x29')][_0xd6db('0x2a')]};});_0x466ac5[_0xd6db('0x2b')]=_[_0xd6db('0x26')](_0x4d0464,_0xd6db('0x24'));_0x466ac5[_0xd6db('0x2c')]=_['keys'](_0x2adbd8[_0xd6db('0x2c')]);_0x466ac5[_0xd6db('0x2d')]=_[_0xd6db('0x2e')](_0x466ac5[_0xd6db('0x2b')],_0x466ac5[_0xd6db('0x2c')]);_0x46df1c[_0xd6db('0x2f')]=_[_0xd6db('0x2e')](_0x466ac5[_0xd6db('0x2b')],qs[_0xd6db('0x30')](_0x2adbd8['query'][_0xd6db('0x30')]));_0x46df1c['attributes']=_0x46df1c['attributes'][_0xd6db('0x31')]?_0x46df1c[_0xd6db('0x2f')]:_0x466ac5[_0xd6db('0x2b')];if(!_0x2adbd8[_0xd6db('0x2c')][_0xd6db('0x32')](_0xd6db('0x33'))){_0x46df1c[_0xd6db('0x19')]=qs['limit'](_0x2adbd8[_0xd6db('0x2c')][_0xd6db('0x19')]);_0x46df1c[_0xd6db('0x1b')]=qs[_0xd6db('0x1b')](_0x2adbd8[_0xd6db('0x2c')]['offset']);}_0x46df1c['order']=qs[_0xd6db('0x34')](_0x2adbd8[_0xd6db('0x2c')][_0xd6db('0x34')]);_0x46df1c['where']=qs[_0xd6db('0x2d')](_[_0xd6db('0x35')](_0x2adbd8['query'],_0x466ac5[_0xd6db('0x2d')]),_0x4d0464);if(_0x2adbd8[_0xd6db('0x2c')]['filter']){_0x46df1c[_0xd6db('0x36')]=_['merge'](_0x46df1c[_0xd6db('0x36')],{'$or':_['map'](_0x4d0464,function(_0x2d19b5){if(_0x2d19b5[_0xd6db('0x29')]!==_0xd6db('0x37')){var _0xbea28={};_0xbea28[_0x2d19b5[_0xd6db('0x24')]]={'$like':'%'+_0x2adbd8['query'][_0xd6db('0x38')]+'%'};return _0xbea28;}})});}_0x46df1c=_[_0xd6db('0x39')]({},_0x46df1c,_0x2adbd8[_0xd6db('0x3a')]);var _0x42e6e1={'where':_0x46df1c['where']};return db[_0xd6db('0x27')][_0xd6db('0x1a')](_0x42e6e1)['then'](function(_0x106e93){_0x20e076['count']=_0x106e93;if(_0x2adbd8['query'][_0xd6db('0x3b')]){_0x46df1c[_0xd6db('0x3c')]=[{'all':!![]}];}return db[_0xd6db('0x27')]['findAll'](_0x46df1c);})[_0xd6db('0x20')](function(_0x5a921a){_0x20e076['rows']=_0x5a921a;return _0x20e076;})['then'](respondWithFilteredResult(_0x2e7b48,_0x46df1c))['catch'](handleError(_0x2e7b48,null));};exports['show']=function(_0x1d3663,_0x19b8c7){var _0x30fd6c={'raw':![],'where':{'id':_0x1d3663[_0xd6db('0x3d')]['id']}},_0x18ac19={};_0x18ac19[_0xd6db('0x2b')]=_[_0xd6db('0x3e')](db['VtigerAccount']['rawAttributes']);_0x18ac19['query']=_[_0xd6db('0x3e')](_0x1d3663[_0xd6db('0x2c')]);_0x18ac19[_0xd6db('0x2d')]=_['intersection'](_0x18ac19[_0xd6db('0x2b')],_0x18ac19[_0xd6db('0x2c')]);_0x30fd6c[_0xd6db('0x2f')]=_['intersection'](_0x18ac19[_0xd6db('0x2b')],qs[_0xd6db('0x30')](_0x1d3663[_0xd6db('0x2c')][_0xd6db('0x30')]));_0x30fd6c['attributes']=_0x30fd6c[_0xd6db('0x2f')][_0xd6db('0x31')]?_0x30fd6c[_0xd6db('0x2f')]:_0x18ac19[_0xd6db('0x2b')];if(_0x1d3663[_0xd6db('0x2c')][_0xd6db('0x3b')]){_0x30fd6c[_0xd6db('0x3c')]=[{'all':!![]}];}_0x30fd6c=_[_0xd6db('0x39')]({},_0x30fd6c,_0x1d3663['options']);return db[_0xd6db('0x27')][_0xd6db('0x3f')](_0x30fd6c)['then'](handleEntityNotFound(_0x19b8c7,null))[_0xd6db('0x20')](respondWithResult(_0x19b8c7,null))[_0xd6db('0x40')](handleError(_0x19b8c7,null));};exports[_0xd6db('0x41')]=function(_0x266e83,_0x630dd2){return db[_0xd6db('0x27')][_0xd6db('0x41')](_0x266e83[_0xd6db('0x42')],{})['then'](respondWithResult(_0x630dd2,0xc9))[_0xd6db('0x40')](handleError(_0x630dd2,null));};exports['update']=function(_0x462e86,_0x57a2d1){if(_0x462e86[_0xd6db('0x42')]['id']){delete _0x462e86[_0xd6db('0x42')]['id'];}return db[_0xd6db('0x27')][_0xd6db('0x3f')]({'where':{'id':_0x462e86['params']['id']}})['then'](handleEntityNotFound(_0x57a2d1,null))[_0xd6db('0x20')](saveUpdates(_0x462e86[_0xd6db('0x42')],null))[_0xd6db('0x20')](respondWithResult(_0x57a2d1,null))['catch'](handleError(_0x57a2d1,null));};exports['destroy']=function(_0xe86e66,_0x39f92c){return db[_0xd6db('0x27')][_0xd6db('0x3f')]({'where':{'id':_0xe86e66[_0xd6db('0x3d')]['id']}})['then'](handleEntityNotFound(_0x39f92c,null))[_0xd6db('0x20')](removeEntity(_0x39f92c,null))[_0xd6db('0x40')](handleError(_0x39f92c,null));};exports['getConfigurations']=function(_0x266229,_0x5d924b,_0xe653bd){var _0x1798db={};var _0x216bc4={};var _0x2290df;var _0x34b88b;return db[_0xd6db('0x27')][_0xd6db('0x43')]({'where':{'id':_0x266229[_0xd6db('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5d924b,null))[_0xd6db('0x20')](function(_0x55b26f){if(_0x55b26f){_0x2290df=_0x55b26f;_0x216bc4[_0xd6db('0x2b')]=_[_0xd6db('0x3e')](db['VtigerConfiguration']['rawAttributes']);_0x216bc4['query']=_[_0xd6db('0x3e')](_0x266229[_0xd6db('0x2c')]);_0x216bc4[_0xd6db('0x2d')]=_[_0xd6db('0x2e')](_0x216bc4[_0xd6db('0x2b')],_0x216bc4[_0xd6db('0x2c')]);_0x1798db[_0xd6db('0x2f')]=_[_0xd6db('0x2e')](_0x216bc4[_0xd6db('0x2b')],qs[_0xd6db('0x30')](_0x266229[_0xd6db('0x2c')][_0xd6db('0x30')]));_0x1798db[_0xd6db('0x2f')]=_0x1798db[_0xd6db('0x2f')]['length']?_0x1798db[_0xd6db('0x2f')]:_0x216bc4['model'];_0x1798db[_0xd6db('0x44')]=qs[_0xd6db('0x34')](_0x266229[_0xd6db('0x2c')][_0xd6db('0x34')]);_0x1798db[_0xd6db('0x36')]=qs[_0xd6db('0x2d')](_[_0xd6db('0x35')](_0x266229['query'],_0x216bc4['filters']));if(_0x266229['query'][_0xd6db('0x38')]){_0x1798db[_0xd6db('0x36')]=_[_0xd6db('0x39')](_0x1798db['where'],{'$or':_[_0xd6db('0x26')](_0x1798db[_0xd6db('0x2f')],function(_0x1d4e89){var _0x1c5be5={};_0x1c5be5[_0x1d4e89]={'$like':'%'+_0x266229[_0xd6db('0x2c')][_0xd6db('0x38')]+'%'};return _0x1c5be5;})});}_0x1798db=_[_0xd6db('0x39')]({},_0x1798db,_0x266229[_0xd6db('0x3a')]);return _0x2290df[_0xd6db('0x45')](_0x1798db);}})['then'](function(_0x1f398b){if(_0x1f398b){_0x34b88b=_0x1f398b[_0xd6db('0x31')];if(!_0x266229[_0xd6db('0x2c')][_0xd6db('0x32')]('nolimit')){_0x1798db[_0xd6db('0x19')]=qs['limit'](_0x266229[_0xd6db('0x2c')][_0xd6db('0x19')]);_0x1798db['offset']=qs[_0xd6db('0x1b')](_0x266229[_0xd6db('0x2c')][_0xd6db('0x1b')]);}return _0x2290df[_0xd6db('0x45')](_0x1798db);}})[_0xd6db('0x20')](function(_0x2638e5){if(_0x2638e5){return _0x2638e5?{'count':_0x34b88b,'rows':_0x2638e5}:null;}})[_0xd6db('0x20')](respondWithResult(_0x5d924b,null))[_0xd6db('0x40')](handleError(_0x5d924b,null));};exports[_0xd6db('0x46')]=function(_0x23d5ac,_0x2482e6,_0x153417){if(_0x23d5ac[_0xd6db('0x42')]['id']){delete _0x23d5ac[_0xd6db('0x42')]['id'];}return db[_0xd6db('0x27')][_0xd6db('0x43')]({'where':{'id':_0x23d5ac[_0xd6db('0x3d')]['id']}})[_0xd6db('0x20')](handleEntityNotFound(_0x2482e6,null))['then'](function(_0x1413e6){if(_0x1413e6){_0x23d5ac['body'][_0xd6db('0x47')]=_0x1413e6['id'];_0x23d5ac[_0xd6db('0x42')][_0xd6db('0x48')]=integrations['getSubjects'](_0x23d5ac[_0xd6db('0x42')][_0xd6db('0x49')],_0x23d5ac[_0xd6db('0x42')][_0xd6db('0x29')]);_0x23d5ac['body'][_0xd6db('0x4a')]=integrations[_0xd6db('0x4b')](_0x23d5ac[_0xd6db('0x42')][_0xd6db('0x49')],_0x23d5ac['body'][_0xd6db('0x29')]);return db[_0xd6db('0x4c')][_0xd6db('0x41')](_0x23d5ac[_0xd6db('0x42')],{'include':[{'model':db[_0xd6db('0x4d')],'as':'Subjects'},{'model':db[_0xd6db('0x4d')],'as':'Descriptions'}]});}return null;})[_0xd6db('0x20')](respondWithResult(_0x2482e6,null))['catch'](handleError(_0x2482e6,null));};var md5=require(_0xd6db('0x4e'));exports[_0xd6db('0x4f')]=function(_0x25cdff,_0x3c7a87,_0x540f01){var _0x5736f3=null;var _0x1c2e18=null;var _0x55b7c7=null;var _0xaf03fe=null;var _0x18b89d='';return db[_0xd6db('0x27')][_0xd6db('0x43')]({'where':{'id':_0x25cdff[_0xd6db('0x3d')]['id']},'attributes':['id',_0xd6db('0x24'),'username',_0xd6db('0x50'),_0xd6db('0x51'),'remoteUri',_0xd6db('0x52'),_0xd6db('0x53')]})[_0xd6db('0x20')](handleEntityNotFound(_0x3c7a87,null))[_0xd6db('0x20')](function(_0x544d33){if(_0x544d33){_0x5736f3=_0x544d33['username'];_0x1c2e18=_0x544d33[_0xd6db('0x53')];_0x55b7c7=_0x544d33['moduleName'];_0x18b89d=_0x544d33[_0xd6db('0x54')];var _0x1f9ba2=_0x18b89d[_0xd6db('0x55')](-0x1);if(_0x1f9ba2==='/'){_0x18b89d=_0x18b89d[_0xd6db('0x56')](0x0,_0x18b89d[_0xd6db('0x57')](_0x1f9ba2));}_0xaf03fe=util[_0xd6db('0x58')](_0xd6db('0x59'),_0x18b89d);var _0x1a6474={'method':'GET','uri':_0xaf03fe,'qs':{'operation':_0xd6db('0x5a'),'username':_0x544d33[_0xd6db('0x5b')]},'json':!![]};return rp(_0x1a6474);}})[_0xd6db('0x20')](function(_0x1ff5e0){if(_0x1ff5e0[_0xd6db('0x5c')]){var _0x2d2eee={'method':_0xd6db('0x5d'),'uri':_0xaf03fe,'form':{'operation':_0xd6db('0x5e'),'username':_0x5736f3,'accessKey':md5(_0x1ff5e0[_0xd6db('0x5f')][_0xd6db('0x60')]+_0x1c2e18)},'json':!![]};return rp(_0x2d2eee);}})[_0xd6db('0x20')](function(_0x312758){if(_0x312758[_0xd6db('0x5c')]){var _0x30fa83={'method':'GET','uri':_0xaf03fe,'qs':{'operation':_0xd6db('0x61'),'username':_0x5736f3,'sessionName':_0x312758[_0xd6db('0x5f')]['sessionName'],'elementType':_0x55b7c7},'json':!![]};return rp(_0x30fa83);}})['then'](function(_0x485cc7){if(_0x485cc7['success']){var _0x365f79=['autogenerated',_0xd6db('0x62'),_0xd6db('0x63')];_['remove'](_0x485cc7['result'][_0xd6db('0x30')],function(_0x5ead72){return _0x365f79[_0xd6db('0x64')](_0x5ead72[_0xd6db('0x29')][_0xd6db('0x24')]);});_[_0xd6db('0x65')](_0x485cc7[_0xd6db('0x5f')][_0xd6db('0x30')],function(_0x21491b){return _0x21491b[_0xd6db('0x66')]==='false';});return{'count':_0x485cc7['result']['fields']['length'],'rows':_[_0xd6db('0x26')](_0x485cc7[_0xd6db('0x5f')][_0xd6db('0x30')],function(_0xc5cd0f){return{'id':_0xc5cd0f[_0xd6db('0x24')],'name':_0xc5cd0f['label'],'custom':_['startsWith'](_0xc5cd0f[_0xd6db('0x24')],_0xd6db('0x67'))?!![]:![],'options':_0xc5cd0f[_0xd6db('0x29')][_0xd6db('0x24')]==='picklist'&&_0xc5cd0f[_0xd6db('0x29')][_0xd6db('0x68')][_0xd6db('0x31')]>0x0?_[_0xd6db('0x26')](_0xc5cd0f[_0xd6db('0x29')][_0xd6db('0x68')],function(_0x3649c8){return{'name':_0x3649c8['label'],'value':_0x3649c8[_0xd6db('0x69')]};}):[]};})};}})[_0xd6db('0x20')](respondWithResult(_0x3c7a87,null))[_0xd6db('0x40')](function(_0x8b854a){console[_0xd6db('0x6a')](_0xd6db('0x6b')+_0x8b854a);var _0x33ce29=_0x25cdff[_0xd6db('0x2c')]['test']?0x1f4:_0x8b854a['statusCode']||0x1f4;logger[_0xd6db('0x22')](_0xd6db('0x6c'),_0xd6db('0x4f'),_0x33ce29,JSON['stringify'](_0x8b854a));delete _0x8b854a[_0xd6db('0x24')];if(_0x33ce29===0x191){_0x33ce29=0x190;}_0x3c7a87[_0xd6db('0x16')](_0x33ce29)['send'](_0x25cdff[_0xd6db('0x2c')]['test']?{'message':_0xd6db('0x6d'),'statusCode':_0x8b854a[_0xd6db('0x6e')]}:_0x8b854a);});}; \ No newline at end of file +var _0x80f9=['then','sendStatus','stack','name','VtigerAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','Subjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','moduleName','remoteUri','accessKey','slice','lastIndexOf','format','GET','POST','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','includes','label','startsWith','cf_','picklistValues','value','log','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy'];(function(_0x540f05,_0x5676a2){var _0xe15876=function(_0x48863d){while(--_0x48863d){_0x540f05['push'](_0x540f05['shift']());}};_0xe15876(++_0x5676a2);}(_0x80f9,0xbe));var _0x980f=function(_0x532457,_0x208dc2){_0x532457=_0x532457-0x0;var _0x3b5461=_0x80f9[_0x532457];return _0x3b5461;};'use strict';var emlformat=require(_0x980f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x980f('0x1'));var rp=require(_0x980f('0x2'));var moment=require(_0x980f('0x3'));var BPromise=require(_0x980f('0x4'));var Mustache=require(_0x980f('0x5'));var util=require(_0x980f('0x6'));var path=require('path');var sox=require(_0x980f('0x7'));var csv=require('to-csv');var ejs=require(_0x980f('0x8'));var fs=require('fs');var fs_extra=require(_0x980f('0x9'));var _=require('lodash');var squel=require(_0x980f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x980f('0xb'));var Redis=require(_0x980f('0xc'));var authService=require(_0x980f('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x980f('0xe'));var logger=require('../../config/logger')(_0x980f('0xf'));var utils=require(_0x980f('0x10'));var config=require(_0x980f('0x11'));var licenseUtil=require(_0x980f('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0x980f('0x13'));function respondWithStatusCode(_0x15e9ba,_0x5b8989){_0x5b8989=_0x5b8989||0xcc;return function(_0x4a5840){if(_0x4a5840){return _0x15e9ba['sendStatus'](_0x5b8989);}return _0x15e9ba[_0x980f('0x14')](_0x5b8989)[_0x980f('0x15')]();};}function respondWithResult(_0x5c5b74,_0x24b2c8){_0x24b2c8=_0x24b2c8||0xc8;return function(_0x3e4417){if(_0x3e4417){return _0x5c5b74[_0x980f('0x14')](_0x24b2c8)[_0x980f('0x16')](_0x3e4417);}};}function respondWithFilteredResult(_0x19b2f6,_0xd2ee83){return function(_0x477852){if(_0x477852){var _0x1be7ec=typeof _0xd2ee83[_0x980f('0x17')]==='undefined'&&typeof _0xd2ee83[_0x980f('0x18')]==='undefined';var _0x7b0160=_0x477852[_0x980f('0x19')];var _0x4357cc=_0x1be7ec?0x0:_0xd2ee83['offset'];var _0x34eafe=_0x1be7ec?_0x477852[_0x980f('0x19')]:_0xd2ee83[_0x980f('0x17')]+_0xd2ee83[_0x980f('0x18')];var _0x2f4510;if(_0x34eafe>=_0x7b0160){_0x34eafe=_0x7b0160;_0x2f4510=0xc8;}else{_0x2f4510=0xce;}_0x19b2f6[_0x980f('0x14')](_0x2f4510);return _0x19b2f6[_0x980f('0x1a')](_0x980f('0x1b'),_0x4357cc+'-'+_0x34eafe+'/'+_0x7b0160)['json'](_0x477852);}return null;};}function patchUpdates(_0x33b1c2){return function(_0x500b92){try{jsonpatch[_0x980f('0x1c')](_0x500b92,_0x33b1c2,!![]);}catch(_0xb128eb){return BPromise[_0x980f('0x1d')](_0xb128eb);}return _0x500b92[_0x980f('0x1e')]();};}function saveUpdates(_0x2dad07,_0x43cd58){return function(_0x1aaea3){if(_0x1aaea3){return _0x1aaea3['update'](_0x2dad07)['then'](function(_0x576285){return _0x576285;});}return null;};}function removeEntity(_0xbf0787,_0x599fba){return function(_0x4fc2aa){if(_0x4fc2aa){return _0x4fc2aa[_0x980f('0x1f')]()[_0x980f('0x20')](function(){_0xbf0787['status'](0xcc)[_0x980f('0x15')]();});}};}function handleEntityNotFound(_0x1fd4ec,_0x156f67){return function(_0x4ca5c1){if(!_0x4ca5c1){_0x1fd4ec[_0x980f('0x21')](0x194);}return _0x4ca5c1;};}function handleError(_0x44192d,_0x50c89b){_0x50c89b=_0x50c89b||0x1f4;return function(_0x1930e6){logger['error'](_0x1930e6[_0x980f('0x22')]);if(_0x1930e6['name']){delete _0x1930e6[_0x980f('0x23')];}_0x44192d[_0x980f('0x14')](_0x50c89b)['send'](_0x1930e6);};}exports['index']=function(_0x4c9ab7,_0x44898a){var _0x3953a4={},_0x430d80={},_0x5d7331={'count':0x0,'rows':[]};var _0x2780e9=_['map'](db[_0x980f('0x24')][_0x980f('0x25')],function(_0x1ef34c){return{'name':_0x1ef34c[_0x980f('0x26')],'type':_0x1ef34c[_0x980f('0x27')]['key']};});_0x430d80[_0x980f('0x28')]=_[_0x980f('0x29')](_0x2780e9,_0x980f('0x23'));_0x430d80[_0x980f('0x2a')]=_[_0x980f('0x2b')](_0x4c9ab7[_0x980f('0x2a')]);_0x430d80['filters']=_[_0x980f('0x2c')](_0x430d80[_0x980f('0x28')],_0x430d80[_0x980f('0x2a')]);_0x3953a4[_0x980f('0x2d')]=_['intersection'](_0x430d80[_0x980f('0x28')],qs[_0x980f('0x2e')](_0x4c9ab7['query']['fields']));_0x3953a4[_0x980f('0x2d')]=_0x3953a4[_0x980f('0x2d')][_0x980f('0x2f')]?_0x3953a4[_0x980f('0x2d')]:_0x430d80[_0x980f('0x28')];if(!_0x4c9ab7[_0x980f('0x2a')]['hasOwnProperty'](_0x980f('0x30'))){_0x3953a4[_0x980f('0x18')]=qs[_0x980f('0x18')](_0x4c9ab7[_0x980f('0x2a')]['limit']);_0x3953a4[_0x980f('0x17')]=qs['offset'](_0x4c9ab7[_0x980f('0x2a')][_0x980f('0x17')]);}_0x3953a4[_0x980f('0x31')]=qs[_0x980f('0x32')](_0x4c9ab7[_0x980f('0x2a')][_0x980f('0x32')]);_0x3953a4[_0x980f('0x33')]=qs[_0x980f('0x34')](_[_0x980f('0x35')](_0x4c9ab7['query'],_0x430d80[_0x980f('0x34')]),_0x2780e9);if(_0x4c9ab7['query']['filter']){_0x3953a4['where']=_[_0x980f('0x36')](_0x3953a4[_0x980f('0x33')],{'$or':_[_0x980f('0x29')](_0x2780e9,function(_0x4a6fcd){if(_0x4a6fcd['type']!==_0x980f('0x37')){var _0x1fe064={};_0x1fe064[_0x4a6fcd[_0x980f('0x23')]]={'$like':'%'+_0x4c9ab7['query'][_0x980f('0x38')]+'%'};return _0x1fe064;}})});}_0x3953a4=_[_0x980f('0x36')]({},_0x3953a4,_0x4c9ab7[_0x980f('0x39')]);var _0x269ccf={'where':_0x3953a4[_0x980f('0x33')]};return db['VtigerAccount'][_0x980f('0x19')](_0x269ccf)['then'](function(_0x5b24c5){_0x5d7331[_0x980f('0x19')]=_0x5b24c5;if(_0x4c9ab7[_0x980f('0x2a')]['includeAll']){_0x3953a4['include']=[{'all':!![]}];}return db[_0x980f('0x24')][_0x980f('0x3a')](_0x3953a4);})['then'](function(_0x40e22e){_0x5d7331['rows']=_0x40e22e;return _0x5d7331;})[_0x980f('0x20')](respondWithFilteredResult(_0x44898a,_0x3953a4))[_0x980f('0x3b')](handleError(_0x44898a,null));};exports[_0x980f('0x3c')]=function(_0x48e428,_0x17dcb4){var _0x410534={'raw':![],'where':{'id':_0x48e428[_0x980f('0x3d')]['id']}},_0x2295d5={};_0x2295d5[_0x980f('0x28')]=_['keys'](db[_0x980f('0x24')][_0x980f('0x25')]);_0x2295d5[_0x980f('0x2a')]=_[_0x980f('0x2b')](_0x48e428['query']);_0x2295d5['filters']=_[_0x980f('0x2c')](_0x2295d5['model'],_0x2295d5[_0x980f('0x2a')]);_0x410534[_0x980f('0x2d')]=_['intersection'](_0x2295d5[_0x980f('0x28')],qs[_0x980f('0x2e')](_0x48e428[_0x980f('0x2a')][_0x980f('0x2e')]));_0x410534[_0x980f('0x2d')]=_0x410534[_0x980f('0x2d')][_0x980f('0x2f')]?_0x410534[_0x980f('0x2d')]:_0x2295d5[_0x980f('0x28')];if(_0x48e428['query'][_0x980f('0x3e')]){_0x410534[_0x980f('0x3f')]=[{'all':!![]}];}_0x410534=_[_0x980f('0x36')]({},_0x410534,_0x48e428[_0x980f('0x39')]);return db[_0x980f('0x24')][_0x980f('0x40')](_0x410534)['then'](handleEntityNotFound(_0x17dcb4,null))['then'](respondWithResult(_0x17dcb4,null))[_0x980f('0x3b')](handleError(_0x17dcb4,null));};exports[_0x980f('0x41')]=function(_0x392d68,_0x203613){return db[_0x980f('0x24')][_0x980f('0x41')](_0x392d68[_0x980f('0x42')],{})[_0x980f('0x20')](respondWithResult(_0x203613,0xc9))[_0x980f('0x3b')](handleError(_0x203613,null));};exports[_0x980f('0x43')]=function(_0x1adc69,_0x5597b6){if(_0x1adc69[_0x980f('0x42')]['id']){delete _0x1adc69[_0x980f('0x42')]['id'];}return db[_0x980f('0x24')][_0x980f('0x40')]({'where':{'id':_0x1adc69[_0x980f('0x3d')]['id']}})[_0x980f('0x20')](handleEntityNotFound(_0x5597b6,null))[_0x980f('0x20')](saveUpdates(_0x1adc69[_0x980f('0x42')],null))[_0x980f('0x20')](respondWithResult(_0x5597b6,null))['catch'](handleError(_0x5597b6,null));};exports[_0x980f('0x1f')]=function(_0x2e9d10,_0x2c4573){return db[_0x980f('0x24')][_0x980f('0x40')]({'where':{'id':_0x2e9d10['params']['id']}})['then'](handleEntityNotFound(_0x2c4573,null))[_0x980f('0x20')](removeEntity(_0x2c4573,null))[_0x980f('0x3b')](handleError(_0x2c4573,null));};exports[_0x980f('0x44')]=function(_0x2ebbe2,_0x51ff1a,_0x3897eb){var _0x2e2298={};var _0x4aa7b1={};var _0x37ce88;var _0x3fe141;return db[_0x980f('0x24')][_0x980f('0x45')]({'where':{'id':_0x2ebbe2['params']['id']}})[_0x980f('0x20')](handleEntityNotFound(_0x51ff1a,null))[_0x980f('0x20')](function(_0x2a4f5b){if(_0x2a4f5b){_0x37ce88=_0x2a4f5b;_0x4aa7b1[_0x980f('0x28')]=_['keys'](db[_0x980f('0x46')][_0x980f('0x25')]);_0x4aa7b1[_0x980f('0x2a')]=_[_0x980f('0x2b')](_0x2ebbe2['query']);_0x4aa7b1[_0x980f('0x34')]=_['intersection'](_0x4aa7b1['model'],_0x4aa7b1[_0x980f('0x2a')]);_0x2e2298['attributes']=_[_0x980f('0x2c')](_0x4aa7b1['model'],qs[_0x980f('0x2e')](_0x2ebbe2[_0x980f('0x2a')][_0x980f('0x2e')]));_0x2e2298[_0x980f('0x2d')]=_0x2e2298[_0x980f('0x2d')]['length']?_0x2e2298[_0x980f('0x2d')]:_0x4aa7b1[_0x980f('0x28')];_0x2e2298[_0x980f('0x31')]=qs[_0x980f('0x32')](_0x2ebbe2[_0x980f('0x2a')][_0x980f('0x32')]);_0x2e2298[_0x980f('0x33')]=qs[_0x980f('0x34')](_[_0x980f('0x35')](_0x2ebbe2[_0x980f('0x2a')],_0x4aa7b1['filters']));if(_0x2ebbe2[_0x980f('0x2a')][_0x980f('0x38')]){_0x2e2298[_0x980f('0x33')]=_[_0x980f('0x36')](_0x2e2298[_0x980f('0x33')],{'$or':_[_0x980f('0x29')](_0x2e2298[_0x980f('0x2d')],function(_0x51a58a){var _0x1da21c={};_0x1da21c[_0x51a58a]={'$like':'%'+_0x2ebbe2['query'][_0x980f('0x38')]+'%'};return _0x1da21c;})});}_0x2e2298=_[_0x980f('0x36')]({},_0x2e2298,_0x2ebbe2[_0x980f('0x39')]);return _0x37ce88[_0x980f('0x44')](_0x2e2298);}})[_0x980f('0x20')](function(_0x52d13a){if(_0x52d13a){_0x3fe141=_0x52d13a[_0x980f('0x2f')];if(!_0x2ebbe2[_0x980f('0x2a')][_0x980f('0x47')](_0x980f('0x30'))){_0x2e2298[_0x980f('0x18')]=qs[_0x980f('0x18')](_0x2ebbe2[_0x980f('0x2a')][_0x980f('0x18')]);_0x2e2298['offset']=qs['offset'](_0x2ebbe2[_0x980f('0x2a')][_0x980f('0x17')]);}return _0x37ce88[_0x980f('0x44')](_0x2e2298);}})[_0x980f('0x20')](function(_0x1e06f3){if(_0x1e06f3){return _0x1e06f3?{'count':_0x3fe141,'rows':_0x1e06f3}:null;}})[_0x980f('0x20')](respondWithResult(_0x51ff1a,null))[_0x980f('0x3b')](handleError(_0x51ff1a,null));};exports[_0x980f('0x48')]=function(_0x445fa0,_0xff769f,_0x57e028){if(_0x445fa0[_0x980f('0x42')]['id']){delete _0x445fa0[_0x980f('0x42')]['id'];}return db[_0x980f('0x24')][_0x980f('0x45')]({'where':{'id':_0x445fa0[_0x980f('0x3d')]['id']}})[_0x980f('0x20')](handleEntityNotFound(_0xff769f,null))[_0x980f('0x20')](function(_0x42edf2){if(_0x42edf2){_0x445fa0[_0x980f('0x42')]['AccountId']=_0x42edf2['id'];_0x445fa0[_0x980f('0x42')][_0x980f('0x49')]=integrations['getSubjects'](_0x445fa0[_0x980f('0x42')]['channel'],_0x445fa0[_0x980f('0x42')][_0x980f('0x27')]);_0x445fa0[_0x980f('0x42')][_0x980f('0x4a')]=integrations[_0x980f('0x4b')](_0x445fa0['body'][_0x980f('0x4c')],_0x445fa0[_0x980f('0x42')][_0x980f('0x27')]);return db[_0x980f('0x46')]['create'](_0x445fa0[_0x980f('0x42')],{'include':[{'model':db[_0x980f('0x4d')],'as':_0x980f('0x49')},{'model':db[_0x980f('0x4d')],'as':_0x980f('0x4a')}]});}return null;})[_0x980f('0x20')](respondWithResult(_0xff769f,null))['catch'](handleError(_0xff769f,null));};var md5=require(_0x980f('0x4e'));exports[_0x980f('0x4f')]=function(_0x80823c,_0x34f824,_0x3ea209){var _0x1a2f82=null;var _0x57dafa=null;var _0xc926fe=null;var _0x255cfc=null;var _0x2c7af9='';return db[_0x980f('0x24')]['findOne']({'where':{'id':_0x80823c[_0x980f('0x3d')]['id']},'attributes':['id','name',_0x980f('0x50'),'description',_0x980f('0x51'),_0x980f('0x52'),'serverUrl',_0x980f('0x53')]})[_0x980f('0x20')](handleEntityNotFound(_0x34f824,null))[_0x980f('0x20')](function(_0x599dc9){if(_0x599dc9){_0x1a2f82=_0x599dc9[_0x980f('0x50')];_0x57dafa=_0x599dc9[_0x980f('0x53')];_0xc926fe=_0x599dc9[_0x980f('0x51')];_0x2c7af9=_0x599dc9[_0x980f('0x52')];var _0x43296d=_0x2c7af9[_0x980f('0x54')](-0x1);if(_0x43296d==='/'){_0x2c7af9=_0x2c7af9['substring'](0x0,_0x2c7af9[_0x980f('0x55')](_0x43296d));}_0x255cfc=util[_0x980f('0x56')]('%s/webservice.php',_0x2c7af9);var _0x589c0c={'method':_0x980f('0x57'),'uri':_0x255cfc,'qs':{'operation':'getchallenge','username':_0x599dc9[_0x980f('0x50')]},'json':!![]};return rp(_0x589c0c);}})[_0x980f('0x20')](function(_0x28ebcb){if(_0x28ebcb['success']){var _0x2436dd={'method':_0x980f('0x58'),'uri':_0x255cfc,'form':{'operation':_0x980f('0x59'),'username':_0x1a2f82,'accessKey':md5(_0x28ebcb[_0x980f('0x5a')][_0x980f('0x5b')]+_0x57dafa)},'json':!![]};return rp(_0x2436dd);}})['then'](function(_0x5cc519){if(_0x5cc519[_0x980f('0x5c')]){var _0x480af6={'method':_0x980f('0x57'),'uri':_0x255cfc,'qs':{'operation':_0x980f('0x5d'),'username':_0x1a2f82,'sessionName':_0x5cc519[_0x980f('0x5a')][_0x980f('0x5e')],'elementType':_0xc926fe},'json':!![]};return rp(_0x480af6);}})['then'](function(_0x2b551c){if(_0x2b551c[_0x980f('0x5c')]){var _0x39493a=[_0x980f('0x5f'),_0x980f('0x60'),_0x980f('0x61')];_[_0x980f('0x62')](_0x2b551c[_0x980f('0x5a')][_0x980f('0x2e')],function(_0x1337b1){return _0x39493a[_0x980f('0x63')](_0x1337b1[_0x980f('0x27')]['name']);});_['remove'](_0x2b551c[_0x980f('0x5a')][_0x980f('0x2e')],function(_0x33c79c){return _0x33c79c['editable']==='false';});return{'count':_0x2b551c['result'][_0x980f('0x2e')][_0x980f('0x2f')],'rows':_[_0x980f('0x29')](_0x2b551c[_0x980f('0x5a')][_0x980f('0x2e')],function(_0x44a7de){return{'id':_0x44a7de[_0x980f('0x23')],'name':_0x44a7de[_0x980f('0x64')],'custom':_[_0x980f('0x65')](_0x44a7de[_0x980f('0x23')],_0x980f('0x66'))?!![]:![],'options':_0x44a7de['type'][_0x980f('0x23')]==='picklist'&&_0x44a7de['type'][_0x980f('0x67')]['length']>0x0?_[_0x980f('0x29')](_0x44a7de[_0x980f('0x27')][_0x980f('0x67')],function(_0x581dbd){return{'name':_0x581dbd[_0x980f('0x64')],'value':_0x581dbd[_0x980f('0x68')]};}):[]};})};}})['then'](respondWithResult(_0x34f824,null))[_0x980f('0x3b')](function(_0x1ec02a){console[_0x980f('0x69')]('vTiger\x20error:\x20'+_0x1ec02a);var _0x1c1621=_0x80823c['query']['test']?0x1f4:_0x1ec02a['statusCode']||0x1f4;logger['error'](_0x980f('0x6a'),_0x980f('0x4f'),_0x1c1621,JSON[_0x980f('0x6b')](_0x1ec02a));delete _0x1ec02a[_0x980f('0x23')];if(_0x1c1621===0x191){_0x1c1621=0x190;}_0x34f824[_0x980f('0x14')](_0x1c1621)[_0x980f('0x6c')](_0x80823c['query'][_0x980f('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x1ec02a[_0x980f('0x6e')]}:_0x1ec02a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index bbdccdd..50b1093 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 _0x0a6e=['define','VtigerAccount','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports'];(function(_0x3ef772,_0x20562e){var _0x273793=function(_0x52400b){while(--_0x52400b){_0x3ef772['push'](_0x3ef772['shift']());}};_0x273793(++_0x20562e);}(_0x0a6e,0x17e));var _0xe0a6=function(_0x31f878,_0x1dd579){_0x31f878=_0x31f878-0x0;var _0x41c37e=_0x0a6e[_0x31f878];return _0x41c37e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe0a6('0x0'))(_0xe0a6('0x1'));var moment=require('moment');var BPromise=require(_0xe0a6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0a6('0x3'));var rimraf=require(_0xe0a6('0x4'));var config=require(_0xe0a6('0x5'));var attributes=require(_0xe0a6('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xe0a6('0x7')]=function(_0x10aaad,_0x20e512){return _0x10aaad[_0xe0a6('0x8')](_0xe0a6('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a8d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','util'];(function(_0x94a721,_0xd2b989){var _0x353bfe=function(_0x500580){while(--_0x500580){_0x94a721['push'](_0x94a721['shift']());}};_0x353bfe(++_0xd2b989);}(_0x3a8d,0xcb));var _0xd3a8=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x3a8d[_0x41bdd4];return _0x5c03a6;};'use strict';var _=require('lodash');var util=require(_0xd3a8('0x0'));var logger=require('../../config/logger')(_0xd3a8('0x1'));var moment=require(_0xd3a8('0x2'));var BPromise=require(_0xd3a8('0x3'));var rp=require(_0xd3a8('0x4'));var fs=require('fs');var path=require(_0xd3a8('0x5'));var rimraf=require(_0xd3a8('0x6'));var config=require(_0xd3a8('0x7'));var attributes=require(_0xd3a8('0x8'));var integrations=require(_0xd3a8('0x9'));module['exports']=function(_0x424d1d,_0x247b0c){return _0x424d1d[_0xd3a8('0xa')](_0xd3a8('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 a37a488..a338351 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 _0x5ec6=['util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','ShowVtigerAccount','find','lodash'];(function(_0x6c681d,_0x2ac778){var _0x430c71=function(_0x542ff5){while(--_0x542ff5){_0x6c681d['push'](_0x6c681d['shift']());}};_0x430c71(++_0x2ac778);}(_0x5ec6,0x7f));var _0x65ec=function(_0x3877cf,_0x459c18){_0x3877cf=_0x3877cf-0x0;var _0x41ccd3=_0x5ec6[_0x3877cf];return _0x41ccd3;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('VtigerAccount,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')]({'raw':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x19')]||null:null,'attributes':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'limit':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')]['limit']||null:null,'include':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0x47288d){return{'model':db[_0x47288d['model']],'as':_0x47288d['as'],'attributes':_0x47288d[_0x65ec('0x1a')],'include':_0x47288d[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x47288d[_0x65ec('0x1b')],function(_0x288e66){return{'model':db[_0x288e66[_0x65ec('0x1d')]],'as':_0x288e66['as'],'attributes':_0x288e66[_0x65ec('0x1a')],'include':_0x288e66[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x288e66['include'],function(_0x10baef){return{'model':db[_0x10baef[_0x65ec('0x1d')]],'as':_0x10baef['as'],'attributes':_0x10baef[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x4de451){logger[_0x65ec('0x12')]('GetVtigerAccount',_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x4de451));_0x29ebc4(_0x4de451);})[_0x65ec('0x13')](function(_0x14431d){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x14431d[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x14431d[_0x65ec('0x11')]));});});};exports[_0x65ec('0x1e')]=function(_0x4b435c){var _0x50d81f=this;return new Promise(function(_0x1d2e24,_0x5084af){return db[_0x65ec('0x15')][_0x65ec('0x1f')]({'raw':_0x4b435c['options']?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')]['where']||null:null,'attributes':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'include':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0xff3f3c){return{'model':db[_0xff3f3c['model']],'as':_0xff3f3c['as'],'attributes':_0xff3f3c[_0x65ec('0x1a')],'include':_0xff3f3c[_0x65ec('0x1b')]?_['map'](_0xff3f3c[_0x65ec('0x1b')],function(_0x24a242){return{'model':db[_0x24a242[_0x65ec('0x1d')]],'as':_0x24a242['as'],'attributes':_0x24a242[_0x65ec('0x1a')],'include':_0x24a242[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x24a242[_0x65ec('0x1b')],function(_0x5afcfc){return{'model':db[_0x5afcfc[_0x65ec('0x1d')]],'as':_0x5afcfc['as'],'attributes':_0x5afcfc[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x185447){logger['info'](_0x65ec('0x1e'),_0x4b435c);logger[_0x65ec('0xc')](_0x65ec('0x1e'),_0x4b435c,JSON[_0x65ec('0xe')](_0x185447));_0x1d2e24(_0x185447);})['catch'](function(_0x59a1c2){logger[_0x65ec('0xf')]('ShowVtigerAccount',_0x59a1c2[_0x65ec('0x11')],_0x4b435c);_0x5084af(_0x50d81f[_0x65ec('0xf')](0x1f4,_0x59a1c2['message']));});});}; \ No newline at end of file +var _0x1c7c=['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','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','include','map','model','attributes','ShowVtigerAccount','raw','lodash','util','moment','bluebird'];(function(_0x341fd6,_0x9d0e71){var _0x3755d3=function(_0x3b7fd3){while(--_0x3b7fd3){_0x341fd6['push'](_0x341fd6['shift']());}};_0x3755d3(++_0x9d0e71);}(_0x1c7c,0x164));var _0xc1c7=function(_0x42e5ee,_0x356e01){_0x42e5ee=_0x42e5ee-0x0;var _0x49e0be=_0x1c7c[_0x42e5ee];return _0x49e0be;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x419138,_0xce5bcd,_0x3b3e9c){return new BPromise(function(_0x434a35,_0x11c7ef){return client[_0xc1c7('0xc')](_0x419138,_0x3b3e9c)[_0xc1c7('0xd')](function(_0x339649){logger[_0xc1c7('0xe')](_0xc1c7('0xf'),_0xce5bcd,'request\x20sent');logger[_0xc1c7('0x10')](_0xc1c7('0x11'),_0xce5bcd,'request\x20sent',JSON[_0xc1c7('0x12')](_0x339649));if(_0x339649[_0xc1c7('0x13')]){if(_0x339649[_0xc1c7('0x13')]['code']===0x1f4){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x11c7ef(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x434a35(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}else{logger['info'](_0xc1c7('0xf'),_0xce5bcd,_0xc1c7('0x15'));_0x434a35(_0x339649[_0xc1c7('0x16')]['message']);}})[_0xc1c7('0x17')](function(_0x3939c1){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x3939c1);_0x11c7ef(_0x3939c1);});});}exports[_0xc1c7('0x18')]=function(_0xb42702){var _0x21758a=this;return new Promise(function(_0x2e93e5,_0x5d44e9){return db[_0xc1c7('0x19')][_0xc1c7('0x1a')]({'raw':_0xb42702[_0xc1c7('0x1b')]?_0xb42702[_0xc1c7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xb42702[_0xc1c7('0x1b')]?_0xb42702['options'][_0xc1c7('0x1c')]||null:null,'attributes':_0xb42702[_0xc1c7('0x1b')]?_0xb42702['options']['attributes']||null:null,'limit':_0xb42702[_0xc1c7('0x1b')]?_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1d')]||null:null,'include':_0xb42702['options']?_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1e')],function(_0x3a2483){return{'model':db[_0x3a2483[_0xc1c7('0x20')]],'as':_0x3a2483['as'],'attributes':_0x3a2483[_0xc1c7('0x21')],'include':_0x3a2483[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x3a2483[_0xc1c7('0x1e')],function(_0x363fbc){return{'model':db[_0x363fbc[_0xc1c7('0x20')]],'as':_0x363fbc['as'],'attributes':_0x363fbc[_0xc1c7('0x21')],'include':_0x363fbc[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x363fbc['include'],function(_0xf0ab9c){return{'model':db[_0xf0ab9c[_0xc1c7('0x20')]],'as':_0xf0ab9c['as'],'attributes':_0xf0ab9c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x352f24){logger['info']('GetVtigerAccount',_0xb42702);logger[_0xc1c7('0x10')](_0xc1c7('0x18'),_0xb42702,JSON[_0xc1c7('0x12')](_0x352f24));_0x2e93e5(_0x352f24);})[_0xc1c7('0x17')](function(_0x461360){logger['error']('GetVtigerAccount',_0x461360[_0xc1c7('0x14')],_0xb42702);_0x5d44e9(_0x21758a[_0xc1c7('0x13')](0x1f4,_0x461360[_0xc1c7('0x14')]));});});};exports[_0xc1c7('0x22')]=function(_0x2e35f1){var _0x4968b0=this;return new Promise(function(_0x50042f,_0x125920){return db[_0xc1c7('0x19')]['find']({'raw':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x23')]===undefined?!![]:![]:!![],'where':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1c')]||null:null,'attributes':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1['options'][_0xc1c7('0x21')]||null:null,'include':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1e')],function(_0xef703f){return{'model':db[_0xef703f[_0xc1c7('0x20')]],'as':_0xef703f['as'],'attributes':_0xef703f['attributes'],'include':_0xef703f['include']?_[_0xc1c7('0x1f')](_0xef703f[_0xc1c7('0x1e')],function(_0x263900){return{'model':db[_0x263900[_0xc1c7('0x20')]],'as':_0x263900['as'],'attributes':_0x263900[_0xc1c7('0x21')],'include':_0x263900[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x263900[_0xc1c7('0x1e')],function(_0x3bd3b0){return{'model':db[_0x3bd3b0[_0xc1c7('0x20')]],'as':_0x3bd3b0['as'],'attributes':_0x3bd3b0[_0xc1c7('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc1c7('0xd')](function(_0x154476){logger[_0xc1c7('0xe')](_0xc1c7('0x22'),_0x2e35f1);logger[_0xc1c7('0x10')](_0xc1c7('0x22'),_0x2e35f1,JSON[_0xc1c7('0x12')](_0x154476));_0x50042f(_0x154476);})[_0xc1c7('0x17')](function(_0x239a91){logger[_0xc1c7('0x13')]('ShowVtigerAccount',_0x239a91['message'],_0x2e35f1);_0x125920(_0x4968b0['error'](0x1f4,_0x239a91[_0xc1c7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 22cd71e..0dbc989 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 _0x4633=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4633,0xa5));var _0x3463=function(_0x5a976b,_0xa2ea8){_0x5a976b=_0x5a976b-0x0;var _0x4d283f=_0x4633[_0x5a976b];return _0x4d283f;};'use strict';var multer=require(_0x3463('0x0'));var util=require('util');var path=require(_0x3463('0x1'));var timeout=require(_0x3463('0x2'));var express=require('express');var router=express[_0x3463('0x3')]();var fs_extra=require(_0x3463('0x4'));var auth=require(_0x3463('0x5'));var interaction=require(_0x3463('0x6'));var config=require(_0x3463('0x7'));var controller=require(_0x3463('0x8'));router[_0x3463('0x9')]('/',auth[_0x3463('0xa')](),controller['index']);router[_0x3463('0x9')](_0x3463('0xb'),auth[_0x3463('0xa')](),controller['show']);router[_0x3463('0x9')](_0x3463('0xc'),auth[_0x3463('0xa')](),controller[_0x3463('0xd')]);router[_0x3463('0x9')]('/:id/subjects',auth[_0x3463('0xa')](),controller[_0x3463('0xe')]);router[_0x3463('0x9')](_0x3463('0xf'),auth[_0x3463('0xa')](),controller['getDescriptions']);router[_0x3463('0x10')]('/',auth['isAuthenticated'](),controller[_0x3463('0x11')]);router[_0x3463('0x12')]('/:id',auth[_0x3463('0xa')](),controller[_0x3463('0x13')]);router[_0x3463('0x14')](_0x3463('0xb'),auth[_0x3463('0xa')](),controller[_0x3463('0x15')]);module[_0x3463('0x16')]=router; \ No newline at end of file +var _0xf94f=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update'];(function(_0x44a14f,_0xb644d3){var _0x397300=function(_0x4f37ed){while(--_0x4f37ed){_0x44a14f['push'](_0x44a14f['shift']());}};_0x397300(++_0xb644d3);}(_0xf94f,0x15b));var _0xff94=function(_0x1f59f1,_0x41f79d){_0x1f59f1=_0x1f59f1-0x0;var _0x31f76=_0xf94f[_0x1f59f1];return _0x31f76;};'use strict';var multer=require('multer');var util=require(_0xff94('0x0'));var path=require(_0xff94('0x1'));var timeout=require(_0xff94('0x2'));var express=require(_0xff94('0x3'));var router=express['Router']();var fs_extra=require(_0xff94('0x4'));var auth=require(_0xff94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xff94('0x6'));var controller=require(_0xff94('0x7'));router[_0xff94('0x8')]('/',auth[_0xff94('0x9')](),controller[_0xff94('0xa')]);router[_0xff94('0x8')](_0xff94('0xb'),auth[_0xff94('0x9')](),controller[_0xff94('0xc')]);router[_0xff94('0x8')]('/:id/fields',auth[_0xff94('0x9')](),controller[_0xff94('0xd')]);router['get'](_0xff94('0xe'),auth[_0xff94('0x9')](),controller[_0xff94('0xf')]);router[_0xff94('0x8')](_0xff94('0x10'),auth[_0xff94('0x9')](),controller[_0xff94('0x11')]);router[_0xff94('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff94('0x13')](_0xff94('0xb'),auth[_0xff94('0x9')](),controller[_0xff94('0x14')]);router['delete'](_0xff94('0xb'),auth[_0xff94('0x9')](),controller[_0xff94('0x15')]);module[_0xff94('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5ba1965..5dd86cf 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 _0x3ae5=['sequelize'];(function(_0x4a5516,_0x4cf973){var _0x161148=function(_0xe05e8a){while(--_0xe05e8a){_0x4a5516['push'](_0x4a5516['shift']());}};_0x161148(++_0x4cf973);}(_0x3ae5,0x9e));var _0x53ae=function(_0x1c12a8,_0x1b4119){_0x1c12a8=_0x1c12a8-0x0;var _0x310111=_0x3ae5[_0x1c12a8];return _0x310111;};'use strict';var Sequelize=require(_0x53ae('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a52=['exports','STRING','sequelize'];(function(_0x1e0612,_0x37bef1){var _0x15041a=function(_0x548072){while(--_0x548072){_0x1e0612['push'](_0x1e0612['shift']());}};_0x15041a(++_0x37bef1);}(_0x6a52,0x182));var _0x26a5=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x6a52[_0x47e549];return _0x251374;};'use strict';var Sequelize=require(_0x26a5('0x0'));module[_0x26a5('0x1')]={'name':{'type':Sequelize[_0x26a5('0x2')]},'description':{'type':Sequelize[_0x26a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2326dfc..347f726 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 _0x4f6f=['includeAll','include','rows','catch','show','merge','find','create','body','params','VtigerField','getFields','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options'];(function(_0x320ff9,_0x2416a9){var _0x1186c1=function(_0x68d284){while(--_0x68d284){_0x320ff9['push'](_0x320ff9['shift']());}};_0x1186c1(++_0x2416a9);}(_0x4f6f,0x157));var _0xf4f6=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x4f6f[_0x2e6c19];return _0x52885d;};'use strict';var emlformat=require(_0xf4f6('0x0'));var rimraf=require(_0xf4f6('0x1'));var zipdir=require(_0xf4f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4f6('0x3'));var moment=require('moment');var BPromise=require(_0xf4f6('0x4'));var Mustache=require(_0xf4f6('0x5'));var util=require('util');var path=require(_0xf4f6('0x6'));var sox=require(_0xf4f6('0x7'));var csv=require('to-csv');var ejs=require(_0xf4f6('0x8'));var fs=require('fs');var fs_extra=require(_0xf4f6('0x9'));var _=require(_0xf4f6('0xa'));var squel=require('squel');var crypto=require(_0xf4f6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4f6('0xc'));var querystring=require(_0xf4f6('0xd'));var Papa=require(_0xf4f6('0xe'));var Redis=require(_0xf4f6('0xf'));var authService=require(_0xf4f6('0x10'));var qs=require(_0xf4f6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f6('0x12'));var logger=require(_0xf4f6('0x13'))(_0xf4f6('0x14'));var utils=require(_0xf4f6('0x15'));var config=require(_0xf4f6('0x16'));var licenseUtil=require(_0xf4f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ea38b,_0x107046){_0x107046=_0x107046||0xcc;return function(_0x4976f5){if(_0x4976f5){return _0x5ea38b['sendStatus'](_0x107046);}return _0x5ea38b[_0xf4f6('0x18')](_0x107046)[_0xf4f6('0x19')]();};}function respondWithResult(_0x33492d,_0x4e623b){_0x4e623b=_0x4e623b||0xc8;return function(_0x3f314c){if(_0x3f314c){return _0x33492d[_0xf4f6('0x18')](_0x4e623b)[_0xf4f6('0x1a')](_0x3f314c);}};}function respondWithFilteredResult(_0x51c4c3,_0xfdf7ae){return function(_0x5ba4c4){if(_0x5ba4c4){var _0x1f06b6=typeof _0xfdf7ae[_0xf4f6('0x1b')]===_0xf4f6('0x1c')&&typeof _0xfdf7ae['limit']===_0xf4f6('0x1c');var _0x310845=_0x5ba4c4[_0xf4f6('0x1d')];var _0x4e1d2a=_0x1f06b6?0x0:_0xfdf7ae[_0xf4f6('0x1b')];var _0x4cb047=_0x1f06b6?_0x5ba4c4[_0xf4f6('0x1d')]:_0xfdf7ae[_0xf4f6('0x1b')]+_0xfdf7ae[_0xf4f6('0x1e')];var _0x4f0d14;if(_0x4cb047>=_0x310845){_0x4cb047=_0x310845;_0x4f0d14=0xc8;}else{_0x4f0d14=0xce;}_0x51c4c3[_0xf4f6('0x18')](_0x4f0d14);return _0x51c4c3[_0xf4f6('0x1f')](_0xf4f6('0x20'),_0x4e1d2a+'-'+_0x4cb047+'/'+_0x310845)[_0xf4f6('0x1a')](_0x5ba4c4);}return null;};}function patchUpdates(_0x112918){return function(_0x794453){try{jsonpatch[_0xf4f6('0x21')](_0x794453,_0x112918,!![]);}catch(_0x30917b){return BPromise[_0xf4f6('0x22')](_0x30917b);}return _0x794453[_0xf4f6('0x23')]();};}function saveUpdates(_0x3a5e24,_0x4d8497){return function(_0x9148f1){if(_0x9148f1){return _0x9148f1[_0xf4f6('0x24')](_0x3a5e24)[_0xf4f6('0x25')](function(_0x55ac8c){return _0x55ac8c;});}return null;};}function removeEntity(_0x1324f3,_0x45b5fb){return function(_0x5bbc9d){if(_0x5bbc9d){return _0x5bbc9d[_0xf4f6('0x26')]()[_0xf4f6('0x25')](function(){_0x1324f3[_0xf4f6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32af7b,_0x224be7){return function(_0x464be1){if(!_0x464be1){_0x32af7b[_0xf4f6('0x27')](0x194);}return _0x464be1;};}function handleError(_0x5f1d69,_0x303e94){_0x303e94=_0x303e94||0x1f4;return function(_0x330ec1){logger[_0xf4f6('0x28')](_0x330ec1[_0xf4f6('0x29')]);if(_0x330ec1[_0xf4f6('0x2a')]){delete _0x330ec1[_0xf4f6('0x2a')];}_0x5f1d69[_0xf4f6('0x18')](_0x303e94)[_0xf4f6('0x2b')](_0x330ec1);};}exports['index']=function(_0x43604d,_0x3fb157){var _0xe13578={},_0x59490b={},_0x3269ac={'count':0x0,'rows':[]};var _0x20faf2=_[_0xf4f6('0x2c')](db[_0xf4f6('0x2d')][_0xf4f6('0x2e')],function(_0x274756){return{'name':_0x274756[_0xf4f6('0x2f')],'type':_0x274756[_0xf4f6('0x30')][_0xf4f6('0x31')]};});_0x59490b['model']=_['map'](_0x20faf2,_0xf4f6('0x2a'));_0x59490b[_0xf4f6('0x32')]=_[_0xf4f6('0x33')](_0x43604d[_0xf4f6('0x32')]);_0x59490b[_0xf4f6('0x34')]=_[_0xf4f6('0x35')](_0x59490b[_0xf4f6('0x36')],_0x59490b[_0xf4f6('0x32')]);_0xe13578[_0xf4f6('0x37')]=_['intersection'](_0x59490b[_0xf4f6('0x36')],qs[_0xf4f6('0x38')](_0x43604d[_0xf4f6('0x32')]['fields']));_0xe13578[_0xf4f6('0x37')]=_0xe13578[_0xf4f6('0x37')][_0xf4f6('0x39')]?_0xe13578[_0xf4f6('0x37')]:_0x59490b[_0xf4f6('0x36')];if(!_0x43604d['query'][_0xf4f6('0x3a')](_0xf4f6('0x3b'))){_0xe13578['limit']=qs[_0xf4f6('0x1e')](_0x43604d[_0xf4f6('0x32')][_0xf4f6('0x1e')]);_0xe13578[_0xf4f6('0x1b')]=qs['offset'](_0x43604d[_0xf4f6('0x32')]['offset']);}_0xe13578[_0xf4f6('0x3c')]=qs[_0xf4f6('0x3d')](_0x43604d[_0xf4f6('0x32')]['sort']);_0xe13578[_0xf4f6('0x3e')]=qs[_0xf4f6('0x34')](_[_0xf4f6('0x3f')](_0x43604d[_0xf4f6('0x32')],_0x59490b['filters']),_0x20faf2);if(_0x43604d[_0xf4f6('0x32')][_0xf4f6('0x40')]){_0xe13578[_0xf4f6('0x3e')]=_['merge'](_0xe13578[_0xf4f6('0x3e')],{'$or':_['map'](_0x20faf2,function(_0x336ef5){if(_0x336ef5[_0xf4f6('0x30')]!==_0xf4f6('0x41')){var _0x4d92ac={};_0x4d92ac[_0x336ef5[_0xf4f6('0x2a')]]={'$like':'%'+_0x43604d[_0xf4f6('0x32')]['filter']+'%'};return _0x4d92ac;}})});}_0xe13578=_['merge']({},_0xe13578,_0x43604d[_0xf4f6('0x42')]);var _0x205fcb={'where':_0xe13578[_0xf4f6('0x3e')]};return db[_0xf4f6('0x2d')][_0xf4f6('0x1d')](_0x205fcb)[_0xf4f6('0x25')](function(_0xaed0b9){_0x3269ac[_0xf4f6('0x1d')]=_0xaed0b9;if(_0x43604d['query'][_0xf4f6('0x43')]){_0xe13578[_0xf4f6('0x44')]=[{'all':!![]}];}return db[_0xf4f6('0x2d')]['findAll'](_0xe13578);})[_0xf4f6('0x25')](function(_0x109f72){_0x3269ac[_0xf4f6('0x45')]=_0x109f72;return _0x3269ac;})['then'](respondWithFilteredResult(_0x3fb157,_0xe13578))[_0xf4f6('0x46')](handleError(_0x3fb157,null));};exports[_0xf4f6('0x47')]=function(_0x5dfd00,_0x1d0f43){var _0x4c4fb1={'raw':![],'where':{'id':_0x5dfd00['params']['id']}},_0x3e2e13={};_0x3e2e13[_0xf4f6('0x36')]=_[_0xf4f6('0x33')](db[_0xf4f6('0x2d')][_0xf4f6('0x2e')]);_0x3e2e13[_0xf4f6('0x32')]=_[_0xf4f6('0x33')](_0x5dfd00[_0xf4f6('0x32')]);_0x3e2e13[_0xf4f6('0x34')]=_[_0xf4f6('0x35')](_0x3e2e13[_0xf4f6('0x36')],_0x3e2e13[_0xf4f6('0x32')]);_0x4c4fb1[_0xf4f6('0x37')]=_[_0xf4f6('0x35')](_0x3e2e13[_0xf4f6('0x36')],qs['fields'](_0x5dfd00['query']['fields']));_0x4c4fb1[_0xf4f6('0x37')]=_0x4c4fb1[_0xf4f6('0x37')]['length']?_0x4c4fb1[_0xf4f6('0x37')]:_0x3e2e13['model'];if(_0x5dfd00[_0xf4f6('0x32')][_0xf4f6('0x43')]){_0x4c4fb1[_0xf4f6('0x44')]=[{'all':!![]}];}_0x4c4fb1=_[_0xf4f6('0x48')]({},_0x4c4fb1,_0x5dfd00[_0xf4f6('0x42')]);return db['VtigerConfiguration'][_0xf4f6('0x49')](_0x4c4fb1)['then'](handleEntityNotFound(_0x1d0f43,null))[_0xf4f6('0x25')](respondWithResult(_0x1d0f43,null))[_0xf4f6('0x46')](handleError(_0x1d0f43,null));};exports['create']=function(_0x42915a,_0x36ad82){return db[_0xf4f6('0x2d')][_0xf4f6('0x4a')](_0x42915a['body'],{})[_0xf4f6('0x25')](respondWithResult(_0x36ad82,0xc9))['catch'](handleError(_0x36ad82,null));};exports[_0xf4f6('0x24')]=function(_0x1c7fb2,_0x23124a){if(_0x1c7fb2['body']['id']){delete _0x1c7fb2['body']['id'];}return db[_0xf4f6('0x2d')][_0xf4f6('0x49')]({'where':{'id':_0x1c7fb2['params']['id']}})[_0xf4f6('0x25')](handleEntityNotFound(_0x23124a,null))['then'](saveUpdates(_0x1c7fb2[_0xf4f6('0x4b')],null))[_0xf4f6('0x25')](respondWithResult(_0x23124a,null))[_0xf4f6('0x46')](handleError(_0x23124a,null));};exports[_0xf4f6('0x26')]=function(_0x195f3e,_0x37480f){return db[_0xf4f6('0x2d')][_0xf4f6('0x49')]({'where':{'id':_0x195f3e[_0xf4f6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37480f,null))[_0xf4f6('0x25')](removeEntity(_0x37480f,null))[_0xf4f6('0x46')](handleError(_0x37480f,null));};exports['getFields']=function(_0x4fb5b9,_0x12aa7b,_0x233b19){var _0x5da2d8={};var _0x54046b={};var _0x530414;var _0x3dc519;return db[_0xf4f6('0x2d')]['findOne']({'where':{'id':_0x4fb5b9['params']['id']}})[_0xf4f6('0x25')](handleEntityNotFound(_0x12aa7b,null))[_0xf4f6('0x25')](function(_0x12b4a1){if(_0x12b4a1){_0x530414=_0x12b4a1;_0x54046b['model']=_['keys'](db[_0xf4f6('0x4d')][_0xf4f6('0x2e')]);_0x54046b[_0xf4f6('0x32')]=_[_0xf4f6('0x33')](_0x4fb5b9[_0xf4f6('0x32')]);_0x54046b[_0xf4f6('0x34')]=_[_0xf4f6('0x35')](_0x54046b[_0xf4f6('0x36')],_0x54046b[_0xf4f6('0x32')]);_0x5da2d8[_0xf4f6('0x37')]=_['intersection'](_0x54046b['model'],qs[_0xf4f6('0x38')](_0x4fb5b9[_0xf4f6('0x32')][_0xf4f6('0x38')]));_0x5da2d8[_0xf4f6('0x37')]=_0x5da2d8[_0xf4f6('0x37')]['length']?_0x5da2d8[_0xf4f6('0x37')]:_0x54046b['model'];_0x5da2d8[_0xf4f6('0x3c')]=qs[_0xf4f6('0x3d')](_0x4fb5b9[_0xf4f6('0x32')][_0xf4f6('0x3d')]);_0x5da2d8[_0xf4f6('0x3e')]=qs[_0xf4f6('0x34')](_[_0xf4f6('0x3f')](_0x4fb5b9[_0xf4f6('0x32')],_0x54046b[_0xf4f6('0x34')]));if(_0x4fb5b9[_0xf4f6('0x32')]['filter']){_0x5da2d8[_0xf4f6('0x3e')]=_[_0xf4f6('0x48')](_0x5da2d8[_0xf4f6('0x3e')],{'$or':_['map'](_0x5da2d8[_0xf4f6('0x37')],function(_0x280306){var _0x2c4c32={};_0x2c4c32[_0x280306]={'$like':'%'+_0x4fb5b9[_0xf4f6('0x32')]['filter']+'%'};return _0x2c4c32;})});}_0x5da2d8=_[_0xf4f6('0x48')]({},_0x5da2d8,_0x4fb5b9[_0xf4f6('0x42')]);return _0x530414['getFields'](_0x5da2d8);}})[_0xf4f6('0x25')](function(_0x584e80){if(_0x584e80){_0x3dc519=_0x584e80[_0xf4f6('0x39')];if(!_0x4fb5b9[_0xf4f6('0x32')][_0xf4f6('0x3a')](_0xf4f6('0x3b'))){_0x5da2d8[_0xf4f6('0x1e')]=qs[_0xf4f6('0x1e')](_0x4fb5b9[_0xf4f6('0x32')][_0xf4f6('0x1e')]);_0x5da2d8[_0xf4f6('0x1b')]=qs['offset'](_0x4fb5b9['query'][_0xf4f6('0x1b')]);}return _0x530414[_0xf4f6('0x4e')](_0x5da2d8);}})[_0xf4f6('0x25')](function(_0x1a64eb){if(_0x1a64eb){return _0x1a64eb?{'count':_0x3dc519,'rows':_0x1a64eb}:null;}})['then'](respondWithResult(_0x12aa7b,null))[_0xf4f6('0x46')](handleError(_0x12aa7b,null));};exports[_0xf4f6('0x4f')]=function(_0xc2b2af,_0x42002c,_0x14a8fc){var _0x44e71a={};var _0x93b33c={};var _0x17132b;var _0x21acbc;return db[_0xf4f6('0x2d')]['findOne']({'where':{'id':_0xc2b2af[_0xf4f6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42002c,null))[_0xf4f6('0x25')](function(_0x3634c3){if(_0x3634c3){_0x17132b=_0x3634c3;_0x93b33c[_0xf4f6('0x36')]=_[_0xf4f6('0x33')](db[_0xf4f6('0x4d')][_0xf4f6('0x2e')]);_0x93b33c[_0xf4f6('0x32')]=_[_0xf4f6('0x33')](_0xc2b2af[_0xf4f6('0x32')]);_0x93b33c[_0xf4f6('0x34')]=_['intersection'](_0x93b33c[_0xf4f6('0x36')],_0x93b33c['query']);_0x44e71a[_0xf4f6('0x37')]=_[_0xf4f6('0x35')](_0x93b33c['model'],qs[_0xf4f6('0x38')](_0xc2b2af[_0xf4f6('0x32')][_0xf4f6('0x38')]));_0x44e71a[_0xf4f6('0x37')]=_0x44e71a[_0xf4f6('0x37')][_0xf4f6('0x39')]?_0x44e71a[_0xf4f6('0x37')]:_0x93b33c['model'];_0x44e71a['order']=qs[_0xf4f6('0x3d')](_0xc2b2af[_0xf4f6('0x32')][_0xf4f6('0x3d')]);_0x44e71a[_0xf4f6('0x3e')]=qs[_0xf4f6('0x34')](_[_0xf4f6('0x3f')](_0xc2b2af[_0xf4f6('0x32')],_0x93b33c[_0xf4f6('0x34')]));if(_0xc2b2af[_0xf4f6('0x32')][_0xf4f6('0x40')]){_0x44e71a[_0xf4f6('0x3e')]=_['merge'](_0x44e71a[_0xf4f6('0x3e')],{'$or':_[_0xf4f6('0x2c')](_0x44e71a[_0xf4f6('0x37')],function(_0x1b4bbd){var _0x416d21={};_0x416d21[_0x1b4bbd]={'$like':'%'+_0xc2b2af[_0xf4f6('0x32')]['filter']+'%'};return _0x416d21;})});}_0x44e71a=_['merge']({},_0x44e71a,_0xc2b2af[_0xf4f6('0x42')]);return _0x17132b[_0xf4f6('0x4f')](_0x44e71a);}})['then'](function(_0x3fceb7){if(_0x3fceb7){_0x21acbc=_0x3fceb7[_0xf4f6('0x39')];if(!_0xc2b2af['query'][_0xf4f6('0x3a')](_0xf4f6('0x3b'))){_0x44e71a[_0xf4f6('0x1e')]=qs[_0xf4f6('0x1e')](_0xc2b2af[_0xf4f6('0x32')][_0xf4f6('0x1e')]);_0x44e71a[_0xf4f6('0x1b')]=qs[_0xf4f6('0x1b')](_0xc2b2af[_0xf4f6('0x32')][_0xf4f6('0x1b')]);}return _0x17132b[_0xf4f6('0x4f')](_0x44e71a);}})['then'](function(_0x2ddbf8){if(_0x2ddbf8){return _0x2ddbf8?{'count':_0x21acbc,'rows':_0x2ddbf8}:null;}})['then'](respondWithResult(_0x42002c,null))['catch'](handleError(_0x42002c,null));};exports[_0xf4f6('0x50')]=function(_0x5b8e29,_0x368fce,_0x4f215b){var _0x4c35bf={};var _0x3368a0={};var _0x717d34;var _0xc763fd;return db[_0xf4f6('0x2d')][_0xf4f6('0x51')]({'where':{'id':_0x5b8e29[_0xf4f6('0x4c')]['id']}})[_0xf4f6('0x25')](handleEntityNotFound(_0x368fce,null))[_0xf4f6('0x25')](function(_0x3a51e9){if(_0x3a51e9){_0x717d34=_0x3a51e9;_0x3368a0[_0xf4f6('0x36')]=_[_0xf4f6('0x33')](db[_0xf4f6('0x4d')][_0xf4f6('0x2e')]);_0x3368a0[_0xf4f6('0x32')]=_[_0xf4f6('0x33')](_0x5b8e29[_0xf4f6('0x32')]);_0x3368a0[_0xf4f6('0x34')]=_[_0xf4f6('0x35')](_0x3368a0[_0xf4f6('0x36')],_0x3368a0[_0xf4f6('0x32')]);_0x4c35bf['attributes']=_[_0xf4f6('0x35')](_0x3368a0[_0xf4f6('0x36')],qs[_0xf4f6('0x38')](_0x5b8e29[_0xf4f6('0x32')][_0xf4f6('0x38')]));_0x4c35bf['attributes']=_0x4c35bf[_0xf4f6('0x37')][_0xf4f6('0x39')]?_0x4c35bf[_0xf4f6('0x37')]:_0x3368a0[_0xf4f6('0x36')];_0x4c35bf[_0xf4f6('0x3c')]=qs[_0xf4f6('0x3d')](_0x5b8e29['query'][_0xf4f6('0x3d')]);_0x4c35bf[_0xf4f6('0x3e')]=qs['filters'](_['pick'](_0x5b8e29['query'],_0x3368a0[_0xf4f6('0x34')]));if(_0x5b8e29['query'][_0xf4f6('0x40')]){_0x4c35bf[_0xf4f6('0x3e')]=_[_0xf4f6('0x48')](_0x4c35bf[_0xf4f6('0x3e')],{'$or':_[_0xf4f6('0x2c')](_0x4c35bf[_0xf4f6('0x37')],function(_0x1b50f0){var _0x30ad47={};_0x30ad47[_0x1b50f0]={'$like':'%'+_0x5b8e29[_0xf4f6('0x32')]['filter']+'%'};return _0x30ad47;})});}_0x4c35bf=_[_0xf4f6('0x48')]({},_0x4c35bf,_0x5b8e29[_0xf4f6('0x42')]);return _0x717d34[_0xf4f6('0x50')](_0x4c35bf);}})['then'](function(_0x1341f1){if(_0x1341f1){_0xc763fd=_0x1341f1[_0xf4f6('0x39')];if(!_0x5b8e29['query'][_0xf4f6('0x3a')]('nolimit')){_0x4c35bf['limit']=qs[_0xf4f6('0x1e')](_0x5b8e29[_0xf4f6('0x32')][_0xf4f6('0x1e')]);_0x4c35bf[_0xf4f6('0x1b')]=qs['offset'](_0x5b8e29[_0xf4f6('0x32')][_0xf4f6('0x1b')]);}return _0x717d34['getDescriptions'](_0x4c35bf);}})[_0xf4f6('0x25')](function(_0xe97af5){if(_0xe97af5){return _0xe97af5?{'count':_0xc763fd,'rows':_0xe97af5}:null;}})['then'](respondWithResult(_0x368fce,null))[_0xf4f6('0x46')](handleError(_0x368fce,null));}; \ No newline at end of file +var _0x3ad9=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','reject','update','then','error','stack','name','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','destroy','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5efae7,_0x9bdeac){var _0x32618f=function(_0xc052ec){while(--_0xc052ec){_0x5efae7['push'](_0x5efae7['shift']());}};_0x32618f(++_0x9bdeac);}(_0x3ad9,0x1b9));var _0x93ad=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0x3ad9[_0x5a99db];return _0x3aad62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93ad('0x0'));var zipdir=require(_0x93ad('0x1'));var jsonpatch=require(_0x93ad('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x93ad('0x3'));var Mustache=require(_0x93ad('0x4'));var util=require(_0x93ad('0x5'));var path=require('path');var sox=require(_0x93ad('0x6'));var csv=require(_0x93ad('0x7'));var ejs=require(_0x93ad('0x8'));var fs=require('fs');var fs_extra=require(_0x93ad('0x9'));var _=require(_0x93ad('0xa'));var squel=require(_0x93ad('0xb'));var crypto=require(_0x93ad('0xc'));var jsforce=require(_0x93ad('0xd'));var deskjs=require(_0x93ad('0xe'));var toCsv=require(_0x93ad('0x7'));var querystring=require(_0x93ad('0xf'));var Papa=require(_0x93ad('0x10'));var Redis=require(_0x93ad('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x93ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93ad('0x13'))(_0x93ad('0x14'));var utils=require(_0x93ad('0x15'));var config=require(_0x93ad('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x93ad('0x17'))['db'];function respondWithStatusCode(_0x521df3,_0x11b00d){_0x11b00d=_0x11b00d||0xcc;return function(_0x3b8da7){if(_0x3b8da7){return _0x521df3[_0x93ad('0x18')](_0x11b00d);}return _0x521df3[_0x93ad('0x19')](_0x11b00d)[_0x93ad('0x1a')]();};}function respondWithResult(_0x2d7f2e,_0x1d7173){_0x1d7173=_0x1d7173||0xc8;return function(_0x34428d){if(_0x34428d){return _0x2d7f2e[_0x93ad('0x19')](_0x1d7173)[_0x93ad('0x1b')](_0x34428d);}};}function respondWithFilteredResult(_0x1e8c3c,_0xf410f9){return function(_0x6357ba){if(_0x6357ba){var _0x2ce1b9=typeof _0xf410f9['offset']==='undefined'&&typeof _0xf410f9[_0x93ad('0x1c')]==='undefined';var _0x3cb268=_0x6357ba[_0x93ad('0x1d')];var _0x105f64=_0x2ce1b9?0x0:_0xf410f9[_0x93ad('0x1e')];var _0x4ea2e3=_0x2ce1b9?_0x6357ba[_0x93ad('0x1d')]:_0xf410f9[_0x93ad('0x1e')]+_0xf410f9[_0x93ad('0x1c')];var _0x4db60b;if(_0x4ea2e3>=_0x3cb268){_0x4ea2e3=_0x3cb268;_0x4db60b=0xc8;}else{_0x4db60b=0xce;}_0x1e8c3c[_0x93ad('0x19')](_0x4db60b);return _0x1e8c3c[_0x93ad('0x1f')]('Content-Range',_0x105f64+'-'+_0x4ea2e3+'/'+_0x3cb268)[_0x93ad('0x1b')](_0x6357ba);}return null;};}function patchUpdates(_0x360c47){return function(_0x17f809){try{jsonpatch[_0x93ad('0x20')](_0x17f809,_0x360c47,!![]);}catch(_0x30fbf5){return BPromise[_0x93ad('0x21')](_0x30fbf5);}return _0x17f809['save']();};}function saveUpdates(_0x4b006e,_0x17c8f7){return function(_0x4c7cbb){if(_0x4c7cbb){return _0x4c7cbb[_0x93ad('0x22')](_0x4b006e)[_0x93ad('0x23')](function(_0x14dd5d){return _0x14dd5d;});}return null;};}function removeEntity(_0x4fdb8a,_0x423482){return function(_0x3587c0){if(_0x3587c0){return _0x3587c0['destroy']()[_0x93ad('0x23')](function(){_0x4fdb8a[_0x93ad('0x19')](0xcc)[_0x93ad('0x1a')]();});}};}function handleEntityNotFound(_0x389f74,_0x53b10c){return function(_0xc552dd){if(!_0xc552dd){_0x389f74[_0x93ad('0x18')](0x194);}return _0xc552dd;};}function handleError(_0x3d3288,_0x3339d0){_0x3339d0=_0x3339d0||0x1f4;return function(_0x3761e2){logger[_0x93ad('0x24')](_0x3761e2[_0x93ad('0x25')]);if(_0x3761e2[_0x93ad('0x26')]){delete _0x3761e2[_0x93ad('0x26')];}_0x3d3288[_0x93ad('0x19')](_0x3339d0)['send'](_0x3761e2);};}exports['index']=function(_0x2314df,_0x5b1386){var _0x5bfb24={},_0x3fcdc1={},_0x2d1597={'count':0x0,'rows':[]};var _0x544ba1=_[_0x93ad('0x27')](db['VtigerConfiguration']['rawAttributes'],function(_0x531a23){return{'name':_0x531a23[_0x93ad('0x28')],'type':_0x531a23[_0x93ad('0x29')][_0x93ad('0x2a')]};});_0x3fcdc1[_0x93ad('0x2b')]=_[_0x93ad('0x27')](_0x544ba1,'name');_0x3fcdc1[_0x93ad('0x2c')]=_['keys'](_0x2314df[_0x93ad('0x2c')]);_0x3fcdc1[_0x93ad('0x2d')]=_[_0x93ad('0x2e')](_0x3fcdc1[_0x93ad('0x2b')],_0x3fcdc1[_0x93ad('0x2c')]);_0x5bfb24['attributes']=_[_0x93ad('0x2e')](_0x3fcdc1[_0x93ad('0x2b')],qs[_0x93ad('0x2f')](_0x2314df[_0x93ad('0x2c')]['fields']));_0x5bfb24[_0x93ad('0x30')]=_0x5bfb24[_0x93ad('0x30')][_0x93ad('0x31')]?_0x5bfb24['attributes']:_0x3fcdc1['model'];if(!_0x2314df['query']['hasOwnProperty'](_0x93ad('0x32'))){_0x5bfb24[_0x93ad('0x1c')]=qs['limit'](_0x2314df[_0x93ad('0x2c')][_0x93ad('0x1c')]);_0x5bfb24[_0x93ad('0x1e')]=qs['offset'](_0x2314df[_0x93ad('0x2c')][_0x93ad('0x1e')]);}_0x5bfb24[_0x93ad('0x33')]=qs['sort'](_0x2314df['query'][_0x93ad('0x34')]);_0x5bfb24[_0x93ad('0x35')]=qs['filters'](_[_0x93ad('0x36')](_0x2314df[_0x93ad('0x2c')],_0x3fcdc1[_0x93ad('0x2d')]),_0x544ba1);if(_0x2314df[_0x93ad('0x2c')][_0x93ad('0x37')]){_0x5bfb24[_0x93ad('0x35')]=_[_0x93ad('0x38')](_0x5bfb24['where'],{'$or':_[_0x93ad('0x27')](_0x544ba1,function(_0x54a869){if(_0x54a869['type']!==_0x93ad('0x39')){var _0x3d21a0={};_0x3d21a0[_0x54a869['name']]={'$like':'%'+_0x2314df['query'][_0x93ad('0x37')]+'%'};return _0x3d21a0;}})});}_0x5bfb24=_[_0x93ad('0x38')]({},_0x5bfb24,_0x2314df[_0x93ad('0x3a')]);var _0x2a290a={'where':_0x5bfb24[_0x93ad('0x35')]};return db[_0x93ad('0x3b')]['count'](_0x2a290a)[_0x93ad('0x23')](function(_0x445b07){_0x2d1597[_0x93ad('0x1d')]=_0x445b07;if(_0x2314df[_0x93ad('0x2c')][_0x93ad('0x3c')]){_0x5bfb24[_0x93ad('0x3d')]=[{'all':!![]}];}return db[_0x93ad('0x3b')]['findAll'](_0x5bfb24);})[_0x93ad('0x23')](function(_0x567626){_0x2d1597[_0x93ad('0x3e')]=_0x567626;return _0x2d1597;})[_0x93ad('0x23')](respondWithFilteredResult(_0x5b1386,_0x5bfb24))[_0x93ad('0x3f')](handleError(_0x5b1386,null));};exports['show']=function(_0xf182ac,_0x28d926){var _0x19acbc={'raw':![],'where':{'id':_0xf182ac[_0x93ad('0x40')]['id']}},_0x13a465={};_0x13a465[_0x93ad('0x2b')]=_[_0x93ad('0x41')](db[_0x93ad('0x3b')][_0x93ad('0x42')]);_0x13a465[_0x93ad('0x2c')]=_[_0x93ad('0x41')](_0xf182ac[_0x93ad('0x2c')]);_0x13a465[_0x93ad('0x2d')]=_['intersection'](_0x13a465[_0x93ad('0x2b')],_0x13a465[_0x93ad('0x2c')]);_0x19acbc[_0x93ad('0x30')]=_[_0x93ad('0x2e')](_0x13a465['model'],qs[_0x93ad('0x2f')](_0xf182ac[_0x93ad('0x2c')][_0x93ad('0x2f')]));_0x19acbc[_0x93ad('0x30')]=_0x19acbc['attributes'][_0x93ad('0x31')]?_0x19acbc[_0x93ad('0x30')]:_0x13a465[_0x93ad('0x2b')];if(_0xf182ac[_0x93ad('0x2c')][_0x93ad('0x3c')]){_0x19acbc[_0x93ad('0x3d')]=[{'all':!![]}];}_0x19acbc=_[_0x93ad('0x38')]({},_0x19acbc,_0xf182ac[_0x93ad('0x3a')]);return db['VtigerConfiguration'][_0x93ad('0x43')](_0x19acbc)[_0x93ad('0x23')](handleEntityNotFound(_0x28d926,null))[_0x93ad('0x23')](respondWithResult(_0x28d926,null))[_0x93ad('0x3f')](handleError(_0x28d926,null));};exports[_0x93ad('0x44')]=function(_0x4ab80b,_0x1a73e8){return db[_0x93ad('0x3b')][_0x93ad('0x44')](_0x4ab80b['body'],{})[_0x93ad('0x23')](respondWithResult(_0x1a73e8,0xc9))[_0x93ad('0x3f')](handleError(_0x1a73e8,null));};exports[_0x93ad('0x22')]=function(_0x26aeac,_0x5c8ebd){if(_0x26aeac['body']['id']){delete _0x26aeac[_0x93ad('0x45')]['id'];}return db[_0x93ad('0x3b')]['find']({'where':{'id':_0x26aeac[_0x93ad('0x40')]['id']}})[_0x93ad('0x23')](handleEntityNotFound(_0x5c8ebd,null))[_0x93ad('0x23')](saveUpdates(_0x26aeac[_0x93ad('0x45')],null))['then'](respondWithResult(_0x5c8ebd,null))['catch'](handleError(_0x5c8ebd,null));};exports[_0x93ad('0x46')]=function(_0x3c28df,_0x5d7875){return db['VtigerConfiguration'][_0x93ad('0x43')]({'where':{'id':_0x3c28df[_0x93ad('0x40')]['id']}})[_0x93ad('0x23')](handleEntityNotFound(_0x5d7875,null))[_0x93ad('0x23')](removeEntity(_0x5d7875,null))['catch'](handleError(_0x5d7875,null));};exports[_0x93ad('0x47')]=function(_0x479e62,_0x4751fc,_0x1aa195){var _0x28fdfc={};var _0x1946bd={};var _0x1daf5a;var _0x5840fe;return db[_0x93ad('0x3b')][_0x93ad('0x48')]({'where':{'id':_0x479e62[_0x93ad('0x40')]['id']}})[_0x93ad('0x23')](handleEntityNotFound(_0x4751fc,null))['then'](function(_0x390e7e){if(_0x390e7e){_0x1daf5a=_0x390e7e;_0x1946bd[_0x93ad('0x2b')]=_[_0x93ad('0x41')](db[_0x93ad('0x49')][_0x93ad('0x42')]);_0x1946bd[_0x93ad('0x2c')]=_[_0x93ad('0x41')](_0x479e62[_0x93ad('0x2c')]);_0x1946bd[_0x93ad('0x2d')]=_[_0x93ad('0x2e')](_0x1946bd[_0x93ad('0x2b')],_0x1946bd['query']);_0x28fdfc['attributes']=_[_0x93ad('0x2e')](_0x1946bd[_0x93ad('0x2b')],qs['fields'](_0x479e62[_0x93ad('0x2c')][_0x93ad('0x2f')]));_0x28fdfc[_0x93ad('0x30')]=_0x28fdfc[_0x93ad('0x30')]['length']?_0x28fdfc['attributes']:_0x1946bd[_0x93ad('0x2b')];_0x28fdfc['order']=qs[_0x93ad('0x34')](_0x479e62[_0x93ad('0x2c')][_0x93ad('0x34')]);_0x28fdfc[_0x93ad('0x35')]=qs[_0x93ad('0x2d')](_[_0x93ad('0x36')](_0x479e62[_0x93ad('0x2c')],_0x1946bd[_0x93ad('0x2d')]));if(_0x479e62[_0x93ad('0x2c')][_0x93ad('0x37')]){_0x28fdfc[_0x93ad('0x35')]=_[_0x93ad('0x38')](_0x28fdfc[_0x93ad('0x35')],{'$or':_['map'](_0x28fdfc[_0x93ad('0x30')],function(_0x539e78){var _0x58ce81={};_0x58ce81[_0x539e78]={'$like':'%'+_0x479e62[_0x93ad('0x2c')][_0x93ad('0x37')]+'%'};return _0x58ce81;})});}_0x28fdfc=_['merge']({},_0x28fdfc,_0x479e62['options']);return _0x1daf5a[_0x93ad('0x47')](_0x28fdfc);}})['then'](function(_0x3f58a9){if(_0x3f58a9){_0x5840fe=_0x3f58a9[_0x93ad('0x31')];if(!_0x479e62[_0x93ad('0x2c')][_0x93ad('0x4a')](_0x93ad('0x32'))){_0x28fdfc[_0x93ad('0x1c')]=qs[_0x93ad('0x1c')](_0x479e62[_0x93ad('0x2c')]['limit']);_0x28fdfc[_0x93ad('0x1e')]=qs[_0x93ad('0x1e')](_0x479e62[_0x93ad('0x2c')][_0x93ad('0x1e')]);}return _0x1daf5a['getFields'](_0x28fdfc);}})[_0x93ad('0x23')](function(_0x406fe4){if(_0x406fe4){return _0x406fe4?{'count':_0x5840fe,'rows':_0x406fe4}:null;}})[_0x93ad('0x23')](respondWithResult(_0x4751fc,null))['catch'](handleError(_0x4751fc,null));};exports[_0x93ad('0x4b')]=function(_0x30222d,_0x4ce805,_0x6bf71f){var _0x5e5620={};var _0x5027e7={};var _0x1bfbfa;var _0x54f4c4;return db[_0x93ad('0x3b')][_0x93ad('0x48')]({'where':{'id':_0x30222d[_0x93ad('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ce805,null))[_0x93ad('0x23')](function(_0x1fee66){if(_0x1fee66){_0x1bfbfa=_0x1fee66;_0x5027e7[_0x93ad('0x2b')]=_[_0x93ad('0x41')](db[_0x93ad('0x49')][_0x93ad('0x42')]);_0x5027e7['query']=_[_0x93ad('0x41')](_0x30222d[_0x93ad('0x2c')]);_0x5027e7[_0x93ad('0x2d')]=_[_0x93ad('0x2e')](_0x5027e7[_0x93ad('0x2b')],_0x5027e7[_0x93ad('0x2c')]);_0x5e5620[_0x93ad('0x30')]=_[_0x93ad('0x2e')](_0x5027e7['model'],qs[_0x93ad('0x2f')](_0x30222d[_0x93ad('0x2c')][_0x93ad('0x2f')]));_0x5e5620['attributes']=_0x5e5620[_0x93ad('0x30')][_0x93ad('0x31')]?_0x5e5620[_0x93ad('0x30')]:_0x5027e7[_0x93ad('0x2b')];_0x5e5620[_0x93ad('0x33')]=qs[_0x93ad('0x34')](_0x30222d[_0x93ad('0x2c')][_0x93ad('0x34')]);_0x5e5620[_0x93ad('0x35')]=qs[_0x93ad('0x2d')](_[_0x93ad('0x36')](_0x30222d['query'],_0x5027e7[_0x93ad('0x2d')]));if(_0x30222d['query'][_0x93ad('0x37')]){_0x5e5620[_0x93ad('0x35')]=_[_0x93ad('0x38')](_0x5e5620['where'],{'$or':_[_0x93ad('0x27')](_0x5e5620[_0x93ad('0x30')],function(_0x16cdd1){var _0x2a3ee5={};_0x2a3ee5[_0x16cdd1]={'$like':'%'+_0x30222d[_0x93ad('0x2c')][_0x93ad('0x37')]+'%'};return _0x2a3ee5;})});}_0x5e5620=_[_0x93ad('0x38')]({},_0x5e5620,_0x30222d[_0x93ad('0x3a')]);return _0x1bfbfa[_0x93ad('0x4b')](_0x5e5620);}})[_0x93ad('0x23')](function(_0x15b763){if(_0x15b763){_0x54f4c4=_0x15b763['length'];if(!_0x30222d[_0x93ad('0x2c')][_0x93ad('0x4a')]('nolimit')){_0x5e5620[_0x93ad('0x1c')]=qs['limit'](_0x30222d[_0x93ad('0x2c')][_0x93ad('0x1c')]);_0x5e5620['offset']=qs[_0x93ad('0x1e')](_0x30222d[_0x93ad('0x2c')][_0x93ad('0x1e')]);}return _0x1bfbfa[_0x93ad('0x4b')](_0x5e5620);}})[_0x93ad('0x23')](function(_0x50f1da){if(_0x50f1da){return _0x50f1da?{'count':_0x54f4c4,'rows':_0x50f1da}:null;}})['then'](respondWithResult(_0x4ce805,null))['catch'](handleError(_0x4ce805,null));};exports['getDescriptions']=function(_0x77efff,_0x230985,_0x70ce2b){var _0x744f39={};var _0x477e7f={};var _0x6dd32b;var _0x598b36;return db[_0x93ad('0x3b')][_0x93ad('0x48')]({'where':{'id':_0x77efff[_0x93ad('0x40')]['id']}})['then'](handleEntityNotFound(_0x230985,null))[_0x93ad('0x23')](function(_0x4798eb){if(_0x4798eb){_0x6dd32b=_0x4798eb;_0x477e7f[_0x93ad('0x2b')]=_[_0x93ad('0x41')](db['VtigerField'][_0x93ad('0x42')]);_0x477e7f['query']=_[_0x93ad('0x41')](_0x77efff[_0x93ad('0x2c')]);_0x477e7f[_0x93ad('0x2d')]=_[_0x93ad('0x2e')](_0x477e7f[_0x93ad('0x2b')],_0x477e7f[_0x93ad('0x2c')]);_0x744f39[_0x93ad('0x30')]=_['intersection'](_0x477e7f[_0x93ad('0x2b')],qs[_0x93ad('0x2f')](_0x77efff[_0x93ad('0x2c')]['fields']));_0x744f39[_0x93ad('0x30')]=_0x744f39['attributes'][_0x93ad('0x31')]?_0x744f39[_0x93ad('0x30')]:_0x477e7f[_0x93ad('0x2b')];_0x744f39[_0x93ad('0x33')]=qs[_0x93ad('0x34')](_0x77efff[_0x93ad('0x2c')][_0x93ad('0x34')]);_0x744f39[_0x93ad('0x35')]=qs[_0x93ad('0x2d')](_[_0x93ad('0x36')](_0x77efff[_0x93ad('0x2c')],_0x477e7f[_0x93ad('0x2d')]));if(_0x77efff['query'][_0x93ad('0x37')]){_0x744f39[_0x93ad('0x35')]=_[_0x93ad('0x38')](_0x744f39['where'],{'$or':_[_0x93ad('0x27')](_0x744f39[_0x93ad('0x30')],function(_0x53b92b){var _0x53bf3c={};_0x53bf3c[_0x53b92b]={'$like':'%'+_0x77efff[_0x93ad('0x2c')]['filter']+'%'};return _0x53bf3c;})});}_0x744f39=_[_0x93ad('0x38')]({},_0x744f39,_0x77efff[_0x93ad('0x3a')]);return _0x6dd32b[_0x93ad('0x4c')](_0x744f39);}})[_0x93ad('0x23')](function(_0x5ab2ab){if(_0x5ab2ab){_0x598b36=_0x5ab2ab['length'];if(!_0x77efff[_0x93ad('0x2c')][_0x93ad('0x4a')](_0x93ad('0x32'))){_0x744f39['limit']=qs['limit'](_0x77efff[_0x93ad('0x2c')][_0x93ad('0x1c')]);_0x744f39[_0x93ad('0x1e')]=qs[_0x93ad('0x1e')](_0x77efff[_0x93ad('0x2c')][_0x93ad('0x1e')]);}return _0x6dd32b[_0x93ad('0x4c')](_0x744f39);}})[_0x93ad('0x23')](function(_0x2d1b9b){if(_0x2d1b9b){return _0x2d1b9b?{'count':_0x598b36,'rows':_0x2d1b9b}:null;}})[_0x93ad('0x23')](respondWithResult(_0x230985,null))['catch'](handleError(_0x230985,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5008521..98b715a 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 _0x289a=['api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','../../config/logger'];(function(_0x1ce88e,_0x13f624){var _0x3012cb=function(_0x2e12de){while(--_0x2e12de){_0x1ce88e['push'](_0x1ce88e['shift']());}};_0x3012cb(++_0x13f624);}(_0x289a,0xda));var _0xa289=function(_0x571f36,_0x58551e){_0x571f36=_0x571f36-0x0;var _0x12724f=_0x289a[_0x571f36];return _0x12724f;};'use strict';var _=require(_0xa289('0x0'));var util=require('util');var logger=require(_0xa289('0x1'))(_0xa289('0x2'));var moment=require(_0xa289('0x3'));var BPromise=require('bluebird');var rp=require(_0xa289('0x4'));var fs=require('fs');var path=require(_0xa289('0x5'));var rimraf=require(_0xa289('0x6'));var config=require(_0xa289('0x7'));var attributes=require(_0xa289('0x8'));module['exports']=function(_0x2b1862,_0x2c284e){return _0x2b1862[_0xa289('0x9')](_0xa289('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc794=['moment','bluebird','request-promise','path','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','../../config/logger','api'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xc794,0xc3));var _0x4c79=function(_0x654345,_0x4d01b5){_0x654345=_0x654345-0x0;var _0x3cf347=_0xc794[_0x654345];return _0x3cf347;};'use strict';var _=require(_0x4c79('0x0'));var util=require('util');var logger=require(_0x4c79('0x1'))(_0x4c79('0x2'));var moment=require(_0x4c79('0x3'));var BPromise=require(_0x4c79('0x4'));var rp=require(_0x4c79('0x5'));var fs=require('fs');var path=require(_0x4c79('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c79('0x7'));module[_0x4c79('0x8')]=function(_0x209dc2,_0x5f3c22){return _0x209dc2[_0x4c79('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x4c79('0xa'),'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 9265a1d..001176b 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 _0x5775=['code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3b5c72,_0x3ad6aa){var _0xbcd3e8=function(_0x5bc93e){while(--_0x5bc93e){_0x3b5c72['push'](_0x3b5c72['shift']());}};_0xbcd3e8(++_0x3ad6aa);}(_0x5775,0xb0));var _0x5577=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5775[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x5577('0x0'));var util=require(_0x5577('0x1'));var moment=require(_0x5577('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(_0x5577('0x3'));var logger=require(_0x5577('0x4'))(_0x5577('0x5'));var config=require('../../config/environment');var jayson=require(_0x5577('0x6'));var client=jayson[_0x5577('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eccf2,_0x57db8a,_0x12aedc){return new BPromise(function(_0x1a1737,_0x1308f9){return client['request'](_0x3eccf2,_0x12aedc)[_0x5577('0x8')](function(_0x5d7afa){logger[_0x5577('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x57db8a,'request\x20sent');logger['debug'](_0x5577('0xa'),_0x57db8a,_0x5577('0xb'),JSON[_0x5577('0xc')](_0x5d7afa));if(_0x5d7afa[_0x5577('0xd')]){if(_0x5d7afa[_0x5577('0xd')][_0x5577('0xe')]===0x1f4){logger[_0x5577('0xd')](_0x5577('0xf'),_0x57db8a,_0x5d7afa['error']['message']);return _0x1308f9(_0x5d7afa[_0x5577('0xd')][_0x5577('0x10')]);}logger[_0x5577('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x57db8a,_0x5d7afa['error'][_0x5577('0x10')]);return _0x1a1737(_0x5d7afa[_0x5577('0xd')]['message']);}else{logger[_0x5577('0x9')](_0x5577('0xf'),_0x57db8a,_0x5577('0xb'));_0x1a1737(_0x5d7afa[_0x5577('0x11')][_0x5577('0x10')]);}})[_0x5577('0x12')](function(_0x39f6b4){logger[_0x5577('0xd')](_0x5577('0xf'),_0x57db8a,_0x39f6b4);_0x1308f9(_0x39f6b4);});});} \ No newline at end of file +var _0xb5ee=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0xb5ee,0x167));var _0xeb5e=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0xb5ee[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0xeb5e('0x0'));var util=require(_0xeb5e('0x1'));var moment=require(_0xeb5e('0x2'));var BPromise=require(_0xeb5e('0x3'));var rs=require(_0xeb5e('0x4'));var fs=require('fs');var Redis=require(_0xeb5e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb5e('0x6'))(_0xeb5e('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb5e('0x8'));var client=jayson['client'][_0xeb5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x70dde4,_0x1d8c67,_0x30afc9){return new BPromise(function(_0x4b80db,_0x352eb6){return client[_0xeb5e('0xa')](_0x70dde4,_0x30afc9)[_0xeb5e('0xb')](function(_0x346628){logger['info'](_0xeb5e('0xc'),_0x1d8c67,_0xeb5e('0xd'));logger[_0xeb5e('0xe')](_0xeb5e('0xf'),_0x1d8c67,'request\x20sent',JSON[_0xeb5e('0x10')](_0x346628));if(_0x346628[_0xeb5e('0x11')]){if(_0x346628[_0xeb5e('0x11')][_0xeb5e('0x12')]===0x1f4){logger[_0xeb5e('0x11')](_0xeb5e('0xc'),_0x1d8c67,_0x346628[_0xeb5e('0x11')]['message']);return _0x352eb6(_0x346628[_0xeb5e('0x11')][_0xeb5e('0x13')]);}logger[_0xeb5e('0x11')](_0xeb5e('0xc'),_0x1d8c67,_0x346628[_0xeb5e('0x11')][_0xeb5e('0x13')]);return _0x4b80db(_0x346628[_0xeb5e('0x11')][_0xeb5e('0x13')]);}else{logger[_0xeb5e('0x14')](_0xeb5e('0xc'),_0x1d8c67,_0xeb5e('0xd'));_0x4b80db(_0x346628[_0xeb5e('0x15')][_0xeb5e('0x13')]);}})['catch'](function(_0x49ace4){logger[_0xeb5e('0x11')](_0xeb5e('0xc'),_0x1d8c67,_0x49ace4);_0x352eb6(_0x49ace4);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 60c5db2..5f5f77d 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 _0x5458=['../../config/environment','isAuthenticated','get','/:id','show','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x178227,_0x488a86){var _0x391c56=function(_0x56a8ae){while(--_0x56a8ae){_0x178227['push'](_0x178227['shift']());}};_0x391c56(++_0x488a86);}(_0x5458,0x89));var _0x8545=function(_0x3fbc6a,_0x1f1133){_0x3fbc6a=_0x3fbc6a-0x0;var _0x524a7c=_0x5458[_0x3fbc6a];return _0x524a7c;};'use strict';var multer=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var path=require(_0x8545('0x2'));var timeout=require('connect-timeout');var express=require(_0x8545('0x3'));var router=express[_0x8545('0x4')]();var fs_extra=require(_0x8545('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8545('0x6'));var config=require(_0x8545('0x7'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x8545('0x8')](),controller['index']);router[_0x8545('0x9')](_0x8545('0xa'),auth[_0x8545('0x8')](),controller[_0x8545('0xb')]);router['post']('/',auth[_0x8545('0x8')](),controller['create']);router[_0x8545('0xc')](_0x8545('0xa'),auth[_0x8545('0x8')](),controller[_0x8545('0xd')]);router[_0x8545('0xe')](_0x8545('0xa'),auth[_0x8545('0x8')](),controller['destroy']);module[_0x8545('0xf')]=router; \ No newline at end of file +var _0x2771=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','show','isAuthenticated','create','/:id','update','destroy','exports'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x2771,0x1cb));var _0x1277=function(_0x343e1e,_0x4def3b){_0x343e1e=_0x343e1e-0x0;var _0x1063a1=_0x2771[_0x343e1e];return _0x1063a1;};'use strict';var multer=require(_0x1277('0x0'));var util=require(_0x1277('0x1'));var path=require('path');var timeout=require(_0x1277('0x2'));var express=require(_0x1277('0x3'));var router=express[_0x1277('0x4')]();var fs_extra=require(_0x1277('0x5'));var auth=require(_0x1277('0x6'));var interaction=require(_0x1277('0x7'));var config=require(_0x1277('0x8'));var controller=require(_0x1277('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1277('0xa')]);router['post']('/',auth[_0x1277('0xb')](),controller[_0x1277('0xc')]);router['put'](_0x1277('0xd'),auth[_0x1277('0xb')](),controller[_0x1277('0xe')]);router['delete'](_0x1277('0xd'),auth[_0x1277('0xb')](),controller[_0x1277('0xf')]);module[_0x1277('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8036da0..2e0f3fa 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 _0x3a98=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x46a920,_0x571299){var _0x32592e=function(_0x3b28bc){while(--_0x3b28bc){_0x46a920['push'](_0x46a920['shift']());}};_0x32592e(++_0x571299);}(_0x3a98,0x71));var _0x83a9=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x3a98[_0x2d4661];return _0x42ed1e;};'use strict';var Sequelize=require(_0x83a9('0x0'));module[_0x83a9('0x1')]={'type':{'type':Sequelize[_0x83a9('0x2')](_0x83a9('0x3'),'variable',_0x83a9('0x4'),_0x83a9('0x5'),_0x83a9('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x83a9('0x7')]},'keyType':{'type':Sequelize[_0x83a9('0x2')](_0x83a9('0x3'),_0x83a9('0x8'),_0x83a9('0x4'))},'keyContent':{'type':Sequelize[_0x83a9('0x7')]},'idField':{'type':Sequelize[_0x83a9('0x7')]},'nameField':{'type':Sequelize[_0x83a9('0x7')]},'customField':{'type':Sequelize[_0x83a9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x83a9('0x7')]}}; \ No newline at end of file +var _0xf440=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x24da78,_0x50a35b){var _0x53e95a=function(_0x169ebf){while(--_0x169ebf){_0x24da78['push'](_0x24da78['shift']());}};_0x53e95a(++_0x50a35b);}(_0xf440,0x19b));var _0x0f44=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf440[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0x0f44('0x0')]={'type':{'type':Sequelize[_0x0f44('0x1')](_0x0f44('0x2'),_0x0f44('0x3'),_0x0f44('0x4'),_0x0f44('0x5'),_0x0f44('0x6')),'defaultValue':_0x0f44('0x2')},'content':{'type':Sequelize[_0x0f44('0x7')]},'key':{'type':Sequelize[_0x0f44('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0f44('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0f44('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0f44('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 4dbfad2..6c3f074 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 _0x2384=['../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','VtigerField','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x34d790,_0x1ca401){var _0x46c83f=function(_0x908c4f){while(--_0x908c4f){_0x34d790['push'](_0x34d790['shift']());}};_0x46c83f(++_0x1ca401);}(_0x2384,0x123));var _0x4238=function(_0x400c2e,_0x4ff80e){_0x400c2e=_0x400c2e-0x0;var _0x33e9db=_0x2384[_0x400c2e];return _0x33e9db;};'use strict';var emlformat=require(_0x4238('0x0'));var rimraf=require(_0x4238('0x1'));var zipdir=require(_0x4238('0x2'));var jsonpatch=require(_0x4238('0x3'));var rp=require(_0x4238('0x4'));var moment=require('moment');var BPromise=require(_0x4238('0x5'));var Mustache=require(_0x4238('0x6'));var util=require(_0x4238('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4238('0x8'));var ejs=require(_0x4238('0x9'));var fs=require('fs');var fs_extra=require(_0x4238('0xa'));var _=require(_0x4238('0xb'));var squel=require(_0x4238('0xc'));var crypto=require(_0x4238('0xd'));var jsforce=require(_0x4238('0xe'));var deskjs=require(_0x4238('0xf'));var toCsv=require(_0x4238('0x8'));var querystring=require(_0x4238('0x10'));var Papa=require(_0x4238('0x11'));var Redis=require(_0x4238('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4238('0x13'));var as=require(_0x4238('0x14'));var hardwareService=require(_0x4238('0x15'));var logger=require(_0x4238('0x16'))(_0x4238('0x17'));var utils=require(_0x4238('0x18'));var config=require(_0x4238('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4238('0x1a'))['db'];function respondWithStatusCode(_0x5e880c,_0x4a36ba){_0x4a36ba=_0x4a36ba||0xcc;return function(_0x3df5ce){if(_0x3df5ce){return _0x5e880c[_0x4238('0x1b')](_0x4a36ba);}return _0x5e880c[_0x4238('0x1c')](_0x4a36ba)[_0x4238('0x1d')]();};}function respondWithResult(_0x2a6b60,_0x14ea01){_0x14ea01=_0x14ea01||0xc8;return function(_0x28f7be){if(_0x28f7be){return _0x2a6b60['status'](_0x14ea01)[_0x4238('0x1e')](_0x28f7be);}};}function respondWithFilteredResult(_0x68848a,_0x59de7b){return function(_0x41c3ae){if(_0x41c3ae){var _0x3a63a2=typeof _0x59de7b['offset']==='undefined'&&typeof _0x59de7b[_0x4238('0x1f')]===_0x4238('0x20');var _0x24d6de=_0x41c3ae[_0x4238('0x21')];var _0x6e822a=_0x3a63a2?0x0:_0x59de7b[_0x4238('0x22')];var _0x37afe3=_0x3a63a2?_0x41c3ae[_0x4238('0x21')]:_0x59de7b['offset']+_0x59de7b['limit'];var _0x28ad60;if(_0x37afe3>=_0x24d6de){_0x37afe3=_0x24d6de;_0x28ad60=0xc8;}else{_0x28ad60=0xce;}_0x68848a[_0x4238('0x1c')](_0x28ad60);return _0x68848a[_0x4238('0x23')](_0x4238('0x24'),_0x6e822a+'-'+_0x37afe3+'/'+_0x24d6de)[_0x4238('0x1e')](_0x41c3ae);}return null;};}function patchUpdates(_0x1749e9){return function(_0x1fd319){try{jsonpatch[_0x4238('0x25')](_0x1fd319,_0x1749e9,!![]);}catch(_0x263144){return BPromise[_0x4238('0x26')](_0x263144);}return _0x1fd319[_0x4238('0x27')]();};}function saveUpdates(_0x1eb9c3,_0x519a14){return function(_0x35c44b){if(_0x35c44b){return _0x35c44b[_0x4238('0x28')](_0x1eb9c3)[_0x4238('0x29')](function(_0x8f81da){return _0x8f81da;});}return null;};}function removeEntity(_0x36aa4f,_0x1b66f7){return function(_0x66df1f){if(_0x66df1f){return _0x66df1f[_0x4238('0x2a')]()[_0x4238('0x29')](function(){_0x36aa4f[_0x4238('0x1c')](0xcc)[_0x4238('0x1d')]();});}};}function handleEntityNotFound(_0x382f11,_0x2e9fd1){return function(_0xd1258){if(!_0xd1258){_0x382f11['sendStatus'](0x194);}return _0xd1258;};}function handleError(_0x35dbdd,_0x40e9a9){_0x40e9a9=_0x40e9a9||0x1f4;return function(_0x2327a9){logger['error'](_0x2327a9[_0x4238('0x2b')]);if(_0x2327a9[_0x4238('0x2c')]){delete _0x2327a9[_0x4238('0x2c')];}_0x35dbdd['status'](_0x40e9a9)[_0x4238('0x2d')](_0x2327a9);};}exports[_0x4238('0x2e')]=function(_0x400f59,_0x14d472){var _0x133f35={},_0x4d5527={},_0x5653e5={'count':0x0,'rows':[]};var _0x29cba4=_['map'](db[_0x4238('0x2f')][_0x4238('0x30')],function(_0x984007){return{'name':_0x984007['fieldName'],'type':_0x984007['type'][_0x4238('0x31')]};});_0x4d5527[_0x4238('0x32')]=_[_0x4238('0x33')](_0x29cba4,_0x4238('0x2c'));_0x4d5527[_0x4238('0x34')]=_[_0x4238('0x35')](_0x400f59['query']);_0x4d5527[_0x4238('0x36')]=_[_0x4238('0x37')](_0x4d5527['model'],_0x4d5527[_0x4238('0x34')]);_0x133f35['attributes']=_[_0x4238('0x37')](_0x4d5527['model'],qs[_0x4238('0x38')](_0x400f59[_0x4238('0x34')]['fields']));_0x133f35[_0x4238('0x39')]=_0x133f35[_0x4238('0x39')][_0x4238('0x3a')]?_0x133f35[_0x4238('0x39')]:_0x4d5527['model'];if(!_0x400f59['query'][_0x4238('0x3b')]('nolimit')){_0x133f35[_0x4238('0x1f')]=qs[_0x4238('0x1f')](_0x400f59[_0x4238('0x34')][_0x4238('0x1f')]);_0x133f35['offset']=qs[_0x4238('0x22')](_0x400f59['query']['offset']);}_0x133f35[_0x4238('0x3c')]=qs[_0x4238('0x3d')](_0x400f59[_0x4238('0x34')][_0x4238('0x3d')]);_0x133f35['where']=qs[_0x4238('0x36')](_[_0x4238('0x3e')](_0x400f59[_0x4238('0x34')],_0x4d5527['filters']),_0x29cba4);if(_0x400f59[_0x4238('0x34')]['filter']){_0x133f35[_0x4238('0x3f')]=_[_0x4238('0x40')](_0x133f35[_0x4238('0x3f')],{'$or':_[_0x4238('0x33')](_0x29cba4,function(_0x359727){if(_0x359727[_0x4238('0x41')]!==_0x4238('0x42')){var _0x85f5a9={};_0x85f5a9[_0x359727['name']]={'$like':'%'+_0x400f59[_0x4238('0x34')][_0x4238('0x43')]+'%'};return _0x85f5a9;}})});}_0x133f35=_[_0x4238('0x40')]({},_0x133f35,_0x400f59[_0x4238('0x44')]);var _0xcce099={'where':_0x133f35[_0x4238('0x3f')]};return db[_0x4238('0x2f')][_0x4238('0x21')](_0xcce099)['then'](function(_0x414788){_0x5653e5[_0x4238('0x21')]=_0x414788;if(_0x400f59['query'][_0x4238('0x45')]){_0x133f35[_0x4238('0x46')]=[{'all':!![]}];}return db[_0x4238('0x2f')][_0x4238('0x47')](_0x133f35);})[_0x4238('0x29')](function(_0x288298){_0x5653e5[_0x4238('0x48')]=_0x288298;return _0x5653e5;})[_0x4238('0x29')](respondWithFilteredResult(_0x14d472,_0x133f35))[_0x4238('0x49')](handleError(_0x14d472,null));};exports[_0x4238('0x4a')]=function(_0x3551ca,_0x4423a8){var _0x1c76ad={'raw':!![],'where':{'id':_0x3551ca['params']['id']}},_0x32f65c={};_0x32f65c[_0x4238('0x32')]=_['keys'](db[_0x4238('0x2f')][_0x4238('0x30')]);_0x32f65c['query']=_[_0x4238('0x35')](_0x3551ca[_0x4238('0x34')]);_0x32f65c['filters']=_[_0x4238('0x37')](_0x32f65c[_0x4238('0x32')],_0x32f65c['query']);_0x1c76ad[_0x4238('0x39')]=_[_0x4238('0x37')](_0x32f65c[_0x4238('0x32')],qs[_0x4238('0x38')](_0x3551ca[_0x4238('0x34')][_0x4238('0x38')]));_0x1c76ad[_0x4238('0x39')]=_0x1c76ad[_0x4238('0x39')][_0x4238('0x3a')]?_0x1c76ad['attributes']:_0x32f65c['model'];if(_0x3551ca['query'][_0x4238('0x45')]){_0x1c76ad[_0x4238('0x46')]=[{'all':!![]}];}_0x1c76ad=_[_0x4238('0x40')]({},_0x1c76ad,_0x3551ca[_0x4238('0x44')]);return db[_0x4238('0x2f')][_0x4238('0x4b')](_0x1c76ad)['then'](handleEntityNotFound(_0x4423a8,null))[_0x4238('0x29')](respondWithResult(_0x4423a8,null))['catch'](handleError(_0x4423a8,null));};exports[_0x4238('0x4c')]=function(_0x3dc50b,_0x34207d){return db[_0x4238('0x2f')]['create'](_0x3dc50b[_0x4238('0x4d')],{})[_0x4238('0x29')](respondWithResult(_0x34207d,0xc9))['catch'](handleError(_0x34207d,null));};exports[_0x4238('0x28')]=function(_0x4767af,_0x23d740){if(_0x4767af[_0x4238('0x4d')]['id']){delete _0x4767af[_0x4238('0x4d')]['id'];}return db[_0x4238('0x2f')][_0x4238('0x4b')]({'where':{'id':_0x4767af[_0x4238('0x4e')]['id']}})[_0x4238('0x29')](handleEntityNotFound(_0x23d740,null))[_0x4238('0x29')](saveUpdates(_0x4767af[_0x4238('0x4d')],null))['then'](respondWithResult(_0x23d740,null))['catch'](handleError(_0x23d740,null));};exports['destroy']=function(_0x10b096,_0x2e1f2c){return db[_0x4238('0x2f')][_0x4238('0x4b')]({'where':{'id':_0x10b096[_0x4238('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e1f2c,null))[_0x4238('0x29')](removeEntity(_0x2e1f2c,null))['catch'](handleError(_0x2e1f2c,null));}; \ No newline at end of file +var _0x7ac2=['find','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','VtigerField','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','rows','catch','params','body'];(function(_0x3edcb2,_0x2408db){var _0x33eb99=function(_0x1eb0d1){while(--_0x1eb0d1){_0x3edcb2['push'](_0x3edcb2['shift']());}};_0x33eb99(++_0x2408db);}(_0x7ac2,0x1c1));var _0x27ac=function(_0x3283d3,_0x19c532){_0x3283d3=_0x3283d3-0x0;var _0x14eee0=_0x7ac2[_0x3283d3];return _0x14eee0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x27ac('0x0'));var jsonpatch=require(_0x27ac('0x1'));var rp=require(_0x27ac('0x2'));var moment=require(_0x27ac('0x3'));var BPromise=require(_0x27ac('0x4'));var Mustache=require('mustache');var util=require(_0x27ac('0x5'));var path=require(_0x27ac('0x6'));var sox=require(_0x27ac('0x7'));var csv=require(_0x27ac('0x8'));var ejs=require(_0x27ac('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(_0x27ac('0xa'));var toCsv=require(_0x27ac('0x8'));var querystring=require(_0x27ac('0xb'));var Papa=require(_0x27ac('0xc'));var Redis=require(_0x27ac('0xd'));var authService=require(_0x27ac('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27ac('0xf'));var logger=require(_0x27ac('0x10'))(_0x27ac('0x11'));var utils=require(_0x27ac('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x27ac('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x576b06,_0x49f8ed){_0x49f8ed=_0x49f8ed||0xcc;return function(_0x134e25){if(_0x134e25){return _0x576b06[_0x27ac('0x14')](_0x49f8ed);}return _0x576b06[_0x27ac('0x15')](_0x49f8ed)[_0x27ac('0x16')]();};}function respondWithResult(_0x244d96,_0x58ab37){_0x58ab37=_0x58ab37||0xc8;return function(_0x328f30){if(_0x328f30){return _0x244d96[_0x27ac('0x15')](_0x58ab37)[_0x27ac('0x17')](_0x328f30);}};}function respondWithFilteredResult(_0x1caac5,_0x10b055){return function(_0x328cbc){if(_0x328cbc){var _0x340e9d=typeof _0x10b055[_0x27ac('0x18')]===_0x27ac('0x19')&&typeof _0x10b055[_0x27ac('0x1a')]==='undefined';var _0x111860=_0x328cbc['count'];var _0x3e35b1=_0x340e9d?0x0:_0x10b055[_0x27ac('0x18')];var _0xca0c3b=_0x340e9d?_0x328cbc[_0x27ac('0x1b')]:_0x10b055['offset']+_0x10b055[_0x27ac('0x1a')];var _0x2a036f;if(_0xca0c3b>=_0x111860){_0xca0c3b=_0x111860;_0x2a036f=0xc8;}else{_0x2a036f=0xce;}_0x1caac5['status'](_0x2a036f);return _0x1caac5[_0x27ac('0x1c')](_0x27ac('0x1d'),_0x3e35b1+'-'+_0xca0c3b+'/'+_0x111860)[_0x27ac('0x17')](_0x328cbc);}return null;};}function patchUpdates(_0xd3f684){return function(_0x34e041){try{jsonpatch[_0x27ac('0x1e')](_0x34e041,_0xd3f684,!![]);}catch(_0xcfe9c0){return BPromise[_0x27ac('0x1f')](_0xcfe9c0);}return _0x34e041[_0x27ac('0x20')]();};}function saveUpdates(_0x3ac6a9,_0x3ed9d7){return function(_0x23e18d){if(_0x23e18d){return _0x23e18d[_0x27ac('0x21')](_0x3ac6a9)[_0x27ac('0x22')](function(_0x5ea0c0){return _0x5ea0c0;});}return null;};}function removeEntity(_0x572aad,_0x112f57){return function(_0x16cbba){if(_0x16cbba){return _0x16cbba['destroy']()['then'](function(){_0x572aad[_0x27ac('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x521b66,_0x18cb26){return function(_0x2421a7){if(!_0x2421a7){_0x521b66[_0x27ac('0x14')](0x194);}return _0x2421a7;};}function handleError(_0x56ae61,_0x3aabe6){_0x3aabe6=_0x3aabe6||0x1f4;return function(_0x217566){logger['error'](_0x217566[_0x27ac('0x23')]);if(_0x217566[_0x27ac('0x24')]){delete _0x217566[_0x27ac('0x24')];}_0x56ae61['status'](_0x3aabe6)[_0x27ac('0x25')](_0x217566);};}exports['index']=function(_0x165e0e,_0x46781d){var _0x8f3b12={},_0xcf5b8d={},_0x4007fb={'count':0x0,'rows':[]};var _0x13d759=_[_0x27ac('0x26')](db[_0x27ac('0x27')]['rawAttributes'],function(_0xdd56b5){return{'name':_0xdd56b5[_0x27ac('0x28')],'type':_0xdd56b5[_0x27ac('0x29')]['key']};});_0xcf5b8d[_0x27ac('0x2a')]=_[_0x27ac('0x26')](_0x13d759,_0x27ac('0x24'));_0xcf5b8d[_0x27ac('0x2b')]=_[_0x27ac('0x2c')](_0x165e0e[_0x27ac('0x2b')]);_0xcf5b8d[_0x27ac('0x2d')]=_[_0x27ac('0x2e')](_0xcf5b8d[_0x27ac('0x2a')],_0xcf5b8d[_0x27ac('0x2b')]);_0x8f3b12['attributes']=_[_0x27ac('0x2e')](_0xcf5b8d['model'],qs[_0x27ac('0x2f')](_0x165e0e[_0x27ac('0x2b')][_0x27ac('0x2f')]));_0x8f3b12[_0x27ac('0x30')]=_0x8f3b12['attributes'][_0x27ac('0x31')]?_0x8f3b12['attributes']:_0xcf5b8d[_0x27ac('0x2a')];if(!_0x165e0e[_0x27ac('0x2b')][_0x27ac('0x32')]('nolimit')){_0x8f3b12[_0x27ac('0x1a')]=qs[_0x27ac('0x1a')](_0x165e0e[_0x27ac('0x2b')][_0x27ac('0x1a')]);_0x8f3b12[_0x27ac('0x18')]=qs['offset'](_0x165e0e[_0x27ac('0x2b')][_0x27ac('0x18')]);}_0x8f3b12[_0x27ac('0x33')]=qs['sort'](_0x165e0e[_0x27ac('0x2b')]['sort']);_0x8f3b12[_0x27ac('0x34')]=qs[_0x27ac('0x2d')](_[_0x27ac('0x35')](_0x165e0e[_0x27ac('0x2b')],_0xcf5b8d[_0x27ac('0x2d')]),_0x13d759);if(_0x165e0e[_0x27ac('0x2b')][_0x27ac('0x36')]){_0x8f3b12['where']=_[_0x27ac('0x37')](_0x8f3b12['where'],{'$or':_[_0x27ac('0x26')](_0x13d759,function(_0x173e06){if(_0x173e06['type']!=='VIRTUAL'){var _0x415436={};_0x415436[_0x173e06[_0x27ac('0x24')]]={'$like':'%'+_0x165e0e[_0x27ac('0x2b')][_0x27ac('0x36')]+'%'};return _0x415436;}})});}_0x8f3b12=_[_0x27ac('0x37')]({},_0x8f3b12,_0x165e0e[_0x27ac('0x38')]);var _0x1f011f={'where':_0x8f3b12[_0x27ac('0x34')]};return db[_0x27ac('0x27')][_0x27ac('0x1b')](_0x1f011f)[_0x27ac('0x22')](function(_0x14106e){_0x4007fb[_0x27ac('0x1b')]=_0x14106e;if(_0x165e0e[_0x27ac('0x2b')][_0x27ac('0x39')]){_0x8f3b12[_0x27ac('0x3a')]=[{'all':!![]}];}return db[_0x27ac('0x27')]['findAll'](_0x8f3b12);})[_0x27ac('0x22')](function(_0x37ae95){_0x4007fb[_0x27ac('0x3b')]=_0x37ae95;return _0x4007fb;})['then'](respondWithFilteredResult(_0x46781d,_0x8f3b12))[_0x27ac('0x3c')](handleError(_0x46781d,null));};exports['show']=function(_0x263e68,_0x31f87f){var _0x3bfb77={'raw':!![],'where':{'id':_0x263e68[_0x27ac('0x3d')]['id']}},_0x4e2bcf={};_0x4e2bcf[_0x27ac('0x2a')]=_['keys'](db[_0x27ac('0x27')]['rawAttributes']);_0x4e2bcf[_0x27ac('0x2b')]=_['keys'](_0x263e68['query']);_0x4e2bcf[_0x27ac('0x2d')]=_[_0x27ac('0x2e')](_0x4e2bcf['model'],_0x4e2bcf['query']);_0x3bfb77[_0x27ac('0x30')]=_[_0x27ac('0x2e')](_0x4e2bcf['model'],qs[_0x27ac('0x2f')](_0x263e68[_0x27ac('0x2b')][_0x27ac('0x2f')]));_0x3bfb77[_0x27ac('0x30')]=_0x3bfb77[_0x27ac('0x30')][_0x27ac('0x31')]?_0x3bfb77[_0x27ac('0x30')]:_0x4e2bcf[_0x27ac('0x2a')];if(_0x263e68[_0x27ac('0x2b')][_0x27ac('0x39')]){_0x3bfb77['include']=[{'all':!![]}];}_0x3bfb77=_[_0x27ac('0x37')]({},_0x3bfb77,_0x263e68[_0x27ac('0x38')]);return db[_0x27ac('0x27')]['find'](_0x3bfb77)[_0x27ac('0x22')](handleEntityNotFound(_0x31f87f,null))[_0x27ac('0x22')](respondWithResult(_0x31f87f,null))[_0x27ac('0x3c')](handleError(_0x31f87f,null));};exports['create']=function(_0x12571f,_0x5888ff){return db[_0x27ac('0x27')]['create'](_0x12571f['body'],{})[_0x27ac('0x22')](respondWithResult(_0x5888ff,0xc9))[_0x27ac('0x3c')](handleError(_0x5888ff,null));};exports[_0x27ac('0x21')]=function(_0x15eb62,_0x3111c8){if(_0x15eb62[_0x27ac('0x3e')]['id']){delete _0x15eb62[_0x27ac('0x3e')]['id'];}return db['VtigerField'][_0x27ac('0x3f')]({'where':{'id':_0x15eb62['params']['id']}})[_0x27ac('0x22')](handleEntityNotFound(_0x3111c8,null))[_0x27ac('0x22')](saveUpdates(_0x15eb62['body'],null))['then'](respondWithResult(_0x3111c8,null))[_0x27ac('0x3c')](handleError(_0x3111c8,null));};exports['destroy']=function(_0x58a49e,_0x579ddb){return db[_0x27ac('0x27')][_0x27ac('0x3f')]({'where':{'id':_0x58a49e[_0x27ac('0x3d')]['id']}})[_0x27ac('0x22')](handleEntityNotFound(_0x579ddb,null))['then'](removeEntity(_0x579ddb,null))[_0x27ac('0x3c')](handleError(_0x579ddb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6e509c0..aeeb5d2 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 _0x67f0=['lodash','util','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','exports','define','idField'];(function(_0x17ed96,_0xce07d9){var _0x2eb1dd=function(_0xebf514){while(--_0xebf514){_0x17ed96['push'](_0x17ed96['shift']());}};_0x2eb1dd(++_0xce07d9);}(_0x67f0,0x181));var _0x067f=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0x67f0[_0x50cd41];return _0x399475;};'use strict';var _=require(_0x067f('0x0'));var util=require(_0x067f('0x1'));var logger=require('../../config/logger')(_0x067f('0x2'));var moment=require(_0x067f('0x3'));var BPromise=require(_0x067f('0x4'));var rp=require(_0x067f('0x5'));var fs=require('fs');var path=require(_0x067f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x067f('0x7'));module[_0x067f('0x8')]=function(_0x1dc327,_0x4d74cd){return _0x1dc327[_0x067f('0x9')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x067f('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41f5=['api','moment','request-promise','path','rimraf','../../config/environment','define','lodash','util'];(function(_0x185952,_0x914ad8){var _0x3b2d90=function(_0x154bc3){while(--_0x154bc3){_0x185952['push'](_0x185952['shift']());}};_0x3b2d90(++_0x914ad8);}(_0x41f5,0xdf));var _0x541f=function(_0x1ba901,_0x20da33){_0x1ba901=_0x1ba901-0x0;var _0x3108b2=_0x41f5[_0x1ba901];return _0x3108b2;};'use strict';var _=require(_0x541f('0x0'));var util=require(_0x541f('0x1'));var logger=require('../../config/logger')(_0x541f('0x2'));var moment=require(_0x541f('0x3'));var BPromise=require('bluebird');var rp=require(_0x541f('0x4'));var fs=require('fs');var path=require(_0x541f('0x5'));var rimraf=require(_0x541f('0x6'));var config=require(_0x541f('0x7'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x408fe1,_0x1bb243){return _0x408fe1[_0x541f('0x8')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'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 9782e01..bcc6610 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 _0x916a=['../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x13b395,_0x23e1f8){var _0x5975ac=function(_0x52d165){while(--_0x52d165){_0x13b395['push'](_0x13b395['shift']());}};_0x5975ac(++_0x23e1f8);}(_0x916a,0x158));var _0xa916=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x916a[_0x5ad07c];return _0x204bae;};'use strict';var _=require(_0xa916('0x0'));var util=require(_0xa916('0x1'));var moment=require(_0xa916('0x2'));var BPromise=require('bluebird');var rs=require(_0xa916('0x3'));var fs=require('fs');var Redis=require(_0xa916('0x4'));var db=require(_0xa916('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa916('0x6'))(_0xa916('0x7'));var config=require(_0xa916('0x8'));var jayson=require(_0xa916('0x9'));var client=jayson[_0xa916('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c0612,_0x5a04a9,_0x349157){return new BPromise(function(_0x4405bc,_0x3fb8ac){return client[_0xa916('0xb')](_0x1c0612,_0x349157)[_0xa916('0xc')](function(_0x352f39){logger[_0xa916('0xd')](_0xa916('0xe'),_0x5a04a9,'request\x20sent');logger[_0xa916('0xf')](_0xa916('0x10'),_0x5a04a9,_0xa916('0x11'),JSON[_0xa916('0x12')](_0x352f39));if(_0x352f39[_0xa916('0x13')]){if(_0x352f39[_0xa916('0x13')][_0xa916('0x14')]===0x1f4){logger['error'](_0xa916('0xe'),_0x5a04a9,_0x352f39['error'][_0xa916('0x15')]);return _0x3fb8ac(_0x352f39[_0xa916('0x13')][_0xa916('0x15')]);}logger['error'](_0xa916('0xe'),_0x5a04a9,_0x352f39[_0xa916('0x13')]['message']);return _0x4405bc(_0x352f39['error']['message']);}else{logger[_0xa916('0xd')](_0xa916('0xe'),_0x5a04a9,'request\x20sent');_0x4405bc(_0x352f39['result'][_0xa916('0x15')]);}})['catch'](function(_0x3e8d26){logger[_0xa916('0x13')]('VtigerField,\x20%s,\x20%s',_0x5a04a9,_0x3e8d26);_0x3fb8ac(_0x3e8d26);});});} \ No newline at end of file +var _0x3845=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util'];(function(_0x4bc9da,_0x42dace){var _0x14573c=function(_0x37cc6f){while(--_0x37cc6f){_0x4bc9da['push'](_0x4bc9da['shift']());}};_0x14573c(++_0x42dace);}(_0x3845,0x136));var _0x5384=function(_0x508fdf,_0x4c1352){_0x508fdf=_0x508fdf-0x0;var _0x37ef27=_0x3845[_0x508fdf];return _0x37ef27;};'use strict';var _=require(_0x5384('0x0'));var util=require(_0x5384('0x1'));var moment=require(_0x5384('0x2'));var BPromise=require(_0x5384('0x3'));var rs=require(_0x5384('0x4'));var fs=require('fs');var Redis=require(_0x5384('0x5'));var db=require(_0x5384('0x6'))['db'];var utils=require(_0x5384('0x7'));var logger=require(_0x5384('0x8'))(_0x5384('0x9'));var config=require(_0x5384('0xa'));var jayson=require(_0x5384('0xb'));var client=jayson[_0x5384('0xc')][_0x5384('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x19128c,_0x223a9e,_0x4cce72){return new BPromise(function(_0x37835e,_0x1ff80c){return client[_0x5384('0xe')](_0x19128c,_0x4cce72)[_0x5384('0xf')](function(_0x5f266b){logger[_0x5384('0x10')](_0x5384('0x11'),_0x223a9e,'request\x20sent');logger['debug'](_0x5384('0x12'),_0x223a9e,_0x5384('0x13'),JSON[_0x5384('0x14')](_0x5f266b));if(_0x5f266b['error']){if(_0x5f266b['error'][_0x5384('0x15')]===0x1f4){logger[_0x5384('0x16')](_0x5384('0x11'),_0x223a9e,_0x5f266b[_0x5384('0x16')][_0x5384('0x17')]);return _0x1ff80c(_0x5f266b['error']['message']);}logger['error'](_0x5384('0x11'),_0x223a9e,_0x5f266b['error'][_0x5384('0x17')]);return _0x37835e(_0x5f266b['error']['message']);}else{logger['info'](_0x5384('0x11'),_0x223a9e,_0x5384('0x13'));_0x37835e(_0x5f266b[_0x5384('0x18')][_0x5384('0x17')]);}})[_0x5384('0x19')](function(_0xf4eb07){logger[_0x5384('0x16')](_0x5384('0x11'),_0x223a9e,_0xf4eb07);_0x1ff80c(_0xf4eb07);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 29f01d2..178af2b 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 _0x3941=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','destroy','exports','multer'];(function(_0x5cbe38,_0x1053b8){var _0x360084=function(_0x5046e8){while(--_0x5046e8){_0x5cbe38['push'](_0x5cbe38['shift']());}};_0x360084(++_0x1053b8);}(_0x3941,0xc5));var _0x1394=function(_0xff1f85,_0x14c895){_0xff1f85=_0xff1f85-0x0;var _0xa1fcf1=_0x3941[_0xff1f85];return _0xa1fcf1;};'use strict';var multer=require(_0x1394('0x0'));var util=require('util');var path=require(_0x1394('0x1'));var timeout=require('connect-timeout');var express=require(_0x1394('0x2'));var router=express[_0x1394('0x3')]();var fs_extra=require(_0x1394('0x4'));var auth=require(_0x1394('0x5'));var interaction=require(_0x1394('0x6'));var config=require(_0x1394('0x7'));var controller=require(_0x1394('0x8'));router[_0x1394('0x9')]('/',auth[_0x1394('0xa')](),controller['index']);router['get'](_0x1394('0xb'),auth['isAuthenticated'](),controller[_0x1394('0xc')]);router[_0x1394('0x9')](_0x1394('0xd'),auth[_0x1394('0xa')](),controller[_0x1394('0xe')]);router[_0x1394('0x9')](_0x1394('0xf'),auth[_0x1394('0xa')](),controller[_0x1394('0x10')]);router['post']('/',auth[_0x1394('0xa')](),controller['create']);router[_0x1394('0x11')](_0x1394('0xd'),auth[_0x1394('0xa')](),controller['addConfiguration']);router[_0x1394('0x12')]('/:id',auth[_0x1394('0xa')](),controller[_0x1394('0x13')]);router['delete']('/:id',auth[_0x1394('0xa')](),controller[_0x1394('0x14')]);module[_0x1394('0x15')]=router; \ No newline at end of file +var _0xc604=['put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x143a91,_0x235332){var _0x1906f5=function(_0xd27eeb){while(--_0xd27eeb){_0x143a91['push'](_0x143a91['shift']());}};_0x1906f5(++_0x235332);}(_0xc604,0x1a9));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x4c60('0x0'));var path=require(_0x4c60('0x1'));var timeout=require(_0x4c60('0x2'));var express=require(_0x4c60('0x3'));var router=express[_0x4c60('0x4')]();var fs_extra=require(_0x4c60('0x5'));var auth=require(_0x4c60('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c60('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x4c60('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4c60('0x9')]);router[_0x4c60('0xa')](_0x4c60('0xb'),auth[_0x4c60('0x8')](),controller[_0x4c60('0xc')]);router[_0x4c60('0xa')](_0x4c60('0xd'),auth[_0x4c60('0x8')](),controller['getFields']);router[_0x4c60('0xe')]('/',auth[_0x4c60('0x8')](),controller[_0x4c60('0xf')]);router[_0x4c60('0xe')]('/:id/configurations',auth[_0x4c60('0x8')](),controller['addConfiguration']);router[_0x4c60('0x10')](_0x4c60('0x11'),auth[_0x4c60('0x8')](),controller[_0x4c60('0x12')]);router[_0x4c60('0x13')](_0x4c60('0x11'),auth[_0x4c60('0x8')](),controller[_0x4c60('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 830ebc3..faeded6 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 _0xcefd=['token','password','newTab','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x5d3b98,_0x2822d2){var _0x51ef2f=function(_0x22ebf6){while(--_0x22ebf6){_0x5d3b98['push'](_0x5d3b98['shift']());}};_0x51ef2f(++_0x2822d2);}(_0xcefd,0x126));var _0xdcef=function(_0x423f6a,_0x2b2377){_0x423f6a=_0x423f6a-0x0;var _0x174dba=_0xcefd[_0x423f6a];return _0x174dba;};'use strict';var Sequelize=require(_0xdcef('0x0'));module[_0xdcef('0x1')]={'name':{'type':Sequelize[_0xdcef('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdcef('0x2')],'unique':_0xdcef('0x3')},'password':{'type':Sequelize[_0xdcef('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdcef('0x2')],'unique':_0xdcef('0x4')},'authType':{'type':Sequelize[_0xdcef('0x5')]('password',_0xdcef('0x6')),'defaultValue':_0xdcef('0x7')},'serverUrl':{'type':Sequelize[_0xdcef('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdcef('0x5')]('integrationTab',_0xdcef('0x8')),'defaultValue':_0xdcef('0x9')}}; \ No newline at end of file +var _0x5b47=['sequelize','exports','STRING','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x1dc634,_0x7f73e3){var _0x40b4dc=function(_0x533fc3){while(--_0x533fc3){_0x1dc634['push'](_0x1dc634['shift']());}};_0x40b4dc(++_0x7f73e3);}(_0x5b47,0x120));var _0x75b4=function(_0x31700f,_0x2080a7){_0x31700f=_0x31700f-0x0;var _0x51b6c8=_0x5b47[_0x31700f];return _0x51b6c8;};'use strict';var Sequelize=require(_0x75b4('0x0'));module[_0x75b4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x75b4('0x2')]},'remoteUri':{'type':Sequelize[_0x75b4('0x2')],'unique':_0x75b4('0x3')},'authType':{'type':Sequelize[_0x75b4('0x4')](_0x75b4('0x5'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x75b4('0x4')]('integrationTab',_0x75b4('0x6')),'defaultValue':_0x75b4('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c51d45d..4199c3e 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 _0x9348=['authType','remoteUri','substring','lastIndexOf','%s/%s','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','username','token'];(function(_0x18a95d,_0xb64648){var _0x43b752=function(_0x23c9ec){while(--_0x23c9ec){_0x18a95d['push'](_0x18a95d['shift']());}};_0x43b752(++_0xb64648);}(_0x9348,0x10d));var _0x8934=function(_0x559699,_0x1d3cf3){_0x559699=_0x559699-0x0;var _0x32716b=_0x9348[_0x559699];return _0x32716b;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x68427d,_0x108eab){_0x108eab=_0x108eab||0xcc;return function(_0x46bca5){if(_0x46bca5){return _0x68427d[_0x8934('0x19')](_0x108eab);}return _0x68427d[_0x8934('0x1a')](_0x108eab)[_0x8934('0x1b')]();};}function respondWithResult(_0x5b560f,_0x254720){_0x254720=_0x254720||0xc8;return function(_0x38230a){if(_0x38230a){return _0x5b560f[_0x8934('0x1a')](_0x254720)[_0x8934('0x1c')](_0x38230a);}};}function respondWithFilteredResult(_0x34d4dc,_0x41e6a9){return function(_0x2a5b04){if(_0x2a5b04){var _0x357cf8=typeof _0x41e6a9['offset']===_0x8934('0x1d')&&typeof _0x41e6a9[_0x8934('0x1e')]===_0x8934('0x1d');var _0x5de8f0=_0x2a5b04['count'];var _0x597eed=_0x357cf8?0x0:_0x41e6a9[_0x8934('0x1f')];var _0x51f9ed=_0x357cf8?_0x2a5b04[_0x8934('0x20')]:_0x41e6a9[_0x8934('0x1f')]+_0x41e6a9[_0x8934('0x1e')];var _0x36c3b9;if(_0x51f9ed>=_0x5de8f0){_0x51f9ed=_0x5de8f0;_0x36c3b9=0xc8;}else{_0x36c3b9=0xce;}_0x34d4dc[_0x8934('0x1a')](_0x36c3b9);return _0x34d4dc['set'](_0x8934('0x21'),_0x597eed+'-'+_0x51f9ed+'/'+_0x5de8f0)['json'](_0x2a5b04);}return null;};}function patchUpdates(_0x476c6c){return function(_0x34f4e7){try{jsonpatch[_0x8934('0x22')](_0x34f4e7,_0x476c6c,!![]);}catch(_0x379445){return BPromise[_0x8934('0x23')](_0x379445);}return _0x34f4e7[_0x8934('0x24')]();};}function saveUpdates(_0x36fe20,_0x4f4a9b){return function(_0xe763c6){if(_0xe763c6){return _0xe763c6[_0x8934('0x25')](_0x36fe20)[_0x8934('0x26')](function(_0x343e09){return _0x343e09;});}return null;};}function removeEntity(_0x43b89a,_0x5e593b){return function(_0x3cf295){if(_0x3cf295){return _0x3cf295[_0x8934('0x27')]()[_0x8934('0x26')](function(){_0x43b89a['status'](0xcc)[_0x8934('0x1b')]();});}};}function handleEntityNotFound(_0x561df2,_0x14c5f0){return function(_0x1783ce){if(!_0x1783ce){_0x561df2[_0x8934('0x19')](0x194);}return _0x1783ce;};}function handleError(_0x5ef0ed,_0x1fd5eb){_0x1fd5eb=_0x1fd5eb||0x1f4;return function(_0x15910b){logger[_0x8934('0x28')](_0x15910b[_0x8934('0x29')]);if(_0x15910b['name']){delete _0x15910b[_0x8934('0x2a')];}_0x5ef0ed[_0x8934('0x1a')](_0x1fd5eb)[_0x8934('0x2b')](_0x15910b);};}exports[_0x8934('0x2c')]=function(_0x44972b,_0x20d448){var _0x3f328a={},_0x457634={},_0x9c6a71={'count':0x0,'rows':[]};var _0x18938a=_['map'](db[_0x8934('0x2d')][_0x8934('0x2e')],function(_0x54d28d){return{'name':_0x54d28d[_0x8934('0x2f')],'type':_0x54d28d[_0x8934('0x30')][_0x8934('0x31')]};});_0x457634[_0x8934('0x32')]=_['map'](_0x18938a,_0x8934('0x2a'));_0x457634[_0x8934('0x33')]=_[_0x8934('0x34')](_0x44972b[_0x8934('0x33')]);_0x457634[_0x8934('0x35')]=_['intersection'](_0x457634[_0x8934('0x32')],_0x457634['query']);_0x3f328a['attributes']=_[_0x8934('0x36')](_0x457634[_0x8934('0x32')],qs[_0x8934('0x37')](_0x44972b[_0x8934('0x33')]['fields']));_0x3f328a[_0x8934('0x38')]=_0x3f328a[_0x8934('0x38')][_0x8934('0x39')]?_0x3f328a[_0x8934('0x38')]:_0x457634[_0x8934('0x32')];if(!_0x44972b['query'][_0x8934('0x3a')](_0x8934('0x3b'))){_0x3f328a['limit']=qs['limit'](_0x44972b[_0x8934('0x33')][_0x8934('0x1e')]);_0x3f328a['offset']=qs['offset'](_0x44972b[_0x8934('0x33')][_0x8934('0x1f')]);}_0x3f328a[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x44972b[_0x8934('0x33')][_0x8934('0x3d')]);_0x3f328a[_0x8934('0x3e')]=qs[_0x8934('0x35')](_[_0x8934('0x3f')](_0x44972b[_0x8934('0x33')],_0x457634[_0x8934('0x35')]),_0x18938a);if(_0x44972b['query'][_0x8934('0x40')]){_0x3f328a[_0x8934('0x3e')]=_['merge'](_0x3f328a[_0x8934('0x3e')],{'$or':_[_0x8934('0x41')](_0x18938a,function(_0x414091){if(_0x414091[_0x8934('0x30')]!==_0x8934('0x42')){var _0x5b0307={};_0x5b0307[_0x414091['name']]={'$like':'%'+_0x44972b['query'][_0x8934('0x40')]+'%'};return _0x5b0307;}})});}_0x3f328a=_[_0x8934('0x43')]({},_0x3f328a,_0x44972b[_0x8934('0x44')]);var _0x53581b={'where':_0x3f328a[_0x8934('0x3e')]};return db['ZendeskAccount']['count'](_0x53581b)[_0x8934('0x26')](function(_0x1f36d0){_0x9c6a71['count']=_0x1f36d0;if(_0x44972b['query'][_0x8934('0x45')]){_0x3f328a[_0x8934('0x46')]=[{'all':!![]}];}return db[_0x8934('0x2d')]['findAll'](_0x3f328a);})[_0x8934('0x26')](function(_0x5e543c){_0x9c6a71[_0x8934('0x47')]=_0x5e543c;return _0x9c6a71;})['then'](respondWithFilteredResult(_0x20d448,_0x3f328a))[_0x8934('0x48')](handleError(_0x20d448,null));};exports[_0x8934('0x49')]=function(_0x83be9e,_0x566d67){var _0xefdfab={'raw':![],'where':{'id':_0x83be9e[_0x8934('0x4a')]['id']}},_0x350d04={};_0x350d04[_0x8934('0x32')]=_['keys'](db[_0x8934('0x2d')][_0x8934('0x2e')]);_0x350d04[_0x8934('0x33')]=_[_0x8934('0x34')](_0x83be9e[_0x8934('0x33')]);_0x350d04[_0x8934('0x35')]=_[_0x8934('0x36')](_0x350d04[_0x8934('0x32')],_0x350d04['query']);_0xefdfab['attributes']=_['intersection'](_0x350d04[_0x8934('0x32')],qs[_0x8934('0x37')](_0x83be9e['query'][_0x8934('0x37')]));_0xefdfab['attributes']=_0xefdfab[_0x8934('0x38')][_0x8934('0x39')]?_0xefdfab['attributes']:_0x350d04[_0x8934('0x32')];if(_0x83be9e[_0x8934('0x33')][_0x8934('0x45')]){_0xefdfab[_0x8934('0x46')]=[{'all':!![]}];}_0xefdfab=_['merge']({},_0xefdfab,_0x83be9e[_0x8934('0x44')]);return db[_0x8934('0x2d')]['find'](_0xefdfab)[_0x8934('0x26')](handleEntityNotFound(_0x566d67,null))[_0x8934('0x26')](respondWithResult(_0x566d67,null))[_0x8934('0x48')](handleError(_0x566d67,null));};exports[_0x8934('0x4b')]=function(_0x406d0a,_0x419e30){return db[_0x8934('0x2d')][_0x8934('0x4b')](_0x406d0a[_0x8934('0x4c')],{})[_0x8934('0x26')](respondWithResult(_0x419e30,0xc9))[_0x8934('0x48')](handleError(_0x419e30,null));};exports[_0x8934('0x25')]=function(_0x2c322d,_0x2febf5){if(_0x2c322d[_0x8934('0x4c')]['id']){delete _0x2c322d[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x4d')]({'where':{'id':_0x2c322d['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x2febf5,null))[_0x8934('0x26')](saveUpdates(_0x2c322d['body'],null))['then'](respondWithResult(_0x2febf5,null))['catch'](handleError(_0x2febf5,null));};exports['destroy']=function(_0x3610a0,_0x15310a){return db[_0x8934('0x2d')]['find']({'where':{'id':_0x3610a0['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x15310a,null))['then'](removeEntity(_0x15310a,null))['catch'](handleError(_0x15310a,null));};exports[_0x8934('0x4e')]=function(_0x2778f9,_0x173bc1,_0x334f27){var _0x21ca17={};var _0x1b66d8={};var _0x3902fb;var _0x575bd7;return db[_0x8934('0x2d')]['findOne']({'where':{'id':_0x2778f9[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x173bc1,null))[_0x8934('0x26')](function(_0x3df31e){if(_0x3df31e){_0x3902fb=_0x3df31e;_0x1b66d8[_0x8934('0x32')]=_[_0x8934('0x34')](db[_0x8934('0x4f')][_0x8934('0x2e')]);_0x1b66d8['query']=_[_0x8934('0x34')](_0x2778f9[_0x8934('0x33')]);_0x1b66d8[_0x8934('0x35')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],_0x1b66d8['query']);_0x21ca17[_0x8934('0x38')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],qs['fields'](_0x2778f9[_0x8934('0x33')][_0x8934('0x37')]));_0x21ca17[_0x8934('0x38')]=_0x21ca17['attributes']['length']?_0x21ca17['attributes']:_0x1b66d8[_0x8934('0x32')];_0x21ca17[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x2778f9['query'][_0x8934('0x3d')]);_0x21ca17[_0x8934('0x3e')]=qs['filters'](_['pick'](_0x2778f9[_0x8934('0x33')],_0x1b66d8[_0x8934('0x35')]));if(_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]){_0x21ca17['where']=_['merge'](_0x21ca17['where'],{'$or':_['map'](_0x21ca17[_0x8934('0x38')],function(_0x2b8837){var _0x18d08e={};_0x18d08e[_0x2b8837]={'$like':'%'+_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]+'%'};return _0x18d08e;})});}_0x21ca17=_[_0x8934('0x43')]({},_0x21ca17,_0x2778f9['options']);return _0x3902fb[_0x8934('0x4e')](_0x21ca17);}})[_0x8934('0x26')](function(_0x4991bd){if(_0x4991bd){_0x575bd7=_0x4991bd[_0x8934('0x39')];if(!_0x2778f9['query'][_0x8934('0x3a')]('nolimit')){_0x21ca17[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x2778f9[_0x8934('0x33')][_0x8934('0x1e')]);_0x21ca17[_0x8934('0x1f')]=qs[_0x8934('0x1f')](_0x2778f9[_0x8934('0x33')]['offset']);}return _0x3902fb['getConfigurations'](_0x21ca17);}})[_0x8934('0x26')](function(_0x3a0378){if(_0x3a0378){return _0x3a0378?{'count':_0x575bd7,'rows':_0x3a0378}:null;}})[_0x8934('0x26')](respondWithResult(_0x173bc1,null))[_0x8934('0x48')](handleError(_0x173bc1,null));};exports[_0x8934('0x50')]=function(_0x18850a,_0x35c437,_0x112957){if(_0x18850a[_0x8934('0x4c')]['id']){delete _0x18850a[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x18850a[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x35c437,null))['then'](function(_0x5c2819){if(_0x5c2819){_0x18850a[_0x8934('0x4c')][_0x8934('0x52')]=_0x5c2819['id'];_0x18850a[_0x8934('0x4c')][_0x8934('0x53')]=integrations[_0x8934('0x54')](_0x18850a[_0x8934('0x4c')][_0x8934('0x55')],_0x18850a['body'][_0x8934('0x30')]);_0x18850a[_0x8934('0x4c')]['Descriptions']=integrations[_0x8934('0x56')](_0x18850a['body'][_0x8934('0x55')],_0x18850a[_0x8934('0x4c')][_0x8934('0x30')]);return db['ZendeskConfiguration'][_0x8934('0x4b')](_0x18850a[_0x8934('0x4c')],{'include':[{'model':db['ZendeskField'],'as':_0x8934('0x53')},{'model':db['ZendeskField'],'as':_0x8934('0x57')}]});}return null;})['then'](respondWithResult(_0x35c437,null))[_0x8934('0x48')](handleError(_0x35c437,null));};exports[_0x8934('0x58')]=function(_0x24b0ce,_0x5ea4fe,_0x196372){var _0xfbad9='';return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x24b0ce['params']['id']},'attributes':['id',_0x8934('0x59'),'password',_0x8934('0x5a'),_0x8934('0x5b'),_0x8934('0x5c')]})[_0x8934('0x26')](handleEntityNotFound(_0x5ea4fe,null))['then'](function(_0xc2799d){if(_0xc2799d){_0xfbad9=_0xc2799d[_0x8934('0x5c')];var _0xd880ba=_0xfbad9['slice'](-0x1);if(_0xd880ba==='/'){_0xfbad9=_0xfbad9[_0x8934('0x5d')](0x0,_0xfbad9[_0x8934('0x5e')](_0xd880ba));}var _0x2acd18={'method':'GET','uri':util['format'](_0x8934('0x5f'),_0xfbad9,_0x8934('0x60')),'json':!![]};switch(_0xc2799d[_0x8934('0x5b')]){case _0x8934('0x61'):_0x2acd18[_0x8934('0x62')]={'Authorization':util[_0x8934('0x63')](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')](_0x8934('0x65'),_0xc2799d['username'],_0xc2799d[_0x8934('0x61')]))[_0x8934('0x66')](_0x8934('0x67')))};break;case _0x8934('0x5a'):_0x2acd18[_0x8934('0x62')]={'Authorization':util['format'](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')]('%s/token:%s',_0xc2799d[_0x8934('0x59')],_0xc2799d['token']))['toString']('base64'))};break;default:throw new db[(_0x8934('0x68'))][(_0x8934('0x69'))](_0x8934('0x6a'));}return rp(_0x2acd18);}})['then'](function(_0x2c289b){if(_0x2c289b){var _0x1d3372=['subject',_0x8934('0x6b'),_0x8934('0x6c'),_0x8934('0x6d')];_[_0x8934('0x6e')](_0x2c289b[_0x8934('0x60')],function(_0x324722){return _0x1d3372[_0x8934('0x6f')](_0x324722[_0x8934('0x30')]);});return{'count':_0x2c289b[_0x8934('0x60')][_0x8934('0x39')],'rows':_['map'](_0x2c289b[_0x8934('0x60')],function(_0x31e7d1){return{'id':_0x31e7d1['id'],'name':_0x31e7d1[_0x8934('0x70')]>0x7?_0x31e7d1[_0x8934('0x71')]:_0x31e7d1[_0x8934('0x30')],'custom':_0x31e7d1[_0x8934('0x70')]>0x7?!![]:![],'options':_0x31e7d1[_0x8934('0x72')]?_0x31e7d1['system_field_options']:_0x31e7d1[_0x8934('0x73')]?_0x31e7d1[_0x8934('0x73')]:[]};})};}})[_0x8934('0x26')](respondWithResult(_0x5ea4fe,null))[_0x8934('0x48')](function(_0x9de459){var _0xdf0ab2=_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?0x1f4:_0x9de459[_0x8934('0x75')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8934('0x58'),_0xdf0ab2,JSON[_0x8934('0x76')](_0x9de459));delete _0x9de459['name'];if(_0xdf0ab2===0x191){_0xdf0ab2=0x190;}_0x5ea4fe[_0x8934('0x1a')](_0xdf0ab2)[_0x8934('0x2b')](_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?{'message':_0x8934('0x77'),'statusCode':_0x9de459[_0x8934('0x75')]}:_0x9de459);});}; \ No newline at end of file +var _0x5423=['Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../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','limit','undefined','count','set','Content-Range','save','then','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','ZendeskConfiguration','nolimit','findOne','AccountId','getSubjects','channel','type','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','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'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x5423,0xe3));var _0x3542=function(_0x1ddd51,_0x1d68f9){_0x1ddd51=_0x1ddd51-0x0;var _0x3c5dc7=_0x5423[_0x1ddd51];return _0x3c5dc7;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];var integrations=require(_0x3542('0x18'));function respondWithStatusCode(_0x43e977,_0x4ee86){_0x4ee86=_0x4ee86||0xcc;return function(_0x1a9062){if(_0x1a9062){return _0x43e977[_0x3542('0x19')](_0x4ee86);}return _0x43e977[_0x3542('0x1a')](_0x4ee86)[_0x3542('0x1b')]();};}function respondWithResult(_0x4bac5b,_0x14fe57){_0x14fe57=_0x14fe57||0xc8;return function(_0x4fb366){if(_0x4fb366){return _0x4bac5b[_0x3542('0x1a')](_0x14fe57)[_0x3542('0x1c')](_0x4fb366);}};}function respondWithFilteredResult(_0xc33d42,_0x546fbd){return function(_0x270312){if(_0x270312){var _0x177fb9=typeof _0x546fbd[_0x3542('0x1d')]==='undefined'&&typeof _0x546fbd[_0x3542('0x1e')]===_0x3542('0x1f');var _0x116859=_0x270312[_0x3542('0x20')];var _0x493d95=_0x177fb9?0x0:_0x546fbd[_0x3542('0x1d')];var _0x53d4aa=_0x177fb9?_0x270312[_0x3542('0x20')]:_0x546fbd[_0x3542('0x1d')]+_0x546fbd['limit'];var _0x1c6403;if(_0x53d4aa>=_0x116859){_0x53d4aa=_0x116859;_0x1c6403=0xc8;}else{_0x1c6403=0xce;}_0xc33d42[_0x3542('0x1a')](_0x1c6403);return _0xc33d42[_0x3542('0x21')](_0x3542('0x22'),_0x493d95+'-'+_0x53d4aa+'/'+_0x116859)[_0x3542('0x1c')](_0x270312);}return null;};}function patchUpdates(_0x4a7695){return function(_0x4a74b0){try{jsonpatch['apply'](_0x4a74b0,_0x4a7695,!![]);}catch(_0x17e3cf){return BPromise['reject'](_0x17e3cf);}return _0x4a74b0[_0x3542('0x23')]();};}function saveUpdates(_0x551645,_0x1d5f1e){return function(_0x55774d){if(_0x55774d){return _0x55774d['update'](_0x551645)[_0x3542('0x24')](function(_0xe3f983){return _0xe3f983;});}return null;};}function removeEntity(_0x5ae097,_0x5d05b2){return function(_0x3fc964){if(_0x3fc964){return _0x3fc964['destroy']()[_0x3542('0x24')](function(){_0x5ae097[_0x3542('0x1a')](0xcc)[_0x3542('0x1b')]();});}};}function handleEntityNotFound(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(!_0xf1f7d0){_0x2f2e63[_0x3542('0x19')](0x194);}return _0xf1f7d0;};}function handleError(_0x1e156e,_0x18dc6c){_0x18dc6c=_0x18dc6c||0x1f4;return function(_0x2841a1){logger[_0x3542('0x25')](_0x2841a1[_0x3542('0x26')]);if(_0x2841a1[_0x3542('0x27')]){delete _0x2841a1[_0x3542('0x27')];}_0x1e156e[_0x3542('0x1a')](_0x18dc6c)[_0x3542('0x28')](_0x2841a1);};}exports[_0x3542('0x29')]=function(_0x20eda1,_0x3bd666){var _0x5590a2={},_0x31ad47={},_0x35bbc9={'count':0x0,'rows':[]};var _0x2aec76=_['map'](db[_0x3542('0x2a')][_0x3542('0x2b')],function(_0x2e883a){return{'name':_0x2e883a[_0x3542('0x2c')],'type':_0x2e883a['type']['key']};});_0x31ad47[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x2aec76,_0x3542('0x27'));_0x31ad47[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x20eda1[_0x3542('0x2f')]);_0x31ad47[_0x3542('0x31')]=_['intersection'](_0x31ad47['model'],_0x31ad47[_0x3542('0x2f')]);_0x5590a2['attributes']=_['intersection'](_0x31ad47[_0x3542('0x2d')],qs['fields'](_0x20eda1['query'][_0x3542('0x32')]));_0x5590a2[_0x3542('0x33')]=_0x5590a2[_0x3542('0x33')]['length']?_0x5590a2[_0x3542('0x33')]:_0x31ad47['model'];if(!_0x20eda1[_0x3542('0x2f')][_0x3542('0x34')]('nolimit')){_0x5590a2[_0x3542('0x1e')]=qs['limit'](_0x20eda1[_0x3542('0x2f')][_0x3542('0x1e')]);_0x5590a2[_0x3542('0x1d')]=qs['offset'](_0x20eda1[_0x3542('0x2f')]['offset']);}_0x5590a2[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x20eda1[_0x3542('0x2f')][_0x3542('0x36')]);_0x5590a2[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x20eda1[_0x3542('0x2f')],_0x31ad47[_0x3542('0x31')]),_0x2aec76);if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]){_0x5590a2[_0x3542('0x37')]=_[_0x3542('0x3a')](_0x5590a2['where'],{'$or':_[_0x3542('0x2e')](_0x2aec76,function(_0x4a80ea){if(_0x4a80ea['type']!==_0x3542('0x3b')){var _0x3ffccc={};_0x3ffccc[_0x4a80ea[_0x3542('0x27')]]={'$like':'%'+_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x3ffccc;}})});}_0x5590a2=_[_0x3542('0x3a')]({},_0x5590a2,_0x20eda1[_0x3542('0x3c')]);var _0x42e87a={'where':_0x5590a2['where']};return db[_0x3542('0x2a')]['count'](_0x42e87a)[_0x3542('0x24')](function(_0x2baa01){_0x35bbc9['count']=_0x2baa01;if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x3d')]){_0x5590a2['include']=[{'all':!![]}];}return db[_0x3542('0x2a')][_0x3542('0x3e')](_0x5590a2);})['then'](function(_0x2682d0){_0x35bbc9[_0x3542('0x3f')]=_0x2682d0;return _0x35bbc9;})[_0x3542('0x24')](respondWithFilteredResult(_0x3bd666,_0x5590a2))[_0x3542('0x40')](handleError(_0x3bd666,null));};exports[_0x3542('0x41')]=function(_0xb12441,_0x2b54b9){var _0x4bf45a={'raw':![],'where':{'id':_0xb12441[_0x3542('0x42')]['id']}},_0x542e0c={};_0x542e0c[_0x3542('0x2d')]=_[_0x3542('0x30')](db[_0x3542('0x2a')][_0x3542('0x2b')]);_0x542e0c['query']=_[_0x3542('0x30')](_0xb12441['query']);_0x542e0c[_0x3542('0x31')]=_[_0x3542('0x43')](_0x542e0c[_0x3542('0x2d')],_0x542e0c['query']);_0x4bf45a[_0x3542('0x33')]=_[_0x3542('0x43')](_0x542e0c['model'],qs[_0x3542('0x32')](_0xb12441[_0x3542('0x2f')][_0x3542('0x32')]));_0x4bf45a[_0x3542('0x33')]=_0x4bf45a[_0x3542('0x33')][_0x3542('0x44')]?_0x4bf45a[_0x3542('0x33')]:_0x542e0c[_0x3542('0x2d')];if(_0xb12441['query']['includeAll']){_0x4bf45a['include']=[{'all':!![]}];}_0x4bf45a=_[_0x3542('0x3a')]({},_0x4bf45a,_0xb12441[_0x3542('0x3c')]);return db[_0x3542('0x2a')][_0x3542('0x45')](_0x4bf45a)[_0x3542('0x24')](handleEntityNotFound(_0x2b54b9,null))[_0x3542('0x24')](respondWithResult(_0x2b54b9,null))[_0x3542('0x40')](handleError(_0x2b54b9,null));};exports['create']=function(_0x157683,_0x14b960){return db[_0x3542('0x2a')][_0x3542('0x46')](_0x157683['body'],{})[_0x3542('0x24')](respondWithResult(_0x14b960,0xc9))[_0x3542('0x40')](handleError(_0x14b960,null));};exports['update']=function(_0x528f8c,_0x1fb253){if(_0x528f8c[_0x3542('0x47')]['id']){delete _0x528f8c[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x528f8c[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x1fb253,null))['then'](saveUpdates(_0x528f8c[_0x3542('0x47')],null))[_0x3542('0x24')](respondWithResult(_0x1fb253,null))[_0x3542('0x40')](handleError(_0x1fb253,null));};exports[_0x3542('0x48')]=function(_0x1ebc82,_0x28be34){return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x1ebc82[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x28be34,null))['then'](removeEntity(_0x28be34,null))[_0x3542('0x40')](handleError(_0x28be34,null));};exports['getConfigurations']=function(_0x5a798a,_0x572e7a,_0x286222){var _0xd5c5c3={};var _0x381885={};var _0x48cfc4;var _0x2db495;return db[_0x3542('0x2a')]['findOne']({'where':{'id':_0x5a798a[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x572e7a,null))[_0x3542('0x24')](function(_0x196c59){if(_0x196c59){_0x48cfc4=_0x196c59;_0x381885[_0x3542('0x2d')]=_['keys'](db[_0x3542('0x49')][_0x3542('0x2b')]);_0x381885[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5a798a[_0x3542('0x2f')]);_0x381885['filters']=_['intersection'](_0x381885[_0x3542('0x2d')],_0x381885[_0x3542('0x2f')]);_0xd5c5c3[_0x3542('0x33')]=_['intersection'](_0x381885[_0x3542('0x2d')],qs[_0x3542('0x32')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x32')]));_0xd5c5c3[_0x3542('0x33')]=_0xd5c5c3['attributes']['length']?_0xd5c5c3[_0x3542('0x33')]:_0x381885['model'];_0xd5c5c3[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x5a798a['query'][_0x3542('0x36')]);_0xd5c5c3[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x5a798a[_0x3542('0x2f')],_0x381885['filters']));if(_0x5a798a['query'][_0x3542('0x39')]){_0xd5c5c3['where']=_[_0x3542('0x3a')](_0xd5c5c3[_0x3542('0x37')],{'$or':_[_0x3542('0x2e')](_0xd5c5c3['attributes'],function(_0xd9c90c){var _0x1f8ddb={};_0x1f8ddb[_0xd9c90c]={'$like':'%'+_0x5a798a[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x1f8ddb;})});}_0xd5c5c3=_[_0x3542('0x3a')]({},_0xd5c5c3,_0x5a798a[_0x3542('0x3c')]);return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})[_0x3542('0x24')](function(_0x3ee446){if(_0x3ee446){_0x2db495=_0x3ee446[_0x3542('0x44')];if(!_0x5a798a[_0x3542('0x2f')][_0x3542('0x34')](_0x3542('0x4a'))){_0xd5c5c3['limit']=qs[_0x3542('0x1e')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1e')]);_0xd5c5c3[_0x3542('0x1d')]=qs['offset'](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1d')]);}return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})['then'](function(_0x2908e5){if(_0x2908e5){return _0x2908e5?{'count':_0x2db495,'rows':_0x2908e5}:null;}})['then'](respondWithResult(_0x572e7a,null))[_0x3542('0x40')](handleError(_0x572e7a,null));};exports['addConfiguration']=function(_0x484204,_0x42a34a,_0x471408){if(_0x484204[_0x3542('0x47')]['id']){delete _0x484204[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x4b')]({'where':{'id':_0x484204[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a34a,null))[_0x3542('0x24')](function(_0xf1cf57){if(_0xf1cf57){_0x484204[_0x3542('0x47')][_0x3542('0x4c')]=_0xf1cf57['id'];_0x484204[_0x3542('0x47')]['Subjects']=integrations[_0x3542('0x4d')](_0x484204[_0x3542('0x47')][_0x3542('0x4e')],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);_0x484204[_0x3542('0x47')][_0x3542('0x50')]=integrations['getDescriptions'](_0x484204[_0x3542('0x47')]['channel'],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);return db[_0x3542('0x49')][_0x3542('0x46')](_0x484204['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x3542('0x51')],'as':_0x3542('0x50')}]});}return null;})[_0x3542('0x24')](respondWithResult(_0x42a34a,null))[_0x3542('0x40')](handleError(_0x42a34a,null));};exports[_0x3542('0x52')]=function(_0x2afc71,_0x3c84fa,_0x77f0af){var _0x2b0de0='';return db['ZendeskAccount'][_0x3542('0x4b')]({'where':{'id':_0x2afc71[_0x3542('0x42')]['id']},'attributes':['id',_0x3542('0x53'),_0x3542('0x54'),_0x3542('0x55'),'authType','remoteUri']})[_0x3542('0x24')](handleEntityNotFound(_0x3c84fa,null))[_0x3542('0x24')](function(_0x52c26d){if(_0x52c26d){_0x2b0de0=_0x52c26d[_0x3542('0x56')];var _0x4b5327=_0x2b0de0[_0x3542('0x57')](-0x1);if(_0x4b5327==='/'){_0x2b0de0=_0x2b0de0['substring'](0x0,_0x2b0de0[_0x3542('0x58')](_0x4b5327));}var _0x153e1b={'method':'GET','uri':util['format']('%s/%s',_0x2b0de0,_0x3542('0x59')),'json':!![]};switch(_0x52c26d['authType']){case _0x3542('0x54'):_0x153e1b[_0x3542('0x5a')]={'Authorization':util['format'](_0x3542('0x5b'),new Buffer(util[_0x3542('0x5c')](_0x3542('0x5d'),_0x52c26d['username'],_0x52c26d[_0x3542('0x54')]))['toString'](_0x3542('0x5e')))};break;case'token':_0x153e1b[_0x3542('0x5a')]={'Authorization':util[_0x3542('0x5c')](_0x3542('0x5b'),new Buffer(util['format'](_0x3542('0x5f'),_0x52c26d[_0x3542('0x53')],_0x52c26d[_0x3542('0x55')]))[_0x3542('0x60')]('base64'))};break;default:throw new db['Sequelize'][(_0x3542('0x61'))](_0x3542('0x62'));}return rp(_0x153e1b);}})[_0x3542('0x24')](function(_0xaa97d5){if(_0xaa97d5){var _0x191fdd=[_0x3542('0x63'),_0x3542('0x64'),_0x3542('0x65'),_0x3542('0x66')];_[_0x3542('0x67')](_0xaa97d5[_0x3542('0x59')],function(_0x1c318c){return _0x191fdd[_0x3542('0x68')](_0x1c318c[_0x3542('0x4f')]);});return{'count':_0xaa97d5[_0x3542('0x59')][_0x3542('0x44')],'rows':_[_0x3542('0x2e')](_0xaa97d5[_0x3542('0x59')],function(_0x4e04b6){return{'id':_0x4e04b6['id'],'name':_0x4e04b6[_0x3542('0x69')]>0x7?_0x4e04b6[_0x3542('0x6a')]:_0x4e04b6['type'],'custom':_0x4e04b6['position']>0x7?!![]:![],'options':_0x4e04b6[_0x3542('0x6b')]?_0x4e04b6[_0x3542('0x6b')]:_0x4e04b6[_0x3542('0x6c')]?_0x4e04b6[_0x3542('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3c84fa,null))[_0x3542('0x40')](function(_0x2d17ce){var _0x54e723=_0x2afc71[_0x3542('0x2f')]['test']?0x1f4:_0x2d17ce[_0x3542('0x6d')]||0x1f4;logger['error'](_0x3542('0x6e'),_0x3542('0x52'),_0x54e723,JSON[_0x3542('0x6f')](_0x2d17ce));delete _0x2d17ce[_0x3542('0x27')];if(_0x54e723===0x191){_0x54e723=0x190;}_0x3c84fa[_0x3542('0x1a')](_0x54e723)[_0x3542('0x28')](_0x2afc71[_0x3542('0x2f')]['test']?{'message':_0x3542('0x70'),'statusCode':_0x2d17ce['statusCode']}:_0x2d17ce);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a9c0089..d9d49fb 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 _0x76fe=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger'];(function(_0x40872c,_0x52c7ae){var _0x444e8d=function(_0x2a571f){while(--_0x2a571f){_0x40872c['push'](_0x40872c['shift']());}};_0x444e8d(++_0x52c7ae);}(_0x76fe,0xc2));var _0xe76f=function(_0x794207,_0x54a989){_0x794207=_0x794207-0x0;var _0x4ee1c9=_0x76fe[_0x794207];return _0x4ee1c9;};'use strict';var _=require(_0xe76f('0x0'));var util=require('util');var logger=require(_0xe76f('0x1'))(_0xe76f('0x2'));var moment=require(_0xe76f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe76f('0x4'));var fs=require('fs');var path=require(_0xe76f('0x5'));var rimraf=require(_0xe76f('0x6'));var config=require(_0xe76f('0x7'));var attributes=require(_0xe76f('0x8'));var integrations=require(_0xe76f('0x9'));module[_0xe76f('0xa')]=function(_0xa3ebe1,_0x3e690f){return _0xa3ebe1[_0xe76f('0xb')](_0xe76f('0xc'),attributes,{'tableName':_0xe76f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a96=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x53a997,_0xc64dce){var _0x10fd03=function(_0x4801d2){while(--_0x4801d2){_0x53a997['push'](_0x53a997['shift']());}};_0x10fd03(++_0xc64dce);}(_0x9a96,0x117));var _0x69a9=function(_0x55dc2d,_0x3135bd){_0x55dc2d=_0x55dc2d-0x0;var _0x38b88f=_0x9a96[_0x55dc2d];return _0x38b88f;};'use strict';var _=require(_0x69a9('0x0'));var util=require('util');var logger=require(_0x69a9('0x1'))(_0x69a9('0x2'));var moment=require(_0x69a9('0x3'));var BPromise=require(_0x69a9('0x4'));var rp=require(_0x69a9('0x5'));var fs=require('fs');var path=require(_0x69a9('0x6'));var rimraf=require(_0x69a9('0x7'));var config=require(_0x69a9('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x69a9('0x9'));module[_0x69a9('0xa')]=function(_0x44215c,_0x425497){return _0x44215c[_0x69a9('0xb')]('ZendeskAccount',attributes,{'tableName':_0x69a9('0xc'),'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 1400293..c5466b2 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 _0xea7e=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','catch','GetZendeskAccount','findAll','options','where','attributes','limit','map','include','model','ShowZendeskAccount','ZendeskAccount','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2ffa17,_0x35b3a8){var _0x3a783b=function(_0x16d13d){while(--_0x16d13d){_0x2ffa17['push'](_0x2ffa17['shift']());}};_0x3a783b(++_0x35b3a8);}(_0xea7e,0x143));var _0xeea7=function(_0x17fdf4,_0x4432bd){_0x17fdf4=_0x17fdf4-0x0;var _0x42cfe8=_0xea7e[_0x17fdf4];return _0x42cfe8;};'use strict';var _=require('lodash');var util=require(_0xeea7('0x0'));var moment=require(_0xeea7('0x1'));var BPromise=require('bluebird');var rs=require(_0xeea7('0x2'));var fs=require('fs');var Redis=require(_0xeea7('0x3'));var db=require(_0xeea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeea7('0x5'))(_0xeea7('0x6'));var config=require(_0xeea7('0x7'));var jayson=require(_0xeea7('0x8'));var client=jayson[_0xeea7('0x9')][_0xeea7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25f505,_0xe52304,_0x3583d2){return new BPromise(function(_0xf3e8fc,_0x18ce7f){return client['request'](_0x25f505,_0x3583d2)[_0xeea7('0xb')](function(_0x42f89e){logger[_0xeea7('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0xe52304,_0xeea7('0xd'));logger[_0xeea7('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0xe52304,_0xeea7('0xd'),JSON[_0xeea7('0xf')](_0x42f89e));if(_0x42f89e[_0xeea7('0x10')]){if(_0x42f89e[_0xeea7('0x10')][_0xeea7('0x11')]===0x1f4){logger[_0xeea7('0x10')](_0xeea7('0x12'),_0xe52304,_0x42f89e['error']['message']);return _0x18ce7f(_0x42f89e['error'][_0xeea7('0x13')]);}logger[_0xeea7('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0xe52304,_0x42f89e[_0xeea7('0x10')][_0xeea7('0x13')]);return _0xf3e8fc(_0x42f89e[_0xeea7('0x10')]['message']);}else{logger[_0xeea7('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0xe52304,_0xeea7('0xd'));_0xf3e8fc(_0x42f89e['result']['message']);}})[_0xeea7('0x14')](function(_0x451d1e){logger[_0xeea7('0x10')](_0xeea7('0x12'),_0xe52304,_0x451d1e);_0x18ce7f(_0x451d1e);});});}exports[_0xeea7('0x15')]=function(_0xdefce6){var _0x58393=this;return new Promise(function(_0x5bafbb,_0x5eff91){return db['ZendeskAccount'][_0xeea7('0x16')]({'raw':_0xdefce6['options']?_0xdefce6[_0xeea7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xdefce6[_0xeea7('0x17')]?_0xdefce6['options'][_0xeea7('0x18')]||null:null,'attributes':_0xdefce6[_0xeea7('0x17')]?_0xdefce6[_0xeea7('0x17')][_0xeea7('0x19')]||null:null,'limit':_0xdefce6[_0xeea7('0x17')]?_0xdefce6[_0xeea7('0x17')][_0xeea7('0x1a')]||null:null,'include':_0xdefce6[_0xeea7('0x17')]?_0xdefce6[_0xeea7('0x17')]['include']?_[_0xeea7('0x1b')](_0xdefce6[_0xeea7('0x17')]['include'],function(_0x3ece56){return{'model':db[_0x3ece56['model']],'as':_0x3ece56['as'],'attributes':_0x3ece56[_0xeea7('0x19')],'include':_0x3ece56[_0xeea7('0x1c')]?_[_0xeea7('0x1b')](_0x3ece56['include'],function(_0xa42d4b){return{'model':db[_0xa42d4b[_0xeea7('0x1d')]],'as':_0xa42d4b['as'],'attributes':_0xa42d4b[_0xeea7('0x19')],'include':_0xa42d4b[_0xeea7('0x1c')]?_[_0xeea7('0x1b')](_0xa42d4b[_0xeea7('0x1c')],function(_0x2edb9e){return{'model':db[_0x2edb9e[_0xeea7('0x1d')]],'as':_0x2edb9e['as'],'attributes':_0x2edb9e[_0xeea7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeea7('0xb')](function(_0x1e1e5d){logger['info']('GetZendeskAccount',_0xdefce6);logger[_0xeea7('0xe')]('GetZendeskAccount',_0xdefce6,JSON[_0xeea7('0xf')](_0x1e1e5d));_0x5bafbb(_0x1e1e5d);})[_0xeea7('0x14')](function(_0x5ddc7e){logger[_0xeea7('0x10')](_0xeea7('0x15'),_0x5ddc7e[_0xeea7('0x13')],_0xdefce6);_0x5eff91(_0x58393[_0xeea7('0x10')](0x1f4,_0x5ddc7e['message']));});});};exports[_0xeea7('0x1e')]=function(_0x648b44){var _0x1e1fbd=this;return new Promise(function(_0x58c816,_0x3fcd9c){return db[_0xeea7('0x1f')]['find']({'raw':_0x648b44[_0xeea7('0x17')]?_0x648b44['options'][_0xeea7('0x20')]===undefined?!![]:![]:!![],'where':_0x648b44['options']?_0x648b44[_0xeea7('0x17')][_0xeea7('0x18')]||null:null,'attributes':_0x648b44[_0xeea7('0x17')]?_0x648b44['options'][_0xeea7('0x19')]||null:null,'include':_0x648b44[_0xeea7('0x17')]?_0x648b44['options'][_0xeea7('0x1c')]?_['map'](_0x648b44[_0xeea7('0x17')][_0xeea7('0x1c')],function(_0x384d17){return{'model':db[_0x384d17[_0xeea7('0x1d')]],'as':_0x384d17['as'],'attributes':_0x384d17[_0xeea7('0x19')],'include':_0x384d17[_0xeea7('0x1c')]?_['map'](_0x384d17[_0xeea7('0x1c')],function(_0x1904c2){return{'model':db[_0x1904c2[_0xeea7('0x1d')]],'as':_0x1904c2['as'],'attributes':_0x1904c2[_0xeea7('0x19')],'include':_0x1904c2[_0xeea7('0x1c')]?_[_0xeea7('0x1b')](_0x1904c2[_0xeea7('0x1c')],function(_0x40fb43){return{'model':db[_0x40fb43['model']],'as':_0x40fb43['as'],'attributes':_0x40fb43[_0xeea7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeea7('0xb')](function(_0x2ede18){logger[_0xeea7('0xc')](_0xeea7('0x1e'),_0x648b44);logger[_0xeea7('0xe')]('ShowZendeskAccount',_0x648b44,JSON[_0xeea7('0xf')](_0x2ede18));_0x58c816(_0x2ede18);})['catch'](function(_0x1b675e){logger[_0xeea7('0x10')](_0xeea7('0x1e'),_0x1b675e[_0xeea7('0x13')],_0x648b44);_0x3fcd9c(_0x1e1fbd[_0xeea7('0x10')](0x1f4,_0x1b675e['message']));});});}; \ No newline at end of file +var _0x54ea=['lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','request','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','debug','stringify','catch','ShowZendeskAccount','find','then','info'];(function(_0xa6271,_0x3e9ce1){var _0x4fbc16=function(_0x596149){while(--_0x596149){_0xa6271['push'](_0xa6271['shift']());}};_0x4fbc16(++_0x3e9ce1);}(_0x54ea,0x80));var _0xa54e=function(_0x232894,_0x364ef4){_0x232894=_0x232894-0x0;var _0x5e59de=_0x54ea[_0x232894];return _0x5e59de;};'use strict';var _=require(_0xa54e('0x0'));var util=require(_0xa54e('0x1'));var moment=require(_0xa54e('0x2'));var BPromise=require(_0xa54e('0x3'));var rs=require(_0xa54e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa54e('0x5'));var logger=require('../../config/logger')(_0xa54e('0x6'));var config=require('../../config/environment');var jayson=require(_0xa54e('0x7'));var client=jayson['client'][_0xa54e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a6f9c,_0x44956a,_0x355883){return new BPromise(function(_0x4899e1,_0x2f7a47){return client[_0xa54e('0x9')](_0x4a6f9c,_0x355883)['then'](function(_0x22af85){logger['info'](_0xa54e('0xa'),_0x44956a,'request\x20sent');logger['debug'](_0xa54e('0xb'),_0x44956a,_0xa54e('0xc'),JSON['stringify'](_0x22af85));if(_0x22af85[_0xa54e('0xd')]){if(_0x22af85['error']['code']===0x1f4){logger['error'](_0xa54e('0xa'),_0x44956a,_0x22af85[_0xa54e('0xd')][_0xa54e('0xe')]);return _0x2f7a47(_0x22af85[_0xa54e('0xd')][_0xa54e('0xe')]);}logger[_0xa54e('0xd')](_0xa54e('0xa'),_0x44956a,_0x22af85[_0xa54e('0xd')]['message']);return _0x4899e1(_0x22af85[_0xa54e('0xd')][_0xa54e('0xe')]);}else{logger['info'](_0xa54e('0xa'),_0x44956a,_0xa54e('0xc'));_0x4899e1(_0x22af85['result'][_0xa54e('0xe')]);}})['catch'](function(_0x59c901){logger[_0xa54e('0xd')](_0xa54e('0xa'),_0x44956a,_0x59c901);_0x2f7a47(_0x59c901);});});}exports['GetZendeskAccount']=function(_0x45b91d){var _0x24f13b=this;return new Promise(function(_0x31c106,_0x1d670d){return db[_0xa54e('0xf')]['findAll']({'raw':_0x45b91d[_0xa54e('0x10')]?_0x45b91d[_0xa54e('0x10')][_0xa54e('0x11')]===undefined?!![]:![]:!![],'where':_0x45b91d[_0xa54e('0x10')]?_0x45b91d['options'][_0xa54e('0x12')]||null:null,'attributes':_0x45b91d[_0xa54e('0x10')]?_0x45b91d[_0xa54e('0x10')][_0xa54e('0x13')]||null:null,'limit':_0x45b91d[_0xa54e('0x10')]?_0x45b91d['options'][_0xa54e('0x14')]||null:null,'include':_0x45b91d[_0xa54e('0x10')]?_0x45b91d[_0xa54e('0x10')][_0xa54e('0x15')]?_[_0xa54e('0x16')](_0x45b91d['options'][_0xa54e('0x15')],function(_0x16ca3a){return{'model':db[_0x16ca3a['model']],'as':_0x16ca3a['as'],'attributes':_0x16ca3a['attributes'],'include':_0x16ca3a[_0xa54e('0x15')]?_[_0xa54e('0x16')](_0x16ca3a[_0xa54e('0x15')],function(_0x973ab8){return{'model':db[_0x973ab8[_0xa54e('0x17')]],'as':_0x973ab8['as'],'attributes':_0x973ab8['attributes'],'include':_0x973ab8[_0xa54e('0x15')]?_['map'](_0x973ab8[_0xa54e('0x15')],function(_0xfcadca){return{'model':db[_0xfcadca[_0xa54e('0x17')]],'as':_0xfcadca['as'],'attributes':_0xfcadca[_0xa54e('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e11b0){logger['info'](_0xa54e('0x18'),_0x45b91d);logger[_0xa54e('0x19')](_0xa54e('0x18'),_0x45b91d,JSON[_0xa54e('0x1a')](_0x2e11b0));_0x31c106(_0x2e11b0);})[_0xa54e('0x1b')](function(_0x3cba30){logger['error'](_0xa54e('0x18'),_0x3cba30[_0xa54e('0xe')],_0x45b91d);_0x1d670d(_0x24f13b[_0xa54e('0xd')](0x1f4,_0x3cba30['message']));});});};exports[_0xa54e('0x1c')]=function(_0x291811){var _0x14fa64=this;return new Promise(function(_0x22a838,_0x265b23){return db[_0xa54e('0xf')][_0xa54e('0x1d')]({'raw':_0x291811[_0xa54e('0x10')]?_0x291811[_0xa54e('0x10')][_0xa54e('0x11')]===undefined?!![]:![]:!![],'where':_0x291811[_0xa54e('0x10')]?_0x291811['options'][_0xa54e('0x12')]||null:null,'attributes':_0x291811[_0xa54e('0x10')]?_0x291811[_0xa54e('0x10')][_0xa54e('0x13')]||null:null,'include':_0x291811[_0xa54e('0x10')]?_0x291811[_0xa54e('0x10')][_0xa54e('0x15')]?_[_0xa54e('0x16')](_0x291811[_0xa54e('0x10')][_0xa54e('0x15')],function(_0x3f7daa){return{'model':db[_0x3f7daa['model']],'as':_0x3f7daa['as'],'attributes':_0x3f7daa[_0xa54e('0x13')],'include':_0x3f7daa[_0xa54e('0x15')]?_[_0xa54e('0x16')](_0x3f7daa[_0xa54e('0x15')],function(_0x56aea2){return{'model':db[_0x56aea2[_0xa54e('0x17')]],'as':_0x56aea2['as'],'attributes':_0x56aea2['attributes'],'include':_0x56aea2[_0xa54e('0x15')]?_[_0xa54e('0x16')](_0x56aea2[_0xa54e('0x15')],function(_0x18d805){return{'model':db[_0x18d805[_0xa54e('0x17')]],'as':_0x18d805['as'],'attributes':_0x18d805['attributes']};}):[]};}):[]};}):[]:[]})[_0xa54e('0x1e')](function(_0x28a930){logger[_0xa54e('0x1f')](_0xa54e('0x1c'),_0x291811);logger['debug'](_0xa54e('0x1c'),_0x291811,JSON[_0xa54e('0x1a')](_0x28a930));_0x22a838(_0x28a930);})[_0xa54e('0x1b')](function(_0x11ba51){logger[_0xa54e('0xd')](_0xa54e('0x1c'),_0x11ba51['message'],_0x291811);_0x265b23(_0x14fa64[_0xa54e('0xd')](0x1f4,_0x11ba51['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 474d668..7066fe0 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 _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x32859c,_0x44b776){_0x32859c=_0x32859c-0x0;var _0x2c8003=_0x9ffd[_0x32859c];return _0x2c8003;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x1db63a,_0x4a2df2){var _0xf1572c=function(_0x57b982){while(--_0x57b982){_0x1db63a['push'](_0x1db63a['shift']());}};_0xf1572c(++_0x4a2df2);}(_0xb10b,0x12a));var _0xbb10=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0xb10b[_0x10c778];return _0x4e9fb2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a536621..55725d2 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 _0x1a30=['STRING'];(function(_0x4ae5e4,_0x101e79){var _0x46ba7b=function(_0x3c8b75){while(--_0x3c8b75){_0x4ae5e4['push'](_0x4ae5e4['shift']());}};_0x46ba7b(++_0x101e79);}(_0x1a30,0x13f));var _0x01a3=function(_0x47233b,_0xd06c5c){_0x47233b=_0x47233b-0x0;var _0x40f1ef=_0x1a30[_0x47233b];return _0x40f1ef;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x01a3('0x0')]},'description':{'type':Sequelize[_0x01a3('0x0')]}}; \ No newline at end of file +var _0x12f0=['STRING'];(function(_0x1fe560,_0x2885de){var _0x364bdd=function(_0x1deae7){while(--_0x1deae7){_0x1fe560['push'](_0x1fe560['shift']());}};_0x364bdd(++_0x2885de);}(_0x12f0,0x1b8));var _0x012f=function(_0x548546,_0x44ccc4){_0x548546=_0x548546-0x0;var _0x11e915=_0x12f0[_0x548546];return _0x11e915;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x012f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5e79524..d1ea6f5 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 _0x9747=['order','sort','where','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','ZendeskField','filter','getSubjects','pick','getDescriptions','findOne','getTags','setTags','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit'];(function(_0x1a9480,_0x5dbd95){var _0x4ee360=function(_0x202fde){while(--_0x202fde){_0x1a9480['push'](_0x1a9480['shift']());}};_0x4ee360(++_0x5dbd95);}(_0x9747,0x15d));var _0x7974=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9747[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7974('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7974('0x1'));var rp=require(_0x7974('0x2'));var moment=require(_0x7974('0x3'));var BPromise=require(_0x7974('0x4'));var Mustache=require(_0x7974('0x5'));var util=require(_0x7974('0x6'));var path=require(_0x7974('0x7'));var sox=require('sox');var csv=require(_0x7974('0x8'));var ejs=require(_0x7974('0x9'));var fs=require('fs');var fs_extra=require(_0x7974('0xa'));var _=require(_0x7974('0xb'));var squel=require('squel');var crypto=require(_0x7974('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7974('0x8'));var querystring=require(_0x7974('0xd'));var Papa=require(_0x7974('0xe'));var Redis=require(_0x7974('0xf'));var authService=require(_0x7974('0x10'));var qs=require(_0x7974('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7974('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x7974('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7974('0x14'));var db=require(_0x7974('0x15'))['db'];function respondWithStatusCode(_0x21f45f,_0x54637c){_0x54637c=_0x54637c||0xcc;return function(_0x393b51){if(_0x393b51){return _0x21f45f[_0x7974('0x16')](_0x54637c);}return _0x21f45f[_0x7974('0x17')](_0x54637c)['end']();};}function respondWithResult(_0x5d7c13,_0x2108df){_0x2108df=_0x2108df||0xc8;return function(_0x392f31){if(_0x392f31){return _0x5d7c13[_0x7974('0x17')](_0x2108df)[_0x7974('0x18')](_0x392f31);}};}function respondWithFilteredResult(_0x4cab31,_0x2ded69){return function(_0x4ecb44){if(_0x4ecb44){var _0x538ef4=typeof _0x2ded69['offset']===_0x7974('0x19')&&typeof _0x2ded69[_0x7974('0x1a')]===_0x7974('0x19');var _0x2fdd30=_0x4ecb44['count'];var _0x3c2857=_0x538ef4?0x0:_0x2ded69['offset'];var _0x4dd09e=_0x538ef4?_0x4ecb44[_0x7974('0x1b')]:_0x2ded69[_0x7974('0x1c')]+_0x2ded69[_0x7974('0x1a')];var _0x72af88;if(_0x4dd09e>=_0x2fdd30){_0x4dd09e=_0x2fdd30;_0x72af88=0xc8;}else{_0x72af88=0xce;}_0x4cab31[_0x7974('0x17')](_0x72af88);return _0x4cab31[_0x7974('0x1d')](_0x7974('0x1e'),_0x3c2857+'-'+_0x4dd09e+'/'+_0x2fdd30)[_0x7974('0x18')](_0x4ecb44);}return null;};}function patchUpdates(_0x3be230){return function(_0x28b8f1){try{jsonpatch[_0x7974('0x1f')](_0x28b8f1,_0x3be230,!![]);}catch(_0xbd6d35){return BPromise[_0x7974('0x20')](_0xbd6d35);}return _0x28b8f1['save']();};}function saveUpdates(_0x3f2629,_0x4d4c62){return function(_0x4ccafe){if(_0x4ccafe){return _0x4ccafe[_0x7974('0x21')](_0x3f2629)[_0x7974('0x22')](function(_0xf1d5a9){return _0xf1d5a9;});}return null;};}function removeEntity(_0x4dcda4,_0x35a098){return function(_0x3e5f62){if(_0x3e5f62){return _0x3e5f62[_0x7974('0x23')]()[_0x7974('0x22')](function(){_0x4dcda4[_0x7974('0x17')](0xcc)[_0x7974('0x24')]();});}};}function handleEntityNotFound(_0x22851c,_0x15d72a){return function(_0x281473){if(!_0x281473){_0x22851c[_0x7974('0x16')](0x194);}return _0x281473;};}function handleError(_0x306499,_0x53b49e){_0x53b49e=_0x53b49e||0x1f4;return function(_0x401864){logger[_0x7974('0x25')](_0x401864['stack']);if(_0x401864[_0x7974('0x26')]){delete _0x401864[_0x7974('0x26')];}_0x306499[_0x7974('0x17')](_0x53b49e)[_0x7974('0x27')](_0x401864);};}exports[_0x7974('0x28')]=function(_0x4f744a,_0x36d78e){var _0x2b0736={},_0x338956={},_0x2aa8f9={'count':0x0,'rows':[]};var _0x41de48=_['map'](db[_0x7974('0x29')][_0x7974('0x2a')],function(_0xf665da){return{'name':_0xf665da[_0x7974('0x2b')],'type':_0xf665da['type'][_0x7974('0x2c')]};});_0x338956['model']=_[_0x7974('0x2d')](_0x41de48,_0x7974('0x26'));_0x338956[_0x7974('0x2e')]=_[_0x7974('0x2f')](_0x4f744a['query']);_0x338956[_0x7974('0x30')]=_['intersection'](_0x338956['model'],_0x338956[_0x7974('0x2e')]);_0x2b0736[_0x7974('0x31')]=_[_0x7974('0x32')](_0x338956[_0x7974('0x33')],qs[_0x7974('0x34')](_0x4f744a[_0x7974('0x2e')][_0x7974('0x34')]));_0x2b0736[_0x7974('0x31')]=_0x2b0736[_0x7974('0x31')][_0x7974('0x35')]?_0x2b0736[_0x7974('0x31')]:_0x338956[_0x7974('0x33')];if(!_0x4f744a[_0x7974('0x2e')][_0x7974('0x36')](_0x7974('0x37'))){_0x2b0736[_0x7974('0x1a')]=qs[_0x7974('0x1a')](_0x4f744a['query'][_0x7974('0x1a')]);_0x2b0736[_0x7974('0x1c')]=qs[_0x7974('0x1c')](_0x4f744a[_0x7974('0x2e')][_0x7974('0x1c')]);}_0x2b0736[_0x7974('0x38')]=qs['sort'](_0x4f744a[_0x7974('0x2e')][_0x7974('0x39')]);_0x2b0736[_0x7974('0x3a')]=qs['filters'](_['pick'](_0x4f744a[_0x7974('0x2e')],_0x338956[_0x7974('0x30')]),_0x41de48);if(_0x4f744a['query']['filter']){_0x2b0736[_0x7974('0x3a')]=_[_0x7974('0x3b')](_0x2b0736[_0x7974('0x3a')],{'$or':_[_0x7974('0x2d')](_0x41de48,function(_0x1efbc7){if(_0x1efbc7[_0x7974('0x3c')]!=='VIRTUAL'){var _0x38f3a6={};_0x38f3a6[_0x1efbc7[_0x7974('0x26')]]={'$like':'%'+_0x4f744a[_0x7974('0x2e')]['filter']+'%'};return _0x38f3a6;}})});}_0x2b0736=_[_0x7974('0x3b')]({},_0x2b0736,_0x4f744a[_0x7974('0x3d')]);var _0x1270af={'where':_0x2b0736['where']};return db[_0x7974('0x29')][_0x7974('0x1b')](_0x1270af)[_0x7974('0x22')](function(_0x2d546d){_0x2aa8f9['count']=_0x2d546d;if(_0x4f744a[_0x7974('0x2e')][_0x7974('0x3e')]){_0x2b0736['include']=[{'all':!![]}];}return db[_0x7974('0x29')][_0x7974('0x3f')](_0x2b0736);})[_0x7974('0x22')](function(_0x5f47bb){_0x2aa8f9[_0x7974('0x40')]=_0x5f47bb;return _0x2aa8f9;})['then'](respondWithFilteredResult(_0x36d78e,_0x2b0736))[_0x7974('0x41')](handleError(_0x36d78e,null));};exports[_0x7974('0x42')]=function(_0x43399d,_0x351c83){var _0xa084c6={'raw':![],'where':{'id':_0x43399d[_0x7974('0x43')]['id']}},_0x412ca0={};_0x412ca0['model']=_[_0x7974('0x2f')](db[_0x7974('0x29')][_0x7974('0x2a')]);_0x412ca0[_0x7974('0x2e')]=_[_0x7974('0x2f')](_0x43399d[_0x7974('0x2e')]);_0x412ca0['filters']=_['intersection'](_0x412ca0[_0x7974('0x33')],_0x412ca0[_0x7974('0x2e')]);_0xa084c6['attributes']=_['intersection'](_0x412ca0[_0x7974('0x33')],qs[_0x7974('0x34')](_0x43399d[_0x7974('0x2e')][_0x7974('0x34')]));_0xa084c6[_0x7974('0x31')]=_0xa084c6['attributes']['length']?_0xa084c6[_0x7974('0x31')]:_0x412ca0['model'];if(_0x43399d['query'][_0x7974('0x3e')]){_0xa084c6[_0x7974('0x44')]=[{'all':!![]}];}_0xa084c6=_[_0x7974('0x3b')]({},_0xa084c6,_0x43399d[_0x7974('0x3d')]);return db[_0x7974('0x29')][_0x7974('0x45')](_0xa084c6)[_0x7974('0x22')](handleEntityNotFound(_0x351c83,null))[_0x7974('0x22')](respondWithResult(_0x351c83,null))[_0x7974('0x41')](handleError(_0x351c83,null));};exports['create']=function(_0x43c64b,_0x2d168c){return db['ZendeskConfiguration'][_0x7974('0x46')](_0x43c64b['body'],{})[_0x7974('0x22')](respondWithResult(_0x2d168c,0xc9))[_0x7974('0x41')](handleError(_0x2d168c,null));};exports[_0x7974('0x21')]=function(_0x395232,_0x242789){if(_0x395232[_0x7974('0x47')]['id']){delete _0x395232[_0x7974('0x47')]['id'];}return db[_0x7974('0x29')][_0x7974('0x45')]({'where':{'id':_0x395232['params']['id']}})[_0x7974('0x22')](handleEntityNotFound(_0x242789,null))['then'](saveUpdates(_0x395232[_0x7974('0x47')],null))['then'](respondWithResult(_0x242789,null))[_0x7974('0x41')](handleError(_0x242789,null));};exports[_0x7974('0x23')]=function(_0x4d97d3,_0x22ff33){return db[_0x7974('0x29')]['find']({'where':{'id':_0x4d97d3[_0x7974('0x43')]['id']}})[_0x7974('0x22')](handleEntityNotFound(_0x22ff33,null))[_0x7974('0x22')](removeEntity(_0x22ff33,null))[_0x7974('0x41')](handleError(_0x22ff33,null));};exports[_0x7974('0x48')]=function(_0x4d4ef1,_0xd102cb,_0x14835f){var _0x4fcc72={};var _0x4285c1={};var _0x24e827;var _0x5345fb;return db[_0x7974('0x29')]['findOne']({'where':{'id':_0x4d4ef1[_0x7974('0x43')]['id']}})[_0x7974('0x22')](handleEntityNotFound(_0xd102cb,null))['then'](function(_0x2dfeed){if(_0x2dfeed){_0x24e827=_0x2dfeed;_0x4285c1[_0x7974('0x33')]=_[_0x7974('0x2f')](db[_0x7974('0x49')][_0x7974('0x2a')]);_0x4285c1[_0x7974('0x2e')]=_[_0x7974('0x2f')](_0x4d4ef1[_0x7974('0x2e')]);_0x4285c1[_0x7974('0x30')]=_['intersection'](_0x4285c1['model'],_0x4285c1['query']);_0x4fcc72['attributes']=_['intersection'](_0x4285c1['model'],qs['fields'](_0x4d4ef1[_0x7974('0x2e')][_0x7974('0x34')]));_0x4fcc72[_0x7974('0x31')]=_0x4fcc72[_0x7974('0x31')][_0x7974('0x35')]?_0x4fcc72[_0x7974('0x31')]:_0x4285c1[_0x7974('0x33')];_0x4fcc72[_0x7974('0x38')]=qs[_0x7974('0x39')](_0x4d4ef1[_0x7974('0x2e')]['sort']);_0x4fcc72['where']=qs[_0x7974('0x30')](_['pick'](_0x4d4ef1[_0x7974('0x2e')],_0x4285c1[_0x7974('0x30')]));if(_0x4d4ef1[_0x7974('0x2e')][_0x7974('0x4a')]){_0x4fcc72['where']=_[_0x7974('0x3b')](_0x4fcc72[_0x7974('0x3a')],{'$or':_[_0x7974('0x2d')](_0x4fcc72['attributes'],function(_0x20cf05){var _0x4e745f={};_0x4e745f[_0x20cf05]={'$like':'%'+_0x4d4ef1[_0x7974('0x2e')][_0x7974('0x4a')]+'%'};return _0x4e745f;})});}_0x4fcc72=_[_0x7974('0x3b')]({},_0x4fcc72,_0x4d4ef1[_0x7974('0x3d')]);return _0x24e827[_0x7974('0x48')](_0x4fcc72);}})[_0x7974('0x22')](function(_0x57130d){if(_0x57130d){_0x5345fb=_0x57130d[_0x7974('0x35')];if(!_0x4d4ef1[_0x7974('0x2e')][_0x7974('0x36')](_0x7974('0x37'))){_0x4fcc72[_0x7974('0x1a')]=qs[_0x7974('0x1a')](_0x4d4ef1[_0x7974('0x2e')][_0x7974('0x1a')]);_0x4fcc72[_0x7974('0x1c')]=qs[_0x7974('0x1c')](_0x4d4ef1[_0x7974('0x2e')]['offset']);}return _0x24e827[_0x7974('0x48')](_0x4fcc72);}})[_0x7974('0x22')](function(_0x5a2c90){if(_0x5a2c90){return _0x5a2c90?{'count':_0x5345fb,'rows':_0x5a2c90}:null;}})[_0x7974('0x22')](respondWithResult(_0xd102cb,null))[_0x7974('0x41')](handleError(_0xd102cb,null));};exports[_0x7974('0x4b')]=function(_0x9fbd66,_0x500781,_0x5319d7){var _0x1680e5={};var _0x437493={};var _0x3d8c24;var _0x16f367;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x9fbd66[_0x7974('0x43')]['id']}})[_0x7974('0x22')](handleEntityNotFound(_0x500781,null))['then'](function(_0x2c6b65){if(_0x2c6b65){_0x3d8c24=_0x2c6b65;_0x437493[_0x7974('0x33')]=_[_0x7974('0x2f')](db[_0x7974('0x49')][_0x7974('0x2a')]);_0x437493[_0x7974('0x2e')]=_[_0x7974('0x2f')](_0x9fbd66['query']);_0x437493[_0x7974('0x30')]=_[_0x7974('0x32')](_0x437493[_0x7974('0x33')],_0x437493[_0x7974('0x2e')]);_0x1680e5[_0x7974('0x31')]=_['intersection'](_0x437493[_0x7974('0x33')],qs[_0x7974('0x34')](_0x9fbd66[_0x7974('0x2e')][_0x7974('0x34')]));_0x1680e5[_0x7974('0x31')]=_0x1680e5[_0x7974('0x31')][_0x7974('0x35')]?_0x1680e5[_0x7974('0x31')]:_0x437493[_0x7974('0x33')];_0x1680e5[_0x7974('0x38')]=qs[_0x7974('0x39')](_0x9fbd66['query'][_0x7974('0x39')]);_0x1680e5['where']=qs['filters'](_[_0x7974('0x4c')](_0x9fbd66['query'],_0x437493['filters']));if(_0x9fbd66[_0x7974('0x2e')][_0x7974('0x4a')]){_0x1680e5[_0x7974('0x3a')]=_['merge'](_0x1680e5['where'],{'$or':_[_0x7974('0x2d')](_0x1680e5[_0x7974('0x31')],function(_0x25a9dc){var _0xee1d1e={};_0xee1d1e[_0x25a9dc]={'$like':'%'+_0x9fbd66[_0x7974('0x2e')][_0x7974('0x4a')]+'%'};return _0xee1d1e;})});}_0x1680e5=_[_0x7974('0x3b')]({},_0x1680e5,_0x9fbd66[_0x7974('0x3d')]);return _0x3d8c24['getSubjects'](_0x1680e5);}})[_0x7974('0x22')](function(_0x5ccd48){if(_0x5ccd48){_0x16f367=_0x5ccd48[_0x7974('0x35')];if(!_0x9fbd66[_0x7974('0x2e')][_0x7974('0x36')](_0x7974('0x37'))){_0x1680e5[_0x7974('0x1a')]=qs[_0x7974('0x1a')](_0x9fbd66['query']['limit']);_0x1680e5[_0x7974('0x1c')]=qs[_0x7974('0x1c')](_0x9fbd66[_0x7974('0x2e')]['offset']);}return _0x3d8c24['getSubjects'](_0x1680e5);}})[_0x7974('0x22')](function(_0x3cb713){if(_0x3cb713){return _0x3cb713?{'count':_0x16f367,'rows':_0x3cb713}:null;}})[_0x7974('0x22')](respondWithResult(_0x500781,null))[_0x7974('0x41')](handleError(_0x500781,null));};exports[_0x7974('0x4d')]=function(_0x5641d3,_0x3b2d1f,_0x12d30d){var _0x261e5c={};var _0x1c6a42={};var _0x292958;var _0x2f05a9;return db[_0x7974('0x29')][_0x7974('0x4e')]({'where':{'id':_0x5641d3[_0x7974('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b2d1f,null))['then'](function(_0x9d1569){if(_0x9d1569){_0x292958=_0x9d1569;_0x1c6a42[_0x7974('0x33')]=_[_0x7974('0x2f')](db[_0x7974('0x49')][_0x7974('0x2a')]);_0x1c6a42['query']=_[_0x7974('0x2f')](_0x5641d3['query']);_0x1c6a42['filters']=_[_0x7974('0x32')](_0x1c6a42[_0x7974('0x33')],_0x1c6a42[_0x7974('0x2e')]);_0x261e5c[_0x7974('0x31')]=_['intersection'](_0x1c6a42[_0x7974('0x33')],qs[_0x7974('0x34')](_0x5641d3[_0x7974('0x2e')][_0x7974('0x34')]));_0x261e5c['attributes']=_0x261e5c['attributes'][_0x7974('0x35')]?_0x261e5c['attributes']:_0x1c6a42[_0x7974('0x33')];_0x261e5c[_0x7974('0x38')]=qs[_0x7974('0x39')](_0x5641d3[_0x7974('0x2e')]['sort']);_0x261e5c[_0x7974('0x3a')]=qs[_0x7974('0x30')](_[_0x7974('0x4c')](_0x5641d3[_0x7974('0x2e')],_0x1c6a42[_0x7974('0x30')]));if(_0x5641d3[_0x7974('0x2e')][_0x7974('0x4a')]){_0x261e5c[_0x7974('0x3a')]=_[_0x7974('0x3b')](_0x261e5c['where'],{'$or':_[_0x7974('0x2d')](_0x261e5c[_0x7974('0x31')],function(_0x4fed3d){var _0x2786da={};_0x2786da[_0x4fed3d]={'$like':'%'+_0x5641d3[_0x7974('0x2e')][_0x7974('0x4a')]+'%'};return _0x2786da;})});}_0x261e5c=_['merge']({},_0x261e5c,_0x5641d3[_0x7974('0x3d')]);return _0x292958[_0x7974('0x4d')](_0x261e5c);}})[_0x7974('0x22')](function(_0x3aff0b){if(_0x3aff0b){_0x2f05a9=_0x3aff0b[_0x7974('0x35')];if(!_0x5641d3[_0x7974('0x2e')][_0x7974('0x36')](_0x7974('0x37'))){_0x261e5c[_0x7974('0x1a')]=qs['limit'](_0x5641d3[_0x7974('0x2e')]['limit']);_0x261e5c[_0x7974('0x1c')]=qs[_0x7974('0x1c')](_0x5641d3['query']['offset']);}return _0x292958[_0x7974('0x4d')](_0x261e5c);}})[_0x7974('0x22')](function(_0x5e2645){if(_0x5e2645){return _0x5e2645?{'count':_0x2f05a9,'rows':_0x5e2645}:null;}})[_0x7974('0x22')](respondWithResult(_0x3b2d1f,null))[_0x7974('0x41')](handleError(_0x3b2d1f,null));};exports[_0x7974('0x4f')]=function(_0x29c18c,_0x388c8f,_0x4cd56f){var _0x2d436b={};var _0xbb630d={};var _0x43d8ac;var _0x180e47;return db[_0x7974('0x29')]['findOne']({'where':{'id':_0x29c18c[_0x7974('0x43')]['id']}})['then'](handleEntityNotFound(_0x388c8f,null))['then'](function(_0x2edada){if(_0x2edada){_0x43d8ac=_0x2edada;_0xbb630d[_0x7974('0x33')]=_[_0x7974('0x2f')](db['Tag']['rawAttributes']);_0xbb630d[_0x7974('0x2e')]=_[_0x7974('0x2f')](_0x29c18c[_0x7974('0x2e')]);_0xbb630d[_0x7974('0x30')]=_[_0x7974('0x32')](_0xbb630d[_0x7974('0x33')],_0xbb630d[_0x7974('0x2e')]);_0x2d436b[_0x7974('0x31')]=_[_0x7974('0x32')](_0xbb630d[_0x7974('0x33')],qs[_0x7974('0x34')](_0x29c18c['query'][_0x7974('0x34')]));_0x2d436b[_0x7974('0x31')]=_0x2d436b[_0x7974('0x31')]['length']?_0x2d436b[_0x7974('0x31')]:_0xbb630d[_0x7974('0x33')];_0x2d436b['order']=qs['sort'](_0x29c18c[_0x7974('0x2e')]['sort']);_0x2d436b[_0x7974('0x3a')]=qs[_0x7974('0x30')](_[_0x7974('0x4c')](_0x29c18c[_0x7974('0x2e')],_0xbb630d[_0x7974('0x30')]));if(_0x29c18c[_0x7974('0x2e')][_0x7974('0x4a')]){_0x2d436b[_0x7974('0x3a')]=_[_0x7974('0x3b')](_0x2d436b[_0x7974('0x3a')],{'$or':_[_0x7974('0x2d')](_0x2d436b['attributes'],function(_0x33517d){var _0x2727e1={};_0x2727e1[_0x33517d]={'$like':'%'+_0x29c18c['query'][_0x7974('0x4a')]+'%'};return _0x2727e1;})});}_0x2d436b=_['merge']({},_0x2d436b,_0x29c18c['options']);return _0x43d8ac[_0x7974('0x4f')](_0x2d436b);}})[_0x7974('0x22')](function(_0x55e00b){if(_0x55e00b){_0x180e47=_0x55e00b['length'];if(!_0x29c18c[_0x7974('0x2e')]['hasOwnProperty'](_0x7974('0x37'))){_0x2d436b[_0x7974('0x1a')]=qs[_0x7974('0x1a')](_0x29c18c[_0x7974('0x2e')][_0x7974('0x1a')]);_0x2d436b[_0x7974('0x1c')]=qs[_0x7974('0x1c')](_0x29c18c[_0x7974('0x2e')][_0x7974('0x1c')]);}return _0x43d8ac[_0x7974('0x4f')](_0x2d436b);}})[_0x7974('0x22')](function(_0x14a613){if(_0x14a613){return _0x14a613?{'count':_0x180e47,'rows':_0x14a613}:null;}})[_0x7974('0x22')](respondWithResult(_0x388c8f,null))[_0x7974('0x41')](handleError(_0x388c8f,null));};exports[_0x7974('0x50')]=function(_0x55e347,_0x3c2863,_0xa402af){if(_0x55e347[_0x7974('0x47')]['id']){delete _0x55e347[_0x7974('0x47')]['id'];}return db[_0x7974('0x29')]['findOne']({'where':{'id':_0x55e347[_0x7974('0x43')]['id']}})[_0x7974('0x22')](handleEntityNotFound(_0x3c2863,null))[_0x7974('0x22')](function(_0x183ba6){if(_0x183ba6){return _0x183ba6[_0x7974('0x50')](_0x55e347[_0x7974('0x47')]['ids']||[]);}return null;})[_0x7974('0x22')](respondWithResult(_0x3c2863,null))[_0x7974('0x41')](handleError(_0x3c2863,null));}; \ No newline at end of file +var _0xd566=['fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','findAll','show','params','include','catch','create','body','find','getFields','findOne','ZendeskField','order','filter','getSubjects','length','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x3ed4d8,_0x4869c1){var _0x57bacd=function(_0x39596c){while(--_0x39596c){_0x3ed4d8['push'](_0x3ed4d8['shift']());}};_0x57bacd(++_0x4869c1);}(_0xd566,0x138));var _0x6d56=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd566[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d56('0x0'));var zipdir=require(_0x6d56('0x1'));var jsonpatch=require(_0x6d56('0x2'));var rp=require(_0x6d56('0x3'));var moment=require(_0x6d56('0x4'));var BPromise=require(_0x6d56('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6d56('0x6'));var sox=require(_0x6d56('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d56('0x8'));var _=require('lodash');var squel=require(_0x6d56('0x9'));var crypto=require(_0x6d56('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6d56('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6d56('0xc'));var Papa=require(_0x6d56('0xd'));var Redis=require(_0x6d56('0xe'));var authService=require(_0x6d56('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6d56('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d56('0x11'))(_0x6d56('0x12'));var utils=require(_0x6d56('0x13'));var config=require(_0x6d56('0x14'));var licenseUtil=require(_0x6d56('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cbd77,_0x1cacb9){_0x1cacb9=_0x1cacb9||0xcc;return function(_0x37a668){if(_0x37a668){return _0x2cbd77['sendStatus'](_0x1cacb9);}return _0x2cbd77[_0x6d56('0x16')](_0x1cacb9)['end']();};}function respondWithResult(_0x51149d,_0x2cc36c){_0x2cc36c=_0x2cc36c||0xc8;return function(_0x4855b5){if(_0x4855b5){return _0x51149d[_0x6d56('0x16')](_0x2cc36c)[_0x6d56('0x17')](_0x4855b5);}};}function respondWithFilteredResult(_0xf91526,_0x27503c){return function(_0x1ed68d){if(_0x1ed68d){var _0x5c6aea=typeof _0x27503c[_0x6d56('0x18')]==='undefined'&&typeof _0x27503c[_0x6d56('0x19')]===_0x6d56('0x1a');var _0x4b2307=_0x1ed68d[_0x6d56('0x1b')];var _0x43543b=_0x5c6aea?0x0:_0x27503c['offset'];var _0x32d80a=_0x5c6aea?_0x1ed68d['count']:_0x27503c[_0x6d56('0x18')]+_0x27503c[_0x6d56('0x19')];var _0x236099;if(_0x32d80a>=_0x4b2307){_0x32d80a=_0x4b2307;_0x236099=0xc8;}else{_0x236099=0xce;}_0xf91526['status'](_0x236099);return _0xf91526[_0x6d56('0x1c')]('Content-Range',_0x43543b+'-'+_0x32d80a+'/'+_0x4b2307)[_0x6d56('0x17')](_0x1ed68d);}return null;};}function patchUpdates(_0x245c2e){return function(_0x599771){try{jsonpatch[_0x6d56('0x1d')](_0x599771,_0x245c2e,!![]);}catch(_0x462334){return BPromise[_0x6d56('0x1e')](_0x462334);}return _0x599771[_0x6d56('0x1f')]();};}function saveUpdates(_0x524d93,_0x5d1a02){return function(_0x4c6e23){if(_0x4c6e23){return _0x4c6e23[_0x6d56('0x20')](_0x524d93)[_0x6d56('0x21')](function(_0x5bbb67){return _0x5bbb67;});}return null;};}function removeEntity(_0x41cbf6,_0x59e46c){return function(_0x3cec32){if(_0x3cec32){return _0x3cec32[_0x6d56('0x22')]()[_0x6d56('0x21')](function(){_0x41cbf6[_0x6d56('0x16')](0xcc)[_0x6d56('0x23')]();});}};}function handleEntityNotFound(_0x2e65bb,_0x47ebdf){return function(_0x1951c5){if(!_0x1951c5){_0x2e65bb[_0x6d56('0x24')](0x194);}return _0x1951c5;};}function handleError(_0x16ccf0,_0x560911){_0x560911=_0x560911||0x1f4;return function(_0x3112a5){logger['error'](_0x3112a5[_0x6d56('0x25')]);if(_0x3112a5[_0x6d56('0x26')]){delete _0x3112a5[_0x6d56('0x26')];}_0x16ccf0['status'](_0x560911)[_0x6d56('0x27')](_0x3112a5);};}exports['index']=function(_0x5dfeb6,_0x250644){var _0x4b151c={},_0x308859={},_0xd424ad={'count':0x0,'rows':[]};var _0x2ddb4a=_[_0x6d56('0x28')](db['ZendeskConfiguration'][_0x6d56('0x29')],function(_0x47454a){return{'name':_0x47454a[_0x6d56('0x2a')],'type':_0x47454a[_0x6d56('0x2b')]['key']};});_0x308859[_0x6d56('0x2c')]=_[_0x6d56('0x28')](_0x2ddb4a,'name');_0x308859['query']=_[_0x6d56('0x2d')](_0x5dfeb6['query']);_0x308859[_0x6d56('0x2e')]=_[_0x6d56('0x2f')](_0x308859[_0x6d56('0x2c')],_0x308859['query']);_0x4b151c[_0x6d56('0x30')]=_[_0x6d56('0x2f')](_0x308859[_0x6d56('0x2c')],qs[_0x6d56('0x31')](_0x5dfeb6[_0x6d56('0x32')]['fields']));_0x4b151c[_0x6d56('0x30')]=_0x4b151c[_0x6d56('0x30')]['length']?_0x4b151c[_0x6d56('0x30')]:_0x308859[_0x6d56('0x2c')];if(!_0x5dfeb6['query'][_0x6d56('0x33')](_0x6d56('0x34'))){_0x4b151c[_0x6d56('0x19')]=qs[_0x6d56('0x19')](_0x5dfeb6[_0x6d56('0x32')][_0x6d56('0x19')]);_0x4b151c[_0x6d56('0x18')]=qs[_0x6d56('0x18')](_0x5dfeb6[_0x6d56('0x32')][_0x6d56('0x18')]);}_0x4b151c['order']=qs[_0x6d56('0x35')](_0x5dfeb6[_0x6d56('0x32')][_0x6d56('0x35')]);_0x4b151c['where']=qs[_0x6d56('0x2e')](_[_0x6d56('0x36')](_0x5dfeb6['query'],_0x308859['filters']),_0x2ddb4a);if(_0x5dfeb6['query']['filter']){_0x4b151c[_0x6d56('0x37')]=_[_0x6d56('0x38')](_0x4b151c[_0x6d56('0x37')],{'$or':_[_0x6d56('0x28')](_0x2ddb4a,function(_0x1db55a){if(_0x1db55a['type']!==_0x6d56('0x39')){var _0x460b92={};_0x460b92[_0x1db55a['name']]={'$like':'%'+_0x5dfeb6[_0x6d56('0x32')]['filter']+'%'};return _0x460b92;}})});}_0x4b151c=_[_0x6d56('0x38')]({},_0x4b151c,_0x5dfeb6[_0x6d56('0x3a')]);var _0x37041e={'where':_0x4b151c[_0x6d56('0x37')]};return db[_0x6d56('0x3b')][_0x6d56('0x1b')](_0x37041e)[_0x6d56('0x21')](function(_0x2d901c){_0xd424ad[_0x6d56('0x1b')]=_0x2d901c;if(_0x5dfeb6['query'][_0x6d56('0x3c')]){_0x4b151c['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x6d56('0x3d')](_0x4b151c);})[_0x6d56('0x21')](function(_0x3cb49e){_0xd424ad['rows']=_0x3cb49e;return _0xd424ad;})[_0x6d56('0x21')](respondWithFilteredResult(_0x250644,_0x4b151c))['catch'](handleError(_0x250644,null));};exports[_0x6d56('0x3e')]=function(_0x46090b,_0x5bdace){var _0xf06403={'raw':![],'where':{'id':_0x46090b[_0x6d56('0x3f')]['id']}},_0x2bb2f3={};_0x2bb2f3[_0x6d56('0x2c')]=_['keys'](db[_0x6d56('0x3b')]['rawAttributes']);_0x2bb2f3['query']=_['keys'](_0x46090b[_0x6d56('0x32')]);_0x2bb2f3[_0x6d56('0x2e')]=_[_0x6d56('0x2f')](_0x2bb2f3[_0x6d56('0x2c')],_0x2bb2f3['query']);_0xf06403['attributes']=_[_0x6d56('0x2f')](_0x2bb2f3[_0x6d56('0x2c')],qs[_0x6d56('0x31')](_0x46090b[_0x6d56('0x32')]['fields']));_0xf06403['attributes']=_0xf06403[_0x6d56('0x30')]['length']?_0xf06403['attributes']:_0x2bb2f3[_0x6d56('0x2c')];if(_0x46090b[_0x6d56('0x32')]['includeAll']){_0xf06403[_0x6d56('0x40')]=[{'all':!![]}];}_0xf06403=_[_0x6d56('0x38')]({},_0xf06403,_0x46090b[_0x6d56('0x3a')]);return db[_0x6d56('0x3b')]['find'](_0xf06403)[_0x6d56('0x21')](handleEntityNotFound(_0x5bdace,null))[_0x6d56('0x21')](respondWithResult(_0x5bdace,null))[_0x6d56('0x41')](handleError(_0x5bdace,null));};exports[_0x6d56('0x42')]=function(_0x28179e,_0x4a1483){return db[_0x6d56('0x3b')][_0x6d56('0x42')](_0x28179e[_0x6d56('0x43')],{})[_0x6d56('0x21')](respondWithResult(_0x4a1483,0xc9))[_0x6d56('0x41')](handleError(_0x4a1483,null));};exports[_0x6d56('0x20')]=function(_0x4b7ea6,_0x1fe5d0){if(_0x4b7ea6['body']['id']){delete _0x4b7ea6[_0x6d56('0x43')]['id'];}return db[_0x6d56('0x3b')][_0x6d56('0x44')]({'where':{'id':_0x4b7ea6[_0x6d56('0x3f')]['id']}})[_0x6d56('0x21')](handleEntityNotFound(_0x1fe5d0,null))[_0x6d56('0x21')](saveUpdates(_0x4b7ea6[_0x6d56('0x43')],null))[_0x6d56('0x21')](respondWithResult(_0x1fe5d0,null))['catch'](handleError(_0x1fe5d0,null));};exports[_0x6d56('0x22')]=function(_0x459d06,_0x1cf221){return db[_0x6d56('0x3b')][_0x6d56('0x44')]({'where':{'id':_0x459d06['params']['id']}})[_0x6d56('0x21')](handleEntityNotFound(_0x1cf221,null))[_0x6d56('0x21')](removeEntity(_0x1cf221,null))[_0x6d56('0x41')](handleError(_0x1cf221,null));};exports[_0x6d56('0x45')]=function(_0x5f1a77,_0x4b0664,_0x478b4b){var _0x1f866d={};var _0x339b7a={};var _0x4296a4;var _0x476996;return db[_0x6d56('0x3b')][_0x6d56('0x46')]({'where':{'id':_0x5f1a77[_0x6d56('0x3f')]['id']}})[_0x6d56('0x21')](handleEntityNotFound(_0x4b0664,null))[_0x6d56('0x21')](function(_0x176937){if(_0x176937){_0x4296a4=_0x176937;_0x339b7a['model']=_[_0x6d56('0x2d')](db[_0x6d56('0x47')][_0x6d56('0x29')]);_0x339b7a['query']=_[_0x6d56('0x2d')](_0x5f1a77['query']);_0x339b7a[_0x6d56('0x2e')]=_[_0x6d56('0x2f')](_0x339b7a[_0x6d56('0x2c')],_0x339b7a[_0x6d56('0x32')]);_0x1f866d['attributes']=_[_0x6d56('0x2f')](_0x339b7a[_0x6d56('0x2c')],qs[_0x6d56('0x31')](_0x5f1a77[_0x6d56('0x32')][_0x6d56('0x31')]));_0x1f866d[_0x6d56('0x30')]=_0x1f866d[_0x6d56('0x30')]['length']?_0x1f866d[_0x6d56('0x30')]:_0x339b7a[_0x6d56('0x2c')];_0x1f866d[_0x6d56('0x48')]=qs[_0x6d56('0x35')](_0x5f1a77[_0x6d56('0x32')][_0x6d56('0x35')]);_0x1f866d[_0x6d56('0x37')]=qs[_0x6d56('0x2e')](_['pick'](_0x5f1a77[_0x6d56('0x32')],_0x339b7a[_0x6d56('0x2e')]));if(_0x5f1a77[_0x6d56('0x32')]['filter']){_0x1f866d[_0x6d56('0x37')]=_[_0x6d56('0x38')](_0x1f866d[_0x6d56('0x37')],{'$or':_['map'](_0x1f866d[_0x6d56('0x30')],function(_0x57d682){var _0x259a85={};_0x259a85[_0x57d682]={'$like':'%'+_0x5f1a77['query'][_0x6d56('0x49')]+'%'};return _0x259a85;})});}_0x1f866d=_[_0x6d56('0x38')]({},_0x1f866d,_0x5f1a77['options']);return _0x4296a4[_0x6d56('0x45')](_0x1f866d);}})[_0x6d56('0x21')](function(_0x5c636c){if(_0x5c636c){_0x476996=_0x5c636c['length'];if(!_0x5f1a77[_0x6d56('0x32')][_0x6d56('0x33')](_0x6d56('0x34'))){_0x1f866d[_0x6d56('0x19')]=qs[_0x6d56('0x19')](_0x5f1a77['query'][_0x6d56('0x19')]);_0x1f866d[_0x6d56('0x18')]=qs[_0x6d56('0x18')](_0x5f1a77['query'][_0x6d56('0x18')]);}return _0x4296a4[_0x6d56('0x45')](_0x1f866d);}})[_0x6d56('0x21')](function(_0x16ca02){if(_0x16ca02){return _0x16ca02?{'count':_0x476996,'rows':_0x16ca02}:null;}})[_0x6d56('0x21')](respondWithResult(_0x4b0664,null))[_0x6d56('0x41')](handleError(_0x4b0664,null));};exports[_0x6d56('0x4a')]=function(_0x218630,_0x2cadc0,_0xf8de0e){var _0x5e26d2={};var _0x3a236c={};var _0x361570;var _0x15c66c;return db[_0x6d56('0x3b')]['findOne']({'where':{'id':_0x218630[_0x6d56('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2cadc0,null))[_0x6d56('0x21')](function(_0x51c0c0){if(_0x51c0c0){_0x361570=_0x51c0c0;_0x3a236c['model']=_[_0x6d56('0x2d')](db[_0x6d56('0x47')][_0x6d56('0x29')]);_0x3a236c[_0x6d56('0x32')]=_[_0x6d56('0x2d')](_0x218630[_0x6d56('0x32')]);_0x3a236c['filters']=_[_0x6d56('0x2f')](_0x3a236c[_0x6d56('0x2c')],_0x3a236c[_0x6d56('0x32')]);_0x5e26d2[_0x6d56('0x30')]=_['intersection'](_0x3a236c[_0x6d56('0x2c')],qs[_0x6d56('0x31')](_0x218630[_0x6d56('0x32')][_0x6d56('0x31')]));_0x5e26d2['attributes']=_0x5e26d2['attributes'][_0x6d56('0x4b')]?_0x5e26d2[_0x6d56('0x30')]:_0x3a236c['model'];_0x5e26d2['order']=qs[_0x6d56('0x35')](_0x218630[_0x6d56('0x32')][_0x6d56('0x35')]);_0x5e26d2[_0x6d56('0x37')]=qs[_0x6d56('0x2e')](_['pick'](_0x218630[_0x6d56('0x32')],_0x3a236c[_0x6d56('0x2e')]));if(_0x218630['query'][_0x6d56('0x49')]){_0x5e26d2[_0x6d56('0x37')]=_[_0x6d56('0x38')](_0x5e26d2[_0x6d56('0x37')],{'$or':_[_0x6d56('0x28')](_0x5e26d2['attributes'],function(_0x140464){var _0x1d0a19={};_0x1d0a19[_0x140464]={'$like':'%'+_0x218630['query'][_0x6d56('0x49')]+'%'};return _0x1d0a19;})});}_0x5e26d2=_[_0x6d56('0x38')]({},_0x5e26d2,_0x218630[_0x6d56('0x3a')]);return _0x361570['getSubjects'](_0x5e26d2);}})[_0x6d56('0x21')](function(_0xa8dfe6){if(_0xa8dfe6){_0x15c66c=_0xa8dfe6[_0x6d56('0x4b')];if(!_0x218630[_0x6d56('0x32')]['hasOwnProperty'](_0x6d56('0x34'))){_0x5e26d2[_0x6d56('0x19')]=qs['limit'](_0x218630[_0x6d56('0x32')]['limit']);_0x5e26d2[_0x6d56('0x18')]=qs[_0x6d56('0x18')](_0x218630['query'][_0x6d56('0x18')]);}return _0x361570[_0x6d56('0x4a')](_0x5e26d2);}})[_0x6d56('0x21')](function(_0x2ef7ac){if(_0x2ef7ac){return _0x2ef7ac?{'count':_0x15c66c,'rows':_0x2ef7ac}:null;}})[_0x6d56('0x21')](respondWithResult(_0x2cadc0,null))['catch'](handleError(_0x2cadc0,null));};exports[_0x6d56('0x4c')]=function(_0x1ed218,_0x212772,_0x4fb14a){var _0x2e786a={};var _0x8953f2={};var _0x155c51;var _0x442cf6;return db[_0x6d56('0x3b')][_0x6d56('0x46')]({'where':{'id':_0x1ed218[_0x6d56('0x3f')]['id']}})['then'](handleEntityNotFound(_0x212772,null))[_0x6d56('0x21')](function(_0x4cd996){if(_0x4cd996){_0x155c51=_0x4cd996;_0x8953f2[_0x6d56('0x2c')]=_[_0x6d56('0x2d')](db[_0x6d56('0x47')][_0x6d56('0x29')]);_0x8953f2[_0x6d56('0x32')]=_['keys'](_0x1ed218['query']);_0x8953f2['filters']=_[_0x6d56('0x2f')](_0x8953f2['model'],_0x8953f2['query']);_0x2e786a[_0x6d56('0x30')]=_[_0x6d56('0x2f')](_0x8953f2[_0x6d56('0x2c')],qs[_0x6d56('0x31')](_0x1ed218['query']['fields']));_0x2e786a[_0x6d56('0x30')]=_0x2e786a[_0x6d56('0x30')]['length']?_0x2e786a[_0x6d56('0x30')]:_0x8953f2[_0x6d56('0x2c')];_0x2e786a[_0x6d56('0x48')]=qs[_0x6d56('0x35')](_0x1ed218[_0x6d56('0x32')][_0x6d56('0x35')]);_0x2e786a[_0x6d56('0x37')]=qs[_0x6d56('0x2e')](_[_0x6d56('0x36')](_0x1ed218[_0x6d56('0x32')],_0x8953f2[_0x6d56('0x2e')]));if(_0x1ed218[_0x6d56('0x32')][_0x6d56('0x49')]){_0x2e786a['where']=_[_0x6d56('0x38')](_0x2e786a[_0x6d56('0x37')],{'$or':_[_0x6d56('0x28')](_0x2e786a[_0x6d56('0x30')],function(_0x3613ec){var _0x378158={};_0x378158[_0x3613ec]={'$like':'%'+_0x1ed218[_0x6d56('0x32')][_0x6d56('0x49')]+'%'};return _0x378158;})});}_0x2e786a=_[_0x6d56('0x38')]({},_0x2e786a,_0x1ed218['options']);return _0x155c51[_0x6d56('0x4c')](_0x2e786a);}})[_0x6d56('0x21')](function(_0x4870c9){if(_0x4870c9){_0x442cf6=_0x4870c9['length'];if(!_0x1ed218[_0x6d56('0x32')][_0x6d56('0x33')](_0x6d56('0x34'))){_0x2e786a[_0x6d56('0x19')]=qs[_0x6d56('0x19')](_0x1ed218[_0x6d56('0x32')][_0x6d56('0x19')]);_0x2e786a['offset']=qs[_0x6d56('0x18')](_0x1ed218[_0x6d56('0x32')][_0x6d56('0x18')]);}return _0x155c51[_0x6d56('0x4c')](_0x2e786a);}})[_0x6d56('0x21')](function(_0x4d1d78){if(_0x4d1d78){return _0x4d1d78?{'count':_0x442cf6,'rows':_0x4d1d78}:null;}})[_0x6d56('0x21')](respondWithResult(_0x212772,null))[_0x6d56('0x41')](handleError(_0x212772,null));};exports[_0x6d56('0x4d')]=function(_0x138286,_0x207e21,_0xc33a69){var _0x27c98c={};var _0x5d1830={};var _0x38daaa;var _0x2bc6f4;return db[_0x6d56('0x3b')][_0x6d56('0x46')]({'where':{'id':_0x138286[_0x6d56('0x3f')]['id']}})[_0x6d56('0x21')](handleEntityNotFound(_0x207e21,null))[_0x6d56('0x21')](function(_0x31df85){if(_0x31df85){_0x38daaa=_0x31df85;_0x5d1830[_0x6d56('0x2c')]=_[_0x6d56('0x2d')](db['Tag'][_0x6d56('0x29')]);_0x5d1830[_0x6d56('0x32')]=_[_0x6d56('0x2d')](_0x138286[_0x6d56('0x32')]);_0x5d1830[_0x6d56('0x2e')]=_['intersection'](_0x5d1830['model'],_0x5d1830[_0x6d56('0x32')]);_0x27c98c[_0x6d56('0x30')]=_['intersection'](_0x5d1830[_0x6d56('0x2c')],qs['fields'](_0x138286[_0x6d56('0x32')][_0x6d56('0x31')]));_0x27c98c['attributes']=_0x27c98c[_0x6d56('0x30')][_0x6d56('0x4b')]?_0x27c98c[_0x6d56('0x30')]:_0x5d1830['model'];_0x27c98c[_0x6d56('0x48')]=qs[_0x6d56('0x35')](_0x138286['query'][_0x6d56('0x35')]);_0x27c98c[_0x6d56('0x37')]=qs['filters'](_[_0x6d56('0x36')](_0x138286['query'],_0x5d1830[_0x6d56('0x2e')]));if(_0x138286[_0x6d56('0x32')][_0x6d56('0x49')]){_0x27c98c[_0x6d56('0x37')]=_[_0x6d56('0x38')](_0x27c98c[_0x6d56('0x37')],{'$or':_[_0x6d56('0x28')](_0x27c98c[_0x6d56('0x30')],function(_0x4e5533){var _0x1c39b7={};_0x1c39b7[_0x4e5533]={'$like':'%'+_0x138286[_0x6d56('0x32')][_0x6d56('0x49')]+'%'};return _0x1c39b7;})});}_0x27c98c=_[_0x6d56('0x38')]({},_0x27c98c,_0x138286[_0x6d56('0x3a')]);return _0x38daaa['getTags'](_0x27c98c);}})[_0x6d56('0x21')](function(_0x56306b){if(_0x56306b){_0x2bc6f4=_0x56306b['length'];if(!_0x138286[_0x6d56('0x32')][_0x6d56('0x33')](_0x6d56('0x34'))){_0x27c98c[_0x6d56('0x19')]=qs[_0x6d56('0x19')](_0x138286['query']['limit']);_0x27c98c[_0x6d56('0x18')]=qs['offset'](_0x138286[_0x6d56('0x32')][_0x6d56('0x18')]);}return _0x38daaa[_0x6d56('0x4d')](_0x27c98c);}})['then'](function(_0x437d34){if(_0x437d34){return _0x437d34?{'count':_0x2bc6f4,'rows':_0x437d34}:null;}})[_0x6d56('0x21')](respondWithResult(_0x207e21,null))['catch'](handleError(_0x207e21,null));};exports[_0x6d56('0x4e')]=function(_0x5b9ac6,_0x166fd1,_0xea6ccc){if(_0x5b9ac6[_0x6d56('0x43')]['id']){delete _0x5b9ac6[_0x6d56('0x43')]['id'];}return db[_0x6d56('0x3b')][_0x6d56('0x46')]({'where':{'id':_0x5b9ac6[_0x6d56('0x3f')]['id']}})['then'](handleEntityNotFound(_0x166fd1,null))[_0x6d56('0x21')](function(_0x1c8f00){if(_0x1c8f00){return _0x1c8f00[_0x6d56('0x4e')](_0x5b9ac6[_0x6d56('0x43')][_0x6d56('0x4f')]||[]);}return null;})[_0x6d56('0x21')](respondWithResult(_0x166fd1,null))['catch'](handleError(_0x166fd1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a64f8f9..674122d 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 _0x58a4=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x176879,_0x468fb2){var _0x581d1c=function(_0xa7840f){while(--_0xa7840f){_0x176879['push'](_0x176879['shift']());}};_0x581d1c(++_0x468fb2);}(_0x58a4,0xbf));var _0x458a=function(_0x16e569,_0x33f836){_0x16e569=_0x16e569-0x0;var _0x22470a=_0x58a4[_0x16e569];return _0x22470a;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var logger=require(_0x458a('0x2'))(_0x458a('0x3'));var moment=require(_0x458a('0x4'));var BPromise=require(_0x458a('0x5'));var rp=require(_0x458a('0x6'));var fs=require('fs');var path=require(_0x458a('0x7'));var rimraf=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var attributes=require(_0x458a('0xa'));module[_0x458a('0xb')]=function(_0x2f5d44,_0x57de3c){return _0x2f5d44['define'](_0x458a('0xc'),attributes,{'tableName':_0x458a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7708=['../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','rimraf'];(function(_0x1ec543,_0x234227){var _0x1e115e=function(_0x55afcf){while(--_0x55afcf){_0x1ec543['push'](_0x1ec543['shift']());}};_0x1e115e(++_0x234227);}(_0x7708,0x188));var _0x8770=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x7708[_0x400322];return _0xfdd597;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'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 c3aa03c..d990088 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 _0x264f=['util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x264f,0x1b7));var _0xf264=function(_0xd13969,_0x26c2a8){_0xd13969=_0xd13969-0x0;var _0x44d388=_0x264f[_0xd13969];return _0x44d388;};'use strict';var _=require(_0xf264('0x0'));var util=require(_0xf264('0x1'));var moment=require('moment');var BPromise=require(_0xf264('0x2'));var rs=require(_0xf264('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf264('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf264('0x5'));var jayson=require(_0xf264('0x6'));var client=jayson[_0xf264('0x7')][_0xf264('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e58ed,_0x34ccd1,_0x3d0cbb){return new BPromise(function(_0x3db774,_0x44f9d2){return client['request'](_0x3e58ed,_0x3d0cbb)[_0xf264('0x9')](function(_0x2e91bc){logger['info'](_0xf264('0xa'),_0x34ccd1,_0xf264('0xb'));logger[_0xf264('0xc')](_0xf264('0xd'),_0x34ccd1,_0xf264('0xb'),JSON[_0xf264('0xe')](_0x2e91bc));if(_0x2e91bc[_0xf264('0xf')]){if(_0x2e91bc['error'][_0xf264('0x10')]===0x1f4){logger[_0xf264('0xf')](_0xf264('0xa'),_0x34ccd1,_0x2e91bc[_0xf264('0xf')][_0xf264('0x11')]);return _0x44f9d2(_0x2e91bc[_0xf264('0xf')][_0xf264('0x11')]);}logger[_0xf264('0xf')](_0xf264('0xa'),_0x34ccd1,_0x2e91bc[_0xf264('0xf')][_0xf264('0x11')]);return _0x3db774(_0x2e91bc['error'][_0xf264('0x11')]);}else{logger[_0xf264('0x12')](_0xf264('0xa'),_0x34ccd1,_0xf264('0xb'));_0x3db774(_0x2e91bc[_0xf264('0x13')]['message']);}})['catch'](function(_0x1ea537){logger[_0xf264('0xf')](_0xf264('0xa'),_0x34ccd1,_0x1ea537);_0x44f9d2(_0x1ea537);});});} \ No newline at end of file +var _0x6e57=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6e57,0xba));var _0x76e5=function(_0x83fa60,_0x4df336){_0x83fa60=_0x83fa60-0x0;var _0x177b94=_0x6e57[_0x83fa60];return _0x177b94;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x76e5('0x0'));var BPromise=require(_0x76e5('0x1'));var rs=require(_0x76e5('0x2'));var fs=require('fs');var Redis=require(_0x76e5('0x3'));var db=require(_0x76e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x76e5('0x5'))(_0x76e5('0x6'));var config=require(_0x76e5('0x7'));var jayson=require(_0x76e5('0x8'));var client=jayson[_0x76e5('0x9')][_0x76e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54fcdc,_0x2a6736,_0x5cf360){return new BPromise(function(_0x3be092,_0x4e7b25){return client['request'](_0x54fcdc,_0x5cf360)[_0x76e5('0xb')](function(_0x23d58e){logger[_0x76e5('0xc')](_0x76e5('0xd'),_0x2a6736,_0x76e5('0xe'));logger[_0x76e5('0xf')](_0x76e5('0x10'),_0x2a6736,_0x76e5('0xe'),JSON[_0x76e5('0x11')](_0x23d58e));if(_0x23d58e['error']){if(_0x23d58e['error'][_0x76e5('0x12')]===0x1f4){logger[_0x76e5('0x13')](_0x76e5('0xd'),_0x2a6736,_0x23d58e['error'][_0x76e5('0x14')]);return _0x4e7b25(_0x23d58e[_0x76e5('0x13')]['message']);}logger[_0x76e5('0x13')](_0x76e5('0xd'),_0x2a6736,_0x23d58e[_0x76e5('0x13')][_0x76e5('0x14')]);return _0x3be092(_0x23d58e[_0x76e5('0x13')][_0x76e5('0x14')]);}else{logger[_0x76e5('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a6736,_0x76e5('0xe'));_0x3be092(_0x23d58e[_0x76e5('0x15')][_0x76e5('0x14')]);}})[_0x76e5('0x16')](function(_0x488286){logger[_0x76e5('0x13')](_0x76e5('0xd'),_0x2a6736,_0x488286);_0x4e7b25(_0x488286);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index b203979..94d5928 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 _0xe754=['./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11517f,_0x2ba286){var _0x3f056d=function(_0x424bde){while(--_0x424bde){_0x11517f['push'](_0x11517f['shift']());}};_0x3f056d(++_0x2ba286);}(_0xe754,0x83));var _0x4e75=function(_0x2f45bf,_0x7c0fc){_0x2f45bf=_0x2f45bf-0x0;var _0x3501d4=_0xe754[_0x2f45bf];return _0x3501d4;};'use strict';var multer=require(_0x4e75('0x0'));var util=require(_0x4e75('0x1'));var path=require(_0x4e75('0x2'));var timeout=require(_0x4e75('0x3'));var express=require(_0x4e75('0x4'));var router=express[_0x4e75('0x5')]();var fs_extra=require(_0x4e75('0x6'));var auth=require(_0x4e75('0x7'));var interaction=require(_0x4e75('0x8'));var config=require('../../config/environment');var controller=require(_0x4e75('0x9'));router[_0x4e75('0xa')]('/',auth[_0x4e75('0xb')](),controller[_0x4e75('0xc')]);router[_0x4e75('0xa')](_0x4e75('0xd'),auth[_0x4e75('0xb')](),controller[_0x4e75('0xe')]);router[_0x4e75('0xf')]('/',auth['isAuthenticated'](),controller[_0x4e75('0x10')]);router[_0x4e75('0x11')](_0x4e75('0xd'),auth[_0x4e75('0xb')](),controller[_0x4e75('0x12')]);router[_0x4e75('0x13')](_0x4e75('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x60ad=['path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZendeskField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x59ed8c,_0x497c0f){var _0x2ae760=function(_0x5e0c08){while(--_0x5e0c08){_0x59ed8c['push'](_0x59ed8c['shift']());}};_0x2ae760(++_0x497c0f);}(_0x60ad,0x99));var _0xd60a=function(_0x1e18ad,_0x590618){_0x1e18ad=_0x1e18ad-0x0;var _0x11af85=_0x60ad[_0x1e18ad];return _0x11af85;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd60a('0x0'));var timeout=require(_0xd60a('0x1'));var express=require(_0xd60a('0x2'));var router=express['Router']();var fs_extra=require(_0xd60a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd60a('0x4'));var config=require('../../config/environment');var controller=require(_0xd60a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd60a('0x6')]);router[_0xd60a('0x7')](_0xd60a('0x8'),auth[_0xd60a('0x9')](),controller[_0xd60a('0xa')]);router[_0xd60a('0xb')]('/',auth[_0xd60a('0x9')](),controller[_0xd60a('0xc')]);router[_0xd60a('0xd')](_0xd60a('0x8'),auth[_0xd60a('0x9')](),controller[_0xd60a('0xe')]);router['delete']('/:id',auth[_0xd60a('0x9')](),controller[_0xd60a('0xf')]);module[_0xd60a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d7a2331..12f9b30 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 _0x490f=['variable','exports','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x784019,_0x461100){var _0x5c0d56=function(_0x299cd4){while(--_0x299cd4){_0x784019['push'](_0x784019['shift']());}};_0x5c0d56(++_0x461100);}(_0x490f,0x1b1));var _0xf490=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x490f[_0x5575cd];return _0x4979a0;};'use strict';var Sequelize=require('sequelize');module[_0xf490('0x0')]={'type':{'type':Sequelize['ENUM'](_0xf490('0x1'),'variable',_0xf490('0x2'),_0xf490('0x3'),_0xf490('0x4')),'defaultValue':_0xf490('0x1')},'content':{'type':Sequelize[_0xf490('0x5')]},'key':{'type':Sequelize[_0xf490('0x5')]},'keyType':{'type':Sequelize[_0xf490('0x6')]('string',_0xf490('0x7'),_0xf490('0x2'))},'keyContent':{'type':Sequelize[_0xf490('0x5')]},'idField':{'type':Sequelize[_0xf490('0x5')]},'nameField':{'type':Sequelize[_0xf490('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf490('0x5')]}}; \ No newline at end of file +var _0x5dc8=['keyValue','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x5e404c,_0x598917){var _0x40de84=function(_0x30ea21){while(--_0x30ea21){_0x5e404c['push'](_0x5e404c['shift']());}};_0x40de84(++_0x598917);}(_0x5dc8,0x1b4));var _0x85dc=function(_0x565dc8,_0x4261e5){_0x565dc8=_0x565dc8-0x0;var _0x46d643=_0x5dc8[_0x565dc8];return _0x46d643;};'use strict';var Sequelize=require('sequelize');module[_0x85dc('0x0')]={'type':{'type':Sequelize['ENUM'](_0x85dc('0x1'),_0x85dc('0x2'),_0x85dc('0x3'),_0x85dc('0x4'),'picklist'),'defaultValue':_0x85dc('0x1')},'content':{'type':Sequelize[_0x85dc('0x5')]},'key':{'type':Sequelize[_0x85dc('0x5')]},'keyType':{'type':Sequelize[_0x85dc('0x6')](_0x85dc('0x1'),_0x85dc('0x2'),_0x85dc('0x3'))},'keyContent':{'type':Sequelize[_0x85dc('0x5')]},'idField':{'type':Sequelize[_0x85dc('0x5')]},'nameField':{'type':Sequelize[_0x85dc('0x5')]},'customField':{'type':Sequelize[_0x85dc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85dc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index aab204a..abe954c 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 _0x339a=['then','destroy','status','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','type','VIRTUAL','merge','options','ZendeskField','include','findAll','rows','catch','show','length','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','save','update'];(function(_0x24a278,_0x25ac4e){var _0x561e7b=function(_0x2b84f2){while(--_0x2b84f2){_0x24a278['push'](_0x24a278['shift']());}};_0x561e7b(++_0x25ac4e);}(_0x339a,0x151));var _0xa339=function(_0x27b710,_0x47f649){_0x27b710=_0x27b710-0x0;var _0x2182b3=_0x339a[_0x27b710];return _0x2182b3;};'use strict';var emlformat=require(_0xa339('0x0'));var rimraf=require(_0xa339('0x1'));var zipdir=require(_0xa339('0x2'));var jsonpatch=require(_0xa339('0x3'));var rp=require(_0xa339('0x4'));var moment=require(_0xa339('0x5'));var BPromise=require(_0xa339('0x6'));var Mustache=require(_0xa339('0x7'));var util=require(_0xa339('0x8'));var path=require(_0xa339('0x9'));var sox=require(_0xa339('0xa'));var csv=require(_0xa339('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa339('0xc'));var squel=require(_0xa339('0xd'));var crypto=require(_0xa339('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa339('0xf'));var toCsv=require(_0xa339('0xb'));var querystring=require(_0xa339('0x10'));var Papa=require(_0xa339('0x11'));var Redis=require(_0xa339('0x12'));var authService=require(_0xa339('0x13'));var qs=require(_0xa339('0x14'));var as=require(_0xa339('0x15'));var hardwareService=require(_0xa339('0x16'));var logger=require(_0xa339('0x17'))(_0xa339('0x18'));var utils=require(_0xa339('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa339('0x1a'));var db=require(_0xa339('0x1b'))['db'];function respondWithStatusCode(_0x48e292,_0x224e03){_0x224e03=_0x224e03||0xcc;return function(_0x206405){if(_0x206405){return _0x48e292['sendStatus'](_0x224e03);}return _0x48e292['status'](_0x224e03)[_0xa339('0x1c')]();};}function respondWithResult(_0x541d29,_0xafc7c0){_0xafc7c0=_0xafc7c0||0xc8;return function(_0x56c32f){if(_0x56c32f){return _0x541d29['status'](_0xafc7c0)[_0xa339('0x1d')](_0x56c32f);}};}function respondWithFilteredResult(_0x326533,_0xfe51f6){return function(_0x241110){if(_0x241110){var _0x13bad7=typeof _0xfe51f6[_0xa339('0x1e')]===_0xa339('0x1f')&&typeof _0xfe51f6[_0xa339('0x20')]==='undefined';var _0x1e54fe=_0x241110[_0xa339('0x21')];var _0x48d551=_0x13bad7?0x0:_0xfe51f6[_0xa339('0x1e')];var _0x46f3ae=_0x13bad7?_0x241110[_0xa339('0x21')]:_0xfe51f6[_0xa339('0x1e')]+_0xfe51f6[_0xa339('0x20')];var _0x17e16e;if(_0x46f3ae>=_0x1e54fe){_0x46f3ae=_0x1e54fe;_0x17e16e=0xc8;}else{_0x17e16e=0xce;}_0x326533['status'](_0x17e16e);return _0x326533[_0xa339('0x22')](_0xa339('0x23'),_0x48d551+'-'+_0x46f3ae+'/'+_0x1e54fe)[_0xa339('0x1d')](_0x241110);}return null;};}function patchUpdates(_0x22a202){return function(_0x32cabc){try{jsonpatch['apply'](_0x32cabc,_0x22a202,!![]);}catch(_0x20fbcf){return BPromise['reject'](_0x20fbcf);}return _0x32cabc[_0xa339('0x24')]();};}function saveUpdates(_0x3f7fa8,_0xb6cfea){return function(_0x30474d){if(_0x30474d){return _0x30474d[_0xa339('0x25')](_0x3f7fa8)[_0xa339('0x26')](function(_0x220c1a){return _0x220c1a;});}return null;};}function removeEntity(_0x2f82da,_0x15bb37){return function(_0x52e7a3){if(_0x52e7a3){return _0x52e7a3[_0xa339('0x27')]()[_0xa339('0x26')](function(){_0x2f82da[_0xa339('0x28')](0xcc)[_0xa339('0x1c')]();});}};}function handleEntityNotFound(_0x5fe021,_0x40c08e){return function(_0x3707fc){if(!_0x3707fc){_0x5fe021[_0xa339('0x29')](0x194);}return _0x3707fc;};}function handleError(_0x4a50c8,_0x365471){_0x365471=_0x365471||0x1f4;return function(_0x21a274){logger[_0xa339('0x2a')](_0x21a274[_0xa339('0x2b')]);if(_0x21a274[_0xa339('0x2c')]){delete _0x21a274[_0xa339('0x2c')];}_0x4a50c8[_0xa339('0x28')](_0x365471)['send'](_0x21a274);};}exports[_0xa339('0x2d')]=function(_0x5c668f,_0x422f47){var _0x24ec3c={},_0x45a75a={},_0x584afe={'count':0x0,'rows':[]};var _0x5321e5=_[_0xa339('0x2e')](db['ZendeskField'][_0xa339('0x2f')],function(_0x52ee55){return{'name':_0x52ee55[_0xa339('0x30')],'type':_0x52ee55['type'][_0xa339('0x31')]};});_0x45a75a[_0xa339('0x32')]=_['map'](_0x5321e5,_0xa339('0x2c'));_0x45a75a[_0xa339('0x33')]=_[_0xa339('0x34')](_0x5c668f['query']);_0x45a75a[_0xa339('0x35')]=_[_0xa339('0x36')](_0x45a75a['model'],_0x45a75a[_0xa339('0x33')]);_0x24ec3c[_0xa339('0x37')]=_[_0xa339('0x36')](_0x45a75a[_0xa339('0x32')],qs[_0xa339('0x38')](_0x5c668f[_0xa339('0x33')][_0xa339('0x38')]));_0x24ec3c[_0xa339('0x37')]=_0x24ec3c['attributes']['length']?_0x24ec3c[_0xa339('0x37')]:_0x45a75a[_0xa339('0x32')];if(!_0x5c668f['query']['hasOwnProperty']('nolimit')){_0x24ec3c[_0xa339('0x20')]=qs[_0xa339('0x20')](_0x5c668f[_0xa339('0x33')]['limit']);_0x24ec3c[_0xa339('0x1e')]=qs[_0xa339('0x1e')](_0x5c668f[_0xa339('0x33')][_0xa339('0x1e')]);}_0x24ec3c['order']=qs[_0xa339('0x39')](_0x5c668f[_0xa339('0x33')][_0xa339('0x39')]);_0x24ec3c[_0xa339('0x3a')]=qs[_0xa339('0x35')](_[_0xa339('0x3b')](_0x5c668f[_0xa339('0x33')],_0x45a75a[_0xa339('0x35')]),_0x5321e5);if(_0x5c668f[_0xa339('0x33')][_0xa339('0x3c')]){_0x24ec3c[_0xa339('0x3a')]=_['merge'](_0x24ec3c[_0xa339('0x3a')],{'$or':_[_0xa339('0x2e')](_0x5321e5,function(_0x5c0fab){if(_0x5c0fab[_0xa339('0x3d')]!==_0xa339('0x3e')){var _0x465461={};_0x465461[_0x5c0fab['name']]={'$like':'%'+_0x5c668f[_0xa339('0x33')][_0xa339('0x3c')]+'%'};return _0x465461;}})});}_0x24ec3c=_[_0xa339('0x3f')]({},_0x24ec3c,_0x5c668f[_0xa339('0x40')]);var _0x1883d8={'where':_0x24ec3c[_0xa339('0x3a')]};return db[_0xa339('0x41')][_0xa339('0x21')](_0x1883d8)['then'](function(_0x295a22){_0x584afe[_0xa339('0x21')]=_0x295a22;if(_0x5c668f[_0xa339('0x33')]['includeAll']){_0x24ec3c[_0xa339('0x42')]=[{'all':!![]}];}return db[_0xa339('0x41')][_0xa339('0x43')](_0x24ec3c);})[_0xa339('0x26')](function(_0x404ab8){_0x584afe[_0xa339('0x44')]=_0x404ab8;return _0x584afe;})[_0xa339('0x26')](respondWithFilteredResult(_0x422f47,_0x24ec3c))[_0xa339('0x45')](handleError(_0x422f47,null));};exports[_0xa339('0x46')]=function(_0x2856d3,_0x292118){var _0x4869ee={'raw':!![],'where':{'id':_0x2856d3['params']['id']}},_0x569021={};_0x569021[_0xa339('0x32')]=_[_0xa339('0x34')](db['ZendeskField']['rawAttributes']);_0x569021[_0xa339('0x33')]=_['keys'](_0x2856d3[_0xa339('0x33')]);_0x569021[_0xa339('0x35')]=_['intersection'](_0x569021[_0xa339('0x32')],_0x569021[_0xa339('0x33')]);_0x4869ee['attributes']=_[_0xa339('0x36')](_0x569021[_0xa339('0x32')],qs[_0xa339('0x38')](_0x2856d3[_0xa339('0x33')][_0xa339('0x38')]));_0x4869ee[_0xa339('0x37')]=_0x4869ee[_0xa339('0x37')][_0xa339('0x47')]?_0x4869ee['attributes']:_0x569021[_0xa339('0x32')];if(_0x2856d3['query']['includeAll']){_0x4869ee[_0xa339('0x42')]=[{'all':!![]}];}_0x4869ee=_[_0xa339('0x3f')]({},_0x4869ee,_0x2856d3[_0xa339('0x40')]);return db['ZendeskField']['find'](_0x4869ee)['then'](handleEntityNotFound(_0x292118,null))[_0xa339('0x26')](respondWithResult(_0x292118,null))[_0xa339('0x45')](handleError(_0x292118,null));};exports[_0xa339('0x48')]=function(_0x28aeb6,_0x531a22){return db[_0xa339('0x41')]['create'](_0x28aeb6[_0xa339('0x49')],{})[_0xa339('0x26')](respondWithResult(_0x531a22,0xc9))['catch'](handleError(_0x531a22,null));};exports[_0xa339('0x25')]=function(_0x592f0a,_0x2bd88c){if(_0x592f0a[_0xa339('0x49')]['id']){delete _0x592f0a[_0xa339('0x49')]['id'];}return db[_0xa339('0x41')]['find']({'where':{'id':_0x592f0a[_0xa339('0x4a')]['id']}})[_0xa339('0x26')](handleEntityNotFound(_0x2bd88c,null))[_0xa339('0x26')](saveUpdates(_0x592f0a[_0xa339('0x49')],null))[_0xa339('0x26')](respondWithResult(_0x2bd88c,null))[_0xa339('0x45')](handleError(_0x2bd88c,null));};exports[_0xa339('0x27')]=function(_0x35e02e,_0x5e79b3){return db[_0xa339('0x41')]['find']({'where':{'id':_0x35e02e[_0xa339('0x4a')]['id']}})[_0xa339('0x26')](handleEntityNotFound(_0x5e79b3,null))[_0xa339('0x26')](removeEntity(_0x5e79b3,null))[_0xa339('0x45')](handleError(_0x5e79b3,null));}; \ No newline at end of file +var _0xaf1d=['findAll','rows','params','keys','length','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZendeskField','includeAll','include'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0xaf1d,0x9f));var _0xdaf1=function(_0xd193d4,_0x8b0eb4){_0xd193d4=_0xd193d4-0x0;var _0x2c88dc=_0xaf1d[_0xd193d4];return _0x2c88dc;};'use strict';var emlformat=require(_0xdaf1('0x0'));var rimraf=require(_0xdaf1('0x1'));var zipdir=require(_0xdaf1('0x2'));var jsonpatch=require(_0xdaf1('0x3'));var rp=require('request-promise');var moment=require(_0xdaf1('0x4'));var BPromise=require(_0xdaf1('0x5'));var Mustache=require('mustache');var util=require(_0xdaf1('0x6'));var path=require(_0xdaf1('0x7'));var sox=require(_0xdaf1('0x8'));var csv=require(_0xdaf1('0x9'));var ejs=require(_0xdaf1('0xa'));var fs=require('fs');var fs_extra=require(_0xdaf1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaf1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdaf1('0xd'));var Papa=require(_0xdaf1('0xe'));var Redis=require(_0xdaf1('0xf'));var authService=require(_0xdaf1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdaf1('0x11'));var hardwareService=require(_0xdaf1('0x12'));var logger=require(_0xdaf1('0x13'))(_0xdaf1('0x14'));var utils=require(_0xdaf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdaf1('0x16'));var db=require(_0xdaf1('0x17'))['db'];function respondWithStatusCode(_0x260c4b,_0x112c60){_0x112c60=_0x112c60||0xcc;return function(_0x3543e1){if(_0x3543e1){return _0x260c4b[_0xdaf1('0x18')](_0x112c60);}return _0x260c4b[_0xdaf1('0x19')](_0x112c60)[_0xdaf1('0x1a')]();};}function respondWithResult(_0x9a5ec6,_0x7393af){_0x7393af=_0x7393af||0xc8;return function(_0x2add26){if(_0x2add26){return _0x9a5ec6[_0xdaf1('0x19')](_0x7393af)[_0xdaf1('0x1b')](_0x2add26);}};}function respondWithFilteredResult(_0x4ed852,_0x506590){return function(_0x2e98d4){if(_0x2e98d4){var _0x562534=typeof _0x506590[_0xdaf1('0x1c')]==='undefined'&&typeof _0x506590[_0xdaf1('0x1d')]===_0xdaf1('0x1e');var _0xc1141c=_0x2e98d4['count'];var _0x1dd985=_0x562534?0x0:_0x506590['offset'];var _0x4896c1=_0x562534?_0x2e98d4[_0xdaf1('0x1f')]:_0x506590[_0xdaf1('0x1c')]+_0x506590[_0xdaf1('0x1d')];var _0x36792f;if(_0x4896c1>=_0xc1141c){_0x4896c1=_0xc1141c;_0x36792f=0xc8;}else{_0x36792f=0xce;}_0x4ed852['status'](_0x36792f);return _0x4ed852['set'](_0xdaf1('0x20'),_0x1dd985+'-'+_0x4896c1+'/'+_0xc1141c)[_0xdaf1('0x1b')](_0x2e98d4);}return null;};}function patchUpdates(_0x37b377){return function(_0x5030e5){try{jsonpatch[_0xdaf1('0x21')](_0x5030e5,_0x37b377,!![]);}catch(_0x2e776d){return BPromise[_0xdaf1('0x22')](_0x2e776d);}return _0x5030e5[_0xdaf1('0x23')]();};}function saveUpdates(_0x77d6c6,_0x110e33){return function(_0x446c5b){if(_0x446c5b){return _0x446c5b[_0xdaf1('0x24')](_0x77d6c6)[_0xdaf1('0x25')](function(_0x28916c){return _0x28916c;});}return null;};}function removeEntity(_0x56b426,_0x1f97e4){return function(_0x41b020){if(_0x41b020){return _0x41b020[_0xdaf1('0x26')]()['then'](function(){_0x56b426['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x556bd8,_0x2e6bf4){return function(_0x10c286){if(!_0x10c286){_0x556bd8['sendStatus'](0x194);}return _0x10c286;};}function handleError(_0x997245,_0x3c2166){_0x3c2166=_0x3c2166||0x1f4;return function(_0x3125d7){logger['error'](_0x3125d7[_0xdaf1('0x27')]);if(_0x3125d7[_0xdaf1('0x28')]){delete _0x3125d7['name'];}_0x997245[_0xdaf1('0x19')](_0x3c2166)[_0xdaf1('0x29')](_0x3125d7);};}exports[_0xdaf1('0x2a')]=function(_0x3892ae,_0x6731f6){var _0x16f6e0={},_0x520500={},_0x2cdcf0={'count':0x0,'rows':[]};var _0x149bb5=_['map'](db['ZendeskField'][_0xdaf1('0x2b')],function(_0x31cf7d){return{'name':_0x31cf7d[_0xdaf1('0x2c')],'type':_0x31cf7d['type'][_0xdaf1('0x2d')]};});_0x520500[_0xdaf1('0x2e')]=_[_0xdaf1('0x2f')](_0x149bb5,_0xdaf1('0x28'));_0x520500[_0xdaf1('0x30')]=_['keys'](_0x3892ae[_0xdaf1('0x30')]);_0x520500[_0xdaf1('0x31')]=_[_0xdaf1('0x32')](_0x520500['model'],_0x520500['query']);_0x16f6e0[_0xdaf1('0x33')]=_['intersection'](_0x520500[_0xdaf1('0x2e')],qs[_0xdaf1('0x34')](_0x3892ae[_0xdaf1('0x30')]['fields']));_0x16f6e0[_0xdaf1('0x33')]=_0x16f6e0[_0xdaf1('0x33')]['length']?_0x16f6e0['attributes']:_0x520500[_0xdaf1('0x2e')];if(!_0x3892ae[_0xdaf1('0x30')]['hasOwnProperty'](_0xdaf1('0x35'))){_0x16f6e0[_0xdaf1('0x1d')]=qs[_0xdaf1('0x1d')](_0x3892ae['query'][_0xdaf1('0x1d')]);_0x16f6e0[_0xdaf1('0x1c')]=qs[_0xdaf1('0x1c')](_0x3892ae[_0xdaf1('0x30')]['offset']);}_0x16f6e0[_0xdaf1('0x36')]=qs[_0xdaf1('0x37')](_0x3892ae[_0xdaf1('0x30')][_0xdaf1('0x37')]);_0x16f6e0[_0xdaf1('0x38')]=qs['filters'](_[_0xdaf1('0x39')](_0x3892ae[_0xdaf1('0x30')],_0x520500[_0xdaf1('0x31')]),_0x149bb5);if(_0x3892ae['query'][_0xdaf1('0x3a')]){_0x16f6e0['where']=_[_0xdaf1('0x3b')](_0x16f6e0[_0xdaf1('0x38')],{'$or':_['map'](_0x149bb5,function(_0x11041f){if(_0x11041f[_0xdaf1('0x3c')]!==_0xdaf1('0x3d')){var _0x2e7414={};_0x2e7414[_0x11041f[_0xdaf1('0x28')]]={'$like':'%'+_0x3892ae['query'][_0xdaf1('0x3a')]+'%'};return _0x2e7414;}})});}_0x16f6e0=_['merge']({},_0x16f6e0,_0x3892ae[_0xdaf1('0x3e')]);var _0x5d9efb={'where':_0x16f6e0[_0xdaf1('0x38')]};return db[_0xdaf1('0x3f')][_0xdaf1('0x1f')](_0x5d9efb)['then'](function(_0x2a02dd){_0x2cdcf0[_0xdaf1('0x1f')]=_0x2a02dd;if(_0x3892ae[_0xdaf1('0x30')][_0xdaf1('0x40')]){_0x16f6e0[_0xdaf1('0x41')]=[{'all':!![]}];}return db[_0xdaf1('0x3f')][_0xdaf1('0x42')](_0x16f6e0);})[_0xdaf1('0x25')](function(_0xeacc01){_0x2cdcf0[_0xdaf1('0x43')]=_0xeacc01;return _0x2cdcf0;})[_0xdaf1('0x25')](respondWithFilteredResult(_0x6731f6,_0x16f6e0))['catch'](handleError(_0x6731f6,null));};exports['show']=function(_0x5e5e87,_0xa9e6d9){var _0x55592a={'raw':!![],'where':{'id':_0x5e5e87[_0xdaf1('0x44')]['id']}},_0x5b93a2={};_0x5b93a2[_0xdaf1('0x2e')]=_[_0xdaf1('0x45')](db['ZendeskField']['rawAttributes']);_0x5b93a2[_0xdaf1('0x30')]=_[_0xdaf1('0x45')](_0x5e5e87[_0xdaf1('0x30')]);_0x5b93a2['filters']=_[_0xdaf1('0x32')](_0x5b93a2['model'],_0x5b93a2[_0xdaf1('0x30')]);_0x55592a[_0xdaf1('0x33')]=_[_0xdaf1('0x32')](_0x5b93a2[_0xdaf1('0x2e')],qs[_0xdaf1('0x34')](_0x5e5e87[_0xdaf1('0x30')][_0xdaf1('0x34')]));_0x55592a[_0xdaf1('0x33')]=_0x55592a[_0xdaf1('0x33')][_0xdaf1('0x46')]?_0x55592a[_0xdaf1('0x33')]:_0x5b93a2[_0xdaf1('0x2e')];if(_0x5e5e87[_0xdaf1('0x30')]['includeAll']){_0x55592a[_0xdaf1('0x41')]=[{'all':!![]}];}_0x55592a=_[_0xdaf1('0x3b')]({},_0x55592a,_0x5e5e87[_0xdaf1('0x3e')]);return db[_0xdaf1('0x3f')][_0xdaf1('0x47')](_0x55592a)[_0xdaf1('0x25')](handleEntityNotFound(_0xa9e6d9,null))[_0xdaf1('0x25')](respondWithResult(_0xa9e6d9,null))['catch'](handleError(_0xa9e6d9,null));};exports[_0xdaf1('0x48')]=function(_0x3f9350,_0x3ef64d){return db['ZendeskField'][_0xdaf1('0x48')](_0x3f9350[_0xdaf1('0x49')],{})['then'](respondWithResult(_0x3ef64d,0xc9))[_0xdaf1('0x4a')](handleError(_0x3ef64d,null));};exports['update']=function(_0x2be988,_0x570e74){if(_0x2be988[_0xdaf1('0x49')]['id']){delete _0x2be988['body']['id'];}return db[_0xdaf1('0x3f')][_0xdaf1('0x47')]({'where':{'id':_0x2be988[_0xdaf1('0x44')]['id']}})[_0xdaf1('0x25')](handleEntityNotFound(_0x570e74,null))[_0xdaf1('0x25')](saveUpdates(_0x2be988[_0xdaf1('0x49')],null))['then'](respondWithResult(_0x570e74,null))[_0xdaf1('0x4a')](handleError(_0x570e74,null));};exports[_0xdaf1('0x26')]=function(_0xe7fe81,_0x3d329a){return db[_0xdaf1('0x3f')][_0xdaf1('0x47')]({'where':{'id':_0xe7fe81[_0xdaf1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d329a,null))[_0xdaf1('0x25')](removeEntity(_0x3d329a,null))['catch'](handleError(_0x3d329a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e4a2f49..38c5978 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 _0xb518=['bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','util','api','moment'];(function(_0x48066c,_0x2dce57){var _0x3bb5d7=function(_0x206aeb){while(--_0x206aeb){_0x48066c['push'](_0x48066c['shift']());}};_0x3bb5d7(++_0x2dce57);}(_0xb518,0x123));var _0x8b51=function(_0x3578a3,_0xc21d1e){_0x3578a3=_0x3578a3-0x0;var _0x2f819e=_0xb518[_0x3578a3];return _0x2f819e;};'use strict';var _=require('lodash');var util=require(_0x8b51('0x0'));var logger=require('../../config/logger')(_0x8b51('0x1'));var moment=require(_0x8b51('0x2'));var BPromise=require(_0x8b51('0x3'));var rp=require(_0x8b51('0x4'));var fs=require('fs');var path=require(_0x8b51('0x5'));var rimraf=require(_0x8b51('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b51('0x7'));module[_0x8b51('0x8')]=function(_0x175107,_0x56aa48){return _0x175107[_0x8b51('0x9')](_0x8b51('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x8b51('0xb'),'fields':[_0x8b51('0xc'),_0x8b51('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x697f=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','lodash','util','api','moment','request-promise'];(function(_0x8cd8da,_0x13ce25){var _0x5c59f2=function(_0x134cc1){while(--_0x134cc1){_0x8cd8da['push'](_0x8cd8da['shift']());}};_0x5c59f2(++_0x13ce25);}(_0x697f,0xe9));var _0xf697=function(_0x24e265,_0x48d1e9){_0x24e265=_0x24e265-0x0;var _0x7fc2a2=_0x697f[_0x24e265];return _0x7fc2a2;};'use strict';var _=require(_0xf697('0x0'));var util=require(_0xf697('0x1'));var logger=require('../../config/logger')(_0xf697('0x2'));var moment=require(_0xf697('0x3'));var BPromise=require('bluebird');var rp=require(_0xf697('0x4'));var fs=require('fs');var path=require(_0xf697('0x5'));var rimraf=require(_0xf697('0x6'));var config=require(_0xf697('0x7'));var attributes=require(_0xf697('0x8'));module[_0xf697('0x9')]=function(_0x36c534,_0x33383f){return _0x36c534[_0xf697('0xa')](_0xf697('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xf697('0xc'),'fields':[_0xf697('0xd'),'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 6f216a9..c37f5a8 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 _0xb2bf=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5cfd99,_0x20bf77){var _0x19090e=function(_0x4a1b7a){while(--_0x4a1b7a){_0x5cfd99['push'](_0x5cfd99['shift']());}};_0x19090e(++_0x20bf77);}(_0xb2bf,0x8f));var _0xfb2b=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0xb2bf[_0xfc406a];return _0x395473;};'use strict';var _=require(_0xfb2b('0x0'));var util=require('util');var moment=require(_0xfb2b('0x1'));var BPromise=require(_0xfb2b('0x2'));var rs=require(_0xfb2b('0x3'));var fs=require('fs');var Redis=require(_0xfb2b('0x4'));var db=require(_0xfb2b('0x5'))['db'];var utils=require(_0xfb2b('0x6'));var logger=require(_0xfb2b('0x7'))(_0xfb2b('0x8'));var config=require(_0xfb2b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x349081,_0x15e870,_0x2a3d68){return new BPromise(function(_0x40e1dd,_0x1d4985){return client[_0xfb2b('0xb')](_0x349081,_0x2a3d68)[_0xfb2b('0xc')](function(_0x307bca){logger[_0xfb2b('0xd')](_0xfb2b('0xe'),_0x15e870,_0xfb2b('0xf'));logger['debug'](_0xfb2b('0x10'),_0x15e870,_0xfb2b('0xf'),JSON['stringify'](_0x307bca));if(_0x307bca['error']){if(_0x307bca[_0xfb2b('0x11')]['code']===0x1f4){logger[_0xfb2b('0x11')](_0xfb2b('0xe'),_0x15e870,_0x307bca[_0xfb2b('0x11')][_0xfb2b('0x12')]);return _0x1d4985(_0x307bca[_0xfb2b('0x11')][_0xfb2b('0x12')]);}logger[_0xfb2b('0x11')](_0xfb2b('0xe'),_0x15e870,_0x307bca[_0xfb2b('0x11')][_0xfb2b('0x12')]);return _0x40e1dd(_0x307bca['error'][_0xfb2b('0x12')]);}else{logger[_0xfb2b('0xd')](_0xfb2b('0xe'),_0x15e870,_0xfb2b('0xf'));_0x40e1dd(_0x307bca[_0xfb2b('0x13')][_0xfb2b('0x12')]);}})[_0xfb2b('0x14')](function(_0x527f6a){logger[_0xfb2b('0x11')](_0xfb2b('0xe'),_0x15e870,_0x527f6a);_0x1d4985(_0x527f6a);});});} \ No newline at end of file +var _0xd53c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','ZendeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x29b701,_0x2487a3){var _0x115e39=function(_0x539d12){while(--_0x539d12){_0x29b701['push'](_0x29b701['shift']());}};_0x115e39(++_0x2487a3);}(_0xd53c,0x1c8));var _0xcd53=function(_0x5a91bb,_0x437b6a){_0x5a91bb=_0x5a91bb-0x0;var _0x40327d=_0xd53c[_0x5a91bb];return _0x40327d;};'use strict';var _=require('lodash');var util=require(_0xcd53('0x0'));var moment=require(_0xcd53('0x1'));var BPromise=require(_0xcd53('0x2'));var rs=require(_0xcd53('0x3'));var fs=require('fs');var Redis=require(_0xcd53('0x4'));var db=require(_0xcd53('0x5'))['db'];var utils=require(_0xcd53('0x6'));var logger=require(_0xcd53('0x7'))(_0xcd53('0x8'));var config=require(_0xcd53('0x9'));var jayson=require(_0xcd53('0xa'));var client=jayson[_0xcd53('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x211e8d,_0x4f140b,_0x50ca43){return new BPromise(function(_0xfb6135,_0x30e955){return client[_0xcd53('0xc')](_0x211e8d,_0x50ca43)[_0xcd53('0xd')](function(_0x4f972a){logger[_0xcd53('0xe')]('ZendeskField,\x20%s,\x20%s',_0x4f140b,_0xcd53('0xf'));logger[_0xcd53('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4f140b,_0xcd53('0xf'),JSON[_0xcd53('0x11')](_0x4f972a));if(_0x4f972a['error']){if(_0x4f972a[_0xcd53('0x12')]['code']===0x1f4){logger[_0xcd53('0x12')](_0xcd53('0x13'),_0x4f140b,_0x4f972a[_0xcd53('0x12')]['message']);return _0x30e955(_0x4f972a[_0xcd53('0x12')][_0xcd53('0x14')]);}logger['error'](_0xcd53('0x13'),_0x4f140b,_0x4f972a['error']['message']);return _0xfb6135(_0x4f972a[_0xcd53('0x12')][_0xcd53('0x14')]);}else{logger['info'](_0xcd53('0x13'),_0x4f140b,'request\x20sent');_0xfb6135(_0x4f972a[_0xcd53('0x15')][_0xcd53('0x14')]);}})[_0xcd53('0x16')](function(_0x5e8b12){logger[_0xcd53('0x12')](_0xcd53('0x13'),_0x4f140b,_0x5e8b12);_0x30e955(_0x5e8b12);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 61dcf63..9be5737 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 _0x50a7=['/:id/configurations','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0x50a7,0x155));var _0x750a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x50a7[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require(_0x750a('0x0'));var path=require(_0x750a('0x1'));var timeout=require(_0x750a('0x2'));var express=require(_0x750a('0x3'));var router=express[_0x750a('0x4')]();var fs_extra=require(_0x750a('0x5'));var auth=require(_0x750a('0x6'));var interaction=require(_0x750a('0x7'));var config=require(_0x750a('0x8'));var controller=require(_0x750a('0x9'));router[_0x750a('0xa')]('/',auth[_0x750a('0xb')](),controller['index']);router[_0x750a('0xa')](_0x750a('0xc'),auth['isAuthenticated'](),controller[_0x750a('0xd')]);router[_0x750a('0xa')]('/:id/configurations',auth[_0x750a('0xb')](),controller[_0x750a('0xe')]);router[_0x750a('0xa')](_0x750a('0xf'),auth[_0x750a('0xb')](),controller[_0x750a('0x10')]);router[_0x750a('0x11')]('/',auth[_0x750a('0xb')](),controller[_0x750a('0x12')]);router[_0x750a('0x11')](_0x750a('0x13'),auth[_0x750a('0xb')](),controller['addConfiguration']);router[_0x750a('0x14')](_0x750a('0xc'),auth[_0x750a('0xb')](),controller[_0x750a('0x15')]);router['delete'](_0x750a('0xc'),auth[_0x750a('0xb')](),controller[_0x750a('0x16')]);module[_0x750a('0x17')]=router; \ No newline at end of file +var _0x12dc=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x39209f,_0x259ba5){var _0xcc32a3=function(_0x583bf9){while(--_0x583bf9){_0x39209f['push'](_0x39209f['shift']());}};_0xcc32a3(++_0x259ba5);}(_0x12dc,0x15e));var _0xc12d=function(_0x2173ae,_0x2763cd){_0x2173ae=_0x2173ae-0x0;var _0x15d425=_0x12dc[_0x2173ae];return _0x15d425;};'use strict';var multer=require(_0xc12d('0x0'));var util=require('util');var path=require(_0xc12d('0x1'));var timeout=require(_0xc12d('0x2'));var express=require(_0xc12d('0x3'));var router=express['Router']();var fs_extra=require(_0xc12d('0x4'));var auth=require(_0xc12d('0x5'));var interaction=require(_0xc12d('0x6'));var config=require(_0xc12d('0x7'));var controller=require('./intZohoAccount.controller');router[_0xc12d('0x8')]('/',auth[_0xc12d('0x9')](),controller['index']);router[_0xc12d('0x8')](_0xc12d('0xa'),auth[_0xc12d('0x9')](),controller[_0xc12d('0xb')]);router[_0xc12d('0x8')](_0xc12d('0xc'),auth[_0xc12d('0x9')](),controller[_0xc12d('0xd')]);router[_0xc12d('0x8')](_0xc12d('0xe'),auth[_0xc12d('0x9')](),controller[_0xc12d('0xf')]);router[_0xc12d('0x10')]('/',auth['isAuthenticated'](),controller[_0xc12d('0x11')]);router[_0xc12d('0x10')](_0xc12d('0xc'),auth[_0xc12d('0x9')](),controller['addConfiguration']);router[_0xc12d('0x12')](_0xc12d('0xa'),auth[_0xc12d('0x9')](),controller[_0xc12d('0x13')]);router[_0xc12d('0x14')]('/:id',auth[_0xc12d('0x9')](),controller[_0xc12d('0x15')]);module[_0xc12d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ab3907b..06de486 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 _0x153f=['exports','STRING','sequelize'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x153f,0x15b));var _0xf153=function(_0x2208de,_0x3b8313){_0x2208de=_0x2208de-0x0;var _0x98981a=_0x153f[_0x2208de];return _0x98981a;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')]},'description':{'type':Sequelize[_0xf153('0x2')]},'host':{'type':Sequelize[_0xf153('0x2')]},'zone':{'type':Sequelize[_0xf153('0x2')]},'clientId':{'type':Sequelize[_0xf153('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf153('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file +var _0x9f62=['exports','STRING'];(function(_0x513c6f,_0x1f244e){var _0x11da03=function(_0x51155d){while(--_0x51155d){_0x513c6f['push'](_0x513c6f['shift']());}};_0x11da03(++_0x1f244e);}(_0x9f62,0x154));var _0x29f6=function(_0x194d03,_0x3ffcf1){_0x194d03=_0x194d03-0x0;var _0x2b52cb=_0x9f62[_0x194d03];return _0x2b52cb;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29f6('0x1')]},'host':{'type':Sequelize[_0x29f6('0x1')]},'zone':{'type':Sequelize[_0x29f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x29f6('0x1')]},'refreshToken':{'type':Sequelize[_0x29f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 612a8fa..6a79aad 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 _0x58bb=['fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','include','then','rows','catch','params','length','create','body','find','ZohoConfiguration','fields','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientId','serverUrl','code','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','name','send','ZohoAccount','rawAttributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x58bb,0x1ce));var _0xb58b=function(_0x33bd2e,_0x44007d){_0x33bd2e=_0x33bd2e-0x0;var _0x4dcb50=_0x58bb[_0x33bd2e];return _0x4dcb50;};'use strict';var emlformat=require(_0xb58b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb58b('0x1'));var rp=require(_0xb58b('0x2'));var moment=require(_0xb58b('0x3'));var BPromise=require(_0xb58b('0x4'));var Mustache=require(_0xb58b('0x5'));var util=require(_0xb58b('0x6'));var path=require('path');var sox=require(_0xb58b('0x7'));var csv=require(_0xb58b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb58b('0x9'));var _=require(_0xb58b('0xa'));var squel=require('squel');var crypto=require(_0xb58b('0xb'));var jsforce=require(_0xb58b('0xc'));var deskjs=require(_0xb58b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb58b('0xe'));var Papa=require(_0xb58b('0xf'));var Redis=require('ioredis');var authService=require(_0xb58b('0x10'));var qs=require(_0xb58b('0x11'));var as=require(_0xb58b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb58b('0x13'))('api');var utils=require(_0xb58b('0x14'));var config=require(_0xb58b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb58b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f1992,_0x5ec552){_0x5ec552=_0x5ec552||0xcc;return function(_0x51b29c){if(_0x51b29c){return _0x4f1992[_0xb58b('0x17')](_0x5ec552);}return _0x4f1992[_0xb58b('0x18')](_0x5ec552)[_0xb58b('0x19')]();};}function respondWithResult(_0x285c74,_0x619de){_0x619de=_0x619de||0xc8;return function(_0x508f58){if(_0x508f58){return _0x285c74['status'](_0x619de)[_0xb58b('0x1a')](_0x508f58);}};}function respondWithFilteredResult(_0x40d9e1,_0x4482b1){return function(_0x5215f9){if(_0x5215f9){var _0x5f1dab=typeof _0x4482b1['offset']===_0xb58b('0x1b')&&typeof _0x4482b1[_0xb58b('0x1c')]===_0xb58b('0x1b');var _0x4ae712=_0x5215f9[_0xb58b('0x1d')];var _0x3b5403=_0x5f1dab?0x0:_0x4482b1[_0xb58b('0x1e')];var _0x4cb0e6=_0x5f1dab?_0x5215f9['count']:_0x4482b1[_0xb58b('0x1e')]+_0x4482b1[_0xb58b('0x1c')];var _0x4e7fed;if(_0x4cb0e6>=_0x4ae712){_0x4cb0e6=_0x4ae712;_0x4e7fed=0xc8;}else{_0x4e7fed=0xce;}_0x40d9e1[_0xb58b('0x18')](_0x4e7fed);return _0x40d9e1[_0xb58b('0x1f')](_0xb58b('0x20'),_0x3b5403+'-'+_0x4cb0e6+'/'+_0x4ae712)[_0xb58b('0x1a')](_0x5215f9);}return null;};}function patchUpdates(_0x3c7911){return function(_0xa82991){try{jsonpatch['apply'](_0xa82991,_0x3c7911,!![]);}catch(_0x5486ba){return BPromise[_0xb58b('0x21')](_0x5486ba);}return _0xa82991[_0xb58b('0x22')]();};}function saveUpdates(_0x38006f,_0x4381e3){return function(_0x22f1a9){if(_0x22f1a9){return _0x22f1a9[_0xb58b('0x23')](_0x38006f)['then'](function(_0x1ed157){return _0x1ed157;});}return null;};}function removeEntity(_0x5855e2,_0x374377){return function(_0x230c10){if(_0x230c10){return _0x230c10[_0xb58b('0x24')]()['then'](function(){_0x5855e2[_0xb58b('0x18')](0xcc)[_0xb58b('0x19')]();});}};}function handleEntityNotFound(_0x265ce3,_0x510797){return function(_0x25d29b){if(!_0x25d29b){_0x265ce3['sendStatus'](0x194);}return _0x25d29b;};}function handleError(_0x1bef86,_0x5b5ee2){_0x5b5ee2=_0x5b5ee2||0x1f4;return function(_0x4f64d3){logger[_0xb58b('0x25')](_0x4f64d3['stack']);if(_0x4f64d3[_0xb58b('0x26')]){delete _0x4f64d3[_0xb58b('0x26')];}_0x1bef86['status'](_0x5b5ee2)[_0xb58b('0x27')](_0x4f64d3);};}exports['index']=function(_0x3c2179,_0xa8293a){var _0x1d35a3={},_0x387037={},_0x4f87fb={'count':0x0,'rows':[]};var _0x9afcce=_['map'](db[_0xb58b('0x28')][_0xb58b('0x29')],function(_0x574377){return{'name':_0x574377[_0xb58b('0x2a')],'type':_0x574377[_0xb58b('0x2b')][_0xb58b('0x2c')]};});_0x387037[_0xb58b('0x2d')]=_['map'](_0x9afcce,_0xb58b('0x26'));_0x387037[_0xb58b('0x2e')]=_[_0xb58b('0x2f')](_0x3c2179[_0xb58b('0x2e')]);_0x387037[_0xb58b('0x30')]=_[_0xb58b('0x31')](_0x387037['model'],_0x387037['query']);_0x1d35a3[_0xb58b('0x32')]=_[_0xb58b('0x31')](_0x387037[_0xb58b('0x2d')],qs['fields'](_0x3c2179[_0xb58b('0x2e')]['fields']));_0x1d35a3['attributes']=_0x1d35a3[_0xb58b('0x32')]['length']?_0x1d35a3[_0xb58b('0x32')]:_0x387037[_0xb58b('0x2d')];if(!_0x3c2179[_0xb58b('0x2e')]['hasOwnProperty'](_0xb58b('0x33'))){_0x1d35a3[_0xb58b('0x1c')]=qs['limit'](_0x3c2179[_0xb58b('0x2e')][_0xb58b('0x1c')]);_0x1d35a3['offset']=qs[_0xb58b('0x1e')](_0x3c2179[_0xb58b('0x2e')][_0xb58b('0x1e')]);}_0x1d35a3[_0xb58b('0x34')]=qs[_0xb58b('0x35')](_0x3c2179['query']['sort']);_0x1d35a3[_0xb58b('0x36')]=qs[_0xb58b('0x30')](_[_0xb58b('0x37')](_0x3c2179[_0xb58b('0x2e')],_0x387037[_0xb58b('0x30')]),_0x9afcce);if(_0x3c2179[_0xb58b('0x2e')][_0xb58b('0x38')]){_0x1d35a3[_0xb58b('0x36')]=_['merge'](_0x1d35a3[_0xb58b('0x36')],{'$or':_[_0xb58b('0x39')](_0x9afcce,function(_0x2ec7cb){if(_0x2ec7cb[_0xb58b('0x2b')]!=='VIRTUAL'){var _0x341eea={};_0x341eea[_0x2ec7cb[_0xb58b('0x26')]]={'$like':'%'+_0x3c2179[_0xb58b('0x2e')][_0xb58b('0x38')]+'%'};return _0x341eea;}})});}_0x1d35a3=_[_0xb58b('0x3a')]({},_0x1d35a3,_0x3c2179[_0xb58b('0x3b')]);var _0x1b3535={'where':_0x1d35a3[_0xb58b('0x36')]};return db[_0xb58b('0x28')][_0xb58b('0x1d')](_0x1b3535)['then'](function(_0x3c8af7){_0x4f87fb[_0xb58b('0x1d')]=_0x3c8af7;if(_0x3c2179[_0xb58b('0x2e')][_0xb58b('0x3c')]){_0x1d35a3[_0xb58b('0x3d')]=[{'all':!![]}];}return db[_0xb58b('0x28')]['findAll'](_0x1d35a3);})[_0xb58b('0x3e')](function(_0x5f0957){_0x4f87fb[_0xb58b('0x3f')]=_0x5f0957;return _0x4f87fb;})['then'](respondWithFilteredResult(_0xa8293a,_0x1d35a3))[_0xb58b('0x40')](handleError(_0xa8293a,null));};exports['show']=function(_0x3ce4ec,_0xac1d74){var _0x398611={'raw':![],'where':{'id':_0x3ce4ec[_0xb58b('0x41')]['id']}},_0x1240aa={};_0x1240aa['model']=_[_0xb58b('0x2f')](db[_0xb58b('0x28')][_0xb58b('0x29')]);_0x1240aa[_0xb58b('0x2e')]=_[_0xb58b('0x2f')](_0x3ce4ec[_0xb58b('0x2e')]);_0x1240aa[_0xb58b('0x30')]=_['intersection'](_0x1240aa['model'],_0x1240aa[_0xb58b('0x2e')]);_0x398611['attributes']=_[_0xb58b('0x31')](_0x1240aa[_0xb58b('0x2d')],qs['fields'](_0x3ce4ec[_0xb58b('0x2e')]['fields']));_0x398611[_0xb58b('0x32')]=_0x398611[_0xb58b('0x32')][_0xb58b('0x42')]?_0x398611[_0xb58b('0x32')]:_0x1240aa[_0xb58b('0x2d')];if(_0x3ce4ec[_0xb58b('0x2e')][_0xb58b('0x3c')]){_0x398611[_0xb58b('0x3d')]=[{'all':!![]}];}_0x398611=_[_0xb58b('0x3a')]({},_0x398611,_0x3ce4ec[_0xb58b('0x3b')]);return db[_0xb58b('0x28')]['find'](_0x398611)[_0xb58b('0x3e')](handleEntityNotFound(_0xac1d74,null))['then'](respondWithResult(_0xac1d74,null))[_0xb58b('0x40')](handleError(_0xac1d74,null));};exports['create']=function(_0x34cfae,_0x14e81e){return db[_0xb58b('0x28')][_0xb58b('0x43')](_0x34cfae[_0xb58b('0x44')],{})[_0xb58b('0x3e')](respondWithResult(_0x14e81e,0xc9))[_0xb58b('0x40')](handleError(_0x14e81e,null));};exports[_0xb58b('0x23')]=function(_0xdae838,_0x31f6b7){if(_0xdae838['body']['id']){delete _0xdae838['body']['id'];}return db[_0xb58b('0x28')][_0xb58b('0x45')]({'where':{'id':_0xdae838['params']['id']}})[_0xb58b('0x3e')](handleEntityNotFound(_0x31f6b7,null))[_0xb58b('0x3e')](saveUpdates(_0xdae838[_0xb58b('0x44')],null))['then'](respondWithResult(_0x31f6b7,null))['catch'](handleError(_0x31f6b7,null));};exports[_0xb58b('0x24')]=function(_0x2ff768,_0x2a9302){return db['ZohoAccount']['find']({'where':{'id':_0x2ff768[_0xb58b('0x41')]['id']}})[_0xb58b('0x3e')](handleEntityNotFound(_0x2a9302,null))[_0xb58b('0x3e')](removeEntity(_0x2a9302,null))['catch'](handleError(_0x2a9302,null));};exports['getConfigurations']=function(_0x155e64,_0x2e4c47,_0x529b10){var _0x19607e={};var _0xb20e2d={};var _0x4525f5;var _0x46a706;return db[_0xb58b('0x28')]['findOne']({'where':{'id':_0x155e64[_0xb58b('0x41')]['id']}})[_0xb58b('0x3e')](handleEntityNotFound(_0x2e4c47,null))[_0xb58b('0x3e')](function(_0x307fba){if(_0x307fba){_0x4525f5=_0x307fba;_0xb20e2d[_0xb58b('0x2d')]=_['keys'](db[_0xb58b('0x46')]['rawAttributes']);_0xb20e2d[_0xb58b('0x2e')]=_['keys'](_0x155e64['query']);_0xb20e2d[_0xb58b('0x30')]=_[_0xb58b('0x31')](_0xb20e2d[_0xb58b('0x2d')],_0xb20e2d[_0xb58b('0x2e')]);_0x19607e['attributes']=_[_0xb58b('0x31')](_0xb20e2d[_0xb58b('0x2d')],qs[_0xb58b('0x47')](_0x155e64['query'][_0xb58b('0x47')]));_0x19607e[_0xb58b('0x32')]=_0x19607e[_0xb58b('0x32')][_0xb58b('0x42')]?_0x19607e[_0xb58b('0x32')]:_0xb20e2d['model'];_0x19607e['order']=qs[_0xb58b('0x35')](_0x155e64['query'][_0xb58b('0x35')]);_0x19607e[_0xb58b('0x36')]=qs['filters'](_['pick'](_0x155e64['query'],_0xb20e2d['filters']));if(_0x155e64[_0xb58b('0x2e')][_0xb58b('0x38')]){_0x19607e[_0xb58b('0x36')]=_[_0xb58b('0x3a')](_0x19607e[_0xb58b('0x36')],{'$or':_[_0xb58b('0x39')](_0x19607e[_0xb58b('0x32')],function(_0x3380e5){var _0x2afe32={};_0x2afe32[_0x3380e5]={'$like':'%'+_0x155e64[_0xb58b('0x2e')][_0xb58b('0x38')]+'%'};return _0x2afe32;})});}_0x19607e=_[_0xb58b('0x3a')]({},_0x19607e,_0x155e64[_0xb58b('0x3b')]);return _0x4525f5[_0xb58b('0x48')](_0x19607e);}})[_0xb58b('0x3e')](function(_0x3aabb8){if(_0x3aabb8){_0x46a706=_0x3aabb8[_0xb58b('0x42')];if(!_0x155e64[_0xb58b('0x2e')][_0xb58b('0x49')](_0xb58b('0x33'))){_0x19607e[_0xb58b('0x1c')]=qs['limit'](_0x155e64[_0xb58b('0x2e')][_0xb58b('0x1c')]);_0x19607e['offset']=qs[_0xb58b('0x1e')](_0x155e64[_0xb58b('0x2e')][_0xb58b('0x1e')]);}return _0x4525f5[_0xb58b('0x48')](_0x19607e);}})[_0xb58b('0x3e')](function(_0x2bdbdc){if(_0x2bdbdc){return _0x2bdbdc?{'count':_0x46a706,'rows':_0x2bdbdc}:null;}})[_0xb58b('0x3e')](respondWithResult(_0x2e4c47,null))[_0xb58b('0x40')](handleError(_0x2e4c47,null));};exports[_0xb58b('0x4a')]=function(_0x3f60e0,_0x48359f,_0x30059c){if(_0x3f60e0[_0xb58b('0x44')]['id']){delete _0x3f60e0['body']['id'];}return db[_0xb58b('0x28')]['findOne']({'where':{'id':_0x3f60e0[_0xb58b('0x41')]['id']}})['then'](handleEntityNotFound(_0x48359f,null))[_0xb58b('0x3e')](function(_0xbb58f7){if(_0xbb58f7){_0x3f60e0[_0xb58b('0x44')]['AccountId']=_0xbb58f7['id'];_0x3f60e0[_0xb58b('0x44')][_0xb58b('0x4b')]=integrations[_0xb58b('0x4c')](_0x3f60e0[_0xb58b('0x44')][_0xb58b('0x4d')],_0x3f60e0['body'][_0xb58b('0x2b')]);_0x3f60e0[_0xb58b('0x44')][_0xb58b('0x4e')]=integrations[_0xb58b('0x4f')](_0x3f60e0[_0xb58b('0x44')][_0xb58b('0x4d')],_0x3f60e0[_0xb58b('0x44')][_0xb58b('0x2b')]);return db[_0xb58b('0x46')][_0xb58b('0x43')](_0x3f60e0[_0xb58b('0x44')],{'include':[{'model':db[_0xb58b('0x50')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xb58b('0x4e')}]});}return null;})['then'](respondWithResult(_0x48359f,null))[_0xb58b('0x40')](handleError(_0x48359f,null));};function getAccessToken(_0x1c00dd){return new Promise(function(_0x22beee,_0x43c234){var _0x592b42;switch(_0x1c00dd[_0xb58b('0x51')]){case'US':_0x592b42=_0xb58b('0x52');break;case'AU':_0x592b42='https://accounts.zoho.com.au';break;case'EU':_0x592b42=_0xb58b('0x53');break;case'IN':_0x592b42=_0xb58b('0x54');break;case'CN':_0x592b42=_0xb58b('0x55');break;default:_0x592b42=_0xb58b('0x53');break;}var _0x48fc7e={'method':_0xb58b('0x56'),'uri':_0x592b42+_0xb58b('0x57'),'qs':{'refresh_token':_0x1c00dd[_0xb58b('0x58')],'client_id':_0x1c00dd['clientId'],'client_secret':_0x1c00dd[_0xb58b('0x59')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x48fc7e)['then'](function(_0x2135ef){if(_0x2135ef['access_token']){_0x22beee(_0x2135ef[_0xb58b('0x5a')]);}else{_0x43c234(_0xb58b('0x5b'));}})['catch'](function(_0x2f0f88){_0x43c234(_0x2f0f88);});});}exports['getFields']=function(_0x2a4aea,_0x1f9d8c,_0x1792ad){var _0x4c5335,_0x262b5e,_0x49f741,_0x5b1565,_0x5d410e;return db[_0xb58b('0x28')]['findOne']({'where':{'id':_0x2a4aea[_0xb58b('0x41')]['id']},'attributes':['id','host',_0xb58b('0x51'),_0xb58b('0x5c'),_0xb58b('0x59'),_0xb58b('0x5d'),_0xb58b('0x5e'),_0xb58b('0x58')]})[_0xb58b('0x3e')](handleEntityNotFound(_0x1f9d8c,null))[_0xb58b('0x3e')](function(_0x4ca142){_0x5d410e=_0x4ca142;_0x4c5335=_0x5d410e[_0xb58b('0x5f')];_0x262b5e=_0x4c5335===_0xb58b('0x60')?'eu':_0xb58b('0x61');_0x49f741=_0x5d410e[_0xb58b('0x5d')];var _0xaf8c0c=_0x49f741[_0xb58b('0x62')](-0x1);if(_0xaf8c0c==='/'||_0xaf8c0c==='\x5c'||_0xaf8c0c===':'){_0x49f741=_0x49f741['substring'](0x0,_0x49f741[_0xb58b('0x63')](_0xaf8c0c));}if(!_0x5d410e[_0xb58b('0x58')]){throw new Error(_0xb58b('0x64'));}return getAccessToken(_0x5d410e);})[_0xb58b('0x3e')](function(_0x2aa8bd){if(_0x2aa8bd){return rp({'method':'GET','uri':util[_0xb58b('0x65')](_0xb58b('0x66'),_0x262b5e),'qs':{'module':_0xb58b('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2aa8bd},'json':!![]});}})[_0xb58b('0x3e')](function(_0x4661e2){if(_0x4661e2){if(_0x4661e2[_0xb58b('0x68')]&&_0x4661e2[_0xb58b('0x68')][_0xb58b('0x25')]){throw new Error(_0x4661e2[_0xb58b('0x68')][_0xb58b('0x25')][_0xb58b('0x69')]);}var _0x1b70ff=[];var _0x425c3b=[];var _0x5dfe13=[_0xb58b('0x6a'),_0xb58b('0x6b'),_0xb58b('0x6c'),'WhoId',_0xb58b('0x6d'),_0xb58b('0x6e'),_0xb58b('0x6f'),'Call_Type'];_0x425c3b=_[_0xb58b('0x70')](_0x4661e2['fields'],function(_0x46c863){return _0x5dfe13[_0xb58b('0x71')](_0x46c863[_0xb58b('0x72')]);});for(var _0x167da6=0x0;_0x167da6<_0x425c3b['length'];_0x167da6++){if(_0x425c3b[_0x167da6]['system_mandatory']===![]){_0x1b70ff['push']({'id':_0x425c3b[_0x167da6]['id'],'name':_0x425c3b[_0x167da6][_0xb58b('0x73')],'custom':_0x425c3b[_0x167da6][_0xb58b('0x74')],'options':_0x425c3b[_0x167da6][_0xb58b('0x75')]===_0xb58b('0x76')&&_0x425c3b[_0x167da6][_0xb58b('0x77')]['length']>-0x1?_['map'](_0x425c3b[_0x167da6][_0xb58b('0x77')],function(_0x5aa678){return{'name':_0x5aa678,'value':_0x5aa678};}):[]});}}return{'count':_0x1b70ff['length'],'rows':_0x1b70ff};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1f9d8c,null))[_0xb58b('0x40')](function(_0x33e277){var _0x4c85e4=_0x2a4aea[_0xb58b('0x2e')][_0xb58b('0x78')]?0x1f4:_0x33e277[_0xb58b('0x79')]||0x1f4;logger[_0xb58b('0x25')](_0xb58b('0x7a'),_0xb58b('0x7b'),_0x4c85e4,JSON[_0xb58b('0x7c')](_0x33e277));delete _0x33e277[_0xb58b('0x26')];if(_0x4c85e4===0x191){_0x4c85e4=0x190;}_0x1f9d8c[_0xb58b('0x18')](_0x4c85e4)[_0xb58b('0x27')](_0x2a4aea['query'][_0xb58b('0x78')]?{'message':_0xb58b('0x7d'),'statusCode':_0x33e277[_0xb58b('0x79')]}:_0x33e277);});}; \ No newline at end of file +var _0x46bd=['ZohoConfiguration','getConfigurations','hasOwnProperty','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','findOne','host','serverUrl','code','refreshToken','com','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Description','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','ZohoAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','create','body','find','params'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x46bd,0x1ae));var _0xd46b=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46bd[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd46b('0x0'));var zipdir=require(_0xd46b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd46b('0x2'));var BPromise=require(_0xd46b('0x3'));var Mustache=require(_0xd46b('0x4'));var util=require(_0xd46b('0x5'));var path=require(_0xd46b('0x6'));var sox=require('sox');var csv=require(_0xd46b('0x7'));var ejs=require(_0xd46b('0x8'));var fs=require('fs');var fs_extra=require(_0xd46b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd46b('0xa'));var jsforce=require(_0xd46b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd46b('0x7'));var querystring=require(_0xd46b('0xc'));var Papa=require(_0xd46b('0xd'));var Redis=require(_0xd46b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd46b('0xf'));var as=require(_0xd46b('0x10'));var hardwareService=require(_0xd46b('0x11'));var logger=require(_0xd46b('0x12'))(_0xd46b('0x13'));var utils=require(_0xd46b('0x14'));var config=require(_0xd46b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46b('0x16'))['db'];var integrations=require(_0xd46b('0x17'));function respondWithStatusCode(_0x15e0cb,_0x28b6d5){_0x28b6d5=_0x28b6d5||0xcc;return function(_0xb19084){if(_0xb19084){return _0x15e0cb[_0xd46b('0x18')](_0x28b6d5);}return _0x15e0cb[_0xd46b('0x19')](_0x28b6d5)[_0xd46b('0x1a')]();};}function respondWithResult(_0xb7fed4,_0x228407){_0x228407=_0x228407||0xc8;return function(_0x5306a2){if(_0x5306a2){return _0xb7fed4['status'](_0x228407)[_0xd46b('0x1b')](_0x5306a2);}};}function respondWithFilteredResult(_0xc3f18b,_0x1dd56a){return function(_0x2cb443){if(_0x2cb443){var _0xe12320=typeof _0x1dd56a[_0xd46b('0x1c')]===_0xd46b('0x1d')&&typeof _0x1dd56a[_0xd46b('0x1e')]===_0xd46b('0x1d');var _0x14da6d=_0x2cb443[_0xd46b('0x1f')];var _0x4e819c=_0xe12320?0x0:_0x1dd56a[_0xd46b('0x1c')];var _0x529e24=_0xe12320?_0x2cb443[_0xd46b('0x1f')]:_0x1dd56a[_0xd46b('0x1c')]+_0x1dd56a[_0xd46b('0x1e')];var _0x3c381a;if(_0x529e24>=_0x14da6d){_0x529e24=_0x14da6d;_0x3c381a=0xc8;}else{_0x3c381a=0xce;}_0xc3f18b[_0xd46b('0x19')](_0x3c381a);return _0xc3f18b[_0xd46b('0x20')](_0xd46b('0x21'),_0x4e819c+'-'+_0x529e24+'/'+_0x14da6d)[_0xd46b('0x1b')](_0x2cb443);}return null;};}function patchUpdates(_0x49d606){return function(_0x3b4d07){try{jsonpatch[_0xd46b('0x22')](_0x3b4d07,_0x49d606,!![]);}catch(_0x39c20d){return BPromise[_0xd46b('0x23')](_0x39c20d);}return _0x3b4d07[_0xd46b('0x24')]();};}function saveUpdates(_0x131d4f,_0x1f8ad0){return function(_0x11d8a0){if(_0x11d8a0){return _0x11d8a0[_0xd46b('0x25')](_0x131d4f)[_0xd46b('0x26')](function(_0x47dff6){return _0x47dff6;});}return null;};}function removeEntity(_0x4cf592,_0x278104){return function(_0x8ea718){if(_0x8ea718){return _0x8ea718[_0xd46b('0x27')]()[_0xd46b('0x26')](function(){_0x4cf592[_0xd46b('0x19')](0xcc)[_0xd46b('0x1a')]();});}};}function handleEntityNotFound(_0x3ff234,_0x2a26e9){return function(_0x5295db){if(!_0x5295db){_0x3ff234[_0xd46b('0x18')](0x194);}return _0x5295db;};}function handleError(_0x30a7b8,_0x558bc0){_0x558bc0=_0x558bc0||0x1f4;return function(_0x5eebe7){logger['error'](_0x5eebe7[_0xd46b('0x28')]);if(_0x5eebe7['name']){delete _0x5eebe7[_0xd46b('0x29')];}_0x30a7b8[_0xd46b('0x19')](_0x558bc0)[_0xd46b('0x2a')](_0x5eebe7);};}exports['index']=function(_0x47d5c8,_0x27ac05){var _0x34a383={},_0x146a78={},_0x4346b7={'count':0x0,'rows':[]};var _0x4b7f2b=_['map'](db[_0xd46b('0x2b')][_0xd46b('0x2c')],function(_0x1387c0){return{'name':_0x1387c0[_0xd46b('0x2d')],'type':_0x1387c0['type'][_0xd46b('0x2e')]};});_0x146a78[_0xd46b('0x2f')]=_[_0xd46b('0x30')](_0x4b7f2b,_0xd46b('0x29'));_0x146a78[_0xd46b('0x31')]=_[_0xd46b('0x32')](_0x47d5c8[_0xd46b('0x31')]);_0x146a78[_0xd46b('0x33')]=_[_0xd46b('0x34')](_0x146a78['model'],_0x146a78['query']);_0x34a383[_0xd46b('0x35')]=_[_0xd46b('0x34')](_0x146a78[_0xd46b('0x2f')],qs[_0xd46b('0x36')](_0x47d5c8[_0xd46b('0x31')][_0xd46b('0x36')]));_0x34a383['attributes']=_0x34a383[_0xd46b('0x35')][_0xd46b('0x37')]?_0x34a383[_0xd46b('0x35')]:_0x146a78[_0xd46b('0x2f')];if(!_0x47d5c8[_0xd46b('0x31')]['hasOwnProperty']('nolimit')){_0x34a383['limit']=qs[_0xd46b('0x1e')](_0x47d5c8['query'][_0xd46b('0x1e')]);_0x34a383[_0xd46b('0x1c')]=qs['offset'](_0x47d5c8[_0xd46b('0x31')]['offset']);}_0x34a383[_0xd46b('0x38')]=qs[_0xd46b('0x39')](_0x47d5c8[_0xd46b('0x31')][_0xd46b('0x39')]);_0x34a383[_0xd46b('0x3a')]=qs['filters'](_[_0xd46b('0x3b')](_0x47d5c8[_0xd46b('0x31')],_0x146a78[_0xd46b('0x33')]),_0x4b7f2b);if(_0x47d5c8['query']['filter']){_0x34a383[_0xd46b('0x3a')]=_[_0xd46b('0x3c')](_0x34a383[_0xd46b('0x3a')],{'$or':_[_0xd46b('0x30')](_0x4b7f2b,function(_0x371839){if(_0x371839[_0xd46b('0x3d')]!==_0xd46b('0x3e')){var _0x2f0e43={};_0x2f0e43[_0x371839[_0xd46b('0x29')]]={'$like':'%'+_0x47d5c8[_0xd46b('0x31')][_0xd46b('0x3f')]+'%'};return _0x2f0e43;}})});}_0x34a383=_[_0xd46b('0x3c')]({},_0x34a383,_0x47d5c8[_0xd46b('0x40')]);var _0x434e12={'where':_0x34a383[_0xd46b('0x3a')]};return db['ZohoAccount'][_0xd46b('0x1f')](_0x434e12)[_0xd46b('0x26')](function(_0x2616f7){_0x4346b7['count']=_0x2616f7;if(_0x47d5c8['query'][_0xd46b('0x41')]){_0x34a383[_0xd46b('0x42')]=[{'all':!![]}];}return db[_0xd46b('0x2b')][_0xd46b('0x43')](_0x34a383);})['then'](function(_0x211bbf){_0x4346b7['rows']=_0x211bbf;return _0x4346b7;})['then'](respondWithFilteredResult(_0x27ac05,_0x34a383))[_0xd46b('0x44')](handleError(_0x27ac05,null));};exports[_0xd46b('0x45')]=function(_0x5ad2d2,_0x494777){var _0x28e381={'raw':![],'where':{'id':_0x5ad2d2['params']['id']}},_0x11f569={};_0x11f569[_0xd46b('0x2f')]=_['keys'](db['ZohoAccount'][_0xd46b('0x2c')]);_0x11f569[_0xd46b('0x31')]=_['keys'](_0x5ad2d2[_0xd46b('0x31')]);_0x11f569[_0xd46b('0x33')]=_[_0xd46b('0x34')](_0x11f569[_0xd46b('0x2f')],_0x11f569[_0xd46b('0x31')]);_0x28e381[_0xd46b('0x35')]=_[_0xd46b('0x34')](_0x11f569[_0xd46b('0x2f')],qs[_0xd46b('0x36')](_0x5ad2d2['query']['fields']));_0x28e381[_0xd46b('0x35')]=_0x28e381[_0xd46b('0x35')][_0xd46b('0x37')]?_0x28e381[_0xd46b('0x35')]:_0x11f569[_0xd46b('0x2f')];if(_0x5ad2d2[_0xd46b('0x31')][_0xd46b('0x41')]){_0x28e381[_0xd46b('0x42')]=[{'all':!![]}];}_0x28e381=_['merge']({},_0x28e381,_0x5ad2d2[_0xd46b('0x40')]);return db[_0xd46b('0x2b')]['find'](_0x28e381)[_0xd46b('0x26')](handleEntityNotFound(_0x494777,null))[_0xd46b('0x26')](respondWithResult(_0x494777,null))[_0xd46b('0x44')](handleError(_0x494777,null));};exports[_0xd46b('0x46')]=function(_0x29569a,_0x1cee3f){return db[_0xd46b('0x2b')]['create'](_0x29569a[_0xd46b('0x47')],{})[_0xd46b('0x26')](respondWithResult(_0x1cee3f,0xc9))[_0xd46b('0x44')](handleError(_0x1cee3f,null));};exports[_0xd46b('0x25')]=function(_0x543b59,_0xc3d541){if(_0x543b59[_0xd46b('0x47')]['id']){delete _0x543b59['body']['id'];}return db[_0xd46b('0x2b')]['find']({'where':{'id':_0x543b59['params']['id']}})[_0xd46b('0x26')](handleEntityNotFound(_0xc3d541,null))[_0xd46b('0x26')](saveUpdates(_0x543b59[_0xd46b('0x47')],null))['then'](respondWithResult(_0xc3d541,null))[_0xd46b('0x44')](handleError(_0xc3d541,null));};exports['destroy']=function(_0x3936d5,_0x2ba5d8){return db[_0xd46b('0x2b')][_0xd46b('0x48')]({'where':{'id':_0x3936d5['params']['id']}})[_0xd46b('0x26')](handleEntityNotFound(_0x2ba5d8,null))[_0xd46b('0x26')](removeEntity(_0x2ba5d8,null))[_0xd46b('0x44')](handleError(_0x2ba5d8,null));};exports['getConfigurations']=function(_0x367123,_0xd70b16,_0x19141c){var _0x3ec775={};var _0x744aac={};var _0x228ab4;var _0x2367f8;return db[_0xd46b('0x2b')]['findOne']({'where':{'id':_0x367123[_0xd46b('0x49')]['id']}})[_0xd46b('0x26')](handleEntityNotFound(_0xd70b16,null))[_0xd46b('0x26')](function(_0x2a597f){if(_0x2a597f){_0x228ab4=_0x2a597f;_0x744aac['model']=_[_0xd46b('0x32')](db[_0xd46b('0x4a')][_0xd46b('0x2c')]);_0x744aac['query']=_[_0xd46b('0x32')](_0x367123[_0xd46b('0x31')]);_0x744aac['filters']=_[_0xd46b('0x34')](_0x744aac[_0xd46b('0x2f')],_0x744aac['query']);_0x3ec775[_0xd46b('0x35')]=_[_0xd46b('0x34')](_0x744aac['model'],qs[_0xd46b('0x36')](_0x367123[_0xd46b('0x31')][_0xd46b('0x36')]));_0x3ec775[_0xd46b('0x35')]=_0x3ec775[_0xd46b('0x35')][_0xd46b('0x37')]?_0x3ec775[_0xd46b('0x35')]:_0x744aac[_0xd46b('0x2f')];_0x3ec775['order']=qs['sort'](_0x367123[_0xd46b('0x31')][_0xd46b('0x39')]);_0x3ec775[_0xd46b('0x3a')]=qs[_0xd46b('0x33')](_[_0xd46b('0x3b')](_0x367123[_0xd46b('0x31')],_0x744aac[_0xd46b('0x33')]));if(_0x367123['query'][_0xd46b('0x3f')]){_0x3ec775[_0xd46b('0x3a')]=_[_0xd46b('0x3c')](_0x3ec775[_0xd46b('0x3a')],{'$or':_[_0xd46b('0x30')](_0x3ec775[_0xd46b('0x35')],function(_0x20b448){var _0x5bc295={};_0x5bc295[_0x20b448]={'$like':'%'+_0x367123[_0xd46b('0x31')][_0xd46b('0x3f')]+'%'};return _0x5bc295;})});}_0x3ec775=_[_0xd46b('0x3c')]({},_0x3ec775,_0x367123[_0xd46b('0x40')]);return _0x228ab4[_0xd46b('0x4b')](_0x3ec775);}})[_0xd46b('0x26')](function(_0x1c8c6b){if(_0x1c8c6b){_0x2367f8=_0x1c8c6b[_0xd46b('0x37')];if(!_0x367123[_0xd46b('0x31')][_0xd46b('0x4c')](_0xd46b('0x4d'))){_0x3ec775['limit']=qs[_0xd46b('0x1e')](_0x367123['query'][_0xd46b('0x1e')]);_0x3ec775['offset']=qs['offset'](_0x367123[_0xd46b('0x31')][_0xd46b('0x1c')]);}return _0x228ab4[_0xd46b('0x4b')](_0x3ec775);}})[_0xd46b('0x26')](function(_0x2fd574){if(_0x2fd574){return _0x2fd574?{'count':_0x2367f8,'rows':_0x2fd574}:null;}})[_0xd46b('0x26')](respondWithResult(_0xd70b16,null))['catch'](handleError(_0xd70b16,null));};exports['addConfiguration']=function(_0x563dd9,_0x2b87a6,_0xc03176){if(_0x563dd9[_0xd46b('0x47')]['id']){delete _0x563dd9[_0xd46b('0x47')]['id'];}return db[_0xd46b('0x2b')]['findOne']({'where':{'id':_0x563dd9['params']['id']}})[_0xd46b('0x26')](handleEntityNotFound(_0x2b87a6,null))[_0xd46b('0x26')](function(_0x31b951){if(_0x31b951){_0x563dd9[_0xd46b('0x47')][_0xd46b('0x4e')]=_0x31b951['id'];_0x563dd9[_0xd46b('0x47')]['Subjects']=integrations[_0xd46b('0x4f')](_0x563dd9[_0xd46b('0x47')][_0xd46b('0x50')],_0x563dd9[_0xd46b('0x47')][_0xd46b('0x3d')]);_0x563dd9['body'][_0xd46b('0x51')]=integrations[_0xd46b('0x52')](_0x563dd9[_0xd46b('0x47')][_0xd46b('0x50')],_0x563dd9[_0xd46b('0x47')][_0xd46b('0x3d')]);return db['ZohoConfiguration'][_0xd46b('0x46')](_0x563dd9[_0xd46b('0x47')],{'include':[{'model':db[_0xd46b('0x53')],'as':_0xd46b('0x54')},{'model':db[_0xd46b('0x53')],'as':_0xd46b('0x51')}]});}return null;})[_0xd46b('0x26')](respondWithResult(_0x2b87a6,null))[_0xd46b('0x44')](handleError(_0x2b87a6,null));};function getAccessToken(_0x425343){return new Promise(function(_0x4805c3,_0x3951f4){var _0x52c882;switch(_0x425343[_0xd46b('0x55')]){case'US':_0x52c882=_0xd46b('0x56');break;case'AU':_0x52c882='https://accounts.zoho.com.au';break;case'EU':_0x52c882=_0xd46b('0x57');break;case'IN':_0x52c882='https://accounts.zoho.in';break;case'CN':_0x52c882=_0xd46b('0x58');break;default:_0x52c882=_0xd46b('0x57');break;}var _0x12ef0e={'method':'POST','uri':_0x52c882+_0xd46b('0x59'),'qs':{'refresh_token':_0x425343['refreshToken'],'client_id':_0x425343[_0xd46b('0x5a')],'client_secret':_0x425343[_0xd46b('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x12ef0e)['then'](function(_0x2bb368){if(_0x2bb368[_0xd46b('0x5c')]){_0x4805c3(_0x2bb368['access_token']);}else{_0x3951f4(_0xd46b('0x5d'));}})[_0xd46b('0x44')](function(_0x5e1dc1){_0x3951f4(_0x5e1dc1);});});}exports['getFields']=function(_0x5385a1,_0x12d17c,_0x523994){var _0x349dd2,_0x4f5b9b,_0x38c847,_0x466f8d,_0x3c36a7;return db[_0xd46b('0x2b')][_0xd46b('0x5e')]({'where':{'id':_0x5385a1[_0xd46b('0x49')]['id']},'attributes':['id',_0xd46b('0x5f'),_0xd46b('0x55'),_0xd46b('0x5a'),_0xd46b('0x5b'),_0xd46b('0x60'),_0xd46b('0x61'),_0xd46b('0x62')]})[_0xd46b('0x26')](handleEntityNotFound(_0x12d17c,null))[_0xd46b('0x26')](function(_0x4114e7){_0x3c36a7=_0x4114e7;_0x349dd2=_0x3c36a7[_0xd46b('0x5f')];_0x4f5b9b=_0x349dd2==='zoho.eu'?'eu':_0xd46b('0x63');_0x38c847=_0x3c36a7[_0xd46b('0x60')];var _0x379d88=_0x38c847['slice'](-0x1);if(_0x379d88==='/'||_0x379d88==='\x5c'||_0x379d88===':'){_0x38c847=_0x38c847[_0xd46b('0x64')](0x0,_0x38c847['lastIndexOf'](_0x379d88));}if(!_0x3c36a7['refreshToken']){throw new Error(_0xd46b('0x65'));}return getAccessToken(_0x3c36a7);})['then'](function(_0x185a30){if(_0x185a30){return rp({'method':_0xd46b('0x66'),'uri':util[_0xd46b('0x67')](_0xd46b('0x68'),_0x4f5b9b),'qs':{'module':_0xd46b('0x69')},'headers':{'Authorization':_0xd46b('0x6a')+_0x185a30},'json':!![]});}})[_0xd46b('0x26')](function(_0x8a5cd0){if(_0x8a5cd0){if(_0x8a5cd0[_0xd46b('0x6b')]&&_0x8a5cd0[_0xd46b('0x6b')][_0xd46b('0x6c')]){throw new Error(_0x8a5cd0[_0xd46b('0x6b')][_0xd46b('0x6c')]['message']);}var _0x3e5550=[];var _0x57fae7=[];var _0x4242ac=['Owner','Subject',_0xd46b('0x6d'),'WhoId',_0xd46b('0x6e'),_0xd46b('0x6f'),'Call_Start_Time',_0xd46b('0x70')];_0x57fae7=_[_0xd46b('0x71')](_0x8a5cd0['fields'],function(_0x241dcb){return _0x4242ac[_0xd46b('0x72')](_0x241dcb['api_name']);});for(var _0x305f1a=0x0;_0x305f1a<_0x57fae7[_0xd46b('0x37')];_0x305f1a++){if(_0x57fae7[_0x305f1a][_0xd46b('0x73')]===![]){_0x3e5550[_0xd46b('0x74')]({'id':_0x57fae7[_0x305f1a]['id'],'name':_0x57fae7[_0x305f1a][_0xd46b('0x75')],'custom':_0x57fae7[_0x305f1a][_0xd46b('0x76')],'options':_0x57fae7[_0x305f1a][_0xd46b('0x77')]===_0xd46b('0x78')&&_0x57fae7[_0x305f1a]['pick_list_values'][_0xd46b('0x37')]>-0x1?_[_0xd46b('0x30')](_0x57fae7[_0x305f1a][_0xd46b('0x79')],function(_0x11f866){return{'name':_0x11f866,'value':_0x11f866};}):[]});}}return{'count':_0x3e5550[_0xd46b('0x37')],'rows':_0x3e5550};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x12d17c,null))[_0xd46b('0x44')](function(_0x2060cc){var _0x584269=_0x5385a1[_0xd46b('0x31')][_0xd46b('0x7a')]?0x1f4:_0x2060cc['statusCode']||0x1f4;logger['error'](_0xd46b('0x7b'),_0xd46b('0x7c'),_0x584269,JSON['stringify'](_0x2060cc));delete _0x2060cc[_0xd46b('0x29')];if(_0x584269===0x191){_0x584269=0x190;}_0x12d17c['status'](_0x584269)[_0xd46b('0x2a')](_0x5385a1[_0xd46b('0x31')][_0xd46b('0x7a')]?{'message':_0xd46b('0x7d'),'statusCode':_0x2060cc['statusCode']}:_0x2060cc);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d4ff5cd..8ccc411 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 _0x478a=['refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error','host','https://accounts.zoho.com','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token'];(function(_0x53b7b4,_0x27ddec){var _0x31acf4=function(_0x3421d6){while(--_0x3421d6){_0x53b7b4['push'](_0x53b7b4['shift']());}};_0x31acf4(++_0x27ddec);}(_0x478a,0x185));var _0xa478=function(_0xa82b44,_0x5d8199){_0xa82b44=_0xa82b44-0x0;var _0x3ee63a=_0x478a[_0xa82b44];return _0x3ee63a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa478('0x0'))(_0xa478('0x1'));var moment=require(_0xa478('0x2'));var BPromise=require(_0xa478('0x3'));var rp=require(_0xa478('0x4'));var fs=require('fs');var path=require(_0xa478('0x5'));var rimraf=require('rimraf');var config=require(_0xa478('0x6'));var attributes=require(_0xa478('0x7'));var integrations=require(_0xa478('0x8'));module['exports']=function(_0x4a355e,_0x29fcd7){return _0x4a355e[_0xa478('0x9')](_0xa478('0xa'),attributes,{'tableName':_0xa478('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x302a1f,_0x79c647,_0x336f27){if(_0x302a1f[_0xa478('0xc')](_0xa478('0xd'))||_0x302a1f[_0xa478('0xc')](_0xa478('0xe'))||_0x302a1f[_0xa478('0xc')](_0xa478('0xf'))||_0x302a1f[_0xa478('0xc')](_0xa478('0x10'))||_0x302a1f[_0xa478('0xc')](_0xa478('0x11'))||_0x302a1f[_0xa478('0xc')]('host')){var _0x3528cd,_0x51c3fb;_0x3528cd=_0x302a1f[_0xa478('0xe')];var _0x2efee4=_0x3528cd[_0xa478('0x12')](-0x1);if(_0x2efee4==='/'||_0x2efee4==='\x5c'||_0x2efee4===':'){_0x3528cd=_0x3528cd[_0xa478('0x13')](0x0,_0x3528cd[_0xa478('0x14')](_0x2efee4));}switch(_0x302a1f[_0xa478('0xd')]){case'US':_0x51c3fb='https://accounts.zoho.com';break;case'AU':_0x51c3fb=_0xa478('0x15');break;case'IN':_0x51c3fb=_0xa478('0x16');break;case'CN':_0x51c3fb=_0xa478('0x17');break;default:_0x51c3fb=_0xa478('0x18');break;}var _0x299722={'method':_0xa478('0x19'),'uri':_0x51c3fb+_0xa478('0x1a'),'form':{'grant_type':_0xa478('0x1b'),'client_id':_0x302a1f[_0xa478('0xf')],'client_secret':_0x302a1f[_0xa478('0x10')],'redirect_uri':_0x302a1f[_0xa478('0xe')],'code':_0x302a1f[_0xa478('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x299722)[_0xa478('0x1c')](function(_0x236f80){var _0x11ca40=JSON[_0xa478('0x1d')](_0x236f80);if(_0x11ca40[_0xa478('0x1e')]){_0x302a1f[_0xa478('0x1f')]=_0x11ca40[_0xa478('0x1e')];logger[_0xa478('0x20')](util[_0xa478('0x21')](_0xa478('0x22'),_0x302a1f[_0xa478('0x23')],_0x302a1f['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x302a1f[_0xa478('0x23')],_0x302a1f['id']),util[_0xa478('0x24')](_0x11ca40,{'showHidden':![],'depth':null}));}return _0x336f27(null,_0x79c647);})['catch'](function(_0x49128d){logger[_0xa478('0x25')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x302a1f['name'],_0x302a1f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x336f27(_0x49128d);});}else{return _0x336f27(null,_0x79c647);}},'beforeUpdate':function(_0x1ef12c,_0x7491bf,_0x229901){if(_0x1ef12c[_0xa478('0xc')](_0xa478('0xd'))||_0x1ef12c[_0xa478('0xc')](_0xa478('0xe'))||_0x1ef12c['changed']('clientId')||_0x1ef12c[_0xa478('0xc')](_0xa478('0x10'))||_0x1ef12c['changed'](_0xa478('0x11'))||_0x1ef12c['changed'](_0xa478('0x26'))){var _0x2929bb,_0x41b60f;_0x2929bb=_0x1ef12c[_0xa478('0xe')];var _0x4f5a63=_0x2929bb[_0xa478('0x12')](-0x1);if(_0x4f5a63==='/'||_0x4f5a63==='\x5c'||_0x4f5a63===':'){_0x2929bb=_0x2929bb['substring'](0x0,_0x2929bb[_0xa478('0x14')](_0x4f5a63));}switch(_0x1ef12c[_0xa478('0xd')]){case'US':_0x41b60f=_0xa478('0x27');break;case'AU':_0x41b60f='https://accounts.zoho.com.au';break;case'IN':_0x41b60f=_0xa478('0x16');break;case'CN':_0x41b60f=_0xa478('0x17');break;default:_0x41b60f='https://accounts.zoho.eu';break;}var _0x2adf59={'method':_0xa478('0x19'),'uri':_0x41b60f+_0xa478('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x1ef12c[_0xa478('0xf')],'client_secret':_0x1ef12c[_0xa478('0x10')],'redirect_uri':_0x1ef12c[_0xa478('0xe')],'code':_0x1ef12c['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2adf59)['then'](function(_0x2d589e){var _0x5c4270=JSON['parse'](_0x2d589e);if(_0x5c4270[_0xa478('0x1e')]){_0x1ef12c[_0xa478('0x1f')]=_0x5c4270[_0xa478('0x1e')];logger[_0xa478('0x20')](util[_0xa478('0x21')](_0xa478('0x22'),_0x1ef12c[_0xa478('0x23')],_0x1ef12c['id']));}else{logger[_0xa478('0x25')](util[_0xa478('0x21')](_0xa478('0x28'),_0x1ef12c[_0xa478('0x23')],_0x1ef12c['id']),util[_0xa478('0x24')](_0x5c4270,{'showHidden':![],'depth':null}));}return _0x229901(null,_0x7491bf);})[_0xa478('0x29')](function(_0x1ae6db){logger[_0xa478('0x25')](util[_0xa478('0x21')](_0xa478('0x28'),_0x1ef12c[_0xa478('0x23')],_0x1ef12c['id']),util[_0xa478('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x229901(_0x1ae6db);});}else{return _0x229901(null,_0x7491bf);}}}});}; \ No newline at end of file +var _0xb8c4=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in'];(function(_0x176337,_0x6feb0b){var _0x13f0ca=function(_0x2035b4){while(--_0x2035b4){_0x176337['push'](_0x176337['shift']());}};_0x13f0ca(++_0x6feb0b);}(_0xb8c4,0x1a1));var _0x4b8c=function(_0x3eca5a,_0x20d490){_0x3eca5a=_0x3eca5a-0x0;var _0x15470e=_0xb8c4[_0x3eca5a];return _0x15470e;};'use strict';var _=require('lodash');var util=require(_0x4b8c('0x0'));var logger=require(_0x4b8c('0x1'))(_0x4b8c('0x2'));var moment=require(_0x4b8c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b8c('0x4'));var rimraf=require(_0x4b8c('0x5'));var config=require(_0x4b8c('0x6'));var attributes=require(_0x4b8c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x4b8c('0x8')]=function(_0x1c4620,_0x3a8cfa){return _0x1c4620[_0x4b8c('0x9')](_0x4b8c('0xa'),attributes,{'tableName':_0x4b8c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1bee85,_0x4ecb29,_0x32164a){if(_0x1bee85[_0x4b8c('0xc')](_0x4b8c('0xd'))||_0x1bee85[_0x4b8c('0xc')](_0x4b8c('0xe'))||_0x1bee85['changed'](_0x4b8c('0xf'))||_0x1bee85[_0x4b8c('0xc')](_0x4b8c('0x10'))||_0x1bee85[_0x4b8c('0xc')](_0x4b8c('0x11'))||_0x1bee85['changed'](_0x4b8c('0x12'))){var _0x15e7d6,_0x39fb4b;_0x15e7d6=_0x1bee85[_0x4b8c('0xe')];var _0x5dce8f=_0x15e7d6['slice'](-0x1);if(_0x5dce8f==='/'||_0x5dce8f==='\x5c'||_0x5dce8f===':'){_0x15e7d6=_0x15e7d6[_0x4b8c('0x13')](0x0,_0x15e7d6[_0x4b8c('0x14')](_0x5dce8f));}switch(_0x1bee85[_0x4b8c('0xd')]){case'US':_0x39fb4b=_0x4b8c('0x15');break;case'AU':_0x39fb4b='https://accounts.zoho.com.au';break;case'IN':_0x39fb4b=_0x4b8c('0x16');break;case'CN':_0x39fb4b=_0x4b8c('0x17');break;default:_0x39fb4b=_0x4b8c('0x18');break;}var _0x5c8823={'method':_0x4b8c('0x19'),'uri':_0x39fb4b+_0x4b8c('0x1a'),'form':{'grant_type':_0x4b8c('0x1b'),'client_id':_0x1bee85[_0x4b8c('0xf')],'client_secret':_0x1bee85[_0x4b8c('0x10')],'redirect_uri':_0x1bee85[_0x4b8c('0xe')],'code':_0x1bee85[_0x4b8c('0x11')]},'headers':{'Content-Type':_0x4b8c('0x1c')}};return rp(_0x5c8823)[_0x4b8c('0x1d')](function(_0x463fb1){var _0xe653df=JSON['parse'](_0x463fb1);if(_0xe653df[_0x4b8c('0x1e')]){_0x1bee85[_0x4b8c('0x1f')]=_0xe653df[_0x4b8c('0x1e')];logger[_0x4b8c('0x20')](util['format'](_0x4b8c('0x21'),_0x1bee85[_0x4b8c('0x22')],_0x1bee85['id']));}else{logger[_0x4b8c('0x23')](util[_0x4b8c('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1bee85[_0x4b8c('0x22')],_0x1bee85['id']),util[_0x4b8c('0x25')](_0xe653df,{'showHidden':![],'depth':null}));}return _0x32164a(null,_0x4ecb29);})[_0x4b8c('0x26')](function(_0x4fa6c9){logger[_0x4b8c('0x23')](util[_0x4b8c('0x24')](_0x4b8c('0x27'),_0x1bee85[_0x4b8c('0x22')],_0x1bee85['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x32164a(_0x4fa6c9);});}else{return _0x32164a(null,_0x4ecb29);}},'beforeUpdate':function(_0x5de3c2,_0x3f512d,_0x24fa7a){if(_0x5de3c2[_0x4b8c('0xc')](_0x4b8c('0xd'))||_0x5de3c2[_0x4b8c('0xc')]('serverUrl')||_0x5de3c2['changed']('clientId')||_0x5de3c2[_0x4b8c('0xc')](_0x4b8c('0x10'))||_0x5de3c2[_0x4b8c('0xc')](_0x4b8c('0x11'))||_0x5de3c2[_0x4b8c('0xc')]('host')){var _0x4b13a6,_0x4c4862;_0x4b13a6=_0x5de3c2[_0x4b8c('0xe')];var _0x12f007=_0x4b13a6['slice'](-0x1);if(_0x12f007==='/'||_0x12f007==='\x5c'||_0x12f007===':'){_0x4b13a6=_0x4b13a6[_0x4b8c('0x13')](0x0,_0x4b13a6[_0x4b8c('0x14')](_0x12f007));}switch(_0x5de3c2['zone']){case'US':_0x4c4862=_0x4b8c('0x15');break;case'AU':_0x4c4862='https://accounts.zoho.com.au';break;case'IN':_0x4c4862='https://accounts.zoho.in';break;case'CN':_0x4c4862=_0x4b8c('0x17');break;default:_0x4c4862=_0x4b8c('0x18');break;}var _0x2113a6={'method':'POST','uri':_0x4c4862+_0x4b8c('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x5de3c2['clientId'],'client_secret':_0x5de3c2[_0x4b8c('0x10')],'redirect_uri':_0x5de3c2['serverUrl'],'code':_0x5de3c2[_0x4b8c('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2113a6)[_0x4b8c('0x1d')](function(_0x446caa){var _0x284a51=JSON['parse'](_0x446caa);if(_0x284a51['refresh_token']){_0x5de3c2[_0x4b8c('0x1f')]=_0x284a51['refresh_token'];logger[_0x4b8c('0x20')](util[_0x4b8c('0x24')](_0x4b8c('0x21'),_0x5de3c2[_0x4b8c('0x22')],_0x5de3c2['id']));}else{logger[_0x4b8c('0x23')](util['format'](_0x4b8c('0x27'),_0x5de3c2[_0x4b8c('0x22')],_0x5de3c2['id']),util[_0x4b8c('0x25')](_0x284a51,{'showHidden':![],'depth':null}));}return _0x24fa7a(null,_0x3f512d);})['catch'](function(_0x115cf0){logger[_0x4b8c('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5de3c2[_0x4b8c('0x22')],_0x5de3c2['id']),util[_0x4b8c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x24fa7a(_0x115cf0);});}else{return _0x24fa7a(null,_0x3f512d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0caf894..de48345 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 _0xef66=['model','include','debug','stringify','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','map'];(function(_0x410ab2,_0x105772){var _0x425a1b=function(_0x16e349){while(--_0x16e349){_0x410ab2['push'](_0x410ab2['shift']());}};_0x425a1b(++_0x105772);}(_0xef66,0x1db));var _0x6ef6=function(_0xd216e5,_0x5ac8fd){_0xd216e5=_0xd216e5-0x0;var _0x36c02e=_0xef66[_0xd216e5];return _0x36c02e;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830aa,_0x3755b5,_0x4f06b9){return new BPromise(function(_0x5a7c74,_0xc0d555){return client[_0x6ef6('0xc')](_0x1830aa,_0x4f06b9)[_0x6ef6('0xd')](function(_0x391e0e){logger[_0x6ef6('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'),JSON['stringify'](_0x391e0e));if(_0x391e0e[_0x6ef6('0x10')]){if(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3755b5,_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0xc0d555(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger['error'](_0x6ef6('0x13'),_0x3755b5,_0x391e0e['error'][_0x6ef6('0x12')]);return _0x5a7c74(_0x391e0e[_0x6ef6('0x10')]['message']);}else{logger[_0x6ef6('0xe')](_0x6ef6('0x13'),_0x3755b5,_0x6ef6('0xf'));_0x5a7c74(_0x391e0e[_0x6ef6('0x14')][_0x6ef6('0x12')]);}})[_0x6ef6('0x15')](function(_0x4ea222){logger[_0x6ef6('0x10')](_0x6ef6('0x13'),_0x3755b5,_0x4ea222);_0xc0d555(_0x4ea222);});});}exports[_0x6ef6('0x16')]=function(_0x53586d){var _0x3fc3d1=this;return new Promise(function(_0x2510be,_0x292af9){return db[_0x6ef6('0x17')][_0x6ef6('0x18')]({'raw':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')][_0x6ef6('0x1a')]||null:null,'attributes':_0x53586d[_0x6ef6('0x19')]?_0x53586d['options'][_0x6ef6('0x1b')]||null:null,'limit':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')]['limit']||null:null,'include':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')]['include']?_[_0x6ef6('0x1c')](_0x53586d[_0x6ef6('0x19')]['include'],function(_0x366f2c){return{'model':db[_0x366f2c[_0x6ef6('0x1d')]],'as':_0x366f2c['as'],'attributes':_0x366f2c[_0x6ef6('0x1b')],'include':_0x366f2c[_0x6ef6('0x1e')]?_[_0x6ef6('0x1c')](_0x366f2c[_0x6ef6('0x1e')],function(_0x1cd549){return{'model':db[_0x1cd549['model']],'as':_0x1cd549['as'],'attributes':_0x1cd549[_0x6ef6('0x1b')],'include':_0x1cd549['include']?_[_0x6ef6('0x1c')](_0x1cd549[_0x6ef6('0x1e')],function(_0x443ded){return{'model':db[_0x443ded[_0x6ef6('0x1d')]],'as':_0x443ded['as'],'attributes':_0x443ded[_0x6ef6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ef6('0xd')](function(_0x23eb77){logger[_0x6ef6('0xe')](_0x6ef6('0x16'),_0x53586d);logger[_0x6ef6('0x1f')](_0x6ef6('0x16'),_0x53586d,JSON[_0x6ef6('0x20')](_0x23eb77));_0x2510be(_0x23eb77);})[_0x6ef6('0x15')](function(_0x40f9f6){logger[_0x6ef6('0x10')](_0x6ef6('0x16'),_0x40f9f6[_0x6ef6('0x12')],_0x53586d);_0x292af9(_0x3fc3d1[_0x6ef6('0x10')](0x1f4,_0x40f9f6[_0x6ef6('0x12')]));});});};exports[_0x6ef6('0x21')]=function(_0x512dda){var _0x4f901c=this;return new Promise(function(_0x5f3179,_0xce3e82){return db[_0x6ef6('0x17')][_0x6ef6('0x22')]({'raw':_0x512dda['options']?_0x512dda['options'][_0x6ef6('0x23')]===undefined?!![]:![]:!![],'where':_0x512dda[_0x6ef6('0x19')]?_0x512dda[_0x6ef6('0x19')]['where']||null:null,'attributes':_0x512dda[_0x6ef6('0x19')]?_0x512dda['options'][_0x6ef6('0x1b')]||null:null,'include':_0x512dda[_0x6ef6('0x19')]?_0x512dda['options']['include']?_[_0x6ef6('0x1c')](_0x512dda['options'][_0x6ef6('0x1e')],function(_0x52c901){return{'model':db[_0x52c901[_0x6ef6('0x1d')]],'as':_0x52c901['as'],'attributes':_0x52c901['attributes'],'include':_0x52c901['include']?_[_0x6ef6('0x1c')](_0x52c901[_0x6ef6('0x1e')],function(_0x5d1db9){return{'model':db[_0x5d1db9[_0x6ef6('0x1d')]],'as':_0x5d1db9['as'],'attributes':_0x5d1db9['attributes'],'include':_0x5d1db9[_0x6ef6('0x1e')]?_['map'](_0x5d1db9[_0x6ef6('0x1e')],function(_0x5cf0ea){return{'model':db[_0x5cf0ea[_0x6ef6('0x1d')]],'as':_0x5cf0ea['as'],'attributes':_0x5cf0ea[_0x6ef6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ef6('0xd')](function(_0x57eaff){logger['info'](_0x6ef6('0x21'),_0x512dda);logger[_0x6ef6('0x1f')](_0x6ef6('0x21'),_0x512dda,JSON[_0x6ef6('0x20')](_0x57eaff));_0x5f3179(_0x57eaff);})['catch'](function(_0x538757){logger[_0x6ef6('0x10')]('ShowZohoAccount',_0x538757['message'],_0x512dda);_0xce3e82(_0x4f901c[_0x6ef6('0x10')](0x1f4,_0x538757['message']));});});}; \ No newline at end of file +var _0xf7f7=['../../config/logger','rpc','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','map','model','include','debug','ShowZohoAccount','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0xb7be,_0x585cd8){var _0x25ba75=function(_0x4b5bd9){while(--_0x4b5bd9){_0xb7be['push'](_0xb7be['shift']());}};_0x25ba75(++_0x585cd8);}(_0xf7f7,0x192));var _0x7f7f=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xf7f7[_0xb8cfbe];return _0x227d51;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var moment=require(_0x7f7f('0x2'));var BPromise=require(_0x7f7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f7f('0x4'))['db'];var utils=require(_0x7f7f('0x5'));var logger=require(_0x7f7f('0x6'))(_0x7f7f('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f7f('0x8'));var client=jayson[_0x7f7f('0x9')][_0x7f7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce9ad,_0x5c40ac,_0x2cb854){return new BPromise(function(_0x58ac2b,_0xebd8af){return client['request'](_0x2ce9ad,_0x2cb854)[_0x7f7f('0xb')](function(_0x4e5cc7){logger[_0x7f7f('0xc')](_0x7f7f('0xd'),_0x5c40ac,_0x7f7f('0xe'));logger['debug'](_0x7f7f('0xf'),_0x5c40ac,_0x7f7f('0xe'),JSON[_0x7f7f('0x10')](_0x4e5cc7));if(_0x4e5cc7['error']){if(_0x4e5cc7['error']['code']===0x1f4){logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);return _0xebd8af(_0x4e5cc7['error']['message']);}logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);return _0x58ac2b(_0x4e5cc7[_0x7f7f('0x11')][_0x7f7f('0x12')]);}else{logger[_0x7f7f('0xc')](_0x7f7f('0xd'),_0x5c40ac,_0x7f7f('0xe'));_0x58ac2b(_0x4e5cc7[_0x7f7f('0x13')][_0x7f7f('0x12')]);}})[_0x7f7f('0x14')](function(_0x175970){logger[_0x7f7f('0x11')](_0x7f7f('0xd'),_0x5c40ac,_0x175970);_0xebd8af(_0x175970);});});}exports[_0x7f7f('0x15')]=function(_0x410957){var _0x349136=this;return new Promise(function(_0xa16527,_0x28c6b0){return db[_0x7f7f('0x16')]['findAll']({'raw':_0x410957[_0x7f7f('0x17')]?_0x410957[_0x7f7f('0x17')][_0x7f7f('0x18')]===undefined?!![]:![]:!![],'where':_0x410957['options']?_0x410957[_0x7f7f('0x17')]['where']||null:null,'attributes':_0x410957[_0x7f7f('0x17')]?_0x410957[_0x7f7f('0x17')][_0x7f7f('0x19')]||null:null,'limit':_0x410957[_0x7f7f('0x17')]?_0x410957['options'][_0x7f7f('0x1a')]||null:null,'include':_0x410957[_0x7f7f('0x17')]?_0x410957[_0x7f7f('0x17')]['include']?_[_0x7f7f('0x1b')](_0x410957['options']['include'],function(_0x597be6){return{'model':db[_0x597be6[_0x7f7f('0x1c')]],'as':_0x597be6['as'],'attributes':_0x597be6['attributes'],'include':_0x597be6[_0x7f7f('0x1d')]?_['map'](_0x597be6[_0x7f7f('0x1d')],function(_0x158df8){return{'model':db[_0x158df8['model']],'as':_0x158df8['as'],'attributes':_0x158df8[_0x7f7f('0x19')],'include':_0x158df8[_0x7f7f('0x1d')]?_[_0x7f7f('0x1b')](_0x158df8[_0x7f7f('0x1d')],function(_0x373cc3){return{'model':db[_0x373cc3[_0x7f7f('0x1c')]],'as':_0x373cc3['as'],'attributes':_0x373cc3[_0x7f7f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7f7f('0xb')](function(_0x46a5d7){logger['info']('GetZohoAccount',_0x410957);logger[_0x7f7f('0x1e')](_0x7f7f('0x15'),_0x410957,JSON[_0x7f7f('0x10')](_0x46a5d7));_0xa16527(_0x46a5d7);})['catch'](function(_0x702b2){logger[_0x7f7f('0x11')](_0x7f7f('0x15'),_0x702b2['message'],_0x410957);_0x28c6b0(_0x349136['error'](0x1f4,_0x702b2['message']));});});};exports[_0x7f7f('0x1f')]=function(_0x45ca53){var _0x3b7364=this;return new Promise(function(_0x24a1e2,_0x89dd20){return db[_0x7f7f('0x16')][_0x7f7f('0x20')]({'raw':_0x45ca53[_0x7f7f('0x17')]?_0x45ca53[_0x7f7f('0x17')][_0x7f7f('0x18')]===undefined?!![]:![]:!![],'where':_0x45ca53[_0x7f7f('0x17')]?_0x45ca53[_0x7f7f('0x17')][_0x7f7f('0x21')]||null:null,'attributes':_0x45ca53[_0x7f7f('0x17')]?_0x45ca53[_0x7f7f('0x17')]['attributes']||null:null,'include':_0x45ca53[_0x7f7f('0x17')]?_0x45ca53['options'][_0x7f7f('0x1d')]?_[_0x7f7f('0x1b')](_0x45ca53[_0x7f7f('0x17')][_0x7f7f('0x1d')],function(_0x395f60){return{'model':db[_0x395f60['model']],'as':_0x395f60['as'],'attributes':_0x395f60[_0x7f7f('0x19')],'include':_0x395f60['include']?_[_0x7f7f('0x1b')](_0x395f60['include'],function(_0x2afc46){return{'model':db[_0x2afc46['model']],'as':_0x2afc46['as'],'attributes':_0x2afc46[_0x7f7f('0x19')],'include':_0x2afc46['include']?_[_0x7f7f('0x1b')](_0x2afc46['include'],function(_0x4af190){return{'model':db[_0x4af190[_0x7f7f('0x1c')]],'as':_0x4af190['as'],'attributes':_0x4af190['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1a03){logger[_0x7f7f('0xc')](_0x7f7f('0x1f'),_0x45ca53);logger['debug'](_0x7f7f('0x1f'),_0x45ca53,JSON[_0x7f7f('0x10')](_0x2a1a03));_0x24a1e2(_0x2a1a03);})[_0x7f7f('0x14')](function(_0x1efb65){logger[_0x7f7f('0x11')]('ShowZohoAccount',_0x1efb65['message'],_0x45ca53);_0x89dd20(_0x3b7364[_0x7f7f('0x11')](0x1f4,_0x1efb65['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9665469..abb4caf 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 _0x47b1=['show','/:id/fields','isAuthenticated','getFields','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index'];(function(_0x10a7b2,_0x37587c){var _0x5cf00e=function(_0x69b0b9){while(--_0x69b0b9){_0x10a7b2['push'](_0x10a7b2['shift']());}};_0x5cf00e(++_0x37587c);}(_0x47b1,0x1d3));var _0x147b=function(_0x1608c2,_0xfc7cd0){_0x1608c2=_0x1608c2-0x0;var _0x10b6f9=_0x47b1[_0x1608c2];return _0x10b6f9;};'use strict';var multer=require(_0x147b('0x0'));var util=require('util');var path=require(_0x147b('0x1'));var timeout=require(_0x147b('0x2'));var express=require('express');var router=express[_0x147b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x147b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x147b('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x147b('0x6')]('/',auth['isAuthenticated'](),controller[_0x147b('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x147b('0x8')]);router[_0x147b('0x6')](_0x147b('0x9'),auth[_0x147b('0xa')](),controller[_0x147b('0xb')]);router[_0x147b('0x6')]('/:id/subjects',auth[_0x147b('0xa')](),controller['getSubjects']);router[_0x147b('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x147b('0xc')]('/',auth[_0x147b('0xa')](),controller[_0x147b('0xd')]);router[_0x147b('0xe')](_0x147b('0xf'),auth[_0x147b('0xa')](),controller[_0x147b('0x10')]);router[_0x147b('0x11')](_0x147b('0xf'),auth[_0x147b('0xa')](),controller['destroy']);module[_0x147b('0x12')]=router; \ No newline at end of file +var _0x0208=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','path'];(function(_0x309689,_0x2a9e08){var _0x5ec5ea=function(_0x33e4c3){while(--_0x33e4c3){_0x309689['push'](_0x309689['shift']());}};_0x5ec5ea(++_0x2a9e08);}(_0x0208,0xef));var _0x8020=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x0208[_0x3d38ae];return _0x3757ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8020('0x0'));var timeout=require(_0x8020('0x1'));var express=require(_0x8020('0x2'));var router=express[_0x8020('0x3')]();var fs_extra=require(_0x8020('0x4'));var auth=require(_0x8020('0x5'));var interaction=require(_0x8020('0x6'));var config=require(_0x8020('0x7'));var controller=require(_0x8020('0x8'));router[_0x8020('0x9')]('/',auth[_0x8020('0xa')](),controller['index']);router[_0x8020('0x9')](_0x8020('0xb'),auth[_0x8020('0xa')](),controller['show']);router[_0x8020('0x9')](_0x8020('0xc'),auth['isAuthenticated'](),controller[_0x8020('0xd')]);router[_0x8020('0x9')](_0x8020('0xe'),auth['isAuthenticated'](),controller[_0x8020('0xf')]);router[_0x8020('0x9')](_0x8020('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8020('0x11')]('/',auth[_0x8020('0xa')](),controller[_0x8020('0x12')]);router[_0x8020('0x13')](_0x8020('0xb'),auth[_0x8020('0xa')](),controller[_0x8020('0x14')]);router[_0x8020('0x15')](_0x8020('0xb'),auth[_0x8020('0xa')](),controller[_0x8020('0x16')]);module[_0x8020('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index a13001f..52ea510 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 _0xe6a2=['lead','contact','nothing','STRING','sequelize','exports','ENUM'];(function(_0x5c199b,_0x2bbf17){var _0x34d311=function(_0x3fca04){while(--_0x3fca04){_0x5c199b['push'](_0x5c199b['shift']());}};_0x34d311(++_0x2bbf17);}(_0xe6a2,0xdd));var _0x2e6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6a2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2e6a('0x0'));module[_0x2e6a('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x2e6a('0x2')](_0x2e6a('0x3'),_0x2e6a('0x4'),_0x2e6a('0x5')),'defaultValue':_0x2e6a('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x2e6a('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x2e6a('0x6')]}}; \ No newline at end of file +var _0x193f=['exports','STRING','ENUM','contact','nothing','lead','contact_lead','sequelize'];(function(_0x5cee8d,_0x3f1730){var _0x3ad5b6=function(_0x470f2b){while(--_0x470f2b){_0x5cee8d['push'](_0x5cee8d['shift']());}};_0x3ad5b6(++_0x3f1730);}(_0x193f,0x9f));var _0xf193=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0x193f[_0x3050ca];return _0x1eed1d;};'use strict';var Sequelize=require(_0xf193('0x0'));module[_0xf193('0x1')]={'name':{'type':Sequelize[_0xf193('0x2')]},'moduleCreate':{'type':Sequelize[_0xf193('0x3')]('lead',_0xf193('0x4'),_0xf193('0x5')),'defaultValue':_0xf193('0x6')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xf193('0x4'),_0xf193('0x6')),'defaultValue':_0xf193('0x7')},'description':{'type':Sequelize[_0xf193('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index eb0d96a..134e96f 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 _0x60b1=['filter','merge','VIRTUAL','includeAll','findAll','show','params','options','catch','create','body','find','getFields','ZohoField','pick','hasOwnProperty','nolimit','findOne','getSubjects','getDescriptions','zip-dir','fast-json-patch','bluebird','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','order','sort','where','filters'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0x60b1,0x190));var _0x160b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x60b1[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x160b('0x0'));var jsonpatch=require(_0x160b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x160b('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x160b('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x160b('0x4'));var squel=require(_0x160b('0x5'));var crypto=require(_0x160b('0x6'));var jsforce=require(_0x160b('0x7'));var deskjs=require(_0x160b('0x8'));var toCsv=require(_0x160b('0x9'));var querystring=require('querystring');var Papa=require(_0x160b('0xa'));var Redis=require(_0x160b('0xb'));var authService=require(_0x160b('0xc'));var qs=require(_0x160b('0xd'));var as=require(_0x160b('0xe'));var hardwareService=require(_0x160b('0xf'));var logger=require(_0x160b('0x10'))(_0x160b('0x11'));var utils=require(_0x160b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x160b('0x13'));var db=require(_0x160b('0x14'))['db'];function respondWithStatusCode(_0x2e07eb,_0x54face){_0x54face=_0x54face||0xcc;return function(_0x107bc6){if(_0x107bc6){return _0x2e07eb['sendStatus'](_0x54face);}return _0x2e07eb['status'](_0x54face)[_0x160b('0x15')]();};}function respondWithResult(_0x307c26,_0x36ae47){_0x36ae47=_0x36ae47||0xc8;return function(_0x1697ff){if(_0x1697ff){return _0x307c26[_0x160b('0x16')](_0x36ae47)[_0x160b('0x17')](_0x1697ff);}};}function respondWithFilteredResult(_0x567c66,_0x3784fa){return function(_0x2d5f0e){if(_0x2d5f0e){var _0x3b5938=typeof _0x3784fa[_0x160b('0x18')]===_0x160b('0x19')&&typeof _0x3784fa['limit']==='undefined';var _0x74c98c=_0x2d5f0e['count'];var _0x13d368=_0x3b5938?0x0:_0x3784fa[_0x160b('0x18')];var _0x14c54a=_0x3b5938?_0x2d5f0e[_0x160b('0x1a')]:_0x3784fa[_0x160b('0x18')]+_0x3784fa[_0x160b('0x1b')];var _0x33e4b3;if(_0x14c54a>=_0x74c98c){_0x14c54a=_0x74c98c;_0x33e4b3=0xc8;}else{_0x33e4b3=0xce;}_0x567c66['status'](_0x33e4b3);return _0x567c66[_0x160b('0x1c')]('Content-Range',_0x13d368+'-'+_0x14c54a+'/'+_0x74c98c)[_0x160b('0x17')](_0x2d5f0e);}return null;};}function patchUpdates(_0x41dbf4){return function(_0x1afe8a){try{jsonpatch[_0x160b('0x1d')](_0x1afe8a,_0x41dbf4,!![]);}catch(_0x2985a5){return BPromise[_0x160b('0x1e')](_0x2985a5);}return _0x1afe8a[_0x160b('0x1f')]();};}function saveUpdates(_0x48a081,_0xe52319){return function(_0x286839){if(_0x286839){return _0x286839[_0x160b('0x20')](_0x48a081)[_0x160b('0x21')](function(_0x11507d){return _0x11507d;});}return null;};}function removeEntity(_0x4d37af,_0x385a7e){return function(_0x189fa7){if(_0x189fa7){return _0x189fa7[_0x160b('0x22')]()[_0x160b('0x21')](function(){_0x4d37af[_0x160b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa932,_0x2e6930){return function(_0x4fdf88){if(!_0x4fdf88){_0x5aa932['sendStatus'](0x194);}return _0x4fdf88;};}function handleError(_0xf098f0,_0x5f010c){_0x5f010c=_0x5f010c||0x1f4;return function(_0x1afede){logger[_0x160b('0x23')](_0x1afede[_0x160b('0x24')]);if(_0x1afede[_0x160b('0x25')]){delete _0x1afede[_0x160b('0x25')];}_0xf098f0[_0x160b('0x16')](_0x5f010c)[_0x160b('0x26')](_0x1afede);};}exports['index']=function(_0x5824e4,_0x2d0739){var _0x25b2aa={},_0x5b3a2d={},_0x19c050={'count':0x0,'rows':[]};var _0x2ee9e8=_['map'](db[_0x160b('0x27')][_0x160b('0x28')],function(_0x3ed2b6){return{'name':_0x3ed2b6[_0x160b('0x29')],'type':_0x3ed2b6[_0x160b('0x2a')][_0x160b('0x2b')]};});_0x5b3a2d[_0x160b('0x2c')]=_[_0x160b('0x2d')](_0x2ee9e8,_0x160b('0x25'));_0x5b3a2d[_0x160b('0x2e')]=_[_0x160b('0x2f')](_0x5824e4[_0x160b('0x2e')]);_0x5b3a2d['filters']=_[_0x160b('0x30')](_0x5b3a2d[_0x160b('0x2c')],_0x5b3a2d['query']);_0x25b2aa['attributes']=_[_0x160b('0x30')](_0x5b3a2d['model'],qs[_0x160b('0x31')](_0x5824e4[_0x160b('0x2e')][_0x160b('0x31')]));_0x25b2aa['attributes']=_0x25b2aa[_0x160b('0x32')][_0x160b('0x33')]?_0x25b2aa[_0x160b('0x32')]:_0x5b3a2d['model'];if(!_0x5824e4[_0x160b('0x2e')]['hasOwnProperty']('nolimit')){_0x25b2aa[_0x160b('0x1b')]=qs[_0x160b('0x1b')](_0x5824e4['query']['limit']);_0x25b2aa['offset']=qs[_0x160b('0x18')](_0x5824e4[_0x160b('0x2e')][_0x160b('0x18')]);}_0x25b2aa[_0x160b('0x34')]=qs['sort'](_0x5824e4[_0x160b('0x2e')][_0x160b('0x35')]);_0x25b2aa[_0x160b('0x36')]=qs[_0x160b('0x37')](_['pick'](_0x5824e4[_0x160b('0x2e')],_0x5b3a2d[_0x160b('0x37')]),_0x2ee9e8);if(_0x5824e4['query'][_0x160b('0x38')]){_0x25b2aa['where']=_[_0x160b('0x39')](_0x25b2aa['where'],{'$or':_[_0x160b('0x2d')](_0x2ee9e8,function(_0xf3652a){if(_0xf3652a[_0x160b('0x2a')]!==_0x160b('0x3a')){var _0x3863ad={};_0x3863ad[_0xf3652a['name']]={'$like':'%'+_0x5824e4[_0x160b('0x2e')]['filter']+'%'};return _0x3863ad;}})});}_0x25b2aa=_['merge']({},_0x25b2aa,_0x5824e4['options']);var _0x17a8ae={'where':_0x25b2aa[_0x160b('0x36')]};return db['ZohoConfiguration']['count'](_0x17a8ae)['then'](function(_0x3d4f42){_0x19c050[_0x160b('0x1a')]=_0x3d4f42;if(_0x5824e4[_0x160b('0x2e')][_0x160b('0x3b')]){_0x25b2aa['include']=[{'all':!![]}];}return db[_0x160b('0x27')][_0x160b('0x3c')](_0x25b2aa);})['then'](function(_0x32fca4){_0x19c050['rows']=_0x32fca4;return _0x19c050;})['then'](respondWithFilteredResult(_0x2d0739,_0x25b2aa))['catch'](handleError(_0x2d0739,null));};exports[_0x160b('0x3d')]=function(_0x1fd36f,_0x144c44){var _0xc4edb0={'raw':![],'where':{'id':_0x1fd36f[_0x160b('0x3e')]['id']}},_0x4779ce={};_0x4779ce['model']=_['keys'](db[_0x160b('0x27')]['rawAttributes']);_0x4779ce['query']=_[_0x160b('0x2f')](_0x1fd36f['query']);_0x4779ce[_0x160b('0x37')]=_[_0x160b('0x30')](_0x4779ce['model'],_0x4779ce[_0x160b('0x2e')]);_0xc4edb0['attributes']=_[_0x160b('0x30')](_0x4779ce[_0x160b('0x2c')],qs[_0x160b('0x31')](_0x1fd36f[_0x160b('0x2e')]['fields']));_0xc4edb0['attributes']=_0xc4edb0['attributes'][_0x160b('0x33')]?_0xc4edb0['attributes']:_0x4779ce[_0x160b('0x2c')];if(_0x1fd36f[_0x160b('0x2e')][_0x160b('0x3b')]){_0xc4edb0['include']=[{'all':!![]}];}_0xc4edb0=_[_0x160b('0x39')]({},_0xc4edb0,_0x1fd36f[_0x160b('0x3f')]);return db[_0x160b('0x27')]['find'](_0xc4edb0)[_0x160b('0x21')](handleEntityNotFound(_0x144c44,null))[_0x160b('0x21')](respondWithResult(_0x144c44,null))[_0x160b('0x40')](handleError(_0x144c44,null));};exports[_0x160b('0x41')]=function(_0x1293d1,_0x289096){return db[_0x160b('0x27')]['create'](_0x1293d1[_0x160b('0x42')],{})[_0x160b('0x21')](respondWithResult(_0x289096,0xc9))['catch'](handleError(_0x289096,null));};exports[_0x160b('0x20')]=function(_0x2417fe,_0x154bbe){if(_0x2417fe['body']['id']){delete _0x2417fe[_0x160b('0x42')]['id'];}return db[_0x160b('0x27')]['find']({'where':{'id':_0x2417fe[_0x160b('0x3e')]['id']}})[_0x160b('0x21')](handleEntityNotFound(_0x154bbe,null))[_0x160b('0x21')](saveUpdates(_0x2417fe['body'],null))[_0x160b('0x21')](respondWithResult(_0x154bbe,null))['catch'](handleError(_0x154bbe,null));};exports[_0x160b('0x22')]=function(_0x63ff6b,_0x2f73cb){return db[_0x160b('0x27')][_0x160b('0x43')]({'where':{'id':_0x63ff6b[_0x160b('0x3e')]['id']}})[_0x160b('0x21')](handleEntityNotFound(_0x2f73cb,null))[_0x160b('0x21')](removeEntity(_0x2f73cb,null))['catch'](handleError(_0x2f73cb,null));};exports[_0x160b('0x44')]=function(_0x5c59ff,_0xd8a11f,_0x4be6d2){var _0x4e7ca0={};var _0x4ec102={};var _0x538944;var _0x2a09bb;return db[_0x160b('0x27')]['findOne']({'where':{'id':_0x5c59ff[_0x160b('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd8a11f,null))['then'](function(_0xdb2be2){if(_0xdb2be2){_0x538944=_0xdb2be2;_0x4ec102[_0x160b('0x2c')]=_[_0x160b('0x2f')](db[_0x160b('0x45')]['rawAttributes']);_0x4ec102[_0x160b('0x2e')]=_[_0x160b('0x2f')](_0x5c59ff[_0x160b('0x2e')]);_0x4ec102[_0x160b('0x37')]=_[_0x160b('0x30')](_0x4ec102[_0x160b('0x2c')],_0x4ec102[_0x160b('0x2e')]);_0x4e7ca0['attributes']=_['intersection'](_0x4ec102[_0x160b('0x2c')],qs[_0x160b('0x31')](_0x5c59ff[_0x160b('0x2e')][_0x160b('0x31')]));_0x4e7ca0[_0x160b('0x32')]=_0x4e7ca0[_0x160b('0x32')][_0x160b('0x33')]?_0x4e7ca0[_0x160b('0x32')]:_0x4ec102[_0x160b('0x2c')];_0x4e7ca0[_0x160b('0x34')]=qs[_0x160b('0x35')](_0x5c59ff['query'][_0x160b('0x35')]);_0x4e7ca0['where']=qs['filters'](_[_0x160b('0x46')](_0x5c59ff[_0x160b('0x2e')],_0x4ec102[_0x160b('0x37')]));if(_0x5c59ff[_0x160b('0x2e')][_0x160b('0x38')]){_0x4e7ca0[_0x160b('0x36')]=_['merge'](_0x4e7ca0[_0x160b('0x36')],{'$or':_[_0x160b('0x2d')](_0x4e7ca0[_0x160b('0x32')],function(_0x56c789){var _0x5787c7={};_0x5787c7[_0x56c789]={'$like':'%'+_0x5c59ff[_0x160b('0x2e')]['filter']+'%'};return _0x5787c7;})});}_0x4e7ca0=_[_0x160b('0x39')]({},_0x4e7ca0,_0x5c59ff['options']);return _0x538944[_0x160b('0x44')](_0x4e7ca0);}})[_0x160b('0x21')](function(_0x314d8c){if(_0x314d8c){_0x2a09bb=_0x314d8c[_0x160b('0x33')];if(!_0x5c59ff[_0x160b('0x2e')][_0x160b('0x47')](_0x160b('0x48'))){_0x4e7ca0[_0x160b('0x1b')]=qs[_0x160b('0x1b')](_0x5c59ff[_0x160b('0x2e')][_0x160b('0x1b')]);_0x4e7ca0['offset']=qs[_0x160b('0x18')](_0x5c59ff[_0x160b('0x2e')][_0x160b('0x18')]);}return _0x538944['getFields'](_0x4e7ca0);}})[_0x160b('0x21')](function(_0x1820cc){if(_0x1820cc){return _0x1820cc?{'count':_0x2a09bb,'rows':_0x1820cc}:null;}})['then'](respondWithResult(_0xd8a11f,null))[_0x160b('0x40')](handleError(_0xd8a11f,null));};exports['getSubjects']=function(_0xa2cd60,_0x545b9f,_0x4d69da){var _0x37d38b={};var _0x3268b4={};var _0x1686ab;var _0x44a0e4;return db[_0x160b('0x27')][_0x160b('0x49')]({'where':{'id':_0xa2cd60[_0x160b('0x3e')]['id']}})[_0x160b('0x21')](handleEntityNotFound(_0x545b9f,null))[_0x160b('0x21')](function(_0xf01dda){if(_0xf01dda){_0x1686ab=_0xf01dda;_0x3268b4[_0x160b('0x2c')]=_[_0x160b('0x2f')](db[_0x160b('0x45')][_0x160b('0x28')]);_0x3268b4[_0x160b('0x2e')]=_['keys'](_0xa2cd60[_0x160b('0x2e')]);_0x3268b4[_0x160b('0x37')]=_['intersection'](_0x3268b4['model'],_0x3268b4['query']);_0x37d38b[_0x160b('0x32')]=_[_0x160b('0x30')](_0x3268b4[_0x160b('0x2c')],qs[_0x160b('0x31')](_0xa2cd60['query'][_0x160b('0x31')]));_0x37d38b[_0x160b('0x32')]=_0x37d38b[_0x160b('0x32')]['length']?_0x37d38b[_0x160b('0x32')]:_0x3268b4['model'];_0x37d38b[_0x160b('0x34')]=qs[_0x160b('0x35')](_0xa2cd60['query']['sort']);_0x37d38b['where']=qs[_0x160b('0x37')](_['pick'](_0xa2cd60['query'],_0x3268b4[_0x160b('0x37')]));if(_0xa2cd60['query'][_0x160b('0x38')]){_0x37d38b[_0x160b('0x36')]=_[_0x160b('0x39')](_0x37d38b[_0x160b('0x36')],{'$or':_[_0x160b('0x2d')](_0x37d38b['attributes'],function(_0x3ca57a){var _0x5283aa={};_0x5283aa[_0x3ca57a]={'$like':'%'+_0xa2cd60[_0x160b('0x2e')][_0x160b('0x38')]+'%'};return _0x5283aa;})});}_0x37d38b=_[_0x160b('0x39')]({},_0x37d38b,_0xa2cd60[_0x160b('0x3f')]);return _0x1686ab[_0x160b('0x4a')](_0x37d38b);}})[_0x160b('0x21')](function(_0x4ddfab){if(_0x4ddfab){_0x44a0e4=_0x4ddfab[_0x160b('0x33')];if(!_0xa2cd60[_0x160b('0x2e')][_0x160b('0x47')](_0x160b('0x48'))){_0x37d38b[_0x160b('0x1b')]=qs[_0x160b('0x1b')](_0xa2cd60[_0x160b('0x2e')][_0x160b('0x1b')]);_0x37d38b[_0x160b('0x18')]=qs[_0x160b('0x18')](_0xa2cd60['query'][_0x160b('0x18')]);}return _0x1686ab[_0x160b('0x4a')](_0x37d38b);}})[_0x160b('0x21')](function(_0x253909){if(_0x253909){return _0x253909?{'count':_0x44a0e4,'rows':_0x253909}:null;}})[_0x160b('0x21')](respondWithResult(_0x545b9f,null))[_0x160b('0x40')](handleError(_0x545b9f,null));};exports[_0x160b('0x4b')]=function(_0x86ce28,_0x243cfa,_0x13b98c){var _0x1940a0={};var _0x442e61={};var _0x3ac169;var _0x3e4525;return db['ZohoConfiguration'][_0x160b('0x49')]({'where':{'id':_0x86ce28[_0x160b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x243cfa,null))[_0x160b('0x21')](function(_0x20a439){if(_0x20a439){_0x3ac169=_0x20a439;_0x442e61[_0x160b('0x2c')]=_[_0x160b('0x2f')](db[_0x160b('0x45')][_0x160b('0x28')]);_0x442e61[_0x160b('0x2e')]=_[_0x160b('0x2f')](_0x86ce28['query']);_0x442e61[_0x160b('0x37')]=_[_0x160b('0x30')](_0x442e61[_0x160b('0x2c')],_0x442e61[_0x160b('0x2e')]);_0x1940a0[_0x160b('0x32')]=_[_0x160b('0x30')](_0x442e61[_0x160b('0x2c')],qs[_0x160b('0x31')](_0x86ce28[_0x160b('0x2e')][_0x160b('0x31')]));_0x1940a0['attributes']=_0x1940a0[_0x160b('0x32')][_0x160b('0x33')]?_0x1940a0[_0x160b('0x32')]:_0x442e61[_0x160b('0x2c')];_0x1940a0['order']=qs[_0x160b('0x35')](_0x86ce28[_0x160b('0x2e')][_0x160b('0x35')]);_0x1940a0['where']=qs[_0x160b('0x37')](_[_0x160b('0x46')](_0x86ce28[_0x160b('0x2e')],_0x442e61[_0x160b('0x37')]));if(_0x86ce28[_0x160b('0x2e')][_0x160b('0x38')]){_0x1940a0['where']=_[_0x160b('0x39')](_0x1940a0['where'],{'$or':_['map'](_0x1940a0[_0x160b('0x32')],function(_0x176441){var _0x21f387={};_0x21f387[_0x176441]={'$like':'%'+_0x86ce28[_0x160b('0x2e')][_0x160b('0x38')]+'%'};return _0x21f387;})});}_0x1940a0=_[_0x160b('0x39')]({},_0x1940a0,_0x86ce28[_0x160b('0x3f')]);return _0x3ac169[_0x160b('0x4b')](_0x1940a0);}})[_0x160b('0x21')](function(_0x267847){if(_0x267847){_0x3e4525=_0x267847['length'];if(!_0x86ce28[_0x160b('0x2e')][_0x160b('0x47')]('nolimit')){_0x1940a0[_0x160b('0x1b')]=qs[_0x160b('0x1b')](_0x86ce28['query']['limit']);_0x1940a0['offset']=qs[_0x160b('0x18')](_0x86ce28['query'][_0x160b('0x18')]);}return _0x3ac169['getDescriptions'](_0x1940a0);}})[_0x160b('0x21')](function(_0x16355a){if(_0x16355a){return _0x16355a?{'count':_0x3e4525,'rows':_0x16355a}:null;}})['then'](respondWithResult(_0x243cfa,null))[_0x160b('0x40')](handleError(_0x243cfa,null));}; \ No newline at end of file +var _0x6cf5=['sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','stack','name','send','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x313e8c,_0x5917e5){var _0xc051d5=function(_0x151646){while(--_0x151646){_0x313e8c['push'](_0x313e8c['shift']());}};_0xc051d5(++_0x5917e5);}(_0x6cf5,0xe3));var _0x56cf=function(_0x401083,_0xab10c6){_0x401083=_0x401083-0x0;var _0x483d60=_0x6cf5[_0x401083];return _0x483d60;};'use strict';var emlformat=require(_0x56cf('0x0'));var rimraf=require(_0x56cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56cf('0x2'));var rp=require(_0x56cf('0x3'));var moment=require(_0x56cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x56cf('0x5'));var util=require(_0x56cf('0x6'));var path=require('path');var sox=require(_0x56cf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x56cf('0x8'));var crypto=require(_0x56cf('0x9'));var jsforce=require(_0x56cf('0xa'));var deskjs=require(_0x56cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0x56cf('0xc'));var Papa=require(_0x56cf('0xd'));var Redis=require(_0x56cf('0xe'));var authService=require(_0x56cf('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56cf('0x10'));var logger=require(_0x56cf('0x11'))(_0x56cf('0x12'));var utils=require('../../config/utils');var config=require(_0x56cf('0x13'));var licenseUtil=require(_0x56cf('0x14'));var db=require(_0x56cf('0x15'))['db'];function respondWithStatusCode(_0x3dedd8,_0x1c3efa){_0x1c3efa=_0x1c3efa||0xcc;return function(_0x367b0f){if(_0x367b0f){return _0x3dedd8[_0x56cf('0x16')](_0x1c3efa);}return _0x3dedd8[_0x56cf('0x17')](_0x1c3efa)[_0x56cf('0x18')]();};}function respondWithResult(_0x5dd6d8,_0x501182){_0x501182=_0x501182||0xc8;return function(_0x21c5b5){if(_0x21c5b5){return _0x5dd6d8[_0x56cf('0x17')](_0x501182)[_0x56cf('0x19')](_0x21c5b5);}};}function respondWithFilteredResult(_0x1afb1b,_0x4c3f26){return function(_0x24d9f9){if(_0x24d9f9){var _0x5735f5=typeof _0x4c3f26['offset']===_0x56cf('0x1a')&&typeof _0x4c3f26['limit']===_0x56cf('0x1a');var _0x4e2d7c=_0x24d9f9['count'];var _0x3b1e08=_0x5735f5?0x0:_0x4c3f26[_0x56cf('0x1b')];var _0x5422b6=_0x5735f5?_0x24d9f9[_0x56cf('0x1c')]:_0x4c3f26['offset']+_0x4c3f26[_0x56cf('0x1d')];var _0x138bbe;if(_0x5422b6>=_0x4e2d7c){_0x5422b6=_0x4e2d7c;_0x138bbe=0xc8;}else{_0x138bbe=0xce;}_0x1afb1b[_0x56cf('0x17')](_0x138bbe);return _0x1afb1b['set'](_0x56cf('0x1e'),_0x3b1e08+'-'+_0x5422b6+'/'+_0x4e2d7c)[_0x56cf('0x19')](_0x24d9f9);}return null;};}function patchUpdates(_0x52d2bd){return function(_0x3867be){try{jsonpatch[_0x56cf('0x1f')](_0x3867be,_0x52d2bd,!![]);}catch(_0xb5cc57){return BPromise[_0x56cf('0x20')](_0xb5cc57);}return _0x3867be[_0x56cf('0x21')]();};}function saveUpdates(_0x3e19cf,_0x3dcaf1){return function(_0x25577b){if(_0x25577b){return _0x25577b[_0x56cf('0x22')](_0x3e19cf)['then'](function(_0x4f1942){return _0x4f1942;});}return null;};}function removeEntity(_0x5252a7,_0x4d118e){return function(_0x6b055e){if(_0x6b055e){return _0x6b055e['destroy']()[_0x56cf('0x23')](function(){_0x5252a7[_0x56cf('0x17')](0xcc)[_0x56cf('0x18')]();});}};}function handleEntityNotFound(_0xc66426,_0x1523dd){return function(_0x39b7cd){if(!_0x39b7cd){_0xc66426[_0x56cf('0x16')](0x194);}return _0x39b7cd;};}function handleError(_0x410b16,_0x1a1aa2){_0x1a1aa2=_0x1a1aa2||0x1f4;return function(_0xb95f98){logger['error'](_0xb95f98[_0x56cf('0x24')]);if(_0xb95f98[_0x56cf('0x25')]){delete _0xb95f98[_0x56cf('0x25')];}_0x410b16[_0x56cf('0x17')](_0x1a1aa2)[_0x56cf('0x26')](_0xb95f98);};}exports['index']=function(_0x585b10,_0x2d2b56){var _0x33022e={},_0x5bebe2={},_0x5c4a57={'count':0x0,'rows':[]};var _0x3cec59=_['map'](db[_0x56cf('0x27')][_0x56cf('0x28')],function(_0x28fe78){return{'name':_0x28fe78[_0x56cf('0x29')],'type':_0x28fe78['type'][_0x56cf('0x2a')]};});_0x5bebe2[_0x56cf('0x2b')]=_[_0x56cf('0x2c')](_0x3cec59,_0x56cf('0x25'));_0x5bebe2[_0x56cf('0x2d')]=_[_0x56cf('0x2e')](_0x585b10[_0x56cf('0x2d')]);_0x5bebe2[_0x56cf('0x2f')]=_['intersection'](_0x5bebe2[_0x56cf('0x2b')],_0x5bebe2[_0x56cf('0x2d')]);_0x33022e[_0x56cf('0x30')]=_[_0x56cf('0x31')](_0x5bebe2[_0x56cf('0x2b')],qs[_0x56cf('0x32')](_0x585b10['query'][_0x56cf('0x32')]));_0x33022e['attributes']=_0x33022e[_0x56cf('0x30')][_0x56cf('0x33')]?_0x33022e[_0x56cf('0x30')]:_0x5bebe2[_0x56cf('0x2b')];if(!_0x585b10[_0x56cf('0x2d')][_0x56cf('0x34')](_0x56cf('0x35'))){_0x33022e[_0x56cf('0x1d')]=qs[_0x56cf('0x1d')](_0x585b10[_0x56cf('0x2d')]['limit']);_0x33022e['offset']=qs[_0x56cf('0x1b')](_0x585b10[_0x56cf('0x2d')][_0x56cf('0x1b')]);}_0x33022e[_0x56cf('0x36')]=qs['sort'](_0x585b10[_0x56cf('0x2d')][_0x56cf('0x37')]);_0x33022e[_0x56cf('0x38')]=qs['filters'](_['pick'](_0x585b10[_0x56cf('0x2d')],_0x5bebe2['filters']),_0x3cec59);if(_0x585b10[_0x56cf('0x2d')]['filter']){_0x33022e[_0x56cf('0x38')]=_[_0x56cf('0x39')](_0x33022e[_0x56cf('0x38')],{'$or':_['map'](_0x3cec59,function(_0x2c65e6){if(_0x2c65e6[_0x56cf('0x3a')]!==_0x56cf('0x3b')){var _0x40320f={};_0x40320f[_0x2c65e6['name']]={'$like':'%'+_0x585b10[_0x56cf('0x2d')][_0x56cf('0x3c')]+'%'};return _0x40320f;}})});}_0x33022e=_['merge']({},_0x33022e,_0x585b10[_0x56cf('0x3d')]);var _0x584ae={'where':_0x33022e['where']};return db[_0x56cf('0x27')][_0x56cf('0x1c')](_0x584ae)[_0x56cf('0x23')](function(_0x5d33f0){_0x5c4a57[_0x56cf('0x1c')]=_0x5d33f0;if(_0x585b10[_0x56cf('0x2d')][_0x56cf('0x3e')]){_0x33022e[_0x56cf('0x3f')]=[{'all':!![]}];}return db[_0x56cf('0x27')][_0x56cf('0x40')](_0x33022e);})['then'](function(_0x3fe671){_0x5c4a57[_0x56cf('0x41')]=_0x3fe671;return _0x5c4a57;})[_0x56cf('0x23')](respondWithFilteredResult(_0x2d2b56,_0x33022e))['catch'](handleError(_0x2d2b56,null));};exports['show']=function(_0x4417be,_0x148d32){var _0x5737cc={'raw':![],'where':{'id':_0x4417be[_0x56cf('0x42')]['id']}},_0x12b489={};_0x12b489['model']=_[_0x56cf('0x2e')](db[_0x56cf('0x27')][_0x56cf('0x28')]);_0x12b489[_0x56cf('0x2d')]=_['keys'](_0x4417be[_0x56cf('0x2d')]);_0x12b489[_0x56cf('0x2f')]=_[_0x56cf('0x31')](_0x12b489[_0x56cf('0x2b')],_0x12b489['query']);_0x5737cc['attributes']=_[_0x56cf('0x31')](_0x12b489['model'],qs['fields'](_0x4417be[_0x56cf('0x2d')]['fields']));_0x5737cc[_0x56cf('0x30')]=_0x5737cc[_0x56cf('0x30')][_0x56cf('0x33')]?_0x5737cc['attributes']:_0x12b489[_0x56cf('0x2b')];if(_0x4417be[_0x56cf('0x2d')][_0x56cf('0x3e')]){_0x5737cc[_0x56cf('0x3f')]=[{'all':!![]}];}_0x5737cc=_[_0x56cf('0x39')]({},_0x5737cc,_0x4417be[_0x56cf('0x3d')]);return db[_0x56cf('0x27')][_0x56cf('0x43')](_0x5737cc)['then'](handleEntityNotFound(_0x148d32,null))[_0x56cf('0x23')](respondWithResult(_0x148d32,null))[_0x56cf('0x44')](handleError(_0x148d32,null));};exports['create']=function(_0x4589fc,_0x282fb8){return db['ZohoConfiguration'][_0x56cf('0x45')](_0x4589fc[_0x56cf('0x46')],{})[_0x56cf('0x23')](respondWithResult(_0x282fb8,0xc9))[_0x56cf('0x44')](handleError(_0x282fb8,null));};exports[_0x56cf('0x22')]=function(_0x577a0a,_0x2d8e64){if(_0x577a0a['body']['id']){delete _0x577a0a[_0x56cf('0x46')]['id'];}return db[_0x56cf('0x27')]['find']({'where':{'id':_0x577a0a[_0x56cf('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d8e64,null))[_0x56cf('0x23')](saveUpdates(_0x577a0a['body'],null))[_0x56cf('0x23')](respondWithResult(_0x2d8e64,null))[_0x56cf('0x44')](handleError(_0x2d8e64,null));};exports[_0x56cf('0x47')]=function(_0x8270d9,_0x12cab9){return db[_0x56cf('0x27')]['find']({'where':{'id':_0x8270d9[_0x56cf('0x42')]['id']}})[_0x56cf('0x23')](handleEntityNotFound(_0x12cab9,null))[_0x56cf('0x23')](removeEntity(_0x12cab9,null))[_0x56cf('0x44')](handleError(_0x12cab9,null));};exports[_0x56cf('0x48')]=function(_0x567ff0,_0x3f4efb,_0x5890e4){var _0x3bde63={};var _0x30d7c0={};var _0x32e334;var _0x4a9ae0;return db[_0x56cf('0x27')][_0x56cf('0x49')]({'where':{'id':_0x567ff0['params']['id']}})[_0x56cf('0x23')](handleEntityNotFound(_0x3f4efb,null))['then'](function(_0x3e4a27){if(_0x3e4a27){_0x32e334=_0x3e4a27;_0x30d7c0[_0x56cf('0x2b')]=_[_0x56cf('0x2e')](db[_0x56cf('0x4a')][_0x56cf('0x28')]);_0x30d7c0['query']=_[_0x56cf('0x2e')](_0x567ff0[_0x56cf('0x2d')]);_0x30d7c0[_0x56cf('0x2f')]=_[_0x56cf('0x31')](_0x30d7c0['model'],_0x30d7c0[_0x56cf('0x2d')]);_0x3bde63['attributes']=_[_0x56cf('0x31')](_0x30d7c0['model'],qs[_0x56cf('0x32')](_0x567ff0['query'][_0x56cf('0x32')]));_0x3bde63[_0x56cf('0x30')]=_0x3bde63['attributes'][_0x56cf('0x33')]?_0x3bde63['attributes']:_0x30d7c0['model'];_0x3bde63['order']=qs[_0x56cf('0x37')](_0x567ff0[_0x56cf('0x2d')]['sort']);_0x3bde63['where']=qs[_0x56cf('0x2f')](_[_0x56cf('0x4b')](_0x567ff0[_0x56cf('0x2d')],_0x30d7c0[_0x56cf('0x2f')]));if(_0x567ff0[_0x56cf('0x2d')][_0x56cf('0x3c')]){_0x3bde63[_0x56cf('0x38')]=_[_0x56cf('0x39')](_0x3bde63[_0x56cf('0x38')],{'$or':_[_0x56cf('0x2c')](_0x3bde63[_0x56cf('0x30')],function(_0x57c559){var _0x152638={};_0x152638[_0x57c559]={'$like':'%'+_0x567ff0[_0x56cf('0x2d')][_0x56cf('0x3c')]+'%'};return _0x152638;})});}_0x3bde63=_[_0x56cf('0x39')]({},_0x3bde63,_0x567ff0[_0x56cf('0x3d')]);return _0x32e334['getFields'](_0x3bde63);}})[_0x56cf('0x23')](function(_0x89095d){if(_0x89095d){_0x4a9ae0=_0x89095d[_0x56cf('0x33')];if(!_0x567ff0[_0x56cf('0x2d')][_0x56cf('0x34')]('nolimit')){_0x3bde63[_0x56cf('0x1d')]=qs[_0x56cf('0x1d')](_0x567ff0[_0x56cf('0x2d')][_0x56cf('0x1d')]);_0x3bde63['offset']=qs['offset'](_0x567ff0['query'][_0x56cf('0x1b')]);}return _0x32e334[_0x56cf('0x48')](_0x3bde63);}})['then'](function(_0x26645e){if(_0x26645e){return _0x26645e?{'count':_0x4a9ae0,'rows':_0x26645e}:null;}})[_0x56cf('0x23')](respondWithResult(_0x3f4efb,null))[_0x56cf('0x44')](handleError(_0x3f4efb,null));};exports[_0x56cf('0x4c')]=function(_0x5ee46f,_0x1e9531,_0x100688){var _0x147f1e={};var _0x1887cc={};var _0x56c817;var _0x4398d8;return db[_0x56cf('0x27')][_0x56cf('0x49')]({'where':{'id':_0x5ee46f[_0x56cf('0x42')]['id']}})[_0x56cf('0x23')](handleEntityNotFound(_0x1e9531,null))[_0x56cf('0x23')](function(_0x44adbb){if(_0x44adbb){_0x56c817=_0x44adbb;_0x1887cc[_0x56cf('0x2b')]=_[_0x56cf('0x2e')](db[_0x56cf('0x4a')][_0x56cf('0x28')]);_0x1887cc['query']=_[_0x56cf('0x2e')](_0x5ee46f[_0x56cf('0x2d')]);_0x1887cc[_0x56cf('0x2f')]=_[_0x56cf('0x31')](_0x1887cc[_0x56cf('0x2b')],_0x1887cc[_0x56cf('0x2d')]);_0x147f1e[_0x56cf('0x30')]=_[_0x56cf('0x31')](_0x1887cc[_0x56cf('0x2b')],qs[_0x56cf('0x32')](_0x5ee46f[_0x56cf('0x2d')][_0x56cf('0x32')]));_0x147f1e[_0x56cf('0x30')]=_0x147f1e[_0x56cf('0x30')][_0x56cf('0x33')]?_0x147f1e[_0x56cf('0x30')]:_0x1887cc['model'];_0x147f1e['order']=qs[_0x56cf('0x37')](_0x5ee46f[_0x56cf('0x2d')][_0x56cf('0x37')]);_0x147f1e[_0x56cf('0x38')]=qs[_0x56cf('0x2f')](_['pick'](_0x5ee46f[_0x56cf('0x2d')],_0x1887cc[_0x56cf('0x2f')]));if(_0x5ee46f[_0x56cf('0x2d')][_0x56cf('0x3c')]){_0x147f1e['where']=_[_0x56cf('0x39')](_0x147f1e[_0x56cf('0x38')],{'$or':_[_0x56cf('0x2c')](_0x147f1e[_0x56cf('0x30')],function(_0x5d7615){var _0x4fe8b5={};_0x4fe8b5[_0x5d7615]={'$like':'%'+_0x5ee46f[_0x56cf('0x2d')][_0x56cf('0x3c')]+'%'};return _0x4fe8b5;})});}_0x147f1e=_[_0x56cf('0x39')]({},_0x147f1e,_0x5ee46f[_0x56cf('0x3d')]);return _0x56c817[_0x56cf('0x4c')](_0x147f1e);}})[_0x56cf('0x23')](function(_0x4925eb){if(_0x4925eb){_0x4398d8=_0x4925eb[_0x56cf('0x33')];if(!_0x5ee46f[_0x56cf('0x2d')]['hasOwnProperty'](_0x56cf('0x35'))){_0x147f1e[_0x56cf('0x1d')]=qs[_0x56cf('0x1d')](_0x5ee46f['query'][_0x56cf('0x1d')]);_0x147f1e[_0x56cf('0x1b')]=qs['offset'](_0x5ee46f[_0x56cf('0x2d')][_0x56cf('0x1b')]);}return _0x56c817['getSubjects'](_0x147f1e);}})[_0x56cf('0x23')](function(_0x142abb){if(_0x142abb){return _0x142abb?{'count':_0x4398d8,'rows':_0x142abb}:null;}})['then'](respondWithResult(_0x1e9531,null))[_0x56cf('0x44')](handleError(_0x1e9531,null));};exports[_0x56cf('0x4d')]=function(_0x45b751,_0x330101,_0x169e03){var _0xe86345={};var _0x4cf900={};var _0x9b5c8c;var _0x559844;return db[_0x56cf('0x27')][_0x56cf('0x49')]({'where':{'id':_0x45b751[_0x56cf('0x42')]['id']}})[_0x56cf('0x23')](handleEntityNotFound(_0x330101,null))[_0x56cf('0x23')](function(_0x349151){if(_0x349151){_0x9b5c8c=_0x349151;_0x4cf900[_0x56cf('0x2b')]=_[_0x56cf('0x2e')](db[_0x56cf('0x4a')][_0x56cf('0x28')]);_0x4cf900[_0x56cf('0x2d')]=_[_0x56cf('0x2e')](_0x45b751[_0x56cf('0x2d')]);_0x4cf900[_0x56cf('0x2f')]=_[_0x56cf('0x31')](_0x4cf900['model'],_0x4cf900[_0x56cf('0x2d')]);_0xe86345[_0x56cf('0x30')]=_[_0x56cf('0x31')](_0x4cf900['model'],qs['fields'](_0x45b751[_0x56cf('0x2d')][_0x56cf('0x32')]));_0xe86345['attributes']=_0xe86345['attributes'][_0x56cf('0x33')]?_0xe86345[_0x56cf('0x30')]:_0x4cf900[_0x56cf('0x2b')];_0xe86345['order']=qs['sort'](_0x45b751[_0x56cf('0x2d')][_0x56cf('0x37')]);_0xe86345[_0x56cf('0x38')]=qs[_0x56cf('0x2f')](_['pick'](_0x45b751[_0x56cf('0x2d')],_0x4cf900[_0x56cf('0x2f')]));if(_0x45b751[_0x56cf('0x2d')][_0x56cf('0x3c')]){_0xe86345[_0x56cf('0x38')]=_[_0x56cf('0x39')](_0xe86345[_0x56cf('0x38')],{'$or':_[_0x56cf('0x2c')](_0xe86345[_0x56cf('0x30')],function(_0x4513bb){var _0x28544d={};_0x28544d[_0x4513bb]={'$like':'%'+_0x45b751[_0x56cf('0x2d')]['filter']+'%'};return _0x28544d;})});}_0xe86345=_[_0x56cf('0x39')]({},_0xe86345,_0x45b751[_0x56cf('0x3d')]);return _0x9b5c8c[_0x56cf('0x4d')](_0xe86345);}})[_0x56cf('0x23')](function(_0x574cb4){if(_0x574cb4){_0x559844=_0x574cb4[_0x56cf('0x33')];if(!_0x45b751[_0x56cf('0x2d')][_0x56cf('0x34')](_0x56cf('0x35'))){_0xe86345[_0x56cf('0x1d')]=qs[_0x56cf('0x1d')](_0x45b751['query'][_0x56cf('0x1d')]);_0xe86345[_0x56cf('0x1b')]=qs[_0x56cf('0x1b')](_0x45b751[_0x56cf('0x2d')][_0x56cf('0x1b')]);}return _0x9b5c8c[_0x56cf('0x4d')](_0xe86345);}})['then'](function(_0x52bd89){if(_0x52bd89){return _0x52bd89?{'count':_0x559844,'rows':_0x52bd89}:null;}})[_0x56cf('0x23')](respondWithResult(_0x330101,null))[_0x56cf('0x44')](handleError(_0x330101,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d288e64..ef7ac17 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 _0xc86d=['int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoConfiguration'];(function(_0x17e022,_0x402bb7){var _0x278853=function(_0x28de4a){while(--_0x28de4a){_0x17e022['push'](_0x17e022['shift']());}};_0x278853(++_0x402bb7);}(_0xc86d,0x16d));var _0xdc86=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xc86d[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xdc86('0x0'));var util=require(_0xdc86('0x1'));var logger=require('../../config/logger')(_0xdc86('0x2'));var moment=require(_0xdc86('0x3'));var BPromise=require(_0xdc86('0x4'));var rp=require(_0xdc86('0x5'));var fs=require('fs');var path=require(_0xdc86('0x6'));var rimraf=require(_0xdc86('0x7'));var config=require(_0xdc86('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0xdc86('0x9')]=function(_0xfe7053,_0x313ab8){return _0xfe7053[_0xdc86('0xa')](_0xdc86('0xb'),attributes,{'tableName':_0xdc86('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x334d=['int_zoho_configurations','lodash','util','api','moment','path','../../config/environment','exports','define'];(function(_0x4bdc4d,_0x1c884c){var _0x599c8f=function(_0x1cbe04){while(--_0x1cbe04){_0x4bdc4d['push'](_0x4bdc4d['shift']());}};_0x599c8f(++_0x1c884c);}(_0x334d,0x18d));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd334('0x0'));var util=require(_0xd334('0x1'));var logger=require('../../config/logger')(_0xd334('0x2'));var moment=require(_0xd334('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd334('0x4'));var rimraf=require('rimraf');var config=require(_0xd334('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0xd334('0x6')]=function(_0x1d7c2b,_0x2c3eb5){return _0x1d7c2b[_0xd334('0x7')]('ZohoConfiguration',attributes,{'tableName':_0xd334('0x8'),'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 57ee0db..a64a926 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 _0x490a=['request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x326e31,_0x4324bb){var _0x200702=function(_0x19d35a){while(--_0x19d35a){_0x326e31['push'](_0x326e31['shift']());}};_0x200702(++_0x4324bb);}(_0x490a,0xc4));var _0xa490=function(_0x395158,_0x15f899){_0x395158=_0x395158-0x0;var _0x1c5e50=_0x490a[_0x395158];return _0x1c5e50;};'use strict';var _=require('lodash');var util=require(_0xa490('0x0'));var moment=require(_0xa490('0x1'));var BPromise=require(_0xa490('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa490('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa490('0x4'));var logger=require(_0xa490('0x5'))(_0xa490('0x6'));var config=require(_0xa490('0x7'));var jayson=require(_0xa490('0x8'));var client=jayson[_0xa490('0x9')][_0xa490('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x169dd5,_0x52a1a1,_0x5688aa){return new BPromise(function(_0xec98d1,_0x54ea57){return client[_0xa490('0xb')](_0x169dd5,_0x5688aa)[_0xa490('0xc')](function(_0x2d8232){logger[_0xa490('0xd')](_0xa490('0xe'),_0x52a1a1,'request\x20sent');logger[_0xa490('0xf')](_0xa490('0x10'),_0x52a1a1,_0xa490('0x11'),JSON[_0xa490('0x12')](_0x2d8232));if(_0x2d8232['error']){if(_0x2d8232['error']['code']===0x1f4){logger[_0xa490('0x13')](_0xa490('0xe'),_0x52a1a1,_0x2d8232[_0xa490('0x13')][_0xa490('0x14')]);return _0x54ea57(_0x2d8232[_0xa490('0x13')]['message']);}logger[_0xa490('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x52a1a1,_0x2d8232[_0xa490('0x13')][_0xa490('0x14')]);return _0xec98d1(_0x2d8232[_0xa490('0x13')][_0xa490('0x14')]);}else{logger[_0xa490('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x52a1a1,'request\x20sent');_0xec98d1(_0x2d8232[_0xa490('0x15')]['message']);}})[_0xa490('0x16')](function(_0x1f9614){logger[_0xa490('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x52a1a1,_0x1f9614);_0x54ea57(_0x1f9614);});});} \ No newline at end of file +var _0x081d=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','debug'];(function(_0x3af63c,_0x580adb){var _0x4fbf4a=function(_0x1d1893){while(--_0x1d1893){_0x3af63c['push'](_0x3af63c['shift']());}};_0x4fbf4a(++_0x580adb);}(_0x081d,0xe4));var _0xd081=function(_0x2dbac1,_0x44db3b){_0x2dbac1=_0x2dbac1-0x0;var _0x8c4e86=_0x081d[_0x2dbac1];return _0x8c4e86;};'use strict';var _=require('lodash');var util=require(_0xd081('0x0'));var moment=require(_0xd081('0x1'));var BPromise=require(_0xd081('0x2'));var rs=require(_0xd081('0x3'));var fs=require('fs');var Redis=require(_0xd081('0x4'));var db=require(_0xd081('0x5'))['db'];var utils=require(_0xd081('0x6'));var logger=require(_0xd081('0x7'))(_0xd081('0x8'));var config=require(_0xd081('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x473e29,_0x3564c1,_0x36fbaa){return new BPromise(function(_0x1c56ba,_0x4352e4){return client[_0xd081('0xa')](_0x473e29,_0x36fbaa)[_0xd081('0xb')](function(_0x5a00a7){logger[_0xd081('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3564c1,'request\x20sent');logger[_0xd081('0xd')](_0xd081('0xe'),_0x3564c1,_0xd081('0xf'),JSON[_0xd081('0x10')](_0x5a00a7));if(_0x5a00a7['error']){if(_0x5a00a7['error']['code']===0x1f4){logger[_0xd081('0x11')](_0xd081('0x12'),_0x3564c1,_0x5a00a7[_0xd081('0x11')]['message']);return _0x4352e4(_0x5a00a7[_0xd081('0x11')]['message']);}logger[_0xd081('0x11')](_0xd081('0x12'),_0x3564c1,_0x5a00a7[_0xd081('0x11')][_0xd081('0x13')]);return _0x1c56ba(_0x5a00a7[_0xd081('0x11')][_0xd081('0x13')]);}else{logger[_0xd081('0xc')](_0xd081('0x12'),_0x3564c1,_0xd081('0xf'));_0x1c56ba(_0x5a00a7[_0xd081('0x14')][_0xd081('0x13')]);}})[_0xd081('0x15')](function(_0x1d89dd){logger[_0xd081('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3564c1,_0x1d89dd);_0x4352e4(_0x1d89dd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 614a8a4..a32d1d4 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 _0xbb3b=['show','post','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xbb3b,0x169));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbbb3('0x0'));var util=require(_0xbbb3('0x1'));var path=require(_0xbbb3('0x2'));var timeout=require(_0xbbb3('0x3'));var express=require(_0xbbb3('0x4'));var router=express[_0xbbb3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbb3('0x6'));var interaction=require(_0xbbb3('0x7'));var config=require('../../config/environment');var controller=require(_0xbbb3('0x8'));router[_0xbbb3('0x9')]('/',auth[_0xbbb3('0xa')](),controller[_0xbbb3('0xb')]);router['get'](_0xbbb3('0xc'),auth[_0xbbb3('0xa')](),controller[_0xbbb3('0xd')]);router[_0xbbb3('0xe')]('/',auth[_0xbbb3('0xa')](),controller['create']);router['put'](_0xbbb3('0xc'),auth[_0xbbb3('0xa')](),controller['update']);router['delete']('/:id',auth[_0xbbb3('0xa')](),controller[_0xbbb3('0xf')]);module[_0xbbb3('0x10')]=router; \ No newline at end of file +var _0x289b=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','create','put','update'];(function(_0x26e317,_0x33cab1){var _0x118004=function(_0x1662bd){while(--_0x1662bd){_0x26e317['push'](_0x26e317['shift']());}};_0x118004(++_0x33cab1);}(_0x289b,0x6d));var _0xb289=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x289b[_0x3f4dd9];return _0x31c54a;};'use strict';var multer=require(_0xb289('0x0'));var util=require(_0xb289('0x1'));var path=require(_0xb289('0x2'));var timeout=require(_0xb289('0x3'));var express=require(_0xb289('0x4'));var router=express['Router']();var fs_extra=require(_0xb289('0x5'));var auth=require(_0xb289('0x6'));var interaction=require(_0xb289('0x7'));var config=require(_0xb289('0x8'));var controller=require(_0xb289('0x9'));router[_0xb289('0xa')]('/',auth[_0xb289('0xb')](),controller[_0xb289('0xc')]);router[_0xb289('0xa')](_0xb289('0xd'),auth[_0xb289('0xb')](),controller['show']);router['post']('/',auth[_0xb289('0xb')](),controller[_0xb289('0xe')]);router[_0xb289('0xf')](_0xb289('0xd'),auth[_0xb289('0xb')](),controller[_0xb289('0x10')]);router['delete'](_0xb289('0xd'),auth['isAuthenticated'](),controller[_0xb289('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 01328d4..57e228e 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 _0xebad=['string','variable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0x3647f7,_0x5bdeed){var _0x2f96de=function(_0x4e66a6){while(--_0x4e66a6){_0x3647f7['push'](_0x3647f7['shift']());}};_0x2f96de(++_0x5bdeed);}(_0xebad,0x16b));var _0xdeba=function(_0x1a5190,_0x2d35d9){_0x1a5190=_0x1a5190-0x0;var _0xa4bb1=_0xebad[_0x1a5190];return _0xa4bb1;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xdeba('0x0')](_0xdeba('0x1'),_0xdeba('0x2'),'customVariable',_0xdeba('0x3'),_0xdeba('0x4')),'defaultValue':_0xdeba('0x1')},'content':{'type':Sequelize[_0xdeba('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdeba('0x0')](_0xdeba('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xdeba('0x5')]},'idField':{'type':Sequelize[_0xdeba('0x5')]},'nameField':{'type':Sequelize[_0xdeba('0x5')]},'customField':{'type':Sequelize[_0xdeba('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdeba('0x5')]}}; \ No newline at end of file +var _0x9551=['ENUM','string','variable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x20875,_0x4ae300){var _0x237ac4=function(_0xa8d1aa){while(--_0xa8d1aa){_0x20875['push'](_0x20875['shift']());}};_0x237ac4(++_0x4ae300);}(_0x9551,0x66));var _0x1955=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x9551[_0x264d4d];return _0xc917e2;};'use strict';var Sequelize=require(_0x1955('0x0'));module[_0x1955('0x1')]={'type':{'type':Sequelize[_0x1955('0x2')](_0x1955('0x3'),_0x1955('0x4'),'customVariable','keyValue',_0x1955('0x5')),'defaultValue':_0x1955('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1955('0x6')]},'keyType':{'type':Sequelize[_0x1955('0x2')](_0x1955('0x3'),_0x1955('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1955('0x6')]},'idField':{'type':Sequelize[_0x1955('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1955('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1955('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 730e07c..aaa5e7d 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 _0xebda=['includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','error','stack','name','index','fieldName','type','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','ZohoField'];(function(_0xdfd52c,_0x5a4cbb){var _0xff23c3=function(_0x1198fe){while(--_0x1198fe){_0xdfd52c['push'](_0xdfd52c['shift']());}};_0xff23c3(++_0x5a4cbb);}(_0xebda,0xa9));var _0xaebd=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xebda[_0x3f0b30];return _0x2748a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaebd('0x0'));var zipdir=require(_0xaebd('0x1'));var jsonpatch=require(_0xaebd('0x2'));var rp=require(_0xaebd('0x3'));var moment=require(_0xaebd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaebd('0x5'));var util=require(_0xaebd('0x6'));var path=require(_0xaebd('0x7'));var sox=require(_0xaebd('0x8'));var csv=require(_0xaebd('0x9'));var ejs=require(_0xaebd('0xa'));var fs=require('fs');var fs_extra=require(_0xaebd('0xb'));var _=require(_0xaebd('0xc'));var squel=require('squel');var crypto=require(_0xaebd('0xd'));var jsforce=require(_0xaebd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaebd('0x9'));var querystring=require(_0xaebd('0xf'));var Papa=require('papaparse');var Redis=require(_0xaebd('0x10'));var authService=require(_0xaebd('0x11'));var qs=require(_0xaebd('0x12'));var as=require(_0xaebd('0x13'));var hardwareService=require(_0xaebd('0x14'));var logger=require(_0xaebd('0x15'))(_0xaebd('0x16'));var utils=require(_0xaebd('0x17'));var config=require(_0xaebd('0x18'));var licenseUtil=require(_0xaebd('0x19'));var db=require(_0xaebd('0x1a'))['db'];function respondWithStatusCode(_0x5eb5f1,_0x57f270){_0x57f270=_0x57f270||0xcc;return function(_0x3abac8){if(_0x3abac8){return _0x5eb5f1[_0xaebd('0x1b')](_0x57f270);}return _0x5eb5f1[_0xaebd('0x1c')](_0x57f270)[_0xaebd('0x1d')]();};}function respondWithResult(_0x144194,_0x3f821b){_0x3f821b=_0x3f821b||0xc8;return function(_0x277019){if(_0x277019){return _0x144194[_0xaebd('0x1c')](_0x3f821b)[_0xaebd('0x1e')](_0x277019);}};}function respondWithFilteredResult(_0x38d1ce,_0x4ab384){return function(_0x1ed2ef){if(_0x1ed2ef){var _0x3ac6f0=typeof _0x4ab384[_0xaebd('0x1f')]===_0xaebd('0x20')&&typeof _0x4ab384['limit']===_0xaebd('0x20');var _0x5a2c80=_0x1ed2ef[_0xaebd('0x21')];var _0x20d3d9=_0x3ac6f0?0x0:_0x4ab384['offset'];var _0x20cc89=_0x3ac6f0?_0x1ed2ef[_0xaebd('0x21')]:_0x4ab384[_0xaebd('0x1f')]+_0x4ab384['limit'];var _0x5de2aa;if(_0x20cc89>=_0x5a2c80){_0x20cc89=_0x5a2c80;_0x5de2aa=0xc8;}else{_0x5de2aa=0xce;}_0x38d1ce['status'](_0x5de2aa);return _0x38d1ce['set'](_0xaebd('0x22'),_0x20d3d9+'-'+_0x20cc89+'/'+_0x5a2c80)[_0xaebd('0x1e')](_0x1ed2ef);}return null;};}function patchUpdates(_0x202319){return function(_0x57ee7a){try{jsonpatch[_0xaebd('0x23')](_0x57ee7a,_0x202319,!![]);}catch(_0x286f79){return BPromise[_0xaebd('0x24')](_0x286f79);}return _0x57ee7a['save']();};}function saveUpdates(_0x14270c,_0x34884a){return function(_0x43baeb){if(_0x43baeb){return _0x43baeb[_0xaebd('0x25')](_0x14270c)[_0xaebd('0x26')](function(_0x5c94c0){return _0x5c94c0;});}return null;};}function removeEntity(_0x33db28,_0x4eff3c){return function(_0x33d6d3){if(_0x33d6d3){return _0x33d6d3['destroy']()[_0xaebd('0x26')](function(){_0x33db28[_0xaebd('0x1c')](0xcc)[_0xaebd('0x1d')]();});}};}function handleEntityNotFound(_0x4be0fd,_0x57a78e){return function(_0x3560ed){if(!_0x3560ed){_0x4be0fd[_0xaebd('0x1b')](0x194);}return _0x3560ed;};}function handleError(_0x24e148,_0x3bb94b){_0x3bb94b=_0x3bb94b||0x1f4;return function(_0x570c1e){logger[_0xaebd('0x27')](_0x570c1e[_0xaebd('0x28')]);if(_0x570c1e[_0xaebd('0x29')]){delete _0x570c1e[_0xaebd('0x29')];}_0x24e148['status'](_0x3bb94b)['send'](_0x570c1e);};}exports[_0xaebd('0x2a')]=function(_0xe7a6ca,_0x391700){var _0x48acac={},_0x75631c={},_0x17bbd2={'count':0x0,'rows':[]};var _0x2faa2f=_['map'](db['ZohoField']['rawAttributes'],function(_0x5e8efd){return{'name':_0x5e8efd[_0xaebd('0x2b')],'type':_0x5e8efd[_0xaebd('0x2c')]['key']};});_0x75631c[_0xaebd('0x2d')]=_[_0xaebd('0x2e')](_0x2faa2f,_0xaebd('0x29'));_0x75631c['query']=_[_0xaebd('0x2f')](_0xe7a6ca[_0xaebd('0x30')]);_0x75631c['filters']=_[_0xaebd('0x31')](_0x75631c[_0xaebd('0x2d')],_0x75631c[_0xaebd('0x30')]);_0x48acac[_0xaebd('0x32')]=_['intersection'](_0x75631c[_0xaebd('0x2d')],qs[_0xaebd('0x33')](_0xe7a6ca[_0xaebd('0x30')]['fields']));_0x48acac[_0xaebd('0x32')]=_0x48acac[_0xaebd('0x32')]['length']?_0x48acac[_0xaebd('0x32')]:_0x75631c[_0xaebd('0x2d')];if(!_0xe7a6ca[_0xaebd('0x30')][_0xaebd('0x34')](_0xaebd('0x35'))){_0x48acac[_0xaebd('0x36')]=qs[_0xaebd('0x36')](_0xe7a6ca[_0xaebd('0x30')][_0xaebd('0x36')]);_0x48acac['offset']=qs[_0xaebd('0x1f')](_0xe7a6ca[_0xaebd('0x30')][_0xaebd('0x1f')]);}_0x48acac[_0xaebd('0x37')]=qs['sort'](_0xe7a6ca[_0xaebd('0x30')][_0xaebd('0x38')]);_0x48acac['where']=qs[_0xaebd('0x39')](_[_0xaebd('0x3a')](_0xe7a6ca[_0xaebd('0x30')],_0x75631c[_0xaebd('0x39')]),_0x2faa2f);if(_0xe7a6ca[_0xaebd('0x30')][_0xaebd('0x3b')]){_0x48acac[_0xaebd('0x3c')]=_[_0xaebd('0x3d')](_0x48acac[_0xaebd('0x3c')],{'$or':_[_0xaebd('0x2e')](_0x2faa2f,function(_0x101169){if(_0x101169[_0xaebd('0x2c')]!==_0xaebd('0x3e')){var _0x4a3ec2={};_0x4a3ec2[_0x101169[_0xaebd('0x29')]]={'$like':'%'+_0xe7a6ca[_0xaebd('0x30')]['filter']+'%'};return _0x4a3ec2;}})});}_0x48acac=_['merge']({},_0x48acac,_0xe7a6ca[_0xaebd('0x3f')]);var _0x307879={'where':_0x48acac[_0xaebd('0x3c')]};return db[_0xaebd('0x40')]['count'](_0x307879)[_0xaebd('0x26')](function(_0x308e10){_0x17bbd2[_0xaebd('0x21')]=_0x308e10;if(_0xe7a6ca[_0xaebd('0x30')][_0xaebd('0x41')]){_0x48acac[_0xaebd('0x42')]=[{'all':!![]}];}return db[_0xaebd('0x40')][_0xaebd('0x43')](_0x48acac);})[_0xaebd('0x26')](function(_0x5eac84){_0x17bbd2[_0xaebd('0x44')]=_0x5eac84;return _0x17bbd2;})[_0xaebd('0x26')](respondWithFilteredResult(_0x391700,_0x48acac))['catch'](handleError(_0x391700,null));};exports[_0xaebd('0x45')]=function(_0x581148,_0x466285){var _0x4b18fb={'raw':!![],'where':{'id':_0x581148[_0xaebd('0x46')]['id']}},_0x4b32a9={};_0x4b32a9[_0xaebd('0x2d')]=_[_0xaebd('0x2f')](db['ZohoField'][_0xaebd('0x47')]);_0x4b32a9['query']=_['keys'](_0x581148[_0xaebd('0x30')]);_0x4b32a9[_0xaebd('0x39')]=_[_0xaebd('0x31')](_0x4b32a9['model'],_0x4b32a9[_0xaebd('0x30')]);_0x4b18fb[_0xaebd('0x32')]=_[_0xaebd('0x31')](_0x4b32a9[_0xaebd('0x2d')],qs[_0xaebd('0x33')](_0x581148[_0xaebd('0x30')][_0xaebd('0x33')]));_0x4b18fb[_0xaebd('0x32')]=_0x4b18fb[_0xaebd('0x32')][_0xaebd('0x48')]?_0x4b18fb['attributes']:_0x4b32a9[_0xaebd('0x2d')];if(_0x581148['query'][_0xaebd('0x41')]){_0x4b18fb[_0xaebd('0x42')]=[{'all':!![]}];}_0x4b18fb=_[_0xaebd('0x3d')]({},_0x4b18fb,_0x581148[_0xaebd('0x3f')]);return db[_0xaebd('0x40')][_0xaebd('0x49')](_0x4b18fb)[_0xaebd('0x26')](handleEntityNotFound(_0x466285,null))[_0xaebd('0x26')](respondWithResult(_0x466285,null))['catch'](handleError(_0x466285,null));};exports[_0xaebd('0x4a')]=function(_0x233cbd,_0x4ae059){return db[_0xaebd('0x40')][_0xaebd('0x4a')](_0x233cbd['body'],{})[_0xaebd('0x26')](respondWithResult(_0x4ae059,0xc9))['catch'](handleError(_0x4ae059,null));};exports[_0xaebd('0x25')]=function(_0x3a5c8f,_0x2a7b35){if(_0x3a5c8f[_0xaebd('0x4b')]['id']){delete _0x3a5c8f['body']['id'];}return db[_0xaebd('0x40')][_0xaebd('0x49')]({'where':{'id':_0x3a5c8f[_0xaebd('0x46')]['id']}})[_0xaebd('0x26')](handleEntityNotFound(_0x2a7b35,null))[_0xaebd('0x26')](saveUpdates(_0x3a5c8f['body'],null))['then'](respondWithResult(_0x2a7b35,null))[_0xaebd('0x4c')](handleError(_0x2a7b35,null));};exports[_0xaebd('0x4d')]=function(_0x32449e,_0x555109){return db['ZohoField'][_0xaebd('0x49')]({'where':{'id':_0x32449e[_0xaebd('0x46')]['id']}})[_0xaebd('0x26')](handleEntityNotFound(_0x555109,null))[_0xaebd('0x26')](removeEntity(_0x555109,null))[_0xaebd('0x4c')](handleError(_0x555109,null));}; \ No newline at end of file +var _0x87cc=['error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x87cc,0xc6));var _0xc87c=function(_0x24a8ce,_0x23e829){_0x24a8ce=_0x24a8ce-0x0;var _0x4952d4=_0x87cc[_0x24a8ce];return _0x4952d4;};'use strict';var emlformat=require(_0xc87c('0x0'));var rimraf=require(_0xc87c('0x1'));var zipdir=require(_0xc87c('0x2'));var jsonpatch=require(_0xc87c('0x3'));var rp=require(_0xc87c('0x4'));var moment=require(_0xc87c('0x5'));var BPromise=require(_0xc87c('0x6'));var Mustache=require(_0xc87c('0x7'));var util=require(_0xc87c('0x8'));var path=require(_0xc87c('0x9'));var sox=require(_0xc87c('0xa'));var csv=require(_0xc87c('0xb'));var ejs=require(_0xc87c('0xc'));var fs=require('fs');var fs_extra=require(_0xc87c('0xd'));var _=require(_0xc87c('0xe'));var squel=require(_0xc87c('0xf'));var crypto=require(_0xc87c('0x10'));var jsforce=require(_0xc87c('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc87c('0x12'));var Papa=require(_0xc87c('0x13'));var Redis=require(_0xc87c('0x14'));var authService=require(_0xc87c('0x15'));var qs=require(_0xc87c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc87c('0x17'));var logger=require(_0xc87c('0x18'))('api');var utils=require(_0xc87c('0x19'));var config=require(_0xc87c('0x1a'));var licenseUtil=require(_0xc87c('0x1b'));var db=require(_0xc87c('0x1c'))['db'];function respondWithStatusCode(_0xec9e09,_0x3d8e69){_0x3d8e69=_0x3d8e69||0xcc;return function(_0x25011d){if(_0x25011d){return _0xec9e09[_0xc87c('0x1d')](_0x3d8e69);}return _0xec9e09[_0xc87c('0x1e')](_0x3d8e69)[_0xc87c('0x1f')]();};}function respondWithResult(_0x2e7fc2,_0x421e32){_0x421e32=_0x421e32||0xc8;return function(_0x4ce7bb){if(_0x4ce7bb){return _0x2e7fc2[_0xc87c('0x1e')](_0x421e32)[_0xc87c('0x20')](_0x4ce7bb);}};}function respondWithFilteredResult(_0x3f1be1,_0x4dc837){return function(_0xfc7536){if(_0xfc7536){var _0x4d7d11=typeof _0x4dc837['offset']===_0xc87c('0x21')&&typeof _0x4dc837[_0xc87c('0x22')]===_0xc87c('0x21');var _0x19d740=_0xfc7536['count'];var _0x1c03cc=_0x4d7d11?0x0:_0x4dc837['offset'];var _0x103677=_0x4d7d11?_0xfc7536[_0xc87c('0x23')]:_0x4dc837[_0xc87c('0x24')]+_0x4dc837[_0xc87c('0x22')];var _0x44e417;if(_0x103677>=_0x19d740){_0x103677=_0x19d740;_0x44e417=0xc8;}else{_0x44e417=0xce;}_0x3f1be1[_0xc87c('0x1e')](_0x44e417);return _0x3f1be1[_0xc87c('0x25')](_0xc87c('0x26'),_0x1c03cc+'-'+_0x103677+'/'+_0x19d740)[_0xc87c('0x20')](_0xfc7536);}return null;};}function patchUpdates(_0x18247f){return function(_0x3000ea){try{jsonpatch[_0xc87c('0x27')](_0x3000ea,_0x18247f,!![]);}catch(_0x18fe92){return BPromise[_0xc87c('0x28')](_0x18fe92);}return _0x3000ea[_0xc87c('0x29')]();};}function saveUpdates(_0xeac1db,_0x45d0ff){return function(_0x4acd9c){if(_0x4acd9c){return _0x4acd9c[_0xc87c('0x2a')](_0xeac1db)[_0xc87c('0x2b')](function(_0x41e9d3){return _0x41e9d3;});}return null;};}function removeEntity(_0x284051,_0x21823a){return function(_0x1d2fce){if(_0x1d2fce){return _0x1d2fce[_0xc87c('0x2c')]()['then'](function(){_0x284051[_0xc87c('0x1e')](0xcc)[_0xc87c('0x1f')]();});}};}function handleEntityNotFound(_0x2a93b6,_0x2cf3aa){return function(_0x49825d){if(!_0x49825d){_0x2a93b6[_0xc87c('0x1d')](0x194);}return _0x49825d;};}function handleError(_0x2b0851,_0x596b3d){_0x596b3d=_0x596b3d||0x1f4;return function(_0x59fe18){logger[_0xc87c('0x2d')](_0x59fe18[_0xc87c('0x2e')]);if(_0x59fe18[_0xc87c('0x2f')]){delete _0x59fe18[_0xc87c('0x2f')];}_0x2b0851[_0xc87c('0x1e')](_0x596b3d)[_0xc87c('0x30')](_0x59fe18);};}exports[_0xc87c('0x31')]=function(_0x5b161d,_0x13d49d){var _0x29f862={},_0x3d96c7={},_0x3885c4={'count':0x0,'rows':[]};var _0x9ed264=_[_0xc87c('0x32')](db[_0xc87c('0x33')][_0xc87c('0x34')],function(_0x4b1de5){return{'name':_0x4b1de5[_0xc87c('0x35')],'type':_0x4b1de5['type'][_0xc87c('0x36')]};});_0x3d96c7['model']=_['map'](_0x9ed264,_0xc87c('0x2f'));_0x3d96c7['query']=_[_0xc87c('0x37')](_0x5b161d[_0xc87c('0x38')]);_0x3d96c7[_0xc87c('0x39')]=_[_0xc87c('0x3a')](_0x3d96c7[_0xc87c('0x3b')],_0x3d96c7['query']);_0x29f862[_0xc87c('0x3c')]=_[_0xc87c('0x3a')](_0x3d96c7['model'],qs['fields'](_0x5b161d['query'][_0xc87c('0x3d')]));_0x29f862['attributes']=_0x29f862['attributes'][_0xc87c('0x3e')]?_0x29f862[_0xc87c('0x3c')]:_0x3d96c7[_0xc87c('0x3b')];if(!_0x5b161d[_0xc87c('0x38')][_0xc87c('0x3f')]('nolimit')){_0x29f862[_0xc87c('0x22')]=qs[_0xc87c('0x22')](_0x5b161d[_0xc87c('0x38')][_0xc87c('0x22')]);_0x29f862[_0xc87c('0x24')]=qs[_0xc87c('0x24')](_0x5b161d[_0xc87c('0x38')][_0xc87c('0x24')]);}_0x29f862[_0xc87c('0x40')]=qs[_0xc87c('0x41')](_0x5b161d[_0xc87c('0x38')][_0xc87c('0x41')]);_0x29f862['where']=qs['filters'](_[_0xc87c('0x42')](_0x5b161d[_0xc87c('0x38')],_0x3d96c7[_0xc87c('0x39')]),_0x9ed264);if(_0x5b161d[_0xc87c('0x38')][_0xc87c('0x43')]){_0x29f862[_0xc87c('0x44')]=_[_0xc87c('0x45')](_0x29f862[_0xc87c('0x44')],{'$or':_[_0xc87c('0x32')](_0x9ed264,function(_0x22338a){if(_0x22338a[_0xc87c('0x46')]!==_0xc87c('0x47')){var _0x4a4d67={};_0x4a4d67[_0x22338a[_0xc87c('0x2f')]]={'$like':'%'+_0x5b161d[_0xc87c('0x38')][_0xc87c('0x43')]+'%'};return _0x4a4d67;}})});}_0x29f862=_[_0xc87c('0x45')]({},_0x29f862,_0x5b161d['options']);var _0x2204c9={'where':_0x29f862['where']};return db['ZohoField'][_0xc87c('0x23')](_0x2204c9)['then'](function(_0x2d88f5){_0x3885c4[_0xc87c('0x23')]=_0x2d88f5;if(_0x5b161d[_0xc87c('0x38')][_0xc87c('0x48')]){_0x29f862[_0xc87c('0x49')]=[{'all':!![]}];}return db[_0xc87c('0x33')][_0xc87c('0x4a')](_0x29f862);})['then'](function(_0xf76750){_0x3885c4['rows']=_0xf76750;return _0x3885c4;})[_0xc87c('0x2b')](respondWithFilteredResult(_0x13d49d,_0x29f862))[_0xc87c('0x4b')](handleError(_0x13d49d,null));};exports['show']=function(_0x3daaa5,_0x4fac36){var _0x670a2b={'raw':!![],'where':{'id':_0x3daaa5[_0xc87c('0x4c')]['id']}},_0x5aa8cd={};_0x5aa8cd[_0xc87c('0x3b')]=_['keys'](db[_0xc87c('0x33')][_0xc87c('0x34')]);_0x5aa8cd[_0xc87c('0x38')]=_[_0xc87c('0x37')](_0x3daaa5[_0xc87c('0x38')]);_0x5aa8cd[_0xc87c('0x39')]=_[_0xc87c('0x3a')](_0x5aa8cd['model'],_0x5aa8cd[_0xc87c('0x38')]);_0x670a2b[_0xc87c('0x3c')]=_[_0xc87c('0x3a')](_0x5aa8cd[_0xc87c('0x3b')],qs[_0xc87c('0x3d')](_0x3daaa5[_0xc87c('0x38')][_0xc87c('0x3d')]));_0x670a2b[_0xc87c('0x3c')]=_0x670a2b[_0xc87c('0x3c')][_0xc87c('0x3e')]?_0x670a2b[_0xc87c('0x3c')]:_0x5aa8cd[_0xc87c('0x3b')];if(_0x3daaa5['query'][_0xc87c('0x48')]){_0x670a2b[_0xc87c('0x49')]=[{'all':!![]}];}_0x670a2b=_[_0xc87c('0x45')]({},_0x670a2b,_0x3daaa5[_0xc87c('0x4d')]);return db[_0xc87c('0x33')][_0xc87c('0x4e')](_0x670a2b)[_0xc87c('0x2b')](handleEntityNotFound(_0x4fac36,null))[_0xc87c('0x2b')](respondWithResult(_0x4fac36,null))[_0xc87c('0x4b')](handleError(_0x4fac36,null));};exports['create']=function(_0x36e74e,_0x1a783e){return db[_0xc87c('0x33')][_0xc87c('0x4f')](_0x36e74e[_0xc87c('0x50')],{})[_0xc87c('0x2b')](respondWithResult(_0x1a783e,0xc9))[_0xc87c('0x4b')](handleError(_0x1a783e,null));};exports['update']=function(_0x147c27,_0x20667d){if(_0x147c27['body']['id']){delete _0x147c27['body']['id'];}return db[_0xc87c('0x33')][_0xc87c('0x4e')]({'where':{'id':_0x147c27[_0xc87c('0x4c')]['id']}})[_0xc87c('0x2b')](handleEntityNotFound(_0x20667d,null))[_0xc87c('0x2b')](saveUpdates(_0x147c27['body'],null))[_0xc87c('0x2b')](respondWithResult(_0x20667d,null))[_0xc87c('0x4b')](handleError(_0x20667d,null));};exports[_0xc87c('0x2c')]=function(_0x1b139f,_0x483c26){return db[_0xc87c('0x33')][_0xc87c('0x4e')]({'where':{'id':_0x1b139f['params']['id']}})[_0xc87c('0x2b')](handleEntityNotFound(_0x483c26,null))[_0xc87c('0x2b')](removeEntity(_0x483c26,null))['catch'](handleError(_0x483c26,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b0bb89d..2cda5ef 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 _0x90b1=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0x38802c,_0x3afdac){var _0x547c6c=function(_0x9eba2a){while(--_0x9eba2a){_0x38802c['push'](_0x38802c['shift']());}};_0x547c6c(++_0x3afdac);}(_0x90b1,0x1bb));var _0x190b=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0x90b1[_0x5a184b];return _0x713964;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xb'),_0x190b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x958a=['moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','lodash','util','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x958a,0x128));var _0xa958=function(_0x834b51,_0x3cc4f4){_0x834b51=_0x834b51-0x0;var _0x23c70e=_0x958a[_0x834b51];return _0x23c70e;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./intZohoField.attributes');module[_0xa958('0x8')]=function(_0x9b7d9e,_0x2692d6){return _0x9b7d9e[_0xa958('0x9')](_0xa958('0xa'),attributes,{'tableName':_0xa958('0xb'),'paranoid':![],'indexes':[{'name':_0xa958('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 442e213..f6d7d55 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 _0xe660=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xe660,0x120));var _0x0e66=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0xe660[_0xc0638b];return _0xd57dfa;};'use strict';var _=require(_0x0e66('0x0'));var util=require(_0x0e66('0x1'));var moment=require(_0x0e66('0x2'));var BPromise=require(_0x0e66('0x3'));var rs=require(_0x0e66('0x4'));var fs=require('fs');var Redis=require(_0x0e66('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e66('0x6'));var logger=require('../../config/logger')(_0x0e66('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e66('0x8')][_0x0e66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3600,_0x231002,_0x4fc89c){return new BPromise(function(_0x442113,_0x1e9699){return client[_0x0e66('0xa')](_0x4c3600,_0x4fc89c)['then'](function(_0x468cac){logger['info'](_0x0e66('0xb'),_0x231002,_0x0e66('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x231002,_0x0e66('0xc'),JSON['stringify'](_0x468cac));if(_0x468cac['error']){if(_0x468cac[_0x0e66('0xd')]['code']===0x1f4){logger['error'](_0x0e66('0xb'),_0x231002,_0x468cac['error'][_0x0e66('0xe')]);return _0x1e9699(_0x468cac[_0x0e66('0xd')][_0x0e66('0xe')]);}logger['error'](_0x0e66('0xb'),_0x231002,_0x468cac[_0x0e66('0xd')][_0x0e66('0xe')]);return _0x442113(_0x468cac[_0x0e66('0xd')][_0x0e66('0xe')]);}else{logger[_0x0e66('0xf')]('ZohoField,\x20%s,\x20%s',_0x231002,_0x0e66('0xc'));_0x442113(_0x468cac[_0x0e66('0x10')][_0x0e66('0xe')]);}})[_0x0e66('0x11')](function(_0x1fb543){logger[_0x0e66('0xd')](_0x0e66('0xb'),_0x231002,_0x1fb543);_0x1e9699(_0x1fb543);});});} \ No newline at end of file +var _0xed80=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x563cdb,_0x5d9b4){var _0x3abae1=function(_0x5b0c28){while(--_0x5b0c28){_0x563cdb['push'](_0x563cdb['shift']());}};_0x3abae1(++_0x5d9b4);}(_0xed80,0x1d9));var _0x0ed8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xed80[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x0ed8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ed8('0x1'));var rs=require(_0x0ed8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ed8('0x3'))['db'];var utils=require(_0x0ed8('0x4'));var logger=require(_0x0ed8('0x5'))(_0x0ed8('0x6'));var config=require(_0x0ed8('0x7'));var jayson=require(_0x0ed8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc86c24,_0xd1677e,_0x57f0e0){return new BPromise(function(_0x268ad2,_0x28ff49){return client[_0x0ed8('0x9')](_0xc86c24,_0x57f0e0)[_0x0ed8('0xa')](function(_0x12b60f){logger[_0x0ed8('0xb')](_0x0ed8('0xc'),_0xd1677e,_0x0ed8('0xd'));logger['debug'](_0x0ed8('0xe'),_0xd1677e,_0x0ed8('0xd'),JSON[_0x0ed8('0xf')](_0x12b60f));if(_0x12b60f[_0x0ed8('0x10')]){if(_0x12b60f[_0x0ed8('0x10')][_0x0ed8('0x11')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0xd1677e,_0x12b60f[_0x0ed8('0x10')][_0x0ed8('0x12')]);return _0x28ff49(_0x12b60f[_0x0ed8('0x10')]['message']);}logger[_0x0ed8('0x10')](_0x0ed8('0xc'),_0xd1677e,_0x12b60f[_0x0ed8('0x10')]['message']);return _0x268ad2(_0x12b60f[_0x0ed8('0x10')][_0x0ed8('0x12')]);}else{logger['info'](_0x0ed8('0xc'),_0xd1677e,'request\x20sent');_0x268ad2(_0x12b60f[_0x0ed8('0x13')][_0x0ed8('0x12')]);}})[_0x0ed8('0x14')](function(_0x527044){logger[_0x0ed8('0x10')](_0x0ed8('0xc'),_0xd1677e,_0x527044);_0x28ff49(_0x527044);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c3ce819..dabac00 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x56b237,_0x28f636){var _0x2148a3=function(_0x525f80){while(--_0x525f80){_0x56b237['push'](_0x56b237['shift']());}};_0x2148a3(++_0x28f636);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0xcb91[_0x304b67];return _0x493afb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x28b3ef,_0x446027){var _0x5e9813=function(_0x301450){while(--_0x301450){_0x28b3ef['push'](_0x28b3ef['shift']());}};_0x5e9813(++_0x446027);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xcb91[_0x1573ea];return _0x51c0e2;};'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 88ff1d9..9ab3f76 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 _0x0a01=['exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','state','sequelize'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x0a01,0x156));var _0x10a0=function(_0x7ca44f,_0x38f5d4){_0x7ca44f=_0x7ca44f-0x0;var _0x6e86d9=_0x0a01[_0x7ca44f];return _0x6e86d9;};'use strict';var Sequelize=require(_0x10a0('0x0'));module[_0x10a0('0x1')]={'name':{'type':Sequelize[_0x10a0('0x2')],'allowNull':![],'unique':_0x10a0('0x3')},'version':{'type':Sequelize[_0x10a0('0x2')],'allowNull':![],'unique':_0x10a0('0x3')},'main':{'type':Sequelize[_0x10a0('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x10a0('0x2')]},'path':{'type':Sequelize[_0x10a0('0x2')]},'type':{'type':Sequelize[_0x10a0('0x2')]},'size':{'type':Sequelize[_0x10a0('0x4')]},'active':{'type':Sequelize[_0x10a0('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x10a0('0x2')]},'logo':{'type':Sequelize[_0x10a0('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x10a0('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x10a0('0x2')]},'remoteUri':{'type':Sequelize[_0x10a0('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xd2be=['app.js','BOOLEAN','STRING','unique_name_and_version'];(function(_0x3137b3,_0x101dc9){var _0x293b31=function(_0x1e2d84){while(--_0x1e2d84){_0x3137b3['push'](_0x3137b3['shift']());}};_0x293b31(++_0x101dc9);}(_0xd2be,0x86));var _0xed2b=function(_0x3070a5,_0xcf7f85){_0x3070a5=_0x3070a5-0x0;var _0x2ae47f=_0xd2be[_0x3070a5];return _0x2ae47f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xed2b('0x0')],'allowNull':![],'unique':_0xed2b('0x1')},'version':{'type':Sequelize[_0xed2b('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xed2b('0x2')},'filename':{'type':Sequelize[_0xed2b('0x0')]},'path':{'type':Sequelize[_0xed2b('0x0')]},'type':{'type':Sequelize[_0xed2b('0x0')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xed2b('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0xed2b('0x0')]},'logo':{'type':Sequelize[_0xed2b('0x0')]},'state':{'type':Sequelize[_0xed2b('0x0')],'unique':'state'},'description':{'type':Sequelize[_0xed2b('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'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 b13bd9e..995699f 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 _0x2542=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x27a45d,_0x14499a){var _0x5aee32=function(_0x3958f2){while(--_0x3958f2){_0x27a45d['push'](_0x27a45d['shift']());}};_0x5aee32(++_0x14499a);}(_0x2542,0x169));var _0x2254=function(_0x239748,_0x232c48){_0x239748=_0x239748-0x0;var _0xb02f5c=_0x2542[_0x239748];return _0xb02f5c;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['Integration'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));}; \ No newline at end of file +var _0x187d=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create'];(function(_0x22608f,_0x1ce6dd){var _0x3439b2=function(_0xaab1d7){while(--_0xaab1d7){_0x22608f['push'](_0x22608f['shift']());}};_0x3439b2(++_0x1ce6dd);}(_0x187d,0x93));var _0xd187=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x187d[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 58e1038..4700b71 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 _0xc60f=['../../config/logger','moment','request-promise','path','./integration.attributes','define','integrations','util'];(function(_0x409186,_0x4b8b73){var _0x3deb43=function(_0x358728){while(--_0x358728){_0x409186['push'](_0x409186['shift']());}};_0x3deb43(++_0x4b8b73);}(_0xc60f,0xc7));var _0xfc60=function(_0x512b48,_0xa3924f){_0x512b48=_0x512b48-0x0;var _0x278a76=_0xc60f[_0x512b48];return _0x278a76;};'use strict';var _=require('lodash');var util=require(_0xfc60('0x0'));var logger=require(_0xfc60('0x1'))('api');var moment=require(_0xfc60('0x2'));var BPromise=require('bluebird');var rp=require(_0xfc60('0x3'));var fs=require('fs');var path=require(_0xfc60('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc60('0x5'));module['exports']=function(_0xa07fcd,_0x1b19c7){return _0xa07fcd[_0xfc60('0x6')]('Integration',attributes,{'tableName':_0xfc60('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee82=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','Integration','integrations'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xee82,0x144));var _0x2ee8=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0xee82[_0x1e6b59];return _0x40d7c5;};'use strict';var _=require(_0x2ee8('0x0'));var util=require(_0x2ee8('0x1'));var logger=require(_0x2ee8('0x2'))(_0x2ee8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ee8('0x4'));var rimraf=require(_0x2ee8('0x5'));var config=require(_0x2ee8('0x6'));var attributes=require('./integration.attributes');module['exports']=function(_0x3d5951,_0x359a96){return _0x3d5951['define'](_0x2ee8('0x7'),attributes,{'tableName':_0x2ee8('0x8'),'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 d097a40..1ce690f 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1bc694,_0x990b86){var _0x4942ee=function(_0x28cfd8){while(--_0x28cfd8){_0x1bc694['push'](_0x1bc694['shift']());}};_0x4942ee(++_0x990b86);}(_0x7880,0x1f4));var _0x0788=function(_0x217542,_0x15cc22){_0x217542=_0x217542-0x0;var _0x4bb071=_0x7880[_0x217542];return _0x4bb071;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf9ee79,_0x1f682b){var _0x58bdac=function(_0x2d87ae){while(--_0x2d87ae){_0xf9ee79['push'](_0xf9ee79['shift']());}};_0x58bdac(++_0x1f682b);}(_0x7880,0x1f4));var _0x0788=function(_0x5c33d4,_0x3621db){_0x5c33d4=_0x5c33d4-0x0;var _0x76150=_0x7880[_0x5c33d4];return _0x76150;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1d11513..8068b2e 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 _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x5c6c64,_0x12d4cb){var _0x172174=function(_0x3f49c3){while(--_0x3f49c3){_0x5c6c64['push'](_0x5c6c64['shift']());}};_0x172174(++_0x12d4cb);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'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('./integrationReport.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('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x35305d,_0x36568e){var _0x1aeb51=function(_0x26d055){while(--_0x26d055){_0x35305d['push'](_0x35305d['shift']());}};_0x1aeb51(++_0x36568e);}(_0x4975,0x86));var _0x5497=function(_0x17f39c,_0x5b03d6){_0x17f39c=_0x17f39c-0x0;var _0x1be2e2=_0x4975[_0x17f39c];return _0x1be2e2;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6711326..0543af0 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 _0x606f=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','RECEIVED','FAILED','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x606f,0x149));var _0xf606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x606f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf606('0x0'));module[_0xf606('0x1')]={'integration':{'type':Sequelize[_0xf606('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xf606('0x2')]},'integrationId':{'type':Sequelize[_0xf606('0x3')]},'contacts':{'type':Sequelize[_0xf606('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf606('0x2')]},'calleridname':{'type':Sequelize[_0xf606('0x2')]},'queue':{'type':Sequelize[_0xf606('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf606('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf606('0x4')]},'agentconnectAt':{'type':Sequelize[_0xf606('0x4')]},'holdtime':{'type':Sequelize[_0xf606('0x3')]},'agentcomplete':{'type':Sequelize[_0xf606('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf606('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf606('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf606('0x3')]},'reason':{'type':Sequelize[_0xf606('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf606('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf606('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf606('0x4')]},'lastevent':{'type':Sequelize[_0xf606('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf606('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf606('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf606('0x2')]},'priority':{'type':Sequelize[_0xf606('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf606('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf606('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xf606('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf606('0x2')]},'destaccountcode':{'type':Sequelize[_0xf606('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf606('0x2')]},'destpriority':{'type':Sequelize[_0xf606('0x2')]},'destuniqueid':{'type':Sequelize[_0xf606('0x2')]},'messageId':{'type':Sequelize[_0xf606('0x2')]},'inReplyTo':{'type':Sequelize[_0xf606('0x2')]},'subject':{'type':Sequelize[_0xf606('0x2')]},'from':{'type':Sequelize[_0xf606('0x2')]},'to':{'type':Sequelize[_0xf606('0x2')]},'cc':{'type':Sequelize[_0xf606('0x2')]},'attachment':{'type':Sequelize[_0xf606('0x6')]},'html':{'type':Sequelize[_0xf606('0x6')]},'text':{'type':Sequelize[_0xf606('0x6')]},'status':{'type':Sequelize[_0xf606('0x7')]('SENT','SENDING',_0xf606('0x8'),_0xf606('0x9'))},'url':{'type':Sequelize[_0xf606('0x2')]},'app':{'type':Sequelize[_0xf606('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xf606('0x3')]}}; \ No newline at end of file +var _0xe1ed=['SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM'];(function(_0x2ea304,_0x599889){var _0x35b712=function(_0x216f02){while(--_0x216f02){_0x2ea304['push'](_0x2ea304['shift']());}};_0x35b712(++_0x599889);}(_0xe1ed,0x19c));var _0xde1e=function(_0x269e6b,_0x5bf136){_0x269e6b=_0x269e6b-0x0;var _0x408b6d=_0xe1ed[_0x269e6b];return _0x408b6d;};'use strict';var Sequelize=require(_0xde1e('0x0'));module[_0xde1e('0x1')]={'integration':{'type':Sequelize[_0xde1e('0x2')]},'eventChannel':{'type':Sequelize[_0xde1e('0x2')]},'exitStatus':{'type':Sequelize[_0xde1e('0x2')]},'ticketId':{'type':Sequelize[_0xde1e('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xde1e('0x2')]},'uniqueid':{'type':Sequelize[_0xde1e('0x2')]},'calleridnum':{'type':Sequelize[_0xde1e('0x2')]},'calleridname':{'type':Sequelize[_0xde1e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xde1e('0x2')]},'agentcalledAt':{'type':Sequelize[_0xde1e('0x3')]},'agentconnectAt':{'type':Sequelize[_0xde1e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xde1e('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xde1e('0x3')]},'talktime':{'type':Sequelize[_0xde1e('0x5')]},'agentacw':{'type':Sequelize[_0xde1e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xde1e('0x5')]},'reason':{'type':Sequelize[_0xde1e('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xde1e('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xde1e('0x3')]},'lastevent':{'type':Sequelize[_0xde1e('0x2')]},'channel':{'type':Sequelize[_0xde1e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xde1e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xde1e('0x2')]},'language':{'type':Sequelize[_0xde1e('0x2')]},'accountcode':{'type':Sequelize[_0xde1e('0x2')]},'context':{'type':Sequelize[_0xde1e('0x2')]},'exten':{'type':Sequelize[_0xde1e('0x2')]},'priority':{'type':Sequelize[_0xde1e('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xde1e('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xde1e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xde1e('0x2')]},'destcalleridname':{'type':Sequelize[_0xde1e('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xde1e('0x2')]},'destlanguage':{'type':Sequelize[_0xde1e('0x2')]},'destaccountcode':{'type':Sequelize[_0xde1e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xde1e('0x2')]},'destuniqueid':{'type':Sequelize[_0xde1e('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xde1e('0x2')]},'subject':{'type':Sequelize[_0xde1e('0x2')]},'from':{'type':Sequelize[_0xde1e('0x2')]},'to':{'type':Sequelize[_0xde1e('0x2')]},'cc':{'type':Sequelize[_0xde1e('0x2')]},'attachment':{'type':Sequelize[_0xde1e('0x6')]},'html':{'type':Sequelize[_0xde1e('0x6')]},'text':{'type':Sequelize[_0xde1e('0x6')]},'status':{'type':Sequelize[_0xde1e('0x7')](_0xde1e('0x8'),_0xde1e('0x9'),_0xde1e('0xa'),_0xde1e('0xb'))},'url':{'type':Sequelize[_0xde1e('0x2')]},'app':{'type':Sequelize[_0xde1e('0x2')]},'appdata':{'type':Sequelize[_0xde1e('0x2')]},'projectId':{'type':Sequelize[_0xde1e('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 59ed453..acd766d 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 _0x23a5=['destroy','error','stack','name','index','map','IntegrationReport','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0x23a5,0x73));var _0x523a=function(_0x5d869e,_0x1731bd){_0x5d869e=_0x5d869e-0x0;var _0x13a90b=_0x23a5[_0x5d869e];return _0x13a90b;};'use strict';var emlformat=require(_0x523a('0x0'));var rimraf=require(_0x523a('0x1'));var zipdir=require(_0x523a('0x2'));var jsonpatch=require(_0x523a('0x3'));var rp=require('request-promise');var moment=require(_0x523a('0x4'));var BPromise=require(_0x523a('0x5'));var Mustache=require(_0x523a('0x6'));var util=require(_0x523a('0x7'));var path=require(_0x523a('0x8'));var sox=require(_0x523a('0x9'));var csv=require(_0x523a('0xa'));var ejs=require(_0x523a('0xb'));var fs=require('fs');var fs_extra=require(_0x523a('0xc'));var _=require(_0x523a('0xd'));var squel=require(_0x523a('0xe'));var crypto=require(_0x523a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x523a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x523a('0x11'));var Redis=require(_0x523a('0x12'));var authService=require(_0x523a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x523a('0x14'));var hardwareService=require(_0x523a('0x15'));var logger=require(_0x523a('0x16'))(_0x523a('0x17'));var utils=require('../../config/utils');var config=require(_0x523a('0x18'));var licenseUtil=require(_0x523a('0x19'));var db=require(_0x523a('0x1a'))['db'];function respondWithStatusCode(_0x4be432,_0x29accd){_0x29accd=_0x29accd||0xcc;return function(_0x30f8fb){if(_0x30f8fb){return _0x4be432[_0x523a('0x1b')](_0x29accd);}return _0x4be432['status'](_0x29accd)['end']();};}function respondWithResult(_0xf5002,_0x284da1){_0x284da1=_0x284da1||0xc8;return function(_0x85df4){if(_0x85df4){return _0xf5002[_0x523a('0x1c')](_0x284da1)[_0x523a('0x1d')](_0x85df4);}};}function respondWithFilteredResult(_0x1111f5,_0x18e315){return function(_0x173eb8){if(_0x173eb8){var _0x43fcf0=typeof _0x18e315[_0x523a('0x1e')]===_0x523a('0x1f')&&typeof _0x18e315['limit']===_0x523a('0x1f');var _0x1c64c6=_0x173eb8[_0x523a('0x20')];var _0x29fd8e=_0x43fcf0?0x0:_0x18e315['offset'];var _0x1e1d57=_0x43fcf0?_0x173eb8['count']:_0x18e315[_0x523a('0x1e')]+_0x18e315[_0x523a('0x21')];var _0x50e273;if(_0x1e1d57>=_0x1c64c6){_0x1e1d57=_0x1c64c6;_0x50e273=0xc8;}else{_0x50e273=0xce;}_0x1111f5['status'](_0x50e273);return _0x1111f5['set'](_0x523a('0x22'),_0x29fd8e+'-'+_0x1e1d57+'/'+_0x1c64c6)[_0x523a('0x1d')](_0x173eb8);}return null;};}function patchUpdates(_0x5f2902){return function(_0x1cb7a0){try{jsonpatch[_0x523a('0x23')](_0x1cb7a0,_0x5f2902,!![]);}catch(_0x3f79b1){return BPromise[_0x523a('0x24')](_0x3f79b1);}return _0x1cb7a0['save']();};}function saveUpdates(_0x4a9110,_0x73045e){return function(_0x50452a){if(_0x50452a){return _0x50452a[_0x523a('0x25')](_0x4a9110)[_0x523a('0x26')](function(_0x238d9d){return _0x238d9d;});}return null;};}function removeEntity(_0x54ed78,_0x135188){return function(_0xf77733){if(_0xf77733){return _0xf77733[_0x523a('0x27')]()[_0x523a('0x26')](function(){_0x54ed78[_0x523a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1363c9,_0x31e54d){return function(_0x45d901){if(!_0x45d901){_0x1363c9[_0x523a('0x1b')](0x194);}return _0x45d901;};}function handleError(_0x5011b2,_0x5db256){_0x5db256=_0x5db256||0x1f4;return function(_0x4ebb9a){logger[_0x523a('0x28')](_0x4ebb9a[_0x523a('0x29')]);if(_0x4ebb9a[_0x523a('0x2a')]){delete _0x4ebb9a[_0x523a('0x2a')];}_0x5011b2[_0x523a('0x1c')](_0x5db256)['send'](_0x4ebb9a);};}exports[_0x523a('0x2b')]=function(_0x421af4,_0x2b2818){var _0x11d19e={},_0x406263={},_0x1c39d3={'count':0x0,'rows':[]};var _0x2cca8b=_[_0x523a('0x2c')](db[_0x523a('0x2d')]['rawAttributes'],function(_0x3c0204){return{'name':_0x3c0204[_0x523a('0x2e')],'type':_0x3c0204['type'][_0x523a('0x2f')]};});_0x406263['model']=_[_0x523a('0x2c')](_0x2cca8b,_0x523a('0x2a'));_0x406263['query']=_[_0x523a('0x30')](_0x421af4[_0x523a('0x31')]);_0x406263[_0x523a('0x32')]=_[_0x523a('0x33')](_0x406263[_0x523a('0x34')],_0x406263['query']);_0x11d19e[_0x523a('0x35')]=_[_0x523a('0x33')](_0x406263[_0x523a('0x34')],qs[_0x523a('0x36')](_0x421af4['query'][_0x523a('0x36')]));_0x11d19e['attributes']=_0x11d19e['attributes']['length']?_0x11d19e[_0x523a('0x35')]:_0x406263['model'];if(!_0x421af4['query'][_0x523a('0x37')](_0x523a('0x38'))){_0x11d19e[_0x523a('0x21')]=qs[_0x523a('0x21')](_0x421af4['query'][_0x523a('0x21')]);_0x11d19e[_0x523a('0x1e')]=qs[_0x523a('0x1e')](_0x421af4[_0x523a('0x31')]['offset']);}_0x11d19e[_0x523a('0x39')]=qs['sort'](_0x421af4[_0x523a('0x31')]['sort']);_0x11d19e[_0x523a('0x3a')]=qs[_0x523a('0x32')](_[_0x523a('0x3b')](_0x421af4[_0x523a('0x31')],_0x406263[_0x523a('0x32')]),_0x2cca8b);if(_0x421af4[_0x523a('0x31')][_0x523a('0x3c')]){_0x11d19e[_0x523a('0x3a')]=_[_0x523a('0x3d')](_0x11d19e['where'],{'$or':_[_0x523a('0x2c')](_0x2cca8b,function(_0x475982){if(_0x475982[_0x523a('0x3e')]!==_0x523a('0x3f')){var _0x209bca={};_0x209bca[_0x475982[_0x523a('0x2a')]]={'$like':'%'+_0x421af4[_0x523a('0x31')][_0x523a('0x3c')]+'%'};return _0x209bca;}})});}_0x11d19e=_[_0x523a('0x3d')]({},_0x11d19e,_0x421af4['options']);var _0x109752={'where':_0x11d19e[_0x523a('0x3a')]};return db[_0x523a('0x2d')][_0x523a('0x20')](_0x109752)['then'](function(_0x1abb6c){_0x1c39d3[_0x523a('0x20')]=_0x1abb6c;if(_0x421af4[_0x523a('0x31')][_0x523a('0x40')]){_0x11d19e[_0x523a('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0x523a('0x42')](_0x11d19e);})[_0x523a('0x26')](function(_0x5b4f18){_0x1c39d3['rows']=_0x5b4f18;return _0x1c39d3;})[_0x523a('0x26')](respondWithFilteredResult(_0x2b2818,_0x11d19e))[_0x523a('0x43')](handleError(_0x2b2818,null));};exports[_0x523a('0x44')]=function(_0x2e9cfe,_0x25dd7a){var _0x3c9644={'raw':![],'where':{'id':_0x2e9cfe[_0x523a('0x45')]['id']}},_0x4d7d86={};_0x4d7d86[_0x523a('0x34')]=_['keys'](db['IntegrationReport'][_0x523a('0x46')]);_0x4d7d86[_0x523a('0x31')]=_[_0x523a('0x30')](_0x2e9cfe[_0x523a('0x31')]);_0x4d7d86['filters']=_[_0x523a('0x33')](_0x4d7d86[_0x523a('0x34')],_0x4d7d86['query']);_0x3c9644[_0x523a('0x35')]=_[_0x523a('0x33')](_0x4d7d86[_0x523a('0x34')],qs[_0x523a('0x36')](_0x2e9cfe[_0x523a('0x31')][_0x523a('0x36')]));_0x3c9644['attributes']=_0x3c9644[_0x523a('0x35')][_0x523a('0x47')]?_0x3c9644[_0x523a('0x35')]:_0x4d7d86[_0x523a('0x34')];if(_0x2e9cfe[_0x523a('0x31')]['includeAll']){_0x3c9644['include']=[{'all':!![]}];}_0x3c9644=_[_0x523a('0x3d')]({},_0x3c9644,_0x2e9cfe[_0x523a('0x48')]);return db[_0x523a('0x2d')][_0x523a('0x49')](_0x3c9644)['then'](handleEntityNotFound(_0x25dd7a,null))[_0x523a('0x26')](respondWithResult(_0x25dd7a,null))[_0x523a('0x43')](handleError(_0x25dd7a,null));};exports['create']=function(_0xad089e,_0x301058){return db[_0x523a('0x2d')][_0x523a('0x4a')](_0xad089e[_0x523a('0x4b')],{})[_0x523a('0x26')](respondWithResult(_0x301058,0xc9))[_0x523a('0x43')](handleError(_0x301058,null));};exports[_0x523a('0x25')]=function(_0x2815b7,_0x15a2cf){if(_0x2815b7[_0x523a('0x4b')]['id']){delete _0x2815b7[_0x523a('0x4b')]['id'];}return db[_0x523a('0x2d')][_0x523a('0x49')]({'where':{'id':_0x2815b7[_0x523a('0x45')]['id']}})['then'](handleEntityNotFound(_0x15a2cf,null))['then'](saveUpdates(_0x2815b7[_0x523a('0x4b')],null))['then'](respondWithResult(_0x15a2cf,null))['catch'](handleError(_0x15a2cf,null));};exports[_0x523a('0x27')]=function(_0x18ab37,_0xeff477){return db[_0x523a('0x2d')]['find']({'where':{'id':_0x18ab37[_0x523a('0x45')]['id']}})[_0x523a('0x26')](handleEntityNotFound(_0xeff477,null))[_0x523a('0x26')](removeEntity(_0xeff477,null))[_0x523a('0x43')](handleError(_0xeff477,null));};exports[_0x523a('0x4c')]=function(_0x1823a1,_0x1440d1){return db['IntegrationReport']['describe']()[_0x523a('0x26')](respondWithResult(_0x1440d1,null))['catch'](handleError(_0x1440d1,null));}; \ No newline at end of file +var _0x368f=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/utils'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x368f,0x1bd));var _0xf368=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x368f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xf368('0x0'));var rimraf=require(_0xf368('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf368('0x2'));var rp=require(_0xf368('0x3'));var moment=require(_0xf368('0x4'));var BPromise=require(_0xf368('0x5'));var Mustache=require('mustache');var util=require(_0xf368('0x6'));var path=require('path');var sox=require(_0xf368('0x7'));var csv=require(_0xf368('0x8'));var ejs=require(_0xf368('0x9'));var fs=require('fs');var fs_extra=require(_0xf368('0xa'));var _=require(_0xf368('0xb'));var squel=require(_0xf368('0xc'));var crypto=require(_0xf368('0xd'));var jsforce=require(_0xf368('0xe'));var deskjs=require(_0xf368('0xf'));var toCsv=require(_0xf368('0x8'));var querystring=require(_0xf368('0x10'));var Papa=require(_0xf368('0x11'));var Redis=require(_0xf368('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf368('0x13'));var as=require(_0xf368('0x14'));var hardwareService=require(_0xf368('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf368('0x16'));var config=require(_0xf368('0x17'));var licenseUtil=require(_0xf368('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298015,_0x1c0e4e){_0x1c0e4e=_0x1c0e4e||0xcc;return function(_0x45ffeb){if(_0x45ffeb){return _0x298015['sendStatus'](_0x1c0e4e);}return _0x298015[_0xf368('0x19')](_0x1c0e4e)[_0xf368('0x1a')]();};}function respondWithResult(_0xc2410e,_0x337153){_0x337153=_0x337153||0xc8;return function(_0x3f04f9){if(_0x3f04f9){return _0xc2410e['status'](_0x337153)[_0xf368('0x1b')](_0x3f04f9);}};}function respondWithFilteredResult(_0xa34d7b,_0x4d17e0){return function(_0x2ea411){if(_0x2ea411){var _0x310f23=typeof _0x4d17e0[_0xf368('0x1c')]===_0xf368('0x1d')&&typeof _0x4d17e0[_0xf368('0x1e')]==='undefined';var _0x525ce5=_0x2ea411[_0xf368('0x1f')];var _0x256809=_0x310f23?0x0:_0x4d17e0['offset'];var _0x4df4e6=_0x310f23?_0x2ea411[_0xf368('0x1f')]:_0x4d17e0[_0xf368('0x1c')]+_0x4d17e0[_0xf368('0x1e')];var _0x4cc9d8;if(_0x4df4e6>=_0x525ce5){_0x4df4e6=_0x525ce5;_0x4cc9d8=0xc8;}else{_0x4cc9d8=0xce;}_0xa34d7b['status'](_0x4cc9d8);return _0xa34d7b[_0xf368('0x20')](_0xf368('0x21'),_0x256809+'-'+_0x4df4e6+'/'+_0x525ce5)[_0xf368('0x1b')](_0x2ea411);}return null;};}function patchUpdates(_0x138508){return function(_0x2fc3cf){try{jsonpatch['apply'](_0x2fc3cf,_0x138508,!![]);}catch(_0x20460e){return BPromise[_0xf368('0x22')](_0x20460e);}return _0x2fc3cf[_0xf368('0x23')]();};}function saveUpdates(_0x1ef342,_0x45c0a9){return function(_0x2cbf2d){if(_0x2cbf2d){return _0x2cbf2d[_0xf368('0x24')](_0x1ef342)[_0xf368('0x25')](function(_0x1ffcbf){return _0x1ffcbf;});}return null;};}function removeEntity(_0x4714e9,_0x56a7f1){return function(_0x252b08){if(_0x252b08){return _0x252b08[_0xf368('0x26')]()[_0xf368('0x25')](function(){_0x4714e9['status'](0xcc)[_0xf368('0x1a')]();});}};}function handleEntityNotFound(_0x9f314a,_0x2b7c61){return function(_0x36a72e){if(!_0x36a72e){_0x9f314a[_0xf368('0x27')](0x194);}return _0x36a72e;};}function handleError(_0x42d821,_0x255c0b){_0x255c0b=_0x255c0b||0x1f4;return function(_0x4e4786){logger[_0xf368('0x28')](_0x4e4786[_0xf368('0x29')]);if(_0x4e4786[_0xf368('0x2a')]){delete _0x4e4786[_0xf368('0x2a')];}_0x42d821['status'](_0x255c0b)[_0xf368('0x2b')](_0x4e4786);};}exports[_0xf368('0x2c')]=function(_0x30d4b1,_0x10de13){var _0x3c7a59={},_0x1d6f9a={},_0x368b67={'count':0x0,'rows':[]};var _0x183e54=_[_0xf368('0x2d')](db[_0xf368('0x2e')][_0xf368('0x2f')],function(_0x501abc){return{'name':_0x501abc['fieldName'],'type':_0x501abc[_0xf368('0x30')][_0xf368('0x31')]};});_0x1d6f9a[_0xf368('0x32')]=_[_0xf368('0x2d')](_0x183e54,'name');_0x1d6f9a['query']=_[_0xf368('0x33')](_0x30d4b1[_0xf368('0x34')]);_0x1d6f9a[_0xf368('0x35')]=_['intersection'](_0x1d6f9a[_0xf368('0x32')],_0x1d6f9a[_0xf368('0x34')]);_0x3c7a59[_0xf368('0x36')]=_[_0xf368('0x37')](_0x1d6f9a[_0xf368('0x32')],qs[_0xf368('0x38')](_0x30d4b1[_0xf368('0x34')][_0xf368('0x38')]));_0x3c7a59[_0xf368('0x36')]=_0x3c7a59['attributes'][_0xf368('0x39')]?_0x3c7a59[_0xf368('0x36')]:_0x1d6f9a['model'];if(!_0x30d4b1['query'][_0xf368('0x3a')](_0xf368('0x3b'))){_0x3c7a59[_0xf368('0x1e')]=qs[_0xf368('0x1e')](_0x30d4b1[_0xf368('0x34')]['limit']);_0x3c7a59[_0xf368('0x1c')]=qs['offset'](_0x30d4b1['query'][_0xf368('0x1c')]);}_0x3c7a59[_0xf368('0x3c')]=qs[_0xf368('0x3d')](_0x30d4b1[_0xf368('0x34')][_0xf368('0x3d')]);_0x3c7a59['where']=qs[_0xf368('0x35')](_[_0xf368('0x3e')](_0x30d4b1[_0xf368('0x34')],_0x1d6f9a['filters']),_0x183e54);if(_0x30d4b1[_0xf368('0x34')][_0xf368('0x3f')]){_0x3c7a59[_0xf368('0x40')]=_[_0xf368('0x41')](_0x3c7a59[_0xf368('0x40')],{'$or':_[_0xf368('0x2d')](_0x183e54,function(_0x27638d){if(_0x27638d[_0xf368('0x30')]!==_0xf368('0x42')){var _0xce5e5f={};_0xce5e5f[_0x27638d[_0xf368('0x2a')]]={'$like':'%'+_0x30d4b1[_0xf368('0x34')][_0xf368('0x3f')]+'%'};return _0xce5e5f;}})});}_0x3c7a59=_[_0xf368('0x41')]({},_0x3c7a59,_0x30d4b1[_0xf368('0x43')]);var _0x16df1d={'where':_0x3c7a59[_0xf368('0x40')]};return db['IntegrationReport'][_0xf368('0x1f')](_0x16df1d)[_0xf368('0x25')](function(_0x4b5c29){_0x368b67['count']=_0x4b5c29;if(_0x30d4b1[_0xf368('0x34')][_0xf368('0x44')]){_0x3c7a59[_0xf368('0x45')]=[{'all':!![]}];}return db['IntegrationReport'][_0xf368('0x46')](_0x3c7a59);})[_0xf368('0x25')](function(_0x3c92af){_0x368b67['rows']=_0x3c92af;return _0x368b67;})[_0xf368('0x25')](respondWithFilteredResult(_0x10de13,_0x3c7a59))[_0xf368('0x47')](handleError(_0x10de13,null));};exports[_0xf368('0x48')]=function(_0x29d0b1,_0x5edc87){var _0x4ecfb6={'raw':![],'where':{'id':_0x29d0b1[_0xf368('0x49')]['id']}},_0x3e7f20={};_0x3e7f20[_0xf368('0x32')]=_['keys'](db['IntegrationReport'][_0xf368('0x2f')]);_0x3e7f20[_0xf368('0x34')]=_[_0xf368('0x33')](_0x29d0b1['query']);_0x3e7f20['filters']=_['intersection'](_0x3e7f20[_0xf368('0x32')],_0x3e7f20[_0xf368('0x34')]);_0x4ecfb6[_0xf368('0x36')]=_[_0xf368('0x37')](_0x3e7f20[_0xf368('0x32')],qs[_0xf368('0x38')](_0x29d0b1['query'][_0xf368('0x38')]));_0x4ecfb6[_0xf368('0x36')]=_0x4ecfb6['attributes'][_0xf368('0x39')]?_0x4ecfb6['attributes']:_0x3e7f20['model'];if(_0x29d0b1[_0xf368('0x34')]['includeAll']){_0x4ecfb6[_0xf368('0x45')]=[{'all':!![]}];}_0x4ecfb6=_['merge']({},_0x4ecfb6,_0x29d0b1[_0xf368('0x43')]);return db['IntegrationReport']['find'](_0x4ecfb6)[_0xf368('0x25')](handleEntityNotFound(_0x5edc87,null))[_0xf368('0x25')](respondWithResult(_0x5edc87,null))[_0xf368('0x47')](handleError(_0x5edc87,null));};exports[_0xf368('0x4a')]=function(_0x4b1526,_0x56d70b){return db[_0xf368('0x2e')][_0xf368('0x4a')](_0x4b1526[_0xf368('0x4b')],{})[_0xf368('0x25')](respondWithResult(_0x56d70b,0xc9))[_0xf368('0x47')](handleError(_0x56d70b,null));};exports[_0xf368('0x24')]=function(_0x4eb41f,_0x714df1){if(_0x4eb41f[_0xf368('0x4b')]['id']){delete _0x4eb41f[_0xf368('0x4b')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x4eb41f[_0xf368('0x49')]['id']}})[_0xf368('0x25')](handleEntityNotFound(_0x714df1,null))['then'](saveUpdates(_0x4eb41f['body'],null))[_0xf368('0x25')](respondWithResult(_0x714df1,null))['catch'](handleError(_0x714df1,null));};exports['destroy']=function(_0x406e84,_0x3c9765){return db[_0xf368('0x2e')][_0xf368('0x4c')]({'where':{'id':_0x406e84['params']['id']}})['then'](handleEntityNotFound(_0x3c9765,null))[_0xf368('0x25')](removeEntity(_0x3c9765,null))['catch'](handleError(_0x3c9765,null));};exports[_0xf368('0x4d')]=function(_0x18fed4,_0xfb1b89){return db['IntegrationReport']['describe']()[_0xf368('0x25')](respondWithResult(_0xfb1b89,null))['catch'](handleError(_0xfb1b89,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 55b7954..501ee9b 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 _0x999f=['../../config/logger','api','moment','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport'];(function(_0xaff82d,_0x5c874c){var _0xa20247=function(_0x3f59ca){while(--_0x3f59ca){_0xaff82d['push'](_0xaff82d['shift']());}};_0xa20247(++_0x5c874c);}(_0x999f,0x168));var _0xf999=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x999f[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf999('0x0'))(_0xf999('0x1'));var moment=require(_0xf999('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf999('0x3'));var rimraf=require(_0xf999('0x4'));var config=require(_0xf999('0x5'));var attributes=require(_0xf999('0x6'));module[_0xf999('0x7')]=function(_0x45b6fd,_0x3f8461){return _0x45b6fd['define'](_0xf999('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25ea=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x7050c8,_0x5d3bec){var _0x7aa70d=function(_0x52aaec){while(--_0x52aaec){_0x7050c8['push'](_0x7050c8['shift']());}};_0x7aa70d(++_0x5d3bec);}(_0x25ea,0x90));var _0xa25e=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0x25ea[_0x5976f8];return _0x179715;};'use strict';var _=require(_0xa25e('0x0'));var util=require('util');var logger=require(_0xa25e('0x1'))(_0xa25e('0x2'));var moment=require(_0xa25e('0x3'));var BPromise=require(_0xa25e('0x4'));var rp=require(_0xa25e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa25e('0x6'));var config=require(_0xa25e('0x7'));var attributes=require(_0xa25e('0x8'));module[_0xa25e('0x9')]=function(_0x48f409,_0x583570){return _0x48f409[_0xa25e('0xa')](_0xa25e('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 2b72c76..3871574 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x1967,0x173));var _0x7196=function(_0x2e7c98,_0x93775d){_0x2e7c98=_0x2e7c98-0x0;var _0xdf4240=_0x1967[_0x2e7c98];return _0xdf4240;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\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(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x814b,0x1a2));var _0xb814=function(_0x1c1509,_0x2dfa81){_0x1c1509=_0x1c1509-0x0;var _0xf11b7=_0x814b[_0x1c1509];return _0xf11b7;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 6a91efc..3ccf7be 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 _0x010a=['../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','/:id','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x248dc8,_0x10c027){var _0x15aaee=function(_0xa53979){while(--_0xa53979){_0x248dc8['push'](_0x248dc8['shift']());}};_0x15aaee(++_0x10c027);}(_0x010a,0x1f4));var _0xa010=function(_0x2a3836,_0x3d7999){_0x2a3836=_0x2a3836-0x0;var _0x136050=_0x010a[_0x2a3836];return _0x136050;};'use strict';var multer=require('multer');var util=require(_0xa010('0x0'));var path=require('path');var timeout=require(_0xa010('0x1'));var express=require(_0xa010('0x2'));var router=express['Router']();var fs_extra=require(_0xa010('0x3'));var auth=require(_0xa010('0x4'));var interaction=require(_0xa010('0x5'));var config=require(_0xa010('0x6'));var controller=require(_0xa010('0x7'));router[_0xa010('0x8')]('/',auth[_0xa010('0x9')](),controller[_0xa010('0xa')]);router[_0xa010('0x8')]('/:id',auth[_0xa010('0x9')](),controller[_0xa010('0xb')]);router[_0xa010('0x8')](_0xa010('0xc'),auth['isAuthenticated'](),controller[_0xa010('0xd')]);router[_0xa010('0xe')]('/',auth[_0xa010('0x9')](),controller['create']);router[_0xa010('0xe')](_0xa010('0xc'),auth[_0xa010('0x9')](),controller[_0xa010('0xf')]);router['post']('/:id/sub_intervals/create_many',auth[_0xa010('0x9')](),controller[_0xa010('0x10')]);router['put'](_0xa010('0x11'),auth['isAuthenticated'](),controller[_0xa010('0x12')]);router[_0xa010('0x13')]('/:id',auth[_0xa010('0x9')](),controller[_0xa010('0x14')]);module[_0xa010('0x15')]=router; \ No newline at end of file +var _0x1696=['index','get','/:id','show','post','/:id/sub_intervals','addInterval','addIntervals','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated'];(function(_0x93d86c,_0x54e7ee){var _0x58e497=function(_0x31ad13){while(--_0x31ad13){_0x93d86c['push'](_0x93d86c['shift']());}};_0x58e497(++_0x54e7ee);}(_0x1696,0x79));var _0x6169=function(_0x508ff2,_0x2e9db7){_0x508ff2=_0x508ff2-0x0;var _0x48d6bc=_0x1696[_0x508ff2];return _0x48d6bc;};'use strict';var multer=require(_0x6169('0x0'));var util=require('util');var path=require(_0x6169('0x1'));var timeout=require(_0x6169('0x2'));var express=require(_0x6169('0x3'));var router=express[_0x6169('0x4')]();var fs_extra=require(_0x6169('0x5'));var auth=require(_0x6169('0x6'));var interaction=require(_0x6169('0x7'));var config=require(_0x6169('0x8'));var controller=require(_0x6169('0x9'));router['get']('/',auth[_0x6169('0xa')](),controller[_0x6169('0xb')]);router[_0x6169('0xc')](_0x6169('0xd'),auth[_0x6169('0xa')](),controller[_0x6169('0xe')]);router[_0x6169('0xc')]('/:id/sub_intervals',auth[_0x6169('0xa')](),controller['getIntervals']);router[_0x6169('0xf')]('/',auth[_0x6169('0xa')](),controller['create']);router[_0x6169('0xf')](_0x6169('0x10'),auth[_0x6169('0xa')](),controller[_0x6169('0x11')]);router['post']('/:id/sub_intervals/create_many',auth[_0x6169('0xa')](),controller[_0x6169('0x12')]);router['put'](_0x6169('0xd'),auth[_0x6169('0xa')](),controller[_0x6169('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6169('0x14')]);module[_0x6169('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index fc8a6bf..b81e0fb 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 _0x957a=['sequelize','exports','STRING'];(function(_0x5746f3,_0x1ac88a){var _0x5ba354=function(_0x2c7eec){while(--_0x2c7eec){_0x5746f3['push'](_0x5746f3['shift']());}};_0x5ba354(++_0x1ac88a);}(_0x957a,0xab));var _0xa957=function(_0x150620,_0x587ec1){_0x150620=_0x150620-0x0;var _0x817e54=_0x957a[_0x150620];return _0x817e54;};'use strict';var Sequelize=require(_0xa957('0x0'));module[_0xa957('0x1')]={'name':{'type':Sequelize[_0xa957('0x2')]},'description':{'type':Sequelize[_0xa957('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x9cac=['exports','STRING','sequelize'];(function(_0xe26664,_0x554e25){var _0x1f7af1=function(_0x351b92){while(--_0x351b92){_0xe26664['push'](_0xe26664['shift']());}};_0x1f7af1(++_0x554e25);}(_0x9cac,0x12e));var _0xc9ca=function(_0x1a6c94,_0x5a8709){_0x1a6c94=_0x1a6c94-0x0;var _0x4ebf7d=_0x9cac[_0x1a6c94];return _0x4ebf7d;};'use strict';var Sequelize=require(_0xc9ca('0x0'));module[_0xc9ca('0x1')]={'name':{'type':Sequelize[_0xc9ca('0x2')]},'description':{'type':Sequelize[_0xc9ca('0x2')]},'interval':{'type':Sequelize[_0xc9ca('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 288b932..86b575a 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 _0x499c=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1c9e13,_0x2d667a){var _0xe0bdb1=function(_0xc38110){while(--_0xc38110){_0x1c9e13['push'](_0x1c9e13['shift']());}};_0xe0bdb1(++_0x2d667a);}(_0x499c,0x168));var _0xc499=function(_0x54cabc,_0x4977cd){_0x54cabc=_0x54cabc-0x0;var _0x4ac4ac=_0x499c[_0x54cabc];return _0x4ac4ac;};'use strict';var emlformat=require(_0xc499('0x0'));var rimraf=require(_0xc499('0x1'));var zipdir=require(_0xc499('0x2'));var jsonpatch=require(_0xc499('0x3'));var rp=require(_0xc499('0x4'));var moment=require(_0xc499('0x5'));var BPromise=require(_0xc499('0x6'));var Mustache=require('mustache');var util=require(_0xc499('0x7'));var path=require(_0xc499('0x8'));var sox=require(_0xc499('0x9'));var csv=require(_0xc499('0xa'));var ejs=require(_0xc499('0xb'));var fs=require('fs');var fs_extra=require(_0xc499('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc499('0xd'));var jsforce=require(_0xc499('0xe'));var deskjs=require(_0xc499('0xf'));var toCsv=require(_0xc499('0xa'));var querystring=require(_0xc499('0x10'));var Papa=require(_0xc499('0x11'));var Redis=require(_0xc499('0x12'));var authService=require(_0xc499('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc499('0x14'));var hardwareService=require(_0xc499('0x15'));var logger=require(_0xc499('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc499('0x17'));var licenseUtil=require(_0xc499('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0xc499('0x19'));function respondWithStatusCode(_0x1d62d5,_0x52aea5){_0x52aea5=_0x52aea5||0xcc;return function(_0x3eb90a){if(_0x3eb90a){return _0x1d62d5[_0xc499('0x1a')](_0x52aea5);}return _0x1d62d5[_0xc499('0x1b')](_0x52aea5)['end']();};}function respondWithResult(_0x5a7f21,_0x35dc66){_0x35dc66=_0x35dc66||0xc8;return function(_0x27d451){if(_0x27d451){return _0x5a7f21[_0xc499('0x1b')](_0x35dc66)[_0xc499('0x1c')](_0x27d451);}};}function respondWithFilteredResult(_0x3f7027,_0x2fa053){return function(_0x27c5f6){if(_0x27c5f6){var _0x194c55=typeof _0x2fa053['offset']===_0xc499('0x1d')&&typeof _0x2fa053['limit']===_0xc499('0x1d');var _0x13d4c4=_0x27c5f6['count'];var _0x2d1f3e=_0x194c55?0x0:_0x2fa053['offset'];var _0x3c4a69=_0x194c55?_0x27c5f6[_0xc499('0x1e')]:_0x2fa053[_0xc499('0x1f')]+_0x2fa053[_0xc499('0x20')];var _0x161bcd;if(_0x3c4a69>=_0x13d4c4){_0x3c4a69=_0x13d4c4;_0x161bcd=0xc8;}else{_0x161bcd=0xce;}_0x3f7027[_0xc499('0x1b')](_0x161bcd);return _0x3f7027[_0xc499('0x21')](_0xc499('0x22'),_0x2d1f3e+'-'+_0x3c4a69+'/'+_0x13d4c4)[_0xc499('0x1c')](_0x27c5f6);}return null;};}function patchUpdates(_0x981f4a){return function(_0x2b645b){try{jsonpatch[_0xc499('0x23')](_0x2b645b,_0x981f4a,!![]);}catch(_0x14fb62){return BPromise[_0xc499('0x24')](_0x14fb62);}return _0x2b645b['save']();};}function saveUpdates(_0x9e5643,_0x5d0374){return function(_0x3a8078){if(_0x3a8078){return _0x3a8078[_0xc499('0x25')](_0x9e5643)[_0xc499('0x26')](function(_0x5ab65c){return _0x5ab65c;});}return null;};}function removeEntity(_0x2ed273,_0x295fb9){return function(_0x3f21af){if(_0x3f21af){return _0x3f21af['destroy']()[_0xc499('0x26')](function(){var _0x1b6d39=_0x3f21af[_0xc499('0x27')]({'plain':!![]});var _0x50cafd=_0xc499('0x28');return db[_0xc499('0x29')][_0xc499('0x2a')]({'where':{'type':_0x50cafd,'resourceId':_0x1b6d39['id']}})[_0xc499('0x26')](function(){return _0x3f21af;});})['then'](function(){_0x2ed273[_0xc499('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8a6b,_0x5d2f80){return function(_0xf5a468){if(!_0xf5a468){_0x1d8a6b[_0xc499('0x1a')](0x194);}return _0xf5a468;};}function handleError(_0xe4b73,_0x1bd47a){_0x1bd47a=_0x1bd47a||0x1f4;return function(_0x463c96){logger[_0xc499('0x2b')](_0x463c96[_0xc499('0x2c')]);if(_0x463c96['name']){delete _0x463c96[_0xc499('0x2d')];}_0xe4b73[_0xc499('0x1b')](_0x1bd47a)['send'](_0x463c96);};}exports['index']=function(_0x23b32e,_0x107bab){var _0x48b440={},_0x5d3e9a={},_0x5296a2={'count':0x0,'rows':[]};var _0x4c5030=_[_0xc499('0x2e')](db[_0xc499('0x2f')][_0xc499('0x30')],function(_0x4d4bce){return{'name':_0x4d4bce[_0xc499('0x31')],'type':_0x4d4bce['type'][_0xc499('0x32')]};});_0x5d3e9a[_0xc499('0x33')]=_[_0xc499('0x2e')](_0x4c5030,_0xc499('0x2d'));_0x5d3e9a[_0xc499('0x34')]=_[_0xc499('0x35')](_0x23b32e['query']);_0x5d3e9a[_0xc499('0x36')]=_[_0xc499('0x37')](_0x5d3e9a[_0xc499('0x33')],_0x5d3e9a['query']);_0x48b440[_0xc499('0x38')]=_['intersection'](_0x5d3e9a[_0xc499('0x33')],qs[_0xc499('0x39')](_0x23b32e['query']['fields']));_0x48b440[_0xc499('0x38')]=_0x48b440[_0xc499('0x38')][_0xc499('0x3a')]?_0x48b440[_0xc499('0x38')]:_0x5d3e9a['model'];if(!_0x23b32e[_0xc499('0x34')][_0xc499('0x3b')]('nolimit')){_0x48b440[_0xc499('0x20')]=qs[_0xc499('0x20')](_0x23b32e['query']['limit']);_0x48b440[_0xc499('0x1f')]=qs[_0xc499('0x1f')](_0x23b32e[_0xc499('0x34')][_0xc499('0x1f')]);}_0x48b440[_0xc499('0x3c')]=qs[_0xc499('0x3d')](_0x23b32e[_0xc499('0x34')][_0xc499('0x3d')]);_0x48b440[_0xc499('0x3e')]=qs[_0xc499('0x36')](_['pick'](_0x23b32e['query'],_0x5d3e9a[_0xc499('0x36')]),_0x4c5030);if(_0x23b32e[_0xc499('0x34')][_0xc499('0x3f')]){_0x48b440[_0xc499('0x3e')]=_[_0xc499('0x40')](_0x48b440['where'],{'$or':_['map'](_0x4c5030,function(_0x3896f0){if(_0x3896f0[_0xc499('0x41')]!==_0xc499('0x42')){var _0x3dc05b={};_0x3dc05b[_0x3896f0[_0xc499('0x2d')]]={'$like':'%'+_0x23b32e[_0xc499('0x34')][_0xc499('0x3f')]+'%'};return _0x3dc05b;}})});}_0x48b440=_[_0xc499('0x40')]({},_0x48b440,_0x23b32e[_0xc499('0x43')]);var _0x352381={'where':_0x48b440[_0xc499('0x3e')]};return db[_0xc499('0x2f')][_0xc499('0x1e')](_0x352381)[_0xc499('0x26')](function(_0x42c70f){_0x5296a2[_0xc499('0x1e')]=_0x42c70f;if(_0x23b32e[_0xc499('0x34')][_0xc499('0x44')]){_0x48b440[_0xc499('0x45')]=[{'all':!![]}];}return db[_0xc499('0x2f')][_0xc499('0x46')](_0x48b440);})[_0xc499('0x26')](function(_0x1fe77a){_0x5296a2['rows']=_0x1fe77a;return _0x5296a2;})['then'](respondWithFilteredResult(_0x107bab,_0x48b440))[_0xc499('0x47')](handleError(_0x107bab,null));};exports[_0xc499('0x48')]=function(_0x3f507d,_0x11ce36){var _0x294791={'raw':!![],'where':{'id':_0x3f507d[_0xc499('0x49')]['id']}},_0x107476={};_0x107476[_0xc499('0x33')]=_[_0xc499('0x35')](db[_0xc499('0x2f')]['rawAttributes']);_0x107476[_0xc499('0x34')]=_[_0xc499('0x35')](_0x3f507d[_0xc499('0x34')]);_0x107476[_0xc499('0x36')]=_[_0xc499('0x37')](_0x107476[_0xc499('0x33')],_0x107476['query']);_0x294791[_0xc499('0x38')]=_[_0xc499('0x37')](_0x107476[_0xc499('0x33')],qs['fields'](_0x3f507d[_0xc499('0x34')][_0xc499('0x39')]));_0x294791[_0xc499('0x38')]=_0x294791[_0xc499('0x38')][_0xc499('0x3a')]?_0x294791['attributes']:_0x107476['model'];if(_0x3f507d['query'][_0xc499('0x44')]){_0x294791[_0xc499('0x45')]=[{'all':!![]}];}_0x294791=_[_0xc499('0x40')]({},_0x294791,_0x3f507d[_0xc499('0x43')]);return db[_0xc499('0x2f')][_0xc499('0x4a')](_0x294791)['then'](handleEntityNotFound(_0x11ce36,null))[_0xc499('0x26')](respondWithResult(_0x11ce36,null))[_0xc499('0x47')](handleError(_0x11ce36,null));};exports[_0xc499('0x4b')]=function(_0x47e516,_0x18d3cd){return db['Interval'][_0xc499('0x4b')](_0x47e516[_0xc499('0x4c')],{})[_0xc499('0x26')](function(_0x122f0d){var _0x31caf7=_0x47e516[_0xc499('0x4d')][_0xc499('0x27')]({'plain':!![]});if(!_0x31caf7)throw new Error(_0xc499('0x4e'));if(_0x31caf7[_0xc499('0x4f')]==='user'){var _0x3511b1=_0x122f0d['get']({'plain':!![]});var _0x28aa3c='Intervals';return db[_0xc499('0x50')][_0xc499('0x4a')]({'where':{'name':_0x28aa3c,'userProfileId':_0x31caf7['userProfileId']},'raw':!![]})['then'](function(_0x438c36){if(_0x438c36&&_0x438c36['autoAssociation']===0x0){return db[_0xc499('0x29')]['create']({'name':_0x3511b1['name'],'resourceId':_0x3511b1['id'],'type':_0x438c36[_0xc499('0x2d')],'sectionId':_0x438c36['id']},{})[_0xc499('0x26')](function(){return _0x122f0d;});}else{return _0x122f0d;}})[_0xc499('0x47')](function(_0x2a1541){logger[_0xc499('0x2b')](_0xc499('0x51'),_0x2a1541);throw _0x2a1541;});}return _0x122f0d;})[_0xc499('0x26')](respondWithResult(_0x18d3cd,0xc9))[_0xc499('0x47')](handleError(_0x18d3cd,null));};exports['update']=function(_0x10e740,_0x2bf4ce){if(_0x10e740[_0xc499('0x4c')]['id']){delete _0x10e740[_0xc499('0x4c')]['id'];}return db['Interval'][_0xc499('0x4a')]({'where':{'id':_0x10e740[_0xc499('0x49')]['id']}})[_0xc499('0x26')](handleEntityNotFound(_0x2bf4ce,null))['then'](saveUpdates(_0x10e740[_0xc499('0x4c')],null))['then'](respondWithResult(_0x2bf4ce,null))[_0xc499('0x47')](handleError(_0x2bf4ce,null));};exports[_0xc499('0x2a')]=function(_0x34cda9,_0x526737){return db[_0xc499('0x2f')][_0xc499('0x4a')]({'where':{'id':_0x34cda9[_0xc499('0x49')]['id']}})[_0xc499('0x26')](handleEntityNotFound(_0x526737,null))['then'](removeEntity(_0x526737,null))[_0xc499('0x47')](handleError(_0x526737,null));};exports[_0xc499('0x52')]=function(_0x3d7afc,_0x9590c9,_0x4bcd4c){if(_0x3d7afc['body']['id']){delete _0x3d7afc[_0xc499('0x4c')]['id'];}return db[_0xc499('0x2f')][_0xc499('0x4a')]({'where':{'id':_0x3d7afc['params']['id']}})[_0xc499('0x26')](handleEntityNotFound(_0x9590c9,null))[_0xc499('0x26')](function(_0x22555b){if(_0x22555b){_0x3d7afc['body'][_0xc499('0x53')]=_0x22555b['id'];return db[_0xc499('0x2f')][_0xc499('0x4b')](_0x3d7afc[_0xc499('0x4c')]);}})['then'](respondWithResult(_0x9590c9,null))[_0xc499('0x47')](handleError(_0x9590c9,null));};exports[_0xc499('0x54')]=function(_0x5213b9,_0x3b3995,_0x3a0db3){var _0x40c5e3={};var _0x30754f={};var _0x3e5ef4;var _0x4b91db;return db[_0xc499('0x2f')][_0xc499('0x55')]({'where':{'id':_0x5213b9['params']['id']}})[_0xc499('0x26')](handleEntityNotFound(_0x3b3995,null))[_0xc499('0x26')](function(_0x49f22c){if(_0x49f22c){_0x3e5ef4=_0x49f22c;_0x30754f[_0xc499('0x33')]=_[_0xc499('0x35')](db[_0xc499('0x2f')][_0xc499('0x30')]);_0x30754f[_0xc499('0x34')]=_['keys'](_0x5213b9[_0xc499('0x34')]);_0x30754f['filters']=_[_0xc499('0x37')](_0x30754f[_0xc499('0x33')],_0x30754f[_0xc499('0x34')]);_0x40c5e3[_0xc499('0x38')]=_[_0xc499('0x37')](_0x30754f[_0xc499('0x33')],qs[_0xc499('0x39')](_0x5213b9[_0xc499('0x34')][_0xc499('0x39')]));_0x40c5e3['attributes']=_0x40c5e3['attributes'][_0xc499('0x3a')]?_0x40c5e3[_0xc499('0x38')]:_0x30754f[_0xc499('0x33')];_0x40c5e3[_0xc499('0x3c')]=qs['sort'](_0x5213b9['query']['sort']);_0x40c5e3[_0xc499('0x3e')]=qs['filters'](_[_0xc499('0x56')](_0x5213b9['query'],_0x30754f[_0xc499('0x36')]));if(_0x5213b9[_0xc499('0x34')][_0xc499('0x3f')]){_0x40c5e3[_0xc499('0x3e')]=_[_0xc499('0x40')](_0x40c5e3[_0xc499('0x3e')],{'$or':_[_0xc499('0x2e')](_0x40c5e3[_0xc499('0x38')],function(_0x44108c){var _0x37eb2b={};_0x37eb2b[_0x44108c]={'$like':'%'+_0x5213b9['query'][_0xc499('0x3f')]+'%'};return _0x37eb2b;})});}_0x40c5e3=_[_0xc499('0x40')]({},_0x40c5e3,_0x5213b9[_0xc499('0x43')]);return _0x3e5ef4[_0xc499('0x54')](_0x40c5e3);}})[_0xc499('0x26')](function(_0x57e074){if(_0x57e074){_0x4b91db=_0x57e074[_0xc499('0x3a')];if(!_0x5213b9[_0xc499('0x34')][_0xc499('0x3b')](_0xc499('0x57'))){_0x40c5e3[_0xc499('0x20')]=qs[_0xc499('0x20')](_0x5213b9[_0xc499('0x34')][_0xc499('0x20')]);_0x40c5e3[_0xc499('0x1f')]=qs[_0xc499('0x1f')](_0x5213b9[_0xc499('0x34')][_0xc499('0x1f')]);}return _0x3e5ef4[_0xc499('0x54')](_0x40c5e3);}})['then'](function(_0x4cda38){if(_0x4cda38){return _0x4cda38?{'count':_0x4b91db,'rows':_0x4cda38}:null;}})[_0xc499('0x26')](respondWithResult(_0x3b3995,null))[_0xc499('0x47')](handleError(_0x3b3995,null));};exports[_0xc499('0x58')]=function(_0x2dcd01,_0xf8302d,_0x28d791){return db['Interval'][_0xc499('0x55')]({'where':{'id':_0x2dcd01[_0xc499('0x49')]['id']}})[_0xc499('0x26')](handleEntityNotFound(_0xf8302d,null))[_0xc499('0x26')](function(_0xe82db5){if(_0xe82db5){return db['sequelize'][_0xc499('0x59')](function(_0x38b165){return db['Interval']['destroy']({'where':{'IntervalId':_0x2dcd01[_0xc499('0x49')]['id']},'transaction':_0x38b165})[_0xc499('0x26')](function(_0x2474a3){var _0x5943bb=_['map'](_0x2dcd01['body'],function(_0x4c7a4c){delete _0x4c7a4c['id'];_0x4c7a4c[_0xc499('0x53')]=_0x2dcd01[_0xc499('0x49')]['id'];return _0x4c7a4c;});return db[_0xc499('0x2f')][_0xc499('0x5a')](_0x5943bb,{'transaction':_0x38b165});});})[_0xc499('0x26')](function(){return db[_0xc499('0x2f')][_0xc499('0x46')]({'where':{'IntervalId':_0x2dcd01[_0xc499('0x49')]['id']}});});}})[_0xc499('0x26')](respondWithResult(_0xf8302d,null))[_0xc499('0x47')](handleError(_0xf8302d,null));}; \ No newline at end of file +var _0xe56e=['index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','Interval','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','order','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','get','Intervals','then','end','error','stack','name','send'];(function(_0x25622f,_0x4fb9f9){var _0x44f990=function(_0x38626e){while(--_0x38626e){_0x25622f['push'](_0x25622f['shift']());}};_0x44f990(++_0x4fb9f9);}(_0xe56e,0x14e));var _0xee56=function(_0x2f06d1,_0x5479ad){_0x2f06d1=_0x2f06d1-0x0;var _0x1be026=_0xe56e[_0x2f06d1];return _0x1be026;};'use strict';var emlformat=require(_0xee56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee56('0x1'));var jsonpatch=require(_0xee56('0x2'));var rp=require('request-promise');var moment=require(_0xee56('0x3'));var BPromise=require(_0xee56('0x4'));var Mustache=require(_0xee56('0x5'));var util=require(_0xee56('0x6'));var path=require(_0xee56('0x7'));var sox=require(_0xee56('0x8'));var csv=require(_0xee56('0x9'));var ejs=require(_0xee56('0xa'));var fs=require('fs');var fs_extra=require(_0xee56('0xb'));var _=require('lodash');var squel=require(_0xee56('0xc'));var crypto=require(_0xee56('0xd'));var jsforce=require(_0xee56('0xe'));var deskjs=require(_0xee56('0xf'));var toCsv=require('to-csv');var querystring=require(_0xee56('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee56('0x11'));var qs=require(_0xee56('0x12'));var as=require(_0xee56('0x13'));var hardwareService=require(_0xee56('0x14'));var logger=require(_0xee56('0x15'))(_0xee56('0x16'));var utils=require('../../config/utils');var config=require(_0xee56('0x17'));var licenseUtil=require(_0xee56('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0xee56('0x19'));function respondWithStatusCode(_0xe3f876,_0x11c59c){_0x11c59c=_0x11c59c||0xcc;return function(_0x61de2a){if(_0x61de2a){return _0xe3f876[_0xee56('0x1a')](_0x11c59c);}return _0xe3f876[_0xee56('0x1b')](_0x11c59c)['end']();};}function respondWithResult(_0x18f13e,_0x4241dc){_0x4241dc=_0x4241dc||0xc8;return function(_0x253f95){if(_0x253f95){return _0x18f13e[_0xee56('0x1b')](_0x4241dc)[_0xee56('0x1c')](_0x253f95);}};}function respondWithFilteredResult(_0x50971d,_0x100cfc){return function(_0x5ad2ec){if(_0x5ad2ec){var _0x4748b4=typeof _0x100cfc[_0xee56('0x1d')]===_0xee56('0x1e')&&typeof _0x100cfc[_0xee56('0x1f')]===_0xee56('0x1e');var _0x85eff4=_0x5ad2ec[_0xee56('0x20')];var _0x5a7fbd=_0x4748b4?0x0:_0x100cfc[_0xee56('0x1d')];var _0x426b98=_0x4748b4?_0x5ad2ec[_0xee56('0x20')]:_0x100cfc[_0xee56('0x1d')]+_0x100cfc[_0xee56('0x1f')];var _0x129ffd;if(_0x426b98>=_0x85eff4){_0x426b98=_0x85eff4;_0x129ffd=0xc8;}else{_0x129ffd=0xce;}_0x50971d[_0xee56('0x1b')](_0x129ffd);return _0x50971d['set'](_0xee56('0x21'),_0x5a7fbd+'-'+_0x426b98+'/'+_0x85eff4)[_0xee56('0x1c')](_0x5ad2ec);}return null;};}function patchUpdates(_0x110360){return function(_0x2ddc4a){try{jsonpatch['apply'](_0x2ddc4a,_0x110360,!![]);}catch(_0x1eee13){return BPromise[_0xee56('0x22')](_0x1eee13);}return _0x2ddc4a[_0xee56('0x23')]();};}function saveUpdates(_0x1ffc5a,_0x5c1d5e){return function(_0x2cd2de){if(_0x2cd2de){return _0x2cd2de[_0xee56('0x24')](_0x1ffc5a)['then'](function(_0x4d4d4b){return _0x4d4d4b;});}return null;};}function removeEntity(_0x4f37e6,_0x38e0b9){return function(_0x2157ac){if(_0x2157ac){return _0x2157ac[_0xee56('0x25')]()['then'](function(){var _0x1e2196=_0x2157ac[_0xee56('0x26')]({'plain':!![]});var _0x27c95c=_0xee56('0x27');return db['UserProfileResource'][_0xee56('0x25')]({'where':{'type':_0x27c95c,'resourceId':_0x1e2196['id']}})['then'](function(){return _0x2157ac;});})[_0xee56('0x28')](function(){_0x4f37e6[_0xee56('0x1b')](0xcc)[_0xee56('0x29')]();});}};}function handleEntityNotFound(_0x2f54c6,_0x33c62f){return function(_0x1b65b7){if(!_0x1b65b7){_0x2f54c6[_0xee56('0x1a')](0x194);}return _0x1b65b7;};}function handleError(_0x44188e,_0x3ae6f3){_0x3ae6f3=_0x3ae6f3||0x1f4;return function(_0x19994c){logger[_0xee56('0x2a')](_0x19994c[_0xee56('0x2b')]);if(_0x19994c[_0xee56('0x2c')]){delete _0x19994c[_0xee56('0x2c')];}_0x44188e[_0xee56('0x1b')](_0x3ae6f3)[_0xee56('0x2d')](_0x19994c);};}exports[_0xee56('0x2e')]=function(_0x1cecb0,_0x4abbaf){var _0x4e579d={},_0x31a026={},_0x41a038={'count':0x0,'rows':[]};var _0x4346c6=_[_0xee56('0x2f')](db['Interval'][_0xee56('0x30')],function(_0x1c646f){return{'name':_0x1c646f['fieldName'],'type':_0x1c646f[_0xee56('0x31')][_0xee56('0x32')]};});_0x31a026[_0xee56('0x33')]=_['map'](_0x4346c6,'name');_0x31a026[_0xee56('0x34')]=_[_0xee56('0x35')](_0x1cecb0[_0xee56('0x34')]);_0x31a026[_0xee56('0x36')]=_[_0xee56('0x37')](_0x31a026[_0xee56('0x33')],_0x31a026[_0xee56('0x34')]);_0x4e579d['attributes']=_['intersection'](_0x31a026['model'],qs[_0xee56('0x38')](_0x1cecb0[_0xee56('0x34')][_0xee56('0x38')]));_0x4e579d['attributes']=_0x4e579d[_0xee56('0x39')][_0xee56('0x3a')]?_0x4e579d['attributes']:_0x31a026[_0xee56('0x33')];if(!_0x1cecb0['query'][_0xee56('0x3b')]('nolimit')){_0x4e579d[_0xee56('0x1f')]=qs[_0xee56('0x1f')](_0x1cecb0['query'][_0xee56('0x1f')]);_0x4e579d[_0xee56('0x1d')]=qs[_0xee56('0x1d')](_0x1cecb0[_0xee56('0x34')][_0xee56('0x1d')]);}_0x4e579d['order']=qs[_0xee56('0x3c')](_0x1cecb0[_0xee56('0x34')]['sort']);_0x4e579d[_0xee56('0x3d')]=qs[_0xee56('0x36')](_[_0xee56('0x3e')](_0x1cecb0[_0xee56('0x34')],_0x31a026[_0xee56('0x36')]),_0x4346c6);if(_0x1cecb0[_0xee56('0x34')][_0xee56('0x3f')]){_0x4e579d[_0xee56('0x3d')]=_[_0xee56('0x40')](_0x4e579d[_0xee56('0x3d')],{'$or':_[_0xee56('0x2f')](_0x4346c6,function(_0x1e5bb0){if(_0x1e5bb0['type']!==_0xee56('0x41')){var _0x1f2845={};_0x1f2845[_0x1e5bb0[_0xee56('0x2c')]]={'$like':'%'+_0x1cecb0[_0xee56('0x34')]['filter']+'%'};return _0x1f2845;}})});}_0x4e579d=_['merge']({},_0x4e579d,_0x1cecb0['options']);var _0x41e735={'where':_0x4e579d[_0xee56('0x3d')]};return db[_0xee56('0x42')][_0xee56('0x20')](_0x41e735)['then'](function(_0x748b33){_0x41a038[_0xee56('0x20')]=_0x748b33;if(_0x1cecb0['query'][_0xee56('0x43')]){_0x4e579d[_0xee56('0x44')]=[{'all':!![]}];}return db[_0xee56('0x42')][_0xee56('0x45')](_0x4e579d);})[_0xee56('0x28')](function(_0x2ebe02){_0x41a038[_0xee56('0x46')]=_0x2ebe02;return _0x41a038;})['then'](respondWithFilteredResult(_0x4abbaf,_0x4e579d))[_0xee56('0x47')](handleError(_0x4abbaf,null));};exports[_0xee56('0x48')]=function(_0x533470,_0x5573ed){var _0x47f180={'raw':!![],'where':{'id':_0x533470[_0xee56('0x49')]['id']}},_0x455dd4={};_0x455dd4[_0xee56('0x33')]=_[_0xee56('0x35')](db[_0xee56('0x42')]['rawAttributes']);_0x455dd4[_0xee56('0x34')]=_[_0xee56('0x35')](_0x533470[_0xee56('0x34')]);_0x455dd4[_0xee56('0x36')]=_['intersection'](_0x455dd4[_0xee56('0x33')],_0x455dd4['query']);_0x47f180[_0xee56('0x39')]=_[_0xee56('0x37')](_0x455dd4[_0xee56('0x33')],qs[_0xee56('0x38')](_0x533470[_0xee56('0x34')][_0xee56('0x38')]));_0x47f180[_0xee56('0x39')]=_0x47f180[_0xee56('0x39')][_0xee56('0x3a')]?_0x47f180[_0xee56('0x39')]:_0x455dd4[_0xee56('0x33')];if(_0x533470['query']['includeAll']){_0x47f180['include']=[{'all':!![]}];}_0x47f180=_[_0xee56('0x40')]({},_0x47f180,_0x533470['options']);return db['Interval'][_0xee56('0x4a')](_0x47f180)[_0xee56('0x28')](handleEntityNotFound(_0x5573ed,null))[_0xee56('0x28')](respondWithResult(_0x5573ed,null))[_0xee56('0x47')](handleError(_0x5573ed,null));};exports['create']=function(_0x333039,_0x4c4938){return db[_0xee56('0x42')][_0xee56('0x4b')](_0x333039[_0xee56('0x4c')],{})['then'](function(_0xf5755d){var _0x4ca052=_0x333039['user'][_0xee56('0x26')]({'plain':!![]});if(!_0x4ca052)throw new Error(_0xee56('0x4d'));if(_0x4ca052[_0xee56('0x4e')]===_0xee56('0x4f')){var _0x50b68f=_0xf5755d['get']({'plain':!![]});var _0x686ff='Intervals';return db[_0xee56('0x50')][_0xee56('0x4a')]({'where':{'name':_0x686ff,'userProfileId':_0x4ca052[_0xee56('0x51')]},'raw':!![]})['then'](function(_0x3d8be7){if(_0x3d8be7&&_0x3d8be7[_0xee56('0x52')]===0x0){return db[_0xee56('0x53')][_0xee56('0x4b')]({'name':_0x50b68f[_0xee56('0x2c')],'resourceId':_0x50b68f['id'],'type':_0x3d8be7[_0xee56('0x2c')],'sectionId':_0x3d8be7['id']},{})[_0xee56('0x28')](function(){return _0xf5755d;});}else{return _0xf5755d;}})['catch'](function(_0x369060){logger['error'](_0xee56('0x54'),_0x369060);throw _0x369060;});}return _0xf5755d;})['then'](respondWithResult(_0x4c4938,0xc9))[_0xee56('0x47')](handleError(_0x4c4938,null));};exports[_0xee56('0x24')]=function(_0x23d2f7,_0x33b716){if(_0x23d2f7[_0xee56('0x4c')]['id']){delete _0x23d2f7[_0xee56('0x4c')]['id'];}return db[_0xee56('0x42')][_0xee56('0x4a')]({'where':{'id':_0x23d2f7['params']['id']}})['then'](handleEntityNotFound(_0x33b716,null))[_0xee56('0x28')](saveUpdates(_0x23d2f7[_0xee56('0x4c')],null))[_0xee56('0x28')](respondWithResult(_0x33b716,null))['catch'](handleError(_0x33b716,null));};exports[_0xee56('0x25')]=function(_0x4ce056,_0x5580bb){return db[_0xee56('0x42')][_0xee56('0x4a')]({'where':{'id':_0x4ce056['params']['id']}})[_0xee56('0x28')](handleEntityNotFound(_0x5580bb,null))['then'](removeEntity(_0x5580bb,null))[_0xee56('0x47')](handleError(_0x5580bb,null));};exports[_0xee56('0x55')]=function(_0x58b79f,_0x27cff0,_0x33279f){if(_0x58b79f['body']['id']){delete _0x58b79f[_0xee56('0x4c')]['id'];}return db['Interval'][_0xee56('0x4a')]({'where':{'id':_0x58b79f[_0xee56('0x49')]['id']}})['then'](handleEntityNotFound(_0x27cff0,null))['then'](function(_0x2decee){if(_0x2decee){_0x58b79f[_0xee56('0x4c')][_0xee56('0x56')]=_0x2decee['id'];return db[_0xee56('0x42')][_0xee56('0x4b')](_0x58b79f[_0xee56('0x4c')]);}})[_0xee56('0x28')](respondWithResult(_0x27cff0,null))[_0xee56('0x47')](handleError(_0x27cff0,null));};exports[_0xee56('0x57')]=function(_0x51b24f,_0x1f304b,_0x272cf9){var _0x2c6406={};var _0x22ed3a={};var _0x3db926;var _0x5a9644;return db[_0xee56('0x42')][_0xee56('0x58')]({'where':{'id':_0x51b24f[_0xee56('0x49')]['id']}})[_0xee56('0x28')](handleEntityNotFound(_0x1f304b,null))[_0xee56('0x28')](function(_0x4bbe39){if(_0x4bbe39){_0x3db926=_0x4bbe39;_0x22ed3a['model']=_[_0xee56('0x35')](db[_0xee56('0x42')][_0xee56('0x30')]);_0x22ed3a[_0xee56('0x34')]=_['keys'](_0x51b24f['query']);_0x22ed3a['filters']=_[_0xee56('0x37')](_0x22ed3a[_0xee56('0x33')],_0x22ed3a[_0xee56('0x34')]);_0x2c6406[_0xee56('0x39')]=_[_0xee56('0x37')](_0x22ed3a[_0xee56('0x33')],qs[_0xee56('0x38')](_0x51b24f[_0xee56('0x34')]['fields']));_0x2c6406[_0xee56('0x39')]=_0x2c6406[_0xee56('0x39')][_0xee56('0x3a')]?_0x2c6406['attributes']:_0x22ed3a['model'];_0x2c6406[_0xee56('0x59')]=qs[_0xee56('0x3c')](_0x51b24f[_0xee56('0x34')][_0xee56('0x3c')]);_0x2c6406[_0xee56('0x3d')]=qs[_0xee56('0x36')](_[_0xee56('0x3e')](_0x51b24f[_0xee56('0x34')],_0x22ed3a['filters']));if(_0x51b24f['query'][_0xee56('0x3f')]){_0x2c6406['where']=_[_0xee56('0x40')](_0x2c6406[_0xee56('0x3d')],{'$or':_[_0xee56('0x2f')](_0x2c6406[_0xee56('0x39')],function(_0x43d6a2){var _0x5ef597={};_0x5ef597[_0x43d6a2]={'$like':'%'+_0x51b24f['query'][_0xee56('0x3f')]+'%'};return _0x5ef597;})});}_0x2c6406=_[_0xee56('0x40')]({},_0x2c6406,_0x51b24f['options']);return _0x3db926[_0xee56('0x57')](_0x2c6406);}})[_0xee56('0x28')](function(_0x1102a9){if(_0x1102a9){_0x5a9644=_0x1102a9[_0xee56('0x3a')];if(!_0x51b24f[_0xee56('0x34')]['hasOwnProperty'](_0xee56('0x5a'))){_0x2c6406[_0xee56('0x1f')]=qs[_0xee56('0x1f')](_0x51b24f[_0xee56('0x34')][_0xee56('0x1f')]);_0x2c6406[_0xee56('0x1d')]=qs[_0xee56('0x1d')](_0x51b24f[_0xee56('0x34')][_0xee56('0x1d')]);}return _0x3db926[_0xee56('0x57')](_0x2c6406);}})[_0xee56('0x28')](function(_0x3e79ac){if(_0x3e79ac){return _0x3e79ac?{'count':_0x5a9644,'rows':_0x3e79ac}:null;}})[_0xee56('0x28')](respondWithResult(_0x1f304b,null))[_0xee56('0x47')](handleError(_0x1f304b,null));};exports[_0xee56('0x5b')]=function(_0x3223b5,_0x56a2c3,_0x56d68c){return db[_0xee56('0x42')][_0xee56('0x58')]({'where':{'id':_0x3223b5[_0xee56('0x49')]['id']}})[_0xee56('0x28')](handleEntityNotFound(_0x56a2c3,null))[_0xee56('0x28')](function(_0x3c4da3){if(_0x3c4da3){return db[_0xee56('0x5c')][_0xee56('0x5d')](function(_0x4536b7){return db[_0xee56('0x42')][_0xee56('0x25')]({'where':{'IntervalId':_0x3223b5[_0xee56('0x49')]['id']},'transaction':_0x4536b7})[_0xee56('0x28')](function(_0x18b6fd){var _0x1191fd=_[_0xee56('0x2f')](_0x3223b5[_0xee56('0x4c')],function(_0x43ff6e){delete _0x43ff6e['id'];_0x43ff6e[_0xee56('0x56')]=_0x3223b5[_0xee56('0x49')]['id'];return _0x43ff6e;});return db[_0xee56('0x42')][_0xee56('0x5e')](_0x1191fd,{'transaction':_0x4536b7});});})[_0xee56('0x28')](function(){return db[_0xee56('0x42')][_0xee56('0x45')]({'where':{'IntervalId':_0x3223b5[_0xee56('0x49')]['id']}});});}})[_0xee56('0x28')](respondWithResult(_0x56a2c3,null))[_0xee56('0x47')](handleError(_0x56a2c3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b73f078..6c8b852 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 _0x0b7c=['getIntervals','then','all','map','./interval.attributes','../../components/extensions/rewrite','iftime','exports','tools_intervals','rewrite','interval','string'];(function(_0x52551c,_0x4a5add){var _0x4a9f1c=function(_0x1d4e00){while(--_0x1d4e00){_0x52551c['push'](_0x52551c['shift']());}};_0x4a9f1c(++_0x4a5add);}(_0x0b7c,0x7c));var _0xc0b7=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0x0b7c[_0x3e5f6d];return _0x1bea6e;};'use strict';var attributes=require(_0xc0b7('0x0'));var extensions=require(_0xc0b7('0x1'));var iftime=require('../../utils/iftime')[_0xc0b7('0x2')];module[_0xc0b7('0x3')]=function(_0x51a67c){return _0x51a67c['define']('Interval',attributes,{'tableName':_0xc0b7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17a9cd){extensions[_0xc0b7('0x5')](_0x51a67c,_0x17a9cd);},'afterBulkCreate':function(_0x20c41c,_0x4aa27c,_0x50ec8d){_0x50ec8d();extensions[_0xc0b7('0x5')](_0x51a67c,_0x20c41c[0x0]);},'afterUpdate':function(_0xe009a8){extensions[_0xc0b7('0x5')](_0x51a67c,_0xe009a8);},'afterDestroy':function(_0x4a6143){extensions[_0xc0b7('0x5')](_0x51a67c,_0x4a6143);}},'instanceMethods':{'ifTime':function(_0x5a78d7=undefined,_0xb0077c=new Date()){if(typeof this[_0xc0b7('0x6')]===_0xc0b7('0x7')){return iftime(this['interval'],_0x5a78d7,_0xb0077c);}else{return this[_0xc0b7('0x8')]()[_0xc0b7('0x9')](function(_0x5a0faa){return Promise[_0xc0b7('0xa')](_0x5a0faa[_0xc0b7('0xb')](function(_0x9800ad){return _0x9800ad['ifTime'](_0x5a78d7,_0xb0077c);}));})['then'](function(_0xfaeb46){return _0xfaeb46['reduce'](function(_0x3ded00,_0x39064c){return _0x3ded00||_0x39064c;},![]);});}}}});}; \ No newline at end of file +var _0x02f9=['getIntervals','then','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','interval','string'];(function(_0x1907ed,_0x389878){var _0x4fc659=function(_0x229bef){while(--_0x229bef){_0x1907ed['push'](_0x1907ed['shift']());}};_0x4fc659(++_0x389878);}(_0x02f9,0x170));var _0x902f=function(_0x10d431,_0x492e01){_0x10d431=_0x10d431-0x0;var _0x3fde9f=_0x02f9[_0x10d431];return _0x3fde9f;};'use strict';var attributes=require(_0x902f('0x0'));var extensions=require(_0x902f('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x902f('0x2')]=function(_0x257815){return _0x257815[_0x902f('0x3')](_0x902f('0x4'),attributes,{'tableName':_0x902f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x24c384){extensions['rewrite'](_0x257815,_0x24c384);},'afterBulkCreate':function(_0x241b72,_0x3eaaa7,_0x5652d8){_0x5652d8();extensions[_0x902f('0x6')](_0x257815,_0x241b72[0x0]);},'afterUpdate':function(_0x3d1ce1){extensions[_0x902f('0x6')](_0x257815,_0x3d1ce1);},'afterDestroy':function(_0x5028bd){extensions[_0x902f('0x6')](_0x257815,_0x5028bd);}},'instanceMethods':{'ifTime':function(_0x43aba9=undefined,_0x904c5d=new Date()){if(typeof this[_0x902f('0x7')]===_0x902f('0x8')){return iftime(this[_0x902f('0x7')],_0x43aba9,_0x904c5d);}else{return this[_0x902f('0x9')]()[_0x902f('0xa')](function(_0x516757){return Promise['all'](_0x516757['map'](function(_0x1dbacd){return _0x1dbacd[_0x902f('0xb')](_0x43aba9,_0x904c5d);}));})['then'](function(_0x127195){return _0x127195[_0x902f('0xc')](function(_0x259136,_0x3680fb){return _0x259136||_0x3680fb;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index bf0f3a3..603ba24 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 _0xc297=['reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowInterval','Interval','find','all','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve'];(function(_0x4f440c,_0x44ed6d){var _0x600fed=function(_0x5145f7){while(--_0x5145f7){_0x4f440c['push'](_0x4f440c['shift']());}};_0x600fed(++_0x44ed6d);}(_0xc297,0xb5));var _0x7c29=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xc297[_0x1db251];return _0x56685a;};'use strict';var _=require(_0x7c29('0x0'));var util=require(_0x7c29('0x1'));var db=require(_0x7c29('0x2'))['db'];var iftime=require(_0x7c29('0x3'))[_0x7c29('0x4')];var logger=require(_0x7c29('0x5'))(_0x7c29('0x6'));exports[_0x7c29('0x7')]=function(_0x5f4a67){var _0x3e982f=this;return new Promise(function(_0x49be56,_0x24ab37){return db['Interval']['findAll']({'raw':_0x5f4a67[_0x7c29('0x8')]?_0x5f4a67[_0x7c29('0x8')][_0x7c29('0x9')]===undefined?!![]:![]:!![],'where':_0x5f4a67['options']?_0x5f4a67['options'][_0x7c29('0xa')]||null:null,'attributes':_0x5f4a67[_0x7c29('0x8')]?_0x5f4a67['options'][_0x7c29('0xb')]||null:null,'limit':_0x5f4a67[_0x7c29('0x8')]?_0x5f4a67['options'][_0x7c29('0xc')]||null:null,'include':_0x5f4a67[_0x7c29('0x8')]?_0x5f4a67[_0x7c29('0x8')]['include']?_['map'](_0x5f4a67['options'][_0x7c29('0xd')],function(_0x1ff045){return{'model':db[_0x1ff045[_0x7c29('0xe')]],'as':_0x1ff045['as'],'attributes':_0x1ff045[_0x7c29('0xb')],'include':_0x1ff045[_0x7c29('0xd')]?_['map'](_0x1ff045['include'],function(_0x3d49f8){return{'model':db[_0x3d49f8[_0x7c29('0xe')]],'as':_0x3d49f8['as'],'attributes':_0x3d49f8[_0x7c29('0xb')],'include':_0x3d49f8[_0x7c29('0xd')]?_[_0x7c29('0xf')](_0x3d49f8[_0x7c29('0xd')],function(_0x5a915b){return{'model':db[_0x5a915b[_0x7c29('0xe')]],'as':_0x5a915b['as'],'attributes':_0x5a915b[_0x7c29('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7c29('0x10')](function(_0x8daf73){logger[_0x7c29('0x11')](_0x7c29('0x7'),_0x5f4a67);logger[_0x7c29('0x12')](_0x7c29('0x7'),_0x5f4a67,JSON[_0x7c29('0x13')](_0x8daf73));_0x49be56(_0x8daf73);})[_0x7c29('0x14')](function(_0x40947a){logger[_0x7c29('0x15')](_0x7c29('0x7'),_0x40947a[_0x7c29('0x16')],_0x5f4a67);_0x24ab37(_0x3e982f['error'](0x1f4,_0x40947a['message']));});});};exports[_0x7c29('0x17')]=function(_0x3ffef2){var _0x4e8427=this;return new Promise(function(_0x21ee51,_0x1bb7f9){return db[_0x7c29('0x18')][_0x7c29('0x19')]({'raw':_0x3ffef2[_0x7c29('0x8')]?_0x3ffef2[_0x7c29('0x8')][_0x7c29('0x9')]===undefined?!![]:![]:!![],'where':_0x3ffef2[_0x7c29('0x8')]?_0x3ffef2[_0x7c29('0x8')][_0x7c29('0xa')]||null:null,'attributes':_0x3ffef2[_0x7c29('0x8')]?_0x3ffef2[_0x7c29('0x8')][_0x7c29('0xb')]||null:null,'include':_0x3ffef2['options']?_0x3ffef2['options']['include']?_[_0x7c29('0xf')](_0x3ffef2[_0x7c29('0x8')]['include'],function(_0x33c319){return{'model':db[_0x33c319['model']],'as':_0x33c319['as'],'attributes':_0x33c319[_0x7c29('0xb')],'include':_0x33c319[_0x7c29('0xd')]?_['map'](_0x33c319[_0x7c29('0xd')],function(_0x41adcb){return{'model':db[_0x41adcb[_0x7c29('0xe')]],'as':_0x41adcb['as'],'attributes':_0x41adcb[_0x7c29('0xb')],'include':_0x41adcb[_0x7c29('0xd')]?_[_0x7c29('0xf')](_0x41adcb[_0x7c29('0xd')],function(_0x5559b9){return{'model':db[_0x5559b9[_0x7c29('0xe')]],'as':_0x5559b9['as'],'attributes':_0x5559b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c29('0x10')](function(_0x54f344){logger['info'](_0x7c29('0x17'),_0x3ffef2);logger[_0x7c29('0x12')]('ShowInterval',_0x3ffef2,JSON[_0x7c29('0x13')](_0x54f344));_0x21ee51(_0x54f344);})[_0x7c29('0x14')](function(_0x39315a){logger[_0x7c29('0x15')](_0x7c29('0x17'),_0x39315a[_0x7c29('0x16')],_0x3ffef2);_0x1bb7f9(_0x4e8427[_0x7c29('0x15')](0x1f4,_0x39315a[_0x7c29('0x16')]));});});};function checkArrayOfIntervals(_0x2974e6,_0x5c18ec){var _0x219dd8=[];return db['Interval']['findAll']({'where':{'id':_0x2974e6}})['then'](function(_0x5c5ddb){_0x219dd8=_0x5c5ddb;return Promise[_0x7c29('0x1a')](_0x219dd8[_0x7c29('0xf')](function(_0x57555c){return _0x57555c['ifTime'](_0x5c18ec);}));})[_0x7c29('0x10')](function(_0x208822){var _0x28c4c1=_0x208822['reduce'](function(_0x1b2d17,_0x269be9){return _0x1b2d17||_0x269be9;},![]);logger[_0x7c29('0x11')](util[_0x7c29('0x1b')](_0x7c29('0x1c'),_0x219dd8[_0x7c29('0xf')](function(_0xc6f30b){return _0xc6f30b[_0x7c29('0x1d')];})[_0x7c29('0x1e')](',\x20'),_0x219dd8[_0x7c29('0xf')](function(_0x47244e){return _0x47244e['id'];})[_0x7c29('0x1e')](',\x20')));return _0x28c4c1;});}function checkSingleInterval(_0x85c921,_0x57c0db){return db[_0x7c29('0x18')]['findById'](_0x85c921)[_0x7c29('0x10')](function(_0xe16d22){if(_0xe16d22){logger['info'](util['format'](_0x7c29('0x1f'),_0xe16d22['name'],_0xe16d22['id']));return _0xe16d22[_0x7c29('0x20')](_0x57c0db);}});}exports[_0x7c29('0x21')]=function(_0x2dc390){var _0x3bb173=_0x2dc390[_0x7c29('0x22')];var _0x1f7522=Array[_0x7c29('0x23')](_0x2dc390['intervals'])?_0x2dc390[_0x7c29('0x24')]:typeof _0x2dc390['intervals']===_0x7c29('0x25')?[_0x2dc390[_0x7c29('0x24')]]:[];var _0x467fc9=_0x2dc390[_0x7c29('0x26')]||undefined;var _0x360eb8=![];if(_0x1f7522['length']){logger[_0x7c29('0x11')](util[_0x7c29('0x1b')](_0x7c29('0x27'),_0x1f7522['join'](';\x20')));}if(_0x467fc9){logger['info'](util[_0x7c29('0x1b')](_0x7c29('0x28'),_0x467fc9));}logger['debug'](_0x7c29('0x29'),_0x360eb8);logger[_0x7c29('0x2a')](_0x7c29('0x21'),_0x2dc390);return Promise[_0x7c29('0x2b')]()[_0x7c29('0x10')](function(){if(Array[_0x7c29('0x23')](_0x3bb173)){return checkArrayOfIntervals(_0x3bb173,_0x467fc9);}else if(_0x3bb173){return checkSingleInterval(_0x3bb173,_0x467fc9);}})[_0x7c29('0x10')](function(_0x50b23c){var _0x67e20f=_0x1f7522[_0x7c29('0x2c')](function(_0x3fd4e4,_0x585a40){return _0x3fd4e4||iftime(_0x585a40,_0x467fc9);},![]);_0x360eb8=_0x50b23c||_0x67e20f;return _0x360eb8;})[_0x7c29('0x14')](function(_0xbd18fa){logger['error']('IntervalIftime',_0x2dc390,_0xbd18fa);throw this[_0x7c29('0x15')](0x1f4,_0xbd18fa[_0x7c29('0x16')]);});}; \ No newline at end of file +var _0x7f13=['resolve','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','attributes','limit','include','map','model','info','debug','stringify','message','error','ShowInterval','find','raw','where','then','catch','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x7f13,0xe2));var _0x37f1=function(_0x5e163f,_0x5343c8){_0x5e163f=_0x5e163f-0x0;var _0x282a35=_0x7f13[_0x5e163f];return _0x282a35;};'use strict';var _=require(_0x37f1('0x0'));var util=require('util');var db=require(_0x37f1('0x1'))['db'];var iftime=require(_0x37f1('0x2'))[_0x37f1('0x3')];var logger=require(_0x37f1('0x4'))(_0x37f1('0x5'));exports[_0x37f1('0x6')]=function(_0x47fd1a){var _0x520b74=this;return new Promise(function(_0x91142b,_0x1cba7e){return db[_0x37f1('0x7')][_0x37f1('0x8')]({'raw':_0x47fd1a[_0x37f1('0x9')]?_0x47fd1a[_0x37f1('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x47fd1a['options']?_0x47fd1a[_0x37f1('0x9')]['where']||null:null,'attributes':_0x47fd1a[_0x37f1('0x9')]?_0x47fd1a[_0x37f1('0x9')][_0x37f1('0xa')]||null:null,'limit':_0x47fd1a['options']?_0x47fd1a[_0x37f1('0x9')][_0x37f1('0xb')]||null:null,'include':_0x47fd1a['options']?_0x47fd1a[_0x37f1('0x9')][_0x37f1('0xc')]?_[_0x37f1('0xd')](_0x47fd1a['options']['include'],function(_0x2ce44b){return{'model':db[_0x2ce44b[_0x37f1('0xe')]],'as':_0x2ce44b['as'],'attributes':_0x2ce44b['attributes'],'include':_0x2ce44b[_0x37f1('0xc')]?_[_0x37f1('0xd')](_0x2ce44b[_0x37f1('0xc')],function(_0x34f99f){return{'model':db[_0x34f99f[_0x37f1('0xe')]],'as':_0x34f99f['as'],'attributes':_0x34f99f[_0x37f1('0xa')],'include':_0x34f99f[_0x37f1('0xc')]?_[_0x37f1('0xd')](_0x34f99f['include'],function(_0x1f4a5d){return{'model':db[_0x1f4a5d['model']],'as':_0x1f4a5d['as'],'attributes':_0x1f4a5d[_0x37f1('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x143ca1){logger[_0x37f1('0xf')](_0x37f1('0x6'),_0x47fd1a);logger[_0x37f1('0x10')](_0x37f1('0x6'),_0x47fd1a,JSON[_0x37f1('0x11')](_0x143ca1));_0x91142b(_0x143ca1);})['catch'](function(_0x585d71){logger['error'](_0x37f1('0x6'),_0x585d71[_0x37f1('0x12')],_0x47fd1a);_0x1cba7e(_0x520b74[_0x37f1('0x13')](0x1f4,_0x585d71[_0x37f1('0x12')]));});});};exports[_0x37f1('0x14')]=function(_0x453551){var _0x437c3d=this;return new Promise(function(_0x5f1206,_0x5badd4){return db[_0x37f1('0x7')][_0x37f1('0x15')]({'raw':_0x453551[_0x37f1('0x9')]?_0x453551[_0x37f1('0x9')][_0x37f1('0x16')]===undefined?!![]:![]:!![],'where':_0x453551[_0x37f1('0x9')]?_0x453551[_0x37f1('0x9')][_0x37f1('0x17')]||null:null,'attributes':_0x453551[_0x37f1('0x9')]?_0x453551[_0x37f1('0x9')][_0x37f1('0xa')]||null:null,'include':_0x453551[_0x37f1('0x9')]?_0x453551['options'][_0x37f1('0xc')]?_['map'](_0x453551['options'][_0x37f1('0xc')],function(_0x36c7bc){return{'model':db[_0x36c7bc[_0x37f1('0xe')]],'as':_0x36c7bc['as'],'attributes':_0x36c7bc[_0x37f1('0xa')],'include':_0x36c7bc['include']?_[_0x37f1('0xd')](_0x36c7bc[_0x37f1('0xc')],function(_0x4eb13a){return{'model':db[_0x4eb13a[_0x37f1('0xe')]],'as':_0x4eb13a['as'],'attributes':_0x4eb13a[_0x37f1('0xa')],'include':_0x4eb13a[_0x37f1('0xc')]?_[_0x37f1('0xd')](_0x4eb13a[_0x37f1('0xc')],function(_0x1d542a){return{'model':db[_0x1d542a[_0x37f1('0xe')]],'as':_0x1d542a['as'],'attributes':_0x1d542a['attributes']};}):[]};}):[]};}):[]:[]})[_0x37f1('0x18')](function(_0x3ef18c){logger[_0x37f1('0xf')](_0x37f1('0x14'),_0x453551);logger[_0x37f1('0x10')](_0x37f1('0x14'),_0x453551,JSON[_0x37f1('0x11')](_0x3ef18c));_0x5f1206(_0x3ef18c);})[_0x37f1('0x19')](function(_0x441b02){logger[_0x37f1('0x13')](_0x37f1('0x14'),_0x441b02[_0x37f1('0x12')],_0x453551);_0x5badd4(_0x437c3d['error'](0x1f4,_0x441b02[_0x37f1('0x12')]));});});};function checkArrayOfIntervals(_0x14a998,_0x165020){var _0x3e964b=[];return db[_0x37f1('0x7')][_0x37f1('0x8')]({'where':{'id':_0x14a998}})[_0x37f1('0x18')](function(_0x291dcc){_0x3e964b=_0x291dcc;return Promise[_0x37f1('0x1a')](_0x3e964b[_0x37f1('0xd')](function(_0x3b838c){return _0x3b838c[_0x37f1('0x1b')](_0x165020);}));})[_0x37f1('0x18')](function(_0x2bdedf){var _0x203dc0=_0x2bdedf[_0x37f1('0x1c')](function(_0x50311b,_0x1a97e7){return _0x50311b||_0x1a97e7;},![]);logger['info'](util[_0x37f1('0x1d')](_0x37f1('0x1e'),_0x3e964b[_0x37f1('0xd')](function(_0x47b84d){return _0x47b84d[_0x37f1('0x1f')];})['join'](',\x20'),_0x3e964b[_0x37f1('0xd')](function(_0x3744ac){return _0x3744ac['id'];})[_0x37f1('0x20')](',\x20')));return _0x203dc0;});}function checkSingleInterval(_0xc98ee,_0x584e25){return db['Interval']['findById'](_0xc98ee)[_0x37f1('0x18')](function(_0x3617da){if(_0x3617da){logger[_0x37f1('0xf')](util[_0x37f1('0x1d')](_0x37f1('0x21'),_0x3617da[_0x37f1('0x1f')],_0x3617da['id']));return _0x3617da[_0x37f1('0x1b')](_0x584e25);}});}exports[_0x37f1('0x22')]=function(_0x3899c3){var _0x4b115e=_0x3899c3['intervalIds'];var _0x23a60e=Array[_0x37f1('0x23')](_0x3899c3[_0x37f1('0x24')])?_0x3899c3[_0x37f1('0x24')]:typeof _0x3899c3[_0x37f1('0x24')]===_0x37f1('0x25')?[_0x3899c3[_0x37f1('0x24')]]:[];var _0x5c242f=_0x3899c3[_0x37f1('0x26')]||undefined;var _0x3d6806=![];if(_0x23a60e[_0x37f1('0x27')]){logger[_0x37f1('0xf')](util[_0x37f1('0x1d')](_0x37f1('0x28'),_0x23a60e['join'](';\x20')));}if(_0x5c242f){logger[_0x37f1('0xf')](util[_0x37f1('0x1d')](_0x37f1('0x29'),_0x5c242f));}logger[_0x37f1('0x10')](_0x37f1('0x2a'),_0x3d6806);logger[_0x37f1('0x2b')](_0x37f1('0x22'),_0x3899c3);return Promise[_0x37f1('0x2c')]()[_0x37f1('0x18')](function(){if(Array['isArray'](_0x4b115e)){return checkArrayOfIntervals(_0x4b115e,_0x5c242f);}else if(_0x4b115e){return checkSingleInterval(_0x4b115e,_0x5c242f);}})[_0x37f1('0x18')](function(_0xb386d2){var _0x4c1bc0=_0x23a60e[_0x37f1('0x1c')](function(_0x4a052b,_0x5ece1d){return _0x4a052b||iftime(_0x5ece1d,_0x5c242f);},![]);_0x3d6806=_0xb386d2||_0x4c1bc0;return _0x3d6806;})['catch'](function(_0x5ae1e3){logger[_0x37f1('0x13')](_0x37f1('0x22'),_0x3899c3,_0x5ae1e3);throw this['error'](0x1f4,_0x5ae1e3[_0x37f1('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 8c8b76b..4b425f5 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0xe025c,_0x15cac6){var _0x549d9b=function(_0xf973a4){while(--_0xf973a4){_0xe025c['push'](_0xe025c['shift']());}};_0x549d9b(++_0x15cac6);}(_0xadb5,0xad));var _0x5adb=function(_0x412ed0,_0xd4d1bf){_0x412ed0=_0x412ed0-0x0;var _0x4140ed=_0xadb5[_0x412ed0];return _0x4140ed;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x4f4f62,_0x514e64){var _0x5bcde7=function(_0x2e58b7){while(--_0x2e58b7){_0x4f4f62['push'](_0x4f4f62['shift']());}};_0x5bcde7(++_0x514e64);}(_0x2ef3,0xba));var _0x32ef=function(_0x32e814,_0x25e2b4){_0x32e814=_0x32e814-0x0;var _0x442fc0=_0x2ef3[_0x32e814];return _0x442fc0;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index cf0279a..62b6e90 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 _0x8859=['stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','status','parse','error','json','api.jira','end','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','api','support','3eAmWpBVP0','summary','\x20from\x20','description'];(function(_0x4ad3b5,_0x3a95d2){var _0x248b91=function(_0x32546a){while(--_0x32546a){_0x4ad3b5['push'](_0x4ad3b5['shift']());}};_0x248b91(++_0x3a95d2);}(_0x8859,0x12c));var _0x9885=function(_0x40ccae,_0x24fac8){_0x40ccae=_0x40ccae-0x0;var _0x5b4165=_0x8859[_0x40ccae];return _0x5b4165;};'use strict';var BPromise=require(_0x9885('0x0'));var https=require('https');var logger=require(_0x9885('0x1'))(_0x9885('0x2'));var USERNAME=_0x9885('0x3');var PASSWORD=_0x9885('0x4');function openIssue(_0x47998b,_0x4bb563){var _0x4653a0={'fields':{'project':{'key':_0x47998b['key']||'MOTGUI'},'summary':(_0x47998b[_0x9885('0x5')]||'Report')+_0x9885('0x6')+_0x47998b['ip'],'description':_0x47998b[_0x9885('0x7')]||JSON[_0x9885('0x8')](_0x47998b),'issuetype':{'name':_0x47998b[_0x9885('0x9')]||_0x9885('0xa')}}};_0x4653a0[_0x9885('0xb')][_0x9885('0xc')]=_0x47998b[_0x9885('0xd')];_0x4653a0[_0x9885('0xb')][_0x9885('0xe')]=_0x47998b['oldToken'];_0x4653a0['fields'][_0x9885('0xf')]=_0x47998b[_0x9885('0x10')];_0x4653a0[_0x9885('0xb')]['customfield_11503']=_0x47998b[_0x9885('0x11')];_0x4653a0[_0x9885('0xb')]['customfield_11504']=_0x47998b[_0x9885('0x12')];_0x4653a0['fields'][_0x9885('0x13')]=_0x47998b['ip'];var _0x4ae0a6={'host':_0x9885('0x14'),'port':0x1bb,'path':_0x9885('0x15'),'method':_0x9885('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x9885('0x17'),'Authorization':_0x9885('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x9885('0x19')]('base64')}};var _0x10c772=JSON[_0x9885('0x8')](_0x4653a0);var _0x26b489=https[_0x9885('0x1a')](_0x4ae0a6,function(_0x5b8318){_0x5b8318[_0x9885('0x1b')](_0x9885('0x1c'));var _0x42d4f2='';_0x5b8318['on'](_0x9885('0x1d'),function(_0x5aa2fa){_0x42d4f2+=_0x5aa2fa;});_0x5b8318['on']('end',function(){if(_0x4bb563){return _0x4bb563[_0x9885('0x1e')](_0x5b8318['statusCode'])['json'](JSON[_0x9885('0x1f')](_0x42d4f2));}});});_0x26b489['on'](_0x9885('0x20'),function(_0x2e7e86){if(_0x4bb563){return _0x4bb563[_0x9885('0x1e')](0x1f4)[_0x9885('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x9885('0x22')}]});}});_0x26b489['write'](_0x10c772);_0x26b489[_0x9885('0x23')]();}exports[_0x9885('0x24')]=openIssue;exports[_0x9885('0x25')]=function(_0x5ea2e3,_0x518673){_0x5ea2e3[_0x9885('0x26')]['ip']=_0x5ea2e3[_0x9885('0x27')][_0x9885('0x28')]||_0x5ea2e3[_0x9885('0x29')]['remoteAddress']||_0x5ea2e3[_0x9885('0x2a')][_0x9885('0x2b')]||_0x5ea2e3[_0x9885('0x29')][_0x9885('0x2a')][_0x9885('0x2b')];return openIssue(_0x5ea2e3[_0x9885('0x26')],_0x518673);}; \ No newline at end of file +var _0x8928=['utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','x-forwarded-for','remoteAddress','connection','body','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','setEncoding'];(function(_0x280131,_0x4e8aae){var _0x58f90f=function(_0x3470d6){while(--_0x3470d6){_0x280131['push'](_0x280131['shift']());}};_0x58f90f(++_0x4e8aae);}(_0x8928,0xe3));var _0x8892=function(_0x358e3b,_0x72233f){_0x358e3b=_0x358e3b-0x0;var _0x4906c0=_0x8928[_0x358e3b];return _0x4906c0;};'use strict';var BPromise=require(_0x8892('0x0'));var https=require('https');var logger=require(_0x8892('0x1'))(_0x8892('0x2'));var USERNAME=_0x8892('0x3');var PASSWORD=_0x8892('0x4');function openIssue(_0x494fd6,_0x7bcdf4){var _0x18956d={'fields':{'project':{'key':_0x494fd6[_0x8892('0x5')]||_0x8892('0x6')},'summary':(_0x494fd6['summary']||_0x8892('0x7'))+'\x20from\x20'+_0x494fd6['ip'],'description':_0x494fd6[_0x8892('0x8')]||JSON[_0x8892('0x9')](_0x494fd6),'issuetype':{'name':_0x494fd6[_0x8892('0xa')]||'Bug'}}};_0x18956d[_0x8892('0xb')][_0x8892('0xc')]=_0x494fd6[_0x8892('0xd')];_0x18956d[_0x8892('0xb')][_0x8892('0xe')]=_0x494fd6[_0x8892('0xf')];_0x18956d[_0x8892('0xb')][_0x8892('0x10')]=_0x494fd6['newToken'];_0x18956d[_0x8892('0xb')]['customfield_11503']=_0x494fd6[_0x8892('0x11')];_0x18956d['fields'][_0x8892('0x12')]=_0x494fd6['reason'];_0x18956d[_0x8892('0xb')][_0x8892('0x13')]=_0x494fd6['ip'];var _0xb237e0={'host':_0x8892('0x14'),'port':0x1bb,'path':_0x8892('0x15'),'method':_0x8892('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x8892('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x271085=JSON[_0x8892('0x9')](_0x18956d);var _0x5c0b91=https['request'](_0xb237e0,function(_0x3fc386){_0x3fc386[_0x8892('0x18')](_0x8892('0x19'));var _0xb8bfef='';_0x3fc386['on'](_0x8892('0x1a'),function(_0x9c1fd9){_0xb8bfef+=_0x9c1fd9;});_0x3fc386['on'](_0x8892('0x1b'),function(){if(_0x7bcdf4){return _0x7bcdf4[_0x8892('0x1c')](_0x3fc386[_0x8892('0x1d')])['json'](JSON[_0x8892('0x1e')](_0xb8bfef));}});});_0x5c0b91['on'](_0x8892('0x1f'),function(_0x10e07c){if(_0x7bcdf4){return _0x7bcdf4[_0x8892('0x1c')](0x1f4)[_0x8892('0x20')]({'errors':[{'message':_0x8892('0x21'),'type':_0x8892('0x22')}]});}});_0x5c0b91[_0x8892('0x23')](_0x271085);_0x5c0b91[_0x8892('0x1b')]();}exports[_0x8892('0x24')]=openIssue;exports[_0x8892('0x25')]=function(_0x113e9d,_0x3e1a49){_0x113e9d['body']['ip']=_0x113e9d['headers'][_0x8892('0x26')]||_0x113e9d['connection'][_0x8892('0x27')]||_0x113e9d['socket'][_0x8892('0x27')]||_0x113e9d[_0x8892('0x28')]['socket'][_0x8892('0x27')];return openIssue(_0x113e9d[_0x8892('0x29')],_0x3e1a49);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index bda85b3..c84e465 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4fb73e,_0x17f37d){var _0x14de68=function(_0xf5eeed){while(--_0xf5eeed){_0x4fb73e['push'](_0x4fb73e['shift']());}};_0x14de68(++_0x17f37d);}(_0x1339,0x1ed));var _0x9133=function(_0x55c61b,_0xd4cdc9){_0x55c61b=_0x55c61b-0x0;var _0xc1530f=_0x1339[_0x55c61b];return _0xc1530f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file +var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x17ba,0xab));var _0xa17b=function(_0x213d43,_0x4c6a04){_0x213d43=_0x213d43-0x0;var _0x1d46c0=_0x17ba[_0x213d43];return _0x1d46c0;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8d0c9a2..e1dd90f 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(_0x3f63d7,_0x12f2ba){_0x3f63d7=_0x3f63d7-0x0;var _0x4738fc=_0x7a54[_0x3f63d7];return _0x4738fc;};'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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x455dbe,_0x4ad5c0){_0x455dbe=_0x455dbe-0x0;var _0xbcd789=_0x7a54[_0x455dbe];return _0xbcd789;};'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 224887c..ca5620d 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 _0xce50=['api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce50,0x1d8));var _0x0ce5=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xce50[_0x2aec52];return _0x3b8835;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ce5('0x0'));var zipdir=require(_0x0ce5('0x1'));var jsonpatch=require(_0x0ce5('0x2'));var rp=require(_0x0ce5('0x3'));var moment=require(_0x0ce5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ce5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0ce5('0x6'));var ejs=require(_0x0ce5('0x7'));var fs=require('fs');var fs_extra=require(_0x0ce5('0x8'));var _=require(_0x0ce5('0x9'));var squel=require('squel');var crypto=require(_0x0ce5('0xa'));var jsforce=require(_0x0ce5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0ce5('0x6'));var querystring=require('querystring');var Papa=require(_0x0ce5('0xc'));var Redis=require(_0x0ce5('0xd'));var authService=require(_0x0ce5('0xe'));var qs=require(_0x0ce5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ce5('0x10'));var logger=require(_0x0ce5('0x11'))(_0x0ce5('0x12'));var utils=require(_0x0ce5('0x13'));var config=require(_0x0ce5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x529265,_0x59c22e){_0x59c22e=_0x59c22e||0xcc;return function(_0xb530fa){if(_0xb530fa){return _0x529265[_0x0ce5('0x15')](_0x59c22e);}return _0x529265[_0x0ce5('0x16')](_0x59c22e)['end']();};}function respondWithResult(_0x85bbb,_0x117fa9){_0x117fa9=_0x117fa9||0xc8;return function(_0x5f4317){if(_0x5f4317){return _0x85bbb[_0x0ce5('0x16')](_0x117fa9)['json'](_0x5f4317);}};}function respondWithFilteredResult(_0x1ece6f,_0x1dd856){return function(_0x3b5a36){if(_0x3b5a36){var _0x13ce5a=typeof _0x1dd856[_0x0ce5('0x17')]===_0x0ce5('0x18')&&typeof _0x1dd856[_0x0ce5('0x19')]===_0x0ce5('0x18');var _0x5eab29=_0x3b5a36[_0x0ce5('0x1a')];var _0x4292ce=_0x13ce5a?0x0:_0x1dd856['offset'];var _0x4f5e0b=_0x13ce5a?_0x3b5a36[_0x0ce5('0x1a')]:_0x1dd856['offset']+_0x1dd856[_0x0ce5('0x19')];var _0x477451;if(_0x4f5e0b>=_0x5eab29){_0x4f5e0b=_0x5eab29;_0x477451=0xc8;}else{_0x477451=0xce;}_0x1ece6f[_0x0ce5('0x16')](_0x477451);return _0x1ece6f[_0x0ce5('0x1b')](_0x0ce5('0x1c'),_0x4292ce+'-'+_0x4f5e0b+'/'+_0x5eab29)[_0x0ce5('0x1d')](_0x3b5a36);}return null;};}function patchUpdates(_0x57d9da){return function(_0x2cc733){try{jsonpatch[_0x0ce5('0x1e')](_0x2cc733,_0x57d9da,!![]);}catch(_0x1a1b8a){return BPromise[_0x0ce5('0x1f')](_0x1a1b8a);}return _0x2cc733['save']();};}function saveUpdates(_0x20f520,_0x4e8e46){return function(_0x16ff16){if(_0x16ff16){return _0x16ff16[_0x0ce5('0x20')](_0x20f520)[_0x0ce5('0x21')](function(_0x78be90){return _0x78be90;});}return null;};}function removeEntity(_0x334e7d,_0xbb1a2c){return function(_0x3ca9de){if(_0x3ca9de){return _0x3ca9de[_0x0ce5('0x22')]()[_0x0ce5('0x21')](function(){_0x334e7d[_0x0ce5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5392a4,_0x2332d4){return function(_0x56ef06){if(!_0x56ef06){_0x5392a4['sendStatus'](0x194);}return _0x56ef06;};}function handleError(_0x73f240,_0x564276){_0x564276=_0x564276||0x1f4;return function(_0x2c7414){logger[_0x0ce5('0x23')](_0x2c7414['stack']);if(_0x2c7414['name']){delete _0x2c7414[_0x0ce5('0x24')];}_0x73f240[_0x0ce5('0x16')](_0x564276)['send'](_0x2c7414);};}exports[_0x0ce5('0x25')]=function(_0x470fb6,_0x3d7153){var _0x54a385={},_0x55aa97={},_0x343137={'count':0x0,'rows':[]};var _0x28080b=_[_0x0ce5('0x26')](db[_0x0ce5('0x27')][_0x0ce5('0x28')],function(_0x44dabc){return{'name':_0x44dabc[_0x0ce5('0x29')],'type':_0x44dabc[_0x0ce5('0x2a')][_0x0ce5('0x2b')]};});_0x55aa97[_0x0ce5('0x2c')]=_[_0x0ce5('0x26')](_0x28080b,_0x0ce5('0x24'));_0x55aa97[_0x0ce5('0x2d')]=_[_0x0ce5('0x2e')](_0x470fb6[_0x0ce5('0x2d')]);_0x55aa97[_0x0ce5('0x2f')]=_[_0x0ce5('0x30')](_0x55aa97[_0x0ce5('0x2c')],_0x55aa97[_0x0ce5('0x2d')]);_0x54a385[_0x0ce5('0x31')]=_[_0x0ce5('0x30')](_0x55aa97[_0x0ce5('0x2c')],qs['fields'](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x32')]));_0x54a385[_0x0ce5('0x31')]=_0x54a385['attributes'][_0x0ce5('0x33')]?_0x54a385[_0x0ce5('0x31')]:_0x55aa97[_0x0ce5('0x2c')];if(!_0x470fb6[_0x0ce5('0x2d')]['hasOwnProperty'](_0x0ce5('0x34'))){_0x54a385[_0x0ce5('0x19')]=qs[_0x0ce5('0x19')](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x19')]);_0x54a385[_0x0ce5('0x17')]=qs[_0x0ce5('0x17')](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x17')]);}_0x54a385[_0x0ce5('0x35')]=qs[_0x0ce5('0x36')](_0x470fb6[_0x0ce5('0x2d')]['sort']);_0x54a385[_0x0ce5('0x37')]=qs[_0x0ce5('0x2f')](_[_0x0ce5('0x38')](_0x470fb6['query'],_0x55aa97[_0x0ce5('0x2f')]),_0x28080b);if(_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x39')]){_0x54a385[_0x0ce5('0x37')]=_['merge'](_0x54a385[_0x0ce5('0x37')],{'$or':_['map'](_0x28080b,function(_0x27cbee){if(_0x27cbee['type']!=='VIRTUAL'){var _0x3b30a4={};_0x3b30a4[_0x27cbee[_0x0ce5('0x24')]]={'$like':'%'+_0x470fb6[_0x0ce5('0x2d')]['filter']+'%'};return _0x3b30a4;}})});}_0x54a385=_[_0x0ce5('0x3a')]({},_0x54a385,_0x470fb6[_0x0ce5('0x3b')]);var _0x245ac6={'where':_0x54a385[_0x0ce5('0x37')]};return db['JscriptyAnswerReport'][_0x0ce5('0x1a')](_0x245ac6)[_0x0ce5('0x21')](function(_0x238f52){_0x343137[_0x0ce5('0x1a')]=_0x238f52;if(_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x3c')]){_0x54a385['include']=[{'all':!![]}];}return db[_0x0ce5('0x27')][_0x0ce5('0x3d')](_0x54a385);})[_0x0ce5('0x21')](function(_0x1fa06f){_0x343137[_0x0ce5('0x3e')]=_0x1fa06f;return _0x343137;})[_0x0ce5('0x21')](respondWithFilteredResult(_0x3d7153,_0x54a385))[_0x0ce5('0x3f')](handleError(_0x3d7153,null));};exports[_0x0ce5('0x40')]=function(_0xa9b36a,_0x48ebfc){var _0x5e280c={'raw':!![],'where':{'id':_0xa9b36a[_0x0ce5('0x41')]['id']}},_0x1a16b7={};_0x1a16b7['model']=_['keys'](db[_0x0ce5('0x27')][_0x0ce5('0x28')]);_0x1a16b7[_0x0ce5('0x2d')]=_[_0x0ce5('0x2e')](_0xa9b36a[_0x0ce5('0x2d')]);_0x1a16b7[_0x0ce5('0x2f')]=_[_0x0ce5('0x30')](_0x1a16b7[_0x0ce5('0x2c')],_0x1a16b7[_0x0ce5('0x2d')]);_0x5e280c[_0x0ce5('0x31')]=_['intersection'](_0x1a16b7['model'],qs['fields'](_0xa9b36a[_0x0ce5('0x2d')][_0x0ce5('0x32')]));_0x5e280c[_0x0ce5('0x31')]=_0x5e280c[_0x0ce5('0x31')][_0x0ce5('0x33')]?_0x5e280c[_0x0ce5('0x31')]:_0x1a16b7['model'];if(_0xa9b36a[_0x0ce5('0x2d')][_0x0ce5('0x3c')]){_0x5e280c[_0x0ce5('0x42')]=[{'all':!![]}];}_0x5e280c=_[_0x0ce5('0x3a')]({},_0x5e280c,_0xa9b36a['options']);return db[_0x0ce5('0x27')]['find'](_0x5e280c)['then'](handleEntityNotFound(_0x48ebfc,null))[_0x0ce5('0x21')](respondWithResult(_0x48ebfc,null))[_0x0ce5('0x3f')](handleError(_0x48ebfc,null));};exports[_0x0ce5('0x43')]=function(_0xf1fc01,_0x3a3ec5){return db[_0x0ce5('0x27')][_0x0ce5('0x43')](_0xf1fc01[_0x0ce5('0x44')],{})[_0x0ce5('0x21')](respondWithResult(_0x3a3ec5,0xc9))[_0x0ce5('0x3f')](handleError(_0x3a3ec5,null));};exports[_0x0ce5('0x20')]=function(_0x40e47c,_0x5629f4){if(_0x40e47c[_0x0ce5('0x44')]['id']){delete _0x40e47c['body']['id'];}return db[_0x0ce5('0x27')]['find']({'where':{'id':_0x40e47c['params']['id']}})['then'](handleEntityNotFound(_0x5629f4,null))[_0x0ce5('0x21')](saveUpdates(_0x40e47c['body'],null))['then'](respondWithResult(_0x5629f4,null))['catch'](handleError(_0x5629f4,null));};exports[_0x0ce5('0x22')]=function(_0x3cd81a,_0x1a9ce4){return db[_0x0ce5('0x27')]['find']({'where':{'id':_0x3cd81a['params']['id']}})[_0x0ce5('0x21')](handleEntityNotFound(_0x1a9ce4,null))[_0x0ce5('0x21')](removeEntity(_0x1a9ce4,null))[_0x0ce5('0x3f')](handleError(_0x1a9ce4,null));};exports[_0x0ce5('0x45')]=function(_0x4256e3,_0x30571c){return db[_0x0ce5('0x27')][_0x0ce5('0x45')]()[_0x0ce5('0x21')](respondWithResult(_0x30571c,null))[_0x0ce5('0x3f')](handleError(_0x30571c,null));}; \ No newline at end of file +var _0xfd87=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','JscriptyAnswerReport','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','filter','merge','where','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x521393,_0x35f474){var _0x2c7645=function(_0x28c4fd){while(--_0x28c4fd){_0x521393['push'](_0x521393['shift']());}};_0x2c7645(++_0x35f474);}(_0xfd87,0x80));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(_0x7fd8('0x2'));var jsonpatch=require(_0x7fd8('0x3'));var rp=require(_0x7fd8('0x4'));var moment=require(_0x7fd8('0x5'));var BPromise=require(_0x7fd8('0x6'));var Mustache=require(_0x7fd8('0x7'));var util=require(_0x7fd8('0x8'));var path=require(_0x7fd8('0x9'));var sox=require(_0x7fd8('0xa'));var csv=require('to-csv');var ejs=require(_0x7fd8('0xb'));var fs=require('fs');var fs_extra=require(_0x7fd8('0xc'));var _=require('lodash');var squel=require(_0x7fd8('0xd'));var crypto=require(_0x7fd8('0xe'));var jsforce=require(_0x7fd8('0xf'));var deskjs=require(_0x7fd8('0x10'));var toCsv=require(_0x7fd8('0x11'));var querystring=require('querystring');var Papa=require(_0x7fd8('0x12'));var Redis=require(_0x7fd8('0x13'));var authService=require(_0x7fd8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fd8('0x15'))('api');var utils=require(_0x7fd8('0x16'));var config=require(_0x7fd8('0x17'));var licenseUtil=require(_0x7fd8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136770,_0x2cccdb){_0x2cccdb=_0x2cccdb||0xcc;return function(_0xe84aa7){if(_0xe84aa7){return _0x136770[_0x7fd8('0x19')](_0x2cccdb);}return _0x136770[_0x7fd8('0x1a')](_0x2cccdb)['end']();};}function respondWithResult(_0x1af365,_0x17a3a1){_0x17a3a1=_0x17a3a1||0xc8;return function(_0x1d481a){if(_0x1d481a){return _0x1af365[_0x7fd8('0x1a')](_0x17a3a1)[_0x7fd8('0x1b')](_0x1d481a);}};}function respondWithFilteredResult(_0x38d45a,_0x1a4a52){return function(_0x33c8f9){if(_0x33c8f9){var _0x2a8818=typeof _0x1a4a52[_0x7fd8('0x1c')]===_0x7fd8('0x1d')&&typeof _0x1a4a52['limit']==='undefined';var _0x5ca7f6=_0x33c8f9[_0x7fd8('0x1e')];var _0xce23dc=_0x2a8818?0x0:_0x1a4a52['offset'];var _0x39e301=_0x2a8818?_0x33c8f9[_0x7fd8('0x1e')]:_0x1a4a52[_0x7fd8('0x1c')]+_0x1a4a52[_0x7fd8('0x1f')];var _0x3ab724;if(_0x39e301>=_0x5ca7f6){_0x39e301=_0x5ca7f6;_0x3ab724=0xc8;}else{_0x3ab724=0xce;}_0x38d45a[_0x7fd8('0x1a')](_0x3ab724);return _0x38d45a[_0x7fd8('0x20')](_0x7fd8('0x21'),_0xce23dc+'-'+_0x39e301+'/'+_0x5ca7f6)['json'](_0x33c8f9);}return null;};}function patchUpdates(_0x34bc09){return function(_0x3b7b49){try{jsonpatch[_0x7fd8('0x22')](_0x3b7b49,_0x34bc09,!![]);}catch(_0x13417d){return BPromise[_0x7fd8('0x23')](_0x13417d);}return _0x3b7b49[_0x7fd8('0x24')]();};}function saveUpdates(_0x4f8563,_0xecd3f3){return function(_0x1d26d4){if(_0x1d26d4){return _0x1d26d4[_0x7fd8('0x25')](_0x4f8563)[_0x7fd8('0x26')](function(_0x52b71a){return _0x52b71a;});}return null;};}function removeEntity(_0x3f71a4,_0x402fa1){return function(_0x2e7520){if(_0x2e7520){return _0x2e7520[_0x7fd8('0x27')]()[_0x7fd8('0x26')](function(){_0x3f71a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3650cb,_0x6cccad){return function(_0xa273a7){if(!_0xa273a7){_0x3650cb[_0x7fd8('0x19')](0x194);}return _0xa273a7;};}function handleError(_0x17b86a,_0x50f34f){_0x50f34f=_0x50f34f||0x1f4;return function(_0x12bc21){logger[_0x7fd8('0x28')](_0x12bc21[_0x7fd8('0x29')]);if(_0x12bc21[_0x7fd8('0x2a')]){delete _0x12bc21[_0x7fd8('0x2a')];}_0x17b86a['status'](_0x50f34f)['send'](_0x12bc21);};}exports[_0x7fd8('0x2b')]=function(_0x2bd721,_0x3919b1){var _0x4319b8={},_0x573ed0={},_0x4fc63a={'count':0x0,'rows':[]};var _0x8f9a8e=_['map'](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')],function(_0x3df0a2){return{'name':_0x3df0a2['fieldName'],'type':_0x3df0a2[_0x7fd8('0x2e')]['key']};});_0x573ed0[_0x7fd8('0x2f')]=_[_0x7fd8('0x30')](_0x8f9a8e,_0x7fd8('0x2a'));_0x573ed0[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x2bd721[_0x7fd8('0x31')]);_0x573ed0[_0x7fd8('0x33')]=_['intersection'](_0x573ed0[_0x7fd8('0x2f')],_0x573ed0[_0x7fd8('0x31')]);_0x4319b8[_0x7fd8('0x34')]=_[_0x7fd8('0x35')](_0x573ed0[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x36')]));_0x4319b8['attributes']=_0x4319b8['attributes'][_0x7fd8('0x37')]?_0x4319b8[_0x7fd8('0x34')]:_0x573ed0[_0x7fd8('0x2f')];if(!_0x2bd721['query'][_0x7fd8('0x38')]('nolimit')){_0x4319b8['limit']=qs[_0x7fd8('0x1f')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1f')]);_0x4319b8[_0x7fd8('0x1c')]=qs[_0x7fd8('0x1c')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1c')]);}_0x4319b8[_0x7fd8('0x39')]=qs['sort'](_0x2bd721[_0x7fd8('0x31')]['sort']);_0x4319b8['where']=qs[_0x7fd8('0x33')](_['pick'](_0x2bd721['query'],_0x573ed0['filters']),_0x8f9a8e);if(_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]){_0x4319b8['where']=_[_0x7fd8('0x3b')](_0x4319b8[_0x7fd8('0x3c')],{'$or':_[_0x7fd8('0x30')](_0x8f9a8e,function(_0x5d8d3d){if(_0x5d8d3d['type']!=='VIRTUAL'){var _0x1cc1d5={};_0x1cc1d5[_0x5d8d3d[_0x7fd8('0x2a')]]={'$like':'%'+_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]+'%'};return _0x1cc1d5;}})});}_0x4319b8=_[_0x7fd8('0x3b')]({},_0x4319b8,_0x2bd721[_0x7fd8('0x3d')]);var _0x2b5abb={'where':_0x4319b8['where']};return db['JscriptyAnswerReport']['count'](_0x2b5abb)[_0x7fd8('0x26')](function(_0x24a0f8){_0x4fc63a[_0x7fd8('0x1e')]=_0x24a0f8;if(_0x2bd721['query'][_0x7fd8('0x3e')]){_0x4319b8[_0x7fd8('0x3f')]=[{'all':!![]}];}return db[_0x7fd8('0x2c')][_0x7fd8('0x40')](_0x4319b8);})['then'](function(_0x2f480c){_0x4fc63a[_0x7fd8('0x41')]=_0x2f480c;return _0x4fc63a;})['then'](respondWithFilteredResult(_0x3919b1,_0x4319b8))[_0x7fd8('0x42')](handleError(_0x3919b1,null));};exports['show']=function(_0x92b45f,_0x2026aa){var _0x393174={'raw':!![],'where':{'id':_0x92b45f['params']['id']}},_0xffd29a={};_0xffd29a[_0x7fd8('0x2f')]=_[_0x7fd8('0x32')](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')]);_0xffd29a[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x92b45f['query']);_0xffd29a['filters']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],_0xffd29a[_0x7fd8('0x31')]);_0x393174['attributes']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x92b45f['query'][_0x7fd8('0x36')]));_0x393174[_0x7fd8('0x34')]=_0x393174[_0x7fd8('0x34')]['length']?_0x393174[_0x7fd8('0x34')]:_0xffd29a[_0x7fd8('0x2f')];if(_0x92b45f['query'][_0x7fd8('0x3e')]){_0x393174['include']=[{'all':!![]}];}_0x393174=_[_0x7fd8('0x3b')]({},_0x393174,_0x92b45f[_0x7fd8('0x3d')]);return db[_0x7fd8('0x2c')][_0x7fd8('0x43')](_0x393174)[_0x7fd8('0x26')](handleEntityNotFound(_0x2026aa,null))[_0x7fd8('0x26')](respondWithResult(_0x2026aa,null))[_0x7fd8('0x42')](handleError(_0x2026aa,null));};exports[_0x7fd8('0x44')]=function(_0x4c2784,_0x1666e7){return db['JscriptyAnswerReport'][_0x7fd8('0x44')](_0x4c2784[_0x7fd8('0x45')],{})['then'](respondWithResult(_0x1666e7,0xc9))[_0x7fd8('0x42')](handleError(_0x1666e7,null));};exports[_0x7fd8('0x25')]=function(_0x5cbc91,_0x5e3a45){if(_0x5cbc91['body']['id']){delete _0x5cbc91[_0x7fd8('0x45')]['id'];}return db['JscriptyAnswerReport'][_0x7fd8('0x43')]({'where':{'id':_0x5cbc91[_0x7fd8('0x46')]['id']}})[_0x7fd8('0x26')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0x26')](saveUpdates(_0x5cbc91[_0x7fd8('0x45')],null))['then'](respondWithResult(_0x5e3a45,null))['catch'](handleError(_0x5e3a45,null));};exports[_0x7fd8('0x27')]=function(_0x46c230,_0x6924a2){return db[_0x7fd8('0x2c')]['find']({'where':{'id':_0x46c230[_0x7fd8('0x46')]['id']}})['then'](handleEntityNotFound(_0x6924a2,null))[_0x7fd8('0x26')](removeEntity(_0x6924a2,null))[_0x7fd8('0x42')](handleError(_0x6924a2,null));};exports[_0x7fd8('0x47')]=function(_0x1a6a03,_0x32160c){return db[_0x7fd8('0x2c')][_0x7fd8('0x47')]()[_0x7fd8('0x26')](respondWithResult(_0x32160c,null))[_0x7fd8('0x42')](handleError(_0x32160c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 22e2b21..66d49c7 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 _0x8be6=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8be6,0xf7));var _0x68be=function(_0x593763,_0x4234f7){_0x593763=_0x593763-0x0;var _0x1d08c9=_0x8be6[_0x593763];return _0x1d08c9;};'use strict';var _=require(_0x68be('0x0'));var util=require(_0x68be('0x1'));var logger=require(_0x68be('0x2'))(_0x68be('0x3'));var moment=require(_0x68be('0x4'));var BPromise=require(_0x68be('0x5'));var rp=require(_0x68be('0x6'));var fs=require('fs');var path=require(_0x68be('0x7'));var rimraf=require(_0x68be('0x8'));var config=require(_0x68be('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x68be('0xa')]=function(_0x3fba89,_0x107770){return _0x3fba89[_0x68be('0xb')](_0x68be('0xc'),attributes,{'tableName':_0x68be('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe872=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyAnswerReport','util'];(function(_0x5d09d2,_0x7af67f){var _0x64493b=function(_0x2f8454){while(--_0x2f8454){_0x5d09d2['push'](_0x5d09d2['shift']());}};_0x64493b(++_0x7af67f);}(_0xe872,0x16a));var _0x2e87=function(_0x4dc010,_0x28bfdd){_0x4dc010=_0x4dc010-0x0;var _0x8f2564=_0xe872[_0x4dc010];return _0x8f2564;};'use strict';var _=require('lodash');var util=require(_0x2e87('0x0'));var logger=require(_0x2e87('0x1'))(_0x2e87('0x2'));var moment=require(_0x2e87('0x3'));var BPromise=require(_0x2e87('0x4'));var rp=require(_0x2e87('0x5'));var fs=require('fs');var path=require(_0x2e87('0x6'));var rimraf=require(_0x2e87('0x7'));var config=require(_0x2e87('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x2e87('0x9')]=function(_0x17b820,_0x1e9688){return _0x17b820['define'](_0x2e87('0xa'),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 88ec982..f8ad791 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 _0x40ae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','util','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x40ae,0x173));var _0xe40a=function(_0x4edccc,_0x15310d){_0x4edccc=_0x4edccc-0x0;var _0xb09b77=_0x40ae[_0x4edccc];return _0xb09b77;};'use strict';var _=require('lodash');var util=require(_0xe40a('0x0'));var moment=require('moment');var BPromise=require(_0xe40a('0x1'));var rs=require(_0xe40a('0x2'));var fs=require('fs');var Redis=require(_0xe40a('0x3'));var db=require(_0xe40a('0x4'))['db'];var utils=require(_0xe40a('0x5'));var logger=require(_0xe40a('0x6'))(_0xe40a('0x7'));var config=require(_0xe40a('0x8'));var jayson=require(_0xe40a('0x9'));var client=jayson[_0xe40a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13bc41,_0x55aae5,_0x24418d){return new BPromise(function(_0x344196,_0x40122f){return client[_0xe40a('0xb')](_0x13bc41,_0x24418d)[_0xe40a('0xc')](function(_0x3a0cc0){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x55aae5,'request\x20sent');logger['debug'](_0xe40a('0xd'),_0x55aae5,_0xe40a('0xe'),JSON[_0xe40a('0xf')](_0x3a0cc0));if(_0x3a0cc0[_0xe40a('0x10')]){if(_0x3a0cc0[_0xe40a('0x10')][_0xe40a('0x11')]===0x1f4){logger[_0xe40a('0x10')](_0xe40a('0x12'),_0x55aae5,_0x3a0cc0['error'][_0xe40a('0x13')]);return _0x40122f(_0x3a0cc0[_0xe40a('0x10')]['message']);}logger[_0xe40a('0x10')](_0xe40a('0x12'),_0x55aae5,_0x3a0cc0[_0xe40a('0x10')][_0xe40a('0x13')]);return _0x344196(_0x3a0cc0[_0xe40a('0x10')][_0xe40a('0x13')]);}else{logger[_0xe40a('0x14')](_0xe40a('0x12'),_0x55aae5,_0xe40a('0xe'));_0x344196(_0x3a0cc0[_0xe40a('0x15')][_0xe40a('0x13')]);}})['catch'](function(_0x7977f6){logger[_0xe40a('0x10')](_0xe40a('0x12'),_0x55aae5,_0x7977f6);_0x40122f(_0x7977f6);});});} \ No newline at end of file +var _0x7bda=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe4e303,_0x8f9657){var _0x39021e=function(_0x134b8a){while(--_0x134b8a){_0xe4e303['push'](_0xe4e303['shift']());}};_0x39021e(++_0x8f9657);}(_0x7bda,0x170));var _0xa7bd=function(_0x5858a0,_0x3ccd2c){_0x5858a0=_0x5858a0-0x0;var _0x11e962=_0x7bda[_0x5858a0];return _0x11e962;};'use strict';var _=require(_0xa7bd('0x0'));var util=require(_0xa7bd('0x1'));var moment=require(_0xa7bd('0x2'));var BPromise=require(_0xa7bd('0x3'));var rs=require(_0xa7bd('0x4'));var fs=require('fs');var Redis=require(_0xa7bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7bd('0x6'));var logger=require(_0xa7bd('0x7'))(_0xa7bd('0x8'));var config=require(_0xa7bd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa7bd('0xa')][_0xa7bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae31d,_0x220ed1,_0xadb95c){return new BPromise(function(_0x2a3338,_0x1ab2f2){return client['request'](_0x1ae31d,_0xadb95c)[_0xa7bd('0xc')](function(_0x36dbc7){logger['info'](_0xa7bd('0xd'),_0x220ed1,_0xa7bd('0xe'));logger[_0xa7bd('0xf')](_0xa7bd('0x10'),_0x220ed1,_0xa7bd('0xe'),JSON[_0xa7bd('0x11')](_0x36dbc7));if(_0x36dbc7['error']){if(_0x36dbc7[_0xa7bd('0x12')][_0xa7bd('0x13')]===0x1f4){logger[_0xa7bd('0x12')](_0xa7bd('0xd'),_0x220ed1,_0x36dbc7['error'][_0xa7bd('0x14')]);return _0x1ab2f2(_0x36dbc7[_0xa7bd('0x12')][_0xa7bd('0x14')]);}logger['error'](_0xa7bd('0xd'),_0x220ed1,_0x36dbc7['error']['message']);return _0x2a3338(_0x36dbc7[_0xa7bd('0x12')][_0xa7bd('0x14')]);}else{logger[_0xa7bd('0x15')](_0xa7bd('0xd'),_0x220ed1,_0xa7bd('0xe'));_0x2a3338(_0x36dbc7[_0xa7bd('0x16')]['message']);}})[_0xa7bd('0x17')](function(_0x4e357c){logger[_0xa7bd('0x12')](_0xa7bd('0xd'),_0x220ed1,_0x4e357c);_0x1ab2f2(_0x4e357c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 6c9517a..40338b8 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 _0x4e0d=['30s','getSummary','post','create','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary'];(function(_0x508400,_0x5befd9){var _0x56e7f4=function(_0x340f31){while(--_0x340f31){_0x508400['push'](_0x508400['shift']());}};_0x56e7f4(++_0x5befd9);}(_0x4e0d,0x140));var _0xd4e0=function(_0x29a893,_0x2ec30d){_0x29a893=_0x29a893-0x0;var _0x10b732=_0x4e0d[_0x29a893];return _0x10b732;};'use strict';var multer=require(_0xd4e0('0x0'));var util=require('util');var path=require(_0xd4e0('0x1'));var timeout=require('connect-timeout');var express=require(_0xd4e0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd4e0('0x3'));var interaction=require(_0xd4e0('0x4'));var config=require(_0xd4e0('0x5'));var controller=require(_0xd4e0('0x6'));router[_0xd4e0('0x7')]('/',auth['isAuthenticated'](),controller[_0xd4e0('0x8')]);router[_0xd4e0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd4e0('0x9')]);router[_0xd4e0('0x7')](_0xd4e0('0xa'),auth[_0xd4e0('0xb')](),controller[_0xd4e0('0xc')]);router[_0xd4e0('0x7')](_0xd4e0('0xd'),auth[_0xd4e0('0xb')](),controller[_0xd4e0('0xe')]);router['get'](_0xd4e0('0xf'),auth[_0xd4e0('0xb')](),timeout(_0xd4e0('0x10')),controller[_0xd4e0('0x11')]);router[_0xd4e0('0x12')]('/',auth[_0xd4e0('0xb')](),controller[_0xd4e0('0x13')]);router['post'](_0xd4e0('0x14'),auth[_0xd4e0('0xb')](),controller[_0xd4e0('0x15')]);router[_0xd4e0('0x16')](_0xd4e0('0x17'),auth[_0xd4e0('0xb')](),controller[_0xd4e0('0x18')]);router[_0xd4e0('0x19')](_0xd4e0('0x17'),auth[_0xd4e0('0xb')](),controller[_0xd4e0('0x1a')]);module[_0xd4e0('0x1b')]=router; \ No newline at end of file +var _0xcd54=['/:id','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put'];(function(_0x21ae23,_0x4186a4){var _0xb46cad=function(_0x5631dd){while(--_0x5631dd){_0x21ae23['push'](_0x21ae23['shift']());}};_0xb46cad(++_0x4186a4);}(_0xcd54,0x162));var _0x4cd5=function(_0x1aaa01,_0x4c4f53){_0x1aaa01=_0x1aaa01-0x0;var _0x30112f=_0xcd54[_0x1aaa01];return _0x30112f;};'use strict';var multer=require(_0x4cd5('0x0'));var util=require('util');var path=require(_0x4cd5('0x1'));var timeout=require(_0x4cd5('0x2'));var express=require('express');var router=express[_0x4cd5('0x3')]();var fs_extra=require(_0x4cd5('0x4'));var auth=require(_0x4cd5('0x5'));var interaction=require(_0x4cd5('0x6'));var config=require(_0x4cd5('0x7'));var controller=require(_0x4cd5('0x8'));router[_0x4cd5('0x9')]('/',auth[_0x4cd5('0xa')](),controller[_0x4cd5('0xb')]);router['get']('/:id',auth[_0x4cd5('0xa')](),controller[_0x4cd5('0xc')]);router[_0x4cd5('0x9')](_0x4cd5('0xd'),auth[_0x4cd5('0xa')](),controller[_0x4cd5('0xe')]);router[_0x4cd5('0x9')](_0x4cd5('0xf'),auth[_0x4cd5('0xa')](),controller[_0x4cd5('0x10')]);router[_0x4cd5('0x9')](_0x4cd5('0x11'),auth['isAuthenticated'](),timeout(_0x4cd5('0x12')),controller[_0x4cd5('0x13')]);router[_0x4cd5('0x14')]('/',auth[_0x4cd5('0xa')](),controller['create']);router['post'](_0x4cd5('0x15'),auth[_0x4cd5('0xa')](),controller[_0x4cd5('0x16')]);router[_0x4cd5('0x17')](_0x4cd5('0x18'),auth[_0x4cd5('0xa')](),controller[_0x4cd5('0x19')]);router['delete'](_0x4cd5('0x18'),auth[_0x4cd5('0xa')](),controller['destroy']);module[_0x4cd5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 2dfe972..0e5b7bf 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 _0x2cfe=['name','long','isObjectLike','setDataValue','formData','stringify','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2cfe,0x99));var _0xe2cf=function(_0x157d45,_0x1ee465){_0x157d45=_0x157d45-0x0;var _0x1222b1=_0x2cfe[_0x157d45];return _0x1222b1;};'use strict';var Sequelize=require(_0xe2cf('0x0'));var _=require('lodash');var util=require('util');module[_0xe2cf('0x1')]={'name':{'type':Sequelize[_0xe2cf('0x2')],'unique':_0xe2cf('0x3')},'description':{'type':Sequelize[_0xe2cf('0x2')]},'formData':{'type':Sequelize['TEXT'](_0xe2cf('0x4')),'set':function(_0x420817){if(_[_0xe2cf('0x5')](_0x420817)){this[_0xe2cf('0x6')](_0xe2cf('0x7'),JSON[_0xe2cf('0x8')](_0x420817));}else if(_['isString'](_0x420817)){this['setDataValue'](_0xe2cf('0x7'),_0x420817);}else{this['setDataValue'](_0xe2cf('0x7'),util['format'](_0xe2cf('0x9'),this[_0xe2cf('0xa')](_0xe2cf('0x3'))||'',this[_0xe2cf('0xa')](_0xe2cf('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe2cf('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe2cf('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xb4d9=['TEXT','long','isObjectLike','setDataValue','stringify','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','name'];(function(_0x5609a2,_0x42e391){var _0x5c38e1=function(_0x4b3100){while(--_0x4b3100){_0x5609a2['push'](_0x5609a2['shift']());}};_0x5c38e1(++_0x42e391);}(_0xb4d9,0x1eb));var _0x9b4d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb4d9[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x9b4d('0x0'));var _=require(_0x9b4d('0x1'));var util=require('util');module[_0x9b4d('0x2')]={'name':{'type':Sequelize[_0x9b4d('0x3')],'unique':_0x9b4d('0x4')},'description':{'type':Sequelize[_0x9b4d('0x3')]},'formData':{'type':Sequelize[_0x9b4d('0x5')](_0x9b4d('0x6')),'set':function(_0x43efa4){if(_[_0x9b4d('0x7')](_0x43efa4)){this[_0x9b4d('0x8')]('formData',JSON[_0x9b4d('0x9')](_0x43efa4));}else if(_['isString'](_0x43efa4)){this['setDataValue'](_0x9b4d('0xa'),_0x43efa4);}else{this[_0x9b4d('0x8')](_0x9b4d('0xa'),util[_0x9b4d('0xb')](_0x9b4d('0xc'),this[_0x9b4d('0xd')](_0x9b4d('0x4'))||'',this[_0x9b4d('0xd')](_0x9b4d('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9b4d('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index cd9ce71..7026f9c 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 _0x9e2a=['Content-type','text/csv','download','eml-format','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','index','map','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','JscriptyProject','includeAll','include','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','nolimit','getAnswers','JscriptyAnswerReport','ProjectId','findAll','number','fromCharCode','apply','indexOf','toString','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition'];(function(_0x14f689,_0x1d36b4){var _0x817a7d=function(_0x2eddc3){while(--_0x2eddc3){_0x14f689['push'](_0x14f689['shift']());}};_0x817a7d(++_0x1d36b4);}(_0x9e2a,0xe1));var _0xa9e2=function(_0x2a93b1,_0x3563d9){_0x2a93b1=_0x2a93b1-0x0;var _0xfb1537=_0x9e2a[_0x2a93b1];return _0xfb1537;};'use strict';var emlformat=require(_0xa9e2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa9e2('0x1'));var BPromise=require(_0xa9e2('0x2'));var Mustache=require(_0xa9e2('0x3'));var util=require(_0xa9e2('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9e2('0x5'));var fs=require('fs');var fs_extra=require(_0xa9e2('0x6'));var _=require(_0xa9e2('0x7'));var squel=require(_0xa9e2('0x8'));var crypto=require(_0xa9e2('0x9'));var jsforce=require(_0xa9e2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa9e2('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9e2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa9e2('0xd'));var as=require(_0xa9e2('0xe'));var hardwareService=require(_0xa9e2('0xf'));var logger=require('../../config/logger')(_0xa9e2('0x10'));var utils=require(_0xa9e2('0x11'));var config=require(_0xa9e2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9e2('0x13'))['db'];function respondWithStatusCode(_0x220e81,_0x25ad16){_0x25ad16=_0x25ad16||0xcc;return function(_0x26774f){if(_0x26774f){return _0x220e81[_0xa9e2('0x14')](_0x25ad16);}return _0x220e81[_0xa9e2('0x15')](_0x25ad16)[_0xa9e2('0x16')]();};}function respondWithResult(_0x46534e,_0x3344b4){_0x3344b4=_0x3344b4||0xc8;return function(_0x38783f){if(_0x38783f){return _0x46534e['status'](_0x3344b4)[_0xa9e2('0x17')](_0x38783f);}};}function respondWithFilteredResult(_0x4aed84,_0x4a26f3){return function(_0x29b289){if(_0x29b289){var _0x5ea885=typeof _0x4a26f3['offset']===_0xa9e2('0x18')&&typeof _0x4a26f3[_0xa9e2('0x19')]===_0xa9e2('0x18');var _0x1ecb9d=_0x29b289[_0xa9e2('0x1a')];var _0x12229e=_0x5ea885?0x0:_0x4a26f3['offset'];var _0x31c91a=_0x5ea885?_0x29b289[_0xa9e2('0x1a')]:_0x4a26f3[_0xa9e2('0x1b')]+_0x4a26f3['limit'];var _0x3b118c;if(_0x31c91a>=_0x1ecb9d){_0x31c91a=_0x1ecb9d;_0x3b118c=0xc8;}else{_0x3b118c=0xce;}_0x4aed84['status'](_0x3b118c);return _0x4aed84[_0xa9e2('0x1c')]('Content-Range',_0x12229e+'-'+_0x31c91a+'/'+_0x1ecb9d)[_0xa9e2('0x17')](_0x29b289);}return null;};}function patchUpdates(_0xa56a64){return function(_0x4fc7d6){try{jsonpatch['apply'](_0x4fc7d6,_0xa56a64,!![]);}catch(_0x4eb902){return BPromise['reject'](_0x4eb902);}return _0x4fc7d6[_0xa9e2('0x1d')]();};}function saveUpdates(_0x3d5681,_0x2c15d5){return function(_0x5c6d96){if(_0x5c6d96){return _0x5c6d96[_0xa9e2('0x1e')](_0x3d5681)[_0xa9e2('0x1f')](function(_0x15e86d){return _0x15e86d;});}return null;};}function removeEntity(_0x1e2b5a,_0x5a90ff){return function(_0x483fbd){if(_0x483fbd){return _0x483fbd['destroy']()['then'](function(){var _0x4ad6c2=_0x483fbd[_0xa9e2('0x20')]({'plain':!![]});var _0x2cd269=_0xa9e2('0x21');return db[_0xa9e2('0x22')][_0xa9e2('0x23')]({'where':{'type':_0x2cd269,'resourceId':_0x4ad6c2['id']}})[_0xa9e2('0x1f')](function(){return _0x483fbd;});})[_0xa9e2('0x1f')](function(){_0x1e2b5a['status'](0xcc)[_0xa9e2('0x16')]();});}};}function handleEntityNotFound(_0x196e12,_0x448c15){return function(_0x279c89){if(!_0x279c89){_0x196e12['sendStatus'](0x194);}return _0x279c89;};}function handleError(_0x298eb3,_0x4d153a){_0x4d153a=_0x4d153a||0x1f4;return function(_0x43bc3b){logger[_0xa9e2('0x24')](_0x43bc3b[_0xa9e2('0x25')]);if(_0x43bc3b[_0xa9e2('0x26')]){delete _0x43bc3b[_0xa9e2('0x26')];}_0x298eb3[_0xa9e2('0x15')](_0x4d153a)['send'](_0x43bc3b);};}exports[_0xa9e2('0x27')]=function(_0xa6dea3,_0xea82f2){var _0x1c18f1={},_0x3f4777={},_0x4aa6e3={'count':0x0,'rows':[]};var _0x1a3bdb=_[_0xa9e2('0x28')](db['JscriptyProject']['rawAttributes'],function(_0x2c3694){return{'name':_0x2c3694['fieldName'],'type':_0x2c3694[_0xa9e2('0x29')][_0xa9e2('0x2a')]};});_0x3f4777[_0xa9e2('0x2b')]=_[_0xa9e2('0x28')](_0x1a3bdb,_0xa9e2('0x26'));_0x3f4777[_0xa9e2('0x2c')]=_['keys'](_0xa6dea3['query']);_0x3f4777[_0xa9e2('0x2d')]=_['intersection'](_0x3f4777[_0xa9e2('0x2b')],_0x3f4777[_0xa9e2('0x2c')]);_0x1c18f1[_0xa9e2('0x2e')]=_[_0xa9e2('0x2f')](_0x3f4777[_0xa9e2('0x2b')],qs['fields'](_0xa6dea3['query'][_0xa9e2('0x30')]));_0x1c18f1[_0xa9e2('0x2e')]=_0x1c18f1[_0xa9e2('0x2e')][_0xa9e2('0x31')]?_0x1c18f1['attributes']:_0x3f4777[_0xa9e2('0x2b')];if(!_0xa6dea3[_0xa9e2('0x2c')][_0xa9e2('0x32')]('nolimit')){_0x1c18f1[_0xa9e2('0x19')]=qs['limit'](_0xa6dea3['query'][_0xa9e2('0x19')]);_0x1c18f1['offset']=qs[_0xa9e2('0x1b')](_0xa6dea3[_0xa9e2('0x2c')][_0xa9e2('0x1b')]);}_0x1c18f1[_0xa9e2('0x33')]=qs[_0xa9e2('0x34')](_0xa6dea3['query'][_0xa9e2('0x34')]);_0x1c18f1[_0xa9e2('0x35')]=qs[_0xa9e2('0x2d')](_['pick'](_0xa6dea3[_0xa9e2('0x2c')],_0x3f4777[_0xa9e2('0x2d')]),_0x1a3bdb);if(_0xa6dea3['query'][_0xa9e2('0x36')]){_0x1c18f1[_0xa9e2('0x35')]=_[_0xa9e2('0x37')](_0x1c18f1[_0xa9e2('0x35')],{'$or':_[_0xa9e2('0x28')](_0x1a3bdb,function(_0x46a644){if(_0x46a644['type']!=='VIRTUAL'){var _0x1e0ed6={};_0x1e0ed6[_0x46a644['name']]={'$like':'%'+_0xa6dea3[_0xa9e2('0x2c')][_0xa9e2('0x36')]+'%'};return _0x1e0ed6;}})});}_0x1c18f1=_[_0xa9e2('0x37')]({},_0x1c18f1,_0xa6dea3[_0xa9e2('0x38')]);var _0x354aa3={'where':_0x1c18f1[_0xa9e2('0x35')]};return db[_0xa9e2('0x39')][_0xa9e2('0x1a')](_0x354aa3)[_0xa9e2('0x1f')](function(_0x10c43b){_0x4aa6e3[_0xa9e2('0x1a')]=_0x10c43b;if(_0xa6dea3[_0xa9e2('0x2c')][_0xa9e2('0x3a')]){_0x1c18f1[_0xa9e2('0x3b')]=[{'all':!![]}];}return db[_0xa9e2('0x39')]['findAll'](_0x1c18f1);})[_0xa9e2('0x1f')](function(_0xb67279){_0x4aa6e3[_0xa9e2('0x3c')]=_0xb67279;return _0x4aa6e3;})['then'](respondWithFilteredResult(_0xea82f2,_0x1c18f1))[_0xa9e2('0x3d')](handleError(_0xea82f2,null));};exports[_0xa9e2('0x3e')]=function(_0x594ee4,_0x380e58){var _0x20081a={'raw':![],'where':{'id':_0x594ee4[_0xa9e2('0x3f')]['id']}},_0x16ca14={};_0x16ca14[_0xa9e2('0x2b')]=_[_0xa9e2('0x40')](db['JscriptyProject']['rawAttributes']);_0x16ca14[_0xa9e2('0x2c')]=_[_0xa9e2('0x40')](_0x594ee4['query']);_0x16ca14['filters']=_['intersection'](_0x16ca14[_0xa9e2('0x2b')],_0x16ca14[_0xa9e2('0x2c')]);_0x20081a[_0xa9e2('0x2e')]=_[_0xa9e2('0x2f')](_0x16ca14[_0xa9e2('0x2b')],qs[_0xa9e2('0x30')](_0x594ee4['query'][_0xa9e2('0x30')]));_0x20081a[_0xa9e2('0x2e')]=_0x20081a[_0xa9e2('0x2e')][_0xa9e2('0x31')]?_0x20081a[_0xa9e2('0x2e')]:_0x16ca14[_0xa9e2('0x2b')];if(_0x594ee4['query'][_0xa9e2('0x3a')]){_0x20081a[_0xa9e2('0x3b')]=[{'all':!![]}];}_0x20081a=_[_0xa9e2('0x37')]({},_0x20081a,_0x594ee4[_0xa9e2('0x38')]);return db[_0xa9e2('0x39')]['find'](_0x20081a)[_0xa9e2('0x1f')](handleEntityNotFound(_0x380e58,null))[_0xa9e2('0x1f')](respondWithResult(_0x380e58,null))[_0xa9e2('0x3d')](handleError(_0x380e58,null));};exports[_0xa9e2('0x41')]=function(_0x2ba242,_0x1b6742){return db[_0xa9e2('0x39')][_0xa9e2('0x41')](_0x2ba242[_0xa9e2('0x42')],{})[_0xa9e2('0x1f')](function(_0x428935){var _0x5612a5=_0x2ba242[_0xa9e2('0x43')]['get']({'plain':!![]});if(!_0x5612a5)throw new Error(_0xa9e2('0x44'));if(_0x5612a5[_0xa9e2('0x45')]===_0xa9e2('0x43')){var _0x2e2539=_0x428935[_0xa9e2('0x20')]({'plain':!![]});var _0x56bd12=_0xa9e2('0x21');return db[_0xa9e2('0x46')][_0xa9e2('0x47')]({'where':{'name':_0x56bd12,'userProfileId':_0x5612a5[_0xa9e2('0x48')]},'raw':!![]})['then'](function(_0x100a9c){if(_0x100a9c&&_0x100a9c[_0xa9e2('0x49')]===0x0){return db['UserProfileResource'][_0xa9e2('0x41')]({'name':_0x2e2539[_0xa9e2('0x26')],'resourceId':_0x2e2539['id'],'type':_0x100a9c[_0xa9e2('0x26')],'sectionId':_0x100a9c['id']},{})[_0xa9e2('0x1f')](function(){return _0x428935;});}else{return _0x428935;}})[_0xa9e2('0x3d')](function(_0x369bb2){logger[_0xa9e2('0x24')](_0xa9e2('0x4a'),_0x369bb2);throw _0x369bb2;});}return _0x428935;})[_0xa9e2('0x1f')](respondWithResult(_0x1b6742,0xc9))[_0xa9e2('0x3d')](handleError(_0x1b6742,null));};exports['clone']=function(_0x257a45,_0x365a5a){var _0x2196fe={'where':{'id':_0x257a45[_0xa9e2('0x3f')]['id']}},_0x11c6bc={};_0x11c6bc[_0xa9e2('0x2b')]=_['keys'](db[_0xa9e2('0x39')][_0xa9e2('0x4b')]);_0x2196fe['attributes']=_[_0xa9e2('0x2f')](_0x11c6bc[_0xa9e2('0x2b')],qs[_0xa9e2('0x30')](_0x257a45[_0xa9e2('0x2c')]['fields']));_0x2196fe[_0xa9e2('0x2e')]=_0x2196fe[_0xa9e2('0x2e')][_0xa9e2('0x31')]?_0x2196fe[_0xa9e2('0x2e')]:_0x11c6bc['model'];if(_0x257a45['query'][_0xa9e2('0x3a')]){_0x2196fe[_0xa9e2('0x3b')]=[{'all':!![]}];}_0x2196fe=_[_0xa9e2('0x37')]({},_0x2196fe,_0x257a45[_0xa9e2('0x38')]);return db[_0xa9e2('0x39')][_0xa9e2('0x47')](_0x2196fe)[_0xa9e2('0x1f')](handleEntityNotFound(_0x365a5a,null))['then'](function(_0xb52bde){if(_0xb52bde){var _0x532a28=_0xb52bde['get']({'plain':!![]});_0x532a28=qs[_0xa9e2('0x4c')](_0x532a28,['id',_0xa9e2('0x4d'),'updatedAt']);_0x257a45['body']=_[_0xa9e2('0x4c')](_0x257a45[_0xa9e2('0x42')],['id',_0xa9e2('0x4d'),_0xa9e2('0x4e')]);return db[_0xa9e2('0x39')][_0xa9e2('0x41')](_[_0xa9e2('0x37')](_0x532a28,_0x257a45[_0xa9e2('0x42')]),{'include':_0x257a45[_0xa9e2('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0xa9e2('0x1f')](function(_0x459927){var _0x35874c=_0x257a45[_0xa9e2('0x43')][_0xa9e2('0x20')]({'plain':!![]});if(!_0x35874c)throw new Error(_0xa9e2('0x44'));if(_0x35874c['role']===_0xa9e2('0x43')){var _0xad91eb=_0x459927[_0xa9e2('0x20')]({'plain':!![]});var _0x2f9aeb=_0xa9e2('0x21');return db[_0xa9e2('0x46')][_0xa9e2('0x47')]({'where':{'name':_0x2f9aeb,'userProfileId':_0x35874c[_0xa9e2('0x48')]},'raw':!![]})[_0xa9e2('0x1f')](function(_0x2189af){if(_0x2189af&&_0x2189af[_0xa9e2('0x49')]===0x0){return db['UserProfileResource'][_0xa9e2('0x41')]({'name':_0xad91eb[_0xa9e2('0x26')],'resourceId':_0xad91eb['id'],'type':_0x2189af[_0xa9e2('0x26')],'sectionId':_0x2189af['id']},{})[_0xa9e2('0x1f')](function(){return _0x459927;});}else{return _0x459927;}})[_0xa9e2('0x3d')](function(_0x2ad4ea){logger[_0xa9e2('0x24')](_0xa9e2('0x4a'),_0x2ad4ea);throw _0x2ad4ea;});}return _0x459927;});}})[_0xa9e2('0x1f')](respondWithResult(_0x365a5a,0xc9))['catch'](handleError(_0x365a5a,null));};exports[_0xa9e2('0x1e')]=function(_0x217687,_0x334edd){if(_0x217687[_0xa9e2('0x42')]['id']){delete _0x217687['body']['id'];}return db[_0xa9e2('0x39')][_0xa9e2('0x47')]({'where':{'id':_0x217687['params']['id']}})[_0xa9e2('0x1f')](handleEntityNotFound(_0x334edd,null))[_0xa9e2('0x1f')](saveUpdates(_0x217687[_0xa9e2('0x42')],null))[_0xa9e2('0x1f')](respondWithResult(_0x334edd,null))['catch'](handleError(_0x334edd,null));};exports['destroy']=function(_0x47cece,_0x24e261){return db[_0xa9e2('0x39')]['find']({'where':{'id':_0x47cece[_0xa9e2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24e261,null))[_0xa9e2('0x1f')](removeEntity(_0x24e261,null))[_0xa9e2('0x3d')](handleError(_0x24e261,null));};exports[_0xa9e2('0x4f')]=function(_0x1e1bf7,_0x3aa5f5,_0x3feb93){var _0x56e0f1={'raw':!![],'where':{}};var _0x46cdab={};var _0x5ee63c={'count':0x0,'rows':[]};return db[_0xa9e2('0x39')][_0xa9e2('0x50')]({'where':{'id':_0x1e1bf7[_0xa9e2('0x3f')]['id']}})[_0xa9e2('0x1f')](handleEntityNotFound(_0x3aa5f5,null))[_0xa9e2('0x1f')](function(_0x5f08c0){if(_0x5f08c0){_0x46cdab[_0xa9e2('0x2b')]=_[_0xa9e2('0x40')](db[_0xa9e2('0x51')][_0xa9e2('0x4b')]);_0x46cdab[_0xa9e2('0x2c')]=_[_0xa9e2('0x40')](_0x1e1bf7['query']);_0x46cdab['filters']=_[_0xa9e2('0x2f')](_0x46cdab[_0xa9e2('0x2b')],_0x46cdab[_0xa9e2('0x2c')]);_0x56e0f1[_0xa9e2('0x2e')]=_['intersection'](_0x46cdab[_0xa9e2('0x2b')],qs['fields'](_0x1e1bf7[_0xa9e2('0x2c')]['fields']));_0x56e0f1[_0xa9e2('0x2e')]=_0x56e0f1[_0xa9e2('0x2e')]['length']?_0x56e0f1[_0xa9e2('0x2e')]:_0x46cdab[_0xa9e2('0x2b')];if(!_0x1e1bf7[_0xa9e2('0x2c')][_0xa9e2('0x32')](_0xa9e2('0x52'))){_0x56e0f1[_0xa9e2('0x19')]=qs[_0xa9e2('0x19')](_0x1e1bf7[_0xa9e2('0x2c')][_0xa9e2('0x19')]);_0x56e0f1[_0xa9e2('0x1b')]=qs[_0xa9e2('0x1b')](_0x1e1bf7[_0xa9e2('0x2c')][_0xa9e2('0x1b')]);}_0x56e0f1[_0xa9e2('0x33')]=qs[_0xa9e2('0x34')](_0x1e1bf7[_0xa9e2('0x2c')]['sort']);_0x56e0f1[_0xa9e2('0x35')]=qs[_0xa9e2('0x2d')](_['pick'](_0x1e1bf7[_0xa9e2('0x2c')],_0x46cdab['filters']));_0x56e0f1[_0xa9e2('0x35')]['ProjectId']=_0x5f08c0['id'];if(_0x1e1bf7[_0xa9e2('0x2c')][_0xa9e2('0x36')]){_0x56e0f1[_0xa9e2('0x35')]=_['merge'](_0x56e0f1[_0xa9e2('0x35')],{'$or':_[_0xa9e2('0x28')](_0x56e0f1['attributes'],function(_0x583bb2){var _0x4b3ae6={};_0x4b3ae6[_0x583bb2]={'$like':'%'+_0x1e1bf7['query'][_0xa9e2('0x36')]+'%'};return _0x4b3ae6;})});}_0x56e0f1=_['merge']({},_0x56e0f1,_0x1e1bf7[_0xa9e2('0x38')]);return db[_0xa9e2('0x51')][_0xa9e2('0x1a')]({'where':_0x56e0f1[_0xa9e2('0x35')]})[_0xa9e2('0x1f')](function(_0x46e534){_0x5ee63c[_0xa9e2('0x1a')]=_0x46e534;if(_0x1e1bf7[_0xa9e2('0x2c')][_0xa9e2('0x3a')]){_0x56e0f1[_0xa9e2('0x3b')]=[{'all':!![]}];}return db[_0xa9e2('0x51')]['findAll'](_0x56e0f1);})[_0xa9e2('0x1f')](function(_0x41689f){_0x5ee63c['rows']=_0x41689f;return _0x5ee63c;});}})[_0xa9e2('0x1f')](respondWithFilteredResult(_0x3aa5f5,_0x56e0f1))[_0xa9e2('0x3d')](handleError(_0x3aa5f5,null));};exports[_0xa9e2('0x53')]=function(_0xc24552,_0x1dc0dc,_0x517988){var _0x1b0d14={'raw':!![],'where':{}};var _0x5ad6f0={};var _0x373e89={'count':0x0,'rows':[]};return db[_0xa9e2('0x39')][_0xa9e2('0x50')]({'where':{'id':_0xc24552['params']['id']}})[_0xa9e2('0x1f')](handleEntityNotFound(_0x1dc0dc,null))['then'](function(_0x556b65){if(_0x556b65){_0x5ad6f0['model']=_[_0xa9e2('0x40')](db[_0xa9e2('0x54')][_0xa9e2('0x4b')]);_0x5ad6f0[_0xa9e2('0x2c')]=_[_0xa9e2('0x40')](_0xc24552[_0xa9e2('0x2c')]);_0x5ad6f0['filters']=_[_0xa9e2('0x2f')](_0x5ad6f0[_0xa9e2('0x2b')],_0x5ad6f0['query']);_0x1b0d14[_0xa9e2('0x2e')]=_[_0xa9e2('0x2f')](_0x5ad6f0[_0xa9e2('0x2b')],qs[_0xa9e2('0x30')](_0xc24552[_0xa9e2('0x2c')][_0xa9e2('0x30')]));_0x1b0d14['attributes']=_0x1b0d14[_0xa9e2('0x2e')][_0xa9e2('0x31')]?_0x1b0d14['attributes']:_0x5ad6f0[_0xa9e2('0x2b')];if(!_0xc24552[_0xa9e2('0x2c')][_0xa9e2('0x32')](_0xa9e2('0x52'))){_0x1b0d14[_0xa9e2('0x19')]=qs['limit'](_0xc24552[_0xa9e2('0x2c')][_0xa9e2('0x19')]);_0x1b0d14[_0xa9e2('0x1b')]=qs[_0xa9e2('0x1b')](_0xc24552[_0xa9e2('0x2c')][_0xa9e2('0x1b')]);}_0x1b0d14[_0xa9e2('0x33')]=qs[_0xa9e2('0x34')](_0xc24552[_0xa9e2('0x2c')][_0xa9e2('0x34')]);_0x1b0d14['where']=qs[_0xa9e2('0x2d')](_['pick'](_0xc24552[_0xa9e2('0x2c')],_0x5ad6f0[_0xa9e2('0x2d')]));_0x1b0d14[_0xa9e2('0x35')][_0xa9e2('0x55')]=_0x556b65['id'];if(_0xc24552['query'][_0xa9e2('0x36')]){_0x1b0d14[_0xa9e2('0x35')]=_['merge'](_0x1b0d14[_0xa9e2('0x35')],{'$or':_[_0xa9e2('0x28')](_0x1b0d14[_0xa9e2('0x2e')],function(_0x25e876){var _0x305727={};_0x305727[_0x25e876]={'$like':'%'+_0xc24552['query'][_0xa9e2('0x36')]+'%'};return _0x305727;})});}_0x1b0d14=_[_0xa9e2('0x37')]({},_0x1b0d14,_0xc24552[_0xa9e2('0x38')]);return db['JscriptyAnswerReport'][_0xa9e2('0x1a')]({'where':_0x1b0d14[_0xa9e2('0x35')]})[_0xa9e2('0x1f')](function(_0x2939b6){_0x373e89['count']=_0x2939b6;if(_0xc24552[_0xa9e2('0x2c')][_0xa9e2('0x3a')]){_0x1b0d14[_0xa9e2('0x3b')]=[{'all':!![]}];}return db[_0xa9e2('0x54')][_0xa9e2('0x56')](_0x1b0d14);})[_0xa9e2('0x1f')](function(_0x1842ec){_0x373e89[_0xa9e2('0x3c')]=_0x1842ec;return _0x373e89;});}})[_0xa9e2('0x1f')](respondWithFilteredResult(_0x1dc0dc,_0x1b0d14))[_0xa9e2('0x3d')](handleError(_0x1dc0dc,null));};function char(_0x48ee93){return _0xa9e2('0x57')===typeof _0x48ee93?String[_0xa9e2('0x58')][_0xa9e2('0x59')](null,arguments):_0x48ee93;}function needsEncapsulation(_0x488fd7){return!!_0x488fd7&&(_0x488fd7['toString']()[_0xa9e2('0x5a')](char(0xd))>=0x0||_0x488fd7[_0xa9e2('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x488fd7[_0xa9e2('0x5b')]()[_0xa9e2('0x5a')](char(0x2c))>=0x0||_0x488fd7[_0xa9e2('0x5b')]()[_0xa9e2('0x5a')](char(0x22))>=0x0);}function encapsulate(_0x5e0a21){var _0x168690=char(0x22),_0x179c43='\x5c'+char(0x22),_0x2c5aeb=_0x5e0a21[_0xa9e2('0x5b')]()['replace'](new RegExp(_0x168690,'g'),_0x179c43);return _0x168690+_0x2c5aeb+_0x168690;}exports[_0xa9e2('0x5c')]=function(_0x557c1e,_0x1ee68f,_0x29b955){var _0x1f22d2,_0x2ad371;var _0x848c75={'where':{'ProjectId':_0x557c1e['params']['id']}};if(_0x557c1e[_0xa9e2('0x2c')][_0xa9e2('0x5d')]){_0x848c75[_0xa9e2('0x35')]['starttime']=JSON['parse'](_0x557c1e['query'][_0xa9e2('0x5d')]);}return db[_0xa9e2('0x51')][_0xa9e2('0x56')](_0x848c75)[_0xa9e2('0x1f')](handleEntityNotFound(_0x1ee68f,null))[_0xa9e2('0x1f')](function(_0x40eaf0){if(_0x40eaf0){_0x1f22d2=_0x40eaf0;return db[_0xa9e2('0x5e')][_0xa9e2('0x56')]({'where':{'SessionId':{'$in':_['map'](_0x1f22d2,'id')},'ProjectId':_0x557c1e[_0xa9e2('0x3f')]['id']},'order':_0xa9e2('0x5f')});}})[_0xa9e2('0x1f')](handleEntityNotFound(_0x1ee68f,null))[_0xa9e2('0x1f')](function(_0x386fdf){if(_0x386fdf){_0x2ad371=_0x386fdf;var _0x154aac={};for(var _0x506ee6=0x0,_0x2b8431=_0x2ad371['length'];_0x506ee6<_0x2b8431;_0x506ee6++){if(!_0x154aac[_0xa9e2('0x32')](_0x2ad371[_0x506ee6][_0xa9e2('0x60')])){_0x154aac[_0x2ad371[_0x506ee6][_0xa9e2('0x60')]]=needsEncapsulation(_0x2ad371[_0x506ee6][_0xa9e2('0x61')])?encapsulate(_0x2ad371[_0x506ee6]['question']):_0x2ad371[_0x506ee6][_0xa9e2('0x61')];}}var _0x2fe350=[],_0x167686={};for(var _0x26ba8a=0x0,_0x2510aa=_0x1f22d2['length'];_0x26ba8a<_0x2510aa;_0x26ba8a++){_0x167686={'ProjectId':_0x557c1e[_0xa9e2('0x3f')]['id'],'SessionId':_0x1f22d2[_0x26ba8a]['id'],'StartTime':moment(_0x1f22d2[_0x26ba8a][_0xa9e2('0x62')])[_0xa9e2('0x63')](_0xa9e2('0x64'))};for(var _0x3e1fb2=0x0,_0x386511=_0x2ad371[_0xa9e2('0x31')];_0x3e1fb2<_0x386511;_0x3e1fb2++){if(_0x2ad371[_0x3e1fb2][_0xa9e2('0x65')]==_0x1f22d2[_0x26ba8a]['id']&&_0x154aac[_0xa9e2('0x32')](_0x2ad371[_0x3e1fb2][_0xa9e2('0x60')])){_0x167686[_0x154aac[_0x2ad371[_0x3e1fb2][_0xa9e2('0x60')]]]=_0x2ad371[_0x3e1fb2][_0xa9e2('0x66')];}}for(var _0x8f7d88 in _0x154aac){if(!_0x167686[_0xa9e2('0x32')](_0x154aac[_0x8f7d88])){_0x167686[_0x154aac[_0x8f7d88]]=null;}}_0x2fe350[_0xa9e2('0x67')](_0x167686);}return _0x2fe350;}})[_0xa9e2('0x1f')](function(_0x268e8c){if(!_['isEmpty'](_0x268e8c)){var _0x4b3cfb=toCsv(_0x268e8c);var _0x1aed8d=Date[_0xa9e2('0x68')]();fs['writeFileSync'](util[_0xa9e2('0x63')](_0xa9e2('0x69'),_0x557c1e[_0xa9e2('0x3f')]['id'],_0x1aed8d),_0x4b3cfb);_0x1ee68f[_0xa9e2('0x6a')](_0xa9e2('0x6b'),'attachment;\x20filename='+util[_0xa9e2('0x63')]('Jscripty_Project_%d_Summary_%s.csv',_0x557c1e[_0xa9e2('0x3f')]['id'],_0x1aed8d));_0x1ee68f[_0xa9e2('0x6a')](_0xa9e2('0x6c'),_0xa9e2('0x6d'));return _0x1ee68f[_0xa9e2('0x6e')](util[_0xa9e2('0x63')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x557c1e[_0xa9e2('0x3f')]['id'],_0x1aed8d));}else{return _0x1ee68f[_0xa9e2('0x14')](0xcc);}})[_0xa9e2('0x3d')](handleError(_0x1ee68f,null));}; \ No newline at end of file +var _0xd914=['question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','Projects','UserProfileResource','name','send','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','params','merge','find','create','body','get','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getSessions','findOne','JscriptySessionReport','ProjectId','filter','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId'];(function(_0x20bc66,_0x2aef37){var _0x3c1b3c=function(_0x23c970){while(--_0x23c970){_0x20bc66['push'](_0x20bc66['shift']());}};_0x3c1b3c(++_0x2aef37);}(_0xd914,0x17f));var _0x4d91=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xd914[_0x359bbe];return _0x1b3353;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];function respondWithStatusCode(_0x1c15b7,_0x318e0c){_0x318e0c=_0x318e0c||0xcc;return function(_0x4ea591){if(_0x4ea591){return _0x1c15b7['sendStatus'](_0x318e0c);}return _0x1c15b7[_0x4d91('0x1b')](_0x318e0c)[_0x4d91('0x1c')]();};}function respondWithResult(_0xb6590d,_0x3c9fd6){_0x3c9fd6=_0x3c9fd6||0xc8;return function(_0x33fbd4){if(_0x33fbd4){return _0xb6590d[_0x4d91('0x1b')](_0x3c9fd6)[_0x4d91('0x1d')](_0x33fbd4);}};}function respondWithFilteredResult(_0x4f5aef,_0x3a8ec9){return function(_0x42631a){if(_0x42631a){var _0x1e2ef7=typeof _0x3a8ec9[_0x4d91('0x1e')]===_0x4d91('0x1f')&&typeof _0x3a8ec9['limit']===_0x4d91('0x1f');var _0xb75abf=_0x42631a[_0x4d91('0x20')];var _0x44b9a7=_0x1e2ef7?0x0:_0x3a8ec9['offset'];var _0x350e23=_0x1e2ef7?_0x42631a[_0x4d91('0x20')]:_0x3a8ec9[_0x4d91('0x1e')]+_0x3a8ec9['limit'];var _0x13ef2c;if(_0x350e23>=_0xb75abf){_0x350e23=_0xb75abf;_0x13ef2c=0xc8;}else{_0x13ef2c=0xce;}_0x4f5aef[_0x4d91('0x1b')](_0x13ef2c);return _0x4f5aef[_0x4d91('0x21')](_0x4d91('0x22'),_0x44b9a7+'-'+_0x350e23+'/'+_0xb75abf)[_0x4d91('0x1d')](_0x42631a);}return null;};}function patchUpdates(_0x40cde4){return function(_0xc1d44f){try{jsonpatch[_0x4d91('0x23')](_0xc1d44f,_0x40cde4,!![]);}catch(_0x30d911){return BPromise[_0x4d91('0x24')](_0x30d911);}return _0xc1d44f['save']();};}function saveUpdates(_0x4493da,_0x5f5236){return function(_0x57913e){if(_0x57913e){return _0x57913e[_0x4d91('0x25')](_0x4493da)[_0x4d91('0x26')](function(_0x341d18){return _0x341d18;});}return null;};}function removeEntity(_0x9cb864,_0x7d8cbf){return function(_0x12b722){if(_0x12b722){return _0x12b722[_0x4d91('0x27')]()[_0x4d91('0x26')](function(){var _0x55356b=_0x12b722['get']({'plain':!![]});var _0x1ee6b3=_0x4d91('0x28');return db[_0x4d91('0x29')][_0x4d91('0x27')]({'where':{'type':_0x1ee6b3,'resourceId':_0x55356b['id']}})[_0x4d91('0x26')](function(){return _0x12b722;});})[_0x4d91('0x26')](function(){_0x9cb864[_0x4d91('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc353,_0xda9802){return function(_0x12ac74){if(!_0x12ac74){_0x3dc353['sendStatus'](0x194);}return _0x12ac74;};}function handleError(_0x480a56,_0x299f27){_0x299f27=_0x299f27||0x1f4;return function(_0x470079){logger['error'](_0x470079['stack']);if(_0x470079[_0x4d91('0x2a')]){delete _0x470079[_0x4d91('0x2a')];}_0x480a56[_0x4d91('0x1b')](_0x299f27)[_0x4d91('0x2b')](_0x470079);};}exports['index']=function(_0x2587a1,_0x31bbf8){var _0x468e95={},_0xee7535={},_0xa63422={'count':0x0,'rows':[]};var _0x3466f3=_[_0x4d91('0x2c')](db['JscriptyProject'][_0x4d91('0x2d')],function(_0x4f44ff){return{'name':_0x4f44ff['fieldName'],'type':_0x4f44ff[_0x4d91('0x2e')][_0x4d91('0x2f')]};});_0xee7535['model']=_[_0x4d91('0x2c')](_0x3466f3,_0x4d91('0x2a'));_0xee7535[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x2587a1[_0x4d91('0x30')]);_0xee7535['filters']=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],_0xee7535[_0x4d91('0x30')]);_0x468e95[_0x4d91('0x34')]=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],qs['fields'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x35')]));_0x468e95['attributes']=_0x468e95[_0x4d91('0x34')][_0x4d91('0x36')]?_0x468e95[_0x4d91('0x34')]:_0xee7535['model'];if(!_0x2587a1[_0x4d91('0x30')][_0x4d91('0x37')](_0x4d91('0x38'))){_0x468e95[_0x4d91('0x39')]=qs['limit'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x39')]);_0x468e95[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x2587a1['query']['offset']);}_0x468e95[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0x2587a1['query'][_0x4d91('0x3b')]);_0x468e95[_0x4d91('0x3c')]=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x2587a1['query'],_0xee7535[_0x4d91('0x3d')]),_0x3466f3);if(_0x2587a1[_0x4d91('0x30')]['filter']){_0x468e95[_0x4d91('0x3c')]=_['merge'](_0x468e95[_0x4d91('0x3c')],{'$or':_['map'](_0x3466f3,function(_0x2dc892){if(_0x2dc892['type']!==_0x4d91('0x3f')){var _0x2782d2={};_0x2782d2[_0x2dc892[_0x4d91('0x2a')]]={'$like':'%'+_0x2587a1[_0x4d91('0x30')]['filter']+'%'};return _0x2782d2;}})});}_0x468e95=_['merge']({},_0x468e95,_0x2587a1[_0x4d91('0x40')]);var _0x55c8d0={'where':_0x468e95[_0x4d91('0x3c')]};return db[_0x4d91('0x41')]['count'](_0x55c8d0)[_0x4d91('0x26')](function(_0x2ae356){_0xa63422[_0x4d91('0x20')]=_0x2ae356;if(_0x2587a1[_0x4d91('0x30')][_0x4d91('0x42')]){_0x468e95[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x41')]['findAll'](_0x468e95);})[_0x4d91('0x26')](function(_0x4c70af){_0xa63422[_0x4d91('0x44')]=_0x4c70af;return _0xa63422;})[_0x4d91('0x26')](respondWithFilteredResult(_0x31bbf8,_0x468e95))[_0x4d91('0x45')](handleError(_0x31bbf8,null));};exports[_0x4d91('0x46')]=function(_0x20ec78,_0x1fc884){var _0x4b8e12={'raw':![],'where':{'id':_0x20ec78[_0x4d91('0x47')]['id']}},_0x4ffc08={};_0x4ffc08[_0x4d91('0x33')]=_['keys'](db[_0x4d91('0x41')][_0x4d91('0x2d')]);_0x4ffc08[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x20ec78[_0x4d91('0x30')]);_0x4ffc08[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x4ffc08[_0x4d91('0x33')],_0x4ffc08[_0x4d91('0x30')]);_0x4b8e12['attributes']=_['intersection'](_0x4ffc08[_0x4d91('0x33')],qs['fields'](_0x20ec78[_0x4d91('0x30')][_0x4d91('0x35')]));_0x4b8e12[_0x4d91('0x34')]=_0x4b8e12[_0x4d91('0x34')]['length']?_0x4b8e12[_0x4d91('0x34')]:_0x4ffc08['model'];if(_0x20ec78['query'][_0x4d91('0x42')]){_0x4b8e12[_0x4d91('0x43')]=[{'all':!![]}];}_0x4b8e12=_[_0x4d91('0x48')]({},_0x4b8e12,_0x20ec78[_0x4d91('0x40')]);return db[_0x4d91('0x41')][_0x4d91('0x49')](_0x4b8e12)['then'](handleEntityNotFound(_0x1fc884,null))[_0x4d91('0x26')](respondWithResult(_0x1fc884,null))[_0x4d91('0x45')](handleError(_0x1fc884,null));};exports[_0x4d91('0x4a')]=function(_0x449dd8,_0x106e5b){return db[_0x4d91('0x41')][_0x4d91('0x4a')](_0x449dd8[_0x4d91('0x4b')],{})[_0x4d91('0x26')](function(_0x145dfd){var _0x16f776=_0x449dd8['user'][_0x4d91('0x4c')]({'plain':!![]});if(!_0x16f776)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f776[_0x4d91('0x4d')]===_0x4d91('0x4e')){var _0x195e65=_0x145dfd[_0x4d91('0x4c')]({'plain':!![]});var _0x436a3d=_0x4d91('0x28');return db[_0x4d91('0x4f')][_0x4d91('0x49')]({'where':{'name':_0x436a3d,'userProfileId':_0x16f776['userProfileId']},'raw':!![]})[_0x4d91('0x26')](function(_0x43e72c){if(_0x43e72c&&_0x43e72c[_0x4d91('0x50')]===0x0){return db[_0x4d91('0x29')][_0x4d91('0x4a')]({'name':_0x195e65[_0x4d91('0x2a')],'resourceId':_0x195e65['id'],'type':_0x43e72c[_0x4d91('0x2a')],'sectionId':_0x43e72c['id']},{})['then'](function(){return _0x145dfd;});}else{return _0x145dfd;}})[_0x4d91('0x45')](function(_0x2159e4){logger[_0x4d91('0x51')](_0x4d91('0x52'),_0x2159e4);throw _0x2159e4;});}return _0x145dfd;})[_0x4d91('0x26')](respondWithResult(_0x106e5b,0xc9))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x53')]=function(_0x4138c5,_0x645923){var _0x2a59a9={'where':{'id':_0x4138c5[_0x4d91('0x47')]['id']}},_0x8339dd={};_0x8339dd[_0x4d91('0x33')]=_[_0x4d91('0x31')](db[_0x4d91('0x41')][_0x4d91('0x2d')]);_0x2a59a9[_0x4d91('0x34')]=_['intersection'](_0x8339dd['model'],qs['fields'](_0x4138c5[_0x4d91('0x30')][_0x4d91('0x35')]));_0x2a59a9[_0x4d91('0x34')]=_0x2a59a9['attributes'][_0x4d91('0x36')]?_0x2a59a9[_0x4d91('0x34')]:_0x8339dd[_0x4d91('0x33')];if(_0x4138c5['query']['includeAll']){_0x2a59a9['include']=[{'all':!![]}];}_0x2a59a9=_[_0x4d91('0x48')]({},_0x2a59a9,_0x4138c5[_0x4d91('0x40')]);return db[_0x4d91('0x41')][_0x4d91('0x49')](_0x2a59a9)[_0x4d91('0x26')](handleEntityNotFound(_0x645923,null))['then'](function(_0x332b70){if(_0x332b70){var _0x20c0f2=_0x332b70['get']({'plain':!![]});_0x20c0f2=qs['omit'](_0x20c0f2,['id',_0x4d91('0x54'),'updatedAt']);_0x4138c5[_0x4d91('0x4b')]=_[_0x4d91('0x55')](_0x4138c5[_0x4d91('0x4b')],['id','createdAt',_0x4d91('0x56')]);return db[_0x4d91('0x41')][_0x4d91('0x4a')](_[_0x4d91('0x48')](_0x20c0f2,_0x4138c5[_0x4d91('0x4b')]),{'include':_0x4138c5[_0x4d91('0x30')][_0x4d91('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x533572){var _0x5eeba8=_0x4138c5['user'][_0x4d91('0x4c')]({'plain':!![]});if(!_0x5eeba8)throw new Error(_0x4d91('0x57'));if(_0x5eeba8[_0x4d91('0x4d')]==='user'){var _0xb5dd5d=_0x533572['get']({'plain':!![]});var _0x3b08c5=_0x4d91('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x3b08c5,'userProfileId':_0x5eeba8[_0x4d91('0x58')]},'raw':!![]})[_0x4d91('0x26')](function(_0x31150f){if(_0x31150f&&_0x31150f[_0x4d91('0x50')]===0x0){return db[_0x4d91('0x29')][_0x4d91('0x4a')]({'name':_0xb5dd5d[_0x4d91('0x2a')],'resourceId':_0xb5dd5d['id'],'type':_0x31150f[_0x4d91('0x2a')],'sectionId':_0x31150f['id']},{})[_0x4d91('0x26')](function(){return _0x533572;});}else{return _0x533572;}})[_0x4d91('0x45')](function(_0x5bfb08){logger['error'](_0x4d91('0x52'),_0x5bfb08);throw _0x5bfb08;});}return _0x533572;});}})[_0x4d91('0x26')](respondWithResult(_0x645923,0xc9))[_0x4d91('0x45')](handleError(_0x645923,null));};exports[_0x4d91('0x25')]=function(_0x16ba26,_0x16d384){if(_0x16ba26[_0x4d91('0x4b')]['id']){delete _0x16ba26[_0x4d91('0x4b')]['id'];}return db[_0x4d91('0x41')]['find']({'where':{'id':_0x16ba26['params']['id']}})['then'](handleEntityNotFound(_0x16d384,null))['then'](saveUpdates(_0x16ba26[_0x4d91('0x4b')],null))[_0x4d91('0x26')](respondWithResult(_0x16d384,null))[_0x4d91('0x45')](handleError(_0x16d384,null));};exports[_0x4d91('0x27')]=function(_0x8565e3,_0x12fa2e){return db[_0x4d91('0x41')][_0x4d91('0x49')]({'where':{'id':_0x8565e3[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x12fa2e,null))[_0x4d91('0x26')](removeEntity(_0x12fa2e,null))[_0x4d91('0x45')](handleError(_0x12fa2e,null));};exports[_0x4d91('0x59')]=function(_0xef787,_0x3bc828,_0x2b7c69){var _0x1b000e={'raw':!![],'where':{}};var _0x5b3a38={};var _0x4062c6={'count':0x0,'rows':[]};return db[_0x4d91('0x41')][_0x4d91('0x5a')]({'where':{'id':_0xef787[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x3bc828,null))['then'](function(_0x402699){if(_0x402699){_0x5b3a38[_0x4d91('0x33')]=_['keys'](db[_0x4d91('0x5b')][_0x4d91('0x2d')]);_0x5b3a38[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0xef787[_0x4d91('0x30')]);_0x5b3a38['filters']=_[_0x4d91('0x32')](_0x5b3a38[_0x4d91('0x33')],_0x5b3a38['query']);_0x1b000e[_0x4d91('0x34')]=_[_0x4d91('0x32')](_0x5b3a38[_0x4d91('0x33')],qs['fields'](_0xef787[_0x4d91('0x30')][_0x4d91('0x35')]));_0x1b000e[_0x4d91('0x34')]=_0x1b000e[_0x4d91('0x34')][_0x4d91('0x36')]?_0x1b000e[_0x4d91('0x34')]:_0x5b3a38[_0x4d91('0x33')];if(!_0xef787['query'][_0x4d91('0x37')](_0x4d91('0x38'))){_0x1b000e['limit']=qs[_0x4d91('0x39')](_0xef787['query']['limit']);_0x1b000e[_0x4d91('0x1e')]=qs['offset'](_0xef787[_0x4d91('0x30')][_0x4d91('0x1e')]);}_0x1b000e[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0xef787[_0x4d91('0x30')][_0x4d91('0x3b')]);_0x1b000e[_0x4d91('0x3c')]=qs['filters'](_['pick'](_0xef787[_0x4d91('0x30')],_0x5b3a38[_0x4d91('0x3d')]));_0x1b000e[_0x4d91('0x3c')][_0x4d91('0x5c')]=_0x402699['id'];if(_0xef787[_0x4d91('0x30')]['filter']){_0x1b000e['where']=_[_0x4d91('0x48')](_0x1b000e['where'],{'$or':_['map'](_0x1b000e[_0x4d91('0x34')],function(_0x54fea8){var _0x585a8d={};_0x585a8d[_0x54fea8]={'$like':'%'+_0xef787[_0x4d91('0x30')][_0x4d91('0x5d')]+'%'};return _0x585a8d;})});}_0x1b000e=_[_0x4d91('0x48')]({},_0x1b000e,_0xef787['options']);return db['JscriptySessionReport']['count']({'where':_0x1b000e[_0x4d91('0x3c')]})[_0x4d91('0x26')](function(_0x1dfa81){_0x4062c6[_0x4d91('0x20')]=_0x1dfa81;if(_0xef787[_0x4d91('0x30')][_0x4d91('0x42')]){_0x1b000e[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x5b')][_0x4d91('0x5e')](_0x1b000e);})['then'](function(_0xb9d1ff){_0x4062c6['rows']=_0xb9d1ff;return _0x4062c6;});}})['then'](respondWithFilteredResult(_0x3bc828,_0x1b000e))[_0x4d91('0x45')](handleError(_0x3bc828,null));};exports[_0x4d91('0x5f')]=function(_0x184cbd,_0x650cfc,_0x50d313){var _0x1d3704={'raw':!![],'where':{}};var _0x12ca7e={};var _0x9475b9={'count':0x0,'rows':[]};return db[_0x4d91('0x41')][_0x4d91('0x5a')]({'where':{'id':_0x184cbd[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x650cfc,null))['then'](function(_0x28322e){if(_0x28322e){_0x12ca7e[_0x4d91('0x33')]=_[_0x4d91('0x31')](db['JscriptyAnswerReport'][_0x4d91('0x2d')]);_0x12ca7e[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x184cbd[_0x4d91('0x30')]);_0x12ca7e[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x12ca7e['model'],_0x12ca7e[_0x4d91('0x30')]);_0x1d3704['attributes']=_[_0x4d91('0x32')](_0x12ca7e['model'],qs[_0x4d91('0x35')](_0x184cbd[_0x4d91('0x30')]['fields']));_0x1d3704['attributes']=_0x1d3704['attributes'][_0x4d91('0x36')]?_0x1d3704[_0x4d91('0x34')]:_0x12ca7e[_0x4d91('0x33')];if(!_0x184cbd[_0x4d91('0x30')][_0x4d91('0x37')]('nolimit')){_0x1d3704['limit']=qs[_0x4d91('0x39')](_0x184cbd[_0x4d91('0x30')][_0x4d91('0x39')]);_0x1d3704[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x184cbd[_0x4d91('0x30')][_0x4d91('0x1e')]);}_0x1d3704['order']=qs[_0x4d91('0x3b')](_0x184cbd[_0x4d91('0x30')][_0x4d91('0x3b')]);_0x1d3704[_0x4d91('0x3c')]=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x184cbd[_0x4d91('0x30')],_0x12ca7e[_0x4d91('0x3d')]));_0x1d3704[_0x4d91('0x3c')]['ProjectId']=_0x28322e['id'];if(_0x184cbd[_0x4d91('0x30')][_0x4d91('0x5d')]){_0x1d3704[_0x4d91('0x3c')]=_[_0x4d91('0x48')](_0x1d3704[_0x4d91('0x3c')],{'$or':_[_0x4d91('0x2c')](_0x1d3704[_0x4d91('0x34')],function(_0x51a30d){var _0x19aa94={};_0x19aa94[_0x51a30d]={'$like':'%'+_0x184cbd[_0x4d91('0x30')]['filter']+'%'};return _0x19aa94;})});}_0x1d3704=_[_0x4d91('0x48')]({},_0x1d3704,_0x184cbd[_0x4d91('0x40')]);return db['JscriptyAnswerReport'][_0x4d91('0x20')]({'where':_0x1d3704[_0x4d91('0x3c')]})[_0x4d91('0x26')](function(_0x1c58f8){_0x9475b9[_0x4d91('0x20')]=_0x1c58f8;if(_0x184cbd[_0x4d91('0x30')]['includeAll']){_0x1d3704[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x60')][_0x4d91('0x5e')](_0x1d3704);})[_0x4d91('0x26')](function(_0x1a73cd){_0x9475b9['rows']=_0x1a73cd;return _0x9475b9;});}})[_0x4d91('0x26')](respondWithFilteredResult(_0x650cfc,_0x1d3704))[_0x4d91('0x45')](handleError(_0x650cfc,null));};function char(_0x3b0ab3){return _0x4d91('0x61')===typeof _0x3b0ab3?String[_0x4d91('0x62')][_0x4d91('0x23')](null,arguments):_0x3b0ab3;}function needsEncapsulation(_0x18f844){return!!_0x18f844&&(_0x18f844[_0x4d91('0x63')]()['indexOf'](char(0xd))>=0x0||_0x18f844[_0x4d91('0x63')]()[_0x4d91('0x64')](char(0xa))>=0x0||_0x18f844[_0x4d91('0x63')]()[_0x4d91('0x64')](char(0x2c))>=0x0||_0x18f844[_0x4d91('0x63')]()[_0x4d91('0x64')](char(0x22))>=0x0);}function encapsulate(_0x117437){var _0x11637a=char(0x22),_0x33b2ac='\x5c'+char(0x22),_0x5abc1d=_0x117437[_0x4d91('0x63')]()[_0x4d91('0x65')](new RegExp(_0x11637a,'g'),_0x33b2ac);return _0x11637a+_0x5abc1d+_0x11637a;}exports[_0x4d91('0x66')]=function(_0x329611,_0x509ac3,_0x5a84b6){var _0x3b46b0,_0x41f485;var _0x223dc8={'where':{'ProjectId':_0x329611[_0x4d91('0x47')]['id']}};if(_0x329611['query'][_0x4d91('0x67')]){_0x223dc8[_0x4d91('0x3c')][_0x4d91('0x68')]=JSON[_0x4d91('0x69')](_0x329611[_0x4d91('0x30')][_0x4d91('0x67')]);}return db[_0x4d91('0x5b')][_0x4d91('0x5e')](_0x223dc8)[_0x4d91('0x26')](handleEntityNotFound(_0x509ac3,null))['then'](function(_0x255206){if(_0x255206){_0x3b46b0=_0x255206;return db[_0x4d91('0x6a')][_0x4d91('0x5e')]({'where':{'SessionId':{'$in':_[_0x4d91('0x2c')](_0x3b46b0,'id')},'ProjectId':_0x329611[_0x4d91('0x47')]['id']},'order':_0x4d91('0x6b')});}})[_0x4d91('0x26')](handleEntityNotFound(_0x509ac3,null))[_0x4d91('0x26')](function(_0x1a7f5e){if(_0x1a7f5e){_0x41f485=_0x1a7f5e;var _0xa396fd={};for(var _0x3c8501=0x0,_0x17474b=_0x41f485['length'];_0x3c8501<_0x17474b;_0x3c8501++){if(!_0xa396fd[_0x4d91('0x37')](_0x41f485[_0x3c8501][_0x4d91('0x6c')])){_0xa396fd[_0x41f485[_0x3c8501][_0x4d91('0x6c')]]=needsEncapsulation(_0x41f485[_0x3c8501][_0x4d91('0x6d')])?encapsulate(_0x41f485[_0x3c8501][_0x4d91('0x6d')]):_0x41f485[_0x3c8501][_0x4d91('0x6d')];}}var _0x1197e5=[],_0x43b35f={};for(var _0xfedc8e=0x0,_0x67a52c=_0x3b46b0[_0x4d91('0x36')];_0xfedc8e<_0x67a52c;_0xfedc8e++){_0x43b35f={'ProjectId':_0x329611[_0x4d91('0x47')]['id'],'SessionId':_0x3b46b0[_0xfedc8e]['id'],'StartTime':moment(_0x3b46b0[_0xfedc8e]['starttime'])['format'](_0x4d91('0x6e'))};for(var _0x5897b2=0x0,_0x376afd=_0x41f485[_0x4d91('0x36')];_0x5897b2<_0x376afd;_0x5897b2++){if(_0x41f485[_0x5897b2][_0x4d91('0x6f')]==_0x3b46b0[_0xfedc8e]['id']&&_0xa396fd[_0x4d91('0x37')](_0x41f485[_0x5897b2][_0x4d91('0x6c')])){_0x43b35f[_0xa396fd[_0x41f485[_0x5897b2][_0x4d91('0x6c')]]]=_0x41f485[_0x5897b2]['answer'];}}for(var _0x44f8f0 in _0xa396fd){if(!_0x43b35f[_0x4d91('0x37')](_0xa396fd[_0x44f8f0])){_0x43b35f[_0xa396fd[_0x44f8f0]]=null;}}_0x1197e5[_0x4d91('0x70')](_0x43b35f);}return _0x1197e5;}})[_0x4d91('0x26')](function(_0x1419c5){if(!_[_0x4d91('0x71')](_0x1419c5)){var _0x322728=toCsv(_0x1419c5);var _0x41c88a=Date['now']();fs[_0x4d91('0x72')](util[_0x4d91('0x73')](_0x4d91('0x74'),_0x329611[_0x4d91('0x47')]['id'],_0x41c88a),_0x322728);_0x509ac3[_0x4d91('0x75')](_0x4d91('0x76'),_0x4d91('0x77')+util[_0x4d91('0x73')](_0x4d91('0x78'),_0x329611[_0x4d91('0x47')]['id'],_0x41c88a));_0x509ac3['setHeader'](_0x4d91('0x79'),_0x4d91('0x7a'));return _0x509ac3['download'](util[_0x4d91('0x73')](_0x4d91('0x74'),_0x329611[_0x4d91('0x47')]['id'],_0x41c88a));}else{return _0x509ac3['sendStatus'](0xcc);}})[_0x4d91('0x45')](handleError(_0x509ac3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 36cb291..14415de 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 _0x6dac=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x42e83b,_0x4d947b){var _0x24ea8b=function(_0x3f341a){while(--_0x3f341a){_0x42e83b['push'](_0x42e83b['shift']());}};_0x24ea8b(++_0x4d947b);}(_0x6dac,0x16e));var _0xc6da=function(_0x2d607b,_0x549c70){_0x2d607b=_0x2d607b-0x0;var _0x3008fb=_0x6dac[_0x2d607b];return _0x3008fb;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var logger=require(_0xc6da('0x2'))(_0xc6da('0x3'));var moment=require(_0xc6da('0x4'));var BPromise=require(_0xc6da('0x5'));var rp=require(_0xc6da('0x6'));var fs=require('fs');var path=require(_0xc6da('0x7'));var rimraf=require(_0xc6da('0x8'));var config=require(_0xc6da('0x9'));var attributes=require(_0xc6da('0xa'));module[_0xc6da('0xb')]=function(_0x325f49,_0x5caf49){return _0x325f49[_0xc6da('0xc')](_0xc6da('0xd'),attributes,{'tableName':_0xc6da('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61df=['api','moment','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects'];(function(_0x40cf0e,_0x16811a){var _0x1b1fed=function(_0x5e3959){while(--_0x5e3959){_0x40cf0e['push'](_0x40cf0e['shift']());}};_0x1b1fed(++_0x16811a);}(_0x61df,0xbd));var _0xf61d=function(_0x143efb,_0x1bbf1d){_0x143efb=_0x143efb-0x0;var _0x1f7db3=_0x61df[_0x143efb];return _0x1f7db3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf61d('0x0'));var moment=require(_0xf61d('0x1'));var BPromise=require('bluebird');var rp=require(_0xf61d('0x2'));var fs=require('fs');var path=require(_0xf61d('0x3'));var rimraf=require('rimraf');var config=require(_0xf61d('0x4'));var attributes=require(_0xf61d('0x5'));module[_0xf61d('0x6')]=function(_0x458eb9,_0x2d0791){return _0x458eb9[_0xf61d('0x7')]('JscriptyProject',attributes,{'tableName':_0xf61d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 994d7bc..270d576 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3fb18b,_0x4b6e5e){var _0x5f0cf9=function(_0x12b5d3){while(--_0x12b5d3){_0x3fb18b['push'](_0x3fb18b['shift']());}};_0x5f0cf9(++_0x4b6e5e);}(_0xaa88,0x137));var _0x8aa8=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0xaa88[_0x53afe9];return _0x396396;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x17ac66,_0x5e1223){var _0x11384a=function(_0x2e981b){while(--_0x2e981b){_0x17ac66['push'](_0x17ac66['shift']());}};_0x11384a(++_0x5e1223);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0xcb91[_0x2a4095];return _0x52eeab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index fc090b6..8bc0c6c 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 _0x0136=['post','put','/:id','destroy','exports','path','connect-timeout','express','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x0136,0x185));var _0x6013=function(_0x4508a0,_0x1c8db2){_0x4508a0=_0x4508a0-0x0;var _0x349edb=_0x0136[_0x4508a0];return _0x349edb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6013('0x0'));var timeout=require(_0x6013('0x1'));var express=require(_0x6013('0x2'));var router=express['Router']();var fs_extra=require(_0x6013('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6013('0x4'));var controller=require(_0x6013('0x5'));router[_0x6013('0x6')]('/',auth[_0x6013('0x7')](),controller[_0x6013('0x8')]);router[_0x6013('0x6')](_0x6013('0x9'),auth[_0x6013('0x7')](),controller[_0x6013('0xa')]);router[_0x6013('0x6')]('/:id',auth[_0x6013('0x7')](),controller['show']);router[_0x6013('0xb')]('/',auth[_0x6013('0x7')](),controller['create']);router[_0x6013('0xc')](_0x6013('0xd'),auth[_0x6013('0x7')](),controller['update']);router['delete'](_0x6013('0xd'),auth[_0x6013('0x7')](),controller[_0x6013('0xe')]);module[_0x6013('0xf')]=router; \ No newline at end of file +var _0x551d=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x4deaa8,_0x3de57a){var _0x33927b=function(_0x277400){while(--_0x277400){_0x4deaa8['push'](_0x4deaa8['shift']());}};_0x33927b(++_0x3de57a);}(_0x551d,0xde));var _0xd551=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x551d[_0x1663ae];return _0x30ffb8;};'use strict';var multer=require(_0xd551('0x0'));var util=require('util');var path=require(_0xd551('0x1'));var timeout=require(_0xd551('0x2'));var express=require(_0xd551('0x3'));var router=express[_0xd551('0x4')]();var fs_extra=require(_0xd551('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd551('0x6'));var config=require('../../config/environment');var controller=require(_0xd551('0x7'));router[_0xd551('0x8')]('/',auth[_0xd551('0x9')](),controller[_0xd551('0xa')]);router['get'](_0xd551('0xb'),auth[_0xd551('0x9')](),controller[_0xd551('0xc')]);router['get'](_0xd551('0xd'),auth[_0xd551('0x9')](),controller[_0xd551('0xe')]);router[_0xd551('0xf')]('/',auth[_0xd551('0x9')](),controller[_0xd551('0x10')]);router[_0xd551('0x11')]('/:id',auth[_0xd551('0x9')](),controller[_0xd551('0x12')]);router[_0xd551('0x13')](_0xd551('0xd'),auth[_0xd551('0x9')](),controller[_0xd551('0x14')]);module[_0xd551('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a8f4afd..ce8eead 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x7c3db2,_0x5eb06b){_0x7c3db2=_0x7c3db2-0x0;var _0x3fd8bf=_0x7a54[_0x7c3db2];return _0x3fd8bf;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x4e71ee,_0x5374f2){_0x4e71ee=_0x4e71ee-0x0;var _0x1b2c2c=_0x7a54[_0x4e71ee];return _0x1b2c2c;};'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 b4a0653..b4b489b 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 _0x3b3d=['key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName'];(function(_0x5ed45,_0x3db138){var _0x2ff437=function(_0x5a7a0e){while(--_0x5a7a0e){_0x5ed45['push'](_0x5ed45['shift']());}};_0x2ff437(++_0x3db138);}(_0x3b3d,0x141));var _0xd3b3=function(_0xdee5a5,_0x9816ed){_0xdee5a5=_0xdee5a5-0x0;var _0x2e4f6c=_0x3b3d[_0xdee5a5];return _0x2e4f6c;};'use strict';var emlformat=require(_0xd3b3('0x0'));var rimraf=require(_0xd3b3('0x1'));var zipdir=require(_0xd3b3('0x2'));var jsonpatch=require(_0xd3b3('0x3'));var rp=require(_0xd3b3('0x4'));var moment=require(_0xd3b3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd3b3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd3b3('0x7'));var csv=require(_0xd3b3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3b3('0x9'));var squel=require(_0xd3b3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd3b3('0x8'));var querystring=require('querystring');var Papa=require(_0xd3b3('0xb'));var Redis=require(_0xd3b3('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd3b3('0xd'));var as=require(_0xd3b3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3b3('0xf'))(_0xd3b3('0x10'));var utils=require(_0xd3b3('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xd3b3('0x12'));var db=require(_0xd3b3('0x13'))['db'];function respondWithStatusCode(_0x51961c,_0x40848b){_0x40848b=_0x40848b||0xcc;return function(_0x464984){if(_0x464984){return _0x51961c[_0xd3b3('0x14')](_0x40848b);}return _0x51961c[_0xd3b3('0x15')](_0x40848b)['end']();};}function respondWithResult(_0x533fa8,_0x352b98){_0x352b98=_0x352b98||0xc8;return function(_0x3a3720){if(_0x3a3720){return _0x533fa8[_0xd3b3('0x15')](_0x352b98)[_0xd3b3('0x16')](_0x3a3720);}};}function respondWithFilteredResult(_0xbce3f3,_0x1afccc){return function(_0x3fb039){if(_0x3fb039){var _0x25d2b6=typeof _0x1afccc[_0xd3b3('0x17')]===_0xd3b3('0x18')&&typeof _0x1afccc[_0xd3b3('0x19')]==='undefined';var _0x17285f=_0x3fb039[_0xd3b3('0x1a')];var _0x27b1bb=_0x25d2b6?0x0:_0x1afccc[_0xd3b3('0x17')];var _0x5b8b85=_0x25d2b6?_0x3fb039['count']:_0x1afccc['offset']+_0x1afccc[_0xd3b3('0x19')];var _0x453514;if(_0x5b8b85>=_0x17285f){_0x5b8b85=_0x17285f;_0x453514=0xc8;}else{_0x453514=0xce;}_0xbce3f3[_0xd3b3('0x15')](_0x453514);return _0xbce3f3[_0xd3b3('0x1b')](_0xd3b3('0x1c'),_0x27b1bb+'-'+_0x5b8b85+'/'+_0x17285f)[_0xd3b3('0x16')](_0x3fb039);}return null;};}function patchUpdates(_0xc8109e){return function(_0x2436dd){try{jsonpatch[_0xd3b3('0x1d')](_0x2436dd,_0xc8109e,!![]);}catch(_0x524341){return BPromise[_0xd3b3('0x1e')](_0x524341);}return _0x2436dd[_0xd3b3('0x1f')]();};}function saveUpdates(_0x87e224,_0x3a2654){return function(_0x2a2251){if(_0x2a2251){return _0x2a2251[_0xd3b3('0x20')](_0x87e224)['then'](function(_0x212553){return _0x212553;});}return null;};}function removeEntity(_0x595b9e,_0xf93d4c){return function(_0x1b491d){if(_0x1b491d){return _0x1b491d[_0xd3b3('0x21')]()[_0xd3b3('0x22')](function(){_0x595b9e[_0xd3b3('0x15')](0xcc)[_0xd3b3('0x23')]();});}};}function handleEntityNotFound(_0x1af064,_0xb782ad){return function(_0x49c899){if(!_0x49c899){_0x1af064[_0xd3b3('0x14')](0x194);}return _0x49c899;};}function handleError(_0x646a44,_0x59d182){_0x59d182=_0x59d182||0x1f4;return function(_0x3e24ac){logger[_0xd3b3('0x24')](_0x3e24ac[_0xd3b3('0x25')]);if(_0x3e24ac[_0xd3b3('0x26')]){delete _0x3e24ac[_0xd3b3('0x26')];}_0x646a44[_0xd3b3('0x15')](_0x59d182)[_0xd3b3('0x27')](_0x3e24ac);};}exports[_0xd3b3('0x28')]=function(_0x17c36e,_0x4f0689){var _0x316412={},_0x4cd6ea={},_0x316cc9={'count':0x0,'rows':[]};var _0x1f9412=_['map'](db[_0xd3b3('0x29')][_0xd3b3('0x2a')],function(_0x1a8556){return{'name':_0x1a8556[_0xd3b3('0x2b')],'type':_0x1a8556['type'][_0xd3b3('0x2c')]};});_0x4cd6ea[_0xd3b3('0x2d')]=_[_0xd3b3('0x2e')](_0x1f9412,'name');_0x4cd6ea[_0xd3b3('0x2f')]=_['keys'](_0x17c36e['query']);_0x4cd6ea['filters']=_[_0xd3b3('0x30')](_0x4cd6ea[_0xd3b3('0x2d')],_0x4cd6ea[_0xd3b3('0x2f')]);_0x316412[_0xd3b3('0x31')]=_['intersection'](_0x4cd6ea[_0xd3b3('0x2d')],qs[_0xd3b3('0x32')](_0x17c36e[_0xd3b3('0x2f')][_0xd3b3('0x32')]));_0x316412[_0xd3b3('0x31')]=_0x316412[_0xd3b3('0x31')]['length']?_0x316412[_0xd3b3('0x31')]:_0x4cd6ea[_0xd3b3('0x2d')];if(!_0x17c36e['query'][_0xd3b3('0x33')](_0xd3b3('0x34'))){_0x316412['limit']=qs['limit'](_0x17c36e[_0xd3b3('0x2f')]['limit']);_0x316412['offset']=qs[_0xd3b3('0x17')](_0x17c36e[_0xd3b3('0x2f')][_0xd3b3('0x17')]);}_0x316412[_0xd3b3('0x35')]=qs['sort'](_0x17c36e['query']['sort']);_0x316412['where']=qs[_0xd3b3('0x36')](_[_0xd3b3('0x37')](_0x17c36e['query'],_0x4cd6ea[_0xd3b3('0x36')]),_0x1f9412);if(_0x17c36e[_0xd3b3('0x2f')][_0xd3b3('0x38')]){_0x316412[_0xd3b3('0x39')]=_['merge'](_0x316412['where'],{'$or':_[_0xd3b3('0x2e')](_0x1f9412,function(_0x3d358c){if(_0x3d358c['type']!==_0xd3b3('0x3a')){var _0x1a86e9={};_0x1a86e9[_0x3d358c[_0xd3b3('0x26')]]={'$like':'%'+_0x17c36e[_0xd3b3('0x2f')][_0xd3b3('0x38')]+'%'};return _0x1a86e9;}})});}_0x316412=_[_0xd3b3('0x3b')]({},_0x316412,_0x17c36e[_0xd3b3('0x3c')]);var _0x2f6681={'where':_0x316412[_0xd3b3('0x39')]};return db[_0xd3b3('0x29')]['count'](_0x2f6681)[_0xd3b3('0x22')](function(_0x29e81b){_0x316cc9[_0xd3b3('0x1a')]=_0x29e81b;if(_0x17c36e[_0xd3b3('0x2f')][_0xd3b3('0x3d')]){_0x316412['include']=[{'all':!![]}];}return db[_0xd3b3('0x29')][_0xd3b3('0x3e')](_0x316412);})[_0xd3b3('0x22')](function(_0x4ad0ec){_0x316cc9[_0xd3b3('0x3f')]=_0x4ad0ec;return _0x316cc9;})['then'](respondWithFilteredResult(_0x4f0689,_0x316412))[_0xd3b3('0x40')](handleError(_0x4f0689,null));};exports[_0xd3b3('0x41')]=function(_0x27697a,_0x51d1e5){var _0x1b87b1={'raw':!![],'where':{'id':_0x27697a[_0xd3b3('0x42')]['id']}},_0xe4efec={};_0xe4efec[_0xd3b3('0x2d')]=_['keys'](db[_0xd3b3('0x29')][_0xd3b3('0x2a')]);_0xe4efec[_0xd3b3('0x2f')]=_[_0xd3b3('0x43')](_0x27697a[_0xd3b3('0x2f')]);_0xe4efec[_0xd3b3('0x36')]=_['intersection'](_0xe4efec['model'],_0xe4efec[_0xd3b3('0x2f')]);_0x1b87b1['attributes']=_[_0xd3b3('0x30')](_0xe4efec['model'],qs['fields'](_0x27697a['query']['fields']));_0x1b87b1[_0xd3b3('0x31')]=_0x1b87b1[_0xd3b3('0x31')][_0xd3b3('0x44')]?_0x1b87b1[_0xd3b3('0x31')]:_0xe4efec['model'];if(_0x27697a[_0xd3b3('0x2f')][_0xd3b3('0x3d')]){_0x1b87b1['include']=[{'all':!![]}];}_0x1b87b1=_[_0xd3b3('0x3b')]({},_0x1b87b1,_0x27697a['options']);return db['JscriptyQuestionReport'][_0xd3b3('0x45')](_0x1b87b1)['then'](handleEntityNotFound(_0x51d1e5,null))[_0xd3b3('0x22')](respondWithResult(_0x51d1e5,null))['catch'](handleError(_0x51d1e5,null));};exports[_0xd3b3('0x46')]=function(_0x33222a,_0x4e55bb){return db['JscriptyQuestionReport'][_0xd3b3('0x46')](_0x33222a[_0xd3b3('0x47')],{})[_0xd3b3('0x22')](respondWithResult(_0x4e55bb,0xc9))['catch'](handleError(_0x4e55bb,null));};exports[_0xd3b3('0x20')]=function(_0x58ec34,_0xe4f9dc){if(_0x58ec34['body']['id']){delete _0x58ec34[_0xd3b3('0x47')]['id'];}return db[_0xd3b3('0x29')][_0xd3b3('0x45')]({'where':{'id':_0x58ec34[_0xd3b3('0x42')]['id']}})[_0xd3b3('0x22')](handleEntityNotFound(_0xe4f9dc,null))[_0xd3b3('0x22')](saveUpdates(_0x58ec34[_0xd3b3('0x47')],null))[_0xd3b3('0x22')](respondWithResult(_0xe4f9dc,null))[_0xd3b3('0x40')](handleError(_0xe4f9dc,null));};exports[_0xd3b3('0x21')]=function(_0x5f32ef,_0x5563f0){return db[_0xd3b3('0x29')][_0xd3b3('0x45')]({'where':{'id':_0x5f32ef[_0xd3b3('0x42')]['id']}})[_0xd3b3('0x22')](handleEntityNotFound(_0x5563f0,null))[_0xd3b3('0x22')](removeEntity(_0x5563f0,null))[_0xd3b3('0x40')](handleError(_0x5563f0,null));};exports[_0xd3b3('0x48')]=function(_0x26ca69,_0x546c73){return db['JscriptyQuestionReport'][_0xd3b3('0x48')]()[_0xd3b3('0x22')](respondWithResult(_0x546c73,null))['catch'](handleError(_0x546c73,null));}; \ No newline at end of file +var _0x0535=['destroy','stack','name','JscriptyQuestionReport','rawAttributes','fieldName','type','map','keys','query','intersection','model','attributes','fields','length','nolimit','filters','filter','where','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then'];(function(_0x704110,_0x116147){var _0x412590=function(_0x3822a0){while(--_0x3822a0){_0x704110['push'](_0x704110['shift']());}};_0x412590(++_0x116147);}(_0x0535,0x179));var _0x5053=function(_0x1e91d7,_0x1639a7){_0x1e91d7=_0x1e91d7-0x0;var _0x9fa8bd=_0x0535[_0x1e91d7];return _0x9fa8bd;};'use strict';var emlformat=require(_0x5053('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5053('0x1'));var jsonpatch=require(_0x5053('0x2'));var rp=require(_0x5053('0x3'));var moment=require(_0x5053('0x4'));var BPromise=require(_0x5053('0x5'));var Mustache=require(_0x5053('0x6'));var util=require('util');var path=require(_0x5053('0x7'));var sox=require(_0x5053('0x8'));var csv=require(_0x5053('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5053('0xa'));var _=require('lodash');var squel=require(_0x5053('0xb'));var crypto=require(_0x5053('0xc'));var jsforce=require(_0x5053('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5053('0x9'));var querystring=require('querystring');var Papa=require(_0x5053('0xe'));var Redis=require(_0x5053('0xf'));var authService=require(_0x5053('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5053('0x11'));var hardwareService=require(_0x5053('0x12'));var logger=require(_0x5053('0x13'))(_0x5053('0x14'));var utils=require(_0x5053('0x15'));var config=require(_0x5053('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x392ae3,_0x3905a){_0x3905a=_0x3905a||0xcc;return function(_0xd72e8b){if(_0xd72e8b){return _0x392ae3[_0x5053('0x17')](_0x3905a);}return _0x392ae3[_0x5053('0x18')](_0x3905a)[_0x5053('0x19')]();};}function respondWithResult(_0x530bbc,_0x2630e4){_0x2630e4=_0x2630e4||0xc8;return function(_0x2303a3){if(_0x2303a3){return _0x530bbc['status'](_0x2630e4)['json'](_0x2303a3);}};}function respondWithFilteredResult(_0x2f2ad4,_0x4c7222){return function(_0x7047fe){if(_0x7047fe){var _0x275c51=typeof _0x4c7222['offset']===_0x5053('0x1a')&&typeof _0x4c7222[_0x5053('0x1b')]===_0x5053('0x1a');var _0x454368=_0x7047fe[_0x5053('0x1c')];var _0x2a91b9=_0x275c51?0x0:_0x4c7222[_0x5053('0x1d')];var _0x862e8b=_0x275c51?_0x7047fe[_0x5053('0x1c')]:_0x4c7222[_0x5053('0x1d')]+_0x4c7222[_0x5053('0x1b')];var _0x3440bf;if(_0x862e8b>=_0x454368){_0x862e8b=_0x454368;_0x3440bf=0xc8;}else{_0x3440bf=0xce;}_0x2f2ad4['status'](_0x3440bf);return _0x2f2ad4[_0x5053('0x1e')](_0x5053('0x1f'),_0x2a91b9+'-'+_0x862e8b+'/'+_0x454368)[_0x5053('0x20')](_0x7047fe);}return null;};}function patchUpdates(_0x3169ba){return function(_0x31406e){try{jsonpatch['apply'](_0x31406e,_0x3169ba,!![]);}catch(_0x262964){return BPromise[_0x5053('0x21')](_0x262964);}return _0x31406e[_0x5053('0x22')]();};}function saveUpdates(_0x1a0ce0,_0x36fb0a){return function(_0x5493b7){if(_0x5493b7){return _0x5493b7[_0x5053('0x23')](_0x1a0ce0)[_0x5053('0x24')](function(_0x4d233d){return _0x4d233d;});}return null;};}function removeEntity(_0x46a9a2,_0x28902a){return function(_0xebffdb){if(_0xebffdb){return _0xebffdb[_0x5053('0x25')]()['then'](function(){_0x46a9a2[_0x5053('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8a6e5,_0x22871a){return function(_0x1f45bc){if(!_0x1f45bc){_0xf8a6e5[_0x5053('0x17')](0x194);}return _0x1f45bc;};}function handleError(_0x500346,_0x38e862){_0x38e862=_0x38e862||0x1f4;return function(_0x219962){logger['error'](_0x219962[_0x5053('0x26')]);if(_0x219962[_0x5053('0x27')]){delete _0x219962[_0x5053('0x27')];}_0x500346[_0x5053('0x18')](_0x38e862)['send'](_0x219962);};}exports['index']=function(_0x4fe15b,_0xb79b3f){var _0x552748={},_0x27a731={},_0x4939d1={'count':0x0,'rows':[]};var _0x1c0a1a=_['map'](db[_0x5053('0x28')][_0x5053('0x29')],function(_0x4a01b2){return{'name':_0x4a01b2[_0x5053('0x2a')],'type':_0x4a01b2[_0x5053('0x2b')]['key']};});_0x27a731['model']=_[_0x5053('0x2c')](_0x1c0a1a,_0x5053('0x27'));_0x27a731['query']=_[_0x5053('0x2d')](_0x4fe15b[_0x5053('0x2e')]);_0x27a731['filters']=_[_0x5053('0x2f')](_0x27a731[_0x5053('0x30')],_0x27a731[_0x5053('0x2e')]);_0x552748[_0x5053('0x31')]=_[_0x5053('0x2f')](_0x27a731['model'],qs[_0x5053('0x32')](_0x4fe15b[_0x5053('0x2e')][_0x5053('0x32')]));_0x552748[_0x5053('0x31')]=_0x552748['attributes'][_0x5053('0x33')]?_0x552748['attributes']:_0x27a731[_0x5053('0x30')];if(!_0x4fe15b[_0x5053('0x2e')]['hasOwnProperty'](_0x5053('0x34'))){_0x552748[_0x5053('0x1b')]=qs[_0x5053('0x1b')](_0x4fe15b['query']['limit']);_0x552748[_0x5053('0x1d')]=qs['offset'](_0x4fe15b['query'][_0x5053('0x1d')]);}_0x552748['order']=qs['sort'](_0x4fe15b[_0x5053('0x2e')]['sort']);_0x552748['where']=qs[_0x5053('0x35')](_['pick'](_0x4fe15b[_0x5053('0x2e')],_0x27a731[_0x5053('0x35')]),_0x1c0a1a);if(_0x4fe15b[_0x5053('0x2e')][_0x5053('0x36')]){_0x552748[_0x5053('0x37')]=_[_0x5053('0x38')](_0x552748['where'],{'$or':_[_0x5053('0x2c')](_0x1c0a1a,function(_0x29c630){if(_0x29c630[_0x5053('0x2b')]!=='VIRTUAL'){var _0x510a8b={};_0x510a8b[_0x29c630[_0x5053('0x27')]]={'$like':'%'+_0x4fe15b[_0x5053('0x2e')][_0x5053('0x36')]+'%'};return _0x510a8b;}})});}_0x552748=_['merge']({},_0x552748,_0x4fe15b[_0x5053('0x39')]);var _0x1deb40={'where':_0x552748['where']};return db[_0x5053('0x28')][_0x5053('0x1c')](_0x1deb40)[_0x5053('0x24')](function(_0x32d002){_0x4939d1[_0x5053('0x1c')]=_0x32d002;if(_0x4fe15b[_0x5053('0x2e')]['includeAll']){_0x552748['include']=[{'all':!![]}];}return db[_0x5053('0x28')][_0x5053('0x3a')](_0x552748);})[_0x5053('0x24')](function(_0x1e53dc){_0x4939d1[_0x5053('0x3b')]=_0x1e53dc;return _0x4939d1;})[_0x5053('0x24')](respondWithFilteredResult(_0xb79b3f,_0x552748))[_0x5053('0x3c')](handleError(_0xb79b3f,null));};exports[_0x5053('0x3d')]=function(_0x3f6e71,_0x32141e){var _0x1cc66a={'raw':!![],'where':{'id':_0x3f6e71[_0x5053('0x3e')]['id']}},_0x1fed5f={};_0x1fed5f[_0x5053('0x30')]=_[_0x5053('0x2d')](db['JscriptyQuestionReport'][_0x5053('0x29')]);_0x1fed5f[_0x5053('0x2e')]=_[_0x5053('0x2d')](_0x3f6e71['query']);_0x1fed5f['filters']=_[_0x5053('0x2f')](_0x1fed5f[_0x5053('0x30')],_0x1fed5f[_0x5053('0x2e')]);_0x1cc66a['attributes']=_[_0x5053('0x2f')](_0x1fed5f[_0x5053('0x30')],qs[_0x5053('0x32')](_0x3f6e71[_0x5053('0x2e')][_0x5053('0x32')]));_0x1cc66a[_0x5053('0x31')]=_0x1cc66a['attributes']['length']?_0x1cc66a['attributes']:_0x1fed5f[_0x5053('0x30')];if(_0x3f6e71[_0x5053('0x2e')][_0x5053('0x3f')]){_0x1cc66a[_0x5053('0x40')]=[{'all':!![]}];}_0x1cc66a=_[_0x5053('0x38')]({},_0x1cc66a,_0x3f6e71['options']);return db[_0x5053('0x28')][_0x5053('0x41')](_0x1cc66a)[_0x5053('0x24')](handleEntityNotFound(_0x32141e,null))[_0x5053('0x24')](respondWithResult(_0x32141e,null))[_0x5053('0x3c')](handleError(_0x32141e,null));};exports[_0x5053('0x42')]=function(_0x4161c9,_0x906e20){return db[_0x5053('0x28')][_0x5053('0x42')](_0x4161c9[_0x5053('0x43')],{})[_0x5053('0x24')](respondWithResult(_0x906e20,0xc9))[_0x5053('0x3c')](handleError(_0x906e20,null));};exports[_0x5053('0x23')]=function(_0x526844,_0x286b75){if(_0x526844['body']['id']){delete _0x526844['body']['id'];}return db[_0x5053('0x28')]['find']({'where':{'id':_0x526844[_0x5053('0x3e')]['id']}})[_0x5053('0x24')](handleEntityNotFound(_0x286b75,null))[_0x5053('0x24')](saveUpdates(_0x526844[_0x5053('0x43')],null))[_0x5053('0x24')](respondWithResult(_0x286b75,null))['catch'](handleError(_0x286b75,null));};exports[_0x5053('0x25')]=function(_0xc43432,_0x2a01da){return db[_0x5053('0x28')][_0x5053('0x41')]({'where':{'id':_0xc43432[_0x5053('0x3e')]['id']}})[_0x5053('0x24')](handleEntityNotFound(_0x2a01da,null))['then'](removeEntity(_0x2a01da,null))[_0x5053('0x3c')](handleError(_0x2a01da,null));};exports[_0x5053('0x44')]=function(_0x28d016,_0x2a0e5a){return db[_0x5053('0x28')][_0x5053('0x44')]()[_0x5053('0x24')](respondWithResult(_0x2a0e5a,null))[_0x5053('0x3c')](handleError(_0x2a0e5a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 951f543..8d15393 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 _0xc780=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','api'];(function(_0x3c9d55,_0x41cf6b){var _0x1811bc=function(_0x337e1e){while(--_0x337e1e){_0x3c9d55['push'](_0x3c9d55['shift']());}};_0x1811bc(++_0x41cf6b);}(_0xc780,0xbd));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c78('0x0'));var util=require(_0x0c78('0x1'));var logger=require('../../config/logger')(_0x0c78('0x2'));var moment=require(_0x0c78('0x3'));var BPromise=require(_0x0c78('0x4'));var rp=require(_0x0c78('0x5'));var fs=require('fs');var path=require(_0x0c78('0x6'));var rimraf=require(_0x0c78('0x7'));var config=require(_0x0c78('0x8'));var attributes=require(_0x0c78('0x9'));module['exports']=function(_0x7ddd7a,_0x1dc600){return _0x7ddd7a[_0x0c78('0xa')](_0x0c78('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99fd=['request-promise','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','api','bluebird'];(function(_0x4dd789,_0x2a1df2){var _0x425b63=function(_0x2c4dd8){while(--_0x2c4dd8){_0x4dd789['push'](_0x4dd789['shift']());}};_0x425b63(++_0x2a1df2);}(_0x99fd,0x127));var _0xd99f=function(_0x58c2d9,_0x5d4674){_0x58c2d9=_0x58c2d9-0x0;var _0x191d1a=_0x99fd[_0x58c2d9];return _0x191d1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd99f('0x0'));var moment=require('moment');var BPromise=require(_0xd99f('0x1'));var rp=require(_0xd99f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd99f('0x3'));var config=require('../../config/environment');var attributes=require(_0xd99f('0x4'));module[_0xd99f('0x5')]=function(_0x16116e,_0x510b32){return _0x16116e[_0xd99f('0x6')](_0xd99f('0x7'),attributes,{'tableName':_0xd99f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index d4326dc..92c2e58 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 _0xb411=['error','code','message','info','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c7443,_0x33b2d6){var _0x51a9c1=function(_0x41b878){while(--_0x41b878){_0x2c7443['push'](_0x2c7443['shift']());}};_0x51a9c1(++_0x33b2d6);}(_0xb411,0x15b));var _0x1b41=function(_0x301b19,_0x525873){_0x301b19=_0x301b19-0x0;var _0x59066c=_0xb411[_0x301b19];return _0x59066c;};'use strict';var _=require(_0x1b41('0x0'));var util=require(_0x1b41('0x1'));var moment=require(_0x1b41('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b41('0x4'))['db'];var utils=require(_0x1b41('0x5'));var logger=require('../../config/logger')(_0x1b41('0x6'));var config=require(_0x1b41('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21b07d,_0x31b12a,_0x173467){return new BPromise(function(_0xc25890,_0x3c2187){return client['request'](_0x21b07d,_0x173467)[_0x1b41('0x9')](function(_0x3cdef1){logger['info'](_0x1b41('0xa'),_0x31b12a,'request\x20sent');logger['debug'](_0x1b41('0xb'),_0x31b12a,_0x1b41('0xc'),JSON[_0x1b41('0xd')](_0x3cdef1));if(_0x3cdef1['error']){if(_0x3cdef1[_0x1b41('0xe')][_0x1b41('0xf')]===0x1f4){logger['error'](_0x1b41('0xa'),_0x31b12a,_0x3cdef1[_0x1b41('0xe')][_0x1b41('0x10')]);return _0x3c2187(_0x3cdef1[_0x1b41('0xe')][_0x1b41('0x10')]);}logger['error'](_0x1b41('0xa'),_0x31b12a,_0x3cdef1['error'][_0x1b41('0x10')]);return _0xc25890(_0x3cdef1[_0x1b41('0xe')][_0x1b41('0x10')]);}else{logger[_0x1b41('0x11')](_0x1b41('0xa'),_0x31b12a,_0x1b41('0xc'));_0xc25890(_0x3cdef1[_0x1b41('0x12')][_0x1b41('0x10')]);}})['catch'](function(_0x548622){logger[_0x1b41('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x31b12a,_0x548622);_0x3c2187(_0x548622);});});} \ No newline at end of file +var _0x577f=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info'];(function(_0x4d63d3,_0x47efa2){var _0x3422ce=function(_0x486be3){while(--_0x486be3){_0x4d63d3['push'](_0x4d63d3['shift']());}};_0x3422ce(++_0x47efa2);}(_0x577f,0x198));var _0xf577=function(_0x5846fc,_0x3ea5d0){_0x5846fc=_0x5846fc-0x0;var _0x138b5b=_0x577f[_0x5846fc];return _0x138b5b;};'use strict';var _=require(_0xf577('0x0'));var util=require(_0xf577('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf577('0x2'));var fs=require('fs');var Redis=require(_0xf577('0x3'));var db=require(_0xf577('0x4'))['db'];var utils=require(_0xf577('0x5'));var logger=require('../../config/logger')(_0xf577('0x6'));var config=require(_0xf577('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf577('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44064b,_0x30c6cd,_0x19921e){return new BPromise(function(_0x3d4a63,_0x58468c){return client[_0xf577('0x9')](_0x44064b,_0x19921e)[_0xf577('0xa')](function(_0x29d00d){logger[_0xf577('0xb')](_0xf577('0xc'),_0x30c6cd,_0xf577('0xd'));logger[_0xf577('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x30c6cd,_0xf577('0xd'),JSON['stringify'](_0x29d00d));if(_0x29d00d[_0xf577('0xf')]){if(_0x29d00d[_0xf577('0xf')][_0xf577('0x10')]===0x1f4){logger[_0xf577('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x30c6cd,_0x29d00d[_0xf577('0xf')][_0xf577('0x11')]);return _0x58468c(_0x29d00d[_0xf577('0xf')]['message']);}logger[_0xf577('0xf')](_0xf577('0xc'),_0x30c6cd,_0x29d00d['error'][_0xf577('0x11')]);return _0x3d4a63(_0x29d00d['error']['message']);}else{logger[_0xf577('0xb')](_0xf577('0xc'),_0x30c6cd,_0xf577('0xd'));_0x3d4a63(_0x29d00d[_0xf577('0x12')]['message']);}})[_0xf577('0x13')](function(_0x376819){logger[_0xf577('0xf')](_0xf577('0xc'),_0x30c6cd,_0x376819);_0x58468c(_0x376819);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7948838..62536d4 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 _0xecb0=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','create','delete','destroy'];(function(_0x2868b3,_0x5a4c8e){var _0x4a8f38=function(_0x2497f2){while(--_0x2497f2){_0x2868b3['push'](_0x2868b3['shift']());}};_0x4a8f38(++_0x5a4c8e);}(_0xecb0,0x1ce));var _0x0ecb=function(_0x179fe9,_0x38b242){_0x179fe9=_0x179fe9-0x0;var _0x4807cf=_0xecb0[_0x179fe9];return _0x4807cf;};'use strict';var multer=require('multer');var util=require(_0x0ecb('0x0'));var path=require(_0x0ecb('0x1'));var timeout=require(_0x0ecb('0x2'));var express=require('express');var router=express[_0x0ecb('0x3')]();var fs_extra=require(_0x0ecb('0x4'));var auth=require(_0x0ecb('0x5'));var interaction=require(_0x0ecb('0x6'));var config=require(_0x0ecb('0x7'));var controller=require(_0x0ecb('0x8'));router[_0x0ecb('0x9')]('/',auth[_0x0ecb('0xa')](),controller[_0x0ecb('0xb')]);router[_0x0ecb('0x9')](_0x0ecb('0xc'),auth[_0x0ecb('0xa')](),controller[_0x0ecb('0xd')]);router['get'](_0x0ecb('0xe'),auth[_0x0ecb('0xa')](),controller['show']);router[_0x0ecb('0x9')](_0x0ecb('0xf'),auth['isAuthenticated'](),controller[_0x0ecb('0x10')]);router[_0x0ecb('0x11')]('/',auth[_0x0ecb('0xa')](),controller[_0x0ecb('0x12')]);router['put'](_0x0ecb('0xe'),auth[_0x0ecb('0xa')](),controller['update']);router[_0x0ecb('0x13')]('/:id',auth[_0x0ecb('0xa')](),controller[_0x0ecb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1cbc=['destroy','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id/questions','getQuestions','post','create','put','/:id','delete'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x1cbc,0x1de));var _0xc1cb=function(_0x5ec777,_0xde237d){_0x5ec777=_0x5ec777-0x0;var _0x3846e3=_0x1cbc[_0x5ec777];return _0x3846e3;};'use strict';var multer=require('multer');var util=require(_0xc1cb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1cb('0x1')]();var fs_extra=require(_0xc1cb('0x2'));var auth=require(_0xc1cb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc1cb('0x4'));var controller=require('./jscriptySessionReport.controller');router[_0xc1cb('0x5')]('/',auth[_0xc1cb('0x6')](),controller['index']);router[_0xc1cb('0x5')]('/describe',auth[_0xc1cb('0x6')](),controller[_0xc1cb('0x7')]);router[_0xc1cb('0x5')]('/:id',auth[_0xc1cb('0x6')](),controller['show']);router[_0xc1cb('0x5')](_0xc1cb('0x8'),auth['isAuthenticated'](),controller[_0xc1cb('0x9')]);router[_0xc1cb('0xa')]('/',auth[_0xc1cb('0x6')](),controller[_0xc1cb('0xb')]);router[_0xc1cb('0xc')](_0xc1cb('0xd'),auth[_0xc1cb('0x6')](),controller['update']);router[_0xc1cb('0xe')](_0xc1cb('0xd'),auth[_0xc1cb('0x6')](),controller[_0xc1cb('0xf')]);module[_0xc1cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9b954de..01cbece 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 _0xff20=['format','STRING','BOOLEAN','DATE','setDataValue','endtime'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xff20,0x87));var _0x0ff2=function(_0x107c3a,_0x6b3209){_0x107c3a=_0x107c3a-0x0;var _0x249ed6=_0xff20[_0x107c3a];return _0x249ed6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x0ff2('0x0')],'set':function(_0x5a7374){this[_0x0ff2('0x1')]('starttime',_0x5a7374);this[_0x0ff2('0x1')](_0x0ff2('0x2'),moment()[_0x0ff2('0x3')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x0ff2('0x4')]},'queue':{'type':Sequelize[_0x0ff2('0x4')]},'uniqueid':{'type':Sequelize[_0x0ff2('0x4')]},'calleridname':{'type':Sequelize[_0x0ff2('0x4')]},'calleridnum':{'type':Sequelize[_0x0ff2('0x4')]},'completed':{'type':Sequelize[_0x0ff2('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xf2f2=['moment','exports','DATE','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0xd6d0c5,_0x146ac3){var _0x2f54bd=function(_0x3da2fd){while(--_0x3da2fd){_0xd6d0c5['push'](_0xd6d0c5['shift']());}};_0x2f54bd(++_0x146ac3);}(_0xf2f2,0x168));var _0x2f2f=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xf2f2[_0x301dab];return _0x2500a2;};'use strict';var moment=require(_0x2f2f('0x0'));var Sequelize=require('sequelize');module[_0x2f2f('0x1')]={'starttime':{'type':Sequelize[_0x2f2f('0x2')],'set':function(_0x1fda2a){this['setDataValue'](_0x2f2f('0x3'),_0x1fda2a);this[_0x2f2f('0x4')]('endtime',moment()[_0x2f2f('0x5')](_0x2f2f('0x6')));}},'endtime':{'type':Sequelize[_0x2f2f('0x2')]},'membername':{'type':Sequelize[_0x2f2f('0x7')]},'projectname':{'type':Sequelize[_0x2f2f('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2f2f('0x7')]},'calleridname':{'type':Sequelize[_0x2f2f('0x7')]},'calleridnum':{'type':Sequelize[_0x2f2f('0x7')]},'completed':{'type':Sequelize[_0x2f2f('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7d47512..cd87792 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 _0x9053=['limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','JscriptySessionReport','includeAll','include','findAll','rows','show','find','create','body','catch','update','params','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9053,0xdc));var _0x3905=function(_0x24e0c9,_0x284109){_0x24e0c9=_0x24e0c9-0x0;var _0x4448f0=_0x9053[_0x24e0c9];return _0x4448f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3905('0x0'));var zipdir=require(_0x3905('0x1'));var jsonpatch=require(_0x3905('0x2'));var rp=require(_0x3905('0x3'));var moment=require(_0x3905('0x4'));var BPromise=require(_0x3905('0x5'));var Mustache=require(_0x3905('0x6'));var util=require(_0x3905('0x7'));var path=require(_0x3905('0x8'));var sox=require(_0x3905('0x9'));var csv=require(_0x3905('0xa'));var ejs=require(_0x3905('0xb'));var fs=require('fs');var fs_extra=require(_0x3905('0xc'));var _=require(_0x3905('0xd'));var squel=require(_0x3905('0xe'));var crypto=require(_0x3905('0xf'));var jsforce=require(_0x3905('0x10'));var deskjs=require(_0x3905('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3905('0x12'));var Redis=require(_0x3905('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3905('0x14'));var as=require(_0x3905('0x15'));var hardwareService=require(_0x3905('0x16'));var logger=require(_0x3905('0x17'))(_0x3905('0x18'));var utils=require(_0x3905('0x19'));var config=require(_0x3905('0x1a'));var licenseUtil=require(_0x3905('0x1b'));var db=require(_0x3905('0x1c'))['db'];function respondWithStatusCode(_0x29d047,_0x33d0bd){_0x33d0bd=_0x33d0bd||0xcc;return function(_0x30c4a4){if(_0x30c4a4){return _0x29d047['sendStatus'](_0x33d0bd);}return _0x29d047[_0x3905('0x1d')](_0x33d0bd)['end']();};}function respondWithResult(_0x499cc4,_0x4e1c42){_0x4e1c42=_0x4e1c42||0xc8;return function(_0x1afb0e){if(_0x1afb0e){return _0x499cc4[_0x3905('0x1d')](_0x4e1c42)['json'](_0x1afb0e);}};}function respondWithFilteredResult(_0x13cdd1,_0x4f56a3){return function(_0x55cbc8){if(_0x55cbc8){var _0x512664=typeof _0x4f56a3[_0x3905('0x1e')]===_0x3905('0x1f')&&typeof _0x4f56a3[_0x3905('0x20')]===_0x3905('0x1f');var _0x5c054e=_0x55cbc8[_0x3905('0x21')];var _0x3fd82a=_0x512664?0x0:_0x4f56a3[_0x3905('0x1e')];var _0x405e58=_0x512664?_0x55cbc8[_0x3905('0x21')]:_0x4f56a3['offset']+_0x4f56a3['limit'];var _0x1d88b1;if(_0x405e58>=_0x5c054e){_0x405e58=_0x5c054e;_0x1d88b1=0xc8;}else{_0x1d88b1=0xce;}_0x13cdd1[_0x3905('0x1d')](_0x1d88b1);return _0x13cdd1[_0x3905('0x22')](_0x3905('0x23'),_0x3fd82a+'-'+_0x405e58+'/'+_0x5c054e)[_0x3905('0x24')](_0x55cbc8);}return null;};}function patchUpdates(_0x492bff){return function(_0x43217b){try{jsonpatch[_0x3905('0x25')](_0x43217b,_0x492bff,!![]);}catch(_0x36f60f){return BPromise[_0x3905('0x26')](_0x36f60f);}return _0x43217b[_0x3905('0x27')]();};}function saveUpdates(_0x4ad2f2,_0xe877b1){return function(_0x38903c){if(_0x38903c){return _0x38903c['update'](_0x4ad2f2)[_0x3905('0x28')](function(_0x49816f){return _0x49816f;});}return null;};}function removeEntity(_0x5c2cec,_0x5459c5){return function(_0x74763d){if(_0x74763d){return _0x74763d[_0x3905('0x29')]()[_0x3905('0x28')](function(){_0x5c2cec[_0x3905('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4163c9,_0x49469c){return function(_0x50b9b8){if(!_0x50b9b8){_0x4163c9[_0x3905('0x2a')](0x194);}return _0x50b9b8;};}function handleError(_0x59136d,_0x8234a5){_0x8234a5=_0x8234a5||0x1f4;return function(_0x2f2e2e){logger[_0x3905('0x2b')](_0x2f2e2e[_0x3905('0x2c')]);if(_0x2f2e2e[_0x3905('0x2d')]){delete _0x2f2e2e['name'];}_0x59136d[_0x3905('0x1d')](_0x8234a5)[_0x3905('0x2e')](_0x2f2e2e);};}exports['index']=function(_0x5f48a3,_0x42d151){var _0x1fa817={},_0x1bea2b={},_0x4de6be={'count':0x0,'rows':[]};var _0x423e71=_[_0x3905('0x2f')](db['JscriptySessionReport'][_0x3905('0x30')],function(_0x3d1c97){return{'name':_0x3d1c97['fieldName'],'type':_0x3d1c97['type']['key']};});_0x1bea2b[_0x3905('0x31')]=_[_0x3905('0x2f')](_0x423e71,'name');_0x1bea2b[_0x3905('0x32')]=_[_0x3905('0x33')](_0x5f48a3[_0x3905('0x32')]);_0x1bea2b[_0x3905('0x34')]=_[_0x3905('0x35')](_0x1bea2b['model'],_0x1bea2b['query']);_0x1fa817[_0x3905('0x36')]=_[_0x3905('0x35')](_0x1bea2b[_0x3905('0x31')],qs[_0x3905('0x37')](_0x5f48a3[_0x3905('0x32')][_0x3905('0x37')]));_0x1fa817[_0x3905('0x36')]=_0x1fa817[_0x3905('0x36')][_0x3905('0x38')]?_0x1fa817[_0x3905('0x36')]:_0x1bea2b[_0x3905('0x31')];if(!_0x5f48a3[_0x3905('0x32')][_0x3905('0x39')]('nolimit')){_0x1fa817[_0x3905('0x20')]=qs[_0x3905('0x20')](_0x5f48a3[_0x3905('0x32')][_0x3905('0x20')]);_0x1fa817[_0x3905('0x1e')]=qs[_0x3905('0x1e')](_0x5f48a3[_0x3905('0x32')][_0x3905('0x1e')]);}_0x1fa817[_0x3905('0x3a')]=qs[_0x3905('0x3b')](_0x5f48a3[_0x3905('0x32')][_0x3905('0x3b')]);_0x1fa817[_0x3905('0x3c')]=qs[_0x3905('0x34')](_[_0x3905('0x3d')](_0x5f48a3['query'],_0x1bea2b[_0x3905('0x34')]),_0x423e71);if(_0x5f48a3[_0x3905('0x32')][_0x3905('0x3e')]){_0x1fa817[_0x3905('0x3c')]=_[_0x3905('0x3f')](_0x1fa817[_0x3905('0x3c')],{'$or':_[_0x3905('0x2f')](_0x423e71,function(_0x1d8cc1){if(_0x1d8cc1[_0x3905('0x40')]!=='VIRTUAL'){var _0x5d1824={};_0x5d1824[_0x1d8cc1['name']]={'$like':'%'+_0x5f48a3[_0x3905('0x32')][_0x3905('0x3e')]+'%'};return _0x5d1824;}})});}_0x1fa817=_['merge']({},_0x1fa817,_0x5f48a3[_0x3905('0x41')]);var _0x3c02bc={'where':_0x1fa817[_0x3905('0x3c')]};return db[_0x3905('0x42')][_0x3905('0x21')](_0x3c02bc)[_0x3905('0x28')](function(_0x15040f){_0x4de6be['count']=_0x15040f;if(_0x5f48a3[_0x3905('0x32')][_0x3905('0x43')]){_0x1fa817[_0x3905('0x44')]=[{'all':!![]}];}return db[_0x3905('0x42')][_0x3905('0x45')](_0x1fa817);})[_0x3905('0x28')](function(_0xe07772){_0x4de6be[_0x3905('0x46')]=_0xe07772;return _0x4de6be;})[_0x3905('0x28')](respondWithFilteredResult(_0x42d151,_0x1fa817))['catch'](handleError(_0x42d151,null));};exports[_0x3905('0x47')]=function(_0x4d84d6,_0xcf785d){var _0x57b9f9={'raw':!![],'where':{'id':_0x4d84d6['params']['id']}},_0x6ff985={};_0x6ff985[_0x3905('0x31')]=_[_0x3905('0x33')](db[_0x3905('0x42')]['rawAttributes']);_0x6ff985[_0x3905('0x32')]=_[_0x3905('0x33')](_0x4d84d6[_0x3905('0x32')]);_0x6ff985[_0x3905('0x34')]=_[_0x3905('0x35')](_0x6ff985[_0x3905('0x31')],_0x6ff985[_0x3905('0x32')]);_0x57b9f9[_0x3905('0x36')]=_[_0x3905('0x35')](_0x6ff985[_0x3905('0x31')],qs[_0x3905('0x37')](_0x4d84d6[_0x3905('0x32')][_0x3905('0x37')]));_0x57b9f9['attributes']=_0x57b9f9[_0x3905('0x36')][_0x3905('0x38')]?_0x57b9f9['attributes']:_0x6ff985[_0x3905('0x31')];if(_0x4d84d6[_0x3905('0x32')][_0x3905('0x43')]){_0x57b9f9[_0x3905('0x44')]=[{'all':!![]}];}_0x57b9f9=_[_0x3905('0x3f')]({},_0x57b9f9,_0x4d84d6[_0x3905('0x41')]);return db[_0x3905('0x42')][_0x3905('0x48')](_0x57b9f9)['then'](handleEntityNotFound(_0xcf785d,null))[_0x3905('0x28')](respondWithResult(_0xcf785d,null))['catch'](handleError(_0xcf785d,null));};exports['create']=function(_0x21df3b,_0x8e671d){return db['JscriptySessionReport'][_0x3905('0x49')](_0x21df3b[_0x3905('0x4a')],{})[_0x3905('0x28')](respondWithResult(_0x8e671d,0xc9))[_0x3905('0x4b')](handleError(_0x8e671d,null));};exports[_0x3905('0x4c')]=function(_0x4a8d7a,_0x34afa1){if(_0x4a8d7a[_0x3905('0x4a')]['id']){delete _0x4a8d7a['body']['id'];}return db[_0x3905('0x42')]['find']({'where':{'id':_0x4a8d7a[_0x3905('0x4d')]['id']}})[_0x3905('0x28')](handleEntityNotFound(_0x34afa1,null))[_0x3905('0x28')](saveUpdates(_0x4a8d7a[_0x3905('0x4a')],null))['then'](respondWithResult(_0x34afa1,null))[_0x3905('0x4b')](handleError(_0x34afa1,null));};exports[_0x3905('0x29')]=function(_0x187b46,_0x289e8d){return db[_0x3905('0x42')][_0x3905('0x48')]({'where':{'id':_0x187b46[_0x3905('0x4d')]['id']}})[_0x3905('0x28')](handleEntityNotFound(_0x289e8d,null))['then'](removeEntity(_0x289e8d,null))[_0x3905('0x4b')](handleError(_0x289e8d,null));};exports[_0x3905('0x4e')]=function(_0x74b855,_0x51fd6d){return db[_0x3905('0x42')][_0x3905('0x4e')]()['then'](respondWithResult(_0x51fd6d,null))[_0x3905('0x4b')](handleError(_0x51fd6d,null));};exports[_0x3905('0x4f')]=function(_0x59555f,_0x48fa06,_0x457b5e){var _0x4a9cae={'raw':!![],'where':{}};var _0x20e863={};var _0x22b6f5={'count':0x0,'rows':[]};return db[_0x3905('0x42')][_0x3905('0x50')]({'where':{'id':_0x59555f['params']['id']}})['then'](handleEntityNotFound(_0x48fa06,null))['then'](function(_0x3f9207){if(_0x3f9207){_0x20e863[_0x3905('0x31')]=_['keys'](db[_0x3905('0x51')][_0x3905('0x30')]);_0x20e863['query']=_[_0x3905('0x33')](_0x59555f[_0x3905('0x32')]);_0x20e863[_0x3905('0x34')]=_[_0x3905('0x35')](_0x20e863[_0x3905('0x31')],_0x20e863[_0x3905('0x32')]);_0x4a9cae[_0x3905('0x36')]=_[_0x3905('0x35')](_0x20e863['model'],qs[_0x3905('0x37')](_0x59555f[_0x3905('0x32')]['fields']));_0x4a9cae['attributes']=_0x4a9cae[_0x3905('0x36')][_0x3905('0x38')]?_0x4a9cae[_0x3905('0x36')]:_0x20e863[_0x3905('0x31')];if(!_0x59555f[_0x3905('0x32')][_0x3905('0x39')](_0x3905('0x52'))){_0x4a9cae[_0x3905('0x20')]=qs[_0x3905('0x20')](_0x59555f['query'][_0x3905('0x20')]);_0x4a9cae[_0x3905('0x1e')]=qs[_0x3905('0x1e')](_0x59555f[_0x3905('0x32')][_0x3905('0x1e')]);}_0x4a9cae[_0x3905('0x3a')]=qs[_0x3905('0x3b')](_0x59555f[_0x3905('0x32')][_0x3905('0x3b')]);_0x4a9cae[_0x3905('0x3c')]=qs[_0x3905('0x34')](_[_0x3905('0x3d')](_0x59555f[_0x3905('0x32')],_0x20e863[_0x3905('0x34')]));_0x4a9cae[_0x3905('0x3c')][_0x3905('0x53')]=_0x3f9207['id'];if(_0x59555f['query'][_0x3905('0x3e')]){_0x4a9cae[_0x3905('0x3c')]=_[_0x3905('0x3f')](_0x4a9cae['where'],{'$or':_['map'](_0x4a9cae[_0x3905('0x36')],function(_0x4e436c){var _0x398910={};_0x398910[_0x4e436c]={'$like':'%'+_0x59555f['query'][_0x3905('0x3e')]+'%'};return _0x398910;})});}_0x4a9cae=_['merge']({},_0x4a9cae,_0x59555f[_0x3905('0x41')]);return db['JscriptyQuestionReport'][_0x3905('0x21')]({'where':_0x4a9cae[_0x3905('0x3c')]})[_0x3905('0x28')](function(_0xee0caf){_0x22b6f5[_0x3905('0x21')]=_0xee0caf;if(_0x59555f[_0x3905('0x32')][_0x3905('0x43')]){_0x4a9cae['include']=[{'all':!![]}];}return db[_0x3905('0x51')][_0x3905('0x45')](_0x4a9cae);})[_0x3905('0x28')](function(_0x5d756d){_0x22b6f5[_0x3905('0x46')]=_0x5d756d;return _0x22b6f5;});}})['then'](respondWithFilteredResult(_0x48fa06,_0x4a9cae))['catch'](handleError(_0x48fa06,null));}; \ No newline at end of file +var _0x57be=['where','filter','merge','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort'];(function(_0xf4050f,_0xefc6bb){var _0x42baab=function(_0x571abb){while(--_0x571abb){_0xf4050f['push'](_0xf4050f['shift']());}};_0x42baab(++_0xefc6bb);}(_0x57be,0x14b));var _0xe57b=function(_0x5ef111,_0x3285e5){_0x5ef111=_0x5ef111-0x0;var _0x2d4619=_0x57be[_0x5ef111];return _0x2d4619;};'use strict';var emlformat=require(_0xe57b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe57b('0x1'));var jsonpatch=require(_0xe57b('0x2'));var rp=require(_0xe57b('0x3'));var moment=require(_0xe57b('0x4'));var BPromise=require(_0xe57b('0x5'));var Mustache=require(_0xe57b('0x6'));var util=require(_0xe57b('0x7'));var path=require(_0xe57b('0x8'));var sox=require(_0xe57b('0x9'));var csv=require(_0xe57b('0xa'));var ejs=require(_0xe57b('0xb'));var fs=require('fs');var fs_extra=require(_0xe57b('0xc'));var _=require(_0xe57b('0xd'));var squel=require('squel');var crypto=require(_0xe57b('0xe'));var jsforce=require(_0xe57b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe57b('0xa'));var querystring=require(_0xe57b('0x10'));var Papa=require(_0xe57b('0x11'));var Redis=require('ioredis');var authService=require(_0xe57b('0x12'));var qs=require(_0xe57b('0x13'));var as=require(_0xe57b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe57b('0x15'));var utils=require('../../config/utils');var config=require(_0xe57b('0x16'));var licenseUtil=require(_0xe57b('0x17'));var db=require(_0xe57b('0x18'))['db'];function respondWithStatusCode(_0x1c3613,_0x241d3f){_0x241d3f=_0x241d3f||0xcc;return function(_0x571839){if(_0x571839){return _0x1c3613[_0xe57b('0x19')](_0x241d3f);}return _0x1c3613[_0xe57b('0x1a')](_0x241d3f)[_0xe57b('0x1b')]();};}function respondWithResult(_0x1a8a7b,_0x4ed2a0){_0x4ed2a0=_0x4ed2a0||0xc8;return function(_0x3c85af){if(_0x3c85af){return _0x1a8a7b[_0xe57b('0x1a')](_0x4ed2a0)[_0xe57b('0x1c')](_0x3c85af);}};}function respondWithFilteredResult(_0x4de353,_0x568a41){return function(_0x4dcf14){if(_0x4dcf14){var _0x712f85=typeof _0x568a41[_0xe57b('0x1d')]===_0xe57b('0x1e')&&typeof _0x568a41[_0xe57b('0x1f')]==='undefined';var _0x2abb9d=_0x4dcf14[_0xe57b('0x20')];var _0xf7e03=_0x712f85?0x0:_0x568a41['offset'];var _0x104c29=_0x712f85?_0x4dcf14[_0xe57b('0x20')]:_0x568a41[_0xe57b('0x1d')]+_0x568a41[_0xe57b('0x1f')];var _0x5206b5;if(_0x104c29>=_0x2abb9d){_0x104c29=_0x2abb9d;_0x5206b5=0xc8;}else{_0x5206b5=0xce;}_0x4de353['status'](_0x5206b5);return _0x4de353[_0xe57b('0x21')](_0xe57b('0x22'),_0xf7e03+'-'+_0x104c29+'/'+_0x2abb9d)[_0xe57b('0x1c')](_0x4dcf14);}return null;};}function patchUpdates(_0x56b93c){return function(_0x3dcdc7){try{jsonpatch[_0xe57b('0x23')](_0x3dcdc7,_0x56b93c,!![]);}catch(_0x1b659d){return BPromise[_0xe57b('0x24')](_0x1b659d);}return _0x3dcdc7[_0xe57b('0x25')]();};}function saveUpdates(_0xcaec48,_0x21676f){return function(_0x309018){if(_0x309018){return _0x309018['update'](_0xcaec48)[_0xe57b('0x26')](function(_0x1238d0){return _0x1238d0;});}return null;};}function removeEntity(_0x44b97c,_0x3e7b61){return function(_0xef373){if(_0xef373){return _0xef373[_0xe57b('0x27')]()[_0xe57b('0x26')](function(){_0x44b97c['status'](0xcc)[_0xe57b('0x1b')]();});}};}function handleEntityNotFound(_0x4fa98a,_0xed17c5){return function(_0x5dd036){if(!_0x5dd036){_0x4fa98a[_0xe57b('0x19')](0x194);}return _0x5dd036;};}function handleError(_0x32559e,_0x5a5009){_0x5a5009=_0x5a5009||0x1f4;return function(_0x187330){logger[_0xe57b('0x28')](_0x187330[_0xe57b('0x29')]);if(_0x187330[_0xe57b('0x2a')]){delete _0x187330[_0xe57b('0x2a')];}_0x32559e[_0xe57b('0x1a')](_0x5a5009)['send'](_0x187330);};}exports[_0xe57b('0x2b')]=function(_0x22b09a,_0x52f9d4){var _0x772a2f={},_0x38ff07={},_0x22d9df={'count':0x0,'rows':[]};var _0x7f3070=_[_0xe57b('0x2c')](db[_0xe57b('0x2d')]['rawAttributes'],function(_0x2726d2){return{'name':_0x2726d2[_0xe57b('0x2e')],'type':_0x2726d2[_0xe57b('0x2f')][_0xe57b('0x30')]};});_0x38ff07[_0xe57b('0x31')]=_[_0xe57b('0x2c')](_0x7f3070,'name');_0x38ff07[_0xe57b('0x32')]=_[_0xe57b('0x33')](_0x22b09a[_0xe57b('0x32')]);_0x38ff07[_0xe57b('0x34')]=_['intersection'](_0x38ff07['model'],_0x38ff07[_0xe57b('0x32')]);_0x772a2f['attributes']=_[_0xe57b('0x35')](_0x38ff07[_0xe57b('0x31')],qs['fields'](_0x22b09a[_0xe57b('0x32')][_0xe57b('0x36')]));_0x772a2f[_0xe57b('0x37')]=_0x772a2f[_0xe57b('0x37')]['length']?_0x772a2f[_0xe57b('0x37')]:_0x38ff07[_0xe57b('0x31')];if(!_0x22b09a['query'][_0xe57b('0x38')](_0xe57b('0x39'))){_0x772a2f[_0xe57b('0x1f')]=qs[_0xe57b('0x1f')](_0x22b09a[_0xe57b('0x32')]['limit']);_0x772a2f[_0xe57b('0x1d')]=qs['offset'](_0x22b09a[_0xe57b('0x32')][_0xe57b('0x1d')]);}_0x772a2f['order']=qs[_0xe57b('0x3a')](_0x22b09a[_0xe57b('0x32')]['sort']);_0x772a2f[_0xe57b('0x3b')]=qs['filters'](_['pick'](_0x22b09a[_0xe57b('0x32')],_0x38ff07[_0xe57b('0x34')]),_0x7f3070);if(_0x22b09a[_0xe57b('0x32')]['filter']){_0x772a2f['where']=_['merge'](_0x772a2f[_0xe57b('0x3b')],{'$or':_[_0xe57b('0x2c')](_0x7f3070,function(_0x1317cf){if(_0x1317cf[_0xe57b('0x2f')]!=='VIRTUAL'){var _0x3f885d={};_0x3f885d[_0x1317cf['name']]={'$like':'%'+_0x22b09a[_0xe57b('0x32')][_0xe57b('0x3c')]+'%'};return _0x3f885d;}})});}_0x772a2f=_[_0xe57b('0x3d')]({},_0x772a2f,_0x22b09a[_0xe57b('0x3e')]);var _0x489b3a={'where':_0x772a2f[_0xe57b('0x3b')]};return db[_0xe57b('0x2d')][_0xe57b('0x20')](_0x489b3a)['then'](function(_0x32cf9f){_0x22d9df[_0xe57b('0x20')]=_0x32cf9f;if(_0x22b09a[_0xe57b('0x32')]['includeAll']){_0x772a2f['include']=[{'all':!![]}];}return db[_0xe57b('0x2d')][_0xe57b('0x3f')](_0x772a2f);})[_0xe57b('0x26')](function(_0x3e763a){_0x22d9df[_0xe57b('0x40')]=_0x3e763a;return _0x22d9df;})[_0xe57b('0x26')](respondWithFilteredResult(_0x52f9d4,_0x772a2f))[_0xe57b('0x41')](handleError(_0x52f9d4,null));};exports[_0xe57b('0x42')]=function(_0x25a746,_0x2b9d8e){var _0x4093eb={'raw':!![],'where':{'id':_0x25a746[_0xe57b('0x43')]['id']}},_0x1858bb={};_0x1858bb[_0xe57b('0x31')]=_['keys'](db[_0xe57b('0x2d')][_0xe57b('0x44')]);_0x1858bb[_0xe57b('0x32')]=_['keys'](_0x25a746[_0xe57b('0x32')]);_0x1858bb[_0xe57b('0x34')]=_[_0xe57b('0x35')](_0x1858bb[_0xe57b('0x31')],_0x1858bb[_0xe57b('0x32')]);_0x4093eb['attributes']=_[_0xe57b('0x35')](_0x1858bb[_0xe57b('0x31')],qs['fields'](_0x25a746['query'][_0xe57b('0x36')]));_0x4093eb['attributes']=_0x4093eb[_0xe57b('0x37')]['length']?_0x4093eb[_0xe57b('0x37')]:_0x1858bb['model'];if(_0x25a746['query'][_0xe57b('0x45')]){_0x4093eb[_0xe57b('0x46')]=[{'all':!![]}];}_0x4093eb=_[_0xe57b('0x3d')]({},_0x4093eb,_0x25a746['options']);return db[_0xe57b('0x2d')][_0xe57b('0x47')](_0x4093eb)['then'](handleEntityNotFound(_0x2b9d8e,null))[_0xe57b('0x26')](respondWithResult(_0x2b9d8e,null))['catch'](handleError(_0x2b9d8e,null));};exports[_0xe57b('0x48')]=function(_0x33c1fe,_0x5876c3){return db['JscriptySessionReport'][_0xe57b('0x48')](_0x33c1fe[_0xe57b('0x49')],{})[_0xe57b('0x26')](respondWithResult(_0x5876c3,0xc9))['catch'](handleError(_0x5876c3,null));};exports['update']=function(_0x2ca664,_0x4b508f){if(_0x2ca664['body']['id']){delete _0x2ca664[_0xe57b('0x49')]['id'];}return db[_0xe57b('0x2d')][_0xe57b('0x47')]({'where':{'id':_0x2ca664[_0xe57b('0x43')]['id']}})[_0xe57b('0x26')](handleEntityNotFound(_0x4b508f,null))[_0xe57b('0x26')](saveUpdates(_0x2ca664['body'],null))[_0xe57b('0x26')](respondWithResult(_0x4b508f,null))[_0xe57b('0x41')](handleError(_0x4b508f,null));};exports[_0xe57b('0x27')]=function(_0x52712f,_0x1cb09c){return db['JscriptySessionReport'][_0xe57b('0x47')]({'where':{'id':_0x52712f[_0xe57b('0x43')]['id']}})[_0xe57b('0x26')](handleEntityNotFound(_0x1cb09c,null))[_0xe57b('0x26')](removeEntity(_0x1cb09c,null))[_0xe57b('0x41')](handleError(_0x1cb09c,null));};exports[_0xe57b('0x4a')]=function(_0x27156c,_0x58ebfe){return db[_0xe57b('0x2d')][_0xe57b('0x4a')]()['then'](respondWithResult(_0x58ebfe,null))[_0xe57b('0x41')](handleError(_0x58ebfe,null));};exports[_0xe57b('0x4b')]=function(_0x47db57,_0x36ce2d,_0x2845ff){var _0x395ced={'raw':!![],'where':{}};var _0x2d86aa={};var _0x47e350={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xe57b('0x4c')]({'where':{'id':_0x47db57[_0xe57b('0x43')]['id']}})[_0xe57b('0x26')](handleEntityNotFound(_0x36ce2d,null))['then'](function(_0x336514){if(_0x336514){_0x2d86aa[_0xe57b('0x31')]=_[_0xe57b('0x33')](db[_0xe57b('0x4d')][_0xe57b('0x44')]);_0x2d86aa[_0xe57b('0x32')]=_[_0xe57b('0x33')](_0x47db57[_0xe57b('0x32')]);_0x2d86aa[_0xe57b('0x34')]=_[_0xe57b('0x35')](_0x2d86aa[_0xe57b('0x31')],_0x2d86aa['query']);_0x395ced[_0xe57b('0x37')]=_[_0xe57b('0x35')](_0x2d86aa[_0xe57b('0x31')],qs[_0xe57b('0x36')](_0x47db57[_0xe57b('0x32')][_0xe57b('0x36')]));_0x395ced[_0xe57b('0x37')]=_0x395ced[_0xe57b('0x37')]['length']?_0x395ced[_0xe57b('0x37')]:_0x2d86aa[_0xe57b('0x31')];if(!_0x47db57[_0xe57b('0x32')][_0xe57b('0x38')](_0xe57b('0x39'))){_0x395ced[_0xe57b('0x1f')]=qs[_0xe57b('0x1f')](_0x47db57['query'][_0xe57b('0x1f')]);_0x395ced[_0xe57b('0x1d')]=qs[_0xe57b('0x1d')](_0x47db57[_0xe57b('0x32')]['offset']);}_0x395ced['order']=qs[_0xe57b('0x3a')](_0x47db57[_0xe57b('0x32')]['sort']);_0x395ced[_0xe57b('0x3b')]=qs[_0xe57b('0x34')](_['pick'](_0x47db57[_0xe57b('0x32')],_0x2d86aa[_0xe57b('0x34')]));_0x395ced[_0xe57b('0x3b')]['SessionId']=_0x336514['id'];if(_0x47db57[_0xe57b('0x32')][_0xe57b('0x3c')]){_0x395ced[_0xe57b('0x3b')]=_['merge'](_0x395ced[_0xe57b('0x3b')],{'$or':_[_0xe57b('0x2c')](_0x395ced[_0xe57b('0x37')],function(_0x303141){var _0x3c9cbd={};_0x3c9cbd[_0x303141]={'$like':'%'+_0x47db57['query'][_0xe57b('0x3c')]+'%'};return _0x3c9cbd;})});}_0x395ced=_[_0xe57b('0x3d')]({},_0x395ced,_0x47db57[_0xe57b('0x3e')]);return db[_0xe57b('0x4d')][_0xe57b('0x20')]({'where':_0x395ced[_0xe57b('0x3b')]})[_0xe57b('0x26')](function(_0x6e7c59){_0x47e350[_0xe57b('0x20')]=_0x6e7c59;if(_0x47db57[_0xe57b('0x32')][_0xe57b('0x45')]){_0x395ced[_0xe57b('0x46')]=[{'all':!![]}];}return db[_0xe57b('0x4d')][_0xe57b('0x3f')](_0x395ced);})[_0xe57b('0x26')](function(_0x41b32b){_0x47e350['rows']=_0x41b32b;return _0x47e350;});}})['then'](respondWithFilteredResult(_0x36ce2d,_0x395ced))[_0xe57b('0x41')](handleError(_0x36ce2d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f61103f..ae54d88 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 _0x4819=['report_jscripty_sessions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport'];(function(_0x1fbdad,_0x113fcd){var _0x512087=function(_0x20786c){while(--_0x20786c){_0x1fbdad['push'](_0x1fbdad['shift']());}};_0x512087(++_0x113fcd);}(_0x4819,0xcd));var _0x9481=function(_0x1152e5,_0x5a8eaf){_0x1152e5=_0x1152e5-0x0;var _0xd1fcdb=_0x4819[_0x1152e5];return _0xd1fcdb;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e96dc95..f795d4a 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 _0x1893=['../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x1893,0xa2));var _0x3189=function(_0x337d97,_0x19c381){_0x337d97=_0x337d97-0x0;var _0x53aa89=_0x1893[_0x337d97];return _0x53aa89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});} \ No newline at end of file +var _0x896e=['JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0x896e,0x1e9));var _0xe896=function(_0x194af9,_0x2346f4){_0x194af9=_0x194af9-0x0;var _0xa106b=_0x896e[_0x194af9];return _0xa106b;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index cad0edd..6b896dc 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 _0x01ad=['index','put','isAuthenticated','downloadLogFile','exports','path','connect-timeout','Router','fs-extra','../../config/environment','./license.controller','get'];(function(_0x547cee,_0x109313){var _0x16b281=function(_0x5ac49b){while(--_0x5ac49b){_0x547cee['push'](_0x547cee['shift']());}};_0x16b281(++_0x109313);}(_0x01ad,0xad));var _0xd01a=function(_0x799123,_0x4e7fbc){_0x799123=_0x799123-0x0;var _0x46d7bc=_0x01ad[_0x799123];return _0x46d7bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd01a('0x0'));var timeout=require(_0xd01a('0x1'));var express=require('express');var router=express[_0xd01a('0x2')]();var fs_extra=require(_0xd01a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd01a('0x4'));var controller=require(_0xd01a('0x5'));router[_0xd01a('0x6')]('/',controller[_0xd01a('0x7')]);router[_0xd01a('0x8')]('/:id',auth[_0xd01a('0x9')](),controller['update']);router[_0xd01a('0x6')]('/download_log_file',auth[_0xd01a('0x9')](),controller[_0xd01a('0xa')]);module[_0xd01a('0xb')]=router; \ No newline at end of file +var _0xb2fe=['Router','fs-extra','../../components/auth/service','./license.controller','index','put','isAuthenticated','update','get','downloadLogFile','multer','util','path','connect-timeout','express'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb2fe,0x163));var _0xeb2f=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0xb2fe[_0x55d911];return _0x3104c2;};'use strict';var multer=require(_0xeb2f('0x0'));var util=require(_0xeb2f('0x1'));var path=require(_0xeb2f('0x2'));var timeout=require(_0xeb2f('0x3'));var express=require(_0xeb2f('0x4'));var router=express[_0xeb2f('0x5')]();var fs_extra=require(_0xeb2f('0x6'));var auth=require(_0xeb2f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb2f('0x8'));router['get']('/',controller[_0xeb2f('0x9')]);router[_0xeb2f('0xa')]('/:id',auth[_0xeb2f('0xb')](),controller[_0xeb2f('0xc')]);router[_0xeb2f('0xd')]('/download_log_file',auth[_0xeb2f('0xb')](),controller[_0xeb2f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 55772f2..6e60cbc 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 _0x4274=['STRING','INTEGER','sequelize','TEXT'];(function(_0x355dd1,_0x23770b){var _0x3110f1=function(_0x3de9b7){while(--_0x3de9b7){_0x355dd1['push'](_0x355dd1['shift']());}};_0x3110f1(++_0x23770b);}(_0x4274,0x1e6));var _0x4427=function(_0x5b0c71,_0x5e8546){_0x5b0c71=_0x5b0c71-0x0;var _0x1409e7=_0x4274[_0x5b0c71];return _0x1409e7;};'use strict';var Sequelize=require(_0x4427('0x0'));module['exports']={'license':{'type':Sequelize[_0x4427('0x1')]},'data1':{'type':Sequelize[_0x4427('0x2')]},'data2':{'type':Sequelize[_0x4427('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x4427('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfeaa=['INTEGER','sequelize','exports','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfeaa,0x1dd));var _0xafea=function(_0x2a4b9e,_0x2c5f76){_0x2a4b9e=_0x2a4b9e-0x0;var _0x2019fa=_0xfeaa[_0x2a4b9e];return _0x2019fa;};'use strict';var Sequelize=require(_0xafea('0x0'));module[_0xafea('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xafea('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xafea('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index d9f12e9..bff2702 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 _0xdc40=['attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','then','destroy','name','model','License','rawAttributes','query','intersection','fields','attributes','length','catch','body','find','key','demo','license-info.log','/var','log','setHeader'];(function(_0x406414,_0x27e918){var _0x132e6c=function(_0x3bbde5){while(--_0x3bbde5){_0x406414['push'](_0x406414['shift']());}};_0x132e6c(++_0x27e918);}(_0xdc40,0xa8));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0dc4('0x0'));var rimraf=require(_0x0dc4('0x1'));var zipdir=require(_0x0dc4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0dc4('0x3'));var BPromise=require(_0x0dc4('0x4'));var Mustache=require(_0x0dc4('0x5'));var util=require('util');var path=require(_0x0dc4('0x6'));var sox=require(_0x0dc4('0x7'));var csv=require(_0x0dc4('0x8'));var ejs=require(_0x0dc4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dc4('0xa'));var squel=require(_0x0dc4('0xb'));var crypto=require('crypto');var jsforce=require(_0x0dc4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0dc4('0x8'));var querystring=require(_0x0dc4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0dc4('0xe'));var qs=require(_0x0dc4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dc4('0x10'));var logger=require(_0x0dc4('0x11'))('api');var utils=require(_0x0dc4('0x12'));var config=require(_0x0dc4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dc4('0x14'))['db'];function respondWithStatusCode(_0x1a144c,_0x51998c){_0x51998c=_0x51998c||0xcc;return function(_0x38e666){if(_0x38e666){return _0x1a144c[_0x0dc4('0x15')](_0x51998c);}return _0x1a144c[_0x0dc4('0x16')](_0x51998c)[_0x0dc4('0x17')]();};}function respondWithResult(_0xac3f5b,_0x58feb1){_0x58feb1=_0x58feb1||0xc8;return function(_0x89733f){if(_0x89733f){return _0xac3f5b[_0x0dc4('0x16')](_0x58feb1)[_0x0dc4('0x18')](_0x89733f);}};}function respondWithFilteredResult(_0x379921,_0x6979e2){return function(_0x55400e){if(_0x55400e){var _0x47b02f=typeof _0x6979e2[_0x0dc4('0x19')]==='undefined'&&typeof _0x6979e2[_0x0dc4('0x1a')]==='undefined';var _0x193a04=_0x55400e[_0x0dc4('0x1b')];var _0x537bd2=_0x47b02f?0x0:_0x6979e2[_0x0dc4('0x19')];var _0x2642d1=_0x47b02f?_0x55400e[_0x0dc4('0x1b')]:_0x6979e2[_0x0dc4('0x19')]+_0x6979e2['limit'];var _0x646a85;if(_0x2642d1>=_0x193a04){_0x2642d1=_0x193a04;_0x646a85=0xc8;}else{_0x646a85=0xce;}_0x379921[_0x0dc4('0x16')](_0x646a85);return _0x379921[_0x0dc4('0x1c')]('Content-Range',_0x537bd2+'-'+_0x2642d1+'/'+_0x193a04)[_0x0dc4('0x18')](_0x55400e);}return null;};}function patchUpdates(_0x4b7248){return function(_0x1faf2a){try{jsonpatch[_0x0dc4('0x1d')](_0x1faf2a,_0x4b7248,!![]);}catch(_0x42da04){return BPromise[_0x0dc4('0x1e')](_0x42da04);}return _0x1faf2a['save']();};}function saveUpdates(_0x2c6f71,_0x405411){return function(_0x4fd2c8){if(_0x4fd2c8){return _0x4fd2c8[_0x0dc4('0x1f')](_0x2c6f71)[_0x0dc4('0x20')](function(_0x3a2f12){return _0x3a2f12;});}return null;};}function removeEntity(_0x494b6e,_0xa6438e){return function(_0x13e1f8){if(_0x13e1f8){return _0x13e1f8[_0x0dc4('0x21')]()[_0x0dc4('0x20')](function(){_0x494b6e[_0x0dc4('0x16')](0xcc)[_0x0dc4('0x17')]();});}};}function handleEntityNotFound(_0x5cfee0,_0x105b73){return function(_0x53a4dd){if(!_0x53a4dd){_0x5cfee0['sendStatus'](0x194);}return _0x53a4dd;};}function handleError(_0x20e4a0,_0x38bd0f){_0x38bd0f=_0x38bd0f||0x1f4;return function(_0x43ba2b){logger['error'](_0x43ba2b['stack']);if(_0x43ba2b[_0x0dc4('0x22')]){delete _0x43ba2b[_0x0dc4('0x22')];}_0x20e4a0[_0x0dc4('0x16')](_0x38bd0f)['send'](_0x43ba2b);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0xdc3f02,_0x55f347){var _0x119ea5={'raw':!![],'where':{'id':0x1}},_0x3d690a={};_0x3d690a[_0x0dc4('0x23')]=_['keys'](db[_0x0dc4('0x24')][_0x0dc4('0x25')]);_0x3d690a[_0x0dc4('0x26')]=_['keys'](_0xdc3f02[_0x0dc4('0x26')]);_0x3d690a['filters']=_[_0x0dc4('0x27')](_0x3d690a[_0x0dc4('0x23')],_0x3d690a[_0x0dc4('0x26')]);_0x119ea5['attributes']=_[_0x0dc4('0x27')](_0x3d690a[_0x0dc4('0x23')],qs[_0x0dc4('0x28')](_0xdc3f02[_0x0dc4('0x26')][_0x0dc4('0x28')]));_0x119ea5[_0x0dc4('0x29')]=_0x119ea5[_0x0dc4('0x29')][_0x0dc4('0x2a')]?_0x119ea5['attributes']:_0x3d690a[_0x0dc4('0x23')];_0x119ea5=_['merge']({},_0x119ea5,_0xdc3f02['options']);return utilLicense['getLicense'](_0x119ea5)[_0x0dc4('0x20')](respondWithResult(_0x55f347,null))[_0x0dc4('0x2b')](handleError(_0x55f347,null));};exports['update']=function(_0x56df45,_0x4caf38){if(_0x56df45[_0x0dc4('0x2c')]['id']){delete _0x56df45[_0x0dc4('0x2c')]['id'];}return db[_0x0dc4('0x24')][_0x0dc4('0x2d')]({'where':{'id':_0x56df45['params']['id']}})[_0x0dc4('0x20')](handleEntityNotFound(_0x4caf38,null))['then'](function(_0x130c59){var _0x4896f8=_0x130c59['get']({'plain':!![]});return utilLicense['checkLicense'](_0x4896f8,_0x56df45[_0x0dc4('0x2c')][_0x0dc4('0x2e')]);})[_0x0dc4('0x20')](function(_0x2c0eda){if(!_0x2c0eda[_0x0dc4('0x2f')]){return saveUpdates(_0x56df45[_0x0dc4('0x2c')],null);}return _0x2c0eda;})['then'](respondWithResult(_0x4caf38,null))[_0x0dc4('0x2b')](handleError(_0x4caf38,null));};exports['downloadLogFile']=function(_0x533371,_0x38adc6){var _0x55e0d3=_0x0dc4('0x30');var _0x244f80=path['join'](_0x0dc4('0x31'),_0x0dc4('0x32'),'xcally',_0x55e0d3);_0x38adc6[_0x0dc4('0x33')]('Content-disposition',_0x0dc4('0x34')+_0x55e0d3);_0x38adc6[_0x0dc4('0x1c')](_0x0dc4('0x35'),_0x0dc4('0x36'));_0x38adc6['download'](_0x244f80);}; \ No newline at end of file +var _0xecb3=['length','merge','options','getLicense','catch','body','find','params','get','checkLicense','demo','license-info.log','join','log','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','keys','License','query','filters','intersection','model','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecb3,0x1bc));var _0x3ecb=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xecb3[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x3ecb('0x0'));var rimraf=require(_0x3ecb('0x1'));var zipdir=require(_0x3ecb('0x2'));var jsonpatch=require(_0x3ecb('0x3'));var rp=require(_0x3ecb('0x4'));var moment=require(_0x3ecb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3ecb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3ecb('0x7'));var csv=require('to-csv');var ejs=require(_0x3ecb('0x8'));var fs=require('fs');var fs_extra=require(_0x3ecb('0x9'));var _=require(_0x3ecb('0xa'));var squel=require(_0x3ecb('0xb'));var crypto=require('crypto');var jsforce=require(_0x3ecb('0xc'));var deskjs=require(_0x3ecb('0xd'));var toCsv=require(_0x3ecb('0xe'));var querystring=require(_0x3ecb('0xf'));var Papa=require(_0x3ecb('0x10'));var Redis=require('ioredis');var authService=require(_0x3ecb('0x11'));var qs=require(_0x3ecb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ecb('0x13'));var logger=require(_0x3ecb('0x14'))(_0x3ecb('0x15'));var utils=require('../../config/utils');var config=require(_0x3ecb('0x16'));var licenseUtil=require(_0x3ecb('0x17'));var db=require(_0x3ecb('0x18'))['db'];function respondWithStatusCode(_0x279950,_0x1d0ecd){_0x1d0ecd=_0x1d0ecd||0xcc;return function(_0x260401){if(_0x260401){return _0x279950[_0x3ecb('0x19')](_0x1d0ecd);}return _0x279950[_0x3ecb('0x1a')](_0x1d0ecd)[_0x3ecb('0x1b')]();};}function respondWithResult(_0x3c47a6,_0x33afc1){_0x33afc1=_0x33afc1||0xc8;return function(_0x20db78){if(_0x20db78){return _0x3c47a6[_0x3ecb('0x1a')](_0x33afc1)[_0x3ecb('0x1c')](_0x20db78);}};}function respondWithFilteredResult(_0x210899,_0x4fceb3){return function(_0x24fd96){if(_0x24fd96){var _0x1c67cd=typeof _0x4fceb3[_0x3ecb('0x1d')]==='undefined'&&typeof _0x4fceb3['limit']===_0x3ecb('0x1e');var _0x38e355=_0x24fd96[_0x3ecb('0x1f')];var _0x54e9a1=_0x1c67cd?0x0:_0x4fceb3[_0x3ecb('0x1d')];var _0x3f7b6f=_0x1c67cd?_0x24fd96[_0x3ecb('0x1f')]:_0x4fceb3[_0x3ecb('0x1d')]+_0x4fceb3[_0x3ecb('0x20')];var _0x3c460b;if(_0x3f7b6f>=_0x38e355){_0x3f7b6f=_0x38e355;_0x3c460b=0xc8;}else{_0x3c460b=0xce;}_0x210899['status'](_0x3c460b);return _0x210899[_0x3ecb('0x21')](_0x3ecb('0x22'),_0x54e9a1+'-'+_0x3f7b6f+'/'+_0x38e355)[_0x3ecb('0x1c')](_0x24fd96);}return null;};}function patchUpdates(_0x38ce5b){return function(_0x4728ec){try{jsonpatch[_0x3ecb('0x23')](_0x4728ec,_0x38ce5b,!![]);}catch(_0x178bce){return BPromise[_0x3ecb('0x24')](_0x178bce);}return _0x4728ec[_0x3ecb('0x25')]();};}function saveUpdates(_0x228719,_0x25899e){return function(_0x56f7b0){if(_0x56f7b0){return _0x56f7b0[_0x3ecb('0x26')](_0x228719)[_0x3ecb('0x27')](function(_0x3fd031){return _0x3fd031;});}return null;};}function removeEntity(_0x1aa722,_0x2667bc){return function(_0x35ae6b){if(_0x35ae6b){return _0x35ae6b[_0x3ecb('0x28')]()[_0x3ecb('0x27')](function(){_0x1aa722[_0x3ecb('0x1a')](0xcc)[_0x3ecb('0x1b')]();});}};}function handleEntityNotFound(_0x85a35c,_0x8d36d6){return function(_0x2b75f2){if(!_0x2b75f2){_0x85a35c[_0x3ecb('0x19')](0x194);}return _0x2b75f2;};}function handleError(_0x874f05,_0x16abb9){_0x16abb9=_0x16abb9||0x1f4;return function(_0x1f1499){logger[_0x3ecb('0x29')](_0x1f1499[_0x3ecb('0x2a')]);if(_0x1f1499['name']){delete _0x1f1499[_0x3ecb('0x2b')];}_0x874f05['status'](_0x16abb9)[_0x3ecb('0x2c')](_0x1f1499);};}var utilLicense=require(_0x3ecb('0x17'));exports['index']=function(_0x4efa2f,_0x38896e){var _0xfa0811={'raw':!![],'where':{'id':0x1}},_0x303950={};_0x303950['model']=_[_0x3ecb('0x2d')](db[_0x3ecb('0x2e')]['rawAttributes']);_0x303950['query']=_['keys'](_0x4efa2f[_0x3ecb('0x2f')]);_0x303950[_0x3ecb('0x30')]=_[_0x3ecb('0x31')](_0x303950[_0x3ecb('0x32')],_0x303950[_0x3ecb('0x2f')]);_0xfa0811[_0x3ecb('0x33')]=_[_0x3ecb('0x31')](_0x303950[_0x3ecb('0x32')],qs[_0x3ecb('0x34')](_0x4efa2f['query'][_0x3ecb('0x34')]));_0xfa0811[_0x3ecb('0x33')]=_0xfa0811[_0x3ecb('0x33')][_0x3ecb('0x35')]?_0xfa0811['attributes']:_0x303950[_0x3ecb('0x32')];_0xfa0811=_[_0x3ecb('0x36')]({},_0xfa0811,_0x4efa2f[_0x3ecb('0x37')]);return utilLicense[_0x3ecb('0x38')](_0xfa0811)[_0x3ecb('0x27')](respondWithResult(_0x38896e,null))[_0x3ecb('0x39')](handleError(_0x38896e,null));};exports['update']=function(_0x363888,_0x1712ec){if(_0x363888[_0x3ecb('0x3a')]['id']){delete _0x363888[_0x3ecb('0x3a')]['id'];}return db['License'][_0x3ecb('0x3b')]({'where':{'id':_0x363888[_0x3ecb('0x3c')]['id']}})[_0x3ecb('0x27')](handleEntityNotFound(_0x1712ec,null))[_0x3ecb('0x27')](function(_0x54d3f9){var _0x221e63=_0x54d3f9[_0x3ecb('0x3d')]({'plain':!![]});return utilLicense[_0x3ecb('0x3e')](_0x221e63,_0x363888[_0x3ecb('0x3a')]['key']);})[_0x3ecb('0x27')](function(_0x355cec){if(!_0x355cec[_0x3ecb('0x3f')]){return saveUpdates(_0x363888[_0x3ecb('0x3a')],null);}return _0x355cec;})['then'](respondWithResult(_0x1712ec,null))[_0x3ecb('0x39')](handleError(_0x1712ec,null));};exports['downloadLogFile']=function(_0xf22895,_0x14b4a7){var _0x2f249f=_0x3ecb('0x40');var _0x354688=path[_0x3ecb('0x41')]('/var',_0x3ecb('0x42'),'xcally',_0x2f249f);_0x14b4a7['setHeader'](_0x3ecb('0x43'),_0x3ecb('0x44')+_0x2f249f);_0x14b4a7[_0x3ecb('0x21')](_0x3ecb('0x45'),_0x3ecb('0x46'));_0x14b4a7['download'](_0x354688);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c3b1241..a6ecc06 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 _0xf581=['license','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x2b0275,_0x3fe1fe){var _0x43708e=function(_0x4f410c){while(--_0x4f410c){_0x2b0275['push'](_0x2b0275['shift']());}};_0x43708e(++_0x3fe1fe);}(_0xf581,0x85));var _0x1f58=function(_0x16921d,_0x2b6958){_0x16921d=_0x16921d-0x0;var _0x1421b9=_0xf581[_0x16921d];return _0x1421b9;};'use strict';var _=require(_0x1f58('0x0'));var util=require(_0x1f58('0x1'));var logger=require(_0x1f58('0x2'))(_0x1f58('0x3'));var moment=require(_0x1f58('0x4'));var BPromise=require(_0x1f58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f58('0x6'));var config=require(_0x1f58('0x7'));var attributes=require(_0x1f58('0x8'));module[_0x1f58('0x9')]=function(_0x381abb,_0x138d3b){return _0x381abb[_0x1f58('0xa')]('License',attributes,{'tableName':_0x1f58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1aa=['./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x409673,_0xb3a7f3){var _0x2ac47e=function(_0x1bc8e3){while(--_0x1bc8e3){_0x409673['push'](_0x409673['shift']());}};_0x2ac47e(++_0xb3a7f3);}(_0xf1aa,0x116));var _0xaf1a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf1aa[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xaf1a('0x0'));var util=require(_0xaf1a('0x1'));var logger=require(_0xaf1a('0x2'))(_0xaf1a('0x3'));var moment=require('moment');var BPromise=require(_0xaf1a('0x4'));var rp=require(_0xaf1a('0x5'));var fs=require('fs');var path=require(_0xaf1a('0x6'));var rimraf=require('rimraf');var config=require(_0xaf1a('0x7'));var attributes=require(_0xaf1a('0x8'));module[_0xaf1a('0x9')]=function(_0x1ed5f7,_0xdcf301){return _0x1ed5f7[_0xaf1a('0xa')](_0xaf1a('0xb'),attributes,{'tableName':_0xaf1a('0xc'),'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 3d83b5c..79ae76f 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 _0xc347=['debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x1d3b8f,_0xb54937){var _0x5131a0=function(_0x2b4818){while(--_0x2b4818){_0x1d3b8f['push'](_0x1d3b8f['shift']());}};_0x5131a0(++_0xb54937);}(_0xc347,0x139));var _0x7c34=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc347[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x7c34('0x0'));var moment=require('moment');var BPromise=require(_0x7c34('0x1'));var rs=require(_0x7c34('0x2'));var fs=require('fs');var Redis=require(_0x7c34('0x3'));var db=require(_0x7c34('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c34('0x5'));var config=require(_0x7c34('0x6'));var jayson=require(_0x7c34('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15ca00,_0x373f5c,_0x1ef7e3){return new BPromise(function(_0x1f519c,_0x1ac23a){return client['request'](_0x15ca00,_0x1ef7e3)['then'](function(_0xdddbe5){logger[_0x7c34('0x8')](_0x7c34('0x9'),_0x373f5c,_0x7c34('0xa'));logger[_0x7c34('0xb')](_0x7c34('0xc'),_0x373f5c,'request\x20sent',JSON[_0x7c34('0xd')](_0xdddbe5));if(_0xdddbe5[_0x7c34('0xe')]){if(_0xdddbe5[_0x7c34('0xe')]['code']===0x1f4){logger['error'](_0x7c34('0x9'),_0x373f5c,_0xdddbe5['error'][_0x7c34('0xf')]);return _0x1ac23a(_0xdddbe5['error'][_0x7c34('0xf')]);}logger[_0x7c34('0xe')]('License,\x20%s,\x20%s',_0x373f5c,_0xdddbe5[_0x7c34('0xe')][_0x7c34('0xf')]);return _0x1f519c(_0xdddbe5[_0x7c34('0xe')][_0x7c34('0xf')]);}else{logger[_0x7c34('0x8')]('License,\x20%s,\x20%s',_0x373f5c,'request\x20sent');_0x1f519c(_0xdddbe5[_0x7c34('0x10')][_0x7c34('0xf')]);}})[_0x7c34('0x11')](function(_0x3764fd){logger[_0x7c34('0xe')](_0x7c34('0x9'),_0x373f5c,_0x3764fd);_0x1ac23a(_0x3764fd);});});} \ No newline at end of file +var _0x7004=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x378f96,_0x13667f){var _0x10a677=function(_0x2bd4fc){while(--_0x2bd4fc){_0x378f96['push'](_0x378f96['shift']());}};_0x10a677(++_0x13667f);}(_0x7004,0x1e7));var _0x4700=function(_0x151132,_0x32026a){_0x151132=_0x151132-0x0;var _0x13c2ad=_0x7004[_0x151132];return _0x13c2ad;};'use strict';var _=require(_0x4700('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4700('0x1'));var fs=require('fs');var Redis=require(_0x4700('0x2'));var db=require(_0x4700('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4700('0x4'))(_0x4700('0x5'));var config=require('../../config/environment');var jayson=require(_0x4700('0x6'));var client=jayson[_0x4700('0x7')][_0x4700('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bd209,_0x3ae332,_0x4f8a57){return new BPromise(function(_0x1d03e7,_0x15cd3c){return client[_0x4700('0x9')](_0x5bd209,_0x4f8a57)[_0x4700('0xa')](function(_0x19d94a){logger[_0x4700('0xb')](_0x4700('0xc'),_0x3ae332,_0x4700('0xd'));logger[_0x4700('0xe')](_0x4700('0xf'),_0x3ae332,_0x4700('0xd'),JSON[_0x4700('0x10')](_0x19d94a));if(_0x19d94a[_0x4700('0x11')]){if(_0x19d94a[_0x4700('0x11')]['code']===0x1f4){logger[_0x4700('0x11')](_0x4700('0xc'),_0x3ae332,_0x19d94a['error'][_0x4700('0x12')]);return _0x15cd3c(_0x19d94a[_0x4700('0x11')][_0x4700('0x12')]);}logger[_0x4700('0x11')](_0x4700('0xc'),_0x3ae332,_0x19d94a[_0x4700('0x11')]['message']);return _0x1d03e7(_0x19d94a[_0x4700('0x11')][_0x4700('0x12')]);}else{logger[_0x4700('0xb')](_0x4700('0xc'),_0x3ae332,'request\x20sent');_0x1d03e7(_0x19d94a['result'][_0x4700('0x12')]);}})[_0x4700('0x13')](function(_0x108a72){logger[_0x4700('0x11')](_0x4700('0xc'),_0x3ae332,_0x108a72);_0x15cd3c(_0x108a72);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6da2b57..5b8b12b 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 _0x5899=['removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','post','addAnswer','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','/:id','delete','removeDispositions'];(function(_0x4dc0c8,_0x48d51f){var _0x26bf81=function(_0x1093f6){while(--_0x1093f6){_0x4dc0c8['push'](_0x4dc0c8['shift']());}};_0x26bf81(++_0x48d51f);}(_0x5899,0x6b));var _0x9589=function(_0xbd65eb,_0x56be97){_0xbd65eb=_0xbd65eb-0x0;var _0x49faf1=_0x5899[_0xbd65eb];return _0x49faf1;};'use strict';var multer=require(_0x9589('0x0'));var util=require(_0x9589('0x1'));var path=require(_0x9589('0x2'));var timeout=require(_0x9589('0x3'));var express=require(_0x9589('0x4'));var router=express[_0x9589('0x5')]();var fs_extra=require(_0x9589('0x6'));var auth=require(_0x9589('0x7'));var interaction=require(_0x9589('0x8'));var config=require(_0x9589('0x9'));var controller=require(_0x9589('0xa'));router[_0x9589('0xb')]('/',auth['isAuthenticated'](),controller[_0x9589('0xc')]);router[_0x9589('0xb')](_0x9589('0xd'),auth[_0x9589('0xe')](),controller[_0x9589('0xf')]);router[_0x9589('0xb')]('/:id',auth[_0x9589('0xe')](),controller[_0x9589('0x10')]);router[_0x9589('0xb')](_0x9589('0x11'),auth[_0x9589('0xe')](),controller[_0x9589('0x12')]);router[_0x9589('0xb')](_0x9589('0x13'),auth[_0x9589('0xe')](),controller[_0x9589('0x14')]);router[_0x9589('0xb')]('/:id/in_servers',auth[_0x9589('0xe')](),controller[_0x9589('0x15')]);router[_0x9589('0xb')](_0x9589('0x16'),auth['isAuthenticated'](),controller[_0x9589('0x17')]);router['get'](_0x9589('0x18'),auth['isAuthenticated'](),controller[_0x9589('0x19')]);router[_0x9589('0xb')](_0x9589('0x1a'),auth[_0x9589('0xe')](),controller[_0x9589('0x1b')]);router[_0x9589('0xb')](_0x9589('0x1c'),auth['isAuthenticated'](),controller[_0x9589('0x1d')]);router['get']('/:id/verify',auth['isAuthenticated'](),controller[_0x9589('0x1e')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x9589('0x1f')](_0x9589('0x11'),auth[_0x9589('0xe')](),controller['addDisposition']);router[_0x9589('0x1f')](_0x9589('0x13'),auth[_0x9589('0xe')](),controller[_0x9589('0x20')]);router['post']('/',auth[_0x9589('0xe')](),controller['create']);router[_0x9589('0x1f')](_0x9589('0x21'),auth[_0x9589('0xe')](),controller[_0x9589('0x22')]);router[_0x9589('0x1f')](_0x9589('0x16'),auth['isAuthenticated'](),controller[_0x9589('0x23')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x9589('0x24')]);router[_0x9589('0x1f')]('/:id/applications',auth[_0x9589('0xe')](),controller[_0x9589('0x25')]);router[_0x9589('0x1f')](_0x9589('0x26'),auth[_0x9589('0xe')](),controller[_0x9589('0x27')]);router[_0x9589('0x1f')](_0x9589('0x28'),auth[_0x9589('0xe')](),controller[_0x9589('0x29')]);router[_0x9589('0x2a')](_0x9589('0x2b'),auth[_0x9589('0xe')](),controller['update']);router[_0x9589('0x2c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9589('0x2d')]);router[_0x9589('0x2c')](_0x9589('0x13'),auth[_0x9589('0xe')](),controller[_0x9589('0x2e')]);router['delete'](_0x9589('0x21'),auth[_0x9589('0xe')](),controller[_0x9589('0x2f')]);router['delete']('/:id/out_servers',auth[_0x9589('0xe')](),controller['removeSmtp']);router[_0x9589('0x2c')](_0x9589('0x2b'),auth[_0x9589('0xe')](),controller[_0x9589('0x30')]);router[_0x9589('0x2c')]('/:id/users',auth[_0x9589('0xe')](),controller[_0x9589('0x31')]);module[_0x9589('0x32')]=router; \ No newline at end of file +var _0xd434=['index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/dispositions','addDisposition','post','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','/:id/users','addAgents','put','update','removeDispositions','removeAnswers','delete','removeImap','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated'];(function(_0x2c549f,_0x3c082e){var _0x42efe9=function(_0x59da6c){while(--_0x59da6c){_0x2c549f['push'](_0x2c549f['shift']());}};_0x42efe9(++_0x3c082e);}(_0xd434,0xee));var _0x4d43=function(_0x2185d7,_0x588aff){_0x2185d7=_0x2185d7-0x0;var _0x3a0c39=_0xd434[_0x2185d7];return _0x3a0c39;};'use strict';var multer=require(_0x4d43('0x0'));var util=require(_0x4d43('0x1'));var path=require('path');var timeout=require(_0x4d43('0x2'));var express=require(_0x4d43('0x3'));var router=express[_0x4d43('0x4')]();var fs_extra=require(_0x4d43('0x5'));var auth=require(_0x4d43('0x6'));var interaction=require(_0x4d43('0x7'));var config=require(_0x4d43('0x8'));var controller=require(_0x4d43('0x9'));router[_0x4d43('0xa')]('/',auth[_0x4d43('0xb')](),controller[_0x4d43('0xc')]);router['get'](_0x4d43('0xd'),auth[_0x4d43('0xb')](),controller[_0x4d43('0xe')]);router[_0x4d43('0xa')](_0x4d43('0xf'),auth['isAuthenticated'](),controller[_0x4d43('0x10')]);router[_0x4d43('0xa')]('/:id/dispositions',auth[_0x4d43('0xb')](),controller[_0x4d43('0x11')]);router[_0x4d43('0xa')](_0x4d43('0x12'),auth['isAuthenticated'](),controller[_0x4d43('0x13')]);router['get'](_0x4d43('0x14'),auth[_0x4d43('0xb')](),controller['getImap']);router[_0x4d43('0xa')]('/:id/out_servers',auth[_0x4d43('0xb')](),controller[_0x4d43('0x15')]);router[_0x4d43('0xa')](_0x4d43('0x16'),auth['isAuthenticated'](),controller[_0x4d43('0x17')]);router[_0x4d43('0xa')](_0x4d43('0x18'),auth['isAuthenticated'](),controller[_0x4d43('0x19')]);router[_0x4d43('0xa')](_0x4d43('0x1a'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x1b')]);router[_0x4d43('0xa')](_0x4d43('0x1c'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x1d')]);router[_0x4d43('0xa')]('/:id/users',auth[_0x4d43('0xb')](),controller['getAgents']);router['post'](_0x4d43('0x1e'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x1f')]);router[_0x4d43('0x20')](_0x4d43('0x12'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x21')]);router['post']('/',auth[_0x4d43('0xb')](),controller['create']);router[_0x4d43('0x20')](_0x4d43('0x14'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x22')]);router[_0x4d43('0x20')](_0x4d43('0x23'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x24')]);router[_0x4d43('0x20')](_0x4d43('0x16'),auth['isAuthenticated'](),controller[_0x4d43('0x25')]);router[_0x4d43('0x20')](_0x4d43('0x18'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x26')]);router[_0x4d43('0x20')](_0x4d43('0x27'),auth[_0x4d43('0xb')](),controller['send']);router[_0x4d43('0x20')](_0x4d43('0x28'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x29')]);router[_0x4d43('0x2a')](_0x4d43('0xf'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x2b')]);router['delete'](_0x4d43('0x1e'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x2c')]);router['delete'](_0x4d43('0x12'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x2d')]);router[_0x4d43('0x2e')](_0x4d43('0x14'),auth['isAuthenticated'](),controller[_0x4d43('0x2f')]);router[_0x4d43('0x2e')](_0x4d43('0x23'),auth['isAuthenticated'](),controller['removeSmtp']);router['delete'](_0x4d43('0xf'),auth[_0x4d43('0xb')](),controller['destroy']);router[_0x4d43('0x2e')](_0x4d43('0x28'),auth[_0x4d43('0xb')](),controller[_0x4d43('0x30')]);module[_0x4d43('0x31')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f2b7894..532b3ef 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 _0x64d4=['UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x64d4,0x186));var _0x464d=function(_0x3df205,_0x2bb24d){_0x3df205=_0x3df205-0x0;var _0x14d5d4=_0x64d4[_0x3df205];return _0x14d5d4;};'use strict';var Sequelize=require(_0x464d('0x0'));module['exports']={'description':{'type':Sequelize[_0x464d('0x1')]},'name':{'type':Sequelize[_0x464d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x464d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x464d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x464d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x464d('0x3')]},'markAsUnread':{'type':Sequelize[_0x464d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x464d('0x1')],'allowNull':![],'defaultValue':_0x464d('0x4')},'fontSize':{'type':Sequelize[_0x464d('0x5')](0x2)[_0x464d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x464d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x464d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x464d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x464d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x464d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x464d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x464d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x464d('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x464d('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x464d('0x2')],'defaultValue':![],'comment':_0x464d('0x8'),'set':function(_0x1a1226){if(!_0x1a1226)this[_0x464d('0x9')](_0x464d('0xa'),null);this[_0x464d('0x9')](_0x464d('0xb'),_0x1a1226);}},'provider':{'type':Sequelize[_0x464d('0xc')]('gmail',_0x464d('0xd'),_0x464d('0xe'),_0x464d('0xf')),'defaultValue':null,'get':function(){var _0xe06d9e=this['getDataValue'](_0x464d('0x10'));return _0xe06d9e||_0x464d('0x11');},'set':function(_0x68838d){if(_0x68838d===_0x464d('0x11')){_0x68838d=null;}return this['setDataValue'](_0x464d('0x10'),_0x68838d);}}}; \ No newline at end of file +var _0x502a=['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','outlook365','provider','custom','sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED'];(function(_0x27eddd,_0x3d2cbf){var _0x23d31d=function(_0x7ff2ba){while(--_0x7ff2ba){_0x27eddd['push'](_0x27eddd['shift']());}};_0x23d31d(++_0x3d2cbf);}(_0x502a,0xb8));var _0xa502=function(_0x3ea978,_0x127dba){_0x3ea978=_0x3ea978-0x0;var _0x59a714=_0x502a[_0x3ea978];return _0x59a714;};'use strict';var Sequelize=require(_0xa502('0x0'));module['exports']={'description':{'type':Sequelize[_0xa502('0x1')]},'name':{'type':Sequelize[_0xa502('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa502('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa502('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xa502('0x3')]},'markAsUnread':{'type':Sequelize[_0xa502('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa502('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xa502('0x4')](0x2)[_0xa502('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa502('0x3')],'defaultValue':function(){return _0xa502('0x6');}},'notificationSound':{'type':Sequelize[_0xa502('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa502('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa502('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa502('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa502('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa502('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa502('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa502('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa502('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xa502('0x2')],'defaultValue':![],'comment':_0xa502('0x8'),'set':function(_0x152f17){if(!_0x152f17)this[_0xa502('0x9')](_0xa502('0xa'),null);this[_0xa502('0x9')](_0xa502('0xb'),_0x152f17);}},'provider':{'type':Sequelize[_0xa502('0xc')](_0xa502('0xd'),_0xa502('0xe'),_0xa502('0xf'),_0xa502('0x10')),'defaultValue':null,'get':function(){var _0x59d151=this['getDataValue'](_0xa502('0x11'));return _0x59d151||_0xa502('0x12');},'set':function(_0x721edf){if(_0x721edf==='custom'){_0x721edf=null;}return this[_0xa502('0x9')](_0xa502('0x11'),_0x721edf);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index b3b033f..fe469dc 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 _0x74b1=['status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','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','show','find','catch','body','provider','custom','describe','addDisposition','params','MailAccountId','Disposition','create','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','includeAll','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','getSmtpOptions','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','sendStatus','end'];(function(_0x21ab42,_0x8ab09a){var _0x4f6351=function(_0x50a316){while(--_0x50a316){_0x21ab42['push'](_0x21ab42['shift']());}};_0x4f6351(++_0x8ab09a);}(_0x74b1,0x168));var _0x174b=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x74b1[_0x49aa7d];return _0xdd0d26;};'use strict';var moment=require(_0x174b('0x0'));var BPromise=require(_0x174b('0x1'));var util=require(_0x174b('0x2'));var path=require(_0x174b('0x3'));var _=require(_0x174b('0x4'));var juice=require('juice');var Redis=require(_0x174b('0x5'));var qs=require(_0x174b('0x6'));var logger=require(_0x174b('0x7'))(_0x174b('0x8'));var config=require(_0x174b('0x9'));var db=require(_0x174b('0xa'))['db'];config[_0x174b('0xb')]=_['defaults'](config['redis'],{'host':_0x174b('0xc'),'port':0x18eb});var socket=require(_0x174b('0xd'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x174b('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x174b('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x2245db,_0x302923,_0x12eb7b,_0x29088f){return new BPromise(function(_0xab12b,_0x556005){var _0x5a3bb6=_0x29088f||client;return _0x5a3bb6[_0x174b('0x10')](_0x2245db,_0x12eb7b)[_0x174b('0x11')](function(_0x3b8b14){logger[_0x174b('0x12')]('MailAccount,\x20%s,\x20%s',_0x302923,_0x174b('0x13'));logger[_0x174b('0x14')](_0x174b('0x15'),_0x302923,_0x174b('0x13'),JSON['stringify'](_0x3b8b14));if(_0x3b8b14[_0x174b('0x16')]){if(_0x3b8b14[_0x174b('0x16')][_0x174b('0x17')]===0x1f4){logger[_0x174b('0x16')](_0x174b('0x18'),_0x302923,_0x3b8b14[_0x174b('0x16')][_0x174b('0x19')]);return _0x556005(_0x3b8b14[_0x174b('0x16')][_0x174b('0x19')]);}logger['error'](_0x174b('0x18'),_0x302923,_0x3b8b14[_0x174b('0x16')][_0x174b('0x19')]);return _0xab12b(_0x3b8b14[_0x174b('0x16')][_0x174b('0x19')]);}else{logger[_0x174b('0x12')](_0x174b('0x18'),_0x302923,_0x174b('0x13'));_0xab12b(_0x3b8b14['result'][_0x174b('0x19')]);}})['catch'](function(_0x3c3b98){logger['error'](_0x174b('0x18'),_0x302923,_0x3c3b98);_0x556005(_0x3c3b98);});});}function respondWithStatusCode(_0x2fac47,_0x137198){_0x137198=_0x137198||0xcc;return function(_0x362181){if(_0x362181){return _0x2fac47[_0x174b('0x1a')](_0x137198);}return _0x2fac47['status'](_0x137198)[_0x174b('0x1b')]();};}function respondWithResult(_0x24460,_0x407c9b){_0x407c9b=_0x407c9b||0xc8;return function(_0x3e9037){if(_0x3e9037){return _0x24460[_0x174b('0x1c')](_0x407c9b)[_0x174b('0x1d')](_0x3e9037);}};}function respondWithFilteredResult(_0x4c9ead,_0x584066){return function(_0x27ccfe){if(_0x27ccfe){var _0x2818c4=typeof _0x584066[_0x174b('0x1e')]===_0x174b('0x1f')&&typeof _0x584066[_0x174b('0x20')]==='undefined';var _0x533862=_0x27ccfe[_0x174b('0x21')];var _0x5b34a7=_0x2818c4?0x0:_0x584066['offset'];var _0x18e4d4=_0x2818c4?_0x27ccfe['count']:_0x584066['offset']+_0x584066['limit'];var _0x5a30fb;if(_0x18e4d4>=_0x533862){_0x18e4d4=_0x533862;_0x5a30fb=0xc8;}else{_0x5a30fb=0xce;}_0x4c9ead[_0x174b('0x1c')](_0x5a30fb);return _0x4c9ead[_0x174b('0x22')](_0x174b('0x23'),_0x5b34a7+'-'+_0x18e4d4+'/'+_0x533862)[_0x174b('0x1d')](_0x27ccfe);}return null;};}function saveUpdates(_0x2eaee1){return function(_0x503b94){if(_0x503b94){return _0x503b94[_0x174b('0x24')](_0x2eaee1)[_0x174b('0x11')](function(_0x1924d9){return _0x1924d9;});}return null;};}function removeEntity(_0x577421){return function(_0x5604c7){if(_0x5604c7){return _0x5604c7[_0x174b('0x25')]()[_0x174b('0x11')](function(){var _0x16a61d=_0x5604c7[_0x174b('0x26')]({'plain':!![]});var _0x230839='MailAccounts';return db['UserProfileResource'][_0x174b('0x25')]({'where':{'type':_0x230839,'resourceId':_0x16a61d['id']}})[_0x174b('0x11')](function(){return _0x5604c7;});})[_0x174b('0x11')](function(){_0x577421['status'](0xcc)[_0x174b('0x1b')]();});}};}function handleEntityNotFound(_0x568ee4){return function(_0x29c26c){if(!_0x29c26c){_0x568ee4[_0x174b('0x1a')](0x194);}return _0x29c26c;};}function handleError(_0x204c00,_0x6889cd){_0x6889cd=_0x6889cd||0x1f4;return function(_0x5776d4){logger[_0x174b('0x16')](_0x5776d4[_0x174b('0x27')]);if(_0x5776d4[_0x174b('0x28')]){delete _0x5776d4[_0x174b('0x28')];}_0x204c00[_0x174b('0x1c')](_0x6889cd)[_0x174b('0x29')](_0x5776d4);};}function getImapHost(_0x38ec2a){switch(_0x38ec2a){case _0x174b('0x2a'):return'imap.gmail.com';case _0x174b('0x2b'):return _0x174b('0x2c');case _0x174b('0x2d'):return _0x174b('0x2e');case _0x174b('0x2f'):return _0x174b('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x38ec2a);}function getSmtpHost(_0x5be2e1){switch(_0x5be2e1){case'gmail':return'smtp.gmail.com';case _0x174b('0x2b'):return'smtp.mail.yahoo.com';case _0x174b('0x2d'):return _0x174b('0x31');case _0x174b('0x2f'):return _0x174b('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5be2e1);}function getAuthenticationOptions(_0x4d0de8,_0x4296d9){var _0x3f33eb={};var _0x2b5c89={};if(_0x4d0de8){_0x3f33eb[_0x174b('0x33')]=_0x2b5c89[_0x174b('0x33')]=_0x4296d9[_0x174b('0x34')];_0x3f33eb['password']=_0x2b5c89[_0x174b('0x35')]=_0x4296d9[_0x174b('0x36')];if(_0x4296d9[_0x174b('0x37')]){_0x3f33eb[_0x174b('0x37')]=_0x2b5c89[_0x174b('0x37')]=!![];_0x3f33eb[_0x174b('0x38')]=_0x2b5c89[_0x174b('0x38')]=_0x4296d9['CloudProviderId'];_0x3f33eb['password']=_0x2b5c89['pass']=null;}else{_0x3f33eb[_0x174b('0x38')]=_0x2b5c89[_0x174b('0x38')]=null;}_0x3f33eb[_0x174b('0x39')]=getImapHost(_0x4d0de8);_0x3f33eb['port']=0x3e1;_0x2b5c89['host']=getSmtpHost(_0x4d0de8);_0x2b5c89[_0x174b('0x3a')]=0x24b;_0x2b5c89[_0x174b('0x3b')]=![];_0x3f33eb[_0x174b('0x3c')]=_0x2b5c89[_0x174b('0x3c')]=null;}else{if(_0x4296d9['authentication']){_0x3f33eb[_0x174b('0x33')]=_0x2b5c89[_0x174b('0x33')]=_0x4296d9[_0x174b('0x34')];_0x3f33eb[_0x174b('0x36')]=_0x2b5c89[_0x174b('0x35')]=_0x4296d9[_0x174b('0x36')];}else{_0x3f33eb[_0x174b('0x3d')]=_0x2b5c89['authentication']=![];_0x3f33eb[_0x174b('0x33')]=_0x2b5c89['user']=null;_0x3f33eb['password']=_0x2b5c89['pass']=null;}_0x3f33eb[_0x174b('0x39')]=_0x4296d9[_0x174b('0x3e')][_0x174b('0x39')];_0x3f33eb['port']=_0x4296d9[_0x174b('0x3e')]['port'];_0x2b5c89['host']=_0x4296d9['Smtp']['host'];_0x2b5c89[_0x174b('0x3a')]=_0x4296d9[_0x174b('0x3f')]['port'];}return{'Imap':_0x3f33eb,'Smtp':_0x2b5c89};}exports[_0x174b('0x40')]=function(_0x46c6fd,_0x4bfb95){var _0x233c0d={'include':[{'model':db[_0x174b('0x41')],'as':_0x174b('0x3e')},{'model':db[_0x174b('0x42')],'as':_0x174b('0x3f')},{'model':db[_0x174b('0x43')],'as':_0x174b('0x44')}]},_0x2ccd79={},_0x3e1456={'count':0x0,'rows':[]};var _0x37a37b=_[_0x174b('0x45')](db[_0x174b('0x46')][_0x174b('0x47')],function(_0x399fd1){return{'name':_0x399fd1[_0x174b('0x48')],'type':_0x399fd1[_0x174b('0x49')][_0x174b('0x4a')]};});_0x2ccd79[_0x174b('0x4b')]=_[_0x174b('0x45')](_0x37a37b,_0x174b('0x28'));_0x2ccd79[_0x174b('0x4c')]=_[_0x174b('0x4d')](_0x46c6fd[_0x174b('0x4c')]);_0x2ccd79[_0x174b('0x4e')]=_[_0x174b('0x4f')](_0x2ccd79[_0x174b('0x4b')],_0x2ccd79[_0x174b('0x4c')]);_0x233c0d[_0x174b('0x50')]=_['intersection'](_0x2ccd79['model'],qs[_0x174b('0x51')](_0x46c6fd[_0x174b('0x4c')][_0x174b('0x51')]));_0x233c0d['attributes']=_0x233c0d[_0x174b('0x50')][_0x174b('0x52')]?_0x233c0d[_0x174b('0x50')]:_0x2ccd79[_0x174b('0x4b')];if(!_0x46c6fd[_0x174b('0x4c')][_0x174b('0x53')](_0x174b('0x54'))){_0x233c0d[_0x174b('0x20')]=qs['limit'](_0x46c6fd['query'][_0x174b('0x20')]);_0x233c0d['offset']=qs['offset'](_0x46c6fd[_0x174b('0x4c')][_0x174b('0x1e')]);}_0x233c0d[_0x174b('0x55')]=qs[_0x174b('0x56')](_0x46c6fd['query'][_0x174b('0x56')]);_0x233c0d[_0x174b('0x57')]=qs[_0x174b('0x4e')](_[_0x174b('0x58')](_0x46c6fd[_0x174b('0x4c')],_0x2ccd79[_0x174b('0x4e')]),_0x37a37b);if(_0x46c6fd[_0x174b('0x4c')][_0x174b('0x59')]){_0x233c0d[_0x174b('0x57')]=_[_0x174b('0x5a')](_0x233c0d['where'],{'$or':_[_0x174b('0x45')](_0x37a37b,function(_0xeee836){if(_0xeee836[_0x174b('0x49')]!==_0x174b('0x5b')){var _0x29d468={};_0x29d468[_0xeee836[_0x174b('0x28')]]={'$like':'%'+_0x46c6fd['query'][_0x174b('0x59')]+'%'};return _0x29d468;}})});}_0x233c0d=_[_0x174b('0x5a')]({},_0x233c0d,_0x46c6fd[_0x174b('0x5c')]);var _0x282245={'where':_0x233c0d[_0x174b('0x57')]};return db['MailAccount'][_0x174b('0x21')](_0x282245)[_0x174b('0x11')](function(_0x61903c){_0x3e1456[_0x174b('0x21')]=_0x61903c;if(_0x46c6fd[_0x174b('0x4c')]['includeAll']){_0x233c0d[_0x174b('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x174b('0x5e')](_0x233c0d);})['then'](function(_0x13223b){_0x3e1456[_0x174b('0x5f')]=_0x13223b;return _0x3e1456;})['then'](respondWithFilteredResult(_0x4bfb95,_0x233c0d))['catch'](handleError(_0x4bfb95,null));};exports[_0x174b('0x60')]=function(_0x1490fa,_0xef87c6){var _0x153722={'raw':![],'where':{'id':_0x1490fa['params']['id']},'include':[{'model':db[_0x174b('0x41')],'as':_0x174b('0x3e')},{'model':db[_0x174b('0x42')],'as':'Smtp'},{'model':db[_0x174b('0x43')],'as':'mandatoryDispositionPause'}]},_0x4e2e9b={};_0x4e2e9b['model']=_[_0x174b('0x4d')](db['MailAccount'][_0x174b('0x47')]);_0x4e2e9b[_0x174b('0x4c')]=_[_0x174b('0x4d')](_0x1490fa[_0x174b('0x4c')]);_0x4e2e9b['filters']=_['intersection'](_0x4e2e9b[_0x174b('0x4b')],_0x4e2e9b[_0x174b('0x4c')]);_0x153722[_0x174b('0x50')]=_[_0x174b('0x4f')](_0x4e2e9b['model'],qs[_0x174b('0x51')](_0x1490fa[_0x174b('0x4c')]['fields']));_0x153722[_0x174b('0x50')]=_0x153722[_0x174b('0x50')][_0x174b('0x52')]?_0x153722[_0x174b('0x50')]:_0x4e2e9b[_0x174b('0x4b')];if(_0x1490fa[_0x174b('0x4c')]['includeAll']){_0x153722['include']=[{'all':!![]}];}_0x153722=_[_0x174b('0x5a')]({},_0x153722,_0x1490fa[_0x174b('0x5c')]);return db[_0x174b('0x46')][_0x174b('0x61')](_0x153722)['then'](handleEntityNotFound(_0xef87c6,null))[_0x174b('0x11')](respondWithResult(_0xef87c6,null))[_0x174b('0x62')](handleError(_0xef87c6,null));};exports[_0x174b('0x24')]=function(_0x48e779,_0x4730c5){if(_0x48e779[_0x174b('0x63')]['id']){delete _0x48e779[_0x174b('0x63')]['id'];}var _0x22bea5=_0x48e779[_0x174b('0x63')][_0x174b('0x64')]===_0x174b('0x65')?null:_0x48e779[_0x174b('0x63')]['provider'];var _0x652a62=_0x48e779[_0x174b('0x63')]['Imap']||{};var _0x1e4447=_0x48e779[_0x174b('0x63')][_0x174b('0x3f')]||{};if(_0x22bea5){_0x652a62[_0x174b('0x39')]=getImapHost(_0x22bea5);_0x652a62['port']=0x3e1;_0x1e4447[_0x174b('0x39')]=getSmtpHost(_0x22bea5);_0x1e4447[_0x174b('0x3a')]=0x24b;_0x1e4447[_0x174b('0x3b')]=![];}if(_0x1e4447[_0x174b('0x37')]){_0x1e4447[_0x174b('0x3b')]=![];}else{_0x1e4447[_0x174b('0x38')]=null;}if(!_0x652a62[_0x174b('0x37')])_0x652a62[_0x174b('0x38')]=null;_0x48e779[_0x174b('0x63')][_0x174b('0x3e')]=_0x652a62;_0x48e779[_0x174b('0x63')][_0x174b('0x3f')]=_0x1e4447;return db[_0x174b('0x46')]['find']({'where':{'id':_0x48e779['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x174b('0x3e')},{'model':db[_0x174b('0x42')],'as':_0x174b('0x3f')},{'model':db[_0x174b('0x43')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4730c5,null))[_0x174b('0x11')](function(_0x4d89d9){if(!_0x4d89d9)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4d89d9['service'])delete _0x48e779[_0x174b('0x63')][_0x174b('0x3e')];return _0x4d89d9;})[_0x174b('0x11')](saveUpdates(_0x48e779['body'],null))[_0x174b('0x11')](function(_0x403b48){if(!_0x48e779[_0x174b('0x63')]['Imap'])return _0x403b48;return db[_0x174b('0x41')][_0x174b('0x24')](_0x48e779[_0x174b('0x63')][_0x174b('0x3e')],{'where':{'MailAccountId':_0x403b48['id']}})[_0x174b('0x11')](function(){return _0x403b48;});})[_0x174b('0x11')](function(_0x56eadd){if(!_0x48e779[_0x174b('0x63')]['Smtp'])return _0x56eadd;return db[_0x174b('0x42')][_0x174b('0x24')](_0x48e779[_0x174b('0x63')]['Smtp'],{'where':{'MailAccountId':_0x56eadd['id']}})[_0x174b('0x11')](function(){return _0x56eadd;});})[_0x174b('0x11')](respondWithResult(_0x4730c5,null))[_0x174b('0x62')](handleError(_0x4730c5,null));};exports['describe']=function(_0x67b4e2,_0x41e725){return db['MailAccount'][_0x174b('0x66')]()[_0x174b('0x11')](respondWithResult(_0x41e725,null))[_0x174b('0x62')](handleError(_0x41e725,null));};exports[_0x174b('0x67')]=function(_0x25de44,_0x372369){if(_0x25de44['body']['id']){delete _0x25de44[_0x174b('0x63')]['id'];}return db[_0x174b('0x46')][_0x174b('0x61')]({'where':{'id':_0x25de44[_0x174b('0x68')]['id']}})['then'](handleEntityNotFound(_0x372369,null))[_0x174b('0x11')](function(_0xa81ff3){if(_0xa81ff3){_0x25de44['body'][_0x174b('0x69')]=_0xa81ff3['id'];return db[_0x174b('0x6a')][_0x174b('0x6b')](_0x25de44['body']);}})[_0x174b('0x11')](respondWithResult(_0x372369,null))['catch'](handleError(_0x372369,null));};exports['getDispositions']=function(_0x334a33,_0x37c4c9){var _0x418214={'raw':![],'where':{}};var _0x43a5d0={};var _0x574a79={'count':0x0,'rows':[]};return db['MailAccount'][_0x174b('0x6c')]({'where':{'id':_0x334a33[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x37c4c9,null))[_0x174b('0x11')](function(_0x337f8d){if(_0x337f8d){_0x43a5d0[_0x174b('0x4b')]=_[_0x174b('0x4d')](db['Disposition'][_0x174b('0x47')]);_0x43a5d0[_0x174b('0x4c')]=_[_0x174b('0x4d')](_0x334a33[_0x174b('0x4c')]);_0x43a5d0[_0x174b('0x4e')]=_[_0x174b('0x4f')](_0x43a5d0[_0x174b('0x4b')],_0x43a5d0[_0x174b('0x4c')]);_0x418214['attributes']=_[_0x174b('0x4f')](_0x43a5d0[_0x174b('0x4b')],qs[_0x174b('0x51')](_0x334a33['query'][_0x174b('0x51')]));_0x418214[_0x174b('0x50')]=_0x418214[_0x174b('0x50')]['length']?_0x418214[_0x174b('0x50')]:_0x43a5d0[_0x174b('0x4b')];if(!_0x334a33['query'][_0x174b('0x53')](_0x174b('0x54'))){_0x418214[_0x174b('0x20')]=qs[_0x174b('0x20')](_0x334a33['query']['limit']);_0x418214['offset']=qs[_0x174b('0x1e')](_0x334a33[_0x174b('0x4c')][_0x174b('0x1e')]);}_0x418214[_0x174b('0x55')]=qs[_0x174b('0x56')](_0x334a33[_0x174b('0x4c')][_0x174b('0x56')]);_0x418214[_0x174b('0x57')]=qs['filters'](_[_0x174b('0x58')](_0x334a33['query'],_0x43a5d0[_0x174b('0x4e')]));_0x418214[_0x174b('0x57')][_0x174b('0x69')]=_0x337f8d['id'];if(_0x334a33['query'][_0x174b('0x59')]){_0x418214['where']=_['merge'](_0x418214[_0x174b('0x57')],{'$or':_[_0x174b('0x45')](_0x418214[_0x174b('0x50')],function(_0x59a14b){var _0x23c3f0={};_0x23c3f0[_0x59a14b]={'$like':'%'+_0x334a33[_0x174b('0x4c')][_0x174b('0x59')]+'%'};return _0x23c3f0;})});}_0x418214=_[_0x174b('0x5a')]({},_0x418214,_0x334a33[_0x174b('0x5c')]);return db[_0x174b('0x6a')][_0x174b('0x21')]({'where':_0x418214[_0x174b('0x57')]})[_0x174b('0x11')](function(_0x5c489a){_0x574a79[_0x174b('0x21')]=_0x5c489a;if(_0x334a33['query']['includeAll']){_0x418214[_0x174b('0x5d')]=[{'all':!![]}];}return db[_0x174b('0x6a')][_0x174b('0x5e')](_0x418214);})[_0x174b('0x11')](function(_0x5e817b){_0x574a79[_0x174b('0x5f')]=_0x5e817b;return _0x574a79;});}})[_0x174b('0x11')](respondWithFilteredResult(_0x37c4c9,_0x418214))[_0x174b('0x62')](handleError(_0x37c4c9,null));};exports[_0x174b('0x6d')]=function(_0x416753,_0x121be1){return db[_0x174b('0x46')][_0x174b('0x61')]({'where':{'id':_0x416753['params']['id']}})['then'](handleEntityNotFound(_0x121be1,null))[_0x174b('0x11')](function(_0x53b111){if(_0x53b111){return _0x53b111[_0x174b('0x6d')](_0x416753['query'][_0x174b('0x6e')]);}})[_0x174b('0x11')](respondWithStatusCode(_0x121be1,null))[_0x174b('0x62')](handleError(_0x121be1,null));};exports[_0x174b('0x6f')]=function(_0x16ddb3,_0x153c02){if(_0x16ddb3[_0x174b('0x63')]['id']){delete _0x16ddb3[_0x174b('0x63')]['id'];}return db['MailAccount'][_0x174b('0x61')]({'where':{'id':_0x16ddb3[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x153c02,null))[_0x174b('0x11')](function(_0x48fc8c){if(_0x48fc8c){_0x16ddb3[_0x174b('0x63')]['MailAccountId']=_0x48fc8c['id'];return db[_0x174b('0x70')][_0x174b('0x6b')](_0x16ddb3['body']);}})['then'](respondWithResult(_0x153c02,null))['catch'](handleError(_0x153c02,null));};exports[_0x174b('0x71')]=function(_0x2dbbb2,_0x2fb4ce){var _0x3d493d={'raw':![],'where':{}};var _0x3fc62a={};var _0x2ede69={'count':0x0,'rows':[]};return db[_0x174b('0x46')][_0x174b('0x6c')]({'where':{'id':_0x2dbbb2[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x2fb4ce,null))[_0x174b('0x11')](function(_0x100cc1){if(_0x100cc1){_0x3fc62a[_0x174b('0x4b')]=_[_0x174b('0x4d')](db[_0x174b('0x70')][_0x174b('0x47')]);_0x3fc62a['query']=_['keys'](_0x2dbbb2[_0x174b('0x4c')]);_0x3fc62a[_0x174b('0x4e')]=_['intersection'](_0x3fc62a[_0x174b('0x4b')],_0x3fc62a[_0x174b('0x4c')]);_0x3d493d['attributes']=_[_0x174b('0x4f')](_0x3fc62a['model'],qs[_0x174b('0x51')](_0x2dbbb2[_0x174b('0x4c')][_0x174b('0x51')]));_0x3d493d[_0x174b('0x50')]=_0x3d493d[_0x174b('0x50')][_0x174b('0x52')]?_0x3d493d[_0x174b('0x50')]:_0x3fc62a[_0x174b('0x4b')];if(!_0x2dbbb2[_0x174b('0x4c')][_0x174b('0x53')]('nolimit')){_0x3d493d[_0x174b('0x20')]=qs['limit'](_0x2dbbb2[_0x174b('0x4c')][_0x174b('0x20')]);_0x3d493d[_0x174b('0x1e')]=qs[_0x174b('0x1e')](_0x2dbbb2['query'][_0x174b('0x1e')]);}_0x3d493d[_0x174b('0x55')]=qs[_0x174b('0x56')](_0x2dbbb2['query']['sort']);_0x3d493d[_0x174b('0x57')]=qs[_0x174b('0x4e')](_[_0x174b('0x58')](_0x2dbbb2[_0x174b('0x4c')],_0x3fc62a[_0x174b('0x4e')]));_0x3d493d[_0x174b('0x57')][_0x174b('0x69')]=_0x100cc1['id'];if(_0x2dbbb2[_0x174b('0x4c')][_0x174b('0x59')]){_0x3d493d[_0x174b('0x57')]=_[_0x174b('0x5a')](_0x3d493d[_0x174b('0x57')],{'$or':_[_0x174b('0x45')](_0x3d493d['attributes'],function(_0x2a4716){var _0x50d650={};_0x50d650[_0x2a4716]={'$like':'%'+_0x2dbbb2[_0x174b('0x4c')]['filter']+'%'};return _0x50d650;})});}_0x3d493d=_[_0x174b('0x5a')]({},_0x3d493d,_0x2dbbb2[_0x174b('0x5c')]);return db[_0x174b('0x70')][_0x174b('0x21')]({'where':_0x3d493d[_0x174b('0x57')]})[_0x174b('0x11')](function(_0x17fbec){_0x2ede69['count']=_0x17fbec;if(_0x2dbbb2[_0x174b('0x4c')][_0x174b('0x72')]){_0x3d493d['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3d493d);})[_0x174b('0x11')](function(_0x149f74){_0x2ede69[_0x174b('0x5f')]=_0x149f74;return _0x2ede69;});}})[_0x174b('0x11')](respondWithFilteredResult(_0x2fb4ce,_0x3d493d))['catch'](handleError(_0x2fb4ce,null));};exports[_0x174b('0x73')]=function(_0x3c98ad,_0xd82753){return db['MailAccount']['find']({'where':{'id':_0x3c98ad[_0x174b('0x68')]['id']}})['then'](handleEntityNotFound(_0xd82753,null))[_0x174b('0x11')](function(_0x1334da){if(_0x1334da){return _0x1334da[_0x174b('0x73')](_0x3c98ad['query']['ids']);}})[_0x174b('0x11')](respondWithStatusCode(_0xd82753,null))[_0x174b('0x62')](handleError(_0xd82753,null));};exports[_0x174b('0x6b')]=function(_0x41af92,_0xb788a3){var _0x432151={'name':_0x41af92[_0x174b('0x63')][_0x174b('0x28')],'key':_0x41af92['body'][_0x174b('0x4a')],'provider':_0x41af92[_0x174b('0x63')][_0x174b('0x64')]===_0x174b('0x65')?null:_0x41af92['body'][_0x174b('0x64')],'email':_0x41af92[_0x174b('0x63')][_0x174b('0x74')],'ListId':_0x41af92['body'][_0x174b('0x75')],'active':!_[_0x174b('0x76')](_0x41af92[_0x174b('0x63')][_0x174b('0x77')])?_0x41af92[_0x174b('0x63')][_0x174b('0x77')]:!![],'description':_0x41af92['body'][_0x174b('0x78')]||null};var _0x3bd3d7=getAuthenticationOptions(_0x432151[_0x174b('0x64')],_0x41af92[_0x174b('0x63')]);_0x432151[_0x174b('0x3e')]=_0x3bd3d7[_0x174b('0x3e')];_0x432151[_0x174b('0x3f')]=_0x3bd3d7[_0x174b('0x3f')];return db['MailAccount']['create'](_0x432151,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x174b('0x41')],'as':'Imap'}]})[_0x174b('0x11')](function(_0xf32036){var _0x3d3215=_0x41af92[_0x174b('0x33')][_0x174b('0x26')]({'plain':!![]});if(!_0x3d3215)throw new Error(_0x174b('0x79'));if(_0x3d3215[_0x174b('0x7a')]===_0x174b('0x33')){var _0x591dfd=_0xf32036['get']({'plain':!![]});return db[_0x174b('0x7b')][_0x174b('0x61')]({'where':{'name':_0x174b('0x7c'),'userProfileId':_0x3d3215[_0x174b('0x7d')]},'raw':!![]})[_0x174b('0x11')](function(_0x2228b8){if(_0x2228b8&&_0x2228b8[_0x174b('0x7e')]===0x0){return db[_0x174b('0x7f')][_0x174b('0x6b')]({'name':_0x591dfd['name'],'resourceId':_0x591dfd['id'],'type':_0x2228b8['name'],'sectionId':_0x2228b8['id']},{})[_0x174b('0x11')](function(){return _0xf32036;});}else{return _0xf32036;}})[_0x174b('0x62')](function(_0x777f6d){logger['error'](_0x174b('0x80'),_0x777f6d);throw _0x777f6d;});}return _0xf32036;})[_0x174b('0x11')](respondWithResult(_0xb788a3,0xc9))[_0x174b('0x62')](handleError(_0xb788a3,null));};exports[_0x174b('0x81')]=function(_0x21901a,_0x4ea7b9){return db[_0x174b('0x46')][_0x174b('0x6c')]({'where':{'id':_0x21901a[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x4ea7b9,null))[_0x174b('0x11')](function(_0x4910e1){if(_0x4910e1){return _0x4910e1[_0x174b('0x81')]();}return null;})[_0x174b('0x11')](respondWithResult(_0x4ea7b9,null))[_0x174b('0x62')](handleError(_0x4ea7b9,null));};exports[_0x174b('0x82')]=function(_0x18fc56,_0x4437e3){if(_0x18fc56['body']['id']){delete _0x18fc56[_0x174b('0x63')]['id'];}return db[_0x174b('0x46')][_0x174b('0x61')]({'where':{'id':_0x18fc56[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x4437e3,null))[_0x174b('0x11')](function(_0x4e9409){if(_0x4e9409){_0x18fc56[_0x174b('0x63')][_0x174b('0x69')]=_0x4e9409['id'];return db['MailServerIn'][_0x174b('0x6b')](_0x18fc56[_0x174b('0x63')]);}})[_0x174b('0x11')](respondWithResult(_0x4437e3,null))[_0x174b('0x62')](handleError(_0x4437e3,null));};exports['removeImap']=function(_0x41940f,_0x4aaffd){return db[_0x174b('0x46')]['findOne']({'where':{'id':_0x41940f['params']['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x4aaffd,null))[_0x174b('0x11')](function(_0x212068){if(_0x212068){return _0x212068[_0x174b('0x83')](null);}return null;})[_0x174b('0x11')](respondWithStatusCode(_0x4aaffd,null))[_0x174b('0x62')](handleError(_0x4aaffd,null));};exports[_0x174b('0x84')]=function(_0x405528,_0x5d04c3){return db[_0x174b('0x46')]['findOne']({'where':{'id':_0x405528[_0x174b('0x68')]['id']}})['then'](handleEntityNotFound(_0x5d04c3,null))[_0x174b('0x11')](function(_0x34ced7){if(_0x34ced7){return _0x34ced7[_0x174b('0x84')]();}return null;})[_0x174b('0x11')](respondWithResult(_0x5d04c3,null))['catch'](handleError(_0x5d04c3,null));};exports['addSmtp']=function(_0xc19ba9,_0x1064e4){if(_0xc19ba9[_0x174b('0x63')]['id']){delete _0xc19ba9[_0x174b('0x63')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xc19ba9[_0x174b('0x68')]['id']}})['then'](handleEntityNotFound(_0x1064e4,null))[_0x174b('0x11')](function(_0x56f10c){if(_0x56f10c){_0xc19ba9['body']['MailAccountId']=_0x56f10c['id'];return db[_0x174b('0x42')][_0x174b('0x6b')](_0xc19ba9[_0x174b('0x63')]);}})[_0x174b('0x11')](respondWithResult(_0x1064e4,null))[_0x174b('0x62')](handleError(_0x1064e4,null));};exports['removeSmtp']=function(_0x441872,_0x1a771c){return db[_0x174b('0x46')][_0x174b('0x6c')]({'where':{'id':_0x441872['params']['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x1a771c,null))['then'](function(_0x3d131b){if(_0x3d131b){return _0x3d131b[_0x174b('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x1a771c,null))[_0x174b('0x62')](handleError(_0x1a771c,null));};exports[_0x174b('0x86')]=function(_0x3928b4,_0x381399){return db[_0x174b('0x87')]['find']({'where':{'id':_0x3928b4[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x381399,null))[_0x174b('0x11')](function(_0x462c49){if(_0x462c49){return _0x462c49[_0x174b('0x86')](_0x3928b4[_0x174b('0x63')][_0x174b('0x6e')],_[_0x174b('0x88')](_0x3928b4[_0x174b('0x63')],[_0x174b('0x6e'),'id'])||{});}})[_0x174b('0x11')](respondWithResult(_0x381399,null))[_0x174b('0x62')](handleError(_0x381399,null));};exports['getInteractions']=function(_0x5bafcd,_0x256679){var _0x2b5e3b={'raw':![],'where':{}};var _0x36d579={};var _0x45a0b5={'count':0x0,'rows':[]};return db[_0x174b('0x46')][_0x174b('0x6c')]({'where':{'id':_0x5bafcd['params']['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x256679,null))['then'](function(_0x367a69){if(_0x367a69){_0x36d579[_0x174b('0x4b')]=_[_0x174b('0x4d')](db[_0x174b('0x87')][_0x174b('0x47')]);_0x36d579[_0x174b('0x4c')]=_['keys'](_0x5bafcd[_0x174b('0x4c')]);_0x36d579[_0x174b('0x4e')]=_[_0x174b('0x4f')](_0x36d579['model'],_0x36d579[_0x174b('0x4c')]);_0x2b5e3b[_0x174b('0x50')]=_[_0x174b('0x4f')](_0x36d579[_0x174b('0x4b')],qs[_0x174b('0x51')](_0x5bafcd['query']['fields']));_0x2b5e3b[_0x174b('0x50')]=_0x2b5e3b['attributes']['length']?_0x2b5e3b[_0x174b('0x50')]:_0x36d579[_0x174b('0x4b')];if(!_0x5bafcd[_0x174b('0x4c')]['hasOwnProperty'](_0x174b('0x54'))){_0x2b5e3b[_0x174b('0x20')]=qs['limit'](_0x5bafcd[_0x174b('0x4c')][_0x174b('0x20')]);_0x2b5e3b[_0x174b('0x1e')]=qs[_0x174b('0x1e')](_0x5bafcd[_0x174b('0x4c')][_0x174b('0x1e')]);}_0x2b5e3b[_0x174b('0x55')]=qs[_0x174b('0x56')](_0x5bafcd[_0x174b('0x4c')][_0x174b('0x56')]);_0x2b5e3b[_0x174b('0x57')]=qs['filters'](_[_0x174b('0x58')](_0x5bafcd['query'],_0x36d579[_0x174b('0x4e')]));_0x2b5e3b[_0x174b('0x57')][_0x174b('0x69')]=_0x367a69['id'];if(_0x5bafcd[_0x174b('0x4c')][_0x174b('0x59')]){_0x2b5e3b[_0x174b('0x57')]=_[_0x174b('0x5a')](_0x2b5e3b[_0x174b('0x57')],{'$or':_[_0x174b('0x45')](_0x2b5e3b[_0x174b('0x50')],function(_0x544bbe){var _0x37d636={};_0x37d636[_0x544bbe]={'$like':'%'+_0x5bafcd[_0x174b('0x4c')][_0x174b('0x59')]+'%'};return _0x37d636;})});}_0x2b5e3b=_[_0x174b('0x5a')]({},_0x2b5e3b,_0x5bafcd[_0x174b('0x5c')]);return db['MailInteraction']['count']({'where':_0x2b5e3b[_0x174b('0x57')]})[_0x174b('0x11')](function(_0x5bdcd0){_0x45a0b5[_0x174b('0x21')]=_0x5bdcd0;if(_0x5bafcd['query'][_0x174b('0x72')]){_0x2b5e3b[_0x174b('0x5d')]=[{'model':db[_0x174b('0x89')],'as':_0x174b('0x8a'),'required':![]},{'model':db[_0x174b('0x8b')],'as':_0x174b('0x8c'),'attributes':[_0x174b('0x28'),_0x174b('0x8d'),_0x174b('0x8e')],'required':![]},{'model':db[_0x174b('0x8f')],'as':_0x174b('0x90'),'attributes':['id',_0x174b('0x28'),'color'],'where':_0x5bafcd[_0x174b('0x4c')][_0x174b('0x91')]?{'id':_0x5bafcd[_0x174b('0x4c')]['tag']}:undefined,'required':_0x5bafcd['query'][_0x174b('0x91')]?!![]:![]}];}return db['MailInteraction'][_0x174b('0x5e')](_0x2b5e3b);})[_0x174b('0x11')](function(_0x1779da){_0x45a0b5[_0x174b('0x5f')]=_0x1779da;return _0x45a0b5;});}})['then'](respondWithFilteredResult(_0x256679,_0x2b5e3b))[_0x174b('0x62')](handleError(_0x256679,null));};exports[_0x174b('0x92')]=function addApplications(_0x28a05f,_0x2708a1){var _0xd35661=_0x28a05f['params']['id'];var _0x39ee35=_0x28a05f['body'];var _0x53ad8e=0xc8;var _0x4ad8ea=null;return db[_0x174b('0x93')][_0x174b('0x94')]({'isolationLevel':db['sequelize'][_0x174b('0x95')][_0x174b('0x96')][_0x174b('0x97')]},function(_0x10639c){return db[_0x174b('0x46')]['findOne']({'where':{'id':_0xd35661},'transaction':_0x10639c})['then'](function(_0x5c57fe){if(_0x5c57fe){return db[_0x174b('0x98')][_0x174b('0x25')]({'where':{'MailAccountId':_0xd35661},'transaction':_0x10639c})['then'](function(){var _0xb4020e=_['map'](_0x39ee35,function(_0x1f4179){_0x1f4179['MailAccountId']=_0xd35661;return _0x1f4179;});return db[_0x174b('0x98')]['bulkCreate'](_0xb4020e,{'transaction':_0x10639c});});}else{_0x53ad8e=0x194;_0x4ad8ea=[];}});})[_0x174b('0x11')](function(){if(_0x53ad8e!==0x194){return db['MailApplication'][_0x174b('0x99')]({'where':{'MailAccountId':_0xd35661},'order':_0x174b('0x9a')})[_0x174b('0x11')](function(_0x38772a){_0x4ad8ea=_0x38772a;});}})[_0x174b('0x62')](function(_0x558f9a){_0x53ad8e=0x1f4;logger['error'](_0x558f9a[_0x174b('0x27')]);if(_0x558f9a[_0x174b('0x28')]){delete _0x558f9a[_0x174b('0x28')];}_0x4ad8ea=_0x558f9a;})[_0x174b('0x9b')](function(){if(_0x4ad8ea===null){_0x2708a1[_0x174b('0x1a')](_0x53ad8e);}else{if(_0x53ad8e===0x1f4){_0x2708a1[_0x174b('0x1c')](_0x53ad8e)[_0x174b('0x29')](_0x4ad8ea);}else{_0x2708a1['status'](_0x53ad8e)['json'](_0x4ad8ea);}}});};exports[_0x174b('0x9c')]=function(_0x2d66e2,_0x4f2291){var _0x485da3={};var _0x194802={};var _0xff78e7;var _0x378044;return db['MailAccount']['findOne']({'where':{'id':_0x2d66e2['params']['id']}})['then'](handleEntityNotFound(_0x4f2291,null))[_0x174b('0x11')](function(_0x319e95){if(_0x319e95){_0xff78e7=_0x319e95;_0x194802[_0x174b('0x4b')]=_[_0x174b('0x4d')](db['MailApplication'][_0x174b('0x47')]);_0x194802['query']=_[_0x174b('0x4d')](_0x2d66e2[_0x174b('0x4c')]);_0x194802[_0x174b('0x4e')]=_[_0x174b('0x4f')](_0x194802[_0x174b('0x4b')],_0x194802[_0x174b('0x4c')]);_0x485da3[_0x174b('0x50')]=_['intersection'](_0x194802[_0x174b('0x4b')],qs[_0x174b('0x51')](_0x2d66e2[_0x174b('0x4c')][_0x174b('0x51')]));_0x485da3[_0x174b('0x50')]=_0x485da3[_0x174b('0x50')][_0x174b('0x52')]?_0x485da3[_0x174b('0x50')]:_0x194802[_0x174b('0x4b')];_0x485da3[_0x174b('0x55')]=qs['sort'](_0x2d66e2[_0x174b('0x4c')][_0x174b('0x56')]);_0x485da3[_0x174b('0x57')]=qs['filters'](_[_0x174b('0x58')](_0x2d66e2[_0x174b('0x4c')],_0x194802['filters']));if(_0x2d66e2[_0x174b('0x4c')][_0x174b('0x59')]){_0x485da3[_0x174b('0x57')]=_[_0x174b('0x5a')](_0x485da3[_0x174b('0x57')],{'$or':_['map'](_0x485da3[_0x174b('0x50')],function(_0x46ece7){var _0x14d591={};_0x14d591[_0x46ece7]={'$like':'%'+_0x2d66e2[_0x174b('0x4c')][_0x174b('0x59')]+'%'};return _0x14d591;})});}_0x485da3=_[_0x174b('0x5a')]({},_0x485da3,_0x2d66e2[_0x174b('0x5c')]);return _0xff78e7[_0x174b('0x9c')](_0x485da3);}})[_0x174b('0x11')](function(_0x4a9fab){if(_0x4a9fab){_0x378044=_0x4a9fab[_0x174b('0x52')];if(!_0x2d66e2[_0x174b('0x4c')]['hasOwnProperty']('nolimit')){_0x485da3[_0x174b('0x20')]=qs[_0x174b('0x20')](_0x2d66e2[_0x174b('0x4c')][_0x174b('0x20')]);_0x485da3[_0x174b('0x1e')]=qs[_0x174b('0x1e')](_0x2d66e2['query']['offset']);}return _0xff78e7[_0x174b('0x9c')](_0x485da3);}})[_0x174b('0x11')](function(_0x4a070c){if(_0x4a070c){return _0x4a070c?{'count':_0x378044,'rows':_0x4a070c}:null;}})[_0x174b('0x11')](respondWithResult(_0x4f2291,null))[_0x174b('0x62')](handleError(_0x4f2291,null));};exports[_0x174b('0x9d')]=function(_0x40fed1,_0x4de0fb){var _0x379f94={'raw':!![],'where':{}};var _0x4825c6={};var _0x46c5bd={'count':0x0,'rows':[]};return db[_0x174b('0x46')][_0x174b('0x6c')]({'where':{'id':_0x40fed1[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x4de0fb,null))[_0x174b('0x11')](function(_0x5010ac){if(_0x5010ac){_0x4825c6[_0x174b('0x4b')]=_['keys'](db[_0x174b('0x9e')]['rawAttributes']);_0x4825c6['query']=_[_0x174b('0x4d')](_0x40fed1[_0x174b('0x4c')]);_0x4825c6[_0x174b('0x4e')]=_[_0x174b('0x4f')](_0x4825c6['model'],_0x4825c6[_0x174b('0x4c')]);_0x379f94[_0x174b('0x50')]=_[_0x174b('0x4f')](_0x4825c6[_0x174b('0x4b')],qs[_0x174b('0x51')](_0x40fed1['query'][_0x174b('0x51')]));_0x379f94[_0x174b('0x50')]=_0x379f94[_0x174b('0x50')][_0x174b('0x52')]?_0x379f94[_0x174b('0x50')]:_0x4825c6[_0x174b('0x4b')];if(!_0x40fed1['query'][_0x174b('0x53')]('nolimit')){_0x379f94[_0x174b('0x20')]=qs[_0x174b('0x20')](_0x40fed1[_0x174b('0x4c')][_0x174b('0x20')]);_0x379f94[_0x174b('0x1e')]=qs[_0x174b('0x1e')](_0x40fed1[_0x174b('0x4c')]['offset']);}_0x379f94[_0x174b('0x55')]=qs[_0x174b('0x56')](_0x40fed1[_0x174b('0x4c')][_0x174b('0x56')]);_0x379f94[_0x174b('0x57')]=qs[_0x174b('0x4e')](_[_0x174b('0x58')](_0x40fed1[_0x174b('0x4c')],_0x4825c6[_0x174b('0x4e')]));_0x379f94[_0x174b('0x57')][_0x174b('0x69')]=_0x5010ac['id'];if(_0x40fed1[_0x174b('0x4c')][_0x174b('0x59')]){_0x379f94[_0x174b('0x57')]=_[_0x174b('0x5a')](_0x379f94[_0x174b('0x57')],{'$or':_[_0x174b('0x45')](_0x379f94['attributes'],function(_0x9dfcc1){var _0x4f9610={};_0x4f9610[_0x9dfcc1]={'$like':'%'+_0x40fed1[_0x174b('0x4c')]['filter']+'%'};return _0x4f9610;})});}if(_0x40fed1[_0x174b('0x4c')][_0x174b('0x9f')]){var _0x2e2581=_0x40fed1[_0x174b('0x4c')][_0x174b('0x9f')][_0x174b('0xa0')](',');var _0x4f193b={};_0x4f193b[_0x2e2581[0x0]]={'$gte':moment(_0x2e2581[0x1])[_0x174b('0xa1')](_0x174b('0xa2'))};_0x379f94[_0x174b('0x57')]=_[_0x174b('0x5a')](_0x379f94[_0x174b('0x57')],_0x4f193b);}_0x379f94=_['merge']({},_0x379f94,_0x40fed1[_0x174b('0x5c')]);return db[_0x174b('0x9e')][_0x174b('0x21')]({'where':_0x379f94[_0x174b('0x57')]})[_0x174b('0x11')](function(_0x4eb3e1){_0x46c5bd[_0x174b('0x21')]=_0x4eb3e1;if(_0x40fed1[_0x174b('0x4c')][_0x174b('0x72')]){_0x379f94[_0x174b('0x5d')]=[{'all':!![]}];}return db[_0x174b('0x9e')][_0x174b('0x5e')](_0x379f94);})[_0x174b('0x11')](function(_0x48724d){if(_0x40fed1[_0x174b('0x4c')]['inlineCss']===_0x174b('0xa3')){for(var _0x27d412=0x0;_0x27d412<_0x48724d[_0x174b('0x52')];_0x27d412++){_0x48724d[_0x27d412]['body']=juice(_0x48724d[_0x27d412][_0x174b('0x63')]);}}_0x46c5bd[_0x174b('0x5f')]=_0x48724d;return _0x46c5bd;});}})['then'](respondWithFilteredResult(_0x4de0fb,_0x379f94))[_0x174b('0x62')](handleError(_0x4de0fb,null));};exports[_0x174b('0x29')]=function(_0x168d0e,_0x302b27){var _0x2c625f,_0x20aac6={},_0x3da0e3;if(_0x168d0e[_0x174b('0x63')]['to']){_0x3da0e3=_0x168d0e['body']['to'][_0x174b('0xa0')](',')[0x0];}return db[_0x174b('0x46')]['find']({'where':{'id':_0x168d0e[_0x174b('0x68')]['id']},'include':[{'model':db[_0x174b('0xa4')],'as':_0x174b('0xa5'),'include':[{'model':db[_0x174b('0x89')],'as':_0x174b('0xa6'),'where':{'email':_0x3da0e3},'limit':0x1,'order':[['updatedAt',_0x174b('0xa7')]]}]},{'model':db[_0x174b('0x42')],'as':_0x174b('0x3f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x174b('0xa8'),'raw':!![]}]}]})[_0x174b('0x11')](handleEntityNotFound(_0x302b27,null))[_0x174b('0x11')](function(_0x4d883f){if(!_0x4d883f)return;_0x2c625f=_0x4d883f;if(!_0x4d883f[_0x174b('0x3f')])throw new Error(_0x174b('0xa9'));if(_[_0x174b('0x76')](_0x168d0e[_0x174b('0x63')][_0x174b('0xaa')])){_0x168d0e[_0x174b('0x63')]['from']=util[_0x174b('0xa1')](_0x174b('0xab'),_0x4d883f[_0x174b('0x28')],_0x4d883f['email']||_0x4d883f[_0x174b('0x3f')][_0x174b('0x33')]);}if(_0x168d0e[_0x174b('0x63')][_0x174b('0xac')]&&_0x168d0e[_0x174b('0x63')][_0x174b('0xac')][_0x174b('0x52')]){for(var _0x2d2290=0x0;_0x2d2290<_0x168d0e[_0x174b('0x63')][_0x174b('0xac')][_0x174b('0x52')];_0x2d2290+=0x1){_0x168d0e[_0x174b('0x63')][_0x174b('0xac')][_0x2d2290]={'filename':_0x168d0e['body'][_0x174b('0xac')][_0x2d2290]['name'],'path':path[_0x174b('0xad')](config[_0x174b('0xae')],_0x174b('0xaf'),_0x168d0e[_0x174b('0x63')][_0x174b('0xac')][_0x2d2290]['basename'])};}}var _0x3aadbf=_0x4d883f['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x174b('0xb0'),{'account':_0x3aadbf,'message':_0x168d0e['body']});})[_0x174b('0x11')](function(_0x44e38d){if(!_0x44e38d)return;_0x20aac6=_0x44e38d;if(!_0x2c625f['List'])throw new Error(_0x174b('0xb1'));if(_0x2c625f[_0x174b('0xa5')][_0x174b('0xa6')][_0x174b('0x52')])return _0x2c625f[_0x174b('0xa5')][_0x174b('0xa6')][0x0];return db['CmContact'][_0x174b('0x6b')](_['defaults'](_0x168d0e['body'],{'firstName':_0x168d0e['body']['to'],'email':_0x168d0e[_0x174b('0x63')]['to'],'phone':_0x168d0e[_0x174b('0x63')]['to'],'ListId':_0x2c625f[_0x174b('0x75')]}));})[_0x174b('0x11')](function(_0x1a6a96){if(!_0x1a6a96)return;var _0x3942d2={'UserId':_0x168d0e[_0x174b('0x33')]['id'],'ContactId':_0x1a6a96['id'],'MailAccountId':_0x2c625f['id'],'inReplyTo':_0x20aac6[_0x174b('0xb2')],'to':_0x168d0e[_0x174b('0x63')]['from'],'cc':_0x168d0e['body']['cc'],'subject':_0x168d0e['body'][_0x174b('0xb3')],'attach':_0x168d0e[_0x174b('0x63')][_0x174b('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x174b('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x174b('0xb5'),'Messages':[_[_0x174b('0x5a')](_0x168d0e[_0x174b('0x63')],{'messageId':_0x20aac6[_0x174b('0xb2')],'sentAt':moment()[_0x174b('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2c625f['id'],'UserId':_0x168d0e[_0x174b('0x33')]['id'],'ContactId':_0x1a6a96['id']})]};if(_0x168d0e[_0x174b('0x63')][_0x174b('0xb6')]){_0x3942d2=_['merge'](_0x3942d2,_0x168d0e['body'][_0x174b('0xb6')]);}return db['MailInteraction'][_0x174b('0x6b')](_0x3942d2,{'include':[{'model':db[_0x174b('0x9e')],'as':'Messages'}]});})[_0x174b('0x11')](respondWithResult(_0x302b27,null))['catch'](handleError(_0x302b27,null));};exports['verifySmtp']=function(_0x9f6c67,_0x1a47db){return db[_0x174b('0x46')][_0x174b('0x61')]({'where':{'id':_0x9f6c67[_0x174b('0x68')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x174b('0x3f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x174b('0xa8'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1a47db,null))['then'](function(_0x948fe8){if(!_0x948fe8[_0x174b('0x3f')])return;var _0x30a27d=_0x948fe8[_0x174b('0xb7')]();return respondWithRpcPromise(_0x174b('0xb8'),_0x174b('0xb9'),{'account':_0x30a27d});})[_0x174b('0x11')](respondWithResult(_0x1a47db,null))[_0x174b('0x62')](handleError(_0x1a47db,null));};exports[_0x174b('0x25')]=function(_0x4b8379,_0xe35742){return db['MailAccount'][_0x174b('0x61')]({'where':{'id':_0x4b8379[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0xe35742,null))[_0x174b('0x11')](function(_0x334e8f){if(_0x334e8f&&_0x334e8f[_0x174b('0x3c')]){throw new db[(_0x174b('0xba'))]['ValidationError'](_0x174b('0xbb'));}return _0x334e8f;})[_0x174b('0x11')](removeEntity(_0xe35742,null))[_0x174b('0x62')](handleError(_0xe35742,null));};exports['addAgents']=function(_0x906f96,_0x2acfe7){return db['MailAccount'][_0x174b('0x61')]({'where':{'id':_0x906f96['params']['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x2acfe7,null))[_0x174b('0x11')](function(_0x43a0c9){if(_0x43a0c9){return _0x43a0c9['addAgents'](_0x906f96[_0x174b('0x63')][_0x174b('0x6e')],_[_0x174b('0x88')](_0x906f96[_0x174b('0x63')],['ids','id'])||{})[_0x174b('0xbc')](function(_0x48ad65){for(var _0x239feb=0x0;_0x239feb<_0x906f96['body'][_0x174b('0x6e')]['length'];_0x239feb+=0x1){socket[_0x174b('0xbd')]('userMailAccount:save',{'UserId':Number(_0x906f96[_0x174b('0x63')][_0x174b('0x6e')][_0x239feb]),'MailAccountId':Number(_0x906f96[_0x174b('0x68')]['id'])});}return _0x48ad65;});}})[_0x174b('0x11')](respondWithResult(_0x2acfe7,null))[_0x174b('0x62')](handleError(_0x2acfe7,null));};exports[_0x174b('0xbe')]=function(_0x3103aa,_0x3f7f33){return db['MailAccount'][_0x174b('0x61')]({'where':{'id':_0x3103aa[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x3f7f33,null))[_0x174b('0x11')](function(_0x4af16d){if(_0x4af16d){return _0x4af16d['removeAgents'](_0x3103aa[_0x174b('0x4c')][_0x174b('0x6e')])[_0x174b('0x11')](function(){if(_[_0x174b('0xbf')](_0x3103aa[_0x174b('0x4c')]['ids'])){for(var _0x31fcd1=0x0;_0x31fcd1<_0x3103aa['query']['ids'][_0x174b('0x52')];_0x31fcd1+=0x1){socket[_0x174b('0xbd')](_0x174b('0xc0'),{'UserId':Number(_0x3103aa['query'][_0x174b('0x6e')][_0x31fcd1]),'MailAccountId':Number(_0x3103aa[_0x174b('0x68')]['id'])});}}else{socket[_0x174b('0xbd')](_0x174b('0xc0'),{'UserId':Number(_0x3103aa[_0x174b('0x4c')]['ids']),'MailAccountId':Number(_0x3103aa['params']['id'])});}});}})[_0x174b('0x11')](respondWithStatusCode(_0x3f7f33,null))[_0x174b('0x62')](handleError(_0x3f7f33,null));};exports[_0x174b('0xc1')]=function(_0xdd94a9,_0x17eb84){var _0x1be6c3={};var _0x421e5b={};var _0x9000a4;var _0x494a0e;return db['MailAccount'][_0x174b('0x6c')]({'where':{'id':_0xdd94a9[_0x174b('0x68')]['id']}})[_0x174b('0x11')](handleEntityNotFound(_0x17eb84,null))['then'](function(_0x3ef729){if(_0x3ef729){_0x9000a4=_0x3ef729;_0x421e5b[_0x174b('0x4b')]=_['keys'](db[_0x174b('0x8b')]['rawAttributes']);_0x421e5b[_0x174b('0x4c')]=_[_0x174b('0x4d')](_0xdd94a9[_0x174b('0x4c')]);_0x421e5b[_0x174b('0x4e')]=_[_0x174b('0x4f')](_0x421e5b[_0x174b('0x4b')],_0x421e5b[_0x174b('0x4c')]);_0x1be6c3[_0x174b('0x50')]=_[_0x174b('0x4f')](_0x421e5b[_0x174b('0x4b')],qs[_0x174b('0x51')](_0xdd94a9['query'][_0x174b('0x51')]));_0x1be6c3[_0x174b('0x50')]=_0x1be6c3[_0x174b('0x50')][_0x174b('0x52')]?_0x1be6c3[_0x174b('0x50')]:_0x421e5b[_0x174b('0x4b')];_0x1be6c3[_0x174b('0x55')]=qs['sort'](_0xdd94a9['query'][_0x174b('0x56')]);_0x1be6c3[_0x174b('0x57')]=qs[_0x174b('0x4e')](_[_0x174b('0x58')](_0xdd94a9[_0x174b('0x4c')],_0x421e5b[_0x174b('0x4e')]));if(_0xdd94a9[_0x174b('0x4c')][_0x174b('0x59')]){_0x1be6c3[_0x174b('0x57')]=_[_0x174b('0x5a')](_0x1be6c3[_0x174b('0x57')],{'$or':_[_0x174b('0x45')](_0x1be6c3[_0x174b('0x50')],function(_0x2f872e){var _0x2edaf1={};_0x2edaf1[_0x2f872e]={'$like':'%'+_0xdd94a9[_0x174b('0x4c')]['filter']+'%'};return _0x2edaf1;})});}_0x1be6c3=_['merge']({},_0x1be6c3,_0xdd94a9[_0x174b('0x5c')]);return _0x9000a4[_0x174b('0xc1')](_0x1be6c3);}})[_0x174b('0x11')](function(_0x413434){if(_0x413434){_0x494a0e=_0x413434['length'];if(!_0xdd94a9[_0x174b('0x4c')][_0x174b('0x53')](_0x174b('0x54'))){_0x1be6c3[_0x174b('0x20')]=qs[_0x174b('0x20')](_0xdd94a9[_0x174b('0x4c')][_0x174b('0x20')]);_0x1be6c3[_0x174b('0x1e')]=qs[_0x174b('0x1e')](_0xdd94a9[_0x174b('0x4c')][_0x174b('0x1e')]);}return _0x9000a4[_0x174b('0xc1')](_0x1be6c3);}})['then'](function(_0xb7e93b){if(_0xb7e93b){return _0xb7e93b?{'count':_0x494a0e,'rows':_0xb7e93b}:null;}})[_0x174b('0x11')](respondWithResult(_0x17eb84,null))['catch'](handleError(_0x17eb84,null));}; \ No newline at end of file +var _0xcad6=['addSmtp','removeSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','send','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','UserProfileResource','end','stack','name','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','map','MailAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','MailServerIn','Pause','keys','merge','find','body','provider','custom','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','Disposition','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','key','email','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp'];(function(_0xa013a4,_0x2ff249){var _0x27f4a2=function(_0x1a5a6f){while(--_0x1a5a6f){_0xa013a4['push'](_0xa013a4['shift']());}};_0x27f4a2(++_0x2ff249);}(_0xcad6,0x101));var _0x6cad=function(_0x1f6aa2,_0xa7762c){_0x1f6aa2=_0x1f6aa2-0x0;var _0x946ab5=_0xcad6[_0x1f6aa2];return _0x946ab5;};'use strict';var moment=require(_0x6cad('0x0'));var BPromise=require(_0x6cad('0x1'));var util=require(_0x6cad('0x2'));var path=require(_0x6cad('0x3'));var _=require(_0x6cad('0x4'));var juice=require(_0x6cad('0x5'));var Redis=require(_0x6cad('0x6'));var qs=require(_0x6cad('0x7'));var logger=require(_0x6cad('0x8'))(_0x6cad('0x9'));var config=require('../../config/environment');var db=require(_0x6cad('0xa'))['db'];config[_0x6cad('0xb')]=_[_0x6cad('0xc')](config[_0x6cad('0xb')],{'host':_0x6cad('0xd'),'port':0x18eb});var socket=require(_0x6cad('0xe'))(new Redis(config[_0x6cad('0xb')]));require(_0x6cad('0xf'))['register'](socket);var jayson=require(_0x6cad('0x10'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x122fdf,_0x42107b,_0x12ea72,_0x2b40a9){return new BPromise(function(_0x262fa6,_0x5046a3){var _0x404d50=_0x2b40a9||client;return _0x404d50[_0x6cad('0x11')](_0x122fdf,_0x12ea72)['then'](function(_0xf4fe20){logger[_0x6cad('0x12')](_0x6cad('0x13'),_0x42107b,_0x6cad('0x14'));logger[_0x6cad('0x15')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x42107b,_0x6cad('0x14'),JSON[_0x6cad('0x16')](_0xf4fe20));if(_0xf4fe20['error']){if(_0xf4fe20['error']['code']===0x1f4){logger[_0x6cad('0x17')](_0x6cad('0x13'),_0x42107b,_0xf4fe20['error'][_0x6cad('0x18')]);return _0x5046a3(_0xf4fe20['error']['message']);}logger[_0x6cad('0x17')]('MailAccount,\x20%s,\x20%s',_0x42107b,_0xf4fe20[_0x6cad('0x17')][_0x6cad('0x18')]);return _0x262fa6(_0xf4fe20['error'][_0x6cad('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x42107b,'request\x20sent');_0x262fa6(_0xf4fe20['result'][_0x6cad('0x18')]);}})[_0x6cad('0x19')](function(_0x417693){logger['error'](_0x6cad('0x13'),_0x42107b,_0x417693);_0x5046a3(_0x417693);});});}function respondWithStatusCode(_0x5d5a77,_0x520e66){_0x520e66=_0x520e66||0xcc;return function(_0x2e7ad2){if(_0x2e7ad2){return _0x5d5a77[_0x6cad('0x1a')](_0x520e66);}return _0x5d5a77[_0x6cad('0x1b')](_0x520e66)['end']();};}function respondWithResult(_0x25ed12,_0xb59bfb){_0xb59bfb=_0xb59bfb||0xc8;return function(_0x1abd94){if(_0x1abd94){return _0x25ed12[_0x6cad('0x1b')](_0xb59bfb)['json'](_0x1abd94);}};}function respondWithFilteredResult(_0x265a9a,_0x50f40d){return function(_0x4b7a9e){if(_0x4b7a9e){var _0x500469=typeof _0x50f40d[_0x6cad('0x1c')]===_0x6cad('0x1d')&&typeof _0x50f40d['limit']===_0x6cad('0x1d');var _0x4f9a4a=_0x4b7a9e[_0x6cad('0x1e')];var _0x464fd5=_0x500469?0x0:_0x50f40d[_0x6cad('0x1c')];var _0xad78d7=_0x500469?_0x4b7a9e[_0x6cad('0x1e')]:_0x50f40d[_0x6cad('0x1c')]+_0x50f40d[_0x6cad('0x1f')];var _0x48aceb;if(_0xad78d7>=_0x4f9a4a){_0xad78d7=_0x4f9a4a;_0x48aceb=0xc8;}else{_0x48aceb=0xce;}_0x265a9a['status'](_0x48aceb);return _0x265a9a[_0x6cad('0x20')](_0x6cad('0x21'),_0x464fd5+'-'+_0xad78d7+'/'+_0x4f9a4a)[_0x6cad('0x22')](_0x4b7a9e);}return null;};}function saveUpdates(_0x4322cc){return function(_0x169cc2){if(_0x169cc2){return _0x169cc2[_0x6cad('0x23')](_0x4322cc)[_0x6cad('0x24')](function(_0x3182d2){return _0x3182d2;});}return null;};}function removeEntity(_0x4c1482){return function(_0x3eadc2){if(_0x3eadc2){return _0x3eadc2[_0x6cad('0x25')]()[_0x6cad('0x24')](function(){var _0x3caf8c=_0x3eadc2['get']({'plain':!![]});var _0xaa29a8='MailAccounts';return db[_0x6cad('0x26')][_0x6cad('0x25')]({'where':{'type':_0xaa29a8,'resourceId':_0x3caf8c['id']}})['then'](function(){return _0x3eadc2;});})[_0x6cad('0x24')](function(){_0x4c1482[_0x6cad('0x1b')](0xcc)[_0x6cad('0x27')]();});}};}function handleEntityNotFound(_0x27ec6e){return function(_0x157a8f){if(!_0x157a8f){_0x27ec6e[_0x6cad('0x1a')](0x194);}return _0x157a8f;};}function handleError(_0x53ae9f,_0x3df408){_0x3df408=_0x3df408||0x1f4;return function(_0x12d53c){logger[_0x6cad('0x17')](_0x12d53c[_0x6cad('0x28')]);if(_0x12d53c['name']){delete _0x12d53c[_0x6cad('0x29')];}_0x53ae9f[_0x6cad('0x1b')](_0x3df408)['send'](_0x12d53c);};}function getImapHost(_0x556ec9){switch(_0x556ec9){case'gmail':return _0x6cad('0x2a');case _0x6cad('0x2b'):return _0x6cad('0x2c');case _0x6cad('0x2d'):return _0x6cad('0x2e');case'outlook365':return _0x6cad('0x2f');}throw new Error('Unknown\x20email\x20service\x20provider',_0x556ec9);}function getSmtpHost(_0x4561c1){switch(_0x4561c1){case'gmail':return _0x6cad('0x30');case _0x6cad('0x2b'):return _0x6cad('0x31');case _0x6cad('0x2d'):return _0x6cad('0x32');case'outlook365':return'smtp.office365.com';}throw new Error(_0x6cad('0x33'),_0x4561c1);}function getAuthenticationOptions(_0x5c7ca2,_0x5d79ec){var _0x11a7dc={};var _0x52ba4e={};if(_0x5c7ca2){_0x11a7dc[_0x6cad('0x34')]=_0x52ba4e[_0x6cad('0x34')]=_0x5d79ec[_0x6cad('0x35')];_0x11a7dc[_0x6cad('0x36')]=_0x52ba4e[_0x6cad('0x37')]=_0x5d79ec[_0x6cad('0x36')];if(_0x5d79ec['modernAuthentication']){_0x11a7dc[_0x6cad('0x38')]=_0x52ba4e[_0x6cad('0x38')]=!![];_0x11a7dc[_0x6cad('0x39')]=_0x52ba4e['CloudProviderId']=_0x5d79ec[_0x6cad('0x39')];_0x11a7dc[_0x6cad('0x36')]=_0x52ba4e['pass']=null;}else{_0x11a7dc[_0x6cad('0x39')]=_0x52ba4e[_0x6cad('0x39')]=null;}_0x11a7dc[_0x6cad('0x3a')]=getImapHost(_0x5c7ca2);_0x11a7dc['port']=0x3e1;_0x52ba4e[_0x6cad('0x3a')]=getSmtpHost(_0x5c7ca2);_0x52ba4e[_0x6cad('0x3b')]=0x24b;_0x52ba4e[_0x6cad('0x3c')]=![];_0x11a7dc[_0x6cad('0x3d')]=_0x52ba4e[_0x6cad('0x3d')]=null;}else{if(_0x5d79ec['authentication']){_0x11a7dc[_0x6cad('0x34')]=_0x52ba4e['user']=_0x5d79ec[_0x6cad('0x35')];_0x11a7dc['password']=_0x52ba4e[_0x6cad('0x37')]=_0x5d79ec[_0x6cad('0x36')];}else{_0x11a7dc[_0x6cad('0x3e')]=_0x52ba4e['authentication']=![];_0x11a7dc['user']=_0x52ba4e[_0x6cad('0x34')]=null;_0x11a7dc[_0x6cad('0x36')]=_0x52ba4e[_0x6cad('0x37')]=null;}_0x11a7dc['host']=_0x5d79ec[_0x6cad('0x3f')]['host'];_0x11a7dc[_0x6cad('0x3b')]=_0x5d79ec['Imap']['port'];_0x52ba4e[_0x6cad('0x3a')]=_0x5d79ec[_0x6cad('0x40')][_0x6cad('0x3a')];_0x52ba4e['port']=_0x5d79ec[_0x6cad('0x40')][_0x6cad('0x3b')];}return{'Imap':_0x11a7dc,'Smtp':_0x52ba4e};}exports[_0x6cad('0x41')]=function(_0x170ae0,_0x33c632){var _0x1addcf={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x6cad('0x42')],'as':_0x6cad('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2a8133={},_0x2a9465={'count':0x0,'rows':[]};var _0x5a9a87=_[_0x6cad('0x43')](db[_0x6cad('0x44')][_0x6cad('0x45')],function(_0x27b074){return{'name':_0x27b074[_0x6cad('0x46')],'type':_0x27b074[_0x6cad('0x47')]['key']};});_0x2a8133[_0x6cad('0x48')]=_[_0x6cad('0x43')](_0x5a9a87,_0x6cad('0x29'));_0x2a8133[_0x6cad('0x49')]=_['keys'](_0x170ae0[_0x6cad('0x49')]);_0x2a8133[_0x6cad('0x4a')]=_[_0x6cad('0x4b')](_0x2a8133[_0x6cad('0x48')],_0x2a8133[_0x6cad('0x49')]);_0x1addcf[_0x6cad('0x4c')]=_[_0x6cad('0x4b')](_0x2a8133[_0x6cad('0x48')],qs['fields'](_0x170ae0[_0x6cad('0x49')][_0x6cad('0x4d')]));_0x1addcf[_0x6cad('0x4c')]=_0x1addcf[_0x6cad('0x4c')][_0x6cad('0x4e')]?_0x1addcf[_0x6cad('0x4c')]:_0x2a8133[_0x6cad('0x48')];if(!_0x170ae0[_0x6cad('0x49')][_0x6cad('0x4f')](_0x6cad('0x50'))){_0x1addcf[_0x6cad('0x1f')]=qs[_0x6cad('0x1f')](_0x170ae0[_0x6cad('0x49')][_0x6cad('0x1f')]);_0x1addcf['offset']=qs[_0x6cad('0x1c')](_0x170ae0[_0x6cad('0x49')][_0x6cad('0x1c')]);}_0x1addcf[_0x6cad('0x51')]=qs[_0x6cad('0x52')](_0x170ae0[_0x6cad('0x49')][_0x6cad('0x52')]);_0x1addcf[_0x6cad('0x53')]=qs[_0x6cad('0x4a')](_[_0x6cad('0x54')](_0x170ae0[_0x6cad('0x49')],_0x2a8133['filters']),_0x5a9a87);if(_0x170ae0[_0x6cad('0x49')][_0x6cad('0x55')]){_0x1addcf['where']=_['merge'](_0x1addcf['where'],{'$or':_[_0x6cad('0x43')](_0x5a9a87,function(_0x1fed01){if(_0x1fed01[_0x6cad('0x47')]!==_0x6cad('0x56')){var _0x53f22={};_0x53f22[_0x1fed01[_0x6cad('0x29')]]={'$like':'%'+_0x170ae0[_0x6cad('0x49')][_0x6cad('0x55')]+'%'};return _0x53f22;}})});}_0x1addcf=_['merge']({},_0x1addcf,_0x170ae0[_0x6cad('0x57')]);var _0x55fc4c={'where':_0x1addcf[_0x6cad('0x53')]};return db['MailAccount']['count'](_0x55fc4c)[_0x6cad('0x24')](function(_0x2b6de4){_0x2a9465[_0x6cad('0x1e')]=_0x2b6de4;if(_0x170ae0['query'][_0x6cad('0x58')]){_0x1addcf[_0x6cad('0x59')]=[{'all':!![]}];}return db[_0x6cad('0x44')][_0x6cad('0x5a')](_0x1addcf);})[_0x6cad('0x24')](function(_0xf19c71){_0x2a9465['rows']=_0xf19c71;return _0x2a9465;})['then'](respondWithFilteredResult(_0x33c632,_0x1addcf))[_0x6cad('0x19')](handleError(_0x33c632,null));};exports[_0x6cad('0x5b')]=function(_0x294167,_0x2ec89c){var _0x3c8b43={'raw':![],'where':{'id':_0x294167[_0x6cad('0x5c')]['id']},'include':[{'model':db[_0x6cad('0x5d')],'as':'Imap'},{'model':db[_0x6cad('0x42')],'as':_0x6cad('0x40')},{'model':db[_0x6cad('0x5e')],'as':'mandatoryDispositionPause'}]},_0x2be501={};_0x2be501[_0x6cad('0x48')]=_[_0x6cad('0x5f')](db[_0x6cad('0x44')]['rawAttributes']);_0x2be501[_0x6cad('0x49')]=_[_0x6cad('0x5f')](_0x294167[_0x6cad('0x49')]);_0x2be501[_0x6cad('0x4a')]=_[_0x6cad('0x4b')](_0x2be501['model'],_0x2be501['query']);_0x3c8b43['attributes']=_[_0x6cad('0x4b')](_0x2be501['model'],qs[_0x6cad('0x4d')](_0x294167[_0x6cad('0x49')][_0x6cad('0x4d')]));_0x3c8b43[_0x6cad('0x4c')]=_0x3c8b43[_0x6cad('0x4c')][_0x6cad('0x4e')]?_0x3c8b43[_0x6cad('0x4c')]:_0x2be501['model'];if(_0x294167[_0x6cad('0x49')][_0x6cad('0x58')]){_0x3c8b43['include']=[{'all':!![]}];}_0x3c8b43=_[_0x6cad('0x60')]({},_0x3c8b43,_0x294167[_0x6cad('0x57')]);return db[_0x6cad('0x44')][_0x6cad('0x61')](_0x3c8b43)['then'](handleEntityNotFound(_0x2ec89c,null))[_0x6cad('0x24')](respondWithResult(_0x2ec89c,null))['catch'](handleError(_0x2ec89c,null));};exports[_0x6cad('0x23')]=function(_0x2f3952,_0xbd810d){if(_0x2f3952['body']['id']){delete _0x2f3952[_0x6cad('0x62')]['id'];}var _0x1e3dfa=_0x2f3952['body'][_0x6cad('0x63')]===_0x6cad('0x64')?null:_0x2f3952[_0x6cad('0x62')][_0x6cad('0x63')];var _0x5be50b=_0x2f3952['body']['Imap']||{};var _0x2bfe2b=_0x2f3952[_0x6cad('0x62')]['Smtp']||{};if(_0x1e3dfa){_0x5be50b[_0x6cad('0x3a')]=getImapHost(_0x1e3dfa);_0x5be50b[_0x6cad('0x3b')]=0x3e1;_0x2bfe2b[_0x6cad('0x3a')]=getSmtpHost(_0x1e3dfa);_0x2bfe2b['port']=0x24b;_0x2bfe2b[_0x6cad('0x3c')]=![];}if(_0x2bfe2b[_0x6cad('0x38')]){_0x2bfe2b[_0x6cad('0x3c')]=![];}else{_0x2bfe2b[_0x6cad('0x39')]=null;}if(!_0x5be50b['modernAuthentication'])_0x5be50b[_0x6cad('0x39')]=null;_0x2f3952[_0x6cad('0x62')]['Imap']=_0x5be50b;_0x2f3952[_0x6cad('0x62')]['Smtp']=_0x2bfe2b;return db[_0x6cad('0x44')][_0x6cad('0x61')]({'where':{'id':_0x2f3952[_0x6cad('0x5c')]['id']},'include':[{'model':db[_0x6cad('0x5d')],'as':_0x6cad('0x3f')},{'model':db[_0x6cad('0x42')],'as':_0x6cad('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x6cad('0x24')](handleEntityNotFound(_0xbd810d,null))[_0x6cad('0x24')](function(_0x114265){if(!_0x114265)throw new Error(_0x6cad('0x65'));if(_0x114265[_0x6cad('0x3d')])delete _0x2f3952[_0x6cad('0x62')][_0x6cad('0x3f')];return _0x114265;})[_0x6cad('0x24')](saveUpdates(_0x2f3952[_0x6cad('0x62')],null))['then'](function(_0x40b461){if(!_0x2f3952[_0x6cad('0x62')]['Imap'])return _0x40b461;return db[_0x6cad('0x5d')]['update'](_0x2f3952[_0x6cad('0x62')][_0x6cad('0x3f')],{'where':{'MailAccountId':_0x40b461['id']}})[_0x6cad('0x24')](function(){return _0x40b461;});})['then'](function(_0x226861){if(!_0x2f3952['body']['Smtp'])return _0x226861;return db[_0x6cad('0x42')]['update'](_0x2f3952['body'][_0x6cad('0x40')],{'where':{'MailAccountId':_0x226861['id']}})['then'](function(){return _0x226861;});})[_0x6cad('0x24')](respondWithResult(_0xbd810d,null))['catch'](handleError(_0xbd810d,null));};exports['describe']=function(_0x1188a5,_0x4ffbc0){return db[_0x6cad('0x44')]['describe']()[_0x6cad('0x24')](respondWithResult(_0x4ffbc0,null))[_0x6cad('0x19')](handleError(_0x4ffbc0,null));};exports[_0x6cad('0x66')]=function(_0x383676,_0x359c24){if(_0x383676['body']['id']){delete _0x383676[_0x6cad('0x62')]['id'];}return db[_0x6cad('0x44')][_0x6cad('0x61')]({'where':{'id':_0x383676[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x359c24,null))[_0x6cad('0x24')](function(_0x4021c6){if(_0x4021c6){_0x383676['body'][_0x6cad('0x67')]=_0x4021c6['id'];return db[_0x6cad('0x68')]['create'](_0x383676[_0x6cad('0x62')]);}})['then'](respondWithResult(_0x359c24,null))[_0x6cad('0x19')](handleError(_0x359c24,null));};exports['getDispositions']=function(_0xd54843,_0xef39){var _0x36fcc4={'raw':![],'where':{}};var _0x7f2fba={};var _0x38f045={'count':0x0,'rows':[]};return db[_0x6cad('0x44')][_0x6cad('0x69')]({'where':{'id':_0xd54843['params']['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0xef39,null))[_0x6cad('0x24')](function(_0x3b6383){if(_0x3b6383){_0x7f2fba[_0x6cad('0x48')]=_[_0x6cad('0x5f')](db[_0x6cad('0x68')]['rawAttributes']);_0x7f2fba[_0x6cad('0x49')]=_[_0x6cad('0x5f')](_0xd54843[_0x6cad('0x49')]);_0x7f2fba[_0x6cad('0x4a')]=_[_0x6cad('0x4b')](_0x7f2fba[_0x6cad('0x48')],_0x7f2fba['query']);_0x36fcc4[_0x6cad('0x4c')]=_[_0x6cad('0x4b')](_0x7f2fba[_0x6cad('0x48')],qs['fields'](_0xd54843[_0x6cad('0x49')]['fields']));_0x36fcc4['attributes']=_0x36fcc4[_0x6cad('0x4c')][_0x6cad('0x4e')]?_0x36fcc4[_0x6cad('0x4c')]:_0x7f2fba['model'];if(!_0xd54843[_0x6cad('0x49')]['hasOwnProperty'](_0x6cad('0x50'))){_0x36fcc4['limit']=qs[_0x6cad('0x1f')](_0xd54843[_0x6cad('0x49')][_0x6cad('0x1f')]);_0x36fcc4[_0x6cad('0x1c')]=qs['offset'](_0xd54843['query'][_0x6cad('0x1c')]);}_0x36fcc4[_0x6cad('0x51')]=qs[_0x6cad('0x52')](_0xd54843['query'][_0x6cad('0x52')]);_0x36fcc4['where']=qs[_0x6cad('0x4a')](_['pick'](_0xd54843[_0x6cad('0x49')],_0x7f2fba[_0x6cad('0x4a')]));_0x36fcc4[_0x6cad('0x53')][_0x6cad('0x67')]=_0x3b6383['id'];if(_0xd54843[_0x6cad('0x49')][_0x6cad('0x55')]){_0x36fcc4['where']=_['merge'](_0x36fcc4[_0x6cad('0x53')],{'$or':_['map'](_0x36fcc4[_0x6cad('0x4c')],function(_0x2a627f){var _0x578ab6={};_0x578ab6[_0x2a627f]={'$like':'%'+_0xd54843[_0x6cad('0x49')][_0x6cad('0x55')]+'%'};return _0x578ab6;})});}_0x36fcc4=_[_0x6cad('0x60')]({},_0x36fcc4,_0xd54843[_0x6cad('0x57')]);return db[_0x6cad('0x68')]['count']({'where':_0x36fcc4[_0x6cad('0x53')]})['then'](function(_0x50b9c2){_0x38f045[_0x6cad('0x1e')]=_0x50b9c2;if(_0xd54843['query'][_0x6cad('0x58')]){_0x36fcc4[_0x6cad('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x36fcc4);})['then'](function(_0xb2ee1c){_0x38f045[_0x6cad('0x6a')]=_0xb2ee1c;return _0x38f045;});}})[_0x6cad('0x24')](respondWithFilteredResult(_0xef39,_0x36fcc4))[_0x6cad('0x19')](handleError(_0xef39,null));};exports[_0x6cad('0x6b')]=function(_0x330e28,_0x381111){return db[_0x6cad('0x44')]['find']({'where':{'id':_0x330e28[_0x6cad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x381111,null))['then'](function(_0x398616){if(_0x398616){return _0x398616[_0x6cad('0x6b')](_0x330e28['query'][_0x6cad('0x6c')]);}})[_0x6cad('0x24')](respondWithStatusCode(_0x381111,null))[_0x6cad('0x19')](handleError(_0x381111,null));};exports[_0x6cad('0x6d')]=function(_0x475091,_0x1a6470){if(_0x475091[_0x6cad('0x62')]['id']){delete _0x475091[_0x6cad('0x62')]['id'];}return db[_0x6cad('0x44')]['find']({'where':{'id':_0x475091[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x1a6470,null))[_0x6cad('0x24')](function(_0x5b69ab){if(_0x5b69ab){_0x475091[_0x6cad('0x62')][_0x6cad('0x67')]=_0x5b69ab['id'];return db[_0x6cad('0x6e')][_0x6cad('0x6f')](_0x475091[_0x6cad('0x62')]);}})['then'](respondWithResult(_0x1a6470,null))[_0x6cad('0x19')](handleError(_0x1a6470,null));};exports[_0x6cad('0x70')]=function(_0x5c4c05,_0x4c7b4f){var _0x2ffcaa={'raw':![],'where':{}};var _0x571f46={};var _0x422fcd={'count':0x0,'rows':[]};return db[_0x6cad('0x44')][_0x6cad('0x69')]({'where':{'id':_0x5c4c05['params']['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x4c7b4f,null))[_0x6cad('0x24')](function(_0x5ac64a){if(_0x5ac64a){_0x571f46[_0x6cad('0x48')]=_[_0x6cad('0x5f')](db[_0x6cad('0x6e')][_0x6cad('0x45')]);_0x571f46[_0x6cad('0x49')]=_[_0x6cad('0x5f')](_0x5c4c05[_0x6cad('0x49')]);_0x571f46['filters']=_[_0x6cad('0x4b')](_0x571f46['model'],_0x571f46[_0x6cad('0x49')]);_0x2ffcaa['attributes']=_[_0x6cad('0x4b')](_0x571f46[_0x6cad('0x48')],qs[_0x6cad('0x4d')](_0x5c4c05[_0x6cad('0x49')][_0x6cad('0x4d')]));_0x2ffcaa[_0x6cad('0x4c')]=_0x2ffcaa[_0x6cad('0x4c')][_0x6cad('0x4e')]?_0x2ffcaa[_0x6cad('0x4c')]:_0x571f46[_0x6cad('0x48')];if(!_0x5c4c05[_0x6cad('0x49')][_0x6cad('0x4f')](_0x6cad('0x50'))){_0x2ffcaa[_0x6cad('0x1f')]=qs[_0x6cad('0x1f')](_0x5c4c05[_0x6cad('0x49')][_0x6cad('0x1f')]);_0x2ffcaa[_0x6cad('0x1c')]=qs[_0x6cad('0x1c')](_0x5c4c05[_0x6cad('0x49')][_0x6cad('0x1c')]);}_0x2ffcaa[_0x6cad('0x51')]=qs[_0x6cad('0x52')](_0x5c4c05[_0x6cad('0x49')][_0x6cad('0x52')]);_0x2ffcaa['where']=qs[_0x6cad('0x4a')](_[_0x6cad('0x54')](_0x5c4c05['query'],_0x571f46['filters']));_0x2ffcaa[_0x6cad('0x53')][_0x6cad('0x67')]=_0x5ac64a['id'];if(_0x5c4c05['query'][_0x6cad('0x55')]){_0x2ffcaa[_0x6cad('0x53')]=_[_0x6cad('0x60')](_0x2ffcaa[_0x6cad('0x53')],{'$or':_['map'](_0x2ffcaa[_0x6cad('0x4c')],function(_0x2815af){var _0x5c1ffc={};_0x5c1ffc[_0x2815af]={'$like':'%'+_0x5c4c05[_0x6cad('0x49')][_0x6cad('0x55')]+'%'};return _0x5c1ffc;})});}_0x2ffcaa=_[_0x6cad('0x60')]({},_0x2ffcaa,_0x5c4c05['options']);return db['CannedAnswer'][_0x6cad('0x1e')]({'where':_0x2ffcaa[_0x6cad('0x53')]})[_0x6cad('0x24')](function(_0x27213b){_0x422fcd['count']=_0x27213b;if(_0x5c4c05[_0x6cad('0x49')][_0x6cad('0x58')]){_0x2ffcaa[_0x6cad('0x59')]=[{'all':!![]}];}return db[_0x6cad('0x6e')]['findAll'](_0x2ffcaa);})[_0x6cad('0x24')](function(_0x28822c){_0x422fcd[_0x6cad('0x6a')]=_0x28822c;return _0x422fcd;});}})[_0x6cad('0x24')](respondWithFilteredResult(_0x4c7b4f,_0x2ffcaa))[_0x6cad('0x19')](handleError(_0x4c7b4f,null));};exports[_0x6cad('0x71')]=function(_0x5868a3,_0x1c32d6){return db['MailAccount'][_0x6cad('0x61')]({'where':{'id':_0x5868a3[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x1c32d6,null))['then'](function(_0x9700){if(_0x9700){return _0x9700[_0x6cad('0x71')](_0x5868a3[_0x6cad('0x49')]['ids']);}})[_0x6cad('0x24')](respondWithStatusCode(_0x1c32d6,null))[_0x6cad('0x19')](handleError(_0x1c32d6,null));};exports[_0x6cad('0x6f')]=function(_0x31f719,_0x1677df){var _0x418c39={'name':_0x31f719['body']['name'],'key':_0x31f719[_0x6cad('0x62')][_0x6cad('0x72')],'provider':_0x31f719['body'][_0x6cad('0x63')]===_0x6cad('0x64')?null:_0x31f719[_0x6cad('0x62')][_0x6cad('0x63')],'email':_0x31f719['body'][_0x6cad('0x73')],'ListId':_0x31f719[_0x6cad('0x62')]['ListId'],'active':!_[_0x6cad('0x74')](_0x31f719[_0x6cad('0x62')]['active'])?_0x31f719[_0x6cad('0x62')]['active']:!![],'description':_0x31f719[_0x6cad('0x62')][_0x6cad('0x75')]||null};var _0x58e388=getAuthenticationOptions(_0x418c39['provider'],_0x31f719[_0x6cad('0x62')]);_0x418c39[_0x6cad('0x3f')]=_0x58e388[_0x6cad('0x3f')];_0x418c39['Smtp']=_0x58e388['Smtp'];return db[_0x6cad('0x44')][_0x6cad('0x6f')](_0x418c39,{'include':[{'model':db[_0x6cad('0x42')],'as':_0x6cad('0x40')},{'model':db['MailServerIn'],'as':_0x6cad('0x3f')}]})[_0x6cad('0x24')](function(_0xc2e1f){var _0x142c57=_0x31f719[_0x6cad('0x34')]['get']({'plain':!![]});if(!_0x142c57)throw new Error(_0x6cad('0x76'));if(_0x142c57[_0x6cad('0x77')]===_0x6cad('0x34')){var _0x120f53=_0xc2e1f['get']({'plain':!![]});return db[_0x6cad('0x78')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x142c57[_0x6cad('0x79')]},'raw':!![]})[_0x6cad('0x24')](function(_0x2bffca){if(_0x2bffca&&_0x2bffca[_0x6cad('0x7a')]===0x0){return db[_0x6cad('0x26')][_0x6cad('0x6f')]({'name':_0x120f53['name'],'resourceId':_0x120f53['id'],'type':_0x2bffca[_0x6cad('0x29')],'sectionId':_0x2bffca['id']},{})['then'](function(){return _0xc2e1f;});}else{return _0xc2e1f;}})[_0x6cad('0x19')](function(_0x4fb5c0){logger[_0x6cad('0x17')](_0x6cad('0x7b'),_0x4fb5c0);throw _0x4fb5c0;});}return _0xc2e1f;})[_0x6cad('0x24')](respondWithResult(_0x1677df,0xc9))[_0x6cad('0x19')](handleError(_0x1677df,null));};exports[_0x6cad('0x7c')]=function(_0x2f96e5,_0x378dd4){return db[_0x6cad('0x44')]['findOne']({'where':{'id':_0x2f96e5['params']['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x378dd4,null))[_0x6cad('0x24')](function(_0x2406f0){if(_0x2406f0){return _0x2406f0[_0x6cad('0x7c')]();}return null;})['then'](respondWithResult(_0x378dd4,null))[_0x6cad('0x19')](handleError(_0x378dd4,null));};exports['addImap']=function(_0x1e8295,_0x18a6dd){if(_0x1e8295[_0x6cad('0x62')]['id']){delete _0x1e8295[_0x6cad('0x62')]['id'];}return db[_0x6cad('0x44')][_0x6cad('0x61')]({'where':{'id':_0x1e8295[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x18a6dd,null))[_0x6cad('0x24')](function(_0x5dc444){if(_0x5dc444){_0x1e8295['body']['MailAccountId']=_0x5dc444['id'];return db[_0x6cad('0x5d')]['create'](_0x1e8295[_0x6cad('0x62')]);}})['then'](respondWithResult(_0x18a6dd,null))[_0x6cad('0x19')](handleError(_0x18a6dd,null));};exports[_0x6cad('0x7d')]=function(_0x143bdf,_0x20bb72){return db[_0x6cad('0x44')][_0x6cad('0x69')]({'where':{'id':_0x143bdf['params']['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x20bb72,null))[_0x6cad('0x24')](function(_0x58ff4a){if(_0x58ff4a){return _0x58ff4a['setImap'](null);}return null;})[_0x6cad('0x24')](respondWithStatusCode(_0x20bb72,null))[_0x6cad('0x19')](handleError(_0x20bb72,null));};exports[_0x6cad('0x7e')]=function(_0x3eff55,_0x1674c9){return db['MailAccount'][_0x6cad('0x69')]({'where':{'id':_0x3eff55['params']['id']}})['then'](handleEntityNotFound(_0x1674c9,null))[_0x6cad('0x24')](function(_0x250950){if(_0x250950){return _0x250950['getSmtp']();}return null;})[_0x6cad('0x24')](respondWithResult(_0x1674c9,null))[_0x6cad('0x19')](handleError(_0x1674c9,null));};exports[_0x6cad('0x7f')]=function(_0x12ed22,_0xc7b5b0){if(_0x12ed22['body']['id']){delete _0x12ed22['body']['id'];}return db['MailAccount'][_0x6cad('0x61')]({'where':{'id':_0x12ed22[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0xc7b5b0,null))[_0x6cad('0x24')](function(_0x3b689f){if(_0x3b689f){_0x12ed22[_0x6cad('0x62')][_0x6cad('0x67')]=_0x3b689f['id'];return db[_0x6cad('0x42')]['create'](_0x12ed22[_0x6cad('0x62')]);}})[_0x6cad('0x24')](respondWithResult(_0xc7b5b0,null))[_0x6cad('0x19')](handleError(_0xc7b5b0,null));};exports[_0x6cad('0x80')]=function(_0x221131,_0x455034){return db[_0x6cad('0x44')]['findOne']({'where':{'id':_0x221131[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x455034,null))[_0x6cad('0x24')](function(_0x35df70){if(_0x35df70){return _0x35df70['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x455034,null))[_0x6cad('0x19')](handleError(_0x455034,null));};exports['addInteraction']=function(_0x27b35b,_0x10a834){return db[_0x6cad('0x81')]['find']({'where':{'id':_0x27b35b[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x10a834,null))[_0x6cad('0x24')](function(_0x3bd312){if(_0x3bd312){return _0x3bd312[_0x6cad('0x82')](_0x27b35b[_0x6cad('0x62')][_0x6cad('0x6c')],_[_0x6cad('0x83')](_0x27b35b['body'],[_0x6cad('0x6c'),'id'])||{});}})[_0x6cad('0x24')](respondWithResult(_0x10a834,null))[_0x6cad('0x19')](handleError(_0x10a834,null));};exports['getInteractions']=function(_0xef5cba,_0x3d7f78){var _0x5c6e11={'raw':![],'where':{}};var _0x88b01f={};var _0x5d9c53={'count':0x0,'rows':[]};return db[_0x6cad('0x44')][_0x6cad('0x69')]({'where':{'id':_0xef5cba[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x3d7f78,null))[_0x6cad('0x24')](function(_0x4d2d2d){if(_0x4d2d2d){_0x88b01f[_0x6cad('0x48')]=_[_0x6cad('0x5f')](db[_0x6cad('0x81')][_0x6cad('0x45')]);_0x88b01f['query']=_['keys'](_0xef5cba['query']);_0x88b01f[_0x6cad('0x4a')]=_[_0x6cad('0x4b')](_0x88b01f[_0x6cad('0x48')],_0x88b01f[_0x6cad('0x49')]);_0x5c6e11[_0x6cad('0x4c')]=_['intersection'](_0x88b01f[_0x6cad('0x48')],qs[_0x6cad('0x4d')](_0xef5cba['query'][_0x6cad('0x4d')]));_0x5c6e11[_0x6cad('0x4c')]=_0x5c6e11['attributes'][_0x6cad('0x4e')]?_0x5c6e11[_0x6cad('0x4c')]:_0x88b01f['model'];if(!_0xef5cba[_0x6cad('0x49')][_0x6cad('0x4f')](_0x6cad('0x50'))){_0x5c6e11[_0x6cad('0x1f')]=qs[_0x6cad('0x1f')](_0xef5cba[_0x6cad('0x49')]['limit']);_0x5c6e11[_0x6cad('0x1c')]=qs[_0x6cad('0x1c')](_0xef5cba['query']['offset']);}_0x5c6e11[_0x6cad('0x51')]=qs[_0x6cad('0x52')](_0xef5cba[_0x6cad('0x49')]['sort']);_0x5c6e11[_0x6cad('0x53')]=qs[_0x6cad('0x4a')](_[_0x6cad('0x54')](_0xef5cba[_0x6cad('0x49')],_0x88b01f['filters']));_0x5c6e11[_0x6cad('0x53')][_0x6cad('0x67')]=_0x4d2d2d['id'];if(_0xef5cba[_0x6cad('0x49')][_0x6cad('0x55')]){_0x5c6e11[_0x6cad('0x53')]=_[_0x6cad('0x60')](_0x5c6e11[_0x6cad('0x53')],{'$or':_[_0x6cad('0x43')](_0x5c6e11[_0x6cad('0x4c')],function(_0x52b73e){var _0x3446d1={};_0x3446d1[_0x52b73e]={'$like':'%'+_0xef5cba['query'][_0x6cad('0x55')]+'%'};return _0x3446d1;})});}_0x5c6e11=_[_0x6cad('0x60')]({},_0x5c6e11,_0xef5cba[_0x6cad('0x57')]);return db[_0x6cad('0x81')]['count']({'where':_0x5c6e11[_0x6cad('0x53')]})['then'](function(_0x39b270){_0x5d9c53[_0x6cad('0x1e')]=_0x39b270;if(_0xef5cba[_0x6cad('0x49')][_0x6cad('0x58')]){_0x5c6e11['include']=[{'model':db[_0x6cad('0x84')],'as':_0x6cad('0x85'),'required':![]},{'model':db[_0x6cad('0x86')],'as':_0x6cad('0x87'),'attributes':['name',_0x6cad('0x88'),_0x6cad('0x89')],'required':![]},{'model':db[_0x6cad('0x8a')],'as':'Tags','attributes':['id',_0x6cad('0x29'),'color'],'where':_0xef5cba['query'][_0x6cad('0x8b')]?{'id':_0xef5cba[_0x6cad('0x49')][_0x6cad('0x8b')]}:undefined,'required':_0xef5cba[_0x6cad('0x49')][_0x6cad('0x8b')]?!![]:![]}];}return db['MailInteraction'][_0x6cad('0x5a')](_0x5c6e11);})['then'](function(_0x117006){_0x5d9c53['rows']=_0x117006;return _0x5d9c53;});}})[_0x6cad('0x24')](respondWithFilteredResult(_0x3d7f78,_0x5c6e11))[_0x6cad('0x19')](handleError(_0x3d7f78,null));};exports['addApplications']=function addApplications(_0x215b80,_0x3eb018){var _0x2dd124=_0x215b80[_0x6cad('0x5c')]['id'];var _0x55a2d6=_0x215b80['body'];var _0x4ea6c5=0xc8;var _0x57d030=null;return db[_0x6cad('0x8c')][_0x6cad('0x8d')]({'isolationLevel':db[_0x6cad('0x8c')][_0x6cad('0x8e')][_0x6cad('0x8f')][_0x6cad('0x90')]},function(_0x41a0c4){return db[_0x6cad('0x44')][_0x6cad('0x69')]({'where':{'id':_0x2dd124},'transaction':_0x41a0c4})[_0x6cad('0x24')](function(_0x16c828){if(_0x16c828){return db[_0x6cad('0x91')]['destroy']({'where':{'MailAccountId':_0x2dd124},'transaction':_0x41a0c4})[_0x6cad('0x24')](function(){var _0x2a4da6=_[_0x6cad('0x43')](_0x55a2d6,function(_0xd41689){_0xd41689['MailAccountId']=_0x2dd124;return _0xd41689;});return db[_0x6cad('0x91')]['bulkCreate'](_0x2a4da6,{'transaction':_0x41a0c4});});}else{_0x4ea6c5=0x194;_0x57d030=[];}});})['then'](function(){if(_0x4ea6c5!==0x194){return db[_0x6cad('0x91')][_0x6cad('0x92')]({'where':{'MailAccountId':_0x2dd124},'order':_0x6cad('0x93')})[_0x6cad('0x24')](function(_0x278768){_0x57d030=_0x278768;});}})[_0x6cad('0x19')](function(_0x536c3b){_0x4ea6c5=0x1f4;logger[_0x6cad('0x17')](_0x536c3b['stack']);if(_0x536c3b['name']){delete _0x536c3b[_0x6cad('0x29')];}_0x57d030=_0x536c3b;})['finally'](function(){if(_0x57d030===null){_0x3eb018[_0x6cad('0x1a')](_0x4ea6c5);}else{if(_0x4ea6c5===0x1f4){_0x3eb018[_0x6cad('0x1b')](_0x4ea6c5)['send'](_0x57d030);}else{_0x3eb018[_0x6cad('0x1b')](_0x4ea6c5)[_0x6cad('0x22')](_0x57d030);}}});};exports['getApplications']=function(_0x292823,_0x1d5d55){var _0x259e70={};var _0xea192d={};var _0x2c8c60;var _0x4ee5ce;return db['MailAccount'][_0x6cad('0x69')]({'where':{'id':_0x292823[_0x6cad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d5d55,null))['then'](function(_0x506873){if(_0x506873){_0x2c8c60=_0x506873;_0xea192d[_0x6cad('0x48')]=_['keys'](db[_0x6cad('0x91')][_0x6cad('0x45')]);_0xea192d[_0x6cad('0x49')]=_[_0x6cad('0x5f')](_0x292823[_0x6cad('0x49')]);_0xea192d[_0x6cad('0x4a')]=_[_0x6cad('0x4b')](_0xea192d[_0x6cad('0x48')],_0xea192d[_0x6cad('0x49')]);_0x259e70[_0x6cad('0x4c')]=_[_0x6cad('0x4b')](_0xea192d[_0x6cad('0x48')],qs['fields'](_0x292823[_0x6cad('0x49')][_0x6cad('0x4d')]));_0x259e70[_0x6cad('0x4c')]=_0x259e70[_0x6cad('0x4c')][_0x6cad('0x4e')]?_0x259e70[_0x6cad('0x4c')]:_0xea192d[_0x6cad('0x48')];_0x259e70[_0x6cad('0x51')]=qs[_0x6cad('0x52')](_0x292823[_0x6cad('0x49')][_0x6cad('0x52')]);_0x259e70[_0x6cad('0x53')]=qs['filters'](_[_0x6cad('0x54')](_0x292823[_0x6cad('0x49')],_0xea192d['filters']));if(_0x292823[_0x6cad('0x49')]['filter']){_0x259e70['where']=_[_0x6cad('0x60')](_0x259e70[_0x6cad('0x53')],{'$or':_[_0x6cad('0x43')](_0x259e70['attributes'],function(_0xcc870b){var _0x193341={};_0x193341[_0xcc870b]={'$like':'%'+_0x292823[_0x6cad('0x49')]['filter']+'%'};return _0x193341;})});}_0x259e70=_[_0x6cad('0x60')]({},_0x259e70,_0x292823[_0x6cad('0x57')]);return _0x2c8c60['getApplications'](_0x259e70);}})[_0x6cad('0x24')](function(_0x1382ca){if(_0x1382ca){_0x4ee5ce=_0x1382ca[_0x6cad('0x4e')];if(!_0x292823[_0x6cad('0x49')][_0x6cad('0x4f')](_0x6cad('0x50'))){_0x259e70[_0x6cad('0x1f')]=qs[_0x6cad('0x1f')](_0x292823['query'][_0x6cad('0x1f')]);_0x259e70[_0x6cad('0x1c')]=qs[_0x6cad('0x1c')](_0x292823[_0x6cad('0x49')][_0x6cad('0x1c')]);}return _0x2c8c60[_0x6cad('0x94')](_0x259e70);}})[_0x6cad('0x24')](function(_0x2dab05){if(_0x2dab05){return _0x2dab05?{'count':_0x4ee5ce,'rows':_0x2dab05}:null;}})[_0x6cad('0x24')](respondWithResult(_0x1d5d55,null))['catch'](handleError(_0x1d5d55,null));};exports[_0x6cad('0x95')]=function(_0x174009,_0x267018){var _0x4db16a={'raw':!![],'where':{}};var _0x50b53f={};var _0x220d48={'count':0x0,'rows':[]};return db[_0x6cad('0x44')][_0x6cad('0x69')]({'where':{'id':_0x174009[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x267018,null))[_0x6cad('0x24')](function(_0x2ae11e){if(_0x2ae11e){_0x50b53f[_0x6cad('0x48')]=_[_0x6cad('0x5f')](db[_0x6cad('0x96')][_0x6cad('0x45')]);_0x50b53f[_0x6cad('0x49')]=_[_0x6cad('0x5f')](_0x174009[_0x6cad('0x49')]);_0x50b53f[_0x6cad('0x4a')]=_[_0x6cad('0x4b')](_0x50b53f[_0x6cad('0x48')],_0x50b53f[_0x6cad('0x49')]);_0x4db16a['attributes']=_[_0x6cad('0x4b')](_0x50b53f['model'],qs[_0x6cad('0x4d')](_0x174009[_0x6cad('0x49')][_0x6cad('0x4d')]));_0x4db16a['attributes']=_0x4db16a[_0x6cad('0x4c')][_0x6cad('0x4e')]?_0x4db16a[_0x6cad('0x4c')]:_0x50b53f[_0x6cad('0x48')];if(!_0x174009[_0x6cad('0x49')][_0x6cad('0x4f')](_0x6cad('0x50'))){_0x4db16a['limit']=qs[_0x6cad('0x1f')](_0x174009['query'][_0x6cad('0x1f')]);_0x4db16a[_0x6cad('0x1c')]=qs[_0x6cad('0x1c')](_0x174009[_0x6cad('0x49')][_0x6cad('0x1c')]);}_0x4db16a['order']=qs[_0x6cad('0x52')](_0x174009['query']['sort']);_0x4db16a[_0x6cad('0x53')]=qs[_0x6cad('0x4a')](_['pick'](_0x174009[_0x6cad('0x49')],_0x50b53f[_0x6cad('0x4a')]));_0x4db16a[_0x6cad('0x53')][_0x6cad('0x67')]=_0x2ae11e['id'];if(_0x174009[_0x6cad('0x49')][_0x6cad('0x55')]){_0x4db16a['where']=_[_0x6cad('0x60')](_0x4db16a[_0x6cad('0x53')],{'$or':_[_0x6cad('0x43')](_0x4db16a[_0x6cad('0x4c')],function(_0x5110e9){var _0x45456e={};_0x45456e[_0x5110e9]={'$like':'%'+_0x174009[_0x6cad('0x49')][_0x6cad('0x55')]+'%'};return _0x45456e;})});}if(_0x174009[_0x6cad('0x49')][_0x6cad('0x97')]){var _0x11d775=_0x174009['query'][_0x6cad('0x97')][_0x6cad('0x98')](',');var _0x3a8144={};_0x3a8144[_0x11d775[0x0]]={'$gte':moment(_0x11d775[0x1])[_0x6cad('0x99')](_0x6cad('0x9a'))};_0x4db16a[_0x6cad('0x53')]=_[_0x6cad('0x60')](_0x4db16a[_0x6cad('0x53')],_0x3a8144);}_0x4db16a=_[_0x6cad('0x60')]({},_0x4db16a,_0x174009[_0x6cad('0x57')]);return db[_0x6cad('0x96')][_0x6cad('0x1e')]({'where':_0x4db16a[_0x6cad('0x53')]})[_0x6cad('0x24')](function(_0x4cb1b5){_0x220d48[_0x6cad('0x1e')]=_0x4cb1b5;if(_0x174009[_0x6cad('0x49')][_0x6cad('0x58')]){_0x4db16a[_0x6cad('0x59')]=[{'all':!![]}];}return db['MailMessage'][_0x6cad('0x5a')](_0x4db16a);})['then'](function(_0x3ca702){if(_0x174009[_0x6cad('0x49')][_0x6cad('0x9b')]===_0x6cad('0x9c')){for(var _0x13d997=0x0;_0x13d997<_0x3ca702[_0x6cad('0x4e')];_0x13d997++){_0x3ca702[_0x13d997][_0x6cad('0x62')]=juice(_0x3ca702[_0x13d997][_0x6cad('0x62')]);}}_0x220d48[_0x6cad('0x6a')]=_0x3ca702;return _0x220d48;});}})[_0x6cad('0x24')](respondWithFilteredResult(_0x267018,_0x4db16a))[_0x6cad('0x19')](handleError(_0x267018,null));};exports[_0x6cad('0x9d')]=function(_0x73334d,_0x1c7403){var _0x141c71,_0x307a71={},_0x53d5ce;if(_0x73334d[_0x6cad('0x62')]['to']){_0x53d5ce=_0x73334d[_0x6cad('0x62')]['to'][_0x6cad('0x98')](',')[0x0];}return db['MailAccount'][_0x6cad('0x61')]({'where':{'id':_0x73334d['params']['id']},'include':[{'model':db[_0x6cad('0x9e')],'as':_0x6cad('0x9f'),'include':[{'model':db[_0x6cad('0x84')],'as':'Contacts','where':{'email':_0x53d5ce},'limit':0x1,'order':[[_0x6cad('0xa0'),_0x6cad('0xa1')]]}]},{'model':db[_0x6cad('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x6cad('0xa2')],'as':_0x6cad('0xa2'),'raw':!![]}]}]})[_0x6cad('0x24')](handleEntityNotFound(_0x1c7403,null))[_0x6cad('0x24')](function(_0x24d104){if(!_0x24d104)return;_0x141c71=_0x24d104;if(!_0x24d104[_0x6cad('0x40')])throw new Error(_0x6cad('0xa3'));if(_[_0x6cad('0x74')](_0x73334d['body'][_0x6cad('0xa4')])){_0x73334d[_0x6cad('0x62')][_0x6cad('0xa4')]=util[_0x6cad('0x99')](_0x6cad('0xa5'),_0x24d104[_0x6cad('0x29')],_0x24d104['email']||_0x24d104[_0x6cad('0x40')][_0x6cad('0x34')]);}if(_0x73334d[_0x6cad('0x62')][_0x6cad('0xa6')]&&_0x73334d[_0x6cad('0x62')]['attachments'][_0x6cad('0x4e')]){for(var _0x409df9=0x0;_0x409df9<_0x73334d[_0x6cad('0x62')][_0x6cad('0xa6')][_0x6cad('0x4e')];_0x409df9+=0x1){_0x73334d[_0x6cad('0x62')][_0x6cad('0xa6')][_0x409df9]={'filename':_0x73334d[_0x6cad('0x62')][_0x6cad('0xa6')][_0x409df9][_0x6cad('0x29')],'path':path[_0x6cad('0xa7')](config['root'],'server/files/attachments',_0x73334d[_0x6cad('0x62')][_0x6cad('0xa6')][_0x409df9][_0x6cad('0xa8')])};}}var _0x17077a=_0x24d104[_0x6cad('0xa9')]();return respondWithRpcPromise(_0x6cad('0xaa'),_0x6cad('0xab'),{'account':_0x17077a,'message':_0x73334d[_0x6cad('0x62')]});})[_0x6cad('0x24')](function(_0x1ced7e){if(!_0x1ced7e)return;_0x307a71=_0x1ced7e;if(!_0x141c71['List'])throw new Error(_0x6cad('0xac'));if(_0x141c71[_0x6cad('0x9f')][_0x6cad('0xad')][_0x6cad('0x4e')])return _0x141c71[_0x6cad('0x9f')][_0x6cad('0xad')][0x0];return db[_0x6cad('0x84')][_0x6cad('0x6f')](_['defaults'](_0x73334d[_0x6cad('0x62')],{'firstName':_0x73334d[_0x6cad('0x62')]['to'],'email':_0x73334d[_0x6cad('0x62')]['to'],'phone':_0x73334d[_0x6cad('0x62')]['to'],'ListId':_0x141c71['ListId']}));})[_0x6cad('0x24')](function(_0x832096){if(!_0x832096)return;var _0x38c68c={'UserId':_0x73334d[_0x6cad('0x34')]['id'],'ContactId':_0x832096['id'],'MailAccountId':_0x141c71['id'],'inReplyTo':_0x307a71[_0x6cad('0xae')],'to':_0x73334d[_0x6cad('0x62')]['from'],'cc':_0x73334d['body']['cc'],'subject':_0x73334d[_0x6cad('0x62')][_0x6cad('0xaf')],'attach':_0x73334d[_0x6cad('0x62')][_0x6cad('0xb0')],'firstMsgDirection':_0x6cad('0xb1'),'lastMsgAt':moment()['format'](_0x6cad('0x9a')),'lastMsgDirection':_0x6cad('0xb1'),'Messages':[_[_0x6cad('0x60')](_0x73334d[_0x6cad('0x62')],{'messageId':_0x307a71['messageId'],'sentAt':moment()['format'](_0x6cad('0x9a')),'read':!![],'MailAccountId':_0x141c71['id'],'UserId':_0x73334d[_0x6cad('0x34')]['id'],'ContactId':_0x832096['id']})]};if(_0x73334d['body'][_0x6cad('0xb2')]){_0x38c68c=_[_0x6cad('0x60')](_0x38c68c,_0x73334d[_0x6cad('0x62')]['Interaction']);}return db['MailInteraction'][_0x6cad('0x6f')](_0x38c68c,{'include':[{'model':db[_0x6cad('0x96')],'as':'Messages'}]});})[_0x6cad('0x24')](respondWithResult(_0x1c7403,null))[_0x6cad('0x19')](handleError(_0x1c7403,null));};exports[_0x6cad('0xb3')]=function(_0x438172,_0x34b6fe){return db[_0x6cad('0x44')][_0x6cad('0x61')]({'where':{'id':_0x438172['params']['id']},'include':[{'model':db[_0x6cad('0x42')],'as':_0x6cad('0x40'),'raw':!![],'include':[{'model':db[_0x6cad('0xa2')],'as':_0x6cad('0xa2'),'raw':!![]}]}]})[_0x6cad('0x24')](handleEntityNotFound(_0x34b6fe,null))[_0x6cad('0x24')](function(_0x71d83a){if(!_0x71d83a[_0x6cad('0x40')])return;var _0x2a241e=_0x71d83a[_0x6cad('0xa9')]();return respondWithRpcPromise(_0x6cad('0xb4'),_0x6cad('0xb3'),{'account':_0x2a241e});})[_0x6cad('0x24')](respondWithResult(_0x34b6fe,null))['catch'](handleError(_0x34b6fe,null));};exports['destroy']=function(_0x56be00,_0x2c9eb4){return db[_0x6cad('0x44')][_0x6cad('0x61')]({'where':{'id':_0x56be00[_0x6cad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2c9eb4,null))[_0x6cad('0x24')](function(_0xae8eda){if(_0xae8eda&&_0xae8eda[_0x6cad('0x3d')]){throw new db[(_0x6cad('0xb5'))][(_0x6cad('0xb6'))](_0x6cad('0xb7'));}return _0xae8eda;})['then'](removeEntity(_0x2c9eb4,null))[_0x6cad('0x19')](handleError(_0x2c9eb4,null));};exports[_0x6cad('0xb8')]=function(_0x39f92f,_0x3aecab){return db['MailAccount'][_0x6cad('0x61')]({'where':{'id':_0x39f92f[_0x6cad('0x5c')]['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x3aecab,null))['then'](function(_0x3d4415){if(_0x3d4415){return _0x3d4415[_0x6cad('0xb8')](_0x39f92f[_0x6cad('0x62')][_0x6cad('0x6c')],_[_0x6cad('0x83')](_0x39f92f[_0x6cad('0x62')],[_0x6cad('0x6c'),'id'])||{})[_0x6cad('0xb9')](function(_0x51daf0){for(var _0x4c0400=0x0;_0x4c0400<_0x39f92f[_0x6cad('0x62')][_0x6cad('0x6c')][_0x6cad('0x4e')];_0x4c0400+=0x1){socket[_0x6cad('0xba')](_0x6cad('0xbb'),{'UserId':Number(_0x39f92f[_0x6cad('0x62')]['ids'][_0x4c0400]),'MailAccountId':Number(_0x39f92f[_0x6cad('0x5c')]['id'])});}return _0x51daf0;});}})[_0x6cad('0x24')](respondWithResult(_0x3aecab,null))['catch'](handleError(_0x3aecab,null));};exports[_0x6cad('0xbc')]=function(_0x49aa7e,_0x23e148){return db[_0x6cad('0x44')][_0x6cad('0x61')]({'where':{'id':_0x49aa7e['params']['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0x23e148,null))[_0x6cad('0x24')](function(_0x4f4767){if(_0x4f4767){return _0x4f4767[_0x6cad('0xbc')](_0x49aa7e[_0x6cad('0x49')][_0x6cad('0x6c')])[_0x6cad('0x24')](function(){if(_[_0x6cad('0xbd')](_0x49aa7e[_0x6cad('0x49')]['ids'])){for(var _0x454c4b=0x0;_0x454c4b<_0x49aa7e[_0x6cad('0x49')][_0x6cad('0x6c')][_0x6cad('0x4e')];_0x454c4b+=0x1){socket[_0x6cad('0xba')](_0x6cad('0xbe'),{'UserId':Number(_0x49aa7e[_0x6cad('0x49')][_0x6cad('0x6c')][_0x454c4b]),'MailAccountId':Number(_0x49aa7e['params']['id'])});}}else{socket[_0x6cad('0xba')](_0x6cad('0xbe'),{'UserId':Number(_0x49aa7e[_0x6cad('0x49')]['ids']),'MailAccountId':Number(_0x49aa7e[_0x6cad('0x5c')]['id'])});}});}})[_0x6cad('0x24')](respondWithStatusCode(_0x23e148,null))[_0x6cad('0x19')](handleError(_0x23e148,null));};exports[_0x6cad('0xbf')]=function(_0x19c821,_0xc0ee67){var _0x45b36f={};var _0x266512={};var _0x2d411e;var _0x14748e;return db[_0x6cad('0x44')]['findOne']({'where':{'id':_0x19c821['params']['id']}})[_0x6cad('0x24')](handleEntityNotFound(_0xc0ee67,null))[_0x6cad('0x24')](function(_0x506d41){if(_0x506d41){_0x2d411e=_0x506d41;_0x266512[_0x6cad('0x48')]=_[_0x6cad('0x5f')](db[_0x6cad('0x86')][_0x6cad('0x45')]);_0x266512[_0x6cad('0x49')]=_['keys'](_0x19c821[_0x6cad('0x49')]);_0x266512[_0x6cad('0x4a')]=_['intersection'](_0x266512[_0x6cad('0x48')],_0x266512[_0x6cad('0x49')]);_0x45b36f['attributes']=_['intersection'](_0x266512[_0x6cad('0x48')],qs[_0x6cad('0x4d')](_0x19c821[_0x6cad('0x49')][_0x6cad('0x4d')]));_0x45b36f['attributes']=_0x45b36f[_0x6cad('0x4c')][_0x6cad('0x4e')]?_0x45b36f[_0x6cad('0x4c')]:_0x266512[_0x6cad('0x48')];_0x45b36f[_0x6cad('0x51')]=qs[_0x6cad('0x52')](_0x19c821['query'][_0x6cad('0x52')]);_0x45b36f[_0x6cad('0x53')]=qs[_0x6cad('0x4a')](_[_0x6cad('0x54')](_0x19c821['query'],_0x266512['filters']));if(_0x19c821[_0x6cad('0x49')]['filter']){_0x45b36f[_0x6cad('0x53')]=_[_0x6cad('0x60')](_0x45b36f[_0x6cad('0x53')],{'$or':_['map'](_0x45b36f[_0x6cad('0x4c')],function(_0x277142){var _0x34425b={};_0x34425b[_0x277142]={'$like':'%'+_0x19c821[_0x6cad('0x49')][_0x6cad('0x55')]+'%'};return _0x34425b;})});}_0x45b36f=_[_0x6cad('0x60')]({},_0x45b36f,_0x19c821[_0x6cad('0x57')]);return _0x2d411e[_0x6cad('0xbf')](_0x45b36f);}})['then'](function(_0x2232f5){if(_0x2232f5){_0x14748e=_0x2232f5[_0x6cad('0x4e')];if(!_0x19c821[_0x6cad('0x49')][_0x6cad('0x4f')](_0x6cad('0x50'))){_0x45b36f[_0x6cad('0x1f')]=qs[_0x6cad('0x1f')](_0x19c821[_0x6cad('0x49')][_0x6cad('0x1f')]);_0x45b36f['offset']=qs[_0x6cad('0x1c')](_0x19c821['query'][_0x6cad('0x1c')]);}return _0x2d411e['getAgents'](_0x45b36f);}})[_0x6cad('0x24')](function(_0x4a481f){if(_0x4a481f){return _0x4a481f?{'count':_0x14748e,'rows':_0x4a481f}:null;}})[_0x6cad('0x24')](respondWithResult(_0xc0ee67,null))[_0x6cad('0x19')](handleError(_0xc0ee67,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index eed7bb1..089912d 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 _0x04cc=['hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','update','emit'];(function(_0x3c7b27,_0x56d8ed){var _0x4081df=function(_0x15eabc){while(--_0x15eabc){_0x3c7b27['push'](_0x3c7b27['shift']());}};_0x4081df(++_0x56d8ed);}(_0x04cc,0x11a));var _0xc04c=function(_0x336030,_0x4086ea){_0x336030=_0x336030-0x0;var _0x2b203b=_0x04cc[_0x336030];return _0x2b203b;};'use strict';var EventEmitter=require(_0xc04c('0x0'));var MailAccount=require(_0xc04c('0x1'))['db'][_0xc04c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc04c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc04c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4cca40){return function(_0x138028,_0x2fefd7,_0x153c93){MailAccountEvents[_0xc04c('0x5')](_0x4cca40+':'+_0x138028['id'],_0x138028);MailAccountEvents[_0xc04c('0x5')](_0x4cca40,_0x138028);_0x153c93(null);};}for(var e in events){if(events[_0xc04c('0x6')](e)){var event=events[e];MailAccount[_0xc04c('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x3989=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3989,0x12f));var _0x9398=function(_0x222377,_0x38a741){_0x222377=_0x222377-0x0;var _0xea051e=_0x3989[_0x222377];return _0xea051e;};'use strict';var EventEmitter=require(_0x9398('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x9398('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9398('0x2')](0x0);var events={'afterCreate':_0x9398('0x3'),'afterUpdate':_0x9398('0x4'),'afterDestroy':_0x9398('0x5')};function emitEvent(_0x117eaf){return function(_0x4759ec,_0x2f9145,_0x2774cb){MailAccountEvents[_0x9398('0x6')](_0x117eaf+':'+_0x4759ec['id'],_0x4759ec);MailAccountEvents[_0x9398('0x6')](_0x117eaf,_0x4759ec);_0x2774cb(null);};}for(var e in events){if(events[_0x9398('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index ca4c96a..b13942d 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 _0x1241=['secure','modernAuthentication','auth','OAuth2','user','CloudProvider','pass','MailAccount','provider','service','host','Smtp','port'];(function(_0x4b49c9,_0x290d55){var _0xab2d67=function(_0x3a8e9c){while(--_0x3a8e9c){_0x4b49c9['push'](_0x4b49c9['shift']());}};_0xab2d67(++_0x290d55);}(_0x1241,0x132));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x2ec41d){return _0x2ec41d['define'](_0x1124('0x0'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2f17e1=this;var _0x51dfd1={'id':_0x2f17e1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2f17e1[_0x1124('0x1')]!=='custom'){_0x51dfd1[_0x1124('0x2')]=_0x2f17e1[_0x1124('0x1')];}else{_0x51dfd1[_0x1124('0x3')]=_0x2f17e1[_0x1124('0x4')][_0x1124('0x3')];_0x51dfd1['port']=_0x2f17e1[_0x1124('0x4')][_0x1124('0x5')];_0x51dfd1[_0x1124('0x6')]=_0x2f17e1[_0x1124('0x4')][_0x1124('0x6')];}if(_0x2f17e1['Smtp']['authentication']){if(_0x2f17e1['Smtp'][_0x1124('0x7')]){if(!_0x2f17e1[_0x1124('0x4')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x51dfd1[_0x1124('0x8')]={'type':_0x1124('0x9'),'user':_0x2f17e1[_0x1124('0x4')][_0x1124('0xa')],'accessToken':_0x2f17e1['Smtp'][_0x1124('0xb')]['data5']};}else{_0x51dfd1['auth']={'user':_0x2f17e1[_0x1124('0x4')][_0x1124('0xa')],'pass':_0x2f17e1[_0x1124('0x4')][_0x1124('0xc')]};}}return _0x51dfd1;}}});}; \ No newline at end of file +var _0x76a6=['secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','service','host','port','Smtp'];(function(_0x171921,_0x1184e8){var _0x54ea06=function(_0x912283){while(--_0x912283){_0x171921['push'](_0x171921['shift']());}};_0x54ea06(++_0x1184e8);}(_0x76a6,0x8e));var _0x676a=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x76a6[_0x137d1d];return _0x485108;};'use strict';var attributes=require(_0x676a('0x0'));module['exports']=function(_0x480986){return _0x480986[_0x676a('0x1')](_0x676a('0x2'),attributes,{'tableName':_0x676a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x42addb=this;var _0x3de419={'id':_0x42addb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x42addb[_0x676a('0x4')]!==_0x676a('0x5')){_0x3de419[_0x676a('0x6')]=_0x42addb['provider'];}else{_0x3de419[_0x676a('0x7')]=_0x42addb['Smtp'][_0x676a('0x7')];_0x3de419[_0x676a('0x8')]=_0x42addb[_0x676a('0x9')][_0x676a('0x8')];_0x3de419[_0x676a('0xa')]=_0x42addb['Smtp'][_0x676a('0xa')];}if(_0x42addb['Smtp'][_0x676a('0xb')]){if(_0x42addb['Smtp'][_0x676a('0xc')]){if(!_0x42addb[_0x676a('0x9')][_0x676a('0xd')])throw new Error(_0x676a('0xe'));_0x3de419[_0x676a('0xf')]={'type':_0x676a('0x10'),'user':_0x42addb[_0x676a('0x9')][_0x676a('0x11')],'accessToken':_0x42addb[_0x676a('0x9')][_0x676a('0xd')]['data5']};}else{_0x3de419[_0x676a('0xf')]={'user':_0x42addb[_0x676a('0x9')][_0x676a('0x11')],'pass':_0x42addb['Smtp'][_0x676a('0x12')]};}}return _0x3de419;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index aad90d7..8eb097d 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 _0x6363=['localhost','register','request','then','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','GetMailAccount','options','raw','where','attributes','map','include','model','ShowMailAccount','MailAccount','find','smtp','smtpOptions','getSmtpOptions','debug','catch','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','autoclose','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','inReplyTo','create','spread','interaction','MailMessage','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','agent','queueId','MailQueue','name','unshift','queue','waitForTheAssignedQueue','Start','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6363,0x13a));var _0x3636=function(_0x539f78,_0x3b83b7){_0x539f78=_0x539f78-0x0;var _0x485577=_0x6363[_0x539f78];return _0x485577;};'use strict';var _=require(_0x3636('0x0'));var moment=require('moment');var BPromise=require(_0x3636('0x1'));var rs=require(_0x3636('0x2'));var Redis=require(_0x3636('0x3'));var db=require(_0x3636('0x4'))['db'];var logger=require(_0x3636('0x5'))(_0x3636('0x6'));var config=require(_0x3636('0x7'));var jayson=require(_0x3636('0x8'));var client=jayson[_0x3636('0x9')][_0x3636('0xa')]({'port':0x232c});config[_0x3636('0xb')]=_[_0x3636('0xc')](config[_0x3636('0xb')],{'host':_0x3636('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3636('0xb')]));require('./mailAccount.socket')[_0x3636('0xe')](socket);function respondWithRpcPromise(_0x3c23e2,_0x23869b,_0x1936b7){return new BPromise(function(_0x1a6c8d,_0x2c9bdd){return client[_0x3636('0xf')](_0x3c23e2,_0x1936b7)[_0x3636('0x10')](function(_0x18f3dc){logger['info']('MailAccount,\x20%s,\x20%s',_0x23869b,_0x3636('0x11'));logger['debug'](_0x3636('0x12'),_0x23869b,_0x3636('0x11'),JSON[_0x3636('0x13')](_0x18f3dc));if(_0x18f3dc[_0x3636('0x14')]){if(_0x18f3dc[_0x3636('0x14')][_0x3636('0x15')]===0x1f4){logger[_0x3636('0x14')](_0x3636('0x16'),_0x23869b,_0x18f3dc[_0x3636('0x14')][_0x3636('0x17')]);return _0x2c9bdd(_0x18f3dc[_0x3636('0x14')][_0x3636('0x17')]);}logger[_0x3636('0x14')](_0x3636('0x16'),_0x23869b,_0x18f3dc[_0x3636('0x14')][_0x3636('0x17')]);return _0x1a6c8d(_0x18f3dc[_0x3636('0x14')]['message']);}else{logger[_0x3636('0x18')](_0x3636('0x16'),_0x23869b,'request\x20sent');_0x1a6c8d(_0x18f3dc[_0x3636('0x19')]['message']);}})['catch'](function(_0xae6469){logger[_0x3636('0x14')](_0x3636('0x16'),_0x23869b,_0xae6469);_0x2c9bdd(_0xae6469);});});}exports[_0x3636('0x1a')]=function(_0xe0e633){var _0x39e367=this;return new Promise(function(_0xa2b8fe,_0x122aae){return db['MailAccount']['findAll']({'raw':_0xe0e633[_0x3636('0x1b')]?_0xe0e633[_0x3636('0x1b')][_0x3636('0x1c')]===undefined?!![]:![]:!![],'where':_0xe0e633['options']?_0xe0e633[_0x3636('0x1b')][_0x3636('0x1d')]||null:null,'attributes':_0xe0e633[_0x3636('0x1b')]?_0xe0e633[_0x3636('0x1b')][_0x3636('0x1e')]||null:null,'limit':_0xe0e633[_0x3636('0x1b')]?_0xe0e633['options']['limit']||null:null,'include':_0xe0e633[_0x3636('0x1b')]?_0xe0e633['options']['include']?_[_0x3636('0x1f')](_0xe0e633['options'][_0x3636('0x20')],function(_0x4c24cf){return{'model':db[_0x4c24cf[_0x3636('0x21')]],'as':_0x4c24cf['as'],'attributes':_0x4c24cf[_0x3636('0x1e')],'include':_0x4c24cf[_0x3636('0x20')]?_[_0x3636('0x1f')](_0x4c24cf[_0x3636('0x20')],function(_0x20ca8b){return{'model':db[_0x20ca8b[_0x3636('0x21')]],'as':_0x20ca8b['as'],'attributes':_0x20ca8b[_0x3636('0x1e')],'include':_0x20ca8b[_0x3636('0x20')]?_[_0x3636('0x1f')](_0x20ca8b[_0x3636('0x20')],function(_0x550443){return{'model':db[_0x550443[_0x3636('0x21')]],'as':_0x550443['as'],'attributes':_0x550443[_0x3636('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3636('0x10')](function(_0x22b12f){logger[_0x3636('0x18')](_0x3636('0x1a'),_0xe0e633);logger['debug'](_0x3636('0x1a'),_0xe0e633,JSON[_0x3636('0x13')](_0x22b12f));_0xa2b8fe(_0x22b12f);})['catch'](function(_0x8fffb0){logger[_0x3636('0x14')](_0x3636('0x1a'),_0x8fffb0[_0x3636('0x17')],_0xe0e633);_0x122aae(_0x39e367[_0x3636('0x14')](0x1f4,_0x8fffb0['message']));});});};exports[_0x3636('0x22')]=function(_0x1fc07c){var _0x143139=this;return new Promise(function(_0x2887de,_0x184fa8){return db[_0x3636('0x23')][_0x3636('0x24')]({'raw':_0x1fc07c[_0x3636('0x1b')]?_0x1fc07c[_0x3636('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1fc07c['options']?_0x1fc07c[_0x3636('0x1b')]['where']||null:null,'attributes':_0x1fc07c['options']?_0x1fc07c[_0x3636('0x1b')][_0x3636('0x1e')]||null:null,'include':_0x1fc07c[_0x3636('0x1b')]?_0x1fc07c['options'][_0x3636('0x20')]?_[_0x3636('0x1f')](_0x1fc07c[_0x3636('0x1b')][_0x3636('0x20')],function(_0x24e873){return{'model':db[_0x24e873[_0x3636('0x21')]],'as':_0x24e873['as'],'attributes':_0x24e873[_0x3636('0x1e')],'include':_0x24e873[_0x3636('0x20')]?_[_0x3636('0x1f')](_0x24e873[_0x3636('0x20')],function(_0x21eb9a){return{'model':db[_0x21eb9a[_0x3636('0x21')]],'as':_0x21eb9a['as'],'attributes':_0x21eb9a[_0x3636('0x1e')],'include':_0x21eb9a['include']?_[_0x3636('0x1f')](_0x21eb9a[_0x3636('0x20')],function(_0x12edf8){return{'model':db[_0x12edf8[_0x3636('0x21')]],'as':_0x12edf8['as'],'attributes':_0x12edf8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e5831){if(_0x1fc07c[_0x3636('0x1b')][_0x3636('0x25')]===!![])_0x1e5831['setDataValue'](_0x3636('0x26'),_0x1e5831[_0x3636('0x27')]());logger['info']('ShowMailAccount',_0x1fc07c);logger[_0x3636('0x28')]('ShowMailAccount',_0x1fc07c,JSON[_0x3636('0x13')](_0x1e5831));_0x2887de(_0x1e5831);})[_0x3636('0x29')](function(_0x195240){logger[_0x3636('0x14')](_0x3636('0x22'),_0x195240[_0x3636('0x17')],_0x1fc07c);_0x184fa8(_0x143139[_0x3636('0x14')](0x1f4,_0x195240[_0x3636('0x17')]));});});};exports[_0x3636('0x2a')]=function(_0x4bdade){var _0x30cf4e=this;return new Promise(function(_0x44cb9c,_0x261f67){var _0x9aa815={'body':_0x4bdade[_0x3636('0x2b')],'channel':_0x3636('0x2c')};var _0x28d6fb=_[_0x3636('0x2d')](_[_0x3636('0x2e')](db['CmContact'][_0x3636('0x2f')]),[_0x3636('0x30'),_0x3636('0x31'),_0x3636('0x32'),_0x3636('0x33')]);var _0x122cb2=![];if(_0x4bdade[_0x3636('0x2b')]['id']){delete _0x4bdade[_0x3636('0x2b')]['id'];}if(_[_0x3636('0x34')](_0x4bdade[_0x3636('0x2b')][_0x3636('0x35')])){return _0x261f67(_0x30cf4e[_0x3636('0x14')](0x1f4,_0x3636('0x36')));}if(_[_0x3636('0x34')](_0x4bdade[_0x3636('0x2b')]['body'])||_0x4bdade[_0x3636('0x2b')][_0x3636('0x2b')]===''){return _0x261f67(_0x30cf4e[_0x3636('0x14')](0x1f4,_0x3636('0x37')));}if(_[_0x3636('0x34')](_0x4bdade[_0x3636('0x2b')][_0x3636('0x38')])){return _0x261f67(_0x30cf4e[_0x3636('0x14')](0x1f4,_0x3636('0x39')+_0x28d6fb));}if(!_[_0x3636('0x3a')](_0x28d6fb,_0x4bdade[_0x3636('0x2b')][_0x3636('0x38')])){return _0x261f67(_0x30cf4e[_0x3636('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28d6fb));}var _0x4ed1d7={};_0x4ed1d7[_0x4bdade['body'][_0x3636('0x38')]]=_0x4bdade['body']['from'];return db[_0x3636('0x23')][_0x3636('0x24')]({'where':{'id':_0x4bdade[_0x3636('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0x3636('0x3c'),'include':[{'model':db[_0x3636('0x3d')],'as':_0x3636('0x3e'),'where':_0x4ed1d7,'limit':0x1,'order':[[_0x3636('0x31'),_0x3636('0x3f')]]}]},{'model':db[_0x3636('0x40')],'as':_0x3636('0x41')},{'model':db[_0x3636('0x42')],'as':_0x3636('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x3636('0x44')}]}]})[_0x3636('0x10')](function(_0x16b65a){if(_0x16b65a&&_0x16b65a[_0x3636('0x3c')]){var _0x12be53=_0x16b65a[_0x3636('0x45')]({'plain':!![]});_0x9aa815['account']=_[_0x3636('0x46')](_0x12be53,[_0x3636('0x41'),_0x3636('0x3c')]);_0x9aa815[_0x3636('0x3b')][_0x3636('0x26')]=_0x16b65a['getSmtpOptions']();_0x9aa815[_0x3636('0x47')]=_0x12be53[_0x3636('0x41')];_0x9aa815[_0x3636('0x48')]=_0x12be53[_0x3636('0x3c')];_0x9aa815[_0x3636('0x47')]=_['orderBy'](_0x9aa815[_0x3636('0x47')],['priority'],['asc']);if(_0x9aa815[_0x3636('0x3b')]&&_0x9aa815[_0x3636('0x3b')][_0x3636('0x49')]){_0x9aa815[_0x3636('0x47')]['push']({'id':0x0,'priority':_0x9aa815['applications'][_0x3636('0x4a')]+0x1,'app':_0x3636('0x4b'),'appdata':_0x3636('0x49'),'interval':_0x3636('0x4c')});}if(_0x9aa815[_0x3636('0x3b')][_0x3636('0x41')]){delete _0x9aa815['account'][_0x3636('0x41')];}if(_0x9aa815[_0x3636('0x3b')][_0x3636('0x3c')]){delete _0x9aa815[_0x3636('0x3b')][_0x3636('0x3c')];}if(_0x12be53[_0x3636('0x3c')][_0x3636('0x3e')][_0x3636('0x4a')]){return _0x12be53['List'][_0x3636('0x3e')][0x0];}var _0x5b2b74=_[_0x3636('0xc')](_0x4bdade['body'],{'firstName':_0x4bdade[_0x3636('0x2b')][_0x3636('0x35')],'ListId':_0x12be53[_0x3636('0x33')]});_0x5b2b74[_0x4bdade[_0x3636('0x2b')][_0x3636('0x38')]]=_0x4bdade[_0x3636('0x2b')]['from'];return db[_0x3636('0x3d')]['create'](_0x5b2b74);}else{throw new Error(_0x3636('0x4d'));}})[_0x3636('0x10')](function(_0x442ff2){_0x9aa815[_0x3636('0x4e')]=_0x442ff2;if(_0x442ff2){if(!_0x4bdade['body'][_0x3636('0x17')][_0x3636('0x4f')]){_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x4f')]=rs[_0x3636('0x50')]()+'\x20'+_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x35')];}var _0x58f7d2={'ContactId':_0x442ff2['id'],'MailAccountId':_0x4bdade[_0x3636('0x3b')]['id'],'inReplyTo':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x4f')],'to':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x35')],'cc':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')]['cc'],'subject':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x51')],'attach':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x52')],'lastMsgAt':moment()[_0x3636('0x53')](_0x3636('0x54')),'lastMsgDirection':'in'};return db[_0x3636('0x55')][_0x3636('0x24')]({'where':{'closed':![],'MailAccountId':_0x4bdade[_0x3636('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x3636('0x4f')],'where':{'messageId':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x56')]}}]})[_0x3636('0x10')](function(_0xb77e30){if(_0xb77e30){return[_0xb77e30,![]];}return db[_0x3636('0x55')][_0x3636('0x57')](_0x58f7d2)['then'](function(_0x1df426){return[_0x1df426,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3636('0x58')](function(_0x2115e4,_0x228716){if(_0x2115e4){_0x122cb2=_0x228716;if(!_0x228716){return _0x2115e4['update']({'inReplyTo':_0x4bdade[_0x3636('0x2b')]['message'][_0x3636('0x4f')],'to':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x35')],'cc':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')]['cc'],'subject':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x51')],'attach':_0x2115e4[_0x3636('0x52')]?_0x2115e4['attach']:_0x4bdade['body']['message'][_0x3636('0x52')],'substatus':null,'substatusAt':moment()['format'](_0x3636('0x54')),'lastMsgAt':moment()[_0x3636('0x53')](_0x3636('0x54')),'lastMsgDirection':'in'});}else{return _0x2115e4;}}})['then'](function(_0x30e757){_0x9aa815[_0x3636('0x59')]=_0x30e757[_0x3636('0x45')]({'plain':!![]});_0x9aa815[_0x3636('0x59')]['created']=_0x122cb2;return db[_0x3636('0x5a')]['create']({'body':_0x4bdade[_0x3636('0x2b')]['body'],'MailAccountId':_0x4bdade['account']['id'],'MailInteractionId':_0x30e757['id'],'direction':'in','ContactId':_0x9aa815[_0x3636('0x4e')]['id'],'messageId':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x4f')],'from':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')]['from'],'to':_0x4bdade['body'][_0x3636('0x17')]['to'],'cc':_0x4bdade['body'][_0x3636('0x17')]['cc'],'subject':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x51')],'attach':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x52')],'Attachments':_0x4bdade[_0x3636('0x2b')]['message'][_0x3636('0x5b')],'originTo':_0x4bdade['body']['message'][_0x3636('0x5c')],'originCc':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x5d')],'bcc':_0x4bdade['body'][_0x3636('0x17')]['bcc'],'ChatWebsiteId':_0x4bdade['body'][_0x3636('0x17')][_0x3636('0x5e')]||null,'originChannel':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x5f')]||'Email','ChatOfflineMessageId':_0x4bdade[_0x3636('0x2b')][_0x3636('0x17')][_0x3636('0x60')]||null},{'include':[{'model':db[_0x3636('0x61')],'as':_0x3636('0x62')}]});})[_0x3636('0x10')](function(_0xb4ff3){_0x9aa815[_0x3636('0x17')]=_0xb4ff3;if(!_0x9aa815[_0x3636('0x59')][_0x3636('0x63')]){return;}return db[_0x3636('0x64')][_0x3636('0x24')]({'attributes':['id','name'],'where':{'id':_0x9aa815['interaction']['UserId']}});})[_0x3636('0x10')](function(_0x3501a8){if(_0x3501a8){_0x9aa815[_0x3636('0x47')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3636('0x65'),'appdata':_0x3501a8['name']+','+(_0x9aa815[_0x3636('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x3636('0x4c')});}if(!_0x9aa815['interaction'][_0x3636('0x66')]){return;}return db[_0x3636('0x67')]['find']({'attributes':['id',_0x3636('0x68')],'where':{'id':_0x9aa815['interaction']['queueId']}});})[_0x3636('0x10')](function(_0x38f6ac){if(_0x38f6ac){_0x9aa815[_0x3636('0x47')][_0x3636('0x69')]({'id':0x0,'priority':0x1,'app':_0x3636('0x6a'),'appdata':_0x38f6ac[_0x3636('0x68')]+','+(_0x9aa815[_0x3636('0x3b')][_0x3636('0x6b')]||0x12c),'interval':_0x3636('0x4c')});}return respondWithRpcPromise(_0x3636('0x6c'),'startRouting',_0x9aa815);})[_0x3636('0x10')](function(_0x212b86){_0x44cb9c(_0x212b86);})[_0x3636('0x29')](function(_0x5816f5){_0x261f67(_0x30cf4e[_0x3636('0x14')](0x1f4,_0x5816f5[_0x3636('0x17')]));});});}; \ No newline at end of file +var _0xfd2e=['agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','include','map','model','stringify','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','getSmtpOptions','body','mail','CmContact','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','MailApplication','MailServerOut','CloudProvider','List','omit','list','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','Applications','create','contact','messageId','generate','attach','MailInteraction','MailMessage','Messages','inReplyTo','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','subject','attachments','originTo','originCc','ChatWebsiteId','originChannel','Attachment','UserId','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd2e,0x6e));var _0xefd2=function(_0x2ab4af,_0x759edf){_0x2ab4af=_0x2ab4af-0x0;var _0x207d43=_0xfd2e[_0x2ab4af];return _0x207d43;};'use strict';var _=require(_0xefd2('0x0'));var moment=require('moment');var BPromise=require(_0xefd2('0x1'));var rs=require('randomstring');var Redis=require(_0xefd2('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xefd2('0x3'))(_0xefd2('0x4'));var config=require(_0xefd2('0x5'));var jayson=require(_0xefd2('0x6'));var client=jayson[_0xefd2('0x7')]['http']({'port':0x232c});config['redis']=_[_0xefd2('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xefd2('0x9'))(new Redis(config['redis']));require(_0xefd2('0xa'))[_0xefd2('0xb')](socket);function respondWithRpcPromise(_0x4483e5,_0xded765,_0xa787ba){return new BPromise(function(_0x2d7d0d,_0x602f0){return client['request'](_0x4483e5,_0xa787ba)[_0xefd2('0xc')](function(_0x349eea){logger[_0xefd2('0xd')](_0xefd2('0xe'),_0xded765,_0xefd2('0xf'));logger[_0xefd2('0x10')](_0xefd2('0x11'),_0xded765,_0xefd2('0xf'),JSON['stringify'](_0x349eea));if(_0x349eea['error']){if(_0x349eea[_0xefd2('0x12')]['code']===0x1f4){logger['error'](_0xefd2('0xe'),_0xded765,_0x349eea[_0xefd2('0x12')][_0xefd2('0x13')]);return _0x602f0(_0x349eea[_0xefd2('0x12')][_0xefd2('0x13')]);}logger['error'](_0xefd2('0xe'),_0xded765,_0x349eea[_0xefd2('0x12')][_0xefd2('0x13')]);return _0x2d7d0d(_0x349eea[_0xefd2('0x12')][_0xefd2('0x13')]);}else{logger[_0xefd2('0xd')]('MailAccount,\x20%s,\x20%s',_0xded765,'request\x20sent');_0x2d7d0d(_0x349eea[_0xefd2('0x14')][_0xefd2('0x13')]);}})[_0xefd2('0x15')](function(_0x471175){logger[_0xefd2('0x12')]('MailAccount,\x20%s,\x20%s',_0xded765,_0x471175);_0x602f0(_0x471175);});});}exports[_0xefd2('0x16')]=function(_0x1ca355){var _0x33c88f=this;return new Promise(function(_0x11baea,_0x4d2e38){return db[_0xefd2('0x17')][_0xefd2('0x18')]({'raw':_0x1ca355[_0xefd2('0x19')]?_0x1ca355[_0xefd2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1ca355[_0xefd2('0x19')]?_0x1ca355[_0xefd2('0x19')][_0xefd2('0x1a')]||null:null,'attributes':_0x1ca355[_0xefd2('0x19')]?_0x1ca355[_0xefd2('0x19')][_0xefd2('0x1b')]||null:null,'limit':_0x1ca355[_0xefd2('0x19')]?_0x1ca355['options']['limit']||null:null,'include':_0x1ca355[_0xefd2('0x19')]?_0x1ca355[_0xefd2('0x19')][_0xefd2('0x1c')]?_[_0xefd2('0x1d')](_0x1ca355[_0xefd2('0x19')][_0xefd2('0x1c')],function(_0x42e4e6){return{'model':db[_0x42e4e6[_0xefd2('0x1e')]],'as':_0x42e4e6['as'],'attributes':_0x42e4e6[_0xefd2('0x1b')],'include':_0x42e4e6[_0xefd2('0x1c')]?_[_0xefd2('0x1d')](_0x42e4e6['include'],function(_0x348019){return{'model':db[_0x348019[_0xefd2('0x1e')]],'as':_0x348019['as'],'attributes':_0x348019[_0xefd2('0x1b')],'include':_0x348019[_0xefd2('0x1c')]?_[_0xefd2('0x1d')](_0x348019[_0xefd2('0x1c')],function(_0x14f0fe){return{'model':db[_0x14f0fe['model']],'as':_0x14f0fe['as'],'attributes':_0x14f0fe[_0xefd2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xefd2('0xc')](function(_0x25f25a){logger[_0xefd2('0xd')](_0xefd2('0x16'),_0x1ca355);logger['debug'](_0xefd2('0x16'),_0x1ca355,JSON[_0xefd2('0x1f')](_0x25f25a));_0x11baea(_0x25f25a);})['catch'](function(_0x2ebfdc){logger[_0xefd2('0x12')](_0xefd2('0x16'),_0x2ebfdc[_0xefd2('0x13')],_0x1ca355);_0x4d2e38(_0x33c88f[_0xefd2('0x12')](0x1f4,_0x2ebfdc[_0xefd2('0x13')]));});});};exports[_0xefd2('0x20')]=function(_0x1202a2){var _0xe3f882=this;return new Promise(function(_0x18f86f,_0x2ba82c){return db['MailAccount'][_0xefd2('0x21')]({'raw':_0x1202a2[_0xefd2('0x19')]?_0x1202a2[_0xefd2('0x19')][_0xefd2('0x22')]===undefined?!![]:![]:!![],'where':_0x1202a2[_0xefd2('0x19')]?_0x1202a2[_0xefd2('0x19')][_0xefd2('0x1a')]||null:null,'attributes':_0x1202a2[_0xefd2('0x19')]?_0x1202a2[_0xefd2('0x19')][_0xefd2('0x1b')]||null:null,'include':_0x1202a2[_0xefd2('0x19')]?_0x1202a2['options'][_0xefd2('0x1c')]?_[_0xefd2('0x1d')](_0x1202a2['options'][_0xefd2('0x1c')],function(_0xd54536){return{'model':db[_0xd54536['model']],'as':_0xd54536['as'],'attributes':_0xd54536['attributes'],'include':_0xd54536[_0xefd2('0x1c')]?_['map'](_0xd54536[_0xefd2('0x1c')],function(_0x42f7ba){return{'model':db[_0x42f7ba[_0xefd2('0x1e')]],'as':_0x42f7ba['as'],'attributes':_0x42f7ba[_0xefd2('0x1b')],'include':_0x42f7ba[_0xefd2('0x1c')]?_['map'](_0x42f7ba[_0xefd2('0x1c')],function(_0x9f118d){return{'model':db[_0x9f118d[_0xefd2('0x1e')]],'as':_0x9f118d['as'],'attributes':_0x9f118d[_0xefd2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xefd2('0xc')](function(_0x1f189c){if(_0x1202a2[_0xefd2('0x19')][_0xefd2('0x23')]===!![])_0x1f189c[_0xefd2('0x24')](_0xefd2('0x25'),_0x1f189c[_0xefd2('0x26')]());logger[_0xefd2('0xd')](_0xefd2('0x20'),_0x1202a2);logger[_0xefd2('0x10')](_0xefd2('0x20'),_0x1202a2,JSON[_0xefd2('0x1f')](_0x1f189c));_0x18f86f(_0x1f189c);})[_0xefd2('0x15')](function(_0x1d3204){logger[_0xefd2('0x12')](_0xefd2('0x20'),_0x1d3204[_0xefd2('0x13')],_0x1202a2);_0x2ba82c(_0xe3f882['error'](0x1f4,_0x1d3204[_0xefd2('0x13')]));});});};exports['NotifyMailAccount']=function(_0x46495b){var _0x4ffec4=this;return new Promise(function(_0x5586ba,_0x42191a){var _0x3a4667={'body':_0x46495b[_0xefd2('0x27')],'channel':_0xefd2('0x28')};var _0x246403=_['difference'](_['keys'](db[_0xefd2('0x29')]['rawAttributes']),[_0xefd2('0x2a'),_0xefd2('0x2b'),'CompanyId',_0xefd2('0x2c')]);var _0xc43985=![];if(_0x46495b[_0xefd2('0x27')]['id']){delete _0x46495b[_0xefd2('0x27')]['id'];}if(_['isNil'](_0x46495b[_0xefd2('0x27')][_0xefd2('0x2d')])){return _0x42191a(_0x4ffec4['error'](0x1f4,_0xefd2('0x2e')));}if(_['isNil'](_0x46495b[_0xefd2('0x27')]['body'])||_0x46495b['body'][_0xefd2('0x27')]===''){return _0x42191a(_0x4ffec4[_0xefd2('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xefd2('0x2f')](_0x46495b['body'][_0xefd2('0x30')])){return _0x42191a(_0x4ffec4['error'](0x1f4,_0xefd2('0x31')+_0x246403));}if(!_[_0xefd2('0x32')](_0x246403,_0x46495b[_0xefd2('0x27')]['mapKey'])){return _0x42191a(_0x4ffec4[_0xefd2('0x12')](0x1f4,_0xefd2('0x33')+_0x246403));}var _0x5a43a5={};_0x5a43a5[_0x46495b['body'][_0xefd2('0x30')]]=_0x46495b[_0xefd2('0x27')]['from'];return db[_0xefd2('0x17')][_0xefd2('0x21')]({'where':{'id':_0x46495b[_0xefd2('0x34')]['id']},'include':[{'model':db[_0xefd2('0x35')],'as':'List','include':[{'model':db[_0xefd2('0x29')],'as':_0xefd2('0x36'),'where':_0x5a43a5,'limit':0x1,'order':[[_0xefd2('0x2b'),'DESC']]}]},{'model':db[_0xefd2('0x37')],'as':'Applications'},{'model':db[_0xefd2('0x38')],'as':'Smtp','include':[{'model':db[_0xefd2('0x39')],'as':_0xefd2('0x39')}]}]})['then'](function(_0x2a4f7b){if(_0x2a4f7b&&_0x2a4f7b[_0xefd2('0x3a')]){var _0xada2a0=_0x2a4f7b['get']({'plain':!![]});_0x3a4667['account']=_[_0xefd2('0x3b')](_0xada2a0,['Applications',_0xefd2('0x3a')]);_0x3a4667[_0xefd2('0x34')][_0xefd2('0x25')]=_0x2a4f7b['getSmtpOptions']();_0x3a4667['applications']=_0xada2a0['Applications'];_0x3a4667[_0xefd2('0x3c')]=_0xada2a0[_0xefd2('0x3a')];_0x3a4667[_0xefd2('0x3d')]=_[_0xefd2('0x3e')](_0x3a4667[_0xefd2('0x3d')],['priority'],[_0xefd2('0x3f')]);if(_0x3a4667[_0xefd2('0x34')]&&_0x3a4667[_0xefd2('0x34')][_0xefd2('0x40')]){_0x3a4667[_0xefd2('0x3d')][_0xefd2('0x41')]({'id':0x0,'priority':_0x3a4667[_0xefd2('0x3d')][_0xefd2('0x42')]+0x1,'app':_0xefd2('0x43'),'appdata':_0xefd2('0x40'),'interval':_0xefd2('0x44')});}if(_0x3a4667[_0xefd2('0x34')][_0xefd2('0x45')]){delete _0x3a4667[_0xefd2('0x34')][_0xefd2('0x45')];}if(_0x3a4667[_0xefd2('0x34')][_0xefd2('0x3a')]){delete _0x3a4667[_0xefd2('0x34')][_0xefd2('0x3a')];}if(_0xada2a0['List'][_0xefd2('0x36')][_0xefd2('0x42')]){return _0xada2a0[_0xefd2('0x3a')][_0xefd2('0x36')][0x0];}var _0x5d4fc7=_[_0xefd2('0x8')](_0x46495b[_0xefd2('0x27')],{'firstName':_0x46495b[_0xefd2('0x27')][_0xefd2('0x2d')],'ListId':_0xada2a0[_0xefd2('0x2c')]});_0x5d4fc7[_0x46495b[_0xefd2('0x27')][_0xefd2('0x30')]]=_0x46495b[_0xefd2('0x27')][_0xefd2('0x2d')];return db[_0xefd2('0x29')][_0xefd2('0x46')](_0x5d4fc7);}else{throw new Error('List\x20not\x20found');}})[_0xefd2('0xc')](function(_0x105e1a){_0x3a4667[_0xefd2('0x47')]=_0x105e1a;if(_0x105e1a){if(!_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x48')]){_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x48')]=rs[_0xefd2('0x49')]()+'\x20'+_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x2d')];}var _0x38b642={'ContactId':_0x105e1a['id'],'MailAccountId':_0x46495b['account']['id'],'inReplyTo':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')]['messageId'],'to':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x2d')],'cc':_0x46495b['body']['message']['cc'],'subject':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')]['subject'],'attach':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x4a')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xefd2('0x4b')][_0xefd2('0x21')]({'where':{'closed':![],'MailAccountId':_0x46495b['account']['id']},'include':[{'model':db[_0xefd2('0x4c')],'as':_0xefd2('0x4d'),'attributes':[_0xefd2('0x48')],'where':{'messageId':_0x46495b[_0xefd2('0x27')]['message'][_0xefd2('0x4e')]}}]})['then'](function(_0x5c1c28){if(_0x5c1c28){return[_0x5c1c28,![]];}return db['MailInteraction'][_0xefd2('0x46')](_0x38b642)[_0xefd2('0xc')](function(_0x40cf35){return[_0x40cf35,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x586925,_0x54305d){if(_0x586925){_0xc43985=_0x54305d;if(!_0x54305d){return _0x586925[_0xefd2('0x4f')]({'inReplyTo':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x48')],'to':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')]['from'],'cc':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')]['cc'],'subject':_0x46495b['body'][_0xefd2('0x13')]['subject'],'attach':_0x586925[_0xefd2('0x4a')]?_0x586925[_0xefd2('0x4a')]:_0x46495b[_0xefd2('0x27')]['message']['attach'],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xefd2('0x50')](_0xefd2('0x51')),'lastMsgDirection':'in'});}else{return _0x586925;}}})[_0xefd2('0xc')](function(_0x5bf630){_0x3a4667[_0xefd2('0x52')]=_0x5bf630[_0xefd2('0x53')]({'plain':!![]});_0x3a4667['interaction'][_0xefd2('0x54')]=_0xc43985;return db[_0xefd2('0x4c')]['create']({'body':_0x46495b[_0xefd2('0x27')][_0xefd2('0x27')],'MailAccountId':_0x46495b[_0xefd2('0x34')]['id'],'MailInteractionId':_0x5bf630['id'],'direction':'in','ContactId':_0x3a4667[_0xefd2('0x47')]['id'],'messageId':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x48')],'from':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x2d')],'to':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')]['to'],'cc':_0x46495b[_0xefd2('0x27')]['message']['cc'],'subject':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x55')],'attach':_0x46495b['body'][_0xefd2('0x13')][_0xefd2('0x4a')],'Attachments':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x56')],'originTo':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x57')],'originCc':_0x46495b[_0xefd2('0x27')]['message'][_0xefd2('0x58')],'bcc':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')]['bcc'],'ChatWebsiteId':_0x46495b[_0xefd2('0x27')][_0xefd2('0x13')][_0xefd2('0x59')]||null,'originChannel':_0x46495b['body'][_0xefd2('0x13')][_0xefd2('0x5a')]||'Email','ChatOfflineMessageId':_0x46495b['body'][_0xefd2('0x13')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xefd2('0x5b')],'as':'Attachments'}]});})[_0xefd2('0xc')](function(_0x105fee){_0x3a4667[_0xefd2('0x13')]=_0x105fee;if(!_0x3a4667[_0xefd2('0x52')][_0xefd2('0x5c')]){return;}return db['User'][_0xefd2('0x21')]({'attributes':['id',_0xefd2('0x5d')],'where':{'id':_0x3a4667['interaction'][_0xefd2('0x5c')]}});})[_0xefd2('0xc')](function(_0x634dc9){if(_0x634dc9){_0x3a4667['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xefd2('0x5e'),'appdata':_0x634dc9[_0xefd2('0x5d')]+','+(_0x3a4667[_0xefd2('0x34')][_0xefd2('0x5f')]||0xa),'interval':'*,*,*,*'});}if(!_0x3a4667[_0xefd2('0x52')][_0xefd2('0x60')]){return;}return db[_0xefd2('0x61')]['find']({'attributes':['id',_0xefd2('0x5d')],'where':{'id':_0x3a4667[_0xefd2('0x52')][_0xefd2('0x60')]}});})['then'](function(_0x788c4a){if(_0x788c4a){_0x3a4667[_0xefd2('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0xefd2('0x62'),'appdata':_0x788c4a[_0xefd2('0x5d')]+','+(_0x3a4667[_0xefd2('0x34')][_0xefd2('0x63')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xefd2('0x64'),_0xefd2('0x65'),_0x3a4667);})[_0xefd2('0xc')](function(_0x537896){_0x5586ba(_0x537896);})[_0xefd2('0x15')](function(_0xe47b3){_0x42191a(_0x4ffec4[_0xefd2('0x12')](0x1f4,_0xe47b3[_0xefd2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e3c80a6..e21603a 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 _0x2ade=['./mailAccount.events','save','remove','update','removeListener','register','mailAccount:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2ade,0xb6));var _0xe2ad=function(_0x49e460,_0x48dad0){_0x49e460=_0x49e460-0x0;var _0x221580=_0x2ade[_0x49e460];return _0x221580;};'use strict';var MailAccountEvents=require(_0xe2ad('0x0'));var events=[_0xe2ad('0x1'),_0xe2ad('0x2'),_0xe2ad('0x3')];function createListener(_0x43b1eb,_0x3bf76d){return function(_0x3e0dd0){_0x3bf76d['emit'](_0x43b1eb,_0x3e0dd0);};}function removeListener(_0x288ea8,_0xca64ac){return function(){MailAccountEvents[_0xe2ad('0x4')](_0x288ea8,_0xca64ac);};}exports[_0xe2ad('0x5')]=function(_0x100613){for(var _0x49b6fe=0x0,_0x67c365=events['length'];_0x49b6fe<_0x67c365;_0x49b6fe++){var _0x3d785b=events[_0x49b6fe];var _0x900511=createListener(_0xe2ad('0x6')+_0x3d785b,_0x100613);MailAccountEvents['on'](_0x3d785b,_0x900511);}}; \ No newline at end of file +var _0x5b1a=['update','emit','removeListener','register','mailAccount:','./mailAccount.events','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5b1a,0x8d));var _0xa5b1=function(_0x1262ab,_0xab8c7a){_0x1262ab=_0x1262ab-0x0;var _0x206d24=_0x5b1a[_0x1262ab];return _0x206d24;};'use strict';var MailAccountEvents=require(_0xa5b1('0x0'));var events=[_0xa5b1('0x1'),_0xa5b1('0x2'),_0xa5b1('0x3')];function createListener(_0x31ab9f,_0x4d53f4){return function(_0x21ac10){_0x4d53f4[_0xa5b1('0x4')](_0x31ab9f,_0x21ac10);};}function removeListener(_0x2c4876,_0x5b61a7){return function(){MailAccountEvents[_0xa5b1('0x5')](_0x2c4876,_0x5b61a7);};}exports[_0xa5b1('0x6')]=function(_0x542d29){for(var _0x168630=0x0,_0x1f3221=events['length'];_0x168630<_0x1f3221;_0x168630++){var _0x350c22=events[_0x168630];var _0x48298a=createListener(_0xa5b1('0x7')+_0x350c22,_0x542d29);MailAccountEvents['on'](_0x350c22,_0x48298a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5141381..efb0008 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 _0xeae0=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xeae0,0x68));var _0x0eae=function(_0x421e3a,_0xd69d11){_0x421e3a=_0x421e3a-0x0;var _0x3f9abd=_0xeae0[_0x421e3a];return _0x3f9abd;};'use strict';var multer=require(_0x0eae('0x0'));var util=require('util');var path=require(_0x0eae('0x1'));var timeout=require('connect-timeout');var express=require(_0x0eae('0x2'));var router=express[_0x0eae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0eae('0x4'));var interaction=require(_0x0eae('0x5'));var config=require(_0x0eae('0x6'));var controller=require(_0x0eae('0x7'));router['get'](_0x0eae('0x8'),auth['isAuthenticated'](),controller['show']);router['put'](_0x0eae('0x8'),auth[_0x0eae('0x9')](),controller[_0x0eae('0xa')]);router[_0x0eae('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x0eae('0xc')]);module[_0x0eae('0xd')]=router; \ No newline at end of file +var _0x62b0=['destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','update'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x62b0,0x16d));var _0x062b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x062b('0x0'));var path=require(_0x062b('0x1'));var timeout=require(_0x062b('0x2'));var express=require(_0x062b('0x3'));var router=express['Router']();var fs_extra=require(_0x062b('0x4'));var auth=require(_0x062b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x062b('0x6'));var controller=require(_0x062b('0x7'));router['get'](_0x062b('0x8'),auth[_0x062b('0x9')](),controller[_0x062b('0xa')]);router['put'](_0x062b('0x8'),auth['isAuthenticated'](),controller[_0x062b('0xb')]);router['delete']('/:id',auth[_0x062b('0x9')](),controller[_0x062b('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a55152d..8c6919e 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 _0x7430=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0x22a51b,_0x196894){var _0x1af6bf=function(_0x3f6384){while(--_0x3f6384){_0x22a51b['push'](_0x22a51b['shift']());}};_0x1af6bf(++_0x196894);}(_0x7430,0x1d8));var _0x0743=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7430[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x0743('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x0743('0x1')],'allowNull':![],'defaultValue':_0x0743('0x2')},'appdata':{'type':Sequelize[_0x0743('0x3')]()},'description':{'type':Sequelize[_0x0743('0x1')]},'interval':{'type':Sequelize[_0x0743('0x1')],'defaultValue':_0x0743('0x4')}}; \ No newline at end of file +var _0x8ed2=['exports','STRING','*,*,*,*','sequelize'];(function(_0x130209,_0x2cc129){var _0x155fb7=function(_0x891a60){while(--_0x891a60){_0x130209['push'](_0x130209['shift']());}};_0x155fb7(++_0x2cc129);}(_0x8ed2,0xb3));var _0x28ed=function(_0x274cd2,_0x22963e){_0x274cd2=_0x274cd2-0x0;var _0x5a3aeb=_0x8ed2[_0x274cd2];return _0x5a3aeb;};'use strict';var Sequelize=require(_0x28ed('0x0'));module[_0x28ed('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x28ed('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x28ed('0x2')],'defaultValue':_0x28ed('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a965187..da2948b 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x331e28,_0x163e3c){var _0x42abb8=function(_0x2bdc7f){while(--_0x2bdc7f){_0x331e28['push'](_0x331e28['shift']());}};_0x42abb8(++_0x163e3c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x5cfc52,_0xf125bd){var _0x1677a9=function(_0x17dd76){while(--_0x17dd76){_0x5cfc52['push'](_0x5cfc52['shift']());}};_0x1677a9(++_0xf125bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 103a89b..0c12307 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 _0x58a9=['request-promise','path','rimraf','./mailApplication.attributes','MailApplication','mail_applications','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3ed3e4,_0x5a7be5){var _0x31f149=function(_0x1ea38b){while(--_0x1ea38b){_0x3ed3e4['push'](_0x3ed3e4['shift']());}};_0x31f149(++_0x5a7be5);}(_0x58a9,0x145));var _0x958a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58a9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x958a('0x0'));var util=require('util');var logger=require(_0x958a('0x1'))(_0x958a('0x2'));var moment=require(_0x958a('0x3'));var BPromise=require(_0x958a('0x4'));var rp=require(_0x958a('0x5'));var fs=require('fs');var path=require(_0x958a('0x6'));var rimraf=require(_0x958a('0x7'));var config=require('../../config/environment');var attributes=require(_0x958a('0x8'));module['exports']=function(_0x1d3a96,_0x3e6573){return _0x1d3a96['define'](_0x958a('0x9'),attributes,{'tableName':_0x958a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdee6=['bluebird','request-promise','path','rimraf','../../config/environment','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x16e224,_0x2776cc){var _0x1c75b1=function(_0x401053){while(--_0x401053){_0x16e224['push'](_0x16e224['shift']());}};_0x1c75b1(++_0x2776cc);}(_0xdee6,0x1d1));var _0x6dee=function(_0x36485e,_0xf1a95d){_0x36485e=_0x36485e-0x0;var _0x5b7324=_0xdee6[_0x36485e];return _0x5b7324;};'use strict';var _=require(_0x6dee('0x0'));var util=require('util');var logger=require(_0x6dee('0x1'))(_0x6dee('0x2'));var moment=require('moment');var BPromise=require(_0x6dee('0x3'));var rp=require(_0x6dee('0x4'));var fs=require('fs');var path=require(_0x6dee('0x5'));var rimraf=require(_0x6dee('0x6'));var config=require(_0x6dee('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x4b44e2,_0x2f7966){return _0x4b44e2['define'](_0x6dee('0x8'),attributes,{'tableName':_0x6dee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6dee('0xa'),'collate':_0x6dee('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ca5f30e..a208c0a 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 _0x3524=['message','result','catch','MailApplication','update','body','options','attributes','UpdateMailApplication','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33533d,_0x152e4d){var _0x3d8092=function(_0x2dd450){while(--_0x2dd450){_0x33533d['push'](_0x33533d['shift']());}};_0x3d8092(++_0x152e4d);}(_0x3524,0x95));var _0x4352=function(_0x32f388,_0x41c281){_0x32f388=_0x32f388-0x0;var _0x2ee7cb=_0x3524[_0x32f388];return _0x2ee7cb;};'use strict';var _=require(_0x4352('0x0'));var util=require(_0x4352('0x1'));var moment=require(_0x4352('0x2'));var BPromise=require('bluebird');var rs=require(_0x4352('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4352('0x4'))['db'];var utils=require(_0x4352('0x5'));var logger=require(_0x4352('0x6'))('rpc');var config=require(_0x4352('0x7'));var jayson=require(_0x4352('0x8'));var client=jayson['client'][_0x4352('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5372d6,_0x4869f1,_0x2ef5ba){return new BPromise(function(_0x784bef,_0x5955e8){return client['request'](_0x5372d6,_0x2ef5ba)[_0x4352('0xa')](function(_0x18f30d){logger[_0x4352('0xb')](_0x4352('0xc'),_0x4869f1,_0x4352('0xd'));logger[_0x4352('0xe')](_0x4352('0xf'),_0x4869f1,'request\x20sent',JSON[_0x4352('0x10')](_0x18f30d));if(_0x18f30d[_0x4352('0x11')]){if(_0x18f30d[_0x4352('0x11')][_0x4352('0x12')]===0x1f4){logger[_0x4352('0x11')](_0x4352('0xc'),_0x4869f1,_0x18f30d[_0x4352('0x11')][_0x4352('0x13')]);return _0x5955e8(_0x18f30d['error'][_0x4352('0x13')]);}logger[_0x4352('0x11')](_0x4352('0xc'),_0x4869f1,_0x18f30d[_0x4352('0x11')][_0x4352('0x13')]);return _0x784bef(_0x18f30d[_0x4352('0x11')][_0x4352('0x13')]);}else{logger['info'](_0x4352('0xc'),_0x4869f1,'request\x20sent');_0x784bef(_0x18f30d[_0x4352('0x14')]['message']);}})[_0x4352('0x15')](function(_0x181feb){logger[_0x4352('0x11')](_0x4352('0xc'),_0x4869f1,_0x181feb);_0x5955e8(_0x181feb);});});}exports['UpdateMailApplication']=function(_0x4fb8f5){var _0x29d6f9=this;return new Promise(function(_0x513a53,_0x42edf3){return db[_0x4352('0x16')][_0x4352('0x17')](_0x4fb8f5[_0x4352('0x18')],{'raw':_0x4fb8f5['options']?_0x4fb8f5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fb8f5[_0x4352('0x19')]?_0x4fb8f5[_0x4352('0x19')]['where']||null:null,'attributes':_0x4fb8f5[_0x4352('0x19')]?_0x4fb8f5['options'][_0x4352('0x1a')]||null:null,'limit':_0x4fb8f5[_0x4352('0x19')]?_0x4fb8f5[_0x4352('0x19')]['limit']||null:null})[_0x4352('0xa')](function(_0x45f090){logger[_0x4352('0xb')](_0x4352('0x1b'),_0x4fb8f5);logger['debug'](_0x4352('0x1b'),_0x4fb8f5,JSON['stringify'](_0x45f090));_0x513a53(_0x45f090);})[_0x4352('0x15')](function(_0x5718f8){logger[_0x4352('0x11')](_0x4352('0x1b'),_0x5718f8[_0x4352('0x13')],_0x4fb8f5);_0x42edf3(_0x29d6f9['error'](0x1f4,_0x5718f8[_0x4352('0x13')]));});});}; \ No newline at end of file +var _0x83c5=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x2f3015,_0xe65f08){var _0x2f79f9=function(_0x42f1cf){while(--_0x42f1cf){_0x2f3015['push'](_0x2f3015['shift']());}};_0x2f79f9(++_0xe65f08);}(_0x83c5,0x187));var _0x583c=function(_0x1a4861,_0x510d80){_0x1a4861=_0x1a4861-0x0;var _0x55c004=_0x83c5[_0x1a4861];return _0x55c004;};'use strict';var _=require(_0x583c('0x0'));var util=require('util');var moment=require(_0x583c('0x1'));var BPromise=require(_0x583c('0x2'));var rs=require(_0x583c('0x3'));var fs=require('fs');var Redis=require(_0x583c('0x4'));var db=require(_0x583c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x583c('0x6'))(_0x583c('0x7'));var config=require('../../config/environment');var jayson=require(_0x583c('0x8'));var client=jayson[_0x583c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444830,_0x28e3ea,_0x18643c){return new BPromise(function(_0x2aff43,_0x4bf422){return client[_0x583c('0xa')](_0x444830,_0x18643c)[_0x583c('0xb')](function(_0x524404){logger[_0x583c('0xc')](_0x583c('0xd'),_0x28e3ea,_0x583c('0xe'));logger[_0x583c('0xf')](_0x583c('0x10'),_0x28e3ea,'request\x20sent',JSON['stringify'](_0x524404));if(_0x524404['error']){if(_0x524404[_0x583c('0x11')][_0x583c('0x12')]===0x1f4){logger[_0x583c('0x11')]('MailApplication,\x20%s,\x20%s',_0x28e3ea,_0x524404[_0x583c('0x11')][_0x583c('0x13')]);return _0x4bf422(_0x524404[_0x583c('0x11')][_0x583c('0x13')]);}logger[_0x583c('0x11')](_0x583c('0xd'),_0x28e3ea,_0x524404[_0x583c('0x11')][_0x583c('0x13')]);return _0x2aff43(_0x524404[_0x583c('0x11')]['message']);}else{logger[_0x583c('0xc')](_0x583c('0xd'),_0x28e3ea,_0x583c('0xe'));_0x2aff43(_0x524404[_0x583c('0x14')][_0x583c('0x13')]);}})[_0x583c('0x15')](function(_0x1b0213){logger[_0x583c('0x11')](_0x583c('0xd'),_0x28e3ea,_0x1b0213);_0x4bf422(_0x1b0213);});});}exports[_0x583c('0x16')]=function(_0x3d6c05){var _0x4aab65=this;return new Promise(function(_0x1b1028,_0x1cba65){return db[_0x583c('0x17')]['update'](_0x3d6c05[_0x583c('0x18')],{'raw':_0x3d6c05[_0x583c('0x19')]?_0x3d6c05['options'][_0x583c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6c05[_0x583c('0x19')]?_0x3d6c05[_0x583c('0x19')][_0x583c('0x1b')]||null:null,'attributes':_0x3d6c05['options']?_0x3d6c05[_0x583c('0x19')][_0x583c('0x1c')]||null:null,'limit':_0x3d6c05[_0x583c('0x19')]?_0x3d6c05[_0x583c('0x19')][_0x583c('0x1d')]||null:null})[_0x583c('0xb')](function(_0x44faa2){logger[_0x583c('0xc')]('UpdateMailApplication',_0x3d6c05);logger[_0x583c('0xf')]('UpdateMailApplication',_0x3d6c05,JSON[_0x583c('0x1e')](_0x44faa2));_0x1b1028(_0x44faa2);})[_0x583c('0x15')](function(_0x511b70){logger['error'](_0x583c('0x16'),_0x511b70[_0x583c('0x13')],_0x3d6c05);_0x1cba65(_0x4aab65[_0x583c('0x11')](0x1f4,_0x511b70[_0x583c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5cc49f7..7f1eaeb 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 _0x1c2f=['Router','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','mail','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports'];(function(_0xd4b99b,_0x21cb1a){var _0x42ce2b=function(_0x4b6228){while(--_0x4b6228){_0xd4b99b['push'](_0xd4b99b['shift']());}};_0x42ce2b(++_0x21cb1a);}(_0x1c2f,0x195));var _0xf1c2=function(_0x53a0d4,_0x2691f9){_0x53a0d4=_0x53a0d4-0x0;var _0x46c9d8=_0x1c2f[_0x53a0d4];return _0x46c9d8;};'use strict';var express=require('express');var router=express[_0xf1c2('0x0')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xf1c2('0x1'));router[_0xf1c2('0x2')]('/',auth[_0xf1c2('0x3')](),controller[_0xf1c2('0x4')]);router[_0xf1c2('0x2')](_0xf1c2('0x5'),auth[_0xf1c2('0x3')](),controller[_0xf1c2('0x6')]);router['get'](_0xf1c2('0x7'),auth[_0xf1c2('0x3')](),controller[_0xf1c2('0x8')]);router['get'](_0xf1c2('0x9'),auth[_0xf1c2('0x3')](),controller[_0xf1c2('0xa')]);router[_0xf1c2('0x2')]('/:id/download',auth[_0xf1c2('0x3')](),controller[_0xf1c2('0xb')]);router[_0xf1c2('0xc')]('/',auth[_0xf1c2('0x3')](),controller[_0xf1c2('0xd')]);router[_0xf1c2('0xc')]('/:id/messages',auth[_0xf1c2('0x3')](),controller[_0xf1c2('0xe')]);router[_0xf1c2('0xc')](_0xf1c2('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xf1c2('0x10'),'mailinteraction:addtags'),controller[_0xf1c2('0x11')]);router[_0xf1c2('0x12')](_0xf1c2('0x7'),auth[_0xf1c2('0x3')](),interaction[_0xf1c2('0x13')]('mail',_0xf1c2('0x14')),controller[_0xf1c2('0x15')]);router[_0xf1c2('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0xf1c2('0x13')]('mail',_0xf1c2('0x17')),controller[_0xf1c2('0x18')]);router[_0xf1c2('0x16')](_0xf1c2('0xf'),auth[_0xf1c2('0x3')](),controller[_0xf1c2('0x19')]);module[_0xf1c2('0x1a')]=router; \ No newline at end of file +var _0x5127=['mail','mailinteraction:addtags','put','mailinteraction:update','update','mailinteraction:destroy','delete','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0x5127,0x18f));var _0x7512=function(_0x36c87d,_0x2ab247){_0x36c87d=_0x36c87d-0x0;var _0x54dc55=_0x5127[_0x36c87d];return _0x54dc55;};'use strict';var express=require(_0x7512('0x0'));var router=express[_0x7512('0x1')]();var auth=require(_0x7512('0x2'));var interaction=require(_0x7512('0x3'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x7512('0x4')](),controller['index']);router[_0x7512('0x5')](_0x7512('0x6'),auth[_0x7512('0x4')](),controller[_0x7512('0x7')]);router[_0x7512('0x5')](_0x7512('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x7512('0x5')]('/:id/messages',auth[_0x7512('0x4')](),controller['getMessages']);router[_0x7512('0x5')](_0x7512('0x9'),auth[_0x7512('0x4')](),controller[_0x7512('0xa')]);router[_0x7512('0xb')]('/',auth[_0x7512('0x4')](),controller[_0x7512('0xc')]);router[_0x7512('0xb')](_0x7512('0xd'),auth[_0x7512('0x4')](),controller[_0x7512('0xe')]);router[_0x7512('0xb')](_0x7512('0xf'),auth[_0x7512('0x4')](),interaction[_0x7512('0x10')](_0x7512('0x11'),_0x7512('0x12')),controller['addTags']);router[_0x7512('0x13')]('/:id',auth[_0x7512('0x4')](),interaction[_0x7512('0x10')](_0x7512('0x11'),_0x7512('0x14')),controller[_0x7512('0x15')]);router['delete']('/:id',auth[_0x7512('0x4')](),interaction[_0x7512('0x10')](_0x7512('0x11'),_0x7512('0x16')),controller['destroy']);router[_0x7512('0x17')]('/:id/tags',auth[_0x7512('0x4')](),controller[_0x7512('0x18')]);module[_0x7512('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b655308..f4a29da 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 _0x0237=['exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','INTEGER','sequelize','iconv'];(function(_0x9f7b2c,_0x2f6678){var _0x19e5ab=function(_0x1adf66){while(--_0x1adf66){_0x9f7b2c['push'](_0x9f7b2c['shift']());}};_0x19e5ab(++_0x2f6678);}(_0x0237,0x6c));var _0x7023=function(_0x48922f,_0x52518a){_0x48922f=_0x48922f-0x0;var _0x4f0a84=_0x0237[_0x48922f];return _0x4f0a84;};'use strict';var Sequelize=require(_0x7023('0x0'));var iconv=require(_0x7023('0x1'));module[_0x7023('0x2')]={'closed':{'type':Sequelize[_0x7023('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7023('0x4')]},'disposition':{'type':Sequelize[_0x7023('0x5')]},'secondDisposition':{'type':Sequelize[_0x7023('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7023('0x5')]},'note':{'type':Sequelize[_0x7023('0x5')]},'inReplyTo':{'type':Sequelize[_0x7023('0x5')](0x1fe)},'to':{'type':Sequelize[_0x7023('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x7023('0x6'))},'subject':{'type':Sequelize[_0x7023('0x7')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7023('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x7023('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7023('0x8')]('in',_0x7023('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7023('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7023('0x8')]('in',_0x7023('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7023('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7023('0xa')]}}; \ No newline at end of file +var _0xcf27=['exports','DATE','STRING','TEXT','BOOLEAN','ENUM','out','iconv'];(function(_0x49f65b,_0x453206){var _0x2e7ad6=function(_0x517ddf){while(--_0x517ddf){_0x49f65b['push'](_0x49f65b['shift']());}};_0x2e7ad6(++_0x453206);}(_0xcf27,0xb7));var _0x7cf2=function(_0x562b2b,_0x3da225){_0x562b2b=_0x562b2b-0x0;var _0x5e8d42=_0xcf27[_0x562b2b];return _0x5e8d42;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x7cf2('0x0'));module[_0x7cf2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7cf2('0x2')]},'disposition':{'type':Sequelize[_0x7cf2('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7cf2('0x3')]},'note':{'type':Sequelize[_0x7cf2('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7cf2('0x4')]('long')},'subject':{'type':Sequelize[_0x7cf2('0x4')]()},'attach':{'type':Sequelize[_0x7cf2('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7cf2('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7cf2('0x6')]('in',_0x7cf2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7cf2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x7cf2('0x6')]('in',_0x7cf2('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7cf2('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 55bc441..cf2a3b7 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 _0x6761=['lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','html-entities','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','user','show','params','model','keys','filters','intersection','attributes','fields','query','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','addTags','setTags','omit','Tag','mailInteractionTags:save','removeTags','download','unix','toString','join','root','tmp','server','files','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path'];(function(_0x53b0ea,_0x42d4c5){var _0x51e79a=function(_0x2a3a34){while(--_0x2a3a34){_0x53b0ea['push'](_0x53b0ea['shift']());}};_0x51e79a(++_0x42d4c5);}(_0x6761,0x153));var _0x1676=function(_0x4ca9e4,_0x109e03){_0x4ca9e4=_0x4ca9e4-0x0;var _0x2ea308=_0x6761[_0x4ca9e4];return _0x2ea308;};'use strict';var emlformat=require(_0x1676('0x0'));var rimraf=require(_0x1676('0x1'));var zipdir=require(_0x1676('0x2'));var moment=require(_0x1676('0x3'));var BPromise=require('bluebird');var util=require(_0x1676('0x4'));var path=require(_0x1676('0x5'));var fs=require('fs');var _=require(_0x1676('0x6'));var juice=require('juice');var Redis=require(_0x1676('0x7'));var interaction=require(_0x1676('0x8'));var qs=require(_0x1676('0x9'));var logger=require(_0x1676('0xa'))(_0x1676('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x1676('0xc'));config['redis']=_['defaults'](config['redis'],{'host':_0x1676('0xd'),'port':0x18eb});var socket=require(_0x1676('0xe'))(new Redis(config[_0x1676('0xf')]));require(_0x1676('0x10'))[_0x1676('0x11')](socket);function respondWithStatusCode(_0x2d7ae6,_0x283faf){_0x283faf=_0x283faf||0xcc;return function(_0xc0012b){if(_0xc0012b){return _0x2d7ae6[_0x1676('0x12')](_0x283faf);}return _0x2d7ae6[_0x1676('0x13')](_0x283faf)[_0x1676('0x14')]();};}function respondWithResult(_0x2d9ef8,_0x85350f){_0x85350f=_0x85350f||0xc8;return function(_0x20009a){if(_0x20009a){return _0x2d9ef8['status'](_0x85350f)[_0x1676('0x15')](_0x20009a);}};}function respondWithFilteredResult(_0x5c6b82,_0x2392f3){return function(_0x570f48){if(_0x570f48){var _0x528f8e=typeof _0x2392f3[_0x1676('0x16')]===_0x1676('0x17')&&typeof _0x2392f3[_0x1676('0x18')]===_0x1676('0x17');var _0x1042ec=_0x570f48[_0x1676('0x19')];var _0x35bf1e=_0x528f8e?0x0:_0x2392f3[_0x1676('0x16')];var _0x47f182=_0x528f8e?_0x570f48[_0x1676('0x19')]:_0x2392f3['offset']+_0x2392f3[_0x1676('0x18')];var _0x30af95;if(_0x47f182>=_0x1042ec){_0x47f182=_0x1042ec;_0x30af95=0xc8;}else{_0x30af95=0xce;}_0x5c6b82[_0x1676('0x13')](_0x30af95);return _0x5c6b82[_0x1676('0x1a')](_0x1676('0x1b'),_0x35bf1e+'-'+_0x47f182+'/'+_0x1042ec)[_0x1676('0x15')](_0x570f48);}return null;};}function saveUpdates(_0x13dcc2){return function(_0x234f6e){if(_0x234f6e){return _0x234f6e[_0x1676('0x1c')](_0x13dcc2)[_0x1676('0x1d')](function(_0x59e7d5){return _0x59e7d5;});}return null;};}function removeEntity(_0x20d652){return function(_0x1e5402){if(_0x1e5402){return _0x1e5402[_0x1676('0x1e')]()[_0x1676('0x1d')](function(){_0x20d652['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf9d702){return function(_0x5be783){if(!_0x5be783){_0xf9d702['sendStatus'](0x194);}return _0x5be783;};}function handleError(_0x3e434d,_0x24f8f3){_0x24f8f3=_0x24f8f3||0x1f4;return function(_0x487058){logger[_0x1676('0x1f')](_0x487058[_0x1676('0x20')]);if(_0x487058[_0x1676('0x21')]){delete _0x487058[_0x1676('0x21')];}_0x3e434d['status'](_0x24f8f3)['send'](_0x487058);};}exports[_0x1676('0x22')]=function(_0x210964,_0x590847){var _0x43d4b1={};var _0x581054=_[_0x1676('0x23')](db[_0x1676('0x24')][_0x1676('0x25')],function(_0x530d31){return{'name':_0x530d31[_0x1676('0x26')],'type':_0x530d31[_0x1676('0x27')][_0x1676('0x28')]};});_0x43d4b1=qs['getOptions'](_0x581054,_0x210964);return interaction[_0x1676('0x29')](_0x1676('0x2a'),_0x210964['query'],_0x210964[_0x1676('0x2b')],_0x43d4b1,_0x581054)['then'](respondWithFilteredResult(_0x590847,_0x43d4b1))['catch'](handleError(_0x590847,null));};exports[_0x1676('0x2c')]=function(_0x20e1f5,_0x5587d1){var _0x3f0e96={'raw':![],'where':{'id':_0x20e1f5[_0x1676('0x2d')]['id']}},_0xf2d74a={};_0xf2d74a[_0x1676('0x2e')]=_[_0x1676('0x2f')](db[_0x1676('0x24')][_0x1676('0x25')]);_0xf2d74a['query']=_[_0x1676('0x2f')](_0x20e1f5['query']);_0xf2d74a[_0x1676('0x30')]=_[_0x1676('0x31')](_0xf2d74a['model'],_0xf2d74a['query']);_0x3f0e96[_0x1676('0x32')]=_[_0x1676('0x31')](_0xf2d74a[_0x1676('0x2e')],qs[_0x1676('0x33')](_0x20e1f5[_0x1676('0x34')][_0x1676('0x33')]));_0x3f0e96[_0x1676('0x32')]=_0x3f0e96[_0x1676('0x32')][_0x1676('0x35')]?_0x3f0e96['attributes']:_0xf2d74a[_0x1676('0x2e')];if(_0x20e1f5[_0x1676('0x34')][_0x1676('0x36')]){_0x3f0e96[_0x1676('0x37')]=[{'all':!![]}];}_0x3f0e96=_[_0x1676('0x38')]({},_0x3f0e96,_0x20e1f5[_0x1676('0x39')]);return db[_0x1676('0x24')][_0x1676('0x3a')](_0x3f0e96)[_0x1676('0x1d')](handleEntityNotFound(_0x5587d1,null))[_0x1676('0x1d')](respondWithResult(_0x5587d1,null))[_0x1676('0x3b')](handleError(_0x5587d1,null));};exports[_0x1676('0x3c')]=function(_0x5ddfba,_0x23f44a){return db[_0x1676('0x24')][_0x1676('0x3c')](_0x5ddfba['body'],{})[_0x1676('0x1d')](respondWithResult(_0x23f44a,0xc9))[_0x1676('0x3b')](handleError(_0x23f44a,null));};exports[_0x1676('0x1c')]=function(_0x225b74,_0xeb1a5d){if(_0x225b74['body']['id']){delete _0x225b74['body']['id'];}return db[_0x1676('0x24')][_0x1676('0x3a')]({'where':{'id':_0x225b74[_0x1676('0x2d')]['id']}})[_0x1676('0x1d')](handleEntityNotFound(_0xeb1a5d,null))[_0x1676('0x1d')](saveUpdates(_0x225b74[_0x1676('0x3d')],null))[_0x1676('0x1d')](respondWithResult(_0xeb1a5d,null))['catch'](handleError(_0xeb1a5d,null));};exports[_0x1676('0x1e')]=function(_0x2d1283,_0xbc92af){return db[_0x1676('0x24')][_0x1676('0x3a')]({'where':{'id':_0x2d1283['params']['id']}})[_0x1676('0x1d')](handleEntityNotFound(_0xbc92af,null))['then'](removeEntity(_0xbc92af,null))[_0x1676('0x3b')](handleError(_0xbc92af,null));};exports[_0x1676('0x3e')]=function(_0x1365f9,_0x2efeea){return db[_0x1676('0x24')][_0x1676('0x3e')]()[_0x1676('0x1d')](respondWithResult(_0x2efeea,null))[_0x1676('0x3b')](handleError(_0x2efeea,null));};exports[_0x1676('0x3f')]=function(_0x58ea50,_0x2e5ed9){return db[_0x1676('0x40')][_0x1676('0x3a')]({'where':{'id':_0x58ea50[_0x1676('0x2d')]['id']}})[_0x1676('0x1d')](handleEntityNotFound(_0x2e5ed9,null))[_0x1676('0x1d')](function(_0x180719){if(_0x180719){return _0x180719[_0x1676('0x3f')](_0x58ea50[_0x1676('0x3d')][_0x1676('0x41')],_['omit'](_0x58ea50[_0x1676('0x3d')],[_0x1676('0x41'),'id'])||{});}})[_0x1676('0x1d')](respondWithResult(_0x2e5ed9,null))[_0x1676('0x3b')](handleError(_0x2e5ed9,null));};exports[_0x1676('0x42')]=function(_0x16164d,_0x8251c5){var _0x5508a9={'raw':![],'where':{}};var _0x223ebd={};var _0x3da79e={'count':0x0,'rows':[]};return db['MailInteraction'][_0x1676('0x43')]({'where':{'id':_0x16164d[_0x1676('0x2d')]['id']}})[_0x1676('0x1d')](handleEntityNotFound(_0x8251c5,null))[_0x1676('0x1d')](function(_0x40c9f2){if(_0x40c9f2){_0x223ebd[_0x1676('0x2e')]=_[_0x1676('0x2f')](db[_0x1676('0x40')][_0x1676('0x25')]);_0x223ebd[_0x1676('0x34')]=_['keys'](_0x16164d['query']);_0x223ebd[_0x1676('0x30')]=_[_0x1676('0x31')](_0x223ebd[_0x1676('0x2e')],_0x223ebd[_0x1676('0x34')]);_0x5508a9[_0x1676('0x32')]=_['intersection'](_0x223ebd[_0x1676('0x2e')],qs[_0x1676('0x33')](_0x16164d[_0x1676('0x34')]['fields']));_0x5508a9['attributes']=_0x5508a9[_0x1676('0x32')][_0x1676('0x35')]?_0x5508a9[_0x1676('0x32')]:_0x223ebd[_0x1676('0x2e')];if(!_0x16164d['query'][_0x1676('0x44')](_0x1676('0x45'))){_0x5508a9['limit']=qs['limit'](_0x16164d[_0x1676('0x34')][_0x1676('0x18')]);_0x5508a9[_0x1676('0x16')]=qs[_0x1676('0x16')](_0x16164d[_0x1676('0x34')][_0x1676('0x16')]);}_0x5508a9['order']=qs[_0x1676('0x46')](_0x16164d[_0x1676('0x34')][_0x1676('0x46')]);_0x5508a9[_0x1676('0x47')]=qs[_0x1676('0x30')](_[_0x1676('0x48')](_0x16164d['query'],_0x223ebd[_0x1676('0x30')]));_0x5508a9[_0x1676('0x47')][_0x1676('0x49')]=_0x40c9f2['id'];if(_0x16164d[_0x1676('0x34')][_0x1676('0x4a')]){_0x5508a9['where']=_[_0x1676('0x38')](_0x5508a9[_0x1676('0x47')],{'$or':_[_0x1676('0x23')](_0x5508a9['attributes'],function(_0x1a3ec1){var _0x19dd46={};_0x19dd46[_0x1a3ec1]={'$like':'%'+_0x16164d[_0x1676('0x34')][_0x1676('0x4a')]+'%'};return _0x19dd46;})});}if(_0x16164d[_0x1676('0x34')][_0x1676('0x4b')]){var _0x3a603c=_0x16164d[_0x1676('0x34')][_0x1676('0x4b')][_0x1676('0x4c')](',');var _0x4ffe96={};_0x4ffe96[_0x3a603c[0x0]]={'$gte':moment(_0x3a603c[0x1])[_0x1676('0x4d')](_0x1676('0x4e'))};_0x5508a9[_0x1676('0x47')]=_[_0x1676('0x38')](_0x5508a9['where'],_0x4ffe96);}_0x5508a9=_['merge']({},_0x5508a9,_0x16164d[_0x1676('0x39')]);return db[_0x1676('0x40')][_0x1676('0x19')]({'where':_0x5508a9[_0x1676('0x47')]})[_0x1676('0x1d')](function(_0x15bc88){_0x3da79e[_0x1676('0x19')]=_0x15bc88;if(_0x16164d[_0x1676('0x34')][_0x1676('0x36')]){_0x5508a9[_0x1676('0x37')]=[{'all':!![]}];}return db[_0x1676('0x40')][_0x1676('0x29')](_0x5508a9);})[_0x1676('0x1d')](function(_0x493cd5){if(_0x16164d[_0x1676('0x34')][_0x1676('0x4f')]==='true'){for(var _0x22066f=0x0;_0x22066f<_0x493cd5[_0x1676('0x35')];_0x22066f++){_0x493cd5[_0x22066f]['body']=juice(_0x493cd5[_0x22066f][_0x1676('0x3d')]);}}_0x3da79e['rows']=_0x493cd5;return _0x3da79e;});}})[_0x1676('0x1d')](respondWithFilteredResult(_0x8251c5,_0x5508a9))[_0x1676('0x3b')](handleError(_0x8251c5,null));};exports[_0x1676('0x50')]=function(_0x3892f0,_0x1c14c0){return db[_0x1676('0x24')][_0x1676('0x3a')]({'where':{'id':_0x3892f0[_0x1676('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1c14c0,null))[_0x1676('0x1d')](function(_0x1d4fed){if(_0x1d4fed){return _0x1d4fed[_0x1676('0x51')](_0x3892f0[_0x1676('0x3d')][_0x1676('0x41')],_[_0x1676('0x52')](_0x3892f0[_0x1676('0x3d')],[_0x1676('0x41'),'id'])||{})['spread'](function(){return db[_0x1676('0x53')][_0x1676('0x29')]({'attributes':['id',_0x1676('0x21'),'color'],'where':{'id':_0x3892f0[_0x1676('0x3d')]['ids']}});})[_0x1676('0x1d')](function(_0x29eaaa){socket['emit'](_0x1676('0x54'),{'id':Number(_0x3892f0['params']['id']),'tags':_0x29eaaa||[]});return{'id':Number(_0x3892f0[_0x1676('0x2d')]['id']),'tags':_0x29eaaa||[]};});}})[_0x1676('0x1d')](respondWithResult(_0x1c14c0,null))['catch'](handleError(_0x1c14c0,null));};exports['removeTags']=function(_0x52d477,_0x3f859f){return db[_0x1676('0x24')][_0x1676('0x3a')]({'where':{'id':_0x52d477[_0x1676('0x2d')]['id']}})[_0x1676('0x1d')](handleEntityNotFound(_0x3f859f,null))['then'](function(_0xe7ed18){if(_0xe7ed18){return _0xe7ed18[_0x1676('0x55')](_0x52d477['query'][_0x1676('0x41')]);}})['then'](respondWithStatusCode(_0x3f859f,null))['catch'](handleError(_0x3f859f,null));};exports[_0x1676('0x56')]=function(_0x1d8eda,_0x578e52){var _0x45b5c8=moment()[_0x1676('0x57')]()[_0x1676('0x58')]();var _0x55e443=path[_0x1676('0x59')](config[_0x1676('0x5a')],'server','files',_0x1676('0x5b'));var _0x18b87e=path[_0x1676('0x59')](config['root'],_0x1676('0x5c'),_0x1676('0x5d'),_0x1676('0x5e'));var _0x4e0b2e=path[_0x1676('0x59')](_0x55e443,_0x45b5c8);var _0x500cd7=util['format']('transcript-%d-%s.zip',_0x1d8eda[_0x1676('0x2d')]['id'],_0x45b5c8);var _0x3cb0ca=path[_0x1676('0x59')](_0x55e443,_0x500cd7);var _0x1c1f35=[];if(_0x1d8eda[_0x1676('0x34')][_0x1676('0x5e')]){_0x1c1f35[_0x1676('0x5f')]({'model':db[_0x1676('0x60')],'as':_0x1676('0x61'),'raw':!![]});}var _0x22bea8=[{'model':db['MailMessage'],'as':_0x1676('0x62'),'attributes':['id',_0x1676('0x3d'),_0x1676('0x63'),'to','cc',_0x1676('0x64'),_0x1676('0x65'),_0x1676('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1c1f35}];return db['MailInteraction'][_0x1676('0x3a')]({'where':{'id':_0x1d8eda[_0x1676('0x2d')]['id']},'include':_0x22bea8})[_0x1676('0x1d')](handleEntityNotFound(_0x578e52,null))['then'](function(_0x170101){if(_0x170101&&_0x170101[_0x1676('0x62')]){var _0x36fb2a=_0x170101[_0x1676('0x67')]({'plain':!![]});fs[_0x1676('0x68')](_0x4e0b2e);return BPromise[_0x1676('0x69')](_0x36fb2a['Messages'],function(_0x4cf189,_0x3895e7){var _0x19fa7e={'from':_0x4cf189[_0x1676('0x63')],'to':_0x4cf189['to']||_0x1676('0x6a'),'subject':_0x4cf189[_0x1676('0x65')],'html':htmlEntities[_0x1676('0x6b')](_0x4cf189[_0x1676('0x3d')]),'headers':{'Date':moment(_0x4cf189[_0x1676('0x66')])['format'](_0x1676('0x6c'))},'attachments':[]};if(_0x4cf189['cc']){_0x19fa7e['headers']['Cc']=_0x4cf189['cc'];}if(_0x4cf189[_0x1676('0x64')]){_0x19fa7e['headers']['Bcc']=_0x4cf189[_0x1676('0x64')];}return new BPromise(function(_0x9c3a83,_0x55b04e){if(_0x4cf189[_0x1676('0x61')]){for(var _0x21d72b=0x0;_0x21d72b<_0x4cf189[_0x1676('0x61')][_0x1676('0x35')];_0x21d72b++){var _0x1fa56c=_0x4cf189['Attachments'][_0x21d72b];var _0x5517c3=path[_0x1676('0x59')](_0x18b87e,_0x1fa56c[_0x1676('0x6d')]);if(fs['existsSync'](_0x5517c3)){_0x19fa7e['attachments'][_0x1676('0x5f')]({'name':_0x1fa56c[_0x1676('0x21')],'contentType':_0x1fa56c['type'],'data':fs[_0x1676('0x6e')](_0x5517c3)});}}}emlformat[_0x1676('0x6f')](_0x19fa7e,function(_0x1cdd5f,_0x3737a7){if(_0x1cdd5f)return _0x55b04e(_0x1cdd5f);fs[_0x1676('0x70')](path['join'](_0x4e0b2e,util[_0x1676('0x4d')](_0x1676('0x71'),_0x3895e7)),_0x3737a7);return _0x9c3a83(_0x3737a7);});});})[_0x1676('0x1d')](function(){return new BPromise(function(_0x10096b,_0x579c1c){zipdir(_0x4e0b2e,{'saveTo':_0x3cb0ca},function(_0x5445ca,_0x5c7a29){if(_0x5445ca)return _0x579c1c(_0x5445ca);return _0x10096b(_0x5c7a29);});})[_0x1676('0x1d')](function(){return new BPromise(function(_0xc7ed0e,_0x464059){rimraf(_0x4e0b2e,function(_0x11ee50){if(_0x11ee50)_0x464059(_0x11ee50);return _0xc7ed0e();});});})[_0x1676('0x1d')](function(){return _0x578e52[_0x1676('0x56')](_0x3cb0ca,_0x500cd7,function(_0x101b10){if(!_0x101b10)fs[_0x1676('0x72')](_0x3cb0ca);});});});}else{return _0x578e52[_0x1676('0x12')](0xc8);}})['catch'](handleError(_0x578e52,null));}; \ No newline at end of file +var _0x99e9=['order','sort','where','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','emit','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','from','mkdirSync','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','push','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','moment','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','MailInteraction','fieldName','type','key','findAll','mail','query','user','show','keys','filters','intersection','model','fields','attributes','length','include','merge','options','catch','create','body','params','find','describe','addMessage','MailMessage','ids','findOne','hasOwnProperty','nolimit'];(function(_0xfceba0,_0x591621){var _0x55dc65=function(_0x10c711){while(--_0x10c711){_0xfceba0['push'](_0xfceba0['shift']());}};_0x55dc65(++_0x591621);}(_0x99e9,0x10b));var _0x999e=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x99e9[_0x26462c];return _0x509a42;};'use strict';var emlformat=require(_0x999e('0x0'));var rimraf=require(_0x999e('0x1'));var zipdir=require(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var util=require(_0x999e('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x999e('0x5'));var juice=require(_0x999e('0x6'));var Redis=require(_0x999e('0x7'));var interaction=require(_0x999e('0x8'));var qs=require(_0x999e('0x9'));var logger=require('../../config/logger')(_0x999e('0xa'));var config=require(_0x999e('0xb'));var db=require(_0x999e('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x999e('0xd')]=_['defaults'](config[_0x999e('0xd')],{'host':_0x999e('0xe'),'port':0x18eb});var socket=require(_0x999e('0xf'))(new Redis(config[_0x999e('0xd')]));require(_0x999e('0x10'))['register'](socket);function respondWithStatusCode(_0x353e38,_0x2735c7){_0x2735c7=_0x2735c7||0xcc;return function(_0x4ec20e){if(_0x4ec20e){return _0x353e38[_0x999e('0x11')](_0x2735c7);}return _0x353e38[_0x999e('0x12')](_0x2735c7)['end']();};}function respondWithResult(_0x154528,_0x2e75d1){_0x2e75d1=_0x2e75d1||0xc8;return function(_0x286d0c){if(_0x286d0c){return _0x154528[_0x999e('0x12')](_0x2e75d1)[_0x999e('0x13')](_0x286d0c);}};}function respondWithFilteredResult(_0xabcf27,_0x3f71f6){return function(_0x3968a6){if(_0x3968a6){var _0xc6f21f=typeof _0x3f71f6[_0x999e('0x14')]===_0x999e('0x15')&&typeof _0x3f71f6[_0x999e('0x16')]===_0x999e('0x15');var _0x224a8e=_0x3968a6[_0x999e('0x17')];var _0x203151=_0xc6f21f?0x0:_0x3f71f6[_0x999e('0x14')];var _0x5e1feb=_0xc6f21f?_0x3968a6[_0x999e('0x17')]:_0x3f71f6['offset']+_0x3f71f6[_0x999e('0x16')];var _0x3d7290;if(_0x5e1feb>=_0x224a8e){_0x5e1feb=_0x224a8e;_0x3d7290=0xc8;}else{_0x3d7290=0xce;}_0xabcf27['status'](_0x3d7290);return _0xabcf27[_0x999e('0x18')](_0x999e('0x19'),_0x203151+'-'+_0x5e1feb+'/'+_0x224a8e)[_0x999e('0x13')](_0x3968a6);}return null;};}function saveUpdates(_0x2df488){return function(_0x6a1be0){if(_0x6a1be0){return _0x6a1be0[_0x999e('0x1a')](_0x2df488)[_0x999e('0x1b')](function(_0x3f97c6){return _0x3f97c6;});}return null;};}function removeEntity(_0x3744d7){return function(_0x2cda85){if(_0x2cda85){return _0x2cda85[_0x999e('0x1c')]()[_0x999e('0x1b')](function(){_0x3744d7[_0x999e('0x12')](0xcc)[_0x999e('0x1d')]();});}};}function handleEntityNotFound(_0x54c40b){return function(_0x2ebf22){if(!_0x2ebf22){_0x54c40b[_0x999e('0x11')](0x194);}return _0x2ebf22;};}function handleError(_0x5c9adb,_0x2149b7){_0x2149b7=_0x2149b7||0x1f4;return function(_0x57dc58){logger[_0x999e('0x1e')](_0x57dc58[_0x999e('0x1f')]);if(_0x57dc58[_0x999e('0x20')]){delete _0x57dc58[_0x999e('0x20')];}_0x5c9adb[_0x999e('0x12')](_0x2149b7)[_0x999e('0x21')](_0x57dc58);};}exports[_0x999e('0x22')]=function(_0x28aaa9,_0x5cc501){var _0x42b614={};var _0x429444=_['map'](db[_0x999e('0x23')]['rawAttributes'],function(_0x4224c4){return{'name':_0x4224c4[_0x999e('0x24')],'type':_0x4224c4[_0x999e('0x25')][_0x999e('0x26')]};});_0x42b614=qs['getOptions'](_0x429444,_0x28aaa9);return interaction[_0x999e('0x27')](_0x999e('0x28'),_0x28aaa9[_0x999e('0x29')],_0x28aaa9[_0x999e('0x2a')],_0x42b614,_0x429444)['then'](respondWithFilteredResult(_0x5cc501,_0x42b614))['catch'](handleError(_0x5cc501,null));};exports[_0x999e('0x2b')]=function(_0x589345,_0x4029d5){var _0x49b4c6={'raw':![],'where':{'id':_0x589345['params']['id']}},_0x1f63b0={};_0x1f63b0['model']=_[_0x999e('0x2c')](db[_0x999e('0x23')]['rawAttributes']);_0x1f63b0['query']=_['keys'](_0x589345['query']);_0x1f63b0[_0x999e('0x2d')]=_[_0x999e('0x2e')](_0x1f63b0['model'],_0x1f63b0[_0x999e('0x29')]);_0x49b4c6['attributes']=_['intersection'](_0x1f63b0[_0x999e('0x2f')],qs[_0x999e('0x30')](_0x589345['query'][_0x999e('0x30')]));_0x49b4c6[_0x999e('0x31')]=_0x49b4c6['attributes'][_0x999e('0x32')]?_0x49b4c6[_0x999e('0x31')]:_0x1f63b0[_0x999e('0x2f')];if(_0x589345[_0x999e('0x29')]['includeAll']){_0x49b4c6[_0x999e('0x33')]=[{'all':!![]}];}_0x49b4c6=_[_0x999e('0x34')]({},_0x49b4c6,_0x589345[_0x999e('0x35')]);return db[_0x999e('0x23')]['find'](_0x49b4c6)['then'](handleEntityNotFound(_0x4029d5,null))[_0x999e('0x1b')](respondWithResult(_0x4029d5,null))[_0x999e('0x36')](handleError(_0x4029d5,null));};exports['create']=function(_0xb373fb,_0x36e69e){return db[_0x999e('0x23')][_0x999e('0x37')](_0xb373fb[_0x999e('0x38')],{})[_0x999e('0x1b')](respondWithResult(_0x36e69e,0xc9))[_0x999e('0x36')](handleError(_0x36e69e,null));};exports['update']=function(_0x3851ab,_0x2c5a03){if(_0x3851ab[_0x999e('0x38')]['id']){delete _0x3851ab[_0x999e('0x38')]['id'];}return db[_0x999e('0x23')]['find']({'where':{'id':_0x3851ab[_0x999e('0x39')]['id']}})['then'](handleEntityNotFound(_0x2c5a03,null))[_0x999e('0x1b')](saveUpdates(_0x3851ab['body'],null))['then'](respondWithResult(_0x2c5a03,null))[_0x999e('0x36')](handleError(_0x2c5a03,null));};exports[_0x999e('0x1c')]=function(_0x19934d,_0x58fa13){return db[_0x999e('0x23')][_0x999e('0x3a')]({'where':{'id':_0x19934d[_0x999e('0x39')]['id']}})['then'](handleEntityNotFound(_0x58fa13,null))['then'](removeEntity(_0x58fa13,null))['catch'](handleError(_0x58fa13,null));};exports[_0x999e('0x3b')]=function(_0x3f43a2,_0x35f104){return db['MailInteraction'][_0x999e('0x3b')]()[_0x999e('0x1b')](respondWithResult(_0x35f104,null))[_0x999e('0x36')](handleError(_0x35f104,null));};exports[_0x999e('0x3c')]=function(_0x5eba13,_0x56cd38){return db[_0x999e('0x3d')]['find']({'where':{'id':_0x5eba13[_0x999e('0x39')]['id']}})[_0x999e('0x1b')](handleEntityNotFound(_0x56cd38,null))[_0x999e('0x1b')](function(_0x5dfce7){if(_0x5dfce7){return _0x5dfce7['addMessage'](_0x5eba13['body'][_0x999e('0x3e')],_['omit'](_0x5eba13['body'],['ids','id'])||{});}})[_0x999e('0x1b')](respondWithResult(_0x56cd38,null))['catch'](handleError(_0x56cd38,null));};exports['getMessages']=function(_0x3dbbff,_0x27975c){var _0x58b343={'raw':![],'where':{}};var _0x36f470={};var _0x459b7b={'count':0x0,'rows':[]};return db[_0x999e('0x23')][_0x999e('0x3f')]({'where':{'id':_0x3dbbff[_0x999e('0x39')]['id']}})['then'](handleEntityNotFound(_0x27975c,null))['then'](function(_0x4f3169){if(_0x4f3169){_0x36f470[_0x999e('0x2f')]=_[_0x999e('0x2c')](db[_0x999e('0x3d')]['rawAttributes']);_0x36f470[_0x999e('0x29')]=_[_0x999e('0x2c')](_0x3dbbff[_0x999e('0x29')]);_0x36f470[_0x999e('0x2d')]=_['intersection'](_0x36f470['model'],_0x36f470[_0x999e('0x29')]);_0x58b343[_0x999e('0x31')]=_['intersection'](_0x36f470['model'],qs[_0x999e('0x30')](_0x3dbbff['query']['fields']));_0x58b343[_0x999e('0x31')]=_0x58b343['attributes']['length']?_0x58b343[_0x999e('0x31')]:_0x36f470['model'];if(!_0x3dbbff[_0x999e('0x29')][_0x999e('0x40')](_0x999e('0x41'))){_0x58b343[_0x999e('0x16')]=qs[_0x999e('0x16')](_0x3dbbff[_0x999e('0x29')][_0x999e('0x16')]);_0x58b343[_0x999e('0x14')]=qs[_0x999e('0x14')](_0x3dbbff[_0x999e('0x29')]['offset']);}_0x58b343[_0x999e('0x42')]=qs[_0x999e('0x43')](_0x3dbbff['query']['sort']);_0x58b343[_0x999e('0x44')]=qs[_0x999e('0x2d')](_['pick'](_0x3dbbff[_0x999e('0x29')],_0x36f470[_0x999e('0x2d')]));_0x58b343[_0x999e('0x44')][_0x999e('0x45')]=_0x4f3169['id'];if(_0x3dbbff[_0x999e('0x29')]['filter']){_0x58b343[_0x999e('0x44')]=_[_0x999e('0x34')](_0x58b343['where'],{'$or':_['map'](_0x58b343['attributes'],function(_0x58121d){var _0xfedb73={};_0xfedb73[_0x58121d]={'$like':'%'+_0x3dbbff['query'][_0x999e('0x46')]+'%'};return _0xfedb73;})});}if(_0x3dbbff[_0x999e('0x29')][_0x999e('0x47')]){var _0x2c0f67=_0x3dbbff[_0x999e('0x29')][_0x999e('0x47')]['split'](',');var _0x5a83d1={};_0x5a83d1[_0x2c0f67[0x0]]={'$gte':moment(_0x2c0f67[0x1])[_0x999e('0x48')](_0x999e('0x49'))};_0x58b343['where']=_['merge'](_0x58b343[_0x999e('0x44')],_0x5a83d1);}_0x58b343=_[_0x999e('0x34')]({},_0x58b343,_0x3dbbff[_0x999e('0x35')]);return db[_0x999e('0x3d')][_0x999e('0x17')]({'where':_0x58b343['where']})['then'](function(_0x4c2f76){_0x459b7b[_0x999e('0x17')]=_0x4c2f76;if(_0x3dbbff['query'][_0x999e('0x4a')]){_0x58b343['include']=[{'all':!![]}];}return db['MailMessage'][_0x999e('0x27')](_0x58b343);})[_0x999e('0x1b')](function(_0x1b5c07){if(_0x3dbbff[_0x999e('0x29')][_0x999e('0x4b')]===_0x999e('0x4c')){for(var _0x221f49=0x0;_0x221f49<_0x1b5c07[_0x999e('0x32')];_0x221f49++){_0x1b5c07[_0x221f49][_0x999e('0x38')]=juice(_0x1b5c07[_0x221f49][_0x999e('0x38')]);}}_0x459b7b[_0x999e('0x4d')]=_0x1b5c07;return _0x459b7b;});}})['then'](respondWithFilteredResult(_0x27975c,_0x58b343))[_0x999e('0x36')](handleError(_0x27975c,null));};exports[_0x999e('0x4e')]=function(_0x3da3a9,_0x2b8a60){return db[_0x999e('0x23')][_0x999e('0x3a')]({'where':{'id':_0x3da3a9[_0x999e('0x39')]['id']}})[_0x999e('0x1b')](handleEntityNotFound(_0x2b8a60,null))[_0x999e('0x1b')](function(_0x3c71c3){if(_0x3c71c3){return _0x3c71c3[_0x999e('0x4f')](_0x3da3a9[_0x999e('0x38')][_0x999e('0x3e')],_['omit'](_0x3da3a9[_0x999e('0x38')],[_0x999e('0x3e'),'id'])||{})[_0x999e('0x50')](function(){return db[_0x999e('0x51')][_0x999e('0x27')]({'attributes':['id',_0x999e('0x20'),'color'],'where':{'id':_0x3da3a9['body'][_0x999e('0x3e')]}});})['then'](function(_0x1f80a4){socket[_0x999e('0x52')]('mailInteractionTags:save',{'id':Number(_0x3da3a9[_0x999e('0x39')]['id']),'tags':_0x1f80a4||[]});return{'id':Number(_0x3da3a9[_0x999e('0x39')]['id']),'tags':_0x1f80a4||[]};});}})[_0x999e('0x1b')](respondWithResult(_0x2b8a60,null))[_0x999e('0x36')](handleError(_0x2b8a60,null));};exports[_0x999e('0x53')]=function(_0x56a928,_0xeeb0ab){return db['MailInteraction'][_0x999e('0x3a')]({'where':{'id':_0x56a928[_0x999e('0x39')]['id']}})[_0x999e('0x1b')](handleEntityNotFound(_0xeeb0ab,null))[_0x999e('0x1b')](function(_0x510404){if(_0x510404){return _0x510404['removeTags'](_0x56a928[_0x999e('0x29')]['ids']);}})[_0x999e('0x1b')](respondWithStatusCode(_0xeeb0ab,null))[_0x999e('0x36')](handleError(_0xeeb0ab,null));};exports[_0x999e('0x54')]=function(_0x2ff673,_0x1b091a){var _0x1e8e20=moment()[_0x999e('0x55')]()[_0x999e('0x56')]();var _0x567f41=path[_0x999e('0x57')](config[_0x999e('0x58')],_0x999e('0x59'),_0x999e('0x5a'),_0x999e('0x5b'));var _0x1f709f=path[_0x999e('0x57')](config['root'],'server',_0x999e('0x5a'),'attachments');var _0x1b36ca=path[_0x999e('0x57')](_0x567f41,_0x1e8e20);var _0x189379=util[_0x999e('0x48')](_0x999e('0x5c'),_0x2ff673[_0x999e('0x39')]['id'],_0x1e8e20);var _0x499001=path[_0x999e('0x57')](_0x567f41,_0x189379);var _0x5ab3c6=[];if(_0x2ff673[_0x999e('0x29')][_0x999e('0x5d')]){_0x5ab3c6['push']({'model':db[_0x999e('0x5e')],'as':_0x999e('0x5f'),'raw':!![]});}var _0x3a4ca1=[{'model':db[_0x999e('0x3d')],'as':_0x999e('0x60'),'attributes':['id',_0x999e('0x38'),_0x999e('0x61'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x5ab3c6}];return db[_0x999e('0x23')][_0x999e('0x3a')]({'where':{'id':_0x2ff673[_0x999e('0x39')]['id']},'include':_0x3a4ca1})[_0x999e('0x1b')](handleEntityNotFound(_0x1b091a,null))[_0x999e('0x1b')](function(_0x3b0f08){if(_0x3b0f08&&_0x3b0f08[_0x999e('0x60')]){var _0xe4a4b4=_0x3b0f08['get']({'plain':!![]});fs[_0x999e('0x62')](_0x1b36ca);return BPromise['each'](_0xe4a4b4[_0x999e('0x60')],function(_0xfe8212,_0x289dbf){var _0x29c37e={'from':_0xfe8212[_0x999e('0x61')],'to':_0xfe8212['to']||_0x999e('0x63'),'subject':_0xfe8212['subject'],'html':htmlEntities[_0x999e('0x64')](_0xfe8212[_0x999e('0x38')]),'headers':{'Date':moment(_0xfe8212[_0x999e('0x65')])[_0x999e('0x48')](_0x999e('0x66'))},'attachments':[]};if(_0xfe8212['cc']){_0x29c37e[_0x999e('0x67')]['Cc']=_0xfe8212['cc'];}if(_0xfe8212[_0x999e('0x68')]){_0x29c37e['headers']['Bcc']=_0xfe8212[_0x999e('0x68')];}return new BPromise(function(_0x3d7111,_0x227cef){if(_0xfe8212[_0x999e('0x5f')]){for(var _0x10a83c=0x0;_0x10a83c<_0xfe8212[_0x999e('0x5f')]['length'];_0x10a83c++){var _0x262ce2=_0xfe8212[_0x999e('0x5f')][_0x10a83c];var _0x23bfa6=path[_0x999e('0x57')](_0x1f709f,_0x262ce2[_0x999e('0x69')]);if(fs[_0x999e('0x6a')](_0x23bfa6)){_0x29c37e[_0x999e('0x5d')][_0x999e('0x6b')]({'name':_0x262ce2[_0x999e('0x20')],'contentType':_0x262ce2[_0x999e('0x25')],'data':fs['readFileSync'](_0x23bfa6)});}}}emlformat[_0x999e('0x6c')](_0x29c37e,function(_0x202cf1,_0x1c752f){if(_0x202cf1)return _0x227cef(_0x202cf1);fs[_0x999e('0x6d')](path['join'](_0x1b36ca,util[_0x999e('0x48')]('message%d.eml',_0x289dbf)),_0x1c752f);return _0x3d7111(_0x1c752f);});});})[_0x999e('0x1b')](function(){return new BPromise(function(_0x42dc39,_0x1b8989){zipdir(_0x1b36ca,{'saveTo':_0x499001},function(_0x1203dd,_0x423fa7){if(_0x1203dd)return _0x1b8989(_0x1203dd);return _0x42dc39(_0x423fa7);});})['then'](function(){return new BPromise(function(_0x23800f,_0x5c3918){rimraf(_0x1b36ca,function(_0x24ae7a){if(_0x24ae7a)_0x5c3918(_0x24ae7a);return _0x23800f();});});})['then'](function(){return _0x1b091a[_0x999e('0x54')](_0x499001,_0x189379,function(_0x1f005e){if(!_0x1f005e)fs[_0x999e('0x6e')](_0x499001);});});});}else{return _0x1b091a[_0x999e('0x11')](0xc8);}})[_0x999e('0x36')](handleError(_0x1b091a,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 59ca5fb..e84eb3b 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 _0xad19=['findAll','setDataValue','unreadMessages','length','catch','hook','exports','events','MailInteraction','MailMessage','setMaxListeners','save','remove','Users','map'];(function(_0x1f1be8,_0x768e9b){var _0x1d77cb=function(_0x5e7203){while(--_0x5e7203){_0x1f1be8['push'](_0x1f1be8['shift']());}};_0x1d77cb(++_0x768e9b);}(_0xad19,0x133));var _0x9ad1=function(_0x2c0904,_0xfc89b9){_0x2c0904=_0x2c0904-0x0;var _0x5a9a96=_0xad19[_0x2c0904];return _0x5a9a96;};'use strict';var EventEmitter=require(_0x9ad1('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x9ad1('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x9ad1('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9ad1('0x3')](0x0);var events={'afterCreate':_0x9ad1('0x4'),'afterUpdate':'update','afterDestroy':_0x9ad1('0x5')};function emitEvent(_0x56dcef){return function(_0x5d4ccc,_0x58ffe8,_0x548163){_0x5d4ccc['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x144d8f){_0x5d4ccc['setDataValue'](_0x9ad1('0x6'),_0x144d8f[_0x9ad1('0x7')](function(_0x1ba7e7){return{'id':_0x1ba7e7['id']};}));return MailMessage[_0x9ad1('0x8')]({'where':{'MailInteractionId':_0x5d4ccc['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x234605){_0x5d4ccc[_0x9ad1('0x9')](_0x9ad1('0xa'),_0x234605[_0x9ad1('0xb')]);MailInteractionEvents['emit'](_0x56dcef+':'+_0x5d4ccc['id'],_0x5d4ccc);MailInteractionEvents['emit'](_0x56dcef,_0x5d4ccc);_0x548163(null);})[_0x9ad1('0xc')](_0x548163(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x9ad1('0xd')](e,emitEvent(event));}}module[_0x9ad1('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x9207=['hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x29b56a,_0x1663cc){var _0x4747cb=function(_0x28b2cc){while(--_0x28b2cc){_0x29b56a['push'](_0x29b56a['shift']());}};_0x4747cb(++_0x1663cc);}(_0x9207,0x1e8));var _0x7920=function(_0x2c3954,_0x4df48f){_0x2c3954=_0x2c3954-0x0;var _0x1c95be=_0x9207[_0x2c3954];return _0x1c95be;};'use strict';var EventEmitter=require(_0x7920('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x7920('0x1')];var MailMessage=require(_0x7920('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7920('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7920('0x4'),'afterDestroy':_0x7920('0x5')};function emitEvent(_0x355e21){return function(_0x1abfc7,_0x5f3a8a,_0x5c1e0b){_0x1abfc7[_0x7920('0x6')]({'attributes':['id'],'raw':!![]})[_0x7920('0x7')](function(_0x4ddc68){_0x1abfc7[_0x7920('0x8')](_0x7920('0x9'),_0x4ddc68[_0x7920('0xa')](function(_0x475beb){return{'id':_0x475beb['id']};}));return MailMessage[_0x7920('0xb')]({'where':{'MailInteractionId':_0x1abfc7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7920('0x7')](function(_0x3ca281){_0x1abfc7[_0x7920('0x8')](_0x7920('0xc'),_0x3ca281[_0x7920('0xd')]);MailInteractionEvents[_0x7920('0xe')](_0x355e21+':'+_0x1abfc7['id'],_0x1abfc7);MailInteractionEvents[_0x7920('0xe')](_0x355e21,_0x1abfc7);_0x5c1e0b(null);})[_0x7920('0xf')](_0x5c1e0b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7920('0x10')](e,emitEvent(event));}}module[_0x7920('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 5e5a776..62afe83 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 _0x08ba=['then','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','update'];(function(_0x568d30,_0x50fceb){var _0xabb817=function(_0x1167f3){while(--_0x1167f3){_0x568d30['push'](_0x568d30['shift']());}};_0xabb817(++_0x50fceb);}(_0x08ba,0xf4));var _0xa08b=function(_0x5b0c71,_0x516927){_0x5b0c71=_0x5b0c71-0x0;var _0x23fd6e=_0x08ba[_0x5b0c71];return _0x23fd6e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa08b('0x0'))(_0xa08b('0x1'));var moment=require(_0xa08b('0x2'));var BPromise=require(_0xa08b('0x3'));var rp=require(_0xa08b('0x4'));var fs=require('fs');var path=require(_0xa08b('0x5'));var rimraf=require(_0xa08b('0x6'));var config=require(_0xa08b('0x7'));var attributes=require(_0xa08b('0x8'));module[_0xa08b('0x9')]=function(_0x9e4bd2,_0x28e54b){return _0x9e4bd2[_0xa08b('0xa')](_0xa08b('0xb'),attributes,{'tableName':_0xa08b('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xa08b('0xd'),'to'],'type':_0xa08b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35a55a,_0x392974,_0x17d80a){if(_0x35a55a[_0xa08b('0xf')]){_0x35a55a['substatusAt']=moment()[_0xa08b('0x10')](_0xa08b('0x11'));}if(_0x35a55a[_0xa08b('0x12')]){_0x35a55a[_0xa08b('0x13')]=moment()['format'](_0xa08b('0x11'));}_0x17d80a(null,_0x392974);},'beforeUpdate':function(_0x1607d9,_0x24613d,_0x4a0e0c){if(_0x1607d9[_0xa08b('0x14')](_0xa08b('0xf'))){_0x1607d9[_0xa08b('0x15')]=_0x1607d9[_0xa08b('0xf')]?moment()[_0xa08b('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1607d9[_0xa08b('0x14')](_0xa08b('0x12'))){_0x1607d9[_0xa08b('0x13')]=moment()[_0xa08b('0x10')](_0xa08b('0x11'));_0x1607d9[_0xa08b('0xf')]=null;_0x1607d9[_0xa08b('0x15')]=null;}_0x4a0e0c(null,_0x1607d9);},'afterUpdate':function(_0x44c40d,_0x3cf6c3,_0x29648e){var _0x23f301=_0x9e4bd2[_0xa08b('0x16')];var _0x3598a9=_0x44c40d[_0xa08b('0x17')]({'plain':!![]});if(_0x3598a9[_0xa08b('0x12')]){return _0x23f301[_0xa08b('0x18')][_0xa08b('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x3598a9['id']}})[_0xa08b('0x1a')](function(){_0x29648e();})[_0xa08b('0x1b')](function(_0xd41c24){_0x29648e(_0xd41c24);});}else{_0x29648e();}}},'charset':_0xa08b('0x1c'),'collate':_0xa08b('0x1d')});}; \ No newline at end of file +var _0x605c=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','closed','closedAt','MailMessage'];(function(_0x1893f2,_0x435485){var _0x16531a=function(_0x5ab1df){while(--_0x5ab1df){_0x1893f2['push'](_0x1893f2['shift']());}};_0x16531a(++_0x435485);}(_0x605c,0x149));var _0xc605=function(_0x32d4db,_0x1eeafa){_0x32d4db=_0x32d4db-0x0;var _0x523706=_0x605c[_0x32d4db];return _0x523706;};'use strict';var _=require('lodash');var util=require(_0xc605('0x0'));var logger=require('../../config/logger')(_0xc605('0x1'));var moment=require(_0xc605('0x2'));var BPromise=require(_0xc605('0x3'));var rp=require(_0xc605('0x4'));var fs=require('fs');var path=require(_0xc605('0x5'));var rimraf=require(_0xc605('0x6'));var config=require('../../config/environment');var attributes=require(_0xc605('0x7'));module[_0xc605('0x8')]=function(_0x457492,_0x3d27f5){return _0x457492[_0xc605('0x9')]('MailInteraction',attributes,{'tableName':_0xc605('0xa'),'paranoid':![],'indexes':[{'name':_0xc605('0xb'),'fields':[_0xc605('0xc'),'to'],'type':_0xc605('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3279fb,_0x3197ed,_0x1294b0){if(_0x3279fb['substatus']){_0x3279fb[_0xc605('0xe')]=moment()[_0xc605('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3279fb['closed']){_0x3279fb['closedAt']=moment()[_0xc605('0xf')](_0xc605('0x10'));}_0x1294b0(null,_0x3197ed);},'beforeUpdate':function(_0x29752e,_0x45721c,_0x3fb83b){if(_0x29752e[_0xc605('0x11')](_0xc605('0x12'))){_0x29752e[_0xc605('0xe')]=_0x29752e[_0xc605('0x12')]?moment()[_0xc605('0xf')](_0xc605('0x10')):null;}if(_0x29752e['changed'](_0xc605('0x13'))){_0x29752e[_0xc605('0x14')]=moment()[_0xc605('0xf')](_0xc605('0x10'));_0x29752e[_0xc605('0x12')]=null;_0x29752e[_0xc605('0xe')]=null;}_0x3fb83b(null,_0x29752e);},'afterUpdate':function(_0x566af2,_0x495693,_0x3d63f4){var _0x38b917=_0x457492['models'];var _0x145615=_0x566af2['get']({'plain':!![]});if(_0x145615[_0xc605('0x13')]){return _0x38b917[_0xc605('0x15')][_0xc605('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x145615['id']}})[_0xc605('0x17')](function(){_0x3d63f4();})[_0xc605('0x18')](function(_0x5ab434){_0x3d63f4(_0x5ab434);});}else{_0x3d63f4();}}},'charset':_0xc605('0x19'),'collate':_0xc605('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cf06e60..1292af2 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 _0x2517=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailInteraction,\x20%s,\x20%s','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','then','AddTagsToMailInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird'];(function(_0x152739,_0x5298ca){var _0x4afd9b=function(_0x15fcc1){while(--_0x15fcc1){_0x152739['push'](_0x152739['shift']());}};_0x4afd9b(++_0x5298ca);}(_0x2517,0xfe));var _0x7251=function(_0x474bf9,_0x4aeba5){_0x474bf9=_0x474bf9-0x0;var _0x49a087=_0x2517[_0x474bf9];return _0x49a087;};'use strict';var _=require(_0x7251('0x0'));var util=require(_0x7251('0x1'));var moment=require(_0x7251('0x2'));var BPromise=require(_0x7251('0x3'));var rs=require(_0x7251('0x4'));var fs=require('fs');var Redis=require(_0x7251('0x5'));var db=require(_0x7251('0x6'))['db'];var utils=require(_0x7251('0x7'));var logger=require(_0x7251('0x8'))('rpc');var config=require(_0x7251('0x9'));var jayson=require(_0x7251('0xa'));var client=jayson[_0x7251('0xb')]['http']({'port':0x232a});config[_0x7251('0xc')]=_[_0x7251('0xd')](config[_0x7251('0xc')],{'host':_0x7251('0xe'),'port':0x18eb});var socket=require(_0x7251('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5ce5bb,_0x288698,_0x4eea64){return new BPromise(function(_0x4f793a,_0x182ef5){return client[_0x7251('0x10')](_0x5ce5bb,_0x4eea64)['then'](function(_0x12a1d0){logger[_0x7251('0x11')]('MailInteraction,\x20%s,\x20%s',_0x288698,'request\x20sent');logger[_0x7251('0x12')](_0x7251('0x13'),_0x288698,_0x7251('0x14'),JSON[_0x7251('0x15')](_0x12a1d0));if(_0x12a1d0['error']){if(_0x12a1d0[_0x7251('0x16')]['code']===0x1f4){logger[_0x7251('0x16')]('MailInteraction,\x20%s,\x20%s',_0x288698,_0x12a1d0['error']['message']);return _0x182ef5(_0x12a1d0[_0x7251('0x16')][_0x7251('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x288698,_0x12a1d0[_0x7251('0x16')][_0x7251('0x17')]);return _0x4f793a(_0x12a1d0[_0x7251('0x16')][_0x7251('0x17')]);}else{logger[_0x7251('0x11')]('MailInteraction,\x20%s,\x20%s',_0x288698,_0x7251('0x14'));_0x4f793a(_0x12a1d0[_0x7251('0x18')][_0x7251('0x17')]);}})[_0x7251('0x19')](function(_0x148323){logger[_0x7251('0x16')](_0x7251('0x1a'),_0x288698,_0x148323);_0x182ef5(_0x148323);});});}exports[_0x7251('0x1b')]=function(_0x466f1b){var _0xb50938=this;return new Promise(function(_0x45f696,_0x284227){return db[_0x7251('0x1c')][_0x7251('0x1d')](_0x466f1b[_0x7251('0x1e')],{'raw':_0x466f1b['options']?_0x466f1b[_0x7251('0x1f')][_0x7251('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466f1b['options']?_0x466f1b['options']['where']||null:null,'attributes':_0x466f1b[_0x7251('0x1f')]?_0x466f1b[_0x7251('0x1f')][_0x7251('0x21')]||null:null,'limit':_0x466f1b[_0x7251('0x1f')]?_0x466f1b[_0x7251('0x1f')][_0x7251('0x22')]||null:null})[_0x7251('0x23')](function(_0x5e899d){logger['info']('UpdateMailInteraction',_0x466f1b);logger[_0x7251('0x12')](_0x7251('0x1b'),_0x466f1b,JSON[_0x7251('0x15')](_0x5e899d));_0x45f696(_0x5e899d);})['catch'](function(_0x4123eb){logger[_0x7251('0x16')](_0x7251('0x1b'),_0x4123eb[_0x7251('0x17')],_0x466f1b);_0x284227(_0xb50938['error'](0x1f4,_0x4123eb[_0x7251('0x17')]));});});};exports[_0x7251('0x24')]=function(_0x167668){return new Promise(function(_0x3e0595,_0xeb498e){return db['MailInteraction'][_0x7251('0x25')]({'where':_0x167668[_0x7251('0x1f')]?_0x167668[_0x7251('0x1f')][_0x7251('0x26')]||null:null})[_0x7251('0x23')](function(_0x384e87){if(_0x384e87){return _0x384e87[_0x7251('0x27')](_0x167668['body'][_0x7251('0x28')],_[_0x7251('0x29')](_0x167668[_0x7251('0x1e')],[_0x7251('0x28'),'id'])||{});}})['spread'](function(_0x3f3299){logger[_0x7251('0x11')]('AddTags',_0x167668);logger[_0x7251('0x12')](_0x7251('0x2a'),_0x167668,JSON[_0x7251('0x15')](_0x3f3299));_0x3e0595(_0x3f3299);})[_0x7251('0x19')](function(_0x1f840a){logger[_0x7251('0x16')](_0x7251('0x2a'),_0x1f840a['message'],_0x167668);_0xeb498e(_this[_0x7251('0x16')](0x1f4,_0x1f840a[_0x7251('0x17')]));});});}; \ No newline at end of file +var _0x1e9d=['raw','attributes','limit','AddTagsToMailInteraction','where','ids','omit','body','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','MailInteraction','options'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x1e9d,0x1dd));var _0xd1e9=function(_0x14ef26,_0x212b3f){_0x14ef26=_0x14ef26-0x0;var _0x5f517a=_0x1e9d[_0x14ef26];return _0x5f517a;};'use strict';var _=require(_0xd1e9('0x0'));var util=require('util');var moment=require(_0xd1e9('0x1'));var BPromise=require(_0xd1e9('0x2'));var rs=require(_0xd1e9('0x3'));var fs=require('fs');var Redis=require(_0xd1e9('0x4'));var db=require(_0xd1e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1e9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd1e9('0x7')]=_[_0xd1e9('0x8')](config[_0xd1e9('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xd1e9('0x9'))(new Redis(config['redis']));require(_0xd1e9('0xa'))[_0xd1e9('0xb')](socket);function respondWithRpcPromise(_0x264a37,_0x3f9e20,_0x431041){return new BPromise(function(_0xd32c3a,_0x2ca5fd){return client[_0xd1e9('0xc')](_0x264a37,_0x431041)[_0xd1e9('0xd')](function(_0x246af0){logger[_0xd1e9('0xe')]('MailInteraction,\x20%s,\x20%s',_0x3f9e20,_0xd1e9('0xf'));logger[_0xd1e9('0x10')](_0xd1e9('0x11'),_0x3f9e20,_0xd1e9('0xf'),JSON[_0xd1e9('0x12')](_0x246af0));if(_0x246af0['error']){if(_0x246af0[_0xd1e9('0x13')][_0xd1e9('0x14')]===0x1f4){logger[_0xd1e9('0x13')](_0xd1e9('0x15'),_0x3f9e20,_0x246af0['error']['message']);return _0x2ca5fd(_0x246af0['error'][_0xd1e9('0x16')]);}logger['error'](_0xd1e9('0x15'),_0x3f9e20,_0x246af0[_0xd1e9('0x13')][_0xd1e9('0x16')]);return _0xd32c3a(_0x246af0[_0xd1e9('0x13')][_0xd1e9('0x16')]);}else{logger[_0xd1e9('0xe')](_0xd1e9('0x15'),_0x3f9e20,_0xd1e9('0xf'));_0xd32c3a(_0x246af0['result']['message']);}})[_0xd1e9('0x17')](function(_0x245a23){logger[_0xd1e9('0x13')](_0xd1e9('0x15'),_0x3f9e20,_0x245a23);_0x2ca5fd(_0x245a23);});});}exports[_0xd1e9('0x18')]=function(_0x58fcdb){var _0x9ee3ef=this;return new Promise(function(_0x402028,_0x4e9784){return db[_0xd1e9('0x19')]['update'](_0x58fcdb['body'],{'raw':_0x58fcdb[_0xd1e9('0x1a')]?_0x58fcdb[_0xd1e9('0x1a')][_0xd1e9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58fcdb['options']?_0x58fcdb['options']['where']||null:null,'attributes':_0x58fcdb['options']?_0x58fcdb[_0xd1e9('0x1a')][_0xd1e9('0x1c')]||null:null,'limit':_0x58fcdb['options']?_0x58fcdb['options'][_0xd1e9('0x1d')]||null:null})['then'](function(_0x37735a){logger[_0xd1e9('0xe')](_0xd1e9('0x18'),_0x58fcdb);logger['debug'](_0xd1e9('0x18'),_0x58fcdb,JSON['stringify'](_0x37735a));_0x402028(_0x37735a);})[_0xd1e9('0x17')](function(_0x2b9667){logger['error'](_0xd1e9('0x18'),_0x2b9667[_0xd1e9('0x16')],_0x58fcdb);_0x4e9784(_0x9ee3ef['error'](0x1f4,_0x2b9667[_0xd1e9('0x16')]));});});};exports[_0xd1e9('0x1e')]=function(_0x5c2821){return new Promise(function(_0x5ac7e3,_0x4875c9){return db[_0xd1e9('0x19')]['find']({'where':_0x5c2821[_0xd1e9('0x1a')]?_0x5c2821[_0xd1e9('0x1a')][_0xd1e9('0x1f')]||null:null})[_0xd1e9('0xd')](function(_0x368a52){if(_0x368a52){return _0x368a52['addTags'](_0x5c2821['body'][_0xd1e9('0x20')],_[_0xd1e9('0x21')](_0x5c2821[_0xd1e9('0x22')],[_0xd1e9('0x20'),'id'])||{});}})['spread'](function(_0x150873){logger[_0xd1e9('0xe')]('AddTags',_0x5c2821);logger[_0xd1e9('0x10')](_0xd1e9('0x23'),_0x5c2821,JSON[_0xd1e9('0x12')](_0x150873));_0x5ac7e3(_0x150873);})[_0xd1e9('0x17')](function(_0x233ad4){logger[_0xd1e9('0x13')](_0xd1e9('0x23'),_0x233ad4[_0xd1e9('0x16')],_0x5c2821);_0x4875c9(_this[_0xd1e9('0x13')](0x1f4,_0x233ad4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 56a30be..d978120 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 _0xd7c5=['save','update','removeListener','register','length'];(function(_0x49ebef,_0x1817fd){var _0x21b74e=function(_0x1b6aa2){while(--_0x1b6aa2){_0x49ebef['push'](_0x49ebef['shift']());}};_0x21b74e(++_0x1817fd);}(_0xd7c5,0x163));var _0x5d7c=function(_0x15a4ce,_0x3ebf1e){_0x15a4ce=_0x15a4ce-0x0;var _0x57a6f0=_0xd7c5[_0x15a4ce];return _0x57a6f0;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x5d7c('0x0'),'remove',_0x5d7c('0x1')];function createListener(_0x18e9d6,_0x360bed){return function(_0x995988){_0x360bed['emit'](_0x18e9d6,_0x995988);};}function removeListener(_0x475150,_0x481708){return function(){MailInteractionEvents[_0x5d7c('0x2')](_0x475150,_0x481708);};}exports[_0x5d7c('0x3')]=function(_0x12617f){for(var _0xac0f2a=0x0,_0x25f33d=events[_0x5d7c('0x4')];_0xac0f2a<_0x25f33d;_0xac0f2a++){var _0x1f01dd=events[_0xac0f2a];var _0x3f4cde=createListener('mailInteraction:'+_0x1f01dd,_0x12617f);MailInteractionEvents['on'](_0x1f01dd,_0x3f4cde);}}; \ No newline at end of file +var _0x695c=['update','emit','removeListener','register','save','remove'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x695c,0x10c));var _0xc695=function(_0x529586,_0x3f1b1f){_0x529586=_0x529586-0x0;var _0x104e16=_0x695c[_0x529586];return _0x104e16;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xc695('0x0'),_0xc695('0x1'),_0xc695('0x2')];function createListener(_0x1ca7cf,_0x2d8896){return function(_0x4e7985){_0x2d8896[_0xc695('0x3')](_0x1ca7cf,_0x4e7985);};}function removeListener(_0x5ee4e4,_0x3544cd){return function(){MailInteractionEvents[_0xc695('0x4')](_0x5ee4e4,_0x3544cd);};}exports[_0xc695('0x5')]=function(_0x319cae){for(var _0xe51fca=0x0,_0xf862d2=events['length'];_0xe51fca<_0xf862d2;_0xe51fca++){var _0x56b635=events[_0xe51fca];var _0x16baff=createListener('mailInteraction:'+_0x56b635,_0x319cae);MailInteractionEvents['on'](_0x56b635,_0x16baff);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 2006295..a598ce2 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d2f=['describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe','isAuthenticated'];(function(_0x426d8c,_0x48ae6b){var _0x45e3ad=function(_0x40045a){while(--_0x40045a){_0x426d8c['push'](_0x426d8c['shift']());}};_0x45e3ad(++_0x48ae6b);}(_0x9d2f,0x14a));var _0xf9d2=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x9d2f[_0x12fc8d];return _0x3f9d04;};'use strict';var express=require(_0xf9d2('0x0'));var router=express[_0xf9d2('0x1')]();var auth=require(_0xf9d2('0x2'));var controller=require(_0xf9d2('0x3'));router['get'](_0xf9d2('0x4'),auth[_0xf9d2('0x5')](),controller[_0xf9d2('0x6')]);module[_0xf9d2('0x7')]=router; \ No newline at end of file +var _0xcde7=['describe','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x38ed42,_0x3d9a37){var _0x474931=function(_0x1fa601){while(--_0x1fa601){_0x38ed42['push'](_0x38ed42['shift']());}};_0x474931(++_0x3d9a37);}(_0xcde7,0x65));var _0x7cde=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xcde7[_0x46698a];return _0x356db0;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x7cde('0x0'));var controller=require(_0x7cde('0x1'));router[_0x7cde('0x2')]('/describe',auth['isAuthenticated'](),controller[_0x7cde('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 2e34f47..e746995 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1d4dad,_0x189528){var _0x204197=function(_0xc1857c){while(--_0xc1857c){_0x1d4dad['push'](_0x1d4dad['shift']());}};_0x204197(++_0x189528);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4ad5ee,_0x3777da){var _0x14729d=function(_0xc42a4){while(--_0xc42a4){_0x4ad5ee['push'](_0x4ad5ee['shift']());}};_0x14729d(++_0x3777da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 371d475..6de060f 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6eb0=['INTEGER','sequelize','exports'];(function(_0x515d8d,_0x5a7b53){var _0x296990=function(_0x172593){while(--_0x172593){_0x515d8d['push'](_0x515d8d['shift']());}};_0x296990(++_0x5a7b53);}(_0x6eb0,0xdf));var _0x06eb=function(_0x5a1f46,_0x1fa129){_0x5a1f46=_0x5a1f46-0x0;var _0x3f36be=_0x6eb0[_0x5a1f46];return _0x3f36be;};'use strict';var Sequelize=require(_0x06eb('0x0'));module[_0x06eb('0x1')]={'MailInteractionId':{'type':Sequelize[_0x06eb('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x06eb('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x9395=['INTEGER','sequelize','exports'];(function(_0x37f55c,_0xf4f380){var _0x7877df=function(_0x3ec551){while(--_0x3ec551){_0x37f55c['push'](_0x37f55c['shift']());}};_0x7877df(++_0xf4f380);}(_0x9395,0x121));var _0x5939=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9395[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5939('0x0'));module[_0x5939('0x1')]={'MailInteractionId':{'type':Sequelize[_0x5939('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x5939('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 4367b2b..0dee4c3 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd47c=['define','MailInteractionHasTag','mail_interaction_has_tags','exports'];(function(_0x20369c,_0xc4350c){var _0x134117=function(_0x35dcda){while(--_0x35dcda){_0x20369c['push'](_0x20369c['shift']());}};_0x134117(++_0xc4350c);}(_0xd47c,0xdb));var _0xcd47=function(_0x63ac21,_0x2edb1b){_0x63ac21=_0x63ac21-0x0;var _0x87cd70=_0xd47c[_0x63ac21];return _0x87cd70;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xcd47('0x0')]=function(_0x3453b6){return _0x3453b6[_0xcd47('0x1')](_0xcd47('0x2'),attributes,{'tableName':_0xcd47('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99a9=['MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag','exports','define'];(function(_0x4684af,_0x34880f){var _0x3bb413=function(_0x600b5a){while(--_0x600b5a){_0x4684af['push'](_0x4684af['shift']());}};_0x3bb413(++_0x34880f);}(_0x99a9,0x1c4));var _0x999a=function(_0x16c4e5,_0x3ab176){_0x16c4e5=_0x16c4e5-0x0;var _0x36311d=_0x99a9[_0x16c4e5];return _0x36311d;};'use strict';var attributes=require(_0x999a('0x0'));module[_0x999a('0x1')]=function(_0x448c6f){return _0x448c6f[_0x999a('0x2')](_0x999a('0x3'),attributes,{'tableName':_0x999a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 0c1cb57..2f0200d 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 _0x2c59=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x92c5('0x0'));var timeout=require(_0x92c5('0x1'));var express=require(_0x92c5('0x2'));var router=express[_0x92c5('0x3')]();var fs_extra=require(_0x92c5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92c5('0x5'));var config=require(_0x92c5('0x6'));var controller=require(_0x92c5('0x7'));router[_0x92c5('0x8')]('/',auth[_0x92c5('0x9')](),controller[_0x92c5('0xa')]);router[_0x92c5('0x8')](_0x92c5('0xb'),auth[_0x92c5('0x9')](),controller[_0x92c5('0xc')]);router[_0x92c5('0x8')](_0x92c5('0xd'),auth[_0x92c5('0x9')](),controller[_0x92c5('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x92c5('0xf')]);router['post']('/',auth[_0x92c5('0x9')](),interaction[_0x92c5('0x10')]('mail','mailmessage:create'),controller[_0x92c5('0x11')]);router[_0x92c5('0x12')](_0x92c5('0xd'),auth['isAuthenticated'](),controller[_0x92c5('0x13')]);router[_0x92c5('0x12')](_0x92c5('0x14'),auth['isAuthenticated'](),controller[_0x92c5('0x15')]);router[_0x92c5('0x12')](_0x92c5('0x16'),auth[_0x92c5('0x9')](),controller[_0x92c5('0x17')]);router[_0x92c5('0x18')](_0x92c5('0xd'),auth[_0x92c5('0x9')](),controller['destroy']);module[_0x92c5('0x19')]=router; \ No newline at end of file +var _0xf17f=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','/describe','get','/:id','/:id/download','post','tracked','mail','put','/:id/accept','accept','delete','destroy','exports','multer'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0xf17f,0x113));var _0xff17=function(_0x11a53c,_0x486647){_0x11a53c=_0x11a53c-0x0;var _0x119348=_0xf17f[_0x11a53c];return _0x119348;};'use strict';var multer=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var path=require(_0xff17('0x2'));var timeout=require('connect-timeout');var express=require(_0xff17('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xff17('0x4'));var interaction=require(_0xff17('0x5'));var config=require(_0xff17('0x6'));var controller=require(_0xff17('0x7'));router['get']('/',auth[_0xff17('0x8')](),controller[_0xff17('0x9')]);router['get'](_0xff17('0xa'),auth[_0xff17('0x8')](),controller['describe']);router[_0xff17('0xb')](_0xff17('0xc'),auth[_0xff17('0x8')](),controller['show']);router[_0xff17('0xb')](_0xff17('0xd'),auth[_0xff17('0x8')](),controller['download']);router[_0xff17('0xe')]('/',auth[_0xff17('0x8')](),interaction[_0xff17('0xf')](_0xff17('0x10'),'mailmessage:create'),controller['create']);router[_0xff17('0x11')](_0xff17('0xc'),auth[_0xff17('0x8')](),controller['update']);router[_0xff17('0x11')](_0xff17('0x12'),auth['isAuthenticated'](),controller[_0xff17('0x13')]);router[_0xff17('0x11')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xff17('0x14')]('/:id',auth[_0xff17('0x8')](),controller[_0xff17('0x15')]);module[_0xff17('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index eef20fd..254f6be 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 _0x6c82=['Email','Chat','sequelize','lodash','long','TEXT','medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE'];(function(_0x2aca6e,_0x13b143){var _0x1732bb=function(_0x588704){while(--_0x588704){_0x2aca6e['push'](_0x2aca6e['shift']());}};_0x1732bb(++_0x13b143);}(_0x6c82,0x1af));var _0x26c8=function(_0x3d5a9e,_0x31e369){_0x3d5a9e=_0x3d5a9e-0x0;var _0x482655=_0x6c82[_0x3d5a9e];return _0x482655;};'use strict';var Sequelize=require(_0x26c8('0x0'));var _=require(_0x26c8('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x26c8('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x26c8('0x3')](_0x26c8('0x4'))},'read':{'type':Sequelize[_0x26c8('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x26c8('0x6')]('in',_0x26c8('0x7')),'defaultValue':_0x26c8('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x26c8('0x8')](0x1fe)},'from':{'type':Sequelize[_0x26c8('0x8')]},'to':{'type':Sequelize[_0x26c8('0x3')](_0x26c8('0x2'))},'cc':{'type':Sequelize[_0x26c8('0x3')](_0x26c8('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x26c8('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x26c8('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x26c8('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x26c8('0xa')]},'originTo':{'type':Sequelize[_0x26c8('0x3')](_0x26c8('0x2'))},'originCc':{'type':Sequelize[_0x26c8('0x3')]('long')},'originChannel':{'type':Sequelize[_0x26c8('0x6')](_0x26c8('0xb'),_0x26c8('0xc')),'defaultValue':_0x26c8('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xf423=['Chat','TEXT','medium','ENUM','out','STRING','long','INTEGER','BOOLEAN','Email'];(function(_0x4f5100,_0xe68ab4){var _0x1cf607=function(_0x5e3021){while(--_0x5e3021){_0x4f5100['push'](_0x4f5100['shift']());}};_0x1cf607(++_0xe68ab4);}(_0xf423,0xbf));var _0x3f42=function(_0x1aaaeb,_0x35cf8c){_0x1aaaeb=_0x1aaaeb-0x0;var _0x33dc0c=_0xf423[_0x1aaaeb];return _0x33dc0c;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x3f42('0x0')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3f42('0x0')](_0x3f42('0x1'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3f42('0x2')]('in',_0x3f42('0x3')),'defaultValue':_0x3f42('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3f42('0x4')](0x1fe)},'from':{'type':Sequelize[_0x3f42('0x4')]},'to':{'type':Sequelize['TEXT'](_0x3f42('0x5'))},'cc':{'type':Sequelize[_0x3f42('0x0')]('long')},'bcc':{'type':Sequelize[_0x3f42('0x0')](_0x3f42('0x5'))},'subject':{'type':Sequelize[_0x3f42('0x0')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x3f42('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3f42('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x3f42('0x5'))},'originCc':{'type':Sequelize[_0x3f42('0x0')](_0x3f42('0x5'))},'originChannel':{'type':Sequelize[_0x3f42('0x2')](_0x3f42('0x8'),_0x3f42('0x9')),'defaultValue':_0x3f42('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e517e44..64ddbee 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 _0xeb62=['fieldName','type','model','map','query','keys','filters','attributes','length','nolimit','sort','pick','filter','where','options','MailMessage','includeAll','findAll','rows','catch','show','intersection','fields','merge','find','body','params','describe','create','direction','secret','split','findOne','MailAccountId','List','CmContact','Contacts','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','server/files/attachments','ListId','List\x20not\x20found','sendMail','messageId','format','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','mail','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','contact','SIP/%s','event','reject','rejectmessage','download','unix','toString','join','root','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','limit','count','offset','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','index'];(function(_0x1e632a,_0x4d0d95){var _0x36bf13=function(_0x346bc7){while(--_0x346bc7){_0x1e632a['push'](_0x1e632a['shift']());}};_0x36bf13(++_0x4d0d95);}(_0xeb62,0x6f));var _0x2eb6=function(_0x383df5,_0x2edfe0){_0x383df5=_0x383df5-0x0;var _0x57632c=_0xeb62[_0x383df5];return _0x57632c;};'use strict';var emlformat=require(_0x2eb6('0x0'));var moment=require('moment');var BPromise=require(_0x2eb6('0x1'));var util=require(_0x2eb6('0x2'));var path=require(_0x2eb6('0x3'));var fs=require('fs');var _=require(_0x2eb6('0x4'));var Redis=require(_0x2eb6('0x5'));var htmlToText=require(_0x2eb6('0x6'));var qs=require(_0x2eb6('0x7'));var logger=require(_0x2eb6('0x8'))(_0x2eb6('0x9'));var interaction_log=require(_0x2eb6('0x8'))(_0x2eb6('0xa'));var config=require(_0x2eb6('0xb'));var db=require(_0x2eb6('0xc'))['db'];config[_0x2eb6('0xd')]=_[_0x2eb6('0xe')](config['redis'],{'host':_0x2eb6('0xf'),'port':0x18eb});var socket=require(_0x2eb6('0x10'))(new Redis(config['redis']));var htmlEntities=require(_0x2eb6('0x11'));require(_0x2eb6('0x12'))[_0x2eb6('0x13')](socket);var jayson=require(_0x2eb6('0x14'));var client=jayson[_0x2eb6('0x15')][_0x2eb6('0x16')]({'port':0x232c});var client9003=jayson[_0x2eb6('0x15')][_0x2eb6('0x16')]({'port':0x232b});var client9002=jayson[_0x2eb6('0x15')][_0x2eb6('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3be2c8,_0x533417,_0x1e29b0,_0x3d7608){return new BPromise(function(_0x1e1aa6,_0x48bae7){var _0x5acc5d=_0x3d7608||client;return _0x5acc5d['request'](_0x3be2c8,_0x1e29b0)[_0x2eb6('0x17')](function(_0x27c72c){logger[_0x2eb6('0x18')](_0x2eb6('0x19'),_0x533417,_0x2eb6('0x1a'));logger[_0x2eb6('0x1b')](_0x2eb6('0x1c'),_0x533417,_0x2eb6('0x1a'),JSON[_0x2eb6('0x1d')](_0x27c72c));if(_0x27c72c[_0x2eb6('0x1e')]){if(_0x27c72c[_0x2eb6('0x1e')][_0x2eb6('0x1f')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x533417,_0x27c72c[_0x2eb6('0x1e')][_0x2eb6('0x20')]);return _0x48bae7(_0x27c72c[_0x2eb6('0x1e')][_0x2eb6('0x20')]);}logger[_0x2eb6('0x1e')](_0x2eb6('0x19'),_0x533417,_0x27c72c[_0x2eb6('0x1e')][_0x2eb6('0x20')]);return _0x1e1aa6(_0x27c72c[_0x2eb6('0x1e')][_0x2eb6('0x20')]);}else{logger[_0x2eb6('0x18')](_0x2eb6('0x19'),_0x533417,_0x2eb6('0x1a'));_0x1e1aa6(_0x27c72c['result'][_0x2eb6('0x20')]);}})['catch'](function(_0x220d30){logger[_0x2eb6('0x1e')](_0x2eb6('0x19'),_0x533417,_0x220d30);_0x48bae7(_0x220d30);});});}function respondWithResult(_0x4389f2,_0x22c7b5){_0x22c7b5=_0x22c7b5||0xc8;return function(_0x447ae4){if(_0x447ae4){return _0x4389f2[_0x2eb6('0x21')](_0x22c7b5)['json'](_0x447ae4);}};}function respondWithFilteredResult(_0x2d7640,_0x374697){return function(_0x2bfa6a){if(_0x2bfa6a){var _0x151d10=typeof _0x374697['offset']==='undefined'&&typeof _0x374697[_0x2eb6('0x22')]==='undefined';var _0x263b16=_0x2bfa6a[_0x2eb6('0x23')];var _0x4e6247=_0x151d10?0x0:_0x374697['offset'];var _0x34e7a5=_0x151d10?_0x2bfa6a[_0x2eb6('0x23')]:_0x374697[_0x2eb6('0x24')]+_0x374697[_0x2eb6('0x22')];var _0x47f714;if(_0x34e7a5>=_0x263b16){_0x34e7a5=_0x263b16;_0x47f714=0xc8;}else{_0x47f714=0xce;}_0x2d7640[_0x2eb6('0x21')](_0x47f714);return _0x2d7640[_0x2eb6('0x25')](_0x2eb6('0x26'),_0x4e6247+'-'+_0x34e7a5+'/'+_0x263b16)[_0x2eb6('0x27')](_0x2bfa6a);}return null;};}function saveUpdates(_0x64a6a7){return function(_0x34005c){if(_0x34005c){return _0x34005c[_0x2eb6('0x28')](_0x64a6a7)[_0x2eb6('0x17')](function(_0x56143b){return _0x56143b;});}return null;};}function removeEntity(_0x11f3a6){return function(_0x5a2eef){if(_0x5a2eef){return _0x5a2eef[_0x2eb6('0x29')]()[_0x2eb6('0x17')](function(){_0x11f3a6[_0x2eb6('0x21')](0xcc)[_0x2eb6('0x2a')]();});}};}function handleEntityNotFound(_0x88bd4b){return function(_0x169c7d){if(!_0x169c7d){_0x88bd4b[_0x2eb6('0x2b')](0x194);}return _0x169c7d;};}function handleError(_0x1f0676,_0x1614c1){_0x1614c1=_0x1614c1||0x1f4;return function(_0xb1886d){logger[_0x2eb6('0x1e')](_0xb1886d[_0x2eb6('0x2c')]);if(_0xb1886d[_0x2eb6('0x2d')]){delete _0xb1886d[_0x2eb6('0x2d')];}_0x1f0676[_0x2eb6('0x21')](_0x1614c1)['send'](_0xb1886d);};}exports[_0x2eb6('0x2e')]=function(_0x356049,_0x4b4e64){var _0x24aa9a={},_0xcf3b5f={},_0x53c9a7={'count':0x0,'rows':[]};var _0x2b0266=_['map'](db['MailMessage']['rawAttributes'],function(_0x10ad22){return{'name':_0x10ad22[_0x2eb6('0x2f')],'type':_0x10ad22[_0x2eb6('0x30')]['key']};});_0xcf3b5f[_0x2eb6('0x31')]=_[_0x2eb6('0x32')](_0x2b0266,'name');_0xcf3b5f[_0x2eb6('0x33')]=_[_0x2eb6('0x34')](_0x356049[_0x2eb6('0x33')]);_0xcf3b5f[_0x2eb6('0x35')]=_['intersection'](_0xcf3b5f[_0x2eb6('0x31')],_0xcf3b5f['query']);_0x24aa9a[_0x2eb6('0x36')]=_['intersection'](_0xcf3b5f[_0x2eb6('0x31')],qs['fields'](_0x356049['query']['fields']));_0x24aa9a[_0x2eb6('0x36')]=_0x24aa9a[_0x2eb6('0x36')][_0x2eb6('0x37')]?_0x24aa9a[_0x2eb6('0x36')]:_0xcf3b5f['model'];if(!_0x356049[_0x2eb6('0x33')]['hasOwnProperty'](_0x2eb6('0x38'))){_0x24aa9a[_0x2eb6('0x22')]=qs[_0x2eb6('0x22')](_0x356049[_0x2eb6('0x33')][_0x2eb6('0x22')]);_0x24aa9a[_0x2eb6('0x24')]=qs[_0x2eb6('0x24')](_0x356049[_0x2eb6('0x33')]['offset']);}_0x24aa9a['order']=qs[_0x2eb6('0x39')](_0x356049[_0x2eb6('0x33')][_0x2eb6('0x39')]);_0x24aa9a['where']=qs[_0x2eb6('0x35')](_[_0x2eb6('0x3a')](_0x356049['query'],_0xcf3b5f[_0x2eb6('0x35')]),_0x2b0266);if(_0x356049['query'][_0x2eb6('0x3b')]){_0x24aa9a[_0x2eb6('0x3c')]=_['merge'](_0x24aa9a[_0x2eb6('0x3c')],{'$or':_[_0x2eb6('0x32')](_0x2b0266,function(_0x25985e){if(_0x25985e[_0x2eb6('0x30')]!=='VIRTUAL'){var _0x4c2053={};_0x4c2053[_0x25985e[_0x2eb6('0x2d')]]={'$like':'%'+_0x356049[_0x2eb6('0x33')]['filter']+'%'};return _0x4c2053;}})});}_0x24aa9a=_['merge']({},_0x24aa9a,_0x356049[_0x2eb6('0x3d')]);var _0x2a4cc3={'where':_0x24aa9a[_0x2eb6('0x3c')]};return db[_0x2eb6('0x3e')][_0x2eb6('0x23')](_0x2a4cc3)['then'](function(_0xc6e30){_0x53c9a7[_0x2eb6('0x23')]=_0xc6e30;if(_0x356049[_0x2eb6('0x33')][_0x2eb6('0x3f')]){_0x24aa9a['include']=[{'all':!![]}];}return db[_0x2eb6('0x3e')][_0x2eb6('0x40')](_0x24aa9a);})[_0x2eb6('0x17')](function(_0x40bb6c){_0x53c9a7[_0x2eb6('0x41')]=_0x40bb6c;return _0x53c9a7;})['then'](respondWithFilteredResult(_0x4b4e64,_0x24aa9a))[_0x2eb6('0x42')](handleError(_0x4b4e64,null));};exports[_0x2eb6('0x43')]=function(_0xa688c3,_0x12b8e1){var _0x4dc1e0={'raw':!![],'where':{'id':_0xa688c3['params']['id']}},_0x5d1839={};_0x5d1839[_0x2eb6('0x31')]=_['keys'](db[_0x2eb6('0x3e')]['rawAttributes']);_0x5d1839['query']=_[_0x2eb6('0x34')](_0xa688c3[_0x2eb6('0x33')]);_0x5d1839['filters']=_[_0x2eb6('0x44')](_0x5d1839[_0x2eb6('0x31')],_0x5d1839[_0x2eb6('0x33')]);_0x4dc1e0[_0x2eb6('0x36')]=_[_0x2eb6('0x44')](_0x5d1839[_0x2eb6('0x31')],qs[_0x2eb6('0x45')](_0xa688c3[_0x2eb6('0x33')][_0x2eb6('0x45')]));_0x4dc1e0['attributes']=_0x4dc1e0[_0x2eb6('0x36')][_0x2eb6('0x37')]?_0x4dc1e0[_0x2eb6('0x36')]:_0x5d1839[_0x2eb6('0x31')];if(_0xa688c3[_0x2eb6('0x33')][_0x2eb6('0x3f')]){_0x4dc1e0['include']=[{'all':!![]}];}_0x4dc1e0=_[_0x2eb6('0x46')]({},_0x4dc1e0,_0xa688c3['options']);return db[_0x2eb6('0x3e')][_0x2eb6('0x47')](_0x4dc1e0)[_0x2eb6('0x17')](handleEntityNotFound(_0x12b8e1,null))['then'](respondWithResult(_0x12b8e1,null))[_0x2eb6('0x42')](handleError(_0x12b8e1,null));};exports['update']=function(_0x413c9a,_0x436ece){if(_0x413c9a[_0x2eb6('0x48')]['id']){delete _0x413c9a['body']['id'];}return db[_0x2eb6('0x3e')][_0x2eb6('0x47')]({'where':{'id':_0x413c9a[_0x2eb6('0x49')]['id']}})[_0x2eb6('0x17')](handleEntityNotFound(_0x436ece,null))[_0x2eb6('0x17')](saveUpdates(_0x413c9a[_0x2eb6('0x48')],null))[_0x2eb6('0x17')](respondWithResult(_0x436ece,null))['catch'](handleError(_0x436ece,null));};exports['destroy']=function(_0x2f6e8c,_0x36f3d7){return db[_0x2eb6('0x3e')][_0x2eb6('0x47')]({'where':{'id':_0x2f6e8c['params']['id']}})[_0x2eb6('0x17')](handleEntityNotFound(_0x36f3d7,null))[_0x2eb6('0x17')](removeEntity(_0x36f3d7,null))[_0x2eb6('0x42')](handleError(_0x36f3d7,null));};exports[_0x2eb6('0x4a')]=function(_0xf6d09d,_0x45565c){return db[_0x2eb6('0x3e')][_0x2eb6('0x4a')]()[_0x2eb6('0x17')](respondWithResult(_0x45565c,null))[_0x2eb6('0x42')](handleError(_0x45565c,null));};exports[_0x2eb6('0x4b')]=function(_0x3497e8,_0x18ca5b){return db[_0x2eb6('0x3e')][_0x2eb6('0x4b')](_0x3497e8['body'])[_0x2eb6('0x17')](function(_0x308fda){if(_0x308fda){if(_0x308fda[_0x2eb6('0x4c')]==='out'&&!_0x308fda[_0x2eb6('0x4d')]){var _0x2a7ef0,_0x43b786,_0x51f6b5;if(_0x3497e8['body']['to']){_0x43b786=_0x3497e8[_0x2eb6('0x48')]['to'][_0x2eb6('0x4e')](',')[0x0];}return db['MailAccount'][_0x2eb6('0x4f')]({'where':{'id':_0x308fda[_0x2eb6('0x50')]},'include':[{'model':db['CmList'],'as':_0x2eb6('0x51'),'include':[{'model':db[_0x2eb6('0x52')],'as':_0x2eb6('0x53'),'where':{'email':_0x43b786},'limit':0x1,'order':[['updatedAt',_0x2eb6('0x54')]]}]},{'model':db['MailServerOut'],'as':_0x2eb6('0x55'),'raw':!![],'include':[{'model':db[_0x2eb6('0x56')],'as':'CloudProvider','raw':!![]}]}]})[_0x2eb6('0x17')](function(_0x5366dd){_0x2a7ef0=_0x5366dd;if(!_0x2a7ef0||!_0x2a7ef0[_0x2eb6('0x55')])return;var _0x393b4c=_0x2a7ef0[_0x2eb6('0x57')]();if(_0x3497e8[_0x2eb6('0x48')]['attachments']&&_0x3497e8[_0x2eb6('0x48')][_0x2eb6('0x58')][_0x2eb6('0x37')]){for(var _0x3dd928=0x0;_0x3dd928<_0x3497e8['body'][_0x2eb6('0x58')][_0x2eb6('0x37')];_0x3dd928+=0x1){_0x3497e8[_0x2eb6('0x48')]['attachments'][_0x3dd928]={'filename':_0x3497e8[_0x2eb6('0x48')][_0x2eb6('0x58')][_0x3dd928][_0x2eb6('0x2d')],'path':path['join'](config['root'],_0x2eb6('0x59'),_0x3497e8[_0x2eb6('0x48')][_0x2eb6('0x58')][_0x3dd928]['basename'])};}}_0x51f6b5={'account':_0x393b4c,'message':_0x3497e8['body']};return;})['then'](function(){if(_0x2a7ef0[_0x2eb6('0x51')]){if(_0x2a7ef0[_0x2eb6('0x51')][_0x2eb6('0x53')][_0x2eb6('0x37')]){return _0x2a7ef0[_0x2eb6('0x51')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x2eb6('0xe')](_0x3497e8[_0x2eb6('0x48')],{'firstName':_0x3497e8['body']['to'],'email':_0x3497e8[_0x2eb6('0x48')]['to'],'phone':_0x3497e8[_0x2eb6('0x48')]['to'],'ListId':_0x2a7ef0[_0x2eb6('0x5a')]}));}}else{throw new Error(_0x2eb6('0x5b'));}})[_0x2eb6('0x17')](function(){if(_0x51f6b5){return respondWithRpcPromise('SendMail',_0x2eb6('0x5c'),_0x51f6b5,client9003)['then'](function(_0x513726){return _0x308fda[_0x2eb6('0x28')]({'read':!![],'messageId':_0x513726[_0x2eb6('0x5d')],'sentAt':moment()[_0x2eb6('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2eb6('0x42')](function(_0x203ffd){logger['error']('%s',JSON[_0x2eb6('0x1d')](_0x203ffd));return _0x308fda;});}return _0x308fda;});}return _0x308fda;}})[_0x2eb6('0x17')](respondWithResult(_0x18ca5b,0xc9))['catch'](handleError(_0x18ca5b,null));};exports[_0x2eb6('0x5f')]=function(_0x3b82b4,_0xf5a1fb){var _0x2936bb={'agent':{},'channel':'mail'};if(_0x3b82b4[_0x2eb6('0x48')]['id']){delete _0x3b82b4[_0x2eb6('0x48')]['id'];}_0x3b82b4[_0x2eb6('0x48')][_0x2eb6('0x60')]=!![];_0x3b82b4[_0x2eb6('0x48')]['readAt']=moment()['format'](_0x2eb6('0x61'));_0x3b82b4[_0x2eb6('0x48')][_0x2eb6('0x62')]=_0x3b82b4[_0x2eb6('0x48')][_0x2eb6('0x62')]||_0x3b82b4[_0x2eb6('0x63')]['id'];_0x2936bb[_0x2eb6('0x64')]['id']=_0x3b82b4[_0x2eb6('0x48')]['UserId'];return db[_0x2eb6('0x3e')][_0x2eb6('0x47')]({'where':{'id':_0x3b82b4['params']['id'],'UserId':null}})[_0x2eb6('0x17')](handleEntityNotFound(_0xf5a1fb,null))[_0x2eb6('0x17')](saveUpdates(_0x3b82b4[_0x2eb6('0x48')],null))['then'](function(_0x85f631){if(_0x85f631){_0x2936bb[_0x2eb6('0x20')]=_0x85f631[_0x2eb6('0x65')]({'plain':!![]});return db['MailInteraction'][_0x2eb6('0x47')]({'where':{'id':_0x85f631['MailInteractionId']}});}return null;})[_0x2eb6('0x17')](handleEntityNotFound(_0xf5a1fb,null))[_0x2eb6('0x17')](function(_0x1dcd45){if(_0x1dcd45){return _0x1dcd45[_0x2eb6('0x28')]({'UserId':_0x3b82b4['body'][_0x2eb6('0x62')],'read1stAt':_[_0x2eb6('0x66')](_0x1dcd45[_0x2eb6('0x67')])?moment()['format'](_0x2eb6('0x61')):undefined});}return null;})['then'](function(_0x594357){if(_0x594357){_0x2936bb[_0x2eb6('0x68')]=_0x594357[_0x2eb6('0x65')]({'plain':!![]});interaction_log[_0x2eb6('0x18')](_0x2eb6('0x69'),_0x3b82b4['user']['id'],_0x3b82b4[_0x2eb6('0x63')][_0x2eb6('0x2d')],_0x3b82b4[_0x2eb6('0x63')][_0x2eb6('0x6a')],_0x2936bb['interaction']['id'],_0x3b82b4[_0x2eb6('0x48')]?JSON[_0x2eb6('0x1d')](_0x3b82b4['body']):_0x2eb6('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x2eb6('0x6c'),_0x2936bb);}return null;})['then'](function(_0x193798){var _0x352b09='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x193798[_0x2eb6('0x20')][_0x2eb6('0x6d')];return db['sequelize'][_0x2eb6('0x33')](_0x352b09,{'type':db[_0x2eb6('0x6e')][_0x2eb6('0x6f')][_0x2eb6('0x70')],'raw':!![]})[_0x2eb6('0x17')](function(_0x398496){return _0x398496;});})[_0x2eb6('0x17')](function(_0x528fca){if(_0x528fca){_0x2936bb[_0x2eb6('0x20')]['contact']=_0x528fca[0x0];if(!_0x3b82b4['body'][_0x2eb6('0x62')])return;return db[_0x2eb6('0x71')]['find']({'where':{'id':_0x3b82b4[_0x2eb6('0x48')][_0x2eb6('0x62')],'role':_0x2eb6('0x64')},'attributes':['id','name',_0x2eb6('0x72'),_0x2eb6('0x73'),_0x2eb6('0x74')],'raw':!![]});}return null;})[_0x2eb6('0x17')](function(_0x113bab){if(!_0x113bab)return null;_0x2936bb[_0x2eb6('0x20')][_0x2eb6('0x64')]=_0x113bab;return _0x2936bb;})[_0x2eb6('0x17')](function(_0x593467){if(_0x593467){if(_0x3b82b4[_0x2eb6('0x48')][_0x2eb6('0x75')]){_0x2936bb['message'][_0x2eb6('0x76')]=util[_0x2eb6('0x5e')]('SIP/%s',_0x3b82b4['user'][_0x2eb6('0x2d')]);_0x2936bb['message'][_0x2eb6('0x77')]=_0x2936bb[_0x2eb6('0x77')];_0x2936bb['message'][_0x2eb6('0x78')]=_0x2936bb['channel'];_0x2936bb[_0x2eb6('0x20')]['event']=_0x2eb6('0x5f');_0x2936bb[_0x2eb6('0x20')]['body']=htmlToText[_0x2eb6('0x79')](_0x2936bb['message'][_0x2eb6('0x48')]);return respondWithRpcPromise(_0x2eb6('0x7a'),_0x2eb6('0x7a'),{'event':'acceptmessage','message':_0x2936bb[_0x2eb6('0x20')]},client9002)[_0x2eb6('0x17')](function(){return _0x2936bb;});}return _0x2936bb;}return null;})[_0x2eb6('0x17')](respondWithResult(_0xf5a1fb,null))['catch'](handleError(_0xf5a1fb,null));};exports['reject']=function(_0x120c75,_0x56bcd){var _0x47ee68={'agent':{},'channel':_0x2eb6('0x7b')};if(_0x120c75['body']['id']){delete _0x120c75[_0x2eb6('0x48')]['id'];}_0x120c75[_0x2eb6('0x48')][_0x2eb6('0x62')]=_0x120c75[_0x2eb6('0x48')][_0x2eb6('0x62')]||_0x120c75[_0x2eb6('0x63')]['id'];_0x47ee68[_0x2eb6('0x64')]['id']=_0x120c75[_0x2eb6('0x48')][_0x2eb6('0x62')];return db[_0x2eb6('0x3e')][_0x2eb6('0x47')]({'where':{'id':_0x120c75['params']['id'],'UserId':null}})[_0x2eb6('0x17')](handleEntityNotFound(_0x56bcd,null))[_0x2eb6('0x17')](function(_0x517b2d){if(_0x517b2d){_0x47ee68[_0x2eb6('0x20')]=_0x517b2d[_0x2eb6('0x65')]({'plain':!![]});return db[_0x2eb6('0x7c')][_0x2eb6('0x47')]({'where':{'id':_0x517b2d[_0x2eb6('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x56bcd,null))[_0x2eb6('0x17')](function(_0x52afdc){if(_0x52afdc){_0x47ee68['interaction']=_0x52afdc['get']({'plain':!![]});interaction_log[_0x2eb6('0x18')](_0x2eb6('0x7e'),_0x120c75[_0x2eb6('0x63')]['id'],_0x120c75[_0x2eb6('0x63')]['name'],_0x120c75['user']['role'],_0x47ee68[_0x2eb6('0x68')]['id'],_0x120c75[_0x2eb6('0x48')]?JSON[_0x2eb6('0x1d')](_0x120c75['body']):_0x2eb6('0x6b'));return respondWithRpcPromise(_0x2eb6('0x7f'),_0x2eb6('0x80'),_0x47ee68);}return null;})[_0x2eb6('0x17')](function(_0x17dede){var _0x5659d3=_0x2eb6('0x81')+_0x17dede[_0x2eb6('0x20')][_0x2eb6('0x6d')];return db[_0x2eb6('0x82')]['query'](_0x5659d3,{'type':db[_0x2eb6('0x6e')]['QueryTypes'][_0x2eb6('0x70')],'raw':!![]})[_0x2eb6('0x17')](function(_0x4879dd){return _0x4879dd;});})[_0x2eb6('0x17')](function(_0x29f813){if(_0x29f813){_0x47ee68[_0x2eb6('0x20')][_0x2eb6('0x83')]=_0x29f813[0x0];if(!_0x120c75[_0x2eb6('0x48')][_0x2eb6('0x62')])return;return db[_0x2eb6('0x71')]['find']({'where':{'id':_0x120c75[_0x2eb6('0x48')]['UserId'],'role':_0x2eb6('0x64')},'attributes':['id',_0x2eb6('0x2d'),_0x2eb6('0x72'),_0x2eb6('0x73'),_0x2eb6('0x74')],'raw':!![]});}return null;})[_0x2eb6('0x17')](function(_0x4864ed){if(!_0x4864ed)return null;_0x47ee68[_0x2eb6('0x20')]['agent']=_0x4864ed;return _0x47ee68;})[_0x2eb6('0x17')](function(_0x2edae9){if(_0x2edae9){_0x2edae9[_0x2eb6('0x20')][_0x2eb6('0x76')]=util[_0x2eb6('0x5e')](_0x2eb6('0x84'),_0x120c75[_0x2eb6('0x63')][_0x2eb6('0x2d')]);_0x2edae9[_0x2eb6('0x20')][_0x2eb6('0x77')]=_0x47ee68[_0x2eb6('0x77')];_0x2edae9['message'][_0x2eb6('0x78')]=_0x47ee68[_0x2eb6('0x77')];_0x2edae9[_0x2eb6('0x20')][_0x2eb6('0x85')]=_0x2eb6('0x86');_0x2edae9[_0x2eb6('0x20')][_0x2eb6('0x48')]=htmlToText[_0x2eb6('0x79')](_0x47ee68[_0x2eb6('0x20')][_0x2eb6('0x48')]);respondWithRpcPromise(_0x2eb6('0x7a'),_0x2eb6('0x7a'),{'event':_0x2eb6('0x87'),'message':_0x2edae9[_0x2eb6('0x20')]},client9002);return _0x47ee68;}return null;})[_0x2eb6('0x17')](respondWithResult(_0x56bcd,null))[_0x2eb6('0x42')](handleError(_0x56bcd,null));};exports[_0x2eb6('0x88')]=function(_0x152718,_0x488fb8){var _0x12db94=moment()[_0x2eb6('0x89')]()[_0x2eb6('0x8a')]();var _0x2eeb7d=path[_0x2eb6('0x8b')](config[_0x2eb6('0x8c')],_0x2eb6('0x8d'),_0x2eb6('0x8e'),_0x2eb6('0x8f'));var _0x26416a=path[_0x2eb6('0x8b')](config['root'],_0x2eb6('0x8d'),'files',_0x2eb6('0x58'));var _0x444acc=util[_0x2eb6('0x5e')]('message-%s.eml',_0x12db94);return db[_0x2eb6('0x3e')][_0x2eb6('0x47')]({'where':{'id':_0x152718[_0x2eb6('0x49')]['id']},'attributes':['id',_0x2eb6('0x48'),_0x2eb6('0x90'),'to','cc',_0x2eb6('0x91'),_0x2eb6('0x92'),_0x2eb6('0x93')],'include':_0x152718[_0x2eb6('0x33')][_0x2eb6('0x58')]?[{'model':db[_0x2eb6('0x94')],'as':_0x2eb6('0x95')}]:undefined})[_0x2eb6('0x17')](handleEntityNotFound(_0x488fb8,null))[_0x2eb6('0x17')](function(_0x4558e4){if(_0x4558e4){var _0x2285e9=_0x4558e4;var _0x24554a={'from':_0x2285e9['from'],'to':_0x2285e9['to'],'subject':_0x2285e9[_0x2eb6('0x92')],'html':htmlEntities[_0x2eb6('0x96')](_0x2285e9[_0x2eb6('0x48')]),'headers':{'Date':moment(_0x2285e9[_0x2eb6('0x93')])[_0x2eb6('0x5e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4558e4['cc']){_0x24554a['headers']['Cc']=_0x4558e4['cc'];}if(_0x4558e4[_0x2eb6('0x91')]){_0x24554a[_0x2eb6('0x97')][_0x2eb6('0x98')]=_0x4558e4['bcc'];}return new BPromise(function(_0x4c25b8,_0x36eb8c){if(_0x4558e4[_0x2eb6('0x95')]){for(var _0x34c358=0x0;_0x34c358<_0x4558e4[_0x2eb6('0x95')][_0x2eb6('0x37')];_0x34c358++){var _0x5a826e=_0x4558e4[_0x2eb6('0x95')][_0x34c358];var _0x2fcfa7=path[_0x2eb6('0x8b')](_0x26416a,_0x5a826e['basename']);if(fs['existsSync'](_0x2fcfa7)){_0x24554a[_0x2eb6('0x58')][_0x2eb6('0x99')]({'name':_0x5a826e[_0x2eb6('0x2d')],'contentType':_0x5a826e[_0x2eb6('0x30')],'data':fs[_0x2eb6('0x9a')](_0x2fcfa7)});}}}emlformat[_0x2eb6('0x9b')](_0x24554a,function(_0x2e6eba,_0x5b5718){if(_0x2e6eba)return _0x36eb8c(_0x2e6eba);fs[_0x2eb6('0x9c')](path[_0x2eb6('0x8b')](_0x2eeb7d,_0x444acc),_0x5b5718);return _0x4c25b8(_0x5b5718);});});}})[_0x2eb6('0x17')](function(_0x5c49c2){if(_0x5c49c2){return _0x488fb8[_0x2eb6('0x88')](path[_0x2eb6('0x8b')](_0x2eeb7d,_0x444acc),_0x444acc,function(_0x4fc091){if(!_0x4fc091)fs[_0x2eb6('0x9d')](path[_0x2eb6('0x8b')](_0x2eeb7d,_0x444acc));});}})[_0x2eb6('0x42')](handleError(_0x488fb8,null));}; \ No newline at end of file +var _0xca5a=['set','Content-Range','update','destroy','end','sendStatus','stack','send','index','map','MailMessage','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','name','includeAll','show','rawAttributes','include','options','find','body','params','describe','create','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','format','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[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','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','channel','event','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','interface','SIP/%s','fromString','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','readFileSync','writeFileSync','bluebird','util','path','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','json','offset','undefined','limit','count','status'];(function(_0x39dee5,_0x363648){var _0xdc8b24=function(_0x3899c2){while(--_0x3899c2){_0x39dee5['push'](_0x39dee5['shift']());}};_0xdc8b24(++_0x363648);}(_0xca5a,0x7a));var _0xaca5=function(_0x1531cc,_0xf16283){_0x1531cc=_0x1531cc-0x0;var _0x54b347=_0xca5a[_0x1531cc];return _0x54b347;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xaca5('0x0'));var util=require(_0xaca5('0x1'));var path=require(_0xaca5('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xaca5('0x3'));var htmlToText=require(_0xaca5('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xaca5('0x5'))(_0xaca5('0x6'));var interaction_log=require(_0xaca5('0x5'))(_0xaca5('0x7'));var config=require('../../config/environment');var db=require(_0xaca5('0x8'))['db'];config[_0xaca5('0x9')]=_[_0xaca5('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaca5('0xb'))(new Redis(config[_0xaca5('0x9')]));var htmlEntities=require(_0xaca5('0xc'));require(_0xaca5('0xd'))[_0xaca5('0xe')](socket);var jayson=require(_0xaca5('0xf'));var client=jayson['client'][_0xaca5('0x10')]({'port':0x232c});var client9003=jayson[_0xaca5('0x11')][_0xaca5('0x10')]({'port':0x232b});var client9002=jayson['client'][_0xaca5('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x102a76,_0x37b3b5,_0x1ac33b,_0x322d95){return new BPromise(function(_0x5559bd,_0x5d16b0){var _0x3c1ba3=_0x322d95||client;return _0x3c1ba3[_0xaca5('0x12')](_0x102a76,_0x1ac33b)[_0xaca5('0x13')](function(_0x3a97d8){logger['info'](_0xaca5('0x14'),_0x37b3b5,_0xaca5('0x15'));logger[_0xaca5('0x16')](_0xaca5('0x17'),_0x37b3b5,'request\x20sent',JSON['stringify'](_0x3a97d8));if(_0x3a97d8['error']){if(_0x3a97d8[_0xaca5('0x18')][_0xaca5('0x19')]===0x1f4){logger[_0xaca5('0x18')](_0xaca5('0x14'),_0x37b3b5,_0x3a97d8[_0xaca5('0x18')][_0xaca5('0x1a')]);return _0x5d16b0(_0x3a97d8[_0xaca5('0x18')]['message']);}logger['error'](_0xaca5('0x14'),_0x37b3b5,_0x3a97d8[_0xaca5('0x18')][_0xaca5('0x1a')]);return _0x5559bd(_0x3a97d8['error'][_0xaca5('0x1a')]);}else{logger[_0xaca5('0x1b')]('MailMessage,\x20%s,\x20%s',_0x37b3b5,_0xaca5('0x15'));_0x5559bd(_0x3a97d8[_0xaca5('0x1c')][_0xaca5('0x1a')]);}})[_0xaca5('0x1d')](function(_0x51f2bf){logger[_0xaca5('0x18')](_0xaca5('0x14'),_0x37b3b5,_0x51f2bf);_0x5d16b0(_0x51f2bf);});});}function respondWithResult(_0x5931d9,_0x4ca1b1){_0x4ca1b1=_0x4ca1b1||0xc8;return function(_0x3880c6){if(_0x3880c6){return _0x5931d9['status'](_0x4ca1b1)[_0xaca5('0x1e')](_0x3880c6);}};}function respondWithFilteredResult(_0x452897,_0x1bc9ae){return function(_0x1104a1){if(_0x1104a1){var _0x4ecd16=typeof _0x1bc9ae[_0xaca5('0x1f')]===_0xaca5('0x20')&&typeof _0x1bc9ae[_0xaca5('0x21')]===_0xaca5('0x20');var _0x8cd00f=_0x1104a1[_0xaca5('0x22')];var _0x2945cb=_0x4ecd16?0x0:_0x1bc9ae[_0xaca5('0x1f')];var _0x4c0c1b=_0x4ecd16?_0x1104a1[_0xaca5('0x22')]:_0x1bc9ae[_0xaca5('0x1f')]+_0x1bc9ae[_0xaca5('0x21')];var _0x131880;if(_0x4c0c1b>=_0x8cd00f){_0x4c0c1b=_0x8cd00f;_0x131880=0xc8;}else{_0x131880=0xce;}_0x452897[_0xaca5('0x23')](_0x131880);return _0x452897[_0xaca5('0x24')](_0xaca5('0x25'),_0x2945cb+'-'+_0x4c0c1b+'/'+_0x8cd00f)[_0xaca5('0x1e')](_0x1104a1);}return null;};}function saveUpdates(_0x861865){return function(_0x1d4fa8){if(_0x1d4fa8){return _0x1d4fa8[_0xaca5('0x26')](_0x861865)[_0xaca5('0x13')](function(_0x447e47){return _0x447e47;});}return null;};}function removeEntity(_0x19837e){return function(_0x539df5){if(_0x539df5){return _0x539df5[_0xaca5('0x27')]()[_0xaca5('0x13')](function(){_0x19837e['status'](0xcc)[_0xaca5('0x28')]();});}};}function handleEntityNotFound(_0x2312fb){return function(_0x4d99fb){if(!_0x4d99fb){_0x2312fb[_0xaca5('0x29')](0x194);}return _0x4d99fb;};}function handleError(_0x1de616,_0x49f838){_0x49f838=_0x49f838||0x1f4;return function(_0x378034){logger[_0xaca5('0x18')](_0x378034[_0xaca5('0x2a')]);if(_0x378034['name']){delete _0x378034['name'];}_0x1de616[_0xaca5('0x23')](_0x49f838)[_0xaca5('0x2b')](_0x378034);};}exports[_0xaca5('0x2c')]=function(_0x5d5327,_0xe52e65){var _0x58f410={},_0x32195e={},_0x1666dc={'count':0x0,'rows':[]};var _0x22899c=_[_0xaca5('0x2d')](db[_0xaca5('0x2e')]['rawAttributes'],function(_0x2333d2){return{'name':_0x2333d2['fieldName'],'type':_0x2333d2[_0xaca5('0x2f')][_0xaca5('0x30')]};});_0x32195e['model']=_[_0xaca5('0x2d')](_0x22899c,'name');_0x32195e['query']=_[_0xaca5('0x31')](_0x5d5327[_0xaca5('0x32')]);_0x32195e[_0xaca5('0x33')]=_[_0xaca5('0x34')](_0x32195e[_0xaca5('0x35')],_0x32195e[_0xaca5('0x32')]);_0x58f410[_0xaca5('0x36')]=_[_0xaca5('0x34')](_0x32195e['model'],qs[_0xaca5('0x37')](_0x5d5327['query'][_0xaca5('0x37')]));_0x58f410['attributes']=_0x58f410[_0xaca5('0x36')][_0xaca5('0x38')]?_0x58f410[_0xaca5('0x36')]:_0x32195e['model'];if(!_0x5d5327[_0xaca5('0x32')][_0xaca5('0x39')]('nolimit')){_0x58f410[_0xaca5('0x21')]=qs[_0xaca5('0x21')](_0x5d5327[_0xaca5('0x32')][_0xaca5('0x21')]);_0x58f410['offset']=qs[_0xaca5('0x1f')](_0x5d5327[_0xaca5('0x32')]['offset']);}_0x58f410[_0xaca5('0x3a')]=qs['sort'](_0x5d5327[_0xaca5('0x32')][_0xaca5('0x3b')]);_0x58f410[_0xaca5('0x3c')]=qs[_0xaca5('0x33')](_['pick'](_0x5d5327['query'],_0x32195e[_0xaca5('0x33')]),_0x22899c);if(_0x5d5327[_0xaca5('0x32')][_0xaca5('0x3d')]){_0x58f410['where']=_['merge'](_0x58f410[_0xaca5('0x3c')],{'$or':_[_0xaca5('0x2d')](_0x22899c,function(_0x1f905c){if(_0x1f905c[_0xaca5('0x2f')]!=='VIRTUAL'){var _0x294543={};_0x294543[_0x1f905c[_0xaca5('0x3e')]]={'$like':'%'+_0x5d5327[_0xaca5('0x32')][_0xaca5('0x3d')]+'%'};return _0x294543;}})});}_0x58f410=_['merge']({},_0x58f410,_0x5d5327['options']);var _0x2aeeed={'where':_0x58f410[_0xaca5('0x3c')]};return db[_0xaca5('0x2e')][_0xaca5('0x22')](_0x2aeeed)[_0xaca5('0x13')](function(_0x17de40){_0x1666dc[_0xaca5('0x22')]=_0x17de40;if(_0x5d5327[_0xaca5('0x32')][_0xaca5('0x3f')]){_0x58f410['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x58f410);})[_0xaca5('0x13')](function(_0x51c843){_0x1666dc['rows']=_0x51c843;return _0x1666dc;})[_0xaca5('0x13')](respondWithFilteredResult(_0xe52e65,_0x58f410))[_0xaca5('0x1d')](handleError(_0xe52e65,null));};exports[_0xaca5('0x40')]=function(_0x17a96c,_0x275f85){var _0x739b41={'raw':!![],'where':{'id':_0x17a96c['params']['id']}},_0x503900={};_0x503900[_0xaca5('0x35')]=_[_0xaca5('0x31')](db[_0xaca5('0x2e')][_0xaca5('0x41')]);_0x503900['query']=_['keys'](_0x17a96c[_0xaca5('0x32')]);_0x503900[_0xaca5('0x33')]=_['intersection'](_0x503900[_0xaca5('0x35')],_0x503900[_0xaca5('0x32')]);_0x739b41[_0xaca5('0x36')]=_['intersection'](_0x503900['model'],qs['fields'](_0x17a96c['query'][_0xaca5('0x37')]));_0x739b41['attributes']=_0x739b41[_0xaca5('0x36')][_0xaca5('0x38')]?_0x739b41[_0xaca5('0x36')]:_0x503900[_0xaca5('0x35')];if(_0x17a96c[_0xaca5('0x32')][_0xaca5('0x3f')]){_0x739b41[_0xaca5('0x42')]=[{'all':!![]}];}_0x739b41=_['merge']({},_0x739b41,_0x17a96c[_0xaca5('0x43')]);return db[_0xaca5('0x2e')][_0xaca5('0x44')](_0x739b41)['then'](handleEntityNotFound(_0x275f85,null))[_0xaca5('0x13')](respondWithResult(_0x275f85,null))['catch'](handleError(_0x275f85,null));};exports[_0xaca5('0x26')]=function(_0x440f1b,_0x5535c2){if(_0x440f1b[_0xaca5('0x45')]['id']){delete _0x440f1b[_0xaca5('0x45')]['id'];}return db[_0xaca5('0x2e')][_0xaca5('0x44')]({'where':{'id':_0x440f1b[_0xaca5('0x46')]['id']}})['then'](handleEntityNotFound(_0x5535c2,null))[_0xaca5('0x13')](saveUpdates(_0x440f1b[_0xaca5('0x45')],null))[_0xaca5('0x13')](respondWithResult(_0x5535c2,null))['catch'](handleError(_0x5535c2,null));};exports[_0xaca5('0x27')]=function(_0x4792a3,_0x49d22b){return db[_0xaca5('0x2e')][_0xaca5('0x44')]({'where':{'id':_0x4792a3[_0xaca5('0x46')]['id']}})[_0xaca5('0x13')](handleEntityNotFound(_0x49d22b,null))[_0xaca5('0x13')](removeEntity(_0x49d22b,null))[_0xaca5('0x1d')](handleError(_0x49d22b,null));};exports[_0xaca5('0x47')]=function(_0x53ccac,_0x538abd){return db[_0xaca5('0x2e')][_0xaca5('0x47')]()[_0xaca5('0x13')](respondWithResult(_0x538abd,null))[_0xaca5('0x1d')](handleError(_0x538abd,null));};exports['create']=function(_0x2fe6e8,_0x1d35e8){return db[_0xaca5('0x2e')][_0xaca5('0x48')](_0x2fe6e8[_0xaca5('0x45')])[_0xaca5('0x13')](function(_0x6aca2e){if(_0x6aca2e){if(_0x6aca2e['direction']===_0xaca5('0x49')&&!_0x6aca2e[_0xaca5('0x4a')]){var _0x2b5710,_0x2c5522,_0x1a8631;if(_0x2fe6e8[_0xaca5('0x45')]['to']){_0x2c5522=_0x2fe6e8[_0xaca5('0x45')]['to'][_0xaca5('0x4b')](',')[0x0];}return db[_0xaca5('0x4c')][_0xaca5('0x4d')]({'where':{'id':_0x6aca2e['MailAccountId']},'include':[{'model':db[_0xaca5('0x4e')],'as':_0xaca5('0x4f'),'include':[{'model':db[_0xaca5('0x50')],'as':_0xaca5('0x51'),'where':{'email':_0x2c5522},'limit':0x1,'order':[[_0xaca5('0x52'),_0xaca5('0x53')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xaca5('0x54')],'as':_0xaca5('0x54'),'raw':!![]}]}]})[_0xaca5('0x13')](function(_0x45ef53){_0x2b5710=_0x45ef53;if(!_0x2b5710||!_0x2b5710[_0xaca5('0x55')])return;var _0x196f5b=_0x2b5710[_0xaca5('0x56')]();if(_0x2fe6e8[_0xaca5('0x45')]['attachments']&&_0x2fe6e8[_0xaca5('0x45')][_0xaca5('0x57')][_0xaca5('0x38')]){for(var _0x363a6c=0x0;_0x363a6c<_0x2fe6e8['body'][_0xaca5('0x57')][_0xaca5('0x38')];_0x363a6c+=0x1){_0x2fe6e8['body']['attachments'][_0x363a6c]={'filename':_0x2fe6e8[_0xaca5('0x45')]['attachments'][_0x363a6c][_0xaca5('0x3e')],'path':path[_0xaca5('0x58')](config[_0xaca5('0x59')],_0xaca5('0x5a'),_0x2fe6e8[_0xaca5('0x45')]['attachments'][_0x363a6c]['basename'])};}}_0x1a8631={'account':_0x196f5b,'message':_0x2fe6e8[_0xaca5('0x45')]};return;})[_0xaca5('0x13')](function(){if(_0x2b5710[_0xaca5('0x4f')]){if(_0x2b5710[_0xaca5('0x4f')][_0xaca5('0x51')][_0xaca5('0x38')]){return _0x2b5710['List'][_0xaca5('0x51')][0x0];}else{return db['CmContact'][_0xaca5('0x48')](_['defaults'](_0x2fe6e8['body'],{'firstName':_0x2fe6e8['body']['to'],'email':_0x2fe6e8[_0xaca5('0x45')]['to'],'phone':_0x2fe6e8['body']['to'],'ListId':_0x2b5710[_0xaca5('0x5b')]}));}}else{throw new Error(_0xaca5('0x5c'));}})[_0xaca5('0x13')](function(){if(_0x1a8631){return respondWithRpcPromise(_0xaca5('0x5d'),_0xaca5('0x5e'),_0x1a8631,client9003)['then'](function(_0x2e5529){return _0x6aca2e[_0xaca5('0x26')]({'read':!![],'messageId':_0x2e5529['messageId'],'sentAt':moment()['format'](_0xaca5('0x5f'))});})[_0xaca5('0x1d')](function(_0x5ed506){logger[_0xaca5('0x18')]('%s',JSON[_0xaca5('0x60')](_0x5ed506));return _0x6aca2e;});}return _0x6aca2e;});}return _0x6aca2e;}})[_0xaca5('0x13')](respondWithResult(_0x1d35e8,0xc9))[_0xaca5('0x1d')](handleError(_0x1d35e8,null));};exports[_0xaca5('0x61')]=function(_0x1386a8,_0x44bc65){var _0x4c46cf={'agent':{},'channel':_0xaca5('0x62')};if(_0x1386a8['body']['id']){delete _0x1386a8[_0xaca5('0x45')]['id'];}_0x1386a8[_0xaca5('0x45')][_0xaca5('0x63')]=!![];_0x1386a8['body'][_0xaca5('0x64')]=moment()[_0xaca5('0x65')](_0xaca5('0x5f'));_0x1386a8[_0xaca5('0x45')]['UserId']=_0x1386a8[_0xaca5('0x45')][_0xaca5('0x66')]||_0x1386a8[_0xaca5('0x67')]['id'];_0x4c46cf[_0xaca5('0x68')]['id']=_0x1386a8[_0xaca5('0x45')]['UserId'];return db[_0xaca5('0x2e')][_0xaca5('0x44')]({'where':{'id':_0x1386a8[_0xaca5('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44bc65,null))['then'](saveUpdates(_0x1386a8[_0xaca5('0x45')],null))[_0xaca5('0x13')](function(_0x553b9e){if(_0x553b9e){_0x4c46cf['message']=_0x553b9e['get']({'plain':!![]});return db[_0xaca5('0x69')][_0xaca5('0x44')]({'where':{'id':_0x553b9e[_0xaca5('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x44bc65,null))['then'](function(_0x2a3ebc){if(_0x2a3ebc){return _0x2a3ebc[_0xaca5('0x26')]({'UserId':_0x1386a8[_0xaca5('0x45')]['UserId'],'read1stAt':_[_0xaca5('0x6b')](_0x2a3ebc[_0xaca5('0x6c')])?moment()[_0xaca5('0x65')](_0xaca5('0x5f')):undefined});}return null;})[_0xaca5('0x13')](function(_0x4bcd20){if(_0x4bcd20){_0x4c46cf[_0xaca5('0x6d')]=_0x4bcd20[_0xaca5('0x6e')]({'plain':!![]});interaction_log[_0xaca5('0x1b')](_0xaca5('0x6f'),_0x1386a8['user']['id'],_0x1386a8[_0xaca5('0x67')][_0xaca5('0x3e')],_0x1386a8[_0xaca5('0x67')][_0xaca5('0x70')],_0x4c46cf['interaction']['id'],_0x1386a8[_0xaca5('0x45')]?JSON[_0xaca5('0x60')](_0x1386a8[_0xaca5('0x45')]):_0xaca5('0x71'));return respondWithRpcPromise(_0xaca5('0x72'),'acceptMessage',_0x4c46cf);}return null;})['then'](function(_0x4b2647){var _0x5aa396=_0xaca5('0x73')+_0x4b2647[_0xaca5('0x1a')][_0xaca5('0x74')];return db[_0xaca5('0x75')][_0xaca5('0x32')](_0x5aa396,{'type':db['Sequelize'][_0xaca5('0x76')][_0xaca5('0x77')],'raw':!![]})[_0xaca5('0x13')](function(_0x21e5bf){return _0x21e5bf;});})[_0xaca5('0x13')](function(_0x25202b){if(_0x25202b){_0x4c46cf['message'][_0xaca5('0x78')]=_0x25202b[0x0];if(!_0x1386a8[_0xaca5('0x45')]['UserId'])return;return db[_0xaca5('0x79')][_0xaca5('0x44')]({'where':{'id':_0x1386a8[_0xaca5('0x45')][_0xaca5('0x66')],'role':'agent'},'attributes':['id',_0xaca5('0x3e'),_0xaca5('0x7a'),_0xaca5('0x7b'),_0xaca5('0x7c')],'raw':!![]});}return null;})[_0xaca5('0x13')](function(_0x36348b){if(!_0x36348b)return null;_0x4c46cf[_0xaca5('0x1a')][_0xaca5('0x68')]=_0x36348b;return _0x4c46cf;})['then'](function(_0x34eba6){if(_0x34eba6){if(_0x1386a8[_0xaca5('0x45')][_0xaca5('0x7d')]){_0x4c46cf[_0xaca5('0x1a')]['interface']=util[_0xaca5('0x65')]('SIP/%s',_0x1386a8[_0xaca5('0x67')][_0xaca5('0x3e')]);_0x4c46cf[_0xaca5('0x1a')]['channel']=_0x4c46cf[_0xaca5('0x7e')];_0x4c46cf[_0xaca5('0x1a')]['motionChannel']=_0x4c46cf[_0xaca5('0x7e')];_0x4c46cf['message'][_0xaca5('0x7f')]=_0xaca5('0x61');_0x4c46cf['message'][_0xaca5('0x45')]=htmlToText['fromString'](_0x4c46cf['message'][_0xaca5('0x45')]);return respondWithRpcPromise(_0xaca5('0x80'),_0xaca5('0x80'),{'event':'acceptmessage','message':_0x4c46cf['message']},client9002)[_0xaca5('0x13')](function(){return _0x4c46cf;});}return _0x4c46cf;}return null;})[_0xaca5('0x13')](respondWithResult(_0x44bc65,null))[_0xaca5('0x1d')](handleError(_0x44bc65,null));};exports[_0xaca5('0x81')]=function(_0x11faee,_0x24d0ee){var _0x21a7d6={'agent':{},'channel':_0xaca5('0x62')};if(_0x11faee[_0xaca5('0x45')]['id']){delete _0x11faee[_0xaca5('0x45')]['id'];}_0x11faee[_0xaca5('0x45')][_0xaca5('0x66')]=_0x11faee[_0xaca5('0x45')][_0xaca5('0x66')]||_0x11faee['user']['id'];_0x21a7d6[_0xaca5('0x68')]['id']=_0x11faee['body']['UserId'];return db['MailMessage'][_0xaca5('0x44')]({'where':{'id':_0x11faee['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24d0ee,null))[_0xaca5('0x13')](function(_0x528b9f){if(_0x528b9f){_0x21a7d6[_0xaca5('0x1a')]=_0x528b9f['get']({'plain':!![]});return db[_0xaca5('0x69')][_0xaca5('0x44')]({'where':{'id':_0x528b9f[_0xaca5('0x6a')]}});}return null;})[_0xaca5('0x13')](handleEntityNotFound(_0x24d0ee,null))[_0xaca5('0x13')](function(_0x50dbda){if(_0x50dbda){_0x21a7d6[_0xaca5('0x6d')]=_0x50dbda['get']({'plain':!![]});interaction_log['info'](_0xaca5('0x82'),_0x11faee[_0xaca5('0x67')]['id'],_0x11faee[_0xaca5('0x67')][_0xaca5('0x3e')],_0x11faee[_0xaca5('0x67')][_0xaca5('0x70')],_0x21a7d6[_0xaca5('0x6d')]['id'],_0x11faee['body']?JSON[_0xaca5('0x60')](_0x11faee[_0xaca5('0x45')]):_0xaca5('0x71'));return respondWithRpcPromise(_0xaca5('0x83'),_0xaca5('0x84'),_0x21a7d6);}return null;})[_0xaca5('0x13')](function(_0x28a93c){var _0x5cde2a=_0xaca5('0x73')+_0x28a93c[_0xaca5('0x1a')]['ContactId'];return db['sequelize'][_0xaca5('0x32')](_0x5cde2a,{'type':db[_0xaca5('0x85')][_0xaca5('0x76')][_0xaca5('0x77')],'raw':!![]})[_0xaca5('0x13')](function(_0x185f99){return _0x185f99;});})[_0xaca5('0x13')](function(_0x33eac5){if(_0x33eac5){_0x21a7d6['message'][_0xaca5('0x78')]=_0x33eac5[0x0];if(!_0x11faee[_0xaca5('0x45')][_0xaca5('0x66')])return;return db['User'][_0xaca5('0x44')]({'where':{'id':_0x11faee[_0xaca5('0x45')][_0xaca5('0x66')],'role':'agent'},'attributes':['id',_0xaca5('0x3e'),_0xaca5('0x7a'),_0xaca5('0x7b'),_0xaca5('0x7c')],'raw':!![]});}return null;})[_0xaca5('0x13')](function(_0x493f72){if(!_0x493f72)return null;_0x21a7d6['message'][_0xaca5('0x68')]=_0x493f72;return _0x21a7d6;})[_0xaca5('0x13')](function(_0x1ab591){if(_0x1ab591){_0x1ab591[_0xaca5('0x1a')][_0xaca5('0x86')]=util['format'](_0xaca5('0x87'),_0x11faee[_0xaca5('0x67')]['name']);_0x1ab591[_0xaca5('0x1a')][_0xaca5('0x7e')]=_0x21a7d6['channel'];_0x1ab591[_0xaca5('0x1a')]['motionChannel']=_0x21a7d6['channel'];_0x1ab591['message']['event']='reject';_0x1ab591[_0xaca5('0x1a')][_0xaca5('0x45')]=htmlToText[_0xaca5('0x88')](_0x21a7d6[_0xaca5('0x1a')][_0xaca5('0x45')]);respondWithRpcPromise(_0xaca5('0x80'),_0xaca5('0x80'),{'event':_0xaca5('0x89'),'message':_0x1ab591[_0xaca5('0x1a')]},client9002);return _0x21a7d6;}return null;})['then'](respondWithResult(_0x24d0ee,null))[_0xaca5('0x1d')](handleError(_0x24d0ee,null));};exports[_0xaca5('0x8a')]=function(_0x333f7f,_0x2ee72e){var _0x2548ac=moment()[_0xaca5('0x8b')]()[_0xaca5('0x8c')]();var _0x253ca6=path['join'](config[_0xaca5('0x59')],_0xaca5('0x8d'),_0xaca5('0x8e'),_0xaca5('0x8f'));var _0x3fd02d=path[_0xaca5('0x58')](config[_0xaca5('0x59')],_0xaca5('0x8d'),_0xaca5('0x8e'),_0xaca5('0x57'));var _0xa6e5d=util[_0xaca5('0x65')](_0xaca5('0x90'),_0x2548ac);return db[_0xaca5('0x2e')][_0xaca5('0x44')]({'where':{'id':_0x333f7f[_0xaca5('0x46')]['id']},'attributes':['id','body',_0xaca5('0x91'),'to','cc',_0xaca5('0x92'),_0xaca5('0x93'),_0xaca5('0x94')],'include':_0x333f7f[_0xaca5('0x32')][_0xaca5('0x57')]?[{'model':db[_0xaca5('0x95')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x2ee72e,null))[_0xaca5('0x13')](function(_0x1a73b3){if(_0x1a73b3){var _0x12cb3f=_0x1a73b3;var _0x3b0ad5={'from':_0x12cb3f[_0xaca5('0x91')],'to':_0x12cb3f['to'],'subject':_0x12cb3f[_0xaca5('0x93')],'html':htmlEntities[_0xaca5('0x96')](_0x12cb3f[_0xaca5('0x45')]),'headers':{'Date':moment(_0x12cb3f['createdAt'])[_0xaca5('0x65')](_0xaca5('0x97'))},'attachments':[]};if(_0x1a73b3['cc']){_0x3b0ad5[_0xaca5('0x98')]['Cc']=_0x1a73b3['cc'];}if(_0x1a73b3[_0xaca5('0x92')]){_0x3b0ad5['headers']['Bcc']=_0x1a73b3[_0xaca5('0x92')];}return new BPromise(function(_0x2613b3,_0x2db960){if(_0x1a73b3[_0xaca5('0x99')]){for(var _0x4ae588=0x0;_0x4ae588<_0x1a73b3[_0xaca5('0x99')]['length'];_0x4ae588++){var _0x142750=_0x1a73b3['Attachments'][_0x4ae588];var _0x4136db=path[_0xaca5('0x58')](_0x3fd02d,_0x142750[_0xaca5('0x9a')]);if(fs[_0xaca5('0x9b')](_0x4136db)){_0x3b0ad5[_0xaca5('0x57')]['push']({'name':_0x142750[_0xaca5('0x3e')],'contentType':_0x142750[_0xaca5('0x2f')],'data':fs[_0xaca5('0x9c')](_0x4136db)});}}}emlformat['build'](_0x3b0ad5,function(_0x26a8c1,_0x40f4e0){if(_0x26a8c1)return _0x2db960(_0x26a8c1);fs[_0xaca5('0x9d')](path['join'](_0x253ca6,_0xa6e5d),_0x40f4e0);return _0x2613b3(_0x40f4e0);});});}})[_0xaca5('0x13')](function(_0x404794){if(_0x404794){return _0x2ee72e['download'](path['join'](_0x253ca6,_0xa6e5d),_0xa6e5d,function(_0x4b4f84){if(!_0x4b4f84)fs['unlinkSync'](path[_0xaca5('0x58')](_0x253ca6,_0xa6e5d));});}})[_0xaca5('0x1d')](handleError(_0x2ee72e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 75fa255..6b2a7ef 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 _0x5224=['../../mysqldb','save','update','remove','emit'];(function(_0x3b7924,_0x294bdc){var _0x428bdb=function(_0x259e8b){while(--_0x259e8b){_0x3b7924['push'](_0x3b7924['shift']());}};_0x428bdb(++_0x294bdc);}(_0x5224,0x16d));var _0x4522=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x5224[_0x3a3758];return _0x1a9234;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x4522('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4522('0x1'),'afterUpdate':_0x4522('0x2'),'afterDestroy':_0x4522('0x3')};function emitEvent(_0x57332d){return function(_0x3a61cd,_0x5c0e18,_0x3562ff){MailMessageEvents[_0x4522('0x4')](_0x57332d+':'+_0x3a61cd['id'],_0x3a61cd);MailMessageEvents[_0x4522('0x4')](_0x57332d,_0x3a61cd);_0x3562ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x3217=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3ed342,_0x3d0b2a){var _0x210137=function(_0x167f47){while(--_0x167f47){_0x3ed342['push'](_0x3ed342['shift']());}};_0x210137(++_0x3d0b2a);}(_0x3217,0x18e));var _0x7321=function(_0x489733,_0xce0400){_0x489733=_0x489733-0x0;var _0x28df33=_0x3217[_0x489733];return _0x28df33;};'use strict';var EventEmitter=require(_0x7321('0x0'));var MailMessage=require(_0x7321('0x1'))['db'][_0x7321('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7321('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7321('0x4'),'afterDestroy':'remove'};function emitEvent(_0x30fb7b){return function(_0x55af57,_0x5e3dc1,_0x182de4){MailMessageEvents[_0x7321('0x5')](_0x30fb7b+':'+_0x55af57['id'],_0x55af57);MailMessageEvents[_0x7321('0x5')](_0x30fb7b,_0x55af57);_0x182de4(null);};}for(var e in events){if(events[_0x7321('0x6')](e)){var event=events[e];MailMessage[_0x7321('0x7')](e,emitEvent(event));}}module[_0x7321('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 963ce82..8ce7791 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 _0x1af3=['MailInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','subject','body','plainBody','models','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne'];(function(_0x1f2686,_0x518aac){var _0x337167=function(_0x478dd4){while(--_0x478dd4){_0x1f2686['push'](_0x1f2686['shift']());}};_0x337167(++_0x518aac);}(_0x1af3,0x1d7));var _0x31af=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x1af3[_0x172ed7];return _0xfa8f61;};'use strict';var _=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var logger=require(_0x31af('0x2'))(_0x31af('0x3'));var moment=require(_0x31af('0x4'));var BPromise=require(_0x31af('0x5'));var rp=require(_0x31af('0x6'));var htmlToText=require(_0x31af('0x7'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x31af('0x8'));var attributes=require(_0x31af('0x9'));module[_0x31af('0xa')]=function(_0x4d37b6,_0x4456b5){return _0x4d37b6[_0x31af('0xb')](_0x31af('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x31af('0xd')]},{'name':'fti_mail_messages','fields':['plainBody',_0x31af('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e2d3a,_0x43786c,_0x15fb6e){if(_0x2e2d3a[_0x31af('0xf')]){_0x2e2d3a[_0x31af('0x10')]=htmlToText['fromString'](_0x2e2d3a[_0x31af('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x15fb6e(null,_0x43786c);},'afterCreate':function(_0x1b193a,_0xc2c1d6,_0xe9792d){var _0x30ff11=_0x4d37b6[_0x31af('0x11')];var _0x20e973=_0x1b193a['get']({'plain':!![]});if(_0x20e973[_0x31af('0x12')]['toLowerCase']()==='in'||_0x20e973[_0x31af('0x12')][_0x31af('0x13')]()===_0x31af('0x14')&&!_0x20e973[_0x31af('0x15')]&&!_[_0x31af('0x16')](_0x20e973['UserId'])){_0x30ff11[_0x31af('0x17')][_0x31af('0x18')]({'where':{'id':_0x20e973[_0x31af('0x19')]}})[_0x31af('0x1a')](function(_0x1c4f18){if(_0x1c4f18){_0x1c4f18['update']({'lastMsgAt':_0x20e973[_0x31af('0x1b')],'lastMsgDirection':_0x20e973[_0x31af('0x12')][_0x31af('0x13')]()});}})[_0x31af('0x1c')](function(_0x1287ec){console['error'](_0x1287ec);});}_0xe9792d();}},'charset':_0x31af('0x1d'),'collate':_0x31af('0x1e')});}; \ No newline at end of file +var _0x4721=['util','api','bluebird','request-promise','html-to-text','./mailMessage.attributes','exports','MailMessage','messageId','plainBody','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash'];(function(_0x52e94f,_0x22e52d){var _0x127d43=function(_0x423f67){while(--_0x423f67){_0x52e94f['push'](_0x52e94f['shift']());}};_0x127d43(++_0x22e52d);}(_0x4721,0xd7));var _0x1472=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x4721[_0x2a2166];return _0x3bcf50;};'use strict';var _=require(_0x1472('0x0'));var util=require(_0x1472('0x1'));var logger=require('../../config/logger')(_0x1472('0x2'));var moment=require('moment');var BPromise=require(_0x1472('0x3'));var rp=require(_0x1472('0x4'));var htmlToText=require(_0x1472('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1472('0x6'));module[_0x1472('0x7')]=function(_0x1c9a23,_0x57e640){return _0x1c9a23['define'](_0x1472('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x1472('0x9'),'fields':[_0x1472('0x9')]},{'name':'fti_mail_messages','fields':[_0x1472('0xa'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3535f6,_0x5671e8,_0x11c426){if(_0x3535f6['body']){_0x3535f6[_0x1472('0xa')]=htmlToText['fromString'](_0x3535f6['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x11c426(null,_0x5671e8);},'afterCreate':function(_0x31f7e6,_0x1967a4,_0x1edf23){var _0x216b99=_0x1c9a23[_0x1472('0xb')];var _0x54981e=_0x31f7e6[_0x1472('0xc')]({'plain':!![]});if(_0x54981e[_0x1472('0xd')]['toLowerCase']()==='in'||_0x54981e['direction'][_0x1472('0xe')]()===_0x1472('0xf')&&!_0x54981e[_0x1472('0x10')]&&!_[_0x1472('0x11')](_0x54981e[_0x1472('0x12')])){_0x216b99[_0x1472('0x13')][_0x1472('0x14')]({'where':{'id':_0x54981e[_0x1472('0x15')]}})['then'](function(_0x4b3e30){if(_0x4b3e30){_0x4b3e30[_0x1472('0x16')]({'lastMsgAt':_0x54981e[_0x1472('0x17')],'lastMsgDirection':_0x54981e[_0x1472('0xd')][_0x1472('0xe')]()});}})[_0x1472('0x18')](function(_0x5388ba){console[_0x1472('0x19')](_0x5388ba);});}_0x1edf23();}},'charset':'utf8mb4','collate':_0x1472('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 57e9a70..d261b95 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 _0x32b6=['raw','CreateMailMessage','stringify','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body','options'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x32b6,0x1d1));var _0x632b=function(_0x36eb1b,_0x4e80cc){_0x36eb1b=_0x36eb1b-0x0;var _0x143f06=_0x32b6[_0x36eb1b];return _0x143f06;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});config[_0x632b('0xb')]=_[_0x632b('0xc')](config[_0x632b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x632b('0xd'))(new Redis(config[_0x632b('0xb')]));require(_0x632b('0xe'))[_0x632b('0xf')](socket);function respondWithRpcPromise(_0x4961b1,_0x5904e8,_0x56e7b6){return new BPromise(function(_0x3ce569,_0x484b3a){return client[_0x632b('0x10')](_0x4961b1,_0x56e7b6)[_0x632b('0x11')](function(_0x2eca51){logger[_0x632b('0x12')](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));logger[_0x632b('0x15')](_0x632b('0x16'),_0x5904e8,_0x632b('0x14'),JSON['stringify'](_0x2eca51));if(_0x2eca51[_0x632b('0x17')]){if(_0x2eca51[_0x632b('0x17')][_0x632b('0x18')]===0x1f4){logger['error'](_0x632b('0x13'),_0x5904e8,_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);return _0x484b3a(_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);}logger[_0x632b('0x17')]('MailMessage,\x20%s,\x20%s',_0x5904e8,_0x2eca51[_0x632b('0x17')]['message']);return _0x3ce569(_0x2eca51['error'][_0x632b('0x19')]);}else{logger['info'](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));_0x3ce569(_0x2eca51[_0x632b('0x1a')]['message']);}})[_0x632b('0x1b')](function(_0x32ca1){logger[_0x632b('0x17')](_0x632b('0x13'),_0x5904e8,_0x32ca1);_0x484b3a(_0x32ca1);});});}exports['CreateMailMessage']=function(_0x472e34){var _0xd9d29f=this;return new Promise(function(_0x4f377f,_0x116f62){return db['MailMessage']['create'](_0x472e34[_0x632b('0x1c')],{'raw':_0x472e34['options']?_0x472e34[_0x632b('0x1d')][_0x632b('0x1e')]===undefined?!![]:![]:!![]})[_0x632b('0x11')](function(_0x540bfb){logger[_0x632b('0x12')](_0x632b('0x1f'),_0x472e34);logger['debug'](_0x632b('0x1f'),_0x472e34,JSON[_0x632b('0x20')](_0x540bfb));_0x4f377f(_0x540bfb);})[_0x632b('0x1b')](function(_0x1e448c){logger[_0x632b('0x17')](_0x632b('0x1f'),_0x1e448c['message'],_0x472e34);_0x116f62(_0xd9d29f['error'](0x1f4,_0x1e448c[_0x632b('0x19')]));});});}; \ No newline at end of file +var _0xb78e=['http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x265c10,_0x306462){var _0x4b3bea=function(_0x244bcc){while(--_0x244bcc){_0x265c10['push'](_0x265c10['shift']());}};_0x4b3bea(++_0x306462);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3ae6d0,_0x308abf){_0x3ae6d0=_0x3ae6d0-0x0;var _0x2fdf82=_0xb78e[_0x3ae6d0];return _0x2fdf82;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});config[_0xeb78('0xc')]=_[_0xeb78('0xd')](config[_0xeb78('0xc')],{'host':_0xeb78('0xe'),'port':0x18eb});var socket=require(_0xeb78('0xf'))(new Redis(config['redis']));require(_0xeb78('0x10'))[_0xeb78('0x11')](socket);function respondWithRpcPromise(_0xa1ca82,_0x46fbad,_0x125e97){return new BPromise(function(_0x402680,_0x15137b){return client[_0xeb78('0x12')](_0xa1ca82,_0x125e97)[_0xeb78('0x13')](function(_0x59d8d8){logger[_0xeb78('0x14')](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));logger[_0xeb78('0x17')](_0xeb78('0x18'),_0x46fbad,_0xeb78('0x16'),JSON[_0xeb78('0x19')](_0x59d8d8));if(_0x59d8d8[_0xeb78('0x1a')]){if(_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1b')]===0x1f4){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x59d8d8[_0xeb78('0x1a')]['message']);return _0x15137b(_0x59d8d8['error']['message']);}logger[_0xeb78('0x1a')]('MailMessage,\x20%s,\x20%s',_0x46fbad,_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1c')]);return _0x402680(_0x59d8d8['error'][_0xeb78('0x1c')]);}else{logger['info'](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));_0x402680(_0x59d8d8['result'][_0xeb78('0x1c')]);}})[_0xeb78('0x1d')](function(_0x1cb338){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x1cb338);_0x15137b(_0x1cb338);});});}exports[_0xeb78('0x1e')]=function(_0x4ab933){var _0x48b106=this;return new Promise(function(_0x455e30,_0x106c5d){return db[_0xeb78('0x1f')][_0xeb78('0x20')](_0x4ab933[_0xeb78('0x21')],{'raw':_0x4ab933[_0xeb78('0x22')]?_0x4ab933[_0xeb78('0x22')][_0xeb78('0x23')]===undefined?!![]:![]:!![]})[_0xeb78('0x13')](function(_0x52b8c1){logger['info']('CreateMailMessage',_0x4ab933);logger['debug'](_0xeb78('0x1e'),_0x4ab933,JSON['stringify'](_0x52b8c1));_0x455e30(_0x52b8c1);})[_0xeb78('0x1d')](function(_0x1fbf2f){logger['error'](_0xeb78('0x1e'),_0x1fbf2f['message'],_0x4ab933);_0x106c5d(_0x48b106[_0xeb78('0x1a')](0x1f4,_0x1fbf2f[_0xeb78('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8ba06b5..6083658 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 _0xd73a=['length','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd73a,0x171));var _0xad73=function(_0x23ad4c,_0x5cdd61){_0x23ad4c=_0x23ad4c-0x0;var _0x50d40d=_0xd73a[_0x23ad4c];return _0x50d40d;};'use strict';var MailMessageEvents=require(_0xad73('0x0'));var events=[_0xad73('0x1'),_0xad73('0x2'),_0xad73('0x3')];function createListener(_0x6da8ec,_0x59c24f){return function(_0x5048f2){_0x59c24f[_0xad73('0x4')](_0x6da8ec,_0x5048f2);};}function removeListener(_0x216563,_0x279d4f){return function(){MailMessageEvents[_0xad73('0x5')](_0x216563,_0x279d4f);};}exports[_0xad73('0x6')]=function(_0x7d2258){for(var _0x247d3c=0x0,_0x2f4736=events[_0xad73('0x7')];_0x247d3c<_0x2f4736;_0x247d3c++){var _0x15cf28=events[_0x247d3c];var _0x1352b3=createListener('mailMessage:'+_0x15cf28,_0x7d2258);MailMessageEvents['on'](_0x15cf28,_0x1352b3);}}; \ No newline at end of file +var _0xa3e6=['length','mailMessage:','./mailMessage.events','remove','removeListener','register'];(function(_0x5ce00e,_0x5be1b1){var _0x2f825b=function(_0xe8ed6){while(--_0xe8ed6){_0x5ce00e['push'](_0x5ce00e['shift']());}};_0x2f825b(++_0x5be1b1);}(_0xa3e6,0x158));var _0x6a3e=function(_0x502fe2,_0x377112){_0x502fe2=_0x502fe2-0x0;var _0x566605=_0xa3e6[_0x502fe2];return _0x566605;};'use strict';var MailMessageEvents=require(_0x6a3e('0x0'));var events=['save',_0x6a3e('0x1'),'update'];function createListener(_0x316e12,_0x740d4a){return function(_0x3892ff){_0x740d4a['emit'](_0x316e12,_0x3892ff);};}function removeListener(_0x2190fc,_0x35a2b6){return function(){MailMessageEvents[_0x6a3e('0x2')](_0x2190fc,_0x35a2b6);};}exports[_0x6a3e('0x3')]=function(_0x1b7d77){for(var _0x9ba644=0x0,_0x8b9c74=events[_0x6a3e('0x4')];_0x9ba644<_0x8b9c74;_0x9ba644++){var _0x4f2397=events[_0x9ba644];var _0x1b4cf1=createListener(_0x6a3e('0x5')+_0x4f2397,_0x1b7d77);MailMessageEvents['on'](_0x4f2397,_0x1b4cf1);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e498445..0ab9aad 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 _0x5323=['addAgents','update','destroy','delete','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x8762db,_0x4c4dc9){var _0x2e874b=function(_0x141d98){while(--_0x141d98){_0x8762db['push'](_0x8762db['shift']());}};_0x2e874b(++_0x4c4dc9);}(_0x5323,0xca));var _0x3532=function(_0x46ff5e,_0x2ee924){_0x46ff5e=_0x46ff5e-0x0;var _0x2906f1=_0x5323[_0x46ff5e];return _0x2906f1;};'use strict';var multer=require('multer');var util=require(_0x3532('0x0'));var path=require(_0x3532('0x1'));var timeout=require(_0x3532('0x2'));var express=require('express');var router=express[_0x3532('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3532('0x4'));var interaction=require(_0x3532('0x5'));var config=require('../../config/environment');var controller=require(_0x3532('0x6'));router['get']('/',auth[_0x3532('0x7')](),controller[_0x3532('0x8')]);router[_0x3532('0x9')](_0x3532('0xa'),auth[_0x3532('0x7')](),controller[_0x3532('0xb')]);router[_0x3532('0x9')]('/:id',auth[_0x3532('0x7')](),controller[_0x3532('0xc')]);router[_0x3532('0x9')](_0x3532('0xd'),auth[_0x3532('0x7')](),controller[_0x3532('0xe')]);router['get'](_0x3532('0xf'),auth[_0x3532('0x7')](),controller[_0x3532('0x10')]);router['get'](_0x3532('0x11'),auth['isAuthenticated'](),controller[_0x3532('0x12')]);router[_0x3532('0x13')]('/',auth[_0x3532('0x7')](),controller[_0x3532('0x14')]);router[_0x3532('0x13')](_0x3532('0xf'),auth[_0x3532('0x7')](),controller[_0x3532('0x15')]);router[_0x3532('0x13')](_0x3532('0x11'),auth['isAuthenticated'](),controller[_0x3532('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3532('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3532('0x18')]);router['delete'](_0x3532('0xf'),auth[_0x3532('0x7')](),controller['removeTeams']);router[_0x3532('0x19')](_0x3532('0x11'),auth[_0x3532('0x7')](),controller[_0x3532('0x1a')]);module[_0x3532('0x1b')]=router; \ No newline at end of file +var _0x447d=['/:id/users','create','post','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams'];(function(_0x5e3cbd,_0x2fd5cd){var _0x1ed1ce=function(_0x4bae94){while(--_0x4bae94){_0x5e3cbd['push'](_0x5e3cbd['shift']());}};_0x1ed1ce(++_0x2fd5cd);}(_0x447d,0x82));var _0xd447=function(_0x2f9eef,_0x26316e){_0x2f9eef=_0x2f9eef-0x0;var _0x55e62a=_0x447d[_0x2f9eef];return _0x55e62a;};'use strict';var multer=require(_0xd447('0x0'));var util=require(_0xd447('0x1'));var path=require(_0xd447('0x2'));var timeout=require(_0xd447('0x3'));var express=require(_0xd447('0x4'));var router=express[_0xd447('0x5')]();var fs_extra=require(_0xd447('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd447('0x7'));var config=require(_0xd447('0x8'));var controller=require(_0xd447('0x9'));router[_0xd447('0xa')]('/',auth[_0xd447('0xb')](),controller[_0xd447('0xc')]);router[_0xd447('0xa')](_0xd447('0xd'),auth[_0xd447('0xb')](),controller[_0xd447('0xe')]);router[_0xd447('0xa')](_0xd447('0xf'),auth[_0xd447('0xb')](),controller[_0xd447('0x10')]);router['get']('/:id/members',auth[_0xd447('0xb')](),controller[_0xd447('0x11')]);router[_0xd447('0xa')](_0xd447('0x12'),auth[_0xd447('0xb')](),controller[_0xd447('0x13')]);router[_0xd447('0xa')](_0xd447('0x14'),auth[_0xd447('0xb')](),controller['getAgents']);router['post']('/',auth[_0xd447('0xb')](),controller[_0xd447('0x15')]);router[_0xd447('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd447('0x17')]);router['post']('/:id/users',auth[_0xd447('0xb')](),controller[_0xd447('0x18')]);router['put'](_0xd447('0xf'),auth[_0xd447('0xb')](),controller['update']);router[_0xd447('0x19')]('/:id',auth[_0xd447('0xb')](),controller[_0xd447('0x1a')]);router[_0xd447('0x19')](_0xd447('0x12'),auth['isAuthenticated'](),controller[_0xd447('0x1b')]);router[_0xd447('0x19')](_0xd447('0x14'),auth[_0xd447('0xb')](),controller[_0xd447('0x1c')]);module[_0xd447('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f1a3c94..a8b406c 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 _0x243f=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x168cf7,_0x5e950e){var _0x52ebcc=function(_0x10b5e5){while(--_0x10b5e5){_0x168cf7['push'](_0x168cf7['shift']());}};_0x52ebcc(++_0x5e950e);}(_0x243f,0x17c));var _0xf243=function(_0x3d5db9,_0x2dbe0a){_0x3d5db9=_0x3d5db9-0x0;var _0x3c114c=_0x243f[_0x3d5db9];return _0x3c114c;};'use strict';var Sequelize=require(_0xf243('0x0'));module[_0xf243('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf243('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf243('0x3')]},'timeout':{'type':Sequelize[_0xf243('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf243('0x5')](_0xf243('0x6'),_0xf243('0x7'),_0xf243('0x8'))}}; \ No newline at end of file +var _0x42c0=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x42c0,0x164));var _0x042c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x42c0[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require('sequelize');module[_0x042c('0x0')]={'name':{'type':Sequelize[_0x042c('0x1')],'unique':_0x042c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x042c('0x1')]},'timeout':{'type':Sequelize[_0x042c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x042c('0x4')](_0x042c('0x5'),_0x042c('0x6'),_0x042c('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 09f6fb8..03dfff8 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 _0xeae5=['getTeams','Team','User','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','emit','removeTeams','ids','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','removeAgents','userMailQueue:remove','addAgents','userMailQueue:save','isArray','getAgents','util','squel','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','MailQueues','error','name','send','index','map','MailQueue','rawAttributes','type','getOptions','where','include','query','catch','show','params','model','keys','intersection','attributes','fields','length','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','filters','pick','MailQueueId','filter','findAll','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','mailPause'];(function(_0x62c612,_0x490248){var _0x2120fa=function(_0x5e754b){while(--_0x5e754b){_0x62c612['push'](_0x62c612['shift']());}};_0x2120fa(++_0x490248);}(_0xeae5,0x1d1));var _0x5eae=function(_0x141d0a,_0x590c81){_0x141d0a=_0x141d0a-0x0;var _0x170d11=_0xeae5[_0x141d0a];return _0x170d11;};'use strict';var BPromise=require('bluebird');var util=require(_0x5eae('0x0'));var _=require('lodash');var squel=require(_0x5eae('0x1'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5eae('0x2'));var config=require('../../config/environment');var db=require(_0x5eae('0x3'))['db'];config[_0x5eae('0x4')]=_[_0x5eae('0x5')](config[_0x5eae('0x4')],{'host':_0x5eae('0x6'),'port':0x18eb});var socket=require(_0x5eae('0x7'))(new Redis(config[_0x5eae('0x4')]));require(_0x5eae('0x8'))['register'](socket);function respondWithStatusCode(_0x50f735,_0x5bbc5f){_0x5bbc5f=_0x5bbc5f||0xcc;return function(_0x20011e){if(_0x20011e){return _0x50f735['sendStatus'](_0x5bbc5f);}return _0x50f735[_0x5eae('0x9')](_0x5bbc5f)[_0x5eae('0xa')]();};}function respondWithResult(_0x2fe9b1,_0x40dd6b){_0x40dd6b=_0x40dd6b||0xc8;return function(_0x20ff9e){if(_0x20ff9e){return _0x2fe9b1[_0x5eae('0x9')](_0x40dd6b)['json'](_0x20ff9e);}};}function respondWithFilteredResult(_0xfc370c,_0x498300){return function(_0x1c8fa6){if(_0x1c8fa6){var _0x5f23f5=typeof _0x498300[_0x5eae('0xb')]===_0x5eae('0xc')&&typeof _0x498300[_0x5eae('0xd')]===_0x5eae('0xc');var _0x389562=_0x1c8fa6[_0x5eae('0xe')];var _0x3b1c1b=_0x5f23f5?0x0:_0x498300[_0x5eae('0xb')];var _0x5621ae=_0x5f23f5?_0x1c8fa6[_0x5eae('0xe')]:_0x498300['offset']+_0x498300['limit'];var _0x4900fa;if(_0x5621ae>=_0x389562){_0x5621ae=_0x389562;_0x4900fa=0xc8;}else{_0x4900fa=0xce;}_0xfc370c['status'](_0x4900fa);return _0xfc370c['set'](_0x5eae('0xf'),_0x3b1c1b+'-'+_0x5621ae+'/'+_0x389562)[_0x5eae('0x10')](_0x1c8fa6);}return null;};}function saveUpdates(_0x2268b6){return function(_0x2173e6){if(_0x2173e6){return _0x2173e6['update'](_0x2268b6)[_0x5eae('0x11')](function(_0x5b7610){return _0x5b7610;});}return null;};}function removeEntity(_0x67a51c){return function(_0x3faac5){if(_0x3faac5){return _0x3faac5[_0x5eae('0x12')]()[_0x5eae('0x11')](function(){var _0xf2fa4f=_0x3faac5[_0x5eae('0x13')]({'plain':!![]});var _0x11fb9c=_0x5eae('0x14');return db['UserProfileResource'][_0x5eae('0x12')]({'where':{'type':_0x11fb9c,'resourceId':_0xf2fa4f['id']}})[_0x5eae('0x11')](function(){return _0x3faac5;});})['then'](function(){_0x67a51c['status'](0xcc)[_0x5eae('0xa')]();});}};}function handleEntityNotFound(_0x134f8b){return function(_0x3a1251){if(!_0x3a1251){_0x134f8b['sendStatus'](0x194);}return _0x3a1251;};}function handleError(_0x283def,_0x1273db){_0x1273db=_0x1273db||0x1f4;return function(_0x454c4d){logger[_0x5eae('0x15')](_0x454c4d['stack']);if(_0x454c4d[_0x5eae('0x16')]){delete _0x454c4d[_0x5eae('0x16')];}_0x283def[_0x5eae('0x9')](_0x1273db)[_0x5eae('0x17')](_0x454c4d);};}exports[_0x5eae('0x18')]=function(_0x36e645,_0x13618e){var _0x6ab17b={};var _0x5cd84c={'count':0x0,'rows':[]};var _0xd12600=_[_0x5eae('0x19')](db[_0x5eae('0x1a')][_0x5eae('0x1b')],function(_0x4a97fd){return{'name':_0x4a97fd['fieldName'],'type':_0x4a97fd[_0x5eae('0x1c')]['key']};});_0x6ab17b=qs[_0x5eae('0x1d')](_0xd12600,_0x36e645);var _0x771058={'where':_0x6ab17b[_0x5eae('0x1e')]};return db[_0x5eae('0x1a')][_0x5eae('0xe')](_0x771058)[_0x5eae('0x11')](function(_0x47a5ea){_0x5cd84c[_0x5eae('0xe')]=_0x47a5ea;_0x6ab17b[_0x5eae('0x1f')]=qs[_0x5eae('0x1f')](_0x36e645[_0x5eae('0x20')]);return db[_0x5eae('0x1a')]['findAll'](_0x6ab17b);})[_0x5eae('0x11')](function(_0x3f9ccb){_0x5cd84c['rows']=_0x3f9ccb;return _0x5cd84c;})['then'](respondWithFilteredResult(_0x13618e,_0x6ab17b))[_0x5eae('0x21')](handleError(_0x13618e,null));};exports[_0x5eae('0x22')]=function(_0x28d0ed,_0x392499){var _0x397942={'raw':!![],'where':{'id':_0x28d0ed[_0x5eae('0x23')]['id']}},_0x4601f1={};_0x4601f1[_0x5eae('0x24')]=_[_0x5eae('0x25')](db[_0x5eae('0x1a')]['rawAttributes']);_0x4601f1[_0x5eae('0x20')]=_[_0x5eae('0x25')](_0x28d0ed[_0x5eae('0x20')]);_0x4601f1['filters']=_[_0x5eae('0x26')](_0x4601f1['model'],_0x4601f1[_0x5eae('0x20')]);_0x397942[_0x5eae('0x27')]=_['intersection'](_0x4601f1[_0x5eae('0x24')],qs[_0x5eae('0x28')](_0x28d0ed['query']['fields']));_0x397942[_0x5eae('0x27')]=_0x397942[_0x5eae('0x27')][_0x5eae('0x29')]?_0x397942[_0x5eae('0x27')]:_0x4601f1[_0x5eae('0x24')];if(_0x28d0ed['query']['includeAll']){_0x397942[_0x5eae('0x1f')]=[{'all':!![]}];}_0x397942=_[_0x5eae('0x2a')]({},_0x397942,_0x28d0ed[_0x5eae('0x2b')]);return db[_0x5eae('0x1a')][_0x5eae('0x2c')](_0x397942)[_0x5eae('0x11')](handleEntityNotFound(_0x392499,null))[_0x5eae('0x11')](respondWithResult(_0x392499,null))[_0x5eae('0x21')](handleError(_0x392499,null));};exports[_0x5eae('0x2d')]=function(_0x1d04d2,_0x5756e1){return db[_0x5eae('0x1a')]['create'](_0x1d04d2['body'],{})[_0x5eae('0x11')](function(_0x3900f5){var _0x35f315=_0x1d04d2[_0x5eae('0x2e')][_0x5eae('0x13')]({'plain':!![]});if(!_0x35f315)throw new Error(_0x5eae('0x2f'));if(_0x35f315[_0x5eae('0x30')]===_0x5eae('0x2e')){var _0x4028b8=_0x3900f5['get']({'plain':!![]});var _0x4cca28='MailQueues';return db[_0x5eae('0x31')][_0x5eae('0x2c')]({'where':{'name':_0x4cca28,'userProfileId':_0x35f315[_0x5eae('0x32')]},'raw':!![]})[_0x5eae('0x11')](function(_0x3f1556){if(_0x3f1556&&_0x3f1556[_0x5eae('0x33')]===0x0){return db[_0x5eae('0x34')][_0x5eae('0x2d')]({'name':_0x4028b8[_0x5eae('0x16')],'resourceId':_0x4028b8['id'],'type':_0x3f1556[_0x5eae('0x16')],'sectionId':_0x3f1556['id']},{})[_0x5eae('0x11')](function(){return _0x3900f5;});}else{return _0x3900f5;}})['catch'](function(_0x36f4e0){logger[_0x5eae('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36f4e0);throw _0x36f4e0;});}return _0x3900f5;})[_0x5eae('0x11')](respondWithResult(_0x5756e1,0xc9))[_0x5eae('0x21')](handleError(_0x5756e1,null));};exports['update']=function(_0x22b0f0,_0x9a111e){if(_0x22b0f0[_0x5eae('0x35')]['id']){delete _0x22b0f0[_0x5eae('0x35')]['id'];}return db[_0x5eae('0x1a')][_0x5eae('0x2c')]({'where':{'id':_0x22b0f0[_0x5eae('0x23')]['id']}})[_0x5eae('0x11')](handleEntityNotFound(_0x9a111e,null))[_0x5eae('0x11')](saveUpdates(_0x22b0f0[_0x5eae('0x35')],null))['then'](respondWithResult(_0x9a111e,null))['catch'](handleError(_0x9a111e,null));};exports[_0x5eae('0x12')]=function(_0x1c8274,_0x1c06ca){return db['MailQueue'][_0x5eae('0x2c')]({'where':{'id':_0x1c8274['params']['id']}})[_0x5eae('0x11')](handleEntityNotFound(_0x1c06ca,null))['then'](removeEntity(_0x1c06ca,null))[_0x5eae('0x21')](handleError(_0x1c06ca,null));};exports['describe']=function(_0x581373,_0xd137fa){return db[_0x5eae('0x1a')][_0x5eae('0x36')]()[_0x5eae('0x11')](respondWithResult(_0xd137fa,null))[_0x5eae('0x21')](handleError(_0xd137fa,null));};exports['getMembers']=function(_0x40669f,_0x3b146b){var _0x3cbe5d={'raw':!![],'where':{}},_0x1bb9e0={},_0x4aa05b;return db[_0x5eae('0x1a')][_0x5eae('0x37')]({'where':{'id':_0x40669f[_0x5eae('0x23')]['id']}})[_0x5eae('0x11')](handleEntityNotFound(_0x3b146b,null))['then'](function(_0x4523ac){if(_0x4523ac){_0x4aa05b=_0x4523ac[_0x5eae('0x13')]({'plain':!![]});_0x1bb9e0[_0x5eae('0x24')]=_[_0x5eae('0x25')](db[_0x5eae('0x38')][_0x5eae('0x1b')]);_0x1bb9e0[_0x5eae('0x20')]=_['keys'](_0x40669f[_0x5eae('0x20')]);_0x1bb9e0['filters']=_[_0x5eae('0x26')](_0x1bb9e0[_0x5eae('0x24')],_0x1bb9e0[_0x5eae('0x20')]);_0x3cbe5d[_0x5eae('0x27')]=_[_0x5eae('0x26')](_0x1bb9e0['model'],qs[_0x5eae('0x28')](_0x40669f[_0x5eae('0x20')][_0x5eae('0x28')]));_0x3cbe5d['attributes']=_0x3cbe5d['attributes'][_0x5eae('0x29')]?_0x3cbe5d[_0x5eae('0x27')]:_0x1bb9e0['model'];if(!_0x40669f[_0x5eae('0x20')][_0x5eae('0x39')](_0x5eae('0x3a'))){_0x3cbe5d[_0x5eae('0xd')]=qs[_0x5eae('0xd')](_0x40669f[_0x5eae('0x20')][_0x5eae('0xd')]);_0x3cbe5d[_0x5eae('0xb')]=qs['offset'](_0x40669f[_0x5eae('0x20')][_0x5eae('0xb')]);}_0x3cbe5d[_0x5eae('0x3b')]=qs[_0x5eae('0x3c')](_0x40669f[_0x5eae('0x20')][_0x5eae('0x3c')]);_0x3cbe5d[_0x5eae('0x1e')]=qs[_0x5eae('0x3d')](_[_0x5eae('0x3e')](_0x40669f['query'],_0x1bb9e0[_0x5eae('0x3d')]));_0x3cbe5d['where'][_0x5eae('0x3f')]=_0x4523ac['id'];if(_0x40669f[_0x5eae('0x20')]['filter']){_0x3cbe5d[_0x5eae('0x1e')]=_[_0x5eae('0x2a')](_0x3cbe5d[_0x5eae('0x1e')],{'$or':_['map'](_0x3cbe5d[_0x5eae('0x27')],function(_0x4a33d7){var _0x1ee558={};_0x1ee558[_0x4a33d7]={'$like':'%'+_0x40669f['query'][_0x5eae('0x40')]+'%'};return _0x1ee558;})});}_0x3cbe5d=_[_0x5eae('0x2a')]({},_0x3cbe5d,_0x40669f['options']);return db['UserMailQueue'][_0x5eae('0x41')](_0x3cbe5d);}})[_0x5eae('0x11')](function(_0x210e88){if(_0x210e88){return db['User'][_0x5eae('0x42')]({'where':{'id':_[_0x5eae('0x19')](_0x210e88,_0x5eae('0x43')),'role':'agent'},'attributes':['id',_0x5eae('0x16'),'mailPause',_0x5eae('0x44'),_0x5eae('0x45')]});}})['then'](function(_0x28173c){if(_0x28173c){return{'count':_0x28173c[_0x5eae('0xe')],'rows':_[_0x5eae('0x19')](_0x28173c[_0x5eae('0x46')],function(_0x53f35d){return{'membername':_0x53f35d[_0x5eae('0x16')],'UserId':_0x53f35d['id'],'queue_name':_0x4aa05b[_0x5eae('0x16')],'MailQueueId':_0x4aa05b['id'],'interface':util[_0x5eae('0x47')](_0x5eae('0x48'),_0x5eae('0x49'),_0x53f35d[_0x5eae('0x16')]),'penalty':0x0,'paused':_0x53f35d[_0x5eae('0x4a')],'createdAt':_0x53f35d['createdAt'],'updatedAt':_0x53f35d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3b146b,_0x3cbe5d))[_0x5eae('0x21')](handleError(_0x3b146b,null));};exports[_0x5eae('0x4b')]=function(_0x25396d,_0x18a09d){var _0x1de7f0={};var _0x307db8={};var _0x1bb7cb;var _0x36b4ff;return db[_0x5eae('0x1a')][_0x5eae('0x37')]({'where':{'id':_0x25396d['params']['id']}})[_0x5eae('0x11')](handleEntityNotFound(_0x18a09d,null))[_0x5eae('0x11')](function(_0x242cdd){if(_0x242cdd){_0x1bb7cb=_0x242cdd;_0x307db8[_0x5eae('0x24')]=_[_0x5eae('0x25')](db[_0x5eae('0x4c')][_0x5eae('0x1b')]);_0x307db8[_0x5eae('0x20')]=_[_0x5eae('0x25')](_0x25396d[_0x5eae('0x20')]);_0x307db8['filters']=_[_0x5eae('0x26')](_0x307db8[_0x5eae('0x24')],_0x307db8[_0x5eae('0x20')]);_0x1de7f0[_0x5eae('0x27')]=_[_0x5eae('0x26')](_0x307db8[_0x5eae('0x24')],qs[_0x5eae('0x28')](_0x25396d[_0x5eae('0x20')][_0x5eae('0x28')]));_0x1de7f0[_0x5eae('0x27')]=_0x1de7f0[_0x5eae('0x27')][_0x5eae('0x29')]?_0x1de7f0[_0x5eae('0x27')]:_0x307db8[_0x5eae('0x24')];_0x1de7f0[_0x5eae('0x3b')]=qs['sort'](_0x25396d[_0x5eae('0x20')][_0x5eae('0x3c')]);_0x1de7f0['where']=qs[_0x5eae('0x3d')](_[_0x5eae('0x3e')](_0x25396d[_0x5eae('0x20')],_0x307db8[_0x5eae('0x3d')]));if(_0x25396d[_0x5eae('0x20')][_0x5eae('0x40')]){_0x1de7f0[_0x5eae('0x1e')]=_[_0x5eae('0x2a')](_0x1de7f0[_0x5eae('0x1e')],{'$or':_[_0x5eae('0x19')](_0x1de7f0['attributes'],function(_0x5e4c65){var _0x3b5626={};_0x3b5626[_0x5e4c65]={'$like':'%'+_0x25396d[_0x5eae('0x20')][_0x5eae('0x40')]+'%'};return _0x3b5626;})});}_0x1de7f0=_['merge']({},_0x1de7f0,_0x25396d[_0x5eae('0x2b')]);return _0x1bb7cb[_0x5eae('0x4b')](_0x1de7f0);}})['then'](function(_0x3a929d){if(_0x3a929d){_0x36b4ff=_0x3a929d['length'];if(!_0x25396d['query'][_0x5eae('0x39')](_0x5eae('0x3a'))){_0x1de7f0['limit']=qs[_0x5eae('0xd')](_0x25396d['query']['limit']);_0x1de7f0[_0x5eae('0xb')]=qs[_0x5eae('0xb')](_0x25396d[_0x5eae('0x20')]['offset']);}return _0x1bb7cb[_0x5eae('0x4b')](_0x1de7f0);}})[_0x5eae('0x11')](function(_0x572218){if(_0x572218){return _0x572218?{'count':_0x36b4ff,'rows':_0x572218}:null;}})[_0x5eae('0x11')](respondWithResult(_0x18a09d,null))[_0x5eae('0x21')](handleError(_0x18a09d,null));};exports['addTeams']=function(_0x4f078c,_0x437d26){var _0xe8fc73=_0x4f078c[_0x5eae('0x35')]['ids'];return db['Team']['findAll']({'where':{'id':_0xe8fc73},'attributes':['id'],'include':[{'model':db[_0x5eae('0x4d')],'as':_0x5eae('0x4e'),'attributes':['id',_0x5eae('0x16'),_0x5eae('0x4f'),_0x5eae('0x50'),'interface'],'raw':!![]}]})[_0x5eae('0x11')](function(_0x1ad09e){if(_0x1ad09e){var _0x29d1c0=_[_0x5eae('0x51')](_0x1ad09e,function(_0x57e2d6){var _0x5bcac5=_0x57e2d6[_0x5eae('0x13')]({'plain':!![]});return _0x5bcac5[_0x5eae('0x4e')];});return db['MailQueue'][_0x5eae('0x2c')]({'where':{'id':_0x4f078c['params']['id']}})['then'](function(_0xd2f64d){return db[_0x5eae('0x52')][_0x5eae('0x53')](function(_0x1579aa){return _0xd2f64d['addTeams'](_0xe8fc73,{'transaction':_0x1579aa})[_0x5eae('0x11')](function(){return BPromise['each'](_0x29d1c0,function(_0xcf1a19){return db[_0x5eae('0x38')][_0x5eae('0x54')]({'where':{'UserId':_0xcf1a19['id'],'MailQueueId':_0x4f078c[_0x5eae('0x23')]['id']},'transaction':_0x1579aa});});})['then'](function(){_0x29d1c0['forEach'](function(_0x31187d){socket[_0x5eae('0x55')]('userMailQueue:save',{'UserId':_0x31187d['id'],'MailQueueId':_0xd2f64d['id']});});});});});}})['then'](respondWithStatusCode(_0x437d26,null))[_0x5eae('0x21')](handleError(_0x437d26,null));};exports[_0x5eae('0x56')]=function(_0x29c644,_0x48e209){return db[_0x5eae('0x4c')][_0x5eae('0x41')]({'where':{'id':_0x29c644[_0x5eae('0x20')][_0x5eae('0x57')]},'attributes':['id'],'include':[{'model':db[_0x5eae('0x4d')],'as':_0x5eae('0x4e'),'attributes':['id'],'raw':!![]}]})[_0x5eae('0x11')](handleEntityNotFound(_0x48e209,null))['then'](function(_0xceffe5){var _0x1ebe4f=_[_0x5eae('0x19')](_0xceffe5,'id');var _0x3851ae=[];var _0x20a0e5=[];var _0xdb9b3d=squel[_0x5eae('0x58')]();_0xdb9b3d[_0x5eae('0x59')]('tq.TeamId')['from'](_0x5eae('0x5a'),'tq')[_0x5eae('0x5b')](_0x5eae('0x5c'),'ut',_0x5eae('0x5d'))[_0x5eae('0x1e')]('MailQueueId\x20=\x20?',_0x29c644['params']['id']);for(var _0x4bb80a=0x0;_0x4bb80a<_0xceffe5[_0x5eae('0x29')];_0x4bb80a+=0x1){let _0x5bcc91=_0xceffe5[_0x4bb80a];for(var _0x51326b=0x0;_0x51326b<_0x5bcc91[_0x5eae('0x4e')][_0x5eae('0x29')];_0x51326b+=0x1){let _0x57b7ea=_0x5bcc91[_0x5eae('0x4e')][_0x51326b];var _0x27263f=_0xdb9b3d[_0x5eae('0x5e')]();_0x27263f[_0x5eae('0x1e')](_0x5eae('0x5f'),_0x57b7ea['id']);_0x20a0e5[_0x5eae('0x60')](db[_0x5eae('0x52')][_0x5eae('0x20')](_0x27263f[_0x5eae('0x61')](),{'type':db[_0x5eae('0x52')][_0x5eae('0x62')]['SELECT']})[_0x5eae('0x11')](function(_0x373cc4){if(_0x373cc4[_0x5eae('0x29')]===0x1){return _0x57b7ea['id'];}else{var _0x5419a6=_[_0x5eae('0x63')](_[_0x5eae('0x19')](_0x373cc4,_0x5eae('0x64')),function(_0x457149){return _[_0x5eae('0x65')](_0x1ebe4f,_0x457149);});if(_0x5419a6){return _0x57b7ea['id'];}}}));}}return BPromise['all'](_0x20a0e5)[_0x5eae('0x11')](function(_0x356f4f){_0x3851ae=_(_0x3851ae)['union'](_0x356f4f)['compact']()['value']();return db[_0x5eae('0x1a')][_0x5eae('0x2c')]({'where':{'id':_0x29c644['params']['id']}})['then'](function(_0x281580){return db[_0x5eae('0x52')]['transaction'](function(_0x37a9d7){return _0x281580[_0x5eae('0x56')](_0x29c644['query'][_0x5eae('0x57')],{'transaction':_0x37a9d7})['then'](function(){if(!_['isEmpty'](_0x3851ae)){return _0x281580[_0x5eae('0x66')](_0x3851ae,{'transaction':_0x37a9d7});}})[_0x5eae('0x11')](function(){_0x3851ae['forEach'](function(_0x2b82bd){socket[_0x5eae('0x55')](_0x5eae('0x67'),{'UserId':_0x2b82bd,'MailQueueId':_0x281580['id']});});});});});});})[_0x5eae('0x11')](respondWithStatusCode(_0x48e209,null))[_0x5eae('0x21')](handleError(_0x48e209,null));};exports[_0x5eae('0x68')]=function(_0x4490fd,_0x22ef3a){return db[_0x5eae('0x1a')]['find']({'where':{'id':_0x4490fd['params']['id']}})[_0x5eae('0x11')](handleEntityNotFound(_0x22ef3a,null))[_0x5eae('0x11')](function(_0x496bc6){if(_0x496bc6){return _0x496bc6[_0x5eae('0x68')](_0x4490fd['body']['ids'],_['omit'](_0x4490fd[_0x5eae('0x35')],['ids','id'])||{})['spread'](function(_0x3b896d){for(var _0x365e80=0x0;_0x365e80<_0x4490fd[_0x5eae('0x35')][_0x5eae('0x57')]['length'];_0x365e80+=0x1){socket[_0x5eae('0x55')](_0x5eae('0x69'),{'UserId':Number(_0x4490fd['body'][_0x5eae('0x57')][_0x365e80]),'MailQueueId':Number(_0x4490fd[_0x5eae('0x23')]['id'])});}return _0x3b896d;});}})[_0x5eae('0x11')](respondWithResult(_0x22ef3a,null))[_0x5eae('0x21')](handleError(_0x22ef3a,null));};exports[_0x5eae('0x66')]=function(_0x468266,_0x3afa63){return db[_0x5eae('0x1a')]['find']({'where':{'id':_0x468266[_0x5eae('0x23')]['id']}})[_0x5eae('0x11')](handleEntityNotFound(_0x3afa63,null))[_0x5eae('0x11')](function(_0xf24c85){if(_0xf24c85){return _0xf24c85[_0x5eae('0x66')](_0x468266[_0x5eae('0x20')][_0x5eae('0x57')])[_0x5eae('0x11')](function(){if(_[_0x5eae('0x6a')](_0x468266[_0x5eae('0x20')][_0x5eae('0x57')])){for(var _0x5e98e7=0x0;_0x5e98e7<_0x468266['query'][_0x5eae('0x57')][_0x5eae('0x29')];_0x5e98e7+=0x1){socket[_0x5eae('0x55')]('userMailQueue:remove',{'UserId':Number(_0x468266[_0x5eae('0x20')][_0x5eae('0x57')][_0x5e98e7]),'MailQueueId':Number(_0x468266['params']['id'])});}}else{socket[_0x5eae('0x55')](_0x5eae('0x67'),{'UserId':Number(_0x468266[_0x5eae('0x20')][_0x5eae('0x57')]),'MailQueueId':Number(_0x468266[_0x5eae('0x23')]['id'])});}});}})[_0x5eae('0x11')](respondWithStatusCode(_0x3afa63,null))['catch'](handleError(_0x3afa63,null));};exports[_0x5eae('0x6b')]=function(_0x38c16c,_0x5cb7a4){var _0xfa9da3={};var _0x519f2b={};var _0xca6c9d;var _0x5f1742;return db[_0x5eae('0x1a')][_0x5eae('0x37')]({'where':{'id':_0x38c16c[_0x5eae('0x23')]['id']}})[_0x5eae('0x11')](handleEntityNotFound(_0x5cb7a4,null))[_0x5eae('0x11')](function(_0x381894){if(_0x381894){_0xca6c9d=_0x381894;_0x519f2b[_0x5eae('0x24')]=_['keys'](db[_0x5eae('0x4d')]['rawAttributes']);_0x519f2b[_0x5eae('0x20')]=_[_0x5eae('0x25')](_0x38c16c[_0x5eae('0x20')]);_0x519f2b[_0x5eae('0x3d')]=_[_0x5eae('0x26')](_0x519f2b['model'],_0x519f2b[_0x5eae('0x20')]);_0xfa9da3[_0x5eae('0x27')]=_[_0x5eae('0x26')](_0x519f2b[_0x5eae('0x24')],qs['fields'](_0x38c16c[_0x5eae('0x20')][_0x5eae('0x28')]));_0xfa9da3[_0x5eae('0x27')]=_0xfa9da3[_0x5eae('0x27')][_0x5eae('0x29')]?_0xfa9da3[_0x5eae('0x27')]:_0x519f2b['model'];_0xfa9da3[_0x5eae('0x3b')]=qs[_0x5eae('0x3c')](_0x38c16c['query']['sort']);_0xfa9da3[_0x5eae('0x1e')]=qs[_0x5eae('0x3d')](_[_0x5eae('0x3e')](_0x38c16c[_0x5eae('0x20')],_0x519f2b['filters']));if(_0x38c16c[_0x5eae('0x20')][_0x5eae('0x40')]){_0xfa9da3['where']=_[_0x5eae('0x2a')](_0xfa9da3[_0x5eae('0x1e')],{'$or':_[_0x5eae('0x19')](_0xfa9da3[_0x5eae('0x27')],function(_0x3ae726){var _0xb9d682={};_0xb9d682[_0x3ae726]={'$like':'%'+_0x38c16c[_0x5eae('0x20')][_0x5eae('0x40')]+'%'};return _0xb9d682;})});}_0xfa9da3=_[_0x5eae('0x2a')]({},_0xfa9da3,_0x38c16c[_0x5eae('0x2b')]);return _0xca6c9d[_0x5eae('0x6b')](_0xfa9da3);}})[_0x5eae('0x11')](function(_0x23d324){if(_0x23d324){_0x5f1742=_0x23d324[_0x5eae('0x29')];if(!_0x38c16c[_0x5eae('0x20')][_0x5eae('0x39')]('nolimit')){_0xfa9da3['limit']=qs['limit'](_0x38c16c[_0x5eae('0x20')]['limit']);_0xfa9da3[_0x5eae('0xb')]=qs[_0x5eae('0xb')](_0x38c16c['query'][_0x5eae('0xb')]);}return _0xca6c9d[_0x5eae('0x6b')](_0xfa9da3);}})[_0x5eae('0x11')](function(_0x1a415f){if(_0x1a415f){return _0x1a415f?{'count':_0x5f1742,'rows':_0x1a415f}:null;}})['then'](respondWithResult(_0x5cb7a4,null))['catch'](handleError(_0x5cb7a4,null));}; \ No newline at end of file +var _0x3fa4=['from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','removeAgents','addAgents','omit','spread','userMailQueue:remove','getAgents','order','util','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','MailQueues','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','type','key','MailQueue','include','show','params','model','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','findOne','UserMailQueue','nolimit','sort','pick','filter','where','findAll','User','UserId','mailPause','createdAt','rows','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','Agents','voicePause','interface','transaction','findOrCreate','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId'];(function(_0x8ea622,_0x8a4da8){var _0x44521e=function(_0x20d562){while(--_0x20d562){_0x8ea622['push'](_0x8ea622['shift']());}};_0x44521e(++_0x8a4da8);}(_0x3fa4,0xfc));var _0x43fa=function(_0x1afa65,_0x7da79e){_0x1afa65=_0x1afa65-0x0;var _0x44b359=_0x3fa4[_0x1afa65];return _0x44b359;};'use strict';var BPromise=require('bluebird');var util=require(_0x43fa('0x0'));var _=require('lodash');var squel=require(_0x43fa('0x1'));var Redis=require(_0x43fa('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x43fa('0x3'));var config=require(_0x43fa('0x4'));var db=require(_0x43fa('0x5'))['db'];config[_0x43fa('0x6')]=_[_0x43fa('0x7')](config[_0x43fa('0x6')],{'host':_0x43fa('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43fa('0x6')]));require(_0x43fa('0x9'))[_0x43fa('0xa')](socket);function respondWithStatusCode(_0x29441a,_0x67ae9){_0x67ae9=_0x67ae9||0xcc;return function(_0x990260){if(_0x990260){return _0x29441a[_0x43fa('0xb')](_0x67ae9);}return _0x29441a[_0x43fa('0xc')](_0x67ae9)[_0x43fa('0xd')]();};}function respondWithResult(_0x163c77,_0x2f8a58){_0x2f8a58=_0x2f8a58||0xc8;return function(_0x553b82){if(_0x553b82){return _0x163c77[_0x43fa('0xc')](_0x2f8a58)[_0x43fa('0xe')](_0x553b82);}};}function respondWithFilteredResult(_0x13178d,_0x5b97a7){return function(_0x3cfe1f){if(_0x3cfe1f){var _0x59d0fb=typeof _0x5b97a7[_0x43fa('0xf')]===_0x43fa('0x10')&&typeof _0x5b97a7[_0x43fa('0x11')]===_0x43fa('0x10');var _0x352a55=_0x3cfe1f[_0x43fa('0x12')];var _0x169b16=_0x59d0fb?0x0:_0x5b97a7['offset'];var _0x54eb85=_0x59d0fb?_0x3cfe1f[_0x43fa('0x12')]:_0x5b97a7[_0x43fa('0xf')]+_0x5b97a7[_0x43fa('0x11')];var _0x360629;if(_0x54eb85>=_0x352a55){_0x54eb85=_0x352a55;_0x360629=0xc8;}else{_0x360629=0xce;}_0x13178d[_0x43fa('0xc')](_0x360629);return _0x13178d['set'](_0x43fa('0x13'),_0x169b16+'-'+_0x54eb85+'/'+_0x352a55)[_0x43fa('0xe')](_0x3cfe1f);}return null;};}function saveUpdates(_0x44e940){return function(_0x15391a){if(_0x15391a){return _0x15391a['update'](_0x44e940)[_0x43fa('0x14')](function(_0x507f7c){return _0x507f7c;});}return null;};}function removeEntity(_0x5cd620){return function(_0x1c07a3){if(_0x1c07a3){return _0x1c07a3['destroy']()[_0x43fa('0x14')](function(){var _0x5b62df=_0x1c07a3['get']({'plain':!![]});var _0x59a4a3=_0x43fa('0x15');return db[_0x43fa('0x16')][_0x43fa('0x17')]({'where':{'type':_0x59a4a3,'resourceId':_0x5b62df['id']}})[_0x43fa('0x14')](function(){return _0x1c07a3;});})[_0x43fa('0x14')](function(){_0x5cd620['status'](0xcc)[_0x43fa('0xd')]();});}};}function handleEntityNotFound(_0x1ac855){return function(_0x4ea649){if(!_0x4ea649){_0x1ac855[_0x43fa('0xb')](0x194);}return _0x4ea649;};}function handleError(_0x2497c4,_0x515999){_0x515999=_0x515999||0x1f4;return function(_0x2360be){logger[_0x43fa('0x18')](_0x2360be[_0x43fa('0x19')]);if(_0x2360be['name']){delete _0x2360be[_0x43fa('0x1a')];}_0x2497c4[_0x43fa('0xc')](_0x515999)['send'](_0x2360be);};}exports[_0x43fa('0x1b')]=function(_0x279314,_0x121e45){var _0xc84829={};var _0x36a774={'count':0x0,'rows':[]};var _0x9ef873=_[_0x43fa('0x1c')](db['MailQueue'][_0x43fa('0x1d')],function(_0x25192a){return{'name':_0x25192a['fieldName'],'type':_0x25192a[_0x43fa('0x1e')][_0x43fa('0x1f')]};});_0xc84829=qs['getOptions'](_0x9ef873,_0x279314);var _0x49324a={'where':_0xc84829['where']};return db[_0x43fa('0x20')][_0x43fa('0x12')](_0x49324a)['then'](function(_0x187b15){_0x36a774['count']=_0x187b15;_0xc84829[_0x43fa('0x21')]=qs[_0x43fa('0x21')](_0x279314['query']);return db['MailQueue']['findAll'](_0xc84829);})[_0x43fa('0x14')](function(_0x1ca9d3){_0x36a774['rows']=_0x1ca9d3;return _0x36a774;})['then'](respondWithFilteredResult(_0x121e45,_0xc84829))['catch'](handleError(_0x121e45,null));};exports[_0x43fa('0x22')]=function(_0x498b02,_0x39ba78){var _0x3292a1={'raw':!![],'where':{'id':_0x498b02[_0x43fa('0x23')]['id']}},_0x54c694={};_0x54c694[_0x43fa('0x24')]=_['keys'](db[_0x43fa('0x20')][_0x43fa('0x1d')]);_0x54c694[_0x43fa('0x25')]=_[_0x43fa('0x26')](_0x498b02['query']);_0x54c694[_0x43fa('0x27')]=_[_0x43fa('0x28')](_0x54c694[_0x43fa('0x24')],_0x54c694[_0x43fa('0x25')]);_0x3292a1[_0x43fa('0x29')]=_[_0x43fa('0x28')](_0x54c694[_0x43fa('0x24')],qs[_0x43fa('0x2a')](_0x498b02[_0x43fa('0x25')][_0x43fa('0x2a')]));_0x3292a1[_0x43fa('0x29')]=_0x3292a1[_0x43fa('0x29')][_0x43fa('0x2b')]?_0x3292a1['attributes']:_0x54c694[_0x43fa('0x24')];if(_0x498b02['query'][_0x43fa('0x2c')]){_0x3292a1[_0x43fa('0x21')]=[{'all':!![]}];}_0x3292a1=_[_0x43fa('0x2d')]({},_0x3292a1,_0x498b02[_0x43fa('0x2e')]);return db['MailQueue'][_0x43fa('0x2f')](_0x3292a1)[_0x43fa('0x14')](handleEntityNotFound(_0x39ba78,null))[_0x43fa('0x14')](respondWithResult(_0x39ba78,null))['catch'](handleError(_0x39ba78,null));};exports[_0x43fa('0x30')]=function(_0xa58fa9,_0x5576b8){return db[_0x43fa('0x20')]['create'](_0xa58fa9[_0x43fa('0x31')],{})[_0x43fa('0x14')](function(_0x4dd32b){var _0x454e6f=_0xa58fa9[_0x43fa('0x32')][_0x43fa('0x33')]({'plain':!![]});if(!_0x454e6f)throw new Error(_0x43fa('0x34'));if(_0x454e6f[_0x43fa('0x35')]===_0x43fa('0x32')){var _0x4f61b5=_0x4dd32b[_0x43fa('0x33')]({'plain':!![]});var _0x49e997='MailQueues';return db[_0x43fa('0x36')][_0x43fa('0x2f')]({'where':{'name':_0x49e997,'userProfileId':_0x454e6f[_0x43fa('0x37')]},'raw':!![]})[_0x43fa('0x14')](function(_0x1d5e2a){if(_0x1d5e2a&&_0x1d5e2a[_0x43fa('0x38')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f61b5[_0x43fa('0x1a')],'resourceId':_0x4f61b5['id'],'type':_0x1d5e2a[_0x43fa('0x1a')],'sectionId':_0x1d5e2a['id']},{})[_0x43fa('0x14')](function(){return _0x4dd32b;});}else{return _0x4dd32b;}})[_0x43fa('0x39')](function(_0x9d6e89){logger[_0x43fa('0x18')](_0x43fa('0x3a'),_0x9d6e89);throw _0x9d6e89;});}return _0x4dd32b;})[_0x43fa('0x14')](respondWithResult(_0x5576b8,0xc9))['catch'](handleError(_0x5576b8,null));};exports[_0x43fa('0x3b')]=function(_0x4bf986,_0x409d1d){if(_0x4bf986[_0x43fa('0x31')]['id']){delete _0x4bf986[_0x43fa('0x31')]['id'];}return db[_0x43fa('0x20')]['find']({'where':{'id':_0x4bf986['params']['id']}})[_0x43fa('0x14')](handleEntityNotFound(_0x409d1d,null))[_0x43fa('0x14')](saveUpdates(_0x4bf986[_0x43fa('0x31')],null))[_0x43fa('0x14')](respondWithResult(_0x409d1d,null))[_0x43fa('0x39')](handleError(_0x409d1d,null));};exports['destroy']=function(_0x4ea28f,_0x1f9e72){return db['MailQueue'][_0x43fa('0x2f')]({'where':{'id':_0x4ea28f[_0x43fa('0x23')]['id']}})[_0x43fa('0x14')](handleEntityNotFound(_0x1f9e72,null))[_0x43fa('0x14')](removeEntity(_0x1f9e72,null))[_0x43fa('0x39')](handleError(_0x1f9e72,null));};exports['describe']=function(_0x1cacb8,_0x37cc49){return db['MailQueue']['describe']()[_0x43fa('0x14')](respondWithResult(_0x37cc49,null))[_0x43fa('0x39')](handleError(_0x37cc49,null));};exports[_0x43fa('0x3c')]=function(_0x1cb5eb,_0xe8c402){var _0x6a739c={'raw':!![],'where':{}},_0x55c7f7={},_0x18b535;return db[_0x43fa('0x20')][_0x43fa('0x3d')]({'where':{'id':_0x1cb5eb[_0x43fa('0x23')]['id']}})['then'](handleEntityNotFound(_0xe8c402,null))[_0x43fa('0x14')](function(_0x4e7cb7){if(_0x4e7cb7){_0x18b535=_0x4e7cb7[_0x43fa('0x33')]({'plain':!![]});_0x55c7f7['model']=_[_0x43fa('0x26')](db[_0x43fa('0x3e')]['rawAttributes']);_0x55c7f7[_0x43fa('0x25')]=_['keys'](_0x1cb5eb[_0x43fa('0x25')]);_0x55c7f7[_0x43fa('0x27')]=_[_0x43fa('0x28')](_0x55c7f7['model'],_0x55c7f7[_0x43fa('0x25')]);_0x6a739c[_0x43fa('0x29')]=_[_0x43fa('0x28')](_0x55c7f7[_0x43fa('0x24')],qs[_0x43fa('0x2a')](_0x1cb5eb[_0x43fa('0x25')][_0x43fa('0x2a')]));_0x6a739c['attributes']=_0x6a739c['attributes'][_0x43fa('0x2b')]?_0x6a739c['attributes']:_0x55c7f7[_0x43fa('0x24')];if(!_0x1cb5eb[_0x43fa('0x25')]['hasOwnProperty'](_0x43fa('0x3f'))){_0x6a739c[_0x43fa('0x11')]=qs['limit'](_0x1cb5eb[_0x43fa('0x25')][_0x43fa('0x11')]);_0x6a739c[_0x43fa('0xf')]=qs[_0x43fa('0xf')](_0x1cb5eb[_0x43fa('0x25')][_0x43fa('0xf')]);}_0x6a739c['order']=qs[_0x43fa('0x40')](_0x1cb5eb['query']['sort']);_0x6a739c['where']=qs['filters'](_[_0x43fa('0x41')](_0x1cb5eb[_0x43fa('0x25')],_0x55c7f7[_0x43fa('0x27')]));_0x6a739c['where']['MailQueueId']=_0x4e7cb7['id'];if(_0x1cb5eb['query'][_0x43fa('0x42')]){_0x6a739c[_0x43fa('0x43')]=_[_0x43fa('0x2d')](_0x6a739c['where'],{'$or':_[_0x43fa('0x1c')](_0x6a739c['attributes'],function(_0x26ecc7){var _0x5caf58={};_0x5caf58[_0x26ecc7]={'$like':'%'+_0x1cb5eb[_0x43fa('0x25')][_0x43fa('0x42')]+'%'};return _0x5caf58;})});}_0x6a739c=_[_0x43fa('0x2d')]({},_0x6a739c,_0x1cb5eb[_0x43fa('0x2e')]);return db[_0x43fa('0x3e')][_0x43fa('0x44')](_0x6a739c);}})[_0x43fa('0x14')](function(_0x27a2da){if(_0x27a2da){return db[_0x43fa('0x45')]['findAndCountAll']({'where':{'id':_[_0x43fa('0x1c')](_0x27a2da,_0x43fa('0x46')),'role':'agent'},'attributes':['id',_0x43fa('0x1a'),_0x43fa('0x47'),'updatedAt',_0x43fa('0x48')]});}})[_0x43fa('0x14')](function(_0x37f1a0){if(_0x37f1a0){return{'count':_0x37f1a0[_0x43fa('0x12')],'rows':_['map'](_0x37f1a0[_0x43fa('0x49')],function(_0x13030d){return{'membername':_0x13030d[_0x43fa('0x1a')],'UserId':_0x13030d['id'],'queue_name':_0x18b535[_0x43fa('0x1a')],'MailQueueId':_0x18b535['id'],'interface':util['format'](_0x43fa('0x4a'),_0x43fa('0x4b'),_0x13030d[_0x43fa('0x1a')]),'penalty':0x0,'paused':_0x13030d['mailPause'],'createdAt':_0x13030d[_0x43fa('0x48')],'updatedAt':_0x13030d[_0x43fa('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x43fa('0x14')](respondWithFilteredResult(_0xe8c402,_0x6a739c))[_0x43fa('0x39')](handleError(_0xe8c402,null));};exports[_0x43fa('0x4d')]=function(_0x600b14,_0x3dac75){var _0x46fb9a={};var _0x358dba={};var _0x29e984;var _0x3553d7;return db[_0x43fa('0x20')][_0x43fa('0x3d')]({'where':{'id':_0x600b14[_0x43fa('0x23')]['id']}})['then'](handleEntityNotFound(_0x3dac75,null))[_0x43fa('0x14')](function(_0x50cb26){if(_0x50cb26){_0x29e984=_0x50cb26;_0x358dba['model']=_[_0x43fa('0x26')](db[_0x43fa('0x4e')][_0x43fa('0x1d')]);_0x358dba[_0x43fa('0x25')]=_[_0x43fa('0x26')](_0x600b14['query']);_0x358dba['filters']=_[_0x43fa('0x28')](_0x358dba[_0x43fa('0x24')],_0x358dba[_0x43fa('0x25')]);_0x46fb9a[_0x43fa('0x29')]=_[_0x43fa('0x28')](_0x358dba[_0x43fa('0x24')],qs[_0x43fa('0x2a')](_0x600b14['query'][_0x43fa('0x2a')]));_0x46fb9a['attributes']=_0x46fb9a[_0x43fa('0x29')]['length']?_0x46fb9a[_0x43fa('0x29')]:_0x358dba['model'];_0x46fb9a['order']=qs['sort'](_0x600b14[_0x43fa('0x25')]['sort']);_0x46fb9a['where']=qs[_0x43fa('0x27')](_[_0x43fa('0x41')](_0x600b14[_0x43fa('0x25')],_0x358dba[_0x43fa('0x27')]));if(_0x600b14['query']['filter']){_0x46fb9a['where']=_[_0x43fa('0x2d')](_0x46fb9a[_0x43fa('0x43')],{'$or':_['map'](_0x46fb9a['attributes'],function(_0x50c313){var _0x207573={};_0x207573[_0x50c313]={'$like':'%'+_0x600b14['query'][_0x43fa('0x42')]+'%'};return _0x207573;})});}_0x46fb9a=_['merge']({},_0x46fb9a,_0x600b14[_0x43fa('0x2e')]);return _0x29e984[_0x43fa('0x4d')](_0x46fb9a);}})[_0x43fa('0x14')](function(_0xac42ae){if(_0xac42ae){_0x3553d7=_0xac42ae[_0x43fa('0x2b')];if(!_0x600b14[_0x43fa('0x25')][_0x43fa('0x4f')](_0x43fa('0x3f'))){_0x46fb9a[_0x43fa('0x11')]=qs[_0x43fa('0x11')](_0x600b14[_0x43fa('0x25')][_0x43fa('0x11')]);_0x46fb9a[_0x43fa('0xf')]=qs[_0x43fa('0xf')](_0x600b14['query'][_0x43fa('0xf')]);}return _0x29e984[_0x43fa('0x4d')](_0x46fb9a);}})[_0x43fa('0x14')](function(_0x5c43c5){if(_0x5c43c5){return _0x5c43c5?{'count':_0x3553d7,'rows':_0x5c43c5}:null;}})['then'](respondWithResult(_0x3dac75,null))['catch'](handleError(_0x3dac75,null));};exports[_0x43fa('0x50')]=function(_0x19b6d9,_0x7785af){var _0x3e7a3f=_0x19b6d9[_0x43fa('0x31')]['ids'];return db[_0x43fa('0x4e')]['findAll']({'where':{'id':_0x3e7a3f},'attributes':['id'],'include':[{'model':db[_0x43fa('0x45')],'as':_0x43fa('0x51'),'attributes':['id',_0x43fa('0x1a'),'online',_0x43fa('0x52'),_0x43fa('0x53')],'raw':!![]}]})['then'](function(_0x5ba9e7){if(_0x5ba9e7){var _0x6edc05=_['flatMap'](_0x5ba9e7,function(_0x574d2f){var _0x43103e=_0x574d2f[_0x43fa('0x33')]({'plain':!![]});return _0x43103e[_0x43fa('0x51')];});return db[_0x43fa('0x20')][_0x43fa('0x2f')]({'where':{'id':_0x19b6d9[_0x43fa('0x23')]['id']}})['then'](function(_0x3a3eb2){return db['sequelize'][_0x43fa('0x54')](function(_0xb4a4b0){return _0x3a3eb2[_0x43fa('0x50')](_0x3e7a3f,{'transaction':_0xb4a4b0})[_0x43fa('0x14')](function(){return BPromise['each'](_0x6edc05,function(_0x1fc649){return db[_0x43fa('0x3e')][_0x43fa('0x55')]({'where':{'UserId':_0x1fc649['id'],'MailQueueId':_0x19b6d9[_0x43fa('0x23')]['id']},'transaction':_0xb4a4b0});});})[_0x43fa('0x14')](function(){_0x6edc05['forEach'](function(_0x32221b){socket[_0x43fa('0x56')](_0x43fa('0x57'),{'UserId':_0x32221b['id'],'MailQueueId':_0x3a3eb2['id']});});});});});}})[_0x43fa('0x14')](respondWithStatusCode(_0x7785af,null))['catch'](handleError(_0x7785af,null));};exports[_0x43fa('0x58')]=function(_0x5528fd,_0x2b6d2a){return db[_0x43fa('0x4e')][_0x43fa('0x44')]({'where':{'id':_0x5528fd[_0x43fa('0x25')][_0x43fa('0x59')]},'attributes':['id'],'include':[{'model':db[_0x43fa('0x45')],'as':_0x43fa('0x51'),'attributes':['id'],'raw':!![]}]})[_0x43fa('0x14')](handleEntityNotFound(_0x2b6d2a,null))['then'](function(_0x36c20d){var _0x2bc0e3=_['map'](_0x36c20d,'id');var _0x398854=[];var _0x48d34e=[];var _0x393ea7=squel[_0x43fa('0x5a')]();_0x393ea7[_0x43fa('0x5b')](_0x43fa('0x5c'))[_0x43fa('0x5d')](_0x43fa('0x5e'),'tq')[_0x43fa('0x5f')]('user_has_teams','ut',_0x43fa('0x60'))[_0x43fa('0x43')]('MailQueueId\x20=\x20?',_0x5528fd[_0x43fa('0x23')]['id']);for(var _0x4f1b6d=0x0;_0x4f1b6d<_0x36c20d[_0x43fa('0x2b')];_0x4f1b6d+=0x1){let _0x216c9f=_0x36c20d[_0x4f1b6d];for(var _0x3fe3ca=0x0;_0x3fe3ca<_0x216c9f[_0x43fa('0x51')]['length'];_0x3fe3ca+=0x1){let _0x47374b=_0x216c9f[_0x43fa('0x51')][_0x3fe3ca];var _0x1acaa4=_0x393ea7['clone']();_0x1acaa4[_0x43fa('0x43')](_0x43fa('0x61'),_0x47374b['id']);_0x48d34e[_0x43fa('0x62')](db[_0x43fa('0x63')][_0x43fa('0x25')](_0x1acaa4[_0x43fa('0x64')](),{'type':db[_0x43fa('0x63')]['QueryTypes'][_0x43fa('0x65')]})[_0x43fa('0x14')](function(_0x136d2c){if(_0x136d2c[_0x43fa('0x2b')]===0x1){return _0x47374b['id'];}else{var _0x5633b8=_[_0x43fa('0x66')](_[_0x43fa('0x1c')](_0x136d2c,_0x43fa('0x67')),function(_0x5ce122){return _[_0x43fa('0x68')](_0x2bc0e3,_0x5ce122);});if(_0x5633b8){return _0x47374b['id'];}}}));}}return BPromise[_0x43fa('0x69')](_0x48d34e)['then'](function(_0x2a728f){_0x398854=_(_0x398854)[_0x43fa('0x6a')](_0x2a728f)[_0x43fa('0x6b')]()['value']();return db[_0x43fa('0x20')][_0x43fa('0x2f')]({'where':{'id':_0x5528fd[_0x43fa('0x23')]['id']}})[_0x43fa('0x14')](function(_0xce638d){return db['sequelize'][_0x43fa('0x54')](function(_0x3ae0fe){return _0xce638d[_0x43fa('0x58')](_0x5528fd[_0x43fa('0x25')][_0x43fa('0x59')],{'transaction':_0x3ae0fe})[_0x43fa('0x14')](function(){if(!_['isEmpty'](_0x398854)){return _0xce638d[_0x43fa('0x6c')](_0x398854,{'transaction':_0x3ae0fe});}})[_0x43fa('0x14')](function(){_0x398854['forEach'](function(_0x1976fb){socket[_0x43fa('0x56')]('userMailQueue:remove',{'UserId':_0x1976fb,'MailQueueId':_0xce638d['id']});});});});});});})['then'](respondWithStatusCode(_0x2b6d2a,null))[_0x43fa('0x39')](handleError(_0x2b6d2a,null));};exports[_0x43fa('0x6d')]=function(_0x351f84,_0x6a1f04){return db[_0x43fa('0x20')][_0x43fa('0x2f')]({'where':{'id':_0x351f84[_0x43fa('0x23')]['id']}})[_0x43fa('0x14')](handleEntityNotFound(_0x6a1f04,null))[_0x43fa('0x14')](function(_0x5690c8){if(_0x5690c8){return _0x5690c8[_0x43fa('0x6d')](_0x351f84['body'][_0x43fa('0x59')],_[_0x43fa('0x6e')](_0x351f84[_0x43fa('0x31')],[_0x43fa('0x59'),'id'])||{})[_0x43fa('0x6f')](function(_0x101e96){for(var _0x180476=0x0;_0x180476<_0x351f84[_0x43fa('0x31')][_0x43fa('0x59')][_0x43fa('0x2b')];_0x180476+=0x1){socket[_0x43fa('0x56')](_0x43fa('0x57'),{'UserId':Number(_0x351f84[_0x43fa('0x31')]['ids'][_0x180476]),'MailQueueId':Number(_0x351f84[_0x43fa('0x23')]['id'])});}return _0x101e96;});}})[_0x43fa('0x14')](respondWithResult(_0x6a1f04,null))[_0x43fa('0x39')](handleError(_0x6a1f04,null));};exports[_0x43fa('0x6c')]=function(_0x81e8e7,_0x21bf53){return db[_0x43fa('0x20')][_0x43fa('0x2f')]({'where':{'id':_0x81e8e7['params']['id']}})[_0x43fa('0x14')](handleEntityNotFound(_0x21bf53,null))[_0x43fa('0x14')](function(_0x3894df){if(_0x3894df){return _0x3894df[_0x43fa('0x6c')](_0x81e8e7[_0x43fa('0x25')][_0x43fa('0x59')])['then'](function(){if(_['isArray'](_0x81e8e7[_0x43fa('0x25')]['ids'])){for(var _0x1ad81a=0x0;_0x1ad81a<_0x81e8e7[_0x43fa('0x25')][_0x43fa('0x59')]['length'];_0x1ad81a+=0x1){socket[_0x43fa('0x56')](_0x43fa('0x70'),{'UserId':Number(_0x81e8e7[_0x43fa('0x25')][_0x43fa('0x59')][_0x1ad81a]),'MailQueueId':Number(_0x81e8e7['params']['id'])});}}else{socket[_0x43fa('0x56')](_0x43fa('0x70'),{'UserId':Number(_0x81e8e7[_0x43fa('0x25')][_0x43fa('0x59')]),'MailQueueId':Number(_0x81e8e7[_0x43fa('0x23')]['id'])});}});}})[_0x43fa('0x14')](respondWithStatusCode(_0x21bf53,null))[_0x43fa('0x39')](handleError(_0x21bf53,null));};exports[_0x43fa('0x71')]=function(_0x4a9964,_0x2b93a9){var _0x15816f={};var _0x5130d5={};var _0x34372d;var _0x8f9608;return db[_0x43fa('0x20')][_0x43fa('0x3d')]({'where':{'id':_0x4a9964[_0x43fa('0x23')]['id']}})['then'](handleEntityNotFound(_0x2b93a9,null))[_0x43fa('0x14')](function(_0x451850){if(_0x451850){_0x34372d=_0x451850;_0x5130d5[_0x43fa('0x24')]=_[_0x43fa('0x26')](db['User']['rawAttributes']);_0x5130d5['query']=_[_0x43fa('0x26')](_0x4a9964[_0x43fa('0x25')]);_0x5130d5[_0x43fa('0x27')]=_[_0x43fa('0x28')](_0x5130d5['model'],_0x5130d5['query']);_0x15816f[_0x43fa('0x29')]=_[_0x43fa('0x28')](_0x5130d5[_0x43fa('0x24')],qs[_0x43fa('0x2a')](_0x4a9964[_0x43fa('0x25')]['fields']));_0x15816f[_0x43fa('0x29')]=_0x15816f[_0x43fa('0x29')][_0x43fa('0x2b')]?_0x15816f['attributes']:_0x5130d5[_0x43fa('0x24')];_0x15816f[_0x43fa('0x72')]=qs[_0x43fa('0x40')](_0x4a9964[_0x43fa('0x25')][_0x43fa('0x40')]);_0x15816f['where']=qs[_0x43fa('0x27')](_[_0x43fa('0x41')](_0x4a9964['query'],_0x5130d5[_0x43fa('0x27')]));if(_0x4a9964['query']['filter']){_0x15816f[_0x43fa('0x43')]=_[_0x43fa('0x2d')](_0x15816f[_0x43fa('0x43')],{'$or':_[_0x43fa('0x1c')](_0x15816f[_0x43fa('0x29')],function(_0x54bb2b){var _0x537ca6={};_0x537ca6[_0x54bb2b]={'$like':'%'+_0x4a9964[_0x43fa('0x25')][_0x43fa('0x42')]+'%'};return _0x537ca6;})});}_0x15816f=_['merge']({},_0x15816f,_0x4a9964[_0x43fa('0x2e')]);return _0x34372d[_0x43fa('0x71')](_0x15816f);}})[_0x43fa('0x14')](function(_0x5d7e79){if(_0x5d7e79){_0x8f9608=_0x5d7e79[_0x43fa('0x2b')];if(!_0x4a9964[_0x43fa('0x25')][_0x43fa('0x4f')](_0x43fa('0x3f'))){_0x15816f[_0x43fa('0x11')]=qs[_0x43fa('0x11')](_0x4a9964[_0x43fa('0x25')][_0x43fa('0x11')]);_0x15816f[_0x43fa('0xf')]=qs[_0x43fa('0xf')](_0x4a9964[_0x43fa('0x25')][_0x43fa('0xf')]);}return _0x34372d[_0x43fa('0x71')](_0x15816f);}})[_0x43fa('0x14')](function(_0x3404af){if(_0x3404af){return _0x3404af?{'count':_0x8f9608,'rows':_0x3404af}:null;}})['then'](respondWithResult(_0x2b93a9,null))[_0x43fa('0x39')](handleError(_0x2b93a9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index dc5fd02..6dca433 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 _0x62db=['emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x2ba84e,_0x1eedcd){var _0x15d2c2=function(_0x3ef4bf){while(--_0x3ef4bf){_0x2ba84e['push'](_0x2ba84e['shift']());}};_0x15d2c2(++_0x1eedcd);}(_0x62db,0x1b9));var _0xb62d=function(_0x5a1ff9,_0x1f1450){_0x5a1ff9=_0x5a1ff9-0x0;var _0x97d74=_0x62db[_0x5a1ff9];return _0x97d74;};'use strict';var EventEmitter=require(_0xb62d('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb62d('0x1')](0x0);var events={'afterCreate':_0xb62d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x476be0){return function(_0x25c038,_0x288b38,_0xe89149){MailQueueEvents[_0xb62d('0x3')](_0x476be0+':'+_0x25c038['id'],_0x25c038);MailQueueEvents[_0xb62d('0x3')](_0x476be0,_0x25c038);_0xe89149(null);};}for(var e in events){if(events[_0xb62d('0x4')](e)){var event=events[e];MailQueue[_0xb62d('0x5')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x725f=['setMaxListeners','save','update','hasOwnProperty','hook','../../mysqldb','MailQueue'];(function(_0x155dc4,_0x307eb4){var _0x711d50=function(_0x5a00dc){while(--_0x5a00dc){_0x155dc4['push'](_0x155dc4['shift']());}};_0x711d50(++_0x307eb4);}(_0x725f,0xd0));var _0xf725=function(_0x537829,_0x3288c6){_0x537829=_0x537829-0x0;var _0xd8e4f2=_0x725f[_0x537829];return _0xd8e4f2;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf725('0x0'))['db'][_0xf725('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf725('0x2')](0x0);var events={'afterCreate':_0xf725('0x3'),'afterUpdate':_0xf725('0x4'),'afterDestroy':'remove'};function emitEvent(_0x40f04a){return function(_0x553259,_0x14494c,_0x2c891c){MailQueueEvents['emit'](_0x40f04a+':'+_0x553259['id'],_0x553259);MailQueueEvents['emit'](_0x40f04a,_0x553259);_0x2c891c(null);};}for(var e in events){if(events[_0xf725('0x5')](e)){var event=events[e];MailQueue[_0xf725('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9164875..38d5a7f 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 _0x8fea=['path','rimraf','./mailQueue.attributes','define','MailQueue','lodash','util','../../config/logger','api','bluebird'];(function(_0x2f42d3,_0x568373){var _0x20ba10=function(_0xac9d4e){while(--_0xac9d4e){_0x2f42d3['push'](_0x2f42d3['shift']());}};_0x20ba10(++_0x568373);}(_0x8fea,0x1b3));var _0xa8fe=function(_0x1e182d,_0x4f35c2){_0x1e182d=_0x1e182d-0x0;var _0x5627c6=_0x8fea[_0x1e182d];return _0x5627c6;};'use strict';var _=require(_0xa8fe('0x0'));var util=require(_0xa8fe('0x1'));var logger=require(_0xa8fe('0x2'))(_0xa8fe('0x3'));var moment=require('moment');var BPromise=require(_0xa8fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8fe('0x5'));var rimraf=require(_0xa8fe('0x6'));var config=require('../../config/environment');var attributes=require(_0xa8fe('0x7'));module['exports']=function(_0x263547,_0x1f8bea){return _0x263547[_0xa8fe('0x8')](_0xa8fe('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5913=['rimraf','./mailQueue.attributes','exports','define','MailQueue','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5913,0xe9));var _0x3591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5913[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3591('0x0'));var logger=require(_0x3591('0x1'))(_0x3591('0x2'));var moment=require(_0x3591('0x3'));var BPromise=require(_0x3591('0x4'));var rp=require(_0x3591('0x5'));var fs=require('fs');var path=require(_0x3591('0x6'));var rimraf=require(_0x3591('0x7'));var config=require('../../config/environment');var attributes=require(_0x3591('0x8'));module[_0x3591('0x9')]=function(_0x415d9c,_0x4d4996){return _0x415d9c[_0x3591('0xa')](_0x3591('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index eaaa1e9..dcdbfb7 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 _0x4ffe=['stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','include','map','model','attributes','debug','ShowMailQueue','find','where'];(function(_0x1d5714,_0x2fa5f4){var _0x1b620e=function(_0x9a0a73){while(--_0x9a0a73){_0x1d5714['push'](_0x1d5714['shift']());}};_0x1b620e(++_0x2fa5f4);}(_0x4ffe,0x172));var _0xe4ff=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x4ffe[_0x5786f9];return _0x22c3cf;};'use strict';var _=require(_0xe4ff('0x0'));var util=require(_0xe4ff('0x1'));var moment=require(_0xe4ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4ff('0x3'));var fs=require('fs');var Redis=require(_0xe4ff('0x4'));var db=require(_0xe4ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4ff('0x6'))(_0xe4ff('0x7'));var config=require(_0xe4ff('0x8'));var jayson=require(_0xe4ff('0x9'));var client=jayson[_0xe4ff('0xa')]['http']({'port':0x232a});config[_0xe4ff('0xb')]=_[_0xe4ff('0xc')](config[_0xe4ff('0xb')],{'host':_0xe4ff('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4ff('0xb')]));require('./mailQueue.socket')[_0xe4ff('0xe')](socket);function respondWithRpcPromise(_0x188173,_0x290d4a,_0x216d65){return new BPromise(function(_0x4b15c2,_0x537541){return client[_0xe4ff('0xf')](_0x188173,_0x216d65)[_0xe4ff('0x10')](function(_0x2f1861){logger[_0xe4ff('0x11')](_0xe4ff('0x12'),_0x290d4a,_0xe4ff('0x13'));logger['debug'](_0xe4ff('0x14'),_0x290d4a,_0xe4ff('0x13'),JSON['stringify'](_0x2f1861));if(_0x2f1861[_0xe4ff('0x15')]){if(_0x2f1861['error'][_0xe4ff('0x16')]===0x1f4){logger[_0xe4ff('0x15')]('MailQueue,\x20%s,\x20%s',_0x290d4a,_0x2f1861[_0xe4ff('0x15')][_0xe4ff('0x17')]);return _0x537541(_0x2f1861[_0xe4ff('0x15')][_0xe4ff('0x17')]);}logger[_0xe4ff('0x15')](_0xe4ff('0x12'),_0x290d4a,_0x2f1861['error'][_0xe4ff('0x17')]);return _0x4b15c2(_0x2f1861[_0xe4ff('0x15')][_0xe4ff('0x17')]);}else{logger[_0xe4ff('0x11')]('MailQueue,\x20%s,\x20%s',_0x290d4a,_0xe4ff('0x13'));_0x4b15c2(_0x2f1861[_0xe4ff('0x18')][_0xe4ff('0x17')]);}})[_0xe4ff('0x19')](function(_0x54edef){logger[_0xe4ff('0x15')](_0xe4ff('0x12'),_0x290d4a,_0x54edef);_0x537541(_0x54edef);});});}exports[_0xe4ff('0x1a')]=function(_0x1fa844){var _0xb195e9=this;return new Promise(function(_0x5c711f,_0x323864){return db[_0xe4ff('0x1b')][_0xe4ff('0x1c')]({'raw':_0x1fa844[_0xe4ff('0x1d')]?_0x1fa844[_0xe4ff('0x1d')][_0xe4ff('0x1e')]===undefined?!![]:![]:!![],'where':_0x1fa844['options']?_0x1fa844[_0xe4ff('0x1d')]['where']||null:null,'attributes':_0x1fa844[_0xe4ff('0x1d')]?_0x1fa844[_0xe4ff('0x1d')]['attributes']||null:null,'limit':_0x1fa844[_0xe4ff('0x1d')]?_0x1fa844['options'][_0xe4ff('0x1f')]||null:null,'include':_0x1fa844[_0xe4ff('0x1d')]?_0x1fa844[_0xe4ff('0x1d')][_0xe4ff('0x20')]?_[_0xe4ff('0x21')](_0x1fa844[_0xe4ff('0x1d')][_0xe4ff('0x20')],function(_0x3f6d4a){return{'model':db[_0x3f6d4a[_0xe4ff('0x22')]],'as':_0x3f6d4a['as'],'attributes':_0x3f6d4a[_0xe4ff('0x23')],'include':_0x3f6d4a[_0xe4ff('0x20')]?_[_0xe4ff('0x21')](_0x3f6d4a['include'],function(_0x28e28a){return{'model':db[_0x28e28a[_0xe4ff('0x22')]],'as':_0x28e28a['as'],'attributes':_0x28e28a[_0xe4ff('0x23')],'include':_0x28e28a[_0xe4ff('0x20')]?_[_0xe4ff('0x21')](_0x28e28a[_0xe4ff('0x20')],function(_0x49c9a3){return{'model':db[_0x49c9a3[_0xe4ff('0x22')]],'as':_0x49c9a3['as'],'attributes':_0x49c9a3[_0xe4ff('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe4ff('0x10')](function(_0x4a5b4d){logger[_0xe4ff('0x11')]('GetMailQueue',_0x1fa844);logger[_0xe4ff('0x24')](_0xe4ff('0x1a'),_0x1fa844,JSON['stringify'](_0x4a5b4d));_0x5c711f(_0x4a5b4d);})['catch'](function(_0x4439be){logger[_0xe4ff('0x15')](_0xe4ff('0x1a'),_0x4439be[_0xe4ff('0x17')],_0x1fa844);_0x323864(_0xb195e9[_0xe4ff('0x15')](0x1f4,_0x4439be[_0xe4ff('0x17')]));});});};exports[_0xe4ff('0x25')]=function(_0x527595){var _0x49a90b=this;return new Promise(function(_0x423cac,_0x4021ae){return db[_0xe4ff('0x1b')][_0xe4ff('0x26')]({'raw':_0x527595[_0xe4ff('0x1d')]?_0x527595['options']['raw']===undefined?!![]:![]:!![],'where':_0x527595[_0xe4ff('0x1d')]?_0x527595[_0xe4ff('0x1d')][_0xe4ff('0x27')]||null:null,'attributes':_0x527595[_0xe4ff('0x1d')]?_0x527595[_0xe4ff('0x1d')]['attributes']||null:null,'include':_0x527595[_0xe4ff('0x1d')]?_0x527595['options'][_0xe4ff('0x20')]?_['map'](_0x527595[_0xe4ff('0x1d')]['include'],function(_0x470a3a){return{'model':db[_0x470a3a['model']],'as':_0x470a3a['as'],'attributes':_0x470a3a[_0xe4ff('0x23')],'include':_0x470a3a[_0xe4ff('0x20')]?_[_0xe4ff('0x21')](_0x470a3a[_0xe4ff('0x20')],function(_0x5a8f12){return{'model':db[_0x5a8f12[_0xe4ff('0x22')]],'as':_0x5a8f12['as'],'attributes':_0x5a8f12['attributes'],'include':_0x5a8f12[_0xe4ff('0x20')]?_[_0xe4ff('0x21')](_0x5a8f12[_0xe4ff('0x20')],function(_0x228bae){return{'model':db[_0x228bae['model']],'as':_0x228bae['as'],'attributes':_0x228bae[_0xe4ff('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe4ff('0x10')](function(_0x233214){logger[_0xe4ff('0x11')](_0xe4ff('0x25'),_0x527595);logger[_0xe4ff('0x24')](_0xe4ff('0x25'),_0x527595,JSON[_0xe4ff('0x28')](_0x233214));_0x423cac(_0x233214);})[_0xe4ff('0x19')](function(_0x4632e7){logger['error'](_0xe4ff('0x25'),_0x4632e7[_0xe4ff('0x17')],_0x527595);_0x4021ae(_0x49a90b[_0xe4ff('0x15')](0x1f4,_0x4632e7[_0xe4ff('0x17')]));});});}; \ No newline at end of file +var _0x00d6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','findAll','options','raw','attributes','include','map','model','GetMailQueue','ShowMailQueue','MailQueue','find','where'];(function(_0x240248,_0x761a1e){var _0x1a30c6=function(_0x3fceb5){while(--_0x3fceb5){_0x240248['push'](_0x240248['shift']());}};_0x1a30c6(++_0x761a1e);}(_0x00d6,0x1e5));var _0x600d=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x00d6[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x600d('0x0'));var util=require(_0x600d('0x1'));var moment=require(_0x600d('0x2'));var BPromise=require(_0x600d('0x3'));var rs=require(_0x600d('0x4'));var fs=require('fs');var Redis=require(_0x600d('0x5'));var db=require(_0x600d('0x6'))['db'];var utils=require(_0x600d('0x7'));var logger=require(_0x600d('0x8'))(_0x600d('0x9'));var config=require(_0x600d('0xa'));var jayson=require(_0x600d('0xb'));var client=jayson[_0x600d('0xc')]['http']({'port':0x232a});config['redis']=_[_0x600d('0xd')](config['redis'],{'host':_0x600d('0xe'),'port':0x18eb});var socket=require(_0x600d('0xf'))(new Redis(config[_0x600d('0x10')]));require(_0x600d('0x11'))[_0x600d('0x12')](socket);function respondWithRpcPromise(_0x494da8,_0x152535,_0xeb48a3){return new BPromise(function(_0x4acb67,_0x1d7dc0){return client[_0x600d('0x13')](_0x494da8,_0xeb48a3)[_0x600d('0x14')](function(_0x66fbe1){logger[_0x600d('0x15')]('MailQueue,\x20%s,\x20%s',_0x152535,'request\x20sent');logger[_0x600d('0x16')](_0x600d('0x17'),_0x152535,_0x600d('0x18'),JSON[_0x600d('0x19')](_0x66fbe1));if(_0x66fbe1[_0x600d('0x1a')]){if(_0x66fbe1[_0x600d('0x1a')][_0x600d('0x1b')]===0x1f4){logger[_0x600d('0x1a')]('MailQueue,\x20%s,\x20%s',_0x152535,_0x66fbe1[_0x600d('0x1a')][_0x600d('0x1c')]);return _0x1d7dc0(_0x66fbe1[_0x600d('0x1a')][_0x600d('0x1c')]);}logger[_0x600d('0x1a')]('MailQueue,\x20%s,\x20%s',_0x152535,_0x66fbe1[_0x600d('0x1a')]['message']);return _0x4acb67(_0x66fbe1[_0x600d('0x1a')]['message']);}else{logger[_0x600d('0x15')](_0x600d('0x1d'),_0x152535,_0x600d('0x18'));_0x4acb67(_0x66fbe1[_0x600d('0x1e')][_0x600d('0x1c')]);}})['catch'](function(_0x4ed2a6){logger[_0x600d('0x1a')]('MailQueue,\x20%s,\x20%s',_0x152535,_0x4ed2a6);_0x1d7dc0(_0x4ed2a6);});});}exports['GetMailQueue']=function(_0x33b1a0){var _0x5585d1=this;return new Promise(function(_0x1f8f8f,_0x308666){return db['MailQueue'][_0x600d('0x1f')]({'raw':_0x33b1a0['options']?_0x33b1a0[_0x600d('0x20')][_0x600d('0x21')]===undefined?!![]:![]:!![],'where':_0x33b1a0['options']?_0x33b1a0['options']['where']||null:null,'attributes':_0x33b1a0[_0x600d('0x20')]?_0x33b1a0[_0x600d('0x20')][_0x600d('0x22')]||null:null,'limit':_0x33b1a0[_0x600d('0x20')]?_0x33b1a0[_0x600d('0x20')]['limit']||null:null,'include':_0x33b1a0['options']?_0x33b1a0[_0x600d('0x20')][_0x600d('0x23')]?_[_0x600d('0x24')](_0x33b1a0[_0x600d('0x20')]['include'],function(_0x19f8f8){return{'model':db[_0x19f8f8['model']],'as':_0x19f8f8['as'],'attributes':_0x19f8f8[_0x600d('0x22')],'include':_0x19f8f8[_0x600d('0x23')]?_[_0x600d('0x24')](_0x19f8f8[_0x600d('0x23')],function(_0x5edeb7){return{'model':db[_0x5edeb7[_0x600d('0x25')]],'as':_0x5edeb7['as'],'attributes':_0x5edeb7[_0x600d('0x22')],'include':_0x5edeb7[_0x600d('0x23')]?_[_0x600d('0x24')](_0x5edeb7[_0x600d('0x23')],function(_0x38c68f){return{'model':db[_0x38c68f['model']],'as':_0x38c68f['as'],'attributes':_0x38c68f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x569379){logger[_0x600d('0x15')]('GetMailQueue',_0x33b1a0);logger['debug'](_0x600d('0x26'),_0x33b1a0,JSON['stringify'](_0x569379));_0x1f8f8f(_0x569379);})['catch'](function(_0x268190){logger[_0x600d('0x1a')](_0x600d('0x26'),_0x268190[_0x600d('0x1c')],_0x33b1a0);_0x308666(_0x5585d1[_0x600d('0x1a')](0x1f4,_0x268190[_0x600d('0x1c')]));});});};exports[_0x600d('0x27')]=function(_0x49f7be){var _0x3b994c=this;return new Promise(function(_0x24e43a,_0x48acbc){return db[_0x600d('0x28')][_0x600d('0x29')]({'raw':_0x49f7be[_0x600d('0x20')]?_0x49f7be['options'][_0x600d('0x21')]===undefined?!![]:![]:!![],'where':_0x49f7be[_0x600d('0x20')]?_0x49f7be[_0x600d('0x20')][_0x600d('0x2a')]||null:null,'attributes':_0x49f7be[_0x600d('0x20')]?_0x49f7be[_0x600d('0x20')][_0x600d('0x22')]||null:null,'include':_0x49f7be[_0x600d('0x20')]?_0x49f7be[_0x600d('0x20')][_0x600d('0x23')]?_[_0x600d('0x24')](_0x49f7be['options'][_0x600d('0x23')],function(_0x269017){return{'model':db[_0x269017[_0x600d('0x25')]],'as':_0x269017['as'],'attributes':_0x269017[_0x600d('0x22')],'include':_0x269017[_0x600d('0x23')]?_[_0x600d('0x24')](_0x269017[_0x600d('0x23')],function(_0x336795){return{'model':db[_0x336795['model']],'as':_0x336795['as'],'attributes':_0x336795['attributes'],'include':_0x336795[_0x600d('0x23')]?_[_0x600d('0x24')](_0x336795['include'],function(_0x10e6e4){return{'model':db[_0x10e6e4[_0x600d('0x25')]],'as':_0x10e6e4['as'],'attributes':_0x10e6e4['attributes']};}):[]};}):[]};}):[]:[]})[_0x600d('0x14')](function(_0x2f7d70){logger[_0x600d('0x15')](_0x600d('0x27'),_0x49f7be);logger['debug'](_0x600d('0x27'),_0x49f7be,JSON['stringify'](_0x2f7d70));_0x24e43a(_0x2f7d70);})[_0x600d('0x2b')](function(_0x4994e6){logger['error'](_0x600d('0x27'),_0x4994e6[_0x600d('0x1c')],_0x49f7be);_0x48acbc(_0x3b994c['error'](0x1f4,_0x4994e6[_0x600d('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 896e65c..d570153 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 _0x14a4=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x4271eb,_0x31d891){var _0x1ed1ea=function(_0x1c508c){while(--_0x1c508c){_0x4271eb['push'](_0x4271eb['shift']());}};_0x1ed1ea(++_0x31d891);}(_0x14a4,0x80));var _0x414a=function(_0x3eb07a,_0x32ceaa){_0x3eb07a=_0x3eb07a-0x0;var _0x50f40c=_0x14a4[_0x3eb07a];return _0x50f40c;};'use strict';var MailQueueEvents=require(_0x414a('0x0'));var events=[_0x414a('0x1'),_0x414a('0x2'),_0x414a('0x3')];function createListener(_0x2854b2,_0x5458ca){return function(_0x2909fd){_0x5458ca[_0x414a('0x4')](_0x2854b2,_0x2909fd);};}function removeListener(_0x519bc5,_0x352c68){return function(){MailQueueEvents[_0x414a('0x5')](_0x519bc5,_0x352c68);};}exports[_0x414a('0x6')]=function(_0x2a6491){for(var _0x5ea7d1=0x0,_0x25e553=events[_0x414a('0x7')];_0x5ea7d1<_0x25e553;_0x5ea7d1++){var _0x3c96aa=events[_0x5ea7d1];var _0x55f9c4=createListener(_0x414a('0x8')+_0x3c96aa,_0x2a6491);MailQueueEvents['on'](_0x3c96aa,_0x55f9c4);}}; \ No newline at end of file +var _0xd3f9=['remove','emit','removeListener','length','mailQueue:','./mailQueue.events'];(function(_0x58fcb2,_0x9c2612){var _0x5799a6=function(_0x3dc6bc){while(--_0x3dc6bc){_0x58fcb2['push'](_0x58fcb2['shift']());}};_0x5799a6(++_0x9c2612);}(_0xd3f9,0x7d));var _0x9d3f=function(_0x331c37,_0x436fa7){_0x331c37=_0x331c37-0x0;var _0x2c6576=_0xd3f9[_0x331c37];return _0x2c6576;};'use strict';var MailQueueEvents=require(_0x9d3f('0x0'));var events=['save',_0x9d3f('0x1'),'update'];function createListener(_0x36d324,_0x1cc000){return function(_0x30df92){_0x1cc000[_0x9d3f('0x2')](_0x36d324,_0x30df92);};}function removeListener(_0x5381a6,_0xfd27bb){return function(){MailQueueEvents[_0x9d3f('0x3')](_0x5381a6,_0xfd27bb);};}exports['register']=function(_0x3338d0){for(var _0x3fb034=0x0,_0x1dd72e=events[_0x9d3f('0x4')];_0x3fb034<_0x1dd72e;_0x3fb034++){var _0xd4d1bf=events[_0x3fb034];var _0x22ec01=createListener(_0x9d3f('0x5')+_0xd4d1bf,_0x3338d0);MailQueueEvents['on'](_0xd4d1bf,_0x22ec01);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 9bb41f8..1a8a130 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 _0x24ce=['index','get','/describe','isAuthenticated','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x24ce,0x11b));var _0xe24c=function(_0x37272d,_0x164468){_0x37272d=_0x37272d-0x0;var _0x534ec4=_0x24ce[_0x37272d];return _0x534ec4;};'use strict';var multer=require(_0xe24c('0x0'));var util=require(_0xe24c('0x1'));var path=require(_0xe24c('0x2'));var timeout=require(_0xe24c('0x3'));var express=require(_0xe24c('0x4'));var router=express[_0xe24c('0x5')]();var fs_extra=require(_0xe24c('0x6'));var auth=require(_0xe24c('0x7'));var interaction=require(_0xe24c('0x8'));var config=require(_0xe24c('0x9'));var controller=require(_0xe24c('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xe24c('0xb')]);router[_0xe24c('0xc')](_0xe24c('0xd'),auth[_0xe24c('0xe')](),controller['describe']);router[_0xe24c('0xc')]('/:id',auth[_0xe24c('0xe')](),controller['show']);router[_0xe24c('0xf')]('/',auth['isAuthenticated'](),controller[_0xe24c('0x10')]);router[_0xe24c('0x11')](_0xe24c('0x12'),auth[_0xe24c('0xe')](),controller[_0xe24c('0x13')]);router['delete'](_0xe24c('0x12'),auth[_0xe24c('0xe')](),controller['destroy']);module[_0xe24c('0x14')]=router; \ No newline at end of file +var _0xcbaa=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0xcbaa,0x1a0));var _0xacba=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xcbaa[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require('multer');var util=require(_0xacba('0x0'));var path=require(_0xacba('0x1'));var timeout=require(_0xacba('0x2'));var express=require(_0xacba('0x3'));var router=express['Router']();var fs_extra=require(_0xacba('0x4'));var auth=require(_0xacba('0x5'));var interaction=require(_0xacba('0x6'));var config=require(_0xacba('0x7'));var controller=require('./mailQueueReport.controller');router[_0xacba('0x8')]('/',auth['isAuthenticated'](),controller[_0xacba('0x9')]);router['get'](_0xacba('0xa'),auth[_0xacba('0xb')](),controller[_0xacba('0xc')]);router[_0xacba('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xacba('0xd')]);router[_0xacba('0xe')]('/',auth[_0xacba('0xb')](),controller['create']);router[_0xacba('0xf')](_0xacba('0x10'),auth[_0xacba('0xb')](),controller[_0xacba('0x11')]);router['delete'](_0xacba('0x10'),auth[_0xacba('0xb')](),controller[_0xacba('0x12')]);module[_0xacba('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 31ce0ae..36bb2be 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 _0x91f8=['sequelize','exports','STRING','DATE','moment'];(function(_0x31ea7d,_0x5d6a20){var _0x3c80ae=function(_0x1997ea){while(--_0x1997ea){_0x31ea7d['push'](_0x31ea7d['shift']());}};_0x3c80ae(++_0x5d6a20);}(_0x91f8,0x13f));var _0x891f=function(_0x444c70,_0x58d3d9){_0x444c70=_0x444c70-0x0;var _0x93886f=_0x91f8[_0x444c70];return _0x93886f;};'use strict';var moment=require(_0x891f('0x0'));var Sequelize=require(_0x891f('0x1'));module[_0x891f('0x2')]={'uniqueid':{'type':Sequelize[_0x891f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x891f('0x3')]},'joinAt':{'type':Sequelize[_0x891f('0x4')]},'leaveAt':{'type':Sequelize[_0x891f('0x4')]},'acceptAt':{'type':Sequelize[_0x891f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x891f('0x3')]}}; \ No newline at end of file +var _0x6759=['STRING','DATE','moment','exports'];(function(_0x32db04,_0x166b9f){var _0x79a839=function(_0x478723){while(--_0x478723){_0x32db04['push'](_0x32db04['shift']());}};_0x79a839(++_0x166b9f);}(_0x6759,0x126));var _0x9675=function(_0x198fc6,_0x5eaee9){_0x198fc6=_0x198fc6-0x0;var _0x4376bb=_0x6759[_0x198fc6];return _0x4376bb;};'use strict';var moment=require(_0x9675('0x0'));var Sequelize=require('sequelize');module[_0x9675('0x1')]={'uniqueid':{'type':Sequelize[_0x9675('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9675('0x2')]},'joinAt':{'type':Sequelize[_0x9675('0x3')]},'leaveAt':{'type':Sequelize[_0x9675('0x3')]},'acceptAt':{'type':Sequelize[_0x9675('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9675('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0483232..b21ed04 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 _0xffd6=['rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','name','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','eml-format'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0xffd6,0x97));var _0x6ffd=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xffd6[_0x4715d2];return _0x141811;};'use strict';var emlformat=require(_0x6ffd('0x0'));var rimraf=require(_0x6ffd('0x1'));var zipdir=require(_0x6ffd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ffd('0x3'));var BPromise=require(_0x6ffd('0x4'));var Mustache=require(_0x6ffd('0x5'));var util=require('util');var path=require(_0x6ffd('0x6'));var sox=require(_0x6ffd('0x7'));var csv=require(_0x6ffd('0x8'));var ejs=require(_0x6ffd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ffd('0xa'));var squel=require(_0x6ffd('0xb'));var crypto=require(_0x6ffd('0xc'));var jsforce=require(_0x6ffd('0xd'));var deskjs=require(_0x6ffd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ffd('0xf'));var Papa=require(_0x6ffd('0x10'));var Redis=require('ioredis');var authService=require(_0x6ffd('0x11'));var qs=require(_0x6ffd('0x12'));var as=require(_0x6ffd('0x13'));var hardwareService=require(_0x6ffd('0x14'));var logger=require(_0x6ffd('0x15'))(_0x6ffd('0x16'));var utils=require(_0x6ffd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6ffd('0x18'));var db=require(_0x6ffd('0x19'))['db'];function respondWithStatusCode(_0x5e8d6d,_0x2d0b63){_0x2d0b63=_0x2d0b63||0xcc;return function(_0x2ec8a5){if(_0x2ec8a5){return _0x5e8d6d[_0x6ffd('0x1a')](_0x2d0b63);}return _0x5e8d6d[_0x6ffd('0x1b')](_0x2d0b63)['end']();};}function respondWithResult(_0x259235,_0x594cb3){_0x594cb3=_0x594cb3||0xc8;return function(_0x468ecc){if(_0x468ecc){return _0x259235['status'](_0x594cb3)[_0x6ffd('0x1c')](_0x468ecc);}};}function respondWithFilteredResult(_0x261ed7,_0x45db49){return function(_0x5d8aff){if(_0x5d8aff){var _0x15fca6=typeof _0x45db49[_0x6ffd('0x1d')]===_0x6ffd('0x1e')&&typeof _0x45db49[_0x6ffd('0x1f')]===_0x6ffd('0x1e');var _0x19a772=_0x5d8aff[_0x6ffd('0x20')];var _0x889a4b=_0x15fca6?0x0:_0x45db49['offset'];var _0x11a609=_0x15fca6?_0x5d8aff['count']:_0x45db49['offset']+_0x45db49[_0x6ffd('0x1f')];var _0x359d09;if(_0x11a609>=_0x19a772){_0x11a609=_0x19a772;_0x359d09=0xc8;}else{_0x359d09=0xce;}_0x261ed7['status'](_0x359d09);return _0x261ed7[_0x6ffd('0x21')](_0x6ffd('0x22'),_0x889a4b+'-'+_0x11a609+'/'+_0x19a772)['json'](_0x5d8aff);}return null;};}function patchUpdates(_0x564a11){return function(_0x465971){try{jsonpatch[_0x6ffd('0x23')](_0x465971,_0x564a11,!![]);}catch(_0x4dcc50){return BPromise[_0x6ffd('0x24')](_0x4dcc50);}return _0x465971[_0x6ffd('0x25')]();};}function saveUpdates(_0x327fee,_0x53128a){return function(_0x3ba429){if(_0x3ba429){return _0x3ba429[_0x6ffd('0x26')](_0x327fee)['then'](function(_0x356c9c){return _0x356c9c;});}return null;};}function removeEntity(_0x438d1a,_0x50c19a){return function(_0x31fb22){if(_0x31fb22){return _0x31fb22[_0x6ffd('0x27')]()[_0x6ffd('0x28')](function(){_0x438d1a['status'](0xcc)[_0x6ffd('0x29')]();});}};}function handleEntityNotFound(_0x3e5726,_0x46b03f){return function(_0x4ae7ac){if(!_0x4ae7ac){_0x3e5726[_0x6ffd('0x1a')](0x194);}return _0x4ae7ac;};}function handleError(_0x5a55e2,_0x41ab4a){_0x41ab4a=_0x41ab4a||0x1f4;return function(_0x43269c){logger['error'](_0x43269c['stack']);if(_0x43269c[_0x6ffd('0x2a')]){delete _0x43269c[_0x6ffd('0x2a')];}_0x5a55e2[_0x6ffd('0x1b')](_0x41ab4a)['send'](_0x43269c);};}exports['index']=function(_0x32c399,_0x48feb4){var _0x470021={},_0x20c007={},_0x51fdb6={'count':0x0,'rows':[]};var _0x6b5aba=_[_0x6ffd('0x2b')](db[_0x6ffd('0x2c')][_0x6ffd('0x2d')],function(_0x235735){return{'name':_0x235735[_0x6ffd('0x2e')],'type':_0x235735[_0x6ffd('0x2f')][_0x6ffd('0x30')]};});_0x20c007[_0x6ffd('0x31')]=_[_0x6ffd('0x2b')](_0x6b5aba,_0x6ffd('0x2a'));_0x20c007[_0x6ffd('0x32')]=_[_0x6ffd('0x33')](_0x32c399['query']);_0x20c007['filters']=_['intersection'](_0x20c007[_0x6ffd('0x31')],_0x20c007[_0x6ffd('0x32')]);_0x470021[_0x6ffd('0x34')]=_[_0x6ffd('0x35')](_0x20c007[_0x6ffd('0x31')],qs[_0x6ffd('0x36')](_0x32c399[_0x6ffd('0x32')][_0x6ffd('0x36')]));_0x470021[_0x6ffd('0x34')]=_0x470021[_0x6ffd('0x34')][_0x6ffd('0x37')]?_0x470021[_0x6ffd('0x34')]:_0x20c007[_0x6ffd('0x31')];if(!_0x32c399['query'][_0x6ffd('0x38')](_0x6ffd('0x39'))){_0x470021[_0x6ffd('0x1f')]=qs[_0x6ffd('0x1f')](_0x32c399['query'][_0x6ffd('0x1f')]);_0x470021['offset']=qs['offset'](_0x32c399[_0x6ffd('0x32')][_0x6ffd('0x1d')]);}_0x470021[_0x6ffd('0x3a')]=qs[_0x6ffd('0x3b')](_0x32c399['query'][_0x6ffd('0x3b')]);_0x470021['where']=qs[_0x6ffd('0x3c')](_[_0x6ffd('0x3d')](_0x32c399[_0x6ffd('0x32')],_0x20c007[_0x6ffd('0x3c')]),_0x6b5aba);if(_0x32c399[_0x6ffd('0x32')]['filter']){_0x470021['where']=_[_0x6ffd('0x3e')](_0x470021['where'],{'$or':_[_0x6ffd('0x2b')](_0x6b5aba,function(_0x98bf46){if(_0x98bf46[_0x6ffd('0x2f')]!==_0x6ffd('0x3f')){var _0x6ee6f0={};_0x6ee6f0[_0x98bf46[_0x6ffd('0x2a')]]={'$like':'%'+_0x32c399['query'][_0x6ffd('0x40')]+'%'};return _0x6ee6f0;}})});}_0x470021=_[_0x6ffd('0x3e')]({},_0x470021,_0x32c399[_0x6ffd('0x41')]);var _0x3ad5ef={'where':_0x470021['where']};return db[_0x6ffd('0x2c')]['count'](_0x3ad5ef)[_0x6ffd('0x28')](function(_0x13b409){_0x51fdb6[_0x6ffd('0x20')]=_0x13b409;if(_0x32c399['query'][_0x6ffd('0x42')]){_0x470021[_0x6ffd('0x43')]=[{'all':!![]}];}return db[_0x6ffd('0x2c')][_0x6ffd('0x44')](_0x470021);})[_0x6ffd('0x28')](function(_0x2894f5){_0x51fdb6[_0x6ffd('0x45')]=_0x2894f5;return _0x51fdb6;})['then'](respondWithFilteredResult(_0x48feb4,_0x470021))['catch'](handleError(_0x48feb4,null));};exports['show']=function(_0x3bcac8,_0x162259){var _0x51ae8d={'raw':!![],'where':{'id':_0x3bcac8[_0x6ffd('0x46')]['id']}},_0x3d5193={};_0x3d5193[_0x6ffd('0x31')]=_[_0x6ffd('0x33')](db['MailQueueReport'][_0x6ffd('0x2d')]);_0x3d5193[_0x6ffd('0x32')]=_[_0x6ffd('0x33')](_0x3bcac8[_0x6ffd('0x32')]);_0x3d5193[_0x6ffd('0x3c')]=_[_0x6ffd('0x35')](_0x3d5193[_0x6ffd('0x31')],_0x3d5193[_0x6ffd('0x32')]);_0x51ae8d[_0x6ffd('0x34')]=_[_0x6ffd('0x35')](_0x3d5193[_0x6ffd('0x31')],qs['fields'](_0x3bcac8['query']['fields']));_0x51ae8d[_0x6ffd('0x34')]=_0x51ae8d[_0x6ffd('0x34')]['length']?_0x51ae8d[_0x6ffd('0x34')]:_0x3d5193[_0x6ffd('0x31')];if(_0x3bcac8[_0x6ffd('0x32')][_0x6ffd('0x42')]){_0x51ae8d[_0x6ffd('0x43')]=[{'all':!![]}];}_0x51ae8d=_['merge']({},_0x51ae8d,_0x3bcac8[_0x6ffd('0x41')]);return db[_0x6ffd('0x2c')][_0x6ffd('0x47')](_0x51ae8d)['then'](handleEntityNotFound(_0x162259,null))[_0x6ffd('0x28')](respondWithResult(_0x162259,null))[_0x6ffd('0x48')](handleError(_0x162259,null));};exports[_0x6ffd('0x49')]=function(_0xc513d4,_0x4184fe){return db[_0x6ffd('0x2c')]['create'](_0xc513d4[_0x6ffd('0x4a')],{})[_0x6ffd('0x28')](respondWithResult(_0x4184fe,0xc9))[_0x6ffd('0x48')](handleError(_0x4184fe,null));};exports[_0x6ffd('0x26')]=function(_0x43399c,_0x3d6221){if(_0x43399c[_0x6ffd('0x4a')]['id']){delete _0x43399c['body']['id'];}return db[_0x6ffd('0x2c')][_0x6ffd('0x47')]({'where':{'id':_0x43399c['params']['id']}})['then'](handleEntityNotFound(_0x3d6221,null))['then'](saveUpdates(_0x43399c[_0x6ffd('0x4a')],null))['then'](respondWithResult(_0x3d6221,null))[_0x6ffd('0x48')](handleError(_0x3d6221,null));};exports[_0x6ffd('0x27')]=function(_0x212578,_0x1fe3a4){return db['MailQueueReport'][_0x6ffd('0x47')]({'where':{'id':_0x212578[_0x6ffd('0x46')]['id']}})[_0x6ffd('0x28')](handleEntityNotFound(_0x1fe3a4,null))['then'](removeEntity(_0x1fe3a4,null))[_0x6ffd('0x48')](handleError(_0x1fe3a4,null));};exports[_0x6ffd('0x4b')]=function(_0x4aa024,_0x528284){return db[_0x6ffd('0x2c')][_0x6ffd('0x4b')]()[_0x6ffd('0x28')](respondWithResult(_0x528284,null))[_0x6ffd('0x48')](handleError(_0x528284,null));}; \ No newline at end of file +var _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3eae52,_0x1352cc){var _0x2794db=function(_0x523ad){while(--_0x523ad){_0x3eae52['push'](_0x3eae52['shift']());}};_0x2794db(++_0x1352cc);}(_0x524e,0x15e));var _0xe524=function(_0x12c55f,_0x1d5d48){_0x12c55f=_0x12c55f-0x0;var _0x6ba07e=_0x524e[_0x12c55f];return _0x6ba07e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['MailQueueReport'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['MailQueueReport'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['MailQueueReport'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ac8e8d9..efa8645 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 _0xaafb=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xaafb,0x1ba));var _0xbaaf=function(_0x138c0a,_0x3d6ab5){_0x138c0a=_0x138c0a-0x0;var _0x266b3f=_0xaafb[_0x138c0a];return _0x266b3f;};'use strict';var _=require(_0xbaaf('0x0'));var util=require(_0xbaaf('0x1'));var logger=require(_0xbaaf('0x2'))('api');var moment=require(_0xbaaf('0x3'));var BPromise=require(_0xbaaf('0x4'));var rp=require(_0xbaaf('0x5'));var fs=require('fs');var path=require(_0xbaaf('0x6'));var rimraf=require(_0xbaaf('0x7'));var config=require('../../config/environment');var attributes=require(_0xbaaf('0x8'));module[_0xbaaf('0x9')]=function(_0x468341,_0x2ba067){return _0x468341[_0xbaaf('0xa')](_0xbaaf('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbaaf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69cf=['path','rimraf','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x2e84d9,_0x2d6f74){var _0x15f9a2=function(_0x523f58){while(--_0x523f58){_0x2e84d9['push'](_0x2e84d9['shift']());}};_0x15f9a2(++_0x2d6f74);}(_0x69cf,0x1b7));var _0xf69c=function(_0x4bd385,_0x3a3e0a){_0x4bd385=_0x4bd385-0x0;var _0x3bbd36=_0x69cf[_0x4bd385];return _0x3bbd36;};'use strict';var _=require(_0xf69c('0x0'));var util=require(_0xf69c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf69c('0x2'));var BPromise=require(_0xf69c('0x3'));var rp=require(_0xf69c('0x4'));var fs=require('fs');var path=require(_0xf69c('0x5'));var rimraf=require(_0xf69c('0x6'));var config=require('../../config/environment');var attributes=require(_0xf69c('0x7'));module[_0xf69c('0x8')]=function(_0x47b10b,_0x3216b1){return _0x47b10b['define'](_0xf69c('0x9'),attributes,{'tableName':_0xf69c('0xa'),'paranoid':![],'indexes':[{'name':_0xf69c('0xb'),'fields':[_0xf69c('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 cf913be..8ec907e 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x11e97c,_0x2babe8){var _0x1fcb0b=function(_0x322ff4){while(--_0x322ff4){_0x11e97c['push'](_0x11e97c['shift']());}};_0x1fcb0b(++_0x2babe8);}(_0x7a54,0x106));var _0x47a5=function(_0x54d6fb,_0x39a8c5){_0x54d6fb=_0x54d6fb-0x0;var _0x3fff3c=_0x7a54[_0x54d6fb];return _0x3fff3c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x29ac03,_0x2deb4a){var _0x26db6e=function(_0x3dbdbb){while(--_0x3dbdbb){_0x29ac03['push'](_0x29ac03['shift']());}};_0x26db6e(++_0x2deb4a);}(_0x326f,0xd1));var _0xf326=function(_0x433d66,_0x2df0ba){_0x433d66=_0x433d66-0x0;var _0x9517cf=_0x326f[_0x433d66];return _0x9517cf;};'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')]('MailQueueReport,\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')]('MailQueueReport,\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')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e4eb5c8..81eb1f5 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x42d5cc,_0x4ab82f){var _0x3daaca=function(_0x7951ec){while(--_0x7951ec){_0x42d5cc['push'](_0x42d5cc['shift']());}};_0x3daaca(++_0x4ab82f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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 38253b5..a696757 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 _0x6e42=['STRING','INTEGER','INBOX','BOOLEAN','sequelize','exports'];(function(_0x528864,_0x4cb24b){var _0x328557=function(_0x480dc9){while(--_0x480dc9){_0x528864['push'](_0x528864['shift']());}};_0x328557(++_0x4cb24b);}(_0x6e42,0x1f0));var _0x26e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e42[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x26e4('0x0'));module[_0x26e4('0x1')]={'description':{'type':Sequelize[_0x26e4('0x2')]},'host':{'type':Sequelize[_0x26e4('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x26e4('0x2')]},'password':{'type':Sequelize[_0x26e4('0x2')]},'port':{'type':Sequelize[_0x26e4('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x26e4('0x2')],'defaultValue':_0x26e4('0x4')},'connTimeout':{'type':Sequelize[_0x26e4('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x26e4('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x26e4('0x2')]},'modernAuthentication':{'type':Sequelize[_0x26e4('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xe7b4=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe7b4,0x19d));var _0x4e7b=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xe7b4[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x4e7b('0x0'));module[_0x4e7b('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4e7b('0x2')]},'authentication':{'type':Sequelize[_0x4e7b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4e7b('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4e7b('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4e7b('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4e7b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 95eaf9f..c829e01 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 _0x0da5=['path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','util','../../config/logger','bluebird'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0x0da5,0x74));var _0x50da=function(_0x4a9874,_0x1fc8b3){_0x4a9874=_0x4a9874-0x0;var _0xdd976a=_0x0da5[_0x4a9874];return _0xdd976a;};'use strict';var _=require(_0x50da('0x0'));var util=require(_0x50da('0x1'));var logger=require(_0x50da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x50da('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50da('0x4'));var rimraf=require('rimraf');var config=require(_0x50da('0x5'));var attributes=require(_0x50da('0x6'));module[_0x50da('0x7')]=function(_0x4d354c,_0x37b619){return _0x4d354c[_0x50da('0x8')](_0x50da('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4d2=['moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger'];(function(_0x30232e,_0x429580){var _0x1b5491=function(_0x377ecf){while(--_0x377ecf){_0x30232e['push'](_0x30232e['shift']());}};_0x1b5491(++_0x429580);}(_0xe4d2,0x1d2));var _0x2e4d=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0xe4d2[_0x21d36e];return _0x4cc307;};'use strict';var _=require(_0x2e4d('0x0'));var util=require('util');var logger=require(_0x2e4d('0x1'))('api');var moment=require(_0x2e4d('0x2'));var BPromise=require('bluebird');var rp=require(_0x2e4d('0x3'));var fs=require('fs');var path=require(_0x2e4d('0x4'));var rimraf=require(_0x2e4d('0x5'));var config=require(_0x2e4d('0x6'));var attributes=require(_0x2e4d('0x7'));module[_0x2e4d('0x8')]=function(_0x403757,_0x4920ae){return _0x403757[_0x2e4d('0x9')](_0x2e4d('0xa'),attributes,{'tableName':_0x2e4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 8478869..5203b89 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 _0x14d1=['include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','message','error','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','findAll','options','raw','attributes','limit'];(function(_0x56e262,_0x5a3e7e){var _0x381e4b=function(_0x112eb7){while(--_0x112eb7){_0x56e262['push'](_0x56e262['shift']());}};_0x381e4b(++_0x5a3e7e);}(_0x14d1,0xc3));var _0x114d=function(_0x21739c,_0x5926c4){_0x21739c=_0x21739c-0x0;var _0x40e0a2=_0x14d1[_0x21739c];return _0x40e0a2;};'use strict';var _=require('lodash');var util=require(_0x114d('0x0'));var moment=require(_0x114d('0x1'));var BPromise=require(_0x114d('0x2'));var rs=require(_0x114d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x114d('0x4'))['db'];var utils=require(_0x114d('0x5'));var logger=require('../../config/logger')(_0x114d('0x6'));var config=require('../../config/environment');var jayson=require(_0x114d('0x7'));var client=jayson[_0x114d('0x8')][_0x114d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3092b1,_0x57209c,_0x10faa4){return new BPromise(function(_0x3aac3b,_0xbca815){return client[_0x114d('0xa')](_0x3092b1,_0x10faa4)[_0x114d('0xb')](function(_0x216f27){logger[_0x114d('0xc')]('MailServerIn,\x20%s,\x20%s',_0x57209c,_0x114d('0xd'));logger[_0x114d('0xe')](_0x114d('0xf'),_0x57209c,'request\x20sent',JSON[_0x114d('0x10')](_0x216f27));if(_0x216f27['error']){if(_0x216f27['error'][_0x114d('0x11')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x57209c,_0x216f27['error'][_0x114d('0x12')]);return _0xbca815(_0x216f27[_0x114d('0x13')][_0x114d('0x12')]);}logger['error'](_0x114d('0x14'),_0x57209c,_0x216f27[_0x114d('0x13')]['message']);return _0x3aac3b(_0x216f27[_0x114d('0x13')][_0x114d('0x12')]);}else{logger[_0x114d('0xc')]('MailServerIn,\x20%s,\x20%s',_0x57209c,_0x114d('0xd'));_0x3aac3b(_0x216f27[_0x114d('0x15')]['message']);}})[_0x114d('0x16')](function(_0x243a91){logger[_0x114d('0x13')](_0x114d('0x14'),_0x57209c,_0x243a91);_0xbca815(_0x243a91);});});}exports[_0x114d('0x17')]=function(_0x37a763){var _0x5dc443=this;return new Promise(function(_0x336979,_0x3c6f28){return db['MailServerIn'][_0x114d('0x18')]({'raw':_0x37a763[_0x114d('0x19')]?_0x37a763[_0x114d('0x19')][_0x114d('0x1a')]===undefined?!![]:![]:!![],'where':_0x37a763['options']?_0x37a763[_0x114d('0x19')]['where']||null:null,'attributes':_0x37a763['options']?_0x37a763[_0x114d('0x19')][_0x114d('0x1b')]||null:null,'limit':_0x37a763[_0x114d('0x19')]?_0x37a763[_0x114d('0x19')][_0x114d('0x1c')]||null:null,'include':_0x37a763[_0x114d('0x19')]?_0x37a763[_0x114d('0x19')][_0x114d('0x1d')]?_[_0x114d('0x1e')](_0x37a763['options'][_0x114d('0x1d')],function(_0x58e9e3){return{'model':db[_0x58e9e3['model']],'as':_0x58e9e3['as'],'attributes':_0x58e9e3['attributes'],'include':_0x58e9e3[_0x114d('0x1d')]?_['map'](_0x58e9e3['include'],function(_0x3cb989){return{'model':db[_0x3cb989[_0x114d('0x1f')]],'as':_0x3cb989['as'],'attributes':_0x3cb989[_0x114d('0x1b')],'include':_0x3cb989[_0x114d('0x1d')]?_[_0x114d('0x1e')](_0x3cb989[_0x114d('0x1d')],function(_0x38e842){return{'model':db[_0x38e842[_0x114d('0x1f')]],'as':_0x38e842['as'],'attributes':_0x38e842['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a00bb){logger[_0x114d('0xc')]('GetMailServerIn',_0x37a763);logger[_0x114d('0xe')]('GetMailServerIn',_0x37a763,JSON[_0x114d('0x10')](_0x4a00bb));_0x336979(_0x4a00bb);})[_0x114d('0x16')](function(_0x40f9bf){logger['error'](_0x114d('0x17'),_0x40f9bf[_0x114d('0x12')],_0x37a763);_0x3c6f28(_0x5dc443['error'](0x1f4,_0x40f9bf[_0x114d('0x12')]));});});}; \ No newline at end of file +var _0x6d4a=['error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','attributes','limit','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x522c93,_0x55b14c){var _0x4a7737=function(_0x4f95e4){while(--_0x4f95e4){_0x522c93['push'](_0x522c93['shift']());}};_0x4a7737(++_0x55b14c);}(_0x6d4a,0x117));var _0xa6d4=function(_0x541712,_0x1f4bae){_0x541712=_0x541712-0x0;var _0x3ea5db=_0x6d4a[_0x541712];return _0x3ea5db;};'use strict';var _=require(_0xa6d4('0x0'));var util=require('util');var moment=require(_0xa6d4('0x1'));var BPromise=require(_0xa6d4('0x2'));var rs=require(_0xa6d4('0x3'));var fs=require('fs');var Redis=require(_0xa6d4('0x4'));var db=require(_0xa6d4('0x5'))['db'];var utils=require(_0xa6d4('0x6'));var logger=require(_0xa6d4('0x7'))(_0xa6d4('0x8'));var config=require(_0xa6d4('0x9'));var jayson=require(_0xa6d4('0xa'));var client=jayson[_0xa6d4('0xb')][_0xa6d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x354148,_0x444bf9,_0x49a9e8){return new BPromise(function(_0x71ccfa,_0xc6d920){return client['request'](_0x354148,_0x49a9e8)[_0xa6d4('0xd')](function(_0x36af3a){logger[_0xa6d4('0xe')](_0xa6d4('0xf'),_0x444bf9,_0xa6d4('0x10'));logger['debug'](_0xa6d4('0x11'),_0x444bf9,_0xa6d4('0x10'),JSON['stringify'](_0x36af3a));if(_0x36af3a[_0xa6d4('0x12')]){if(_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x13')]===0x1f4){logger['error'](_0xa6d4('0xf'),_0x444bf9,_0x36af3a['error'][_0xa6d4('0x14')]);return _0xc6d920(_0x36af3a[_0xa6d4('0x12')]['message']);}logger[_0xa6d4('0x12')](_0xa6d4('0xf'),_0x444bf9,_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x14')]);return _0x71ccfa(_0x36af3a[_0xa6d4('0x12')][_0xa6d4('0x14')]);}else{logger[_0xa6d4('0xe')](_0xa6d4('0xf'),_0x444bf9,_0xa6d4('0x10'));_0x71ccfa(_0x36af3a[_0xa6d4('0x15')][_0xa6d4('0x14')]);}})[_0xa6d4('0x16')](function(_0x518a73){logger[_0xa6d4('0x12')]('MailServerIn,\x20%s,\x20%s',_0x444bf9,_0x518a73);_0xc6d920(_0x518a73);});});}exports[_0xa6d4('0x17')]=function(_0x474b62){var _0x4533ea=this;return new Promise(function(_0x4a7af1,_0x12226a){return db[_0xa6d4('0x18')]['findAll']({'raw':_0x474b62[_0xa6d4('0x19')]?_0x474b62[_0xa6d4('0x19')][_0xa6d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x474b62[_0xa6d4('0x19')]?_0x474b62[_0xa6d4('0x19')]['where']||null:null,'attributes':_0x474b62[_0xa6d4('0x19')]?_0x474b62[_0xa6d4('0x19')][_0xa6d4('0x1b')]||null:null,'limit':_0x474b62['options']?_0x474b62['options'][_0xa6d4('0x1c')]||null:null,'include':_0x474b62[_0xa6d4('0x19')]?_0x474b62[_0xa6d4('0x19')][_0xa6d4('0x1d')]?_[_0xa6d4('0x1e')](_0x474b62[_0xa6d4('0x19')]['include'],function(_0x1bf8cb){return{'model':db[_0x1bf8cb[_0xa6d4('0x1f')]],'as':_0x1bf8cb['as'],'attributes':_0x1bf8cb[_0xa6d4('0x1b')],'include':_0x1bf8cb[_0xa6d4('0x1d')]?_[_0xa6d4('0x1e')](_0x1bf8cb[_0xa6d4('0x1d')],function(_0x4dca66){return{'model':db[_0x4dca66[_0xa6d4('0x1f')]],'as':_0x4dca66['as'],'attributes':_0x4dca66['attributes'],'include':_0x4dca66[_0xa6d4('0x1d')]?_['map'](_0x4dca66[_0xa6d4('0x1d')],function(_0xf2f536){return{'model':db[_0xf2f536[_0xa6d4('0x1f')]],'as':_0xf2f536['as'],'attributes':_0xf2f536['attributes']};}):[]};}):[]};}):[]:[]})[_0xa6d4('0xd')](function(_0xded510){logger['info'](_0xa6d4('0x17'),_0x474b62);logger[_0xa6d4('0x20')]('GetMailServerIn',_0x474b62,JSON['stringify'](_0xded510));_0x4a7af1(_0xded510);})[_0xa6d4('0x16')](function(_0x378bf6){logger[_0xa6d4('0x12')]('GetMailServerIn',_0x378bf6[_0xa6d4('0x14')],_0x474b62);_0x12226a(_0x4533ea[_0xa6d4('0x12')](0x1f4,_0x378bf6[_0xa6d4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4152ef2..ba6f7dd 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(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x964b55,_0x55423d){_0x964b55=_0x964b55-0x0;var _0x238708=_0x7a54[_0x964b55];return _0x238708;};'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 _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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2e6f65,_0x15bc91){_0x2e6f65=_0x2e6f65-0x0;var _0x3ac7cf=_0x7a54[_0x2e6f65];return _0x3ac7cf;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 3efc398..837a4c1 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 _0x3de3=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x23a6ea,_0x4855e2){var _0x157ecc=function(_0x50e577){while(--_0x50e577){_0x23a6ea['push'](_0x23a6ea['shift']());}};_0x157ecc(++_0x4855e2);}(_0x3de3,0x1ce));var _0x33de=function(_0x4fb01e,_0x55b482){_0x4fb01e=_0x4fb01e-0x0;var _0x2febc5=_0x3de3[_0x4fb01e];return _0x2febc5;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'description':{'type':Sequelize[_0x33de('0x1')]},'host':{'type':Sequelize[_0x33de('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x33de('0x1')]},'port':{'type':Sequelize[_0x33de('0x2')]},'secure':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x33de('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf45e=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x4da1d4,_0x32effe){var _0x3dad48=function(_0x282572){while(--_0x282572){_0x4da1d4['push'](_0x4da1d4['shift']());}};_0x3dad48(++_0x32effe);}(_0xf45e,0x115));var _0xef45=function(_0x36ccc9,_0x18f541){_0x36ccc9=_0x36ccc9-0x0;var _0x1e933b=_0xf45e[_0x36ccc9];return _0x1e933b;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'description':{'type':Sequelize[_0xef45('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xef45('0x1')]},'pass':{'type':Sequelize[_0xef45('0x1')]},'port':{'type':Sequelize[_0xef45('0x2')]},'secure':{'type':Sequelize[_0xef45('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xef45('0x1')]},'authentication':{'type':Sequelize[_0xef45('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xef45('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 8009406..c03d7a6 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 _0x4216=['../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0x4216,0x1d3));var _0x6421=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4216[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x6421('0x0'));var rimraf=require(_0x6421('0x1'));var zipdir=require(_0x6421('0x2'));var jsonpatch=require(_0x6421('0x3'));var rp=require('request-promise');var moment=require(_0x6421('0x4'));var BPromise=require(_0x6421('0x5'));var Mustache=require(_0x6421('0x6'));var util=require(_0x6421('0x7'));var path=require(_0x6421('0x8'));var sox=require(_0x6421('0x9'));var csv=require(_0x6421('0xa'));var ejs=require(_0x6421('0xb'));var fs=require('fs');var fs_extra=require(_0x6421('0xc'));var _=require(_0x6421('0xd'));var squel=require(_0x6421('0xe'));var crypto=require(_0x6421('0xf'));var jsforce=require(_0x6421('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6421('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6421('0x11'));var authService=require(_0x6421('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6421('0x13'));var hardwareService=require(_0x6421('0x14'));var logger=require(_0x6421('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6421('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6421('0x17'))['db'];function respondWithStatusCode(_0x5c9ac8,_0x8d907b){_0x8d907b=_0x8d907b||0xcc;return function(_0x32c319){if(_0x32c319){return _0x5c9ac8[_0x6421('0x18')](_0x8d907b);}return _0x5c9ac8['status'](_0x8d907b)[_0x6421('0x19')]();};}function respondWithResult(_0x1b3a42,_0x5f354f){_0x5f354f=_0x5f354f||0xc8;return function(_0x57f7eb){if(_0x57f7eb){return _0x1b3a42[_0x6421('0x1a')](_0x5f354f)[_0x6421('0x1b')](_0x57f7eb);}};}function respondWithFilteredResult(_0x19c77f,_0x13f683){return function(_0x2d2670){if(_0x2d2670){var _0x31ecf9=typeof _0x13f683[_0x6421('0x1c')]==='undefined'&&typeof _0x13f683['limit']===_0x6421('0x1d');var _0x4c5e7f=_0x2d2670[_0x6421('0x1e')];var _0x15b338=_0x31ecf9?0x0:_0x13f683[_0x6421('0x1c')];var _0x393842=_0x31ecf9?_0x2d2670['count']:_0x13f683[_0x6421('0x1c')]+_0x13f683['limit'];var _0x1c7c00;if(_0x393842>=_0x4c5e7f){_0x393842=_0x4c5e7f;_0x1c7c00=0xc8;}else{_0x1c7c00=0xce;}_0x19c77f['status'](_0x1c7c00);return _0x19c77f['set'](_0x6421('0x1f'),_0x15b338+'-'+_0x393842+'/'+_0x4c5e7f)[_0x6421('0x1b')](_0x2d2670);}return null;};}function patchUpdates(_0x5662be){return function(_0x11b0f4){try{jsonpatch[_0x6421('0x20')](_0x11b0f4,_0x5662be,!![]);}catch(_0x9602a2){return BPromise[_0x6421('0x21')](_0x9602a2);}return _0x11b0f4[_0x6421('0x22')]();};}function saveUpdates(_0x8ce592,_0x2ea1f2){return function(_0x2d0983){if(_0x2d0983){return _0x2d0983[_0x6421('0x23')](_0x8ce592)['then'](function(_0x19f0ce){return _0x19f0ce;});}return null;};}function removeEntity(_0x2e2e99,_0xc9c438){return function(_0x3e3d00){if(_0x3e3d00){return _0x3e3d00[_0x6421('0x24')]()[_0x6421('0x25')](function(){_0x2e2e99[_0x6421('0x1a')](0xcc)[_0x6421('0x19')]();});}};}function handleEntityNotFound(_0x1e2c05,_0x55e101){return function(_0x39f9c8){if(!_0x39f9c8){_0x1e2c05[_0x6421('0x18')](0x194);}return _0x39f9c8;};}function handleError(_0x187767,_0x38a0ad){_0x38a0ad=_0x38a0ad||0x1f4;return function(_0x386ae1){logger[_0x6421('0x26')](_0x386ae1[_0x6421('0x27')]);if(_0x386ae1[_0x6421('0x28')]){delete _0x386ae1['name'];}_0x187767[_0x6421('0x1a')](_0x38a0ad)[_0x6421('0x29')](_0x386ae1);};}exports[_0x6421('0x2a')]=function(_0x20985f,_0x46014b){var _0xc60dbf={},_0x455885={},_0xf4c1df={'count':0x0,'rows':[]};var _0x573bef=_['map'](db[_0x6421('0x2b')][_0x6421('0x2c')],function(_0x668d79){return{'name':_0x668d79[_0x6421('0x2d')],'type':_0x668d79[_0x6421('0x2e')]['key']};});_0x455885[_0x6421('0x2f')]=_[_0x6421('0x30')](_0x573bef,'name');_0x455885[_0x6421('0x31')]=_[_0x6421('0x32')](_0x20985f[_0x6421('0x31')]);_0x455885[_0x6421('0x33')]=_[_0x6421('0x34')](_0x455885[_0x6421('0x2f')],_0x455885['query']);_0xc60dbf[_0x6421('0x35')]=_['intersection'](_0x455885[_0x6421('0x2f')],qs[_0x6421('0x36')](_0x20985f[_0x6421('0x31')]['fields']));_0xc60dbf['attributes']=_0xc60dbf[_0x6421('0x35')][_0x6421('0x37')]?_0xc60dbf[_0x6421('0x35')]:_0x455885[_0x6421('0x2f')];if(!_0x20985f[_0x6421('0x31')][_0x6421('0x38')]('nolimit')){_0xc60dbf[_0x6421('0x39')]=qs['limit'](_0x20985f['query']['limit']);_0xc60dbf[_0x6421('0x1c')]=qs[_0x6421('0x1c')](_0x20985f[_0x6421('0x31')][_0x6421('0x1c')]);}_0xc60dbf['order']=qs['sort'](_0x20985f[_0x6421('0x31')][_0x6421('0x3a')]);_0xc60dbf[_0x6421('0x3b')]=qs[_0x6421('0x33')](_[_0x6421('0x3c')](_0x20985f[_0x6421('0x31')],_0x455885[_0x6421('0x33')]),_0x573bef);if(_0x20985f[_0x6421('0x31')]['filter']){_0xc60dbf[_0x6421('0x3b')]=_[_0x6421('0x3d')](_0xc60dbf['where'],{'$or':_[_0x6421('0x30')](_0x573bef,function(_0xc7b349){if(_0xc7b349[_0x6421('0x2e')]!==_0x6421('0x3e')){var _0x57a05d={};_0x57a05d[_0xc7b349[_0x6421('0x28')]]={'$like':'%'+_0x20985f[_0x6421('0x31')]['filter']+'%'};return _0x57a05d;}})});}_0xc60dbf=_['merge']({},_0xc60dbf,_0x20985f[_0x6421('0x3f')]);var _0x1c6408={'where':_0xc60dbf[_0x6421('0x3b')]};return db[_0x6421('0x2b')][_0x6421('0x1e')](_0x1c6408)[_0x6421('0x25')](function(_0x91beb1){_0xf4c1df[_0x6421('0x1e')]=_0x91beb1;if(_0x20985f[_0x6421('0x31')][_0x6421('0x40')]){_0xc60dbf[_0x6421('0x41')]=[{'all':!![]}];}return db[_0x6421('0x2b')]['findAll'](_0xc60dbf);})[_0x6421('0x25')](function(_0x2d64b1){_0xf4c1df['rows']=_0x2d64b1;return _0xf4c1df;})[_0x6421('0x25')](respondWithFilteredResult(_0x46014b,_0xc60dbf))['catch'](handleError(_0x46014b,null));};exports['show']=function(_0x745838,_0x539bd7){var _0x4fb0df={'raw':!![],'where':{'id':_0x745838['params']['id']}},_0x386f0b={};_0x386f0b[_0x6421('0x2f')]=_[_0x6421('0x32')](db['MailServerOut'][_0x6421('0x2c')]);_0x386f0b['query']=_['keys'](_0x745838['query']);_0x386f0b[_0x6421('0x33')]=_[_0x6421('0x34')](_0x386f0b['model'],_0x386f0b[_0x6421('0x31')]);_0x4fb0df[_0x6421('0x35')]=_['intersection'](_0x386f0b[_0x6421('0x2f')],qs[_0x6421('0x36')](_0x745838[_0x6421('0x31')][_0x6421('0x36')]));_0x4fb0df[_0x6421('0x35')]=_0x4fb0df[_0x6421('0x35')]['length']?_0x4fb0df[_0x6421('0x35')]:_0x386f0b[_0x6421('0x2f')];if(_0x745838['query'][_0x6421('0x40')]){_0x4fb0df[_0x6421('0x41')]=[{'all':!![]}];}_0x4fb0df=_[_0x6421('0x3d')]({},_0x4fb0df,_0x745838[_0x6421('0x3f')]);return db[_0x6421('0x2b')]['find'](_0x4fb0df)[_0x6421('0x25')](handleEntityNotFound(_0x539bd7,null))['then'](respondWithResult(_0x539bd7,null))[_0x6421('0x42')](handleError(_0x539bd7,null));};exports[_0x6421('0x43')]=function(_0x1fa08a,_0x42b6da){return db[_0x6421('0x2b')][_0x6421('0x43')](_0x1fa08a['body'],{})[_0x6421('0x25')](respondWithResult(_0x42b6da,0xc9))[_0x6421('0x42')](handleError(_0x42b6da,null));};exports[_0x6421('0x23')]=function(_0x3b483f,_0x3adf8c){if(_0x3b483f[_0x6421('0x44')]['id']){delete _0x3b483f['body']['id'];}return db['MailServerOut'][_0x6421('0x45')]({'where':{'id':_0x3b483f['params']['id']}})[_0x6421('0x25')](handleEntityNotFound(_0x3adf8c,null))[_0x6421('0x25')](saveUpdates(_0x3b483f[_0x6421('0x44')],null))[_0x6421('0x25')](respondWithResult(_0x3adf8c,null))[_0x6421('0x42')](handleError(_0x3adf8c,null));};exports[_0x6421('0x24')]=function(_0x266534,_0xee3629){return db[_0x6421('0x2b')][_0x6421('0x45')]({'where':{'id':_0x266534['params']['id']}})[_0x6421('0x25')](handleEntityNotFound(_0xee3629,null))['then'](removeEntity(_0xee3629,null))['catch'](handleError(_0xee3629,null));}; \ No newline at end of file +var _0xcc1e=['merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','MailServerOut','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc1e,0xeb));var _0xecc1=function(_0x3cdb16,_0x4e3bfe){_0x3cdb16=_0x3cdb16-0x0;var _0x1f0207=_0xcc1e[_0x3cdb16];return _0x1f0207;};'use strict';var emlformat=require(_0xecc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecc1('0x1'));var jsonpatch=require(_0xecc1('0x2'));var rp=require(_0xecc1('0x3'));var moment=require(_0xecc1('0x4'));var BPromise=require(_0xecc1('0x5'));var Mustache=require(_0xecc1('0x6'));var util=require(_0xecc1('0x7'));var path=require(_0xecc1('0x8'));var sox=require(_0xecc1('0x9'));var csv=require(_0xecc1('0xa'));var ejs=require(_0xecc1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xecc1('0xc'));var jsforce=require(_0xecc1('0xd'));var deskjs=require(_0xecc1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xecc1('0xf'));var Papa=require(_0xecc1('0x10'));var Redis=require(_0xecc1('0x11'));var authService=require(_0xecc1('0x12'));var qs=require(_0xecc1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecc1('0x14'));var logger=require(_0xecc1('0x15'))(_0xecc1('0x16'));var utils=require(_0xecc1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xecc1('0x18'));var db=require(_0xecc1('0x19'))['db'];function respondWithStatusCode(_0x37fce0,_0x302fad){_0x302fad=_0x302fad||0xcc;return function(_0x1af45b){if(_0x1af45b){return _0x37fce0[_0xecc1('0x1a')](_0x302fad);}return _0x37fce0[_0xecc1('0x1b')](_0x302fad)[_0xecc1('0x1c')]();};}function respondWithResult(_0x1b5b76,_0x1b429b){_0x1b429b=_0x1b429b||0xc8;return function(_0x26e84e){if(_0x26e84e){return _0x1b5b76[_0xecc1('0x1b')](_0x1b429b)['json'](_0x26e84e);}};}function respondWithFilteredResult(_0x186654,_0x7149c7){return function(_0x504885){if(_0x504885){var _0x4faa9b=typeof _0x7149c7[_0xecc1('0x1d')]===_0xecc1('0x1e')&&typeof _0x7149c7['limit']===_0xecc1('0x1e');var _0x2be61e=_0x504885[_0xecc1('0x1f')];var _0x54e9da=_0x4faa9b?0x0:_0x7149c7[_0xecc1('0x1d')];var _0x5513b=_0x4faa9b?_0x504885[_0xecc1('0x1f')]:_0x7149c7[_0xecc1('0x1d')]+_0x7149c7[_0xecc1('0x20')];var _0x17ddc7;if(_0x5513b>=_0x2be61e){_0x5513b=_0x2be61e;_0x17ddc7=0xc8;}else{_0x17ddc7=0xce;}_0x186654[_0xecc1('0x1b')](_0x17ddc7);return _0x186654['set'](_0xecc1('0x21'),_0x54e9da+'-'+_0x5513b+'/'+_0x2be61e)[_0xecc1('0x22')](_0x504885);}return null;};}function patchUpdates(_0x2d60ab){return function(_0xd819fc){try{jsonpatch[_0xecc1('0x23')](_0xd819fc,_0x2d60ab,!![]);}catch(_0x4e0734){return BPromise[_0xecc1('0x24')](_0x4e0734);}return _0xd819fc[_0xecc1('0x25')]();};}function saveUpdates(_0x2ae468,_0xe312c5){return function(_0x40569a){if(_0x40569a){return _0x40569a[_0xecc1('0x26')](_0x2ae468)[_0xecc1('0x27')](function(_0x3b926c){return _0x3b926c;});}return null;};}function removeEntity(_0x11bff1,_0xad9b43){return function(_0x18772a){if(_0x18772a){return _0x18772a[_0xecc1('0x28')]()['then'](function(){_0x11bff1[_0xecc1('0x1b')](0xcc)[_0xecc1('0x1c')]();});}};}function handleEntityNotFound(_0x46b265,_0x395f0e){return function(_0x329394){if(!_0x329394){_0x46b265[_0xecc1('0x1a')](0x194);}return _0x329394;};}function handleError(_0x49a063,_0x433b3e){_0x433b3e=_0x433b3e||0x1f4;return function(_0x25f930){logger['error'](_0x25f930[_0xecc1('0x29')]);if(_0x25f930[_0xecc1('0x2a')]){delete _0x25f930['name'];}_0x49a063[_0xecc1('0x1b')](_0x433b3e)[_0xecc1('0x2b')](_0x25f930);};}exports[_0xecc1('0x2c')]=function(_0x3765ee,_0x2a42db){var _0x5850bc={},_0xcd35cd={},_0x144af4={'count':0x0,'rows':[]};var _0x3181a2=_['map'](db[_0xecc1('0x2d')][_0xecc1('0x2e')],function(_0x166ff7){return{'name':_0x166ff7[_0xecc1('0x2f')],'type':_0x166ff7['type']['key']};});_0xcd35cd[_0xecc1('0x30')]=_[_0xecc1('0x31')](_0x3181a2,_0xecc1('0x2a'));_0xcd35cd[_0xecc1('0x32')]=_[_0xecc1('0x33')](_0x3765ee['query']);_0xcd35cd[_0xecc1('0x34')]=_['intersection'](_0xcd35cd['model'],_0xcd35cd['query']);_0x5850bc[_0xecc1('0x35')]=_[_0xecc1('0x36')](_0xcd35cd[_0xecc1('0x30')],qs[_0xecc1('0x37')](_0x3765ee[_0xecc1('0x32')][_0xecc1('0x37')]));_0x5850bc[_0xecc1('0x35')]=_0x5850bc[_0xecc1('0x35')][_0xecc1('0x38')]?_0x5850bc[_0xecc1('0x35')]:_0xcd35cd[_0xecc1('0x30')];if(!_0x3765ee['query'][_0xecc1('0x39')](_0xecc1('0x3a'))){_0x5850bc['limit']=qs[_0xecc1('0x20')](_0x3765ee[_0xecc1('0x32')]['limit']);_0x5850bc[_0xecc1('0x1d')]=qs[_0xecc1('0x1d')](_0x3765ee[_0xecc1('0x32')][_0xecc1('0x1d')]);}_0x5850bc[_0xecc1('0x3b')]=qs[_0xecc1('0x3c')](_0x3765ee[_0xecc1('0x32')][_0xecc1('0x3c')]);_0x5850bc['where']=qs[_0xecc1('0x34')](_[_0xecc1('0x3d')](_0x3765ee[_0xecc1('0x32')],_0xcd35cd[_0xecc1('0x34')]),_0x3181a2);if(_0x3765ee[_0xecc1('0x32')][_0xecc1('0x3e')]){_0x5850bc[_0xecc1('0x3f')]=_['merge'](_0x5850bc['where'],{'$or':_[_0xecc1('0x31')](_0x3181a2,function(_0x4cdeed){if(_0x4cdeed[_0xecc1('0x40')]!==_0xecc1('0x41')){var _0xf03527={};_0xf03527[_0x4cdeed[_0xecc1('0x2a')]]={'$like':'%'+_0x3765ee[_0xecc1('0x32')][_0xecc1('0x3e')]+'%'};return _0xf03527;}})});}_0x5850bc=_['merge']({},_0x5850bc,_0x3765ee[_0xecc1('0x42')]);var _0x18bacb={'where':_0x5850bc[_0xecc1('0x3f')]};return db['MailServerOut'][_0xecc1('0x1f')](_0x18bacb)['then'](function(_0x354f7b){_0x144af4['count']=_0x354f7b;if(_0x3765ee[_0xecc1('0x32')]['includeAll']){_0x5850bc['include']=[{'all':!![]}];}return db['MailServerOut'][_0xecc1('0x43')](_0x5850bc);})[_0xecc1('0x27')](function(_0x27ef16){_0x144af4[_0xecc1('0x44')]=_0x27ef16;return _0x144af4;})[_0xecc1('0x27')](respondWithFilteredResult(_0x2a42db,_0x5850bc))[_0xecc1('0x45')](handleError(_0x2a42db,null));};exports[_0xecc1('0x46')]=function(_0x3f410b,_0x3fe391){var _0x3ecc97={'raw':!![],'where':{'id':_0x3f410b[_0xecc1('0x47')]['id']}},_0x392019={};_0x392019[_0xecc1('0x30')]=_['keys'](db[_0xecc1('0x2d')][_0xecc1('0x2e')]);_0x392019[_0xecc1('0x32')]=_[_0xecc1('0x33')](_0x3f410b[_0xecc1('0x32')]);_0x392019[_0xecc1('0x34')]=_[_0xecc1('0x36')](_0x392019[_0xecc1('0x30')],_0x392019[_0xecc1('0x32')]);_0x3ecc97[_0xecc1('0x35')]=_[_0xecc1('0x36')](_0x392019['model'],qs[_0xecc1('0x37')](_0x3f410b['query'][_0xecc1('0x37')]));_0x3ecc97['attributes']=_0x3ecc97['attributes'][_0xecc1('0x38')]?_0x3ecc97[_0xecc1('0x35')]:_0x392019[_0xecc1('0x30')];if(_0x3f410b['query'][_0xecc1('0x48')]){_0x3ecc97['include']=[{'all':!![]}];}_0x3ecc97=_[_0xecc1('0x49')]({},_0x3ecc97,_0x3f410b['options']);return db[_0xecc1('0x2d')][_0xecc1('0x4a')](_0x3ecc97)['then'](handleEntityNotFound(_0x3fe391,null))['then'](respondWithResult(_0x3fe391,null))[_0xecc1('0x45')](handleError(_0x3fe391,null));};exports[_0xecc1('0x4b')]=function(_0x459284,_0x5ec5a8){return db[_0xecc1('0x2d')]['create'](_0x459284[_0xecc1('0x4c')],{})[_0xecc1('0x27')](respondWithResult(_0x5ec5a8,0xc9))['catch'](handleError(_0x5ec5a8,null));};exports['update']=function(_0x148461,_0xd68ddf){if(_0x148461[_0xecc1('0x4c')]['id']){delete _0x148461[_0xecc1('0x4c')]['id'];}return db[_0xecc1('0x2d')][_0xecc1('0x4a')]({'where':{'id':_0x148461[_0xecc1('0x47')]['id']}})[_0xecc1('0x27')](handleEntityNotFound(_0xd68ddf,null))[_0xecc1('0x27')](saveUpdates(_0x148461['body'],null))[_0xecc1('0x27')](respondWithResult(_0xd68ddf,null))[_0xecc1('0x45')](handleError(_0xd68ddf,null));};exports[_0xecc1('0x28')]=function(_0x2e6ffa,_0x4c359b){return db[_0xecc1('0x2d')][_0xecc1('0x4a')]({'where':{'id':_0x2e6ffa[_0xecc1('0x47')]['id']}})[_0xecc1('0x27')](handleEntityNotFound(_0x4c359b,null))[_0xecc1('0x27')](removeEntity(_0x4c359b,null))['catch'](handleError(_0x4c359b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 5361009..c75f4b2 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 _0x4563=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x4563,0x14b));var _0x3456=function(_0x39f7d4,_0x3763f5){_0x39f7d4=_0x39f7d4-0x0;var _0x564b64=_0x4563[_0x39f7d4];return _0x564b64;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3456('0x0'))(_0x3456('0x1'));var moment=require(_0x3456('0x2'));var BPromise=require(_0x3456('0x3'));var rp=require(_0x3456('0x4'));var fs=require('fs');var path=require(_0x3456('0x5'));var rimraf=require(_0x3456('0x6'));var config=require(_0x3456('0x7'));var attributes=require(_0x3456('0x8'));module[_0x3456('0x9')]=function(_0x32142c,_0x3b9183){return _0x32142c[_0x3456('0xa')](_0x3456('0xb'),attributes,{'tableName':_0x3456('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca40=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','api','request-promise','path'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0xca40,0x193));var _0x0ca4=function(_0x5c7e53,_0x174ce5){_0x5c7e53=_0x5c7e53-0x0;var _0x1c9af9=_0xca40[_0x5c7e53];return _0x1c9af9;};'use strict';var _=require(_0x0ca4('0x0'));var util=require('util');var logger=require(_0x0ca4('0x1'))(_0x0ca4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ca4('0x3'));var fs=require('fs');var path=require(_0x0ca4('0x4'));var rimraf=require(_0x0ca4('0x5'));var config=require(_0x0ca4('0x6'));var attributes=require(_0x0ca4('0x7'));module[_0x0ca4('0x8')]=function(_0x594555,_0x38954b){return _0x594555[_0x0ca4('0x9')](_0x0ca4('0xa'),attributes,{'tableName':_0x0ca4('0xb'),'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 5afce78..859a46d 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0xadb5,0xad));var _0x5adb=function(_0x256198,_0x415247){_0x256198=_0x256198-0x0;var _0x5baee7=_0xadb5[_0x256198];return _0x5baee7;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x304767,_0x4b0ca1){var _0x4929c6=function(_0x292e62){while(--_0x292e62){_0x304767['push'](_0x304767['shift']());}};_0x4929c6(++_0x4b0ca1);}(_0xdb28,0x106));var _0x8db2=function(_0xfb4901,_0x4eafe1){_0xfb4901=_0xfb4901-0x0;var _0x11d09e=_0xdb28[_0xfb4901];return _0x11d09e;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5c512ac..b44a739 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 _0x7e32=['describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7e32,0x1b8));var _0x27e3=function(_0x2baa3c,_0x16a263){_0x2baa3c=_0x2baa3c-0x0;var _0x491c73=_0x7e32[_0x2baa3c];return _0x491c73;};'use strict';var multer=require(_0x27e3('0x0'));var util=require(_0x27e3('0x1'));var path=require(_0x27e3('0x2'));var timeout=require(_0x27e3('0x3'));var express=require(_0x27e3('0x4'));var router=express[_0x27e3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x27e3('0x6'));var config=require(_0x27e3('0x7'));var controller=require('./mailSubstatus.controller');router[_0x27e3('0x8')]('/',auth[_0x27e3('0x9')](),controller['index']);router[_0x27e3('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x27e3('0xa')]);router[_0x27e3('0x8')](_0x27e3('0xb'),auth[_0x27e3('0x9')](),controller['show']);router[_0x27e3('0xc')]('/',auth['isAuthenticated'](),controller[_0x27e3('0xd')]);router[_0x27e3('0xe')](_0x27e3('0xb'),auth['isAuthenticated'](),controller[_0x27e3('0xf')]);router[_0x27e3('0x10')](_0x27e3('0xb'),auth[_0x27e3('0x9')](),controller[_0x27e3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd379=['get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index'];(function(_0x242700,_0x21a5bf){var _0x5116eb=function(_0x27c93d){while(--_0x27c93d){_0x242700['push'](_0x242700['shift']());}};_0x5116eb(++_0x21a5bf);}(_0xd379,0x14e));var _0x9d37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd379[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d37('0x0')]();var fs_extra=require(_0x9d37('0x1'));var auth=require(_0x9d37('0x2'));var interaction=require(_0x9d37('0x3'));var config=require(_0x9d37('0x4'));var controller=require(_0x9d37('0x5'));router['get']('/',auth[_0x9d37('0x6')](),controller[_0x9d37('0x7')]);router[_0x9d37('0x8')](_0x9d37('0x9'),auth[_0x9d37('0x6')](),controller['describe']);router[_0x9d37('0x8')](_0x9d37('0xa'),auth[_0x9d37('0x6')](),controller[_0x9d37('0xb')]);router[_0x9d37('0xc')]('/',auth[_0x9d37('0x6')](),controller[_0x9d37('0xd')]);router[_0x9d37('0xe')](_0x9d37('0xa'),auth['isAuthenticated'](),controller[_0x9d37('0xf')]);router[_0x9d37('0x10')](_0x9d37('0xa'),auth[_0x9d37('0x6')](),controller[_0x9d37('0x11')]);module[_0x9d37('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7b5387b..763e1f8 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 _0xcde7=['name','STRING'];(function(_0x2c3483,_0x22f134){var _0x4e945f=function(_0x5a1575){while(--_0x5a1575){_0x2c3483['push'](_0x2c3483['shift']());}};_0x4e945f(++_0x22f134);}(_0xcde7,0x65));var _0x7cde=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcde7[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7cde('0x0')],'unique':_0x7cde('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7cde('0x0')]}}; \ No newline at end of file +var _0xcf98=['exports','STRING','name'];(function(_0x4d4282,_0x47388c){var _0x540385=function(_0x17f501){while(--_0x17f501){_0x4d4282['push'](_0x4d4282['shift']());}};_0x540385(++_0x47388c);}(_0xcf98,0x8d));var _0x8cf9=function(_0x109837,_0x450fe6){_0x109837=_0x109837-0x0;var _0x537f6c=_0xcf98[_0x109837];return _0x537f6c;};'use strict';var Sequelize=require('sequelize');module[_0x8cf9('0x0')]={'name':{'type':Sequelize[_0x8cf9('0x1')],'unique':_0x8cf9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8cf9('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1593a21..ac0a3b6 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 _0x4790=['name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4790,0x19c));var _0x0479=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x4790[_0x236c89];return _0x3b2a15;};'use strict';var emlformat=require(_0x0479('0x0'));var rimraf=require(_0x0479('0x1'));var zipdir=require(_0x0479('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0479('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0479('0x4'));var util=require(_0x0479('0x5'));var path=require(_0x0479('0x6'));var sox=require('sox');var csv=require(_0x0479('0x7'));var ejs=require(_0x0479('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0479('0x9'));var crypto=require('crypto');var jsforce=require(_0x0479('0xa'));var deskjs=require(_0x0479('0xb'));var toCsv=require(_0x0479('0x7'));var querystring=require(_0x0479('0xc'));var Papa=require(_0x0479('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0479('0xe'));var as=require(_0x0479('0xf'));var hardwareService=require(_0x0479('0x10'));var logger=require('../../config/logger')(_0x0479('0x11'));var utils=require(_0x0479('0x12'));var config=require(_0x0479('0x13'));var licenseUtil=require(_0x0479('0x14'));var db=require(_0x0479('0x15'))['db'];function respondWithStatusCode(_0xb048a2,_0x4a6da2){_0x4a6da2=_0x4a6da2||0xcc;return function(_0x56697f){if(_0x56697f){return _0xb048a2['sendStatus'](_0x4a6da2);}return _0xb048a2[_0x0479('0x16')](_0x4a6da2)[_0x0479('0x17')]();};}function respondWithResult(_0x48bc8b,_0x39049c){_0x39049c=_0x39049c||0xc8;return function(_0x3644d6){if(_0x3644d6){return _0x48bc8b[_0x0479('0x16')](_0x39049c)['json'](_0x3644d6);}};}function respondWithFilteredResult(_0x64531,_0x5c2767){return function(_0x5de3d0){if(_0x5de3d0){var _0x9d183c=typeof _0x5c2767[_0x0479('0x18')]==='undefined'&&typeof _0x5c2767[_0x0479('0x19')]===_0x0479('0x1a');var _0x3705a6=_0x5de3d0['count'];var _0x465d02=_0x9d183c?0x0:_0x5c2767[_0x0479('0x18')];var _0x2aacba=_0x9d183c?_0x5de3d0['count']:_0x5c2767[_0x0479('0x18')]+_0x5c2767[_0x0479('0x19')];var _0xe39deb;if(_0x2aacba>=_0x3705a6){_0x2aacba=_0x3705a6;_0xe39deb=0xc8;}else{_0xe39deb=0xce;}_0x64531['status'](_0xe39deb);return _0x64531[_0x0479('0x1b')](_0x0479('0x1c'),_0x465d02+'-'+_0x2aacba+'/'+_0x3705a6)[_0x0479('0x1d')](_0x5de3d0);}return null;};}function patchUpdates(_0x471b2d){return function(_0x433868){try{jsonpatch[_0x0479('0x1e')](_0x433868,_0x471b2d,!![]);}catch(_0x2cd1d8){return BPromise[_0x0479('0x1f')](_0x2cd1d8);}return _0x433868[_0x0479('0x20')]();};}function saveUpdates(_0x7ef357,_0x42b2f8){return function(_0x4ab027){if(_0x4ab027){return _0x4ab027[_0x0479('0x21')](_0x7ef357)[_0x0479('0x22')](function(_0x3ee17e){return _0x3ee17e;});}return null;};}function removeEntity(_0x3790f5,_0x20afaa){return function(_0x170a19){if(_0x170a19){return _0x170a19[_0x0479('0x23')]()['then'](function(){_0x3790f5[_0x0479('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x892409,_0x305586){return function(_0x14421e){if(!_0x14421e){_0x892409['sendStatus'](0x194);}return _0x14421e;};}function handleError(_0x2bd88d,_0x4ff49c){_0x4ff49c=_0x4ff49c||0x1f4;return function(_0x1415cb){logger[_0x0479('0x24')](_0x1415cb[_0x0479('0x25')]);if(_0x1415cb[_0x0479('0x26')]){delete _0x1415cb[_0x0479('0x26')];}_0x2bd88d['status'](_0x4ff49c)[_0x0479('0x27')](_0x1415cb);};}exports[_0x0479('0x28')]=function(_0x146bf8,_0xffabf1){var _0x4b8170={},_0x3e8c7b={},_0x47870b={'count':0x0,'rows':[]};var _0x321d53=_[_0x0479('0x29')](db[_0x0479('0x2a')][_0x0479('0x2b')],function(_0x485957){return{'name':_0x485957[_0x0479('0x2c')],'type':_0x485957[_0x0479('0x2d')]['key']};});_0x3e8c7b[_0x0479('0x2e')]=_['map'](_0x321d53,_0x0479('0x26'));_0x3e8c7b[_0x0479('0x2f')]=_[_0x0479('0x30')](_0x146bf8[_0x0479('0x2f')]);_0x3e8c7b[_0x0479('0x31')]=_[_0x0479('0x32')](_0x3e8c7b[_0x0479('0x2e')],_0x3e8c7b[_0x0479('0x2f')]);_0x4b8170['attributes']=_[_0x0479('0x32')](_0x3e8c7b['model'],qs[_0x0479('0x33')](_0x146bf8[_0x0479('0x2f')][_0x0479('0x33')]));_0x4b8170[_0x0479('0x34')]=_0x4b8170['attributes'][_0x0479('0x35')]?_0x4b8170['attributes']:_0x3e8c7b[_0x0479('0x2e')];if(!_0x146bf8[_0x0479('0x2f')][_0x0479('0x36')](_0x0479('0x37'))){_0x4b8170[_0x0479('0x19')]=qs[_0x0479('0x19')](_0x146bf8[_0x0479('0x2f')][_0x0479('0x19')]);_0x4b8170[_0x0479('0x18')]=qs[_0x0479('0x18')](_0x146bf8['query'][_0x0479('0x18')]);}_0x4b8170[_0x0479('0x38')]=qs['sort'](_0x146bf8['query'][_0x0479('0x39')]);_0x4b8170[_0x0479('0x3a')]=qs[_0x0479('0x31')](_[_0x0479('0x3b')](_0x146bf8[_0x0479('0x2f')],_0x3e8c7b['filters']),_0x321d53);if(_0x146bf8[_0x0479('0x2f')]['filter']){_0x4b8170[_0x0479('0x3a')]=_[_0x0479('0x3c')](_0x4b8170[_0x0479('0x3a')],{'$or':_['map'](_0x321d53,function(_0x1d4ffb){if(_0x1d4ffb['type']!==_0x0479('0x3d')){var _0x18edea={};_0x18edea[_0x1d4ffb[_0x0479('0x26')]]={'$like':'%'+_0x146bf8['query'][_0x0479('0x3e')]+'%'};return _0x18edea;}})});}_0x4b8170=_[_0x0479('0x3c')]({},_0x4b8170,_0x146bf8[_0x0479('0x3f')]);var _0x3002c9={'where':_0x4b8170[_0x0479('0x3a')]};return db['MailSubstatus']['count'](_0x3002c9)[_0x0479('0x22')](function(_0x36dd70){_0x47870b[_0x0479('0x40')]=_0x36dd70;if(_0x146bf8[_0x0479('0x2f')][_0x0479('0x41')]){_0x4b8170[_0x0479('0x42')]=[{'all':!![]}];}return db[_0x0479('0x2a')][_0x0479('0x43')](_0x4b8170);})[_0x0479('0x22')](function(_0x237b95){_0x47870b[_0x0479('0x44')]=_0x237b95;return _0x47870b;})[_0x0479('0x22')](respondWithFilteredResult(_0xffabf1,_0x4b8170))['catch'](handleError(_0xffabf1,null));};exports[_0x0479('0x45')]=function(_0x5c4e9a,_0x328405){var _0x4763af={'raw':!![],'where':{'id':_0x5c4e9a[_0x0479('0x46')]['id']}},_0x323487={};_0x323487[_0x0479('0x2e')]=_[_0x0479('0x30')](db[_0x0479('0x2a')][_0x0479('0x2b')]);_0x323487[_0x0479('0x2f')]=_[_0x0479('0x30')](_0x5c4e9a[_0x0479('0x2f')]);_0x323487[_0x0479('0x31')]=_['intersection'](_0x323487[_0x0479('0x2e')],_0x323487['query']);_0x4763af[_0x0479('0x34')]=_[_0x0479('0x32')](_0x323487[_0x0479('0x2e')],qs['fields'](_0x5c4e9a[_0x0479('0x2f')][_0x0479('0x33')]));_0x4763af['attributes']=_0x4763af['attributes'][_0x0479('0x35')]?_0x4763af[_0x0479('0x34')]:_0x323487[_0x0479('0x2e')];if(_0x5c4e9a[_0x0479('0x2f')][_0x0479('0x41')]){_0x4763af['include']=[{'all':!![]}];}_0x4763af=_[_0x0479('0x3c')]({},_0x4763af,_0x5c4e9a[_0x0479('0x3f')]);return db[_0x0479('0x2a')][_0x0479('0x47')](_0x4763af)[_0x0479('0x22')](handleEntityNotFound(_0x328405,null))[_0x0479('0x22')](respondWithResult(_0x328405,null))[_0x0479('0x48')](handleError(_0x328405,null));};exports[_0x0479('0x49')]=function(_0x4b26ea,_0x1da8be){return db[_0x0479('0x2a')]['create'](_0x4b26ea['body'],{})[_0x0479('0x22')](respondWithResult(_0x1da8be,0xc9))[_0x0479('0x48')](handleError(_0x1da8be,null));};exports['update']=function(_0x2ab884,_0x11ea13){if(_0x2ab884[_0x0479('0x4a')]['id']){delete _0x2ab884[_0x0479('0x4a')]['id'];}return db[_0x0479('0x2a')][_0x0479('0x47')]({'where':{'id':_0x2ab884[_0x0479('0x46')]['id']}})['then'](handleEntityNotFound(_0x11ea13,null))[_0x0479('0x22')](saveUpdates(_0x2ab884[_0x0479('0x4a')],null))['then'](respondWithResult(_0x11ea13,null))[_0x0479('0x48')](handleError(_0x11ea13,null));};exports['destroy']=function(_0x2c35b7,_0xf3fd6c){return db[_0x0479('0x2a')][_0x0479('0x47')]({'where':{'id':_0x2c35b7[_0x0479('0x46')]['id']}})[_0x0479('0x22')](handleEntityNotFound(_0xf3fd6c,null))[_0x0479('0x22')](removeEntity(_0xf3fd6c,null))['catch'](handleError(_0xf3fd6c,null));};exports['describe']=function(_0x672e40,_0x59cb61){return db[_0x0479('0x2a')]['describe']()[_0x0479('0x22')](respondWithResult(_0x59cb61,null))[_0x0479('0x48')](handleError(_0x59cb61,null));}; \ No newline at end of file +var _0x4c1e=['key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type'];(function(_0x128119,_0x2ec797){var _0x5c5e78=function(_0x51faa0){while(--_0x51faa0){_0x128119['push'](_0x128119['shift']());}};_0x5c5e78(++_0x2ec797);}(_0x4c1e,0x1a3));var _0xe4c1=function(_0x5bb919,_0x4caabb){_0x5bb919=_0x5bb919-0x0;var _0x355d7f=_0x4c1e[_0x5bb919];return _0x355d7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4c1('0x1'));var rp=require(_0xe4c1('0x2'));var moment=require(_0xe4c1('0x3'));var BPromise=require(_0xe4c1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe4c1('0x5'));var sox=require(_0xe4c1('0x6'));var csv=require(_0xe4c1('0x7'));var ejs=require(_0xe4c1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4c1('0x9'));var squel=require(_0xe4c1('0xa'));var crypto=require(_0xe4c1('0xb'));var jsforce=require(_0xe4c1('0xc'));var deskjs=require(_0xe4c1('0xd'));var toCsv=require(_0xe4c1('0x7'));var querystring=require('querystring');var Papa=require(_0xe4c1('0xe'));var Redis=require('ioredis');var authService=require(_0xe4c1('0xf'));var qs=require(_0xe4c1('0x10'));var as=require(_0xe4c1('0x11'));var hardwareService=require(_0xe4c1('0x12'));var logger=require(_0xe4c1('0x13'))(_0xe4c1('0x14'));var utils=require(_0xe4c1('0x15'));var config=require(_0xe4c1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4c1('0x17'))['db'];function respondWithStatusCode(_0x4db679,_0x15a3a8){_0x15a3a8=_0x15a3a8||0xcc;return function(_0xfbf491){if(_0xfbf491){return _0x4db679[_0xe4c1('0x18')](_0x15a3a8);}return _0x4db679['status'](_0x15a3a8)[_0xe4c1('0x19')]();};}function respondWithResult(_0x490058,_0x202d0e){_0x202d0e=_0x202d0e||0xc8;return function(_0x8ab6e6){if(_0x8ab6e6){return _0x490058[_0xe4c1('0x1a')](_0x202d0e)[_0xe4c1('0x1b')](_0x8ab6e6);}};}function respondWithFilteredResult(_0x4e2f5f,_0x16b0ad){return function(_0xce40af){if(_0xce40af){var _0x13f1f6=typeof _0x16b0ad[_0xe4c1('0x1c')]===_0xe4c1('0x1d')&&typeof _0x16b0ad['limit']===_0xe4c1('0x1d');var _0x567cff=_0xce40af[_0xe4c1('0x1e')];var _0x42fa00=_0x13f1f6?0x0:_0x16b0ad[_0xe4c1('0x1c')];var _0x46a8a8=_0x13f1f6?_0xce40af[_0xe4c1('0x1e')]:_0x16b0ad[_0xe4c1('0x1c')]+_0x16b0ad['limit'];var _0x136ad0;if(_0x46a8a8>=_0x567cff){_0x46a8a8=_0x567cff;_0x136ad0=0xc8;}else{_0x136ad0=0xce;}_0x4e2f5f[_0xe4c1('0x1a')](_0x136ad0);return _0x4e2f5f[_0xe4c1('0x1f')](_0xe4c1('0x20'),_0x42fa00+'-'+_0x46a8a8+'/'+_0x567cff)[_0xe4c1('0x1b')](_0xce40af);}return null;};}function patchUpdates(_0x37d324){return function(_0x25ec34){try{jsonpatch[_0xe4c1('0x21')](_0x25ec34,_0x37d324,!![]);}catch(_0x382edd){return BPromise[_0xe4c1('0x22')](_0x382edd);}return _0x25ec34[_0xe4c1('0x23')]();};}function saveUpdates(_0x378abf,_0x3b2765){return function(_0x147041){if(_0x147041){return _0x147041[_0xe4c1('0x24')](_0x378abf)[_0xe4c1('0x25')](function(_0x129bfa){return _0x129bfa;});}return null;};}function removeEntity(_0x3bbebc,_0x565221){return function(_0x236c38){if(_0x236c38){return _0x236c38[_0xe4c1('0x26')]()['then'](function(){_0x3bbebc[_0xe4c1('0x1a')](0xcc)[_0xe4c1('0x19')]();});}};}function handleEntityNotFound(_0x780edc,_0x3ced0f){return function(_0x4e6306){if(!_0x4e6306){_0x780edc[_0xe4c1('0x18')](0x194);}return _0x4e6306;};}function handleError(_0x267cea,_0x7d36f3){_0x7d36f3=_0x7d36f3||0x1f4;return function(_0x2a2125){logger[_0xe4c1('0x27')](_0x2a2125[_0xe4c1('0x28')]);if(_0x2a2125[_0xe4c1('0x29')]){delete _0x2a2125[_0xe4c1('0x29')];}_0x267cea[_0xe4c1('0x1a')](_0x7d36f3)[_0xe4c1('0x2a')](_0x2a2125);};}exports[_0xe4c1('0x2b')]=function(_0x277aeb,_0x45d879){var _0x34e378={},_0x5c0b05={},_0x303792={'count':0x0,'rows':[]};var _0x5eff2e=_[_0xe4c1('0x2c')](db[_0xe4c1('0x2d')][_0xe4c1('0x2e')],function(_0x4c6678){return{'name':_0x4c6678[_0xe4c1('0x2f')],'type':_0x4c6678[_0xe4c1('0x30')][_0xe4c1('0x31')]};});_0x5c0b05['model']=_[_0xe4c1('0x2c')](_0x5eff2e,'name');_0x5c0b05['query']=_[_0xe4c1('0x32')](_0x277aeb[_0xe4c1('0x33')]);_0x5c0b05[_0xe4c1('0x34')]=_[_0xe4c1('0x35')](_0x5c0b05['model'],_0x5c0b05[_0xe4c1('0x33')]);_0x34e378['attributes']=_[_0xe4c1('0x35')](_0x5c0b05[_0xe4c1('0x36')],qs[_0xe4c1('0x37')](_0x277aeb[_0xe4c1('0x33')][_0xe4c1('0x37')]));_0x34e378['attributes']=_0x34e378[_0xe4c1('0x38')][_0xe4c1('0x39')]?_0x34e378[_0xe4c1('0x38')]:_0x5c0b05[_0xe4c1('0x36')];if(!_0x277aeb[_0xe4c1('0x33')][_0xe4c1('0x3a')]('nolimit')){_0x34e378[_0xe4c1('0x3b')]=qs[_0xe4c1('0x3b')](_0x277aeb[_0xe4c1('0x33')]['limit']);_0x34e378['offset']=qs[_0xe4c1('0x1c')](_0x277aeb[_0xe4c1('0x33')][_0xe4c1('0x1c')]);}_0x34e378[_0xe4c1('0x3c')]=qs[_0xe4c1('0x3d')](_0x277aeb[_0xe4c1('0x33')][_0xe4c1('0x3d')]);_0x34e378[_0xe4c1('0x3e')]=qs[_0xe4c1('0x34')](_[_0xe4c1('0x3f')](_0x277aeb[_0xe4c1('0x33')],_0x5c0b05[_0xe4c1('0x34')]),_0x5eff2e);if(_0x277aeb[_0xe4c1('0x33')][_0xe4c1('0x40')]){_0x34e378[_0xe4c1('0x3e')]=_[_0xe4c1('0x41')](_0x34e378[_0xe4c1('0x3e')],{'$or':_[_0xe4c1('0x2c')](_0x5eff2e,function(_0x5bcacc){if(_0x5bcacc[_0xe4c1('0x30')]!==_0xe4c1('0x42')){var _0x1242fb={};_0x1242fb[_0x5bcacc[_0xe4c1('0x29')]]={'$like':'%'+_0x277aeb[_0xe4c1('0x33')][_0xe4c1('0x40')]+'%'};return _0x1242fb;}})});}_0x34e378=_['merge']({},_0x34e378,_0x277aeb[_0xe4c1('0x43')]);var _0x3d1e88={'where':_0x34e378[_0xe4c1('0x3e')]};return db[_0xe4c1('0x2d')]['count'](_0x3d1e88)[_0xe4c1('0x25')](function(_0x30fd26){_0x303792[_0xe4c1('0x1e')]=_0x30fd26;if(_0x277aeb[_0xe4c1('0x33')]['includeAll']){_0x34e378[_0xe4c1('0x44')]=[{'all':!![]}];}return db[_0xe4c1('0x2d')]['findAll'](_0x34e378);})['then'](function(_0x2a2afd){_0x303792[_0xe4c1('0x45')]=_0x2a2afd;return _0x303792;})[_0xe4c1('0x25')](respondWithFilteredResult(_0x45d879,_0x34e378))[_0xe4c1('0x46')](handleError(_0x45d879,null));};exports[_0xe4c1('0x47')]=function(_0x3649f9,_0x4cba5f){var _0x35b655={'raw':!![],'where':{'id':_0x3649f9[_0xe4c1('0x48')]['id']}},_0x86a28b={};_0x86a28b[_0xe4c1('0x36')]=_['keys'](db[_0xe4c1('0x2d')][_0xe4c1('0x2e')]);_0x86a28b['query']=_[_0xe4c1('0x32')](_0x3649f9[_0xe4c1('0x33')]);_0x86a28b[_0xe4c1('0x34')]=_['intersection'](_0x86a28b['model'],_0x86a28b[_0xe4c1('0x33')]);_0x35b655[_0xe4c1('0x38')]=_['intersection'](_0x86a28b['model'],qs[_0xe4c1('0x37')](_0x3649f9['query'][_0xe4c1('0x37')]));_0x35b655[_0xe4c1('0x38')]=_0x35b655[_0xe4c1('0x38')]['length']?_0x35b655[_0xe4c1('0x38')]:_0x86a28b[_0xe4c1('0x36')];if(_0x3649f9[_0xe4c1('0x33')][_0xe4c1('0x49')]){_0x35b655[_0xe4c1('0x44')]=[{'all':!![]}];}_0x35b655=_[_0xe4c1('0x41')]({},_0x35b655,_0x3649f9[_0xe4c1('0x43')]);return db[_0xe4c1('0x2d')]['find'](_0x35b655)[_0xe4c1('0x25')](handleEntityNotFound(_0x4cba5f,null))['then'](respondWithResult(_0x4cba5f,null))[_0xe4c1('0x46')](handleError(_0x4cba5f,null));};exports[_0xe4c1('0x4a')]=function(_0x5dc401,_0x125c3b){return db[_0xe4c1('0x2d')][_0xe4c1('0x4a')](_0x5dc401[_0xe4c1('0x4b')],{})[_0xe4c1('0x25')](respondWithResult(_0x125c3b,0xc9))[_0xe4c1('0x46')](handleError(_0x125c3b,null));};exports[_0xe4c1('0x24')]=function(_0x560bd6,_0x57bf3a){if(_0x560bd6[_0xe4c1('0x4b')]['id']){delete _0x560bd6[_0xe4c1('0x4b')]['id'];}return db[_0xe4c1('0x2d')][_0xe4c1('0x4c')]({'where':{'id':_0x560bd6[_0xe4c1('0x48')]['id']}})[_0xe4c1('0x25')](handleEntityNotFound(_0x57bf3a,null))[_0xe4c1('0x25')](saveUpdates(_0x560bd6[_0xe4c1('0x4b')],null))[_0xe4c1('0x25')](respondWithResult(_0x57bf3a,null))[_0xe4c1('0x46')](handleError(_0x57bf3a,null));};exports['destroy']=function(_0x1ca406,_0x34b579){return db[_0xe4c1('0x2d')][_0xe4c1('0x4c')]({'where':{'id':_0x1ca406[_0xe4c1('0x48')]['id']}})[_0xe4c1('0x25')](handleEntityNotFound(_0x34b579,null))[_0xe4c1('0x25')](removeEntity(_0x34b579,null))['catch'](handleError(_0x34b579,null));};exports[_0xe4c1('0x4d')]=function(_0x35f6d2,_0x4a3098){return db[_0xe4c1('0x2d')]['describe']()[_0xe4c1('0x25')](respondWithResult(_0x4a3098,null))[_0xe4c1('0x46')](handleError(_0x4a3098,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 3c4e1e7..5e9331a 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 _0xb8a0=['setMaxListeners','update','emit','hook','exports','events','MailSubstatus'];(function(_0x20a288,_0x57d420){var _0x4e3c71=function(_0x1bd97b){while(--_0x1bd97b){_0x20a288['push'](_0x20a288['shift']());}};_0x4e3c71(++_0x57d420);}(_0xb8a0,0xec));var _0x0b8a=function(_0x49c995,_0xa4de19){_0x49c995=_0x49c995-0x0;var _0x1778ed=_0xb8a0[_0x49c995];return _0x1778ed;};'use strict';var EventEmitter=require(_0x0b8a('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x0b8a('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0b8a('0x2')](0x0);var events={'afterUpdate':_0x0b8a('0x3')};function emitEvent(_0x86a039){return function(_0x596540,_0x1dd0fa,_0x2d88bf){MailSubstatusEvents[_0x0b8a('0x4')](_0x86a039+':'+_0x596540['id'],_0x596540);MailSubstatusEvents[_0x0b8a('0x4')](_0x86a039,_0x596540);_0x2d88bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x0b8a('0x5')](e,emitEvent(event));}}module[_0x0b8a('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0xd561=['exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x50b7a8,_0x1e3067){var _0x9e970b=function(_0x43fe08){while(--_0x43fe08){_0x50b7a8['push'](_0x50b7a8['shift']());}};_0x9e970b(++_0x1e3067);}(_0xd561,0x189));var _0x1d56=function(_0x21ecf2,_0x13907f){_0x21ecf2=_0x21ecf2-0x0;var _0x3127ae=_0xd561[_0x21ecf2];return _0x3127ae;};'use strict';var EventEmitter=require(_0x1d56('0x0'));var MailSubstatus=require(_0x1d56('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x1d56('0x2')](0x0);var events={'afterUpdate':_0x1d56('0x3')};function emitEvent(_0x341b57){return function(_0x370f31,_0x4ab6b5,_0x4c7d62){MailSubstatusEvents[_0x1d56('0x4')](_0x341b57+':'+_0x370f31['id'],_0x370f31);MailSubstatusEvents[_0x1d56('0x4')](_0x341b57,_0x370f31);_0x4c7d62(null);};}for(var e in events){if(events[_0x1d56('0x5')](e)){var event=events[e];MailSubstatus[_0x1d56('0x6')](e,emitEvent(event));}}module[_0x1d56('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4a2bc75..c0d745f 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 _0x5a9e=['mail_substatuses','Condition','update','name','mailSubstatus','then','catch','./mailSubstatus.attributes','models','define'];(function(_0x53125e,_0x11c6a5){var _0x3dfd9a=function(_0x23eb91){while(--_0x23eb91){_0x53125e['push'](_0x53125e['shift']());}};_0x3dfd9a(++_0x11c6a5);}(_0x5a9e,0x15b));var _0xe5a9=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x5a9e[_0x134192];return _0x3cd080;};'use strict';var attributes=require(_0xe5a9('0x0'));module['exports']=function(_0x591ccc){var _0x82232d=_0x591ccc[_0xe5a9('0x1')];return _0x591ccc[_0xe5a9('0x2')]('MailSubstatus',attributes,{'tableName':_0xe5a9('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1e5157,_0x1d1fa5,_0x5c12ee){return _0x82232d[_0xe5a9('0x4')][_0xe5a9('0x5')]({'value':_0x1e5157[_0xe5a9('0x6')]},{'where':{'field':_0xe5a9('0x7'),'value':_0x1e5157['_previousDataValues'][_0xe5a9('0x6')]}})[_0xe5a9('0x8')](function(){_0x5c12ee();})[_0xe5a9('0x9')](function(_0x2f7814){_0x5c12ee(_0x2f7814);});}}});}; \ No newline at end of file +var _0xb2ed=['name','mailSubstatus','_previousDataValues','catch','./mailSubstatus.attributes','define','MailSubstatus','Condition','update'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xb2ed,0x124));var _0xdb2e=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0xb2ed[_0x5235dd];return _0x13059d;};'use strict';var attributes=require(_0xdb2e('0x0'));module['exports']=function(_0x48538e){var _0x49503b=_0x48538e['models'];return _0x48538e[_0xdb2e('0x1')](_0xdb2e('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x25df39,_0x3e288f,_0x4878db){return _0x49503b[_0xdb2e('0x3')][_0xdb2e('0x4')]({'value':_0x25df39[_0xdb2e('0x5')]},{'where':{'field':_0xdb2e('0x6'),'value':_0x25df39[_0xdb2e('0x7')]['name']}})['then'](function(){_0x4878db();})[_0xdb2e('0x8')](function(_0x53cfcc){_0x4878db(_0x53cfcc);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 26e9612..e430a82 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 _0xd5f5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0xd5f5,0x1ca));var _0x5d5f=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd5f5[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x5d5f('0x0'));var util=require(_0x5d5f('0x1'));var moment=require('moment');var BPromise=require(_0x5d5f('0x2'));var rs=require(_0x5d5f('0x3'));var fs=require('fs');var Redis=require(_0x5d5f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d5f('0x5'));var logger=require(_0x5d5f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5d5f('0x7'));var client=jayson['client'][_0x5d5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ee691,_0x406876,_0xd682be){return new BPromise(function(_0x2aee8a,_0x15acd9){return client[_0x5d5f('0x9')](_0x3ee691,_0xd682be)[_0x5d5f('0xa')](function(_0x3cf862){logger[_0x5d5f('0xb')](_0x5d5f('0xc'),_0x406876,_0x5d5f('0xd'));logger['debug'](_0x5d5f('0xe'),_0x406876,_0x5d5f('0xd'),JSON['stringify'](_0x3cf862));if(_0x3cf862[_0x5d5f('0xf')]){if(_0x3cf862[_0x5d5f('0xf')][_0x5d5f('0x10')]===0x1f4){logger[_0x5d5f('0xf')](_0x5d5f('0xc'),_0x406876,_0x3cf862[_0x5d5f('0xf')][_0x5d5f('0x11')]);return _0x15acd9(_0x3cf862[_0x5d5f('0xf')][_0x5d5f('0x11')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x406876,_0x3cf862[_0x5d5f('0xf')][_0x5d5f('0x11')]);return _0x2aee8a(_0x3cf862[_0x5d5f('0xf')][_0x5d5f('0x11')]);}else{logger[_0x5d5f('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x406876,_0x5d5f('0xd'));_0x2aee8a(_0x3cf862[_0x5d5f('0x12')]['message']);}})[_0x5d5f('0x13')](function(_0x3ab99f){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x406876,_0x3ab99f);_0x15acd9(_0x3ab99f);});});} \ No newline at end of file +var _0x503b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x19e09d,_0x37349e){var _0x42e332=function(_0x3d5d94){while(--_0x3d5d94){_0x19e09d['push'](_0x19e09d['shift']());}};_0x42e332(++_0x37349e);}(_0x503b,0xdf));var _0xb503=function(_0x87b0e8,_0xaefede){_0x87b0e8=_0x87b0e8-0x0;var _0x1ed870=_0x503b[_0x87b0e8];return _0x1ed870;};'use strict';var _=require(_0xb503('0x0'));var util=require(_0xb503('0x1'));var moment=require(_0xb503('0x2'));var BPromise=require(_0xb503('0x3'));var rs=require(_0xb503('0x4'));var fs=require('fs');var Redis=require(_0xb503('0x5'));var db=require(_0xb503('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb503('0x7'))(_0xb503('0x8'));var config=require(_0xb503('0x9'));var jayson=require(_0xb503('0xa'));var client=jayson[_0xb503('0xb')][_0xb503('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd60b3e,_0x2b80f0,_0xcc8f9e){return new BPromise(function(_0x418d6e,_0x3db27d){return client['request'](_0xd60b3e,_0xcc8f9e)['then'](function(_0x363de0){logger[_0xb503('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x2b80f0,_0xb503('0xe'));logger['debug'](_0xb503('0xf'),_0x2b80f0,'request\x20sent',JSON[_0xb503('0x10')](_0x363de0));if(_0x363de0['error']){if(_0x363de0[_0xb503('0x11')][_0xb503('0x12')]===0x1f4){logger['error'](_0xb503('0x13'),_0x2b80f0,_0x363de0[_0xb503('0x11')]['message']);return _0x3db27d(_0x363de0[_0xb503('0x11')][_0xb503('0x14')]);}logger[_0xb503('0x11')](_0xb503('0x13'),_0x2b80f0,_0x363de0[_0xb503('0x11')][_0xb503('0x14')]);return _0x418d6e(_0x363de0['error'][_0xb503('0x14')]);}else{logger[_0xb503('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x2b80f0,_0xb503('0xe'));_0x418d6e(_0x363de0[_0xb503('0x15')][_0xb503('0x14')]);}})[_0xb503('0x16')](function(_0x3cdff9){logger[_0xb503('0x11')](_0xb503('0x13'),_0x2b80f0,_0x3cdff9);_0x3db27d(_0x3cdff9);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9a53c69..da02a69 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 _0x69e2=['/:id','show','post','create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailTransferReport.controller','isAuthenticated','index','get'];(function(_0x5e473c,_0x5734f6){var _0x17af5f=function(_0x3d39b8){while(--_0x3d39b8){_0x5e473c['push'](_0x5e473c['shift']());}};_0x17af5f(++_0x5734f6);}(_0x69e2,0x85));var _0x269e=function(_0x5ee4c1,_0x1fb48c){_0x5ee4c1=_0x5ee4c1-0x0;var _0x365d2c=_0x69e2[_0x5ee4c1];return _0x365d2c;};'use strict';var multer=require('multer');var util=require(_0x269e('0x0'));var path=require(_0x269e('0x1'));var timeout=require(_0x269e('0x2'));var express=require(_0x269e('0x3'));var router=express[_0x269e('0x4')]();var fs_extra=require(_0x269e('0x5'));var auth=require(_0x269e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x269e('0x7'));router['get']('/',auth[_0x269e('0x8')](),controller[_0x269e('0x9')]);router[_0x269e('0xa')]('/describe',auth[_0x269e('0x8')](),controller['describe']);router['get'](_0x269e('0xb'),auth['isAuthenticated'](),controller[_0x269e('0xc')]);router[_0x269e('0xd')]('/',auth[_0x269e('0x8')](),controller[_0x269e('0xe')]);router['put'](_0x269e('0xb'),auth[_0x269e('0x8')](),controller[_0x269e('0xf')]);router['delete'](_0x269e('0xb'),auth[_0x269e('0x8')](),controller[_0x269e('0x10')]);module[_0x269e('0x11')]=router; \ No newline at end of file +var _0x20d1=['show','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../config/environment','./mailTransferReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x55fc03,_0x43ce48){var _0x5bf429=function(_0xa06468){while(--_0xa06468){_0x55fc03['push'](_0x55fc03['shift']());}};_0x5bf429(++_0x43ce48);}(_0x20d1,0x100));var _0x120d=function(_0x4f0ac9,_0xf8844e){_0x4f0ac9=_0x4f0ac9-0x0;var _0x1d1f24=_0x20d1[_0x4f0ac9];return _0x1d1f24;};'use strict';var multer=require(_0x120d('0x0'));var util=require('util');var path=require(_0x120d('0x1'));var timeout=require('connect-timeout');var express=require(_0x120d('0x2'));var router=express[_0x120d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x120d('0x4'));var controller=require(_0x120d('0x5'));router[_0x120d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x120d('0x6')](_0x120d('0x7'),auth[_0x120d('0x8')](),controller[_0x120d('0x9')]);router['get']('/:id',auth[_0x120d('0x8')](),controller[_0x120d('0xa')]);router[_0x120d('0xb')]('/',auth['isAuthenticated'](),controller[_0x120d('0xc')]);router[_0x120d('0xd')](_0x120d('0xe'),auth[_0x120d('0x8')](),controller[_0x120d('0xf')]);router[_0x120d('0x10')](_0x120d('0xe'),auth[_0x120d('0x8')](),controller[_0x120d('0x11')]);module[_0x120d('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 bf66d52..23f3460 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x29f783,_0x1c2b10){var _0x3b1dbe=function(_0x394169){while(--_0x394169){_0x29f783['push'](_0x29f783['shift']());}};_0x3b1dbe(++_0x1c2b10);}(_0x70e0,0x17b));var _0x070e=function(_0x491d1b,_0x395366){_0x491d1b=_0x491d1b-0x0;var _0x1ceaf8=_0x70e0[_0x491d1b];return _0x1ceaf8;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x282a5f,_0x15f71e){var _0x45250d=function(_0x54265e){while(--_0x54265e){_0x282a5f['push'](_0x282a5f['shift']());}};_0x45250d(++_0x15f71e);}(_0xe706,0xa3));var _0x6e70=function(_0x20e6c4,_0x573880){_0x20e6c4=_0x20e6c4-0x0;var _0x61fc99=_0xe706[_0x20e6c4];return _0x61fc99;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 071ea56..48b7095 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 _0x29e4=['papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x53b199,_0x38ff21){var _0x1ba42d=function(_0x35dc53){while(--_0x35dc53){_0x53b199['push'](_0x53b199['shift']());}};_0x1ba42d(++_0x38ff21);}(_0x29e4,0x88));var _0x429e=function(_0x2bb9ac,_0x557e7d){_0x2bb9ac=_0x2bb9ac-0x0;var _0x2b897b=_0x29e4[_0x2bb9ac];return _0x2b897b;};'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(_0x429e('0x0'));var moment=require(_0x429e('0x1'));var BPromise=require(_0x429e('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x429e('0x3'));var sox=require('sox');var csv=require(_0x429e('0x4'));var ejs=require(_0x429e('0x5'));var fs=require('fs');var fs_extra=require(_0x429e('0x6'));var _=require(_0x429e('0x7'));var squel=require(_0x429e('0x8'));var crypto=require(_0x429e('0x9'));var jsforce=require(_0x429e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x429e('0x4'));var querystring=require(_0x429e('0xb'));var Papa=require(_0x429e('0xc'));var Redis=require('ioredis');var authService=require(_0x429e('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x429e('0xe'))(_0x429e('0xf'));var utils=require(_0x429e('0x10'));var config=require(_0x429e('0x11'));var licenseUtil=require(_0x429e('0x12'));var db=require(_0x429e('0x13'))['db'];function respondWithStatusCode(_0x17c286,_0x540f55){_0x540f55=_0x540f55||0xcc;return function(_0x28f0b6){if(_0x28f0b6){return _0x17c286[_0x429e('0x14')](_0x540f55);}return _0x17c286['status'](_0x540f55)['end']();};}function respondWithResult(_0x2c4fe2,_0x2c15f5){_0x2c15f5=_0x2c15f5||0xc8;return function(_0x350da5){if(_0x350da5){return _0x2c4fe2['status'](_0x2c15f5)[_0x429e('0x15')](_0x350da5);}};}function respondWithFilteredResult(_0x5da781,_0x54d102){return function(_0x4b1dde){if(_0x4b1dde){var _0x3f099d=typeof _0x54d102[_0x429e('0x16')]==='undefined'&&typeof _0x54d102[_0x429e('0x17')]===_0x429e('0x18');var _0x1ed8ff=_0x4b1dde[_0x429e('0x19')];var _0x3ec2ff=_0x3f099d?0x0:_0x54d102[_0x429e('0x16')];var _0x45770f=_0x3f099d?_0x4b1dde[_0x429e('0x19')]:_0x54d102[_0x429e('0x16')]+_0x54d102[_0x429e('0x17')];var _0x5b80fb;if(_0x45770f>=_0x1ed8ff){_0x45770f=_0x1ed8ff;_0x5b80fb=0xc8;}else{_0x5b80fb=0xce;}_0x5da781[_0x429e('0x1a')](_0x5b80fb);return _0x5da781['set'](_0x429e('0x1b'),_0x3ec2ff+'-'+_0x45770f+'/'+_0x1ed8ff)[_0x429e('0x15')](_0x4b1dde);}return null;};}function patchUpdates(_0x9d7ea2){return function(_0x4a8ec9){try{jsonpatch[_0x429e('0x1c')](_0x4a8ec9,_0x9d7ea2,!![]);}catch(_0x145248){return BPromise[_0x429e('0x1d')](_0x145248);}return _0x4a8ec9[_0x429e('0x1e')]();};}function saveUpdates(_0x267a49,_0x3011e3){return function(_0x379a6f){if(_0x379a6f){return _0x379a6f[_0x429e('0x1f')](_0x267a49)[_0x429e('0x20')](function(_0x11869a){return _0x11869a;});}return null;};}function removeEntity(_0x19c3e8,_0x3b4cec){return function(_0x306534){if(_0x306534){return _0x306534[_0x429e('0x21')]()[_0x429e('0x20')](function(){_0x19c3e8['status'](0xcc)[_0x429e('0x22')]();});}};}function handleEntityNotFound(_0x4a50b6,_0x263972){return function(_0x44617b){if(!_0x44617b){_0x4a50b6[_0x429e('0x14')](0x194);}return _0x44617b;};}function handleError(_0x550b8e,_0xbf295f){_0xbf295f=_0xbf295f||0x1f4;return function(_0x1e1279){logger[_0x429e('0x23')](_0x1e1279[_0x429e('0x24')]);if(_0x1e1279[_0x429e('0x25')]){delete _0x1e1279[_0x429e('0x25')];}_0x550b8e[_0x429e('0x1a')](_0xbf295f)[_0x429e('0x26')](_0x1e1279);};}exports[_0x429e('0x27')]=function(_0x512d4b,_0x127569){var _0x235e31={},_0x3905de={},_0x1c36de={'count':0x0,'rows':[]};var _0x20e04c=_[_0x429e('0x28')](db[_0x429e('0x29')][_0x429e('0x2a')],function(_0x96af74){return{'name':_0x96af74[_0x429e('0x2b')],'type':_0x96af74[_0x429e('0x2c')][_0x429e('0x2d')]};});_0x3905de['model']=_[_0x429e('0x28')](_0x20e04c,_0x429e('0x25'));_0x3905de[_0x429e('0x2e')]=_[_0x429e('0x2f')](_0x512d4b[_0x429e('0x2e')]);_0x3905de[_0x429e('0x30')]=_[_0x429e('0x31')](_0x3905de['model'],_0x3905de[_0x429e('0x2e')]);_0x235e31['attributes']=_['intersection'](_0x3905de[_0x429e('0x32')],qs[_0x429e('0x33')](_0x512d4b[_0x429e('0x2e')][_0x429e('0x33')]));_0x235e31['attributes']=_0x235e31[_0x429e('0x34')][_0x429e('0x35')]?_0x235e31['attributes']:_0x3905de[_0x429e('0x32')];if(!_0x512d4b[_0x429e('0x2e')][_0x429e('0x36')](_0x429e('0x37'))){_0x235e31['limit']=qs[_0x429e('0x17')](_0x512d4b[_0x429e('0x2e')]['limit']);_0x235e31[_0x429e('0x16')]=qs['offset'](_0x512d4b[_0x429e('0x2e')]['offset']);}_0x235e31[_0x429e('0x38')]=qs['sort'](_0x512d4b[_0x429e('0x2e')][_0x429e('0x39')]);_0x235e31[_0x429e('0x3a')]=qs[_0x429e('0x30')](_[_0x429e('0x3b')](_0x512d4b[_0x429e('0x2e')],_0x3905de['filters']),_0x20e04c);if(_0x512d4b[_0x429e('0x2e')][_0x429e('0x3c')]){_0x235e31[_0x429e('0x3a')]=_[_0x429e('0x3d')](_0x235e31[_0x429e('0x3a')],{'$or':_[_0x429e('0x28')](_0x20e04c,function(_0x3c7a1a){if(_0x3c7a1a[_0x429e('0x2c')]!==_0x429e('0x3e')){var _0x327969={};_0x327969[_0x3c7a1a[_0x429e('0x25')]]={'$like':'%'+_0x512d4b[_0x429e('0x2e')][_0x429e('0x3c')]+'%'};return _0x327969;}})});}_0x235e31=_[_0x429e('0x3d')]({},_0x235e31,_0x512d4b[_0x429e('0x3f')]);var _0x339afa={'where':_0x235e31[_0x429e('0x3a')]};return db[_0x429e('0x29')][_0x429e('0x19')](_0x339afa)[_0x429e('0x20')](function(_0xe1350f){_0x1c36de[_0x429e('0x19')]=_0xe1350f;if(_0x512d4b[_0x429e('0x2e')]['includeAll']){_0x235e31[_0x429e('0x40')]=[{'all':!![]}];}return db[_0x429e('0x29')][_0x429e('0x41')](_0x235e31);})[_0x429e('0x20')](function(_0x1b4c61){_0x1c36de[_0x429e('0x42')]=_0x1b4c61;return _0x1c36de;})[_0x429e('0x20')](respondWithFilteredResult(_0x127569,_0x235e31))[_0x429e('0x43')](handleError(_0x127569,null));};exports['show']=function(_0x529004,_0x43429f){var _0xc16fb2={'raw':!![],'where':{'id':_0x529004[_0x429e('0x44')]['id']}},_0x281497={};_0x281497[_0x429e('0x32')]=_['keys'](db[_0x429e('0x29')]['rawAttributes']);_0x281497['query']=_[_0x429e('0x2f')](_0x529004['query']);_0x281497[_0x429e('0x30')]=_[_0x429e('0x31')](_0x281497[_0x429e('0x32')],_0x281497['query']);_0xc16fb2[_0x429e('0x34')]=_[_0x429e('0x31')](_0x281497[_0x429e('0x32')],qs[_0x429e('0x33')](_0x529004[_0x429e('0x2e')][_0x429e('0x33')]));_0xc16fb2[_0x429e('0x34')]=_0xc16fb2[_0x429e('0x34')][_0x429e('0x35')]?_0xc16fb2[_0x429e('0x34')]:_0x281497['model'];if(_0x529004[_0x429e('0x2e')][_0x429e('0x45')]){_0xc16fb2[_0x429e('0x40')]=[{'all':!![]}];}_0xc16fb2=_[_0x429e('0x3d')]({},_0xc16fb2,_0x529004['options']);return db[_0x429e('0x29')][_0x429e('0x46')](_0xc16fb2)[_0x429e('0x20')](handleEntityNotFound(_0x43429f,null))[_0x429e('0x20')](respondWithResult(_0x43429f,null))[_0x429e('0x43')](handleError(_0x43429f,null));};exports['create']=function(_0x5ca238,_0x2f5749){return db[_0x429e('0x29')][_0x429e('0x47')](_0x5ca238[_0x429e('0x48')],{})[_0x429e('0x20')](respondWithResult(_0x2f5749,0xc9))['catch'](handleError(_0x2f5749,null));};exports['update']=function(_0x1a8e40,_0x341474){if(_0x1a8e40[_0x429e('0x48')]['id']){delete _0x1a8e40['body']['id'];}return db[_0x429e('0x29')][_0x429e('0x46')]({'where':{'id':_0x1a8e40[_0x429e('0x44')]['id']}})[_0x429e('0x20')](handleEntityNotFound(_0x341474,null))[_0x429e('0x20')](saveUpdates(_0x1a8e40[_0x429e('0x48')],null))[_0x429e('0x20')](respondWithResult(_0x341474,null))['catch'](handleError(_0x341474,null));};exports[_0x429e('0x21')]=function(_0x10b263,_0x5322a7){return db[_0x429e('0x29')]['find']({'where':{'id':_0x10b263[_0x429e('0x44')]['id']}})[_0x429e('0x20')](handleEntityNotFound(_0x5322a7,null))[_0x429e('0x20')](removeEntity(_0x5322a7,null))['catch'](handleError(_0x5322a7,null));};exports['describe']=function(_0x577a74,_0x1d3d51){return db[_0x429e('0x29')][_0x429e('0x49')]()[_0x429e('0x20')](respondWithResult(_0x1d3d51,null))[_0x429e('0x43')](handleError(_0x1d3d51,null));}; \ No newline at end of file +var _0xa0a8=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','map','MailTransferReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','zip-dir'];(function(_0x18776a,_0x4fecab){var _0x484e4a=function(_0x2c8722){while(--_0x2c8722){_0x18776a['push'](_0x18776a['shift']());}};_0x484e4a(++_0x4fecab);}(_0xa0a8,0x11a));var _0x8a0a=function(_0xdc372,_0x411328){_0xdc372=_0xdc372-0x0;var _0x45a089=_0xa0a8[_0xdc372];return _0x45a089;};'use strict';var emlformat=require(_0x8a0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a0a('0x1'));var jsonpatch=require(_0x8a0a('0x2'));var rp=require('request-promise');var moment=require(_0x8a0a('0x3'));var BPromise=require(_0x8a0a('0x4'));var Mustache=require(_0x8a0a('0x5'));var util=require(_0x8a0a('0x6'));var path=require(_0x8a0a('0x7'));var sox=require(_0x8a0a('0x8'));var csv=require(_0x8a0a('0x9'));var ejs=require(_0x8a0a('0xa'));var fs=require('fs');var fs_extra=require(_0x8a0a('0xb'));var _=require(_0x8a0a('0xc'));var squel=require(_0x8a0a('0xd'));var crypto=require('crypto');var jsforce=require(_0x8a0a('0xe'));var deskjs=require(_0x8a0a('0xf'));var toCsv=require(_0x8a0a('0x9'));var querystring=require('querystring');var Papa=require(_0x8a0a('0x10'));var Redis=require('ioredis');var authService=require(_0x8a0a('0x11'));var qs=require(_0x8a0a('0x12'));var as=require(_0x8a0a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a0a('0x14'))(_0x8a0a('0x15'));var utils=require(_0x8a0a('0x16'));var config=require(_0x8a0a('0x17'));var licenseUtil=require(_0x8a0a('0x18'));var db=require(_0x8a0a('0x19'))['db'];function respondWithStatusCode(_0x57a9f6,_0x365e28){_0x365e28=_0x365e28||0xcc;return function(_0x5159d5){if(_0x5159d5){return _0x57a9f6[_0x8a0a('0x1a')](_0x365e28);}return _0x57a9f6[_0x8a0a('0x1b')](_0x365e28)[_0x8a0a('0x1c')]();};}function respondWithResult(_0x1604b6,_0x116009){_0x116009=_0x116009||0xc8;return function(_0xb74d47){if(_0xb74d47){return _0x1604b6[_0x8a0a('0x1b')](_0x116009)[_0x8a0a('0x1d')](_0xb74d47);}};}function respondWithFilteredResult(_0x2de401,_0x52ae56){return function(_0x29c0f0){if(_0x29c0f0){var _0x559986=typeof _0x52ae56[_0x8a0a('0x1e')]===_0x8a0a('0x1f')&&typeof _0x52ae56[_0x8a0a('0x20')]===_0x8a0a('0x1f');var _0x5866b7=_0x29c0f0[_0x8a0a('0x21')];var _0xf9190=_0x559986?0x0:_0x52ae56['offset'];var _0x360f4a=_0x559986?_0x29c0f0[_0x8a0a('0x21')]:_0x52ae56[_0x8a0a('0x1e')]+_0x52ae56['limit'];var _0x33a69c;if(_0x360f4a>=_0x5866b7){_0x360f4a=_0x5866b7;_0x33a69c=0xc8;}else{_0x33a69c=0xce;}_0x2de401['status'](_0x33a69c);return _0x2de401[_0x8a0a('0x22')](_0x8a0a('0x23'),_0xf9190+'-'+_0x360f4a+'/'+_0x5866b7)[_0x8a0a('0x1d')](_0x29c0f0);}return null;};}function patchUpdates(_0x4ae0ce){return function(_0x38db8b){try{jsonpatch['apply'](_0x38db8b,_0x4ae0ce,!![]);}catch(_0x23fd2c){return BPromise[_0x8a0a('0x24')](_0x23fd2c);}return _0x38db8b[_0x8a0a('0x25')]();};}function saveUpdates(_0x40fffc,_0x2cbd51){return function(_0x3296a4){if(_0x3296a4){return _0x3296a4[_0x8a0a('0x26')](_0x40fffc)[_0x8a0a('0x27')](function(_0x30d5eb){return _0x30d5eb;});}return null;};}function removeEntity(_0x363805,_0x4183c5){return function(_0xef39b2){if(_0xef39b2){return _0xef39b2['destroy']()[_0x8a0a('0x27')](function(){_0x363805[_0x8a0a('0x1b')](0xcc)[_0x8a0a('0x1c')]();});}};}function handleEntityNotFound(_0x6175cc,_0x3f3d9f){return function(_0x2b6ed7){if(!_0x2b6ed7){_0x6175cc[_0x8a0a('0x1a')](0x194);}return _0x2b6ed7;};}function handleError(_0x250695,_0x370e11){_0x370e11=_0x370e11||0x1f4;return function(_0x30da06){logger['error'](_0x30da06['stack']);if(_0x30da06[_0x8a0a('0x28')]){delete _0x30da06['name'];}_0x250695['status'](_0x370e11)['send'](_0x30da06);};}exports['index']=function(_0x629110,_0x5c59a2){var _0x472373={},_0x30a510={},_0x1ea8aa={'count':0x0,'rows':[]};var _0x1928df=_[_0x8a0a('0x29')](db[_0x8a0a('0x2a')][_0x8a0a('0x2b')],function(_0x180311){return{'name':_0x180311[_0x8a0a('0x2c')],'type':_0x180311[_0x8a0a('0x2d')]['key']};});_0x30a510['model']=_[_0x8a0a('0x29')](_0x1928df,_0x8a0a('0x28'));_0x30a510['query']=_[_0x8a0a('0x2e')](_0x629110[_0x8a0a('0x2f')]);_0x30a510[_0x8a0a('0x30')]=_[_0x8a0a('0x31')](_0x30a510[_0x8a0a('0x32')],_0x30a510[_0x8a0a('0x2f')]);_0x472373['attributes']=_[_0x8a0a('0x31')](_0x30a510['model'],qs['fields'](_0x629110['query'][_0x8a0a('0x33')]));_0x472373[_0x8a0a('0x34')]=_0x472373[_0x8a0a('0x34')][_0x8a0a('0x35')]?_0x472373[_0x8a0a('0x34')]:_0x30a510['model'];if(!_0x629110[_0x8a0a('0x2f')][_0x8a0a('0x36')](_0x8a0a('0x37'))){_0x472373[_0x8a0a('0x20')]=qs[_0x8a0a('0x20')](_0x629110[_0x8a0a('0x2f')][_0x8a0a('0x20')]);_0x472373[_0x8a0a('0x1e')]=qs['offset'](_0x629110['query'][_0x8a0a('0x1e')]);}_0x472373[_0x8a0a('0x38')]=qs['sort'](_0x629110[_0x8a0a('0x2f')]['sort']);_0x472373[_0x8a0a('0x39')]=qs[_0x8a0a('0x30')](_['pick'](_0x629110[_0x8a0a('0x2f')],_0x30a510[_0x8a0a('0x30')]),_0x1928df);if(_0x629110['query'][_0x8a0a('0x3a')]){_0x472373[_0x8a0a('0x39')]=_[_0x8a0a('0x3b')](_0x472373[_0x8a0a('0x39')],{'$or':_[_0x8a0a('0x29')](_0x1928df,function(_0x464384){if(_0x464384['type']!=='VIRTUAL'){var _0x245d7a={};_0x245d7a[_0x464384['name']]={'$like':'%'+_0x629110[_0x8a0a('0x2f')][_0x8a0a('0x3a')]+'%'};return _0x245d7a;}})});}_0x472373=_[_0x8a0a('0x3b')]({},_0x472373,_0x629110[_0x8a0a('0x3c')]);var _0x3b210e={'where':_0x472373[_0x8a0a('0x39')]};return db[_0x8a0a('0x2a')][_0x8a0a('0x21')](_0x3b210e)['then'](function(_0x217a95){_0x1ea8aa[_0x8a0a('0x21')]=_0x217a95;if(_0x629110[_0x8a0a('0x2f')][_0x8a0a('0x3d')]){_0x472373['include']=[{'all':!![]}];}return db[_0x8a0a('0x2a')][_0x8a0a('0x3e')](_0x472373);})[_0x8a0a('0x27')](function(_0x1851d3){_0x1ea8aa[_0x8a0a('0x3f')]=_0x1851d3;return _0x1ea8aa;})[_0x8a0a('0x27')](respondWithFilteredResult(_0x5c59a2,_0x472373))[_0x8a0a('0x40')](handleError(_0x5c59a2,null));};exports['show']=function(_0x4bb2ce,_0x26b6a6){var _0x213d70={'raw':!![],'where':{'id':_0x4bb2ce[_0x8a0a('0x41')]['id']}},_0x51c15a={};_0x51c15a[_0x8a0a('0x32')]=_[_0x8a0a('0x2e')](db['MailTransferReport'][_0x8a0a('0x2b')]);_0x51c15a[_0x8a0a('0x2f')]=_[_0x8a0a('0x2e')](_0x4bb2ce[_0x8a0a('0x2f')]);_0x51c15a['filters']=_['intersection'](_0x51c15a[_0x8a0a('0x32')],_0x51c15a['query']);_0x213d70[_0x8a0a('0x34')]=_[_0x8a0a('0x31')](_0x51c15a[_0x8a0a('0x32')],qs[_0x8a0a('0x33')](_0x4bb2ce[_0x8a0a('0x2f')][_0x8a0a('0x33')]));_0x213d70[_0x8a0a('0x34')]=_0x213d70['attributes']['length']?_0x213d70['attributes']:_0x51c15a[_0x8a0a('0x32')];if(_0x4bb2ce[_0x8a0a('0x2f')]['includeAll']){_0x213d70[_0x8a0a('0x42')]=[{'all':!![]}];}_0x213d70=_[_0x8a0a('0x3b')]({},_0x213d70,_0x4bb2ce[_0x8a0a('0x3c')]);return db[_0x8a0a('0x2a')][_0x8a0a('0x43')](_0x213d70)[_0x8a0a('0x27')](handleEntityNotFound(_0x26b6a6,null))['then'](respondWithResult(_0x26b6a6,null))[_0x8a0a('0x40')](handleError(_0x26b6a6,null));};exports['create']=function(_0x1a1309,_0x2e708e){return db['MailTransferReport'][_0x8a0a('0x44')](_0x1a1309[_0x8a0a('0x45')],{})[_0x8a0a('0x27')](respondWithResult(_0x2e708e,0xc9))[_0x8a0a('0x40')](handleError(_0x2e708e,null));};exports[_0x8a0a('0x26')]=function(_0x367231,_0x1cd01e){if(_0x367231[_0x8a0a('0x45')]['id']){delete _0x367231[_0x8a0a('0x45')]['id'];}return db[_0x8a0a('0x2a')][_0x8a0a('0x43')]({'where':{'id':_0x367231['params']['id']}})[_0x8a0a('0x27')](handleEntityNotFound(_0x1cd01e,null))[_0x8a0a('0x27')](saveUpdates(_0x367231[_0x8a0a('0x45')],null))[_0x8a0a('0x27')](respondWithResult(_0x1cd01e,null))[_0x8a0a('0x40')](handleError(_0x1cd01e,null));};exports['destroy']=function(_0x57e7e6,_0x28b898){return db[_0x8a0a('0x2a')]['find']({'where':{'id':_0x57e7e6[_0x8a0a('0x41')]['id']}})[_0x8a0a('0x27')](handleEntityNotFound(_0x28b898,null))['then'](removeEntity(_0x28b898,null))[_0x8a0a('0x40')](handleError(_0x28b898,null));};exports[_0x8a0a('0x46')]=function(_0x25db83,_0x49cd13){return db[_0x8a0a('0x2a')][_0x8a0a('0x46')]()['then'](respondWithResult(_0x49cd13,null))[_0x8a0a('0x40')](handleError(_0x49cd13,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index bd3cca4..ad881d2 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 _0x02b1=['request-promise','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4b6ea5,_0x382c04){var _0x2fa943=function(_0x13aadf){while(--_0x13aadf){_0x4b6ea5['push'](_0x4b6ea5['shift']());}};_0x2fa943(++_0x382c04);}(_0x02b1,0x7f));var _0x102b=function(_0x31722d,_0x195ef3){_0x31722d=_0x31722d-0x0;var _0x27d919=_0x02b1[_0x31722d];return _0x27d919;};'use strict';var _=require(_0x102b('0x0'));var util=require(_0x102b('0x1'));var logger=require(_0x102b('0x2'))(_0x102b('0x3'));var moment=require(_0x102b('0x4'));var BPromise=require('bluebird');var rp=require(_0x102b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x102b('0x6'));var attributes=require(_0x102b('0x7'));module[_0x102b('0x8')]=function(_0x779f1f,_0x2cf25c){return _0x779f1f['define'](_0x102b('0x9'),attributes,{'tableName':_0x102b('0xa'),'paranoid':![],'indexes':[{'name':_0x102b('0xb'),'fields':[_0x102b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b1d=['bluebird','request-promise','path','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','api','moment'];(function(_0x5e364e,_0x3a8472){var _0x30211c=function(_0x31218c){while(--_0x31218c){_0x5e364e['push'](_0x5e364e['shift']());}};_0x30211c(++_0x3a8472);}(_0x6b1d,0xc9));var _0xd6b1=function(_0x117581,_0x307e77){_0x117581=_0x117581-0x0;var _0x25cfa7=_0x6b1d[_0x117581];return _0x25cfa7;};'use strict';var _=require('lodash');var util=require(_0xd6b1('0x0'));var logger=require('../../config/logger')(_0xd6b1('0x1'));var moment=require(_0xd6b1('0x2'));var BPromise=require(_0xd6b1('0x3'));var rp=require(_0xd6b1('0x4'));var fs=require('fs');var path=require(_0xd6b1('0x5'));var rimraf=require('rimraf');var config=require(_0xd6b1('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0xd6b1('0x7')]=function(_0x37345b,_0x106639){return _0x37345b[_0xd6b1('0x8')](_0xd6b1('0x9'),attributes,{'tableName':_0xd6b1('0xa'),'paranoid':![],'indexes':[{'name':_0xd6b1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index eeb8944..3460e9a 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 _0xa5fd=['http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5fd,0x173));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda5f('0x0'));var BPromise=require(_0xda5f('0x1'));var rs=require(_0xda5f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xda5f('0x3'))(_0xda5f('0x4'));var config=require(_0xda5f('0x5'));var jayson=require(_0xda5f('0x6'));var client=jayson['client'][_0xda5f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b3098,_0x16d2ef,_0xcf238e){return new BPromise(function(_0x3b0ead,_0x585e03){return client[_0xda5f('0x8')](_0x4b3098,_0xcf238e)[_0xda5f('0x9')](function(_0x320a34){logger[_0xda5f('0xa')](_0xda5f('0xb'),_0x16d2ef,_0xda5f('0xc'));logger[_0xda5f('0xd')](_0xda5f('0xe'),_0x16d2ef,'request\x20sent',JSON[_0xda5f('0xf')](_0x320a34));if(_0x320a34[_0xda5f('0x10')]){if(_0x320a34[_0xda5f('0x10')][_0xda5f('0x11')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x16d2ef,_0x320a34[_0xda5f('0x10')][_0xda5f('0x12')]);return _0x585e03(_0x320a34[_0xda5f('0x10')][_0xda5f('0x12')]);}logger[_0xda5f('0x10')](_0xda5f('0xb'),_0x16d2ef,_0x320a34['error'][_0xda5f('0x12')]);return _0x3b0ead(_0x320a34['error'][_0xda5f('0x12')]);}else{logger[_0xda5f('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x16d2ef,_0xda5f('0xc'));_0x3b0ead(_0x320a34[_0xda5f('0x13')][_0xda5f('0x12')]);}})[_0xda5f('0x14')](function(_0x53357c){logger[_0xda5f('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x16d2ef,_0x53357c);_0x585e03(_0x53357c);});});} \ No newline at end of file +var _0x2b3f=['client','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x2b3f,0x1b0));var _0xf2b3=function(_0x20eabe,_0x56599e){_0x20eabe=_0x20eabe-0x0;var _0xd37ac5=_0x2b3f[_0x20eabe];return _0xd37ac5;};'use strict';var _=require(_0xf2b3('0x0'));var util=require('util');var moment=require(_0xf2b3('0x1'));var BPromise=require(_0xf2b3('0x2'));var rs=require(_0xf2b3('0x3'));var fs=require('fs');var Redis=require(_0xf2b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf2b3('0x5'))(_0xf2b3('0x6'));var config=require(_0xf2b3('0x7'));var jayson=require(_0xf2b3('0x8'));var client=jayson[_0xf2b3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27ab30,_0x25432e,_0x3b7f59){return new BPromise(function(_0x3f6361,_0x1ec5a8){return client['request'](_0x27ab30,_0x3b7f59)[_0xf2b3('0xa')](function(_0x3a5377){logger[_0xf2b3('0xb')](_0xf2b3('0xc'),_0x25432e,_0xf2b3('0xd'));logger[_0xf2b3('0xe')](_0xf2b3('0xf'),_0x25432e,_0xf2b3('0xd'),JSON['stringify'](_0x3a5377));if(_0x3a5377[_0xf2b3('0x10')]){if(_0x3a5377['error'][_0xf2b3('0x11')]===0x1f4){logger[_0xf2b3('0x10')](_0xf2b3('0xc'),_0x25432e,_0x3a5377['error']['message']);return _0x1ec5a8(_0x3a5377['error']['message']);}logger[_0xf2b3('0x10')](_0xf2b3('0xc'),_0x25432e,_0x3a5377[_0xf2b3('0x10')]['message']);return _0x3f6361(_0x3a5377['error'][_0xf2b3('0x12')]);}else{logger[_0xf2b3('0xb')](_0xf2b3('0xc'),_0x25432e,_0xf2b3('0xd'));_0x3f6361(_0x3a5377[_0xf2b3('0x13')][_0xf2b3('0x12')]);}})[_0xf2b3('0x14')](function(_0x6fd666){logger[_0xf2b3('0x10')](_0xf2b3('0xc'),_0x25432e,_0x6fd666);_0x1ec5a8(_0x6fd666);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 18625e9..9d1263c 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 _0x1a69=['Router','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','describe','show','post','create','update','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x1a69,0x177));var _0x91a6=function(_0x15c4dd,_0x28b6b2){_0x15c4dd=_0x15c4dd-0x0;var _0x5df0c3=_0x1a69[_0x15c4dd];return _0x5df0c3;};'use strict';var multer=require(_0x91a6('0x0'));var util=require(_0x91a6('0x1'));var path=require(_0x91a6('0x2'));var timeout=require(_0x91a6('0x3'));var express=require(_0x91a6('0x4'));var router=express[_0x91a6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x91a6('0x7'));var controller=require(_0x91a6('0x8'));router['get']('/',auth[_0x91a6('0x9')](),controller[_0x91a6('0xa')]);router[_0x91a6('0xb')]('/describe',auth[_0x91a6('0x9')](),controller[_0x91a6('0xc')]);router[_0x91a6('0xb')]('/:id',auth[_0x91a6('0x9')](),controller[_0x91a6('0xd')]);router[_0x91a6('0xe')]('/',auth[_0x91a6('0x9')](),controller[_0x91a6('0xf')]);router['put']('/:id',auth[_0x91a6('0x9')](),controller[_0x91a6('0x10')]);router['delete'](_0x91a6('0x11'),auth[_0x91a6('0x9')](),controller[_0x91a6('0x12')]);module[_0x91a6('0x13')]=router; \ No newline at end of file +var _0xb08f=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','index','isAuthenticated','describe','get','/:id','show','post','create','put','destroy','exports'];(function(_0x3657a7,_0x2395a3){var _0x4a1dc5=function(_0x51a518){while(--_0x51a518){_0x3657a7['push'](_0x3657a7['shift']());}};_0x4a1dc5(++_0x2395a3);}(_0xb08f,0x17c));var _0xfb08=function(_0x214fa1,_0x327601){_0x214fa1=_0x214fa1-0x0;var _0x3636e3=_0xb08f[_0x214fa1];return _0x3636e3;};'use strict';var multer=require('multer');var util=require(_0xfb08('0x0'));var path=require(_0xfb08('0x1'));var timeout=require(_0xfb08('0x2'));var express=require('express');var router=express[_0xfb08('0x3')]();var fs_extra=require(_0xfb08('0x4'));var auth=require(_0xfb08('0x5'));var interaction=require(_0xfb08('0x6'));var config=require('../../config/environment');var controller=require(_0xfb08('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfb08('0x8')]);router['get']('/describe',auth[_0xfb08('0x9')](),controller[_0xfb08('0xa')]);router[_0xfb08('0xb')](_0xfb08('0xc'),auth[_0xfb08('0x9')](),controller[_0xfb08('0xd')]);router[_0xfb08('0xe')]('/',auth[_0xfb08('0x9')](),controller[_0xfb08('0xf')]);router[_0xfb08('0x10')](_0xfb08('0xc'),auth[_0xfb08('0x9')](),controller['update']);router['delete'](_0xfb08('0xc'),auth[_0xfb08('0x9')](),controller[_0xfb08('0x11')]);module[_0xfb08('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 66e5489..3280db5 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 _0x35a5=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x5de3ce,_0xb182d5){var _0x36fe59=function(_0x101d1b){while(--_0x101d1b){_0x5de3ce['push'](_0x5de3ce['shift']());}};_0x36fe59(++_0xb182d5);}(_0x35a5,0x1df));var _0x535a=function(_0x5bf20a,_0x63375d){_0x5bf20a=_0x5bf20a-0x0;var _0x1a0362=_0x35a5[_0x5bf20a];return _0x1a0362;};'use strict';var Sequelize=require(_0x535a('0x0'));var moment=require(_0x535a('0x1'));module[_0x535a('0x2')]={'channel':{'type':Sequelize[_0x535a('0x3')]},'membername':{'type':Sequelize[_0x535a('0x3')]},'interface':{'type':Sequelize[_0x535a('0x3')]},'type':{'type':Sequelize[_0x535a('0x3')],'defaultValue':_0x535a('0x4'),'comment':_0x535a('0x5')},'duration':{'type':Sequelize[_0x535a('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x535a('0x7')],'set':function(_0x3cc12e){var _0x5518fb=moment(_0x3cc12e);var _0x35d67d=moment(this[_0x535a('0x8')]('enterAt'));var _0x187f05=_0x5518fb['diff'](_0x35d67d,_0x535a('0x9'));this[_0x535a('0xa')]('exitAt',_0x3cc12e);this[_0x535a('0xa')](_0x535a('0xb'),_0x187f05>=0x0?_0x187f05:null);}},'data1':{'type':Sequelize[_0x535a('0x3')],'comment':_0x535a('0xc')},'data2':{'type':Sequelize[_0x535a('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x535a('0xd')},'data4':{'type':Sequelize[_0x535a('0x3')],'comment':_0x535a('0xe')},'data5':{'type':Sequelize[_0x535a('0x3')],'comment':_0x535a('0xf')},'role':{'type':Sequelize[_0x535a('0x3')]},'internal':{'type':Sequelize[_0x535a('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xad56=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0xbe2a17,_0x517d6b){var _0x50cd6b=function(_0x4ed727){while(--_0x4ed727){_0xbe2a17['push'](_0xbe2a17['shift']());}};_0x50cd6b(++_0x517d6b);}(_0xad56,0x14c));var _0x6ad5=function(_0x4ca1b8,_0x9faad5){_0x4ca1b8=_0x4ca1b8-0x0;var _0x49b9e4=_0xad56[_0x4ca1b8];return _0x49b9e4;};'use strict';var Sequelize=require(_0x6ad5('0x0'));var moment=require(_0x6ad5('0x1'));module['exports']={'channel':{'type':Sequelize[_0x6ad5('0x2')]},'membername':{'type':Sequelize[_0x6ad5('0x2')]},'interface':{'type':Sequelize[_0x6ad5('0x2')]},'type':{'type':Sequelize[_0x6ad5('0x2')],'defaultValue':_0x6ad5('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x6ad5('0x4')]},'exitAt':{'type':Sequelize[_0x6ad5('0x4')],'set':function(_0x105f47){var _0x49f239=moment(_0x105f47);var _0x35a80f=moment(this[_0x6ad5('0x5')](_0x6ad5('0x6')));var _0x47633f=_0x49f239[_0x6ad5('0x7')](_0x35a80f,_0x6ad5('0x8'));this[_0x6ad5('0x9')](_0x6ad5('0xa'),_0x105f47);this[_0x6ad5('0x9')](_0x6ad5('0xb'),_0x47633f>=0x0?_0x47633f:null);}},'data1':{'type':Sequelize[_0x6ad5('0x2')],'comment':_0x6ad5('0xc')},'data2':{'type':Sequelize[_0x6ad5('0x2')],'comment':_0x6ad5('0xd')},'data3':{'type':Sequelize[_0x6ad5('0x2')],'comment':_0x6ad5('0xe')},'data4':{'type':Sequelize[_0x6ad5('0x2')],'comment':_0x6ad5('0xf')},'data5':{'type':Sequelize[_0x6ad5('0x2')],'comment':_0x6ad5('0x10')},'role':{'type':Sequelize[_0x6ad5('0x2')]},'internal':{'type':Sequelize[_0x6ad5('0x11')]},'uniqueid':{'type':Sequelize[_0x6ad5('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 56840a0..bd98886 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xedd9,0xfc));var _0x9edd=function(_0x40eddd,_0x3164f8){_0x40eddd=_0x40eddd-0x0;var _0x3c8220=_0xedd9[_0x40eddd];return _0x3c8220;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xedd9,0xfc));var _0x9edd=function(_0x1ca57c,_0x577ed0){_0x1ca57c=_0x1ca57c-0x0;var _0x3d26a2=_0xedd9[_0x1ca57c];return _0x3d26a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1f9af73..ea758fd 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 _0x0497=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername','interface'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x0497,0xe1));var _0x7049=function(_0x347932,_0x2618cc){_0x347932=_0x347932-0x0;var _0x7a730c=_0x0497[_0x347932];return _0x7a730c;};'use strict';var _=require(_0x7049('0x0'));var util=require(_0x7049('0x1'));var logger=require('../../config/logger')(_0x7049('0x2'));var moment=require(_0x7049('0x3'));var BPromise=require(_0x7049('0x4'));var rp=require(_0x7049('0x5'));var fs=require('fs');var path=require(_0x7049('0x6'));var rimraf=require(_0x7049('0x7'));var config=require(_0x7049('0x8'));var attributes=require(_0x7049('0x9'));module[_0x7049('0xa')]=function(_0xf951d2,_0x2443c4){return _0xf951d2[_0x7049('0xb')]('MemberReport',attributes,{'tableName':_0x7049('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x7049('0xd'),_0x7049('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd9=['rimraf','../../config/environment','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird'];(function(_0x48b875,_0x53423b){var _0x5ac132=function(_0x3019ca){while(--_0x3019ca){_0x48b875['push'](_0x48b875['shift']());}};_0x5ac132(++_0x53423b);}(_0x5fd9,0xbe));var _0x95fd=function(_0x1972f4,_0x1231ff){_0x1972f4=_0x1972f4-0x0;var _0x42159b=_0x5fd9[_0x1972f4];return _0x42159b;};'use strict';var _=require(_0x95fd('0x0'));var util=require(_0x95fd('0x1'));var logger=require(_0x95fd('0x2'))(_0x95fd('0x3'));var moment=require('moment');var BPromise=require(_0x95fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95fd('0x5'));var config=require(_0x95fd('0x6'));var attributes=require('./memberReport.attributes');module[_0x95fd('0x7')]=function(_0x14daf8,_0x1fe346){return _0x14daf8[_0x95fd('0x8')](_0x95fd('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x95fd('0xa'),'fields':[_0x95fd('0xb'),_0x95fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f7821c2..116a411 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 _0x81c6=['GetMemberReport','MemberReport','findAll','options','where','limit','include','map','model','attributes','CreateMemberReport','body','raw','UpdateMemberReport','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch'];(function(_0x5b36ac,_0x353cfd){var _0x29bd0e=function(_0x477098){while(--_0x477098){_0x5b36ac['push'](_0x5b36ac['shift']());}};_0x29bd0e(++_0x353cfd);}(_0x81c6,0x1d5));var _0x681c=function(_0x385567,_0x40550f){_0x385567=_0x385567-0x0;var _0x49cf95=_0x81c6[_0x385567];return _0x49cf95;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('MemberReport,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('MemberReport,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['create'](_0x2e783d[_0x681c('0x20')],{'raw':_0x2e783d['options']?_0x2e783d['options'][_0x681c('0x21')]===undefined?!![]:![]:!![]})[_0x681c('0x9')](function(_0x16277f){logger['info'](_0x681c('0x1f'),_0x2e783d);logger['debug'](_0x681c('0x1f'),_0x2e783d,JSON['stringify'](_0x16277f));_0x385b14(_0x16277f);})['catch'](function(_0x4ea825){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x4ea825['message'],_0x2e783d);_0x2179cd(_0x4af6aa[_0x681c('0x10')](0x1f4,_0x4ea825['message']));});});};exports['UpdateMemberReport']=function(_0x3286e1){var _0x52261f=this;return new Promise(function(_0x35991d,_0x4e22f8){return db[_0x681c('0x16')]['update'](_0x3286e1['body'],{'raw':_0x3286e1[_0x681c('0x18')]?_0x3286e1[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3286e1[_0x681c('0x18')]?_0x3286e1[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x3286e1['options']?_0x3286e1[_0x681c('0x18')][_0x681c('0x1e')]||null:null,'limit':_0x3286e1['options']?_0x3286e1[_0x681c('0x18')][_0x681c('0x1a')]||null:null})[_0x681c('0x9')](function(_0x435188){logger[_0x681c('0x12')]('UpdateMemberReport',_0x3286e1);logger['debug'](_0x681c('0x22'),_0x3286e1,JSON[_0x681c('0xe')](_0x435188));_0x35991d(_0x435188);})['catch'](function(_0x3f8618){logger[_0x681c('0x10')]('UpdateMemberReport',_0x3f8618[_0x681c('0x11')],_0x3286e1);_0x4e22f8(_0x52261f[_0x681c('0x10')](0x1f4,_0x3f8618[_0x681c('0x11')]));});});}; \ No newline at end of file +var _0x6144=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','where','limit','include','map','model','attributes','then','CreateMemberReport','create','body','raw','stringify','UpdateMemberReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4782b2,_0x564759){var _0x108f9d=function(_0x5bbe16){while(--_0x5bbe16){_0x4782b2['push'](_0x4782b2['shift']());}};_0x108f9d(++_0x564759);}(_0x6144,0x99));var _0x4614=function(_0x243ec6,_0x38b167){_0x243ec6=_0x243ec6-0x0;var _0x7580ab=_0x6144[_0x243ec6];return _0x7580ab;};'use strict';var _=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var moment=require(_0x4614('0x2'));var BPromise=require(_0x4614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4614('0x4'));var db=require(_0x4614('0x5'))['db'];var utils=require(_0x4614('0x6'));var logger=require(_0x4614('0x7'))('rpc');var config=require(_0x4614('0x8'));var jayson=require(_0x4614('0x9'));var client=jayson[_0x4614('0xa')][_0x4614('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d6142,_0x4a1030,_0x45e5f2){return new BPromise(function(_0x3eb8ea,_0x4035f3){return client[_0x4614('0xc')](_0x3d6142,_0x45e5f2)['then'](function(_0x3c3afa){logger[_0x4614('0xd')](_0x4614('0xe'),_0x4a1030,_0x4614('0xf'));logger[_0x4614('0x10')](_0x4614('0x11'),_0x4a1030,_0x4614('0xf'),JSON['stringify'](_0x3c3afa));if(_0x3c3afa[_0x4614('0x12')]){if(_0x3c3afa[_0x4614('0x12')][_0x4614('0x13')]===0x1f4){logger[_0x4614('0x12')]('MemberReport,\x20%s,\x20%s',_0x4a1030,_0x3c3afa['error'][_0x4614('0x14')]);return _0x4035f3(_0x3c3afa[_0x4614('0x12')][_0x4614('0x14')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x4a1030,_0x3c3afa['error'][_0x4614('0x14')]);return _0x3eb8ea(_0x3c3afa[_0x4614('0x12')]['message']);}else{logger[_0x4614('0xd')](_0x4614('0xe'),_0x4a1030,_0x4614('0xf'));_0x3eb8ea(_0x3c3afa['result'][_0x4614('0x14')]);}})[_0x4614('0x15')](function(_0x1f30b0){logger[_0x4614('0x12')](_0x4614('0xe'),_0x4a1030,_0x1f30b0);_0x4035f3(_0x1f30b0);});});}exports[_0x4614('0x16')]=function(_0x5d10fc){var _0x29f526=this;return new Promise(function(_0x195eac,_0x53a14c){return db[_0x4614('0x17')][_0x4614('0x18')]({'raw':_0x5d10fc[_0x4614('0x19')]?_0x5d10fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d10fc[_0x4614('0x19')]?_0x5d10fc[_0x4614('0x19')][_0x4614('0x1a')]||null:null,'attributes':_0x5d10fc['options']?_0x5d10fc[_0x4614('0x19')]['attributes']||null:null,'limit':_0x5d10fc['options']?_0x5d10fc[_0x4614('0x19')][_0x4614('0x1b')]||null:null,'include':_0x5d10fc[_0x4614('0x19')]?_0x5d10fc['options'][_0x4614('0x1c')]?_[_0x4614('0x1d')](_0x5d10fc[_0x4614('0x19')]['include'],function(_0x341fa5){return{'model':db[_0x341fa5[_0x4614('0x1e')]],'as':_0x341fa5['as'],'attributes':_0x341fa5['attributes'],'include':_0x341fa5[_0x4614('0x1c')]?_[_0x4614('0x1d')](_0x341fa5[_0x4614('0x1c')],function(_0x51edf0){return{'model':db[_0x51edf0[_0x4614('0x1e')]],'as':_0x51edf0['as'],'attributes':_0x51edf0['attributes'],'include':_0x51edf0[_0x4614('0x1c')]?_[_0x4614('0x1d')](_0x51edf0[_0x4614('0x1c')],function(_0x5ecfa6){return{'model':db[_0x5ecfa6['model']],'as':_0x5ecfa6['as'],'attributes':_0x5ecfa6[_0x4614('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4614('0x20')](function(_0x48bf58){logger['info'](_0x4614('0x16'),_0x5d10fc);logger[_0x4614('0x10')](_0x4614('0x16'),_0x5d10fc,JSON['stringify'](_0x48bf58));_0x195eac(_0x48bf58);})[_0x4614('0x15')](function(_0xc57a63){logger[_0x4614('0x12')](_0x4614('0x16'),_0xc57a63[_0x4614('0x14')],_0x5d10fc);_0x53a14c(_0x29f526[_0x4614('0x12')](0x1f4,_0xc57a63[_0x4614('0x14')]));});});};exports[_0x4614('0x21')]=function(_0x1bbe82){var _0x1a0f26=this;return new Promise(function(_0x2ebe8d,_0x521651){return db[_0x4614('0x17')][_0x4614('0x22')](_0x1bbe82[_0x4614('0x23')],{'raw':_0x1bbe82[_0x4614('0x19')]?_0x1bbe82['options'][_0x4614('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x22da64){logger[_0x4614('0xd')](_0x4614('0x21'),_0x1bbe82);logger[_0x4614('0x10')]('CreateMemberReport',_0x1bbe82,JSON[_0x4614('0x25')](_0x22da64));_0x2ebe8d(_0x22da64);})[_0x4614('0x15')](function(_0x77e060){logger['error']('CreateMemberReport',_0x77e060[_0x4614('0x14')],_0x1bbe82);_0x521651(_0x1a0f26[_0x4614('0x12')](0x1f4,_0x77e060['message']));});});};exports[_0x4614('0x26')]=function(_0x505ccd){var _0x153f15=this;return new Promise(function(_0x6c0ba2,_0x1a66e4){return db[_0x4614('0x17')][_0x4614('0x27')](_0x505ccd['body'],{'raw':_0x505ccd['options']?_0x505ccd[_0x4614('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x505ccd['options']?_0x505ccd[_0x4614('0x19')][_0x4614('0x1a')]||null:null,'attributes':_0x505ccd['options']?_0x505ccd[_0x4614('0x19')][_0x4614('0x1f')]||null:null,'limit':_0x505ccd[_0x4614('0x19')]?_0x505ccd[_0x4614('0x19')][_0x4614('0x1b')]||null:null})[_0x4614('0x20')](function(_0x318b28){logger[_0x4614('0xd')](_0x4614('0x26'),_0x505ccd);logger[_0x4614('0x10')](_0x4614('0x26'),_0x505ccd,JSON[_0x4614('0x25')](_0x318b28));_0x6c0ba2(_0x318b28);})[_0x4614('0x15')](function(_0x126e3f){logger['error'](_0x4614('0x26'),_0x126e3f[_0x4614('0x14')],_0x505ccd);_0x1a66e4(_0x153f15[_0x4614('0x12')](0x1f4,_0x126e3f[_0x4614('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 643a88b..2a2ba17 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 _0x9dd0=['../../config/environment','./migration.controller','get','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31a639,_0x392cf8){var _0x4a8300=function(_0x449727){while(--_0x449727){_0x31a639['push'](_0x31a639['shift']());}};_0x4a8300(++_0x392cf8);}(_0x9dd0,0x1bb));var _0x09dd=function(_0x71e45c,_0x10ed83){_0x71e45c=_0x71e45c-0x0;var _0x222130=_0x9dd0[_0x71e45c];return _0x222130;};'use strict';var multer=require(_0x09dd('0x0'));var util=require(_0x09dd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09dd('0x2'));var router=express[_0x09dd('0x3')]();var fs_extra=require(_0x09dd('0x4'));var auth=require(_0x09dd('0x5'));var interaction=require(_0x09dd('0x6'));var config=require(_0x09dd('0x7'));var controller=require(_0x09dd('0x8'));router[_0x09dd('0x9')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0xc82d=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x50f5f7,_0x1f6bf4){var _0x18fb38=function(_0x3c4204){while(--_0x3c4204){_0x50f5f7['push'](_0x50f5f7['shift']());}};_0x18fb38(++_0x1f6bf4);}(_0xc82d,0x7a));var _0xdc82=function(_0x436641,_0x4afca2){_0x436641=_0x436641-0x0;var _0x29e38f=_0xc82d[_0x436641];return _0x29e38f;};'use strict';var multer=require(_0xdc82('0x0'));var util=require(_0xdc82('0x1'));var path=require(_0xdc82('0x2'));var timeout=require(_0xdc82('0x3'));var express=require('express');var router=express[_0xdc82('0x4')]();var fs_extra=require(_0xdc82('0x5'));var auth=require(_0xdc82('0x6'));var interaction=require(_0xdc82('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xdc82('0x8')]('/',controller[_0xdc82('0x9')]);module[_0xdc82('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e9cd61b..a666faf 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 _0x4071=['sequelize','STRING'];(function(_0x5527ad,_0x30bf8f){var _0x4a74c6=function(_0x1b404a){while(--_0x1b404a){_0x5527ad['push'](_0x5527ad['shift']());}};_0x4a74c6(++_0x30bf8f);}(_0x4071,0xbe));var _0x1407=function(_0x5df538,_0x5c5bb8){_0x5df538=_0x5df538-0x0;var _0xea390d=_0x4071[_0x5df538];return _0xea390d;};'use strict';var Sequelize=require(_0x1407('0x0'));module['exports']={'version':{'type':Sequelize[_0x1407('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xf526=['sequelize','exports','STRING'];(function(_0x28b3f8,_0x31e698){var _0xa403f3=function(_0x387adc){while(--_0x387adc){_0x28b3f8['push'](_0x28b3f8['shift']());}};_0xa403f3(++_0x31e698);}(_0xf526,0x11d));var _0x6f52=function(_0xd04979,_0x1337a6){_0xd04979=_0xd04979-0x0;var _0x155676=_0xf526[_0xd04979];return _0x155676;};'use strict';var Sequelize=require(_0x6f52('0x0'));module[_0x6f52('0x1')]={'version':{'type':Sequelize[_0x6f52('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ec410cf..d65addc 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 _0xd7c2=['offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','Migration','fieldName','type','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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','api','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x3c9ca0,_0x4ac698){var _0x22dcb6=function(_0x28cd68){while(--_0x28cd68){_0x3c9ca0['push'](_0x3c9ca0['shift']());}};_0x22dcb6(++_0x4ac698);}(_0xd7c2,0xeb));var _0x2d7c=function(_0x5af6d1,_0x405643){_0x5af6d1=_0x5af6d1-0x0;var _0x32317f=_0xd7c2[_0x5af6d1];return _0x32317f;};'use strict';var emlformat=require(_0x2d7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d7c('0x1'));var jsonpatch=require(_0x2d7c('0x2'));var rp=require(_0x2d7c('0x3'));var moment=require('moment');var BPromise=require(_0x2d7c('0x4'));var Mustache=require('mustache');var util=require(_0x2d7c('0x5'));var path=require(_0x2d7c('0x6'));var sox=require(_0x2d7c('0x7'));var csv=require(_0x2d7c('0x8'));var ejs=require(_0x2d7c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d7c('0xa'));var squel=require(_0x2d7c('0xb'));var crypto=require(_0x2d7c('0xc'));var jsforce=require(_0x2d7c('0xd'));var deskjs=require(_0x2d7c('0xe'));var toCsv=require(_0x2d7c('0x8'));var querystring=require(_0x2d7c('0xf'));var Papa=require(_0x2d7c('0x10'));var Redis=require(_0x2d7c('0x11'));var authService=require(_0x2d7c('0x12'));var qs=require(_0x2d7c('0x13'));var as=require(_0x2d7c('0x14'));var hardwareService=require(_0x2d7c('0x15'));var logger=require('../../config/logger')(_0x2d7c('0x16'));var utils=require(_0x2d7c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d7c('0x18'))['db'];function respondWithStatusCode(_0x29c365,_0x5f5400){_0x5f5400=_0x5f5400||0xcc;return function(_0x4fb44b){if(_0x4fb44b){return _0x29c365[_0x2d7c('0x19')](_0x5f5400);}return _0x29c365[_0x2d7c('0x1a')](_0x5f5400)[_0x2d7c('0x1b')]();};}function respondWithResult(_0x3e7bf3,_0x328f12){_0x328f12=_0x328f12||0xc8;return function(_0x2847f1){if(_0x2847f1){return _0x3e7bf3[_0x2d7c('0x1a')](_0x328f12)[_0x2d7c('0x1c')](_0x2847f1);}};}function respondWithFilteredResult(_0x361c5f,_0xcc4167){return function(_0x31a968){if(_0x31a968){var _0x388890=typeof _0xcc4167[_0x2d7c('0x1d')]===_0x2d7c('0x1e')&&typeof _0xcc4167['limit']===_0x2d7c('0x1e');var _0x5efc69=_0x31a968[_0x2d7c('0x1f')];var _0x4dbaf8=_0x388890?0x0:_0xcc4167[_0x2d7c('0x1d')];var _0x6a1f75=_0x388890?_0x31a968[_0x2d7c('0x1f')]:_0xcc4167[_0x2d7c('0x1d')]+_0xcc4167['limit'];var _0x3de98b;if(_0x6a1f75>=_0x5efc69){_0x6a1f75=_0x5efc69;_0x3de98b=0xc8;}else{_0x3de98b=0xce;}_0x361c5f[_0x2d7c('0x1a')](_0x3de98b);return _0x361c5f[_0x2d7c('0x20')](_0x2d7c('0x21'),_0x4dbaf8+'-'+_0x6a1f75+'/'+_0x5efc69)[_0x2d7c('0x1c')](_0x31a968);}return null;};}function patchUpdates(_0x24846d){return function(_0x5b982c){try{jsonpatch[_0x2d7c('0x22')](_0x5b982c,_0x24846d,!![]);}catch(_0x4816db){return BPromise[_0x2d7c('0x23')](_0x4816db);}return _0x5b982c[_0x2d7c('0x24')]();};}function saveUpdates(_0x3edf37,_0x268e55){return function(_0x368946){if(_0x368946){return _0x368946['update'](_0x3edf37)[_0x2d7c('0x25')](function(_0x16b4a5){return _0x16b4a5;});}return null;};}function removeEntity(_0x53ea6f,_0x9961c6){return function(_0x58ae2b){if(_0x58ae2b){return _0x58ae2b[_0x2d7c('0x26')]()[_0x2d7c('0x25')](function(){_0x53ea6f[_0x2d7c('0x1a')](0xcc)[_0x2d7c('0x1b')]();});}};}function handleEntityNotFound(_0x1cffde,_0x5ab8aa){return function(_0x11e561){if(!_0x11e561){_0x1cffde[_0x2d7c('0x19')](0x194);}return _0x11e561;};}function handleError(_0x463f9e,_0x11c988){_0x11c988=_0x11c988||0x1f4;return function(_0x521e74){logger[_0x2d7c('0x27')](_0x521e74[_0x2d7c('0x28')]);if(_0x521e74[_0x2d7c('0x29')]){delete _0x521e74[_0x2d7c('0x29')];}_0x463f9e['status'](_0x11c988)[_0x2d7c('0x2a')](_0x521e74);};}exports['index']=function(_0x217453,_0x30f917){var _0x217469={},_0x199ee8={},_0x25793c={'count':0x0,'rows':[]};var _0x5c5423=_[_0x2d7c('0x2b')](db[_0x2d7c('0x2c')]['rawAttributes'],function(_0x2bebae){return{'name':_0x2bebae[_0x2d7c('0x2d')],'type':_0x2bebae[_0x2d7c('0x2e')]['key']};});_0x199ee8['model']=_[_0x2d7c('0x2b')](_0x5c5423,_0x2d7c('0x29'));_0x199ee8[_0x2d7c('0x2f')]=_['keys'](_0x217453['query']);_0x199ee8[_0x2d7c('0x30')]=_[_0x2d7c('0x31')](_0x199ee8['model'],_0x199ee8[_0x2d7c('0x2f')]);_0x217469[_0x2d7c('0x32')]=_[_0x2d7c('0x31')](_0x199ee8['model'],qs[_0x2d7c('0x33')](_0x217453[_0x2d7c('0x2f')][_0x2d7c('0x33')]));_0x217469[_0x2d7c('0x32')]=_0x217469['attributes'][_0x2d7c('0x34')]?_0x217469['attributes']:_0x199ee8[_0x2d7c('0x35')];if(!_0x217453[_0x2d7c('0x2f')][_0x2d7c('0x36')](_0x2d7c('0x37'))){_0x217469[_0x2d7c('0x38')]=qs['limit'](_0x217453['query'][_0x2d7c('0x38')]);_0x217469[_0x2d7c('0x1d')]=qs['offset'](_0x217453[_0x2d7c('0x2f')][_0x2d7c('0x1d')]);}_0x217469['order']=qs[_0x2d7c('0x39')](_0x217453[_0x2d7c('0x2f')]['sort']);_0x217469[_0x2d7c('0x3a')]=qs[_0x2d7c('0x30')](_[_0x2d7c('0x3b')](_0x217453[_0x2d7c('0x2f')],_0x199ee8[_0x2d7c('0x30')]),_0x5c5423);if(_0x217453[_0x2d7c('0x2f')][_0x2d7c('0x3c')]){_0x217469['where']=_[_0x2d7c('0x3d')](_0x217469['where'],{'$or':_['map'](_0x5c5423,function(_0x5a92df){if(_0x5a92df[_0x2d7c('0x2e')]!==_0x2d7c('0x3e')){var _0x4f047b={};_0x4f047b[_0x5a92df['name']]={'$like':'%'+_0x217453[_0x2d7c('0x2f')][_0x2d7c('0x3c')]+'%'};return _0x4f047b;}})});}_0x217469=_[_0x2d7c('0x3d')]({},_0x217469,_0x217453[_0x2d7c('0x3f')]);var _0x1994cb={'where':_0x217469[_0x2d7c('0x3a')]};return db[_0x2d7c('0x2c')]['count'](_0x1994cb)[_0x2d7c('0x25')](function(_0x560647){_0x25793c[_0x2d7c('0x1f')]=_0x560647;if(_0x217453[_0x2d7c('0x2f')][_0x2d7c('0x40')]){_0x217469[_0x2d7c('0x41')]=[{'all':!![]}];}return db[_0x2d7c('0x2c')]['findAll'](_0x217469);})[_0x2d7c('0x25')](function(_0x342360){_0x25793c['rows']=_0x342360;return _0x25793c;})[_0x2d7c('0x25')](respondWithFilteredResult(_0x30f917,_0x217469))['catch'](handleError(_0x30f917,null));}; \ No newline at end of file +var _0xbc44=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','Migration','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse'];(function(_0x345bc6,_0xd14200){var _0x1081f2=function(_0x1ee68a){while(--_0x1ee68a){_0x345bc6['push'](_0x345bc6['shift']());}};_0x1081f2(++_0xd14200);}(_0xbc44,0xb8));var _0x4bc4=function(_0x3341c8,_0x16d391){_0x3341c8=_0x3341c8-0x0;var _0x5400ea=_0xbc44[_0x3341c8];return _0x5400ea;};'use strict';var emlformat=require(_0x4bc4('0x0'));var rimraf=require(_0x4bc4('0x1'));var zipdir=require(_0x4bc4('0x2'));var jsonpatch=require(_0x4bc4('0x3'));var rp=require(_0x4bc4('0x4'));var moment=require(_0x4bc4('0x5'));var BPromise=require(_0x4bc4('0x6'));var Mustache=require(_0x4bc4('0x7'));var util=require('util');var path=require(_0x4bc4('0x8'));var sox=require(_0x4bc4('0x9'));var csv=require(_0x4bc4('0xa'));var ejs=require(_0x4bc4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bc4('0xc'));var squel=require('squel');var crypto=require(_0x4bc4('0xd'));var jsforce=require(_0x4bc4('0xe'));var deskjs=require(_0x4bc4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4bc4('0x10'));var Redis=require(_0x4bc4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4bc4('0x12'));var as=require(_0x4bc4('0x13'));var hardwareService=require(_0x4bc4('0x14'));var logger=require('../../config/logger')(_0x4bc4('0x15'));var utils=require(_0x4bc4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4bc4('0x17'));var db=require(_0x4bc4('0x18'))['db'];function respondWithStatusCode(_0x98fa09,_0x5580fb){_0x5580fb=_0x5580fb||0xcc;return function(_0x300452){if(_0x300452){return _0x98fa09['sendStatus'](_0x5580fb);}return _0x98fa09[_0x4bc4('0x19')](_0x5580fb)[_0x4bc4('0x1a')]();};}function respondWithResult(_0xdcaae5,_0x2bef2c){_0x2bef2c=_0x2bef2c||0xc8;return function(_0x21b562){if(_0x21b562){return _0xdcaae5['status'](_0x2bef2c)[_0x4bc4('0x1b')](_0x21b562);}};}function respondWithFilteredResult(_0x59f747,_0x1129bd){return function(_0x5109e3){if(_0x5109e3){var _0x5010b0=typeof _0x1129bd[_0x4bc4('0x1c')]==='undefined'&&typeof _0x1129bd['limit']==='undefined';var _0x57a157=_0x5109e3[_0x4bc4('0x1d')];var _0xdf2e4f=_0x5010b0?0x0:_0x1129bd[_0x4bc4('0x1c')];var _0x37bc68=_0x5010b0?_0x5109e3[_0x4bc4('0x1d')]:_0x1129bd[_0x4bc4('0x1c')]+_0x1129bd[_0x4bc4('0x1e')];var _0x20e4f4;if(_0x37bc68>=_0x57a157){_0x37bc68=_0x57a157;_0x20e4f4=0xc8;}else{_0x20e4f4=0xce;}_0x59f747[_0x4bc4('0x19')](_0x20e4f4);return _0x59f747[_0x4bc4('0x1f')](_0x4bc4('0x20'),_0xdf2e4f+'-'+_0x37bc68+'/'+_0x57a157)[_0x4bc4('0x1b')](_0x5109e3);}return null;};}function patchUpdates(_0x4e515f){return function(_0x540479){try{jsonpatch[_0x4bc4('0x21')](_0x540479,_0x4e515f,!![]);}catch(_0x519299){return BPromise[_0x4bc4('0x22')](_0x519299);}return _0x540479['save']();};}function saveUpdates(_0x831923,_0x1474b9){return function(_0x5bf4ce){if(_0x5bf4ce){return _0x5bf4ce[_0x4bc4('0x23')](_0x831923)[_0x4bc4('0x24')](function(_0x5c82a4){return _0x5c82a4;});}return null;};}function removeEntity(_0x47bd13,_0x54c6f2){return function(_0x16b6c9){if(_0x16b6c9){return _0x16b6c9[_0x4bc4('0x25')]()[_0x4bc4('0x24')](function(){_0x47bd13[_0x4bc4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x562fb5,_0x4cc007){return function(_0x4d0bce){if(!_0x4d0bce){_0x562fb5[_0x4bc4('0x26')](0x194);}return _0x4d0bce;};}function handleError(_0x4ecadb,_0x59440f){_0x59440f=_0x59440f||0x1f4;return function(_0xffffe0){logger[_0x4bc4('0x27')](_0xffffe0['stack']);if(_0xffffe0[_0x4bc4('0x28')]){delete _0xffffe0[_0x4bc4('0x28')];}_0x4ecadb['status'](_0x59440f)[_0x4bc4('0x29')](_0xffffe0);};}exports[_0x4bc4('0x2a')]=function(_0x4f51f3,_0x42ca70){var _0x2e38ac={},_0x2c86fa={},_0x2af036={'count':0x0,'rows':[]};var _0x5d872c=_['map'](db[_0x4bc4('0x2b')]['rawAttributes'],function(_0x35c72f){return{'name':_0x35c72f[_0x4bc4('0x2c')],'type':_0x35c72f['type'][_0x4bc4('0x2d')]};});_0x2c86fa[_0x4bc4('0x2e')]=_[_0x4bc4('0x2f')](_0x5d872c,_0x4bc4('0x28'));_0x2c86fa['query']=_[_0x4bc4('0x30')](_0x4f51f3[_0x4bc4('0x31')]);_0x2c86fa[_0x4bc4('0x32')]=_[_0x4bc4('0x33')](_0x2c86fa[_0x4bc4('0x2e')],_0x2c86fa[_0x4bc4('0x31')]);_0x2e38ac[_0x4bc4('0x34')]=_[_0x4bc4('0x33')](_0x2c86fa[_0x4bc4('0x2e')],qs[_0x4bc4('0x35')](_0x4f51f3[_0x4bc4('0x31')]['fields']));_0x2e38ac[_0x4bc4('0x34')]=_0x2e38ac['attributes'][_0x4bc4('0x36')]?_0x2e38ac[_0x4bc4('0x34')]:_0x2c86fa[_0x4bc4('0x2e')];if(!_0x4f51f3[_0x4bc4('0x31')][_0x4bc4('0x37')]('nolimit')){_0x2e38ac[_0x4bc4('0x1e')]=qs[_0x4bc4('0x1e')](_0x4f51f3[_0x4bc4('0x31')]['limit']);_0x2e38ac[_0x4bc4('0x1c')]=qs[_0x4bc4('0x1c')](_0x4f51f3[_0x4bc4('0x31')][_0x4bc4('0x1c')]);}_0x2e38ac[_0x4bc4('0x38')]=qs[_0x4bc4('0x39')](_0x4f51f3[_0x4bc4('0x31')][_0x4bc4('0x39')]);_0x2e38ac[_0x4bc4('0x3a')]=qs[_0x4bc4('0x32')](_['pick'](_0x4f51f3[_0x4bc4('0x31')],_0x2c86fa[_0x4bc4('0x32')]),_0x5d872c);if(_0x4f51f3['query'][_0x4bc4('0x3b')]){_0x2e38ac[_0x4bc4('0x3a')]=_[_0x4bc4('0x3c')](_0x2e38ac[_0x4bc4('0x3a')],{'$or':_['map'](_0x5d872c,function(_0x4c59e9){if(_0x4c59e9[_0x4bc4('0x3d')]!==_0x4bc4('0x3e')){var _0x52a607={};_0x52a607[_0x4c59e9['name']]={'$like':'%'+_0x4f51f3[_0x4bc4('0x31')][_0x4bc4('0x3b')]+'%'};return _0x52a607;}})});}_0x2e38ac=_['merge']({},_0x2e38ac,_0x4f51f3['options']);var _0x5d1918={'where':_0x2e38ac[_0x4bc4('0x3a')]};return db['Migration'][_0x4bc4('0x1d')](_0x5d1918)[_0x4bc4('0x24')](function(_0x12439b){_0x2af036[_0x4bc4('0x1d')]=_0x12439b;if(_0x4f51f3['query'][_0x4bc4('0x3f')]){_0x2e38ac[_0x4bc4('0x40')]=[{'all':!![]}];}return db[_0x4bc4('0x2b')]['findAll'](_0x2e38ac);})[_0x4bc4('0x24')](function(_0x371b02){_0x2af036[_0x4bc4('0x41')]=_0x371b02;return _0x2af036;})['then'](respondWithFilteredResult(_0x42ca70,_0x2e38ac))[_0x4bc4('0x42')](handleError(_0x42ca70,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f92284a..2070c16 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 _0x5819=['../../config/logger','api','moment','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5819,0x1a1));var _0x9581=function(_0x4cd785,_0x57affa){_0x4cd785=_0x4cd785-0x0;var _0xfa5d8=_0x5819[_0x4cd785];return _0xfa5d8;};'use strict';var _=require(_0x9581('0x0'));var util=require('util');var logger=require(_0x9581('0x1'))(_0x9581('0x2'));var moment=require(_0x9581('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9581('0x4'));var config=require(_0x9581('0x5'));var attributes=require(_0x9581('0x6'));module[_0x9581('0x7')]=function(_0x255bfb,_0x3480f5){return _0x255bfb[_0x9581('0x8')](_0x9581('0x9'),attributes,{'tableName':_0x9581('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b06=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./migration.attributes','Migration','migrations','lodash'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x8b06,0x103));var _0x68b0=function(_0x5520a7,_0x341980){_0x5520a7=_0x5520a7-0x0;var _0x5e39d6=_0x8b06[_0x5520a7];return _0x5e39d6;};'use strict';var _=require(_0x68b0('0x0'));var util=require('util');var logger=require(_0x68b0('0x1'))(_0x68b0('0x2'));var moment=require('moment');var BPromise=require(_0x68b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x68b0('0x4'));var rimraf=require(_0x68b0('0x5'));var config=require(_0x68b0('0x6'));var attributes=require(_0x68b0('0x7'));module['exports']=function(_0x2fd786,_0x301804){return _0x2fd786['define'](_0x68b0('0x8'),attributes,{'tableName':_0x68b0('0x9'),'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 d7f5cdb..a371252 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 _0x7d13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7d13,0x6c));var _0x37d1=function(_0x4c2e0e,_0x514f78){_0x4c2e0e=_0x4c2e0e-0x0;var _0x24e866=_0x7d13[_0x4c2e0e];return _0x24e866;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require('moment');var BPromise=require(_0x37d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d1('0x2'));var db=require(_0x37d1('0x3'))['db'];var utils=require(_0x37d1('0x4'));var logger=require(_0x37d1('0x5'))(_0x37d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d1('0x7'));var client=jayson[_0x37d1('0x8')][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ac1d,_0x5146e3,_0x9302bd){return new BPromise(function(_0x41dfaa,_0x115eca){return client[_0x37d1('0xa')](_0x27ac1d,_0x9302bd)[_0x37d1('0xb')](function(_0x636359){logger[_0x37d1('0xc')]('Migration,\x20%s,\x20%s',_0x5146e3,'request\x20sent');logger[_0x37d1('0xd')](_0x37d1('0xe'),_0x5146e3,'request\x20sent',JSON[_0x37d1('0xf')](_0x636359));if(_0x636359[_0x37d1('0x10')]){if(_0x636359[_0x37d1('0x10')][_0x37d1('0x11')]===0x1f4){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x115eca(_0x636359['error'][_0x37d1('0x13')]);}logger[_0x37d1('0x10')]('Migration,\x20%s,\x20%s',_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x41dfaa(_0x636359['error'][_0x37d1('0x13')]);}else{logger[_0x37d1('0xc')]('Migration,\x20%s,\x20%s',_0x5146e3,'request\x20sent');_0x41dfaa(_0x636359[_0x37d1('0x14')][_0x37d1('0x13')]);}})[_0x37d1('0x15')](function(_0x5ded71){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x5ded71);_0x115eca(_0x5ded71);});});} \ No newline at end of file +var _0x851d=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result'];(function(_0x2c2dca,_0x504f0d){var _0x48543a=function(_0xc42894){while(--_0xc42894){_0x2c2dca['push'](_0x2c2dca['shift']());}};_0x48543a(++_0x504f0d);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd851('0x0'));var util=require('util');var moment=require(_0xd851('0x1'));var BPromise=require(_0xd851('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd851('0x3'));var db=require(_0xd851('0x4'))['db'];var utils=require(_0xd851('0x5'));var logger=require(_0xd851('0x6'))(_0xd851('0x7'));var config=require(_0xd851('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd851('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b63e4,_0x3d2383,_0x2f9540){return new BPromise(function(_0x60bef0,_0x4554d8){return client['request'](_0x2b63e4,_0x2f9540)[_0xd851('0xa')](function(_0x51bf16){logger[_0xd851('0xb')](_0xd851('0xc'),_0x3d2383,'request\x20sent');logger[_0xd851('0xd')](_0xd851('0xe'),_0x3d2383,_0xd851('0xf'),JSON[_0xd851('0x10')](_0x51bf16));if(_0x51bf16['error']){if(_0x51bf16['error'][_0xd851('0x11')]===0x1f4){logger[_0xd851('0x12')](_0xd851('0xc'),_0x3d2383,_0x51bf16[_0xd851('0x12')]['message']);return _0x4554d8(_0x51bf16[_0xd851('0x12')][_0xd851('0x13')]);}logger['error'](_0xd851('0xc'),_0x3d2383,_0x51bf16[_0xd851('0x12')][_0xd851('0x13')]);return _0x60bef0(_0x51bf16['error'][_0xd851('0x13')]);}else{logger[_0xd851('0xb')](_0xd851('0xc'),_0x3d2383,_0xd851('0xf'));_0x60bef0(_0x51bf16[_0xd851('0x14')][_0xd851('0x13')]);}})['catch'](function(_0x448e31){logger[_0xd851('0x12')](_0xd851('0xc'),_0x3d2383,_0x448e31);_0x4554d8(_0x448e31);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 52241c3..53d6dde 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 _0x50a8=['update','delete','exports','util','connect-timeout','express','Router','fs-extra','./network.controller','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x29999f,_0x1f0f86){var _0x48edf5=function(_0x1f3237){while(--_0x1f3237){_0x29999f['push'](_0x29999f['shift']());}};_0x48edf5(++_0x1f0f86);}(_0x50a8,0x193));var _0x850a=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0x50a8[_0x1af0e5];return _0x3c444a;};'use strict';var multer=require('multer');var util=require(_0x850a('0x0'));var path=require('path');var timeout=require(_0x850a('0x1'));var express=require(_0x850a('0x2'));var router=express[_0x850a('0x3')]();var fs_extra=require(_0x850a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x850a('0x5'));router[_0x850a('0x6')]('/',auth['isAuthenticated'](),controller[_0x850a('0x7')]);router['get'](_0x850a('0x8'),auth[_0x850a('0x9')](),controller[_0x850a('0xa')]);router['post']('/',auth[_0x850a('0x9')](),controller[_0x850a('0xb')]);router[_0x850a('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x850a('0xd')]);router[_0x850a('0xe')]('/:id',auth[_0x850a('0x9')](),controller['destroy']);module[_0x850a('0xf')]=router; \ No newline at end of file +var _0xdfa0=['get','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xdfa0,0x69));var _0x0dfa=function(_0x56ea9a,_0x59ad20){_0x56ea9a=_0x56ea9a-0x0;var _0x150bb6=_0xdfa0[_0x56ea9a];return _0x150bb6;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var fs_extra=require(_0x0dfa('0x4'));var auth=require(_0x0dfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dfa('0x6'));var controller=require('./network.controller');router[_0x0dfa('0x7')]('/',auth[_0x0dfa('0x8')](),controller['index']);router[_0x0dfa('0x7')](_0x0dfa('0x9'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0xb')]('/',auth['isAuthenticated'](),controller[_0x0dfa('0xc')]);router[_0x0dfa('0xd')](_0x0dfa('0x9'),auth['isAuthenticated'](),controller[_0x0dfa('0xe')]);router['delete'](_0x0dfa('0x9'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xf')]);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 7227483..2cd549d 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 _0xe880=['sequelize','exports','stun','STRING'];(function(_0x1f386c,_0x289dee){var _0x54446b=function(_0x4dc541){while(--_0x4dc541){_0x1f386c['push'](_0x1f386c['shift']());}};_0x54446b(++_0x289dee);}(_0xe880,0x180));var _0x0e88=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xe880[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0x0e88('0x0'));module[_0x0e88('0x1')]={'type':{'type':Sequelize['ENUM']('localnet','externip',_0x0e88('0x2'),'turn')},'value':{'type':Sequelize[_0x0e88('0x3')]},'username':{'type':Sequelize[_0x0e88('0x3')]},'password':{'type':Sequelize[_0x0e88('0x3')]}}; \ No newline at end of file +var _0x9209=['stun','turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9209,0x113));var _0x9920=function(_0x14f7e0,_0x4028f8){_0x14f7e0=_0x14f7e0-0x0;var _0x30b764=_0x9209[_0x14f7e0];return _0x30b764;};'use strict';var Sequelize=require(_0x9920('0x0'));module[_0x9920('0x1')]={'type':{'type':Sequelize[_0x9920('0x2')](_0x9920('0x3'),_0x9920('0x4'),_0x9920('0x5'),_0x9920('0x6'))},'value':{'type':Sequelize[_0x9920('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9920('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4dad93f..f8b5d53 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 _0x80bd=['length','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','toLowerCase','chan_sip.so','update','findAll','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','../../config/logger','../../mysqldb','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','json','undefined','count','offset','status','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params'];(function(_0x8fb89b,_0x39b030){var _0x42fdbc=function(_0x57fb1b){while(--_0x57fb1b){_0x8fb89b['push'](_0x8fb89b['shift']());}};_0x42fdbc(++_0x39b030);}(_0x80bd,0xbe));var _0xd80b=function(_0x285f99,_0x5203e8){_0x285f99=_0x285f99-0x0;var _0x3f9352=_0x80bd[_0x285f99];return _0x3f9352;};'use strict';var util=require(_0xd80b('0x0'));var path=require(_0xd80b('0x1'));var ejs=require(_0xd80b('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xd80b('0x3'))('api');var config=require('../../config/environment');var db=require(_0xd80b('0x4'))['db'];var jayson=require(_0xd80b('0x5'));var client=jayson[_0xd80b('0x6')][_0xd80b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x119c07,_0xd5919,_0x1a1239,_0x3b25cf){return new Promise(function(_0x28b0bd,_0x2d0047){var _0x20e8eb=_0x3b25cf||client;return _0x20e8eb['request'](_0x119c07,_0x1a1239)[_0xd80b('0x8')](function(_0x2c354d){logger['info'](_0xd80b('0x9'),_0xd5919,_0xd80b('0xa'));logger[_0xd80b('0xb')](_0xd80b('0xc'),_0xd5919,_0xd80b('0xa'),JSON[_0xd80b('0xd')](_0x2c354d));if(_0x2c354d['error']){if(_0x2c354d['error']['code']===0x1f4){logger[_0xd80b('0xe')](_0xd80b('0x9'),_0xd5919,_0x2c354d[_0xd80b('0xe')][_0xd80b('0xf')]);return _0x2d0047(_0x2c354d[_0xd80b('0xe')][_0xd80b('0xf')]);}logger['error'](_0xd80b('0x9'),_0xd5919,_0x2c354d[_0xd80b('0xe')][_0xd80b('0xf')]);return _0x28b0bd(_0x2c354d[_0xd80b('0xe')][_0xd80b('0xf')]);}else{logger[_0xd80b('0x10')](_0xd80b('0x9'),_0xd5919,'request\x20sent');_0x28b0bd(_0x2c354d[_0xd80b('0x11')]['message']);}})[_0xd80b('0x12')](function(_0x53f2a0){logger[_0xd80b('0xe')](_0xd80b('0x9'),_0xd5919,_0x53f2a0);_0x2d0047(_0x53f2a0);});});}function respondWithResult(_0x32be06,_0x2e5057){_0x2e5057=_0x2e5057||0xc8;return function(_0x253697){if(_0x253697){return _0x32be06['status'](_0x2e5057)[_0xd80b('0x13')](_0x253697);}};}function respondWithFilteredResult(_0x2823ef,_0x22d9c3){return function(_0x161895){if(_0x161895){var _0x4bbf16=typeof _0x22d9c3['offset']===_0xd80b('0x14')&&typeof _0x22d9c3['limit']===_0xd80b('0x14');var _0x9d07be=_0x161895[_0xd80b('0x15')];var _0x4b39c5=_0x4bbf16?0x0:_0x22d9c3['offset'];var _0x5b8f17=_0x4bbf16?_0x161895[_0xd80b('0x15')]:_0x22d9c3[_0xd80b('0x16')]+_0x22d9c3['limit'];var _0x1171ef;if(_0x5b8f17>=_0x9d07be){_0x5b8f17=_0x9d07be;_0x1171ef=0xc8;}else{_0x1171ef=0xce;}_0x2823ef[_0xd80b('0x17')](_0x1171ef);return _0x2823ef['set']('Content-Range',_0x4b39c5+'-'+_0x5b8f17+'/'+_0x9d07be)[_0xd80b('0x13')](_0x161895);}return null;};}function saveUpdates(_0x5567f8){return function(_0x566465){if(_0x566465){return _0x566465['update'](_0x5567f8)[_0xd80b('0x8')](function(_0x2c96fb){return _0x2c96fb;});}return null;};}function removeEntity(_0x420f9a){return function(_0x1d21a9){if(_0x1d21a9){return _0x1d21a9[_0xd80b('0x18')]()['then'](function(){_0x420f9a[_0xd80b('0x17')](0xcc)[_0xd80b('0x19')]();});}};}function handleEntityNotFound(_0x25d03e){return function(_0x306b3b){if(!_0x306b3b){_0x25d03e[_0xd80b('0x1a')](0x194);}return _0x306b3b;};}function handleError(_0x3f1fac,_0x457df5){_0x457df5=_0x457df5||0x1f4;return function(_0x1a7e9a){logger[_0xd80b('0xe')](_0x1a7e9a[_0xd80b('0x1b')]);if(_0x1a7e9a[_0xd80b('0x1c')]){delete _0x1a7e9a[_0xd80b('0x1c')];}_0x3f1fac['status'](_0x457df5)[_0xd80b('0x1d')](_0x1a7e9a);};}exports[_0xd80b('0x1e')]=function(_0x5aba37,_0x4ed3c8){var _0x1ef6b6={},_0x57a646={},_0x2b632a={'count':0x0,'rows':[]};var _0x4112d1=_[_0xd80b('0x1f')](db[_0xd80b('0x20')][_0xd80b('0x21')],function(_0x3a5dfb){return{'name':_0x3a5dfb['fieldName'],'type':_0x3a5dfb[_0xd80b('0x22')]['key']};});_0x57a646[_0xd80b('0x23')]=_[_0xd80b('0x1f')](_0x4112d1,_0xd80b('0x1c'));_0x57a646[_0xd80b('0x24')]=_[_0xd80b('0x25')](_0x5aba37[_0xd80b('0x24')]);_0x57a646[_0xd80b('0x26')]=_[_0xd80b('0x27')](_0x57a646['model'],_0x57a646[_0xd80b('0x24')]);_0x1ef6b6['attributes']=_[_0xd80b('0x27')](_0x57a646[_0xd80b('0x23')],qs[_0xd80b('0x28')](_0x5aba37['query'][_0xd80b('0x28')]));_0x1ef6b6[_0xd80b('0x29')]=_0x1ef6b6['attributes']['length']?_0x1ef6b6[_0xd80b('0x29')]:_0x57a646[_0xd80b('0x23')];if(!_0x5aba37[_0xd80b('0x24')][_0xd80b('0x2a')](_0xd80b('0x2b'))){_0x1ef6b6[_0xd80b('0x2c')]=qs[_0xd80b('0x2c')](_0x5aba37[_0xd80b('0x24')][_0xd80b('0x2c')]);_0x1ef6b6[_0xd80b('0x16')]=qs[_0xd80b('0x16')](_0x5aba37[_0xd80b('0x24')][_0xd80b('0x16')]);}_0x1ef6b6[_0xd80b('0x2d')]=qs[_0xd80b('0x2e')](_0x5aba37['query'][_0xd80b('0x2e')]);_0x1ef6b6[_0xd80b('0x2f')]=qs[_0xd80b('0x26')](_[_0xd80b('0x30')](_0x5aba37[_0xd80b('0x24')],_0x57a646[_0xd80b('0x26')]),_0x4112d1);if(_0x5aba37[_0xd80b('0x24')][_0xd80b('0x31')]){_0x1ef6b6['where']=_[_0xd80b('0x32')](_0x1ef6b6[_0xd80b('0x2f')],{'$or':_[_0xd80b('0x1f')](_0x4112d1,function(_0x2a0c7e){if(_0x2a0c7e[_0xd80b('0x22')]!=='VIRTUAL'){var _0x2bbc3f={};_0x2bbc3f[_0x2a0c7e[_0xd80b('0x1c')]]={'$like':'%'+_0x5aba37[_0xd80b('0x24')]['filter']+'%'};return _0x2bbc3f;}})});}_0x1ef6b6=_[_0xd80b('0x32')]({},_0x1ef6b6,_0x5aba37[_0xd80b('0x33')]);var _0x1fa012={'where':_0x1ef6b6[_0xd80b('0x2f')]};return db[_0xd80b('0x20')][_0xd80b('0x15')](_0x1fa012)[_0xd80b('0x8')](function(_0x281bda){_0x2b632a[_0xd80b('0x15')]=_0x281bda;if(_0x5aba37['query'][_0xd80b('0x34')]){_0x1ef6b6[_0xd80b('0x35')]=[{'all':!![]}];}return db[_0xd80b('0x20')]['findAll'](_0x1ef6b6);})[_0xd80b('0x8')](function(_0x494719){_0x2b632a['rows']=_0x494719;return _0x2b632a;})[_0xd80b('0x8')](respondWithFilteredResult(_0x4ed3c8,_0x1ef6b6))['catch'](handleError(_0x4ed3c8,null));};exports[_0xd80b('0x36')]=function(_0x51eb16,_0x242811){var _0x42260c={'raw':!![],'where':{'id':_0x51eb16[_0xd80b('0x37')]['id']}},_0x4b0eea={};_0x4b0eea[_0xd80b('0x23')]=_[_0xd80b('0x25')](db[_0xd80b('0x20')][_0xd80b('0x21')]);_0x4b0eea[_0xd80b('0x24')]=_[_0xd80b('0x25')](_0x51eb16[_0xd80b('0x24')]);_0x4b0eea[_0xd80b('0x26')]=_[_0xd80b('0x27')](_0x4b0eea[_0xd80b('0x23')],_0x4b0eea[_0xd80b('0x24')]);_0x42260c[_0xd80b('0x29')]=_['intersection'](_0x4b0eea[_0xd80b('0x23')],qs[_0xd80b('0x28')](_0x51eb16[_0xd80b('0x24')]['fields']));_0x42260c[_0xd80b('0x29')]=_0x42260c[_0xd80b('0x29')][_0xd80b('0x38')]?_0x42260c['attributes']:_0x4b0eea[_0xd80b('0x23')];if(_0x51eb16[_0xd80b('0x24')][_0xd80b('0x34')]){_0x42260c[_0xd80b('0x35')]=[{'all':!![]}];}_0x42260c=_[_0xd80b('0x32')]({},_0x42260c,_0x51eb16[_0xd80b('0x33')]);return db['Network'][_0xd80b('0x39')](_0x42260c)[_0xd80b('0x8')](handleEntityNotFound(_0x242811,null))[_0xd80b('0x8')](respondWithResult(_0x242811,null))[_0xd80b('0x12')](handleError(_0x242811,null));};exports[_0xd80b('0x3a')]=function(_0x4b0ea8,_0x38d82f){var _0xe6049e;return db[_0xd80b('0x20')][_0xd80b('0x3a')](_0x4b0ea8[_0xd80b('0x3b')],{'raw':!![]})[_0xd80b('0x8')](function(_0x503117){_0xe6049e=_0x503117;return db[_0xd80b('0x20')]['findAll']({'where':{'type':_0x4b0ea8[_0xd80b('0x3b')][_0xd80b('0x22')]},'raw':!![]});})['then'](function(_0x101568){if(_0xe6049e[_0xd80b('0x22')][_0xd80b('0x3c')]()==_0xd80b('0x3d')){var _0x168ddf=fs['readFileSync'](path[_0xd80b('0x3e')](config[_0xd80b('0x3f')],_0xd80b('0x40')),_0xd80b('0x41'));var _0x443f92=ejs[_0xd80b('0x42')](_0x168ddf,{'networks':_0x101568||[]});fs[_0xd80b('0x43')](_0xd80b('0x44'),_0x443f92);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x3a'),{'module':_0xd80b('0x46')});}else if(_0xe6049e[_0xd80b('0x22')][_0xd80b('0x3c')]()==_0xd80b('0x47')){var _0x35593b=fs[_0xd80b('0x48')](path[_0xd80b('0x3e')](config[_0xd80b('0x3f')],_0xd80b('0x49')),_0xd80b('0x41'));var _0xb5e89b=ejs[_0xd80b('0x42')](_0x35593b,{'networks':_0x101568||[]});fs[_0xd80b('0x43')](_0xd80b('0x4a'),_0xb5e89b);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x3a'),{'module':'res_stun_monitor.so'});}else{var _0x18b94c=fs[_0xd80b('0x48')](path[_0xd80b('0x3e')](config[_0xd80b('0x3f')],'server/files/templates/network.ejs'),'utf8');var _0x5b2038=ejs[_0xd80b('0x42')](_0x18b94c,{'networks':_0x101568||[]});fs[_0xd80b('0x43')](util[_0xd80b('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x4b0ea8[_0xd80b('0x3b')]['type'][_0xd80b('0x4c')]()),_0x5b2038);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x3a'),{'module':_0xd80b('0x4d')});}})[_0xd80b('0x8')](function(){return _0xe6049e;})[_0xd80b('0x8')](respondWithResult(_0x38d82f,0xc9))[_0xd80b('0x12')](handleError(_0x38d82f,null));};exports[_0xd80b('0x4e')]=function(_0xbae415,_0x1817b3){var _0x4cc098;return db[_0xd80b('0x20')][_0xd80b('0x39')]({'where':{'id':_0xbae415[_0xd80b('0x37')]['id']}})[_0xd80b('0x8')](handleEntityNotFound(_0x1817b3,null))['then'](saveUpdates(_0xbae415[_0xd80b('0x3b')],null))['then'](function(_0x548ed9){if(_0x548ed9){_0x4cc098=_0x548ed9;return db[_0xd80b('0x20')][_0xd80b('0x4f')]({'where':{'type':_0x4cc098[_0xd80b('0x22')]},'raw':!![]});}return null;})[_0xd80b('0x8')](function(_0x55a118){if(_0x4cc098[_0xd80b('0x22')]['toUpperCase']()==_0xd80b('0x3d')){var _0x53ba60=fs[_0xd80b('0x48')](path[_0xd80b('0x3e')](config[_0xd80b('0x3f')],_0xd80b('0x40')),_0xd80b('0x41'));var _0x5d9882=ejs[_0xd80b('0x42')](_0x53ba60,{'networks':_0x55a118||[]});fs['writeFileSync'](_0xd80b('0x44'),_0x5d9882);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x4e'),{'module':_0xd80b('0x46')});}else if(_0x4cc098[_0xd80b('0x22')]['toUpperCase']()==_0xd80b('0x47')){var _0x49e48b=fs[_0xd80b('0x48')](path[_0xd80b('0x3e')](config[_0xd80b('0x3f')],_0xd80b('0x49')),_0xd80b('0x41'));var _0x1d998e=ejs[_0xd80b('0x42')](_0x49e48b,{'networks':_0x55a118||[]});fs[_0xd80b('0x43')](_0xd80b('0x4a'),_0x1d998e);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x4e'),{'module':_0xd80b('0x46')});}else{var _0x4f74ee=fs['readFileSync'](path['join'](config[_0xd80b('0x3f')],_0xd80b('0x50')),_0xd80b('0x41'));var _0x4187ea=ejs[_0xd80b('0x42')](_0x4f74ee,{'networks':_0x55a118||[]});fs['writeFileSync'](util['format'](_0xd80b('0x51'),_0xbae415[_0xd80b('0x3b')][_0xd80b('0x22')][_0xd80b('0x4c')]()),_0x4187ea);return respondWithRpcPromise(_0xd80b('0x45'),'update',{'module':_0xd80b('0x4d')});}})[_0xd80b('0x8')](function(_0x463872){if(_0x463872){return _0x4cc098;}return null;})[_0xd80b('0x8')](respondWithResult(_0x1817b3,null))[_0xd80b('0x12')](handleError(_0x1817b3,null));};exports[_0xd80b('0x18')]=function(_0x239dfc,_0x5d9441){var _0x1ae717;return db[_0xd80b('0x20')][_0xd80b('0x39')]({'where':{'id':_0x239dfc['params']['id']}})[_0xd80b('0x8')](function(_0x357856){_0x1ae717=_0x357856;return _0x357856;})[_0xd80b('0x8')](handleEntityNotFound(_0x5d9441,null))[_0xd80b('0x8')](removeEntity(_0x5d9441,null))['then'](function(){if(_0x1ae717){return db['Network'][_0xd80b('0x4f')]({'where':{'type':_0x1ae717[_0xd80b('0x22')]},'raw':!![]});}})[_0xd80b('0x8')](function(_0x62cb9e){if(_0x1ae717[_0xd80b('0x22')][_0xd80b('0x3c')]()=='STUN'){var _0x35fc47=fs['readFileSync'](path[_0xd80b('0x3e')](config[_0xd80b('0x3f')],_0xd80b('0x40')),_0xd80b('0x41'));var _0x56f073=ejs[_0xd80b('0x42')](_0x35fc47,{'networks':_0x62cb9e||[]});fs['writeFileSync'](_0xd80b('0x44'),_0x56f073);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x18'),{'module':'res_stun_monitor.so'});}else if(_0x1ae717[_0xd80b('0x22')]['toUpperCase']()==_0xd80b('0x47')){var _0x45e239=fs['readFileSync'](path[_0xd80b('0x3e')](config[_0xd80b('0x3f')],'server/files/templates/turn_multiple.ejs'),_0xd80b('0x41'));var _0x5a89cd=ejs['render'](_0x45e239,{'networks':_0x62cb9e||[]});fs[_0xd80b('0x43')]('/etc/asterisk/turn_xcally.conf',_0x5a89cd);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x18'),{'module':_0xd80b('0x46')});}else{var _0x107dd4=fs[_0xd80b('0x48')](path[_0xd80b('0x3e')](config['root'],_0xd80b('0x50')),_0xd80b('0x41'));var _0x313b21=ejs[_0xd80b('0x42')](_0x107dd4,{'networks':_0x62cb9e||[]});fs['writeFileSync'](util[_0xd80b('0x4b')](_0xd80b('0x51'),_0x1ae717[_0xd80b('0x22')]['toLowerCase']()),_0x313b21);return respondWithRpcPromise(_0xd80b('0x45'),_0xd80b('0x18'),{'module':_0xd80b('0x4d')});}})[_0xd80b('0x12')](handleError(_0x5d9441,null));}; \ No newline at end of file +var _0x09a8=['debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','request\x20sent','result','catch','status','json','limit','undefined','count','offset','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','root','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','TURN','server/files/templates/turn_multiple.ejs','destroy','path','lodash','../../config/logger','../../config/environment','../../mysqldb','client','http','request','info'];(function(_0x22b6a0,_0x29940a){var _0x56a622=function(_0x43ee92){while(--_0x43ee92){_0x22b6a0['push'](_0x22b6a0['shift']());}};_0x56a622(++_0x29940a);}(_0x09a8,0xa3));var _0x809a=function(_0xfadd11,_0x24c520){_0xfadd11=_0xfadd11-0x0;var _0x1db5b6=_0x09a8[_0xfadd11];return _0x1db5b6;};'use strict';var util=require('util');var path=require(_0x809a('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x809a('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x809a('0x2'))('api');var config=require(_0x809a('0x3'));var db=require(_0x809a('0x4'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x809a('0x5')][_0x809a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c602a,_0x1f4412,_0x22f496,_0xc81c22){return new Promise(function(_0xb17549,_0x19ece2){var _0x530026=_0xc81c22||client;return _0x530026[_0x809a('0x7')](_0x4c602a,_0x22f496)['then'](function(_0x52a908){logger[_0x809a('0x8')]('Network,\x20%s,\x20%s',_0x1f4412,'request\x20sent');logger[_0x809a('0x9')](_0x809a('0xa'),_0x1f4412,'request\x20sent',JSON[_0x809a('0xb')](_0x52a908));if(_0x52a908[_0x809a('0xc')]){if(_0x52a908[_0x809a('0xc')][_0x809a('0xd')]===0x1f4){logger['error'](_0x809a('0xe'),_0x1f4412,_0x52a908[_0x809a('0xc')][_0x809a('0xf')]);return _0x19ece2(_0x52a908[_0x809a('0xc')][_0x809a('0xf')]);}logger[_0x809a('0xc')](_0x809a('0xe'),_0x1f4412,_0x52a908[_0x809a('0xc')][_0x809a('0xf')]);return _0xb17549(_0x52a908['error'][_0x809a('0xf')]);}else{logger[_0x809a('0x8')](_0x809a('0xe'),_0x1f4412,_0x809a('0x10'));_0xb17549(_0x52a908[_0x809a('0x11')][_0x809a('0xf')]);}})[_0x809a('0x12')](function(_0x24c70a){logger[_0x809a('0xc')](_0x809a('0xe'),_0x1f4412,_0x24c70a);_0x19ece2(_0x24c70a);});});}function respondWithResult(_0x46da63,_0x5c4245){_0x5c4245=_0x5c4245||0xc8;return function(_0x28586a){if(_0x28586a){return _0x46da63[_0x809a('0x13')](_0x5c4245)[_0x809a('0x14')](_0x28586a);}};}function respondWithFilteredResult(_0x22347b,_0x56b411){return function(_0x35f46d){if(_0x35f46d){var _0x402417=typeof _0x56b411['offset']==='undefined'&&typeof _0x56b411[_0x809a('0x15')]===_0x809a('0x16');var _0xd9f109=_0x35f46d[_0x809a('0x17')];var _0x1f32ba=_0x402417?0x0:_0x56b411['offset'];var _0x5afaae=_0x402417?_0x35f46d['count']:_0x56b411[_0x809a('0x18')]+_0x56b411[_0x809a('0x15')];var _0x1194ad;if(_0x5afaae>=_0xd9f109){_0x5afaae=_0xd9f109;_0x1194ad=0xc8;}else{_0x1194ad=0xce;}_0x22347b[_0x809a('0x13')](_0x1194ad);return _0x22347b[_0x809a('0x19')](_0x809a('0x1a'),_0x1f32ba+'-'+_0x5afaae+'/'+_0xd9f109)[_0x809a('0x14')](_0x35f46d);}return null;};}function saveUpdates(_0x1b353d){return function(_0x3c6f88){if(_0x3c6f88){return _0x3c6f88[_0x809a('0x1b')](_0x1b353d)['then'](function(_0x561a1f){return _0x561a1f;});}return null;};}function removeEntity(_0x59c747){return function(_0x1474b9){if(_0x1474b9){return _0x1474b9['destroy']()[_0x809a('0x1c')](function(){_0x59c747['status'](0xcc)[_0x809a('0x1d')]();});}};}function handleEntityNotFound(_0xd18d18){return function(_0x50346){if(!_0x50346){_0xd18d18[_0x809a('0x1e')](0x194);}return _0x50346;};}function handleError(_0x2f7d05,_0x3f202a){_0x3f202a=_0x3f202a||0x1f4;return function(_0x59d1b1){logger[_0x809a('0xc')](_0x59d1b1[_0x809a('0x1f')]);if(_0x59d1b1[_0x809a('0x20')]){delete _0x59d1b1[_0x809a('0x20')];}_0x2f7d05[_0x809a('0x13')](_0x3f202a)[_0x809a('0x21')](_0x59d1b1);};}exports[_0x809a('0x22')]=function(_0x30f0ed,_0x26bca5){var _0x8fb4e={},_0x3a9301={},_0x377f64={'count':0x0,'rows':[]};var _0xd280a1=_['map'](db[_0x809a('0x23')][_0x809a('0x24')],function(_0x4da0d5){return{'name':_0x4da0d5[_0x809a('0x25')],'type':_0x4da0d5[_0x809a('0x26')][_0x809a('0x27')]};});_0x3a9301[_0x809a('0x28')]=_[_0x809a('0x29')](_0xd280a1,_0x809a('0x20'));_0x3a9301['query']=_[_0x809a('0x2a')](_0x30f0ed[_0x809a('0x2b')]);_0x3a9301[_0x809a('0x2c')]=_[_0x809a('0x2d')](_0x3a9301[_0x809a('0x28')],_0x3a9301[_0x809a('0x2b')]);_0x8fb4e[_0x809a('0x2e')]=_[_0x809a('0x2d')](_0x3a9301[_0x809a('0x28')],qs[_0x809a('0x2f')](_0x30f0ed[_0x809a('0x2b')][_0x809a('0x2f')]));_0x8fb4e['attributes']=_0x8fb4e[_0x809a('0x2e')]['length']?_0x8fb4e['attributes']:_0x3a9301[_0x809a('0x28')];if(!_0x30f0ed[_0x809a('0x2b')][_0x809a('0x30')](_0x809a('0x31'))){_0x8fb4e[_0x809a('0x15')]=qs['limit'](_0x30f0ed[_0x809a('0x2b')]['limit']);_0x8fb4e[_0x809a('0x18')]=qs[_0x809a('0x18')](_0x30f0ed['query']['offset']);}_0x8fb4e['order']=qs[_0x809a('0x32')](_0x30f0ed[_0x809a('0x2b')][_0x809a('0x32')]);_0x8fb4e[_0x809a('0x33')]=qs['filters'](_[_0x809a('0x34')](_0x30f0ed['query'],_0x3a9301[_0x809a('0x2c')]),_0xd280a1);if(_0x30f0ed['query'][_0x809a('0x35')]){_0x8fb4e[_0x809a('0x33')]=_[_0x809a('0x36')](_0x8fb4e['where'],{'$or':_['map'](_0xd280a1,function(_0x14832b){if(_0x14832b[_0x809a('0x26')]!==_0x809a('0x37')){var _0x1e47fc={};_0x1e47fc[_0x14832b['name']]={'$like':'%'+_0x30f0ed['query']['filter']+'%'};return _0x1e47fc;}})});}_0x8fb4e=_[_0x809a('0x36')]({},_0x8fb4e,_0x30f0ed[_0x809a('0x38')]);var _0x54cc36={'where':_0x8fb4e[_0x809a('0x33')]};return db['Network']['count'](_0x54cc36)['then'](function(_0x2eb283){_0x377f64['count']=_0x2eb283;if(_0x30f0ed[_0x809a('0x2b')][_0x809a('0x39')]){_0x8fb4e[_0x809a('0x3a')]=[{'all':!![]}];}return db[_0x809a('0x23')]['findAll'](_0x8fb4e);})['then'](function(_0x117f3b){_0x377f64['rows']=_0x117f3b;return _0x377f64;})[_0x809a('0x1c')](respondWithFilteredResult(_0x26bca5,_0x8fb4e))['catch'](handleError(_0x26bca5,null));};exports[_0x809a('0x3b')]=function(_0x52d800,_0xe7275d){var _0x2735c2={'raw':!![],'where':{'id':_0x52d800[_0x809a('0x3c')]['id']}},_0x5d8681={};_0x5d8681[_0x809a('0x28')]=_[_0x809a('0x2a')](db[_0x809a('0x23')][_0x809a('0x24')]);_0x5d8681[_0x809a('0x2b')]=_[_0x809a('0x2a')](_0x52d800[_0x809a('0x2b')]);_0x5d8681[_0x809a('0x2c')]=_['intersection'](_0x5d8681['model'],_0x5d8681[_0x809a('0x2b')]);_0x2735c2['attributes']=_['intersection'](_0x5d8681[_0x809a('0x28')],qs['fields'](_0x52d800[_0x809a('0x2b')][_0x809a('0x2f')]));_0x2735c2[_0x809a('0x2e')]=_0x2735c2['attributes'][_0x809a('0x3d')]?_0x2735c2['attributes']:_0x5d8681[_0x809a('0x28')];if(_0x52d800[_0x809a('0x2b')]['includeAll']){_0x2735c2[_0x809a('0x3a')]=[{'all':!![]}];}_0x2735c2=_[_0x809a('0x36')]({},_0x2735c2,_0x52d800['options']);return db['Network']['find'](_0x2735c2)[_0x809a('0x1c')](handleEntityNotFound(_0xe7275d,null))[_0x809a('0x1c')](respondWithResult(_0xe7275d,null))[_0x809a('0x12')](handleError(_0xe7275d,null));};exports[_0x809a('0x3e')]=function(_0x7b44a4,_0x57179e){var _0xc482d6;return db['Network'][_0x809a('0x3e')](_0x7b44a4[_0x809a('0x3f')],{'raw':!![]})['then'](function(_0x3339d4){_0xc482d6=_0x3339d4;return db[_0x809a('0x23')]['findAll']({'where':{'type':_0x7b44a4['body'][_0x809a('0x26')]},'raw':!![]});})[_0x809a('0x1c')](function(_0x37ba06){if(_0xc482d6[_0x809a('0x26')][_0x809a('0x40')]()==_0x809a('0x41')){var _0x17565b=fs[_0x809a('0x42')](path[_0x809a('0x43')](config['root'],_0x809a('0x44')),_0x809a('0x45'));var _0x7f99ca=ejs[_0x809a('0x46')](_0x17565b,{'networks':_0x37ba06||[]});fs[_0x809a('0x47')](_0x809a('0x48'),_0x7f99ca);return respondWithRpcPromise(_0x809a('0x49'),_0x809a('0x3e'),{'module':_0x809a('0x4a')});}else if(_0xc482d6[_0x809a('0x26')][_0x809a('0x40')]()=='TURN'){var _0x555fbc=fs[_0x809a('0x42')](path[_0x809a('0x43')](config[_0x809a('0x4b')],'server/files/templates/turn_multiple.ejs'),_0x809a('0x45'));var _0x175da5=ejs[_0x809a('0x46')](_0x555fbc,{'networks':_0x37ba06||[]});fs[_0x809a('0x47')](_0x809a('0x4c'),_0x175da5);return respondWithRpcPromise(_0x809a('0x49'),'create',{'module':_0x809a('0x4a')});}else{var _0x1c8d2d=fs[_0x809a('0x42')](path['join'](config['root'],_0x809a('0x4d')),_0x809a('0x45'));var _0x4675e0=ejs['render'](_0x1c8d2d,{'networks':_0x37ba06||[]});fs['writeFileSync'](util[_0x809a('0x4e')](_0x809a('0x4f'),_0x7b44a4[_0x809a('0x3f')][_0x809a('0x26')][_0x809a('0x50')]()),_0x4675e0);return respondWithRpcPromise(_0x809a('0x49'),_0x809a('0x3e'),{'module':_0x809a('0x51')});}})[_0x809a('0x1c')](function(){return _0xc482d6;})['then'](respondWithResult(_0x57179e,0xc9))[_0x809a('0x12')](handleError(_0x57179e,null));};exports[_0x809a('0x1b')]=function(_0x464e5c,_0x2e8f09){var _0x4d0185;return db[_0x809a('0x23')][_0x809a('0x52')]({'where':{'id':_0x464e5c[_0x809a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2e8f09,null))[_0x809a('0x1c')](saveUpdates(_0x464e5c[_0x809a('0x3f')],null))[_0x809a('0x1c')](function(_0x556149){if(_0x556149){_0x4d0185=_0x556149;return db[_0x809a('0x23')]['findAll']({'where':{'type':_0x4d0185[_0x809a('0x26')]},'raw':!![]});}return null;})['then'](function(_0x5b6ecb){if(_0x4d0185[_0x809a('0x26')]['toUpperCase']()==_0x809a('0x41')){var _0x30b912=fs['readFileSync'](path[_0x809a('0x43')](config['root'],_0x809a('0x44')),_0x809a('0x45'));var _0x4f261d=ejs[_0x809a('0x46')](_0x30b912,{'networks':_0x5b6ecb||[]});fs[_0x809a('0x47')](_0x809a('0x48'),_0x4f261d);return respondWithRpcPromise(_0x809a('0x49'),_0x809a('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x4d0185[_0x809a('0x26')][_0x809a('0x40')]()==_0x809a('0x53')){var _0xf28804=fs[_0x809a('0x42')](path[_0x809a('0x43')](config[_0x809a('0x4b')],_0x809a('0x54')),_0x809a('0x45'));var _0x53b652=ejs[_0x809a('0x46')](_0xf28804,{'networks':_0x5b6ecb||[]});fs[_0x809a('0x47')]('/etc/asterisk/turn_xcally.conf',_0x53b652);return respondWithRpcPromise(_0x809a('0x49'),_0x809a('0x1b'),{'module':_0x809a('0x4a')});}else{var _0x283844=fs[_0x809a('0x42')](path[_0x809a('0x43')](config[_0x809a('0x4b')],_0x809a('0x4d')),_0x809a('0x45'));var _0x56944a=ejs[_0x809a('0x46')](_0x283844,{'networks':_0x5b6ecb||[]});fs[_0x809a('0x47')](util[_0x809a('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x464e5c['body'][_0x809a('0x26')][_0x809a('0x50')]()),_0x56944a);return respondWithRpcPromise(_0x809a('0x49'),'update',{'module':_0x809a('0x51')});}})[_0x809a('0x1c')](function(_0x321206){if(_0x321206){return _0x4d0185;}return null;})[_0x809a('0x1c')](respondWithResult(_0x2e8f09,null))[_0x809a('0x12')](handleError(_0x2e8f09,null));};exports[_0x809a('0x55')]=function(_0x5a85c1,_0x3d1d0b){var _0x338623;return db[_0x809a('0x23')][_0x809a('0x52')]({'where':{'id':_0x5a85c1[_0x809a('0x3c')]['id']}})[_0x809a('0x1c')](function(_0x5d8553){_0x338623=_0x5d8553;return _0x5d8553;})['then'](handleEntityNotFound(_0x3d1d0b,null))[_0x809a('0x1c')](removeEntity(_0x3d1d0b,null))['then'](function(){if(_0x338623){return db[_0x809a('0x23')]['findAll']({'where':{'type':_0x338623[_0x809a('0x26')]},'raw':!![]});}})[_0x809a('0x1c')](function(_0x2a5e17){if(_0x338623['type'][_0x809a('0x40')]()==_0x809a('0x41')){var _0x2d262f=fs[_0x809a('0x42')](path['join'](config['root'],_0x809a('0x44')),_0x809a('0x45'));var _0x216f6d=ejs[_0x809a('0x46')](_0x2d262f,{'networks':_0x2a5e17||[]});fs['writeFileSync'](_0x809a('0x48'),_0x216f6d);return respondWithRpcPromise('Reload',_0x809a('0x55'),{'module':_0x809a('0x4a')});}else if(_0x338623['type'][_0x809a('0x40')]()=='TURN'){var _0x196eac=fs[_0x809a('0x42')](path[_0x809a('0x43')](config[_0x809a('0x4b')],_0x809a('0x54')),_0x809a('0x45'));var _0x420531=ejs[_0x809a('0x46')](_0x196eac,{'networks':_0x2a5e17||[]});fs['writeFileSync'](_0x809a('0x4c'),_0x420531);return respondWithRpcPromise('Reload',_0x809a('0x55'),{'module':_0x809a('0x4a')});}else{var _0x5c3d7e=fs[_0x809a('0x42')](path[_0x809a('0x43')](config[_0x809a('0x4b')],_0x809a('0x4d')),_0x809a('0x45'));var _0x47ac2e=ejs[_0x809a('0x46')](_0x5c3d7e,{'networks':_0x2a5e17||[]});fs[_0x809a('0x47')](util[_0x809a('0x4e')](_0x809a('0x4f'),_0x338623['type'][_0x809a('0x50')]()),_0x47ac2e);return respondWithRpcPromise(_0x809a('0x49'),_0x809a('0x55'),{'module':_0x809a('0x51')});}})['catch'](handleError(_0x3d1d0b,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 38f0d80..9fd7fca 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 _0xf109=['Network','network','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x462e0d,_0x357634){var _0x1d0b0d=function(_0x25e53d){while(--_0x25e53d){_0x462e0d['push'](_0x462e0d['shift']());}};_0x1d0b0d(++_0x357634);}(_0xf109,0xce));var _0x9f10=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf109[_0x35885a];return _0xe86249;};'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 +var _0x5eb1=['./network.attributes','exports','define','network','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x15aa1f,_0x5b4966){var _0xf2e433=function(_0x2e799c){while(--_0x2e799c){_0x15aa1f['push'](_0x15aa1f['shift']());}};_0xf2e433(++_0x5b4966);}(_0x5eb1,0x7c));var _0x15eb=function(_0x4f3e33,_0x5704a8){_0x4f3e33=_0x4f3e33-0x0;var _0x1a070c=_0x5eb1[_0x4f3e33];return _0x1a070c;};'use strict';var _=require('lodash');var util=require(_0x15eb('0x0'));var logger=require(_0x15eb('0x1'))(_0x15eb('0x2'));var moment=require(_0x15eb('0x3'));var BPromise=require(_0x15eb('0x4'));var rp=require(_0x15eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15eb('0x6'));var config=require(_0x15eb('0x7'));var attributes=require(_0x15eb('0x8'));module[_0x15eb('0x9')]=function(_0x47e341,_0x1be042){return _0x47e341[_0x15eb('0xa')]('Network',attributes,{'tableName':_0x15eb('0xb'),'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 90ded19..37c7e91 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0xcadac1,_0x551418){_0xcadac1=_0xcadac1-0x0;var _0x4f5204=_0x7a54[_0xcadac1];return _0x4f5204;};'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 _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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x36e19b,_0x510d76){_0x36e19b=_0x36e19b-0x0;var _0x1f159d=_0x7a54[_0x36e19b];return _0x1f159d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 9ca175f..34bbe55 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 _0x3de3=['send','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3de3,0x1ce));var _0x33de=function(_0x58f7c8,_0x5e2681){_0x58f7c8=_0x58f7c8-0x0;var _0x3fdee6=_0x3de3[_0x58f7c8];return _0x3fdee6;};'use strict';var multer=require(_0x33de('0x0'));var util=require('util');var path=require(_0x33de('0x1'));var timeout=require(_0x33de('0x2'));var express=require('express');var router=express[_0x33de('0x3')]();var fs_extra=require(_0x33de('0x4'));var auth=require(_0x33de('0x5'));var interaction=require(_0x33de('0x6'));var config=require('../../config/environment');var controller=require(_0x33de('0x7'));router[_0x33de('0x8')]('/',auth['isAuthenticated'](),controller[_0x33de('0x9')]);router['get'](_0x33de('0xa'),auth[_0x33de('0xb')](),controller[_0x33de('0xc')]);router['get'](_0x33de('0xd'),auth[_0x33de('0xb')](),controller[_0x33de('0xe')]);router['get'](_0x33de('0xf'),auth[_0x33de('0xb')](),controller[_0x33de('0x10')]);router[_0x33de('0x8')](_0x33de('0x11'),auth[_0x33de('0xb')](),controller[_0x33de('0x12')]);router[_0x33de('0x8')](_0x33de('0x13'),auth[_0x33de('0xb')](),controller[_0x33de('0x14')]);router['get'](_0x33de('0x15'),auth[_0x33de('0xb')](),controller['getInteractions']);router['get'](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x17')]);router[_0x33de('0x18')]('/',auth['isAuthenticated'](),controller[_0x33de('0x19')]);router[_0x33de('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x33de('0x1a')]);router[_0x33de('0x18')](_0x33de('0x11'),auth['isAuthenticated'](),controller[_0x33de('0x1b')]);router[_0x33de('0x18')]('/:id/notify',controller[_0x33de('0x1c')]);router[_0x33de('0x18')]('/:id/applications',auth['isAuthenticated'](),controller[_0x33de('0x1d')]);router['post'](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x1e')]);router[_0x33de('0x18')](_0x33de('0x1f'),auth[_0x33de('0xb')](),controller[_0x33de('0x20')]);router['put']('/:id',auth[_0x33de('0xb')](),controller['update']);router[_0x33de('0x21')]('/:id',auth[_0x33de('0xb')](),controller[_0x33de('0x22')]);router['delete'](_0x33de('0xf'),auth['isAuthenticated'](),controller[_0x33de('0x23')]);router['delete'](_0x33de('0x11'),auth[_0x33de('0xb')](),controller[_0x33de('0x24')]);router['delete'](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x25')]);module['exports']=router; \ No newline at end of file +var _0x5430=['/:id/interactions','getInteractions','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x264f48,_0x2c82d8){var _0xb99167=function(_0x4a6be7){while(--_0x4a6be7){_0x264f48['push'](_0x264f48['shift']());}};_0xb99167(++_0x2c82d8);}(_0x5430,0x10c));var _0x0543=function(_0x1676b7,_0x2f4aac){_0x1676b7=_0x1676b7-0x0;var _0x41e312=_0x5430[_0x1676b7];return _0x41e312;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0x7')]('/:id/dispositions',auth[_0x0543('0x8')](),controller[_0x0543('0xe')]);router['get'](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x10')]);router[_0x0543('0x7')](_0x0543('0x11'),auth[_0x0543('0x8')](),controller[_0x0543('0x12')]);router[_0x0543('0x7')](_0x0543('0x13'),auth[_0x0543('0x8')](),controller[_0x0543('0x14')]);router[_0x0543('0x7')]('/:id/users',auth[_0x0543('0x8')](),controller[_0x0543('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0543('0x16')]);router[_0x0543('0x17')](_0x0543('0x18'),auth[_0x0543('0x8')](),controller[_0x0543('0x19')]);router['post'](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x1a')]);router[_0x0543('0x17')](_0x0543('0x1b'),controller[_0x0543('0x1c')]);router[_0x0543('0x17')]('/:id/applications',auth[_0x0543('0x8')](),controller['addApplications']);router['post'](_0x0543('0x1d'),auth[_0x0543('0x8')](),controller[_0x0543('0x1e')]);router['post'](_0x0543('0x1f'),auth['isAuthenticated'](),controller[_0x0543('0x20')]);router[_0x0543('0x21')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0x22')]);router[_0x0543('0x23')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x24')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0543('0x25')]);router[_0x0543('0x23')](_0x0543('0xf'),auth[_0x0543('0x8')](),controller[_0x0543('0x26')]);router[_0x0543('0x23')](_0x0543('0x1d'),auth[_0x0543('0x8')](),controller[_0x0543('0x27')]);module[_0x0543('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b646731..cb5e75c 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 _0xa450=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa450,0x171));var _0x0a45=function(_0x2eac41,_0x1e0e8a){_0x2eac41=_0x2eac41-0x0;var _0x11df48=_0xa450[_0x2eac41];return _0x11df48;};'use strict';var Sequelize=require(_0x0a45('0x0'));var rs=require(_0x0a45('0x1'));module['exports']={'name':{'type':Sequelize[_0x0a45('0x2')],'unique':_0x0a45('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0a45('0x2')]},'token':{'type':Sequelize[_0x0a45('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x0a45('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0a45('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0a45('0x4')],'defaultValue':function(){return _0x0a45('0x5');}},'notificationSound':{'type':Sequelize[_0x0a45('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0a45('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0a45('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0a45('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0a45('0x2')]},'queueTransfer':{'type':Sequelize[_0x0a45('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0a45('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0a45('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a45('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x0a45('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0a45('0x6')],'defaultValue':![],'comment':_0x0a45('0x9'),'set':function(_0x325790){if(!_0x325790)this[_0x0a45('0xa')](_0x0a45('0xb'),null);this['setDataValue'](_0x0a45('0xc'),_0x325790);}}}; \ No newline at end of file +var _0x78f5=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x28c552,_0x3929c4){var _0x583625=function(_0x457b11){while(--_0x457b11){_0x28c552['push'](_0x28c552['shift']());}};_0x583625(++_0x3929c4);}(_0x78f5,0x104));var _0x578f=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x78f5[_0x24b477];return _0x4041a6;};'use strict';var Sequelize=require(_0x578f('0x0'));var rs=require(_0x578f('0x1'));module[_0x578f('0x2')]={'name':{'type':Sequelize[_0x578f('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x578f('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x578f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x578f('0x4');}},'notificationSound':{'type':Sequelize[_0x578f('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x578f('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x578f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x578f('0x3')]},'queueTransfer':{'type':Sequelize[_0x578f('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x578f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x578f('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x578f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x578f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x578f('0x8'),'set':function(_0x2af6b7){if(!_0x2af6b7)this[_0x578f('0x9')](_0x578f('0xa'),null);this[_0x578f('0x9')](_0x578f('0xb'),_0x2af6b7);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 5b447cb..13248ce 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 _0x980e=['asc','account','ListId','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','lastName','messageId','interaction','created','autoclose','close','OpenchannelMessage','User','UserId','queueId','unshift','queue','Start','startRouting','EventManager','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','send','getApplications','getInteractions','Contact','Owner','fullname','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','destroy','get','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority'];(function(_0x11e10d,_0x25b544){var _0xeb7091=function(_0x29c174){while(--_0x29c174){_0x11e10d['push'](_0x11e10d['shift']());}};_0xeb7091(++_0x25b544);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe980('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe980('0x1'));var rp=require('request-promise');var moment=require(_0xe980('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe980('0x3'));var util=require(_0xe980('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xe980('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe980('0x6'));var squel=require(_0xe980('0x7'));var crypto=require(_0xe980('0x8'));var jsforce=require(_0xe980('0x9'));var deskjs=require(_0xe980('0xa'));var toCsv=require(_0xe980('0x5'));var querystring=require('querystring');var Papa=require(_0xe980('0xb'));var Redis=require(_0xe980('0xc'));var authService=require(_0xe980('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe980('0xe'));var hardwareService=require(_0xe980('0xf'));var logger=require(_0xe980('0x10'))(_0xe980('0x11'));var utils=require(_0xe980('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe980('0x13')]=_[_0xe980('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe980('0x15'))(new Redis(config[_0xe980('0x13')]));require(_0xe980('0x16'))[_0xe980('0x17')](socket);var jayson=require(_0xe980('0x18'));var client=jayson[_0xe980('0x19')][_0xe980('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49771e,_0x594116,_0xd9fff2,_0x1e6760){return new BPromise(function(_0x406418,_0x29593c){var _0x551a2c=_0x1e6760||client;return _0x551a2c[_0xe980('0x1b')](_0x49771e,_0xd9fff2)[_0xe980('0x1c')](function(_0x1ddb12){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x594116,_0xe980('0x1d'));logger[_0xe980('0x1e')](_0xe980('0x1f'),_0x594116,_0xe980('0x1d'),JSON[_0xe980('0x20')](_0x1ddb12));if(_0x1ddb12[_0xe980('0x21')]){if(_0x1ddb12[_0xe980('0x21')][_0xe980('0x22')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x594116,_0x1ddb12[_0xe980('0x21')][_0xe980('0x23')]);return _0x29593c(_0x1ddb12[_0xe980('0x21')]['message']);}logger[_0xe980('0x21')](_0xe980('0x24'),_0x594116,_0x1ddb12['error'][_0xe980('0x23')]);return _0x406418(_0x1ddb12[_0xe980('0x21')][_0xe980('0x23')]);}else{logger['info'](_0xe980('0x24'),_0x594116,'request\x20sent');_0x406418(_0x1ddb12[_0xe980('0x25')][_0xe980('0x23')]);}})[_0xe980('0x26')](function(_0x40a34e){logger['error'](_0xe980('0x24'),_0x594116,_0x40a34e);_0x29593c(_0x40a34e);});});}function respondWithStatusCode(_0x392bd1,_0xdc9ad7){_0xdc9ad7=_0xdc9ad7||0xcc;return function(_0x4ac608){if(_0x4ac608){return _0x392bd1['sendStatus'](_0xdc9ad7);}return _0x392bd1[_0xe980('0x27')](_0xdc9ad7)[_0xe980('0x28')]();};}function respondWithResult(_0x5ec906,_0x16f2fe){_0x16f2fe=_0x16f2fe||0xc8;return function(_0x565424){if(_0x565424){return _0x5ec906[_0xe980('0x27')](_0x16f2fe)[_0xe980('0x29')](_0x565424);}};}function respondWithFilteredResult(_0x10f084,_0x3ef831){return function(_0x2a6e8a){if(_0x2a6e8a){var _0x43a7c2=typeof _0x3ef831['offset']===_0xe980('0x2a')&&typeof _0x3ef831['limit']===_0xe980('0x2a');var _0x24a29e=_0x2a6e8a[_0xe980('0x2b')];var _0x38ab6d=_0x43a7c2?0x0:_0x3ef831[_0xe980('0x2c')];var _0x56fbf7=_0x43a7c2?_0x2a6e8a['count']:_0x3ef831[_0xe980('0x2c')]+_0x3ef831[_0xe980('0x2d')];var _0x1b6d07;if(_0x56fbf7>=_0x24a29e){_0x56fbf7=_0x24a29e;_0x1b6d07=0xc8;}else{_0x1b6d07=0xce;}_0x10f084[_0xe980('0x27')](_0x1b6d07);return _0x10f084[_0xe980('0x2e')](_0xe980('0x2f'),_0x38ab6d+'-'+_0x56fbf7+'/'+_0x24a29e)[_0xe980('0x29')](_0x2a6e8a);}return null;};}function patchUpdates(_0x369c3a){return function(_0x15a5d1){try{jsonpatch[_0xe980('0x30')](_0x15a5d1,_0x369c3a,!![]);}catch(_0x371136){return BPromise['reject'](_0x371136);}return _0x15a5d1['save']();};}function saveUpdates(_0x9a6819,_0x4702e0){return function(_0x46c931){if(_0x46c931){return _0x46c931['update'](_0x9a6819)[_0xe980('0x1c')](function(_0x4b9586){return _0x4b9586;});}return null;};}function removeEntity(_0x2b481c,_0x3d5393){return function(_0x163db9){if(_0x163db9){return _0x163db9[_0xe980('0x31')]()[_0xe980('0x1c')](function(){var _0x36ab72=_0x163db9[_0xe980('0x32')]({'plain':!![]});var _0x9e301c='OpenchannelAccounts';return db['UserProfileResource'][_0xe980('0x31')]({'where':{'type':_0x9e301c,'resourceId':_0x36ab72['id']}})[_0xe980('0x1c')](function(){return _0x163db9;});})['then'](function(){_0x2b481c[_0xe980('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf0735c,_0x2a3b92){return function(_0x253198){if(!_0x253198){_0xf0735c[_0xe980('0x33')](0x194);}return _0x253198;};}function handleError(_0x3b0732,_0x33353f){_0x33353f=_0x33353f||0x1f4;return function(_0x502223){logger[_0xe980('0x21')](_0x502223[_0xe980('0x34')]);if(_0x502223[_0xe980('0x35')]){delete _0x502223[_0xe980('0x35')];}_0x3b0732[_0xe980('0x27')](_0x33353f)['send'](_0x502223);};}exports[_0xe980('0x36')]=function(_0x1f35ed,_0x1faffe){var _0x49448b={'include':[{'model':db[_0xe980('0x37')],'as':_0xe980('0x38')}]},_0x16422e={},_0x5c4626={'count':0x0,'rows':[]};var _0x577d17=_['map'](db[_0xe980('0x39')][_0xe980('0x3a')],function(_0x346a78){return{'name':_0x346a78[_0xe980('0x3b')],'type':_0x346a78[_0xe980('0x3c')][_0xe980('0x3d')]};});_0x16422e['model']=_[_0xe980('0x3e')](_0x577d17,_0xe980('0x35'));_0x16422e[_0xe980('0x3f')]=_['keys'](_0x1f35ed[_0xe980('0x3f')]);_0x16422e[_0xe980('0x40')]=_[_0xe980('0x41')](_0x16422e['model'],_0x16422e[_0xe980('0x3f')]);_0x49448b[_0xe980('0x42')]=_['intersection'](_0x16422e[_0xe980('0x43')],qs[_0xe980('0x44')](_0x1f35ed[_0xe980('0x3f')][_0xe980('0x44')]));_0x49448b[_0xe980('0x42')]=_0x49448b[_0xe980('0x42')]['length']?_0x49448b[_0xe980('0x42')]:_0x16422e[_0xe980('0x43')];if(!_0x1f35ed[_0xe980('0x3f')][_0xe980('0x45')]('nolimit')){_0x49448b[_0xe980('0x2d')]=qs[_0xe980('0x2d')](_0x1f35ed[_0xe980('0x3f')][_0xe980('0x2d')]);_0x49448b[_0xe980('0x2c')]=qs[_0xe980('0x2c')](_0x1f35ed['query'][_0xe980('0x2c')]);}_0x49448b[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x1f35ed[_0xe980('0x3f')][_0xe980('0x47')]);_0x49448b[_0xe980('0x48')]=qs[_0xe980('0x40')](_[_0xe980('0x49')](_0x1f35ed[_0xe980('0x3f')],_0x16422e[_0xe980('0x40')]),_0x577d17);if(_0x1f35ed[_0xe980('0x3f')][_0xe980('0x4a')]){_0x49448b[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x49448b['where'],{'$or':_['map'](_0x577d17,function(_0x8b1e4){if(_0x8b1e4[_0xe980('0x3c')]!==_0xe980('0x4c')){var _0x4a2544={};_0x4a2544[_0x8b1e4[_0xe980('0x35')]]={'$like':'%'+_0x1f35ed[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x4a2544;}})});}_0x49448b=_[_0xe980('0x4b')]({},_0x49448b,_0x1f35ed[_0xe980('0x4d')]);var _0x5e1b39={'where':_0x49448b[_0xe980('0x48')]};return db[_0xe980('0x39')][_0xe980('0x2b')](_0x5e1b39)['then'](function(_0x4f9504){_0x5c4626[_0xe980('0x2b')]=_0x4f9504;if(_0x1f35ed[_0xe980('0x3f')]['includeAll']){_0x49448b[_0xe980('0x4e')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xe980('0x4f')](_0x49448b);})['then'](function(_0x52c1b3){_0x5c4626[_0xe980('0x50')]=_0x52c1b3;return _0x5c4626;})[_0xe980('0x1c')](respondWithFilteredResult(_0x1faffe,_0x49448b))[_0xe980('0x26')](handleError(_0x1faffe,null));};exports[_0xe980('0x51')]=function(_0x713154,_0xc151aa){var _0x51df57={'raw':![],'where':{'id':_0x713154[_0xe980('0x52')]['id']},'include':[{'model':db[_0xe980('0x37')],'as':_0xe980('0x38')}]},_0x161a56={};_0x161a56[_0xe980('0x43')]=_['keys'](db[_0xe980('0x39')][_0xe980('0x3a')]);_0x161a56[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x713154[_0xe980('0x3f')]);_0x161a56[_0xe980('0x40')]=_[_0xe980('0x41')](_0x161a56['model'],_0x161a56[_0xe980('0x3f')]);_0x51df57[_0xe980('0x42')]=_[_0xe980('0x41')](_0x161a56[_0xe980('0x43')],qs[_0xe980('0x44')](_0x713154['query']['fields']));_0x51df57[_0xe980('0x42')]=_0x51df57[_0xe980('0x42')][_0xe980('0x54')]?_0x51df57[_0xe980('0x42')]:_0x161a56[_0xe980('0x43')];if(_0x713154[_0xe980('0x3f')]['includeAll']){_0x51df57[_0xe980('0x4e')]=[{'all':!![]}];}_0x51df57=_[_0xe980('0x4b')]({},_0x51df57,_0x713154[_0xe980('0x4d')]);return db[_0xe980('0x39')][_0xe980('0x55')](_0x51df57)[_0xe980('0x1c')](handleEntityNotFound(_0xc151aa,null))[_0xe980('0x1c')](respondWithResult(_0xc151aa,null))['catch'](handleError(_0xc151aa,null));};exports[_0xe980('0x56')]=function(_0x300877,_0x19d3e1){return db[_0xe980('0x39')]['create'](_0x300877[_0xe980('0x57')],{})[_0xe980('0x1c')](function(_0x358820){var _0x4831b0=_0x300877[_0xe980('0x58')][_0xe980('0x32')]({'plain':!![]});if(!_0x4831b0)throw new Error(_0xe980('0x59'));if(_0x4831b0[_0xe980('0x5a')]===_0xe980('0x58')){var _0x4275fc=_0x358820[_0xe980('0x32')]({'plain':!![]});var _0x299b9a=_0xe980('0x5b');return db[_0xe980('0x5c')][_0xe980('0x55')]({'where':{'name':_0x299b9a,'userProfileId':_0x4831b0[_0xe980('0x5d')]},'raw':!![]})[_0xe980('0x1c')](function(_0x1c1290){if(_0x1c1290&&_0x1c1290[_0xe980('0x5e')]===0x0){return db[_0xe980('0x5f')][_0xe980('0x56')]({'name':_0x4275fc['name'],'resourceId':_0x4275fc['id'],'type':_0x1c1290[_0xe980('0x35')],'sectionId':_0x1c1290['id']},{})[_0xe980('0x1c')](function(){return _0x358820;});}else{return _0x358820;}})[_0xe980('0x26')](function(_0x5b3f71){logger[_0xe980('0x21')](_0xe980('0x60'),_0x5b3f71);throw _0x5b3f71;});}return _0x358820;})[_0xe980('0x1c')](respondWithResult(_0x19d3e1,0xc9))['catch'](handleError(_0x19d3e1,null));};exports[_0xe980('0x61')]=function(_0x2a02bd,_0x188d68){if(_0x2a02bd[_0xe980('0x57')]['id']){delete _0x2a02bd['body']['id'];}return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x2a02bd[_0xe980('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xe980('0x38')}]})[_0xe980('0x1c')](handleEntityNotFound(_0x188d68,null))[_0xe980('0x1c')](saveUpdates(_0x2a02bd[_0xe980('0x57')],null))[_0xe980('0x1c')](respondWithResult(_0x188d68,null))[_0xe980('0x26')](handleError(_0x188d68,null));};exports['destroy']=function(_0x17b346,_0x466093){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x17b346[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x466093,null))[_0xe980('0x1c')](removeEntity(_0x466093,null))[_0xe980('0x26')](handleError(_0x466093,null));};exports[_0xe980('0x62')]=function(_0x5adc6d,_0x269260){return db[_0xe980('0x39')]['describe']()[_0xe980('0x1c')](respondWithResult(_0x269260,null))[_0xe980('0x26')](handleError(_0x269260,null));};exports[_0xe980('0x63')]=function(_0x37cf72,_0x2b9dad,_0x47940b){if(_0x37cf72[_0xe980('0x57')]['id']){delete _0x37cf72[_0xe980('0x57')]['id'];}return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x37cf72[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x2b9dad,null))[_0xe980('0x1c')](function(_0x3b4c8f){if(_0x3b4c8f){_0x37cf72[_0xe980('0x57')][_0xe980('0x64')]=_0x3b4c8f['id'];return db['Disposition'][_0xe980('0x56')](_0x37cf72[_0xe980('0x57')]);}})[_0xe980('0x1c')](respondWithResult(_0x2b9dad,null))['catch'](handleError(_0x2b9dad,null));};exports['getDispositions']=function(_0x5a6c4d,_0x7b79e2,_0x4e4159){var _0xfcfcef={'raw':![],'where':{}};var _0x3b44c2={};var _0x2597b4={'count':0x0,'rows':[]};return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x5a6c4d[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x7b79e2,null))['then'](function(_0x20d8ae){if(_0x20d8ae){_0x3b44c2[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x66')][_0xe980('0x3a')]);_0x3b44c2[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x5a6c4d[_0xe980('0x3f')]);_0x3b44c2[_0xe980('0x40')]=_[_0xe980('0x41')](_0x3b44c2['model'],_0x3b44c2[_0xe980('0x3f')]);_0xfcfcef[_0xe980('0x42')]=_[_0xe980('0x41')](_0x3b44c2[_0xe980('0x43')],qs[_0xe980('0x44')](_0x5a6c4d['query'][_0xe980('0x44')]));_0xfcfcef[_0xe980('0x42')]=_0xfcfcef['attributes'][_0xe980('0x54')]?_0xfcfcef[_0xe980('0x42')]:_0x3b44c2[_0xe980('0x43')];if(!_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x45')](_0xe980('0x67'))){_0xfcfcef[_0xe980('0x2d')]=qs['limit'](_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x2d')]);_0xfcfcef['offset']=qs['offset'](_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x2c')]);}_0xfcfcef[_0xe980('0x46')]=qs['sort'](_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x47')]);_0xfcfcef['where']=qs[_0xe980('0x40')](_['pick'](_0x5a6c4d[_0xe980('0x3f')],_0x3b44c2['filters']));_0xfcfcef[_0xe980('0x48')][_0xe980('0x64')]=_0x20d8ae['id'];if(_0x5a6c4d['query']['filter']){_0xfcfcef[_0xe980('0x48')]=_[_0xe980('0x4b')](_0xfcfcef[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0xfcfcef[_0xe980('0x42')],function(_0x1d2cdc){var _0x4720ed={};_0x4720ed[_0x1d2cdc]={'$like':'%'+_0x5a6c4d[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x4720ed;})});}_0xfcfcef=_[_0xe980('0x4b')]({},_0xfcfcef,_0x5a6c4d[_0xe980('0x4d')]);return db[_0xe980('0x66')][_0xe980('0x2b')]({'where':_0xfcfcef[_0xe980('0x48')]})['then'](function(_0xa513f4){_0x2597b4['count']=_0xa513f4;if(_0x5a6c4d[_0xe980('0x3f')]['includeAll']){_0xfcfcef[_0xe980('0x4e')]=[{'all':!![]}];}return db[_0xe980('0x66')]['findAll'](_0xfcfcef);})['then'](function(_0x16a5af){_0x2597b4['rows']=_0x16a5af;return _0x2597b4;});}})['then'](respondWithFilteredResult(_0x7b79e2,_0xfcfcef))[_0xe980('0x26')](handleError(_0x7b79e2,null));};exports[_0xe980('0x68')]=function(_0x35f031,_0x48519e,_0x3c7e5a){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x35f031[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x48519e,null))[_0xe980('0x1c')](function(_0x36454f){if(_0x36454f){return _0x36454f['removeDispositions'](_0x35f031[_0xe980('0x3f')][_0xe980('0x69')]);}})['then'](respondWithStatusCode(_0x48519e,null))[_0xe980('0x26')](handleError(_0x48519e,null));};exports[_0xe980('0x6a')]=function(_0x2064f1,_0x4badad,_0x39c57b){if(_0x2064f1['body']['id']){delete _0x2064f1[_0xe980('0x57')]['id'];}return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x2064f1[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x4badad,null))[_0xe980('0x1c')](function(_0x268536){if(_0x268536){_0x2064f1[_0xe980('0x57')]['OpenchannelAccountId']=_0x268536['id'];return db[_0xe980('0x6b')][_0xe980('0x56')](_0x2064f1[_0xe980('0x57')]);}})['then'](respondWithResult(_0x4badad,null))[_0xe980('0x26')](handleError(_0x4badad,null));};exports['getAnswers']=function(_0x64fc2c,_0x4f3321,_0x4ec8a1){var _0x52d1e1={'raw':![],'where':{}};var _0x3bccde={};var _0x5dc191={'count':0x0,'rows':[]};return db[_0xe980('0x39')]['findOne']({'where':{'id':_0x64fc2c[_0xe980('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f3321,null))[_0xe980('0x1c')](function(_0x355f70){if(_0x355f70){_0x3bccde[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x6b')][_0xe980('0x3a')]);_0x3bccde[_0xe980('0x3f')]=_['keys'](_0x64fc2c[_0xe980('0x3f')]);_0x3bccde[_0xe980('0x40')]=_[_0xe980('0x41')](_0x3bccde[_0xe980('0x43')],_0x3bccde[_0xe980('0x3f')]);_0x52d1e1[_0xe980('0x42')]=_[_0xe980('0x41')](_0x3bccde[_0xe980('0x43')],qs['fields'](_0x64fc2c['query'][_0xe980('0x44')]));_0x52d1e1[_0xe980('0x42')]=_0x52d1e1['attributes'][_0xe980('0x54')]?_0x52d1e1[_0xe980('0x42')]:_0x3bccde[_0xe980('0x43')];if(!_0x64fc2c[_0xe980('0x3f')]['hasOwnProperty'](_0xe980('0x67'))){_0x52d1e1[_0xe980('0x2d')]=qs['limit'](_0x64fc2c['query']['limit']);_0x52d1e1['offset']=qs['offset'](_0x64fc2c['query']['offset']);}_0x52d1e1[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x64fc2c[_0xe980('0x3f')][_0xe980('0x47')]);_0x52d1e1[_0xe980('0x48')]=qs[_0xe980('0x40')](_[_0xe980('0x49')](_0x64fc2c['query'],_0x3bccde[_0xe980('0x40')]));_0x52d1e1[_0xe980('0x48')][_0xe980('0x64')]=_0x355f70['id'];if(_0x64fc2c[_0xe980('0x3f')]['filter']){_0x52d1e1[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x52d1e1[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0x52d1e1[_0xe980('0x42')],function(_0x2720ed){var _0x144b6d={};_0x144b6d[_0x2720ed]={'$like':'%'+_0x64fc2c['query'][_0xe980('0x4a')]+'%'};return _0x144b6d;})});}_0x52d1e1=_['merge']({},_0x52d1e1,_0x64fc2c[_0xe980('0x4d')]);return db[_0xe980('0x6b')][_0xe980('0x2b')]({'where':_0x52d1e1['where']})[_0xe980('0x1c')](function(_0x28d0b9){_0x5dc191[_0xe980('0x2b')]=_0x28d0b9;if(_0x64fc2c['query']['includeAll']){_0x52d1e1['include']=[{'all':!![]}];}return db[_0xe980('0x6b')][_0xe980('0x4f')](_0x52d1e1);})['then'](function(_0x44ecc8){_0x5dc191['rows']=_0x44ecc8;return _0x5dc191;});}})[_0xe980('0x1c')](respondWithFilteredResult(_0x4f3321,_0x52d1e1))[_0xe980('0x26')](handleError(_0x4f3321,null));};exports['removeAnswers']=function(_0x38bd68,_0x2c3e9c,_0x2b7854){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x38bd68['params']['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x2c3e9c,null))[_0xe980('0x1c')](function(_0x27541a){if(_0x27541a){return _0x27541a[_0xe980('0x6c')](_0x38bd68['query'][_0xe980('0x69')]);}})[_0xe980('0x1c')](respondWithStatusCode(_0x2c3e9c,null))[_0xe980('0x26')](handleError(_0x2c3e9c,null));};exports[_0xe980('0x6d')]=function(_0x121730,_0x264d75,_0x4d05b5){var _0x1d3ce4={'body':_0x121730['body'],'channel':'openchannel'};var _0x11c964=[];var _0x5a4495=[];var _0x58124a={};var _0x4555f0=![];return db[_0xe980('0x6e')][_0xe980('0x62')]()[_0xe980('0x1c')](function(_0x3a547f){if(!_0x3a547f){throw new db['Sequelize'][(_0xe980('0x6f'))](_0xe980('0x70'));}_0x11c964=_[_0xe980('0x71')](_[_0xe980('0x53')](_0x3a547f),[_0xe980('0x72'),'updatedAt']);_0x5a4495=_[_0xe980('0x71')](_[_0xe980('0x53')](_0x3a547f),[_0xe980('0x72'),_0xe980('0x73'),_0xe980('0x74'),'ListId']);if(_0x121730['body']['id']){delete _0x121730[_0xe980('0x57')]['id'];}if(_[_0xe980('0x75')](_0x121730[_0xe980('0x57')][_0xe980('0x76')])){throw new db[(_0xe980('0x77'))][(_0xe980('0x6f'))](_0xe980('0x78'));}if(_['isNil'](_0x121730[_0xe980('0x57')][_0xe980('0x57')])||_0x121730[_0xe980('0x57')][_0xe980('0x57')]===''){throw new db[(_0xe980('0x77'))]['ValidationError'](_0xe980('0x79'));}if(_[_0xe980('0x75')](_0x121730['body']['mapKey'])){throw new db[(_0xe980('0x77'))][(_0xe980('0x6f'))](_0xe980('0x7a')+_0x5a4495);}if(!_[_0xe980('0x7b')](_0x5a4495,_0x121730[_0xe980('0x57')][_0xe980('0x7c')])){throw new db['Sequelize'][(_0xe980('0x6f'))](_0xe980('0x7d')+_0x5a4495);}_0x58124a[_0x121730[_0xe980('0x57')][_0xe980('0x7c')]]=_0x121730[_0xe980('0x57')][_0xe980('0x76')];})[_0xe980('0x1c')](function(){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x121730['params']['id']},'include':[{'model':db[_0xe980('0x7e')],'as':_0xe980('0x7f'),'include':[{'model':db[_0xe980('0x6e')],'as':_0xe980('0x80'),'where':_0x58124a,'limit':0x1,'order':[[_0xe980('0x73'),_0xe980('0x81')]]}]},{'model':db[_0xe980('0x82')],'as':_0xe980('0x83')}]});})[_0xe980('0x1c')](handleEntityNotFound(_0x264d75,null))[_0xe980('0x1c')](function(_0x59b327){if(_0x59b327&&_0x59b327[_0xe980('0x7f')]){_0x1d3ce4['account']=_0x59b327;_0x1d3ce4[_0xe980('0x84')]=_0x59b327[_0xe980('0x83')];_0x1d3ce4[_0xe980('0x85')]=_0x59b327[_0xe980('0x7f')];_0x1d3ce4['applications']=_[_0xe980('0x86')](_0x1d3ce4['applications'],[_0xe980('0x87')],[_0xe980('0x88')]);if(_0x1d3ce4['account'][_0xe980('0x83')]){delete _0x1d3ce4[_0xe980('0x89')][_0xe980('0x83')];}if(_0x1d3ce4[_0xe980('0x89')]['List']&&_0x1d3ce4[_0xe980('0x89')][_0xe980('0x7f')][_0xe980('0x80')][_0xe980('0x54')]){return _0x1d3ce4[_0xe980('0x89')][_0xe980('0x7f')]['Contacts'][0x0];}var _0x3dec9c=_[_0xe980('0x14')](_0x121730[_0xe980('0x57')],{'firstName':_0x121730[_0xe980('0x57')][_0xe980('0x76')],'ListId':_0x59b327[_0xe980('0x8a')]});_0x3dec9c[_0x121730[_0xe980('0x57')]['mapKey']]=_0x121730[_0xe980('0x57')][_0xe980('0x76')];return db['CmContact']['create'](_0x3dec9c,{'fields':_0x11c964,'raw':!![]});}})[_0xe980('0x1c')](handleEntityNotFound(_0x264d75,null))[_0xe980('0x1c')](function(_0x529f39){_0x1d3ce4['contact']=_0x529f39;if(_0x529f39){var _0x2b2727={'ContactId':_0x529f39['id'],'OpenchannelAccountId':_0x121730[_0xe980('0x52')]['id'],'from':(_0x529f39['firstName']||'')+'\x20'+(_0x529f39['lastName']||'')};var _0x135341={'OpenchannelAccountId':_0x121730['params']['id'],'closed':![]};if(_0x121730[_0xe980('0x57')][_0xe980('0x8b')]){_0x135341[_0xe980('0x8b')]=_0x121730['body'][_0xe980('0x8b')];return db[_0xe980('0x8c')][_0xe980('0x55')]({'where':_0x135341})[_0xe980('0x1c')](function(_0x29ce47){if(_0x29ce47){return[_0x29ce47,![]];}_0x2b2727[_0xe980('0x8b')]=_0x121730['body'][_0xe980('0x8b')];_0x2b2727[_0xe980('0x8d')]=_0x121730[_0xe980('0x57')][_0xe980('0x8d')];return db[_0xe980('0x8c')][_0xe980('0x56')](_0x2b2727)[_0xe980('0x1c')](function(_0x5c2247){return[_0x5c2247,!![]];});});}else{_0x135341['threadId']=null;}_0x135341[_0xe980('0x8e')]=_0x529f39['id'];return db[_0xe980('0x8c')][_0xe980('0x55')]({'where':_0x135341})[_0xe980('0x1c')](function(_0xb157d6){if(_0xb157d6){return[_0xb157d6,![]];}return db[_0xe980('0x8c')][_0xe980('0x56')](_0x2b2727)[_0xe980('0x1c')](function(_0x17f37b){return[_0x17f37b,!![]];});});}})[_0xe980('0x8f')](function(_0x44610a,_0x56da6a){if(_0x44610a){_0x4555f0=_0x56da6a;if(!_0x56da6a){var _0x10fd1b={'from':(_0x1d3ce4[_0xe980('0x90')][_0xe980('0x91')]||'')+'\x20'+(_0x1d3ce4['contact'][_0xe980('0x92')]||'')};if(_0x121730[_0xe980('0x57')][_0xe980('0x8b')]&&_0x121730[_0xe980('0x57')][_0xe980('0x93')]&&_0x121730[_0xe980('0x57')][_0xe980('0x8b')]!=_0x121730[_0xe980('0x57')][_0xe980('0x93')]){_0x10fd1b[_0xe980('0x8b')]=_0x121730[_0xe980('0x57')][_0xe980('0x93')];}return _0x44610a[_0xe980('0x61')](_0x10fd1b);}else{return _0x44610a;}}})[_0xe980('0x1c')](function(_0x52f6ae){_0x1d3ce4[_0xe980('0x94')]=_0x52f6ae[_0xe980('0x32')]({'plain':!![]});_0x1d3ce4[_0xe980('0x94')][_0xe980('0x95')]=_0x4555f0;if(_0x1d3ce4['interaction'][_0xe980('0x95')]){if(_0x1d3ce4['account'][_0xe980('0x96')]){_0x1d3ce4[_0xe980('0x84')]['push']({'id':0x0,'priority':_0x1d3ce4[_0xe980('0x84')][_0xe980('0x54')]+0x1,'app':_0xe980('0x97'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xe980('0x98')]['create']({'body':_0x121730[_0xe980('0x57')][_0xe980('0x57')],'OpenchannelAccountId':_0x121730[_0xe980('0x52')]['id'],'OpenchannelInteractionId':_0x52f6ae['id'],'direction':'in','ContactId':_0x1d3ce4['contact']['id'],'AttachmentId':_0x121730[_0xe980('0x57')]['AttachmentId']});})[_0xe980('0x1c')](function(_0x35547a){_0x1d3ce4[_0xe980('0x23')]=_0x35547a;if(!_0x1d3ce4['interaction']['UserId'])return;return db[_0xe980('0x99')]['find']({'attributes':['id',_0xe980('0x35')],'where':{'id':_0x1d3ce4[_0xe980('0x94')][_0xe980('0x9a')]}});})[_0xe980('0x1c')](function(_0x3f3ea2){if(_0x3f3ea2){_0x1d3ce4[_0xe980('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f3ea2['name']+','+(_0x1d3ce4[_0xe980('0x89')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1d3ce4[_0xe980('0x94')][_0xe980('0x9b')])return;return db['OpenchannelQueue']['find']({'attributes':['id','name'],'where':{'id':_0x1d3ce4[_0xe980('0x94')]['queueId']}});})['then'](function(_0x233545){if(_0x233545){_0x1d3ce4['applications'][_0xe980('0x9c')]({'id':0x0,'priority':0x1,'app':_0xe980('0x9d'),'appdata':_0x233545[_0xe980('0x35')]+','+(_0x1d3ce4['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe980('0x9e'),_0xe980('0x9f'),_0x1d3ce4);})[_0xe980('0x1c')](function(_0x200eb1){respondWithRpcPromise(_0xe980('0xa0'),_0xe980('0xa0'),{'event':_0xe980('0x6d'),'message':_0x200eb1},client9002);return _0x200eb1;})['then'](respondWithResult(_0x264d75,null))['catch'](handleError(_0x264d75,null));};exports['addApplications']=function(_0x267ac6,_0x117a74){var _0x4ce90a=_0x267ac6[_0xe980('0x52')]['id'];var _0x287d62=_0x267ac6[_0xe980('0x57')];var _0xe12d31=0xc8;var _0xc9b6a3=null;return db[_0xe980('0xa1')][_0xe980('0xa2')]({'isolationLevel':db[_0xe980('0xa1')][_0xe980('0xa3')]['ISOLATION_LEVELS'][_0xe980('0xa4')]},function(_0x39c140){return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x4ce90a},'transaction':_0x39c140})[_0xe980('0x1c')](function(_0x42acb7){if(_0x42acb7){return db['OpenchannelApplication'][_0xe980('0x31')]({'where':{'OpenchannelAccountId':_0x4ce90a},'transaction':_0x39c140})[_0xe980('0x1c')](function(){var _0x464c04=_[_0xe980('0x3e')](_0x287d62,function(_0x53017f){_0x53017f[_0xe980('0x64')]=_0x4ce90a;return _0x53017f;});return db[_0xe980('0x82')][_0xe980('0xa5')](_0x464c04,{'transaction':_0x39c140});});}else{_0xe12d31=0x194;_0xc9b6a3=[];}});})['then'](function(){if(_0xe12d31!==0x194){return db[_0xe980('0x82')][_0xe980('0xa6')]({'where':{'OpenchannelAccountId':_0x4ce90a},'order':_0xe980('0x87')})[_0xe980('0x1c')](function(_0xbb0b87){_0xc9b6a3=_0xbb0b87;});}})[_0xe980('0x26')](function(_0x4f2d6e){_0xe12d31=0x1f4;logger[_0xe980('0x21')](_0x4f2d6e['stack']);if(_0x4f2d6e[_0xe980('0x35')]){delete _0x4f2d6e[_0xe980('0x35')];}_0xc9b6a3=_0x4f2d6e;})['finally'](function(){if(_0xc9b6a3===null){_0x117a74[_0xe980('0x33')](_0xe12d31);}else{if(_0xe12d31===0x1f4){_0x117a74['status'](_0xe12d31)[_0xe980('0xa7')](_0xc9b6a3);}else{_0x117a74[_0xe980('0x27')](_0xe12d31)['json'](_0xc9b6a3);}}});};exports[_0xe980('0xa8')]=function(_0x3ce2b5,_0x536a59,_0x2da697){var _0x16193b={};var _0x7f4f1b={};var _0x23e593;var _0x4b94ec;return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x3ce2b5['params']['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x536a59,null))[_0xe980('0x1c')](function(_0x37fa02){if(_0x37fa02){_0x23e593=_0x37fa02;_0x7f4f1b[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x82')]['rawAttributes']);_0x7f4f1b[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x3ce2b5[_0xe980('0x3f')]);_0x7f4f1b[_0xe980('0x40')]=_[_0xe980('0x41')](_0x7f4f1b[_0xe980('0x43')],_0x7f4f1b[_0xe980('0x3f')]);_0x16193b['attributes']=_['intersection'](_0x7f4f1b['model'],qs[_0xe980('0x44')](_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x44')]));_0x16193b[_0xe980('0x42')]=_0x16193b[_0xe980('0x42')][_0xe980('0x54')]?_0x16193b[_0xe980('0x42')]:_0x7f4f1b['model'];_0x16193b[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x47')]);_0x16193b[_0xe980('0x48')]=qs[_0xe980('0x40')](_[_0xe980('0x49')](_0x3ce2b5[_0xe980('0x3f')],_0x7f4f1b[_0xe980('0x40')]));if(_0x3ce2b5[_0xe980('0x3f')]['filter']){_0x16193b[_0xe980('0x48')]=_['merge'](_0x16193b['where'],{'$or':_[_0xe980('0x3e')](_0x16193b[_0xe980('0x42')],function(_0x43b52e){var _0x38c0e5={};_0x38c0e5[_0x43b52e]={'$like':'%'+_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x38c0e5;})});}_0x16193b=_[_0xe980('0x4b')]({},_0x16193b,_0x3ce2b5['options']);return _0x23e593[_0xe980('0xa8')](_0x16193b);}})['then'](function(_0xc0f474){if(_0xc0f474){_0x4b94ec=_0xc0f474[_0xe980('0x54')];if(!_0x3ce2b5[_0xe980('0x3f')]['hasOwnProperty']('nolimit')){_0x16193b[_0xe980('0x2d')]=qs[_0xe980('0x2d')](_0x3ce2b5['query'][_0xe980('0x2d')]);_0x16193b[_0xe980('0x2c')]=qs['offset'](_0x3ce2b5[_0xe980('0x3f')][_0xe980('0x2c')]);}return _0x23e593['getApplications'](_0x16193b);}})['then'](function(_0x1c84da){if(_0x1c84da){return _0x1c84da?{'count':_0x4b94ec,'rows':_0x1c84da}:null;}})[_0xe980('0x1c')](respondWithResult(_0x536a59,null))[_0xe980('0x26')](handleError(_0x536a59,null));};exports[_0xe980('0xa9')]=function(_0x5277c8,_0x5f5621,_0x12d554){var _0x3886bd={'raw':![],'where':{}};var _0x3cee6c={};var _0x41511b={'count':0x0,'rows':[]};return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x5277c8[_0xe980('0x52')]['id']}})['then'](handleEntityNotFound(_0x5f5621,null))['then'](function(_0x19cd4d){if(_0x19cd4d){_0x3cee6c[_0xe980('0x43')]=_['keys'](db[_0xe980('0x8c')][_0xe980('0x3a')]);_0x3cee6c[_0xe980('0x3f')]=_[_0xe980('0x53')](_0x5277c8[_0xe980('0x3f')]);_0x3cee6c[_0xe980('0x40')]=_['intersection'](_0x3cee6c[_0xe980('0x43')],_0x3cee6c['query']);_0x3886bd[_0xe980('0x42')]=_['intersection'](_0x3cee6c[_0xe980('0x43')],qs[_0xe980('0x44')](_0x5277c8['query'][_0xe980('0x44')]));_0x3886bd['attributes']=_0x3886bd[_0xe980('0x42')][_0xe980('0x54')]?_0x3886bd[_0xe980('0x42')]:_0x3cee6c[_0xe980('0x43')];if(!_0x5277c8[_0xe980('0x3f')][_0xe980('0x45')]('nolimit')){_0x3886bd['limit']=qs[_0xe980('0x2d')](_0x5277c8[_0xe980('0x3f')][_0xe980('0x2d')]);_0x3886bd[_0xe980('0x2c')]=qs[_0xe980('0x2c')](_0x5277c8['query']['offset']);}_0x3886bd[_0xe980('0x46')]=qs[_0xe980('0x47')](_0x5277c8[_0xe980('0x3f')][_0xe980('0x47')]);_0x3886bd[_0xe980('0x48')]=qs[_0xe980('0x40')](_['pick'](_0x5277c8['query'],_0x3cee6c['filters']));_0x3886bd[_0xe980('0x48')][_0xe980('0x64')]=_0x19cd4d['id'];if(_0x5277c8[_0xe980('0x3f')][_0xe980('0x4a')]){_0x3886bd[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x3886bd[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0x3886bd[_0xe980('0x42')],function(_0x469d76){var _0x42d08e={};_0x42d08e[_0x469d76]={'$like':'%'+_0x5277c8[_0xe980('0x3f')][_0xe980('0x4a')]+'%'};return _0x42d08e;})});}_0x3886bd=_[_0xe980('0x4b')]({},_0x3886bd,_0x5277c8[_0xe980('0x4d')]);return db['OpenchannelInteraction'][_0xe980('0x2b')]({'where':_0x3886bd['where']})[_0xe980('0x1c')](function(_0x52ce8f){_0x41511b[_0xe980('0x2b')]=_0x52ce8f;if(_0x5277c8[_0xe980('0x3f')]['includeAll']){_0x3886bd[_0xe980('0x4e')]=[{'model':db['CmContact'],'as':_0xe980('0xaa'),'required':![]},{'model':db[_0xe980('0x99')],'as':_0xe980('0xab'),'attributes':[_0xe980('0x35'),_0xe980('0xac'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xe980('0x35'),_0xe980('0xad')],'where':_0x5277c8[_0xe980('0x3f')]['tag']?{'id':_0x5277c8['query']['tag']}:undefined,'required':_0x5277c8[_0xe980('0x3f')][_0xe980('0xae')]?!![]:![]}];}return db[_0xe980('0x8c')][_0xe980('0x4f')](_0x3886bd);})[_0xe980('0x1c')](function(_0x226f13){_0x41511b[_0xe980('0x50')]=_0x226f13;return _0x41511b;});}})['then'](respondWithFilteredResult(_0x5f5621,_0x3886bd))[_0xe980('0x26')](handleError(_0x5f5621,null));};exports[_0xe980('0xaf')]=function(_0x140306,_0x6b23f,_0x19c75a){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x140306['params']['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x6b23f,null))[_0xe980('0x1c')](function(_0x100ee3){if(_0x100ee3){return _0x100ee3[_0xe980('0xaf')](_0x140306[_0xe980('0x57')][_0xe980('0x69')],_[_0xe980('0xb0')](_0x140306[_0xe980('0x57')],[_0xe980('0x69'),'id'])||{})[_0xe980('0x8f')](function(_0x4de543){for(var _0x189280=0x0;_0x189280<_0x140306[_0xe980('0x57')][_0xe980('0x69')]['length'];_0x189280+=0x1){socket[_0xe980('0xb1')](_0xe980('0xb2'),{'UserId':Number(_0x140306[_0xe980('0x57')][_0xe980('0x69')][_0x189280]),'OpenchannelAccountId':Number(_0x140306[_0xe980('0x52')]['id'])});}return _0x4de543;});}})[_0xe980('0x1c')](respondWithResult(_0x6b23f,null))[_0xe980('0x26')](handleError(_0x6b23f,null));};exports[_0xe980('0xb3')]=function(_0x18ba64,_0x44d7f8,_0x1f44ba){return db['OpenchannelAccount'][_0xe980('0x55')]({'where':{'id':_0x18ba64['params']['id']}})['then'](handleEntityNotFound(_0x44d7f8,null))['then'](function(_0x1a3b21){if(_0x1a3b21){return _0x1a3b21[_0xe980('0xb3')](_0x18ba64[_0xe980('0x3f')][_0xe980('0x69')])['then'](function(){if(_['isArray'](_0x18ba64[_0xe980('0x3f')][_0xe980('0x69')])){for(var _0x5ecab4=0x0;_0x5ecab4<_0x18ba64['query']['ids']['length'];_0x5ecab4+=0x1){socket[_0xe980('0xb1')](_0xe980('0xb4'),{'UserId':Number(_0x18ba64[_0xe980('0x3f')]['ids'][_0x5ecab4]),'OpenchannelAccountId':Number(_0x18ba64[_0xe980('0x52')]['id'])});}}else{socket['emit'](_0xe980('0xb4'),{'UserId':Number(_0x18ba64[_0xe980('0x3f')][_0xe980('0x69')]),'OpenchannelAccountId':Number(_0x18ba64['params']['id'])});}});}})[_0xe980('0x1c')](respondWithStatusCode(_0x44d7f8,null))['catch'](handleError(_0x44d7f8,null));};exports[_0xe980('0xb5')]=function(_0xf87ca3,_0xeb1e9a,_0x539621){var _0x4d0918={};var _0x1fbe46={};var _0x3ccf57;var _0x31e50a;return db[_0xe980('0x39')]['findOne']({'where':{'id':_0xf87ca3[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0xeb1e9a,null))[_0xe980('0x1c')](function(_0x2ba463){if(_0x2ba463){_0x3ccf57=_0x2ba463;_0x1fbe46[_0xe980('0x43')]=_[_0xe980('0x53')](db[_0xe980('0x99')][_0xe980('0x3a')]);_0x1fbe46[_0xe980('0x3f')]=_[_0xe980('0x53')](_0xf87ca3['query']);_0x1fbe46[_0xe980('0x40')]=_['intersection'](_0x1fbe46['model'],_0x1fbe46[_0xe980('0x3f')]);_0x4d0918[_0xe980('0x42')]=_[_0xe980('0x41')](_0x1fbe46[_0xe980('0x43')],qs['fields'](_0xf87ca3[_0xe980('0x3f')]['fields']));_0x4d0918['attributes']=_0x4d0918[_0xe980('0x42')]['length']?_0x4d0918[_0xe980('0x42')]:_0x1fbe46[_0xe980('0x43')];_0x4d0918[_0xe980('0x46')]=qs['sort'](_0xf87ca3[_0xe980('0x3f')]['sort']);_0x4d0918[_0xe980('0x48')]=qs['filters'](_[_0xe980('0x49')](_0xf87ca3['query'],_0x1fbe46[_0xe980('0x40')]));if(_0xf87ca3['query'][_0xe980('0x4a')]){_0x4d0918[_0xe980('0x48')]=_[_0xe980('0x4b')](_0x4d0918[_0xe980('0x48')],{'$or':_[_0xe980('0x3e')](_0x4d0918['attributes'],function(_0x1ce9d9){var _0x3e8efc={};_0x3e8efc[_0x1ce9d9]={'$like':'%'+_0xf87ca3['query']['filter']+'%'};return _0x3e8efc;})});}_0x4d0918=_[_0xe980('0x4b')]({},_0x4d0918,_0xf87ca3['options']);return _0x3ccf57[_0xe980('0xb5')](_0x4d0918);}})[_0xe980('0x1c')](function(_0x1ee44d){if(_0x1ee44d){_0x31e50a=_0x1ee44d[_0xe980('0x54')];if(!_0xf87ca3[_0xe980('0x3f')][_0xe980('0x45')](_0xe980('0x67'))){_0x4d0918['limit']=qs[_0xe980('0x2d')](_0xf87ca3[_0xe980('0x3f')]['limit']);_0x4d0918['offset']=qs[_0xe980('0x2c')](_0xf87ca3['query'][_0xe980('0x2c')]);}return _0x3ccf57[_0xe980('0xb5')](_0x4d0918);}})[_0xe980('0x1c')](function(_0x1e5b16){if(_0x1e5b16){return _0x1e5b16?{'count':_0x31e50a,'rows':_0x1e5b16}:null;}})['then'](respondWithResult(_0xeb1e9a,null))[_0xe980('0x26')](handleError(_0xeb1e9a,null));};exports[_0xe980('0xa7')]=function(_0x1cca5b,_0x1e05b4,_0x165db5){var _0x561f0e,_0x55a00f,_0x278278;if(_['isNil'](_0x1cca5b['body'][_0xe980('0x57')])||_0x1cca5b['body'][_0xe980('0x57')]===''){throw new db[(_0xe980('0x77'))][(_0xe980('0x6f'))](_0xe980('0x79'));}if(_[_0xe980('0x75')](_0x1cca5b['body']['to'])){}_0x561f0e=_0x1cca5b[_0xe980('0x57')]['to'];return db[_0xe980('0x39')][_0xe980('0x65')]({'where':{'id':_0x1cca5b[_0xe980('0x52')]['id']}})[_0xe980('0x1c')](handleEntityNotFound(_0x1e05b4,null))[_0xe980('0x1c')](function(_0x210d98){if(_0x210d98){return db[_0xe980('0x39')][_0xe980('0x55')]({'where':{'id':_0x210d98['id']},'include':[{'model':db['CmList'],'as':_0xe980('0x7f'),'include':[{'model':db[_0xe980('0x6e')],'as':'Contacts','where':{[_0x210d98[_0xe980('0x7c')]]:_0x561f0e},'limit':0x1,'order':[[_0xe980('0x73'),_0xe980('0x81')]]}]}]})['then'](handleEntityNotFound(_0x1e05b4,null))[_0xe980('0x1c')](function(_0x8710df){if(_0x8710df&&_0x8710df[_0xe980('0x7f')]){_0x55a00f=_0x8710df[_0xe980('0x32')]({'plain':!![]});if(_0x55a00f[_0xe980('0x7f')]&&_0x55a00f['List'][_0xe980('0x80')][_0xe980('0x54')]){return _0x55a00f['List'][_0xe980('0x80')][0x0];}return db['CmContact'][_0xe980('0x56')](_[_0xe980('0x14')](_0x1cca5b[_0xe980('0x57')],{'firstName':_0x561f0e,[_0x8710df[_0xe980('0x7c')]]:_0x561f0e,'phone':_0x561f0e,'ListId':_0x55a00f['ListId']}));}})['then'](handleEntityNotFound(_0x1e05b4,null))[_0xe980('0x1c')](function(_0x5e0b70){if(_0x5e0b70){_0x278278=_0x5e0b70;return db[_0xe980('0x8c')]['find']({'where':{'ContactId':_0x278278['id'],'closed':![],'OpenchannelAccountId':_0x55a00f['id']}})[_0xe980('0x1c')](function(_0x397fbd){if(_0x397fbd){return[_0x397fbd,![]];}return db['OpenchannelInteraction'][_0xe980('0x56')]({'UserId':_0x1cca5b['user']['id'],'ContactId':_0x278278['id'],'OpenchannelAccountId':_0x55a00f['id'],'lastMsgDirection':_0xe980('0xb6'),'firstMsgDirection':_0xe980('0xb6'),'Messages':[_[_0xe980('0x4b')](_0x1cca5b[_0xe980('0x57')],{'read':![],'body':_0x1cca5b['body'][_0xe980('0x57')],'OpenchannelAccountId':_0x55a00f['id'],'UserId':_0x1cca5b['user']['id'],'ContactId':_0x278278['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xe980('0xb7')}]})[_0xe980('0x1c')](function(_0x4afe95){return[_0x4afe95,!![]];});});}})['spread'](function(_0x189a78,_0x43d09f){if(_0x43d09f){return _0x189a78;}return db[_0xe980('0x98')][_0xe980('0x56')](_[_0xe980('0x4b')](_0x1cca5b[_0xe980('0x57')],{'read':![],'body':_0x1cca5b['body']['body'],'OpenchannelAccountId':_0x55a00f['id'],'OpenchannelInteractionId':_0x189a78['id'],'UserId':_0x1cca5b[_0xe980('0x58')]['id'],'ContactId':_0x278278['id']}))[_0xe980('0x1c')](function(_0x2f79c4){_0x189a78[_0xe980('0xb8')][_0xe980('0xb7')]=[];_0x189a78[_0xe980('0xb8')][_0xe980('0xb7')][_0xe980('0xb9')](_0x2f79c4[_0xe980('0xb8')]);return _0x189a78;});});}})[_0xe980('0x1c')](respondWithResult(_0x1e05b4,null))['catch'](handleError(_0x1e05b4,null));}; \ No newline at end of file +var _0x7ad3=['removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','DESC','OpenchannelApplication','Applications','List','applications','list','orderBy','priority','account','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','UserId','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','startRouting','EventManager','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','send','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','findOne','OpenchannelAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x7ad3,0x108));var _0x37ad=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x7ad3[_0x3f6565];return _0x4abd23;};'use strict';var emlformat=require(_0x37ad('0x0'));var rimraf=require(_0x37ad('0x1'));var zipdir=require(_0x37ad('0x2'));var jsonpatch=require(_0x37ad('0x3'));var rp=require('request-promise');var moment=require(_0x37ad('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x37ad('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x37ad('0x6'));var fs=require('fs');var fs_extra=require(_0x37ad('0x7'));var _=require(_0x37ad('0x8'));var squel=require(_0x37ad('0x9'));var crypto=require(_0x37ad('0xa'));var jsforce=require(_0x37ad('0xb'));var deskjs=require(_0x37ad('0xc'));var toCsv=require(_0x37ad('0xd'));var querystring=require(_0x37ad('0xe'));var Papa=require('papaparse');var Redis=require(_0x37ad('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x37ad('0x10'))(_0x37ad('0x11'));var utils=require(_0x37ad('0x12'));var config=require(_0x37ad('0x13'));var licenseUtil=require(_0x37ad('0x14'));var db=require(_0x37ad('0x15'))['db'];config[_0x37ad('0x16')]=_[_0x37ad('0x17')](config[_0x37ad('0x16')],{'host':_0x37ad('0x18'),'port':0x18eb});var socket=require(_0x37ad('0x19'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x37ad('0x1a')](socket);var jayson=require(_0x37ad('0x1b'));var client=jayson['client'][_0x37ad('0x1c')]({'port':0x232c});var client9002=jayson[_0x37ad('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ddb40,_0x4d90b0,_0x512ada,_0x3c7b74){return new BPromise(function(_0xb19de4,_0x3be7b7){var _0x4f6137=_0x3c7b74||client;return _0x4f6137[_0x37ad('0x1e')](_0x3ddb40,_0x512ada)[_0x37ad('0x1f')](function(_0x2e6c0e){logger['info'](_0x37ad('0x20'),_0x4d90b0,_0x37ad('0x21'));logger['debug'](_0x37ad('0x22'),_0x4d90b0,_0x37ad('0x21'),JSON[_0x37ad('0x23')](_0x2e6c0e));if(_0x2e6c0e['error']){if(_0x2e6c0e[_0x37ad('0x24')][_0x37ad('0x25')]===0x1f4){logger[_0x37ad('0x24')](_0x37ad('0x20'),_0x4d90b0,_0x2e6c0e[_0x37ad('0x24')]['message']);return _0x3be7b7(_0x2e6c0e[_0x37ad('0x24')][_0x37ad('0x26')]);}logger[_0x37ad('0x24')](_0x37ad('0x20'),_0x4d90b0,_0x2e6c0e['error'][_0x37ad('0x26')]);return _0xb19de4(_0x2e6c0e[_0x37ad('0x24')]['message']);}else{logger[_0x37ad('0x27')](_0x37ad('0x20'),_0x4d90b0,_0x37ad('0x21'));_0xb19de4(_0x2e6c0e[_0x37ad('0x28')][_0x37ad('0x26')]);}})['catch'](function(_0x4f93b3){logger[_0x37ad('0x24')](_0x37ad('0x20'),_0x4d90b0,_0x4f93b3);_0x3be7b7(_0x4f93b3);});});}function respondWithStatusCode(_0x13f62c,_0xf480c0){_0xf480c0=_0xf480c0||0xcc;return function(_0x10373f){if(_0x10373f){return _0x13f62c['sendStatus'](_0xf480c0);}return _0x13f62c[_0x37ad('0x29')](_0xf480c0)[_0x37ad('0x2a')]();};}function respondWithResult(_0x5a83be,_0x11d317){_0x11d317=_0x11d317||0xc8;return function(_0x40d36d){if(_0x40d36d){return _0x5a83be['status'](_0x11d317)[_0x37ad('0x2b')](_0x40d36d);}};}function respondWithFilteredResult(_0x4c15f2,_0x21fa5a){return function(_0x16daa4){if(_0x16daa4){var _0x1ea0e2=typeof _0x21fa5a[_0x37ad('0x2c')]==='undefined'&&typeof _0x21fa5a[_0x37ad('0x2d')]===_0x37ad('0x2e');var _0x5077af=_0x16daa4[_0x37ad('0x2f')];var _0x36555f=_0x1ea0e2?0x0:_0x21fa5a['offset'];var _0x2bdb58=_0x1ea0e2?_0x16daa4[_0x37ad('0x2f')]:_0x21fa5a[_0x37ad('0x2c')]+_0x21fa5a[_0x37ad('0x2d')];var _0x4b1ff8;if(_0x2bdb58>=_0x5077af){_0x2bdb58=_0x5077af;_0x4b1ff8=0xc8;}else{_0x4b1ff8=0xce;}_0x4c15f2[_0x37ad('0x29')](_0x4b1ff8);return _0x4c15f2[_0x37ad('0x30')](_0x37ad('0x31'),_0x36555f+'-'+_0x2bdb58+'/'+_0x5077af)[_0x37ad('0x2b')](_0x16daa4);}return null;};}function patchUpdates(_0x34f72d){return function(_0x1ca11c){try{jsonpatch['apply'](_0x1ca11c,_0x34f72d,!![]);}catch(_0x378256){return BPromise[_0x37ad('0x32')](_0x378256);}return _0x1ca11c[_0x37ad('0x33')]();};}function saveUpdates(_0x545cec,_0x183bf4){return function(_0x58f216){if(_0x58f216){return _0x58f216[_0x37ad('0x34')](_0x545cec)['then'](function(_0x14e0ac){return _0x14e0ac;});}return null;};}function removeEntity(_0x530964,_0x40c8ba){return function(_0x15fc43){if(_0x15fc43){return _0x15fc43['destroy']()['then'](function(){var _0x4c319f=_0x15fc43[_0x37ad('0x35')]({'plain':!![]});var _0x142524=_0x37ad('0x36');return db[_0x37ad('0x37')][_0x37ad('0x38')]({'where':{'type':_0x142524,'resourceId':_0x4c319f['id']}})[_0x37ad('0x1f')](function(){return _0x15fc43;});})['then'](function(){_0x530964['status'](0xcc)[_0x37ad('0x2a')]();});}};}function handleEntityNotFound(_0x1996dd,_0x3dff41){return function(_0x3098d7){if(!_0x3098d7){_0x1996dd[_0x37ad('0x39')](0x194);}return _0x3098d7;};}function handleError(_0x2914ba,_0x5da9f7){_0x5da9f7=_0x5da9f7||0x1f4;return function(_0x3440e5){logger['error'](_0x3440e5[_0x37ad('0x3a')]);if(_0x3440e5[_0x37ad('0x3b')]){delete _0x3440e5['name'];}_0x2914ba[_0x37ad('0x29')](_0x5da9f7)['send'](_0x3440e5);};}exports[_0x37ad('0x3c')]=function(_0x480539,_0x603a29){var _0x2627a8={'include':[{'model':db[_0x37ad('0x3d')],'as':_0x37ad('0x3e')}]},_0x500051={},_0x21eb25={'count':0x0,'rows':[]};var _0x17017a=_[_0x37ad('0x3f')](db[_0x37ad('0x40')][_0x37ad('0x41')],function(_0x22854e){return{'name':_0x22854e[_0x37ad('0x42')],'type':_0x22854e['type']['key']};});_0x500051[_0x37ad('0x43')]=_['map'](_0x17017a,'name');_0x500051[_0x37ad('0x44')]=_[_0x37ad('0x45')](_0x480539[_0x37ad('0x44')]);_0x500051[_0x37ad('0x46')]=_[_0x37ad('0x47')](_0x500051[_0x37ad('0x43')],_0x500051[_0x37ad('0x44')]);_0x2627a8[_0x37ad('0x48')]=_[_0x37ad('0x47')](_0x500051[_0x37ad('0x43')],qs[_0x37ad('0x49')](_0x480539[_0x37ad('0x44')][_0x37ad('0x49')]));_0x2627a8['attributes']=_0x2627a8['attributes'][_0x37ad('0x4a')]?_0x2627a8[_0x37ad('0x48')]:_0x500051[_0x37ad('0x43')];if(!_0x480539['query'][_0x37ad('0x4b')](_0x37ad('0x4c'))){_0x2627a8[_0x37ad('0x2d')]=qs['limit'](_0x480539[_0x37ad('0x44')]['limit']);_0x2627a8[_0x37ad('0x2c')]=qs[_0x37ad('0x2c')](_0x480539[_0x37ad('0x44')][_0x37ad('0x2c')]);}_0x2627a8[_0x37ad('0x4d')]=qs[_0x37ad('0x4e')](_0x480539[_0x37ad('0x44')][_0x37ad('0x4e')]);_0x2627a8[_0x37ad('0x4f')]=qs[_0x37ad('0x46')](_[_0x37ad('0x50')](_0x480539['query'],_0x500051[_0x37ad('0x46')]),_0x17017a);if(_0x480539[_0x37ad('0x44')][_0x37ad('0x51')]){_0x2627a8[_0x37ad('0x4f')]=_[_0x37ad('0x52')](_0x2627a8[_0x37ad('0x4f')],{'$or':_[_0x37ad('0x3f')](_0x17017a,function(_0x2baa03){if(_0x2baa03[_0x37ad('0x53')]!==_0x37ad('0x54')){var _0x4db8c0={};_0x4db8c0[_0x2baa03[_0x37ad('0x3b')]]={'$like':'%'+_0x480539[_0x37ad('0x44')][_0x37ad('0x51')]+'%'};return _0x4db8c0;}})});}_0x2627a8=_[_0x37ad('0x52')]({},_0x2627a8,_0x480539[_0x37ad('0x55')]);var _0x25c059={'where':_0x2627a8[_0x37ad('0x4f')]};return db[_0x37ad('0x40')][_0x37ad('0x2f')](_0x25c059)['then'](function(_0x1a9d93){_0x21eb25['count']=_0x1a9d93;if(_0x480539[_0x37ad('0x44')][_0x37ad('0x56')]){_0x2627a8[_0x37ad('0x57')]=[{'all':!![]}];}return db[_0x37ad('0x40')][_0x37ad('0x58')](_0x2627a8);})[_0x37ad('0x1f')](function(_0x2de05d){_0x21eb25[_0x37ad('0x59')]=_0x2de05d;return _0x21eb25;})[_0x37ad('0x1f')](respondWithFilteredResult(_0x603a29,_0x2627a8))['catch'](handleError(_0x603a29,null));};exports['show']=function(_0x34f99d,_0x501cc7){var _0xff9e2={'raw':![],'where':{'id':_0x34f99d[_0x37ad('0x5a')]['id']},'include':[{'model':db[_0x37ad('0x3d')],'as':'mandatoryDispositionPause'}]},_0xdc8f3d={};_0xdc8f3d['model']=_[_0x37ad('0x45')](db['OpenchannelAccount'][_0x37ad('0x41')]);_0xdc8f3d[_0x37ad('0x44')]=_[_0x37ad('0x45')](_0x34f99d['query']);_0xdc8f3d[_0x37ad('0x46')]=_[_0x37ad('0x47')](_0xdc8f3d[_0x37ad('0x43')],_0xdc8f3d[_0x37ad('0x44')]);_0xff9e2[_0x37ad('0x48')]=_['intersection'](_0xdc8f3d[_0x37ad('0x43')],qs[_0x37ad('0x49')](_0x34f99d[_0x37ad('0x44')][_0x37ad('0x49')]));_0xff9e2[_0x37ad('0x48')]=_0xff9e2['attributes']['length']?_0xff9e2[_0x37ad('0x48')]:_0xdc8f3d[_0x37ad('0x43')];if(_0x34f99d['query'][_0x37ad('0x56')]){_0xff9e2[_0x37ad('0x57')]=[{'all':!![]}];}_0xff9e2=_['merge']({},_0xff9e2,_0x34f99d[_0x37ad('0x55')]);return db[_0x37ad('0x40')][_0x37ad('0x5b')](_0xff9e2)[_0x37ad('0x1f')](handleEntityNotFound(_0x501cc7,null))[_0x37ad('0x1f')](respondWithResult(_0x501cc7,null))[_0x37ad('0x5c')](handleError(_0x501cc7,null));};exports[_0x37ad('0x5d')]=function(_0x7cacf8,_0xcd9d96){return db[_0x37ad('0x40')][_0x37ad('0x5d')](_0x7cacf8[_0x37ad('0x5e')],{})['then'](function(_0xa89955){var _0x32d2fa=_0x7cacf8['user'][_0x37ad('0x35')]({'plain':!![]});if(!_0x32d2fa)throw new Error(_0x37ad('0x5f'));if(_0x32d2fa[_0x37ad('0x60')]===_0x37ad('0x61')){var _0x58602a=_0xa89955[_0x37ad('0x35')]({'plain':!![]});var _0xfd7eca=_0x37ad('0x36');return db[_0x37ad('0x62')]['find']({'where':{'name':_0xfd7eca,'userProfileId':_0x32d2fa[_0x37ad('0x63')]},'raw':!![]})['then'](function(_0x220e1e){if(_0x220e1e&&_0x220e1e[_0x37ad('0x64')]===0x0){return db[_0x37ad('0x37')][_0x37ad('0x5d')]({'name':_0x58602a['name'],'resourceId':_0x58602a['id'],'type':_0x220e1e[_0x37ad('0x3b')],'sectionId':_0x220e1e['id']},{})[_0x37ad('0x1f')](function(){return _0xa89955;});}else{return _0xa89955;}})[_0x37ad('0x5c')](function(_0x4ee311){logger[_0x37ad('0x24')](_0x37ad('0x65'),_0x4ee311);throw _0x4ee311;});}return _0xa89955;})[_0x37ad('0x1f')](respondWithResult(_0xcd9d96,0xc9))[_0x37ad('0x5c')](handleError(_0xcd9d96,null));};exports[_0x37ad('0x34')]=function(_0x65e588,_0x54e2f1){if(_0x65e588[_0x37ad('0x5e')]['id']){delete _0x65e588[_0x37ad('0x5e')]['id'];}return db[_0x37ad('0x40')][_0x37ad('0x5b')]({'where':{'id':_0x65e588[_0x37ad('0x5a')]['id']},'include':[{'model':db[_0x37ad('0x3d')],'as':_0x37ad('0x3e')}]})['then'](handleEntityNotFound(_0x54e2f1,null))[_0x37ad('0x1f')](saveUpdates(_0x65e588[_0x37ad('0x5e')],null))[_0x37ad('0x1f')](respondWithResult(_0x54e2f1,null))[_0x37ad('0x5c')](handleError(_0x54e2f1,null));};exports[_0x37ad('0x38')]=function(_0x14e25a,_0x139492){return db[_0x37ad('0x40')][_0x37ad('0x5b')]({'where':{'id':_0x14e25a[_0x37ad('0x5a')]['id']}})[_0x37ad('0x1f')](handleEntityNotFound(_0x139492,null))['then'](removeEntity(_0x139492,null))[_0x37ad('0x5c')](handleError(_0x139492,null));};exports[_0x37ad('0x66')]=function(_0xd42093,_0x256849){return db[_0x37ad('0x40')]['describe']()[_0x37ad('0x1f')](respondWithResult(_0x256849,null))[_0x37ad('0x5c')](handleError(_0x256849,null));};exports[_0x37ad('0x67')]=function(_0x197e6b,_0x319bc2,_0xbfcf64){if(_0x197e6b['body']['id']){delete _0x197e6b['body']['id'];}return db[_0x37ad('0x40')][_0x37ad('0x5b')]({'where':{'id':_0x197e6b[_0x37ad('0x5a')]['id']}})[_0x37ad('0x1f')](handleEntityNotFound(_0x319bc2,null))[_0x37ad('0x1f')](function(_0xaa037c){if(_0xaa037c){_0x197e6b['body']['OpenchannelAccountId']=_0xaa037c['id'];return db['Disposition'][_0x37ad('0x5d')](_0x197e6b[_0x37ad('0x5e')]);}})['then'](respondWithResult(_0x319bc2,null))[_0x37ad('0x5c')](handleError(_0x319bc2,null));};exports['getDispositions']=function(_0x2ec11a,_0x73325c,_0x2519b9){var _0xd542c3={'raw':![],'where':{}};var _0x52b784={};var _0x4fa276={'count':0x0,'rows':[]};return db[_0x37ad('0x40')][_0x37ad('0x68')]({'where':{'id':_0x2ec11a['params']['id']}})['then'](handleEntityNotFound(_0x73325c,null))[_0x37ad('0x1f')](function(_0x1562c8){if(_0x1562c8){_0x52b784[_0x37ad('0x43')]=_['keys'](db['Disposition'][_0x37ad('0x41')]);_0x52b784[_0x37ad('0x44')]=_['keys'](_0x2ec11a['query']);_0x52b784['filters']=_[_0x37ad('0x47')](_0x52b784[_0x37ad('0x43')],_0x52b784[_0x37ad('0x44')]);_0xd542c3[_0x37ad('0x48')]=_['intersection'](_0x52b784['model'],qs[_0x37ad('0x49')](_0x2ec11a[_0x37ad('0x44')][_0x37ad('0x49')]));_0xd542c3['attributes']=_0xd542c3[_0x37ad('0x48')]['length']?_0xd542c3['attributes']:_0x52b784[_0x37ad('0x43')];if(!_0x2ec11a['query'][_0x37ad('0x4b')](_0x37ad('0x4c'))){_0xd542c3[_0x37ad('0x2d')]=qs[_0x37ad('0x2d')](_0x2ec11a['query'][_0x37ad('0x2d')]);_0xd542c3[_0x37ad('0x2c')]=qs['offset'](_0x2ec11a[_0x37ad('0x44')][_0x37ad('0x2c')]);}_0xd542c3['order']=qs[_0x37ad('0x4e')](_0x2ec11a[_0x37ad('0x44')][_0x37ad('0x4e')]);_0xd542c3[_0x37ad('0x4f')]=qs[_0x37ad('0x46')](_[_0x37ad('0x50')](_0x2ec11a[_0x37ad('0x44')],_0x52b784[_0x37ad('0x46')]));_0xd542c3['where'][_0x37ad('0x69')]=_0x1562c8['id'];if(_0x2ec11a[_0x37ad('0x44')][_0x37ad('0x51')]){_0xd542c3[_0x37ad('0x4f')]=_['merge'](_0xd542c3[_0x37ad('0x4f')],{'$or':_[_0x37ad('0x3f')](_0xd542c3[_0x37ad('0x48')],function(_0x2bcf94){var _0xcdb1a2={};_0xcdb1a2[_0x2bcf94]={'$like':'%'+_0x2ec11a['query'][_0x37ad('0x51')]+'%'};return _0xcdb1a2;})});}_0xd542c3=_[_0x37ad('0x52')]({},_0xd542c3,_0x2ec11a[_0x37ad('0x55')]);return db[_0x37ad('0x6a')]['count']({'where':_0xd542c3[_0x37ad('0x4f')]})[_0x37ad('0x1f')](function(_0x34aefd){_0x4fa276['count']=_0x34aefd;if(_0x2ec11a['query']['includeAll']){_0xd542c3[_0x37ad('0x57')]=[{'all':!![]}];}return db[_0x37ad('0x6a')][_0x37ad('0x58')](_0xd542c3);})[_0x37ad('0x1f')](function(_0x568352){_0x4fa276[_0x37ad('0x59')]=_0x568352;return _0x4fa276;});}})['then'](respondWithFilteredResult(_0x73325c,_0xd542c3))[_0x37ad('0x5c')](handleError(_0x73325c,null));};exports[_0x37ad('0x6b')]=function(_0x5f12ec,_0xd1c1ac,_0x1cfcf5){return db[_0x37ad('0x40')][_0x37ad('0x5b')]({'where':{'id':_0x5f12ec[_0x37ad('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd1c1ac,null))[_0x37ad('0x1f')](function(_0x5bd873){if(_0x5bd873){return _0x5bd873[_0x37ad('0x6b')](_0x5f12ec[_0x37ad('0x44')][_0x37ad('0x6c')]);}})[_0x37ad('0x1f')](respondWithStatusCode(_0xd1c1ac,null))[_0x37ad('0x5c')](handleError(_0xd1c1ac,null));};exports[_0x37ad('0x6d')]=function(_0xc99c43,_0x2f9ce5,_0xe806a4){if(_0xc99c43[_0x37ad('0x5e')]['id']){delete _0xc99c43[_0x37ad('0x5e')]['id'];}return db[_0x37ad('0x40')][_0x37ad('0x5b')]({'where':{'id':_0xc99c43['params']['id']}})['then'](handleEntityNotFound(_0x2f9ce5,null))[_0x37ad('0x1f')](function(_0x1d7328){if(_0x1d7328){_0xc99c43[_0x37ad('0x5e')][_0x37ad('0x69')]=_0x1d7328['id'];return db[_0x37ad('0x6e')]['create'](_0xc99c43[_0x37ad('0x5e')]);}})[_0x37ad('0x1f')](respondWithResult(_0x2f9ce5,null))[_0x37ad('0x5c')](handleError(_0x2f9ce5,null));};exports[_0x37ad('0x6f')]=function(_0x39eac7,_0x2c08a6,_0x2b2422){var _0x4efb85={'raw':![],'where':{}};var _0x18b8e6={};var _0x3dbce7={'count':0x0,'rows':[]};return db[_0x37ad('0x40')]['findOne']({'where':{'id':_0x39eac7[_0x37ad('0x5a')]['id']}})[_0x37ad('0x1f')](handleEntityNotFound(_0x2c08a6,null))[_0x37ad('0x1f')](function(_0x34e6b2){if(_0x34e6b2){_0x18b8e6[_0x37ad('0x43')]=_['keys'](db[_0x37ad('0x6e')][_0x37ad('0x41')]);_0x18b8e6['query']=_[_0x37ad('0x45')](_0x39eac7[_0x37ad('0x44')]);_0x18b8e6[_0x37ad('0x46')]=_[_0x37ad('0x47')](_0x18b8e6[_0x37ad('0x43')],_0x18b8e6['query']);_0x4efb85['attributes']=_[_0x37ad('0x47')](_0x18b8e6[_0x37ad('0x43')],qs[_0x37ad('0x49')](_0x39eac7['query']['fields']));_0x4efb85[_0x37ad('0x48')]=_0x4efb85['attributes']['length']?_0x4efb85['attributes']:_0x18b8e6[_0x37ad('0x43')];if(!_0x39eac7[_0x37ad('0x44')][_0x37ad('0x4b')](_0x37ad('0x4c'))){_0x4efb85[_0x37ad('0x2d')]=qs[_0x37ad('0x2d')](_0x39eac7['query'][_0x37ad('0x2d')]);_0x4efb85[_0x37ad('0x2c')]=qs['offset'](_0x39eac7[_0x37ad('0x44')]['offset']);}_0x4efb85[_0x37ad('0x4d')]=qs['sort'](_0x39eac7[_0x37ad('0x44')][_0x37ad('0x4e')]);_0x4efb85[_0x37ad('0x4f')]=qs[_0x37ad('0x46')](_[_0x37ad('0x50')](_0x39eac7[_0x37ad('0x44')],_0x18b8e6[_0x37ad('0x46')]));_0x4efb85[_0x37ad('0x4f')][_0x37ad('0x69')]=_0x34e6b2['id'];if(_0x39eac7[_0x37ad('0x44')][_0x37ad('0x51')]){_0x4efb85[_0x37ad('0x4f')]=_[_0x37ad('0x52')](_0x4efb85[_0x37ad('0x4f')],{'$or':_[_0x37ad('0x3f')](_0x4efb85['attributes'],function(_0x189659){var _0x5c4861={};_0x5c4861[_0x189659]={'$like':'%'+_0x39eac7[_0x37ad('0x44')]['filter']+'%'};return _0x5c4861;})});}_0x4efb85=_[_0x37ad('0x52')]({},_0x4efb85,_0x39eac7[_0x37ad('0x55')]);return db[_0x37ad('0x6e')][_0x37ad('0x2f')]({'where':_0x4efb85[_0x37ad('0x4f')]})[_0x37ad('0x1f')](function(_0x4869d7){_0x3dbce7['count']=_0x4869d7;if(_0x39eac7['query'][_0x37ad('0x56')]){_0x4efb85[_0x37ad('0x57')]=[{'all':!![]}];}return db[_0x37ad('0x6e')][_0x37ad('0x58')](_0x4efb85);})['then'](function(_0x52b953){_0x3dbce7[_0x37ad('0x59')]=_0x52b953;return _0x3dbce7;});}})[_0x37ad('0x1f')](respondWithFilteredResult(_0x2c08a6,_0x4efb85))[_0x37ad('0x5c')](handleError(_0x2c08a6,null));};exports[_0x37ad('0x70')]=function(_0x46fc50,_0x5326bd,_0x188550){return db['OpenchannelAccount'][_0x37ad('0x5b')]({'where':{'id':_0x46fc50['params']['id']}})['then'](handleEntityNotFound(_0x5326bd,null))['then'](function(_0x1614c5){if(_0x1614c5){return _0x1614c5[_0x37ad('0x70')](_0x46fc50[_0x37ad('0x44')][_0x37ad('0x6c')]);}})['then'](respondWithStatusCode(_0x5326bd,null))[_0x37ad('0x5c')](handleError(_0x5326bd,null));};exports['notify']=function(_0x28ca1e,_0x117118,_0x5bfb13){var _0x5d6455={'body':_0x28ca1e[_0x37ad('0x5e')],'channel':_0x37ad('0x71')};var _0x12193d=[];var _0x113e6e=[];var _0x14b172={};var _0x1048e0=![];return db[_0x37ad('0x72')][_0x37ad('0x66')]()[_0x37ad('0x1f')](function(_0x2087d1){if(!_0x2087d1){throw new db[(_0x37ad('0x73'))][(_0x37ad('0x74'))](_0x37ad('0x75'));}_0x12193d=_[_0x37ad('0x76')](_[_0x37ad('0x45')](_0x2087d1),[_0x37ad('0x77'),_0x37ad('0x78')]);_0x113e6e=_[_0x37ad('0x76')](_['keys'](_0x2087d1),[_0x37ad('0x77'),_0x37ad('0x78'),_0x37ad('0x79'),_0x37ad('0x7a')]);if(_0x28ca1e['body']['id']){delete _0x28ca1e['body']['id'];}if(_['isNil'](_0x28ca1e['body'][_0x37ad('0x7b')])){throw new db[(_0x37ad('0x73'))][(_0x37ad('0x74'))]('from\x20is\x20mandatory');}if(_[_0x37ad('0x7c')](_0x28ca1e['body'][_0x37ad('0x5e')])||_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x5e')]===''){throw new db['Sequelize'][(_0x37ad('0x74'))](_0x37ad('0x7d'));}if(_['isNil'](_0x28ca1e['body'][_0x37ad('0x7e')])){throw new db[(_0x37ad('0x73'))][(_0x37ad('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x113e6e);}if(!_[_0x37ad('0x7f')](_0x113e6e,_0x28ca1e[_0x37ad('0x5e')]['mapKey'])){throw new db[(_0x37ad('0x73'))][(_0x37ad('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x113e6e);}_0x14b172[_0x28ca1e[_0x37ad('0x5e')]['mapKey']]=_0x28ca1e[_0x37ad('0x5e')]['from'];})[_0x37ad('0x1f')](function(){return db[_0x37ad('0x40')][_0x37ad('0x5b')]({'where':{'id':_0x28ca1e[_0x37ad('0x5a')]['id']},'include':[{'model':db[_0x37ad('0x80')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x14b172,'limit':0x1,'order':[[_0x37ad('0x78'),_0x37ad('0x81')]]}]},{'model':db[_0x37ad('0x82')],'as':_0x37ad('0x83')}]});})[_0x37ad('0x1f')](handleEntityNotFound(_0x117118,null))[_0x37ad('0x1f')](function(_0x6a112b){if(_0x6a112b&&_0x6a112b[_0x37ad('0x84')]){_0x5d6455['account']=_0x6a112b;_0x5d6455[_0x37ad('0x85')]=_0x6a112b[_0x37ad('0x83')];_0x5d6455[_0x37ad('0x86')]=_0x6a112b['List'];_0x5d6455[_0x37ad('0x85')]=_[_0x37ad('0x87')](_0x5d6455[_0x37ad('0x85')],[_0x37ad('0x88')],['asc']);if(_0x5d6455[_0x37ad('0x89')][_0x37ad('0x83')]){delete _0x5d6455[_0x37ad('0x89')][_0x37ad('0x83')];}if(_0x5d6455[_0x37ad('0x89')][_0x37ad('0x84')]&&_0x5d6455[_0x37ad('0x89')][_0x37ad('0x84')][_0x37ad('0x8a')][_0x37ad('0x4a')]){return _0x5d6455[_0x37ad('0x89')]['List'][_0x37ad('0x8a')][0x0];}var _0x4c4df7=_[_0x37ad('0x17')](_0x28ca1e[_0x37ad('0x5e')],{'firstName':_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x7b')],'ListId':_0x6a112b[_0x37ad('0x7a')]});_0x4c4df7[_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x7e')]]=_0x28ca1e['body']['from'];return db[_0x37ad('0x72')][_0x37ad('0x5d')](_0x4c4df7,{'fields':_0x12193d,'raw':!![]});}})[_0x37ad('0x1f')](handleEntityNotFound(_0x117118,null))[_0x37ad('0x1f')](function(_0x10f5c0){_0x5d6455[_0x37ad('0x8b')]=_0x10f5c0;if(_0x10f5c0){var _0xbb013f={'ContactId':_0x10f5c0['id'],'OpenchannelAccountId':_0x28ca1e[_0x37ad('0x5a')]['id'],'from':(_0x10f5c0[_0x37ad('0x8c')]||'')+'\x20'+(_0x10f5c0[_0x37ad('0x8d')]||'')};var _0x5d518f={'OpenchannelAccountId':_0x28ca1e[_0x37ad('0x5a')]['id'],'closed':![]};if(_0x28ca1e['body'][_0x37ad('0x8e')]){_0x5d518f[_0x37ad('0x8e')]=_0x28ca1e['body']['threadId'];return db[_0x37ad('0x8f')][_0x37ad('0x5b')]({'where':_0x5d518f})['then'](function(_0x4d8d29){if(_0x4d8d29){return[_0x4d8d29,![]];}_0xbb013f[_0x37ad('0x8e')]=_0x28ca1e[_0x37ad('0x5e')]['threadId'];_0xbb013f[_0x37ad('0x90')]=_0x28ca1e['body']['externalUrl'];return db[_0x37ad('0x8f')][_0x37ad('0x5d')](_0xbb013f)['then'](function(_0x310ecd){return[_0x310ecd,!![]];});});}else{_0x5d518f['threadId']=null;}_0x5d518f['ContactId']=_0x10f5c0['id'];return db['OpenchannelInteraction'][_0x37ad('0x5b')]({'where':_0x5d518f})[_0x37ad('0x1f')](function(_0x395c0a){if(_0x395c0a){return[_0x395c0a,![]];}return db[_0x37ad('0x8f')][_0x37ad('0x5d')](_0xbb013f)['then'](function(_0x443ddb){return[_0x443ddb,!![]];});});}})[_0x37ad('0x91')](function(_0x1cbbe9,_0x504be0){if(_0x1cbbe9){_0x1048e0=_0x504be0;if(!_0x504be0){var _0x13670b={'from':(_0x5d6455[_0x37ad('0x8b')][_0x37ad('0x8c')]||'')+'\x20'+(_0x5d6455[_0x37ad('0x8b')][_0x37ad('0x8d')]||'')};if(_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x8e')]&&_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x92')]&&_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x8e')]!=_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x92')]){_0x13670b[_0x37ad('0x8e')]=_0x28ca1e[_0x37ad('0x5e')][_0x37ad('0x92')];}return _0x1cbbe9[_0x37ad('0x34')](_0x13670b);}else{return _0x1cbbe9;}}})[_0x37ad('0x1f')](function(_0x330158){_0x5d6455[_0x37ad('0x93')]=_0x330158['get']({'plain':!![]});_0x5d6455['interaction'][_0x37ad('0x94')]=_0x1048e0;if(_0x5d6455[_0x37ad('0x93')][_0x37ad('0x94')]){if(_0x5d6455['account'][_0x37ad('0x95')]){_0x5d6455['applications'][_0x37ad('0x96')]({'id':0x0,'priority':_0x5d6455[_0x37ad('0x85')][_0x37ad('0x4a')]+0x1,'app':_0x37ad('0x97'),'appdata':_0x37ad('0x98'),'interval':_0x37ad('0x99')});}}return db['OpenchannelMessage'][_0x37ad('0x5d')]({'body':_0x28ca1e['body'][_0x37ad('0x5e')],'OpenchannelAccountId':_0x28ca1e['params']['id'],'OpenchannelInteractionId':_0x330158['id'],'direction':'in','ContactId':_0x5d6455[_0x37ad('0x8b')]['id'],'AttachmentId':_0x28ca1e[_0x37ad('0x5e')]['AttachmentId']});})[_0x37ad('0x1f')](function(_0x4239ce){_0x5d6455['message']=_0x4239ce;if(!_0x5d6455[_0x37ad('0x93')][_0x37ad('0x9a')])return;return db['User'][_0x37ad('0x5b')]({'attributes':['id',_0x37ad('0x3b')],'where':{'id':_0x5d6455[_0x37ad('0x93')][_0x37ad('0x9a')]}});})['then'](function(_0x3a4405){if(_0x3a4405){_0x5d6455[_0x37ad('0x85')][_0x37ad('0x9b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3a4405[_0x37ad('0x3b')]+','+(_0x5d6455['account'][_0x37ad('0x9c')]||0xa),'interval':'*,*,*,*'});}if(!_0x5d6455['interaction'][_0x37ad('0x9d')])return;return db[_0x37ad('0x9e')][_0x37ad('0x5b')]({'attributes':['id',_0x37ad('0x3b')],'where':{'id':_0x5d6455[_0x37ad('0x93')][_0x37ad('0x9d')]}});})[_0x37ad('0x1f')](function(_0x424131){if(_0x424131){_0x5d6455[_0x37ad('0x85')][_0x37ad('0x9b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x424131['name']+','+(_0x5d6455[_0x37ad('0x89')]['waitForTheAssignedQueue']||0x12c),'interval':_0x37ad('0x99')});}return respondWithRpcPromise('Start',_0x37ad('0x9f'),_0x5d6455);})[_0x37ad('0x1f')](function(_0x4f8380){respondWithRpcPromise(_0x37ad('0xa0'),_0x37ad('0xa0'),{'event':'notify','message':_0x4f8380},client9002);return _0x4f8380;})[_0x37ad('0x1f')](respondWithResult(_0x117118,null))[_0x37ad('0x5c')](handleError(_0x117118,null));};exports['addApplications']=function(_0x3c28f4,_0x3822fa){var _0x2d54bd=_0x3c28f4[_0x37ad('0x5a')]['id'];var _0x504752=_0x3c28f4[_0x37ad('0x5e')];var _0x420a5b=0xc8;var _0x4becff=null;return db[_0x37ad('0xa1')][_0x37ad('0xa2')]({'isolationLevel':db[_0x37ad('0xa1')][_0x37ad('0xa3')]['ISOLATION_LEVELS'][_0x37ad('0xa4')]},function(_0x263124){return db[_0x37ad('0x40')][_0x37ad('0x68')]({'where':{'id':_0x2d54bd},'transaction':_0x263124})[_0x37ad('0x1f')](function(_0x56c398){if(_0x56c398){return db[_0x37ad('0x82')]['destroy']({'where':{'OpenchannelAccountId':_0x2d54bd},'transaction':_0x263124})[_0x37ad('0x1f')](function(){var _0x3d5e21=_[_0x37ad('0x3f')](_0x504752,function(_0xa65438){_0xa65438['OpenchannelAccountId']=_0x2d54bd;return _0xa65438;});return db[_0x37ad('0x82')][_0x37ad('0xa5')](_0x3d5e21,{'transaction':_0x263124});});}else{_0x420a5b=0x194;_0x4becff=[];}});})['then'](function(){if(_0x420a5b!==0x194){return db[_0x37ad('0x82')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2d54bd},'order':_0x37ad('0x88')})[_0x37ad('0x1f')](function(_0x2a7d57){_0x4becff=_0x2a7d57;});}})[_0x37ad('0x5c')](function(_0x4d2c37){_0x420a5b=0x1f4;logger[_0x37ad('0x24')](_0x4d2c37[_0x37ad('0x3a')]);if(_0x4d2c37[_0x37ad('0x3b')]){delete _0x4d2c37[_0x37ad('0x3b')];}_0x4becff=_0x4d2c37;})[_0x37ad('0xa6')](function(){if(_0x4becff===null){_0x3822fa['sendStatus'](_0x420a5b);}else{if(_0x420a5b===0x1f4){_0x3822fa[_0x37ad('0x29')](_0x420a5b)['send'](_0x4becff);}else{_0x3822fa[_0x37ad('0x29')](_0x420a5b)[_0x37ad('0x2b')](_0x4becff);}}});};exports[_0x37ad('0xa7')]=function(_0x282ab7,_0x1d729a,_0x95f707){var _0x1c2ff5={};var _0x8424aa={};var _0x3b8656;var _0x7f7659;return db['OpenchannelAccount'][_0x37ad('0x68')]({'where':{'id':_0x282ab7[_0x37ad('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1d729a,null))[_0x37ad('0x1f')](function(_0x27dbcd){if(_0x27dbcd){_0x3b8656=_0x27dbcd;_0x8424aa[_0x37ad('0x43')]=_[_0x37ad('0x45')](db[_0x37ad('0x82')]['rawAttributes']);_0x8424aa[_0x37ad('0x44')]=_['keys'](_0x282ab7[_0x37ad('0x44')]);_0x8424aa['filters']=_[_0x37ad('0x47')](_0x8424aa[_0x37ad('0x43')],_0x8424aa[_0x37ad('0x44')]);_0x1c2ff5[_0x37ad('0x48')]=_['intersection'](_0x8424aa[_0x37ad('0x43')],qs[_0x37ad('0x49')](_0x282ab7['query'][_0x37ad('0x49')]));_0x1c2ff5[_0x37ad('0x48')]=_0x1c2ff5[_0x37ad('0x48')][_0x37ad('0x4a')]?_0x1c2ff5['attributes']:_0x8424aa['model'];_0x1c2ff5['order']=qs[_0x37ad('0x4e')](_0x282ab7[_0x37ad('0x44')][_0x37ad('0x4e')]);_0x1c2ff5[_0x37ad('0x4f')]=qs['filters'](_[_0x37ad('0x50')](_0x282ab7[_0x37ad('0x44')],_0x8424aa[_0x37ad('0x46')]));if(_0x282ab7[_0x37ad('0x44')][_0x37ad('0x51')]){_0x1c2ff5[_0x37ad('0x4f')]=_['merge'](_0x1c2ff5[_0x37ad('0x4f')],{'$or':_['map'](_0x1c2ff5[_0x37ad('0x48')],function(_0x314d4f){var _0x1369e0={};_0x1369e0[_0x314d4f]={'$like':'%'+_0x282ab7[_0x37ad('0x44')][_0x37ad('0x51')]+'%'};return _0x1369e0;})});}_0x1c2ff5=_[_0x37ad('0x52')]({},_0x1c2ff5,_0x282ab7['options']);return _0x3b8656[_0x37ad('0xa7')](_0x1c2ff5);}})[_0x37ad('0x1f')](function(_0x2ea9bb){if(_0x2ea9bb){_0x7f7659=_0x2ea9bb[_0x37ad('0x4a')];if(!_0x282ab7[_0x37ad('0x44')][_0x37ad('0x4b')](_0x37ad('0x4c'))){_0x1c2ff5[_0x37ad('0x2d')]=qs[_0x37ad('0x2d')](_0x282ab7['query']['limit']);_0x1c2ff5[_0x37ad('0x2c')]=qs[_0x37ad('0x2c')](_0x282ab7[_0x37ad('0x44')][_0x37ad('0x2c')]);}return _0x3b8656[_0x37ad('0xa7')](_0x1c2ff5);}})[_0x37ad('0x1f')](function(_0x2f7304){if(_0x2f7304){return _0x2f7304?{'count':_0x7f7659,'rows':_0x2f7304}:null;}})[_0x37ad('0x1f')](respondWithResult(_0x1d729a,null))['catch'](handleError(_0x1d729a,null));};exports[_0x37ad('0xa8')]=function(_0x4b0d4e,_0x3b2659,_0xbd4cfa){var _0x3d6dab={'raw':![],'where':{}};var _0x2313cf={};var _0x4b6b42={'count':0x0,'rows':[]};return db[_0x37ad('0x40')][_0x37ad('0x68')]({'where':{'id':_0x4b0d4e['params']['id']}})[_0x37ad('0x1f')](handleEntityNotFound(_0x3b2659,null))[_0x37ad('0x1f')](function(_0x222654){if(_0x222654){_0x2313cf[_0x37ad('0x43')]=_['keys'](db[_0x37ad('0x8f')][_0x37ad('0x41')]);_0x2313cf[_0x37ad('0x44')]=_[_0x37ad('0x45')](_0x4b0d4e[_0x37ad('0x44')]);_0x2313cf[_0x37ad('0x46')]=_['intersection'](_0x2313cf[_0x37ad('0x43')],_0x2313cf[_0x37ad('0x44')]);_0x3d6dab['attributes']=_[_0x37ad('0x47')](_0x2313cf[_0x37ad('0x43')],qs[_0x37ad('0x49')](_0x4b0d4e[_0x37ad('0x44')][_0x37ad('0x49')]));_0x3d6dab[_0x37ad('0x48')]=_0x3d6dab['attributes']['length']?_0x3d6dab[_0x37ad('0x48')]:_0x2313cf[_0x37ad('0x43')];if(!_0x4b0d4e[_0x37ad('0x44')][_0x37ad('0x4b')](_0x37ad('0x4c'))){_0x3d6dab[_0x37ad('0x2d')]=qs[_0x37ad('0x2d')](_0x4b0d4e['query']['limit']);_0x3d6dab[_0x37ad('0x2c')]=qs[_0x37ad('0x2c')](_0x4b0d4e[_0x37ad('0x44')][_0x37ad('0x2c')]);}_0x3d6dab[_0x37ad('0x4d')]=qs[_0x37ad('0x4e')](_0x4b0d4e[_0x37ad('0x44')][_0x37ad('0x4e')]);_0x3d6dab['where']=qs['filters'](_[_0x37ad('0x50')](_0x4b0d4e[_0x37ad('0x44')],_0x2313cf[_0x37ad('0x46')]));_0x3d6dab['where']['OpenchannelAccountId']=_0x222654['id'];if(_0x4b0d4e[_0x37ad('0x44')]['filter']){_0x3d6dab[_0x37ad('0x4f')]=_[_0x37ad('0x52')](_0x3d6dab['where'],{'$or':_['map'](_0x3d6dab[_0x37ad('0x48')],function(_0x5d2f8f){var _0x5ccd34={};_0x5ccd34[_0x5d2f8f]={'$like':'%'+_0x4b0d4e[_0x37ad('0x44')][_0x37ad('0x51')]+'%'};return _0x5ccd34;})});}_0x3d6dab=_[_0x37ad('0x52')]({},_0x3d6dab,_0x4b0d4e['options']);return db['OpenchannelInteraction'][_0x37ad('0x2f')]({'where':_0x3d6dab['where']})[_0x37ad('0x1f')](function(_0x543c5c){_0x4b6b42[_0x37ad('0x2f')]=_0x543c5c;if(_0x4b0d4e[_0x37ad('0x44')]['includeAll']){_0x3d6dab[_0x37ad('0x57')]=[{'model':db[_0x37ad('0x72')],'as':_0x37ad('0xa9'),'required':![]},{'model':db[_0x37ad('0xaa')],'as':_0x37ad('0xab'),'attributes':[_0x37ad('0x3b'),'fullname',_0x37ad('0xac')],'required':![]},{'model':db[_0x37ad('0xad')],'as':'Tags','attributes':['id',_0x37ad('0x3b'),_0x37ad('0xae')],'where':_0x4b0d4e['query']['tag']?{'id':_0x4b0d4e[_0x37ad('0x44')][_0x37ad('0xaf')]}:undefined,'required':_0x4b0d4e[_0x37ad('0x44')][_0x37ad('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x37ad('0x58')](_0x3d6dab);})[_0x37ad('0x1f')](function(_0x50a3b1){_0x4b6b42['rows']=_0x50a3b1;return _0x4b6b42;});}})[_0x37ad('0x1f')](respondWithFilteredResult(_0x3b2659,_0x3d6dab))[_0x37ad('0x5c')](handleError(_0x3b2659,null));};exports[_0x37ad('0xb0')]=function(_0x2ac2d0,_0x2977f7,_0x4dcc68){return db[_0x37ad('0x40')][_0x37ad('0x5b')]({'where':{'id':_0x2ac2d0[_0x37ad('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2977f7,null))[_0x37ad('0x1f')](function(_0x264562){if(_0x264562){return _0x264562[_0x37ad('0xb0')](_0x2ac2d0[_0x37ad('0x5e')][_0x37ad('0x6c')],_['omit'](_0x2ac2d0[_0x37ad('0x5e')],[_0x37ad('0x6c'),'id'])||{})[_0x37ad('0x91')](function(_0x3f8499){for(var _0x3a11d1=0x0;_0x3a11d1<_0x2ac2d0[_0x37ad('0x5e')][_0x37ad('0x6c')]['length'];_0x3a11d1+=0x1){socket['emit'](_0x37ad('0xb1'),{'UserId':Number(_0x2ac2d0['body'][_0x37ad('0x6c')][_0x3a11d1]),'OpenchannelAccountId':Number(_0x2ac2d0['params']['id'])});}return _0x3f8499;});}})['then'](respondWithResult(_0x2977f7,null))[_0x37ad('0x5c')](handleError(_0x2977f7,null));};exports[_0x37ad('0xb2')]=function(_0x21d2a1,_0xb45897,_0xef98cb){return db[_0x37ad('0x40')]['find']({'where':{'id':_0x21d2a1[_0x37ad('0x5a')]['id']}})[_0x37ad('0x1f')](handleEntityNotFound(_0xb45897,null))[_0x37ad('0x1f')](function(_0x6bb1d7){if(_0x6bb1d7){return _0x6bb1d7[_0x37ad('0xb2')](_0x21d2a1['query']['ids'])['then'](function(){if(_[_0x37ad('0xb3')](_0x21d2a1[_0x37ad('0x44')][_0x37ad('0x6c')])){for(var _0x38e033=0x0;_0x38e033<_0x21d2a1[_0x37ad('0x44')]['ids'][_0x37ad('0x4a')];_0x38e033+=0x1){socket['emit'](_0x37ad('0xb4'),{'UserId':Number(_0x21d2a1[_0x37ad('0x44')][_0x37ad('0x6c')][_0x38e033]),'OpenchannelAccountId':Number(_0x21d2a1[_0x37ad('0x5a')]['id'])});}}else{socket[_0x37ad('0xb5')](_0x37ad('0xb4'),{'UserId':Number(_0x21d2a1[_0x37ad('0x44')][_0x37ad('0x6c')]),'OpenchannelAccountId':Number(_0x21d2a1[_0x37ad('0x5a')]['id'])});}});}})[_0x37ad('0x1f')](respondWithStatusCode(_0xb45897,null))[_0x37ad('0x5c')](handleError(_0xb45897,null));};exports[_0x37ad('0xb6')]=function(_0xf309cb,_0x1fdc80,_0x17db3f){var _0x4833f7={};var _0x341d24={};var _0x357bbb;var _0x417acd;return db[_0x37ad('0x40')][_0x37ad('0x68')]({'where':{'id':_0xf309cb[_0x37ad('0x5a')]['id']}})[_0x37ad('0x1f')](handleEntityNotFound(_0x1fdc80,null))[_0x37ad('0x1f')](function(_0x494206){if(_0x494206){_0x357bbb=_0x494206;_0x341d24[_0x37ad('0x43')]=_[_0x37ad('0x45')](db[_0x37ad('0xaa')]['rawAttributes']);_0x341d24[_0x37ad('0x44')]=_[_0x37ad('0x45')](_0xf309cb['query']);_0x341d24[_0x37ad('0x46')]=_[_0x37ad('0x47')](_0x341d24['model'],_0x341d24['query']);_0x4833f7['attributes']=_[_0x37ad('0x47')](_0x341d24[_0x37ad('0x43')],qs['fields'](_0xf309cb[_0x37ad('0x44')][_0x37ad('0x49')]));_0x4833f7[_0x37ad('0x48')]=_0x4833f7[_0x37ad('0x48')][_0x37ad('0x4a')]?_0x4833f7[_0x37ad('0x48')]:_0x341d24[_0x37ad('0x43')];_0x4833f7[_0x37ad('0x4d')]=qs['sort'](_0xf309cb[_0x37ad('0x44')][_0x37ad('0x4e')]);_0x4833f7[_0x37ad('0x4f')]=qs['filters'](_[_0x37ad('0x50')](_0xf309cb[_0x37ad('0x44')],_0x341d24[_0x37ad('0x46')]));if(_0xf309cb[_0x37ad('0x44')]['filter']){_0x4833f7[_0x37ad('0x4f')]=_['merge'](_0x4833f7[_0x37ad('0x4f')],{'$or':_[_0x37ad('0x3f')](_0x4833f7['attributes'],function(_0x2d5847){var _0x27c915={};_0x27c915[_0x2d5847]={'$like':'%'+_0xf309cb[_0x37ad('0x44')]['filter']+'%'};return _0x27c915;})});}_0x4833f7=_[_0x37ad('0x52')]({},_0x4833f7,_0xf309cb[_0x37ad('0x55')]);return _0x357bbb[_0x37ad('0xb6')](_0x4833f7);}})[_0x37ad('0x1f')](function(_0x34d37a){if(_0x34d37a){_0x417acd=_0x34d37a[_0x37ad('0x4a')];if(!_0xf309cb[_0x37ad('0x44')][_0x37ad('0x4b')](_0x37ad('0x4c'))){_0x4833f7[_0x37ad('0x2d')]=qs[_0x37ad('0x2d')](_0xf309cb[_0x37ad('0x44')][_0x37ad('0x2d')]);_0x4833f7[_0x37ad('0x2c')]=qs[_0x37ad('0x2c')](_0xf309cb['query'][_0x37ad('0x2c')]);}return _0x357bbb[_0x37ad('0xb6')](_0x4833f7);}})[_0x37ad('0x1f')](function(_0x690b10){if(_0x690b10){return _0x690b10?{'count':_0x417acd,'rows':_0x690b10}:null;}})[_0x37ad('0x1f')](respondWithResult(_0x1fdc80,null))[_0x37ad('0x5c')](handleError(_0x1fdc80,null));};exports[_0x37ad('0xb7')]=function(_0x21ae4d,_0x3d868e,_0x45bd45){var _0x372188,_0x5ac3a3,_0x59b38c;if(_[_0x37ad('0x7c')](_0x21ae4d[_0x37ad('0x5e')]['body'])||_0x21ae4d[_0x37ad('0x5e')][_0x37ad('0x5e')]===''){throw new db[(_0x37ad('0x73'))][(_0x37ad('0x74'))](_0x37ad('0x7d'));}if(_['isNil'](_0x21ae4d[_0x37ad('0x5e')]['to'])){}_0x372188=_0x21ae4d[_0x37ad('0x5e')]['to'];return db['OpenchannelAccount'][_0x37ad('0x68')]({'where':{'id':_0x21ae4d[_0x37ad('0x5a')]['id']}})[_0x37ad('0x1f')](handleEntityNotFound(_0x3d868e,null))[_0x37ad('0x1f')](function(_0x27be6b){if(_0x27be6b){return db[_0x37ad('0x40')]['find']({'where':{'id':_0x27be6b['id']},'include':[{'model':db[_0x37ad('0x80')],'as':_0x37ad('0x84'),'include':[{'model':db['CmContact'],'as':_0x37ad('0x8a'),'where':{[_0x27be6b['mapKey']]:_0x372188},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x37ad('0x1f')](handleEntityNotFound(_0x3d868e,null))[_0x37ad('0x1f')](function(_0x4faea0){if(_0x4faea0&&_0x4faea0['List']){_0x5ac3a3=_0x4faea0[_0x37ad('0x35')]({'plain':!![]});if(_0x5ac3a3[_0x37ad('0x84')]&&_0x5ac3a3[_0x37ad('0x84')][_0x37ad('0x8a')][_0x37ad('0x4a')]){return _0x5ac3a3['List'][_0x37ad('0x8a')][0x0];}return db['CmContact'][_0x37ad('0x5d')](_[_0x37ad('0x17')](_0x21ae4d['body'],{'firstName':_0x372188,[_0x4faea0['mapKey']]:_0x372188,'phone':_0x372188,'ListId':_0x5ac3a3['ListId']}));}})[_0x37ad('0x1f')](handleEntityNotFound(_0x3d868e,null))['then'](function(_0x5878f5){if(_0x5878f5){_0x59b38c=_0x5878f5;return db[_0x37ad('0x8f')][_0x37ad('0x5b')]({'where':{'ContactId':_0x59b38c['id'],'closed':![],'OpenchannelAccountId':_0x5ac3a3['id']}})[_0x37ad('0x1f')](function(_0x23ba6a){if(_0x23ba6a){return[_0x23ba6a,![]];}return db[_0x37ad('0x8f')][_0x37ad('0x5d')]({'UserId':_0x21ae4d[_0x37ad('0x61')]['id'],'ContactId':_0x59b38c['id'],'OpenchannelAccountId':_0x5ac3a3['id'],'lastMsgDirection':'out','firstMsgDirection':_0x37ad('0xb8'),'Messages':[_[_0x37ad('0x52')](_0x21ae4d['body'],{'read':![],'body':_0x21ae4d[_0x37ad('0x5e')][_0x37ad('0x5e')],'OpenchannelAccountId':_0x5ac3a3['id'],'UserId':_0x21ae4d[_0x37ad('0x61')]['id'],'ContactId':_0x59b38c['id']})]},{'include':[{'model':db[_0x37ad('0xb9')],'as':_0x37ad('0xba')}]})['then'](function(_0x1a57f0){return[_0x1a57f0,!![]];});});}})[_0x37ad('0x91')](function(_0x4facd4,_0x4f684d){if(_0x4f684d){return _0x4facd4;}return db[_0x37ad('0xb9')]['create'](_[_0x37ad('0x52')](_0x21ae4d[_0x37ad('0x5e')],{'read':![],'body':_0x21ae4d['body'][_0x37ad('0x5e')],'OpenchannelAccountId':_0x5ac3a3['id'],'OpenchannelInteractionId':_0x4facd4['id'],'UserId':_0x21ae4d[_0x37ad('0x61')]['id'],'ContactId':_0x59b38c['id']}))[_0x37ad('0x1f')](function(_0x4dcf39){_0x4facd4[_0x37ad('0xbb')]['Messages']=[];_0x4facd4[_0x37ad('0xbb')][_0x37ad('0xba')]['push'](_0x4dcf39['dataValues']);return _0x4facd4;});});}})[_0x37ad('0x1f')](respondWithResult(_0x3d868e,null))[_0x37ad('0x5c')](handleError(_0x3d868e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index fe9bdfa..4edb80a 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 _0xb58b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x484930,_0x2353f5){var _0x3b33da=function(_0x5d3da7){while(--_0x5d3da7){_0x484930['push'](_0x484930['shift']());}};_0x3b33da(++_0x2353f5);}(_0xb58b,0x1f1));var _0xbb58=function(_0x572a50,_0x44e294){_0x572a50=_0x572a50-0x0;var _0x25b39d=_0xb58b[_0x572a50];return _0x25b39d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb58('0x3'),'afterDestroy':_0xbb58('0x4')};function emitEvent(_0x5c9ec5){return function(_0x226363,_0x546510,_0x2edb10){OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5+':'+_0x226363['id'],_0x226363);OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5,_0x226363);_0x2edb10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xbb58('0x6')](e,emitEvent(event));}}module[_0xbb58('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x55e0=['remove','emit','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x51b169,_0x5efbc2){var _0x12605a=function(_0x570f5e){while(--_0x570f5e){_0x51b169['push'](_0x51b169['shift']());}};_0x12605a(++_0x5efbc2);}(_0x55e0,0xdc));var _0x055e=function(_0x4ade17,_0x1bff9b){_0x4ade17=_0x4ade17-0x0;var _0x3e4bb9=_0x55e0[_0x4ade17];return _0x3e4bb9;};'use strict';var EventEmitter=require(_0x055e('0x0'));var OpenchannelAccount=require(_0x055e('0x1'))['db'][_0x055e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x055e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x055e('0x4')};function emitEvent(_0x2d9bd5){return function(_0x33cd7b,_0x2773e4,_0x157473){OpenchannelAccountEvents[_0x055e('0x5')](_0x2d9bd5+':'+_0x33cd7b['id'],_0x33cd7b);OpenchannelAccountEvents['emit'](_0x2d9bd5,_0x33cd7b);_0x157473(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x055e('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 212d8b1..496806f 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(_0x3f7d12,_0x2b0ee7){var _0x512948=function(_0x1f79d8){while(--_0x1f79d8){_0x3f7d12['push'](_0x3f7d12['shift']());}};_0x512948(++_0x2b0ee7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x237632,_0x4231da){var _0x48d414=function(_0x416486){while(--_0x416486){_0x237632['push'](_0x237632['shift']());}};_0x48d414(++_0x4231da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));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 d8ade05..d3aa9bc 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 _0xbfcc=['redis','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xbfcc[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});config[_0xcbfc('0x7')]=_['defaults'](config[_0xcbfc('0x7')],{'host':_0xcbfc('0x8'),'port':0x18eb});var socket=require(_0xcbfc('0x9'))(new Redis(config[_0xcbfc('0x7')]));require('./openchannelAccount.socket')[_0xcbfc('0xa')](socket);function respondWithRpcPromise(_0x3be6f9,_0x36bdb8,_0x25786f){return new BPromise(function(_0x20c7c6,_0x3498c7){return client['request'](_0x3be6f9,_0x25786f)[_0xcbfc('0xb')](function(_0x376a4c){logger[_0xcbfc('0xc')](_0xcbfc('0xd'),_0x36bdb8,_0xcbfc('0xe'));logger['debug'](_0xcbfc('0xf'),_0x36bdb8,_0xcbfc('0xe'),JSON[_0xcbfc('0x10')](_0x376a4c));if(_0x376a4c['error']){if(_0x376a4c[_0xcbfc('0x11')][_0xcbfc('0x12')]===0x1f4){logger[_0xcbfc('0x11')](_0xcbfc('0xd'),_0x36bdb8,_0x376a4c[_0xcbfc('0x11')]['message']);return _0x3498c7(_0x376a4c[_0xcbfc('0x11')][_0xcbfc('0x13')]);}logger[_0xcbfc('0x11')](_0xcbfc('0xd'),_0x36bdb8,_0x376a4c['error']['message']);return _0x20c7c6(_0x376a4c[_0xcbfc('0x11')][_0xcbfc('0x13')]);}else{logger[_0xcbfc('0xc')]('OpenchannelAccount,\x20%s,\x20%s',_0x36bdb8,'request\x20sent');_0x20c7c6(_0x376a4c[_0xcbfc('0x14')][_0xcbfc('0x13')]);}})[_0xcbfc('0x15')](function(_0x4beb87){logger[_0xcbfc('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x36bdb8,_0x4beb87);_0x3498c7(_0x4beb87);});});} \ No newline at end of file +var _0x2884=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x501099,_0x223250){var _0x555ebf=function(_0x4139ab){while(--_0x4139ab){_0x501099['push'](_0x501099['shift']());}};_0x555ebf(++_0x223250);}(_0x2884,0x1eb));var _0x4288=function(_0x18920a,_0x5c7896){_0x18920a=_0x18920a-0x0;var _0x5b48a2=_0x2884[_0x18920a];return _0x5b48a2;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4288('0x9')](config['redis'],{'host':_0x4288('0xa'),'port':0x18eb});var socket=require(_0x4288('0xb'))(new Redis(config['redis']));require(_0x4288('0xc'))[_0x4288('0xd')](socket);function respondWithRpcPromise(_0x41794a,_0x55c9ee,_0x55a4f7){return new BPromise(function(_0x5c0e2d,_0x42a234){return client[_0x4288('0xe')](_0x41794a,_0x55a4f7)[_0x4288('0xf')](function(_0x2445eb){logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');logger[_0x4288('0x12')](_0x4288('0x13'),_0x55c9ee,_0x4288('0x14'),JSON[_0x4288('0x15')](_0x2445eb));if(_0x2445eb['error']){if(_0x2445eb[_0x4288('0x16')][_0x4288('0x17')]===0x1f4){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x2445eb['error'][_0x4288('0x18')]);return _0x42a234(_0x2445eb['error'][_0x4288('0x18')]);}logger[_0x4288('0x16')](_0x4288('0x11'),_0x55c9ee,_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);return _0x5c0e2d(_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);}else{logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');_0x5c0e2d(_0x2445eb[_0x4288('0x19')][_0x4288('0x18')]);}})['catch'](function(_0x479d52){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x479d52);_0x42a234(_0x479d52);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2666187..3989262 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 _0x9086=['emit','removeListener','length','./openchannelAccount.events','save','update'];(function(_0xe38d39,_0x506c68){var _0x4a9882=function(_0xb0036){while(--_0xb0036){_0xe38d39['push'](_0xe38d39['shift']());}};_0x4a9882(++_0x506c68);}(_0x9086,0x10b));var _0x6908=function(_0x49b71c,_0x343fed){_0x49b71c=_0x49b71c-0x0;var _0x231b46=_0x9086[_0x49b71c];return _0x231b46;};'use strict';var OpenchannelAccountEvents=require(_0x6908('0x0'));var events=[_0x6908('0x1'),'remove',_0x6908('0x2')];function createListener(_0x3f95e4,_0x38d58b){return function(_0x230e29){_0x38d58b[_0x6908('0x3')](_0x3f95e4,_0x230e29);};}function removeListener(_0x1a49e1,_0x4b8a45){return function(){OpenchannelAccountEvents[_0x6908('0x4')](_0x1a49e1,_0x4b8a45);};}exports['register']=function(_0x578f7a){for(var _0xecf3b7=0x0,_0x4e8ff0=events[_0x6908('0x5')];_0xecf3b7<_0x4e8ff0;_0xecf3b7++){var _0x2049a1=events[_0xecf3b7];var _0x2ce577=createListener('openchannelAccount:'+_0x2049a1,_0x578f7a);OpenchannelAccountEvents['on'](_0x2049a1,_0x2ce577);}}; \ No newline at end of file +var _0xbb95=['openchannelAccount:','./openchannelAccount.events','save','emit','register','length'];(function(_0x11d69e,_0x50de1c){var _0x5eead6=function(_0xd63e84){while(--_0xd63e84){_0x11d69e['push'](_0x11d69e['shift']());}};_0x5eead6(++_0x50de1c);}(_0xbb95,0x7f));var _0x5bb9=function(_0x185aca,_0x3b01a4){_0x185aca=_0x185aca-0x0;var _0x7fb55a=_0xbb95[_0x185aca];return _0x7fb55a;};'use strict';var OpenchannelAccountEvents=require(_0x5bb9('0x0'));var events=[_0x5bb9('0x1'),'remove','update'];function createListener(_0x15492a,_0x2a9386){return function(_0x535716){_0x2a9386[_0x5bb9('0x2')](_0x15492a,_0x535716);};}function removeListener(_0x572ef3,_0x4ef42d){return function(){OpenchannelAccountEvents['removeListener'](_0x572ef3,_0x4ef42d);};}exports[_0x5bb9('0x3')]=function(_0x2b72aa){for(var _0x49b590=0x0,_0x180e69=events[_0x5bb9('0x4')];_0x49b590<_0x180e69;_0x49b590++){var _0x39f347=events[_0x49b590];var _0x5e8b1c=createListener(_0x5bb9('0x5')+_0x39f347,_0x2b72aa);OpenchannelAccountEvents['on'](_0x39f347,_0x5e8b1c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 722e178..f3701fc 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 _0xd479=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','update','delete','destroy'];(function(_0x2ea356,_0x4c373b){var _0x1439d5=function(_0x1dab2c){while(--_0x1dab2c){_0x2ea356['push'](_0x2ea356['shift']());}};_0x1439d5(++_0x4c373b);}(_0xd479,0x101));var _0x9d47=function(_0x133b8d,_0x22635f){_0x133b8d=_0x133b8d-0x0;var _0x10acbf=_0xd479[_0x133b8d];return _0x10acbf;};'use strict';var multer=require(_0x9d47('0x0'));var util=require(_0x9d47('0x1'));var path=require(_0x9d47('0x2'));var timeout=require(_0x9d47('0x3'));var express=require('express');var router=express[_0x9d47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d47('0x5'));var interaction=require(_0x9d47('0x6'));var config=require(_0x9d47('0x7'));var controller=require(_0x9d47('0x8'));router[_0x9d47('0x9')]('/',auth[_0x9d47('0xa')](),controller['index']);router[_0x9d47('0x9')](_0x9d47('0xb'),auth[_0x9d47('0xa')](),controller['show']);router['post']('/',auth[_0x9d47('0xa')](),controller['create']);router['put'](_0x9d47('0xb'),auth['isAuthenticated'](),controller[_0x9d47('0xc')]);router[_0x9d47('0xd')](_0x9d47('0xb'),auth[_0x9d47('0xa')](),controller[_0x9d47('0xe')]);module[_0x9d47('0xf')]=router; \ No newline at end of file +var _0x1ff9=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x4d88f6,_0x52f758){var _0x2041c8=function(_0x16f556){while(--_0x16f556){_0x4d88f6['push'](_0x4d88f6['shift']());}};_0x2041c8(++_0x52f758);}(_0x1ff9,0xd8));var _0x91ff=function(_0x2c1c4a,_0x26b5b2){_0x2c1c4a=_0x2c1c4a-0x0;var _0x2b7391=_0x1ff9[_0x2c1c4a];return _0x2b7391;};'use strict';var multer=require(_0x91ff('0x0'));var util=require(_0x91ff('0x1'));var path=require(_0x91ff('0x2'));var timeout=require(_0x91ff('0x3'));var express=require(_0x91ff('0x4'));var router=express[_0x91ff('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91ff('0x6'));var interaction=require(_0x91ff('0x7'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x91ff('0x8')]('/',auth[_0x91ff('0x9')](),controller[_0x91ff('0xa')]);router[_0x91ff('0x8')](_0x91ff('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x91ff('0xc')]('/',auth[_0x91ff('0x9')](),controller[_0x91ff('0xd')]);router[_0x91ff('0xe')](_0x91ff('0xb'),auth[_0x91ff('0x9')](),controller[_0x91ff('0xf')]);router[_0x91ff('0x10')](_0x91ff('0xb'),auth[_0x91ff('0x9')](),controller[_0x91ff('0x11')]);module[_0x91ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index c40a421..8cf9e9c 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 _0xde7c=['STRING','noop','TEXT','sequelize'];(function(_0x5a0e1d,_0x261edc){var _0x320dc0=function(_0x2fef8a){while(--_0x2fef8a){_0x5a0e1d['push'](_0x5a0e1d['shift']());}};_0x320dc0(++_0x261edc);}(_0xde7c,0x107));var _0xcde7=function(_0x49f0f0,_0x351603){_0x49f0f0=_0x49f0f0-0x0;var _0x1bc8aa=_0xde7c[_0x49f0f0];return _0x1bc8aa;};'use strict';var Sequelize=require(_0xcde7('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcde7('0x1')],'allowNull':![],'defaultValue':_0xcde7('0x2')},'appdata':{'type':Sequelize[_0xcde7('0x3')]()},'description':{'type':Sequelize[_0xcde7('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x09c8=['*,*,*,*','exports','TEXT','STRING'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x09c8,0x131));var _0x809c=function(_0x5ad272,_0x20be90){_0x5ad272=_0x5ad272-0x0;var _0x75eef6=_0x09c8[_0x5ad272];return _0x75eef6;};'use strict';var Sequelize=require('sequelize');module[_0x809c('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x809c('0x1')]()},'description':{'type':Sequelize[_0x809c('0x2')]},'interval':{'type':Sequelize[_0x809c('0x2')],'defaultValue':_0x809c('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 8798432..e3def4e 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 _0x4f75=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','reject','save','update','then','error','stack','name','map','OpenchannelApplication','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4f75,0xc0));var _0x54f7=function(_0x4054ac,_0x2d4af3){_0x4054ac=_0x4054ac-0x0;var _0xa75059=_0x4f75[_0x4054ac];return _0xa75059;};'use strict';var emlformat=require(_0x54f7('0x0'));var rimraf=require(_0x54f7('0x1'));var zipdir=require(_0x54f7('0x2'));var jsonpatch=require(_0x54f7('0x3'));var rp=require(_0x54f7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x54f7('0x5'));var util=require(_0x54f7('0x6'));var path=require('path');var sox=require(_0x54f7('0x7'));var csv=require('to-csv');var ejs=require(_0x54f7('0x8'));var fs=require('fs');var fs_extra=require(_0x54f7('0x9'));var _=require(_0x54f7('0xa'));var squel=require(_0x54f7('0xb'));var crypto=require(_0x54f7('0xc'));var jsforce=require(_0x54f7('0xd'));var deskjs=require(_0x54f7('0xe'));var toCsv=require(_0x54f7('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x54f7('0x10'));var authService=require(_0x54f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x54f7('0x12'));var hardwareService=require(_0x54f7('0x13'));var logger=require(_0x54f7('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x54f7('0x15'))['db'];function respondWithStatusCode(_0x177910,_0x4543d8){_0x4543d8=_0x4543d8||0xcc;return function(_0x19ef72){if(_0x19ef72){return _0x177910[_0x54f7('0x16')](_0x4543d8);}return _0x177910[_0x54f7('0x17')](_0x4543d8)[_0x54f7('0x18')]();};}function respondWithResult(_0x23c64f,_0x5c3c40){_0x5c3c40=_0x5c3c40||0xc8;return function(_0x3fc5ff){if(_0x3fc5ff){return _0x23c64f[_0x54f7('0x17')](_0x5c3c40)['json'](_0x3fc5ff);}};}function respondWithFilteredResult(_0xdff8ac,_0x3beb69){return function(_0x3be7d7){if(_0x3be7d7){var _0x26e10=typeof _0x3beb69[_0x54f7('0x19')]==='undefined'&&typeof _0x3beb69[_0x54f7('0x1a')]===_0x54f7('0x1b');var _0x20b2df=_0x3be7d7[_0x54f7('0x1c')];var _0xbb18bf=_0x26e10?0x0:_0x3beb69['offset'];var _0x2aa90c=_0x26e10?_0x3be7d7[_0x54f7('0x1c')]:_0x3beb69[_0x54f7('0x19')]+_0x3beb69[_0x54f7('0x1a')];var _0xb231cc;if(_0x2aa90c>=_0x20b2df){_0x2aa90c=_0x20b2df;_0xb231cc=0xc8;}else{_0xb231cc=0xce;}_0xdff8ac['status'](_0xb231cc);return _0xdff8ac[_0x54f7('0x1d')]('Content-Range',_0xbb18bf+'-'+_0x2aa90c+'/'+_0x20b2df)['json'](_0x3be7d7);}return null;};}function patchUpdates(_0x277f15){return function(_0x2abe69){try{jsonpatch['apply'](_0x2abe69,_0x277f15,!![]);}catch(_0x1649a2){return BPromise[_0x54f7('0x1e')](_0x1649a2);}return _0x2abe69[_0x54f7('0x1f')]();};}function saveUpdates(_0x368dad,_0x57406f){return function(_0x563aae){if(_0x563aae){return _0x563aae[_0x54f7('0x20')](_0x368dad)[_0x54f7('0x21')](function(_0x35a16c){return _0x35a16c;});}return null;};}function removeEntity(_0x818220,_0x4875ab){return function(_0x41f3fd){if(_0x41f3fd){return _0x41f3fd['destroy']()[_0x54f7('0x21')](function(){_0x818220[_0x54f7('0x17')](0xcc)[_0x54f7('0x18')]();});}};}function handleEntityNotFound(_0x36f42d,_0x510e07){return function(_0x550e16){if(!_0x550e16){_0x36f42d[_0x54f7('0x16')](0x194);}return _0x550e16;};}function handleError(_0x5a5a84,_0x49a730){_0x49a730=_0x49a730||0x1f4;return function(_0x4b94fa){logger[_0x54f7('0x22')](_0x4b94fa[_0x54f7('0x23')]);if(_0x4b94fa['name']){delete _0x4b94fa[_0x54f7('0x24')];}_0x5a5a84[_0x54f7('0x17')](_0x49a730)['send'](_0x4b94fa);};}exports['index']=function(_0x435981,_0x5c78f2){var _0x45c06b={},_0x307718={},_0x5b4f98={'count':0x0,'rows':[]};var _0x5e745a=_[_0x54f7('0x25')](db[_0x54f7('0x26')]['rawAttributes'],function(_0x26c6b5){return{'name':_0x26c6b5['fieldName'],'type':_0x26c6b5[_0x54f7('0x27')][_0x54f7('0x28')]};});_0x307718['model']=_[_0x54f7('0x25')](_0x5e745a,'name');_0x307718[_0x54f7('0x29')]=_[_0x54f7('0x2a')](_0x435981[_0x54f7('0x29')]);_0x307718[_0x54f7('0x2b')]=_[_0x54f7('0x2c')](_0x307718[_0x54f7('0x2d')],_0x307718[_0x54f7('0x29')]);_0x45c06b[_0x54f7('0x2e')]=_['intersection'](_0x307718[_0x54f7('0x2d')],qs[_0x54f7('0x2f')](_0x435981[_0x54f7('0x29')]['fields']));_0x45c06b[_0x54f7('0x2e')]=_0x45c06b[_0x54f7('0x2e')][_0x54f7('0x30')]?_0x45c06b[_0x54f7('0x2e')]:_0x307718[_0x54f7('0x2d')];if(!_0x435981['query'][_0x54f7('0x31')](_0x54f7('0x32'))){_0x45c06b[_0x54f7('0x1a')]=qs[_0x54f7('0x1a')](_0x435981['query']['limit']);_0x45c06b[_0x54f7('0x19')]=qs[_0x54f7('0x19')](_0x435981[_0x54f7('0x29')][_0x54f7('0x19')]);}_0x45c06b[_0x54f7('0x33')]=qs[_0x54f7('0x34')](_0x435981[_0x54f7('0x29')][_0x54f7('0x34')]);_0x45c06b['where']=qs[_0x54f7('0x2b')](_['pick'](_0x435981[_0x54f7('0x29')],_0x307718['filters']),_0x5e745a);if(_0x435981['query'][_0x54f7('0x35')]){_0x45c06b[_0x54f7('0x36')]=_[_0x54f7('0x37')](_0x45c06b['where'],{'$or':_[_0x54f7('0x25')](_0x5e745a,function(_0x1e2bcf){if(_0x1e2bcf[_0x54f7('0x27')]!==_0x54f7('0x38')){var _0x3e8258={};_0x3e8258[_0x1e2bcf[_0x54f7('0x24')]]={'$like':'%'+_0x435981[_0x54f7('0x29')]['filter']+'%'};return _0x3e8258;}})});}_0x45c06b=_['merge']({},_0x45c06b,_0x435981[_0x54f7('0x39')]);var _0x3ba73c={'where':_0x45c06b[_0x54f7('0x36')]};return db[_0x54f7('0x26')][_0x54f7('0x1c')](_0x3ba73c)[_0x54f7('0x21')](function(_0x236768){_0x5b4f98[_0x54f7('0x1c')]=_0x236768;if(_0x435981['query'][_0x54f7('0x3a')]){_0x45c06b[_0x54f7('0x3b')]=[{'all':!![]}];}return db[_0x54f7('0x26')][_0x54f7('0x3c')](_0x45c06b);})[_0x54f7('0x21')](function(_0x26b3c8){_0x5b4f98[_0x54f7('0x3d')]=_0x26b3c8;return _0x5b4f98;})['then'](respondWithFilteredResult(_0x5c78f2,_0x45c06b))[_0x54f7('0x3e')](handleError(_0x5c78f2,null));};exports[_0x54f7('0x3f')]=function(_0x1fd92a,_0x3d1179){var _0x2765e6={'raw':!![],'where':{'id':_0x1fd92a['params']['id']}},_0x24b71f={};_0x24b71f[_0x54f7('0x2d')]=_['keys'](db[_0x54f7('0x26')][_0x54f7('0x40')]);_0x24b71f[_0x54f7('0x29')]=_['keys'](_0x1fd92a[_0x54f7('0x29')]);_0x24b71f[_0x54f7('0x2b')]=_[_0x54f7('0x2c')](_0x24b71f['model'],_0x24b71f[_0x54f7('0x29')]);_0x2765e6[_0x54f7('0x2e')]=_[_0x54f7('0x2c')](_0x24b71f[_0x54f7('0x2d')],qs[_0x54f7('0x2f')](_0x1fd92a['query'][_0x54f7('0x2f')]));_0x2765e6[_0x54f7('0x2e')]=_0x2765e6[_0x54f7('0x2e')][_0x54f7('0x30')]?_0x2765e6[_0x54f7('0x2e')]:_0x24b71f[_0x54f7('0x2d')];if(_0x1fd92a[_0x54f7('0x29')][_0x54f7('0x3a')]){_0x2765e6[_0x54f7('0x3b')]=[{'all':!![]}];}_0x2765e6=_['merge']({},_0x2765e6,_0x1fd92a[_0x54f7('0x39')]);return db[_0x54f7('0x26')][_0x54f7('0x41')](_0x2765e6)[_0x54f7('0x21')](handleEntityNotFound(_0x3d1179,null))[_0x54f7('0x21')](respondWithResult(_0x3d1179,null))['catch'](handleError(_0x3d1179,null));};exports[_0x54f7('0x42')]=function(_0x5a222d,_0x14dac0){return db[_0x54f7('0x26')][_0x54f7('0x42')](_0x5a222d[_0x54f7('0x43')],{})[_0x54f7('0x21')](respondWithResult(_0x14dac0,0xc9))[_0x54f7('0x3e')](handleError(_0x14dac0,null));};exports[_0x54f7('0x20')]=function(_0x5ea277,_0x880bde){if(_0x5ea277[_0x54f7('0x43')]['id']){delete _0x5ea277['body']['id'];}return db['OpenchannelApplication'][_0x54f7('0x41')]({'where':{'id':_0x5ea277[_0x54f7('0x44')]['id']}})[_0x54f7('0x21')](handleEntityNotFound(_0x880bde,null))[_0x54f7('0x21')](saveUpdates(_0x5ea277[_0x54f7('0x43')],null))[_0x54f7('0x21')](respondWithResult(_0x880bde,null))[_0x54f7('0x3e')](handleError(_0x880bde,null));};exports[_0x54f7('0x45')]=function(_0x5bef01,_0x10e672){return db[_0x54f7('0x26')][_0x54f7('0x41')]({'where':{'id':_0x5bef01[_0x54f7('0x44')]['id']}})[_0x54f7('0x21')](handleEntityNotFound(_0x10e672,null))[_0x54f7('0x21')](removeEntity(_0x10e672,null))[_0x54f7('0x3e')](handleError(_0x10e672,null));}; \ No newline at end of file +var _0x13d3=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelApplication','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x13d3,0x157));var _0x313d=function(_0x39a7e0,_0x4876af){_0x39a7e0=_0x39a7e0-0x0;var _0x4c4780=_0x13d3[_0x39a7e0];return _0x4c4780;};'use strict';var emlformat=require(_0x313d('0x0'));var rimraf=require(_0x313d('0x1'));var zipdir=require(_0x313d('0x2'));var jsonpatch=require(_0x313d('0x3'));var rp=require(_0x313d('0x4'));var moment=require(_0x313d('0x5'));var BPromise=require(_0x313d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x313d('0x7'));var sox=require('sox');var csv=require(_0x313d('0x8'));var ejs=require(_0x313d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x313d('0xa'));var squel=require(_0x313d('0xb'));var crypto=require(_0x313d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x313d('0xd'));var toCsv=require(_0x313d('0x8'));var querystring=require(_0x313d('0xe'));var Papa=require(_0x313d('0xf'));var Redis=require(_0x313d('0x10'));var authService=require(_0x313d('0x11'));var qs=require(_0x313d('0x12'));var as=require(_0x313d('0x13'));var hardwareService=require(_0x313d('0x14'));var logger=require(_0x313d('0x15'))('api');var utils=require(_0x313d('0x16'));var config=require(_0x313d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x313d('0x18'))['db'];function respondWithStatusCode(_0x4aecba,_0x27ecdc){_0x27ecdc=_0x27ecdc||0xcc;return function(_0x41b095){if(_0x41b095){return _0x4aecba[_0x313d('0x19')](_0x27ecdc);}return _0x4aecba[_0x313d('0x1a')](_0x27ecdc)['end']();};}function respondWithResult(_0xce2c4,_0x5f2167){_0x5f2167=_0x5f2167||0xc8;return function(_0xae330a){if(_0xae330a){return _0xce2c4[_0x313d('0x1a')](_0x5f2167)[_0x313d('0x1b')](_0xae330a);}};}function respondWithFilteredResult(_0x5df3eb,_0x181f0f){return function(_0x224e2b){if(_0x224e2b){var _0x46e174=typeof _0x181f0f[_0x313d('0x1c')]===_0x313d('0x1d')&&typeof _0x181f0f[_0x313d('0x1e')]===_0x313d('0x1d');var _0x4d4d21=_0x224e2b[_0x313d('0x1f')];var _0x459a0b=_0x46e174?0x0:_0x181f0f[_0x313d('0x1c')];var _0x28376a=_0x46e174?_0x224e2b[_0x313d('0x1f')]:_0x181f0f[_0x313d('0x1c')]+_0x181f0f[_0x313d('0x1e')];var _0x4960bb;if(_0x28376a>=_0x4d4d21){_0x28376a=_0x4d4d21;_0x4960bb=0xc8;}else{_0x4960bb=0xce;}_0x5df3eb[_0x313d('0x1a')](_0x4960bb);return _0x5df3eb[_0x313d('0x20')](_0x313d('0x21'),_0x459a0b+'-'+_0x28376a+'/'+_0x4d4d21)[_0x313d('0x1b')](_0x224e2b);}return null;};}function patchUpdates(_0x36b0e0){return function(_0x466e2b){try{jsonpatch[_0x313d('0x22')](_0x466e2b,_0x36b0e0,!![]);}catch(_0x20a13b){return BPromise[_0x313d('0x23')](_0x20a13b);}return _0x466e2b[_0x313d('0x24')]();};}function saveUpdates(_0x32e9df,_0x3c72c4){return function(_0x42fc93){if(_0x42fc93){return _0x42fc93[_0x313d('0x25')](_0x32e9df)[_0x313d('0x26')](function(_0x137869){return _0x137869;});}return null;};}function removeEntity(_0x18dc47,_0x42dc29){return function(_0x5886ad){if(_0x5886ad){return _0x5886ad['destroy']()[_0x313d('0x26')](function(){_0x18dc47[_0x313d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xda55f9,_0x9b85f7){return function(_0x401f86){if(!_0x401f86){_0xda55f9[_0x313d('0x19')](0x194);}return _0x401f86;};}function handleError(_0x9bb113,_0x2e2647){_0x2e2647=_0x2e2647||0x1f4;return function(_0x5f09d8){logger[_0x313d('0x27')](_0x5f09d8[_0x313d('0x28')]);if(_0x5f09d8[_0x313d('0x29')]){delete _0x5f09d8[_0x313d('0x29')];}_0x9bb113[_0x313d('0x1a')](_0x2e2647)[_0x313d('0x2a')](_0x5f09d8);};}exports[_0x313d('0x2b')]=function(_0x2802bc,_0x14217b){var _0x110629={},_0x5edebe={},_0xce8176={'count':0x0,'rows':[]};var _0x55a7b5=_[_0x313d('0x2c')](db[_0x313d('0x2d')]['rawAttributes'],function(_0x4f1dd6){return{'name':_0x4f1dd6['fieldName'],'type':_0x4f1dd6['type'][_0x313d('0x2e')]};});_0x5edebe[_0x313d('0x2f')]=_[_0x313d('0x2c')](_0x55a7b5,'name');_0x5edebe[_0x313d('0x30')]=_[_0x313d('0x31')](_0x2802bc[_0x313d('0x30')]);_0x5edebe[_0x313d('0x32')]=_['intersection'](_0x5edebe['model'],_0x5edebe[_0x313d('0x30')]);_0x110629[_0x313d('0x33')]=_[_0x313d('0x34')](_0x5edebe[_0x313d('0x2f')],qs[_0x313d('0x35')](_0x2802bc[_0x313d('0x30')][_0x313d('0x35')]));_0x110629[_0x313d('0x33')]=_0x110629[_0x313d('0x33')][_0x313d('0x36')]?_0x110629['attributes']:_0x5edebe[_0x313d('0x2f')];if(!_0x2802bc['query'][_0x313d('0x37')]('nolimit')){_0x110629[_0x313d('0x1e')]=qs[_0x313d('0x1e')](_0x2802bc['query']['limit']);_0x110629['offset']=qs[_0x313d('0x1c')](_0x2802bc['query'][_0x313d('0x1c')]);}_0x110629[_0x313d('0x38')]=qs[_0x313d('0x39')](_0x2802bc['query']['sort']);_0x110629[_0x313d('0x3a')]=qs[_0x313d('0x32')](_[_0x313d('0x3b')](_0x2802bc['query'],_0x5edebe['filters']),_0x55a7b5);if(_0x2802bc['query']['filter']){_0x110629[_0x313d('0x3a')]=_[_0x313d('0x3c')](_0x110629['where'],{'$or':_[_0x313d('0x2c')](_0x55a7b5,function(_0x36c030){if(_0x36c030[_0x313d('0x3d')]!=='VIRTUAL'){var _0x31dc42={};_0x31dc42[_0x36c030[_0x313d('0x29')]]={'$like':'%'+_0x2802bc[_0x313d('0x30')][_0x313d('0x3e')]+'%'};return _0x31dc42;}})});}_0x110629=_[_0x313d('0x3c')]({},_0x110629,_0x2802bc[_0x313d('0x3f')]);var _0x3f1ab6={'where':_0x110629[_0x313d('0x3a')]};return db[_0x313d('0x2d')][_0x313d('0x1f')](_0x3f1ab6)[_0x313d('0x26')](function(_0x1df2f4){_0xce8176[_0x313d('0x1f')]=_0x1df2f4;if(_0x2802bc['query'][_0x313d('0x40')]){_0x110629[_0x313d('0x41')]=[{'all':!![]}];}return db[_0x313d('0x2d')][_0x313d('0x42')](_0x110629);})['then'](function(_0x340cad){_0xce8176['rows']=_0x340cad;return _0xce8176;})[_0x313d('0x26')](respondWithFilteredResult(_0x14217b,_0x110629))['catch'](handleError(_0x14217b,null));};exports[_0x313d('0x43')]=function(_0x4ae76a,_0x4632bf){var _0x48c8eb={'raw':!![],'where':{'id':_0x4ae76a[_0x313d('0x44')]['id']}},_0x5c9a06={};_0x5c9a06[_0x313d('0x2f')]=_[_0x313d('0x31')](db['OpenchannelApplication'][_0x313d('0x45')]);_0x5c9a06[_0x313d('0x30')]=_[_0x313d('0x31')](_0x4ae76a[_0x313d('0x30')]);_0x5c9a06[_0x313d('0x32')]=_[_0x313d('0x34')](_0x5c9a06[_0x313d('0x2f')],_0x5c9a06[_0x313d('0x30')]);_0x48c8eb[_0x313d('0x33')]=_[_0x313d('0x34')](_0x5c9a06[_0x313d('0x2f')],qs[_0x313d('0x35')](_0x4ae76a['query'][_0x313d('0x35')]));_0x48c8eb[_0x313d('0x33')]=_0x48c8eb['attributes'][_0x313d('0x36')]?_0x48c8eb[_0x313d('0x33')]:_0x5c9a06[_0x313d('0x2f')];if(_0x4ae76a[_0x313d('0x30')][_0x313d('0x40')]){_0x48c8eb[_0x313d('0x41')]=[{'all':!![]}];}_0x48c8eb=_[_0x313d('0x3c')]({},_0x48c8eb,_0x4ae76a['options']);return db[_0x313d('0x2d')][_0x313d('0x46')](_0x48c8eb)[_0x313d('0x26')](handleEntityNotFound(_0x4632bf,null))[_0x313d('0x26')](respondWithResult(_0x4632bf,null))[_0x313d('0x47')](handleError(_0x4632bf,null));};exports['create']=function(_0x3afcc6,_0x2f246f){return db[_0x313d('0x2d')]['create'](_0x3afcc6[_0x313d('0x48')],{})[_0x313d('0x26')](respondWithResult(_0x2f246f,0xc9))['catch'](handleError(_0x2f246f,null));};exports[_0x313d('0x25')]=function(_0x502b7e,_0x5a6a79){if(_0x502b7e[_0x313d('0x48')]['id']){delete _0x502b7e[_0x313d('0x48')]['id'];}return db[_0x313d('0x2d')]['find']({'where':{'id':_0x502b7e['params']['id']}})[_0x313d('0x26')](handleEntityNotFound(_0x5a6a79,null))[_0x313d('0x26')](saveUpdates(_0x502b7e[_0x313d('0x48')],null))[_0x313d('0x26')](respondWithResult(_0x5a6a79,null))['catch'](handleError(_0x5a6a79,null));};exports[_0x313d('0x49')]=function(_0x5f32cc,_0x13bd7c){return db[_0x313d('0x2d')][_0x313d('0x46')]({'where':{'id':_0x5f32cc['params']['id']}})[_0x313d('0x26')](handleEntityNotFound(_0x13bd7c,null))['then'](removeEntity(_0x13bd7c,null))[_0x313d('0x47')](handleError(_0x13bd7c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index cef903f..817e589 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 _0x7a06=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelApplication','utf8mb4'];(function(_0x4333f3,_0x52c5da){var _0x4ba6e5=function(_0x110967){while(--_0x110967){_0x4333f3['push'](_0x4333f3['shift']());}};_0x4ba6e5(++_0x52c5da);}(_0x7a06,0x1c1));var _0x67a0=function(_0x3d613e,_0x377afa){_0x3d613e=_0x3d613e-0x0;var _0x365df4=_0x7a06[_0x3d613e];return _0x365df4;};'use strict';var _=require(_0x67a0('0x0'));var util=require(_0x67a0('0x1'));var logger=require(_0x67a0('0x2'))(_0x67a0('0x3'));var moment=require(_0x67a0('0x4'));var BPromise=require(_0x67a0('0x5'));var rp=require(_0x67a0('0x6'));var fs=require('fs');var path=require(_0x67a0('0x7'));var rimraf=require(_0x67a0('0x8'));var config=require(_0x67a0('0x9'));var attributes=require('./openchannelApplication.attributes');module[_0x67a0('0xa')]=function(_0x3ce774,_0x3305dc){return _0x3ce774['define'](_0x67a0('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x67a0('0xc'),'collate':_0x67a0('0xd')});}; \ No newline at end of file +var _0x1ee1=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x1ee1,0x93));var _0x11ee=function(_0xd052d7,_0xa69d50){_0xd052d7=_0xd052d7-0x0;var _0x520839=_0x1ee1[_0xd052d7];return _0x520839;};'use strict';var _=require('lodash');var util=require(_0x11ee('0x0'));var logger=require(_0x11ee('0x1'))(_0x11ee('0x2'));var moment=require(_0x11ee('0x3'));var BPromise=require(_0x11ee('0x4'));var rp=require(_0x11ee('0x5'));var fs=require('fs');var path=require(_0x11ee('0x6'));var rimraf=require(_0x11ee('0x7'));var config=require(_0x11ee('0x8'));var attributes=require(_0x11ee('0x9'));module[_0x11ee('0xa')]=function(_0x94f643,_0x3e3c3a){return _0x94f643[_0x11ee('0xb')](_0x11ee('0xc'),attributes,{'tableName':_0x11ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x11ee('0xe'),'collate':_0x11ee('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 347b952..973ee8c 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 _0x5c00=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','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','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x565fd9,_0x50b381){var _0x31156b=function(_0x44f3cb){while(--_0x44f3cb){_0x565fd9['push'](_0x565fd9['shift']());}};_0x31156b(++_0x50b381);}(_0x5c00,0x19b));var _0x05c0=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x5c00[_0x385fed];return _0x52fa25;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require(_0x05c0('0x3'));var rs=require(_0x05c0('0x4'));var fs=require('fs');var Redis=require(_0x05c0('0x5'));var db=require(_0x05c0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05c0('0x7'));var config=require(_0x05c0('0x8'));var jayson=require(_0x05c0('0x9'));var client=jayson['client'][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b9ed5,_0x5189d2,_0x79e25c){return new BPromise(function(_0x32ef5c,_0x2919ef){return client[_0x05c0('0xb')](_0x2b9ed5,_0x79e25c)[_0x05c0('0xc')](function(_0x18ff8f){logger[_0x05c0('0xd')](_0x05c0('0xe'),_0x5189d2,_0x05c0('0xf'));logger[_0x05c0('0x10')](_0x05c0('0x11'),_0x5189d2,_0x05c0('0xf'),JSON[_0x05c0('0x12')](_0x18ff8f));if(_0x18ff8f[_0x05c0('0x13')]){if(_0x18ff8f[_0x05c0('0x13')][_0x05c0('0x14')]===0x1f4){logger[_0x05c0('0x13')](_0x05c0('0xe'),_0x5189d2,_0x18ff8f['error'][_0x05c0('0x15')]);return _0x2919ef(_0x18ff8f['error']['message']);}logger[_0x05c0('0x13')](_0x05c0('0xe'),_0x5189d2,_0x18ff8f[_0x05c0('0x13')][_0x05c0('0x15')]);return _0x32ef5c(_0x18ff8f[_0x05c0('0x13')][_0x05c0('0x15')]);}else{logger[_0x05c0('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x5189d2,'request\x20sent');_0x32ef5c(_0x18ff8f[_0x05c0('0x16')]['message']);}})[_0x05c0('0x17')](function(_0x9cf88c){logger['error'](_0x05c0('0xe'),_0x5189d2,_0x9cf88c);_0x2919ef(_0x9cf88c);});});}exports[_0x05c0('0x18')]=function(_0x16c13c){var _0x4f417d=this;return new Promise(function(_0x40dede,_0x2df351){return db[_0x05c0('0x19')][_0x05c0('0x1a')](_0x16c13c[_0x05c0('0x1b')],{'raw':_0x16c13c[_0x05c0('0x1c')]?_0x16c13c[_0x05c0('0x1c')][_0x05c0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16c13c[_0x05c0('0x1c')]?_0x16c13c[_0x05c0('0x1c')]['where']||null:null,'attributes':_0x16c13c[_0x05c0('0x1c')]?_0x16c13c['options'][_0x05c0('0x1e')]||null:null,'limit':_0x16c13c[_0x05c0('0x1c')]?_0x16c13c[_0x05c0('0x1c')][_0x05c0('0x1f')]||null:null})['then'](function(_0x3c4f1b){logger[_0x05c0('0xd')](_0x05c0('0x18'),_0x16c13c);logger[_0x05c0('0x10')]('UpdateOpenchannelApplication',_0x16c13c,JSON[_0x05c0('0x12')](_0x3c4f1b));_0x40dede(_0x3c4f1b);})[_0x05c0('0x17')](function(_0x19f1a5){logger['error'](_0x05c0('0x18'),_0x19f1a5[_0x05c0('0x15')],_0x16c13c);_0x2df351(_0x4f417d[_0x05c0('0x13')](0x1f4,_0x19f1a5[_0x05c0('0x15')]));});});}; \ No newline at end of file +var _0xc4e2=['http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x44d8d2,_0x7c7aa6){var _0x273a41=function(_0x32eac9){while(--_0x32eac9){_0x44d8d2['push'](_0x44d8d2['shift']());}};_0x273a41(++_0x7c7aa6);}(_0xc4e2,0xe7));var _0x2c4e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc4e2[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x2c4e('0x0'));var util=require('util');var moment=require(_0x2c4e('0x1'));var BPromise=require(_0x2c4e('0x2'));var rs=require(_0x2c4e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c4e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c4e('0x5'))(_0x2c4e('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c4e('0x7'));var client=jayson[_0x2c4e('0x8')][_0x2c4e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c5bed,_0x1e8930,_0x3bd07e){return new BPromise(function(_0xd8341d,_0x556d34){return client[_0x2c4e('0xa')](_0x1c5bed,_0x3bd07e)['then'](function(_0x1be1e8){logger['info'](_0x2c4e('0xb'),_0x1e8930,_0x2c4e('0xc'));logger['debug'](_0x2c4e('0xd'),_0x1e8930,'request\x20sent',JSON[_0x2c4e('0xe')](_0x1be1e8));if(_0x1be1e8[_0x2c4e('0xf')]){if(_0x1be1e8[_0x2c4e('0xf')][_0x2c4e('0x10')]===0x1f4){logger[_0x2c4e('0xf')](_0x2c4e('0xb'),_0x1e8930,_0x1be1e8[_0x2c4e('0xf')][_0x2c4e('0x11')]);return _0x556d34(_0x1be1e8[_0x2c4e('0xf')][_0x2c4e('0x11')]);}logger[_0x2c4e('0xf')](_0x2c4e('0xb'),_0x1e8930,_0x1be1e8[_0x2c4e('0xf')][_0x2c4e('0x11')]);return _0xd8341d(_0x1be1e8[_0x2c4e('0xf')][_0x2c4e('0x11')]);}else{logger[_0x2c4e('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e8930,'request\x20sent');_0xd8341d(_0x1be1e8['result'][_0x2c4e('0x11')]);}})[_0x2c4e('0x13')](function(_0x52c04f){logger[_0x2c4e('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e8930,_0x52c04f);_0x556d34(_0x52c04f);});});}exports[_0x2c4e('0x14')]=function(_0x3d1415){var _0x5581b9=this;return new Promise(function(_0x41130c,_0x1fabd8){return db[_0x2c4e('0x15')][_0x2c4e('0x16')](_0x3d1415[_0x2c4e('0x17')],{'raw':_0x3d1415[_0x2c4e('0x18')]?_0x3d1415[_0x2c4e('0x18')][_0x2c4e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d1415[_0x2c4e('0x18')]?_0x3d1415[_0x2c4e('0x18')][_0x2c4e('0x1a')]||null:null,'attributes':_0x3d1415[_0x2c4e('0x18')]?_0x3d1415['options'][_0x2c4e('0x1b')]||null:null,'limit':_0x3d1415[_0x2c4e('0x18')]?_0x3d1415[_0x2c4e('0x18')][_0x2c4e('0x1c')]||null:null})[_0x2c4e('0x1d')](function(_0x591639){logger[_0x2c4e('0x12')]('UpdateOpenchannelApplication',_0x3d1415);logger['debug']('UpdateOpenchannelApplication',_0x3d1415,JSON[_0x2c4e('0xe')](_0x591639));_0x41130c(_0x591639);})[_0x2c4e('0x13')](function(_0x2207a4){logger[_0x2c4e('0xf')](_0x2c4e('0x14'),_0x2207a4[_0x2c4e('0x11')],_0x3d1415);_0x1fabd8(_0x5581b9[_0x2c4e('0xf')](0x1f4,_0x2207a4[_0x2c4e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c98f49b..80aa96d 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 _0xe16f=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x374bf8,_0x4613a6){var _0x3c9f75=function(_0x2bdbbe){while(--_0x2bdbbe){_0x374bf8['push'](_0x374bf8['shift']());}};_0x3c9f75(++_0x4613a6);}(_0xe16f,0x1cd));var _0xfe16=function(_0x3cc814,_0x5bf790){_0x3cc814=_0x3cc814-0x0;var _0x527770=_0xe16f[_0x3cc814];return _0x527770;};'use strict';var multer=require('multer');var util=require(_0xfe16('0x0'));var path=require(_0xfe16('0x1'));var timeout=require(_0xfe16('0x2'));var express=require(_0xfe16('0x3'));var router=express[_0xfe16('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfe16('0x5'));var interaction=require(_0xfe16('0x6'));var config=require(_0xfe16('0x7'));var controller=require(_0xfe16('0x8'));router[_0xfe16('0x9')]('/',auth[_0xfe16('0xa')](),controller[_0xfe16('0xb')]);router[_0xfe16('0x9')](_0xfe16('0xc'),auth[_0xfe16('0xa')](),controller[_0xfe16('0xd')]);router[_0xfe16('0x9')](_0xfe16('0xe'),auth[_0xfe16('0xa')](),controller[_0xfe16('0xf')]);router[_0xfe16('0x9')](_0xfe16('0x10'),auth['isAuthenticated'](),controller[_0xfe16('0x11')]);router[_0xfe16('0x9')](_0xfe16('0x12'),auth[_0xfe16('0xa')](),controller[_0xfe16('0x13')]);router[_0xfe16('0x14')]('/',auth[_0xfe16('0xa')](),controller[_0xfe16('0x15')]);router[_0xfe16('0x14')](_0xfe16('0x10'),auth[_0xfe16('0xa')](),controller[_0xfe16('0x16')]);router[_0xfe16('0x14')](_0xfe16('0x17'),auth['isAuthenticated'](),interaction[_0xfe16('0x18')](_0xfe16('0x19'),'openchannelinteraction:addtags'),controller[_0xfe16('0x1a')]);router[_0xfe16('0x1b')]('/:id',auth[_0xfe16('0xa')](),interaction['tracked'](_0xfe16('0x19'),_0xfe16('0x1c')),controller[_0xfe16('0x1d')]);router[_0xfe16('0x1e')](_0xfe16('0xe'),auth[_0xfe16('0xa')](),interaction[_0xfe16('0x18')](_0xfe16('0x19'),_0xfe16('0x1f')),controller[_0xfe16('0x20')]);router[_0xfe16('0x1e')](_0xfe16('0x17'),auth[_0xfe16('0xa')](),controller[_0xfe16('0x21')]);module['exports']=router; \ No newline at end of file +var _0xb642=['tracked','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb642,0x1e7));var _0x2b64=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xb642[_0x4709c0];return _0x13348b;};'use strict';var multer=require('multer');var util=require(_0x2b64('0x0'));var path=require('path');var timeout=require(_0x2b64('0x1'));var express=require(_0x2b64('0x2'));var router=express[_0x2b64('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b64('0x4'));var interaction=require(_0x2b64('0x5'));var config=require(_0x2b64('0x6'));var controller=require(_0x2b64('0x7'));router[_0x2b64('0x8')]('/',auth[_0x2b64('0x9')](),controller[_0x2b64('0xa')]);router[_0x2b64('0x8')](_0x2b64('0xb'),auth[_0x2b64('0x9')](),controller[_0x2b64('0xc')]);router[_0x2b64('0x8')](_0x2b64('0xd'),auth[_0x2b64('0x9')](),controller[_0x2b64('0xe')]);router['get'](_0x2b64('0xf'),auth['isAuthenticated'](),controller[_0x2b64('0x10')]);router['get'](_0x2b64('0x11'),auth['isAuthenticated'](),controller[_0x2b64('0x12')]);router['post']('/',auth[_0x2b64('0x9')](),controller[_0x2b64('0x13')]);router[_0x2b64('0x14')](_0x2b64('0xf'),auth[_0x2b64('0x9')](),controller[_0x2b64('0x15')]);router['post'](_0x2b64('0x16'),auth[_0x2b64('0x9')](),interaction['tracked'](_0x2b64('0x17'),_0x2b64('0x18')),controller['addTags']);router['put']('/:id',auth[_0x2b64('0x9')](),interaction[_0x2b64('0x19')](_0x2b64('0x17'),_0x2b64('0x1a')),controller[_0x2b64('0x1b')]);router['delete'](_0x2b64('0xd'),auth[_0x2b64('0x9')](),interaction[_0x2b64('0x19')](_0x2b64('0x17'),_0x2b64('0x1c')),controller[_0x2b64('0x1d')]);router[_0x2b64('0x1e')]('/:id/tags',auth[_0x2b64('0x9')](),controller[_0x2b64('0x1f')]);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 aec9627..025131c 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 _0x7b37=['sequelize','exports','DATE','STRING','ENUM','out','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b37,0xd9));var _0x77b3=function(_0x39aba0,_0x5a5cf6){_0x39aba0=_0x39aba0-0x0;var _0x56dc38=_0x7b37[_0x39aba0];return _0x56dc38;};'use strict';var Sequelize=require(_0x77b3('0x0'));module[_0x77b3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x77b3('0x2')]},'disposition':{'type':Sequelize[_0x77b3('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x77b3('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x77b3('0x2')]},'threadId':{'type':Sequelize[_0x77b3('0x3')]},'externalUrl':{'type':Sequelize[_0x77b3('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x77b3('0x4')]('in',_0x77b3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x77b3('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x77b3('0x6')]}}; \ No newline at end of file +var _0x6002=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0x6002,0x103));var _0x2600=function(_0x197570,_0x48c3d5){_0x197570=_0x197570-0x0;var _0x237723=_0x6002[_0x197570];return _0x237723;};'use strict';var Sequelize=require(_0x2600('0x0'));module[_0x2600('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2600('0x2')]},'disposition':{'type':Sequelize[_0x2600('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2600('0x3')]},'note':{'type':Sequelize[_0x2600('0x3')]},'read1stAt':{'type':Sequelize[_0x2600('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2600('0x4')]('in',_0x2600('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e43f6bc..d10c0cc 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 _0x584f=['create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','rawAttributes','filters','order','sort','where','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','downloadInteraction.ejs','transcript-','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','findAll','openchannel','query','user','then','catch','show','from','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find'];(function(_0x49c532,_0x8b5fe2){var _0x460af5=function(_0x139801){while(--_0x139801){_0x49c532['push'](_0x49c532['shift']());}};_0x460af5(++_0x8b5fe2);}(_0x584f,0x144));var _0xf584=function(_0x201efd,_0x561cd2){_0x201efd=_0x201efd-0x0;var _0x328cdb=_0x584f[_0x201efd];return _0x328cdb;};'use strict';var rimraf=require(_0xf584('0x0'));var zipdir=require(_0xf584('0x1'));var moment=require(_0xf584('0x2'));var util=require('util');var path=require(_0xf584('0x3'));var ejs=require(_0xf584('0x4'));var fs=require('fs');var _=require(_0xf584('0x5'));var Redis=require(_0xf584('0x6'));var interaction=require(_0xf584('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xf584('0x8'))(_0xf584('0x9'));var config=require('../../config/environment');var db=require(_0xf584('0xa'))['db'];config[_0xf584('0xb')]=_[_0xf584('0xc')](config[_0xf584('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf584('0xd'))(new Redis(config[_0xf584('0xb')]));require(_0xf584('0xe'))[_0xf584('0xf')](socket);function respondWithStatusCode(_0x481e51,_0x3d38a9){_0x3d38a9=_0x3d38a9||0xcc;return function(_0x3236d6){if(_0x3236d6){return _0x481e51[_0xf584('0x10')](_0x3d38a9);}return _0x481e51[_0xf584('0x11')](_0x3d38a9)[_0xf584('0x12')]();};}function respondWithResult(_0x5ce026,_0x17b0df){_0x17b0df=_0x17b0df||0xc8;return function(_0x59b113){if(_0x59b113){return _0x5ce026[_0xf584('0x11')](_0x17b0df)[_0xf584('0x13')](_0x59b113);}};}function respondWithFilteredResult(_0x28009a,_0x4eda0f){return function(_0x5174b3){if(_0x5174b3){var _0x4a45af=typeof _0x4eda0f[_0xf584('0x14')]===_0xf584('0x15')&&typeof _0x4eda0f[_0xf584('0x16')]===_0xf584('0x15');var _0x29cafa=_0x5174b3[_0xf584('0x17')];var _0x2439e9=_0x4a45af?0x0:_0x4eda0f[_0xf584('0x14')];var _0x29c26d=_0x4a45af?_0x5174b3[_0xf584('0x17')]:_0x4eda0f[_0xf584('0x14')]+_0x4eda0f['limit'];var _0x2450d3;if(_0x29c26d>=_0x29cafa){_0x29c26d=_0x29cafa;_0x2450d3=0xc8;}else{_0x2450d3=0xce;}_0x28009a[_0xf584('0x11')](_0x2450d3);return _0x28009a[_0xf584('0x18')](_0xf584('0x19'),_0x2439e9+'-'+_0x29c26d+'/'+_0x29cafa)[_0xf584('0x13')](_0x5174b3);}return null;};}function saveUpdates(_0x55ef91){return function(_0x5e21cb){if(_0x5e21cb){return _0x5e21cb[_0xf584('0x1a')](_0x55ef91)['then'](function(_0x16063c){return _0x16063c;});}return null;};}function removeEntity(_0x17d17c){return function(_0x47ff52){if(_0x47ff52){return _0x47ff52[_0xf584('0x1b')]()['then'](function(){_0x17d17c[_0xf584('0x11')](0xcc)[_0xf584('0x12')]();});}};}function handleEntityNotFound(_0x5316eb){return function(_0x467af0){if(!_0x467af0){_0x5316eb[_0xf584('0x10')](0x194);}return _0x467af0;};}function handleError(_0x286a25,_0x3113ab){_0x3113ab=_0x3113ab||0x1f4;return function(_0x47e4fe){logger[_0xf584('0x1c')](_0x47e4fe[_0xf584('0x1d')]);if(_0x47e4fe[_0xf584('0x1e')]){delete _0x47e4fe[_0xf584('0x1e')];}_0x286a25[_0xf584('0x11')](_0x3113ab)[_0xf584('0x1f')](_0x47e4fe);};}exports[_0xf584('0x20')]=function(_0x5c153e,_0x5eb682){var _0x4473f5={};var _0x3ffe62=_[_0xf584('0x21')](db[_0xf584('0x22')]['rawAttributes'],function(_0x1aaa0a){return{'name':_0x1aaa0a[_0xf584('0x23')],'type':_0x1aaa0a[_0xf584('0x24')]['key']};});_0x4473f5=qs['getOptions'](_0x3ffe62,_0x5c153e);return interaction[_0xf584('0x25')](_0xf584('0x26'),_0x5c153e[_0xf584('0x27')],_0x5c153e[_0xf584('0x28')],_0x4473f5,_0x3ffe62)[_0xf584('0x29')](respondWithFilteredResult(_0x5eb682,_0x4473f5))[_0xf584('0x2a')](handleError(_0x5eb682,null));};exports[_0xf584('0x2b')]=function(_0x4b7b43,_0x151e8f){var _0x525ce8={};if(_0x4b7b43[_0xf584('0x27')][_0xf584('0x24')]&&_0x4b7b43[_0xf584('0x27')][_0xf584('0x24')]==='from'){_0x525ce8[_0xf584('0x2c')]=_0x4b7b43[_0xf584('0x2d')]['id'];}else{_0x525ce8['id']=_0x4b7b43['params']['id'];}var _0x5979a5={'raw':![],'where':_0x525ce8},_0x19b65e={};_0x19b65e[_0xf584('0x2e')]=_[_0xf584('0x2f')](db['OpenchannelInteraction']['rawAttributes']);_0x19b65e[_0xf584('0x27')]=_[_0xf584('0x2f')](_0x4b7b43[_0xf584('0x27')]);_0x19b65e['filters']=_[_0xf584('0x30')](_0x19b65e[_0xf584('0x2e')],_0x19b65e[_0xf584('0x27')]);_0x5979a5[_0xf584('0x31')]=_['intersection'](_0x19b65e['model'],qs['fields'](_0x4b7b43[_0xf584('0x27')][_0xf584('0x32')]));_0x5979a5[_0xf584('0x31')]=_0x5979a5[_0xf584('0x31')][_0xf584('0x33')]?_0x5979a5[_0xf584('0x31')]:_0x19b65e[_0xf584('0x2e')];if(_0x4b7b43[_0xf584('0x27')][_0xf584('0x34')]){_0x5979a5[_0xf584('0x35')]=[{'all':!![]}];}_0x5979a5=_[_0xf584('0x36')]({},_0x5979a5,_0x4b7b43[_0xf584('0x37')]);return db[_0xf584('0x22')][_0xf584('0x38')](_0x5979a5)['then'](handleEntityNotFound(_0x151e8f,null))[_0xf584('0x29')](respondWithResult(_0x151e8f,null))[_0xf584('0x2a')](handleError(_0x151e8f,null));};exports[_0xf584('0x39')]=function(_0x153391,_0x47989f){return db[_0xf584('0x22')]['create'](_0x153391[_0xf584('0x3a')],{})[_0xf584('0x29')](respondWithResult(_0x47989f,0xc9))[_0xf584('0x2a')](handleError(_0x47989f,null));};exports['update']=function(_0x380687,_0x1eb74b){if(_0x380687['body']['id']){delete _0x380687[_0xf584('0x3a')]['id'];}return db[_0xf584('0x22')][_0xf584('0x38')]({'where':{'id':_0x380687['params']['id']}})['then'](handleEntityNotFound(_0x1eb74b,null))[_0xf584('0x29')](saveUpdates(_0x380687[_0xf584('0x3a')],null))[_0xf584('0x29')](respondWithResult(_0x1eb74b,null))['catch'](handleError(_0x1eb74b,null));};exports[_0xf584('0x1b')]=function(_0x482502,_0xe79db7){return db[_0xf584('0x22')][_0xf584('0x38')]({'where':{'id':_0x482502[_0xf584('0x2d')]['id']}})[_0xf584('0x29')](handleEntityNotFound(_0xe79db7,null))[_0xf584('0x29')](removeEntity(_0xe79db7,null))[_0xf584('0x2a')](handleError(_0xe79db7,null));};exports[_0xf584('0x3b')]=function(_0x155adb,_0x403949){return db['OpenchannelInteraction'][_0xf584('0x3b')]()[_0xf584('0x29')](respondWithResult(_0x403949,null))[_0xf584('0x2a')](handleError(_0x403949,null));};exports[_0xf584('0x3c')]=function(_0x37d8a8,_0x31dbee){return db[_0xf584('0x3d')]['find']({'where':{'id':_0x37d8a8[_0xf584('0x2d')]['id']}})[_0xf584('0x29')](handleEntityNotFound(_0x31dbee,null))[_0xf584('0x29')](function(_0x584518){if(_0x584518){return _0x584518[_0xf584('0x3c')](_0x37d8a8['body'][_0xf584('0x3e')],_['omit'](_0x37d8a8[_0xf584('0x3a')],[_0xf584('0x3e'),'id'])||{});}})[_0xf584('0x29')](respondWithResult(_0x31dbee,null))[_0xf584('0x2a')](handleError(_0x31dbee,null));};exports[_0xf584('0x3f')]=function(_0x324938,_0xe811a5){var _0x1e02db={'raw':![],'where':{}};var _0x169627={};var _0x4d6097={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x324938[_0xf584('0x2d')]['id']}})[_0xf584('0x29')](handleEntityNotFound(_0xe811a5,null))[_0xf584('0x29')](function(_0x29e04f){if(_0x29e04f){_0x169627[_0xf584('0x2e')]=_[_0xf584('0x2f')](db[_0xf584('0x3d')][_0xf584('0x40')]);_0x169627[_0xf584('0x27')]=_['keys'](_0x324938['query']);_0x169627[_0xf584('0x41')]=_['intersection'](_0x169627['model'],_0x169627[_0xf584('0x27')]);_0x1e02db[_0xf584('0x31')]=_[_0xf584('0x30')](_0x169627[_0xf584('0x2e')],qs[_0xf584('0x32')](_0x324938[_0xf584('0x27')][_0xf584('0x32')]));_0x1e02db[_0xf584('0x31')]=_0x1e02db[_0xf584('0x31')]['length']?_0x1e02db[_0xf584('0x31')]:_0x169627[_0xf584('0x2e')];if(!_0x324938['query']['hasOwnProperty']('nolimit')){_0x1e02db[_0xf584('0x16')]=qs[_0xf584('0x16')](_0x324938[_0xf584('0x27')][_0xf584('0x16')]);_0x1e02db[_0xf584('0x14')]=qs[_0xf584('0x14')](_0x324938[_0xf584('0x27')][_0xf584('0x14')]);}_0x1e02db[_0xf584('0x42')]=qs[_0xf584('0x43')](_0x324938[_0xf584('0x27')][_0xf584('0x43')]);_0x1e02db[_0xf584('0x44')]=qs[_0xf584('0x41')](_['pick'](_0x324938[_0xf584('0x27')],_0x169627[_0xf584('0x41')]));_0x1e02db[_0xf584('0x44')][_0xf584('0x45')]=_0x29e04f['id'];if(_0x324938[_0xf584('0x27')][_0xf584('0x46')]){_0x1e02db['where']=_[_0xf584('0x36')](_0x1e02db['where'],{'$or':_[_0xf584('0x21')](_0x1e02db['attributes'],function(_0x2b8f1c){var _0x2c4e32={};_0x2c4e32[_0x2b8f1c]={'$like':'%'+_0x324938[_0xf584('0x27')]['filter']+'%'};return _0x2c4e32;})});}if(_0x324938[_0xf584('0x27')][_0xf584('0x47')]){var _0x5f4d3d=_0x324938[_0xf584('0x27')]['$gte']['split'](',');var _0x524a2c={};_0x524a2c[_0x5f4d3d[0x0]]={'$gte':moment(_0x5f4d3d[0x1])['format'](_0xf584('0x48'))};_0x1e02db['where']=_[_0xf584('0x36')](_0x1e02db[_0xf584('0x44')],_0x524a2c);}_0x1e02db=_[_0xf584('0x36')]({},_0x1e02db,_0x324938[_0xf584('0x37')]);return db[_0xf584('0x3d')][_0xf584('0x17')]({'where':_0x1e02db['where']})[_0xf584('0x29')](function(_0x2433cb){_0x4d6097[_0xf584('0x17')]=_0x2433cb;if(_0x324938['query'][_0xf584('0x34')]){_0x1e02db[_0xf584('0x35')]=[{'all':!![]}];}return db[_0xf584('0x3d')][_0xf584('0x25')](_0x1e02db);})[_0xf584('0x29')](function(_0x1cf03d){_0x4d6097[_0xf584('0x49')]=_0x1cf03d;return _0x4d6097;});}})['then'](respondWithFilteredResult(_0xe811a5,_0x1e02db))[_0xf584('0x2a')](handleError(_0xe811a5,null));};exports[_0xf584('0x4a')]=function(_0x5a3c29,_0x46bd7e){return db[_0xf584('0x22')]['find']({'where':{'id':_0x5a3c29[_0xf584('0x2d')]['id']}})[_0xf584('0x29')](handleEntityNotFound(_0x46bd7e,null))['then'](function(_0x308a3b){if(_0x308a3b){return _0x308a3b[_0xf584('0x4b')](_0x5a3c29[_0xf584('0x3a')]['ids'],_['omit'](_0x5a3c29[_0xf584('0x3a')],[_0xf584('0x3e'),'id'])||{})[_0xf584('0x4c')](function(){return db[_0xf584('0x4d')][_0xf584('0x25')]({'attributes':['id',_0xf584('0x1e'),_0xf584('0x4e')],'where':{'id':_0x5a3c29[_0xf584('0x3a')]['ids']}});})[_0xf584('0x29')](function(_0x7d1386){socket[_0xf584('0x4f')](_0xf584('0x50'),{'id':Number(_0x5a3c29['params']['id']),'tags':_0x7d1386||[]});return{'id':Number(_0x5a3c29['params']['id']),'tags':_0x7d1386||[]};});}})[_0xf584('0x29')](respondWithResult(_0x46bd7e,null))[_0xf584('0x2a')](handleError(_0x46bd7e,null));};exports[_0xf584('0x51')]=function(_0x161412,_0x49b075){return db['OpenchannelInteraction'][_0xf584('0x38')]({'where':{'id':_0x161412[_0xf584('0x2d')]['id']}})[_0xf584('0x29')](handleEntityNotFound(_0x49b075,null))[_0xf584('0x29')](function(_0x44eae){if(_0x44eae){return _0x44eae[_0xf584('0x51')](_0x161412[_0xf584('0x27')][_0xf584('0x3e')]);}})['then'](respondWithStatusCode(_0x49b075,null))[_0xf584('0x2a')](handleError(_0x49b075,null));};exports[_0xf584('0x52')]=function(_0x1c308a,_0x488699){var _0x75caee=moment()[_0xf584('0x53')]()[_0xf584('0x54')]();var _0x367a2b=path[_0xf584('0x55')](config[_0xf584('0x56')],_0xf584('0x57'),_0xf584('0x58'),_0xf584('0x59'));var _0x42a02d=path[_0xf584('0x55')](config['root'],_0xf584('0x57'),_0xf584('0x58'),_0xf584('0x5a'));var _0x498c5d=path[_0xf584('0x55')](_0x367a2b,_0x75caee);var _0x4834e6=util[_0xf584('0x5b')](_0xf584('0x5c'),_0x1c308a['params']['id'],_0x75caee);var _0x203ed1=path[_0xf584('0x55')](_0x367a2b,_0x4834e6);var _0xdb8f01=[];_0xdb8f01[_0xf584('0x5d')]({'model':db[_0xf584('0x5e')],'as':_0xf584('0x5e'),'attributes':['id',_0xf584('0x5f')],'raw':!![]});_0xdb8f01[_0xf584('0x5d')]({'model':db['CmContact'],'as':_0xf584('0x60'),'attributes':['id',_0xf584('0x61'),_0xf584('0x62')],'raw':!![]});if(_0x1c308a['query'][_0xf584('0x5a')]){_0xdb8f01['push']({'model':db[_0xf584('0x63')],'as':_0xf584('0x63'),'raw':!![]});}var _0x4a4b6d=[{'model':db[_0xf584('0x3d')],'as':_0xf584('0x64'),'attributes':['id',_0xf584('0x3a'),_0xf584('0x65'),_0xf584('0x66'),_0xf584('0x67'),_0xf584('0x68')],'include':_0xdb8f01}];_0x4a4b6d[_0xf584('0x5d')]({'model':db[_0xf584('0x69')],'as':_0xf584('0x6a'),'attributes':['id','name']});_0x4a4b6d[_0xf584('0x5d')]({'model':db['User'],'as':'Owner','attributes':['id',_0xf584('0x5f')]});return db['OpenchannelInteraction'][_0xf584('0x38')]({'where':{'id':_0x1c308a[_0xf584('0x2d')]['id']},'include':_0x4a4b6d})['then'](handleEntityNotFound(_0x488699,null))[_0xf584('0x29')](function(_0x40fcea){if(_0x40fcea){var _0x522a89=_0x40fcea[_0xf584('0x6b')]({'plain':!![]});fs[_0xf584('0x6c')](_0x498c5d);var _0x8129f5={'channel':_0xf584('0x6d'),'account':_0x522a89[_0xf584('0x6a')][_0xf584('0x1e')],'agent':_0x522a89[_0xf584('0x6e')]?_0x522a89['Owner']['fullname']:'N.A.','createdAt':moment(_0x522a89[_0xf584('0x65')])['format'](_0xf584('0x48'))['toString'](),'closedAt':_0x522a89[_0xf584('0x6f')]?moment(_0x522a89[_0xf584('0x70')])[_0xf584('0x5b')](_0xf584('0x48'))[_0xf584('0x54')]():'','disposition':_0x522a89[_0xf584('0x71')],'visibility':_0x522a89['threadId']?_0xf584('0x72'):_0xf584('0x73'),'messages':_(_0x522a89[_0xf584('0x64')])[_0xf584('0x46')]({'secret':![]})[_0xf584('0x21')](function(_0x30de33){if(_0x30de33[_0xf584('0x63')]){var _0x40a0b9=path[_0xf584('0x55')](_0x42a02d,_0x30de33[_0xf584('0x63')][_0xf584('0x74')]);if(fs[_0xf584('0x75')](_0x40a0b9)){fs[_0xf584('0x76')](_0x40a0b9)[_0xf584('0x77')](fs[_0xf584('0x78')](path['join'](_0x498c5d,_0x30de33[_0xf584('0x63')][_0xf584('0x74')])));}}return{'date':moment(_0x30de33[_0xf584('0x65')])[_0xf584('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf584('0x54')](),'sender':_0x30de33[_0xf584('0x66')]===_0xf584('0x79')?_0x30de33['User']?_0x30de33[_0xf584('0x5e')][_0xf584('0x5f')]:_0xf584('0x7a'):_0x30de33[_0xf584('0x60')][_0xf584('0x61')]+(_0x30de33[_0xf584('0x60')][_0xf584('0x62')]?'\x20'+_0x30de33[_0xf584('0x60')][_0xf584('0x62')]:''),'body':_0x30de33['Attachment']?_0x30de33[_0xf584('0x63')][_0xf584('0x74')]:_0x30de33[_0xf584('0x3a')],'direction':_0x30de33[_0xf584('0x66')]==='out'?'A':'C','secret':_0x30de33[_0xf584('0x67')],'read':_0x30de33[_0xf584('0x68')],'attachment':_0x30de33[_0xf584('0x63')]};})[_0xf584('0x7b')]()};return ejs['renderFile'](path[_0xf584('0x55')](config[_0xf584('0x56')],'server','views',_0xf584('0x7c')),{'interaction':_0x8129f5})[_0xf584('0x29')](function(_0x1a7e58){var _0xfdc0b4=path['join'](_0x498c5d,_0xf584('0x7d')+_0x522a89['id']+'-'+_0x75caee+'.pdf');var _0x2f944c={'path':_0xfdc0b4,'channel':_0xf584('0x6d'),'interactionId':_0x522a89['id']};return pdf['createPdfFromHTML'](_0x1a7e58,_0x2f944c);})['then'](function(){return new Promise(function(_0x43f34e,_0x467144){zipdir(_0x498c5d,{'saveTo':_0x203ed1},function(_0x540767,_0x4e36f4){if(_0x540767)return _0x467144(_0x540767);return _0x43f34e(_0x4e36f4);});})['then'](function(){return new Promise(function(_0x212756,_0x1aa251){rimraf(_0x498c5d,function(_0x5327ff){if(_0x5327ff)_0x1aa251(_0x5327ff);return _0x212756();});});})[_0xf584('0x29')](function(){return _0x488699['download'](_0x203ed1,_0x4834e6,function(_0x3da096){if(_0x3da096){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x3da096);}else{fs[_0xf584('0x7e')](_0x203ed1);}});});});}else{return _0x488699[_0xf584('0x10')](0xc8);}})['catch'](handleError(_0x488699,null));}; \ No newline at end of file +var _0x7545=['Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','end','json','offset','limit','count','status','Content-Range','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','getOptions','findAll','openchannel','query','user','show','type','from','params','keys','OpenchannelInteraction','filters','fields','attributes','length','model','includeAll','include','merge','options','find','catch','create','body','update','destroy','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','intersection','hasOwnProperty','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','disposition','threadId','Public','Private','map','existsSync','createReadStream','createWriteStream','basename','System','Contact','out','value','renderFile','views','downloadInteraction.ejs','.pdf'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x7545,0x10c));var _0x5754=function(_0x325cf2,_0x1aba44){_0x325cf2=_0x325cf2-0x0;var _0x51d67b=_0x7545[_0x325cf2];return _0x51d67b;};'use strict';var rimraf=require(_0x5754('0x0'));var zipdir=require(_0x5754('0x1'));var moment=require(_0x5754('0x2'));var util=require('util');var path=require(_0x5754('0x3'));var ejs=require(_0x5754('0x4'));var fs=require('fs');var _=require(_0x5754('0x5'));var Redis=require(_0x5754('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x5754('0x7'));var pdf=require(_0x5754('0x8'));var logger=require(_0x5754('0x9'))(_0x5754('0xa'));var config=require(_0x5754('0xb'));var db=require(_0x5754('0xc'))['db'];config[_0x5754('0xd')]=_[_0x5754('0xe')](config['redis'],{'host':_0x5754('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5754('0xd')]));require(_0x5754('0x10'))['register'](socket);function respondWithStatusCode(_0xdc498d,_0x4ba0cb){_0x4ba0cb=_0x4ba0cb||0xcc;return function(_0x1d9bb1){if(_0x1d9bb1){return _0xdc498d['sendStatus'](_0x4ba0cb);}return _0xdc498d['status'](_0x4ba0cb)[_0x5754('0x11')]();};}function respondWithResult(_0x4ec8bd,_0x1ebe6b){_0x1ebe6b=_0x1ebe6b||0xc8;return function(_0x30ef57){if(_0x30ef57){return _0x4ec8bd['status'](_0x1ebe6b)[_0x5754('0x12')](_0x30ef57);}};}function respondWithFilteredResult(_0xbd081,_0x5d6aa5){return function(_0x16921b){if(_0x16921b){var _0x225029=typeof _0x5d6aa5[_0x5754('0x13')]==='undefined'&&typeof _0x5d6aa5[_0x5754('0x14')]==='undefined';var _0x126ed5=_0x16921b['count'];var _0x1af655=_0x225029?0x0:_0x5d6aa5[_0x5754('0x13')];var _0x3ddb01=_0x225029?_0x16921b[_0x5754('0x15')]:_0x5d6aa5['offset']+_0x5d6aa5['limit'];var _0x1e87e6;if(_0x3ddb01>=_0x126ed5){_0x3ddb01=_0x126ed5;_0x1e87e6=0xc8;}else{_0x1e87e6=0xce;}_0xbd081[_0x5754('0x16')](_0x1e87e6);return _0xbd081['set'](_0x5754('0x17'),_0x1af655+'-'+_0x3ddb01+'/'+_0x126ed5)[_0x5754('0x12')](_0x16921b);}return null;};}function saveUpdates(_0x339d4b){return function(_0xeb600f){if(_0xeb600f){return _0xeb600f['update'](_0x339d4b)[_0x5754('0x18')](function(_0x1b9597){return _0x1b9597;});}return null;};}function removeEntity(_0x27ca03){return function(_0x3fa683){if(_0x3fa683){return _0x3fa683['destroy']()[_0x5754('0x18')](function(){_0x27ca03[_0x5754('0x16')](0xcc)[_0x5754('0x11')]();});}};}function handleEntityNotFound(_0x72b953){return function(_0x6cea9f){if(!_0x6cea9f){_0x72b953[_0x5754('0x19')](0x194);}return _0x6cea9f;};}function handleError(_0x590b5c,_0x239393){_0x239393=_0x239393||0x1f4;return function(_0x24f264){logger[_0x5754('0x1a')](_0x24f264[_0x5754('0x1b')]);if(_0x24f264[_0x5754('0x1c')]){delete _0x24f264['name'];}_0x590b5c[_0x5754('0x16')](_0x239393)[_0x5754('0x1d')](_0x24f264);};}exports['index']=function(_0x261315,_0x18b475){var _0x1384d4={};var _0x1d0f62=_['map'](db['OpenchannelInteraction'][_0x5754('0x1e')],function(_0x4d2dff){return{'name':_0x4d2dff[_0x5754('0x1f')],'type':_0x4d2dff['type']['key']};});_0x1384d4=qs[_0x5754('0x20')](_0x1d0f62,_0x261315);return interaction[_0x5754('0x21')](_0x5754('0x22'),_0x261315[_0x5754('0x23')],_0x261315[_0x5754('0x24')],_0x1384d4,_0x1d0f62)['then'](respondWithFilteredResult(_0x18b475,_0x1384d4))['catch'](handleError(_0x18b475,null));};exports[_0x5754('0x25')]=function(_0x5464d4,_0x18479f){var _0x15b81b={};if(_0x5464d4[_0x5754('0x23')][_0x5754('0x26')]&&_0x5464d4[_0x5754('0x23')][_0x5754('0x26')]===_0x5754('0x27')){_0x15b81b['from']=_0x5464d4[_0x5754('0x28')]['id'];}else{_0x15b81b['id']=_0x5464d4[_0x5754('0x28')]['id'];}var _0xae8d5={'raw':![],'where':_0x15b81b},_0x44aba5={};_0x44aba5['model']=_[_0x5754('0x29')](db[_0x5754('0x2a')][_0x5754('0x1e')]);_0x44aba5[_0x5754('0x23')]=_[_0x5754('0x29')](_0x5464d4[_0x5754('0x23')]);_0x44aba5[_0x5754('0x2b')]=_['intersection'](_0x44aba5['model'],_0x44aba5[_0x5754('0x23')]);_0xae8d5['attributes']=_['intersection'](_0x44aba5['model'],qs['fields'](_0x5464d4[_0x5754('0x23')][_0x5754('0x2c')]));_0xae8d5[_0x5754('0x2d')]=_0xae8d5['attributes'][_0x5754('0x2e')]?_0xae8d5['attributes']:_0x44aba5[_0x5754('0x2f')];if(_0x5464d4['query'][_0x5754('0x30')]){_0xae8d5[_0x5754('0x31')]=[{'all':!![]}];}_0xae8d5=_[_0x5754('0x32')]({},_0xae8d5,_0x5464d4[_0x5754('0x33')]);return db[_0x5754('0x2a')][_0x5754('0x34')](_0xae8d5)[_0x5754('0x18')](handleEntityNotFound(_0x18479f,null))[_0x5754('0x18')](respondWithResult(_0x18479f,null))[_0x5754('0x35')](handleError(_0x18479f,null));};exports[_0x5754('0x36')]=function(_0x274283,_0x477597){return db[_0x5754('0x2a')][_0x5754('0x36')](_0x274283[_0x5754('0x37')],{})[_0x5754('0x18')](respondWithResult(_0x477597,0xc9))['catch'](handleError(_0x477597,null));};exports[_0x5754('0x38')]=function(_0x50272b,_0x5bdc6f){if(_0x50272b[_0x5754('0x37')]['id']){delete _0x50272b['body']['id'];}return db[_0x5754('0x2a')][_0x5754('0x34')]({'where':{'id':_0x50272b[_0x5754('0x28')]['id']}})[_0x5754('0x18')](handleEntityNotFound(_0x5bdc6f,null))[_0x5754('0x18')](saveUpdates(_0x50272b[_0x5754('0x37')],null))[_0x5754('0x18')](respondWithResult(_0x5bdc6f,null))['catch'](handleError(_0x5bdc6f,null));};exports[_0x5754('0x39')]=function(_0xfa1a19,_0x576167){return db['OpenchannelInteraction'][_0x5754('0x34')]({'where':{'id':_0xfa1a19[_0x5754('0x28')]['id']}})[_0x5754('0x18')](handleEntityNotFound(_0x576167,null))[_0x5754('0x18')](removeEntity(_0x576167,null))[_0x5754('0x35')](handleError(_0x576167,null));};exports['describe']=function(_0x3ab7e3,_0x184b46){return db['OpenchannelInteraction'][_0x5754('0x3a')]()[_0x5754('0x18')](respondWithResult(_0x184b46,null))['catch'](handleError(_0x184b46,null));};exports[_0x5754('0x3b')]=function(_0x227cdd,_0x30feb1){return db['OpenchannelMessage']['find']({'where':{'id':_0x227cdd['params']['id']}})[_0x5754('0x18')](handleEntityNotFound(_0x30feb1,null))['then'](function(_0x583efb){if(_0x583efb){return _0x583efb[_0x5754('0x3b')](_0x227cdd[_0x5754('0x37')]['ids'],_[_0x5754('0x3c')](_0x227cdd[_0x5754('0x37')],[_0x5754('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x30feb1,null))['catch'](handleError(_0x30feb1,null));};exports[_0x5754('0x3e')]=function(_0x259477,_0x5aecb0){var _0x4c3354={'raw':![],'where':{}};var _0x240771={};var _0x5e1db3={'count':0x0,'rows':[]};return db[_0x5754('0x2a')][_0x5754('0x3f')]({'where':{'id':_0x259477['params']['id']}})[_0x5754('0x18')](handleEntityNotFound(_0x5aecb0,null))['then'](function(_0x556f4a){if(_0x556f4a){_0x240771[_0x5754('0x2f')]=_[_0x5754('0x29')](db[_0x5754('0x40')]['rawAttributes']);_0x240771['query']=_[_0x5754('0x29')](_0x259477['query']);_0x240771['filters']=_[_0x5754('0x41')](_0x240771['model'],_0x240771[_0x5754('0x23')]);_0x4c3354[_0x5754('0x2d')]=_['intersection'](_0x240771[_0x5754('0x2f')],qs[_0x5754('0x2c')](_0x259477[_0x5754('0x23')][_0x5754('0x2c')]));_0x4c3354['attributes']=_0x4c3354[_0x5754('0x2d')][_0x5754('0x2e')]?_0x4c3354[_0x5754('0x2d')]:_0x240771[_0x5754('0x2f')];if(!_0x259477[_0x5754('0x23')][_0x5754('0x42')]('nolimit')){_0x4c3354[_0x5754('0x14')]=qs['limit'](_0x259477['query'][_0x5754('0x14')]);_0x4c3354[_0x5754('0x13')]=qs[_0x5754('0x13')](_0x259477[_0x5754('0x23')]['offset']);}_0x4c3354[_0x5754('0x43')]=qs['sort'](_0x259477[_0x5754('0x23')][_0x5754('0x44')]);_0x4c3354['where']=qs[_0x5754('0x2b')](_[_0x5754('0x45')](_0x259477['query'],_0x240771[_0x5754('0x2b')]));_0x4c3354[_0x5754('0x46')]['OpenchannelInteractionId']=_0x556f4a['id'];if(_0x259477['query'][_0x5754('0x47')]){_0x4c3354[_0x5754('0x46')]=_[_0x5754('0x32')](_0x4c3354[_0x5754('0x46')],{'$or':_['map'](_0x4c3354['attributes'],function(_0x5613b8){var _0x578668={};_0x578668[_0x5613b8]={'$like':'%'+_0x259477[_0x5754('0x23')][_0x5754('0x47')]+'%'};return _0x578668;})});}if(_0x259477['query'][_0x5754('0x48')]){var _0x4b5bf6=_0x259477[_0x5754('0x23')][_0x5754('0x48')][_0x5754('0x49')](',');var _0x13e616={};_0x13e616[_0x4b5bf6[0x0]]={'$gte':moment(_0x4b5bf6[0x1])[_0x5754('0x4a')](_0x5754('0x4b'))};_0x4c3354[_0x5754('0x46')]=_['merge'](_0x4c3354['where'],_0x13e616);}_0x4c3354=_[_0x5754('0x32')]({},_0x4c3354,_0x259477[_0x5754('0x33')]);return db[_0x5754('0x40')][_0x5754('0x15')]({'where':_0x4c3354['where']})['then'](function(_0x5543eb){_0x5e1db3[_0x5754('0x15')]=_0x5543eb;if(_0x259477[_0x5754('0x23')][_0x5754('0x30')]){_0x4c3354['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x5754('0x21')](_0x4c3354);})[_0x5754('0x18')](function(_0x1d5027){_0x5e1db3[_0x5754('0x4c')]=_0x1d5027;return _0x5e1db3;});}})[_0x5754('0x18')](respondWithFilteredResult(_0x5aecb0,_0x4c3354))[_0x5754('0x35')](handleError(_0x5aecb0,null));};exports['addTags']=function(_0x1947f9,_0xead773){return db[_0x5754('0x2a')][_0x5754('0x34')]({'where':{'id':_0x1947f9[_0x5754('0x28')]['id']}})[_0x5754('0x18')](handleEntityNotFound(_0xead773,null))['then'](function(_0x2dec2c){if(_0x2dec2c){return _0x2dec2c[_0x5754('0x4d')](_0x1947f9[_0x5754('0x37')][_0x5754('0x3d')],_[_0x5754('0x3c')](_0x1947f9[_0x5754('0x37')],[_0x5754('0x3d'),'id'])||{})[_0x5754('0x4e')](function(){return db[_0x5754('0x4f')]['findAll']({'attributes':['id',_0x5754('0x1c'),_0x5754('0x50')],'where':{'id':_0x1947f9[_0x5754('0x37')]['ids']}});})[_0x5754('0x18')](function(_0x2aaad2){socket[_0x5754('0x51')](_0x5754('0x52'),{'id':Number(_0x1947f9[_0x5754('0x28')]['id']),'tags':_0x2aaad2||[]});return{'id':Number(_0x1947f9[_0x5754('0x28')]['id']),'tags':_0x2aaad2||[]};});}})[_0x5754('0x18')](respondWithResult(_0xead773,null))['catch'](handleError(_0xead773,null));};exports['removeTags']=function(_0x451cff,_0x1bf0b5){return db[_0x5754('0x2a')][_0x5754('0x34')]({'where':{'id':_0x451cff[_0x5754('0x28')]['id']}})[_0x5754('0x18')](handleEntityNotFound(_0x1bf0b5,null))[_0x5754('0x18')](function(_0x4c5393){if(_0x4c5393){return _0x4c5393[_0x5754('0x53')](_0x451cff[_0x5754('0x23')][_0x5754('0x3d')]);}})[_0x5754('0x18')](respondWithStatusCode(_0x1bf0b5,null))[_0x5754('0x35')](handleError(_0x1bf0b5,null));};exports[_0x5754('0x54')]=function(_0x259b42,_0x2f8521){var _0x2b1c17=moment()['unix']()[_0x5754('0x55')]();var _0x1c092b=path[_0x5754('0x56')](config[_0x5754('0x57')],_0x5754('0x58'),_0x5754('0x59'),_0x5754('0x5a'));var _0x23fd69=path[_0x5754('0x56')](config[_0x5754('0x57')],_0x5754('0x58'),_0x5754('0x59'),_0x5754('0x5b'));var _0x54e11d=path[_0x5754('0x56')](_0x1c092b,_0x2b1c17);var _0x123a05=util[_0x5754('0x4a')](_0x5754('0x5c'),_0x259b42[_0x5754('0x28')]['id'],_0x2b1c17);var _0x21dbbb=path[_0x5754('0x56')](_0x1c092b,_0x123a05);var _0x3ebde0=[];_0x3ebde0[_0x5754('0x5d')]({'model':db[_0x5754('0x5e')],'as':_0x5754('0x5e'),'attributes':['id',_0x5754('0x5f')],'raw':!![]});_0x3ebde0[_0x5754('0x5d')]({'model':db[_0x5754('0x60')],'as':'Contact','attributes':['id',_0x5754('0x61'),_0x5754('0x62')],'raw':!![]});if(_0x259b42[_0x5754('0x23')][_0x5754('0x5b')]){_0x3ebde0[_0x5754('0x5d')]({'model':db['Attachment'],'as':_0x5754('0x63'),'raw':!![]});}var _0x47084f=[{'model':db[_0x5754('0x40')],'as':_0x5754('0x64'),'attributes':['id',_0x5754('0x37'),_0x5754('0x65'),_0x5754('0x66'),_0x5754('0x67'),_0x5754('0x68')],'include':_0x3ebde0}];_0x47084f['push']({'model':db[_0x5754('0x69')],'as':_0x5754('0x6a'),'attributes':['id','name']});_0x47084f[_0x5754('0x5d')]({'model':db[_0x5754('0x5e')],'as':_0x5754('0x6b'),'attributes':['id',_0x5754('0x5f')]});return db[_0x5754('0x2a')][_0x5754('0x34')]({'where':{'id':_0x259b42[_0x5754('0x28')]['id']},'include':_0x47084f})[_0x5754('0x18')](handleEntityNotFound(_0x2f8521,null))[_0x5754('0x18')](function(_0x141ebe){if(_0x141ebe){var _0x26d1d2=_0x141ebe[_0x5754('0x6c')]({'plain':!![]});fs[_0x5754('0x6d')](_0x54e11d);var _0x3d3b29={'channel':'Openchannel','account':_0x26d1d2[_0x5754('0x6a')][_0x5754('0x1c')],'agent':_0x26d1d2[_0x5754('0x6b')]?_0x26d1d2[_0x5754('0x6b')][_0x5754('0x5f')]:_0x5754('0x6e'),'createdAt':moment(_0x26d1d2[_0x5754('0x65')])[_0x5754('0x4a')](_0x5754('0x4b'))['toString'](),'closedAt':_0x26d1d2['closed']?moment(_0x26d1d2['closedAt'])[_0x5754('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5754('0x55')]():'','disposition':_0x26d1d2[_0x5754('0x6f')],'visibility':_0x26d1d2[_0x5754('0x70')]?_0x5754('0x71'):_0x5754('0x72'),'messages':_(_0x26d1d2[_0x5754('0x64')])[_0x5754('0x47')]({'secret':![]})[_0x5754('0x73')](function(_0x82ae4d){if(_0x82ae4d[_0x5754('0x63')]){var _0x4fa996=path['join'](_0x23fd69,_0x82ae4d[_0x5754('0x63')]['basename']);if(fs[_0x5754('0x74')](_0x4fa996)){fs[_0x5754('0x75')](_0x4fa996)['pipe'](fs[_0x5754('0x76')](path['join'](_0x54e11d,_0x82ae4d[_0x5754('0x63')][_0x5754('0x77')])));}}return{'date':moment(_0x82ae4d[_0x5754('0x65')])[_0x5754('0x4a')](_0x5754('0x4b'))['toString'](),'sender':_0x82ae4d[_0x5754('0x66')]==='out'?_0x82ae4d[_0x5754('0x5e')]?_0x82ae4d[_0x5754('0x5e')][_0x5754('0x5f')]:_0x5754('0x78'):_0x82ae4d[_0x5754('0x79')][_0x5754('0x61')]+(_0x82ae4d[_0x5754('0x79')][_0x5754('0x62')]?'\x20'+_0x82ae4d[_0x5754('0x79')]['lastName']:''),'body':_0x82ae4d[_0x5754('0x63')]?_0x82ae4d[_0x5754('0x63')]['basename']:_0x82ae4d['body'],'direction':_0x82ae4d[_0x5754('0x66')]===_0x5754('0x7a')?'A':'C','secret':_0x82ae4d[_0x5754('0x67')],'read':_0x82ae4d[_0x5754('0x68')],'attachment':_0x82ae4d[_0x5754('0x63')]};})[_0x5754('0x7b')]()};return ejs[_0x5754('0x7c')](path['join'](config[_0x5754('0x57')],_0x5754('0x58'),_0x5754('0x7d'),_0x5754('0x7e')),{'interaction':_0x3d3b29})[_0x5754('0x18')](function(_0x4caf09){var _0xce1a78=path['join'](_0x54e11d,'transcript-'+_0x26d1d2['id']+'-'+_0x2b1c17+_0x5754('0x7f'));var _0x3ed06d={'path':_0xce1a78,'channel':_0x5754('0x80'),'interactionId':_0x26d1d2['id']};return pdf[_0x5754('0x81')](_0x4caf09,_0x3ed06d);})[_0x5754('0x18')](function(){return new Promise(function(_0x140864,_0x574093){zipdir(_0x54e11d,{'saveTo':_0x21dbbb},function(_0x39e196,_0x57bfcf){if(_0x39e196)return _0x574093(_0x39e196);return _0x140864(_0x57bfcf);});})[_0x5754('0x18')](function(){return new Promise(function(_0x966d56,_0x545728){rimraf(_0x54e11d,function(_0x14c00a){if(_0x14c00a)_0x545728(_0x14c00a);return _0x966d56();});});})['then'](function(){return _0x2f8521['download'](_0x21dbbb,_0x123a05,function(_0x54d5b7){if(_0x54d5b7){logger[_0x5754('0x1a')](_0x5754('0x82'),_0x54d5b7);}else{fs[_0x5754('0x83')](_0x21dbbb);}});});});}else{return _0x2f8521[_0x5754('0x19')](0xc8);}})[_0x5754('0x35')](handleError(_0x2f8521,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1e584a2..ce43416 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 _0x7b02=['remove','getUsers','then','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','save','update'];(function(_0x2692c3,_0xf50f49){var _0x3845b1=function(_0x12f9cd){while(--_0x12f9cd){_0x2692c3['push'](_0x2692c3['shift']());}};_0x3845b1(++_0xf50f49);}(_0x7b02,0x71));var _0x27b0=function(_0x1e31bc,_0x3ce1c0){_0x1e31bc=_0x1e31bc-0x0;var _0x5adbb4=_0x7b02[_0x1e31bc];return _0x5adbb4;};'use strict';var EventEmitter=require(_0x27b0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x27b0('0x1')];var OpenchannelMessage=require(_0x27b0('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x27b0('0x3')](0x0);var events={'afterCreate':_0x27b0('0x4'),'afterUpdate':_0x27b0('0x5'),'afterDestroy':_0x27b0('0x6')};function emitEvent(_0x2c8059){return function(_0x3f98a5,_0x507179,_0x17b238){_0x3f98a5[_0x27b0('0x7')]({'attributes':['id'],'raw':!![]})[_0x27b0('0x8')](function(_0x9e6e65){_0x3f98a5['setDataValue']('Users',_0x9e6e65[_0x27b0('0x9')](function(_0x5b1c37){return{'id':_0x5b1c37['id']};}));return OpenchannelMessage[_0x27b0('0xa')]({'where':{'OpenchannelInteractionId':_0x3f98a5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x27b0('0x8')](function(_0x2f1e85){_0x3f98a5['setDataValue'](_0x27b0('0xb'),_0x2f1e85[_0x27b0('0xc')]);OpenchannelInteractionEvents[_0x27b0('0xd')](_0x2c8059+':'+_0x3f98a5['id'],_0x3f98a5);OpenchannelInteractionEvents[_0x27b0('0xd')](_0x2c8059,_0x3f98a5);_0x17b238(null);})[_0x27b0('0xe')](_0x17b238(null));};}for(var e in events){if(events[_0x27b0('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x27b0('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xfc56=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','then','Users','map','findAll','setDataValue'];(function(_0x15bc2f,_0x25e563){var _0x574008=function(_0x220bee){while(--_0x220bee){_0x15bc2f['push'](_0x15bc2f['shift']());}};_0x574008(++_0x25e563);}(_0xfc56,0x14b));var _0x6fc5=function(_0x1a4b48,_0x4458ad){_0x1a4b48=_0x1a4b48-0x0;var _0x31a1d6=_0xfc56[_0x1a4b48];return _0x31a1d6;};'use strict';var EventEmitter=require(_0x6fc5('0x0'));var OpenchannelInteraction=require(_0x6fc5('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x6fc5('0x1'))['db'][_0x6fc5('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6fc5('0x3')](0x0);var events={'afterCreate':_0x6fc5('0x4'),'afterUpdate':_0x6fc5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c3ead){return function(_0x536478,_0x42f361,_0x1d4482){_0x536478['getUsers']({'attributes':['id'],'raw':!![]})[_0x6fc5('0x6')](function(_0x145825){_0x536478['setDataValue'](_0x6fc5('0x7'),_0x145825[_0x6fc5('0x8')](function(_0x231c9f){return{'id':_0x231c9f['id']};}));return OpenchannelMessage[_0x6fc5('0x9')]({'where':{'OpenchannelInteractionId':_0x536478['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6fc5('0x6')](function(_0x2b52e4){_0x536478[_0x6fc5('0xa')](_0x6fc5('0xb'),_0x2b52e4[_0x6fc5('0xc')]);OpenchannelInteractionEvents[_0x6fc5('0xd')](_0x2c3ead+':'+_0x536478['id'],_0x536478);OpenchannelInteractionEvents[_0x6fc5('0xd')](_0x2c3ead,_0x536478);_0x1d4482(null);})[_0x6fc5('0xe')](_0x1d4482(null));};}for(var e in events){if(events[_0x6fc5('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x6fc5('0x10')](e,emitEvent(event));}}module[_0x6fc5('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1d477b6..09c2b63 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 _0x5fed=['../../config/logger','api','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x18e9fd,_0x5dd85d){var _0xa540b4=function(_0x522297){while(--_0x522297){_0x18e9fd['push'](_0x18e9fd['shift']());}};_0xa540b4(++_0x5dd85d);}(_0x5fed,0x1a7));var _0xd5fe=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0x5fed[_0x770f7];return _0xe797c6;};'use strict';var _=require(_0xd5fe('0x0'));var util=require(_0xd5fe('0x1'));var logger=require(_0xd5fe('0x2'))(_0xd5fe('0x3'));var moment=require(_0xd5fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xd5fe('0x5'));var fs=require('fs');var path=require(_0xd5fe('0x6'));var rimraf=require(_0xd5fe('0x7'));var config=require('../../config/environment');var attributes=require(_0xd5fe('0x8'));module[_0xd5fe('0x9')]=function(_0x27c81f,_0x1b3817){return _0x27c81f[_0xd5fe('0xa')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd5fe('0xb'),'collate':_0xd5fe('0xc'),'hooks':{'beforeUpdate':function(_0xf2fe6f,_0x7234bd,_0x3dea41){if(_0xf2fe6f['changed'](_0xd5fe('0xd'))){_0xf2fe6f[_0xd5fe('0xe')]=moment()[_0xd5fe('0xf')](_0xd5fe('0x10'));}_0x3dea41(null,_0xf2fe6f);}}});}; \ No newline at end of file +var _0xc035=['OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x41c8d5,_0xe283e1){var _0xfa818e=function(_0x2102af){while(--_0x2102af){_0x41c8d5['push'](_0x41c8d5['shift']());}};_0xfa818e(++_0xe283e1);}(_0xc035,0xf6));var _0x5c03=function(_0x183eab,_0x4b8f40){_0x183eab=_0x183eab-0x0;var _0x3845d6=_0xc035[_0x183eab];return _0x3845d6;};'use strict';var _=require(_0x5c03('0x0'));var util=require('util');var logger=require(_0x5c03('0x1'))(_0x5c03('0x2'));var moment=require(_0x5c03('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c03('0x4'));var fs=require('fs');var path=require(_0x5c03('0x5'));var rimraf=require(_0x5c03('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x5c03('0x7')]=function(_0x50c273,_0x518514){return _0x50c273[_0x5c03('0x8')](_0x5c03('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5c03('0xa'),'collate':_0x5c03('0xb'),'hooks':{'beforeUpdate':function(_0x4243f8,_0x577eb4,_0x5c4892){if(_0x4243f8['changed'](_0x5c03('0xc'))){_0x4243f8[_0x5c03('0xd')]=moment()['format'](_0x5c03('0xe'));}_0x5c4892(null,_0x4243f8);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6f8d5e3..9c5fce5 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 _0xd090=['http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelInteraction','update','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0xf18977,_0x87ecc4){var _0x360bb8=function(_0x58a178){while(--_0x58a178){_0xf18977['push'](_0xf18977['shift']());}};_0x360bb8(++_0x87ecc4);}(_0xd090,0x1c5));var _0x0d09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd090[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0d09('0x0'));var moment=require(_0x0d09('0x1'));var BPromise=require(_0x0d09('0x2'));var rs=require(_0x0d09('0x3'));var fs=require('fs');var Redis=require(_0x0d09('0x4'));var db=require(_0x0d09('0x5'))['db'];var utils=require(_0x0d09('0x6'));var logger=require('../../config/logger')(_0x0d09('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d09('0x8'));var client=jayson['client'][_0x0d09('0x9')]({'port':0x232a});config[_0x0d09('0xa')]=_[_0x0d09('0xb')](config['redis'],{'host':_0x0d09('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d09('0xa')]));require(_0x0d09('0xd'))[_0x0d09('0xe')](socket);function respondWithRpcPromise(_0x53ffa8,_0x2cb0b3,_0x27c825){return new BPromise(function(_0xc2f874,_0x3632b6){return client[_0x0d09('0xf')](_0x53ffa8,_0x27c825)[_0x0d09('0x10')](function(_0x5eb105){logger['info'](_0x0d09('0x11'),_0x2cb0b3,_0x0d09('0x12'));logger[_0x0d09('0x13')](_0x0d09('0x14'),_0x2cb0b3,_0x0d09('0x12'),JSON[_0x0d09('0x15')](_0x5eb105));if(_0x5eb105[_0x0d09('0x16')]){if(_0x5eb105['error'][_0x0d09('0x17')]===0x1f4){logger[_0x0d09('0x16')](_0x0d09('0x11'),_0x2cb0b3,_0x5eb105['error']['message']);return _0x3632b6(_0x5eb105[_0x0d09('0x16')]['message']);}logger['error'](_0x0d09('0x11'),_0x2cb0b3,_0x5eb105[_0x0d09('0x16')][_0x0d09('0x18')]);return _0xc2f874(_0x5eb105['error'][_0x0d09('0x18')]);}else{logger[_0x0d09('0x19')](_0x0d09('0x11'),_0x2cb0b3,_0x0d09('0x12'));_0xc2f874(_0x5eb105['result'][_0x0d09('0x18')]);}})[_0x0d09('0x1a')](function(_0x26192a){logger[_0x0d09('0x16')](_0x0d09('0x11'),_0x2cb0b3,_0x26192a);_0x3632b6(_0x26192a);});});}exports['UpdateOpenchannelInteraction']=function(_0x48f014){var _0x378f09=this;return new Promise(function(_0x2f195b,_0x569767){return db[_0x0d09('0x1b')][_0x0d09('0x1c')](_0x48f014['body'],{'raw':_0x48f014[_0x0d09('0x1d')]?_0x48f014[_0x0d09('0x1d')][_0x0d09('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48f014[_0x0d09('0x1d')]?_0x48f014[_0x0d09('0x1d')][_0x0d09('0x1f')]||null:null,'attributes':_0x48f014[_0x0d09('0x1d')]?_0x48f014[_0x0d09('0x1d')][_0x0d09('0x20')]||null:null,'limit':_0x48f014[_0x0d09('0x1d')]?_0x48f014['options'][_0x0d09('0x21')]||null:null})['then'](function(_0x16e48c){logger[_0x0d09('0x19')]('UpdateOpenchannelInteraction',_0x48f014);logger[_0x0d09('0x13')]('UpdateOpenchannelInteraction',_0x48f014,JSON[_0x0d09('0x15')](_0x16e48c));_0x2f195b(_0x16e48c);})[_0x0d09('0x1a')](function(_0x267fb2){logger['error']('UpdateOpenchannelInteraction',_0x267fb2[_0x0d09('0x18')],_0x48f014);_0x569767(_0x378f09['error'](0x1f4,_0x267fb2[_0x0d09('0x18')]));});});};exports[_0x0d09('0x22')]=function(_0x1404a6){return new Promise(function(_0x5be523,_0x49b114){return db[_0x0d09('0x1b')][_0x0d09('0x23')]({'where':_0x1404a6[_0x0d09('0x1d')]?_0x1404a6['options'][_0x0d09('0x1f')]||null:null})[_0x0d09('0x10')](function(_0x59b54d){if(_0x59b54d){return _0x59b54d[_0x0d09('0x24')](_0x1404a6[_0x0d09('0x25')][_0x0d09('0x26')],_[_0x0d09('0x27')](_0x1404a6[_0x0d09('0x25')],[_0x0d09('0x26'),'id'])||{});}})[_0x0d09('0x28')](function(_0x541543){logger['info'](_0x0d09('0x29'),_0x1404a6);logger[_0x0d09('0x13')](_0x0d09('0x29'),_0x1404a6,JSON[_0x0d09('0x15')](_0x541543));_0x5be523(_0x541543);})[_0x0d09('0x1a')](function(_0x249183){logger[_0x0d09('0x16')](_0x0d09('0x29'),_0x249183['message'],_0x1404a6);_0x49b114(_this[_0x0d09('0x16')](0x1f4,_0x249183[_0x0d09('0x18')]));});});}; \ No newline at end of file +var _0x4a24=['catch','UpdateOpenchannelInteraction','update','options','where','attributes','limit','debug','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x366966,_0x54f134){var _0x354a14=function(_0x308280){while(--_0x308280){_0x366966['push'](_0x366966['shift']());}};_0x354a14(++_0x54f134);}(_0x4a24,0x162));var _0x44a2=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x4a24[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x44a2('0x0'));var util=require('util');var moment=require(_0x44a2('0x1'));var BPromise=require('bluebird');var rs=require(_0x44a2('0x2'));var fs=require('fs');var Redis=require(_0x44a2('0x3'));var db=require(_0x44a2('0x4'))['db'];var utils=require(_0x44a2('0x5'));var logger=require(_0x44a2('0x6'))(_0x44a2('0x7'));var config=require(_0x44a2('0x8'));var jayson=require(_0x44a2('0x9'));var client=jayson[_0x44a2('0xa')][_0x44a2('0xb')]({'port':0x232a});config['redis']=_[_0x44a2('0xc')](config[_0x44a2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x44a2('0xe'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x44a2('0xf')](socket);function respondWithRpcPromise(_0x3851e6,_0x5f1d94,_0x244dea){return new BPromise(function(_0x28b36f,_0x46cbb0){return client['request'](_0x3851e6,_0x244dea)[_0x44a2('0x10')](function(_0x3c79bf){logger[_0x44a2('0x11')](_0x44a2('0x12'),_0x5f1d94,_0x44a2('0x13'));logger['debug'](_0x44a2('0x14'),_0x5f1d94,_0x44a2('0x13'),JSON['stringify'](_0x3c79bf));if(_0x3c79bf['error']){if(_0x3c79bf[_0x44a2('0x15')][_0x44a2('0x16')]===0x1f4){logger[_0x44a2('0x15')](_0x44a2('0x12'),_0x5f1d94,_0x3c79bf[_0x44a2('0x15')]['message']);return _0x46cbb0(_0x3c79bf[_0x44a2('0x15')][_0x44a2('0x17')]);}logger[_0x44a2('0x15')](_0x44a2('0x12'),_0x5f1d94,_0x3c79bf[_0x44a2('0x15')][_0x44a2('0x17')]);return _0x28b36f(_0x3c79bf[_0x44a2('0x15')][_0x44a2('0x17')]);}else{logger[_0x44a2('0x11')](_0x44a2('0x12'),_0x5f1d94,'request\x20sent');_0x28b36f(_0x3c79bf['result'][_0x44a2('0x17')]);}})[_0x44a2('0x18')](function(_0x58fe32){logger['error'](_0x44a2('0x12'),_0x5f1d94,_0x58fe32);_0x46cbb0(_0x58fe32);});});}exports[_0x44a2('0x19')]=function(_0x3cada3){var _0x2a6464=this;return new Promise(function(_0x4c0ad4,_0x52006d){return db['OpenchannelInteraction'][_0x44a2('0x1a')](_0x3cada3['body'],{'raw':_0x3cada3['options']?_0x3cada3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cada3[_0x44a2('0x1b')]?_0x3cada3[_0x44a2('0x1b')][_0x44a2('0x1c')]||null:null,'attributes':_0x3cada3[_0x44a2('0x1b')]?_0x3cada3[_0x44a2('0x1b')][_0x44a2('0x1d')]||null:null,'limit':_0x3cada3[_0x44a2('0x1b')]?_0x3cada3[_0x44a2('0x1b')][_0x44a2('0x1e')]||null:null})[_0x44a2('0x10')](function(_0x4119e0){logger['info'](_0x44a2('0x19'),_0x3cada3);logger[_0x44a2('0x1f')](_0x44a2('0x19'),_0x3cada3,JSON[_0x44a2('0x20')](_0x4119e0));_0x4c0ad4(_0x4119e0);})[_0x44a2('0x18')](function(_0x3ac0a5){logger[_0x44a2('0x15')](_0x44a2('0x19'),_0x3ac0a5[_0x44a2('0x17')],_0x3cada3);_0x52006d(_0x2a6464[_0x44a2('0x15')](0x1f4,_0x3ac0a5[_0x44a2('0x17')]));});});};exports[_0x44a2('0x21')]=function(_0x216318){return new Promise(function(_0x668af2,_0x4f97fa){return db[_0x44a2('0x22')][_0x44a2('0x23')]({'where':_0x216318[_0x44a2('0x1b')]?_0x216318[_0x44a2('0x1b')][_0x44a2('0x1c')]||null:null})[_0x44a2('0x10')](function(_0x19e0c8){if(_0x19e0c8){return _0x19e0c8[_0x44a2('0x24')](_0x216318[_0x44a2('0x25')][_0x44a2('0x26')],_[_0x44a2('0x27')](_0x216318[_0x44a2('0x25')],[_0x44a2('0x26'),'id'])||{});}})[_0x44a2('0x28')](function(_0x481929){logger[_0x44a2('0x11')](_0x44a2('0x29'),_0x216318);logger[_0x44a2('0x1f')](_0x44a2('0x29'),_0x216318,JSON['stringify'](_0x481929));_0x668af2(_0x481929);})[_0x44a2('0x18')](function(_0x49baec){logger[_0x44a2('0x15')](_0x44a2('0x29'),_0x49baec[_0x44a2('0x17')],_0x216318);_0x4f97fa(_this[_0x44a2('0x15')](0x1f4,_0x49baec[_0x44a2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ed49b6e..f1445e9 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 _0x6353=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x5291fb,_0x151cfc){var _0x790840=function(_0x1f5766){while(--_0x1f5766){_0x5291fb['push'](_0x5291fb['shift']());}};_0x790840(++_0x151cfc);}(_0x6353,0x1e5));var _0x3635=function(_0x5aa6a9,_0x3ae14c){_0x5aa6a9=_0x5aa6a9-0x0;var _0x119ce5=_0x6353[_0x5aa6a9];return _0x119ce5;};'use strict';var OpenchannelInteractionEvents=require(_0x3635('0x0'));var events=[_0x3635('0x1'),_0x3635('0x2'),_0x3635('0x3')];function createListener(_0x17ef28,_0x324957){return function(_0x481e31){_0x324957[_0x3635('0x4')](_0x17ef28,_0x481e31);};}function removeListener(_0x1f6cd7,_0xb1b9bb){return function(){OpenchannelInteractionEvents[_0x3635('0x5')](_0x1f6cd7,_0xb1b9bb);};}exports[_0x3635('0x6')]=function(_0x26aec5){for(var _0x171dc3=0x0,_0x526e89=events[_0x3635('0x7')];_0x171dc3<_0x526e89;_0x171dc3++){var _0x45bb30=events[_0x171dc3];var _0x276c68=createListener(_0x3635('0x8')+_0x45bb30,_0x26aec5);OpenchannelInteractionEvents['on'](_0x45bb30,_0x276c68);}}; \ No newline at end of file +var _0xb74c=['length','openchannelInteraction:','save','remove','emit','removeListener'];(function(_0x1dfcf9,_0x2a88f8){var _0x39676a=function(_0x245463){while(--_0x245463){_0x1dfcf9['push'](_0x1dfcf9['shift']());}};_0x39676a(++_0x2a88f8);}(_0xb74c,0x1ac));var _0xcb74=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb74c[_0x122ef9];return _0x42fba0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xcb74('0x0'),_0xcb74('0x1'),'update'];function createListener(_0x51b4b7,_0x3fae39){return function(_0x5f29b4){_0x3fae39[_0xcb74('0x2')](_0x51b4b7,_0x5f29b4);};}function removeListener(_0x3f4d64,_0x348beb){return function(){OpenchannelInteractionEvents[_0xcb74('0x3')](_0x3f4d64,_0x348beb);};}exports['register']=function(_0x291b86){for(var _0x3e6420=0x0,_0x2f569a=events[_0xcb74('0x4')];_0x3e6420<_0x2f569a;_0x3e6420++){var _0x490b90=events[_0x3e6420];var _0x15d807=createListener(_0xcb74('0x5')+_0x490b90,_0x291b86);OpenchannelInteractionEvents['on'](_0x490b90,_0x15d807);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 53333f9..905762f 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x28c74f,_0x428de6){var _0x11a209=function(_0x28d83f){while(--_0x28d83f){_0x28c74f['push'](_0x28c74f['shift']());}};_0x11a209(++_0x428de6);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f9939,_0x4adbbc){_0x3f9939=_0x3f9939-0x0;var _0x2db2ba=_0xedd9[_0x3f9939];return _0x2db2ba;};'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('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x350563,_0x128fa4){_0x350563=_0x350563-0x0;var _0x5e451a=_0x70e0[_0x350563];return _0x5e451a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 89fdb24..c309f07 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 _0x14b7=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x263e25,_0x303a1a){var _0x5117b7=function(_0x34faae){while(--_0x34faae){_0x263e25['push'](_0x263e25['shift']());}};_0x5117b7(++_0x303a1a);}(_0x14b7,0x144));var _0x714b=function(_0x39b1d8,_0xd5e4d9){_0x39b1d8=_0x39b1d8-0x0;var _0x18f8d9=_0x14b7[_0x39b1d8];return _0x18f8d9;};'use strict';var Sequelize=require(_0x714b('0x0'));module[_0x714b('0x1')]={'body':{'type':Sequelize[_0x714b('0x2')](_0x714b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x714b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x714b('0x5')]('in',_0x714b('0x6')),'defaultValue':_0x714b('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x714b('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2cae=['out','DATE','STRING','sequelize','exports','BOOLEAN'];(function(_0x1038aa,_0x5db039){var _0x396b5b=function(_0x4a1e17){while(--_0x4a1e17){_0x1038aa['push'](_0x1038aa['shift']());}};_0x396b5b(++_0x5db039);}(_0x2cae,0x16b));var _0xe2ca=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x2cae[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe2ca('0x3')),'defaultValue':_0xe2ca('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe2ca('0x4')]},'providerName':{'type':Sequelize[_0xe2ca('0x5')]},'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 90e8a54..c8f169c 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 _0xe35c=['mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','request\x20sent','debug','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','end','stack','name','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','stringify','null','rejectMessage','ContactId','Sequelize','User','fullname','eml-format','zip-dir','request-promise','moment'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xe35c,0x7c));var _0xce35=function(_0x382779,_0x4e6f62){_0x382779=_0x382779-0x0;var _0x585906=_0xe35c[_0x382779];return _0x585906;};'use strict';var emlformat=require(_0xce35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce35('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce35('0x2'));var moment=require(_0xce35('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce35('0x4'));var util=require(_0xce35('0x5'));var path=require(_0xce35('0x6'));var sox=require('sox');var csv=require(_0xce35('0x7'));var ejs=require(_0xce35('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce35('0x9'));var squel=require(_0xce35('0xa'));var crypto=require('crypto');var jsforce=require(_0xce35('0xb'));var deskjs=require(_0xce35('0xc'));var toCsv=require(_0xce35('0x7'));var querystring=require(_0xce35('0xd'));var Papa=require(_0xce35('0xe'));var Redis=require(_0xce35('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xce35('0x10'));var as=require(_0xce35('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce35('0x12'))(_0xce35('0x13'));var utils=require(_0xce35('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce35('0x15'))['db'];config[_0xce35('0x16')]=_[_0xce35('0x17')](config[_0xce35('0x16')],{'host':_0xce35('0x18'),'port':0x18eb});var socket=require(_0xce35('0x19'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xce35('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xce35('0x1b')][_0xce35('0x1c')]({'port':0x232c});var client9002=jayson[_0xce35('0x1b')][_0xce35('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xef0bb3,_0x1cb237,_0x336e2b,_0x1f8819){return new BPromise(function(_0x1522f6,_0x2e308c){var _0x8772f0=_0x1f8819||client;return _0x8772f0[_0xce35('0x1d')](_0xef0bb3,_0x336e2b)[_0xce35('0x1e')](function(_0x42feca){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1cb237,_0xce35('0x1f'));logger[_0xce35('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1cb237,_0xce35('0x1f'),JSON['stringify'](_0x42feca));if(_0x42feca[_0xce35('0x21')]){if(_0x42feca[_0xce35('0x21')][_0xce35('0x22')]===0x1f4){logger['error'](_0xce35('0x23'),_0x1cb237,_0x42feca[_0xce35('0x21')][_0xce35('0x24')]);return _0x2e308c(_0x42feca['error'][_0xce35('0x24')]);}logger['error'](_0xce35('0x23'),_0x1cb237,_0x42feca['error'][_0xce35('0x24')]);return _0x1522f6(_0x42feca[_0xce35('0x21')][_0xce35('0x24')]);}else{logger[_0xce35('0x25')](_0xce35('0x23'),_0x1cb237,'request\x20sent');_0x1522f6(_0x42feca[_0xce35('0x26')][_0xce35('0x24')]);}})[_0xce35('0x27')](function(_0x510a93){logger['error'](_0xce35('0x23'),_0x1cb237,_0x510a93);_0x2e308c(_0x510a93);});});}function respondWithStatusCode(_0x3dfb7c,_0x3ff608){_0x3ff608=_0x3ff608||0xcc;return function(_0xe7ae30){if(_0xe7ae30){return _0x3dfb7c[_0xce35('0x28')](_0x3ff608);}return _0x3dfb7c[_0xce35('0x29')](_0x3ff608)['end']();};}function respondWithResult(_0x562b12,_0x54bbf3){_0x54bbf3=_0x54bbf3||0xc8;return function(_0x30abc5){if(_0x30abc5){return _0x562b12['status'](_0x54bbf3)[_0xce35('0x2a')](_0x30abc5);}};}function respondWithFilteredResult(_0x4ebf5a,_0x271f32){return function(_0x5583b1){if(_0x5583b1){var _0x5f0ca1=typeof _0x271f32['offset']==='undefined'&&typeof _0x271f32[_0xce35('0x2b')]===_0xce35('0x2c');var _0x118e73=_0x5583b1[_0xce35('0x2d')];var _0x101161=_0x5f0ca1?0x0:_0x271f32['offset'];var _0x479d68=_0x5f0ca1?_0x5583b1['count']:_0x271f32['offset']+_0x271f32[_0xce35('0x2b')];var _0xf33371;if(_0x479d68>=_0x118e73){_0x479d68=_0x118e73;_0xf33371=0xc8;}else{_0xf33371=0xce;}_0x4ebf5a['status'](_0xf33371);return _0x4ebf5a[_0xce35('0x2e')](_0xce35('0x2f'),_0x101161+'-'+_0x479d68+'/'+_0x118e73)['json'](_0x5583b1);}return null;};}function patchUpdates(_0x15bbe1){return function(_0x14f49d){try{jsonpatch[_0xce35('0x30')](_0x14f49d,_0x15bbe1,!![]);}catch(_0x22dd63){return BPromise[_0xce35('0x31')](_0x22dd63);}return _0x14f49d['save']();};}function saveUpdates(_0x120eb2,_0x1bf533){return function(_0x595f48){if(_0x595f48){return _0x595f48[_0xce35('0x32')](_0x120eb2)[_0xce35('0x1e')](function(_0x436773){return _0x436773;});}return null;};}function removeEntity(_0x2670b2,_0x245caa){return function(_0x5dbb76){if(_0x5dbb76){return _0x5dbb76[_0xce35('0x33')]()[_0xce35('0x1e')](function(){_0x2670b2['status'](0xcc)[_0xce35('0x34')]();});}};}function handleEntityNotFound(_0x49e4d3,_0x2ed5da){return function(_0x543a43){if(!_0x543a43){_0x49e4d3[_0xce35('0x28')](0x194);}return _0x543a43;};}function handleError(_0x5a7980,_0x3848ea){_0x3848ea=_0x3848ea||0x1f4;return function(_0xa0325b){logger[_0xce35('0x21')](_0xa0325b[_0xce35('0x35')]);if(_0xa0325b['name']){delete _0xa0325b[_0xce35('0x36')];}_0x5a7980[_0xce35('0x29')](_0x3848ea)['send'](_0xa0325b);};}exports['index']=function(_0x5a6745,_0x2a0339){var _0x443501={},_0x1ffc3b={},_0x24b8fb={'count':0x0,'rows':[]};var _0x3e6208=_[_0xce35('0x37')](db[_0xce35('0x38')]['rawAttributes'],function(_0x3a5bc6){return{'name':_0x3a5bc6[_0xce35('0x39')],'type':_0x3a5bc6[_0xce35('0x3a')][_0xce35('0x3b')]};});_0x1ffc3b[_0xce35('0x3c')]=_[_0xce35('0x37')](_0x3e6208,'name');_0x1ffc3b[_0xce35('0x3d')]=_[_0xce35('0x3e')](_0x5a6745['query']);_0x1ffc3b[_0xce35('0x3f')]=_[_0xce35('0x40')](_0x1ffc3b['model'],_0x1ffc3b[_0xce35('0x3d')]);_0x443501['attributes']=_['intersection'](_0x1ffc3b[_0xce35('0x3c')],qs[_0xce35('0x41')](_0x5a6745[_0xce35('0x3d')][_0xce35('0x41')]));_0x443501[_0xce35('0x42')]=_0x443501[_0xce35('0x42')]['length']?_0x443501[_0xce35('0x42')]:_0x1ffc3b[_0xce35('0x3c')];if(!_0x5a6745[_0xce35('0x3d')][_0xce35('0x43')](_0xce35('0x44'))){_0x443501[_0xce35('0x2b')]=qs[_0xce35('0x2b')](_0x5a6745[_0xce35('0x3d')][_0xce35('0x2b')]);_0x443501[_0xce35('0x45')]=qs['offset'](_0x5a6745[_0xce35('0x3d')][_0xce35('0x45')]);}_0x443501['order']=qs[_0xce35('0x46')](_0x5a6745[_0xce35('0x3d')]['sort']);_0x443501[_0xce35('0x47')]=qs[_0xce35('0x3f')](_[_0xce35('0x48')](_0x5a6745[_0xce35('0x3d')],_0x1ffc3b[_0xce35('0x3f')]),_0x3e6208);if(_0x5a6745['query'][_0xce35('0x49')]){_0x443501['where']=_[_0xce35('0x4a')](_0x443501[_0xce35('0x47')],{'$or':_[_0xce35('0x37')](_0x3e6208,function(_0x38294b){if(_0x38294b[_0xce35('0x3a')]!=='VIRTUAL'){var _0x28c95e={};_0x28c95e[_0x38294b['name']]={'$like':'%'+_0x5a6745[_0xce35('0x3d')]['filter']+'%'};return _0x28c95e;}})});}_0x443501=_[_0xce35('0x4a')]({},_0x443501,_0x5a6745[_0xce35('0x4b')]);var _0xb3a908={'where':_0x443501[_0xce35('0x47')]};return db[_0xce35('0x38')][_0xce35('0x2d')](_0xb3a908)[_0xce35('0x1e')](function(_0x4d17fe){_0x24b8fb[_0xce35('0x2d')]=_0x4d17fe;if(_0x5a6745[_0xce35('0x3d')]['includeAll']){_0x443501['include']=[{'all':!![]}];}return db[_0xce35('0x38')][_0xce35('0x4c')](_0x443501);})[_0xce35('0x1e')](function(_0x1942ad){_0x24b8fb[_0xce35('0x4d')]=_0x1942ad;return _0x24b8fb;})[_0xce35('0x1e')](respondWithFilteredResult(_0x2a0339,_0x443501))[_0xce35('0x27')](handleError(_0x2a0339,null));};exports[_0xce35('0x4e')]=function(_0x15d59d,_0x1111fe){var _0x41f62f={'raw':!![],'where':{'id':_0x15d59d[_0xce35('0x4f')]['id']}},_0x16f9d0={};_0x16f9d0[_0xce35('0x3c')]=_[_0xce35('0x3e')](db['OpenchannelMessage'][_0xce35('0x50')]);_0x16f9d0[_0xce35('0x3d')]=_[_0xce35('0x3e')](_0x15d59d[_0xce35('0x3d')]);_0x16f9d0[_0xce35('0x3f')]=_[_0xce35('0x40')](_0x16f9d0[_0xce35('0x3c')],_0x16f9d0[_0xce35('0x3d')]);_0x41f62f[_0xce35('0x42')]=_[_0xce35('0x40')](_0x16f9d0[_0xce35('0x3c')],qs[_0xce35('0x41')](_0x15d59d[_0xce35('0x3d')][_0xce35('0x41')]));_0x41f62f[_0xce35('0x42')]=_0x41f62f[_0xce35('0x42')]['length']?_0x41f62f['attributes']:_0x16f9d0['model'];if(_0x15d59d[_0xce35('0x3d')][_0xce35('0x51')]){_0x41f62f[_0xce35('0x52')]=[{'all':!![]}];}_0x41f62f=_['merge']({},_0x41f62f,_0x15d59d['options']);return db[_0xce35('0x38')][_0xce35('0x53')](_0x41f62f)[_0xce35('0x1e')](handleEntityNotFound(_0x1111fe,null))['then'](respondWithResult(_0x1111fe,null))[_0xce35('0x27')](handleError(_0x1111fe,null));};exports[_0xce35('0x54')]=function(_0x11c3e9,_0x5ba77c){return db[_0xce35('0x38')][_0xce35('0x54')](_0x11c3e9[_0xce35('0x55')],{})[_0xce35('0x1e')](respondWithResult(_0x5ba77c,0xc9))[_0xce35('0x27')](handleError(_0x5ba77c,null));};exports[_0xce35('0x32')]=function(_0xde9f24,_0x42ce24){if(_0xde9f24[_0xce35('0x55')]['id']){delete _0xde9f24[_0xce35('0x55')]['id'];}return db[_0xce35('0x38')][_0xce35('0x53')]({'where':{'id':_0xde9f24['params']['id']}})[_0xce35('0x1e')](handleEntityNotFound(_0x42ce24,null))[_0xce35('0x1e')](saveUpdates(_0xde9f24[_0xce35('0x55')],null))['then'](respondWithResult(_0x42ce24,null))[_0xce35('0x27')](handleError(_0x42ce24,null));};exports['destroy']=function(_0x533570,_0xe2d2b0){return db[_0xce35('0x38')][_0xce35('0x53')]({'where':{'id':_0x533570[_0xce35('0x4f')]['id']}})[_0xce35('0x1e')](handleEntityNotFound(_0xe2d2b0,null))[_0xce35('0x1e')](removeEntity(_0xe2d2b0,null))[_0xce35('0x27')](handleError(_0xe2d2b0,null));};exports['describe']=function(_0x2a8eb9,_0x3d6ac5){return db['OpenchannelMessage']['describe']()[_0xce35('0x1e')](respondWithResult(_0x3d6ac5,null))[_0xce35('0x27')](handleError(_0x3d6ac5,null));};var interaction_log=require('../../config/logger')(_0xce35('0x56'));exports[_0xce35('0x57')]=function(_0x2231ed,_0x25fc72,_0x86d72e){var _0x269e6b={'agent':{},'channel':_0xce35('0x58')};if(_0x2231ed[_0xce35('0x55')]['id']){delete _0x2231ed['body']['id'];}_0x2231ed['body'][_0xce35('0x59')]=!![];_0x2231ed[_0xce35('0x55')][_0xce35('0x5a')]=moment()[_0xce35('0x5b')](_0xce35('0x5c'));_0x2231ed[_0xce35('0x55')]['UserId']=_0x2231ed[_0xce35('0x55')]['UserId']||_0x2231ed['user']['id'];_0x269e6b[_0xce35('0x5d')]['id']=_0x2231ed[_0xce35('0x55')][_0xce35('0x5e')];return db[_0xce35('0x38')]['find']({'where':{'id':_0x2231ed[_0xce35('0x4f')]['id'],'UserId':null}})[_0xce35('0x1e')](handleEntityNotFound(_0x25fc72,null))[_0xce35('0x1e')](saveUpdates(_0x2231ed[_0xce35('0x55')],null))['then'](function(_0x64e73){if(_0x64e73){_0x269e6b['message']=_0x64e73[_0xce35('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0xce35('0x53')]({'where':{'id':_0x64e73[_0xce35('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x25fc72,null))[_0xce35('0x1e')](function(_0x3efc94){if(_0x3efc94){return _0x3efc94[_0xce35('0x32')]({'UserId':_0x2231ed[_0xce35('0x55')][_0xce35('0x5e')],'read1stAt':_[_0xce35('0x61')](_0x3efc94[_0xce35('0x62')])?moment()[_0xce35('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xce35('0x1e')](function(_0x4303bf){if(_0x4303bf){_0x269e6b[_0xce35('0x63')]=_0x4303bf['get']({'plain':!![]});interaction_log[_0xce35('0x25')](_0xce35('0x64'),_0x2231ed[_0xce35('0x65')]['id'],_0x2231ed[_0xce35('0x65')][_0xce35('0x36')],_0x2231ed[_0xce35('0x65')][_0xce35('0x66')],_0x269e6b[_0xce35('0x63')]['id'],_0x2231ed[_0xce35('0x55')]?JSON['stringify'](_0x2231ed[_0xce35('0x55')]):'null');return respondWithRpcPromise(_0xce35('0x67'),_0xce35('0x68'),_0x269e6b);}return null;})[_0xce35('0x1e')](function(_0x55c146){var _0x40263b=_0xce35('0x69')+_0x55c146['message']['ContactId'];return db[_0xce35('0x6a')]['query'](_0x40263b,{'type':db['Sequelize'][_0xce35('0x6b')][_0xce35('0x6c')],'raw':!![]})['then'](function(_0x36faca){return _0x36faca;});})[_0xce35('0x1e')](function(_0x237607){if(_0x237607){_0x269e6b['message'][_0xce35('0x6d')]=_0x237607[0x0];if(!_0x2231ed[_0xce35('0x55')][_0xce35('0x5e')])return;return db['User'][_0xce35('0x53')]({'where':{'id':_0x2231ed[_0xce35('0x55')][_0xce35('0x5e')],'role':'agent'},'attributes':['id','name','fullname',_0xce35('0x6e'),_0xce35('0x6f')],'raw':!![]});}return null;})[_0xce35('0x1e')](function(_0xe1a531){if(!_0xe1a531)return null;_0x269e6b[_0xce35('0x24')]['agent']=_0xe1a531;return _0x269e6b;})[_0xce35('0x1e')](function(_0x34024c){if(_0x34024c){if(_0x2231ed[_0xce35('0x55')][_0xce35('0x70')]){_0x269e6b[_0xce35('0x24')][_0xce35('0x71')]=util[_0xce35('0x5b')](_0xce35('0x72'),_0x2231ed[_0xce35('0x65')][_0xce35('0x36')]);_0x269e6b[_0xce35('0x24')][_0xce35('0x73')]=_0x269e6b['channel'];_0x269e6b[_0xce35('0x24')][_0xce35('0x74')]=_0x269e6b[_0xce35('0x73')];_0x269e6b[_0xce35('0x24')][_0xce35('0x75')]='accept';return respondWithRpcPromise(_0xce35('0x76'),'EventManager',{'event':_0xce35('0x77'),'message':_0x269e6b[_0xce35('0x24')]},client9002)['then'](function(){return _0x269e6b;});}return _0x269e6b;}return null;})[_0xce35('0x1e')](respondWithResult(_0x25fc72,null))['catch'](handleError(_0x25fc72,null));};var interaction_log=require(_0xce35('0x12'))(_0xce35('0x56'));exports['reject']=function(_0x32ce4e,_0x58f705,_0x342094){var _0x254ea7={'agent':{},'channel':_0xce35('0x58')};if(_0x32ce4e['body']['id']){delete _0x32ce4e[_0xce35('0x55')]['id'];}_0x32ce4e[_0xce35('0x55')][_0xce35('0x5e')]=_0x32ce4e[_0xce35('0x55')][_0xce35('0x5e')]||_0x32ce4e[_0xce35('0x65')]['id'];_0x254ea7[_0xce35('0x5d')]['id']=_0x32ce4e[_0xce35('0x55')][_0xce35('0x5e')];return db[_0xce35('0x38')][_0xce35('0x53')]({'where':{'id':_0x32ce4e[_0xce35('0x4f')]['id'],'UserId':null}})[_0xce35('0x1e')](handleEntityNotFound(_0x58f705,null))[_0xce35('0x1e')](function(_0x26b392){if(_0x26b392){_0x254ea7['message']=_0x26b392[_0xce35('0x5f')]({'plain':!![]});return db[_0xce35('0x78')][_0xce35('0x53')]({'where':{'id':_0x26b392['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x58f705,null))[_0xce35('0x1e')](function(_0x598f45){if(_0x598f45){_0x254ea7['interaction']=_0x598f45[_0xce35('0x5f')]({'plain':!![]});interaction_log[_0xce35('0x25')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x32ce4e['user']['id'],_0x32ce4e['user'][_0xce35('0x36')],_0x32ce4e[_0xce35('0x65')][_0xce35('0x66')],_0x254ea7[_0xce35('0x63')]['id'],_0x32ce4e['body']?JSON[_0xce35('0x79')](_0x32ce4e['body']):_0xce35('0x7a'));return respondWithRpcPromise('RejectMessage',_0xce35('0x7b'),_0x254ea7);}return null;})[_0xce35('0x1e')](function(_0x42ce0b){var _0x3f61c0=_0xce35('0x69')+_0x42ce0b['message'][_0xce35('0x7c')];return db[_0xce35('0x6a')][_0xce35('0x3d')](_0x3f61c0,{'type':db[_0xce35('0x7d')]['QueryTypes'][_0xce35('0x6c')],'raw':!![]})[_0xce35('0x1e')](function(_0x54097e){return _0x54097e;});})[_0xce35('0x1e')](function(_0x2b09e2){if(_0x2b09e2){_0x254ea7[_0xce35('0x24')]['contact']=_0x2b09e2[0x0];if(!_0x32ce4e[_0xce35('0x55')][_0xce35('0x5e')])return;return db[_0xce35('0x7e')][_0xce35('0x53')]({'where':{'id':_0x32ce4e[_0xce35('0x55')][_0xce35('0x5e')],'role':'agent'},'attributes':['id','name',_0xce35('0x7f'),'email','internal'],'raw':!![]});}return null;})[_0xce35('0x1e')](function(_0x3fc818){if(!_0x3fc818)return null;_0x254ea7[_0xce35('0x24')][_0xce35('0x5d')]=_0x3fc818;return _0x254ea7;})[_0xce35('0x1e')](function(_0x219e0e){if(_0x219e0e){_0x219e0e[_0xce35('0x24')][_0xce35('0x71')]=util[_0xce35('0x5b')]('SIP/%s',_0x32ce4e[_0xce35('0x65')]['name']);_0x219e0e[_0xce35('0x24')]['channel']=_0x254ea7['channel'];_0x219e0e[_0xce35('0x24')][_0xce35('0x74')]=_0x254ea7[_0xce35('0x73')];_0x219e0e[_0xce35('0x24')][_0xce35('0x75')]=_0xce35('0x31');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x219e0e[_0xce35('0x24')]},client9002);return _0x254ea7;}return null;})['then'](respondWithResult(_0x58f705,null))[_0xce35('0x27')](handleError(_0x58f705,null));}; \ No newline at end of file +var _0x7a22=['fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','channel','motionChannel','EventManager','acceptmessage','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','User','SIP/%s','event','rejectmessage','eml-format','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x7a22,0x1cd));var _0x27a2=function(_0x1856d3,_0x4bec94){_0x1856d3=_0x1856d3-0x0;var _0x5b1851=_0x7a22[_0x1856d3];return _0x5b1851;};'use strict';var emlformat=require(_0x27a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27a2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27a2('0x2'));var moment=require('moment');var BPromise=require(_0x27a2('0x3'));var Mustache=require('mustache');var util=require(_0x27a2('0x4'));var path=require('path');var sox=require(_0x27a2('0x5'));var csv=require('to-csv');var ejs=require(_0x27a2('0x6'));var fs=require('fs');var fs_extra=require(_0x27a2('0x7'));var _=require(_0x27a2('0x8'));var squel=require(_0x27a2('0x9'));var crypto=require(_0x27a2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x27a2('0xb'));var toCsv=require(_0x27a2('0xc'));var querystring=require(_0x27a2('0xd'));var Papa=require(_0x27a2('0xe'));var Redis=require(_0x27a2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x27a2('0x10'));var as=require(_0x27a2('0x11'));var hardwareService=require(_0x27a2('0x12'));var logger=require(_0x27a2('0x13'))('api');var utils=require(_0x27a2('0x14'));var config=require(_0x27a2('0x15'));var licenseUtil=require(_0x27a2('0x16'));var db=require(_0x27a2('0x17'))['db'];config[_0x27a2('0x18')]=_['defaults'](config[_0x27a2('0x18')],{'host':_0x27a2('0x19'),'port':0x18eb});var socket=require(_0x27a2('0x1a'))(new Redis(config[_0x27a2('0x18')]));require(_0x27a2('0x1b'))[_0x27a2('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x27a2('0x1d')]({'port':0x232c});var client9002=jayson[_0x27a2('0x1e')][_0x27a2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2b7ee6,_0x1e921d,_0x11da8f,_0x443344){return new BPromise(function(_0x2e09f3,_0x508d24){var _0x23fefc=_0x443344||client;return _0x23fefc[_0x27a2('0x1f')](_0x2b7ee6,_0x11da8f)[_0x27a2('0x20')](function(_0x23d8ce){logger['info'](_0x27a2('0x21'),_0x1e921d,_0x27a2('0x22'));logger[_0x27a2('0x23')](_0x27a2('0x24'),_0x1e921d,_0x27a2('0x22'),JSON[_0x27a2('0x25')](_0x23d8ce));if(_0x23d8ce[_0x27a2('0x26')]){if(_0x23d8ce[_0x27a2('0x26')][_0x27a2('0x27')]===0x1f4){logger[_0x27a2('0x26')](_0x27a2('0x21'),_0x1e921d,_0x23d8ce['error'][_0x27a2('0x28')]);return _0x508d24(_0x23d8ce[_0x27a2('0x26')][_0x27a2('0x28')]);}logger['error'](_0x27a2('0x21'),_0x1e921d,_0x23d8ce[_0x27a2('0x26')]['message']);return _0x2e09f3(_0x23d8ce[_0x27a2('0x26')][_0x27a2('0x28')]);}else{logger[_0x27a2('0x29')](_0x27a2('0x21'),_0x1e921d,'request\x20sent');_0x2e09f3(_0x23d8ce['result'][_0x27a2('0x28')]);}})[_0x27a2('0x2a')](function(_0x5c3ff6){logger[_0x27a2('0x26')](_0x27a2('0x21'),_0x1e921d,_0x5c3ff6);_0x508d24(_0x5c3ff6);});});}function respondWithStatusCode(_0x2fa4a5,_0x3f40d5){_0x3f40d5=_0x3f40d5||0xcc;return function(_0x233656){if(_0x233656){return _0x2fa4a5[_0x27a2('0x2b')](_0x3f40d5);}return _0x2fa4a5[_0x27a2('0x2c')](_0x3f40d5)[_0x27a2('0x2d')]();};}function respondWithResult(_0x331a00,_0xdd128b){_0xdd128b=_0xdd128b||0xc8;return function(_0x476985){if(_0x476985){return _0x331a00[_0x27a2('0x2c')](_0xdd128b)[_0x27a2('0x2e')](_0x476985);}};}function respondWithFilteredResult(_0x5db4ff,_0x191e59){return function(_0x414eac){if(_0x414eac){var _0x2f656e=typeof _0x191e59['offset']===_0x27a2('0x2f')&&typeof _0x191e59[_0x27a2('0x30')]===_0x27a2('0x2f');var _0x52bee0=_0x414eac[_0x27a2('0x31')];var _0x368772=_0x2f656e?0x0:_0x191e59[_0x27a2('0x32')];var _0x458221=_0x2f656e?_0x414eac[_0x27a2('0x31')]:_0x191e59['offset']+_0x191e59[_0x27a2('0x30')];var _0x2bb141;if(_0x458221>=_0x52bee0){_0x458221=_0x52bee0;_0x2bb141=0xc8;}else{_0x2bb141=0xce;}_0x5db4ff[_0x27a2('0x2c')](_0x2bb141);return _0x5db4ff[_0x27a2('0x33')](_0x27a2('0x34'),_0x368772+'-'+_0x458221+'/'+_0x52bee0)['json'](_0x414eac);}return null;};}function patchUpdates(_0x122bc3){return function(_0x264dff){try{jsonpatch['apply'](_0x264dff,_0x122bc3,!![]);}catch(_0x393214){return BPromise[_0x27a2('0x35')](_0x393214);}return _0x264dff['save']();};}function saveUpdates(_0x1fe885,_0x249fde){return function(_0x1290db){if(_0x1290db){return _0x1290db[_0x27a2('0x36')](_0x1fe885)[_0x27a2('0x20')](function(_0x10f54d){return _0x10f54d;});}return null;};}function removeEntity(_0x12fb7f,_0x5ceff7){return function(_0x3684da){if(_0x3684da){return _0x3684da[_0x27a2('0x37')]()[_0x27a2('0x20')](function(){_0x12fb7f[_0x27a2('0x2c')](0xcc)[_0x27a2('0x2d')]();});}};}function handleEntityNotFound(_0x1c937e,_0x22e1f2){return function(_0x1c0390){if(!_0x1c0390){_0x1c937e[_0x27a2('0x2b')](0x194);}return _0x1c0390;};}function handleError(_0x38e31c,_0x1d685e){_0x1d685e=_0x1d685e||0x1f4;return function(_0x140d21){logger[_0x27a2('0x26')](_0x140d21[_0x27a2('0x38')]);if(_0x140d21['name']){delete _0x140d21[_0x27a2('0x39')];}_0x38e31c[_0x27a2('0x2c')](_0x1d685e)[_0x27a2('0x3a')](_0x140d21);};}exports[_0x27a2('0x3b')]=function(_0x5b2d39,_0x3c38df){var _0x219cd9={},_0x2dc60d={},_0x13aa29={'count':0x0,'rows':[]};var _0x5203d9=_[_0x27a2('0x3c')](db[_0x27a2('0x3d')][_0x27a2('0x3e')],function(_0x32bc83){return{'name':_0x32bc83[_0x27a2('0x3f')],'type':_0x32bc83['type'][_0x27a2('0x40')]};});_0x2dc60d['model']=_['map'](_0x5203d9,_0x27a2('0x39'));_0x2dc60d[_0x27a2('0x41')]=_[_0x27a2('0x42')](_0x5b2d39[_0x27a2('0x41')]);_0x2dc60d[_0x27a2('0x43')]=_[_0x27a2('0x44')](_0x2dc60d[_0x27a2('0x45')],_0x2dc60d[_0x27a2('0x41')]);_0x219cd9[_0x27a2('0x46')]=_[_0x27a2('0x44')](_0x2dc60d[_0x27a2('0x45')],qs[_0x27a2('0x47')](_0x5b2d39[_0x27a2('0x41')][_0x27a2('0x47')]));_0x219cd9[_0x27a2('0x46')]=_0x219cd9['attributes']['length']?_0x219cd9[_0x27a2('0x46')]:_0x2dc60d[_0x27a2('0x45')];if(!_0x5b2d39['query'][_0x27a2('0x48')](_0x27a2('0x49'))){_0x219cd9[_0x27a2('0x30')]=qs[_0x27a2('0x30')](_0x5b2d39['query'][_0x27a2('0x30')]);_0x219cd9[_0x27a2('0x32')]=qs['offset'](_0x5b2d39[_0x27a2('0x41')][_0x27a2('0x32')]);}_0x219cd9['order']=qs[_0x27a2('0x4a')](_0x5b2d39[_0x27a2('0x41')][_0x27a2('0x4a')]);_0x219cd9[_0x27a2('0x4b')]=qs[_0x27a2('0x43')](_[_0x27a2('0x4c')](_0x5b2d39[_0x27a2('0x41')],_0x2dc60d[_0x27a2('0x43')]),_0x5203d9);if(_0x5b2d39[_0x27a2('0x41')][_0x27a2('0x4d')]){_0x219cd9[_0x27a2('0x4b')]=_[_0x27a2('0x4e')](_0x219cd9[_0x27a2('0x4b')],{'$or':_['map'](_0x5203d9,function(_0x28b0e5){if(_0x28b0e5['type']!==_0x27a2('0x4f')){var _0x41aedd={};_0x41aedd[_0x28b0e5[_0x27a2('0x39')]]={'$like':'%'+_0x5b2d39[_0x27a2('0x41')]['filter']+'%'};return _0x41aedd;}})});}_0x219cd9=_['merge']({},_0x219cd9,_0x5b2d39[_0x27a2('0x50')]);var _0x325f45={'where':_0x219cd9[_0x27a2('0x4b')]};return db[_0x27a2('0x3d')]['count'](_0x325f45)['then'](function(_0x25fd8b){_0x13aa29[_0x27a2('0x31')]=_0x25fd8b;if(_0x5b2d39[_0x27a2('0x41')]['includeAll']){_0x219cd9[_0x27a2('0x51')]=[{'all':!![]}];}return db[_0x27a2('0x3d')][_0x27a2('0x52')](_0x219cd9);})['then'](function(_0x35e86c){_0x13aa29[_0x27a2('0x53')]=_0x35e86c;return _0x13aa29;})[_0x27a2('0x20')](respondWithFilteredResult(_0x3c38df,_0x219cd9))[_0x27a2('0x2a')](handleError(_0x3c38df,null));};exports['show']=function(_0x24f518,_0x11457e){var _0x2b0ca3={'raw':!![],'where':{'id':_0x24f518[_0x27a2('0x54')]['id']}},_0x374429={};_0x374429[_0x27a2('0x45')]=_[_0x27a2('0x42')](db[_0x27a2('0x3d')][_0x27a2('0x3e')]);_0x374429[_0x27a2('0x41')]=_[_0x27a2('0x42')](_0x24f518['query']);_0x374429[_0x27a2('0x43')]=_[_0x27a2('0x44')](_0x374429[_0x27a2('0x45')],_0x374429[_0x27a2('0x41')]);_0x2b0ca3[_0x27a2('0x46')]=_[_0x27a2('0x44')](_0x374429[_0x27a2('0x45')],qs[_0x27a2('0x47')](_0x24f518[_0x27a2('0x41')][_0x27a2('0x47')]));_0x2b0ca3[_0x27a2('0x46')]=_0x2b0ca3[_0x27a2('0x46')]['length']?_0x2b0ca3[_0x27a2('0x46')]:_0x374429[_0x27a2('0x45')];if(_0x24f518[_0x27a2('0x41')][_0x27a2('0x55')]){_0x2b0ca3[_0x27a2('0x51')]=[{'all':!![]}];}_0x2b0ca3=_[_0x27a2('0x4e')]({},_0x2b0ca3,_0x24f518['options']);return db[_0x27a2('0x3d')][_0x27a2('0x56')](_0x2b0ca3)[_0x27a2('0x20')](handleEntityNotFound(_0x11457e,null))[_0x27a2('0x20')](respondWithResult(_0x11457e,null))[_0x27a2('0x2a')](handleError(_0x11457e,null));};exports[_0x27a2('0x57')]=function(_0x545086,_0x3ae774){return db[_0x27a2('0x3d')][_0x27a2('0x57')](_0x545086[_0x27a2('0x58')],{})['then'](respondWithResult(_0x3ae774,0xc9))[_0x27a2('0x2a')](handleError(_0x3ae774,null));};exports[_0x27a2('0x36')]=function(_0x80573b,_0x4a8ed1){if(_0x80573b['body']['id']){delete _0x80573b['body']['id'];}return db[_0x27a2('0x3d')][_0x27a2('0x56')]({'where':{'id':_0x80573b['params']['id']}})[_0x27a2('0x20')](handleEntityNotFound(_0x4a8ed1,null))[_0x27a2('0x20')](saveUpdates(_0x80573b['body'],null))[_0x27a2('0x20')](respondWithResult(_0x4a8ed1,null))['catch'](handleError(_0x4a8ed1,null));};exports[_0x27a2('0x37')]=function(_0x191d9a,_0xab9bad){return db['OpenchannelMessage'][_0x27a2('0x56')]({'where':{'id':_0x191d9a['params']['id']}})[_0x27a2('0x20')](handleEntityNotFound(_0xab9bad,null))[_0x27a2('0x20')](removeEntity(_0xab9bad,null))[_0x27a2('0x2a')](handleError(_0xab9bad,null));};exports[_0x27a2('0x59')]=function(_0x587414,_0x5d2e05){return db[_0x27a2('0x3d')][_0x27a2('0x59')]()[_0x27a2('0x20')](respondWithResult(_0x5d2e05,null))[_0x27a2('0x2a')](handleError(_0x5d2e05,null));};var interaction_log=require(_0x27a2('0x13'))(_0x27a2('0x5a'));exports[_0x27a2('0x5b')]=function(_0x44f0f4,_0x5ed729,_0x348547){var _0x53fbc4={'agent':{},'channel':_0x27a2('0x5c')};if(_0x44f0f4['body']['id']){delete _0x44f0f4[_0x27a2('0x58')]['id'];}_0x44f0f4['body']['read']=!![];_0x44f0f4[_0x27a2('0x58')][_0x27a2('0x5d')]=moment()[_0x27a2('0x5e')](_0x27a2('0x5f'));_0x44f0f4[_0x27a2('0x58')][_0x27a2('0x60')]=_0x44f0f4[_0x27a2('0x58')][_0x27a2('0x60')]||_0x44f0f4['user']['id'];_0x53fbc4[_0x27a2('0x61')]['id']=_0x44f0f4[_0x27a2('0x58')]['UserId'];return db['OpenchannelMessage'][_0x27a2('0x56')]({'where':{'id':_0x44f0f4[_0x27a2('0x54')]['id'],'UserId':null}})[_0x27a2('0x20')](handleEntityNotFound(_0x5ed729,null))[_0x27a2('0x20')](saveUpdates(_0x44f0f4[_0x27a2('0x58')],null))[_0x27a2('0x20')](function(_0x58cbf7){if(_0x58cbf7){_0x53fbc4[_0x27a2('0x28')]=_0x58cbf7['get']({'plain':!![]});return db[_0x27a2('0x62')][_0x27a2('0x56')]({'where':{'id':_0x58cbf7[_0x27a2('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5ed729,null))[_0x27a2('0x20')](function(_0x106017){if(_0x106017){return _0x106017['update']({'UserId':_0x44f0f4['body'][_0x27a2('0x60')],'read1stAt':_[_0x27a2('0x64')](_0x106017['read1stAt'])?moment()[_0x27a2('0x5e')](_0x27a2('0x5f')):undefined});}return null;})['then'](function(_0x32db1e){if(_0x32db1e){_0x53fbc4[_0x27a2('0x65')]=_0x32db1e['get']({'plain':!![]});interaction_log[_0x27a2('0x29')](_0x27a2('0x66'),_0x44f0f4[_0x27a2('0x67')]['id'],_0x44f0f4[_0x27a2('0x67')][_0x27a2('0x39')],_0x44f0f4[_0x27a2('0x67')]['role'],_0x53fbc4[_0x27a2('0x65')]['id'],_0x44f0f4[_0x27a2('0x58')]?JSON['stringify'](_0x44f0f4[_0x27a2('0x58')]):_0x27a2('0x68'));return respondWithRpcPromise(_0x27a2('0x69'),_0x27a2('0x6a'),_0x53fbc4);}return null;})[_0x27a2('0x20')](function(_0x2b17b4){var _0x453066=_0x27a2('0x6b')+_0x2b17b4[_0x27a2('0x28')]['ContactId'];return db['sequelize'][_0x27a2('0x41')](_0x453066,{'type':db[_0x27a2('0x6c')][_0x27a2('0x6d')][_0x27a2('0x6e')],'raw':!![]})['then'](function(_0x3a5f83){return _0x3a5f83;});})[_0x27a2('0x20')](function(_0x16f7c1){if(_0x16f7c1){_0x53fbc4[_0x27a2('0x28')][_0x27a2('0x6f')]=_0x16f7c1[0x0];if(!_0x44f0f4[_0x27a2('0x58')]['UserId'])return;return db['User']['find']({'where':{'id':_0x44f0f4['body'][_0x27a2('0x60')],'role':_0x27a2('0x61')},'attributes':['id',_0x27a2('0x39'),_0x27a2('0x70'),_0x27a2('0x71'),_0x27a2('0x72')],'raw':!![]});}return null;})[_0x27a2('0x20')](function(_0xec386b){if(!_0xec386b)return null;_0x53fbc4[_0x27a2('0x28')][_0x27a2('0x61')]=_0xec386b;return _0x53fbc4;})[_0x27a2('0x20')](function(_0x468935){if(_0x468935){if(_0x44f0f4['body']['manual']){_0x53fbc4[_0x27a2('0x28')][_0x27a2('0x73')]=util[_0x27a2('0x5e')]('SIP/%s',_0x44f0f4[_0x27a2('0x67')][_0x27a2('0x39')]);_0x53fbc4[_0x27a2('0x28')][_0x27a2('0x74')]=_0x53fbc4[_0x27a2('0x74')];_0x53fbc4[_0x27a2('0x28')][_0x27a2('0x75')]=_0x53fbc4[_0x27a2('0x74')];_0x53fbc4[_0x27a2('0x28')]['event']=_0x27a2('0x5b');return respondWithRpcPromise('EventManager',_0x27a2('0x76'),{'event':_0x27a2('0x77'),'message':_0x53fbc4[_0x27a2('0x28')]},client9002)['then'](function(){return _0x53fbc4;});}return _0x53fbc4;}return null;})[_0x27a2('0x20')](respondWithResult(_0x5ed729,null))[_0x27a2('0x2a')](handleError(_0x5ed729,null));};var interaction_log=require('../../config/logger')(_0x27a2('0x5a'));exports['reject']=function(_0x542bf2,_0x58ab64,_0x5f1848){var _0x2a2abd={'agent':{},'channel':'openchannel'};if(_0x542bf2[_0x27a2('0x58')]['id']){delete _0x542bf2[_0x27a2('0x58')]['id'];}_0x542bf2[_0x27a2('0x58')][_0x27a2('0x60')]=_0x542bf2['body'][_0x27a2('0x60')]||_0x542bf2[_0x27a2('0x67')]['id'];_0x2a2abd['agent']['id']=_0x542bf2[_0x27a2('0x58')][_0x27a2('0x60')];return db[_0x27a2('0x3d')][_0x27a2('0x56')]({'where':{'id':_0x542bf2[_0x27a2('0x54')]['id'],'UserId':null}})[_0x27a2('0x20')](handleEntityNotFound(_0x58ab64,null))['then'](function(_0x44c527){if(_0x44c527){_0x2a2abd[_0x27a2('0x28')]=_0x44c527[_0x27a2('0x78')]({'plain':!![]});return db[_0x27a2('0x62')]['find']({'where':{'id':_0x44c527['OpenchannelInteractionId']}});}return null;})[_0x27a2('0x20')](handleEntityNotFound(_0x58ab64,null))[_0x27a2('0x20')](function(_0x9c8ec){if(_0x9c8ec){_0x2a2abd[_0x27a2('0x65')]=_0x9c8ec[_0x27a2('0x78')]({'plain':!![]});interaction_log[_0x27a2('0x29')](_0x27a2('0x79'),_0x542bf2['user']['id'],_0x542bf2['user'][_0x27a2('0x39')],_0x542bf2['user'][_0x27a2('0x7a')],_0x2a2abd[_0x27a2('0x65')]['id'],_0x542bf2[_0x27a2('0x58')]?JSON['stringify'](_0x542bf2['body']):_0x27a2('0x68'));return respondWithRpcPromise(_0x27a2('0x7b'),_0x27a2('0x7c'),_0x2a2abd);}return null;})['then'](function(_0x34d5b0){var _0x3c32ec=_0x27a2('0x6b')+_0x34d5b0[_0x27a2('0x28')][_0x27a2('0x7d')];return db[_0x27a2('0x7e')][_0x27a2('0x41')](_0x3c32ec,{'type':db[_0x27a2('0x6c')][_0x27a2('0x6d')][_0x27a2('0x6e')],'raw':!![]})['then'](function(_0x2d8634){return _0x2d8634;});})[_0x27a2('0x20')](function(_0x1419e6){if(_0x1419e6){_0x2a2abd[_0x27a2('0x28')]['contact']=_0x1419e6[0x0];if(!_0x542bf2['body']['UserId'])return;return db[_0x27a2('0x7f')]['find']({'where':{'id':_0x542bf2['body'][_0x27a2('0x60')],'role':_0x27a2('0x61')},'attributes':['id','name','fullname',_0x27a2('0x71'),'internal'],'raw':!![]});}return null;})[_0x27a2('0x20')](function(_0x5daaef){if(!_0x5daaef)return null;_0x2a2abd[_0x27a2('0x28')][_0x27a2('0x61')]=_0x5daaef;return _0x2a2abd;})[_0x27a2('0x20')](function(_0x2566d0){if(_0x2566d0){_0x2566d0[_0x27a2('0x28')][_0x27a2('0x73')]=util[_0x27a2('0x5e')](_0x27a2('0x80'),_0x542bf2[_0x27a2('0x67')][_0x27a2('0x39')]);_0x2566d0[_0x27a2('0x28')]['channel']=_0x2a2abd[_0x27a2('0x74')];_0x2566d0['message'][_0x27a2('0x75')]=_0x2a2abd['channel'];_0x2566d0[_0x27a2('0x28')][_0x27a2('0x81')]=_0x27a2('0x35');respondWithRpcPromise(_0x27a2('0x76'),_0x27a2('0x76'),{'event':_0x27a2('0x82'),'message':_0x2566d0[_0x27a2('0x28')]},client9002);return _0x2a2abd;}return null;})[_0x27a2('0x20')](respondWithResult(_0x58ab64,null))[_0x27a2('0x2a')](handleError(_0x58ab64,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index fd5b8b7..5bdcaa8 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 _0xd655=['../../mysqldb','OpenchannelMessage','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5a42d9,_0x2d397e){var _0x190cf2=function(_0x57430a){while(--_0x57430a){_0x5a42d9['push'](_0x5a42d9['shift']());}};_0x190cf2(++_0x2d397e);}(_0xd655,0x1ca));var _0x5d65=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0xd655[_0x4fda88];return _0xe37511;};'use strict';var EventEmitter=require(_0x5d65('0x0'));var OpenchannelMessage=require(_0x5d65('0x1'))['db'][_0x5d65('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d65('0x3'),'afterUpdate':_0x5d65('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa1731a){return function(_0x27fc04,_0xaaf09b,_0x26d46c){OpenchannelMessageEvents[_0x5d65('0x5')](_0xa1731a+':'+_0x27fc04['id'],_0x27fc04);OpenchannelMessageEvents['emit'](_0xa1731a,_0x27fc04);_0x26d46c(null);};}for(var e in events){if(events[_0x5d65('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5d65('0x7')](e,emitEvent(event));}}module[_0x5d65('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xc875=['exports','events','../../mysqldb','OpenchannelMessage','save','update','emit','hasOwnProperty','hook'];(function(_0x473d2a,_0x588d94){var _0x31d5ca=function(_0x486b06){while(--_0x486b06){_0x473d2a['push'](_0x473d2a['shift']());}};_0x31d5ca(++_0x588d94);}(_0xc875,0x12a));var _0x5c87=function(_0x23b7cb,_0x40f1a0){_0x23b7cb=_0x23b7cb-0x0;var _0x275c9e=_0xc875[_0x23b7cb];return _0x275c9e;};'use strict';var EventEmitter=require(_0x5c87('0x0'));var OpenchannelMessage=require(_0x5c87('0x1'))['db'][_0x5c87('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c87('0x3'),'afterUpdate':_0x5c87('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1424d7){return function(_0xa5e3a7,_0x5d8fcc,_0x554fd6){OpenchannelMessageEvents[_0x5c87('0x5')](_0x1424d7+':'+_0xa5e3a7['id'],_0xa5e3a7);OpenchannelMessageEvents['emit'](_0x1424d7,_0xa5e3a7);_0x554fd6(null);};}for(var e in events){if(events[_0x5c87('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5c87('0x7')](e,emitEvent(event));}}module[_0x5c87('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e7cc24a..657a8fa 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 _0x07fc=['openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','format','threadId','inspect','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07fc,0xb8));var _0xc07f=function(_0x5d7454,_0x1db327){_0x5d7454=_0x5d7454-0x0;var _0x16d54a=_0x07fc[_0x5d7454];return _0x16d54a;};'use strict';var _=require('lodash');var util=require(_0xc07f('0x0'));var logger=require('../../config/logger')(_0xc07f('0x1'));var moment=require(_0xc07f('0x2'));var BPromise=require(_0xc07f('0x3'));var rp=require(_0xc07f('0x4'));var fs=require('fs');var path=require(_0xc07f('0x5'));var rimraf=require(_0xc07f('0x6'));var config=require(_0xc07f('0x7'));var attributes=require(_0xc07f('0x8'));module[_0xc07f('0x9')]=function(_0x139b48,_0x103dac){return _0x139b48[_0xc07f('0xa')](_0xc07f('0xb'),attributes,{'tableName':_0xc07f('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xc07f('0xd')],'type':_0xc07f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x197a02,_0x639b27,_0x54cbea){var _0xff26aa=_0x139b48[_0xc07f('0xf')];var _0x2e4ee5=_0x197a02[_0xc07f('0x10')]({'plain':!![]});if(_0x2e4ee5[_0xc07f('0x11')][_0xc07f('0x12')]()==='in'||_0x2e4ee5['direction'][_0xc07f('0x12')]()===_0xc07f('0x13')&&!_0x2e4ee5[_0xc07f('0x14')]&&!_['isNil'](_0x2e4ee5[_0xc07f('0x15')])){_0xff26aa[_0xc07f('0x16')][_0xc07f('0x17')]({'where':{'id':_0x2e4ee5[_0xc07f('0x18')]}})[_0xc07f('0x19')](function(_0x773070){if(_0x773070){_0x773070[_0xc07f('0x1a')]({'lastMsgAt':_0x2e4ee5['createdAt'],'lastMsgDirection':_0x2e4ee5[_0xc07f('0x11')][_0xc07f('0x12')]()});}})[_0xc07f('0x1b')](function(_0x49e3bd){console[_0xc07f('0x1c')](_0x49e3bd);});}if(_0x2e4ee5[_0xc07f('0x11')]===_0xc07f('0x13')&&!_0x2e4ee5['secret']){var _0x268571;_0xff26aa[_0xc07f('0x1d')]['describe']()['then'](function(_0x58feac){return _0xff26aa['OpenchannelAccount']['find']({'where':{'id':_0x2e4ee5[_0xc07f('0x1e')]},'include':[{'model':_0xff26aa[_0xc07f('0x16')],'as':_0xc07f('0x1f'),'where':{'id':_0x2e4ee5[_0xc07f('0x18')]},'limit':0x1,'include':[{'model':_0xff26aa[_0xc07f('0x1d')],'as':_0xc07f('0x20'),'attributes':_['keys'](_0x58feac)}]}]});})[_0xc07f('0x19')](function(_0x5c33d7){_0x268571=_0x5c33d7[_0xc07f('0x10')]({'plain':!![]});if(_0x268571&&_0x268571[_0xc07f('0x21')]){logger[_0xc07f('0x22')](_0xc07f('0x23'),_0xc07f('0x24'),util['format'](_0xc07f('0x25'),_0x2e4ee5['id'],_0x268571[_0xc07f('0x21')]));if(_0x268571['Interactions']&&_0x268571[_0xc07f('0x1f')][_0xc07f('0x26')]){_0x2e4ee5[_0xc07f('0x27')]=_[_0xc07f('0x28')](_0x268571['Interactions'][0x0],_0xc07f('0x20'));_0x2e4ee5[_0xc07f('0x20')]=_0x268571[_0xc07f('0x1f')][0x0]['Contact'];}var _0x639b27={'method':_0xc07f('0x29'),'uri':encodeURI(_0x268571[_0xc07f('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x639b27[_0xc07f('0x2a')]){case _0xc07f('0x2b'):_0x639b27['qs']=_0x2e4ee5;break;case'POST':_0x639b27[_0xc07f('0xd')]=_0x2e4ee5;break;}return rp(_0x639b27)['then'](function(_0x23526a){logger[_0xc07f('0x22')](_0xc07f('0x23'),_0xc07f('0x24'),util[_0xc07f('0x2c')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2e4ee5['id'],_0x268571['replyUri']));if(_0x23526a['body'][_0xc07f('0x2d')]&&_0x23526a[_0xc07f('0xd')][_0xc07f('0x2d')]!=_0x2e4ee5['Interaction'][_0xc07f('0x2d')]){return _0xff26aa[_0xc07f('0x16')]['update']({'threadId':_0x23526a[_0xc07f('0xd')][_0xc07f('0x2d')]},{'where':{'id':_0x2e4ee5[_0xc07f('0x27')]['id']}});}else{return;}})[_0xc07f('0x19')](function(){return _0x197a02[_0xc07f('0x1a')]({'read':!![]});})[_0xc07f('0x1b')](function(_0x3b99d7){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xc07f('0x24'),util[_0xc07f('0x2e')](_0x3b99d7,{'showHidden':![],'depth':null}));_0x54cbea();});}else{_0x54cbea();}})[_0xc07f('0x2f')](function(){_0x54cbea();});}else{_0x54cbea();}}},'charset':'utf8mb4','collate':_0xc07f('0x30')});}; \ No newline at end of file +var _0xea0e=['Interactions','OpenchannelInteractionId','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','POST','afterCreate','threadId','Interaction','update','inspect','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','then','createdAt','catch','error','OpenchannelAccount','find','OpenchannelAccountId'];(function(_0x41aaff,_0x492197){var _0x4f0890=function(_0x595a44){while(--_0x595a44){_0x41aaff['push'](_0x41aaff['shift']());}};_0x4f0890(++_0x492197);}(_0xea0e,0x1c2));var _0xeea0=function(_0x2abbc5,_0x29f737){_0x2abbc5=_0x2abbc5-0x0;var _0x129f65=_0xea0e[_0x2abbc5];return _0x129f65;};'use strict';var _=require(_0xeea0('0x0'));var util=require(_0xeea0('0x1'));var logger=require('../../config/logger')(_0xeea0('0x2'));var moment=require(_0xeea0('0x3'));var BPromise=require(_0xeea0('0x4'));var rp=require(_0xeea0('0x5'));var fs=require('fs');var path=require(_0xeea0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeea0('0x7'));module[_0xeea0('0x8')]=function(_0x21657d,_0x345750){return _0x21657d[_0xeea0('0x9')](_0xeea0('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xeea0('0xb'),'fields':[_0xeea0('0xc')],'type':_0xeea0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a57bd,_0x4a8a4a,_0x217b22){var _0x55897a=_0x21657d[_0xeea0('0xe')];var _0x188582=_0x3a57bd[_0xeea0('0xf')]({'plain':!![]});if(_0x188582[_0xeea0('0x10')][_0xeea0('0x11')]()==='in'||_0x188582[_0xeea0('0x10')][_0xeea0('0x11')]()===_0xeea0('0x12')&&!_0x188582[_0xeea0('0x13')]&&!_['isNil'](_0x188582[_0xeea0('0x14')])){_0x55897a[_0xeea0('0x15')][_0xeea0('0x16')]({'where':{'id':_0x188582['OpenchannelInteractionId']}})[_0xeea0('0x17')](function(_0x4be073){if(_0x4be073){_0x4be073['update']({'lastMsgAt':_0x188582[_0xeea0('0x18')],'lastMsgDirection':_0x188582[_0xeea0('0x10')]['toLowerCase']()});}})[_0xeea0('0x19')](function(_0x31c2be){console[_0xeea0('0x1a')](_0x31c2be);});}if(_0x188582[_0xeea0('0x10')]==='out'&&!_0x188582[_0xeea0('0x13')]){var _0x5d5122;_0x55897a['CmContact']['describe']()[_0xeea0('0x17')](function(_0x1a5a64){return _0x55897a[_0xeea0('0x1b')][_0xeea0('0x1c')]({'where':{'id':_0x188582[_0xeea0('0x1d')]},'include':[{'model':_0x55897a[_0xeea0('0x15')],'as':_0xeea0('0x1e'),'where':{'id':_0x188582[_0xeea0('0x1f')]},'limit':0x1,'include':[{'model':_0x55897a[_0xeea0('0x20')],'as':_0xeea0('0x21'),'attributes':_[_0xeea0('0x22')](_0x1a5a64)}]}]});})[_0xeea0('0x17')](function(_0x488eac){_0x5d5122=_0x488eac[_0xeea0('0xf')]({'plain':!![]});if(_0x5d5122&&_0x5d5122['replyUri']){logger[_0xeea0('0x23')](_0xeea0('0x24'),'afterCreate',util[_0xeea0('0x25')](_0xeea0('0x26'),_0x188582['id'],_0x5d5122[_0xeea0('0x27')]));if(_0x5d5122[_0xeea0('0x1e')]&&_0x5d5122[_0xeea0('0x1e')][_0xeea0('0x28')]){_0x188582['Interaction']=_['omit'](_0x5d5122[_0xeea0('0x1e')][0x0],_0xeea0('0x21'));_0x188582[_0xeea0('0x21')]=_0x5d5122[_0xeea0('0x1e')][0x0][_0xeea0('0x21')];}var _0x4a8a4a={'method':_0xeea0('0x29'),'uri':encodeURI(_0x5d5122[_0xeea0('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4a8a4a['method']){case'GET':_0x4a8a4a['qs']=_0x188582;break;case _0xeea0('0x29'):_0x4a8a4a['body']=_0x188582;break;}return rp(_0x4a8a4a)[_0xeea0('0x17')](function(_0x4ef58f){logger['info'](_0xeea0('0x24'),_0xeea0('0x2a'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x188582['id'],_0x5d5122[_0xeea0('0x27')]));if(_0x4ef58f[_0xeea0('0xc')][_0xeea0('0x2b')]&&_0x4ef58f[_0xeea0('0xc')]['threadId']!=_0x188582[_0xeea0('0x2c')][_0xeea0('0x2b')]){return _0x55897a[_0xeea0('0x15')][_0xeea0('0x2d')]({'threadId':_0x4ef58f[_0xeea0('0xc')][_0xeea0('0x2b')]},{'where':{'id':_0x188582['Interaction']['id']}});}else{return;}})[_0xeea0('0x17')](function(){return _0x3a57bd['update']({'read':!![]});})[_0xeea0('0x19')](function(_0x41514e){logger[_0xeea0('0x1a')](_0xeea0('0x24'),_0xeea0('0x2a'),util[_0xeea0('0x2e')](_0x41514e,{'showHidden':![],'depth':null}));_0x217b22();});}else{_0x217b22();}})['finally'](function(){_0x217b22();});}else{_0x217b22();}}},'charset':_0xeea0('0x2f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 327cb93..8ab2c5a 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x454cbf,_0x4262dd){var _0x12eb05=function(_0x10d405){while(--_0x10d405){_0x454cbf['push'](_0x454cbf['shift']());}};_0x12eb05(++_0x4262dd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _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(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0xdb28,0x106));var _0x8db2=function(_0x119e0f,_0x477f46){_0x119e0f=_0x119e0f-0x0;var _0x1d8ca7=_0xdb28[_0x119e0f];return _0x1d8ca7;};'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 d5f509c..6270205 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 _0x0686=['update','removeListener','register','length','./openchannelMessage.events','save','remove'];(function(_0x232cbf,_0x3e2f33){var _0x1cd460=function(_0x29b4f3){while(--_0x29b4f3){_0x232cbf['push'](_0x232cbf['shift']());}};_0x1cd460(++_0x3e2f33);}(_0x0686,0x123));var _0x6068=function(_0x2119aa,_0x1ee338){_0x2119aa=_0x2119aa-0x0;var _0x161f6a=_0x0686[_0x2119aa];return _0x161f6a;};'use strict';var OpenchannelMessageEvents=require(_0x6068('0x0'));var events=[_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x3')];function createListener(_0x199954,_0x408d70){return function(_0xe6eb70){_0x408d70['emit'](_0x199954,_0xe6eb70);};}function removeListener(_0x22449d,_0x4ccea4){return function(){OpenchannelMessageEvents[_0x6068('0x4')](_0x22449d,_0x4ccea4);};}exports[_0x6068('0x5')]=function(_0x2d4dd0){for(var _0x3e5dfd=0x0,_0x37489b=events[_0x6068('0x6')];_0x3e5dfd<_0x37489b;_0x3e5dfd++){var _0x3eb140=events[_0x3e5dfd];var _0x4e0ccf=createListener('openchannelMessage:'+_0x3eb140,_0x2d4dd0);OpenchannelMessageEvents['on'](_0x3eb140,_0x4e0ccf);}}; \ No newline at end of file +var _0x77a5=['remove','update','emit','removeListener','register','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x77a5,0x196));var _0x577a=function(_0x5f5b7d,_0x3a3dc5){_0x5f5b7d=_0x5f5b7d-0x0;var _0x1c4b5f=_0x77a5[_0x5f5b7d];return _0x1c4b5f;};'use strict';var OpenchannelMessageEvents=require(_0x577a('0x0'));var events=[_0x577a('0x1'),_0x577a('0x2'),_0x577a('0x3')];function createListener(_0x21f087,_0x428642){return function(_0x31eb76){_0x428642[_0x577a('0x4')](_0x21f087,_0x31eb76);};}function removeListener(_0x950e98,_0x1cce35){return function(){OpenchannelMessageEvents[_0x577a('0x5')](_0x950e98,_0x1cce35);};}exports[_0x577a('0x6')]=function(_0x57be67){for(var _0x62614c=0x0,_0x4e14e=events['length'];_0x62614c<_0x4e14e;_0x62614c++){var _0xa3bc95=events[_0x62614c];var _0x5244c9=createListener(_0x577a('0x7')+_0xa3bc95,_0x57be67);OpenchannelMessageEvents['on'](_0xa3bc95,_0x5244c9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c307b27..2ced47f 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 _0x1209=['index','/describe','describe','/:id','show','/:id/members','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x14ba7c,_0x579807){var _0x549d05=function(_0x15c0ba){while(--_0x15c0ba){_0x14ba7c['push'](_0x14ba7c['shift']());}};_0x549d05(++_0x579807);}(_0x1209,0xc9));var _0x9120=function(_0x4ba611,_0x1190e1){_0x4ba611=_0x4ba611-0x0;var _0x4732b6=_0x1209[_0x4ba611];return _0x4732b6;};'use strict';var multer=require(_0x9120('0x0'));var util=require(_0x9120('0x1'));var path=require('path');var timeout=require(_0x9120('0x2'));var express=require(_0x9120('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9120('0x4'));var interaction=require(_0x9120('0x5'));var config=require('../../config/environment');var controller=require(_0x9120('0x6'));router[_0x9120('0x7')]('/',auth[_0x9120('0x8')](),controller[_0x9120('0x9')]);router[_0x9120('0x7')](_0x9120('0xa'),auth[_0x9120('0x8')](),controller[_0x9120('0xb')]);router[_0x9120('0x7')](_0x9120('0xc'),auth[_0x9120('0x8')](),controller[_0x9120('0xd')]);router[_0x9120('0x7')](_0x9120('0xe'),auth[_0x9120('0x8')](),controller['getMembers']);router[_0x9120('0x7')]('/:id/teams',auth[_0x9120('0x8')](),controller[_0x9120('0xf')]);router[_0x9120('0x7')]('/:id/users',auth[_0x9120('0x8')](),controller[_0x9120('0x10')]);router[_0x9120('0x11')]('/',auth[_0x9120('0x8')](),controller[_0x9120('0x12')]);router[_0x9120('0x11')](_0x9120('0x13'),auth[_0x9120('0x8')](),controller[_0x9120('0x14')]);router[_0x9120('0x11')](_0x9120('0x15'),auth[_0x9120('0x8')](),controller[_0x9120('0x16')]);router[_0x9120('0x17')]('/:id',auth[_0x9120('0x8')](),controller[_0x9120('0x18')]);router[_0x9120('0x19')]('/:id',auth[_0x9120('0x8')](),controller[_0x9120('0x1a')]);router['delete'](_0x9120('0x13'),auth['isAuthenticated'](),controller[_0x9120('0x1b')]);router[_0x9120('0x19')](_0x9120('0x15'),auth['isAuthenticated'](),controller[_0x9120('0x1c')]);module[_0x9120('0x1d')]=router; \ No newline at end of file +var _0x7fd8=['get','/describe','describe','isAuthenticated','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','destroy','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x5bef0a,_0x1fb747){var _0x1a02ea=function(_0x51cc55){while(--_0x51cc55){_0x5bef0a['push'](_0x5bef0a['shift']());}};_0x1a02ea(++_0x1fb747);}(_0x7fd8,0xd8));var _0x87fd=function(_0x32824e,_0x140783){_0x32824e=_0x32824e-0x0;var _0x2e26af=_0x7fd8[_0x32824e];return _0x2e26af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x87fd('0x0'));var timeout=require(_0x87fd('0x1'));var express=require(_0x87fd('0x2'));var router=express[_0x87fd('0x3')]();var fs_extra=require(_0x87fd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x87fd('0x5'));var config=require(_0x87fd('0x6'));var controller=require(_0x87fd('0x7'));router[_0x87fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x87fd('0x8')](_0x87fd('0x9'),auth['isAuthenticated'](),controller[_0x87fd('0xa')]);router[_0x87fd('0x8')]('/:id',auth[_0x87fd('0xb')](),controller[_0x87fd('0xc')]);router[_0x87fd('0x8')]('/:id/members',auth[_0x87fd('0xb')](),controller[_0x87fd('0xd')]);router[_0x87fd('0x8')](_0x87fd('0xe'),auth[_0x87fd('0xb')](),controller[_0x87fd('0xf')]);router['get'](_0x87fd('0x10'),auth['isAuthenticated'](),controller[_0x87fd('0x11')]);router[_0x87fd('0x12')]('/',auth[_0x87fd('0xb')](),controller[_0x87fd('0x13')]);router[_0x87fd('0x12')](_0x87fd('0xe'),auth[_0x87fd('0xb')](),controller[_0x87fd('0x14')]);router[_0x87fd('0x12')](_0x87fd('0x10'),auth[_0x87fd('0xb')](),controller[_0x87fd('0x15')]);router[_0x87fd('0x16')]('/:id',auth[_0x87fd('0xb')](),controller[_0x87fd('0x17')]);router[_0x87fd('0x18')](_0x87fd('0x19'),auth[_0x87fd('0xb')](),controller[_0x87fd('0x1a')]);router[_0x87fd('0x18')]('/:id/teams',auth[_0x87fd('0xb')](),controller['removeTeams']);router[_0x87fd('0x18')](_0x87fd('0x10'),auth[_0x87fd('0xb')](),controller[_0x87fd('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c6bec7f..a560b90 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 _0x56a1=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x212ca6,_0x155ec9){var _0x3ce20f=function(_0x2a7aa4){while(--_0x2a7aa4){_0x212ca6['push'](_0x212ca6['shift']());}};_0x3ce20f(++_0x155ec9);}(_0x56a1,0x1ef));var _0x156a=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x56a1[_0xae282f];return _0x5f46d4;};'use strict';var Sequelize=require(_0x156a('0x0'));module[_0x156a('0x1')]={'name':{'type':Sequelize[_0x156a('0x2')],'unique':_0x156a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x156a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x156a('0x5')](_0x156a('0x6'),_0x156a('0x7'),_0x156a('0x8'))}}; \ No newline at end of file +var _0xdd07=['roundrobin','STRING','INTEGER','beepall'];(function(_0x51beb3,_0x959fc1){var _0x5dc752=function(_0x5d9810){while(--_0x5d9810){_0x51beb3['push'](_0x51beb3['shift']());}};_0x5dc752(++_0x959fc1);}(_0xdd07,0x191));var _0x7dd0=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xdd07[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7dd0('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7dd0('0x0')]},'timeout':{'type':Sequelize[_0x7dd0('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7dd0('0x2'),_0x7dd0('0x3'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6aab57a..167d376 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 _0x550b=['Agents','sequelize','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','addAgents','omit','spread','removeAgents','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','OpenchannelQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','where','include','catch','params','keys','query','filters','intersection','model','fields','attributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','findAll','findAndCountAll','agent','rows','format','SIP','openchannelPause','updatedAt','getTeams','Team','length','nolimit','addTeams','User','online','voicePause','flatMap'];(function(_0x40f326,_0x229594){var _0x5edb45=function(_0x4b1d68){while(--_0x4b1d68){_0x40f326['push'](_0x40f326['shift']());}};_0x5edb45(++_0x229594);}(_0x550b,0x193));var _0xb550=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x550b[_0x18ab2a];return _0x16dcee;};'use strict';var BPromise=require(_0xb550('0x0'));var util=require(_0xb550('0x1'));var _=require(_0xb550('0x2'));var squel=require(_0xb550('0x3'));var Redis=require(_0xb550('0x4'));var qs=require(_0xb550('0x5'));var logger=require(_0xb550('0x6'))('api');var config=require(_0xb550('0x7'));var db=require('../../mysqldb')['db'];config[_0xb550('0x8')]=_[_0xb550('0x9')](config[_0xb550('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb550('0xa'))(new Redis(config[_0xb550('0x8')]));require(_0xb550('0xb'))[_0xb550('0xc')](socket);function respondWithStatusCode(_0x3af91f,_0x1e2a8c){_0x1e2a8c=_0x1e2a8c||0xcc;return function(_0x58d548){if(_0x58d548){return _0x3af91f['sendStatus'](_0x1e2a8c);}return _0x3af91f[_0xb550('0xd')](_0x1e2a8c)[_0xb550('0xe')]();};}function respondWithResult(_0x23ea48,_0x2710e9){_0x2710e9=_0x2710e9||0xc8;return function(_0x186680){if(_0x186680){return _0x23ea48[_0xb550('0xd')](_0x2710e9)[_0xb550('0xf')](_0x186680);}};}function respondWithFilteredResult(_0x416549,_0x1028ae){return function(_0x15303d){if(_0x15303d){var _0x4327e6=typeof _0x1028ae[_0xb550('0x10')]==='undefined'&&typeof _0x1028ae[_0xb550('0x11')]===_0xb550('0x12');var _0x3d00e4=_0x15303d[_0xb550('0x13')];var _0x1aea32=_0x4327e6?0x0:_0x1028ae[_0xb550('0x10')];var _0x21b4e2=_0x4327e6?_0x15303d['count']:_0x1028ae[_0xb550('0x10')]+_0x1028ae[_0xb550('0x11')];var _0x3bec76;if(_0x21b4e2>=_0x3d00e4){_0x21b4e2=_0x3d00e4;_0x3bec76=0xc8;}else{_0x3bec76=0xce;}_0x416549[_0xb550('0xd')](_0x3bec76);return _0x416549[_0xb550('0x14')](_0xb550('0x15'),_0x1aea32+'-'+_0x21b4e2+'/'+_0x3d00e4)[_0xb550('0xf')](_0x15303d);}return null;};}function saveUpdates(_0x41ac45){return function(_0x226436){if(_0x226436){return _0x226436[_0xb550('0x16')](_0x41ac45)[_0xb550('0x17')](function(_0x11eb3a){return _0x11eb3a;});}return null;};}function removeEntity(_0x1dee2c){return function(_0x4b139f){if(_0x4b139f){return _0x4b139f['destroy']()[_0xb550('0x17')](function(){var _0x5d4056=_0x4b139f['get']({'plain':!![]});var _0x7f82=_0xb550('0x18');return db[_0xb550('0x19')][_0xb550('0x1a')]({'where':{'type':_0x7f82,'resourceId':_0x5d4056['id']}})['then'](function(){return _0x4b139f;});})[_0xb550('0x17')](function(){_0x1dee2c[_0xb550('0xd')](0xcc)[_0xb550('0xe')]();});}};}function handleEntityNotFound(_0x17bde7){return function(_0x5ecd56){if(!_0x5ecd56){_0x17bde7[_0xb550('0x1b')](0x194);}return _0x5ecd56;};}function handleError(_0x579c2e,_0x5555ab){_0x5555ab=_0x5555ab||0x1f4;return function(_0x18f4dc){logger[_0xb550('0x1c')](_0x18f4dc[_0xb550('0x1d')]);if(_0x18f4dc[_0xb550('0x1e')]){delete _0x18f4dc[_0xb550('0x1e')];}_0x579c2e[_0xb550('0xd')](_0x5555ab)[_0xb550('0x1f')](_0x18f4dc);};}exports[_0xb550('0x20')]=function(_0x56e58a,_0x32dd97){var _0x4ac8b9={};var _0x32c6e6={'count':0x0,'rows':[]};var _0xfeebde=_[_0xb550('0x21')](db[_0xb550('0x22')][_0xb550('0x23')],function(_0x52e28e){return{'name':_0x52e28e[_0xb550('0x24')],'type':_0x52e28e[_0xb550('0x25')]['key']};});_0x4ac8b9=qs['getOptions'](_0xfeebde,_0x56e58a);var _0x3f4f62={'where':_0x4ac8b9[_0xb550('0x26')]};return db[_0xb550('0x22')][_0xb550('0x13')](_0x3f4f62)[_0xb550('0x17')](function(_0x35cbbf){_0x32c6e6[_0xb550('0x13')]=_0x35cbbf;_0x4ac8b9[_0xb550('0x27')]=qs[_0xb550('0x27')](_0x56e58a['query']);return db[_0xb550('0x22')]['findAll'](_0x4ac8b9);})[_0xb550('0x17')](function(_0x2d9343){_0x32c6e6['rows']=_0x2d9343;return _0x32c6e6;})[_0xb550('0x17')](respondWithFilteredResult(_0x32dd97,_0x4ac8b9))[_0xb550('0x28')](handleError(_0x32dd97,null));};exports['show']=function(_0xa4b594,_0x363a1d){var _0x49c278={'raw':!![],'where':{'id':_0xa4b594[_0xb550('0x29')]['id']}},_0x571b27={};_0x571b27['model']=_[_0xb550('0x2a')](db['OpenchannelQueue'][_0xb550('0x23')]);_0x571b27[_0xb550('0x2b')]=_['keys'](_0xa4b594[_0xb550('0x2b')]);_0x571b27[_0xb550('0x2c')]=_['intersection'](_0x571b27['model'],_0x571b27[_0xb550('0x2b')]);_0x49c278['attributes']=_[_0xb550('0x2d')](_0x571b27[_0xb550('0x2e')],qs[_0xb550('0x2f')](_0xa4b594[_0xb550('0x2b')][_0xb550('0x2f')]));_0x49c278[_0xb550('0x30')]=_0x49c278['attributes']['length']?_0x49c278[_0xb550('0x30')]:_0x571b27[_0xb550('0x2e')];if(_0xa4b594[_0xb550('0x2b')][_0xb550('0x31')]){_0x49c278[_0xb550('0x27')]=[{'all':!![]}];}_0x49c278=_[_0xb550('0x32')]({},_0x49c278,_0xa4b594[_0xb550('0x33')]);return db[_0xb550('0x22')][_0xb550('0x34')](_0x49c278)[_0xb550('0x17')](handleEntityNotFound(_0x363a1d,null))[_0xb550('0x17')](respondWithResult(_0x363a1d,null))['catch'](handleError(_0x363a1d,null));};exports['create']=function(_0x7a178f,_0x55c6df){return db[_0xb550('0x22')][_0xb550('0x35')](_0x7a178f['body'],{})[_0xb550('0x17')](function(_0x389c80){var _0x41c887=_0x7a178f[_0xb550('0x36')]['get']({'plain':!![]});if(!_0x41c887)throw new Error(_0xb550('0x37'));if(_0x41c887[_0xb550('0x38')]==='user'){var _0x22b279=_0x389c80[_0xb550('0x39')]({'plain':!![]});var _0x3c3207=_0xb550('0x18');return db[_0xb550('0x3a')][_0xb550('0x34')]({'where':{'name':_0x3c3207,'userProfileId':_0x41c887[_0xb550('0x3b')]},'raw':!![]})[_0xb550('0x17')](function(_0x4d590b){if(_0x4d590b&&_0x4d590b[_0xb550('0x3c')]===0x0){return db[_0xb550('0x19')]['create']({'name':_0x22b279[_0xb550('0x1e')],'resourceId':_0x22b279['id'],'type':_0x4d590b[_0xb550('0x1e')],'sectionId':_0x4d590b['id']},{})[_0xb550('0x17')](function(){return _0x389c80;});}else{return _0x389c80;}})['catch'](function(_0x572b24){logger[_0xb550('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572b24);throw _0x572b24;});}return _0x389c80;})[_0xb550('0x17')](respondWithResult(_0x55c6df,0xc9))[_0xb550('0x28')](handleError(_0x55c6df,null));};exports[_0xb550('0x16')]=function(_0x5ea6c9,_0x3d2ee3){if(_0x5ea6c9[_0xb550('0x3d')]['id']){delete _0x5ea6c9['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x5ea6c9[_0xb550('0x29')]['id']}})[_0xb550('0x17')](handleEntityNotFound(_0x3d2ee3,null))[_0xb550('0x17')](saveUpdates(_0x5ea6c9['body'],null))['then'](respondWithResult(_0x3d2ee3,null))[_0xb550('0x28')](handleError(_0x3d2ee3,null));};exports[_0xb550('0x1a')]=function(_0x4019d1,_0x28891b){return db[_0xb550('0x22')][_0xb550('0x34')]({'where':{'id':_0x4019d1['params']['id']}})[_0xb550('0x17')](handleEntityNotFound(_0x28891b,null))[_0xb550('0x17')](removeEntity(_0x28891b,null))[_0xb550('0x28')](handleError(_0x28891b,null));};exports[_0xb550('0x3e')]=function(_0x4fc442,_0x576b35){return db['OpenchannelQueue'][_0xb550('0x3e')]()[_0xb550('0x17')](respondWithResult(_0x576b35,null))['catch'](handleError(_0x576b35,null));};exports[_0xb550('0x3f')]=function(_0x1ac917,_0x1881b1){var _0x576cd2={'raw':!![],'where':{}},_0x65da13={},_0x190b51;return db['OpenchannelQueue'][_0xb550('0x40')]({'where':{'id':_0x1ac917['params']['id']}})['then'](handleEntityNotFound(_0x1881b1,null))[_0xb550('0x17')](function(_0x478741){if(_0x478741){_0x190b51=_0x478741[_0xb550('0x39')]({'plain':!![]});_0x65da13[_0xb550('0x2e')]=_[_0xb550('0x2a')](db[_0xb550('0x41')]['rawAttributes']);_0x65da13[_0xb550('0x2b')]=_['keys'](_0x1ac917[_0xb550('0x2b')]);_0x65da13[_0xb550('0x2c')]=_[_0xb550('0x2d')](_0x65da13[_0xb550('0x2e')],_0x65da13[_0xb550('0x2b')]);_0x576cd2[_0xb550('0x30')]=_[_0xb550('0x2d')](_0x65da13[_0xb550('0x2e')],qs[_0xb550('0x2f')](_0x1ac917[_0xb550('0x2b')][_0xb550('0x2f')]));_0x576cd2[_0xb550('0x30')]=_0x576cd2['attributes']['length']?_0x576cd2['attributes']:_0x65da13[_0xb550('0x2e')];if(!_0x1ac917[_0xb550('0x2b')][_0xb550('0x42')]('nolimit')){_0x576cd2[_0xb550('0x11')]=qs[_0xb550('0x11')](_0x1ac917[_0xb550('0x2b')][_0xb550('0x11')]);_0x576cd2['offset']=qs[_0xb550('0x10')](_0x1ac917[_0xb550('0x2b')]['offset']);}_0x576cd2[_0xb550('0x43')]=qs[_0xb550('0x44')](_0x1ac917['query'][_0xb550('0x44')]);_0x576cd2[_0xb550('0x26')]=qs['filters'](_[_0xb550('0x45')](_0x1ac917['query'],_0x65da13[_0xb550('0x2c')]));_0x576cd2[_0xb550('0x26')][_0xb550('0x46')]=_0x478741['id'];if(_0x1ac917['query'][_0xb550('0x47')]){_0x576cd2[_0xb550('0x26')]=_[_0xb550('0x32')](_0x576cd2[_0xb550('0x26')],{'$or':_['map'](_0x576cd2[_0xb550('0x30')],function(_0x1786dd){var _0x26e95d={};_0x26e95d[_0x1786dd]={'$like':'%'+_0x1ac917[_0xb550('0x2b')][_0xb550('0x47')]+'%'};return _0x26e95d;})});}_0x576cd2=_[_0xb550('0x32')]({},_0x576cd2,_0x1ac917['options']);return db['UserOpenchannelQueue'][_0xb550('0x48')](_0x576cd2);}})['then'](function(_0x42b50d){if(_0x42b50d){return db['User'][_0xb550('0x49')]({'where':{'id':_[_0xb550('0x21')](_0x42b50d,'UserId'),'role':_0xb550('0x4a')},'attributes':['id',_0xb550('0x1e'),'openchannelPause','updatedAt','createdAt']});}})[_0xb550('0x17')](function(_0x3eecf2){if(_0x3eecf2){return{'count':_0x3eecf2[_0xb550('0x13')],'rows':_[_0xb550('0x21')](_0x3eecf2[_0xb550('0x4b')],function(_0x48b9d3){return{'membername':_0x48b9d3[_0xb550('0x1e')],'UserId':_0x48b9d3['id'],'queue_name':_0x190b51['name'],'OpenchannelQueueId':_0x190b51['id'],'interface':util[_0xb550('0x4c')]('%s/%s',_0xb550('0x4d'),_0x48b9d3['name']),'penalty':0x0,'paused':_0x48b9d3[_0xb550('0x4e')],'createdAt':_0x48b9d3['createdAt'],'updatedAt':_0x48b9d3[_0xb550('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb550('0x17')](respondWithFilteredResult(_0x1881b1,_0x576cd2))['catch'](handleError(_0x1881b1,null));};exports[_0xb550('0x50')]=function(_0xd7c2f4,_0x59b778){var _0x4058ef={};var _0x3e3bac={};var _0x4f9791;var _0x17903c;return db['OpenchannelQueue'][_0xb550('0x40')]({'where':{'id':_0xd7c2f4[_0xb550('0x29')]['id']}})[_0xb550('0x17')](handleEntityNotFound(_0x59b778,null))[_0xb550('0x17')](function(_0x291d32){if(_0x291d32){_0x4f9791=_0x291d32;_0x3e3bac['model']=_[_0xb550('0x2a')](db[_0xb550('0x51')][_0xb550('0x23')]);_0x3e3bac['query']=_['keys'](_0xd7c2f4[_0xb550('0x2b')]);_0x3e3bac[_0xb550('0x2c')]=_[_0xb550('0x2d')](_0x3e3bac[_0xb550('0x2e')],_0x3e3bac['query']);_0x4058ef[_0xb550('0x30')]=_['intersection'](_0x3e3bac[_0xb550('0x2e')],qs[_0xb550('0x2f')](_0xd7c2f4[_0xb550('0x2b')][_0xb550('0x2f')]));_0x4058ef[_0xb550('0x30')]=_0x4058ef['attributes'][_0xb550('0x52')]?_0x4058ef[_0xb550('0x30')]:_0x3e3bac['model'];_0x4058ef[_0xb550('0x43')]=qs[_0xb550('0x44')](_0xd7c2f4[_0xb550('0x2b')][_0xb550('0x44')]);_0x4058ef['where']=qs['filters'](_[_0xb550('0x45')](_0xd7c2f4[_0xb550('0x2b')],_0x3e3bac[_0xb550('0x2c')]));if(_0xd7c2f4[_0xb550('0x2b')][_0xb550('0x47')]){_0x4058ef[_0xb550('0x26')]=_[_0xb550('0x32')](_0x4058ef[_0xb550('0x26')],{'$or':_[_0xb550('0x21')](_0x4058ef[_0xb550('0x30')],function(_0x48bc4a){var _0x22ff4a={};_0x22ff4a[_0x48bc4a]={'$like':'%'+_0xd7c2f4[_0xb550('0x2b')]['filter']+'%'};return _0x22ff4a;})});}_0x4058ef=_[_0xb550('0x32')]({},_0x4058ef,_0xd7c2f4[_0xb550('0x33')]);return _0x4f9791[_0xb550('0x50')](_0x4058ef);}})['then'](function(_0xc3bc72){if(_0xc3bc72){_0x17903c=_0xc3bc72[_0xb550('0x52')];if(!_0xd7c2f4[_0xb550('0x2b')][_0xb550('0x42')](_0xb550('0x53'))){_0x4058ef[_0xb550('0x11')]=qs[_0xb550('0x11')](_0xd7c2f4[_0xb550('0x2b')]['limit']);_0x4058ef[_0xb550('0x10')]=qs['offset'](_0xd7c2f4['query']['offset']);}return _0x4f9791[_0xb550('0x50')](_0x4058ef);}})[_0xb550('0x17')](function(_0x50407e){if(_0x50407e){return _0x50407e?{'count':_0x17903c,'rows':_0x50407e}:null;}})[_0xb550('0x17')](respondWithResult(_0x59b778,null))[_0xb550('0x28')](handleError(_0x59b778,null));};exports[_0xb550('0x54')]=function(_0x1511c6,_0x3fbe21){var _0x32fe1e=_0x1511c6[_0xb550('0x3d')]['ids'];return db[_0xb550('0x51')][_0xb550('0x48')]({'where':{'id':_0x32fe1e},'attributes':['id'],'include':[{'model':db[_0xb550('0x55')],'as':'Agents','attributes':['id',_0xb550('0x1e'),_0xb550('0x56'),_0xb550('0x57'),'interface'],'raw':!![]}]})[_0xb550('0x17')](function(_0x44d55b){if(_0x44d55b){var _0xc45287=_[_0xb550('0x58')](_0x44d55b,function(_0xbac0eb){var _0xef5564=_0xbac0eb[_0xb550('0x39')]({'plain':!![]});return _0xef5564[_0xb550('0x59')];});return db['OpenchannelQueue'][_0xb550('0x34')]({'where':{'id':_0x1511c6[_0xb550('0x29')]['id']}})[_0xb550('0x17')](function(_0x35fde5){return db[_0xb550('0x5a')]['transaction'](function(_0x48816e){return _0x35fde5[_0xb550('0x54')](_0x32fe1e,{'transaction':_0x48816e})[_0xb550('0x17')](function(){return BPromise[_0xb550('0x5b')](_0xc45287,function(_0x163b38){return db[_0xb550('0x41')]['findOrCreate']({'where':{'UserId':_0x163b38['id'],'OpenchannelQueueId':_0x1511c6[_0xb550('0x29')]['id']},'transaction':_0x48816e});});})[_0xb550('0x17')](function(){_0xc45287[_0xb550('0x5c')](function(_0x6e5fe7){socket[_0xb550('0x5d')](_0xb550('0x5e'),{'UserId':_0x6e5fe7['id'],'OpenchannelQueueId':_0x35fde5['id']});});});});});}})[_0xb550('0x17')](respondWithStatusCode(_0x3fbe21,null))[_0xb550('0x28')](handleError(_0x3fbe21,null));};exports[_0xb550('0x5f')]=function(_0x3baf93,_0x1ebcb8){return db[_0xb550('0x51')]['findAll']({'where':{'id':_0x3baf93['query'][_0xb550('0x60')]},'attributes':['id'],'include':[{'model':db[_0xb550('0x55')],'as':_0xb550('0x59'),'attributes':['id'],'raw':!![]}]})[_0xb550('0x17')](handleEntityNotFound(_0x1ebcb8,null))[_0xb550('0x17')](function(_0xfc9e86){var _0x5d42b9=_[_0xb550('0x21')](_0xfc9e86,'id');var _0x2a152a=[];var _0x1bd4c2=[];var _0x37f3e1=squel[_0xb550('0x61')]();_0x37f3e1[_0xb550('0x62')](_0xb550('0x63'))[_0xb550('0x64')]('team_has_openchannel_queues','tq')[_0xb550('0x65')](_0xb550('0x66'),'ut',_0xb550('0x67'))[_0xb550('0x26')](_0xb550('0x68'),_0x3baf93[_0xb550('0x29')]['id']);for(var _0x48a925=0x0;_0x48a925<_0xfc9e86[_0xb550('0x52')];_0x48a925+=0x1){let _0x19cc67=_0xfc9e86[_0x48a925];for(var _0x43e707=0x0;_0x43e707<_0x19cc67[_0xb550('0x59')][_0xb550('0x52')];_0x43e707+=0x1){let _0x453050=_0x19cc67[_0xb550('0x59')][_0x43e707];var _0x33d1ea=_0x37f3e1[_0xb550('0x69')]();_0x33d1ea[_0xb550('0x26')]('ut.UserId\x20=\x20?',_0x453050['id']);_0x1bd4c2[_0xb550('0x6a')](db[_0xb550('0x5a')][_0xb550('0x2b')](_0x33d1ea['toString'](),{'type':db['sequelize'][_0xb550('0x6b')][_0xb550('0x6c')]})[_0xb550('0x17')](function(_0x1e8a24){if(_0x1e8a24[_0xb550('0x52')]===0x1){return _0x453050['id'];}else{var _0x4d2749=_[_0xb550('0x6d')](_[_0xb550('0x21')](_0x1e8a24,_0xb550('0x6e')),function(_0x2111e5){return _['includes'](_0x5d42b9,_0x2111e5);});if(_0x4d2749){return _0x453050['id'];}}}));}}return BPromise[_0xb550('0x6f')](_0x1bd4c2)[_0xb550('0x17')](function(_0x48c85a){_0x2a152a=_(_0x2a152a)[_0xb550('0x70')](_0x48c85a)[_0xb550('0x71')]()[_0xb550('0x72')]();return db[_0xb550('0x22')][_0xb550('0x34')]({'where':{'id':_0x3baf93[_0xb550('0x29')]['id']}})[_0xb550('0x17')](function(_0x1efb54){return db[_0xb550('0x5a')][_0xb550('0x73')](function(_0x4c6bd4){return _0x1efb54['removeTeams'](_0x3baf93['query']['ids'],{'transaction':_0x4c6bd4})[_0xb550('0x17')](function(){if(!_[_0xb550('0x74')](_0x2a152a)){return _0x1efb54['removeAgents'](_0x2a152a,{'transaction':_0x4c6bd4});}})[_0xb550('0x17')](function(){_0x2a152a[_0xb550('0x5c')](function(_0x1c7394){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x1c7394,'OpenchannelQueueId':_0x1efb54['id']});});});});});});})[_0xb550('0x17')](respondWithStatusCode(_0x1ebcb8,null))[_0xb550('0x28')](handleError(_0x1ebcb8,null));};exports[_0xb550('0x75')]=function(_0x1036f4,_0x52962d){return db[_0xb550('0x22')][_0xb550('0x34')]({'where':{'id':_0x1036f4[_0xb550('0x29')]['id']}})[_0xb550('0x17')](handleEntityNotFound(_0x52962d,null))[_0xb550('0x17')](function(_0x38c75b){if(_0x38c75b){return _0x38c75b['addAgents'](_0x1036f4['body'][_0xb550('0x60')],_[_0xb550('0x76')](_0x1036f4[_0xb550('0x3d')],['ids','id'])||{})[_0xb550('0x77')](function(_0x277573){for(var _0x3dcdb2=0x0;_0x3dcdb2<_0x1036f4[_0xb550('0x3d')]['ids']['length'];_0x3dcdb2+=0x1){socket[_0xb550('0x5d')](_0xb550('0x5e'),{'UserId':Number(_0x1036f4['body'][_0xb550('0x60')][_0x3dcdb2]),'OpenchannelQueueId':Number(_0x1036f4[_0xb550('0x29')]['id'])});}return _0x277573;});}})[_0xb550('0x17')](respondWithResult(_0x52962d,null))['catch'](handleError(_0x52962d,null));};exports['removeAgents']=function(_0x569ad0,_0x4f07fe){return db[_0xb550('0x22')][_0xb550('0x34')]({'where':{'id':_0x569ad0[_0xb550('0x29')]['id']}})['then'](handleEntityNotFound(_0x4f07fe,null))['then'](function(_0x4062da){if(_0x4062da){return _0x4062da[_0xb550('0x78')](_0x569ad0[_0xb550('0x2b')][_0xb550('0x60')])[_0xb550('0x17')](function(){if(_['isArray'](_0x569ad0[_0xb550('0x2b')][_0xb550('0x60')])){for(var _0x39f081=0x0;_0x39f081<_0x569ad0[_0xb550('0x2b')][_0xb550('0x60')][_0xb550('0x52')];_0x39f081+=0x1){socket[_0xb550('0x5d')](_0xb550('0x79'),{'UserId':Number(_0x569ad0[_0xb550('0x2b')][_0xb550('0x60')][_0x39f081]),'OpenchannelQueueId':Number(_0x569ad0['params']['id'])});}}else{socket[_0xb550('0x5d')](_0xb550('0x79'),{'UserId':Number(_0x569ad0[_0xb550('0x2b')][_0xb550('0x60')]),'OpenchannelQueueId':Number(_0x569ad0[_0xb550('0x29')]['id'])});}});}})[_0xb550('0x17')](respondWithStatusCode(_0x4f07fe,null))[_0xb550('0x28')](handleError(_0x4f07fe,null));};exports[_0xb550('0x7a')]=function(_0x4c0e23,_0x1dbfe0){var _0x7650ac={};var _0x2b94d1={};var _0x2244a6;var _0x7394e6;return db[_0xb550('0x22')][_0xb550('0x40')]({'where':{'id':_0x4c0e23[_0xb550('0x29')]['id']}})[_0xb550('0x17')](handleEntityNotFound(_0x1dbfe0,null))[_0xb550('0x17')](function(_0x18bb73){if(_0x18bb73){_0x2244a6=_0x18bb73;_0x2b94d1[_0xb550('0x2e')]=_[_0xb550('0x2a')](db['User']['rawAttributes']);_0x2b94d1[_0xb550('0x2b')]=_[_0xb550('0x2a')](_0x4c0e23[_0xb550('0x2b')]);_0x2b94d1[_0xb550('0x2c')]=_[_0xb550('0x2d')](_0x2b94d1[_0xb550('0x2e')],_0x2b94d1['query']);_0x7650ac['attributes']=_['intersection'](_0x2b94d1[_0xb550('0x2e')],qs[_0xb550('0x2f')](_0x4c0e23[_0xb550('0x2b')]['fields']));_0x7650ac[_0xb550('0x30')]=_0x7650ac[_0xb550('0x30')][_0xb550('0x52')]?_0x7650ac[_0xb550('0x30')]:_0x2b94d1[_0xb550('0x2e')];_0x7650ac['order']=qs[_0xb550('0x44')](_0x4c0e23[_0xb550('0x2b')]['sort']);_0x7650ac['where']=qs[_0xb550('0x2c')](_[_0xb550('0x45')](_0x4c0e23['query'],_0x2b94d1['filters']));if(_0x4c0e23['query'][_0xb550('0x47')]){_0x7650ac[_0xb550('0x26')]=_[_0xb550('0x32')](_0x7650ac[_0xb550('0x26')],{'$or':_[_0xb550('0x21')](_0x7650ac[_0xb550('0x30')],function(_0x340e82){var _0x47f7d6={};_0x47f7d6[_0x340e82]={'$like':'%'+_0x4c0e23[_0xb550('0x2b')]['filter']+'%'};return _0x47f7d6;})});}_0x7650ac=_[_0xb550('0x32')]({},_0x7650ac,_0x4c0e23[_0xb550('0x33')]);return _0x2244a6[_0xb550('0x7a')](_0x7650ac);}})['then'](function(_0x29bfd3){if(_0x29bfd3){_0x7394e6=_0x29bfd3[_0xb550('0x52')];if(!_0x4c0e23['query'][_0xb550('0x42')](_0xb550('0x53'))){_0x7650ac[_0xb550('0x11')]=qs[_0xb550('0x11')](_0x4c0e23[_0xb550('0x2b')][_0xb550('0x11')]);_0x7650ac['offset']=qs['offset'](_0x4c0e23[_0xb550('0x2b')][_0xb550('0x10')]);}return _0x2244a6['getAgents'](_0x7650ac);}})['then'](function(_0x57a30d){if(_0x57a30d){return _0x57a30d?{'count':_0x7394e6,'rows':_0x57a30d}:null;}})['then'](respondWithResult(_0x1dbfe0,null))[_0xb550('0x28')](handleError(_0x1dbfe0,null));}; \ No newline at end of file +var _0x8055=['clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','removeAgents','forEach','addAgents','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','update','destroy','then','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','where','include','query','findAll','catch','show','model','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','body','params','describe','getMembers','findOne','UserOpenchannelQueue','keys','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','merge','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','order','ids','Team','Agents','online','interface','flatMap','sequelize','addTeams','each','emit','removeTeams','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8055,0x17c));var _0x5805=function(_0x4b7ca3,_0x57019a){_0x4b7ca3=_0x4b7ca3-0x0;var _0x3e5ee6=_0x8055[_0x4b7ca3];return _0x3e5ee6;};'use strict';var BPromise=require('bluebird');var util=require(_0x5805('0x0'));var _=require(_0x5805('0x1'));var squel=require(_0x5805('0x2'));var Redis=require(_0x5805('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x5805('0x4'))(_0x5805('0x5'));var config=require(_0x5805('0x6'));var db=require('../../mysqldb')['db'];config[_0x5805('0x7')]=_[_0x5805('0x8')](config[_0x5805('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x5805('0x9'))(new Redis(config[_0x5805('0x7')]));require(_0x5805('0xa'))[_0x5805('0xb')](socket);function respondWithStatusCode(_0x45e1f8,_0x2118ab){_0x2118ab=_0x2118ab||0xcc;return function(_0x4578f9){if(_0x4578f9){return _0x45e1f8[_0x5805('0xc')](_0x2118ab);}return _0x45e1f8['status'](_0x2118ab)[_0x5805('0xd')]();};}function respondWithResult(_0x1bc6d6,_0x307004){_0x307004=_0x307004||0xc8;return function(_0x5d3371){if(_0x5d3371){return _0x1bc6d6[_0x5805('0xe')](_0x307004)[_0x5805('0xf')](_0x5d3371);}};}function respondWithFilteredResult(_0x78163f,_0x546045){return function(_0x334bc8){if(_0x334bc8){var _0x5ac43d=typeof _0x546045[_0x5805('0x10')]===_0x5805('0x11')&&typeof _0x546045[_0x5805('0x12')]===_0x5805('0x11');var _0x368b07=_0x334bc8[_0x5805('0x13')];var _0x4540ae=_0x5ac43d?0x0:_0x546045[_0x5805('0x10')];var _0x58ca50=_0x5ac43d?_0x334bc8[_0x5805('0x13')]:_0x546045[_0x5805('0x10')]+_0x546045[_0x5805('0x12')];var _0x6e1a9d;if(_0x58ca50>=_0x368b07){_0x58ca50=_0x368b07;_0x6e1a9d=0xc8;}else{_0x6e1a9d=0xce;}_0x78163f['status'](_0x6e1a9d);return _0x78163f[_0x5805('0x14')]('Content-Range',_0x4540ae+'-'+_0x58ca50+'/'+_0x368b07)[_0x5805('0xf')](_0x334bc8);}return null;};}function saveUpdates(_0x2cb6a5){return function(_0x5cd163){if(_0x5cd163){return _0x5cd163[_0x5805('0x15')](_0x2cb6a5)['then'](function(_0x39b025){return _0x39b025;});}return null;};}function removeEntity(_0x200478){return function(_0x3bbfe1){if(_0x3bbfe1){return _0x3bbfe1[_0x5805('0x16')]()[_0x5805('0x17')](function(){var _0x15ac36=_0x3bbfe1['get']({'plain':!![]});var _0x57464d=_0x5805('0x18');return db[_0x5805('0x19')][_0x5805('0x16')]({'where':{'type':_0x57464d,'resourceId':_0x15ac36['id']}})[_0x5805('0x17')](function(){return _0x3bbfe1;});})[_0x5805('0x17')](function(){_0x200478['status'](0xcc)[_0x5805('0xd')]();});}};}function handleEntityNotFound(_0x121e3c){return function(_0x576e59){if(!_0x576e59){_0x121e3c[_0x5805('0xc')](0x194);}return _0x576e59;};}function handleError(_0x1b3427,_0x371bea){_0x371bea=_0x371bea||0x1f4;return function(_0xe22c2f){logger[_0x5805('0x1a')](_0xe22c2f['stack']);if(_0xe22c2f[_0x5805('0x1b')]){delete _0xe22c2f['name'];}_0x1b3427[_0x5805('0xe')](_0x371bea)[_0x5805('0x1c')](_0xe22c2f);};}exports[_0x5805('0x1d')]=function(_0x146164,_0x3b370f){var _0xa48ab5={};var _0x7f530e={'count':0x0,'rows':[]};var _0x1ccc48=_[_0x5805('0x1e')](db[_0x5805('0x1f')]['rawAttributes'],function(_0x7244dc){return{'name':_0x7244dc[_0x5805('0x20')],'type':_0x7244dc[_0x5805('0x21')][_0x5805('0x22')]};});_0xa48ab5=qs['getOptions'](_0x1ccc48,_0x146164);var _0x474a8b={'where':_0xa48ab5[_0x5805('0x23')]};return db[_0x5805('0x1f')][_0x5805('0x13')](_0x474a8b)[_0x5805('0x17')](function(_0x123bba){_0x7f530e[_0x5805('0x13')]=_0x123bba;_0xa48ab5['include']=qs[_0x5805('0x24')](_0x146164[_0x5805('0x25')]);return db[_0x5805('0x1f')][_0x5805('0x26')](_0xa48ab5);})[_0x5805('0x17')](function(_0x4354c4){_0x7f530e['rows']=_0x4354c4;return _0x7f530e;})[_0x5805('0x17')](respondWithFilteredResult(_0x3b370f,_0xa48ab5))[_0x5805('0x27')](handleError(_0x3b370f,null));};exports[_0x5805('0x28')]=function(_0x300771,_0x2e6008){var _0xbc3335={'raw':!![],'where':{'id':_0x300771['params']['id']}},_0x1a8206={};_0x1a8206[_0x5805('0x29')]=_['keys'](db['OpenchannelQueue'][_0x5805('0x2a')]);_0x1a8206[_0x5805('0x25')]=_['keys'](_0x300771[_0x5805('0x25')]);_0x1a8206[_0x5805('0x2b')]=_[_0x5805('0x2c')](_0x1a8206[_0x5805('0x29')],_0x1a8206['query']);_0xbc3335[_0x5805('0x2d')]=_[_0x5805('0x2c')](_0x1a8206[_0x5805('0x29')],qs[_0x5805('0x2e')](_0x300771[_0x5805('0x25')][_0x5805('0x2e')]));_0xbc3335[_0x5805('0x2d')]=_0xbc3335[_0x5805('0x2d')][_0x5805('0x2f')]?_0xbc3335['attributes']:_0x1a8206[_0x5805('0x29')];if(_0x300771['query'][_0x5805('0x30')]){_0xbc3335['include']=[{'all':!![]}];}_0xbc3335=_['merge']({},_0xbc3335,_0x300771[_0x5805('0x31')]);return db[_0x5805('0x1f')][_0x5805('0x32')](_0xbc3335)['then'](handleEntityNotFound(_0x2e6008,null))[_0x5805('0x17')](respondWithResult(_0x2e6008,null))[_0x5805('0x27')](handleError(_0x2e6008,null));};exports['create']=function(_0x265e87,_0x681bc2){return db[_0x5805('0x1f')][_0x5805('0x33')](_0x265e87['body'],{})[_0x5805('0x17')](function(_0x26d168){var _0x26ad7f=_0x265e87[_0x5805('0x34')][_0x5805('0x35')]({'plain':!![]});if(!_0x26ad7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ad7f[_0x5805('0x36')]===_0x5805('0x34')){var _0xa1d798=_0x26d168[_0x5805('0x35')]({'plain':!![]});var _0x124dc5=_0x5805('0x18');return db[_0x5805('0x37')][_0x5805('0x32')]({'where':{'name':_0x124dc5,'userProfileId':_0x26ad7f[_0x5805('0x38')]},'raw':!![]})['then'](function(_0x59dbc6){if(_0x59dbc6&&_0x59dbc6[_0x5805('0x39')]===0x0){return db[_0x5805('0x19')]['create']({'name':_0xa1d798[_0x5805('0x1b')],'resourceId':_0xa1d798['id'],'type':_0x59dbc6[_0x5805('0x1b')],'sectionId':_0x59dbc6['id']},{})[_0x5805('0x17')](function(){return _0x26d168;});}else{return _0x26d168;}})[_0x5805('0x27')](function(_0x3d79c4){logger[_0x5805('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d79c4);throw _0x3d79c4;});}return _0x26d168;})[_0x5805('0x17')](respondWithResult(_0x681bc2,0xc9))['catch'](handleError(_0x681bc2,null));};exports[_0x5805('0x15')]=function(_0x4e6027,_0x19424c){if(_0x4e6027[_0x5805('0x3a')]['id']){delete _0x4e6027[_0x5805('0x3a')]['id'];}return db[_0x5805('0x1f')]['find']({'where':{'id':_0x4e6027[_0x5805('0x3b')]['id']}})['then'](handleEntityNotFound(_0x19424c,null))[_0x5805('0x17')](saveUpdates(_0x4e6027[_0x5805('0x3a')],null))['then'](respondWithResult(_0x19424c,null))[_0x5805('0x27')](handleError(_0x19424c,null));};exports['destroy']=function(_0x3d0810,_0x2ba3cb){return db['OpenchannelQueue'][_0x5805('0x32')]({'where':{'id':_0x3d0810['params']['id']}})[_0x5805('0x17')](handleEntityNotFound(_0x2ba3cb,null))['then'](removeEntity(_0x2ba3cb,null))['catch'](handleError(_0x2ba3cb,null));};exports['describe']=function(_0x4a13b7,_0x4a6525){return db[_0x5805('0x1f')][_0x5805('0x3c')]()[_0x5805('0x17')](respondWithResult(_0x4a6525,null))['catch'](handleError(_0x4a6525,null));};exports[_0x5805('0x3d')]=function(_0xbfd48c,_0x2e5752){var _0x33a2fd={'raw':!![],'where':{}},_0x2698e3={},_0x230e89;return db[_0x5805('0x1f')][_0x5805('0x3e')]({'where':{'id':_0xbfd48c[_0x5805('0x3b')]['id']}})[_0x5805('0x17')](handleEntityNotFound(_0x2e5752,null))[_0x5805('0x17')](function(_0x5ad438){if(_0x5ad438){_0x230e89=_0x5ad438[_0x5805('0x35')]({'plain':!![]});_0x2698e3[_0x5805('0x29')]=_['keys'](db[_0x5805('0x3f')][_0x5805('0x2a')]);_0x2698e3[_0x5805('0x25')]=_[_0x5805('0x40')](_0xbfd48c['query']);_0x2698e3[_0x5805('0x2b')]=_['intersection'](_0x2698e3[_0x5805('0x29')],_0x2698e3[_0x5805('0x25')]);_0x33a2fd[_0x5805('0x2d')]=_[_0x5805('0x2c')](_0x2698e3[_0x5805('0x29')],qs[_0x5805('0x2e')](_0xbfd48c[_0x5805('0x25')][_0x5805('0x2e')]));_0x33a2fd[_0x5805('0x2d')]=_0x33a2fd['attributes']['length']?_0x33a2fd['attributes']:_0x2698e3[_0x5805('0x29')];if(!_0xbfd48c[_0x5805('0x25')][_0x5805('0x41')](_0x5805('0x42'))){_0x33a2fd[_0x5805('0x12')]=qs[_0x5805('0x12')](_0xbfd48c[_0x5805('0x25')][_0x5805('0x12')]);_0x33a2fd['offset']=qs['offset'](_0xbfd48c[_0x5805('0x25')][_0x5805('0x10')]);}_0x33a2fd['order']=qs['sort'](_0xbfd48c['query'][_0x5805('0x43')]);_0x33a2fd[_0x5805('0x23')]=qs[_0x5805('0x2b')](_[_0x5805('0x44')](_0xbfd48c[_0x5805('0x25')],_0x2698e3[_0x5805('0x2b')]));_0x33a2fd[_0x5805('0x23')][_0x5805('0x45')]=_0x5ad438['id'];if(_0xbfd48c[_0x5805('0x25')][_0x5805('0x46')]){_0x33a2fd['where']=_[_0x5805('0x47')](_0x33a2fd['where'],{'$or':_[_0x5805('0x1e')](_0x33a2fd[_0x5805('0x2d')],function(_0x482078){var _0x4e73e9={};_0x4e73e9[_0x482078]={'$like':'%'+_0xbfd48c[_0x5805('0x25')][_0x5805('0x46')]+'%'};return _0x4e73e9;})});}_0x33a2fd=_[_0x5805('0x47')]({},_0x33a2fd,_0xbfd48c[_0x5805('0x31')]);return db[_0x5805('0x3f')][_0x5805('0x26')](_0x33a2fd);}})['then'](function(_0x119ca2){if(_0x119ca2){return db[_0x5805('0x48')][_0x5805('0x49')]({'where':{'id':_[_0x5805('0x1e')](_0x119ca2,'UserId'),'role':_0x5805('0x4a')},'attributes':['id',_0x5805('0x1b'),_0x5805('0x4b'),_0x5805('0x4c'),_0x5805('0x4d')]});}})[_0x5805('0x17')](function(_0x17e864){if(_0x17e864){return{'count':_0x17e864[_0x5805('0x13')],'rows':_[_0x5805('0x1e')](_0x17e864[_0x5805('0x4e')],function(_0x4668b1){return{'membername':_0x4668b1['name'],'UserId':_0x4668b1['id'],'queue_name':_0x230e89[_0x5805('0x1b')],'OpenchannelQueueId':_0x230e89['id'],'interface':util['format'](_0x5805('0x4f'),_0x5805('0x50'),_0x4668b1['name']),'penalty':0x0,'paused':_0x4668b1[_0x5805('0x4b')],'createdAt':_0x4668b1[_0x5805('0x4d')],'updatedAt':_0x4668b1[_0x5805('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2e5752,_0x33a2fd))[_0x5805('0x27')](handleError(_0x2e5752,null));};exports[_0x5805('0x51')]=function(_0x3702a6,_0x547278){var _0x3907d2={};var _0x2ab826={};var _0x472afa;var _0x4797ce;return db['OpenchannelQueue'][_0x5805('0x3e')]({'where':{'id':_0x3702a6[_0x5805('0x3b')]['id']}})['then'](handleEntityNotFound(_0x547278,null))['then'](function(_0x5dfe38){if(_0x5dfe38){_0x472afa=_0x5dfe38;_0x2ab826[_0x5805('0x29')]=_[_0x5805('0x40')](db['Team'][_0x5805('0x2a')]);_0x2ab826[_0x5805('0x25')]=_[_0x5805('0x40')](_0x3702a6[_0x5805('0x25')]);_0x2ab826[_0x5805('0x2b')]=_['intersection'](_0x2ab826[_0x5805('0x29')],_0x2ab826['query']);_0x3907d2['attributes']=_[_0x5805('0x2c')](_0x2ab826[_0x5805('0x29')],qs['fields'](_0x3702a6[_0x5805('0x25')][_0x5805('0x2e')]));_0x3907d2[_0x5805('0x2d')]=_0x3907d2[_0x5805('0x2d')][_0x5805('0x2f')]?_0x3907d2[_0x5805('0x2d')]:_0x2ab826['model'];_0x3907d2[_0x5805('0x52')]=qs['sort'](_0x3702a6['query'][_0x5805('0x43')]);_0x3907d2['where']=qs['filters'](_[_0x5805('0x44')](_0x3702a6['query'],_0x2ab826['filters']));if(_0x3702a6['query']['filter']){_0x3907d2['where']=_['merge'](_0x3907d2[_0x5805('0x23')],{'$or':_[_0x5805('0x1e')](_0x3907d2[_0x5805('0x2d')],function(_0x412986){var _0x297bdf={};_0x297bdf[_0x412986]={'$like':'%'+_0x3702a6[_0x5805('0x25')]['filter']+'%'};return _0x297bdf;})});}_0x3907d2=_[_0x5805('0x47')]({},_0x3907d2,_0x3702a6[_0x5805('0x31')]);return _0x472afa[_0x5805('0x51')](_0x3907d2);}})[_0x5805('0x17')](function(_0xb28f46){if(_0xb28f46){_0x4797ce=_0xb28f46[_0x5805('0x2f')];if(!_0x3702a6[_0x5805('0x25')]['hasOwnProperty'](_0x5805('0x42'))){_0x3907d2[_0x5805('0x12')]=qs[_0x5805('0x12')](_0x3702a6['query'][_0x5805('0x12')]);_0x3907d2['offset']=qs[_0x5805('0x10')](_0x3702a6[_0x5805('0x25')][_0x5805('0x10')]);}return _0x472afa[_0x5805('0x51')](_0x3907d2);}})[_0x5805('0x17')](function(_0x3d7da7){if(_0x3d7da7){return _0x3d7da7?{'count':_0x4797ce,'rows':_0x3d7da7}:null;}})[_0x5805('0x17')](respondWithResult(_0x547278,null))[_0x5805('0x27')](handleError(_0x547278,null));};exports['addTeams']=function(_0x5d7f56,_0x3b6391){var _0x2a96df=_0x5d7f56[_0x5805('0x3a')][_0x5805('0x53')];return db[_0x5805('0x54')]['findAll']({'where':{'id':_0x2a96df},'attributes':['id'],'include':[{'model':db[_0x5805('0x48')],'as':_0x5805('0x55'),'attributes':['id',_0x5805('0x1b'),_0x5805('0x56'),'voicePause',_0x5805('0x57')],'raw':!![]}]})[_0x5805('0x17')](function(_0x331cb2){if(_0x331cb2){var _0xd7d425=_[_0x5805('0x58')](_0x331cb2,function(_0x44a7e4){var _0x518040=_0x44a7e4[_0x5805('0x35')]({'plain':!![]});return _0x518040[_0x5805('0x55')];});return db[_0x5805('0x1f')][_0x5805('0x32')]({'where':{'id':_0x5d7f56['params']['id']}})[_0x5805('0x17')](function(_0x14848c){return db[_0x5805('0x59')]['transaction'](function(_0x35c965){return _0x14848c[_0x5805('0x5a')](_0x2a96df,{'transaction':_0x35c965})[_0x5805('0x17')](function(){return BPromise[_0x5805('0x5b')](_0xd7d425,function(_0x35a5b8){return db[_0x5805('0x3f')]['findOrCreate']({'where':{'UserId':_0x35a5b8['id'],'OpenchannelQueueId':_0x5d7f56[_0x5805('0x3b')]['id']},'transaction':_0x35c965});});})[_0x5805('0x17')](function(){_0xd7d425['forEach'](function(_0x11423b){socket[_0x5805('0x5c')]('userOpenchannelQueue:save',{'UserId':_0x11423b['id'],'OpenchannelQueueId':_0x14848c['id']});});});});});}})[_0x5805('0x17')](respondWithStatusCode(_0x3b6391,null))[_0x5805('0x27')](handleError(_0x3b6391,null));};exports[_0x5805('0x5d')]=function(_0xa3fa61,_0x159047){return db[_0x5805('0x54')][_0x5805('0x26')]({'where':{'id':_0xa3fa61[_0x5805('0x25')][_0x5805('0x53')]},'attributes':['id'],'include':[{'model':db[_0x5805('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x159047,null))['then'](function(_0x48d015){var _0x18fe5e=_[_0x5805('0x1e')](_0x48d015,'id');var _0x36e729=[];var _0x7f9575=[];var _0x3ab873=squel[_0x5805('0x5e')]();_0x3ab873[_0x5805('0x5f')]('tq.TeamId')['from'](_0x5805('0x60'),'tq')[_0x5805('0x61')](_0x5805('0x62'),'ut',_0x5805('0x63'))['where']('OpenchannelQueueId\x20=\x20?',_0xa3fa61[_0x5805('0x3b')]['id']);for(var _0x3534cd=0x0;_0x3534cd<_0x48d015['length'];_0x3534cd+=0x1){let _0x962766=_0x48d015[_0x3534cd];for(var _0x5484e2=0x0;_0x5484e2<_0x962766['Agents'][_0x5805('0x2f')];_0x5484e2+=0x1){let _0x58a5be=_0x962766[_0x5805('0x55')][_0x5484e2];var _0x4573a6=_0x3ab873[_0x5805('0x64')]();_0x4573a6['where'](_0x5805('0x65'),_0x58a5be['id']);_0x7f9575[_0x5805('0x66')](db[_0x5805('0x59')][_0x5805('0x25')](_0x4573a6[_0x5805('0x67')](),{'type':db[_0x5805('0x59')][_0x5805('0x68')][_0x5805('0x69')]})[_0x5805('0x17')](function(_0x3e1244){if(_0x3e1244[_0x5805('0x2f')]===0x1){return _0x58a5be['id'];}else{var _0x59b21d=_[_0x5805('0x6a')](_[_0x5805('0x1e')](_0x3e1244,_0x5805('0x6b')),function(_0xe02973){return _['includes'](_0x18fe5e,_0xe02973);});if(_0x59b21d){return _0x58a5be['id'];}}}));}}return BPromise[_0x5805('0x6c')](_0x7f9575)[_0x5805('0x17')](function(_0xd2f726){_0x36e729=_(_0x36e729)[_0x5805('0x6d')](_0xd2f726)[_0x5805('0x6e')]()['value']();return db[_0x5805('0x1f')][_0x5805('0x32')]({'where':{'id':_0xa3fa61[_0x5805('0x3b')]['id']}})['then'](function(_0x4bb627){return db[_0x5805('0x59')][_0x5805('0x6f')](function(_0x38621b){return _0x4bb627[_0x5805('0x5d')](_0xa3fa61[_0x5805('0x25')][_0x5805('0x53')],{'transaction':_0x38621b})[_0x5805('0x17')](function(){if(!_[_0x5805('0x70')](_0x36e729)){return _0x4bb627[_0x5805('0x71')](_0x36e729,{'transaction':_0x38621b});}})['then'](function(){_0x36e729[_0x5805('0x72')](function(_0x317373){socket[_0x5805('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0x317373,'OpenchannelQueueId':_0x4bb627['id']});});});});});});})[_0x5805('0x17')](respondWithStatusCode(_0x159047,null))['catch'](handleError(_0x159047,null));};exports['addAgents']=function(_0x590547,_0x41275b){return db[_0x5805('0x1f')]['find']({'where':{'id':_0x590547[_0x5805('0x3b')]['id']}})[_0x5805('0x17')](handleEntityNotFound(_0x41275b,null))[_0x5805('0x17')](function(_0x16e04e){if(_0x16e04e){return _0x16e04e[_0x5805('0x73')](_0x590547[_0x5805('0x3a')][_0x5805('0x53')],_['omit'](_0x590547[_0x5805('0x3a')],[_0x5805('0x53'),'id'])||{})['spread'](function(_0x47571b){for(var _0x199c7c=0x0;_0x199c7c<_0x590547[_0x5805('0x3a')][_0x5805('0x53')][_0x5805('0x2f')];_0x199c7c+=0x1){socket[_0x5805('0x5c')](_0x5805('0x74'),{'UserId':Number(_0x590547['body'][_0x5805('0x53')][_0x199c7c]),'OpenchannelQueueId':Number(_0x590547['params']['id'])});}return _0x47571b;});}})[_0x5805('0x17')](respondWithResult(_0x41275b,null))['catch'](handleError(_0x41275b,null));};exports['removeAgents']=function(_0x1963c8,_0x381dce){return db[_0x5805('0x1f')][_0x5805('0x32')]({'where':{'id':_0x1963c8[_0x5805('0x3b')]['id']}})[_0x5805('0x17')](handleEntityNotFound(_0x381dce,null))[_0x5805('0x17')](function(_0x5465ad){if(_0x5465ad){return _0x5465ad[_0x5805('0x71')](_0x1963c8[_0x5805('0x25')][_0x5805('0x53')])[_0x5805('0x17')](function(){if(_[_0x5805('0x75')](_0x1963c8[_0x5805('0x25')][_0x5805('0x53')])){for(var _0x34dd3a=0x0;_0x34dd3a<_0x1963c8[_0x5805('0x25')][_0x5805('0x53')][_0x5805('0x2f')];_0x34dd3a+=0x1){socket[_0x5805('0x5c')](_0x5805('0x76'),{'UserId':Number(_0x1963c8[_0x5805('0x25')][_0x5805('0x53')][_0x34dd3a]),'OpenchannelQueueId':Number(_0x1963c8['params']['id'])});}}else{socket[_0x5805('0x5c')](_0x5805('0x76'),{'UserId':Number(_0x1963c8['query'][_0x5805('0x53')]),'OpenchannelQueueId':Number(_0x1963c8[_0x5805('0x3b')]['id'])});}});}})[_0x5805('0x17')](respondWithStatusCode(_0x381dce,null))[_0x5805('0x27')](handleError(_0x381dce,null));};exports[_0x5805('0x77')]=function(_0x3ef4f7,_0x3c605d){var _0x2fee0f={};var _0xbeb27c={};var _0x1d87d7;var _0x4bb943;return db[_0x5805('0x1f')]['findOne']({'where':{'id':_0x3ef4f7['params']['id']}})[_0x5805('0x17')](handleEntityNotFound(_0x3c605d,null))['then'](function(_0x57013d){if(_0x57013d){_0x1d87d7=_0x57013d;_0xbeb27c[_0x5805('0x29')]=_[_0x5805('0x40')](db[_0x5805('0x48')][_0x5805('0x2a')]);_0xbeb27c[_0x5805('0x25')]=_[_0x5805('0x40')](_0x3ef4f7[_0x5805('0x25')]);_0xbeb27c['filters']=_[_0x5805('0x2c')](_0xbeb27c[_0x5805('0x29')],_0xbeb27c['query']);_0x2fee0f[_0x5805('0x2d')]=_['intersection'](_0xbeb27c[_0x5805('0x29')],qs['fields'](_0x3ef4f7[_0x5805('0x25')]['fields']));_0x2fee0f[_0x5805('0x2d')]=_0x2fee0f[_0x5805('0x2d')][_0x5805('0x2f')]?_0x2fee0f['attributes']:_0xbeb27c['model'];_0x2fee0f[_0x5805('0x52')]=qs[_0x5805('0x43')](_0x3ef4f7[_0x5805('0x25')]['sort']);_0x2fee0f['where']=qs[_0x5805('0x2b')](_[_0x5805('0x44')](_0x3ef4f7[_0x5805('0x25')],_0xbeb27c[_0x5805('0x2b')]));if(_0x3ef4f7[_0x5805('0x25')][_0x5805('0x46')]){_0x2fee0f[_0x5805('0x23')]=_[_0x5805('0x47')](_0x2fee0f[_0x5805('0x23')],{'$or':_[_0x5805('0x1e')](_0x2fee0f['attributes'],function(_0x1a6d6e){var _0x125798={};_0x125798[_0x1a6d6e]={'$like':'%'+_0x3ef4f7[_0x5805('0x25')][_0x5805('0x46')]+'%'};return _0x125798;})});}_0x2fee0f=_[_0x5805('0x47')]({},_0x2fee0f,_0x3ef4f7[_0x5805('0x31')]);return _0x1d87d7[_0x5805('0x77')](_0x2fee0f);}})[_0x5805('0x17')](function(_0x5ad1c9){if(_0x5ad1c9){_0x4bb943=_0x5ad1c9[_0x5805('0x2f')];if(!_0x3ef4f7[_0x5805('0x25')][_0x5805('0x41')]('nolimit')){_0x2fee0f['limit']=qs[_0x5805('0x12')](_0x3ef4f7['query'][_0x5805('0x12')]);_0x2fee0f[_0x5805('0x10')]=qs[_0x5805('0x10')](_0x3ef4f7[_0x5805('0x25')][_0x5805('0x10')]);}return _0x1d87d7['getAgents'](_0x2fee0f);}})['then'](function(_0x911ddc){if(_0x911ddc){return _0x911ddc?{'count':_0x4bb943,'rows':_0x911ddc}:null;}})[_0x5805('0x17')](respondWithResult(_0x3c605d,null))[_0x5805('0x27')](handleError(_0x3c605d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0672747..f436715 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 _0xd2ca=['emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd2ca,0x67));var _0xad2c=function(_0x2f4b33,_0x5ac85d){_0x2f4b33=_0x2f4b33-0x0;var _0x1cab22=_0xd2ca[_0x2f4b33];return _0x1cab22;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xad2c('0x0'))['db'][_0xad2c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xad2c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xad2c('0x3'),'afterDestroy':_0xad2c('0x4')};function emitEvent(_0x21ad83){return function(_0x92446d,_0x2422d3,_0x4eee26){OpenchannelQueueEvents['emit'](_0x21ad83+':'+_0x92446d['id'],_0x92446d);OpenchannelQueueEvents[_0xad2c('0x5')](_0x21ad83,_0x92446d);_0x4eee26(null);};}for(var e in events){if(events[_0xad2c('0x6')](e)){var event=events[e];OpenchannelQueue[_0xad2c('0x7')](e,emitEvent(event));}}module[_0xad2c('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xec21=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue'];(function(_0x48c550,_0x428ac2){var _0x4bf9ee=function(_0x265900){while(--_0x265900){_0x48c550['push'](_0x48c550['shift']());}};_0x4bf9ee(++_0x428ac2);}(_0xec21,0x1a6));var _0x1ec2=function(_0x3333a6,_0x2c1150){_0x3333a6=_0x3333a6-0x0;var _0x36f253=_0xec21[_0x3333a6];return _0x36f253;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x1ec2('0x0'))['db'][_0x1ec2('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ec2('0x2'),'afterDestroy':_0x1ec2('0x3')};function emitEvent(_0x1d5808){return function(_0x31ef69,_0x166b84,_0x345c3e){OpenchannelQueueEvents['emit'](_0x1d5808+':'+_0x31ef69['id'],_0x31ef69);OpenchannelQueueEvents[_0x1ec2('0x4')](_0x1d5808,_0x31ef69);_0x345c3e(null);};}for(var e in events){if(events[_0x1ec2('0x5')](e)){var event=events[e];OpenchannelQueue[_0x1ec2('0x6')](e,emitEvent(event));}}module[_0x1ec2('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 0b230f3..959c548 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 _0x7d5e=['../../config/environment','./openchannelQueue.attributes','exports','openchannel_queues','bluebird','request-promise','path','rimraf'];(function(_0x2b16a9,_0xd1086f){var _0x14ce86=function(_0x1a22f2){while(--_0x1a22f2){_0x2b16a9['push'](_0x2b16a9['shift']());}};_0x14ce86(++_0xd1086f);}(_0x7d5e,0x10c));var _0xe7d5=function(_0x3f9db3,_0x57f43e){_0x3f9db3=_0x3f9db3-0x0;var _0x1234c5=_0x7d5e[_0x3f9db3];return _0x1234c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe7d5('0x0'));var rp=require(_0xe7d5('0x1'));var fs=require('fs');var path=require(_0xe7d5('0x2'));var rimraf=require(_0xe7d5('0x3'));var config=require(_0xe7d5('0x4'));var attributes=require(_0xe7d5('0x5'));module[_0xe7d5('0x6')]=function(_0x31c251,_0x6cd21d){return _0x31c251['define']('OpenchannelQueue',attributes,{'tableName':_0xe7d5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87ab=['bluebird','request-promise','path','rimraf','../../config/environment','exports','util','api','moment'];(function(_0x5cf1f7,_0x3f4d07){var _0x2b524f=function(_0x10fad5){while(--_0x10fad5){_0x5cf1f7['push'](_0x5cf1f7['shift']());}};_0x2b524f(++_0x3f4d07);}(_0x87ab,0x180));var _0xb87a=function(_0x415cdd,_0x522e9b){_0x415cdd=_0x415cdd-0x0;var _0x112a15=_0x87ab[_0x415cdd];return _0x112a15;};'use strict';var _=require('lodash');var util=require(_0xb87a('0x0'));var logger=require('../../config/logger')(_0xb87a('0x1'));var moment=require(_0xb87a('0x2'));var BPromise=require(_0xb87a('0x3'));var rp=require(_0xb87a('0x4'));var fs=require('fs');var path=require(_0xb87a('0x5'));var rimraf=require(_0xb87a('0x6'));var config=require(_0xb87a('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0xb87a('0x8')]=function(_0x9cc3b3,_0x2b7699){return _0x9cc3b3['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index f8846d2..71d9fbb 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 _0x8089=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','catch','ShowOpenchannelQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4da068,_0x510497){var _0x578c1e=function(_0xdf14da){while(--_0xdf14da){_0x4da068['push'](_0x4da068['shift']());}};_0x578c1e(++_0x510497);}(_0x8089,0x124));var _0x9808=function(_0x1d51e8,_0x4e339a){_0x1d51e8=_0x1d51e8-0x0;var _0x57f9ca=_0x8089[_0x1d51e8];return _0x57f9ca;};'use strict';var _=require(_0x9808('0x0'));var util=require(_0x9808('0x1'));var moment=require(_0x9808('0x2'));var BPromise=require('bluebird');var rs=require(_0x9808('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9808('0x4'))['db'];var utils=require(_0x9808('0x5'));var logger=require(_0x9808('0x6'))('rpc');var config=require(_0x9808('0x7'));var jayson=require(_0x9808('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x9808('0x9')]=_[_0x9808('0xa')](config[_0x9808('0x9')],{'host':_0x9808('0xb'),'port':0x18eb});var socket=require(_0x9808('0xc'))(new Redis(config[_0x9808('0x9')]));require(_0x9808('0xd'))[_0x9808('0xe')](socket);function respondWithRpcPromise(_0x586153,_0x24c318,_0x224ca0){return new BPromise(function(_0x30106e,_0x3a0ef8){return client[_0x9808('0xf')](_0x586153,_0x224ca0)[_0x9808('0x10')](function(_0x4e75cf){logger['info'](_0x9808('0x11'),_0x24c318,_0x9808('0x12'));logger[_0x9808('0x13')](_0x9808('0x14'),_0x24c318,_0x9808('0x12'),JSON[_0x9808('0x15')](_0x4e75cf));if(_0x4e75cf['error']){if(_0x4e75cf[_0x9808('0x16')][_0x9808('0x17')]===0x1f4){logger['error'](_0x9808('0x11'),_0x24c318,_0x4e75cf[_0x9808('0x16')][_0x9808('0x18')]);return _0x3a0ef8(_0x4e75cf['error'][_0x9808('0x18')]);}logger['error'](_0x9808('0x11'),_0x24c318,_0x4e75cf[_0x9808('0x16')][_0x9808('0x18')]);return _0x30106e(_0x4e75cf[_0x9808('0x16')][_0x9808('0x18')]);}else{logger[_0x9808('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x24c318,'request\x20sent');_0x30106e(_0x4e75cf[_0x9808('0x1a')]['message']);}})['catch'](function(_0x44e030){logger[_0x9808('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x24c318,_0x44e030);_0x3a0ef8(_0x44e030);});});}exports[_0x9808('0x1b')]=function(_0x15ca3c){var _0x308740=this;return new Promise(function(_0x563205,_0x417277){return db[_0x9808('0x1c')][_0x9808('0x1d')]({'raw':_0x15ca3c[_0x9808('0x1e')]?_0x15ca3c[_0x9808('0x1e')][_0x9808('0x1f')]===undefined?!![]:![]:!![],'where':_0x15ca3c[_0x9808('0x1e')]?_0x15ca3c[_0x9808('0x1e')][_0x9808('0x20')]||null:null,'attributes':_0x15ca3c[_0x9808('0x1e')]?_0x15ca3c['options'][_0x9808('0x21')]||null:null,'limit':_0x15ca3c[_0x9808('0x1e')]?_0x15ca3c[_0x9808('0x1e')]['limit']||null:null,'include':_0x15ca3c['options']?_0x15ca3c[_0x9808('0x1e')][_0x9808('0x22')]?_[_0x9808('0x23')](_0x15ca3c[_0x9808('0x1e')][_0x9808('0x22')],function(_0x49d1ac){return{'model':db[_0x49d1ac['model']],'as':_0x49d1ac['as'],'attributes':_0x49d1ac[_0x9808('0x21')],'include':_0x49d1ac[_0x9808('0x22')]?_[_0x9808('0x23')](_0x49d1ac[_0x9808('0x22')],function(_0x272852){return{'model':db[_0x272852[_0x9808('0x24')]],'as':_0x272852['as'],'attributes':_0x272852[_0x9808('0x21')],'include':_0x272852['include']?_[_0x9808('0x23')](_0x272852[_0x9808('0x22')],function(_0x40e65c){return{'model':db[_0x40e65c[_0x9808('0x24')]],'as':_0x40e65c['as'],'attributes':_0x40e65c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9808('0x10')](function(_0xf2e9a0){logger['info'](_0x9808('0x1b'),_0x15ca3c);logger[_0x9808('0x13')](_0x9808('0x1b'),_0x15ca3c,JSON['stringify'](_0xf2e9a0));_0x563205(_0xf2e9a0);})[_0x9808('0x25')](function(_0x5b1009){logger[_0x9808('0x16')](_0x9808('0x1b'),_0x5b1009[_0x9808('0x18')],_0x15ca3c);_0x417277(_0x308740[_0x9808('0x16')](0x1f4,_0x5b1009['message']));});});};exports[_0x9808('0x26')]=function(_0xe4c2e1){var _0x45cca5=this;return new Promise(function(_0x37dfbc,_0x544032){return db['OpenchannelQueue']['find']({'raw':_0xe4c2e1['options']?_0xe4c2e1[_0x9808('0x1e')][_0x9808('0x1f')]===undefined?!![]:![]:!![],'where':_0xe4c2e1[_0x9808('0x1e')]?_0xe4c2e1[_0x9808('0x1e')][_0x9808('0x20')]||null:null,'attributes':_0xe4c2e1[_0x9808('0x1e')]?_0xe4c2e1[_0x9808('0x1e')][_0x9808('0x21')]||null:null,'include':_0xe4c2e1[_0x9808('0x1e')]?_0xe4c2e1['options'][_0x9808('0x22')]?_['map'](_0xe4c2e1[_0x9808('0x1e')]['include'],function(_0x26f4ef){return{'model':db[_0x26f4ef['model']],'as':_0x26f4ef['as'],'attributes':_0x26f4ef[_0x9808('0x21')],'include':_0x26f4ef[_0x9808('0x22')]?_[_0x9808('0x23')](_0x26f4ef[_0x9808('0x22')],function(_0x426357){return{'model':db[_0x426357[_0x9808('0x24')]],'as':_0x426357['as'],'attributes':_0x426357[_0x9808('0x21')],'include':_0x426357[_0x9808('0x22')]?_[_0x9808('0x23')](_0x426357[_0x9808('0x22')],function(_0x4e9971){return{'model':db[_0x4e9971[_0x9808('0x24')]],'as':_0x4e9971['as'],'attributes':_0x4e9971[_0x9808('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9808('0x10')](function(_0x58157b){logger[_0x9808('0x19')](_0x9808('0x26'),_0xe4c2e1);logger[_0x9808('0x13')](_0x9808('0x26'),_0xe4c2e1,JSON[_0x9808('0x15')](_0x58157b));_0x37dfbc(_0x58157b);})[_0x9808('0x25')](function(_0xafb217){logger[_0x9808('0x16')](_0x9808('0x26'),_0xafb217['message'],_0xe4c2e1);_0x544032(_0x45cca5['error'](0x1f4,_0xafb217['message']));});});}; \ No newline at end of file +var _0x5bb8=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','info','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','include','map','model','catch','ShowOpenchannelQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request'];(function(_0x1ec62d,_0xfd9d68){var _0x21c744=function(_0x5dc1af){while(--_0x5dc1af){_0x1ec62d['push'](_0x1ec62d['shift']());}};_0x21c744(++_0xfd9d68);}(_0x5bb8,0xa9));var _0x85bb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5bb8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x85bb('0x0'));var moment=require(_0x85bb('0x1'));var BPromise=require(_0x85bb('0x2'));var rs=require(_0x85bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85bb('0x4'))['db'];var utils=require(_0x85bb('0x5'));var logger=require(_0x85bb('0x6'))(_0x85bb('0x7'));var config=require(_0x85bb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x85bb('0x9')]({'port':0x232a});config[_0x85bb('0xa')]=_[_0x85bb('0xb')](config['redis'],{'host':_0x85bb('0xc'),'port':0x18eb});var socket=require(_0x85bb('0xd'))(new Redis(config['redis']));require(_0x85bb('0xe'))['register'](socket);function respondWithRpcPromise(_0x3a7021,_0x2b1994,_0x5a6126){return new BPromise(function(_0x537cfb,_0x35cae7){return client[_0x85bb('0xf')](_0x3a7021,_0x5a6126)['then'](function(_0xd38ada){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x2b1994,_0x85bb('0x10'));logger[_0x85bb('0x11')](_0x85bb('0x12'),_0x2b1994,_0x85bb('0x10'),JSON[_0x85bb('0x13')](_0xd38ada));if(_0xd38ada[_0x85bb('0x14')]){if(_0xd38ada['error']['code']===0x1f4){logger[_0x85bb('0x14')](_0x85bb('0x15'),_0x2b1994,_0xd38ada[_0x85bb('0x14')]['message']);return _0x35cae7(_0xd38ada['error'][_0x85bb('0x16')]);}logger['error'](_0x85bb('0x15'),_0x2b1994,_0xd38ada[_0x85bb('0x14')][_0x85bb('0x16')]);return _0x537cfb(_0xd38ada[_0x85bb('0x14')]['message']);}else{logger[_0x85bb('0x17')](_0x85bb('0x15'),_0x2b1994,_0x85bb('0x10'));_0x537cfb(_0xd38ada[_0x85bb('0x18')][_0x85bb('0x16')]);}})['catch'](function(_0x56bd43){logger[_0x85bb('0x14')](_0x85bb('0x15'),_0x2b1994,_0x56bd43);_0x35cae7(_0x56bd43);});});}exports[_0x85bb('0x19')]=function(_0x4765b8){var _0x4614b1=this;return new Promise(function(_0x4ddc9d,_0x1f6a91){return db[_0x85bb('0x1a')]['findAll']({'raw':_0x4765b8['options']?_0x4765b8[_0x85bb('0x1b')][_0x85bb('0x1c')]===undefined?!![]:![]:!![],'where':_0x4765b8[_0x85bb('0x1b')]?_0x4765b8[_0x85bb('0x1b')][_0x85bb('0x1d')]||null:null,'attributes':_0x4765b8[_0x85bb('0x1b')]?_0x4765b8['options'][_0x85bb('0x1e')]||null:null,'limit':_0x4765b8[_0x85bb('0x1b')]?_0x4765b8[_0x85bb('0x1b')]['limit']||null:null,'include':_0x4765b8[_0x85bb('0x1b')]?_0x4765b8[_0x85bb('0x1b')][_0x85bb('0x1f')]?_[_0x85bb('0x20')](_0x4765b8[_0x85bb('0x1b')]['include'],function(_0x51c10f){return{'model':db[_0x51c10f[_0x85bb('0x21')]],'as':_0x51c10f['as'],'attributes':_0x51c10f['attributes'],'include':_0x51c10f['include']?_[_0x85bb('0x20')](_0x51c10f['include'],function(_0x4ff2eb){return{'model':db[_0x4ff2eb['model']],'as':_0x4ff2eb['as'],'attributes':_0x4ff2eb[_0x85bb('0x1e')],'include':_0x4ff2eb[_0x85bb('0x1f')]?_['map'](_0x4ff2eb[_0x85bb('0x1f')],function(_0x11877d){return{'model':db[_0x11877d['model']],'as':_0x11877d['as'],'attributes':_0x11877d[_0x85bb('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea132){logger['info'](_0x85bb('0x19'),_0x4765b8);logger[_0x85bb('0x11')](_0x85bb('0x19'),_0x4765b8,JSON[_0x85bb('0x13')](_0x3ea132));_0x4ddc9d(_0x3ea132);})[_0x85bb('0x22')](function(_0x552a62){logger[_0x85bb('0x14')]('GetOpenchannelQueue',_0x552a62[_0x85bb('0x16')],_0x4765b8);_0x1f6a91(_0x4614b1[_0x85bb('0x14')](0x1f4,_0x552a62[_0x85bb('0x16')]));});});};exports[_0x85bb('0x23')]=function(_0x1fc96c){var _0x36a9e4=this;return new Promise(function(_0x208545,_0x5674ea){return db[_0x85bb('0x1a')][_0x85bb('0x24')]({'raw':_0x1fc96c[_0x85bb('0x1b')]?_0x1fc96c[_0x85bb('0x1b')][_0x85bb('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fc96c[_0x85bb('0x1b')]?_0x1fc96c[_0x85bb('0x1b')][_0x85bb('0x1d')]||null:null,'attributes':_0x1fc96c[_0x85bb('0x1b')]?_0x1fc96c[_0x85bb('0x1b')][_0x85bb('0x1e')]||null:null,'include':_0x1fc96c[_0x85bb('0x1b')]?_0x1fc96c[_0x85bb('0x1b')][_0x85bb('0x1f')]?_[_0x85bb('0x20')](_0x1fc96c[_0x85bb('0x1b')]['include'],function(_0x32da91){return{'model':db[_0x32da91[_0x85bb('0x21')]],'as':_0x32da91['as'],'attributes':_0x32da91['attributes'],'include':_0x32da91['include']?_['map'](_0x32da91[_0x85bb('0x1f')],function(_0x27539b){return{'model':db[_0x27539b[_0x85bb('0x21')]],'as':_0x27539b['as'],'attributes':_0x27539b[_0x85bb('0x1e')],'include':_0x27539b[_0x85bb('0x1f')]?_['map'](_0x27539b['include'],function(_0x1e9d00){return{'model':db[_0x1e9d00['model']],'as':_0x1e9d00['as'],'attributes':_0x1e9d00[_0x85bb('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2741){logger['info'](_0x85bb('0x23'),_0x1fc96c);logger[_0x85bb('0x11')]('ShowOpenchannelQueue',_0x1fc96c,JSON[_0x85bb('0x13')](_0x2d2741));_0x208545(_0x2d2741);})['catch'](function(_0x526188){logger[_0x85bb('0x14')]('ShowOpenchannelQueue',_0x526188['message'],_0x1fc96c);_0x5674ea(_0x36a9e4[_0x85bb('0x14')](0x1f4,_0x526188['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index fa0470b..cbbad4a 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 _0xf310=['openchannelQueue:','./openchannelQueue.events','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf310,0x8d));var _0x0f31=function(_0x35d39e,_0x11ace6){_0x35d39e=_0x35d39e-0x0;var _0x5c0194=_0xf310[_0x35d39e];return _0x5c0194;};'use strict';var OpenchannelQueueEvents=require(_0x0f31('0x0'));var events=[_0x0f31('0x1'),_0x0f31('0x2'),'update'];function createListener(_0xf1e1e1,_0x1ccfd8){return function(_0x1179c8){_0x1ccfd8[_0x0f31('0x3')](_0xf1e1e1,_0x1179c8);};}function removeListener(_0x14341e,_0x2f3983){return function(){OpenchannelQueueEvents['removeListener'](_0x14341e,_0x2f3983);};}exports['register']=function(_0x32a4f2){for(var _0x160be4=0x0,_0x110189=events['length'];_0x160be4<_0x110189;_0x160be4++){var _0x63832f=events[_0x160be4];var _0x469805=createListener(_0x0f31('0x4')+_0x63832f,_0x32a4f2);OpenchannelQueueEvents['on'](_0x63832f,_0x469805);}}; \ No newline at end of file +var _0x3d67=['save','remove','update','emit','removeListener','register','openchannelQueue:'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x3d67,0x1f1));var _0x73d6=function(_0x347c61,_0x5c038e){_0x347c61=_0x347c61-0x0;var _0x3c5237=_0x3d67[_0x347c61];return _0x3c5237;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x73d6('0x0'),_0x73d6('0x1'),_0x73d6('0x2')];function createListener(_0x352082,_0x4098cb){return function(_0xfa57b){_0x4098cb[_0x73d6('0x3')](_0x352082,_0xfa57b);};}function removeListener(_0x4ce1c1,_0x484481){return function(){OpenchannelQueueEvents[_0x73d6('0x4')](_0x4ce1c1,_0x484481);};}exports[_0x73d6('0x5')]=function(_0x3d3c05){for(var _0x302d40=0x0,_0x4f1fd4=events['length'];_0x302d40<_0x4f1fd4;_0x302d40++){var _0x495cd6=events[_0x302d40];var _0x39649a=createListener(_0x73d6('0x6')+_0x495cd6,_0x3d3c05);OpenchannelQueueEvents['on'](_0x495cd6,_0x39649a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ad2670b..2895681 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 _0xc11e=['get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x19cbac,_0x4a7597){var _0x180da3=function(_0x219c1a){while(--_0x219c1a){_0x19cbac['push'](_0x19cbac['shift']());}};_0x180da3(++_0x4a7597);}(_0xc11e,0xb4));var _0xec11=function(_0x141cf2,_0xc262e1){_0x141cf2=_0x141cf2-0x0;var _0x44dc0b=_0xc11e[_0x141cf2];return _0x44dc0b;};'use strict';var multer=require(_0xec11('0x0'));var util=require(_0xec11('0x1'));var path=require(_0xec11('0x2'));var timeout=require(_0xec11('0x3'));var express=require(_0xec11('0x4'));var router=express[_0xec11('0x5')]();var fs_extra=require(_0xec11('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xec11('0x7'));var config=require(_0xec11('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0xec11('0x9')]('/',auth[_0xec11('0xa')](),controller[_0xec11('0xb')]);router['get'](_0xec11('0xc'),auth[_0xec11('0xa')](),controller[_0xec11('0xd')]);router[_0xec11('0x9')](_0xec11('0xe'),auth[_0xec11('0xa')](),controller[_0xec11('0xf')]);router[_0xec11('0x10')]('/',auth[_0xec11('0xa')](),controller['create']);router['put'](_0xec11('0xe'),auth[_0xec11('0xa')](),controller[_0xec11('0x11')]);router[_0xec11('0x12')](_0xec11('0xe'),auth['isAuthenticated'](),controller[_0xec11('0x13')]);module[_0xec11('0x14')]=router; \ No newline at end of file +var _0xfe5e=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','describe','/:id','isAuthenticated','post','create','update','delete','exports'];(function(_0x243e43,_0x137fb0){var _0x553cda=function(_0x399e6d){while(--_0x399e6d){_0x243e43['push'](_0x243e43['shift']());}};_0x553cda(++_0x137fb0);}(_0xfe5e,0xc6));var _0xefe5=function(_0x275caa,_0x166d5e){_0x275caa=_0x275caa-0x0;var _0x28d670=_0xfe5e[_0x275caa];return _0x28d670;};'use strict';var multer=require(_0xefe5('0x0'));var util=require(_0xefe5('0x1'));var path=require(_0xefe5('0x2'));var timeout=require('connect-timeout');var express=require(_0xefe5('0x3'));var router=express[_0xefe5('0x4')]();var fs_extra=require(_0xefe5('0x5'));var auth=require(_0xefe5('0x6'));var interaction=require(_0xefe5('0x7'));var config=require(_0xefe5('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0xefe5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xefe5('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xefe5('0xa')]);router[_0xefe5('0x9')](_0xefe5('0xb'),auth[_0xefe5('0xc')](),controller['show']);router[_0xefe5('0xd')]('/',auth['isAuthenticated'](),controller[_0xefe5('0xe')]);router['put']('/:id',auth[_0xefe5('0xc')](),controller[_0xefe5('0xf')]);router[_0xefe5('0x10')]('/:id',auth[_0xefe5('0xc')](),controller['destroy']);module[_0xefe5('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0ef0e36..83d9e36 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 _0xd645=['moment','sequelize','DATE','STRING'];(function(_0x2a7ec6,_0xb493f3){var _0x5c871c=function(_0x1ca54f){while(--_0x1ca54f){_0x2a7ec6['push'](_0x2a7ec6['shift']());}};_0x5c871c(++_0xb493f3);}(_0xd645,0x10c));var _0x5d64=function(_0x4ac994,_0x933321){_0x4ac994=_0x4ac994-0x0;var _0x5e7f3e=_0xd645[_0x4ac994];return _0x5e7f3e;};'use strict';var moment=require(_0x5d64('0x0'));var Sequelize=require(_0x5d64('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5d64('0x2')]},'leaveAt':{'type':Sequelize[_0x5d64('0x2')]},'acceptAt':{'type':Sequelize[_0x5d64('0x2')]},'exitAt':{'type':Sequelize[_0x5d64('0x2')]},'reason':{'type':Sequelize[_0x5d64('0x3')]}}; \ No newline at end of file +var _0xc433=['DATE','moment','exports','STRING'];(function(_0xb71ce,_0x40d82b){var _0x248d99=function(_0x50338e){while(--_0x50338e){_0xb71ce['push'](_0xb71ce['shift']());}};_0x248d99(++_0x40d82b);}(_0xc433,0x1b1));var _0x3c43=function(_0x16b148,_0x7ba829){_0x16b148=_0x16b148-0x0;var _0x552b68=_0xc433[_0x16b148];return _0x552b68;};'use strict';var moment=require(_0x3c43('0x0'));var Sequelize=require('sequelize');module[_0x3c43('0x1')]={'uniqueid':{'type':Sequelize[_0x3c43('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3c43('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3c43('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5fbe2ec..bdace55 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 _0xb62e=['body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','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','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x184));var _0xeb62=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb62e[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require(_0xeb62('0xa'));var csv=require(_0xeb62('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb62('0xc'));var _=require(_0xeb62('0xd'));var squel=require(_0xeb62('0xe'));var crypto=require('crypto');var jsforce=require(_0xeb62('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeb62('0xb'));var querystring=require(_0xeb62('0x10'));var Papa=require(_0xeb62('0x11'));var Redis=require('ioredis');var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xeb62('0x16'));var config=require(_0xeb62('0x17'));var licenseUtil=require(_0xeb62('0x18'));var db=require(_0xeb62('0x19'))['db'];function respondWithStatusCode(_0x4d7529,_0x443a23){_0x443a23=_0x443a23||0xcc;return function(_0x57971e){if(_0x57971e){return _0x4d7529[_0xeb62('0x1a')](_0x443a23);}return _0x4d7529[_0xeb62('0x1b')](_0x443a23)[_0xeb62('0x1c')]();};}function respondWithResult(_0x62f5af,_0x24e371){_0x24e371=_0x24e371||0xc8;return function(_0x5c9f6e){if(_0x5c9f6e){return _0x62f5af['status'](_0x24e371)[_0xeb62('0x1d')](_0x5c9f6e);}};}function respondWithFilteredResult(_0x1d184b,_0x58bbc5){return function(_0x78d3d7){if(_0x78d3d7){var _0x3b0e98=typeof _0x58bbc5[_0xeb62('0x1e')]===_0xeb62('0x1f')&&typeof _0x58bbc5[_0xeb62('0x20')]==='undefined';var _0x37e04c=_0x78d3d7['count'];var _0x429b8e=_0x3b0e98?0x0:_0x58bbc5[_0xeb62('0x1e')];var _0x42f91b=_0x3b0e98?_0x78d3d7[_0xeb62('0x21')]:_0x58bbc5[_0xeb62('0x1e')]+_0x58bbc5[_0xeb62('0x20')];var _0x149601;if(_0x42f91b>=_0x37e04c){_0x42f91b=_0x37e04c;_0x149601=0xc8;}else{_0x149601=0xce;}_0x1d184b[_0xeb62('0x1b')](_0x149601);return _0x1d184b[_0xeb62('0x22')](_0xeb62('0x23'),_0x429b8e+'-'+_0x42f91b+'/'+_0x37e04c)[_0xeb62('0x1d')](_0x78d3d7);}return null;};}function patchUpdates(_0xb844b2){return function(_0x19d07b){try{jsonpatch['apply'](_0x19d07b,_0xb844b2,!![]);}catch(_0x374a95){return BPromise[_0xeb62('0x24')](_0x374a95);}return _0x19d07b[_0xeb62('0x25')]();};}function saveUpdates(_0x28dc25,_0x528928){return function(_0x12fbb1){if(_0x12fbb1){return _0x12fbb1[_0xeb62('0x26')](_0x28dc25)[_0xeb62('0x27')](function(_0x145ffa){return _0x145ffa;});}return null;};}function removeEntity(_0x1ff2e0,_0x414358){return function(_0x2a70d6){if(_0x2a70d6){return _0x2a70d6[_0xeb62('0x28')]()[_0xeb62('0x27')](function(){_0x1ff2e0['status'](0xcc)[_0xeb62('0x1c')]();});}};}function handleEntityNotFound(_0x3215a6,_0x5458c4){return function(_0xd8ca6b){if(!_0xd8ca6b){_0x3215a6[_0xeb62('0x1a')](0x194);}return _0xd8ca6b;};}function handleError(_0x2d0adb,_0x1c435){_0x1c435=_0x1c435||0x1f4;return function(_0x5220cf){logger[_0xeb62('0x29')](_0x5220cf[_0xeb62('0x2a')]);if(_0x5220cf[_0xeb62('0x2b')]){delete _0x5220cf[_0xeb62('0x2b')];}_0x2d0adb[_0xeb62('0x1b')](_0x1c435)['send'](_0x5220cf);};}exports[_0xeb62('0x2c')]=function(_0xc57154,_0x566ac1){var _0x473d73={},_0x16143={},_0x535161={'count':0x0,'rows':[]};var _0x6e4e52=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')][_0xeb62('0x2f')],function(_0x5288eb){return{'name':_0x5288eb[_0xeb62('0x30')],'type':_0x5288eb['type'][_0xeb62('0x31')]};});_0x16143['model']=_[_0xeb62('0x2d')](_0x6e4e52,_0xeb62('0x2b'));_0x16143[_0xeb62('0x32')]=_[_0xeb62('0x33')](_0xc57154['query']);_0x16143['filters']=_[_0xeb62('0x34')](_0x16143[_0xeb62('0x35')],_0x16143[_0xeb62('0x32')]);_0x473d73[_0xeb62('0x36')]=_['intersection'](_0x16143['model'],qs[_0xeb62('0x37')](_0xc57154[_0xeb62('0x32')][_0xeb62('0x37')]));_0x473d73['attributes']=_0x473d73[_0xeb62('0x36')][_0xeb62('0x38')]?_0x473d73[_0xeb62('0x36')]:_0x16143[_0xeb62('0x35')];if(!_0xc57154[_0xeb62('0x32')][_0xeb62('0x39')]('nolimit')){_0x473d73['limit']=qs['limit'](_0xc57154[_0xeb62('0x32')][_0xeb62('0x20')]);_0x473d73[_0xeb62('0x1e')]=qs[_0xeb62('0x1e')](_0xc57154[_0xeb62('0x32')][_0xeb62('0x1e')]);}_0x473d73[_0xeb62('0x3a')]=qs['sort'](_0xc57154[_0xeb62('0x32')][_0xeb62('0x3b')]);_0x473d73[_0xeb62('0x3c')]=qs[_0xeb62('0x3d')](_[_0xeb62('0x3e')](_0xc57154[_0xeb62('0x32')],_0x16143[_0xeb62('0x3d')]),_0x6e4e52);if(_0xc57154[_0xeb62('0x32')][_0xeb62('0x3f')]){_0x473d73[_0xeb62('0x3c')]=_[_0xeb62('0x40')](_0x473d73[_0xeb62('0x3c')],{'$or':_[_0xeb62('0x2d')](_0x6e4e52,function(_0x347e50){if(_0x347e50[_0xeb62('0x41')]!=='VIRTUAL'){var _0x1e659d={};_0x1e659d[_0x347e50[_0xeb62('0x2b')]]={'$like':'%'+_0xc57154[_0xeb62('0x32')][_0xeb62('0x3f')]+'%'};return _0x1e659d;}})});}_0x473d73=_[_0xeb62('0x40')]({},_0x473d73,_0xc57154[_0xeb62('0x42')]);var _0x272495={'where':_0x473d73[_0xeb62('0x3c')]};return db['OpenchannelQueueReport'][_0xeb62('0x21')](_0x272495)[_0xeb62('0x27')](function(_0x29b0d2){_0x535161[_0xeb62('0x21')]=_0x29b0d2;if(_0xc57154['query'][_0xeb62('0x43')]){_0x473d73[_0xeb62('0x44')]=[{'all':!![]}];}return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x473d73);})[_0xeb62('0x27')](function(_0x450ad7){_0x535161['rows']=_0x450ad7;return _0x535161;})[_0xeb62('0x27')](respondWithFilteredResult(_0x566ac1,_0x473d73))[_0xeb62('0x46')](handleError(_0x566ac1,null));};exports[_0xeb62('0x47')]=function(_0xb14e1d,_0x570a94){var _0x2a816d={'raw':!![],'where':{'id':_0xb14e1d['params']['id']}},_0x179f99={};_0x179f99[_0xeb62('0x35')]=_[_0xeb62('0x33')](db[_0xeb62('0x2e')][_0xeb62('0x2f')]);_0x179f99['query']=_['keys'](_0xb14e1d['query']);_0x179f99['filters']=_[_0xeb62('0x34')](_0x179f99[_0xeb62('0x35')],_0x179f99[_0xeb62('0x32')]);_0x2a816d[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x179f99[_0xeb62('0x35')],qs[_0xeb62('0x37')](_0xb14e1d[_0xeb62('0x32')][_0xeb62('0x37')]));_0x2a816d['attributes']=_0x2a816d[_0xeb62('0x36')][_0xeb62('0x38')]?_0x2a816d[_0xeb62('0x36')]:_0x179f99[_0xeb62('0x35')];if(_0xb14e1d[_0xeb62('0x32')][_0xeb62('0x43')]){_0x2a816d[_0xeb62('0x44')]=[{'all':!![]}];}_0x2a816d=_[_0xeb62('0x40')]({},_0x2a816d,_0xb14e1d[_0xeb62('0x42')]);return db[_0xeb62('0x2e')][_0xeb62('0x48')](_0x2a816d)[_0xeb62('0x27')](handleEntityNotFound(_0x570a94,null))[_0xeb62('0x27')](respondWithResult(_0x570a94,null))['catch'](handleError(_0x570a94,null));};exports[_0xeb62('0x49')]=function(_0x20d019,_0x42ba0c){return db['OpenchannelQueueReport'][_0xeb62('0x49')](_0x20d019[_0xeb62('0x4a')],{})[_0xeb62('0x27')](respondWithResult(_0x42ba0c,0xc9))[_0xeb62('0x46')](handleError(_0x42ba0c,null));};exports['update']=function(_0x5a0553,_0x2cd0ac){if(_0x5a0553[_0xeb62('0x4a')]['id']){delete _0x5a0553['body']['id'];}return db['OpenchannelQueueReport'][_0xeb62('0x48')]({'where':{'id':_0x5a0553[_0xeb62('0x4b')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x2cd0ac,null))[_0xeb62('0x27')](saveUpdates(_0x5a0553[_0xeb62('0x4a')],null))['then'](respondWithResult(_0x2cd0ac,null))[_0xeb62('0x46')](handleError(_0x2cd0ac,null));};exports[_0xeb62('0x28')]=function(_0x496b86,_0x2b9c01){return db[_0xeb62('0x2e')][_0xeb62('0x48')]({'where':{'id':_0x496b86[_0xeb62('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b9c01,null))[_0xeb62('0x27')](removeEntity(_0x2b9c01,null))[_0xeb62('0x46')](handleError(_0x2b9c01,null));};exports[_0xeb62('0x4c')]=function(_0x45a0b5,_0x10e258){return db['OpenchannelQueueReport'][_0xeb62('0x4c')]()['then'](respondWithResult(_0x10e258,null))['catch'](handleError(_0x10e258,null));}; \ No newline at end of file +var _0x75ce=['OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','intersection','find','create','body','catch','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','end','error','stack','name','send','index','map'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x75ce,0x14e));var _0xe75c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x75ce[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe75c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe75c('0x1'));var jsonpatch=require(_0xe75c('0x2'));var rp=require(_0xe75c('0x3'));var moment=require(_0xe75c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe75c('0x5'));var util=require(_0xe75c('0x6'));var path=require(_0xe75c('0x7'));var sox=require(_0xe75c('0x8'));var csv=require(_0xe75c('0x9'));var ejs=require(_0xe75c('0xa'));var fs=require('fs');var fs_extra=require(_0xe75c('0xb'));var _=require(_0xe75c('0xc'));var squel=require(_0xe75c('0xd'));var crypto=require(_0xe75c('0xe'));var jsforce=require(_0xe75c('0xf'));var deskjs=require(_0xe75c('0x10'));var toCsv=require(_0xe75c('0x9'));var querystring=require(_0xe75c('0x11'));var Papa=require('papaparse');var Redis=require(_0xe75c('0x12'));var authService=require(_0xe75c('0x13'));var qs=require(_0xe75c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe75c('0x15'));var logger=require(_0xe75c('0x16'))(_0xe75c('0x17'));var utils=require('../../config/utils');var config=require(_0xe75c('0x18'));var licenseUtil=require(_0xe75c('0x19'));var db=require(_0xe75c('0x1a'))['db'];function respondWithStatusCode(_0x4834d6,_0x2bc5f8){_0x2bc5f8=_0x2bc5f8||0xcc;return function(_0x118914){if(_0x118914){return _0x4834d6[_0xe75c('0x1b')](_0x2bc5f8);}return _0x4834d6[_0xe75c('0x1c')](_0x2bc5f8)['end']();};}function respondWithResult(_0x148e1b,_0x35074c){_0x35074c=_0x35074c||0xc8;return function(_0xf5adae){if(_0xf5adae){return _0x148e1b[_0xe75c('0x1c')](_0x35074c)[_0xe75c('0x1d')](_0xf5adae);}};}function respondWithFilteredResult(_0x4978fe,_0xfa6c3c){return function(_0x3da099){if(_0x3da099){var _0x5bc32d=typeof _0xfa6c3c[_0xe75c('0x1e')]===_0xe75c('0x1f')&&typeof _0xfa6c3c['limit']===_0xe75c('0x1f');var _0x4de883=_0x3da099[_0xe75c('0x20')];var _0x2a3277=_0x5bc32d?0x0:_0xfa6c3c[_0xe75c('0x1e')];var _0xd4a5d9=_0x5bc32d?_0x3da099['count']:_0xfa6c3c[_0xe75c('0x1e')]+_0xfa6c3c[_0xe75c('0x21')];var _0x33d8f8;if(_0xd4a5d9>=_0x4de883){_0xd4a5d9=_0x4de883;_0x33d8f8=0xc8;}else{_0x33d8f8=0xce;}_0x4978fe[_0xe75c('0x1c')](_0x33d8f8);return _0x4978fe[_0xe75c('0x22')](_0xe75c('0x23'),_0x2a3277+'-'+_0xd4a5d9+'/'+_0x4de883)[_0xe75c('0x1d')](_0x3da099);}return null;};}function patchUpdates(_0xe38218){return function(_0x115517){try{jsonpatch['apply'](_0x115517,_0xe38218,!![]);}catch(_0x281a94){return BPromise['reject'](_0x281a94);}return _0x115517[_0xe75c('0x24')]();};}function saveUpdates(_0x5a1cca,_0x5f5b03){return function(_0x38a1bf){if(_0x38a1bf){return _0x38a1bf[_0xe75c('0x25')](_0x5a1cca)[_0xe75c('0x26')](function(_0x2556a0){return _0x2556a0;});}return null;};}function removeEntity(_0x23fab8,_0x9f8b68){return function(_0x4c5bd9){if(_0x4c5bd9){return _0x4c5bd9['destroy']()['then'](function(){_0x23fab8[_0xe75c('0x1c')](0xcc)[_0xe75c('0x27')]();});}};}function handleEntityNotFound(_0x33832d,_0x58c70a){return function(_0x3ee3e3){if(!_0x3ee3e3){_0x33832d[_0xe75c('0x1b')](0x194);}return _0x3ee3e3;};}function handleError(_0x2bab88,_0x2c594c){_0x2c594c=_0x2c594c||0x1f4;return function(_0x98a08c){logger[_0xe75c('0x28')](_0x98a08c[_0xe75c('0x29')]);if(_0x98a08c['name']){delete _0x98a08c[_0xe75c('0x2a')];}_0x2bab88[_0xe75c('0x1c')](_0x2c594c)[_0xe75c('0x2b')](_0x98a08c);};}exports[_0xe75c('0x2c')]=function(_0x11aac7,_0x2065e9){var _0x208ca9={},_0x2199a9={},_0x3f32d9={'count':0x0,'rows':[]};var _0x14ec90=_[_0xe75c('0x2d')](db[_0xe75c('0x2e')]['rawAttributes'],function(_0x55c285){return{'name':_0x55c285[_0xe75c('0x2f')],'type':_0x55c285[_0xe75c('0x30')][_0xe75c('0x31')]};});_0x2199a9[_0xe75c('0x32')]=_[_0xe75c('0x2d')](_0x14ec90,_0xe75c('0x2a'));_0x2199a9[_0xe75c('0x33')]=_[_0xe75c('0x34')](_0x11aac7[_0xe75c('0x33')]);_0x2199a9[_0xe75c('0x35')]=_['intersection'](_0x2199a9[_0xe75c('0x32')],_0x2199a9[_0xe75c('0x33')]);_0x208ca9[_0xe75c('0x36')]=_['intersection'](_0x2199a9[_0xe75c('0x32')],qs[_0xe75c('0x37')](_0x11aac7[_0xe75c('0x33')][_0xe75c('0x37')]));_0x208ca9[_0xe75c('0x36')]=_0x208ca9[_0xe75c('0x36')]['length']?_0x208ca9[_0xe75c('0x36')]:_0x2199a9[_0xe75c('0x32')];if(!_0x11aac7['query'][_0xe75c('0x38')](_0xe75c('0x39'))){_0x208ca9[_0xe75c('0x21')]=qs['limit'](_0x11aac7[_0xe75c('0x33')]['limit']);_0x208ca9[_0xe75c('0x1e')]=qs['offset'](_0x11aac7['query'][_0xe75c('0x1e')]);}_0x208ca9[_0xe75c('0x3a')]=qs[_0xe75c('0x3b')](_0x11aac7[_0xe75c('0x33')][_0xe75c('0x3b')]);_0x208ca9[_0xe75c('0x3c')]=qs[_0xe75c('0x35')](_['pick'](_0x11aac7['query'],_0x2199a9['filters']),_0x14ec90);if(_0x11aac7[_0xe75c('0x33')]['filter']){_0x208ca9[_0xe75c('0x3c')]=_[_0xe75c('0x3d')](_0x208ca9[_0xe75c('0x3c')],{'$or':_[_0xe75c('0x2d')](_0x14ec90,function(_0x449398){if(_0x449398[_0xe75c('0x30')]!==_0xe75c('0x3e')){var _0x19bd76={};_0x19bd76[_0x449398[_0xe75c('0x2a')]]={'$like':'%'+_0x11aac7[_0xe75c('0x33')]['filter']+'%'};return _0x19bd76;}})});}_0x208ca9=_[_0xe75c('0x3d')]({},_0x208ca9,_0x11aac7[_0xe75c('0x3f')]);var _0x7d577b={'where':_0x208ca9[_0xe75c('0x3c')]};return db[_0xe75c('0x2e')][_0xe75c('0x20')](_0x7d577b)[_0xe75c('0x26')](function(_0x2308a9){_0x3f32d9['count']=_0x2308a9;if(_0x11aac7[_0xe75c('0x33')][_0xe75c('0x40')]){_0x208ca9[_0xe75c('0x41')]=[{'all':!![]}];}return db[_0xe75c('0x2e')]['findAll'](_0x208ca9);})[_0xe75c('0x26')](function(_0x5d3cd5){_0x3f32d9[_0xe75c('0x42')]=_0x5d3cd5;return _0x3f32d9;})[_0xe75c('0x26')](respondWithFilteredResult(_0x2065e9,_0x208ca9))['catch'](handleError(_0x2065e9,null));};exports['show']=function(_0xfaf566,_0x6c942c){var _0x9a004d={'raw':!![],'where':{'id':_0xfaf566[_0xe75c('0x43')]['id']}},_0x48517e={};_0x48517e[_0xe75c('0x32')]=_[_0xe75c('0x34')](db[_0xe75c('0x2e')][_0xe75c('0x44')]);_0x48517e[_0xe75c('0x33')]=_[_0xe75c('0x34')](_0xfaf566['query']);_0x48517e[_0xe75c('0x35')]=_[_0xe75c('0x45')](_0x48517e[_0xe75c('0x32')],_0x48517e[_0xe75c('0x33')]);_0x9a004d[_0xe75c('0x36')]=_['intersection'](_0x48517e[_0xe75c('0x32')],qs[_0xe75c('0x37')](_0xfaf566[_0xe75c('0x33')][_0xe75c('0x37')]));_0x9a004d[_0xe75c('0x36')]=_0x9a004d[_0xe75c('0x36')]['length']?_0x9a004d['attributes']:_0x48517e[_0xe75c('0x32')];if(_0xfaf566['query'][_0xe75c('0x40')]){_0x9a004d[_0xe75c('0x41')]=[{'all':!![]}];}_0x9a004d=_['merge']({},_0x9a004d,_0xfaf566[_0xe75c('0x3f')]);return db['OpenchannelQueueReport'][_0xe75c('0x46')](_0x9a004d)[_0xe75c('0x26')](handleEntityNotFound(_0x6c942c,null))[_0xe75c('0x26')](respondWithResult(_0x6c942c,null))['catch'](handleError(_0x6c942c,null));};exports['create']=function(_0x395ac4,_0x4ccb11){return db['OpenchannelQueueReport'][_0xe75c('0x47')](_0x395ac4[_0xe75c('0x48')],{})[_0xe75c('0x26')](respondWithResult(_0x4ccb11,0xc9))['catch'](handleError(_0x4ccb11,null));};exports['update']=function(_0x5ce65b,_0x1a4e8f){if(_0x5ce65b['body']['id']){delete _0x5ce65b[_0xe75c('0x48')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x5ce65b[_0xe75c('0x43')]['id']}})[_0xe75c('0x26')](handleEntityNotFound(_0x1a4e8f,null))['then'](saveUpdates(_0x5ce65b['body'],null))[_0xe75c('0x26')](respondWithResult(_0x1a4e8f,null))[_0xe75c('0x49')](handleError(_0x1a4e8f,null));};exports[_0xe75c('0x4a')]=function(_0x1d0686,_0x3c0cea){return db['OpenchannelQueueReport'][_0xe75c('0x46')]({'where':{'id':_0x1d0686[_0xe75c('0x43')]['id']}})[_0xe75c('0x26')](handleEntityNotFound(_0x3c0cea,null))[_0xe75c('0x26')](removeEntity(_0x3c0cea,null))['catch'](handleError(_0x3c0cea,null));};exports['describe']=function(_0x3ddb39,_0x18b57c){return db[_0xe75c('0x2e')][_0xe75c('0x4b')]()['then'](respondWithResult(_0x18b57c,null))[_0xe75c('0x49')](handleError(_0x18b57c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2c66482..327e03f 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x151c28,_0x348645){var _0x558af2=function(_0x20f3f7){while(--_0x20f3f7){_0x151c28['push'](_0x151c28['shift']());}};_0x558af2(++_0x348645);}(_0x2ef3,0xba));var _0x32ef=function(_0x182c7d,_0x3b7525){_0x182c7d=_0x182c7d-0x0;var _0x5334a6=_0x2ef3[_0x182c7d];return _0x5334a6;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x44676a,_0x3e7b88){var _0x588695=function(_0x168ed1){while(--_0x168ed1){_0x44676a['push'](_0x44676a['shift']());}};_0x588695(++_0x3e7b88);}(_0xe14b,0x93));var _0xbe14=function(_0x240aed,_0x20d95f){_0x240aed=_0x240aed-0x0;var _0x28ddbf=_0xe14b[_0x240aed];return _0x28ddbf;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3cc31c3..36490f8 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 _0x1c7c=['raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options'];(function(_0x5ee990,_0x3362fe){var _0x2d2dad=function(_0x38480e){while(--_0x38480e){_0x5ee990['push'](_0x5ee990['shift']());}};_0x2d2dad(++_0x3362fe);}(_0x1c7c,0x164));var _0xc1c7=function(_0x453be9,_0x1c7930){_0x453be9=_0x453be9-0x0;var _0x180559=_0x1c7c[_0x453be9];return _0x180559;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x419138,_0xce5bcd,_0x3b3e9c){return new BPromise(function(_0x434a35,_0x11c7ef){return client[_0xc1c7('0xc')](_0x419138,_0x3b3e9c)[_0xc1c7('0xd')](function(_0x339649){logger[_0xc1c7('0xe')](_0xc1c7('0xf'),_0xce5bcd,'request\x20sent');logger[_0xc1c7('0x10')](_0xc1c7('0x11'),_0xce5bcd,'request\x20sent',JSON[_0xc1c7('0x12')](_0x339649));if(_0x339649[_0xc1c7('0x13')]){if(_0x339649[_0xc1c7('0x13')]['code']===0x1f4){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x11c7ef(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x434a35(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}else{logger['info'](_0xc1c7('0xf'),_0xce5bcd,_0xc1c7('0x15'));_0x434a35(_0x339649[_0xc1c7('0x16')]['message']);}})[_0xc1c7('0x17')](function(_0x3939c1){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x3939c1);_0x11c7ef(_0x3939c1);});});}exports[_0xc1c7('0x18')]=function(_0xb42702){var _0x21758a=this;return new Promise(function(_0x2e93e5,_0x5d44e9){return db[_0xc1c7('0x19')][_0xc1c7('0x1a')](_0xb42702[_0xc1c7('0x1b')],{'raw':_0xb42702[_0xc1c7('0x1c')]?_0xb42702['options'][_0xc1c7('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5e7e4a){logger[_0xc1c7('0xe')]('CreateOpenchannelQueueReport',_0xb42702);logger['debug'](_0xc1c7('0x18'),_0xb42702,JSON[_0xc1c7('0x12')](_0x5e7e4a));_0x2e93e5(_0x5e7e4a);})[_0xc1c7('0x17')](function(_0x4c6b34){logger[_0xc1c7('0x13')](_0xc1c7('0x18'),_0x4c6b34[_0xc1c7('0x14')],_0xb42702);_0x5d44e9(_0x21758a[_0xc1c7('0x13')](0x1f4,_0x4c6b34[_0xc1c7('0x14')]));});});};exports[_0xc1c7('0x1e')]=function(_0x3180fd){var _0x120168=this;return new Promise(function(_0x22b654,_0x1540c1){return db[_0xc1c7('0x19')][_0xc1c7('0x1f')](_0x3180fd[_0xc1c7('0x1b')],{'raw':_0x3180fd[_0xc1c7('0x1c')]?_0x3180fd[_0xc1c7('0x1c')][_0xc1c7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3180fd['options']?_0x3180fd[_0xc1c7('0x1c')][_0xc1c7('0x20')]||null:null,'attributes':_0x3180fd['options']?_0x3180fd['options'][_0xc1c7('0x21')]||null:null,'limit':_0x3180fd['options']?_0x3180fd['options'][_0xc1c7('0x22')]||null:null})[_0xc1c7('0xd')](function(_0x46d045){logger[_0xc1c7('0xe')](_0xc1c7('0x1e'),_0x3180fd);logger['debug']('UpdateOpenchannelQueueReport',_0x3180fd,JSON[_0xc1c7('0x12')](_0x46d045));_0x22b654(_0x46d045);})[_0xc1c7('0x17')](function(_0x9a0ab3){logger[_0xc1c7('0x13')](_0xc1c7('0x1e'),_0x9a0ab3['message'],_0x3180fd);_0x1540c1(_0x120168['error'](0x1f4,_0x9a0ab3[_0xc1c7('0x14')]));});});}; \ No newline at end of file +var _0x594d=['result','create','options','raw','CreateOpenchannelQueueReport','stringify','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','body','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x41207d,_0x2b0612){var _0x2876d9=function(_0x14a5ab){while(--_0x14a5ab){_0x41207d['push'](_0x41207d['shift']());}};_0x2876d9(++_0x2b0612);}(_0x594d,0x92));var _0xd594=function(_0x2ac352,_0x4051b1){_0x2ac352=_0x2ac352-0x0;var _0x423370=_0x594d[_0x2ac352];return _0x423370;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1c64,_0x446711,_0xeedad0){return new BPromise(function(_0x20325a,_0x20718a){return client[_0xd594('0x9')](_0x3b1c64,_0xeedad0)[_0xd594('0xa')](function(_0xf3043e){logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');logger[_0xd594('0xd')](_0xd594('0xe'),_0x446711,_0xd594('0xf'),JSON['stringify'](_0xf3043e));if(_0xf3043e[_0xd594('0x10')]){if(_0xf3043e[_0xd594('0x10')][_0xd594('0x11')]===0x1f4){logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e[_0xd594('0x10')][_0xd594('0x12')]);return _0x20718a(_0xf3043e['error']['message']);}logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e['error'][_0xd594('0x12')]);return _0x20325a(_0xf3043e['error'][_0xd594('0x12')]);}else{logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');_0x20325a(_0xf3043e[_0xd594('0x13')]['message']);}})['catch'](function(_0x2a5f17){logger[_0xd594('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x446711,_0x2a5f17);_0x20718a(_0x2a5f17);});});}exports['CreateOpenchannelQueueReport']=function(_0x232776){var _0x4ea0d5=this;return new Promise(function(_0x54f640,_0x3ae9be){return db['OpenchannelQueueReport'][_0xd594('0x14')](_0x232776['body'],{'raw':_0x232776[_0xd594('0x15')]?_0x232776['options'][_0xd594('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3b0fda){logger[_0xd594('0xb')](_0xd594('0x17'),_0x232776);logger[_0xd594('0xd')](_0xd594('0x17'),_0x232776,JSON[_0xd594('0x18')](_0x3b0fda));_0x54f640(_0x3b0fda);})[_0xd594('0x19')](function(_0x2b8495){logger[_0xd594('0x10')](_0xd594('0x17'),_0x2b8495[_0xd594('0x12')],_0x232776);_0x3ae9be(_0x4ea0d5[_0xd594('0x10')](0x1f4,_0x2b8495[_0xd594('0x12')]));});});};exports[_0xd594('0x1a')]=function(_0x769cae){var _0x3a6a4e=this;return new Promise(function(_0x16bda7,_0x5c8200){return db[_0xd594('0x1b')][_0xd594('0x1c')](_0x769cae[_0xd594('0x1d')],{'raw':_0x769cae[_0xd594('0x15')]?_0x769cae[_0xd594('0x15')][_0xd594('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x769cae[_0xd594('0x15')]?_0x769cae[_0xd594('0x15')][_0xd594('0x1e')]||null:null,'attributes':_0x769cae['options']?_0x769cae[_0xd594('0x15')][_0xd594('0x1f')]||null:null,'limit':_0x769cae[_0xd594('0x15')]?_0x769cae[_0xd594('0x15')][_0xd594('0x20')]||null:null})[_0xd594('0xa')](function(_0x3cb6b5){logger[_0xd594('0xb')](_0xd594('0x1a'),_0x769cae);logger[_0xd594('0xd')](_0xd594('0x1a'),_0x769cae,JSON[_0xd594('0x18')](_0x3cb6b5));_0x16bda7(_0x3cb6b5);})[_0xd594('0x19')](function(_0x2d93ed){logger[_0xd594('0x10')](_0xd594('0x1a'),_0x2d93ed[_0xd594('0x12')],_0x769cae);_0x5c8200(_0x3a6a4e['error'](0x1f4,_0x2d93ed['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1644867..fc7867e 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 _0xa0df=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0xee68af,_0x8e4acc){var _0x18cc97=function(_0x4c6179){while(--_0x4c6179){_0xee68af['push'](_0xee68af['shift']());}};_0x18cc97(++_0x8e4acc);}(_0xa0df,0xd7));var _0xfa0d=function(_0xa78842,_0x4796a2){_0xa78842=_0xa78842-0x0;var _0x2abc00=_0xa0df[_0xa78842];return _0x2abc00;};'use strict';var multer=require(_0xfa0d('0x0'));var util=require(_0xfa0d('0x1'));var path=require(_0xfa0d('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa0d('0x3'));var router=express[_0xfa0d('0x4')]();var fs_extra=require(_0xfa0d('0x5'));var auth=require(_0xfa0d('0x6'));var interaction=require(_0xfa0d('0x7'));var config=require('../../config/environment');var controller=require(_0xfa0d('0x8'));router['get']('/',auth[_0xfa0d('0x9')](),controller[_0xfa0d('0xa')]);router['get'](_0xfa0d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xfa0d('0xc'),auth[_0xfa0d('0x9')](),controller[_0xfa0d('0xd')]);router[_0xfa0d('0xe')]('/',auth[_0xfa0d('0x9')](),controller[_0xfa0d('0xf')]);router[_0xfa0d('0x10')]('/:id',auth[_0xfa0d('0x9')](),controller[_0xfa0d('0x11')]);router[_0xfa0d('0x12')](_0xfa0d('0xc'),auth[_0xfa0d('0x9')](),controller[_0xfa0d('0x13')]);module[_0xfa0d('0x14')]=router; \ No newline at end of file +var _0xe9e6=['../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','create','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x498b9e,_0x46ae26){var _0x29dd57=function(_0x56f191){while(--_0x56f191){_0x498b9e['push'](_0x498b9e['shift']());}};_0x29dd57(++_0x46ae26);}(_0xe9e6,0x12b));var _0x6e9e=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0xe9e6[_0x1678c8];return _0x387aa9;};'use strict';var multer=require('multer');var util=require(_0x6e9e('0x0'));var path=require(_0x6e9e('0x1'));var timeout=require(_0x6e9e('0x2'));var express=require(_0x6e9e('0x3'));var router=express[_0x6e9e('0x4')]();var fs_extra=require(_0x6e9e('0x5'));var auth=require(_0x6e9e('0x6'));var interaction=require(_0x6e9e('0x7'));var config=require(_0x6e9e('0x8'));var controller=require(_0x6e9e('0x9'));router[_0x6e9e('0xa')]('/',auth[_0x6e9e('0xb')](),controller['index']);router[_0x6e9e('0xa')](_0x6e9e('0xc'),auth[_0x6e9e('0xb')](),controller[_0x6e9e('0xd')]);router[_0x6e9e('0xa')](_0x6e9e('0xe'),auth[_0x6e9e('0xb')](),controller['show']);router['post']('/',auth[_0x6e9e('0xb')](),controller[_0x6e9e('0xf')]);router['put']('/:id',auth[_0x6e9e('0xb')](),controller[_0x6e9e('0x10')]);router[_0x6e9e('0x11')](_0x6e9e('0xe'),auth[_0x6e9e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 42f9a3d..3c8b6fc 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x9bde,0xe1));var _0xe9bd=function(_0x273148,_0x4032a6){_0x273148=_0x273148-0x0;var _0x228324=_0x9bde[_0x273148];return _0x228324;};'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 +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x343fe2,_0x4ce0da){var _0x304ee3=function(_0xe934bd){while(--_0xe934bd){_0x343fe2['push'](_0x343fe2['shift']());}};_0x304ee3(++_0x4ce0da);}(_0xaa88,0x137));var _0x8aa8=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0xaa88[_0x461886];return _0x295e0a;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 796be57..191c8ed 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 _0x3364=['sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','error','name','index','map','OpenchannelTransferReport','fieldName','type','model','keys','intersection','query','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x3364,0xf0));var _0x4336=function(_0x21ca6c,_0xa5aba6){_0x21ca6c=_0x21ca6c-0x0;var _0x5e6c21=_0x3364[_0x21ca6c];return _0x5e6c21;};'use strict';var emlformat=require(_0x4336('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4336('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4336('0x2'));var moment=require(_0x4336('0x3'));var BPromise=require(_0x4336('0x4'));var Mustache=require(_0x4336('0x5'));var util=require('util');var path=require(_0x4336('0x6'));var sox=require('sox');var csv=require(_0x4336('0x7'));var ejs=require(_0x4336('0x8'));var fs=require('fs');var fs_extra=require(_0x4336('0x9'));var _=require(_0x4336('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4336('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4336('0xc'));var Papa=require(_0x4336('0xd'));var Redis=require(_0x4336('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4336('0xf'));var hardwareService=require(_0x4336('0x10'));var logger=require(_0x4336('0x11'))(_0x4336('0x12'));var utils=require(_0x4336('0x13'));var config=require(_0x4336('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4336('0x15'))['db'];function respondWithStatusCode(_0x24b03d,_0x1fd06d){_0x1fd06d=_0x1fd06d||0xcc;return function(_0xf2604){if(_0xf2604){return _0x24b03d[_0x4336('0x16')](_0x1fd06d);}return _0x24b03d['status'](_0x1fd06d)[_0x4336('0x17')]();};}function respondWithResult(_0x24f5fe,_0xb98038){_0xb98038=_0xb98038||0xc8;return function(_0x1f1827){if(_0x1f1827){return _0x24f5fe['status'](_0xb98038)[_0x4336('0x18')](_0x1f1827);}};}function respondWithFilteredResult(_0x2bd458,_0x31d787){return function(_0x4c3dab){if(_0x4c3dab){var _0x2bc8ce=typeof _0x31d787[_0x4336('0x19')]===_0x4336('0x1a')&&typeof _0x31d787[_0x4336('0x1b')]==='undefined';var _0x3c2305=_0x4c3dab[_0x4336('0x1c')];var _0x338269=_0x2bc8ce?0x0:_0x31d787[_0x4336('0x19')];var _0x422c13=_0x2bc8ce?_0x4c3dab[_0x4336('0x1c')]:_0x31d787[_0x4336('0x19')]+_0x31d787[_0x4336('0x1b')];var _0xeaa73;if(_0x422c13>=_0x3c2305){_0x422c13=_0x3c2305;_0xeaa73=0xc8;}else{_0xeaa73=0xce;}_0x2bd458[_0x4336('0x1d')](_0xeaa73);return _0x2bd458[_0x4336('0x1e')](_0x4336('0x1f'),_0x338269+'-'+_0x422c13+'/'+_0x3c2305)[_0x4336('0x18')](_0x4c3dab);}return null;};}function patchUpdates(_0xbdee37){return function(_0x7b6794){try{jsonpatch[_0x4336('0x20')](_0x7b6794,_0xbdee37,!![]);}catch(_0x22ffcc){return BPromise[_0x4336('0x21')](_0x22ffcc);}return _0x7b6794[_0x4336('0x22')]();};}function saveUpdates(_0x4118c5,_0x20a6e8){return function(_0x397ad8){if(_0x397ad8){return _0x397ad8['update'](_0x4118c5)[_0x4336('0x23')](function(_0x52cbd2){return _0x52cbd2;});}return null;};}function removeEntity(_0x5006f0,_0x3c3e2e){return function(_0x409a72){if(_0x409a72){return _0x409a72['destroy']()[_0x4336('0x23')](function(){_0x5006f0[_0x4336('0x1d')](0xcc)[_0x4336('0x17')]();});}};}function handleEntityNotFound(_0x1f70e8,_0x216f74){return function(_0x2578ab){if(!_0x2578ab){_0x1f70e8[_0x4336('0x16')](0x194);}return _0x2578ab;};}function handleError(_0x33f864,_0x328f62){_0x328f62=_0x328f62||0x1f4;return function(_0x543ef8){logger[_0x4336('0x24')](_0x543ef8['stack']);if(_0x543ef8[_0x4336('0x25')]){delete _0x543ef8[_0x4336('0x25')];}_0x33f864[_0x4336('0x1d')](_0x328f62)['send'](_0x543ef8);};}exports[_0x4336('0x26')]=function(_0x1821b5,_0x5e31ea){var _0x3bc41c={},_0x418323={},_0x1c605b={'count':0x0,'rows':[]};var _0x3925dc=_[_0x4336('0x27')](db[_0x4336('0x28')]['rawAttributes'],function(_0x7bedc9){return{'name':_0x7bedc9[_0x4336('0x29')],'type':_0x7bedc9[_0x4336('0x2a')]['key']};});_0x418323[_0x4336('0x2b')]=_['map'](_0x3925dc,_0x4336('0x25'));_0x418323['query']=_[_0x4336('0x2c')](_0x1821b5['query']);_0x418323['filters']=_[_0x4336('0x2d')](_0x418323['model'],_0x418323[_0x4336('0x2e')]);_0x3bc41c[_0x4336('0x2f')]=_[_0x4336('0x2d')](_0x418323[_0x4336('0x2b')],qs['fields'](_0x1821b5[_0x4336('0x2e')]['fields']));_0x3bc41c[_0x4336('0x2f')]=_0x3bc41c['attributes'][_0x4336('0x30')]?_0x3bc41c[_0x4336('0x2f')]:_0x418323[_0x4336('0x2b')];if(!_0x1821b5[_0x4336('0x2e')][_0x4336('0x31')](_0x4336('0x32'))){_0x3bc41c[_0x4336('0x1b')]=qs[_0x4336('0x1b')](_0x1821b5[_0x4336('0x2e')]['limit']);_0x3bc41c['offset']=qs[_0x4336('0x19')](_0x1821b5[_0x4336('0x2e')][_0x4336('0x19')]);}_0x3bc41c[_0x4336('0x33')]=qs[_0x4336('0x34')](_0x1821b5[_0x4336('0x2e')][_0x4336('0x34')]);_0x3bc41c[_0x4336('0x35')]=qs[_0x4336('0x36')](_[_0x4336('0x37')](_0x1821b5[_0x4336('0x2e')],_0x418323[_0x4336('0x36')]),_0x3925dc);if(_0x1821b5[_0x4336('0x2e')][_0x4336('0x38')]){_0x3bc41c[_0x4336('0x35')]=_[_0x4336('0x39')](_0x3bc41c['where'],{'$or':_[_0x4336('0x27')](_0x3925dc,function(_0x1a06f7){if(_0x1a06f7[_0x4336('0x2a')]!==_0x4336('0x3a')){var _0x4c6284={};_0x4c6284[_0x1a06f7[_0x4336('0x25')]]={'$like':'%'+_0x1821b5[_0x4336('0x2e')][_0x4336('0x38')]+'%'};return _0x4c6284;}})});}_0x3bc41c=_[_0x4336('0x39')]({},_0x3bc41c,_0x1821b5[_0x4336('0x3b')]);var _0x44e225={'where':_0x3bc41c['where']};return db[_0x4336('0x28')][_0x4336('0x1c')](_0x44e225)['then'](function(_0x2a48a3){_0x1c605b[_0x4336('0x1c')]=_0x2a48a3;if(_0x1821b5['query'][_0x4336('0x3c')]){_0x3bc41c[_0x4336('0x3d')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4336('0x3e')](_0x3bc41c);})[_0x4336('0x23')](function(_0x54f831){_0x1c605b[_0x4336('0x3f')]=_0x54f831;return _0x1c605b;})['then'](respondWithFilteredResult(_0x5e31ea,_0x3bc41c))[_0x4336('0x40')](handleError(_0x5e31ea,null));};exports[_0x4336('0x41')]=function(_0x5ad13b,_0x49e4ff){var _0x3d9bfb={'raw':!![],'where':{'id':_0x5ad13b[_0x4336('0x42')]['id']}},_0x576860={};_0x576860[_0x4336('0x2b')]=_['keys'](db[_0x4336('0x28')][_0x4336('0x43')]);_0x576860[_0x4336('0x2e')]=_['keys'](_0x5ad13b[_0x4336('0x2e')]);_0x576860[_0x4336('0x36')]=_[_0x4336('0x2d')](_0x576860[_0x4336('0x2b')],_0x576860[_0x4336('0x2e')]);_0x3d9bfb['attributes']=_[_0x4336('0x2d')](_0x576860[_0x4336('0x2b')],qs[_0x4336('0x44')](_0x5ad13b[_0x4336('0x2e')]['fields']));_0x3d9bfb['attributes']=_0x3d9bfb[_0x4336('0x2f')]['length']?_0x3d9bfb['attributes']:_0x576860[_0x4336('0x2b')];if(_0x5ad13b[_0x4336('0x2e')]['includeAll']){_0x3d9bfb[_0x4336('0x3d')]=[{'all':!![]}];}_0x3d9bfb=_[_0x4336('0x39')]({},_0x3d9bfb,_0x5ad13b[_0x4336('0x3b')]);return db['OpenchannelTransferReport'][_0x4336('0x45')](_0x3d9bfb)['then'](handleEntityNotFound(_0x49e4ff,null))[_0x4336('0x23')](respondWithResult(_0x49e4ff,null))[_0x4336('0x40')](handleError(_0x49e4ff,null));};exports['create']=function(_0x1c445c,_0x4db9b4){return db[_0x4336('0x28')][_0x4336('0x46')](_0x1c445c[_0x4336('0x47')],{})[_0x4336('0x23')](respondWithResult(_0x4db9b4,0xc9))[_0x4336('0x40')](handleError(_0x4db9b4,null));};exports['update']=function(_0x175f4f,_0x228c07){if(_0x175f4f[_0x4336('0x47')]['id']){delete _0x175f4f[_0x4336('0x47')]['id'];}return db[_0x4336('0x28')]['find']({'where':{'id':_0x175f4f[_0x4336('0x42')]['id']}})[_0x4336('0x23')](handleEntityNotFound(_0x228c07,null))[_0x4336('0x23')](saveUpdates(_0x175f4f[_0x4336('0x47')],null))[_0x4336('0x23')](respondWithResult(_0x228c07,null))[_0x4336('0x40')](handleError(_0x228c07,null));};exports['destroy']=function(_0x5e820b,_0x242d04){return db['OpenchannelTransferReport'][_0x4336('0x45')]({'where':{'id':_0x5e820b[_0x4336('0x42')]['id']}})[_0x4336('0x23')](handleEntityNotFound(_0x242d04,null))[_0x4336('0x23')](removeEntity(_0x242d04,null))[_0x4336('0x40')](handleError(_0x242d04,null));};exports[_0x4336('0x48')]=function(_0x539022,_0x353d4a){return db['OpenchannelTransferReport'][_0x4336('0x48')]()[_0x4336('0x23')](respondWithResult(_0x353d4a,null))[_0x4336('0x40')](handleError(_0x353d4a,null));}; \ No newline at end of file +var _0xd3e5=['../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x140a60,_0xe96b8a){var _0x4876fc=function(_0x1a48f8){while(--_0x1a48f8){_0x140a60['push'](_0x140a60['shift']());}};_0x4876fc(++_0xe96b8a);}(_0xd3e5,0xc9));var _0x5d3e=function(_0x1e92ea,_0x4de6f1){_0x1e92ea=_0x1e92ea-0x0;var _0x3443f3=_0xd3e5[_0x1e92ea];return _0x3443f3;};'use strict';var emlformat=require(_0x5d3e('0x0'));var rimraf=require(_0x5d3e('0x1'));var zipdir=require(_0x5d3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d3e('0x3'));var moment=require(_0x5d3e('0x4'));var BPromise=require(_0x5d3e('0x5'));var Mustache=require(_0x5d3e('0x6'));var util=require(_0x5d3e('0x7'));var path=require('path');var sox=require(_0x5d3e('0x8'));var csv=require(_0x5d3e('0x9'));var ejs=require(_0x5d3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d3e('0xb'));var squel=require(_0x5d3e('0xc'));var crypto=require(_0x5d3e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5d3e('0xe'));var toCsv=require(_0x5d3e('0x9'));var querystring=require(_0x5d3e('0xf'));var Papa=require(_0x5d3e('0x10'));var Redis=require(_0x5d3e('0x11'));var authService=require(_0x5d3e('0x12'));var qs=require(_0x5d3e('0x13'));var as=require(_0x5d3e('0x14'));var hardwareService=require(_0x5d3e('0x15'));var logger=require(_0x5d3e('0x16'))(_0x5d3e('0x17'));var utils=require(_0x5d3e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5d3e('0x19'))['db'];function respondWithStatusCode(_0x567b3d,_0x2000e3){_0x2000e3=_0x2000e3||0xcc;return function(_0xf45575){if(_0xf45575){return _0x567b3d[_0x5d3e('0x1a')](_0x2000e3);}return _0x567b3d[_0x5d3e('0x1b')](_0x2000e3)[_0x5d3e('0x1c')]();};}function respondWithResult(_0x489c39,_0x49ac5d){_0x49ac5d=_0x49ac5d||0xc8;return function(_0x1e99ae){if(_0x1e99ae){return _0x489c39[_0x5d3e('0x1b')](_0x49ac5d)[_0x5d3e('0x1d')](_0x1e99ae);}};}function respondWithFilteredResult(_0xa3a6d3,_0x210fd7){return function(_0x320a22){if(_0x320a22){var _0x33c056=typeof _0x210fd7['offset']==='undefined'&&typeof _0x210fd7[_0x5d3e('0x1e')]===_0x5d3e('0x1f');var _0x2ca91f=_0x320a22[_0x5d3e('0x20')];var _0x348aa2=_0x33c056?0x0:_0x210fd7[_0x5d3e('0x21')];var _0x2556d0=_0x33c056?_0x320a22[_0x5d3e('0x20')]:_0x210fd7[_0x5d3e('0x21')]+_0x210fd7[_0x5d3e('0x1e')];var _0xbb2836;if(_0x2556d0>=_0x2ca91f){_0x2556d0=_0x2ca91f;_0xbb2836=0xc8;}else{_0xbb2836=0xce;}_0xa3a6d3[_0x5d3e('0x1b')](_0xbb2836);return _0xa3a6d3['set'](_0x5d3e('0x22'),_0x348aa2+'-'+_0x2556d0+'/'+_0x2ca91f)['json'](_0x320a22);}return null;};}function patchUpdates(_0x1d2488){return function(_0x5e74a9){try{jsonpatch[_0x5d3e('0x23')](_0x5e74a9,_0x1d2488,!![]);}catch(_0x105c7b){return BPromise[_0x5d3e('0x24')](_0x105c7b);}return _0x5e74a9[_0x5d3e('0x25')]();};}function saveUpdates(_0x1f0fa8,_0x30e429){return function(_0x1630b2){if(_0x1630b2){return _0x1630b2[_0x5d3e('0x26')](_0x1f0fa8)[_0x5d3e('0x27')](function(_0x1387a9){return _0x1387a9;});}return null;};}function removeEntity(_0x3c7e74,_0x45d2b4){return function(_0x4399a6){if(_0x4399a6){return _0x4399a6[_0x5d3e('0x28')]()[_0x5d3e('0x27')](function(){_0x3c7e74[_0x5d3e('0x1b')](0xcc)[_0x5d3e('0x1c')]();});}};}function handleEntityNotFound(_0x1b0b93,_0x23d655){return function(_0x194dd7){if(!_0x194dd7){_0x1b0b93['sendStatus'](0x194);}return _0x194dd7;};}function handleError(_0x574645,_0x3503dd){_0x3503dd=_0x3503dd||0x1f4;return function(_0x29a833){logger['error'](_0x29a833[_0x5d3e('0x29')]);if(_0x29a833[_0x5d3e('0x2a')]){delete _0x29a833['name'];}_0x574645['status'](_0x3503dd)['send'](_0x29a833);};}exports[_0x5d3e('0x2b')]=function(_0xbcb77f,_0xcdf738){var _0x5d0234={},_0x2204bc={},_0x1fe7a1={'count':0x0,'rows':[]};var _0x3d2d1a=_[_0x5d3e('0x2c')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x419c4a){return{'name':_0x419c4a[_0x5d3e('0x2d')],'type':_0x419c4a[_0x5d3e('0x2e')][_0x5d3e('0x2f')]};});_0x2204bc['model']=_[_0x5d3e('0x2c')](_0x3d2d1a,_0x5d3e('0x2a'));_0x2204bc[_0x5d3e('0x30')]=_[_0x5d3e('0x31')](_0xbcb77f[_0x5d3e('0x30')]);_0x2204bc[_0x5d3e('0x32')]=_[_0x5d3e('0x33')](_0x2204bc[_0x5d3e('0x34')],_0x2204bc[_0x5d3e('0x30')]);_0x5d0234[_0x5d3e('0x35')]=_[_0x5d3e('0x33')](_0x2204bc[_0x5d3e('0x34')],qs[_0x5d3e('0x36')](_0xbcb77f[_0x5d3e('0x30')]['fields']));_0x5d0234[_0x5d3e('0x35')]=_0x5d0234['attributes'][_0x5d3e('0x37')]?_0x5d0234[_0x5d3e('0x35')]:_0x2204bc[_0x5d3e('0x34')];if(!_0xbcb77f[_0x5d3e('0x30')][_0x5d3e('0x38')](_0x5d3e('0x39'))){_0x5d0234[_0x5d3e('0x1e')]=qs[_0x5d3e('0x1e')](_0xbcb77f[_0x5d3e('0x30')][_0x5d3e('0x1e')]);_0x5d0234[_0x5d3e('0x21')]=qs[_0x5d3e('0x21')](_0xbcb77f['query'][_0x5d3e('0x21')]);}_0x5d0234['order']=qs[_0x5d3e('0x3a')](_0xbcb77f['query']['sort']);_0x5d0234[_0x5d3e('0x3b')]=qs[_0x5d3e('0x32')](_[_0x5d3e('0x3c')](_0xbcb77f[_0x5d3e('0x30')],_0x2204bc[_0x5d3e('0x32')]),_0x3d2d1a);if(_0xbcb77f[_0x5d3e('0x30')][_0x5d3e('0x3d')]){_0x5d0234['where']=_['merge'](_0x5d0234[_0x5d3e('0x3b')],{'$or':_['map'](_0x3d2d1a,function(_0x32e7b7){if(_0x32e7b7['type']!=='VIRTUAL'){var _0x3af7ad={};_0x3af7ad[_0x32e7b7[_0x5d3e('0x2a')]]={'$like':'%'+_0xbcb77f[_0x5d3e('0x30')]['filter']+'%'};return _0x3af7ad;}})});}_0x5d0234=_[_0x5d3e('0x3e')]({},_0x5d0234,_0xbcb77f[_0x5d3e('0x3f')]);var _0xc61bd9={'where':_0x5d0234['where']};return db[_0x5d3e('0x40')][_0x5d3e('0x20')](_0xc61bd9)['then'](function(_0x485f1a){_0x1fe7a1[_0x5d3e('0x20')]=_0x485f1a;if(_0xbcb77f[_0x5d3e('0x30')][_0x5d3e('0x41')]){_0x5d0234[_0x5d3e('0x42')]=[{'all':!![]}];}return db[_0x5d3e('0x40')][_0x5d3e('0x43')](_0x5d0234);})[_0x5d3e('0x27')](function(_0x1c45e6){_0x1fe7a1[_0x5d3e('0x44')]=_0x1c45e6;return _0x1fe7a1;})[_0x5d3e('0x27')](respondWithFilteredResult(_0xcdf738,_0x5d0234))[_0x5d3e('0x45')](handleError(_0xcdf738,null));};exports[_0x5d3e('0x46')]=function(_0x21d7f6,_0x1325a2){var _0x14253c={'raw':!![],'where':{'id':_0x21d7f6['params']['id']}},_0x2d4b4c={};_0x2d4b4c[_0x5d3e('0x34')]=_['keys'](db[_0x5d3e('0x40')]['rawAttributes']);_0x2d4b4c['query']=_['keys'](_0x21d7f6['query']);_0x2d4b4c[_0x5d3e('0x32')]=_['intersection'](_0x2d4b4c['model'],_0x2d4b4c['query']);_0x14253c[_0x5d3e('0x35')]=_[_0x5d3e('0x33')](_0x2d4b4c[_0x5d3e('0x34')],qs[_0x5d3e('0x36')](_0x21d7f6[_0x5d3e('0x30')][_0x5d3e('0x36')]));_0x14253c[_0x5d3e('0x35')]=_0x14253c[_0x5d3e('0x35')][_0x5d3e('0x37')]?_0x14253c[_0x5d3e('0x35')]:_0x2d4b4c[_0x5d3e('0x34')];if(_0x21d7f6['query']['includeAll']){_0x14253c['include']=[{'all':!![]}];}_0x14253c=_[_0x5d3e('0x3e')]({},_0x14253c,_0x21d7f6['options']);return db[_0x5d3e('0x40')][_0x5d3e('0x47')](_0x14253c)['then'](handleEntityNotFound(_0x1325a2,null))[_0x5d3e('0x27')](respondWithResult(_0x1325a2,null))['catch'](handleError(_0x1325a2,null));};exports[_0x5d3e('0x48')]=function(_0x1a02a5,_0x36b630){return db[_0x5d3e('0x40')][_0x5d3e('0x48')](_0x1a02a5['body'],{})[_0x5d3e('0x27')](respondWithResult(_0x36b630,0xc9))[_0x5d3e('0x45')](handleError(_0x36b630,null));};exports[_0x5d3e('0x26')]=function(_0x589eef,_0x40824c){if(_0x589eef[_0x5d3e('0x49')]['id']){delete _0x589eef[_0x5d3e('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x589eef['params']['id']}})[_0x5d3e('0x27')](handleEntityNotFound(_0x40824c,null))[_0x5d3e('0x27')](saveUpdates(_0x589eef['body'],null))['then'](respondWithResult(_0x40824c,null))[_0x5d3e('0x45')](handleError(_0x40824c,null));};exports[_0x5d3e('0x28')]=function(_0x54dc51,_0x3ed141){return db[_0x5d3e('0x40')][_0x5d3e('0x47')]({'where':{'id':_0x54dc51[_0x5d3e('0x4a')]['id']}})[_0x5d3e('0x27')](handleEntityNotFound(_0x3ed141,null))['then'](removeEntity(_0x3ed141,null))[_0x5d3e('0x45')](handleError(_0x3ed141,null));};exports['describe']=function(_0x484d05,_0x28d394){return db[_0x5d3e('0x40')]['describe']()[_0x5d3e('0x27')](respondWithResult(_0x28d394,null))['catch'](handleError(_0x28d394,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9128610..b670ee7 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 _0x25b1=['./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b9c34,_0x1b7dbd){var _0x126845=function(_0x345526){while(--_0x345526){_0x2b9c34['push'](_0x2b9c34['shift']());}};_0x126845(++_0x1b7dbd);}(_0x25b1,0x1b7));var _0x125b=function(_0xc3aae7,_0x3bfa91){_0xc3aae7=_0xc3aae7-0x0;var _0x1f365a=_0x25b1[_0xc3aae7];return _0x1f365a;};'use strict';var _=require(_0x125b('0x0'));var util=require(_0x125b('0x1'));var logger=require(_0x125b('0x2'))('api');var moment=require(_0x125b('0x3'));var BPromise=require(_0x125b('0x4'));var rp=require(_0x125b('0x5'));var fs=require('fs');var path=require(_0x125b('0x6'));var rimraf=require(_0x125b('0x7'));var config=require(_0x125b('0x8'));var attributes=require(_0x125b('0x9'));module['exports']=function(_0x306f47,_0x5906ce){return _0x306f47[_0x125b('0xa')](_0x125b('0xb'),attributes,{'tableName':_0x125b('0xc'),'paranoid':![],'indexes':[{'name':_0x125b('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6531=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x6531,0xdf));var _0x1653=function(_0x28b3d7,_0x52417b){_0x28b3d7=_0x28b3d7-0x0;var _0x482169=_0x6531[_0x28b3d7];return _0x482169;};'use strict';var _=require(_0x1653('0x0'));var util=require(_0x1653('0x1'));var logger=require(_0x1653('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1653('0x3'));var rp=require(_0x1653('0x4'));var fs=require('fs');var path=require(_0x1653('0x5'));var rimraf=require(_0x1653('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x3b9d11,_0x37bde1){return _0x3b9d11[_0x1653('0x7')](_0x1653('0x8'),attributes,{'tableName':_0x1653('0x9'),'paranoid':![],'indexes':[{'name':_0x1653('0xa'),'fields':[_0x1653('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8362267..adb1b0e 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 _0xf5a7=['rpc','../../config/environment','jayson/promise','http','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x370aa4,_0x271e2e){var _0x160617=function(_0x976cf){while(--_0x976cf){_0x370aa4['push'](_0x370aa4['shift']());}};_0x160617(++_0x271e2e);}(_0xf5a7,0x133));var _0x7f5a=function(_0x624bb7,_0x547628){_0x624bb7=_0x624bb7-0x0;var _0x205730=_0xf5a7[_0x624bb7];return _0x205730;};'use strict';var _=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var moment=require('moment');var BPromise=require(_0x7f5a('0x2'));var rs=require(_0x7f5a('0x3'));var fs=require('fs');var Redis=require(_0x7f5a('0x4'));var db=require(_0x7f5a('0x5'))['db'];var utils=require(_0x7f5a('0x6'));var logger=require(_0x7f5a('0x7'))(_0x7f5a('0x8'));var config=require(_0x7f5a('0x9'));var jayson=require(_0x7f5a('0xa'));var client=jayson['client'][_0x7f5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be845,_0x585e25,_0x19c400){return new BPromise(function(_0x46d6d5,_0x2a21fe){return client['request'](_0x2be845,_0x19c400)['then'](function(_0x50e511){logger[_0x7f5a('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x585e25,'request\x20sent');logger[_0x7f5a('0xd')](_0x7f5a('0xe'),_0x585e25,'request\x20sent',JSON['stringify'](_0x50e511));if(_0x50e511[_0x7f5a('0xf')]){if(_0x50e511[_0x7f5a('0xf')][_0x7f5a('0x10')]===0x1f4){logger[_0x7f5a('0xf')](_0x7f5a('0x11'),_0x585e25,_0x50e511[_0x7f5a('0xf')]['message']);return _0x2a21fe(_0x50e511[_0x7f5a('0xf')][_0x7f5a('0x12')]);}logger[_0x7f5a('0xf')](_0x7f5a('0x11'),_0x585e25,_0x50e511[_0x7f5a('0xf')][_0x7f5a('0x12')]);return _0x46d6d5(_0x50e511[_0x7f5a('0xf')][_0x7f5a('0x12')]);}else{logger['info'](_0x7f5a('0x11'),_0x585e25,_0x7f5a('0x13'));_0x46d6d5(_0x50e511['result'][_0x7f5a('0x12')]);}})[_0x7f5a('0x14')](function(_0x2bb541){logger[_0x7f5a('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x585e25,_0x2bb541);_0x2a21fe(_0x2bb541);});});} \ No newline at end of file +var _0x9879=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x257794,_0x17c21d){var _0x440d82=function(_0x5b24bc){while(--_0x5b24bc){_0x257794['push'](_0x257794['shift']());}};_0x440d82(++_0x17c21d);}(_0x9879,0x98));var _0x9987=function(_0x428ad5,_0x19306f){_0x428ad5=_0x428ad5-0x0;var _0x127161=_0x9879[_0x428ad5];return _0x127161;};'use strict';var _=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var moment=require(_0x9987('0x2'));var BPromise=require('bluebird');var rs=require(_0x9987('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9987('0x4'))['db'];var utils=require(_0x9987('0x5'));var logger=require(_0x9987('0x6'))(_0x9987('0x7'));var config=require(_0x9987('0x8'));var jayson=require(_0x9987('0x9'));var client=jayson[_0x9987('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34d2fd,_0x5afd59,_0x6cb988){return new BPromise(function(_0x3e5538,_0x364d75){return client[_0x9987('0xb')](_0x34d2fd,_0x6cb988)[_0x9987('0xc')](function(_0x450f82){logger[_0x9987('0xd')](_0x9987('0xe'),_0x5afd59,_0x9987('0xf'));logger[_0x9987('0x10')](_0x9987('0x11'),_0x5afd59,_0x9987('0xf'),JSON[_0x9987('0x12')](_0x450f82));if(_0x450f82[_0x9987('0x13')]){if(_0x450f82[_0x9987('0x13')][_0x9987('0x14')]===0x1f4){logger[_0x9987('0x13')](_0x9987('0xe'),_0x5afd59,_0x450f82['error'][_0x9987('0x15')]);return _0x364d75(_0x450f82[_0x9987('0x13')][_0x9987('0x15')]);}logger[_0x9987('0x13')](_0x9987('0xe'),_0x5afd59,_0x450f82['error'][_0x9987('0x15')]);return _0x3e5538(_0x450f82['error'][_0x9987('0x15')]);}else{logger[_0x9987('0xd')](_0x9987('0xe'),_0x5afd59,_0x9987('0xf'));_0x3e5538(_0x450f82[_0x9987('0x16')][_0x9987('0x15')]);}})[_0x9987('0x17')](function(_0x3eefd0){logger[_0x9987('0x13')](_0x9987('0xe'),_0x5afd59,_0x3eefd0);_0x364d75(_0x3eefd0);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 88862fd..dabfe95 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 _0x81bb=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','put','update','exports','multer','util'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x81bb,0x178));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb81b('0x0'));var util=require(_0xb81b('0x1'));var path=require(_0xb81b('0x2'));var timeout=require(_0xb81b('0x3'));var express=require(_0xb81b('0x4'));var router=express[_0xb81b('0x5')]();var fs_extra=require(_0xb81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb81b('0x7'));var config=require(_0xb81b('0x8'));var controller=require(_0xb81b('0x9'));router[_0xb81b('0xa')]('/',auth[_0xb81b('0xb')](),controller[_0xb81b('0xc')]);router[_0xb81b('0xa')](_0xb81b('0xd'),auth[_0xb81b('0xb')](),controller[_0xb81b('0xe')]);router['post']('/',auth[_0xb81b('0xb')](),controller['create']);router[_0xb81b('0xf')](_0xb81b('0xd'),auth[_0xb81b('0xb')](),controller[_0xb81b('0x10')]);router['delete']('/:id',auth[_0xb81b('0xb')](),controller['destroy']);module[_0xb81b('0x11')]=router; \ No newline at end of file +var _0x4f14=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','show','create','put','/:id','util','connect-timeout','express'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4f14,0xb3));var _0x44f1=function(_0x7a0d27,_0x166eeb){_0x7a0d27=_0x7a0d27-0x0;var _0x5ee426=_0x4f14[_0x7a0d27];return _0x5ee426;};'use strict';var multer=require('multer');var util=require(_0x44f1('0x0'));var path=require('path');var timeout=require(_0x44f1('0x1'));var express=require(_0x44f1('0x2'));var router=express[_0x44f1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x44f1('0x4'));var interaction=require(_0x44f1('0x5'));var config=require(_0x44f1('0x6'));var controller=require(_0x44f1('0x7'));router['get']('/',auth[_0x44f1('0x8')](),controller['index']);router[_0x44f1('0x9')]('/:id',auth[_0x44f1('0x8')](),controller[_0x44f1('0xa')]);router['post']('/',auth[_0x44f1('0x8')](),controller[_0x44f1('0xb')]);router[_0x44f1('0xc')]('/:id',auth[_0x44f1('0x8')](),controller['update']);router['delete'](_0x44f1('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 089e994..d1f2343 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 _0xb6e0=['sequelize','exports','STRING'];(function(_0x13095a,_0x45f967){var _0x398688=function(_0x570bbb){while(--_0x570bbb){_0x13095a['push'](_0x13095a['shift']());}};_0x398688(++_0x45f967);}(_0xb6e0,0x105));var _0x0b6e=function(_0x1d9202,_0x51a545){_0x1d9202=_0x1d9202-0x0;var _0x1b8af2=_0xb6e0[_0x1d9202];return _0x1b8af2;};'use strict';var Sequelize=require(_0x0b6e('0x0'));module[_0x0b6e('0x1')]={'name':{'type':Sequelize[_0x0b6e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0b6e('0x2')]}}; \ No newline at end of file +var _0x60c5=['name','STRING','sequelize','exports'];(function(_0x44ea17,_0x422059){var _0x1d8af1=function(_0x159a75){while(--_0x159a75){_0x44ea17['push'](_0x44ea17['shift']());}};_0x1d8af1(++_0x422059);}(_0x60c5,0x1e6));var _0x560c=function(_0x2d85bf,_0x5247a8){_0x2d85bf=_0x2d85bf-0x0;var _0x44ec55=_0x60c5[_0x2d85bf];return _0x44ec55;};'use strict';var Sequelize=require(_0x560c('0x0'));module[_0x560c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x560c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x560c('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2d4f6c6..f44c146 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 _0xdfc1=['index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','reject','save','then','destroy','get','Pauses','UserProfileResource','end','stack','name','send'];(function(_0x1dc2d8,_0x39ce50){var _0x4b7107=function(_0x226dee){while(--_0x226dee){_0x1dc2d8['push'](_0x1dc2d8['shift']());}};_0x4b7107(++_0x39ce50);}(_0xdfc1,0x79));var _0x1dfc=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0xdfc1[_0x5eb1a8];return _0x14c11c;};'use strict';var emlformat=require(_0x1dfc('0x0'));var rimraf=require(_0x1dfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1dfc('0x2'));var moment=require(_0x1dfc('0x3'));var BPromise=require(_0x1dfc('0x4'));var Mustache=require(_0x1dfc('0x5'));var util=require(_0x1dfc('0x6'));var path=require(_0x1dfc('0x7'));var sox=require(_0x1dfc('0x8'));var csv=require('to-csv');var ejs=require(_0x1dfc('0x9'));var fs=require('fs');var fs_extra=require(_0x1dfc('0xa'));var _=require(_0x1dfc('0xb'));var squel=require(_0x1dfc('0xc'));var crypto=require('crypto');var jsforce=require(_0x1dfc('0xd'));var deskjs=require(_0x1dfc('0xe'));var toCsv=require(_0x1dfc('0xf'));var querystring=require(_0x1dfc('0x10'));var Papa=require(_0x1dfc('0x11'));var Redis=require(_0x1dfc('0x12'));var authService=require(_0x1dfc('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dfc('0x14'));var logger=require(_0x1dfc('0x15'))(_0x1dfc('0x16'));var utils=require(_0x1dfc('0x17'));var config=require(_0x1dfc('0x18'));var licenseUtil=require(_0x1dfc('0x19'));var db=require(_0x1dfc('0x1a'))['db'];function respondWithStatusCode(_0x2a85b2,_0x1d825c){_0x1d825c=_0x1d825c||0xcc;return function(_0x5083fa){if(_0x5083fa){return _0x2a85b2[_0x1dfc('0x1b')](_0x1d825c);}return _0x2a85b2['status'](_0x1d825c)['end']();};}function respondWithResult(_0x42a779,_0x57b19a){_0x57b19a=_0x57b19a||0xc8;return function(_0x196145){if(_0x196145){return _0x42a779[_0x1dfc('0x1c')](_0x57b19a)[_0x1dfc('0x1d')](_0x196145);}};}function respondWithFilteredResult(_0x2e5433,_0xc709f){return function(_0x5a581d){if(_0x5a581d){var _0x5723ae=typeof _0xc709f['offset']===_0x1dfc('0x1e')&&typeof _0xc709f[_0x1dfc('0x1f')]===_0x1dfc('0x1e');var _0x57b4fc=_0x5a581d['count'];var _0x59001d=_0x5723ae?0x0:_0xc709f['offset'];var _0x4bcb10=_0x5723ae?_0x5a581d[_0x1dfc('0x20')]:_0xc709f['offset']+_0xc709f[_0x1dfc('0x1f')];var _0x147383;if(_0x4bcb10>=_0x57b4fc){_0x4bcb10=_0x57b4fc;_0x147383=0xc8;}else{_0x147383=0xce;}_0x2e5433['status'](_0x147383);return _0x2e5433[_0x1dfc('0x21')]('Content-Range',_0x59001d+'-'+_0x4bcb10+'/'+_0x57b4fc)[_0x1dfc('0x1d')](_0x5a581d);}return null;};}function patchUpdates(_0x34a8e3){return function(_0x8340a3){try{jsonpatch['apply'](_0x8340a3,_0x34a8e3,!![]);}catch(_0x4a32c6){return BPromise[_0x1dfc('0x22')](_0x4a32c6);}return _0x8340a3[_0x1dfc('0x23')]();};}function saveUpdates(_0x17fe12,_0x188d89){return function(_0x3c0a9b){if(_0x3c0a9b){return _0x3c0a9b['update'](_0x17fe12)[_0x1dfc('0x24')](function(_0x242cbe){return _0x242cbe;});}return null;};}function removeEntity(_0x2136e9,_0x29a035){return function(_0x104aab){if(_0x104aab){return _0x104aab[_0x1dfc('0x25')]()[_0x1dfc('0x24')](function(){var _0x450609=_0x104aab[_0x1dfc('0x26')]({'plain':!![]});var _0x5cfe8b=_0x1dfc('0x27');return db[_0x1dfc('0x28')][_0x1dfc('0x25')]({'where':{'type':_0x5cfe8b,'resourceId':_0x450609['id']}})['then'](function(){return _0x104aab;});})[_0x1dfc('0x24')](function(){_0x2136e9['status'](0xcc)[_0x1dfc('0x29')]();});}};}function handleEntityNotFound(_0x3b43e8,_0x2f7068){return function(_0x536b81){if(!_0x536b81){_0x3b43e8['sendStatus'](0x194);}return _0x536b81;};}function handleError(_0x3e8d63,_0x4c91de){_0x4c91de=_0x4c91de||0x1f4;return function(_0x3dc383){logger['error'](_0x3dc383[_0x1dfc('0x2a')]);if(_0x3dc383[_0x1dfc('0x2b')]){delete _0x3dc383[_0x1dfc('0x2b')];}_0x3e8d63['status'](_0x4c91de)[_0x1dfc('0x2c')](_0x3dc383);};}exports[_0x1dfc('0x2d')]=function(_0x1f1da1,_0x2987ca){var _0x164d0d={},_0xa26f5a={},_0x2cad4a={'count':0x0,'rows':[]};var _0x472512=_[_0x1dfc('0x2e')](db[_0x1dfc('0x2f')][_0x1dfc('0x30')],function(_0x44141f){return{'name':_0x44141f[_0x1dfc('0x31')],'type':_0x44141f[_0x1dfc('0x32')][_0x1dfc('0x33')]};});_0xa26f5a[_0x1dfc('0x34')]=_['map'](_0x472512,_0x1dfc('0x2b'));_0xa26f5a[_0x1dfc('0x35')]=_[_0x1dfc('0x36')](_0x1f1da1['query']);_0xa26f5a[_0x1dfc('0x37')]=_[_0x1dfc('0x38')](_0xa26f5a[_0x1dfc('0x34')],_0xa26f5a[_0x1dfc('0x35')]);_0x164d0d['attributes']=_[_0x1dfc('0x38')](_0xa26f5a['model'],qs[_0x1dfc('0x39')](_0x1f1da1[_0x1dfc('0x35')][_0x1dfc('0x39')]));_0x164d0d[_0x1dfc('0x3a')]=_0x164d0d[_0x1dfc('0x3a')][_0x1dfc('0x3b')]?_0x164d0d[_0x1dfc('0x3a')]:_0xa26f5a['model'];if(!_0x1f1da1[_0x1dfc('0x35')]['hasOwnProperty'](_0x1dfc('0x3c'))){_0x164d0d[_0x1dfc('0x1f')]=qs[_0x1dfc('0x1f')](_0x1f1da1[_0x1dfc('0x35')]['limit']);_0x164d0d['offset']=qs['offset'](_0x1f1da1[_0x1dfc('0x35')]['offset']);}_0x164d0d['order']=qs[_0x1dfc('0x3d')](_0x1f1da1[_0x1dfc('0x35')][_0x1dfc('0x3d')]);_0x164d0d[_0x1dfc('0x3e')]=qs[_0x1dfc('0x37')](_[_0x1dfc('0x3f')](_0x1f1da1['query'],_0xa26f5a[_0x1dfc('0x37')]),_0x472512);if(_0x1f1da1[_0x1dfc('0x35')][_0x1dfc('0x40')]){_0x164d0d[_0x1dfc('0x3e')]=_['merge'](_0x164d0d[_0x1dfc('0x3e')],{'$or':_[_0x1dfc('0x2e')](_0x472512,function(_0x18dccc){if(_0x18dccc['type']!==_0x1dfc('0x41')){var _0x34c13c={};_0x34c13c[_0x18dccc['name']]={'$like':'%'+_0x1f1da1[_0x1dfc('0x35')][_0x1dfc('0x40')]+'%'};return _0x34c13c;}})});}_0x164d0d=_[_0x1dfc('0x42')]({},_0x164d0d,_0x1f1da1['options']);var _0x198c74={'where':_0x164d0d[_0x1dfc('0x3e')]};return db[_0x1dfc('0x2f')][_0x1dfc('0x20')](_0x198c74)[_0x1dfc('0x24')](function(_0x31bb85){_0x2cad4a[_0x1dfc('0x20')]=_0x31bb85;if(_0x1f1da1[_0x1dfc('0x35')]['includeAll']){_0x164d0d[_0x1dfc('0x43')]=[{'all':!![]}];}return db['Pause'][_0x1dfc('0x44')](_0x164d0d);})['then'](function(_0x484860){_0x2cad4a['rows']=_0x484860;return _0x2cad4a;})[_0x1dfc('0x24')](respondWithFilteredResult(_0x2987ca,_0x164d0d))[_0x1dfc('0x45')](handleError(_0x2987ca,null));};exports[_0x1dfc('0x46')]=function(_0x19f999,_0x400a5d){var _0x67e76={'raw':!![],'where':{'id':_0x19f999[_0x1dfc('0x47')]['id']}},_0x48acb6={};_0x48acb6['model']=_[_0x1dfc('0x36')](db[_0x1dfc('0x2f')][_0x1dfc('0x30')]);_0x48acb6[_0x1dfc('0x35')]=_[_0x1dfc('0x36')](_0x19f999['query']);_0x48acb6[_0x1dfc('0x37')]=_[_0x1dfc('0x38')](_0x48acb6[_0x1dfc('0x34')],_0x48acb6['query']);_0x67e76['attributes']=_[_0x1dfc('0x38')](_0x48acb6[_0x1dfc('0x34')],qs[_0x1dfc('0x39')](_0x19f999['query'][_0x1dfc('0x39')]));_0x67e76[_0x1dfc('0x3a')]=_0x67e76[_0x1dfc('0x3a')]['length']?_0x67e76['attributes']:_0x48acb6['model'];if(_0x19f999[_0x1dfc('0x35')][_0x1dfc('0x48')]){_0x67e76[_0x1dfc('0x43')]=[{'all':!![]}];}_0x67e76=_[_0x1dfc('0x42')]({},_0x67e76,_0x19f999[_0x1dfc('0x49')]);return db['Pause'][_0x1dfc('0x4a')](_0x67e76)[_0x1dfc('0x24')](handleEntityNotFound(_0x400a5d,null))[_0x1dfc('0x24')](respondWithResult(_0x400a5d,null))[_0x1dfc('0x45')](handleError(_0x400a5d,null));};exports[_0x1dfc('0x4b')]=function(_0x5a39d7,_0x794044){return db[_0x1dfc('0x2f')][_0x1dfc('0x4b')](_0x5a39d7[_0x1dfc('0x4c')],{})[_0x1dfc('0x24')](function(_0x2e0bd7){var _0x37e3d7=_0x5a39d7[_0x1dfc('0x4d')]['get']({'plain':!![]});if(!_0x37e3d7)throw new Error(_0x1dfc('0x4e'));if(_0x37e3d7['role']==='user'){var _0x1bbed9=_0x2e0bd7[_0x1dfc('0x26')]({'plain':!![]});var _0x57903c='Pauses';return db[_0x1dfc('0x4f')][_0x1dfc('0x4a')]({'where':{'name':_0x57903c,'userProfileId':_0x37e3d7[_0x1dfc('0x50')]},'raw':!![]})['then'](function(_0x453f6b){if(_0x453f6b&&_0x453f6b[_0x1dfc('0x51')]===0x0){return db[_0x1dfc('0x28')]['create']({'name':_0x1bbed9[_0x1dfc('0x2b')],'resourceId':_0x1bbed9['id'],'type':_0x453f6b[_0x1dfc('0x2b')],'sectionId':_0x453f6b['id']},{})['then'](function(){return _0x2e0bd7;});}else{return _0x2e0bd7;}})[_0x1dfc('0x45')](function(_0x223f98){logger['error'](_0x1dfc('0x52'),_0x223f98);throw _0x223f98;});}return _0x2e0bd7;})['then'](respondWithResult(_0x794044,0xc9))[_0x1dfc('0x45')](handleError(_0x794044,null));};exports['update']=function(_0x235882,_0xc0fc6f){if(_0x235882[_0x1dfc('0x4c')]['id']){delete _0x235882[_0x1dfc('0x4c')]['id'];}return db[_0x1dfc('0x2f')]['find']({'where':{'id':_0x235882[_0x1dfc('0x47')]['id']}})[_0x1dfc('0x24')](handleEntityNotFound(_0xc0fc6f,null))[_0x1dfc('0x24')](saveUpdates(_0x235882['body'],null))[_0x1dfc('0x24')](respondWithResult(_0xc0fc6f,null))[_0x1dfc('0x45')](handleError(_0xc0fc6f,null));};exports[_0x1dfc('0x25')]=function(_0x5afa8b,_0x353aac){return db['Pause'][_0x1dfc('0x4a')]({'where':{'id':_0x5afa8b[_0x1dfc('0x47')]['id']}})[_0x1dfc('0x24')](handleEntityNotFound(_0x353aac,null))[_0x1dfc('0x24')](removeEntity(_0x353aac,null))['catch'](handleError(_0x353aac,null));}; \ No newline at end of file +var _0x1ac3=['map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','stack','name','send','Pause','rawAttributes','fieldName','type','key'];(function(_0x325247,_0x59554d){var _0x2aec52=function(_0x2426d6){while(--_0x2426d6){_0x325247['push'](_0x325247['shift']());}};_0x2aec52(++_0x59554d);}(_0x1ac3,0x77));var _0x31ac=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x1ac3[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x31ac('0x0'));var rimraf=require(_0x31ac('0x1'));var zipdir=require(_0x31ac('0x2'));var jsonpatch=require(_0x31ac('0x3'));var rp=require('request-promise');var moment=require(_0x31ac('0x4'));var BPromise=require(_0x31ac('0x5'));var Mustache=require(_0x31ac('0x6'));var util=require(_0x31ac('0x7'));var path=require(_0x31ac('0x8'));var sox=require(_0x31ac('0x9'));var csv=require(_0x31ac('0xa'));var ejs=require(_0x31ac('0xb'));var fs=require('fs');var fs_extra=require(_0x31ac('0xc'));var _=require(_0x31ac('0xd'));var squel=require(_0x31ac('0xe'));var crypto=require('crypto');var jsforce=require(_0x31ac('0xf'));var deskjs=require(_0x31ac('0x10'));var toCsv=require(_0x31ac('0xa'));var querystring=require(_0x31ac('0x11'));var Papa=require('papaparse');var Redis=require(_0x31ac('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x31ac('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31ac('0x14'))(_0x31ac('0x15'));var utils=require(_0x31ac('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x31ac('0x17'));var db=require(_0x31ac('0x18'))['db'];function respondWithStatusCode(_0x5813e3,_0x572337){_0x572337=_0x572337||0xcc;return function(_0x4c46bb){if(_0x4c46bb){return _0x5813e3[_0x31ac('0x19')](_0x572337);}return _0x5813e3[_0x31ac('0x1a')](_0x572337)['end']();};}function respondWithResult(_0x2059db,_0x4effa5){_0x4effa5=_0x4effa5||0xc8;return function(_0x3da521){if(_0x3da521){return _0x2059db[_0x31ac('0x1a')](_0x4effa5)['json'](_0x3da521);}};}function respondWithFilteredResult(_0x34af2d,_0x278672){return function(_0x3411de){if(_0x3411de){var _0x3b47d7=typeof _0x278672[_0x31ac('0x1b')]===_0x31ac('0x1c')&&typeof _0x278672['limit']===_0x31ac('0x1c');var _0x22a032=_0x3411de['count'];var _0x101656=_0x3b47d7?0x0:_0x278672[_0x31ac('0x1b')];var _0x1f36bd=_0x3b47d7?_0x3411de[_0x31ac('0x1d')]:_0x278672[_0x31ac('0x1b')]+_0x278672['limit'];var _0x175270;if(_0x1f36bd>=_0x22a032){_0x1f36bd=_0x22a032;_0x175270=0xc8;}else{_0x175270=0xce;}_0x34af2d['status'](_0x175270);return _0x34af2d[_0x31ac('0x1e')](_0x31ac('0x1f'),_0x101656+'-'+_0x1f36bd+'/'+_0x22a032)[_0x31ac('0x20')](_0x3411de);}return null;};}function patchUpdates(_0x247e6c){return function(_0x4c6531){try{jsonpatch[_0x31ac('0x21')](_0x4c6531,_0x247e6c,!![]);}catch(_0x588d6b){return BPromise[_0x31ac('0x22')](_0x588d6b);}return _0x4c6531[_0x31ac('0x23')]();};}function saveUpdates(_0x331529,_0x252228){return function(_0x40124d){if(_0x40124d){return _0x40124d[_0x31ac('0x24')](_0x331529)[_0x31ac('0x25')](function(_0xe9a2af){return _0xe9a2af;});}return null;};}function removeEntity(_0xfdfd8b,_0x4d7eae){return function(_0x3b6bac){if(_0x3b6bac){return _0x3b6bac[_0x31ac('0x26')]()[_0x31ac('0x25')](function(){var _0x4c5618=_0x3b6bac[_0x31ac('0x27')]({'plain':!![]});var _0x23afd3=_0x31ac('0x28');return db['UserProfileResource'][_0x31ac('0x26')]({'where':{'type':_0x23afd3,'resourceId':_0x4c5618['id']}})[_0x31ac('0x25')](function(){return _0x3b6bac;});})[_0x31ac('0x25')](function(){_0xfdfd8b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35d66e,_0x6ed378){return function(_0x1dba4a){if(!_0x1dba4a){_0x35d66e[_0x31ac('0x19')](0x194);}return _0x1dba4a;};}function handleError(_0x1866cc,_0x2d3638){_0x2d3638=_0x2d3638||0x1f4;return function(_0x3c7c7d){logger['error'](_0x3c7c7d[_0x31ac('0x29')]);if(_0x3c7c7d[_0x31ac('0x2a')]){delete _0x3c7c7d[_0x31ac('0x2a')];}_0x1866cc[_0x31ac('0x1a')](_0x2d3638)[_0x31ac('0x2b')](_0x3c7c7d);};}exports['index']=function(_0x510e9b,_0xbe899e){var _0x397b24={},_0x362ce7={},_0x305358={'count':0x0,'rows':[]};var _0x3cdcfb=_['map'](db[_0x31ac('0x2c')][_0x31ac('0x2d')],function(_0x1af539){return{'name':_0x1af539[_0x31ac('0x2e')],'type':_0x1af539[_0x31ac('0x2f')][_0x31ac('0x30')]};});_0x362ce7['model']=_[_0x31ac('0x31')](_0x3cdcfb,_0x31ac('0x2a'));_0x362ce7[_0x31ac('0x32')]=_[_0x31ac('0x33')](_0x510e9b[_0x31ac('0x32')]);_0x362ce7[_0x31ac('0x34')]=_[_0x31ac('0x35')](_0x362ce7[_0x31ac('0x36')],_0x362ce7['query']);_0x397b24['attributes']=_[_0x31ac('0x35')](_0x362ce7[_0x31ac('0x36')],qs[_0x31ac('0x37')](_0x510e9b['query'][_0x31ac('0x37')]));_0x397b24['attributes']=_0x397b24[_0x31ac('0x38')][_0x31ac('0x39')]?_0x397b24['attributes']:_0x362ce7[_0x31ac('0x36')];if(!_0x510e9b[_0x31ac('0x32')][_0x31ac('0x3a')](_0x31ac('0x3b'))){_0x397b24[_0x31ac('0x3c')]=qs[_0x31ac('0x3c')](_0x510e9b[_0x31ac('0x32')][_0x31ac('0x3c')]);_0x397b24[_0x31ac('0x1b')]=qs[_0x31ac('0x1b')](_0x510e9b[_0x31ac('0x32')]['offset']);}_0x397b24[_0x31ac('0x3d')]=qs['sort'](_0x510e9b[_0x31ac('0x32')]['sort']);_0x397b24['where']=qs[_0x31ac('0x34')](_[_0x31ac('0x3e')](_0x510e9b[_0x31ac('0x32')],_0x362ce7[_0x31ac('0x34')]),_0x3cdcfb);if(_0x510e9b['query'][_0x31ac('0x3f')]){_0x397b24['where']=_[_0x31ac('0x40')](_0x397b24['where'],{'$or':_[_0x31ac('0x31')](_0x3cdcfb,function(_0x6473c7){if(_0x6473c7[_0x31ac('0x2f')]!==_0x31ac('0x41')){var _0x37cd56={};_0x37cd56[_0x6473c7[_0x31ac('0x2a')]]={'$like':'%'+_0x510e9b[_0x31ac('0x32')]['filter']+'%'};return _0x37cd56;}})});}_0x397b24=_[_0x31ac('0x40')]({},_0x397b24,_0x510e9b[_0x31ac('0x42')]);var _0x1bb82b={'where':_0x397b24[_0x31ac('0x43')]};return db[_0x31ac('0x2c')][_0x31ac('0x1d')](_0x1bb82b)[_0x31ac('0x25')](function(_0x226b3b){_0x305358[_0x31ac('0x1d')]=_0x226b3b;if(_0x510e9b['query'][_0x31ac('0x44')]){_0x397b24['include']=[{'all':!![]}];}return db[_0x31ac('0x2c')][_0x31ac('0x45')](_0x397b24);})[_0x31ac('0x25')](function(_0x58856f){_0x305358[_0x31ac('0x46')]=_0x58856f;return _0x305358;})[_0x31ac('0x25')](respondWithFilteredResult(_0xbe899e,_0x397b24))[_0x31ac('0x47')](handleError(_0xbe899e,null));};exports[_0x31ac('0x48')]=function(_0x5832dc,_0x31bfe6){var _0x36e264={'raw':!![],'where':{'id':_0x5832dc[_0x31ac('0x49')]['id']}},_0x3869a5={};_0x3869a5[_0x31ac('0x36')]=_['keys'](db[_0x31ac('0x2c')]['rawAttributes']);_0x3869a5['query']=_['keys'](_0x5832dc['query']);_0x3869a5[_0x31ac('0x34')]=_[_0x31ac('0x35')](_0x3869a5[_0x31ac('0x36')],_0x3869a5[_0x31ac('0x32')]);_0x36e264[_0x31ac('0x38')]=_[_0x31ac('0x35')](_0x3869a5[_0x31ac('0x36')],qs[_0x31ac('0x37')](_0x5832dc[_0x31ac('0x32')][_0x31ac('0x37')]));_0x36e264[_0x31ac('0x38')]=_0x36e264[_0x31ac('0x38')][_0x31ac('0x39')]?_0x36e264[_0x31ac('0x38')]:_0x3869a5[_0x31ac('0x36')];if(_0x5832dc[_0x31ac('0x32')]['includeAll']){_0x36e264[_0x31ac('0x4a')]=[{'all':!![]}];}_0x36e264=_[_0x31ac('0x40')]({},_0x36e264,_0x5832dc['options']);return db['Pause'][_0x31ac('0x4b')](_0x36e264)['then'](handleEntityNotFound(_0x31bfe6,null))[_0x31ac('0x25')](respondWithResult(_0x31bfe6,null))[_0x31ac('0x47')](handleError(_0x31bfe6,null));};exports[_0x31ac('0x4c')]=function(_0x3342f4,_0x257ca4){return db[_0x31ac('0x2c')][_0x31ac('0x4c')](_0x3342f4[_0x31ac('0x4d')],{})[_0x31ac('0x25')](function(_0x57f2a7){var _0x10b248=_0x3342f4[_0x31ac('0x4e')][_0x31ac('0x27')]({'plain':!![]});if(!_0x10b248)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10b248['role']===_0x31ac('0x4e')){var _0x72010e=_0x57f2a7[_0x31ac('0x27')]({'plain':!![]});var _0x30b8be=_0x31ac('0x28');return db[_0x31ac('0x4f')][_0x31ac('0x4b')]({'where':{'name':_0x30b8be,'userProfileId':_0x10b248[_0x31ac('0x50')]},'raw':!![]})[_0x31ac('0x25')](function(_0x510177){if(_0x510177&&_0x510177[_0x31ac('0x51')]===0x0){return db[_0x31ac('0x52')]['create']({'name':_0x72010e[_0x31ac('0x2a')],'resourceId':_0x72010e['id'],'type':_0x510177['name'],'sectionId':_0x510177['id']},{})[_0x31ac('0x25')](function(){return _0x57f2a7;});}else{return _0x57f2a7;}})['catch'](function(_0x2b5a2f){logger['error'](_0x31ac('0x53'),_0x2b5a2f);throw _0x2b5a2f;});}return _0x57f2a7;})['then'](respondWithResult(_0x257ca4,0xc9))[_0x31ac('0x47')](handleError(_0x257ca4,null));};exports[_0x31ac('0x24')]=function(_0x19c709,_0x551e99){if(_0x19c709[_0x31ac('0x4d')]['id']){delete _0x19c709[_0x31ac('0x4d')]['id'];}return db[_0x31ac('0x2c')][_0x31ac('0x4b')]({'where':{'id':_0x19c709[_0x31ac('0x49')]['id']}})[_0x31ac('0x25')](handleEntityNotFound(_0x551e99,null))[_0x31ac('0x25')](saveUpdates(_0x19c709[_0x31ac('0x4d')],null))[_0x31ac('0x25')](respondWithResult(_0x551e99,null))[_0x31ac('0x47')](handleError(_0x551e99,null));};exports[_0x31ac('0x26')]=function(_0x317bb9,_0x5bcb89){return db[_0x31ac('0x2c')][_0x31ac('0x4b')]({'where':{'id':_0x317bb9['params']['id']}})[_0x31ac('0x25')](handleEntityNotFound(_0x5bcb89,null))[_0x31ac('0x25')](removeEntity(_0x5bcb89,null))[_0x31ac('0x47')](handleError(_0x5bcb89,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a6c9cf9..5b5d7ae 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x27a7d3,_0x24ca5b){_0x27a7d3=_0x27a7d3-0x0;var _0x107ab8=_0x7fbe[_0x27a7d3];return _0x107ab8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5c56f01..f93a58b 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x159c12,_0x44591c){var _0x196cd3=function(_0x399a72){while(--_0x399a72){_0x159c12['push'](_0x159c12['shift']());}};_0x196cd3(++_0x44591c);}(_0x7a54,0x106));var _0x47a5=function(_0x112872,_0x27fe6e){_0x112872=_0x112872-0x0;var _0x55872a=_0x7a54[_0x112872];return _0x55872a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x33726a,_0x434bb0){var _0x10691f=function(_0x209a92){while(--_0x209a92){_0x33726a['push'](_0x33726a['shift']());}};_0x10691f(++_0x434bb0);}(_0x7a54,0x106));var _0x47a5=function(_0x44c2b9,_0x489ba0){_0x44c2b9=_0x44c2b9-0x0;var _0x4eb08a=_0x7a54[_0x44c2b9];return _0x4eb08a;};'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 a02e90b..352a8e4 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 _0x524a=['show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','basename','now','extname','post','single','file','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./plugin.controller','get','isAuthenticated','webhookGet'];(function(_0x2c7e5a,_0x3a15a4){var _0x360c7e=function(_0x22ca1c){while(--_0x22ca1c){_0x2c7e5a['push'](_0x2c7e5a['shift']());}};_0x360c7e(++_0x3a15a4);}(_0x524a,0xf5));var _0xa524=function(_0x3d46d6,_0x3b051d){_0x3d46d6=_0x3d46d6-0x0;var _0x1d10e0=_0x524a[_0x3d46d6];return _0x1d10e0;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require('express');var router=express[_0xa524('0x4')]();var fs_extra=require(_0xa524('0x5'));var auth=require(_0xa524('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa524('0x7'));router[_0xa524('0x8')]('/',auth[_0xa524('0x9')](),controller['index']);router[_0xa524('0x8')]('/webhook',controller[_0xa524('0xa')]);router[_0xa524('0x8')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0xb')]);router[_0xa524('0x8')](_0xa524('0xc'),auth[_0xa524('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xa524('0xd')]({'destination':function(_0x2ebea2,_0x59660a,_0x565fab){_0x565fab(null,path[_0xa524('0xe')](config[_0xa524('0xf')],_0xa524('0x10')));},'filename':function(_0x4936fa,_0x55117f,_0x14a0d6){_0x55117f['originalname']=_0x55117f[_0xa524('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x14a0d6(null,util[_0xa524('0x12')]('%s-%s%s',path[_0xa524('0x13')](_0x55117f[_0xa524('0x11')],path['extname'](_0x55117f[_0xa524('0x11')])),Date[_0xa524('0x14')](),path[_0xa524('0x15')](_0x55117f[_0xa524('0x11')])));}})});router[_0xa524('0x16')]('/',upload[_0xa524('0x17')](_0xa524('0x18')),controller['upload']);router[_0xa524('0x16')](_0xa524('0x19'),controller[_0xa524('0x1a')]);router[_0xa524('0x1b')](_0xa524('0x1c'),auth[_0xa524('0x9')](),controller[_0xa524('0x1d')]);router[_0xa524('0x1e')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0x1e')]);module[_0xa524('0x1f')]=router; \ No newline at end of file +var _0x5ad3=['webhookGet','/:id','show','download','root','server/files/plugins','replace','format','%s-%s%s','originalname','extname','now','post','single','file','/webhook','webhookPost','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index'];(function(_0x3bd1d6,_0x33d200){var _0x555857=function(_0x43e7a5){while(--_0x43e7a5){_0x3bd1d6['push'](_0x3bd1d6['shift']());}};_0x555857(++_0x33d200);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0x5ad3[_0x12fcbd];return _0x28ec2a;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/webhook',controller[_0x35ad('0xd')]);router[_0x35ad('0xa')](_0x35ad('0xe'),auth['isAuthenticated'](),controller[_0x35ad('0xf')]);router['get']('/:id/download',auth[_0x35ad('0xb')](),controller[_0x35ad('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34c2cb,_0x3a70a9,_0x4ad760){_0x4ad760(null,path['join'](config[_0x35ad('0x11')],_0x35ad('0x12')));},'filename':function(_0x4cf6bd,_0x3c4dd5,_0x33e2ec){_0x3c4dd5['originalname']=_0x3c4dd5['originalname'][_0x35ad('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e2ec(null,util[_0x35ad('0x14')](_0x35ad('0x15'),path['basename'](_0x3c4dd5[_0x35ad('0x16')],path[_0x35ad('0x17')](_0x3c4dd5['originalname'])),Date[_0x35ad('0x18')](),path['extname'](_0x3c4dd5['originalname'])));}})});router[_0x35ad('0x19')]('/',upload[_0x35ad('0x1a')](_0x35ad('0x1b')),controller['upload']);router[_0x35ad('0x19')](_0x35ad('0x1c'),controller[_0x35ad('0x1d')]);router[_0x35ad('0x1e')](_0x35ad('0xe'),auth[_0x35ad('0xb')](),controller['update']);router[_0x35ad('0x1f')](_0x35ad('0xe'),auth['isAuthenticated'](),controller['delete']);module[_0x35ad('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 687928b..7301f5f 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 _0x3920=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2ebe71,_0x582644){var _0x5296d5=function(_0x36aaf0){while(--_0x36aaf0){_0x2ebe71['push'](_0x2ebe71['shift']());}};_0x5296d5(++_0x582644);}(_0x3920,0x94));var _0x0392=function(_0x12960a,_0x1d4c54){_0x12960a=_0x12960a-0x0;var _0x2e96be=_0x3920[_0x12960a];return _0x2e96be;};'use strict';var Sequelize=require(_0x0392('0x0'));module[_0x0392('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0392('0x2')](_0x0392('0x3'),_0x0392('0x4'))},'description':{'type':Sequelize[_0x0392('0x5')]},'version':{'type':Sequelize[_0x0392('0x5')]},'path':{'type':Sequelize[_0x0392('0x6')],'comment':_0x0392('0x7')},'active':{'type':Sequelize[_0x0392('0x8')],'defaultValue':0x0,'comment':_0x0392('0x9')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x0392('0xa'),_0x0392('0xb'),'never'),'defaultValue':'always','comment':_0x0392('0xc')},'icon':{'type':Sequelize[_0x0392('0x6')]},'adminUrl':{'type':Sequelize[_0x0392('0x6')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x0392('0x6')]},'scriptPath':{'type':Sequelize[_0x0392('0x6')]}}; \ No newline at end of file +var _0x3a23=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT'];(function(_0x4a7148,_0x47772b){var _0x2c760f=function(_0x329524){while(--_0x329524){_0x4a7148['push'](_0x4a7148['shift']());}};_0x2c760f(++_0x47772b);}(_0x3a23,0x17a));var _0x33a2=function(_0x316b60,_0x26f868){_0x316b60=_0x316b60-0x0;var _0x5dbf7a=_0x3a23[_0x316b60];return _0x5dbf7a;};'use strict';var Sequelize=require(_0x33a2('0x0'));module[_0x33a2('0x1')]={'name':{'type':Sequelize[_0x33a2('0x2')]},'type':{'type':Sequelize[_0x33a2('0x3')](_0x33a2('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x33a2('0x5')]},'path':{'type':Sequelize[_0x33a2('0x2')],'comment':_0x33a2('0x6')},'active':{'type':Sequelize[_0x33a2('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x33a2('0x8'),'agentOnly',_0x33a2('0x9'),_0x33a2('0xa')),'defaultValue':_0x33a2('0x9'),'comment':_0x33a2('0xb')},'icon':{'type':Sequelize[_0x33a2('0x2')]},'adminUrl':{'type':Sequelize[_0x33a2('0x2')]},'agentUrl':{'type':Sequelize[_0x33a2('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x33a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 10b0c22..7a52849 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 _0x68d9=['Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','some','readFileSync','manifest.json','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','admin','agent','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','body','userProfileId','user','UserProfileSection','autoAssociation','create','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-type','set','statusCode','webhookPost','content-length','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','count','Content-Range','apply','save','update','then','destroy','get','Plugins','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','Plugin','includeAll','include','findAll','catch','show','params','options','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed'];(function(_0x1acddc,_0x323392){var _0x313b4c=function(_0x1a42c0){while(--_0x1a42c0){_0x1acddc['push'](_0x1acddc['shift']());}};_0x313b4c(++_0x323392);}(_0x68d9,0x178));var _0x968d=function(_0x30b907,_0x45efd7){_0x30b907=_0x30b907-0x0;var _0x31c62f=_0x68d9[_0x30b907];return _0x31c62f;};'use strict';var emlformat=require(_0x968d('0x0'));var rimraf=require(_0x968d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x968d('0x2'));var rp=require('request-promise');var moment=require(_0x968d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x968d('0x4'));var util=require('util');var path=require(_0x968d('0x5'));var sox=require(_0x968d('0x6'));var csv=require(_0x968d('0x7'));var ejs=require(_0x968d('0x8'));var fs=require('fs');var fs_extra=require(_0x968d('0x9'));var _=require(_0x968d('0xa'));var squel=require(_0x968d('0xb'));var crypto=require('crypto');var jsforce=require(_0x968d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x968d('0x7'));var querystring=require(_0x968d('0xd'));var Papa=require('papaparse');var extract=require(_0x968d('0xe'));var rimraf=require(_0x968d('0x1'));var archiver=require(_0x968d('0xf'));var Redis=require(_0x968d('0x10'));var authService=require(_0x968d('0x11'));var qs=require(_0x968d('0x12'));var as=require(_0x968d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x968d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x968d('0x15'));var licenseUtil=require(_0x968d('0x16'));var db=require(_0x968d('0x17'))['db'];config[_0x968d('0x18')]=_['defaults'](config[_0x968d('0x18')],{'host':_0x968d('0x19'),'port':0x18eb});var socket=require(_0x968d('0x1a'))(new Redis(config[_0x968d('0x18')]));require('./plugin.socket')[_0x968d('0x1b')](socket);function respondWithStatusCode(_0x1bf84b,_0x2dcbaa){_0x2dcbaa=_0x2dcbaa||0xcc;return function(_0x195d88){if(_0x195d88){return _0x1bf84b[_0x968d('0x1c')](_0x2dcbaa);}return _0x1bf84b[_0x968d('0x1d')](_0x2dcbaa)[_0x968d('0x1e')]();};}function respondWithResult(_0x3087d5,_0xa6a21a){_0xa6a21a=_0xa6a21a||0xc8;return function(_0x928b5f){if(_0x928b5f){return _0x3087d5['status'](_0xa6a21a)['json'](_0x928b5f);}};}function respondWithFilteredResult(_0x5bcf51,_0x7833d4){return function(_0x19082f){if(_0x19082f){var _0x478efc=typeof _0x7833d4[_0x968d('0x1f')]==='undefined'&&typeof _0x7833d4[_0x968d('0x20')]==='undefined';var _0xa6dd70=_0x19082f[_0x968d('0x21')];var _0x1232f7=_0x478efc?0x0:_0x7833d4[_0x968d('0x1f')];var _0x243d25=_0x478efc?_0x19082f['count']:_0x7833d4[_0x968d('0x1f')]+_0x7833d4['limit'];var _0x22d245;if(_0x243d25>=_0xa6dd70){_0x243d25=_0xa6dd70;_0x22d245=0xc8;}else{_0x22d245=0xce;}_0x5bcf51[_0x968d('0x1d')](_0x22d245);return _0x5bcf51['set'](_0x968d('0x22'),_0x1232f7+'-'+_0x243d25+'/'+_0xa6dd70)['json'](_0x19082f);}return null;};}function patchUpdates(_0x29f5fa){return function(_0x44c347){try{jsonpatch[_0x968d('0x23')](_0x44c347,_0x29f5fa,!![]);}catch(_0x3d7e7e){return BPromise['reject'](_0x3d7e7e);}return _0x44c347[_0x968d('0x24')]();};}function saveUpdates(_0x43d679,_0x22033d){return function(_0x4a85cb){if(_0x4a85cb){return _0x4a85cb[_0x968d('0x25')](_0x43d679)[_0x968d('0x26')](function(_0x3cf2f){return _0x3cf2f;});}return null;};}function removeEntity(_0xa90516,_0xcea8ab){return function(_0x476e81){if(_0x476e81){return _0x476e81[_0x968d('0x27')]()[_0x968d('0x26')](function(){var _0x165655=_0x476e81[_0x968d('0x28')]({'plain':!![]});var _0x336dde=_0x968d('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x336dde,'resourceId':_0x165655['id']}})[_0x968d('0x26')](function(){return _0x476e81;});})[_0x968d('0x26')](function(){_0xa90516[_0x968d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb604,_0x4d9382){return function(_0x51f79d){if(!_0x51f79d){_0x3fb604[_0x968d('0x1c')](0x194);}return _0x51f79d;};}function handleError(_0x2ba13e,_0x541692){_0x541692=_0x541692||0x1f4;return function(_0x55371e){logger[_0x968d('0x2a')](_0x55371e[_0x968d('0x2b')]);if(_0x55371e[_0x968d('0x2c')]){delete _0x55371e[_0x968d('0x2c')];}_0x2ba13e['status'](_0x541692)[_0x968d('0x2d')](_0x55371e);};}exports[_0x968d('0x2e')]=function(_0x49cb98,_0x263fb8){var _0x4ed5ca={},_0x43ec3b={},_0x4e4633={'count':0x0,'rows':[]};var _0x2f1420=_[_0x968d('0x2f')](db['Plugin'][_0x968d('0x30')],function(_0x56864b){return{'name':_0x56864b[_0x968d('0x31')],'type':_0x56864b[_0x968d('0x32')]['key']};});_0x43ec3b['model']=_[_0x968d('0x2f')](_0x2f1420,_0x968d('0x2c'));_0x43ec3b[_0x968d('0x33')]=_[_0x968d('0x34')](_0x49cb98[_0x968d('0x33')]);_0x43ec3b['filters']=_[_0x968d('0x35')](_0x43ec3b[_0x968d('0x36')],_0x43ec3b['query']);_0x4ed5ca['attributes']=_['intersection'](_0x43ec3b[_0x968d('0x36')],qs[_0x968d('0x37')](_0x49cb98[_0x968d('0x33')][_0x968d('0x37')]));_0x4ed5ca['attributes']=_0x4ed5ca[_0x968d('0x38')][_0x968d('0x39')]?_0x4ed5ca[_0x968d('0x38')]:_0x43ec3b['model'];if(!_0x49cb98[_0x968d('0x33')][_0x968d('0x3a')]('nolimit')){_0x4ed5ca['limit']=qs['limit'](_0x49cb98[_0x968d('0x33')][_0x968d('0x20')]);_0x4ed5ca[_0x968d('0x1f')]=qs[_0x968d('0x1f')](_0x49cb98[_0x968d('0x33')][_0x968d('0x1f')]);}_0x4ed5ca['order']=qs[_0x968d('0x3b')](_0x49cb98[_0x968d('0x33')][_0x968d('0x3b')]);_0x4ed5ca[_0x968d('0x3c')]=qs[_0x968d('0x3d')](_['pick'](_0x49cb98[_0x968d('0x33')],_0x43ec3b[_0x968d('0x3d')]),_0x2f1420);if(_0x49cb98[_0x968d('0x33')][_0x968d('0x3e')]){_0x4ed5ca[_0x968d('0x3c')]=_[_0x968d('0x3f')](_0x4ed5ca[_0x968d('0x3c')],{'$or':_[_0x968d('0x2f')](_0x2f1420,function(_0x498f45){if(_0x498f45[_0x968d('0x32')]!=='VIRTUAL'){var _0x3bd30f={};_0x3bd30f[_0x498f45['name']]={'$like':'%'+_0x49cb98[_0x968d('0x33')][_0x968d('0x3e')]+'%'};return _0x3bd30f;}})});}_0x4ed5ca=_[_0x968d('0x3f')]({},_0x4ed5ca,_0x49cb98['options']);var _0x42c67c={'where':_0x4ed5ca[_0x968d('0x3c')]};return db[_0x968d('0x40')][_0x968d('0x21')](_0x42c67c)[_0x968d('0x26')](function(_0x264d05){_0x4e4633[_0x968d('0x21')]=_0x264d05;if(_0x49cb98['query'][_0x968d('0x41')]){_0x4ed5ca[_0x968d('0x42')]=[{'all':!![]}];}return db[_0x968d('0x40')][_0x968d('0x43')](_0x4ed5ca);})[_0x968d('0x26')](function(_0xf97701){_0x4e4633['rows']=_0xf97701;return _0x4e4633;})[_0x968d('0x26')](respondWithFilteredResult(_0x263fb8,_0x4ed5ca))[_0x968d('0x44')](handleError(_0x263fb8,null));};exports[_0x968d('0x45')]=function(_0x25b18b,_0x28a124){var _0x5b7c56={'raw':!![],'where':{'id':_0x25b18b[_0x968d('0x46')]['id']}},_0x40d245={};_0x40d245['model']=_[_0x968d('0x34')](db[_0x968d('0x40')][_0x968d('0x30')]);_0x40d245[_0x968d('0x33')]=_[_0x968d('0x34')](_0x25b18b[_0x968d('0x33')]);_0x40d245['filters']=_['intersection'](_0x40d245['model'],_0x40d245[_0x968d('0x33')]);_0x5b7c56[_0x968d('0x38')]=_[_0x968d('0x35')](_0x40d245['model'],qs[_0x968d('0x37')](_0x25b18b[_0x968d('0x33')]['fields']));_0x5b7c56[_0x968d('0x38')]=_0x5b7c56[_0x968d('0x38')][_0x968d('0x39')]?_0x5b7c56[_0x968d('0x38')]:_0x40d245[_0x968d('0x36')];if(_0x25b18b[_0x968d('0x33')][_0x968d('0x41')]){_0x5b7c56['include']=[{'all':!![]}];}_0x5b7c56=_[_0x968d('0x3f')]({},_0x5b7c56,_0x25b18b[_0x968d('0x47')]);return db[_0x968d('0x40')]['find'](_0x5b7c56)['then'](handleEntityNotFound(_0x28a124,null))['then'](respondWithResult(_0x28a124,null))[_0x968d('0x44')](handleError(_0x28a124,null));};exports[_0x968d('0x48')]=function(_0x348999,_0x5c0863,_0x11974e){return db[_0x968d('0x40')][_0x968d('0x49')]({'where':{'id':_0x348999['params']['id']},'attributes':[_0x968d('0x2c'),_0x968d('0x5')],'raw':!![]})[_0x968d('0x26')](handleEntityNotFound(_0x5c0863,null))[_0x968d('0x26')](function(_0x3b7a5e){if(_0x3b7a5e){var _0x320d04=path[_0x968d('0x4a')](config[_0x968d('0x4b')],_0x968d('0x4c'),util[_0x968d('0x4d')](_0x968d('0x4e'),path[_0x968d('0x4f')](_0x3b7a5e[_0x968d('0x5')])));var _0x3394b2=fs[_0x968d('0x50')](_0x320d04);var _0x40eea4=archiver(_0x968d('0x51'),{'zlib':{'level':0x9}});_0x40eea4['on']('warning',function(_0x1db2bc){if(_0x1db2bc[_0x968d('0x52')]==='ENOENT'){logger[_0x968d('0x2a')](_0x1db2bc);}else{throw new db['Sequelize'][(_0x968d('0x53'))](_0x968d('0x54'));}});_0x40eea4['on'](_0x968d('0x2a'),function(_0xed9468){throw new db[(_0x968d('0x55'))][(_0x968d('0x53'))](_0x968d('0x54'));});_0x40eea4[_0x968d('0x56')](_0x3394b2);_0x40eea4[_0x968d('0x57')](_0x968d('0x58'),{'cwd':path['join'](config[_0x968d('0x4b')],_0x968d('0x4c'),path[_0x968d('0x59')](_0x3b7a5e['path'])),'ignore':[path[_0x968d('0x4a')](path[_0x968d('0x4f')](_0x3b7a5e[_0x968d('0x5')]),'node_modules/**/*'),path[_0x968d('0x4a')](path[_0x968d('0x4f')](_0x3b7a5e['path']),_0x968d('0x5a'))],'nodir':!![]})[_0x968d('0x5b')]();_0x3394b2['on'](_0x968d('0x5c'),function(){if(!fs[_0x968d('0x5d')](_0x320d04)){throw new db[(_0x968d('0x55'))][(_0x968d('0x53'))]('Plugin\x20not\x20found');}return _0x5c0863['download'](_0x320d04,util['format'](_0x968d('0x4e'),path[_0x968d('0x4f')](_0x3b7a5e[_0x968d('0x5')])),function(_0x4aef00){if(_0x4aef00){throw new db[(_0x968d('0x55'))]['Error'](_0x968d('0x5e'));}fs[_0x968d('0x5f')](_0x320d04);logger[_0x968d('0x60')](_0x968d('0x61'));logger[_0x968d('0x60')](_0x968d('0x62'));});});}return null;})[_0x968d('0x44')](handleError(_0x5c0863,null));};exports[_0x968d('0x63')]=function(_0x36548b,_0x25fdd8,_0x45262f){var _0x4f4cff=path[_0x968d('0x4f')](_0x36548b[_0x968d('0x64')][_0x968d('0x65')],path[_0x968d('0x66')](_0x36548b['file'][_0x968d('0x65')]));var _0x34c706=path[_0x968d('0x4a')](config[_0x968d('0x4b')],'server/files/plugins',_0x36548b[_0x968d('0x64')][_0x968d('0x65')]);var _0x17ccf6=path[_0x968d('0x4a')](config[_0x968d('0x4b')],_0x968d('0x4c'),_0x4f4cff);logger['info'](_0x968d('0x67'),_0x34c706);logger[_0x968d('0x60')](_0x968d('0x68'),_0x17ccf6);try{fs[_0x968d('0x69')](_0x34c706,parseInt(_0x968d('0x6a'),0x8));extract(_0x34c706,{'dir':_0x17ccf6},function(_0x1043fd){if(_0x1043fd){logger[_0x968d('0x2a')](_0x1043fd);handleError(_0x1043fd,!![]);};var _0x3409fe=fs['readdirSync'](_0x17ccf6);if(_0x3409fe[_0x968d('0x39')]>0x1){removeReferences(_0x34c706,_0x17ccf6);logger[_0x968d('0x2a')](_0x968d('0x6b'));return _0x45262f(new Error('Invalid\x20plugin\x20structure'));}var _0x117e0e=fs[_0x968d('0x6c')](path[_0x968d('0x4a')](_0x17ccf6,_0x3409fe[0x0]));if(_0x117e0e[_0x968d('0x6d')]()){removeReferences(_0x34c706,_0x17ccf6);logger[_0x968d('0x2a')]('Invalid\x20plugin\x20structure');return _0x45262f(new Error(_0x968d('0x6b')));}if(_0x117e0e['isDirectory']()){var _0x574358=fs['readdirSync'](path[_0x968d('0x4a')](_0x17ccf6,_0x3409fe[0x0]));if(_0x574358['length']===0x0){removeReferences(_0x34c706,_0x17ccf6);logger[_0x968d('0x2a')]('Invalid\x20plugin\x20structure');return _0x45262f(new Error(_0x968d('0x6b')));}var _0x3f79be=_0x574358[_0x968d('0x6e')](function(_0x55ca69){return _0x55ca69==='manifest.json';});if(!_0x3f79be){return _0x45262f(new Error('Plugin\x20manifest\x20missing'));}var _0x5dbe55=fs[_0x968d('0x6f')](path['join'](_0x17ccf6,_0x3409fe[0x0],_0x968d('0x70')));var _0x1aa38d=JSON['parse'](_0x5dbe55);if(_0x968d('0x71')==typeof _0x1aa38d[_0x968d('0x2c')]){return _0x45262f(new Error(_0x968d('0x72')));}if('undefined'==typeof _0x1aa38d[_0x968d('0x32')]){return _0x45262f(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x968d('0x71')==typeof _0x1aa38d[_0x968d('0x73')]){return _0x45262f(new Error(_0x968d('0x74')));}if(_0x968d('0x71')==typeof _0x1aa38d[_0x968d('0x75')]){return _0x45262f(new Error(_0x968d('0x76')));}if(_0x1aa38d[_0x968d('0x32')]==='html'){if(_0x968d('0x71')==typeof _0x1aa38d['parameters'][_0x968d('0x77')]){return _0x45262f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x78')]&&_0x968d('0x71')==typeof _0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x79')]){return _0x45262f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1aa38d[_0x968d('0x32')]==='script'){if(_0x968d('0x71')==typeof _0x1aa38d['parameters']['scriptName']){return _0x45262f(new Error(_0x968d('0x7a')));}if('undefined'==typeof _0x1aa38d[_0x968d('0x75')][_0x968d('0x7b')]){return _0x45262f(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x45262f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4f7c35=_0x1aa38d[_0x968d('0x2c')];var _0x50b64c=_0x1aa38d[_0x968d('0x7c')];var _0x117f7d=_0x1aa38d[_0x968d('0x32')];var _0x21626b=_0x1aa38d[_0x968d('0x7d')]?_0x1aa38d['sidebar']:'always';var _0x56566c=_0x1aa38d[_0x968d('0x7e')]?_0x1aa38d[_0x968d('0x7e')]:_0x968d('0x7f');var _0x152ecb='';var _0x263dfe='';var _0x28bf04='';var _0x517ad9='';var _0x17b575=_0x1aa38d[_0x968d('0x73')];if(_0x117f7d==='html'){if(_0x968d('0x71')!=typeof _0x1aa38d[_0x968d('0x75')]['views']['admin']){var _0x16cb3c=_0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x968d('0x80')](_0x16cb3c)){_0x152ecb=path[_0x968d('0x4a')](_0x968d('0x81'),_0x4f4cff,_0x3409fe[0x0],_0x16cb3c);}else{_0x152ecb=_0x16cb3c;}}else{logger[_0x968d('0x60')](_0x968d('0x82'));}if(_0x968d('0x71')!=typeof _0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x79')]){var _0x5ca7cf=_0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x968d('0x80')](_0x5ca7cf)){_0x263dfe=path[_0x968d('0x4a')](_0x968d('0x81'),_0x4f4cff,_0x3409fe[0x0],_0x5ca7cf);}else{_0x263dfe=_0x5ca7cf;}}else{logger['info'](_0x968d('0x83'));}}else if(_0x117f7d===_0x968d('0x84')){_0x28bf04=_0x1aa38d[_0x968d('0x75')][_0x968d('0x85')];_0x517ad9=_0x1aa38d[_0x968d('0x75')][_0x968d('0x7b')];if(_0x968d('0x71')!=typeof _0x1aa38d['parameters'][_0x968d('0x77')]){if('undefined'!=typeof _0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x78')]){var _0x16cb3c=_0x1aa38d['parameters'][_0x968d('0x77')][_0x968d('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x968d('0x80')](_0x16cb3c)){_0x152ecb=path[_0x968d('0x4a')](_0x968d('0x81'),_0x4f4cff,_0x3409fe[0x0],_0x16cb3c);}else{_0x152ecb=_0x16cb3c;}}if(_0x968d('0x71')!=typeof _0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x79')]){var _0x5ca7cf=_0x1aa38d[_0x968d('0x75')][_0x968d('0x77')][_0x968d('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x968d('0x80')](_0x5ca7cf)){_0x263dfe=path[_0x968d('0x4a')](_0x968d('0x81'),_0x4f4cff,_0x3409fe[0x0],_0x5ca7cf);}else{_0x263dfe=_0x5ca7cf;}}}}var _0x30008c={'name':_0x4f7c35,'description':_0x50b64c,'path':path[_0x968d('0x4a')](_0x4f4cff,_0x3409fe[0x0]),'type':_0x117f7d,'sidebar':_0x21626b,'icon':_0x56566c,'adminUrl':_0x152ecb,'agentUrl':_0x263dfe,'scriptName':_0x28bf04,'scriptPath':_0x517ad9,'version':_0x17b575};removeReferences(_0x34c706,null);return db['Plugin']['create'](_0x30008c)[_0x968d('0x26')](function(_0x5d64b5){var _0x5cb697={'role':_0x36548b[_0x968d('0x86')]['role'],'userProfileId':_0x36548b['body'][_0x968d('0x87')]};if(!_0x5cb697)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cb697['role']===_0x968d('0x88')){var _0x24b24f=_0x5d64b5[_0x968d('0x28')]({'plain':!![]});return db[_0x968d('0x89')][_0x968d('0x49')]({'where':{'name':'Plugins','userProfileId':_0x5cb697[_0x968d('0x87')]},'raw':!![]})['then'](function(_0x2dd6e0){if(_0x2dd6e0&&_0x2dd6e0[_0x968d('0x8a')]===0x0){return db['UserProfileResource'][_0x968d('0x8b')]({'name':_0x24b24f[_0x968d('0x2c')],'resourceId':_0x24b24f['id'],'type':_0x2dd6e0[_0x968d('0x2c')],'sectionId':_0x2dd6e0['id']},{})[_0x968d('0x26')](function(){return _0x5d64b5;});}else{return _0x5d64b5;}})[_0x968d('0x44')](function(_0x557925){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557925);throw _0x557925;});}return _0x5d64b5;})[_0x968d('0x26')](respondWithResult(_0x25fdd8,null))['catch'](handleError(_0x25fdd8,null));}});}catch(_0x34ef0e){_0x25fdd8[_0x968d('0x1d')](0x1f4)[_0x968d('0x2d')](_0x34ef0e);}};function removeReferences(_0x5623b8,_0x4defd0){try{if(_0x5623b8){fs[_0x968d('0x5f')](_0x5623b8);logger[_0x968d('0x60')]('Zip\x20archive\x20removed');}if(_0x4defd0){rimraf(_0x4defd0,function(){});logger[_0x968d('0x60')](_0x968d('0x8c'));}}catch(_0x44f610){logger[_0x968d('0x2a')](_0x44f610);}}exports[_0x968d('0x25')]=function(_0x57fc29,_0x40c773,_0x445127){return db[_0x968d('0x40')][_0x968d('0x49')]({'where':{'id':_0x57fc29[_0x968d('0x46')]['id']}})[_0x968d('0x26')](handleEntityNotFound(_0x40c773,null))[_0x968d('0x26')](saveUpdates(_0x57fc29[_0x968d('0x86')],null))[_0x968d('0x26')](respondWithResult(_0x40c773,null))[_0x968d('0x44')](handleError(_0x40c773,null));};exports['delete']=function(_0x166638,_0x21e2a3,_0x1a51ca){return db[_0x968d('0x40')][_0x968d('0x49')]({'where':{'id':_0x166638[_0x968d('0x46')]['id']}})[_0x968d('0x26')](function(_0x3fdc5e){if(_0x3fdc5e){return _0x3fdc5e['destroy']();}})['then'](function(_0x13be11){rimraf(path['join'](config[_0x968d('0x4b')],'server/files/plugins',path['dirname'](_0x13be11['path'])),function(){});return _0x13be11;})[_0x968d('0x26')](handleEntityNotFound(_0x21e2a3,null))[_0x968d('0x26')](respondWithStatusCode(_0x21e2a3,null))[_0x968d('0x44')](handleError(_0x21e2a3,null));};exports[_0x968d('0x8d')]=function(_0x46678c,_0x3116aa,_0x3271ec){return BPromise[_0x968d('0x8e')]()['then'](function(){if(!_0x46678c[_0x968d('0x33')][_0x968d('0x5')]){throw new Error(_0x968d('0x8f'));}if(!_0x46678c[_0x968d('0x33')][_0x968d('0x90')]){throw new Error(_0x968d('0x91'));}var _0x9ab1bd=_0x46678c[_0x968d('0x33')][_0x968d('0x92')]?_0x46678c[_0x968d('0x33')][_0x968d('0x92')]+':'+_0x46678c[_0x968d('0x33')][_0x968d('0x90')]:_0x968d('0x93')+_0x46678c['query'][_0x968d('0x90')];var _0x41c6cb=_0x46678c[_0x968d('0x33')]['json']?_0x46678c[_0x968d('0x33')][_0x968d('0x94')]:!![];var _0x2dcb59=_0x46678c['query'][_0x968d('0x95')]?_0x46678c['query'][_0x968d('0x95')]:null;var _0x370cb9={'method':_0x46678c[_0x968d('0x96')],'uri':util[_0x968d('0x4d')](_0x968d('0x97'),_0x9ab1bd,_0x46678c[_0x968d('0x33')][_0x968d('0x5')]),'json':_0x41c6cb,'resolveWithFullResponse':!![],'encoding':_0x2dcb59,'qs':_0x46678c['query']};if(_0x46678c[_0x968d('0x98')]){_0x370cb9[_0x968d('0x98')]=_0x46678c[_0x968d('0x98')];if(_0x370cb9['headers']['content-length']){delete _0x370cb9[_0x968d('0x98')]['content-length'];}}if(_0x370cb9[_0x968d('0x98')][_0x968d('0x99')]){delete _0x370cb9[_0x968d('0x98')][_0x968d('0x99')];}return rp(_0x370cb9);})[_0x968d('0x26')](function(_0x54d840){if(_0x54d840){_0x3116aa[_0x968d('0x9a')](_0x54d840[_0x968d('0x98')]);logger[_0x968d('0x60')](_0x54d840[_0x968d('0x86')]);if(_['endsWith'](_0x46678c[_0x968d('0x33')]['path'],_0x968d('0x48'))&&_0x54d840['statusCode']==0x1f4){return _0x3116aa[_0x968d('0x1c')](_0x54d840[_0x968d('0x9b')]);}else{return _0x3116aa[_0x968d('0x1d')](_0x54d840['statusCode'])[_0x968d('0x2d')](_0x54d840[_0x968d('0x86')]);}}else{return _0x3116aa['sendStatus'](0xc8);}})[_0x968d('0x44')](handleError(_0x3116aa,null));};exports[_0x968d('0x9c')]=function(_0x1c920a,_0x3bca71,_0x7c46c8){return BPromise[_0x968d('0x8e')]()[_0x968d('0x26')](function(){if(!_0x1c920a[_0x968d('0x33')][_0x968d('0x5')]){throw new Error(_0x968d('0x8f'));}if(!_0x1c920a[_0x968d('0x33')][_0x968d('0x90')]){throw new Error(_0x968d('0x91'));}var _0x4dc226=_0x1c920a['query'][_0x968d('0x92')]?_0x1c920a[_0x968d('0x33')][_0x968d('0x92')]+':'+_0x1c920a[_0x968d('0x33')][_0x968d('0x90')]:_0x968d('0x93')+_0x1c920a[_0x968d('0x33')][_0x968d('0x90')];var _0x35a03c=_0x1c920a['query'][_0x968d('0x94')]?_0x1c920a['query'][_0x968d('0x94')]:!![];var _0x8bd5ee=_0x1c920a[_0x968d('0x33')][_0x968d('0x95')]?_0x1c920a[_0x968d('0x33')]['encoding']:null;var _0x2129be={'method':_0x1c920a[_0x968d('0x96')],'uri':util[_0x968d('0x4d')]('%s%s',_0x4dc226,_0x1c920a['query']['path']),'json':_0x35a03c,'resolveWithFullResponse':!![],'encoding':_0x8bd5ee,'body':_0x1c920a[_0x968d('0x86')]};if(_0x1c920a[_0x968d('0x98')]){_0x2129be[_0x968d('0x98')]=_0x1c920a[_0x968d('0x98')];if(_0x2129be[_0x968d('0x98')][_0x968d('0x9d')]){delete _0x2129be['headers'][_0x968d('0x9d')];}}if(_0x2129be[_0x968d('0x98')][_0x968d('0x99')]){delete _0x2129be['headers']['content-type'];}return rp(_0x2129be);})[_0x968d('0x26')](function(_0x5b602f){if(_0x5b602f){_0x3bca71[_0x968d('0x9a')](_0x5b602f['headers']);logger[_0x968d('0x60')](_0x5b602f[_0x968d('0x86')]);return _0x3bca71['status'](_0x5b602f['statusCode'])['send'](_0x5b602f[_0x968d('0x86')]);}else{return _0x3bca71[_0x968d('0x1c')](0xc8);}})[_0x968d('0x44')](handleError(_0x3bca71,null));}; \ No newline at end of file +var _0x1330=['test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','format','%s%s','headers','content-length','content-type','body','endsWith','statusCode','webhookPost','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','include','catch','show','params','Plugin','includeAll','options','find','download','join','root','server/files/plugins','%s.zip','basename','zip','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps'];(function(_0x1c51ca,_0x58ed7d){var _0x2f1baa=function(_0x98b62){while(--_0x98b62){_0x1c51ca['push'](_0x1c51ca['shift']());}};_0x2f1baa(++_0x58ed7d);}(_0x1330,0xcc));var _0x0133=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x1330[_0x77d310];return _0x2cdce4;};'use strict';var emlformat=require(_0x0133('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0133('0x1'));var jsonpatch=require(_0x0133('0x2'));var rp=require(_0x0133('0x3'));var moment=require(_0x0133('0x4'));var BPromise=require(_0x0133('0x5'));var Mustache=require(_0x0133('0x6'));var util=require('util');var path=require(_0x0133('0x7'));var sox=require(_0x0133('0x8'));var csv=require(_0x0133('0x9'));var ejs=require(_0x0133('0xa'));var fs=require('fs');var fs_extra=require(_0x0133('0xb'));var _=require(_0x0133('0xc'));var squel=require('squel');var crypto=require(_0x0133('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0133('0xe'));var toCsv=require(_0x0133('0x9'));var querystring=require(_0x0133('0xf'));var Papa=require('papaparse');var extract=require(_0x0133('0x10'));var rimraf=require(_0x0133('0x11'));var archiver=require(_0x0133('0x12'));var Redis=require(_0x0133('0x13'));var authService=require(_0x0133('0x14'));var qs=require(_0x0133('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0133('0x16'));var logger=require(_0x0133('0x17'))('api');var utils=require(_0x0133('0x18'));var config=require(_0x0133('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0133('0x1a'))['db'];config[_0x0133('0x1b')]=_['defaults'](config[_0x0133('0x1b')],{'host':_0x0133('0x1c'),'port':0x18eb});var socket=require(_0x0133('0x1d'))(new Redis(config[_0x0133('0x1b')]));require(_0x0133('0x1e'))[_0x0133('0x1f')](socket);function respondWithStatusCode(_0x68855e,_0x56e527){_0x56e527=_0x56e527||0xcc;return function(_0x3ab5fe){if(_0x3ab5fe){return _0x68855e[_0x0133('0x20')](_0x56e527);}return _0x68855e[_0x0133('0x21')](_0x56e527)[_0x0133('0x22')]();};}function respondWithResult(_0x296d77,_0x3373ab){_0x3373ab=_0x3373ab||0xc8;return function(_0x127f24){if(_0x127f24){return _0x296d77[_0x0133('0x21')](_0x3373ab)['json'](_0x127f24);}};}function respondWithFilteredResult(_0x5275db,_0x2c9c04){return function(_0x23460b){if(_0x23460b){var _0x2e1d79=typeof _0x2c9c04[_0x0133('0x23')]==='undefined'&&typeof _0x2c9c04[_0x0133('0x24')]===_0x0133('0x25');var _0x54201d=_0x23460b[_0x0133('0x26')];var _0x770d2d=_0x2e1d79?0x0:_0x2c9c04[_0x0133('0x23')];var _0x5a12d9=_0x2e1d79?_0x23460b[_0x0133('0x26')]:_0x2c9c04[_0x0133('0x23')]+_0x2c9c04[_0x0133('0x24')];var _0x4b3b3f;if(_0x5a12d9>=_0x54201d){_0x5a12d9=_0x54201d;_0x4b3b3f=0xc8;}else{_0x4b3b3f=0xce;}_0x5275db['status'](_0x4b3b3f);return _0x5275db[_0x0133('0x27')]('Content-Range',_0x770d2d+'-'+_0x5a12d9+'/'+_0x54201d)[_0x0133('0x28')](_0x23460b);}return null;};}function patchUpdates(_0x54b868){return function(_0x42efce){try{jsonpatch[_0x0133('0x29')](_0x42efce,_0x54b868,!![]);}catch(_0x23d97e){return BPromise['reject'](_0x23d97e);}return _0x42efce[_0x0133('0x2a')]();};}function saveUpdates(_0x57afc1,_0xcd3579){return function(_0x2b5bd1){if(_0x2b5bd1){return _0x2b5bd1[_0x0133('0x2b')](_0x57afc1)[_0x0133('0x2c')](function(_0x418de7){return _0x418de7;});}return null;};}function removeEntity(_0x58ac32,_0x3d50d1){return function(_0xd7a86){if(_0xd7a86){return _0xd7a86[_0x0133('0x2d')]()[_0x0133('0x2c')](function(){var _0x4d8e1e=_0xd7a86[_0x0133('0x2e')]({'plain':!![]});var _0x1bd91d=_0x0133('0x2f');return db[_0x0133('0x30')]['destroy']({'where':{'type':_0x1bd91d,'resourceId':_0x4d8e1e['id']}})['then'](function(){return _0xd7a86;});})[_0x0133('0x2c')](function(){_0x58ac32[_0x0133('0x21')](0xcc)[_0x0133('0x22')]();});}};}function handleEntityNotFound(_0x472595,_0x4966c3){return function(_0x3f7e6f){if(!_0x3f7e6f){_0x472595[_0x0133('0x20')](0x194);}return _0x3f7e6f;};}function handleError(_0x2981bf,_0x2d54b0){_0x2d54b0=_0x2d54b0||0x1f4;return function(_0x4af1c0){logger[_0x0133('0x31')](_0x4af1c0[_0x0133('0x32')]);if(_0x4af1c0[_0x0133('0x33')]){delete _0x4af1c0[_0x0133('0x33')];}_0x2981bf[_0x0133('0x21')](_0x2d54b0)[_0x0133('0x34')](_0x4af1c0);};}exports[_0x0133('0x35')]=function(_0x2b35d5,_0x4cc75a){var _0x4f9ea5={},_0x42939e={},_0x1b611a={'count':0x0,'rows':[]};var _0x23fd31=_[_0x0133('0x36')](db['Plugin'][_0x0133('0x37')],function(_0x4c059d){return{'name':_0x4c059d[_0x0133('0x38')],'type':_0x4c059d[_0x0133('0x39')][_0x0133('0x3a')]};});_0x42939e['model']=_[_0x0133('0x36')](_0x23fd31,_0x0133('0x33'));_0x42939e[_0x0133('0x3b')]=_[_0x0133('0x3c')](_0x2b35d5[_0x0133('0x3b')]);_0x42939e[_0x0133('0x3d')]=_[_0x0133('0x3e')](_0x42939e['model'],_0x42939e[_0x0133('0x3b')]);_0x4f9ea5['attributes']=_['intersection'](_0x42939e[_0x0133('0x3f')],qs['fields'](_0x2b35d5[_0x0133('0x3b')][_0x0133('0x40')]));_0x4f9ea5[_0x0133('0x41')]=_0x4f9ea5[_0x0133('0x41')][_0x0133('0x42')]?_0x4f9ea5['attributes']:_0x42939e[_0x0133('0x3f')];if(!_0x2b35d5[_0x0133('0x3b')][_0x0133('0x43')](_0x0133('0x44'))){_0x4f9ea5[_0x0133('0x24')]=qs[_0x0133('0x24')](_0x2b35d5[_0x0133('0x3b')][_0x0133('0x24')]);_0x4f9ea5[_0x0133('0x23')]=qs[_0x0133('0x23')](_0x2b35d5[_0x0133('0x3b')][_0x0133('0x23')]);}_0x4f9ea5['order']=qs[_0x0133('0x45')](_0x2b35d5[_0x0133('0x3b')][_0x0133('0x45')]);_0x4f9ea5[_0x0133('0x46')]=qs[_0x0133('0x3d')](_['pick'](_0x2b35d5[_0x0133('0x3b')],_0x42939e[_0x0133('0x3d')]),_0x23fd31);if(_0x2b35d5[_0x0133('0x3b')][_0x0133('0x47')]){_0x4f9ea5[_0x0133('0x46')]=_[_0x0133('0x48')](_0x4f9ea5['where'],{'$or':_[_0x0133('0x36')](_0x23fd31,function(_0x3cf25a){if(_0x3cf25a[_0x0133('0x39')]!=='VIRTUAL'){var _0x1441fc={};_0x1441fc[_0x3cf25a[_0x0133('0x33')]]={'$like':'%'+_0x2b35d5['query'][_0x0133('0x47')]+'%'};return _0x1441fc;}})});}_0x4f9ea5=_[_0x0133('0x48')]({},_0x4f9ea5,_0x2b35d5['options']);var _0x337b34={'where':_0x4f9ea5[_0x0133('0x46')]};return db['Plugin']['count'](_0x337b34)['then'](function(_0xb18502){_0x1b611a[_0x0133('0x26')]=_0xb18502;if(_0x2b35d5[_0x0133('0x3b')]['includeAll']){_0x4f9ea5[_0x0133('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x4f9ea5);})['then'](function(_0x32fd3f){_0x1b611a['rows']=_0x32fd3f;return _0x1b611a;})[_0x0133('0x2c')](respondWithFilteredResult(_0x4cc75a,_0x4f9ea5))[_0x0133('0x4a')](handleError(_0x4cc75a,null));};exports[_0x0133('0x4b')]=function(_0x3c3d42,_0x5e9868){var _0x346c33={'raw':!![],'where':{'id':_0x3c3d42[_0x0133('0x4c')]['id']}},_0x20b7c3={};_0x20b7c3['model']=_['keys'](db[_0x0133('0x4d')][_0x0133('0x37')]);_0x20b7c3[_0x0133('0x3b')]=_['keys'](_0x3c3d42['query']);_0x20b7c3[_0x0133('0x3d')]=_[_0x0133('0x3e')](_0x20b7c3[_0x0133('0x3f')],_0x20b7c3[_0x0133('0x3b')]);_0x346c33[_0x0133('0x41')]=_[_0x0133('0x3e')](_0x20b7c3[_0x0133('0x3f')],qs[_0x0133('0x40')](_0x3c3d42[_0x0133('0x3b')][_0x0133('0x40')]));_0x346c33['attributes']=_0x346c33[_0x0133('0x41')]['length']?_0x346c33[_0x0133('0x41')]:_0x20b7c3[_0x0133('0x3f')];if(_0x3c3d42[_0x0133('0x3b')][_0x0133('0x4e')]){_0x346c33[_0x0133('0x49')]=[{'all':!![]}];}_0x346c33=_[_0x0133('0x48')]({},_0x346c33,_0x3c3d42[_0x0133('0x4f')]);return db[_0x0133('0x4d')][_0x0133('0x50')](_0x346c33)[_0x0133('0x2c')](handleEntityNotFound(_0x5e9868,null))[_0x0133('0x2c')](respondWithResult(_0x5e9868,null))[_0x0133('0x4a')](handleError(_0x5e9868,null));};exports[_0x0133('0x51')]=function(_0x342499,_0x3e8097,_0x1598eb){return db[_0x0133('0x4d')][_0x0133('0x50')]({'where':{'id':_0x342499[_0x0133('0x4c')]['id']},'attributes':[_0x0133('0x33'),'path'],'raw':!![]})[_0x0133('0x2c')](handleEntityNotFound(_0x3e8097,null))[_0x0133('0x2c')](function(_0x2bba69){if(_0x2bba69){var _0x19c75a=path[_0x0133('0x52')](config[_0x0133('0x53')],_0x0133('0x54'),util['format'](_0x0133('0x55'),path[_0x0133('0x56')](_0x2bba69[_0x0133('0x7')])));var _0x617c7f=fs['createWriteStream'](_0x19c75a);var _0x189304=archiver(_0x0133('0x57'),{'zlib':{'level':0x9}});_0x189304['on']('warning',function(_0x438aef){if(_0x438aef['code']===_0x0133('0x58')){logger[_0x0133('0x31')](_0x438aef);}else{throw new db['Sequelize'][(_0x0133('0x59'))](_0x0133('0x5a'));}});_0x189304['on'](_0x0133('0x31'),function(_0x121ce7){throw new db[(_0x0133('0x5b'))][(_0x0133('0x59'))](_0x0133('0x5a'));});_0x189304['pipe'](_0x617c7f);_0x189304['glob'](_0x0133('0x5c'),{'cwd':path[_0x0133('0x52')](config[_0x0133('0x53')],'server/files/plugins',path[_0x0133('0x5d')](_0x2bba69[_0x0133('0x7')])),'ignore':[path[_0x0133('0x52')](path['basename'](_0x2bba69[_0x0133('0x7')]),_0x0133('0x5e')),path['join'](path[_0x0133('0x56')](_0x2bba69[_0x0133('0x7')]),_0x0133('0x5f'))],'nodir':!![]})[_0x0133('0x60')]();_0x617c7f['on'](_0x0133('0x61'),function(){if(!fs[_0x0133('0x62')](_0x19c75a)){throw new db[(_0x0133('0x5b'))]['Error'](_0x0133('0x63'));}return _0x3e8097[_0x0133('0x51')](_0x19c75a,util['format'](_0x0133('0x55'),path[_0x0133('0x56')](_0x2bba69['path'])),function(_0x2106b9){if(_0x2106b9){throw new db['Sequelize'][(_0x0133('0x59'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x0133('0x64')](_0x19c75a);logger[_0x0133('0x65')](_0x0133('0x66'));logger[_0x0133('0x65')](_0x0133('0x67'));});});}return null;})[_0x0133('0x4a')](handleError(_0x3e8097,null));};exports[_0x0133('0x68')]=function(_0x322f23,_0x5bbe28,_0x56a469){var _0x4f9212=path[_0x0133('0x56')](_0x322f23[_0x0133('0x69')][_0x0133('0x6a')],path[_0x0133('0x6b')](_0x322f23[_0x0133('0x69')][_0x0133('0x6a')]));var _0x15c9ce=path['join'](config['root'],_0x0133('0x54'),_0x322f23[_0x0133('0x69')][_0x0133('0x6a')]);var _0x5d5aba=path[_0x0133('0x52')](config[_0x0133('0x53')],_0x0133('0x54'),_0x4f9212);logger[_0x0133('0x65')](_0x0133('0x6c'),_0x15c9ce);logger[_0x0133('0x65')](_0x0133('0x6d'),_0x5d5aba);try{fs['chmodSync'](_0x15c9ce,parseInt(_0x0133('0x6e'),0x8));extract(_0x15c9ce,{'dir':_0x5d5aba},function(_0x2c5d6c){if(_0x2c5d6c){logger[_0x0133('0x31')](_0x2c5d6c);handleError(_0x2c5d6c,!![]);};var _0x7fb69b=fs[_0x0133('0x6f')](_0x5d5aba);if(_0x7fb69b[_0x0133('0x42')]>0x1){removeReferences(_0x15c9ce,_0x5d5aba);logger[_0x0133('0x31')](_0x0133('0x70'));return _0x56a469(new Error(_0x0133('0x70')));}var _0xa0b096=fs[_0x0133('0x71')](path[_0x0133('0x52')](_0x5d5aba,_0x7fb69b[0x0]));if(_0xa0b096[_0x0133('0x72')]()){removeReferences(_0x15c9ce,_0x5d5aba);logger['error']('Invalid\x20plugin\x20structure');return _0x56a469(new Error(_0x0133('0x70')));}if(_0xa0b096[_0x0133('0x73')]()){var _0x17a39a=fs[_0x0133('0x6f')](path[_0x0133('0x52')](_0x5d5aba,_0x7fb69b[0x0]));if(_0x17a39a[_0x0133('0x42')]===0x0){removeReferences(_0x15c9ce,_0x5d5aba);logger['error'](_0x0133('0x70'));return _0x56a469(new Error('Invalid\x20plugin\x20structure'));}var _0x54e9bc=_0x17a39a[_0x0133('0x74')](function(_0x52efe3){return _0x52efe3===_0x0133('0x75');});if(!_0x54e9bc){return _0x56a469(new Error(_0x0133('0x76')));}var _0x13eb02=fs[_0x0133('0x77')](path[_0x0133('0x52')](_0x5d5aba,_0x7fb69b[0x0],_0x0133('0x75')));var _0xfafaba=JSON[_0x0133('0x78')](_0x13eb02);if(_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x33')]){return _0x56a469(new Error(_0x0133('0x79')));}if(_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x39')]){return _0x56a469(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x7a')]){return _0x56a469(new Error(_0x0133('0x7b')));}if(_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x7c')]){return _0x56a469(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0xfafaba[_0x0133('0x39')]===_0x0133('0x7d')){if(_0x0133('0x25')==typeof _0xfafaba['parameters']['views']){return _0x56a469(new Error(_0x0133('0x7e')));}if(_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x7c')][_0x0133('0x7f')][_0x0133('0x80')]&&_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x7c')][_0x0133('0x7f')][_0x0133('0x81')]){return _0x56a469(new Error(_0x0133('0x82')));}}else if(_0xfafaba[_0x0133('0x39')]===_0x0133('0x83')){if(_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x7c')][_0x0133('0x84')]){return _0x56a469(new Error(_0x0133('0x85')));}if(_0x0133('0x25')==typeof _0xfafaba[_0x0133('0x7c')]['scriptPath']){return _0x56a469(new Error(_0x0133('0x86')));}}else{return _0x56a469(new Error(_0x0133('0x87')));}var _0x335cc8=_0xfafaba[_0x0133('0x33')];var _0x51c977=_0xfafaba[_0x0133('0x88')];var _0xbd7684=_0xfafaba[_0x0133('0x39')];var _0x503b4f=_0xfafaba['sidebar']?_0xfafaba['sidebar']:_0x0133('0x89');var _0x5bbc7e=_0xfafaba[_0x0133('0x8a')]?_0xfafaba[_0x0133('0x8a')]:_0x0133('0x8b');var _0x302060='';var _0x3e304c='';var _0x38e039='';var _0x42c0cf='';var _0x5099f2=_0xfafaba['version'];if(_0xbd7684===_0x0133('0x7d')){if(_0x0133('0x25')!=typeof _0xfafaba[_0x0133('0x7c')][_0x0133('0x7f')][_0x0133('0x80')]){var _0x19d4d5=_0xfafaba[_0x0133('0x7c')][_0x0133('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0133('0x8c')](_0x19d4d5)){_0x302060=path[_0x0133('0x52')]('plugins',_0x4f9212,_0x7fb69b[0x0],_0x19d4d5);}else{_0x302060=_0x19d4d5;}}else{logger[_0x0133('0x65')](_0x0133('0x8d'));}if(_0x0133('0x25')!=typeof _0xfafaba['parameters'][_0x0133('0x7f')][_0x0133('0x81')]){var _0x227ed4=_0xfafaba['parameters'][_0x0133('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0133('0x8c')](_0x227ed4)){_0x3e304c=path[_0x0133('0x52')](_0x0133('0x8e'),_0x4f9212,_0x7fb69b[0x0],_0x227ed4);}else{_0x3e304c=_0x227ed4;}}else{logger[_0x0133('0x65')](_0x0133('0x8f'));}}else if(_0xbd7684===_0x0133('0x83')){_0x38e039=_0xfafaba[_0x0133('0x7c')][_0x0133('0x84')];_0x42c0cf=_0xfafaba[_0x0133('0x7c')][_0x0133('0x90')];if('undefined'!=typeof _0xfafaba[_0x0133('0x7c')][_0x0133('0x7f')]){if(_0x0133('0x25')!=typeof _0xfafaba['parameters'][_0x0133('0x7f')]['admin']){var _0x19d4d5=_0xfafaba[_0x0133('0x7c')][_0x0133('0x7f')][_0x0133('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x0133('0x8c')](_0x19d4d5)){_0x302060=path[_0x0133('0x52')]('plugins',_0x4f9212,_0x7fb69b[0x0],_0x19d4d5);}else{_0x302060=_0x19d4d5;}}if(_0x0133('0x25')!=typeof _0xfafaba[_0x0133('0x7c')][_0x0133('0x7f')]['agent']){var _0x227ed4=_0xfafaba['parameters']['views'][_0x0133('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x227ed4)){_0x3e304c=path[_0x0133('0x52')](_0x0133('0x8e'),_0x4f9212,_0x7fb69b[0x0],_0x227ed4);}else{_0x3e304c=_0x227ed4;}}}}var _0x4a8069={'name':_0x335cc8,'description':_0x51c977,'path':path['join'](_0x4f9212,_0x7fb69b[0x0]),'type':_0xbd7684,'sidebar':_0x503b4f,'icon':_0x5bbc7e,'adminUrl':_0x302060,'agentUrl':_0x3e304c,'scriptName':_0x38e039,'scriptPath':_0x42c0cf,'version':_0x5099f2};removeReferences(_0x15c9ce,null);return db[_0x0133('0x4d')][_0x0133('0x91')](_0x4a8069)[_0x0133('0x2c')](function(_0x5bf4da){var _0x4512ac={'role':_0x322f23['body']['role'],'userProfileId':_0x322f23['body'][_0x0133('0x92')]};if(!_0x4512ac)throw new Error(_0x0133('0x93'));if(_0x4512ac[_0x0133('0x94')]==='user'){var _0x1cd706=_0x5bf4da['get']({'plain':!![]});return db[_0x0133('0x95')]['find']({'where':{'name':'Plugins','userProfileId':_0x4512ac[_0x0133('0x92')]},'raw':!![]})[_0x0133('0x2c')](function(_0x419302){if(_0x419302&&_0x419302[_0x0133('0x96')]===0x0){return db['UserProfileResource'][_0x0133('0x91')]({'name':_0x1cd706['name'],'resourceId':_0x1cd706['id'],'type':_0x419302[_0x0133('0x33')],'sectionId':_0x419302['id']},{})[_0x0133('0x2c')](function(){return _0x5bf4da;});}else{return _0x5bf4da;}})['catch'](function(_0x58bebe){logger[_0x0133('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58bebe);throw _0x58bebe;});}return _0x5bf4da;})['then'](respondWithResult(_0x5bbe28,null))['catch'](handleError(_0x5bbe28,null));}});}catch(_0xfe252e){_0x5bbe28[_0x0133('0x21')](0x1f4)[_0x0133('0x34')](_0xfe252e);}};function removeReferences(_0x37bc01,_0x1b295c){try{if(_0x37bc01){fs[_0x0133('0x64')](_0x37bc01);logger[_0x0133('0x65')](_0x0133('0x97'));}if(_0x1b295c){rimraf(_0x1b295c,function(){});logger['info'](_0x0133('0x98'));}}catch(_0x182667){logger['error'](_0x182667);}}exports[_0x0133('0x2b')]=function(_0x3ef22d,_0x1acc68,_0x2a1100){return db[_0x0133('0x4d')][_0x0133('0x50')]({'where':{'id':_0x3ef22d[_0x0133('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1acc68,null))[_0x0133('0x2c')](saveUpdates(_0x3ef22d['body'],null))[_0x0133('0x2c')](respondWithResult(_0x1acc68,null))['catch'](handleError(_0x1acc68,null));};exports[_0x0133('0x99')]=function(_0x3a1bb1,_0x466fe1,_0x9721bf){return db[_0x0133('0x4d')][_0x0133('0x50')]({'where':{'id':_0x3a1bb1[_0x0133('0x4c')]['id']}})[_0x0133('0x2c')](function(_0x197cef){if(_0x197cef){return _0x197cef[_0x0133('0x2d')]();}})[_0x0133('0x2c')](function(_0x5a7b25){rimraf(path[_0x0133('0x52')](config[_0x0133('0x53')],_0x0133('0x54'),path[_0x0133('0x5d')](_0x5a7b25[_0x0133('0x7')])),function(){});return _0x5a7b25;})[_0x0133('0x2c')](handleEntityNotFound(_0x466fe1,null))[_0x0133('0x2c')](respondWithStatusCode(_0x466fe1,null))[_0x0133('0x4a')](handleError(_0x466fe1,null));};exports[_0x0133('0x9a')]=function(_0x40a2e5,_0x559953,_0x205d1c){return BPromise[_0x0133('0x9b')]()['then'](function(){if(!_0x40a2e5[_0x0133('0x3b')]['path']){throw new Error(_0x0133('0x9c'));}if(!_0x40a2e5[_0x0133('0x3b')]['port']){throw new Error(_0x0133('0x9d'));}var _0x2a43ea=_0x40a2e5[_0x0133('0x3b')][_0x0133('0x9e')]?_0x40a2e5[_0x0133('0x3b')][_0x0133('0x9e')]+':'+_0x40a2e5[_0x0133('0x3b')]['port']:_0x0133('0x9f')+_0x40a2e5[_0x0133('0x3b')][_0x0133('0xa0')];var _0x24eda8=_0x40a2e5[_0x0133('0x3b')][_0x0133('0x28')]?_0x40a2e5[_0x0133('0x3b')][_0x0133('0x28')]:!![];var _0x295e65=_0x40a2e5[_0x0133('0x3b')][_0x0133('0xa1')]?_0x40a2e5[_0x0133('0x3b')][_0x0133('0xa1')]:null;var _0x898f67={'method':_0x40a2e5[_0x0133('0xa2')],'uri':util[_0x0133('0xa3')](_0x0133('0xa4'),_0x2a43ea,_0x40a2e5['query'][_0x0133('0x7')]),'json':_0x24eda8,'resolveWithFullResponse':!![],'encoding':_0x295e65,'qs':_0x40a2e5['query']};if(_0x40a2e5['headers']){_0x898f67[_0x0133('0xa5')]=_0x40a2e5[_0x0133('0xa5')];if(_0x898f67[_0x0133('0xa5')][_0x0133('0xa6')]){delete _0x898f67['headers'][_0x0133('0xa6')];}}if(_0x898f67[_0x0133('0xa5')][_0x0133('0xa7')]){delete _0x898f67[_0x0133('0xa5')][_0x0133('0xa7')];}return rp(_0x898f67);})[_0x0133('0x2c')](function(_0x212b63){if(_0x212b63){_0x559953[_0x0133('0x27')](_0x212b63[_0x0133('0xa5')]);logger[_0x0133('0x65')](_0x212b63[_0x0133('0xa8')]);if(_[_0x0133('0xa9')](_0x40a2e5['query']['path'],_0x0133('0x51'))&&_0x212b63[_0x0133('0xaa')]==0x1f4){return _0x559953['sendStatus'](_0x212b63['statusCode']);}else{return _0x559953[_0x0133('0x21')](_0x212b63[_0x0133('0xaa')])[_0x0133('0x34')](_0x212b63['body']);}}else{return _0x559953[_0x0133('0x20')](0xc8);}})[_0x0133('0x4a')](handleError(_0x559953,null));};exports[_0x0133('0xab')]=function(_0x26d97b,_0x140cdb,_0x4c260c){return BPromise['resolve']()[_0x0133('0x2c')](function(){if(!_0x26d97b[_0x0133('0x3b')][_0x0133('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x26d97b[_0x0133('0x3b')][_0x0133('0xa0')]){throw new Error(_0x0133('0x9d'));}var _0x4852bf=_0x26d97b[_0x0133('0x3b')]['hostname']?_0x26d97b[_0x0133('0x3b')][_0x0133('0x9e')]+':'+_0x26d97b[_0x0133('0x3b')]['port']:_0x0133('0x9f')+_0x26d97b['query']['port'];var _0x40ea85=_0x26d97b['query'][_0x0133('0x28')]?_0x26d97b[_0x0133('0x3b')][_0x0133('0x28')]:!![];var _0x28dbaf=_0x26d97b[_0x0133('0x3b')][_0x0133('0xa1')]?_0x26d97b[_0x0133('0x3b')][_0x0133('0xa1')]:null;var _0x2157ae={'method':_0x26d97b[_0x0133('0xa2')],'uri':util['format']('%s%s',_0x4852bf,_0x26d97b[_0x0133('0x3b')][_0x0133('0x7')]),'json':_0x40ea85,'resolveWithFullResponse':!![],'encoding':_0x28dbaf,'body':_0x26d97b[_0x0133('0xa8')]};if(_0x26d97b[_0x0133('0xa5')]){_0x2157ae[_0x0133('0xa5')]=_0x26d97b[_0x0133('0xa5')];if(_0x2157ae[_0x0133('0xa5')][_0x0133('0xa6')]){delete _0x2157ae[_0x0133('0xa5')]['content-length'];}}if(_0x2157ae[_0x0133('0xa5')][_0x0133('0xa7')]){delete _0x2157ae[_0x0133('0xa5')][_0x0133('0xa7')];}return rp(_0x2157ae);})[_0x0133('0x2c')](function(_0x82bb41){if(_0x82bb41){_0x140cdb[_0x0133('0x27')](_0x82bb41[_0x0133('0xa5')]);logger[_0x0133('0x65')](_0x82bb41['body']);return _0x140cdb[_0x0133('0x21')](_0x82bb41[_0x0133('0xaa')])[_0x0133('0x34')](_0x82bb41[_0x0133('0xa8')]);}else{return _0x140cdb[_0x0133('0x20')](0xc8);}})[_0x0133('0x4a')](handleError(_0x140cdb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4683066..228ba1a 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 _0x7412=['setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x28b254,_0x20c0cd){var _0x1a1f34=function(_0x2bcdaf){while(--_0x2bcdaf){_0x28b254['push'](_0x28b254['shift']());}};_0x1a1f34(++_0x20c0cd);}(_0x7412,0x161));var _0x2741=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x7412[_0x4fbfd9];return _0x31dc94;};'use strict';var EventEmitter=require(_0x2741('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x2741('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2741('0x2'),'afterDestroy':'remove'};function emitEvent(_0x51d3c5){return function(_0x509ce6,_0x552836,_0x521b65){PluginEvents['emit'](_0x51d3c5+':'+_0x509ce6['id'],_0x509ce6);PluginEvents[_0x2741('0x3')](_0x51d3c5,_0x509ce6);_0x521b65(null);};}for(var e in events){if(events[_0x2741('0x4')](e)){var event=events[e];Plugin[_0x2741('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xbbbd=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x387623,_0x8e3ce0){var _0x2780d6=function(_0x56ede5){while(--_0x56ede5){_0x387623['push'](_0x387623['shift']());}};_0x2780d6(++_0x8e3ce0);}(_0xbbbd,0x86));var _0xdbbb=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xbbbd[_0xbf8ebe];return _0x1e25e8;};'use strict';var EventEmitter=require(_0xdbbb('0x0'));var Plugin=require(_0xdbbb('0x1'))['db'][_0xdbbb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xdbbb('0x3')](0x0);var events={'afterCreate':_0xdbbb('0x4'),'afterUpdate':_0xdbbb('0x5'),'afterDestroy':_0xdbbb('0x6')};function emitEvent(_0x3351fb){return function(_0x3b665d,_0x114d3a,_0x1cd8ad){PluginEvents[_0xdbbb('0x7')](_0x3351fb+':'+_0x3b665d['id'],_0x3b665d);PluginEvents['emit'](_0x3351fb,_0x3b665d);_0x1cd8ad(null);};}for(var e in events){if(events[_0xdbbb('0x8')](e)){var event=events[e];Plugin[_0xdbbb('0x9')](e,emitEvent(event));}}module[_0xdbbb('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e6b47f0..823572c 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 _0x20c4=['Plugin','plugins','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','define'];(function(_0x1b58e7,_0x47add7){var _0x348227=function(_0x3ebbbf){while(--_0x3ebbbf){_0x1b58e7['push'](_0x1b58e7['shift']());}};_0x348227(++_0x47add7);}(_0x20c4,0xbd));var _0x420c=function(_0x1f9d92,_0x2b8162){_0x1f9d92=_0x1f9d92-0x0;var _0x4bd38f=_0x20c4[_0x1f9d92];return _0x4bd38f;};'use strict';var _=require(_0x420c('0x0'));var util=require(_0x420c('0x1'));var logger=require(_0x420c('0x2'))(_0x420c('0x3'));var moment=require(_0x420c('0x4'));var BPromise=require('bluebird');var rp=require(_0x420c('0x5'));var fs=require('fs');var path=require(_0x420c('0x6'));var rimraf=require('rimraf');var config=require(_0x420c('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x4670ae,_0x3b97bc){return _0x4670ae[_0x420c('0x8')](_0x420c('0x9'),attributes,{'tableName':_0x420c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7515=['util','api','bluebird','request-promise','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x3810c6,_0x33754b){var _0x7d2d5a=function(_0x50e9bf){while(--_0x50e9bf){_0x3810c6['push'](_0x3810c6['shift']());}};_0x7d2d5a(++_0x33754b);}(_0x7515,0x82));var _0x5751=function(_0xda5c34,_0x37ab57){_0xda5c34=_0xda5c34-0x0;var _0x4bba27=_0x7515[_0xda5c34];return _0x4bba27;};'use strict';var _=require('lodash');var util=require(_0x5751('0x0'));var logger=require('../../config/logger')(_0x5751('0x1'));var moment=require('moment');var BPromise=require(_0x5751('0x2'));var rp=require(_0x5751('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5751('0x4'));var attributes=require(_0x5751('0x5'));module[_0x5751('0x6')]=function(_0x118b33,_0x4d9476){return _0x118b33[_0x5751('0x7')](_0x5751('0x8'),attributes,{'tableName':_0x5751('0x9'),'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 f329413..a2a308e 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 _0x291f=['register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','debug','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x54dd6e,_0x1897e8){var _0x1ae0be=function(_0x248643){while(--_0x248643){_0x54dd6e['push'](_0x54dd6e['shift']());}};_0x1ae0be(++_0x1897e8);}(_0x291f,0x84));var _0xf291=function(_0x267bc3,_0x8c525d){_0x267bc3=_0x267bc3-0x0;var _0x4a6226=_0x291f[_0x267bc3];return _0x4a6226;};'use strict';var _=require(_0xf291('0x0'));var util=require(_0xf291('0x1'));var moment=require('moment');var BPromise=require(_0xf291('0x2'));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(_0xf291('0x3'))(_0xf291('0x4'));var config=require(_0xf291('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf291('0x6')]['http']({'port':0x232a});config[_0xf291('0x7')]=_['defaults'](config[_0xf291('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf291('0x7')]));require('./plugin.socket')[_0xf291('0x8')](socket);function respondWithRpcPromise(_0x45f190,_0x10dc8e,_0x3b5cc0){return new BPromise(function(_0x373295,_0x76ddfe){return client[_0xf291('0x9')](_0x45f190,_0x3b5cc0)[_0xf291('0xa')](function(_0x541eee){logger[_0xf291('0xb')](_0xf291('0xc'),_0x10dc8e,_0xf291('0xd'));logger['debug'](_0xf291('0xe'),_0x10dc8e,_0xf291('0xd'),JSON[_0xf291('0xf')](_0x541eee));if(_0x541eee[_0xf291('0x10')]){if(_0x541eee[_0xf291('0x10')][_0xf291('0x11')]===0x1f4){logger[_0xf291('0x10')](_0xf291('0xc'),_0x10dc8e,_0x541eee['error'][_0xf291('0x12')]);return _0x76ddfe(_0x541eee[_0xf291('0x10')][_0xf291('0x12')]);}logger[_0xf291('0x10')](_0xf291('0xc'),_0x10dc8e,_0x541eee[_0xf291('0x10')][_0xf291('0x12')]);return _0x373295(_0x541eee[_0xf291('0x10')][_0xf291('0x12')]);}else{logger[_0xf291('0xb')]('Plugin,\x20%s,\x20%s',_0x10dc8e,'request\x20sent');_0x373295(_0x541eee[_0xf291('0x13')]['message']);}})[_0xf291('0x14')](function(_0x571fae){logger[_0xf291('0x10')](_0xf291('0xc'),_0x10dc8e,_0x571fae);_0x76ddfe(_0x571fae);});});}exports[_0xf291('0x15')]=function(_0x2e5501){var _0x36c543=this;return new Promise(function(_0x841a0c,_0x392998){return db[_0xf291('0x16')][_0xf291('0x17')](_0x2e5501[_0xf291('0x18')],{'raw':_0x2e5501['options']?_0x2e5501[_0xf291('0x19')][_0xf291('0x1a')]===undefined?!![]:![]:!![]})[_0xf291('0xa')](function(_0x1df249){logger['info'](_0xf291('0x15'),_0x2e5501);logger[_0xf291('0x1b')]('CreatePlugin',_0x2e5501,JSON[_0xf291('0xf')](_0x1df249));_0x841a0c(_0x1df249);})[_0xf291('0x14')](function(_0x2802e8){logger[_0xf291('0x10')]('CreatePlugin',_0x2802e8[_0xf291('0x12')],_0x2e5501);_0x392998(_0x36c543['error'](0x1f4,_0x2802e8['message']));});});}; \ No newline at end of file +var _0x721e=['catch','CreatePlugin','Plugin','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2997da,_0x35e1a6){var _0x43f745=function(_0x48b056){while(--_0x48b056){_0x2997da['push'](_0x2997da['shift']());}};_0x43f745(++_0x35e1a6);}(_0x721e,0x188));var _0xe721=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x721e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe721('0x0'));var util=require(_0xe721('0x1'));var moment=require(_0xe721('0x2'));var BPromise=require(_0xe721('0x3'));var rs=require(_0xe721('0x4'));var fs=require('fs');var Redis=require(_0xe721('0x5'));var db=require(_0xe721('0x6'))['db'];var utils=require(_0xe721('0x7'));var logger=require(_0xe721('0x8'))(_0xe721('0x9'));var config=require(_0xe721('0xa'));var jayson=require(_0xe721('0xb'));var client=jayson['client'][_0xe721('0xc')]({'port':0x232a});config[_0xe721('0xd')]=_['defaults'](config[_0xe721('0xd')],{'host':_0xe721('0xe'),'port':0x18eb});var socket=require(_0xe721('0xf'))(new Redis(config['redis']));require(_0xe721('0x10'))['register'](socket);function respondWithRpcPromise(_0xcfe1c6,_0x58add5,_0x36350e){return new BPromise(function(_0x32479d,_0x162d59){return client[_0xe721('0x11')](_0xcfe1c6,_0x36350e)[_0xe721('0x12')](function(_0x129a1e){logger[_0xe721('0x13')](_0xe721('0x14'),_0x58add5,_0xe721('0x15'));logger[_0xe721('0x16')](_0xe721('0x17'),_0x58add5,_0xe721('0x15'),JSON['stringify'](_0x129a1e));if(_0x129a1e[_0xe721('0x18')]){if(_0x129a1e['error'][_0xe721('0x19')]===0x1f4){logger['error'](_0xe721('0x14'),_0x58add5,_0x129a1e[_0xe721('0x18')][_0xe721('0x1a')]);return _0x162d59(_0x129a1e[_0xe721('0x18')]['message']);}logger[_0xe721('0x18')](_0xe721('0x14'),_0x58add5,_0x129a1e[_0xe721('0x18')][_0xe721('0x1a')]);return _0x32479d(_0x129a1e['error'][_0xe721('0x1a')]);}else{logger[_0xe721('0x13')](_0xe721('0x14'),_0x58add5,_0xe721('0x15'));_0x32479d(_0x129a1e[_0xe721('0x1b')][_0xe721('0x1a')]);}})[_0xe721('0x1c')](function(_0x1c33c5){logger[_0xe721('0x18')](_0xe721('0x14'),_0x58add5,_0x1c33c5);_0x162d59(_0x1c33c5);});});}exports[_0xe721('0x1d')]=function(_0x44ffac){var _0x27d1fd=this;return new Promise(function(_0x477310,_0x37f160){return db[_0xe721('0x1e')][_0xe721('0x1f')](_0x44ffac['body'],{'raw':_0x44ffac[_0xe721('0x20')]?_0x44ffac[_0xe721('0x20')][_0xe721('0x21')]===undefined?!![]:![]:!![]})[_0xe721('0x12')](function(_0x15f50f){logger[_0xe721('0x13')]('CreatePlugin',_0x44ffac);logger[_0xe721('0x16')](_0xe721('0x1d'),_0x44ffac,JSON[_0xe721('0x22')](_0x15f50f));_0x477310(_0x15f50f);})['catch'](function(_0x4a3f81){logger[_0xe721('0x18')](_0xe721('0x1d'),_0x4a3f81[_0xe721('0x1a')],_0x44ffac);_0x37f160(_0x27d1fd[_0xe721('0x18')](0x1f4,_0x4a3f81['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 7d54600..5cf3eec 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 _0xe598=['register','length','plugin:','remove','update','emit','removeListener'];(function(_0x155bbf,_0x1bca34){var _0x1cb0ac=function(_0x101c7c){while(--_0x101c7c){_0x155bbf['push'](_0x155bbf['shift']());}};_0x1cb0ac(++_0x1bca34);}(_0xe598,0x145));var _0x8e59=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0xe598[_0x258b93];return _0x35484b;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x8e59('0x0'),_0x8e59('0x1')];function createListener(_0x52262d,_0x4c1157){return function(_0x2f89e1){_0x4c1157[_0x8e59('0x2')](_0x52262d,_0x2f89e1);};}function removeListener(_0x4ac451,_0x449a37){return function(){PluginEvents[_0x8e59('0x3')](_0x4ac451,_0x449a37);};}exports[_0x8e59('0x4')]=function(_0x1f10b7){for(var _0x5d60bb=0x0,_0x2aee9d=events[_0x8e59('0x5')];_0x5d60bb<_0x2aee9d;_0x5d60bb++){var _0x174683=events[_0x5d60bb];var _0x3223f5=createListener(_0x8e59('0x6')+_0x174683,_0x1f10b7);PluginEvents['on'](_0x174683,_0x3223f5);}}; \ No newline at end of file +var _0x46e2=['plugin:','./plugin.events','save','update','register','length'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x46e2,0xf7));var _0x246e=function(_0x3c0f40,_0x2ddfdf){_0x3c0f40=_0x3c0f40-0x0;var _0x3caebd=_0x46e2[_0x3c0f40];return _0x3caebd;};'use strict';var PluginEvents=require(_0x246e('0x0'));var events=[_0x246e('0x1'),'remove',_0x246e('0x2')];function createListener(_0x1e8c5e,_0x222211){return function(_0x35e32c){_0x222211['emit'](_0x1e8c5e,_0x35e32c);};}function removeListener(_0x369d8,_0x1c108c){return function(){PluginEvents['removeListener'](_0x369d8,_0x1c108c);};}exports[_0x246e('0x3')]=function(_0x74fc9d){for(var _0x13097=0x0,_0x4f879d=events[_0x246e('0x4')];_0x13097<_0x4f879d;_0x13097++){var _0x479afb=events[_0x13097];var _0x50f113=createListener(_0x246e('0x5')+_0x479afb,_0x74fc9d);PluginEvents['on'](_0x479afb,_0x50f113);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f9a898e..7691c8a 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(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x33d5cc,_0x3b88f9){var _0x2b0e=function(_0x4be9fa){while(--_0x4be9fa){_0x33d5cc['push'](_0x33d5cc['shift']());}};_0x2b0e(++_0x3b88f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 6066e8a..f86e697 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 _0x1d2d=['reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then'];(function(_0x568aae,_0x3b0b5c){var _0x291f71=function(_0x3bc4dc){while(--_0x3bc4dc){_0x568aae['push'](_0x568aae['shift']());}};_0x291f71(++_0x3b0b5c);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x22d4ad,_0xb500fe){_0x22d4ad=_0x22d4ad-0x0;var _0x5e0ab4=_0x1d2d[_0x22d4ad];return _0x5e0ab4;};'use strict';var _=require(_0xd1d2('0x0'));var pm2=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var path=require(_0xd1d2('0x4'));var exec=require('child_process')[_0xd1d2('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5d3fac,_0x3caa72){return function(_0x2bfabc){if(!_0x2bfabc){_0x5d3fac[_0xd1d2('0x6')](0x194);;}return _0x2bfabc;};}function respondWithResult(_0x269613,_0x2f930d){_0x2f930d=_0x2f930d||0xc8;return function(_0x353dbd){if(_0x353dbd){return _0x269613['status'](_0x2f930d)[_0xd1d2('0x7')](_0x353dbd);}return null;};}function handleError(_0x21bc28,_0x35735f){_0x35735f=_0x35735f||0x1f4;return function(_0x37ff2a){logger[_0xd1d2('0x8')](_0x37ff2a[_0xd1d2('0x9')]);if(_0x37ff2a[_0xd1d2('0xa')]){delete _0x37ff2a[_0xd1d2('0xa')];}_0x21bc28[_0xd1d2('0xb')](_0x35735f)[_0xd1d2('0xc')](_0x37ff2a);};}function execChildProcess(){return new BPromise(function(_0x900ec,_0x227d7f){exec(_0xd1d2('0xd'),function(_0x5b21f4,_0x41fcb5,_0x1f49ed){logger[_0xd1d2('0xe')](_0x41fcb5);logger[_0xd1d2('0xe')](_0x1f49ed);if(_0x5b21f4){logger[_0xd1d2('0x8')](_0x5b21f4);return _0x227d7f(_0x5b21f4);}return _0x900ec(_0x41fcb5);});});}exports[_0xd1d2('0xf')]=function(_0x2df8a5,_0x31dc84){return pm2[_0xd1d2('0x10')]()[_0xd1d2('0x11')](function(_0x4cf702){if(_0x4cf702){var _0x2e7fec=_[_0xd1d2('0x12')](_0x4cf702,function(_0x3476f8){return _0x3476f8['name']===_0xd1d2('0x13')||_0x3476f8[_0xd1d2('0xa')]===_0xd1d2('0x14');});return{'rows':_0x2e7fec,'count':_0x2e7fec[_0xd1d2('0x15')]};}return null;})[_0xd1d2('0x11')](respondWithResult(_0x31dc84,null))[_0xd1d2('0x16')](handleError(_0x31dc84,null));};exports[_0xd1d2('0x17')]=function(_0x57f2f9,_0x539d5a){return pm2[_0xd1d2('0x18')](_0x57f2f9['params']['id'])[_0xd1d2('0x11')](respondWithResult(_0x539d5a,null))[_0xd1d2('0x11')](handleEntityNotFound(_0x539d5a,null))[_0xd1d2('0x16')](handleError(_0x539d5a,null));};exports[_0xd1d2('0x19')]=function(_0x4ab386,_0x4f1201){if(_0x4ab386[_0xd1d2('0x1a')]['name']&&_0x4ab386['body'][_0xd1d2('0x1b')]){var _0x27e26b=path[_0xd1d2('0x1c')](__dirname,_0xd1d2('0x1d'),_0x4ab386['body'][_0xd1d2('0x1b')]);var _0xbb4d27=process[_0xd1d2('0x1e')]();process['chdir'](path['dirname'](_0x27e26b));return execChildProcess()[_0xd1d2('0x11')](function(_0x3a1078){process[_0xd1d2('0x1f')](_0xbb4d27);return pm2[_0xd1d2('0x20')]({'name':_0x4ab386[_0xd1d2('0x1a')][_0xd1d2('0xa')],'script':_0x27e26b});})[_0xd1d2('0x11')](function(_0x5df4af){pm2[_0xd1d2('0x21')]();return _0x5df4af[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x4f1201,0xc9))[_0xd1d2('0x16')](handleError(_0x4f1201,null));}else{return _0x4f1201[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x22')});}};exports[_0xd1d2('0x23')]=function(_0x34faf7,_0xe6ef3c){if(_0x34faf7[_0xd1d2('0x1a')]['id']){delete _0x34faf7[_0xd1d2('0x1a')]['id'];}var _0x4e1bc2={'online':'restart','stopped':_0xd1d2('0x24')};if(_0x4e1bc2[_0xd1d2('0x25')](_0x34faf7[_0xd1d2('0x1a')][_0xd1d2('0xb')])){return pm2[_0x4e1bc2[_0x34faf7[_0xd1d2('0x1a')]['status']]](_0x34faf7[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](respondWithResult(_0xe6ef3c,0xc8))[_0xd1d2('0x16')](handleError(_0xe6ef3c,null));}else{return _0xe6ef3c['status'](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x27')});}};exports[_0xd1d2('0x28')]=function(_0x56557d,_0x419db7){if(_0x56557d[_0xd1d2('0x1a')]['id']){delete _0x56557d[_0xd1d2('0x1a')]['id'];}if(_0x56557d[_0xd1d2('0x26')]['id']){return pm2[_0xd1d2('0x29')](_0x56557d[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](function(_0x322f50){pm2[_0xd1d2('0x21')]();return _0x322f50[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x419db7,null))[_0xd1d2('0x16')](handleError(_0x419db7,null));}else{return _0x419db7[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x2a')});}}; \ No newline at end of file +var _0xb43b=['stack','name','send','npm\x20install','info','index','list','express','then','describe','catch','create','body','script','join','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xb43b,0x1b2));var _0xbb43=function(_0x12f303,_0x5992a7){_0x12f303=_0x12f303-0x0;var _0x376ef1=_0xb43b[_0x12f303];return _0x376ef1;};'use strict';var _=require(_0xbb43('0x0'));var pm2=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var path=require(_0xbb43('0x3'));var exec=require(_0xbb43('0x4'))['exec'];var BPromise=require(_0xbb43('0x5'));function handleEntityNotFound(_0x41aff6,_0x351254){return function(_0x16432a){if(!_0x16432a){_0x41aff6['sendStatus'](0x194);;}return _0x16432a;};}function respondWithResult(_0x491fb9,_0x378df5){_0x378df5=_0x378df5||0xc8;return function(_0x553520){if(_0x553520){return _0x491fb9[_0xbb43('0x6')](_0x378df5)[_0xbb43('0x7')](_0x553520);}return null;};}function handleError(_0x2a2f11,_0x29ae1a){_0x29ae1a=_0x29ae1a||0x1f4;return function(_0x364718){logger['error'](_0x364718[_0xbb43('0x8')]);if(_0x364718[_0xbb43('0x9')]){delete _0x364718['name'];}_0x2a2f11[_0xbb43('0x6')](_0x29ae1a)[_0xbb43('0xa')](_0x364718);};}function execChildProcess(){return new BPromise(function(_0xd37cdf,_0x5e3611){exec(_0xbb43('0xb'),function(_0x2bef86,_0x480cc2,_0x36a473){logger[_0xbb43('0xc')](_0x480cc2);logger['info'](_0x36a473);if(_0x2bef86){logger['error'](_0x2bef86);return _0x5e3611(_0x2bef86);}return _0xd37cdf(_0x480cc2);});});}exports[_0xbb43('0xd')]=function(_0x4a3714,_0x593d0b){return pm2[_0xbb43('0xe')]()['then'](function(_0x68d45d){if(_0x68d45d){var _0x43021d=_['reject'](_0x68d45d,function(_0x4a6e18){return _0x4a6e18['name']===_0xbb43('0xf')||_0x4a6e18[_0xbb43('0x9')]==='motion2';});return{'rows':_0x43021d,'count':_0x43021d['length']};}return null;})[_0xbb43('0x10')](respondWithResult(_0x593d0b,null))['catch'](handleError(_0x593d0b,null));};exports['show']=function(_0x2b0797,_0x8242ab){return pm2[_0xbb43('0x11')](_0x2b0797['params']['id'])[_0xbb43('0x10')](respondWithResult(_0x8242ab,null))['then'](handleEntityNotFound(_0x8242ab,null))[_0xbb43('0x12')](handleError(_0x8242ab,null));};exports[_0xbb43('0x13')]=function(_0x4dfc54,_0x5d765b){if(_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')]&&_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x15')]){var _0x5bcce7=path[_0xbb43('0x16')](__dirname,'../../files/plugins',_0x4dfc54[_0xbb43('0x14')]['script']);var _0x2f5e31=process['cwd']();process[_0xbb43('0x17')](path[_0xbb43('0x18')](_0x5bcce7));return execChildProcess()['then'](function(_0x1d0768){process['chdir'](_0x2f5e31);return pm2[_0xbb43('0x19')]({'name':_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')],'script':_0x5bcce7});})['then'](function(_0x53f0d5){pm2['dump']();return _0x53f0d5[0x0];})[_0xbb43('0x10')](respondWithResult(_0x5d765b,0xc9))[_0xbb43('0x12')](handleError(_0x5d765b,null));}else{return _0x5d765b['status'](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x1a')});}};exports[_0xbb43('0x1b')]=function(_0x3874fb,_0x4ed43f){if(_0x3874fb['body']['id']){delete _0x3874fb[_0xbb43('0x14')]['id'];}var _0x42800f={'online':_0xbb43('0x1c'),'stopped':_0xbb43('0x1d')};if(_0x42800f[_0xbb43('0x1e')](_0x3874fb[_0xbb43('0x14')][_0xbb43('0x6')])){return pm2[_0x42800f[_0x3874fb[_0xbb43('0x14')]['status']]](_0x3874fb[_0xbb43('0x1f')]['id'])['then'](respondWithResult(_0x4ed43f,0xc8))[_0xbb43('0x12')](handleError(_0x4ed43f,null));}else{return _0x4ed43f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x20')});}};exports['destroy']=function(_0x157d62,_0x547a6f){if(_0x157d62['body']['id']){delete _0x157d62['body']['id'];}if(_0x157d62[_0xbb43('0x1f')]['id']){return pm2['delete'](_0x157d62[_0xbb43('0x1f')]['id'])[_0xbb43('0x10')](function(_0xc577ac){pm2['dump']();return _0xc577ac[0x0];})[_0xbb43('0x10')](respondWithResult(_0x547a6f,null))[_0xbb43('0x12')](handleError(_0x547a6f,null));}else{return _0x547a6f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x21')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index c73348f..b0c1d9e 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 _0x22b5=['isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x22b5,0x186));var _0x522b=function(_0x2f83a3,_0x50ee38){_0x2f83a3=_0x2f83a3-0x0;var _0x16b2b4=_0x22b5[_0x2f83a3];return _0x16b2b4;};'use strict';var express=require(_0x522b('0x0'));var router=express[_0x522b('0x1')]();var auth=require(_0x522b('0x2'));var controller=require(_0x522b('0x3'));router[_0x522b('0x4')](_0x522b('0x5'),auth[_0x522b('0x6')](),controller[_0x522b('0x7')]);router[_0x522b('0x4')](_0x522b('0x8'),auth[_0x522b('0x6')](),controller[_0x522b('0x9')]);module[_0x522b('0xa')]=router; \ No newline at end of file +var _0x94a5=['get','/agents','isAuthenticated','getAgents','/queues','exports','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x5a5242,_0x1b1e6f){var _0x33bf2c=function(_0x2f2ec9){while(--_0x2f2ec9){_0x5a5242['push'](_0x5a5242['shift']());}};_0x33bf2c(++_0x1b1e6f);}(_0x94a5,0x74));var _0x594a=function(_0xffd2fe,_0x30a3b8){_0xffd2fe=_0xffd2fe-0x0;var _0xf387b4=_0x94a5[_0xffd2fe];return _0xf387b4;};'use strict';var express=require(_0x594a('0x0'));var router=express[_0x594a('0x1')]();var auth=require(_0x594a('0x2'));var controller=require(_0x594a('0x3'));router[_0x594a('0x4')](_0x594a('0x5'),auth[_0x594a('0x6')](),controller[_0x594a('0x7')]);router[_0x594a('0x4')](_0x594a('0x8'),auth[_0x594a('0x6')](),controller['getQueues']);module[_0x594a('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 924a74a..32e87fd 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 _0xb352=['online','assign','rows','map','getAgentStatus','includes','voice','talking','Status','getRealtimeAgentsQueryFields','getQueues','toLowerCase','startCase','key','fields','outbound','dialMethod','QueueCampaigns','name','filter','UserProfile','getResources','findAndCountAll','getRealtimeQueues','catch','lodash','util','../../components/realtime/queues','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','limit','count','offset','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','role','agent','getOptions','push','sequelize','literal','forEach','*pause','Pause','merge','where','user','Agents'];(function(_0x439482,_0x7315b9){var _0x6ef0f5=function(_0x3c6ff6){while(--_0x3c6ff6){_0x439482['push'](_0x439482['shift']());}};_0x6ef0f5(++_0x7315b9);}(_0xb352,0x14d));var _0x2b35=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb352[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x2b35('0x0'));var util=require(_0x2b35('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x2b35('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0x2b35('0x3'));var db=require(_0x2b35('0x4'))['db'];var APIBadRequestError=require('../../errors/api')[_0x2b35('0x5')];var APIHandleError=require(_0x2b35('0x6'))['handleError'];function respondWithFilteredResult(_0x1e3a59,_0x5b4327){return function(_0x1a592f){if(_0x1a592f){var _0x3d0776=typeof _0x5b4327['offset']==='undefined'&&typeof _0x5b4327[_0x2b35('0x7')]==='undefined';var _0x2e06f4=_0x1a592f[_0x2b35('0x8')];var _0x32a784=_0x3d0776?0x0:_0x5b4327['offset'];var _0x406059=_0x3d0776?_0x1a592f[_0x2b35('0x8')]:_0x5b4327[_0x2b35('0x9')]+_0x5b4327[_0x2b35('0x7')];var _0xc38d3b;if(_0x406059>=_0x2e06f4){_0x406059=_0x2e06f4;_0xc38d3b=0xc8;}else{_0xc38d3b=0xce;}_0x1e3a59[_0x2b35('0xa')](_0xc38d3b);return _0x1e3a59[_0x2b35('0xb')](_0x2b35('0xc'),_0x32a784+'-'+_0x406059+'/'+_0x2e06f4)['json'](_0x1a592f);}return null;};}exports[_0x2b35('0xd')]=function(_0x1d96be,_0x19dfdf){var _0x429556={'count':0x0,'rows':[]};var _0x274ea8={};var _0x122d94;var _0x18330d=utils[_0x2b35('0xe')]();var _0x58c491;var _0x25132d;var _0x5b3c08=_0x1d96be[_0x2b35('0xf')][_0x2b35('0x10')];var _0x1990f4=_0x1d96be[_0x2b35('0xf')]['globalStatusFilter'];var _0x44379d=_0x1d96be['query'][_0x2b35('0x11')];var _0x33bbe9=_0x1990f4===_0x2b35('0x12')||_0x1990f4==='*pause'?!![]:![];var _0x3e8667=[];var _0x5082e2;var _0xbd6616;Promise[_0x2b35('0x13')]()[_0x2b35('0x14')](function(){if(_0x1d96be['query'][_0x2b35('0x15')]){if(!utils[_0x2b35('0x16')](_0x1d96be[_0x2b35('0xf')][_0x2b35('0x15')])){throw new APIBadRequestError(util[_0x2b35('0x17')](_0x2b35('0x18'),_0x1d96be[_0x2b35('0xf')]['channel']));}_0x122d94=_0x1d96be[_0x2b35('0xf')][_0x2b35('0x15')]['toLowerCase']();}if(!_0x1d96be[_0x2b35('0xf')][_0x2b35('0x19')]||!_0x1d96be['query']['sort']['includes'](_0x2b35('0x1a'))){_0x1d96be[_0x2b35('0xf')][_0x2b35('0x19')]=rta[_0x2b35('0x1b')](_0x1d96be['query'][_0x2b35('0x19')]);return;}var _0x10a422=rta[_0x2b35('0x1c')](_0x1d96be[_0x2b35('0xf')][_0x2b35('0x19')]);_0x1d96be['query']['sort']=_0x10a422['fields']['join'](',');_0x5082e2=_0x10a422[_0x2b35('0x1d')];})['then'](function(){if(!_0x5b3c08){return[];}return rta[_0x2b35('0x1e')](_0x5b3c08,_0x122d94);})['then'](function(_0x2d929d){_0x3e8667=_0x2d929d;return rta[_0x2b35('0x1f')]();})[_0x2b35('0x14')](function(_0x2ae86d){_0x25132d=_0x2ae86d['rows'];if((!_0x1990f4||_0x33bbe9)&&!_0x5082e2){return _0x3e8667;}if(_0x5082e2&&!_0x1990f4){return rta[_0x2b35('0x20')](_0x25132d,_0x3e8667,_0x5082e2);}else{return rta[_0x2b35('0x21')](_0x25132d,_0x3e8667,_0x1990f4);}})[_0x2b35('0x14')](function(_0x597696){_0x3e8667=_0x597696;var _0x341bdc=![];if(_0x3e8667[_0x2b35('0x22')]===0x0){if(_0x5b3c08||_0x1990f4){_0x341bdc=!![];}if(_0x33bbe9){_0x341bdc=![];}}if(_0x341bdc){return _0x429556;}var _0x5d3998=_['map'](db[_0x2b35('0x23')][_0x2b35('0x24')],function(_0x59122d){return{'name':_0x59122d[_0x2b35('0x25')],'type':_0x59122d[_0x2b35('0x26')]['key']};});_0x1d96be[_0x2b35('0xf')][_0x2b35('0x27')]=_0x2b35('0x28');_0x274ea8=qs[_0x2b35('0x29')](_0x5d3998,_0x1d96be);_0x274ea8['raw']=!![];var _0x4432d8=[];if(_0x3e8667[_0x2b35('0x22')]>0x0){_0x4432d8[_0x2b35('0x2a')]({'id':{'$in':_0x3e8667}});if(_0x5082e2&&!_0x1990f4){_0xbd6616=[db[_0x2b35('0x2b')][_0x2b35('0x2c')]('FIELD(id,'+_0x3e8667+')')];_0x274ea8[_0x2b35('0x1d')]=_0xbd6616;}}if(_0x33bbe9){_0x18330d[_0x2b35('0x2d')](function(_0x126258){var _0x3f0985=!![];if(_0x1990f4===_0x2b35('0x2e')&&_0x122d94!==_0x126258){_0x3f0985=![];}_0x4432d8[_0x2b35('0x2a')]({[_0x126258+'Pause']:_0x3f0985});});if(_0x44379d){_0x4432d8[_0x2b35('0x2a')]({'pauseType':_0x44379d});}}else if(_0x1990f4){_0x18330d[_0x2b35('0x2d')](function(_0x3a45da){_0x4432d8['push']({[_0x3a45da+_0x2b35('0x2f')]:![]});});}_0x274ea8['where']=_[_0x2b35('0x30')](_0x274ea8[_0x2b35('0x31')],{'$and':_0x4432d8});if(_0x1d96be[_0x2b35('0x32')][_0x2b35('0x27')]==='user'){var _0x316e39={'params':{'id':_0x1d96be[_0x2b35('0x32')]['userProfileId']},'query':{'section':_0x2b35('0x33'),'role':_0x2b35('0x28'),'raw':!![],'ids':_0x3e8667,'customSorting':_0xbd6616}};if(_0x1d96be[_0x2b35('0xf')][_0x2b35('0x34')]){_0x316e39[_0x2b35('0xf')][_0x2b35('0x34')]=!![];}if(_0x33bbe9){_0x316e39[_0x2b35('0xf')]['extraQueryConditions']=_0x4432d8;}_0x316e39['query']=Object[_0x2b35('0x35')](_0x316e39[_0x2b35('0xf')],_0x1d96be['query']);return db['UserProfile']['getResources'](_0x316e39);}return db[_0x2b35('0x23')]['findAndCountAll'](_0x274ea8);})[_0x2b35('0x14')](function(_0xed26b4){_0x429556['count']=_0xed26b4['count'];_0x58c491=_0xed26b4[_0x2b35('0x36')];return _0x58c491[_0x2b35('0x37')](function(_0x16c429){var _0x59894b=_['find'](_0x25132d,['id',_0x16c429['id']]);if(_0x59894b){var _0xb3083c=rta['filterAgentAttributes'](_0x59894b);_[_0x2b35('0x30')](_0x16c429,_0xb3083c);}_0x16c429[_0x2b35('0x1a')]=rta[_0x2b35('0x38')](_0x16c429);if(_0x16c429[_0x2b35('0x1a')][_0x2b35('0x39')]('pause')){_0x18330d[_0x2b35('0x2d')](function(_0x18cb5a){if(_0x16c429[_0x18cb5a+_0x2b35('0x2f')]){if(_0x18cb5a===_0x2b35('0x3a')){if(_0x16c429['voiceStatus']!==_0x2b35('0x3b')){_0x16c429['voiceStatus']=_0x2b35('0x12');}}else{_0x16c429[_0x18cb5a+_0x2b35('0x3c')]=_0x2b35('0x12');}}});}return _0x16c429;});})[_0x2b35('0x14')](function(_0x3455ac){if(!_0x5082e2||_0xbd6616){return _0x3455ac;}return rta['sortAgentsByStatus'](_0x3455ac,_0x5082e2);})[_0x2b35('0x14')](function(_0x4e7485){var _0x5c212b=rta[_0x2b35('0x3d')]();_0x429556[_0x2b35('0x36')]=_0x4e7485[_0x2b35('0x37')](function(_0x1a8f43){return _['pick'](_0x1a8f43,_0x5c212b);});return _0x429556;})[_0x2b35('0x14')](respondWithFilteredResult(_0x19dfdf,_0x274ea8))['catch'](APIHandleError(_0x19dfdf));};exports[_0x2b35('0x3e')]=function(_0x4f7960,_0x17a880){var _0x56d496={'count':0x0,'rows':[]};var _0x36d2c0={};var _0x587117;var _0x554857;var _0x589f19;Promise[_0x2b35('0x13')]()[_0x2b35('0x14')](function(){if(_0x4f7960[_0x2b35('0xf')][_0x2b35('0x15')]){if(!utils[_0x2b35('0x16')](_0x4f7960[_0x2b35('0xf')][_0x2b35('0x15')])){throw new APIBadRequestError(util[_0x2b35('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4f7960[_0x2b35('0xf')]['channel']));}_0x587117=_0x4f7960[_0x2b35('0xf')]['channel'][_0x2b35('0x3f')]();}var _0x3e7e9d=_[_0x2b35('0x40')](_0x587117)+'Queue';var _0x20eeae=_[_0x2b35('0x37')](db[_0x3e7e9d]['rawAttributes'],function(_0x545c4c){return{'name':_0x545c4c[_0x2b35('0x25')],'type':_0x545c4c['type'][_0x2b35('0x41')]};});if(!_0x4f7960['query'][_0x2b35('0x42')]){var _0x1a0d11=['id','name'];if(_0x587117===_0x2b35('0x3a')){_0x1a0d11[_0x2b35('0x2a')]('type');if(_0x4f7960['query']['type']===_0x2b35('0x43')){_0x1a0d11[_0x2b35('0x2a')](['dialActive',_0x2b35('0x44')]);}}_0x4f7960[_0x2b35('0xf')][_0x2b35('0x42')]=_0x1a0d11['join'](',');}_0x36d2c0=qs[_0x2b35('0x29')](_0x20eeae,_0x4f7960);if(_0x4f7960[_0x2b35('0x32')]['role']===_0x2b35('0x32')){var _0x5e35a2={'params':{'id':_0x4f7960[_0x2b35('0x32')]['userProfileId']},'query':{'section':_0x587117===_0x2b35('0x3a')&&_0x4f7960[_0x2b35('0xf')][_0x2b35('0x26')]==='outbound'?_0x2b35('0x45'):_[_0x2b35('0x40')](_0x587117)+'Queues','type':_0x4f7960[_0x2b35('0xf')][_0x2b35('0x26')],'nolimit':!![],'sort':_0x2b35('0x46'),'filter':_0x4f7960[_0x2b35('0xf')][_0x2b35('0x47')]}};_0x5e35a2[_0x2b35('0xf')]=Object['assign'](_0x5e35a2[_0x2b35('0xf')],_0x4f7960[_0x2b35('0xf')]);delete _0x5e35a2[_0x2b35('0xf')]['id'];return db[_0x2b35('0x48')][_0x2b35('0x49')](_0x5e35a2);}return db[_0x3e7e9d][_0x2b35('0x4a')](_0x36d2c0);})[_0x2b35('0x14')](function(_0x15f865){_0x56d496[_0x2b35('0x8')]=_0x15f865[_0x2b35('0x8')];_0x554857=_0x15f865[_0x2b35('0x36')];return rtq[_0x2b35('0x4b')](_0x4f7960,_0x587117);})[_0x2b35('0x14')](function(_0x274b8f){_0x589f19=_0x274b8f['rows'];return rtq['initializeQueues'](_0x554857,_0x589f19,_0x587117,_0x4f7960[_0x2b35('0xf')][_0x2b35('0x26')]);})[_0x2b35('0x14')](function(_0x153ce3){_0x56d496[_0x2b35('0x36')]=_0x153ce3;return _0x56d496;})[_0x2b35('0x14')](respondWithFilteredResult(_0x17a880,_0x36d2c0))[_0x2b35('0x4c')](APIHandleError(_0x17a880));}; \ No newline at end of file +var _0x730a=['UserProfile','getResources','User','find','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','pick','catch','getQueues','format','startCase','Queue','fieldName','outbound','dialActive','dialMethod','join','QueueCampaigns','Queues','name','filter','getRealtimeQueues','lodash','util','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','set','json','getAgents','getChannels','globalQueueFilter','query','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','type','key','agent','getOptions','push','sequelize','literal','FIELD(id,','order','forEach','Pause','where','merge','user','role','online','extraQueryConditions','assign'];(function(_0x4e761d,_0x744679){var _0x897387=function(_0x513d48){while(--_0x513d48){_0x4e761d['push'](_0x4e761d['shift']());}};_0x897387(++_0x744679);}(_0x730a,0x1ca));var _0xa730=function(_0x5a9841,_0x950566){_0x5a9841=_0x5a9841-0x0;var _0xb4f748=_0x730a[_0x5a9841];return _0xb4f748;};'use strict';var _=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0xa730('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0xa730('0x3'));var db=require(_0xa730('0x4'))['db'];var APIBadRequestError=require(_0xa730('0x5'))[_0xa730('0x6')];var APIHandleError=require(_0xa730('0x5'))['handleError'];function respondWithFilteredResult(_0x235822,_0xe46822){return function(_0x199bdc){if(_0x199bdc){var _0x220d0f=typeof _0xe46822[_0xa730('0x7')]===_0xa730('0x8')&&typeof _0xe46822[_0xa730('0x9')]===_0xa730('0x8');var _0x459975=_0x199bdc[_0xa730('0xa')];var _0x3b7ec8=_0x220d0f?0x0:_0xe46822[_0xa730('0x7')];var _0x4a58a0=_0x220d0f?_0x199bdc[_0xa730('0xa')]:_0xe46822[_0xa730('0x7')]+_0xe46822[_0xa730('0x9')];var _0x4eaec6;if(_0x4a58a0>=_0x459975){_0x4a58a0=_0x459975;_0x4eaec6=0xc8;}else{_0x4eaec6=0xce;}_0x235822[_0xa730('0xb')](_0x4eaec6);return _0x235822[_0xa730('0xc')]('Content-Range',_0x3b7ec8+'-'+_0x4a58a0+'/'+_0x459975)[_0xa730('0xd')](_0x199bdc);}return null;};}exports[_0xa730('0xe')]=function(_0xca3dc2,_0x1abda1){var _0x2046da={'count':0x0,'rows':[]};var _0xe1dafe={};var _0x592b93;var _0x4745dd=utils[_0xa730('0xf')]();var _0x228b90;var _0x520726;var _0x256bf4=_0xca3dc2['query'][_0xa730('0x10')];var _0x167437=_0xca3dc2[_0xa730('0x11')]['globalStatusFilter'];var _0x218989=_0xca3dc2[_0xa730('0x11')][_0xa730('0x12')];var _0x6491cb=_0x167437===_0xa730('0x13')||_0x167437===_0xa730('0x14')?!![]:![];var _0x255513=[];var _0x596016;var _0x499e31;Promise[_0xa730('0x15')]()[_0xa730('0x16')](function(){if(_0xca3dc2[_0xa730('0x11')][_0xa730('0x17')]){if(!utils[_0xa730('0x18')](_0xca3dc2[_0xa730('0x11')]['channel'])){throw new APIBadRequestError(util['format'](_0xa730('0x19'),_0xca3dc2[_0xa730('0x11')][_0xa730('0x17')]));}_0x592b93=_0xca3dc2[_0xa730('0x11')][_0xa730('0x17')][_0xa730('0x1a')]();}if(!_0xca3dc2['query'][_0xa730('0x1b')]||!_0xca3dc2[_0xa730('0x11')][_0xa730('0x1b')]['includes'](_0xa730('0x1c'))){_0xca3dc2[_0xa730('0x11')][_0xa730('0x1b')]=rta[_0xa730('0x1d')](_0xca3dc2[_0xa730('0x11')][_0xa730('0x1b')]);return;}var _0x7e2366=rta[_0xa730('0x1e')](_0xca3dc2['query'][_0xa730('0x1b')]);_0xca3dc2[_0xa730('0x11')]['sort']=_0x7e2366[_0xa730('0x1f')]['join'](',');_0x596016=_0x7e2366['order'];})['then'](function(){if(!_0x256bf4){return[];}return rta[_0xa730('0x20')](_0x256bf4,_0x592b93);})[_0xa730('0x16')](function(_0x3a9e0b){_0x255513=_0x3a9e0b;return rta[_0xa730('0x21')]();})[_0xa730('0x16')](function(_0x7ac6fe){_0x520726=_0x7ac6fe[_0xa730('0x22')];if((!_0x167437||_0x6491cb)&&!_0x596016){return _0x255513;}if(_0x596016&&!_0x167437){return rta[_0xa730('0x23')](_0x520726,_0x255513,_0x596016);}else{return rta[_0xa730('0x24')](_0x520726,_0x255513,_0x167437);}})[_0xa730('0x16')](function(_0x218d52){_0x255513=_0x218d52;var _0x9d17ee=![];if(_0x255513[_0xa730('0x25')]===0x0){if(_0x256bf4||_0x167437){_0x9d17ee=!![];}if(_0x6491cb){_0x9d17ee=![];}}if(_0x9d17ee){return _0x2046da;}var _0x506c8b=_[_0xa730('0x26')](db['User'][_0xa730('0x27')],function(_0x1062a4){return{'name':_0x1062a4['fieldName'],'type':_0x1062a4[_0xa730('0x28')][_0xa730('0x29')]};});_0xca3dc2[_0xa730('0x11')]['role']=_0xa730('0x2a');_0xe1dafe=qs[_0xa730('0x2b')](_0x506c8b,_0xca3dc2);_0xe1dafe['raw']=!![];var _0xaf3245=[];if(_0x255513[_0xa730('0x25')]>0x0){_0xaf3245[_0xa730('0x2c')]({'id':{'$in':_0x255513}});if(_0x596016&&!_0x167437){_0x499e31=[db[_0xa730('0x2d')][_0xa730('0x2e')](_0xa730('0x2f')+_0x255513+')')];_0xe1dafe[_0xa730('0x30')]=_0x499e31;}}if(_0x6491cb){_0x4745dd[_0xa730('0x31')](function(_0x5aafd7){var _0x147b48=!![];if(_0x167437===_0xa730('0x14')&&_0x592b93!==_0x5aafd7){_0x147b48=![];}_0xaf3245['push']({[_0x5aafd7+_0xa730('0x32')]:_0x147b48});});if(_0x218989){_0xaf3245['push']({'pauseType':_0x218989});}}else if(_0x167437){_0x4745dd[_0xa730('0x31')](function(_0x4f35aa){_0xaf3245[_0xa730('0x2c')]({[_0x4f35aa+'Pause']:![]});});}_0xe1dafe[_0xa730('0x33')]=_[_0xa730('0x34')](_0xe1dafe['where'],{'$and':_0xaf3245});if(_0xca3dc2[_0xa730('0x35')][_0xa730('0x36')]===_0xa730('0x35')){var _0x49b4e8={'params':{'id':_0xca3dc2[_0xa730('0x35')]['userProfileId']},'query':{'section':'Agents','role':_0xa730('0x2a'),'raw':!![],'ids':_0x255513,'customSorting':_0x499e31}};if(_0xca3dc2['query'][_0xa730('0x37')]){_0x49b4e8['query'][_0xa730('0x37')]=!![];}if(_0x6491cb){_0x49b4e8['query'][_0xa730('0x38')]=_0xaf3245;}_0x49b4e8['query']=Object[_0xa730('0x39')](_0x49b4e8[_0xa730('0x11')],_0xca3dc2[_0xa730('0x11')]);return db[_0xa730('0x3a')][_0xa730('0x3b')](_0x49b4e8);}return db[_0xa730('0x3c')]['findAndCountAll'](_0xe1dafe);})[_0xa730('0x16')](function(_0x26dc83){_0x2046da[_0xa730('0xa')]=_0x26dc83[_0xa730('0xa')];_0x228b90=_0x26dc83[_0xa730('0x22')];return _0x228b90[_0xa730('0x26')](function(_0x40c111){var _0x3a0859=_[_0xa730('0x3d')](_0x520726,['id',_0x40c111['id']]);if(_0x3a0859){var _0x21709a=rta[_0xa730('0x3e')](_0x3a0859);_[_0xa730('0x34')](_0x40c111,_0x21709a);}_0x40c111[_0xa730('0x1c')]=rta[_0xa730('0x3f')](_0x40c111);if(_0x40c111[_0xa730('0x1c')][_0xa730('0x40')](_0xa730('0x13'))){_0x4745dd['forEach'](function(_0x16946f){if(_0x40c111[_0x16946f+_0xa730('0x32')]){if(_0x16946f===_0xa730('0x41')){if(_0x40c111[_0xa730('0x42')]!==_0xa730('0x43')){_0x40c111[_0xa730('0x42')]=_0xa730('0x13');}}else{_0x40c111[_0x16946f+_0xa730('0x44')]=_0xa730('0x13');}}});}return _0x40c111;});})[_0xa730('0x16')](function(_0x26ae97){if(!_0x596016||_0x499e31){return _0x26ae97;}return rta['sortAgentsByStatus'](_0x26ae97,_0x596016);})[_0xa730('0x16')](function(_0x3cded0){var _0x11f8c2=rta[_0xa730('0x45')]();_0x2046da[_0xa730('0x22')]=_0x3cded0[_0xa730('0x26')](function(_0x292b5e){return _[_0xa730('0x46')](_0x292b5e,_0x11f8c2);});return _0x2046da;})[_0xa730('0x16')](respondWithFilteredResult(_0x1abda1,_0xe1dafe))[_0xa730('0x47')](APIHandleError(_0x1abda1));};exports[_0xa730('0x48')]=function(_0x3c8e98,_0x387be1){var _0x2d260b={'count':0x0,'rows':[]};var _0x241e1b={};var _0x3ff52f;var _0xd6b6a1;var _0x402049;Promise[_0xa730('0x15')]()[_0xa730('0x16')](function(){if(_0x3c8e98[_0xa730('0x11')][_0xa730('0x17')]){if(!utils[_0xa730('0x18')](_0x3c8e98[_0xa730('0x11')][_0xa730('0x17')])){throw new APIBadRequestError(util[_0xa730('0x49')](_0xa730('0x19'),_0x3c8e98['query']['channel']));}_0x3ff52f=_0x3c8e98[_0xa730('0x11')][_0xa730('0x17')][_0xa730('0x1a')]();}var _0x526ab8=_[_0xa730('0x4a')](_0x3ff52f)+_0xa730('0x4b');var _0x2b8d40=_[_0xa730('0x26')](db[_0x526ab8][_0xa730('0x27')],function(_0x5cd2e0){return{'name':_0x5cd2e0[_0xa730('0x4c')],'type':_0x5cd2e0['type'][_0xa730('0x29')]};});if(!_0x3c8e98[_0xa730('0x11')][_0xa730('0x1f')]){var _0x4257a6=['id','name'];if(_0x3ff52f===_0xa730('0x41')){_0x4257a6[_0xa730('0x2c')](_0xa730('0x28'));if(_0x3c8e98[_0xa730('0x11')][_0xa730('0x28')]===_0xa730('0x4d')){_0x4257a6[_0xa730('0x2c')]([_0xa730('0x4e'),_0xa730('0x4f')]);}}_0x3c8e98['query']['fields']=_0x4257a6[_0xa730('0x50')](',');}_0x241e1b=qs[_0xa730('0x2b')](_0x2b8d40,_0x3c8e98);if(_0x3c8e98[_0xa730('0x35')][_0xa730('0x36')]==='user'){var _0x499ff9={'params':{'id':_0x3c8e98[_0xa730('0x35')]['userProfileId']},'query':{'section':_0x3ff52f===_0xa730('0x41')&&_0x3c8e98[_0xa730('0x11')][_0xa730('0x28')]===_0xa730('0x4d')?_0xa730('0x51'):_['startCase'](_0x3ff52f)+_0xa730('0x52'),'type':_0x3c8e98[_0xa730('0x11')]['type'],'nolimit':!![],'sort':_0xa730('0x53'),'filter':_0x3c8e98[_0xa730('0x11')][_0xa730('0x54')]}};_0x499ff9['query']=Object['assign'](_0x499ff9['query'],_0x3c8e98[_0xa730('0x11')]);delete _0x499ff9['query']['id'];return db[_0xa730('0x3a')][_0xa730('0x3b')](_0x499ff9);}return db[_0x526ab8]['findAndCountAll'](_0x241e1b);})['then'](function(_0x5ae3cc){_0x2d260b[_0xa730('0xa')]=_0x5ae3cc['count'];_0xd6b6a1=_0x5ae3cc[_0xa730('0x22')];return rtq[_0xa730('0x55')](_0x3c8e98,_0x3ff52f);})[_0xa730('0x16')](function(_0x3c0eef){_0x402049=_0x3c0eef[_0xa730('0x22')];return rtq['initializeQueues'](_0xd6b6a1,_0x402049,_0x3ff52f,_0x3c8e98[_0xa730('0x11')][_0xa730('0x28')]);})[_0xa730('0x16')](function(_0xd9f5ad){_0x2d260b[_0xa730('0x22')]=_0xd9f5ad;return _0x2d260b;})[_0xa730('0x16')](respondWithFilteredResult(_0x387be1,_0x241e1b))[_0xa730('0x47')](APIHandleError(_0x387be1));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6ad8b32..8354057 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4ab9a7,_0x291df1){var _0xd08799=function(_0x32bd6a){while(--_0x32bd6a){_0x4ab9a7['push'](_0x4ab9a7['shift']());}};_0xd08799(++_0x291df1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x45b3b7,_0x2b645e){var _0x2849dd=function(_0x2e79bd){while(--_0x2e79bd){_0x45b3b7['push'](_0x45b3b7['shift']());}};_0x2849dd(++_0x2b645e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 649fb33..963ff30 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 _0x3ca4=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x3ca4,0x17d));var _0x43ca=function(_0xfe3c35,_0xdb92c5){_0xfe3c35=_0xfe3c35-0x0;var _0x92ddf9=_0x3ca4[_0xfe3c35];return _0x92ddf9;};'use strict';var Sequelize=require(_0x43ca('0x0'));module[_0x43ca('0x1')]={'state':{'type':Sequelize[_0x43ca('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x43ca('0x3')]},'starttime':{'type':Sequelize[_0x43ca('0x4')]},'responsetime':{'type':Sequelize[_0x43ca('0x4')]},'ringtime':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x43ca('0x3')]},'campaigntype':{'type':Sequelize[_0x43ca('0x3')]},'membername':{'type':Sequelize[_0x43ca('0x3')]}}; \ No newline at end of file +var _0x3595=['DATE','STRING','sequelize','exports','INTEGER'];(function(_0x341e33,_0x1578ae){var _0x39856a=function(_0x4ba18e){while(--_0x4ba18e){_0x341e33['push'](_0x341e33['shift']());}};_0x39856a(++_0x1578ae);}(_0x3595,0x147));var _0x5359=function(_0x5dacf4,_0x132ca2){_0x5dacf4=_0x5dacf4-0x0;var _0xd839bc=_0x3595[_0x5dacf4];return _0xd839bc;};'use strict';var Sequelize=require(_0x5359('0x0'));module[_0x5359('0x1')]={'state':{'type':Sequelize[_0x5359('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5359('0x3')]},'uniqueid':{'type':Sequelize[_0x5359('0x4')]},'starttime':{'type':Sequelize[_0x5359('0x3')]},'responsetime':{'type':Sequelize[_0x5359('0x3')]},'ringtime':{'type':Sequelize[_0x5359('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5359('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index ee7ba6c..fe3ec24 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 _0x6c25=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x4cd96a,_0x5863ac){var _0x33f89e=function(_0x4dd826){while(--_0x4dd826){_0x4cd96a['push'](_0x4cd96a['shift']());}};_0x33f89e(++_0x5863ac);}(_0x6c25,0x177));var _0x56c2=function(_0x1b0aef,_0xe03f3d){_0x1b0aef=_0x1b0aef-0x0;var _0x1604b6=_0x6c25[_0x1b0aef];return _0x1604b6;};'use strict';var _=require(_0x56c2('0x0'));var util=require(_0x56c2('0x1'));var logger=require(_0x56c2('0x2'))(_0x56c2('0x3'));var moment=require(_0x56c2('0x4'));var BPromise=require('bluebird');var rp=require(_0x56c2('0x5'));var fs=require('fs');var path=require(_0x56c2('0x6'));var rimraf=require(_0x56c2('0x7'));var config=require(_0x56c2('0x8'));var attributes=require(_0x56c2('0x9'));module['exports']=function(_0x2298f7,_0x347b69){return _0x2298f7[_0x56c2('0xa')](_0x56c2('0xb'),attributes,{'tableName':_0x56c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbb7=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0xcbb7,0x11e));var _0x7cbb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcbb7[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7cbb('0x0'));var util=require(_0x7cbb('0x1'));var logger=require(_0x7cbb('0x2'))(_0x7cbb('0x3'));var moment=require(_0x7cbb('0x4'));var BPromise=require(_0x7cbb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cbb('0x6'));var rimraf=require(_0x7cbb('0x7'));var config=require(_0x7cbb('0x8'));var attributes=require(_0x7cbb('0x9'));module['exports']=function(_0x323bbe,_0x2de6cc){return _0x323bbe['define'](_0x7cbb('0xa'),attributes,{'tableName':_0x7cbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index b06a14c..e8f5ce3 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 _0x9c24=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateReportAgentPreview','create','body','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug'];(function(_0x4bb606,_0x1085ee){var _0x185007=function(_0x33f83f){while(--_0x33f83f){_0x4bb606['push'](_0x4bb606['shift']());}};_0x185007(++_0x1085ee);}(_0x9c24,0xc0));var _0x49c2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9c24[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x49c2('0x0'));var util=require(_0x49c2('0x1'));var moment=require(_0x49c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x49c2('0x3'));var fs=require('fs');var Redis=require(_0x49c2('0x4'));var db=require(_0x49c2('0x5'))['db'];var utils=require(_0x49c2('0x6'));var logger=require(_0x49c2('0x7'))(_0x49c2('0x8'));var config=require(_0x49c2('0x9'));var jayson=require(_0x49c2('0xa'));var client=jayson[_0x49c2('0xb')][_0x49c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x111664,_0x3805df,_0x4d30dd){return new BPromise(function(_0x251370,_0x1f1adb){return client[_0x49c2('0xd')](_0x111664,_0x4d30dd)[_0x49c2('0xe')](function(_0xe01982){logger[_0x49c2('0xf')](_0x49c2('0x10'),_0x3805df,'request\x20sent');logger[_0x49c2('0x11')](_0x49c2('0x12'),_0x3805df,_0x49c2('0x13'),JSON[_0x49c2('0x14')](_0xe01982));if(_0xe01982[_0x49c2('0x15')]){if(_0xe01982['error']['code']===0x1f4){logger[_0x49c2('0x15')](_0x49c2('0x10'),_0x3805df,_0xe01982[_0x49c2('0x15')][_0x49c2('0x16')]);return _0x1f1adb(_0xe01982[_0x49c2('0x15')][_0x49c2('0x16')]);}logger[_0x49c2('0x15')]('ReportAgentPreview,\x20%s,\x20%s',_0x3805df,_0xe01982[_0x49c2('0x15')][_0x49c2('0x16')]);return _0x251370(_0xe01982[_0x49c2('0x15')]['message']);}else{logger[_0x49c2('0xf')](_0x49c2('0x10'),_0x3805df,'request\x20sent');_0x251370(_0xe01982[_0x49c2('0x17')]['message']);}})['catch'](function(_0x597417){logger[_0x49c2('0x15')]('ReportAgentPreview,\x20%s,\x20%s',_0x3805df,_0x597417);_0x1f1adb(_0x597417);});});}exports[_0x49c2('0x18')]=function(_0x1fa5e1){var _0x49eb52=this;return new Promise(function(_0x4c6757,_0x1be1a8){return db['ReportAgentPreview'][_0x49c2('0x19')](_0x1fa5e1[_0x49c2('0x1a')],{'raw':_0x1fa5e1[_0x49c2('0x1b')]?_0x1fa5e1[_0x49c2('0x1b')][_0x49c2('0x1c')]===undefined?!![]:![]:!![]})[_0x49c2('0xe')](function(_0x3eb16c){logger['info'](_0x49c2('0x18'),_0x1fa5e1);logger[_0x49c2('0x11')]('CreateReportAgentPreview',_0x1fa5e1,JSON[_0x49c2('0x14')](_0x3eb16c));_0x4c6757(_0x3eb16c);})[_0x49c2('0x1d')](function(_0x55ed1c){logger[_0x49c2('0x15')](_0x49c2('0x18'),_0x55ed1c['message'],_0x1fa5e1);_0x1be1a8(_0x49eb52[_0x49c2('0x15')](0x1f4,_0x55ed1c[_0x49c2('0x16')]));});});}; \ No newline at end of file +var _0xb9cc=['info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x58d972,_0x30578c){var _0x12142b=function(_0x592b4e){while(--_0x592b4e){_0x58d972['push'](_0x58d972['shift']());}};_0x12142b(++_0x30578c);}(_0xb9cc,0x100));var _0xcb9c=function(_0x32aa58,_0x253498){_0x32aa58=_0x32aa58-0x0;var _0xf61e7c=_0xb9cc[_0x32aa58];return _0xf61e7c;};'use strict';var _=require('lodash');var util=require(_0xcb9c('0x0'));var moment=require(_0xcb9c('0x1'));var BPromise=require(_0xcb9c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb9c('0x3'));var db=require(_0xcb9c('0x4'))['db'];var utils=require(_0xcb9c('0x5'));var logger=require(_0xcb9c('0x6'))(_0xcb9c('0x7'));var config=require(_0xcb9c('0x8'));var jayson=require(_0xcb9c('0x9'));var client=jayson[_0xcb9c('0xa')][_0xcb9c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5703fa,_0x2c5281,_0x37ea16){return new BPromise(function(_0x466874,_0x584382){return client[_0xcb9c('0xc')](_0x5703fa,_0x37ea16)[_0xcb9c('0xd')](function(_0x4db22b){logger[_0xcb9c('0xe')](_0xcb9c('0xf'),_0x2c5281,'request\x20sent');logger[_0xcb9c('0x10')](_0xcb9c('0x11'),_0x2c5281,_0xcb9c('0x12'),JSON['stringify'](_0x4db22b));if(_0x4db22b[_0xcb9c('0x13')]){if(_0x4db22b[_0xcb9c('0x13')][_0xcb9c('0x14')]===0x1f4){logger[_0xcb9c('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c5281,_0x4db22b[_0xcb9c('0x13')][_0xcb9c('0x15')]);return _0x584382(_0x4db22b[_0xcb9c('0x13')][_0xcb9c('0x15')]);}logger[_0xcb9c('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c5281,_0x4db22b[_0xcb9c('0x13')][_0xcb9c('0x15')]);return _0x466874(_0x4db22b[_0xcb9c('0x13')][_0xcb9c('0x15')]);}else{logger[_0xcb9c('0xe')](_0xcb9c('0xf'),_0x2c5281,_0xcb9c('0x12'));_0x466874(_0x4db22b[_0xcb9c('0x16')][_0xcb9c('0x15')]);}})[_0xcb9c('0x17')](function(_0x12c881){logger[_0xcb9c('0x13')](_0xcb9c('0xf'),_0x2c5281,_0x12c881);_0x584382(_0x12c881);});});}exports[_0xcb9c('0x18')]=function(_0x501969){var _0x39514d=this;return new Promise(function(_0x3d52ea,_0x3a1e83){return db[_0xcb9c('0x19')][_0xcb9c('0x1a')](_0x501969[_0xcb9c('0x1b')],{'raw':_0x501969['options']?_0x501969[_0xcb9c('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xcb9c('0xd')](function(_0x4ba828){logger[_0xcb9c('0xe')](_0xcb9c('0x18'),_0x501969);logger['debug'](_0xcb9c('0x18'),_0x501969,JSON[_0xcb9c('0x1d')](_0x4ba828));_0x3d52ea(_0x4ba828);})[_0xcb9c('0x17')](function(_0x576bd1){logger[_0xcb9c('0x13')]('CreateReportAgentPreview',_0x576bd1['message'],_0x501969);_0x3a1e83(_0x39514d[_0xcb9c('0x13')](0x1f4,_0x576bd1[_0xcb9c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ed5ca67..11e9d1b 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 _0xf1b4=['/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','exports','util','path','express','Router','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id'];(function(_0x4f174d,_0x13ec6d){var _0x48d90f=function(_0x1a0114){while(--_0x1a0114){_0x4f174d['push'](_0x4f174d['shift']());}};_0x48d90f(++_0x13ec6d);}(_0xf1b4,0x13a));var _0x4f1b=function(_0x3a5539,_0x52b95c){_0x3a5539=_0x3a5539-0x0;var _0x31fd5a=_0xf1b4[_0x3a5539];return _0x31fd5a;};'use strict';var multer=require('multer');var util=require(_0x4f1b('0x0'));var path=require(_0x4f1b('0x1'));var express=require(_0x4f1b('0x2'));var router=express[_0x4f1b('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router['get'](_0x4f1b('0x4'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x6')]);router['get'](_0x4f1b('0x7'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x8')]);router[_0x4f1b('0x9')](_0x4f1b('0xa'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0xb')]);router[_0x4f1b('0x9')](_0x4f1b('0xc'),auth[_0x4f1b('0x5')](),controller['voiceQueues']);router['get']('/chat/queues',auth[_0x4f1b('0x5')](),controller[_0x4f1b('0xd')]);router[_0x4f1b('0x9')](_0x4f1b('0xe'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0xf')]);router[_0x4f1b('0x9')]('/mail/accounts',auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x10')]);router[_0x4f1b('0x9')](_0x4f1b('0x11'),auth['isAuthenticated'](),controller[_0x4f1b('0x12')]);router[_0x4f1b('0x9')](_0x4f1b('0x13'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x4f1b('0x9')](_0x4f1b('0x14'),auth['isAuthenticated'](),controller[_0x4f1b('0x15')]);router[_0x4f1b('0x9')](_0x4f1b('0x16'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x17')]);router[_0x4f1b('0x9')](_0x4f1b('0x18'),auth[_0x4f1b('0x5')](),controller['voiceQueuesPreview']);router[_0x4f1b('0x9')](_0x4f1b('0x19'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x1a')]);router[_0x4f1b('0x9')](_0x4f1b('0x1b'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x1c')]);router[_0x4f1b('0x9')](_0x4f1b('0x1d'),auth[_0x4f1b('0x5')](),controller['voiceQueuesChannelHangup']);router['get'](_0x4f1b('0x1e'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x1f')]);router[_0x4f1b('0x9')](_0x4f1b('0x20'),auth[_0x4f1b('0x5')](),controller['showVoiceQueues']);router[_0x4f1b('0x21')](_0x4f1b('0x20'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x22')]);router['get']('/outbound',auth[_0x4f1b('0x5')](),controller['outbound']);router[_0x4f1b('0x9')]('/outbound/channels',auth[_0x4f1b('0x5')](),controller['outboundChannels']);router[_0x4f1b('0x9')](_0x4f1b('0x23'),auth['isAuthenticated'](),controller[_0x4f1b('0x24')]);router[_0x4f1b('0x21')](_0x4f1b('0x25'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x26')]);router[_0x4f1b('0x9')](_0x4f1b('0x27'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x28')]);router['get'](_0x4f1b('0x29'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x2a')]);router[_0x4f1b('0x9')]('/campaigns',auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x2b')]);router['get'](_0x4f1b('0x2c'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x4f1b('0x9')](_0x4f1b('0x2d'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x2e')]);router[_0x4f1b('0x9')]('/mail/queues/waitinginteractions',auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x2f')]);router[_0x4f1b('0x9')](_0x4f1b('0x30'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x31')]);router[_0x4f1b('0x9')](_0x4f1b('0x32'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x33')]);router[_0x4f1b('0x9')]('/sms/queues/waitinginteractions',auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x34')]);router[_0x4f1b('0x9')](_0x4f1b('0x35'),auth['isAuthenticated'](),controller[_0x4f1b('0x36')]);router[_0x4f1b('0x9')](_0x4f1b('0x37'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x38')]);router[_0x4f1b('0x39')](_0x4f1b('0x3a'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x3b')](_0x4f1b('0x3c')));router[_0x4f1b('0x9')](_0x4f1b('0x3d'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x3e')]);router[_0x4f1b('0x39')](_0x4f1b('0x3f'),auth['isAuthenticated'](),controller[_0x4f1b('0x3b')](_0x4f1b('0x40')));router['get'](_0x4f1b('0x41'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x42')]);router[_0x4f1b('0x39')]('/fax/queues/:id/notify',auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x3b')]('fax'));router[_0x4f1b('0x9')](_0x4f1b('0x43'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x44')]);router['post'](_0x4f1b('0x45'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0x4f1b('0x9')](_0x4f1b('0x46'),auth[_0x4f1b('0x5')](),controller['showOpenchannelQueues']);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x4f1b('0x3b')]('sms'));router[_0x4f1b('0x39')](_0x4f1b('0x47'),auth[_0x4f1b('0x5')](),controller[_0x4f1b('0x3b')](_0x4f1b('0x48')));router[_0x4f1b('0x9')](_0x4f1b('0x49'),auth['isAuthenticated'](),controller[_0x4f1b('0x4a')]);router[_0x4f1b('0x9')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x4f1b('0x4b')]);router['post']('/agents/:id/notify',auth[_0x4f1b('0x5')](),controller['agentNotify']);module[_0x4f1b('0x4c')]=router; \ No newline at end of file +var _0xef33=['/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound'];(function(_0x8e7d1a,_0x292249){var _0x37b95e=function(_0x4adaff){while(--_0x4adaff){_0x8e7d1a['push'](_0x8e7d1a['shift']());}};_0x37b95e(++_0x292249);}(_0xef33,0x7e));var _0x3ef3=function(_0x260c1e,_0x1cfa6b){_0x260c1e=_0x260c1e-0x0;var _0x289ee0=_0xef33[_0x260c1e];return _0x289ee0;};'use strict';var multer=require(_0x3ef3('0x0'));var util=require('util');var path=require(_0x3ef3('0x1'));var express=require(_0x3ef3('0x2'));var router=express[_0x3ef3('0x3')]();var auth=require(_0x3ef3('0x4'));var controller=require(_0x3ef3('0x5'));router['get'](_0x3ef3('0x6'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x8')]);router[_0x3ef3('0x9')](_0x3ef3('0xa'),auth[_0x3ef3('0x7')](),controller['voiceChannelMixMonitor']);router['get'](_0x3ef3('0xb'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0xc')]);router[_0x3ef3('0x9')](_0x3ef3('0xd'),auth['isAuthenticated'](),controller[_0x3ef3('0xe')]);router['get'](_0x3ef3('0xf'),auth['isAuthenticated'](),controller['chatQueues']);router['get'](_0x3ef3('0x10'),auth['isAuthenticated'](),controller[_0x3ef3('0x11')]);router[_0x3ef3('0x9')](_0x3ef3('0x12'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x13')]);router[_0x3ef3('0x9')](_0x3ef3('0x14'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x15')]);router[_0x3ef3('0x9')](_0x3ef3('0x16'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x17')]);router[_0x3ef3('0x9')](_0x3ef3('0x18'),auth['isAuthenticated'](),controller[_0x3ef3('0x19')]);router[_0x3ef3('0x9')](_0x3ef3('0x1a'),auth['isAuthenticated'](),controller[_0x3ef3('0x1b')]);router['get'](_0x3ef3('0x1c'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x1d')]);router['get'](_0x3ef3('0x1e'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x1f')]);router[_0x3ef3('0x9')](_0x3ef3('0x20'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x21')]);router[_0x3ef3('0x9')](_0x3ef3('0x22'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x23')]);router['get'](_0x3ef3('0x24'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x25')]);router[_0x3ef3('0x9')](_0x3ef3('0x26'),auth[_0x3ef3('0x7')](),controller['showVoiceQueues']);router[_0x3ef3('0x27')]('/voice/queues/:id',auth[_0x3ef3('0x7')](),controller['updateVoiceQueue']);router[_0x3ef3('0x9')](_0x3ef3('0x28'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x29')]);router[_0x3ef3('0x9')](_0x3ef3('0x2a'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x2b')]);router[_0x3ef3('0x9')](_0x3ef3('0x2c'),auth[_0x3ef3('0x7')](),controller['agents']);router[_0x3ef3('0x27')](_0x3ef3('0x2d'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x2e')]);router[_0x3ef3('0x9')](_0x3ef3('0x2f'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x30')]);router['get'](_0x3ef3('0x31'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x32')]);router[_0x3ef3('0x9')]('/campaigns',auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x33')]);router[_0x3ef3('0x9')](_0x3ef3('0x34'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x35')]);router[_0x3ef3('0x9')]('/chat/queues/waitinginteractions',auth[_0x3ef3('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x3ef3('0x9')]('/mail/queues/waitinginteractions',auth[_0x3ef3('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x3ef3('0x9')](_0x3ef3('0x36'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x37')]);router['get'](_0x3ef3('0x38'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x39')]);router[_0x3ef3('0x9')](_0x3ef3('0x3a'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x3b')]);router[_0x3ef3('0x9')](_0x3ef3('0x3c'),auth['isAuthenticated'](),controller[_0x3ef3('0x3d')]);router[_0x3ef3('0x9')](_0x3ef3('0x3e'),auth[_0x3ef3('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x3ef3('0x3f'),auth[_0x3ef3('0x7')](),controller['queueNotify']('mail'));router[_0x3ef3('0x9')](_0x3ef3('0x40'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x41')]);router[_0x3ef3('0x42')](_0x3ef3('0x43'),auth[_0x3ef3('0x7')](),controller['queueNotify']('chat'));router['get'](_0x3ef3('0x44'),auth['isAuthenticated'](),controller['showChatQueues']);router['post'](_0x3ef3('0x45'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x46')](_0x3ef3('0x47')));router[_0x3ef3('0x9')](_0x3ef3('0x48'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x49')]);router[_0x3ef3('0x42')](_0x3ef3('0x4a'),auth['isAuthenticated'](),controller[_0x3ef3('0x46')](_0x3ef3('0x4b')));router[_0x3ef3('0x9')](_0x3ef3('0x4c'),auth['isAuthenticated'](),controller[_0x3ef3('0x4d')]);router['post']('/sms/queues/:id/notify',auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x46')](_0x3ef3('0x4e')));router[_0x3ef3('0x42')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3ef3('0x46')]('whatsapp'));router[_0x3ef3('0x9')](_0x3ef3('0x4f'),auth[_0x3ef3('0x7')](),controller[_0x3ef3('0x50')]);router[_0x3ef3('0x9')](_0x3ef3('0x51'),auth[_0x3ef3('0x7')](),controller['showWhatsappQueues']);router[_0x3ef3('0x42')](_0x3ef3('0x52'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x3ef3('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index ef9d3d1..db9ee0b 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x11e296,_0x48f6bc){var _0x560c46=function(_0x554040){while(--_0x554040){_0x11e296['push'](_0x11e296['shift']());}};_0x560c46(++_0x48f6bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x513981,_0x492952){var _0xff10d5=function(_0x211513){while(--_0x211513){_0x513981['push'](_0x513981['shift']());}};_0xff10d5(++_0x492952);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4e18995..dc617e7 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 _0x87d0=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/run','run','create','put','/:id','update'];(function(_0x3a9440,_0xa0745a){var _0x151df8=function(_0x3b14e9){while(--_0x3b14e9){_0x3a9440['push'](_0x3a9440['shift']());}};_0x151df8(++_0xa0745a);}(_0x87d0,0x1dd));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var path=require(_0x087d('0x2'));var timeout=require(_0x087d('0x3'));var express=require(_0x087d('0x4'));var router=express['Router']();var fs_extra=require(_0x087d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x087d('0x6'));var config=require(_0x087d('0x7'));var controller=require('./schedule.controller');router[_0x087d('0x8')]('/',auth[_0x087d('0x9')](),controller[_0x087d('0xa')]);router[_0x087d('0x8')]('/:id',auth[_0x087d('0x9')](),controller['show']);router['get'](_0x087d('0xb'),auth[_0x087d('0x9')](),controller[_0x087d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x087d('0xd')]);router[_0x087d('0xe')](_0x087d('0xf'),auth[_0x087d('0x9')](),controller[_0x087d('0x10')]);router['delete'](_0x087d('0xf'),auth[_0x087d('0x9')](),controller[_0x087d('0x11')]);module[_0x087d('0x12')]=router; \ No newline at end of file +var _0x26d4=['./schedule.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12d323,_0x4df602){var _0x2109ab=function(_0x3c777f){while(--_0x3c777f){_0x12d323['push'](_0x12d323['shift']());}};_0x2109ab(++_0x4df602);}(_0x26d4,0x1e7));var _0x426d=function(_0x147216,_0x44fb1a){_0x147216=_0x147216-0x0;var _0x8a291d=_0x26d4[_0x147216];return _0x8a291d;};'use strict';var multer=require(_0x426d('0x0'));var util=require(_0x426d('0x1'));var path=require(_0x426d('0x2'));var timeout=require(_0x426d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x426d('0x4'));var auth=require(_0x426d('0x5'));var interaction=require(_0x426d('0x6'));var config=require('../../config/environment');var controller=require(_0x426d('0x7'));router[_0x426d('0x8')]('/',auth[_0x426d('0x9')](),controller[_0x426d('0xa')]);router[_0x426d('0x8')](_0x426d('0xb'),auth[_0x426d('0x9')](),controller[_0x426d('0xc')]);router[_0x426d('0x8')]('/:id/run',auth[_0x426d('0x9')](),controller['run']);router[_0x426d('0xd')]('/',auth[_0x426d('0x9')](),controller[_0x426d('0xe')]);router[_0x426d('0xf')](_0x426d('0xb'),auth[_0x426d('0x9')](),controller['update']);router[_0x426d('0x10')]('/:id',auth[_0x426d('0x9')](),controller[_0x426d('0x11')]);module[_0x426d('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 1cce8eb..5041f79 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 _0x983f=['STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','csv','pdf','xlsx','custom','TEXT'];(function(_0x2e1ac8,_0x4bb931){var _0x342e6a=function(_0x3cc9ac){while(--_0x3cc9ac){_0x2e1ac8['push'](_0x2e1ac8['shift']());}};_0x342e6a(++_0x4bb931);}(_0x983f,0x96));var _0xf983=function(_0x3534ac,_0x57c708){_0x3534ac=_0x3534ac-0x0;var _0x443e7e=_0x983f[_0x3534ac];return _0x443e7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf983('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xf983('0x0')]},'active':{'type':Sequelize[_0xf983('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf983('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xf983('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf983('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf983('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf983('0x4')](_0xf983('0x5'),_0xf983('0x6'),_0xf983('0x7'),_0xf983('0x8'),_0xf983('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':_0xf983('0x9')},'output':{'type':Sequelize[_0xf983('0x4')](_0xf983('0xa'),_0xf983('0xb'),_0xf983('0xc')),'allowNull':![],'defaultValue':_0xf983('0xa')},'type':{'type':Sequelize[_0xf983('0x4')](_0xf983('0xd'),'default'),'allowNull':![],'defaultValue':_0xf983('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf983('0x0')]},'cc':{'type':Sequelize[_0xf983('0xe')]},'bcc':{'type':Sequelize[_0xf983('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xf983('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x78e0=['days','csv','xlsx','custom','default','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','INTEGER','ENUM','quarters','months','weeks'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x78e0,0xe8));var _0x078e=function(_0x4c0b23,_0x474c1c){_0x4c0b23=_0x4c0b23-0x0;var _0x3a06f0=_0x78e0[_0x4c0b23];return _0x3a06f0;};'use strict';var Sequelize=require('sequelize');module[_0x078e('0x0')]={'name':{'type':Sequelize[_0x078e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x078e('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x078e('0x1')],'allowNull':![],'defaultValue':_0x078e('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x078e('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x078e('0x4')]('years',_0x078e('0x5'),_0x078e('0x6'),_0x078e('0x7'),'days','hours','minutes'),'allowNull':![],'defaultValue':_0x078e('0x8')},'output':{'type':Sequelize[_0x078e('0x4')](_0x078e('0x9'),'pdf',_0x078e('0xa')),'allowNull':![],'defaultValue':_0x078e('0x9')},'type':{'type':Sequelize['ENUM'](_0x078e('0xb'),_0x078e('0xc')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x078e('0xd')],'defaultValue':![]},'email':{'type':Sequelize[_0x078e('0x1')]},'cc':{'type':Sequelize[_0x078e('0xe')]},'bcc':{'type':Sequelize[_0x078e('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x078e('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index e1b0c0a..16a0cd8 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 _0x0807=['UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x312028,_0x961392){var _0x4968bf=function(_0x1b174e){while(--_0x1b174e){_0x312028['push'](_0x312028['shift']());}};_0x4968bf(++_0x961392);}(_0x0807,0x1a5));var _0x7080=function(_0x3b6a64,_0x4cf99d){_0x3b6a64=_0x3b6a64-0x0;var _0x4cdc64=_0x0807[_0x3b6a64];return _0x4cdc64;};'use strict';var emlformat=require(_0x7080('0x0'));var rimraf=require(_0x7080('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7080('0x2'));var rp=require(_0x7080('0x3'));var moment=require(_0x7080('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7080('0x5'));var util=require(_0x7080('0x6'));var path=require(_0x7080('0x7'));var sox=require(_0x7080('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7080('0x9'));var _=require('lodash');var squel=require(_0x7080('0xa'));var crypto=require(_0x7080('0xb'));var jsforce=require(_0x7080('0xc'));var deskjs=require(_0x7080('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7080('0xe'));var Papa=require(_0x7080('0xf'));var Redis=require(_0x7080('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7080('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7080('0x12'));var logger=require('../../config/logger')(_0x7080('0x13'));var utils=require(_0x7080('0x14'));var config=require(_0x7080('0x15'));var licenseUtil=require(_0x7080('0x16'));var db=require(_0x7080('0x17'))['db'];function respondWithStatusCode(_0xef592f,_0x1d5245){_0x1d5245=_0x1d5245||0xcc;return function(_0x46c6d5){if(_0x46c6d5){return _0xef592f[_0x7080('0x18')](_0x1d5245);}return _0xef592f[_0x7080('0x19')](_0x1d5245)[_0x7080('0x1a')]();};}function respondWithResult(_0x5c7a0a,_0x9376d4){_0x9376d4=_0x9376d4||0xc8;return function(_0x9b7281){if(_0x9b7281){return _0x5c7a0a[_0x7080('0x19')](_0x9376d4)['json'](_0x9b7281);}};}function respondWithFilteredResult(_0x9637e7,_0x2bf107){return function(_0x5e4ed1){if(_0x5e4ed1){var _0x450993=typeof _0x2bf107[_0x7080('0x1b')]===_0x7080('0x1c')&&typeof _0x2bf107['limit']===_0x7080('0x1c');var _0x3712cc=_0x5e4ed1[_0x7080('0x1d')];var _0x4acc2a=_0x450993?0x0:_0x2bf107[_0x7080('0x1b')];var _0x366a0a=_0x450993?_0x5e4ed1[_0x7080('0x1d')]:_0x2bf107[_0x7080('0x1b')]+_0x2bf107[_0x7080('0x1e')];var _0x36d9c0;if(_0x366a0a>=_0x3712cc){_0x366a0a=_0x3712cc;_0x36d9c0=0xc8;}else{_0x36d9c0=0xce;}_0x9637e7[_0x7080('0x19')](_0x36d9c0);return _0x9637e7['set'](_0x7080('0x1f'),_0x4acc2a+'-'+_0x366a0a+'/'+_0x3712cc)[_0x7080('0x20')](_0x5e4ed1);}return null;};}function patchUpdates(_0x2bf1f4){return function(_0x2bcac8){try{jsonpatch[_0x7080('0x21')](_0x2bcac8,_0x2bf1f4,!![]);}catch(_0xf474db){return BPromise['reject'](_0xf474db);}return _0x2bcac8['save']();};}function saveUpdates(_0x2b8681,_0x463519){return function(_0x1a6d1a){if(_0x1a6d1a){return _0x1a6d1a[_0x7080('0x22')](_0x2b8681)[_0x7080('0x23')](function(_0x54288c){return _0x54288c;});}return null;};}function removeEntity(_0x166e08,_0xf6986b){return function(_0x4a8941){if(_0x4a8941){return _0x4a8941[_0x7080('0x24')]()[_0x7080('0x23')](function(){var _0x33584c=_0x4a8941[_0x7080('0x25')]({'plain':!![]});var _0x4ebd2f=_0x7080('0x26');return db[_0x7080('0x27')][_0x7080('0x24')]({'where':{'type':_0x4ebd2f,'resourceId':_0x33584c['id']}})[_0x7080('0x23')](function(){return _0x4a8941;});})[_0x7080('0x23')](function(){_0x166e08[_0x7080('0x19')](0xcc)[_0x7080('0x1a')]();});}};}function handleEntityNotFound(_0x330615,_0x4efcd4){return function(_0x29fdb8){if(!_0x29fdb8){_0x330615[_0x7080('0x18')](0x194);}return _0x29fdb8;};}function handleError(_0x4e1adb,_0x1c8dfa){_0x1c8dfa=_0x1c8dfa||0x1f4;return function(_0x32de03){logger[_0x7080('0x28')](_0x32de03[_0x7080('0x29')]);if(_0x32de03['name']){delete _0x32de03[_0x7080('0x2a')];}_0x4e1adb[_0x7080('0x19')](_0x1c8dfa)[_0x7080('0x2b')](_0x32de03);};}exports[_0x7080('0x2c')]=function(_0x5e83fc,_0x42437d){var _0x15407f={},_0x5bcb98={},_0x178240={'count':0x0,'rows':[]};var _0x310c4d=_['map'](db[_0x7080('0x2d')][_0x7080('0x2e')],function(_0x3b359c){return{'name':_0x3b359c[_0x7080('0x2f')],'type':_0x3b359c['type'][_0x7080('0x30')]};});_0x5bcb98[_0x7080('0x31')]=_['map'](_0x310c4d,_0x7080('0x2a'));_0x5bcb98[_0x7080('0x32')]=_[_0x7080('0x33')](_0x5e83fc[_0x7080('0x32')]);_0x5bcb98[_0x7080('0x34')]=_[_0x7080('0x35')](_0x5bcb98['model'],_0x5bcb98[_0x7080('0x32')]);_0x15407f['attributes']=_[_0x7080('0x35')](_0x5bcb98['model'],qs[_0x7080('0x36')](_0x5e83fc[_0x7080('0x32')][_0x7080('0x36')]));_0x15407f[_0x7080('0x37')]=_0x15407f[_0x7080('0x37')][_0x7080('0x38')]?_0x15407f[_0x7080('0x37')]:_0x5bcb98[_0x7080('0x31')];if(!_0x5e83fc[_0x7080('0x32')][_0x7080('0x39')]('nolimit')){_0x15407f['limit']=qs[_0x7080('0x1e')](_0x5e83fc[_0x7080('0x32')][_0x7080('0x1e')]);_0x15407f[_0x7080('0x1b')]=qs[_0x7080('0x1b')](_0x5e83fc['query'][_0x7080('0x1b')]);}_0x15407f[_0x7080('0x3a')]=qs['sort'](_0x5e83fc[_0x7080('0x32')][_0x7080('0x3b')]);_0x15407f[_0x7080('0x3c')]=qs[_0x7080('0x34')](_['pick'](_0x5e83fc['query'],_0x5bcb98[_0x7080('0x34')]),_0x310c4d);if(_0x5e83fc[_0x7080('0x32')][_0x7080('0x3d')]){_0x15407f[_0x7080('0x3c')]=_['merge'](_0x15407f['where'],{'$or':_['map'](_0x310c4d,function(_0x56f543){if(_0x56f543[_0x7080('0x3e')]!==_0x7080('0x3f')){var _0x185289={};_0x185289[_0x56f543[_0x7080('0x2a')]]={'$like':'%'+_0x5e83fc[_0x7080('0x32')]['filter']+'%'};return _0x185289;}})});}_0x15407f=_['merge']({},_0x15407f,_0x5e83fc[_0x7080('0x40')]);var _0x123b29={'where':_0x15407f[_0x7080('0x3c')]};return db[_0x7080('0x2d')]['count'](_0x123b29)[_0x7080('0x23')](function(_0x288dac){_0x178240[_0x7080('0x1d')]=_0x288dac;if(_0x5e83fc[_0x7080('0x32')][_0x7080('0x41')]){_0x15407f[_0x7080('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x7080('0x43')](_0x15407f);})['then'](function(_0x150c5e){_0x178240[_0x7080('0x44')]=_0x150c5e;return _0x178240;})[_0x7080('0x23')](respondWithFilteredResult(_0x42437d,_0x15407f))[_0x7080('0x45')](handleError(_0x42437d,null));};exports[_0x7080('0x46')]=function(_0x1993d5,_0x1cdb1d){var _0xc3d6e6={'raw':![],'where':{'id':_0x1993d5['params']['id']}},_0x3b22f8={};_0x3b22f8[_0x7080('0x31')]=_[_0x7080('0x33')](db[_0x7080('0x2d')][_0x7080('0x2e')]);_0x3b22f8['query']=_['keys'](_0x1993d5[_0x7080('0x32')]);_0x3b22f8[_0x7080('0x34')]=_[_0x7080('0x35')](_0x3b22f8['model'],_0x3b22f8['query']);_0xc3d6e6[_0x7080('0x37')]=_['intersection'](_0x3b22f8[_0x7080('0x31')],qs[_0x7080('0x36')](_0x1993d5[_0x7080('0x32')][_0x7080('0x36')]));_0xc3d6e6['attributes']=_0xc3d6e6[_0x7080('0x37')][_0x7080('0x38')]?_0xc3d6e6[_0x7080('0x37')]:_0x3b22f8['model'];if(_0x1993d5[_0x7080('0x32')]['includeAll']){_0xc3d6e6[_0x7080('0x42')]=[{'all':!![]}];}_0xc3d6e6=_[_0x7080('0x47')]({},_0xc3d6e6,_0x1993d5['options']);return db[_0x7080('0x2d')][_0x7080('0x48')](_0xc3d6e6)[_0x7080('0x23')](handleEntityNotFound(_0x1cdb1d,null))['then'](respondWithResult(_0x1cdb1d,null))[_0x7080('0x45')](handleError(_0x1cdb1d,null));};exports[_0x7080('0x49')]=function(_0x93969,_0x55960d){return db[_0x7080('0x2d')][_0x7080('0x49')](_0x93969[_0x7080('0x4a')],{})[_0x7080('0x23')](function(_0x1cf9a8){var _0x2c1dc7=_0x93969[_0x7080('0x4b')]['get']({'plain':!![]});if(!_0x2c1dc7)throw new Error(_0x7080('0x4c'));if(_0x2c1dc7['role']===_0x7080('0x4b')){var _0x38e267=_0x1cf9a8[_0x7080('0x25')]({'plain':!![]});var _0x4378e5=_0x7080('0x26');return db[_0x7080('0x4d')][_0x7080('0x48')]({'where':{'name':_0x4378e5,'userProfileId':_0x2c1dc7[_0x7080('0x4e')]},'raw':!![]})[_0x7080('0x23')](function(_0x34f13c){if(_0x34f13c&&_0x34f13c['autoAssociation']===0x0){return db[_0x7080('0x27')][_0x7080('0x49')]({'name':_0x38e267[_0x7080('0x2a')],'resourceId':_0x38e267['id'],'type':_0x34f13c[_0x7080('0x2a')],'sectionId':_0x34f13c['id']},{})[_0x7080('0x23')](function(){return _0x1cf9a8;});}else{return _0x1cf9a8;}})[_0x7080('0x45')](function(_0x6b34e7){logger['error'](_0x7080('0x4f'),_0x6b34e7);throw _0x6b34e7;});}return _0x1cf9a8;})['then'](respondWithResult(_0x55960d,0xc9))[_0x7080('0x45')](handleError(_0x55960d,null));};exports[_0x7080('0x22')]=function(_0x55f00c,_0x3200cf){if(_0x55f00c['body']['id']){delete _0x55f00c[_0x7080('0x4a')]['id'];}return db[_0x7080('0x2d')][_0x7080('0x48')]({'where':{'id':_0x55f00c[_0x7080('0x50')]['id']}})['then'](handleEntityNotFound(_0x3200cf,null))[_0x7080('0x23')](saveUpdates(_0x55f00c[_0x7080('0x4a')],null))[_0x7080('0x23')](respondWithResult(_0x3200cf,null))[_0x7080('0x45')](handleError(_0x3200cf,null));};exports[_0x7080('0x24')]=function(_0x4fa7e5,_0x1462f9){return db[_0x7080('0x2d')][_0x7080('0x48')]({'where':{'id':_0x4fa7e5[_0x7080('0x50')]['id']}})['then'](handleEntityNotFound(_0x1462f9,null))[_0x7080('0x23')](removeEntity(_0x1462f9,null))[_0x7080('0x45')](handleError(_0x1462f9,null));};exports[_0x7080('0x51')]=function(_0x2ef2d4,_0x59a081,_0x595a86){var _0x93f33b=require(_0x7080('0x52'));return db[_0x7080('0x2d')]['find']({'where':{'id':_0x2ef2d4['params']['id']},'raw':!![]})[_0x7080('0x23')](handleEntityNotFound(_0x59a081,null))['then'](function(){_0x93f33b[_0x7080('0x51')](_0x2ef2d4[_0x7080('0x50')]['id']);})['then'](respondWithStatusCode(_0x59a081,null))[_0x7080('0x45')](handleError(_0x59a081,null));}; \ No newline at end of file +var _0x50f7=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','end','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','Schedule','include','findAll','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x50f7,0xa0));var _0x750f=function(_0x36e7a2,_0x2293c4){_0x36e7a2=_0x36e7a2-0x0;var _0x2e2556=_0x50f7[_0x36e7a2];return _0x2e2556;};'use strict';var emlformat=require(_0x750f('0x0'));var rimraf=require(_0x750f('0x1'));var zipdir=require(_0x750f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x750f('0x3'));var moment=require(_0x750f('0x4'));var BPromise=require(_0x750f('0x5'));var Mustache=require(_0x750f('0x6'));var util=require(_0x750f('0x7'));var path=require(_0x750f('0x8'));var sox=require(_0x750f('0x9'));var csv=require(_0x750f('0xa'));var ejs=require(_0x750f('0xb'));var fs=require('fs');var fs_extra=require(_0x750f('0xc'));var _=require(_0x750f('0xd'));var squel=require(_0x750f('0xe'));var crypto=require(_0x750f('0xf'));var jsforce=require(_0x750f('0x10'));var deskjs=require(_0x750f('0x11'));var toCsv=require('to-csv');var querystring=require(_0x750f('0x12'));var Papa=require('papaparse');var Redis=require(_0x750f('0x13'));var authService=require(_0x750f('0x14'));var qs=require(_0x750f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x750f('0x16'))(_0x750f('0x17'));var utils=require(_0x750f('0x18'));var config=require(_0x750f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x750f('0x1a'))['db'];function respondWithStatusCode(_0x243ddd,_0x4ecd49){_0x4ecd49=_0x4ecd49||0xcc;return function(_0x5af684){if(_0x5af684){return _0x243ddd[_0x750f('0x1b')](_0x4ecd49);}return _0x243ddd['status'](_0x4ecd49)['end']();};}function respondWithResult(_0x958a56,_0x1384aa){_0x1384aa=_0x1384aa||0xc8;return function(_0x1f5307){if(_0x1f5307){return _0x958a56[_0x750f('0x1c')](_0x1384aa)[_0x750f('0x1d')](_0x1f5307);}};}function respondWithFilteredResult(_0x1780da,_0x354a65){return function(_0x6fd6f1){if(_0x6fd6f1){var _0x292adc=typeof _0x354a65[_0x750f('0x1e')]===_0x750f('0x1f')&&typeof _0x354a65[_0x750f('0x20')]==='undefined';var _0x4046b6=_0x6fd6f1[_0x750f('0x21')];var _0x5e9104=_0x292adc?0x0:_0x354a65[_0x750f('0x1e')];var _0x1a8e33=_0x292adc?_0x6fd6f1[_0x750f('0x21')]:_0x354a65['offset']+_0x354a65[_0x750f('0x20')];var _0x14a73a;if(_0x1a8e33>=_0x4046b6){_0x1a8e33=_0x4046b6;_0x14a73a=0xc8;}else{_0x14a73a=0xce;}_0x1780da[_0x750f('0x1c')](_0x14a73a);return _0x1780da[_0x750f('0x22')](_0x750f('0x23'),_0x5e9104+'-'+_0x1a8e33+'/'+_0x4046b6)[_0x750f('0x1d')](_0x6fd6f1);}return null;};}function patchUpdates(_0x128c7c){return function(_0x448cc1){try{jsonpatch['apply'](_0x448cc1,_0x128c7c,!![]);}catch(_0x42b494){return BPromise[_0x750f('0x24')](_0x42b494);}return _0x448cc1[_0x750f('0x25')]();};}function saveUpdates(_0x2a3025,_0x58f683){return function(_0x4f67fb){if(_0x4f67fb){return _0x4f67fb[_0x750f('0x26')](_0x2a3025)[_0x750f('0x27')](function(_0x5e6b06){return _0x5e6b06;});}return null;};}function removeEntity(_0x2b565d,_0x2abb82){return function(_0x495811){if(_0x495811){return _0x495811['destroy']()['then'](function(){var _0x216697=_0x495811[_0x750f('0x28')]({'plain':!![]});var _0x1353f6=_0x750f('0x29');return db[_0x750f('0x2a')][_0x750f('0x2b')]({'where':{'type':_0x1353f6,'resourceId':_0x216697['id']}})[_0x750f('0x27')](function(){return _0x495811;});})[_0x750f('0x27')](function(){_0x2b565d[_0x750f('0x1c')](0xcc)[_0x750f('0x2c')]();});}};}function handleEntityNotFound(_0x5ebc2b,_0x284faa){return function(_0x101bc0){if(!_0x101bc0){_0x5ebc2b[_0x750f('0x1b')](0x194);}return _0x101bc0;};}function handleError(_0x32a152,_0x56c31b){_0x56c31b=_0x56c31b||0x1f4;return function(_0x3430e1){logger['error'](_0x3430e1[_0x750f('0x2d')]);if(_0x3430e1[_0x750f('0x2e')]){delete _0x3430e1[_0x750f('0x2e')];}_0x32a152[_0x750f('0x1c')](_0x56c31b)[_0x750f('0x2f')](_0x3430e1);};}exports[_0x750f('0x30')]=function(_0x31a461,_0x36c092){var _0x27dfec={},_0x4be8dd={},_0x400b7e={'count':0x0,'rows':[]};var _0x3f4e86=_['map'](db['Schedule'][_0x750f('0x31')],function(_0x5d8e60){return{'name':_0x5d8e60['fieldName'],'type':_0x5d8e60[_0x750f('0x32')]['key']};});_0x4be8dd[_0x750f('0x33')]=_[_0x750f('0x34')](_0x3f4e86,_0x750f('0x2e'));_0x4be8dd[_0x750f('0x35')]=_[_0x750f('0x36')](_0x31a461['query']);_0x4be8dd[_0x750f('0x37')]=_[_0x750f('0x38')](_0x4be8dd['model'],_0x4be8dd['query']);_0x27dfec['attributes']=_['intersection'](_0x4be8dd[_0x750f('0x33')],qs[_0x750f('0x39')](_0x31a461[_0x750f('0x35')][_0x750f('0x39')]));_0x27dfec['attributes']=_0x27dfec[_0x750f('0x3a')][_0x750f('0x3b')]?_0x27dfec[_0x750f('0x3a')]:_0x4be8dd[_0x750f('0x33')];if(!_0x31a461['query'][_0x750f('0x3c')](_0x750f('0x3d'))){_0x27dfec[_0x750f('0x20')]=qs[_0x750f('0x20')](_0x31a461['query'][_0x750f('0x20')]);_0x27dfec['offset']=qs['offset'](_0x31a461['query'][_0x750f('0x1e')]);}_0x27dfec[_0x750f('0x3e')]=qs[_0x750f('0x3f')](_0x31a461['query'][_0x750f('0x3f')]);_0x27dfec['where']=qs[_0x750f('0x37')](_[_0x750f('0x40')](_0x31a461['query'],_0x4be8dd[_0x750f('0x37')]),_0x3f4e86);if(_0x31a461[_0x750f('0x35')]['filter']){_0x27dfec['where']=_[_0x750f('0x41')](_0x27dfec[_0x750f('0x42')],{'$or':_[_0x750f('0x34')](_0x3f4e86,function(_0x4eafb6){if(_0x4eafb6[_0x750f('0x32')]!=='VIRTUAL'){var _0x567aac={};_0x567aac[_0x4eafb6['name']]={'$like':'%'+_0x31a461[_0x750f('0x35')][_0x750f('0x43')]+'%'};return _0x567aac;}})});}_0x27dfec=_[_0x750f('0x41')]({},_0x27dfec,_0x31a461['options']);var _0x1bea2f={'where':_0x27dfec[_0x750f('0x42')]};return db[_0x750f('0x44')][_0x750f('0x21')](_0x1bea2f)[_0x750f('0x27')](function(_0x187343){_0x400b7e[_0x750f('0x21')]=_0x187343;if(_0x31a461['query']['includeAll']){_0x27dfec[_0x750f('0x45')]=[{'all':!![]}];}return db['Schedule'][_0x750f('0x46')](_0x27dfec);})['then'](function(_0x5db0ec){_0x400b7e['rows']=_0x5db0ec;return _0x400b7e;})[_0x750f('0x27')](respondWithFilteredResult(_0x36c092,_0x27dfec))[_0x750f('0x47')](handleError(_0x36c092,null));};exports[_0x750f('0x48')]=function(_0x4b59cd,_0x535240){var _0x58d84c={'raw':![],'where':{'id':_0x4b59cd[_0x750f('0x49')]['id']}},_0x42a0fe={};_0x42a0fe[_0x750f('0x33')]=_[_0x750f('0x36')](db[_0x750f('0x44')][_0x750f('0x31')]);_0x42a0fe[_0x750f('0x35')]=_['keys'](_0x4b59cd[_0x750f('0x35')]);_0x42a0fe['filters']=_[_0x750f('0x38')](_0x42a0fe[_0x750f('0x33')],_0x42a0fe[_0x750f('0x35')]);_0x58d84c[_0x750f('0x3a')]=_['intersection'](_0x42a0fe[_0x750f('0x33')],qs[_0x750f('0x39')](_0x4b59cd[_0x750f('0x35')][_0x750f('0x39')]));_0x58d84c['attributes']=_0x58d84c['attributes'][_0x750f('0x3b')]?_0x58d84c['attributes']:_0x42a0fe[_0x750f('0x33')];if(_0x4b59cd[_0x750f('0x35')][_0x750f('0x4a')]){_0x58d84c[_0x750f('0x45')]=[{'all':!![]}];}_0x58d84c=_[_0x750f('0x41')]({},_0x58d84c,_0x4b59cd[_0x750f('0x4b')]);return db[_0x750f('0x44')][_0x750f('0x4c')](_0x58d84c)[_0x750f('0x27')](handleEntityNotFound(_0x535240,null))['then'](respondWithResult(_0x535240,null))[_0x750f('0x47')](handleError(_0x535240,null));};exports[_0x750f('0x4d')]=function(_0x3544e3,_0x1d5c7e){return db[_0x750f('0x44')][_0x750f('0x4d')](_0x3544e3[_0x750f('0x4e')],{})[_0x750f('0x27')](function(_0xeaf9cf){var _0x919cc1=_0x3544e3[_0x750f('0x4f')][_0x750f('0x28')]({'plain':!![]});if(!_0x919cc1)throw new Error(_0x750f('0x50'));if(_0x919cc1[_0x750f('0x51')]===_0x750f('0x4f')){var _0xea725b=_0xeaf9cf[_0x750f('0x28')]({'plain':!![]});var _0x3aabb4=_0x750f('0x29');return db[_0x750f('0x52')][_0x750f('0x4c')]({'where':{'name':_0x3aabb4,'userProfileId':_0x919cc1[_0x750f('0x53')]},'raw':!![]})['then'](function(_0x1cfae0){if(_0x1cfae0&&_0x1cfae0[_0x750f('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0xea725b[_0x750f('0x2e')],'resourceId':_0xea725b['id'],'type':_0x1cfae0['name'],'sectionId':_0x1cfae0['id']},{})[_0x750f('0x27')](function(){return _0xeaf9cf;});}else{return _0xeaf9cf;}})[_0x750f('0x47')](function(_0x19af31){logger[_0x750f('0x55')](_0x750f('0x56'),_0x19af31);throw _0x19af31;});}return _0xeaf9cf;})['then'](respondWithResult(_0x1d5c7e,0xc9))[_0x750f('0x47')](handleError(_0x1d5c7e,null));};exports[_0x750f('0x26')]=function(_0x30aa0c,_0x2903fa){if(_0x30aa0c[_0x750f('0x4e')]['id']){delete _0x30aa0c[_0x750f('0x4e')]['id'];}return db[_0x750f('0x44')]['find']({'where':{'id':_0x30aa0c[_0x750f('0x49')]['id']}})['then'](handleEntityNotFound(_0x2903fa,null))['then'](saveUpdates(_0x30aa0c[_0x750f('0x4e')],null))['then'](respondWithResult(_0x2903fa,null))[_0x750f('0x47')](handleError(_0x2903fa,null));};exports['destroy']=function(_0xe17c4,_0x2da2ba){return db[_0x750f('0x44')][_0x750f('0x4c')]({'where':{'id':_0xe17c4[_0x750f('0x49')]['id']}})[_0x750f('0x27')](handleEntityNotFound(_0x2da2ba,null))['then'](removeEntity(_0x2da2ba,null))[_0x750f('0x47')](handleError(_0x2da2ba,null));};exports['run']=function(_0xed5f12,_0x183684,_0x404bf8){var _0x2c9aa0=require(_0x750f('0x57'));return db['Schedule'][_0x750f('0x4c')]({'where':{'id':_0xed5f12['params']['id']},'raw':!![]})[_0x750f('0x27')](handleEntityNotFound(_0x183684,null))[_0x750f('0x27')](function(){_0x2c9aa0[_0x750f('0x58')](_0xed5f12['params']['id']);})[_0x750f('0x27')](respondWithStatusCode(_0x183684,null))[_0x750f('0x47')](handleError(_0x183684,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 593ff69..2010cde 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 _0x8a97=['Schedule','tools_schedules','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x32ebee,_0xf5e41b){var _0x394447=function(_0x3ac9c8){while(--_0x3ac9c8){_0x32ebee['push'](_0x32ebee['shift']());}};_0x394447(++_0xf5e41b);}(_0x8a97,0xb2));var _0x78a9=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8a97[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x78a9('0x0'));var util=require(_0x78a9('0x1'));var logger=require('../../config/logger')(_0x78a9('0x2'));var moment=require(_0x78a9('0x3'));var BPromise=require('bluebird');var rp=require(_0x78a9('0x4'));var fs=require('fs');var path=require(_0x78a9('0x5'));var rimraf=require('rimraf');var config=require(_0x78a9('0x6'));var attributes=require('./schedule.attributes');module[_0x78a9('0x7')]=function(_0x37a38f,_0x4e31ee){return _0x37a38f[_0x78a9('0x8')](_0x78a9('0x9'),attributes,{'tableName':_0x78a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x877b=['exports','Schedule','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x437534,_0x450875){var _0x11c466=function(_0x45f7d0){while(--_0x45f7d0){_0x437534['push'](_0x437534['shift']());}};_0x11c466(++_0x450875);}(_0x877b,0x12e));var _0xb877=function(_0x287bf5,_0x27f04e){_0x287bf5=_0x287bf5-0x0;var _0x457302=_0x877b[_0x287bf5];return _0x457302;};'use strict';var _=require('lodash');var util=require(_0xb877('0x0'));var logger=require(_0xb877('0x1'))(_0xb877('0x2'));var moment=require(_0xb877('0x3'));var BPromise=require(_0xb877('0x4'));var rp=require(_0xb877('0x5'));var fs=require('fs');var path=require(_0xb877('0x6'));var rimraf=require(_0xb877('0x7'));var config=require(_0xb877('0x8'));var attributes=require(_0xb877('0x9'));module[_0xb877('0xa')]=function(_0x9a2f64,_0x51f4cf){return _0x9a2f64['define'](_0xb877('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 4d22b59..ae314e9 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 _0xd707=['catch','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','result'];(function(_0x1ad901,_0x852d9e){var _0x3c0249=function(_0x319eda){while(--_0x319eda){_0x1ad901['push'](_0x1ad901['shift']());}};_0x3c0249(++_0x852d9e);}(_0xd707,0xbf));var _0x7d70=function(_0xcce770,_0x128c75){_0xcce770=_0xcce770-0x0;var _0x3d6adf=_0xd707[_0xcce770];return _0x3d6adf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7d70('0x0'));var rs=require(_0x7d70('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d70('0x2'));var logger=require(_0x7d70('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7d70('0x4'));var client=jayson['client'][_0x7d70('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2c228e,_0x2b4b26,_0x41b4d8){return new BPromise(function(_0x459921,_0x20ce55){return client[_0x7d70('0x6')](_0x2c228e,_0x41b4d8)[_0x7d70('0x7')](function(_0x3cd32b){logger[_0x7d70('0x8')]('Schedule,\x20%s,\x20%s',_0x2b4b26,'request\x20sent');logger[_0x7d70('0x9')](_0x7d70('0xa'),_0x2b4b26,_0x7d70('0xb'),JSON[_0x7d70('0xc')](_0x3cd32b));if(_0x3cd32b[_0x7d70('0xd')]){if(_0x3cd32b[_0x7d70('0xd')][_0x7d70('0xe')]===0x1f4){logger[_0x7d70('0xd')](_0x7d70('0xf'),_0x2b4b26,_0x3cd32b['error'][_0x7d70('0x10')]);return _0x20ce55(_0x3cd32b[_0x7d70('0xd')]['message']);}logger[_0x7d70('0xd')](_0x7d70('0xf'),_0x2b4b26,_0x3cd32b[_0x7d70('0xd')]['message']);return _0x459921(_0x3cd32b[_0x7d70('0xd')]['message']);}else{logger[_0x7d70('0x8')](_0x7d70('0xf'),_0x2b4b26,_0x7d70('0xb'));_0x459921(_0x3cd32b[_0x7d70('0x11')][_0x7d70('0x10')]);}})[_0x7d70('0x12')](function(_0x5ed6ff){logger[_0x7d70('0xd')](_0x7d70('0xf'),_0x2b4b26,_0x5ed6ff);_0x20ce55(_0x5ed6ff);});});} \ No newline at end of file +var _0xf289=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3b2df0,_0x565f30){var _0x3294d4=function(_0x3e4609){while(--_0x3e4609){_0x3b2df0['push'](_0x3b2df0['shift']());}};_0x3294d4(++_0x565f30);}(_0xf289,0x18c));var _0x9f28=function(_0x17070a,_0x50d2fb){_0x17070a=_0x17070a-0x0;var _0x246a40=_0xf289[_0x17070a];return _0x246a40;};'use strict';var _=require(_0x9f28('0x0'));var util=require(_0x9f28('0x1'));var moment=require(_0x9f28('0x2'));var BPromise=require(_0x9f28('0x3'));var rs=require(_0x9f28('0x4'));var fs=require('fs');var Redis=require(_0x9f28('0x5'));var db=require(_0x9f28('0x6'))['db'];var utils=require(_0x9f28('0x7'));var logger=require('../../config/logger')(_0x9f28('0x8'));var config=require('../../config/environment');var jayson=require(_0x9f28('0x9'));var client=jayson['client'][_0x9f28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd9f8,_0x5eafcd,_0x1cde81){return new BPromise(function(_0x4fd9b2,_0x101152){return client[_0x9f28('0xb')](_0x4dd9f8,_0x1cde81)['then'](function(_0x51d272){logger[_0x9f28('0xc')](_0x9f28('0xd'),_0x5eafcd,'request\x20sent');logger[_0x9f28('0xe')](_0x9f28('0xf'),_0x5eafcd,'request\x20sent',JSON[_0x9f28('0x10')](_0x51d272));if(_0x51d272[_0x9f28('0x11')]){if(_0x51d272[_0x9f28('0x11')][_0x9f28('0x12')]===0x1f4){logger[_0x9f28('0x11')](_0x9f28('0xd'),_0x5eafcd,_0x51d272['error'][_0x9f28('0x13')]);return _0x101152(_0x51d272[_0x9f28('0x11')]['message']);}logger[_0x9f28('0x11')](_0x9f28('0xd'),_0x5eafcd,_0x51d272[_0x9f28('0x11')][_0x9f28('0x13')]);return _0x4fd9b2(_0x51d272[_0x9f28('0x11')][_0x9f28('0x13')]);}else{logger[_0x9f28('0xc')]('Schedule,\x20%s,\x20%s',_0x5eafcd,_0x9f28('0x14'));_0x4fd9b2(_0x51d272[_0x9f28('0x15')]['message']);}})[_0x9f28('0x16')](function(_0x2f3d29){logger['error'](_0x9f28('0xd'),_0x5eafcd,_0x2f3d29);_0x101152(_0x2f3d29);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index be4694c..1830b5e 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 _0x4d41=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','create'];(function(_0x1d3f32,_0x4bddb8){var _0x2d9c10=function(_0x268ff4){while(--_0x268ff4){_0x1d3f32['push'](_0x1d3f32['shift']());}};_0x2d9c10(++_0x4bddb8);}(_0x4d41,0xeb));var _0x14d4=function(_0x16295e,_0x4a9b05){_0x16295e=_0x16295e-0x0;var _0x2d9e54=_0x4d41[_0x16295e];return _0x2d9e54;};'use strict';var multer=require(_0x14d4('0x0'));var util=require(_0x14d4('0x1'));var path=require(_0x14d4('0x2'));var timeout=require(_0x14d4('0x3'));var express=require(_0x14d4('0x4'));var router=express[_0x14d4('0x5')]();var fs_extra=require(_0x14d4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x14d4('0x7'));var config=require(_0x14d4('0x8'));var controller=require(_0x14d4('0x9'));router['get']('/',auth[_0x14d4('0xa')](),controller['index']);router[_0x14d4('0xb')](_0x14d4('0xc'),auth[_0x14d4('0xa')](),controller['describe']);router['get'](_0x14d4('0xd'),auth['isAuthenticated'](),controller[_0x14d4('0xe')]);router[_0x14d4('0xb')](_0x14d4('0xf'),auth[_0x14d4('0xa')](),controller['download']);router['post']('/',auth[_0x14d4('0xa')](),controller[_0x14d4('0x10')]);router[_0x14d4('0x11')](_0x14d4('0xd'),auth['isAuthenticated'](),controller[_0x14d4('0x12')]);router[_0x14d4('0x13')]('/:id',auth[_0x14d4('0xa')](),controller['destroy']);module[_0x14d4('0x14')]=router; \ No newline at end of file +var _0xc448=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','put','update'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0xc448,0x8c));var _0x8c44=function(_0x4a1df8,_0x16c573){_0x4a1df8=_0x4a1df8-0x0;var _0x500579=_0xc448[_0x4a1df8];return _0x500579;};'use strict';var multer=require(_0x8c44('0x0'));var util=require(_0x8c44('0x1'));var path=require(_0x8c44('0x2'));var timeout=require(_0x8c44('0x3'));var express=require(_0x8c44('0x4'));var router=express['Router']();var fs_extra=require(_0x8c44('0x5'));var auth=require(_0x8c44('0x6'));var interaction=require(_0x8c44('0x7'));var config=require(_0x8c44('0x8'));var controller=require(_0x8c44('0x9'));router[_0x8c44('0xa')]('/',auth[_0x8c44('0xb')](),controller[_0x8c44('0xc')]);router[_0x8c44('0xa')](_0x8c44('0xd'),auth[_0x8c44('0xb')](),controller['describe']);router[_0x8c44('0xa')](_0x8c44('0xe'),auth[_0x8c44('0xb')](),controller[_0x8c44('0xf')]);router[_0x8c44('0xa')](_0x8c44('0x10'),auth['isAuthenticated'](),controller[_0x8c44('0x11')]);router[_0x8c44('0x12')]('/',auth[_0x8c44('0xb')](),controller['create']);router[_0x8c44('0x13')](_0x8c44('0xe'),auth[_0x8c44('0xb')](),controller[_0x8c44('0x14')]);router['delete']('/:id',auth[_0x8c44('0xb')](),controller[_0x8c44('0x15')]);module[_0x8c44('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4111ede..4507fff 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 _0x3c32=['VIRTUAL','getDataValue','extname','value','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','exports'];(function(_0x49be08,_0x2eb8bc){var _0x4f1708=function(_0x32cac6){while(--_0x32cac6){_0x49be08['push'](_0x49be08['shift']());}};_0x4f1708(++_0x2eb8bc);}(_0x3c32,0x161));var _0x23c3=function(_0x46af26,_0x4c19a1){_0x46af26=_0x46af26-0x0;var _0x3a14b9=_0x3c32[_0x46af26];return _0x3a14b9;};'use strict';var Sequelize=require(_0x23c3('0x0'));var moment=require(_0x23c3('0x1'));var path=require(_0x23c3('0x2'));var config=require('../../config/environment');module[_0x23c3('0x3')]={'format':{'type':Sequelize[_0x23c3('0x4')],'get':function(){return this[_0x23c3('0x5')]('value')?path[_0x23c3('0x6')](this['getDataValue'](_0x23c3('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x23c3('0x8')]},'channel':{'type':Sequelize[_0x23c3('0x8')]},'value':{'type':Sequelize[_0x23c3('0x8')],'set':function(_0x4a6364){var _0x56568e=_0x4a6364['replace'](/\\/g,'/');this['setDataValue'](_0x23c3('0x7'),_0x56568e);}},'rating':{'type':Sequelize[_0x23c3('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x23c3('0x9')],'set':function(_0x420987){this[_0x23c3('0xa')](_0x23c3('0xb'),moment()[_0x23c3('0xc')](_0x420987,'ms'));this[_0x23c3('0xa')](_0x23c3('0xd'),moment());this[_0x23c3('0xa')](_0x23c3('0xe'),_0x420987);}},'startedAt':{'type':Sequelize[_0x23c3('0xf')],'get':function(){return moment(this[_0x23c3('0x5')](_0x23c3('0xb')))[_0x23c3('0x10')](_0x23c3('0x11'))[_0x23c3('0x12')]();}},'closedAt':{'type':Sequelize[_0x23c3('0xf')],'get':function(){return moment(this[_0x23c3('0x5')](_0x23c3('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x23c3('0x12')]();}},'createdAt':{'type':Sequelize[_0x23c3('0xf')],'get':function(){return moment(this[_0x23c3('0x5')](_0x23c3('0x13')))[_0x23c3('0x10')](_0x23c3('0x11'))[_0x23c3('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x23c3('0x14')))[_0x23c3('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x23c3('0x12')]();}}}; \ No newline at end of file +var _0x5eb8=['getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','VIRTUAL'];(function(_0x527306,_0x444b80){var _0x4085e9=function(_0x3c5b19){while(--_0x3c5b19){_0x527306['push'](_0x527306['shift']());}};_0x4085e9(++_0x444b80);}(_0x5eb8,0xb0));var _0x85eb=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x5eb8[_0x38b14f];return _0x22a324;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x85eb('0x0'));var config=require(_0x85eb('0x1'));module[_0x85eb('0x2')]={'format':{'type':Sequelize[_0x85eb('0x3')],'get':function(){return this[_0x85eb('0x4')](_0x85eb('0x5'))?path[_0x85eb('0x6')](this[_0x85eb('0x4')](_0x85eb('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x85eb('0x7')]},'channel':{'type':Sequelize[_0x85eb('0x7')]},'value':{'type':Sequelize[_0x85eb('0x7')],'set':function(_0x4a8814){var _0x16d7b9=_0x4a8814[_0x85eb('0x8')](/\\/g,'/');this[_0x85eb('0x9')]('value',_0x16d7b9);}},'rating':{'type':Sequelize[_0x85eb('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1f0036){this[_0x85eb('0x9')](_0x85eb('0xb'),moment()[_0x85eb('0xc')](_0x1f0036,'ms'));this[_0x85eb('0x9')](_0x85eb('0xd'),moment());this[_0x85eb('0x9')]('duration',_0x1f0036);}},'startedAt':{'type':Sequelize[_0x85eb('0xe')],'get':function(){return moment(this[_0x85eb('0x4')]('startedAt'))[_0x85eb('0xf')](_0x85eb('0x10'))[_0x85eb('0x11')]();}},'closedAt':{'type':Sequelize[_0x85eb('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x85eb('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x85eb('0x11')]();}},'createdAt':{'type':Sequelize[_0x85eb('0xe')],'get':function(){return moment(this[_0x85eb('0x4')](_0x85eb('0x12')))[_0x85eb('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x85eb('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x85eb('0x4')](_0x85eb('0x13')))[_0x85eb('0xf')](_0x85eb('0x10'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9adcb37..bbcd123 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 _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xae24,0x182));var _0x4ae2=function(_0x4ec041,_0x4584d3){_0x4ec041=_0x4ec041-0x0;var _0x9ce2a0=_0xae24[_0x4ec041];return _0x9ce2a0;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file +var _0xb4c7=['rawAttributes','fieldName','type','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','ValidationError','download','filename','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording'];(function(_0x4ac716,_0x40243f){var _0x35f56b=function(_0x14e518){while(--_0x14e518){_0x4ac716['push'](_0x4ac716['shift']());}};_0x35f56b(++_0x40243f);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3027c3,_0xe78773){_0x3027c3=_0x3027c3-0x0;var _0x459d40=_0xb4c7[_0x3027c3];return _0x459d40;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['differenceBy'](_[_0x7b4c('0x30')](_0x3544bc,_0x7b4c('0x2d')),[_0x7b4c('0x35')]);_0x3585cd[_0x7b4c('0x36')]=_['keys'](_0x2552f9[_0x7b4c('0x36')]);_0x3585cd[_0x7b4c('0x37')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_[_0x7b4c('0x3a')](_0x3585cd[_0x7b4c('0x38')],qs['fields'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x9a799b['attributes']=_0x9a799b[_0x7b4c('0x39')][_0x7b4c('0x3c')]?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9['query']['hasOwnProperty'](_0x7b4c('0x3d'))){_0x9a799b[_0x7b4c('0x22')]=qs['limit'](_0x2552f9[_0x7b4c('0x36')]['limit']);_0x9a799b['offset']=qs[_0x7b4c('0x1f')](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3e')]=qs['sort'](_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x3f')]);_0x9a799b[_0x7b4c('0x40')]=qs[_0x7b4c('0x37')](_[_0x7b4c('0x41')](_0x2552f9[_0x7b4c('0x36')],_0x3585cd[_0x7b4c('0x37')]),_0x3544bc);if(_0x2552f9['query']['filter']){_0x9a799b[_0x7b4c('0x40')]=_[_0x7b4c('0x42')](_0x9a799b[_0x7b4c('0x40')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0xb8486d){if(_0xb8486d['type']!==_0x7b4c('0x43')){var _0x902367={};_0x902367[_0xb8486d[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x44')]+'%'};return _0x902367;}})});}_0x9a799b=_[_0x7b4c('0x42')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x45')]);var _0x1080fc={'where':_0x9a799b[_0x7b4c('0x40')]};return db['ScreenRecording'][_0x7b4c('0x21')](_0x1080fc)['then'](function(_0x2a3a74){_0x130ace['count']=_0x2a3a74;if(_0x2552f9[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x9a799b['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7b4c('0x47')](_0x9a799b);})[_0x7b4c('0x29')](function(_0x1def44){_0x130ace[_0x7b4c('0x48')]=_0x1def44;return _0x130ace;})['then'](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x49')](handleError(_0x3e4a46,null));};exports[_0x7b4c('0x4a')]=function(_0x100774,_0x5d4ed8){var _0x45ad59={'raw':![],'where':{'id':_0x100774['params']['id']}},_0x4b4757={};_0x4b4757[_0x7b4c('0x38')]=_['keys'](db[_0x7b4c('0x31')][_0x7b4c('0x32')]);_0x4b4757[_0x7b4c('0x36')]=_[_0x7b4c('0x4b')](_0x100774[_0x7b4c('0x36')]);_0x4b4757[_0x7b4c('0x37')]=_[_0x7b4c('0x3a')](_0x4b4757[_0x7b4c('0x38')],_0x4b4757[_0x7b4c('0x36')]);_0x45ad59['attributes']=_[_0x7b4c('0x3a')](_0x4b4757['model'],qs['fields'](_0x100774[_0x7b4c('0x36')][_0x7b4c('0x3b')]));_0x45ad59['attributes']=_0x45ad59['attributes'][_0x7b4c('0x3c')]?_0x45ad59[_0x7b4c('0x39')]:_0x4b4757[_0x7b4c('0x38')];if(_0x100774[_0x7b4c('0x36')][_0x7b4c('0x46')]){_0x45ad59[_0x7b4c('0x4c')]=[{'all':!![]}];}_0x45ad59=_[_0x7b4c('0x42')]({},_0x45ad59,_0x100774[_0x7b4c('0x45')]);return db['ScreenRecording'][_0x7b4c('0x4d')](_0x45ad59)[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4ed8,null))[_0x7b4c('0x29')](respondWithResult(_0x5d4ed8,null))[_0x7b4c('0x49')](handleError(_0x5d4ed8,null));};exports[_0x7b4c('0x4e')]=function(_0x379f15,_0x11a6f9){return db[_0x7b4c('0x31')][_0x7b4c('0x4e')](_0x379f15['body'],{})['then'](respondWithResult(_0x11a6f9,0xc9))[_0x7b4c('0x49')](handleError(_0x11a6f9,null));};exports[_0x7b4c('0x28')]=function(_0x97eadf,_0x5d4192){if(_0x97eadf[_0x7b4c('0x4f')]['id']){delete _0x97eadf[_0x7b4c('0x4f')]['id'];}delete _0x97eadf['body'][_0x7b4c('0x50')];delete _0x97eadf['body'][_0x7b4c('0x51')];delete _0x97eadf['body'][_0x7b4c('0x52')];delete _0x97eadf['body'][_0x7b4c('0x53')];return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x97eadf['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x5d4192,null))[_0x7b4c('0x29')](saveUpdates(_0x97eadf[_0x7b4c('0x4f')],null))['then'](respondWithResult(_0x5d4192,null))['catch'](handleError(_0x5d4192,null));};exports[_0x7b4c('0x54')]=function(_0x1c118a,_0x4cbf1b){return db['ScreenRecording'][_0x7b4c('0x54')]()[_0x7b4c('0x29')](respondWithResult(_0x4cbf1b,null))[_0x7b4c('0x49')](handleError(_0x4cbf1b,null));};exports['download']=function(_0x1d017d,_0x2f009a,_0x4aaf57){var _0x484e80=require(_0x7b4c('0x55'));var _0x4d8491=![];var _0x59db20={};if(_0x1d017d[_0x7b4c('0x36')]['type']&&_0x1d017d['query'][_0x7b4c('0x34')]===_0x7b4c('0x56')){_0x59db20[_0x7b4c('0x56')]=_0x1d017d[_0x7b4c('0x57')]['id'];}else{_0x59db20['id']=_0x1d017d['params']['id'];}return db['ScreenRecording'][_0x7b4c('0x4d')]({'where':_0x59db20,'attributes':['id',_0x7b4c('0x53')],'raw':!![]})[_0x7b4c('0x29')](handleEntityNotFound(_0x2f009a,null))['then'](function(_0x255262){if(_0x255262){var _0x3d81fb=path[_0x7b4c('0x58')](config['root'],_0x7b4c('0x59'),_0x255262[_0x7b4c('0x53')]);var _0x529803=util[_0x7b4c('0x35')](_0x7b4c('0x5a'),_0x3d81fb);if(fs[_0x7b4c('0x5b')](_0x529803)){_0x4d8491=!![];return _0x484e80[_0x7b4c('0x5c')](_0x529803,_0x3d81fb,config[_0x7b4c('0x5d')][_0x7b4c('0x5e')])[_0x7b4c('0x29')](function(){return _0x255262;});}return _0x255262;}})['then'](function(_0x4443d0){if(_0x4443d0){var _0x2dc79a=path['join'](config[_0x7b4c('0x5f')],_0x7b4c('0x59'),_0x4443d0[_0x7b4c('0x53')]);if(!fs[_0x7b4c('0x5b')](_0x2dc79a)){throw new db['Sequelize'][(_0x7b4c('0x60'))]('ScreenRecording\x20not\x20found');}if(_0x4443d0['filename']){return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,_0x4443d0[_0x7b4c('0x62')]+path[_0x7b4c('0x63')](_0x2dc79a),function(){if(_0x4d8491){fs[_0x7b4c('0x64')](_0x2dc79a);}});}else{return _0x2f009a[_0x7b4c('0x61')](_0x2dc79a,function(_0x5b24f6){if(_0x4d8491){fs['unlink'](_0x2dc79a);}});}}})[_0x7b4c('0x49')](function(_0x3c84af){if(_0x3c84af[_0x7b4c('0x65')]==='ScreenRecording\x20not\x20found'){_0x2f009a[_0x7b4c('0x1c')](0x194)[_0x7b4c('0x2e')](_0x7b4c('0x66'));}else{return handleError(_0x2f009a,null);}});};exports['destroy']=function(_0x222b47,_0x3b2144){return db[_0x7b4c('0x31')]['find']({'where':{'id':_0x222b47[_0x7b4c('0x57')]['id']}})[_0x7b4c('0x29')](function(_0x4ac03e){if(_[_0x7b4c('0x67')](_0x4ac03e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4ac03e;})[_0x7b4c('0x29')](function(_0x11ae6e){var _0x3a3713=path['join'](config['root'],_0x7b4c('0x59'),_0x11ae6e[_0x7b4c('0x53')]);logger[_0x7b4c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3713);if(!_[_0x7b4c('0x67')](_0x11ae6e['value'])&&fs[_0x7b4c('0x5b')](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}_0x3a3713=_0x3a3713+'.cypher';if(!_[_0x7b4c('0x67')](_0x11ae6e[_0x7b4c('0x53')])&&fs['existsSync'](_0x3a3713)){logger[_0x7b4c('0x68')](_0x7b4c('0x69')+_0x3a3713+_0x7b4c('0x6a'));fs[_0x7b4c('0x6b')](_0x3a3713);}return _0x11ae6e;})[_0x7b4c('0x29')](function(_0x2befd7){if(!_0x2befd7)throw new InternalError();return _0x2befd7[_0x7b4c('0x2a')]();})[_0x7b4c('0x29')](function(){_0x3b2144['status'](0xcc)[_0x7b4c('0x1d')]();})[_0x7b4c('0x49')](handleError(_0x3b2144,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 38a4b10..de2ceb2 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 _0xdacc=['moment','bluebird','path','../../config/environment','define','interactionid','lodash','util'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0xdacc,0xbe));var _0xcdac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdacc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcdac('0x0'));var util=require(_0xcdac('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcdac('0x2'));var BPromise=require(_0xcdac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdac('0x4'));var rimraf=require('rimraf');var config=require(_0xcdac('0x5'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x49cc94,_0x191948){return _0x49cc94[_0xcdac('0x6')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xcdac('0x7'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x939b=['screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x939b,0x8e));var _0xb939=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x939b[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xb939('0x0'));var util=require(_0xb939('0x1'));var logger=require(_0xb939('0x2'))('api');var moment=require(_0xb939('0x3'));var BPromise=require(_0xb939('0x4'));var rp=require(_0xb939('0x5'));var fs=require('fs');var path=require(_0xb939('0x6'));var rimraf=require(_0xb939('0x7'));var config=require(_0xb939('0x8'));var attributes=require(_0xb939('0x9'));module['exports']=function(_0x523325,_0x371066){return _0x523325[_0xb939('0xa')](_0xb939('0xb'),attributes,{'tableName':_0xb939('0xc'),'paranoid':![],'indexes':[{'name':_0xb939('0xd'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 03a36c8..ebcb197 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 _0xd2a3=['util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x5cb8cd,_0x5821d4){var _0x1bccd6=function(_0x42f1f8){while(--_0x42f1f8){_0x5cb8cd['push'](_0x5cb8cd['shift']());}};_0x1bccd6(++_0x5821d4);}(_0xd2a3,0x65));var _0x3d2a=function(_0x4686b9,_0x376275){_0x4686b9=_0x4686b9-0x0;var _0x22e449=_0xd2a3[_0x4686b9];return _0x22e449;};'use strict';var _=require(_0x3d2a('0x0'));var util=require(_0x3d2a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d2a('0x2'))['db'];var utils=require(_0x3d2a('0x3'));var logger=require(_0x3d2a('0x4'))(_0x3d2a('0x5'));var config=require('../../config/environment');var jayson=require(_0x3d2a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb5d36e,_0xccf5eb,_0x2e7a63){return new BPromise(function(_0x15fce2,_0x5c8c69){return client['request'](_0xb5d36e,_0x2e7a63)['then'](function(_0x17abc3){logger[_0x3d2a('0x7')](_0x3d2a('0x8'),_0xccf5eb,_0x3d2a('0x9'));logger[_0x3d2a('0xa')](_0x3d2a('0xb'),_0xccf5eb,_0x3d2a('0x9'),JSON[_0x3d2a('0xc')](_0x17abc3));if(_0x17abc3[_0x3d2a('0xd')]){if(_0x17abc3[_0x3d2a('0xd')]['code']===0x1f4){logger['error'](_0x3d2a('0x8'),_0xccf5eb,_0x17abc3[_0x3d2a('0xd')][_0x3d2a('0xe')]);return _0x5c8c69(_0x17abc3['error']['message']);}logger[_0x3d2a('0xd')](_0x3d2a('0x8'),_0xccf5eb,_0x17abc3['error'][_0x3d2a('0xe')]);return _0x15fce2(_0x17abc3[_0x3d2a('0xd')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0xccf5eb,_0x3d2a('0x9'));_0x15fce2(_0x17abc3[_0x3d2a('0xf')]['message']);}})[_0x3d2a('0x10')](function(_0x5dfc8d){logger[_0x3d2a('0xd')](_0x3d2a('0x8'),_0xccf5eb,_0x5dfc8d);_0x5c8c69(_0x5dfc8d);});});} \ No newline at end of file +var _0x23b3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','bluebird'];(function(_0x5c337e,_0x12c0cb){var _0x3c8041=function(_0x44d366){while(--_0x44d366){_0x5c337e['push'](_0x5c337e['shift']());}};_0x3c8041(++_0x12c0cb);}(_0x23b3,0xb6));var _0x323b=function(_0x1a8caa,_0x195483){_0x1a8caa=_0x1a8caa-0x0;var _0x9021fe=_0x23b3[_0x1a8caa];return _0x9021fe;};'use strict';var _=require(_0x323b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x323b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323b('0x2'));var db=require(_0x323b('0x3'))['db'];var utils=require(_0x323b('0x4'));var logger=require(_0x323b('0x5'))(_0x323b('0x6'));var config=require(_0x323b('0x7'));var jayson=require(_0x323b('0x8'));var client=jayson[_0x323b('0x9')][_0x323b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b7de3,_0x43667e,_0x58198e){return new BPromise(function(_0x439706,_0x378c55){return client[_0x323b('0xb')](_0x4b7de3,_0x58198e)[_0x323b('0xc')](function(_0x50c8c1){logger[_0x323b('0xd')](_0x323b('0xe'),_0x43667e,_0x323b('0xf'));logger[_0x323b('0x10')](_0x323b('0x11'),_0x43667e,_0x323b('0xf'),JSON['stringify'](_0x50c8c1));if(_0x50c8c1['error']){if(_0x50c8c1['error'][_0x323b('0x12')]===0x1f4){logger[_0x323b('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x43667e,_0x50c8c1[_0x323b('0x13')][_0x323b('0x14')]);return _0x378c55(_0x50c8c1['error'][_0x323b('0x14')]);}logger[_0x323b('0x13')](_0x323b('0xe'),_0x43667e,_0x50c8c1[_0x323b('0x13')]['message']);return _0x439706(_0x50c8c1[_0x323b('0x13')][_0x323b('0x14')]);}else{logger[_0x323b('0xd')](_0x323b('0xe'),_0x43667e,_0x323b('0xf'));_0x439706(_0x50c8c1[_0x323b('0x15')][_0x323b('0x14')]);}})[_0x323b('0x16')](function(_0x166293){logger[_0x323b('0x13')](_0x323b('0xe'),_0x43667e,_0x166293);_0x378c55(_0x166293);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index be45e0e..039ea99 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 _0x0f8d=['multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','root','originalname','/:id/logo_login','addLogoLogin','join','preferred','/:id/preferred','addFavicon','put','/:id','update','exports'];(function(_0x1360ac,_0x36dd81){var _0x4efdf3=function(_0x21d215){while(--_0x21d215){_0x1360ac['push'](_0x1360ac['shift']());}};_0x4efdf3(++_0x36dd81);}(_0x0f8d,0xa0));var _0xd0f8=function(_0x43ddf5,_0x71f223){_0x43ddf5=_0x43ddf5-0x0;var _0x1a0269=_0x0f8d[_0x43ddf5];return _0x1a0269;};'use strict';var multer=require(_0xd0f8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd0f8('0x1'));var express=require(_0xd0f8('0x2'));var router=express[_0xd0f8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd0f8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd0f8('0x5'));var controller=require('./setting.controller');router[_0xd0f8('0x6')]('/',auth[_0xd0f8('0x7')](),controller[_0xd0f8('0x8')]);router[_0xd0f8('0x6')](_0xd0f8('0x9'),controller[_0xd0f8('0xa')]);router[_0xd0f8('0x6')]('/:id',controller['show']);router['get'](_0xd0f8('0xb'),controller[_0xd0f8('0xc')]);router[_0xd0f8('0x6')]('/:id/logo_login',controller[_0xd0f8('0xd')]);router[_0xd0f8('0x6')](_0xd0f8('0xe'),controller[_0xd0f8('0xf')]);router[_0xd0f8('0x6')]('/:id/preferred',controller['getPreferred']);router[_0xd0f8('0x6')](_0xd0f8('0x10'),controller[_0xd0f8('0x11')]);var upload=multer({'storage':multer[_0xd0f8('0x12')]({'destination':function(_0x53506c,_0xe1ba47,_0x53f794){_0x53f794(null,path['join'](config['root'],_0xd0f8('0x13')));},'filename':function(_0x4e5f60,_0x1eba70,_0x16d40e){_0x16d40e(null,util[_0xd0f8('0x14')](_0xd0f8('0x15'),_0xd0f8('0x16'),path[_0xd0f8('0x17')](_0x1eba70['originalname'])));}})});router[_0xd0f8('0x18')](_0xd0f8('0xb'),upload[_0xd0f8('0x19')](_0xd0f8('0x1a')),controller[_0xd0f8('0x1b')]);var upload=multer({'storage':multer[_0xd0f8('0x12')]({'destination':function(_0x11a383,_0x43b875,_0x5466b1){_0x5466b1(null,path['join'](config[_0xd0f8('0x1c')],_0xd0f8('0x13')));},'filename':function(_0x2a235a,_0x5c677b,_0x19c71f){_0x19c71f(null,util[_0xd0f8('0x14')]('%s%s','logologin',path[_0xd0f8('0x17')](_0x5c677b[_0xd0f8('0x1d')])));}})});router['post'](_0xd0f8('0x1e'),upload['single']('file'),controller[_0xd0f8('0x1f')]);var upload=multer({'storage':multer[_0xd0f8('0x12')]({'destination':function(_0x292054,_0x4ed564,_0x393aec){_0x393aec(null,path[_0xd0f8('0x20')](config[_0xd0f8('0x1c')],'server/files/images/logos/'));},'filename':function(_0x20196f,_0x2d9bca,_0x57550f){_0x57550f(null,util['format']('%s%s',_0xd0f8('0x21'),path['extname'](_0x2d9bca[_0xd0f8('0x1d')])));}})});router[_0xd0f8('0x18')](_0xd0f8('0x22'),upload[_0xd0f8('0x19')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xd0f8('0x12')]({'destination':function(_0x212902,_0x79c1fd,_0x42c393){_0x42c393(null,path[_0xd0f8('0x20')](config[_0xd0f8('0x1c')],'server/files/images/logos/'));},'filename':function(_0x57384d,_0x1bc661,_0x28feae){_0x28feae(null,util[_0xd0f8('0x14')](_0xd0f8('0x15'),'favicon',path[_0xd0f8('0x17')](_0x1bc661[_0xd0f8('0x1d')])));}})});router['post']('/:id/favicon',upload['single']('file'),controller[_0xd0f8('0x23')]);router[_0xd0f8('0x24')](_0xd0f8('0x25'),auth[_0xd0f8('0x7')](),controller[_0xd0f8('0x26')]);module[_0xd0f8('0x27')]=router; \ No newline at end of file +var _0x440d=['server/files/images/logos/','format','logo','post','/:id/logo','single','file','addLogo','%s%s','logologin','extname','originalname','addLogoLogin','join','favicon','update','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x440d,0x167));var _0xd440=function(_0x5a2d38,_0x5a7d09){_0x5a2d38=_0x5a2d38-0x0;var _0xb5f96a=_0x440d[_0x5a2d38];return _0xb5f96a;};'use strict';var multer=require(_0xd440('0x0'));var util=require(_0xd440('0x1'));var path=require(_0xd440('0x2'));var timeout=require(_0xd440('0x3'));var express=require(_0xd440('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd440('0x5'));var config=require(_0xd440('0x6'));var controller=require(_0xd440('0x7'));router[_0xd440('0x8')]('/',auth[_0xd440('0x9')](),controller['index']);router[_0xd440('0x8')](_0xd440('0xa'),controller[_0xd440('0xb')]);router[_0xd440('0x8')](_0xd440('0xc'),controller['show']);router[_0xd440('0x8')]('/:id/logo',controller[_0xd440('0xd')]);router['get'](_0xd440('0xe'),controller['getLogoLogin']);router['get'](_0xd440('0xf'),controller['gdpr']);router[_0xd440('0x8')](_0xd440('0x10'),controller['getPreferred']);router[_0xd440('0x8')](_0xd440('0x11'),controller[_0xd440('0x12')]);var upload=multer({'storage':multer[_0xd440('0x13')]({'destination':function(_0x2f94b8,_0x446520,_0x53fb06){_0x53fb06(null,path['join'](config[_0xd440('0x14')],_0xd440('0x15')));},'filename':function(_0x1d3d41,_0x4e373a,_0x2d68ea){_0x2d68ea(null,util[_0xd440('0x16')]('%s%s',_0xd440('0x17'),path['extname'](_0x4e373a['originalname'])));}})});router[_0xd440('0x18')](_0xd440('0x19'),upload[_0xd440('0x1a')](_0xd440('0x1b')),controller[_0xd440('0x1c')]);var upload=multer({'storage':multer[_0xd440('0x13')]({'destination':function(_0x370cce,_0x5ceeb5,_0x5df767){_0x5df767(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x5c7381,_0x29ea38,_0xe942cc){_0xe942cc(null,util[_0xd440('0x16')](_0xd440('0x1d'),_0xd440('0x1e'),path[_0xd440('0x1f')](_0x29ea38[_0xd440('0x20')])));}})});router[_0xd440('0x18')](_0xd440('0xe'),upload[_0xd440('0x1a')]('file'),controller[_0xd440('0x21')]);var upload=multer({'storage':multer[_0xd440('0x13')]({'destination':function(_0xc9765c,_0x230b17,_0x5ddee6){_0x5ddee6(null,path[_0xd440('0x22')](config[_0xd440('0x14')],_0xd440('0x15')));},'filename':function(_0x55eb0c,_0xf9dd86,_0x452b44){_0x452b44(null,util[_0xd440('0x16')](_0xd440('0x1d'),'preferred',path[_0xd440('0x1f')](_0xf9dd86['originalname'])));}})});router[_0xd440('0x18')](_0xd440('0x10'),upload['single'](_0xd440('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0xd440('0x13')]({'destination':function(_0x454eeb,_0x3d9dc2,_0x462f91){_0x462f91(null,path[_0xd440('0x22')](config[_0xd440('0x14')],'server/files/images/logos/'));},'filename':function(_0x4b343e,_0x3f8e1a,_0x591097){_0x591097(null,util[_0xd440('0x16')](_0xd440('0x1d'),_0xd440('0x23'),path['extname'](_0x3f8e1a[_0xd440('0x20')])));}})});router[_0xd440('0x18')](_0xd440('0x11'),upload[_0xd440('0x1a')](_0xd440('0x1b')),controller['addFavicon']);router['put'](_0xd440('0xc'),auth['isAuthenticated'](),controller[_0xd440('0x24')]);module[_0xd440('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8ed3b2f..03f3c53 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 _0x1cbf=['INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x8dba7,_0x29082e){var _0x542462=function(_0x24edba){while(--_0x24edba){_0x8dba7['push'](_0x8dba7['shift']());}};_0x542462(++_0x29082e);}(_0x1cbf,0x18a));var _0xf1cb=function(_0x514ce9,_0x43c138){_0x514ce9=_0x514ce9-0x0;var _0x1249ea=_0x1cbf[_0x514ce9];return _0x1249ea;};'use strict';var Sequelize=require(_0xf1cb('0x0'));module[_0xf1cb('0x1')]={'min_internal':{'type':Sequelize[_0xf1cb('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf1cb('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf1cb('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf1cb('0x3')],'defaultValue':_0xf1cb('0x4')},'logo':{'type':Sequelize[_0xf1cb('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xf1cb('0x3')]},'turnusername':{'type':Sequelize[_0xf1cb('0x3')]},'turnpassword':{'type':Sequelize[_0xf1cb('0x3')]},'pageTitle':{'type':Sequelize[_0xf1cb('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf1cb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf1cb('0x3')],'defaultValue':_0xf1cb('0x6')},'enableEmailPreview':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf1cb('0x7')},'chatTimeout':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf1cb('0x3')]},'defaultPreferred':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf1cb('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xf1cb('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf1cb('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf1cb('0x3')]},'bucket':{'type':Sequelize[_0xf1cb('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xf1cb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf1cb('0x2')](0x2)[_0xf1cb('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xf1cb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xf1cb('0x2')](0x2)[_0xf1cb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xf1cb('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xf1cb('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x8835=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER'];(function(_0x2b06e3,_0x2aa97f){var _0x1e869f=function(_0x3e709b){while(--_0x3e709b){_0x2b06e3['push'](_0x2b06e3['shift']());}};_0x1e869f(++_0x2aa97f);}(_0x8835,0xe4));var _0x5883=function(_0x50cbe6,_0x561dd4){_0x50cbe6=_0x50cbe6-0x0;var _0x5ee624=_0x8835[_0x50cbe6];return _0x5ee624;};'use strict';var Sequelize=require(_0x5883('0x0'));module[_0x5883('0x1')]={'min_internal':{'type':Sequelize[_0x5883('0x2')](0xb),'unique':_0x5883('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5883('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x5883('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5883('0x5')],'defaultValue':_0x5883('0x6')},'logo':{'type':Sequelize[_0x5883('0x5')]},'defaultLogo':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5883('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5883('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5883('0x5')]},'turnaddr':{'type':Sequelize[_0x5883('0x5')]},'turnusername':{'type':Sequelize[_0x5883('0x5')]},'turnpassword':{'type':Sequelize[_0x5883('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5883('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5883('0x5')],'defaultValue':_0x5883('0x8')},'enableEmailPreview':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5883('0x5')],'defaultValue':_0x5883('0x9')},'chatTimeout':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5883('0x5')]},'defaultPreferred':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5883('0x5')]},'defaultFavicon':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5883('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5883('0x5')]},'sentiment':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x5883('0x5')]},'language':{'type':Sequelize[_0x5883('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x5883('0x2')](0x2)[_0x5883('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x5883('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5883('0x2')](0x2)[_0x5883('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5883('0x2')](0x2)[_0x5883('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x5883('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x5883('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x5883('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d350a95..dffa143 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 _0x9ec0=['sox','to-csv','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','length','body','find','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','custom','Sequelize','download','getLogoLogin','loginLogo','upperFirst','ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','fast-json-patch','moment','mustache','path'];(function(_0x161b28,_0x1f6927){var _0x121019=function(_0x57f01d){while(--_0x57f01d){_0x161b28['push'](_0x161b28['shift']());}};_0x121019(++_0x1f6927);}(_0x9ec0,0x71));var _0x09ec=function(_0x2322a8,_0x3cb189){_0x2322a8=_0x2322a8-0x0;var _0x5c980e=_0x9ec0[_0x2322a8];return _0x5c980e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09ec('0x0'));var rp=require('request-promise');var moment=require(_0x09ec('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x09ec('0x2'));var util=require('util');var path=require(_0x09ec('0x3'));var sox=require(_0x09ec('0x4'));var csv=require(_0x09ec('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x09ec('0x6'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x09ec('0x5'));var querystring=require(_0x09ec('0x7'));var Papa=require(_0x09ec('0x8'));var Redis=require(_0x09ec('0x9'));var authService=require(_0x09ec('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x09ec('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09ec('0xc'))('api');var utils=require('../../config/utils');var config=require(_0x09ec('0xd'));var licenseUtil=require('../../config/license/util');var db=require(_0x09ec('0xe'))['db'];var jayson=require(_0x09ec('0xf'));var client=jayson[_0x09ec('0x10')][_0x09ec('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x82251e,_0x24388b,_0x88d686,_0x448acf){return new BPromise(function(_0x219cd5,_0xda518a){var _0x415682=_0x448acf||client;return _0x415682[_0x09ec('0x12')](_0x82251e,_0x88d686)[_0x09ec('0x13')](function(_0x26e3d4){logger[_0x09ec('0x14')](_0x09ec('0x15'),_0x24388b,_0x09ec('0x16'));logger['debug'](_0x09ec('0x17'),_0x24388b,_0x09ec('0x16'),JSON[_0x09ec('0x18')](_0x26e3d4));if(_0x26e3d4[_0x09ec('0x19')]){if(_0x26e3d4[_0x09ec('0x19')][_0x09ec('0x1a')]===0x1f4){logger[_0x09ec('0x19')](_0x09ec('0x15'),_0x24388b,_0x26e3d4[_0x09ec('0x19')][_0x09ec('0x1b')]);return _0xda518a(_0x26e3d4['error']['message']);}logger['error'](_0x09ec('0x15'),_0x24388b,_0x26e3d4[_0x09ec('0x19')]['message']);return _0x219cd5(_0x26e3d4[_0x09ec('0x19')][_0x09ec('0x1b')]);}else{logger[_0x09ec('0x14')](_0x09ec('0x15'),_0x24388b,_0x09ec('0x16'));_0x219cd5(_0x26e3d4[_0x09ec('0x1c')][_0x09ec('0x1b')]);}})[_0x09ec('0x1d')](function(_0x5c7420){logger[_0x09ec('0x19')](_0x09ec('0x15'),_0x24388b,_0x5c7420);_0xda518a(_0x5c7420);});});}function respondWithStatusCode(_0x377181,_0xe1ef3e){_0xe1ef3e=_0xe1ef3e||0xcc;return function(_0x156b92){if(_0x156b92){return _0x377181[_0x09ec('0x1e')](_0xe1ef3e);}return _0x377181[_0x09ec('0x1f')](_0xe1ef3e)[_0x09ec('0x20')]();};}function respondWithResult(_0x3435c8,_0x2bee32){_0x2bee32=_0x2bee32||0xc8;return function(_0x1ee389){if(_0x1ee389){return _0x3435c8[_0x09ec('0x1f')](_0x2bee32)['json'](_0x1ee389);}};}function respondWithFilteredResult(_0x4ad98b,_0x1eb3c3){return function(_0x39ebfd){if(_0x39ebfd){var _0x30a5e7=typeof _0x1eb3c3['offset']===_0x09ec('0x21')&&typeof _0x1eb3c3[_0x09ec('0x22')]===_0x09ec('0x21');var _0x4b8e37=_0x39ebfd['count'];var _0x2fe744=_0x30a5e7?0x0:_0x1eb3c3[_0x09ec('0x23')];var _0x3dc03e=_0x30a5e7?_0x39ebfd[_0x09ec('0x24')]:_0x1eb3c3[_0x09ec('0x23')]+_0x1eb3c3['limit'];var _0x7fda52;if(_0x3dc03e>=_0x4b8e37){_0x3dc03e=_0x4b8e37;_0x7fda52=0xc8;}else{_0x7fda52=0xce;}_0x4ad98b['status'](_0x7fda52);return _0x4ad98b[_0x09ec('0x25')](_0x09ec('0x26'),_0x2fe744+'-'+_0x3dc03e+'/'+_0x4b8e37)[_0x09ec('0x27')](_0x39ebfd);}return null;};}function patchUpdates(_0x3f5fab){return function(_0x2769c7){try{jsonpatch[_0x09ec('0x28')](_0x2769c7,_0x3f5fab,!![]);}catch(_0x3929cd){return BPromise[_0x09ec('0x29')](_0x3929cd);}return _0x2769c7[_0x09ec('0x2a')]();};}function saveUpdates(_0xc04b,_0x505c14){return function(_0x2a2300){if(_0x2a2300){return _0x2a2300[_0x09ec('0x2b')](_0xc04b)[_0x09ec('0x13')](function(_0x34240d){return _0x34240d;});}return null;};}function removeEntity(_0x196e4d,_0x152919){return function(_0x2a819e){if(_0x2a819e){return _0x2a819e[_0x09ec('0x2c')]()[_0x09ec('0x13')](function(){_0x196e4d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3588,_0xfc35e7){return function(_0x50d35e){if(!_0x50d35e){_0x1f3588[_0x09ec('0x1e')](0x194);}return _0x50d35e;};}function handleError(_0x4d99ff,_0x5c3103){_0x5c3103=_0x5c3103||0x1f4;return function(_0xbd9273){logger[_0x09ec('0x19')](_0xbd9273[_0x09ec('0x2d')]);if(_0xbd9273[_0x09ec('0x2e')]){delete _0xbd9273['name'];}_0x4d99ff['status'](_0x5c3103)[_0x09ec('0x2f')](_0xbd9273);};}exports['index']=function(_0x3ca3b0,_0x5b6c62){var _0x1d03a5={},_0x39a4a2={},_0x5e786f={'count':0x0,'rows':[]};var _0x3d66ff=_[_0x09ec('0x30')](db[_0x09ec('0x31')][_0x09ec('0x32')],function(_0x521ef6){return{'name':_0x521ef6[_0x09ec('0x33')],'type':_0x521ef6[_0x09ec('0x34')][_0x09ec('0x35')]};});_0x39a4a2[_0x09ec('0x36')]=_[_0x09ec('0x30')](_0x3d66ff,_0x09ec('0x2e'));_0x39a4a2[_0x09ec('0x37')]=_[_0x09ec('0x38')](_0x3ca3b0[_0x09ec('0x37')]);_0x39a4a2[_0x09ec('0x39')]=_[_0x09ec('0x3a')](_0x39a4a2[_0x09ec('0x36')],_0x39a4a2[_0x09ec('0x37')]);_0x1d03a5['attributes']=_['intersection'](_0x39a4a2['model'],qs['fields'](_0x3ca3b0[_0x09ec('0x37')][_0x09ec('0x3b')]));_0x1d03a5[_0x09ec('0x3c')]=_0x1d03a5[_0x09ec('0x3c')]['length']?_0x1d03a5[_0x09ec('0x3c')]:_0x39a4a2[_0x09ec('0x36')];if(!_0x3ca3b0[_0x09ec('0x37')]['hasOwnProperty'](_0x09ec('0x3d'))){_0x1d03a5[_0x09ec('0x22')]=qs[_0x09ec('0x22')](_0x3ca3b0[_0x09ec('0x37')][_0x09ec('0x22')]);_0x1d03a5[_0x09ec('0x23')]=qs[_0x09ec('0x23')](_0x3ca3b0[_0x09ec('0x37')][_0x09ec('0x23')]);}_0x1d03a5['order']=qs['sort'](_0x3ca3b0[_0x09ec('0x37')][_0x09ec('0x3e')]);_0x1d03a5[_0x09ec('0x3f')]=qs[_0x09ec('0x39')](_[_0x09ec('0x40')](_0x3ca3b0[_0x09ec('0x37')],_0x39a4a2['filters']),_0x3d66ff);if(_0x3ca3b0[_0x09ec('0x37')][_0x09ec('0x41')]){_0x1d03a5['where']=_[_0x09ec('0x42')](_0x1d03a5[_0x09ec('0x3f')],{'$or':_[_0x09ec('0x30')](_0x3d66ff,function(_0x53ad8d){if(_0x53ad8d[_0x09ec('0x34')]!==_0x09ec('0x43')){var _0x3d572f={};_0x3d572f[_0x53ad8d[_0x09ec('0x2e')]]={'$like':'%'+_0x3ca3b0['query'][_0x09ec('0x41')]+'%'};return _0x3d572f;}})});}_0x1d03a5=_[_0x09ec('0x42')]({},_0x1d03a5,_0x3ca3b0['options']);var _0xed8f67={'where':_0x1d03a5['where']};return db[_0x09ec('0x31')]['count'](_0xed8f67)[_0x09ec('0x13')](function(_0x3e3f3f){_0x5e786f[_0x09ec('0x24')]=_0x3e3f3f;if(_0x3ca3b0[_0x09ec('0x37')]['includeAll']){_0x1d03a5[_0x09ec('0x44')]=[{'all':!![]}];}return db[_0x09ec('0x31')][_0x09ec('0x45')](_0x1d03a5);})[_0x09ec('0x13')](function(_0x3cbb55){_0x5e786f[_0x09ec('0x46')]=_0x3cbb55;return _0x5e786f;})['then'](respondWithFilteredResult(_0x5b6c62,_0x1d03a5))[_0x09ec('0x1d')](handleError(_0x5b6c62,null));};exports[_0x09ec('0x47')]=function(_0x23c78b,_0x113da1){var _0x1becb2={'raw':![],'where':{'id':_0x23c78b[_0x09ec('0x48')]['id']}},_0x217853={};_0x217853[_0x09ec('0x36')]=_[_0x09ec('0x38')](db['Setting'][_0x09ec('0x32')]);_0x217853[_0x09ec('0x37')]=_[_0x09ec('0x38')](_0x23c78b[_0x09ec('0x37')]);_0x217853[_0x09ec('0x39')]=_[_0x09ec('0x3a')](_0x217853['model'],_0x217853[_0x09ec('0x37')]);_0x1becb2[_0x09ec('0x3c')]=_[_0x09ec('0x3a')](_0x217853[_0x09ec('0x36')],qs[_0x09ec('0x3b')](_0x23c78b[_0x09ec('0x37')][_0x09ec('0x3b')]));_0x1becb2['attributes']=_0x1becb2[_0x09ec('0x3c')][_0x09ec('0x49')]?_0x1becb2['attributes']:_0x217853[_0x09ec('0x36')];if(_0x23c78b['query']['includeAll']){_0x1becb2[_0x09ec('0x44')]=[{'all':!![]}];}_0x1becb2=_[_0x09ec('0x42')]({},_0x1becb2,_0x23c78b['options']);return db['Setting']['find'](_0x1becb2)[_0x09ec('0x13')](handleEntityNotFound(_0x113da1,null))[_0x09ec('0x13')](respondWithResult(_0x113da1,null))[_0x09ec('0x1d')](handleError(_0x113da1,null));};exports[_0x09ec('0x2b')]=function(_0x53d73b,_0x58bf4a){if(_0x53d73b[_0x09ec('0x4a')]['id']){delete _0x53d73b['body']['id'];}return db['Setting'][_0x09ec('0x4b')]({'where':{'id':_0x53d73b[_0x09ec('0x48')]['id']}})[_0x09ec('0x13')](handleEntityNotFound(_0x58bf4a,null))[_0x09ec('0x13')](saveUpdates(_0x53d73b[_0x09ec('0x4a')],null))[_0x09ec('0x13')](respondWithResult(_0x58bf4a,null))['catch'](handleError(_0x58bf4a,null));};exports[_0x09ec('0x4c')]=function(_0x27de36,_0x2b8e07,_0x53e53e){if(_0x27de36['file']&&_0x27de36[_0x09ec('0x4d')][_0x09ec('0x4e')]){_0x27de36[_0x09ec('0x4a')][_0x09ec('0x4f')]=_0x27de36[_0x09ec('0x4d')][_0x09ec('0x4e')];}return db['Setting'][_0x09ec('0x4b')]({'where':{'id':_0x27de36[_0x09ec('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b8e07,null))[_0x09ec('0x13')](saveUpdates(_0x27de36['body'],null))[_0x09ec('0x13')](respondWithResult(_0x2b8e07,null))['catch'](handleError(_0x2b8e07,null));};exports[_0x09ec('0x50')]=function(_0x3a1523,_0x19d5bf,_0x2d400e){if(_0x3a1523[_0x09ec('0x4d')]&&_0x3a1523[_0x09ec('0x4d')][_0x09ec('0x4e')]){_0x3a1523['body']['loginLogo']=_0x3a1523[_0x09ec('0x4d')][_0x09ec('0x4e')];}return db[_0x09ec('0x31')][_0x09ec('0x4b')]({'where':{'id':_0x3a1523[_0x09ec('0x48')]['id']}})['then'](handleEntityNotFound(_0x19d5bf,null))[_0x09ec('0x13')](saveUpdates(_0x3a1523[_0x09ec('0x4a')],null))['then'](respondWithResult(_0x19d5bf,null))['catch'](handleError(_0x19d5bf,null));};var utilLicense=require(_0x09ec('0x51'));exports[_0x09ec('0x52')]=function(_0x5af35a,_0x28d862,_0x3b53f6){var _0x378ef0=_0x09ec('0x53');var _0xc7d869={'custom':![]};return utilLicense[_0x09ec('0x54')]()[_0x09ec('0x13')](function(_0x320d5b){if(_0x320d5b){_0xc7d869=_0x320d5b;}return db[_0x09ec('0x31')][_0x09ec('0x4b')]({'where':{'id':_0x5af35a[_0x09ec('0x48')]['id']},'attributes':[_0x09ec('0x4f'),'loginLogo',_0x09ec('0x55'),_0x09ec('0x56'),_0x09ec('0x57'),_0x09ec('0x58'),_0x09ec('0x59'),_0x09ec('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x28d862,null))[_0x09ec('0x13')](function(_0x221f45){if(_0x221f45){var _0x2015cc=_0x221f45[_0x09ec('0x4f')]&&fs[_0x09ec('0x5b')](path[_0x09ec('0x5c')](config[_0x09ec('0x5d')],_0x378ef0,_[_0x09ec('0x5e')](_0x221f45[_0x09ec('0x4f')])))?path[_0x09ec('0x5c')](config[_0x09ec('0x5d')],_0x378ef0,_[_0x09ec('0x5e')](_0x221f45[_0x09ec('0x4f')])):path[_0x09ec('0x5c')](config[_0x09ec('0x5d')],_0x378ef0,_[_0x09ec('0x5e')](_0x09ec('0x5f')));var _0x8bcbc7='default'+_['upperFirst'](_0x09ec('0x4f'));if(_0x221f45[_0x8bcbc7]||!_0xc7d869[_0x09ec('0x60')]){_0x2015cc=path[_0x09ec('0x5c')](config['root'],_0x378ef0,_['toLower']('default_logo.svg'));}if(!fs[_0x09ec('0x5b')](_0x2015cc)){throw new db[(_0x09ec('0x61'))]['ValidationError'](_['upperFirst'](_0x09ec('0x4f'))+'\x20not\x20found');}return _0x28d862[_0x09ec('0x62')](_0x2015cc);}})['catch'](handleError(_0x28d862,null));};var utilLicense=require(_0x09ec('0x51'));exports[_0x09ec('0x63')]=function(_0x10e630,_0x48a444,_0x552e7c){var _0x276e71=_0x09ec('0x53');var _0x2adf4c={'custom':![]};return utilLicense[_0x09ec('0x54')]()[_0x09ec('0x13')](function(_0x549b7e){if(_0x549b7e){_0x2adf4c=_0x549b7e;}return db[_0x09ec('0x31')][_0x09ec('0x4b')]({'where':{'id':_0x10e630[_0x09ec('0x48')]['id']},'attributes':[_0x09ec('0x4f'),'loginLogo',_0x09ec('0x55'),_0x09ec('0x56'),'defaultLogo',_0x09ec('0x58'),_0x09ec('0x59'),_0x09ec('0x5a')],'raw':!![]});})[_0x09ec('0x13')](handleEntityNotFound(_0x48a444,null))[_0x09ec('0x13')](function(_0x23e66a){if(_0x23e66a){var _0x488f27=_0x23e66a[_0x09ec('0x64')]&&fs['existsSync'](path[_0x09ec('0x5c')](config[_0x09ec('0x5d')],_0x276e71,_[_0x09ec('0x5e')](_0x23e66a[_0x09ec('0x64')])))?path['join'](config[_0x09ec('0x5d')],_0x276e71,_['toLower'](_0x23e66a[_0x09ec('0x64')])):path[_0x09ec('0x5c')](config['root'],_0x276e71,_[_0x09ec('0x5e')]('default_loginLogo.svg'));var _0x36550c='default'+_[_0x09ec('0x65')]('loginLogo');if(_0x23e66a[_0x36550c]||!_0x2adf4c['custom']){_0x488f27=path[_0x09ec('0x5c')](config['root'],_0x276e71,_[_0x09ec('0x5e')]('default_loginLogo.svg'));}if(!fs[_0x09ec('0x5b')](_0x488f27)){throw new db[(_0x09ec('0x61'))][(_0x09ec('0x66'))](_[_0x09ec('0x65')](_0x09ec('0x64'))+_0x09ec('0x67'));}return _0x48a444[_0x09ec('0x62')](_0x488f27);}})[_0x09ec('0x1d')](handleError(_0x48a444,null));};exports[_0x09ec('0x68')]=function(_0x38717a,_0x24006b){return db[_0x09ec('0x31')]['find']({'where':{'id':_0x38717a[_0x09ec('0x48')]['id']},'attributes':[_0x09ec('0x69')]})['then'](respondWithResult(_0x24006b,null))[_0x09ec('0x1d')](handleError(_0x24006b,null));};exports[_0x09ec('0x6a')]=function(_0x2df85e,_0x364580,_0x111c0e){if(_0x2df85e['file']&&_0x2df85e['file'][_0x09ec('0x4e')]){_0x2df85e['body'][_0x09ec('0x55')]=_0x2df85e[_0x09ec('0x4d')][_0x09ec('0x4e')];}return db[_0x09ec('0x31')][_0x09ec('0x4b')]({'where':{'id':_0x2df85e[_0x09ec('0x48')]['id']}})[_0x09ec('0x13')](handleEntityNotFound(_0x364580,null))[_0x09ec('0x13')](saveUpdates(_0x2df85e[_0x09ec('0x4a')],null))['then'](respondWithResult(_0x364580,null))['catch'](handleError(_0x364580,null));};var utilLicense=require(_0x09ec('0x51'));exports[_0x09ec('0x6b')]=function(_0x3dba1b,_0x2e47f1,_0x445d77){var _0x36ce36='server/files/images/logos';var _0x1ca24d={'custom':![]};return utilLicense[_0x09ec('0x54')]()[_0x09ec('0x13')](function(_0x46028e){if(_0x46028e){_0x1ca24d=_0x46028e;}return db[_0x09ec('0x31')][_0x09ec('0x4b')]({'where':{'id':_0x3dba1b[_0x09ec('0x48')]['id']},'attributes':[_0x09ec('0x4f'),'loginLogo','preferred',_0x09ec('0x56'),_0x09ec('0x57'),_0x09ec('0x58'),_0x09ec('0x59'),'defaultFavicon'],'raw':!![]});})[_0x09ec('0x13')](handleEntityNotFound(_0x2e47f1,null))[_0x09ec('0x13')](function(_0x7dd954){if(_0x7dd954){var _0x5b4e8c=_0x7dd954[_0x09ec('0x55')]&&fs['existsSync'](path[_0x09ec('0x5c')](config[_0x09ec('0x5d')],_0x36ce36,_[_0x09ec('0x5e')](_0x7dd954[_0x09ec('0x55')])))?path[_0x09ec('0x5c')](config[_0x09ec('0x5d')],_0x36ce36,_[_0x09ec('0x5e')](_0x7dd954[_0x09ec('0x55')])):path[_0x09ec('0x5c')](config['root'],_0x36ce36,_[_0x09ec('0x5e')](_0x09ec('0x6c')));var _0x3788fe='default'+_[_0x09ec('0x65')](_0x09ec('0x55'));if(_0x7dd954[_0x3788fe]||!_0x1ca24d[_0x09ec('0x60')]||!_0x1ca24d[_0x09ec('0x55')]){_0x5b4e8c=path[_0x09ec('0x5c')](config[_0x09ec('0x5d')],_0x36ce36,_[_0x09ec('0x5e')](_0x09ec('0x6c')));}if(!fs[_0x09ec('0x5b')](_0x5b4e8c)){throw new db[(_0x09ec('0x61'))]['ValidationError'](_['upperFirst']('preferred')+'\x20not\x20found');}return _0x2e47f1[_0x09ec('0x62')](_0x5b4e8c);}})[_0x09ec('0x1d')](handleError(_0x2e47f1,null));};exports[_0x09ec('0x6d')]=function(_0x3c3ec1,_0x10988e,_0x185a82){if(_0x3c3ec1['file']&&_0x3c3ec1[_0x09ec('0x4d')][_0x09ec('0x4e')]){_0x3c3ec1[_0x09ec('0x4a')][_0x09ec('0x56')]=_0x3c3ec1[_0x09ec('0x4d')][_0x09ec('0x4e')];}return db[_0x09ec('0x31')][_0x09ec('0x4b')]({'where':{'id':_0x3c3ec1[_0x09ec('0x48')]['id']}})[_0x09ec('0x13')](handleEntityNotFound(_0x10988e,null))[_0x09ec('0x13')](saveUpdates(_0x3c3ec1['body'],null))[_0x09ec('0x13')](respondWithResult(_0x10988e,null))['catch'](handleError(_0x10988e,null));};var utilLicense=require(_0x09ec('0x51'));exports[_0x09ec('0x6e')]=function(_0x397ed1,_0x11cfe8,_0x4d2552){var _0x25cead=_0x09ec('0x53');var _0xdfc9e7={'custom':![]};return utilLicense[_0x09ec('0x54')]()['then'](function(_0x9bff94){if(_0x9bff94){_0xdfc9e7=_0x9bff94;}return db[_0x09ec('0x31')][_0x09ec('0x4b')]({'where':{'id':_0x397ed1[_0x09ec('0x48')]['id']},'attributes':[_0x09ec('0x4f'),_0x09ec('0x64'),'preferred',_0x09ec('0x56'),_0x09ec('0x57'),_0x09ec('0x58'),_0x09ec('0x59'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x11cfe8,null))[_0x09ec('0x13')](function(_0x36aab5){if(_0x36aab5){var _0x2d0649=_0x36aab5[_0x09ec('0x56')]&&fs[_0x09ec('0x5b')](path[_0x09ec('0x5c')](config['root'],_0x25cead,_['toLower'](_0x36aab5['favicon'])))?path['join'](config['root'],_0x25cead,_[_0x09ec('0x5e')](_0x36aab5[_0x09ec('0x56')])):path['join'](config['root'],_0x25cead,_[_0x09ec('0x5e')](_0x09ec('0x6f')));var _0x439ef9='default'+_['upperFirst'](_0x09ec('0x56'));if(_0x36aab5[_0x439ef9]||!_0xdfc9e7['custom']){_0x2d0649=path['join'](config[_0x09ec('0x5d')],_0x25cead,_[_0x09ec('0x5e')](_0x09ec('0x6f')));}if(!fs[_0x09ec('0x5b')](_0x2d0649)){throw new db['Sequelize']['ValidationError'](_[_0x09ec('0x65')](_0x09ec('0x56'))+'\x20not\x20found');}return _0x11cfe8['download'](_0x2d0649);}})[_0x09ec('0x1d')](handleError(_0x11cfe8,null));};exports[_0x09ec('0x70')]=function(_0x24e1fc,_0x1fde51){var _0x4dd7dc={'offset':moment()['utcOffset']()};_0x4dd7dc[_0x09ec('0x71')]=moment()[_0x09ec('0x72')](_0x4dd7dc['offset'])[_0x09ec('0x73')](_0x09ec('0x74'));return _0x1fde51['status'](0xc8)[_0x09ec('0x2f')](_0x4dd7dc);}; \ No newline at end of file +var _0x34e2=['show','params','rawAttributes','include','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','defaultPreferred','default_loginLogo.svg','Sequelize','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','zip-dir','fast-json-patch','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','includeAll','findAll'];(function(_0xbdf03f,_0x595215){var _0x2bbe9e=function(_0x59fbd4){while(--_0x59fbd4){_0xbdf03f['push'](_0xbdf03f['shift']());}};_0x2bbe9e(++_0x595215);}(_0x34e2,0x126));var _0x234e=function(_0x37c607,_0x25f1e1){_0x37c607=_0x37c607-0x0;var _0x15185=_0x34e2[_0x37c607];return _0x15185;};'use strict';var emlformat=require(_0x234e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x234e('0x1'));var jsonpatch=require(_0x234e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x234e('0x3'));var util=require(_0x234e('0x4'));var path=require(_0x234e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x234e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x234e('0x7'));var squel=require(_0x234e('0x8'));var crypto=require(_0x234e('0x9'));var jsforce=require(_0x234e('0xa'));var deskjs=require(_0x234e('0xb'));var toCsv=require(_0x234e('0xc'));var querystring=require(_0x234e('0xd'));var Papa=require('papaparse');var Redis=require(_0x234e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x234e('0xf'));var as=require(_0x234e('0x10'));var hardwareService=require(_0x234e('0x11'));var logger=require(_0x234e('0x12'))(_0x234e('0x13'));var utils=require(_0x234e('0x14'));var config=require(_0x234e('0x15'));var licenseUtil=require(_0x234e('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x234e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1c2eeb,_0x1d876e,_0x556c3f,_0x544d26){return new BPromise(function(_0x396fb2,_0x27a18f){var _0x3d2e61=_0x544d26||client;return _0x3d2e61[_0x234e('0x18')](_0x1c2eeb,_0x556c3f)['then'](function(_0x23a8bd){logger[_0x234e('0x19')](_0x234e('0x1a'),_0x1d876e,_0x234e('0x1b'));logger[_0x234e('0x1c')](_0x234e('0x1d'),_0x1d876e,_0x234e('0x1b'),JSON[_0x234e('0x1e')](_0x23a8bd));if(_0x23a8bd[_0x234e('0x1f')]){if(_0x23a8bd[_0x234e('0x1f')][_0x234e('0x20')]===0x1f4){logger[_0x234e('0x1f')](_0x234e('0x1a'),_0x1d876e,_0x23a8bd['error'][_0x234e('0x21')]);return _0x27a18f(_0x23a8bd[_0x234e('0x1f')]['message']);}logger[_0x234e('0x1f')](_0x234e('0x1a'),_0x1d876e,_0x23a8bd[_0x234e('0x1f')][_0x234e('0x21')]);return _0x396fb2(_0x23a8bd['error']['message']);}else{logger[_0x234e('0x19')]('Setting,\x20%s,\x20%s',_0x1d876e,_0x234e('0x1b'));_0x396fb2(_0x23a8bd[_0x234e('0x22')]['message']);}})[_0x234e('0x23')](function(_0x58b194){logger['error']('Setting,\x20%s,\x20%s',_0x1d876e,_0x58b194);_0x27a18f(_0x58b194);});});}function respondWithStatusCode(_0x128fc1,_0x48ed5a){_0x48ed5a=_0x48ed5a||0xcc;return function(_0x4f9fd3){if(_0x4f9fd3){return _0x128fc1[_0x234e('0x24')](_0x48ed5a);}return _0x128fc1[_0x234e('0x25')](_0x48ed5a)[_0x234e('0x26')]();};}function respondWithResult(_0x55dd9b,_0x4281ff){_0x4281ff=_0x4281ff||0xc8;return function(_0x4856e5){if(_0x4856e5){return _0x55dd9b[_0x234e('0x25')](_0x4281ff)['json'](_0x4856e5);}};}function respondWithFilteredResult(_0x35a15f,_0x3d5881){return function(_0x24d983){if(_0x24d983){var _0x7b70d4=typeof _0x3d5881[_0x234e('0x27')]===_0x234e('0x28')&&typeof _0x3d5881[_0x234e('0x29')]===_0x234e('0x28');var _0x1d5dc3=_0x24d983[_0x234e('0x2a')];var _0x18feeb=_0x7b70d4?0x0:_0x3d5881['offset'];var _0x527efd=_0x7b70d4?_0x24d983['count']:_0x3d5881[_0x234e('0x27')]+_0x3d5881[_0x234e('0x29')];var _0x512f97;if(_0x527efd>=_0x1d5dc3){_0x527efd=_0x1d5dc3;_0x512f97=0xc8;}else{_0x512f97=0xce;}_0x35a15f['status'](_0x512f97);return _0x35a15f[_0x234e('0x2b')](_0x234e('0x2c'),_0x18feeb+'-'+_0x527efd+'/'+_0x1d5dc3)[_0x234e('0x2d')](_0x24d983);}return null;};}function patchUpdates(_0x1eaffc){return function(_0x286e04){try{jsonpatch[_0x234e('0x2e')](_0x286e04,_0x1eaffc,!![]);}catch(_0x38a0d2){return BPromise['reject'](_0x38a0d2);}return _0x286e04[_0x234e('0x2f')]();};}function saveUpdates(_0x404e7c,_0x5cdae4){return function(_0x6496c3){if(_0x6496c3){return _0x6496c3['update'](_0x404e7c)[_0x234e('0x30')](function(_0x1c31a3){return _0x1c31a3;});}return null;};}function removeEntity(_0x526f4a,_0x237449){return function(_0xb3239e){if(_0xb3239e){return _0xb3239e['destroy']()['then'](function(){_0x526f4a['status'](0xcc)[_0x234e('0x26')]();});}};}function handleEntityNotFound(_0x2f6bb5,_0x23407d){return function(_0x1aa011){if(!_0x1aa011){_0x2f6bb5[_0x234e('0x24')](0x194);}return _0x1aa011;};}function handleError(_0x567161,_0x1ecb8a){_0x1ecb8a=_0x1ecb8a||0x1f4;return function(_0x4d2677){logger['error'](_0x4d2677[_0x234e('0x31')]);if(_0x4d2677['name']){delete _0x4d2677[_0x234e('0x32')];}_0x567161[_0x234e('0x25')](_0x1ecb8a)[_0x234e('0x33')](_0x4d2677);};}exports[_0x234e('0x34')]=function(_0x4563f2,_0xafb3dd){var _0x1df9a3={},_0x2cd189={},_0x15fb4f={'count':0x0,'rows':[]};var _0x44434b=_[_0x234e('0x35')](db['Setting']['rawAttributes'],function(_0x545296){return{'name':_0x545296[_0x234e('0x36')],'type':_0x545296[_0x234e('0x37')][_0x234e('0x38')]};});_0x2cd189[_0x234e('0x39')]=_[_0x234e('0x35')](_0x44434b,_0x234e('0x32'));_0x2cd189[_0x234e('0x3a')]=_[_0x234e('0x3b')](_0x4563f2[_0x234e('0x3a')]);_0x2cd189[_0x234e('0x3c')]=_['intersection'](_0x2cd189[_0x234e('0x39')],_0x2cd189[_0x234e('0x3a')]);_0x1df9a3[_0x234e('0x3d')]=_[_0x234e('0x3e')](_0x2cd189[_0x234e('0x39')],qs[_0x234e('0x3f')](_0x4563f2[_0x234e('0x3a')][_0x234e('0x3f')]));_0x1df9a3[_0x234e('0x3d')]=_0x1df9a3['attributes'][_0x234e('0x40')]?_0x1df9a3[_0x234e('0x3d')]:_0x2cd189[_0x234e('0x39')];if(!_0x4563f2[_0x234e('0x3a')][_0x234e('0x41')](_0x234e('0x42'))){_0x1df9a3[_0x234e('0x29')]=qs[_0x234e('0x29')](_0x4563f2[_0x234e('0x3a')]['limit']);_0x1df9a3[_0x234e('0x27')]=qs['offset'](_0x4563f2[_0x234e('0x3a')]['offset']);}_0x1df9a3[_0x234e('0x43')]=qs[_0x234e('0x44')](_0x4563f2[_0x234e('0x3a')][_0x234e('0x44')]);_0x1df9a3[_0x234e('0x45')]=qs[_0x234e('0x3c')](_[_0x234e('0x46')](_0x4563f2[_0x234e('0x3a')],_0x2cd189[_0x234e('0x3c')]),_0x44434b);if(_0x4563f2[_0x234e('0x3a')][_0x234e('0x47')]){_0x1df9a3[_0x234e('0x45')]=_[_0x234e('0x48')](_0x1df9a3['where'],{'$or':_['map'](_0x44434b,function(_0x19a843){if(_0x19a843[_0x234e('0x37')]!==_0x234e('0x49')){var _0x2cd401={};_0x2cd401[_0x19a843[_0x234e('0x32')]]={'$like':'%'+_0x4563f2[_0x234e('0x3a')]['filter']+'%'};return _0x2cd401;}})});}_0x1df9a3=_[_0x234e('0x48')]({},_0x1df9a3,_0x4563f2[_0x234e('0x4a')]);var _0x4f244b={'where':_0x1df9a3[_0x234e('0x45')]};return db[_0x234e('0x4b')][_0x234e('0x2a')](_0x4f244b)[_0x234e('0x30')](function(_0x31b9e6){_0x15fb4f[_0x234e('0x2a')]=_0x31b9e6;if(_0x4563f2['query'][_0x234e('0x4c')]){_0x1df9a3['include']=[{'all':!![]}];}return db[_0x234e('0x4b')][_0x234e('0x4d')](_0x1df9a3);})[_0x234e('0x30')](function(_0xa70b4a){_0x15fb4f['rows']=_0xa70b4a;return _0x15fb4f;})[_0x234e('0x30')](respondWithFilteredResult(_0xafb3dd,_0x1df9a3))['catch'](handleError(_0xafb3dd,null));};exports[_0x234e('0x4e')]=function(_0xcf5aa8,_0x3af329){var _0x436545={'raw':![],'where':{'id':_0xcf5aa8[_0x234e('0x4f')]['id']}},_0x2174a8={};_0x2174a8['model']=_['keys'](db[_0x234e('0x4b')][_0x234e('0x50')]);_0x2174a8['query']=_[_0x234e('0x3b')](_0xcf5aa8[_0x234e('0x3a')]);_0x2174a8[_0x234e('0x3c')]=_[_0x234e('0x3e')](_0x2174a8[_0x234e('0x39')],_0x2174a8['query']);_0x436545[_0x234e('0x3d')]=_[_0x234e('0x3e')](_0x2174a8[_0x234e('0x39')],qs[_0x234e('0x3f')](_0xcf5aa8['query']['fields']));_0x436545[_0x234e('0x3d')]=_0x436545[_0x234e('0x3d')][_0x234e('0x40')]?_0x436545['attributes']:_0x2174a8[_0x234e('0x39')];if(_0xcf5aa8[_0x234e('0x3a')][_0x234e('0x4c')]){_0x436545[_0x234e('0x51')]=[{'all':!![]}];}_0x436545=_['merge']({},_0x436545,_0xcf5aa8[_0x234e('0x4a')]);return db[_0x234e('0x4b')][_0x234e('0x52')](_0x436545)[_0x234e('0x30')](handleEntityNotFound(_0x3af329,null))[_0x234e('0x30')](respondWithResult(_0x3af329,null))[_0x234e('0x23')](handleError(_0x3af329,null));};exports[_0x234e('0x53')]=function(_0x39b2cd,_0x334fae){if(_0x39b2cd[_0x234e('0x54')]['id']){delete _0x39b2cd[_0x234e('0x54')]['id'];}return db[_0x234e('0x4b')][_0x234e('0x52')]({'where':{'id':_0x39b2cd[_0x234e('0x4f')]['id']}})[_0x234e('0x30')](handleEntityNotFound(_0x334fae,null))[_0x234e('0x30')](saveUpdates(_0x39b2cd[_0x234e('0x54')],null))['then'](respondWithResult(_0x334fae,null))[_0x234e('0x23')](handleError(_0x334fae,null));};exports[_0x234e('0x55')]=function(_0x2aaa95,_0x1660e7,_0x4fc053){if(_0x2aaa95[_0x234e('0x56')]&&_0x2aaa95[_0x234e('0x56')][_0x234e('0x57')]){_0x2aaa95[_0x234e('0x54')][_0x234e('0x58')]=_0x2aaa95[_0x234e('0x56')][_0x234e('0x57')];}return db[_0x234e('0x4b')][_0x234e('0x52')]({'where':{'id':_0x2aaa95['params']['id']}})['then'](handleEntityNotFound(_0x1660e7,null))[_0x234e('0x30')](saveUpdates(_0x2aaa95['body'],null))[_0x234e('0x30')](respondWithResult(_0x1660e7,null))['catch'](handleError(_0x1660e7,null));};exports[_0x234e('0x59')]=function(_0xd9a969,_0x1e4768,_0x5b2713){if(_0xd9a969[_0x234e('0x56')]&&_0xd9a969[_0x234e('0x56')][_0x234e('0x57')]){_0xd9a969[_0x234e('0x54')][_0x234e('0x5a')]=_0xd9a969[_0x234e('0x56')][_0x234e('0x57')];}return db[_0x234e('0x4b')]['find']({'where':{'id':_0xd9a969['params']['id']}})['then'](handleEntityNotFound(_0x1e4768,null))[_0x234e('0x30')](saveUpdates(_0xd9a969['body'],null))[_0x234e('0x30')](respondWithResult(_0x1e4768,null))['catch'](handleError(_0x1e4768,null));};var utilLicense=require(_0x234e('0x16'));exports['getLogo']=function(_0x542b8c,_0x471adb,_0x4e2ffa){var _0x1849d3=_0x234e('0x5b');var _0x1c286b={'custom':![]};return utilLicense[_0x234e('0x5c')]()[_0x234e('0x30')](function(_0x5b8fd8){if(_0x5b8fd8){_0x1c286b=_0x5b8fd8;}return db[_0x234e('0x4b')][_0x234e('0x52')]({'where':{'id':_0x542b8c[_0x234e('0x4f')]['id']},'attributes':[_0x234e('0x58'),'loginLogo','preferred',_0x234e('0x5d'),_0x234e('0x5e'),_0x234e('0x5f'),'defaultPreferred',_0x234e('0x60')],'raw':!![]});})[_0x234e('0x30')](handleEntityNotFound(_0x471adb,null))[_0x234e('0x30')](function(_0x29b6ab){if(_0x29b6ab){var _0x25aa5f=_0x29b6ab[_0x234e('0x58')]&&fs[_0x234e('0x61')](path[_0x234e('0x62')](config[_0x234e('0x63')],_0x1849d3,_[_0x234e('0x64')](_0x29b6ab[_0x234e('0x58')])))?path[_0x234e('0x62')](config[_0x234e('0x63')],_0x1849d3,_[_0x234e('0x64')](_0x29b6ab[_0x234e('0x58')])):path['join'](config[_0x234e('0x63')],_0x1849d3,_[_0x234e('0x64')](_0x234e('0x65')));var _0x72dec8=_0x234e('0x66')+_[_0x234e('0x67')](_0x234e('0x58'));if(_0x29b6ab[_0x72dec8]||!_0x1c286b[_0x234e('0x68')]){_0x25aa5f=path[_0x234e('0x62')](config['root'],_0x1849d3,_['toLower'](_0x234e('0x65')));}if(!fs[_0x234e('0x61')](_0x25aa5f)){throw new db['Sequelize'][(_0x234e('0x69'))](_[_0x234e('0x67')](_0x234e('0x58'))+_0x234e('0x6a'));}return _0x471adb[_0x234e('0x6b')](_0x25aa5f);}})[_0x234e('0x23')](handleError(_0x471adb,null));};var utilLicense=require(_0x234e('0x16'));exports[_0x234e('0x6c')]=function(_0x2bf6bf,_0x56a7c3,_0x3f162b){var _0x5d88f0='server/files/images/logos';var _0x4ee861={'custom':![]};return utilLicense[_0x234e('0x5c')]()[_0x234e('0x30')](function(_0x4708ff){if(_0x4708ff){_0x4ee861=_0x4708ff;}return db[_0x234e('0x4b')]['find']({'where':{'id':_0x2bf6bf[_0x234e('0x4f')]['id']},'attributes':[_0x234e('0x58'),_0x234e('0x5a'),_0x234e('0x6d'),_0x234e('0x5d'),_0x234e('0x5e'),'defaultLoginLogo',_0x234e('0x6e'),_0x234e('0x60')],'raw':!![]});})[_0x234e('0x30')](handleEntityNotFound(_0x56a7c3,null))[_0x234e('0x30')](function(_0x2db9a0){if(_0x2db9a0){var _0x34b0e9=_0x2db9a0[_0x234e('0x5a')]&&fs['existsSync'](path[_0x234e('0x62')](config[_0x234e('0x63')],_0x5d88f0,_[_0x234e('0x64')](_0x2db9a0[_0x234e('0x5a')])))?path['join'](config['root'],_0x5d88f0,_[_0x234e('0x64')](_0x2db9a0[_0x234e('0x5a')])):path[_0x234e('0x62')](config[_0x234e('0x63')],_0x5d88f0,_[_0x234e('0x64')](_0x234e('0x6f')));var _0x5989ad='default'+_[_0x234e('0x67')](_0x234e('0x5a'));if(_0x2db9a0[_0x5989ad]||!_0x4ee861[_0x234e('0x68')]){_0x34b0e9=path[_0x234e('0x62')](config[_0x234e('0x63')],_0x5d88f0,_[_0x234e('0x64')](_0x234e('0x6f')));}if(!fs['existsSync'](_0x34b0e9)){throw new db[(_0x234e('0x70'))][(_0x234e('0x69'))](_['upperFirst'](_0x234e('0x5a'))+_0x234e('0x6a'));}return _0x56a7c3[_0x234e('0x6b')](_0x34b0e9);}})[_0x234e('0x23')](handleError(_0x56a7c3,null));};exports[_0x234e('0x71')]=function(_0x10ab8f,_0x5c63b5){return db[_0x234e('0x4b')][_0x234e('0x52')]({'where':{'id':_0x10ab8f[_0x234e('0x4f')]['id']},'attributes':[_0x234e('0x72')]})[_0x234e('0x30')](respondWithResult(_0x5c63b5,null))['catch'](handleError(_0x5c63b5,null));};exports['addPreferred']=function(_0x3f27da,_0x9087d3,_0x32d2af){if(_0x3f27da[_0x234e('0x56')]&&_0x3f27da[_0x234e('0x56')]['filename']){_0x3f27da['body'][_0x234e('0x6d')]=_0x3f27da[_0x234e('0x56')][_0x234e('0x57')];}return db[_0x234e('0x4b')]['find']({'where':{'id':_0x3f27da['params']['id']}})['then'](handleEntityNotFound(_0x9087d3,null))['then'](saveUpdates(_0x3f27da[_0x234e('0x54')],null))[_0x234e('0x30')](respondWithResult(_0x9087d3,null))[_0x234e('0x23')](handleError(_0x9087d3,null));};var utilLicense=require(_0x234e('0x16'));exports[_0x234e('0x73')]=function(_0x1d0bd8,_0x527a96,_0x6152b8){var _0x1283ad='server/files/images/logos';var _0x543674={'custom':![]};return utilLicense[_0x234e('0x5c')]()[_0x234e('0x30')](function(_0xe5c89c){if(_0xe5c89c){_0x543674=_0xe5c89c;}return db['Setting'][_0x234e('0x52')]({'where':{'id':_0x1d0bd8[_0x234e('0x4f')]['id']},'attributes':[_0x234e('0x58'),_0x234e('0x5a'),'preferred',_0x234e('0x5d'),_0x234e('0x5e'),'defaultLoginLogo','defaultPreferred',_0x234e('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x527a96,null))[_0x234e('0x30')](function(_0x312d7d){if(_0x312d7d){var _0x1be3a8=_0x312d7d[_0x234e('0x6d')]&&fs[_0x234e('0x61')](path['join'](config[_0x234e('0x63')],_0x1283ad,_[_0x234e('0x64')](_0x312d7d[_0x234e('0x6d')])))?path[_0x234e('0x62')](config['root'],_0x1283ad,_['toLower'](_0x312d7d[_0x234e('0x6d')])):path[_0x234e('0x62')](config[_0x234e('0x63')],_0x1283ad,_[_0x234e('0x64')]('default_preferred.png'));var _0x5792ac=_0x234e('0x66')+_[_0x234e('0x67')](_0x234e('0x6d'));if(_0x312d7d[_0x5792ac]||!_0x543674['custom']||!_0x543674[_0x234e('0x6d')]){_0x1be3a8=path[_0x234e('0x62')](config[_0x234e('0x63')],_0x1283ad,_[_0x234e('0x64')](_0x234e('0x74')));}if(!fs[_0x234e('0x61')](_0x1be3a8)){throw new db[(_0x234e('0x70'))]['ValidationError'](_[_0x234e('0x67')](_0x234e('0x6d'))+_0x234e('0x6a'));}return _0x527a96['download'](_0x1be3a8);}})['catch'](handleError(_0x527a96,null));};exports[_0x234e('0x75')]=function(_0x47cf94,_0x581571,_0x99be2c){if(_0x47cf94[_0x234e('0x56')]&&_0x47cf94[_0x234e('0x56')][_0x234e('0x57')]){_0x47cf94['body']['favicon']=_0x47cf94[_0x234e('0x56')]['filename'];}return db[_0x234e('0x4b')][_0x234e('0x52')]({'where':{'id':_0x47cf94['params']['id']}})[_0x234e('0x30')](handleEntityNotFound(_0x581571,null))[_0x234e('0x30')](saveUpdates(_0x47cf94['body'],null))[_0x234e('0x30')](respondWithResult(_0x581571,null))['catch'](handleError(_0x581571,null));};var utilLicense=require(_0x234e('0x16'));exports[_0x234e('0x76')]=function(_0x41f178,_0x4a46d5,_0x361667){var _0x1df19e=_0x234e('0x5b');var _0x281f3b={'custom':![]};return utilLicense[_0x234e('0x5c')]()[_0x234e('0x30')](function(_0x275a2b){if(_0x275a2b){_0x281f3b=_0x275a2b;}return db[_0x234e('0x4b')][_0x234e('0x52')]({'where':{'id':_0x41f178[_0x234e('0x4f')]['id']},'attributes':[_0x234e('0x58'),_0x234e('0x5a'),_0x234e('0x6d'),_0x234e('0x5d'),_0x234e('0x5e'),_0x234e('0x5f'),_0x234e('0x6e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4a46d5,null))[_0x234e('0x30')](function(_0x8ce6cc){if(_0x8ce6cc){var _0x1bc913=_0x8ce6cc[_0x234e('0x5d')]&&fs[_0x234e('0x61')](path[_0x234e('0x62')](config[_0x234e('0x63')],_0x1df19e,_['toLower'](_0x8ce6cc[_0x234e('0x5d')])))?path[_0x234e('0x62')](config['root'],_0x1df19e,_['toLower'](_0x8ce6cc[_0x234e('0x5d')])):path[_0x234e('0x62')](config[_0x234e('0x63')],_0x1df19e,_[_0x234e('0x64')](_0x234e('0x77')));var _0x112b9f=_0x234e('0x66')+_[_0x234e('0x67')](_0x234e('0x5d'));if(_0x8ce6cc[_0x112b9f]||!_0x281f3b['custom']){_0x1bc913=path[_0x234e('0x62')](config[_0x234e('0x63')],_0x1df19e,_[_0x234e('0x64')](_0x234e('0x77')));}if(!fs[_0x234e('0x61')](_0x1bc913)){throw new db[(_0x234e('0x70'))][(_0x234e('0x69'))](_[_0x234e('0x67')](_0x234e('0x5d'))+_0x234e('0x6a'));}return _0x4a46d5[_0x234e('0x6b')](_0x1bc913);}})[_0x234e('0x23')](handleError(_0x4a46d5,null));};exports[_0x234e('0x78')]=function(_0x2427a6,_0x4c564e){var _0x11a51a={'offset':moment()[_0x234e('0x79')]()};_0x11a51a[_0x234e('0x7a')]=moment()[_0x234e('0x79')](_0x11a51a['offset'])[_0x234e('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x4c564e[_0x234e('0x25')](0xc8)[_0x234e('0x33')](_0x11a51a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 841c8dd..939c4f2 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0xa5db57,_0x1880a7){var _0x11cd5c=function(_0x1bdc0b){while(--_0x1bdc0b){_0xa5db57['push'](_0xa5db57['shift']());}};_0x11cd5c(++_0x1880a7);}(_0xedd9,0xfc));var _0x9edd=function(_0x23a2ba,_0x193a82){_0x23a2ba=_0x23a2ba-0x0;var _0x3e8f82=_0xedd9[_0x23a2ba];return _0x3e8f82;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 0ed7dcb..c97f208 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 _0x8b06=['include','map','model','stringify','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','ShowSetting','Setting','options','raw','where','attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8b06,0xb8));var _0x68b0=function(_0x297fd3,_0x1a586b){_0x297fd3=_0x297fd3-0x0;var _0x32e8e3=_0x8b06[_0x297fd3];return _0x32e8e3;};'use strict';var _=require('lodash');var util=require(_0x68b0('0x0'));var moment=require('moment');var BPromise=require(_0x68b0('0x1'));var rs=require(_0x68b0('0x2'));var fs=require('fs');var Redis=require(_0x68b0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x68b0('0x4'));var logger=require(_0x68b0('0x5'))(_0x68b0('0x6'));var config=require(_0x68b0('0x7'));var jayson=require(_0x68b0('0x8'));var client=jayson['client'][_0x68b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290c2c,_0x6b4364,_0x50d7ef){return new BPromise(function(_0x3dff14,_0xd5899e){return client['request'](_0x290c2c,_0x50d7ef)[_0x68b0('0xa')](function(_0x193ce2){logger['info']('Setting,\x20%s,\x20%s',_0x6b4364,_0x68b0('0xb'));logger['debug'](_0x68b0('0xc'),_0x6b4364,_0x68b0('0xb'),JSON['stringify'](_0x193ce2));if(_0x193ce2[_0x68b0('0xd')]){if(_0x193ce2['error'][_0x68b0('0xe')]===0x1f4){logger['error'](_0x68b0('0xf'),_0x6b4364,_0x193ce2['error'][_0x68b0('0x10')]);return _0xd5899e(_0x193ce2[_0x68b0('0xd')][_0x68b0('0x10')]);}logger[_0x68b0('0xd')](_0x68b0('0xf'),_0x6b4364,_0x193ce2[_0x68b0('0xd')][_0x68b0('0x10')]);return _0x3dff14(_0x193ce2[_0x68b0('0xd')][_0x68b0('0x10')]);}else{logger[_0x68b0('0x11')](_0x68b0('0xf'),_0x6b4364,_0x68b0('0xb'));_0x3dff14(_0x193ce2[_0x68b0('0x12')][_0x68b0('0x10')]);}})[_0x68b0('0x13')](function(_0x25a582){logger[_0x68b0('0xd')]('Setting,\x20%s,\x20%s',_0x6b4364,_0x25a582);_0xd5899e(_0x25a582);});});}exports[_0x68b0('0x14')]=function(_0x3c3f81){var _0x362905=this;return new Promise(function(_0x3e1a98,_0x1e1f90){return db[_0x68b0('0x15')]['find']({'raw':_0x3c3f81[_0x68b0('0x16')]?_0x3c3f81[_0x68b0('0x16')][_0x68b0('0x17')]===undefined?!![]:![]:!![],'where':_0x3c3f81[_0x68b0('0x16')]?_0x3c3f81[_0x68b0('0x16')][_0x68b0('0x18')]||null:null,'attributes':_0x3c3f81[_0x68b0('0x16')]?_0x3c3f81[_0x68b0('0x16')][_0x68b0('0x19')]||null:null,'include':_0x3c3f81[_0x68b0('0x16')]?_0x3c3f81[_0x68b0('0x16')][_0x68b0('0x1a')]?_[_0x68b0('0x1b')](_0x3c3f81[_0x68b0('0x16')][_0x68b0('0x1a')],function(_0x7ea21d){return{'model':db[_0x7ea21d[_0x68b0('0x1c')]],'as':_0x7ea21d['as'],'attributes':_0x7ea21d[_0x68b0('0x19')],'include':_0x7ea21d[_0x68b0('0x1a')]?_['map'](_0x7ea21d[_0x68b0('0x1a')],function(_0xaea97f){return{'model':db[_0xaea97f['model']],'as':_0xaea97f['as'],'attributes':_0xaea97f['attributes'],'include':_0xaea97f[_0x68b0('0x1a')]?_[_0x68b0('0x1b')](_0xaea97f[_0x68b0('0x1a')],function(_0x36ca10){return{'model':db[_0x36ca10[_0x68b0('0x1c')]],'as':_0x36ca10['as'],'attributes':_0x36ca10[_0x68b0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x68b0('0xa')](function(_0x1c399b){logger['info'](_0x68b0('0x14'),_0x3c3f81);logger['debug']('ShowSetting',_0x3c3f81,JSON[_0x68b0('0x1d')](_0x1c399b));_0x3e1a98(_0x1c399b);})['catch'](function(_0x1e65cd){logger['error']('ShowSetting',_0x1e65cd[_0x68b0('0x10')],_0x3c3f81);_0x1e1f90(_0x362905['error'](0x1f4,_0x1e65cd[_0x68b0('0x10')]));});});}; \ No newline at end of file +var _0x0277=['options','raw','where','attributes','include','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting'];(function(_0x103e8f,_0x786d03){var _0x2523f8=function(_0xbcbea7){while(--_0xbcbea7){_0x103e8f['push'](_0x103e8f['shift']());}};_0x2523f8(++_0x786d03);}(_0x0277,0xb0));var _0x7027=function(_0x19cbb3,_0x323edc){_0x19cbb3=_0x19cbb3-0x0;var _0x330ee3=_0x0277[_0x19cbb3];return _0x330ee3;};'use strict';var _=require(_0x7027('0x0'));var util=require(_0x7027('0x1'));var moment=require(_0x7027('0x2'));var BPromise=require(_0x7027('0x3'));var rs=require(_0x7027('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7027('0x5'))['db'];var utils=require(_0x7027('0x6'));var logger=require(_0x7027('0x7'))(_0x7027('0x8'));var config=require(_0x7027('0x9'));var jayson=require(_0x7027('0xa'));var client=jayson[_0x7027('0xb')][_0x7027('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x233447,_0x78e988,_0x54192b){return new BPromise(function(_0x5d6625,_0x26e03f){return client[_0x7027('0xd')](_0x233447,_0x54192b)[_0x7027('0xe')](function(_0x357de7){logger[_0x7027('0xf')](_0x7027('0x10'),_0x78e988,_0x7027('0x11'));logger[_0x7027('0x12')](_0x7027('0x13'),_0x78e988,_0x7027('0x11'),JSON[_0x7027('0x14')](_0x357de7));if(_0x357de7['error']){if(_0x357de7[_0x7027('0x15')][_0x7027('0x16')]===0x1f4){logger[_0x7027('0x15')](_0x7027('0x10'),_0x78e988,_0x357de7[_0x7027('0x15')][_0x7027('0x17')]);return _0x26e03f(_0x357de7[_0x7027('0x15')]['message']);}logger[_0x7027('0x15')](_0x7027('0x10'),_0x78e988,_0x357de7[_0x7027('0x15')][_0x7027('0x17')]);return _0x5d6625(_0x357de7['error'][_0x7027('0x17')]);}else{logger[_0x7027('0xf')](_0x7027('0x10'),_0x78e988,_0x7027('0x11'));_0x5d6625(_0x357de7[_0x7027('0x18')][_0x7027('0x17')]);}})[_0x7027('0x19')](function(_0x47a0e1){logger['error']('Setting,\x20%s,\x20%s',_0x78e988,_0x47a0e1);_0x26e03f(_0x47a0e1);});});}exports[_0x7027('0x1a')]=function(_0x378169){var _0xc05733=this;return new Promise(function(_0x4d5640,_0x12a35f){return db[_0x7027('0x1b')]['find']({'raw':_0x378169[_0x7027('0x1c')]?_0x378169[_0x7027('0x1c')][_0x7027('0x1d')]===undefined?!![]:![]:!![],'where':_0x378169[_0x7027('0x1c')]?_0x378169['options'][_0x7027('0x1e')]||null:null,'attributes':_0x378169['options']?_0x378169[_0x7027('0x1c')][_0x7027('0x1f')]||null:null,'include':_0x378169[_0x7027('0x1c')]?_0x378169[_0x7027('0x1c')][_0x7027('0x20')]?_[_0x7027('0x21')](_0x378169[_0x7027('0x1c')][_0x7027('0x20')],function(_0x76af68){return{'model':db[_0x76af68['model']],'as':_0x76af68['as'],'attributes':_0x76af68[_0x7027('0x1f')],'include':_0x76af68[_0x7027('0x20')]?_[_0x7027('0x21')](_0x76af68['include'],function(_0x287a95){return{'model':db[_0x287a95['model']],'as':_0x287a95['as'],'attributes':_0x287a95[_0x7027('0x1f')],'include':_0x287a95['include']?_[_0x7027('0x21')](_0x287a95[_0x7027('0x20')],function(_0x231c15){return{'model':db[_0x231c15['model']],'as':_0x231c15['as'],'attributes':_0x231c15[_0x7027('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21a2c8){logger[_0x7027('0xf')](_0x7027('0x1a'),_0x378169);logger[_0x7027('0x12')](_0x7027('0x1a'),_0x378169,JSON[_0x7027('0x14')](_0x21a2c8));_0x4d5640(_0x21a2c8);})['catch'](function(_0x522530){logger[_0x7027('0x15')]('ShowSetting',_0x522530['message'],_0x378169);_0x12a35f(_0xc05733['error'](0x1f4,_0x522530[_0x7027('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7ce97c3..99bf86d 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x3febf8,_0x3a20b1){var _0x56b67d=function(_0x123166){while(--_0x123166){_0x3febf8['push'](_0x3febf8['shift']());}};_0x56b67d(++_0x3a20b1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x27ede3,_0x4b8f2a){var _0x22b59c=function(_0x223ed9){while(--_0x223ed9){_0x27ede3['push'](_0x27ede3['shift']());}};_0x22b59c(++_0x4b8f2a);}(_0x7a54,0x106));var _0x47a5=function(_0x3285da,_0x41599){_0x3285da=_0x3285da-0x0;var _0xa1c7cc=_0x7a54[_0x3285da];return _0xa1c7cc;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 7a34173..72ae866 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 _0x22a7=['STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports'];(function(_0x3e80eb,_0x2c3bc7){var _0x3b9bff=function(_0x4e1e48){while(--_0x4e1e48){_0x3e80eb['push'](_0x3e80eb['shift']());}};_0x3b9bff(++_0x2c3bc7);}(_0x22a7,0x179));var _0x722a=function(_0x44053d,_0x33b5c4){_0x44053d=_0x44053d-0x0;var _0x345f76=_0x22a7[_0x44053d];return _0x345f76;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x722a('0x0')]={'name':{'type':Sequelize[_0x722a('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x722a('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x722a('0x1')],'defaultValue':function(){return rs[_0x722a('0x2')]();}},'phone':{'type':Sequelize[_0x722a('0x1')]},'type':{'type':Sequelize[_0x722a('0x3')](_0x722a('0x4'),_0x722a('0x5'),_0x722a('0x6'),_0x722a('0x7'),_0x722a('0x8'),_0x722a('0x9'),_0x722a('0xa'),_0x722a('0xb'),_0x722a('0xc'),_0x722a('0xd'))},'accountSid':{'type':Sequelize[_0x722a('0x1')]},'authId':{'type':Sequelize[_0x722a('0x1')]},'authToken':{'type':Sequelize[_0x722a('0x1')]},'smsMethod':{'type':Sequelize[_0x722a('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x722a('0x1')]},'password':{'type':Sequelize[_0x722a('0x1')]},'apiKey':{'type':Sequelize[_0x722a('0x1')]},'applicationId':{'type':Sequelize[_0x722a('0x1')]},'accountId':{'type':Sequelize[_0x722a('0x1')]},'senderString':{'type':Sequelize[_0x722a('0x1')]},'deliveryReport':{'type':Sequelize[_0x722a('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x722a('0x1')]},'notificationTemplate':{'type':Sequelize[_0x722a('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x722a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x722a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x722a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x722a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x722a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x722a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x722a('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x722a('0x10')],'comment':_0x722a('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x722a('0x12'),'set':function(_0xe309bf){if(!_0xe309bf)this[_0x722a('0x13')]('mandatoryDispositionPauseId',null);this[_0x722a('0x13')](_0x722a('0x14'),_0xe309bf);}}}; \ No newline at end of file +var _0x9ac6=['twilio','connectel','clicksend','clickatell','csc','infobip','intelepeer','TEXT','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9ac6,0x13f));var _0x69ac=function(_0x89e0c7,_0x5ca569){_0x89e0c7=_0x89e0c7-0x0;var _0x444f72=_0x9ac6[_0x89e0c7];return _0x444f72;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x69ac('0x0'));module['exports']={'name':{'type':Sequelize[_0x69ac('0x1')],'unique':_0x69ac('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x69ac('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x69ac('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x69ac('0x1')],'defaultValue':function(){return rs[_0x69ac('0x3')]();}},'phone':{'type':Sequelize[_0x69ac('0x1')]},'type':{'type':Sequelize[_0x69ac('0x4')](_0x69ac('0x5'),'skebby',_0x69ac('0x6'),_0x69ac('0x7'),'plivo',_0x69ac('0x8'),'bandwidth',_0x69ac('0x9'),_0x69ac('0xa'),_0x69ac('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x69ac('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x69ac('0x1')]},'password':{'type':Sequelize[_0x69ac('0x1')]},'apiKey':{'type':Sequelize[_0x69ac('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x69ac('0x1')]},'senderString':{'type':Sequelize[_0x69ac('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x69ac('0x1')]},'notificationTemplate':{'type':Sequelize[_0x69ac('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x69ac('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x69ac('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x69ac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x69ac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x69ac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x69ac('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x69ac('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x69ac('0x1')]},'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(_0x52338e){if(!_0x52338e)this[_0x69ac('0xf')](_0x69ac('0x10'),null);this[_0x69ac('0xf')](_0x69ac('0x11'),_0x52338e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4c57da8..b0fd06e 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 _0x5656=['count','set','reject','save','update','destroy','SmsAccounts','UserProfileResource','end','stack','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','SmsAccountId','Disposition','getDispositions','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','SmsQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','ACCEPTD','intelepeer','state','message-id','addAgents','removeAgents','emit','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined'];(function(_0x43682f,_0x24beaa){var _0x40bde6=function(_0x330af5){while(--_0x330af5){_0x43682f['push'](_0x43682f['shift']());}};_0x40bde6(++_0x24beaa);}(_0x5656,0x19d));var _0x6565=function(_0xc8dde6,_0x2ed4eb){_0xc8dde6=_0xc8dde6-0x0;var _0x3f20df=_0x5656[_0xc8dde6];return _0x3f20df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6565('0x0'));var zipdir=require(_0x6565('0x1'));var jsonpatch=require(_0x6565('0x2'));var rp=require(_0x6565('0x3'));var moment=require(_0x6565('0x4'));var BPromise=require(_0x6565('0x5'));var Mustache=require(_0x6565('0x6'));var util=require(_0x6565('0x7'));var path=require(_0x6565('0x8'));var sox=require(_0x6565('0x9'));var csv=require(_0x6565('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6565('0xb'));var crypto=require('crypto');var jsforce=require(_0x6565('0xc'));var deskjs=require(_0x6565('0xd'));var toCsv=require(_0x6565('0xa'));var querystring=require('querystring');var Papa=require(_0x6565('0xe'));var Redis=require(_0x6565('0xf'));var authService=require(_0x6565('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6565('0x11'));var logger=require(_0x6565('0x12'))(_0x6565('0x13'));var utils=require(_0x6565('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6565('0x15'))['db'];config[_0x6565('0x16')]=_[_0x6565('0x17')](config[_0x6565('0x16')],{'host':_0x6565('0x18'),'port':0x18eb});var socket=require(_0x6565('0x19'))(new Redis(config[_0x6565('0x16')]));require('./smsAccount.socket')[_0x6565('0x1a')](socket);var jayson=require(_0x6565('0x1b'));var client=jayson[_0x6565('0x1c')][_0x6565('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1808fb,_0x2fa3c2,_0x5287c6,_0x2449c5){return new BPromise(function(_0x21c5c4,_0x1fe7dc){var _0x396b45=_0x2449c5||client;return _0x396b45[_0x6565('0x1e')](_0x1808fb,_0x5287c6)[_0x6565('0x1f')](function(_0x388d4d){logger[_0x6565('0x20')]('SmsAccount,\x20%s,\x20%s',_0x2fa3c2,_0x6565('0x21'));logger[_0x6565('0x22')](_0x6565('0x23'),_0x2fa3c2,'request\x20sent',JSON[_0x6565('0x24')](_0x388d4d));if(_0x388d4d[_0x6565('0x25')]){if(_0x388d4d[_0x6565('0x25')][_0x6565('0x26')]===0x1f4){logger[_0x6565('0x25')](_0x6565('0x27'),_0x2fa3c2,_0x388d4d['error'][_0x6565('0x28')]);return _0x1fe7dc(_0x388d4d[_0x6565('0x25')][_0x6565('0x28')]);}logger[_0x6565('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2fa3c2,_0x388d4d['error'][_0x6565('0x28')]);return _0x21c5c4(_0x388d4d[_0x6565('0x25')][_0x6565('0x28')]);}else{logger[_0x6565('0x20')]('SmsAccount,\x20%s,\x20%s',_0x2fa3c2,_0x6565('0x21'));_0x21c5c4(_0x388d4d[_0x6565('0x29')][_0x6565('0x28')]);}})['catch'](function(_0x5a1613){logger[_0x6565('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2fa3c2,_0x5a1613);_0x1fe7dc(_0x5a1613);});});}function respondWithStatusCode(_0x494099,_0x5198e2){_0x5198e2=_0x5198e2||0xcc;return function(_0x16f16e){if(_0x16f16e){return _0x494099[_0x6565('0x2a')](_0x5198e2);}return _0x494099[_0x6565('0x2b')](_0x5198e2)['end']();};}function respondWithResult(_0x2bb3ee,_0x2ba874){_0x2ba874=_0x2ba874||0xc8;return function(_0xa2c499){if(_0xa2c499){return _0x2bb3ee['status'](_0x2ba874)[_0x6565('0x2c')](_0xa2c499);}};}function respondWithFilteredResult(_0x635821,_0x2c0929){return function(_0x225ffc){if(_0x225ffc){var _0x4b6d33=typeof _0x2c0929[_0x6565('0x2d')]==='undefined'&&typeof _0x2c0929['limit']===_0x6565('0x2e');var _0x4b9b02=_0x225ffc[_0x6565('0x2f')];var _0xbad2fe=_0x4b6d33?0x0:_0x2c0929[_0x6565('0x2d')];var _0x323ab9=_0x4b6d33?_0x225ffc[_0x6565('0x2f')]:_0x2c0929[_0x6565('0x2d')]+_0x2c0929['limit'];var _0x15a13c;if(_0x323ab9>=_0x4b9b02){_0x323ab9=_0x4b9b02;_0x15a13c=0xc8;}else{_0x15a13c=0xce;}_0x635821[_0x6565('0x2b')](_0x15a13c);return _0x635821[_0x6565('0x30')]('Content-Range',_0xbad2fe+'-'+_0x323ab9+'/'+_0x4b9b02)['json'](_0x225ffc);}return null;};}function patchUpdates(_0x1eb4a7){return function(_0x16a73a){try{jsonpatch['apply'](_0x16a73a,_0x1eb4a7,!![]);}catch(_0x591c5b){return BPromise[_0x6565('0x31')](_0x591c5b);}return _0x16a73a[_0x6565('0x32')]();};}function saveUpdates(_0x4fc06c,_0x52cab2){return function(_0x163481){if(_0x163481){return _0x163481[_0x6565('0x33')](_0x4fc06c)['then'](function(_0x5c8dc9){return _0x5c8dc9;});}return null;};}function removeEntity(_0x7c2c7e,_0x2945f8){return function(_0x1b0506){if(_0x1b0506){return _0x1b0506[_0x6565('0x34')]()['then'](function(){var _0x2a65df=_0x1b0506['get']({'plain':!![]});var _0x1b0c7b=_0x6565('0x35');return db[_0x6565('0x36')]['destroy']({'where':{'type':_0x1b0c7b,'resourceId':_0x2a65df['id']}})[_0x6565('0x1f')](function(){return _0x1b0506;});})['then'](function(){_0x7c2c7e[_0x6565('0x2b')](0xcc)[_0x6565('0x37')]();});}};}function handleEntityNotFound(_0x355462,_0x67256b){return function(_0x48c0e9){if(!_0x48c0e9){_0x355462[_0x6565('0x2a')](0x194);}return _0x48c0e9;};}function handleError(_0x1fa696,_0xbb7843){_0xbb7843=_0xbb7843||0x1f4;return function(_0x2b1ed3){logger[_0x6565('0x25')](_0x2b1ed3[_0x6565('0x38')]);if(_0x2b1ed3['name']){delete _0x2b1ed3['name'];}_0x1fa696[_0x6565('0x2b')](_0xbb7843)['send'](_0x2b1ed3);};}exports[_0x6565('0x39')]=function(_0x4cb344,_0x22c9c4){var _0x3bb466={'include':[{'model':db['Pause'],'as':_0x6565('0x3a')}]},_0x456df3={},_0x5bc873={'count':0x0,'rows':[]};var _0x4b2628=_[_0x6565('0x3b')](db[_0x6565('0x3c')][_0x6565('0x3d')],function(_0x24f769){return{'name':_0x24f769[_0x6565('0x3e')],'type':_0x24f769[_0x6565('0x3f')][_0x6565('0x40')]};});_0x456df3[_0x6565('0x41')]=_['map'](_0x4b2628,_0x6565('0x42'));_0x456df3[_0x6565('0x43')]=_[_0x6565('0x44')](_0x4cb344[_0x6565('0x43')]);_0x456df3[_0x6565('0x45')]=_['intersection'](_0x456df3[_0x6565('0x41')],_0x456df3[_0x6565('0x43')]);_0x3bb466[_0x6565('0x46')]=_[_0x6565('0x47')](_0x456df3[_0x6565('0x41')],qs[_0x6565('0x48')](_0x4cb344[_0x6565('0x43')]['fields']));_0x3bb466[_0x6565('0x46')]=_0x3bb466[_0x6565('0x46')][_0x6565('0x49')]?_0x3bb466['attributes']:_0x456df3[_0x6565('0x41')];if(!_0x4cb344[_0x6565('0x43')][_0x6565('0x4a')](_0x6565('0x4b'))){_0x3bb466[_0x6565('0x4c')]=qs[_0x6565('0x4c')](_0x4cb344[_0x6565('0x43')][_0x6565('0x4c')]);_0x3bb466[_0x6565('0x2d')]=qs[_0x6565('0x2d')](_0x4cb344[_0x6565('0x43')][_0x6565('0x2d')]);}_0x3bb466[_0x6565('0x4d')]=qs[_0x6565('0x4e')](_0x4cb344[_0x6565('0x43')][_0x6565('0x4e')]);_0x3bb466[_0x6565('0x4f')]=qs[_0x6565('0x45')](_[_0x6565('0x50')](_0x4cb344['query'],_0x456df3[_0x6565('0x45')]),_0x4b2628);if(_0x4cb344['query']['filter']){_0x3bb466[_0x6565('0x4f')]=_[_0x6565('0x51')](_0x3bb466[_0x6565('0x4f')],{'$or':_[_0x6565('0x3b')](_0x4b2628,function(_0x492337){if(_0x492337['type']!=='VIRTUAL'){var _0x2e961f={};_0x2e961f[_0x492337[_0x6565('0x42')]]={'$like':'%'+_0x4cb344[_0x6565('0x43')][_0x6565('0x52')]+'%'};return _0x2e961f;}})});}_0x3bb466=_[_0x6565('0x51')]({},_0x3bb466,_0x4cb344['options']);var _0x546764={'where':_0x3bb466[_0x6565('0x4f')]};return db['SmsAccount']['count'](_0x546764)[_0x6565('0x1f')](function(_0x388853){_0x5bc873[_0x6565('0x2f')]=_0x388853;if(_0x4cb344[_0x6565('0x43')][_0x6565('0x53')]){_0x3bb466[_0x6565('0x54')]=[{'all':!![]}];}return db['SmsAccount'][_0x6565('0x55')](_0x3bb466);})[_0x6565('0x1f')](function(_0x2b74d7){_0x5bc873[_0x6565('0x56')]=_0x2b74d7;return _0x5bc873;})[_0x6565('0x1f')](respondWithFilteredResult(_0x22c9c4,_0x3bb466))[_0x6565('0x57')](handleError(_0x22c9c4,null));};exports[_0x6565('0x58')]=function(_0x4fe306,_0x247ae2){var _0x3f21c2={'raw':![],'where':{'id':_0x4fe306[_0x6565('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x288673={};_0x288673[_0x6565('0x41')]=_[_0x6565('0x44')](db[_0x6565('0x3c')][_0x6565('0x3d')]);_0x288673[_0x6565('0x43')]=_[_0x6565('0x44')](_0x4fe306[_0x6565('0x43')]);_0x288673[_0x6565('0x45')]=_['intersection'](_0x288673[_0x6565('0x41')],_0x288673['query']);_0x3f21c2[_0x6565('0x46')]=_[_0x6565('0x47')](_0x288673[_0x6565('0x41')],qs[_0x6565('0x48')](_0x4fe306[_0x6565('0x43')][_0x6565('0x48')]));_0x3f21c2[_0x6565('0x46')]=_0x3f21c2[_0x6565('0x46')]['length']?_0x3f21c2[_0x6565('0x46')]:_0x288673[_0x6565('0x41')];if(_0x4fe306['query'][_0x6565('0x53')]){_0x3f21c2['include']=[{'all':!![]}];}_0x3f21c2=_['merge']({},_0x3f21c2,_0x4fe306['options']);return db[_0x6565('0x3c')]['find'](_0x3f21c2)[_0x6565('0x1f')](handleEntityNotFound(_0x247ae2,null))[_0x6565('0x1f')](respondWithResult(_0x247ae2,null))[_0x6565('0x57')](handleError(_0x247ae2,null));};exports['create']=function(_0x34ac2f,_0x46d39d){return db[_0x6565('0x3c')][_0x6565('0x5a')](_0x34ac2f[_0x6565('0x5b')],{})['then'](function(_0x3bc54c){var _0x47d3bf=_0x34ac2f[_0x6565('0x5c')]['get']({'plain':!![]});if(!_0x47d3bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47d3bf['role']===_0x6565('0x5c')){var _0x2f3b0a=_0x3bc54c[_0x6565('0x5d')]({'plain':!![]});var _0x3c154a=_0x6565('0x35');return db[_0x6565('0x5e')][_0x6565('0x5f')]({'where':{'name':_0x3c154a,'userProfileId':_0x47d3bf['userProfileId']},'raw':!![]})['then'](function(_0x469dc7){if(_0x469dc7&&_0x469dc7[_0x6565('0x60')]===0x0){return db[_0x6565('0x36')]['create']({'name':_0x2f3b0a[_0x6565('0x42')],'resourceId':_0x2f3b0a['id'],'type':_0x469dc7[_0x6565('0x42')],'sectionId':_0x469dc7['id']},{})['then'](function(){return _0x3bc54c;});}else{return _0x3bc54c;}})[_0x6565('0x57')](function(_0x4f14ee){logger[_0x6565('0x25')](_0x6565('0x61'),_0x4f14ee);throw _0x4f14ee;});}return _0x3bc54c;})[_0x6565('0x1f')](respondWithResult(_0x46d39d,0xc9))[_0x6565('0x57')](handleError(_0x46d39d,null));};exports[_0x6565('0x33')]=function(_0x5ecfd0,_0x40a552){if(_0x5ecfd0[_0x6565('0x5b')]['id']){delete _0x5ecfd0[_0x6565('0x5b')]['id'];}return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x5ecfd0['params']['id']},'include':[{'model':db[_0x6565('0x62')],'as':_0x6565('0x3a')}]})[_0x6565('0x1f')](handleEntityNotFound(_0x40a552,null))['then'](saveUpdates(_0x5ecfd0[_0x6565('0x5b')],null))['then'](respondWithResult(_0x40a552,null))[_0x6565('0x57')](handleError(_0x40a552,null));};exports[_0x6565('0x34')]=function(_0x228d71,_0x48eea6){return db['SmsAccount'][_0x6565('0x5f')]({'where':{'id':_0x228d71['params']['id']}})['then'](handleEntityNotFound(_0x48eea6,null))['then'](removeEntity(_0x48eea6,null))[_0x6565('0x57')](handleError(_0x48eea6,null));};exports['describe']=function(_0x284d14,_0x1a7cbd){return db[_0x6565('0x3c')][_0x6565('0x63')]()[_0x6565('0x1f')](respondWithResult(_0x1a7cbd,null))[_0x6565('0x57')](handleError(_0x1a7cbd,null));};exports[_0x6565('0x64')]=function(_0xf57cc3,_0x1b48ab,_0x7f4526){if(_0xf57cc3[_0x6565('0x5b')]['id']){delete _0xf57cc3[_0x6565('0x5b')]['id'];}return db['SmsAccount'][_0x6565('0x5f')]({'where':{'id':_0xf57cc3[_0x6565('0x59')]['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x1b48ab,null))[_0x6565('0x1f')](function(_0x11d6f8){if(_0x11d6f8){_0xf57cc3[_0x6565('0x5b')][_0x6565('0x65')]=_0x11d6f8['id'];return db[_0x6565('0x66')]['create'](_0xf57cc3[_0x6565('0x5b')]);}})[_0x6565('0x1f')](respondWithResult(_0x1b48ab,null))['catch'](handleError(_0x1b48ab,null));};exports[_0x6565('0x67')]=function(_0x3e8622,_0x203ce6,_0x42d48f){var _0xfb3032={'raw':![],'where':{}};var _0x523e92={};var _0x22be1f={'count':0x0,'rows':[]};return db[_0x6565('0x3c')]['findOne']({'where':{'id':_0x3e8622['params']['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x203ce6,null))['then'](function(_0x16050b){if(_0x16050b){_0x523e92['model']=_['keys'](db[_0x6565('0x66')][_0x6565('0x3d')]);_0x523e92[_0x6565('0x43')]=_[_0x6565('0x44')](_0x3e8622[_0x6565('0x43')]);_0x523e92[_0x6565('0x45')]=_['intersection'](_0x523e92[_0x6565('0x41')],_0x523e92[_0x6565('0x43')]);_0xfb3032[_0x6565('0x46')]=_['intersection'](_0x523e92[_0x6565('0x41')],qs[_0x6565('0x48')](_0x3e8622[_0x6565('0x43')][_0x6565('0x48')]));_0xfb3032[_0x6565('0x46')]=_0xfb3032['attributes'][_0x6565('0x49')]?_0xfb3032[_0x6565('0x46')]:_0x523e92[_0x6565('0x41')];if(!_0x3e8622[_0x6565('0x43')][_0x6565('0x4a')](_0x6565('0x4b'))){_0xfb3032['limit']=qs[_0x6565('0x4c')](_0x3e8622[_0x6565('0x43')][_0x6565('0x4c')]);_0xfb3032['offset']=qs[_0x6565('0x2d')](_0x3e8622[_0x6565('0x43')][_0x6565('0x2d')]);}_0xfb3032[_0x6565('0x4d')]=qs[_0x6565('0x4e')](_0x3e8622[_0x6565('0x43')]['sort']);_0xfb3032[_0x6565('0x4f')]=qs[_0x6565('0x45')](_['pick'](_0x3e8622[_0x6565('0x43')],_0x523e92[_0x6565('0x45')]));_0xfb3032['where']['SmsAccountId']=_0x16050b['id'];if(_0x3e8622[_0x6565('0x43')][_0x6565('0x52')]){_0xfb3032['where']=_['merge'](_0xfb3032[_0x6565('0x4f')],{'$or':_[_0x6565('0x3b')](_0xfb3032[_0x6565('0x46')],function(_0x27ec1c){var _0x585fa4={};_0x585fa4[_0x27ec1c]={'$like':'%'+_0x3e8622[_0x6565('0x43')]['filter']+'%'};return _0x585fa4;})});}_0xfb3032=_[_0x6565('0x51')]({},_0xfb3032,_0x3e8622[_0x6565('0x68')]);return db[_0x6565('0x66')]['count']({'where':_0xfb3032[_0x6565('0x4f')]})[_0x6565('0x1f')](function(_0x5e1f24){_0x22be1f[_0x6565('0x2f')]=_0x5e1f24;if(_0x3e8622[_0x6565('0x43')][_0x6565('0x53')]){_0xfb3032[_0x6565('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x6565('0x55')](_0xfb3032);})['then'](function(_0x1e5cb9){_0x22be1f[_0x6565('0x56')]=_0x1e5cb9;return _0x22be1f;});}})[_0x6565('0x1f')](respondWithFilteredResult(_0x203ce6,_0xfb3032))[_0x6565('0x57')](handleError(_0x203ce6,null));};exports[_0x6565('0x69')]=function(_0x486f5e,_0x23c770,_0x3b8333){return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x486f5e['params']['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x23c770,null))[_0x6565('0x1f')](function(_0x1be07e){if(_0x1be07e){return _0x1be07e['removeDispositions'](_0x486f5e[_0x6565('0x43')][_0x6565('0x6a')]);}})['then'](respondWithStatusCode(_0x23c770,null))[_0x6565('0x57')](handleError(_0x23c770,null));};exports[_0x6565('0x6b')]=function(_0x3b852f,_0x4d5bda,_0x4551e7){if(_0x3b852f[_0x6565('0x5b')]['id']){delete _0x3b852f['body']['id'];}return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x3b852f[_0x6565('0x59')]['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x4d5bda,null))[_0x6565('0x1f')](function(_0x316bd4){if(_0x316bd4){_0x3b852f['body'][_0x6565('0x65')]=_0x316bd4['id'];return db[_0x6565('0x6c')][_0x6565('0x5a')](_0x3b852f['body']);}})[_0x6565('0x1f')](respondWithResult(_0x4d5bda,null))['catch'](handleError(_0x4d5bda,null));};exports[_0x6565('0x6d')]=function(_0x5174ae,_0x4576ca,_0x27ece6){var _0x17e8cc={'raw':![],'where':{}};var _0xaad727={};var _0x240bb6={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x5174ae[_0x6565('0x59')]['id']}})['then'](handleEntityNotFound(_0x4576ca,null))[_0x6565('0x1f')](function(_0x5d2b81){if(_0x5d2b81){_0xaad727['model']=_[_0x6565('0x44')](db[_0x6565('0x6c')][_0x6565('0x3d')]);_0xaad727['query']=_[_0x6565('0x44')](_0x5174ae[_0x6565('0x43')]);_0xaad727[_0x6565('0x45')]=_['intersection'](_0xaad727[_0x6565('0x41')],_0xaad727[_0x6565('0x43')]);_0x17e8cc[_0x6565('0x46')]=_[_0x6565('0x47')](_0xaad727[_0x6565('0x41')],qs['fields'](_0x5174ae['query']['fields']));_0x17e8cc[_0x6565('0x46')]=_0x17e8cc[_0x6565('0x46')][_0x6565('0x49')]?_0x17e8cc[_0x6565('0x46')]:_0xaad727['model'];if(!_0x5174ae[_0x6565('0x43')][_0x6565('0x4a')](_0x6565('0x4b'))){_0x17e8cc[_0x6565('0x4c')]=qs['limit'](_0x5174ae[_0x6565('0x43')][_0x6565('0x4c')]);_0x17e8cc[_0x6565('0x2d')]=qs[_0x6565('0x2d')](_0x5174ae[_0x6565('0x43')][_0x6565('0x2d')]);}_0x17e8cc[_0x6565('0x4d')]=qs[_0x6565('0x4e')](_0x5174ae[_0x6565('0x43')][_0x6565('0x4e')]);_0x17e8cc[_0x6565('0x4f')]=qs[_0x6565('0x45')](_[_0x6565('0x50')](_0x5174ae['query'],_0xaad727[_0x6565('0x45')]));_0x17e8cc[_0x6565('0x4f')]['SmsAccountId']=_0x5d2b81['id'];if(_0x5174ae[_0x6565('0x43')][_0x6565('0x52')]){_0x17e8cc[_0x6565('0x4f')]=_[_0x6565('0x51')](_0x17e8cc[_0x6565('0x4f')],{'$or':_[_0x6565('0x3b')](_0x17e8cc[_0x6565('0x46')],function(_0x42dcce){var _0x4ae1db={};_0x4ae1db[_0x42dcce]={'$like':'%'+_0x5174ae[_0x6565('0x43')][_0x6565('0x52')]+'%'};return _0x4ae1db;})});}_0x17e8cc=_[_0x6565('0x51')]({},_0x17e8cc,_0x5174ae[_0x6565('0x68')]);return db['CannedAnswer'][_0x6565('0x2f')]({'where':_0x17e8cc['where']})['then'](function(_0x35becf){_0x240bb6[_0x6565('0x2f')]=_0x35becf;if(_0x5174ae['query']['includeAll']){_0x17e8cc[_0x6565('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x17e8cc);})[_0x6565('0x1f')](function(_0x44b8cb){_0x240bb6[_0x6565('0x56')]=_0x44b8cb;return _0x240bb6;});}})['then'](respondWithFilteredResult(_0x4576ca,_0x17e8cc))[_0x6565('0x57')](handleError(_0x4576ca,null));};exports[_0x6565('0x6e')]=function(_0x2a9fdb,_0x4fb307,_0x363600){return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x2a9fdb[_0x6565('0x59')]['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x4fb307,null))[_0x6565('0x1f')](function(_0x5da4a1){if(_0x5da4a1){return _0x5da4a1[_0x6565('0x6e')](_0x2a9fdb[_0x6565('0x43')][_0x6565('0x6a')]);}})[_0x6565('0x1f')](respondWithStatusCode(_0x4fb307,null))[_0x6565('0x57')](handleError(_0x4fb307,null));};exports['notify']=function(_0x2b8448,_0x237b34,_0x40cda5){var _0x79a8ac={'channel':'sms'};var _0x2a0665=[];var _0x22c2fe=[];var _0x535ced={};return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x2b8448[_0x6565('0x59')]['id']},'include':[{'model':db[_0x6565('0x6f')],'as':_0x6565('0x70')}]})[_0x6565('0x1f')](handleEntityNotFound(_0x237b34,null))[_0x6565('0x1f')](function(_0x4f5110){_0x79a8ac[_0x6565('0x71')]=_0x4f5110;_0x79a8ac[_0x6565('0x72')]=_[_0x6565('0x73')](_0x4f5110['Applications'],[_0x6565('0x74')],['asc']);if(_0x79a8ac[_0x6565('0x71')][_0x6565('0x70')]){delete _0x79a8ac['account'][_0x6565('0x70')];}return db[_0x6565('0x75')][_0x6565('0x63')]();})[_0x6565('0x1f')](function(_0x1caed8){if(!_0x1caed8){throw new db['Sequelize']['ValidationError'](_0x6565('0x76'));}_0x2a0665=_[_0x6565('0x77')](_[_0x6565('0x44')](_0x1caed8),['createdAt',_0x6565('0x78')]);_0x22c2fe=_[_0x6565('0x77')](_[_0x6565('0x44')](_0x1caed8),[_0x6565('0x79'),_0x6565('0x78'),'CompanyId',_0x6565('0x7a')]);_0x79a8ac['body']={'mapKey':_0x6565('0x7b')};if(_0x79a8ac[_0x6565('0x71')][_0x6565('0x3f')]){switch(_0x79a8ac[_0x6565('0x71')][_0x6565('0x3f')]){case _0x6565('0x7c'):_0x79a8ac['body'][_0x6565('0x7d')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x7e')];_0x79a8ac['body'][_0x6565('0x5b')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x7f')];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x80')]=_0x2b8448[_0x6565('0x5b')]['MessageSid'];break;case _0x6565('0x81'):_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')]='+'+_0x2b8448['body'][_0x6565('0x82')];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x5b')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x83')];break;case _0x6565('0x84'):_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')]=_0x2b8448['body'][_0x6565('0x7d')];_0x79a8ac['body'][_0x6565('0x5b')]=_0x2b8448['body']['message'];break;case _0x6565('0x85'):_0x79a8ac[_0x6565('0x5b')]['from']=_0x2b8448[_0x6565('0x5b')]['from'];_0x79a8ac[_0x6565('0x5b')]['body']=_0x2b8448[_0x6565('0x5b')][_0x6565('0x5b')];_0x79a8ac[_0x6565('0x5b')]['messageId']=_0x2b8448['body']['message_id'];break;case _0x6565('0x86'):_0x79a8ac[_0x6565('0x5b')]['from']=_0x2b8448[_0x6565('0x5b')]['From'];_0x79a8ac['body']['body']=_0x2b8448['body'][_0x6565('0x87')];_0x79a8ac[_0x6565('0x5b')]['messageId']=_0x2b8448['body'][_0x6565('0x88')];break;case _0x6565('0x89'):_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')]='+'+_0x2b8448[_0x6565('0x5b')][_0x6565('0x8a')][0x0]['from'];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x5b')]=_0x2b8448[_0x6565('0x5b')]['results'][0x0]['text'];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x80')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x8a')][0x0][_0x6565('0x80')];break;case _0x6565('0x8b'):_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')]=_0x2b8448[_0x6565('0x5b')]['originatingAddress'];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x5b')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x8c')][_0x6565('0x28')];break;case _0x6565('0x8d'):_0x79a8ac['body'][_0x6565('0x7d')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x8e')];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x5b')]=_0x2b8448['body'][_0x6565('0x83')];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x80')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x8f')];break;case _0x6565('0x90'):_0x79a8ac[_0x6565('0x5b')][_0x6565('0x80')]=_0x2b8448[_0x6565('0x5b')][0x0][_0x6565('0x28')]['id'];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')]=_0x2b8448[_0x6565('0x5b')][0x0]['message'][_0x6565('0x7d')];_0x79a8ac[_0x6565('0x5b')]['body']=_0x2b8448[_0x6565('0x5b')][0x0][_0x6565('0x28')][_0x6565('0x83')];break;case'intelepeer':_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')]=_0x2b8448[_0x6565('0x5b')]['from'];_0x79a8ac['body'][_0x6565('0x5b')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x28')];_0x79a8ac[_0x6565('0x5b')][_0x6565('0x80')]=_0x2b8448[_0x6565('0x5b')][_0x6565('0x91')];break;}}if(_0x79a8ac[_0x6565('0x5b')]['id']){delete _0x79a8ac[_0x6565('0x5b')]['id'];}if(_[_0x6565('0x92')](_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')])){throw new db[(_0x6565('0x93'))][(_0x6565('0x94'))](_0x6565('0x95'));}if(_[_0x6565('0x92')](_0x79a8ac[_0x6565('0x5b')]['body'])||_0x79a8ac[_0x6565('0x5b')][_0x6565('0x5b')]===''){throw new db[(_0x6565('0x93'))][(_0x6565('0x94'))](_0x6565('0x96'));}if(_[_0x6565('0x92')](_0x79a8ac[_0x6565('0x5b')][_0x6565('0x97')])){throw new db['Sequelize'][(_0x6565('0x94'))](_0x6565('0x98')+_0x22c2fe);}if(!_[_0x6565('0x99')](_0x22c2fe,_0x79a8ac[_0x6565('0x5b')][_0x6565('0x97')])){throw new db['Sequelize'][(_0x6565('0x94'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22c2fe);}_0x535ced[_0x79a8ac[_0x6565('0x5b')][_0x6565('0x97')]]=_0x79a8ac[_0x6565('0x5b')]['from'];return db[_0x6565('0x9a')]['find']({'where':{'id':_0x79a8ac[_0x6565('0x71')]['ListId']},'include':[{'model':db[_0x6565('0x75')],'as':_0x6565('0x9b'),'where':_0x535ced,'limit':0x1,'order':[[_0x6565('0x78'),_0x6565('0x9c')]]}]});})[_0x6565('0x1f')](handleEntityNotFound(_0x237b34,null))[_0x6565('0x1f')](function(_0x30f4a8){if(_0x30f4a8){_0x79a8ac['list']=_[_0x6565('0x9d')](_0x30f4a8,[_0x6565('0x9b')]);if(_0x30f4a8[_0x6565('0x9b')]['length']){return _0x30f4a8[_0x6565('0x9b')][0x0];}var _0x24f53c=_[_0x6565('0x17')](_0x79a8ac[_0x6565('0x5b')],{'firstName':_0x79a8ac[_0x6565('0x5b')]['from'],'ListId':_0x30f4a8['id']});_0x24f53c[_0x79a8ac[_0x6565('0x5b')]['mapKey']]=_0x79a8ac['body'][_0x6565('0x7d')];return db[_0x6565('0x75')]['create'](_0x24f53c,{'fields':_0x2a0665,'raw':!![]});}})[_0x6565('0x1f')](handleEntityNotFound(_0x237b34,null))['then'](function(_0x2582df){if(_0x2582df){_0x79a8ac[_0x6565('0x9e')]=_0x2582df;var _0x4e3640={'ContactId':_0x2582df['id'],'phone':_0x79a8ac['body']['from'],'SmsAccountId':_0x2b8448['params']['id']};var _0x49b903={'ContactId':_0x2582df['id'],'SmsAccountId':_0x2b8448[_0x6565('0x59')]['id'],'closed':![]};return db['SmsInteraction'][_0x6565('0x5f')]({'where':_0x49b903})['then'](function(_0x3336b2){if(_0x3336b2){return[_0x3336b2,![]];}return db[_0x6565('0x9f')]['create'](_0x4e3640)['then'](function(_0x19bf2b){return[_0x19bf2b,!![]];});});}})[_0x6565('0xa0')](function(_0x411178,_0x1f93c9){_0x79a8ac['interaction']=_0x411178[_0x6565('0x5d')]({'plain':!![]});_0x79a8ac[_0x6565('0xa1')][_0x6565('0xa2')]=![];if(_0x1f93c9){if(_0x79a8ac[_0x6565('0x71')][_0x6565('0xa3')]){_0x79a8ac[_0x6565('0x72')][_0x6565('0xa4')]({'id':0x0,'priority':_0x79a8ac['applications'][_0x6565('0x49')]+0x1,'app':_0x6565('0xa5'),'appdata':_0x6565('0xa6'),'interval':_0x6565('0xa7')});}_0x79a8ac[_0x6565('0xa1')]['created']=!![];}return db[_0x6565('0xa8')][_0x6565('0x5a')]({'phone':_0x79a8ac[_0x6565('0x5b')][_0x6565('0x7d')],'messageId':_0x79a8ac[_0x6565('0x5b')]['messageId'],'body':_0x79a8ac['body'][_0x6565('0x5b')],'SmsAccountId':_0x2b8448[_0x6565('0x59')]['id'],'SmsInteractionId':_0x411178['id'],'direction':'in','ContactId':_0x411178[_0x6565('0xa9')],'AttachmentId':_0x79a8ac['body'][_0x6565('0xaa')]});})['then'](function(_0x10528e){_0x79a8ac[_0x6565('0x28')]=_0x10528e;if(!_0x79a8ac['interaction'][_0x6565('0xab')])return;return db[_0x6565('0xac')][_0x6565('0x5f')]({'attributes':['id','name'],'where':{'id':_0x79a8ac[_0x6565('0xa1')][_0x6565('0xab')]}});})['then'](function(_0x590d08){if(_0x590d08){_0x79a8ac[_0x6565('0x72')][_0x6565('0xad')]({'id':0x0,'priority':0x0,'app':_0x6565('0xae'),'appdata':_0x590d08['name']+','+(_0x79a8ac[_0x6565('0x71')][_0x6565('0xaf')]||0xa),'interval':_0x6565('0xa7')});}if(!_0x79a8ac[_0x6565('0xa1')]['queueId'])return;return db[_0x6565('0xb0')][_0x6565('0x5f')]({'attributes':['id',_0x6565('0x42')],'where':{'id':_0x79a8ac[_0x6565('0xa1')][_0x6565('0xb1')]}});})[_0x6565('0x1f')](function(_0x4178a9){if(_0x4178a9){_0x79a8ac[_0x6565('0x72')][_0x6565('0xad')]({'id':0x0,'priority':0x1,'app':_0x6565('0xb2'),'appdata':_0x4178a9[_0x6565('0x42')]+','+(_0x79a8ac[_0x6565('0x71')][_0x6565('0xb3')]||0x12c),'interval':_0x6565('0xa7')});}return respondWithRpcPromise(_0x6565('0xb4'),_0x6565('0xb5'),_0x79a8ac);})[_0x6565('0x1f')](function(_0x7c4ce6){if(_0x7c4ce6){var _0x14ab45=0xc8;var _0x2d70b0=_0x6565('0xb6');logger['info'](_0x6565('0x23'),_0x2d70b0,_0x14ab45,_0x6565('0xb7'));logger[_0x6565('0x22')](_0x6565('0xb8'),_0x2d70b0,_0x14ab45,'entity\x20found',JSON[_0x6565('0x24')](_0x7c4ce6));if(_0x79a8ac[_0x6565('0x71')]['type']==='twilio'){return _0x237b34[_0x6565('0x2b')](_0x14ab45)[_0x6565('0x30')](_0x6565('0xb9'),_0x6565('0xba'))[_0x6565('0xbb')]('\x0a');}else{return _0x237b34[_0x6565('0x2b')](_0x14ab45)[_0x6565('0x2c')](_0x7c4ce6);}}})[_0x6565('0x57')](handleError(_0x237b34,null));};exports[_0x6565('0xbc')]=function(_0x5a3cdd,_0x83d097){var _0x23a641=_0x5a3cdd[_0x6565('0x59')]['id'];var _0x5ad878=_0x5a3cdd['body'];var _0x1c3dc7=0xc8;var _0x5b8be0=null;return db[_0x6565('0xbd')][_0x6565('0xbe')]({'isolationLevel':db[_0x6565('0xbd')][_0x6565('0xbf')]['ISOLATION_LEVELS'][_0x6565('0xc0')]},function(_0x17b0e8){return db[_0x6565('0x3c')][_0x6565('0xc1')]({'where':{'id':_0x23a641},'transaction':_0x17b0e8})[_0x6565('0x1f')](function(_0x477550){if(_0x477550){return db['SmsApplication'][_0x6565('0x34')]({'where':{'SmsAccountId':_0x23a641},'transaction':_0x17b0e8})[_0x6565('0x1f')](function(){var _0x1823ba=_['map'](_0x5ad878,function(_0x548c40){_0x548c40[_0x6565('0x65')]=_0x23a641;return _0x548c40;});return db['SmsApplication'][_0x6565('0xc2')](_0x1823ba,{'transaction':_0x17b0e8});});}else{_0x1c3dc7=0x194;_0x5b8be0=[];}});})[_0x6565('0x1f')](function(){if(_0x1c3dc7!==0x194){return db[_0x6565('0x6f')][_0x6565('0xc3')]({'where':{'SmsAccountId':_0x23a641},'order':_0x6565('0x74')})['then'](function(_0x27a8b6){_0x5b8be0=_0x27a8b6;});}})[_0x6565('0x57')](function(_0x382f02){_0x1c3dc7=0x1f4;logger[_0x6565('0x25')](_0x382f02['stack']);if(_0x382f02[_0x6565('0x42')]){delete _0x382f02[_0x6565('0x42')];}_0x5b8be0=_0x382f02;})[_0x6565('0xc4')](function(){if(_0x5b8be0===null){_0x83d097[_0x6565('0x2a')](_0x1c3dc7);}else{if(_0x1c3dc7===0x1f4){_0x83d097['status'](_0x1c3dc7)[_0x6565('0xbb')](_0x5b8be0);}else{_0x83d097[_0x6565('0x2b')](_0x1c3dc7)[_0x6565('0x2c')](_0x5b8be0);}}});};exports[_0x6565('0xc5')]=function(_0x495418,_0x6f1c14,_0x3e3534){var _0x59e74b={};var _0x41d8c0={};var _0x5b68c4;var _0x43a50f;return db[_0x6565('0x3c')]['findOne']({'where':{'id':_0x495418[_0x6565('0x59')]['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x6f1c14,null))['then'](function(_0x2d65d3){if(_0x2d65d3){_0x5b68c4=_0x2d65d3;_0x41d8c0[_0x6565('0x41')]=_[_0x6565('0x44')](db[_0x6565('0x6f')]['rawAttributes']);_0x41d8c0['query']=_[_0x6565('0x44')](_0x495418['query']);_0x41d8c0[_0x6565('0x45')]=_['intersection'](_0x41d8c0[_0x6565('0x41')],_0x41d8c0['query']);_0x59e74b[_0x6565('0x46')]=_[_0x6565('0x47')](_0x41d8c0[_0x6565('0x41')],qs[_0x6565('0x48')](_0x495418[_0x6565('0x43')]['fields']));_0x59e74b[_0x6565('0x46')]=_0x59e74b['attributes'][_0x6565('0x49')]?_0x59e74b[_0x6565('0x46')]:_0x41d8c0['model'];_0x59e74b['order']=qs['sort'](_0x495418[_0x6565('0x43')][_0x6565('0x4e')]);_0x59e74b['where']=qs[_0x6565('0x45')](_[_0x6565('0x50')](_0x495418['query'],_0x41d8c0[_0x6565('0x45')]));if(_0x495418['query'][_0x6565('0x52')]){_0x59e74b[_0x6565('0x4f')]=_[_0x6565('0x51')](_0x59e74b[_0x6565('0x4f')],{'$or':_[_0x6565('0x3b')](_0x59e74b['attributes'],function(_0x52a9ff){var _0x3b8607={};_0x3b8607[_0x52a9ff]={'$like':'%'+_0x495418[_0x6565('0x43')][_0x6565('0x52')]+'%'};return _0x3b8607;})});}_0x59e74b=_[_0x6565('0x51')]({},_0x59e74b,_0x495418[_0x6565('0x68')]);return _0x5b68c4[_0x6565('0xc5')](_0x59e74b);}})[_0x6565('0x1f')](function(_0x341589){if(_0x341589){_0x43a50f=_0x341589['length'];if(!_0x495418[_0x6565('0x43')][_0x6565('0x4a')](_0x6565('0x4b'))){_0x59e74b[_0x6565('0x4c')]=qs[_0x6565('0x4c')](_0x495418['query'][_0x6565('0x4c')]);_0x59e74b[_0x6565('0x2d')]=qs[_0x6565('0x2d')](_0x495418[_0x6565('0x43')]['offset']);}return _0x5b68c4['getApplications'](_0x59e74b);}})['then'](function(_0x2f24a1){if(_0x2f24a1){return _0x2f24a1?{'count':_0x43a50f,'rows':_0x2f24a1}:null;}})[_0x6565('0x1f')](respondWithResult(_0x6f1c14,null))['catch'](handleError(_0x6f1c14,null));};exports[_0x6565('0xc6')]=function(_0x13e70b,_0xc47c5,_0x3a4994){var _0x59d5df={'raw':![],'where':{}};var _0x12a45b={};var _0xa99f55={'count':0x0,'rows':[]};return db[_0x6565('0x3c')][_0x6565('0xc1')]({'where':{'id':_0x13e70b[_0x6565('0x59')]['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0xc47c5,null))['then'](function(_0x533b54){if(_0x533b54){_0x12a45b[_0x6565('0x41')]=_[_0x6565('0x44')](db[_0x6565('0x9f')][_0x6565('0x3d')]);_0x12a45b[_0x6565('0x43')]=_[_0x6565('0x44')](_0x13e70b['query']);_0x12a45b['filters']=_['intersection'](_0x12a45b[_0x6565('0x41')],_0x12a45b[_0x6565('0x43')]);_0x59d5df[_0x6565('0x46')]=_['intersection'](_0x12a45b[_0x6565('0x41')],qs['fields'](_0x13e70b[_0x6565('0x43')][_0x6565('0x48')]));_0x59d5df['attributes']=_0x59d5df['attributes'][_0x6565('0x49')]?_0x59d5df[_0x6565('0x46')]:_0x12a45b[_0x6565('0x41')];if(!_0x13e70b[_0x6565('0x43')][_0x6565('0x4a')]('nolimit')){_0x59d5df[_0x6565('0x4c')]=qs[_0x6565('0x4c')](_0x13e70b[_0x6565('0x43')][_0x6565('0x4c')]);_0x59d5df[_0x6565('0x2d')]=qs[_0x6565('0x2d')](_0x13e70b[_0x6565('0x43')][_0x6565('0x2d')]);}_0x59d5df[_0x6565('0x4d')]=qs[_0x6565('0x4e')](_0x13e70b[_0x6565('0x43')][_0x6565('0x4e')]);_0x59d5df[_0x6565('0x4f')]=qs[_0x6565('0x45')](_[_0x6565('0x50')](_0x13e70b[_0x6565('0x43')],_0x12a45b['filters']));_0x59d5df[_0x6565('0x4f')][_0x6565('0x65')]=_0x533b54['id'];if(_0x13e70b[_0x6565('0x43')][_0x6565('0x52')]){_0x59d5df[_0x6565('0x4f')]=_['merge'](_0x59d5df[_0x6565('0x4f')],{'$or':_['map'](_0x59d5df[_0x6565('0x46')],function(_0x3e62ed){var _0x4209c4={};_0x4209c4[_0x3e62ed]={'$like':'%'+_0x13e70b[_0x6565('0x43')][_0x6565('0x52')]+'%'};return _0x4209c4;})});}_0x59d5df=_[_0x6565('0x51')]({},_0x59d5df,_0x13e70b[_0x6565('0x68')]);return db['SmsInteraction']['count']({'where':_0x59d5df[_0x6565('0x4f')]})[_0x6565('0x1f')](function(_0x1ce88c){_0xa99f55[_0x6565('0x2f')]=_0x1ce88c;if(_0x13e70b[_0x6565('0x43')][_0x6565('0x53')]){_0x59d5df['include']=[{'model':db[_0x6565('0x75')],'as':'Contact','required':![]},{'model':db[_0x6565('0xac')],'as':_0x6565('0xc7'),'attributes':[_0x6565('0x42'),_0x6565('0xc8'),_0x6565('0xc9')],'required':![]},{'model':db[_0x6565('0xca')],'as':_0x6565('0xcb'),'attributes':['id','name','color'],'where':_0x13e70b[_0x6565('0x43')]['tag']?{'id':_0x13e70b[_0x6565('0x43')][_0x6565('0xcc')]}:undefined,'required':_0x13e70b[_0x6565('0x43')][_0x6565('0xcc')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x59d5df);})['then'](function(_0x35ec7e){_0xa99f55['rows']=_0x35ec7e;return _0xa99f55;});}})[_0x6565('0x1f')](respondWithFilteredResult(_0xc47c5,_0x59d5df))[_0x6565('0x57')](handleError(_0xc47c5,null));};exports[_0x6565('0xbb')]=function(_0x2828a7,_0x1baf7d,_0x38aa7b){var _0x101370,_0x2c526d,_0x4a778f;if(_[_0x6565('0x92')](_0x2828a7[_0x6565('0x5b')][_0x6565('0x5b')])||_0x2828a7[_0x6565('0x5b')]['body']===''){throw new db[(_0x6565('0x93'))][(_0x6565('0x94'))](_0x6565('0x96'));}if(_['isNil'](_0x2828a7[_0x6565('0x5b')]['to'])){throw new db[(_0x6565('0x93'))][(_0x6565('0x94'))](_0x6565('0xcd'));}_0x101370=_0x2828a7[_0x6565('0x5b')]['to'];return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x2828a7[_0x6565('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x6565('0xce'),'include':[{'model':db[_0x6565('0x75')],'as':_0x6565('0x9b'),'where':{'mobile':_0x101370},'limit':0x1,'order':[['updatedAt',_0x6565('0x9c')]]}]}]})[_0x6565('0x1f')](handleEntityNotFound(_0x1baf7d,null))['then'](function(_0x560fac){if(_0x560fac&&_0x560fac['List']){_0x2c526d=_0x560fac[_0x6565('0x5d')]({'plain':!![]});if(_0x2c526d[_0x6565('0xce')]&&_0x2c526d[_0x6565('0xce')][_0x6565('0x9b')]['length']){return _0x2c526d['List'][_0x6565('0x9b')][0x0];}return db['CmContact'][_0x6565('0x5a')](_['defaults'](_0x2828a7[_0x6565('0x5b')],{'firstName':_0x101370,'mobile':_0x101370,'phone':_0x101370,'ListId':_0x2c526d[_0x6565('0x7a')]}));}})[_0x6565('0x1f')](handleEntityNotFound(_0x1baf7d,null))['then'](function(_0x1e9bed){if(_0x1e9bed){_0x4a778f=_0x1e9bed;return db['SmsInteraction'][_0x6565('0x5f')]({'where':{'ContactId':_0x4a778f['id'],'closed':![],'SmsAccountId':_0x2c526d['id']}})[_0x6565('0x1f')](function(_0x4a0c26){if(_0x4a0c26){return[_0x4a0c26,![]];}return db[_0x6565('0x9f')][_0x6565('0x5a')]({'UserId':_0x2828a7[_0x6565('0x5c')]['id'],'ContactId':_0x4a778f['id'],'SmsAccountId':_0x2c526d['id'],'phone':_0x101370,'firstMsgDirection':_0x6565('0xcf'),'Messages':[_[_0x6565('0x51')](_0x2828a7[_0x6565('0x5b')],{'read':![],'body':_0x2828a7[_0x6565('0x5b')][_0x6565('0x5b')],'phone':_0x101370,'SmsAccountId':_0x2c526d['id'],'UserId':_0x2828a7[_0x6565('0x5c')]['id'],'ContactId':_0x4a778f['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6565('0xd0')}]})[_0x6565('0x1f')](function(_0x1b6f57){return[_0x1b6f57,!![]];});});}})[_0x6565('0xa0')](function(_0x19bf07,_0x30b0a7){if(_0x30b0a7){return _0x19bf07;}return db[_0x6565('0xa8')][_0x6565('0x5a')](_[_0x6565('0x51')](_0x2828a7[_0x6565('0x5b')],{'read':![],'body':_0x2828a7[_0x6565('0x5b')][_0x6565('0x5b')],'phone':_0x101370,'SmsAccountId':_0x2c526d['id'],'SmsInteractionId':_0x19bf07['id'],'UserId':_0x2828a7['user']['id'],'ContactId':_0x4a778f['id']}))[_0x6565('0x1f')](function(_0xc701c5){_0x19bf07['dataValues']['Messages']=[];_0x19bf07[_0x6565('0xd1')]['Messages'][_0x6565('0xa4')](_0xc701c5['dataValues']);return _0x19bf07;});})[_0x6565('0x1f')](respondWithResult(_0x1baf7d,null))['catch'](handleError(_0x1baf7d,null));};exports[_0x6565('0x2b')]=function(_0x29b43c,_0x5de90a,_0x233ec5){if(_0x29b43c[_0x6565('0x5b')]['id']){delete _0x29b43c[_0x6565('0x5b')]['id'];}var _0xac7a9,_0x4968b1,_0x30cf1d;return db['SmsAccount']['find']({'where':{'id':_0x29b43c[_0x6565('0x59')]['id']}})['then'](handleEntityNotFound(_0x5de90a,null))['then'](function(_0xe0fc40){if(_0xe0fc40){_0x30cf1d=_0xe0fc40;logger['debug'](_0x6565('0x23'),_0x6565('0x2b'),_0x6565('0xd2'),_0xe0fc40[_0x6565('0x3f')],util[_0x6565('0xd3')](_0x29b43c[_0x6565('0x5b')],{'showHidden':![],'depth':null}));switch(_0xe0fc40[_0x6565('0x3f')]){case _0x6565('0x81'):if(_0x29b43c[_0x6565('0x5b')]['skebby_dispatch_id']&&_0x29b43c[_0x6565('0x5b')][_0x6565('0x2b')]){_0x4968b1=_0x29b43c[_0x6565('0x5b')]['status'];return db['SmsMessage'][_0x6565('0x5f')]({'where':{'messageId':_0x29b43c[_0x6565('0x5b')][_0x6565('0xd4')]}});}break;case _0x6565('0x84'):if(_0x29b43c[_0x6565('0x5b')][_0x6565('0xd5')]&&_0x29b43c[_0x6565('0x5b')][_0x6565('0xd6')]){_0x4968b1=_0x29b43c[_0x6565('0x5b')][_0x6565('0xd6')];return db[_0x6565('0xa8')]['find']({'where':{'messageId':_0x29b43c[_0x6565('0x5b')]['requestid']}});}break;case _0x6565('0x85'):if(_0x29b43c[_0x6565('0x5b')][_0x6565('0xd7')]&&_0x29b43c['body'][_0x6565('0xd8')]){_0x4968b1=_0x29b43c[_0x6565('0x5b')][_0x6565('0xd8')];return db[_0x6565('0xa8')]['find']({'where':{'messageId':_0x29b43c[_0x6565('0x5b')][_0x6565('0xd7')]}});}break;case _0x6565('0x89'):var _0x46660e=_0x29b43c['body']['results'][0x0];if(_0x46660e['messageId']&&_0x46660e[_0x6565('0x2b')][_0x6565('0xd9')]===_0x6565('0xda')){_0x4968b1=_0x46660e['status']['groupName'];return db[_0x6565('0xa8')][_0x6565('0x5f')]({'where':{'messageId':_0x46660e[_0x6565('0x80')]}});}break;case'clickatell':if(_0x29b43c['body']['messageId']&&_0x29b43c['body'][_0x6565('0x2b')]){_0x4968b1=_0x29b43c[_0x6565('0x5b')][_0x6565('0x2b')];return db[_0x6565('0xa8')][_0x6565('0x5f')]({'where':{'messageId':_0x29b43c['body'][_0x6565('0x80')]}});}break;case _0x6565('0x90'):if(_0x29b43c[_0x6565('0x5b')][0x0][_0x6565('0x28')]['id']){_0x4968b1=_0x29b43c[_0x6565('0x5b')][0x0]['type'];return db['SmsMessage'][_0x6565('0x5f')]({'where':{'messageId':_0x29b43c[_0x6565('0x5b')][0x0][_0x6565('0x28')]['id']}});}break;case'intelepeer':if(_0x29b43c['body'][_0x6565('0xdb')]&&_0x29b43c[_0x6565('0x5b')][_0x6565('0x2b')]){_0x4968b1=_0x29b43c[_0x6565('0x5b')][_0x6565('0x2b')];return db[_0x6565('0xa8')][_0x6565('0x5f')]({'where':{'messageId':_0x29b43c[_0x6565('0x5b')]['redif']}});}break;}}})[_0x6565('0x1f')](handleEntityNotFound(_0x5de90a,null))[_0x6565('0x1f')](function(_0x1c3220){if(_0x1c3220){_0xac7a9=_0x1c3220;switch(_0x30cf1d[_0x6565('0x3f')]){case'skebby':if(_0x4968b1===_0x6565('0xda')){return _0xac7a9[_0x6565('0x33')]({'read':!![]});}else{logger[_0x6565('0x25')](_0x6565('0x23'),_0x6565('0x2b'),'skebby',util[_0x6565('0xd3')](_0x29b43c[_0x6565('0x5b')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4968b1==='1'){return _0xac7a9['update']({'read':!![]});}else{logger[_0x6565('0x25')](_0x6565('0x23'),_0x6565('0x2b'),_0x6565('0x81'),util[_0x6565('0xd3')](_0x29b43c[_0x6565('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6565('0x85'):if(!_0x29b43c[_0x6565('0x5b')][_0x6565('0xdc')]&&_0x4968b1>=0xc8&&_0x4968b1<=0xce){return _0xac7a9['update']({'read':!![]});}else{logger[_0x6565('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util['inspect'](_0x29b43c[_0x6565('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6565('0x89'):var _0x3e4227=_0x29b43c[_0x6565('0x5b')]['results'][0x0];if(_0x3e4227['status'][_0x6565('0xd9')]===_0x6565('0xda')){return _0xac7a9['update']({'read':!![]});}else{logger['error'](_0x6565('0x23'),_0x6565('0x2b'),_0x6565('0x89'),util['inspect'](_0x29b43c[_0x6565('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4968b1=='DELIVERED_TO_GATEWAY'||_0x4968b1==_0x6565('0xdd')){return _0xac7a9[_0x6565('0x33')]({'read':!![]});}else{logger[_0x6565('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6565('0x2b'),_0x6565('0x8d'),util[_0x6565('0xd3')](_0x29b43c[_0x6565('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6565('0x90'):if(_0x4968b1=='message-delivered'){return _0xac7a9[_0x6565('0x33')]({'read':!![]});}else{logger[_0x6565('0x25')](_0x6565('0x23'),'status',_0x6565('0x90'),util['inspect'](_0x29b43c['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4968b1==='DELIVRD'||_0x4968b1===_0x6565('0xde')){return _0xac7a9['update']({'read':!![]});}else{logger[_0x6565('0x25')](_0x6565('0x23'),'status',_0x6565('0xdf'),util['inspect'](_0x29b43c[_0x6565('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0xac7a9;}})[_0x6565('0x1f')](respondWithResult(_0x5de90a,null))[_0x6565('0x57')](handleError(_0x5de90a,null));};exports['statusGet']=function(_0x4207ac,_0x5ebd15,_0x1fd3b3){var _0x1e7d2b,_0xd2ca14,_0x13b7a3;return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x4207ac[_0x6565('0x59')]['id']}})['then'](handleEntityNotFound(_0x5ebd15,null))[_0x6565('0x1f')](function(_0x32012){if(_0x32012){_0x13b7a3=_0x32012;logger[_0x6565('0x22')](_0x6565('0x23'),_0x6565('0x2b'),_0x6565('0xd2'),_0x32012[_0x6565('0x3f')],util[_0x6565('0xd3')](_0x4207ac[_0x6565('0x43')],{'showHidden':![],'depth':null}));switch(_0x32012[_0x6565('0x3f')]){case _0x6565('0x8b'):if(_0x4207ac[_0x6565('0x43')]['message-id']&&_0x4207ac[_0x6565('0x43')][_0x6565('0xe0')]){_0xd2ca14=_0x4207ac[_0x6565('0x43')][_0x6565('0xe0')];return db['SmsMessage'][_0x6565('0x5f')]({'where':{'messageId':_0x4207ac[_0x6565('0x43')][_0x6565('0xe1')]}});}break;}}})[_0x6565('0x1f')](handleEntityNotFound(_0x5ebd15,null))[_0x6565('0x1f')](function(_0x355f08){if(_0x355f08){_0x1e7d2b=_0x355f08;switch(_0x13b7a3[_0x6565('0x3f')]){case _0x6565('0x8b'):if(_0xd2ca14==='2'||_0xd2ca14==='6'){return _0x1e7d2b[_0x6565('0x33')]({'read':!![]});}else{logger['error'](_0x6565('0x23'),'status',_0x6565('0x8b'),util['inspect'](_0x4207ac[_0x6565('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x1e7d2b;}})['then'](respondWithResult(_0x5ebd15,null))[_0x6565('0x57')](handleError(_0x5ebd15,null));};exports[_0x6565('0xe2')]=function(_0x7756d0,_0x34e040,_0xb2177d){return db[_0x6565('0x3c')][_0x6565('0x5f')]({'where':{'id':_0x7756d0[_0x6565('0x59')]['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x34e040,null))[_0x6565('0x1f')](function(_0x16509d){if(_0x16509d){return _0x16509d[_0x6565('0xe2')](_0x7756d0[_0x6565('0x5b')]['ids'],_[_0x6565('0x9d')](_0x7756d0['body'],['ids','id'])||{})[_0x6565('0xa0')](function(_0x4f22fe){for(var _0x17572d=0x0;_0x17572d<_0x7756d0[_0x6565('0x5b')][_0x6565('0x6a')][_0x6565('0x49')];_0x17572d+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x7756d0[_0x6565('0x5b')][_0x6565('0x6a')][_0x17572d]),'SmsAccountId':Number(_0x7756d0[_0x6565('0x59')]['id'])});}return _0x4f22fe;});}})[_0x6565('0x1f')](respondWithResult(_0x34e040,null))[_0x6565('0x57')](handleError(_0x34e040,null));};exports['removeAgents']=function(_0x3ba034,_0x57b6b8,_0x302978){return db['SmsAccount'][_0x6565('0x5f')]({'where':{'id':_0x3ba034[_0x6565('0x59')]['id']}})[_0x6565('0x1f')](handleEntityNotFound(_0x57b6b8,null))[_0x6565('0x1f')](function(_0x3b7423){if(_0x3b7423){return _0x3b7423[_0x6565('0xe3')](_0x3ba034[_0x6565('0x43')][_0x6565('0x6a')])[_0x6565('0x1f')](function(){if(_['isArray'](_0x3ba034['query'][_0x6565('0x6a')])){for(var _0x3bcce2=0x0;_0x3bcce2<_0x3ba034[_0x6565('0x43')]['ids'][_0x6565('0x49')];_0x3bcce2+=0x1){socket[_0x6565('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x3ba034[_0x6565('0x43')][_0x6565('0x6a')][_0x3bcce2]),'SmsAccountId':Number(_0x3ba034['params']['id'])});}}else{socket[_0x6565('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x3ba034[_0x6565('0x43')][_0x6565('0x6a')]),'SmsAccountId':Number(_0x3ba034['params']['id'])});}});}})[_0x6565('0x1f')](respondWithStatusCode(_0x57b6b8,null))['catch'](handleError(_0x57b6b8,null));};exports[_0x6565('0xe5')]=function(_0x5310ac,_0x323b49,_0x24a25){var _0x4d46c4={};var _0x55b7fc={};var _0x4c0f54;var _0x2fd5be;return db[_0x6565('0x3c')]['findOne']({'where':{'id':_0x5310ac[_0x6565('0x59')]['id']}})['then'](handleEntityNotFound(_0x323b49,null))[_0x6565('0x1f')](function(_0x1c239f){if(_0x1c239f){_0x4c0f54=_0x1c239f;_0x55b7fc[_0x6565('0x41')]=_[_0x6565('0x44')](db[_0x6565('0xac')][_0x6565('0x3d')]);_0x55b7fc[_0x6565('0x43')]=_[_0x6565('0x44')](_0x5310ac[_0x6565('0x43')]);_0x55b7fc[_0x6565('0x45')]=_[_0x6565('0x47')](_0x55b7fc[_0x6565('0x41')],_0x55b7fc['query']);_0x4d46c4[_0x6565('0x46')]=_[_0x6565('0x47')](_0x55b7fc[_0x6565('0x41')],qs[_0x6565('0x48')](_0x5310ac[_0x6565('0x43')][_0x6565('0x48')]));_0x4d46c4[_0x6565('0x46')]=_0x4d46c4[_0x6565('0x46')][_0x6565('0x49')]?_0x4d46c4['attributes']:_0x55b7fc[_0x6565('0x41')];_0x4d46c4[_0x6565('0x4d')]=qs[_0x6565('0x4e')](_0x5310ac[_0x6565('0x43')][_0x6565('0x4e')]);_0x4d46c4[_0x6565('0x4f')]=qs[_0x6565('0x45')](_[_0x6565('0x50')](_0x5310ac[_0x6565('0x43')],_0x55b7fc[_0x6565('0x45')]));if(_0x5310ac[_0x6565('0x43')][_0x6565('0x52')]){_0x4d46c4[_0x6565('0x4f')]=_[_0x6565('0x51')](_0x4d46c4[_0x6565('0x4f')],{'$or':_[_0x6565('0x3b')](_0x4d46c4[_0x6565('0x46')],function(_0x58142d){var _0x1aa63c={};_0x1aa63c[_0x58142d]={'$like':'%'+_0x5310ac[_0x6565('0x43')][_0x6565('0x52')]+'%'};return _0x1aa63c;})});}_0x4d46c4=_[_0x6565('0x51')]({},_0x4d46c4,_0x5310ac[_0x6565('0x68')]);return _0x4c0f54[_0x6565('0xe5')](_0x4d46c4);}})[_0x6565('0x1f')](function(_0x24be12){if(_0x24be12){_0x2fd5be=_0x24be12['length'];if(!_0x5310ac[_0x6565('0x43')][_0x6565('0x4a')]('nolimit')){_0x4d46c4[_0x6565('0x4c')]=qs['limit'](_0x5310ac[_0x6565('0x43')][_0x6565('0x4c')]);_0x4d46c4[_0x6565('0x2d')]=qs['offset'](_0x5310ac['query'][_0x6565('0x2d')]);}return _0x4c0f54[_0x6565('0xe5')](_0x4d46c4);}})['then'](function(_0x4896d4){if(_0x4896d4){return _0x4896d4?{'count':_0x2fd5be,'rows':_0x4896d4}:null;}})[_0x6565('0x1f')](respondWithResult(_0x323b49,null))['catch'](handleError(_0x323b49,null));}; \ No newline at end of file +var _0x7ffe=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','From','Body','messageId','MessageSid','skebby','text','from','message_id','plivo','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','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','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','infobip','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','util','path','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/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','then','request\x20sent','error','message','SmsAccount,\x20%s,\x20%s','info','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','SmsAccounts','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x1ea726,_0x2eed82){var _0x24af9e=function(_0x3b2a6d){while(--_0x3b2a6d){_0x1ea726['push'](_0x1ea726['shift']());}};_0x24af9e(++_0x2eed82);}(_0x7ffe,0x18c));var _0xe7ff=function(_0x1f8362,_0x3b999a){_0x1f8362=_0x1f8362-0x0;var _0x5bdf3e=_0x7ffe[_0x1f8362];return _0x5bdf3e;};'use strict';var emlformat=require(_0xe7ff('0x0'));var rimraf=require(_0xe7ff('0x1'));var zipdir=require(_0xe7ff('0x2'));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(_0xe7ff('0x3'));var path=require(_0xe7ff('0x4'));var sox=require(_0xe7ff('0x5'));var csv=require(_0xe7ff('0x6'));var ejs=require(_0xe7ff('0x7'));var fs=require('fs');var fs_extra=require(_0xe7ff('0x8'));var _=require('lodash');var squel=require(_0xe7ff('0x9'));var crypto=require(_0xe7ff('0xa'));var jsforce=require(_0xe7ff('0xb'));var deskjs=require(_0xe7ff('0xc'));var toCsv=require(_0xe7ff('0x6'));var querystring=require(_0xe7ff('0xd'));var Papa=require('papaparse');var Redis=require(_0xe7ff('0xe'));var authService=require(_0xe7ff('0xf'));var qs=require(_0xe7ff('0x10'));var as=require(_0xe7ff('0x11'));var hardwareService=require(_0xe7ff('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe7ff('0x13'));var config=require(_0xe7ff('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe7ff('0x15')]=_[_0xe7ff('0x16')](config['redis'],{'host':_0xe7ff('0x17'),'port':0x18eb});var socket=require(_0xe7ff('0x18'))(new Redis(config[_0xe7ff('0x15')]));require(_0xe7ff('0x19'))['register'](socket);var jayson=require(_0xe7ff('0x1a'));var client=jayson[_0xe7ff('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1fa919,_0x45d6c8,_0x2bbf5c,_0x4dc7ca){return new BPromise(function(_0x4dba32,_0x494ab8){var _0x36811d=_0x4dc7ca||client;return _0x36811d['request'](_0x1fa919,_0x2bbf5c)[_0xe7ff('0x1c')](function(_0x430791){logger['info']('SmsAccount,\x20%s,\x20%s',_0x45d6c8,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x45d6c8,_0xe7ff('0x1d'),JSON['stringify'](_0x430791));if(_0x430791[_0xe7ff('0x1e')]){if(_0x430791['error']['code']===0x1f4){logger[_0xe7ff('0x1e')]('SmsAccount,\x20%s,\x20%s',_0x45d6c8,_0x430791['error'][_0xe7ff('0x1f')]);return _0x494ab8(_0x430791[_0xe7ff('0x1e')][_0xe7ff('0x1f')]);}logger[_0xe7ff('0x1e')](_0xe7ff('0x20'),_0x45d6c8,_0x430791[_0xe7ff('0x1e')][_0xe7ff('0x1f')]);return _0x4dba32(_0x430791[_0xe7ff('0x1e')][_0xe7ff('0x1f')]);}else{logger[_0xe7ff('0x21')](_0xe7ff('0x20'),_0x45d6c8,'request\x20sent');_0x4dba32(_0x430791[_0xe7ff('0x22')][_0xe7ff('0x1f')]);}})['catch'](function(_0x411ca7){logger[_0xe7ff('0x1e')](_0xe7ff('0x20'),_0x45d6c8,_0x411ca7);_0x494ab8(_0x411ca7);});});}function respondWithStatusCode(_0x489967,_0x13a4f3){_0x13a4f3=_0x13a4f3||0xcc;return function(_0x50b444){if(_0x50b444){return _0x489967[_0xe7ff('0x23')](_0x13a4f3);}return _0x489967['status'](_0x13a4f3)[_0xe7ff('0x24')]();};}function respondWithResult(_0x3b1c5f,_0x218a33){_0x218a33=_0x218a33||0xc8;return function(_0x651f3a){if(_0x651f3a){return _0x3b1c5f[_0xe7ff('0x25')](_0x218a33)[_0xe7ff('0x26')](_0x651f3a);}};}function respondWithFilteredResult(_0x197cfa,_0x1ec8b5){return function(_0x4ce918){if(_0x4ce918){var _0xd174a=typeof _0x1ec8b5[_0xe7ff('0x27')]===_0xe7ff('0x28')&&typeof _0x1ec8b5[_0xe7ff('0x29')]===_0xe7ff('0x28');var _0x4a5444=_0x4ce918[_0xe7ff('0x2a')];var _0xb8a96b=_0xd174a?0x0:_0x1ec8b5[_0xe7ff('0x27')];var _0x167cd1=_0xd174a?_0x4ce918[_0xe7ff('0x2a')]:_0x1ec8b5['offset']+_0x1ec8b5[_0xe7ff('0x29')];var _0x36bf83;if(_0x167cd1>=_0x4a5444){_0x167cd1=_0x4a5444;_0x36bf83=0xc8;}else{_0x36bf83=0xce;}_0x197cfa[_0xe7ff('0x25')](_0x36bf83);return _0x197cfa[_0xe7ff('0x2b')](_0xe7ff('0x2c'),_0xb8a96b+'-'+_0x167cd1+'/'+_0x4a5444)[_0xe7ff('0x26')](_0x4ce918);}return null;};}function patchUpdates(_0x36e8f0){return function(_0x277fb2){try{jsonpatch[_0xe7ff('0x2d')](_0x277fb2,_0x36e8f0,!![]);}catch(_0xe2b74c){return BPromise['reject'](_0xe2b74c);}return _0x277fb2[_0xe7ff('0x2e')]();};}function saveUpdates(_0x542fdd,_0x2068dd){return function(_0x362be4){if(_0x362be4){return _0x362be4['update'](_0x542fdd)[_0xe7ff('0x1c')](function(_0x3b96aa){return _0x3b96aa;});}return null;};}function removeEntity(_0x7f7103,_0x168e88){return function(_0x462e1d){if(_0x462e1d){return _0x462e1d['destroy']()[_0xe7ff('0x1c')](function(){var _0xc349b=_0x462e1d['get']({'plain':!![]});var _0x211acf=_0xe7ff('0x2f');return db[_0xe7ff('0x30')][_0xe7ff('0x31')]({'where':{'type':_0x211acf,'resourceId':_0xc349b['id']}})[_0xe7ff('0x1c')](function(){return _0x462e1d;});})[_0xe7ff('0x1c')](function(){_0x7f7103['status'](0xcc)[_0xe7ff('0x24')]();});}};}function handleEntityNotFound(_0x48219a,_0x4501e6){return function(_0x230945){if(!_0x230945){_0x48219a[_0xe7ff('0x23')](0x194);}return _0x230945;};}function handleError(_0xf15307,_0x49b8ad){_0x49b8ad=_0x49b8ad||0x1f4;return function(_0x236b60){logger['error'](_0x236b60['stack']);if(_0x236b60[_0xe7ff('0x32')]){delete _0x236b60[_0xe7ff('0x32')];}_0xf15307[_0xe7ff('0x25')](_0x49b8ad)[_0xe7ff('0x33')](_0x236b60);};}exports[_0xe7ff('0x34')]=function(_0x39d13e,_0x4a9c64){var _0x3d0ea0={'include':[{'model':db[_0xe7ff('0x35')],'as':_0xe7ff('0x36')}]},_0x1e4f76={},_0x1a23fb={'count':0x0,'rows':[]};var _0x1caabb=_[_0xe7ff('0x37')](db[_0xe7ff('0x38')][_0xe7ff('0x39')],function(_0x18b45b){return{'name':_0x18b45b['fieldName'],'type':_0x18b45b[_0xe7ff('0x3a')][_0xe7ff('0x3b')]};});_0x1e4f76[_0xe7ff('0x3c')]=_[_0xe7ff('0x37')](_0x1caabb,_0xe7ff('0x32'));_0x1e4f76[_0xe7ff('0x3d')]=_['keys'](_0x39d13e[_0xe7ff('0x3d')]);_0x1e4f76[_0xe7ff('0x3e')]=_['intersection'](_0x1e4f76[_0xe7ff('0x3c')],_0x1e4f76[_0xe7ff('0x3d')]);_0x3d0ea0[_0xe7ff('0x3f')]=_[_0xe7ff('0x40')](_0x1e4f76[_0xe7ff('0x3c')],qs[_0xe7ff('0x41')](_0x39d13e[_0xe7ff('0x3d')][_0xe7ff('0x41')]));_0x3d0ea0[_0xe7ff('0x3f')]=_0x3d0ea0['attributes'][_0xe7ff('0x42')]?_0x3d0ea0[_0xe7ff('0x3f')]:_0x1e4f76[_0xe7ff('0x3c')];if(!_0x39d13e[_0xe7ff('0x3d')][_0xe7ff('0x43')](_0xe7ff('0x44'))){_0x3d0ea0[_0xe7ff('0x29')]=qs['limit'](_0x39d13e[_0xe7ff('0x3d')][_0xe7ff('0x29')]);_0x3d0ea0[_0xe7ff('0x27')]=qs[_0xe7ff('0x27')](_0x39d13e['query']['offset']);}_0x3d0ea0[_0xe7ff('0x45')]=qs[_0xe7ff('0x46')](_0x39d13e[_0xe7ff('0x3d')][_0xe7ff('0x46')]);_0x3d0ea0[_0xe7ff('0x47')]=qs[_0xe7ff('0x3e')](_[_0xe7ff('0x48')](_0x39d13e[_0xe7ff('0x3d')],_0x1e4f76[_0xe7ff('0x3e')]),_0x1caabb);if(_0x39d13e[_0xe7ff('0x3d')][_0xe7ff('0x49')]){_0x3d0ea0[_0xe7ff('0x47')]=_[_0xe7ff('0x4a')](_0x3d0ea0['where'],{'$or':_[_0xe7ff('0x37')](_0x1caabb,function(_0x582fca){if(_0x582fca[_0xe7ff('0x3a')]!=='VIRTUAL'){var _0x2283fd={};_0x2283fd[_0x582fca[_0xe7ff('0x32')]]={'$like':'%'+_0x39d13e['query'][_0xe7ff('0x49')]+'%'};return _0x2283fd;}})});}_0x3d0ea0=_[_0xe7ff('0x4a')]({},_0x3d0ea0,_0x39d13e[_0xe7ff('0x4b')]);var _0x499d05={'where':_0x3d0ea0[_0xe7ff('0x47')]};return db[_0xe7ff('0x38')]['count'](_0x499d05)[_0xe7ff('0x1c')](function(_0x527f1d){_0x1a23fb[_0xe7ff('0x2a')]=_0x527f1d;if(_0x39d13e[_0xe7ff('0x3d')][_0xe7ff('0x4c')]){_0x3d0ea0[_0xe7ff('0x4d')]=[{'all':!![]}];}return db[_0xe7ff('0x38')][_0xe7ff('0x4e')](_0x3d0ea0);})[_0xe7ff('0x1c')](function(_0x769195){_0x1a23fb[_0xe7ff('0x4f')]=_0x769195;return _0x1a23fb;})[_0xe7ff('0x1c')](respondWithFilteredResult(_0x4a9c64,_0x3d0ea0))['catch'](handleError(_0x4a9c64,null));};exports['show']=function(_0x2d88ce,_0x3925a0){var _0x169455={'raw':![],'where':{'id':_0x2d88ce[_0xe7ff('0x50')]['id']},'include':[{'model':db[_0xe7ff('0x35')],'as':_0xe7ff('0x36')}]},_0x2f6dc2={};_0x2f6dc2[_0xe7ff('0x3c')]=_[_0xe7ff('0x51')](db[_0xe7ff('0x38')][_0xe7ff('0x39')]);_0x2f6dc2['query']=_[_0xe7ff('0x51')](_0x2d88ce['query']);_0x2f6dc2[_0xe7ff('0x3e')]=_['intersection'](_0x2f6dc2[_0xe7ff('0x3c')],_0x2f6dc2[_0xe7ff('0x3d')]);_0x169455['attributes']=_[_0xe7ff('0x40')](_0x2f6dc2['model'],qs[_0xe7ff('0x41')](_0x2d88ce['query'][_0xe7ff('0x41')]));_0x169455[_0xe7ff('0x3f')]=_0x169455[_0xe7ff('0x3f')][_0xe7ff('0x42')]?_0x169455[_0xe7ff('0x3f')]:_0x2f6dc2[_0xe7ff('0x3c')];if(_0x2d88ce[_0xe7ff('0x3d')][_0xe7ff('0x4c')]){_0x169455['include']=[{'all':!![]}];}_0x169455=_[_0xe7ff('0x4a')]({},_0x169455,_0x2d88ce[_0xe7ff('0x4b')]);return db[_0xe7ff('0x38')][_0xe7ff('0x52')](_0x169455)[_0xe7ff('0x1c')](handleEntityNotFound(_0x3925a0,null))[_0xe7ff('0x1c')](respondWithResult(_0x3925a0,null))[_0xe7ff('0x53')](handleError(_0x3925a0,null));};exports['create']=function(_0x102827,_0x5209f2){return db[_0xe7ff('0x38')][_0xe7ff('0x54')](_0x102827[_0xe7ff('0x55')],{})[_0xe7ff('0x1c')](function(_0x575015){var _0x44a84b=_0x102827[_0xe7ff('0x56')][_0xe7ff('0x57')]({'plain':!![]});if(!_0x44a84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44a84b[_0xe7ff('0x58')]===_0xe7ff('0x56')){var _0x877afb=_0x575015[_0xe7ff('0x57')]({'plain':!![]});var _0x5f235a=_0xe7ff('0x2f');return db['UserProfileSection'][_0xe7ff('0x52')]({'where':{'name':_0x5f235a,'userProfileId':_0x44a84b[_0xe7ff('0x59')]},'raw':!![]})['then'](function(_0x5311c0){if(_0x5311c0&&_0x5311c0[_0xe7ff('0x5a')]===0x0){return db[_0xe7ff('0x30')][_0xe7ff('0x54')]({'name':_0x877afb['name'],'resourceId':_0x877afb['id'],'type':_0x5311c0[_0xe7ff('0x32')],'sectionId':_0x5311c0['id']},{})[_0xe7ff('0x1c')](function(){return _0x575015;});}else{return _0x575015;}})[_0xe7ff('0x53')](function(_0x4f7b2d){logger['error'](_0xe7ff('0x5b'),_0x4f7b2d);throw _0x4f7b2d;});}return _0x575015;})[_0xe7ff('0x1c')](respondWithResult(_0x5209f2,0xc9))[_0xe7ff('0x53')](handleError(_0x5209f2,null));};exports[_0xe7ff('0x5c')]=function(_0x285723,_0x3689ee){if(_0x285723[_0xe7ff('0x55')]['id']){delete _0x285723[_0xe7ff('0x55')]['id'];}return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0x285723[_0xe7ff('0x50')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe7ff('0x1c')](handleEntityNotFound(_0x3689ee,null))[_0xe7ff('0x1c')](saveUpdates(_0x285723[_0xe7ff('0x55')],null))[_0xe7ff('0x1c')](respondWithResult(_0x3689ee,null))[_0xe7ff('0x53')](handleError(_0x3689ee,null));};exports[_0xe7ff('0x31')]=function(_0x251b01,_0x158abc){return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0x251b01['params']['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x158abc,null))['then'](removeEntity(_0x158abc,null))[_0xe7ff('0x53')](handleError(_0x158abc,null));};exports[_0xe7ff('0x5d')]=function(_0x5eb44d,_0x377a48){return db[_0xe7ff('0x38')][_0xe7ff('0x5d')]()[_0xe7ff('0x1c')](respondWithResult(_0x377a48,null))['catch'](handleError(_0x377a48,null));};exports[_0xe7ff('0x5e')]=function(_0x3942b7,_0x16c9ef,_0x42aefc){if(_0x3942b7[_0xe7ff('0x55')]['id']){delete _0x3942b7[_0xe7ff('0x55')]['id'];}return db[_0xe7ff('0x38')]['find']({'where':{'id':_0x3942b7[_0xe7ff('0x50')]['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x16c9ef,null))[_0xe7ff('0x1c')](function(_0x2ce18f){if(_0x2ce18f){_0x3942b7['body'][_0xe7ff('0x5f')]=_0x2ce18f['id'];return db['Disposition'][_0xe7ff('0x54')](_0x3942b7[_0xe7ff('0x55')]);}})[_0xe7ff('0x1c')](respondWithResult(_0x16c9ef,null))[_0xe7ff('0x53')](handleError(_0x16c9ef,null));};exports['getDispositions']=function(_0x2edc89,_0x435617,_0x39d62e){var _0x2590fa={'raw':![],'where':{}};var _0x1011e6={};var _0x2fd78c={'count':0x0,'rows':[]};return db[_0xe7ff('0x38')]['findOne']({'where':{'id':_0x2edc89[_0xe7ff('0x50')]['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x435617,null))[_0xe7ff('0x1c')](function(_0x58d65b){if(_0x58d65b){_0x1011e6[_0xe7ff('0x3c')]=_[_0xe7ff('0x51')](db[_0xe7ff('0x60')][_0xe7ff('0x39')]);_0x1011e6[_0xe7ff('0x3d')]=_['keys'](_0x2edc89[_0xe7ff('0x3d')]);_0x1011e6['filters']=_['intersection'](_0x1011e6[_0xe7ff('0x3c')],_0x1011e6['query']);_0x2590fa[_0xe7ff('0x3f')]=_[_0xe7ff('0x40')](_0x1011e6['model'],qs[_0xe7ff('0x41')](_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x41')]));_0x2590fa['attributes']=_0x2590fa[_0xe7ff('0x3f')]['length']?_0x2590fa[_0xe7ff('0x3f')]:_0x1011e6['model'];if(!_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x43')](_0xe7ff('0x44'))){_0x2590fa[_0xe7ff('0x29')]=qs[_0xe7ff('0x29')](_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x29')]);_0x2590fa[_0xe7ff('0x27')]=qs['offset'](_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x27')]);}_0x2590fa['order']=qs[_0xe7ff('0x46')](_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x46')]);_0x2590fa[_0xe7ff('0x47')]=qs[_0xe7ff('0x3e')](_[_0xe7ff('0x48')](_0x2edc89[_0xe7ff('0x3d')],_0x1011e6[_0xe7ff('0x3e')]));_0x2590fa[_0xe7ff('0x47')][_0xe7ff('0x5f')]=_0x58d65b['id'];if(_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x49')]){_0x2590fa['where']=_['merge'](_0x2590fa[_0xe7ff('0x47')],{'$or':_['map'](_0x2590fa[_0xe7ff('0x3f')],function(_0x177bd9){var _0x542960={};_0x542960[_0x177bd9]={'$like':'%'+_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x49')]+'%'};return _0x542960;})});}_0x2590fa=_[_0xe7ff('0x4a')]({},_0x2590fa,_0x2edc89[_0xe7ff('0x4b')]);return db[_0xe7ff('0x60')][_0xe7ff('0x2a')]({'where':_0x2590fa[_0xe7ff('0x47')]})[_0xe7ff('0x1c')](function(_0x49405f){_0x2fd78c[_0xe7ff('0x2a')]=_0x49405f;if(_0x2edc89[_0xe7ff('0x3d')][_0xe7ff('0x4c')]){_0x2590fa[_0xe7ff('0x4d')]=[{'all':!![]}];}return db[_0xe7ff('0x60')][_0xe7ff('0x4e')](_0x2590fa);})[_0xe7ff('0x1c')](function(_0x4d9453){_0x2fd78c[_0xe7ff('0x4f')]=_0x4d9453;return _0x2fd78c;});}})[_0xe7ff('0x1c')](respondWithFilteredResult(_0x435617,_0x2590fa))[_0xe7ff('0x53')](handleError(_0x435617,null));};exports['removeDispositions']=function(_0x1e3088,_0x37692a,_0x3c7df7){return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0x1e3088['params']['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x37692a,null))[_0xe7ff('0x1c')](function(_0x1595e4){if(_0x1595e4){return _0x1595e4[_0xe7ff('0x61')](_0x1e3088['query'][_0xe7ff('0x62')]);}})[_0xe7ff('0x1c')](respondWithStatusCode(_0x37692a,null))[_0xe7ff('0x53')](handleError(_0x37692a,null));};exports['addAnswer']=function(_0x18a84b,_0x3941a1,_0x101873){if(_0x18a84b['body']['id']){delete _0x18a84b['body']['id'];}return db[_0xe7ff('0x38')]['find']({'where':{'id':_0x18a84b[_0xe7ff('0x50')]['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x3941a1,null))['then'](function(_0x472e59){if(_0x472e59){_0x18a84b[_0xe7ff('0x55')][_0xe7ff('0x5f')]=_0x472e59['id'];return db[_0xe7ff('0x63')]['create'](_0x18a84b['body']);}})[_0xe7ff('0x1c')](respondWithResult(_0x3941a1,null))[_0xe7ff('0x53')](handleError(_0x3941a1,null));};exports[_0xe7ff('0x64')]=function(_0x1d32e1,_0x382e9e,_0x203848){var _0x5df873={'raw':![],'where':{}};var _0x22fb96={};var _0x3146a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe7ff('0x65')]({'where':{'id':_0x1d32e1[_0xe7ff('0x50')]['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x382e9e,null))[_0xe7ff('0x1c')](function(_0x17ecf1){if(_0x17ecf1){_0x22fb96['model']=_[_0xe7ff('0x51')](db[_0xe7ff('0x63')][_0xe7ff('0x39')]);_0x22fb96[_0xe7ff('0x3d')]=_['keys'](_0x1d32e1['query']);_0x22fb96['filters']=_[_0xe7ff('0x40')](_0x22fb96['model'],_0x22fb96[_0xe7ff('0x3d')]);_0x5df873[_0xe7ff('0x3f')]=_[_0xe7ff('0x40')](_0x22fb96[_0xe7ff('0x3c')],qs['fields'](_0x1d32e1[_0xe7ff('0x3d')][_0xe7ff('0x41')]));_0x5df873[_0xe7ff('0x3f')]=_0x5df873[_0xe7ff('0x3f')]['length']?_0x5df873[_0xe7ff('0x3f')]:_0x22fb96['model'];if(!_0x1d32e1[_0xe7ff('0x3d')]['hasOwnProperty'](_0xe7ff('0x44'))){_0x5df873[_0xe7ff('0x29')]=qs[_0xe7ff('0x29')](_0x1d32e1[_0xe7ff('0x3d')][_0xe7ff('0x29')]);_0x5df873[_0xe7ff('0x27')]=qs[_0xe7ff('0x27')](_0x1d32e1['query'][_0xe7ff('0x27')]);}_0x5df873[_0xe7ff('0x45')]=qs[_0xe7ff('0x46')](_0x1d32e1['query']['sort']);_0x5df873[_0xe7ff('0x47')]=qs[_0xe7ff('0x3e')](_[_0xe7ff('0x48')](_0x1d32e1['query'],_0x22fb96['filters']));_0x5df873['where'][_0xe7ff('0x5f')]=_0x17ecf1['id'];if(_0x1d32e1[_0xe7ff('0x3d')][_0xe7ff('0x49')]){_0x5df873[_0xe7ff('0x47')]=_[_0xe7ff('0x4a')](_0x5df873[_0xe7ff('0x47')],{'$or':_[_0xe7ff('0x37')](_0x5df873[_0xe7ff('0x3f')],function(_0x58b3b8){var _0x1c2a62={};_0x1c2a62[_0x58b3b8]={'$like':'%'+_0x1d32e1[_0xe7ff('0x3d')][_0xe7ff('0x49')]+'%'};return _0x1c2a62;})});}_0x5df873=_[_0xe7ff('0x4a')]({},_0x5df873,_0x1d32e1['options']);return db[_0xe7ff('0x63')]['count']({'where':_0x5df873[_0xe7ff('0x47')]})['then'](function(_0x8a020){_0x3146a8[_0xe7ff('0x2a')]=_0x8a020;if(_0x1d32e1[_0xe7ff('0x3d')][_0xe7ff('0x4c')]){_0x5df873['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xe7ff('0x4e')](_0x5df873);})[_0xe7ff('0x1c')](function(_0x4b1d8a){_0x3146a8['rows']=_0x4b1d8a;return _0x3146a8;});}})[_0xe7ff('0x1c')](respondWithFilteredResult(_0x382e9e,_0x5df873))['catch'](handleError(_0x382e9e,null));};exports[_0xe7ff('0x66')]=function(_0x5a7967,_0x5901cb,_0x439a17){return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0x5a7967[_0xe7ff('0x50')]['id']}})['then'](handleEntityNotFound(_0x5901cb,null))[_0xe7ff('0x1c')](function(_0x7d092b){if(_0x7d092b){return _0x7d092b[_0xe7ff('0x66')](_0x5a7967['query'][_0xe7ff('0x62')]);}})['then'](respondWithStatusCode(_0x5901cb,null))[_0xe7ff('0x53')](handleError(_0x5901cb,null));};exports['notify']=function(_0xb7b8b,_0x1f0d60,_0x58ab83){var _0x4a7631={'channel':_0xe7ff('0x67')};var _0x4fcb88=[];var _0x21245b=[];var _0x28e3a2={};return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0xb7b8b[_0xe7ff('0x50')]['id']},'include':[{'model':db[_0xe7ff('0x68')],'as':'Applications'}]})[_0xe7ff('0x1c')](handleEntityNotFound(_0x1f0d60,null))[_0xe7ff('0x1c')](function(_0x569647){_0x4a7631[_0xe7ff('0x69')]=_0x569647;_0x4a7631[_0xe7ff('0x6a')]=_[_0xe7ff('0x6b')](_0x569647[_0xe7ff('0x6c')],[_0xe7ff('0x6d')],[_0xe7ff('0x6e')]);if(_0x4a7631['account'][_0xe7ff('0x6c')]){delete _0x4a7631[_0xe7ff('0x69')][_0xe7ff('0x6c')];}return db['CmContact'][_0xe7ff('0x5d')]();})[_0xe7ff('0x1c')](function(_0x2f4679){if(!_0x2f4679){throw new db[(_0xe7ff('0x6f'))]['ValidationError']('no\x20available\x20attributes');}_0x4fcb88=_[_0xe7ff('0x70')](_[_0xe7ff('0x51')](_0x2f4679),[_0xe7ff('0x71'),_0xe7ff('0x72')]);_0x21245b=_[_0xe7ff('0x70')](_[_0xe7ff('0x51')](_0x2f4679),[_0xe7ff('0x71'),_0xe7ff('0x72'),_0xe7ff('0x73'),_0xe7ff('0x74')]);_0x4a7631[_0xe7ff('0x55')]={'mapKey':'mobile'};if(_0x4a7631[_0xe7ff('0x69')][_0xe7ff('0x3a')]){switch(_0x4a7631[_0xe7ff('0x69')][_0xe7ff('0x3a')]){case _0xe7ff('0x75'):_0x4a7631[_0xe7ff('0x55')]['from']=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x76')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x55')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x77')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x78')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x79')];break;case _0xe7ff('0x7a'):_0x4a7631[_0xe7ff('0x55')]['from']='+'+_0xb7b8b[_0xe7ff('0x55')]['sender'];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x55')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x7b')];break;case'connectel':_0x4a7631[_0xe7ff('0x55')]['from']=_0xb7b8b[_0xe7ff('0x55')]['from'];_0x4a7631[_0xe7ff('0x55')]['body']=_0xb7b8b[_0xe7ff('0x55')]['message'];break;case'clicksend':_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')]=_0xb7b8b[_0xe7ff('0x55')]['from'];_0x4a7631[_0xe7ff('0x55')]['body']=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x55')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x78')]=_0xb7b8b['body'][_0xe7ff('0x7d')];break;case _0xe7ff('0x7e'):_0x4a7631['body'][_0xe7ff('0x7c')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x76')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x55')]=_0xb7b8b['body']['Text'];_0x4a7631['body']['messageId']=_0xb7b8b[_0xe7ff('0x55')]['MessageUUID'];break;case'infobip':_0x4a7631['body'][_0xe7ff('0x7c')]='+'+_0xb7b8b['body'][_0xe7ff('0x7f')][0x0][_0xe7ff('0x7c')];_0x4a7631[_0xe7ff('0x55')]['body']=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x7f')][0x0]['text'];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x78')]=_0xb7b8b['body'][_0xe7ff('0x7f')][0x0]['messageId'];break;case _0xe7ff('0x80'):_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')]=_0xb7b8b[_0xe7ff('0x55')]['originatingAddress'];_0x4a7631['body'][_0xe7ff('0x55')]=_0xb7b8b['body'][_0xe7ff('0x81')][_0xe7ff('0x1f')];break;case _0xe7ff('0x82'):_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x83')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x55')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x7b')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x78')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x84')];break;case _0xe7ff('0x85'):_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x78')]=_0xb7b8b[_0xe7ff('0x55')][0x0][_0xe7ff('0x1f')]['id'];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')]=_0xb7b8b['body'][0x0]['message']['from'];_0x4a7631['body'][_0xe7ff('0x55')]=_0xb7b8b[_0xe7ff('0x55')][0x0][_0xe7ff('0x1f')]['text'];break;case _0xe7ff('0x86'):_0x4a7631[_0xe7ff('0x55')]['from']=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x7c')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x55')]=_0xb7b8b['body'][_0xe7ff('0x1f')];_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x78')]=_0xb7b8b[_0xe7ff('0x55')][_0xe7ff('0x87')];break;}}if(_0x4a7631[_0xe7ff('0x55')]['id']){delete _0x4a7631[_0xe7ff('0x55')]['id'];}if(_[_0xe7ff('0x88')](_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')])){throw new db['Sequelize']['ValidationError'](_0xe7ff('0x89'));}if(_[_0xe7ff('0x88')](_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x55')])||_0x4a7631['body']['body']===''){throw new db[(_0xe7ff('0x6f'))][(_0xe7ff('0x8a'))](_0xe7ff('0x8b'));}if(_['isNil'](_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x8c')])){throw new db[(_0xe7ff('0x6f'))][(_0xe7ff('0x8a'))](_0xe7ff('0x8d')+_0x21245b);}if(!_[_0xe7ff('0x8e')](_0x21245b,_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x8c')])){throw new db['Sequelize']['ValidationError'](_0xe7ff('0x8f')+_0x21245b);}_0x28e3a2[_0x4a7631['body'][_0xe7ff('0x8c')]]=_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')];return db[_0xe7ff('0x90')][_0xe7ff('0x52')]({'where':{'id':_0x4a7631[_0xe7ff('0x69')]['ListId']},'include':[{'model':db[_0xe7ff('0x91')],'as':_0xe7ff('0x92'),'where':_0x28e3a2,'limit':0x1,'order':[[_0xe7ff('0x72'),_0xe7ff('0x93')]]}]});})[_0xe7ff('0x1c')](handleEntityNotFound(_0x1f0d60,null))['then'](function(_0x39d138){if(_0x39d138){_0x4a7631[_0xe7ff('0x94')]=_[_0xe7ff('0x95')](_0x39d138,[_0xe7ff('0x92')]);if(_0x39d138['Contacts'][_0xe7ff('0x42')]){return _0x39d138[_0xe7ff('0x92')][0x0];}var _0x2ae480=_['defaults'](_0x4a7631[_0xe7ff('0x55')],{'firstName':_0x4a7631['body'][_0xe7ff('0x7c')],'ListId':_0x39d138['id']});_0x2ae480[_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x8c')]]=_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')];return db[_0xe7ff('0x91')][_0xe7ff('0x54')](_0x2ae480,{'fields':_0x4fcb88,'raw':!![]});}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x1f0d60,null))[_0xe7ff('0x1c')](function(_0x1c00e4){if(_0x1c00e4){_0x4a7631[_0xe7ff('0x96')]=_0x1c00e4;var _0x1f3f21={'ContactId':_0x1c00e4['id'],'phone':_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')],'SmsAccountId':_0xb7b8b[_0xe7ff('0x50')]['id']};var _0x3bc90d={'ContactId':_0x1c00e4['id'],'SmsAccountId':_0xb7b8b[_0xe7ff('0x50')]['id'],'closed':![]};return db[_0xe7ff('0x97')][_0xe7ff('0x52')]({'where':_0x3bc90d})[_0xe7ff('0x1c')](function(_0x16f7e3){if(_0x16f7e3){return[_0x16f7e3,![]];}return db[_0xe7ff('0x97')]['create'](_0x1f3f21)[_0xe7ff('0x1c')](function(_0x2e67a3){return[_0x2e67a3,!![]];});});}})['spread'](function(_0x316bb4,_0x35d61c){_0x4a7631[_0xe7ff('0x98')]=_0x316bb4[_0xe7ff('0x57')]({'plain':!![]});_0x4a7631[_0xe7ff('0x98')]['created']=![];if(_0x35d61c){if(_0x4a7631[_0xe7ff('0x69')][_0xe7ff('0x99')]){_0x4a7631[_0xe7ff('0x6a')][_0xe7ff('0x9a')]({'id':0x0,'priority':_0x4a7631['applications']['length']+0x1,'app':_0xe7ff('0x9b'),'appdata':_0xe7ff('0x9c'),'interval':_0xe7ff('0x9d')});}_0x4a7631['interaction'][_0xe7ff('0x9e')]=!![];}return db[_0xe7ff('0x9f')]['create']({'phone':_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0x7c')],'messageId':_0x4a7631[_0xe7ff('0x55')]['messageId'],'body':_0x4a7631[_0xe7ff('0x55')]['body'],'SmsAccountId':_0xb7b8b[_0xe7ff('0x50')]['id'],'SmsInteractionId':_0x316bb4['id'],'direction':'in','ContactId':_0x316bb4[_0xe7ff('0xa0')],'AttachmentId':_0x4a7631[_0xe7ff('0x55')][_0xe7ff('0xa1')]});})[_0xe7ff('0x1c')](function(_0x4a06ab){_0x4a7631[_0xe7ff('0x1f')]=_0x4a06ab;if(!_0x4a7631['interaction'][_0xe7ff('0xa2')])return;return db[_0xe7ff('0xa3')][_0xe7ff('0x52')]({'attributes':['id',_0xe7ff('0x32')],'where':{'id':_0x4a7631['interaction'][_0xe7ff('0xa2')]}});})['then'](function(_0x2df1b5){if(_0x2df1b5){_0x4a7631[_0xe7ff('0x6a')][_0xe7ff('0xa4')]({'id':0x0,'priority':0x0,'app':_0xe7ff('0xa5'),'appdata':_0x2df1b5[_0xe7ff('0x32')]+','+(_0x4a7631[_0xe7ff('0x69')]['waitForTheAssignedAgent']||0xa),'interval':_0xe7ff('0x9d')});}if(!_0x4a7631['interaction'][_0xe7ff('0xa6')])return;return db[_0xe7ff('0xa7')][_0xe7ff('0x52')]({'attributes':['id','name'],'where':{'id':_0x4a7631['interaction'][_0xe7ff('0xa6')]}});})['then'](function(_0x2d1d78){if(_0x2d1d78){_0x4a7631[_0xe7ff('0x6a')][_0xe7ff('0xa4')]({'id':0x0,'priority':0x1,'app':_0xe7ff('0xa8'),'appdata':_0x2d1d78[_0xe7ff('0x32')]+','+(_0x4a7631[_0xe7ff('0x69')][_0xe7ff('0xa9')]||0x12c),'interval':_0xe7ff('0x9d')});}return respondWithRpcPromise('Start',_0xe7ff('0xaa'),_0x4a7631);})['then'](function(_0x25a1e4){if(_0x25a1e4){var _0x27d7dc=0xc8;var _0x890fbf=_0xe7ff('0xab');logger[_0xe7ff('0x21')](_0xe7ff('0xac'),_0x890fbf,_0x27d7dc,_0xe7ff('0xad'));logger[_0xe7ff('0xae')](_0xe7ff('0xaf'),_0x890fbf,_0x27d7dc,_0xe7ff('0xad'),JSON[_0xe7ff('0xb0')](_0x25a1e4));if(_0x4a7631[_0xe7ff('0x69')][_0xe7ff('0x3a')]===_0xe7ff('0x75')){return _0x1f0d60[_0xe7ff('0x25')](_0x27d7dc)['set'](_0xe7ff('0xb1'),_0xe7ff('0xb2'))[_0xe7ff('0x33')](_0xe7ff('0xb3'));}else{return _0x1f0d60[_0xe7ff('0x25')](_0x27d7dc)[_0xe7ff('0x26')](_0x25a1e4);}}})['catch'](handleError(_0x1f0d60,null));};exports[_0xe7ff('0xb4')]=function(_0x2df7d2,_0x57c456){var _0x216459=_0x2df7d2['params']['id'];var _0x15ee55=_0x2df7d2['body'];var _0x5ee240=0xc8;var _0x1bea56=null;return db[_0xe7ff('0xb5')][_0xe7ff('0xb6')]({'isolationLevel':db['sequelize'][_0xe7ff('0xb7')][_0xe7ff('0xb8')][_0xe7ff('0xb9')]},function(_0x42c57b){return db[_0xe7ff('0x38')]['findOne']({'where':{'id':_0x216459},'transaction':_0x42c57b})[_0xe7ff('0x1c')](function(_0x58b3ed){if(_0x58b3ed){return db['SmsApplication'][_0xe7ff('0x31')]({'where':{'SmsAccountId':_0x216459},'transaction':_0x42c57b})[_0xe7ff('0x1c')](function(){var _0x2e194a=_[_0xe7ff('0x37')](_0x15ee55,function(_0x25053e){_0x25053e[_0xe7ff('0x5f')]=_0x216459;return _0x25053e;});return db[_0xe7ff('0x68')][_0xe7ff('0xba')](_0x2e194a,{'transaction':_0x42c57b});});}else{_0x5ee240=0x194;_0x1bea56=[];}});})[_0xe7ff('0x1c')](function(){if(_0x5ee240!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x216459},'order':_0xe7ff('0x6d')})[_0xe7ff('0x1c')](function(_0x410f8a){_0x1bea56=_0x410f8a;});}})['catch'](function(_0x2002e8){_0x5ee240=0x1f4;logger[_0xe7ff('0x1e')](_0x2002e8[_0xe7ff('0xbb')]);if(_0x2002e8['name']){delete _0x2002e8[_0xe7ff('0x32')];}_0x1bea56=_0x2002e8;})[_0xe7ff('0xbc')](function(){if(_0x1bea56===null){_0x57c456[_0xe7ff('0x23')](_0x5ee240);}else{if(_0x5ee240===0x1f4){_0x57c456[_0xe7ff('0x25')](_0x5ee240)[_0xe7ff('0x33')](_0x1bea56);}else{_0x57c456['status'](_0x5ee240)[_0xe7ff('0x26')](_0x1bea56);}}});};exports[_0xe7ff('0xbd')]=function(_0x2f9863,_0x26339f,_0x5b7019){var _0x2e5ed8={};var _0x116447={};var _0x3b8a70;var _0x41a2e8;return db[_0xe7ff('0x38')][_0xe7ff('0x65')]({'where':{'id':_0x2f9863['params']['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x26339f,null))[_0xe7ff('0x1c')](function(_0x48aaaf){if(_0x48aaaf){_0x3b8a70=_0x48aaaf;_0x116447['model']=_['keys'](db[_0xe7ff('0x68')]['rawAttributes']);_0x116447[_0xe7ff('0x3d')]=_[_0xe7ff('0x51')](_0x2f9863[_0xe7ff('0x3d')]);_0x116447['filters']=_['intersection'](_0x116447[_0xe7ff('0x3c')],_0x116447[_0xe7ff('0x3d')]);_0x2e5ed8['attributes']=_[_0xe7ff('0x40')](_0x116447['model'],qs['fields'](_0x2f9863[_0xe7ff('0x3d')]['fields']));_0x2e5ed8[_0xe7ff('0x3f')]=_0x2e5ed8[_0xe7ff('0x3f')][_0xe7ff('0x42')]?_0x2e5ed8[_0xe7ff('0x3f')]:_0x116447[_0xe7ff('0x3c')];_0x2e5ed8['order']=qs[_0xe7ff('0x46')](_0x2f9863[_0xe7ff('0x3d')][_0xe7ff('0x46')]);_0x2e5ed8[_0xe7ff('0x47')]=qs['filters'](_[_0xe7ff('0x48')](_0x2f9863[_0xe7ff('0x3d')],_0x116447[_0xe7ff('0x3e')]));if(_0x2f9863[_0xe7ff('0x3d')][_0xe7ff('0x49')]){_0x2e5ed8[_0xe7ff('0x47')]=_[_0xe7ff('0x4a')](_0x2e5ed8[_0xe7ff('0x47')],{'$or':_[_0xe7ff('0x37')](_0x2e5ed8['attributes'],function(_0x719915){var _0x2e736c={};_0x2e736c[_0x719915]={'$like':'%'+_0x2f9863[_0xe7ff('0x3d')]['filter']+'%'};return _0x2e736c;})});}_0x2e5ed8=_[_0xe7ff('0x4a')]({},_0x2e5ed8,_0x2f9863['options']);return _0x3b8a70[_0xe7ff('0xbd')](_0x2e5ed8);}})[_0xe7ff('0x1c')](function(_0x4f7a88){if(_0x4f7a88){_0x41a2e8=_0x4f7a88['length'];if(!_0x2f9863[_0xe7ff('0x3d')][_0xe7ff('0x43')](_0xe7ff('0x44'))){_0x2e5ed8[_0xe7ff('0x29')]=qs[_0xe7ff('0x29')](_0x2f9863[_0xe7ff('0x3d')][_0xe7ff('0x29')]);_0x2e5ed8[_0xe7ff('0x27')]=qs[_0xe7ff('0x27')](_0x2f9863[_0xe7ff('0x3d')][_0xe7ff('0x27')]);}return _0x3b8a70[_0xe7ff('0xbd')](_0x2e5ed8);}})[_0xe7ff('0x1c')](function(_0x229b69){if(_0x229b69){return _0x229b69?{'count':_0x41a2e8,'rows':_0x229b69}:null;}})[_0xe7ff('0x1c')](respondWithResult(_0x26339f,null))['catch'](handleError(_0x26339f,null));};exports[_0xe7ff('0xbe')]=function(_0x1f2eb1,_0x28e206,_0x101475){var _0x3d8329={'raw':![],'where':{}};var _0x1fd79e={};var _0x33f581={'count':0x0,'rows':[]};return db[_0xe7ff('0x38')]['findOne']({'where':{'id':_0x1f2eb1[_0xe7ff('0x50')]['id']}})['then'](handleEntityNotFound(_0x28e206,null))[_0xe7ff('0x1c')](function(_0x56d02c){if(_0x56d02c){_0x1fd79e[_0xe7ff('0x3c')]=_[_0xe7ff('0x51')](db[_0xe7ff('0x97')][_0xe7ff('0x39')]);_0x1fd79e[_0xe7ff('0x3d')]=_[_0xe7ff('0x51')](_0x1f2eb1[_0xe7ff('0x3d')]);_0x1fd79e['filters']=_[_0xe7ff('0x40')](_0x1fd79e[_0xe7ff('0x3c')],_0x1fd79e[_0xe7ff('0x3d')]);_0x3d8329[_0xe7ff('0x3f')]=_['intersection'](_0x1fd79e[_0xe7ff('0x3c')],qs['fields'](_0x1f2eb1[_0xe7ff('0x3d')][_0xe7ff('0x41')]));_0x3d8329[_0xe7ff('0x3f')]=_0x3d8329['attributes']['length']?_0x3d8329[_0xe7ff('0x3f')]:_0x1fd79e['model'];if(!_0x1f2eb1['query'][_0xe7ff('0x43')]('nolimit')){_0x3d8329[_0xe7ff('0x29')]=qs[_0xe7ff('0x29')](_0x1f2eb1[_0xe7ff('0x3d')][_0xe7ff('0x29')]);_0x3d8329[_0xe7ff('0x27')]=qs[_0xe7ff('0x27')](_0x1f2eb1[_0xe7ff('0x3d')]['offset']);}_0x3d8329[_0xe7ff('0x45')]=qs[_0xe7ff('0x46')](_0x1f2eb1[_0xe7ff('0x3d')]['sort']);_0x3d8329[_0xe7ff('0x47')]=qs[_0xe7ff('0x3e')](_[_0xe7ff('0x48')](_0x1f2eb1['query'],_0x1fd79e[_0xe7ff('0x3e')]));_0x3d8329['where'][_0xe7ff('0x5f')]=_0x56d02c['id'];if(_0x1f2eb1[_0xe7ff('0x3d')][_0xe7ff('0x49')]){_0x3d8329[_0xe7ff('0x47')]=_[_0xe7ff('0x4a')](_0x3d8329[_0xe7ff('0x47')],{'$or':_[_0xe7ff('0x37')](_0x3d8329[_0xe7ff('0x3f')],function(_0x293f85){var _0x39bca9={};_0x39bca9[_0x293f85]={'$like':'%'+_0x1f2eb1['query'][_0xe7ff('0x49')]+'%'};return _0x39bca9;})});}_0x3d8329=_[_0xe7ff('0x4a')]({},_0x3d8329,_0x1f2eb1[_0xe7ff('0x4b')]);return db['SmsInteraction'][_0xe7ff('0x2a')]({'where':_0x3d8329['where']})[_0xe7ff('0x1c')](function(_0x45a9df){_0x33f581['count']=_0x45a9df;if(_0x1f2eb1[_0xe7ff('0x3d')][_0xe7ff('0x4c')]){_0x3d8329[_0xe7ff('0x4d')]=[{'model':db['CmContact'],'as':_0xe7ff('0xbf'),'required':![]},{'model':db['User'],'as':_0xe7ff('0xc0'),'attributes':[_0xe7ff('0x32'),_0xe7ff('0xc1'),_0xe7ff('0xc2')],'required':![]},{'model':db[_0xe7ff('0xc3')],'as':_0xe7ff('0xc4'),'attributes':['id',_0xe7ff('0x32'),'color'],'where':_0x1f2eb1[_0xe7ff('0x3d')][_0xe7ff('0xc5')]?{'id':_0x1f2eb1[_0xe7ff('0x3d')][_0xe7ff('0xc5')]}:undefined,'required':_0x1f2eb1[_0xe7ff('0x3d')][_0xe7ff('0xc5')]?!![]:![]}];}return db[_0xe7ff('0x97')][_0xe7ff('0x4e')](_0x3d8329);})[_0xe7ff('0x1c')](function(_0x529c04){_0x33f581[_0xe7ff('0x4f')]=_0x529c04;return _0x33f581;});}})[_0xe7ff('0x1c')](respondWithFilteredResult(_0x28e206,_0x3d8329))[_0xe7ff('0x53')](handleError(_0x28e206,null));};exports[_0xe7ff('0x33')]=function(_0x2dd177,_0x34e88d,_0xf75768){var _0x4cea5e,_0x58adf9,_0x290e11;if(_['isNil'](_0x2dd177[_0xe7ff('0x55')][_0xe7ff('0x55')])||_0x2dd177['body'][_0xe7ff('0x55')]===''){throw new db[(_0xe7ff('0x6f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe7ff('0x88')](_0x2dd177[_0xe7ff('0x55')]['to'])){throw new db[(_0xe7ff('0x6f'))][(_0xe7ff('0x8a'))](_0xe7ff('0xc6'));}_0x4cea5e=_0x2dd177['body']['to'];return db[_0xe7ff('0x38')]['find']({'where':{'id':_0x2dd177[_0xe7ff('0x50')]['id']},'include':[{'model':db[_0xe7ff('0x90')],'as':_0xe7ff('0xc7'),'include':[{'model':db[_0xe7ff('0x91')],'as':'Contacts','where':{'mobile':_0x4cea5e},'limit':0x1,'order':[['updatedAt',_0xe7ff('0x93')]]}]}]})[_0xe7ff('0x1c')](handleEntityNotFound(_0x34e88d,null))['then'](function(_0x1676b8){if(_0x1676b8&&_0x1676b8[_0xe7ff('0xc7')]){_0x58adf9=_0x1676b8[_0xe7ff('0x57')]({'plain':!![]});if(_0x58adf9[_0xe7ff('0xc7')]&&_0x58adf9['List'][_0xe7ff('0x92')]['length']){return _0x58adf9[_0xe7ff('0xc7')][_0xe7ff('0x92')][0x0];}return db[_0xe7ff('0x91')][_0xe7ff('0x54')](_[_0xe7ff('0x16')](_0x2dd177[_0xe7ff('0x55')],{'firstName':_0x4cea5e,'mobile':_0x4cea5e,'phone':_0x4cea5e,'ListId':_0x58adf9['ListId']}));}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x34e88d,null))[_0xe7ff('0x1c')](function(_0x8cdb4e){if(_0x8cdb4e){_0x290e11=_0x8cdb4e;return db[_0xe7ff('0x97')][_0xe7ff('0x52')]({'where':{'ContactId':_0x290e11['id'],'closed':![],'SmsAccountId':_0x58adf9['id']}})[_0xe7ff('0x1c')](function(_0x50d827){if(_0x50d827){return[_0x50d827,![]];}return db[_0xe7ff('0x97')][_0xe7ff('0x54')]({'UserId':_0x2dd177[_0xe7ff('0x56')]['id'],'ContactId':_0x290e11['id'],'SmsAccountId':_0x58adf9['id'],'phone':_0x4cea5e,'firstMsgDirection':_0xe7ff('0xc8'),'Messages':[_[_0xe7ff('0x4a')](_0x2dd177[_0xe7ff('0x55')],{'read':![],'body':_0x2dd177[_0xe7ff('0x55')][_0xe7ff('0x55')],'phone':_0x4cea5e,'SmsAccountId':_0x58adf9['id'],'UserId':_0x2dd177[_0xe7ff('0x56')]['id'],'ContactId':_0x290e11['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xe7ff('0xc9')}]})[_0xe7ff('0x1c')](function(_0xaf5fa6){return[_0xaf5fa6,!![]];});});}})[_0xe7ff('0xca')](function(_0x4b8e13,_0x4e08ea){if(_0x4e08ea){return _0x4b8e13;}return db[_0xe7ff('0x9f')]['create'](_[_0xe7ff('0x4a')](_0x2dd177['body'],{'read':![],'body':_0x2dd177['body'][_0xe7ff('0x55')],'phone':_0x4cea5e,'SmsAccountId':_0x58adf9['id'],'SmsInteractionId':_0x4b8e13['id'],'UserId':_0x2dd177[_0xe7ff('0x56')]['id'],'ContactId':_0x290e11['id']}))[_0xe7ff('0x1c')](function(_0x8e2c2a){_0x4b8e13['dataValues'][_0xe7ff('0xc9')]=[];_0x4b8e13[_0xe7ff('0xcb')][_0xe7ff('0xc9')][_0xe7ff('0x9a')](_0x8e2c2a[_0xe7ff('0xcb')]);return _0x4b8e13;});})[_0xe7ff('0x1c')](respondWithResult(_0x34e88d,null))[_0xe7ff('0x53')](handleError(_0x34e88d,null));};exports[_0xe7ff('0x25')]=function(_0x2f404e,_0x3e13bc,_0x5d722b){if(_0x2f404e[_0xe7ff('0x55')]['id']){delete _0x2f404e['body']['id'];}var _0x43ffb8,_0x4faf3d,_0x38716c;return db['SmsAccount'][_0xe7ff('0x52')]({'where':{'id':_0x2f404e[_0xe7ff('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e13bc,null))[_0xe7ff('0x1c')](function(_0x3d205e){if(_0x3d205e){_0x38716c=_0x3d205e;logger[_0xe7ff('0xae')](_0xe7ff('0xac'),_0xe7ff('0x25'),_0xe7ff('0xcc'),_0x3d205e[_0xe7ff('0x3a')],util[_0xe7ff('0xcd')](_0x2f404e['body'],{'showHidden':![],'depth':null}));switch(_0x3d205e[_0xe7ff('0x3a')]){case'skebby':if(_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0xce')]&&_0x2f404e[_0xe7ff('0x55')]['status']){_0x4faf3d=_0x2f404e['body'][_0xe7ff('0x25')];return db[_0xe7ff('0x9f')][_0xe7ff('0x52')]({'where':{'messageId':_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0xce')]}});}break;case _0xe7ff('0xcf'):if(_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0xd0')]&&_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0xd1')]){_0x4faf3d=_0x2f404e['body']['statusInt'];return db[_0xe7ff('0x9f')]['find']({'where':{'messageId':_0x2f404e['body'][_0xe7ff('0xd0')]}});}break;case _0xe7ff('0xd2'):if(_0x2f404e[_0xe7ff('0x55')]['message_id']&&_0x2f404e['body'][_0xe7ff('0xd3')]){_0x4faf3d=_0x2f404e['body'][_0xe7ff('0xd3')];return db[_0xe7ff('0x9f')][_0xe7ff('0x52')]({'where':{'messageId':_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0x7d')]}});}break;case _0xe7ff('0xd4'):var _0x11439a=_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0x7f')][0x0];if(_0x11439a[_0xe7ff('0x78')]&&_0x11439a[_0xe7ff('0x25')]['groupName']===_0xe7ff('0xd5')){_0x4faf3d=_0x11439a[_0xe7ff('0x25')][_0xe7ff('0xd6')];return db[_0xe7ff('0x9f')][_0xe7ff('0x52')]({'where':{'messageId':_0x11439a[_0xe7ff('0x78')]}});}break;case _0xe7ff('0x82'):if(_0x2f404e['body']['messageId']&&_0x2f404e['body'][_0xe7ff('0x25')]){_0x4faf3d=_0x2f404e['body'][_0xe7ff('0x25')];return db['SmsMessage'][_0xe7ff('0x52')]({'where':{'messageId':_0x2f404e['body'][_0xe7ff('0x78')]}});}break;case _0xe7ff('0x85'):if(_0x2f404e[_0xe7ff('0x55')][0x0][_0xe7ff('0x1f')]['id']){_0x4faf3d=_0x2f404e[_0xe7ff('0x55')][0x0][_0xe7ff('0x3a')];return db[_0xe7ff('0x9f')][_0xe7ff('0x52')]({'where':{'messageId':_0x2f404e['body'][0x0][_0xe7ff('0x1f')]['id']}});}break;case _0xe7ff('0x86'):if(_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0xd7')]&&_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0x25')]){_0x4faf3d=_0x2f404e['body'][_0xe7ff('0x25')];return db[_0xe7ff('0x9f')][_0xe7ff('0x52')]({'where':{'messageId':_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0xd7')]}});}break;}}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x3e13bc,null))['then'](function(_0x21ad95){if(_0x21ad95){_0x43ffb8=_0x21ad95;switch(_0x38716c['type']){case _0xe7ff('0x7a'):if(_0x4faf3d===_0xe7ff('0xd5')){return _0x43ffb8[_0xe7ff('0x5c')]({'read':!![]});}else{logger[_0xe7ff('0x1e')](_0xe7ff('0xac'),_0xe7ff('0x25'),_0xe7ff('0x7a'),util[_0xe7ff('0xcd')](_0x2f404e[_0xe7ff('0x55')],{'showHidden':![],'depth':null}));}break;case _0xe7ff('0xcf'):if(_0x4faf3d==='1'){return _0x43ffb8[_0xe7ff('0x5c')]({'read':!![]});}else{logger[_0xe7ff('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe7ff('0x25'),'skebby',util[_0xe7ff('0xcd')](_0x2f404e[_0xe7ff('0x55')],{'showHidden':![],'depth':null}));}break;case _0xe7ff('0xd2'):if(!_0x2f404e[_0xe7ff('0x55')][_0xe7ff('0xd8')]&&_0x4faf3d>=0xc8&&_0x4faf3d<=0xce){return _0x43ffb8[_0xe7ff('0x5c')]({'read':!![]});}else{logger[_0xe7ff('0x1e')](_0xe7ff('0xac'),_0xe7ff('0x25'),_0xe7ff('0xd2'),util[_0xe7ff('0xcd')](_0x2f404e[_0xe7ff('0x55')],{'showHidden':![],'depth':null}));}break;case _0xe7ff('0xd4'):var _0x1f4f53=_0x2f404e['body'][_0xe7ff('0x7f')][0x0];if(_0x1f4f53[_0xe7ff('0x25')][_0xe7ff('0xd6')]===_0xe7ff('0xd5')){return _0x43ffb8[_0xe7ff('0x5c')]({'read':!![]});}else{logger[_0xe7ff('0x1e')](_0xe7ff('0xac'),_0xe7ff('0x25'),_0xe7ff('0xd4'),util[_0xe7ff('0xcd')](_0x2f404e['body'],{'showHidden':![],'depth':null}));}break;case _0xe7ff('0x82'):if(_0x4faf3d==_0xe7ff('0xd9')||_0x4faf3d==_0xe7ff('0xda')){return _0x43ffb8[_0xe7ff('0x5c')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe7ff('0x25'),_0xe7ff('0x82'),util[_0xe7ff('0xcd')](_0x2f404e['body'],{'showHidden':![],'depth':null}));}break;case _0xe7ff('0x85'):if(_0x4faf3d==_0xe7ff('0xdb')){return _0x43ffb8[_0xe7ff('0x5c')]({'read':!![]});}else{logger[_0xe7ff('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe7ff('0x25'),'bandwidth',util[_0xe7ff('0xcd')](_0x2f404e[_0xe7ff('0x55')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4faf3d===_0xe7ff('0xdc')||_0x4faf3d===_0xe7ff('0xdd')){return _0x43ffb8[_0xe7ff('0x5c')]({'read':!![]});}else{logger[_0xe7ff('0x1e')](_0xe7ff('0xac'),_0xe7ff('0x25'),'intelepeer',util[_0xe7ff('0xcd')](_0x2f404e[_0xe7ff('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x43ffb8;}})[_0xe7ff('0x1c')](respondWithResult(_0x3e13bc,null))[_0xe7ff('0x53')](handleError(_0x3e13bc,null));};exports[_0xe7ff('0xde')]=function(_0x3a63be,_0x44f5cc,_0x530118){var _0x109f00,_0xa6a711,_0x22a540;return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0x3a63be[_0xe7ff('0x50')]['id']}})['then'](handleEntityNotFound(_0x44f5cc,null))['then'](function(_0x346a4a){if(_0x346a4a){_0x22a540=_0x346a4a;logger[_0xe7ff('0xae')](_0xe7ff('0xac'),_0xe7ff('0x25'),_0xe7ff('0xcc'),_0x346a4a[_0xe7ff('0x3a')],util[_0xe7ff('0xcd')](_0x3a63be[_0xe7ff('0x3d')],{'showHidden':![],'depth':null}));switch(_0x346a4a[_0xe7ff('0x3a')]){case _0xe7ff('0x80'):if(_0x3a63be[_0xe7ff('0x3d')][_0xe7ff('0xdf')]&&_0x3a63be[_0xe7ff('0x3d')]['state']){_0xa6a711=_0x3a63be[_0xe7ff('0x3d')][_0xe7ff('0xe0')];return db['SmsMessage'][_0xe7ff('0x52')]({'where':{'messageId':_0x3a63be[_0xe7ff('0x3d')][_0xe7ff('0xdf')]}});}break;}}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x44f5cc,null))[_0xe7ff('0x1c')](function(_0x4f9c8d){if(_0x4f9c8d){_0x109f00=_0x4f9c8d;switch(_0x22a540[_0xe7ff('0x3a')]){case _0xe7ff('0x80'):if(_0xa6a711==='2'||_0xa6a711==='6'){return _0x109f00[_0xe7ff('0x5c')]({'read':!![]});}else{logger[_0xe7ff('0x1e')](_0xe7ff('0xac'),_0xe7ff('0x25'),'csc',util[_0xe7ff('0xcd')](_0x3a63be[_0xe7ff('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x109f00;}})[_0xe7ff('0x1c')](respondWithResult(_0x44f5cc,null))['catch'](handleError(_0x44f5cc,null));};exports[_0xe7ff('0xe1')]=function(_0x37857a,_0x2d20f2,_0x5c4b83){return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0x37857a[_0xe7ff('0x50')]['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x2d20f2,null))[_0xe7ff('0x1c')](function(_0x5d5a72){if(_0x5d5a72){return _0x5d5a72['addAgents'](_0x37857a[_0xe7ff('0x55')][_0xe7ff('0x62')],_[_0xe7ff('0x95')](_0x37857a['body'],[_0xe7ff('0x62'),'id'])||{})[_0xe7ff('0xca')](function(_0x1c360b){for(var _0x274309=0x0;_0x274309<_0x37857a[_0xe7ff('0x55')][_0xe7ff('0x62')][_0xe7ff('0x42')];_0x274309+=0x1){socket[_0xe7ff('0xe2')](_0xe7ff('0xe3'),{'UserId':Number(_0x37857a[_0xe7ff('0x55')][_0xe7ff('0x62')][_0x274309]),'SmsAccountId':Number(_0x37857a[_0xe7ff('0x50')]['id'])});}return _0x1c360b;});}})[_0xe7ff('0x1c')](respondWithResult(_0x2d20f2,null))[_0xe7ff('0x53')](handleError(_0x2d20f2,null));};exports[_0xe7ff('0xe4')]=function(_0x2b6a0d,_0x133132,_0x565372){return db[_0xe7ff('0x38')][_0xe7ff('0x52')]({'where':{'id':_0x2b6a0d[_0xe7ff('0x50')]['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x133132,null))['then'](function(_0x372c0c){if(_0x372c0c){return _0x372c0c[_0xe7ff('0xe4')](_0x2b6a0d['query'][_0xe7ff('0x62')])[_0xe7ff('0x1c')](function(){if(_[_0xe7ff('0xe5')](_0x2b6a0d[_0xe7ff('0x3d')][_0xe7ff('0x62')])){for(var _0x27a322=0x0;_0x27a322<_0x2b6a0d[_0xe7ff('0x3d')][_0xe7ff('0x62')]['length'];_0x27a322+=0x1){socket[_0xe7ff('0xe2')](_0xe7ff('0xe6'),{'UserId':Number(_0x2b6a0d[_0xe7ff('0x3d')][_0xe7ff('0x62')][_0x27a322]),'SmsAccountId':Number(_0x2b6a0d[_0xe7ff('0x50')]['id'])});}}else{socket[_0xe7ff('0xe2')](_0xe7ff('0xe6'),{'UserId':Number(_0x2b6a0d[_0xe7ff('0x3d')][_0xe7ff('0x62')]),'SmsAccountId':Number(_0x2b6a0d[_0xe7ff('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x133132,null))[_0xe7ff('0x53')](handleError(_0x133132,null));};exports['getAgents']=function(_0x59c65a,_0x1ea359,_0x1ba88c){var _0x54ff5e={};var _0x1ea9da={};var _0x636fcc;var _0x126990;return db[_0xe7ff('0x38')][_0xe7ff('0x65')]({'where':{'id':_0x59c65a['params']['id']}})[_0xe7ff('0x1c')](handleEntityNotFound(_0x1ea359,null))[_0xe7ff('0x1c')](function(_0x846f2c){if(_0x846f2c){_0x636fcc=_0x846f2c;_0x1ea9da[_0xe7ff('0x3c')]=_[_0xe7ff('0x51')](db['User'][_0xe7ff('0x39')]);_0x1ea9da['query']=_[_0xe7ff('0x51')](_0x59c65a[_0xe7ff('0x3d')]);_0x1ea9da[_0xe7ff('0x3e')]=_[_0xe7ff('0x40')](_0x1ea9da[_0xe7ff('0x3c')],_0x1ea9da[_0xe7ff('0x3d')]);_0x54ff5e[_0xe7ff('0x3f')]=_[_0xe7ff('0x40')](_0x1ea9da[_0xe7ff('0x3c')],qs['fields'](_0x59c65a[_0xe7ff('0x3d')][_0xe7ff('0x41')]));_0x54ff5e[_0xe7ff('0x3f')]=_0x54ff5e[_0xe7ff('0x3f')][_0xe7ff('0x42')]?_0x54ff5e[_0xe7ff('0x3f')]:_0x1ea9da[_0xe7ff('0x3c')];_0x54ff5e[_0xe7ff('0x45')]=qs['sort'](_0x59c65a[_0xe7ff('0x3d')][_0xe7ff('0x46')]);_0x54ff5e[_0xe7ff('0x47')]=qs[_0xe7ff('0x3e')](_[_0xe7ff('0x48')](_0x59c65a['query'],_0x1ea9da[_0xe7ff('0x3e')]));if(_0x59c65a[_0xe7ff('0x3d')][_0xe7ff('0x49')]){_0x54ff5e['where']=_[_0xe7ff('0x4a')](_0x54ff5e[_0xe7ff('0x47')],{'$or':_[_0xe7ff('0x37')](_0x54ff5e[_0xe7ff('0x3f')],function(_0x287555){var _0x401976={};_0x401976[_0x287555]={'$like':'%'+_0x59c65a[_0xe7ff('0x3d')][_0xe7ff('0x49')]+'%'};return _0x401976;})});}_0x54ff5e=_[_0xe7ff('0x4a')]({},_0x54ff5e,_0x59c65a[_0xe7ff('0x4b')]);return _0x636fcc[_0xe7ff('0xe7')](_0x54ff5e);}})[_0xe7ff('0x1c')](function(_0xbe687a){if(_0xbe687a){_0x126990=_0xbe687a[_0xe7ff('0x42')];if(!_0x59c65a[_0xe7ff('0x3d')][_0xe7ff('0x43')](_0xe7ff('0x44'))){_0x54ff5e['limit']=qs['limit'](_0x59c65a[_0xe7ff('0x3d')][_0xe7ff('0x29')]);_0x54ff5e[_0xe7ff('0x27')]=qs[_0xe7ff('0x27')](_0x59c65a[_0xe7ff('0x3d')][_0xe7ff('0x27')]);}return _0x636fcc[_0xe7ff('0xe7')](_0x54ff5e);}})[_0xe7ff('0x1c')](function(_0x15c099){if(_0x15c099){return _0x15c099?{'count':_0x126990,'rows':_0x15c099}:null;}})['then'](respondWithResult(_0x1ea359,null))['catch'](handleError(_0x1ea359,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d6cfd52..e790649 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 _0xebcc=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0xebcc,0x89));var _0xcebc=function(_0x49c06f,_0x26ff57){_0x49c06f=_0x49c06f-0x0;var _0x8ed240=_0xebcc[_0x49c06f];return _0x8ed240;};'use strict';var EventEmitter=require(_0xcebc('0x0'));var SmsAccount=require(_0xcebc('0x1'))['db'][_0xcebc('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xcebc('0x3')](0x0);var events={'afterCreate':_0xcebc('0x4'),'afterUpdate':'update','afterDestroy':_0xcebc('0x5')};function emitEvent(_0x48a417){return function(_0x14ef5a,_0x344cc6,_0x7dbdfa){SmsAccountEvents['emit'](_0x48a417+':'+_0x14ef5a['id'],_0x14ef5a);SmsAccountEvents[_0xcebc('0x6')](_0x48a417,_0x14ef5a);_0x7dbdfa(null);};}for(var e in events){if(events[_0xcebc('0x7')](e)){var event=events[e];SmsAccount[_0xcebc('0x8')](e,emitEvent(event));}}module[_0xcebc('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x5a6c=['SmsAccount','setMaxListeners','save','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x5a6c,0x17f));var _0xc5a6=function(_0x36f08c,_0x2aca5a){_0x36f08c=_0x36f08c-0x0;var _0xe9250b=_0x5a6c[_0x36f08c];return _0xe9250b;};'use strict';var EventEmitter=require(_0xc5a6('0x0'));var SmsAccount=require(_0xc5a6('0x1'))['db'][_0xc5a6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc5a6('0x3')](0x0);var events={'afterCreate':_0xc5a6('0x4'),'afterUpdate':'update','afterDestroy':_0xc5a6('0x5')};function emitEvent(_0x29c87d){return function(_0x495614,_0x65d330,_0x50bd40){SmsAccountEvents['emit'](_0x29c87d+':'+_0x495614['id'],_0x495614);SmsAccountEvents['emit'](_0x29c87d,_0x495614);_0x50bd40(null);};}for(var e in events){if(events[_0xc5a6('0x6')](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 8f4ba0f..a8242dd 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 _0x1db9=['util','../../config/logger','api','moment','bluebird','request-promise','path','define','sms_accounts','lodash'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x1db9,0x12b));var _0x91db=function(_0x38eba4,_0x28b0de){_0x38eba4=_0x38eba4-0x0;var _0x25eba4=_0x1db9[_0x38eba4];return _0x25eba4;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require(_0x91db('0x6'));var fs=require('fs');var path=require(_0x91db('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x5cc562,_0x2e2f2c){return _0x5cc562[_0x91db('0x8')]('SmsAccount',attributes,{'tableName':_0x91db('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cad=['./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x4cad,0x1a9));var _0xd4ca=function(_0x14d64b,_0x1b4e94){_0x14d64b=_0x14d64b-0x0;var _0x5cec8a=_0x4cad[_0x14d64b];return _0x5cec8a;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var logger=require(_0xd4ca('0x2'))(_0xd4ca('0x3'));var moment=require(_0xd4ca('0x4'));var BPromise=require(_0xd4ca('0x5'));var rp=require(_0xd4ca('0x6'));var fs=require('fs');var path=require(_0xd4ca('0x7'));var rimraf=require(_0xd4ca('0x8'));var config=require(_0xd4ca('0x9'));var attributes=require(_0xd4ca('0xa'));module[_0xd4ca('0xb')]=function(_0xc0d040,_0x261dca){return _0xc0d040[_0xd4ca('0xc')](_0xd4ca('0xd'),attributes,{'tableName':_0xd4ca('0xe'),'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 fd1adc5..6a7267b 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 _0xe38a=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','model','include','map','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request'];(function(_0x146dc2,_0x31644f){var _0x3adb0c=function(_0x59b5ab){while(--_0x59b5ab){_0x146dc2['push'](_0x146dc2['shift']());}};_0x3adb0c(++_0x31644f);}(_0xe38a,0x162));var _0xae38=function(_0xb54b31,_0x4ac97c){_0xb54b31=_0xb54b31-0x0;var _0x49d88b=_0xe38a[_0xb54b31];return _0x49d88b;};'use strict';var _=require(_0xae38('0x0'));var util=require('util');var moment=require(_0xae38('0x1'));var BPromise=require(_0xae38('0x2'));var rs=require(_0xae38('0x3'));var fs=require('fs');var Redis=require(_0xae38('0x4'));var db=require(_0xae38('0x5'))['db'];var utils=require(_0xae38('0x6'));var logger=require('../../config/logger')(_0xae38('0x7'));var config=require(_0xae38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae38('0x9')]['http']({'port':0x232a});config[_0xae38('0xa')]=_[_0xae38('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae38('0xc'))(new Redis(config['redis']));require(_0xae38('0xd'))[_0xae38('0xe')](socket);function respondWithRpcPromise(_0x3a6578,_0x574236,_0x497e29){return new BPromise(function(_0x22331f,_0x507ee3){return client[_0xae38('0xf')](_0x3a6578,_0x497e29)['then'](function(_0x37c6fb){logger[_0xae38('0x10')](_0xae38('0x11'),_0x574236,_0xae38('0x12'));logger[_0xae38('0x13')](_0xae38('0x14'),_0x574236,_0xae38('0x12'),JSON[_0xae38('0x15')](_0x37c6fb));if(_0x37c6fb[_0xae38('0x16')]){if(_0x37c6fb[_0xae38('0x16')][_0xae38('0x17')]===0x1f4){logger['error'](_0xae38('0x11'),_0x574236,_0x37c6fb['error'][_0xae38('0x18')]);return _0x507ee3(_0x37c6fb['error'][_0xae38('0x18')]);}logger['error'](_0xae38('0x11'),_0x574236,_0x37c6fb[_0xae38('0x16')][_0xae38('0x18')]);return _0x22331f(_0x37c6fb[_0xae38('0x16')][_0xae38('0x18')]);}else{logger[_0xae38('0x10')](_0xae38('0x11'),_0x574236,_0xae38('0x12'));_0x22331f(_0x37c6fb[_0xae38('0x19')][_0xae38('0x18')]);}})[_0xae38('0x1a')](function(_0x174991){logger['error'](_0xae38('0x11'),_0x574236,_0x174991);_0x507ee3(_0x174991);});});}exports[_0xae38('0x1b')]=function(_0x3fe914){var _0x36d7e9=this;return new Promise(function(_0x40e4c3,_0x5ba649){return db['SmsAccount'][_0xae38('0x1c')]({'raw':_0x3fe914[_0xae38('0x1d')]?_0x3fe914[_0xae38('0x1d')][_0xae38('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fe914[_0xae38('0x1d')]?_0x3fe914[_0xae38('0x1d')][_0xae38('0x1f')]||null:null,'attributes':_0x3fe914[_0xae38('0x1d')]?_0x3fe914['options'][_0xae38('0x20')]||null:null,'include':_0x3fe914[_0xae38('0x1d')]?_0x3fe914[_0xae38('0x1d')]['include']?_['map'](_0x3fe914['options']['include'],function(_0x20994a){return{'model':db[_0x20994a[_0xae38('0x21')]],'as':_0x20994a['as'],'attributes':_0x20994a['attributes'],'include':_0x20994a[_0xae38('0x22')]?_[_0xae38('0x23')](_0x20994a[_0xae38('0x22')],function(_0x14544d){return{'model':db[_0x14544d['model']],'as':_0x14544d['as'],'attributes':_0x14544d['attributes'],'include':_0x14544d['include']?_[_0xae38('0x23')](_0x14544d[_0xae38('0x22')],function(_0x53b14f){return{'model':db[_0x53b14f['model']],'as':_0x53b14f['as'],'attributes':_0x53b14f[_0xae38('0x20')]};}):[]};}):[]};}):[]:[]})[_0xae38('0x24')](function(_0x2fded0){logger['info'](_0xae38('0x1b'),_0x3fe914);logger['debug'](_0xae38('0x1b'),_0x3fe914,JSON[_0xae38('0x15')](_0x2fded0));_0x40e4c3(_0x2fded0);})[_0xae38('0x1a')](function(_0x519227){logger[_0xae38('0x16')](_0xae38('0x1b'),_0x519227[_0xae38('0x18')],_0x3fe914);_0x5ba649(_0x36d7e9[_0xae38('0x16')](0x1f4,_0x519227[_0xae38('0x18')]));});});}; \ No newline at end of file +var _0x8f6c=['options','raw','attributes','include','map','model','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSmsAccount','SmsAccount','find'];(function(_0x56381a,_0x195018){var _0x876bbe=function(_0x5aa29c){while(--_0x5aa29c){_0x56381a['push'](_0x56381a['shift']());}};_0x876bbe(++_0x195018);}(_0x8f6c,0x18e));var _0xc8f6=function(_0x1173fd,_0x5afe4e){_0x1173fd=_0x1173fd-0x0;var _0x5a785b=_0x8f6c[_0x1173fd];return _0x5a785b;};'use strict';var _=require(_0xc8f6('0x0'));var util=require(_0xc8f6('0x1'));var moment=require(_0xc8f6('0x2'));var BPromise=require(_0xc8f6('0x3'));var rs=require(_0xc8f6('0x4'));var fs=require('fs');var Redis=require(_0xc8f6('0x5'));var db=require(_0xc8f6('0x6'))['db'];var utils=require(_0xc8f6('0x7'));var logger=require(_0xc8f6('0x8'))('rpc');var config=require(_0xc8f6('0x9'));var jayson=require(_0xc8f6('0xa'));var client=jayson[_0xc8f6('0xb')][_0xc8f6('0xc')]({'port':0x232a});config[_0xc8f6('0xd')]=_['defaults'](config[_0xc8f6('0xd')],{'host':_0xc8f6('0xe'),'port':0x18eb});var socket=require(_0xc8f6('0xf'))(new Redis(config[_0xc8f6('0xd')]));require(_0xc8f6('0x10'))[_0xc8f6('0x11')](socket);function respondWithRpcPromise(_0x516520,_0x11bc65,_0x17f759){return new BPromise(function(_0x56d2ee,_0x4d1e68){return client[_0xc8f6('0x12')](_0x516520,_0x17f759)['then'](function(_0x32024b){logger['info'](_0xc8f6('0x13'),_0x11bc65,_0xc8f6('0x14'));logger[_0xc8f6('0x15')](_0xc8f6('0x16'),_0x11bc65,_0xc8f6('0x14'),JSON['stringify'](_0x32024b));if(_0x32024b['error']){if(_0x32024b[_0xc8f6('0x17')][_0xc8f6('0x18')]===0x1f4){logger['error'](_0xc8f6('0x13'),_0x11bc65,_0x32024b['error'][_0xc8f6('0x19')]);return _0x4d1e68(_0x32024b['error'][_0xc8f6('0x19')]);}logger[_0xc8f6('0x17')](_0xc8f6('0x13'),_0x11bc65,_0x32024b[_0xc8f6('0x17')]['message']);return _0x56d2ee(_0x32024b[_0xc8f6('0x17')]['message']);}else{logger[_0xc8f6('0x1a')](_0xc8f6('0x13'),_0x11bc65,_0xc8f6('0x14'));_0x56d2ee(_0x32024b['result'][_0xc8f6('0x19')]);}})[_0xc8f6('0x1b')](function(_0x15b4a4){logger['error'](_0xc8f6('0x13'),_0x11bc65,_0x15b4a4);_0x4d1e68(_0x15b4a4);});});}exports[_0xc8f6('0x1c')]=function(_0x178a99){var _0xb1ed8b=this;return new Promise(function(_0x1732b3,_0x3840e9){return db[_0xc8f6('0x1d')][_0xc8f6('0x1e')]({'raw':_0x178a99[_0xc8f6('0x1f')]?_0x178a99[_0xc8f6('0x1f')][_0xc8f6('0x20')]===undefined?!![]:![]:!![],'where':_0x178a99[_0xc8f6('0x1f')]?_0x178a99['options']['where']||null:null,'attributes':_0x178a99['options']?_0x178a99[_0xc8f6('0x1f')][_0xc8f6('0x21')]||null:null,'include':_0x178a99[_0xc8f6('0x1f')]?_0x178a99['options'][_0xc8f6('0x22')]?_[_0xc8f6('0x23')](_0x178a99[_0xc8f6('0x1f')][_0xc8f6('0x22')],function(_0x26395b){return{'model':db[_0x26395b[_0xc8f6('0x24')]],'as':_0x26395b['as'],'attributes':_0x26395b[_0xc8f6('0x21')],'include':_0x26395b[_0xc8f6('0x22')]?_['map'](_0x26395b[_0xc8f6('0x22')],function(_0x2c590f){return{'model':db[_0x2c590f[_0xc8f6('0x24')]],'as':_0x2c590f['as'],'attributes':_0x2c590f[_0xc8f6('0x21')],'include':_0x2c590f[_0xc8f6('0x22')]?_[_0xc8f6('0x23')](_0x2c590f[_0xc8f6('0x22')],function(_0x55b7ea){return{'model':db[_0x55b7ea[_0xc8f6('0x24')]],'as':_0x55b7ea['as'],'attributes':_0x55b7ea[_0xc8f6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc8f6('0x25')](function(_0x48b6bc){logger[_0xc8f6('0x1a')](_0xc8f6('0x1c'),_0x178a99);logger['debug'](_0xc8f6('0x1c'),_0x178a99,JSON[_0xc8f6('0x26')](_0x48b6bc));_0x1732b3(_0x48b6bc);})[_0xc8f6('0x1b')](function(_0x585ca1){logger[_0xc8f6('0x17')](_0xc8f6('0x1c'),_0x585ca1[_0xc8f6('0x19')],_0x178a99);_0x3840e9(_0xb1ed8b[_0xc8f6('0x17')](0x1f4,_0x585ca1[_0xc8f6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a5d2c82..3ef250e 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 d02f14d..d28b727 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x5194b3,_0x1fc235){var _0x32e645=function(_0x536d47){while(--_0x536d47){_0x5194b3['push'](_0x5194b3['shift']());}};_0x32e645(++_0x1fc235);}(_0x55ca,0x126));var _0xa55c=function(_0x52c8e8,_0x5ee20d){_0x52c8e8=_0x52c8e8-0x0;var _0x31bb1a=_0x55ca[_0x52c8e8];return _0x31bb1a;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6e65bb7..609d439 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 _0x4245=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x3a7738,_0x441480){var _0x2af3e6=function(_0x3f6029){while(--_0x3f6029){_0x3a7738['push'](_0x3a7738['shift']());}};_0x2af3e6(++_0x441480);}(_0x4245,0x103));var _0x5424=function(_0x1b0784,_0x17f0a5){_0x1b0784=_0x1b0784-0x0;var _0x4696b3=_0x4245[_0x1b0784];return _0x4696b3;};'use strict';var Sequelize=require(_0x5424('0x0'));module[_0x5424('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5424('0x2')],'allowNull':![],'defaultValue':_0x5424('0x3')},'appdata':{'type':Sequelize[_0x5424('0x4')]()},'description':{'type':Sequelize[_0x5424('0x2')]},'interval':{'type':Sequelize[_0x5424('0x2')],'defaultValue':_0x5424('0x5')}}; \ No newline at end of file +var _0xb506=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb506,0x10c));var _0x6b50=function(_0x1fe414,_0x4c073d){_0x1fe414=_0x1fe414-0x0;var _0x336943=_0xb506[_0x1fe414];return _0x336943;};'use strict';var Sequelize=require(_0x6b50('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6b50('0x1')],'allowNull':![],'defaultValue':_0x6b50('0x2')},'appdata':{'type':Sequelize[_0x6b50('0x3')]()},'description':{'type':Sequelize[_0x6b50('0x1')]},'interval':{'type':Sequelize[_0x6b50('0x1')],'defaultValue':_0x6b50('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a87be18..0b97145 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 _0xb7a3=['create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','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','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0xa6d252,_0xf664a8){var _0x498d25=function(_0x2b83d8){while(--_0x2b83d8){_0xa6d252['push'](_0xa6d252['shift']());}};_0x498d25(++_0xf664a8);}(_0xb7a3,0x179));var _0x3b7a=function(_0x2953f3,_0xc3c64a){_0x2953f3=_0x2953f3-0x0;var _0x481c97=_0xb7a3[_0x2953f3];return _0x481c97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b7a('0x0'));var zipdir=require(_0x3b7a('0x1'));var jsonpatch=require(_0x3b7a('0x2'));var rp=require(_0x3b7a('0x3'));var moment=require(_0x3b7a('0x4'));var BPromise=require(_0x3b7a('0x5'));var Mustache=require('mustache');var util=require(_0x3b7a('0x6'));var path=require(_0x3b7a('0x7'));var sox=require(_0x3b7a('0x8'));var csv=require('to-csv');var ejs=require(_0x3b7a('0x9'));var fs=require('fs');var fs_extra=require(_0x3b7a('0xa'));var _=require('lodash');var squel=require(_0x3b7a('0xb'));var crypto=require(_0x3b7a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3b7a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3b7a('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b7a('0xf'));var authService=require(_0x3b7a('0x10'));var qs=require(_0x3b7a('0x11'));var as=require(_0x3b7a('0x12'));var hardwareService=require(_0x3b7a('0x13'));var logger=require(_0x3b7a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3b7a('0x15'));var licenseUtil=require(_0x3b7a('0x16'));var db=require(_0x3b7a('0x17'))['db'];function respondWithStatusCode(_0x2f30b8,_0x1d87be){_0x1d87be=_0x1d87be||0xcc;return function(_0xa5ba05){if(_0xa5ba05){return _0x2f30b8[_0x3b7a('0x18')](_0x1d87be);}return _0x2f30b8[_0x3b7a('0x19')](_0x1d87be)[_0x3b7a('0x1a')]();};}function respondWithResult(_0x32afac,_0x27a7de){_0x27a7de=_0x27a7de||0xc8;return function(_0x3f8cc5){if(_0x3f8cc5){return _0x32afac[_0x3b7a('0x19')](_0x27a7de)[_0x3b7a('0x1b')](_0x3f8cc5);}};}function respondWithFilteredResult(_0x4c3bee,_0x2ec1f0){return function(_0x5ace91){if(_0x5ace91){var _0x346240=typeof _0x2ec1f0[_0x3b7a('0x1c')]==='undefined'&&typeof _0x2ec1f0[_0x3b7a('0x1d')]===_0x3b7a('0x1e');var _0x2070be=_0x5ace91[_0x3b7a('0x1f')];var _0x4da178=_0x346240?0x0:_0x2ec1f0['offset'];var _0x400513=_0x346240?_0x5ace91[_0x3b7a('0x1f')]:_0x2ec1f0[_0x3b7a('0x1c')]+_0x2ec1f0['limit'];var _0x470d8d;if(_0x400513>=_0x2070be){_0x400513=_0x2070be;_0x470d8d=0xc8;}else{_0x470d8d=0xce;}_0x4c3bee['status'](_0x470d8d);return _0x4c3bee[_0x3b7a('0x20')](_0x3b7a('0x21'),_0x4da178+'-'+_0x400513+'/'+_0x2070be)[_0x3b7a('0x1b')](_0x5ace91);}return null;};}function patchUpdates(_0x52cddf){return function(_0xdec262){try{jsonpatch[_0x3b7a('0x22')](_0xdec262,_0x52cddf,!![]);}catch(_0x39013b){return BPromise['reject'](_0x39013b);}return _0xdec262['save']();};}function saveUpdates(_0x20622a,_0x52c10e){return function(_0x13b908){if(_0x13b908){return _0x13b908[_0x3b7a('0x23')](_0x20622a)[_0x3b7a('0x24')](function(_0x196815){return _0x196815;});}return null;};}function removeEntity(_0xef0122,_0x34b486){return function(_0x11c1b4){if(_0x11c1b4){return _0x11c1b4['destroy']()[_0x3b7a('0x24')](function(){_0xef0122[_0x3b7a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1512c1,_0x17f22a){return function(_0x24c483){if(!_0x24c483){_0x1512c1[_0x3b7a('0x18')](0x194);}return _0x24c483;};}function handleError(_0x3ac63e,_0x57ed40){_0x57ed40=_0x57ed40||0x1f4;return function(_0xee057a){logger[_0x3b7a('0x25')](_0xee057a[_0x3b7a('0x26')]);if(_0xee057a['name']){delete _0xee057a[_0x3b7a('0x27')];}_0x3ac63e['status'](_0x57ed40)[_0x3b7a('0x28')](_0xee057a);};}exports[_0x3b7a('0x29')]=function(_0x39014f,_0x3405e3){var _0x540513={},_0x57b00f={},_0x46e8d4={'count':0x0,'rows':[]};var _0x1b3da9=_[_0x3b7a('0x2a')](db[_0x3b7a('0x2b')][_0x3b7a('0x2c')],function(_0x1066e7){return{'name':_0x1066e7[_0x3b7a('0x2d')],'type':_0x1066e7[_0x3b7a('0x2e')][_0x3b7a('0x2f')]};});_0x57b00f[_0x3b7a('0x30')]=_[_0x3b7a('0x2a')](_0x1b3da9,_0x3b7a('0x27'));_0x57b00f[_0x3b7a('0x31')]=_[_0x3b7a('0x32')](_0x39014f[_0x3b7a('0x31')]);_0x57b00f[_0x3b7a('0x33')]=_[_0x3b7a('0x34')](_0x57b00f[_0x3b7a('0x30')],_0x57b00f['query']);_0x540513['attributes']=_[_0x3b7a('0x34')](_0x57b00f['model'],qs['fields'](_0x39014f[_0x3b7a('0x31')][_0x3b7a('0x35')]));_0x540513[_0x3b7a('0x36')]=_0x540513[_0x3b7a('0x36')][_0x3b7a('0x37')]?_0x540513[_0x3b7a('0x36')]:_0x57b00f[_0x3b7a('0x30')];if(!_0x39014f['query'][_0x3b7a('0x38')](_0x3b7a('0x39'))){_0x540513[_0x3b7a('0x1d')]=qs[_0x3b7a('0x1d')](_0x39014f[_0x3b7a('0x31')][_0x3b7a('0x1d')]);_0x540513[_0x3b7a('0x1c')]=qs[_0x3b7a('0x1c')](_0x39014f[_0x3b7a('0x31')][_0x3b7a('0x1c')]);}_0x540513[_0x3b7a('0x3a')]=qs['sort'](_0x39014f[_0x3b7a('0x31')][_0x3b7a('0x3b')]);_0x540513[_0x3b7a('0x3c')]=qs['filters'](_[_0x3b7a('0x3d')](_0x39014f[_0x3b7a('0x31')],_0x57b00f[_0x3b7a('0x33')]),_0x1b3da9);if(_0x39014f[_0x3b7a('0x31')]['filter']){_0x540513[_0x3b7a('0x3c')]=_[_0x3b7a('0x3e')](_0x540513['where'],{'$or':_[_0x3b7a('0x2a')](_0x1b3da9,function(_0xe5af4f){if(_0xe5af4f[_0x3b7a('0x2e')]!=='VIRTUAL'){var _0x11acbf={};_0x11acbf[_0xe5af4f[_0x3b7a('0x27')]]={'$like':'%'+_0x39014f['query'][_0x3b7a('0x3f')]+'%'};return _0x11acbf;}})});}_0x540513=_[_0x3b7a('0x3e')]({},_0x540513,_0x39014f[_0x3b7a('0x40')]);var _0x2d4c42={'where':_0x540513['where']};return db[_0x3b7a('0x2b')]['count'](_0x2d4c42)['then'](function(_0x386d12){_0x46e8d4['count']=_0x386d12;if(_0x39014f[_0x3b7a('0x31')][_0x3b7a('0x41')]){_0x540513[_0x3b7a('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x3b7a('0x43')](_0x540513);})[_0x3b7a('0x24')](function(_0x4abe92){_0x46e8d4[_0x3b7a('0x44')]=_0x4abe92;return _0x46e8d4;})[_0x3b7a('0x24')](respondWithFilteredResult(_0x3405e3,_0x540513))[_0x3b7a('0x45')](handleError(_0x3405e3,null));};exports[_0x3b7a('0x46')]=function(_0x38ef76,_0x187076){var _0x1b2108={'raw':!![],'where':{'id':_0x38ef76[_0x3b7a('0x47')]['id']}},_0x53b7e9={};_0x53b7e9[_0x3b7a('0x30')]=_[_0x3b7a('0x32')](db[_0x3b7a('0x2b')][_0x3b7a('0x2c')]);_0x53b7e9[_0x3b7a('0x31')]=_[_0x3b7a('0x32')](_0x38ef76[_0x3b7a('0x31')]);_0x53b7e9[_0x3b7a('0x33')]=_[_0x3b7a('0x34')](_0x53b7e9[_0x3b7a('0x30')],_0x53b7e9[_0x3b7a('0x31')]);_0x1b2108[_0x3b7a('0x36')]=_[_0x3b7a('0x34')](_0x53b7e9['model'],qs['fields'](_0x38ef76[_0x3b7a('0x31')]['fields']));_0x1b2108[_0x3b7a('0x36')]=_0x1b2108[_0x3b7a('0x36')][_0x3b7a('0x37')]?_0x1b2108[_0x3b7a('0x36')]:_0x53b7e9['model'];if(_0x38ef76[_0x3b7a('0x31')][_0x3b7a('0x41')]){_0x1b2108[_0x3b7a('0x42')]=[{'all':!![]}];}_0x1b2108=_[_0x3b7a('0x3e')]({},_0x1b2108,_0x38ef76[_0x3b7a('0x40')]);return db[_0x3b7a('0x2b')][_0x3b7a('0x48')](_0x1b2108)[_0x3b7a('0x24')](handleEntityNotFound(_0x187076,null))['then'](respondWithResult(_0x187076,null))[_0x3b7a('0x45')](handleError(_0x187076,null));};exports[_0x3b7a('0x49')]=function(_0x41e79c,_0x553614){return db[_0x3b7a('0x2b')][_0x3b7a('0x49')](_0x41e79c['body'],{})[_0x3b7a('0x24')](respondWithResult(_0x553614,0xc9))['catch'](handleError(_0x553614,null));};exports[_0x3b7a('0x23')]=function(_0x56be05,_0x2fc5c2){if(_0x56be05[_0x3b7a('0x4a')]['id']){delete _0x56be05[_0x3b7a('0x4a')]['id'];}return db[_0x3b7a('0x2b')][_0x3b7a('0x48')]({'where':{'id':_0x56be05[_0x3b7a('0x47')]['id']}})[_0x3b7a('0x24')](handleEntityNotFound(_0x2fc5c2,null))[_0x3b7a('0x24')](saveUpdates(_0x56be05[_0x3b7a('0x4a')],null))[_0x3b7a('0x24')](respondWithResult(_0x2fc5c2,null))[_0x3b7a('0x45')](handleError(_0x2fc5c2,null));};exports['destroy']=function(_0x271b26,_0x769b68){return db[_0x3b7a('0x2b')][_0x3b7a('0x48')]({'where':{'id':_0x271b26[_0x3b7a('0x47')]['id']}})[_0x3b7a('0x24')](handleEntityNotFound(_0x769b68,null))[_0x3b7a('0x24')](removeEntity(_0x769b68,null))['catch'](handleError(_0x769b68,null));}; \ No newline at end of file +var _0x6331=['findAll','rows','catch','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','SmsApplication','includeAll','include'];(function(_0x2350dd,_0x4272a8){var _0xdd28dc=function(_0x30ac88){while(--_0x30ac88){_0x2350dd['push'](_0x2350dd['shift']());}};_0xdd28dc(++_0x4272a8);}(_0x6331,0x9c));var _0x1633=function(_0x35f5a6,_0x12926e){_0x35f5a6=_0x35f5a6-0x0;var _0x334ffb=_0x6331[_0x35f5a6];return _0x334ffb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1633('0x0'));var zipdir=require(_0x1633('0x1'));var jsonpatch=require(_0x1633('0x2'));var rp=require(_0x1633('0x3'));var moment=require(_0x1633('0x4'));var BPromise=require(_0x1633('0x5'));var Mustache=require(_0x1633('0x6'));var util=require('util');var path=require(_0x1633('0x7'));var sox=require(_0x1633('0x8'));var csv=require(_0x1633('0x9'));var ejs=require(_0x1633('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1633('0xb'));var squel=require(_0x1633('0xc'));var crypto=require(_0x1633('0xd'));var jsforce=require(_0x1633('0xe'));var deskjs=require(_0x1633('0xf'));var toCsv=require(_0x1633('0x9'));var querystring=require(_0x1633('0x10'));var Papa=require(_0x1633('0x11'));var Redis=require(_0x1633('0x12'));var authService=require(_0x1633('0x13'));var qs=require(_0x1633('0x14'));var as=require(_0x1633('0x15'));var hardwareService=require(_0x1633('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1633('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1633('0x18'))['db'];function respondWithStatusCode(_0x2fdcad,_0x129d7e){_0x129d7e=_0x129d7e||0xcc;return function(_0x3f7a16){if(_0x3f7a16){return _0x2fdcad['sendStatus'](_0x129d7e);}return _0x2fdcad[_0x1633('0x19')](_0x129d7e)[_0x1633('0x1a')]();};}function respondWithResult(_0xe88396,_0x2ab93e){_0x2ab93e=_0x2ab93e||0xc8;return function(_0x1c6514){if(_0x1c6514){return _0xe88396[_0x1633('0x19')](_0x2ab93e)[_0x1633('0x1b')](_0x1c6514);}};}function respondWithFilteredResult(_0x22971d,_0x55fed1){return function(_0x1e8fa2){if(_0x1e8fa2){var _0x2ecdb9=typeof _0x55fed1[_0x1633('0x1c')]===_0x1633('0x1d')&&typeof _0x55fed1[_0x1633('0x1e')]==='undefined';var _0x420d66=_0x1e8fa2['count'];var _0x1a352d=_0x2ecdb9?0x0:_0x55fed1[_0x1633('0x1c')];var _0x5b7cf1=_0x2ecdb9?_0x1e8fa2[_0x1633('0x1f')]:_0x55fed1[_0x1633('0x1c')]+_0x55fed1[_0x1633('0x1e')];var _0x23f16a;if(_0x5b7cf1>=_0x420d66){_0x5b7cf1=_0x420d66;_0x23f16a=0xc8;}else{_0x23f16a=0xce;}_0x22971d[_0x1633('0x19')](_0x23f16a);return _0x22971d[_0x1633('0x20')](_0x1633('0x21'),_0x1a352d+'-'+_0x5b7cf1+'/'+_0x420d66)[_0x1633('0x1b')](_0x1e8fa2);}return null;};}function patchUpdates(_0xc7e2bd){return function(_0x1fdc7f){try{jsonpatch[_0x1633('0x22')](_0x1fdc7f,_0xc7e2bd,!![]);}catch(_0x2821b5){return BPromise[_0x1633('0x23')](_0x2821b5);}return _0x1fdc7f[_0x1633('0x24')]();};}function saveUpdates(_0x335c10,_0x1d4ec1){return function(_0x50a0c9){if(_0x50a0c9){return _0x50a0c9['update'](_0x335c10)[_0x1633('0x25')](function(_0x3504c9){return _0x3504c9;});}return null;};}function removeEntity(_0xe0f461,_0x529047){return function(_0x40235){if(_0x40235){return _0x40235['destroy']()[_0x1633('0x25')](function(){_0xe0f461[_0x1633('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x425cc9,_0x3393df){return function(_0x332366){if(!_0x332366){_0x425cc9[_0x1633('0x26')](0x194);}return _0x332366;};}function handleError(_0x20e6f6,_0x5d1389){_0x5d1389=_0x5d1389||0x1f4;return function(_0x1b2f6b){logger[_0x1633('0x27')](_0x1b2f6b[_0x1633('0x28')]);if(_0x1b2f6b['name']){delete _0x1b2f6b[_0x1633('0x29')];}_0x20e6f6[_0x1633('0x19')](_0x5d1389)[_0x1633('0x2a')](_0x1b2f6b);};}exports[_0x1633('0x2b')]=function(_0x263179,_0x555bb6){var _0x3e2062={},_0x1dc379={},_0x1998ad={'count':0x0,'rows':[]};var _0xf72687=_[_0x1633('0x2c')](db['SmsApplication'][_0x1633('0x2d')],function(_0x57bd53){return{'name':_0x57bd53[_0x1633('0x2e')],'type':_0x57bd53[_0x1633('0x2f')]['key']};});_0x1dc379[_0x1633('0x30')]=_[_0x1633('0x2c')](_0xf72687,'name');_0x1dc379['query']=_[_0x1633('0x31')](_0x263179[_0x1633('0x32')]);_0x1dc379['filters']=_['intersection'](_0x1dc379[_0x1633('0x30')],_0x1dc379[_0x1633('0x32')]);_0x3e2062[_0x1633('0x33')]=_[_0x1633('0x34')](_0x1dc379[_0x1633('0x30')],qs[_0x1633('0x35')](_0x263179['query'][_0x1633('0x35')]));_0x3e2062[_0x1633('0x33')]=_0x3e2062[_0x1633('0x33')][_0x1633('0x36')]?_0x3e2062[_0x1633('0x33')]:_0x1dc379[_0x1633('0x30')];if(!_0x263179[_0x1633('0x32')][_0x1633('0x37')](_0x1633('0x38'))){_0x3e2062[_0x1633('0x1e')]=qs[_0x1633('0x1e')](_0x263179[_0x1633('0x32')][_0x1633('0x1e')]);_0x3e2062[_0x1633('0x1c')]=qs['offset'](_0x263179[_0x1633('0x32')]['offset']);}_0x3e2062['order']=qs['sort'](_0x263179[_0x1633('0x32')][_0x1633('0x39')]);_0x3e2062[_0x1633('0x3a')]=qs[_0x1633('0x3b')](_['pick'](_0x263179[_0x1633('0x32')],_0x1dc379[_0x1633('0x3b')]),_0xf72687);if(_0x263179['query'][_0x1633('0x3c')]){_0x3e2062[_0x1633('0x3a')]=_['merge'](_0x3e2062['where'],{'$or':_[_0x1633('0x2c')](_0xf72687,function(_0x18071d){if(_0x18071d[_0x1633('0x2f')]!=='VIRTUAL'){var _0x45ce57={};_0x45ce57[_0x18071d[_0x1633('0x29')]]={'$like':'%'+_0x263179['query'][_0x1633('0x3c')]+'%'};return _0x45ce57;}})});}_0x3e2062=_[_0x1633('0x3d')]({},_0x3e2062,_0x263179[_0x1633('0x3e')]);var _0x3e0fc4={'where':_0x3e2062['where']};return db[_0x1633('0x3f')][_0x1633('0x1f')](_0x3e0fc4)[_0x1633('0x25')](function(_0x141f50){_0x1998ad[_0x1633('0x1f')]=_0x141f50;if(_0x263179[_0x1633('0x32')][_0x1633('0x40')]){_0x3e2062[_0x1633('0x41')]=[{'all':!![]}];}return db[_0x1633('0x3f')][_0x1633('0x42')](_0x3e2062);})['then'](function(_0x4e24e9){_0x1998ad[_0x1633('0x43')]=_0x4e24e9;return _0x1998ad;})[_0x1633('0x25')](respondWithFilteredResult(_0x555bb6,_0x3e2062))[_0x1633('0x44')](handleError(_0x555bb6,null));};exports['show']=function(_0x4cd7fd,_0x665f57){var _0x1fc67b={'raw':!![],'where':{'id':_0x4cd7fd['params']['id']}},_0x3db518={};_0x3db518['model']=_[_0x1633('0x31')](db[_0x1633('0x3f')][_0x1633('0x2d')]);_0x3db518[_0x1633('0x32')]=_[_0x1633('0x31')](_0x4cd7fd['query']);_0x3db518[_0x1633('0x3b')]=_['intersection'](_0x3db518[_0x1633('0x30')],_0x3db518[_0x1633('0x32')]);_0x1fc67b['attributes']=_['intersection'](_0x3db518[_0x1633('0x30')],qs[_0x1633('0x35')](_0x4cd7fd[_0x1633('0x32')]['fields']));_0x1fc67b[_0x1633('0x33')]=_0x1fc67b[_0x1633('0x33')][_0x1633('0x36')]?_0x1fc67b['attributes']:_0x3db518[_0x1633('0x30')];if(_0x4cd7fd['query']['includeAll']){_0x1fc67b[_0x1633('0x41')]=[{'all':!![]}];}_0x1fc67b=_[_0x1633('0x3d')]({},_0x1fc67b,_0x4cd7fd[_0x1633('0x3e')]);return db['SmsApplication'][_0x1633('0x45')](_0x1fc67b)[_0x1633('0x25')](handleEntityNotFound(_0x665f57,null))[_0x1633('0x25')](respondWithResult(_0x665f57,null))[_0x1633('0x44')](handleError(_0x665f57,null));};exports[_0x1633('0x46')]=function(_0x463c99,_0x4e0bab){return db[_0x1633('0x3f')][_0x1633('0x46')](_0x463c99[_0x1633('0x47')],{})[_0x1633('0x25')](respondWithResult(_0x4e0bab,0xc9))['catch'](handleError(_0x4e0bab,null));};exports['update']=function(_0x295b36,_0x5b7aef){if(_0x295b36[_0x1633('0x47')]['id']){delete _0x295b36['body']['id'];}return db[_0x1633('0x3f')][_0x1633('0x45')]({'where':{'id':_0x295b36['params']['id']}})[_0x1633('0x25')](handleEntityNotFound(_0x5b7aef,null))[_0x1633('0x25')](saveUpdates(_0x295b36['body'],null))['then'](respondWithResult(_0x5b7aef,null))[_0x1633('0x44')](handleError(_0x5b7aef,null));};exports[_0x1633('0x48')]=function(_0x3e46a7,_0x25072f){return db[_0x1633('0x3f')][_0x1633('0x45')]({'where':{'id':_0x3e46a7[_0x1633('0x49')]['id']}})['then'](handleEntityNotFound(_0x25072f,null))[_0x1633('0x25')](removeEntity(_0x25072f,null))[_0x1633('0x44')](handleError(_0x25072f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 73cc959..0a1e902 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 _0x3fea=['lodash','util','moment','bluebird','request-promise','path','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xe8dbf7,_0x302c11){var _0x4f3789=function(_0x321fe0){while(--_0x321fe0){_0xe8dbf7['push'](_0xe8dbf7['shift']());}};_0x4f3789(++_0x302c11);}(_0x3fea,0x1bc));var _0xa3fe=function(_0x4e88dd,_0x2392cf){_0x4e88dd=_0x4e88dd-0x0;var _0x510350=_0x3fea[_0x4e88dd];return _0x510350;};'use strict';var _=require(_0xa3fe('0x0'));var util=require(_0xa3fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa3fe('0x2'));var BPromise=require(_0xa3fe('0x3'));var rp=require(_0xa3fe('0x4'));var fs=require('fs');var path=require(_0xa3fe('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3fe('0x6'));module['exports']=function(_0x380ba9,_0x462b65){return _0x380ba9[_0xa3fe('0x7')](_0xa3fe('0x8'),attributes,{'tableName':_0xa3fe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa3fe('0xa'),'collate':_0xa3fe('0xb')});}; \ No newline at end of file +var _0x6b14=['api','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0x6b14,0x102));var _0x46b1=function(_0xe70f50,_0x13c10a){_0xe70f50=_0xe70f50-0x0;var _0x5441f6=_0x6b14[_0xe70f50];return _0x5441f6;};'use strict';var _=require('lodash');var util=require(_0x46b1('0x0'));var logger=require(_0x46b1('0x1'))(_0x46b1('0x2'));var moment=require(_0x46b1('0x3'));var BPromise=require(_0x46b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46b1('0x5'));var rimraf=require(_0x46b1('0x6'));var config=require(_0x46b1('0x7'));var attributes=require(_0x46b1('0x8'));module[_0x46b1('0x9')]=function(_0x2deeff,_0x30b20){return _0x2deeff['define']('SmsApplication',attributes,{'tableName':_0x46b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46b1('0xb'),'collate':_0x46b1('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index a3069a6..e22088c 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 _0x3d3d=['info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','result','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x455e9d,_0x3eb4b4){var _0x5abebd=function(_0x756ec9){while(--_0x756ec9){_0x455e9d['push'](_0x455e9d['shift']());}};_0x5abebd(++_0x3eb4b4);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var moment=require(_0xd3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require(_0xd3d3('0x3'));var db=require(_0xd3d3('0x4'))['db'];var utils=require(_0xd3d3('0x5'));var logger=require(_0xd3d3('0x6'))(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var jayson=require(_0xd3d3('0x9'));var client=jayson[_0xd3d3('0xa')][_0xd3d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa421,_0x1f47fe,_0x263940){return new BPromise(function(_0x3fe58e,_0x2ed96f){return client['request'](_0x4aa421,_0x263940)[_0xd3d3('0xc')](function(_0x412054){logger[_0xd3d3('0xd')](_0xd3d3('0xe'),_0x1f47fe,'request\x20sent');logger[_0xd3d3('0xf')](_0xd3d3('0x10'),_0x1f47fe,_0xd3d3('0x11'),JSON[_0xd3d3('0x12')](_0x412054));if(_0x412054[_0xd3d3('0x13')]){if(_0x412054[_0xd3d3('0x13')]['code']===0x1f4){logger[_0xd3d3('0x13')]('SmsApplication,\x20%s,\x20%s',_0x1f47fe,_0x412054['error']['message']);return _0x2ed96f(_0x412054[_0xd3d3('0x13')]['message']);}logger['error'](_0xd3d3('0xe'),_0x1f47fe,_0x412054[_0xd3d3('0x13')]['message']);return _0x3fe58e(_0x412054[_0xd3d3('0x13')]['message']);}else{logger['info'](_0xd3d3('0xe'),_0x1f47fe,_0xd3d3('0x11'));_0x3fe58e(_0x412054[_0xd3d3('0x14')][_0xd3d3('0x15')]);}})[_0xd3d3('0x16')](function(_0x5c3462){logger[_0xd3d3('0x13')](_0xd3d3('0xe'),_0x1f47fe,_0x5c3462);_0x2ed96f(_0x5c3462);});});} \ No newline at end of file +var _0x5464=['info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x30ae47,_0x118fb4){var _0x2b046e=function(_0x45613f){while(--_0x45613f){_0x30ae47['push'](_0x30ae47['shift']());}};_0x2b046e(++_0x118fb4);}(_0x5464,0x15d));var _0x4546=function(_0xa8875e,_0x3e424c){_0xa8875e=_0xa8875e-0x0;var _0x60a72a=_0x5464[_0xa8875e];return _0x60a72a;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('SmsApplication,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('SmsApplication,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 79381e1..1d87ecd 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 _0xe5b5=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','put','tracked','smsinteraction:update','delete','smsinteraction:destroy'];(function(_0x4cd92c,_0x37e405){var _0x517a4e=function(_0x3bd290){while(--_0x3bd290){_0x4cd92c['push'](_0x4cd92c['shift']());}};_0x517a4e(++_0x37e405);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xe5b5[_0xf0bc07];return _0x1c50c2;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/messages',auth[_0x5e5b('0xc')](),controller['getMessages']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e5b('0x14')](_0x5e5b('0x15'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x14')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),interaction['tracked'](_0x5e5b('0x18'),_0x5e5b('0x19')),controller['addTags']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5e5b('0x1b')](_0x5e5b('0x18'),_0x5e5b('0x1c')),controller['update']);router[_0x5e5b('0x1d')]('/:id',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x1b')]('sms',_0x5e5b('0x1e')),controller[_0x5e5b('0x1f')]);router[_0x5e5b('0x1d')]('/:id/tags',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x20')]);module['exports']=router; \ No newline at end of file +var _0x93e9=['update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update'];(function(_0x175146,_0x1e5d09){var _0x2d0614=function(_0x48455c){while(--_0x48455c){_0x175146['push'](_0x175146['shift']());}};_0x2d0614(++_0x1e5d09);}(_0x93e9,0xcc));var _0x993e=function(_0x379c5e,_0x53285e){_0x379c5e=_0x379c5e-0x0;var _0x5aa6b4=_0x93e9[_0x379c5e];return _0x5aa6b4;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getMessages']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x993e('0x11')]('/',auth['isAuthenticated'](),controller[_0x993e('0x12')]);router['post']('/:id/messages',auth[_0x993e('0xa')](),controller[_0x993e('0x13')]);router[_0x993e('0x11')](_0x993e('0x14'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x17')),controller[_0x993e('0x18')]);router[_0x993e('0x19')](_0x993e('0xd'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1a')),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')]('/:id',auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1d')),controller[_0x993e('0x1e')]);router[_0x993e('0x1c')]('/:id/tags',auth[_0x993e('0xa')](),controller[_0x993e('0x1f')]);module[_0x993e('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 680be90..37f7601 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 _0xcabe=['exports','BOOLEAN','STRING','DATE','out','ENUM','INTEGER','sequelize'];(function(_0x2d85e3,_0x35009f){var _0xfba446=function(_0x11a6aa){while(--_0x11a6aa){_0x2d85e3['push'](_0x2d85e3['shift']());}};_0xfba446(++_0x35009f);}(_0xcabe,0x1ef));var _0xecab=function(_0x27ce63,_0x3220b8){_0x27ce63=_0x27ce63-0x0;var _0x301ec6=_0xcabe[_0x27ce63];return _0x301ec6;};'use strict';var Sequelize=require(_0xecab('0x0'));var moment=require('moment');module[_0xecab('0x1')]={'closed':{'type':Sequelize[_0xecab('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xecab('0x3')]},'secondDisposition':{'type':Sequelize[_0xecab('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xecab('0x3')]},'phone':{'type':Sequelize[_0xecab('0x3')]},'read1stAt':{'type':Sequelize[_0xecab('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xecab('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xecab('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xecab('0x6')]('in',_0xecab('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xecab('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xecab('0x7')]}}; \ No newline at end of file +var _0x45d8=['DATE','STRING','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x905714,_0x1cf3ee){var _0xec0fd3=function(_0x2e26be){while(--_0x2e26be){_0x905714['push'](_0x905714['shift']());}};_0xec0fd3(++_0x1cf3ee);}(_0x45d8,0x174));var _0x845d=function(_0x4f5af0,_0x5af252){_0x4f5af0=_0x4f5af0-0x0;var _0x49647a=_0x45d8[_0x4f5af0];return _0x49647a;};'use strict';var Sequelize=require(_0x845d('0x0'));var moment=require(_0x845d('0x1'));module[_0x845d('0x2')]={'closed':{'type':Sequelize[_0x845d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x845d('0x4')]},'disposition':{'type':Sequelize[_0x845d('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x845d('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x845d('0x5')]},'read1stAt':{'type':Sequelize[_0x845d('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x845d('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x845d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x845d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x845d('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4e0053e..da565af 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 _0xc7d3=['SmsAccount','Account','fullname','Sms','Owner','N.A.','closed','closedAt','direction','out','System','value','renderFile','server','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','error','stack','name','send','index','map','fieldName','key','getOptions','findAll','query','user','catch','show','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','describe','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','toString','root','files','tmp','join','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0xc7d3,0x8f));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var rimraf=require(_0x3c7d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x3c7d('0x1'));var BPromise=require(_0x3c7d('0x2'));var util=require(_0x3c7d('0x3'));var path=require(_0x3c7d('0x4'));var ejs=require(_0x3c7d('0x5'));var fs=require('fs');var _=require(_0x3c7d('0x6'));var Redis=require(_0x3c7d('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x3c7d('0x8'));var pdf=require(_0x3c7d('0x9'));var logger=require(_0x3c7d('0xa'))(_0x3c7d('0xb'));var config=require(_0x3c7d('0xc'));var db=require('../../mysqldb')['db'];config[_0x3c7d('0xd')]=_['defaults'](config[_0x3c7d('0xd')],{'host':_0x3c7d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c7d('0xd')]));require(_0x3c7d('0xf'))[_0x3c7d('0x10')](socket);function respondWithStatusCode(_0x431bb0,_0x29022c){_0x29022c=_0x29022c||0xcc;return function(_0x46d4fa){if(_0x46d4fa){return _0x431bb0[_0x3c7d('0x11')](_0x29022c);}return _0x431bb0[_0x3c7d('0x12')](_0x29022c)[_0x3c7d('0x13')]();};}function respondWithResult(_0x5c63f4,_0x4d4a1a){_0x4d4a1a=_0x4d4a1a||0xc8;return function(_0x253cb1){if(_0x253cb1){return _0x5c63f4[_0x3c7d('0x12')](_0x4d4a1a)['json'](_0x253cb1);}};}function respondWithFilteredResult(_0x92cc0e,_0x5d52ff){return function(_0x145be7){if(_0x145be7){var _0x378fd7=typeof _0x5d52ff[_0x3c7d('0x14')]===_0x3c7d('0x15')&&typeof _0x5d52ff[_0x3c7d('0x16')]===_0x3c7d('0x15');var _0x48c4d2=_0x145be7['count'];var _0xeb9b7f=_0x378fd7?0x0:_0x5d52ff[_0x3c7d('0x14')];var _0x2b0d57=_0x378fd7?_0x145be7[_0x3c7d('0x17')]:_0x5d52ff[_0x3c7d('0x14')]+_0x5d52ff[_0x3c7d('0x16')];var _0x1b2d62;if(_0x2b0d57>=_0x48c4d2){_0x2b0d57=_0x48c4d2;_0x1b2d62=0xc8;}else{_0x1b2d62=0xce;}_0x92cc0e[_0x3c7d('0x12')](_0x1b2d62);return _0x92cc0e[_0x3c7d('0x18')](_0x3c7d('0x19'),_0xeb9b7f+'-'+_0x2b0d57+'/'+_0x48c4d2)[_0x3c7d('0x1a')](_0x145be7);}return null;};}function saveUpdates(_0xd618b){return function(_0x5032c0){if(_0x5032c0){return _0x5032c0['update'](_0xd618b)['then'](function(_0x1666ed){return _0x1666ed;});}return null;};}function removeEntity(_0x193fa7){return function(_0x4c6208){if(_0x4c6208){return _0x4c6208[_0x3c7d('0x1b')]()[_0x3c7d('0x1c')](function(){_0x193fa7['status'](0xcc)[_0x3c7d('0x13')]();});}};}function handleEntityNotFound(_0x45a06a){return function(_0xb29940){if(!_0xb29940){_0x45a06a[_0x3c7d('0x11')](0x194);}return _0xb29940;};}function handleError(_0x323017,_0x389633){_0x389633=_0x389633||0x1f4;return function(_0x3e3ea0){logger[_0x3c7d('0x1d')](_0x3e3ea0[_0x3c7d('0x1e')]);if(_0x3e3ea0[_0x3c7d('0x1f')]){delete _0x3e3ea0[_0x3c7d('0x1f')];}_0x323017['status'](_0x389633)[_0x3c7d('0x20')](_0x3e3ea0);};}exports[_0x3c7d('0x21')]=function(_0x2468a0,_0x1d8878){var _0x49acce={};var _0x3236b9=_[_0x3c7d('0x22')](db['SmsInteraction']['rawAttributes'],function(_0x98aa45){return{'name':_0x98aa45[_0x3c7d('0x23')],'type':_0x98aa45['type'][_0x3c7d('0x24')]};});_0x49acce=qs[_0x3c7d('0x25')](_0x3236b9,_0x2468a0);return interaction[_0x3c7d('0x26')]('sms',_0x2468a0[_0x3c7d('0x27')],_0x2468a0[_0x3c7d('0x28')],_0x49acce,_0x3236b9)[_0x3c7d('0x1c')](respondWithFilteredResult(_0x1d8878,_0x49acce))[_0x3c7d('0x29')](handleError(_0x1d8878,null));};exports[_0x3c7d('0x2a')]=function(_0x2e1e9f,_0x37e6f9){var _0x48b691={'raw':![],'where':{'id':_0x2e1e9f[_0x3c7d('0x2b')]['id']}},_0x3c30ef={};_0x3c30ef[_0x3c7d('0x2c')]=_[_0x3c7d('0x2d')](db[_0x3c7d('0x2e')]['rawAttributes']);_0x3c30ef[_0x3c7d('0x27')]=_[_0x3c7d('0x2d')](_0x2e1e9f[_0x3c7d('0x27')]);_0x3c30ef[_0x3c7d('0x2f')]=_[_0x3c7d('0x30')](_0x3c30ef[_0x3c7d('0x2c')],_0x3c30ef[_0x3c7d('0x27')]);_0x48b691[_0x3c7d('0x31')]=_[_0x3c7d('0x30')](_0x3c30ef['model'],qs[_0x3c7d('0x32')](_0x2e1e9f['query']['fields']));_0x48b691['attributes']=_0x48b691['attributes'][_0x3c7d('0x33')]?_0x48b691[_0x3c7d('0x31')]:_0x3c30ef[_0x3c7d('0x2c')];if(_0x2e1e9f[_0x3c7d('0x27')][_0x3c7d('0x34')]){_0x48b691[_0x3c7d('0x35')]=[{'all':!![]}];}_0x48b691=_[_0x3c7d('0x36')]({},_0x48b691,_0x2e1e9f[_0x3c7d('0x37')]);return db[_0x3c7d('0x2e')][_0x3c7d('0x38')](_0x48b691)[_0x3c7d('0x1c')](handleEntityNotFound(_0x37e6f9,null))[_0x3c7d('0x1c')](respondWithResult(_0x37e6f9,null))[_0x3c7d('0x29')](handleError(_0x37e6f9,null));};exports[_0x3c7d('0x39')]=function(_0x295ca0,_0x4a578a){return db[_0x3c7d('0x2e')][_0x3c7d('0x39')](_0x295ca0[_0x3c7d('0x3a')],{})[_0x3c7d('0x1c')](respondWithResult(_0x4a578a,0xc9))[_0x3c7d('0x29')](handleError(_0x4a578a,null));};exports[_0x3c7d('0x3b')]=function(_0x204fa8,_0x3785de){if(_0x204fa8[_0x3c7d('0x3a')]['id']){delete _0x204fa8[_0x3c7d('0x3a')]['id'];}return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0x204fa8[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x3785de,null))[_0x3c7d('0x1c')](saveUpdates(_0x204fa8[_0x3c7d('0x3a')],null))[_0x3c7d('0x1c')](respondWithResult(_0x3785de,null))[_0x3c7d('0x29')](handleError(_0x3785de,null));};exports[_0x3c7d('0x1b')]=function(_0xced95f,_0xf963a8){return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0xced95f[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0xf963a8,null))[_0x3c7d('0x1c')](removeEntity(_0xf963a8,null))[_0x3c7d('0x29')](handleError(_0xf963a8,null));};exports[_0x3c7d('0x3c')]=function(_0x50f7ae,_0x165bc8){return db[_0x3c7d('0x2e')][_0x3c7d('0x3c')]()['then'](respondWithResult(_0x165bc8,null))['catch'](handleError(_0x165bc8,null));};exports['addMessage']=function(_0x570660,_0x5d3c36){return db['SmsMessage'][_0x3c7d('0x38')]({'where':{'id':_0x570660[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x5d3c36,null))[_0x3c7d('0x1c')](function(_0x30739f){if(_0x30739f){return _0x30739f['addMessage'](_0x570660['body'][_0x3c7d('0x3d')],_[_0x3c7d('0x3e')](_0x570660['body'],['ids','id'])||{});}})[_0x3c7d('0x1c')](respondWithResult(_0x5d3c36,null))[_0x3c7d('0x29')](handleError(_0x5d3c36,null));};exports[_0x3c7d('0x3f')]=function(_0x4db688,_0x4ce7f5){var _0xfe3657={'raw':![],'where':{}};var _0x6a4025={};var _0x5886bc={'count':0x0,'rows':[]};return db[_0x3c7d('0x2e')][_0x3c7d('0x40')]({'where':{'id':_0x4db688[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x4ce7f5,null))['then'](function(_0x4c5b01){if(_0x4c5b01){_0x6a4025['model']=_[_0x3c7d('0x2d')](db[_0x3c7d('0x41')]['rawAttributes']);_0x6a4025[_0x3c7d('0x27')]=_[_0x3c7d('0x2d')](_0x4db688[_0x3c7d('0x27')]);_0x6a4025[_0x3c7d('0x2f')]=_[_0x3c7d('0x30')](_0x6a4025[_0x3c7d('0x2c')],_0x6a4025['query']);_0xfe3657[_0x3c7d('0x31')]=_['intersection'](_0x6a4025['model'],qs[_0x3c7d('0x32')](_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x32')]));_0xfe3657[_0x3c7d('0x31')]=_0xfe3657[_0x3c7d('0x31')][_0x3c7d('0x33')]?_0xfe3657[_0x3c7d('0x31')]:_0x6a4025[_0x3c7d('0x2c')];if(!_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x42')]('nolimit')){_0xfe3657[_0x3c7d('0x16')]=qs[_0x3c7d('0x16')](_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x16')]);_0xfe3657['offset']=qs[_0x3c7d('0x14')](_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x14')]);}_0xfe3657[_0x3c7d('0x43')]=qs[_0x3c7d('0x44')](_0x4db688['query']['sort']);_0xfe3657[_0x3c7d('0x45')]=qs[_0x3c7d('0x2f')](_[_0x3c7d('0x46')](_0x4db688[_0x3c7d('0x27')],_0x6a4025[_0x3c7d('0x2f')]));_0xfe3657[_0x3c7d('0x45')][_0x3c7d('0x47')]=_0x4c5b01['id'];if(_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x48')]){_0xfe3657[_0x3c7d('0x45')]=_[_0x3c7d('0x36')](_0xfe3657[_0x3c7d('0x45')],{'$or':_['map'](_0xfe3657[_0x3c7d('0x31')],function(_0x4c2e64){var _0x4270d2={};_0x4270d2[_0x4c2e64]={'$like':'%'+_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x48')]+'%'};return _0x4270d2;})});}if(_0x4db688['query']['$gte']){var _0x102cdc=_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x49')][_0x3c7d('0x4a')](',');var _0x406a1c={};_0x406a1c[_0x102cdc[0x0]]={'$gte':moment(_0x102cdc[0x1])[_0x3c7d('0x4b')](_0x3c7d('0x4c'))};_0xfe3657[_0x3c7d('0x45')]=_['merge'](_0xfe3657['where'],_0x406a1c);}_0xfe3657=_[_0x3c7d('0x36')]({},_0xfe3657,_0x4db688[_0x3c7d('0x37')]);return db[_0x3c7d('0x41')][_0x3c7d('0x17')]({'where':_0xfe3657[_0x3c7d('0x45')]})[_0x3c7d('0x1c')](function(_0x1cc82f){_0x5886bc[_0x3c7d('0x17')]=_0x1cc82f;if(_0x4db688[_0x3c7d('0x27')][_0x3c7d('0x34')]){_0xfe3657['include']=[{'all':!![]}];}return db[_0x3c7d('0x41')]['findAll'](_0xfe3657);})[_0x3c7d('0x1c')](function(_0x15b3ab){_0x5886bc['rows']=_0x15b3ab;return _0x5886bc;});}})[_0x3c7d('0x1c')](respondWithFilteredResult(_0x4ce7f5,_0xfe3657))[_0x3c7d('0x29')](handleError(_0x4ce7f5,null));};exports[_0x3c7d('0x4d')]=function(_0x3b5062,_0x21d9ef){return db[_0x3c7d('0x2e')]['find']({'where':{'id':_0x3b5062[_0x3c7d('0x2b')]['id']}})[_0x3c7d('0x1c')](handleEntityNotFound(_0x21d9ef,null))[_0x3c7d('0x1c')](function(_0xcc0c02){if(_0xcc0c02){return _0xcc0c02[_0x3c7d('0x4e')](_0x3b5062[_0x3c7d('0x3a')][_0x3c7d('0x3d')],_[_0x3c7d('0x3e')](_0x3b5062[_0x3c7d('0x3a')],['ids','id'])||{})[_0x3c7d('0x4f')](function(){return db[_0x3c7d('0x50')][_0x3c7d('0x26')]({'attributes':['id',_0x3c7d('0x1f'),'color'],'where':{'id':_0x3b5062[_0x3c7d('0x3a')]['ids']}});})['then'](function(_0x56240a){socket[_0x3c7d('0x51')](_0x3c7d('0x52'),{'id':Number(_0x3b5062[_0x3c7d('0x2b')]['id']),'tags':_0x56240a||[]});return{'id':Number(_0x3b5062[_0x3c7d('0x2b')]['id']),'tags':_0x56240a||[]};});}})[_0x3c7d('0x1c')](respondWithResult(_0x21d9ef,null))[_0x3c7d('0x29')](handleError(_0x21d9ef,null));};exports[_0x3c7d('0x53')]=function(_0x56ef60,_0x3c8df0){return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0x56ef60[_0x3c7d('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3c8df0,null))[_0x3c7d('0x1c')](function(_0x374380){if(_0x374380){return _0x374380[_0x3c7d('0x53')](_0x56ef60[_0x3c7d('0x27')][_0x3c7d('0x3d')]);}})[_0x3c7d('0x1c')](respondWithStatusCode(_0x3c8df0,null))[_0x3c7d('0x29')](handleError(_0x3c8df0,null));};exports[_0x3c7d('0x54')]=function(_0x5ac1cb,_0x3e3ae3){var _0x84aa90=moment()['unix']()[_0x3c7d('0x55')]();var _0x4987ea=path['join'](config[_0x3c7d('0x56')],'server',_0x3c7d('0x57'),_0x3c7d('0x58'));var _0x1c6f1f=path[_0x3c7d('0x59')](_0x4987ea,_0x84aa90);var _0x1dd9f8=util['format'](_0x3c7d('0x5a'),_0x5ac1cb[_0x3c7d('0x2b')]['id'],_0x84aa90);var _0x48ad25=path[_0x3c7d('0x59')](_0x4987ea,_0x1dd9f8);var _0xaa5d47=[];_0xaa5d47[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x5c')],'as':_0x3c7d('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0xaa5d47[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x5d')],'as':_0x3c7d('0x5e'),'attributes':['id',_0x3c7d('0x5f'),_0x3c7d('0x60')],'raw':!![]});var _0x4c8e82=[{'model':db[_0x3c7d('0x41')],'as':_0x3c7d('0x61'),'attributes':['id',_0x3c7d('0x3a'),_0x3c7d('0x62'),'direction',_0x3c7d('0x63'),_0x3c7d('0x64')],'include':_0xaa5d47}];_0x4c8e82[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x65')],'as':_0x3c7d('0x66'),'attributes':['id','name']});_0x4c8e82[_0x3c7d('0x5b')]({'model':db[_0x3c7d('0x5c')],'as':'Owner','attributes':['id',_0x3c7d('0x67')]});return db[_0x3c7d('0x2e')][_0x3c7d('0x38')]({'where':{'id':_0x5ac1cb['params']['id']},'include':_0x4c8e82})['then'](handleEntityNotFound(_0x3e3ae3,null))[_0x3c7d('0x1c')](function(_0x1208cc){if(_0x1208cc){var _0x9df427=_0x1208cc['get']({'plain':!![]});fs['mkdirSync'](_0x1c6f1f);var _0x44eaa4={'channel':_0x3c7d('0x68'),'account':_0x9df427['Account'][_0x3c7d('0x1f')],'agent':_0x9df427[_0x3c7d('0x69')]?_0x9df427['Owner'][_0x3c7d('0x67')]:_0x3c7d('0x6a'),'createdAt':moment(_0x9df427[_0x3c7d('0x62')])[_0x3c7d('0x4b')](_0x3c7d('0x4c'))['toString'](),'closedAt':_0x9df427[_0x3c7d('0x6b')]?moment(_0x9df427[_0x3c7d('0x6c')])['format'](_0x3c7d('0x4c'))[_0x3c7d('0x55')]():'','disposition':_0x9df427['disposition'],'messages':_(_0x9df427[_0x3c7d('0x61')])[_0x3c7d('0x48')]({'secret':![]})[_0x3c7d('0x22')](function(_0x204967){return{'date':moment(_0x204967[_0x3c7d('0x62')])[_0x3c7d('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x204967[_0x3c7d('0x6d')]===_0x3c7d('0x6e')?_0x204967['User']?_0x204967[_0x3c7d('0x5c')][_0x3c7d('0x67')]:_0x3c7d('0x6f'):_0x204967[_0x3c7d('0x5e')]['firstName']+(_0x204967[_0x3c7d('0x5e')][_0x3c7d('0x60')]?'\x20'+_0x204967[_0x3c7d('0x5e')][_0x3c7d('0x60')]:''),'body':_0x204967[_0x3c7d('0x3a')],'direction':_0x204967[_0x3c7d('0x6d')]===_0x3c7d('0x6e')?'A':'C','secret':_0x204967[_0x3c7d('0x63')],'read':_0x204967[_0x3c7d('0x64')]};})[_0x3c7d('0x70')]()};return ejs[_0x3c7d('0x71')](path[_0x3c7d('0x59')](config[_0x3c7d('0x56')],_0x3c7d('0x72'),_0x3c7d('0x73'),'downloadInteraction.ejs'),{'interaction':_0x44eaa4})['then'](function(_0x32b77a){var _0x25e9a3=path[_0x3c7d('0x59')](_0x1c6f1f,_0x3c7d('0x74')+_0x9df427['id']+'-'+_0x84aa90+_0x3c7d('0x75'));var _0x485618={'path':_0x25e9a3,'channel':_0x3c7d('0x68'),'interactionId':_0x9df427['id']};return pdf[_0x3c7d('0x76')](_0x32b77a,_0x485618);})[_0x3c7d('0x1c')](function(){return new BPromise(function(_0x44c986,_0x39d890){zipdir(_0x1c6f1f,{'saveTo':_0x48ad25},function(_0x22c6b7,_0x143597){if(_0x22c6b7)return _0x39d890(_0x22c6b7);return _0x44c986(_0x143597);});})['then'](function(){return new BPromise(function(_0x499ddc,_0x4a053b){rimraf(_0x1c6f1f,function(_0x51c07d){if(_0x51c07d)_0x4a053b(_0x51c07d);return _0x499ddc();});});})['then'](function(){return _0x3e3ae3[_0x3c7d('0x54')](_0x48ad25,_0x1dd9f8,function(_0x2a70e8){if(_0x2a70e8){console[_0x3c7d('0x77')](_0x3c7d('0x78'),_0x2a70e8);}else{fs[_0x3c7d('0x79')](_0x48ad25);}});});});}else{return _0x3e3ae3[_0x3c7d('0x11')](0xc8);}})[_0x3c7d('0x29')](handleError(_0x3e3ae3,null));}; \ No newline at end of file +var _0xa6b1=['Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','transcript-%d-%s.zip','fullname','push','CmContact','lastName','Messages','createdAt','direction','secret','read','SmsAccount','User','Owner','get','mkdirSync','Account','N.A.','closed','closedAt','disposition','out','System','Contact','firstName','value','renderFile','views','join','transcript-','.pdf','Sms','createPdfFromHTML','log','unlinkSync','rimraf','bluebird','path','ejs','lodash','ioredis','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','show','keys','SmsInteraction','model','attributes','fields','includeAll','include','merge','find','catch','create','body','params','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','filters','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa6b1,0x125));var _0x1a6b=function(_0x172c8a,_0x4aa089){_0x172c8a=_0x172c8a-0x0;var _0x5bf147=_0xa6b1[_0x172c8a];return _0x5bf147;};'use strict';var rimraf=require(_0x1a6b('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x1a6b('0x1'));var util=require('util');var path=require(_0x1a6b('0x2'));var ejs=require(_0x1a6b('0x3'));var fs=require('fs');var _=require(_0x1a6b('0x4'));var Redis=require(_0x1a6b('0x5'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x1a6b('0x6'));var logger=require('../../config/logger')(_0x1a6b('0x7'));var config=require(_0x1a6b('0x8'));var db=require(_0x1a6b('0x9'))['db'];config[_0x1a6b('0xa')]=_[_0x1a6b('0xb')](config['redis'],{'host':_0x1a6b('0xc'),'port':0x18eb});var socket=require(_0x1a6b('0xd'))(new Redis(config['redis']));require(_0x1a6b('0xe'))[_0x1a6b('0xf')](socket);function respondWithStatusCode(_0x33c24e,_0x32e21c){_0x32e21c=_0x32e21c||0xcc;return function(_0x13e1ee){if(_0x13e1ee){return _0x33c24e[_0x1a6b('0x10')](_0x32e21c);}return _0x33c24e[_0x1a6b('0x11')](_0x32e21c)[_0x1a6b('0x12')]();};}function respondWithResult(_0x17e489,_0x4dd299){_0x4dd299=_0x4dd299||0xc8;return function(_0xd254e6){if(_0xd254e6){return _0x17e489[_0x1a6b('0x11')](_0x4dd299)[_0x1a6b('0x13')](_0xd254e6);}};}function respondWithFilteredResult(_0x47cc03,_0x3de1a5){return function(_0x3f39d6){if(_0x3f39d6){var _0x5ab3c5=typeof _0x3de1a5['offset']===_0x1a6b('0x14')&&typeof _0x3de1a5[_0x1a6b('0x15')]===_0x1a6b('0x14');var _0x1e8092=_0x3f39d6[_0x1a6b('0x16')];var _0x522d52=_0x5ab3c5?0x0:_0x3de1a5[_0x1a6b('0x17')];var _0x20d0f1=_0x5ab3c5?_0x3f39d6[_0x1a6b('0x16')]:_0x3de1a5[_0x1a6b('0x17')]+_0x3de1a5[_0x1a6b('0x15')];var _0x303d2c;if(_0x20d0f1>=_0x1e8092){_0x20d0f1=_0x1e8092;_0x303d2c=0xc8;}else{_0x303d2c=0xce;}_0x47cc03[_0x1a6b('0x11')](_0x303d2c);return _0x47cc03[_0x1a6b('0x18')](_0x1a6b('0x19'),_0x522d52+'-'+_0x20d0f1+'/'+_0x1e8092)['json'](_0x3f39d6);}return null;};}function saveUpdates(_0x8a9cf2){return function(_0x5e463c){if(_0x5e463c){return _0x5e463c[_0x1a6b('0x1a')](_0x8a9cf2)[_0x1a6b('0x1b')](function(_0x343c46){return _0x343c46;});}return null;};}function removeEntity(_0x4b0de5){return function(_0x350fd){if(_0x350fd){return _0x350fd[_0x1a6b('0x1c')]()[_0x1a6b('0x1b')](function(){_0x4b0de5[_0x1a6b('0x11')](0xcc)[_0x1a6b('0x12')]();});}};}function handleEntityNotFound(_0x1b73bc){return function(_0x36f145){if(!_0x36f145){_0x1b73bc[_0x1a6b('0x10')](0x194);}return _0x36f145;};}function handleError(_0x47bf7c,_0xaf2f7a){_0xaf2f7a=_0xaf2f7a||0x1f4;return function(_0xea435a){logger[_0x1a6b('0x1d')](_0xea435a[_0x1a6b('0x1e')]);if(_0xea435a[_0x1a6b('0x1f')]){delete _0xea435a[_0x1a6b('0x1f')];}_0x47bf7c[_0x1a6b('0x11')](_0xaf2f7a)['send'](_0xea435a);};}exports[_0x1a6b('0x20')]=function(_0x55850c,_0x5a9182){var _0x28582c={};var _0x4b0e90=_[_0x1a6b('0x21')](db['SmsInteraction'][_0x1a6b('0x22')],function(_0x1684af){return{'name':_0x1684af[_0x1a6b('0x23')],'type':_0x1684af[_0x1a6b('0x24')][_0x1a6b('0x25')]};});_0x28582c=qs[_0x1a6b('0x26')](_0x4b0e90,_0x55850c);return interaction[_0x1a6b('0x27')](_0x1a6b('0x28'),_0x55850c[_0x1a6b('0x29')],_0x55850c['user'],_0x28582c,_0x4b0e90)[_0x1a6b('0x1b')](respondWithFilteredResult(_0x5a9182,_0x28582c))['catch'](handleError(_0x5a9182,null));};exports[_0x1a6b('0x2a')]=function(_0x59f02d,_0x2ace05){var _0x56ca59={'raw':![],'where':{'id':_0x59f02d['params']['id']}},_0x4237ad={};_0x4237ad['model']=_[_0x1a6b('0x2b')](db[_0x1a6b('0x2c')][_0x1a6b('0x22')]);_0x4237ad['query']=_['keys'](_0x59f02d[_0x1a6b('0x29')]);_0x4237ad['filters']=_['intersection'](_0x4237ad[_0x1a6b('0x2d')],_0x4237ad[_0x1a6b('0x29')]);_0x56ca59[_0x1a6b('0x2e')]=_['intersection'](_0x4237ad[_0x1a6b('0x2d')],qs[_0x1a6b('0x2f')](_0x59f02d[_0x1a6b('0x29')][_0x1a6b('0x2f')]));_0x56ca59[_0x1a6b('0x2e')]=_0x56ca59[_0x1a6b('0x2e')]['length']?_0x56ca59[_0x1a6b('0x2e')]:_0x4237ad['model'];if(_0x59f02d[_0x1a6b('0x29')][_0x1a6b('0x30')]){_0x56ca59[_0x1a6b('0x31')]=[{'all':!![]}];}_0x56ca59=_[_0x1a6b('0x32')]({},_0x56ca59,_0x59f02d['options']);return db[_0x1a6b('0x2c')][_0x1a6b('0x33')](_0x56ca59)[_0x1a6b('0x1b')](handleEntityNotFound(_0x2ace05,null))[_0x1a6b('0x1b')](respondWithResult(_0x2ace05,null))[_0x1a6b('0x34')](handleError(_0x2ace05,null));};exports[_0x1a6b('0x35')]=function(_0xd68d3b,_0x3aca8e){return db[_0x1a6b('0x2c')][_0x1a6b('0x35')](_0xd68d3b[_0x1a6b('0x36')],{})[_0x1a6b('0x1b')](respondWithResult(_0x3aca8e,0xc9))[_0x1a6b('0x34')](handleError(_0x3aca8e,null));};exports[_0x1a6b('0x1a')]=function(_0x24d6a7,_0x21a236){if(_0x24d6a7['body']['id']){delete _0x24d6a7[_0x1a6b('0x36')]['id'];}return db[_0x1a6b('0x2c')][_0x1a6b('0x33')]({'where':{'id':_0x24d6a7['params']['id']}})[_0x1a6b('0x1b')](handleEntityNotFound(_0x21a236,null))['then'](saveUpdates(_0x24d6a7[_0x1a6b('0x36')],null))[_0x1a6b('0x1b')](respondWithResult(_0x21a236,null))['catch'](handleError(_0x21a236,null));};exports[_0x1a6b('0x1c')]=function(_0x3af451,_0x46530f){return db[_0x1a6b('0x2c')]['find']({'where':{'id':_0x3af451[_0x1a6b('0x37')]['id']}})[_0x1a6b('0x1b')](handleEntityNotFound(_0x46530f,null))['then'](removeEntity(_0x46530f,null))['catch'](handleError(_0x46530f,null));};exports[_0x1a6b('0x38')]=function(_0xdc46ea,_0x4a16cd){return db[_0x1a6b('0x2c')][_0x1a6b('0x38')]()[_0x1a6b('0x1b')](respondWithResult(_0x4a16cd,null))[_0x1a6b('0x34')](handleError(_0x4a16cd,null));};exports['addMessage']=function(_0xb6ef7c,_0x53f2cc){return db[_0x1a6b('0x39')]['find']({'where':{'id':_0xb6ef7c[_0x1a6b('0x37')]['id']}})[_0x1a6b('0x1b')](handleEntityNotFound(_0x53f2cc,null))['then'](function(_0x56c006){if(_0x56c006){return _0x56c006[_0x1a6b('0x3a')](_0xb6ef7c[_0x1a6b('0x36')][_0x1a6b('0x3b')],_[_0x1a6b('0x3c')](_0xb6ef7c['body'],[_0x1a6b('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x53f2cc,null))[_0x1a6b('0x34')](handleError(_0x53f2cc,null));};exports[_0x1a6b('0x3d')]=function(_0x314968,_0xc6fa43){var _0x1afdce={'raw':![],'where':{}};var _0x2be434={};var _0x1cf5af={'count':0x0,'rows':[]};return db[_0x1a6b('0x2c')][_0x1a6b('0x3e')]({'where':{'id':_0x314968['params']['id']}})[_0x1a6b('0x1b')](handleEntityNotFound(_0xc6fa43,null))[_0x1a6b('0x1b')](function(_0x4dcef2){if(_0x4dcef2){_0x2be434[_0x1a6b('0x2d')]=_[_0x1a6b('0x2b')](db[_0x1a6b('0x39')][_0x1a6b('0x22')]);_0x2be434[_0x1a6b('0x29')]=_['keys'](_0x314968[_0x1a6b('0x29')]);_0x2be434['filters']=_['intersection'](_0x2be434[_0x1a6b('0x2d')],_0x2be434[_0x1a6b('0x29')]);_0x1afdce['attributes']=_['intersection'](_0x2be434[_0x1a6b('0x2d')],qs[_0x1a6b('0x2f')](_0x314968[_0x1a6b('0x29')][_0x1a6b('0x2f')]));_0x1afdce[_0x1a6b('0x2e')]=_0x1afdce[_0x1a6b('0x2e')]['length']?_0x1afdce['attributes']:_0x2be434['model'];if(!_0x314968[_0x1a6b('0x29')][_0x1a6b('0x3f')](_0x1a6b('0x40'))){_0x1afdce['limit']=qs[_0x1a6b('0x15')](_0x314968[_0x1a6b('0x29')][_0x1a6b('0x15')]);_0x1afdce[_0x1a6b('0x17')]=qs[_0x1a6b('0x17')](_0x314968[_0x1a6b('0x29')][_0x1a6b('0x17')]);}_0x1afdce['order']=qs['sort'](_0x314968[_0x1a6b('0x29')][_0x1a6b('0x41')]);_0x1afdce[_0x1a6b('0x42')]=qs[_0x1a6b('0x43')](_[_0x1a6b('0x44')](_0x314968['query'],_0x2be434[_0x1a6b('0x43')]));_0x1afdce[_0x1a6b('0x42')][_0x1a6b('0x45')]=_0x4dcef2['id'];if(_0x314968[_0x1a6b('0x29')][_0x1a6b('0x46')]){_0x1afdce[_0x1a6b('0x42')]=_['merge'](_0x1afdce[_0x1a6b('0x42')],{'$or':_[_0x1a6b('0x21')](_0x1afdce[_0x1a6b('0x2e')],function(_0x1f1643){var _0x271283={};_0x271283[_0x1f1643]={'$like':'%'+_0x314968[_0x1a6b('0x29')][_0x1a6b('0x46')]+'%'};return _0x271283;})});}if(_0x314968[_0x1a6b('0x29')][_0x1a6b('0x47')]){var _0x40e9ac=_0x314968['query'][_0x1a6b('0x47')][_0x1a6b('0x48')](',');var _0x4644ce={};_0x4644ce[_0x40e9ac[0x0]]={'$gte':moment(_0x40e9ac[0x1])[_0x1a6b('0x49')](_0x1a6b('0x4a'))};_0x1afdce[_0x1a6b('0x42')]=_['merge'](_0x1afdce[_0x1a6b('0x42')],_0x4644ce);}_0x1afdce=_[_0x1a6b('0x32')]({},_0x1afdce,_0x314968[_0x1a6b('0x4b')]);return db[_0x1a6b('0x39')][_0x1a6b('0x16')]({'where':_0x1afdce[_0x1a6b('0x42')]})['then'](function(_0x4c89e3){_0x1cf5af[_0x1a6b('0x16')]=_0x4c89e3;if(_0x314968[_0x1a6b('0x29')][_0x1a6b('0x30')]){_0x1afdce['include']=[{'all':!![]}];}return db[_0x1a6b('0x39')][_0x1a6b('0x27')](_0x1afdce);})['then'](function(_0x232c02){_0x1cf5af[_0x1a6b('0x4c')]=_0x232c02;return _0x1cf5af;});}})[_0x1a6b('0x1b')](respondWithFilteredResult(_0xc6fa43,_0x1afdce))[_0x1a6b('0x34')](handleError(_0xc6fa43,null));};exports[_0x1a6b('0x4d')]=function(_0x564603,_0x244e30){return db[_0x1a6b('0x2c')]['find']({'where':{'id':_0x564603[_0x1a6b('0x37')]['id']}})[_0x1a6b('0x1b')](handleEntityNotFound(_0x244e30,null))[_0x1a6b('0x1b')](function(_0x357f84){if(_0x357f84){return _0x357f84[_0x1a6b('0x4e')](_0x564603['body'][_0x1a6b('0x3b')],_[_0x1a6b('0x3c')](_0x564603['body'],[_0x1a6b('0x3b'),'id'])||{})['spread'](function(){return db[_0x1a6b('0x4f')][_0x1a6b('0x27')]({'attributes':['id',_0x1a6b('0x1f'),_0x1a6b('0x50')],'where':{'id':_0x564603[_0x1a6b('0x36')]['ids']}});})[_0x1a6b('0x1b')](function(_0xec9a11){socket[_0x1a6b('0x51')](_0x1a6b('0x52'),{'id':Number(_0x564603[_0x1a6b('0x37')]['id']),'tags':_0xec9a11||[]});return{'id':Number(_0x564603['params']['id']),'tags':_0xec9a11||[]};});}})[_0x1a6b('0x1b')](respondWithResult(_0x244e30,null))['catch'](handleError(_0x244e30,null));};exports[_0x1a6b('0x53')]=function(_0x4ebbbe,_0xbed5a6){return db[_0x1a6b('0x2c')][_0x1a6b('0x33')]({'where':{'id':_0x4ebbbe[_0x1a6b('0x37')]['id']}})[_0x1a6b('0x1b')](handleEntityNotFound(_0xbed5a6,null))[_0x1a6b('0x1b')](function(_0x7015d7){if(_0x7015d7){return _0x7015d7[_0x1a6b('0x53')](_0x4ebbbe[_0x1a6b('0x29')][_0x1a6b('0x3b')]);}})['then'](respondWithStatusCode(_0xbed5a6,null))['catch'](handleError(_0xbed5a6,null));};exports[_0x1a6b('0x54')]=function(_0x57da81,_0x539d66){var _0x17ca96=moment()[_0x1a6b('0x55')]()[_0x1a6b('0x56')]();var _0x521d2a=path['join'](config[_0x1a6b('0x57')],_0x1a6b('0x58'),_0x1a6b('0x59'),'tmp');var _0x3ee61d=path['join'](_0x521d2a,_0x17ca96);var _0x65d000=util[_0x1a6b('0x49')](_0x1a6b('0x5a'),_0x57da81[_0x1a6b('0x37')]['id'],_0x17ca96);var _0x4330dc=path['join'](_0x521d2a,_0x65d000);var _0x27bfaf=[];_0x27bfaf['push']({'model':db['User'],'as':'User','attributes':['id',_0x1a6b('0x5b')],'raw':!![]});_0x27bfaf[_0x1a6b('0x5c')]({'model':db[_0x1a6b('0x5d')],'as':'Contact','attributes':['id','firstName',_0x1a6b('0x5e')],'raw':!![]});var _0x3aff8f=[{'model':db['SmsMessage'],'as':_0x1a6b('0x5f'),'attributes':['id',_0x1a6b('0x36'),_0x1a6b('0x60'),_0x1a6b('0x61'),_0x1a6b('0x62'),_0x1a6b('0x63')],'include':_0x27bfaf}];_0x3aff8f[_0x1a6b('0x5c')]({'model':db[_0x1a6b('0x64')],'as':'Account','attributes':['id',_0x1a6b('0x1f')]});_0x3aff8f[_0x1a6b('0x5c')]({'model':db[_0x1a6b('0x65')],'as':_0x1a6b('0x66'),'attributes':['id',_0x1a6b('0x5b')]});return db[_0x1a6b('0x2c')][_0x1a6b('0x33')]({'where':{'id':_0x57da81[_0x1a6b('0x37')]['id']},'include':_0x3aff8f})['then'](handleEntityNotFound(_0x539d66,null))[_0x1a6b('0x1b')](function(_0x47aa7b){if(_0x47aa7b){var _0x1aa0ae=_0x47aa7b[_0x1a6b('0x67')]({'plain':!![]});fs[_0x1a6b('0x68')](_0x3ee61d);var _0x14c145={'channel':'Sms','account':_0x1aa0ae[_0x1a6b('0x69')][_0x1a6b('0x1f')],'agent':_0x1aa0ae[_0x1a6b('0x66')]?_0x1aa0ae[_0x1a6b('0x66')][_0x1a6b('0x5b')]:_0x1a6b('0x6a'),'createdAt':moment(_0x1aa0ae[_0x1a6b('0x60')])['format'](_0x1a6b('0x4a'))[_0x1a6b('0x56')](),'closedAt':_0x1aa0ae[_0x1a6b('0x6b')]?moment(_0x1aa0ae[_0x1a6b('0x6c')])[_0x1a6b('0x49')](_0x1a6b('0x4a'))[_0x1a6b('0x56')]():'','disposition':_0x1aa0ae[_0x1a6b('0x6d')],'messages':_(_0x1aa0ae[_0x1a6b('0x5f')])[_0x1a6b('0x46')]({'secret':![]})[_0x1a6b('0x21')](function(_0x504966){return{'date':moment(_0x504966[_0x1a6b('0x60')])[_0x1a6b('0x49')](_0x1a6b('0x4a'))[_0x1a6b('0x56')](),'sender':_0x504966[_0x1a6b('0x61')]===_0x1a6b('0x6e')?_0x504966[_0x1a6b('0x65')]?_0x504966[_0x1a6b('0x65')][_0x1a6b('0x5b')]:_0x1a6b('0x6f'):_0x504966[_0x1a6b('0x70')][_0x1a6b('0x71')]+(_0x504966[_0x1a6b('0x70')][_0x1a6b('0x5e')]?'\x20'+_0x504966['Contact'][_0x1a6b('0x5e')]:''),'body':_0x504966['body'],'direction':_0x504966[_0x1a6b('0x61')]===_0x1a6b('0x6e')?'A':'C','secret':_0x504966[_0x1a6b('0x62')],'read':_0x504966[_0x1a6b('0x63')]};})[_0x1a6b('0x72')]()};return ejs[_0x1a6b('0x73')](path['join'](config[_0x1a6b('0x57')],_0x1a6b('0x58'),_0x1a6b('0x74'),'downloadInteraction.ejs'),{'interaction':_0x14c145})[_0x1a6b('0x1b')](function(_0x28eab7){var _0x39f17f=path[_0x1a6b('0x75')](_0x3ee61d,_0x1a6b('0x76')+_0x1aa0ae['id']+'-'+_0x17ca96+_0x1a6b('0x77'));var _0x42ae34={'path':_0x39f17f,'channel':_0x1a6b('0x78'),'interactionId':_0x1aa0ae['id']};return pdf[_0x1a6b('0x79')](_0x28eab7,_0x42ae34);})[_0x1a6b('0x1b')](function(){return new BPromise(function(_0x59cfdd,_0x550dfb){zipdir(_0x3ee61d,{'saveTo':_0x4330dc},function(_0x46c5d3,_0x3b9974){if(_0x46c5d3)return _0x550dfb(_0x46c5d3);return _0x59cfdd(_0x3b9974);});})[_0x1a6b('0x1b')](function(){return new BPromise(function(_0x2f233b,_0x4881c5){rimraf(_0x3ee61d,function(_0x4281e0){if(_0x4281e0)_0x4881c5(_0x4281e0);return _0x2f233b();});});})[_0x1a6b('0x1b')](function(){return _0x539d66[_0x1a6b('0x54')](_0x4330dc,_0x65d000,function(_0x3ad04b){if(_0x3ad04b){console[_0x1a6b('0x7a')]('err',_0x3ad04b);}else{fs[_0x1a6b('0x7b')](_0x4330dc);}});});});}else{return _0x539d66[_0x1a6b('0x10')](0xc8);}})[_0x1a6b('0x34')](handleError(_0x539d66,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 001c04a..0b8d2c8 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 _0x3266=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x1379b7,_0x5caa37){var _0x6008d9=function(_0x30e753){while(--_0x30e753){_0x1379b7['push'](_0x1379b7['shift']());}};_0x6008d9(++_0x5caa37);}(_0x3266,0x6a));var _0x6326=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3266[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require(_0x6326('0x0'));var SmsInteraction=require(_0x6326('0x1'))['db'][_0x6326('0x2')];var SmsMessage=require(_0x6326('0x1'))['db'][_0x6326('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6326('0x4')](0x0);var events={'afterCreate':_0x6326('0x5'),'afterUpdate':_0x6326('0x6'),'afterDestroy':_0x6326('0x7')};function emitEvent(_0x5a6b4d){return function(_0x30b22e,_0x5f38a3,_0x25ecd8){_0x30b22e[_0x6326('0x8')]({'attributes':['id'],'raw':!![]})[_0x6326('0x9')](function(_0x5402e5){_0x30b22e[_0x6326('0xa')]('Users',_0x5402e5[_0x6326('0xb')](function(_0x90c0f){return{'id':_0x90c0f['id']};}));return SmsMessage[_0x6326('0xc')]({'where':{'SmsInteractionId':_0x30b22e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6326('0x9')](function(_0x37a23d){_0x30b22e['setDataValue'](_0x6326('0xd'),_0x37a23d[_0x6326('0xe')]);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d+':'+_0x30b22e['id'],_0x30b22e);SmsInteractionEvents[_0x6326('0xf')](_0x5a6b4d,_0x30b22e);_0x25ecd8(null);})[_0x6326('0x10')](_0x25ecd8(null));};}for(var e in events){if(events[_0x6326('0x11')](e)){var event=events[e];SmsInteraction[_0x6326('0x12')](e,emitEvent(event));}}module[_0x6326('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0xb03e=['SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction'];(function(_0x10f249,_0x5eb137){var _0x3adfad=function(_0x55901d){while(--_0x55901d){_0x10f249['push'](_0x10f249['shift']());}};_0x3adfad(++_0x5eb137);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3bc3e2,_0x1c7cce){_0x3bc3e2=_0x3bc3e2-0x0;var _0x528cb7=_0xb03e[_0x3bc3e2];return _0x528cb7;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xeb03('0x0'))['db'][_0xeb03('0x1')];var SmsMessage=require(_0xeb03('0x0'))['db'][_0xeb03('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeb03('0x3')](0x0);var events={'afterCreate':_0xeb03('0x4'),'afterUpdate':_0xeb03('0x5'),'afterDestroy':_0xeb03('0x6')};function emitEvent(_0x474450){return function(_0x3ba4b0,_0x88925b,_0xee2291){_0x3ba4b0['getUsers']({'attributes':['id'],'raw':!![]})[_0xeb03('0x7')](function(_0x3d3322){_0x3ba4b0[_0xeb03('0x8')](_0xeb03('0x9'),_0x3d3322[_0xeb03('0xa')](function(_0x28c772){return{'id':_0x28c772['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3ba4b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb03('0x7')](function(_0x99f4e2){_0x3ba4b0[_0xeb03('0x8')]('unreadMessages',_0x99f4e2[_0xeb03('0xb')]);SmsInteractionEvents['emit'](_0x474450+':'+_0x3ba4b0['id'],_0x3ba4b0);SmsInteractionEvents[_0xeb03('0xc')](_0x474450,_0x3ba4b0);_0xee2291(null);})[_0xeb03('0xd')](_0xee2291(null));};}for(var e in events){if(events[_0xeb03('0xe')](e)){var event=events[e];SmsInteraction[_0xeb03('0xf')](e,emitEvent(event));}}module[_0xeb03('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 901ca6c..1ee0bb9 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 _0x742e=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','./smsInteraction.attributes','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x742e,0x1c7));var _0xe742=function(_0x9a0b48,_0x12004d){_0x9a0b48=_0x9a0b48-0x0;var _0x25f464=_0x742e[_0x9a0b48];return _0x25f464;};'use strict';var _=require(_0xe742('0x0'));var util=require(_0xe742('0x1'));var logger=require(_0xe742('0x2'))(_0xe742('0x3'));var moment=require(_0xe742('0x4'));var BPromise=require(_0xe742('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe742('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe742('0x7'));module[_0xe742('0x8')]=function(_0x252600,_0x3e8808){return _0x252600['define'](_0xe742('0x9'),attributes,{'tableName':_0xe742('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a4e14,_0x29bc20,_0x3808ec){if(_0x3a4e14[_0xe742('0xb')](_0xe742('0xc'))){_0x3a4e14[_0xe742('0xd')]=moment()[_0xe742('0xe')](_0xe742('0xf'));}_0x3808ec(null,_0x3a4e14);}}});}; \ No newline at end of file +var _0x3dc9=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format'];(function(_0x19a6a4,_0x1efec0){var _0x569c90=function(_0x49f3e6){while(--_0x49f3e6){_0x19a6a4['push'](_0x19a6a4['shift']());}};_0x569c90(++_0x1efec0);}(_0x3dc9,0x151));var _0x93dc=function(_0x535d27,_0x3bd9cc){_0x535d27=_0x535d27-0x0;var _0x13aefd=_0x3dc9[_0x535d27];return _0x13aefd;};'use strict';var _=require(_0x93dc('0x0'));var util=require(_0x93dc('0x1'));var logger=require(_0x93dc('0x2'))(_0x93dc('0x3'));var moment=require('moment');var BPromise=require(_0x93dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93dc('0x5'));var rimraf=require(_0x93dc('0x6'));var config=require(_0x93dc('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x93dc('0x8')]=function(_0x5b72d8,_0x195b6a){return _0x5b72d8[_0x93dc('0x9')](_0x93dc('0xa'),attributes,{'tableName':_0x93dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x479537,_0x1ebd83,_0x25eb46){if(_0x479537[_0x93dc('0xc')]('closed')){_0x479537[_0x93dc('0xd')]=moment()[_0x93dc('0xe')](_0x93dc('0xf'));}_0x25eb46(null,_0x479537);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f362e6c..63c4d40 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 _0x370e=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','options','where','attributes','limit','debug','stringify','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','randomstring'];(function(_0x315d41,_0x3d67d1){var _0x557dfa=function(_0x42227f){while(--_0x42227f){_0x315d41['push'](_0x315d41['shift']());}};_0x557dfa(++_0x3d67d1);}(_0x370e,0x1b5));var _0xe370=function(_0x581a04,_0x5b3b77){_0x581a04=_0x581a04-0x0;var _0x26de69=_0x370e[_0x581a04];return _0x26de69;};'use strict';var _=require('lodash');var util=require(_0xe370('0x0'));var moment=require(_0xe370('0x1'));var BPromise=require('bluebird');var rs=require(_0xe370('0x2'));var fs=require('fs');var Redis=require(_0xe370('0x3'));var db=require(_0xe370('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe370('0x5'))(_0xe370('0x6'));var config=require(_0xe370('0x7'));var jayson=require(_0xe370('0x8'));var client=jayson[_0xe370('0x9')][_0xe370('0xa')]({'port':0x232a});config[_0xe370('0xb')]=_[_0xe370('0xc')](config['redis'],{'host':_0xe370('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe370('0xb')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x25bb5d,_0x3b02b4,_0x3aa2da){return new BPromise(function(_0x437437,_0x244623){return client[_0xe370('0xe')](_0x25bb5d,_0x3aa2da)[_0xe370('0xf')](function(_0x49cfdb){logger[_0xe370('0x10')](_0xe370('0x11'),_0x3b02b4,_0xe370('0x12'));logger['debug'](_0xe370('0x13'),_0x3b02b4,'request\x20sent',JSON['stringify'](_0x49cfdb));if(_0x49cfdb['error']){if(_0x49cfdb[_0xe370('0x14')][_0xe370('0x15')]===0x1f4){logger[_0xe370('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x3b02b4,_0x49cfdb['error'][_0xe370('0x16')]);return _0x244623(_0x49cfdb[_0xe370('0x14')][_0xe370('0x16')]);}logger[_0xe370('0x14')](_0xe370('0x11'),_0x3b02b4,_0x49cfdb[_0xe370('0x14')][_0xe370('0x16')]);return _0x437437(_0x49cfdb[_0xe370('0x14')][_0xe370('0x16')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3b02b4,_0xe370('0x12'));_0x437437(_0x49cfdb['result'][_0xe370('0x16')]);}})[_0xe370('0x17')](function(_0x282a02){logger[_0xe370('0x14')](_0xe370('0x11'),_0x3b02b4,_0x282a02);_0x244623(_0x282a02);});});}exports[_0xe370('0x18')]=function(_0x53d92a){var _0x571099=this;return new Promise(function(_0x23574b,_0x2a90f6){return db[_0xe370('0x19')]['update'](_0x53d92a['body'],{'raw':_0x53d92a[_0xe370('0x1a')]?_0x53d92a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53d92a[_0xe370('0x1a')]?_0x53d92a[_0xe370('0x1a')][_0xe370('0x1b')]||null:null,'attributes':_0x53d92a[_0xe370('0x1a')]?_0x53d92a[_0xe370('0x1a')][_0xe370('0x1c')]||null:null,'limit':_0x53d92a[_0xe370('0x1a')]?_0x53d92a[_0xe370('0x1a')][_0xe370('0x1d')]||null:null})[_0xe370('0xf')](function(_0x388419){logger[_0xe370('0x10')](_0xe370('0x18'),_0x53d92a);logger[_0xe370('0x1e')](_0xe370('0x18'),_0x53d92a,JSON[_0xe370('0x1f')](_0x388419));_0x23574b(_0x388419);})[_0xe370('0x17')](function(_0x240a58){logger[_0xe370('0x14')](_0xe370('0x18'),_0x240a58[_0xe370('0x16')],_0x53d92a);_0x2a90f6(_0x571099['error'](0x1f4,_0x240a58[_0xe370('0x16')]));});});};exports[_0xe370('0x20')]=function(_0x15a66e){return new Promise(function(_0x359e36,_0x29a93d){return db[_0xe370('0x19')][_0xe370('0x21')]({'where':_0x15a66e[_0xe370('0x1a')]?_0x15a66e['options'][_0xe370('0x1b')]||null:null})[_0xe370('0xf')](function(_0xa3a922){if(_0xa3a922){return _0xa3a922[_0xe370('0x22')](_0x15a66e[_0xe370('0x23')][_0xe370('0x24')],_[_0xe370('0x25')](_0x15a66e[_0xe370('0x23')],[_0xe370('0x24'),'id'])||{});}})[_0xe370('0x26')](function(_0x10cc4e){logger[_0xe370('0x10')](_0xe370('0x27'),_0x15a66e);logger[_0xe370('0x1e')](_0xe370('0x27'),_0x15a66e,JSON[_0xe370('0x1f')](_0x10cc4e));_0x359e36(_0x10cc4e);})[_0xe370('0x17')](function(_0x5147c6){logger[_0xe370('0x14')](_0xe370('0x27'),_0x5147c6[_0xe370('0x16')],_0x15a66e);_0x29a93d(_this[_0xe370('0x14')](0x1f4,_0x5147c6[_0xe370('0x16')]));});});}; \ No newline at end of file +var _0x5b40=['addTags','ids','omit','body','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','update','options','where','limit','AddTagsToSmsInteraction','SmsInteraction','find'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x5b40,0x1df));var _0x05b4=function(_0x5483e6,_0x2680a6){_0x5483e6=_0x5483e6-0x0;var _0x49ebe5=_0x5b40[_0x5483e6];return _0x49ebe5;};'use strict';var _=require(_0x05b4('0x0'));var util=require(_0x05b4('0x1'));var moment=require(_0x05b4('0x2'));var BPromise=require('bluebird');var rs=require(_0x05b4('0x3'));var fs=require('fs');var Redis=require(_0x05b4('0x4'));var db=require(_0x05b4('0x5'))['db'];var utils=require(_0x05b4('0x6'));var logger=require(_0x05b4('0x7'))(_0x05b4('0x8'));var config=require(_0x05b4('0x9'));var jayson=require(_0x05b4('0xa'));var client=jayson[_0x05b4('0xb')][_0x05b4('0xc')]({'port':0x232a});config[_0x05b4('0xd')]=_[_0x05b4('0xe')](config[_0x05b4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x05b4('0xf'))(new Redis(config[_0x05b4('0xd')]));require(_0x05b4('0x10'))['register'](socket);function respondWithRpcPromise(_0x2edd2c,_0x3c59b4,_0x4494c4){return new BPromise(function(_0x5963df,_0x34d005){return client[_0x05b4('0x11')](_0x2edd2c,_0x4494c4)[_0x05b4('0x12')](function(_0x4a2bca){logger[_0x05b4('0x13')](_0x05b4('0x14'),_0x3c59b4,_0x05b4('0x15'));logger[_0x05b4('0x16')](_0x05b4('0x17'),_0x3c59b4,_0x05b4('0x15'),JSON[_0x05b4('0x18')](_0x4a2bca));if(_0x4a2bca[_0x05b4('0x19')]){if(_0x4a2bca[_0x05b4('0x19')]['code']===0x1f4){logger[_0x05b4('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x3c59b4,_0x4a2bca['error'][_0x05b4('0x1a')]);return _0x34d005(_0x4a2bca[_0x05b4('0x19')][_0x05b4('0x1a')]);}logger[_0x05b4('0x19')](_0x05b4('0x14'),_0x3c59b4,_0x4a2bca['error'][_0x05b4('0x1a')]);return _0x5963df(_0x4a2bca['error'][_0x05b4('0x1a')]);}else{logger[_0x05b4('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x3c59b4,_0x05b4('0x15'));_0x5963df(_0x4a2bca[_0x05b4('0x1b')][_0x05b4('0x1a')]);}})[_0x05b4('0x1c')](function(_0x3fddd5){logger[_0x05b4('0x19')](_0x05b4('0x14'),_0x3c59b4,_0x3fddd5);_0x34d005(_0x3fddd5);});});}exports[_0x05b4('0x1d')]=function(_0x292bbf){var _0x4a2f17=this;return new Promise(function(_0x3e7eb5,_0x5e964b){return db['SmsInteraction'][_0x05b4('0x1e')](_0x292bbf['body'],{'raw':_0x292bbf[_0x05b4('0x1f')]?_0x292bbf[_0x05b4('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292bbf[_0x05b4('0x1f')]?_0x292bbf[_0x05b4('0x1f')][_0x05b4('0x20')]||null:null,'attributes':_0x292bbf[_0x05b4('0x1f')]?_0x292bbf['options']['attributes']||null:null,'limit':_0x292bbf[_0x05b4('0x1f')]?_0x292bbf[_0x05b4('0x1f')][_0x05b4('0x21')]||null:null})[_0x05b4('0x12')](function(_0x3852e7){logger[_0x05b4('0x13')](_0x05b4('0x1d'),_0x292bbf);logger['debug']('UpdateSmsInteraction',_0x292bbf,JSON[_0x05b4('0x18')](_0x3852e7));_0x3e7eb5(_0x3852e7);})[_0x05b4('0x1c')](function(_0x2262f0){logger[_0x05b4('0x19')](_0x05b4('0x1d'),_0x2262f0[_0x05b4('0x1a')],_0x292bbf);_0x5e964b(_0x4a2f17[_0x05b4('0x19')](0x1f4,_0x2262f0['message']));});});};exports[_0x05b4('0x22')]=function(_0x21fc44){return new Promise(function(_0x15d0ec,_0x1b60b6){return db[_0x05b4('0x23')][_0x05b4('0x24')]({'where':_0x21fc44[_0x05b4('0x1f')]?_0x21fc44['options'][_0x05b4('0x20')]||null:null})[_0x05b4('0x12')](function(_0x52da7b){if(_0x52da7b){return _0x52da7b[_0x05b4('0x25')](_0x21fc44['body'][_0x05b4('0x26')],_[_0x05b4('0x27')](_0x21fc44[_0x05b4('0x28')],[_0x05b4('0x26'),'id'])||{});}})[_0x05b4('0x29')](function(_0x15e0e9){logger[_0x05b4('0x13')](_0x05b4('0x2a'),_0x21fc44);logger[_0x05b4('0x16')](_0x05b4('0x2a'),_0x21fc44,JSON['stringify'](_0x15e0e9));_0x15d0ec(_0x15e0e9);})['catch'](function(_0x1e0393){logger[_0x05b4('0x19')]('AddTags',_0x1e0393[_0x05b4('0x1a')],_0x21fc44);_0x1b60b6(_this['error'](0x1f4,_0x1e0393['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d6710b7..265fad4 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 _0x4b1c=['smsInteraction:','save','remove','update','removeListener','length'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x4b1c,0xcd));var _0xc4b1=function(_0x2748fd,_0x251f99){_0x2748fd=_0x2748fd-0x0;var _0x2645c0=_0x4b1c[_0x2748fd];return _0x2645c0;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xc4b1('0x0'),_0xc4b1('0x1'),_0xc4b1('0x2')];function createListener(_0x1370a8,_0x3a5e7a){return function(_0x587b37){_0x3a5e7a['emit'](_0x1370a8,_0x587b37);};}function removeListener(_0xd1dcd,_0x330898){return function(){SmsInteractionEvents[_0xc4b1('0x3')](_0xd1dcd,_0x330898);};}exports['register']=function(_0x40f023){for(var _0x4c2cd3=0x0,_0x586094=events[_0xc4b1('0x4')];_0x4c2cd3<_0x586094;_0x4c2cd3++){var _0x2e086d=events[_0x4c2cd3];var _0x3328d4=createListener(_0xc4b1('0x5')+_0x2e086d,_0x40f023);SmsInteractionEvents['on'](_0x2e086d,_0x3328d4);}}; \ No newline at end of file +var _0x91c0=['removeListener','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91c0,0x1a3));var _0x091c=function(_0x5bac80,_0xe69ecb){_0x5bac80=_0x5bac80-0x0;var _0xbe5015=_0x91c0[_0x5bac80];return _0xbe5015;};'use strict';var SmsInteractionEvents=require(_0x091c('0x0'));var events=[_0x091c('0x1'),_0x091c('0x2'),_0x091c('0x3')];function createListener(_0x3b4f19,_0x5cd41d){return function(_0x39abeb){_0x5cd41d[_0x091c('0x4')](_0x3b4f19,_0x39abeb);};}function removeListener(_0x53dfb9,_0xcb69b2){return function(){SmsInteractionEvents[_0x091c('0x5')](_0x53dfb9,_0xcb69b2);};}exports['register']=function(_0x14d930){for(var _0x54ac84=0x0,_0x5ae9cc=events[_0x091c('0x6')];_0x54ac84<_0x5ae9cc;_0x54ac84++){var _0x7572f=events[_0x54ac84];var _0x1ab042=createListener(_0x091c('0x7')+_0x7572f,_0x14d930);SmsInteractionEvents['on'](_0x7572f,_0x1ab042);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index fe41e68..efd0d8d 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 _0xd9b6=['/:id/accept','accept','/:id/reject','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','tracked','smsmessage:create','create','status','put','update'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0xd9b6,0x17b));var _0x6d9b=function(_0x42701f,_0x3d2f90){_0x42701f=_0x42701f-0x0;var _0x36aafb=_0xd9b6[_0x42701f];return _0x36aafb;};'use strict';var multer=require(_0x6d9b('0x0'));var util=require(_0x6d9b('0x1'));var path=require(_0x6d9b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d9b('0x3')]();var fs_extra=require(_0x6d9b('0x4'));var auth=require(_0x6d9b('0x5'));var interaction=require(_0x6d9b('0x6'));var config=require(_0x6d9b('0x7'));var controller=require(_0x6d9b('0x8'));router[_0x6d9b('0x9')]('/',auth[_0x6d9b('0xa')](),controller['index']);router[_0x6d9b('0x9')](_0x6d9b('0xb'),auth[_0x6d9b('0xa')](),controller[_0x6d9b('0xc')]);router[_0x6d9b('0x9')](_0x6d9b('0xd'),auth[_0x6d9b('0xa')](),controller['show']);router[_0x6d9b('0xe')]('/',auth[_0x6d9b('0xa')](),interaction[_0x6d9b('0xf')]('sms',_0x6d9b('0x10')),controller[_0x6d9b('0x11')]);router[_0x6d9b('0xe')]('/:id/status',controller[_0x6d9b('0x12')]);router[_0x6d9b('0x13')](_0x6d9b('0xd'),auth['isAuthenticated'](),controller[_0x6d9b('0x14')]);router[_0x6d9b('0x13')](_0x6d9b('0x15'),auth[_0x6d9b('0xa')](),controller[_0x6d9b('0x16')]);router[_0x6d9b('0x13')](_0x6d9b('0x17'),auth[_0x6d9b('0xa')](),controller['reject']);router[_0x6d9b('0x18')](_0x6d9b('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x77ed=['/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','tracked','sms','create','post','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x2b90f1,_0x5d0db7){var _0x16baae=function(_0x5de285){while(--_0x5de285){_0x2b90f1['push'](_0x2b90f1['shift']());}};_0x16baae(++_0x5d0db7);}(_0x77ed,0x11c));var _0xd77e=function(_0x35dbb4,_0x16e0a7){_0x35dbb4=_0x35dbb4-0x0;var _0x9dc31b=_0x77ed[_0x35dbb4];return _0x9dc31b;};'use strict';var multer=require(_0xd77e('0x0'));var util=require(_0xd77e('0x1'));var path=require('path');var timeout=require(_0xd77e('0x2'));var express=require(_0xd77e('0x3'));var router=express[_0xd77e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd77e('0x5'));var interaction=require(_0xd77e('0x6'));var config=require(_0xd77e('0x7'));var controller=require(_0xd77e('0x8'));router[_0xd77e('0x9')]('/',auth[_0xd77e('0xa')](),controller[_0xd77e('0xb')]);router[_0xd77e('0x9')]('/describe',auth[_0xd77e('0xa')](),controller[_0xd77e('0xc')]);router[_0xd77e('0x9')](_0xd77e('0xd'),auth[_0xd77e('0xa')](),controller['show']);router['post']('/',auth[_0xd77e('0xa')](),interaction[_0xd77e('0xe')](_0xd77e('0xf'),'smsmessage:create'),controller[_0xd77e('0x10')]);router[_0xd77e('0x11')](_0xd77e('0x12'),controller[_0xd77e('0x13')]);router[_0xd77e('0x14')](_0xd77e('0xd'),auth[_0xd77e('0xa')](),controller[_0xd77e('0x15')]);router[_0xd77e('0x14')](_0xd77e('0x16'),auth[_0xd77e('0xa')](),controller[_0xd77e('0x17')]);router['put'](_0xd77e('0x18'),auth[_0xd77e('0xa')](),controller['reject']);router[_0xd77e('0x19')](_0xd77e('0xd'),auth[_0xd77e('0xa')](),controller[_0xd77e('0x1a')]);module[_0xd77e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d6f4d81..14b6e90 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 _0xa24e=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x291f2a,_0x2a038c){var _0x1ad874=function(_0x4a0f90){while(--_0x4a0f90){_0x291f2a['push'](_0x291f2a['shift']());}};_0x1ad874(++_0x2a038c);}(_0xa24e,0x137));var _0xea24=function(_0xbe1b2d,_0xcae67c){_0xbe1b2d=_0xbe1b2d-0x0;var _0x1e38a3=_0xa24e[_0xbe1b2d];return _0x1e38a3;};'use strict';var Sequelize=require(_0xea24('0x0'));module[_0xea24('0x1')]={'body':{'type':Sequelize[_0xea24('0x2')](_0xea24('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xea24('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xea24('0x5')]('in',_0xea24('0x6')),'defaultValue':_0xea24('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xea24('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xea24('0x8')]},'secret':{'type':Sequelize[_0xea24('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xea24('0x7')]},'providerResponse':{'type':Sequelize[_0xea24('0x2')]}}; \ No newline at end of file +var _0x67de=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2407aa,_0xb8aea8){var _0x5be353=function(_0x3a3422){while(--_0x3a3422){_0x2407aa['push'](_0x2407aa['shift']());}};_0x5be353(++_0xb8aea8);}(_0x67de,0x1ba));var _0xe67d=function(_0x3e2a68,_0x45f67e){_0x3e2a68=_0x3e2a68-0x0;var _0xcef2d3=_0x67de[_0x3e2a68];return _0xcef2d3;};'use strict';var Sequelize=require(_0xe67d('0x0'));module[_0xe67d('0x1')]={'body':{'type':Sequelize[_0xe67d('0x2')](_0xe67d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe67d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe67d('0x5')]('in',_0xe67d('0x6')),'defaultValue':_0xe67d('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe67d('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe67d('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe67d('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe67d('0x7')]},'providerResponse':{'type':Sequelize[_0xe67d('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 85209ed..2beb74d 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 _0x49d9=['EventManager','acceptmessage','sms-interactions','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','fullname','email','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','plivio','results','groupName','DELIVERED','infobip','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','http','client','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','includeAll','include','SmsMessage','findAll','options','find','create','body','params','describe','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','isNil','read1stAt','format','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','QueryTypes','SELECT','User','internal','manual','interface','SIP/%s','channel','motionChannel'];(function(_0x4bce9a,_0x31e325){var _0x4ed97a=function(_0x455891){while(--_0x455891){_0x4bce9a['push'](_0x4bce9a['shift']());}};_0x4ed97a(++_0x31e325);}(_0x49d9,0x13e));var _0x949d=function(_0x3790c5,_0x583e9f){_0x3790c5=_0x3790c5-0x0;var _0x38da5e=_0x49d9[_0x3790c5];return _0x38da5e;};'use strict';var emlformat=require(_0x949d('0x0'));var rimraf=require(_0x949d('0x1'));var zipdir=require(_0x949d('0x2'));var jsonpatch=require(_0x949d('0x3'));var rp=require(_0x949d('0x4'));var moment=require('moment');var BPromise=require(_0x949d('0x5'));var Mustache=require(_0x949d('0x6'));var util=require(_0x949d('0x7'));var path=require(_0x949d('0x8'));var sox=require(_0x949d('0x9'));var csv=require('to-csv');var ejs=require(_0x949d('0xa'));var fs=require('fs');var fs_extra=require(_0x949d('0xb'));var _=require(_0x949d('0xc'));var squel=require(_0x949d('0xd'));var crypto=require(_0x949d('0xe'));var jsforce=require(_0x949d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x949d('0x10'));var querystring=require(_0x949d('0x11'));var Papa=require(_0x949d('0x12'));var Redis=require('ioredis');var authService=require(_0x949d('0x13'));var qs=require(_0x949d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x949d('0x15'));var logger=require(_0x949d('0x16'))(_0x949d('0x17'));var utils=require(_0x949d('0x18'));var config=require(_0x949d('0x19'));var licenseUtil=require(_0x949d('0x1a'));var db=require(_0x949d('0x1b'))['db'];config[_0x949d('0x1c')]=_['defaults'](config['redis'],{'host':_0x949d('0x1d'),'port':0x18eb});var socket=require(_0x949d('0x1e'))(new Redis(config[_0x949d('0x1c')]));require(_0x949d('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x949d('0x20')]({'port':0x232c});var client9002=jayson[_0x949d('0x21')][_0x949d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1fa673,_0x198fd1,_0x156007,_0x28c004){return new BPromise(function(_0xf4a980,_0x2628d8){var _0x220288=_0x28c004||client;return _0x220288[_0x949d('0x22')](_0x1fa673,_0x156007)[_0x949d('0x23')](function(_0x4597d0){logger[_0x949d('0x24')]('SmsMessage,\x20%s,\x20%s',_0x198fd1,_0x949d('0x25'));logger[_0x949d('0x26')](_0x949d('0x27'),_0x198fd1,_0x949d('0x25'),JSON[_0x949d('0x28')](_0x4597d0));if(_0x4597d0[_0x949d('0x29')]){if(_0x4597d0[_0x949d('0x29')][_0x949d('0x2a')]===0x1f4){logger['error'](_0x949d('0x2b'),_0x198fd1,_0x4597d0[_0x949d('0x29')]['message']);return _0x2628d8(_0x4597d0[_0x949d('0x29')][_0x949d('0x2c')]);}logger[_0x949d('0x29')]('SmsMessage,\x20%s,\x20%s',_0x198fd1,_0x4597d0[_0x949d('0x29')][_0x949d('0x2c')]);return _0xf4a980(_0x4597d0[_0x949d('0x29')][_0x949d('0x2c')]);}else{logger[_0x949d('0x24')](_0x949d('0x2b'),_0x198fd1,_0x949d('0x25'));_0xf4a980(_0x4597d0[_0x949d('0x2d')][_0x949d('0x2c')]);}})[_0x949d('0x2e')](function(_0x156362){logger[_0x949d('0x29')](_0x949d('0x2b'),_0x198fd1,_0x156362);_0x2628d8(_0x156362);});});}function respondWithStatusCode(_0xf4d4c7,_0x279460){_0x279460=_0x279460||0xcc;return function(_0x19f75d){if(_0x19f75d){return _0xf4d4c7['sendStatus'](_0x279460);}return _0xf4d4c7[_0x949d('0x2f')](_0x279460)[_0x949d('0x30')]();};}function respondWithResult(_0xd250b,_0x2adc4a){_0x2adc4a=_0x2adc4a||0xc8;return function(_0x4f9aa3){if(_0x4f9aa3){return _0xd250b[_0x949d('0x2f')](_0x2adc4a)[_0x949d('0x31')](_0x4f9aa3);}};}function respondWithFilteredResult(_0xf20d1f,_0x16e63a){return function(_0x5c9930){if(_0x5c9930){var _0x4cfb04=typeof _0x16e63a[_0x949d('0x32')]===_0x949d('0x33')&&typeof _0x16e63a[_0x949d('0x34')]===_0x949d('0x33');var _0x362b0c=_0x5c9930[_0x949d('0x35')];var _0x30e71f=_0x4cfb04?0x0:_0x16e63a[_0x949d('0x32')];var _0x5c54a0=_0x4cfb04?_0x5c9930[_0x949d('0x35')]:_0x16e63a[_0x949d('0x32')]+_0x16e63a[_0x949d('0x34')];var _0x11039f;if(_0x5c54a0>=_0x362b0c){_0x5c54a0=_0x362b0c;_0x11039f=0xc8;}else{_0x11039f=0xce;}_0xf20d1f['status'](_0x11039f);return _0xf20d1f[_0x949d('0x36')](_0x949d('0x37'),_0x30e71f+'-'+_0x5c54a0+'/'+_0x362b0c)[_0x949d('0x31')](_0x5c9930);}return null;};}function patchUpdates(_0x6a14f4){return function(_0x3e06d9){try{jsonpatch[_0x949d('0x38')](_0x3e06d9,_0x6a14f4,!![]);}catch(_0x1d7736){return BPromise[_0x949d('0x39')](_0x1d7736);}return _0x3e06d9[_0x949d('0x3a')]();};}function saveUpdates(_0x5bcc58,_0x152188){return function(_0x3820e9){if(_0x3820e9){return _0x3820e9[_0x949d('0x3b')](_0x5bcc58)['then'](function(_0x262057){return _0x262057;});}return null;};}function removeEntity(_0x2c75de,_0x5eebb8){return function(_0x3ac990){if(_0x3ac990){return _0x3ac990[_0x949d('0x3c')]()['then'](function(){_0x2c75de[_0x949d('0x2f')](0xcc)[_0x949d('0x30')]();});}};}function handleEntityNotFound(_0x246713,_0x373002){return function(_0x204295){if(!_0x204295){_0x246713['sendStatus'](0x194);}return _0x204295;};}function handleError(_0xc108a3,_0x42f5fd){_0x42f5fd=_0x42f5fd||0x1f4;return function(_0x4b261d){logger[_0x949d('0x29')](_0x4b261d['stack']);if(_0x4b261d[_0x949d('0x3d')]){delete _0x4b261d['name'];}_0xc108a3[_0x949d('0x2f')](_0x42f5fd)[_0x949d('0x3e')](_0x4b261d);};}exports[_0x949d('0x3f')]=function(_0x105e04,_0x357cd5){var _0x5f20d4={},_0x6572df={},_0x13e8d8={'count':0x0,'rows':[]};var _0x15db02=_[_0x949d('0x40')](db['SmsMessage'][_0x949d('0x41')],function(_0x4c622d){return{'name':_0x4c622d[_0x949d('0x42')],'type':_0x4c622d[_0x949d('0x43')][_0x949d('0x44')]};});_0x6572df[_0x949d('0x45')]=_[_0x949d('0x40')](_0x15db02,_0x949d('0x3d'));_0x6572df[_0x949d('0x46')]=_[_0x949d('0x47')](_0x105e04['query']);_0x6572df[_0x949d('0x48')]=_[_0x949d('0x49')](_0x6572df[_0x949d('0x45')],_0x6572df['query']);_0x5f20d4[_0x949d('0x4a')]=_['intersection'](_0x6572df[_0x949d('0x45')],qs[_0x949d('0x4b')](_0x105e04[_0x949d('0x46')][_0x949d('0x4b')]));_0x5f20d4[_0x949d('0x4a')]=_0x5f20d4['attributes'][_0x949d('0x4c')]?_0x5f20d4[_0x949d('0x4a')]:_0x6572df[_0x949d('0x45')];if(!_0x105e04[_0x949d('0x46')]['hasOwnProperty'](_0x949d('0x4d'))){_0x5f20d4[_0x949d('0x34')]=qs[_0x949d('0x34')](_0x105e04[_0x949d('0x46')][_0x949d('0x34')]);_0x5f20d4[_0x949d('0x32')]=qs[_0x949d('0x32')](_0x105e04[_0x949d('0x46')][_0x949d('0x32')]);}_0x5f20d4['order']=qs[_0x949d('0x4e')](_0x105e04['query'][_0x949d('0x4e')]);_0x5f20d4[_0x949d('0x4f')]=qs[_0x949d('0x48')](_['pick'](_0x105e04['query'],_0x6572df['filters']),_0x15db02);if(_0x105e04[_0x949d('0x46')][_0x949d('0x50')]){_0x5f20d4['where']=_[_0x949d('0x51')](_0x5f20d4[_0x949d('0x4f')],{'$or':_['map'](_0x15db02,function(_0x42fe45){if(_0x42fe45[_0x949d('0x43')]!=='VIRTUAL'){var _0xac37ec={};_0xac37ec[_0x42fe45[_0x949d('0x3d')]]={'$like':'%'+_0x105e04[_0x949d('0x46')][_0x949d('0x50')]+'%'};return _0xac37ec;}})});}_0x5f20d4=_['merge']({},_0x5f20d4,_0x105e04['options']);var _0x504c6b={'where':_0x5f20d4['where']};return db['SmsMessage'][_0x949d('0x35')](_0x504c6b)['then'](function(_0x5e9f7e){_0x13e8d8[_0x949d('0x35')]=_0x5e9f7e;if(_0x105e04[_0x949d('0x46')][_0x949d('0x52')]){_0x5f20d4[_0x949d('0x53')]=[{'all':!![]}];}return db[_0x949d('0x54')][_0x949d('0x55')](_0x5f20d4);})[_0x949d('0x23')](function(_0x3caf2e){_0x13e8d8['rows']=_0x3caf2e;return _0x13e8d8;})[_0x949d('0x23')](respondWithFilteredResult(_0x357cd5,_0x5f20d4))[_0x949d('0x2e')](handleError(_0x357cd5,null));};exports['show']=function(_0x22da6d,_0x537b8b){var _0x4f6ed3={'raw':!![],'where':{'id':_0x22da6d['params']['id']}},_0x237e3f={};_0x237e3f[_0x949d('0x45')]=_[_0x949d('0x47')](db[_0x949d('0x54')][_0x949d('0x41')]);_0x237e3f[_0x949d('0x46')]=_[_0x949d('0x47')](_0x22da6d[_0x949d('0x46')]);_0x237e3f['filters']=_[_0x949d('0x49')](_0x237e3f[_0x949d('0x45')],_0x237e3f[_0x949d('0x46')]);_0x4f6ed3[_0x949d('0x4a')]=_[_0x949d('0x49')](_0x237e3f[_0x949d('0x45')],qs['fields'](_0x22da6d[_0x949d('0x46')][_0x949d('0x4b')]));_0x4f6ed3[_0x949d('0x4a')]=_0x4f6ed3[_0x949d('0x4a')][_0x949d('0x4c')]?_0x4f6ed3['attributes']:_0x237e3f[_0x949d('0x45')];if(_0x22da6d[_0x949d('0x46')][_0x949d('0x52')]){_0x4f6ed3['include']=[{'all':!![]}];}_0x4f6ed3=_[_0x949d('0x51')]({},_0x4f6ed3,_0x22da6d[_0x949d('0x56')]);return db[_0x949d('0x54')][_0x949d('0x57')](_0x4f6ed3)[_0x949d('0x23')](handleEntityNotFound(_0x537b8b,null))['then'](respondWithResult(_0x537b8b,null))[_0x949d('0x2e')](handleError(_0x537b8b,null));};exports[_0x949d('0x58')]=function(_0xab6e5,_0x491966){return db['SmsMessage']['create'](_0xab6e5[_0x949d('0x59')],{})[_0x949d('0x23')](respondWithResult(_0x491966,0xc9))[_0x949d('0x2e')](handleError(_0x491966,null));};exports[_0x949d('0x3b')]=function(_0x2f6f51,_0x1ddd63){if(_0x2f6f51[_0x949d('0x59')]['id']){delete _0x2f6f51[_0x949d('0x59')]['id'];}return db[_0x949d('0x54')]['find']({'where':{'id':_0x2f6f51[_0x949d('0x5a')]['id']}})[_0x949d('0x23')](handleEntityNotFound(_0x1ddd63,null))[_0x949d('0x23')](saveUpdates(_0x2f6f51['body'],null))[_0x949d('0x23')](respondWithResult(_0x1ddd63,null))[_0x949d('0x2e')](handleError(_0x1ddd63,null));};exports[_0x949d('0x3c')]=function(_0x72a035,_0x3255ff){return db['SmsMessage']['find']({'where':{'id':_0x72a035[_0x949d('0x5a')]['id']}})[_0x949d('0x23')](handleEntityNotFound(_0x3255ff,null))[_0x949d('0x23')](removeEntity(_0x3255ff,null))[_0x949d('0x2e')](handleError(_0x3255ff,null));};exports[_0x949d('0x5b')]=function(_0x136285,_0x58448a){return db['SmsMessage'][_0x949d('0x5b')]()['then'](respondWithResult(_0x58448a,null))[_0x949d('0x2e')](handleError(_0x58448a,null));};var interaction_log=require(_0x949d('0x16'))('sms-interactions');exports[_0x949d('0x5c')]=function(_0x258f55,_0x59caea,_0x8036aa){var _0x293e7b={'agent':{},'channel':_0x949d('0x5d')};if(_0x258f55[_0x949d('0x59')]['id']){delete _0x258f55[_0x949d('0x59')]['id'];}_0x258f55[_0x949d('0x59')][_0x949d('0x5e')]=!![];_0x258f55[_0x949d('0x59')][_0x949d('0x5f')]=moment()['format'](_0x949d('0x60'));_0x258f55['body'][_0x949d('0x61')]=_0x258f55[_0x949d('0x59')][_0x949d('0x61')]||_0x258f55[_0x949d('0x62')]['id'];_0x293e7b[_0x949d('0x63')]['id']=_0x258f55['body'][_0x949d('0x61')];return db[_0x949d('0x54')][_0x949d('0x57')]({'where':{'id':_0x258f55[_0x949d('0x5a')]['id'],'UserId':null}})[_0x949d('0x23')](handleEntityNotFound(_0x59caea,null))[_0x949d('0x23')](saveUpdates(_0x258f55[_0x949d('0x59')],null))[_0x949d('0x23')](function(_0x139c71){if(_0x139c71){_0x293e7b[_0x949d('0x2c')]=_0x139c71['get']({'plain':!![]});return db[_0x949d('0x64')][_0x949d('0x57')]({'where':{'id':_0x139c71['SmsInteractionId']}});}return null;})[_0x949d('0x23')](handleEntityNotFound(_0x59caea,null))[_0x949d('0x23')](function(_0x3f0994){if(_0x3f0994){return _0x3f0994[_0x949d('0x3b')]({'UserId':_0x258f55[_0x949d('0x59')][_0x949d('0x61')],'read1stAt':_[_0x949d('0x65')](_0x3f0994[_0x949d('0x66')])?moment()[_0x949d('0x67')](_0x949d('0x60')):undefined});}return null;})[_0x949d('0x23')](function(_0x3892f3){if(_0x3892f3){_0x293e7b[_0x949d('0x68')]=_0x3892f3[_0x949d('0x69')]({'plain':!![]});interaction_log['info'](_0x949d('0x6a'),_0x258f55['user']['id'],_0x258f55[_0x949d('0x62')]['name'],_0x258f55[_0x949d('0x62')]['role'],_0x293e7b[_0x949d('0x68')]['id'],_0x258f55[_0x949d('0x59')]?JSON[_0x949d('0x28')](_0x258f55[_0x949d('0x59')]):_0x949d('0x6b'));return respondWithRpcPromise(_0x949d('0x6c'),_0x949d('0x6d'),_0x293e7b);}return null;})[_0x949d('0x23')](function(_0x12ced6){var _0x4783c5=_0x949d('0x6e')+_0x12ced6[_0x949d('0x2c')][_0x949d('0x6f')];return db[_0x949d('0x70')][_0x949d('0x46')](_0x4783c5,{'type':db[_0x949d('0x71')][_0x949d('0x72')][_0x949d('0x73')],'raw':!![]})[_0x949d('0x23')](function(_0x23368b){return _0x23368b;});})[_0x949d('0x23')](function(_0x57ec85){if(_0x57ec85){_0x293e7b['message']['contact']=_0x57ec85[0x0];if(!_0x258f55[_0x949d('0x59')][_0x949d('0x61')])return;return db[_0x949d('0x74')][_0x949d('0x57')]({'where':{'id':_0x258f55[_0x949d('0x59')][_0x949d('0x61')],'role':_0x949d('0x63')},'attributes':['id','name','fullname','email',_0x949d('0x75')],'raw':!![]});}return null;})['then'](function(_0x471ff9){if(!_0x471ff9)return null;_0x293e7b[_0x949d('0x2c')][_0x949d('0x63')]=_0x471ff9;return _0x293e7b;})[_0x949d('0x23')](function(_0x421143){if(_0x421143){if(_0x258f55[_0x949d('0x59')][_0x949d('0x76')]){_0x293e7b['message'][_0x949d('0x77')]=util[_0x949d('0x67')](_0x949d('0x78'),_0x258f55[_0x949d('0x62')]['name']);_0x293e7b[_0x949d('0x2c')][_0x949d('0x79')]=_0x293e7b[_0x949d('0x79')];_0x293e7b[_0x949d('0x2c')][_0x949d('0x7a')]=_0x293e7b[_0x949d('0x79')];_0x293e7b[_0x949d('0x2c')]['event']=_0x949d('0x5c');return respondWithRpcPromise(_0x949d('0x7b'),_0x949d('0x7b'),{'event':_0x949d('0x7c'),'message':_0x293e7b[_0x949d('0x2c')]},client9002)[_0x949d('0x23')](function(){return _0x293e7b;});}return _0x293e7b;}return null;})[_0x949d('0x23')](respondWithResult(_0x59caea,null))[_0x949d('0x2e')](handleError(_0x59caea,null));};var interaction_log=require('../../config/logger')(_0x949d('0x7d'));exports[_0x949d('0x39')]=function(_0x57a461,_0x371130,_0x3cd779){var _0x2e2701={'agent':{},'channel':_0x949d('0x5d')};if(_0x57a461['body']['id']){delete _0x57a461[_0x949d('0x59')]['id'];}_0x57a461[_0x949d('0x59')][_0x949d('0x61')]=_0x57a461[_0x949d('0x59')][_0x949d('0x61')]||_0x57a461['user']['id'];_0x2e2701['agent']['id']=_0x57a461[_0x949d('0x59')]['UserId'];return db['SmsMessage'][_0x949d('0x57')]({'where':{'id':_0x57a461[_0x949d('0x5a')]['id'],'UserId':null}})[_0x949d('0x23')](handleEntityNotFound(_0x371130,null))[_0x949d('0x23')](function(_0x4de398){if(_0x4de398){_0x2e2701[_0x949d('0x2c')]=_0x4de398['get']({'plain':!![]});return db[_0x949d('0x64')]['find']({'where':{'id':_0x4de398[_0x949d('0x7e')]}});}return null;})[_0x949d('0x23')](handleEntityNotFound(_0x371130,null))[_0x949d('0x23')](function(_0x3dfff9){if(_0x3dfff9){_0x2e2701[_0x949d('0x68')]=_0x3dfff9[_0x949d('0x69')]({'plain':!![]});interaction_log[_0x949d('0x24')](_0x949d('0x7f'),_0x57a461[_0x949d('0x62')]['id'],_0x57a461[_0x949d('0x62')][_0x949d('0x3d')],_0x57a461[_0x949d('0x62')]['role'],_0x2e2701[_0x949d('0x68')]['id'],_0x57a461[_0x949d('0x59')]?JSON[_0x949d('0x28')](_0x57a461[_0x949d('0x59')]):'null');return respondWithRpcPromise(_0x949d('0x80'),_0x949d('0x81'),_0x2e2701);}return null;})[_0x949d('0x23')](function(_0x6bd7b9){var _0x3247b0=_0x949d('0x6e')+_0x6bd7b9['message'][_0x949d('0x6f')];return db['sequelize']['query'](_0x3247b0,{'type':db['Sequelize'][_0x949d('0x72')][_0x949d('0x73')],'raw':!![]})[_0x949d('0x23')](function(_0x437e94){return _0x437e94;});})[_0x949d('0x23')](function(_0x3ba11c){if(_0x3ba11c){_0x2e2701[_0x949d('0x2c')][_0x949d('0x82')]=_0x3ba11c[0x0];if(!_0x57a461['body'][_0x949d('0x61')])return;return db[_0x949d('0x74')]['find']({'where':{'id':_0x57a461[_0x949d('0x59')][_0x949d('0x61')],'role':_0x949d('0x63')},'attributes':['id',_0x949d('0x3d'),_0x949d('0x83'),_0x949d('0x84'),_0x949d('0x75')],'raw':!![]});}return null;})[_0x949d('0x23')](function(_0x33a24d){if(!_0x33a24d)return null;_0x2e2701[_0x949d('0x2c')]['agent']=_0x33a24d;return _0x2e2701;})[_0x949d('0x23')](function(_0x1ef297){if(_0x1ef297){_0x1ef297[_0x949d('0x2c')][_0x949d('0x77')]=util[_0x949d('0x67')]('SIP/%s',_0x57a461['user']['name']);_0x1ef297['message']['channel']=_0x2e2701['channel'];_0x1ef297[_0x949d('0x2c')]['motionChannel']=_0x2e2701['channel'];_0x1ef297[_0x949d('0x2c')]['event']=_0x949d('0x39');respondWithRpcPromise(_0x949d('0x7b'),_0x949d('0x7b'),{'event':'rejectmessage','message':_0x1ef297['message']},client9002);return _0x2e2701;}return null;})[_0x949d('0x23')](respondWithResult(_0x371130,null))[_0x949d('0x2e')](handleError(_0x371130,null));};exports['status']=function(_0x4a8e45,_0x40b452,_0x7526a4){if(_0x4a8e45[_0x949d('0x59')]['id']){delete _0x4a8e45[_0x949d('0x59')]['id'];}var _0x1f7288;return db['SmsMessage'][_0x949d('0x57')]({'where':{'id':_0x4a8e45[_0x949d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x40b452,null))[_0x949d('0x23')](function(_0x2bb965){if(_0x2bb965){_0x1f7288=_0x2bb965;return db[_0x949d('0x85')][_0x949d('0x57')]({'where':{'id':_0x2bb965['SmsAccountId']}});}})[_0x949d('0x23')](handleEntityNotFound(_0x40b452,null))[_0x949d('0x23')](function(_0x3ec1c3){if(_0x3ec1c3){logger['debug'](_0x949d('0x27'),_0x949d('0x2f'),_0x949d('0x86'),_0x3ec1c3[_0x949d('0x43')],util[_0x949d('0x87')](_0x4a8e45[_0x949d('0x59')],{'showHidden':![],'depth':null}));switch(_0x3ec1c3[_0x949d('0x43')]){case _0x949d('0x88'):if(_0x4a8e45[_0x949d('0x59')][_0x949d('0x89')]&&_0x4a8e45['body'][_0x949d('0x89')]===_0x1f7288[_0x949d('0x8a')]){return _0x1f7288[_0x949d('0x3b')]({'read':!![]});}else{logger['error'](_0x949d('0x8b'),_0x949d('0x2f'),_0x949d('0x88'),util[_0x949d('0x87')](_0x4a8e45[_0x949d('0x59')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4a8e45[_0x949d('0x59')][_0x949d('0x8c')]&&_0x4a8e45[_0x949d('0x59')][_0x949d('0x8c')]===_0x1f7288[_0x949d('0x8a')]&&_['indexOf']([_0x949d('0x8d'),'delivered'],_0x4a8e45[_0x949d('0x59')]['Status'])>=0x0){return _0x1f7288[_0x949d('0x3b')]({'read':!![]});}else{logger[_0x949d('0x29')](_0x949d('0x8b'),_0x949d('0x2f'),_0x949d('0x8e'),util[_0x949d('0x87')](_0x4a8e45[_0x949d('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5036ac=_0x4a8e45[_0x949d('0x59')][_0x949d('0x8f')][0x0];if(_0x5036ac[_0x949d('0x2f')][_0x949d('0x90')]===_0x949d('0x91')){return _0x1f7288[_0x949d('0x3b')]({'read':!![]});}else{logger[_0x949d('0x29')](_0x949d('0x8b'),_0x949d('0x2f'),_0x949d('0x92'),util['inspect'](_0x4a8e45[_0x949d('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1f7288;}})[_0x949d('0x23')](respondWithResult(_0x40b452,null))[_0x949d('0x2e')](handleError(_0x40b452,null));}; \ No newline at end of file +var _0xbb61=['SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','json','offset','undefined','limit','status','Content-Range','apply','save','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','params','include','find','create','body','describe','../../config/logger','accept','sms','format','UserId','agent','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','reject','RejectMessage','rejectMessage','ContactId','SmsAccount','SmsAccountId','debug','inspect','twilio','MessageSid','messageId'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbb61,0x131));var _0x1bb6=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xbb61[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require(_0x1bb6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bb6('0x1'));var jsonpatch=require(_0x1bb6('0x2'));var rp=require(_0x1bb6('0x3'));var moment=require(_0x1bb6('0x4'));var BPromise=require(_0x1bb6('0x5'));var Mustache=require(_0x1bb6('0x6'));var util=require(_0x1bb6('0x7'));var path=require('path');var sox=require(_0x1bb6('0x8'));var csv=require(_0x1bb6('0x9'));var ejs=require(_0x1bb6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bb6('0xb'));var squel=require(_0x1bb6('0xc'));var crypto=require(_0x1bb6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1bb6('0xe'));var toCsv=require(_0x1bb6('0x9'));var querystring=require(_0x1bb6('0xf'));var Papa=require(_0x1bb6('0x10'));var Redis=require(_0x1bb6('0x11'));var authService=require(_0x1bb6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1bb6('0x13'));var hardwareService=require(_0x1bb6('0x14'));var logger=require('../../config/logger')(_0x1bb6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1bb6('0x16')]=_[_0x1bb6('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1bb6('0x18'))(new Redis(config[_0x1bb6('0x16')]));require(_0x1bb6('0x19'))[_0x1bb6('0x1a')](socket);var jayson=require(_0x1bb6('0x1b'));var client=jayson[_0x1bb6('0x1c')][_0x1bb6('0x1d')]({'port':0x232c});var client9002=jayson[_0x1bb6('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3856f7,_0x1c802b,_0x476d81,_0x2fce2f){return new BPromise(function(_0x583711,_0x553709){var _0x10fd13=_0x2fce2f||client;return _0x10fd13[_0x1bb6('0x1e')](_0x3856f7,_0x476d81)[_0x1bb6('0x1f')](function(_0x5015bf){logger[_0x1bb6('0x20')]('SmsMessage,\x20%s,\x20%s',_0x1c802b,_0x1bb6('0x21'));logger['debug'](_0x1bb6('0x22'),_0x1c802b,_0x1bb6('0x21'),JSON[_0x1bb6('0x23')](_0x5015bf));if(_0x5015bf[_0x1bb6('0x24')]){if(_0x5015bf[_0x1bb6('0x24')][_0x1bb6('0x25')]===0x1f4){logger[_0x1bb6('0x24')](_0x1bb6('0x26'),_0x1c802b,_0x5015bf[_0x1bb6('0x24')]['message']);return _0x553709(_0x5015bf[_0x1bb6('0x24')][_0x1bb6('0x27')]);}logger['error'](_0x1bb6('0x26'),_0x1c802b,_0x5015bf[_0x1bb6('0x24')][_0x1bb6('0x27')]);return _0x583711(_0x5015bf[_0x1bb6('0x24')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1c802b,'request\x20sent');_0x583711(_0x5015bf['result'][_0x1bb6('0x27')]);}})[_0x1bb6('0x28')](function(_0x104bf5){logger['error'](_0x1bb6('0x26'),_0x1c802b,_0x104bf5);_0x553709(_0x104bf5);});});}function respondWithStatusCode(_0x8e8b4a,_0x8941a5){_0x8941a5=_0x8941a5||0xcc;return function(_0x320512){if(_0x320512){return _0x8e8b4a[_0x1bb6('0x29')](_0x8941a5);}return _0x8e8b4a['status'](_0x8941a5)['end']();};}function respondWithResult(_0x556672,_0x736c70){_0x736c70=_0x736c70||0xc8;return function(_0x4d109d){if(_0x4d109d){return _0x556672['status'](_0x736c70)[_0x1bb6('0x2a')](_0x4d109d);}};}function respondWithFilteredResult(_0x501cb3,_0x5c7bde){return function(_0x18526d){if(_0x18526d){var _0xf42d9=typeof _0x5c7bde[_0x1bb6('0x2b')]===_0x1bb6('0x2c')&&typeof _0x5c7bde['limit']===_0x1bb6('0x2c');var _0x2eb3cb=_0x18526d['count'];var _0x38a385=_0xf42d9?0x0:_0x5c7bde[_0x1bb6('0x2b')];var _0x47fc5d=_0xf42d9?_0x18526d['count']:_0x5c7bde[_0x1bb6('0x2b')]+_0x5c7bde[_0x1bb6('0x2d')];var _0x30d0ad;if(_0x47fc5d>=_0x2eb3cb){_0x47fc5d=_0x2eb3cb;_0x30d0ad=0xc8;}else{_0x30d0ad=0xce;}_0x501cb3[_0x1bb6('0x2e')](_0x30d0ad);return _0x501cb3['set'](_0x1bb6('0x2f'),_0x38a385+'-'+_0x47fc5d+'/'+_0x2eb3cb)[_0x1bb6('0x2a')](_0x18526d);}return null;};}function patchUpdates(_0x4f8565){return function(_0x2ad17d){try{jsonpatch[_0x1bb6('0x30')](_0x2ad17d,_0x4f8565,!![]);}catch(_0x477737){return BPromise['reject'](_0x477737);}return _0x2ad17d[_0x1bb6('0x31')]();};}function saveUpdates(_0x437610,_0x33a3f2){return function(_0x53bc67){if(_0x53bc67){return _0x53bc67['update'](_0x437610)[_0x1bb6('0x1f')](function(_0x32401f){return _0x32401f;});}return null;};}function removeEntity(_0x59a811,_0x313ebf){return function(_0x5a6593){if(_0x5a6593){return _0x5a6593[_0x1bb6('0x32')]()[_0x1bb6('0x1f')](function(){_0x59a811[_0x1bb6('0x2e')](0xcc)[_0x1bb6('0x33')]();});}};}function handleEntityNotFound(_0xca9470,_0xb7cd68){return function(_0x430cda){if(!_0x430cda){_0xca9470['sendStatus'](0x194);}return _0x430cda;};}function handleError(_0x2a20e1,_0x23c94c){_0x23c94c=_0x23c94c||0x1f4;return function(_0x4ae495){logger[_0x1bb6('0x24')](_0x4ae495[_0x1bb6('0x34')]);if(_0x4ae495[_0x1bb6('0x35')]){delete _0x4ae495[_0x1bb6('0x35')];}_0x2a20e1[_0x1bb6('0x2e')](_0x23c94c)[_0x1bb6('0x36')](_0x4ae495);};}exports[_0x1bb6('0x37')]=function(_0xd30f83,_0x481098){var _0xec2088={},_0x1f43f3={},_0x57e631={'count':0x0,'rows':[]};var _0x370826=_[_0x1bb6('0x38')](db[_0x1bb6('0x39')][_0x1bb6('0x3a')],function(_0x34ec38){return{'name':_0x34ec38[_0x1bb6('0x3b')],'type':_0x34ec38[_0x1bb6('0x3c')][_0x1bb6('0x3d')]};});_0x1f43f3['model']=_[_0x1bb6('0x38')](_0x370826,'name');_0x1f43f3[_0x1bb6('0x3e')]=_[_0x1bb6('0x3f')](_0xd30f83[_0x1bb6('0x3e')]);_0x1f43f3[_0x1bb6('0x40')]=_[_0x1bb6('0x41')](_0x1f43f3[_0x1bb6('0x42')],_0x1f43f3[_0x1bb6('0x3e')]);_0xec2088[_0x1bb6('0x43')]=_['intersection'](_0x1f43f3[_0x1bb6('0x42')],qs['fields'](_0xd30f83[_0x1bb6('0x3e')][_0x1bb6('0x44')]));_0xec2088[_0x1bb6('0x43')]=_0xec2088[_0x1bb6('0x43')][_0x1bb6('0x45')]?_0xec2088[_0x1bb6('0x43')]:_0x1f43f3[_0x1bb6('0x42')];if(!_0xd30f83['query']['hasOwnProperty'](_0x1bb6('0x46'))){_0xec2088['limit']=qs['limit'](_0xd30f83[_0x1bb6('0x3e')]['limit']);_0xec2088[_0x1bb6('0x2b')]=qs[_0x1bb6('0x2b')](_0xd30f83[_0x1bb6('0x3e')]['offset']);}_0xec2088[_0x1bb6('0x47')]=qs[_0x1bb6('0x48')](_0xd30f83['query']['sort']);_0xec2088[_0x1bb6('0x49')]=qs[_0x1bb6('0x40')](_[_0x1bb6('0x4a')](_0xd30f83[_0x1bb6('0x3e')],_0x1f43f3[_0x1bb6('0x40')]),_0x370826);if(_0xd30f83[_0x1bb6('0x3e')][_0x1bb6('0x4b')]){_0xec2088['where']=_['merge'](_0xec2088['where'],{'$or':_[_0x1bb6('0x38')](_0x370826,function(_0x27ed9a){if(_0x27ed9a['type']!=='VIRTUAL'){var _0x13fb66={};_0x13fb66[_0x27ed9a[_0x1bb6('0x35')]]={'$like':'%'+_0xd30f83['query'][_0x1bb6('0x4b')]+'%'};return _0x13fb66;}})});}_0xec2088=_[_0x1bb6('0x4c')]({},_0xec2088,_0xd30f83[_0x1bb6('0x4d')]);var _0x481d3e={'where':_0xec2088[_0x1bb6('0x49')]};return db[_0x1bb6('0x39')]['count'](_0x481d3e)[_0x1bb6('0x1f')](function(_0x4178fe){_0x57e631[_0x1bb6('0x4e')]=_0x4178fe;if(_0xd30f83['query'][_0x1bb6('0x4f')]){_0xec2088['include']=[{'all':!![]}];}return db[_0x1bb6('0x39')][_0x1bb6('0x50')](_0xec2088);})['then'](function(_0x2a216a){_0x57e631[_0x1bb6('0x51')]=_0x2a216a;return _0x57e631;})['then'](respondWithFilteredResult(_0x481098,_0xec2088))[_0x1bb6('0x28')](handleError(_0x481098,null));};exports['show']=function(_0x55aac8,_0x848462){var _0x2e4f0e={'raw':!![],'where':{'id':_0x55aac8[_0x1bb6('0x52')]['id']}},_0x5103b1={};_0x5103b1[_0x1bb6('0x42')]=_['keys'](db[_0x1bb6('0x39')]['rawAttributes']);_0x5103b1[_0x1bb6('0x3e')]=_[_0x1bb6('0x3f')](_0x55aac8[_0x1bb6('0x3e')]);_0x5103b1[_0x1bb6('0x40')]=_['intersection'](_0x5103b1['model'],_0x5103b1[_0x1bb6('0x3e')]);_0x2e4f0e[_0x1bb6('0x43')]=_[_0x1bb6('0x41')](_0x5103b1[_0x1bb6('0x42')],qs[_0x1bb6('0x44')](_0x55aac8[_0x1bb6('0x3e')][_0x1bb6('0x44')]));_0x2e4f0e[_0x1bb6('0x43')]=_0x2e4f0e[_0x1bb6('0x43')][_0x1bb6('0x45')]?_0x2e4f0e[_0x1bb6('0x43')]:_0x5103b1[_0x1bb6('0x42')];if(_0x55aac8['query'][_0x1bb6('0x4f')]){_0x2e4f0e[_0x1bb6('0x53')]=[{'all':!![]}];}_0x2e4f0e=_[_0x1bb6('0x4c')]({},_0x2e4f0e,_0x55aac8[_0x1bb6('0x4d')]);return db[_0x1bb6('0x39')][_0x1bb6('0x54')](_0x2e4f0e)['then'](handleEntityNotFound(_0x848462,null))[_0x1bb6('0x1f')](respondWithResult(_0x848462,null))['catch'](handleError(_0x848462,null));};exports[_0x1bb6('0x55')]=function(_0x23f1fa,_0x229790){return db[_0x1bb6('0x39')][_0x1bb6('0x55')](_0x23f1fa[_0x1bb6('0x56')],{})[_0x1bb6('0x1f')](respondWithResult(_0x229790,0xc9))[_0x1bb6('0x28')](handleError(_0x229790,null));};exports['update']=function(_0x369962,_0x16d1ce){if(_0x369962[_0x1bb6('0x56')]['id']){delete _0x369962[_0x1bb6('0x56')]['id'];}return db[_0x1bb6('0x39')][_0x1bb6('0x54')]({'where':{'id':_0x369962['params']['id']}})[_0x1bb6('0x1f')](handleEntityNotFound(_0x16d1ce,null))['then'](saveUpdates(_0x369962[_0x1bb6('0x56')],null))[_0x1bb6('0x1f')](respondWithResult(_0x16d1ce,null))[_0x1bb6('0x28')](handleError(_0x16d1ce,null));};exports[_0x1bb6('0x32')]=function(_0x462c1e,_0x4574d4){return db['SmsMessage']['find']({'where':{'id':_0x462c1e['params']['id']}})['then'](handleEntityNotFound(_0x4574d4,null))[_0x1bb6('0x1f')](removeEntity(_0x4574d4,null))[_0x1bb6('0x28')](handleError(_0x4574d4,null));};exports[_0x1bb6('0x57')]=function(_0x1a64e9,_0x2e2b5a){return db[_0x1bb6('0x39')]['describe']()[_0x1bb6('0x1f')](respondWithResult(_0x2e2b5a,null))['catch'](handleError(_0x2e2b5a,null));};var interaction_log=require(_0x1bb6('0x58'))('sms-interactions');exports[_0x1bb6('0x59')]=function(_0x3f358c,_0x10aa7c,_0x1a3a84){var _0x27b037={'agent':{},'channel':_0x1bb6('0x5a')};if(_0x3f358c['body']['id']){delete _0x3f358c[_0x1bb6('0x56')]['id'];}_0x3f358c[_0x1bb6('0x56')]['read']=!![];_0x3f358c[_0x1bb6('0x56')]['readAt']=moment()[_0x1bb6('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f358c[_0x1bb6('0x56')][_0x1bb6('0x5c')]=_0x3f358c[_0x1bb6('0x56')][_0x1bb6('0x5c')]||_0x3f358c['user']['id'];_0x27b037[_0x1bb6('0x5d')]['id']=_0x3f358c[_0x1bb6('0x56')][_0x1bb6('0x5c')];return db[_0x1bb6('0x39')][_0x1bb6('0x54')]({'where':{'id':_0x3f358c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x10aa7c,null))[_0x1bb6('0x1f')](saveUpdates(_0x3f358c[_0x1bb6('0x56')],null))[_0x1bb6('0x1f')](function(_0x25b34d){if(_0x25b34d){_0x27b037[_0x1bb6('0x27')]=_0x25b34d[_0x1bb6('0x5e')]({'plain':!![]});return db[_0x1bb6('0x5f')][_0x1bb6('0x54')]({'where':{'id':_0x25b34d[_0x1bb6('0x60')]}});}return null;})[_0x1bb6('0x1f')](handleEntityNotFound(_0x10aa7c,null))[_0x1bb6('0x1f')](function(_0x75735f){if(_0x75735f){return _0x75735f[_0x1bb6('0x61')]({'UserId':_0x3f358c['body'][_0x1bb6('0x5c')],'read1stAt':_[_0x1bb6('0x62')](_0x75735f[_0x1bb6('0x63')])?moment()[_0x1bb6('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4b2ca3){if(_0x4b2ca3){_0x27b037[_0x1bb6('0x64')]=_0x4b2ca3[_0x1bb6('0x5e')]({'plain':!![]});interaction_log[_0x1bb6('0x20')](_0x1bb6('0x65'),_0x3f358c['user']['id'],_0x3f358c[_0x1bb6('0x66')][_0x1bb6('0x35')],_0x3f358c[_0x1bb6('0x66')][_0x1bb6('0x67')],_0x27b037[_0x1bb6('0x64')]['id'],_0x3f358c[_0x1bb6('0x56')]?JSON[_0x1bb6('0x23')](_0x3f358c[_0x1bb6('0x56')]):_0x1bb6('0x68'));return respondWithRpcPromise(_0x1bb6('0x69'),_0x1bb6('0x6a'),_0x27b037);}return null;})[_0x1bb6('0x1f')](function(_0x67a93b){var _0xab6745=_0x1bb6('0x6b')+_0x67a93b['message']['ContactId'];return db[_0x1bb6('0x6c')][_0x1bb6('0x3e')](_0xab6745,{'type':db['Sequelize'][_0x1bb6('0x6d')][_0x1bb6('0x6e')],'raw':!![]})['then'](function(_0x368ed8){return _0x368ed8;});})[_0x1bb6('0x1f')](function(_0x698fa8){if(_0x698fa8){_0x27b037[_0x1bb6('0x27')][_0x1bb6('0x6f')]=_0x698fa8[0x0];if(!_0x3f358c[_0x1bb6('0x56')][_0x1bb6('0x5c')])return;return db[_0x1bb6('0x70')]['find']({'where':{'id':_0x3f358c[_0x1bb6('0x56')]['UserId'],'role':'agent'},'attributes':['id','name',_0x1bb6('0x71'),_0x1bb6('0x72'),_0x1bb6('0x73')],'raw':!![]});}return null;})['then'](function(_0x3b654d){if(!_0x3b654d)return null;_0x27b037[_0x1bb6('0x27')][_0x1bb6('0x5d')]=_0x3b654d;return _0x27b037;})[_0x1bb6('0x1f')](function(_0x359023){if(_0x359023){if(_0x3f358c['body'][_0x1bb6('0x74')]){_0x27b037['message'][_0x1bb6('0x75')]=util['format'](_0x1bb6('0x76'),_0x3f358c['user'][_0x1bb6('0x35')]);_0x27b037[_0x1bb6('0x27')][_0x1bb6('0x77')]=_0x27b037[_0x1bb6('0x77')];_0x27b037[_0x1bb6('0x27')][_0x1bb6('0x78')]=_0x27b037[_0x1bb6('0x77')];_0x27b037['message'][_0x1bb6('0x79')]='accept';return respondWithRpcPromise(_0x1bb6('0x7a'),_0x1bb6('0x7a'),{'event':_0x1bb6('0x7b'),'message':_0x27b037[_0x1bb6('0x27')]},client9002)[_0x1bb6('0x1f')](function(){return _0x27b037;});}return _0x27b037;}return null;})[_0x1bb6('0x1f')](respondWithResult(_0x10aa7c,null))['catch'](handleError(_0x10aa7c,null));};var interaction_log=require(_0x1bb6('0x58'))(_0x1bb6('0x7c'));exports[_0x1bb6('0x7d')]=function(_0x55cdd8,_0x5d4649,_0x189814){var _0xdecfee={'agent':{},'channel':'sms'};if(_0x55cdd8[_0x1bb6('0x56')]['id']){delete _0x55cdd8['body']['id'];}_0x55cdd8['body'][_0x1bb6('0x5c')]=_0x55cdd8[_0x1bb6('0x56')]['UserId']||_0x55cdd8['user']['id'];_0xdecfee[_0x1bb6('0x5d')]['id']=_0x55cdd8[_0x1bb6('0x56')]['UserId'];return db[_0x1bb6('0x39')][_0x1bb6('0x54')]({'where':{'id':_0x55cdd8[_0x1bb6('0x52')]['id'],'UserId':null}})[_0x1bb6('0x1f')](handleEntityNotFound(_0x5d4649,null))[_0x1bb6('0x1f')](function(_0x40b1ba){if(_0x40b1ba){_0xdecfee['message']=_0x40b1ba[_0x1bb6('0x5e')]({'plain':!![]});return db[_0x1bb6('0x5f')][_0x1bb6('0x54')]({'where':{'id':_0x40b1ba[_0x1bb6('0x60')]}});}return null;})[_0x1bb6('0x1f')](handleEntityNotFound(_0x5d4649,null))[_0x1bb6('0x1f')](function(_0x4eaf34){if(_0x4eaf34){_0xdecfee[_0x1bb6('0x64')]=_0x4eaf34['get']({'plain':!![]});interaction_log[_0x1bb6('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55cdd8[_0x1bb6('0x66')]['id'],_0x55cdd8[_0x1bb6('0x66')]['name'],_0x55cdd8['user'][_0x1bb6('0x67')],_0xdecfee[_0x1bb6('0x64')]['id'],_0x55cdd8[_0x1bb6('0x56')]?JSON['stringify'](_0x55cdd8[_0x1bb6('0x56')]):'null');return respondWithRpcPromise(_0x1bb6('0x7e'),_0x1bb6('0x7f'),_0xdecfee);}return null;})['then'](function(_0xbe2ca1){var _0x233136=_0x1bb6('0x6b')+_0xbe2ca1['message'][_0x1bb6('0x80')];return db[_0x1bb6('0x6c')][_0x1bb6('0x3e')](_0x233136,{'type':db['Sequelize'][_0x1bb6('0x6d')][_0x1bb6('0x6e')],'raw':!![]})[_0x1bb6('0x1f')](function(_0xe94d6a){return _0xe94d6a;});})[_0x1bb6('0x1f')](function(_0x3b6bd5){if(_0x3b6bd5){_0xdecfee[_0x1bb6('0x27')][_0x1bb6('0x6f')]=_0x3b6bd5[0x0];if(!_0x55cdd8[_0x1bb6('0x56')][_0x1bb6('0x5c')])return;return db[_0x1bb6('0x70')][_0x1bb6('0x54')]({'where':{'id':_0x55cdd8['body']['UserId'],'role':_0x1bb6('0x5d')},'attributes':['id',_0x1bb6('0x35'),_0x1bb6('0x71'),_0x1bb6('0x72'),_0x1bb6('0x73')],'raw':!![]});}return null;})[_0x1bb6('0x1f')](function(_0x466d48){if(!_0x466d48)return null;_0xdecfee[_0x1bb6('0x27')]['agent']=_0x466d48;return _0xdecfee;})['then'](function(_0x4da3a8){if(_0x4da3a8){_0x4da3a8[_0x1bb6('0x27')][_0x1bb6('0x75')]=util[_0x1bb6('0x5b')]('SIP/%s',_0x55cdd8[_0x1bb6('0x66')][_0x1bb6('0x35')]);_0x4da3a8['message'][_0x1bb6('0x77')]=_0xdecfee[_0x1bb6('0x77')];_0x4da3a8[_0x1bb6('0x27')][_0x1bb6('0x78')]=_0xdecfee[_0x1bb6('0x77')];_0x4da3a8['message'][_0x1bb6('0x79')]=_0x1bb6('0x7d');respondWithRpcPromise('EventManager',_0x1bb6('0x7a'),{'event':'rejectmessage','message':_0x4da3a8[_0x1bb6('0x27')]},client9002);return _0xdecfee;}return null;})['then'](respondWithResult(_0x5d4649,null))[_0x1bb6('0x28')](handleError(_0x5d4649,null));};exports[_0x1bb6('0x2e')]=function(_0x6c8ad8,_0x5a85b6,_0x23660c){if(_0x6c8ad8['body']['id']){delete _0x6c8ad8[_0x1bb6('0x56')]['id'];}var _0x49f4e9;return db[_0x1bb6('0x39')]['find']({'where':{'id':_0x6c8ad8[_0x1bb6('0x52')]['id']}})[_0x1bb6('0x1f')](handleEntityNotFound(_0x5a85b6,null))[_0x1bb6('0x1f')](function(_0x31dff2){if(_0x31dff2){_0x49f4e9=_0x31dff2;return db[_0x1bb6('0x81')][_0x1bb6('0x54')]({'where':{'id':_0x31dff2[_0x1bb6('0x82')]}});}})['then'](handleEntityNotFound(_0x5a85b6,null))[_0x1bb6('0x1f')](function(_0xff194){if(_0xff194){logger[_0x1bb6('0x83')](_0x1bb6('0x22'),_0x1bb6('0x2e'),'received\x20delivery\x20report\x20from',_0xff194[_0x1bb6('0x3c')],util[_0x1bb6('0x84')](_0x6c8ad8[_0x1bb6('0x56')],{'showHidden':![],'depth':null}));switch(_0xff194['type']){case _0x1bb6('0x85'):if(_0x6c8ad8[_0x1bb6('0x56')][_0x1bb6('0x86')]&&_0x6c8ad8['body'][_0x1bb6('0x86')]===_0x49f4e9[_0x1bb6('0x87')]){return _0x49f4e9[_0x1bb6('0x61')]({'read':!![]});}else{logger[_0x1bb6('0x24')](_0x1bb6('0x88'),_0x1bb6('0x2e'),'twilio',util['inspect'](_0x6c8ad8[_0x1bb6('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1bb6('0x89'):if(_0x6c8ad8[_0x1bb6('0x56')][_0x1bb6('0x8a')]&&_0x6c8ad8[_0x1bb6('0x56')][_0x1bb6('0x8a')]===_0x49f4e9[_0x1bb6('0x87')]&&_[_0x1bb6('0x8b')]([_0x1bb6('0x8c'),_0x1bb6('0x8d')],_0x6c8ad8[_0x1bb6('0x56')][_0x1bb6('0x8e')])>=0x0){return _0x49f4e9[_0x1bb6('0x61')]({'read':!![]});}else{logger[_0x1bb6('0x24')](_0x1bb6('0x88'),'status','plivio',util['inspect'](_0x6c8ad8[_0x1bb6('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1bb6('0x8f'):var _0x50d5fb=_0x6c8ad8[_0x1bb6('0x56')][_0x1bb6('0x90')][0x0];if(_0x50d5fb['status'][_0x1bb6('0x91')]===_0x1bb6('0x92')){return _0x49f4e9['update']({'read':!![]});}else{logger[_0x1bb6('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1bb6('0x2e'),_0x1bb6('0x8f'),util[_0x1bb6('0x84')](_0x6c8ad8[_0x1bb6('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x49f4e9;}})[_0x1bb6('0x1f')](respondWithResult(_0x5a85b6,null))[_0x1bb6('0x28')](handleError(_0x5a85b6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 4f84a78..0f3ef35 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 _0xc18b=['exports','../../mysqldb','SmsMessage','remove','emit','hook'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xc18b,0xd3));var _0xbc18=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xc18b[_0x1cbcf1];return _0x3a06f0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xbc18('0x0'))['db'][_0xbc18('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbc18('0x2')};function emitEvent(_0x4f83d3){return function(_0x1d4619,_0x38df59,_0x808864){SmsMessageEvents['emit'](_0x4f83d3+':'+_0x1d4619['id'],_0x1d4619);SmsMessageEvents[_0xbc18('0x3')](_0x4f83d3,_0x1d4619);_0x808864(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xbc18('0x4')](e,emitEvent(event));}}module[_0xbc18('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x1bdd=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0xc41568,_0x355072){var _0x48cdd8=function(_0x60b5f4){while(--_0x60b5f4){_0xc41568['push'](_0xc41568['shift']());}};_0x48cdd8(++_0x355072);}(_0x1bdd,0x195));var _0xd1bd=function(_0x376160,_0x4852bd){_0x376160=_0x376160-0x0;var _0x48b138=_0x1bdd[_0x376160];return _0x48b138;};'use strict';var EventEmitter=require(_0xd1bd('0x0'));var SmsMessage=require(_0xd1bd('0x1'))['db'][_0xd1bd('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd1bd('0x3')](0x0);var events={'afterCreate':_0xd1bd('0x4'),'afterUpdate':_0xd1bd('0x5'),'afterDestroy':_0xd1bd('0x6')};function emitEvent(_0x382dfd){return function(_0x25d41d,_0xc5cd3a,_0x10534b){SmsMessageEvents[_0xd1bd('0x7')](_0x382dfd+':'+_0x25d41d['id'],_0x25d41d);SmsMessageEvents[_0xd1bd('0x7')](_0x382dfd,_0x25d41d);_0x10534b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xd1bd('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c1c6c8a..4b4dd6d 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 _0x46f8=['/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','split','user_key','session_key','total_sent','internal_order_id','error','afterCreate','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','read','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/status?token=','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','timestamp','keys','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','bandwidth','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','out','SmsAccount','type','twilio','accountSid','authToken','phone','remote'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x46f8,0xce));var _0x846f=function(_0x4e7188,_0x49527d){_0x4e7188=_0x4e7188-0x0;var _0x105685=_0x46f8[_0x4e7188];return _0x105685;};'use strict';var _=require(_0x846f('0x0'));var util=require('util');var logger=require(_0x846f('0x1'))(_0x846f('0x2'));var moment=require(_0x846f('0x3'));var BPromise=require(_0x846f('0x4'));var rp=require(_0x846f('0x5'));var fs=require('fs');var path=require(_0x846f('0x6'));var rimraf=require(_0x846f('0x7'));var config=require(_0x846f('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x421f9f,_0x261dbc){return _0x421f9f[_0x846f('0x9')](_0x846f('0xa'),attributes,{'tableName':_0x846f('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x846f('0xc')]},{'name':_0x846f('0xd'),'fields':[_0x846f('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25d18a,_0x200dc1,_0x5515b6){var _0x1775f1=_0x421f9f[_0x846f('0xf')];var _0x6fa398=_0x25d18a[_0x846f('0x10')]({'plain':!![]});if(_0x6fa398[_0x846f('0x11')][_0x846f('0x12')]()==='in'||_0x6fa398['direction']['toLowerCase']()==='out'&&!_0x6fa398[_0x846f('0x13')]&&!_['isNil'](_0x6fa398[_0x846f('0x14')])&&!_['isNil'](_0x6fa398[_0x846f('0x15')])){_0x1775f1[_0x846f('0x16')][_0x846f('0x17')]({'where':{'id':_0x6fa398[_0x846f('0x15')]}})[_0x846f('0x18')](function(_0x5c7efa){if(_0x5c7efa){_0x5c7efa[_0x846f('0x19')]({'lastMsgAt':_0x6fa398[_0x846f('0x1a')],'lastMsgDirection':_0x6fa398['direction'][_0x846f('0x12')]()});}})[_0x846f('0x1b')](function(_0x40d05a){console['error'](_0x40d05a);});}if(_0x6fa398['direction']===_0x846f('0x1c')&&!_0x6fa398[_0x846f('0x13')]){var _0x1d887e;_0x1775f1[_0x846f('0x1d')]['find']({'where':{'id':_0x6fa398['SmsAccountId']},'raw':!![]})[_0x846f('0x18')](function(_0xb44b49){_0x1d887e=_0xb44b49;if(_0x1d887e&&_0x1d887e[_0x846f('0x1e')]){switch(_0x1d887e[_0x846f('0x1e')]){case'twilio':var _0x301543=require(_0x846f('0x1f'));if(_0x1d887e[_0x846f('0x20')]&&_0x1d887e[_0x846f('0x21')]&&_0x1d887e[_0x846f('0x22')]){var _0x41710e=new _0x301543(_0x1d887e[_0x846f('0x20')],_0x1d887e[_0x846f('0x21')]);_0x41710e['messages']['create']({'body':_0x6fa398['body'],'to':_0x6fa398[_0x846f('0x22')],'from':_0x1d887e[_0x846f('0x22')],'statusCallback':_0x1d887e[_0x846f('0x23')]+_0x846f('0x24')+_0x6fa398['id']+'/status?token='+_0x1d887e[_0x846f('0x25')]})['then'](function(_0x2d100b){if(_0x2d100b['sid']){return _0x25d18a[_0x846f('0x19')]({'messageId':_0x2d100b[_0x846f('0x26')]});}})[_0x846f('0x1b')](function(_0x4ede95){logger['error'](_0x846f('0x27'),'afterCreate',_0x846f('0x1f'),util[_0x846f('0x28')](_0x4ede95,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x846f('0x1f'),_0x846f('0x29'));}break;case'skebby':var _0x1fc18f=_0x846f('0x2a');if(_0x1d887e[_0x846f('0x2b')]&&_0x1d887e['password']){var _0x106cd2={'recipient':[_0x6fa398[_0x846f('0x22')]],'message':_0x6fa398[_0x846f('0xe')],'message_type':_0x1d887e[_0x846f('0x2c')]};if(_0x1d887e[_0x846f('0x2c')]&&_0x1d887e[_0x846f('0x2c')]!=='SI'){_0x106cd2[_0x846f('0x2d')]=_0x1d887e[_0x846f('0x22')];}var _0x46d622={'url':_0x1fc18f+_0x846f('0x2e')+_0x1d887e[_0x846f('0x2b')]+_0x846f('0x2f')+_0x1d887e[_0x846f('0x30')],'method':_0x846f('0x31')};rp(_0x46d622)[_0x846f('0x18')](function(_0x50592e){var _0x4da936=_0x50592e[_0x846f('0x32')](';');var _0x1bf3cd={'user_key':_0x4da936[0x0],'session_key':_0x4da936[0x1]};_0x46d622={'url':_0x1fc18f+'sms','method':'POST','headers':{'user_key':_0x1bf3cd[_0x846f('0x33')],'Session_key':_0x1bf3cd[_0x846f('0x34')]},'json':!![],'body':_0x106cd2};return rp(_0x46d622);})[_0x846f('0x18')](function(_0x48a381){if(_0x48a381[_0x846f('0x35')]>=0x1){var _0x55940a={'messageId':_0x48a381[_0x846f('0x36')]};if(_0x1d887e[_0x846f('0x2c')]!=='GP'||!_0x1d887e['deliveryReport']){_0x55940a['read']=!![];}return _0x25d18a[_0x846f('0x19')](_0x55940a);}else{return logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),'skebby',util[_0x846f('0x28')](_0x48a381,{'showHidden':![],'depth':null}));}})[_0x846f('0x1b')](function(_0x3d5822){return logger[_0x846f('0x37')](_0x846f('0x27'),'afterCreate',_0x846f('0x39'),util[_0x846f('0x28')](_0x3d5822,{'showHidden':![],'depth':null}));});}else{logger[_0x846f('0x37')](_0x846f('0x27'),'afterCreate',_0x846f('0x39'),_0x846f('0x3a'));}break;case _0x846f('0x3b'):if(_0x1d887e[_0x846f('0x21')]){var _0x27341c={'recipient':_0x6fa398[_0x846f('0x22')],'message':_0x6fa398['body'],'sender':_0x1d887e[_0x846f('0x3c')]||_0x1d887e['phone'],'authorization':_0x1d887e[_0x846f('0x21')]};var _0x200dc1={'method':_0x846f('0x3d'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x27341c,'json':!![]};rp(_0x200dc1)['then'](function(_0x30ebec){var _0x50748e={'messageId':_0x30ebec['requestid']};if(!_0x1d887e[_0x846f('0x3e')]){_0x50748e['read']=!![];}return _0x25d18a[_0x846f('0x19')](_0x50748e);})[_0x846f('0x1b')](function(_0x4b2576){logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),'connectel',util[_0x846f('0x28')](_0x4b2576,{'showHidden':![],'depth':null}));});}else{logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x846f('0x3f'):if(_0x1d887e[_0x846f('0x2b')]&&_0x1d887e['password']){var _0x27341c={'messages':[{'source':_0x846f('0x40'),'to':_0x6fa398['phone'],'body':_0x6fa398['body'],'from':_0x1d887e[_0x846f('0x3c')]||_0x1d887e['phone']}]};var _0x3441e5=util[_0x846f('0x41')](_0x846f('0x42'),_0x1d887e[_0x846f('0x2b')],_0x1d887e['password']);var _0x200dc1={'method':_0x846f('0x3d'),'uri':_0x846f('0x43'),'body':_0x27341c,'headers':{'Authorization':util['format'](_0x846f('0x44'),new Buffer(_0x3441e5)[_0x846f('0x45')](_0x846f('0x46')))},'json':!![]};rp(_0x200dc1)['then'](function(_0x5a7a12){if(_0x5a7a12[_0x846f('0x47')]>=0xc8&&_0x5a7a12[_0x846f('0x47')]<=0xce){if(_0x5a7a12[_0x846f('0x48')]&&_0x5a7a12[_0x846f('0x48')][_0x846f('0x49')]>0x0){var _0x491c34=_[_0x846f('0x4a')](_0x5a7a12[_0x846f('0x48')][_0x846f('0x4b')]);var _0x14c166={'messageId':_0x491c34['message_id']};if(!_0x1d887e[_0x846f('0x3e')]){_0x14c166[_0x846f('0x4c')]=!![];}return _0x25d18a[_0x846f('0x19')](_0x14c166);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x846f('0x38'),_0x846f('0x4d'),util[_0x846f('0x28')](_0x5a7a12,{'showHidden':![],'depth':null}));}}else{logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x4d'),util['inspect'](_0x5a7a12,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1349d4){logger['error'](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x4d'),util[_0x846f('0x28')](_0x1349d4,{'showHidden':![],'depth':null}));});}else{logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x4d'),_0x846f('0x3a'));}break;case _0x846f('0x4e'):if(_0x1d887e[_0x846f('0x4f')]&&_0x1d887e[_0x846f('0x21')]){var _0x27341c={'dst':_0x6fa398[_0x846f('0x22')],'text':_0x6fa398[_0x846f('0xe')],'src':_0x1d887e[_0x846f('0x3c')]||_0x1d887e['phone'],'url':_0x1d887e[_0x846f('0x23')]+_0x846f('0x24')+_0x6fa398['id']+'/status?token='+_0x1d887e['token']};var _0x3441e5=util[_0x846f('0x41')]('%s:%s',_0x1d887e[_0x846f('0x4f')],_0x1d887e[_0x846f('0x21')]);var _0x200dc1={'method':'POST','uri':util[_0x846f('0x41')](_0x846f('0x50'),_0x1d887e['authId']),'body':_0x27341c,'headers':{'Authorization':util[_0x846f('0x41')](_0x846f('0x44'),new Buffer(_0x3441e5)[_0x846f('0x45')]('base64'))},'json':!![]};rp(_0x200dc1)[_0x846f('0x18')](function(_0x2bb1d5){var _0x25a5be={'messageId':_0x2bb1d5[_0x846f('0x51')][0x0]};return _0x25d18a['update'](_0x25a5be);})[_0x846f('0x1b')](function(_0x58bab6){logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x4e'),util[_0x846f('0x28')](_0x58bab6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x846f('0x27'),_0x846f('0x38'),'plivo',_0x846f('0x52'));}break;case _0x846f('0x53'):if(_0x1d887e['username']&&_0x1d887e[_0x846f('0x30')]){if(_0x1d887e[_0x846f('0x54')]){var _0x57069a={'method':_0x846f('0x3d'),'uri':_0x1d887e[_0x846f('0x54')]+_0x846f('0x55'),'body':{'username':_0x1d887e[_0x846f('0x2b')],'password':_0x1d887e[_0x846f('0x30')]},'json':!![]};return rp(_0x57069a)['then'](function(_0xfffb77){var _0x3de4e3={'method':_0x846f('0x3d'),'uri':_0x1d887e[_0x846f('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1d887e[_0x846f('0x22')],'destinations':[{'to':_0x6fa398[_0x846f('0x22')]}],'text':_0x6fa398[_0x846f('0xe')],'notifyUrl':_0x1d887e[_0x846f('0x23')]+_0x846f('0x24')+_0x6fa398['id']+_0x846f('0x56')+_0x1d887e[_0x846f('0x25')],'notifyContentType':_0x846f('0x57'),'callbackData':_0x1d887e[_0x846f('0x22')]+';'+_0x6fa398[_0x846f('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0xfffb77[_0x846f('0x25')]},'json':!![]};return rp(_0x3de4e3)[_0x846f('0x18')](function(_0x98c11e){if(_0x98c11e[_0x846f('0x4b')]){var _0x44568c={'messageId':_0x98c11e[_0x846f('0x4b')][0x0][_0x846f('0xc')]};if(!_0x1d887e[_0x846f('0x3e')]){_0x44568c['read']=!![];}return _0x25d18a[_0x846f('0x19')](_0x44568c);}else{return logger[_0x846f('0x37')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x846f('0x38'),_0x846f('0x53'),util['inspect'](_0x98c11e,{'showHidden':![],'depth':null}));}});})[_0x846f('0x1b')](function(_0x18d0c8){return logger[_0x846f('0x37')](_0x846f('0x27'),'afterCreate','infobip',util[_0x846f('0x28')](_0x18d0c8,{'showHidden':![],'depth':null}));});}else{logger[_0x846f('0x37')](_0x846f('0x27'),'afterCreate',_0x846f('0x53'),_0x846f('0x58'));}}else{logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x53'),_0x846f('0x3a'));}break;case _0x846f('0x59'):var _0x3386a1=require(_0x846f('0x5a'));if(_0x1d887e['apiKey']){var _0x610841={};_0x610841[_0x846f('0x5b')]=_0x1d887e[_0x846f('0x2b')];_0x610841['phone']=_0x6fa398[_0x846f('0x22')];_0x610841[_0x846f('0x2d')]=_0x1d887e[_0x846f('0x22')];_0x610841['text']=_0x6fa398[_0x846f('0xe')];_0x610841[_0x846f('0x5c')]=+new Date();var _0x494d8b='';var _0x511f09='';var _0x2e0844=Object[_0x846f('0x5d')](_0x610841);_0x2e0844['sort']();for(var _0xfb3263=0x0;_0xfb3263<_0x2e0844[_0x846f('0x5e')];_0xfb3263++){if(_0x494d8b!=''){_0x494d8b+='&';}_0x494d8b+=_0x2e0844[_0xfb3263]+'='+encodeURIComponent(_0x610841[_0x2e0844[_0xfb3263]]);_0x511f09+=_0x610841[_0x2e0844[_0xfb3263]];}_0x511f09+=_0x1d887e['apiKey'];_0x511f09=_0x3386a1[_0x846f('0x5f')](_0x846f('0x60'))[_0x846f('0x19')](_0x511f09)[_0x846f('0x61')](_0x846f('0x62'));if(_0x494d8b!==''){_0x494d8b+='&';}_0x494d8b+='signature='+_0x511f09;var _0x46d622={'method':_0x846f('0x31'),'uri':_0x1d887e[_0x846f('0x54')]+_0x846f('0x63')+_0x494d8b,'json':!![]};return rp(_0x46d622)[_0x846f('0x18')](function(_0x1d78d7){var _0x387be5=Object['keys'](_0x1d78d7);if(_0x1d78d7[_0x387be5[0x0]][_0x846f('0x37')]&&parseInt(_0x1d78d7[_0x387be5[0x0]][_0x846f('0x37')])===0x0){var _0x3c613c={'messageId':_0x1d78d7[_0x387be5[0x0]][_0x846f('0x64')]};if(!_0x1d887e['deliveryReport']){_0x3c613c[_0x846f('0x4c')]=!![];}return _0x25d18a[_0x846f('0x19')](_0x3c613c);}else{return logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),'csc',util[_0x846f('0x28')](_0x1d78d7[_0x846f('0x37')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x39827f){return logger['error'](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x59'),util[_0x846f('0x28')](_0x39827f,{'showHidden':![],'depth':null}));});}else{logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x846f('0x65'):if(_0x1d887e[_0x846f('0x66')]){var _0x32823b={'method':_0x846f('0x3d'),'uri':_0x846f('0x67'),'headers':{'Authorization':_0x1d887e[_0x846f('0x66')]},'body':{'content':_0x6fa398[_0x846f('0xe')],'to':[_0x6fa398['phone']],'from':_0x1d887e['phone'],'binary':![],'clientMessageId':_0x846f('0x68'),'charset':_0x846f('0x69')},'json':!![]};rp(_0x32823b)[_0x846f('0x18')](function(_0x33637c){if(!_0x33637c[_0x846f('0x37')]){var _0x360fea={'messageId':_0x33637c[_0x846f('0x4b')][0x0][_0x846f('0x6a')]};if(!_0x1d887e[_0x846f('0x3e')]){_0x360fea[_0x846f('0x4c')]=!![];}return _0x25d18a[_0x846f('0x19')](_0x360fea);}else{return logger[_0x846f('0x37')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x846f('0x38'),_0x846f('0x65'),util['inspect'](_0x33637c[_0x846f('0x37')],{'showHidden':![],'depth':null}));}})[_0x846f('0x1b')](function(_0x25d7bf){return logger[_0x846f('0x37')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x846f('0x65'),util[_0x846f('0x28')](_0x25d7bf,{'showHidden':![],'depth':null}));});}else{logger[_0x846f('0x37')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x846f('0x38'),_0x846f('0x65'),_0x846f('0x6b'));}break;case'bandwidth':if(_0x1d887e[_0x846f('0x2b')]&&_0x1d887e[_0x846f('0x30')]){var _0x3441e5=util['format'](_0x846f('0x42'),_0x1d887e[_0x846f('0x2b')],_0x1d887e[_0x846f('0x30')]);var _0x200dc1={'method':_0x846f('0x3d'),'uri':_0x846f('0x6c')+_0x1d887e[_0x846f('0x6d')]+'/messages','body':{'to':[_0x6fa398['phone']],'text':_0x6fa398[_0x846f('0xe')],'from':_0x1d887e[_0x846f('0x22')],'applicationId':_0x1d887e[_0x846f('0x6e')]},'headers':{'Authorization':util[_0x846f('0x41')](_0x846f('0x44'),new Buffer(_0x3441e5)['toString'](_0x846f('0x46')))},'json':!![]};rp(_0x200dc1)['then'](function(_0x4ed65c){if(_0x4ed65c['id']){var _0x237b56={'messageId':_0x4ed65c['id']};return _0x25d18a[_0x846f('0x19')](_0x237b56);}else{logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x6f'),util[_0x846f('0x28')](_0x4ed65c,{'showHidden':![],'depth':null}));}})[_0x846f('0x1b')](function(_0x6e199b){logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x6f'),util[_0x846f('0x28')](_0x6e199b,{'showHidden':![],'depth':null}));});}else{logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),_0x846f('0x6f'),_0x846f('0x3a'));}break;case'intelepeer':if(_0x1d887e['apiKey']){var _0x4e9c87={};var _0x46d622={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x846f('0x70')+_0x1d887e[_0x846f('0x66')],'Content-Type':_0x846f('0x57')},'body':{'from':_0x1d887e[_0x846f('0x22')],'to':_0x6fa398[_0x846f('0x22')],'text':_0x6fa398[_0x846f('0xe')]},'json':!![]};return rp(_0x46d622)[_0x846f('0x18')](function(_0xa00db8){if(_0xa00db8[_0x846f('0x71')]==0xca){_0x4e9c87[_0x846f('0x72')]=_0xa00db8;var _0x1aa96b={'method':_0x846f('0x3d'),'uri':_0x846f('0x73'),'headers':{'Authorization':_0x846f('0x70')+_0x1d887e['apiKey'],'Content-Type':_0x846f('0x57')},'body':{'refid':_0x4e9c87[_0x846f('0x72')][_0x846f('0x74')]},'json':!![]};return rp(_0x1aa96b)[_0x846f('0x18')](function(_0x4f9472){_0x4e9c87[_0x846f('0x75')]=_0x4f9472;var _0x107639={'messageId':_0x4e9c87['message'][_0x846f('0x74')],'read':!![]};return _0x25d18a[_0x846f('0x19')](_0x107639);});}else{return logger[_0x846f('0x37')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x846f('0x76'),util['inspect'](_0xa00db8,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb5af42){return logger[_0x846f('0x37')](_0x846f('0x27'),_0x846f('0x38'),'intelepeer',util['inspect'](_0xb5af42,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x846f('0x27'),_0x846f('0x38'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x846f('0x77')](function(){_0x5515b6();});}else{_0x5515b6();}}},'charset':_0x846f('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7260=['clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','models','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','secret','type','twilio','accountSid','phone','authToken','create','body','remote','/status?token=','token','error','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','total_sent','internal_order_id','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','timestamp','keys','sort','length','apiKey','createHash','digest','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId'];(function(_0xdcf293,_0x225268){var _0x3e9448=function(_0x57632b){while(--_0x57632b){_0xdcf293['push'](_0xdcf293['shift']());}};_0x3e9448(++_0x225268);}(_0x7260,0x89));var _0x0726=function(_0x4db089,_0x2e7ade){_0x4db089=_0x4db089-0x0;var _0x3c8f6c=_0x7260[_0x4db089];return _0x3c8f6c;};'use strict';var _=require('lodash');var util=require(_0x0726('0x0'));var logger=require(_0x0726('0x1'))(_0x0726('0x2'));var moment=require(_0x0726('0x3'));var BPromise=require(_0x0726('0x4'));var rp=require(_0x0726('0x5'));var fs=require('fs');var path=require(_0x0726('0x6'));var rimraf=require(_0x0726('0x7'));var config=require(_0x0726('0x8'));var attributes=require(_0x0726('0x9'));module[_0x0726('0xa')]=function(_0x50a66d,_0x56830f){return _0x50a66d['define'](_0x0726('0xb'),attributes,{'tableName':_0x0726('0xc'),'paranoid':![],'indexes':[{'name':_0x0726('0xd'),'fields':[_0x0726('0xd')]},{'name':_0x0726('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11c506,_0x596360,_0x234fb5){var _0x3d570b=_0x50a66d[_0x0726('0xf')];var _0xea1f56=_0x11c506['get']({'plain':!![]});if(_0xea1f56[_0x0726('0x10')][_0x0726('0x11')]()==='in'||_0xea1f56[_0x0726('0x10')][_0x0726('0x11')]()===_0x0726('0x12')&&!_0xea1f56['secret']&&!_[_0x0726('0x13')](_0xea1f56[_0x0726('0x14')])&&!_[_0x0726('0x13')](_0xea1f56['SmsInteractionId'])){_0x3d570b[_0x0726('0x15')][_0x0726('0x16')]({'where':{'id':_0xea1f56['SmsInteractionId']}})[_0x0726('0x17')](function(_0x5f05b0){if(_0x5f05b0){_0x5f05b0[_0x0726('0x18')]({'lastMsgAt':_0xea1f56[_0x0726('0x19')],'lastMsgDirection':_0xea1f56[_0x0726('0x10')]['toLowerCase']()});}})[_0x0726('0x1a')](function(_0x452488){console['error'](_0x452488);});}if(_0xea1f56[_0x0726('0x10')]===_0x0726('0x12')&&!_0xea1f56[_0x0726('0x1b')]){var _0x56ca38;_0x3d570b['SmsAccount']['find']({'where':{'id':_0xea1f56['SmsAccountId']},'raw':!![]})[_0x0726('0x17')](function(_0x526903){_0x56ca38=_0x526903;if(_0x56ca38&&_0x56ca38[_0x0726('0x1c')]){switch(_0x56ca38[_0x0726('0x1c')]){case _0x0726('0x1d'):var _0x4bb814=require('twilio');if(_0x56ca38[_0x0726('0x1e')]&&_0x56ca38['authToken']&&_0x56ca38[_0x0726('0x1f')]){var _0x1eb23d=new _0x4bb814(_0x56ca38[_0x0726('0x1e')],_0x56ca38[_0x0726('0x20')]);_0x1eb23d['messages'][_0x0726('0x21')]({'body':_0xea1f56[_0x0726('0x22')],'to':_0xea1f56[_0x0726('0x1f')],'from':_0x56ca38[_0x0726('0x1f')],'statusCallback':_0x56ca38[_0x0726('0x23')]+'/api/sms/messages/'+_0xea1f56['id']+_0x0726('0x24')+_0x56ca38[_0x0726('0x25')]})[_0x0726('0x17')](function(_0xb7df72){if(_0xb7df72['sid']){return _0x11c506[_0x0726('0x18')]({'messageId':_0xb7df72['sid']});}})[_0x0726('0x1a')](function(_0x177d0d){logger[_0x0726('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0x0726('0x27')](_0x177d0d,{'showHidden':![],'depth':null}));});}else{logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x1d'),_0x0726('0x2a'));}break;case _0x0726('0x2b'):var _0xbc9ebb=_0x0726('0x2c');if(_0x56ca38[_0x0726('0x2d')]&&_0x56ca38[_0x0726('0x2e')]){var _0x5bb695={'recipient':[_0xea1f56[_0x0726('0x1f')]],'message':_0xea1f56[_0x0726('0x22')],'message_type':_0x56ca38[_0x0726('0x2f')]};if(_0x56ca38[_0x0726('0x2f')]&&_0x56ca38[_0x0726('0x2f')]!=='SI'){_0x5bb695[_0x0726('0x30')]=_0x56ca38[_0x0726('0x1f')];}var _0x253d81={'url':_0xbc9ebb+_0x0726('0x31')+_0x56ca38[_0x0726('0x2d')]+_0x0726('0x32')+_0x56ca38[_0x0726('0x2e')],'method':'GET'};rp(_0x253d81)[_0x0726('0x17')](function(_0x187042){var _0x268276=_0x187042[_0x0726('0x33')](';');var _0x1260b6={'user_key':_0x268276[0x0],'session_key':_0x268276[0x1]};_0x253d81={'url':_0xbc9ebb+_0x0726('0x34'),'method':_0x0726('0x35'),'headers':{'user_key':_0x1260b6[_0x0726('0x36')],'Session_key':_0x1260b6['session_key']},'json':!![],'body':_0x5bb695};return rp(_0x253d81);})['then'](function(_0x1c3313){if(_0x1c3313[_0x0726('0x37')]>=0x1){var _0x544878={'messageId':_0x1c3313[_0x0726('0x38')]};if(_0x56ca38[_0x0726('0x2f')]!=='GP'||!_0x56ca38['deliveryReport']){_0x544878['read']=!![];}return _0x11c506['update'](_0x544878);}else{return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x2b'),util[_0x0726('0x27')](_0x1c3313,{'showHidden':![],'depth':null}));}})[_0x0726('0x1a')](function(_0x2390b0){return logger[_0x0726('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0726('0x2b'),util['inspect'](_0x2390b0,{'showHidden':![],'depth':null}));});}else{logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0726('0x39'):if(_0x56ca38[_0x0726('0x20')]){var _0x53a588={'recipient':_0xea1f56[_0x0726('0x1f')],'message':_0xea1f56['body'],'sender':_0x56ca38[_0x0726('0x3a')]||_0x56ca38[_0x0726('0x1f')],'authorization':_0x56ca38[_0x0726('0x20')]};var _0x596360={'method':_0x0726('0x35'),'uri':_0x0726('0x3b'),'body':_0x53a588,'json':!![]};rp(_0x596360)[_0x0726('0x17')](function(_0x59b3dc){var _0x5ac4b1={'messageId':_0x59b3dc[_0x0726('0x3c')]};if(!_0x56ca38[_0x0726('0x3d')]){_0x5ac4b1[_0x0726('0x3e')]=!![];}return _0x11c506['update'](_0x5ac4b1);})[_0x0726('0x1a')](function(_0x223b9a){logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x39'),util[_0x0726('0x27')](_0x223b9a,{'showHidden':![],'depth':null}));});}else{logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x56ca38[_0x0726('0x2d')]&&_0x56ca38[_0x0726('0x2e')]){var _0x53a588={'messages':[{'source':_0x0726('0x3f'),'to':_0xea1f56[_0x0726('0x1f')],'body':_0xea1f56[_0x0726('0x22')],'from':_0x56ca38[_0x0726('0x3a')]||_0x56ca38['phone']}]};var _0x32a541=util[_0x0726('0x40')](_0x0726('0x41'),_0x56ca38[_0x0726('0x2d')],_0x56ca38['password']);var _0x596360={'method':_0x0726('0x35'),'uri':_0x0726('0x42'),'body':_0x53a588,'headers':{'Authorization':util['format'](_0x0726('0x43'),new Buffer(_0x32a541)[_0x0726('0x44')]('base64'))},'json':!![]};rp(_0x596360)[_0x0726('0x17')](function(_0x159011){if(_0x159011['http_code']>=0xc8&&_0x159011['http_code']<=0xce){if(_0x159011[_0x0726('0x45')]&&_0x159011[_0x0726('0x45')]['queued_count']>0x0){var _0x2d1942=_['head'](_0x159011[_0x0726('0x45')]['messages']);var _0x119ff5={'messageId':_0x2d1942[_0x0726('0x46')]};if(!_0x56ca38[_0x0726('0x3d')]){_0x119ff5['read']=!![];}return _0x11c506[_0x0726('0x18')](_0x119ff5);}else{logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x47'),util[_0x0726('0x27')](_0x159011,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x47'),util[_0x0726('0x27')](_0x159011,{'showHidden':![],'depth':null}));}})[_0x0726('0x1a')](function(_0x76d506){logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x47'),util[_0x0726('0x27')](_0x76d506,{'showHidden':![],'depth':null}));});}else{logger[_0x0726('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0726('0x29'),_0x0726('0x47'),_0x0726('0x48'));}break;case _0x0726('0x49'):if(_0x56ca38[_0x0726('0x4a')]&&_0x56ca38[_0x0726('0x20')]){var _0x53a588={'dst':_0xea1f56[_0x0726('0x1f')],'text':_0xea1f56['body'],'src':_0x56ca38['senderString']||_0x56ca38[_0x0726('0x1f')],'url':_0x56ca38[_0x0726('0x23')]+_0x0726('0x4b')+_0xea1f56['id']+_0x0726('0x24')+_0x56ca38[_0x0726('0x25')]};var _0x32a541=util[_0x0726('0x40')]('%s:%s',_0x56ca38['authId'],_0x56ca38[_0x0726('0x20')]);var _0x596360={'method':_0x0726('0x35'),'uri':util[_0x0726('0x40')](_0x0726('0x4c'),_0x56ca38[_0x0726('0x4a')]),'body':_0x53a588,'headers':{'Authorization':util[_0x0726('0x40')](_0x0726('0x43'),new Buffer(_0x32a541)[_0x0726('0x44')](_0x0726('0x4d')))},'json':!![]};rp(_0x596360)['then'](function(_0x3cae19){var _0x59ffc7={'messageId':_0x3cae19[_0x0726('0x4e')][0x0]};return _0x11c506['update'](_0x59ffc7);})[_0x0726('0x1a')](function(_0x57530b){logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x49'),util['inspect'](_0x57530b,{'showHidden':![],'depth':null}));});}else{logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x49'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x0726('0x4f'):if(_0x56ca38[_0x0726('0x2d')]&&_0x56ca38[_0x0726('0x2e')]){if(_0x56ca38[_0x0726('0x50')]){var _0x94c541={'method':_0x0726('0x35'),'uri':_0x56ca38[_0x0726('0x50')]+_0x0726('0x51'),'body':{'username':_0x56ca38[_0x0726('0x2d')],'password':_0x56ca38[_0x0726('0x2e')]},'json':!![]};return rp(_0x94c541)[_0x0726('0x17')](function(_0x15c9dc){var _0x57faff={'method':_0x0726('0x35'),'uri':_0x56ca38[_0x0726('0x50')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x56ca38[_0x0726('0x1f')],'destinations':[{'to':_0xea1f56[_0x0726('0x1f')]}],'text':_0xea1f56['body'],'notifyUrl':_0x56ca38[_0x0726('0x23')]+_0x0726('0x4b')+_0xea1f56['id']+_0x0726('0x24')+_0x56ca38[_0x0726('0x25')],'notifyContentType':'application/json','callbackData':_0x56ca38[_0x0726('0x1f')]+';'+_0xea1f56[_0x0726('0x22')]}]},'headers':{'Authorization':_0x0726('0x52')+_0x15c9dc['token']},'json':!![]};return rp(_0x57faff)[_0x0726('0x17')](function(_0x47c9b9){if(_0x47c9b9[_0x0726('0x53')]){var _0x550d89={'messageId':_0x47c9b9[_0x0726('0x53')][0x0][_0x0726('0xd')]};if(!_0x56ca38[_0x0726('0x3d')]){_0x550d89[_0x0726('0x3e')]=!![];}return _0x11c506['update'](_0x550d89);}else{return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x4f'),util[_0x0726('0x27')](_0x47c9b9,{'showHidden':![],'depth':null}));}});})[_0x0726('0x1a')](function(_0x5110e7){return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),'infobip',util[_0x0726('0x27')](_0x5110e7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x4f'),_0x0726('0x54'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0726('0x29'),_0x0726('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0726('0x55'):var _0x17095d=require(_0x0726('0x56'));if(_0x56ca38['apiKey']){var _0x5e852d={};_0x5e852d['login']=_0x56ca38[_0x0726('0x2d')];_0x5e852d[_0x0726('0x1f')]=_0xea1f56[_0x0726('0x1f')];_0x5e852d[_0x0726('0x30')]=_0x56ca38[_0x0726('0x1f')];_0x5e852d['text']=_0xea1f56[_0x0726('0x22')];_0x5e852d[_0x0726('0x57')]=+new Date();var _0x231904='';var _0x399ade='';var _0x5088b5=Object[_0x0726('0x58')](_0x5e852d);_0x5088b5[_0x0726('0x59')]();for(var _0x207ee0=0x0;_0x207ee0<_0x5088b5[_0x0726('0x5a')];_0x207ee0++){if(_0x231904!=''){_0x231904+='&';}_0x231904+=_0x5088b5[_0x207ee0]+'='+encodeURIComponent(_0x5e852d[_0x5088b5[_0x207ee0]]);_0x399ade+=_0x5e852d[_0x5088b5[_0x207ee0]];}_0x399ade+=_0x56ca38[_0x0726('0x5b')];_0x399ade=_0x17095d[_0x0726('0x5c')]('md5')[_0x0726('0x18')](_0x399ade)[_0x0726('0x5d')]('hex');if(_0x231904!==''){_0x231904+='&';}_0x231904+=_0x0726('0x5e')+_0x399ade;var _0x253d81={'method':_0x0726('0x5f'),'uri':_0x56ca38['baseUrl']+_0x0726('0x60')+_0x231904,'json':!![]};return rp(_0x253d81)['then'](function(_0x176f9e){var _0x2be7bc=Object[_0x0726('0x58')](_0x176f9e);if(_0x176f9e[_0x2be7bc[0x0]][_0x0726('0x26')]&&parseInt(_0x176f9e[_0x2be7bc[0x0]][_0x0726('0x26')])===0x0){var _0x5ed908={'messageId':_0x176f9e[_0x2be7bc[0x0]][_0x0726('0x61')]};if(!_0x56ca38['deliveryReport']){_0x5ed908['read']=!![];}return _0x11c506[_0x0726('0x18')](_0x5ed908);}else{return logger[_0x0726('0x26')](_0x0726('0x28'),'afterCreate',_0x0726('0x55'),util[_0x0726('0x27')](_0x176f9e['error'],{'showHidden':![],'depth':null}));}})[_0x0726('0x1a')](function(_0x381606){return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x55'),util[_0x0726('0x27')](_0x381606,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0726('0x29'),_0x0726('0x55'),_0x0726('0x62'));}break;case'clickatell':if(_0x56ca38[_0x0726('0x5b')]){var _0x2fa175={'method':_0x0726('0x35'),'uri':_0x0726('0x63'),'headers':{'Authorization':_0x56ca38['apiKey']},'body':{'content':_0xea1f56[_0x0726('0x22')],'to':[_0xea1f56[_0x0726('0x1f')]],'from':_0x56ca38['phone'],'binary':![],'clientMessageId':_0x0726('0x64'),'charset':_0x0726('0x65')},'json':!![]};rp(_0x2fa175)[_0x0726('0x17')](function(_0x172e13){if(!_0x172e13[_0x0726('0x26')]){var _0x35ec85={'messageId':_0x172e13[_0x0726('0x53')][0x0][_0x0726('0x66')]};if(!_0x56ca38[_0x0726('0x3d')]){_0x35ec85[_0x0726('0x3e')]=!![];}return _0x11c506[_0x0726('0x18')](_0x35ec85);}else{return logger['error'](_0x0726('0x28'),'afterCreate','clickatell',util[_0x0726('0x27')](_0x172e13[_0x0726('0x26')],{'showHidden':![],'depth':null}));}})[_0x0726('0x1a')](function(_0x2b98f3){return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x67'),util[_0x0726('0x27')](_0x2b98f3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0726('0x29'),_0x0726('0x67'),_0x0726('0x62'));}break;case _0x0726('0x68'):if(_0x56ca38['username']&&_0x56ca38[_0x0726('0x2e')]){var _0x32a541=util['format'](_0x0726('0x41'),_0x56ca38[_0x0726('0x2d')],_0x56ca38['password']);var _0x596360={'method':_0x0726('0x35'),'uri':_0x0726('0x69')+_0x56ca38[_0x0726('0x6a')]+_0x0726('0x6b'),'body':{'to':[_0xea1f56[_0x0726('0x1f')]],'text':_0xea1f56[_0x0726('0x22')],'from':_0x56ca38[_0x0726('0x1f')],'applicationId':_0x56ca38[_0x0726('0x6c')]},'headers':{'Authorization':util[_0x0726('0x40')]('Basic\x20%s',new Buffer(_0x32a541)[_0x0726('0x44')](_0x0726('0x4d')))},'json':!![]};rp(_0x596360)[_0x0726('0x17')](function(_0xca5b9a){if(_0xca5b9a['id']){var _0x507fa6={'messageId':_0xca5b9a['id']};return _0x11c506[_0x0726('0x18')](_0x507fa6);}else{logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),'bandwidth',util[_0x0726('0x27')](_0xca5b9a,{'showHidden':![],'depth':null}));}})[_0x0726('0x1a')](function(_0x6152d4){logger[_0x0726('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0726('0x68'),util[_0x0726('0x27')](_0x6152d4,{'showHidden':![],'depth':null}));});}else{logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x0726('0x6d'):if(_0x56ca38[_0x0726('0x5b')]){var _0x279d5c={};var _0x253d81={'method':_0x0726('0x35'),'uri':_0x0726('0x6e'),'headers':{'Authorization':_0x0726('0x6f')+_0x56ca38[_0x0726('0x5b')],'Content-Type':_0x0726('0x70')},'body':{'from':_0x56ca38['phone'],'to':_0xea1f56[_0x0726('0x1f')],'text':_0xea1f56[_0x0726('0x22')]},'json':!![]};return rp(_0x253d81)[_0x0726('0x17')](function(_0xc04ed7){if(_0xc04ed7['code']==0xca){_0x279d5c[_0x0726('0x71')]=_0xc04ed7;var _0x2f00d3={'method':_0x0726('0x35'),'uri':_0x0726('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x56ca38[_0x0726('0x5b')],'Content-Type':_0x0726('0x70')},'body':{'refid':_0x279d5c['message']['refid']},'json':!![]};return rp(_0x2f00d3)[_0x0726('0x17')](function(_0x1fdca4){_0x279d5c[_0x0726('0x73')]=_0x1fdca4;var _0x51f17d={'messageId':_0x279d5c['message'][_0x0726('0x74')],'read':!![]};return _0x11c506[_0x0726('0x18')](_0x51f17d);});}else{return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),'intelepeer',util['inspect'](_0xc04ed7,{'showHidden':![],'depth':null}));}})[_0x0726('0x1a')](function(_0x20f7a2){return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x6d'),util[_0x0726('0x27')](_0x20f7a2,{'showHidden':![],'depth':null}));});}else{return logger[_0x0726('0x26')](_0x0726('0x28'),_0x0726('0x29'),_0x0726('0x6d'),_0x0726('0x75'));}break;}}})['finally'](function(){_0x234fb5();});}else{_0x234fb5();}}},'charset':_0x0726('0x76'),'collate':_0x0726('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d4dffca..85ee659 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 _0xba03=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','raw','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x35d546,_0x3d9ba3){var _0x4349e5=function(_0x14efa5){while(--_0x14efa5){_0x35d546['push'](_0x35d546['shift']());}};_0x4349e5(++_0x3d9ba3);}(_0xba03,0x1c0));var _0x3ba0=function(_0x1ccc32,_0x1f4018){_0x1ccc32=_0x1ccc32-0x0;var _0x306522=_0xba03[_0x1ccc32];return _0x306522;};'use strict';var _=require(_0x3ba0('0x0'));var util=require(_0x3ba0('0x1'));var moment=require(_0x3ba0('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ba0('0x3'));var fs=require('fs');var Redis=require(_0x3ba0('0x4'));var db=require(_0x3ba0('0x5'))['db'];var utils=require(_0x3ba0('0x6'));var logger=require('../../config/logger')(_0x3ba0('0x7'));var config=require(_0x3ba0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3ba0('0x9')][_0x3ba0('0xa')]({'port':0x232a});config[_0x3ba0('0xb')]=_[_0x3ba0('0xc')](config[_0x3ba0('0xb')],{'host':_0x3ba0('0xd'),'port':0x18eb});var socket=require(_0x3ba0('0xe'))(new Redis(config[_0x3ba0('0xb')]));require(_0x3ba0('0xf'))[_0x3ba0('0x10')](socket);function respondWithRpcPromise(_0x24adf4,_0xdd84b8,_0x531f0c){return new BPromise(function(_0x3c5c17,_0x1fc90e){return client[_0x3ba0('0x11')](_0x24adf4,_0x531f0c)['then'](function(_0x3cee32){logger[_0x3ba0('0x12')](_0x3ba0('0x13'),_0xdd84b8,_0x3ba0('0x14'));logger[_0x3ba0('0x15')](_0x3ba0('0x16'),_0xdd84b8,_0x3ba0('0x14'),JSON['stringify'](_0x3cee32));if(_0x3cee32[_0x3ba0('0x17')]){if(_0x3cee32[_0x3ba0('0x17')][_0x3ba0('0x18')]===0x1f4){logger['error'](_0x3ba0('0x13'),_0xdd84b8,_0x3cee32[_0x3ba0('0x17')][_0x3ba0('0x19')]);return _0x1fc90e(_0x3cee32[_0x3ba0('0x17')][_0x3ba0('0x19')]);}logger[_0x3ba0('0x17')](_0x3ba0('0x13'),_0xdd84b8,_0x3cee32[_0x3ba0('0x17')]['message']);return _0x3c5c17(_0x3cee32['error'][_0x3ba0('0x19')]);}else{logger[_0x3ba0('0x12')]('SmsMessage,\x20%s,\x20%s',_0xdd84b8,'request\x20sent');_0x3c5c17(_0x3cee32[_0x3ba0('0x1a')][_0x3ba0('0x19')]);}})[_0x3ba0('0x1b')](function(_0x44e42a){logger['error'](_0x3ba0('0x13'),_0xdd84b8,_0x44e42a);_0x1fc90e(_0x44e42a);});});}exports[_0x3ba0('0x1c')]=function(_0x37de93){var _0x1f2247=this;return new Promise(function(_0x1678f1,_0xad67a3){return db[_0x3ba0('0x1d')][_0x3ba0('0x1e')](_0x37de93[_0x3ba0('0x1f')],{'raw':_0x37de93['options']?_0x37de93['options'][_0x3ba0('0x20')]===undefined?!![]:![]:!![]})[_0x3ba0('0x21')](function(_0xf0d77){logger['info'](_0x3ba0('0x1c'),_0x37de93);logger[_0x3ba0('0x15')](_0x3ba0('0x1c'),_0x37de93,JSON[_0x3ba0('0x22')](_0xf0d77));_0x1678f1(_0xf0d77);})['catch'](function(_0x5d1d3a){logger[_0x3ba0('0x17')](_0x3ba0('0x1c'),_0x5d1d3a[_0x3ba0('0x19')],_0x37de93);_0xad67a3(_0x1f2247[_0x3ba0('0x17')](0x1f4,_0x5d1d3a[_0x3ba0('0x19')]));});});}; \ No newline at end of file +var _0xe68e=['message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11862,_0x57693c){var _0x392999=function(_0x4a5371){while(--_0x4a5371){_0x11862['push'](_0x11862['shift']());}};_0x392999(++_0x57693c);}(_0xe68e,0xf1));var _0xee68=function(_0x187f71,_0xf40f00){_0x187f71=_0x187f71-0x0;var _0xdf027a=_0xe68e[_0x187f71];return _0xdf027a;};'use strict';var _=require(_0xee68('0x0'));var util=require(_0xee68('0x1'));var moment=require(_0xee68('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee68('0x3'));var db=require(_0xee68('0x4'))['db'];var utils=require(_0xee68('0x5'));var logger=require(_0xee68('0x6'))(_0xee68('0x7'));var config=require(_0xee68('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee68('0x9')]({'port':0x232a});config[_0xee68('0xa')]=_[_0xee68('0xb')](config[_0xee68('0xa')],{'host':_0xee68('0xc'),'port':0x18eb});var socket=require(_0xee68('0xd'))(new Redis(config['redis']));require(_0xee68('0xe'))['register'](socket);function respondWithRpcPromise(_0x5e660b,_0x22cba7,_0x480632){return new BPromise(function(_0xfe0cdc,_0x5d9792){return client[_0xee68('0xf')](_0x5e660b,_0x480632)[_0xee68('0x10')](function(_0x20f0e6){logger['info'](_0xee68('0x11'),_0x22cba7,_0xee68('0x12'));logger['debug'](_0xee68('0x13'),_0x22cba7,_0xee68('0x12'),JSON[_0xee68('0x14')](_0x20f0e6));if(_0x20f0e6['error']){if(_0x20f0e6[_0xee68('0x15')][_0xee68('0x16')]===0x1f4){logger['error'](_0xee68('0x11'),_0x22cba7,_0x20f0e6[_0xee68('0x15')][_0xee68('0x17')]);return _0x5d9792(_0x20f0e6[_0xee68('0x15')][_0xee68('0x17')]);}logger[_0xee68('0x15')](_0xee68('0x11'),_0x22cba7,_0x20f0e6['error'][_0xee68('0x17')]);return _0xfe0cdc(_0x20f0e6[_0xee68('0x15')][_0xee68('0x17')]);}else{logger[_0xee68('0x18')]('SmsMessage,\x20%s,\x20%s',_0x22cba7,'request\x20sent');_0xfe0cdc(_0x20f0e6[_0xee68('0x19')][_0xee68('0x17')]);}})[_0xee68('0x1a')](function(_0x6665a9){logger[_0xee68('0x15')](_0xee68('0x11'),_0x22cba7,_0x6665a9);_0x5d9792(_0x6665a9);});});}exports[_0xee68('0x1b')]=function(_0x10b21b){var _0x59988a=this;return new Promise(function(_0xfa5eda,_0x1e2cbd){return db[_0xee68('0x1c')][_0xee68('0x1d')](_0x10b21b['body'],{'raw':_0x10b21b[_0xee68('0x1e')]?_0x10b21b['options'][_0xee68('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1ca0e2){logger['info'](_0xee68('0x1b'),_0x10b21b);logger[_0xee68('0x20')](_0xee68('0x1b'),_0x10b21b,JSON['stringify'](_0x1ca0e2));_0xfa5eda(_0x1ca0e2);})[_0xee68('0x1a')](function(_0x538374){logger['error'](_0xee68('0x1b'),_0x538374[_0xee68('0x17')],_0x10b21b);_0x1e2cbd(_0x59988a[_0xee68('0x15')](0x1f4,_0x538374['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e562b9c..29711a2 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 _0xc9b3=['emit','removeListener','length','./smsMessage.events','save','update'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xc9b3,0x1a1));var _0x3c9b=function(_0x3b3258,_0x574f97){_0x3b3258=_0x3b3258-0x0;var _0x46c937=_0xc9b3[_0x3b3258];return _0x46c937;};'use strict';var SmsMessageEvents=require(_0x3c9b('0x0'));var events=[_0x3c9b('0x1'),'remove',_0x3c9b('0x2')];function createListener(_0x5336b3,_0x5853ef){return function(_0x43d943){_0x5853ef[_0x3c9b('0x3')](_0x5336b3,_0x43d943);};}function removeListener(_0x3681e7,_0x27a6e8){return function(){SmsMessageEvents[_0x3c9b('0x4')](_0x3681e7,_0x27a6e8);};}exports['register']=function(_0x47d622){for(var _0xfc586a=0x0,_0x5f100c=events[_0x3c9b('0x5')];_0xfc586a<_0x5f100c;_0xfc586a++){var _0x3706c0=events[_0xfc586a];var _0x565d03=createListener('smsMessage:'+_0x3706c0,_0x47d622);SmsMessageEvents['on'](_0x3706c0,_0x565d03);}}; \ No newline at end of file +var _0xc828=['length','smsMessage:','save','remove','update','emit','removeListener','register'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc828,0x1a2));var _0x8c82=function(_0x578967,_0x1a9c08){_0x578967=_0x578967-0x0;var _0x4d06d2=_0xc828[_0x578967];return _0x4d06d2;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x8c82('0x0'),_0x8c82('0x1'),_0x8c82('0x2')];function createListener(_0x58e01d,_0x54c195){return function(_0x47888b){_0x54c195[_0x8c82('0x3')](_0x58e01d,_0x47888b);};}function removeListener(_0xd7ceba,_0x2e1f41){return function(){SmsMessageEvents[_0x8c82('0x4')](_0xd7ceba,_0x2e1f41);};}exports[_0x8c82('0x5')]=function(_0x54f61f){for(var _0xcaacb8=0x0,_0x321e01=events[_0x8c82('0x6')];_0xcaacb8<_0x321e01;_0xcaacb8++){var _0x2f4da7=events[_0xcaacb8];var _0xfae2aa=createListener(_0x8c82('0x7')+_0x2f4da7,_0x54f61f);SmsMessageEvents['on'](_0x2f4da7,_0xfae2aa);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 83753cb..7f1829c 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 _0x5d6b=['get','/describe','isAuthenticated','describe','/:id','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsQueue.controller'];(function(_0x555057,_0x539fff){var _0x420780=function(_0x201065){while(--_0x201065){_0x555057['push'](_0x555057['shift']());}};_0x420780(++_0x539fff);}(_0x5d6b,0x181));var _0xb5d6=function(_0x55811e,_0x59f0d7){_0x55811e=_0x55811e-0x0;var _0x2880a7=_0x5d6b[_0x55811e];return _0x2880a7;};'use strict';var multer=require('multer');var util=require(_0xb5d6('0x0'));var path=require('path');var timeout=require(_0xb5d6('0x1'));var express=require(_0xb5d6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb5d6('0x3'));var interaction=require(_0xb5d6('0x4'));var config=require('../../config/environment');var controller=require(_0xb5d6('0x5'));router[_0xb5d6('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb5d6('0x6')](_0xb5d6('0x7'),auth[_0xb5d6('0x8')](),controller[_0xb5d6('0x9')]);router[_0xb5d6('0x6')](_0xb5d6('0xa'),auth[_0xb5d6('0x8')](),controller['show']);router[_0xb5d6('0x6')]('/:id/members',auth[_0xb5d6('0x8')](),controller['getMembers']);router[_0xb5d6('0x6')]('/:id/teams',auth[_0xb5d6('0x8')](),controller[_0xb5d6('0xb')]);router[_0xb5d6('0x6')](_0xb5d6('0xc'),auth[_0xb5d6('0x8')](),controller[_0xb5d6('0xd')]);router[_0xb5d6('0xe')]('/',auth[_0xb5d6('0x8')](),controller[_0xb5d6('0xf')]);router[_0xb5d6('0xe')]('/:id/teams',auth[_0xb5d6('0x8')](),controller[_0xb5d6('0x10')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xb5d6('0x11')]);router[_0xb5d6('0x12')]('/:id',auth[_0xb5d6('0x8')](),controller[_0xb5d6('0x13')]);router[_0xb5d6('0x14')]('/:id',auth[_0xb5d6('0x8')](),controller[_0xb5d6('0x15')]);router[_0xb5d6('0x14')]('/:id/teams',auth[_0xb5d6('0x8')](),controller['removeTeams']);router['delete'](_0xb5d6('0xc'),auth[_0xb5d6('0x8')](),controller[_0xb5d6('0x16')]);module['exports']=router; \ No newline at end of file +var _0x74ad=['exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0x59d600,_0x4a87e8){var _0x553014=function(_0x4f8ed2){while(--_0x4f8ed2){_0x59d600['push'](_0x59d600['shift']());}};_0x553014(++_0x4a87e8);}(_0x74ad,0x11f));var _0xd74a=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x74ad[_0x301148];return _0x42ce24;};'use strict';var multer=require(_0xd74a('0x0'));var util=require('util');var path=require(_0xd74a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd74a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd74a('0x3'));var interaction=require(_0xd74a('0x4'));var config=require('../../config/environment');var controller=require(_0xd74a('0x5'));router[_0xd74a('0x6')]('/',auth[_0xd74a('0x7')](),controller[_0xd74a('0x8')]);router['get']('/describe',auth[_0xd74a('0x7')](),controller['describe']);router[_0xd74a('0x6')](_0xd74a('0x9'),auth[_0xd74a('0x7')](),controller[_0xd74a('0xa')]);router[_0xd74a('0x6')](_0xd74a('0xb'),auth[_0xd74a('0x7')](),controller[_0xd74a('0xc')]);router[_0xd74a('0x6')](_0xd74a('0xd'),auth[_0xd74a('0x7')](),controller[_0xd74a('0xe')]);router[_0xd74a('0x6')](_0xd74a('0xf'),auth[_0xd74a('0x7')](),controller[_0xd74a('0x10')]);router[_0xd74a('0x11')]('/',auth[_0xd74a('0x7')](),controller[_0xd74a('0x12')]);router[_0xd74a('0x11')](_0xd74a('0xd'),auth[_0xd74a('0x7')](),controller['addTeams']);router[_0xd74a('0x11')](_0xd74a('0xf'),auth['isAuthenticated'](),controller[_0xd74a('0x13')]);router['put'](_0xd74a('0x9'),auth[_0xd74a('0x7')](),controller[_0xd74a('0x14')]);router[_0xd74a('0x15')](_0xd74a('0x9'),auth[_0xd74a('0x7')](),controller[_0xd74a('0x16')]);router[_0xd74a('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd74a('0x17')]);router['delete'](_0xd74a('0xf'),auth[_0xd74a('0x7')](),controller[_0xd74a('0x18')]);module[_0xd74a('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7de249a..beab51b 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 _0xfc83=['roundrobin','sequelize','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x9d07d7,_0x384334){var _0x4b7483=function(_0x407b08){while(--_0x407b08){_0x9d07d7['push'](_0x9d07d7['shift']());}};_0x4b7483(++_0x384334);}(_0xfc83,0x129));var _0x3fc8=function(_0x27c0e0,_0x4d7673){_0x27c0e0=_0x27c0e0-0x0;var _0x217c01=_0xfc83[_0x27c0e0];return _0x217c01;};'use strict';var Sequelize=require(_0x3fc8('0x0'));module[_0x3fc8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3fc8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3fc8('0x3')]},'timeout':{'type':Sequelize[_0x3fc8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3fc8('0x5'),_0x3fc8('0x6'),_0x3fc8('0x7'))}}; \ No newline at end of file +var _0x0d07=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x0d07,0x1ce));var _0x70d0=function(_0x2c7d07,_0x5b252d){_0x2c7d07=_0x2c7d07-0x0;var _0x14c3dc=_0x0d07[_0x2c7d07];return _0x14c3dc;};'use strict';var Sequelize=require(_0x70d0('0x0'));module[_0x70d0('0x1')]={'name':{'type':Sequelize[_0x70d0('0x2')],'unique':_0x70d0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x70d0('0x2')]},'timeout':{'type':Sequelize[_0x70d0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x70d0('0x5')]('rrmemory',_0x70d0('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 536901e..dfef8d3 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x22a467,_0x3f1678){var _0x55c84c=function(_0x24355a){while(--_0x24355a){_0x22a467['push'](_0x22a467['shift']());}};_0x55c84c(++_0x3f1678);}(_0x7a54,0x106));var _0x47a5=function(_0x16eb3f,_0x3459ec){_0x16eb3f=_0x16eb3f-0x0;var _0x4a3982=_0x7a54[_0x16eb3f];return _0x4a3982;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0xadb5,0xad));var _0x5adb=function(_0x12a6d0,_0xcc196a){_0x12a6d0=_0x12a6d0-0x0;var _0x218b7f=_0xadb5[_0x12a6d0];return _0x218b7f;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 995e1c1..ee521b0 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 _0x6c06=['setMaxListeners','save','update','remove','emit','hook','exports','SmsQueue'];(function(_0x57b58c,_0x17082f){var _0x5813db=function(_0x3672cb){while(--_0x3672cb){_0x57b58c['push'](_0x57b58c['shift']());}};_0x5813db(++_0x17082f);}(_0x6c06,0x187));var _0x66c0=function(_0x2c1333,_0x5833ce){_0x2c1333=_0x2c1333-0x0;var _0x5eb3a9=_0x6c06[_0x2c1333];return _0x5eb3a9;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x66c0('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x66c0('0x1')](0x0);var events={'afterCreate':_0x66c0('0x2'),'afterUpdate':_0x66c0('0x3'),'afterDestroy':_0x66c0('0x4')};function emitEvent(_0xe8ecd){return function(_0xb9d6fc,_0xcf1460,_0x507912){SmsQueueEvents['emit'](_0xe8ecd+':'+_0xb9d6fc['id'],_0xb9d6fc);SmsQueueEvents[_0x66c0('0x5')](_0xe8ecd,_0xb9d6fc);_0x507912(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x66c0('0x6')](e,emitEvent(event));}}module[_0x66c0('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xf899=['SmsQueue','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xebc5c7,_0x4b821a){var _0x2776f9=function(_0x282ffb){while(--_0x282ffb){_0xebc5c7['push'](_0xebc5c7['shift']());}};_0x2776f9(++_0x4b821a);}(_0xf899,0x157));var _0x9f89=function(_0x1d7d7e,_0x5d9682){_0x1d7d7e=_0x1d7d7e-0x0;var _0x597dc8=_0xf899[_0x1d7d7e];return _0x597dc8;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x9f89('0x0'))['db'][_0x9f89('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f89('0x2'),'afterUpdate':_0x9f89('0x3'),'afterDestroy':'remove'};function emitEvent(_0x241cc1){return function(_0x545ca0,_0x4af2ad,_0x83b712){SmsQueueEvents['emit'](_0x241cc1+':'+_0x545ca0['id'],_0x545ca0);SmsQueueEvents[_0x9f89('0x4')](_0x241cc1,_0x545ca0);_0x83b712(null);};}for(var e in events){if(events[_0x9f89('0x5')](e)){var event=events[e];SmsQueue[_0x9f89('0x6')](e,emitEvent(event));}}module[_0x9f89('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 9f0b2d6..338de55 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 _0x6c56=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x19a6a7,_0x37f4d3){var _0x1bb1b3=function(_0x27d356){while(--_0x27d356){_0x19a6a7['push'](_0x19a6a7['shift']());}};_0x1bb1b3(++_0x37f4d3);}(_0x6c56,0x191));var _0x66c5=function(_0x48aaca,_0x140945){_0x48aaca=_0x48aaca-0x0;var _0xac5ed9=_0x6c56[_0x48aaca];return _0xac5ed9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66c5('0x0'))(_0x66c5('0x1'));var moment=require(_0x66c5('0x2'));var BPromise=require(_0x66c5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66c5('0x4'));var rimraf=require(_0x66c5('0x5'));var config=require('../../config/environment');var attributes=require(_0x66c5('0x6'));module[_0x66c5('0x7')]=function(_0x488864,_0x24afc9){return _0x488864[_0x66c5('0x8')](_0x66c5('0x9'),attributes,{'tableName':_0x66c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfa9=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger','api','bluebird'];(function(_0x305ea7,_0x9764c){var _0x3b9b60=function(_0x103b26){while(--_0x103b26){_0x305ea7['push'](_0x305ea7['shift']());}};_0x3b9b60(++_0x9764c);}(_0xbfa9,0x1e7));var _0x9bfa=function(_0x3f4070,_0x3ff2a6){_0x3f4070=_0x3f4070-0x0;var _0x1063be=_0xbfa9[_0x3f4070];return _0x1063be;};'use strict';var _=require(_0x9bfa('0x0'));var util=require(_0x9bfa('0x1'));var logger=require(_0x9bfa('0x2'))(_0x9bfa('0x3'));var moment=require('moment');var BPromise=require(_0x9bfa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bfa('0x5'));var rimraf=require(_0x9bfa('0x6'));var config=require(_0x9bfa('0x7'));var attributes=require(_0x9bfa('0x8'));module[_0x9bfa('0x9')]=function(_0x53efe8,_0x1323df){return _0x53efe8[_0x9bfa('0xa')](_0x9bfa('0xb'),attributes,{'tableName':'sms_queues','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 2a42b75..bcf66ed 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 _0x5f12=['where','attributes','limit','include','map','model','then','debug','catch','ShowSmsQueue','SmsQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','findAll','options','raw'];(function(_0x2e6b3d,_0x5226b4){var _0x5b3306=function(_0x508b34){while(--_0x508b34){_0x2e6b3d['push'](_0x2e6b3d['shift']());}};_0x5b3306(++_0x5226b4);}(_0x5f12,0x1eb));var _0x25f1=function(_0x1dd137,_0x1a8e2e){_0x1dd137=_0x1dd137-0x0;var _0x206e38=_0x5f12[_0x1dd137];return _0x206e38;};'use strict';var _=require('lodash');var util=require(_0x25f1('0x0'));var moment=require(_0x25f1('0x1'));var BPromise=require(_0x25f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25f1('0x3'));var db=require(_0x25f1('0x4'))['db'];var utils=require(_0x25f1('0x5'));var logger=require('../../config/logger')(_0x25f1('0x6'));var config=require(_0x25f1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x25f1('0x8')][_0x25f1('0x9')]({'port':0x232a});config[_0x25f1('0xa')]=_[_0x25f1('0xb')](config[_0x25f1('0xa')],{'host':_0x25f1('0xc'),'port':0x18eb});var socket=require(_0x25f1('0xd'))(new Redis(config['redis']));require(_0x25f1('0xe'))['register'](socket);function respondWithRpcPromise(_0x39fee6,_0x322a94,_0x311718){return new BPromise(function(_0x1c467a,_0x2646e3){return client[_0x25f1('0xf')](_0x39fee6,_0x311718)['then'](function(_0x5be568){logger[_0x25f1('0x10')](_0x25f1('0x11'),_0x322a94,_0x25f1('0x12'));logger['debug'](_0x25f1('0x13'),_0x322a94,'request\x20sent',JSON[_0x25f1('0x14')](_0x5be568));if(_0x5be568[_0x25f1('0x15')]){if(_0x5be568['error'][_0x25f1('0x16')]===0x1f4){logger[_0x25f1('0x15')](_0x25f1('0x11'),_0x322a94,_0x5be568[_0x25f1('0x15')]['message']);return _0x2646e3(_0x5be568['error'][_0x25f1('0x17')]);}logger[_0x25f1('0x15')](_0x25f1('0x11'),_0x322a94,_0x5be568[_0x25f1('0x15')][_0x25f1('0x17')]);return _0x1c467a(_0x5be568[_0x25f1('0x15')]['message']);}else{logger[_0x25f1('0x10')]('SmsQueue,\x20%s,\x20%s',_0x322a94,'request\x20sent');_0x1c467a(_0x5be568[_0x25f1('0x18')][_0x25f1('0x17')]);}})['catch'](function(_0x1aaa83){logger[_0x25f1('0x15')](_0x25f1('0x11'),_0x322a94,_0x1aaa83);_0x2646e3(_0x1aaa83);});});}exports[_0x25f1('0x19')]=function(_0x5e325a){var _0x122aa4=this;return new Promise(function(_0x143314,_0x1936ea){return db['SmsQueue'][_0x25f1('0x1a')]({'raw':_0x5e325a[_0x25f1('0x1b')]?_0x5e325a[_0x25f1('0x1b')][_0x25f1('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e325a[_0x25f1('0x1b')]?_0x5e325a[_0x25f1('0x1b')][_0x25f1('0x1d')]||null:null,'attributes':_0x5e325a['options']?_0x5e325a['options'][_0x25f1('0x1e')]||null:null,'limit':_0x5e325a[_0x25f1('0x1b')]?_0x5e325a[_0x25f1('0x1b')][_0x25f1('0x1f')]||null:null,'include':_0x5e325a[_0x25f1('0x1b')]?_0x5e325a[_0x25f1('0x1b')][_0x25f1('0x20')]?_[_0x25f1('0x21')](_0x5e325a[_0x25f1('0x1b')][_0x25f1('0x20')],function(_0x14d3e0){return{'model':db[_0x14d3e0[_0x25f1('0x22')]],'as':_0x14d3e0['as'],'attributes':_0x14d3e0[_0x25f1('0x1e')],'include':_0x14d3e0[_0x25f1('0x20')]?_['map'](_0x14d3e0['include'],function(_0x3a24fb){return{'model':db[_0x3a24fb[_0x25f1('0x22')]],'as':_0x3a24fb['as'],'attributes':_0x3a24fb[_0x25f1('0x1e')],'include':_0x3a24fb[_0x25f1('0x20')]?_[_0x25f1('0x21')](_0x3a24fb[_0x25f1('0x20')],function(_0x4898da){return{'model':db[_0x4898da['model']],'as':_0x4898da['as'],'attributes':_0x4898da[_0x25f1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x25f1('0x23')](function(_0x2ae9e4){logger['info']('GetSmsQueue',_0x5e325a);logger[_0x25f1('0x24')](_0x25f1('0x19'),_0x5e325a,JSON['stringify'](_0x2ae9e4));_0x143314(_0x2ae9e4);})[_0x25f1('0x25')](function(_0x2c0ef2){logger[_0x25f1('0x15')](_0x25f1('0x19'),_0x2c0ef2['message'],_0x5e325a);_0x1936ea(_0x122aa4[_0x25f1('0x15')](0x1f4,_0x2c0ef2['message']));});});};exports[_0x25f1('0x26')]=function(_0x31b2f2){var _0x33a9f0=this;return new Promise(function(_0x77a31b,_0x2f56e3){return db[_0x25f1('0x27')]['find']({'raw':_0x31b2f2['options']?_0x31b2f2[_0x25f1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x31b2f2[_0x25f1('0x1b')]?_0x31b2f2['options'][_0x25f1('0x1d')]||null:null,'attributes':_0x31b2f2['options']?_0x31b2f2[_0x25f1('0x1b')][_0x25f1('0x1e')]||null:null,'include':_0x31b2f2[_0x25f1('0x1b')]?_0x31b2f2[_0x25f1('0x1b')][_0x25f1('0x20')]?_[_0x25f1('0x21')](_0x31b2f2['options'][_0x25f1('0x20')],function(_0x2bdbb3){return{'model':db[_0x2bdbb3['model']],'as':_0x2bdbb3['as'],'attributes':_0x2bdbb3[_0x25f1('0x1e')],'include':_0x2bdbb3['include']?_[_0x25f1('0x21')](_0x2bdbb3['include'],function(_0x159bcd){return{'model':db[_0x159bcd[_0x25f1('0x22')]],'as':_0x159bcd['as'],'attributes':_0x159bcd[_0x25f1('0x1e')],'include':_0x159bcd['include']?_[_0x25f1('0x21')](_0x159bcd[_0x25f1('0x20')],function(_0x416f05){return{'model':db[_0x416f05[_0x25f1('0x22')]],'as':_0x416f05['as'],'attributes':_0x416f05['attributes']};}):[]};}):[]};}):[]:[]})[_0x25f1('0x23')](function(_0x51641d){logger['info'](_0x25f1('0x26'),_0x31b2f2);logger['debug'](_0x25f1('0x26'),_0x31b2f2,JSON[_0x25f1('0x14')](_0x51641d));_0x77a31b(_0x51641d);})[_0x25f1('0x25')](function(_0x1ec986){logger[_0x25f1('0x15')](_0x25f1('0x26'),_0x1ec986['message'],_0x31b2f2);_0x2f56e3(_0x33a9f0[_0x25f1('0x15')](0x1f4,_0x1ec986[_0x25f1('0x17')]));});});}; \ No newline at end of file +var _0x8338=['client','http','redis','defaults','localhost','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetSmsQueue','options','raw','where','limit','include','map','attributes','model','ShowSmsQueue','SmsQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x49adfe,_0x2fd329){var _0x1d53da=function(_0x4edbdb){while(--_0x4edbdb){_0x49adfe['push'](_0x49adfe['shift']());}};_0x1d53da(++_0x2fd329);}(_0x8338,0xe6));var _0x8833=function(_0x5edd8c,_0x301bc6){_0x5edd8c=_0x5edd8c-0x0;var _0x82b9bd=_0x8338[_0x5edd8c];return _0x82b9bd;};'use strict';var _=require(_0x8833('0x0'));var util=require(_0x8833('0x1'));var moment=require(_0x8833('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8833('0x3'));var db=require(_0x8833('0x4'))['db'];var utils=require(_0x8833('0x5'));var logger=require(_0x8833('0x6'))(_0x8833('0x7'));var config=require(_0x8833('0x8'));var jayson=require(_0x8833('0x9'));var client=jayson[_0x8833('0xa')][_0x8833('0xb')]({'port':0x232a});config[_0x8833('0xc')]=_[_0x8833('0xd')](config[_0x8833('0xc')],{'host':_0x8833('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8833('0xc')]));require(_0x8833('0xf'))['register'](socket);function respondWithRpcPromise(_0x1eee52,_0x55e3e2,_0x7c8953){return new BPromise(function(_0x11c8a1,_0x2a604d){return client[_0x8833('0x10')](_0x1eee52,_0x7c8953)[_0x8833('0x11')](function(_0x19a710){logger[_0x8833('0x12')](_0x8833('0x13'),_0x55e3e2,'request\x20sent');logger[_0x8833('0x14')](_0x8833('0x15'),_0x55e3e2,_0x8833('0x16'),JSON[_0x8833('0x17')](_0x19a710));if(_0x19a710['error']){if(_0x19a710['error'][_0x8833('0x18')]===0x1f4){logger[_0x8833('0x19')]('SmsQueue,\x20%s,\x20%s',_0x55e3e2,_0x19a710['error'][_0x8833('0x1a')]);return _0x2a604d(_0x19a710[_0x8833('0x19')]['message']);}logger[_0x8833('0x19')](_0x8833('0x13'),_0x55e3e2,_0x19a710['error'][_0x8833('0x1a')]);return _0x11c8a1(_0x19a710['error'][_0x8833('0x1a')]);}else{logger[_0x8833('0x12')](_0x8833('0x13'),_0x55e3e2,'request\x20sent');_0x11c8a1(_0x19a710[_0x8833('0x1b')][_0x8833('0x1a')]);}})[_0x8833('0x1c')](function(_0x3004f8){logger[_0x8833('0x19')](_0x8833('0x13'),_0x55e3e2,_0x3004f8);_0x2a604d(_0x3004f8);});});}exports[_0x8833('0x1d')]=function(_0x177b0c){var _0x22a687=this;return new Promise(function(_0x4dcfb0,_0x423b4c){return db['SmsQueue']['findAll']({'raw':_0x177b0c['options']?_0x177b0c[_0x8833('0x1e')][_0x8833('0x1f')]===undefined?!![]:![]:!![],'where':_0x177b0c['options']?_0x177b0c['options'][_0x8833('0x20')]||null:null,'attributes':_0x177b0c[_0x8833('0x1e')]?_0x177b0c[_0x8833('0x1e')]['attributes']||null:null,'limit':_0x177b0c[_0x8833('0x1e')]?_0x177b0c[_0x8833('0x1e')][_0x8833('0x21')]||null:null,'include':_0x177b0c[_0x8833('0x1e')]?_0x177b0c[_0x8833('0x1e')][_0x8833('0x22')]?_[_0x8833('0x23')](_0x177b0c[_0x8833('0x1e')][_0x8833('0x22')],function(_0x570cf1){return{'model':db[_0x570cf1['model']],'as':_0x570cf1['as'],'attributes':_0x570cf1[_0x8833('0x24')],'include':_0x570cf1[_0x8833('0x22')]?_[_0x8833('0x23')](_0x570cf1['include'],function(_0x2b4b31){return{'model':db[_0x2b4b31[_0x8833('0x25')]],'as':_0x2b4b31['as'],'attributes':_0x2b4b31['attributes'],'include':_0x2b4b31[_0x8833('0x22')]?_['map'](_0x2b4b31[_0x8833('0x22')],function(_0x2ca1dd){return{'model':db[_0x2ca1dd[_0x8833('0x25')]],'as':_0x2ca1dd['as'],'attributes':_0x2ca1dd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x392503){logger[_0x8833('0x12')]('GetSmsQueue',_0x177b0c);logger['debug'](_0x8833('0x1d'),_0x177b0c,JSON[_0x8833('0x17')](_0x392503));_0x4dcfb0(_0x392503);})[_0x8833('0x1c')](function(_0x165488){logger[_0x8833('0x19')](_0x8833('0x1d'),_0x165488[_0x8833('0x1a')],_0x177b0c);_0x423b4c(_0x22a687[_0x8833('0x19')](0x1f4,_0x165488[_0x8833('0x1a')]));});});};exports[_0x8833('0x26')]=function(_0x237b88){var _0x3d1f9b=this;return new Promise(function(_0x385dd7,_0x5dcbe1){return db[_0x8833('0x27')]['find']({'raw':_0x237b88[_0x8833('0x1e')]?_0x237b88[_0x8833('0x1e')][_0x8833('0x1f')]===undefined?!![]:![]:!![],'where':_0x237b88['options']?_0x237b88[_0x8833('0x1e')][_0x8833('0x20')]||null:null,'attributes':_0x237b88[_0x8833('0x1e')]?_0x237b88[_0x8833('0x1e')][_0x8833('0x24')]||null:null,'include':_0x237b88[_0x8833('0x1e')]?_0x237b88[_0x8833('0x1e')][_0x8833('0x22')]?_['map'](_0x237b88[_0x8833('0x1e')]['include'],function(_0x5abab6){return{'model':db[_0x5abab6[_0x8833('0x25')]],'as':_0x5abab6['as'],'attributes':_0x5abab6['attributes'],'include':_0x5abab6[_0x8833('0x22')]?_[_0x8833('0x23')](_0x5abab6[_0x8833('0x22')],function(_0x5e91fe){return{'model':db[_0x5e91fe[_0x8833('0x25')]],'as':_0x5e91fe['as'],'attributes':_0x5e91fe['attributes'],'include':_0x5e91fe[_0x8833('0x22')]?_['map'](_0x5e91fe[_0x8833('0x22')],function(_0x202f9b){return{'model':db[_0x202f9b[_0x8833('0x25')]],'as':_0x202f9b['as'],'attributes':_0x202f9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8833('0x11')](function(_0x4d4c0e){logger[_0x8833('0x12')](_0x8833('0x26'),_0x237b88);logger['debug']('ShowSmsQueue',_0x237b88,JSON[_0x8833('0x17')](_0x4d4c0e));_0x385dd7(_0x4d4c0e);})[_0x8833('0x1c')](function(_0x31280f){logger['error'](_0x8833('0x26'),_0x31280f[_0x8833('0x1a')],_0x237b88);_0x5dcbe1(_0x3d1f9b[_0x8833('0x19')](0x1f4,_0x31280f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9be78a7..1012053 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 _0x0211=['remove','update','emit','removeListener','length','smsQueue:','./smsQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0211,0x13e));var _0x1021=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0211[_0x2f5ac5];return _0x37c9a8;};'use strict';var SmsQueueEvents=require(_0x1021('0x0'));var events=[_0x1021('0x1'),_0x1021('0x2'),_0x1021('0x3')];function createListener(_0x375e53,_0x4d5fb3){return function(_0x5abb09){_0x4d5fb3[_0x1021('0x4')](_0x375e53,_0x5abb09);};}function removeListener(_0x1f9c14,_0x184fb2){return function(){SmsQueueEvents[_0x1021('0x5')](_0x1f9c14,_0x184fb2);};}exports['register']=function(_0xbe2794){for(var _0x1f91d0=0x0,_0x1ad9d9=events[_0x1021('0x6')];_0x1f91d0<_0x1ad9d9;_0x1f91d0++){var _0xa966c9=events[_0x1f91d0];var _0x829ffe=createListener(_0x1021('0x7')+_0xa966c9,_0xbe2794);SmsQueueEvents['on'](_0xa966c9,_0x829ffe);}}; \ No newline at end of file +var _0x82d1=['remove','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x82d1,0x156));var _0x182d=function(_0x95fa9d,_0x1e3ed6){_0x95fa9d=_0x95fa9d-0x0;var _0x3140a2=_0x82d1[_0x95fa9d];return _0x3140a2;};'use strict';var SmsQueueEvents=require(_0x182d('0x0'));var events=['save',_0x182d('0x1'),'update'];function createListener(_0x41a12e,_0x362853){return function(_0x3b94ad){_0x362853[_0x182d('0x2')](_0x41a12e,_0x3b94ad);};}function removeListener(_0xe85d00,_0x48f004){return function(){SmsQueueEvents[_0x182d('0x3')](_0xe85d00,_0x48f004);};}exports[_0x182d('0x4')]=function(_0x38e13a){for(var _0x6fbe28=0x0,_0x59b4fa=events[_0x182d('0x5')];_0x6fbe28<_0x59b4fa;_0x6fbe28++){var _0x5a15a5=events[_0x6fbe28];var _0x201a07=createListener(_0x182d('0x6')+_0x5a15a5,_0x38e13a);SmsQueueEvents['on'](_0x5a15a5,_0x201a07);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d29d494..5eeb2b3 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 _0x7dbc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','index','get','describe','isAuthenticated','show','post','create','put','/:id','update','multer','util'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x7dbc,0xe2));var _0xc7db=function(_0x137f31,_0x1674ea){_0x137f31=_0x137f31-0x0;var _0x580d91=_0x7dbc[_0x137f31];return _0x580d91;};'use strict';var multer=require(_0xc7db('0x0'));var util=require(_0xc7db('0x1'));var path=require('path');var timeout=require(_0xc7db('0x2'));var express=require(_0xc7db('0x3'));var router=express[_0xc7db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7db('0x5'));var interaction=require(_0xc7db('0x6'));var config=require(_0xc7db('0x7'));var controller=require(_0xc7db('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc7db('0x9')]);router[_0xc7db('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xc7db('0xb')]);router[_0xc7db('0xa')]('/:id',auth[_0xc7db('0xc')](),controller[_0xc7db('0xd')]);router[_0xc7db('0xe')]('/',auth[_0xc7db('0xc')](),controller[_0xc7db('0xf')]);router[_0xc7db('0x10')](_0xc7db('0x11'),auth['isAuthenticated'](),controller[_0xc7db('0x12')]);router['delete'](_0xc7db('0x11'),auth[_0xc7db('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x91a6=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete'];(function(_0x382ebc,_0x4268db){var _0x5e1626=function(_0x29acd2){while(--_0x29acd2){_0x382ebc['push'](_0x382ebc['shift']());}};_0x5e1626(++_0x4268db);}(_0x91a6,0x12d));var _0x691a=function(_0x2edd7c,_0x4d7c30){_0x2edd7c=_0x2edd7c-0x0;var _0x400574=_0x91a6[_0x2edd7c];return _0x400574;};'use strict';var multer=require(_0x691a('0x0'));var util=require(_0x691a('0x1'));var path=require(_0x691a('0x2'));var timeout=require(_0x691a('0x3'));var express=require('express');var router=express[_0x691a('0x4')]();var fs_extra=require(_0x691a('0x5'));var auth=require(_0x691a('0x6'));var interaction=require(_0x691a('0x7'));var config=require(_0x691a('0x8'));var controller=require('./smsQueueReport.controller');router[_0x691a('0x9')]('/',auth[_0x691a('0xa')](),controller[_0x691a('0xb')]);router[_0x691a('0x9')](_0x691a('0xc'),auth[_0x691a('0xa')](),controller[_0x691a('0xd')]);router['get'](_0x691a('0xe'),auth[_0x691a('0xa')](),controller['show']);router[_0x691a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x691a('0x10')](_0x691a('0xe'),auth[_0x691a('0xa')](),controller[_0x691a('0x11')]);router[_0x691a('0x12')](_0x691a('0xe'),auth[_0x691a('0xa')](),controller['destroy']);module[_0x691a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b448efe..ca385e9 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 _0xa43a=['STRING','DATE','moment','sequelize','exports'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0xa43a,0xe3));var _0xaa43=function(_0x2e4cfb,_0x2bee56){_0x2e4cfb=_0x2e4cfb-0x0;var _0x5c7206=_0xa43a[_0x2e4cfb];return _0x5c7206;};'use strict';var moment=require(_0xaa43('0x0'));var Sequelize=require(_0xaa43('0x1'));module[_0xaa43('0x2')]={'uniqueid':{'type':Sequelize[_0xaa43('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xaa43('0x3')]},'joinAt':{'type':Sequelize[_0xaa43('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xaa43('0x4')]},'exitAt':{'type':Sequelize[_0xaa43('0x4')]},'reason':{'type':Sequelize[_0xaa43('0x3')]}}; \ No newline at end of file +var _0xbe22=['DATE','moment','sequelize','STRING'];(function(_0x1dd6e7,_0x1cda2b){var _0xb53aa4=function(_0xd2ac7b){while(--_0xd2ac7b){_0x1dd6e7['push'](_0x1dd6e7['shift']());}};_0xb53aa4(++_0x1cda2b);}(_0xbe22,0x1c1));var _0x2be2=function(_0x44d5ba,_0x36fa03){_0x44d5ba=_0x44d5ba-0x0;var _0x15a46c=_0xbe22[_0x44d5ba];return _0x15a46c;};'use strict';var moment=require(_0x2be2('0x0'));var Sequelize=require(_0x2be2('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2be2('0x2')]},'joinAt':{'type':Sequelize[_0x2be2('0x3')]},'leaveAt':{'type':Sequelize[_0x2be2('0x3')]},'acceptAt':{'type':Sequelize[_0x2be2('0x3')]},'exitAt':{'type':Sequelize[_0x2be2('0x3')]},'reason':{'type':Sequelize[_0x2be2('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b5c5c8b..f0632a0 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 _0x5ad9=['keys','intersection','find','create','body','destroy','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','map','SmsQueueReport','rawAttributes','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x1ef7bf,_0x51c42a){var _0x5d8d52=function(_0x435210){while(--_0x435210){_0x1ef7bf['push'](_0x1ef7bf['shift']());}};_0x5d8d52(++_0x51c42a);}(_0x5ad9,0x9c));var _0x95ad=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5ad9[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ad('0x1'));var rp=require(_0x95ad('0x2'));var moment=require(_0x95ad('0x3'));var BPromise=require(_0x95ad('0x4'));var Mustache=require('mustache');var util=require(_0x95ad('0x5'));var path=require(_0x95ad('0x6'));var sox=require('sox');var csv=require(_0x95ad('0x7'));var ejs=require(_0x95ad('0x8'));var fs=require('fs');var fs_extra=require(_0x95ad('0x9'));var _=require(_0x95ad('0xa'));var squel=require('squel');var crypto=require(_0x95ad('0xb'));var jsforce=require(_0x95ad('0xc'));var deskjs=require(_0x95ad('0xd'));var toCsv=require(_0x95ad('0x7'));var querystring=require(_0x95ad('0xe'));var Papa=require(_0x95ad('0xf'));var Redis=require(_0x95ad('0x10'));var authService=require(_0x95ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x95ad('0x12'));var hardwareService=require(_0x95ad('0x13'));var logger=require('../../config/logger')(_0x95ad('0x14'));var utils=require(_0x95ad('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e900b,_0x22c00b){_0x22c00b=_0x22c00b||0xcc;return function(_0x308509){if(_0x308509){return _0x4e900b[_0x95ad('0x16')](_0x22c00b);}return _0x4e900b['status'](_0x22c00b)[_0x95ad('0x17')]();};}function respondWithResult(_0x5c8d60,_0x37be67){_0x37be67=_0x37be67||0xc8;return function(_0x2fdc8d){if(_0x2fdc8d){return _0x5c8d60[_0x95ad('0x18')](_0x37be67)[_0x95ad('0x19')](_0x2fdc8d);}};}function respondWithFilteredResult(_0x14c550,_0x12e722){return function(_0x31f43a){if(_0x31f43a){var _0x6b4184=typeof _0x12e722[_0x95ad('0x1a')]===_0x95ad('0x1b')&&typeof _0x12e722[_0x95ad('0x1c')]===_0x95ad('0x1b');var _0x22f508=_0x31f43a[_0x95ad('0x1d')];var _0x3071ed=_0x6b4184?0x0:_0x12e722['offset'];var _0x421b78=_0x6b4184?_0x31f43a['count']:_0x12e722[_0x95ad('0x1a')]+_0x12e722[_0x95ad('0x1c')];var _0x1b16c4;if(_0x421b78>=_0x22f508){_0x421b78=_0x22f508;_0x1b16c4=0xc8;}else{_0x1b16c4=0xce;}_0x14c550[_0x95ad('0x18')](_0x1b16c4);return _0x14c550[_0x95ad('0x1e')](_0x95ad('0x1f'),_0x3071ed+'-'+_0x421b78+'/'+_0x22f508)[_0x95ad('0x19')](_0x31f43a);}return null;};}function patchUpdates(_0x2b5846){return function(_0x35dd4c){try{jsonpatch[_0x95ad('0x20')](_0x35dd4c,_0x2b5846,!![]);}catch(_0x2ba478){return BPromise[_0x95ad('0x21')](_0x2ba478);}return _0x35dd4c[_0x95ad('0x22')]();};}function saveUpdates(_0x1f37b6,_0x1c3d7e){return function(_0x3ce8e2){if(_0x3ce8e2){return _0x3ce8e2[_0x95ad('0x23')](_0x1f37b6)[_0x95ad('0x24')](function(_0x5df958){return _0x5df958;});}return null;};}function removeEntity(_0x40a859,_0x5644de){return function(_0xa9946e){if(_0xa9946e){return _0xa9946e['destroy']()['then'](function(){_0x40a859[_0x95ad('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab50d,_0x531fbd){return function(_0x571ab5){if(!_0x571ab5){_0x5ab50d[_0x95ad('0x16')](0x194);}return _0x571ab5;};}function handleError(_0x2d7f91,_0x1d6991){_0x1d6991=_0x1d6991||0x1f4;return function(_0x2aaf12){logger['error'](_0x2aaf12['stack']);if(_0x2aaf12[_0x95ad('0x25')]){delete _0x2aaf12[_0x95ad('0x25')];}_0x2d7f91[_0x95ad('0x18')](_0x1d6991)[_0x95ad('0x26')](_0x2aaf12);};}exports[_0x95ad('0x27')]=function(_0x13e18d,_0x1f5608){var _0x4affa9={},_0x1ec6f6={},_0x1c7daa={'count':0x0,'rows':[]};var _0x5a2b3e=_[_0x95ad('0x28')](db[_0x95ad('0x29')][_0x95ad('0x2a')],function(_0x664c10){return{'name':_0x664c10['fieldName'],'type':_0x664c10['type']['key']};});_0x1ec6f6[_0x95ad('0x2b')]=_['map'](_0x5a2b3e,_0x95ad('0x25'));_0x1ec6f6[_0x95ad('0x2c')]=_['keys'](_0x13e18d[_0x95ad('0x2c')]);_0x1ec6f6[_0x95ad('0x2d')]=_['intersection'](_0x1ec6f6[_0x95ad('0x2b')],_0x1ec6f6['query']);_0x4affa9[_0x95ad('0x2e')]=_['intersection'](_0x1ec6f6[_0x95ad('0x2b')],qs[_0x95ad('0x2f')](_0x13e18d[_0x95ad('0x2c')][_0x95ad('0x2f')]));_0x4affa9[_0x95ad('0x2e')]=_0x4affa9[_0x95ad('0x2e')][_0x95ad('0x30')]?_0x4affa9['attributes']:_0x1ec6f6[_0x95ad('0x2b')];if(!_0x13e18d[_0x95ad('0x2c')][_0x95ad('0x31')](_0x95ad('0x32'))){_0x4affa9[_0x95ad('0x1c')]=qs[_0x95ad('0x1c')](_0x13e18d['query'][_0x95ad('0x1c')]);_0x4affa9['offset']=qs[_0x95ad('0x1a')](_0x13e18d[_0x95ad('0x2c')]['offset']);}_0x4affa9[_0x95ad('0x33')]=qs['sort'](_0x13e18d['query'][_0x95ad('0x34')]);_0x4affa9[_0x95ad('0x35')]=qs[_0x95ad('0x2d')](_[_0x95ad('0x36')](_0x13e18d['query'],_0x1ec6f6[_0x95ad('0x2d')]),_0x5a2b3e);if(_0x13e18d[_0x95ad('0x2c')][_0x95ad('0x37')]){_0x4affa9[_0x95ad('0x35')]=_[_0x95ad('0x38')](_0x4affa9[_0x95ad('0x35')],{'$or':_[_0x95ad('0x28')](_0x5a2b3e,function(_0x3be7e7){if(_0x3be7e7[_0x95ad('0x39')]!==_0x95ad('0x3a')){var _0x1b0124={};_0x1b0124[_0x3be7e7[_0x95ad('0x25')]]={'$like':'%'+_0x13e18d[_0x95ad('0x2c')][_0x95ad('0x37')]+'%'};return _0x1b0124;}})});}_0x4affa9=_[_0x95ad('0x38')]({},_0x4affa9,_0x13e18d[_0x95ad('0x3b')]);var _0x5a4d9c={'where':_0x4affa9['where']};return db[_0x95ad('0x29')][_0x95ad('0x1d')](_0x5a4d9c)[_0x95ad('0x24')](function(_0x42e08c){_0x1c7daa[_0x95ad('0x1d')]=_0x42e08c;if(_0x13e18d['query'][_0x95ad('0x3c')]){_0x4affa9[_0x95ad('0x3d')]=[{'all':!![]}];}return db[_0x95ad('0x29')][_0x95ad('0x3e')](_0x4affa9);})['then'](function(_0x5d1b76){_0x1c7daa[_0x95ad('0x3f')]=_0x5d1b76;return _0x1c7daa;})[_0x95ad('0x24')](respondWithFilteredResult(_0x1f5608,_0x4affa9))[_0x95ad('0x40')](handleError(_0x1f5608,null));};exports[_0x95ad('0x41')]=function(_0x117b6e,_0x1cb672){var _0x16a36b={'raw':!![],'where':{'id':_0x117b6e['params']['id']}},_0x9c1827={};_0x9c1827['model']=_[_0x95ad('0x42')](db[_0x95ad('0x29')][_0x95ad('0x2a')]);_0x9c1827[_0x95ad('0x2c')]=_['keys'](_0x117b6e[_0x95ad('0x2c')]);_0x9c1827['filters']=_[_0x95ad('0x43')](_0x9c1827[_0x95ad('0x2b')],_0x9c1827[_0x95ad('0x2c')]);_0x16a36b[_0x95ad('0x2e')]=_['intersection'](_0x9c1827[_0x95ad('0x2b')],qs[_0x95ad('0x2f')](_0x117b6e[_0x95ad('0x2c')]['fields']));_0x16a36b[_0x95ad('0x2e')]=_0x16a36b['attributes'][_0x95ad('0x30')]?_0x16a36b[_0x95ad('0x2e')]:_0x9c1827[_0x95ad('0x2b')];if(_0x117b6e[_0x95ad('0x2c')][_0x95ad('0x3c')]){_0x16a36b[_0x95ad('0x3d')]=[{'all':!![]}];}_0x16a36b=_['merge']({},_0x16a36b,_0x117b6e[_0x95ad('0x3b')]);return db[_0x95ad('0x29')][_0x95ad('0x44')](_0x16a36b)[_0x95ad('0x24')](handleEntityNotFound(_0x1cb672,null))['then'](respondWithResult(_0x1cb672,null))[_0x95ad('0x40')](handleError(_0x1cb672,null));};exports['create']=function(_0x7b86fe,_0xaab926){return db[_0x95ad('0x29')][_0x95ad('0x45')](_0x7b86fe[_0x95ad('0x46')],{})[_0x95ad('0x24')](respondWithResult(_0xaab926,0xc9))[_0x95ad('0x40')](handleError(_0xaab926,null));};exports[_0x95ad('0x23')]=function(_0x38ecef,_0x8a76d2){if(_0x38ecef[_0x95ad('0x46')]['id']){delete _0x38ecef[_0x95ad('0x46')]['id'];}return db['SmsQueueReport'][_0x95ad('0x44')]({'where':{'id':_0x38ecef['params']['id']}})[_0x95ad('0x24')](handleEntityNotFound(_0x8a76d2,null))[_0x95ad('0x24')](saveUpdates(_0x38ecef[_0x95ad('0x46')],null))[_0x95ad('0x24')](respondWithResult(_0x8a76d2,null))['catch'](handleError(_0x8a76d2,null));};exports[_0x95ad('0x47')]=function(_0x325149,_0x6b2402){return db[_0x95ad('0x29')][_0x95ad('0x44')]({'where':{'id':_0x325149[_0x95ad('0x48')]['id']}})[_0x95ad('0x24')](handleEntityNotFound(_0x6b2402,null))[_0x95ad('0x24')](removeEntity(_0x6b2402,null))[_0x95ad('0x40')](handleError(_0x6b2402,null));};exports[_0x95ad('0x49')]=function(_0x44d332,_0x342fea){return db[_0x95ad('0x29')][_0x95ad('0x49')]()[_0x95ad('0x24')](respondWithResult(_0x342fea,null))[_0x95ad('0x40')](handleError(_0x342fea,null));}; \ No newline at end of file +var _0x7b36=['type','VIRTUAL','options','then','includeAll','include','SmsQueueReport','findAll','rows','catch','show','params','intersection','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x7b36,0xa7));var _0x67b3=function(_0x4311ae,_0x5c29b2){_0x4311ae=_0x4311ae-0x0;var _0x19380b=_0x7b36[_0x4311ae];return _0x19380b;};'use strict';var emlformat=require(_0x67b3('0x0'));var rimraf=require(_0x67b3('0x1'));var zipdir=require(_0x67b3('0x2'));var jsonpatch=require(_0x67b3('0x3'));var rp=require(_0x67b3('0x4'));var moment=require(_0x67b3('0x5'));var BPromise=require(_0x67b3('0x6'));var Mustache=require(_0x67b3('0x7'));var util=require('util');var path=require(_0x67b3('0x8'));var sox=require(_0x67b3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67b3('0xa'));var _=require('lodash');var squel=require(_0x67b3('0xb'));var crypto=require(_0x67b3('0xc'));var jsforce=require(_0x67b3('0xd'));var deskjs=require(_0x67b3('0xe'));var toCsv=require(_0x67b3('0xf'));var querystring=require(_0x67b3('0x10'));var Papa=require(_0x67b3('0x11'));var Redis=require(_0x67b3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x67b3('0x13'));var as=require(_0x67b3('0x14'));var hardwareService=require(_0x67b3('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x67b3('0x16'));var licenseUtil=require(_0x67b3('0x17'));var db=require(_0x67b3('0x18'))['db'];function respondWithStatusCode(_0xb0ffd4,_0x22ece9){_0x22ece9=_0x22ece9||0xcc;return function(_0x544f5d){if(_0x544f5d){return _0xb0ffd4['sendStatus'](_0x22ece9);}return _0xb0ffd4[_0x67b3('0x19')](_0x22ece9)[_0x67b3('0x1a')]();};}function respondWithResult(_0x573fa8,_0x489554){_0x489554=_0x489554||0xc8;return function(_0xafabda){if(_0xafabda){return _0x573fa8['status'](_0x489554)[_0x67b3('0x1b')](_0xafabda);}};}function respondWithFilteredResult(_0x277cb7,_0x578166){return function(_0x4138a3){if(_0x4138a3){var _0x475b99=typeof _0x578166[_0x67b3('0x1c')]==='undefined'&&typeof _0x578166['limit']===_0x67b3('0x1d');var _0x252539=_0x4138a3['count'];var _0xdb4376=_0x475b99?0x0:_0x578166[_0x67b3('0x1c')];var _0x493347=_0x475b99?_0x4138a3[_0x67b3('0x1e')]:_0x578166[_0x67b3('0x1c')]+_0x578166[_0x67b3('0x1f')];var _0x587caa;if(_0x493347>=_0x252539){_0x493347=_0x252539;_0x587caa=0xc8;}else{_0x587caa=0xce;}_0x277cb7['status'](_0x587caa);return _0x277cb7[_0x67b3('0x20')](_0x67b3('0x21'),_0xdb4376+'-'+_0x493347+'/'+_0x252539)['json'](_0x4138a3);}return null;};}function patchUpdates(_0x3baaa9){return function(_0x357fa1){try{jsonpatch['apply'](_0x357fa1,_0x3baaa9,!![]);}catch(_0xc173e9){return BPromise[_0x67b3('0x22')](_0xc173e9);}return _0x357fa1[_0x67b3('0x23')]();};}function saveUpdates(_0x1f029f,_0x44099b){return function(_0x32fc8e){if(_0x32fc8e){return _0x32fc8e['update'](_0x1f029f)['then'](function(_0x4c9a01){return _0x4c9a01;});}return null;};}function removeEntity(_0x553543,_0x34b7bd){return function(_0xf7de39){if(_0xf7de39){return _0xf7de39['destroy']()['then'](function(){_0x553543[_0x67b3('0x19')](0xcc)[_0x67b3('0x1a')]();});}};}function handleEntityNotFound(_0x5d2222,_0x3345a9){return function(_0x17605e){if(!_0x17605e){_0x5d2222[_0x67b3('0x24')](0x194);}return _0x17605e;};}function handleError(_0x443e2a,_0xeb3d7b){_0xeb3d7b=_0xeb3d7b||0x1f4;return function(_0x1cae32){logger['error'](_0x1cae32[_0x67b3('0x25')]);if(_0x1cae32[_0x67b3('0x26')]){delete _0x1cae32['name'];}_0x443e2a['status'](_0xeb3d7b)['send'](_0x1cae32);};}exports[_0x67b3('0x27')]=function(_0xe603e4,_0x2f93f8){var _0x194aa7={},_0x5c5cf4={},_0x2ece8c={'count':0x0,'rows':[]};var _0x232db8=_[_0x67b3('0x28')](db['SmsQueueReport'][_0x67b3('0x29')],function(_0x34a811){return{'name':_0x34a811[_0x67b3('0x2a')],'type':_0x34a811['type'][_0x67b3('0x2b')]};});_0x5c5cf4[_0x67b3('0x2c')]=_[_0x67b3('0x28')](_0x232db8,_0x67b3('0x26'));_0x5c5cf4[_0x67b3('0x2d')]=_[_0x67b3('0x2e')](_0xe603e4[_0x67b3('0x2d')]);_0x5c5cf4['filters']=_['intersection'](_0x5c5cf4[_0x67b3('0x2c')],_0x5c5cf4[_0x67b3('0x2d')]);_0x194aa7['attributes']=_['intersection'](_0x5c5cf4[_0x67b3('0x2c')],qs[_0x67b3('0x2f')](_0xe603e4[_0x67b3('0x2d')][_0x67b3('0x2f')]));_0x194aa7[_0x67b3('0x30')]=_0x194aa7[_0x67b3('0x30')][_0x67b3('0x31')]?_0x194aa7[_0x67b3('0x30')]:_0x5c5cf4[_0x67b3('0x2c')];if(!_0xe603e4[_0x67b3('0x2d')][_0x67b3('0x32')]('nolimit')){_0x194aa7[_0x67b3('0x1f')]=qs['limit'](_0xe603e4[_0x67b3('0x2d')]['limit']);_0x194aa7['offset']=qs[_0x67b3('0x1c')](_0xe603e4[_0x67b3('0x2d')][_0x67b3('0x1c')]);}_0x194aa7[_0x67b3('0x33')]=qs[_0x67b3('0x34')](_0xe603e4[_0x67b3('0x2d')][_0x67b3('0x34')]);_0x194aa7[_0x67b3('0x35')]=qs['filters'](_[_0x67b3('0x36')](_0xe603e4['query'],_0x5c5cf4[_0x67b3('0x37')]),_0x232db8);if(_0xe603e4[_0x67b3('0x2d')][_0x67b3('0x38')]){_0x194aa7[_0x67b3('0x35')]=_[_0x67b3('0x39')](_0x194aa7[_0x67b3('0x35')],{'$or':_[_0x67b3('0x28')](_0x232db8,function(_0x36ceb1){if(_0x36ceb1[_0x67b3('0x3a')]!==_0x67b3('0x3b')){var _0x42a68c={};_0x42a68c[_0x36ceb1[_0x67b3('0x26')]]={'$like':'%'+_0xe603e4[_0x67b3('0x2d')]['filter']+'%'};return _0x42a68c;}})});}_0x194aa7=_[_0x67b3('0x39')]({},_0x194aa7,_0xe603e4[_0x67b3('0x3c')]);var _0x626bf2={'where':_0x194aa7[_0x67b3('0x35')]};return db['SmsQueueReport']['count'](_0x626bf2)[_0x67b3('0x3d')](function(_0x27e79e){_0x2ece8c[_0x67b3('0x1e')]=_0x27e79e;if(_0xe603e4[_0x67b3('0x2d')][_0x67b3('0x3e')]){_0x194aa7[_0x67b3('0x3f')]=[{'all':!![]}];}return db[_0x67b3('0x40')][_0x67b3('0x41')](_0x194aa7);})[_0x67b3('0x3d')](function(_0x1e72c8){_0x2ece8c[_0x67b3('0x42')]=_0x1e72c8;return _0x2ece8c;})[_0x67b3('0x3d')](respondWithFilteredResult(_0x2f93f8,_0x194aa7))[_0x67b3('0x43')](handleError(_0x2f93f8,null));};exports[_0x67b3('0x44')]=function(_0x237e6e,_0x2a6b81){var _0x47ec16={'raw':!![],'where':{'id':_0x237e6e[_0x67b3('0x45')]['id']}},_0x5b5796={};_0x5b5796['model']=_[_0x67b3('0x2e')](db[_0x67b3('0x40')][_0x67b3('0x29')]);_0x5b5796[_0x67b3('0x2d')]=_['keys'](_0x237e6e[_0x67b3('0x2d')]);_0x5b5796['filters']=_['intersection'](_0x5b5796[_0x67b3('0x2c')],_0x5b5796[_0x67b3('0x2d')]);_0x47ec16[_0x67b3('0x30')]=_[_0x67b3('0x46')](_0x5b5796[_0x67b3('0x2c')],qs[_0x67b3('0x2f')](_0x237e6e[_0x67b3('0x2d')][_0x67b3('0x2f')]));_0x47ec16[_0x67b3('0x30')]=_0x47ec16[_0x67b3('0x30')]['length']?_0x47ec16[_0x67b3('0x30')]:_0x5b5796[_0x67b3('0x2c')];if(_0x237e6e[_0x67b3('0x2d')][_0x67b3('0x3e')]){_0x47ec16['include']=[{'all':!![]}];}_0x47ec16=_[_0x67b3('0x39')]({},_0x47ec16,_0x237e6e[_0x67b3('0x3c')]);return db[_0x67b3('0x40')]['find'](_0x47ec16)[_0x67b3('0x3d')](handleEntityNotFound(_0x2a6b81,null))['then'](respondWithResult(_0x2a6b81,null))['catch'](handleError(_0x2a6b81,null));};exports['create']=function(_0x11e6e1,_0x1a11fd){return db[_0x67b3('0x40')]['create'](_0x11e6e1[_0x67b3('0x47')],{})[_0x67b3('0x3d')](respondWithResult(_0x1a11fd,0xc9))['catch'](handleError(_0x1a11fd,null));};exports[_0x67b3('0x48')]=function(_0x1fec1e,_0x2da1cd){if(_0x1fec1e[_0x67b3('0x47')]['id']){delete _0x1fec1e[_0x67b3('0x47')]['id'];}return db[_0x67b3('0x40')][_0x67b3('0x49')]({'where':{'id':_0x1fec1e[_0x67b3('0x45')]['id']}})[_0x67b3('0x3d')](handleEntityNotFound(_0x2da1cd,null))[_0x67b3('0x3d')](saveUpdates(_0x1fec1e['body'],null))[_0x67b3('0x3d')](respondWithResult(_0x2da1cd,null))['catch'](handleError(_0x2da1cd,null));};exports['destroy']=function(_0x252597,_0xd2506b){return db['SmsQueueReport'][_0x67b3('0x49')]({'where':{'id':_0x252597[_0x67b3('0x45')]['id']}})[_0x67b3('0x3d')](handleEntityNotFound(_0xd2506b,null))['then'](removeEntity(_0xd2506b,null))[_0x67b3('0x43')](handleError(_0xd2506b,null));};exports[_0x67b3('0x4a')]=function(_0x143da8,_0x1869c4){return db[_0x67b3('0x40')][_0x67b3('0x4a')]()[_0x67b3('0x3d')](respondWithResult(_0x1869c4,null))[_0x67b3('0x43')](handleError(_0x1869c4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 68b1c1d..6fa49d9 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x483a3a,_0x582ca8){var _0x3c8648=function(_0x47826f){while(--_0x47826f){_0x483a3a['push'](_0x483a3a['shift']());}};_0x3c8648(++_0x582ca8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0xfaf455,_0x13c0a9){var _0x5aaa60=function(_0x55ce23){while(--_0x55ce23){_0xfaf455['push'](_0xfaf455['shift']());}};_0x5aaa60(++_0x13c0a9);}(_0xe706,0xa3));var _0x6e70=function(_0x44dcf0,_0x1402cd){_0x44dcf0=_0x44dcf0-0x0;var _0x206867=_0xe706[_0x44dcf0];return _0x206867;};'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 210d0bf..46063a6 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 _0x077c=['CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch'];(function(_0x2706f2,_0x9a058){var _0x595bab=function(_0x54371f){while(--_0x54371f){_0x2706f2['push'](_0x2706f2['shift']());}};_0x595bab(++_0x9a058);}(_0x077c,0x112));var _0xc077=function(_0x14bed4,_0x568f1a){_0x14bed4=_0x14bed4-0x0;var _0x29507f=_0x077c[_0x14bed4];return _0x29507f;};'use strict';var _=require(_0xc077('0x0'));var util=require(_0xc077('0x1'));var moment=require(_0xc077('0x2'));var BPromise=require(_0xc077('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc077('0x4'));var db=require(_0xc077('0x5'))['db'];var utils=require(_0xc077('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc077('0x7'));var jayson=require(_0xc077('0x8'));var client=jayson[_0xc077('0x9')][_0xc077('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3acfac,_0xec899c,_0x29ed98){return new BPromise(function(_0x161426,_0x580f9f){return client[_0xc077('0xb')](_0x3acfac,_0x29ed98)[_0xc077('0xc')](function(_0x7a82fd){logger[_0xc077('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0xec899c,_0xc077('0xe'));logger[_0xc077('0xf')](_0xc077('0x10'),_0xec899c,'request\x20sent',JSON[_0xc077('0x11')](_0x7a82fd));if(_0x7a82fd['error']){if(_0x7a82fd[_0xc077('0x12')][_0xc077('0x13')]===0x1f4){logger['error'](_0xc077('0x14'),_0xec899c,_0x7a82fd[_0xc077('0x12')][_0xc077('0x15')]);return _0x580f9f(_0x7a82fd[_0xc077('0x12')][_0xc077('0x15')]);}logger[_0xc077('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0xec899c,_0x7a82fd[_0xc077('0x12')][_0xc077('0x15')]);return _0x161426(_0x7a82fd[_0xc077('0x12')][_0xc077('0x15')]);}else{logger[_0xc077('0xd')](_0xc077('0x14'),_0xec899c,_0xc077('0xe'));_0x161426(_0x7a82fd['result'][_0xc077('0x15')]);}})[_0xc077('0x16')](function(_0x461b7d){logger['error'](_0xc077('0x14'),_0xec899c,_0x461b7d);_0x580f9f(_0x461b7d);});});}exports[_0xc077('0x17')]=function(_0x5f1556){var _0x4cd510=this;return new Promise(function(_0x50b130,_0x3f0d93){return db[_0xc077('0x18')][_0xc077('0x19')](_0x5f1556[_0xc077('0x1a')],{'raw':_0x5f1556[_0xc077('0x1b')]?_0x5f1556['options'][_0xc077('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x22b2ae){logger[_0xc077('0xd')](_0xc077('0x17'),_0x5f1556);logger[_0xc077('0xf')]('CreateSmsQueueReport',_0x5f1556,JSON[_0xc077('0x11')](_0x22b2ae));_0x50b130(_0x22b2ae);})[_0xc077('0x16')](function(_0x2f898d){logger['error'](_0xc077('0x17'),_0x2f898d['message'],_0x5f1556);_0x3f0d93(_0x4cd510[_0xc077('0x12')](0x1f4,_0x2f898d[_0xc077('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x4ad40a){var _0x4f8a3a=this;return new Promise(function(_0x5bb30a,_0x1d0387){return db[_0xc077('0x18')]['update'](_0x4ad40a[_0xc077('0x1a')],{'raw':_0x4ad40a['options']?_0x4ad40a[_0xc077('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad40a['options']?_0x4ad40a[_0xc077('0x1b')][_0xc077('0x1d')]||null:null,'attributes':_0x4ad40a[_0xc077('0x1b')]?_0x4ad40a[_0xc077('0x1b')][_0xc077('0x1e')]||null:null,'limit':_0x4ad40a['options']?_0x4ad40a['options'][_0xc077('0x1f')]||null:null})[_0xc077('0xc')](function(_0x5ed382){logger[_0xc077('0xd')](_0xc077('0x20'),_0x4ad40a);logger[_0xc077('0xf')](_0xc077('0x20'),_0x4ad40a,JSON[_0xc077('0x11')](_0x5ed382));_0x5bb30a(_0x5ed382);})[_0xc077('0x16')](function(_0x2c7715){logger['error'](_0xc077('0x20'),_0x2c7715[_0xc077('0x15')],_0x4ad40a);_0x1d0387(_0x4f8a3a[_0xc077('0x12')](0x1f4,_0x2c7715[_0xc077('0x15')]));});});}; \ No newline at end of file +var _0xf154=['create','options','raw','CreateSmsQueueReport','catch','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x192f6d,_0x3d8296){var _0x5b6f0f=function(_0x584ada){while(--_0x584ada){_0x192f6d['push'](_0x192f6d['shift']());}};_0x5b6f0f(++_0x3d8296);}(_0xf154,0x11b));var _0x4f15=function(_0x3505d5,_0x746a58){_0x3505d5=_0x3505d5-0x0;var _0x43ea3b=_0xf154[_0x3505d5];return _0x43ea3b;};'use strict';var _=require(_0x4f15('0x0'));var util=require(_0x4f15('0x1'));var moment=require(_0x4f15('0x2'));var BPromise=require(_0x4f15('0x3'));var rs=require(_0x4f15('0x4'));var fs=require('fs');var Redis=require(_0x4f15('0x5'));var db=require(_0x4f15('0x6'))['db'];var utils=require(_0x4f15('0x7'));var logger=require('../../config/logger')(_0x4f15('0x8'));var config=require(_0x4f15('0x9'));var jayson=require(_0x4f15('0xa'));var client=jayson['client'][_0x4f15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29e81a,_0x31c93d,_0x1a8a0e){return new BPromise(function(_0x3e9a5f,_0xf3858f){return client[_0x4f15('0xc')](_0x29e81a,_0x1a8a0e)[_0x4f15('0xd')](function(_0x4d3c07){logger[_0x4f15('0xe')](_0x4f15('0xf'),_0x31c93d,'request\x20sent');logger[_0x4f15('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x31c93d,_0x4f15('0x11'),JSON[_0x4f15('0x12')](_0x4d3c07));if(_0x4d3c07[_0x4f15('0x13')]){if(_0x4d3c07[_0x4f15('0x13')][_0x4f15('0x14')]===0x1f4){logger[_0x4f15('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x31c93d,_0x4d3c07[_0x4f15('0x13')][_0x4f15('0x15')]);return _0xf3858f(_0x4d3c07[_0x4f15('0x13')][_0x4f15('0x15')]);}logger[_0x4f15('0x13')](_0x4f15('0xf'),_0x31c93d,_0x4d3c07[_0x4f15('0x13')]['message']);return _0x3e9a5f(_0x4d3c07[_0x4f15('0x13')][_0x4f15('0x15')]);}else{logger[_0x4f15('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x31c93d,_0x4f15('0x11'));_0x3e9a5f(_0x4d3c07[_0x4f15('0x16')][_0x4f15('0x15')]);}})['catch'](function(_0x12d5b2){logger[_0x4f15('0x13')](_0x4f15('0xf'),_0x31c93d,_0x12d5b2);_0xf3858f(_0x12d5b2);});});}exports['CreateSmsQueueReport']=function(_0x11ae02){var _0xdf7809=this;return new Promise(function(_0x17941f,_0x688884){return db['SmsQueueReport'][_0x4f15('0x17')](_0x11ae02['body'],{'raw':_0x11ae02['options']?_0x11ae02[_0x4f15('0x18')][_0x4f15('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x30533a){logger['info']('CreateSmsQueueReport',_0x11ae02);logger[_0x4f15('0x10')](_0x4f15('0x1a'),_0x11ae02,JSON['stringify'](_0x30533a));_0x17941f(_0x30533a);})[_0x4f15('0x1b')](function(_0x4834c0){logger[_0x4f15('0x13')](_0x4f15('0x1a'),_0x4834c0[_0x4f15('0x15')],_0x11ae02);_0x688884(_0xdf7809['error'](0x1f4,_0x4834c0[_0x4f15('0x15')]));});});};exports[_0x4f15('0x1c')]=function(_0x2396ff){var _0x45b9be=this;return new Promise(function(_0x48c0e1,_0x2ee83b){return db['SmsQueueReport'][_0x4f15('0x1d')](_0x2396ff[_0x4f15('0x1e')],{'raw':_0x2396ff[_0x4f15('0x18')]?_0x2396ff[_0x4f15('0x18')][_0x4f15('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2396ff['options']?_0x2396ff[_0x4f15('0x18')][_0x4f15('0x1f')]||null:null,'attributes':_0x2396ff[_0x4f15('0x18')]?_0x2396ff['options'][_0x4f15('0x20')]||null:null,'limit':_0x2396ff[_0x4f15('0x18')]?_0x2396ff[_0x4f15('0x18')][_0x4f15('0x21')]||null:null})['then'](function(_0x1674c0){logger[_0x4f15('0xe')]('UpdateSmsQueueReport',_0x2396ff);logger[_0x4f15('0x10')](_0x4f15('0x1c'),_0x2396ff,JSON[_0x4f15('0x12')](_0x1674c0));_0x48c0e1(_0x1674c0);})['catch'](function(_0x46a9cf){logger[_0x4f15('0x13')](_0x4f15('0x1c'),_0x46a9cf[_0x4f15('0x15')],_0x2396ff);_0x2ee83b(_0x45b9be['error'](0x1f4,_0x46a9cf[_0x4f15('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2ed35bd..9da226f 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 _0x032e=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x1e1dea,_0x16fe92){var _0x360ed7=function(_0x3fd6d5){while(--_0x3fd6d5){_0x1e1dea['push'](_0x1e1dea['shift']());}};_0x360ed7(++_0x16fe92);}(_0x032e,0x124));var _0xe032=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x032e[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0x8')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0xc')]);router[_0xe032('0x8')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0xf')]('/',auth[_0xe032('0x9')](),controller['create']);router[_0xe032('0x10')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0x11')]);router[_0xe032('0x12')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller['destroy']);module[_0xe032('0x13')]=router; \ No newline at end of file +var _0x008c=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','show','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x008c,0x188));var _0xc008=function(_0x4cf88d,_0x5de590){_0x4cf88d=_0x4cf88d-0x0;var _0x1f49c0=_0x008c[_0x4cf88d];return _0x1f49c0;};'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('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['update']);router[_0xc008('0x10')](_0xc008('0xf'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);module[_0xc008('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 04f4f1f..b5ecf9c 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x100ac4,_0x895843){var _0x599750=function(_0x33594c){while(--_0x33594c){_0x100ac4['push'](_0x100ac4['shift']());}};_0x599750(++_0x895843);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xf3cd[_0x3f2a90];return _0xb46279;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x411dc3,_0x447538){var _0x3265f2=function(_0x3ecb17){while(--_0x3ecb17){_0x411dc3['push'](_0x411dc3['shift']());}};_0x3265f2(++_0x447538);}(_0x34e8,0x12c));var _0x834e=function(_0x512402,_0x6b04d9){_0x512402=_0x512402-0x0;var _0x1ca9e7=_0x34e8[_0x512402];return _0x1ca9e7;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e2d5663..55ca0bb 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 _0x2ebc=['length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','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','undefined','limit','count','Content-Range','apply','save','then','error','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x2ebc,0x189));var _0xc2eb=function(_0x25455f,_0x30c813){_0x25455f=_0x25455f-0x0;var _0x1db3a7=_0x2ebc[_0x25455f];return _0x1db3a7;};'use strict';var emlformat=require(_0xc2eb('0x0'));var rimraf=require(_0xc2eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2eb('0x2'));var rp=require(_0xc2eb('0x3'));var moment=require(_0xc2eb('0x4'));var BPromise=require(_0xc2eb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc2eb('0x6'));var sox=require(_0xc2eb('0x7'));var csv=require(_0xc2eb('0x8'));var ejs=require(_0xc2eb('0x9'));var fs=require('fs');var fs_extra=require(_0xc2eb('0xa'));var _=require('lodash');var squel=require(_0xc2eb('0xb'));var crypto=require(_0xc2eb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc2eb('0x8'));var querystring=require(_0xc2eb('0xd'));var Papa=require(_0xc2eb('0xe'));var Redis=require(_0xc2eb('0xf'));var authService=require(_0xc2eb('0x10'));var qs=require(_0xc2eb('0x11'));var as=require(_0xc2eb('0x12'));var hardwareService=require(_0xc2eb('0x13'));var logger=require(_0xc2eb('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc2eb('0x15'));var licenseUtil=require(_0xc2eb('0x16'));var db=require(_0xc2eb('0x17'))['db'];function respondWithStatusCode(_0x931f20,_0x299c5d){_0x299c5d=_0x299c5d||0xcc;return function(_0xc7edc6){if(_0xc7edc6){return _0x931f20[_0xc2eb('0x18')](_0x299c5d);}return _0x931f20[_0xc2eb('0x19')](_0x299c5d)[_0xc2eb('0x1a')]();};}function respondWithResult(_0x5a5801,_0x41c007){_0x41c007=_0x41c007||0xc8;return function(_0x28acc3){if(_0x28acc3){return _0x5a5801[_0xc2eb('0x19')](_0x41c007)[_0xc2eb('0x1b')](_0x28acc3);}};}function respondWithFilteredResult(_0x3e9b8e,_0x25536a){return function(_0x404952){if(_0x404952){var _0x108930=typeof _0x25536a[_0xc2eb('0x1c')]===_0xc2eb('0x1d')&&typeof _0x25536a[_0xc2eb('0x1e')]==='undefined';var _0x43e8bc=_0x404952[_0xc2eb('0x1f')];var _0x275227=_0x108930?0x0:_0x25536a[_0xc2eb('0x1c')];var _0x8e1c47=_0x108930?_0x404952[_0xc2eb('0x1f')]:_0x25536a[_0xc2eb('0x1c')]+_0x25536a[_0xc2eb('0x1e')];var _0x439f02;if(_0x8e1c47>=_0x43e8bc){_0x8e1c47=_0x43e8bc;_0x439f02=0xc8;}else{_0x439f02=0xce;}_0x3e9b8e['status'](_0x439f02);return _0x3e9b8e['set'](_0xc2eb('0x20'),_0x275227+'-'+_0x8e1c47+'/'+_0x43e8bc)[_0xc2eb('0x1b')](_0x404952);}return null;};}function patchUpdates(_0x2d926c){return function(_0x16c10c){try{jsonpatch[_0xc2eb('0x21')](_0x16c10c,_0x2d926c,!![]);}catch(_0x43ecdc){return BPromise['reject'](_0x43ecdc);}return _0x16c10c[_0xc2eb('0x22')]();};}function saveUpdates(_0x5b0994,_0x4ce9cc){return function(_0x19bd81){if(_0x19bd81){return _0x19bd81['update'](_0x5b0994)['then'](function(_0x5dc906){return _0x5dc906;});}return null;};}function removeEntity(_0x47b184,_0x3c580c){return function(_0x2d1284){if(_0x2d1284){return _0x2d1284['destroy']()[_0xc2eb('0x23')](function(){_0x47b184[_0xc2eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2897,_0x3c3a3d){return function(_0x397760){if(!_0x397760){_0x5c2897[_0xc2eb('0x18')](0x194);}return _0x397760;};}function handleError(_0x3c56de,_0x913226){_0x913226=_0x913226||0x1f4;return function(_0x35437c){logger[_0xc2eb('0x24')](_0x35437c['stack']);if(_0x35437c[_0xc2eb('0x25')]){delete _0x35437c['name'];}_0x3c56de['status'](_0x913226)[_0xc2eb('0x26')](_0x35437c);};}exports[_0xc2eb('0x27')]=function(_0x344ebd,_0x287869){var _0x4e435c={},_0x3d4490={},_0x212bf0={'count':0x0,'rows':[]};var _0x4b50fc=_['map'](db[_0xc2eb('0x28')][_0xc2eb('0x29')],function(_0x57a7b5){return{'name':_0x57a7b5[_0xc2eb('0x2a')],'type':_0x57a7b5[_0xc2eb('0x2b')][_0xc2eb('0x2c')]};});_0x3d4490[_0xc2eb('0x2d')]=_['map'](_0x4b50fc,'name');_0x3d4490[_0xc2eb('0x2e')]=_[_0xc2eb('0x2f')](_0x344ebd['query']);_0x3d4490[_0xc2eb('0x30')]=_['intersection'](_0x3d4490[_0xc2eb('0x2d')],_0x3d4490[_0xc2eb('0x2e')]);_0x4e435c[_0xc2eb('0x31')]=_['intersection'](_0x3d4490['model'],qs[_0xc2eb('0x32')](_0x344ebd[_0xc2eb('0x2e')][_0xc2eb('0x32')]));_0x4e435c['attributes']=_0x4e435c['attributes'][_0xc2eb('0x33')]?_0x4e435c[_0xc2eb('0x31')]:_0x3d4490['model'];if(!_0x344ebd[_0xc2eb('0x2e')][_0xc2eb('0x34')](_0xc2eb('0x35'))){_0x4e435c[_0xc2eb('0x1e')]=qs['limit'](_0x344ebd[_0xc2eb('0x2e')][_0xc2eb('0x1e')]);_0x4e435c[_0xc2eb('0x1c')]=qs[_0xc2eb('0x1c')](_0x344ebd[_0xc2eb('0x2e')]['offset']);}_0x4e435c[_0xc2eb('0x36')]=qs['sort'](_0x344ebd['query'][_0xc2eb('0x37')]);_0x4e435c[_0xc2eb('0x38')]=qs[_0xc2eb('0x30')](_['pick'](_0x344ebd[_0xc2eb('0x2e')],_0x3d4490['filters']),_0x4b50fc);if(_0x344ebd[_0xc2eb('0x2e')]['filter']){_0x4e435c[_0xc2eb('0x38')]=_[_0xc2eb('0x39')](_0x4e435c[_0xc2eb('0x38')],{'$or':_[_0xc2eb('0x3a')](_0x4b50fc,function(_0x590ada){if(_0x590ada[_0xc2eb('0x2b')]!==_0xc2eb('0x3b')){var _0x4b3372={};_0x4b3372[_0x590ada[_0xc2eb('0x25')]]={'$like':'%'+_0x344ebd[_0xc2eb('0x2e')][_0xc2eb('0x3c')]+'%'};return _0x4b3372;}})});}_0x4e435c=_['merge']({},_0x4e435c,_0x344ebd[_0xc2eb('0x3d')]);var _0xa52082={'where':_0x4e435c[_0xc2eb('0x38')]};return db[_0xc2eb('0x28')][_0xc2eb('0x1f')](_0xa52082)[_0xc2eb('0x23')](function(_0x4d99dc){_0x212bf0[_0xc2eb('0x1f')]=_0x4d99dc;if(_0x344ebd[_0xc2eb('0x2e')][_0xc2eb('0x3e')]){_0x4e435c[_0xc2eb('0x3f')]=[{'all':!![]}];}return db[_0xc2eb('0x28')][_0xc2eb('0x40')](_0x4e435c);})[_0xc2eb('0x23')](function(_0x461198){_0x212bf0['rows']=_0x461198;return _0x212bf0;})[_0xc2eb('0x23')](respondWithFilteredResult(_0x287869,_0x4e435c))[_0xc2eb('0x41')](handleError(_0x287869,null));};exports[_0xc2eb('0x42')]=function(_0x34bc00,_0x1bd4d8){var _0x3eaabd={'raw':!![],'where':{'id':_0x34bc00[_0xc2eb('0x43')]['id']}},_0x100277={};_0x100277['model']=_['keys'](db[_0xc2eb('0x28')][_0xc2eb('0x29')]);_0x100277[_0xc2eb('0x2e')]=_[_0xc2eb('0x2f')](_0x34bc00[_0xc2eb('0x2e')]);_0x100277[_0xc2eb('0x30')]=_[_0xc2eb('0x44')](_0x100277[_0xc2eb('0x2d')],_0x100277[_0xc2eb('0x2e')]);_0x3eaabd[_0xc2eb('0x31')]=_[_0xc2eb('0x44')](_0x100277[_0xc2eb('0x2d')],qs[_0xc2eb('0x32')](_0x34bc00[_0xc2eb('0x2e')][_0xc2eb('0x32')]));_0x3eaabd[_0xc2eb('0x31')]=_0x3eaabd['attributes'][_0xc2eb('0x33')]?_0x3eaabd[_0xc2eb('0x31')]:_0x100277['model'];if(_0x34bc00[_0xc2eb('0x2e')][_0xc2eb('0x3e')]){_0x3eaabd[_0xc2eb('0x3f')]=[{'all':!![]}];}_0x3eaabd=_[_0xc2eb('0x39')]({},_0x3eaabd,_0x34bc00['options']);return db[_0xc2eb('0x28')][_0xc2eb('0x45')](_0x3eaabd)[_0xc2eb('0x23')](handleEntityNotFound(_0x1bd4d8,null))[_0xc2eb('0x23')](respondWithResult(_0x1bd4d8,null))['catch'](handleError(_0x1bd4d8,null));};exports[_0xc2eb('0x46')]=function(_0x46f830,_0x7ca4bf){return db['SmsTransferReport'][_0xc2eb('0x46')](_0x46f830[_0xc2eb('0x47')],{})['then'](respondWithResult(_0x7ca4bf,0xc9))[_0xc2eb('0x41')](handleError(_0x7ca4bf,null));};exports[_0xc2eb('0x48')]=function(_0x2d0b59,_0x1f3728){if(_0x2d0b59['body']['id']){delete _0x2d0b59[_0xc2eb('0x47')]['id'];}return db[_0xc2eb('0x28')][_0xc2eb('0x45')]({'where':{'id':_0x2d0b59['params']['id']}})[_0xc2eb('0x23')](handleEntityNotFound(_0x1f3728,null))[_0xc2eb('0x23')](saveUpdates(_0x2d0b59[_0xc2eb('0x47')],null))[_0xc2eb('0x23')](respondWithResult(_0x1f3728,null))[_0xc2eb('0x41')](handleError(_0x1f3728,null));};exports[_0xc2eb('0x49')]=function(_0x34069c,_0x107941){return db[_0xc2eb('0x28')]['find']({'where':{'id':_0x34069c[_0xc2eb('0x43')]['id']}})[_0xc2eb('0x23')](handleEntityNotFound(_0x107941,null))['then'](removeEntity(_0x107941,null))[_0xc2eb('0x41')](handleError(_0x107941,null));};exports['describe']=function(_0x57cab3,_0x341fbf){return db[_0xc2eb('0x28')]['describe']()[_0xc2eb('0x23')](respondWithResult(_0x341fbf,null))['catch'](handleError(_0x341fbf,null));}; \ No newline at end of file +var _0x260d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','error','stack','name','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','body','destroy','describe','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x30f23a,_0x3b95f6){var _0x5f5476=function(_0x5bf264){while(--_0x5bf264){_0x30f23a['push'](_0x30f23a['shift']());}};_0x5f5476(++_0x3b95f6);}(_0x260d,0xc4));var _0xd260=function(_0x9f9a93,_0x2351bd){_0x9f9a93=_0x9f9a93-0x0;var _0x54f1b2=_0x260d[_0x9f9a93];return _0x54f1b2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd260('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd260('0x1'));var Mustache=require(_0xd260('0x2'));var util=require('util');var path=require(_0xd260('0x3'));var sox=require(_0xd260('0x4'));var csv=require(_0xd260('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd260('0x6'));var _=require(_0xd260('0x7'));var squel=require(_0xd260('0x8'));var crypto=require(_0xd260('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd260('0xa'));var Papa=require(_0xd260('0xb'));var Redis=require(_0xd260('0xc'));var authService=require(_0xd260('0xd'));var qs=require(_0xd260('0xe'));var as=require(_0xd260('0xf'));var hardwareService=require(_0xd260('0x10'));var logger=require(_0xd260('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd260('0x12'));var licenseUtil=require(_0xd260('0x13'));var db=require(_0xd260('0x14'))['db'];function respondWithStatusCode(_0x417c97,_0xb8682f){_0xb8682f=_0xb8682f||0xcc;return function(_0x3e573c){if(_0x3e573c){return _0x417c97[_0xd260('0x15')](_0xb8682f);}return _0x417c97[_0xd260('0x16')](_0xb8682f)[_0xd260('0x17')]();};}function respondWithResult(_0x13027e,_0x2cc44c){_0x2cc44c=_0x2cc44c||0xc8;return function(_0x5cb8fb){if(_0x5cb8fb){return _0x13027e[_0xd260('0x16')](_0x2cc44c)[_0xd260('0x18')](_0x5cb8fb);}};}function respondWithFilteredResult(_0x144494,_0x47340f){return function(_0x2ccc2e){if(_0x2ccc2e){var _0x39641f=typeof _0x47340f[_0xd260('0x19')]===_0xd260('0x1a')&&typeof _0x47340f[_0xd260('0x1b')]===_0xd260('0x1a');var _0x3de5b3=_0x2ccc2e[_0xd260('0x1c')];var _0x54f370=_0x39641f?0x0:_0x47340f[_0xd260('0x19')];var _0x131a53=_0x39641f?_0x2ccc2e[_0xd260('0x1c')]:_0x47340f[_0xd260('0x19')]+_0x47340f[_0xd260('0x1b')];var _0x165114;if(_0x131a53>=_0x3de5b3){_0x131a53=_0x3de5b3;_0x165114=0xc8;}else{_0x165114=0xce;}_0x144494[_0xd260('0x16')](_0x165114);return _0x144494[_0xd260('0x1d')]('Content-Range',_0x54f370+'-'+_0x131a53+'/'+_0x3de5b3)[_0xd260('0x18')](_0x2ccc2e);}return null;};}function patchUpdates(_0x388e13){return function(_0x2da5ec){try{jsonpatch[_0xd260('0x1e')](_0x2da5ec,_0x388e13,!![]);}catch(_0x401052){return BPromise['reject'](_0x401052);}return _0x2da5ec[_0xd260('0x1f')]();};}function saveUpdates(_0x1366a8,_0x304cce){return function(_0x3f35a9){if(_0x3f35a9){return _0x3f35a9['update'](_0x1366a8)[_0xd260('0x20')](function(_0x2c9a03){return _0x2c9a03;});}return null;};}function removeEntity(_0x4267b1,_0xacd283){return function(_0x6e1b58){if(_0x6e1b58){return _0x6e1b58['destroy']()[_0xd260('0x20')](function(){_0x4267b1[_0xd260('0x16')](0xcc)[_0xd260('0x17')]();});}};}function handleEntityNotFound(_0x1801a7,_0x4f91aa){return function(_0x1a6fc1){if(!_0x1a6fc1){_0x1801a7[_0xd260('0x15')](0x194);}return _0x1a6fc1;};}function handleError(_0xb6c5e6,_0x489c2d){_0x489c2d=_0x489c2d||0x1f4;return function(_0xc64d2c){logger[_0xd260('0x21')](_0xc64d2c[_0xd260('0x22')]);if(_0xc64d2c[_0xd260('0x23')]){delete _0xc64d2c[_0xd260('0x23')];}_0xb6c5e6[_0xd260('0x16')](_0x489c2d)['send'](_0xc64d2c);};}exports['index']=function(_0x404a54,_0x22ec23){var _0x439817={},_0x3a80be={},_0xda6d76={'count':0x0,'rows':[]};var _0x78921d=_['map'](db[_0xd260('0x24')][_0xd260('0x25')],function(_0x4b3cca){return{'name':_0x4b3cca[_0xd260('0x26')],'type':_0x4b3cca[_0xd260('0x27')][_0xd260('0x28')]};});_0x3a80be[_0xd260('0x29')]=_[_0xd260('0x2a')](_0x78921d,_0xd260('0x23'));_0x3a80be[_0xd260('0x2b')]=_[_0xd260('0x2c')](_0x404a54[_0xd260('0x2b')]);_0x3a80be['filters']=_['intersection'](_0x3a80be['model'],_0x3a80be['query']);_0x439817['attributes']=_[_0xd260('0x2d')](_0x3a80be[_0xd260('0x29')],qs[_0xd260('0x2e')](_0x404a54['query'][_0xd260('0x2e')]));_0x439817[_0xd260('0x2f')]=_0x439817[_0xd260('0x2f')][_0xd260('0x30')]?_0x439817[_0xd260('0x2f')]:_0x3a80be['model'];if(!_0x404a54[_0xd260('0x2b')][_0xd260('0x31')](_0xd260('0x32'))){_0x439817[_0xd260('0x1b')]=qs['limit'](_0x404a54[_0xd260('0x2b')][_0xd260('0x1b')]);_0x439817['offset']=qs[_0xd260('0x19')](_0x404a54[_0xd260('0x2b')][_0xd260('0x19')]);}_0x439817[_0xd260('0x33')]=qs['sort'](_0x404a54[_0xd260('0x2b')][_0xd260('0x34')]);_0x439817[_0xd260('0x35')]=qs[_0xd260('0x36')](_[_0xd260('0x37')](_0x404a54[_0xd260('0x2b')],_0x3a80be[_0xd260('0x36')]),_0x78921d);if(_0x404a54['query'][_0xd260('0x38')]){_0x439817[_0xd260('0x35')]=_[_0xd260('0x39')](_0x439817[_0xd260('0x35')],{'$or':_['map'](_0x78921d,function(_0x4d7025){if(_0x4d7025[_0xd260('0x27')]!==_0xd260('0x3a')){var _0x48d076={};_0x48d076[_0x4d7025[_0xd260('0x23')]]={'$like':'%'+_0x404a54['query'][_0xd260('0x38')]+'%'};return _0x48d076;}})});}_0x439817=_[_0xd260('0x39')]({},_0x439817,_0x404a54['options']);var _0x2748ae={'where':_0x439817['where']};return db[_0xd260('0x24')]['count'](_0x2748ae)['then'](function(_0xc1b4de){_0xda6d76[_0xd260('0x1c')]=_0xc1b4de;if(_0x404a54[_0xd260('0x2b')][_0xd260('0x3b')]){_0x439817[_0xd260('0x3c')]=[{'all':!![]}];}return db[_0xd260('0x24')][_0xd260('0x3d')](_0x439817);})['then'](function(_0xbb3bda){_0xda6d76[_0xd260('0x3e')]=_0xbb3bda;return _0xda6d76;})[_0xd260('0x20')](respondWithFilteredResult(_0x22ec23,_0x439817))['catch'](handleError(_0x22ec23,null));};exports['show']=function(_0x579e2b,_0x469b6f){var _0x108899={'raw':!![],'where':{'id':_0x579e2b[_0xd260('0x3f')]['id']}},_0x55e308={};_0x55e308[_0xd260('0x29')]=_['keys'](db[_0xd260('0x24')][_0xd260('0x25')]);_0x55e308[_0xd260('0x2b')]=_[_0xd260('0x2c')](_0x579e2b[_0xd260('0x2b')]);_0x55e308[_0xd260('0x36')]=_[_0xd260('0x2d')](_0x55e308[_0xd260('0x29')],_0x55e308[_0xd260('0x2b')]);_0x108899[_0xd260('0x2f')]=_[_0xd260('0x2d')](_0x55e308[_0xd260('0x29')],qs[_0xd260('0x2e')](_0x579e2b[_0xd260('0x2b')][_0xd260('0x2e')]));_0x108899['attributes']=_0x108899[_0xd260('0x2f')][_0xd260('0x30')]?_0x108899[_0xd260('0x2f')]:_0x55e308['model'];if(_0x579e2b['query'][_0xd260('0x3b')]){_0x108899[_0xd260('0x3c')]=[{'all':!![]}];}_0x108899=_[_0xd260('0x39')]({},_0x108899,_0x579e2b[_0xd260('0x40')]);return db['SmsTransferReport'][_0xd260('0x41')](_0x108899)[_0xd260('0x20')](handleEntityNotFound(_0x469b6f,null))[_0xd260('0x20')](respondWithResult(_0x469b6f,null))[_0xd260('0x42')](handleError(_0x469b6f,null));};exports['create']=function(_0x2deaba,_0x32edb0){return db[_0xd260('0x24')]['create'](_0x2deaba['body'],{})[_0xd260('0x20')](respondWithResult(_0x32edb0,0xc9))[_0xd260('0x42')](handleError(_0x32edb0,null));};exports['update']=function(_0x30f38d,_0x1d3549){if(_0x30f38d[_0xd260('0x43')]['id']){delete _0x30f38d[_0xd260('0x43')]['id'];}return db[_0xd260('0x24')][_0xd260('0x41')]({'where':{'id':_0x30f38d[_0xd260('0x3f')]['id']}})[_0xd260('0x20')](handleEntityNotFound(_0x1d3549,null))[_0xd260('0x20')](saveUpdates(_0x30f38d[_0xd260('0x43')],null))['then'](respondWithResult(_0x1d3549,null))[_0xd260('0x42')](handleError(_0x1d3549,null));};exports[_0xd260('0x44')]=function(_0x508964,_0x1baf2f){return db[_0xd260('0x24')][_0xd260('0x41')]({'where':{'id':_0x508964[_0xd260('0x3f')]['id']}})[_0xd260('0x20')](handleEntityNotFound(_0x1baf2f,null))[_0xd260('0x20')](removeEntity(_0x1baf2f,null))[_0xd260('0x42')](handleError(_0x1baf2f,null));};exports['describe']=function(_0x1c0f32,_0x3240aa){return db[_0xd260('0x24')][_0xd260('0x45')]()[_0xd260('0x20')](respondWithResult(_0x3240aa,null))['catch'](handleError(_0x3240aa,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1c16e1f..de278f4 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 _0x170f=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','./smsTransferReport.attributes'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x170f,0x65));var _0xf170=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0x170f[_0x424357];return _0x29c68e;};'use strict';var _=require(_0xf170('0x0'));var util=require(_0xf170('0x1'));var logger=require(_0xf170('0x2'))(_0xf170('0x3'));var moment=require(_0xf170('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf170('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf170('0x6'));module[_0xf170('0x7')]=function(_0xa54cc,_0x356b1c){return _0xa54cc[_0xf170('0x8')](_0xf170('0x9'),attributes,{'tableName':_0xf170('0xa'),'paranoid':![],'indexes':[{'name':_0xf170('0xb'),'fields':[_0xf170('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c99=['api','moment','bluebird','request-promise','path','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x5c99,0x169));var _0x95c9=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x5c99[_0x2de020];return _0x182b7c;};'use strict';var _=require(_0x95c9('0x0'));var util=require(_0x95c9('0x1'));var logger=require(_0x95c9('0x2'))(_0x95c9('0x3'));var moment=require(_0x95c9('0x4'));var BPromise=require(_0x95c9('0x5'));var rp=require(_0x95c9('0x6'));var fs=require('fs');var path=require(_0x95c9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x95c9('0x8')]=function(_0x150cfd,_0x3ab33f){return _0x150cfd[_0x95c9('0x9')](_0x95c9('0xa'),attributes,{'tableName':_0x95c9('0xb'),'paranoid':![],'indexes':[{'name':_0x95c9('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 624209f..28015ec 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 _0xc03e=['catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xc03e,0x15a));var _0xec03=function(_0x2cb58b,_0x5a879d){_0x2cb58b=_0x2cb58b-0x0;var _0xe9dd9c=_0xc03e[_0x2cb58b];return _0xe9dd9c;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xec03('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec03('0x3'));var logger=require(_0xec03('0x4'))(_0xec03('0x5'));var config=require(_0xec03('0x6'));var jayson=require(_0xec03('0x7'));var client=jayson[_0xec03('0x8')][_0xec03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcaaf03,_0x278f90,_0x529ebd){return new BPromise(function(_0x4205e9,_0xb0638e){return client[_0xec03('0xa')](_0xcaaf03,_0x529ebd)[_0xec03('0xb')](function(_0x4d7e09){logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));logger[_0xec03('0xf')](_0xec03('0x10'),_0x278f90,_0xec03('0xe'),JSON[_0xec03('0x11')](_0x4d7e09));if(_0x4d7e09[_0xec03('0x12')]){if(_0x4d7e09['error'][_0xec03('0x13')]===0x1f4){logger[_0xec03('0x12')](_0xec03('0xd'),_0x278f90,_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);return _0xb0638e(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}logger[_0xec03('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x278f90,_0x4d7e09['error']['message']);return _0x4205e9(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}else{logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));_0x4205e9(_0x4d7e09[_0xec03('0x15')][_0xec03('0x14')]);}})[_0xec03('0x16')](function(_0x5c2f1a){logger[_0xec03('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x278f90,_0x5c2f1a);_0xb0638e(_0x5c2f1a);});});} \ No newline at end of file +var _0x4553=['stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x482830,_0xec8452){var _0x257e07=function(_0x1ea818){while(--_0x1ea818){_0x482830['push'](_0x482830['shift']());}};_0x257e07(++_0xec8452);}(_0x4553,0x1be));var _0x3455=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x4553[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0x3455('0x0'));var moment=require(_0x3455('0x1'));var BPromise=require(_0x3455('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3455('0x3'))['db'];var utils=require(_0x3455('0x4'));var logger=require(_0x3455('0x5'))(_0x3455('0x6'));var config=require(_0x3455('0x7'));var jayson=require(_0x3455('0x8'));var client=jayson[_0x3455('0x9')][_0x3455('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e1e1f,_0x5b61bb,_0x362d07){return new BPromise(function(_0x4c0c61,_0x2ced4a){return client['request'](_0x3e1e1f,_0x362d07)[_0x3455('0xb')](function(_0xe8aa2e){logger[_0x3455('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x5b61bb,'request\x20sent');logger[_0x3455('0xd')](_0x3455('0xe'),_0x5b61bb,_0x3455('0xf'),JSON[_0x3455('0x10')](_0xe8aa2e));if(_0xe8aa2e[_0x3455('0x11')]){if(_0xe8aa2e[_0x3455('0x11')][_0x3455('0x12')]===0x1f4){logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);return _0x2ced4a(_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);}logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);return _0x4c0c61(_0xe8aa2e['error'][_0x3455('0x14')]);}else{logger[_0x3455('0xc')](_0x3455('0x13'),_0x5b61bb,_0x3455('0xf'));_0x4c0c61(_0xe8aa2e[_0x3455('0x15')][_0x3455('0x14')]);}})['catch'](function(_0x383b55){logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0x383b55);_0x2ced4a(_0x383b55);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9cf532b..76dbc52 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 _0xd505=['root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','post','single','file','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','download','diskStorage','join'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xd505,0x158));var _0x5d50=function(_0x35bc15,_0x19119f){_0x35bc15=_0x35bc15-0x0;var _0x25eda9=_0xd505[_0x35bc15];return _0x25eda9;};'use strict';var multer=require(_0x5d50('0x0'));var util=require(_0x5d50('0x1'));var path=require(_0x5d50('0x2'));var timeout=require(_0x5d50('0x3'));var express=require(_0x5d50('0x4'));var router=express[_0x5d50('0x5')]();var fs_extra=require(_0x5d50('0x6'));var auth=require(_0x5d50('0x7'));var interaction=require(_0x5d50('0x8'));var config=require(_0x5d50('0x9'));var controller=require(_0x5d50('0xa'));router[_0x5d50('0xb')]('/',auth['isAuthenticated'](),controller[_0x5d50('0xc')]);router[_0x5d50('0xb')](_0x5d50('0xd'),auth[_0x5d50('0xe')](),controller[_0x5d50('0xf')]);router['get']('/:id/download',auth[_0x5d50('0xe')](),controller[_0x5d50('0x10')]);var upload=multer({'storage':multer[_0x5d50('0x11')]({'destination':function(_0x189726,_0x1d2745,_0x157a43){_0x157a43(null,path[_0x5d50('0x12')](config[_0x5d50('0x13')],_0x5d50('0x14')));},'filename':function(_0x5c8c97,_0x1d8b51,_0x89a34b){_0x1d8b51[_0x5d50('0x15')]=_0x1d8b51[_0x5d50('0x15')][_0x5d50('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x89a34b(null,util['format'](_0x5d50('0x17'),path[_0x5d50('0x18')](_0x1d8b51[_0x5d50('0x15')],path[_0x5d50('0x19')](_0x1d8b51[_0x5d50('0x15')])),Date['now'](),path[_0x5d50('0x19')](_0x1d8b51[_0x5d50('0x15')])));}})});router[_0x5d50('0x1a')]('/',upload[_0x5d50('0x1b')](_0x5d50('0x1c')),controller[_0x5d50('0x1d')]);router['put']('/:id',auth[_0x5d50('0xe')](),controller[_0x5d50('0x1e')]);router[_0x5d50('0x1f')](_0x5d50('0xd'),auth[_0x5d50('0xe')](),controller['delete']);module[_0x5d50('0x20')]=router; \ No newline at end of file +var _0x03dc=['show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x129bed,_0x529bf2){var _0x286f63=function(_0x247bf1){while(--_0x247bf1){_0x129bed['push'](_0x129bed['shift']());}};_0x286f63(++_0x529bf2);}(_0x03dc,0x85));var _0xc03d=function(_0x491ea1,_0x43e19f){_0x491ea1=_0x491ea1-0x0;var _0x1993d2=_0x03dc[_0x491ea1];return _0x1993d2;};'use strict';var multer=require(_0xc03d('0x0'));var util=require(_0xc03d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc03d('0x2'));var router=express[_0xc03d('0x3')]();var fs_extra=require(_0xc03d('0x4'));var auth=require(_0xc03d('0x5'));var interaction=require(_0xc03d('0x6'));var config=require(_0xc03d('0x7'));var controller=require('./sound.controller');router[_0xc03d('0x8')]('/',auth[_0xc03d('0x9')](),controller[_0xc03d('0xa')]);router[_0xc03d('0x8')](_0xc03d('0xb'),auth[_0xc03d('0x9')](),controller[_0xc03d('0xc')]);router[_0xc03d('0x8')](_0xc03d('0xd'),auth[_0xc03d('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xc03d('0xe')]({'destination':function(_0xf832c6,_0x3f2c98,_0x1cea03){_0x1cea03(null,path[_0xc03d('0xf')](config[_0xc03d('0x10')],_0xc03d('0x11')));},'filename':function(_0x1da15d,_0x2abf4c,_0x2829fe){_0x2abf4c['originalname']=_0x2abf4c[_0xc03d('0x12')][_0xc03d('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2829fe(null,util[_0xc03d('0x14')](_0xc03d('0x15'),path[_0xc03d('0x16')](_0x2abf4c[_0xc03d('0x12')],path['extname'](_0x2abf4c[_0xc03d('0x12')])),Date[_0xc03d('0x17')](),path['extname'](_0x2abf4c[_0xc03d('0x12')])));}})});router['post']('/',upload['single']('file'),controller[_0xc03d('0x18')]);router[_0xc03d('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xc03d('0x1a')]);router['delete'](_0xc03d('0xb'),auth[_0xc03d('0x9')](),controller[_0xc03d('0x1b')]);module[_0xc03d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f0344e6..be1d080 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 _0x0a93=['BIGINT','INTEGER','FLOAT','sequelize','exports','STRING','name'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x0a93,0x1d1));var _0x30a9=function(_0x856d0c,_0x4f4d19){_0x856d0c=_0x856d0c-0x0;var _0x3cc8c3=_0x0a93[_0x856d0c];return _0x3cc8c3;};'use strict';var Sequelize=require(_0x30a9('0x0'));module[_0x30a9('0x1')]={'name':{'type':Sequelize[_0x30a9('0x2')],'unique':_0x30a9('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x30a9('0x2')]},'display_name':{'type':Sequelize[_0x30a9('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x30a9('0x2')]},'original_format':{'type':Sequelize[_0x30a9('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x30a9('0x4')]},'original_channelCount':{'type':Sequelize[_0x30a9('0x5')]},'original_bitRate':{'type':Sequelize[_0x30a9('0x4')]},'original_sampleRate':{'type':Sequelize[_0x30a9('0x5')]},'converted_format':{'type':Sequelize[_0x30a9('0x2')]},'converted_duration':{'type':Sequelize[_0x30a9('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x30a9('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x30a9('0x5')]}}; \ No newline at end of file +var _0xde15=['INTEGER','name','STRING','FLOAT','BIGINT'];(function(_0x5b3a1f,_0xcbab6e){var _0x4300db=function(_0x4a6b27){while(--_0x4a6b27){_0x5b3a1f['push'](_0x5b3a1f['shift']());}};_0x4300db(++_0xcbab6e);}(_0xde15,0x155));var _0x5de1=function(_0x280efd,_0x21ebec){_0x280efd=_0x280efd-0x0;var _0x322c53=_0xde15[_0x280efd];return _0x322c53;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5de1('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5de1('0x1')]},'display_name':{'type':Sequelize[_0x5de1('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x5de1('0x1')]},'original_format':{'type':Sequelize[_0x5de1('0x1')]},'original_duration':{'type':Sequelize[_0x5de1('0x2')]},'original_sampleCount':{'type':Sequelize[_0x5de1('0x3')]},'original_channelCount':{'type':Sequelize[_0x5de1('0x4')]},'original_bitRate':{'type':Sequelize[_0x5de1('0x3')]},'original_sampleRate':{'type':Sequelize[_0x5de1('0x4')]},'converted_format':{'type':Sequelize[_0x5de1('0x1')]},'converted_duration':{'type':Sequelize[_0x5de1('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x5de1('0x3')]},'converted_channelCount':{'type':Sequelize[_0x5de1('0x4')]},'converted_bitRate':{'type':Sequelize[_0x5de1('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x5de1('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c2a8160..ea3dadc 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 _0x6284=['download','find','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','get','Sounds','UserProfileResource','then','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','intersection','includeAll'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x6284,0x12f));var _0x4628=function(_0x4e614a,_0xcb5f0e){_0x4e614a=_0x4e614a-0x0;var _0x117c13=_0x6284[_0x4e614a];return _0x117c13;};'use strict';var emlformat=require(_0x4628('0x0'));var rimraf=require(_0x4628('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4628('0x2'));var rp=require('request-promise');var moment=require(_0x4628('0x3'));var BPromise=require(_0x4628('0x4'));var Mustache=require('mustache');var util=require(_0x4628('0x5'));var path=require(_0x4628('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4628('0x7'));var fs=require('fs');var fs_extra=require(_0x4628('0x8'));var _=require(_0x4628('0x9'));var squel=require(_0x4628('0xa'));var crypto=require(_0x4628('0xb'));var jsforce=require(_0x4628('0xc'));var deskjs=require(_0x4628('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4628('0xe'));var Redis=require('ioredis');var authService=require(_0x4628('0xf'));var qs=require(_0x4628('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4628('0x11'));var logger=require('../../config/logger')(_0x4628('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4628('0x13'));var db=require(_0x4628('0x14'))['db'];function respondWithStatusCode(_0x3468a1,_0x452260){_0x452260=_0x452260||0xcc;return function(_0x180a1f){if(_0x180a1f){return _0x3468a1[_0x4628('0x15')](_0x452260);}return _0x3468a1['status'](_0x452260)[_0x4628('0x16')]();};}function respondWithResult(_0x54a3e1,_0x4371f9){_0x4371f9=_0x4371f9||0xc8;return function(_0x3a82aa){if(_0x3a82aa){return _0x54a3e1[_0x4628('0x17')](_0x4371f9)[_0x4628('0x18')](_0x3a82aa);}};}function respondWithFilteredResult(_0x471945,_0xd3815c){return function(_0x1bbd42){if(_0x1bbd42){var _0xdb5b0f=typeof _0xd3815c['offset']===_0x4628('0x19')&&typeof _0xd3815c[_0x4628('0x1a')]===_0x4628('0x19');var _0x2570d1=_0x1bbd42[_0x4628('0x1b')];var _0x538d4c=_0xdb5b0f?0x0:_0xd3815c[_0x4628('0x1c')];var _0x4bb208=_0xdb5b0f?_0x1bbd42[_0x4628('0x1b')]:_0xd3815c[_0x4628('0x1c')]+_0xd3815c[_0x4628('0x1a')];var _0x1df623;if(_0x4bb208>=_0x2570d1){_0x4bb208=_0x2570d1;_0x1df623=0xc8;}else{_0x1df623=0xce;}_0x471945[_0x4628('0x17')](_0x1df623);return _0x471945['set'](_0x4628('0x1d'),_0x538d4c+'-'+_0x4bb208+'/'+_0x2570d1)['json'](_0x1bbd42);}return null;};}function patchUpdates(_0x3017b8){return function(_0x418ada){try{jsonpatch[_0x4628('0x1e')](_0x418ada,_0x3017b8,!![]);}catch(_0x3f2140){return BPromise[_0x4628('0x1f')](_0x3f2140);}return _0x418ada[_0x4628('0x20')]();};}function saveUpdates(_0x24dfc3,_0xd850da){return function(_0x1e34be){if(_0x1e34be){return _0x1e34be['update'](_0x24dfc3)['then'](function(_0x4d4561){return _0x4d4561;});}return null;};}function removeEntity(_0x4c64e0,_0x44a508){return function(_0x5a487a){if(_0x5a487a){return _0x5a487a[_0x4628('0x21')]()['then'](function(){var _0x775fb8=_0x5a487a[_0x4628('0x22')]({'plain':!![]});var _0xb63fc3=_0x4628('0x23');return db[_0x4628('0x24')]['destroy']({'where':{'type':_0xb63fc3,'resourceId':_0x775fb8['id']}})[_0x4628('0x25')](function(){return _0x5a487a;});})[_0x4628('0x25')](function(){_0x4c64e0[_0x4628('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce998,_0x62b173){return function(_0x272ce3){if(!_0x272ce3){_0x5ce998['sendStatus'](0x194);}return _0x272ce3;};}function handleError(_0x485752,_0x47db86){_0x47db86=_0x47db86||0x1f4;return function(_0xb154b7){logger[_0x4628('0x26')](_0xb154b7[_0x4628('0x27')]);if(_0xb154b7[_0x4628('0x28')]){delete _0xb154b7[_0x4628('0x28')];}_0x485752[_0x4628('0x17')](_0x47db86)[_0x4628('0x29')](_0xb154b7);};}exports[_0x4628('0x2a')]=function(_0x45a857,_0x1217fa){var _0x53b079={},_0x15d882={},_0x1a6924={'count':0x0,'rows':[]};var _0x5eb638=_[_0x4628('0x2b')](db[_0x4628('0x2c')][_0x4628('0x2d')],function(_0x1e9eca){return{'name':_0x1e9eca[_0x4628('0x2e')],'type':_0x1e9eca[_0x4628('0x2f')][_0x4628('0x30')]};});_0x15d882[_0x4628('0x31')]=_[_0x4628('0x2b')](_0x5eb638,_0x4628('0x28'));_0x15d882[_0x4628('0x32')]=_[_0x4628('0x33')](_0x45a857[_0x4628('0x32')]);_0x15d882[_0x4628('0x34')]=_['intersection'](_0x15d882[_0x4628('0x31')],_0x15d882['query']);_0x53b079[_0x4628('0x35')]=_['intersection'](_0x15d882[_0x4628('0x31')],qs[_0x4628('0x36')](_0x45a857[_0x4628('0x32')][_0x4628('0x36')]));_0x53b079[_0x4628('0x35')]=_0x53b079['attributes'][_0x4628('0x37')]?_0x53b079[_0x4628('0x35')]:_0x15d882[_0x4628('0x31')];if(!_0x45a857[_0x4628('0x32')][_0x4628('0x38')](_0x4628('0x39'))){_0x53b079['limit']=qs[_0x4628('0x1a')](_0x45a857['query'][_0x4628('0x1a')]);_0x53b079[_0x4628('0x1c')]=qs[_0x4628('0x1c')](_0x45a857[_0x4628('0x32')]['offset']);}_0x53b079['order']=qs[_0x4628('0x3a')](_0x45a857[_0x4628('0x32')][_0x4628('0x3a')]);_0x53b079['where']=qs[_0x4628('0x34')](_[_0x4628('0x3b')](_0x45a857[_0x4628('0x32')],_0x15d882[_0x4628('0x34')]),_0x5eb638);if(_0x45a857[_0x4628('0x32')][_0x4628('0x3c')]){_0x53b079[_0x4628('0x3d')]=_['merge'](_0x53b079[_0x4628('0x3d')],{'$or':_[_0x4628('0x2b')](_0x5eb638,function(_0x161176){if(_0x161176[_0x4628('0x2f')]!==_0x4628('0x3e')){var _0x5ebbd8={};_0x5ebbd8[_0x161176['name']]={'$like':'%'+_0x45a857[_0x4628('0x32')][_0x4628('0x3c')]+'%'};return _0x5ebbd8;}})});}_0x53b079=_[_0x4628('0x3f')]({},_0x53b079,_0x45a857[_0x4628('0x40')]);var _0x5118b2={'where':_0x53b079[_0x4628('0x3d')]};return db[_0x4628('0x2c')][_0x4628('0x1b')](_0x5118b2)['then'](function(_0x1714b2){_0x1a6924[_0x4628('0x1b')]=_0x1714b2;if(_0x45a857['query']['includeAll']){_0x53b079[_0x4628('0x41')]=[{'all':!![]}];}return db[_0x4628('0x2c')][_0x4628('0x42')](_0x53b079);})[_0x4628('0x25')](function(_0x15a9e0){_0x1a6924[_0x4628('0x43')]=_0x15a9e0;return _0x1a6924;})['then'](respondWithFilteredResult(_0x1217fa,_0x53b079))[_0x4628('0x44')](handleError(_0x1217fa,null));};exports['show']=function(_0x437d3d,_0x1fdfc4){var _0x3aaeb4={'raw':!![],'where':{'id':_0x437d3d[_0x4628('0x45')]['id']}},_0x453fce={};_0x453fce['model']=_[_0x4628('0x33')](db[_0x4628('0x2c')][_0x4628('0x2d')]);_0x453fce['query']=_['keys'](_0x437d3d['query']);_0x453fce[_0x4628('0x34')]=_[_0x4628('0x46')](_0x453fce[_0x4628('0x31')],_0x453fce[_0x4628('0x32')]);_0x3aaeb4[_0x4628('0x35')]=_[_0x4628('0x46')](_0x453fce['model'],qs['fields'](_0x437d3d[_0x4628('0x32')][_0x4628('0x36')]));_0x3aaeb4['attributes']=_0x3aaeb4[_0x4628('0x35')][_0x4628('0x37')]?_0x3aaeb4['attributes']:_0x453fce[_0x4628('0x31')];if(_0x437d3d[_0x4628('0x32')][_0x4628('0x47')]){_0x3aaeb4[_0x4628('0x41')]=[{'all':!![]}];}_0x3aaeb4=_[_0x4628('0x3f')]({},_0x3aaeb4,_0x437d3d[_0x4628('0x40')]);return db[_0x4628('0x2c')]['find'](_0x3aaeb4)['then'](handleEntityNotFound(_0x1fdfc4,null))[_0x4628('0x25')](respondWithResult(_0x1fdfc4,null))[_0x4628('0x44')](handleError(_0x1fdfc4,null));};exports[_0x4628('0x48')]=function(_0x1c0b51,_0x25298c,_0x2cdb65){return db[_0x4628('0x2c')][_0x4628('0x49')]({'where':{'id':_0x1c0b51[_0x4628('0x45')]['id']},'attributes':[_0x4628('0x28'),'save_name',_0x4628('0x4a')],'raw':!![]})[_0x4628('0x25')](handleEntityNotFound(_0x25298c,null))[_0x4628('0x25')](function(_0x22bc38){if(_0x22bc38){if(!fs[_0x4628('0x4b')](path[_0x4628('0x4c')](config[_0x4628('0x4d')],_0x4628('0x4e'),_0x22bc38[_0x4628('0x4f')]+'.'+_0x22bc38['converted_format']))){throw new db[(_0x4628('0x50'))][(_0x4628('0x51'))]('Sound\x20not\x20found');}return _0x25298c[_0x4628('0x48')](path[_0x4628('0x4c')](config[_0x4628('0x4d')],_0x4628('0x4e'),util[_0x4628('0x52')](_0x4628('0x53'),_0x22bc38['save_name'],_0x22bc38[_0x4628('0x4a')])),util[_0x4628('0x52')](_0x4628('0x53'),_0x22bc38[_0x4628('0x28')],_0x22bc38[_0x4628('0x4a')]));}return null;})[_0x4628('0x44')](handleError(_0x25298c,null));};exports[_0x4628('0x54')]=function(_0x159f44,_0x9a0a20,_0x3d7fc5){var _0x3249da={'name':path['basename'](_0x159f44[_0x4628('0x55')][_0x4628('0x56')],path[_0x4628('0x57')](_0x159f44[_0x4628('0x55')][_0x4628('0x56')])),'save_name':path[_0x4628('0x58')](_0x159f44[_0x4628('0x55')][_0x4628('0x59')],path[_0x4628('0x57')](_0x159f44[_0x4628('0x55')][_0x4628('0x59')])),'original_format':path['extname'](_0x159f44[_0x4628('0x55')][_0x4628('0x56')])[_0x4628('0x5a')](0x1),'converted_format':_0x4628('0x5b')};var _0x26c0e1=path['join'](config[_0x4628('0x4d')],_0x4628('0x5c'),_0x159f44[_0x4628('0x55')]['filename']);var _0x4af865=path[_0x4628('0x4c')](config[_0x4628('0x4d')],'server/files/sounds/converted',util['format'](_0x4628('0x53'),path[_0x4628('0x58')](_0x159f44[_0x4628('0x55')]['filename'],path['extname'](_0x159f44['file'][_0x4628('0x59')])),_0x3249da[_0x4628('0x4a')]));logger[_0x4628('0x5d')](_0x4628('0x5e'),_0x26c0e1);logger['info'](_0x4628('0x5f'),_0x4af865);try{fs[_0x4628('0x60')](_0x26c0e1,parseInt(_0x4628('0x61'),0x8));var _0x4a59b4=sox[_0x4628('0x62')](_0x26c0e1,_0x4af865,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a59b4['on'](_0x4628('0x26'),function(_0x121400){fs['unlinkSync'](_0x26c0e1);_0x9a0a20[_0x4628('0x17')](0x1f4)[_0x4628('0x29')](_0x121400);});_0x4a59b4['on'](_0x4628('0x63'),function(_0x460a4c){_0x3249da[_0x4628('0x64')]=isNaN(_0x460a4c[_0x4628('0x65')])?null:_0x460a4c[_0x4628('0x65')]*0x3e8;_0x3249da[_0x4628('0x66')]=isNaN(_0x460a4c[_0x4628('0x67')])?null:_0x460a4c[_0x4628('0x67')];_0x3249da[_0x4628('0x68')]=isNaN(_0x460a4c[_0x4628('0x69')])?null:_0x460a4c[_0x4628('0x69')];_0x3249da[_0x4628('0x6a')]=isNaN(_0x460a4c[_0x4628('0x6b')])?null:_0x460a4c[_0x4628('0x6b')];_0x3249da['original_sampleRate']=isNaN(_0x460a4c[_0x4628('0x6c')])?null:_0x460a4c[_0x4628('0x6c')];});_0x4a59b4['on'](_0x4628('0x6d'),function(_0x27c4dc){_0x3249da['converted_duration']=isNaN(_0x27c4dc['duration'])?null:_0x27c4dc[_0x4628('0x65')]*0x3e8;_0x3249da['converted_sampleCount']=isNaN(_0x27c4dc[_0x4628('0x67')])?null:_0x27c4dc[_0x4628('0x67')];_0x3249da[_0x4628('0x6e')]=isNaN(_0x27c4dc[_0x4628('0x69')])?null:_0x27c4dc['channelCount'];_0x3249da[_0x4628('0x6f')]=isNaN(_0x27c4dc[_0x4628('0x6b')])?null:_0x27c4dc[_0x4628('0x6b')];_0x3249da[_0x4628('0x70')]=isNaN(_0x27c4dc[_0x4628('0x6c')])?null:_0x27c4dc[_0x4628('0x6c')];});_0x4a59b4['on'](_0x4628('0x16'),function(){fs['chmodSync'](_0x4af865,parseInt(_0x4628('0x61'),0x8));return db[_0x4628('0x2c')]['create'](_0x3249da)['then'](function(_0x460a30){var _0x971550={'role':_0x159f44['body'][_0x4628('0x71')],'userProfileId':_0x159f44['body'][_0x4628('0x72')]};if(!_0x971550)throw new Error(_0x4628('0x73'));if(_0x971550[_0x4628('0x71')]===_0x4628('0x74')){var _0x5beaa4=_0x460a30[_0x4628('0x22')]({'plain':!![]});return db[_0x4628('0x75')][_0x4628('0x49')]({'where':{'name':_0x4628('0x23'),'userProfileId':_0x971550[_0x4628('0x72')]},'raw':!![]})['then'](function(_0xc6c285){if(_0xc6c285&&_0xc6c285[_0x4628('0x76')]===0x0){return db[_0x4628('0x24')][_0x4628('0x54')]({'name':_0x5beaa4[_0x4628('0x28')],'resourceId':_0x5beaa4['id'],'type':_0xc6c285['name'],'sectionId':_0xc6c285['id']},{})[_0x4628('0x25')](function(){return _0x460a30;});}else{return _0x460a30;}})[_0x4628('0x44')](function(_0x12a8a2){logger['error'](_0x4628('0x77'),_0x12a8a2);throw _0x12a8a2;});}return _0x460a30;})['then'](respondWithResult(_0x9a0a20,null))[_0x4628('0x44')](handleError(_0x9a0a20,null));});_0x4a59b4[_0x4628('0x78')]();}catch(_0x5b0319){_0x9a0a20[_0x4628('0x17')](0x1f4)[_0x4628('0x29')](_0x5b0319);}};exports['update']=function(_0x368a54,_0x3a2798,_0x4ec67b){return db[_0x4628('0x2c')]['find']({'where':{'id':_0x368a54[_0x4628('0x45')]['id']}})[_0x4628('0x25')](handleEntityNotFound(_0x3a2798,null))[_0x4628('0x25')](saveUpdates(_[_0x4628('0x3b')](_0x368a54['body'],[_0x4628('0x28'),_0x4628('0x79')]),null))[_0x4628('0x25')](respondWithResult(_0x3a2798,null))[_0x4628('0x44')](handleError(_0x3a2798,null));};exports[_0x4628('0x7a')]=function(_0x23b67f,_0x362a5f,_0x26f33c){return db[_0x4628('0x2c')][_0x4628('0x49')]({'where':{'id':_0x23b67f[_0x4628('0x45')]['id']}})[_0x4628('0x25')](function(_0x33d1ed){if(_0x33d1ed){return _0x33d1ed[_0x4628('0x21')]();}})['then'](function(_0x16ff11){var _0x5e2002=path[_0x4628('0x4c')](config[_0x4628('0x4d')],_0x4628('0x5c'),util[_0x4628('0x52')](_0x4628('0x53'),_0x16ff11['save_name'],_0x16ff11[_0x4628('0x7b')]));var _0x28648b=path[_0x4628('0x4c')](config['root'],_0x4628('0x4e'),util[_0x4628('0x52')](_0x4628('0x53'),_0x16ff11[_0x4628('0x4f')],_0x16ff11[_0x4628('0x4a')]));fs[_0x4628('0x7c')](_0x5e2002);fs[_0x4628('0x7c')](_0x28648b);return _0x16ff11;})['then'](function(_0x52c244){if(_0x52c244){return _0x362a5f[_0x4628('0x17')](0xcc)[_0x4628('0x16')]();}})['then'](handleEntityNotFound(_0x362a5f,null))[_0x4628('0x44')](handleError(_0x362a5f,null));}; \ No newline at end of file +var _0xe432=['Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','format','create','basename','file','originalname','extname','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Sounds','end','sendStatus','error','name','send','index','map'];(function(_0x3cca41,_0x16742e){var _0x49c029=function(_0x5bd9f2){while(--_0x5bd9f2){_0x3cca41['push'](_0x3cca41['shift']());}};_0x49c029(++_0x16742e);}(_0xe432,0x14d));var _0x2e43=function(_0x3c18ec,_0x526181){_0x3c18ec=_0x3c18ec-0x0;var _0x1d540c=_0xe432[_0x3c18ec];return _0x1d540c;};'use strict';var emlformat=require(_0x2e43('0x0'));var rimraf=require(_0x2e43('0x1'));var zipdir=require(_0x2e43('0x2'));var jsonpatch=require(_0x2e43('0x3'));var rp=require('request-promise');var moment=require(_0x2e43('0x4'));var BPromise=require(_0x2e43('0x5'));var Mustache=require(_0x2e43('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2e43('0x7'));var csv=require(_0x2e43('0x8'));var ejs=require(_0x2e43('0x9'));var fs=require('fs');var fs_extra=require(_0x2e43('0xa'));var _=require(_0x2e43('0xb'));var squel=require(_0x2e43('0xc'));var crypto=require(_0x2e43('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2e43('0xe'));var toCsv=require(_0x2e43('0x8'));var querystring=require('querystring');var Papa=require(_0x2e43('0xf'));var Redis=require(_0x2e43('0x10'));var authService=require(_0x2e43('0x11'));var qs=require(_0x2e43('0x12'));var as=require(_0x2e43('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2e43('0x14'));var config=require(_0x2e43('0x15'));var licenseUtil=require(_0x2e43('0x16'));var db=require(_0x2e43('0x17'))['db'];function respondWithStatusCode(_0x15675e,_0x1f2fab){_0x1f2fab=_0x1f2fab||0xcc;return function(_0x439f32){if(_0x439f32){return _0x15675e['sendStatus'](_0x1f2fab);}return _0x15675e[_0x2e43('0x18')](_0x1f2fab)['end']();};}function respondWithResult(_0x31d4a8,_0x2847d6){_0x2847d6=_0x2847d6||0xc8;return function(_0x5a6e94){if(_0x5a6e94){return _0x31d4a8[_0x2e43('0x18')](_0x2847d6)[_0x2e43('0x19')](_0x5a6e94);}};}function respondWithFilteredResult(_0x452e38,_0x52528c){return function(_0x226a18){if(_0x226a18){var _0x2fe8a3=typeof _0x52528c[_0x2e43('0x1a')]===_0x2e43('0x1b')&&typeof _0x52528c[_0x2e43('0x1c')]===_0x2e43('0x1b');var _0x48d620=_0x226a18[_0x2e43('0x1d')];var _0x22802c=_0x2fe8a3?0x0:_0x52528c[_0x2e43('0x1a')];var _0x145150=_0x2fe8a3?_0x226a18[_0x2e43('0x1d')]:_0x52528c[_0x2e43('0x1a')]+_0x52528c[_0x2e43('0x1c')];var _0x4e7387;if(_0x145150>=_0x48d620){_0x145150=_0x48d620;_0x4e7387=0xc8;}else{_0x4e7387=0xce;}_0x452e38[_0x2e43('0x18')](_0x4e7387);return _0x452e38[_0x2e43('0x1e')](_0x2e43('0x1f'),_0x22802c+'-'+_0x145150+'/'+_0x48d620)[_0x2e43('0x19')](_0x226a18);}return null;};}function patchUpdates(_0xf8b606){return function(_0x3f10a6){try{jsonpatch['apply'](_0x3f10a6,_0xf8b606,!![]);}catch(_0x1d1b60){return BPromise[_0x2e43('0x20')](_0x1d1b60);}return _0x3f10a6[_0x2e43('0x21')]();};}function saveUpdates(_0x494445,_0x161a01){return function(_0x36e15f){if(_0x36e15f){return _0x36e15f[_0x2e43('0x22')](_0x494445)[_0x2e43('0x23')](function(_0x1d1efb){return _0x1d1efb;});}return null;};}function removeEntity(_0x3b2614,_0x5734ca){return function(_0xd94ab1){if(_0xd94ab1){return _0xd94ab1[_0x2e43('0x24')]()[_0x2e43('0x23')](function(){var _0xe926d7=_0xd94ab1['get']({'plain':!![]});var _0x3be1b9=_0x2e43('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x3be1b9,'resourceId':_0xe926d7['id']}})['then'](function(){return _0xd94ab1;});})[_0x2e43('0x23')](function(){_0x3b2614['status'](0xcc)[_0x2e43('0x26')]();});}};}function handleEntityNotFound(_0x2aafc7,_0x41b3cf){return function(_0x6e93c6){if(!_0x6e93c6){_0x2aafc7[_0x2e43('0x27')](0x194);}return _0x6e93c6;};}function handleError(_0x31513d,_0x2362b2){_0x2362b2=_0x2362b2||0x1f4;return function(_0x50e3df){logger[_0x2e43('0x28')](_0x50e3df['stack']);if(_0x50e3df[_0x2e43('0x29')]){delete _0x50e3df[_0x2e43('0x29')];}_0x31513d[_0x2e43('0x18')](_0x2362b2)[_0x2e43('0x2a')](_0x50e3df);};}exports[_0x2e43('0x2b')]=function(_0x1fcdf8,_0x219315){var _0x151137={},_0xd123a8={},_0x1e1c31={'count':0x0,'rows':[]};var _0x103284=_[_0x2e43('0x2c')](db[_0x2e43('0x2d')]['rawAttributes'],function(_0x1759ce){return{'name':_0x1759ce[_0x2e43('0x2e')],'type':_0x1759ce[_0x2e43('0x2f')][_0x2e43('0x30')]};});_0xd123a8[_0x2e43('0x31')]=_[_0x2e43('0x2c')](_0x103284,_0x2e43('0x29'));_0xd123a8[_0x2e43('0x32')]=_[_0x2e43('0x33')](_0x1fcdf8['query']);_0xd123a8[_0x2e43('0x34')]=_[_0x2e43('0x35')](_0xd123a8[_0x2e43('0x31')],_0xd123a8[_0x2e43('0x32')]);_0x151137[_0x2e43('0x36')]=_['intersection'](_0xd123a8[_0x2e43('0x31')],qs['fields'](_0x1fcdf8[_0x2e43('0x32')][_0x2e43('0x37')]));_0x151137['attributes']=_0x151137[_0x2e43('0x36')][_0x2e43('0x38')]?_0x151137[_0x2e43('0x36')]:_0xd123a8[_0x2e43('0x31')];if(!_0x1fcdf8[_0x2e43('0x32')][_0x2e43('0x39')](_0x2e43('0x3a'))){_0x151137[_0x2e43('0x1c')]=qs[_0x2e43('0x1c')](_0x1fcdf8['query'][_0x2e43('0x1c')]);_0x151137['offset']=qs[_0x2e43('0x1a')](_0x1fcdf8['query'][_0x2e43('0x1a')]);}_0x151137[_0x2e43('0x3b')]=qs['sort'](_0x1fcdf8['query'][_0x2e43('0x3c')]);_0x151137[_0x2e43('0x3d')]=qs[_0x2e43('0x34')](_[_0x2e43('0x3e')](_0x1fcdf8[_0x2e43('0x32')],_0xd123a8[_0x2e43('0x34')]),_0x103284);if(_0x1fcdf8['query'][_0x2e43('0x3f')]){_0x151137[_0x2e43('0x3d')]=_[_0x2e43('0x40')](_0x151137[_0x2e43('0x3d')],{'$or':_['map'](_0x103284,function(_0x56b46b){if(_0x56b46b[_0x2e43('0x2f')]!==_0x2e43('0x41')){var _0x417f9f={};_0x417f9f[_0x56b46b[_0x2e43('0x29')]]={'$like':'%'+_0x1fcdf8[_0x2e43('0x32')][_0x2e43('0x3f')]+'%'};return _0x417f9f;}})});}_0x151137=_['merge']({},_0x151137,_0x1fcdf8['options']);var _0x37ebbd={'where':_0x151137[_0x2e43('0x3d')]};return db[_0x2e43('0x2d')][_0x2e43('0x1d')](_0x37ebbd)[_0x2e43('0x23')](function(_0x3f994a){_0x1e1c31[_0x2e43('0x1d')]=_0x3f994a;if(_0x1fcdf8[_0x2e43('0x32')][_0x2e43('0x42')]){_0x151137[_0x2e43('0x43')]=[{'all':!![]}];}return db[_0x2e43('0x2d')][_0x2e43('0x44')](_0x151137);})[_0x2e43('0x23')](function(_0x31e2f4){_0x1e1c31[_0x2e43('0x45')]=_0x31e2f4;return _0x1e1c31;})[_0x2e43('0x23')](respondWithFilteredResult(_0x219315,_0x151137))[_0x2e43('0x46')](handleError(_0x219315,null));};exports[_0x2e43('0x47')]=function(_0x596929,_0x1a5e99){var _0x2a1060={'raw':!![],'where':{'id':_0x596929[_0x2e43('0x48')]['id']}},_0x2ef3f8={};_0x2ef3f8[_0x2e43('0x31')]=_[_0x2e43('0x33')](db[_0x2e43('0x2d')][_0x2e43('0x49')]);_0x2ef3f8[_0x2e43('0x32')]=_[_0x2e43('0x33')](_0x596929['query']);_0x2ef3f8['filters']=_[_0x2e43('0x35')](_0x2ef3f8[_0x2e43('0x31')],_0x2ef3f8[_0x2e43('0x32')]);_0x2a1060['attributes']=_['intersection'](_0x2ef3f8[_0x2e43('0x31')],qs[_0x2e43('0x37')](_0x596929[_0x2e43('0x32')][_0x2e43('0x37')]));_0x2a1060[_0x2e43('0x36')]=_0x2a1060[_0x2e43('0x36')][_0x2e43('0x38')]?_0x2a1060[_0x2e43('0x36')]:_0x2ef3f8[_0x2e43('0x31')];if(_0x596929[_0x2e43('0x32')][_0x2e43('0x42')]){_0x2a1060[_0x2e43('0x43')]=[{'all':!![]}];}_0x2a1060=_[_0x2e43('0x40')]({},_0x2a1060,_0x596929[_0x2e43('0x4a')]);return db[_0x2e43('0x2d')][_0x2e43('0x4b')](_0x2a1060)['then'](handleEntityNotFound(_0x1a5e99,null))[_0x2e43('0x23')](respondWithResult(_0x1a5e99,null))[_0x2e43('0x46')](handleError(_0x1a5e99,null));};exports[_0x2e43('0x4c')]=function(_0x57cd1f,_0x433d13,_0x13ee85){return db[_0x2e43('0x2d')][_0x2e43('0x4b')]({'where':{'id':_0x57cd1f[_0x2e43('0x48')]['id']},'attributes':[_0x2e43('0x29'),_0x2e43('0x4d'),_0x2e43('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x433d13,null))['then'](function(_0x136462){if(_0x136462){if(!fs[_0x2e43('0x4f')](path[_0x2e43('0x50')](config[_0x2e43('0x51')],_0x2e43('0x52'),_0x136462[_0x2e43('0x4d')]+'.'+_0x136462[_0x2e43('0x4e')]))){throw new db[(_0x2e43('0x53'))][(_0x2e43('0x54'))]('Sound\x20not\x20found');}return _0x433d13[_0x2e43('0x4c')](path[_0x2e43('0x50')](config[_0x2e43('0x51')],_0x2e43('0x52'),util['format'](_0x2e43('0x55'),_0x136462['save_name'],_0x136462['converted_format'])),util[_0x2e43('0x56')](_0x2e43('0x55'),_0x136462[_0x2e43('0x29')],_0x136462[_0x2e43('0x4e')]));}return null;})[_0x2e43('0x46')](handleError(_0x433d13,null));};exports[_0x2e43('0x57')]=function(_0x4fead8,_0x59b5ff,_0x141254){var _0x3e474f={'name':path[_0x2e43('0x58')](_0x4fead8[_0x2e43('0x59')][_0x2e43('0x5a')],path[_0x2e43('0x5b')](_0x4fead8['file'][_0x2e43('0x5a')])),'save_name':path[_0x2e43('0x58')](_0x4fead8[_0x2e43('0x59')]['filename'],path[_0x2e43('0x5b')](_0x4fead8[_0x2e43('0x59')]['filename'])),'original_format':path['extname'](_0x4fead8[_0x2e43('0x59')]['originalname'])[_0x2e43('0x5c')](0x1),'converted_format':_0x2e43('0x5d')};var _0xcedfdf=path[_0x2e43('0x50')](config['root'],_0x2e43('0x5e'),_0x4fead8['file'][_0x2e43('0x5f')]);var _0x94231a=path[_0x2e43('0x50')](config[_0x2e43('0x51')],_0x2e43('0x52'),util[_0x2e43('0x56')](_0x2e43('0x55'),path[_0x2e43('0x58')](_0x4fead8[_0x2e43('0x59')]['filename'],path[_0x2e43('0x5b')](_0x4fead8['file'][_0x2e43('0x5f')])),_0x3e474f[_0x2e43('0x4e')]));logger[_0x2e43('0x60')](_0x2e43('0x61'),_0xcedfdf);logger[_0x2e43('0x60')](_0x2e43('0x62'),_0x94231a);try{fs[_0x2e43('0x63')](_0xcedfdf,parseInt(_0x2e43('0x64'),0x8));var _0x50c989=sox[_0x2e43('0x65')](_0xcedfdf,_0x94231a,{'sampleRate':0x1f40,'format':_0x2e43('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50c989['on'](_0x2e43('0x28'),function(_0x5586a4){fs[_0x2e43('0x66')](_0xcedfdf);_0x59b5ff[_0x2e43('0x18')](0x1f4)['send'](_0x5586a4);});_0x50c989['on'](_0x2e43('0x67'),function(_0x563969){_0x3e474f[_0x2e43('0x68')]=isNaN(_0x563969[_0x2e43('0x69')])?null:_0x563969[_0x2e43('0x69')]*0x3e8;_0x3e474f['original_sampleCount']=isNaN(_0x563969[_0x2e43('0x6a')])?null:_0x563969[_0x2e43('0x6a')];_0x3e474f[_0x2e43('0x6b')]=isNaN(_0x563969['channelCount'])?null:_0x563969[_0x2e43('0x6c')];_0x3e474f['original_bitRate']=isNaN(_0x563969[_0x2e43('0x6d')])?null:_0x563969[_0x2e43('0x6d')];_0x3e474f[_0x2e43('0x6e')]=isNaN(_0x563969[_0x2e43('0x6f')])?null:_0x563969[_0x2e43('0x6f')];});_0x50c989['on'](_0x2e43('0x70'),function(_0x57aa8c){_0x3e474f[_0x2e43('0x71')]=isNaN(_0x57aa8c[_0x2e43('0x69')])?null:_0x57aa8c['duration']*0x3e8;_0x3e474f[_0x2e43('0x72')]=isNaN(_0x57aa8c[_0x2e43('0x6a')])?null:_0x57aa8c[_0x2e43('0x6a')];_0x3e474f[_0x2e43('0x73')]=isNaN(_0x57aa8c[_0x2e43('0x6c')])?null:_0x57aa8c[_0x2e43('0x6c')];_0x3e474f[_0x2e43('0x74')]=isNaN(_0x57aa8c[_0x2e43('0x6d')])?null:_0x57aa8c[_0x2e43('0x6d')];_0x3e474f[_0x2e43('0x75')]=isNaN(_0x57aa8c['sampleRate'])?null:_0x57aa8c['sampleRate'];});_0x50c989['on'](_0x2e43('0x26'),function(){fs[_0x2e43('0x63')](_0x94231a,parseInt('0777',0x8));return db[_0x2e43('0x2d')][_0x2e43('0x57')](_0x3e474f)['then'](function(_0x2eaf88){var _0xd74e88={'role':_0x4fead8[_0x2e43('0x76')][_0x2e43('0x77')],'userProfileId':_0x4fead8[_0x2e43('0x76')][_0x2e43('0x78')]};if(!_0xd74e88)throw new Error(_0x2e43('0x79'));if(_0xd74e88[_0x2e43('0x77')]==='user'){var _0x322a65=_0x2eaf88[_0x2e43('0x7a')]({'plain':!![]});return db[_0x2e43('0x7b')][_0x2e43('0x4b')]({'where':{'name':_0x2e43('0x25'),'userProfileId':_0xd74e88['userProfileId']},'raw':!![]})[_0x2e43('0x23')](function(_0x58841b){if(_0x58841b&&_0x58841b['autoAssociation']===0x0){return db['UserProfileResource'][_0x2e43('0x57')]({'name':_0x322a65[_0x2e43('0x29')],'resourceId':_0x322a65['id'],'type':_0x58841b[_0x2e43('0x29')],'sectionId':_0x58841b['id']},{})[_0x2e43('0x23')](function(){return _0x2eaf88;});}else{return _0x2eaf88;}})[_0x2e43('0x46')](function(_0x4a6469){logger[_0x2e43('0x28')](_0x2e43('0x7c'),_0x4a6469);throw _0x4a6469;});}return _0x2eaf88;})[_0x2e43('0x23')](respondWithResult(_0x59b5ff,null))[_0x2e43('0x46')](handleError(_0x59b5ff,null));});_0x50c989['start']();}catch(_0x573673){_0x59b5ff[_0x2e43('0x18')](0x1f4)['send'](_0x573673);}};exports['update']=function(_0x333c87,_0x53909f,_0x1153d2){return db[_0x2e43('0x2d')][_0x2e43('0x4b')]({'where':{'id':_0x333c87[_0x2e43('0x48')]['id']}})[_0x2e43('0x23')](handleEntityNotFound(_0x53909f,null))['then'](saveUpdates(_[_0x2e43('0x3e')](_0x333c87[_0x2e43('0x76')],[_0x2e43('0x29'),'description']),null))['then'](respondWithResult(_0x53909f,null))[_0x2e43('0x46')](handleError(_0x53909f,null));};exports[_0x2e43('0x7d')]=function(_0x478091,_0x3b3253,_0x4aa513){return db[_0x2e43('0x2d')][_0x2e43('0x4b')]({'where':{'id':_0x478091[_0x2e43('0x48')]['id']}})[_0x2e43('0x23')](function(_0x3a75ba){if(_0x3a75ba){return _0x3a75ba[_0x2e43('0x24')]();}})['then'](function(_0x405a7c){var _0xfffa88=path['join'](config['root'],'server/files/sounds/original',util[_0x2e43('0x56')](_0x2e43('0x55'),_0x405a7c[_0x2e43('0x4d')],_0x405a7c['original_format']));var _0x57e915=path['join'](config[_0x2e43('0x51')],_0x2e43('0x52'),util[_0x2e43('0x56')](_0x2e43('0x55'),_0x405a7c[_0x2e43('0x4d')],_0x405a7c[_0x2e43('0x4e')]));fs[_0x2e43('0x66')](_0xfffa88);fs[_0x2e43('0x66')](_0x57e915);return _0x405a7c;})[_0x2e43('0x23')](function(_0x1f8e7d){if(_0x1f8e7d){return _0x3b3253[_0x2e43('0x18')](0xcc)[_0x2e43('0x26')]();}})[_0x2e43('0x23')](handleEntityNotFound(_0x3b3253,null))['catch'](handleError(_0x3b3253,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5bdb003..1799ee0 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 _0x8194=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8194,0x102));var _0x4819=function(_0x50b658,_0xd3077f){_0x50b658=_0x50b658-0x0;var _0x484d1d=_0x8194[_0x50b658];return _0x484d1d;};'use strict';var _=require(_0x4819('0x0'));var util=require(_0x4819('0x1'));var logger=require('../../config/logger')(_0x4819('0x2'));var moment=require(_0x4819('0x3'));var BPromise=require('bluebird');var rp=require(_0x4819('0x4'));var fs=require('fs');var path=require(_0x4819('0x5'));var rimraf=require(_0x4819('0x6'));var config=require(_0x4819('0x7'));var attributes=require(_0x4819('0x8'));module[_0x4819('0x9')]=function(_0x574860,_0x584ed4){return _0x574860[_0x4819('0xa')](_0x4819('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48eb=['api','moment','request-promise','path','rimraf','./sound.attributes','exports','lodash','util','../../config/logger'];(function(_0x1c84e5,_0x95c96){var _0x3b12c0=function(_0x3bf4cc){while(--_0x3bf4cc){_0x1c84e5['push'](_0x1c84e5['shift']());}};_0x3b12c0(++_0x95c96);}(_0x48eb,0x6b));var _0xb48e=function(_0x127675,_0x38abf6){_0x127675=_0x127675-0x0;var _0x13a8df=_0x48eb[_0x127675];return _0x13a8df;};'use strict';var _=require(_0xb48e('0x0'));var util=require(_0xb48e('0x1'));var logger=require(_0xb48e('0x2'))(_0xb48e('0x3'));var moment=require(_0xb48e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb48e('0x5'));var fs=require('fs');var path=require(_0xb48e('0x6'));var rimraf=require(_0xb48e('0x7'));var config=require('../../config/environment');var attributes=require(_0xb48e('0x8'));module[_0xb48e('0x9')]=function(_0x40f420,_0x17775d){return _0x40f420['define']('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 31f6564..4116911 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 _0x5167=['debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info'];(function(_0x154285,_0x5a9804){var _0x21db10=function(_0x435f16){while(--_0x435f16){_0x154285['push'](_0x154285['shift']());}};_0x21db10(++_0x5a9804);}(_0x5167,0xe4));var _0x7516=function(_0x4a8642,_0x23e53e){_0x4a8642=_0x4a8642-0x0;var _0x3d02f1=_0x5167[_0x4a8642];return _0x3d02f1;};'use strict';var _=require(_0x7516('0x0'));var util=require(_0x7516('0x1'));var moment=require(_0x7516('0x2'));var BPromise=require('bluebird');var rs=require(_0x7516('0x3'));var fs=require('fs');var Redis=require(_0x7516('0x4'));var db=require(_0x7516('0x5'))['db'];var utils=require(_0x7516('0x6'));var logger=require(_0x7516('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7516('0x8'));var client=jayson['client'][_0x7516('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x231ae8,_0x166c85,_0x322ad4){return new BPromise(function(_0x2a436e,_0x15ae55){return client['request'](_0x231ae8,_0x322ad4)[_0x7516('0xa')](function(_0x5157e5){logger[_0x7516('0xb')]('Sound,\x20%s,\x20%s',_0x166c85,'request\x20sent');logger[_0x7516('0xc')](_0x7516('0xd'),_0x166c85,'request\x20sent',JSON[_0x7516('0xe')](_0x5157e5));if(_0x5157e5[_0x7516('0xf')]){if(_0x5157e5['error'][_0x7516('0x10')]===0x1f4){logger[_0x7516('0xf')](_0x7516('0x11'),_0x166c85,_0x5157e5[_0x7516('0xf')][_0x7516('0x12')]);return _0x15ae55(_0x5157e5[_0x7516('0xf')][_0x7516('0x12')]);}logger[_0x7516('0xf')](_0x7516('0x11'),_0x166c85,_0x5157e5[_0x7516('0xf')][_0x7516('0x12')]);return _0x2a436e(_0x5157e5[_0x7516('0xf')][_0x7516('0x12')]);}else{logger[_0x7516('0xb')](_0x7516('0x11'),_0x166c85,'request\x20sent');_0x2a436e(_0x5157e5[_0x7516('0x13')][_0x7516('0x12')]);}})[_0x7516('0x14')](function(_0x3f3673){logger[_0x7516('0xf')](_0x7516('0x11'),_0x166c85,_0x3f3673);_0x15ae55(_0x3f3673);});});}exports[_0x7516('0x15')]=function(_0x4f407b){var _0x554f35=this;return new Promise(function(_0x5d6429,_0xccf7a0){return db['Sound'][_0x7516('0x16')]({'raw':_0x4f407b[_0x7516('0x17')]?_0x4f407b['options'][_0x7516('0x18')]===undefined?!![]:![]:!![],'where':_0x4f407b[_0x7516('0x17')]?_0x4f407b[_0x7516('0x17')][_0x7516('0x19')]||null:null,'attributes':_0x4f407b[_0x7516('0x17')]?_0x4f407b[_0x7516('0x17')][_0x7516('0x1a')]||null:null,'include':_0x4f407b[_0x7516('0x17')]?_0x4f407b['options'][_0x7516('0x1b')]?_[_0x7516('0x1c')](_0x4f407b[_0x7516('0x17')][_0x7516('0x1b')],function(_0x24c0ca){return{'model':db[_0x24c0ca[_0x7516('0x1d')]],'as':_0x24c0ca['as'],'attributes':_0x24c0ca[_0x7516('0x1a')],'include':_0x24c0ca[_0x7516('0x1b')]?_[_0x7516('0x1c')](_0x24c0ca['include'],function(_0xa8ca2b){return{'model':db[_0xa8ca2b[_0x7516('0x1d')]],'as':_0xa8ca2b['as'],'attributes':_0xa8ca2b['attributes'],'include':_0xa8ca2b[_0x7516('0x1b')]?_[_0x7516('0x1c')](_0xa8ca2b[_0x7516('0x1b')],function(_0x131918){return{'model':db[_0x131918[_0x7516('0x1d')]],'as':_0x131918['as'],'attributes':_0x131918['attributes']};}):[]};}):[]};}):[]:[]})[_0x7516('0xa')](function(_0x3c6bb4){logger[_0x7516('0xb')]('ShowSound',_0x4f407b);logger['debug']('ShowSound',_0x4f407b,JSON[_0x7516('0xe')](_0x3c6bb4));_0x5d6429(_0x3c6bb4);})[_0x7516('0x14')](function(_0x39fbde){logger[_0x7516('0xf')](_0x7516('0x15'),_0x39fbde[_0x7516('0x12')],_0x4f407b);_0xccf7a0(_0x554f35['error'](0x1f4,_0x39fbde[_0x7516('0x12')]));});});}; \ No newline at end of file +var _0x3d7b=['http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Sound','find','options','where','attributes','include','map','model','ShowSound','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x3d7b,0x1b6));var _0xb3d7=function(_0x5edf3a,_0x27276c){_0x5edf3a=_0x5edf3a-0x0;var _0x3236f9=_0x3d7b[_0x5edf3a];return _0x3236f9;};'use strict';var _=require(_0xb3d7('0x0'));var util=require(_0xb3d7('0x1'));var moment=require('moment');var BPromise=require(_0xb3d7('0x2'));var rs=require(_0xb3d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3d7('0x4'))['db'];var utils=require(_0xb3d7('0x5'));var logger=require(_0xb3d7('0x6'))(_0xb3d7('0x7'));var config=require('../../config/environment');var jayson=require(_0xb3d7('0x8'));var client=jayson[_0xb3d7('0x9')][_0xb3d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ab7e4,_0x373426,_0x2b9d5b){return new BPromise(function(_0x5256ff,_0x32fafd){return client[_0xb3d7('0xb')](_0x5ab7e4,_0x2b9d5b)[_0xb3d7('0xc')](function(_0x2c9b83){logger[_0xb3d7('0xd')](_0xb3d7('0xe'),_0x373426,_0xb3d7('0xf'));logger['debug'](_0xb3d7('0x10'),_0x373426,_0xb3d7('0xf'),JSON[_0xb3d7('0x11')](_0x2c9b83));if(_0x2c9b83[_0xb3d7('0x12')]){if(_0x2c9b83[_0xb3d7('0x12')][_0xb3d7('0x13')]===0x1f4){logger[_0xb3d7('0x12')](_0xb3d7('0xe'),_0x373426,_0x2c9b83[_0xb3d7('0x12')][_0xb3d7('0x14')]);return _0x32fafd(_0x2c9b83[_0xb3d7('0x12')][_0xb3d7('0x14')]);}logger[_0xb3d7('0x12')](_0xb3d7('0xe'),_0x373426,_0x2c9b83[_0xb3d7('0x12')][_0xb3d7('0x14')]);return _0x5256ff(_0x2c9b83[_0xb3d7('0x12')][_0xb3d7('0x14')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x373426,_0xb3d7('0xf'));_0x5256ff(_0x2c9b83[_0xb3d7('0x15')][_0xb3d7('0x14')]);}})[_0xb3d7('0x16')](function(_0x564a3c){logger[_0xb3d7('0x12')](_0xb3d7('0xe'),_0x373426,_0x564a3c);_0x32fafd(_0x564a3c);});});}exports['ShowSound']=function(_0x517bd3){var _0x155e49=this;return new Promise(function(_0x49ca27,_0xb67b05){return db[_0xb3d7('0x17')][_0xb3d7('0x18')]({'raw':_0x517bd3[_0xb3d7('0x19')]?_0x517bd3[_0xb3d7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x517bd3[_0xb3d7('0x19')]?_0x517bd3[_0xb3d7('0x19')][_0xb3d7('0x1a')]||null:null,'attributes':_0x517bd3['options']?_0x517bd3[_0xb3d7('0x19')][_0xb3d7('0x1b')]||null:null,'include':_0x517bd3[_0xb3d7('0x19')]?_0x517bd3[_0xb3d7('0x19')][_0xb3d7('0x1c')]?_[_0xb3d7('0x1d')](_0x517bd3['options'][_0xb3d7('0x1c')],function(_0x3a1231){return{'model':db[_0x3a1231[_0xb3d7('0x1e')]],'as':_0x3a1231['as'],'attributes':_0x3a1231['attributes'],'include':_0x3a1231['include']?_[_0xb3d7('0x1d')](_0x3a1231[_0xb3d7('0x1c')],function(_0x470f34){return{'model':db[_0x470f34['model']],'as':_0x470f34['as'],'attributes':_0x470f34[_0xb3d7('0x1b')],'include':_0x470f34[_0xb3d7('0x1c')]?_[_0xb3d7('0x1d')](_0x470f34['include'],function(_0x210f3a){return{'model':db[_0x210f3a[_0xb3d7('0x1e')]],'as':_0x210f3a['as'],'attributes':_0x210f3a[_0xb3d7('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cdef9){logger['info'](_0xb3d7('0x1f'),_0x517bd3);logger['debug']('ShowSound',_0x517bd3,JSON[_0xb3d7('0x11')](_0x4cdef9));_0x49ca27(_0x4cdef9);})[_0xb3d7('0x16')](function(_0x2d80d3){logger[_0xb3d7('0x12')](_0xb3d7('0x1f'),_0x2d80d3[_0xb3d7('0x14')],_0x517bd3);_0xb67b05(_0x155e49[_0xb3d7('0x12')](0x1f4,_0x2d80d3[_0xb3d7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 70ec0d2..648ffe5 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4baded,_0x3a55fc){_0x4baded=_0x4baded-0x0;var _0x18cde4=_0x9ffd[_0x4baded];return _0x18cde4;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x201de1,_0x307d30){var _0x1bdda9=function(_0x471239){while(--_0x471239){_0x201de1['push'](_0x201de1['shift']());}};_0x1bdda9(++_0x307d30);}(_0x5eb8,0xb0));var _0x85eb=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x5eb8[_0x26fc81];return _0x9feece;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 030b832..a7f383e 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 _0xb136=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xb136,0xca));var _0x6b13=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb136[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');module[_0x6b13('0x0')]={'uniqueid':{'type':Sequelize[_0x6b13('0x1')]},'body':{'type':Sequelize[_0x6b13('0x2')](_0x6b13('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6b13('0x4')]('in',_0x6b13('0x5')),'defaultValue':_0x6b13('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7d2c=['out','TEXT','STRING','medium'];(function(_0x4c784a,_0x396c3b){var _0x4759bb=function(_0x3460f0){while(--_0x3460f0){_0x4c784a['push'](_0x4c784a['shift']());}};_0x4759bb(++_0x396c3b);}(_0x7d2c,0x1e2));var _0xc7d2=function(_0x511012,_0x5045ec){_0x511012=_0x511012-0x0;var _0x38e37f=_0x7d2c[_0x511012];return _0x38e37f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xc7d2('0x0')]},'body':{'type':Sequelize['TEXT'](_0xc7d2('0x1')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc7d2('0x2')),'defaultValue':_0xc7d2('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc7d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 3239b90..93aae75 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 _0x9db7=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','SquareMessage','fieldName','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x52a3f5,_0x138f2e){var _0x533007=function(_0x318e9f){while(--_0x318e9f){_0x52a3f5['push'](_0x52a3f5['shift']());}};_0x533007(++_0x138f2e);}(_0x9db7,0x1bf));var _0x79db=function(_0x400ff6,_0x47061a){_0x400ff6=_0x400ff6-0x0;var _0x53c296=_0x9db7[_0x400ff6];return _0x53c296;};'use strict';var emlformat=require(_0x79db('0x0'));var rimraf=require(_0x79db('0x1'));var zipdir=require(_0x79db('0x2'));var jsonpatch=require(_0x79db('0x3'));var rp=require('request-promise');var moment=require(_0x79db('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x79db('0x5'));var util=require(_0x79db('0x6'));var path=require('path');var sox=require(_0x79db('0x7'));var csv=require(_0x79db('0x8'));var ejs=require(_0x79db('0x9'));var fs=require('fs');var fs_extra=require(_0x79db('0xa'));var _=require(_0x79db('0xb'));var squel=require(_0x79db('0xc'));var crypto=require(_0x79db('0xd'));var jsforce=require(_0x79db('0xe'));var deskjs=require(_0x79db('0xf'));var toCsv=require(_0x79db('0x8'));var querystring=require(_0x79db('0x10'));var Papa=require(_0x79db('0x11'));var Redis=require('ioredis');var authService=require(_0x79db('0x12'));var qs=require(_0x79db('0x13'));var as=require(_0x79db('0x14'));var hardwareService=require(_0x79db('0x15'));var logger=require(_0x79db('0x16'))(_0x79db('0x17'));var utils=require(_0x79db('0x18'));var config=require(_0x79db('0x19'));var licenseUtil=require(_0x79db('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51e061,_0x49b16c){_0x49b16c=_0x49b16c||0xcc;return function(_0x308f84){if(_0x308f84){return _0x51e061['sendStatus'](_0x49b16c);}return _0x51e061[_0x79db('0x1b')](_0x49b16c)['end']();};}function respondWithResult(_0x472f26,_0x2387d7){_0x2387d7=_0x2387d7||0xc8;return function(_0x9262ee){if(_0x9262ee){return _0x472f26[_0x79db('0x1b')](_0x2387d7)[_0x79db('0x1c')](_0x9262ee);}};}function respondWithFilteredResult(_0x3a5667,_0x52acc5){return function(_0x495ec8){if(_0x495ec8){var _0xa1cc87=typeof _0x52acc5[_0x79db('0x1d')]===_0x79db('0x1e')&&typeof _0x52acc5[_0x79db('0x1f')]===_0x79db('0x1e');var _0x4a9f30=_0x495ec8[_0x79db('0x20')];var _0x43912f=_0xa1cc87?0x0:_0x52acc5[_0x79db('0x1d')];var _0x77f6d0=_0xa1cc87?_0x495ec8[_0x79db('0x20')]:_0x52acc5['offset']+_0x52acc5[_0x79db('0x1f')];var _0xc6038c;if(_0x77f6d0>=_0x4a9f30){_0x77f6d0=_0x4a9f30;_0xc6038c=0xc8;}else{_0xc6038c=0xce;}_0x3a5667['status'](_0xc6038c);return _0x3a5667[_0x79db('0x21')](_0x79db('0x22'),_0x43912f+'-'+_0x77f6d0+'/'+_0x4a9f30)['json'](_0x495ec8);}return null;};}function patchUpdates(_0x40676e){return function(_0x3be8e0){try{jsonpatch[_0x79db('0x23')](_0x3be8e0,_0x40676e,!![]);}catch(_0x2d58fe){return BPromise[_0x79db('0x24')](_0x2d58fe);}return _0x3be8e0[_0x79db('0x25')]();};}function saveUpdates(_0x1f48ff,_0x150a6d){return function(_0x3b3ad9){if(_0x3b3ad9){return _0x3b3ad9[_0x79db('0x26')](_0x1f48ff)[_0x79db('0x27')](function(_0x252479){return _0x252479;});}return null;};}function removeEntity(_0x21feec,_0x25a360){return function(_0x319888){if(_0x319888){return _0x319888['destroy']()[_0x79db('0x27')](function(){_0x21feec[_0x79db('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dfa54,_0x3d9fb4){return function(_0x459652){if(!_0x459652){_0x4dfa54[_0x79db('0x28')](0x194);}return _0x459652;};}function handleError(_0x1409c2,_0x3ac231){_0x3ac231=_0x3ac231||0x1f4;return function(_0x3def02){logger[_0x79db('0x29')](_0x3def02[_0x79db('0x2a')]);if(_0x3def02[_0x79db('0x2b')]){delete _0x3def02[_0x79db('0x2b')];}_0x1409c2[_0x79db('0x1b')](_0x3ac231)['send'](_0x3def02);};}exports[_0x79db('0x2c')]=function(_0x5756b1,_0x5de0b7){var _0x25878c={},_0x45bd26={},_0x5d79cb={'count':0x0,'rows':[]};var _0x320276=_[_0x79db('0x2d')](db[_0x79db('0x2e')]['rawAttributes'],function(_0x1f25b7){return{'name':_0x1f25b7[_0x79db('0x2f')],'type':_0x1f25b7['type'][_0x79db('0x30')]};});_0x45bd26[_0x79db('0x31')]=_[_0x79db('0x2d')](_0x320276,_0x79db('0x2b'));_0x45bd26['query']=_[_0x79db('0x32')](_0x5756b1['query']);_0x45bd26[_0x79db('0x33')]=_['intersection'](_0x45bd26[_0x79db('0x31')],_0x45bd26[_0x79db('0x34')]);_0x25878c['attributes']=_[_0x79db('0x35')](_0x45bd26[_0x79db('0x31')],qs[_0x79db('0x36')](_0x5756b1[_0x79db('0x34')][_0x79db('0x36')]));_0x25878c[_0x79db('0x37')]=_0x25878c[_0x79db('0x37')][_0x79db('0x38')]?_0x25878c['attributes']:_0x45bd26[_0x79db('0x31')];if(!_0x5756b1['query']['hasOwnProperty'](_0x79db('0x39'))){_0x25878c[_0x79db('0x1f')]=qs[_0x79db('0x1f')](_0x5756b1[_0x79db('0x34')][_0x79db('0x1f')]);_0x25878c[_0x79db('0x1d')]=qs['offset'](_0x5756b1['query'][_0x79db('0x1d')]);}_0x25878c[_0x79db('0x3a')]=qs[_0x79db('0x3b')](_0x5756b1['query'][_0x79db('0x3b')]);_0x25878c['where']=qs[_0x79db('0x33')](_[_0x79db('0x3c')](_0x5756b1[_0x79db('0x34')],_0x45bd26[_0x79db('0x33')]),_0x320276);if(_0x5756b1[_0x79db('0x34')][_0x79db('0x3d')]){_0x25878c[_0x79db('0x3e')]=_[_0x79db('0x3f')](_0x25878c[_0x79db('0x3e')],{'$or':_[_0x79db('0x2d')](_0x320276,function(_0x1e6649){if(_0x1e6649[_0x79db('0x40')]!==_0x79db('0x41')){var _0x3b1cd4={};_0x3b1cd4[_0x1e6649[_0x79db('0x2b')]]={'$like':'%'+_0x5756b1[_0x79db('0x34')][_0x79db('0x3d')]+'%'};return _0x3b1cd4;}})});}_0x25878c=_[_0x79db('0x3f')]({},_0x25878c,_0x5756b1[_0x79db('0x42')]);var _0x1232d4={'where':_0x25878c['where']};return db[_0x79db('0x2e')][_0x79db('0x20')](_0x1232d4)[_0x79db('0x27')](function(_0x244dec){_0x5d79cb[_0x79db('0x20')]=_0x244dec;if(_0x5756b1[_0x79db('0x34')][_0x79db('0x43')]){_0x25878c[_0x79db('0x44')]=[{'all':!![]}];}return db[_0x79db('0x2e')]['findAll'](_0x25878c);})[_0x79db('0x27')](function(_0x5b7587){_0x5d79cb[_0x79db('0x45')]=_0x5b7587;return _0x5d79cb;})[_0x79db('0x27')](respondWithFilteredResult(_0x5de0b7,_0x25878c))['catch'](handleError(_0x5de0b7,null));};exports[_0x79db('0x46')]=function(_0x49f040,_0x1090d5){var _0x5e0896={'raw':!![],'where':{'id':_0x49f040['params']['id']}},_0x23d3c0={};_0x23d3c0[_0x79db('0x31')]=_['keys'](db[_0x79db('0x2e')][_0x79db('0x47')]);_0x23d3c0[_0x79db('0x34')]=_[_0x79db('0x32')](_0x49f040[_0x79db('0x34')]);_0x23d3c0[_0x79db('0x33')]=_['intersection'](_0x23d3c0[_0x79db('0x31')],_0x23d3c0[_0x79db('0x34')]);_0x5e0896[_0x79db('0x37')]=_[_0x79db('0x35')](_0x23d3c0[_0x79db('0x31')],qs[_0x79db('0x36')](_0x49f040[_0x79db('0x34')]['fields']));_0x5e0896[_0x79db('0x37')]=_0x5e0896['attributes'][_0x79db('0x38')]?_0x5e0896[_0x79db('0x37')]:_0x23d3c0[_0x79db('0x31')];if(_0x49f040['query'][_0x79db('0x43')]){_0x5e0896[_0x79db('0x44')]=[{'all':!![]}];}_0x5e0896=_['merge']({},_0x5e0896,_0x49f040[_0x79db('0x42')]);return db[_0x79db('0x2e')][_0x79db('0x48')](_0x5e0896)['then'](handleEntityNotFound(_0x1090d5,null))[_0x79db('0x27')](respondWithResult(_0x1090d5,null))[_0x79db('0x49')](handleError(_0x1090d5,null));};exports['create']=function(_0x348d90,_0x33704d){return db[_0x79db('0x2e')][_0x79db('0x4a')](_0x348d90[_0x79db('0x4b')],{})[_0x79db('0x27')](respondWithResult(_0x33704d,0xc9))[_0x79db('0x49')](handleError(_0x33704d,null));};exports[_0x79db('0x26')]=function(_0x9515fc,_0x430c56){if(_0x9515fc[_0x79db('0x4b')]['id']){delete _0x9515fc[_0x79db('0x4b')]['id'];}return db[_0x79db('0x2e')][_0x79db('0x48')]({'where':{'id':_0x9515fc[_0x79db('0x4c')]['id']}})[_0x79db('0x27')](handleEntityNotFound(_0x430c56,null))[_0x79db('0x27')](saveUpdates(_0x9515fc['body'],null))['then'](respondWithResult(_0x430c56,null))['catch'](handleError(_0x430c56,null));};exports[_0x79db('0x4d')]=function(_0x2a16f9,_0x180c9b){return db[_0x79db('0x2e')]['find']({'where':{'id':_0x2a16f9[_0x79db('0x4c')]['id']}})[_0x79db('0x27')](handleEntityNotFound(_0x180c9b,null))[_0x79db('0x27')](removeEntity(_0x180c9b,null))[_0x79db('0x49')](handleError(_0x180c9b,null));}; \ No newline at end of file +var _0x71ee=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','findAll','rows','params','include','find','catch','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection'];(function(_0x3787a3,_0x16810e){var _0x37ef57=function(_0x58415e){while(--_0x58415e){_0x3787a3['push'](_0x3787a3['shift']());}};_0x37ef57(++_0x16810e);}(_0x71ee,0x1cb));var _0xe71e=function(_0x5a56cc,_0x29650c){_0x5a56cc=_0x5a56cc-0x0;var _0x589caa=_0x71ee[_0x5a56cc];return _0x589caa;};'use strict';var emlformat=require(_0xe71e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe71e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe71e('0x2'));var moment=require(_0xe71e('0x3'));var BPromise=require(_0xe71e('0x4'));var Mustache=require('mustache');var util=require(_0xe71e('0x5'));var path=require(_0xe71e('0x6'));var sox=require(_0xe71e('0x7'));var csv=require(_0xe71e('0x8'));var ejs=require(_0xe71e('0x9'));var fs=require('fs');var fs_extra=require(_0xe71e('0xa'));var _=require('lodash');var squel=require(_0xe71e('0xb'));var crypto=require('crypto');var jsforce=require(_0xe71e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe71e('0xd'));var Papa=require(_0xe71e('0xe'));var Redis=require(_0xe71e('0xf'));var authService=require(_0xe71e('0x10'));var qs=require(_0xe71e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe71e('0x12'));var logger=require(_0xe71e('0x13'))(_0xe71e('0x14'));var utils=require('../../config/utils');var config=require(_0xe71e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fadf4,_0x5bcbea){_0x5bcbea=_0x5bcbea||0xcc;return function(_0x1342f8){if(_0x1342f8){return _0x4fadf4[_0xe71e('0x16')](_0x5bcbea);}return _0x4fadf4['status'](_0x5bcbea)[_0xe71e('0x17')]();};}function respondWithResult(_0x3cca57,_0x191cca){_0x191cca=_0x191cca||0xc8;return function(_0xdca6b7){if(_0xdca6b7){return _0x3cca57[_0xe71e('0x18')](_0x191cca)[_0xe71e('0x19')](_0xdca6b7);}};}function respondWithFilteredResult(_0x17218f,_0x415d86){return function(_0x29e2aa){if(_0x29e2aa){var _0x28d0d4=typeof _0x415d86['offset']===_0xe71e('0x1a')&&typeof _0x415d86[_0xe71e('0x1b')]===_0xe71e('0x1a');var _0xfefb81=_0x29e2aa[_0xe71e('0x1c')];var _0x1c004a=_0x28d0d4?0x0:_0x415d86['offset'];var _0x48937f=_0x28d0d4?_0x29e2aa[_0xe71e('0x1c')]:_0x415d86[_0xe71e('0x1d')]+_0x415d86[_0xe71e('0x1b')];var _0x53a716;if(_0x48937f>=_0xfefb81){_0x48937f=_0xfefb81;_0x53a716=0xc8;}else{_0x53a716=0xce;}_0x17218f['status'](_0x53a716);return _0x17218f[_0xe71e('0x1e')](_0xe71e('0x1f'),_0x1c004a+'-'+_0x48937f+'/'+_0xfefb81)[_0xe71e('0x19')](_0x29e2aa);}return null;};}function patchUpdates(_0x30c148){return function(_0x39ebeb){try{jsonpatch[_0xe71e('0x20')](_0x39ebeb,_0x30c148,!![]);}catch(_0x21aea6){return BPromise[_0xe71e('0x21')](_0x21aea6);}return _0x39ebeb[_0xe71e('0x22')]();};}function saveUpdates(_0x2e5fac,_0x268665){return function(_0x1f2e7c){if(_0x1f2e7c){return _0x1f2e7c['update'](_0x2e5fac)['then'](function(_0x18d0bd){return _0x18d0bd;});}return null;};}function removeEntity(_0x10d256,_0x16d50b){return function(_0x2091b4){if(_0x2091b4){return _0x2091b4[_0xe71e('0x23')]()[_0xe71e('0x24')](function(){_0x10d256['status'](0xcc)[_0xe71e('0x17')]();});}};}function handleEntityNotFound(_0x6b64e6,_0x38b784){return function(_0x189c9c){if(!_0x189c9c){_0x6b64e6[_0xe71e('0x16')](0x194);}return _0x189c9c;};}function handleError(_0x311b04,_0x287e2f){_0x287e2f=_0x287e2f||0x1f4;return function(_0x4508b7){logger[_0xe71e('0x25')](_0x4508b7['stack']);if(_0x4508b7['name']){delete _0x4508b7['name'];}_0x311b04['status'](_0x287e2f)[_0xe71e('0x26')](_0x4508b7);};}exports[_0xe71e('0x27')]=function(_0x1e3f56,_0x1161b2){var _0x462e38={},_0xac32c2={},_0x30ba8b={'count':0x0,'rows':[]};var _0x2472a9=_['map'](db[_0xe71e('0x28')][_0xe71e('0x29')],function(_0x1b0c4b){return{'name':_0x1b0c4b[_0xe71e('0x2a')],'type':_0x1b0c4b[_0xe71e('0x2b')][_0xe71e('0x2c')]};});_0xac32c2[_0xe71e('0x2d')]=_[_0xe71e('0x2e')](_0x2472a9,_0xe71e('0x2f'));_0xac32c2[_0xe71e('0x30')]=_[_0xe71e('0x31')](_0x1e3f56['query']);_0xac32c2[_0xe71e('0x32')]=_[_0xe71e('0x33')](_0xac32c2['model'],_0xac32c2[_0xe71e('0x30')]);_0x462e38[_0xe71e('0x34')]=_[_0xe71e('0x33')](_0xac32c2['model'],qs[_0xe71e('0x35')](_0x1e3f56[_0xe71e('0x30')][_0xe71e('0x35')]));_0x462e38['attributes']=_0x462e38[_0xe71e('0x34')][_0xe71e('0x36')]?_0x462e38['attributes']:_0xac32c2[_0xe71e('0x2d')];if(!_0x1e3f56[_0xe71e('0x30')][_0xe71e('0x37')](_0xe71e('0x38'))){_0x462e38[_0xe71e('0x1b')]=qs[_0xe71e('0x1b')](_0x1e3f56[_0xe71e('0x30')][_0xe71e('0x1b')]);_0x462e38[_0xe71e('0x1d')]=qs[_0xe71e('0x1d')](_0x1e3f56[_0xe71e('0x30')]['offset']);}_0x462e38[_0xe71e('0x39')]=qs[_0xe71e('0x3a')](_0x1e3f56[_0xe71e('0x30')]['sort']);_0x462e38['where']=qs[_0xe71e('0x32')](_['pick'](_0x1e3f56[_0xe71e('0x30')],_0xac32c2[_0xe71e('0x32')]),_0x2472a9);if(_0x1e3f56[_0xe71e('0x30')]['filter']){_0x462e38['where']=_[_0xe71e('0x3b')](_0x462e38[_0xe71e('0x3c')],{'$or':_[_0xe71e('0x2e')](_0x2472a9,function(_0x485886){if(_0x485886['type']!==_0xe71e('0x3d')){var _0x4092a8={};_0x4092a8[_0x485886[_0xe71e('0x2f')]]={'$like':'%'+_0x1e3f56[_0xe71e('0x30')][_0xe71e('0x3e')]+'%'};return _0x4092a8;}})});}_0x462e38=_[_0xe71e('0x3b')]({},_0x462e38,_0x1e3f56[_0xe71e('0x3f')]);var _0x2fb5a1={'where':_0x462e38[_0xe71e('0x3c')]};return db['SquareMessage'][_0xe71e('0x1c')](_0x2fb5a1)[_0xe71e('0x24')](function(_0x3c4866){_0x30ba8b['count']=_0x3c4866;if(_0x1e3f56[_0xe71e('0x30')]['includeAll']){_0x462e38['include']=[{'all':!![]}];}return db[_0xe71e('0x28')][_0xe71e('0x40')](_0x462e38);})[_0xe71e('0x24')](function(_0x32e5df){_0x30ba8b[_0xe71e('0x41')]=_0x32e5df;return _0x30ba8b;})['then'](respondWithFilteredResult(_0x1161b2,_0x462e38))['catch'](handleError(_0x1161b2,null));};exports['show']=function(_0x154ec8,_0x5705d1){var _0xb8d305={'raw':!![],'where':{'id':_0x154ec8[_0xe71e('0x42')]['id']}},_0x12e6b0={};_0x12e6b0['model']=_['keys'](db[_0xe71e('0x28')][_0xe71e('0x29')]);_0x12e6b0[_0xe71e('0x30')]=_['keys'](_0x154ec8[_0xe71e('0x30')]);_0x12e6b0[_0xe71e('0x32')]=_['intersection'](_0x12e6b0[_0xe71e('0x2d')],_0x12e6b0['query']);_0xb8d305['attributes']=_[_0xe71e('0x33')](_0x12e6b0[_0xe71e('0x2d')],qs[_0xe71e('0x35')](_0x154ec8[_0xe71e('0x30')][_0xe71e('0x35')]));_0xb8d305[_0xe71e('0x34')]=_0xb8d305['attributes'][_0xe71e('0x36')]?_0xb8d305[_0xe71e('0x34')]:_0x12e6b0[_0xe71e('0x2d')];if(_0x154ec8['query']['includeAll']){_0xb8d305[_0xe71e('0x43')]=[{'all':!![]}];}_0xb8d305=_['merge']({},_0xb8d305,_0x154ec8[_0xe71e('0x3f')]);return db[_0xe71e('0x28')][_0xe71e('0x44')](_0xb8d305)['then'](handleEntityNotFound(_0x5705d1,null))['then'](respondWithResult(_0x5705d1,null))[_0xe71e('0x45')](handleError(_0x5705d1,null));};exports[_0xe71e('0x46')]=function(_0x443b8c,_0x314a60){return db[_0xe71e('0x28')][_0xe71e('0x46')](_0x443b8c[_0xe71e('0x47')],{})[_0xe71e('0x24')](respondWithResult(_0x314a60,0xc9))[_0xe71e('0x45')](handleError(_0x314a60,null));};exports[_0xe71e('0x48')]=function(_0x15a5fa,_0x1a5bd6){if(_0x15a5fa[_0xe71e('0x47')]['id']){delete _0x15a5fa[_0xe71e('0x47')]['id'];}return db[_0xe71e('0x28')][_0xe71e('0x44')]({'where':{'id':_0x15a5fa[_0xe71e('0x42')]['id']}})[_0xe71e('0x24')](handleEntityNotFound(_0x1a5bd6,null))[_0xe71e('0x24')](saveUpdates(_0x15a5fa[_0xe71e('0x47')],null))[_0xe71e('0x24')](respondWithResult(_0x1a5bd6,null))[_0xe71e('0x45')](handleError(_0x1a5bd6,null));};exports[_0xe71e('0x23')]=function(_0x2bb603,_0x1b5d97){return db['SquareMessage'][_0xe71e('0x44')]({'where':{'id':_0x2bb603[_0xe71e('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b5d97,null))[_0xe71e('0x24')](removeEntity(_0x1b5d97,null))['catch'](handleError(_0x1b5d97,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3f1c390..be63f83 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 _0x82b5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x12ac92,_0x5e2765){var _0x3427f4=function(_0x5051e2){while(--_0x5051e2){_0x12ac92['push'](_0x12ac92['shift']());}};_0x3427f4(++_0x5e2765);}(_0x82b5,0xb4));var _0x582b=function(_0x335b25,_0x3b723c){_0x335b25=_0x335b25-0x0;var _0x342e4d=_0x82b5[_0x335b25];return _0x342e4d;};'use strict';var _=require('lodash');var util=require(_0x582b('0x0'));var logger=require(_0x582b('0x1'))(_0x582b('0x2'));var moment=require(_0x582b('0x3'));var BPromise=require(_0x582b('0x4'));var rp=require(_0x582b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x582b('0x6'));var config=require('../../config/environment');var attributes=require(_0x582b('0x7'));module[_0x582b('0x8')]=function(_0x12b65e,_0x282d8a){return _0x12b65e[_0x582b('0x9')](_0x582b('0xa'),attributes,{'tableName':_0x582b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe30f=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xe30f,0xb4));var _0xfe30=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe30f[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xfe30('0x0'));var util=require(_0xfe30('0x1'));var logger=require(_0xfe30('0x2'))(_0xfe30('0x3'));var moment=require('moment');var BPromise=require(_0xfe30('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe30('0x5'));var rimraf=require(_0xfe30('0x6'));var config=require(_0xfe30('0x7'));var attributes=require(_0xfe30('0x8'));module[_0xfe30('0x9')]=function(_0x323178,_0x44e2a8){return _0x323178[_0xfe30('0xa')](_0xfe30('0xb'),attributes,{'tableName':_0xfe30('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 0977d04..6b9fd75 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 _0x5946=['create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x1ed406,_0x3b3184){var _0x359b38=function(_0x35dc97){while(--_0x35dc97){_0x1ed406['push'](_0x1ed406['shift']());}};_0x359b38(++_0x3b3184);}(_0x5946,0x18c));var _0x6594=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x5946[_0x297eea];return _0x1c42d2;};'use strict';var _=require(_0x6594('0x0'));var util=require(_0x6594('0x1'));var moment=require(_0x6594('0x2'));var BPromise=require(_0x6594('0x3'));var rs=require(_0x6594('0x4'));var fs=require('fs');var Redis=require(_0x6594('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6594('0x6'));var logger=require(_0x6594('0x7'))(_0x6594('0x8'));var config=require(_0x6594('0x9'));var jayson=require(_0x6594('0xa'));var client=jayson[_0x6594('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36fb25,_0x3f373c,_0x54a5e2){return new BPromise(function(_0x17ae67,_0x4c6da4){return client[_0x6594('0xc')](_0x36fb25,_0x54a5e2)['then'](function(_0x52e3d8){logger['info'](_0x6594('0xd'),_0x3f373c,_0x6594('0xe'));logger[_0x6594('0xf')](_0x6594('0x10'),_0x3f373c,_0x6594('0xe'),JSON['stringify'](_0x52e3d8));if(_0x52e3d8['error']){if(_0x52e3d8[_0x6594('0x11')]['code']===0x1f4){logger[_0x6594('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3f373c,_0x52e3d8['error'][_0x6594('0x12')]);return _0x4c6da4(_0x52e3d8['error'][_0x6594('0x12')]);}logger['error'](_0x6594('0xd'),_0x3f373c,_0x52e3d8[_0x6594('0x11')][_0x6594('0x12')]);return _0x17ae67(_0x52e3d8[_0x6594('0x11')]['message']);}else{logger[_0x6594('0x13')](_0x6594('0xd'),_0x3f373c,_0x6594('0xe'));_0x17ae67(_0x52e3d8[_0x6594('0x14')]['message']);}})[_0x6594('0x15')](function(_0x457fa1){logger[_0x6594('0x11')](_0x6594('0xd'),_0x3f373c,_0x457fa1);_0x4c6da4(_0x457fa1);});});}exports[_0x6594('0x16')]=function(_0x678fe0){var _0x56ee5c=this;return new Promise(function(_0x2e6994,_0x24e6fd){return db[_0x6594('0x17')][_0x6594('0x18')](_0x678fe0[_0x6594('0x19')],{'raw':_0x678fe0[_0x6594('0x1a')]?_0x678fe0[_0x6594('0x1a')][_0x6594('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4bbbd0){logger[_0x6594('0x13')](_0x6594('0x16'),_0x678fe0);logger[_0x6594('0xf')](_0x6594('0x16'),_0x678fe0,JSON['stringify'](_0x4bbbd0));_0x2e6994(_0x4bbbd0);})[_0x6594('0x15')](function(_0xa44dc7){logger[_0x6594('0x11')](_0x6594('0x16'),_0xa44dc7['message'],_0x678fe0);_0x24e6fd(_0x56ee5c[_0x6594('0x11')](0x1f4,_0xa44dc7[_0x6594('0x12')]));});});}; \ No newline at end of file +var _0x7b4a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','options','raw','CreateSquareMessage','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x3f7094,_0x4297eb){var _0x4bbedc=function(_0x422c01){while(--_0x422c01){_0x3f7094['push'](_0x3f7094['shift']());}};_0x4bbedc(++_0x4297eb);}(_0x7b4a,0x13f));var _0xa7b4=function(_0x5673f2,_0x74fc53){_0x5673f2=_0x5673f2-0x0;var _0x1d457d=_0x7b4a[_0x5673f2];return _0x1d457d;};'use strict';var _=require(_0xa7b4('0x0'));var util=require(_0xa7b4('0x1'));var moment=require(_0xa7b4('0x2'));var BPromise=require(_0xa7b4('0x3'));var rs=require(_0xa7b4('0x4'));var fs=require('fs');var Redis=require(_0xa7b4('0x5'));var db=require(_0xa7b4('0x6'))['db'];var utils=require(_0xa7b4('0x7'));var logger=require(_0xa7b4('0x8'))('rpc');var config=require(_0xa7b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa7b4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50f135,_0xe6c030,_0x1e5f2d){return new BPromise(function(_0x52492c,_0x11d3a0){return client['request'](_0x50f135,_0x1e5f2d)[_0xa7b4('0xb')](function(_0x3df5bd){logger[_0xa7b4('0xc')](_0xa7b4('0xd'),_0xe6c030,_0xa7b4('0xe'));logger[_0xa7b4('0xf')](_0xa7b4('0x10'),_0xe6c030,'request\x20sent',JSON['stringify'](_0x3df5bd));if(_0x3df5bd[_0xa7b4('0x11')]){if(_0x3df5bd[_0xa7b4('0x11')][_0xa7b4('0x12')]===0x1f4){logger[_0xa7b4('0x11')](_0xa7b4('0xd'),_0xe6c030,_0x3df5bd[_0xa7b4('0x11')][_0xa7b4('0x13')]);return _0x11d3a0(_0x3df5bd[_0xa7b4('0x11')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0xe6c030,_0x3df5bd[_0xa7b4('0x11')][_0xa7b4('0x13')]);return _0x52492c(_0x3df5bd[_0xa7b4('0x11')][_0xa7b4('0x13')]);}else{logger[_0xa7b4('0xc')](_0xa7b4('0xd'),_0xe6c030,_0xa7b4('0xe'));_0x52492c(_0x3df5bd[_0xa7b4('0x14')]['message']);}})[_0xa7b4('0x15')](function(_0x5c1ad4){logger[_0xa7b4('0x11')]('SquareMessage,\x20%s,\x20%s',_0xe6c030,_0x5c1ad4);_0x11d3a0(_0x5c1ad4);});});}exports['CreateSquareMessage']=function(_0x12f15c){var _0x11925e=this;return new Promise(function(_0x43b4c2,_0x1dd84f){return db['SquareMessage'][_0xa7b4('0x16')](_0x12f15c['body'],{'raw':_0x12f15c[_0xa7b4('0x17')]?_0x12f15c[_0xa7b4('0x17')][_0xa7b4('0x18')]===undefined?!![]:![]:!![]})[_0xa7b4('0xb')](function(_0x264e85){logger['info'](_0xa7b4('0x19'),_0x12f15c);logger[_0xa7b4('0xf')]('CreateSquareMessage',_0x12f15c,JSON[_0xa7b4('0x1a')](_0x264e85));_0x43b4c2(_0x264e85);})[_0xa7b4('0x15')](function(_0x324c90){logger[_0xa7b4('0x11')]('CreateSquareMessage',_0x324c90[_0xa7b4('0x13')],_0x12f15c);_0x1dd84f(_0x11925e[_0xa7b4('0x11')](0x1f4,_0x324c90[_0xa7b4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f8b350d..0a84e31 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 _0x28c1=['isAuthenticated','index','show','15s','test','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','./squareOdbc.controller','get'];(function(_0x442a7c,_0x498ef0){var _0x4adb57=function(_0x413044){while(--_0x413044){_0x442a7c['push'](_0x442a7c['shift']());}};_0x4adb57(++_0x498ef0);}(_0x28c1,0xad));var _0x128c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x28c1[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x128c('0x0'));var util=require('util');var path=require(_0x128c('0x1'));var timeout=require(_0x128c('0x2'));var express=require(_0x128c('0x3'));var router=express['Router']();var fs_extra=require(_0x128c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x128c('0x5'));router[_0x128c('0x6')]('/',auth[_0x128c('0x7')](),controller[_0x128c('0x8')]);router[_0x128c('0x6')]('/:id',auth[_0x128c('0x7')](),controller[_0x128c('0x9')]);router[_0x128c('0x6')]('/:id/test',auth[_0x128c('0x7')](),timeout(_0x128c('0xa')),controller[_0x128c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x128c('0x7')](),controller[_0x128c('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x128c('0xd')]);module[_0x128c('0xe')]=router; \ No newline at end of file +var _0xcdd3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','test','create','/:id','delete','destroy','util','path','express','Router','fs-extra'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xcdd3,0x163));var _0x3cdd=function(_0x2b2c9a,_0x325982){_0x2b2c9a=_0x2b2c9a-0x0;var _0x100b55=_0xcdd3[_0x2b2c9a];return _0x100b55;};'use strict';var multer=require('multer');var util=require(_0x3cdd('0x0'));var path=require(_0x3cdd('0x1'));var timeout=require('connect-timeout');var express=require(_0x3cdd('0x2'));var router=express[_0x3cdd('0x3')]();var fs_extra=require(_0x3cdd('0x4'));var auth=require(_0x3cdd('0x5'));var interaction=require(_0x3cdd('0x6'));var config=require(_0x3cdd('0x7'));var controller=require(_0x3cdd('0x8'));router[_0x3cdd('0x9')]('/',auth[_0x3cdd('0xa')](),controller[_0x3cdd('0xb')]);router[_0x3cdd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3cdd('0xc')]);router[_0x3cdd('0x9')]('/:id/test',auth[_0x3cdd('0xa')](),timeout('15s'),controller[_0x3cdd('0xd')]);router['post']('/',auth[_0x3cdd('0xa')](),controller[_0x3cdd('0xe')]);router['put'](_0x3cdd('0xf'),auth[_0x3cdd('0xa')](),controller['update']);router[_0x3cdd('0x10')](_0x3cdd('0xf'),auth['isAuthenticated'](),controller[_0x3cdd('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f218de1..8cde684 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 _0x69f4=['exports','STRING','sequelize'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x69f4,0x137));var _0x469f=function(_0x745b9c,_0x1cb622){_0x745b9c=_0x745b9c-0x0;var _0x122115=_0x69f4[_0x745b9c];return _0x122115;};'use strict';var Sequelize=require(_0x469f('0x0'));module[_0x469f('0x1')]={'name':{'type':Sequelize[_0x469f('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x469f('0x2')]},'description':{'type':Sequelize[_0x469f('0x2')]}}; \ No newline at end of file +var _0x780f=['STRING','name','exports'];(function(_0x7fb279,_0x4e333a){var _0x4344de=function(_0x25c483){while(--_0x25c483){_0x7fb279['push'](_0x7fb279['shift']());}};_0x4344de(++_0x4e333a);}(_0x780f,0xe3));var _0xf780=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x780f[_0x54d49e];return _0x4af0f1;};'use strict';var Sequelize=require('sequelize');module[_0xf780('0x0')]={'name':{'type':Sequelize[_0xf780('0x1')],'unique':_0xf780('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf780('0x1')]},'description':{'type':Sequelize[_0xf780('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2881163..b001862 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 _0xdbc9=['filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','SquareOdbc','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','test','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','status','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','ODBC','UserProfileResource','end','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0x2ccbca,_0x3c9574){var _0x26825f=function(_0x41aea2){while(--_0x41aea2){_0x2ccbca['push'](_0x2ccbca['shift']());}};_0x26825f(++_0x3c9574);}(_0xdbc9,0x166));var _0x9dbc=function(_0xd6f16,_0x4195d9){_0xd6f16=_0xd6f16-0x0;var _0x98646b=_0xdbc9[_0xd6f16];return _0x98646b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dbc('0x1'));var rp=require('request-promise');var moment=require(_0x9dbc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9dbc('0x3'));var util=require(_0x9dbc('0x4'));var path=require(_0x9dbc('0x5'));var sox=require('sox');var csv=require(_0x9dbc('0x6'));var ejs=require(_0x9dbc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dbc('0x8'));var crypto=require(_0x9dbc('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9dbc('0xa'));var toCsv=require(_0x9dbc('0x6'));var querystring=require(_0x9dbc('0xb'));var Papa=require(_0x9dbc('0xc'));var Redis=require(_0x9dbc('0xd'));var authService=require(_0x9dbc('0xe'));var qs=require(_0x9dbc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dbc('0x10'));var logger=require('../../config/logger')(_0x9dbc('0x11'));var utils=require(_0x9dbc('0x12'));var config=require(_0x9dbc('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37d066,_0x14e0d9){_0x14e0d9=_0x14e0d9||0xcc;return function(_0x34f944){if(_0x34f944){return _0x37d066['sendStatus'](_0x14e0d9);}return _0x37d066['status'](_0x14e0d9)['end']();};}function respondWithResult(_0x4240c7,_0x1d3daa){_0x1d3daa=_0x1d3daa||0xc8;return function(_0x21fb71){if(_0x21fb71){return _0x4240c7[_0x9dbc('0x14')](_0x1d3daa)['json'](_0x21fb71);}};}function respondWithFilteredResult(_0x89ac7f,_0xadd694){return function(_0x386891){if(_0x386891){var _0x525f53=typeof _0xadd694['offset']==='undefined'&&typeof _0xadd694[_0x9dbc('0x15')]==='undefined';var _0x2b8381=_0x386891[_0x9dbc('0x16')];var _0x45c71c=_0x525f53?0x0:_0xadd694[_0x9dbc('0x17')];var _0x11ad63=_0x525f53?_0x386891[_0x9dbc('0x16')]:_0xadd694[_0x9dbc('0x17')]+_0xadd694[_0x9dbc('0x15')];var _0x3e30e0;if(_0x11ad63>=_0x2b8381){_0x11ad63=_0x2b8381;_0x3e30e0=0xc8;}else{_0x3e30e0=0xce;}_0x89ac7f[_0x9dbc('0x14')](_0x3e30e0);return _0x89ac7f[_0x9dbc('0x18')](_0x9dbc('0x19'),_0x45c71c+'-'+_0x11ad63+'/'+_0x2b8381)[_0x9dbc('0x1a')](_0x386891);}return null;};}function patchUpdates(_0x593cc7){return function(_0x55f82c){try{jsonpatch[_0x9dbc('0x1b')](_0x55f82c,_0x593cc7,!![]);}catch(_0x3020fa){return BPromise['reject'](_0x3020fa);}return _0x55f82c[_0x9dbc('0x1c')]();};}function saveUpdates(_0x18d207,_0x270506){return function(_0x2d33d7){if(_0x2d33d7){return _0x2d33d7[_0x9dbc('0x1d')](_0x18d207)[_0x9dbc('0x1e')](function(_0x106850){return _0x106850;});}return null;};}function removeEntity(_0x3e85a4,_0x6a3467){return function(_0x1873bb){if(_0x1873bb){return _0x1873bb[_0x9dbc('0x1f')]()[_0x9dbc('0x1e')](function(){var _0xdfb6f6=_0x1873bb[_0x9dbc('0x20')]({'plain':!![]});var _0x45eb6f=_0x9dbc('0x21');return db[_0x9dbc('0x22')][_0x9dbc('0x1f')]({'where':{'type':_0x45eb6f,'resourceId':_0xdfb6f6['id']}})[_0x9dbc('0x1e')](function(){return _0x1873bb;});})[_0x9dbc('0x1e')](function(){_0x3e85a4[_0x9dbc('0x14')](0xcc)[_0x9dbc('0x23')]();});}};}function handleEntityNotFound(_0x1c1558,_0x1fb6a5){return function(_0x156f38){if(!_0x156f38){_0x1c1558[_0x9dbc('0x24')](0x194);}return _0x156f38;};}function handleError(_0x97e1e7,_0x397460){_0x397460=_0x397460||0x1f4;return function(_0x2d8900){logger[_0x9dbc('0x25')](_0x2d8900[_0x9dbc('0x26')]);if(_0x2d8900[_0x9dbc('0x27')]){delete _0x2d8900[_0x9dbc('0x27')];}_0x97e1e7[_0x9dbc('0x14')](_0x397460)['send'](_0x2d8900);};}exports['index']=function(_0x34371d,_0x1f54b5){var _0x37819b={},_0x36d448={},_0x25a0b0={'count':0x0,'rows':[]};var _0x5ac0f2=_[_0x9dbc('0x28')](db['SquareOdbc'][_0x9dbc('0x29')],function(_0x193ce7){return{'name':_0x193ce7[_0x9dbc('0x2a')],'type':_0x193ce7[_0x9dbc('0x2b')][_0x9dbc('0x2c')]};});_0x36d448['model']=_['map'](_0x5ac0f2,'name');_0x36d448[_0x9dbc('0x2d')]=_[_0x9dbc('0x2e')](_0x34371d[_0x9dbc('0x2d')]);_0x36d448[_0x9dbc('0x2f')]=_['intersection'](_0x36d448[_0x9dbc('0x30')],_0x36d448[_0x9dbc('0x2d')]);_0x37819b[_0x9dbc('0x31')]=_[_0x9dbc('0x32')](_0x36d448[_0x9dbc('0x30')],qs[_0x9dbc('0x33')](_0x34371d[_0x9dbc('0x2d')][_0x9dbc('0x33')]));_0x37819b[_0x9dbc('0x31')]=_0x37819b[_0x9dbc('0x31')][_0x9dbc('0x34')]?_0x37819b[_0x9dbc('0x31')]:_0x36d448[_0x9dbc('0x30')];if(!_0x34371d[_0x9dbc('0x2d')][_0x9dbc('0x35')](_0x9dbc('0x36'))){_0x37819b[_0x9dbc('0x15')]=qs[_0x9dbc('0x15')](_0x34371d[_0x9dbc('0x2d')]['limit']);_0x37819b[_0x9dbc('0x17')]=qs[_0x9dbc('0x17')](_0x34371d[_0x9dbc('0x2d')]['offset']);}_0x37819b[_0x9dbc('0x37')]=qs[_0x9dbc('0x38')](_0x34371d[_0x9dbc('0x2d')][_0x9dbc('0x38')]);_0x37819b[_0x9dbc('0x39')]=qs[_0x9dbc('0x2f')](_['pick'](_0x34371d[_0x9dbc('0x2d')],_0x36d448['filters']),_0x5ac0f2);if(_0x34371d[_0x9dbc('0x2d')][_0x9dbc('0x3a')]){_0x37819b[_0x9dbc('0x39')]=_[_0x9dbc('0x3b')](_0x37819b[_0x9dbc('0x39')],{'$or':_['map'](_0x5ac0f2,function(_0x1ba88f){if(_0x1ba88f[_0x9dbc('0x2b')]!==_0x9dbc('0x3c')){var _0x51f3b5={};_0x51f3b5[_0x1ba88f[_0x9dbc('0x27')]]={'$like':'%'+_0x34371d[_0x9dbc('0x2d')][_0x9dbc('0x3a')]+'%'};return _0x51f3b5;}})});}_0x37819b=_[_0x9dbc('0x3b')]({},_0x37819b,_0x34371d[_0x9dbc('0x3d')]);var _0x19aa3d={'where':_0x37819b[_0x9dbc('0x39')]};return db['SquareOdbc'][_0x9dbc('0x16')](_0x19aa3d)[_0x9dbc('0x1e')](function(_0x54cf9e){_0x25a0b0['count']=_0x54cf9e;if(_0x34371d[_0x9dbc('0x2d')][_0x9dbc('0x3e')]){_0x37819b[_0x9dbc('0x3f')]=[{'all':!![]}];}return db[_0x9dbc('0x40')][_0x9dbc('0x41')](_0x37819b);})[_0x9dbc('0x1e')](function(_0x14dd79){_0x25a0b0[_0x9dbc('0x42')]=_0x14dd79;return _0x25a0b0;})[_0x9dbc('0x1e')](respondWithFilteredResult(_0x1f54b5,_0x37819b))[_0x9dbc('0x43')](handleError(_0x1f54b5,null));};exports['show']=function(_0x165b07,_0x459639){var _0x2ee298={'raw':!![],'where':{'id':_0x165b07[_0x9dbc('0x44')]['id']}},_0x438391={};_0x438391[_0x9dbc('0x30')]=_[_0x9dbc('0x2e')](db['SquareOdbc']['rawAttributes']);_0x438391[_0x9dbc('0x2d')]=_[_0x9dbc('0x2e')](_0x165b07[_0x9dbc('0x2d')]);_0x438391[_0x9dbc('0x2f')]=_[_0x9dbc('0x32')](_0x438391['model'],_0x438391['query']);_0x2ee298[_0x9dbc('0x31')]=_[_0x9dbc('0x32')](_0x438391[_0x9dbc('0x30')],qs['fields'](_0x165b07[_0x9dbc('0x2d')][_0x9dbc('0x33')]));_0x2ee298[_0x9dbc('0x31')]=_0x2ee298[_0x9dbc('0x31')]['length']?_0x2ee298[_0x9dbc('0x31')]:_0x438391[_0x9dbc('0x30')];if(_0x165b07['query'][_0x9dbc('0x3e')]){_0x2ee298[_0x9dbc('0x3f')]=[{'all':!![]}];}_0x2ee298=_[_0x9dbc('0x3b')]({},_0x2ee298,_0x165b07[_0x9dbc('0x3d')]);return db[_0x9dbc('0x40')][_0x9dbc('0x45')](_0x2ee298)[_0x9dbc('0x1e')](handleEntityNotFound(_0x459639,null))[_0x9dbc('0x1e')](respondWithResult(_0x459639,null))['catch'](handleError(_0x459639,null));};exports['create']=function(_0x1b0a82,_0x3c3b6e){return db['SquareOdbc'][_0x9dbc('0x46')](_0x1b0a82[_0x9dbc('0x47')],{})[_0x9dbc('0x1e')](function(_0x383638){var _0x12d3a1=_0x1b0a82[_0x9dbc('0x48')][_0x9dbc('0x20')]({'plain':!![]});if(!_0x12d3a1)throw new Error(_0x9dbc('0x49'));if(_0x12d3a1['role']===_0x9dbc('0x48')){var _0x2a5ab1=_0x383638['get']({'plain':!![]});var _0x50bfde=_0x9dbc('0x21');return db[_0x9dbc('0x4a')]['find']({'where':{'name':_0x50bfde,'userProfileId':_0x12d3a1['userProfileId']},'raw':!![]})['then'](function(_0x262a3c){if(_0x262a3c&&_0x262a3c[_0x9dbc('0x4b')]===0x0){return db[_0x9dbc('0x22')][_0x9dbc('0x46')]({'name':_0x2a5ab1[_0x9dbc('0x27')],'resourceId':_0x2a5ab1['id'],'type':_0x262a3c[_0x9dbc('0x27')],'sectionId':_0x262a3c['id']},{})[_0x9dbc('0x1e')](function(){return _0x383638;});}else{return _0x383638;}})['catch'](function(_0x9ec310){logger[_0x9dbc('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9ec310);throw _0x9ec310;});}return _0x383638;})[_0x9dbc('0x1e')](respondWithResult(_0x3c3b6e,0xc9))[_0x9dbc('0x43')](handleError(_0x3c3b6e,null));};exports[_0x9dbc('0x1d')]=function(_0xcb57ab,_0xc91535){if(_0xcb57ab[_0x9dbc('0x47')]['id']){delete _0xcb57ab[_0x9dbc('0x47')]['id'];}return db['SquareOdbc'][_0x9dbc('0x45')]({'where':{'id':_0xcb57ab[_0x9dbc('0x44')]['id']}})[_0x9dbc('0x1e')](handleEntityNotFound(_0xc91535,null))[_0x9dbc('0x1e')](saveUpdates(_0xcb57ab[_0x9dbc('0x47')],null))[_0x9dbc('0x1e')](respondWithResult(_0xc91535,null))['catch'](handleError(_0xc91535,null));};exports[_0x9dbc('0x1f')]=function(_0x563875,_0x270463){return db[_0x9dbc('0x40')][_0x9dbc('0x45')]({'where':{'id':_0x563875[_0x9dbc('0x44')]['id']}})[_0x9dbc('0x1e')](handleEntityNotFound(_0x270463,null))[_0x9dbc('0x1e')](removeEntity(_0x270463,null))[_0x9dbc('0x43')](handleError(_0x270463,null));};exports[_0x9dbc('0x4c')]=function(_0x1ee829,_0x1378d6,_0x2dd516){var _0x89b120;return db['SquareOdbc'][_0x9dbc('0x45')]({'where':{'id':_0x1ee829[_0x9dbc('0x44')]['id']},'attributes':['id',_0x9dbc('0x4d')]})[_0x9dbc('0x1e')](handleEntityNotFound(_0x1378d6,null))['then'](function(_0x4c63ed){if(_0x4c63ed){var _0x300d26=require(_0x9dbc('0x4e'))();_0x300d26[_0x9dbc('0x4f')](_0x4c63ed['dsn']);_0x300d26[_0x9dbc('0x50')]();return _0x4c63ed;}})[_0x9dbc('0x1e')](respondWithResult(_0x1378d6,null))[_0x9dbc('0x43')](handleError(_0x1378d6,null));}; \ No newline at end of file +var _0xd187=['filter','merge','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','ODBC','UserProfileResource','end','name','send','index','SquareOdbc','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd187,0x6a));var _0x7d18=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0xd187[_0x9be28f];return _0xa9f52d;};'use strict';var emlformat=require(_0x7d18('0x0'));var rimraf=require(_0x7d18('0x1'));var zipdir=require(_0x7d18('0x2'));var jsonpatch=require(_0x7d18('0x3'));var rp=require(_0x7d18('0x4'));var moment=require('moment');var BPromise=require(_0x7d18('0x5'));var Mustache=require(_0x7d18('0x6'));var util=require(_0x7d18('0x7'));var path=require(_0x7d18('0x8'));var sox=require(_0x7d18('0x9'));var csv=require(_0x7d18('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d18('0xb'));var _=require(_0x7d18('0xc'));var squel=require(_0x7d18('0xd'));var crypto=require(_0x7d18('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7d18('0xa'));var querystring=require('querystring');var Papa=require(_0x7d18('0xf'));var Redis=require(_0x7d18('0x10'));var authService=require(_0x7d18('0x11'));var qs=require(_0x7d18('0x12'));var as=require(_0x7d18('0x13'));var hardwareService=require(_0x7d18('0x14'));var logger=require('../../config/logger')(_0x7d18('0x15'));var utils=require(_0x7d18('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7d18('0x17'));var db=require(_0x7d18('0x18'))['db'];function respondWithStatusCode(_0x52a576,_0x1db8b6){_0x1db8b6=_0x1db8b6||0xcc;return function(_0x4c4ea5){if(_0x4c4ea5){return _0x52a576[_0x7d18('0x19')](_0x1db8b6);}return _0x52a576['status'](_0x1db8b6)['end']();};}function respondWithResult(_0x4e7269,_0x2efce1){_0x2efce1=_0x2efce1||0xc8;return function(_0x35f486){if(_0x35f486){return _0x4e7269[_0x7d18('0x1a')](_0x2efce1)[_0x7d18('0x1b')](_0x35f486);}};}function respondWithFilteredResult(_0x231252,_0x1f9d2c){return function(_0x3fb8ac){if(_0x3fb8ac){var _0x485983=typeof _0x1f9d2c[_0x7d18('0x1c')]===_0x7d18('0x1d')&&typeof _0x1f9d2c[_0x7d18('0x1e')]===_0x7d18('0x1d');var _0x30fde1=_0x3fb8ac[_0x7d18('0x1f')];var _0x311687=_0x485983?0x0:_0x1f9d2c[_0x7d18('0x1c')];var _0x554a42=_0x485983?_0x3fb8ac[_0x7d18('0x1f')]:_0x1f9d2c['offset']+_0x1f9d2c[_0x7d18('0x1e')];var _0x344d63;if(_0x554a42>=_0x30fde1){_0x554a42=_0x30fde1;_0x344d63=0xc8;}else{_0x344d63=0xce;}_0x231252[_0x7d18('0x1a')](_0x344d63);return _0x231252['set'](_0x7d18('0x20'),_0x311687+'-'+_0x554a42+'/'+_0x30fde1)[_0x7d18('0x1b')](_0x3fb8ac);}return null;};}function patchUpdates(_0x568bc0){return function(_0x2bc0df){try{jsonpatch['apply'](_0x2bc0df,_0x568bc0,!![]);}catch(_0x17613f){return BPromise[_0x7d18('0x21')](_0x17613f);}return _0x2bc0df[_0x7d18('0x22')]();};}function saveUpdates(_0x321584,_0x41b6c8){return function(_0x5517ae){if(_0x5517ae){return _0x5517ae[_0x7d18('0x23')](_0x321584)[_0x7d18('0x24')](function(_0x238021){return _0x238021;});}return null;};}function removeEntity(_0x11a3c4,_0x18233c){return function(_0x5eb501){if(_0x5eb501){return _0x5eb501[_0x7d18('0x25')]()['then'](function(){var _0x5c14ee=_0x5eb501['get']({'plain':!![]});var _0x18b4be=_0x7d18('0x26');return db[_0x7d18('0x27')]['destroy']({'where':{'type':_0x18b4be,'resourceId':_0x5c14ee['id']}})[_0x7d18('0x24')](function(){return _0x5eb501;});})[_0x7d18('0x24')](function(){_0x11a3c4[_0x7d18('0x1a')](0xcc)[_0x7d18('0x28')]();});}};}function handleEntityNotFound(_0xff65b7,_0x5ddf1f){return function(_0x508db7){if(!_0x508db7){_0xff65b7[_0x7d18('0x19')](0x194);}return _0x508db7;};}function handleError(_0xde180f,_0x76c0ff){_0x76c0ff=_0x76c0ff||0x1f4;return function(_0x2294b4){logger['error'](_0x2294b4['stack']);if(_0x2294b4[_0x7d18('0x29')]){delete _0x2294b4['name'];}_0xde180f[_0x7d18('0x1a')](_0x76c0ff)[_0x7d18('0x2a')](_0x2294b4);};}exports[_0x7d18('0x2b')]=function(_0x3fd630,_0xf19244){var _0x24b55c={},_0xe8d68d={},_0x3dd128={'count':0x0,'rows':[]};var _0x49c221=_['map'](db[_0x7d18('0x2c')]['rawAttributes'],function(_0xcc954b){return{'name':_0xcc954b[_0x7d18('0x2d')],'type':_0xcc954b[_0x7d18('0x2e')][_0x7d18('0x2f')]};});_0xe8d68d[_0x7d18('0x30')]=_[_0x7d18('0x31')](_0x49c221,'name');_0xe8d68d[_0x7d18('0x32')]=_[_0x7d18('0x33')](_0x3fd630[_0x7d18('0x32')]);_0xe8d68d[_0x7d18('0x34')]=_[_0x7d18('0x35')](_0xe8d68d[_0x7d18('0x30')],_0xe8d68d[_0x7d18('0x32')]);_0x24b55c[_0x7d18('0x36')]=_[_0x7d18('0x35')](_0xe8d68d['model'],qs['fields'](_0x3fd630[_0x7d18('0x32')]['fields']));_0x24b55c['attributes']=_0x24b55c['attributes']['length']?_0x24b55c['attributes']:_0xe8d68d[_0x7d18('0x30')];if(!_0x3fd630[_0x7d18('0x32')][_0x7d18('0x37')]('nolimit')){_0x24b55c['limit']=qs['limit'](_0x3fd630[_0x7d18('0x32')][_0x7d18('0x1e')]);_0x24b55c[_0x7d18('0x1c')]=qs[_0x7d18('0x1c')](_0x3fd630['query'][_0x7d18('0x1c')]);}_0x24b55c[_0x7d18('0x38')]=qs[_0x7d18('0x39')](_0x3fd630[_0x7d18('0x32')][_0x7d18('0x39')]);_0x24b55c[_0x7d18('0x3a')]=qs[_0x7d18('0x34')](_[_0x7d18('0x3b')](_0x3fd630[_0x7d18('0x32')],_0xe8d68d['filters']),_0x49c221);if(_0x3fd630[_0x7d18('0x32')][_0x7d18('0x3c')]){_0x24b55c['where']=_[_0x7d18('0x3d')](_0x24b55c[_0x7d18('0x3a')],{'$or':_['map'](_0x49c221,function(_0x3c0c66){if(_0x3c0c66[_0x7d18('0x2e')]!==_0x7d18('0x3e')){var _0x57e008={};_0x57e008[_0x3c0c66[_0x7d18('0x29')]]={'$like':'%'+_0x3fd630[_0x7d18('0x32')][_0x7d18('0x3c')]+'%'};return _0x57e008;}})});}_0x24b55c=_[_0x7d18('0x3d')]({},_0x24b55c,_0x3fd630['options']);var _0x2c2747={'where':_0x24b55c[_0x7d18('0x3a')]};return db['SquareOdbc'][_0x7d18('0x1f')](_0x2c2747)['then'](function(_0x4f4e06){_0x3dd128[_0x7d18('0x1f')]=_0x4f4e06;if(_0x3fd630[_0x7d18('0x32')][_0x7d18('0x3f')]){_0x24b55c[_0x7d18('0x40')]=[{'all':!![]}];}return db[_0x7d18('0x2c')]['findAll'](_0x24b55c);})['then'](function(_0x3baed8){_0x3dd128['rows']=_0x3baed8;return _0x3dd128;})[_0x7d18('0x24')](respondWithFilteredResult(_0xf19244,_0x24b55c))[_0x7d18('0x41')](handleError(_0xf19244,null));};exports[_0x7d18('0x42')]=function(_0x4b6e39,_0x2c1bbb){var _0x21180c={'raw':!![],'where':{'id':_0x4b6e39[_0x7d18('0x43')]['id']}},_0x516dfc={};_0x516dfc[_0x7d18('0x30')]=_['keys'](db[_0x7d18('0x2c')][_0x7d18('0x44')]);_0x516dfc[_0x7d18('0x32')]=_[_0x7d18('0x33')](_0x4b6e39['query']);_0x516dfc[_0x7d18('0x34')]=_['intersection'](_0x516dfc[_0x7d18('0x30')],_0x516dfc['query']);_0x21180c[_0x7d18('0x36')]=_[_0x7d18('0x35')](_0x516dfc[_0x7d18('0x30')],qs['fields'](_0x4b6e39[_0x7d18('0x32')]['fields']));_0x21180c['attributes']=_0x21180c['attributes']['length']?_0x21180c[_0x7d18('0x36')]:_0x516dfc['model'];if(_0x4b6e39[_0x7d18('0x32')][_0x7d18('0x3f')]){_0x21180c[_0x7d18('0x40')]=[{'all':!![]}];}_0x21180c=_[_0x7d18('0x3d')]({},_0x21180c,_0x4b6e39['options']);return db[_0x7d18('0x2c')][_0x7d18('0x45')](_0x21180c)['then'](handleEntityNotFound(_0x2c1bbb,null))[_0x7d18('0x24')](respondWithResult(_0x2c1bbb,null))[_0x7d18('0x41')](handleError(_0x2c1bbb,null));};exports[_0x7d18('0x46')]=function(_0x36d463,_0x3e133a){return db[_0x7d18('0x2c')]['create'](_0x36d463['body'],{})[_0x7d18('0x24')](function(_0x2dafec){var _0x347735=_0x36d463[_0x7d18('0x47')][_0x7d18('0x48')]({'plain':!![]});if(!_0x347735)throw new Error(_0x7d18('0x49'));if(_0x347735[_0x7d18('0x4a')]===_0x7d18('0x47')){var _0x158350=_0x2dafec[_0x7d18('0x48')]({'plain':!![]});var _0x350849=_0x7d18('0x26');return db['UserProfileSection'][_0x7d18('0x45')]({'where':{'name':_0x350849,'userProfileId':_0x347735[_0x7d18('0x4b')]},'raw':!![]})[_0x7d18('0x24')](function(_0x4ac9d5){if(_0x4ac9d5&&_0x4ac9d5[_0x7d18('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x158350['name'],'resourceId':_0x158350['id'],'type':_0x4ac9d5[_0x7d18('0x29')],'sectionId':_0x4ac9d5['id']},{})[_0x7d18('0x24')](function(){return _0x2dafec;});}else{return _0x2dafec;}})['catch'](function(_0x20a03d){logger['error'](_0x7d18('0x4d'),_0x20a03d);throw _0x20a03d;});}return _0x2dafec;})[_0x7d18('0x24')](respondWithResult(_0x3e133a,0xc9))[_0x7d18('0x41')](handleError(_0x3e133a,null));};exports[_0x7d18('0x23')]=function(_0x49ec52,_0x56aa67){if(_0x49ec52[_0x7d18('0x4e')]['id']){delete _0x49ec52[_0x7d18('0x4e')]['id'];}return db[_0x7d18('0x2c')][_0x7d18('0x45')]({'where':{'id':_0x49ec52[_0x7d18('0x43')]['id']}})[_0x7d18('0x24')](handleEntityNotFound(_0x56aa67,null))[_0x7d18('0x24')](saveUpdates(_0x49ec52[_0x7d18('0x4e')],null))[_0x7d18('0x24')](respondWithResult(_0x56aa67,null))['catch'](handleError(_0x56aa67,null));};exports[_0x7d18('0x25')]=function(_0x37fe86,_0x39b4e3){return db[_0x7d18('0x2c')][_0x7d18('0x45')]({'where':{'id':_0x37fe86['params']['id']}})[_0x7d18('0x24')](handleEntityNotFound(_0x39b4e3,null))[_0x7d18('0x24')](removeEntity(_0x39b4e3,null))[_0x7d18('0x41')](handleError(_0x39b4e3,null));};exports[_0x7d18('0x4f')]=function(_0x3f2f85,_0x522555,_0x959733){var _0x145e61;return db[_0x7d18('0x2c')]['find']({'where':{'id':_0x3f2f85[_0x7d18('0x43')]['id']},'attributes':['id',_0x7d18('0x50')]})[_0x7d18('0x24')](handleEntityNotFound(_0x522555,null))['then'](function(_0x256d6d){if(_0x256d6d){var _0x905ce7=require('odbc')();_0x905ce7[_0x7d18('0x51')](_0x256d6d[_0x7d18('0x50')]);_0x905ce7[_0x7d18('0x52')]();return _0x256d6d;}})[_0x7d18('0x24')](respondWithResult(_0x522555,null))[_0x7d18('0x41')](handleError(_0x522555,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ac2fe60..c9871a6 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 _0x91d2=['bluebird','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0x91d2,0x188));var _0x291d=function(_0x50ab95,_0x30f673){_0x50ab95=_0x50ab95-0x0;var _0xfe781b=_0x91d2[_0x50ab95];return _0xfe781b;};'use strict';var _=require(_0x291d('0x0'));var util=require(_0x291d('0x1'));var logger=require(_0x291d('0x2'))('api');var moment=require(_0x291d('0x3'));var BPromise=require(_0x291d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x291d('0x5'));var rimraf=require('rimraf');var config=require(_0x291d('0x6'));var attributes=require(_0x291d('0x7'));module[_0x291d('0x8')]=function(_0x56ade4,_0x10031f){return _0x56ade4[_0x291d('0x9')](_0x291d('0xa'),attributes,{'tableName':_0x291d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab38=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','lodash'];(function(_0x3968ff,_0x3d5ab4){var _0xabf59a=function(_0x63e8){while(--_0x63e8){_0x3968ff['push'](_0x3968ff['shift']());}};_0xabf59a(++_0x3d5ab4);}(_0xab38,0x137));var _0x8ab3=function(_0x46d1bb,_0x2f0ad9){_0x46d1bb=_0x46d1bb-0x0;var _0x4d83b6=_0xab38[_0x46d1bb];return _0x4d83b6;};'use strict';var _=require(_0x8ab3('0x0'));var util=require(_0x8ab3('0x1'));var logger=require(_0x8ab3('0x2'))(_0x8ab3('0x3'));var moment=require(_0x8ab3('0x4'));var BPromise=require(_0x8ab3('0x5'));var rp=require(_0x8ab3('0x6'));var fs=require('fs');var path=require(_0x8ab3('0x7'));var rimraf=require(_0x8ab3('0x8'));var config=require('../../config/environment');var attributes=require(_0x8ab3('0x9'));module[_0x8ab3('0xa')]=function(_0x2e4d99,_0x5037c3){return _0x2e4d99[_0x8ab3('0xb')](_0x8ab3('0xc'),attributes,{'tableName':'square_odbc','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 8dbde3c..f1fe203 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 _0xdaa8=['rpc','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','ShowSquareOdbc','options','raw','where','include','map','model','attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x8dda5a,_0x48adb1){var _0x94d7c3=function(_0x45f30d){while(--_0x45f30d){_0x8dda5a['push'](_0x8dda5a['shift']());}};_0x94d7c3(++_0x48adb1);}(_0xdaa8,0x11c));var _0x8daa=function(_0x143017,_0x8b3508){_0x143017=_0x143017-0x0;var _0x22c11a=_0xdaa8[_0x143017];return _0x22c11a;};'use strict';var _=require(_0x8daa('0x0'));var util=require('util');var moment=require(_0x8daa('0x1'));var BPromise=require(_0x8daa('0x2'));var rs=require(_0x8daa('0x3'));var fs=require('fs');var Redis=require(_0x8daa('0x4'));var db=require(_0x8daa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8daa('0x6'));var config=require('../../config/environment');var jayson=require(_0x8daa('0x7'));var client=jayson[_0x8daa('0x8')][_0x8daa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19ef36,_0x34adaa,_0x1f9a04){return new BPromise(function(_0x382cfe,_0x314fd5){return client['request'](_0x19ef36,_0x1f9a04)[_0x8daa('0xa')](function(_0x4dcc4d){logger[_0x8daa('0xb')](_0x8daa('0xc'),_0x34adaa,'request\x20sent');logger[_0x8daa('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x34adaa,'request\x20sent',JSON['stringify'](_0x4dcc4d));if(_0x4dcc4d[_0x8daa('0xe')]){if(_0x4dcc4d['error'][_0x8daa('0xf')]===0x1f4){logger[_0x8daa('0xe')](_0x8daa('0xc'),_0x34adaa,_0x4dcc4d[_0x8daa('0xe')][_0x8daa('0x10')]);return _0x314fd5(_0x4dcc4d[_0x8daa('0xe')][_0x8daa('0x10')]);}logger[_0x8daa('0xe')](_0x8daa('0xc'),_0x34adaa,_0x4dcc4d[_0x8daa('0xe')][_0x8daa('0x10')]);return _0x382cfe(_0x4dcc4d['error'][_0x8daa('0x10')]);}else{logger[_0x8daa('0xb')](_0x8daa('0xc'),_0x34adaa,_0x8daa('0x11'));_0x382cfe(_0x4dcc4d[_0x8daa('0x12')][_0x8daa('0x10')]);}})[_0x8daa('0x13')](function(_0x1dc098){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x34adaa,_0x1dc098);_0x314fd5(_0x1dc098);});});}exports[_0x8daa('0x14')]=function(_0x28a19e){var _0x521530=this;return new Promise(function(_0x5c8017,_0x55e2b3){return db['SquareOdbc']['find']({'raw':_0x28a19e[_0x8daa('0x15')]?_0x28a19e['options'][_0x8daa('0x16')]===undefined?!![]:![]:!![],'where':_0x28a19e[_0x8daa('0x15')]?_0x28a19e[_0x8daa('0x15')][_0x8daa('0x17')]||null:null,'attributes':_0x28a19e[_0x8daa('0x15')]?_0x28a19e[_0x8daa('0x15')]['attributes']||null:null,'include':_0x28a19e['options']?_0x28a19e[_0x8daa('0x15')][_0x8daa('0x18')]?_[_0x8daa('0x19')](_0x28a19e[_0x8daa('0x15')][_0x8daa('0x18')],function(_0x2665f9){return{'model':db[_0x2665f9[_0x8daa('0x1a')]],'as':_0x2665f9['as'],'attributes':_0x2665f9[_0x8daa('0x1b')],'include':_0x2665f9[_0x8daa('0x18')]?_[_0x8daa('0x19')](_0x2665f9[_0x8daa('0x18')],function(_0x1a0ea9){return{'model':db[_0x1a0ea9['model']],'as':_0x1a0ea9['as'],'attributes':_0x1a0ea9[_0x8daa('0x1b')],'include':_0x1a0ea9['include']?_[_0x8daa('0x19')](_0x1a0ea9[_0x8daa('0x18')],function(_0x4e5dbb){return{'model':db[_0x4e5dbb[_0x8daa('0x1a')]],'as':_0x4e5dbb['as'],'attributes':_0x4e5dbb['attributes']};}):[]};}):[]};}):[]:[]})[_0x8daa('0xa')](function(_0x5cfc0c){logger['info'](_0x8daa('0x14'),_0x28a19e);logger[_0x8daa('0xd')](_0x8daa('0x14'),_0x28a19e,JSON[_0x8daa('0x1c')](_0x5cfc0c));_0x5c8017(_0x5cfc0c);})[_0x8daa('0x13')](function(_0x4a6dc8){logger[_0x8daa('0xe')](_0x8daa('0x14'),_0x4a6dc8[_0x8daa('0x10')],_0x28a19e);_0x55e2b3(_0x521530[_0x8daa('0xe')](0x1f4,_0x4a6dc8[_0x8daa('0x10')]));});});}; \ No newline at end of file +var _0x03c5=['then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xd6ba79,_0x56cdbd){var _0x389ada=function(_0x3e8c48){while(--_0x3e8c48){_0xd6ba79['push'](_0xd6ba79['shift']());}};_0x389ada(++_0x56cdbd);}(_0x03c5,0x146));var _0x503c=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x03c5[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0x503c('0x0'));var util=require(_0x503c('0x1'));var moment=require(_0x503c('0x2'));var BPromise=require(_0x503c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x503c('0x4'));var db=require(_0x503c('0x5'))['db'];var utils=require(_0x503c('0x6'));var logger=require(_0x503c('0x7'))(_0x503c('0x8'));var config=require(_0x503c('0x9'));var jayson=require(_0x503c('0xa'));var client=jayson[_0x503c('0xb')][_0x503c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cdb0b,_0x28151e,_0xd46002){return new BPromise(function(_0x1b33e9,_0x2a38c8){return client[_0x503c('0xd')](_0x4cdb0b,_0xd46002)[_0x503c('0xe')](function(_0x4f30a1){logger['info'](_0x503c('0xf'),_0x28151e,_0x503c('0x10'));logger[_0x503c('0x11')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x28151e,_0x503c('0x10'),JSON[_0x503c('0x12')](_0x4f30a1));if(_0x4f30a1[_0x503c('0x13')]){if(_0x4f30a1[_0x503c('0x13')][_0x503c('0x14')]===0x1f4){logger[_0x503c('0x13')](_0x503c('0xf'),_0x28151e,_0x4f30a1[_0x503c('0x13')]['message']);return _0x2a38c8(_0x4f30a1['error'][_0x503c('0x15')]);}logger[_0x503c('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x28151e,_0x4f30a1[_0x503c('0x13')][_0x503c('0x15')]);return _0x1b33e9(_0x4f30a1['error'][_0x503c('0x15')]);}else{logger['info'](_0x503c('0xf'),_0x28151e,_0x503c('0x10'));_0x1b33e9(_0x4f30a1[_0x503c('0x16')][_0x503c('0x15')]);}})[_0x503c('0x17')](function(_0xc3776b){logger['error'](_0x503c('0xf'),_0x28151e,_0xc3776b);_0x2a38c8(_0xc3776b);});});}exports[_0x503c('0x18')]=function(_0x690a55){var _0x56e260=this;return new Promise(function(_0x529505,_0x3b20db){return db[_0x503c('0x19')][_0x503c('0x1a')]({'raw':_0x690a55['options']?_0x690a55['options']['raw']===undefined?!![]:![]:!![],'where':_0x690a55[_0x503c('0x1b')]?_0x690a55[_0x503c('0x1b')][_0x503c('0x1c')]||null:null,'attributes':_0x690a55[_0x503c('0x1b')]?_0x690a55['options'][_0x503c('0x1d')]||null:null,'include':_0x690a55[_0x503c('0x1b')]?_0x690a55[_0x503c('0x1b')][_0x503c('0x1e')]?_[_0x503c('0x1f')](_0x690a55[_0x503c('0x1b')][_0x503c('0x1e')],function(_0xf6b2e0){return{'model':db[_0xf6b2e0['model']],'as':_0xf6b2e0['as'],'attributes':_0xf6b2e0[_0x503c('0x1d')],'include':_0xf6b2e0[_0x503c('0x1e')]?_['map'](_0xf6b2e0[_0x503c('0x1e')],function(_0x4c63d6){return{'model':db[_0x4c63d6[_0x503c('0x20')]],'as':_0x4c63d6['as'],'attributes':_0x4c63d6['attributes'],'include':_0x4c63d6['include']?_[_0x503c('0x1f')](_0x4c63d6[_0x503c('0x1e')],function(_0x4ab0f0){return{'model':db[_0x4ab0f0['model']],'as':_0x4ab0f0['as'],'attributes':_0x4ab0f0[_0x503c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cad0){logger[_0x503c('0x21')](_0x503c('0x18'),_0x690a55);logger['debug'](_0x503c('0x18'),_0x690a55,JSON['stringify'](_0x23cad0));_0x529505(_0x23cad0);})[_0x503c('0x17')](function(_0x1a939b){logger[_0x503c('0x13')](_0x503c('0x18'),_0x1a939b[_0x503c('0x15')],_0x690a55);_0x3b20db(_0x56e260[_0x503c('0x13')](0x1f4,_0x1a939b[_0x503c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 37bc9e9..3aaf2a6 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 _0xd0ea=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','post'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0xd0ea,0x142));var _0xad0e=function(_0x406ba5,_0x39fa4b){_0x406ba5=_0x406ba5-0x0;var _0x557db7=_0xd0ea[_0x406ba5];return _0x557db7;};'use strict';var multer=require('multer');var util=require(_0xad0e('0x0'));var path=require('path');var timeout=require(_0xad0e('0x1'));var express=require(_0xad0e('0x2'));var router=express[_0xad0e('0x3')]();var fs_extra=require(_0xad0e('0x4'));var auth=require(_0xad0e('0x5'));var interaction=require(_0xad0e('0x6'));var config=require(_0xad0e('0x7'));var controller=require(_0xad0e('0x8'));router[_0xad0e('0x9')]('/',auth[_0xad0e('0xa')](),controller[_0xad0e('0xb')]);router[_0xad0e('0x9')](_0xad0e('0xc'),auth[_0xad0e('0xa')](),controller['show']);router[_0xad0e('0xd')]('/',auth[_0xad0e('0xa')](),controller['create']);router['put'](_0xad0e('0xc'),auth[_0xad0e('0xa')](),controller['update']);router['delete'](_0xad0e('0xc'),auth[_0xad0e('0xa')](),controller[_0xad0e('0xe')]);module[_0xad0e('0xf')]=router; \ No newline at end of file +var _0xcbd0=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcbd0,0xc8));var _0x0cbd=function(_0x56d450,_0x20a968){_0x56d450=_0x56d450-0x0;var _0xc1fb7b=_0xcbd0[_0x56d450];return _0xc1fb7b;};'use strict';var multer=require(_0x0cbd('0x0'));var util=require(_0x0cbd('0x1'));var path=require(_0x0cbd('0x2'));var timeout=require(_0x0cbd('0x3'));var express=require(_0x0cbd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0cbd('0x5'));var interaction=require(_0x0cbd('0x6'));var config=require(_0x0cbd('0x7'));var controller=require(_0x0cbd('0x8'));router[_0x0cbd('0x9')]('/',auth[_0x0cbd('0xa')](),controller[_0x0cbd('0xb')]);router['get'](_0x0cbd('0xc'),auth[_0x0cbd('0xa')](),controller[_0x0cbd('0xd')]);router['post']('/',auth[_0x0cbd('0xa')](),controller[_0x0cbd('0xe')]);router[_0x0cbd('0xf')](_0x0cbd('0xc'),auth[_0x0cbd('0xa')](),controller[_0x0cbd('0x10')]);router[_0x0cbd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0cbd('0x12')]);module[_0x0cbd('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 655266a..3f88b9d 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 _0x1751=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x5e8e62,_0x4dcbe2){var _0x3e1b94=function(_0x52b24d){while(--_0x52b24d){_0x5e8e62['push'](_0x5e8e62['shift']());}};_0x3e1b94(++_0x4dcbe2);}(_0x1751,0x76));var _0x1175=function(_0x4a7b14,_0x5326c1){_0x4a7b14=_0x4a7b14-0x0;var _0x43e501=_0x1751[_0x4a7b14];return _0x43e501;};'use strict';var Sequelize=require(_0x1175('0x0'));module[_0x1175('0x1')]={'name':{'type':Sequelize[_0x1175('0x2')],'unique':_0x1175('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x1175('0x4')]},'preproduction':{'type':Sequelize[_0x1175('0x5')](_0x1175('0x6')),'get':function(){if(this[_0x1175('0x7')](_0x1175('0x8'))){return this[_0x1175('0x7')](_0x1175('0x8'))[_0x1175('0x9')](_0x1175('0xa'));}}},'production':{'type':Sequelize[_0x1175('0x5')](_0x1175('0x6')),'get':function(){if(this[_0x1175('0x7')](_0x1175('0xb'))){return this[_0x1175('0x7')](_0x1175('0xb'))[_0x1175('0x9')](_0x1175('0xa'));}}},'savedAt':{'type':Sequelize[_0x1175('0xc')]},'publishedAt':{'type':Sequelize[_0x1175('0xc')]}}; \ No newline at end of file +var _0x0ccb=['BLOB','long','preproduction','getDataValue','toString','utf8','production','DATE','sequelize','name','STRING','TEXT'];(function(_0x2f8148,_0x2365cd){var _0x20b711=function(_0x43044b){while(--_0x43044b){_0x2f8148['push'](_0x2f8148['shift']());}};_0x20b711(++_0x2365cd);}(_0x0ccb,0x128));var _0xb0cc=function(_0x1146a8,_0x29edaf){_0x1146a8=_0x1146a8-0x0;var _0x359657=_0x0ccb[_0x1146a8];return _0x359657;};'use strict';var Sequelize=require(_0xb0cc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb0cc('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb0cc('0x2')]},'notes':{'type':Sequelize[_0xb0cc('0x3')]},'preproduction':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x5')),'get':function(){if(this['getDataValue'](_0xb0cc('0x6'))){return this[_0xb0cc('0x7')](_0xb0cc('0x6'))[_0xb0cc('0x8')](_0xb0cc('0x9'));}}},'production':{'type':Sequelize[_0xb0cc('0x4')](_0xb0cc('0x5')),'get':function(){if(this[_0xb0cc('0x7')](_0xb0cc('0xa'))){return this['getDataValue'](_0xb0cc('0xa'))[_0xb0cc('0x8')](_0xb0cc('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xb0cc('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 70b2584..a3fdc1a 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 _0x8f77=['redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish','sendStatus','error','stack','name','send','SquareProject','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x174701,_0x26ed67){var _0xa0f865=function(_0x2cf5b5){while(--_0x2cf5b5){_0x174701['push'](_0x174701['shift']());}};_0xa0f865(++_0x26ed67);}(_0x8f77,0x1dc));var _0x78f7=function(_0x412200,_0x5735c6){_0x412200=_0x412200-0x0;var _0x140699=_0x8f77[_0x412200];return _0x140699;};'use strict';var _=require(_0x78f7('0x0'));var Redis=require(_0x78f7('0x1'));var qs=require(_0x78f7('0x2'));var logger=require(_0x78f7('0x3'))(_0x78f7('0x4'));var config=require(_0x78f7('0x5'));var db=require(_0x78f7('0x6'))['db'];config[_0x78f7('0x7')]=_[_0x78f7('0x8')](config[_0x78f7('0x7')],{'host':_0x78f7('0x9'),'port':0x18eb});var socket=require(_0x78f7('0xa'))(new Redis(config[_0x78f7('0x7')]));require(_0x78f7('0xb'))[_0x78f7('0xc')](socket);function respondWithResult(_0x5af3ea,_0x4ffd32){_0x4ffd32=_0x4ffd32||0xc8;return function(_0x3bcfcc){if(_0x3bcfcc){return _0x5af3ea[_0x78f7('0xd')](_0x4ffd32)[_0x78f7('0xe')](_0x3bcfcc);}};}function respondWithFilteredResult(_0x1a3fce,_0x10d675){return function(_0x57a793){if(_0x57a793){var _0x5aa81b=typeof _0x10d675['offset']===_0x78f7('0xf')&&typeof _0x10d675['limit']===_0x78f7('0xf');var _0x1b1349=_0x57a793[_0x78f7('0x10')];var _0x58e2dd=_0x5aa81b?0x0:_0x10d675[_0x78f7('0x11')];var _0x4d2876=_0x5aa81b?_0x57a793['count']:_0x10d675['offset']+_0x10d675[_0x78f7('0x12')];var _0x13c587;if(_0x4d2876>=_0x1b1349){_0x4d2876=_0x1b1349;_0x13c587=0xc8;}else{_0x13c587=0xce;}_0x1a3fce[_0x78f7('0xd')](_0x13c587);return _0x1a3fce[_0x78f7('0x13')](_0x78f7('0x14'),_0x58e2dd+'-'+_0x4d2876+'/'+_0x1b1349)[_0x78f7('0xe')](_0x57a793);}return null;};}function saveUpdates(_0x2a73f3){return function(_0x316901){if(_0x316901){return _0x316901[_0x78f7('0x15')](_0x2a73f3)[_0x78f7('0x16')](function(_0x21eb6f){return _0x21eb6f;});}return null;};}function removeEntity(_0x45f5dd){return function(_0x5015f4){if(_0x5015f4){return _0x5015f4[_0x78f7('0x17')]()['then'](function(){var _0x1f182f=_0x5015f4[_0x78f7('0x18')]({'plain':!![]});var _0x59e0df=_0x78f7('0x19');return db[_0x78f7('0x1a')][_0x78f7('0x17')]({'where':{'type':_0x59e0df,'resourceId':_0x1f182f['id']}})[_0x78f7('0x16')](function(){return _0x5015f4;});})[_0x78f7('0x16')](function(){var _0x51f099=new Redis(config[_0x78f7('0x7')]);_0x51f099[_0x78f7('0x1b')]('agi',JSON['stringify']({'id':_0x5015f4['id'],'deleted':!![]}));})[_0x78f7('0x16')](function(){_0x45f5dd[_0x78f7('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a6129){return function(_0x18cde4){if(!_0x18cde4){_0x4a6129[_0x78f7('0x1c')](0x194);}return _0x18cde4;};}function handleError(_0x16ae62,_0x4ee282){_0x4ee282=_0x4ee282||0x1f4;return function(_0x4c3df9){logger[_0x78f7('0x1d')](_0x4c3df9[_0x78f7('0x1e')]);if(_0x4c3df9[_0x78f7('0x1f')]){delete _0x4c3df9[_0x78f7('0x1f')];}_0x16ae62[_0x78f7('0xd')](_0x4ee282)[_0x78f7('0x20')](_0x4c3df9);};}exports['index']=function(_0x33a8d1,_0x3431d1){var _0x5be193={},_0x3f2997={},_0x3ec1b5={'count':0x0,'rows':[]};var _0x22145f=_['map'](db[_0x78f7('0x21')]['rawAttributes'],function(_0x299b97){return{'name':_0x299b97['fieldName'],'type':_0x299b97['type'][_0x78f7('0x22')]};});_0x3f2997[_0x78f7('0x23')]=_[_0x78f7('0x24')](_0x22145f,_0x78f7('0x1f'));_0x3f2997[_0x78f7('0x25')]=_[_0x78f7('0x26')](_0x33a8d1[_0x78f7('0x25')]);_0x3f2997[_0x78f7('0x27')]=_[_0x78f7('0x28')](_0x3f2997[_0x78f7('0x23')],_0x3f2997[_0x78f7('0x25')]);_0x5be193['attributes']=_[_0x78f7('0x28')](_0x3f2997[_0x78f7('0x23')],qs[_0x78f7('0x29')](_0x33a8d1[_0x78f7('0x25')]['fields']));_0x5be193[_0x78f7('0x2a')]=_0x5be193[_0x78f7('0x2a')][_0x78f7('0x2b')]?_0x5be193['attributes']:_0x3f2997[_0x78f7('0x23')];if(!_0x33a8d1['query'][_0x78f7('0x2c')](_0x78f7('0x2d'))){_0x5be193['limit']=qs[_0x78f7('0x12')](_0x33a8d1[_0x78f7('0x25')][_0x78f7('0x12')]);_0x5be193[_0x78f7('0x11')]=qs[_0x78f7('0x11')](_0x33a8d1['query']['offset']);}_0x5be193[_0x78f7('0x2e')]=qs['sort'](_0x33a8d1['query']['sort']);_0x5be193[_0x78f7('0x2f')]=qs[_0x78f7('0x27')](_[_0x78f7('0x30')](_0x33a8d1[_0x78f7('0x25')],_0x3f2997['filters']),_0x22145f);if(_0x33a8d1[_0x78f7('0x25')][_0x78f7('0x31')]){_0x5be193[_0x78f7('0x2f')]=_[_0x78f7('0x32')](_0x5be193[_0x78f7('0x2f')],{'$or':_[_0x78f7('0x24')](_0x22145f,function(_0x1d6559){if(_0x1d6559[_0x78f7('0x33')]!=='VIRTUAL'){var _0x22d255={};_0x22d255[_0x1d6559['name']]={'$like':'%'+_0x33a8d1[_0x78f7('0x25')][_0x78f7('0x31')]+'%'};return _0x22d255;}})});}_0x5be193=_[_0x78f7('0x32')]({},_0x5be193,_0x33a8d1[_0x78f7('0x34')]);var _0x52293b={'where':_0x5be193[_0x78f7('0x2f')]};return db['SquareProject']['count'](_0x52293b)[_0x78f7('0x16')](function(_0x75ac4d){_0x3ec1b5['count']=_0x75ac4d;if(_0x33a8d1[_0x78f7('0x25')][_0x78f7('0x35')]){_0x5be193[_0x78f7('0x36')]=[{'all':!![]}];}return db['SquareProject'][_0x78f7('0x37')](_0x5be193);})[_0x78f7('0x16')](function(_0x5a0850){_0x3ec1b5['rows']=_0x5a0850;return _0x3ec1b5;})[_0x78f7('0x16')](respondWithFilteredResult(_0x3431d1,_0x5be193))[_0x78f7('0x38')](handleError(_0x3431d1,null));};exports['show']=function(_0xf7b18,_0x1ed93e){var _0x3957dc={'raw':![],'where':{'id':_0xf7b18[_0x78f7('0x39')]['id']}},_0x45fecc={};_0x45fecc[_0x78f7('0x23')]=_[_0x78f7('0x26')](db[_0x78f7('0x21')]['rawAttributes']);_0x45fecc[_0x78f7('0x25')]=_[_0x78f7('0x26')](_0xf7b18['query']);_0x45fecc[_0x78f7('0x27')]=_[_0x78f7('0x28')](_0x45fecc[_0x78f7('0x23')],_0x45fecc[_0x78f7('0x25')]);_0x3957dc[_0x78f7('0x2a')]=_[_0x78f7('0x28')](_0x45fecc[_0x78f7('0x23')],qs['fields'](_0xf7b18['query'][_0x78f7('0x29')]));_0x3957dc[_0x78f7('0x2a')]=_0x3957dc[_0x78f7('0x2a')][_0x78f7('0x2b')]?_0x3957dc[_0x78f7('0x2a')]:_0x45fecc['model'];if(_0xf7b18[_0x78f7('0x25')][_0x78f7('0x35')]){_0x3957dc[_0x78f7('0x36')]=[{'all':!![]}];}_0x3957dc=_['merge']({},_0x3957dc,_0xf7b18[_0x78f7('0x34')]);return db[_0x78f7('0x21')][_0x78f7('0x3a')](_0x3957dc)[_0x78f7('0x16')](handleEntityNotFound(_0x1ed93e,null))[_0x78f7('0x16')](respondWithResult(_0x1ed93e,null))[_0x78f7('0x38')](handleError(_0x1ed93e,null));};exports[_0x78f7('0x3b')]=function(_0x5ed8b8,_0x39a3ab){return db[_0x78f7('0x21')]['create'](_0x5ed8b8[_0x78f7('0x3c')],{})[_0x78f7('0x16')](function(_0x4dd1a1){var _0x2afb35=_0x5ed8b8[_0x78f7('0x3d')][_0x78f7('0x18')]({'plain':!![]});if(!_0x2afb35)throw new Error(_0x78f7('0x3e'));if(_0x2afb35[_0x78f7('0x3f')]===_0x78f7('0x3d')){var _0x15fa32=_0x4dd1a1[_0x78f7('0x18')]({'plain':!![]});var _0x421884=_0x78f7('0x19');return db[_0x78f7('0x40')][_0x78f7('0x3a')]({'where':{'name':_0x421884,'userProfileId':_0x2afb35['userProfileId']},'raw':!![]})[_0x78f7('0x16')](function(_0x24a00c){if(_0x24a00c&&_0x24a00c[_0x78f7('0x41')]===0x0){return db[_0x78f7('0x1a')]['create']({'name':_0x15fa32[_0x78f7('0x1f')],'resourceId':_0x15fa32['id'],'type':_0x24a00c['name'],'sectionId':_0x24a00c['id']},{})[_0x78f7('0x16')](function(){return _0x4dd1a1;});}else{return _0x4dd1a1;}})[_0x78f7('0x38')](function(_0x167273){logger[_0x78f7('0x1d')](_0x78f7('0x42'),_0x167273);throw _0x167273;});}return _0x4dd1a1;})[_0x78f7('0x16')](respondWithResult(_0x39a3ab,0xc9))['catch'](handleError(_0x39a3ab,null));};exports[_0x78f7('0x15')]=function(_0x7016ed,_0x216685){if(_0x7016ed[_0x78f7('0x3c')]['id']){delete _0x7016ed['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x7016ed[_0x78f7('0x39')]['id']}})['then'](handleEntityNotFound(_0x216685,null))['then'](saveUpdates(_0x7016ed[_0x78f7('0x3c')],null))['then'](function(_0x42236a){if(!_0x42236a)return;var _0x3e8559=_0x42236a[_0x78f7('0x18')]({'plain':!![]});return _0x3e8559;})['then'](function(_0x2ef7ae){var _0x320602=new Redis(config[_0x78f7('0x7')]);_0x320602[_0x78f7('0x1b')]('agi',JSON[_0x78f7('0x43')](_[_0x78f7('0x30')](_0x2ef7ae,['id','name',_0x78f7('0x44')])));return _0x2ef7ae;})[_0x78f7('0x16')](respondWithResult(_0x216685,null))[_0x78f7('0x38')](handleError(_0x216685,null));};exports[_0x78f7('0x17')]=function(_0x1dba3c,_0x2da3b0){return db['SquareProject'][_0x78f7('0x3a')]({'where':{'id':_0x1dba3c[_0x78f7('0x39')]['id']}})[_0x78f7('0x16')](handleEntityNotFound(_0x2da3b0,null))[_0x78f7('0x16')](removeEntity(_0x2da3b0,null))[_0x78f7('0x38')](handleError(_0x2da3b0,null));}; \ No newline at end of file +var _0x9d14=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SquareProject','includeAll','include','rows','params','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','agi','destroy','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','undefined','count','limit','status','set','Content-Range','update','then','get','UserProfileResource','stringify','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3c371a,_0x3893fa){var _0x1ad099=function(_0x5241f6){while(--_0x5241f6){_0x3c371a['push'](_0x3c371a['shift']());}};_0x1ad099(++_0x3893fa);}(_0x9d14,0xed));var _0x49d1=function(_0x220978,_0x26464b){_0x220978=_0x220978-0x0;var _0x1e01c7=_0x9d14[_0x220978];return _0x1e01c7;};'use strict';var _=require(_0x49d1('0x0'));var Redis=require(_0x49d1('0x1'));var qs=require(_0x49d1('0x2'));var logger=require(_0x49d1('0x3'))(_0x49d1('0x4'));var config=require('../../config/environment');var db=require(_0x49d1('0x5'))['db'];config[_0x49d1('0x6')]=_['defaults'](config[_0x49d1('0x6')],{'host':_0x49d1('0x7'),'port':0x18eb});var socket=require(_0x49d1('0x8'))(new Redis(config[_0x49d1('0x6')]));require(_0x49d1('0x9'))[_0x49d1('0xa')](socket);function respondWithResult(_0x5b4e52,_0x2f741a){_0x2f741a=_0x2f741a||0xc8;return function(_0x55d5fc){if(_0x55d5fc){return _0x5b4e52['status'](_0x2f741a)[_0x49d1('0xb')](_0x55d5fc);}};}function respondWithFilteredResult(_0x2c4012,_0x3cc7ad){return function(_0x400d6b){if(_0x400d6b){var _0x432383=typeof _0x3cc7ad[_0x49d1('0xc')]===_0x49d1('0xd')&&typeof _0x3cc7ad['limit']===_0x49d1('0xd');var _0x5415eb=_0x400d6b[_0x49d1('0xe')];var _0x30f990=_0x432383?0x0:_0x3cc7ad[_0x49d1('0xc')];var _0x27e981=_0x432383?_0x400d6b[_0x49d1('0xe')]:_0x3cc7ad[_0x49d1('0xc')]+_0x3cc7ad[_0x49d1('0xf')];var _0x4a9368;if(_0x27e981>=_0x5415eb){_0x27e981=_0x5415eb;_0x4a9368=0xc8;}else{_0x4a9368=0xce;}_0x2c4012[_0x49d1('0x10')](_0x4a9368);return _0x2c4012[_0x49d1('0x11')](_0x49d1('0x12'),_0x30f990+'-'+_0x27e981+'/'+_0x5415eb)[_0x49d1('0xb')](_0x400d6b);}return null;};}function saveUpdates(_0x177102){return function(_0x2c310d){if(_0x2c310d){return _0x2c310d[_0x49d1('0x13')](_0x177102)['then'](function(_0x2b17c4){return _0x2b17c4;});}return null;};}function removeEntity(_0x15707b){return function(_0x376a63){if(_0x376a63){return _0x376a63['destroy']()[_0x49d1('0x14')](function(){var _0x56870f=_0x376a63[_0x49d1('0x15')]({'plain':!![]});var _0x1bbfd0='SquareProjects';return db[_0x49d1('0x16')]['destroy']({'where':{'type':_0x1bbfd0,'resourceId':_0x56870f['id']}})[_0x49d1('0x14')](function(){return _0x376a63;});})[_0x49d1('0x14')](function(){var _0x487858=new Redis(config['redis']);_0x487858['publish']('agi',JSON[_0x49d1('0x17')]({'id':_0x376a63['id'],'deleted':!![]}));})[_0x49d1('0x14')](function(){_0x15707b[_0x49d1('0x10')](0xcc)[_0x49d1('0x18')]();});}};}function handleEntityNotFound(_0x63fa59){return function(_0x11aaf2){if(!_0x11aaf2){_0x63fa59[_0x49d1('0x19')](0x194);}return _0x11aaf2;};}function handleError(_0x45b24e,_0x89bbca){_0x89bbca=_0x89bbca||0x1f4;return function(_0x97d1eb){logger[_0x49d1('0x1a')](_0x97d1eb[_0x49d1('0x1b')]);if(_0x97d1eb[_0x49d1('0x1c')]){delete _0x97d1eb[_0x49d1('0x1c')];}_0x45b24e[_0x49d1('0x10')](_0x89bbca)[_0x49d1('0x1d')](_0x97d1eb);};}exports[_0x49d1('0x1e')]=function(_0x5c2666,_0x595817){var _0x27072c={},_0x51c93b={},_0xbeee6a={'count':0x0,'rows':[]};var _0x1d887c=_[_0x49d1('0x1f')](db['SquareProject'][_0x49d1('0x20')],function(_0x486748){return{'name':_0x486748['fieldName'],'type':_0x486748[_0x49d1('0x21')][_0x49d1('0x22')]};});_0x51c93b[_0x49d1('0x23')]=_['map'](_0x1d887c,_0x49d1('0x1c'));_0x51c93b[_0x49d1('0x24')]=_[_0x49d1('0x25')](_0x5c2666['query']);_0x51c93b[_0x49d1('0x26')]=_['intersection'](_0x51c93b[_0x49d1('0x23')],_0x51c93b[_0x49d1('0x24')]);_0x27072c[_0x49d1('0x27')]=_[_0x49d1('0x28')](_0x51c93b['model'],qs['fields'](_0x5c2666[_0x49d1('0x24')][_0x49d1('0x29')]));_0x27072c[_0x49d1('0x27')]=_0x27072c[_0x49d1('0x27')][_0x49d1('0x2a')]?_0x27072c[_0x49d1('0x27')]:_0x51c93b[_0x49d1('0x23')];if(!_0x5c2666['query'][_0x49d1('0x2b')](_0x49d1('0x2c'))){_0x27072c[_0x49d1('0xf')]=qs[_0x49d1('0xf')](_0x5c2666[_0x49d1('0x24')][_0x49d1('0xf')]);_0x27072c[_0x49d1('0xc')]=qs[_0x49d1('0xc')](_0x5c2666['query'][_0x49d1('0xc')]);}_0x27072c[_0x49d1('0x2d')]=qs[_0x49d1('0x2e')](_0x5c2666['query'][_0x49d1('0x2e')]);_0x27072c[_0x49d1('0x2f')]=qs['filters'](_[_0x49d1('0x30')](_0x5c2666[_0x49d1('0x24')],_0x51c93b[_0x49d1('0x26')]),_0x1d887c);if(_0x5c2666[_0x49d1('0x24')][_0x49d1('0x31')]){_0x27072c['where']=_[_0x49d1('0x32')](_0x27072c[_0x49d1('0x2f')],{'$or':_[_0x49d1('0x1f')](_0x1d887c,function(_0x274c6a){if(_0x274c6a['type']!=='VIRTUAL'){var _0x1d5e6d={};_0x1d5e6d[_0x274c6a[_0x49d1('0x1c')]]={'$like':'%'+_0x5c2666[_0x49d1('0x24')]['filter']+'%'};return _0x1d5e6d;}})});}_0x27072c=_[_0x49d1('0x32')]({},_0x27072c,_0x5c2666[_0x49d1('0x33')]);var _0x4e5a83={'where':_0x27072c[_0x49d1('0x2f')]};return db[_0x49d1('0x34')][_0x49d1('0xe')](_0x4e5a83)[_0x49d1('0x14')](function(_0x554a2f){_0xbeee6a['count']=_0x554a2f;if(_0x5c2666['query'][_0x49d1('0x35')]){_0x27072c[_0x49d1('0x36')]=[{'all':!![]}];}return db[_0x49d1('0x34')]['findAll'](_0x27072c);})[_0x49d1('0x14')](function(_0x37862c){_0xbeee6a[_0x49d1('0x37')]=_0x37862c;return _0xbeee6a;})[_0x49d1('0x14')](respondWithFilteredResult(_0x595817,_0x27072c))['catch'](handleError(_0x595817,null));};exports['show']=function(_0x5c3c4c,_0x4d5647){var _0x37d05e={'raw':![],'where':{'id':_0x5c3c4c[_0x49d1('0x38')]['id']}},_0x20345f={};_0x20345f[_0x49d1('0x23')]=_[_0x49d1('0x25')](db[_0x49d1('0x34')][_0x49d1('0x20')]);_0x20345f['query']=_[_0x49d1('0x25')](_0x5c3c4c[_0x49d1('0x24')]);_0x20345f[_0x49d1('0x26')]=_[_0x49d1('0x28')](_0x20345f['model'],_0x20345f[_0x49d1('0x24')]);_0x37d05e[_0x49d1('0x27')]=_[_0x49d1('0x28')](_0x20345f[_0x49d1('0x23')],qs[_0x49d1('0x29')](_0x5c3c4c[_0x49d1('0x24')]['fields']));_0x37d05e['attributes']=_0x37d05e['attributes'][_0x49d1('0x2a')]?_0x37d05e[_0x49d1('0x27')]:_0x20345f[_0x49d1('0x23')];if(_0x5c3c4c[_0x49d1('0x24')][_0x49d1('0x35')]){_0x37d05e[_0x49d1('0x36')]=[{'all':!![]}];}_0x37d05e=_[_0x49d1('0x32')]({},_0x37d05e,_0x5c3c4c[_0x49d1('0x33')]);return db['SquareProject'][_0x49d1('0x39')](_0x37d05e)[_0x49d1('0x14')](handleEntityNotFound(_0x4d5647,null))[_0x49d1('0x14')](respondWithResult(_0x4d5647,null))[_0x49d1('0x3a')](handleError(_0x4d5647,null));};exports['create']=function(_0x3f701e,_0x578653){return db[_0x49d1('0x34')]['create'](_0x3f701e[_0x49d1('0x3b')],{})[_0x49d1('0x14')](function(_0x5535f2){var _0x515533=_0x3f701e[_0x49d1('0x3c')]['get']({'plain':!![]});if(!_0x515533)throw new Error(_0x49d1('0x3d'));if(_0x515533[_0x49d1('0x3e')]==='user'){var _0x2d168a=_0x5535f2[_0x49d1('0x15')]({'plain':!![]});var _0x57e436=_0x49d1('0x3f');return db[_0x49d1('0x40')][_0x49d1('0x39')]({'where':{'name':_0x57e436,'userProfileId':_0x515533[_0x49d1('0x41')]},'raw':!![]})[_0x49d1('0x14')](function(_0x44f7aa){if(_0x44f7aa&&_0x44f7aa[_0x49d1('0x42')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d168a['name'],'resourceId':_0x2d168a['id'],'type':_0x44f7aa['name'],'sectionId':_0x44f7aa['id']},{})[_0x49d1('0x14')](function(){return _0x5535f2;});}else{return _0x5535f2;}})[_0x49d1('0x3a')](function(_0x3173bc){logger[_0x49d1('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3173bc);throw _0x3173bc;});}return _0x5535f2;})[_0x49d1('0x14')](respondWithResult(_0x578653,0xc9))[_0x49d1('0x3a')](handleError(_0x578653,null));};exports[_0x49d1('0x13')]=function(_0x5534fe,_0x29b546){if(_0x5534fe[_0x49d1('0x3b')]['id']){delete _0x5534fe[_0x49d1('0x3b')]['id'];}return db['SquareProject'][_0x49d1('0x39')]({'where':{'id':_0x5534fe[_0x49d1('0x38')]['id']}})[_0x49d1('0x14')](handleEntityNotFound(_0x29b546,null))[_0x49d1('0x14')](saveUpdates(_0x5534fe[_0x49d1('0x3b')],null))[_0x49d1('0x14')](function(_0x4cb9e3){if(!_0x4cb9e3)return;var _0x225257=_0x4cb9e3[_0x49d1('0x15')]({'plain':!![]});return _0x225257;})[_0x49d1('0x14')](function(_0x5b6ece){var _0x260d1e=new Redis(config[_0x49d1('0x6')]);_0x260d1e['publish'](_0x49d1('0x43'),JSON[_0x49d1('0x17')](_[_0x49d1('0x30')](_0x5b6ece,['id','name','production'])));return _0x5b6ece;})[_0x49d1('0x14')](respondWithResult(_0x29b546,null))[_0x49d1('0x3a')](handleError(_0x29b546,null));};exports[_0x49d1('0x44')]=function(_0x3a4871,_0xa6c572){return db[_0x49d1('0x34')][_0x49d1('0x39')]({'where':{'id':_0x3a4871[_0x49d1('0x38')]['id']}})[_0x49d1('0x14')](handleEntityNotFound(_0xa6c572,null))['then'](removeEntity(_0xa6c572,null))[_0x49d1('0x3a')](handleError(_0xa6c572,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ad5398e..31d105f 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 _0x2f26=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x34346e,_0x202a30){var _0xc657a7=function(_0x283b1a){while(--_0x283b1a){_0x34346e['push'](_0x34346e['shift']());}};_0xc657a7(++_0x202a30);}(_0x2f26,0x1cc));var _0x62f2=function(_0x4079f0,_0x2b48bf){_0x4079f0=_0x4079f0-0x0;var _0x447773=_0x2f26[_0x4079f0];return _0x447773;};'use strict';var EventEmitter=require(_0x62f2('0x0'));var SquareProject=require(_0x62f2('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x62f2('0x2')](0x0);var events={'afterCreate':_0x62f2('0x3'),'afterUpdate':_0x62f2('0x4'),'afterDestroy':_0x62f2('0x5')};function emitEvent(_0x4cbc19){return function(_0x5a2a89,_0x258663,_0x5875f7){SquareProjectEvents['emit'](_0x4cbc19+':'+_0x5a2a89['id'],_0x5a2a89);SquareProjectEvents[_0x62f2('0x6')](_0x4cbc19,_0x5a2a89);_0x5875f7(null);};}for(var e in events){if(events[_0x62f2('0x7')](e)){var event=events[e];SquareProject[_0x62f2('0x8')](e,emitEvent(event));}}module[_0x62f2('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x1029=['remove','emit','hasOwnProperty','exports','events','SquareProject','setMaxListeners','update'];(function(_0x1f3f77,_0x2119d4){var _0x5a3835=function(_0x4e100d){while(--_0x4e100d){_0x1f3f77['push'](_0x1f3f77['shift']());}};_0x5a3835(++_0x2119d4);}(_0x1029,0x19c));var _0x9102=function(_0x41a71f,_0x4ba927){_0x41a71f=_0x41a71f-0x0;var _0xf5f37e=_0x1029[_0x41a71f];return _0xf5f37e;};'use strict';var EventEmitter=require(_0x9102('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x9102('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9102('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9102('0x3'),'afterDestroy':_0x9102('0x4')};function emitEvent(_0xef20d2){return function(_0x3b4669,_0x4ba695,_0x2f76ca){SquareProjectEvents[_0x9102('0x5')](_0xef20d2+':'+_0x3b4669['id'],_0x3b4669);SquareProjectEvents[_0x9102('0x5')](_0xef20d2,_0x3b4669);_0x2f76ca(null);};}for(var e in events){if(events[_0x9102('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x9102('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a50fc32..6e77eeb 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 _0x009d=['SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x2831d,_0x588a14){var _0x338c06=function(_0x3d4a16){while(--_0x3d4a16){_0x2831d['push'](_0x2831d['shift']());}};_0x338c06(++_0x588a14);}(_0x009d,0xe0));var _0xd009=function(_0x4a9a40,_0x44ffe3){_0x4a9a40=_0x4a9a40-0x0;var _0x216d12=_0x009d[_0x4a9a40];return _0x216d12;};'use strict';var _=require(_0xd009('0x0'));var util=require(_0xd009('0x1'));var logger=require(_0xd009('0x2'))(_0xd009('0x3'));var moment=require(_0xd009('0x4'));var BPromise=require('bluebird');var rp=require(_0xd009('0x5'));var fs=require('fs');var path=require(_0xd009('0x6'));var rimraf=require(_0xd009('0x7'));var config=require(_0xd009('0x8'));var attributes=require('./squareProject.attributes');module['exports']=function(_0xb9c5b4,_0x3bfbc6){return _0xb9c5b4[_0xd009('0x9')](_0xd009('0xa'),attributes,{'tableName':_0xd009('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28fc9a,_0x73a66e,_0x59b997){if(_0x28fc9a[_0xd009('0xc')](_0xd009('0xd'))){_0x28fc9a[_0xd009('0xe')]=moment()[_0xd009('0xf')](_0xd009('0x10'));}if(_0x28fc9a[_0xd009('0xc')](_0xd009('0x11'))){_0x28fc9a['publishedAt']=moment()[_0xd009('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x59b997(null,_0x28fc9a);}}});}; \ No newline at end of file +var _0x3c9e=['exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4bcf44,_0xe728bf){var _0xec23d3=function(_0x1cb13a){while(--_0x1cb13a){_0x4bcf44['push'](_0x4bcf44['shift']());}};_0xec23d3(++_0xe728bf);}(_0x3c9e,0xa2));var _0xe3c9=function(_0x3c729b,_0x2a4146){_0x3c729b=_0x3c729b-0x0;var _0x55894c=_0x3c9e[_0x3c729b];return _0x55894c;};'use strict';var _=require(_0xe3c9('0x0'));var util=require(_0xe3c9('0x1'));var logger=require(_0xe3c9('0x2'))(_0xe3c9('0x3'));var moment=require(_0xe3c9('0x4'));var BPromise=require(_0xe3c9('0x5'));var rp=require(_0xe3c9('0x6'));var fs=require('fs');var path=require(_0xe3c9('0x7'));var rimraf=require(_0xe3c9('0x8'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xe3c9('0x9')]=function(_0x5dda89,_0x3fd58d){return _0x5dda89[_0xe3c9('0xa')](_0xe3c9('0xb'),attributes,{'tableName':_0xe3c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36da0d,_0x2c91fd,_0x6655c2){if(_0x36da0d[_0xe3c9('0xd')](_0xe3c9('0xe'))){_0x36da0d[_0xe3c9('0xf')]=moment()[_0xe3c9('0x10')](_0xe3c9('0x11'));}if(_0x36da0d[_0xe3c9('0xd')]('production')){_0x36da0d[_0xe3c9('0x12')]=moment()[_0xe3c9('0x10')](_0xe3c9('0x11'));}_0x6655c2(null,_0x36da0d);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index bc4a65d..1e0743a 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 _0xf418=['error','message','ShowSquareProject','stringify','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','raw','options','where','attributes','limit','map','include','model','then','info','debug','catch'];(function(_0x40541a,_0x599511){var _0x968a3e=function(_0x3e8f6d){while(--_0x3e8f6d){_0x40541a['push'](_0x40541a['shift']());}};_0x968a3e(++_0x599511);}(_0xf418,0xc8));var _0x8f41=function(_0x30d8bd,_0x153d73){_0x30d8bd=_0x30d8bd-0x0;var _0x17f7ad=_0xf418[_0x30d8bd];return _0x17f7ad;};'use strict';var _=require(_0x8f41('0x0'));var Redis=require('ioredis');var db=require(_0x8f41('0x1'))['db'];var logger=require(_0x8f41('0x2'))(_0x8f41('0x3'));var config=require(_0x8f41('0x4'));config['redis']=_['defaults'](config[_0x8f41('0x5')],{'host':_0x8f41('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f41('0x5')]));require(_0x8f41('0x7'))[_0x8f41('0x8')](socket);exports[_0x8f41('0x9')]=function(_0x41a00a){var _0x1f2ced=this;return new Promise(function(_0x5440ef,_0x3c15d9){return db[_0x8f41('0xa')][_0x8f41('0xb')]({'raw':_0x41a00a['options']?_0x41a00a['options'][_0x8f41('0xc')]===undefined?!![]:![]:!![],'where':_0x41a00a[_0x8f41('0xd')]?_0x41a00a[_0x8f41('0xd')][_0x8f41('0xe')]||null:null,'attributes':_0x41a00a[_0x8f41('0xd')]?_0x41a00a[_0x8f41('0xd')][_0x8f41('0xf')]||null:null,'limit':_0x41a00a[_0x8f41('0xd')]?_0x41a00a[_0x8f41('0xd')][_0x8f41('0x10')]||null:null,'include':_0x41a00a[_0x8f41('0xd')]?_0x41a00a[_0x8f41('0xd')]['include']?_[_0x8f41('0x11')](_0x41a00a[_0x8f41('0xd')][_0x8f41('0x12')],function(_0x478439){return{'model':db[_0x478439[_0x8f41('0x13')]],'as':_0x478439['as'],'attributes':_0x478439[_0x8f41('0xf')],'include':_0x478439['include']?_[_0x8f41('0x11')](_0x478439['include'],function(_0xaf12ea){return{'model':db[_0xaf12ea[_0x8f41('0x13')]],'as':_0xaf12ea['as'],'attributes':_0xaf12ea[_0x8f41('0xf')],'include':_0xaf12ea['include']?_[_0x8f41('0x11')](_0xaf12ea[_0x8f41('0x12')],function(_0xe8ee7f){return{'model':db[_0xe8ee7f[_0x8f41('0x13')]],'as':_0xe8ee7f['as'],'attributes':_0xe8ee7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f41('0x14')](function(_0x5aa8ac){logger[_0x8f41('0x15')](_0x8f41('0x9'),_0x41a00a);logger[_0x8f41('0x16')]('GetSquareProjects',_0x41a00a,JSON['stringify'](_0x5aa8ac));_0x5440ef(_0x5aa8ac);})[_0x8f41('0x17')](function(_0x35939d){logger[_0x8f41('0x18')](_0x8f41('0x9'),_0x35939d[_0x8f41('0x19')],_0x41a00a);_0x3c15d9(_0x1f2ced[_0x8f41('0x18')](0x1f4,_0x35939d['message']));});});};exports['ShowSquareProject']=function(_0x77740c){var _0x503891=this;return new Promise(function(_0x46105a,_0x3490e3){return db['SquareProject']['find']({'raw':_0x77740c[_0x8f41('0xd')]?_0x77740c[_0x8f41('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x77740c['options']?_0x77740c[_0x8f41('0xd')][_0x8f41('0xe')]||null:null,'attributes':_0x77740c['options']?_0x77740c[_0x8f41('0xd')][_0x8f41('0xf')]||null:null,'include':_0x77740c[_0x8f41('0xd')]?_0x77740c[_0x8f41('0xd')][_0x8f41('0x12')]?_['map'](_0x77740c[_0x8f41('0xd')][_0x8f41('0x12')],function(_0xe80625){return{'model':db[_0xe80625[_0x8f41('0x13')]],'as':_0xe80625['as'],'attributes':_0xe80625['attributes'],'include':_0xe80625[_0x8f41('0x12')]?_[_0x8f41('0x11')](_0xe80625[_0x8f41('0x12')],function(_0xf8bbcb){return{'model':db[_0xf8bbcb['model']],'as':_0xf8bbcb['as'],'attributes':_0xf8bbcb['attributes'],'include':_0xf8bbcb['include']?_[_0x8f41('0x11')](_0xf8bbcb['include'],function(_0x523fa0){return{'model':db[_0x523fa0[_0x8f41('0x13')]],'as':_0x523fa0['as'],'attributes':_0x523fa0[_0x8f41('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fe428){logger[_0x8f41('0x15')](_0x8f41('0x1a'),_0x77740c);logger['debug']('ShowSquareProject',_0x77740c,JSON[_0x8f41('0x1b')](_0x1fe428));_0x46105a(_0x1fe428);})['catch'](function(_0x85a41){logger['error'](_0x8f41('0x1a'),_0x85a41[_0x8f41('0x19')],_0x77740c);_0x3490e3(_0x503891['error'](0x1f4,_0x85a41[_0x8f41('0x19')]));});});}; \ No newline at end of file +var _0xb5f4=['ShowSquareProject','SquareProject','find','raw','stringify','catch','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','./squareProject.socket','options','where','attributes','limit','include','model','map','then','GetSquareProjects','debug','error','message'];(function(_0x3e56c7,_0x334c9b){var _0x4fef94=function(_0x4604fb){while(--_0x4604fb){_0x3e56c7['push'](_0x3e56c7['shift']());}};_0x4fef94(++_0x334c9b);}(_0xb5f4,0x186));var _0x4b5f=function(_0x389f53,_0x38d52d){_0x389f53=_0x389f53-0x0;var _0x2e641a=_0xb5f4[_0x389f53];return _0x2e641a;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x4b5f('0x0'))['db'];var logger=require(_0x4b5f('0x1'))('rpc');var config=require(_0x4b5f('0x2'));config[_0x4b5f('0x3')]=_[_0x4b5f('0x4')](config[_0x4b5f('0x3')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b5f('0x3')]));require(_0x4b5f('0x5'))['register'](socket);exports['GetSquareProjects']=function(_0x4e516f){var _0x2330e2=this;return new Promise(function(_0x5b6c3b,_0x222085){return db['SquareProject']['findAll']({'raw':_0x4e516f[_0x4b5f('0x6')]?_0x4e516f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e516f[_0x4b5f('0x6')]?_0x4e516f[_0x4b5f('0x6')][_0x4b5f('0x7')]||null:null,'attributes':_0x4e516f[_0x4b5f('0x6')]?_0x4e516f[_0x4b5f('0x6')][_0x4b5f('0x8')]||null:null,'limit':_0x4e516f[_0x4b5f('0x6')]?_0x4e516f[_0x4b5f('0x6')][_0x4b5f('0x9')]||null:null,'include':_0x4e516f[_0x4b5f('0x6')]?_0x4e516f['options'][_0x4b5f('0xa')]?_['map'](_0x4e516f[_0x4b5f('0x6')][_0x4b5f('0xa')],function(_0x4024bb){return{'model':db[_0x4024bb[_0x4b5f('0xb')]],'as':_0x4024bb['as'],'attributes':_0x4024bb[_0x4b5f('0x8')],'include':_0x4024bb['include']?_[_0x4b5f('0xc')](_0x4024bb[_0x4b5f('0xa')],function(_0xba29da){return{'model':db[_0xba29da[_0x4b5f('0xb')]],'as':_0xba29da['as'],'attributes':_0xba29da[_0x4b5f('0x8')],'include':_0xba29da[_0x4b5f('0xa')]?_[_0x4b5f('0xc')](_0xba29da[_0x4b5f('0xa')],function(_0x4ce98a){return{'model':db[_0x4ce98a[_0x4b5f('0xb')]],'as':_0x4ce98a['as'],'attributes':_0x4ce98a['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b5f('0xd')](function(_0xf5c02d){logger['info'](_0x4b5f('0xe'),_0x4e516f);logger[_0x4b5f('0xf')]('GetSquareProjects',_0x4e516f,JSON['stringify'](_0xf5c02d));_0x5b6c3b(_0xf5c02d);})['catch'](function(_0x71cb79){logger[_0x4b5f('0x10')](_0x4b5f('0xe'),_0x71cb79[_0x4b5f('0x11')],_0x4e516f);_0x222085(_0x2330e2[_0x4b5f('0x10')](0x1f4,_0x71cb79[_0x4b5f('0x11')]));});});};exports[_0x4b5f('0x12')]=function(_0x44f5af){var _0x3fef9=this;return new Promise(function(_0x3ae96e,_0x1c8ef5){return db[_0x4b5f('0x13')][_0x4b5f('0x14')]({'raw':_0x44f5af[_0x4b5f('0x6')]?_0x44f5af['options'][_0x4b5f('0x15')]===undefined?!![]:![]:!![],'where':_0x44f5af['options']?_0x44f5af[_0x4b5f('0x6')][_0x4b5f('0x7')]||null:null,'attributes':_0x44f5af['options']?_0x44f5af['options'][_0x4b5f('0x8')]||null:null,'include':_0x44f5af[_0x4b5f('0x6')]?_0x44f5af['options'][_0x4b5f('0xa')]?_[_0x4b5f('0xc')](_0x44f5af[_0x4b5f('0x6')]['include'],function(_0x48f1c7){return{'model':db[_0x48f1c7[_0x4b5f('0xb')]],'as':_0x48f1c7['as'],'attributes':_0x48f1c7['attributes'],'include':_0x48f1c7[_0x4b5f('0xa')]?_['map'](_0x48f1c7[_0x4b5f('0xa')],function(_0x3931ec){return{'model':db[_0x3931ec[_0x4b5f('0xb')]],'as':_0x3931ec['as'],'attributes':_0x3931ec['attributes'],'include':_0x3931ec[_0x4b5f('0xa')]?_[_0x4b5f('0xc')](_0x3931ec[_0x4b5f('0xa')],function(_0x49a1e2){return{'model':db[_0x49a1e2[_0x4b5f('0xb')]],'as':_0x49a1e2['as'],'attributes':_0x49a1e2[_0x4b5f('0x8')]};}):[]};}):[]};}):[]:[]})[_0x4b5f('0xd')](function(_0x8421df){logger['info'](_0x4b5f('0x12'),_0x44f5af);logger[_0x4b5f('0xf')](_0x4b5f('0x12'),_0x44f5af,JSON[_0x4b5f('0x16')](_0x8421df));_0x3ae96e(_0x8421df);})[_0x4b5f('0x17')](function(_0x100971){logger[_0x4b5f('0x10')]('ShowSquareProject',_0x100971[_0x4b5f('0x11')],_0x44f5af);_0x1c8ef5(_0x3fef9[_0x4b5f('0x10')](0x1f4,_0x100971[_0x4b5f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8c402e5..0a35cac 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 _0x63dd=['save','remove','update','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0x5e8680,_0xbdeb4e){var _0x3f070c=function(_0x34b1a0){while(--_0x34b1a0){_0x5e8680['push'](_0x5e8680['shift']());}};_0x3f070c(++_0xbdeb4e);}(_0x63dd,0x19f));var _0xd63d=function(_0x435eca,_0x4c462c){_0x435eca=_0x435eca-0x0;var _0x39d552=_0x63dd[_0x435eca];return _0x39d552;};'use strict';var SquareProjectEvents=require(_0xd63d('0x0'));var events=[_0xd63d('0x1'),_0xd63d('0x2'),_0xd63d('0x3')];function createListener(_0x10b4fc,_0x32db09){return function(_0x4f4efb){_0x32db09[_0xd63d('0x4')](_0x10b4fc,_0x4f4efb);};}function removeListener(_0x298ecd,_0x375fb9){return function(){SquareProjectEvents[_0xd63d('0x5')](_0x298ecd,_0x375fb9);};}exports[_0xd63d('0x6')]=function(_0x2dc764){for(var _0x2d82e0=0x0,_0xf8a9bf=events['length'];_0x2d82e0<_0xf8a9bf;_0x2d82e0++){var _0x57d3a9=events[_0x2d82e0];var _0x2ab57d=createListener(_0xd63d('0x7')+_0x57d3a9,_0x2dc764);SquareProjectEvents['on'](_0x57d3a9,_0x2ab57d);}}; \ No newline at end of file +var _0x609e=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x1be6de,_0x2f7cfb){var _0x3ea77d=function(_0x561416){while(--_0x561416){_0x1be6de['push'](_0x1be6de['shift']());}};_0x3ea77d(++_0x2f7cfb);}(_0x609e,0xbc));var _0xe609=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x609e[_0x1035c1];return _0x308d67;};'use strict';var SquareProjectEvents=require(_0xe609('0x0'));var events=[_0xe609('0x1'),_0xe609('0x2'),_0xe609('0x3')];function createListener(_0x4fd779,_0x544201){return function(_0x3f195f){_0x544201[_0xe609('0x4')](_0x4fd779,_0x3f195f);};}function removeListener(_0x462471,_0x17e2da){return function(){SquareProjectEvents[_0xe609('0x5')](_0x462471,_0x17e2da);};}exports[_0xe609('0x6')]=function(_0x25ad66){for(var _0xd71f29=0x0,_0x31f6fc=events[_0xe609('0x7')];_0xd71f29<_0x31f6fc;_0xd71f29++){var _0x5195ea=events[_0xd71f29];var _0x5b5714=createListener(_0xe609('0x8')+_0x5195ea,_0x25ad66);SquareProjectEvents['on'](_0x5195ea,_0x5b5714);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f029111..ac7665e 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x4442bc,_0x28f5e1){var _0x3d6ffd=function(_0x1b0d8a){while(--_0x1b0d8a){_0x4442bc['push'](_0x4442bc['shift']());}};_0x3d6ffd(++_0x28f5e1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4bc764,_0x29a439){_0x4bc764=_0x4bc764-0x0;var _0x3b240b=_0x7fbe[_0x4bc764];return _0x3b240b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x29bb37,_0x25360b){var _0x2a3543=function(_0x47a589){while(--_0x47a589){_0x29bb37['push'](_0x29bb37['shift']());}};_0x2a3543(++_0x25360b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4c3593,_0x4ea381){_0x4c3593=_0x4c3593-0x0;var _0x1172d1=_0x7fbe[_0x4c3593];return _0x1172d1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('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 c874cd8..309616d 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 _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x132211,_0x428a27){var _0x2aa8e2=function(_0x1ecf7d){while(--_0x1ecf7d){_0x132211['push'](_0x132211['shift']());}};_0x2aa8e2(++_0x428a27);}(_0x814b,0x1a2));var _0xb814=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0x814b[_0x3f578f];return _0x32c754;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file +var _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x36147b,_0x57f40b){var _0x141351=function(_0x219aa1){while(--_0x219aa1){_0x36147b['push'](_0x36147b['shift']());}};_0x141351(++_0x57f40b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x434f13,_0x30e19d){_0x434f13=_0x434f13-0x0;var _0x100160=_0x9c5a[_0x434f13];return _0x100160;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c5ae7e1..78869cd 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 _0xf60d=['moment','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','length','includeAll','options','find','create','body','../../components/encryptor','uniqueid','params','savePath','%s.cypher','decryptFile','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','filename','extname','message','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf60d,0xb1));var _0xdf60=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xf60d[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require(_0xdf60('0x0'));var rimraf=require(_0xdf60('0x1'));var zipdir=require(_0xdf60('0x2'));var jsonpatch=require(_0xdf60('0x3'));var rp=require(_0xdf60('0x4'));var moment=require(_0xdf60('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf60('0x6'));var path=require('path');var sox=require(_0xdf60('0x7'));var csv=require(_0xdf60('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf60('0x9'));var _=require(_0xdf60('0xa'));var squel=require(_0xdf60('0xb'));var crypto=require('crypto');var jsforce=require(_0xdf60('0xc'));var deskjs=require(_0xdf60('0xd'));var toCsv=require(_0xdf60('0x8'));var querystring=require(_0xdf60('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf60('0xf'));var hardwareService=require(_0xdf60('0x10'));var logger=require(_0xdf60('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xdf60('0x12'));var licenseUtil=require(_0xdf60('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371492,_0x5cb96b){_0x5cb96b=_0x5cb96b||0xcc;return function(_0x5b46a2){if(_0x5b46a2){return _0x371492['sendStatus'](_0x5cb96b);}return _0x371492[_0xdf60('0x14')](_0x5cb96b)[_0xdf60('0x15')]();};}function respondWithResult(_0x294092,_0xb63eeb){_0xb63eeb=_0xb63eeb||0xc8;return function(_0x43c7b3){if(_0x43c7b3){return _0x294092[_0xdf60('0x14')](_0xb63eeb)['json'](_0x43c7b3);}};}function respondWithFilteredResult(_0xab276e,_0xdb6b9f){return function(_0x10975f){if(_0x10975f){var _0x362567=typeof _0xdb6b9f['offset']==='undefined'&&typeof _0xdb6b9f[_0xdf60('0x16')]===_0xdf60('0x17');var _0xc2b13a=_0x10975f[_0xdf60('0x18')];var _0x54aae0=_0x362567?0x0:_0xdb6b9f['offset'];var _0x543179=_0x362567?_0x10975f[_0xdf60('0x18')]:_0xdb6b9f[_0xdf60('0x19')]+_0xdb6b9f[_0xdf60('0x16')];var _0x3184de;if(_0x543179>=_0xc2b13a){_0x543179=_0xc2b13a;_0x3184de=0xc8;}else{_0x3184de=0xce;}_0xab276e['status'](_0x3184de);return _0xab276e[_0xdf60('0x1a')](_0xdf60('0x1b'),_0x54aae0+'-'+_0x543179+'/'+_0xc2b13a)[_0xdf60('0x1c')](_0x10975f);}return null;};}function patchUpdates(_0x261a61){return function(_0x5bf53e){try{jsonpatch[_0xdf60('0x1d')](_0x5bf53e,_0x261a61,!![]);}catch(_0x2f7a67){return BPromise[_0xdf60('0x1e')](_0x2f7a67);}return _0x5bf53e[_0xdf60('0x1f')]();};}function saveUpdates(_0x156937,_0x185b73){return function(_0x550609){if(_0x550609){return _0x550609[_0xdf60('0x20')](_0x156937)[_0xdf60('0x21')](function(_0x2b32fa){return _0x2b32fa;});}return null;};}function removeEntity(_0x448763,_0x3509a5){return function(_0x4c41f8){if(_0x4c41f8){return _0x4c41f8['destroy']()[_0xdf60('0x21')](function(){_0x448763[_0xdf60('0x14')](0xcc)[_0xdf60('0x15')]();});}};}function handleEntityNotFound(_0x3bcd02,_0x2e88c6){return function(_0x161075){if(!_0x161075){_0x3bcd02[_0xdf60('0x22')](0x194);}return _0x161075;};}function handleError(_0x424119,_0x4822a8){_0x4822a8=_0x4822a8||0x1f4;return function(_0x1c19ad){logger['error'](_0x1c19ad['stack']);if(_0x1c19ad['name']){delete _0x1c19ad[_0xdf60('0x23')];}_0x424119['status'](_0x4822a8)[_0xdf60('0x24')](_0x1c19ad);};}exports[_0xdf60('0x25')]=function(_0x33db8a,_0x39a71d){var _0x39a2aa={},_0x1c6461={},_0x2c2977={'count':0x0,'rows':[]};var _0x3cf0f0=_['map'](db[_0xdf60('0x26')][_0xdf60('0x27')],function(_0x2e62fb){return{'name':_0x2e62fb[_0xdf60('0x28')],'type':_0x2e62fb[_0xdf60('0x29')][_0xdf60('0x2a')]};});_0x1c6461[_0xdf60('0x2b')]=_[_0xdf60('0x2c')](_0x3cf0f0,'name');_0x1c6461[_0xdf60('0x2d')]=_[_0xdf60('0x2e')](_0x33db8a[_0xdf60('0x2d')]);_0x1c6461[_0xdf60('0x2f')]=_[_0xdf60('0x30')](_0x1c6461[_0xdf60('0x2b')],_0x1c6461[_0xdf60('0x2d')]);_0x39a2aa[_0xdf60('0x31')]=_[_0xdf60('0x30')](_0x1c6461[_0xdf60('0x2b')],qs[_0xdf60('0x32')](_0x33db8a['query'][_0xdf60('0x32')]));_0x39a2aa['attributes']=_0x39a2aa[_0xdf60('0x31')]['length']?_0x39a2aa[_0xdf60('0x31')]:_0x1c6461[_0xdf60('0x2b')];if(!_0x33db8a[_0xdf60('0x2d')][_0xdf60('0x33')](_0xdf60('0x34'))){_0x39a2aa[_0xdf60('0x16')]=qs['limit'](_0x33db8a[_0xdf60('0x2d')][_0xdf60('0x16')]);_0x39a2aa[_0xdf60('0x19')]=qs['offset'](_0x33db8a['query'][_0xdf60('0x19')]);}_0x39a2aa[_0xdf60('0x35')]=qs[_0xdf60('0x36')](_0x33db8a[_0xdf60('0x2d')][_0xdf60('0x36')]);_0x39a2aa['where']=qs[_0xdf60('0x2f')](_[_0xdf60('0x37')](_0x33db8a[_0xdf60('0x2d')],_0x1c6461['filters']),_0x3cf0f0);if(_0x33db8a[_0xdf60('0x2d')][_0xdf60('0x38')]){_0x39a2aa[_0xdf60('0x39')]=_[_0xdf60('0x3a')](_0x39a2aa[_0xdf60('0x39')],{'$or':_['map'](_0x3cf0f0,function(_0x2e9437){if(_0x2e9437['type']!==_0xdf60('0x3b')){var _0x21b2ae={};_0x21b2ae[_0x2e9437[_0xdf60('0x23')]]={'$like':'%'+_0x33db8a[_0xdf60('0x2d')][_0xdf60('0x38')]+'%'};return _0x21b2ae;}})});}_0x39a2aa=_[_0xdf60('0x3a')]({},_0x39a2aa,_0x33db8a['options']);var _0x2c1dbe={'where':_0x39a2aa['where']};return db[_0xdf60('0x26')]['count'](_0x2c1dbe)[_0xdf60('0x21')](function(_0x5554de){_0x2c2977['count']=_0x5554de;if(_0x33db8a[_0xdf60('0x2d')]['includeAll']){_0x39a2aa[_0xdf60('0x3c')]=[{'all':!![]}];}return db[_0xdf60('0x26')][_0xdf60('0x3d')](_0x39a2aa);})[_0xdf60('0x21')](function(_0x2fd575){_0x2c2977[_0xdf60('0x3e')]=_0x2fd575;return _0x2c2977;})['then'](respondWithFilteredResult(_0x39a71d,_0x39a2aa))[_0xdf60('0x3f')](handleError(_0x39a71d,null));};exports['show']=function(_0x17f6f4,_0x45e37f){var _0x59e8e5={'raw':!![],'where':{'id':_0x17f6f4['params']['id']}},_0x3d085c={};_0x3d085c[_0xdf60('0x2b')]=_['keys'](db[_0xdf60('0x26')][_0xdf60('0x27')]);_0x3d085c[_0xdf60('0x2d')]=_['keys'](_0x17f6f4[_0xdf60('0x2d')]);_0x3d085c[_0xdf60('0x2f')]=_[_0xdf60('0x30')](_0x3d085c[_0xdf60('0x2b')],_0x3d085c[_0xdf60('0x2d')]);_0x59e8e5[_0xdf60('0x31')]=_[_0xdf60('0x30')](_0x3d085c['model'],qs['fields'](_0x17f6f4[_0xdf60('0x2d')][_0xdf60('0x32')]));_0x59e8e5[_0xdf60('0x31')]=_0x59e8e5['attributes'][_0xdf60('0x40')]?_0x59e8e5['attributes']:_0x3d085c[_0xdf60('0x2b')];if(_0x17f6f4[_0xdf60('0x2d')][_0xdf60('0x41')]){_0x59e8e5[_0xdf60('0x3c')]=[{'all':!![]}];}_0x59e8e5=_['merge']({},_0x59e8e5,_0x17f6f4[_0xdf60('0x42')]);return db[_0xdf60('0x26')][_0xdf60('0x43')](_0x59e8e5)[_0xdf60('0x21')](handleEntityNotFound(_0x45e37f,null))[_0xdf60('0x21')](respondWithResult(_0x45e37f,null))[_0xdf60('0x3f')](handleError(_0x45e37f,null));};exports[_0xdf60('0x44')]=function(_0x3c2954,_0x38dbbd){return db[_0xdf60('0x26')]['create'](_0x3c2954[_0xdf60('0x45')],{})[_0xdf60('0x21')](respondWithResult(_0x38dbbd,0xc9))[_0xdf60('0x3f')](handleError(_0x38dbbd,null));};exports[_0xdf60('0x20')]=function(_0x59b22f,_0x5730e1){if(_0x59b22f['body']['id']){delete _0x59b22f[_0xdf60('0x45')]['id'];}return db['SquareRecording'][_0xdf60('0x43')]({'where':{'id':_0x59b22f['params']['id']}})[_0xdf60('0x21')](handleEntityNotFound(_0x5730e1,null))['then'](saveUpdates(_0x59b22f['body'],null))['then'](respondWithResult(_0x5730e1,null))[_0xdf60('0x3f')](handleError(_0x5730e1,null));};exports['download']=function(_0x18c0d3,_0xd1b096,_0x16fccc){var _0x321dc3=require(_0xdf60('0x46'));var _0x3851ec=![];var _0xc358b8={};if(_0x18c0d3['query'][_0xdf60('0x29')]&&_0x18c0d3[_0xdf60('0x2d')][_0xdf60('0x29')]===_0xdf60('0x47')){_0xc358b8[_0xdf60('0x47')]=_0x18c0d3['params']['id'];}else{_0xc358b8['id']=_0x18c0d3[_0xdf60('0x48')]['id'];}return db[_0xdf60('0x26')]['find']({'where':_0xc358b8,'attributes':['id',_0xdf60('0x49'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0xd1b096,null))[_0xdf60('0x21')](function(_0x2ada3b){if(_0x2ada3b){var _0x2b24cb=_0x2ada3b[_0xdf60('0x49')];var _0x2a88ff=util['format'](_0xdf60('0x4a'),_0x2b24cb);if(fs['existsSync'](_0x2a88ff)){_0x3851ec=!![];return _0x321dc3[_0xdf60('0x4b')](_0x2a88ff,_0x2b24cb,config['secrets'][_0xdf60('0x4c')])[_0xdf60('0x21')](function(){return _0x2ada3b;});}return _0x2ada3b;}})[_0xdf60('0x21')](function(_0x2d9fcf){if(_0x2d9fcf){var _0x2e92e5=_0x2d9fcf[_0xdf60('0x49')];if(!fs[_0xdf60('0x4d')](_0x2e92e5)){throw new db[(_0xdf60('0x4e'))]['ValidationError'](_0xdf60('0x4f'));}if(_0x2d9fcf[_0xdf60('0x50')]){return _0xd1b096['download'](_0x2e92e5,_0x2d9fcf['filename']+path[_0xdf60('0x51')](_0x2e92e5),function(){if(_0x3851ec){fs['unlink'](_0x2e92e5);}});}else{return _0xd1b096['download'](_0x2e92e5,function(_0x5d8b5d){if(_0x3851ec){fs['unlink'](_0x2e92e5);}});}}})[_0xdf60('0x3f')](function(_0x2a349a){if(_0x2a349a[_0xdf60('0x52')]==='SquareRecording\x20not\x20found'){_0xd1b096[_0xdf60('0x14')](0x194)[_0xdf60('0x24')]('Not\x20found');}else{return handleError(_0xd1b096,null);}});};exports[_0xdf60('0x53')]=function(_0x383212,_0xda3742){return db[_0xdf60('0x26')]['find']({'where':{'id':_0x383212['params']['id']}})['then'](function(_0x51ab57){if(_[_0xdf60('0x54')](_0x51ab57)){throw new ReferenceError(_0xdf60('0x55'));}return _0x51ab57;})[_0xdf60('0x21')](function(_0x1899a3){var _0x58cfbe=_0x1899a3[_0xdf60('0x49')];logger[_0xdf60('0x56')](_0xdf60('0x57'),_0x58cfbe);if(!_[_0xdf60('0x54')](_0x1899a3['savePath'])&&fs['existsSync'](_0x58cfbe)){logger[_0xdf60('0x56')](_0xdf60('0x58')+_0x58cfbe+_0xdf60('0x59'));fs[_0xdf60('0x5a')](_0x58cfbe);}_0x58cfbe=_0x58cfbe+'.cypher';if(!_[_0xdf60('0x54')](_0x1899a3[_0xdf60('0x49')])&&fs[_0xdf60('0x4d')](_0x58cfbe)){logger[_0xdf60('0x56')](_0xdf60('0x58')+_0x58cfbe+_0xdf60('0x59'));fs[_0xdf60('0x5a')](_0x58cfbe);}return _0x1899a3;})[_0xdf60('0x21')](function(_0x5363af){if(!_0x5363af)throw new InternalError();return _0x5363af[_0xdf60('0x53')]();})['then'](function(){_0xda3742['status'](0xcc)[_0xdf60('0x15')]();})[_0xdf60('0x3f')](handleError(_0xda3742,null));}; \ No newline at end of file +var _0x5d5a=['body','update','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','index','map','SquareRecording','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d5a,0x7a));var _0xa5d5=function(_0x2d9d9d,_0x501b18){_0x2d9d9d=_0x2d9d9d-0x0;var _0x38b8f1=_0x5d5a[_0x2d9d9d];return _0x38b8f1;};'use strict';var emlformat=require(_0xa5d5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa5d5('0x1'));var rp=require('request-promise');var moment=require(_0xa5d5('0x2'));var BPromise=require(_0xa5d5('0x3'));var Mustache=require(_0xa5d5('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa5d5('0x5'));var csv=require(_0xa5d5('0x6'));var ejs=require(_0xa5d5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa5d5('0x8'));var deskjs=require(_0xa5d5('0x9'));var toCsv=require(_0xa5d5('0x6'));var querystring=require(_0xa5d5('0xa'));var Papa=require(_0xa5d5('0xb'));var Redis=require('ioredis');var authService=require(_0xa5d5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa5d5('0xd'));var hardwareService=require(_0xa5d5('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xa5d5('0xf'));var config=require(_0xa5d5('0x10'));var licenseUtil=require(_0xa5d5('0x11'));var db=require(_0xa5d5('0x12'))['db'];function respondWithStatusCode(_0x305913,_0x1b0bbb){_0x1b0bbb=_0x1b0bbb||0xcc;return function(_0x37067a){if(_0x37067a){return _0x305913['sendStatus'](_0x1b0bbb);}return _0x305913[_0xa5d5('0x13')](_0x1b0bbb)[_0xa5d5('0x14')]();};}function respondWithResult(_0x35d48e,_0x2203d5){_0x2203d5=_0x2203d5||0xc8;return function(_0x20d075){if(_0x20d075){return _0x35d48e['status'](_0x2203d5)[_0xa5d5('0x15')](_0x20d075);}};}function respondWithFilteredResult(_0x541ecc,_0x43bf99){return function(_0x5a7a61){if(_0x5a7a61){var _0x5dc244=typeof _0x43bf99['offset']===_0xa5d5('0x16')&&typeof _0x43bf99[_0xa5d5('0x17')]===_0xa5d5('0x16');var _0x5c2571=_0x5a7a61[_0xa5d5('0x18')];var _0x32db1e=_0x5dc244?0x0:_0x43bf99[_0xa5d5('0x19')];var _0x3e7d2f=_0x5dc244?_0x5a7a61[_0xa5d5('0x18')]:_0x43bf99[_0xa5d5('0x19')]+_0x43bf99[_0xa5d5('0x17')];var _0x38c2ff;if(_0x3e7d2f>=_0x5c2571){_0x3e7d2f=_0x5c2571;_0x38c2ff=0xc8;}else{_0x38c2ff=0xce;}_0x541ecc[_0xa5d5('0x13')](_0x38c2ff);return _0x541ecc[_0xa5d5('0x1a')](_0xa5d5('0x1b'),_0x32db1e+'-'+_0x3e7d2f+'/'+_0x5c2571)[_0xa5d5('0x15')](_0x5a7a61);}return null;};}function patchUpdates(_0x24b5ca){return function(_0x44da1d){try{jsonpatch[_0xa5d5('0x1c')](_0x44da1d,_0x24b5ca,!![]);}catch(_0x50ae36){return BPromise['reject'](_0x50ae36);}return _0x44da1d[_0xa5d5('0x1d')]();};}function saveUpdates(_0x2d87f3,_0x276b34){return function(_0x2a7a3c){if(_0x2a7a3c){return _0x2a7a3c['update'](_0x2d87f3)[_0xa5d5('0x1e')](function(_0x2d4e2a){return _0x2d4e2a;});}return null;};}function removeEntity(_0x475c89,_0x233327){return function(_0x4038b3){if(_0x4038b3){return _0x4038b3[_0xa5d5('0x1f')]()[_0xa5d5('0x1e')](function(){_0x475c89[_0xa5d5('0x13')](0xcc)[_0xa5d5('0x14')]();});}};}function handleEntityNotFound(_0xc41356,_0x4223fd){return function(_0x43c67c){if(!_0x43c67c){_0xc41356[_0xa5d5('0x20')](0x194);}return _0x43c67c;};}function handleError(_0x4de851,_0x368f84){_0x368f84=_0x368f84||0x1f4;return function(_0x4d3b9c){logger[_0xa5d5('0x21')](_0x4d3b9c[_0xa5d5('0x22')]);if(_0x4d3b9c[_0xa5d5('0x23')]){delete _0x4d3b9c[_0xa5d5('0x23')];}_0x4de851['status'](_0x368f84)['send'](_0x4d3b9c);};}exports[_0xa5d5('0x24')]=function(_0x15562d,_0x518b7e){var _0x4ccfc5={},_0x29c011={},_0x31d290={'count':0x0,'rows':[]};var _0x2cebaa=_[_0xa5d5('0x25')](db[_0xa5d5('0x26')]['rawAttributes'],function(_0x38884f){return{'name':_0x38884f[_0xa5d5('0x27')],'type':_0x38884f[_0xa5d5('0x28')]['key']};});_0x29c011['model']=_[_0xa5d5('0x25')](_0x2cebaa,'name');_0x29c011[_0xa5d5('0x29')]=_[_0xa5d5('0x2a')](_0x15562d[_0xa5d5('0x29')]);_0x29c011[_0xa5d5('0x2b')]=_['intersection'](_0x29c011['model'],_0x29c011[_0xa5d5('0x29')]);_0x4ccfc5[_0xa5d5('0x2c')]=_[_0xa5d5('0x2d')](_0x29c011[_0xa5d5('0x2e')],qs[_0xa5d5('0x2f')](_0x15562d['query'][_0xa5d5('0x2f')]));_0x4ccfc5[_0xa5d5('0x2c')]=_0x4ccfc5['attributes'][_0xa5d5('0x30')]?_0x4ccfc5[_0xa5d5('0x2c')]:_0x29c011['model'];if(!_0x15562d[_0xa5d5('0x29')][_0xa5d5('0x31')](_0xa5d5('0x32'))){_0x4ccfc5[_0xa5d5('0x17')]=qs['limit'](_0x15562d[_0xa5d5('0x29')][_0xa5d5('0x17')]);_0x4ccfc5[_0xa5d5('0x19')]=qs[_0xa5d5('0x19')](_0x15562d[_0xa5d5('0x29')]['offset']);}_0x4ccfc5[_0xa5d5('0x33')]=qs[_0xa5d5('0x34')](_0x15562d[_0xa5d5('0x29')][_0xa5d5('0x34')]);_0x4ccfc5['where']=qs[_0xa5d5('0x2b')](_[_0xa5d5('0x35')](_0x15562d[_0xa5d5('0x29')],_0x29c011[_0xa5d5('0x2b')]),_0x2cebaa);if(_0x15562d['query'][_0xa5d5('0x36')]){_0x4ccfc5[_0xa5d5('0x37')]=_[_0xa5d5('0x38')](_0x4ccfc5[_0xa5d5('0x37')],{'$or':_[_0xa5d5('0x25')](_0x2cebaa,function(_0x393308){if(_0x393308[_0xa5d5('0x28')]!==_0xa5d5('0x39')){var _0x416da0={};_0x416da0[_0x393308['name']]={'$like':'%'+_0x15562d[_0xa5d5('0x29')]['filter']+'%'};return _0x416da0;}})});}_0x4ccfc5=_[_0xa5d5('0x38')]({},_0x4ccfc5,_0x15562d['options']);var _0x1b8819={'where':_0x4ccfc5[_0xa5d5('0x37')]};return db[_0xa5d5('0x26')]['count'](_0x1b8819)[_0xa5d5('0x1e')](function(_0x1e74a2){_0x31d290['count']=_0x1e74a2;if(_0x15562d[_0xa5d5('0x29')][_0xa5d5('0x3a')]){_0x4ccfc5[_0xa5d5('0x3b')]=[{'all':!![]}];}return db['SquareRecording'][_0xa5d5('0x3c')](_0x4ccfc5);})[_0xa5d5('0x1e')](function(_0x5c040f){_0x31d290[_0xa5d5('0x3d')]=_0x5c040f;return _0x31d290;})[_0xa5d5('0x1e')](respondWithFilteredResult(_0x518b7e,_0x4ccfc5))[_0xa5d5('0x3e')](handleError(_0x518b7e,null));};exports[_0xa5d5('0x3f')]=function(_0x243d0b,_0x1a82c2){var _0xf9dfab={'raw':!![],'where':{'id':_0x243d0b[_0xa5d5('0x40')]['id']}},_0x7c0dda={};_0x7c0dda['model']=_['keys'](db['SquareRecording'][_0xa5d5('0x41')]);_0x7c0dda['query']=_[_0xa5d5('0x2a')](_0x243d0b[_0xa5d5('0x29')]);_0x7c0dda[_0xa5d5('0x2b')]=_[_0xa5d5('0x2d')](_0x7c0dda[_0xa5d5('0x2e')],_0x7c0dda[_0xa5d5('0x29')]);_0xf9dfab[_0xa5d5('0x2c')]=_[_0xa5d5('0x2d')](_0x7c0dda[_0xa5d5('0x2e')],qs['fields'](_0x243d0b[_0xa5d5('0x29')][_0xa5d5('0x2f')]));_0xf9dfab[_0xa5d5('0x2c')]=_0xf9dfab['attributes'][_0xa5d5('0x30')]?_0xf9dfab['attributes']:_0x7c0dda[_0xa5d5('0x2e')];if(_0x243d0b[_0xa5d5('0x29')]['includeAll']){_0xf9dfab[_0xa5d5('0x3b')]=[{'all':!![]}];}_0xf9dfab=_['merge']({},_0xf9dfab,_0x243d0b['options']);return db[_0xa5d5('0x26')][_0xa5d5('0x42')](_0xf9dfab)[_0xa5d5('0x1e')](handleEntityNotFound(_0x1a82c2,null))[_0xa5d5('0x1e')](respondWithResult(_0x1a82c2,null))[_0xa5d5('0x3e')](handleError(_0x1a82c2,null));};exports[_0xa5d5('0x43')]=function(_0x7664a1,_0x3ef931){return db[_0xa5d5('0x26')][_0xa5d5('0x43')](_0x7664a1[_0xa5d5('0x44')],{})[_0xa5d5('0x1e')](respondWithResult(_0x3ef931,0xc9))['catch'](handleError(_0x3ef931,null));};exports[_0xa5d5('0x45')]=function(_0x419fff,_0x5c90b7){if(_0x419fff[_0xa5d5('0x44')]['id']){delete _0x419fff['body']['id'];}return db[_0xa5d5('0x26')][_0xa5d5('0x42')]({'where':{'id':_0x419fff[_0xa5d5('0x40')]['id']}})[_0xa5d5('0x1e')](handleEntityNotFound(_0x5c90b7,null))[_0xa5d5('0x1e')](saveUpdates(_0x419fff[_0xa5d5('0x44')],null))[_0xa5d5('0x1e')](respondWithResult(_0x5c90b7,null))[_0xa5d5('0x3e')](handleError(_0x5c90b7,null));};exports[_0xa5d5('0x46')]=function(_0x450ca1,_0x938a23,_0x420928){var _0x845d66=require(_0xa5d5('0x47'));var _0x2215b0=![];var _0x1d3e28={};if(_0x450ca1['query'][_0xa5d5('0x28')]&&_0x450ca1[_0xa5d5('0x29')][_0xa5d5('0x28')]==='uniqueid'){_0x1d3e28[_0xa5d5('0x48')]=_0x450ca1['params']['id'];}else{_0x1d3e28['id']=_0x450ca1['params']['id'];}return db[_0xa5d5('0x26')]['find']({'where':_0x1d3e28,'attributes':['id',_0xa5d5('0x49'),_0xa5d5('0x4a')],'raw':!![]})[_0xa5d5('0x1e')](handleEntityNotFound(_0x938a23,null))[_0xa5d5('0x1e')](function(_0x527ec8){if(_0x527ec8){var _0x3ae50a=_0x527ec8['savePath'];var _0x1a82fe=util['format'](_0xa5d5('0x4b'),_0x3ae50a);if(fs[_0xa5d5('0x4c')](_0x1a82fe)){_0x2215b0=!![];return _0x845d66[_0xa5d5('0x4d')](_0x1a82fe,_0x3ae50a,config['secrets'][_0xa5d5('0x4e')])[_0xa5d5('0x1e')](function(){return _0x527ec8;});}return _0x527ec8;}})[_0xa5d5('0x1e')](function(_0x5239dd){if(_0x5239dd){var _0x191c33=_0x5239dd['savePath'];if(!fs[_0xa5d5('0x4c')](_0x191c33)){throw new db[(_0xa5d5('0x4f'))][(_0xa5d5('0x50'))]('SquareRecording\x20not\x20found');}if(_0x5239dd[_0xa5d5('0x4a')]){return _0x938a23[_0xa5d5('0x46')](_0x191c33,_0x5239dd[_0xa5d5('0x4a')]+path[_0xa5d5('0x51')](_0x191c33),function(){if(_0x2215b0){fs[_0xa5d5('0x52')](_0x191c33);}});}else{return _0x938a23[_0xa5d5('0x46')](_0x191c33,function(_0x370dbc){if(_0x2215b0){fs[_0xa5d5('0x52')](_0x191c33);}});}}})[_0xa5d5('0x3e')](function(_0x41bd29){if(_0x41bd29[_0xa5d5('0x53')]===_0xa5d5('0x54')){_0x938a23[_0xa5d5('0x13')](0x194)[_0xa5d5('0x55')](_0xa5d5('0x56'));}else{return handleError(_0x938a23,null);}});};exports[_0xa5d5('0x1f')]=function(_0x185fe6,_0x3c609f){return db[_0xa5d5('0x26')][_0xa5d5('0x42')]({'where':{'id':_0x185fe6[_0xa5d5('0x40')]['id']}})[_0xa5d5('0x1e')](function(_0xd311b){if(_[_0xa5d5('0x57')](_0xd311b)){throw new ReferenceError(_0xa5d5('0x58'));}return _0xd311b;})[_0xa5d5('0x1e')](function(_0x1ffc32){var _0x3d7fd3=_0x1ffc32[_0xa5d5('0x49')];logger['info'](_0xa5d5('0x59'),_0x3d7fd3);if(!_['isNil'](_0x1ffc32[_0xa5d5('0x49')])&&fs[_0xa5d5('0x4c')](_0x3d7fd3)){logger[_0xa5d5('0x5a')](_0xa5d5('0x5b')+_0x3d7fd3+_0xa5d5('0x5c'));fs['unlinkSync'](_0x3d7fd3);}_0x3d7fd3=_0x3d7fd3+_0xa5d5('0x5d');if(!_['isNil'](_0x1ffc32[_0xa5d5('0x49')])&&fs[_0xa5d5('0x4c')](_0x3d7fd3)){logger[_0xa5d5('0x5a')]('File:\x20\x22'+_0x3d7fd3+_0xa5d5('0x5c'));fs[_0xa5d5('0x5e')](_0x3d7fd3);}return _0x1ffc32;})['then'](function(_0x5cc3f7){if(!_0x5cc3f7)throw new InternalError();return _0x5cc3f7['destroy']();})[_0xa5d5('0x1e')](function(){_0x3c609f[_0xa5d5('0x13')](0xcc)[_0xa5d5('0x14')]();})[_0xa5d5('0x3e')](handleError(_0x3c609f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2bb76f1..fe7332e 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 _0xbba1=['api','moment','path','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash'];(function(_0x1231ca,_0x2c9160){var _0x445e92=function(_0x3e75aa){while(--_0x3e75aa){_0x1231ca['push'](_0x1231ca['shift']());}};_0x445e92(++_0x2c9160);}(_0xbba1,0x17f));var _0x1bba=function(_0x2449d8,_0x152635){_0x2449d8=_0x2449d8-0x0;var _0x58a2c7=_0xbba1[_0x2449d8];return _0x58a2c7;};'use strict';var _=require(_0x1bba('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1bba('0x1'));var moment=require(_0x1bba('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bba('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bba('0x4'));module['exports']=function(_0x4af979,_0x163e4e){return _0x4af979[_0x1bba('0x5')](_0x1bba('0x6'),attributes,{'tableName':_0x1bba('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e8a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','SquareRecording','square_recordings','lodash','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9e8a,0x112));var _0xa9e8=function(_0x4ba218,_0x48d5a9){_0x4ba218=_0x4ba218-0x0;var _0x1a6fd5=_0x9e8a[_0x4ba218];return _0x1a6fd5;};'use strict';var _=require(_0xa9e8('0x0'));var util=require(_0xa9e8('0x1'));var logger=require(_0xa9e8('0x2'))(_0xa9e8('0x3'));var moment=require(_0xa9e8('0x4'));var BPromise=require(_0xa9e8('0x5'));var rp=require(_0xa9e8('0x6'));var fs=require('fs');var path=require(_0xa9e8('0x7'));var rimraf=require(_0xa9e8('0x8'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x5272b7,_0xbc717c){return _0x5272b7[_0xa9e8('0x9')](_0xa9e8('0xa'),attributes,{'tableName':_0xa9e8('0xb'),'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 dfffc3c..f488da7 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 _0x463a=['message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','debug','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x357fa7,_0xa13c16){var _0x786596=function(_0x4bae22){while(--_0x4bae22){_0x357fa7['push'](_0x357fa7['shift']());}};_0x786596(++_0xa13c16);}(_0x463a,0x6d));var _0xa463=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x463a[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require('lodash');var util=require(_0xa463('0x0'));var moment=require(_0xa463('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa463('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa463('0x3'));var logger=require('../../config/logger')(_0xa463('0x4'));var config=require(_0xa463('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa463('0x6')][_0xa463('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x532bcb,_0x52394d,_0x656155){return new BPromise(function(_0x107ba6,_0x3add68){return client[_0xa463('0x8')](_0x532bcb,_0x656155)[_0xa463('0x9')](function(_0x4d9a6b){logger[_0xa463('0xa')](_0xa463('0xb'),_0x52394d,_0xa463('0xc'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x52394d,_0xa463('0xc'),JSON[_0xa463('0xd')](_0x4d9a6b));if(_0x4d9a6b[_0xa463('0xe')]){if(_0x4d9a6b[_0xa463('0xe')][_0xa463('0xf')]===0x1f4){logger[_0xa463('0xe')](_0xa463('0xb'),_0x52394d,_0x4d9a6b[_0xa463('0xe')]['message']);return _0x3add68(_0x4d9a6b[_0xa463('0xe')][_0xa463('0x10')]);}logger[_0xa463('0xe')]('SquareRecording,\x20%s,\x20%s',_0x52394d,_0x4d9a6b[_0xa463('0xe')][_0xa463('0x10')]);return _0x107ba6(_0x4d9a6b[_0xa463('0xe')][_0xa463('0x10')]);}else{logger[_0xa463('0xa')](_0xa463('0xb'),_0x52394d,_0xa463('0xc'));_0x107ba6(_0x4d9a6b[_0xa463('0x11')][_0xa463('0x10')]);}})[_0xa463('0x12')](function(_0x2f08c7){logger[_0xa463('0xe')](_0xa463('0xb'),_0x52394d,_0x2f08c7);_0x3add68(_0x2f08c7);});});}exports[_0xa463('0x13')]=function(_0xb6ac6e){var _0x3867bf=this;return new Promise(function(_0x1f0ece,_0x4d1e88){return db[_0xa463('0x14')][_0xa463('0x15')](_0xb6ac6e[_0xa463('0x16')],{'raw':_0xb6ac6e[_0xa463('0x17')]?_0xb6ac6e[_0xa463('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xa463('0x9')](function(_0x38a16d){logger[_0xa463('0xa')](_0xa463('0x13'),_0xb6ac6e);logger[_0xa463('0x18')](_0xa463('0x13'),_0xb6ac6e,JSON[_0xa463('0xd')](_0x38a16d));_0x1f0ece(_0x38a16d);})[_0xa463('0x12')](function(_0x14f375){logger[_0xa463('0xe')](_0xa463('0x13'),_0x14f375['message'],_0xb6ac6e);_0x4d1e88(_0x3867bf[_0xa463('0xe')](0x1f4,_0x14f375[_0xa463('0x10')]));});});}; \ No newline at end of file +var _0x346a=['error','code','SquareRecording,\x20%s,\x20%s','message','info','result','catch','SquareRecording','body','options','raw','CreateSquareRecording','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify'];(function(_0x3664cc,_0x5a42ae){var _0x11f1a2=function(_0x458cb9){while(--_0x458cb9){_0x3664cc['push'](_0x3664cc['shift']());}};_0x11f1a2(++_0x5a42ae);}(_0x346a,0xfc));var _0xa346=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x346a[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa346('0x0'));var rs=require(_0xa346('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa346('0x2'))['db'];var utils=require(_0xa346('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xa346('0x4'));var jayson=require(_0xa346('0x5'));var client=jayson[_0xa346('0x6')][_0xa346('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc03b2c,_0x2654ae,_0x4ab790){return new BPromise(function(_0x39b765,_0x30273f){return client[_0xa346('0x8')](_0xc03b2c,_0x4ab790)[_0xa346('0x9')](function(_0x32c8a1){logger['info']('SquareRecording,\x20%s,\x20%s',_0x2654ae,_0xa346('0xa'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2654ae,_0xa346('0xa'),JSON[_0xa346('0xb')](_0x32c8a1));if(_0x32c8a1[_0xa346('0xc')]){if(_0x32c8a1[_0xa346('0xc')][_0xa346('0xd')]===0x1f4){logger[_0xa346('0xc')](_0xa346('0xe'),_0x2654ae,_0x32c8a1[_0xa346('0xc')][_0xa346('0xf')]);return _0x30273f(_0x32c8a1[_0xa346('0xc')][_0xa346('0xf')]);}logger[_0xa346('0xc')](_0xa346('0xe'),_0x2654ae,_0x32c8a1[_0xa346('0xc')][_0xa346('0xf')]);return _0x39b765(_0x32c8a1['error']['message']);}else{logger[_0xa346('0x10')](_0xa346('0xe'),_0x2654ae,_0xa346('0xa'));_0x39b765(_0x32c8a1[_0xa346('0x11')][_0xa346('0xf')]);}})[_0xa346('0x12')](function(_0x30aa61){logger[_0xa346('0xc')]('SquareRecording,\x20%s,\x20%s',_0x2654ae,_0x30aa61);_0x30273f(_0x30aa61);});});}exports['CreateSquareRecording']=function(_0x9202e1){var _0xeb1e14=this;return new Promise(function(_0x115589,_0x43b877){return db[_0xa346('0x13')]['create'](_0x9202e1[_0xa346('0x14')],{'raw':_0x9202e1['options']?_0x9202e1[_0xa346('0x15')][_0xa346('0x16')]===undefined?!![]:![]:!![]})[_0xa346('0x9')](function(_0x15a751){logger[_0xa346('0x10')](_0xa346('0x17'),_0x9202e1);logger['debug'](_0xa346('0x17'),_0x9202e1,JSON[_0xa346('0xb')](_0x15a751));_0x115589(_0x15a751);})[_0xa346('0x12')](function(_0x1ca289){logger[_0xa346('0xc')](_0xa346('0x17'),_0x1ca289[_0xa346('0xf')],_0x9202e1);_0x43b877(_0xeb1e14[_0xa346('0xc')](0x1f4,_0x1ca289[_0xa346('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e219191..4ac928c 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x5df5a5,_0x533c87){var _0x543a84=function(_0x167d59){while(--_0x167d59){_0x5df5a5['push'](_0x5df5a5['shift']());}};_0x543a84(++_0x533c87);}(_0xe706,0xa3));var _0x6e70=function(_0xdb576,_0x13705e){_0xdb576=_0xdb576-0x0;var _0x98a94b=_0xe706[_0xdb576];return _0x98a94b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c726c6a..52e1a53 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 _0x5c95=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x5e9b10,_0x30b9f7){var _0x2cf536=function(_0x1e212e){while(--_0x1e212e){_0x5e9b10['push'](_0x5e9b10['shift']());}};_0x2cf536(++_0x30b9f7);}(_0x5c95,0x80));var _0x55c9=function(_0x455df1,_0x3219d2){_0x455df1=_0x455df1-0x0;var _0x564834=_0x5c95[_0x455df1];return _0x564834;};'use strict';var Sequelize=require(_0x55c9('0x0'));module[_0x55c9('0x1')]={'network':{'type':Sequelize[_0x55c9('0x2')]},'network_script':{'type':Sequelize[_0x55c9('0x2')]},'request':{'type':Sequelize[_0x55c9('0x2')]},'channel':{'type':Sequelize[_0x55c9('0x2')]},'language':{'type':Sequelize[_0x55c9('0x2')]},'type':{'type':Sequelize[_0x55c9('0x2')]},'uniqueid':{'type':Sequelize[_0x55c9('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x55c9('0x2')]},'calleridname':{'type':Sequelize[_0x55c9('0x2')]},'callingpres':{'type':Sequelize[_0x55c9('0x2')]},'callingani2':{'type':Sequelize[_0x55c9('0x2')]},'callington':{'type':Sequelize[_0x55c9('0x2')]},'callingtns':{'type':Sequelize[_0x55c9('0x2')]},'dnid':{'type':Sequelize[_0x55c9('0x2')]},'rdnis':{'type':Sequelize[_0x55c9('0x2')]},'context':{'type':Sequelize[_0x55c9('0x2')]},'extension':{'type':Sequelize[_0x55c9('0x2')]},'priority':{'type':Sequelize[_0x55c9('0x2')]},'enhanced':{'type':Sequelize[_0x55c9('0x2')]},'accountcode':{'type':Sequelize[_0x55c9('0x2')]},'threadid':{'type':Sequelize[_0x55c9('0x2')]},'project_name':{'type':Sequelize[_0x55c9('0x2')]},'joinAt':{'type':Sequelize[_0x55c9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x55c9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x837c=['exports','STRING','DATE','sequelize'];(function(_0x59525b,_0x1026c6){var _0x2aa9ba=function(_0x1bc3af){while(--_0x1bc3af){_0x59525b['push'](_0x59525b['shift']());}};_0x2aa9ba(++_0x1026c6);}(_0x837c,0xa7));var _0xc837=function(_0x55cd37,_0x198fee){_0x55cd37=_0x55cd37-0x0;var _0x2765fd=_0x837c[_0x55cd37];return _0x2765fd;};'use strict';var Sequelize=require(_0xc837('0x0'));module[_0xc837('0x1')]={'network':{'type':Sequelize[_0xc837('0x2')]},'network_script':{'type':Sequelize[_0xc837('0x2')]},'request':{'type':Sequelize[_0xc837('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc837('0x2')]},'type':{'type':Sequelize[_0xc837('0x2')]},'uniqueid':{'type':Sequelize[_0xc837('0x2')]},'version':{'type':Sequelize[_0xc837('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc837('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc837('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xc837('0x2')]},'dnid':{'type':Sequelize[_0xc837('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc837('0x2')]},'extension':{'type':Sequelize[_0xc837('0x2')]},'priority':{'type':Sequelize[_0xc837('0x2')]},'enhanced':{'type':Sequelize[_0xc837('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc837('0x3')]},'leaveAt':{'type':Sequelize[_0xc837('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2ce093e..7081413 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 _0x33e1=['catch','show','params','find','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','end','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','keys','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','SquareReport','findAll','rows'];(function(_0x1f25b3,_0x4e17a5){var _0x527093=function(_0x1ba28b){while(--_0x1ba28b){_0x1f25b3['push'](_0x1f25b3['shift']());}};_0x527093(++_0x4e17a5);}(_0x33e1,0x1f1));var _0x133e=function(_0x2be8dc,_0x326c35){_0x2be8dc=_0x2be8dc-0x0;var _0x2ea7d7=_0x33e1[_0x2be8dc];return _0x2ea7d7;};'use strict';var emlformat=require(_0x133e('0x0'));var rimraf=require(_0x133e('0x1'));var zipdir=require(_0x133e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x133e('0x3'));var moment=require(_0x133e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x133e('0x5'));var path=require(_0x133e('0x6'));var sox=require(_0x133e('0x7'));var csv=require(_0x133e('0x8'));var ejs=require(_0x133e('0x9'));var fs=require('fs');var fs_extra=require(_0x133e('0xa'));var _=require('lodash');var squel=require(_0x133e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x133e('0xc'));var toCsv=require(_0x133e('0x8'));var querystring=require(_0x133e('0xd'));var Papa=require(_0x133e('0xe'));var Redis=require(_0x133e('0xf'));var authService=require(_0x133e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x133e('0x11'));var logger=require(_0x133e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x133e('0x13'));var licenseUtil=require(_0x133e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5916cd,_0x4b1d7e){_0x4b1d7e=_0x4b1d7e||0xcc;return function(_0x63d4f8){if(_0x63d4f8){return _0x5916cd['sendStatus'](_0x4b1d7e);}return _0x5916cd[_0x133e('0x15')](_0x4b1d7e)['end']();};}function respondWithResult(_0x37f8f0,_0xca439d){_0xca439d=_0xca439d||0xc8;return function(_0x24086a){if(_0x24086a){return _0x37f8f0['status'](_0xca439d)['json'](_0x24086a);}};}function respondWithFilteredResult(_0x508781,_0x3935b4){return function(_0x2580b6){if(_0x2580b6){var _0x1aa148=typeof _0x3935b4[_0x133e('0x16')]===_0x133e('0x17')&&typeof _0x3935b4[_0x133e('0x18')]===_0x133e('0x17');var _0x1b1827=_0x2580b6['count'];var _0x380e8a=_0x1aa148?0x0:_0x3935b4[_0x133e('0x16')];var _0x205ed6=_0x1aa148?_0x2580b6[_0x133e('0x19')]:_0x3935b4[_0x133e('0x16')]+_0x3935b4[_0x133e('0x18')];var _0x1059a6;if(_0x205ed6>=_0x1b1827){_0x205ed6=_0x1b1827;_0x1059a6=0xc8;}else{_0x1059a6=0xce;}_0x508781['status'](_0x1059a6);return _0x508781['set'](_0x133e('0x1a'),_0x380e8a+'-'+_0x205ed6+'/'+_0x1b1827)[_0x133e('0x1b')](_0x2580b6);}return null;};}function patchUpdates(_0x5914a9){return function(_0x4d6747){try{jsonpatch['apply'](_0x4d6747,_0x5914a9,!![]);}catch(_0x473d98){return BPromise[_0x133e('0x1c')](_0x473d98);}return _0x4d6747[_0x133e('0x1d')]();};}function saveUpdates(_0x40ceed,_0x2efd60){return function(_0x54cf9b){if(_0x54cf9b){return _0x54cf9b['update'](_0x40ceed)[_0x133e('0x1e')](function(_0x397c38){return _0x397c38;});}return null;};}function removeEntity(_0x4cb298,_0x4081da){return function(_0xc2decb){if(_0xc2decb){return _0xc2decb[_0x133e('0x1f')]()[_0x133e('0x1e')](function(){_0x4cb298[_0x133e('0x15')](0xcc)[_0x133e('0x20')]();});}};}function handleEntityNotFound(_0x3442b0,_0x12e39c){return function(_0x3afacc){if(!_0x3afacc){_0x3442b0[_0x133e('0x21')](0x194);}return _0x3afacc;};}function handleError(_0x461de0,_0x24f4fd){_0x24f4fd=_0x24f4fd||0x1f4;return function(_0x160117){logger[_0x133e('0x22')](_0x160117[_0x133e('0x23')]);if(_0x160117['name']){delete _0x160117['name'];}_0x461de0[_0x133e('0x15')](_0x24f4fd)[_0x133e('0x24')](_0x160117);};}exports[_0x133e('0x25')]=function(_0x4bba7b,_0x297e68){var _0x5ecdfe={},_0x54d358={},_0x28e73a={'count':0x0,'rows':[]};var _0x351481=_[_0x133e('0x26')](db['SquareReport'][_0x133e('0x27')],function(_0x52ba29){return{'name':_0x52ba29[_0x133e('0x28')],'type':_0x52ba29['type']['key']};});_0x54d358['model']=_[_0x133e('0x26')](_0x351481,'name');_0x54d358['query']=_[_0x133e('0x29')](_0x4bba7b['query']);_0x54d358['filters']=_[_0x133e('0x2a')](_0x54d358['model'],_0x54d358[_0x133e('0x2b')]);_0x5ecdfe[_0x133e('0x2c')]=_[_0x133e('0x2a')](_0x54d358['model'],qs['fields'](_0x4bba7b[_0x133e('0x2b')][_0x133e('0x2d')]));_0x5ecdfe[_0x133e('0x2c')]=_0x5ecdfe[_0x133e('0x2c')][_0x133e('0x2e')]?_0x5ecdfe[_0x133e('0x2c')]:_0x54d358[_0x133e('0x2f')];if(!_0x4bba7b['query'][_0x133e('0x30')](_0x133e('0x31'))){_0x5ecdfe[_0x133e('0x18')]=qs[_0x133e('0x18')](_0x4bba7b['query']['limit']);_0x5ecdfe[_0x133e('0x16')]=qs[_0x133e('0x16')](_0x4bba7b[_0x133e('0x2b')][_0x133e('0x16')]);}_0x5ecdfe[_0x133e('0x32')]=qs[_0x133e('0x33')](_0x4bba7b[_0x133e('0x2b')][_0x133e('0x33')]);_0x5ecdfe[_0x133e('0x34')]=qs[_0x133e('0x35')](_[_0x133e('0x36')](_0x4bba7b[_0x133e('0x2b')],_0x54d358[_0x133e('0x35')]),_0x351481);if(_0x4bba7b[_0x133e('0x2b')][_0x133e('0x37')]){_0x5ecdfe[_0x133e('0x34')]=_['merge'](_0x5ecdfe[_0x133e('0x34')],{'$or':_[_0x133e('0x26')](_0x351481,function(_0x19359e){if(_0x19359e[_0x133e('0x38')]!==_0x133e('0x39')){var _0x32b2c4={};_0x32b2c4[_0x19359e['name']]={'$like':'%'+_0x4bba7b[_0x133e('0x2b')][_0x133e('0x37')]+'%'};return _0x32b2c4;}})});}_0x5ecdfe=_['merge']({},_0x5ecdfe,_0x4bba7b[_0x133e('0x3a')]);var _0x7fb1d6={'where':_0x5ecdfe[_0x133e('0x34')]};return db['SquareReport'][_0x133e('0x19')](_0x7fb1d6)[_0x133e('0x1e')](function(_0x498ebd){_0x28e73a[_0x133e('0x19')]=_0x498ebd;if(_0x4bba7b['query'][_0x133e('0x3b')]){_0x5ecdfe['include']=[{'all':!![]}];}return db[_0x133e('0x3c')][_0x133e('0x3d')](_0x5ecdfe);})[_0x133e('0x1e')](function(_0x17d8e5){_0x28e73a[_0x133e('0x3e')]=_0x17d8e5;return _0x28e73a;})['then'](respondWithFilteredResult(_0x297e68,_0x5ecdfe))[_0x133e('0x3f')](handleError(_0x297e68,null));};exports[_0x133e('0x40')]=function(_0x2b5ea1,_0x5a8b36){var _0x368524={'raw':!![],'where':{'id':_0x2b5ea1[_0x133e('0x41')]['id']}},_0x384214={};_0x384214[_0x133e('0x2f')]=_[_0x133e('0x29')](db[_0x133e('0x3c')][_0x133e('0x27')]);_0x384214[_0x133e('0x2b')]=_[_0x133e('0x29')](_0x2b5ea1[_0x133e('0x2b')]);_0x384214['filters']=_[_0x133e('0x2a')](_0x384214[_0x133e('0x2f')],_0x384214['query']);_0x368524[_0x133e('0x2c')]=_['intersection'](_0x384214[_0x133e('0x2f')],qs['fields'](_0x2b5ea1[_0x133e('0x2b')][_0x133e('0x2d')]));_0x368524[_0x133e('0x2c')]=_0x368524[_0x133e('0x2c')][_0x133e('0x2e')]?_0x368524[_0x133e('0x2c')]:_0x384214[_0x133e('0x2f')];if(_0x2b5ea1[_0x133e('0x2b')][_0x133e('0x3b')]){_0x368524['include']=[{'all':!![]}];}_0x368524=_['merge']({},_0x368524,_0x2b5ea1[_0x133e('0x3a')]);return db[_0x133e('0x3c')][_0x133e('0x42')](_0x368524)[_0x133e('0x1e')](handleEntityNotFound(_0x5a8b36,null))[_0x133e('0x1e')](respondWithResult(_0x5a8b36,null))[_0x133e('0x3f')](handleError(_0x5a8b36,null));};exports['create']=function(_0x88ef00,_0x24ac47){return db['SquareReport']['create'](_0x88ef00[_0x133e('0x43')],{})['then'](respondWithResult(_0x24ac47,0xc9))[_0x133e('0x3f')](handleError(_0x24ac47,null));};exports[_0x133e('0x44')]=function(_0x2e6882,_0x187552){if(_0x2e6882[_0x133e('0x43')]['id']){delete _0x2e6882[_0x133e('0x43')]['id'];}return db['SquareReport'][_0x133e('0x42')]({'where':{'id':_0x2e6882['params']['id']}})[_0x133e('0x1e')](handleEntityNotFound(_0x187552,null))[_0x133e('0x1e')](saveUpdates(_0x2e6882[_0x133e('0x43')],null))['then'](respondWithResult(_0x187552,null))['catch'](handleError(_0x187552,null));};exports[_0x133e('0x1f')]=function(_0x52268f,_0x15cd06){return db[_0x133e('0x3c')][_0x133e('0x42')]({'where':{'id':_0x52268f[_0x133e('0x41')]['id']}})[_0x133e('0x1e')](handleEntityNotFound(_0x15cd06,null))['then'](removeEntity(_0x15cd06,null))['catch'](handleError(_0x15cd06,null));};exports[_0x133e('0x45')]=function(_0x15e8d8,_0x5801ba){return db['SquareReport'][_0x133e('0x45')]()[_0x133e('0x1e')](respondWithResult(_0x5801ba,null))[_0x133e('0x3f')](handleError(_0x5801ba,null));}; \ No newline at end of file +var _0xb5a4=['VIRTUAL','SquareReport','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4df8f1,_0x8bc8ba){var _0x57f3d=function(_0x111406){while(--_0x111406){_0x4df8f1['push'](_0x4df8f1['shift']());}};_0x57f3d(++_0x8bc8ba);}(_0xb5a4,0xac));var _0x4b5a=function(_0x4a75f3,_0x50a66d){_0x4a75f3=_0x4a75f3-0x0;var _0x196706=_0xb5a4[_0x4a75f3];return _0x196706;};'use strict';var emlformat=require(_0x4b5a('0x0'));var rimraf=require(_0x4b5a('0x1'));var zipdir=require(_0x4b5a('0x2'));var jsonpatch=require(_0x4b5a('0x3'));var rp=require(_0x4b5a('0x4'));var moment=require(_0x4b5a('0x5'));var BPromise=require(_0x4b5a('0x6'));var Mustache=require(_0x4b5a('0x7'));var util=require('util');var path=require(_0x4b5a('0x8'));var sox=require(_0x4b5a('0x9'));var csv=require(_0x4b5a('0xa'));var ejs=require(_0x4b5a('0xb'));var fs=require('fs');var fs_extra=require(_0x4b5a('0xc'));var _=require('lodash');var squel=require(_0x4b5a('0xd'));var crypto=require(_0x4b5a('0xe'));var jsforce=require(_0x4b5a('0xf'));var deskjs=require(_0x4b5a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4b5a('0x11'));var Papa=require(_0x4b5a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b5a('0x13'));var as=require(_0x4b5a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b5a('0x15'))(_0x4b5a('0x16'));var utils=require(_0x4b5a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4b5a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50fe19,_0x3a868d){_0x3a868d=_0x3a868d||0xcc;return function(_0x36d1dc){if(_0x36d1dc){return _0x50fe19['sendStatus'](_0x3a868d);}return _0x50fe19[_0x4b5a('0x19')](_0x3a868d)[_0x4b5a('0x1a')]();};}function respondWithResult(_0x5f0c12,_0x292f55){_0x292f55=_0x292f55||0xc8;return function(_0x5deff2){if(_0x5deff2){return _0x5f0c12[_0x4b5a('0x19')](_0x292f55)[_0x4b5a('0x1b')](_0x5deff2);}};}function respondWithFilteredResult(_0x114d7f,_0x445605){return function(_0xf47e80){if(_0xf47e80){var _0x3d4581=typeof _0x445605[_0x4b5a('0x1c')]==='undefined'&&typeof _0x445605[_0x4b5a('0x1d')]==='undefined';var _0xe8a810=_0xf47e80[_0x4b5a('0x1e')];var _0x5c9f3c=_0x3d4581?0x0:_0x445605[_0x4b5a('0x1c')];var _0x32e9fb=_0x3d4581?_0xf47e80[_0x4b5a('0x1e')]:_0x445605[_0x4b5a('0x1c')]+_0x445605['limit'];var _0x378954;if(_0x32e9fb>=_0xe8a810){_0x32e9fb=_0xe8a810;_0x378954=0xc8;}else{_0x378954=0xce;}_0x114d7f['status'](_0x378954);return _0x114d7f[_0x4b5a('0x1f')](_0x4b5a('0x20'),_0x5c9f3c+'-'+_0x32e9fb+'/'+_0xe8a810)[_0x4b5a('0x1b')](_0xf47e80);}return null;};}function patchUpdates(_0x5f2e51){return function(_0x51893a){try{jsonpatch[_0x4b5a('0x21')](_0x51893a,_0x5f2e51,!![]);}catch(_0xd9e6da){return BPromise[_0x4b5a('0x22')](_0xd9e6da);}return _0x51893a[_0x4b5a('0x23')]();};}function saveUpdates(_0x573b58,_0x41b42b){return function(_0x3c8ccb){if(_0x3c8ccb){return _0x3c8ccb['update'](_0x573b58)[_0x4b5a('0x24')](function(_0x2a3f89){return _0x2a3f89;});}return null;};}function removeEntity(_0x26723b,_0xda0ba1){return function(_0x1ba45b){if(_0x1ba45b){return _0x1ba45b[_0x4b5a('0x25')]()[_0x4b5a('0x24')](function(){_0x26723b[_0x4b5a('0x19')](0xcc)[_0x4b5a('0x1a')]();});}};}function handleEntityNotFound(_0x59922d,_0x56d031){return function(_0x31b3e0){if(!_0x31b3e0){_0x59922d[_0x4b5a('0x26')](0x194);}return _0x31b3e0;};}function handleError(_0x30dc38,_0x2f6bf9){_0x2f6bf9=_0x2f6bf9||0x1f4;return function(_0x5b7405){logger[_0x4b5a('0x27')](_0x5b7405[_0x4b5a('0x28')]);if(_0x5b7405['name']){delete _0x5b7405[_0x4b5a('0x29')];}_0x30dc38['status'](_0x2f6bf9)[_0x4b5a('0x2a')](_0x5b7405);};}exports['index']=function(_0xae9e03,_0x2a2d48){var _0x303231={},_0x489752={},_0x331742={'count':0x0,'rows':[]};var _0x5a1903=_[_0x4b5a('0x2b')](db['SquareReport'][_0x4b5a('0x2c')],function(_0x2243cd){return{'name':_0x2243cd[_0x4b5a('0x2d')],'type':_0x2243cd[_0x4b5a('0x2e')][_0x4b5a('0x2f')]};});_0x489752[_0x4b5a('0x30')]=_[_0x4b5a('0x2b')](_0x5a1903,'name');_0x489752[_0x4b5a('0x31')]=_[_0x4b5a('0x32')](_0xae9e03[_0x4b5a('0x31')]);_0x489752[_0x4b5a('0x33')]=_[_0x4b5a('0x34')](_0x489752[_0x4b5a('0x30')],_0x489752[_0x4b5a('0x31')]);_0x303231['attributes']=_[_0x4b5a('0x34')](_0x489752[_0x4b5a('0x30')],qs[_0x4b5a('0x35')](_0xae9e03['query']['fields']));_0x303231['attributes']=_0x303231['attributes']['length']?_0x303231[_0x4b5a('0x36')]:_0x489752[_0x4b5a('0x30')];if(!_0xae9e03['query']['hasOwnProperty'](_0x4b5a('0x37'))){_0x303231[_0x4b5a('0x1d')]=qs['limit'](_0xae9e03['query']['limit']);_0x303231[_0x4b5a('0x1c')]=qs[_0x4b5a('0x1c')](_0xae9e03[_0x4b5a('0x31')][_0x4b5a('0x1c')]);}_0x303231[_0x4b5a('0x38')]=qs[_0x4b5a('0x39')](_0xae9e03['query']['sort']);_0x303231[_0x4b5a('0x3a')]=qs[_0x4b5a('0x33')](_[_0x4b5a('0x3b')](_0xae9e03[_0x4b5a('0x31')],_0x489752['filters']),_0x5a1903);if(_0xae9e03['query'][_0x4b5a('0x3c')]){_0x303231[_0x4b5a('0x3a')]=_[_0x4b5a('0x3d')](_0x303231[_0x4b5a('0x3a')],{'$or':_[_0x4b5a('0x2b')](_0x5a1903,function(_0x230345){if(_0x230345['type']!==_0x4b5a('0x3e')){var _0x86ec05={};_0x86ec05[_0x230345[_0x4b5a('0x29')]]={'$like':'%'+_0xae9e03[_0x4b5a('0x31')][_0x4b5a('0x3c')]+'%'};return _0x86ec05;}})});}_0x303231=_[_0x4b5a('0x3d')]({},_0x303231,_0xae9e03['options']);var _0x5bf34c={'where':_0x303231[_0x4b5a('0x3a')]};return db[_0x4b5a('0x3f')][_0x4b5a('0x1e')](_0x5bf34c)[_0x4b5a('0x24')](function(_0xe6a513){_0x331742[_0x4b5a('0x1e')]=_0xe6a513;if(_0xae9e03[_0x4b5a('0x31')][_0x4b5a('0x40')]){_0x303231['include']=[{'all':!![]}];}return db[_0x4b5a('0x3f')][_0x4b5a('0x41')](_0x303231);})[_0x4b5a('0x24')](function(_0x2260fb){_0x331742[_0x4b5a('0x42')]=_0x2260fb;return _0x331742;})[_0x4b5a('0x24')](respondWithFilteredResult(_0x2a2d48,_0x303231))[_0x4b5a('0x43')](handleError(_0x2a2d48,null));};exports[_0x4b5a('0x44')]=function(_0x26f106,_0x5c4508){var _0x9a036d={'raw':!![],'where':{'id':_0x26f106[_0x4b5a('0x45')]['id']}},_0x385a58={};_0x385a58['model']=_[_0x4b5a('0x32')](db[_0x4b5a('0x3f')][_0x4b5a('0x2c')]);_0x385a58['query']=_[_0x4b5a('0x32')](_0x26f106[_0x4b5a('0x31')]);_0x385a58[_0x4b5a('0x33')]=_['intersection'](_0x385a58[_0x4b5a('0x30')],_0x385a58[_0x4b5a('0x31')]);_0x9a036d['attributes']=_[_0x4b5a('0x34')](_0x385a58[_0x4b5a('0x30')],qs[_0x4b5a('0x35')](_0x26f106['query'][_0x4b5a('0x35')]));_0x9a036d[_0x4b5a('0x36')]=_0x9a036d[_0x4b5a('0x36')][_0x4b5a('0x46')]?_0x9a036d['attributes']:_0x385a58[_0x4b5a('0x30')];if(_0x26f106[_0x4b5a('0x31')][_0x4b5a('0x40')]){_0x9a036d[_0x4b5a('0x47')]=[{'all':!![]}];}_0x9a036d=_[_0x4b5a('0x3d')]({},_0x9a036d,_0x26f106[_0x4b5a('0x48')]);return db['SquareReport'][_0x4b5a('0x49')](_0x9a036d)[_0x4b5a('0x24')](handleEntityNotFound(_0x5c4508,null))[_0x4b5a('0x24')](respondWithResult(_0x5c4508,null))[_0x4b5a('0x43')](handleError(_0x5c4508,null));};exports[_0x4b5a('0x4a')]=function(_0x4dd12,_0x47425c){return db[_0x4b5a('0x3f')][_0x4b5a('0x4a')](_0x4dd12[_0x4b5a('0x4b')],{})[_0x4b5a('0x24')](respondWithResult(_0x47425c,0xc9))['catch'](handleError(_0x47425c,null));};exports[_0x4b5a('0x4c')]=function(_0x4f0fdc,_0x2c8b6a){if(_0x4f0fdc[_0x4b5a('0x4b')]['id']){delete _0x4f0fdc['body']['id'];}return db[_0x4b5a('0x3f')][_0x4b5a('0x49')]({'where':{'id':_0x4f0fdc['params']['id']}})['then'](handleEntityNotFound(_0x2c8b6a,null))[_0x4b5a('0x24')](saveUpdates(_0x4f0fdc['body'],null))[_0x4b5a('0x24')](respondWithResult(_0x2c8b6a,null))['catch'](handleError(_0x2c8b6a,null));};exports[_0x4b5a('0x25')]=function(_0x18059f,_0xb333f){return db[_0x4b5a('0x3f')][_0x4b5a('0x49')]({'where':{'id':_0x18059f['params']['id']}})[_0x4b5a('0x24')](handleEntityNotFound(_0xb333f,null))[_0x4b5a('0x24')](removeEntity(_0xb333f,null))[_0x4b5a('0x43')](handleError(_0xb333f,null));};exports[_0x4b5a('0x4d')]=function(_0x2b6818,_0xb2622d){return db[_0x4b5a('0x3f')][_0x4b5a('0x4d')]()[_0x4b5a('0x24')](respondWithResult(_0xb2622d,null))[_0x4b5a('0x43')](handleError(_0xb2622d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 03e06ce..058a626 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 _0x1da8=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','api','moment'];(function(_0x2447eb,_0x3ec090){var _0x19213e=function(_0x172e62){while(--_0x172e62){_0x2447eb['push'](_0x2447eb['shift']());}};_0x19213e(++_0x3ec090);}(_0x1da8,0x1ea));var _0x81da=function(_0x2e3dd4,_0xa1a10){_0x2e3dd4=_0x2e3dd4-0x0;var _0x48d991=_0x1da8[_0x2e3dd4];return _0x48d991;};'use strict';var _=require(_0x81da('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x81da('0x1'));var moment=require(_0x81da('0x2'));var BPromise=require(_0x81da('0x3'));var rp=require(_0x81da('0x4'));var fs=require('fs');var path=require(_0x81da('0x5'));var rimraf=require(_0x81da('0x6'));var config=require(_0x81da('0x7'));var attributes=require(_0x81da('0x8'));module[_0x81da('0x9')]=function(_0x2fc664,_0x56a864){return _0x2fc664[_0x81da('0xa')](_0x81da('0xb'),attributes,{'tableName':_0x81da('0xc'),'paranoid':![],'indexes':[{'name':_0x81da('0xd'),'fields':[_0x81da('0xe'),_0x81da('0xf')]},{'name':'leaveAt','fields':[_0x81da('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0696=['exports','define','uid_pname','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReport.attributes'];(function(_0x40fbee,_0x268f74){var _0x1d93e8=function(_0x55b3c1){while(--_0x55b3c1){_0x40fbee['push'](_0x40fbee['shift']());}};_0x1d93e8(++_0x268f74);}(_0x0696,0x118));var _0x6069=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x0696[_0x5beda8];return _0x2aa042;};'use strict';var _=require('lodash');var util=require(_0x6069('0x0'));var logger=require(_0x6069('0x1'))(_0x6069('0x2'));var moment=require(_0x6069('0x3'));var BPromise=require(_0x6069('0x4'));var rp=require(_0x6069('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6069('0x6'));var config=require('../../config/environment');var attributes=require(_0x6069('0x7'));module[_0x6069('0x8')]=function(_0x3f9b06,_0x32c787){return _0x3f9b06[_0x6069('0x9')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x6069('0xa'),'fields':['uniqueid','project_name']},{'name':_0x6069('0xb'),'fields':[_0x6069('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 59c73ee..bfd7e87 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 _0xae4d=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent','error','code','SquareReport,\x20%s,\x20%s','message','catch','SquareReport','create','body','options','CreateSquareReport','debug','stringify','UpdateSquareReport','update','where','attributes','lodash','util','moment'];(function(_0x45359b,_0x11f3f2){var _0x148eb=function(_0x599a60){while(--_0x599a60){_0x45359b['push'](_0x45359b['shift']());}};_0x148eb(++_0x11f3f2);}(_0xae4d,0x169));var _0xdae4=function(_0x44bb23,_0x80ed96){_0x44bb23=_0x44bb23-0x0;var _0x58c933=_0xae4d[_0x44bb23];return _0x58c933;};'use strict';var _=require(_0xdae4('0x0'));var util=require(_0xdae4('0x1'));var moment=require(_0xdae4('0x2'));var BPromise=require('bluebird');var rs=require(_0xdae4('0x3'));var fs=require('fs');var Redis=require(_0xdae4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdae4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdae4('0x6'));var jayson=require(_0xdae4('0x7'));var client=jayson['client'][_0xdae4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b25af,_0x5a69fb,_0x16ec89){return new BPromise(function(_0x4b9837,_0xa7ea10){return client['request'](_0x1b25af,_0x16ec89)[_0xdae4('0x9')](function(_0x1d6c89){logger[_0xdae4('0xa')]('SquareReport,\x20%s,\x20%s',_0x5a69fb,_0xdae4('0xb'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x5a69fb,_0xdae4('0xb'),JSON['stringify'](_0x1d6c89));if(_0x1d6c89[_0xdae4('0xc')]){if(_0x1d6c89[_0xdae4('0xc')][_0xdae4('0xd')]===0x1f4){logger[_0xdae4('0xc')](_0xdae4('0xe'),_0x5a69fb,_0x1d6c89['error'][_0xdae4('0xf')]);return _0xa7ea10(_0x1d6c89['error'][_0xdae4('0xf')]);}logger[_0xdae4('0xc')](_0xdae4('0xe'),_0x5a69fb,_0x1d6c89[_0xdae4('0xc')][_0xdae4('0xf')]);return _0x4b9837(_0x1d6c89[_0xdae4('0xc')][_0xdae4('0xf')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x5a69fb,_0xdae4('0xb'));_0x4b9837(_0x1d6c89['result'][_0xdae4('0xf')]);}})[_0xdae4('0x10')](function(_0x1896b7){logger[_0xdae4('0xc')](_0xdae4('0xe'),_0x5a69fb,_0x1896b7);_0xa7ea10(_0x1896b7);});});}exports['CreateSquareReport']=function(_0x4ec17a){var _0x596c69=this;return new Promise(function(_0x2615c5,_0xa338eb){return db[_0xdae4('0x11')][_0xdae4('0x12')](_0x4ec17a[_0xdae4('0x13')],{'raw':_0x4ec17a[_0xdae4('0x14')]?_0x4ec17a['options']['raw']===undefined?!![]:![]:!![]})[_0xdae4('0x9')](function(_0x5cf813){logger[_0xdae4('0xa')](_0xdae4('0x15'),_0x4ec17a);logger[_0xdae4('0x16')](_0xdae4('0x15'),_0x4ec17a,JSON[_0xdae4('0x17')](_0x5cf813));_0x2615c5(_0x5cf813);})['catch'](function(_0x5dd254){logger[_0xdae4('0xc')](_0xdae4('0x15'),_0x5dd254[_0xdae4('0xf')],_0x4ec17a);_0xa338eb(_0x596c69[_0xdae4('0xc')](0x1f4,_0x5dd254['message']));});});};exports[_0xdae4('0x18')]=function(_0x3fcf63){var _0x100fc8=this;return new Promise(function(_0x46e78d,_0x3ba52f){return db['SquareReport'][_0xdae4('0x19')](_0x3fcf63[_0xdae4('0x13')],{'raw':_0x3fcf63[_0xdae4('0x14')]?_0x3fcf63['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fcf63[_0xdae4('0x14')]?_0x3fcf63[_0xdae4('0x14')][_0xdae4('0x1a')]||null:null,'attributes':_0x3fcf63['options']?_0x3fcf63['options'][_0xdae4('0x1b')]||null:null,'limit':_0x3fcf63[_0xdae4('0x14')]?_0x3fcf63['options']['limit']||null:null})['then'](function(_0x37e5fe){logger['info']('UpdateSquareReport',_0x3fcf63);logger['debug'](_0xdae4('0x18'),_0x3fcf63,JSON[_0xdae4('0x17')](_0x37e5fe));_0x46e78d(_0x37e5fe);})[_0xdae4('0x10')](function(_0x2d499e){logger[_0xdae4('0xc')](_0xdae4('0x18'),_0x2d499e[_0xdae4('0xf')],_0x3fcf63);_0x3ba52f(_0x100fc8[_0xdae4('0xc')](0x1f4,_0x2d499e[_0xdae4('0xf')]));});});}; \ No newline at end of file +var _0x4599=['jayson/promise','client','then','info','debug','request\x20sent','stringify','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','UpdateSquareReport','update','raw','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4599,0x1e4));var _0x9459=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4599[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9459('0x0'));var util=require(_0x9459('0x1'));var moment=require('moment');var BPromise=require(_0x9459('0x2'));var rs=require(_0x9459('0x3'));var fs=require('fs');var Redis=require(_0x9459('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9459('0x5'));var logger=require(_0x9459('0x6'))(_0x9459('0x7'));var config=require(_0x9459('0x8'));var jayson=require(_0x9459('0x9'));var client=jayson[_0x9459('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11f11a,_0x4bde48,_0x2570c5){return new BPromise(function(_0x1a9a5a,_0x52706c){return client['request'](_0x11f11a,_0x2570c5)[_0x9459('0xb')](function(_0x8ae4a5){logger[_0x9459('0xc')]('SquareReport,\x20%s,\x20%s',_0x4bde48,'request\x20sent');logger[_0x9459('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x4bde48,_0x9459('0xe'),JSON[_0x9459('0xf')](_0x8ae4a5));if(_0x8ae4a5['error']){if(_0x8ae4a5[_0x9459('0x10')]['code']===0x1f4){logger['error'](_0x9459('0x11'),_0x4bde48,_0x8ae4a5[_0x9459('0x10')][_0x9459('0x12')]);return _0x52706c(_0x8ae4a5[_0x9459('0x10')][_0x9459('0x12')]);}logger[_0x9459('0x10')](_0x9459('0x11'),_0x4bde48,_0x8ae4a5[_0x9459('0x10')]['message']);return _0x1a9a5a(_0x8ae4a5[_0x9459('0x10')][_0x9459('0x12')]);}else{logger[_0x9459('0xc')](_0x9459('0x11'),_0x4bde48,_0x9459('0xe'));_0x1a9a5a(_0x8ae4a5[_0x9459('0x13')]['message']);}})[_0x9459('0x14')](function(_0x277fc7){logger['error']('SquareReport,\x20%s,\x20%s',_0x4bde48,_0x277fc7);_0x52706c(_0x277fc7);});});}exports[_0x9459('0x15')]=function(_0x46586a){var _0x5a2a14=this;return new Promise(function(_0x9fb0a1,_0x47692b){return db['SquareReport'][_0x9459('0x16')](_0x46586a[_0x9459('0x17')],{'raw':_0x46586a[_0x9459('0x18')]?_0x46586a[_0x9459('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x365568){logger[_0x9459('0xc')](_0x9459('0x15'),_0x46586a);logger[_0x9459('0xd')](_0x9459('0x15'),_0x46586a,JSON['stringify'](_0x365568));_0x9fb0a1(_0x365568);})['catch'](function(_0x16b53f){logger[_0x9459('0x10')](_0x9459('0x15'),_0x16b53f['message'],_0x46586a);_0x47692b(_0x5a2a14[_0x9459('0x10')](0x1f4,_0x16b53f[_0x9459('0x12')]));});});};exports[_0x9459('0x19')]=function(_0x4fbde7){var _0x315bf1=this;return new Promise(function(_0x55d8c7,_0x3f936f){return db['SquareReport'][_0x9459('0x1a')](_0x4fbde7[_0x9459('0x17')],{'raw':_0x4fbde7[_0x9459('0x18')]?_0x4fbde7[_0x9459('0x18')][_0x9459('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fbde7[_0x9459('0x18')]?_0x4fbde7[_0x9459('0x18')][_0x9459('0x1c')]||null:null,'attributes':_0x4fbde7[_0x9459('0x18')]?_0x4fbde7[_0x9459('0x18')]['attributes']||null:null,'limit':_0x4fbde7[_0x9459('0x18')]?_0x4fbde7['options']['limit']||null:null})[_0x9459('0xb')](function(_0x569dc7){logger[_0x9459('0xc')](_0x9459('0x19'),_0x4fbde7);logger[_0x9459('0xd')](_0x9459('0x19'),_0x4fbde7,JSON[_0x9459('0xf')](_0x569dc7));_0x55d8c7(_0x569dc7);})[_0x9459('0x14')](function(_0x1f31bb){logger[_0x9459('0x10')]('UpdateSquareReport',_0x1f31bb[_0x9459('0x12')],_0x4fbde7);_0x3f936f(_0x315bf1[_0x9459('0x10')](0x1f4,_0x1f31bb[_0x9459('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f9c7c3d..e7e93aa 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 _0xa814=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','multer'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0xa814,0x133));var _0x4a81=function(_0xa09846,_0x514b81){_0xa09846=_0xa09846-0x0;var _0x448823=_0xa814[_0xa09846];return _0x448823;};'use strict';var multer=require(_0x4a81('0x0'));var util=require(_0x4a81('0x1'));var path=require(_0x4a81('0x2'));var timeout=require(_0x4a81('0x3'));var express=require(_0x4a81('0x4'));var router=express[_0x4a81('0x5')]();var fs_extra=require(_0x4a81('0x6'));var auth=require(_0x4a81('0x7'));var interaction=require(_0x4a81('0x8'));var config=require('../../config/environment');var controller=require(_0x4a81('0x9'));router[_0x4a81('0xa')]('/',auth['isAuthenticated'](),controller[_0x4a81('0xb')]);router[_0x4a81('0xa')](_0x4a81('0xc'),auth[_0x4a81('0xd')](),controller[_0x4a81('0xe')]);router[_0x4a81('0xa')]('/:id',auth[_0x4a81('0xd')](),controller[_0x4a81('0xf')]);router[_0x4a81('0x10')]('/',auth[_0x4a81('0xd')](),controller[_0x4a81('0x11')]);router['put'](_0x4a81('0x12'),auth[_0x4a81('0xd')](),controller[_0x4a81('0x13')]);router[_0x4a81('0x14')](_0x4a81('0x12'),auth[_0x4a81('0xd')](),controller[_0x4a81('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1c9b=['isAuthenticated','/:id','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index'];(function(_0x2acc3e,_0x25e62b){var _0x5801a9=function(_0x9c0067){while(--_0x9c0067){_0x2acc3e['push'](_0x2acc3e['shift']());}};_0x5801a9(++_0x25e62b);}(_0x1c9b,0xf1));var _0xb1c9=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x1c9b[_0x3fcc20];return _0x15d3ce;};'use strict';var multer=require(_0xb1c9('0x0'));var util=require(_0xb1c9('0x1'));var path=require('path');var timeout=require(_0xb1c9('0x2'));var express=require(_0xb1c9('0x3'));var router=express[_0xb1c9('0x4')]();var fs_extra=require(_0xb1c9('0x5'));var auth=require(_0xb1c9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb1c9('0x7'));var controller=require(_0xb1c9('0x8'));router[_0xb1c9('0x9')]('/',auth['isAuthenticated'](),controller[_0xb1c9('0xa')]);router['get']('/describe',auth[_0xb1c9('0xb')](),controller['describe']);router['get'](_0xb1c9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb1c9('0xd')]('/',auth[_0xb1c9('0xb')](),controller[_0xb1c9('0xe')]);router['put'](_0xb1c9('0xc'),auth[_0xb1c9('0xb')](),controller[_0xb1c9('0xf')]);router[_0xb1c9('0x10')](_0xb1c9('0xc'),auth[_0xb1c9('0xb')](),controller[_0xb1c9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3bc1ba0..b936aeb 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 _0x18e1=['STRING','TEXT','exports'];(function(_0x39e888,_0x149263){var _0x2adfcb=function(_0x52a5c1){while(--_0x52a5c1){_0x39e888['push'](_0x39e888['shift']());}};_0x2adfcb(++_0x149263);}(_0x18e1,0x11f));var _0x118e=function(_0x56ee02,_0x410bb2){_0x56ee02=_0x56ee02-0x0;var _0x92942e=_0x18e1[_0x56ee02];return _0x92942e;};'use strict';var Sequelize=require('sequelize');module[_0x118e('0x0')]={'uniqueid':{'type':Sequelize[_0x118e('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x118e('0x2')]},'project_name':{'type':Sequelize[_0x118e('0x1')]},'callerid':{'type':Sequelize[_0x118e('0x1')]}}; \ No newline at end of file +var _0x0d6e=['TEXT','sequelize','exports','STRING'];(function(_0x562bf7,_0x5b80ac){var _0x17825b=function(_0x4804ae){while(--_0x4804ae){_0x562bf7['push'](_0x562bf7['shift']());}};_0x17825b(++_0x5b80ac);}(_0x0d6e,0x1f1));var _0xe0d6=function(_0x4c0d7f,_0x13ddc0){_0x4c0d7f=_0x4c0d7f-0x0;var _0x5dfb7a=_0x0d6e[_0x4c0d7f];return _0x5dfb7a;};'use strict';var Sequelize=require(_0xe0d6('0x0'));module[_0xe0d6('0x1')]={'uniqueid':{'type':Sequelize[_0xe0d6('0x2')]},'node':{'type':Sequelize[_0xe0d6('0x2')]},'application':{'type':Sequelize[_0xe0d6('0x2')]},'data':{'type':Sequelize[_0xe0d6('0x3')]},'project_name':{'type':Sequelize[_0xe0d6('0x2')]},'callerid':{'type':Sequelize[_0xe0d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index effac89..87dd763 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 _0x50a0=['../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','sendStatus','error','stack','name','map','SquareDetailsReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x15c517,_0x482d0a){var _0x3e8c45=function(_0x4dab13){while(--_0x4dab13){_0x15c517['push'](_0x15c517['shift']());}};_0x3e8c45(++_0x482d0a);}(_0x50a0,0x80));var _0x050a=function(_0x51b881,_0x729665){_0x51b881=_0x51b881-0x0;var _0x4fd299=_0x50a0[_0x51b881];return _0x4fd299;};'use strict';var emlformat=require(_0x050a('0x0'));var rimraf=require(_0x050a('0x1'));var zipdir=require(_0x050a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x050a('0x3'));var moment=require(_0x050a('0x4'));var BPromise=require(_0x050a('0x5'));var Mustache=require(_0x050a('0x6'));var util=require(_0x050a('0x7'));var path=require(_0x050a('0x8'));var sox=require(_0x050a('0x9'));var csv=require(_0x050a('0xa'));var ejs=require(_0x050a('0xb'));var fs=require('fs');var fs_extra=require(_0x050a('0xc'));var _=require(_0x050a('0xd'));var squel=require(_0x050a('0xe'));var crypto=require(_0x050a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x050a('0x10'));var toCsv=require(_0x050a('0xa'));var querystring=require(_0x050a('0x11'));var Papa=require(_0x050a('0x12'));var Redis=require(_0x050a('0x13'));var authService=require(_0x050a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x050a('0x15'));var hardwareService=require(_0x050a('0x16'));var logger=require('../../config/logger')(_0x050a('0x17'));var utils=require(_0x050a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x050a('0x19'))['db'];function respondWithStatusCode(_0x22103b,_0x2fb92d){_0x2fb92d=_0x2fb92d||0xcc;return function(_0x3438e9){if(_0x3438e9){return _0x22103b['sendStatus'](_0x2fb92d);}return _0x22103b[_0x050a('0x1a')](_0x2fb92d)[_0x050a('0x1b')]();};}function respondWithResult(_0x9c8d4a,_0x325a01){_0x325a01=_0x325a01||0xc8;return function(_0x4b8032){if(_0x4b8032){return _0x9c8d4a['status'](_0x325a01)[_0x050a('0x1c')](_0x4b8032);}};}function respondWithFilteredResult(_0x5455c9,_0x269685){return function(_0x10f785){if(_0x10f785){var _0x1860ad=typeof _0x269685[_0x050a('0x1d')]===_0x050a('0x1e')&&typeof _0x269685[_0x050a('0x1f')]===_0x050a('0x1e');var _0x1fc626=_0x10f785[_0x050a('0x20')];var _0x21fe10=_0x1860ad?0x0:_0x269685[_0x050a('0x1d')];var _0x10a2ce=_0x1860ad?_0x10f785[_0x050a('0x20')]:_0x269685[_0x050a('0x1d')]+_0x269685[_0x050a('0x1f')];var _0x23b3c1;if(_0x10a2ce>=_0x1fc626){_0x10a2ce=_0x1fc626;_0x23b3c1=0xc8;}else{_0x23b3c1=0xce;}_0x5455c9[_0x050a('0x1a')](_0x23b3c1);return _0x5455c9[_0x050a('0x21')]('Content-Range',_0x21fe10+'-'+_0x10a2ce+'/'+_0x1fc626)[_0x050a('0x1c')](_0x10f785);}return null;};}function patchUpdates(_0xbf8163){return function(_0x238768){try{jsonpatch['apply'](_0x238768,_0xbf8163,!![]);}catch(_0x1a649){return BPromise[_0x050a('0x22')](_0x1a649);}return _0x238768[_0x050a('0x23')]();};}function saveUpdates(_0x3e9a40,_0x15a6e8){return function(_0x2ba01b){if(_0x2ba01b){return _0x2ba01b[_0x050a('0x24')](_0x3e9a40)['then'](function(_0x1cf11c){return _0x1cf11c;});}return null;};}function removeEntity(_0x33a646,_0x9d1c31){return function(_0x497b86){if(_0x497b86){return _0x497b86[_0x050a('0x25')]()[_0x050a('0x26')](function(){_0x33a646[_0x050a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d67d6,_0x1eea25){return function(_0x236cfb){if(!_0x236cfb){_0x1d67d6[_0x050a('0x27')](0x194);}return _0x236cfb;};}function handleError(_0x452846,_0x5d173d){_0x5d173d=_0x5d173d||0x1f4;return function(_0x52bd95){logger[_0x050a('0x28')](_0x52bd95[_0x050a('0x29')]);if(_0x52bd95[_0x050a('0x2a')]){delete _0x52bd95[_0x050a('0x2a')];}_0x452846[_0x050a('0x1a')](_0x5d173d)['send'](_0x52bd95);};}exports['index']=function(_0x2ec273,_0x4960b0){var _0x448c04={},_0x10512b={},_0x5c0568={'count':0x0,'rows':[]};var _0x4be812=_[_0x050a('0x2b')](db[_0x050a('0x2c')]['rawAttributes'],function(_0x40b660){return{'name':_0x40b660[_0x050a('0x2d')],'type':_0x40b660[_0x050a('0x2e')][_0x050a('0x2f')]};});_0x10512b['model']=_['map'](_0x4be812,'name');_0x10512b[_0x050a('0x30')]=_[_0x050a('0x31')](_0x2ec273[_0x050a('0x30')]);_0x10512b[_0x050a('0x32')]=_[_0x050a('0x33')](_0x10512b[_0x050a('0x34')],_0x10512b['query']);_0x448c04[_0x050a('0x35')]=_[_0x050a('0x33')](_0x10512b[_0x050a('0x34')],qs['fields'](_0x2ec273['query'][_0x050a('0x36')]));_0x448c04[_0x050a('0x35')]=_0x448c04['attributes']['length']?_0x448c04[_0x050a('0x35')]:_0x10512b[_0x050a('0x34')];if(!_0x2ec273[_0x050a('0x30')][_0x050a('0x37')]('nolimit')){_0x448c04['limit']=qs['limit'](_0x2ec273[_0x050a('0x30')][_0x050a('0x1f')]);_0x448c04[_0x050a('0x1d')]=qs[_0x050a('0x1d')](_0x2ec273[_0x050a('0x30')][_0x050a('0x1d')]);}_0x448c04[_0x050a('0x38')]=qs[_0x050a('0x39')](_0x2ec273[_0x050a('0x30')]['sort']);_0x448c04[_0x050a('0x3a')]=qs['filters'](_[_0x050a('0x3b')](_0x2ec273['query'],_0x10512b[_0x050a('0x32')]),_0x4be812);if(_0x2ec273['query'][_0x050a('0x3c')]){_0x448c04[_0x050a('0x3a')]=_[_0x050a('0x3d')](_0x448c04[_0x050a('0x3a')],{'$or':_[_0x050a('0x2b')](_0x4be812,function(_0x248701){if(_0x248701[_0x050a('0x2e')]!=='VIRTUAL'){var _0x461c63={};_0x461c63[_0x248701[_0x050a('0x2a')]]={'$like':'%'+_0x2ec273[_0x050a('0x30')]['filter']+'%'};return _0x461c63;}})});}_0x448c04=_[_0x050a('0x3d')]({},_0x448c04,_0x2ec273[_0x050a('0x3e')]);var _0x152d3e={'where':_0x448c04[_0x050a('0x3a')]};return db[_0x050a('0x2c')][_0x050a('0x20')](_0x152d3e)[_0x050a('0x26')](function(_0x2a07f3){_0x5c0568[_0x050a('0x20')]=_0x2a07f3;if(_0x2ec273[_0x050a('0x30')][_0x050a('0x3f')]){_0x448c04[_0x050a('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x050a('0x41')](_0x448c04);})['then'](function(_0x4f17ac){_0x5c0568[_0x050a('0x42')]=_0x4f17ac;return _0x5c0568;})[_0x050a('0x26')](respondWithFilteredResult(_0x4960b0,_0x448c04))[_0x050a('0x43')](handleError(_0x4960b0,null));};exports[_0x050a('0x44')]=function(_0x16c0a9,_0x41d430){var _0x24a050={'raw':!![],'where':{'id':_0x16c0a9[_0x050a('0x45')]['id']}},_0x1e2450={};_0x1e2450[_0x050a('0x34')]=_[_0x050a('0x31')](db['SquareDetailsReport'][_0x050a('0x46')]);_0x1e2450['query']=_[_0x050a('0x31')](_0x16c0a9['query']);_0x1e2450[_0x050a('0x32')]=_[_0x050a('0x33')](_0x1e2450[_0x050a('0x34')],_0x1e2450[_0x050a('0x30')]);_0x24a050[_0x050a('0x35')]=_[_0x050a('0x33')](_0x1e2450[_0x050a('0x34')],qs[_0x050a('0x36')](_0x16c0a9[_0x050a('0x30')]['fields']));_0x24a050[_0x050a('0x35')]=_0x24a050[_0x050a('0x35')]['length']?_0x24a050[_0x050a('0x35')]:_0x1e2450[_0x050a('0x34')];if(_0x16c0a9[_0x050a('0x30')][_0x050a('0x3f')]){_0x24a050[_0x050a('0x40')]=[{'all':!![]}];}_0x24a050=_[_0x050a('0x3d')]({},_0x24a050,_0x16c0a9[_0x050a('0x3e')]);return db['SquareDetailsReport'][_0x050a('0x47')](_0x24a050)[_0x050a('0x26')](handleEntityNotFound(_0x41d430,null))[_0x050a('0x26')](respondWithResult(_0x41d430,null))[_0x050a('0x43')](handleError(_0x41d430,null));};exports[_0x050a('0x48')]=function(_0x2f4df9,_0x377838){return db['SquareDetailsReport'][_0x050a('0x48')](_0x2f4df9[_0x050a('0x49')],{})['then'](respondWithResult(_0x377838,0xc9))[_0x050a('0x43')](handleError(_0x377838,null));};exports[_0x050a('0x24')]=function(_0x43d876,_0x47b87a){if(_0x43d876[_0x050a('0x49')]['id']){delete _0x43d876[_0x050a('0x49')]['id'];}return db['SquareDetailsReport'][_0x050a('0x47')]({'where':{'id':_0x43d876[_0x050a('0x45')]['id']}})['then'](handleEntityNotFound(_0x47b87a,null))[_0x050a('0x26')](saveUpdates(_0x43d876[_0x050a('0x49')],null))[_0x050a('0x26')](respondWithResult(_0x47b87a,null))[_0x050a('0x43')](handleError(_0x47b87a,null));};exports['destroy']=function(_0x987851,_0xdcb527){return db[_0x050a('0x2c')]['find']({'where':{'id':_0x987851['params']['id']}})[_0x050a('0x26')](handleEntityNotFound(_0xdcb527,null))[_0x050a('0x26')](removeEntity(_0xdcb527,null))[_0x050a('0x43')](handleError(_0xdcb527,null));};exports[_0x050a('0x4a')]=function(_0x3bad47,_0x3b05ab){return db[_0x050a('0x2c')]['describe']()[_0x050a('0x26')](respondWithResult(_0x3b05ab,null))[_0x050a('0x43')](handleError(_0x3b05ab,null));}; \ No newline at end of file +var _0xc9e3=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SquareDetailsReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection'];(function(_0x59e9f5,_0x430097){var _0x3fa278=function(_0x170f85){while(--_0x170f85){_0x59e9f5['push'](_0x59e9f5['shift']());}};_0x3fa278(++_0x430097);}(_0xc9e3,0xb7));var _0x3c9e=function(_0x4c1b2b,_0x10a40c){_0x4c1b2b=_0x4c1b2b-0x0;var _0x55c160=_0xc9e3[_0x4c1b2b];return _0x55c160;};'use strict';var emlformat=require(_0x3c9e('0x0'));var rimraf=require(_0x3c9e('0x1'));var zipdir=require(_0x3c9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c9e('0x3'));var moment=require(_0x3c9e('0x4'));var BPromise=require(_0x3c9e('0x5'));var Mustache=require(_0x3c9e('0x6'));var util=require(_0x3c9e('0x7'));var path=require(_0x3c9e('0x8'));var sox=require('sox');var csv=require(_0x3c9e('0x9'));var ejs=require(_0x3c9e('0xa'));var fs=require('fs');var fs_extra=require(_0x3c9e('0xb'));var _=require(_0x3c9e('0xc'));var squel=require(_0x3c9e('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c9e('0xe'));var deskjs=require(_0x3c9e('0xf'));var toCsv=require(_0x3c9e('0x9'));var querystring=require('querystring');var Papa=require(_0x3c9e('0x10'));var Redis=require('ioredis');var authService=require(_0x3c9e('0x11'));var qs=require(_0x3c9e('0x12'));var as=require(_0x3c9e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3c9e('0x14'));var utils=require(_0x3c9e('0x15'));var config=require(_0x3c9e('0x16'));var licenseUtil=require(_0x3c9e('0x17'));var db=require(_0x3c9e('0x18'))['db'];function respondWithStatusCode(_0x5e8191,_0x23f106){_0x23f106=_0x23f106||0xcc;return function(_0x1c31eb){if(_0x1c31eb){return _0x5e8191[_0x3c9e('0x19')](_0x23f106);}return _0x5e8191[_0x3c9e('0x1a')](_0x23f106)[_0x3c9e('0x1b')]();};}function respondWithResult(_0x1c80c6,_0x2c0c19){_0x2c0c19=_0x2c0c19||0xc8;return function(_0xd1afab){if(_0xd1afab){return _0x1c80c6[_0x3c9e('0x1a')](_0x2c0c19)[_0x3c9e('0x1c')](_0xd1afab);}};}function respondWithFilteredResult(_0x6c0dd3,_0x3d1749){return function(_0x391fca){if(_0x391fca){var _0x3a3de8=typeof _0x3d1749[_0x3c9e('0x1d')]===_0x3c9e('0x1e')&&typeof _0x3d1749[_0x3c9e('0x1f')]===_0x3c9e('0x1e');var _0x5c8802=_0x391fca[_0x3c9e('0x20')];var _0x1edf59=_0x3a3de8?0x0:_0x3d1749[_0x3c9e('0x1d')];var _0x6c4666=_0x3a3de8?_0x391fca[_0x3c9e('0x20')]:_0x3d1749['offset']+_0x3d1749[_0x3c9e('0x1f')];var _0x3d1960;if(_0x6c4666>=_0x5c8802){_0x6c4666=_0x5c8802;_0x3d1960=0xc8;}else{_0x3d1960=0xce;}_0x6c0dd3['status'](_0x3d1960);return _0x6c0dd3[_0x3c9e('0x21')](_0x3c9e('0x22'),_0x1edf59+'-'+_0x6c4666+'/'+_0x5c8802)['json'](_0x391fca);}return null;};}function patchUpdates(_0x3954a2){return function(_0x44ab02){try{jsonpatch[_0x3c9e('0x23')](_0x44ab02,_0x3954a2,!![]);}catch(_0x2da3c2){return BPromise['reject'](_0x2da3c2);}return _0x44ab02[_0x3c9e('0x24')]();};}function saveUpdates(_0x209fdd,_0xcbc4fe){return function(_0x188cf8){if(_0x188cf8){return _0x188cf8[_0x3c9e('0x25')](_0x209fdd)[_0x3c9e('0x26')](function(_0x1faffa){return _0x1faffa;});}return null;};}function removeEntity(_0x275296,_0x350f69){return function(_0x6f20fa){if(_0x6f20fa){return _0x6f20fa['destroy']()['then'](function(){_0x275296[_0x3c9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc79d,_0x1f5586){return function(_0x63d407){if(!_0x63d407){_0x2fc79d[_0x3c9e('0x19')](0x194);}return _0x63d407;};}function handleError(_0x320150,_0x15c183){_0x15c183=_0x15c183||0x1f4;return function(_0x11ba20){logger[_0x3c9e('0x27')](_0x11ba20[_0x3c9e('0x28')]);if(_0x11ba20['name']){delete _0x11ba20[_0x3c9e('0x29')];}_0x320150[_0x3c9e('0x1a')](_0x15c183)[_0x3c9e('0x2a')](_0x11ba20);};}exports[_0x3c9e('0x2b')]=function(_0xb69dbd,_0x29d189){var _0x3f60ce={},_0x347eeb={},_0x1c5cdc={'count':0x0,'rows':[]};var _0x232b03=_['map'](db['SquareDetailsReport'][_0x3c9e('0x2c')],function(_0x321cc4){return{'name':_0x321cc4[_0x3c9e('0x2d')],'type':_0x321cc4[_0x3c9e('0x2e')][_0x3c9e('0x2f')]};});_0x347eeb[_0x3c9e('0x30')]=_[_0x3c9e('0x31')](_0x232b03,'name');_0x347eeb['query']=_[_0x3c9e('0x32')](_0xb69dbd[_0x3c9e('0x33')]);_0x347eeb[_0x3c9e('0x34')]=_[_0x3c9e('0x35')](_0x347eeb[_0x3c9e('0x30')],_0x347eeb[_0x3c9e('0x33')]);_0x3f60ce['attributes']=_[_0x3c9e('0x35')](_0x347eeb[_0x3c9e('0x30')],qs[_0x3c9e('0x36')](_0xb69dbd['query'][_0x3c9e('0x36')]));_0x3f60ce[_0x3c9e('0x37')]=_0x3f60ce[_0x3c9e('0x37')][_0x3c9e('0x38')]?_0x3f60ce[_0x3c9e('0x37')]:_0x347eeb[_0x3c9e('0x30')];if(!_0xb69dbd[_0x3c9e('0x33')][_0x3c9e('0x39')](_0x3c9e('0x3a'))){_0x3f60ce[_0x3c9e('0x1f')]=qs[_0x3c9e('0x1f')](_0xb69dbd[_0x3c9e('0x33')]['limit']);_0x3f60ce[_0x3c9e('0x1d')]=qs[_0x3c9e('0x1d')](_0xb69dbd[_0x3c9e('0x33')][_0x3c9e('0x1d')]);}_0x3f60ce[_0x3c9e('0x3b')]=qs[_0x3c9e('0x3c')](_0xb69dbd[_0x3c9e('0x33')]['sort']);_0x3f60ce['where']=qs['filters'](_[_0x3c9e('0x3d')](_0xb69dbd[_0x3c9e('0x33')],_0x347eeb['filters']),_0x232b03);if(_0xb69dbd['query']['filter']){_0x3f60ce[_0x3c9e('0x3e')]=_[_0x3c9e('0x3f')](_0x3f60ce[_0x3c9e('0x3e')],{'$or':_[_0x3c9e('0x31')](_0x232b03,function(_0x3d00fe){if(_0x3d00fe[_0x3c9e('0x2e')]!==_0x3c9e('0x40')){var _0x51bd83={};_0x51bd83[_0x3d00fe[_0x3c9e('0x29')]]={'$like':'%'+_0xb69dbd[_0x3c9e('0x33')][_0x3c9e('0x41')]+'%'};return _0x51bd83;}})});}_0x3f60ce=_[_0x3c9e('0x3f')]({},_0x3f60ce,_0xb69dbd[_0x3c9e('0x42')]);var _0x493e41={'where':_0x3f60ce[_0x3c9e('0x3e')]};return db[_0x3c9e('0x43')][_0x3c9e('0x20')](_0x493e41)[_0x3c9e('0x26')](function(_0x3a0cf4){_0x1c5cdc[_0x3c9e('0x20')]=_0x3a0cf4;if(_0xb69dbd[_0x3c9e('0x33')][_0x3c9e('0x44')]){_0x3f60ce['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x3c9e('0x45')](_0x3f60ce);})[_0x3c9e('0x26')](function(_0x48066e){_0x1c5cdc[_0x3c9e('0x46')]=_0x48066e;return _0x1c5cdc;})['then'](respondWithFilteredResult(_0x29d189,_0x3f60ce))[_0x3c9e('0x47')](handleError(_0x29d189,null));};exports[_0x3c9e('0x48')]=function(_0x1b309a,_0x1cadd8){var _0x260167={'raw':!![],'where':{'id':_0x1b309a[_0x3c9e('0x49')]['id']}},_0x40193d={};_0x40193d[_0x3c9e('0x30')]=_['keys'](db[_0x3c9e('0x43')][_0x3c9e('0x2c')]);_0x40193d['query']=_[_0x3c9e('0x32')](_0x1b309a[_0x3c9e('0x33')]);_0x40193d[_0x3c9e('0x34')]=_[_0x3c9e('0x35')](_0x40193d[_0x3c9e('0x30')],_0x40193d['query']);_0x260167['attributes']=_['intersection'](_0x40193d['model'],qs[_0x3c9e('0x36')](_0x1b309a[_0x3c9e('0x33')][_0x3c9e('0x36')]));_0x260167['attributes']=_0x260167[_0x3c9e('0x37')][_0x3c9e('0x38')]?_0x260167[_0x3c9e('0x37')]:_0x40193d[_0x3c9e('0x30')];if(_0x1b309a[_0x3c9e('0x33')]['includeAll']){_0x260167[_0x3c9e('0x4a')]=[{'all':!![]}];}_0x260167=_[_0x3c9e('0x3f')]({},_0x260167,_0x1b309a[_0x3c9e('0x42')]);return db[_0x3c9e('0x43')][_0x3c9e('0x4b')](_0x260167)[_0x3c9e('0x26')](handleEntityNotFound(_0x1cadd8,null))[_0x3c9e('0x26')](respondWithResult(_0x1cadd8,null))[_0x3c9e('0x47')](handleError(_0x1cadd8,null));};exports[_0x3c9e('0x4c')]=function(_0x56dec1,_0x567eb8){return db[_0x3c9e('0x43')][_0x3c9e('0x4c')](_0x56dec1[_0x3c9e('0x4d')],{})[_0x3c9e('0x26')](respondWithResult(_0x567eb8,0xc9))[_0x3c9e('0x47')](handleError(_0x567eb8,null));};exports[_0x3c9e('0x25')]=function(_0x58745e,_0x51d385){if(_0x58745e[_0x3c9e('0x4d')]['id']){delete _0x58745e[_0x3c9e('0x4d')]['id'];}return db[_0x3c9e('0x43')][_0x3c9e('0x4b')]({'where':{'id':_0x58745e[_0x3c9e('0x49')]['id']}})[_0x3c9e('0x26')](handleEntityNotFound(_0x51d385,null))[_0x3c9e('0x26')](saveUpdates(_0x58745e[_0x3c9e('0x4d')],null))[_0x3c9e('0x26')](respondWithResult(_0x51d385,null))[_0x3c9e('0x47')](handleError(_0x51d385,null));};exports['destroy']=function(_0x3a50f4,_0x586664){return db[_0x3c9e('0x43')][_0x3c9e('0x4b')]({'where':{'id':_0x3a50f4[_0x3c9e('0x49')]['id']}})[_0x3c9e('0x26')](handleEntityNotFound(_0x586664,null))[_0x3c9e('0x26')](removeEntity(_0x586664,null))['catch'](handleError(_0x586664,null));};exports[_0x3c9e('0x4e')]=function(_0x3b1c0b,_0x3055df){return db[_0x3c9e('0x43')][_0x3c9e('0x4e')]()[_0x3c9e('0x26')](respondWithResult(_0x3055df,null))['catch'](handleError(_0x3055df,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1f61c8b..20c39b1 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 _0xcce1=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash'];(function(_0x4a2c6d,_0x2c2311){var _0x328eb4=function(_0x6f9b36){while(--_0x6f9b36){_0x4a2c6d['push'](_0x4a2c6d['shift']());}};_0x328eb4(++_0x2c2311);}(_0xcce1,0xdb));var _0x1cce=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xcce1[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x1cce('0x0'));var util=require(_0x1cce('0x1'));var logger=require(_0x1cce('0x2'))(_0x1cce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1cce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cce('0x5'));var config=require(_0x1cce('0x6'));var attributes=require(_0x1cce('0x7'));module[_0x1cce('0x8')]=function(_0x4fcb30,_0x1f3b12){return _0x4fcb30[_0x1cce('0x9')](_0x1cce('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6588=['exports','define','report_square_details','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes'];(function(_0x85ca3a,_0xea99ce){var _0x3ca94c=function(_0x1946b7){while(--_0x1946b7){_0x85ca3a['push'](_0x85ca3a['shift']());}};_0x3ca94c(++_0xea99ce);}(_0x6588,0xc1));var _0x8658=function(_0x541f4e,_0x1aaa66){_0x541f4e=_0x541f4e-0x0;var _0x48ad45=_0x6588[_0x541f4e];return _0x48ad45;};'use strict';var _=require(_0x8658('0x0'));var util=require('util');var logger=require(_0x8658('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8658('0x2'));var rp=require(_0x8658('0x3'));var fs=require('fs');var path=require(_0x8658('0x4'));var rimraf=require('rimraf');var config=require(_0x8658('0x5'));var attributes=require(_0x8658('0x6'));module[_0x8658('0x7')]=function(_0x5b69b4,_0xfa3bbf){return _0x5b69b4[_0x8658('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x8658('0x9'),'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 468e953..3eb1c03 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 _0x4e2e=['options','raw','CreateSquareDetailsReport','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SquareDetailsReport','create','body'];(function(_0x4ed5d0,_0x2a53f8){var _0x509b5e=function(_0x3e3a67){while(--_0x3e3a67){_0x4ed5d0['push'](_0x4ed5d0['shift']());}};_0x509b5e(++_0x2a53f8);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x5a92d3,_0x3bb350){_0x5a92d3=_0x5a92d3-0x0;var _0x267492=_0x4e2e[_0x5a92d3];return _0x267492;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['CreateSquareDetailsReport']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![]})[_0xe4e2('0xc')](function(_0x362741){logger['info'](_0xe4e2('0x1a'),_0x196f16);logger[_0xe4e2('0x1b')](_0xe4e2('0x1a'),_0x196f16,JSON[_0xe4e2('0x11')](_0x362741));_0x1d5e9d(_0x362741);})[_0xe4e2('0x1c')](function(_0x23b466){logger[_0xe4e2('0x12')]('CreateSquareDetailsReport',_0x23b466[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x23b466[_0xe4e2('0x13')]));});});}; \ No newline at end of file +var _0xaebd=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareDetailsReport,\x20%s,\x20%s','catch','CreateSquareDetailsReport','create','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x30d055,_0x2e32dd){var _0xde8f15=function(_0x5bb022){while(--_0x5bb022){_0x30d055['push'](_0x30d055['shift']());}};_0xde8f15(++_0x2e32dd);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x18ea98,_0x402166){_0x18ea98=_0x18ea98-0x0;var _0x10ba99=_0xaebd[_0x18ea98];return _0x10ba99;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['SquareDetailsReport'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e97e0){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x19')](_0xdaeb('0x15'),_0x1b5243,JSON[_0xdaeb('0x10')](_0x4e97e0));_0x2d8f11(_0x4e97e0);})['catch'](function(_0x597bb7){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x597bb7[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x597bb7[_0xdaeb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index afb95ca..7fef389 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 _0xe7b5=['killProcess','exports','express','../../components/auth/service','isAuthenticated','index','get','/process/:pid/kill'];(function(_0x11f89d,_0x18070f){var _0x318aa8=function(_0x22632f){while(--_0x22632f){_0x11f89d['push'](_0x11f89d['shift']());}};_0x318aa8(++_0x18070f);}(_0xe7b5,0x162));var _0x5e7b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe7b5[_0x167cc1];return _0x10bc4b;};'use strict';var express=require(_0x5e7b('0x0'));var router=express['Router']();var auth=require(_0x5e7b('0x1'));var controller=require('./system.controller');router['get']('/',auth[_0x5e7b('0x2')](),controller[_0x5e7b('0x3')]);router[_0x5e7b('0x4')](_0x5e7b('0x5'),auth[_0x5e7b('0x2')](),controller[_0x5e7b('0x6')]);module[_0x5e7b('0x7')]=router; \ No newline at end of file +var _0x55d5=['express','Router','../../components/auth/service','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x3a6b3b,_0x5cb411){var _0x901318=function(_0x44b49d){while(--_0x44b49d){_0x3a6b3b['push'](_0x3a6b3b['shift']());}};_0x901318(++_0x5cb411);}(_0x55d5,0x1c0));var _0x555d=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x55d5[_0x5ddaac];return _0x2a9c58;};'use strict';var express=require(_0x555d('0x0'));var router=express[_0x555d('0x1')]();var auth=require(_0x555d('0x2'));var controller=require('./system.controller');router[_0x555d('0x3')]('/',auth[_0x555d('0x4')](),controller[_0x555d('0x5')]);router[_0x555d('0x3')](_0x555d('0x6'),auth[_0x555d('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f3b8710..71d8a2c 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 _0xc671=['split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','status','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','index','getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0x21001b,_0x3ff1a8){var _0x665a00=function(_0x98d912){while(--_0x98d912){_0x21001b['push'](_0x21001b['shift']());}};_0x665a00(++_0x3ff1a8);}(_0xc671,0xd7));var _0x1c67=function(_0x3c1940,_0x13fd09){_0x3c1940=_0x3c1940-0x0;var _0x31c4cd=_0xc671[_0x3c1940];return _0x31c4cd;};'use strict';var info=require(_0x1c67('0x0'));var exec=require(_0x1c67('0x1'))['exec'];var logger=require(_0x1c67('0x2'))(_0x1c67('0x3'));var util=require('util');var BPromise=require(_0x1c67('0x4'));var _=require(_0x1c67('0x5'));function handleError(_0x1059ac,_0x922186,_0x377d21){_0x922186=_0x922186||0x1f4;return function(_0x2acfc6){logger[_0x1c67('0x6')](_0x1c67('0x7'),_0x377d21,_0x922186,util[_0x1c67('0x8')](_0x2acfc6,{'showHidden':![],'depth':null}));delete _0x2acfc6['name'];_0x1059ac['status'](_0x922186)['send'](_0x2acfc6);};}exports[_0x1c67('0x9')]=function(_0x1b36af,_0x470102){return info[_0x1c67('0xa')]()[_0x1c67('0xb')](function(_0x3610da){return _0x470102['status'](0xc8)[_0x1c67('0xc')](_0x3610da);})[_0x1c67('0xd')](function(_0x43d4d1){return _0x470102['status'](0x1f4)['json'](_0x43d4d1);});};exports[_0x1c67('0xe')]=function(_0x36a465,_0xb8d6b0){var _0x5c9d6a=[_0x1c67('0xf')];return new BPromise(function(_0x4e5df8,_0x4688f9){return exec(util['format'](_0x1c67('0x10'),_0x36a465[_0x1c67('0x11')][_0x1c67('0x12')]),function(_0x2d0097,_0x498c0c,_0x856bae){if(_0x2d0097){return _0x4688f9(_0x2d0097);}return _0x4e5df8(_0x498c0c);});})[_0x1c67('0xb')](function(_0x523d0e){var _0x129f52=![];var _0x2cf08e=_0x523d0e[_0x1c67('0x13')](/\n/);for(var _0x496ecd=0x0,_0x250bfd=_0x5c9d6a[_0x1c67('0x14')];_0x496ecd<_0x250bfd,_0x129f52===![];_0x496ecd+=0x1){if(_0x523d0e['indexOf'](_0x5c9d6a[_0x496ecd])>=0x0){_0x129f52=!![];}}if(!_0x129f52){throw new Error(util['format'](_0x1c67('0x15'),_0x36a465[_0x1c67('0x11')]['pid']));}process['kill'](_0x36a465['params'][_0x1c67('0x12')],_0x1c67('0x16'));return _0xb8d6b0[_0x1c67('0x17')](0xc8)['json']({'message':util[_0x1c67('0x18')](_0x1c67('0x19'),_0x36a465[_0x1c67('0x11')][_0x1c67('0x12')])});})[_0x1c67('0xd')](handleError(_0xb8d6b0,null,_0x1c67('0xe')));}; \ No newline at end of file +var _0xf6e0=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','util','lodash','error','inspect','name','status','index','getAllData','json','killProcess','format'];(function(_0x851dc3,_0x1d1b90){var _0x2f4478=function(_0x3119eb){while(--_0x3119eb){_0x851dc3['push'](_0x851dc3['shift']());}};_0x2f4478(++_0x1d1b90);}(_0xf6e0,0x73));var _0x0f6e=function(_0x1dc5bf,_0x53d200){_0x1dc5bf=_0x1dc5bf-0x0;var _0x39965d=_0xf6e0[_0x1dc5bf];return _0x39965d;};'use strict';var info=require(_0x0f6e('0x0'));var exec=require(_0x0f6e('0x1'))[_0x0f6e('0x2')];var logger=require(_0x0f6e('0x3'))('api');var util=require(_0x0f6e('0x4'));var BPromise=require('bluebird');var _=require(_0x0f6e('0x5'));function handleError(_0x1cf6e5,_0x44fc39,_0x2f8992){_0x44fc39=_0x44fc39||0x1f4;return function(_0x19126c){logger[_0x0f6e('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2f8992,_0x44fc39,util[_0x0f6e('0x7')](_0x19126c,{'showHidden':![],'depth':null}));delete _0x19126c[_0x0f6e('0x8')];_0x1cf6e5[_0x0f6e('0x9')](_0x44fc39)['send'](_0x19126c);};}exports[_0x0f6e('0xa')]=function(_0x563ecc,_0x428ec0){return info[_0x0f6e('0xb')]()['then'](function(_0xe4fead){return _0x428ec0[_0x0f6e('0x9')](0xc8)['json'](_0xe4fead);})['catch'](function(_0xe0e32d){return _0x428ec0[_0x0f6e('0x9')](0x1f4)[_0x0f6e('0xc')](_0xe0e32d);});};exports[_0x0f6e('0xd')]=function(_0x25f83e,_0x2002ae){var _0xa81674=['components/import/cm'];return new BPromise(function(_0x5f5c9c,_0x1d0da6){return exec(util[_0x0f6e('0xe')](_0x0f6e('0xf'),_0x25f83e[_0x0f6e('0x10')][_0x0f6e('0x11')]),function(_0x2a387b,_0x48e93d,_0x385888){if(_0x2a387b){return _0x1d0da6(_0x2a387b);}return _0x5f5c9c(_0x48e93d);});})[_0x0f6e('0x12')](function(_0x44f5a5){var _0x4778e6=![];var _0x261ba0=_0x44f5a5[_0x0f6e('0x13')](/\n/);for(var _0x37a4ae=0x0,_0x3ad0ba=_0xa81674[_0x0f6e('0x14')];_0x37a4ae<_0x3ad0ba,_0x4778e6===![];_0x37a4ae+=0x1){if(_0x44f5a5[_0x0f6e('0x15')](_0xa81674[_0x37a4ae])>=0x0){_0x4778e6=!![];}}if(!_0x4778e6){throw new Error(util[_0x0f6e('0xe')](_0x0f6e('0x16'),_0x25f83e[_0x0f6e('0x10')][_0x0f6e('0x11')]));}process['kill'](_0x25f83e['params'][_0x0f6e('0x11')],_0x0f6e('0x17'));return _0x2002ae[_0x0f6e('0x9')](0xc8)['json']({'message':util['format'](_0x0f6e('0x18'),_0x25f83e[_0x0f6e('0x10')][_0x0f6e('0x11')])});})[_0x0f6e('0x19')](handleError(_0x2002ae,null,_0x0f6e('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 32eaebf..3f9d5e0 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 _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x4c7ced,_0x44efa5){var _0x18cd1e=function(_0x5ef51d){while(--_0x5ef51d){_0x4c7ced['push'](_0x4c7ced['shift']());}};_0x18cd1e(++_0x44efa5);}(_0x4522,0x1a0));var _0x2452=function(_0x467944,_0x5885e8){_0x467944=_0x467944-0x0;var _0x138583=_0x4522[_0x467944];return _0x138583;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2452('0xf')]);router['put']('/:id',auth[_0x2452('0x9')](),controller[_0x2452('0x10')]);router[_0x2452('0x11')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x12')]);module[_0x2452('0x13')]=router; \ No newline at end of file +var _0x4b84=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0x4b84,0x1cc));var _0x44b8=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x4b84[_0x411e71];return _0x226ae3;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./tag.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xe'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xf')]);router[_0x44b8('0x10')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0x11')]);module[_0x44b8('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 ad267f9..831cc28 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 _0x19e1=['exports','STRING','name','sequelize'];(function(_0x47da2b,_0x2f0d65){var _0x147a1d=function(_0x2b1c0e){while(--_0x2b1c0e){_0x47da2b['push'](_0x47da2b['shift']());}};_0x147a1d(++_0x2f0d65);}(_0x19e1,0x163));var _0x119e=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x19e1[_0x4d1ee9];return _0x9a5456;};'use strict';var Sequelize=require(_0x119e('0x0'));module[_0x119e('0x1')]={'name':{'type':Sequelize[_0x119e('0x2')],'unique':_0x119e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x119e('0x2')]}}; \ No newline at end of file +var _0xdb94=['exports','STRING','name','sequelize'];(function(_0x2c159f,_0x4d5aca){var _0x29d6a2=function(_0x50b7d9){while(--_0x50b7d9){_0x2c159f['push'](_0x2c159f['shift']());}};_0x29d6a2(++_0x4d5aca);}(_0xdb94,0xab));var _0x4db9=function(_0x20055f,_0x1e72d0){_0x20055f=_0x20055f-0x0;var _0x405f96=_0xdb94[_0x20055f];return _0x405f96;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'name':{'type':Sequelize[_0x4db9('0x2')],'unique':_0x4db9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4db9('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3019af3..b264a50 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 _0xf796=['include','findAll','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','set','apply','reject','update','then','Tags','UserProfileResource','destroy','status','error','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','model','fields','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','Tag','includeAll'];(function(_0x720604,_0x1ed241){var _0x51126d=function(_0x3aedde){while(--_0x3aedde){_0x720604['push'](_0x720604['shift']());}};_0x51126d(++_0x1ed241);}(_0xf796,0x19b));var _0x6f79=function(_0x201ed6,_0x3ccc92){_0x201ed6=_0x201ed6-0x0;var _0x47ae39=_0xf796[_0x201ed6];return _0x47ae39;};'use strict';var emlformat=require(_0x6f79('0x0'));var rimraf=require(_0x6f79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f79('0x2'));var rp=require(_0x6f79('0x3'));var moment=require(_0x6f79('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6f79('0x5'));var util=require('util');var path=require(_0x6f79('0x6'));var sox=require(_0x6f79('0x7'));var csv=require(_0x6f79('0x8'));var ejs=require(_0x6f79('0x9'));var fs=require('fs');var fs_extra=require(_0x6f79('0xa'));var _=require(_0x6f79('0xb'));var squel=require(_0x6f79('0xc'));var crypto=require(_0x6f79('0xd'));var jsforce=require(_0x6f79('0xe'));var deskjs=require(_0x6f79('0xf'));var toCsv=require(_0x6f79('0x8'));var querystring=require(_0x6f79('0x10'));var Papa=require(_0x6f79('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f79('0x12'));var hardwareService=require(_0x6f79('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6f79('0x14'));var config=require(_0x6f79('0x15'));var licenseUtil=require(_0x6f79('0x16'));var db=require(_0x6f79('0x17'))['db'];function respondWithStatusCode(_0x8fd241,_0x2a2ddc){_0x2a2ddc=_0x2a2ddc||0xcc;return function(_0x196422){if(_0x196422){return _0x8fd241[_0x6f79('0x18')](_0x2a2ddc);}return _0x8fd241['status'](_0x2a2ddc)[_0x6f79('0x19')]();};}function respondWithResult(_0x33a442,_0xf69c99){_0xf69c99=_0xf69c99||0xc8;return function(_0x45929a){if(_0x45929a){return _0x33a442['status'](_0xf69c99)[_0x6f79('0x1a')](_0x45929a);}};}function respondWithFilteredResult(_0x5c43d0,_0x47b91d){return function(_0x185cce){if(_0x185cce){var _0x4b1dbe=typeof _0x47b91d[_0x6f79('0x1b')]==='undefined'&&typeof _0x47b91d[_0x6f79('0x1c')]==='undefined';var _0x450235=_0x185cce[_0x6f79('0x1d')];var _0x24a3a9=_0x4b1dbe?0x0:_0x47b91d[_0x6f79('0x1b')];var _0x5e71ac=_0x4b1dbe?_0x185cce[_0x6f79('0x1d')]:_0x47b91d['offset']+_0x47b91d[_0x6f79('0x1c')];var _0x16d0ec;if(_0x5e71ac>=_0x450235){_0x5e71ac=_0x450235;_0x16d0ec=0xc8;}else{_0x16d0ec=0xce;}_0x5c43d0['status'](_0x16d0ec);return _0x5c43d0[_0x6f79('0x1e')]('Content-Range',_0x24a3a9+'-'+_0x5e71ac+'/'+_0x450235)[_0x6f79('0x1a')](_0x185cce);}return null;};}function patchUpdates(_0x432ad6){return function(_0xf42e5d){try{jsonpatch[_0x6f79('0x1f')](_0xf42e5d,_0x432ad6,!![]);}catch(_0x173a60){return BPromise[_0x6f79('0x20')](_0x173a60);}return _0xf42e5d['save']();};}function saveUpdates(_0x390984,_0x126814){return function(_0x3254e1){if(_0x3254e1){return _0x3254e1[_0x6f79('0x21')](_0x390984)[_0x6f79('0x22')](function(_0x374451){return _0x374451;});}return null;};}function removeEntity(_0x46ff8d,_0x1cb5b2){return function(_0x337929){if(_0x337929){return _0x337929['destroy']()[_0x6f79('0x22')](function(){var _0x3fef02=_0x337929['get']({'plain':!![]});var _0x5057b9=_0x6f79('0x23');return db[_0x6f79('0x24')][_0x6f79('0x25')]({'where':{'type':_0x5057b9,'resourceId':_0x3fef02['id']}})[_0x6f79('0x22')](function(){return _0x337929;});})[_0x6f79('0x22')](function(){_0x46ff8d[_0x6f79('0x26')](0xcc)[_0x6f79('0x19')]();});}};}function handleEntityNotFound(_0x5ec061,_0x1242f2){return function(_0x12b863){if(!_0x12b863){_0x5ec061['sendStatus'](0x194);}return _0x12b863;};}function handleError(_0x25b394,_0x17695a){_0x17695a=_0x17695a||0x1f4;return function(_0x106590){logger[_0x6f79('0x27')](_0x106590['stack']);if(_0x106590[_0x6f79('0x28')]){delete _0x106590[_0x6f79('0x28')];}_0x25b394[_0x6f79('0x26')](_0x17695a)[_0x6f79('0x29')](_0x106590);};}exports[_0x6f79('0x2a')]=function(_0x1b1408,_0x49beec){var _0x4d8941={},_0x63aedc={},_0x214d92={'count':0x0,'rows':[]};var _0x5b9e3a=_['map'](db['Tag'][_0x6f79('0x2b')],function(_0xf0c735){return{'name':_0xf0c735['fieldName'],'type':_0xf0c735[_0x6f79('0x2c')][_0x6f79('0x2d')]};});_0x63aedc['model']=_[_0x6f79('0x2e')](_0x5b9e3a,_0x6f79('0x28'));_0x63aedc[_0x6f79('0x2f')]=_[_0x6f79('0x30')](_0x1b1408[_0x6f79('0x2f')]);_0x63aedc['filters']=_[_0x6f79('0x31')](_0x63aedc['model'],_0x63aedc['query']);_0x4d8941[_0x6f79('0x32')]=_[_0x6f79('0x31')](_0x63aedc[_0x6f79('0x33')],qs[_0x6f79('0x34')](_0x1b1408[_0x6f79('0x2f')]['fields']));_0x4d8941[_0x6f79('0x32')]=_0x4d8941[_0x6f79('0x32')]['length']?_0x4d8941[_0x6f79('0x32')]:_0x63aedc[_0x6f79('0x33')];if(!_0x1b1408['query']['hasOwnProperty'](_0x6f79('0x35'))){_0x4d8941['limit']=qs[_0x6f79('0x1c')](_0x1b1408['query'][_0x6f79('0x1c')]);_0x4d8941['offset']=qs[_0x6f79('0x1b')](_0x1b1408['query'][_0x6f79('0x1b')]);}_0x4d8941['order']=qs[_0x6f79('0x36')](_0x1b1408['query']['sort']);_0x4d8941['where']=qs[_0x6f79('0x37')](_['pick'](_0x1b1408[_0x6f79('0x2f')],_0x63aedc[_0x6f79('0x37')]),_0x5b9e3a);if(_0x1b1408[_0x6f79('0x2f')][_0x6f79('0x38')]){_0x4d8941[_0x6f79('0x39')]=_['merge'](_0x4d8941['where'],{'$or':_[_0x6f79('0x2e')](_0x5b9e3a,function(_0x167c42){if(_0x167c42[_0x6f79('0x2c')]!==_0x6f79('0x3a')){var _0x2d3c21={};_0x2d3c21[_0x167c42[_0x6f79('0x28')]]={'$like':'%'+_0x1b1408[_0x6f79('0x2f')][_0x6f79('0x38')]+'%'};return _0x2d3c21;}})});}_0x4d8941=_[_0x6f79('0x3b')]({},_0x4d8941,_0x1b1408[_0x6f79('0x3c')]);var _0x3b74b8={'where':_0x4d8941[_0x6f79('0x39')]};return db[_0x6f79('0x3d')]['count'](_0x3b74b8)[_0x6f79('0x22')](function(_0x15ae5e){_0x214d92[_0x6f79('0x1d')]=_0x15ae5e;if(_0x1b1408[_0x6f79('0x2f')][_0x6f79('0x3e')]){_0x4d8941[_0x6f79('0x3f')]=[{'all':!![]}];}return db[_0x6f79('0x3d')][_0x6f79('0x40')](_0x4d8941);})[_0x6f79('0x22')](function(_0x5d09d3){_0x214d92['rows']=_0x5d09d3;return _0x214d92;})[_0x6f79('0x22')](respondWithFilteredResult(_0x49beec,_0x4d8941))[_0x6f79('0x41')](handleError(_0x49beec,null));};exports[_0x6f79('0x42')]=function(_0x480258,_0x245895){var _0x244468={'raw':!![],'where':{'id':_0x480258[_0x6f79('0x43')]['id']}},_0xc0026f={};_0xc0026f[_0x6f79('0x33')]=_[_0x6f79('0x30')](db[_0x6f79('0x3d')]['rawAttributes']);_0xc0026f['query']=_['keys'](_0x480258[_0x6f79('0x2f')]);_0xc0026f[_0x6f79('0x37')]=_[_0x6f79('0x31')](_0xc0026f['model'],_0xc0026f[_0x6f79('0x2f')]);_0x244468[_0x6f79('0x32')]=_[_0x6f79('0x31')](_0xc0026f[_0x6f79('0x33')],qs[_0x6f79('0x34')](_0x480258[_0x6f79('0x2f')][_0x6f79('0x34')]));_0x244468[_0x6f79('0x32')]=_0x244468[_0x6f79('0x32')][_0x6f79('0x44')]?_0x244468[_0x6f79('0x32')]:_0xc0026f[_0x6f79('0x33')];if(_0x480258[_0x6f79('0x2f')][_0x6f79('0x3e')]){_0x244468[_0x6f79('0x3f')]=[{'all':!![]}];}_0x244468=_[_0x6f79('0x3b')]({},_0x244468,_0x480258[_0x6f79('0x3c')]);return db[_0x6f79('0x3d')][_0x6f79('0x45')](_0x244468)[_0x6f79('0x22')](handleEntityNotFound(_0x245895,null))[_0x6f79('0x22')](respondWithResult(_0x245895,null))[_0x6f79('0x41')](handleError(_0x245895,null));};exports[_0x6f79('0x46')]=function(_0x44111b,_0x4a50b0){return db[_0x6f79('0x3d')][_0x6f79('0x46')](_0x44111b[_0x6f79('0x47')],{})[_0x6f79('0x22')](function(_0x3afdaa){var _0x37bbbf=_0x44111b[_0x6f79('0x48')][_0x6f79('0x49')]({'plain':!![]});if(!_0x37bbbf)throw new Error(_0x6f79('0x4a'));if(_0x37bbbf['role']===_0x6f79('0x48')){var _0x7ae7bc=_0x3afdaa['get']({'plain':!![]});var _0x49983e=_0x6f79('0x23');return db[_0x6f79('0x4b')][_0x6f79('0x45')]({'where':{'name':_0x49983e,'userProfileId':_0x37bbbf[_0x6f79('0x4c')]},'raw':!![]})[_0x6f79('0x22')](function(_0x139477){if(_0x139477&&_0x139477['autoAssociation']===0x0){return db['UserProfileResource'][_0x6f79('0x46')]({'name':_0x7ae7bc[_0x6f79('0x28')],'resourceId':_0x7ae7bc['id'],'type':_0x139477['name'],'sectionId':_0x139477['id']},{})[_0x6f79('0x22')](function(){return _0x3afdaa;});}else{return _0x3afdaa;}})['catch'](function(_0x2d448f){logger[_0x6f79('0x27')](_0x6f79('0x4d'),_0x2d448f);throw _0x2d448f;});}return _0x3afdaa;})[_0x6f79('0x22')](respondWithResult(_0x4a50b0,0xc9))['catch'](handleError(_0x4a50b0,null));};exports[_0x6f79('0x21')]=function(_0x2cf938,_0x3446b9){if(_0x2cf938[_0x6f79('0x47')]['id']){delete _0x2cf938[_0x6f79('0x47')]['id'];}return db[_0x6f79('0x3d')]['find']({'where':{'id':_0x2cf938[_0x6f79('0x43')]['id']}})[_0x6f79('0x22')](handleEntityNotFound(_0x3446b9,null))[_0x6f79('0x22')](saveUpdates(_0x2cf938[_0x6f79('0x47')],null))['then'](respondWithResult(_0x3446b9,null))[_0x6f79('0x41')](handleError(_0x3446b9,null));};exports[_0x6f79('0x25')]=function(_0x36687e,_0x4cdce8){return db[_0x6f79('0x3d')][_0x6f79('0x45')]({'where':{'id':_0x36687e['params']['id']}})[_0x6f79('0x22')](handleEntityNotFound(_0x4cdce8,null))[_0x6f79('0x22')](removeEntity(_0x4cdce8,null))[_0x6f79('0x41')](handleError(_0x4cdce8,null));};exports[_0x6f79('0x4e')]=function(_0x17b7c6,_0x15a789){return db[_0x6f79('0x3d')][_0x6f79('0x4e')]()[_0x6f79('0x22')](respondWithResult(_0x15a789,null))['catch'](handleError(_0x15a789,null));}; \ No newline at end of file +var _0x858e=['send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','name','merge','options','Tag','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','Tags','sendStatus','stack'];(function(_0x2c1bcf,_0x5beb3b){var _0x495573=function(_0x2df5cf){while(--_0x2df5cf){_0x2c1bcf['push'](_0x2c1bcf['shift']());}};_0x495573(++_0x5beb3b);}(_0x858e,0x16e));var _0xe858=function(_0x416468,_0x2e7a72){_0x416468=_0x416468-0x0;var _0x2ee9b7=_0x858e[_0x416468];return _0x2ee9b7;};'use strict';var emlformat=require(_0xe858('0x0'));var rimraf=require(_0xe858('0x1'));var zipdir=require(_0xe858('0x2'));var jsonpatch=require(_0xe858('0x3'));var rp=require('request-promise');var moment=require(_0xe858('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe858('0x5'));var util=require('util');var path=require(_0xe858('0x6'));var sox=require(_0xe858('0x7'));var csv=require(_0xe858('0x8'));var ejs=require(_0xe858('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe858('0xa'));var squel=require(_0xe858('0xb'));var crypto=require(_0xe858('0xc'));var jsforce=require(_0xe858('0xd'));var deskjs=require(_0xe858('0xe'));var toCsv=require(_0xe858('0x8'));var querystring=require('querystring');var Papa=require(_0xe858('0xf'));var Redis=require(_0xe858('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe858('0x11'));var as=require(_0xe858('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe858('0x13'))(_0xe858('0x14'));var utils=require(_0xe858('0x15'));var config=require(_0xe858('0x16'));var licenseUtil=require(_0xe858('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b7531,_0x2eb136){_0x2eb136=_0x2eb136||0xcc;return function(_0x25dee7){if(_0x25dee7){return _0x2b7531['sendStatus'](_0x2eb136);}return _0x2b7531[_0xe858('0x18')](_0x2eb136)[_0xe858('0x19')]();};}function respondWithResult(_0x4da465,_0x3c63a2){_0x3c63a2=_0x3c63a2||0xc8;return function(_0x5c8e8c){if(_0x5c8e8c){return _0x4da465['status'](_0x3c63a2)[_0xe858('0x1a')](_0x5c8e8c);}};}function respondWithFilteredResult(_0x1830d7,_0x577290){return function(_0x52fc4a){if(_0x52fc4a){var _0x3b7d87=typeof _0x577290[_0xe858('0x1b')]===_0xe858('0x1c')&&typeof _0x577290[_0xe858('0x1d')]===_0xe858('0x1c');var _0x5ca244=_0x52fc4a[_0xe858('0x1e')];var _0x1b5c04=_0x3b7d87?0x0:_0x577290[_0xe858('0x1b')];var _0x523c8b=_0x3b7d87?_0x52fc4a[_0xe858('0x1e')]:_0x577290[_0xe858('0x1b')]+_0x577290[_0xe858('0x1d')];var _0xf74a46;if(_0x523c8b>=_0x5ca244){_0x523c8b=_0x5ca244;_0xf74a46=0xc8;}else{_0xf74a46=0xce;}_0x1830d7['status'](_0xf74a46);return _0x1830d7['set'](_0xe858('0x1f'),_0x1b5c04+'-'+_0x523c8b+'/'+_0x5ca244)[_0xe858('0x1a')](_0x52fc4a);}return null;};}function patchUpdates(_0x6e8ca9){return function(_0x4f3a9a){try{jsonpatch[_0xe858('0x20')](_0x4f3a9a,_0x6e8ca9,!![]);}catch(_0x17fcd){return BPromise['reject'](_0x17fcd);}return _0x4f3a9a['save']();};}function saveUpdates(_0xe8fdf2,_0x5c69ab){return function(_0x119fb0){if(_0x119fb0){return _0x119fb0[_0xe858('0x21')](_0xe8fdf2)[_0xe858('0x22')](function(_0x12004a){return _0x12004a;});}return null;};}function removeEntity(_0x5384e5,_0x3eba87){return function(_0x2c88f2){if(_0x2c88f2){return _0x2c88f2[_0xe858('0x23')]()[_0xe858('0x22')](function(){var _0xc4b22d=_0x2c88f2['get']({'plain':!![]});var _0x31f13b=_0xe858('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x31f13b,'resourceId':_0xc4b22d['id']}})[_0xe858('0x22')](function(){return _0x2c88f2;});})[_0xe858('0x22')](function(){_0x5384e5[_0xe858('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f166e,_0x1ab118){return function(_0x3a6acb){if(!_0x3a6acb){_0x4f166e[_0xe858('0x25')](0x194);}return _0x3a6acb;};}function handleError(_0x11a254,_0x5aa02a){_0x5aa02a=_0x5aa02a||0x1f4;return function(_0x10c582){logger['error'](_0x10c582[_0xe858('0x26')]);if(_0x10c582['name']){delete _0x10c582['name'];}_0x11a254[_0xe858('0x18')](_0x5aa02a)[_0xe858('0x27')](_0x10c582);};}exports['index']=function(_0x2f90ea,_0x219837){var _0x173cdd={},_0x1edf08={},_0x2a81f8={'count':0x0,'rows':[]};var _0x9cb732=_[_0xe858('0x28')](db['Tag'][_0xe858('0x29')],function(_0x38e0ba){return{'name':_0x38e0ba[_0xe858('0x2a')],'type':_0x38e0ba[_0xe858('0x2b')]['key']};});_0x1edf08['model']=_[_0xe858('0x28')](_0x9cb732,'name');_0x1edf08[_0xe858('0x2c')]=_[_0xe858('0x2d')](_0x2f90ea['query']);_0x1edf08[_0xe858('0x2e')]=_['intersection'](_0x1edf08[_0xe858('0x2f')],_0x1edf08[_0xe858('0x2c')]);_0x173cdd[_0xe858('0x30')]=_[_0xe858('0x31')](_0x1edf08[_0xe858('0x2f')],qs[_0xe858('0x32')](_0x2f90ea['query'][_0xe858('0x32')]));_0x173cdd[_0xe858('0x30')]=_0x173cdd['attributes'][_0xe858('0x33')]?_0x173cdd['attributes']:_0x1edf08[_0xe858('0x2f')];if(!_0x2f90ea[_0xe858('0x2c')][_0xe858('0x34')](_0xe858('0x35'))){_0x173cdd[_0xe858('0x1d')]=qs['limit'](_0x2f90ea['query'][_0xe858('0x1d')]);_0x173cdd[_0xe858('0x1b')]=qs['offset'](_0x2f90ea['query']['offset']);}_0x173cdd[_0xe858('0x36')]=qs[_0xe858('0x37')](_0x2f90ea[_0xe858('0x2c')]['sort']);_0x173cdd[_0xe858('0x38')]=qs['filters'](_['pick'](_0x2f90ea[_0xe858('0x2c')],_0x1edf08['filters']),_0x9cb732);if(_0x2f90ea[_0xe858('0x2c')][_0xe858('0x39')]){_0x173cdd[_0xe858('0x38')]=_['merge'](_0x173cdd['where'],{'$or':_[_0xe858('0x28')](_0x9cb732,function(_0x2b7138){if(_0x2b7138[_0xe858('0x2b')]!==_0xe858('0x3a')){var _0x33ab67={};_0x33ab67[_0x2b7138[_0xe858('0x3b')]]={'$like':'%'+_0x2f90ea[_0xe858('0x2c')][_0xe858('0x39')]+'%'};return _0x33ab67;}})});}_0x173cdd=_[_0xe858('0x3c')]({},_0x173cdd,_0x2f90ea[_0xe858('0x3d')]);var _0x1ddc8a={'where':_0x173cdd[_0xe858('0x38')]};return db[_0xe858('0x3e')][_0xe858('0x1e')](_0x1ddc8a)['then'](function(_0x487bb9){_0x2a81f8[_0xe858('0x1e')]=_0x487bb9;if(_0x2f90ea[_0xe858('0x2c')][_0xe858('0x3f')]){_0x173cdd[_0xe858('0x40')]=[{'all':!![]}];}return db[_0xe858('0x3e')][_0xe858('0x41')](_0x173cdd);})[_0xe858('0x22')](function(_0x204b69){_0x2a81f8[_0xe858('0x42')]=_0x204b69;return _0x2a81f8;})['then'](respondWithFilteredResult(_0x219837,_0x173cdd))[_0xe858('0x43')](handleError(_0x219837,null));};exports[_0xe858('0x44')]=function(_0x2cc184,_0xc07fb){var _0x5471aa={'raw':!![],'where':{'id':_0x2cc184['params']['id']}},_0xb35b44={};_0xb35b44[_0xe858('0x2f')]=_['keys'](db[_0xe858('0x3e')]['rawAttributes']);_0xb35b44['query']=_[_0xe858('0x2d')](_0x2cc184[_0xe858('0x2c')]);_0xb35b44['filters']=_[_0xe858('0x31')](_0xb35b44[_0xe858('0x2f')],_0xb35b44[_0xe858('0x2c')]);_0x5471aa[_0xe858('0x30')]=_['intersection'](_0xb35b44[_0xe858('0x2f')],qs[_0xe858('0x32')](_0x2cc184[_0xe858('0x2c')]['fields']));_0x5471aa[_0xe858('0x30')]=_0x5471aa[_0xe858('0x30')][_0xe858('0x33')]?_0x5471aa[_0xe858('0x30')]:_0xb35b44[_0xe858('0x2f')];if(_0x2cc184['query'][_0xe858('0x3f')]){_0x5471aa[_0xe858('0x40')]=[{'all':!![]}];}_0x5471aa=_[_0xe858('0x3c')]({},_0x5471aa,_0x2cc184[_0xe858('0x3d')]);return db['Tag'][_0xe858('0x45')](_0x5471aa)[_0xe858('0x22')](handleEntityNotFound(_0xc07fb,null))[_0xe858('0x22')](respondWithResult(_0xc07fb,null))[_0xe858('0x43')](handleError(_0xc07fb,null));};exports[_0xe858('0x46')]=function(_0x2b69a9,_0x2c3496){return db[_0xe858('0x3e')][_0xe858('0x46')](_0x2b69a9[_0xe858('0x47')],{})[_0xe858('0x22')](function(_0x274336){var _0x2460ce=_0x2b69a9[_0xe858('0x48')][_0xe858('0x49')]({'plain':!![]});if(!_0x2460ce)throw new Error(_0xe858('0x4a'));if(_0x2460ce[_0xe858('0x4b')]===_0xe858('0x48')){var _0x40a6f6=_0x274336[_0xe858('0x49')]({'plain':!![]});var _0x27203f='Tags';return db[_0xe858('0x4c')][_0xe858('0x45')]({'where':{'name':_0x27203f,'userProfileId':_0x2460ce['userProfileId']},'raw':!![]})[_0xe858('0x22')](function(_0x4c34da){if(_0x4c34da&&_0x4c34da[_0xe858('0x4d')]===0x0){return db[_0xe858('0x4e')]['create']({'name':_0x40a6f6[_0xe858('0x3b')],'resourceId':_0x40a6f6['id'],'type':_0x4c34da['name'],'sectionId':_0x4c34da['id']},{})['then'](function(){return _0x274336;});}else{return _0x274336;}})[_0xe858('0x43')](function(_0x2849e3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2849e3);throw _0x2849e3;});}return _0x274336;})[_0xe858('0x22')](respondWithResult(_0x2c3496,0xc9))['catch'](handleError(_0x2c3496,null));};exports[_0xe858('0x21')]=function(_0x570f46,_0x12a2c1){if(_0x570f46[_0xe858('0x47')]['id']){delete _0x570f46[_0xe858('0x47')]['id'];}return db[_0xe858('0x3e')][_0xe858('0x45')]({'where':{'id':_0x570f46[_0xe858('0x4f')]['id']}})[_0xe858('0x22')](handleEntityNotFound(_0x12a2c1,null))[_0xe858('0x22')](saveUpdates(_0x570f46[_0xe858('0x47')],null))[_0xe858('0x22')](respondWithResult(_0x12a2c1,null))[_0xe858('0x43')](handleError(_0x12a2c1,null));};exports[_0xe858('0x23')]=function(_0x3ce2ca,_0xd23899){return db[_0xe858('0x3e')][_0xe858('0x45')]({'where':{'id':_0x3ce2ca['params']['id']}})[_0xe858('0x22')](handleEntityNotFound(_0xd23899,null))['then'](removeEntity(_0xd23899,null))[_0xe858('0x43')](handleError(_0xd23899,null));};exports[_0xe858('0x50')]=function(_0x492dee,_0x44620b){return db['Tag'][_0xe858('0x50')]()[_0xe858('0x22')](respondWithResult(_0x44620b,null))[_0xe858('0x43')](handleError(_0x44620b,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index babfb65..638c499 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 _0x74cc=['define','Tag','tools_tags','lodash','util','moment','bluebird','path','../../config/environment','exports'];(function(_0x3a0cf5,_0xdd5f36){var _0x37ce5a=function(_0x3904b){while(--_0x3904b){_0x3a0cf5['push'](_0x3a0cf5['shift']());}};_0x37ce5a(++_0xdd5f36);}(_0x74cc,0x19d));var _0xc74c=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x74cc[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xc74c('0x0'));var util=require(_0xc74c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc74c('0x2'));var BPromise=require(_0xc74c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc74c('0x4'));var rimraf=require('rimraf');var config=require(_0xc74c('0x5'));var attributes=require('./tag.attributes');module[_0xc74c('0x6')]=function(_0x5eac2c,_0x4b9efb){return _0x5eac2c[_0xc74c('0x7')](_0xc74c('0x8'),attributes,{'tableName':_0xc74c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x605e=['define','Tag','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x3dad57,_0x1dd8b3){var _0x47a6b5=function(_0x6e545d){while(--_0x6e545d){_0x3dad57['push'](_0x3dad57['shift']());}};_0x47a6b5(++_0x1dd8b3);}(_0x605e,0xab));var _0xe605=function(_0x173c05,_0x3fe3f5){_0x173c05=_0x173c05-0x0;var _0x19f281=_0x605e[_0x173c05];return _0x19f281;};'use strict';var _=require(_0xe605('0x0'));var util=require(_0xe605('0x1'));var logger=require(_0xe605('0x2'))(_0xe605('0x3'));var moment=require(_0xe605('0x4'));var BPromise=require(_0xe605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe605('0x6'));var rimraf=require(_0xe605('0x7'));var config=require(_0xe605('0x8'));var attributes=require(_0xe605('0x9'));module[_0xe605('0xa')]=function(_0x5a36ec,_0x3e6285){return _0x5a36ec[_0xe605('0xb')](_0xe605('0xc'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 62e42ed..53d6f04 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1d59e2,_0x567c01){var _0x4352be=function(_0x164dd4){while(--_0x164dd4){_0x1d59e2['push'](_0x1d59e2['shift']());}};_0x4352be(++_0x567c01);}(_0x84ab,0x12f));var _0xb84a=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x84ab[_0x4fbb86];return _0xb141fe;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('Tag,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0xd6d6=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x38adae,_0x51b026){var _0x3a989d=function(_0x3a04ce){while(--_0x3a04ce){_0x38adae['push'](_0x38adae['shift']());}};_0x3a989d(++_0x51b026);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4c470c,_0x40bbfd){_0x4c470c=_0x4c470c-0x0;var _0x2f5180=_0xd6d6[_0x4c470c];return _0x2f5180;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('Tag,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ee2ffd2..a9f24e8 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 ad19024..cae97e1 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 _0x0713=['STRING','name'];(function(_0x481015,_0x5b3e2e){var _0x24a6c5=function(_0x18071c){while(--_0x18071c){_0x481015['push'](_0x481015['shift']());}};_0x24a6c5(++_0x5b3e2e);}(_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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x1fd002,_0x482d34){var _0xf8388f=function(_0x52ba07){while(--_0x52ba07){_0x1fd002['push'](_0x1fd002['shift']());}};_0xf8388f(++_0x482d34);}(_0xb10b,0x12a));var _0xbb10=function(_0x19c64a,_0x5de14e){_0x19c64a=_0x19c64a-0x0;var _0x1b1a06=_0xb10b[_0x19c64a];return _0x1b1a06;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9a87fc3..85570d4 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 _0x2a90=['count','set','Content-Range','json','apply','reject','save','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','where','pick','filters','filter','merge','options','includeAll','include','findAll','then','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','ValidationError','capitalize','Queue','rawAttributes','order','sort','toLowerCase','Queues','addQueues','isValidChannel','Unknown\x20channel','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','VoicePrefixId','spread','Sms','removeAgents','Queue:remove','hasOwnProperty','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','limit','undefined'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x2a90,0x1c8));var _0x02a9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2a90[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x02a9('0x0'));var rimraf=require(_0x02a9('0x1'));var zipdir=require(_0x02a9('0x2'));var jsonpatch=require(_0x02a9('0x3'));var rp=require(_0x02a9('0x4'));var moment=require(_0x02a9('0x5'));var BPromise=require(_0x02a9('0x6'));var Mustache=require(_0x02a9('0x7'));var util=require(_0x02a9('0x8'));var path=require(_0x02a9('0x9'));var sox=require(_0x02a9('0xa'));var csv=require(_0x02a9('0xb'));var ejs=require(_0x02a9('0xc'));var fs=require('fs');var fs_extra=require(_0x02a9('0xd'));var _=require(_0x02a9('0xe'));var squel=require(_0x02a9('0xf'));var crypto=require(_0x02a9('0x10'));var jsforce=require(_0x02a9('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x02a9('0xb'));var querystring=require(_0x02a9('0x12'));var Papa=require(_0x02a9('0x13'));var Redis=require(_0x02a9('0x14'));var authService=require(_0x02a9('0x15'));var qs=require(_0x02a9('0x16'));var as=require(_0x02a9('0x17'));var hardwareService=require(_0x02a9('0x18'));var logger=require(_0x02a9('0x19'))(_0x02a9('0x1a'));var utils=require(_0x02a9('0x1b'));var config=require(_0x02a9('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x02a9('0x1d'))['db'];config[_0x02a9('0x1e')]=_[_0x02a9('0x1f')](config[_0x02a9('0x1e')],{'host':_0x02a9('0x20'),'port':0x18eb});var socket=require(_0x02a9('0x21'))(new Redis(config[_0x02a9('0x1e')]));require(_0x02a9('0x22'))[_0x02a9('0x23')](socket);function respondWithStatusCode(_0x58f803,_0x2aa672){_0x2aa672=_0x2aa672||0xcc;return function(_0x4bfbc7){if(_0x4bfbc7){return _0x58f803[_0x02a9('0x24')](_0x2aa672);}return _0x58f803[_0x02a9('0x25')](_0x2aa672)[_0x02a9('0x26')]();};}function respondWithResult(_0x1c0a10,_0x203f84){_0x203f84=_0x203f84||0xc8;return function(_0x4a9a87){if(_0x4a9a87){return _0x1c0a10[_0x02a9('0x25')](_0x203f84)['json'](_0x4a9a87);}};}function respondWithFilteredResult(_0x2d6b17,_0x49e2cc){return function(_0x14edbc){if(_0x14edbc){var _0x1422a4=typeof _0x49e2cc[_0x02a9('0x27')]==='undefined'&&typeof _0x49e2cc[_0x02a9('0x28')]===_0x02a9('0x29');var _0x200890=_0x14edbc['count'];var _0x2c264d=_0x1422a4?0x0:_0x49e2cc[_0x02a9('0x27')];var _0x28886d=_0x1422a4?_0x14edbc[_0x02a9('0x2a')]:_0x49e2cc[_0x02a9('0x27')]+_0x49e2cc[_0x02a9('0x28')];var _0x313a64;if(_0x28886d>=_0x200890){_0x28886d=_0x200890;_0x313a64=0xc8;}else{_0x313a64=0xce;}_0x2d6b17[_0x02a9('0x25')](_0x313a64);return _0x2d6b17[_0x02a9('0x2b')](_0x02a9('0x2c'),_0x2c264d+'-'+_0x28886d+'/'+_0x200890)[_0x02a9('0x2d')](_0x14edbc);}return null;};}function patchUpdates(_0x34b950){return function(_0x3b4b53){try{jsonpatch[_0x02a9('0x2e')](_0x3b4b53,_0x34b950,!![]);}catch(_0x173c27){return BPromise[_0x02a9('0x2f')](_0x173c27);}return _0x3b4b53[_0x02a9('0x30')]();};}function saveUpdates(_0x5331bf,_0x204a7e){return function(_0x31903c){if(_0x31903c){return _0x31903c['update'](_0x5331bf)['then'](function(_0x453d40){return _0x453d40;});}return null;};}function handleEntityNotFound(_0x362a71,_0x9bac94){return function(_0x2b7834){if(!_0x2b7834){_0x362a71[_0x02a9('0x24')](0x194);}return _0x2b7834;};}function handleError(_0x4de7eb,_0x2aca9d){_0x2aca9d=_0x2aca9d||0x1f4;return function(_0x3d1988){logger['error'](_0x3d1988[_0x02a9('0x31')]);if(_0x3d1988[_0x02a9('0x32')]){delete _0x3d1988[_0x02a9('0x32')];}_0x4de7eb[_0x02a9('0x25')](_0x2aca9d)[_0x02a9('0x33')](_0x3d1988);};}exports[_0x02a9('0x34')]=function(_0x4e6a7d,_0x5b3a06){var _0x4e8582={},_0x8a280a={},_0x338f30={'count':0x0,'rows':[]};var _0x2ee6b7=_[_0x02a9('0x35')](db[_0x02a9('0x36')]['rawAttributes'],function(_0x36e7bf){return{'name':_0x36e7bf[_0x02a9('0x37')],'type':_0x36e7bf[_0x02a9('0x38')][_0x02a9('0x39')]};});_0x8a280a[_0x02a9('0x3a')]=_[_0x02a9('0x35')](_0x2ee6b7,'name');_0x8a280a[_0x02a9('0x3b')]=_[_0x02a9('0x3c')](_0x4e6a7d['query']);_0x8a280a['filters']=_[_0x02a9('0x3d')](_0x8a280a[_0x02a9('0x3a')],_0x8a280a[_0x02a9('0x3b')]);_0x4e8582[_0x02a9('0x3e')]=_[_0x02a9('0x3d')](_0x8a280a[_0x02a9('0x3a')],qs[_0x02a9('0x3f')](_0x4e6a7d[_0x02a9('0x3b')][_0x02a9('0x3f')]));_0x4e8582[_0x02a9('0x3e')]=_0x4e8582[_0x02a9('0x3e')][_0x02a9('0x40')]?_0x4e8582[_0x02a9('0x3e')]:_0x8a280a['model'];if(!_0x4e6a7d[_0x02a9('0x3b')]['hasOwnProperty'](_0x02a9('0x41'))){_0x4e8582[_0x02a9('0x28')]=qs['limit'](_0x4e6a7d[_0x02a9('0x3b')][_0x02a9('0x28')]);_0x4e8582['offset']=qs['offset'](_0x4e6a7d[_0x02a9('0x3b')]['offset']);}_0x4e8582['order']=qs['sort'](_0x4e6a7d['query']['sort']);_0x4e8582[_0x02a9('0x42')]=qs['filters'](_[_0x02a9('0x43')](_0x4e6a7d[_0x02a9('0x3b')],_0x8a280a[_0x02a9('0x44')]),_0x2ee6b7);if(_0x4e6a7d[_0x02a9('0x3b')][_0x02a9('0x45')]){_0x4e8582[_0x02a9('0x42')]=_[_0x02a9('0x46')](_0x4e8582['where'],{'$or':_['map'](_0x2ee6b7,function(_0xa775c4){if(_0xa775c4[_0x02a9('0x38')]!=='VIRTUAL'){var _0x4a24cc={};_0x4a24cc[_0xa775c4[_0x02a9('0x32')]]={'$like':'%'+_0x4e6a7d[_0x02a9('0x3b')]['filter']+'%'};return _0x4a24cc;}})});}_0x4e8582=_[_0x02a9('0x46')]({},_0x4e8582,_0x4e6a7d[_0x02a9('0x47')]);var _0x888289={'where':_0x4e8582[_0x02a9('0x42')]};return db[_0x02a9('0x36')][_0x02a9('0x2a')](_0x888289)['then'](function(_0x312504){_0x338f30[_0x02a9('0x2a')]=_0x312504;if(_0x4e6a7d[_0x02a9('0x3b')][_0x02a9('0x48')]){_0x4e8582[_0x02a9('0x49')]=[{'all':!![]}];}return db[_0x02a9('0x36')][_0x02a9('0x4a')](_0x4e8582);})[_0x02a9('0x4b')](function(_0x196ffc){_0x338f30['rows']=_0x196ffc;return _0x338f30;})[_0x02a9('0x4b')](respondWithFilteredResult(_0x5b3a06,_0x4e8582))[_0x02a9('0x4c')](handleError(_0x5b3a06,null));};exports[_0x02a9('0x4d')]=function(_0x50fe98,_0x9445a){var _0x1c5212={'raw':![],'where':{'id':_0x50fe98[_0x02a9('0x4e')]['id']}},_0x5d6bb6={};_0x5d6bb6[_0x02a9('0x3a')]=_[_0x02a9('0x3c')](db[_0x02a9('0x36')]['rawAttributes']);_0x5d6bb6[_0x02a9('0x3b')]=_[_0x02a9('0x3c')](_0x50fe98[_0x02a9('0x3b')]);_0x5d6bb6[_0x02a9('0x44')]=_[_0x02a9('0x3d')](_0x5d6bb6['model'],_0x5d6bb6['query']);_0x1c5212[_0x02a9('0x3e')]=_['intersection'](_0x5d6bb6[_0x02a9('0x3a')],qs[_0x02a9('0x3f')](_0x50fe98[_0x02a9('0x3b')][_0x02a9('0x3f')]));_0x1c5212['attributes']=_0x1c5212[_0x02a9('0x3e')][_0x02a9('0x40')]?_0x1c5212[_0x02a9('0x3e')]:_0x5d6bb6['model'];if(_0x50fe98[_0x02a9('0x3b')][_0x02a9('0x48')]){_0x1c5212[_0x02a9('0x49')]=[{'all':!![]}];}_0x1c5212=_[_0x02a9('0x46')]({},_0x1c5212,_0x50fe98[_0x02a9('0x47')]);return db[_0x02a9('0x36')]['find'](_0x1c5212)[_0x02a9('0x4b')](handleEntityNotFound(_0x9445a,null))[_0x02a9('0x4b')](respondWithResult(_0x9445a,null))['catch'](handleError(_0x9445a,null));};exports[_0x02a9('0x4f')]=function(_0x19114c,_0x25e4ed){return db['Team']['create'](_0x19114c[_0x02a9('0x50')],{})[_0x02a9('0x4b')](function(_0x150dd7){var _0x27a116=_0x19114c[_0x02a9('0x51')][_0x02a9('0x52')]({'plain':!![]});if(!_0x27a116)throw new Error(_0x02a9('0x53'));if(_0x27a116[_0x02a9('0x54')]===_0x02a9('0x51')){var _0x5f3e1c=_0x150dd7[_0x02a9('0x52')]({'plain':!![]});var _0x34bdd6=_0x02a9('0x55');return db['UserProfileSection'][_0x02a9('0x56')]({'where':{'name':_0x34bdd6,'userProfileId':_0x27a116[_0x02a9('0x57')]},'raw':!![]})['then'](function(_0x4ca2f4){if(_0x4ca2f4&&_0x4ca2f4[_0x02a9('0x58')]===0x0){return db[_0x02a9('0x59')][_0x02a9('0x4f')]({'name':_0x5f3e1c[_0x02a9('0x32')],'resourceId':_0x5f3e1c['id'],'type':_0x4ca2f4[_0x02a9('0x32')],'sectionId':_0x4ca2f4['id']},{})['then'](function(){return _0x150dd7;});}else{return _0x150dd7;}})[_0x02a9('0x4c')](function(_0x69987a){logger[_0x02a9('0x5a')](_0x02a9('0x5b'),_0x69987a);throw _0x69987a;});}return _0x150dd7;})[_0x02a9('0x4b')](respondWithResult(_0x25e4ed,0xc9))[_0x02a9('0x4c')](handleError(_0x25e4ed,null));};exports[_0x02a9('0x5c')]=function(_0x3cec8b,_0x402499){if(_0x3cec8b[_0x02a9('0x50')]['id']){delete _0x3cec8b[_0x02a9('0x50')]['id'];}return db[_0x02a9('0x36')][_0x02a9('0x56')]({'where':{'id':_0x3cec8b[_0x02a9('0x4e')]['id']}})[_0x02a9('0x4b')](handleEntityNotFound(_0x402499,null))[_0x02a9('0x4b')](saveUpdates(_0x3cec8b[_0x02a9('0x50')],null))[_0x02a9('0x4b')](respondWithResult(_0x402499,null))[_0x02a9('0x4c')](handleError(_0x402499,null));};exports[_0x02a9('0x5d')]=function(_0x4d347d,_0x475342){var _0x34c0b2=_0x4d347d[_0x02a9('0x4e')]['id'];var _0x413ef6=[];return db[_0x02a9('0x5e')]['transaction'](function(_0x1a8ea1){var _0x321e10=_0x02a9('0x5f')+_0x34c0b2;return db['sequelize']['query'](_0x321e10,{'type':db[_0x02a9('0x60')][_0x02a9('0x61')]['SELECT'],'raw':!![],'transaction':_0x1a8ea1})[_0x02a9('0x4b')](function(_0x5e0c9a){_0x413ef6=_['map'](_0x5e0c9a,function(_0x4de4ee){return Number(_0x4de4ee[_0x02a9('0x62')]);});})['then'](function(){var _0x12af3f=_0x02a9('0x63')+_0x34c0b2;return db['sequelize'][_0x02a9('0x3b')](_0x12af3f,{'type':db[_0x02a9('0x60')][_0x02a9('0x61')][_0x02a9('0x64')],'raw':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0x148290){var _0x1b6a35=_[_0x02a9('0x35')](_0x148290,function(_0x1b69bb){return Number(_0x1b69bb['VoiceQueueId']);});return db[_0x02a9('0x65')]['destroy']({'where':{'UserId':{'$in':_0x413ef6},'VoiceQueueId':{'$in':_0x1b6a35}},'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(){var _0x30bc3d='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x34c0b2;return db[_0x02a9('0x5e')][_0x02a9('0x3b')](_0x30bc3d,{'type':db[_0x02a9('0x60')]['QueryTypes'][_0x02a9('0x64')],'raw':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0x1c72e4){var _0x5d4344=_[_0x02a9('0x35')](_0x1c72e4,function(_0x1cfbc3){return Number(_0x1cfbc3[_0x02a9('0x66')]);});return db[_0x02a9('0x67')]['destroy']({'where':{'UserId':{'$in':_0x413ef6},'MailQueueId':{'$in':_0x5d4344}},'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(){var _0x112c51=_0x02a9('0x68')+_0x34c0b2;return db[_0x02a9('0x5e')][_0x02a9('0x3b')](_0x112c51,{'type':db['Sequelize'][_0x02a9('0x61')][_0x02a9('0x64')],'raw':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0x126ec1){var _0x3b3400=_['map'](_0x126ec1,function(_0x267f67){return Number(_0x267f67['SmsQueueId']);});return db[_0x02a9('0x69')]['destroy']({'where':{'UserId':{'$in':_0x413ef6},'SmsQueueId':{'$in':_0x3b3400}},'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(){var _0x16b6e3=_0x02a9('0x6a')+_0x34c0b2;return db[_0x02a9('0x5e')]['query'](_0x16b6e3,{'type':db[_0x02a9('0x60')][_0x02a9('0x61')]['SELECT'],'raw':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0x2c5555){var _0x462362=_[_0x02a9('0x35')](_0x2c5555,function(_0x454b1b){return Number(_0x454b1b[_0x02a9('0x6b')]);});return db[_0x02a9('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x413ef6},'ChatQueueId':{'$in':_0x462362}},'transaction':_0x1a8ea1});})['then'](function(){var _0x1b58f9=_0x02a9('0x6d')+_0x34c0b2;return db[_0x02a9('0x5e')][_0x02a9('0x3b')](_0x1b58f9,{'type':db[_0x02a9('0x60')][_0x02a9('0x61')][_0x02a9('0x64')],'raw':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0xfb34ba){var _0x4afb9c=_['map'](_0xfb34ba,function(_0x38eb93){return Number(_0x38eb93[_0x02a9('0x6e')]);});return db['UserFaxQueue'][_0x02a9('0x5d')]({'where':{'UserId':{'$in':_0x413ef6},'FaxQueueId':{'$in':_0x4afb9c}},'transaction':_0x1a8ea1});})['then'](function(){var _0x30600c=_0x02a9('0x6f')+_0x34c0b2;return db['sequelize'][_0x02a9('0x3b')](_0x30600c,{'type':db['Sequelize'][_0x02a9('0x61')][_0x02a9('0x64')],'raw':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0x984fac){var _0x54307c=_[_0x02a9('0x35')](_0x984fac,function(_0x89d8bc){return Number(_0x89d8bc[_0x02a9('0x70')]);});return db['UserOpenchannelQueue'][_0x02a9('0x5d')]({'where':{'UserId':{'$in':_0x413ef6},'OpenchannelQueueId':{'$in':_0x54307c}},'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(){var _0x15283b=_0x02a9('0x71')+_0x34c0b2;return db['sequelize'][_0x02a9('0x3b')](_0x15283b,{'type':db['Sequelize'][_0x02a9('0x61')]['SELECT'],'raw':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0x1102c0){var _0x5b45ab=_[_0x02a9('0x35')](_0x1102c0,function(_0x21d27b){return Number(_0x21d27b[_0x02a9('0x72')]);});return db['UserWhatsappQueue'][_0x02a9('0x5d')]({'where':{'UserId':{'$in':_0x413ef6},'WhatsappQueueId':{'$in':_0x5b45ab}},'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(){return db[_0x02a9('0x73')][_0x02a9('0x56')]({'where':{'TeamId':_0x34c0b2}});})['then'](function(_0x10a73e){if(_0x10a73e===null){return;}return db[_0x02a9('0x74')][_0x02a9('0x5d')]({'where':{'UserId':{'$in':_0x413ef6},'VoicePrefixId':_0x10a73e['VoicePrefixId']},'transaction':_0x1a8ea1});})['then'](function(){return db[_0x02a9('0x36')][_0x02a9('0x5d')]({'where':{'id':_0x34c0b2},'cascade':!![],'transaction':_0x1a8ea1});})[_0x02a9('0x4b')](function(_0x5eabf4){if(_0x5eabf4===0x0){_0x475342[_0x02a9('0x24')](0x194);}else{return db['UserProfileResource'][_0x02a9('0x5d')]({'where':{'type':_0x02a9('0x55'),'resourceId':_0x34c0b2},'cascade':!![],'transaction':_0x1a8ea1})['then'](function(){_0x475342[_0x02a9('0x25')](0xcc)[_0x02a9('0x26')]();});}})[_0x02a9('0x4c')](function(_0x27974f){_0x475342[_0x02a9('0x25')](0x1f4)['send'](_0x27974f);});});};exports[_0x02a9('0x75')]=function(_0x46b348,_0x5e908f,_0xafc04){return db[_0x02a9('0x36')][_0x02a9('0x76')]({'where':{'id':_0x46b348['params']['id']}})['then'](handleEntityNotFound(_0x5e908f,null))['then'](function(_0x5c8b78){if(!_0x46b348['query'][_0x02a9('0x77')]||!utils['isValidChannel'](_0x46b348['query'][_0x02a9('0x77')])){throw new db[(_0x02a9('0x60'))][(_0x02a9('0x78'))]('Unknown\x20channel');}var _0x1ed972={};var _0x18203a={};_0x18203a[_0x02a9('0x3a')]=_[_0x02a9('0x3c')](db[_[_0x02a9('0x79')](_0x46b348[_0x02a9('0x3b')][_0x02a9('0x77')]['toLowerCase']())+_0x02a9('0x7a')][_0x02a9('0x7b')]);_0x18203a['query']=_[_0x02a9('0x3c')](_0x46b348['query']);_0x18203a[_0x02a9('0x44')]=_[_0x02a9('0x3d')](_0x18203a[_0x02a9('0x3a')],_0x18203a[_0x02a9('0x3b')]);_0x1ed972[_0x02a9('0x3e')]=_['intersection'](_0x18203a[_0x02a9('0x3a')],qs[_0x02a9('0x3f')](_0x46b348[_0x02a9('0x3b')][_0x02a9('0x3f')]));_0x1ed972[_0x02a9('0x3e')]=_0x1ed972['attributes'][_0x02a9('0x40')]?_0x1ed972['attributes']:_0x18203a[_0x02a9('0x3a')];_0x1ed972[_0x02a9('0x28')]=qs['limit'](_0x46b348[_0x02a9('0x3b')][_0x02a9('0x28')]);_0x1ed972['offset']=qs[_0x02a9('0x27')](_0x46b348[_0x02a9('0x3b')][_0x02a9('0x27')]);_0x1ed972[_0x02a9('0x7c')]=qs[_0x02a9('0x7d')](_0x46b348[_0x02a9('0x3b')]['sort']);_0x1ed972['where']=qs['filters'](_[_0x02a9('0x43')](_0x46b348[_0x02a9('0x3b')],_0x18203a[_0x02a9('0x44')]));_0x1ed972=_[_0x02a9('0x46')]({},_0x1ed972,_0x46b348[_0x02a9('0x47')]);return _0x5c8b78[_0x02a9('0x52')+_[_0x02a9('0x79')](_0x46b348[_0x02a9('0x3b')]['channel'][_0x02a9('0x7e')]())+_0x02a9('0x7f')](_0x1ed972);})[_0x02a9('0x4b')](respondWithResult(_0x5e908f,null))[_0x02a9('0x4c')](handleError(_0x5e908f,null));};exports[_0x02a9('0x80')]=function(_0x28606f,_0x3bb354,_0xf3bb53){return db[_0x02a9('0x36')][_0x02a9('0x76')]({'where':{'id':_0x28606f['params']['id']}})['then'](function(_0x3226fe){if(_0x3226fe){if(!_0x28606f['body'][_0x02a9('0x77')]||!utils[_0x02a9('0x81')](_0x28606f[_0x02a9('0x50')][_0x02a9('0x77')])){throw new db['Sequelize'][(_0x02a9('0x78'))](_0x02a9('0x82'));}return _0x3226fe['add'+_[_0x02a9('0x79')](_0x28606f['body'][_0x02a9('0x77')][_0x02a9('0x7e')]())+'Queues'](_0x28606f[_0x02a9('0x50')][_0x02a9('0x83')]);}return null;})[_0x02a9('0x4b')](handleEntityNotFound(_0x3bb354,null))[_0x02a9('0x4b')](respondWithStatusCode(_0x3bb354,null))[_0x02a9('0x4c')](handleError(_0x3bb354,null));};exports[_0x02a9('0x84')]=function(_0x3d0e00,_0x11fcf4,_0x727e1c){return db['Team'][_0x02a9('0x76')]({'where':{'id':_0x3d0e00['params']['id']}})[_0x02a9('0x4b')](function(_0x52fc2c){if(_0x52fc2c){if(!_0x3d0e00[_0x02a9('0x3b')][_0x02a9('0x77')]||!utils[_0x02a9('0x81')](_0x3d0e00[_0x02a9('0x3b')][_0x02a9('0x77')])){throw new db[(_0x02a9('0x60'))][(_0x02a9('0x78'))](_0x02a9('0x82'));}return _0x52fc2c[_0x02a9('0x85')+_[_0x02a9('0x79')](_0x3d0e00[_0x02a9('0x3b')]['channel'][_0x02a9('0x7e')]())+_0x02a9('0x7f')](_0x3d0e00['query'][_0x02a9('0x83')]);}return null;})[_0x02a9('0x4b')](handleEntityNotFound(_0x11fcf4,null))[_0x02a9('0x4b')](respondWithStatusCode(_0x11fcf4,null))[_0x02a9('0x4c')](handleError(_0x11fcf4,null));};exports[_0x02a9('0x86')]=function(_0x1b6f4e,_0x336f56){var _0x2f613e=_[_0x02a9('0x87')](_0x1b6f4e[_0x02a9('0x50')][_0x02a9('0x83')])?_0x1b6f4e[_0x02a9('0x50')][_0x02a9('0x83')]:[_0x1b6f4e['body'][_0x02a9('0x83')]];var _0x3d2ba2=_0x1b6f4e[_0x02a9('0x4e')]['id'];return db[_0x02a9('0x36')][_0x02a9('0x56')]({'where':{'id':_0x3d2ba2}})[_0x02a9('0x4b')](handleEntityNotFound(_0x336f56,null))[_0x02a9('0x4b')](function(_0x33df53){if(_0x33df53){var _0x1d2e3f=[_0x02a9('0x88'),_0x02a9('0x89'),_0x02a9('0x8a'),'Sms',_0x02a9('0x8b'),_0x02a9('0x8c'),_0x02a9('0x8d')];return db[_0x02a9('0x5e')][_0x02a9('0x8e')](function(_0x37df79){var _0x238a20=_['map'](_0x1d2e3f,function(_0x1e9fbb){var _0x47e637={'attributes':['id',_0x02a9('0x32')]};if(_0x1e9fbb==='Voice'){_0x47e637[_0x02a9('0x8f')]={'attributes':[_0x02a9('0x90')]};}return _0x33df53[_0x02a9('0x52')+_0x1e9fbb+_0x02a9('0x7f')](_0x47e637)[_0x02a9('0x4b')](function(_0x43305a){var _0x5ce9da=_['map'](_0x43305a,function(_0x44f862){var _0x1be27a=_['map'](_0x2f613e,function(_0xbda92b){var _0x337ddd={'where':{'UserId':_0xbda92b,[_0x1e9fbb+_0x02a9('0x91')]:_0x44f862['id']},'transaction':_0x37df79};if(_0x1e9fbb===_0x02a9('0x88')){_0x337ddd['defaults']={'penalty':_0x44f862['TeamVoiceQueue'][_0x02a9('0x90')]};}return db[_0x02a9('0x92')+_0x1e9fbb+_0x02a9('0x7a')]['findOrCreate'](_0x337ddd)[_0x02a9('0x4b')](function(){socket[_0x02a9('0x93')]('user'+_0x1e9fbb+_0x02a9('0x94'),{'UserId':_0xbda92b,[_0x1e9fbb+_0x02a9('0x91')]:_0x44f862['id']});if(_0x1e9fbb!=='Voice'){return;}return db[_0x02a9('0x92')][_0x02a9('0x4a')]({'where':{'id':_0x2f613e,'online':0x1},'attributes':['id',_0x02a9('0x32'),_0x02a9('0x95'),_0x02a9('0x96'),_0x02a9('0x97')],'raw':!![]})['then'](function(_0x6f714d){var _0x57bacb=_[_0x02a9('0x35')](_0x6f714d,function(_0x2bfe3f){return db[_0x02a9('0x98')][_0x02a9('0x99')]({'membername':_0x2bfe3f[_0x02a9('0x32')],'UserId':_0x2bfe3f['id'],'queue_name':_0x44f862[_0x02a9('0x32')],'VoiceQueueId':_0x44f862['id'],'interface':_[_0x02a9('0x9a')](_0x2bfe3f['interface'])?util[_0x02a9('0x9b')](_0x02a9('0x9c'),_0x2bfe3f['name']):_0x2bfe3f[_0x02a9('0x97')],'paused':_0x2bfe3f['voicePause']||![],'penalty':_0x44f862[_0x02a9('0x9d')][_0x02a9('0x90')]},{'transaction':_0x37df79});});return Promise[_0x02a9('0x9e')](_0x57bacb);});});});return Promise['all'](_0x1be27a);});return Promise['all'](_0x5ce9da);})['then'](function(){return db[_0x02a9('0x73')][_0x02a9('0x76')]({'where':{'teamId':_0x3d2ba2}})[_0x02a9('0x4b')](function(_0x219f43){if(_0x219f43){var _0x1e36c9=_[_0x02a9('0x35')](_0x2f613e,function(_0x4022b1){db[_0x02a9('0x74')][_0x02a9('0x99')]({'UserId':_0x4022b1,'VoicePrefixId':_0x219f43[_0x02a9('0x9f')]});});return Promise[_0x02a9('0x9e')](_0x1e36c9);}});});});return Promise[_0x02a9('0x9e')](_0x238a20)[_0x02a9('0x4b')](function(){return _0x33df53['addAgents'](_0x2f613e,{'transaction':_0x37df79})[_0x02a9('0xa0')](function(_0x5d4b9e){return _0x5d4b9e;});});});}})['then'](respondWithResult(_0x336f56,null))[_0x02a9('0x4c')](handleError(_0x336f56,null));};exports['removeAgents']=function(_0x2b9f5c,_0x5c63ab){var _0x4db5a9=_['isArray'](_0x2b9f5c[_0x02a9('0x3b')]['ids'])?_0x2b9f5c[_0x02a9('0x3b')][_0x02a9('0x83')]:[_0x2b9f5c[_0x02a9('0x3b')][_0x02a9('0x83')]];var _0x207da9=_0x2b9f5c[_0x02a9('0x4e')]['id'];return db[_0x02a9('0x36')]['find']({'where':{'id':_0x207da9}})['then'](handleEntityNotFound(_0x5c63ab,null))[_0x02a9('0x4b')](function(_0x30ca1d){if(_0x30ca1d){var _0x2c8250=['Voice',_0x02a9('0x89'),_0x02a9('0x8a'),_0x02a9('0xa1'),_0x02a9('0x8b'),_0x02a9('0x8c'),'Whatsapp'];return db[_0x02a9('0x5e')][_0x02a9('0x8e')](function(_0x2813d7){var _0x4d03c5=_[_0x02a9('0x35')](_0x2c8250,function(_0x3ea1d7){var _0x48cb9c={'attributes':['id','name']};return _0x30ca1d[_0x02a9('0x52')+_0x3ea1d7+_0x02a9('0x7f')](_0x48cb9c)[_0x02a9('0x4b')](function(_0x59bd53){var _0xf2eb31=_['map'](_0x59bd53,function(_0x1ffe28){return _0x1ffe28[_0x02a9('0xa2')](_0x4db5a9,{'transaction':_0x2813d7})['then'](function(){var _0x1ced1c=_[_0x02a9('0x35')](_0x4db5a9,function(_0x288e59){socket['emit'](_0x02a9('0x51')+_0x3ea1d7+_0x02a9('0xa3'),{'UserId':Number(_0x288e59),[_0x3ea1d7+_0x02a9('0x91')]:_0x1ffe28['id']});if(_0x3ea1d7!=='Voice'){return;}return db[_0x02a9('0x98')]['destroy']({'where':{'VoiceQueueId':_0x1ffe28['id'],'UserId':_0x288e59},'transaction':_0x2813d7});});return Promise[_0x02a9('0x9e')](_0x1ced1c);});});return Promise[_0x02a9('0x9e')](_0xf2eb31);});});return Promise[_0x02a9('0x9e')](_0x4d03c5)[_0x02a9('0x4b')](function(){return _0x30ca1d[_0x02a9('0xa2')](_0x4db5a9,{'transaction':_0x2813d7});})['then'](function(){return db[_0x02a9('0x73')][_0x02a9('0x76')]({'where':{'teamId':_0x207da9}})[_0x02a9('0x4b')](function(_0x1ca882){if(_0x1ca882){var _0x308c24=_[_0x02a9('0x35')](_0x4db5a9,function(_0x2eca90){db[_0x02a9('0x74')][_0x02a9('0x5d')]({'where':{'UserId':_0x2eca90,'VoicePrefixId':_0x1ca882[_0x02a9('0x9f')]}});});return Promise[_0x02a9('0x9e')](_0x308c24);}});});});}})[_0x02a9('0x4b')](respondWithStatusCode(_0x5c63ab,null))[_0x02a9('0x4c')](handleError(_0x5c63ab,null));};exports['getAgents']=function(_0x46d517,_0x20aaf8,_0x51bb68){var _0x32274c={};var _0x1d0afe={};var _0x5539b2;var _0x8b055e;return db['Team'][_0x02a9('0x76')]({'where':{'id':_0x46d517[_0x02a9('0x4e')]['id']}})[_0x02a9('0x4b')](handleEntityNotFound(_0x20aaf8,null))[_0x02a9('0x4b')](function(_0xca1ea8){if(_0xca1ea8){_0x5539b2=_0xca1ea8;_0x1d0afe[_0x02a9('0x3a')]=_[_0x02a9('0x3c')](db[_0x02a9('0x92')]['rawAttributes']);_0x1d0afe[_0x02a9('0x3b')]=_['keys'](_0x46d517[_0x02a9('0x3b')]);_0x1d0afe[_0x02a9('0x44')]=_[_0x02a9('0x3d')](_0x1d0afe[_0x02a9('0x3a')],_0x1d0afe[_0x02a9('0x3b')]);_0x32274c[_0x02a9('0x3e')]=_[_0x02a9('0x3d')](_0x1d0afe[_0x02a9('0x3a')],qs[_0x02a9('0x3f')](_0x46d517[_0x02a9('0x3b')][_0x02a9('0x3f')]));_0x32274c[_0x02a9('0x3e')]=_0x32274c[_0x02a9('0x3e')][_0x02a9('0x40')]?_0x32274c['attributes']:_0x1d0afe['model'];_0x32274c[_0x02a9('0x7c')]=qs[_0x02a9('0x7d')](_0x46d517['query'][_0x02a9('0x7d')]);_0x32274c[_0x02a9('0x42')]=qs[_0x02a9('0x44')](_[_0x02a9('0x43')](_0x46d517['query'],_0x1d0afe[_0x02a9('0x44')]));if(_0x46d517[_0x02a9('0x3b')][_0x02a9('0x45')]){_0x32274c[_0x02a9('0x42')]=_[_0x02a9('0x46')](_0x32274c[_0x02a9('0x42')],{'$or':_[_0x02a9('0x35')](_0x32274c[_0x02a9('0x3e')],function(_0x98c92){var _0x244b93={};_0x244b93[_0x98c92]={'$like':'%'+_0x46d517['query'][_0x02a9('0x45')]+'%'};return _0x244b93;})});}_0x32274c=_[_0x02a9('0x46')]({},_0x32274c,_0x46d517[_0x02a9('0x47')]);return _0x5539b2['getAgents'](_0x32274c);}})['then'](function(_0x3c8a5c){if(_0x3c8a5c){_0x8b055e=_0x3c8a5c[_0x02a9('0x40')];if(!_0x46d517[_0x02a9('0x3b')][_0x02a9('0xa4')](_0x02a9('0x41'))){_0x32274c['limit']=qs[_0x02a9('0x28')](_0x46d517[_0x02a9('0x3b')]['limit']);_0x32274c['offset']=qs[_0x02a9('0x27')](_0x46d517['query'][_0x02a9('0x27')]);}return _0x5539b2[_0x02a9('0xa5')](_0x32274c);}})[_0x02a9('0x4b')](function(_0x417b9a){if(_0x417b9a){return _0x417b9a?{'count':_0x8b055e,'rows':_0x417b9a}:null;}})[_0x02a9('0x4b')](respondWithResult(_0x20aaf8,null))['catch'](handleError(_0x20aaf8,null));}; \ No newline at end of file +var _0x7ea2=['Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','VoicePrefixId','UserProfileResource','send','getQueues','findOne','isValidChannel','Unknown\x20channel','toLowerCase','capitalize','channel','addQueues','ValidationError','add','Queues','ids','remove','addAgents','isArray','Voice','Chat','Fax','Openchannel','through','penalty','QueueId','TeamVoiceQueue','User','Queue:save','online','voicePause','interface','UserVoiceQueueRt','isNil','format','all','UserVoicePrefix','upsert','Sms','Whatsapp','removeAgents','emit','Queue:remove','TeamVoicePrefix','getAgents','nolimit','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','stack','index','map'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x7ea2,0x6a));var _0x27ea=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x7ea2[_0x2d0d9f];return _0x30243d;};'use strict';var emlformat=require(_0x27ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27ea('0x2'));var moment=require(_0x27ea('0x3'));var BPromise=require(_0x27ea('0x4'));var Mustache=require(_0x27ea('0x5'));var util=require(_0x27ea('0x6'));var path=require(_0x27ea('0x7'));var sox=require(_0x27ea('0x8'));var csv=require(_0x27ea('0x9'));var ejs=require(_0x27ea('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27ea('0xb'));var squel=require(_0x27ea('0xc'));var crypto=require(_0x27ea('0xd'));var jsforce=require(_0x27ea('0xe'));var deskjs=require(_0x27ea('0xf'));var toCsv=require(_0x27ea('0x9'));var querystring=require('querystring');var Papa=require(_0x27ea('0x10'));var Redis=require(_0x27ea('0x11'));var authService=require(_0x27ea('0x12'));var qs=require(_0x27ea('0x13'));var as=require(_0x27ea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x27ea('0x15'))('api');var utils=require(_0x27ea('0x16'));var config=require(_0x27ea('0x17'));var licenseUtil=require(_0x27ea('0x18'));var db=require('../../mysqldb')['db'];config[_0x27ea('0x19')]=_[_0x27ea('0x1a')](config[_0x27ea('0x19')],{'host':_0x27ea('0x1b'),'port':0x18eb});var socket=require(_0x27ea('0x1c'))(new Redis(config['redis']));require(_0x27ea('0x1d'))[_0x27ea('0x1e')](socket);function respondWithStatusCode(_0x5ad23c,_0x45d8c5){_0x45d8c5=_0x45d8c5||0xcc;return function(_0x24193b){if(_0x24193b){return _0x5ad23c['sendStatus'](_0x45d8c5);}return _0x5ad23c[_0x27ea('0x1f')](_0x45d8c5)[_0x27ea('0x20')]();};}function respondWithResult(_0x5d13c3,_0x37e019){_0x37e019=_0x37e019||0xc8;return function(_0x207c8f){if(_0x207c8f){return _0x5d13c3[_0x27ea('0x1f')](_0x37e019)[_0x27ea('0x21')](_0x207c8f);}};}function respondWithFilteredResult(_0x245929,_0x1624f0){return function(_0x634e24){if(_0x634e24){var _0x4520c7=typeof _0x1624f0[_0x27ea('0x22')]===_0x27ea('0x23')&&typeof _0x1624f0[_0x27ea('0x24')]===_0x27ea('0x23');var _0x2671c0=_0x634e24[_0x27ea('0x25')];var _0xc56ea0=_0x4520c7?0x0:_0x1624f0['offset'];var _0x504c4d=_0x4520c7?_0x634e24[_0x27ea('0x25')]:_0x1624f0[_0x27ea('0x22')]+_0x1624f0[_0x27ea('0x24')];var _0xfa51aa;if(_0x504c4d>=_0x2671c0){_0x504c4d=_0x2671c0;_0xfa51aa=0xc8;}else{_0xfa51aa=0xce;}_0x245929[_0x27ea('0x1f')](_0xfa51aa);return _0x245929[_0x27ea('0x26')]('Content-Range',_0xc56ea0+'-'+_0x504c4d+'/'+_0x2671c0)[_0x27ea('0x21')](_0x634e24);}return null;};}function patchUpdates(_0x26c6bb){return function(_0x579e0c){try{jsonpatch[_0x27ea('0x27')](_0x579e0c,_0x26c6bb,!![]);}catch(_0x4077bb){return BPromise[_0x27ea('0x28')](_0x4077bb);}return _0x579e0c[_0x27ea('0x29')]();};}function saveUpdates(_0x56d8c0,_0x45cb92){return function(_0x35dda4){if(_0x35dda4){return _0x35dda4[_0x27ea('0x2a')](_0x56d8c0)[_0x27ea('0x2b')](function(_0x106b4c){return _0x106b4c;});}return null;};}function handleEntityNotFound(_0x361e9b,_0x4cab54){return function(_0xac186c){if(!_0xac186c){_0x361e9b[_0x27ea('0x2c')](0x194);}return _0xac186c;};}function handleError(_0xdd106b,_0x3aee08){_0x3aee08=_0x3aee08||0x1f4;return function(_0x28a313){logger[_0x27ea('0x2d')](_0x28a313[_0x27ea('0x2e')]);if(_0x28a313['name']){delete _0x28a313['name'];}_0xdd106b[_0x27ea('0x1f')](_0x3aee08)['send'](_0x28a313);};}exports[_0x27ea('0x2f')]=function(_0x32bb0b,_0x2df7eb){var _0x1daad3={},_0x474f6e={},_0x3606de={'count':0x0,'rows':[]};var _0x6a1950=_[_0x27ea('0x30')](db[_0x27ea('0x31')]['rawAttributes'],function(_0x43da29){return{'name':_0x43da29[_0x27ea('0x32')],'type':_0x43da29[_0x27ea('0x33')][_0x27ea('0x34')]};});_0x474f6e[_0x27ea('0x35')]=_[_0x27ea('0x30')](_0x6a1950,'name');_0x474f6e[_0x27ea('0x36')]=_[_0x27ea('0x37')](_0x32bb0b[_0x27ea('0x36')]);_0x474f6e[_0x27ea('0x38')]=_[_0x27ea('0x39')](_0x474f6e[_0x27ea('0x35')],_0x474f6e[_0x27ea('0x36')]);_0x1daad3[_0x27ea('0x3a')]=_[_0x27ea('0x39')](_0x474f6e[_0x27ea('0x35')],qs[_0x27ea('0x3b')](_0x32bb0b['query'][_0x27ea('0x3b')]));_0x1daad3[_0x27ea('0x3a')]=_0x1daad3[_0x27ea('0x3a')][_0x27ea('0x3c')]?_0x1daad3[_0x27ea('0x3a')]:_0x474f6e[_0x27ea('0x35')];if(!_0x32bb0b[_0x27ea('0x36')][_0x27ea('0x3d')]('nolimit')){_0x1daad3[_0x27ea('0x24')]=qs[_0x27ea('0x24')](_0x32bb0b[_0x27ea('0x36')]['limit']);_0x1daad3[_0x27ea('0x22')]=qs[_0x27ea('0x22')](_0x32bb0b[_0x27ea('0x36')][_0x27ea('0x22')]);}_0x1daad3['order']=qs[_0x27ea('0x3e')](_0x32bb0b['query'][_0x27ea('0x3e')]);_0x1daad3[_0x27ea('0x3f')]=qs['filters'](_[_0x27ea('0x40')](_0x32bb0b[_0x27ea('0x36')],_0x474f6e[_0x27ea('0x38')]),_0x6a1950);if(_0x32bb0b['query'][_0x27ea('0x41')]){_0x1daad3['where']=_[_0x27ea('0x42')](_0x1daad3['where'],{'$or':_['map'](_0x6a1950,function(_0x12136a){if(_0x12136a[_0x27ea('0x33')]!==_0x27ea('0x43')){var _0x52618d={};_0x52618d[_0x12136a[_0x27ea('0x44')]]={'$like':'%'+_0x32bb0b[_0x27ea('0x36')][_0x27ea('0x41')]+'%'};return _0x52618d;}})});}_0x1daad3=_[_0x27ea('0x42')]({},_0x1daad3,_0x32bb0b['options']);var _0x3b9600={'where':_0x1daad3['where']};return db[_0x27ea('0x31')][_0x27ea('0x25')](_0x3b9600)[_0x27ea('0x2b')](function(_0x35e712){_0x3606de[_0x27ea('0x25')]=_0x35e712;if(_0x32bb0b['query'][_0x27ea('0x45')]){_0x1daad3['include']=[{'all':!![]}];}return db['Team'][_0x27ea('0x46')](_0x1daad3);})[_0x27ea('0x2b')](function(_0x49d692){_0x3606de[_0x27ea('0x47')]=_0x49d692;return _0x3606de;})[_0x27ea('0x2b')](respondWithFilteredResult(_0x2df7eb,_0x1daad3))['catch'](handleError(_0x2df7eb,null));};exports[_0x27ea('0x48')]=function(_0x5c27a8,_0x411d4b){var _0x352d49={'raw':![],'where':{'id':_0x5c27a8[_0x27ea('0x49')]['id']}},_0x90be8f={};_0x90be8f['model']=_[_0x27ea('0x37')](db['Team'][_0x27ea('0x4a')]);_0x90be8f[_0x27ea('0x36')]=_[_0x27ea('0x37')](_0x5c27a8[_0x27ea('0x36')]);_0x90be8f['filters']=_[_0x27ea('0x39')](_0x90be8f[_0x27ea('0x35')],_0x90be8f[_0x27ea('0x36')]);_0x352d49['attributes']=_[_0x27ea('0x39')](_0x90be8f['model'],qs['fields'](_0x5c27a8['query'][_0x27ea('0x3b')]));_0x352d49[_0x27ea('0x3a')]=_0x352d49[_0x27ea('0x3a')][_0x27ea('0x3c')]?_0x352d49[_0x27ea('0x3a')]:_0x90be8f[_0x27ea('0x35')];if(_0x5c27a8['query']['includeAll']){_0x352d49[_0x27ea('0x4b')]=[{'all':!![]}];}_0x352d49=_[_0x27ea('0x42')]({},_0x352d49,_0x5c27a8[_0x27ea('0x4c')]);return db['Team'][_0x27ea('0x4d')](_0x352d49)['then'](handleEntityNotFound(_0x411d4b,null))['then'](respondWithResult(_0x411d4b,null))['catch'](handleError(_0x411d4b,null));};exports[_0x27ea('0x4e')]=function(_0x5dcbef,_0x5629b3){return db[_0x27ea('0x31')][_0x27ea('0x4e')](_0x5dcbef[_0x27ea('0x4f')],{})[_0x27ea('0x2b')](function(_0x5ccd2c){var _0x5e7a15=_0x5dcbef['user']['get']({'plain':!![]});if(!_0x5e7a15)throw new Error(_0x27ea('0x50'));if(_0x5e7a15[_0x27ea('0x51')]===_0x27ea('0x52')){var _0x30d999=_0x5ccd2c[_0x27ea('0x53')]({'plain':!![]});var _0x315168=_0x27ea('0x54');return db[_0x27ea('0x55')][_0x27ea('0x4d')]({'where':{'name':_0x315168,'userProfileId':_0x5e7a15['userProfileId']},'raw':!![]})['then'](function(_0xd967c6){if(_0xd967c6&&_0xd967c6[_0x27ea('0x56')]===0x0){return db['UserProfileResource'][_0x27ea('0x4e')]({'name':_0x30d999[_0x27ea('0x44')],'resourceId':_0x30d999['id'],'type':_0xd967c6[_0x27ea('0x44')],'sectionId':_0xd967c6['id']},{})['then'](function(){return _0x5ccd2c;});}else{return _0x5ccd2c;}})['catch'](function(_0x328da7){logger[_0x27ea('0x2d')](_0x27ea('0x57'),_0x328da7);throw _0x328da7;});}return _0x5ccd2c;})[_0x27ea('0x2b')](respondWithResult(_0x5629b3,0xc9))[_0x27ea('0x58')](handleError(_0x5629b3,null));};exports[_0x27ea('0x2a')]=function(_0x1dc696,_0x9233e){if(_0x1dc696[_0x27ea('0x4f')]['id']){delete _0x1dc696[_0x27ea('0x4f')]['id'];}return db[_0x27ea('0x31')][_0x27ea('0x4d')]({'where':{'id':_0x1dc696[_0x27ea('0x49')]['id']}})[_0x27ea('0x2b')](handleEntityNotFound(_0x9233e,null))[_0x27ea('0x2b')](saveUpdates(_0x1dc696['body'],null))[_0x27ea('0x2b')](respondWithResult(_0x9233e,null))[_0x27ea('0x58')](handleError(_0x9233e,null));};exports['destroy']=function(_0x84be45,_0x15412c){var _0x4bcf1a=_0x84be45['params']['id'];var _0x3ab6f3=[];return db[_0x27ea('0x59')][_0x27ea('0x5a')](function(_0x4d6514){var _0x1c15ad=_0x27ea('0x5b')+_0x4bcf1a;return db['sequelize']['query'](_0x1c15ad,{'type':db['Sequelize'][_0x27ea('0x5c')][_0x27ea('0x5d')],'raw':!![],'transaction':_0x4d6514})['then'](function(_0x293070){_0x3ab6f3=_[_0x27ea('0x30')](_0x293070,function(_0x1be064){return Number(_0x1be064[_0x27ea('0x5e')]);});})['then'](function(){var _0x22f01d='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4bcf1a;return db['sequelize'][_0x27ea('0x36')](_0x22f01d,{'type':db[_0x27ea('0x5f')][_0x27ea('0x5c')]['SELECT'],'raw':!![],'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(_0x2fc31f){var _0x190b34=_[_0x27ea('0x30')](_0x2fc31f,function(_0x3a0b27){return Number(_0x3a0b27[_0x27ea('0x60')]);});return db[_0x27ea('0x61')][_0x27ea('0x62')]({'where':{'UserId':{'$in':_0x3ab6f3},'VoiceQueueId':{'$in':_0x190b34}},'transaction':_0x4d6514});})['then'](function(){var _0x25ac70='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4bcf1a;return db[_0x27ea('0x59')][_0x27ea('0x36')](_0x25ac70,{'type':db[_0x27ea('0x5f')][_0x27ea('0x5c')][_0x27ea('0x5d')],'raw':!![],'transaction':_0x4d6514});})['then'](function(_0x119572){var _0x46428e=_[_0x27ea('0x30')](_0x119572,function(_0x1af58d){return Number(_0x1af58d[_0x27ea('0x63')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x3ab6f3},'MailQueueId':{'$in':_0x46428e}},'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(){var _0x229901=_0x27ea('0x64')+_0x4bcf1a;return db['sequelize']['query'](_0x229901,{'type':db['Sequelize'][_0x27ea('0x5c')][_0x27ea('0x5d')],'raw':!![],'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(_0x54959b){var _0x5bef2b=_[_0x27ea('0x30')](_0x54959b,function(_0x58a559){return Number(_0x58a559['SmsQueueId']);});return db[_0x27ea('0x65')][_0x27ea('0x62')]({'where':{'UserId':{'$in':_0x3ab6f3},'SmsQueueId':{'$in':_0x5bef2b}},'transaction':_0x4d6514});})['then'](function(){var _0xc2be84=_0x27ea('0x66')+_0x4bcf1a;return db[_0x27ea('0x59')][_0x27ea('0x36')](_0xc2be84,{'type':db[_0x27ea('0x5f')][_0x27ea('0x5c')]['SELECT'],'raw':!![],'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(_0x5405b8){var _0x232d24=_[_0x27ea('0x30')](_0x5405b8,function(_0x53f537){return Number(_0x53f537[_0x27ea('0x67')]);});return db[_0x27ea('0x68')][_0x27ea('0x62')]({'where':{'UserId':{'$in':_0x3ab6f3},'ChatQueueId':{'$in':_0x232d24}},'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(){var _0x1f0fb2=_0x27ea('0x69')+_0x4bcf1a;return db[_0x27ea('0x59')][_0x27ea('0x36')](_0x1f0fb2,{'type':db[_0x27ea('0x5f')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(_0x1f05fe){var _0x47c19e=_[_0x27ea('0x30')](_0x1f05fe,function(_0x56795f){return Number(_0x56795f['FaxQueueId']);});return db[_0x27ea('0x6a')][_0x27ea('0x62')]({'where':{'UserId':{'$in':_0x3ab6f3},'FaxQueueId':{'$in':_0x47c19e}},'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(){var _0x11696e='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4bcf1a;return db[_0x27ea('0x59')][_0x27ea('0x36')](_0x11696e,{'type':db['Sequelize']['QueryTypes'][_0x27ea('0x5d')],'raw':!![],'transaction':_0x4d6514});})['then'](function(_0x41182d){var _0x9c98=_[_0x27ea('0x30')](_0x41182d,function(_0x11a398){return Number(_0x11a398[_0x27ea('0x6b')]);});return db[_0x27ea('0x6c')][_0x27ea('0x62')]({'where':{'UserId':{'$in':_0x3ab6f3},'OpenchannelQueueId':{'$in':_0x9c98}},'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(){var _0x57c2ac=_0x27ea('0x6d')+_0x4bcf1a;return db[_0x27ea('0x59')]['query'](_0x57c2ac,{'type':db['Sequelize'][_0x27ea('0x5c')][_0x27ea('0x5d')],'raw':!![],'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(_0x4f8736){var _0xbf2487=_['map'](_0x4f8736,function(_0x35e5c7){return Number(_0x35e5c7['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x27ea('0x62')]({'where':{'UserId':{'$in':_0x3ab6f3},'WhatsappQueueId':{'$in':_0xbf2487}},'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(){return db['TeamVoicePrefix'][_0x27ea('0x4d')]({'where':{'TeamId':_0x4bcf1a}});})[_0x27ea('0x2b')](function(_0x273eff){if(_0x273eff===null){return;}return db['UserVoicePrefix'][_0x27ea('0x62')]({'where':{'UserId':{'$in':_0x3ab6f3},'VoicePrefixId':_0x273eff[_0x27ea('0x6e')]},'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(){return db[_0x27ea('0x31')][_0x27ea('0x62')]({'where':{'id':_0x4bcf1a},'cascade':!![],'transaction':_0x4d6514});})[_0x27ea('0x2b')](function(_0x198e19){if(_0x198e19===0x0){_0x15412c[_0x27ea('0x2c')](0x194);}else{return db[_0x27ea('0x6f')][_0x27ea('0x62')]({'where':{'type':_0x27ea('0x54'),'resourceId':_0x4bcf1a},'cascade':!![],'transaction':_0x4d6514})['then'](function(){_0x15412c[_0x27ea('0x1f')](0xcc)[_0x27ea('0x20')]();});}})[_0x27ea('0x58')](function(_0xd1a21c){_0x15412c[_0x27ea('0x1f')](0x1f4)[_0x27ea('0x70')](_0xd1a21c);});});};exports[_0x27ea('0x71')]=function(_0x4c8c41,_0x27b8b2,_0x4e1b87){return db[_0x27ea('0x31')][_0x27ea('0x72')]({'where':{'id':_0x4c8c41[_0x27ea('0x49')]['id']}})[_0x27ea('0x2b')](handleEntityNotFound(_0x27b8b2,null))[_0x27ea('0x2b')](function(_0x2c531c){if(!_0x4c8c41[_0x27ea('0x36')]['channel']||!utils[_0x27ea('0x73')](_0x4c8c41[_0x27ea('0x36')]['channel'])){throw new db[(_0x27ea('0x5f'))]['ValidationError'](_0x27ea('0x74'));}var _0x184c9c={};var _0x9a81e9={};_0x9a81e9[_0x27ea('0x35')]=_['keys'](db[_['capitalize'](_0x4c8c41[_0x27ea('0x36')]['channel'][_0x27ea('0x75')]())+'Queue']['rawAttributes']);_0x9a81e9[_0x27ea('0x36')]=_[_0x27ea('0x37')](_0x4c8c41['query']);_0x9a81e9[_0x27ea('0x38')]=_[_0x27ea('0x39')](_0x9a81e9[_0x27ea('0x35')],_0x9a81e9['query']);_0x184c9c['attributes']=_[_0x27ea('0x39')](_0x9a81e9['model'],qs[_0x27ea('0x3b')](_0x4c8c41[_0x27ea('0x36')]['fields']));_0x184c9c['attributes']=_0x184c9c[_0x27ea('0x3a')][_0x27ea('0x3c')]?_0x184c9c['attributes']:_0x9a81e9[_0x27ea('0x35')];_0x184c9c[_0x27ea('0x24')]=qs[_0x27ea('0x24')](_0x4c8c41[_0x27ea('0x36')][_0x27ea('0x24')]);_0x184c9c['offset']=qs['offset'](_0x4c8c41[_0x27ea('0x36')][_0x27ea('0x22')]);_0x184c9c['order']=qs['sort'](_0x4c8c41['query']['sort']);_0x184c9c[_0x27ea('0x3f')]=qs[_0x27ea('0x38')](_['pick'](_0x4c8c41[_0x27ea('0x36')],_0x9a81e9['filters']));_0x184c9c=_[_0x27ea('0x42')]({},_0x184c9c,_0x4c8c41[_0x27ea('0x4c')]);return _0x2c531c[_0x27ea('0x53')+_[_0x27ea('0x76')](_0x4c8c41[_0x27ea('0x36')][_0x27ea('0x77')][_0x27ea('0x75')]())+'Queues'](_0x184c9c);})[_0x27ea('0x2b')](respondWithResult(_0x27b8b2,null))[_0x27ea('0x58')](handleError(_0x27b8b2,null));};exports[_0x27ea('0x78')]=function(_0x46131e,_0xa70197,_0x30ff18){return db[_0x27ea('0x31')]['findOne']({'where':{'id':_0x46131e[_0x27ea('0x49')]['id']}})[_0x27ea('0x2b')](function(_0x3f8dd7){if(_0x3f8dd7){if(!_0x46131e[_0x27ea('0x4f')][_0x27ea('0x77')]||!utils[_0x27ea('0x73')](_0x46131e[_0x27ea('0x4f')]['channel'])){throw new db[(_0x27ea('0x5f'))][(_0x27ea('0x79'))](_0x27ea('0x74'));}return _0x3f8dd7[_0x27ea('0x7a')+_[_0x27ea('0x76')](_0x46131e['body'][_0x27ea('0x77')]['toLowerCase']())+_0x27ea('0x7b')](_0x46131e[_0x27ea('0x4f')][_0x27ea('0x7c')]);}return null;})[_0x27ea('0x2b')](handleEntityNotFound(_0xa70197,null))[_0x27ea('0x2b')](respondWithStatusCode(_0xa70197,null))['catch'](handleError(_0xa70197,null));};exports['removeQueues']=function(_0x5c078a,_0x4db3ea,_0x5325c0){return db[_0x27ea('0x31')][_0x27ea('0x72')]({'where':{'id':_0x5c078a['params']['id']}})[_0x27ea('0x2b')](function(_0x11fb7e){if(_0x11fb7e){if(!_0x5c078a['query'][_0x27ea('0x77')]||!utils['isValidChannel'](_0x5c078a[_0x27ea('0x36')][_0x27ea('0x77')])){throw new db[(_0x27ea('0x5f'))][(_0x27ea('0x79'))](_0x27ea('0x74'));}return _0x11fb7e[_0x27ea('0x7d')+_[_0x27ea('0x76')](_0x5c078a['query'][_0x27ea('0x77')][_0x27ea('0x75')]())+_0x27ea('0x7b')](_0x5c078a['query'][_0x27ea('0x7c')]);}return null;})[_0x27ea('0x2b')](handleEntityNotFound(_0x4db3ea,null))['then'](respondWithStatusCode(_0x4db3ea,null))[_0x27ea('0x58')](handleError(_0x4db3ea,null));};exports[_0x27ea('0x7e')]=function(_0x35eb74,_0x470218){var _0x4cb505=_[_0x27ea('0x7f')](_0x35eb74[_0x27ea('0x4f')][_0x27ea('0x7c')])?_0x35eb74[_0x27ea('0x4f')]['ids']:[_0x35eb74['body']['ids']];var _0x2f8ac4=_0x35eb74[_0x27ea('0x49')]['id'];return db[_0x27ea('0x31')][_0x27ea('0x4d')]({'where':{'id':_0x2f8ac4}})[_0x27ea('0x2b')](handleEntityNotFound(_0x470218,null))[_0x27ea('0x2b')](function(_0x39be15){if(_0x39be15){var _0x115083=[_0x27ea('0x80'),_0x27ea('0x81'),'Mail','Sms',_0x27ea('0x82'),_0x27ea('0x83'),'Whatsapp'];return db['sequelize'][_0x27ea('0x5a')](function(_0x38be87){var _0x5f5902=_[_0x27ea('0x30')](_0x115083,function(_0x38f262){var _0x3e8f38={'attributes':['id',_0x27ea('0x44')]};if(_0x38f262===_0x27ea('0x80')){_0x3e8f38[_0x27ea('0x84')]={'attributes':[_0x27ea('0x85')]};}return _0x39be15['get'+_0x38f262+_0x27ea('0x7b')](_0x3e8f38)[_0x27ea('0x2b')](function(_0x322a7c){var _0x5eccdb=_[_0x27ea('0x30')](_0x322a7c,function(_0x352b9f){var _0x360c84=_[_0x27ea('0x30')](_0x4cb505,function(_0x22ff9c){var _0x5d0c39={'where':{'UserId':_0x22ff9c,[_0x38f262+_0x27ea('0x86')]:_0x352b9f['id']},'transaction':_0x38be87};if(_0x38f262===_0x27ea('0x80')){_0x5d0c39[_0x27ea('0x1a')]={'penalty':_0x352b9f[_0x27ea('0x87')][_0x27ea('0x85')]};}return db[_0x27ea('0x88')+_0x38f262+'Queue']['findOrCreate'](_0x5d0c39)[_0x27ea('0x2b')](function(){socket['emit'](_0x27ea('0x52')+_0x38f262+_0x27ea('0x89'),{'UserId':_0x22ff9c,[_0x38f262+_0x27ea('0x86')]:_0x352b9f['id']});if(_0x38f262!==_0x27ea('0x80')){return;}return db['User'][_0x27ea('0x46')]({'where':{'id':_0x4cb505,'online':0x1},'attributes':['id',_0x27ea('0x44'),_0x27ea('0x8a'),_0x27ea('0x8b'),_0x27ea('0x8c')],'raw':!![]})[_0x27ea('0x2b')](function(_0x5abcc6){var _0x32f1ef=_[_0x27ea('0x30')](_0x5abcc6,function(_0x2ef6ef){return db[_0x27ea('0x8d')]['upsert']({'membername':_0x2ef6ef[_0x27ea('0x44')],'UserId':_0x2ef6ef['id'],'queue_name':_0x352b9f[_0x27ea('0x44')],'VoiceQueueId':_0x352b9f['id'],'interface':_[_0x27ea('0x8e')](_0x2ef6ef[_0x27ea('0x8c')])?util[_0x27ea('0x8f')]('SIP/%s',_0x2ef6ef[_0x27ea('0x44')]):_0x2ef6ef['interface'],'paused':_0x2ef6ef['voicePause']||![],'penalty':_0x352b9f[_0x27ea('0x87')][_0x27ea('0x85')]},{'transaction':_0x38be87});});return Promise[_0x27ea('0x90')](_0x32f1ef);});});});return Promise['all'](_0x360c84);});return Promise[_0x27ea('0x90')](_0x5eccdb);})[_0x27ea('0x2b')](function(){return db['TeamVoicePrefix'][_0x27ea('0x72')]({'where':{'teamId':_0x2f8ac4}})[_0x27ea('0x2b')](function(_0x309e83){if(_0x309e83){var _0x53b917=_[_0x27ea('0x30')](_0x4cb505,function(_0x4b7a73){db[_0x27ea('0x91')][_0x27ea('0x92')]({'UserId':_0x4b7a73,'VoicePrefixId':_0x309e83['VoicePrefixId']});});return Promise[_0x27ea('0x90')](_0x53b917);}});});});return Promise['all'](_0x5f5902)[_0x27ea('0x2b')](function(){return _0x39be15[_0x27ea('0x7e')](_0x4cb505,{'transaction':_0x38be87})['spread'](function(_0x489ae1){return _0x489ae1;});});});}})[_0x27ea('0x2b')](respondWithResult(_0x470218,null))[_0x27ea('0x58')](handleError(_0x470218,null));};exports['removeAgents']=function(_0x2f1ed7,_0x298330){var _0x4af141=_[_0x27ea('0x7f')](_0x2f1ed7['query'][_0x27ea('0x7c')])?_0x2f1ed7[_0x27ea('0x36')][_0x27ea('0x7c')]:[_0x2f1ed7[_0x27ea('0x36')][_0x27ea('0x7c')]];var _0x337d50=_0x2f1ed7['params']['id'];return db[_0x27ea('0x31')][_0x27ea('0x4d')]({'where':{'id':_0x337d50}})[_0x27ea('0x2b')](handleEntityNotFound(_0x298330,null))[_0x27ea('0x2b')](function(_0x3aa564){if(_0x3aa564){var _0x38ac39=[_0x27ea('0x80'),'Chat','Mail',_0x27ea('0x93'),_0x27ea('0x82'),_0x27ea('0x83'),_0x27ea('0x94')];return db[_0x27ea('0x59')][_0x27ea('0x5a')](function(_0x551afb){var _0x13eee5=_['map'](_0x38ac39,function(_0x1dcc2b){var _0x43aacd={'attributes':['id',_0x27ea('0x44')]};return _0x3aa564[_0x27ea('0x53')+_0x1dcc2b+_0x27ea('0x7b')](_0x43aacd)['then'](function(_0x490d95){var _0x25b105=_['map'](_0x490d95,function(_0x32ee98){return _0x32ee98[_0x27ea('0x95')](_0x4af141,{'transaction':_0x551afb})['then'](function(){var _0x359aba=_[_0x27ea('0x30')](_0x4af141,function(_0x58fff8){socket[_0x27ea('0x96')](_0x27ea('0x52')+_0x1dcc2b+_0x27ea('0x97'),{'UserId':Number(_0x58fff8),[_0x1dcc2b+_0x27ea('0x86')]:_0x32ee98['id']});if(_0x1dcc2b!=='Voice'){return;}return db[_0x27ea('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x32ee98['id'],'UserId':_0x58fff8},'transaction':_0x551afb});});return Promise[_0x27ea('0x90')](_0x359aba);});});return Promise[_0x27ea('0x90')](_0x25b105);});});return Promise[_0x27ea('0x90')](_0x13eee5)[_0x27ea('0x2b')](function(){return _0x3aa564[_0x27ea('0x95')](_0x4af141,{'transaction':_0x551afb});})[_0x27ea('0x2b')](function(){return db[_0x27ea('0x98')][_0x27ea('0x72')]({'where':{'teamId':_0x337d50}})['then'](function(_0x314a6a){if(_0x314a6a){var _0x1cf1ed=_['map'](_0x4af141,function(_0x3f8ab3){db[_0x27ea('0x91')][_0x27ea('0x62')]({'where':{'UserId':_0x3f8ab3,'VoicePrefixId':_0x314a6a['VoicePrefixId']}});});return Promise[_0x27ea('0x90')](_0x1cf1ed);}});});});}})['then'](respondWithStatusCode(_0x298330,null))['catch'](handleError(_0x298330,null));};exports['getAgents']=function(_0x4184c0,_0x25d609,_0x192441){var _0x3794df={};var _0x58edb1={};var _0x1761a8;var _0x5f23a0;return db[_0x27ea('0x31')]['findOne']({'where':{'id':_0x4184c0[_0x27ea('0x49')]['id']}})[_0x27ea('0x2b')](handleEntityNotFound(_0x25d609,null))[_0x27ea('0x2b')](function(_0x23ec79){if(_0x23ec79){_0x1761a8=_0x23ec79;_0x58edb1['model']=_[_0x27ea('0x37')](db[_0x27ea('0x88')][_0x27ea('0x4a')]);_0x58edb1['query']=_[_0x27ea('0x37')](_0x4184c0['query']);_0x58edb1['filters']=_[_0x27ea('0x39')](_0x58edb1[_0x27ea('0x35')],_0x58edb1[_0x27ea('0x36')]);_0x3794df[_0x27ea('0x3a')]=_[_0x27ea('0x39')](_0x58edb1[_0x27ea('0x35')],qs[_0x27ea('0x3b')](_0x4184c0[_0x27ea('0x36')][_0x27ea('0x3b')]));_0x3794df['attributes']=_0x3794df['attributes'][_0x27ea('0x3c')]?_0x3794df['attributes']:_0x58edb1[_0x27ea('0x35')];_0x3794df['order']=qs[_0x27ea('0x3e')](_0x4184c0[_0x27ea('0x36')]['sort']);_0x3794df[_0x27ea('0x3f')]=qs[_0x27ea('0x38')](_[_0x27ea('0x40')](_0x4184c0[_0x27ea('0x36')],_0x58edb1[_0x27ea('0x38')]));if(_0x4184c0[_0x27ea('0x36')][_0x27ea('0x41')]){_0x3794df[_0x27ea('0x3f')]=_[_0x27ea('0x42')](_0x3794df[_0x27ea('0x3f')],{'$or':_[_0x27ea('0x30')](_0x3794df[_0x27ea('0x3a')],function(_0x33bbed){var _0x4f8860={};_0x4f8860[_0x33bbed]={'$like':'%'+_0x4184c0[_0x27ea('0x36')][_0x27ea('0x41')]+'%'};return _0x4f8860;})});}_0x3794df=_[_0x27ea('0x42')]({},_0x3794df,_0x4184c0[_0x27ea('0x4c')]);return _0x1761a8[_0x27ea('0x99')](_0x3794df);}})[_0x27ea('0x2b')](function(_0x31f7e5){if(_0x31f7e5){_0x5f23a0=_0x31f7e5[_0x27ea('0x3c')];if(!_0x4184c0[_0x27ea('0x36')]['hasOwnProperty'](_0x27ea('0x9a'))){_0x3794df[_0x27ea('0x24')]=qs[_0x27ea('0x24')](_0x4184c0[_0x27ea('0x36')][_0x27ea('0x24')]);_0x3794df[_0x27ea('0x22')]=qs[_0x27ea('0x22')](_0x4184c0['query']['offset']);}return _0x1761a8[_0x27ea('0x99')](_0x3794df);}})[_0x27ea('0x2b')](function(_0x1939af){if(_0x1939af){return _0x1939af?{'count':_0x5f23a0,'rows':_0x1939af}:null;}})[_0x27ea('0x2b')](respondWithResult(_0x25d609,null))['catch'](handleError(_0x25d609,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0049d1e..355aac9 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 _0x2a3b=['emit','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove'];(function(_0x5a94af,_0x548782){var _0x31ee8a=function(_0x581640){while(--_0x581640){_0x5a94af['push'](_0x5a94af['shift']());}};_0x31ee8a(++_0x548782);}(_0x2a3b,0x1ed));var _0xb2a3=function(_0x4dbf62,_0x496198){_0x4dbf62=_0x4dbf62-0x0;var _0x34102b=_0x2a3b[_0x4dbf62];return _0x34102b;};'use strict';var EventEmitter=require(_0xb2a3('0x0'));var Team=require(_0xb2a3('0x1'))['db'][_0xb2a3('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb2a3('0x3')](0x0);var events={'afterCreate':_0xb2a3('0x4'),'afterUpdate':_0xb2a3('0x5'),'afterDestroy':_0xb2a3('0x6')};function emitEvent(_0x3254f9){return function(_0x3466bf,_0x2d76f9,_0x99cadb){TeamEvents[_0xb2a3('0x7')](_0x3254f9+':'+_0x3466bf['id'],_0x3466bf);TeamEvents[_0xb2a3('0x7')](_0x3254f9,_0x3466bf);_0x99cadb(null);};}for(var e in events){if(events[_0xb2a3('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xb2a3('0x9')]=TeamEvents; \ No newline at end of file +var _0x9bb4=['emit','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove'];(function(_0x24c3fd,_0x3cafc0){var _0x53828e=function(_0x11fb62){while(--_0x11fb62){_0x24c3fd['push'](_0x24c3fd['shift']());}};_0x53828e(++_0x3cafc0);}(_0x9bb4,0xd5));var _0x49bb=function(_0x4e1301,_0x31d640){_0x4e1301=_0x4e1301-0x0;var _0x161d46=_0x9bb4[_0x4e1301];return _0x161d46;};'use strict';var EventEmitter=require(_0x49bb('0x0'));var Team=require(_0x49bb('0x1'))['db'][_0x49bb('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x49bb('0x3')](0x0);var events={'afterCreate':_0x49bb('0x4'),'afterUpdate':_0x49bb('0x5'),'afterDestroy':_0x49bb('0x6')};function emitEvent(_0xa01a73){return function(_0x45317c,_0x5c50f8,_0x1aa8db){TeamEvents[_0x49bb('0x7')](_0xa01a73+':'+_0x45317c['id'],_0x45317c);TeamEvents[_0x49bb('0x7')](_0xa01a73,_0x45317c);_0x1aa8db(null);};}for(var e in events){if(events[_0x49bb('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x49bb('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8050919..a604c31 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 _0x3362=['map','setDataValue','channel','exports','define','Team','teams','Chat','Openchannel','Whatsapp','then','all','lodash','./team.attributes','get'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x3362,0xcf));var _0x2336=function(_0x47617c,_0x160a60){_0x47617c=_0x47617c-0x0;var _0x57fd3d=_0x3362[_0x47617c];return _0x57fd3d;};'use strict';var _=require(_0x2336('0x0'));var attributes=require(_0x2336('0x1'));function getQueuesByChannel(_0x779491,_0x431968){var _0x935825=_0x2336('0x2')+_0x431968+'Queues';return _0x779491[_0x935825]()['then'](function(_0x336801){return _[_0x2336('0x3')](_0x336801,function(_0x3afda4){_0x3afda4[_0x2336('0x4')](_0x2336('0x5'),_0x431968);return _0x3afda4;});})['catch'](function(_0x2c1f0a){throw _0x2c1f0a;});}module[_0x2336('0x6')]=function(_0xa8b3b7){return _0xa8b3b7[_0x2336('0x7')](_0x2336('0x8'),attributes,{'tableName':_0x2336('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5d6a34=this;var _0xa9ab46=[_0x2336('0xa'),'Fax','Mail',_0x2336('0xb'),'Sms','Voice',_0x2336('0xc')];return Promise['resolve']()[_0x2336('0xd')](function(){var _0xfd8f7b=_[_0x2336('0x3')](_0xa9ab46,function(_0x3d4a28){return getQueuesByChannel(_0x5d6a34,_0x3d4a28);});return Promise[_0x2336('0xe')](_0xfd8f7b);})['catch'](function(_0x4d4f25){throw _0x4d4f25;});}}});}; \ No newline at end of file +var _0xed45=['Sms','Voice','lodash','get','setDataValue','catch','exports','define','Team','teams','Chat','Fax','Openchannel'];(function(_0x15af3a,_0x533393){var _0x346d4=function(_0x49e954){while(--_0x49e954){_0x15af3a['push'](_0x15af3a['shift']());}};_0x346d4(++_0x533393);}(_0xed45,0xf9));var _0x5ed4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xed45[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x5ed4('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x1f75a2,_0x2758ed){var _0x17372c=_0x5ed4('0x1')+_0x2758ed+'Queues';return _0x1f75a2[_0x17372c]()['then'](function(_0x301a1c){return _['map'](_0x301a1c,function(_0x3fb74e){_0x3fb74e[_0x5ed4('0x2')]('channel',_0x2758ed);return _0x3fb74e;});})[_0x5ed4('0x3')](function(_0x579832){throw _0x579832;});}module[_0x5ed4('0x4')]=function(_0x144d9f){return _0x144d9f[_0x5ed4('0x5')](_0x5ed4('0x6'),attributes,{'tableName':_0x5ed4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x173dde=this;var _0x17c9ac=[_0x5ed4('0x8'),_0x5ed4('0x9'),'Mail',_0x5ed4('0xa'),_0x5ed4('0xb'),_0x5ed4('0xc'),'Whatsapp'];return Promise['resolve']()['then'](function(){var _0x35f0fa=_['map'](_0x17c9ac,function(_0x3a6f43){return getQueuesByChannel(_0x173dde,_0x3a6f43);});return Promise['all'](_0x35f0fa);})[_0x5ed4('0x3')](function(_0x59bc01){throw _0x59bc01;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 3a86477..16716f2 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 _0x8d3a=['../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x8d3a,0x155));var _0xa8d3=function(_0x58d694,_0x3a19c0){_0x58d694=_0x58d694-0x0;var _0x3222b8=_0x8d3a[_0x58d694];return _0x3222b8;};'use strict';var _=require('lodash');var util=require(_0xa8d3('0x0'));var moment=require(_0xa8d3('0x1'));var BPromise=require(_0xa8d3('0x2'));var rs=require(_0xa8d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8d3('0x5'));var config=require(_0xa8d3('0x6'));var jayson=require(_0xa8d3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa8d3('0x8')]=_[_0xa8d3('0x9')](config[_0xa8d3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa8d3('0xa'))(new Redis(config[_0xa8d3('0x8')]));require(_0xa8d3('0xb'))[_0xa8d3('0xc')](socket);function respondWithRpcPromise(_0x331431,_0x41f8d4,_0x3b26e8){return new BPromise(function(_0xe5383c,_0x19f8e2){return client[_0xa8d3('0xd')](_0x331431,_0x3b26e8)[_0xa8d3('0xe')](function(_0x1b7ef5){logger[_0xa8d3('0xf')](_0xa8d3('0x10'),_0x41f8d4,_0xa8d3('0x11'));logger[_0xa8d3('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x41f8d4,_0xa8d3('0x11'),JSON[_0xa8d3('0x13')](_0x1b7ef5));if(_0x1b7ef5[_0xa8d3('0x14')]){if(_0x1b7ef5['error'][_0xa8d3('0x15')]===0x1f4){logger[_0xa8d3('0x14')](_0xa8d3('0x10'),_0x41f8d4,_0x1b7ef5[_0xa8d3('0x14')][_0xa8d3('0x16')]);return _0x19f8e2(_0x1b7ef5['error'][_0xa8d3('0x16')]);}logger['error'](_0xa8d3('0x10'),_0x41f8d4,_0x1b7ef5[_0xa8d3('0x14')][_0xa8d3('0x16')]);return _0xe5383c(_0x1b7ef5[_0xa8d3('0x14')][_0xa8d3('0x16')]);}else{logger[_0xa8d3('0xf')](_0xa8d3('0x10'),_0x41f8d4,_0xa8d3('0x11'));_0xe5383c(_0x1b7ef5['result'][_0xa8d3('0x16')]);}})['catch'](function(_0x580de8){logger['error'](_0xa8d3('0x10'),_0x41f8d4,_0x580de8);_0x19f8e2(_0x580de8);});});} \ No newline at end of file +var _0x3229=['debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x3bb058,_0x41945b){var _0x2e0d96=function(_0x4a54da){while(--_0x4a54da){_0x3bb058['push'](_0x3bb058['shift']());}};_0x2e0d96(++_0x41945b);}(_0x3229,0x104));var _0x9322=function(_0x5913a9,_0x4b95fb){_0x5913a9=_0x5913a9-0x0;var _0x530679=_0x3229[_0x5913a9];return _0x530679;};'use strict';var _=require(_0x9322('0x0'));var util=require(_0x9322('0x1'));var moment=require(_0x9322('0x2'));var BPromise=require('bluebird');var rs=require(_0x9322('0x3'));var fs=require('fs');var Redis=require(_0x9322('0x4'));var db=require(_0x9322('0x5'))['db'];var utils=require(_0x9322('0x6'));var logger=require(_0x9322('0x7'))(_0x9322('0x8'));var config=require(_0x9322('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9322('0xa')]({'port':0x232a});config['redis']=_[_0x9322('0xb')](config[_0x9322('0xc')],{'host':_0x9322('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9322('0xe'))[_0x9322('0xf')](socket);function respondWithRpcPromise(_0x1e144d,_0x318818,_0x511da0){return new BPromise(function(_0x120ea0,_0xd2031c){return client[_0x9322('0x10')](_0x1e144d,_0x511da0)['then'](function(_0x49ddbe){logger[_0x9322('0x11')](_0x9322('0x12'),_0x318818,_0x9322('0x13'));logger[_0x9322('0x14')](_0x9322('0x15'),_0x318818,_0x9322('0x13'),JSON[_0x9322('0x16')](_0x49ddbe));if(_0x49ddbe[_0x9322('0x17')]){if(_0x49ddbe[_0x9322('0x17')][_0x9322('0x18')]===0x1f4){logger[_0x9322('0x17')]('Team,\x20%s,\x20%s',_0x318818,_0x49ddbe['error']['message']);return _0xd2031c(_0x49ddbe[_0x9322('0x17')][_0x9322('0x19')]);}logger['error'](_0x9322('0x12'),_0x318818,_0x49ddbe['error']['message']);return _0x120ea0(_0x49ddbe['error'][_0x9322('0x19')]);}else{logger['info'](_0x9322('0x12'),_0x318818,_0x9322('0x13'));_0x120ea0(_0x49ddbe[_0x9322('0x1a')][_0x9322('0x19')]);}})[_0x9322('0x1b')](function(_0x1e8080){logger[_0x9322('0x17')](_0x9322('0x12'),_0x318818,_0x1e8080);_0xd2031c(_0x1e8080);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5274be9..05860ee 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 _0x1be1=['remove','update','emit','removeListener','register','team:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1be1,0x192));var _0x11be=function(_0xc73c3d,_0x1dfcfb){_0xc73c3d=_0xc73c3d-0x0;var _0x32bfb6=_0x1be1[_0xc73c3d];return _0x32bfb6;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x11be('0x0'),_0x11be('0x1')];function createListener(_0x5527b3,_0x175deb){return function(_0xd002ca){_0x175deb[_0x11be('0x2')](_0x5527b3,_0xd002ca);};}function removeListener(_0x318d41,_0x504d3a){return function(){TeamEvents[_0x11be('0x3')](_0x318d41,_0x504d3a);};}exports[_0x11be('0x4')]=function(_0x11f793){for(var _0x479719=0x0,_0xfe8c62=events['length'];_0x479719<_0xfe8c62;_0x479719++){var _0x18f661=events[_0x479719];var _0x11fc15=createListener(_0x11be('0x5')+_0x18f661,_0x11f793);TeamEvents['on'](_0x18f661,_0x11fc15);}}; \ No newline at end of file +var _0xbaf3=['length','team:','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x269061,_0x17d182){var _0x28eb80=function(_0x537e0a){while(--_0x537e0a){_0x269061['push'](_0x269061['shift']());}};_0x28eb80(++_0x17d182);}(_0xbaf3,0x1df));var _0x3baf=function(_0x3a55a7,_0x1c2b0a){_0x3a55a7=_0x3a55a7-0x0;var _0x5caec0=_0xbaf3[_0x3a55a7];return _0x5caec0;};'use strict';var TeamEvents=require(_0x3baf('0x0'));var events=[_0x3baf('0x1'),_0x3baf('0x2'),_0x3baf('0x3')];function createListener(_0x4e5c0a,_0x23c030){return function(_0x2168db){_0x23c030[_0x3baf('0x4')](_0x4e5c0a,_0x2168db);};}function removeListener(_0x59ffff,_0x13d0f8){return function(){TeamEvents[_0x3baf('0x5')](_0x59ffff,_0x13d0f8);};}exports[_0x3baf('0x6')]=function(_0x38bc65){for(var _0xdfda72=0x0,_0x518d8d=events[_0x3baf('0x7')];_0xdfda72<_0x518d8d;_0xdfda72++){var _0x514868=events[_0xdfda72];var _0x430daf=createListener(_0x3baf('0x8')+_0x514868,_0x38bc65);TeamEvents['on'](_0x514868,_0x430daf);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 25de0a0..3b88a7c 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 _0xfb09=['INTEGER','sequelize'];(function(_0x3cc6d4,_0x40fc15){var _0x938239=function(_0x3dcbbe){while(--_0x3dcbbe){_0x3cc6d4['push'](_0x3cc6d4['shift']());}};_0x938239(++_0x40fc15);}(_0xfb09,0x97));var _0x9fb0=function(_0x5bf797,_0x26115c){_0x5bf797=_0x5bf797-0x0;var _0x3832dd=_0xfb09[_0x5bf797];return _0x3832dd;};'use strict';var Sequelize=require(_0x9fb0('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x9fb0('0x1')]}}; \ No newline at end of file +var _0x235a=['sequelize','exports','INTEGER'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x235a,0x1ef));var _0xa235=function(_0x3af15c,_0x13e517){_0x3af15c=_0x3af15c-0x0;var _0x5956e8=_0x235a[_0x3af15c];return _0x5956e8;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'TeamId':{'type':Sequelize[_0xa235('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 7173333..f9cd46c 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 _0x63a5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','TeamVoicePrefix','lodash','util'];(function(_0x3ca44a,_0x4bc76d){var _0x362653=function(_0x4af955){while(--_0x4af955){_0x3ca44a['push'](_0x3ca44a['shift']());}};_0x362653(++_0x4bc76d);}(_0x63a5,0x18e));var _0x563a=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x63a5[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var logger=require(_0x563a('0x2'))('api');var moment=require(_0x563a('0x3'));var BPromise=require('bluebird');var rp=require(_0x563a('0x4'));var fs=require('fs');var path=require(_0x563a('0x5'));var rimraf=require(_0x563a('0x6'));var config=require(_0x563a('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x1fdcb0,_0x5a6458){return _0x1fdcb0[_0x563a('0x8')](_0x563a('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e8c=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird'];(function(_0x28dfdd,_0x3dde71){var _0x22fcf5=function(_0x842a5a){while(--_0x842a5a){_0x28dfdd['push'](_0x28dfdd['shift']());}};_0x22fcf5(++_0x3dde71);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x1e8c[_0x301148];return _0x42ce24;};'use strict';var _=require('lodash');var util=require(_0xc1e8('0x0'));var logger=require(_0xc1e8('0x1'))(_0xc1e8('0x2'));var moment=require(_0xc1e8('0x3'));var BPromise=require(_0xc1e8('0x4'));var rp=require(_0xc1e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1e8('0x6'));var config=require(_0xc1e8('0x7'));var attributes=require(_0xc1e8('0x8'));module[_0xc1e8('0x9')]=function(_0x2547e3,_0x18613e){return _0x2547e3['define'](_0xc1e8('0xa'),attributes,{'tableName':_0xc1e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1e5dfe3..1d58795 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3732e1,_0x304dc1){var _0x51e120=function(_0x33c129){while(--_0x33c129){_0x3732e1['push'](_0x3732e1['shift']());}};_0x51e120(++_0x304dc1);}(_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(_0x180833,_0x2cdcaf){var _0x119a72=function(_0x3f4b8e){while(--_0x3f4b8e){_0x180833['push'](_0x180833['shift']());}};_0x119a72(++_0x2cdcaf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 aa662f8..9d69a05 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 _0xd7c7=['exports','INTEGER'];(function(_0x1a199d,_0x4f9025){var _0x4c59c3=function(_0xe84ab2){while(--_0xe84ab2){_0x1a199d['push'](_0x1a199d['shift']());}};_0x4c59c3(++_0x4f9025);}(_0xd7c7,0xe8));var _0x7d7c=function(_0x5559bf,_0x531262){_0x5559bf=_0x5559bf-0x0;var _0x41e17a=_0xd7c7[_0x5559bf];return _0x41e17a;};'use strict';var Sequelize=require('sequelize');module[_0x7d7c('0x0')]={'penalty':{'type':Sequelize[_0x7d7c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x59ec=['sequelize','exports'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x59ec,0x102));var _0xc59e=function(_0x1d358b,_0x73b8a5){_0x1d358b=_0x1d358b-0x0;var _0x542674=_0x59ec[_0x1d358b];return _0x542674;};'use strict';var Sequelize=require(_0xc59e('0x0'));module[_0xc59e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 c4d052f..63233da 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 _0xc999=['./teamVoiceQueue.attributes','define','team_has_voice_queues','util','../../config/logger','api','rimraf'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xc999,0x176));var _0x9c99=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xc999[_0x4695ba];return _0x524b7d;};'use strict';var _=require('lodash');var util=require(_0x9c99('0x0'));var logger=require(_0x9c99('0x1'))(_0x9c99('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c99('0x3'));var config=require('../../config/environment');var attributes=require(_0x9c99('0x4'));module['exports']=function(_0x35f5f4,_0x1ce762){return _0x35f5f4[_0x9c99('0x5')]('TeamVoiceQueue',attributes,{'tableName':_0x9c99('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd382=['request-promise','path','rimraf','../../config/environment','define','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x51dc59,_0x5cbc30){_0x51dc59=_0x51dc59-0x0;var _0x4450ed=_0xd382[_0x51dc59];return _0x4450ed;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))(_0x2d38('0x3'));var moment=require(_0x2d38('0x4'));var BPromise=require(_0x2d38('0x5'));var rp=require(_0x2d38('0x6'));var fs=require('fs');var path=require(_0x2d38('0x7'));var rimraf=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x5a8219,_0x30106c){return _0x5a8219[_0x2d38('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x2d38('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 51a62c4..ede7dc5 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 _0xd73f=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0xc16c45,_0xe50e84){var _0x284d0e=function(_0x5357cd){while(--_0x5357cd){_0xc16c45['push'](_0xc16c45['shift']());}};_0x284d0e(++_0xe50e84);}(_0xd73f,0x90));var _0xfd73=function(_0x32f9cd,_0x4ffb36){_0x32f9cd=_0x32f9cd-0x0;var _0xe80ced=_0xd73f[_0x32f9cd];return _0xe80ced;};'use strict';var _=require('lodash');var util=require(_0xfd73('0x0'));var moment=require(_0xfd73('0x1'));var BPromise=require(_0xfd73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd73('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd73('0x4'));var logger=require(_0xfd73('0x5'))(_0xfd73('0x6'));var config=require(_0xfd73('0x7'));var jayson=require(_0xfd73('0x8'));var client=jayson[_0xfd73('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b000b,_0x540c76,_0x2edf9e){return new BPromise(function(_0xf40b11,_0x2c8cc4){return client[_0xfd73('0xa')](_0x2b000b,_0x2edf9e)[_0xfd73('0xb')](function(_0x5162a5){logger[_0xfd73('0xc')](_0xfd73('0xd'),_0x540c76,_0xfd73('0xe'));logger['debug'](_0xfd73('0xf'),_0x540c76,'request\x20sent',JSON[_0xfd73('0x10')](_0x5162a5));if(_0x5162a5[_0xfd73('0x11')]){if(_0x5162a5[_0xfd73('0x11')][_0xfd73('0x12')]===0x1f4){logger[_0xfd73('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x540c76,_0x5162a5[_0xfd73('0x11')]['message']);return _0x2c8cc4(_0x5162a5[_0xfd73('0x11')][_0xfd73('0x13')]);}logger[_0xfd73('0x11')](_0xfd73('0xd'),_0x540c76,_0x5162a5[_0xfd73('0x11')][_0xfd73('0x13')]);return _0xf40b11(_0x5162a5[_0xfd73('0x11')][_0xfd73('0x13')]);}else{logger['info'](_0xfd73('0xd'),_0x540c76,_0xfd73('0xe'));_0xf40b11(_0x5162a5[_0xfd73('0x14')][_0xfd73('0x13')]);}})['catch'](function(_0x23032){logger['error'](_0xfd73('0xd'),_0x540c76,_0x23032);_0x2c8cc4(_0x23032);});});} \ No newline at end of file +var _0x6944=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x385191,_0xdcaaf3){var _0x5dfaa5=function(_0x473823){while(--_0x473823){_0x385191['push'](_0x385191['shift']());}};_0x5dfaa5(++_0xdcaaf3);}(_0x6944,0xe6));var _0x4694=function(_0xa0a1ab,_0x6d0eb7){_0xa0a1ab=_0xa0a1ab-0x0;var _0x3d57aa=_0x6944[_0xa0a1ab];return _0x3d57aa;};'use strict';var _=require(_0x4694('0x0'));var util=require(_0x4694('0x1'));var moment=require(_0x4694('0x2'));var BPromise=require(_0x4694('0x3'));var rs=require(_0x4694('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4694('0x5'));var logger=require('../../config/logger')(_0x4694('0x6'));var config=require(_0x4694('0x7'));var jayson=require(_0x4694('0x8'));var client=jayson[_0x4694('0x9')][_0x4694('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364038,_0x2e05a1,_0x56ae53){return new BPromise(function(_0x4c6703,_0x33cba1){return client[_0x4694('0xb')](_0x364038,_0x56ae53)[_0x4694('0xc')](function(_0x5d2bd5){logger[_0x4694('0xd')](_0x4694('0xe'),_0x2e05a1,_0x4694('0xf'));logger[_0x4694('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2e05a1,_0x4694('0xf'),JSON[_0x4694('0x11')](_0x5d2bd5));if(_0x5d2bd5[_0x4694('0x12')]){if(_0x5d2bd5[_0x4694('0x12')]['code']===0x1f4){logger[_0x4694('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2e05a1,_0x5d2bd5[_0x4694('0x12')]['message']);return _0x33cba1(_0x5d2bd5[_0x4694('0x12')]['message']);}logger[_0x4694('0x12')](_0x4694('0xe'),_0x2e05a1,_0x5d2bd5['error'][_0x4694('0x13')]);return _0x4c6703(_0x5d2bd5[_0x4694('0x12')][_0x4694('0x13')]);}else{logger[_0x4694('0xd')](_0x4694('0xe'),_0x2e05a1,_0x4694('0xf'));_0x4c6703(_0x5d2bd5[_0x4694('0x14')][_0x4694('0x13')]);}})[_0x4694('0x15')](function(_0x208ed8){logger[_0x4694('0x12')](_0x4694('0xe'),_0x2e05a1,_0x208ed8);_0x33cba1(_0x208ed8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 832de5d..5bce28f 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 _0xb7ae=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x3be82b,_0x3ef4fb){var _0x293c0e=function(_0x6af388){while(--_0x6af388){_0x3be82b['push'](_0x3be82b['shift']());}};_0x293c0e(++_0x3ef4fb);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x35f280,_0x5acc4a){_0x35f280=_0x35f280-0x0;var _0x35d555=_0xb7ae[_0x35f280];return _0x35d555;};'use strict';var multer=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var path=require(_0xeb7a('0x2'));var timeout=require(_0xeb7a('0x3'));var express=require(_0xeb7a('0x4'));var router=express['Router']();var fs_extra=require(_0xeb7a('0x5'));var auth=require(_0xeb7a('0x6'));var interaction=require(_0xeb7a('0x7'));var config=require('../../config/environment');var controller=require(_0xeb7a('0x8'));router[_0xeb7a('0x9')]('/',auth[_0xeb7a('0xa')](),controller[_0xeb7a('0xb')]);router[_0xeb7a('0x9')]('/:id',auth[_0xeb7a('0xa')](),controller[_0xeb7a('0xc')]);router[_0xeb7a('0xd')]('/',auth['isAuthenticated'](),controller[_0xeb7a('0xe')]);router[_0xeb7a('0xf')](_0xeb7a('0x10'),auth[_0xeb7a('0xa')](),controller[_0xeb7a('0x11')]);router[_0xeb7a('0x12')](_0xeb7a('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb7a('0x13')]=router; \ No newline at end of file +var _0x2015=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4d729f,_0x52bf8b){var _0x5ce12a=function(_0x3ae6a6){while(--_0x3ae6a6){_0x4d729f['push'](_0x4d729f['shift']());}};_0x5ce12a(++_0x52bf8b);}(_0x2015,0x193));var _0x5201=function(_0x4a7a0d,_0x170639){_0x4a7a0d=_0x4a7a0d-0x0;var _0x273b1b=_0x2015[_0x4a7a0d];return _0x273b1b;};'use strict';var multer=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var path=require(_0x5201('0x2'));var timeout=require(_0x5201('0x3'));var express=require(_0x5201('0x4'));var router=express[_0x5201('0x5')]();var fs_extra=require(_0x5201('0x6'));var auth=require(_0x5201('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5201('0x8'));var controller=require(_0x5201('0x9'));router[_0x5201('0xa')]('/',auth[_0x5201('0xb')](),controller[_0x5201('0xc')]);router[_0x5201('0xa')](_0x5201('0xd'),auth[_0x5201('0xb')](),controller[_0x5201('0xe')]);router[_0x5201('0xf')]('/',auth['isAuthenticated'](),controller[_0x5201('0x10')]);router[_0x5201('0x11')]('/:id',auth[_0x5201('0xb')](),controller[_0x5201('0x12')]);router[_0x5201('0x13')]('/:id',auth[_0x5201('0xb')](),controller[_0x5201('0x14')]);module[_0x5201('0x15')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 51cc320..7d8bd3b 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 _0x8d0d=['STRING','TEXT','sequelize','exports'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x8d0d,0x122));var _0xd8d0=function(_0x5acdfa,_0x29f83d){_0x5acdfa=_0x5acdfa-0x0;var _0x5a03fd=_0x8d0d[_0x5acdfa];return _0x5a03fd;};'use strict';var Sequelize=require(_0xd8d0('0x0'));module[_0xd8d0('0x1')]={'name':{'type':Sequelize[_0xd8d0('0x2')]},'description':{'type':Sequelize[_0xd8d0('0x2')]},'html':{'type':Sequelize[_0xd8d0('0x3')]}}; \ No newline at end of file +var _0x8230=['sequelize','STRING','TEXT'];(function(_0xecdab5,_0x284b5c){var _0xa98503=function(_0x50896d){while(--_0x50896d){_0xecdab5['push'](_0xecdab5['shift']());}};_0xa98503(++_0x284b5c);}(_0x8230,0xcf));var _0x0823=function(_0x475070,_0x22c956){_0x475070=_0x475070-0x0;var _0x25e006=_0x8230[_0x475070];return _0x25e006;};'use strict';var Sequelize=require(_0x0823('0x0'));module['exports']={'name':{'type':Sequelize[_0x0823('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x0823('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 89614f7..2fd78cd 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 _0x2632=['rows','show','params','find','catch','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','get','Templates','UserProfileResource','end','error','stack','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','type','VIRTUAL','then','includeAll','include','findAll'];(function(_0x4a1835,_0xe4a237){var _0x203f1b=function(_0x52886e){while(--_0x52886e){_0x4a1835['push'](_0x4a1835['shift']());}};_0x203f1b(++_0xe4a237);}(_0x2632,0x182));var _0x2263=function(_0x2534dc,_0x387cc6){_0x2534dc=_0x2534dc-0x0;var _0x152cd3=_0x2632[_0x2534dc];return _0x152cd3;};'use strict';var emlformat=require(_0x2263('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2263('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2263('0x2'));var util=require(_0x2263('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x2263('0x4'));var ejs=require(_0x2263('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2263('0x6'));var squel=require(_0x2263('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2263('0x8'));var Papa=require(_0x2263('0x9'));var Redis=require(_0x2263('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x2263('0xb'));var as=require(_0x2263('0xc'));var hardwareService=require(_0x2263('0xd'));var logger=require('../../config/logger')(_0x2263('0xe'));var utils=require(_0x2263('0xf'));var config=require(_0x2263('0x10'));var licenseUtil=require(_0x2263('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42c06f,_0x16efdf){_0x16efdf=_0x16efdf||0xcc;return function(_0x238c71){if(_0x238c71){return _0x42c06f[_0x2263('0x12')](_0x16efdf);}return _0x42c06f[_0x2263('0x13')](_0x16efdf)['end']();};}function respondWithResult(_0x13ca3c,_0x560a32){_0x560a32=_0x560a32||0xc8;return function(_0x392dd9){if(_0x392dd9){return _0x13ca3c['status'](_0x560a32)['json'](_0x392dd9);}};}function respondWithFilteredResult(_0x55e83c,_0x41e4bb){return function(_0x25d14a){if(_0x25d14a){var _0x39a0f8=typeof _0x41e4bb[_0x2263('0x14')]==='undefined'&&typeof _0x41e4bb['limit']===_0x2263('0x15');var _0x110e34=_0x25d14a[_0x2263('0x16')];var _0x3586e5=_0x39a0f8?0x0:_0x41e4bb[_0x2263('0x14')];var _0x4c0de7=_0x39a0f8?_0x25d14a[_0x2263('0x16')]:_0x41e4bb['offset']+_0x41e4bb[_0x2263('0x17')];var _0x156c97;if(_0x4c0de7>=_0x110e34){_0x4c0de7=_0x110e34;_0x156c97=0xc8;}else{_0x156c97=0xce;}_0x55e83c[_0x2263('0x13')](_0x156c97);return _0x55e83c[_0x2263('0x18')]('Content-Range',_0x3586e5+'-'+_0x4c0de7+'/'+_0x110e34)[_0x2263('0x19')](_0x25d14a);}return null;};}function patchUpdates(_0x3e5e98){return function(_0x3ceca5){try{jsonpatch[_0x2263('0x1a')](_0x3ceca5,_0x3e5e98,!![]);}catch(_0x19ee93){return BPromise[_0x2263('0x1b')](_0x19ee93);}return _0x3ceca5[_0x2263('0x1c')]();};}function saveUpdates(_0x4d5f18,_0x333ad5){return function(_0x1f5d88){if(_0x1f5d88){return _0x1f5d88[_0x2263('0x1d')](_0x4d5f18)['then'](function(_0x5530a1){return _0x5530a1;});}return null;};}function removeEntity(_0x80bf41,_0x21a888){return function(_0x4ea912){if(_0x4ea912){return _0x4ea912[_0x2263('0x1e')]()['then'](function(){var _0x1a58a7=_0x4ea912[_0x2263('0x1f')]({'plain':!![]});var _0x4c61f0=_0x2263('0x20');return db[_0x2263('0x21')]['destroy']({'where':{'type':_0x4c61f0,'resourceId':_0x1a58a7['id']}})['then'](function(){return _0x4ea912;});})['then'](function(){_0x80bf41['status'](0xcc)[_0x2263('0x22')]();});}};}function handleEntityNotFound(_0xdf8ed6,_0x279993){return function(_0x582ce5){if(!_0x582ce5){_0xdf8ed6[_0x2263('0x12')](0x194);}return _0x582ce5;};}function handleError(_0x556e41,_0x36859b){_0x36859b=_0x36859b||0x1f4;return function(_0x400bd8){logger[_0x2263('0x23')](_0x400bd8[_0x2263('0x24')]);if(_0x400bd8[_0x2263('0x25')]){delete _0x400bd8[_0x2263('0x25')];}_0x556e41['status'](_0x36859b)[_0x2263('0x26')](_0x400bd8);};}exports[_0x2263('0x27')]=function(_0x45d2ba,_0x2cb34f){var _0x5c3003={},_0x96bd58={},_0x662b2f={'count':0x0,'rows':[]};var _0x332e3c=_[_0x2263('0x28')](db[_0x2263('0x29')][_0x2263('0x2a')],function(_0x45e244){return{'name':_0x45e244[_0x2263('0x2b')],'type':_0x45e244['type'][_0x2263('0x2c')]};});_0x96bd58[_0x2263('0x2d')]=_['map'](_0x332e3c,_0x2263('0x25'));_0x96bd58[_0x2263('0x2e')]=_[_0x2263('0x2f')](_0x45d2ba[_0x2263('0x2e')]);_0x96bd58[_0x2263('0x30')]=_[_0x2263('0x31')](_0x96bd58[_0x2263('0x2d')],_0x96bd58[_0x2263('0x2e')]);_0x5c3003[_0x2263('0x32')]=_[_0x2263('0x31')](_0x96bd58['model'],qs[_0x2263('0x33')](_0x45d2ba[_0x2263('0x2e')][_0x2263('0x33')]));_0x5c3003[_0x2263('0x32')]=_0x5c3003[_0x2263('0x32')][_0x2263('0x34')]?_0x5c3003[_0x2263('0x32')]:_0x96bd58[_0x2263('0x2d')];if(!_0x45d2ba[_0x2263('0x2e')][_0x2263('0x35')]('nolimit')){_0x5c3003['limit']=qs['limit'](_0x45d2ba[_0x2263('0x2e')][_0x2263('0x17')]);_0x5c3003[_0x2263('0x14')]=qs[_0x2263('0x14')](_0x45d2ba[_0x2263('0x2e')][_0x2263('0x14')]);}_0x5c3003['order']=qs[_0x2263('0x36')](_0x45d2ba['query'][_0x2263('0x36')]);_0x5c3003['where']=qs[_0x2263('0x30')](_['pick'](_0x45d2ba[_0x2263('0x2e')],_0x96bd58['filters']),_0x332e3c);if(_0x45d2ba[_0x2263('0x2e')][_0x2263('0x37')]){_0x5c3003[_0x2263('0x38')]=_[_0x2263('0x39')](_0x5c3003[_0x2263('0x38')],{'$or':_[_0x2263('0x28')](_0x332e3c,function(_0x45df4d){if(_0x45df4d[_0x2263('0x3a')]!==_0x2263('0x3b')){var _0x433300={};_0x433300[_0x45df4d['name']]={'$like':'%'+_0x45d2ba[_0x2263('0x2e')][_0x2263('0x37')]+'%'};return _0x433300;}})});}_0x5c3003=_['merge']({},_0x5c3003,_0x45d2ba['options']);var _0x2a94af={'where':_0x5c3003['where']};return db['Template'][_0x2263('0x16')](_0x2a94af)[_0x2263('0x3c')](function(_0x1d13fb){_0x662b2f['count']=_0x1d13fb;if(_0x45d2ba[_0x2263('0x2e')][_0x2263('0x3d')]){_0x5c3003[_0x2263('0x3e')]=[{'all':!![]}];}return db[_0x2263('0x29')][_0x2263('0x3f')](_0x5c3003);})[_0x2263('0x3c')](function(_0x41bc1a){_0x662b2f[_0x2263('0x40')]=_0x41bc1a;return _0x662b2f;})[_0x2263('0x3c')](respondWithFilteredResult(_0x2cb34f,_0x5c3003))['catch'](handleError(_0x2cb34f,null));};exports[_0x2263('0x41')]=function(_0x126e68,_0x41be40){var _0x5a8e6a={'raw':!![],'where':{'id':_0x126e68[_0x2263('0x42')]['id']}},_0x434c0b={};_0x434c0b[_0x2263('0x2d')]=_[_0x2263('0x2f')](db[_0x2263('0x29')][_0x2263('0x2a')]);_0x434c0b[_0x2263('0x2e')]=_[_0x2263('0x2f')](_0x126e68[_0x2263('0x2e')]);_0x434c0b[_0x2263('0x30')]=_[_0x2263('0x31')](_0x434c0b[_0x2263('0x2d')],_0x434c0b[_0x2263('0x2e')]);_0x5a8e6a[_0x2263('0x32')]=_[_0x2263('0x31')](_0x434c0b[_0x2263('0x2d')],qs[_0x2263('0x33')](_0x126e68[_0x2263('0x2e')][_0x2263('0x33')]));_0x5a8e6a[_0x2263('0x32')]=_0x5a8e6a[_0x2263('0x32')][_0x2263('0x34')]?_0x5a8e6a[_0x2263('0x32')]:_0x434c0b[_0x2263('0x2d')];if(_0x126e68[_0x2263('0x2e')][_0x2263('0x3d')]){_0x5a8e6a[_0x2263('0x3e')]=[{'all':!![]}];}_0x5a8e6a=_[_0x2263('0x39')]({},_0x5a8e6a,_0x126e68['options']);return db['Template'][_0x2263('0x43')](_0x5a8e6a)[_0x2263('0x3c')](handleEntityNotFound(_0x41be40,null))[_0x2263('0x3c')](respondWithResult(_0x41be40,null))[_0x2263('0x44')](handleError(_0x41be40,null));};exports['create']=function(_0x5cd2b0,_0x521565){return db[_0x2263('0x29')][_0x2263('0x45')](_0x5cd2b0['body'],{})[_0x2263('0x3c')](function(_0x489c0d){var _0x15f41a=_0x5cd2b0['user'][_0x2263('0x1f')]({'plain':!![]});if(!_0x15f41a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15f41a['role']===_0x2263('0x46')){var _0x1ce5a5=_0x489c0d[_0x2263('0x1f')]({'plain':!![]});var _0x4862a2='Templates';return db[_0x2263('0x47')][_0x2263('0x43')]({'where':{'name':_0x4862a2,'userProfileId':_0x15f41a[_0x2263('0x48')]},'raw':!![]})[_0x2263('0x3c')](function(_0x4d8ed6){if(_0x4d8ed6&&_0x4d8ed6['autoAssociation']===0x0){return db[_0x2263('0x21')][_0x2263('0x45')]({'name':_0x1ce5a5[_0x2263('0x25')],'resourceId':_0x1ce5a5['id'],'type':_0x4d8ed6[_0x2263('0x25')],'sectionId':_0x4d8ed6['id']},{})['then'](function(){return _0x489c0d;});}else{return _0x489c0d;}})[_0x2263('0x44')](function(_0x334623){logger[_0x2263('0x23')](_0x2263('0x49'),_0x334623);throw _0x334623;});}return _0x489c0d;})['then'](respondWithResult(_0x521565,0xc9))[_0x2263('0x44')](handleError(_0x521565,null));};exports['update']=function(_0xad8d99,_0x5ec979){if(_0xad8d99[_0x2263('0x4a')]['id']){delete _0xad8d99[_0x2263('0x4a')]['id'];}return db[_0x2263('0x29')][_0x2263('0x43')]({'where':{'id':_0xad8d99[_0x2263('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ec979,null))[_0x2263('0x3c')](saveUpdates(_0xad8d99[_0x2263('0x4a')],null))[_0x2263('0x3c')](respondWithResult(_0x5ec979,null))[_0x2263('0x44')](handleError(_0x5ec979,null));};exports[_0x2263('0x1e')]=function(_0x3f98fa,_0x3eb524){return db['Template']['find']({'where':{'id':_0x3f98fa[_0x2263('0x42')]['id']}})[_0x2263('0x3c')](handleEntityNotFound(_0x3eb524,null))[_0x2263('0x3c')](removeEntity(_0x3eb524,null))[_0x2263('0x44')](handleError(_0x3eb524,null));}; \ No newline at end of file +var _0x6424=['name','send','index','map','Template','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','include','findAll','rows','catch','params','length','find','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6424,0xaf));var _0x4642=function(_0x51554e,_0x2e58cb){_0x51554e=_0x51554e-0x0;var _0x1e455c=_0x6424[_0x51554e];return _0x1e455c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4642('0x0'));var zipdir=require(_0x4642('0x1'));var jsonpatch=require(_0x4642('0x2'));var rp=require('request-promise');var moment=require(_0x4642('0x3'));var BPromise=require(_0x4642('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4642('0x5'));var sox=require(_0x4642('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4642('0x7'));var _=require(_0x4642('0x8'));var squel=require(_0x4642('0x9'));var crypto=require('crypto');var jsforce=require(_0x4642('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4642('0xb'));var Papa=require(_0x4642('0xc'));var Redis=require(_0x4642('0xd'));var authService=require(_0x4642('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4642('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4642('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25debd,_0xa752da){_0xa752da=_0xa752da||0xcc;return function(_0x236e6c){if(_0x236e6c){return _0x25debd[_0x4642('0x11')](_0xa752da);}return _0x25debd[_0x4642('0x12')](_0xa752da)[_0x4642('0x13')]();};}function respondWithResult(_0xb7566d,_0x58103e){_0x58103e=_0x58103e||0xc8;return function(_0x3b2f49){if(_0x3b2f49){return _0xb7566d[_0x4642('0x12')](_0x58103e)['json'](_0x3b2f49);}};}function respondWithFilteredResult(_0xdfa1eb,_0x51df2d){return function(_0x1d351a){if(_0x1d351a){var _0x4f8436=typeof _0x51df2d[_0x4642('0x14')]===_0x4642('0x15')&&typeof _0x51df2d[_0x4642('0x16')]===_0x4642('0x15');var _0x3120d6=_0x1d351a[_0x4642('0x17')];var _0x5283df=_0x4f8436?0x0:_0x51df2d[_0x4642('0x14')];var _0x5efa8a=_0x4f8436?_0x1d351a[_0x4642('0x17')]:_0x51df2d[_0x4642('0x14')]+_0x51df2d['limit'];var _0x46df31;if(_0x5efa8a>=_0x3120d6){_0x5efa8a=_0x3120d6;_0x46df31=0xc8;}else{_0x46df31=0xce;}_0xdfa1eb[_0x4642('0x12')](_0x46df31);return _0xdfa1eb[_0x4642('0x18')](_0x4642('0x19'),_0x5283df+'-'+_0x5efa8a+'/'+_0x3120d6)['json'](_0x1d351a);}return null;};}function patchUpdates(_0x146014){return function(_0x3c5cfe){try{jsonpatch[_0x4642('0x1a')](_0x3c5cfe,_0x146014,!![]);}catch(_0x287563){return BPromise[_0x4642('0x1b')](_0x287563);}return _0x3c5cfe['save']();};}function saveUpdates(_0x30c0c7,_0x51fa9b){return function(_0x27b20f){if(_0x27b20f){return _0x27b20f[_0x4642('0x1c')](_0x30c0c7)[_0x4642('0x1d')](function(_0x22e504){return _0x22e504;});}return null;};}function removeEntity(_0x495f9a,_0x561968){return function(_0x289231){if(_0x289231){return _0x289231[_0x4642('0x1e')]()['then'](function(){var _0x22aaba=_0x289231[_0x4642('0x1f')]({'plain':!![]});var _0x1f0a71='Templates';return db[_0x4642('0x20')][_0x4642('0x1e')]({'where':{'type':_0x1f0a71,'resourceId':_0x22aaba['id']}})[_0x4642('0x1d')](function(){return _0x289231;});})['then'](function(){_0x495f9a[_0x4642('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34f7ae,_0x44abd1){return function(_0x1e9499){if(!_0x1e9499){_0x34f7ae[_0x4642('0x11')](0x194);}return _0x1e9499;};}function handleError(_0x2cbd88,_0x3cdd00){_0x3cdd00=_0x3cdd00||0x1f4;return function(_0x17ceec){logger[_0x4642('0x21')](_0x17ceec[_0x4642('0x22')]);if(_0x17ceec[_0x4642('0x23')]){delete _0x17ceec[_0x4642('0x23')];}_0x2cbd88[_0x4642('0x12')](_0x3cdd00)[_0x4642('0x24')](_0x17ceec);};}exports[_0x4642('0x25')]=function(_0x3680fc,_0xc4334e){var _0x51383c={},_0x560f4b={},_0x996b91={'count':0x0,'rows':[]};var _0x2edbdd=_[_0x4642('0x26')](db[_0x4642('0x27')][_0x4642('0x28')],function(_0x271f1d){return{'name':_0x271f1d['fieldName'],'type':_0x271f1d['type']['key']};});_0x560f4b[_0x4642('0x29')]=_[_0x4642('0x26')](_0x2edbdd,_0x4642('0x23'));_0x560f4b[_0x4642('0x2a')]=_[_0x4642('0x2b')](_0x3680fc[_0x4642('0x2a')]);_0x560f4b[_0x4642('0x2c')]=_[_0x4642('0x2d')](_0x560f4b['model'],_0x560f4b[_0x4642('0x2a')]);_0x51383c[_0x4642('0x2e')]=_[_0x4642('0x2d')](_0x560f4b[_0x4642('0x29')],qs[_0x4642('0x2f')](_0x3680fc[_0x4642('0x2a')]['fields']));_0x51383c['attributes']=_0x51383c[_0x4642('0x2e')]['length']?_0x51383c[_0x4642('0x2e')]:_0x560f4b[_0x4642('0x29')];if(!_0x3680fc[_0x4642('0x2a')][_0x4642('0x30')](_0x4642('0x31'))){_0x51383c[_0x4642('0x16')]=qs[_0x4642('0x16')](_0x3680fc['query'][_0x4642('0x16')]);_0x51383c[_0x4642('0x14')]=qs['offset'](_0x3680fc[_0x4642('0x2a')][_0x4642('0x14')]);}_0x51383c['order']=qs[_0x4642('0x32')](_0x3680fc[_0x4642('0x2a')][_0x4642('0x32')]);_0x51383c['where']=qs[_0x4642('0x2c')](_[_0x4642('0x33')](_0x3680fc[_0x4642('0x2a')],_0x560f4b[_0x4642('0x2c')]),_0x2edbdd);if(_0x3680fc['query'][_0x4642('0x34')]){_0x51383c[_0x4642('0x35')]=_[_0x4642('0x36')](_0x51383c['where'],{'$or':_[_0x4642('0x26')](_0x2edbdd,function(_0x55d693){if(_0x55d693[_0x4642('0x37')]!=='VIRTUAL'){var _0x1b149f={};_0x1b149f[_0x55d693['name']]={'$like':'%'+_0x3680fc['query'][_0x4642('0x34')]+'%'};return _0x1b149f;}})});}_0x51383c=_[_0x4642('0x36')]({},_0x51383c,_0x3680fc[_0x4642('0x38')]);var _0x149935={'where':_0x51383c[_0x4642('0x35')]};return db['Template']['count'](_0x149935)[_0x4642('0x1d')](function(_0x870023){_0x996b91['count']=_0x870023;if(_0x3680fc[_0x4642('0x2a')]['includeAll']){_0x51383c[_0x4642('0x39')]=[{'all':!![]}];}return db['Template'][_0x4642('0x3a')](_0x51383c);})[_0x4642('0x1d')](function(_0x54101c){_0x996b91[_0x4642('0x3b')]=_0x54101c;return _0x996b91;})[_0x4642('0x1d')](respondWithFilteredResult(_0xc4334e,_0x51383c))[_0x4642('0x3c')](handleError(_0xc4334e,null));};exports['show']=function(_0x1f8bec,_0x523cc9){var _0x272d05={'raw':!![],'where':{'id':_0x1f8bec[_0x4642('0x3d')]['id']}},_0x8e1230={};_0x8e1230['model']=_[_0x4642('0x2b')](db['Template']['rawAttributes']);_0x8e1230[_0x4642('0x2a')]=_['keys'](_0x1f8bec[_0x4642('0x2a')]);_0x8e1230[_0x4642('0x2c')]=_[_0x4642('0x2d')](_0x8e1230['model'],_0x8e1230[_0x4642('0x2a')]);_0x272d05[_0x4642('0x2e')]=_[_0x4642('0x2d')](_0x8e1230[_0x4642('0x29')],qs[_0x4642('0x2f')](_0x1f8bec['query'][_0x4642('0x2f')]));_0x272d05[_0x4642('0x2e')]=_0x272d05[_0x4642('0x2e')][_0x4642('0x3e')]?_0x272d05[_0x4642('0x2e')]:_0x8e1230[_0x4642('0x29')];if(_0x1f8bec[_0x4642('0x2a')]['includeAll']){_0x272d05[_0x4642('0x39')]=[{'all':!![]}];}_0x272d05=_[_0x4642('0x36')]({},_0x272d05,_0x1f8bec[_0x4642('0x38')]);return db[_0x4642('0x27')][_0x4642('0x3f')](_0x272d05)[_0x4642('0x1d')](handleEntityNotFound(_0x523cc9,null))['then'](respondWithResult(_0x523cc9,null))[_0x4642('0x3c')](handleError(_0x523cc9,null));};exports['create']=function(_0x1ac99a,_0xd30177){return db['Template']['create'](_0x1ac99a['body'],{})['then'](function(_0x5e90b9){var _0xa8375a=_0x1ac99a[_0x4642('0x40')][_0x4642('0x1f')]({'plain':!![]});if(!_0xa8375a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa8375a['role']===_0x4642('0x40')){var _0x5e173e=_0x5e90b9[_0x4642('0x1f')]({'plain':!![]});var _0xf3baee='Templates';return db['UserProfileSection'][_0x4642('0x3f')]({'where':{'name':_0xf3baee,'userProfileId':_0xa8375a[_0x4642('0x41')]},'raw':!![]})[_0x4642('0x1d')](function(_0x4b7669){if(_0x4b7669&&_0x4b7669[_0x4642('0x42')]===0x0){return db['UserProfileResource'][_0x4642('0x43')]({'name':_0x5e173e[_0x4642('0x23')],'resourceId':_0x5e173e['id'],'type':_0x4b7669[_0x4642('0x23')],'sectionId':_0x4b7669['id']},{})[_0x4642('0x1d')](function(){return _0x5e90b9;});}else{return _0x5e90b9;}})[_0x4642('0x3c')](function(_0x299c90){logger[_0x4642('0x21')](_0x4642('0x44'),_0x299c90);throw _0x299c90;});}return _0x5e90b9;})[_0x4642('0x1d')](respondWithResult(_0xd30177,0xc9))[_0x4642('0x3c')](handleError(_0xd30177,null));};exports[_0x4642('0x1c')]=function(_0x549323,_0x152aa1){if(_0x549323[_0x4642('0x45')]['id']){delete _0x549323[_0x4642('0x45')]['id'];}return db[_0x4642('0x27')][_0x4642('0x3f')]({'where':{'id':_0x549323[_0x4642('0x3d')]['id']}})[_0x4642('0x1d')](handleEntityNotFound(_0x152aa1,null))[_0x4642('0x1d')](saveUpdates(_0x549323[_0x4642('0x45')],null))[_0x4642('0x1d')](respondWithResult(_0x152aa1,null))['catch'](handleError(_0x152aa1,null));};exports[_0x4642('0x1e')]=function(_0x5c5dd9,_0x23b71f){return db[_0x4642('0x27')][_0x4642('0x3f')]({'where':{'id':_0x5c5dd9[_0x4642('0x3d')]['id']}})[_0x4642('0x1d')](handleEntityNotFound(_0x23b71f,null))['then'](removeEntity(_0x23b71f,null))[_0x4642('0x3c')](handleError(_0x23b71f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 501fc37..fff217c 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 _0x158f=['exports','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x158f,0xd3));var _0xf158=function(_0x35a2ef,_0x29c660){_0x35a2ef=_0x35a2ef-0x0;var _0x4a2dc8=_0x158f[_0x35a2ef];return _0x4a2dc8;};'use strict';var _=require(_0xf158('0x0'));var util=require(_0xf158('0x1'));var logger=require(_0xf158('0x2'))(_0xf158('0x3'));var moment=require(_0xf158('0x4'));var BPromise=require(_0xf158('0x5'));var rp=require(_0xf158('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf158('0x7'));var config=require(_0xf158('0x8'));var attributes=require(_0xf158('0x9'));module[_0xf158('0xa')]=function(_0x41ce1b,_0xe4a703){return _0x41ce1b['define'](_0xf158('0xb'),attributes,{'tableName':_0xf158('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5141=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','../../config/logger'];(function(_0x417b94,_0x29c80b){var _0x1508fe=function(_0x1ef3da){while(--_0x1ef3da){_0x417b94['push'](_0x417b94['shift']());}};_0x1508fe(++_0x29c80b);}(_0x5141,0x159));var _0x1514=function(_0x4b078e,_0x117cef){_0x4b078e=_0x4b078e-0x0;var _0x5bf7a8=_0x5141[_0x4b078e];return _0x5bf7a8;};'use strict';var _=require(_0x1514('0x0'));var util=require(_0x1514('0x1'));var logger=require(_0x1514('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1514('0x3'));var rp=require(_0x1514('0x4'));var fs=require('fs');var path=require(_0x1514('0x5'));var rimraf=require(_0x1514('0x6'));var config=require(_0x1514('0x7'));var attributes=require(_0x1514('0x8'));module[_0x1514('0x9')]=function(_0x4c1782,_0x29cb10){return _0x4c1782[_0x1514('0xa')]('Template',attributes,{'tableName':_0x1514('0xb'),'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 1d12969..d3bb853 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 _0x7b22=['result','GetTemplate','findAll','options','where','attributes','limit','include','map','model','then','debug','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d953e,_0x2f06af){var _0xc885df=function(_0x1ac647){while(--_0x1ac647){_0x5d953e['push'](_0x5d953e['shift']());}};_0xc885df(++_0x2f06af);}(_0x7b22,0x67));var _0x27b2=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0x7b22[_0x16e9b5];return _0x206df0;};'use strict';var _=require(_0x27b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x27b2('0x1'));var rs=require(_0x27b2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27b2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x27b2('0x4'));var config=require(_0x27b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x27b2('0x6')][_0x27b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3cfc8b,_0x68faca,_0x137a51){return new BPromise(function(_0x5d723b,_0x4e59ea){return client[_0x27b2('0x8')](_0x3cfc8b,_0x137a51)['then'](function(_0x2bf699){logger[_0x27b2('0x9')](_0x27b2('0xa'),_0x68faca,_0x27b2('0xb'));logger['debug'](_0x27b2('0xc'),_0x68faca,_0x27b2('0xb'),JSON[_0x27b2('0xd')](_0x2bf699));if(_0x2bf699[_0x27b2('0xe')]){if(_0x2bf699[_0x27b2('0xe')][_0x27b2('0xf')]===0x1f4){logger[_0x27b2('0xe')]('Template,\x20%s,\x20%s',_0x68faca,_0x2bf699['error']['message']);return _0x4e59ea(_0x2bf699[_0x27b2('0xe')][_0x27b2('0x10')]);}logger[_0x27b2('0xe')]('Template,\x20%s,\x20%s',_0x68faca,_0x2bf699['error'][_0x27b2('0x10')]);return _0x5d723b(_0x2bf699[_0x27b2('0xe')][_0x27b2('0x10')]);}else{logger['info'](_0x27b2('0xa'),_0x68faca,_0x27b2('0xb'));_0x5d723b(_0x2bf699[_0x27b2('0x11')]['message']);}})['catch'](function(_0x5ae82b){logger[_0x27b2('0xe')](_0x27b2('0xa'),_0x68faca,_0x5ae82b);_0x4e59ea(_0x5ae82b);});});}exports[_0x27b2('0x12')]=function(_0x2b3819){var _0x27afe3=this;return new Promise(function(_0x2e3f8c,_0x1a1135){return db['Template'][_0x27b2('0x13')]({'raw':_0x2b3819['options']?_0x2b3819[_0x27b2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2b3819[_0x27b2('0x14')]?_0x2b3819[_0x27b2('0x14')][_0x27b2('0x15')]||null:null,'attributes':_0x2b3819['options']?_0x2b3819['options'][_0x27b2('0x16')]||null:null,'limit':_0x2b3819[_0x27b2('0x14')]?_0x2b3819['options'][_0x27b2('0x17')]||null:null,'include':_0x2b3819[_0x27b2('0x14')]?_0x2b3819['options'][_0x27b2('0x18')]?_[_0x27b2('0x19')](_0x2b3819[_0x27b2('0x14')][_0x27b2('0x18')],function(_0x453b92){return{'model':db[_0x453b92[_0x27b2('0x1a')]],'as':_0x453b92['as'],'attributes':_0x453b92['attributes'],'include':_0x453b92[_0x27b2('0x18')]?_[_0x27b2('0x19')](_0x453b92[_0x27b2('0x18')],function(_0x5b6a73){return{'model':db[_0x5b6a73['model']],'as':_0x5b6a73['as'],'attributes':_0x5b6a73[_0x27b2('0x16')],'include':_0x5b6a73[_0x27b2('0x18')]?_[_0x27b2('0x19')](_0x5b6a73[_0x27b2('0x18')],function(_0x4375a7){return{'model':db[_0x4375a7[_0x27b2('0x1a')]],'as':_0x4375a7['as'],'attributes':_0x4375a7[_0x27b2('0x16')]};}):[]};}):[]};}):[]:[]})[_0x27b2('0x1b')](function(_0x569e89){logger[_0x27b2('0x9')](_0x27b2('0x12'),_0x2b3819);logger[_0x27b2('0x1c')](_0x27b2('0x12'),_0x2b3819,JSON['stringify'](_0x569e89));_0x2e3f8c(_0x569e89);})[_0x27b2('0x1d')](function(_0x2600e3){logger[_0x27b2('0xe')](_0x27b2('0x12'),_0x2600e3[_0x27b2('0x10')],_0x2b3819);_0x1a1135(_0x27afe3['error'](0x1f4,_0x2600e3[_0x27b2('0x10')]));});});}; \ No newline at end of file +var _0x5c27=['GetTemplate','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','options','raw','where','limit','include','model','map','attributes'];(function(_0x32bd09,_0x5b7530){var _0xf1727d=function(_0x531d4f){while(--_0x531d4f){_0x32bd09['push'](_0x32bd09['shift']());}};_0xf1727d(++_0x5b7530);}(_0x5c27,0xe8));var _0x75c2=function(_0x77fd25,_0x226ea2){_0x77fd25=_0x77fd25-0x0;var _0xe14528=_0x5c27[_0x77fd25];return _0xe14528;};'use strict';var _=require(_0x75c2('0x0'));var util=require(_0x75c2('0x1'));var moment=require(_0x75c2('0x2'));var BPromise=require(_0x75c2('0x3'));var rs=require(_0x75c2('0x4'));var fs=require('fs');var Redis=require(_0x75c2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x75c2('0x6'));var logger=require(_0x75c2('0x7'))('rpc');var config=require(_0x75c2('0x8'));var jayson=require(_0x75c2('0x9'));var client=jayson[_0x75c2('0xa')][_0x75c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5212d0,_0x19c89b,_0x42d53f){return new BPromise(function(_0x238a5a,_0x5697d8){return client[_0x75c2('0xc')](_0x5212d0,_0x42d53f)[_0x75c2('0xd')](function(_0x1147e3){logger['info'](_0x75c2('0xe'),_0x19c89b,_0x75c2('0xf'));logger[_0x75c2('0x10')](_0x75c2('0x11'),_0x19c89b,'request\x20sent',JSON[_0x75c2('0x12')](_0x1147e3));if(_0x1147e3[_0x75c2('0x13')]){if(_0x1147e3[_0x75c2('0x13')]['code']===0x1f4){logger[_0x75c2('0x13')](_0x75c2('0xe'),_0x19c89b,_0x1147e3['error'][_0x75c2('0x14')]);return _0x5697d8(_0x1147e3[_0x75c2('0x13')][_0x75c2('0x14')]);}logger[_0x75c2('0x13')](_0x75c2('0xe'),_0x19c89b,_0x1147e3[_0x75c2('0x13')][_0x75c2('0x14')]);return _0x238a5a(_0x1147e3[_0x75c2('0x13')][_0x75c2('0x14')]);}else{logger[_0x75c2('0x15')](_0x75c2('0xe'),_0x19c89b,_0x75c2('0xf'));_0x238a5a(_0x1147e3[_0x75c2('0x16')]['message']);}})[_0x75c2('0x17')](function(_0x513b7b){logger[_0x75c2('0x13')](_0x75c2('0xe'),_0x19c89b,_0x513b7b);_0x5697d8(_0x513b7b);});});}exports['GetTemplate']=function(_0x242b5d){var _0x2224b7=this;return new Promise(function(_0x1f97ec,_0x18fa94){return db['Template']['findAll']({'raw':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x19')]===undefined?!![]:![]:!![],'where':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1a')]||null:null,'attributes':_0x242b5d['options']?_0x242b5d[_0x75c2('0x18')]['attributes']||null:null,'limit':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1b')]||null:null,'include':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1c')]?_['map'](_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1c')],function(_0x6d0ace){return{'model':db[_0x6d0ace[_0x75c2('0x1d')]],'as':_0x6d0ace['as'],'attributes':_0x6d0ace['attributes'],'include':_0x6d0ace[_0x75c2('0x1c')]?_[_0x75c2('0x1e')](_0x6d0ace[_0x75c2('0x1c')],function(_0x8d43a5){return{'model':db[_0x8d43a5[_0x75c2('0x1d')]],'as':_0x8d43a5['as'],'attributes':_0x8d43a5[_0x75c2('0x1f')],'include':_0x8d43a5['include']?_[_0x75c2('0x1e')](_0x8d43a5[_0x75c2('0x1c')],function(_0x323730){return{'model':db[_0x323730[_0x75c2('0x1d')]],'as':_0x323730['as'],'attributes':_0x323730['attributes']};}):[]};}):[]};}):[]:[]})[_0x75c2('0xd')](function(_0x321260){logger[_0x75c2('0x15')](_0x75c2('0x20'),_0x242b5d);logger[_0x75c2('0x10')](_0x75c2('0x20'),_0x242b5d,JSON[_0x75c2('0x12')](_0x321260));_0x1f97ec(_0x321260);})['catch'](function(_0x11f431){logger[_0x75c2('0x13')]('GetTemplate',_0x11f431[_0x75c2('0x14')],_0x242b5d);_0x18fa94(_0x2224b7[_0x75c2('0x13')](0x1f4,_0x11f431['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 21ea712..a9c8890 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 _0xffe1=['destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0xffe1,0x187));var _0x1ffe=function(_0x3fa9c4,_0x35ddb6){_0x3fa9c4=_0x3fa9c4-0x0;var _0x3d18cf=_0xffe1[_0x3fa9c4];return _0x3d18cf;};'use strict';var multer=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var path=require('path');var timeout=require(_0x1ffe('0x2'));var express=require('express');var router=express[_0x1ffe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ffe('0x4'));var interaction=require(_0x1ffe('0x5'));var config=require(_0x1ffe('0x6'));var controller=require(_0x1ffe('0x7'));router[_0x1ffe('0x8')]('/',auth[_0x1ffe('0x9')](),controller[_0x1ffe('0xa')]);router[_0x1ffe('0x8')](_0x1ffe('0xb'),auth['isAuthenticated'](),controller[_0x1ffe('0xc')]);router['get'](_0x1ffe('0xd'),auth['isAuthenticated'](),controller[_0x1ffe('0xe')]);router['get'](_0x1ffe('0xf'),auth[_0x1ffe('0x9')](),controller[_0x1ffe('0x10')]);router[_0x1ffe('0x8')](_0x1ffe('0x11'),auth[_0x1ffe('0x9')](),controller[_0x1ffe('0x12')]);router[_0x1ffe('0x13')]('/',auth[_0x1ffe('0x9')](),controller['create']);router['post'](_0x1ffe('0xd'),auth[_0x1ffe('0x9')](),controller[_0x1ffe('0x14')]);router[_0x1ffe('0x13')](_0x1ffe('0xf'),auth[_0x1ffe('0x9')](),controller[_0x1ffe('0x15')]);router['post'](_0x1ffe('0x11'),auth[_0x1ffe('0x9')](),controller[_0x1ffe('0x16')]);router[_0x1ffe('0x17')](_0x1ffe('0xb'),auth[_0x1ffe('0x9')](),controller[_0x1ffe('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1ffe('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6bdd=['post','create','addAllCondition','addAnyCondition','addAction','/:id','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./trigger.controller','get','index','show','/:id/all_conditions','isAuthenticated','getAllConditions','/:id/any_conditions','getAnyConditions','getActions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bdd,0xe9));var _0xd6bd=function(_0x1750a9,_0x373841){_0x1750a9=_0x1750a9-0x0;var _0x409942=_0x6bdd[_0x1750a9];return _0x409942;};'use strict';var multer=require('multer');var util=require(_0xd6bd('0x0'));var path=require(_0xd6bd('0x1'));var timeout=require(_0xd6bd('0x2'));var express=require(_0xd6bd('0x3'));var router=express[_0xd6bd('0x4')]();var fs_extra=require(_0xd6bd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6bd('0x6'));var config=require('../../config/environment');var controller=require(_0xd6bd('0x7'));router[_0xd6bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6bd('0x9')]);router[_0xd6bd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd6bd('0xa')]);router[_0xd6bd('0x8')](_0xd6bd('0xb'),auth[_0xd6bd('0xc')](),controller[_0xd6bd('0xd')]);router['get'](_0xd6bd('0xe'),auth[_0xd6bd('0xc')](),controller[_0xd6bd('0xf')]);router['get']('/:id/actions',auth[_0xd6bd('0xc')](),controller[_0xd6bd('0x10')]);router[_0xd6bd('0x11')]('/',auth[_0xd6bd('0xc')](),controller[_0xd6bd('0x12')]);router[_0xd6bd('0x11')](_0xd6bd('0xb'),auth[_0xd6bd('0xc')](),controller[_0xd6bd('0x13')]);router[_0xd6bd('0x11')](_0xd6bd('0xe'),auth['isAuthenticated'](),controller[_0xd6bd('0x14')]);router[_0xd6bd('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0xd6bd('0x15')]);router['put'](_0xd6bd('0x16'),auth[_0xd6bd('0xc')](),controller[_0xd6bd('0x17')]);router[_0xd6bd('0x18')]('/:id',auth[_0xd6bd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6d5999e..fe964d1 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 _0xa9d7=['sequelize','STRING'];(function(_0x19b7f6,_0x2e4772){var _0x145070=function(_0x350f09){while(--_0x350f09){_0x19b7f6['push'](_0x19b7f6['shift']());}};_0x145070(++_0x2e4772);}(_0xa9d7,0x134));var _0x7a9d=function(_0x4fa8b3,_0x59d119){_0x4fa8b3=_0x4fa8b3-0x0;var _0x2b4be1=_0xa9d7[_0x4fa8b3];return _0x2b4be1;};'use strict';var Sequelize=require(_0x7a9d('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a9d('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9a96=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9a96,0xd0));var _0x69a9=function(_0x317e60,_0x2badaa){_0x317e60=_0x317e60-0x0;var _0x28b7a8=_0x9a96[_0x317e60];return _0x28b7a8;};'use strict';var Sequelize=require(_0x69a9('0x0'));module[_0x69a9('0x1')]={'name':{'type':Sequelize[_0x69a9('0x2')]},'channel':{'type':Sequelize[_0x69a9('0x2')]},'description':{'type':Sequelize[_0x69a9('0x2')]},'status':{'type':Sequelize[_0x69a9('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 8135193..1f774de 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 _0xda58=['pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','params','addAllCondition','TriggerAllId','Condition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','crypto','jsforce','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','undefined','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Triggers','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda58,0x1bf));var _0x8da5=function(_0xb397f8,_0x565f97){_0xb397f8=_0xb397f8-0x0;var _0x2af80c=_0xda58[_0xb397f8];return _0x2af80c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8da5('0x0'));var zipdir=require(_0x8da5('0x1'));var jsonpatch=require(_0x8da5('0x2'));var rp=require(_0x8da5('0x3'));var moment=require(_0x8da5('0x4'));var BPromise=require(_0x8da5('0x5'));var Mustache=require(_0x8da5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8da5('0x7'));var fs=require('fs');var fs_extra=require(_0x8da5('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8da5('0x9'));var jsforce=require(_0x8da5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8da5('0xb'));var querystring=require(_0x8da5('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8da5('0xd'));var hardwareService=require(_0x8da5('0xe'));var logger=require(_0x8da5('0xf'))(_0x8da5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8da5('0x11'))['db'];function respondWithStatusCode(_0x5e6514,_0x4e5948){_0x4e5948=_0x4e5948||0xcc;return function(_0xa01a96){if(_0xa01a96){return _0x5e6514[_0x8da5('0x12')](_0x4e5948);}return _0x5e6514[_0x8da5('0x13')](_0x4e5948)['end']();};}function respondWithResult(_0x35d6ae,_0x48f8e5){_0x48f8e5=_0x48f8e5||0xc8;return function(_0xeef29){if(_0xeef29){return _0x35d6ae['status'](_0x48f8e5)[_0x8da5('0x14')](_0xeef29);}};}function respondWithFilteredResult(_0x5bdf30,_0x1d2ac0){return function(_0x3b277d){if(_0x3b277d){var _0x50887e=typeof _0x1d2ac0['offset']===_0x8da5('0x15')&&typeof _0x1d2ac0['limit']===_0x8da5('0x15');var _0x413d0a=_0x3b277d['count'];var _0xe7f6e0=_0x50887e?0x0:_0x1d2ac0['offset'];var _0x219323=_0x50887e?_0x3b277d['count']:_0x1d2ac0[_0x8da5('0x16')]+_0x1d2ac0[_0x8da5('0x17')];var _0x595115;if(_0x219323>=_0x413d0a){_0x219323=_0x413d0a;_0x595115=0xc8;}else{_0x595115=0xce;}_0x5bdf30[_0x8da5('0x13')](_0x595115);return _0x5bdf30[_0x8da5('0x18')](_0x8da5('0x19'),_0xe7f6e0+'-'+_0x219323+'/'+_0x413d0a)[_0x8da5('0x14')](_0x3b277d);}return null;};}function patchUpdates(_0x286988){return function(_0x35a8c5){try{jsonpatch[_0x8da5('0x1a')](_0x35a8c5,_0x286988,!![]);}catch(_0xf32296){return BPromise[_0x8da5('0x1b')](_0xf32296);}return _0x35a8c5['save']();};}function saveUpdates(_0x105317,_0x302480){return function(_0x2a1271){if(_0x2a1271){return _0x2a1271[_0x8da5('0x1c')](_0x105317)['then'](function(_0xb1ad08){return _0xb1ad08;});}return null;};}function removeEntity(_0x532915,_0x167a6b){return function(_0x5c9b4a){if(_0x5c9b4a){return _0x5c9b4a[_0x8da5('0x1d')]()[_0x8da5('0x1e')](function(){var _0x1dc6a9=_0x5c9b4a[_0x8da5('0x1f')]({'plain':!![]});var _0x1eb46d=_0x8da5('0x20');return db[_0x8da5('0x21')][_0x8da5('0x1d')]({'where':{'type':_0x1eb46d,'resourceId':_0x1dc6a9['id']}})[_0x8da5('0x1e')](function(){return _0x5c9b4a;});})[_0x8da5('0x1e')](function(){_0x532915[_0x8da5('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x172454,_0x3de266){return function(_0x234ee6){if(!_0x234ee6){_0x172454[_0x8da5('0x12')](0x194);}return _0x234ee6;};}function handleError(_0x4b5811,_0x328cbc){_0x328cbc=_0x328cbc||0x1f4;return function(_0x1dfeeb){logger[_0x8da5('0x22')](_0x1dfeeb['stack']);if(_0x1dfeeb[_0x8da5('0x23')]){delete _0x1dfeeb['name'];}_0x4b5811['status'](_0x328cbc)[_0x8da5('0x24')](_0x1dfeeb);};}exports[_0x8da5('0x25')]=function(_0x1689c5,_0x406f36){var _0x25d75b={},_0x185804={},_0x2b2c84={'count':0x0,'rows':[]};var _0x391793=_[_0x8da5('0x26')](db[_0x8da5('0x27')][_0x8da5('0x28')],function(_0xd192a1){return{'name':_0xd192a1[_0x8da5('0x29')],'type':_0xd192a1[_0x8da5('0x2a')][_0x8da5('0x2b')]};});_0x185804[_0x8da5('0x2c')]=_['map'](_0x391793,_0x8da5('0x23'));_0x185804[_0x8da5('0x2d')]=_[_0x8da5('0x2e')](_0x1689c5['query']);_0x185804['filters']=_['intersection'](_0x185804[_0x8da5('0x2c')],_0x185804['query']);_0x25d75b[_0x8da5('0x2f')]=_[_0x8da5('0x30')](_0x185804[_0x8da5('0x2c')],qs[_0x8da5('0x31')](_0x1689c5[_0x8da5('0x2d')][_0x8da5('0x31')]));_0x25d75b[_0x8da5('0x2f')]=_0x25d75b[_0x8da5('0x2f')][_0x8da5('0x32')]?_0x25d75b[_0x8da5('0x2f')]:_0x185804[_0x8da5('0x2c')];if(!_0x1689c5[_0x8da5('0x2d')][_0x8da5('0x33')](_0x8da5('0x34'))){_0x25d75b[_0x8da5('0x17')]=qs[_0x8da5('0x17')](_0x1689c5[_0x8da5('0x2d')]['limit']);_0x25d75b[_0x8da5('0x16')]=qs['offset'](_0x1689c5[_0x8da5('0x2d')]['offset']);}_0x25d75b[_0x8da5('0x35')]=qs[_0x8da5('0x36')](_0x1689c5[_0x8da5('0x2d')][_0x8da5('0x36')]);_0x25d75b[_0x8da5('0x37')]=qs[_0x8da5('0x38')](_[_0x8da5('0x39')](_0x1689c5[_0x8da5('0x2d')],_0x185804[_0x8da5('0x38')]),_0x391793);if(_0x1689c5[_0x8da5('0x2d')][_0x8da5('0x3a')]){_0x25d75b['where']=_[_0x8da5('0x3b')](_0x25d75b[_0x8da5('0x37')],{'$or':_[_0x8da5('0x26')](_0x391793,function(_0x1203cb){if(_0x1203cb[_0x8da5('0x2a')]!==_0x8da5('0x3c')){var _0x432119={};_0x432119[_0x1203cb[_0x8da5('0x23')]]={'$like':'%'+_0x1689c5[_0x8da5('0x2d')][_0x8da5('0x3a')]+'%'};return _0x432119;}})});}_0x25d75b=_[_0x8da5('0x3b')]({},_0x25d75b,_0x1689c5[_0x8da5('0x3d')]);var _0x2281a3={'where':_0x25d75b[_0x8da5('0x37')]};return db[_0x8da5('0x27')][_0x8da5('0x3e')](_0x2281a3)[_0x8da5('0x1e')](function(_0x1b11bb){_0x2b2c84['count']=_0x1b11bb;if(_0x1689c5[_0x8da5('0x2d')][_0x8da5('0x3f')]){_0x25d75b[_0x8da5('0x40')]=[{'all':!![]}];}return db[_0x8da5('0x27')][_0x8da5('0x41')](_0x25d75b);})[_0x8da5('0x1e')](function(_0x1e43f7){_0x2b2c84['rows']=_0x1e43f7;return _0x2b2c84;})[_0x8da5('0x1e')](respondWithFilteredResult(_0x406f36,_0x25d75b))['catch'](handleError(_0x406f36,null));};exports['show']=function(_0x376baf,_0x25fed2){var _0x3f70ad={'raw':![],'where':{'id':_0x376baf['params']['id']}},_0x5f2088={};_0x5f2088[_0x8da5('0x2c')]=_[_0x8da5('0x2e')](db[_0x8da5('0x27')][_0x8da5('0x28')]);_0x5f2088[_0x8da5('0x2d')]=_['keys'](_0x376baf['query']);_0x5f2088[_0x8da5('0x38')]=_[_0x8da5('0x30')](_0x5f2088[_0x8da5('0x2c')],_0x5f2088[_0x8da5('0x2d')]);_0x3f70ad['attributes']=_[_0x8da5('0x30')](_0x5f2088[_0x8da5('0x2c')],qs[_0x8da5('0x31')](_0x376baf['query']['fields']));_0x3f70ad[_0x8da5('0x2f')]=_0x3f70ad[_0x8da5('0x2f')]['length']?_0x3f70ad[_0x8da5('0x2f')]:_0x5f2088[_0x8da5('0x2c')];if(_0x376baf[_0x8da5('0x2d')][_0x8da5('0x3f')]){_0x3f70ad[_0x8da5('0x40')]=[{'all':!![]}];}_0x3f70ad=_[_0x8da5('0x3b')]({},_0x3f70ad,_0x376baf[_0x8da5('0x3d')]);return db[_0x8da5('0x27')][_0x8da5('0x42')](_0x3f70ad)[_0x8da5('0x1e')](handleEntityNotFound(_0x25fed2,null))[_0x8da5('0x1e')](respondWithResult(_0x25fed2,null))[_0x8da5('0x43')](handleError(_0x25fed2,null));};exports[_0x8da5('0x44')]=function(_0x1d9568,_0x3afd86){return db[_0x8da5('0x27')][_0x8da5('0x44')](_0x1d9568[_0x8da5('0x45')],{})[_0x8da5('0x1e')](function(_0x29edd3){var _0x41969f=_0x1d9568[_0x8da5('0x46')][_0x8da5('0x1f')]({'plain':!![]});if(!_0x41969f)throw new Error(_0x8da5('0x47'));if(_0x41969f['role']===_0x8da5('0x46')){var _0x3eccd0=_0x29edd3[_0x8da5('0x1f')]({'plain':!![]});var _0x166c98=_0x8da5('0x20');return db['UserProfileSection'][_0x8da5('0x42')]({'where':{'name':_0x166c98,'userProfileId':_0x41969f[_0x8da5('0x48')]},'raw':!![]})[_0x8da5('0x1e')](function(_0x4d3f67){if(_0x4d3f67&&_0x4d3f67['autoAssociation']===0x0){return db['UserProfileResource'][_0x8da5('0x44')]({'name':_0x3eccd0[_0x8da5('0x23')],'resourceId':_0x3eccd0['id'],'type':_0x4d3f67[_0x8da5('0x23')],'sectionId':_0x4d3f67['id']},{})[_0x8da5('0x1e')](function(){return _0x29edd3;});}else{return _0x29edd3;}})['catch'](function(_0x552ff4){logger[_0x8da5('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x552ff4);throw _0x552ff4;});}return _0x29edd3;})[_0x8da5('0x1e')](respondWithResult(_0x3afd86,0xc9))[_0x8da5('0x43')](handleError(_0x3afd86,null));};exports['update']=function(_0x5cdabb,_0x5a7ba8){if(_0x5cdabb[_0x8da5('0x45')]['id']){delete _0x5cdabb[_0x8da5('0x45')]['id'];}return db[_0x8da5('0x27')][_0x8da5('0x42')]({'where':{'id':_0x5cdabb[_0x8da5('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a7ba8,null))['then'](saveUpdates(_0x5cdabb['body'],null))[_0x8da5('0x1e')](respondWithResult(_0x5a7ba8,null))['catch'](handleError(_0x5a7ba8,null));};exports[_0x8da5('0x1d')]=function(_0x181122,_0x187f0d){return db[_0x8da5('0x27')][_0x8da5('0x42')]({'where':{'id':_0x181122[_0x8da5('0x49')]['id']}})[_0x8da5('0x1e')](handleEntityNotFound(_0x187f0d,null))[_0x8da5('0x1e')](removeEntity(_0x187f0d,null))[_0x8da5('0x43')](handleError(_0x187f0d,null));};exports[_0x8da5('0x4a')]=function(_0x75f55f,_0x4ed39d,_0x3993a7){if(_0x75f55f['body']['id']){delete _0x75f55f['body']['id'];}return db[_0x8da5('0x27')][_0x8da5('0x42')]({'where':{'id':_0x75f55f[_0x8da5('0x49')]['id']}})[_0x8da5('0x1e')](handleEntityNotFound(_0x4ed39d,null))[_0x8da5('0x1e')](function(_0x5796a2){if(_0x5796a2){_0x75f55f[_0x8da5('0x45')][_0x8da5('0x4b')]=_0x5796a2['id'];return db[_0x8da5('0x4c')][_0x8da5('0x44')](_0x75f55f[_0x8da5('0x45')]);}})[_0x8da5('0x1e')](respondWithResult(_0x4ed39d,null))[_0x8da5('0x43')](handleError(_0x4ed39d,null));};exports['addAnyCondition']=function(_0x54b83e,_0x2d96c4,_0xfe6fb1){if(_0x54b83e[_0x8da5('0x45')]['id']){delete _0x54b83e[_0x8da5('0x45')]['id'];}return db[_0x8da5('0x27')]['find']({'where':{'id':_0x54b83e[_0x8da5('0x49')]['id']}})[_0x8da5('0x1e')](handleEntityNotFound(_0x2d96c4,null))[_0x8da5('0x1e')](function(_0x225756){if(_0x225756){_0x54b83e['body']['TriggerAnyId']=_0x225756['id'];return db[_0x8da5('0x4c')][_0x8da5('0x44')](_0x54b83e[_0x8da5('0x45')]);}})[_0x8da5('0x1e')](respondWithResult(_0x2d96c4,null))['catch'](handleError(_0x2d96c4,null));};exports[_0x8da5('0x4d')]=function(_0x355590,_0x2bbb68,_0x5a6bd4){var _0x45d8f4={};var _0x40c759={};var _0x49bd32;var _0x44587b;return db['Trigger']['findOne']({'where':{'id':_0x355590[_0x8da5('0x49')]['id']}})[_0x8da5('0x1e')](handleEntityNotFound(_0x2bbb68,null))[_0x8da5('0x1e')](function(_0x102e6d){if(_0x102e6d){_0x49bd32=_0x102e6d;_0x40c759['model']=_[_0x8da5('0x2e')](db[_0x8da5('0x4c')][_0x8da5('0x28')]);_0x40c759[_0x8da5('0x2d')]=_['keys'](_0x355590[_0x8da5('0x2d')]);_0x40c759[_0x8da5('0x38')]=_['intersection'](_0x40c759[_0x8da5('0x2c')],_0x40c759[_0x8da5('0x2d')]);_0x45d8f4[_0x8da5('0x2f')]=_[_0x8da5('0x30')](_0x40c759[_0x8da5('0x2c')],qs['fields'](_0x355590['query'][_0x8da5('0x31')]));_0x45d8f4[_0x8da5('0x2f')]=_0x45d8f4['attributes'][_0x8da5('0x32')]?_0x45d8f4[_0x8da5('0x2f')]:_0x40c759[_0x8da5('0x2c')];_0x45d8f4[_0x8da5('0x35')]=qs[_0x8da5('0x36')](_0x355590[_0x8da5('0x2d')][_0x8da5('0x36')]);_0x45d8f4[_0x8da5('0x37')]=qs['filters'](_['pick'](_0x355590[_0x8da5('0x2d')],_0x40c759[_0x8da5('0x38')]));if(_0x355590[_0x8da5('0x2d')][_0x8da5('0x3a')]){_0x45d8f4['where']=_['merge'](_0x45d8f4[_0x8da5('0x37')],{'$or':_[_0x8da5('0x26')](_0x45d8f4['attributes'],function(_0x1a7794){var _0x1c25d2={};_0x1c25d2[_0x1a7794]={'$like':'%'+_0x355590[_0x8da5('0x2d')][_0x8da5('0x3a')]+'%'};return _0x1c25d2;})});}_0x45d8f4=_[_0x8da5('0x3b')]({},_0x45d8f4,_0x355590[_0x8da5('0x3d')]);return _0x49bd32[_0x8da5('0x4d')](_0x45d8f4);}})[_0x8da5('0x1e')](function(_0x1118e8){if(_0x1118e8){_0x44587b=_0x1118e8[_0x8da5('0x32')];if(!_0x355590[_0x8da5('0x2d')][_0x8da5('0x33')](_0x8da5('0x34'))){_0x45d8f4[_0x8da5('0x17')]=qs['limit'](_0x355590[_0x8da5('0x2d')][_0x8da5('0x17')]);_0x45d8f4[_0x8da5('0x16')]=qs[_0x8da5('0x16')](_0x355590['query'][_0x8da5('0x16')]);}return _0x49bd32['getAllConditions'](_0x45d8f4);}})['then'](function(_0xf1b553){if(_0xf1b553){return _0xf1b553?{'count':_0x44587b,'rows':_0xf1b553}:null;}})['then'](respondWithResult(_0x2bbb68,null))[_0x8da5('0x43')](handleError(_0x2bbb68,null));};exports[_0x8da5('0x4e')]=function(_0x51a5de,_0x3e3e14,_0x28268b){var _0x2dfeb4={};var _0x535e4c={};var _0x58de1e;var _0x346a43;return db[_0x8da5('0x27')][_0x8da5('0x4f')]({'where':{'id':_0x51a5de[_0x8da5('0x49')]['id']}})[_0x8da5('0x1e')](handleEntityNotFound(_0x3e3e14,null))[_0x8da5('0x1e')](function(_0x57455d){if(_0x57455d){_0x58de1e=_0x57455d;_0x535e4c[_0x8da5('0x2c')]=_[_0x8da5('0x2e')](db[_0x8da5('0x4c')][_0x8da5('0x28')]);_0x535e4c[_0x8da5('0x2d')]=_[_0x8da5('0x2e')](_0x51a5de[_0x8da5('0x2d')]);_0x535e4c['filters']=_[_0x8da5('0x30')](_0x535e4c['model'],_0x535e4c[_0x8da5('0x2d')]);_0x2dfeb4[_0x8da5('0x2f')]=_['intersection'](_0x535e4c[_0x8da5('0x2c')],qs[_0x8da5('0x31')](_0x51a5de[_0x8da5('0x2d')][_0x8da5('0x31')]));_0x2dfeb4[_0x8da5('0x2f')]=_0x2dfeb4[_0x8da5('0x2f')]['length']?_0x2dfeb4[_0x8da5('0x2f')]:_0x535e4c['model'];_0x2dfeb4[_0x8da5('0x35')]=qs[_0x8da5('0x36')](_0x51a5de[_0x8da5('0x2d')]['sort']);_0x2dfeb4[_0x8da5('0x37')]=qs['filters'](_[_0x8da5('0x39')](_0x51a5de[_0x8da5('0x2d')],_0x535e4c[_0x8da5('0x38')]));if(_0x51a5de[_0x8da5('0x2d')][_0x8da5('0x3a')]){_0x2dfeb4['where']=_[_0x8da5('0x3b')](_0x2dfeb4[_0x8da5('0x37')],{'$or':_[_0x8da5('0x26')](_0x2dfeb4[_0x8da5('0x2f')],function(_0x24c5de){var _0x55b3a0={};_0x55b3a0[_0x24c5de]={'$like':'%'+_0x51a5de[_0x8da5('0x2d')][_0x8da5('0x3a')]+'%'};return _0x55b3a0;})});}_0x2dfeb4=_[_0x8da5('0x3b')]({},_0x2dfeb4,_0x51a5de[_0x8da5('0x3d')]);return _0x58de1e[_0x8da5('0x4e')](_0x2dfeb4);}})[_0x8da5('0x1e')](function(_0x308179){if(_0x308179){_0x346a43=_0x308179[_0x8da5('0x32')];if(!_0x51a5de[_0x8da5('0x2d')]['hasOwnProperty'](_0x8da5('0x34'))){_0x2dfeb4[_0x8da5('0x17')]=qs[_0x8da5('0x17')](_0x51a5de[_0x8da5('0x2d')][_0x8da5('0x17')]);_0x2dfeb4[_0x8da5('0x16')]=qs[_0x8da5('0x16')](_0x51a5de[_0x8da5('0x2d')][_0x8da5('0x16')]);}return _0x58de1e[_0x8da5('0x4e')](_0x2dfeb4);}})['then'](function(_0x56a3cd){if(_0x56a3cd){return _0x56a3cd?{'count':_0x346a43,'rows':_0x56a3cd}:null;}})[_0x8da5('0x1e')](respondWithResult(_0x3e3e14,null))[_0x8da5('0x43')](handleError(_0x3e3e14,null));};exports[_0x8da5('0x50')]=function(_0x8e456b,_0x133e23,_0x55c3d1){if(_0x8e456b[_0x8da5('0x45')]['id']){delete _0x8e456b[_0x8da5('0x45')]['id'];}return db[_0x8da5('0x27')][_0x8da5('0x42')]({'where':{'id':_0x8e456b[_0x8da5('0x49')]['id']}})[_0x8da5('0x1e')](handleEntityNotFound(_0x133e23,null))[_0x8da5('0x1e')](function(_0x5d4aae){if(_0x5d4aae){_0x8e456b[_0x8da5('0x45')][_0x8da5('0x51')]=_0x5d4aae['id'];return db[_0x8da5('0x52')][_0x8da5('0x44')](_0x8e456b[_0x8da5('0x45')]);}})[_0x8da5('0x1e')](respondWithResult(_0x133e23,null))['catch'](handleError(_0x133e23,null));};exports[_0x8da5('0x53')]=function(_0x4f28eb,_0x346e46,_0x442d0e){var _0x16e5f5={};var _0x5c440f={};var _0x540306;var _0x503410;return db[_0x8da5('0x27')][_0x8da5('0x4f')]({'where':{'id':_0x4f28eb['params']['id']}})[_0x8da5('0x1e')](handleEntityNotFound(_0x346e46,null))['then'](function(_0xe6f413){if(_0xe6f413){_0x540306=_0xe6f413;_0x5c440f[_0x8da5('0x2c')]=_[_0x8da5('0x2e')](db['Action']['rawAttributes']);_0x5c440f[_0x8da5('0x2d')]=_['keys'](_0x4f28eb[_0x8da5('0x2d')]);_0x5c440f[_0x8da5('0x38')]=_['intersection'](_0x5c440f[_0x8da5('0x2c')],_0x5c440f[_0x8da5('0x2d')]);_0x16e5f5[_0x8da5('0x2f')]=_[_0x8da5('0x30')](_0x5c440f[_0x8da5('0x2c')],qs[_0x8da5('0x31')](_0x4f28eb[_0x8da5('0x2d')][_0x8da5('0x31')]));_0x16e5f5[_0x8da5('0x2f')]=_0x16e5f5[_0x8da5('0x2f')][_0x8da5('0x32')]?_0x16e5f5[_0x8da5('0x2f')]:_0x5c440f[_0x8da5('0x2c')];_0x16e5f5[_0x8da5('0x35')]=qs[_0x8da5('0x36')](_0x4f28eb[_0x8da5('0x2d')][_0x8da5('0x36')]);_0x16e5f5[_0x8da5('0x37')]=qs[_0x8da5('0x38')](_[_0x8da5('0x39')](_0x4f28eb['query'],_0x5c440f[_0x8da5('0x38')]));if(_0x4f28eb[_0x8da5('0x2d')]['filter']){_0x16e5f5[_0x8da5('0x37')]=_[_0x8da5('0x3b')](_0x16e5f5[_0x8da5('0x37')],{'$or':_[_0x8da5('0x26')](_0x16e5f5[_0x8da5('0x2f')],function(_0x2a1d53){var _0x5da6fa={};_0x5da6fa[_0x2a1d53]={'$like':'%'+_0x4f28eb[_0x8da5('0x2d')][_0x8da5('0x3a')]+'%'};return _0x5da6fa;})});}_0x16e5f5=_[_0x8da5('0x3b')]({},_0x16e5f5,_0x4f28eb[_0x8da5('0x3d')]);return _0x540306[_0x8da5('0x53')](_0x16e5f5);}})[_0x8da5('0x1e')](function(_0x42cf3c){if(_0x42cf3c){_0x503410=_0x42cf3c['length'];if(!_0x4f28eb['query'][_0x8da5('0x33')]('nolimit')){_0x16e5f5[_0x8da5('0x17')]=qs[_0x8da5('0x17')](_0x4f28eb[_0x8da5('0x2d')][_0x8da5('0x17')]);_0x16e5f5[_0x8da5('0x16')]=qs[_0x8da5('0x16')](_0x4f28eb[_0x8da5('0x2d')][_0x8da5('0x16')]);}return _0x540306[_0x8da5('0x53')](_0x16e5f5);}})[_0x8da5('0x1e')](function(_0x58a027){if(_0x58a027){return _0x58a027?{'count':_0x503410,'rows':_0x58a027}:null;}})[_0x8da5('0x1e')](respondWithResult(_0x346e46,null))['catch'](handleError(_0x346e46,null));}; \ No newline at end of file +var _0x0b70=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','reject','update','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x0b70,0x179));var _0x00b7=function(_0x13de2a,_0x15c54a){_0x13de2a=_0x13de2a-0x0;var _0x41aa31=_0x0b70[_0x13de2a];return _0x41aa31;};'use strict';var emlformat=require(_0x00b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00b7('0x1'));var jsonpatch=require(_0x00b7('0x2'));var rp=require(_0x00b7('0x3'));var moment=require(_0x00b7('0x4'));var BPromise=require(_0x00b7('0x5'));var Mustache=require('mustache');var util=require(_0x00b7('0x6'));var path=require(_0x00b7('0x7'));var sox=require(_0x00b7('0x8'));var csv=require(_0x00b7('0x9'));var ejs=require(_0x00b7('0xa'));var fs=require('fs');var fs_extra=require(_0x00b7('0xb'));var _=require(_0x00b7('0xc'));var squel=require(_0x00b7('0xd'));var crypto=require(_0x00b7('0xe'));var jsforce=require(_0x00b7('0xf'));var deskjs=require(_0x00b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x00b7('0x11'));var Papa=require(_0x00b7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00b7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00b7('0x14'));var logger=require(_0x00b7('0x15'))(_0x00b7('0x16'));var utils=require(_0x00b7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x00b7('0x18'));var db=require(_0x00b7('0x19'))['db'];function respondWithStatusCode(_0x4d8301,_0x15225c){_0x15225c=_0x15225c||0xcc;return function(_0x5efaae){if(_0x5efaae){return _0x4d8301['sendStatus'](_0x15225c);}return _0x4d8301['status'](_0x15225c)[_0x00b7('0x1a')]();};}function respondWithResult(_0x1343f4,_0x5c8abb){_0x5c8abb=_0x5c8abb||0xc8;return function(_0x457823){if(_0x457823){return _0x1343f4['status'](_0x5c8abb)[_0x00b7('0x1b')](_0x457823);}};}function respondWithFilteredResult(_0x109596,_0x56d11f){return function(_0x988258){if(_0x988258){var _0x42b26f=typeof _0x56d11f['offset']===_0x00b7('0x1c')&&typeof _0x56d11f[_0x00b7('0x1d')]===_0x00b7('0x1c');var _0x3a491=_0x988258['count'];var _0x1c6396=_0x42b26f?0x0:_0x56d11f['offset'];var _0x2dded9=_0x42b26f?_0x988258[_0x00b7('0x1e')]:_0x56d11f[_0x00b7('0x1f')]+_0x56d11f[_0x00b7('0x1d')];var _0x2241a9;if(_0x2dded9>=_0x3a491){_0x2dded9=_0x3a491;_0x2241a9=0xc8;}else{_0x2241a9=0xce;}_0x109596[_0x00b7('0x20')](_0x2241a9);return _0x109596[_0x00b7('0x21')]('Content-Range',_0x1c6396+'-'+_0x2dded9+'/'+_0x3a491)[_0x00b7('0x1b')](_0x988258);}return null;};}function patchUpdates(_0x1132fa){return function(_0x38fc82){try{jsonpatch['apply'](_0x38fc82,_0x1132fa,!![]);}catch(_0x4e8e76){return BPromise[_0x00b7('0x22')](_0x4e8e76);}return _0x38fc82['save']();};}function saveUpdates(_0x29e69e,_0x1ad662){return function(_0x1a3f55){if(_0x1a3f55){return _0x1a3f55[_0x00b7('0x23')](_0x29e69e)['then'](function(_0x3a9579){return _0x3a9579;});}return null;};}function removeEntity(_0x4a91cb,_0x14599e){return function(_0x4b9e41){if(_0x4b9e41){return _0x4b9e41[_0x00b7('0x24')]()[_0x00b7('0x25')](function(){var _0x523fd6=_0x4b9e41[_0x00b7('0x26')]({'plain':!![]});var _0x5d4902=_0x00b7('0x27');return db[_0x00b7('0x28')]['destroy']({'where':{'type':_0x5d4902,'resourceId':_0x523fd6['id']}})[_0x00b7('0x25')](function(){return _0x4b9e41;});})[_0x00b7('0x25')](function(){_0x4a91cb[_0x00b7('0x20')](0xcc)[_0x00b7('0x1a')]();});}};}function handleEntityNotFound(_0x4f367f,_0x421175){return function(_0x306e20){if(!_0x306e20){_0x4f367f['sendStatus'](0x194);}return _0x306e20;};}function handleError(_0x2f75e8,_0x298fcb){_0x298fcb=_0x298fcb||0x1f4;return function(_0x4917c3){logger[_0x00b7('0x29')](_0x4917c3[_0x00b7('0x2a')]);if(_0x4917c3[_0x00b7('0x2b')]){delete _0x4917c3[_0x00b7('0x2b')];}_0x2f75e8[_0x00b7('0x20')](_0x298fcb)[_0x00b7('0x2c')](_0x4917c3);};}exports[_0x00b7('0x2d')]=function(_0x12c989,_0x1b29b3){var _0x55bfab={},_0x80c2b9={},_0x47dc01={'count':0x0,'rows':[]};var _0x248daa=_[_0x00b7('0x2e')](db[_0x00b7('0x2f')][_0x00b7('0x30')],function(_0x5cedad){return{'name':_0x5cedad[_0x00b7('0x31')],'type':_0x5cedad[_0x00b7('0x32')][_0x00b7('0x33')]};});_0x80c2b9[_0x00b7('0x34')]=_['map'](_0x248daa,_0x00b7('0x2b'));_0x80c2b9[_0x00b7('0x35')]=_[_0x00b7('0x36')](_0x12c989[_0x00b7('0x35')]);_0x80c2b9[_0x00b7('0x37')]=_[_0x00b7('0x38')](_0x80c2b9['model'],_0x80c2b9[_0x00b7('0x35')]);_0x55bfab[_0x00b7('0x39')]=_[_0x00b7('0x38')](_0x80c2b9[_0x00b7('0x34')],qs['fields'](_0x12c989[_0x00b7('0x35')][_0x00b7('0x3a')]));_0x55bfab['attributes']=_0x55bfab[_0x00b7('0x39')][_0x00b7('0x3b')]?_0x55bfab[_0x00b7('0x39')]:_0x80c2b9[_0x00b7('0x34')];if(!_0x12c989[_0x00b7('0x35')][_0x00b7('0x3c')](_0x00b7('0x3d'))){_0x55bfab[_0x00b7('0x1d')]=qs[_0x00b7('0x1d')](_0x12c989['query'][_0x00b7('0x1d')]);_0x55bfab[_0x00b7('0x1f')]=qs['offset'](_0x12c989[_0x00b7('0x35')][_0x00b7('0x1f')]);}_0x55bfab[_0x00b7('0x3e')]=qs[_0x00b7('0x3f')](_0x12c989['query'][_0x00b7('0x3f')]);_0x55bfab[_0x00b7('0x40')]=qs['filters'](_[_0x00b7('0x41')](_0x12c989[_0x00b7('0x35')],_0x80c2b9['filters']),_0x248daa);if(_0x12c989[_0x00b7('0x35')]['filter']){_0x55bfab[_0x00b7('0x40')]=_[_0x00b7('0x42')](_0x55bfab[_0x00b7('0x40')],{'$or':_[_0x00b7('0x2e')](_0x248daa,function(_0x472090){if(_0x472090[_0x00b7('0x32')]!==_0x00b7('0x43')){var _0x1e56e0={};_0x1e56e0[_0x472090[_0x00b7('0x2b')]]={'$like':'%'+_0x12c989[_0x00b7('0x35')][_0x00b7('0x44')]+'%'};return _0x1e56e0;}})});}_0x55bfab=_['merge']({},_0x55bfab,_0x12c989[_0x00b7('0x45')]);var _0x1b5826={'where':_0x55bfab[_0x00b7('0x40')]};return db[_0x00b7('0x2f')][_0x00b7('0x1e')](_0x1b5826)['then'](function(_0x4c4a28){_0x47dc01[_0x00b7('0x1e')]=_0x4c4a28;if(_0x12c989[_0x00b7('0x35')][_0x00b7('0x46')]){_0x55bfab[_0x00b7('0x47')]=[{'all':!![]}];}return db[_0x00b7('0x2f')][_0x00b7('0x48')](_0x55bfab);})[_0x00b7('0x25')](function(_0x527004){_0x47dc01[_0x00b7('0x49')]=_0x527004;return _0x47dc01;})['then'](respondWithFilteredResult(_0x1b29b3,_0x55bfab))[_0x00b7('0x4a')](handleError(_0x1b29b3,null));};exports[_0x00b7('0x4b')]=function(_0x4a304b,_0x42e29e){var _0x316c45={'raw':![],'where':{'id':_0x4a304b['params']['id']}},_0x438962={};_0x438962['model']=_['keys'](db[_0x00b7('0x2f')][_0x00b7('0x30')]);_0x438962[_0x00b7('0x35')]=_['keys'](_0x4a304b['query']);_0x438962['filters']=_[_0x00b7('0x38')](_0x438962[_0x00b7('0x34')],_0x438962['query']);_0x316c45[_0x00b7('0x39')]=_[_0x00b7('0x38')](_0x438962['model'],qs['fields'](_0x4a304b[_0x00b7('0x35')][_0x00b7('0x3a')]));_0x316c45[_0x00b7('0x39')]=_0x316c45['attributes'][_0x00b7('0x3b')]?_0x316c45[_0x00b7('0x39')]:_0x438962['model'];if(_0x4a304b[_0x00b7('0x35')]['includeAll']){_0x316c45[_0x00b7('0x47')]=[{'all':!![]}];}_0x316c45=_[_0x00b7('0x42')]({},_0x316c45,_0x4a304b['options']);return db['Trigger'][_0x00b7('0x4c')](_0x316c45)[_0x00b7('0x25')](handleEntityNotFound(_0x42e29e,null))[_0x00b7('0x25')](respondWithResult(_0x42e29e,null))[_0x00b7('0x4a')](handleError(_0x42e29e,null));};exports['create']=function(_0x456936,_0x4f8c78){return db[_0x00b7('0x2f')]['create'](_0x456936[_0x00b7('0x4d')],{})[_0x00b7('0x25')](function(_0x4d2dd5){var _0x25a388=_0x456936[_0x00b7('0x4e')][_0x00b7('0x26')]({'plain':!![]});if(!_0x25a388)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25a388[_0x00b7('0x4f')]===_0x00b7('0x4e')){var _0x7f1b78=_0x4d2dd5[_0x00b7('0x26')]({'plain':!![]});var _0x2d3422=_0x00b7('0x27');return db[_0x00b7('0x50')][_0x00b7('0x4c')]({'where':{'name':_0x2d3422,'userProfileId':_0x25a388[_0x00b7('0x51')]},'raw':!![]})['then'](function(_0xde4bff){if(_0xde4bff&&_0xde4bff[_0x00b7('0x52')]===0x0){return db[_0x00b7('0x28')][_0x00b7('0x53')]({'name':_0x7f1b78[_0x00b7('0x2b')],'resourceId':_0x7f1b78['id'],'type':_0xde4bff['name'],'sectionId':_0xde4bff['id']},{})['then'](function(){return _0x4d2dd5;});}else{return _0x4d2dd5;}})[_0x00b7('0x4a')](function(_0x24d52e){logger[_0x00b7('0x29')](_0x00b7('0x54'),_0x24d52e);throw _0x24d52e;});}return _0x4d2dd5;})[_0x00b7('0x25')](respondWithResult(_0x4f8c78,0xc9))[_0x00b7('0x4a')](handleError(_0x4f8c78,null));};exports['update']=function(_0x4f9c29,_0x551ef2){if(_0x4f9c29[_0x00b7('0x4d')]['id']){delete _0x4f9c29[_0x00b7('0x4d')]['id'];}return db[_0x00b7('0x2f')][_0x00b7('0x4c')]({'where':{'id':_0x4f9c29['params']['id']}})[_0x00b7('0x25')](handleEntityNotFound(_0x551ef2,null))['then'](saveUpdates(_0x4f9c29[_0x00b7('0x4d')],null))[_0x00b7('0x25')](respondWithResult(_0x551ef2,null))[_0x00b7('0x4a')](handleError(_0x551ef2,null));};exports[_0x00b7('0x24')]=function(_0xf38f1a,_0xa66189){return db[_0x00b7('0x2f')][_0x00b7('0x4c')]({'where':{'id':_0xf38f1a[_0x00b7('0x55')]['id']}})[_0x00b7('0x25')](handleEntityNotFound(_0xa66189,null))[_0x00b7('0x25')](removeEntity(_0xa66189,null))[_0x00b7('0x4a')](handleError(_0xa66189,null));};exports[_0x00b7('0x56')]=function(_0xba96a0,_0x27f50a,_0x37bd54){if(_0xba96a0[_0x00b7('0x4d')]['id']){delete _0xba96a0['body']['id'];}return db[_0x00b7('0x2f')][_0x00b7('0x4c')]({'where':{'id':_0xba96a0[_0x00b7('0x55')]['id']}})[_0x00b7('0x25')](handleEntityNotFound(_0x27f50a,null))[_0x00b7('0x25')](function(_0x1ee31e){if(_0x1ee31e){_0xba96a0['body'][_0x00b7('0x57')]=_0x1ee31e['id'];return db[_0x00b7('0x58')][_0x00b7('0x53')](_0xba96a0[_0x00b7('0x4d')]);}})[_0x00b7('0x25')](respondWithResult(_0x27f50a,null))[_0x00b7('0x4a')](handleError(_0x27f50a,null));};exports['addAnyCondition']=function(_0x4b06b5,_0x1350c4,_0x13f8d8){if(_0x4b06b5['body']['id']){delete _0x4b06b5[_0x00b7('0x4d')]['id'];}return db['Trigger'][_0x00b7('0x4c')]({'where':{'id':_0x4b06b5[_0x00b7('0x55')]['id']}})[_0x00b7('0x25')](handleEntityNotFound(_0x1350c4,null))['then'](function(_0x4b7c2e){if(_0x4b7c2e){_0x4b06b5['body'][_0x00b7('0x59')]=_0x4b7c2e['id'];return db[_0x00b7('0x58')][_0x00b7('0x53')](_0x4b06b5[_0x00b7('0x4d')]);}})['then'](respondWithResult(_0x1350c4,null))[_0x00b7('0x4a')](handleError(_0x1350c4,null));};exports['getAllConditions']=function(_0x1e6150,_0x3dbc22,_0x1259a5){var _0x38e7c9={};var _0x24f18f={};var _0x32ac0f;var _0x417a09;return db[_0x00b7('0x2f')][_0x00b7('0x5a')]({'where':{'id':_0x1e6150[_0x00b7('0x55')]['id']}})['then'](handleEntityNotFound(_0x3dbc22,null))[_0x00b7('0x25')](function(_0x3469d0){if(_0x3469d0){_0x32ac0f=_0x3469d0;_0x24f18f['model']=_[_0x00b7('0x36')](db[_0x00b7('0x58')][_0x00b7('0x30')]);_0x24f18f[_0x00b7('0x35')]=_[_0x00b7('0x36')](_0x1e6150[_0x00b7('0x35')]);_0x24f18f[_0x00b7('0x37')]=_[_0x00b7('0x38')](_0x24f18f[_0x00b7('0x34')],_0x24f18f[_0x00b7('0x35')]);_0x38e7c9[_0x00b7('0x39')]=_['intersection'](_0x24f18f[_0x00b7('0x34')],qs['fields'](_0x1e6150[_0x00b7('0x35')][_0x00b7('0x3a')]));_0x38e7c9[_0x00b7('0x39')]=_0x38e7c9[_0x00b7('0x39')][_0x00b7('0x3b')]?_0x38e7c9[_0x00b7('0x39')]:_0x24f18f[_0x00b7('0x34')];_0x38e7c9['order']=qs[_0x00b7('0x3f')](_0x1e6150[_0x00b7('0x35')][_0x00b7('0x3f')]);_0x38e7c9[_0x00b7('0x40')]=qs[_0x00b7('0x37')](_[_0x00b7('0x41')](_0x1e6150['query'],_0x24f18f['filters']));if(_0x1e6150['query'][_0x00b7('0x44')]){_0x38e7c9['where']=_[_0x00b7('0x42')](_0x38e7c9['where'],{'$or':_['map'](_0x38e7c9[_0x00b7('0x39')],function(_0x302914){var _0x3fab1a={};_0x3fab1a[_0x302914]={'$like':'%'+_0x1e6150['query'][_0x00b7('0x44')]+'%'};return _0x3fab1a;})});}_0x38e7c9=_['merge']({},_0x38e7c9,_0x1e6150[_0x00b7('0x45')]);return _0x32ac0f[_0x00b7('0x5b')](_0x38e7c9);}})[_0x00b7('0x25')](function(_0x2c0a32){if(_0x2c0a32){_0x417a09=_0x2c0a32[_0x00b7('0x3b')];if(!_0x1e6150['query']['hasOwnProperty']('nolimit')){_0x38e7c9[_0x00b7('0x1d')]=qs[_0x00b7('0x1d')](_0x1e6150[_0x00b7('0x35')][_0x00b7('0x1d')]);_0x38e7c9[_0x00b7('0x1f')]=qs['offset'](_0x1e6150[_0x00b7('0x35')][_0x00b7('0x1f')]);}return _0x32ac0f[_0x00b7('0x5b')](_0x38e7c9);}})[_0x00b7('0x25')](function(_0x5238a4){if(_0x5238a4){return _0x5238a4?{'count':_0x417a09,'rows':_0x5238a4}:null;}})[_0x00b7('0x25')](respondWithResult(_0x3dbc22,null))[_0x00b7('0x4a')](handleError(_0x3dbc22,null));};exports[_0x00b7('0x5c')]=function(_0x19273d,_0x4d448c,_0x9d8f19){var _0x40f848={};var _0xb724e8={};var _0x1fb320;var _0x17ec91;return db[_0x00b7('0x2f')][_0x00b7('0x5a')]({'where':{'id':_0x19273d['params']['id']}})['then'](handleEntityNotFound(_0x4d448c,null))[_0x00b7('0x25')](function(_0x589b2f){if(_0x589b2f){_0x1fb320=_0x589b2f;_0xb724e8[_0x00b7('0x34')]=_[_0x00b7('0x36')](db[_0x00b7('0x58')][_0x00b7('0x30')]);_0xb724e8['query']=_[_0x00b7('0x36')](_0x19273d['query']);_0xb724e8['filters']=_[_0x00b7('0x38')](_0xb724e8['model'],_0xb724e8['query']);_0x40f848[_0x00b7('0x39')]=_[_0x00b7('0x38')](_0xb724e8[_0x00b7('0x34')],qs[_0x00b7('0x3a')](_0x19273d[_0x00b7('0x35')][_0x00b7('0x3a')]));_0x40f848[_0x00b7('0x39')]=_0x40f848[_0x00b7('0x39')]['length']?_0x40f848['attributes']:_0xb724e8['model'];_0x40f848[_0x00b7('0x3e')]=qs[_0x00b7('0x3f')](_0x19273d[_0x00b7('0x35')][_0x00b7('0x3f')]);_0x40f848[_0x00b7('0x40')]=qs['filters'](_[_0x00b7('0x41')](_0x19273d['query'],_0xb724e8[_0x00b7('0x37')]));if(_0x19273d[_0x00b7('0x35')][_0x00b7('0x44')]){_0x40f848[_0x00b7('0x40')]=_[_0x00b7('0x42')](_0x40f848['where'],{'$or':_[_0x00b7('0x2e')](_0x40f848[_0x00b7('0x39')],function(_0x1882e6){var _0x290eaf={};_0x290eaf[_0x1882e6]={'$like':'%'+_0x19273d['query'][_0x00b7('0x44')]+'%'};return _0x290eaf;})});}_0x40f848=_[_0x00b7('0x42')]({},_0x40f848,_0x19273d[_0x00b7('0x45')]);return _0x1fb320['getAnyConditions'](_0x40f848);}})[_0x00b7('0x25')](function(_0x322777){if(_0x322777){_0x17ec91=_0x322777[_0x00b7('0x3b')];if(!_0x19273d[_0x00b7('0x35')][_0x00b7('0x3c')](_0x00b7('0x3d'))){_0x40f848[_0x00b7('0x1d')]=qs[_0x00b7('0x1d')](_0x19273d['query'][_0x00b7('0x1d')]);_0x40f848['offset']=qs[_0x00b7('0x1f')](_0x19273d[_0x00b7('0x35')][_0x00b7('0x1f')]);}return _0x1fb320['getAnyConditions'](_0x40f848);}})['then'](function(_0x172e98){if(_0x172e98){return _0x172e98?{'count':_0x17ec91,'rows':_0x172e98}:null;}})[_0x00b7('0x25')](respondWithResult(_0x4d448c,null))[_0x00b7('0x4a')](handleError(_0x4d448c,null));};exports[_0x00b7('0x5d')]=function(_0x15c30d,_0x31bda7,_0x34c882){if(_0x15c30d[_0x00b7('0x4d')]['id']){delete _0x15c30d[_0x00b7('0x4d')]['id'];}return db['Trigger'][_0x00b7('0x4c')]({'where':{'id':_0x15c30d[_0x00b7('0x55')]['id']}})[_0x00b7('0x25')](handleEntityNotFound(_0x31bda7,null))[_0x00b7('0x25')](function(_0x53159e){if(_0x53159e){_0x15c30d[_0x00b7('0x4d')][_0x00b7('0x5e')]=_0x53159e['id'];return db['Action'][_0x00b7('0x53')](_0x15c30d['body']);}})['then'](respondWithResult(_0x31bda7,null))[_0x00b7('0x4a')](handleError(_0x31bda7,null));};exports[_0x00b7('0x5f')]=function(_0x22abaf,_0x54ca05,_0x1352d1){var _0x5d9f91={};var _0x41688c={};var _0x5accdb;var _0x11152a;return db[_0x00b7('0x2f')][_0x00b7('0x5a')]({'where':{'id':_0x22abaf[_0x00b7('0x55')]['id']}})[_0x00b7('0x25')](handleEntityNotFound(_0x54ca05,null))['then'](function(_0x2add26){if(_0x2add26){_0x5accdb=_0x2add26;_0x41688c[_0x00b7('0x34')]=_[_0x00b7('0x36')](db[_0x00b7('0x60')][_0x00b7('0x30')]);_0x41688c[_0x00b7('0x35')]=_['keys'](_0x22abaf[_0x00b7('0x35')]);_0x41688c[_0x00b7('0x37')]=_[_0x00b7('0x38')](_0x41688c[_0x00b7('0x34')],_0x41688c[_0x00b7('0x35')]);_0x5d9f91[_0x00b7('0x39')]=_['intersection'](_0x41688c[_0x00b7('0x34')],qs[_0x00b7('0x3a')](_0x22abaf[_0x00b7('0x35')][_0x00b7('0x3a')]));_0x5d9f91[_0x00b7('0x39')]=_0x5d9f91[_0x00b7('0x39')]['length']?_0x5d9f91[_0x00b7('0x39')]:_0x41688c[_0x00b7('0x34')];_0x5d9f91[_0x00b7('0x3e')]=qs[_0x00b7('0x3f')](_0x22abaf[_0x00b7('0x35')]['sort']);_0x5d9f91[_0x00b7('0x40')]=qs[_0x00b7('0x37')](_[_0x00b7('0x41')](_0x22abaf[_0x00b7('0x35')],_0x41688c[_0x00b7('0x37')]));if(_0x22abaf['query'][_0x00b7('0x44')]){_0x5d9f91[_0x00b7('0x40')]=_[_0x00b7('0x42')](_0x5d9f91['where'],{'$or':_[_0x00b7('0x2e')](_0x5d9f91[_0x00b7('0x39')],function(_0x442446){var _0x537245={};_0x537245[_0x442446]={'$like':'%'+_0x22abaf[_0x00b7('0x35')]['filter']+'%'};return _0x537245;})});}_0x5d9f91=_[_0x00b7('0x42')]({},_0x5d9f91,_0x22abaf['options']);return _0x5accdb[_0x00b7('0x5f')](_0x5d9f91);}})[_0x00b7('0x25')](function(_0x10dd9a){if(_0x10dd9a){_0x11152a=_0x10dd9a[_0x00b7('0x3b')];if(!_0x22abaf[_0x00b7('0x35')][_0x00b7('0x3c')](_0x00b7('0x3d'))){_0x5d9f91[_0x00b7('0x1d')]=qs[_0x00b7('0x1d')](_0x22abaf['query']['limit']);_0x5d9f91[_0x00b7('0x1f')]=qs[_0x00b7('0x1f')](_0x22abaf['query']['offset']);}return _0x5accdb['getActions'](_0x5d9f91);}})[_0x00b7('0x25')](function(_0x5a6458){if(_0x5a6458){return _0x5a6458?{'count':_0x11152a,'rows':_0x5a6458}:null;}})['then'](respondWithResult(_0x54ca05,null))['catch'](handleError(_0x54ca05,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 72b3db0..be6aa3e 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 _0xa7e6=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x7536f5,_0x577005){var _0x46dc97=function(_0x4f333f){while(--_0x4f333f){_0x7536f5['push'](_0x7536f5['shift']());}};_0x46dc97(++_0x577005);}(_0xa7e6,0x74));var _0x6a7e=function(_0xf73f79,_0x1ed75a){_0xf73f79=_0xf73f79-0x0;var _0x43b270=_0xa7e6[_0xf73f79];return _0x43b270;};'use strict';var _=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var logger=require(_0x6a7e('0x2'))(_0x6a7e('0x3'));var moment=require(_0x6a7e('0x4'));var BPromise=require(_0x6a7e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a7e('0x6'));var rimraf=require(_0x6a7e('0x7'));var config=require(_0x6a7e('0x8'));var attributes=require(_0x6a7e('0x9'));module[_0x6a7e('0xa')]=function(_0x599006,_0x79df6f){return _0x599006[_0x6a7e('0xb')](_0x6a7e('0xc'),attributes,{'tableName':_0x6a7e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd1=['tools_triggers','util','api','moment','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x2d8a21,_0x180eb1){var _0x54b379=function(_0x3573de){while(--_0x3573de){_0x2d8a21['push'](_0x2d8a21['shift']());}};_0x54b379(++_0x180eb1);}(_0x4bd1,0x90));var _0x14bd=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x4bd1[_0x38854e];return _0x3f8415;};'use strict';var _=require('lodash');var util=require(_0x14bd('0x0'));var logger=require('../../config/logger')(_0x14bd('0x1'));var moment=require(_0x14bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x14bd('0x3'));var fs=require('fs');var path=require(_0x14bd('0x4'));var rimraf=require('rimraf');var config=require(_0x14bd('0x5'));var attributes=require(_0x14bd('0x6'));module[_0x14bd('0x7')]=function(_0x31b468,_0x5c4680){return _0x31b468[_0x14bd('0x8')](_0x14bd('0x9'),attributes,{'tableName':_0x14bd('0xa'),'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 cae8f7b..b497244 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 _0xf8ce=['map','model','stringify','ShowTrigger','find','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xf8ce,0x150));var _0xef8c=function(_0x350fd4,_0x1651d0){_0x350fd4=_0x350fd4-0x0;var _0x384e90=_0xf8ce[_0x350fd4];return _0x384e90;};'use strict';var _=require('lodash');var util=require(_0xef8c('0x0'));var moment=require(_0xef8c('0x1'));var BPromise=require(_0xef8c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef8c('0x3'));var db=require(_0xef8c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef8c('0x5'))(_0xef8c('0x6'));var config=require('../../config/environment');var jayson=require(_0xef8c('0x7'));var client=jayson[_0xef8c('0x8')][_0xef8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d3274,_0x2619fd,_0x30bc4c){return new BPromise(function(_0x151a60,_0xa1c2e1){return client['request'](_0x8d3274,_0x30bc4c)[_0xef8c('0xa')](function(_0x4d7b68){logger['info'](_0xef8c('0xb'),_0x2619fd,_0xef8c('0xc'));logger[_0xef8c('0xd')](_0xef8c('0xe'),_0x2619fd,'request\x20sent',JSON['stringify'](_0x4d7b68));if(_0x4d7b68['error']){if(_0x4d7b68[_0xef8c('0xf')]['code']===0x1f4){logger[_0xef8c('0xf')](_0xef8c('0xb'),_0x2619fd,_0x4d7b68[_0xef8c('0xf')][_0xef8c('0x10')]);return _0xa1c2e1(_0x4d7b68[_0xef8c('0xf')][_0xef8c('0x10')]);}logger[_0xef8c('0xf')](_0xef8c('0xb'),_0x2619fd,_0x4d7b68[_0xef8c('0xf')][_0xef8c('0x10')]);return _0x151a60(_0x4d7b68[_0xef8c('0xf')][_0xef8c('0x10')]);}else{logger[_0xef8c('0x11')](_0xef8c('0xb'),_0x2619fd,'request\x20sent');_0x151a60(_0x4d7b68['result'][_0xef8c('0x10')]);}})[_0xef8c('0x12')](function(_0x257a6b){logger[_0xef8c('0xf')](_0xef8c('0xb'),_0x2619fd,_0x257a6b);_0xa1c2e1(_0x257a6b);});});}exports[_0xef8c('0x13')]=function(_0x313c7f){var _0x35ee9f=this;return new Promise(function(_0x58a97f,_0x1792f7){return db[_0xef8c('0x14')][_0xef8c('0x15')]({'raw':_0x313c7f['options']?_0x313c7f[_0xef8c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x313c7f['options']?_0x313c7f['options'][_0xef8c('0x17')]||null:null,'attributes':_0x313c7f[_0xef8c('0x16')]?_0x313c7f[_0xef8c('0x16')][_0xef8c('0x18')]||null:null,'limit':_0x313c7f[_0xef8c('0x16')]?_0x313c7f[_0xef8c('0x16')][_0xef8c('0x19')]||null:null,'include':_0x313c7f[_0xef8c('0x16')]?_0x313c7f[_0xef8c('0x16')][_0xef8c('0x1a')]?_[_0xef8c('0x1b')](_0x313c7f[_0xef8c('0x16')][_0xef8c('0x1a')],function(_0x282755){return{'model':db[_0x282755[_0xef8c('0x1c')]],'as':_0x282755['as'],'attributes':_0x282755['attributes'],'include':_0x282755[_0xef8c('0x1a')]?_[_0xef8c('0x1b')](_0x282755['include'],function(_0x4692f5){return{'model':db[_0x4692f5[_0xef8c('0x1c')]],'as':_0x4692f5['as'],'attributes':_0x4692f5[_0xef8c('0x18')],'include':_0x4692f5[_0xef8c('0x1a')]?_['map'](_0x4692f5[_0xef8c('0x1a')],function(_0x559ea6){return{'model':db[_0x559ea6['model']],'as':_0x559ea6['as'],'attributes':_0x559ea6['attributes']};}):[]};}):[]};}):[]:[]})[_0xef8c('0xa')](function(_0x117924){logger[_0xef8c('0x11')]('GetTrigger',_0x313c7f);logger['debug'](_0xef8c('0x13'),_0x313c7f,JSON[_0xef8c('0x1d')](_0x117924));_0x58a97f(_0x117924);})[_0xef8c('0x12')](function(_0x4abc14){logger[_0xef8c('0xf')](_0xef8c('0x13'),_0x4abc14[_0xef8c('0x10')],_0x313c7f);_0x1792f7(_0x35ee9f[_0xef8c('0xf')](0x1f4,_0x4abc14['message']));});});};exports[_0xef8c('0x1e')]=function(_0xc20c52){var _0x250b74=this;return new Promise(function(_0x282e89,_0xa17c6c){return db[_0xef8c('0x14')][_0xef8c('0x1f')]({'raw':_0xc20c52[_0xef8c('0x16')]?_0xc20c52['options'][_0xef8c('0x20')]===undefined?!![]:![]:!![],'where':_0xc20c52[_0xef8c('0x16')]?_0xc20c52[_0xef8c('0x16')]['where']||null:null,'attributes':_0xc20c52[_0xef8c('0x16')]?_0xc20c52[_0xef8c('0x16')][_0xef8c('0x18')]||null:null,'include':_0xc20c52[_0xef8c('0x16')]?_0xc20c52[_0xef8c('0x16')][_0xef8c('0x1a')]?_['map'](_0xc20c52[_0xef8c('0x16')][_0xef8c('0x1a')],function(_0x64bccc){return{'model':db[_0x64bccc[_0xef8c('0x1c')]],'as':_0x64bccc['as'],'attributes':_0x64bccc[_0xef8c('0x18')],'include':_0x64bccc[_0xef8c('0x1a')]?_[_0xef8c('0x1b')](_0x64bccc['include'],function(_0x4f91ae){return{'model':db[_0x4f91ae[_0xef8c('0x1c')]],'as':_0x4f91ae['as'],'attributes':_0x4f91ae[_0xef8c('0x18')],'include':_0x4f91ae['include']?_[_0xef8c('0x1b')](_0x4f91ae['include'],function(_0x337698){return{'model':db[_0x337698[_0xef8c('0x1c')]],'as':_0x337698['as'],'attributes':_0x337698[_0xef8c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xef8c('0xa')](function(_0x28a2c9){logger[_0xef8c('0x11')](_0xef8c('0x1e'),_0xc20c52);logger['debug'](_0xef8c('0x1e'),_0xc20c52,JSON[_0xef8c('0x1d')](_0x28a2c9));_0x282e89(_0x28a2c9);})[_0xef8c('0x12')](function(_0x3148d1){logger['error'](_0xef8c('0x1e'),_0x3148d1[_0xef8c('0x10')],_0xc20c52);_0xa17c6c(_0x250b74[_0xef8c('0xf')](0x1f4,_0x3148d1[_0xef8c('0x10')]));});});}; \ No newline at end of file +var _0x931f=['message','result','GetTrigger','findAll','options','where','attributes','limit','include','model','map','catch','ShowTrigger','Trigger','find','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2fe15c,_0x48713a){var _0x26ec58=function(_0x3e475a){while(--_0x3e475a){_0x2fe15c['push'](_0x2fe15c['shift']());}};_0x26ec58(++_0x48713a);}(_0x931f,0x139));var _0xf931=function(_0x35f677,_0x4cc714){_0x35f677=_0x35f677-0x0;var _0x321dec=_0x931f[_0x35f677];return _0x321dec;};'use strict';var _=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var moment=require(_0xf931('0x2'));var BPromise=require(_0xf931('0x3'));var rs=require(_0xf931('0x4'));var fs=require('fs');var Redis=require(_0xf931('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf931('0x6'));var logger=require(_0xf931('0x7'))(_0xf931('0x8'));var config=require(_0xf931('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf931('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5324e0,_0x6b02ba,_0x3ac5e2){return new BPromise(function(_0x108cc3,_0x4191e7){return client[_0xf931('0xb')](_0x5324e0,_0x3ac5e2)['then'](function(_0x59c8ed){logger[_0xf931('0xc')](_0xf931('0xd'),_0x6b02ba,_0xf931('0xe'));logger[_0xf931('0xf')](_0xf931('0x10'),_0x6b02ba,_0xf931('0xe'),JSON[_0xf931('0x11')](_0x59c8ed));if(_0x59c8ed[_0xf931('0x12')]){if(_0x59c8ed[_0xf931('0x12')][_0xf931('0x13')]===0x1f4){logger[_0xf931('0x12')](_0xf931('0xd'),_0x6b02ba,_0x59c8ed[_0xf931('0x12')][_0xf931('0x14')]);return _0x4191e7(_0x59c8ed[_0xf931('0x12')][_0xf931('0x14')]);}logger[_0xf931('0x12')](_0xf931('0xd'),_0x6b02ba,_0x59c8ed[_0xf931('0x12')][_0xf931('0x14')]);return _0x108cc3(_0x59c8ed[_0xf931('0x12')][_0xf931('0x14')]);}else{logger[_0xf931('0xc')](_0xf931('0xd'),_0x6b02ba,_0xf931('0xe'));_0x108cc3(_0x59c8ed[_0xf931('0x15')][_0xf931('0x14')]);}})['catch'](function(_0x5ec47a){logger['error'](_0xf931('0xd'),_0x6b02ba,_0x5ec47a);_0x4191e7(_0x5ec47a);});});}exports[_0xf931('0x16')]=function(_0x48bec5){var _0x5c9077=this;return new Promise(function(_0x555404,_0x18c26f){return db['Trigger'][_0xf931('0x17')]({'raw':_0x48bec5[_0xf931('0x18')]?_0x48bec5[_0xf931('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x48bec5[_0xf931('0x18')]?_0x48bec5[_0xf931('0x18')][_0xf931('0x19')]||null:null,'attributes':_0x48bec5['options']?_0x48bec5[_0xf931('0x18')][_0xf931('0x1a')]||null:null,'limit':_0x48bec5[_0xf931('0x18')]?_0x48bec5[_0xf931('0x18')][_0xf931('0x1b')]||null:null,'include':_0x48bec5[_0xf931('0x18')]?_0x48bec5[_0xf931('0x18')]['include']?_['map'](_0x48bec5[_0xf931('0x18')][_0xf931('0x1c')],function(_0x2e5d27){return{'model':db[_0x2e5d27[_0xf931('0x1d')]],'as':_0x2e5d27['as'],'attributes':_0x2e5d27[_0xf931('0x1a')],'include':_0x2e5d27[_0xf931('0x1c')]?_[_0xf931('0x1e')](_0x2e5d27[_0xf931('0x1c')],function(_0x4c7e47){return{'model':db[_0x4c7e47[_0xf931('0x1d')]],'as':_0x4c7e47['as'],'attributes':_0x4c7e47[_0xf931('0x1a')],'include':_0x4c7e47[_0xf931('0x1c')]?_['map'](_0x4c7e47[_0xf931('0x1c')],function(_0x4003f9){return{'model':db[_0x4003f9[_0xf931('0x1d')]],'as':_0x4003f9['as'],'attributes':_0x4003f9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4909ad){logger['info'](_0xf931('0x16'),_0x48bec5);logger['debug'](_0xf931('0x16'),_0x48bec5,JSON['stringify'](_0x4909ad));_0x555404(_0x4909ad);})[_0xf931('0x1f')](function(_0x3355c9){logger[_0xf931('0x12')](_0xf931('0x16'),_0x3355c9['message'],_0x48bec5);_0x18c26f(_0x5c9077[_0xf931('0x12')](0x1f4,_0x3355c9[_0xf931('0x14')]));});});};exports[_0xf931('0x20')]=function(_0x1c8069){var _0x5847c1=this;return new Promise(function(_0x157218,_0x126367){return db[_0xf931('0x21')][_0xf931('0x22')]({'raw':_0x1c8069['options']?_0x1c8069['options'][_0xf931('0x23')]===undefined?!![]:![]:!![],'where':_0x1c8069[_0xf931('0x18')]?_0x1c8069[_0xf931('0x18')]['where']||null:null,'attributes':_0x1c8069[_0xf931('0x18')]?_0x1c8069[_0xf931('0x18')]['attributes']||null:null,'include':_0x1c8069[_0xf931('0x18')]?_0x1c8069[_0xf931('0x18')][_0xf931('0x1c')]?_['map'](_0x1c8069['options'][_0xf931('0x1c')],function(_0x2a40e6){return{'model':db[_0x2a40e6[_0xf931('0x1d')]],'as':_0x2a40e6['as'],'attributes':_0x2a40e6[_0xf931('0x1a')],'include':_0x2a40e6['include']?_[_0xf931('0x1e')](_0x2a40e6[_0xf931('0x1c')],function(_0x2a6a9d){return{'model':db[_0x2a6a9d[_0xf931('0x1d')]],'as':_0x2a6a9d['as'],'attributes':_0x2a6a9d[_0xf931('0x1a')],'include':_0x2a6a9d[_0xf931('0x1c')]?_[_0xf931('0x1e')](_0x2a6a9d[_0xf931('0x1c')],function(_0x40c392){return{'model':db[_0x40c392[_0xf931('0x1d')]],'as':_0x40c392['as'],'attributes':_0x40c392[_0xf931('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf931('0x24')](function(_0x2ff261){logger[_0xf931('0xc')](_0xf931('0x20'),_0x1c8069);logger['debug'](_0xf931('0x20'),_0x1c8069,JSON[_0xf931('0x11')](_0x2ff261));_0x157218(_0x2ff261);})[_0xf931('0x1f')](function(_0x5abde7){logger[_0xf931('0x12')](_0xf931('0x20'),_0x5abde7[_0xf931('0x14')],_0x1c8069);_0x126367(_0x5847c1[_0xf931('0x12')](0x1f4,_0x5abde7['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index cb30aef..c7adcae 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 _0xeca9=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','put','update'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xeca9,0xfe));var _0x9eca=function(_0x41e499,_0x2b6fc7){_0x41e499=_0x41e499-0x0;var _0x36bffc=_0xeca9[_0x41e499];return _0x36bffc;};'use strict';var multer=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var path=require(_0x9eca('0x2'));var timeout=require('connect-timeout');var express=require(_0x9eca('0x3'));var router=express[_0x9eca('0x4')]();var fs_extra=require(_0x9eca('0x5'));var auth=require(_0x9eca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9eca('0x7'));var controller=require(_0x9eca('0x8'));router[_0x9eca('0x9')]('/',auth[_0x9eca('0xa')](),controller[_0x9eca('0xb')]);router[_0x9eca('0x9')](_0x9eca('0xc'),auth[_0x9eca('0xa')](),controller['show']);router[_0x9eca('0xd')]('/:id/clone',auth[_0x9eca('0xa')](),controller['clone']);router[_0x9eca('0xd')]('/',auth[_0x9eca('0xa')](),controller['create']);router[_0x9eca('0xe')](_0x9eca('0xc'),auth['isAuthenticated'](),controller[_0x9eca('0xf')]);router[_0x9eca('0x10')](_0x9eca('0xc'),auth[_0x9eca('0xa')](),controller[_0x9eca('0x11')]);module['exports']=router; \ No newline at end of file +var _0xecfc=['post','/:id/clone','clone','create','put','update','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x50cce9,_0x1f65b0){var _0x3032f1=function(_0x16cfff){while(--_0x16cfff){_0x50cce9['push'](_0x50cce9['shift']());}};_0x3032f1(++_0x1f65b0);}(_0xecfc,0x198));var _0xcecf=function(_0x29987b,_0x321bd9){_0x29987b=_0x29987b-0x0;var _0xb2dff=_0xecfc[_0x29987b];return _0xb2dff;};'use strict';var multer=require(_0xcecf('0x0'));var util=require(_0xcecf('0x1'));var path=require('path');var timeout=require(_0xcecf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcecf('0x3'));var auth=require(_0xcecf('0x4'));var interaction=require(_0xcecf('0x5'));var config=require(_0xcecf('0x6'));var controller=require('./trunk.controller');router[_0xcecf('0x7')]('/',auth[_0xcecf('0x8')](),controller[_0xcecf('0x9')]);router['get'](_0xcecf('0xa'),auth['isAuthenticated'](),controller[_0xcecf('0xb')]);router[_0xcecf('0xc')](_0xcecf('0xd'),auth['isAuthenticated'](),controller[_0xcecf('0xe')]);router['post']('/',auth[_0xcecf('0x8')](),controller[_0xcecf('0xf')]);router[_0xcecf('0x10')]('/:id',auth[_0xcecf('0x8')](),controller[_0xcecf('0x11')]);router[_0xcecf('0x12')](_0xcecf('0xa'),auth[_0xcecf('0x8')](),controller[_0xcecf('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8f63728..47fa998 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 _0xceca=['pai','active','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','update','outgoing','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas'];(function(_0x3fc3f1,_0xd40a2b){var _0x3f8923=function(_0x3ca210){while(--_0x3ca210){_0x3fc3f1['push'](_0x3fc3f1['shift']());}};_0x3f8923(++_0xd40a2b);}(_0xceca,0x1ac));var _0xacec=function(_0x2ac3de,_0x1432c8){_0x2ac3de=_0x2ac3de-0x0;var _0x20befd=_0xceca[_0x2ac3de];return _0x20befd;};'use strict';var Sequelize=require(_0xacec('0x0'));module[_0xacec('0x1')]={'name':{'type':Sequelize[_0xacec('0x2')],'allowNull':![],'unique':_0xacec('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x5'),'user',_0xacec('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xacec('0x2')],'allowNull':![],'defaultValue':_0xacec('0x7')},'callingpres':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x8'),_0xacec('0x9'),_0xacec('0xa'),'ALLOWED',_0xacec('0xb'),_0xacec('0xc'),'PROHIB_FAILED_SCREEN',_0xacec('0xd'))},'deny':{'type':Sequelize[_0xacec('0x2')]},'permit':{'type':Sequelize[_0xacec('0x2')]},'secret':{'type':Sequelize[_0xacec('0x2')]},'md5secret':{'type':Sequelize[_0xacec('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xacec('0x2')],'defaultValue':_0xacec('0xe'),'set':function(_0x224aa2){this[_0xacec('0xf')]('transport',_0x224aa2?_0x224aa2[_0xacec('0x10')](','):null);},'get':function(){return this[_0xacec('0x11')](_0xacec('0x12'))?this['getDataValue']('transport')[_0xacec('0x13')](','):null;},'comment':_0xacec('0x14')},'dtmfmode':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x15'),_0xacec('0x16'),_0xacec('0x17'),'inband',_0xacec('0x18')),'defaultValue':_0xacec('0x15')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xacec('0x19'),_0xacec('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xacec('0x2')]},'directmediadeny':{'type':Sequelize[_0xacec('0x2')]},'nat':{'type':Sequelize[_0xacec('0x2')],'defaultValue':_0xacec('0x1c'),'set':function(_0x4d430b){this[_0xacec('0xf')](_0xacec('0x1d'),_0x4d430b?_0x4d430b[_0xacec('0x10')](','):null);},'get':function(){return this[_0xacec('0x11')]('nat')?this['getDataValue']('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xacec('0x2')]},'namedcallgroup':{'type':Sequelize[_0xacec('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xacec('0x2')]},'language':{'type':Sequelize[_0xacec('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xacec('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xacec('0x1e')},'allow':{'type':Sequelize[_0xacec('0x2')],'allowNull':![],'defaultValue':_0xacec('0x1f'),'set':function(_0x167057){this[_0xacec('0xf')](_0xacec('0x20'),_0x167057?_0x167057[_0xacec('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xacec('0x11')](_0xacec('0x20'))?this[_0xacec('0x11')](_0xacec('0x20'))[_0xacec('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xacec('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xacec('0x2')],'defaultValue':'port,invite','set':function(_0x4c3cd9){this[_0xacec('0xf')](_0xacec('0x21'),_0x4c3cd9?_0x4c3cd9['join'](','):null);},'get':function(){return this[_0xacec('0x11')](_0xacec('0x21'))?this[_0xacec('0x11')](_0xacec('0x21'))[_0xacec('0x13')](','):null;},'comment':_0xacec('0x22')},'trustrpid':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no','never')},'promiscredir':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xacec('0x1b'),'no')},'accountcode':{'type':Sequelize[_0xacec('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xacec('0x2')],'defaultValue':_0xacec('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no'),'defaultValue':_0xacec('0x1b')},'busylevel':{'type':Sequelize[_0xacec('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xacec('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0xacec('0x2')]},'template':{'type':Sequelize[_0xacec('0x2')]},'videosupport':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no',_0xacec('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xacec('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xacec('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x26'),_0xacec('0x27'),'originate')},'session_expires':{'type':Sequelize[_0xacec('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xacec('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x28'),_0xacec('0x29')),'defaultValue':_0xacec('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xacec('0x2')]},'regexten':{'type':Sequelize[_0xacec('0x2')]},'fromdomain':{'type':Sequelize[_0xacec('0x2')]},'fromuser':{'type':Sequelize[_0xacec('0x2')]},'port':{'type':Sequelize[_0xacec('0x23')](0x5)},'qualify':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xacec('0x23')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xacec('0x2')]},'rtptimeout':{'type':Sequelize[_0xacec('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xacec('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xacec('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0xacec('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xacec('0x2')]},'callbackextension':{'type':Sequelize[_0xacec('0x2')]},'timert1':{'type':Sequelize[_0xacec('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xacec('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xacec('0x2')]},'use_q850_reason':{'type':Sequelize[_0xacec('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xacec('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xacec('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xacec('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xacec('0x2')]},'dtlscipher':{'type':Sequelize[_0xacec('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x2b'),'passive',_0xacec('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xacec('0x2')]},'usereqphone':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xacec('0x2')]},'call_limit':{'type':Sequelize[_0xacec('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xacec('0x1b'),'no')},'vmexten':{'type':Sequelize[_0xacec('0x2')]},'mohinterpret':{'type':Sequelize[_0xacec('0x2')]},'mohsuggest':{'type':Sequelize[_0xacec('0x2')]},'parkinglot':{'type':Sequelize[_0xacec('0x2')]},'description':{'type':Sequelize[_0xacec('0x2')]},'host':{'type':Sequelize[_0xacec('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xacec('0x4')](_0xacec('0x1b'),'no','nonat','update',_0xacec('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xacec('0x2')]},'active':{'type':Sequelize[_0xacec('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xacec('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xd409=['update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','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]','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','actpass','dynamic'];(function(_0xcd19f5,_0x350b2f){var _0x5ba480=function(_0x358b78){while(--_0x358b78){_0xcd19f5['push'](_0xcd19f5['shift']());}};_0x5ba480(++_0x350b2f);}(_0xd409,0x1d8));var _0x9d40=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0xd409[_0x32665e];return _0x10be45;};'use strict';var Sequelize=require(_0x9d40('0x0'));module['exports']={'name':{'type':Sequelize[_0x9d40('0x1')],'allowNull':![],'unique':_0x9d40('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x4'),_0x9d40('0x5'),_0x9d40('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x9d40('0x1')],'allowNull':![],'defaultValue':_0x9d40('0x7')},'callingpres':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x8'),_0x9d40('0x9'),_0x9d40('0xa'),'ALLOWED','PROHIB_NOT_SCREENED',_0x9d40('0xb'),'PROHIB_FAILED_SCREEN',_0x9d40('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x9d40('0x1')]},'secret':{'type':Sequelize[_0x9d40('0x1')]},'md5secret':{'type':Sequelize[_0x9d40('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x9d40('0x1')],'defaultValue':'udp','set':function(_0x47090e){this[_0x9d40('0xd')](_0x9d40('0xe'),_0x47090e?_0x47090e[_0x9d40('0xf')](','):null);},'get':function(){return this[_0x9d40('0x10')](_0x9d40('0xe'))?this[_0x9d40('0x10')](_0x9d40('0xe'))[_0x9d40('0x11')](','):null;},'comment':_0x9d40('0x12')},'dtmfmode':{'type':Sequelize[_0x9d40('0x3')]('rfc2833',_0x9d40('0x13'),_0x9d40('0x14'),_0x9d40('0x15'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no',_0x9d40('0x17'),_0x9d40('0x18'),_0x9d40('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9d40('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x9d40('0x1')],'defaultValue':_0x9d40('0x1a'),'set':function(_0x5540a5){this[_0x9d40('0xd')](_0x9d40('0x1b'),_0x5540a5?_0x5540a5[_0x9d40('0xf')](','):null);},'get':function(){return this[_0x9d40('0x10')](_0x9d40('0x1b'))?this['getDataValue'](_0x9d40('0x1b'))['split'](','):null;},'comment':_0x9d40('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9d40('0x1')]},'pickupgroup':{'type':Sequelize[_0x9d40('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x9d40('0x1')]},'language':{'type':Sequelize[_0x9d40('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9d40('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x9d40('0x1')],'allowNull':![],'defaultValue':_0x9d40('0x1d'),'set':function(_0x1b2c8f){this['setDataValue'](_0x9d40('0x1e'),_0x1b2c8f?_0x1b2c8f[_0x9d40('0xf')](';'):_0x9d40('0x1d'));},'get':function(){return this[_0x9d40('0x10')](_0x9d40('0x1e'))?this[_0x9d40('0x10')](_0x9d40('0x1e'))[_0x9d40('0x11')](';'):null;},'comment':_0x9d40('0x1f')},'autoframing':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'insecure':{'type':Sequelize[_0x9d40('0x1')],'defaultValue':'port,invite','set':function(_0x410f44){this[_0x9d40('0xd')](_0x9d40('0x20'),_0x410f44?_0x410f44[_0x9d40('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x9d40('0x20'))?this[_0x9d40('0x10')](_0x9d40('0x20'))[_0x9d40('0x11')](','):null;},'comment':_0x9d40('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x9d40('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9d40('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9d40('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x9d40('0x1')]},'callerid':{'type':Sequelize[_0x9d40('0x1')],'defaultValue':_0x9d40('0x22')},'amaflags':{'type':Sequelize[_0x9d40('0x1')]},'callcounter':{'type':Sequelize[_0x9d40('0x3')]('yes','no'),'defaultValue':_0x9d40('0x16')},'busylevel':{'type':Sequelize[_0x9d40('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9d40('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x9d40('0x1')]},'template':{'type':Sequelize[_0x9d40('0x1')]},'videosupport':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no',_0x9d40('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9d40('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9d40('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x9d40('0x1')]},'session_timers':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x25'),_0x9d40('0x26'),_0x9d40('0x27'))},'session_expires':{'type':Sequelize[_0x9d40('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x9d40('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x9d40('0x3')]('uac',_0x9d40('0x28')),'defaultValue':_0x9d40('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x9d40('0x1')]},'regexten':{'type':Sequelize[_0x9d40('0x1')]},'fromdomain':{'type':Sequelize[_0x9d40('0x1')]},'fromuser':{'type':Sequelize[_0x9d40('0x1')]},'port':{'type':Sequelize[_0x9d40('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x9d40('0x16'),'no'),'defaultValue':_0x9d40('0x16')},'keepalive':{'type':Sequelize[_0x9d40('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x9d40('0x1')]},'defaultuser':{'type':Sequelize[_0x9d40('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no',_0x9d40('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x9d40('0x1')]},'timert1':{'type':Sequelize[_0x9d40('0x23')](0xb)},'timerb':{'type':Sequelize[_0x9d40('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x9d40('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x9d40('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x9d40('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x9d40('0x23')](0xb)},'encryption':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'force_avp':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'icesupport':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no',_0x9d40('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x9d40('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x9d40('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x9d40('0x1')]},'dtlscapath':{'type':Sequelize[_0x9d40('0x1')]},'dtlssetup':{'type':Sequelize[_0x9d40('0x3')]('active','passive',_0x9d40('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9d40('0x1')]},'usereqphone':{'type':Sequelize[_0x9d40('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9d40('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x9d40('0x1')]},'mohinterpret':{'type':Sequelize[_0x9d40('0x1')]},'mohsuggest':{'type':Sequelize[_0x9d40('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d40('0x1')]},'host':{'type':Sequelize[_0x9d40('0x1')],'defaultValue':_0x9d40('0x2c')},'canreinvite':{'type':Sequelize[_0x9d40('0x3')](_0x9d40('0x16'),'no',_0x9d40('0x17'),_0x9d40('0x18'),_0x9d40('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9d40('0x1')]},'otherFields':{'type':Sequelize[_0x9d40('0x1')]},'active':{'type':Sequelize[_0x9d40('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 5ddc2c3..9fa9f48 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 _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x4b84[_0x2e7a43];return _0x52e9e1;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0xf3cd=['length','limit','sort','where','filter','merge','options','Trunk','includeAll','include','findAll','show','find','clone','createdAt','updatedAt','omit','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','offset','count','json','reject','save','update','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3c8e13,_0x5811d4){var _0x33bbf8=function(_0x47c30c){while(--_0x47c30c){_0x3c8e13['push'](_0x3c8e13['shift']());}};_0x33bbf8(++_0x5811d4);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0xf3cd[_0x1deee5];return _0x1d6c3a;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf3c('0x1a'));var client=jayson[_0xdf3c('0x1b')][_0xdf3c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17319c,_0x59e431,_0x2ae4ad,_0x461079){return new BPromise(function(_0x13ea5f,_0x5e0047){var _0x18aafa=_0x461079||client;return _0x18aafa[_0xdf3c('0x1d')](_0x17319c,_0x2ae4ad)[_0xdf3c('0x1e')](function(_0x4274fd){logger[_0xdf3c('0x1f')](_0xdf3c('0x20'),_0x59e431,_0xdf3c('0x21'));logger[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x59e431,_0xdf3c('0x21'),JSON['stringify'](_0x4274fd));if(_0x4274fd[_0xdf3c('0x24')]){if(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x25')]===0x1f4){logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x5e0047(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);}logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x13ea5f(_0x4274fd['error']['message']);}else{logger[_0xdf3c('0x1f')]('Trunk,\x20%s,\x20%s',_0x59e431,_0xdf3c('0x21'));_0x13ea5f(_0x4274fd[_0xdf3c('0x27')][_0xdf3c('0x26')]);}})[_0xdf3c('0x28')](function(_0x33652f){logger[_0xdf3c('0x24')]('Trunk,\x20%s,\x20%s',_0x59e431,_0x33652f);_0x5e0047(_0x33652f);});});}function respondWithStatusCode(_0x22a164,_0x213d75){_0x213d75=_0x213d75||0xcc;return function(_0x13e3ca){if(_0x13e3ca){return _0x22a164[_0xdf3c('0x29')](_0x213d75);}return _0x22a164[_0xdf3c('0x2a')](_0x213d75)[_0xdf3c('0x2b')]();};}function respondWithResult(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0xc8;return function(_0x18cb46){if(_0x18cb46){return _0xef54cb[_0xdf3c('0x2a')](_0x155f54)['json'](_0x18cb46);}};}function respondWithFilteredResult(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){var _0xdc8962=typeof _0x153daa['offset']==='undefined'&&typeof _0x153daa['limit']===_0xdf3c('0x2c');var _0x186bba=_0x4b57a4['count'];var _0x5c3b5a=_0xdc8962?0x0:_0x153daa[_0xdf3c('0x2d')];var _0x1f2ce4=_0xdc8962?_0x4b57a4[_0xdf3c('0x2e')]:_0x153daa[_0xdf3c('0x2d')]+_0x153daa['limit'];var _0x43ce06;if(_0x1f2ce4>=_0x186bba){_0x1f2ce4=_0x186bba;_0x43ce06=0xc8;}else{_0x43ce06=0xce;}_0xd284d7[_0xdf3c('0x2a')](_0x43ce06);return _0xd284d7['set']('Content-Range',_0x5c3b5a+'-'+_0x1f2ce4+'/'+_0x186bba)[_0xdf3c('0x2f')](_0x4b57a4);}return null;};}function patchUpdates(_0x46f0e3){return function(_0x36937e){try{jsonpatch['apply'](_0x36937e,_0x46f0e3,!![]);}catch(_0x2355f6){return BPromise[_0xdf3c('0x30')](_0x2355f6);}return _0x36937e[_0xdf3c('0x31')]();};}function saveUpdates(_0x10099e,_0x575ae1){return function(_0xda0de0){if(_0xda0de0){return _0xda0de0[_0xdf3c('0x32')](_0x10099e)['then'](function(_0x40ae3d){return _0x40ae3d;});}return null;};}function removeEntity(_0x3daeda,_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x1e')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x33')]({'plain':!![]});var _0x3b9ce8='Trunks';return db[_0xdf3c('0x34')][_0xdf3c('0x35')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x3daeda[_0xdf3c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115,_0x5e8130){return function(_0x57faba){if(!_0x57faba){_0x216115['sendStatus'](0x194);}return _0x57faba;};}function handleError(_0x44a478,_0x2ee9ad){_0x2ee9ad=_0x2ee9ad||0x1f4;return function(_0x1d0b8a){logger[_0xdf3c('0x24')](_0x1d0b8a['stack']);if(_0x1d0b8a['name']){delete _0x1d0b8a[_0xdf3c('0x36')];}_0x44a478['status'](_0x2ee9ad)[_0xdf3c('0x37')](_0x1d0b8a);};}exports[_0xdf3c('0x38')]=function(_0x3628ae,_0xcdd731){var _0x1004e9={},_0x1e0cf2={},_0x1c7335={'count':0x0,'rows':[]};var _0x809f3d=_[_0xdf3c('0x39')](db['Trunk'][_0xdf3c('0x3a')],function(_0x54e689){return{'name':_0x54e689['fieldName'],'type':_0x54e689[_0xdf3c('0x3b')]['key']};});_0x1e0cf2[_0xdf3c('0x3c')]=_['map'](_0x809f3d,_0xdf3c('0x36'));_0x1e0cf2[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x3628ae[_0xdf3c('0x3d')]);_0x1e0cf2[_0xdf3c('0x3f')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],_0x1e0cf2[_0xdf3c('0x3d')]);_0x1004e9[_0xdf3c('0x41')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x3628ae['query']['fields']));_0x1004e9[_0xdf3c('0x41')]=_0x1004e9['attributes'][_0xdf3c('0x43')]?_0x1004e9[_0xdf3c('0x41')]:_0x1e0cf2[_0xdf3c('0x3c')];if(!_0x3628ae[_0xdf3c('0x3d')]['hasOwnProperty']('nolimit')){_0x1004e9[_0xdf3c('0x44')]=qs[_0xdf3c('0x44')](_0x3628ae[_0xdf3c('0x3d')]['limit']);_0x1004e9[_0xdf3c('0x2d')]=qs[_0xdf3c('0x2d')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x2d')]);}_0x1004e9['order']=qs[_0xdf3c('0x45')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x45')]);_0x1004e9[_0xdf3c('0x46')]=qs[_0xdf3c('0x3f')](_['pick'](_0x3628ae[_0xdf3c('0x3d')],_0x1e0cf2[_0xdf3c('0x3f')]),_0x809f3d);if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]){_0x1004e9[_0xdf3c('0x46')]=_[_0xdf3c('0x48')](_0x1004e9['where'],{'$or':_['map'](_0x809f3d,function(_0x2c6c6d){if(_0x2c6c6d[_0xdf3c('0x3b')]!=='VIRTUAL'){var _0x5c9885={};_0x5c9885[_0x2c6c6d[_0xdf3c('0x36')]]={'$like':'%'+_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]+'%'};return _0x5c9885;}})});}_0x1004e9=_[_0xdf3c('0x48')]({},_0x1004e9,_0x3628ae[_0xdf3c('0x49')]);var _0x2dbf54={'where':_0x1004e9[_0xdf3c('0x46')]};return db[_0xdf3c('0x4a')][_0xdf3c('0x2e')](_0x2dbf54)['then'](function(_0x129c2a){_0x1c7335[_0xdf3c('0x2e')]=_0x129c2a;if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x1004e9[_0xdf3c('0x4c')]=[{'all':!![]}];}return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')](_0x1004e9);})['then'](function(_0x1751a8){_0x1c7335['rows']=_0x1751a8;return _0x1c7335;})[_0xdf3c('0x1e')](respondWithFilteredResult(_0xcdd731,_0x1004e9))['catch'](handleError(_0xcdd731,null));};exports[_0xdf3c('0x4e')]=function(_0x28144f,_0x2ec575){var _0x94c5b9={'raw':![],'where':{'id':_0x28144f['params']['id']}},_0x5eef94={};_0x5eef94['model']=_[_0xdf3c('0x3e')](db['Trunk'][_0xdf3c('0x3a')]);_0x5eef94[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x28144f[_0xdf3c('0x3d')]);_0x5eef94[_0xdf3c('0x3f')]=_['intersection'](_0x5eef94['model'],_0x5eef94[_0xdf3c('0x3d')]);_0x94c5b9[_0xdf3c('0x41')]=_['intersection'](_0x5eef94[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x94c5b9[_0xdf3c('0x41')]=_0x94c5b9[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x94c5b9['attributes']:_0x5eef94['model'];if(_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x94c5b9[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x94c5b9=_[_0xdf3c('0x48')]({},_0x94c5b9,_0x28144f[_0xdf3c('0x49')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x94c5b9)[_0xdf3c('0x1e')](handleEntityNotFound(_0x2ec575,null))[_0xdf3c('0x1e')](respondWithResult(_0x2ec575,null))[_0xdf3c('0x28')](handleError(_0x2ec575,null));};exports[_0xdf3c('0x50')]=function(_0x4cb28f,_0x1eebcf){var _0x47cb74={'where':{'id':_0x4cb28f['params']['id']}},_0x5e7247={};_0x5e7247['model']=_['keys'](db[_0xdf3c('0x4a')][_0xdf3c('0x3a')]);_0x47cb74['attributes']=_[_0xdf3c('0x40')](_0x5e7247[_0xdf3c('0x3c')],qs['fields'](_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x47cb74[_0xdf3c('0x41')]=_0x47cb74[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x47cb74[_0xdf3c('0x41')]:_0x5e7247[_0xdf3c('0x3c')];if(_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x47cb74[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x47cb74=_[_0xdf3c('0x48')]({},_0x47cb74,_0x4cb28f['options']);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x47cb74)[_0xdf3c('0x1e')](handleEntityNotFound(_0x1eebcf,null))['then'](function(_0x245c68){if(_0x245c68){var _0x3e327e=_0x245c68[_0xdf3c('0x33')]({'plain':!![]});_0x3e327e=qs['omit'](_0x3e327e,['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);_0x4cb28f['body']=_[_0xdf3c('0x53')](_0x4cb28f['body'],['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_[_0xdf3c('0x48')](_0x3e327e,_0x4cb28f[_0xdf3c('0x55')]),{'include':_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]?[{'all':!![]}]:undefined})[_0xdf3c('0x1e')](function(_0x330730){var _0x283be2=_0x4cb28f[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x283be2)throw new Error(_0xdf3c('0x57'));if(_0x283be2[_0xdf3c('0x58')]===_0xdf3c('0x56')){var _0xd7fb2d=_0x330730['get']({'plain':!![]});var _0x4dade5=_0xdf3c('0x59');return db[_0xdf3c('0x5a')][_0xdf3c('0x4f')]({'where':{'name':_0x4dade5,'userProfileId':_0x283be2['userProfileId']},'raw':!![]})[_0xdf3c('0x1e')](function(_0x5f2765){if(_0x5f2765&&_0x5f2765['autoAssociation']===0x0){return db[_0xdf3c('0x34')][_0xdf3c('0x54')]({'name':_0xd7fb2d[_0xdf3c('0x36')],'resourceId':_0xd7fb2d['id'],'type':_0x5f2765[_0xdf3c('0x36')],'sectionId':_0x5f2765['id']},{})[_0xdf3c('0x1e')](function(){return _0x330730;});}else{return _0x330730;}})[_0xdf3c('0x28')](function(_0x1a31d7){logger[_0xdf3c('0x24')](_0xdf3c('0x5b'),_0x1a31d7);throw _0x1a31d7;});}return _0x330730;});}})[_0xdf3c('0x1e')](respondWithResult(_0x1eebcf,0xc9))[_0xdf3c('0x28')](handleError(_0x1eebcf,null));};exports[_0xdf3c('0x54')]=function(_0x34000c,_0x4be79a,_0x3febac){var _0x2cb0f5;return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_0x34000c[_0xdf3c('0x55')],{'raw':!![]})['then'](function(_0x18bf4f){_0x2cb0f5=_0x18bf4f;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x1efa9c){var _0x50805c=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x5f')),'utf8');var _0xb867a1=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x19c851=ejs['render'](_0x50805c,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x19c851);if(_0x2cb0f5['registry']){var _0x52a2e1=ejs[_0xdf3c('0x64')](_0xb867a1,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x52a2e1);}})[_0xdf3c('0x1e')](function(){return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x54'),{'module':_0xdf3c('0x67')});})[_0xdf3c('0x1e')](function(){var _0x5e6606=_0x34000c[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x5e6606)throw new Error(_0xdf3c('0x57'));if(_0x5e6606['role']===_0xdf3c('0x56')){var _0x354ff4=_0x2cb0f5[_0xdf3c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xdf3c('0x4f')]({'where':{'name':_0xdf3c('0x59'),'userProfileId':_0x5e6606[_0xdf3c('0x68')]},'raw':!![]})[_0xdf3c('0x1e')](function(_0xe01538){if(_0xe01538&&_0xe01538[_0xdf3c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x354ff4['name'],'resourceId':_0x354ff4['id'],'type':_0xe01538['name'],'sectionId':_0xe01538['id']},{})['then'](function(){return _0x2cb0f5;});}else{return _0x2cb0f5;}})[_0xdf3c('0x28')](function(_0x3f43a0){logger[_0xdf3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f43a0);throw _0x3f43a0;});}return _0x2cb0f5;})[_0xdf3c('0x1e')](respondWithResult(_0x4be79a,0xc9))[_0xdf3c('0x28')](handleError(_0x4be79a,null));};exports[_0xdf3c('0x32')]=function(_0x51e8c6,_0x591936,_0x233718){var _0x4e3517;return db[_0xdf3c('0x4a')]['find']({'where':{'id':_0x51e8c6[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x591936,null))[_0xdf3c('0x1e')](saveUpdates(_0x51e8c6[_0xdf3c('0x55')],null))['then'](function(_0x5148f6){if(_0x5148f6){_0x4e3517=_0x5148f6;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});}})[_0xdf3c('0x1e')](function(_0x12a7b0){if(_0x12a7b0){var _0x39d9f0=fs[_0xdf3c('0x5c')](path['join'](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x9c761a=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/registry.ejs'),_0xdf3c('0x61'));var _0x5c27cc=ejs[_0xdf3c('0x64')](_0x39d9f0,{'trunks':_0x12a7b0||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5c27cc);var _0x53b0c3=ejs['render'](_0x9c761a,{'trunks':_0x12a7b0||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x53b0c3);return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x32'),{'module':_0xdf3c('0x67')});}return null;})[_0xdf3c('0x1e')](function(_0x5c8e5e){if(_0x5c8e5e){return _0x4e3517;}})[_0xdf3c('0x1e')](respondWithResult(_0x591936,null))['catch'](handleError(_0x591936,null));};exports[_0xdf3c('0x35')]=function(_0x389708,_0x2e5f82,_0x15a057){var _0x320452;return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')]({'where':{'id':_0x389708[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x2e5f82,null))[_0xdf3c('0x1e')](removeEntity(_0x2e5f82,null))[_0xdf3c('0x1e')](function(){return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x55fd73){var _0x118ab5=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x1c8fe4=fs['readFileSync'](path['join'](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x1aaf8b=ejs[_0xdf3c('0x64')](_0x118ab5,{'trunks':_0x55fd73});var _0x56fc77=ejs[_0xdf3c('0x64')](_0x1c8fe4,{'trunks':_0x55fd73});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x1aaf8b);fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x56fc77);return respondWithRpcPromise(_0xdf3c('0x66'),'destroy',{'module':_0xdf3c('0x67')});})[_0xdf3c('0x28')](handleError(_0x2e5f82,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 9ec1c75..bdd6289 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 _0xa5bd=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger'];(function(_0x13248d,_0x35184a){var _0x564f27=function(_0x32ce2c){while(--_0x32ce2c){_0x13248d['push'](_0x13248d['shift']());}};_0x564f27(++_0x35184a);}(_0xa5bd,0x191));var _0xda5b=function(_0x1ee7e4,_0x4ba132){_0x1ee7e4=_0x1ee7e4-0x0;var _0x4a99aa=_0xa5bd[_0x1ee7e4];return _0x4a99aa;};'use strict';var _=require(_0xda5b('0x0'));var util=require('util');var logger=require(_0xda5b('0x1'))(_0xda5b('0x2'));var moment=require(_0xda5b('0x3'));var BPromise=require(_0xda5b('0x4'));var rp=require(_0xda5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda5b('0x6'));var config=require(_0xda5b('0x7'));var attributes=require(_0xda5b('0x8'));module[_0xda5b('0x9')]=function(_0x393b53,_0xdfb84f){return _0x393b53[_0xda5b('0xa')](_0xda5b('0xb'),attributes,{'tableName':_0xda5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda42=['tools_trunks','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Trunk'];(function(_0xd94fab,_0x4a85ac){var _0x44fded=function(_0x20037e){while(--_0x20037e){_0xd94fab['push'](_0xd94fab['shift']());}};_0x44fded(++_0x4a85ac);}(_0xda42,0x64));var _0x2da4=function(_0x5f247d,_0x74a736){_0x5f247d=_0x5f247d-0x0;var _0x2af387=_0xda42[_0x5f247d];return _0x2af387;};'use strict';var _=require(_0x2da4('0x0'));var util=require('util');var logger=require(_0x2da4('0x1'))(_0x2da4('0x2'));var moment=require(_0x2da4('0x3'));var BPromise=require(_0x2da4('0x4'));var rp=require(_0x2da4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2da4('0x6'));var config=require(_0x2da4('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0x211cbd,_0x540b23){return _0x211cbd[_0x2da4('0x8')](_0x2da4('0x9'),attributes,{'tableName':_0x2da4('0xa'),'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 7f43599..5192848 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 _0x1275=['include','map','model','attributes','GetTrunk','ShowTrunk','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','catch','Trunk','options','raw','where','limit'];(function(_0x9472f6,_0x46fbaa){var _0x32802d=function(_0x35e2b1){while(--_0x35e2b1){_0x9472f6['push'](_0x9472f6['shift']());}};_0x32802d(++_0x46fbaa);}(_0x1275,0x128));var _0x5127=function(_0x765c44,_0x11e252){_0x765c44=_0x765c44-0x0;var _0x335d41=_0x1275[_0x765c44];return _0x335d41;};'use strict';var _=require(_0x5127('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5127('0x1'));var rs=require(_0x5127('0x2'));var fs=require('fs');var Redis=require(_0x5127('0x3'));var db=require(_0x5127('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5127('0x5'))('rpc');var config=require(_0x5127('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bf0c7,_0x3f42f7,_0x92d971){return new BPromise(function(_0x5a9099,_0x1bc7bc){return client[_0x5127('0x7')](_0x5bf0c7,_0x92d971)[_0x5127('0x8')](function(_0x2a4032){logger[_0x5127('0x9')]('Trunk,\x20%s,\x20%s',_0x3f42f7,_0x5127('0xa'));logger[_0x5127('0xb')](_0x5127('0xc'),_0x3f42f7,'request\x20sent',JSON[_0x5127('0xd')](_0x2a4032));if(_0x2a4032[_0x5127('0xe')]){if(_0x2a4032[_0x5127('0xe')]['code']===0x1f4){logger[_0x5127('0xe')](_0x5127('0xf'),_0x3f42f7,_0x2a4032[_0x5127('0xe')][_0x5127('0x10')]);return _0x1bc7bc(_0x2a4032[_0x5127('0xe')][_0x5127('0x10')]);}logger[_0x5127('0xe')]('Trunk,\x20%s,\x20%s',_0x3f42f7,_0x2a4032['error'][_0x5127('0x10')]);return _0x5a9099(_0x2a4032['error'][_0x5127('0x10')]);}else{logger[_0x5127('0x9')](_0x5127('0xf'),_0x3f42f7,_0x5127('0xa'));_0x5a9099(_0x2a4032['result'][_0x5127('0x10')]);}})[_0x5127('0x11')](function(_0x3a0e30){logger[_0x5127('0xe')]('Trunk,\x20%s,\x20%s',_0x3f42f7,_0x3a0e30);_0x1bc7bc(_0x3a0e30);});});}exports['GetTrunk']=function(_0x803d4c){var _0x31e3e7=this;return new Promise(function(_0xb86f57,_0x1e28f7){return db[_0x5127('0x12')]['findAll']({'raw':_0x803d4c[_0x5127('0x13')]?_0x803d4c['options'][_0x5127('0x14')]===undefined?!![]:![]:!![],'where':_0x803d4c['options']?_0x803d4c['options'][_0x5127('0x15')]||null:null,'attributes':_0x803d4c[_0x5127('0x13')]?_0x803d4c[_0x5127('0x13')]['attributes']||null:null,'limit':_0x803d4c['options']?_0x803d4c['options'][_0x5127('0x16')]||null:null,'include':_0x803d4c[_0x5127('0x13')]?_0x803d4c[_0x5127('0x13')][_0x5127('0x17')]?_[_0x5127('0x18')](_0x803d4c[_0x5127('0x13')][_0x5127('0x17')],function(_0x42d569){return{'model':db[_0x42d569['model']],'as':_0x42d569['as'],'attributes':_0x42d569['attributes'],'include':_0x42d569[_0x5127('0x17')]?_['map'](_0x42d569[_0x5127('0x17')],function(_0xc5dc27){return{'model':db[_0xc5dc27[_0x5127('0x19')]],'as':_0xc5dc27['as'],'attributes':_0xc5dc27[_0x5127('0x1a')],'include':_0xc5dc27[_0x5127('0x17')]?_[_0x5127('0x18')](_0xc5dc27[_0x5127('0x17')],function(_0x23a6ea){return{'model':db[_0x23a6ea[_0x5127('0x19')]],'as':_0x23a6ea['as'],'attributes':_0x23a6ea[_0x5127('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5127('0x8')](function(_0xcdb6c6){logger['info'](_0x5127('0x1b'),_0x803d4c);logger[_0x5127('0xb')](_0x5127('0x1b'),_0x803d4c,JSON['stringify'](_0xcdb6c6));_0xb86f57(_0xcdb6c6);})[_0x5127('0x11')](function(_0x54cd55){logger[_0x5127('0xe')](_0x5127('0x1b'),_0x54cd55['message'],_0x803d4c);_0x1e28f7(_0x31e3e7[_0x5127('0xe')](0x1f4,_0x54cd55[_0x5127('0x10')]));});});};exports[_0x5127('0x1c')]=function(_0x269a6d){var _0x145cdf=this;return new Promise(function(_0x1ca0de,_0x52caf1){return db[_0x5127('0x12')]['find']({'raw':_0x269a6d[_0x5127('0x13')]?_0x269a6d[_0x5127('0x13')][_0x5127('0x14')]===undefined?!![]:![]:!![],'where':_0x269a6d[_0x5127('0x13')]?_0x269a6d[_0x5127('0x13')]['where']||null:null,'attributes':_0x269a6d[_0x5127('0x13')]?_0x269a6d[_0x5127('0x13')][_0x5127('0x1a')]||null:null,'include':_0x269a6d[_0x5127('0x13')]?_0x269a6d[_0x5127('0x13')][_0x5127('0x17')]?_[_0x5127('0x18')](_0x269a6d[_0x5127('0x13')][_0x5127('0x17')],function(_0x2aaf63){return{'model':db[_0x2aaf63[_0x5127('0x19')]],'as':_0x2aaf63['as'],'attributes':_0x2aaf63[_0x5127('0x1a')],'include':_0x2aaf63[_0x5127('0x17')]?_['map'](_0x2aaf63['include'],function(_0x259364){return{'model':db[_0x259364[_0x5127('0x19')]],'as':_0x259364['as'],'attributes':_0x259364[_0x5127('0x1a')],'include':_0x259364[_0x5127('0x17')]?_[_0x5127('0x18')](_0x259364[_0x5127('0x17')],function(_0x3c6317){return{'model':db[_0x3c6317[_0x5127('0x19')]],'as':_0x3c6317['as'],'attributes':_0x3c6317[_0x5127('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5127('0x8')](function(_0x1f48a9){logger[_0x5127('0x9')](_0x5127('0x1c'),_0x269a6d);logger[_0x5127('0xb')]('ShowTrunk',_0x269a6d,JSON[_0x5127('0xd')](_0x1f48a9));_0x1ca0de(_0x1f48a9);})['catch'](function(_0x1c7c50){logger['error'](_0x5127('0x1c'),_0x1c7c50[_0x5127('0x10')],_0x269a6d);_0x52caf1(_0x145cdf[_0x5127('0xe')](0x1f4,_0x1c7c50[_0x5127('0x10')]));});});}; \ No newline at end of file +var _0xf26f=['catch','GetTrunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','Trunk','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xd20f56,_0x4289bf){var _0x366917=function(_0x46b37c){while(--_0x46b37c){_0xd20f56['push'](_0xd20f56['shift']());}};_0x366917(++_0x4289bf);}(_0xf26f,0xdf));var _0xff26=function(_0x45b733,_0x1162bc){_0x45b733=_0x45b733-0x0;var _0x257e01=_0xf26f[_0x45b733];return _0x257e01;};'use strict';var _=require('lodash');var util=require(_0xff26('0x0'));var moment=require(_0xff26('0x1'));var BPromise=require(_0xff26('0x2'));var rs=require(_0xff26('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff26('0x4'))['db'];var utils=require(_0xff26('0x5'));var logger=require('../../config/logger')(_0xff26('0x6'));var config=require(_0xff26('0x7'));var jayson=require(_0xff26('0x8'));var client=jayson[_0xff26('0x9')][_0xff26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee1138,_0x5abdc8,_0x415ebb){return new BPromise(function(_0x4be6e1,_0x24b37b){return client[_0xff26('0xb')](_0xee1138,_0x415ebb)[_0xff26('0xc')](function(_0x1315c4){logger[_0xff26('0xd')](_0xff26('0xe'),_0x5abdc8,_0xff26('0xf'));logger[_0xff26('0x10')](_0xff26('0x11'),_0x5abdc8,_0xff26('0xf'),JSON[_0xff26('0x12')](_0x1315c4));if(_0x1315c4[_0xff26('0x13')]){if(_0x1315c4[_0xff26('0x13')]['code']===0x1f4){logger[_0xff26('0x13')](_0xff26('0xe'),_0x5abdc8,_0x1315c4[_0xff26('0x13')][_0xff26('0x14')]);return _0x24b37b(_0x1315c4[_0xff26('0x13')][_0xff26('0x14')]);}logger[_0xff26('0x13')]('Trunk,\x20%s,\x20%s',_0x5abdc8,_0x1315c4[_0xff26('0x13')][_0xff26('0x14')]);return _0x4be6e1(_0x1315c4[_0xff26('0x13')][_0xff26('0x14')]);}else{logger[_0xff26('0xd')](_0xff26('0xe'),_0x5abdc8,_0xff26('0xf'));_0x4be6e1(_0x1315c4[_0xff26('0x15')][_0xff26('0x14')]);}})[_0xff26('0x16')](function(_0x3dc694){logger[_0xff26('0x13')]('Trunk,\x20%s,\x20%s',_0x5abdc8,_0x3dc694);_0x24b37b(_0x3dc694);});});}exports[_0xff26('0x17')]=function(_0x3948c3){var _0x14342a=this;return new Promise(function(_0xc8f2ff,_0x49a951){return db['Trunk'][_0xff26('0x18')]({'raw':_0x3948c3['options']?_0x3948c3[_0xff26('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3948c3[_0xff26('0x19')]?_0x3948c3[_0xff26('0x19')][_0xff26('0x1a')]||null:null,'attributes':_0x3948c3[_0xff26('0x19')]?_0x3948c3[_0xff26('0x19')][_0xff26('0x1b')]||null:null,'limit':_0x3948c3[_0xff26('0x19')]?_0x3948c3['options'][_0xff26('0x1c')]||null:null,'include':_0x3948c3[_0xff26('0x19')]?_0x3948c3[_0xff26('0x19')][_0xff26('0x1d')]?_[_0xff26('0x1e')](_0x3948c3[_0xff26('0x19')][_0xff26('0x1d')],function(_0x198fae){return{'model':db[_0x198fae['model']],'as':_0x198fae['as'],'attributes':_0x198fae[_0xff26('0x1b')],'include':_0x198fae[_0xff26('0x1d')]?_[_0xff26('0x1e')](_0x198fae['include'],function(_0x414f3b){return{'model':db[_0x414f3b[_0xff26('0x1f')]],'as':_0x414f3b['as'],'attributes':_0x414f3b['attributes'],'include':_0x414f3b[_0xff26('0x1d')]?_[_0xff26('0x1e')](_0x414f3b[_0xff26('0x1d')],function(_0x4e75f5){return{'model':db[_0x4e75f5[_0xff26('0x1f')]],'as':_0x4e75f5['as'],'attributes':_0x4e75f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xff26('0xc')](function(_0x1fcf81){logger[_0xff26('0xd')](_0xff26('0x17'),_0x3948c3);logger[_0xff26('0x10')]('GetTrunk',_0x3948c3,JSON[_0xff26('0x12')](_0x1fcf81));_0xc8f2ff(_0x1fcf81);})[_0xff26('0x16')](function(_0x3a3156){logger[_0xff26('0x13')]('GetTrunk',_0x3a3156[_0xff26('0x14')],_0x3948c3);_0x49a951(_0x14342a[_0xff26('0x13')](0x1f4,_0x3a3156[_0xff26('0x14')]));});});};exports[_0xff26('0x20')]=function(_0x96d026){var _0xe4df9d=this;return new Promise(function(_0x56ae94,_0x29c985){return db[_0xff26('0x21')]['find']({'raw':_0x96d026[_0xff26('0x19')]?_0x96d026[_0xff26('0x19')][_0xff26('0x22')]===undefined?!![]:![]:!![],'where':_0x96d026[_0xff26('0x19')]?_0x96d026[_0xff26('0x19')]['where']||null:null,'attributes':_0x96d026[_0xff26('0x19')]?_0x96d026[_0xff26('0x19')]['attributes']||null:null,'include':_0x96d026[_0xff26('0x19')]?_0x96d026['options']['include']?_['map'](_0x96d026['options'][_0xff26('0x1d')],function(_0x2fb14f){return{'model':db[_0x2fb14f[_0xff26('0x1f')]],'as':_0x2fb14f['as'],'attributes':_0x2fb14f[_0xff26('0x1b')],'include':_0x2fb14f['include']?_[_0xff26('0x1e')](_0x2fb14f[_0xff26('0x1d')],function(_0xdf1862){return{'model':db[_0xdf1862[_0xff26('0x1f')]],'as':_0xdf1862['as'],'attributes':_0xdf1862['attributes'],'include':_0xdf1862[_0xff26('0x1d')]?_[_0xff26('0x1e')](_0xdf1862[_0xff26('0x1d')],function(_0x264e1b){return{'model':db[_0x264e1b[_0xff26('0x1f')]],'as':_0x264e1b['as'],'attributes':_0x264e1b[_0xff26('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d3dfd){logger[_0xff26('0xd')](_0xff26('0x20'),_0x96d026);logger['debug'](_0xff26('0x20'),_0x96d026,JSON[_0xff26('0x12')](_0x4d3dfd));_0x56ae94(_0x4d3dfd);})['catch'](function(_0x36df27){logger[_0xff26('0x13')](_0xff26('0x20'),_0x36df27[_0xff26('0x14')],_0x96d026);_0x29c985(_0xe4df9d['error'](0x1f4,_0x36df27[_0xff26('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 59547d5..28519a3 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 _0xeff9=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x2a6796,_0x4d0ab0){var _0xd84fed=function(_0x45b890){while(--_0x45b890){_0x2a6796['push'](_0x2a6796['shift']());}};_0xd84fed(++_0x4d0ab0);}(_0xeff9,0x18d));var _0x9eff=function(_0x50292b,_0x454be6){_0x50292b=_0x50292b-0x0;var _0xb1a315=_0xeff9[_0x50292b];return _0xb1a315;};'use strict';var express=require(_0x9eff('0x0'));var router=express[_0x9eff('0x1')]();var auth=require(_0x9eff('0x2'));var controller=require(_0x9eff('0x3'));router[_0x9eff('0x4')](_0x9eff('0x5'),auth[_0x9eff('0x6')](),controller[_0x9eff('0x7')]);module[_0x9eff('0x8')]=router; \ No newline at end of file +var _0xb6b6=['isAuthenticated','update','exports','express','Router','put','/:id'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0xb6b6,0x10d));var _0x6b6b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb6b6[_0xfae23b];return _0x200640;};'use strict';var express=require(_0x6b6b('0x0'));var router=express[_0x6b6b('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x6b6b('0x2')](_0x6b6b('0x3'),auth[_0x6b6b('0x4')](),controller[_0x6b6b('0x5')]);module[_0x6b6b('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 a9cebfc..8845e7e 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 _0xd215=['TEXT','UserId','sequelize','error','warning','info','debug','ENUM','BOOLEAN'];(function(_0x294969,_0xce801e){var _0x59482e=function(_0x26cc9b){while(--_0x26cc9b){_0x294969['push'](_0x294969['shift']());}};_0x59482e(++_0xce801e);}(_0xd215,0x16a));var _0x5d21=function(_0x15ce13,_0x4c034b){_0x15ce13=_0x15ce13-0x0;var _0x38aefe=_0xd215[_0x15ce13];return _0x38aefe;};'use strict';var Sequelize=require(_0x5d21('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x5d21('0x1'),_0x5d21('0x2'),_0x5d21('0x3'),_0x5d21('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x5d21('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5d21('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5d21('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5d21('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x5d21('0x8')}}; \ No newline at end of file +var _0x4762=['warning','info','debug','exports','ENUM','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x4762,0x77));var _0x2476=function(_0x3290f5,_0x208e31){_0x3290f5=_0x3290f5-0x0;var _0x393406=_0x4762[_0x3290f5];return _0x393406;};'use strict';var Sequelize=require(_0x2476('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x2476('0x1'),_0x2476('0x2'),_0x2476('0x3'),_0x2476('0x4')];module[_0x2476('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2476('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2476('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2476('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2476('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2476('0x9')],'unique':_0x2476('0xa')}}; \ 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 2ae1d5c..9c0a24d 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 _0x2821=['error','stack','name','send','update','user','role','admin','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','defaults','localhost','json','then','sendStatus'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0x2821,0xc3));var _0x1282=function(_0x2ddc0a,_0x344a3f){_0x2ddc0a=_0x2ddc0a-0x0;var _0x35ad69=_0x2821[_0x2ddc0a];return _0x35ad69;};'use strict';var _=require(_0x1282('0x0'));var Redis=require(_0x1282('0x1'));var logger=require(_0x1282('0x2'))(_0x1282('0x3'));var config=require(_0x1282('0x4'));var db=require(_0x1282('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x1282('0x6')]));require(_0x1282('0x7'))['register'](socket);config[_0x1282('0x6')]=_[_0x1282('0x8')](config[_0x1282('0x6')],{'host':_0x1282('0x9'),'port':0x18eb});function respondWithResult(_0xb5be26,_0x17a244){_0x17a244=_0x17a244||0xc8;return function(_0x296ffc){if(_0x296ffc){return _0xb5be26['status'](_0x17a244)[_0x1282('0xa')](_0x296ffc);}};}function saveUpdates(_0x48349c){return function(_0x5cb6b6){if(_0x5cb6b6){return _0x5cb6b6['update'](_0x48349c)[_0x1282('0xb')](function(_0xb4f761){return _0xb4f761;});}return null;};}function handleEntityNotFound(_0x3aba30){return function(_0x5c34ec){if(!_0x5c34ec){_0x3aba30[_0x1282('0xc')](0x194);}return _0x5c34ec;};}function handleError(_0x1cbfdd,_0x4c8105){_0x4c8105=_0x4c8105||0x1f4;return function(_0x484dca){logger[_0x1282('0xd')](_0x484dca[_0x1282('0xe')]);if(_0x484dca[_0x1282('0xf')]){delete _0x484dca['name'];}_0x1cbfdd['status'](_0x4c8105)[_0x1282('0x10')](_0x484dca);};}exports[_0x1282('0x11')]=function(_0x548899,_0x1ce472){if(_0x548899[_0x1282('0x12')][_0x1282('0x13')]!==_0x1282('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x548899[_0x1282('0x15')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x1282('0x16')][_0x1282('0x17')]({'where':{'id':_0x548899['params']['id']}})[_0x1282('0xb')](handleEntityNotFound(_0x1ce472,null))[_0x1282('0xb')](saveUpdates(_0x548899[_0x1282('0x18')],null))['then'](respondWithResult(_0x1ce472,null))[_0x1282('0x19')](handleError(_0x1ce472,null));}; \ No newline at end of file +var _0x8d9b=['../../config/environment','redis','register','json','update','then','sendStatus','error','stack','name','status','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var Redis=require(_0xb8d9('0x1'));var logger=require(_0xb8d9('0x2'))(_0xb8d9('0x3'));var config=require(_0xb8d9('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xb8d9('0x5')]));require('./user-setting.socket')[_0xb8d9('0x6')](socket);config[_0xb8d9('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x21c87d,_0x537b18){_0x537b18=_0x537b18||0xc8;return function(_0x53339b){if(_0x53339b){return _0x21c87d['status'](_0x537b18)[_0xb8d9('0x7')](_0x53339b);}};}function saveUpdates(_0x40e074){return function(_0x245d54){if(_0x245d54){return _0x245d54[_0xb8d9('0x8')](_0x40e074)[_0xb8d9('0x9')](function(_0x31d887){return _0x31d887;});}return null;};}function handleEntityNotFound(_0x211a49){return function(_0x48f36d){if(!_0x48f36d){_0x211a49[_0xb8d9('0xa')](0x194);}return _0x48f36d;};}function handleError(_0x59f638,_0x206075){_0x206075=_0x206075||0x1f4;return function(_0x2a60a4){logger[_0xb8d9('0xb')](_0x2a60a4[_0xb8d9('0xc')]);if(_0x2a60a4[_0xb8d9('0xd')]){delete _0x2a60a4[_0xb8d9('0xd')];}_0x59f638[_0xb8d9('0xe')](_0x206075)[_0xb8d9('0xf')](_0x2a60a4);};}exports[_0xb8d9('0x8')]=function(_0x11b664,_0x2b3223){if(_0x11b664[_0xb8d9('0x10')][_0xb8d9('0x11')]!==_0xb8d9('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x11b664[_0xb8d9('0x13')]['id'])))throw new Error(_0xb8d9('0x14'));return db[_0xb8d9('0x15')][_0xb8d9('0x16')]({'where':{'id':_0x11b664[_0xb8d9('0x13')]['id']}})['then'](handleEntityNotFound(_0x2b3223,null))['then'](saveUpdates(_0x11b664['body'],null))[_0xb8d9('0x9')](respondWithResult(_0x2b3223,null))[_0xb8d9('0x17')](handleError(_0x2b3223,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 cd2be44..4e1835c 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 _0x7861=['hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x2d72a0,_0x1b7c94){var _0x4c9c7a=function(_0x5bdecd){while(--_0x5bdecd){_0x2d72a0['push'](_0x2d72a0['shift']());}};_0x4c9c7a(++_0x1b7c94);}(_0x7861,0x1b0));var _0x1786=function(_0x4076ef,_0x3c2d8c){_0x4076ef=_0x4076ef-0x0;var _0x570bfd=_0x7861[_0x4076ef];return _0x570bfd;};'use strict';var EventEmitter=require(_0x1786('0x0'));var UserSetting=require(_0x1786('0x1'))['db'][_0x1786('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1786('0x3')](0x0);var events={'afterCreate':_0x1786('0x4'),'afterUpdate':_0x1786('0x5'),'afterDestroy':_0x1786('0x6')};function emitEvent(_0x28ba75){return function(_0x4f2fe5,_0x5f2a45,_0x1ba0c4){UserSettingEvents[_0x1786('0x7')](_0x28ba75+':'+_0x4f2fe5['id'],_0x4f2fe5);UserSettingEvents[_0x1786('0x7')](_0x28ba75,_0x4f2fe5);_0x1ba0c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x1786('0x8')](e,emitEvent(event));}}module[_0x1786('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x9853=['emit','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x9853,0xff));var _0x3985=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x9853[_0x21c6b8];return _0x39d474;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x3985('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x3985('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3985('0x2'),'afterDestroy':_0x3985('0x3')};function emitEvent(_0x1bd9a2){return function(_0x243c35,_0x2f98fd,_0x3a2c6f){UserSettingEvents['emit'](_0x1bd9a2+':'+_0x243c35['id'],_0x243c35);UserSettingEvents[_0x3985('0x4')](_0x1bd9a2,_0x243c35);_0x3a2c6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x3985('0x5')](e,emitEvent(event));}}module[_0x3985('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index d85ce47..a4fcda4 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 _0xb84e=['clientSideLoggingEnabledSince','exports','define','UserSetting','clientSideLoggingEnabled'];(function(_0x2ea80c,_0xaf95a5){var _0x340bfc=function(_0x1a32ed){while(--_0x1a32ed){_0x2ea80c['push'](_0x2ea80c['shift']());}};_0x340bfc(++_0xaf95a5);}(_0xb84e,0xbf));var _0xeb84=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xb84e[_0x42020e];return _0x561551;};'use strict';var attributes=require('./user-setting.attributes');module[_0xeb84('0x0')]=function(_0x6bfa05){return _0x6bfa05[_0xeb84('0x1')](_0xeb84('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x512746){if(!_0x512746[_0xeb84('0x3')])_0x512746[_0xeb84('0x4')]=null;else if(_0x512746[_0xeb84('0x4')]===null)_0x512746[_0xeb84('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xeb74=['exports','define','UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x255b90,_0x12802a){var _0x4fd833=function(_0x39b459){while(--_0x39b459){_0x255b90['push'](_0x255b90['shift']());}};_0x4fd833(++_0x12802a);}(_0xeb74,0xe3));var _0x4eb7=function(_0x3f1dbe,_0x2492c5){_0x3f1dbe=_0x3f1dbe-0x0;var _0x387538=_0xeb74[_0x3f1dbe];return _0x387538;};'use strict';var attributes=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]=function(_0x1dd325){return _0x1dd325[_0x4eb7('0x2')](_0x4eb7('0x3'),attributes,{'tableName':_0x4eb7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9f83f5){if(!_0x9f83f5['clientSideLoggingEnabled'])_0x9f83f5[_0x4eb7('0x5')]=null;else if(_0x9f83f5[_0x4eb7('0x5')]===null)_0x9f83f5[_0x4eb7('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 9847200..726bc4c 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 _0xd7eb=['user-setting:','./user-setting.events','save','emit','user-setting:update:user-','UserId','length'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd7eb,0xef));var _0xbd7e=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xd7eb[_0x2555d0];return _0x3bb486;};'use strict';var UserSettingEvents=require(_0xbd7e('0x0'));var events=[_0xbd7e('0x1'),'remove','update'];function createListener(_0x2c7ff7,_0x2cedd1){return function(_0x9c4726){_0x2cedd1[_0xbd7e('0x2')](_0x2c7ff7,_0x9c4726);if(_0x2c7ff7==='user-setting:update'){_0x2cedd1[_0xbd7e('0x2')](_0xbd7e('0x3')+_0x9c4726[_0xbd7e('0x4')],_0x9c4726);}};}exports['register']=function(_0x5121f9){for(var _0x257e3c=0x0,_0x578bdc=events[_0xbd7e('0x5')];_0x257e3c<_0x578bdc;_0x257e3c++){var _0x11f2f3=events[_0x257e3c];var _0x4edaff=createListener(_0xbd7e('0x6')+_0x11f2f3,_0x5121f9);UserSettingEvents['on'](_0x11f2f3,_0x4edaff);}}; \ No newline at end of file +var _0xeb8d=['user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','user-setting:update'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xeb8d,0x89));var _0xdeb8=function(_0x2750a0,_0x2ecb01){_0x2750a0=_0x2750a0-0x0;var _0x18300a=_0xeb8d[_0x2750a0];return _0x18300a;};'use strict';var UserSettingEvents=require(_0xdeb8('0x0'));var events=[_0xdeb8('0x1'),'remove','update'];function createListener(_0x268933,_0x51b135){return function(_0x2f480f){_0x51b135['emit'](_0x268933,_0x2f480f);if(_0x268933===_0xdeb8('0x2')){_0x51b135['emit'](_0xdeb8('0x3')+_0x2f480f['UserId'],_0x2f480f);}};}exports[_0xdeb8('0x4')]=function(_0x2a2844){for(var _0x45d162=0x0,_0x5b83f1=events[_0xdeb8('0x5')];_0x45d162<_0x5b83f1;_0x45d162++){var _0x112853=events[_0x45d162];var _0x554abb=createListener(_0xdeb8('0x6')+_0x112853,_0x2a2844);UserSettingEvents['on'](_0x112853,_0x554abb);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d6ec7d7..631c19c 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 _0x02d9=['update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','/whoami','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','addContacts','create','/create_many','post','addQueues','diskStorage','format','now','originalname','single','addAvatar','/:id/login','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','put','/:id'];(function(_0xa93267,_0x41407e){var _0x5dadb1=function(_0xaa3232){while(--_0xaa3232){_0xa93267['push'](_0xa93267['shift']());}};_0x5dadb1(++_0x41407e);}(_0x02d9,0x1d7));var _0x902d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x02d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x902d('0x0'));var util=require(_0x902d('0x1'));var path=require(_0x902d('0x2'));var timeout=require('connect-timeout');var express=require(_0x902d('0x3'));var router=express[_0x902d('0x4')]();var fs_extra=require(_0x902d('0x5'));var auth=require(_0x902d('0x6'));var interaction=require(_0x902d('0x7'));var config=require(_0x902d('0x8'));var controller=require(_0x902d('0x9'));router['get']('/',auth[_0x902d('0xa')](),controller['index']);router[_0x902d('0xb')](_0x902d('0xc'),auth[_0x902d('0xa')](),controller['describe']);router[_0x902d('0xb')](_0x902d('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0x902d('0xb')](_0x902d('0xe'),auth[_0x902d('0xa')](),controller[_0x902d('0xf')]);router[_0x902d('0xb')]('/:id',auth[_0x902d('0xa')](),controller[_0x902d('0x10')]);router[_0x902d('0xb')](_0x902d('0x11'),controller[_0x902d('0x12')]);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x902d('0x13')]);router['get'](_0x902d('0x14'),auth[_0x902d('0xa')](),controller[_0x902d('0x15')]);router[_0x902d('0xb')](_0x902d('0x16'),auth['isAuthenticated'](),controller[_0x902d('0x17')]);router[_0x902d('0xb')](_0x902d('0x18'),auth['isAuthenticated'](),controller[_0x902d('0x19')]);router[_0x902d('0xb')](_0x902d('0x1a'),auth[_0x902d('0xa')](),controller[_0x902d('0x1b')]);router[_0x902d('0xb')](_0x902d('0x1c'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x902d('0xb')](_0x902d('0x1d'),auth[_0x902d('0xa')](),controller[_0x902d('0x1e')]);router[_0x902d('0xb')]('/:id/chat/interactions',auth[_0x902d('0xa')](),controller[_0x902d('0x1f')]);router[_0x902d('0xb')]('/:id/openchannel/interactions',auth[_0x902d('0xa')](),controller['getOpenchannelInteractions']);router[_0x902d('0xb')](_0x902d('0x20'),auth[_0x902d('0xa')](),controller['getMailInteractions']);router[_0x902d('0xb')](_0x902d('0x21'),auth[_0x902d('0xa')](),controller['getSmsInteractions']);router[_0x902d('0xb')](_0x902d('0x22'),auth['isAuthenticated'](),controller[_0x902d('0x23')]);router['get'](_0x902d('0x24'),auth[_0x902d('0xa')](),controller[_0x902d('0x25')]);router['get'](_0x902d('0x26'),auth['isAuthenticated'](),controller[_0x902d('0x27')]);router[_0x902d('0xb')](_0x902d('0x28'),auth[_0x902d('0xa')](),controller['getLists']);router['get'](_0x902d('0x29'),auth['isAuthenticated'](),controller[_0x902d('0x2a')]);router[_0x902d('0xb')](_0x902d('0x2b'),auth[_0x902d('0xa')](),controller[_0x902d('0x2c')]);router[_0x902d('0xb')](_0x902d('0x2d'),auth['isAuthenticated'](),controller[_0x902d('0x2e')]);router[_0x902d('0xb')]('/:id/mail_accounts',auth[_0x902d('0xa')](),controller[_0x902d('0x2f')]);router['get'](_0x902d('0x30'),auth[_0x902d('0xa')](),controller[_0x902d('0x31')]);router[_0x902d('0xb')](_0x902d('0x32'),auth[_0x902d('0xa')](),controller[_0x902d('0x33')]);router['get'](_0x902d('0x34'),auth[_0x902d('0xa')](),controller['getChatWebsites']);router[_0x902d('0xb')](_0x902d('0x35'),auth['isAuthenticated'](),controller[_0x902d('0x36')]);router['get'](_0x902d('0x37'),auth[_0x902d('0xa')](),controller[_0x902d('0x38')]);router[_0x902d('0xb')]('/:id/api_key',auth[_0x902d('0xa')](),controller['getApiKey']);router['post'](_0x902d('0x14'),auth[_0x902d('0xa')](),controller[_0x902d('0x39')]);router['post']('/',auth['isAuthenticated'](),controller[_0x902d('0x3a')]);router['post'](_0x902d('0x3b'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x902d('0x3c')](_0x902d('0x16'),auth[_0x902d('0xa')](),controller[_0x902d('0x3d')]);var upload=multer({'storage':multer[_0x902d('0x3e')]({'destination':function(_0x197655,_0x4fcd98,_0x12b12d){_0x12b12d(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x4f7c04,_0x36b583,_0x560ec7){_0x560ec7(null,util[_0x902d('0x3f')]('%s-%s',Date[_0x902d('0x40')](),_0x36b583[_0x902d('0x41')]));}})});router[_0x902d('0x3c')](_0x902d('0x11'),upload[_0x902d('0x42')]('file'),controller[_0x902d('0x43')]);router[_0x902d('0x3c')](_0x902d('0x44'),auth['isAuthenticated'](),controller['login']);router[_0x902d('0x3c')]('/:id/logout',auth['isAuthenticated'](),controller[_0x902d('0x45')]);router[_0x902d('0x3c')]('/:id/pause',auth[_0x902d('0xa')](),controller['pause']);router[_0x902d('0x3c')](_0x902d('0x46'),auth[_0x902d('0xa')](),controller[_0x902d('0x47')]);router[_0x902d('0x3c')](_0x902d('0x26'),auth['isAuthenticated'](),controller[_0x902d('0x48')]);router['post'](_0x902d('0x49'),auth['isAuthenticated'](),controller[_0x902d('0x4a')]);router[_0x902d('0x3c')](_0x902d('0x4b'),auth[_0x902d('0xa')](),controller[_0x902d('0x4c')]);router[_0x902d('0x3c')](_0x902d('0x4d'),auth['isAuthenticated'](),controller[_0x902d('0x4e')]);router[_0x902d('0x3c')](_0x902d('0x4f'),auth[_0x902d('0xa')](),controller[_0x902d('0x50')]);router['post'](_0x902d('0x51'),auth[_0x902d('0xa')](),controller[_0x902d('0x52')]);router['post'](_0x902d('0x53'),auth[_0x902d('0xa')](),controller[_0x902d('0x54')]);router[_0x902d('0x3c')]('/:id/fax_accounts',auth[_0x902d('0xa')](),controller[_0x902d('0x55')]);router[_0x902d('0x3c')](_0x902d('0x56'),auth['isAuthenticated'](),controller[_0x902d('0x57')]);router[_0x902d('0x3c')](_0x902d('0x30'),auth[_0x902d('0xa')](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x902d('0xa')](),controller[_0x902d('0x58')]);router['post'](_0x902d('0x34'),auth[_0x902d('0xa')](),controller[_0x902d('0x59')]);router[_0x902d('0x3c')](_0x902d('0x35'),auth[_0x902d('0xa')](),controller[_0x902d('0x5a')]);router[_0x902d('0x3c')](_0x902d('0x5b'),auth[_0x902d('0xa')](),controller['createApiKey']);router[_0x902d('0x5c')](_0x902d('0x5d'),auth[_0x902d('0xa')](),controller[_0x902d('0x5e')]);router[_0x902d('0x5c')](_0x902d('0x5f'),auth[_0x902d('0xa')](),controller[_0x902d('0x60')]);router[_0x902d('0x61')]('/:id/queues',auth[_0x902d('0xa')](),controller[_0x902d('0x62')]);router[_0x902d('0x61')](_0x902d('0x26'),auth['isAuthenticated'](),controller[_0x902d('0x63')]);router['delete'](_0x902d('0x5d'),auth[_0x902d('0xa')](),controller[_0x902d('0x64')]);router[_0x902d('0x61')](_0x902d('0x49'),auth[_0x902d('0xa')](),controller[_0x902d('0x65')]);router[_0x902d('0x61')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x902d('0x66')]);router[_0x902d('0x61')](_0x902d('0x4d'),auth[_0x902d('0xa')](),controller[_0x902d('0x67')]);router[_0x902d('0x61')](_0x902d('0x4f'),auth[_0x902d('0xa')](),controller[_0x902d('0x68')]);router[_0x902d('0x61')](_0x902d('0x51'),auth[_0x902d('0xa')](),controller[_0x902d('0x69')]);router[_0x902d('0x61')](_0x902d('0x53'),auth['isAuthenticated'](),controller[_0x902d('0x6a')]);router[_0x902d('0x61')](_0x902d('0x2d'),auth[_0x902d('0xa')](),controller[_0x902d('0x6b')]);router[_0x902d('0x61')]('/:id/mail_accounts',auth[_0x902d('0xa')](),controller[_0x902d('0x6c')]);router['delete'](_0x902d('0x30'),auth[_0x902d('0xa')](),controller[_0x902d('0x6d')]);router[_0x902d('0x61')](_0x902d('0x32'),auth[_0x902d('0xa')](),controller['removeSmsAccounts']);router[_0x902d('0x61')](_0x902d('0x34'),auth[_0x902d('0xa')](),controller[_0x902d('0x6e')]);router[_0x902d('0x61')](_0x902d('0x35'),auth[_0x902d('0xa')](),controller['removeWhatsappAccounts']);router[_0x902d('0x61')]('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);router[_0x902d('0x3c')](_0x902d('0x6f'),auth[_0x902d('0xa')](),controller[_0x902d('0x70')]);module['exports']=router; \ No newline at end of file +var _0xb9c6=['exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeQueues','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/api_key','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification'];(function(_0x4ead81,_0x1e576e){var _0x2165cc=function(_0x3dc14a){while(--_0x3dc14a){_0x4ead81['push'](_0x4ead81['shift']());}};_0x2165cc(++_0x1e576e);}(_0xb9c6,0x1c5));var _0x6b9c=function(_0x56752d,_0x23ec6e){_0x56752d=_0x56752d-0x0;var _0x3a9ef3=_0xb9c6[_0x56752d];return _0x3a9ef3;};'use strict';var multer=require('multer');var util=require(_0x6b9c('0x0'));var path=require('path');var timeout=require(_0x6b9c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6b9c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6b9c('0x3'));var config=require(_0x6b9c('0x4'));var controller=require(_0x6b9c('0x5'));router['get']('/',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x7')]);router[_0x6b9c('0x8')](_0x6b9c('0x9'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0xa')]);router[_0x6b9c('0x8')](_0x6b9c('0xb'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0xc')]);router['get'](_0x6b9c('0xd'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0xe')]);router[_0x6b9c('0x8')](_0x6b9c('0xf'),auth['isAuthenticated'](),controller[_0x6b9c('0x10')]);router[_0x6b9c('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x6b9c('0x8')](_0x6b9c('0x11'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x12')]);router[_0x6b9c('0x8')](_0x6b9c('0x13'),auth['isAuthenticated'](),controller[_0x6b9c('0x14')]);router['get'](_0x6b9c('0x15'),auth['isAuthenticated'](),controller['getQueues']);router[_0x6b9c('0x8')](_0x6b9c('0x16'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x17')]);router[_0x6b9c('0x8')](_0x6b9c('0x18'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x19')]);router[_0x6b9c('0x8')]('/:id/recordings',auth[_0x6b9c('0x6')](),controller['getRecordings']);router[_0x6b9c('0x8')](_0x6b9c('0x1a'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x1b')]);router[_0x6b9c('0x8')]('/:id/chat/interactions',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x1c')]);router[_0x6b9c('0x8')](_0x6b9c('0x1d'),auth[_0x6b9c('0x6')](),controller['getOpenchannelInteractions']);router['get']('/:id/mail/interactions',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x1e')]);router[_0x6b9c('0x8')]('/:id/sms/interactions',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x1f')]);router[_0x6b9c('0x8')](_0x6b9c('0x20'),auth['isAuthenticated'](),controller[_0x6b9c('0x21')]);router[_0x6b9c('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x6b9c('0x22')]);router[_0x6b9c('0x8')](_0x6b9c('0x23'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x24')]);router[_0x6b9c('0x8')](_0x6b9c('0x25'),auth[_0x6b9c('0x6')](),controller['getLists']);router['get'](_0x6b9c('0x26'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x27')]);router[_0x6b9c('0x8')](_0x6b9c('0x28'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x29')]);router[_0x6b9c('0x8')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x6b9c('0x2a')]);router[_0x6b9c('0x8')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x6b9c('0x2b')]);router[_0x6b9c('0x8')](_0x6b9c('0x2c'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x2d')]);router['get'](_0x6b9c('0x2e'),auth[_0x6b9c('0x6')](),controller['getSmsAccounts']);router[_0x6b9c('0x8')]('/:id/chat_websites',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x2f')]);router[_0x6b9c('0x8')]('/:id/whatsapp_accounts',auth[_0x6b9c('0x6')](),controller['getWhatsappAccounts']);router[_0x6b9c('0x8')](_0x6b9c('0x30'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x31')]);router[_0x6b9c('0x8')]('/:id/api_key',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x32')]);router[_0x6b9c('0x33')]('/:id/contacts',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x34')]);router[_0x6b9c('0x33')]('/',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x35')]);router[_0x6b9c('0x33')](_0x6b9c('0x36'),auth['isAuthenticated'](),controller[_0x6b9c('0x37')]);router[_0x6b9c('0x33')](_0x6b9c('0x15'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x38')]);var upload=multer({'storage':multer[_0x6b9c('0x39')]({'destination':function(_0x1e721c,_0x192fb5,_0x313290){_0x313290(null,path[_0x6b9c('0x3a')](config[_0x6b9c('0x3b')],_0x6b9c('0x3c')));},'filename':function(_0x449a0d,_0x234399,_0x40aa42){_0x40aa42(null,util[_0x6b9c('0x3d')](_0x6b9c('0x3e'),Date['now'](),_0x234399[_0x6b9c('0x3f')]));}})});router[_0x6b9c('0x33')](_0x6b9c('0x40'),upload[_0x6b9c('0x41')](_0x6b9c('0x42')),controller[_0x6b9c('0x43')]);router[_0x6b9c('0x33')](_0x6b9c('0x44'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x45')]);router[_0x6b9c('0x33')](_0x6b9c('0x46'),auth[_0x6b9c('0x6')](),controller['logout']);router[_0x6b9c('0x33')](_0x6b9c('0x47'),auth['isAuthenticated'](),controller['pause']);router[_0x6b9c('0x33')](_0x6b9c('0x48'),auth['isAuthenticated'](),controller[_0x6b9c('0x49')]);router[_0x6b9c('0x33')](_0x6b9c('0x23'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x4a')]);router[_0x6b9c('0x33')](_0x6b9c('0x4b'),auth[_0x6b9c('0x6')](),controller['addChatInteractions']);router[_0x6b9c('0x33')](_0x6b9c('0x4c'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x4d')]);router['post'](_0x6b9c('0x4e'),auth['isAuthenticated'](),controller[_0x6b9c('0x4f')]);router[_0x6b9c('0x33')](_0x6b9c('0x50'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x51')]);router[_0x6b9c('0x33')]('/:id/openchannel_interactions',auth[_0x6b9c('0x6')](),controller['addOpenchannelInteractions']);router[_0x6b9c('0x33')](_0x6b9c('0x52'),auth[_0x6b9c('0x6')](),controller['addWhatsappInteractions']);router['post']('/:id/fax_accounts',auth[_0x6b9c('0x6')](),controller['addFaxAccounts']);router[_0x6b9c('0x33')](_0x6b9c('0x53'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x54')]);router[_0x6b9c('0x33')](_0x6b9c('0x2c'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x55')]);router[_0x6b9c('0x33')]('/:id/sms_accounts',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x56')]);router[_0x6b9c('0x33')](_0x6b9c('0x57'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x6b9c('0x33')]('/:id/whatsapp_accounts',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x58')]);router[_0x6b9c('0x33')]('/:id/api_key',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x59')]);router[_0x6b9c('0x5a')]('/:id',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x5b')]);router[_0x6b9c('0x5a')]('/:id/password',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x5c')]);router[_0x6b9c('0x5d')](_0x6b9c('0x15'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x5e')]);router[_0x6b9c('0x5d')](_0x6b9c('0x23'),auth[_0x6b9c('0x6')](),controller['removeTeams']);router[_0x6b9c('0x5d')](_0x6b9c('0xf'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x5f')]);router[_0x6b9c('0x5d')](_0x6b9c('0x4b'),auth[_0x6b9c('0x6')](),controller['removeChatInteractions']);router[_0x6b9c('0x5d')](_0x6b9c('0x4c'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x60')]);router[_0x6b9c('0x5d')]('/:id/fax_interactions',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x61')]);router[_0x6b9c('0x5d')](_0x6b9c('0x50'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x62')]);router[_0x6b9c('0x5d')](_0x6b9c('0x63'),auth['isAuthenticated'](),controller[_0x6b9c('0x64')]);router[_0x6b9c('0x5d')](_0x6b9c('0x52'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x65')]);router[_0x6b9c('0x5d')](_0x6b9c('0x66'),auth['isAuthenticated'](),controller[_0x6b9c('0x67')]);router[_0x6b9c('0x5d')]('/:id/mail_accounts',auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x68')]);router[_0x6b9c('0x5d')](_0x6b9c('0x2c'),auth['isAuthenticated'](),controller[_0x6b9c('0x69')]);router[_0x6b9c('0x5d')](_0x6b9c('0x2e'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x6a')]);router[_0x6b9c('0x5d')](_0x6b9c('0x57'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x6b')]);router[_0x6b9c('0x5d')]('/:id/whatsapp_accounts',auth[_0x6b9c('0x6')](),controller['removeWhatsappAccounts']);router[_0x6b9c('0x5d')](_0x6b9c('0x6c'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x6d')]);router['post'](_0x6b9c('0x6e'),auth[_0x6b9c('0x6')](),controller[_0x6b9c('0x6f')]);module[_0x6b9c('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5c40aec..7d49d6f 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 _0x2f7a=['ulaw;alaw;gsm','allow','insecure','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','accountcode','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','info','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x3ea9ff,_0x503928){var _0x506eb7=function(_0x3b30a4){while(--_0x3b30a4){_0x3ea9ff['push'](_0x3ea9ff['shift']());}};_0x506eb7(++_0x503928);}(_0x2f7a,0x1e9));var _0xa2f7=function(_0x2dcf4e,_0x4447f8){_0x2dcf4e=_0x2dcf4e-0x0;var _0x20c9ea=_0x2f7a[_0x2dcf4e];return _0x20c9ea;};'use strict';var Sequelize=require(_0xa2f7('0x0'));var moment=require(_0xa2f7('0x1'));var util=require('util');var _=require(_0xa2f7('0x2'));module[_0xa2f7('0x3')]={'name':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x169a99){this[_0xa2f7('0x5')](_0xa2f7('0x6'),_0x169a99);this[_0xa2f7('0x5')](_0xa2f7('0x7'),_0x169a99);},'comment':_0xa2f7('0x8')},'fullname':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':![],'set':function(_0x4b4952){this['setDataValue'](_0xa2f7('0x9'),_0x4b4952);this[_0xa2f7('0x5')](_0xa2f7('0xa'),util[_0xa2f7('0xb')](_0xa2f7('0xc'),_0x4b4952,this['getDataValue'](_0xa2f7('0xd'))));}},'alias':{'type':Sequelize[_0xa2f7('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa2f7('0xe'),'validate':{'isEmail':!![]},'set':function(_0x3670e0){if(_0x3670e0){this[_0xa2f7('0x5')]('email',_0x3670e0[_0xa2f7('0xf')]());}}},'role':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x11'),_0xa2f7('0x12'),'agent',_0xa2f7('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xa2f7('0x14')},'internal':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x5689b1){this[_0xa2f7('0x5')](_0xa2f7('0xd'),_0x5689b1);this['setDataValue'](_0xa2f7('0x16'),_0x5689b1);this[_0xa2f7('0x5')](_0xa2f7('0xa'),util[_0xa2f7('0xb')](_0xa2f7('0xc'),this[_0xa2f7('0x17')](_0xa2f7('0x9')),_0x5689b1));}},'salt':{'type':Sequelize[_0xa2f7('0x4')]},'phone':{'type':Sequelize[_0xa2f7('0x4')]},'mobile':{'type':Sequelize[_0xa2f7('0x4')]},'address':{'type':Sequelize[_0xa2f7('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xa2f7('0x4')]},'city':{'type':Sequelize[_0xa2f7('0x4')]},'country':{'type':Sequelize[_0xa2f7('0x4')]},'online':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa2f7('0x19')]},'voicePause':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa2f7('0x4')],'defaultValue':_0xa2f7('0x1a')},'lastPauseAt':{'type':Sequelize[_0xa2f7('0x19')]},'chatCapacity':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa2f7('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa2f7('0x1b')},'ipaddr':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xa2f7('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x1c'),_0xa2f7('0x12'),'peer'),'allowNull':!![],'defaultValue':_0xa2f7('0x1c')},'context':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![],'defaultValue':_0xa2f7('0x1d')},'callingpres':{'type':Sequelize['ENUM'](_0xa2f7('0x1e'),_0xa2f7('0x1f'),_0xa2f7('0x20'),_0xa2f7('0x21'),_0xa2f7('0x22'),'PROHIB_PASSED_SCREEN',_0xa2f7('0x23'),_0xa2f7('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![],'defaultValue':_0xa2f7('0x25'),'set':function(_0x5a530b){this[_0xa2f7('0x5')](_0xa2f7('0x26'),_0x5a530b?_0x5a530b[_0xa2f7('0x27')](','):null);},'get':function(){return this['getDataValue'](_0xa2f7('0x26'))?this[_0xa2f7('0x17')](_0xa2f7('0x26'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa2f7('0x10')]('rfc2833',_0xa2f7('0x28'),_0xa2f7('0x29'),'inband',_0xa2f7('0x2a')),'allowNull':!![],'defaultValue':_0xa2f7('0x2b')},'directmedia':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no',_0xa2f7('0x2d'),_0xa2f7('0x2e'),_0xa2f7('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![],'defaultValue':_0xa2f7('0x30'),'set':function(_0xd6fff){this['setDataValue']('nat',_0xd6fff?_0xd6fff[_0xa2f7('0x27')](','):null);},'get':function(){return this[_0xa2f7('0x17')](_0xa2f7('0x31'))?this[_0xa2f7('0x17')]('nat')['split'](','):null;},'comment':_0xa2f7('0x32')},'callgroup':{'type':Sequelize[_0xa2f7('0x4')]},'namedcallgroup':{'type':Sequelize[_0xa2f7('0x4')]},'pickupgroup':{'type':Sequelize[_0xa2f7('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xa2f7('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa2f7('0x4')]},'disallow':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':![],'defaultValue':_0xa2f7('0x33'),'set':function(_0x1c1a4d){this[_0xa2f7('0x5')]('allow',_0x1c1a4d?_0x1c1a4d[_0xa2f7('0x27')](';'):_0xa2f7('0x33'));},'get':function(){return this[_0xa2f7('0x17')](_0xa2f7('0x34'))?this[_0xa2f7('0x17')](_0xa2f7('0x34'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![],'set':function(_0x3aa0df){this[_0xa2f7('0x5')](_0xa2f7('0x35'),_0x3aa0df?_0x3aa0df[_0xa2f7('0x27')](','):null);},'get':function(){return this[_0xa2f7('0x17')](_0xa2f7('0x35'))?this[_0xa2f7('0x17')]('insecure')[_0xa2f7('0x36')](','):null;},'comment':_0xa2f7('0x37')},'trustrpid':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa2f7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no',_0xa2f7('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa2f7('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xa2f7('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no',_0xa2f7('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa2f7('0x10')]('accept',_0xa2f7('0x3a'),_0xa2f7('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa2f7('0x10')]('uac',_0xa2f7('0x3c')),'allowNull':!![],'defaultValue':_0xa2f7('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xa2f7('0x2c')},'keepalive':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa2f7('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no',_0xa2f7('0x3d'),_0xa2f7('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x3f'),_0xa2f7('0x40'),_0xa2f7('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa2f7('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no',_0xa2f7('0x2d'),_0xa2f7('0x2e'),_0xa2f7('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa2f7('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xa2f7('0x19')]},'passwordResetAt':{'type':Sequelize[_0xa2f7('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa2f7('0x43')]},'showWebBar':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0,'set':function(_0x4fd7e9){this['setDataValue'](_0xa2f7('0x44'),_0x4fd7e9);var _0x2a48f3=this['get']({'plain':!![]});switch(_0x4fd7e9){case 0x0:case 0x1:var _0x1346cf=_0x2a48f3['transport']?_['isArray'](_0x2a48f3[_0xa2f7('0x26')])?_0x2a48f3[_0xa2f7('0x26')][_0xa2f7('0x27')]():_0x2a48f3[_0xa2f7('0x26')]:_0xa2f7('0x25');if(_0x1346cf===_0xa2f7('0x45')){_0x1346cf=_0xa2f7('0x25');}this[_0xa2f7('0x5')](_0xa2f7('0x26'),_0x1346cf);this['setDataValue'](_0xa2f7('0x46'),'no');this[_0xa2f7('0x5')]('avpf',null);this['setDataValue'](_0xa2f7('0x47'),null);this['setDataValue'](_0xa2f7('0x48'),null);this['setDataValue']('dtlsenable',null);this[_0xa2f7('0x5')](_0xa2f7('0x49'),null);this[_0xa2f7('0x5')](_0xa2f7('0x4a'),null);this['setDataValue'](_0xa2f7('0x4b'),null);this['setDataValue'](_0xa2f7('0x4c'),null);this[_0xa2f7('0x5')](_0xa2f7('0x4d'),'no');break;case 0x2:this[_0xa2f7('0x5')](_0xa2f7('0x26'),_0xa2f7('0x45'));this['setDataValue'](_0xa2f7('0x46'),_0xa2f7('0x2c'));this[_0xa2f7('0x5')]('avpf','yes');this[_0xa2f7('0x5')](_0xa2f7('0x47'),'yes');this[_0xa2f7('0x5')]('icesupport',_0xa2f7('0x2c'));this['setDataValue'](_0xa2f7('0x4e'),_0xa2f7('0x2c'));this['setDataValue'](_0xa2f7('0x49'),'no');this['setDataValue']('dtlssetup',_0xa2f7('0x41'));this[_0xa2f7('0x5')](_0xa2f7('0x4b'),_0x2a48f3[_0xa2f7('0x4b')]||_0xa2f7('0x4f'));this[_0xa2f7('0x5')](_0xa2f7('0x4c'),_0x2a48f3[_0xa2f7('0x4c')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xa2f7('0x4d'),_0xa2f7('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x22d5c8){this[_0xa2f7('0x5')]('permissions',_0x22d5c8?_0x22d5c8[_0xa2f7('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0xa2f7('0x50'))?_['map'](this['getDataValue'](_0xa2f7('0x50'))[_0xa2f7('0x36')](','),function(_0xb35656){return parseInt(_0xb35656,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa2f7('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa2f7('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa2f7('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa2f7('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa2f7('0x10')](_0xa2f7('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa2f7('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa2f7('0x51')],'get':function(){return this[_0xa2f7('0x17')](_0xa2f7('0x52'))?this[_0xa2f7('0x17')](_0xa2f7('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xa2f7('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa2f7('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![],'set':function(_0x41760d){if(typeof _0x41760d==='string'){var _0x25c67f=_0x41760d==='1'?!![]:_0x41760d==='0'?![]:_0x41760d===_0xa2f7('0x53')?!![]:_0x41760d===_0xa2f7('0x54')?![]:![];this[_0xa2f7('0x5')](_0xa2f7('0x55'),_0x25c67f);}else{this[_0xa2f7('0x5')](_0xa2f7('0x55'),_0x41760d);}}},'blocked':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![],'set':function(_0x37724b){this[_0xa2f7('0x5')](_0xa2f7('0x56'),_0x37724b);if(_0x37724b===!![]){this[_0xa2f7('0x5')](_0xa2f7('0x57'),moment());this[_0xa2f7('0x5')](_0xa2f7('0x58'),0x0);}else{this[_0xa2f7('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xa2f7('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa2f7('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xa2f7('0x18')],'defaultValue':![]}}; \ No newline at end of file +var _0x92db=['callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user'];(function(_0x4fc0af,_0x50aeea){var _0x7cae07=function(_0x1b424f){while(--_0x1b424f){_0x4fc0af['push'](_0x4fc0af['shift']());}};_0x7cae07(++_0x50aeea);}(_0x92db,0xb7));var _0xb92d=function(_0x1d6130,_0x5fdeff){_0x1d6130=_0x1d6130-0x0;var _0x1acf23=_0x92db[_0x1d6130];return _0x1acf23;};'use strict';var Sequelize=require(_0xb92d('0x0'));var moment=require(_0xb92d('0x1'));var util=require('util');var _=require(_0xb92d('0x2'));module['exports']={'name':{'type':Sequelize[_0xb92d('0x3')],'allowNull':![],'unique':_0xb92d('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x50132d){this['setDataValue'](_0xb92d('0x4'),_0x50132d);this[_0xb92d('0x5')]('defaultuser',_0x50132d);},'comment':_0xb92d('0x6')},'fullname':{'type':Sequelize[_0xb92d('0x3')],'allowNull':![],'set':function(_0x5672d6){this[_0xb92d('0x5')]('fullname',_0x5672d6);this[_0xb92d('0x5')](_0xb92d('0x7'),util[_0xb92d('0x8')](_0xb92d('0x9'),_0x5672d6,this[_0xb92d('0xa')](_0xb92d('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb92d('0xc'),'validate':{'isEmail':!![]},'set':function(_0x5cd16b){if(_0x5cd16b){this[_0xb92d('0x5')](_0xb92d('0xc'),_0x5cd16b[_0xb92d('0xd')]());}}},'role':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0xf'),'user',_0xb92d('0x10'),_0xb92d('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xb92d('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xb92d('0x12')},'internal':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4bcca1){this[_0xb92d('0x5')](_0xb92d('0xb'),_0x4bcca1);this[_0xb92d('0x5')](_0xb92d('0x14'),_0x4bcca1);this[_0xb92d('0x5')]('callerid',util['format']('\x22%s\x22\x20<%s>',this[_0xb92d('0xa')](_0xb92d('0x15')),_0x4bcca1));}},'salt':{'type':Sequelize[_0xb92d('0x3')]},'phone':{'type':Sequelize[_0xb92d('0x3')]},'mobile':{'type':Sequelize[_0xb92d('0x3')]},'address':{'type':Sequelize[_0xb92d('0x3')]},'zipcode':{'type':Sequelize[_0xb92d('0x3')]},'userpic':{'type':Sequelize[_0xb92d('0x3')]},'city':{'type':Sequelize[_0xb92d('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb92d('0x17')]},'voicePause':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb92d('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xb92d('0x17')]},'chatCapacity':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb92d('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb92d('0x18')},'ipaddr':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xb92d('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x19'),_0xb92d('0x1a'),_0xb92d('0x1b')),'allowNull':!![],'defaultValue':_0xb92d('0x19')},'context':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![],'defaultValue':_0xb92d('0x1c')},'callingpres':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x1d'),_0xb92d('0x1e'),_0xb92d('0x1f'),_0xb92d('0x20'),_0xb92d('0x21'),_0xb92d('0x22'),_0xb92d('0x23'),_0xb92d('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![],'defaultValue':_0xb92d('0x25'),'set':function(_0x1fa067){this[_0xb92d('0x5')](_0xb92d('0x26'),_0x1fa067?_0x1fa067['join'](','):null);},'get':function(){return this[_0xb92d('0xa')](_0xb92d('0x26'))?this[_0xb92d('0xa')]('transport')[_0xb92d('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xb92d('0xe')]('rfc2833',_0xb92d('0x28'),_0xb92d('0x29'),_0xb92d('0x2a'),_0xb92d('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xb92d('0x2c'),'no',_0xb92d('0x2d'),_0xb92d('0x2e'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![],'defaultValue':_0xb92d('0x2f'),'set':function(_0x4c1c9f){this[_0xb92d('0x5')](_0xb92d('0x30'),_0x4c1c9f?_0x4c1c9f[_0xb92d('0x31')](','):null);},'get':function(){return this['getDataValue'](_0xb92d('0x30'))?this[_0xb92d('0xa')](_0xb92d('0x30'))[_0xb92d('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb92d('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xb92d('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb92d('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb92d('0x3')]},'disallow':{'type':Sequelize[_0xb92d('0x3')],'allowNull':![],'defaultValue':_0xb92d('0x32')},'allow':{'type':Sequelize[_0xb92d('0x3')],'allowNull':![],'defaultValue':_0xb92d('0x33'),'set':function(_0x3f66d1){this['setDataValue'](_0xb92d('0x34'),_0x3f66d1?_0x3f66d1[_0xb92d('0x31')](';'):_0xb92d('0x33'));},'get':function(){return this['getDataValue']('allow')?this[_0xb92d('0xa')](_0xb92d('0x34'))[_0xb92d('0x27')](';'):null;},'comment':_0xb92d('0x35')},'autoframing':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x1faebd){this[_0xb92d('0x5')](_0xb92d('0x36'),_0x1faebd?_0x1faebd['join'](','):null);},'get':function(){return this[_0xb92d('0xa')](_0xb92d('0x36'))?this[_0xb92d('0xa')](_0xb92d('0x36'))['split'](','):null;},'comment':_0xb92d('0x37')},'trustrpid':{'type':Sequelize[_0xb92d('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xb92d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no',_0xb92d('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![],'defaultValue':_0xb92d('0x39')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xb92d('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xb92d('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb92d('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no',_0xb92d('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x3b'),_0xb92d('0x3c'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x3d'),'uas'),'allowNull':!![],'defaultValue':_0xb92d('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xb92d('0x2c')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xb92d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xb92d('0x2c'),'no','fingerprint',_0xb92d('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x40'),_0xb92d('0x41'),_0xb92d('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb92d('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb92d('0xe')](_0xb92d('0x2c'),'no',_0xb92d('0x2d'),'update',_0xb92d('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb92d('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xb92d('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb92d('0x44')]},'showWebBar':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0,'set':function(_0x423a08){this[_0xb92d('0x5')](_0xb92d('0x45'),_0x423a08);var _0x108048=this[_0xb92d('0x46')]({'plain':!![]});switch(_0x423a08){case 0x0:case 0x1:var _0x9bcada=_0x108048[_0xb92d('0x26')]?_[_0xb92d('0x47')](_0x108048[_0xb92d('0x26')])?_0x108048['transport']['join']():_0x108048[_0xb92d('0x26')]:'udp';if(_0x9bcada===_0xb92d('0x48')){_0x9bcada=_0xb92d('0x25');}this['setDataValue']('transport',_0x9bcada);this[_0xb92d('0x5')](_0xb92d('0x49'),'no');this['setDataValue'](_0xb92d('0x4a'),null);this['setDataValue'](_0xb92d('0x4b'),null);this[_0xb92d('0x5')](_0xb92d('0x4c'),null);this[_0xb92d('0x5')](_0xb92d('0x4d'),null);this[_0xb92d('0x5')]('dtlsverify',null);this[_0xb92d('0x5')]('dtlssetup',null);this['setDataValue'](_0xb92d('0x4e'),null);this['setDataValue'](_0xb92d('0x4f'),null);this[_0xb92d('0x5')](_0xb92d('0x50'),'no');break;case 0x2:this[_0xb92d('0x5')](_0xb92d('0x26'),_0xb92d('0x48'));this[_0xb92d('0x5')](_0xb92d('0x49'),_0xb92d('0x2c'));this['setDataValue']('avpf',_0xb92d('0x2c'));this[_0xb92d('0x5')](_0xb92d('0x4b'),_0xb92d('0x2c'));this[_0xb92d('0x5')](_0xb92d('0x4c'),_0xb92d('0x2c'));this[_0xb92d('0x5')](_0xb92d('0x4d'),_0xb92d('0x2c'));this[_0xb92d('0x5')](_0xb92d('0x51'),'no');this[_0xb92d('0x5')](_0xb92d('0x52'),_0xb92d('0x42'));this[_0xb92d('0x5')](_0xb92d('0x4e'),_0x108048[_0xb92d('0x4e')]||_0xb92d('0x53'));this['setDataValue'](_0xb92d('0x4f'),_0x108048[_0xb92d('0x4f')]||'/etc/pki/tls/private/motion.key');this[_0xb92d('0x5')]('rtcp_mux',_0xb92d('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xb92d('0x44')],'set':function(_0x28f1a0){this[_0xb92d('0x5')](_0xb92d('0x54'),_0x28f1a0?_0x28f1a0[_0xb92d('0x31')](','):[]);},'get':function(){return this[_0xb92d('0xa')]('permissions')?_[_0xb92d('0x55')](this[_0xb92d('0xa')]('permissions')['split'](','),function(_0x217afa){return parseInt(_0x217afa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb92d('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb92d('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb92d('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb92d('0xa')](_0xb92d('0x56'))?this['getDataValue'](_0xb92d('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb92d('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![],'set':function(_0x267a86){if(typeof _0x267a86===_0xb92d('0x57')){var _0x2c0a24=_0x267a86==='1'?!![]:_0x267a86==='0'?![]:_0x267a86===_0xb92d('0x58')?!![]:_0x267a86===_0xb92d('0x59')?![]:![];this[_0xb92d('0x5')](_0xb92d('0x5a'),_0x2c0a24);}else{this[_0xb92d('0x5')](_0xb92d('0x5a'),_0x267a86);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x30fba5){this[_0xb92d('0x5')](_0xb92d('0x5b'),_0x30fba5);if(_0x30fba5===!![]){this[_0xb92d('0x5')](_0xb92d('0x5c'),moment());this[_0xb92d('0x5')](_0xb92d('0x5d'),0x0);}else{this[_0xb92d('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb92d('0x13')](0x5)[_0xb92d('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xb92d('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xb92d('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1d98e13..8b73b5f 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 _0x6e04=['spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','$or','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','lastName','CmContact','VoiceQueue','getApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','inbound','flatten','lower','col','asc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','charAt','toUpperCase','slice','select','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','util','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','client','http','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','update','emit','userNotification:recalc:','get','role','admin','Users','user','agent','Telephones','telephone','filter','ignore','value','includes','name','UserProfileResource','destroy','send','User','rawAttributes','map','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','index','getOptions','includeAll','include','userSetting','true','UserSetting','attributes','findAll','openTabs','rows','length','push','chat','dataValues','sms','mail','whatsapp','all','show','query','params','merge','options','fax','body','find','describe','addContacts','omit','ids','internal','findById','validatePasswordPattern','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','110','104','108','109','100','111','Unauthorized','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','UserProfileSection','Agents','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','autoAssociation','compact','create','changePassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','ValidationError','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordHistory','addQueues','channel','online','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','voice','format','voicePause','upsert','removeQueues','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','existsSync','join','server/files/images/','download','root','getOpenTabs','openchannel','ChatOpenTabs','CHAT','OpenchannelOpenTabs','OPENCHANNEL','createdAt','MailOpenTabs','MAIL','SmsOpenTabs','SMS','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','where','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','loginInPause','intrf','SIP/%s','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','PAUSE','MemberReport','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper'];(function(_0x17e181,_0x46bf9e){var _0x590f79=function(_0xf68183){while(--_0xf68183){_0x17e181['push'](_0x17e181['shift']());}};_0x590f79(++_0x46bf9e);}(_0x6e04,0x66));var _0x46e0=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x6e04[_0x324012];return _0x435cf2;};'use strict';var moment=require(_0x46e0('0x0'));var util=require(_0x46e0('0x1'));var path=require(_0x46e0('0x2'));var fs=require('fs');var _=require(_0x46e0('0x3'));var squel=require(_0x46e0('0x4'));var Redis=require(_0x46e0('0x5'));var jayson=require(_0x46e0('0x6'));var authService=require(_0x46e0('0x7'));var contacts=require('../../components/contacts');var qs=require(_0x46e0('0x8'));var rta=require('../../components/realtime/agents');var logger=require(_0x46e0('0x9'))(_0x46e0('0xa'));var utils=require(_0x46e0('0xb'));var config=require(_0x46e0('0xc'));var licenseUtil=require(_0x46e0('0xd'));var APIBadRequestError=require(_0x46e0('0xe'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIForbiddenError=require(_0x46e0('0xe'))[_0x46e0('0xf')];var APIHandleError=require('../../errors/api')[_0x46e0('0x10')];var db=require(_0x46e0('0x11'))['db'];var socket=require(_0x46e0('0x12'))(new Redis(config[_0x46e0('0x13')]));require(_0x46e0('0x14'))['register'](socket);config['redis']=_[_0x46e0('0x15')](config[_0x46e0('0x13')],{'host':_0x46e0('0x16'),'port':0x18eb});var amiClient=jayson[_0x46e0('0x17')][_0x46e0('0x18')]({'port':0x232a});var values;function respondWithStatusCode(_0x1a10b5,_0x429ec6){_0x429ec6=_0x429ec6||0xcc;return function(_0x1022f2){if(_0x1022f2){return _0x1a10b5[_0x46e0('0x19')](_0x429ec6);}return _0x1a10b5[_0x46e0('0x1a')](_0x429ec6)[_0x46e0('0x1b')]();};}function respondWithResult(_0x309b97,_0x527d31){_0x527d31=_0x527d31||0xc8;return function(_0x46a185){if(_0x46a185){return _0x309b97[_0x46e0('0x1a')](_0x527d31)[_0x46e0('0x1c')](_0x46a185);}};}function respondWithFilteredResult(_0x32f6b3,_0x34f448){return function(_0x3d6ddd){if(_0x3d6ddd){var _0x5c088a=typeof _0x34f448[_0x46e0('0x1d')]===_0x46e0('0x1e')&&typeof _0x34f448[_0x46e0('0x1f')]===_0x46e0('0x1e');var _0x374383=_0x3d6ddd['count'];var _0x1d3344=_0x5c088a?0x0:_0x34f448[_0x46e0('0x1d')];var _0x2a6043=_0x5c088a?_0x3d6ddd[_0x46e0('0x20')]:_0x34f448[_0x46e0('0x1d')]+_0x34f448[_0x46e0('0x1f')];var _0x425564;if(_0x2a6043>=_0x374383){_0x2a6043=_0x374383;_0x425564=0xc8;}else{_0x425564=0xce;}_0x32f6b3[_0x46e0('0x1a')](_0x425564);return _0x32f6b3[_0x46e0('0x21')](_0x46e0('0x22'),_0x1d3344+'-'+_0x2a6043+'/'+_0x374383)[_0x46e0('0x1c')](_0x3d6ddd);}return null;};}function respondWithRpcPromise(_0x12dd7d,_0x4d1290,_0x369d3e,_0xd5d3e0){return new Promise(function(_0x287f79,_0x41bf4e){var _0x22482a=_0xd5d3e0||amiClient;return _0x22482a['request'](_0x12dd7d,_0x369d3e)[_0x46e0('0x23')](function(_0x5cd90c){logger[_0x46e0('0x24')](_0x46e0('0x25'),_0x4d1290,_0x46e0('0x26'));logger[_0x46e0('0x27')]('User,\x20%s,\x20%s,\x20%s',_0x4d1290,_0x46e0('0x26'),JSON[_0x46e0('0x28')](_0x5cd90c));if(_0x5cd90c[_0x46e0('0x29')]){if(_0x5cd90c[_0x46e0('0x29')]['code']===0x1f4){logger[_0x46e0('0x29')]('User,\x20%s,\x20%s',_0x4d1290,_0x5cd90c['error']['message']);return _0x41bf4e(_0x5cd90c['error'][_0x46e0('0x2a')]);}logger['error'](_0x46e0('0x25'),_0x4d1290,_0x5cd90c[_0x46e0('0x29')][_0x46e0('0x2a')]);return _0x287f79(_0x5cd90c['error'][_0x46e0('0x2a')]);}else{logger['info'](_0x46e0('0x25'),_0x4d1290,_0x46e0('0x26'));_0x287f79(_0x5cd90c[_0x46e0('0x2b')][_0x46e0('0x2a')]);}})[_0x46e0('0x2c')](function(_0x3c82ae){logger[_0x46e0('0x29')]('User,\x20%s,\x20%s',_0x4d1290,_0x3c82ae);_0x41bf4e(_0x3c82ae);});});}function saveUpdates(_0x3b55ab){return function(_0x163aab){if(_0x163aab){return _0x163aab[_0x46e0('0x2d')](_0x3b55ab)[_0x46e0('0x23')](function(_0xdc451b){if(_0xdc451b['role']==='agent'){socket[_0x46e0('0x2e')](_0x46e0('0x2f')+_0xdc451b['id'],_0xdc451b);}return _0xdc451b;});}return null;};}function removeEntity(_0x47a841,_0x90011f){return function(_0x506130){if(_0x506130){return _0x506130['destroy']({'transaction':_0x90011f})[_0x46e0('0x23')](function(){var _0x5202f0=_0x506130[_0x46e0('0x30')]({'plain':!![]});if(_0x5202f0[_0x46e0('0x31')]===_0x46e0('0x32'))return;var _0x2e8284=[{'name':_0x46e0('0x33'),'value':_0x46e0('0x34'),'ignore':!![]},{'name':'Agents','value':_0x46e0('0x35'),'ignore':![]},{'name':_0x46e0('0x36'),'value':_0x46e0('0x37'),'ignore':![]}];var _0x17173d=_(_0x2e8284)[_0x46e0('0x38')](_0x46e0('0x39'))['map'](_0x46e0('0x3a'))[_0x46e0('0x3a')]();if(_[_0x46e0('0x3b')](_0x17173d,_0x5202f0[_0x46e0('0x31')])){return;}var _0x3ce87e=_['find'](_0x2e8284,['value',_0x5202f0['role']])[_0x46e0('0x3c')];return db[_0x46e0('0x3d')][_0x46e0('0x3e')]({'where':{'type':_0x3ce87e,'resourceId':_0x5202f0['id']},'transaction':_0x90011f})[_0x46e0('0x23')](function(){return _0x506130;});})[_0x46e0('0x23')](function(){_0x47a841['status'](0xcc)[_0x46e0('0x1b')]();});}};}function handleEntityNotFound(_0x5320eb){return function(_0x3d16d5){if(!_0x3d16d5){_0x5320eb['sendStatus'](0x194);}return _0x3d16d5;};}function handleError(_0x2f4659,_0x463e61){_0x463e61=_0x463e61||0x1f4;return function(_0x2cdfa0){logger[_0x46e0('0x29')](_0x2cdfa0['stack']);if(_0x2cdfa0['name']){delete _0x2cdfa0[_0x46e0('0x3c')];}_0x2f4659[_0x46e0('0x1a')](_0x463e61)[_0x46e0('0x3f')](_0x2cdfa0);};}function getUserAttributes(){return _(db[_0x46e0('0x40')][_0x46e0('0x41')])[_0x46e0('0x42')](function(_0x49bb4b){return{'name':_0x49bb4b[_0x46e0('0x43')],'type':_0x49bb4b[_0x46e0('0x44')][_0x46e0('0x45')]};})[_0x46e0('0x38')](function(_0x538c33){return![_0x46e0('0x46'),_0x46e0('0x47'),_0x46e0('0x48'),_0x46e0('0x49'),'resetPasswordExpires','md5secret'][_0x46e0('0x3b')](_0x538c33['name']);})[_0x46e0('0x3a')]();}exports[_0x46e0('0x4a')]=function(_0x59a965,_0x2e39df){var _0x541009={},_0x505fdd={'count':0x0,'rows':[]};var _0x387746=getUserAttributes();_0x541009=qs[_0x46e0('0x4b')](_0x387746,_0x59a965);var _0xe4aaca={'where':_0x541009['where']};return db['User'][_0x46e0('0x20')](_0xe4aaca)[_0x46e0('0x23')](function(_0xf1aa68){_0x505fdd[_0x46e0('0x20')]=_0xf1aa68;if(_0x59a965['query'][_0x46e0('0x4c')]){_0x541009[_0x46e0('0x4d')]=[{'all':!![]}];}if(_0x59a965['query'][_0x46e0('0x4e')]===_0x46e0('0x4f')){_0x541009[_0x46e0('0x4d')]=[{'model':db[_0x46e0('0x50')],'as':_0x46e0('0x4e')}];}if(!_['includes'](_0x541009[_0x46e0('0x51')],'id')){_0x541009['attributes']['push']('id');}return db['User'][_0x46e0('0x52')](_0x541009);})['then'](function(_0x16e45d){_0x505fdd['rows']=_0x16e45d;if(_0x59a965['query'][_0x46e0('0x53')]===_0x46e0('0x4f')){var _0x5c164c=[];for(var _0x28d712=0x0;_0x28d712<_0x505fdd[_0x46e0('0x54')][_0x46e0('0x55')];_0x28d712++){_0x5c164c[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x57'),_0x505fdd[_0x46e0('0x54')][_0x28d712][_0x46e0('0x58')]));_0x5c164c[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x59'),_0x505fdd[_0x46e0('0x54')][_0x28d712][_0x46e0('0x58')]));_0x5c164c[_0x46e0('0x56')](get_open_tabs('fax',_0x505fdd[_0x46e0('0x54')][_0x28d712][_0x46e0('0x58')]));_0x5c164c[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x5a'),_0x505fdd[_0x46e0('0x54')][_0x28d712]['dataValues']));_0x5c164c[_0x46e0('0x56')](get_open_tabs('openchannel',_0x505fdd[_0x46e0('0x54')][_0x28d712]['dataValues']));_0x5c164c[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x5b'),_0x505fdd[_0x46e0('0x54')][_0x28d712][_0x46e0('0x58')]));}return Promise[_0x46e0('0x5c')](_0x5c164c)[_0x46e0('0x23')](function(){return _0x505fdd;});}else{return _0x505fdd;}})[_0x46e0('0x23')](respondWithFilteredResult(_0x2e39df,_0x541009))[_0x46e0('0x2c')](handleError(_0x2e39df,null));};exports[_0x46e0('0x5d')]=function(_0x39a1c9,_0x5695f9){var _0x4e3232=getUserAttributes();_0x39a1c9[_0x46e0('0x5e')]['id']=_0x39a1c9[_0x46e0('0x5f')]['id'];var _0x4b2782=qs[_0x46e0('0x4b')](_0x4e3232,_0x39a1c9);if(_0x39a1c9[_0x46e0('0x5e')][_0x46e0('0x4c')]){_0x4b2782[_0x46e0('0x4d')]=[{'all':!![]}];}if(_0x39a1c9[_0x46e0('0x5e')][_0x46e0('0x4e')]===_0x46e0('0x4f')){_0x4b2782[_0x46e0('0x4d')]=[{'model':db['UserSetting'],'as':_0x46e0('0x4e')}];}_0x4b2782=_[_0x46e0('0x60')]({},_0x4b2782,_0x39a1c9[_0x46e0('0x61')]);if(!_[_0x46e0('0x3b')](_0x4b2782[_0x46e0('0x51')],'id')){_0x4b2782[_0x46e0('0x51')][_0x46e0('0x56')]('id');}return db[_0x46e0('0x40')]['find'](_0x4b2782)[_0x46e0('0x23')](handleEntityNotFound(_0x5695f9,null))[_0x46e0('0x23')](function(_0x263d66){var _0x3bec80=[];values=_0x263d66;if(_0x39a1c9[_0x46e0('0x5e')]['openTabs']===_0x46e0('0x4f')){_0x3bec80['push'](get_open_tabs(_0x46e0('0x57'),_0x263d66[_0x46e0('0x58')]));_0x3bec80[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x59'),_0x263d66[_0x46e0('0x58')]));_0x3bec80[_0x46e0('0x56')](get_open_tabs('openchannel',_0x263d66['dataValues']));_0x3bec80[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x5b'),_0x263d66[_0x46e0('0x58')]));_0x3bec80[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x62'),_0x263d66[_0x46e0('0x58')]));_0x3bec80[_0x46e0('0x56')](get_open_tabs('mail',_0x263d66[_0x46e0('0x58')]));return Promise[_0x46e0('0x5c')](_0x3bec80);}else{return values;}})['then'](function(){return values;})[_0x46e0('0x23')](respondWithResult(_0x5695f9,null))['catch'](handleError(_0x5695f9,null));};exports['update']=function(_0x117fc6,_0x479aac){if(_0x117fc6['body']['id']){delete _0x117fc6['body']['id'];}delete _0x117fc6[_0x46e0('0x63')]['role'];return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x117fc6[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x479aac,null))[_0x46e0('0x23')](saveUpdates(_0x117fc6[_0x46e0('0x63')],null))[_0x46e0('0x23')](respondWithResult(_0x479aac,null))[_0x46e0('0x2c')](handleError(_0x479aac,null));};exports[_0x46e0('0x65')]=function(_0x2ea2a5,_0x280470){return db['User'][_0x46e0('0x65')]()[_0x46e0('0x23')](respondWithResult(_0x280470,null))[_0x46e0('0x2c')](handleError(_0x280470,null));};exports['addContacts']=function(_0x45a2f5,_0x165e9d){return db['User'][_0x46e0('0x64')]({'where':{'id':_0x45a2f5[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x165e9d,null))['then'](function(_0x220e83){if(_0x220e83){return _0x220e83[_0x46e0('0x66')](_0x45a2f5['body']['ids'],_[_0x46e0('0x67')](_0x45a2f5[_0x46e0('0x63')],[_0x46e0('0x68'),'id'])||{});}})[_0x46e0('0x23')](respondWithResult(_0x165e9d,null))[_0x46e0('0x2c')](handleError(_0x165e9d,null));};function validateUser(_0xcfab50){return new Promise(function(_0x5e753e,_0x418cbe){if(_0xcfab50[_0x46e0('0x69')])return _0x5e753e(_0xcfab50);return db['Setting'][_0x46e0('0x6a')](0x1)[_0x46e0('0x23')](function(_0x46897f){if(_0x46897f['securePassword'])authService[_0x46e0('0x6b')](_0xcfab50[_0x46e0('0x46')]);db[_0x46e0('0x40')]['max'](_0x46e0('0x69'))['then'](function(_0x3e3a8e){if(_['isNil'](_0x3e3a8e)){_0xcfab50[_0x46e0('0x69')]=_0x46897f[_0x46e0('0x6c')]||0x1;return;}if(_[_0x46e0('0x6d')](_0x46897f[_0x46e0('0x6c')])||_0x46897f[_0x46e0('0x6c')]===_0x3e3a8e){_0xcfab50[_0x46e0('0x69')]=_0x3e3a8e+0x1;return;}if(_0x46897f[_0x46e0('0x6c')]>_0x3e3a8e){_0xcfab50[_0x46e0('0x69')]=_0x46897f['min_internal'];return;}return db[_0x46e0('0x6e')][_0x46e0('0x5e')](_0x46e0('0x6f'),{'type':db['sequelize'][_0x46e0('0x70')][_0x46e0('0x71')]})[_0x46e0('0x23')](function(_0x168d43){if(_0x168d43&&_0x168d43[_0x46e0('0x55')]){for(var _0x25822a=0x0,_0x29b739=_0x168d43[_0x46e0('0x55')];_0x25822a<_0x29b739&&_['isNil'](_0xcfab50['internal']);_0x25822a++){if(_0x46897f['min_internal']<=_0x168d43[_0x25822a][_0x46e0('0x72')]){_0xcfab50[_0x46e0('0x69')]=_0x168d43[_0x25822a]['from'];}else if(_0x46897f[_0x46e0('0x6c')]>_0x168d43[_0x25822a][_0x46e0('0x72')]&&_0x46897f[_0x46e0('0x6c')]<=_0x168d43[_0x25822a]['to']){_0xcfab50[_0x46e0('0x69')]=_0x46897f[_0x46e0('0x6c')];}}}if(_['isNil'](_0xcfab50[_0x46e0('0x69')])){_0xcfab50[_0x46e0('0x69')]=_0x3e3a8e+0x1;}return _0x5e753e(_0xcfab50);});});})[_0x46e0('0x2c')](function(_0x56537f){_0x418cbe(_0x56537f);});});}function updateUser(_0x4a1c3a){return new Promise(function(_0x1df850,_0x260df9){try{if(_0x4a1c3a[_0x46e0('0x73')]){_0x4a1c3a[_0x46e0('0x74')]=_0x4a1c3a[_0x46e0('0x69')];_0x4a1c3a[_0x46e0('0x75')]={'mailbox':_0x4a1c3a[_0x46e0('0x69')],'password':_0x4a1c3a['password'],'fullname':_0x4a1c3a['fullname'],'email':_0x4a1c3a[_0x46e0('0x76')]};}if(_0x4a1c3a[_0x46e0('0x31')]===_0x46e0('0x35')){if(!_0x4a1c3a[_0x46e0('0x77')])_0x4a1c3a['permissions']=[_0x46e0('0x78'),_0x46e0('0x79'),_0x46e0('0x7a'),_0x46e0('0x7b'),_0x46e0('0x7c'),_0x46e0('0x7d'),'105','106','107',_0x46e0('0x7e'),_0x46e0('0x7f'),_0x46e0('0x80'),_0x46e0('0x81'),'114','115'];}_0x1df850(_0x4a1c3a);}catch(_0xf8627){_0x260df9(_0xf8627);}});}exports['create']=function(_0x2906cb,_0x1b0a80){if(_0x2906cb[_0x46e0('0x34')]['role']==='agent')throw new Error(_0x46e0('0x82'));if(_0x2906cb[_0x46e0('0x63')][_0x46e0('0x31')]===_0x46e0('0x34')&&_0x2906cb[_0x46e0('0x34')][_0x46e0('0x31')]!==_0x46e0('0x32')){throw new Error(_0x46e0('0x83'));}if(_0x2906cb[_0x46e0('0x63')][_0x46e0('0x31')]===_0x46e0('0x32')&&_0x2906cb[_0x46e0('0x34')][_0x46e0('0x31')]!==_0x46e0('0x32')){throw new Error(_0x46e0('0x84'));}return licenseUtil[_0x46e0('0x85')]([_0x2906cb['body']])[_0x46e0('0x23')](function(){return validateUser(_0x2906cb[_0x46e0('0x63')]);})['then'](function(_0x516b3b){return updateUser(_0x516b3b)['then'](function(_0x554763){if(_0x554763['role']===_0x46e0('0x32')){_0x554763[_0x46e0('0x86')]=_0x2906cb[_0x46e0('0x34')][_0x46e0('0x86')];delete _0x554763[_0x46e0('0x87')];}return _0x554763;});})[_0x46e0('0x23')](function(_0x23c8c1){return db[_0x46e0('0x40')]['create'](_0x23c8c1,{'include':[{'model':db[_0x46e0('0x75')],'as':_0x46e0('0x75')}]});})[_0x46e0('0x23')](function(_0x4effc0){if(_0x2906cb['body'][_0x46e0('0x31')]===_0x46e0('0x34'))return _0x4effc0;if(_0x2906cb[_0x46e0('0x34')][_0x46e0('0x31')]!==_0x46e0('0x34'))return _0x4effc0;return db[_0x46e0('0x88')][_0x46e0('0x64')]({'where':{'name':_0x4effc0[_0x46e0('0x31')]===_0x46e0('0x35')?_0x46e0('0x89'):'Telephones','userProfileId':_0x2906cb[_0x46e0('0x34')][_0x46e0('0x87')]},'raw':!![]})[_0x46e0('0x23')](function(_0x1cf985){if(!_0x1cf985||_0x1cf985['autoAssociation']!=0x0)return _0x4effc0;return db[_0x46e0('0x3d')]['create']({'name':_0x4effc0[_0x46e0('0x3c')],'resourceId':_0x4effc0['id'],'type':_0x1cf985[_0x46e0('0x3c')],'sectionId':_0x1cf985['id']},{})[_0x46e0('0x23')](function(){return _0x4effc0;});})[_0x46e0('0x2c')](function(_0x15df37){logger[_0x46e0('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15df37);throw _0x15df37;});})['then'](respondWithResult(_0x1b0a80,0xc9))[_0x46e0('0x2c')](handleError(_0x1b0a80,null));};exports[_0x46e0('0x8a')]=function(_0x22301f,_0x330700){var _0x2538d8=_0x22301f[_0x46e0('0x63')];var _0x5f3b70=[];if(_0x22301f[_0x46e0('0x34')]['role']===_0x46e0('0x35'))throw new Error(_0x46e0('0x82'));if(_[_0x46e0('0x8b')](_0x2538d8,[_0x46e0('0x31'),_0x46e0('0x34')])&&_0x22301f['user'][_0x46e0('0x31')]!==_0x46e0('0x32')){throw new Error(_0x46e0('0x83'));}if(_[_0x46e0('0x8b')](_0x2538d8,[_0x46e0('0x31'),_0x46e0('0x32')])&&_0x22301f[_0x46e0('0x34')][_0x46e0('0x31')]!==_0x46e0('0x32')){throw new Error(_0x46e0('0x8c'));}return licenseUtil['checkUserLimits'](_0x2538d8)['then'](function(){return validateUser(_0x2538d8[0x0]);})[_0x46e0('0x23')](function(){for(var _0x33e2fb=0x1;_0x33e2fb<_0x2538d8[_0x46e0('0x55')];_0x33e2fb++){var _0x1053fb=_0x2538d8[_0x33e2fb-0x1][_0x46e0('0x69')];if(!_0x2538d8[_0x33e2fb]['internal'])_0x2538d8[_0x33e2fb][_0x46e0('0x69')]=_0x1053fb+0x1;_0x5f3b70[_0x46e0('0x56')](validateUser(_0x2538d8[_0x33e2fb]));}return Promise[_0x46e0('0x5c')](_0x5f3b70);})[_0x46e0('0x23')](function(){_0x5f3b70=[];for(var _0x54e086=0x0;_0x54e086<_0x2538d8[_0x46e0('0x55')];_0x54e086++){_0x5f3b70[_0x46e0('0x56')](updateUser(_0x2538d8[_0x54e086]));}return Promise[_0x46e0('0x5c')](_0x5f3b70);})[_0x46e0('0x23')](function(){_0x5f3b70=_0x2538d8[_0x46e0('0x42')](function(_0x3241f1){return db[_0x46e0('0x40')]['create'](_0x3241f1,{'include':[{'model':db[_0x46e0('0x75')],'as':_0x46e0('0x75')}]})['then'](function(_0x5cbbb4){_0x3241f1['id']=_0x5cbbb4['id'];return _0x3241f1;});});return Promise[_0x46e0('0x5c')](_0x5f3b70);})['then'](function(_0x12fa00){if(_0x22301f['body']['role']===_0x46e0('0x34'))return _0x12fa00;if(_0x22301f[_0x46e0('0x34')]['role']!==_0x46e0('0x34'))return _0x12fa00;var _0x27aae5=_[_0x46e0('0x8b')](_0x12fa00,function(_0x4f566c){return _0x4f566c['role']===_0x46e0('0x35')||_0x4f566c[_0x46e0('0x31')]===_0x46e0('0x37');});if(!_0x27aae5)return _0x12fa00;return db[_0x46e0('0x88')]['findAll']({'where':{'name':{'$or':[_0x46e0('0x89'),_0x46e0('0x36')]},'userProfileId':_0x22301f['user'][_0x46e0('0x87')]},'raw':!![]})[_0x46e0('0x23')](function(_0x4d010b){if(_[_0x46e0('0x8d')](_0x4d010b)||!_[_0x46e0('0x8b')](_0x4d010b,[_0x46e0('0x8e'),0x0]))return _0x12fa00;_0x5f3b70=[];var _0x1a934b=_(_0x4d010b)[_0x46e0('0x42')](function(_0x589eee){if(_0x589eee[_0x46e0('0x8e')]===0x1)return;return _0x589eee[_0x46e0('0x3c')]===_0x46e0('0x89')?_0x46e0('0x35'):_0x46e0('0x37');})[_0x46e0('0x8f')]()[_0x46e0('0x3a')]();for(var _0x3c0cbe=0x0;_0x3c0cbe<_0x12fa00[_0x46e0('0x55')];_0x3c0cbe++){if(!_[_0x46e0('0x3b')](_0x1a934b,_0x12fa00[_0x3c0cbe][_0x46e0('0x31')]))return;var _0x4c3b11=_0x12fa00[_0x3c0cbe][_0x46e0('0x31')]===_0x46e0('0x35')?_0x46e0('0x89'):_0x46e0('0x36');_0x5f3b70[_0x46e0('0x56')](db[_0x46e0('0x3d')][_0x46e0('0x90')]({'name':_0x12fa00[_0x3c0cbe][_0x46e0('0x3c')],'resourceId':_0x12fa00[_0x3c0cbe]['id'],'type':_0x4c3b11,'sectionId':_[_0x46e0('0x64')](_0x4d010b,['name',_0x4c3b11])['id']},{}));}return Promise[_0x46e0('0x5c')](_0x5f3b70);});})[_0x46e0('0x23')](respondWithResult(_0x330700,0xc9))[_0x46e0('0x2c')](handleError(_0x330700,null));};exports[_0x46e0('0x91')]=function(_0x2ce22d,_0x3453ad){if(_0x2ce22d[_0x46e0('0x63')]['id']){delete _0x2ce22d['body']['id'];}return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x2ce22d[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](function(_0x1ab0b1){if(!_0x1ab0b1)return null;if(_0x1ab0b1['id']===_0x2ce22d[_0x46e0('0x34')]['id']){if(!_0x2ce22d[_0x46e0('0x63')]['oldPassword']||!_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x92')]){throw new db[(_0x46e0('0x93'))]['ValidationError'](_0x46e0('0x94'));}if(!_0x1ab0b1['authenticate'](_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x95')])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x95')]===_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x92')]){throw new db['Sequelize']['ValidationError'](_0x46e0('0x96'));}}else if(_0x2ce22d[_0x46e0('0x34')][_0x46e0('0x31')]==='admin'){if(!_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x92')]){throw new db['Sequelize'][(_0x46e0('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x2ce22d[_0x46e0('0x34')][_0x46e0('0x31')]===_0x46e0('0x34')){if(!_0x2ce22d[_0x46e0('0x63')]['newPassword']){throw new db[(_0x46e0('0x93'))][(_0x46e0('0x97'))](_0x46e0('0x98'));}if(_0x1ab0b1[_0x46e0('0x31')]!==_0x46e0('0x35')){throw new db['Sequelize'][(_0x46e0('0x97'))](_0x46e0('0x82'));}}else{throw new db[(_0x46e0('0x93'))][(_0x46e0('0x97'))]('Unauthorized');}return _0x1ab0b1;})['then'](handleEntityNotFound(_0x3453ad,null))[_0x46e0('0x23')](function(_0x26a0c1){return db[_0x46e0('0x99')][_0x46e0('0x9a')]({'attributes':['id','securePassword',_0x46e0('0x9b'),_0x46e0('0x9c')]})[_0x46e0('0x23')](function(_0x3a1207){if(_0x3a1207[_0x46e0('0x9d')])authService[_0x46e0('0x6b')](_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x92')]);if(!_0x3a1207['enforcePasswordHistory']||!_0x26a0c1[_0x46e0('0x48')])return _0x26a0c1;authService[_0x46e0('0x9e')](_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x92')],_0x26a0c1[_0x46e0('0x48')],_0x3a1207['passwordHistoryLimit']);return _0x26a0c1;})['then'](saveUpdates({'password':_0x2ce22d[_0x46e0('0x63')]['newPassword'],'passwordResetAt':_0x2ce22d['user']['id']==_0x2ce22d[_0x46e0('0x5f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2ce22d[_0x46e0('0x63')][_0x46e0('0x92')],_0x26a0c1['previousPasswords'])},null));})[_0x46e0('0x23')](respondWithResult(_0x3453ad,null))[_0x46e0('0x2c')](handleError(_0x3453ad,null));};exports[_0x46e0('0x9f')]=function(_0x17f9c6,_0x59c926){var _0x2dd211=_0x17f9c6[_0x46e0('0x63')][_0x46e0('0xa0')];return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x17f9c6['params']['id']},'attributes':['id',_0x46e0('0x3c'),_0x46e0('0x31'),_0x46e0('0xa1'),'loginInPause','voicePause',_0x46e0('0xa2')]})[_0x46e0('0x23')](handleEntityNotFound(_0x59c926,null))[_0x46e0('0x23')](function(_0x3c1837){if(_0x3c1837){if(!utils[_0x46e0('0xa3')](_0x2dd211)){throw new db['Sequelize'][(_0x46e0('0x97'))](_0x46e0('0xa4'));}return _0x3c1837[_0x46e0('0xa5')+_[_0x46e0('0xa6')](_0x2dd211[_0x46e0('0xa7')]())+_0x46e0('0xa8')](_0x17f9c6['body'][_0x46e0('0x68')],{'penalty':_0x17f9c6[_0x46e0('0x63')][_0x46e0('0xa9')]||0x0})['spread'](function(_0x506f29){for(var _0x13438e=0x0;_0x13438e<_0x17f9c6['body'][_0x46e0('0x68')]['length'];_0x13438e+=0x1){var _0x177307={'UserId':Number(_0x17f9c6['params']['id'])};_0x177307[_[_0x46e0('0xa6')](_0x2dd211[_0x46e0('0xa7')]())+_0x46e0('0xaa')]=Number(_0x17f9c6[_0x46e0('0x63')][_0x46e0('0x68')][_0x13438e]);socket['emit'](_0x46e0('0x34')+_[_0x46e0('0xa6')](_0x2dd211[_0x46e0('0xa7')]())+'Queue:save',_0x177307);}return _0x506f29;})[_0x46e0('0x23')](function(){if(_0x2dd211===_0x46e0('0xab')){return db['VoiceQueue'][_0x46e0('0x52')]({'where':{'id':_0x17f9c6[_0x46e0('0x63')][_0x46e0('0x68')]||[]},'raw':!![],'attributes':['id',_0x46e0('0x3c')]});}})['then'](function(_0x102446){var _0x243c0e=_0x3c1837[_0x46e0('0x30')]({'plain':!![]});var _0x58a692=[];if(_0x2dd211===_0x46e0('0xab')&&_0x243c0e[_0x46e0('0x31')]===_0x46e0('0x35')&&_0x243c0e[_0x46e0('0xa1')]){for(let _0x4376ed=0x0;_0x4376ed<_0x102446[_0x46e0('0x55')];_0x4376ed+=0x1){_0x58a692[_0x46e0('0x56')]({'membername':_0x243c0e['name'],'UserId':_0x243c0e['id'],'queue_name':_0x102446[_0x4376ed]['name'],'VoiceQueueId':_0x102446[_0x4376ed]['id'],'interface':_[_0x46e0('0x6d')](_0x243c0e['interface'])?util[_0x46e0('0xac')]('SIP/%s',_0x243c0e['name']):_0x243c0e[_0x46e0('0xa2')],'paused':_0x243c0e[_0x46e0('0xad')]||![],'penalty':_0x17f9c6['body']['penalty']||0x0});}return Promise[_0x46e0('0x5c')](_0x58a692['map'](function(_0x3ace59){return db['UserVoiceQueueRt'][_0x46e0('0xae')](_0x3ace59);}));}return _0x3c1837;});}})[_0x46e0('0x23')](respondWithStatusCode(_0x59c926,null))[_0x46e0('0x2c')](handleError(_0x59c926,null));};exports[_0x46e0('0xaf')]=function(_0x1ca8bf,_0x5b8366){var _0x311e04,_0x2d5913;return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x1ca8bf[_0x46e0('0x5f')]['id']},'attributes':['id',_0x46e0('0x3c'),_0x46e0('0x31')]})[_0x46e0('0x23')](handleEntityNotFound(_0x5b8366,null))[_0x46e0('0x23')](function(_0x494609){if(_0x494609){_0x311e04=_0x494609;if(!_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0xa0')]||!utils[_0x46e0('0xa3')](_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0xa0')])){throw new db[(_0x46e0('0x93'))][(_0x46e0('0x97'))]('Unknown\x20channel');}return _0x494609[_0x46e0('0xb0')+_[_0x46e0('0xa6')](_0x1ca8bf['query'][_0x46e0('0xa0')][_0x46e0('0xa7')]())+_0x46e0('0xa8')](_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0x68')]);}})[_0x46e0('0x23')](function(_0x3b8800){if(_[_0x46e0('0xb1')](_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0x68')])){for(var _0x5b584f=0x0;_0x5b584f<_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0x68')][_0x46e0('0x55')];_0x5b584f+=0x1){_0x2d5913={'UserId':Number(_0x1ca8bf[_0x46e0('0x5f')]['id'])};_0x2d5913[_[_0x46e0('0xa6')](_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0xa0')]['toLowerCase']())+'QueueId']=Number(_0x1ca8bf[_0x46e0('0x5e')]['ids'][_0x5b584f]);socket[_0x46e0('0x2e')](_0x46e0('0x34')+_['capitalize'](_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0xa0')][_0x46e0('0xa7')]())+_0x46e0('0xb2'),_0x2d5913);}}else{_0x2d5913={'UserId':Number(_0x1ca8bf[_0x46e0('0x5f')]['id'])};_0x2d5913[_[_0x46e0('0xa6')](_0x1ca8bf['query']['channel'][_0x46e0('0xa7')]())+'QueueId']=Number(_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0x68')]);socket[_0x46e0('0x2e')](_0x46e0('0x34')+_[_0x46e0('0xa6')](_0x1ca8bf[_0x46e0('0x5e')][_0x46e0('0xa0')][_0x46e0('0xa7')]())+_0x46e0('0xb2'),_0x2d5913);}return _0x3b8800;})['then'](function(){if(_0x1ca8bf['query'][_0x46e0('0xa0')]===_0x46e0('0xab')){return db[_0x46e0('0xb3')][_0x46e0('0x3e')]({'where':{'UserId':_0x1ca8bf[_0x46e0('0x5f')]['id'],'VoiceQueueId':_0x1ca8bf[_0x46e0('0x5e')]['ids']},'individualHooks':!![]})[_0x46e0('0x23')](function(){return _0x311e04;});}return _0x311e04;})['then'](respondWithStatusCode(_0x5b8366,null))['catch'](handleError(_0x5b8366,null));};exports[_0x46e0('0xb4')]=function(_0x4af959,_0x57dfac){_0x4af959[_0x46e0('0x63')][_0x46e0('0xb5')]=_0x4af959[_0x46e0('0xb6')][_0x46e0('0xb7')];return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x4af959[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x57dfac,null))['then'](saveUpdates(_0x4af959[_0x46e0('0x63')],null))['then'](respondWithResult(_0x57dfac,null))['catch'](handleError(_0x57dfac,null));};exports['getAvatar']=function(_0x35a8b4,_0x2274f2){var _0x48c319=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x46e0('0x64')]({'where':{'id':_0x35a8b4['params']['id']},'attributes':['id',_0x46e0('0xb5')],'raw':!![]})[_0x46e0('0x23')](handleEntityNotFound(_0x2274f2,null))['then'](function(_0x28325b){if(_0x28325b){if(_[_0x46e0('0x6d')](_0x28325b[_0x46e0('0xb5')])){return _0x2274f2['download'](_0x48c319);}else{if(!fs[_0x46e0('0xb8')](path[_0x46e0('0xb9')](config['root'],_0x46e0('0xba'),_0x28325b[_0x46e0('0xb5')]))){return _0x2274f2[_0x46e0('0xbb')](_0x48c319);}return _0x2274f2[_0x46e0('0xbb')](path[_0x46e0('0xb9')](config[_0x46e0('0xbc')],_0x46e0('0xba'),_0x28325b[_0x46e0('0xb5')]));}}})[_0x46e0('0x2c')](handleError(_0x2274f2,null));};exports[_0x46e0('0xbd')]=function(_0x147eed,_0x25e8e5){return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x147eed['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x25e8e5,null))[_0x46e0('0x23')](function(_0x25c3df){var _0xd8c62f=[];values=_0x25c3df['dataValues'];_0xd8c62f[_0x46e0('0x56')](get_open_tabs('chat',_0x25c3df[_0x46e0('0x58')]));_0xd8c62f[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x59'),_0x25c3df['dataValues']));_0xd8c62f[_0x46e0('0x56')](get_open_tabs(_0x46e0('0xbe'),_0x25c3df[_0x46e0('0x58')]));_0xd8c62f['push'](get_open_tabs(_0x46e0('0x5b'),_0x25c3df[_0x46e0('0x58')]));_0xd8c62f[_0x46e0('0x56')](get_open_tabs(_0x46e0('0x62'),_0x25c3df['dataValues']));_0xd8c62f['push'](get_open_tabs(_0x46e0('0x5a'),_0x25c3df[_0x46e0('0x58')]));return Promise[_0x46e0('0x5c')](_0xd8c62f);})[_0x46e0('0x23')](function(_0x2545e0){if(_0x2545e0){var _0x485333=_[_0x46e0('0x42')](values[_0x46e0('0xbf')],function(_0x3c1a0e){return{'channel':_0x46e0('0xc0'),'id':_0x3c1a0e['id'],'createdAt':_0x3c1a0e['createdAt']};});var _0x7f64a1=_[_0x46e0('0x42')](values['FaxOpenTabs'],function(_0x455b0e){return{'channel':'FAX','id':_0x455b0e['id'],'createdAt':_0x455b0e['createdAt']};});var _0x311d1c=_[_0x46e0('0x42')](values[_0x46e0('0xc1')],function(_0x29ed79){return{'channel':_0x46e0('0xc2'),'id':_0x29ed79['id'],'createdAt':_0x29ed79[_0x46e0('0xc3')]};});var _0x233ac8=_[_0x46e0('0x42')](values[_0x46e0('0xc4')],function(_0x2a200b){return{'channel':_0x46e0('0xc5'),'id':_0x2a200b['id'],'createdAt':_0x2a200b[_0x46e0('0xc3')]};});var _0x2fb2c9=_['map'](values[_0x46e0('0xc6')],function(_0x4697a1){return{'channel':_0x46e0('0xc7'),'id':_0x4697a1['id'],'createdAt':_0x4697a1['createdAt']};});var _0x5d93fa=_[_0x46e0('0x42')](values['WhatsappOpenTabs'],function(_0x42be0f){return{'channel':'WHATSAPP','id':_0x42be0f['id'],'createdAt':_0x42be0f[_0x46e0('0xc3')]};});var _0x197aa0=_[_0x46e0('0xc8')](_0x485333,_0x7f64a1,_0x311d1c,_0x233ac8,_0x2fb2c9,_0x5d93fa);var _0x4670d4={'count':_0x197aa0['length'],'rows':_0x197aa0};return _0x4670d4;}else return null;})[_0x46e0('0x23')](respondWithResult(_0x25e8e5,null))[_0x46e0('0x2c')](handleError(_0x25e8e5,null));};exports['getContacts']=function(_0x234346,_0x5655ff){var _0x27479a={};return db['User']['findOne']({'where':{'id':_0x234346[_0x46e0('0x5f')]['id']}})['then'](function(_0x57bf65){if(!_0x57bf65){throw new APINotFoundError(util['format'](_0x46e0('0xc9'),_0x234346[_0x46e0('0x5f')]['id']));}return contacts[_0x46e0('0x65')]();})[_0x46e0('0x23')](function(_0xdcf56d){_0x234346[_0x46e0('0x5e')][_0x46e0('0x40')]=_0x234346[_0x46e0('0x5f')]['id'];_0x27479a=qs[_0x46e0('0x4b')](_0xdcf56d,_0x234346);if(_0x234346[_0x46e0('0x5e')][_0x46e0('0xca')](_0x46e0('0x4c'))){_0x27479a[_0x46e0('0x4d')]=[{'model':db[_0x46e0('0xcb')],'as':_0x46e0('0xcc'),'required':![]},{'model':db[_0x46e0('0xcd')],'as':_0x46e0('0xce'),'attributes':['id',_0x46e0('0x3c'),_0x46e0('0xcf')],'where':_0x234346[_0x46e0('0x5e')]['tag']?{'id':_0x234346[_0x46e0('0x5e')]['tag']}:undefined,'required':_0x234346['query'][_0x46e0('0xd0')]?!![]:![]}];}return contacts['findAll'](_0x234346[_0x46e0('0x5e')],_0x234346['user'],_0x27479a,_0xdcf56d);})['then'](respondWithFilteredResult(_0x5655ff,_0x27479a))[_0x46e0('0x2c')](APIHandleError(_0x5655ff));};exports[_0x46e0('0xd1')]=function(_0x41bd28,_0x14af41){var _0x183f2d;var _0x5a79b9={};var _0xb0621a;return db['User']['findOne']({'where':{'id':_0x41bd28[_0x46e0('0x5f')]['id']},'attributes':['id',_0x46e0('0x3c'),_0x46e0('0x31')]})[_0x46e0('0x23')](handleEntityNotFound(_0x14af41,null))[_0x46e0('0x23')](function(_0xb3454a){if(!utils[_0x46e0('0xa3')](_0x41bd28['query'][_0x46e0('0xa0')])){throw new db[(_0x46e0('0x93'))]['ValidationError'](_0x46e0('0xa4'));}_0x183f2d=_0xb3454a;var _0x3f0fc7={};_0x3f0fc7[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db[_[_0x46e0('0xa6')](_0x41bd28[_0x46e0('0x5e')][_0x46e0('0xa0')])+_0x46e0('0xd4')][_0x46e0('0x41')]);_0x3f0fc7['query']=_[_0x46e0('0xd3')](_0x41bd28[_0x46e0('0x5e')]);_0x3f0fc7[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x3f0fc7['model'],_0x3f0fc7[_0x46e0('0x5e')]);_0x5a79b9['attributes']=_[_0x46e0('0xd6')](_0x3f0fc7['model'],qs[_0x46e0('0xd7')](_0x41bd28['query'][_0x46e0('0xd7')]));_0x5a79b9['attributes']=_0x5a79b9[_0x46e0('0x51')][_0x46e0('0x55')]?_0x5a79b9[_0x46e0('0x51')]:_0x3f0fc7[_0x46e0('0xd2')];_0x5a79b9[_0x46e0('0xd8')]=qs[_0x46e0('0xd9')](_0x41bd28[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x5a79b9[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x41bd28[_0x46e0('0x5e')],_0x3f0fc7[_0x46e0('0xd5')]));if(_0x41bd28[_0x46e0('0x5e')]['filter']){_0x5a79b9['where']=_[_0x46e0('0x60')](_0x5a79b9[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x5a79b9[_0x46e0('0x51')],function(_0x34e616){var _0x9dabd0={};_0x9dabd0[_0x34e616]={'$like':'%'+_0x41bd28['query'][_0x46e0('0x38')]+'%'};return _0x9dabd0;})});}_0x5a79b9=_['merge']({},_0x5a79b9,_0x41bd28[_0x46e0('0x61')]);switch(_0x183f2d[_0x46e0('0x31')]){case'admin':return db[_[_0x46e0('0xa6')](_0x41bd28[_0x46e0('0x5e')][_0x46e0('0xa0')])+_0x46e0('0xd4')][_0x46e0('0x52')](_0x5a79b9);case _0x46e0('0x34'):case _0x46e0('0x35'):return _0x183f2d[_0x46e0('0x30')+_[_0x46e0('0xa6')](_0x41bd28['query']['channel'])+'Queues'](_0x5a79b9);default:throw new db[(_0x46e0('0x93'))][(_0x46e0('0x97'))](_0x46e0('0xdc'));}})[_0x46e0('0x23')](function(_0x1cbd9b){_0xb0621a=_0x1cbd9b[_0x46e0('0x55')];if(!_0x41bd28['query'][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x5a79b9[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x41bd28[_0x46e0('0x5e')][_0x46e0('0x1f')]);_0x5a79b9[_0x46e0('0x1d')]=qs[_0x46e0('0x1d')](_0x41bd28[_0x46e0('0x5e')][_0x46e0('0x1d')]);}switch(_0x183f2d[_0x46e0('0x31')]){case'admin':return db[_[_0x46e0('0xa6')](_0x41bd28['query'][_0x46e0('0xa0')])+'Queue'][_0x46e0('0x52')](_0x5a79b9);case _0x46e0('0x34'):case _0x46e0('0x35'):return _0x183f2d['get'+_[_0x46e0('0xa6')](_0x41bd28[_0x46e0('0x5e')]['channel'])+_0x46e0('0xa8')](_0x5a79b9);}})['then'](function(_0x4538fb){return{'count':_0xb0621a,'rows':_0x4538fb};})[_0x46e0('0x23')](respondWithResult(_0x14af41,null))[_0x46e0('0x2c')](handleError(_0x14af41,null));};exports[_0x46e0('0xde')]=function(_0x45b7c0,_0x431fec){var _0x1c859d={};var _0x194496={};var _0x1a051a;var _0x1a30f9;return db['User']['findOne']({'where':{'id':_0x45b7c0[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x431fec,null))[_0x46e0('0x23')](function(_0x5cd194){if(_0x5cd194){_0x1a051a=_0x5cd194;_0x194496[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db[_0x46e0('0xb3')]['rawAttributes']);_0x194496[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x45b7c0[_0x46e0('0x5e')]);_0x194496[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x194496[_0x46e0('0xd2')],_0x194496[_0x46e0('0x5e')]);_0x1c859d['attributes']=_[_0x46e0('0xd6')](_0x194496[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x45b7c0['query']['fields']));_0x1c859d[_0x46e0('0x51')]=_0x1c859d[_0x46e0('0x51')][_0x46e0('0x55')]?_0x1c859d[_0x46e0('0x51')]:_0x194496[_0x46e0('0xd2')];_0x1c859d['order']=qs[_0x46e0('0xd9')](_0x45b7c0[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x1c859d[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x45b7c0[_0x46e0('0x5e')],_0x194496['filters']));if(_0x45b7c0[_0x46e0('0x5e')][_0x46e0('0x38')]){_0x1c859d[_0x46e0('0xda')]=_[_0x46e0('0x60')](_0x1c859d[_0x46e0('0xda')],{'$or':_['map'](_0x1c859d[_0x46e0('0x51')],function(_0x86e81b){var _0xc4acf8={};_0xc4acf8[_0x86e81b]={'$like':'%'+_0x45b7c0[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0xc4acf8;})});}_0x1c859d=_['merge']({},_0x1c859d,_0x45b7c0[_0x46e0('0x61')]);return _0x1a051a[_0x46e0('0xde')](_0x1c859d);}})[_0x46e0('0x23')](function(_0x357c3a){if(_0x357c3a){_0x1a30f9=_0x357c3a[_0x46e0('0x55')];if(!_0x45b7c0[_0x46e0('0x5e')][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x1c859d['limit']=qs[_0x46e0('0x1f')](_0x45b7c0[_0x46e0('0x5e')][_0x46e0('0x1f')]);_0x1c859d[_0x46e0('0x1d')]=qs[_0x46e0('0x1d')](_0x45b7c0[_0x46e0('0x5e')]['offset']);}return _0x1a051a[_0x46e0('0xde')](_0x1c859d);}})[_0x46e0('0x23')](function(_0x445aec){if(_0x445aec){return _0x445aec?{'count':_0x1a30f9,'rows':_0x445aec}:null;}})[_0x46e0('0x23')](respondWithResult(_0x431fec,null))['catch'](handleError(_0x431fec,null));};exports[_0x46e0('0xdf')]=function(_0x8d9a77,_0x442095){var _0x4f259b={};var _0xb38de2={};var _0x1bc653;var _0x3f7b2b;return db['User'][_0x46e0('0x9a')]({'where':{'id':_0x8d9a77[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x442095,null))[_0x46e0('0x23')](function(_0x184a94){if(_0x184a94){_0x1bc653=_0x184a94;_0xb38de2['model']=_[_0x46e0('0xd3')](db[_0x46e0('0xe0')][_0x46e0('0x41')]);_0xb38de2[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x8d9a77['query']);_0xb38de2[_0x46e0('0xd5')]=_['intersection'](_0xb38de2[_0x46e0('0xd2')],_0xb38de2['query']);_0x4f259b[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0xb38de2[_0x46e0('0xd2')],qs['fields'](_0x8d9a77[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0x4f259b[_0x46e0('0x51')]=_0x4f259b[_0x46e0('0x51')][_0x46e0('0x55')]?_0x4f259b['attributes']:_0xb38de2[_0x46e0('0xd2')];_0x4f259b['order']=qs[_0x46e0('0xd9')](_0x8d9a77[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x4f259b[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_['pick'](_0x8d9a77[_0x46e0('0x5e')],_0xb38de2['filters']));if(_0x8d9a77[_0x46e0('0x5e')]['filter']){_0x4f259b['where']=_[_0x46e0('0x60')](_0x4f259b[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x4f259b[_0x46e0('0x51')],function(_0x42aae6){var _0x230f9e={};_0x230f9e[_0x42aae6]={'$like':'%'+_0x8d9a77[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0x230f9e;})});}_0x4f259b=_[_0x46e0('0x60')]({},_0x4f259b,_0x8d9a77[_0x46e0('0x61')]);return _0x1bc653[_0x46e0('0xdf')](_0x4f259b);}})[_0x46e0('0x23')](function(_0xd4cda2){if(_0xd4cda2){_0x3f7b2b=_0xd4cda2[_0x46e0('0x55')];if(!_0x8d9a77[_0x46e0('0x5e')][_0x46e0('0xca')]('nolimit')){_0x4f259b[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x8d9a77[_0x46e0('0x5e')]['limit']);_0x4f259b['offset']=qs[_0x46e0('0x1d')](_0x8d9a77['query'][_0x46e0('0x1d')]);}return _0x1bc653[_0x46e0('0xdf')](_0x4f259b);}})['then'](function(_0x6c0450){if(_0x6c0450){return _0x6c0450?{'count':_0x3f7b2b,'rows':_0x6c0450}:null;}})[_0x46e0('0x23')](respondWithResult(_0x442095,null))[_0x46e0('0x2c')](handleError(_0x442095,null));};exports[_0x46e0('0xe1')]=function(_0x2bc5be,_0x5afe97){var _0x3c8373={'raw':!![],'where':{}};var _0x1aa279={};var _0x525d90={'count':0x0,'rows':[]};return db['User'][_0x46e0('0x9a')]({'where':{'id':_0x2bc5be[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x5afe97,null))[_0x46e0('0x23')](function(_0x1c4850){if(_0x1c4850){_0x1aa279[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db['VoiceRecording']['rawAttributes']);_0x1aa279[_0x46e0('0x5e')]=_['keys'](_0x2bc5be['query']);_0x1aa279[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x1aa279[_0x46e0('0xd2')],_0x1aa279['query']);_0x3c8373[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0x1aa279[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x2bc5be[_0x46e0('0x5e')]['fields']));_0x3c8373['attributes']=_0x3c8373[_0x46e0('0x51')][_0x46e0('0x55')]?_0x3c8373[_0x46e0('0x51')]:_0x1aa279[_0x46e0('0xd2')];if(!_0x2bc5be[_0x46e0('0x5e')][_0x46e0('0xca')]('nolimit')){_0x3c8373[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x2bc5be['query'][_0x46e0('0x1f')]);_0x3c8373[_0x46e0('0x1d')]=qs[_0x46e0('0x1d')](_0x2bc5be['query'][_0x46e0('0x1d')]);}_0x3c8373[_0x46e0('0xd8')]=qs['sort'](_0x2bc5be[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x3c8373[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x2bc5be[_0x46e0('0x5e')],_0x1aa279[_0x46e0('0xd5')]));_0x3c8373[_0x46e0('0xda')]['UserId']=_0x1c4850['id'];if(_0x2bc5be[_0x46e0('0x5e')][_0x46e0('0x38')]){_0x3c8373['where']=_[_0x46e0('0x60')](_0x3c8373[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x3c8373[_0x46e0('0x51')],function(_0x505047){var _0x26fcdb={};_0x26fcdb[_0x505047]={'$like':'%'+_0x2bc5be[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0x26fcdb;})});}_0x3c8373=_[_0x46e0('0x60')]({},_0x3c8373,_0x2bc5be['options']);return db[_0x46e0('0xe2')][_0x46e0('0x20')]({'where':_0x3c8373['where']})['then'](function(_0x2fc822){_0x525d90[_0x46e0('0x20')]=_0x2fc822;if(_0x2bc5be[_0x46e0('0x5e')][_0x46e0('0x4c')]){_0x3c8373['include']=[{'all':!![]}];}return db[_0x46e0('0xe2')]['findAll'](_0x3c8373);})[_0x46e0('0x23')](function(_0x4cb7ed){_0x525d90[_0x46e0('0x54')]=_0x4cb7ed;return _0x525d90;});}})[_0x46e0('0x23')](respondWithFilteredResult(_0x5afe97,_0x3c8373))[_0x46e0('0x2c')](handleError(_0x5afe97,null));};exports[_0x46e0('0xe3')]=function(_0x292907,_0x3c67ff){var _0x51208f={'raw':!![],'where':{}};var _0x1724c4={};var _0x3c6edb={'count':0x0,'rows':[]};return db[_0x46e0('0x40')][_0x46e0('0x9a')]({'where':{'id':_0x292907[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x3c67ff,null))[_0x46e0('0x23')](function(_0x361621){if(_0x361621){_0x1724c4[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db['ScreenRecording']['rawAttributes']);_0x1724c4[_0x46e0('0x5e')]=_['keys'](_0x292907[_0x46e0('0x5e')]);_0x1724c4['filters']=_[_0x46e0('0xd6')](_0x1724c4['model'],_0x1724c4[_0x46e0('0x5e')]);_0x51208f[_0x46e0('0x51')]=_['intersection'](_0x1724c4['model'],qs[_0x46e0('0xd7')](_0x292907[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0x51208f[_0x46e0('0x51')]=_0x51208f[_0x46e0('0x51')][_0x46e0('0x55')]?_0x51208f[_0x46e0('0x51')]:_0x1724c4[_0x46e0('0xd2')];if(!_0x292907['query'][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x51208f[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x292907[_0x46e0('0x5e')][_0x46e0('0x1f')]);_0x51208f[_0x46e0('0x1d')]=qs['offset'](_0x292907[_0x46e0('0x5e')][_0x46e0('0x1d')]);}_0x51208f[_0x46e0('0xd8')]=qs[_0x46e0('0xd9')](_0x292907[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x51208f[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x292907['query'],_0x1724c4[_0x46e0('0xd5')]));_0x51208f[_0x46e0('0xda')][_0x46e0('0xe4')]=_0x361621['id'];if(_0x292907[_0x46e0('0x5e')][_0x46e0('0x38')]){_0x51208f[_0x46e0('0xda')]=_[_0x46e0('0x60')](_0x51208f[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x51208f[_0x46e0('0x51')],function(_0x2d1412){var _0x53d8c9={};_0x53d8c9[_0x2d1412]={'$like':'%'+_0x292907['query'][_0x46e0('0x38')]+'%'};return _0x53d8c9;})});}_0x51208f=_[_0x46e0('0x60')]({},_0x51208f,_0x292907[_0x46e0('0x61')]);return db['ScreenRecording'][_0x46e0('0x20')]({'where':_0x51208f[_0x46e0('0xda')]})[_0x46e0('0x23')](function(_0x31892e){_0x3c6edb[_0x46e0('0x20')]=_0x31892e;if(_0x292907[_0x46e0('0x5e')][_0x46e0('0x4c')]){_0x51208f[_0x46e0('0x4d')]=[{'all':!![]}];}return db['ScreenRecording'][_0x46e0('0x52')](_0x51208f);})[_0x46e0('0x23')](function(_0x4cf92b){_0x3c6edb[_0x46e0('0x54')]=_0x4cf92b;return _0x3c6edb;});}})['then'](respondWithFilteredResult(_0x3c67ff,_0x51208f))['catch'](handleError(_0x3c67ff,null));};exports[_0x46e0('0xe5')]=function(_0x4de143,_0x1502d0){var _0x43f843={};var _0x77c8ca={};var _0xa2c0ad;var _0x2c480d;return db['User']['findOne']({'where':{'id':_0x4de143['params']['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x1502d0,null))[_0x46e0('0x23')](function(_0x2f7a82){if(_0x2f7a82){_0xa2c0ad=_0x2f7a82;_0x77c8ca[_0x46e0('0xd2')]=_['keys'](db[_0x46e0('0xe6')]['rawAttributes']);_0x77c8ca[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x4de143[_0x46e0('0x5e')]);_0x77c8ca[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x77c8ca[_0x46e0('0xd2')],_0x77c8ca[_0x46e0('0x5e')]);_0x43f843['attributes']=_[_0x46e0('0xd6')](_0x77c8ca[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x4de143[_0x46e0('0x5e')]['fields']));_0x43f843[_0x46e0('0x51')]=_0x43f843[_0x46e0('0x51')][_0x46e0('0x55')]?_0x43f843[_0x46e0('0x51')]:_0x77c8ca[_0x46e0('0xd2')];_0x43f843[_0x46e0('0xd8')]=qs[_0x46e0('0xd9')](_0x4de143[_0x46e0('0x5e')]['sort']);_0x43f843[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_['pick'](_0x4de143[_0x46e0('0x5e')],_0x77c8ca[_0x46e0('0xd5')]));if(_0x4de143[_0x46e0('0x5e')][_0x46e0('0x38')]){_0x43f843[_0x46e0('0xda')]=_[_0x46e0('0x60')](_0x43f843['where'],{'$or':_[_0x46e0('0x42')](_0x43f843[_0x46e0('0x51')],function(_0x5dfbe1){var _0x563958={};_0x563958[_0x5dfbe1]={'$like':'%'+_0x4de143[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0x563958;})});}_0x43f843=_[_0x46e0('0x60')]({},_0x43f843,_0x4de143['options']);return _0xa2c0ad[_0x46e0('0xe5')](_0x43f843);}})[_0x46e0('0x23')](function(_0x931c7a){if(_0x931c7a){_0x2c480d=_0x931c7a['length'];if(!_0x4de143[_0x46e0('0x5e')][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x43f843[_0x46e0('0x1f')]=qs['limit'](_0x4de143[_0x46e0('0x5e')]['limit']);_0x43f843[_0x46e0('0x1d')]=qs['offset'](_0x4de143[_0x46e0('0x5e')][_0x46e0('0x1d')]);}return _0xa2c0ad[_0x46e0('0xe5')](_0x43f843);}})[_0x46e0('0x23')](function(_0xe8b623){if(_0xe8b623){return _0xe8b623?{'count':_0x2c480d,'rows':_0xe8b623}:null;}})[_0x46e0('0x23')](respondWithResult(_0x1502d0,null))[_0x46e0('0x2c')](handleError(_0x1502d0,null));};exports['getOpenchannelInteractions']=function(_0x1a1ef0,_0x2506c0){var _0xef625f={};var _0x41cf41={};var _0x35e374;var _0x4f6576;return db[_0x46e0('0x40')][_0x46e0('0x9a')]({'where':{'id':_0x1a1ef0[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x2506c0,null))[_0x46e0('0x23')](function(_0x38be80){if(_0x38be80){_0x35e374=_0x38be80;_0x41cf41['model']=_[_0x46e0('0xd3')](db['OpenchannelInteraction']['rawAttributes']);_0x41cf41[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x1a1ef0[_0x46e0('0x5e')]);_0x41cf41['filters']=_[_0x46e0('0xd6')](_0x41cf41[_0x46e0('0xd2')],_0x41cf41['query']);_0xef625f[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0x41cf41[_0x46e0('0xd2')],qs['fields'](_0x1a1ef0[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0xef625f[_0x46e0('0x51')]=_0xef625f[_0x46e0('0x51')]['length']?_0xef625f[_0x46e0('0x51')]:_0x41cf41[_0x46e0('0xd2')];_0xef625f[_0x46e0('0xd8')]=qs['sort'](_0x1a1ef0[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0xef625f[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x1a1ef0[_0x46e0('0x5e')],_0x41cf41[_0x46e0('0xd5')]));if(_0x1a1ef0[_0x46e0('0x5e')]['filter']){_0xef625f[_0x46e0('0xda')]=_['merge'](_0xef625f[_0x46e0('0xda')],{'$or':_['map'](_0xef625f[_0x46e0('0x51')],function(_0x27deb9){var _0x4af0b2={};_0x4af0b2[_0x27deb9]={'$like':'%'+_0x1a1ef0[_0x46e0('0x5e')]['filter']+'%'};return _0x4af0b2;})});}_0xef625f=_['merge']({},_0xef625f,_0x1a1ef0[_0x46e0('0x61')]);return _0x35e374['getOpenchannelInteractions'](_0xef625f);}})['then'](function(_0xffbecf){if(_0xffbecf){_0x4f6576=_0xffbecf[_0x46e0('0x55')];if(!_0x1a1ef0['query'][_0x46e0('0xca')](_0x46e0('0xdd'))){_0xef625f['limit']=qs[_0x46e0('0x1f')](_0x1a1ef0[_0x46e0('0x5e')][_0x46e0('0x1f')]);_0xef625f[_0x46e0('0x1d')]=qs[_0x46e0('0x1d')](_0x1a1ef0[_0x46e0('0x5e')][_0x46e0('0x1d')]);}return _0x35e374[_0x46e0('0xe7')](_0xef625f);}})[_0x46e0('0x23')](function(_0x413156){if(_0x413156){return _0x413156?{'count':_0x4f6576,'rows':_0x413156}:null;}})['then'](respondWithResult(_0x2506c0,null))[_0x46e0('0x2c')](handleError(_0x2506c0,null));};exports[_0x46e0('0xe8')]=function(_0x563d6d,_0x4bf139){var _0xf752f7={'raw':!![],'where':{}};var _0x56000b={};var _0x13058c={'count':0x0,'rows':[]};return db[_0x46e0('0x40')][_0x46e0('0x9a')]({'where':{'id':_0x563d6d['params']['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x4bf139,null))[_0x46e0('0x23')](function(_0x500b2c){if(_0x500b2c){_0x56000b[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db[_0x46e0('0xe9')][_0x46e0('0x41')]);_0x56000b[_0x46e0('0x5e')]=_['keys'](_0x563d6d['query']);_0x56000b[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x56000b[_0x46e0('0xd2')],_0x56000b[_0x46e0('0x5e')]);_0xf752f7[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0x56000b['model'],qs[_0x46e0('0xd7')](_0x563d6d[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0xf752f7[_0x46e0('0x51')]=_0xf752f7['attributes'][_0x46e0('0x55')]?_0xf752f7[_0x46e0('0x51')]:_0x56000b[_0x46e0('0xd2')];if(!_0x563d6d[_0x46e0('0x5e')]['hasOwnProperty'](_0x46e0('0xdd'))){_0xf752f7[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x563d6d[_0x46e0('0x5e')][_0x46e0('0x1f')]);_0xf752f7[_0x46e0('0x1d')]=qs[_0x46e0('0x1d')](_0x563d6d[_0x46e0('0x5e')][_0x46e0('0x1d')]);}_0xf752f7['order']=qs['sort'](_0x563d6d[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0xf752f7[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x563d6d[_0x46e0('0x5e')],_0x56000b[_0x46e0('0xd5')]));_0xf752f7[_0x46e0('0xda')][_0x46e0('0xe4')]=_0x500b2c['id'];if(_0x563d6d[_0x46e0('0x5e')][_0x46e0('0x38')]){_0xf752f7[_0x46e0('0xda')]=_[_0x46e0('0x60')](_0xf752f7[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0xf752f7[_0x46e0('0x51')],function(_0x592667){var _0x5a0c38={};_0x5a0c38[_0x592667]={'$like':'%'+_0x563d6d['query'][_0x46e0('0x38')]+'%'};return _0x5a0c38;})});}_0xf752f7=_[_0x46e0('0x60')]({},_0xf752f7,_0x563d6d['options']);return db[_0x46e0('0xe9')][_0x46e0('0x20')]({'where':_0xf752f7[_0x46e0('0xda')]})['then'](function(_0x5b891f){_0x13058c[_0x46e0('0x20')]=_0x5b891f;if(_0x563d6d[_0x46e0('0x5e')][_0x46e0('0x4c')]){_0xf752f7[_0x46e0('0x4d')]=[{'all':!![]}];}return db[_0x46e0('0xe9')][_0x46e0('0x52')](_0xf752f7);})[_0x46e0('0x23')](function(_0x3ee0a4){_0x13058c[_0x46e0('0x54')]=_0x3ee0a4;return _0x13058c;});}})[_0x46e0('0x23')](respondWithFilteredResult(_0x4bf139,_0xf752f7))[_0x46e0('0x2c')](handleError(_0x4bf139,null));};exports[_0x46e0('0xea')]=function(_0x3f9ced,_0x5d9a6a){var _0x453339={};var _0x26b5c9={};var _0x2a1f7b;var _0x214aab;return db['User']['findOne']({'where':{'id':_0x3f9ced['params']['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x5d9a6a,null))[_0x46e0('0x23')](function(_0x16de00){if(_0x16de00){_0x2a1f7b=_0x16de00;_0x26b5c9[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db['SmsInteraction'][_0x46e0('0x41')]);_0x26b5c9[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x3f9ced[_0x46e0('0x5e')]);_0x26b5c9[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x26b5c9[_0x46e0('0xd2')],_0x26b5c9[_0x46e0('0x5e')]);_0x453339[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0x26b5c9[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x3f9ced['query']['fields']));_0x453339[_0x46e0('0x51')]=_0x453339[_0x46e0('0x51')][_0x46e0('0x55')]?_0x453339[_0x46e0('0x51')]:_0x26b5c9[_0x46e0('0xd2')];_0x453339[_0x46e0('0xd8')]=qs[_0x46e0('0xd9')](_0x3f9ced['query'][_0x46e0('0xd9')]);_0x453339[_0x46e0('0xda')]=qs['filters'](_['pick'](_0x3f9ced['query'],_0x26b5c9['filters']));if(_0x3f9ced['query'][_0x46e0('0x38')]){_0x453339[_0x46e0('0xda')]=_['merge'](_0x453339[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x453339[_0x46e0('0x51')],function(_0x4aaf68){var _0x2ddb22={};_0x2ddb22[_0x4aaf68]={'$like':'%'+_0x3f9ced['query'][_0x46e0('0x38')]+'%'};return _0x2ddb22;})});}_0x453339=_[_0x46e0('0x60')]({},_0x453339,_0x3f9ced[_0x46e0('0x61')]);return _0x2a1f7b[_0x46e0('0xea')](_0x453339);}})[_0x46e0('0x23')](function(_0x5b9195){if(_0x5b9195){_0x214aab=_0x5b9195['length'];if(!_0x3f9ced[_0x46e0('0x5e')][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x453339[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x3f9ced[_0x46e0('0x5e')]['limit']);_0x453339['offset']=qs[_0x46e0('0x1d')](_0x3f9ced[_0x46e0('0x5e')]['offset']);}return _0x2a1f7b['getSmsInteractions'](_0x453339);}})['then'](function(_0x8c5998){if(_0x8c5998){return _0x8c5998?{'count':_0x214aab,'rows':_0x8c5998}:null;}})[_0x46e0('0x23')](respondWithResult(_0x5d9a6a,null))[_0x46e0('0x2c')](handleError(_0x5d9a6a,null));};exports[_0x46e0('0xeb')]=function(_0x51273,_0x537b5a){var _0x5ece52={};var _0x24dac0={};var _0x44569a;var _0x167e4f;return db[_0x46e0('0x40')][_0x46e0('0x9a')]({'where':{'id':_0x51273['params']['id']}})['then'](handleEntityNotFound(_0x537b5a,null))[_0x46e0('0x23')](function(_0x34332d){if(_0x34332d){_0x44569a=_0x34332d;_0x24dac0[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db[_0x46e0('0xec')][_0x46e0('0x41')]);_0x24dac0[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x51273['query']);_0x24dac0[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x24dac0[_0x46e0('0xd2')],_0x24dac0[_0x46e0('0x5e')]);_0x5ece52[_0x46e0('0x51')]=_['intersection'](_0x24dac0[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x51273['query']['fields']));_0x5ece52[_0x46e0('0x51')]=_0x5ece52[_0x46e0('0x51')]['length']?_0x5ece52[_0x46e0('0x51')]:_0x24dac0[_0x46e0('0xd2')];_0x5ece52[_0x46e0('0xd8')]=qs[_0x46e0('0xd9')](_0x51273[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x5ece52['where']=qs[_0x46e0('0xd5')](_['pick'](_0x51273[_0x46e0('0x5e')],_0x24dac0[_0x46e0('0xd5')]));if(_0x51273[_0x46e0('0x5e')][_0x46e0('0x38')]){_0x5ece52[_0x46e0('0xda')]=_['merge'](_0x5ece52[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x5ece52[_0x46e0('0x51')],function(_0x5bd74a){var _0x371da7={};_0x371da7[_0x5bd74a]={'$like':'%'+_0x51273[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0x371da7;})});}_0x5ece52=_[_0x46e0('0x60')]({},_0x5ece52,_0x51273[_0x46e0('0x61')]);return _0x44569a[_0x46e0('0xeb')](_0x5ece52);}})['then'](function(_0x998c72){if(_0x998c72){_0x167e4f=_0x998c72[_0x46e0('0x55')];if(!_0x51273['query'][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x5ece52['limit']=qs['limit'](_0x51273[_0x46e0('0x5e')]['limit']);_0x5ece52[_0x46e0('0x1d')]=qs[_0x46e0('0x1d')](_0x51273['query'][_0x46e0('0x1d')]);}return _0x44569a[_0x46e0('0xeb')](_0x5ece52);}})[_0x46e0('0x23')](function(_0x4737d6){if(_0x4737d6){return _0x4737d6?{'count':_0x167e4f,'rows':_0x4737d6}:null;}})[_0x46e0('0x23')](respondWithResult(_0x537b5a,null))['catch'](handleError(_0x537b5a,null));};exports[_0x46e0('0xed')]=function(_0x2d9388,_0x2ddd1f){var _0x52e1dd={};var _0xbc0d04={};var _0x4ef16a;var _0x501fa6;return db[_0x46e0('0x40')][_0x46e0('0x9a')]({'where':{'id':_0x2d9388['params']['id']}})['then'](handleEntityNotFound(_0x2ddd1f,null))[_0x46e0('0x23')](function(_0x3df633){if(_0x3df633){_0x4ef16a=_0x3df633;_0xbc0d04[_0x46e0('0xd2')]=_['keys'](db['WhatsappInteraction'][_0x46e0('0x41')]);_0xbc0d04[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x2d9388[_0x46e0('0x5e')]);_0xbc0d04['filters']=_['intersection'](_0xbc0d04[_0x46e0('0xd2')],_0xbc0d04[_0x46e0('0x5e')]);_0x52e1dd[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0xbc0d04[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x2d9388[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0x52e1dd['attributes']=_0x52e1dd[_0x46e0('0x51')][_0x46e0('0x55')]?_0x52e1dd[_0x46e0('0x51')]:_0xbc0d04['model'];_0x52e1dd[_0x46e0('0xd8')]=qs['sort'](_0x2d9388[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x52e1dd[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x2d9388[_0x46e0('0x5e')],_0xbc0d04['filters']));if(_0x2d9388[_0x46e0('0x5e')][_0x46e0('0x38')]){_0x52e1dd[_0x46e0('0xda')]=_[_0x46e0('0x60')](_0x52e1dd[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x52e1dd[_0x46e0('0x51')],function(_0x2db644){var _0x3a6afd={};_0x3a6afd[_0x2db644]={'$like':'%'+_0x2d9388[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0x3a6afd;})});}_0x52e1dd=_[_0x46e0('0x60')]({},_0x52e1dd,_0x2d9388['options']);return _0x4ef16a[_0x46e0('0xed')](_0x52e1dd);}})['then'](function(_0xbcf890){if(_0xbcf890){_0x501fa6=_0xbcf890[_0x46e0('0x55')];if(!_0x2d9388[_0x46e0('0x5e')][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x52e1dd[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x2d9388[_0x46e0('0x5e')][_0x46e0('0x1f')]);_0x52e1dd['offset']=qs[_0x46e0('0x1d')](_0x2d9388[_0x46e0('0x5e')][_0x46e0('0x1d')]);}return _0x4ef16a['getWhatsappInteractions'](_0x52e1dd);}})[_0x46e0('0x23')](function(_0x864703){if(_0x864703){return _0x864703?{'count':_0x501fa6,'rows':_0x864703}:null;}})[_0x46e0('0x23')](respondWithResult(_0x2ddd1f,null))['catch'](handleError(_0x2ddd1f,null));};exports[_0x46e0('0xee')]=function(_0x8c9c48,_0x7ed4c1,_0x49a9c1){var _0x191329;var _0xc71391;var _0x1019e2;var _0x2c3b7a=!_[_0x46e0('0x6d')](_0x8c9c48[_0x46e0('0x5f')]['id'])?_0x8c9c48['params']['id']:!_[_0x46e0('0x6d')](_0x8c9c48[_0x46e0('0x34')]['id'])?_0x8c9c48[_0x46e0('0x34')]['id']:null;return db[_0x46e0('0x40')]['find']({'where':{'id':_0x2c3b7a,'role':{'$or':['admin','user',_0x46e0('0x35')]}},'attributes':['id','name',_0x46e0('0xef'),'mobile','role',_0x46e0('0x69'),_0x46e0('0xf0')]})[_0x46e0('0x23')](function(_0x2889d5){if(_0x2889d5){if(_0x2889d5['role']===_0x46e0('0x35')){_0x191329=_0x2889d5;if(_0x8c9c48[_0x46e0('0x63')]['interface']){_0x1019e2=util[_0x46e0('0xac')]('LOCAL/%s@from-sip/n',_0x191329[_0x8c9c48[_0x46e0('0x63')]['interface']]);}else if(_0x8c9c48[_0x46e0('0x63')][_0x46e0('0xf1')]){_0x1019e2=util['format'](_0x46e0('0xf2'),_0x8c9c48[_0x46e0('0x63')]['intrf']);}else{_0x1019e2=util['format']('SIP/%s',_0x191329['name']);}socket['to'](util[_0x46e0('0xac')](_0x46e0('0xf3'),_0x191329[_0x46e0('0x3c')]))[_0x46e0('0x2e')]('user:forcelogout',{'user':{'id':_0x191329['id'],'name':_0x191329['name']},'ip':_0x8c9c48[_0x46e0('0xf4')][_0x46e0('0xf5')]||_0x8c9c48[_0x46e0('0xf6')][_0x46e0('0xf7')]||_0x8c9c48[_0x46e0('0xf8')][_0x46e0('0xf7')]||_0x8c9c48[_0x46e0('0xf6')][_0x46e0('0xf8')][_0x46e0('0xf7')]});return db[_0x46e0('0xb3')][_0x46e0('0x3e')]({'where':{'membername':_0x191329[_0x46e0('0x3c')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x46e0('0x97'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x46e0('0x23')](function(){if(_0x191329){return _0x191329[_0x46e0('0xf9')]({'raw':!![]});}})[_0x46e0('0x23')](function(_0x5409be){if(_0x191329){if(_0x5409be){_0xc71391=_0x5409be;if(_0xc71391[_0x46e0('0x55')]){var _0x412d0b=_0xc71391[_0x46e0('0x42')](function(_0x11f3d1){var _0x83c000={'membername':_0x191329[_0x46e0('0x3c')],'UserId':_0x191329['id'],'queue_name':_0x11f3d1[_0x46e0('0x3c')],'VoiceQueueId':_0x11f3d1['id'],'interface':_0x1019e2,'paused':_0x191329[_0x46e0('0xf0')]||![],'penalty':_0x11f3d1[_0x46e0('0xfa')]||0x0};return db[_0x46e0('0xb3')][_0x46e0('0xae')](_0x83c000);});return Promise[_0x46e0('0x5c')](_0x412d0b);}}}})[_0x46e0('0x23')](function(){if(_0x191329){return db['MemberReport'][_0x46e0('0x52')]({'where':{'membername':_0x191329[_0x46e0('0x3c')],'exitAt':null}});}})[_0x46e0('0x23')](function(_0xd9af5e){if(_0x191329){var _0x82bdaa=[];_0xd9af5e['forEach'](function(_0x3ee090){_0x82bdaa['push'](_0x3ee090[_0x46e0('0x2d')]({'exitAt':moment()['format'](_0x46e0('0xfb'))}));});return Promise[_0x46e0('0x5c')](_0x82bdaa);}})['then'](function(){if(_0x191329){var _0x297a6f=[];var _0x1ce29c=[];var _0x22529c=utils[_0x46e0('0xfc')]();var _0x452814={'membername':_0x191329[_0x46e0('0x3c')],'interface':_0x1019e2,'enterAt':moment()[_0x46e0('0xac')](_0x46e0('0xfb')),'role':_0x191329[_0x46e0('0x31')],'internal':_0x191329[_0x46e0('0x69')]};_0x22529c[_0x46e0('0xfd')](function(_0x6c7109){_0x297a6f[_0x46e0('0x56')](_[_0x46e0('0x60')]({'channel':_0x6c7109,'type':'LOGIN','data1':_0x8c9c48[_0x46e0('0x63')]['device'],'data2':_0x1019e2},_0x452814));if(_0x191329['loginInPause']){_0x1ce29c[_0x46e0('0x56')](_[_0x46e0('0x60')]({'channel':_0x6c7109,'type':_0x46e0('0xfe'),'data1':'LOGININPAUSE'},_0x452814));}});return db[_0x46e0('0xff')][_0x46e0('0x8a')](_0x297a6f[_0x46e0('0xc8')](_0x1ce29c),{'individualHooks':!![]});}})['then'](function(){if(_0x191329){return _0x191329[_0x46e0('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x46e0('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x191329['loginInPause']||![],'mailPause':_0x191329['loginInPause']||![],'chatPause':_0x191329['loginInPause']||![],'faxPause':_0x191329[_0x46e0('0xf0')]||![],'smsPause':_0x191329[_0x46e0('0xf0')]||![],'openchannelPause':_0x191329['loginInPause']||![],'whatsappPause':_0x191329[_0x46e0('0xf0')]||![],'pauseType':_0x191329[_0x46e0('0xf0')]?'LOGININPAUSE':null,'interface':_0x1019e2,'lastPauseAt':moment()[_0x46e0('0xac')](_0x46e0('0xfb'))});}})[_0x46e0('0x23')](function(_0x287558){if(_0x8c9c48[_0x46e0('0x100')]){return _0x49a9c1();}else{return Promise[_0x46e0('0x101')](_0x287558)[_0x46e0('0x23')](respondWithResult(_0x7ed4c1,null));}})[_0x46e0('0x2c')](handleError(_0x7ed4c1,null));};exports[_0x46e0('0x102')]=function(_0x62a05d,_0x229cc5){var _0x5006e4;return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x62a05d[_0x46e0('0x5f')]['id'],'role':_0x46e0('0x35')},'attributes':['id',_0x46e0('0x3c'),'role']})[_0x46e0('0x23')](handleEntityNotFound(_0x229cc5,null))['then'](function(_0x69f465){if(_0x69f465){_0x5006e4=_0x69f465;return db[_0x46e0('0xb3')][_0x46e0('0x3e')]({'where':{'membername':_0x5006e4[_0x46e0('0x3c')]},'individualHooks':!![]});}})[_0x46e0('0x23')](function(){return db[_0x46e0('0xff')][_0x46e0('0x52')]({'where':{'membername':_0x5006e4[_0x46e0('0x3c')],'exitAt':null}});})[_0x46e0('0x23')](function(_0x404394){var _0x3830e1=[];_0x404394[_0x46e0('0xfd')](function(_0x4e630a){_0x3830e1[_0x46e0('0x56')](_0x4e630a[_0x46e0('0x2d')]({'exitAt':moment()['format'](_0x46e0('0xfb'))}));});return Promise[_0x46e0('0x5c')](_0x3830e1);})['then'](function(){return _0x5006e4[_0x46e0('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x46e0('0x23')](respondWithResult(_0x229cc5,null))[_0x46e0('0x2c')](handleError(_0x229cc5,null));};exports[_0x46e0('0x103')]=function(_0x584e86,_0x3b4399){var _0x5487b3;return db[_0x46e0('0xb3')][_0x46e0('0x2d')]({'paused':0x1},{'where':{'UserId':_0x584e86[_0x46e0('0x5f')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x584e86['params']['id'],'role':_0x46e0('0x35')},'attributes':['id',_0x46e0('0x3c'),_0x46e0('0x31'),'internal',_0x46e0('0xa2'),'online']});})[_0x46e0('0x23')](handleEntityNotFound(_0x3b4399,null))[_0x46e0('0x23')](function(_0xb910df){if(_0xb910df){_0x5487b3=_0xb910df;return respondWithRpcPromise('QueuePause',_0x46e0('0x103'),{'id':_0x5487b3['id'],'name':_0x5487b3[_0x46e0('0x3c')],'pause':!![]});}})[_0x46e0('0x23')](function(){if(_0x5487b3){return db[_0x46e0('0xff')][_0x46e0('0x52')]({'where':{'membername':_0x5487b3[_0x46e0('0x3c')],'type':_0x46e0('0xfe'),'exitAt':null}});}})[_0x46e0('0x23')](function(_0x1b7c5e){if(_0x1b7c5e[_0x46e0('0x55')]){var _0x4fec09=moment()[_0x46e0('0xac')](_0x46e0('0xfb'));for(var _0x44c263=0x0,_0x3a4e72=_0x1b7c5e[_0x46e0('0x55')];_0x44c263<_0x3a4e72;_0x44c263++){_0x1b7c5e[_0x44c263][_0x46e0('0x104')]({'exitAt':_0x4fec09});}}})[_0x46e0('0x23')](function(){var _0x49ec58=[];var _0x49f7e0=utils[_0x46e0('0xfc')]();_0x49f7e0[_0x46e0('0xfd')](function(_0x1ae2fe){_0x49ec58[_0x46e0('0x56')]({'channel':_0x1ae2fe,'membername':_0x5487b3[_0x46e0('0x3c')],'interface':_[_0x46e0('0x6d')](_0x5487b3[_0x46e0('0xa2')])?util[_0x46e0('0xac')]('SIP/%s',_0x5487b3[_0x46e0('0x3c')]):_0x5487b3[_0x46e0('0xa2')],'type':'PAUSE','enterAt':moment()[_0x46e0('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x584e86[_0x46e0('0x63')][_0x46e0('0x44')]||_0x46e0('0x105'),'role':_0x5487b3[_0x46e0('0x31')],'internal':_0x5487b3['internal']});});return db[_0x46e0('0xff')][_0x46e0('0x8a')](_0x49ec58,{'individualHooks':!![]});})[_0x46e0('0x23')](function(){return _0x5487b3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x584e86[_0x46e0('0x63')]['type']||_0x46e0('0x105'),'lastPauseAt':moment()[_0x46e0('0xac')](_0x46e0('0xfb'))});})[_0x46e0('0x23')](respondWithResult(_0x3b4399,null))['catch'](handleError(_0x3b4399,null));};exports[_0x46e0('0x106')]=function(_0x2091d4,_0x38c399){if(_0x2091d4['body'][_0x46e0('0xa0')]&&!utils['isValidChannel'](_0x2091d4['body'][_0x46e0('0xa0')])){throw new APIBadRequestError(util[_0x46e0('0xac')](_0x46e0('0x107'),_0x2091d4[_0x46e0('0x63')][_0x46e0('0xa0')]));}return db[_0x46e0('0x40')][_0x46e0('0x64')]({'where':{'id':_0x2091d4[_0x46e0('0x5f')]['id']},'attributes':['id','name',_0x46e0('0x31'),_0x46e0('0x69'),_0x46e0('0xa2'),'online',_0x46e0('0xad'),_0x46e0('0x108'),_0x46e0('0x109'),'faxPause',_0x46e0('0x10a'),_0x46e0('0x10b'),_0x46e0('0x10c'),_0x46e0('0x10d'),_0x46e0('0x10e')]})[_0x46e0('0x23')](function(_0xfe3b66){if(!_0xfe3b66){throw new APINotFoundError(util[_0x46e0('0xac')](_0x46e0('0xc9'),_0x2091d4[_0x46e0('0x5f')]['id']));}return _0xfe3b66[_0x46e0('0x106')](_0x2091d4[_0x46e0('0x63')][_0x46e0('0xa0')]);})['then'](respondWithResult(_0x38c399,null))['catch'](APIHandleError(_0x38c399));};exports[_0x46e0('0x10f')]=function(_0x3c2860,_0x421966){var _0x3361da={};var _0x57dac8={};var _0x58b6cc;var _0x23c87b;return db['User'][_0x46e0('0x9a')]({'where':{'id':_0x3c2860['params']['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x421966,null))[_0x46e0('0x23')](function(_0x28c384){if(_0x28c384){_0x58b6cc=_0x28c384;_0x57dac8[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db['Team']['rawAttributes']);_0x57dac8['query']=_[_0x46e0('0xd3')](_0x3c2860[_0x46e0('0x5e')]);_0x57dac8[_0x46e0('0xd5')]=_['intersection'](_0x57dac8[_0x46e0('0xd2')],_0x57dac8[_0x46e0('0x5e')]);_0x3361da[_0x46e0('0x51')]=_['intersection'](_0x57dac8[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x3c2860[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0x3361da[_0x46e0('0x51')]=_0x3361da[_0x46e0('0x51')]['length']?_0x3361da[_0x46e0('0x51')]:_0x57dac8[_0x46e0('0xd2')];_0x3361da[_0x46e0('0xd8')]=qs[_0x46e0('0xd9')](_0x3c2860['query'][_0x46e0('0xd9')]);_0x3361da[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_['pick'](_0x3c2860[_0x46e0('0x5e')],_0x57dac8[_0x46e0('0xd5')]));if(_0x3c2860[_0x46e0('0x5e')]['filter']){_0x3361da[_0x46e0('0xda')]=_[_0x46e0('0x60')](_0x3361da[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x3361da['attributes'],function(_0x526c68){var _0x382afe={};_0x382afe[_0x526c68]={'$like':'%'+_0x3c2860[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0x382afe;})});}_0x3361da=_[_0x46e0('0x60')]({},_0x3361da,_0x3c2860[_0x46e0('0x61')]);return _0x58b6cc[_0x46e0('0x10f')](_0x3361da);}})['then'](function(_0x3023ac){if(_0x3023ac){_0x23c87b=_0x3023ac[_0x46e0('0x55')];if(!_0x3c2860['query']['hasOwnProperty'](_0x46e0('0xdd'))){_0x3361da[_0x46e0('0x1f')]=qs['limit'](_0x3c2860[_0x46e0('0x5e')][_0x46e0('0x1f')]);_0x3361da['offset']=qs[_0x46e0('0x1d')](_0x3c2860[_0x46e0('0x5e')][_0x46e0('0x1d')]);}return _0x58b6cc['getTeams'](_0x3361da);}})[_0x46e0('0x23')](function(_0x47f154){if(_0x47f154){return _0x47f154?{'count':_0x23c87b,'rows':_0x47f154}:null;}})[_0x46e0('0x23')](respondWithResult(_0x421966,null))[_0x46e0('0x2c')](handleError(_0x421966,null));};exports[_0x46e0('0x110')]=function(_0x108f4b,_0x5a05bc){var _0x47709d=_0x108f4b['params']['id'];var _0x53f1a9=_0x108f4b[_0x46e0('0x63')]?_0x108f4b[_0x46e0('0x63')][_0x46e0('0x68')]:null;var _0x4aa70d=[];return Promise['resolve']()[_0x46e0('0x23')](function(){if(!_0x53f1a9)throw new APIBadRequestError(_0x46e0('0x111'));})[_0x46e0('0x23')](function(){return db[_0x46e0('0x40')]['findOne']({'where':{'id':_0x47709d}});})[_0x46e0('0x23')](function(_0x39a162){if(!_0x39a162)throw new APINotFoundError(util[_0x46e0('0xac')](_0x46e0('0xc9'),_0x108f4b['params']['id']));return db[_0x46e0('0x6e')][_0x46e0('0x112')](function(_0x385309){return _0x39a162[_0x46e0('0x110')](_0x53f1a9,{'transaction':_0x385309})[_0x46e0('0x23')](function(){return db[_0x46e0('0x113')][_0x46e0('0x52')]({'where':{'id':{'$in':_0x53f1a9}}});})[_0x46e0('0x23')](function(_0x29279a){var _0x213dc2=_[_0x46e0('0x42')](_0x29279a,function(_0x1d7f9d){return _0x1d7f9d[_0x46e0('0x114')]();});return Promise[_0x46e0('0x5c')](_0x213dc2);})['then'](function(_0x3d65d6){_0x4aa70d=_[_0x46e0('0x115')](_0x3d65d6);var _0x471b81=_[_0x46e0('0x42')](_0x4aa70d,function(_0x1be0ab){return _0x1be0ab[_0x46e0('0x116')](_0x39a162['id'],{'transaction':_0x385309});});return Promise[_0x46e0('0x5c')](_0x471b81);})[_0x46e0('0x23')](function(){if(!_0x39a162['online'])return;var _0x26fcd4=_[_0x46e0('0x38')](_0x4aa70d,function(_0x4fdd5b){return _0x4fdd5b[_0x46e0('0x117')](_0x46e0('0xa0'))===_0x46e0('0x118');});var _0x24d703=_[_0x46e0('0x42')](_0x26fcd4,function(_0xa1b2d9){return db[_0x46e0('0xb3')]['upsert']({'membername':_0x39a162[_0x46e0('0x3c')],'UserId':_0x39a162['id'],'queue_name':_0xa1b2d9[_0x46e0('0x3c')],'VoiceQueueId':_0xa1b2d9['id'],'interface':_['isNil'](_0x39a162['interface'])?util['format'](_0x46e0('0xf2'),_0x39a162['name']):_0x39a162[_0x46e0('0xa2')],'paused':_0x39a162['voicePause']||![],'penalty':_0x39a162[_0x46e0('0xa9')]},{'transaction':_0x385309});});return Promise[_0x46e0('0x5c')](_0x24d703);})['then'](function(){return db[_0x46e0('0x119')]['findAll']({'where':{'teamId':{'$in':_0x53f1a9}}});})['then'](function(_0x3d8f76){var _0x1280a5=_[_0x46e0('0x42')](_0x3d8f76,function(_0x12736e){return db[_0x46e0('0x11a')][_0x46e0('0x90')]({'UserId':_0x39a162['id'],'VoicePrefixId':_0x12736e[_0x46e0('0x11b')]},{'transaction':_0x385309});});return Promise['all'](_0x1280a5);});});})[_0x46e0('0x23')](function(){for(var _0x33fa31=0x0;_0x33fa31<_0x4aa70d[_0x46e0('0x55')];_0x33fa31++){var _0x1bb0eb=_0x4aa70d[_0x33fa31][_0x46e0('0x117')]('channel');var _0x3253c1=_0x1bb0eb+_0x46e0('0xaa');socket[_0x46e0('0x2e')](_0x46e0('0x34')+_0x1bb0eb+'Queue:save',{'UserId':_0x47709d,['queueField']:_0x4aa70d[_0x33fa31]['id']});}})[_0x46e0('0x23')](respondWithStatusCode(_0x5a05bc,null))[_0x46e0('0x2c')](APIHandleError(_0x5a05bc));};exports[_0x46e0('0x11c')]=function(_0x236ded,_0x3dbaf0){var _0x544c9c=_0x236ded['params']['id'];var _0x45fffc=null;if(_0x236ded[_0x46e0('0x5e')][_0x46e0('0x68')]){_0x45fffc=_[_0x46e0('0xb1')](_0x236ded['query']['ids'])?_0x236ded[_0x46e0('0x5e')]['ids']:[_0x236ded['query']['ids']];}var _0x50d63b=[];return Promise[_0x46e0('0x101')]()[_0x46e0('0x23')](function(){if(!_0x45fffc)throw new APIBadRequestError(_0x46e0('0x11d'));})[_0x46e0('0x23')](function(){return db[_0x46e0('0x40')][_0x46e0('0x9a')]({'where':{'id':_0x544c9c}});})[_0x46e0('0x23')](function(_0x570887){if(!_0x570887)throw new APINotFoundError(util[_0x46e0('0xac')](_0x46e0('0xc9'),_0x236ded[_0x46e0('0x5f')]['id']));return db[_0x46e0('0x6e')]['transaction'](function(_0x2f9ade){return _0x570887[_0x46e0('0x11c')](_0x45fffc,{'transaction':_0x2f9ade})['then'](function(){return db[_0x46e0('0x113')][_0x46e0('0x52')]({'where':{'id':{'$in':_0x45fffc}}});})[_0x46e0('0x23')](function(_0x2a26f4){var _0x52d3d3=_[_0x46e0('0x42')](_0x2a26f4,function(_0x22f828){return _0x22f828['getAssociatedQueues']();});return Promise[_0x46e0('0x5c')](_0x52d3d3);})[_0x46e0('0x23')](function(_0x5e0943){_0x50d63b=_['flattenDeep'](_0x5e0943);var _0x21ebf0=_[_0x46e0('0x42')](_0x50d63b,function(_0x4ae0ca){return _0x4ae0ca[_0x46e0('0x11e')](_0x570887['id'],{'transaction':_0x2f9ade});});return Promise['all'](_0x21ebf0);})[_0x46e0('0x23')](function(){if(!_0x570887['online'])return;var _0x1b8533=_[_0x46e0('0x38')](_0x50d63b,function(_0x4c17f9){return _0x4c17f9[_0x46e0('0x117')](_0x46e0('0xa0'))===_0x46e0('0x118');});var _0x2be552=_['map'](_0x1b8533,function(_0x16b94e){return db[_0x46e0('0xb3')]['destroy']({'where':{'VoiceQueueId':_0x16b94e['id'],'UserId':_0x570887['id']},'transaction':_0x2f9ade});});return Promise[_0x46e0('0x5c')](_0x2be552);})[_0x46e0('0x23')](function(){return db[_0x46e0('0x119')][_0x46e0('0x52')]({'where':{'teamId':{'$in':_0x45fffc}}});})[_0x46e0('0x23')](function(_0x314c4f){var _0x210c3e=_[_0x46e0('0x42')](_0x314c4f,function(_0x4b92a4){return db[_0x46e0('0x11a')]['destroy']({'where':{'UserId':_0x570887['id'],'VoicePrefixId':_0x4b92a4[_0x46e0('0x11b')]}},{'transaction':_0x2f9ade});});return Promise[_0x46e0('0x5c')](_0x210c3e);});});})[_0x46e0('0x23')](function(){for(var _0x52ff6c=0x0;_0x52ff6c<_0x50d63b[_0x46e0('0x55')];_0x52ff6c++){var _0x4ba2ee=_0x50d63b[_0x52ff6c][_0x46e0('0x117')](_0x46e0('0xa0'));var _0x3f20fd=_0x4ba2ee+'QueueId';socket[_0x46e0('0x2e')]('user'+_0x4ba2ee+_0x46e0('0xb2'),{'UserId':_0x544c9c,['queueField']:_0x50d63b[_0x52ff6c]['id']});}})[_0x46e0('0x23')](respondWithStatusCode(_0x3dbaf0,null))[_0x46e0('0x2c')](APIHandleError(_0x3dbaf0));};exports['getLists']=function(_0x523169,_0xa1fb90){var _0x4253fb={};var _0x5d7845={};var _0x1be777;var _0x2e4559;return db[_0x46e0('0x40')]['findOne']({'where':{'id':_0x523169[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0xa1fb90,null))[_0x46e0('0x23')](function(_0x2ff39d){if(_0x2ff39d){_0x1be777=_0x2ff39d;_0x5d7845[_0x46e0('0xd2')]=_[_0x46e0('0xd3')](db[_0x46e0('0xcb')]['rawAttributes']);_0x5d7845[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x523169[_0x46e0('0x5e')]);_0x5d7845[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x5d7845[_0x46e0('0xd2')],_0x5d7845[_0x46e0('0x5e')]);_0x4253fb[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0x5d7845[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x523169[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0x4253fb[_0x46e0('0x51')]=_0x4253fb[_0x46e0('0x51')][_0x46e0('0x55')]?_0x4253fb[_0x46e0('0x51')]:_0x5d7845[_0x46e0('0xd2')];_0x4253fb[_0x46e0('0xd8')]=qs['sort'](_0x523169[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x4253fb[_0x46e0('0xda')]=qs[_0x46e0('0xd5')](_[_0x46e0('0xdb')](_0x523169[_0x46e0('0x5e')],_0x5d7845[_0x46e0('0xd5')]));if(_0x523169[_0x46e0('0x5e')]['filter']){_0x4253fb[_0x46e0('0xda')]=_['merge'](_0x4253fb[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x4253fb[_0x46e0('0x51')],function(_0x1d58ed){var _0x3fbb4a={};_0x3fbb4a[_0x1d58ed]={'$like':'%'+_0x523169[_0x46e0('0x5e')][_0x46e0('0x38')]+'%'};return _0x3fbb4a;})});}_0x4253fb=_[_0x46e0('0x60')]({},_0x4253fb,_0x523169[_0x46e0('0x61')]);return _0x1be777[_0x46e0('0x11f')](_0x4253fb);}})[_0x46e0('0x23')](function(_0x500bb1){if(_0x500bb1){_0x2e4559=_0x500bb1[_0x46e0('0x55')];if(!_0x523169['query'][_0x46e0('0xca')](_0x46e0('0xdd'))){_0x4253fb[_0x46e0('0x1f')]=qs[_0x46e0('0x1f')](_0x523169['query'][_0x46e0('0x1f')]);_0x4253fb[_0x46e0('0x1d')]=qs[_0x46e0('0x1d')](_0x523169[_0x46e0('0x5e')][_0x46e0('0x1d')]);}return _0x1be777['getLists'](_0x4253fb);}})[_0x46e0('0x23')](function(_0x58c26e){if(_0x58c26e){return _0x58c26e?{'count':_0x2e4559,'rows':_0x58c26e}:null;}})[_0x46e0('0x23')](respondWithResult(_0xa1fb90,null))[_0x46e0('0x2c')](handleError(_0xa1fb90,null));};exports[_0x46e0('0x120')]=function(_0x248610,_0x470e01){var _0x5a54bd={};var _0x15f7b6={};var _0x3c8700;return db[_0x46e0('0x40')]['findOne']({'where':{'id':_0x248610[_0x46e0('0x5f')]['id']}})[_0x46e0('0x23')](handleEntityNotFound(_0x470e01,null))['then'](function(_0x4fc1e6){if(_0x4fc1e6){_0x3c8700=_0x4fc1e6;_0x15f7b6[_0x46e0('0xd2')]=_['keys'](db[_0x46e0('0x40')][_0x46e0('0x41')]);_0x15f7b6[_0x46e0('0x5e')]=_[_0x46e0('0xd3')](_0x248610[_0x46e0('0x5e')]);_0x15f7b6[_0x46e0('0xd5')]=_[_0x46e0('0xd6')](_0x15f7b6[_0x46e0('0xd2')],_0x15f7b6['query']);_0x5a54bd[_0x46e0('0x51')]=_[_0x46e0('0xd6')](_0x15f7b6[_0x46e0('0xd2')],qs[_0x46e0('0xd7')](_0x248610[_0x46e0('0x5e')][_0x46e0('0xd7')]));_0x5a54bd[_0x46e0('0x51')]=_0x5a54bd[_0x46e0('0x51')][_0x46e0('0x55')]?_0x5a54bd['attributes']:_0x15f7b6[_0x46e0('0xd2')];_0x5a54bd[_0x46e0('0xd8')]=qs[_0x46e0('0xd9')](_0x248610[_0x46e0('0x5e')][_0x46e0('0xd9')]);_0x5a54bd[_0x46e0('0xda')]=qs['filters'](_[_0x46e0('0xdb')](_0x248610['query'],_0x15f7b6[_0x46e0('0xd5')]));if(_0x248610[_0x46e0('0x5e')][_0x46e0('0x38')]){_0x5a54bd[_0x46e0('0xda')]=_[_0x46e0('0x60')](_0x5a54bd[_0x46e0('0xda')],{'$or':_[_0x46e0('0x42')](_0x5a54bd[_0x46e0('0x51')],function(_0x37735b){var _0x48da6c={};_0x48da6c[_0x37735b]={'$like':'%'+_0x248610['query'][_0x46e0('0x38')]+'%'};return _0x48da6c;})});}_0x5a54bd[_0x46e0('0xd2')]=db[_0x46e0('0x40')];_0x5a54bd['as']=_0x46e0('0x89');_0x5a54bd=_[_0x46e0('0x60')]({},_0x5a54bd,_0x248610[_0x46e0('0x61')]);return _0x3c8700['getVoiceQueues']({'include':[_0x5a54bd]});}})[_0x46e0('0x23')](function(_0x53421b){if(_0x53421b){var _0x38aca2={},_0xa8d825=[];for(var _0xd7ba0e=0x0;_0xd7ba0e<_0x53421b[_0x46e0('0x55')];_0xd7ba0e+=0x1){for(var _0x3d6d3d=0x0,_0x57d925;_0x3d6d3d<_0x53421b[_0xd7ba0e][_0x46e0('0x89')][_0x46e0('0x55')];_0x3d6d3d+=0x1){_0x57d925=_0x53421b[_0xd7ba0e][_0x46e0('0x89')][_0x3d6d3d][_0x46e0('0x30')]({'plain':!![]});_0x38aca2[_0x57d925['id']]=_0x57d925;}}_0x38aca2=_[_0x46e0('0x121')](_0x38aca2);for(var _0x1a5349=qs[_0x46e0('0x1d')](_0x248610['query'][_0x46e0('0x1d')]);_0x1a5349<_0x38aca2[_0x46e0('0x55')]&&_0xa8d825[_0x46e0('0x55')]=_0x2d7026){_0x15e79e=_0x2d7026;_0x322140=0xc8;}else{_0x322140=0xce;}_0x1537d8[_0xd222('0x1b')](_0x322140);return _0x1537d8[_0xd222('0x21')](_0xd222('0x22'),_0x3460a2+'-'+_0x15e79e+'/'+_0x2d7026)[_0xd222('0x1c')](_0x14942a);}return null;};}function respondWithRpcPromise(_0x16a3ab,_0x51e00b,_0x5dad0b,_0x34e375){return new Promise(function(_0x2ed048,_0x5a9e2a){var _0x16d072=_0x34e375||amiClient;return _0x16d072['request'](_0x16a3ab,_0x5dad0b)[_0xd222('0x23')](function(_0x3939ee){logger['info'](_0xd222('0x24'),_0x51e00b,_0xd222('0x25'));logger[_0xd222('0x26')](_0xd222('0x27'),_0x51e00b,_0xd222('0x25'),JSON[_0xd222('0x28')](_0x3939ee));if(_0x3939ee[_0xd222('0x29')]){if(_0x3939ee[_0xd222('0x29')][_0xd222('0x2a')]===0x1f4){logger[_0xd222('0x29')](_0xd222('0x24'),_0x51e00b,_0x3939ee['error'][_0xd222('0x2b')]);return _0x5a9e2a(_0x3939ee[_0xd222('0x29')][_0xd222('0x2b')]);}logger[_0xd222('0x29')]('User,\x20%s,\x20%s',_0x51e00b,_0x3939ee[_0xd222('0x29')]['message']);return _0x2ed048(_0x3939ee[_0xd222('0x29')][_0xd222('0x2b')]);}else{logger['info'](_0xd222('0x24'),_0x51e00b,'request\x20sent');_0x2ed048(_0x3939ee[_0xd222('0x2c')]['message']);}})[_0xd222('0x2d')](function(_0x2c29f9){logger[_0xd222('0x29')](_0xd222('0x24'),_0x51e00b,_0x2c29f9);_0x5a9e2a(_0x2c29f9);});});}function saveUpdates(_0x53830e){return function(_0x26d4d0){if(_0x26d4d0){return _0x26d4d0['update'](_0x53830e)['then'](function(_0x4f237d){if(_0x4f237d['role']===_0xd222('0x2e')){socket[_0xd222('0x2f')](_0xd222('0x30')+_0x4f237d['id'],_0x4f237d);}return _0x4f237d;});}return null;};}function removeEntity(_0xdedb54,_0x31e53c){return function(_0x18185e){if(_0x18185e){return _0x18185e['destroy']({'transaction':_0x31e53c})[_0xd222('0x23')](function(){var _0x238a94=_0x18185e[_0xd222('0x31')]({'plain':!![]});if(_0x238a94[_0xd222('0x32')]===_0xd222('0x33'))return;var _0x2684d0=[{'name':_0xd222('0x34'),'value':_0xd222('0x35'),'ignore':!![]},{'name':_0xd222('0x36'),'value':_0xd222('0x2e'),'ignore':![]},{'name':_0xd222('0x37'),'value':'telephone','ignore':![]}];var _0x289906=_(_0x2684d0)[_0xd222('0x38')](_0xd222('0x39'))[_0xd222('0x3a')](_0xd222('0x3b'))[_0xd222('0x3b')]();if(_[_0xd222('0x3c')](_0x289906,_0x238a94['role'])){return;}var _0x302746=_[_0xd222('0x3d')](_0x2684d0,['value',_0x238a94[_0xd222('0x32')]])[_0xd222('0x3e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x302746,'resourceId':_0x238a94['id']},'transaction':_0x31e53c})[_0xd222('0x23')](function(){return _0x18185e;});})[_0xd222('0x23')](function(){_0xdedb54[_0xd222('0x1b')](0xcc)[_0xd222('0x3f')]();});}};}function handleEntityNotFound(_0x36be66){return function(_0x4a6a0c){if(!_0x4a6a0c){_0x36be66[_0xd222('0x1a')](0x194);}return _0x4a6a0c;};}function handleError(_0x3edce6,_0x46e116){_0x46e116=_0x46e116||0x1f4;return function(_0x2bea4c){logger[_0xd222('0x29')](_0x2bea4c[_0xd222('0x40')]);if(_0x2bea4c[_0xd222('0x3e')]){delete _0x2bea4c[_0xd222('0x3e')];}_0x3edce6[_0xd222('0x1b')](_0x46e116)[_0xd222('0x41')](_0x2bea4c);};}function getUserAttributes(){return _(db[_0xd222('0x42')][_0xd222('0x43')])['map'](function(_0x3ba1cd){return{'name':_0x3ba1cd[_0xd222('0x44')],'type':_0x3ba1cd['type'][_0xd222('0x45')]};})['filter'](function(_0x5a3e6c){return!['password',_0xd222('0x46'),_0xd222('0x47'),_0xd222('0x48'),_0xd222('0x49'),_0xd222('0x4a')][_0xd222('0x3c')](_0x5a3e6c[_0xd222('0x3e')]);})[_0xd222('0x3b')]();}exports[_0xd222('0x4b')]=function(_0xe07997,_0x5ba00a){var _0x447752={},_0x13d72a={'count':0x0,'rows':[]};var _0xe465e8=getUserAttributes();_0x447752=qs['getOptions'](_0xe465e8,_0xe07997);var _0xd0a38a={'where':_0x447752[_0xd222('0x4c')]};return db[_0xd222('0x42')][_0xd222('0x20')](_0xd0a38a)[_0xd222('0x23')](function(_0x3f553e){_0x13d72a[_0xd222('0x20')]=_0x3f553e;if(_0xe07997[_0xd222('0x4d')][_0xd222('0x4e')]){_0x447752[_0xd222('0x4f')]=[{'all':!![]}];}if(_0xe07997[_0xd222('0x4d')][_0xd222('0x50')]===_0xd222('0x51')){_0x447752[_0xd222('0x4f')]=[{'model':db[_0xd222('0x52')],'as':_0xd222('0x50')}];}if(!_[_0xd222('0x3c')](_0x447752[_0xd222('0x53')],'id')){_0x447752[_0xd222('0x53')][_0xd222('0x54')]('id');}return db[_0xd222('0x42')][_0xd222('0x55')](_0x447752);})[_0xd222('0x23')](function(_0x4f3f6e){_0x13d72a[_0xd222('0x56')]=_0x4f3f6e;if(_0xe07997[_0xd222('0x4d')][_0xd222('0x57')]===_0xd222('0x51')){var _0x3378d2=[];for(var _0x560765=0x0;_0x560765<_0x13d72a[_0xd222('0x56')]['length'];_0x560765++){_0x3378d2[_0xd222('0x54')](get_open_tabs(_0xd222('0x58'),_0x13d72a[_0xd222('0x56')][_0x560765][_0xd222('0x59')]));_0x3378d2[_0xd222('0x54')](get_open_tabs(_0xd222('0x5a'),_0x13d72a[_0xd222('0x56')][_0x560765][_0xd222('0x59')]));_0x3378d2[_0xd222('0x54')](get_open_tabs(_0xd222('0x5b'),_0x13d72a[_0xd222('0x56')][_0x560765][_0xd222('0x59')]));_0x3378d2['push'](get_open_tabs('mail',_0x13d72a[_0xd222('0x56')][_0x560765]['dataValues']));_0x3378d2[_0xd222('0x54')](get_open_tabs('openchannel',_0x13d72a['rows'][_0x560765][_0xd222('0x59')]));_0x3378d2[_0xd222('0x54')](get_open_tabs(_0xd222('0x5c'),_0x13d72a[_0xd222('0x56')][_0x560765]['dataValues']));}return Promise['all'](_0x3378d2)[_0xd222('0x23')](function(){return _0x13d72a;});}else{return _0x13d72a;}})[_0xd222('0x23')](respondWithFilteredResult(_0x5ba00a,_0x447752))['catch'](handleError(_0x5ba00a,null));};exports[_0xd222('0x5d')]=function(_0x3fa803,_0x30786b){var _0x67de6e=getUserAttributes();_0x3fa803[_0xd222('0x4d')]['id']=_0x3fa803['params']['id'];var _0x3932e2=qs[_0xd222('0x5e')](_0x67de6e,_0x3fa803);if(_0x3fa803[_0xd222('0x4d')]['includeAll']){_0x3932e2['include']=[{'all':!![]}];}if(_0x3fa803[_0xd222('0x4d')][_0xd222('0x50')]===_0xd222('0x51')){_0x3932e2[_0xd222('0x4f')]=[{'model':db[_0xd222('0x52')],'as':_0xd222('0x50')}];}_0x3932e2=_[_0xd222('0x5f')]({},_0x3932e2,_0x3fa803['options']);if(!_[_0xd222('0x3c')](_0x3932e2[_0xd222('0x53')],'id')){_0x3932e2[_0xd222('0x53')][_0xd222('0x54')]('id');}return db[_0xd222('0x42')][_0xd222('0x3d')](_0x3932e2)[_0xd222('0x23')](handleEntityNotFound(_0x30786b,null))['then'](function(_0x55c5e5){var _0x245f6e=[];values=_0x55c5e5;if(_0x3fa803[_0xd222('0x4d')][_0xd222('0x57')]===_0xd222('0x51')){_0x245f6e[_0xd222('0x54')](get_open_tabs(_0xd222('0x58'),_0x55c5e5[_0xd222('0x59')]));_0x245f6e[_0xd222('0x54')](get_open_tabs(_0xd222('0x5a'),_0x55c5e5[_0xd222('0x59')]));_0x245f6e['push'](get_open_tabs('openchannel',_0x55c5e5['dataValues']));_0x245f6e['push'](get_open_tabs(_0xd222('0x5c'),_0x55c5e5[_0xd222('0x59')]));_0x245f6e['push'](get_open_tabs(_0xd222('0x5b'),_0x55c5e5['dataValues']));_0x245f6e[_0xd222('0x54')](get_open_tabs(_0xd222('0x60'),_0x55c5e5[_0xd222('0x59')]));return Promise[_0xd222('0x61')](_0x245f6e);}else{return values;}})['then'](function(){return values;})[_0xd222('0x23')](respondWithResult(_0x30786b,null))['catch'](handleError(_0x30786b,null));};exports[_0xd222('0x62')]=function(_0x453c71,_0x1b0bdf){if(_0x453c71[_0xd222('0x63')]['id']){delete _0x453c71[_0xd222('0x63')]['id'];}delete _0x453c71['body'][_0xd222('0x32')];return db['User'][_0xd222('0x3d')]({'where':{'id':_0x453c71[_0xd222('0x64')]['id']}})['then'](handleEntityNotFound(_0x1b0bdf,null))['then'](saveUpdates(_0x453c71[_0xd222('0x63')],null))[_0xd222('0x23')](respondWithResult(_0x1b0bdf,null))[_0xd222('0x2d')](handleError(_0x1b0bdf,null));};exports[_0xd222('0x65')]=function(_0x146668,_0xc71347){return db['User'][_0xd222('0x65')]()['then'](respondWithResult(_0xc71347,null))[_0xd222('0x2d')](handleError(_0xc71347,null));};exports['addContacts']=function(_0xa183be,_0x53ab75){return db['User'][_0xd222('0x3d')]({'where':{'id':_0xa183be[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x53ab75,null))[_0xd222('0x23')](function(_0x46de29){if(_0x46de29){return _0x46de29[_0xd222('0x66')](_0xa183be[_0xd222('0x63')][_0xd222('0x67')],_[_0xd222('0x68')](_0xa183be['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x53ab75,null))['catch'](handleError(_0x53ab75,null));};function validateUser(_0x262067){return new Promise(function(_0x457a9c,_0x22c422){if(_0x262067[_0xd222('0x69')])return _0x457a9c(_0x262067);return db[_0xd222('0x6a')][_0xd222('0x6b')](0x1)[_0xd222('0x23')](function(_0x51222a){if(_0x51222a['securePassword'])authService['validatePasswordPattern'](_0x262067[_0xd222('0x6c')]);db[_0xd222('0x42')][_0xd222('0x6d')]('internal')[_0xd222('0x23')](function(_0x30e808){if(_[_0xd222('0x6e')](_0x30e808)){_0x262067[_0xd222('0x69')]=_0x51222a[_0xd222('0x6f')]||0x1;return;}if(_[_0xd222('0x6e')](_0x51222a[_0xd222('0x6f')])||_0x51222a[_0xd222('0x6f')]===_0x30e808){_0x262067[_0xd222('0x69')]=_0x30e808+0x1;return;}if(_0x51222a[_0xd222('0x6f')]>_0x30e808){_0x262067['internal']=_0x51222a[_0xd222('0x6f')];return;}return db[_0xd222('0x70')]['query'](_0xd222('0x71'),{'type':db[_0xd222('0x70')][_0xd222('0x72')][_0xd222('0x73')]})['then'](function(_0x49fc2b){if(_0x49fc2b&&_0x49fc2b[_0xd222('0x74')]){for(var _0x422e46=0x0,_0x2a0f29=_0x49fc2b[_0xd222('0x74')];_0x422e46<_0x2a0f29&&_['isNil'](_0x262067[_0xd222('0x69')]);_0x422e46++){if(_0x51222a[_0xd222('0x6f')]<=_0x49fc2b[_0x422e46]['from']){_0x262067['internal']=_0x49fc2b[_0x422e46]['from'];}else if(_0x51222a[_0xd222('0x6f')]>_0x49fc2b[_0x422e46][_0xd222('0x75')]&&_0x51222a[_0xd222('0x6f')]<=_0x49fc2b[_0x422e46]['to']){_0x262067['internal']=_0x51222a[_0xd222('0x6f')];}}}if(_['isNil'](_0x262067[_0xd222('0x69')])){_0x262067['internal']=_0x30e808+0x1;}return _0x457a9c(_0x262067);});});})[_0xd222('0x2d')](function(_0x1216ea){_0x22c422(_0x1216ea);});});}function updateUser(_0xc1da57){return new Promise(function(_0xb428cb,_0x23ef27){try{if(_0xc1da57[_0xd222('0x76')]){_0xc1da57[_0xd222('0x77')]=_0xc1da57[_0xd222('0x69')];_0xc1da57[_0xd222('0x78')]={'mailbox':_0xc1da57[_0xd222('0x69')],'password':_0xc1da57[_0xd222('0x6c')],'fullname':_0xc1da57[_0xd222('0x79')],'email':_0xc1da57[_0xd222('0x7a')]};}if(_0xc1da57[_0xd222('0x32')]==='agent'){if(!_0xc1da57[_0xd222('0x7b')])_0xc1da57[_0xd222('0x7b')]=[_0xd222('0x7c'),_0xd222('0x7d'),_0xd222('0x7e'),'113','110',_0xd222('0x7f'),_0xd222('0x80'),_0xd222('0x81'),'107',_0xd222('0x82'),_0xd222('0x83'),_0xd222('0x84'),_0xd222('0x85'),_0xd222('0x86'),_0xd222('0x87')];}_0xb428cb(_0xc1da57);}catch(_0x18f81f){_0x23ef27(_0x18f81f);}});}exports['create']=function(_0x12e7a7,_0x379964){if(_0x12e7a7['user'][_0xd222('0x32')]===_0xd222('0x2e'))throw new Error(_0xd222('0x88'));if(_0x12e7a7[_0xd222('0x63')]['role']==='user'&&_0x12e7a7['user'][_0xd222('0x32')]!==_0xd222('0x33')){throw new Error(_0xd222('0x89'));}if(_0x12e7a7[_0xd222('0x63')][_0xd222('0x32')]===_0xd222('0x33')&&_0x12e7a7[_0xd222('0x35')]['role']!==_0xd222('0x33')){throw new Error(_0xd222('0x8a'));}return licenseUtil[_0xd222('0x8b')]([_0x12e7a7[_0xd222('0x63')]])[_0xd222('0x23')](function(){return validateUser(_0x12e7a7[_0xd222('0x63')]);})[_0xd222('0x23')](function(_0x1037ff){return updateUser(_0x1037ff)[_0xd222('0x23')](function(_0x4b9d54){if(_0x4b9d54[_0xd222('0x32')]==='admin'){_0x4b9d54[_0xd222('0x8c')]=_0x12e7a7['user'][_0xd222('0x8c')];delete _0x4b9d54[_0xd222('0x8d')];}return _0x4b9d54;});})[_0xd222('0x23')](function(_0x3998ab){return db['User'][_0xd222('0x8e')](_0x3998ab,{'include':[{'model':db['VoiceMail'],'as':_0xd222('0x78')}]});})[_0xd222('0x23')](function(_0x51445d){if(_0x12e7a7[_0xd222('0x63')][_0xd222('0x32')]==='user')return _0x51445d;if(_0x12e7a7[_0xd222('0x35')][_0xd222('0x32')]!==_0xd222('0x35'))return _0x51445d;return db[_0xd222('0x8f')][_0xd222('0x3d')]({'where':{'name':_0x51445d[_0xd222('0x32')]===_0xd222('0x2e')?_0xd222('0x36'):'Telephones','userProfileId':_0x12e7a7[_0xd222('0x35')][_0xd222('0x8d')]},'raw':!![]})[_0xd222('0x23')](function(_0x42fff7){if(!_0x42fff7||_0x42fff7['autoAssociation']!=0x0)return _0x51445d;return db['UserProfileResource'][_0xd222('0x8e')]({'name':_0x51445d[_0xd222('0x3e')],'resourceId':_0x51445d['id'],'type':_0x42fff7['name'],'sectionId':_0x42fff7['id']},{})['then'](function(){return _0x51445d;});})[_0xd222('0x2d')](function(_0x596708){logger[_0xd222('0x29')](_0xd222('0x90'),_0x596708);throw _0x596708;});})[_0xd222('0x23')](respondWithResult(_0x379964,0xc9))[_0xd222('0x2d')](handleError(_0x379964,null));};exports['bulkCreate']=function(_0x22cc1c,_0x1f4fe9){var _0x1a9526=_0x22cc1c[_0xd222('0x63')];var _0x2a92ba=[];if(_0x22cc1c[_0xd222('0x35')][_0xd222('0x32')]==='agent')throw new Error(_0xd222('0x88'));if(_['some'](_0x1a9526,['role','user'])&&_0x22cc1c['user'][_0xd222('0x32')]!==_0xd222('0x33')){throw new Error(_0xd222('0x89'));}if(_['some'](_0x1a9526,[_0xd222('0x32'),_0xd222('0x33')])&&_0x22cc1c[_0xd222('0x35')][_0xd222('0x32')]!==_0xd222('0x33')){throw new Error(_0xd222('0x91'));}return licenseUtil[_0xd222('0x8b')](_0x1a9526)[_0xd222('0x23')](function(){return validateUser(_0x1a9526[0x0]);})['then'](function(){for(var _0x42194c=0x1;_0x42194c<_0x1a9526['length'];_0x42194c++){var _0x2e768d=_0x1a9526[_0x42194c-0x1][_0xd222('0x69')];if(!_0x1a9526[_0x42194c][_0xd222('0x69')])_0x1a9526[_0x42194c][_0xd222('0x69')]=_0x2e768d+0x1;_0x2a92ba['push'](validateUser(_0x1a9526[_0x42194c]));}return Promise[_0xd222('0x61')](_0x2a92ba);})[_0xd222('0x23')](function(){_0x2a92ba=[];for(var _0x518ee5=0x0;_0x518ee5<_0x1a9526[_0xd222('0x74')];_0x518ee5++){_0x2a92ba[_0xd222('0x54')](updateUser(_0x1a9526[_0x518ee5]));}return Promise[_0xd222('0x61')](_0x2a92ba);})[_0xd222('0x23')](function(){_0x2a92ba=_0x1a9526[_0xd222('0x3a')](function(_0x22cd2c){return db[_0xd222('0x42')][_0xd222('0x8e')](_0x22cd2c,{'include':[{'model':db[_0xd222('0x78')],'as':_0xd222('0x78')}]})[_0xd222('0x23')](function(_0xcb2694){_0x22cd2c['id']=_0xcb2694['id'];return _0x22cd2c;});});return Promise[_0xd222('0x61')](_0x2a92ba);})[_0xd222('0x23')](function(_0x41b7d9){if(_0x22cc1c[_0xd222('0x63')]['role']===_0xd222('0x35'))return _0x41b7d9;if(_0x22cc1c['user'][_0xd222('0x32')]!==_0xd222('0x35'))return _0x41b7d9;var _0x4ed123=_['some'](_0x41b7d9,function(_0x21d4a8){return _0x21d4a8[_0xd222('0x32')]===_0xd222('0x2e')||_0x21d4a8[_0xd222('0x32')]==='telephone';});if(!_0x4ed123)return _0x41b7d9;return db[_0xd222('0x8f')][_0xd222('0x55')]({'where':{'name':{'$or':[_0xd222('0x36'),_0xd222('0x37')]},'userProfileId':_0x22cc1c[_0xd222('0x35')][_0xd222('0x8d')]},'raw':!![]})[_0xd222('0x23')](function(_0x27423f){if(_[_0xd222('0x92')](_0x27423f)||!_['some'](_0x27423f,['autoAssociation',0x0]))return _0x41b7d9;_0x2a92ba=[];var _0x4e3f14=_(_0x27423f)[_0xd222('0x3a')](function(_0x3fe3f8){if(_0x3fe3f8[_0xd222('0x93')]===0x1)return;return _0x3fe3f8['name']===_0xd222('0x36')?_0xd222('0x2e'):_0xd222('0x94');})['compact']()[_0xd222('0x3b')]();for(var _0x8cc334=0x0;_0x8cc334<_0x41b7d9['length'];_0x8cc334++){if(!_[_0xd222('0x3c')](_0x4e3f14,_0x41b7d9[_0x8cc334][_0xd222('0x32')]))return;var _0x79f4ea=_0x41b7d9[_0x8cc334][_0xd222('0x32')]===_0xd222('0x2e')?_0xd222('0x36'):_0xd222('0x37');_0x2a92ba['push'](db['UserProfileResource'][_0xd222('0x8e')]({'name':_0x41b7d9[_0x8cc334][_0xd222('0x3e')],'resourceId':_0x41b7d9[_0x8cc334]['id'],'type':_0x79f4ea,'sectionId':_['find'](_0x27423f,[_0xd222('0x3e'),_0x79f4ea])['id']},{}));}return Promise[_0xd222('0x61')](_0x2a92ba);});})['then'](respondWithResult(_0x1f4fe9,0xc9))[_0xd222('0x2d')](handleError(_0x1f4fe9,null));};exports[_0xd222('0x95')]=function(_0x1444d3,_0x3a9027){if(_0x1444d3['body']['id']){delete _0x1444d3['body']['id'];}return db[_0xd222('0x42')][_0xd222('0x3d')]({'where':{'id':_0x1444d3[_0xd222('0x64')]['id']}})[_0xd222('0x23')](function(_0x62e19){if(!_0x62e19)return null;if(_0x62e19['id']===_0x1444d3[_0xd222('0x35')]['id']){if(!_0x1444d3[_0xd222('0x63')]['oldPassword']||!_0x1444d3[_0xd222('0x63')]['newPassword']){throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x62e19[_0xd222('0x98')](_0x1444d3[_0xd222('0x63')]['oldPassword'])){throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0x99'));}if(_0x1444d3[_0xd222('0x63')][_0xd222('0x9a')]===_0x1444d3[_0xd222('0x63')][_0xd222('0x9b')]){throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0x9c'));}}else if(_0x1444d3[_0xd222('0x35')][_0xd222('0x32')]===_0xd222('0x33')){if(!_0x1444d3[_0xd222('0x63')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0xd222('0x9d'));}}else if(_0x1444d3[_0xd222('0x35')][_0xd222('0x32')]===_0xd222('0x35')){if(!_0x1444d3[_0xd222('0x63')][_0xd222('0x9b')]){throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0x9d'));}if(_0x62e19[_0xd222('0x32')]!==_0xd222('0x2e')){throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))]('Unauthorized');}}else{throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0x88'));}return _0x62e19;})[_0xd222('0x23')](handleEntityNotFound(_0x3a9027,null))[_0xd222('0x23')](function(_0x24b108){return db[_0xd222('0x6a')][_0xd222('0x9e')]({'attributes':['id',_0xd222('0x9f'),_0xd222('0xa0'),_0xd222('0xa1')]})['then'](function(_0xb916ce){if(_0xb916ce[_0xd222('0x9f')])authService[_0xd222('0xa2')](_0x1444d3['body'][_0xd222('0x9b')]);if(!_0xb916ce['enforcePasswordHistory']||!_0x24b108[_0xd222('0x47')])return _0x24b108;authService[_0xd222('0xa3')](_0x1444d3[_0xd222('0x63')]['newPassword'],_0x24b108[_0xd222('0x47')],_0xb916ce[_0xd222('0xa1')]);return _0x24b108;})[_0xd222('0x23')](saveUpdates({'password':_0x1444d3[_0xd222('0x63')][_0xd222('0x9b')],'passwordResetAt':_0x1444d3[_0xd222('0x35')]['id']==_0x1444d3[_0xd222('0x64')]['id']?moment():null,'previousPasswords':authService[_0xd222('0xa4')](_0x1444d3['body'][_0xd222('0x9b')],_0x24b108[_0xd222('0x47')])},null));})[_0xd222('0x23')](respondWithResult(_0x3a9027,null))[_0xd222('0x2d')](handleError(_0x3a9027,null));};exports[_0xd222('0xa5')]=function(_0x381a06,_0x77ac96){var _0x446650=_0x381a06[_0xd222('0x63')][_0xd222('0xa6')];return db['User']['find']({'where':{'id':_0x381a06[_0xd222('0x64')]['id']},'attributes':['id',_0xd222('0x3e'),_0xd222('0x32'),_0xd222('0xa7'),'loginInPause',_0xd222('0xa8'),_0xd222('0xa9')]})[_0xd222('0x23')](handleEntityNotFound(_0x77ac96,null))[_0xd222('0x23')](function(_0xeb0cb6){if(_0xeb0cb6){if(!utils[_0xd222('0xaa')](_0x446650)){throw new db['Sequelize'][(_0xd222('0x97'))](_0xd222('0xab'));}return _0xeb0cb6[_0xd222('0xac')+_['capitalize'](_0x446650[_0xd222('0xad')]())+_0xd222('0xae')](_0x381a06[_0xd222('0x63')][_0xd222('0x67')],{'penalty':_0x381a06['body'][_0xd222('0xaf')]||0x0})['spread'](function(_0x10a55a){for(var _0x2c9dbb=0x0;_0x2c9dbb<_0x381a06[_0xd222('0x63')][_0xd222('0x67')]['length'];_0x2c9dbb+=0x1){var _0x579f4d={'UserId':Number(_0x381a06[_0xd222('0x64')]['id'])};_0x579f4d[_[_0xd222('0xb0')](_0x446650[_0xd222('0xad')]())+_0xd222('0xb1')]=Number(_0x381a06[_0xd222('0x63')][_0xd222('0x67')][_0x2c9dbb]);socket['emit'](_0xd222('0x35')+_[_0xd222('0xb0')](_0x446650[_0xd222('0xad')]())+_0xd222('0xb2'),_0x579f4d);}return _0x10a55a;})[_0xd222('0x23')](function(){if(_0x446650===_0xd222('0xb3')){return db[_0xd222('0xb4')][_0xd222('0x55')]({'where':{'id':_0x381a06[_0xd222('0x63')]['ids']||[]},'raw':!![],'attributes':['id',_0xd222('0x3e')]});}})[_0xd222('0x23')](function(_0x3652e0){var _0x2ef8a8=_0xeb0cb6[_0xd222('0x31')]({'plain':!![]});var _0x5714fe=[];if(_0x446650===_0xd222('0xb3')&&_0x2ef8a8['role']==='agent'&&_0x2ef8a8[_0xd222('0xa7')]){for(let _0x253607=0x0;_0x253607<_0x3652e0[_0xd222('0x74')];_0x253607+=0x1){_0x5714fe[_0xd222('0x54')]({'membername':_0x2ef8a8[_0xd222('0x3e')],'UserId':_0x2ef8a8['id'],'queue_name':_0x3652e0[_0x253607]['name'],'VoiceQueueId':_0x3652e0[_0x253607]['id'],'interface':_[_0xd222('0x6e')](_0x2ef8a8[_0xd222('0xa9')])?util[_0xd222('0xb5')](_0xd222('0xb6'),_0x2ef8a8['name']):_0x2ef8a8[_0xd222('0xa9')],'paused':_0x2ef8a8[_0xd222('0xa8')]||![],'penalty':_0x381a06['body'][_0xd222('0xaf')]||0x0});}return Promise[_0xd222('0x61')](_0x5714fe[_0xd222('0x3a')](function(_0xc977ed){return db[_0xd222('0xb7')][_0xd222('0xb8')](_0xc977ed);}));}return _0xeb0cb6;});}})[_0xd222('0x23')](respondWithStatusCode(_0x77ac96,null))['catch'](handleError(_0x77ac96,null));};exports[_0xd222('0xb9')]=function(_0x473309,_0x159991){var _0x2f2133,_0x5abd8c;return db[_0xd222('0x42')][_0xd222('0x3d')]({'where':{'id':_0x473309[_0xd222('0x64')]['id']},'attributes':['id','name',_0xd222('0x32')]})[_0xd222('0x23')](handleEntityNotFound(_0x159991,null))[_0xd222('0x23')](function(_0x1f974c){if(_0x1f974c){_0x2f2133=_0x1f974c;if(!_0x473309[_0xd222('0x4d')]['channel']||!utils[_0xd222('0xaa')](_0x473309[_0xd222('0x4d')][_0xd222('0xa6')])){throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0xab'));}return _0x1f974c[_0xd222('0xba')+_['capitalize'](_0x473309[_0xd222('0x4d')][_0xd222('0xa6')][_0xd222('0xad')]())+_0xd222('0xae')](_0x473309['query']['ids']);}})['then'](function(_0x276d1a){if(_[_0xd222('0xbb')](_0x473309[_0xd222('0x4d')][_0xd222('0x67')])){for(var _0x209fa0=0x0;_0x209fa0<_0x473309['query']['ids']['length'];_0x209fa0+=0x1){_0x5abd8c={'UserId':Number(_0x473309[_0xd222('0x64')]['id'])};_0x5abd8c[_['capitalize'](_0x473309[_0xd222('0x4d')]['channel'][_0xd222('0xad')]())+'QueueId']=Number(_0x473309[_0xd222('0x4d')]['ids'][_0x209fa0]);socket[_0xd222('0x2f')](_0xd222('0x35')+_[_0xd222('0xb0')](_0x473309['query'][_0xd222('0xa6')][_0xd222('0xad')]())+_0xd222('0xbc'),_0x5abd8c);}}else{_0x5abd8c={'UserId':Number(_0x473309['params']['id'])};_0x5abd8c[_[_0xd222('0xb0')](_0x473309[_0xd222('0x4d')][_0xd222('0xa6')][_0xd222('0xad')]())+_0xd222('0xb1')]=Number(_0x473309['query']['ids']);socket[_0xd222('0x2f')]('user'+_[_0xd222('0xb0')](_0x473309[_0xd222('0x4d')][_0xd222('0xa6')]['toLowerCase']())+_0xd222('0xbc'),_0x5abd8c);}return _0x276d1a;})['then'](function(){if(_0x473309['query'][_0xd222('0xa6')]==='voice'){return db['UserVoiceQueueRt'][_0xd222('0xbd')]({'where':{'UserId':_0x473309[_0xd222('0x64')]['id'],'VoiceQueueId':_0x473309[_0xd222('0x4d')]['ids']},'individualHooks':!![]})[_0xd222('0x23')](function(){return _0x2f2133;});}return _0x2f2133;})[_0xd222('0x23')](respondWithStatusCode(_0x159991,null))['catch'](handleError(_0x159991,null));};exports[_0xd222('0xbe')]=function(_0x133d7e,_0x2aff38){_0x133d7e[_0xd222('0x63')]['userpic']=_0x133d7e[_0xd222('0xbf')][_0xd222('0xc0')];return db[_0xd222('0x42')]['find']({'where':{'id':_0x133d7e[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x2aff38,null))[_0xd222('0x23')](saveUpdates(_0x133d7e[_0xd222('0x63')],null))[_0xd222('0x23')](respondWithResult(_0x2aff38,null))['catch'](handleError(_0x2aff38,null));};exports['getAvatar']=function(_0x4fc9f6,_0x306309){var _0x571791=path[_0xd222('0xc1')](config[_0xd222('0xc2')],_0xd222('0xc3'));return db[_0xd222('0x42')][_0xd222('0x3d')]({'where':{'id':_0x4fc9f6[_0xd222('0x64')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xd222('0x23')](handleEntityNotFound(_0x306309,null))[_0xd222('0x23')](function(_0x15701f){if(_0x15701f){if(_[_0xd222('0x6e')](_0x15701f['userpic'])){return _0x306309[_0xd222('0xc4')](_0x571791);}else{if(!fs[_0xd222('0xc5')](path[_0xd222('0xc1')](config[_0xd222('0xc2')],_0xd222('0xc6'),_0x15701f[_0xd222('0xc7')]))){return _0x306309[_0xd222('0xc4')](_0x571791);}return _0x306309['download'](path[_0xd222('0xc1')](config[_0xd222('0xc2')],_0xd222('0xc6'),_0x15701f[_0xd222('0xc7')]));}}})['catch'](handleError(_0x306309,null));};exports[_0xd222('0xc8')]=function(_0x5092ed,_0x45236e){return db[_0xd222('0x42')][_0xd222('0x3d')]({'where':{'id':_0x5092ed['params']['id']},'attributes':['id']})[_0xd222('0x23')](handleEntityNotFound(_0x45236e,null))[_0xd222('0x23')](function(_0x567a45){var _0x3e243d=[];values=_0x567a45[_0xd222('0x59')];_0x3e243d['push'](get_open_tabs(_0xd222('0x58'),_0x567a45[_0xd222('0x59')]));_0x3e243d['push'](get_open_tabs(_0xd222('0x5a'),_0x567a45['dataValues']));_0x3e243d[_0xd222('0x54')](get_open_tabs(_0xd222('0xc9'),_0x567a45['dataValues']));_0x3e243d[_0xd222('0x54')](get_open_tabs('whatsapp',_0x567a45[_0xd222('0x59')]));_0x3e243d[_0xd222('0x54')](get_open_tabs('fax',_0x567a45['dataValues']));_0x3e243d[_0xd222('0x54')](get_open_tabs(_0xd222('0x60'),_0x567a45[_0xd222('0x59')]));return Promise[_0xd222('0x61')](_0x3e243d);})[_0xd222('0x23')](function(_0x37b3bb){if(_0x37b3bb){var _0xec0bc3=_[_0xd222('0x3a')](values[_0xd222('0xca')],function(_0x27a438){return{'channel':_0xd222('0xcb'),'id':_0x27a438['id'],'createdAt':_0x27a438[_0xd222('0xcc')]};});var _0x4f9359=_[_0xd222('0x3a')](values['FaxOpenTabs'],function(_0x4425c8){return{'channel':_0xd222('0xcd'),'id':_0x4425c8['id'],'createdAt':_0x4425c8[_0xd222('0xcc')]};});var _0x20d19f=_['map'](values[_0xd222('0xce')],function(_0xbe6185){return{'channel':_0xd222('0xcf'),'id':_0xbe6185['id'],'createdAt':_0xbe6185[_0xd222('0xcc')]};});var _0x3139fe=_['map'](values['MailOpenTabs'],function(_0x1753c1){return{'channel':'MAIL','id':_0x1753c1['id'],'createdAt':_0x1753c1[_0xd222('0xcc')]};});var _0x425e0b=_['map'](values[_0xd222('0xd0')],function(_0x52556c){return{'channel':_0xd222('0xd1'),'id':_0x52556c['id'],'createdAt':_0x52556c[_0xd222('0xcc')]};});var _0x1f7e29=_[_0xd222('0x3a')](values[_0xd222('0xd2')],function(_0x205958){return{'channel':'WHATSAPP','id':_0x205958['id'],'createdAt':_0x205958['createdAt']};});var _0x2a16e5=_['concat'](_0xec0bc3,_0x4f9359,_0x20d19f,_0x3139fe,_0x425e0b,_0x1f7e29);var _0x132071={'count':_0x2a16e5['length'],'rows':_0x2a16e5};return _0x132071;}else return null;})[_0xd222('0x23')](respondWithResult(_0x45236e,null))[_0xd222('0x2d')](handleError(_0x45236e,null));};exports['getContacts']=function(_0x2acbb2,_0x40a06d){var _0xf4ce3e={};return db[_0xd222('0x42')][_0xd222('0x9e')]({'where':{'id':_0x2acbb2['params']['id']}})[_0xd222('0x23')](function(_0x4bf8d9){if(!_0x4bf8d9){throw new APINotFoundError(util[_0xd222('0xb5')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2acbb2[_0xd222('0x64')]['id']));}return contacts[_0xd222('0x65')]();})['then'](function(_0x144a27){_0x2acbb2[_0xd222('0x4d')][_0xd222('0x42')]=_0x2acbb2['params']['id'];_0xf4ce3e=qs[_0xd222('0x5e')](_0x144a27,_0x2acbb2);if(_0x2acbb2['query'][_0xd222('0xd3')]('includeAll')){_0xf4ce3e['include']=[{'model':db['CmList'],'as':_0xd222('0xd4'),'required':![]},{'model':db[_0xd222('0xd5')],'as':_0xd222('0xd6'),'attributes':['id','name',_0xd222('0xd7')],'where':_0x2acbb2['query'][_0xd222('0xd8')]?{'id':_0x2acbb2[_0xd222('0x4d')][_0xd222('0xd8')]}:undefined,'required':_0x2acbb2['query'][_0xd222('0xd8')]?!![]:![]}];}return contacts['findAll'](_0x2acbb2[_0xd222('0x4d')],_0x2acbb2[_0xd222('0x35')],_0xf4ce3e,_0x144a27);})['then'](respondWithFilteredResult(_0x40a06d,_0xf4ce3e))['catch'](APIHandleError(_0x40a06d));};exports[_0xd222('0xd9')]=function(_0x1d2ec4,_0x321d4d){var _0x24a3e8;var _0x15f1cf={};var _0x5b4c9c;return db['User']['findOne']({'where':{'id':_0x1d2ec4[_0xd222('0x64')]['id']},'attributes':['id',_0xd222('0x3e'),_0xd222('0x32')]})[_0xd222('0x23')](handleEntityNotFound(_0x321d4d,null))[_0xd222('0x23')](function(_0x1f63dd){if(!utils[_0xd222('0xaa')](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0xa6')])){throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0xab'));}_0x24a3e8=_0x1f63dd;var _0x18a041={};_0x18a041[_0xd222('0xda')]=_['keys'](db[_[_0xd222('0xb0')](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0xa6')])+_0xd222('0xdb')][_0xd222('0x43')]);_0x18a041[_0xd222('0x4d')]=_[_0xd222('0xdc')](_0x1d2ec4[_0xd222('0x4d')]);_0x18a041['filters']=_[_0xd222('0xdd')](_0x18a041[_0xd222('0xda')],_0x18a041['query']);_0x15f1cf[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x18a041['model'],qs[_0xd222('0xde')](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0xde')]));_0x15f1cf[_0xd222('0x53')]=_0x15f1cf[_0xd222('0x53')][_0xd222('0x74')]?_0x15f1cf[_0xd222('0x53')]:_0x18a041[_0xd222('0xda')];_0x15f1cf[_0xd222('0xdf')]=qs[_0xd222('0xe0')](_0x1d2ec4['query'][_0xd222('0xe0')]);_0x15f1cf[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x1d2ec4['query'],_0x18a041['filters']));if(_0x1d2ec4[_0xd222('0x4d')][_0xd222('0x38')]){_0x15f1cf[_0xd222('0x4c')]=_['merge'](_0x15f1cf[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x15f1cf[_0xd222('0x53')],function(_0x332f92){var _0xbfa3cf={};_0xbfa3cf[_0x332f92]={'$like':'%'+_0x1d2ec4[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0xbfa3cf;})});}_0x15f1cf=_[_0xd222('0x5f')]({},_0x15f1cf,_0x1d2ec4[_0xd222('0xe3')]);switch(_0x24a3e8[_0xd222('0x32')]){case _0xd222('0x33'):return db[_[_0xd222('0xb0')](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0xa6')])+_0xd222('0xdb')][_0xd222('0x55')](_0x15f1cf);case _0xd222('0x35'):case _0xd222('0x2e'):return _0x24a3e8[_0xd222('0x31')+_[_0xd222('0xb0')](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0xa6')])+_0xd222('0xae')](_0x15f1cf);default:throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0xe4'));}})[_0xd222('0x23')](function(_0x58f840){_0x5b4c9c=_0x58f840[_0xd222('0x74')];if(!_0x1d2ec4[_0xd222('0x4d')]['hasOwnProperty'](_0xd222('0xe5'))){_0x15f1cf[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0x1f')]);_0x15f1cf[_0xd222('0x1d')]=qs['offset'](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0x1d')]);}switch(_0x24a3e8[_0xd222('0x32')]){case _0xd222('0x33'):return db[_[_0xd222('0xb0')](_0x1d2ec4[_0xd222('0x4d')][_0xd222('0xa6')])+_0xd222('0xdb')][_0xd222('0x55')](_0x15f1cf);case _0xd222('0x35'):case'agent':return _0x24a3e8['get'+_[_0xd222('0xb0')](_0x1d2ec4[_0xd222('0x4d')]['channel'])+_0xd222('0xae')](_0x15f1cf);}})[_0xd222('0x23')](function(_0x2b9861){return{'count':_0x5b4c9c,'rows':_0x2b9861};})['then'](respondWithResult(_0x321d4d,null))['catch'](handleError(_0x321d4d,null));};exports[_0xd222('0xe6')]=function(_0x42db31,_0x26bb6a){var _0x472b19={};var _0x4ccf94={};var _0x3b079d;var _0x7e34ac;return db['User'][_0xd222('0x9e')]({'where':{'id':_0x42db31[_0xd222('0x64')]['id']}})['then'](handleEntityNotFound(_0x26bb6a,null))[_0xd222('0x23')](function(_0x15edbb){if(_0x15edbb){_0x3b079d=_0x15edbb;_0x4ccf94[_0xd222('0xda')]=_['keys'](db[_0xd222('0xb7')][_0xd222('0x43')]);_0x4ccf94[_0xd222('0x4d')]=_[_0xd222('0xdc')](_0x42db31[_0xd222('0x4d')]);_0x4ccf94['filters']=_[_0xd222('0xdd')](_0x4ccf94[_0xd222('0xda')],_0x4ccf94['query']);_0x472b19[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x4ccf94['model'],qs[_0xd222('0xde')](_0x42db31['query'][_0xd222('0xde')]));_0x472b19[_0xd222('0x53')]=_0x472b19[_0xd222('0x53')]['length']?_0x472b19['attributes']:_0x4ccf94[_0xd222('0xda')];_0x472b19[_0xd222('0xdf')]=qs[_0xd222('0xe0')](_0x42db31[_0xd222('0x4d')][_0xd222('0xe0')]);_0x472b19[_0xd222('0x4c')]=qs['filters'](_[_0xd222('0xe2')](_0x42db31[_0xd222('0x4d')],_0x4ccf94['filters']));if(_0x42db31['query'][_0xd222('0x38')]){_0x472b19[_0xd222('0x4c')]=_[_0xd222('0x5f')](_0x472b19['where'],{'$or':_[_0xd222('0x3a')](_0x472b19[_0xd222('0x53')],function(_0xd24f9){var _0x535f3b={};_0x535f3b[_0xd24f9]={'$like':'%'+_0x42db31[_0xd222('0x4d')]['filter']+'%'};return _0x535f3b;})});}_0x472b19=_[_0xd222('0x5f')]({},_0x472b19,_0x42db31[_0xd222('0xe3')]);return _0x3b079d[_0xd222('0xe6')](_0x472b19);}})[_0xd222('0x23')](function(_0x43e8ca){if(_0x43e8ca){_0x7e34ac=_0x43e8ca[_0xd222('0x74')];if(!_0x42db31[_0xd222('0x4d')][_0xd222('0xd3')]('nolimit')){_0x472b19[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x42db31[_0xd222('0x4d')][_0xd222('0x1f')]);_0x472b19['offset']=qs[_0xd222('0x1d')](_0x42db31[_0xd222('0x4d')]['offset']);}return _0x3b079d['getVoiceQueuesRt'](_0x472b19);}})[_0xd222('0x23')](function(_0x2a0ec0){if(_0x2a0ec0){return _0x2a0ec0?{'count':_0x7e34ac,'rows':_0x2a0ec0}:null;}})[_0xd222('0x23')](respondWithResult(_0x26bb6a,null))[_0xd222('0x2d')](handleError(_0x26bb6a,null));};exports[_0xd222('0xe7')]=function(_0x4ca51a,_0x6da17c){var _0x271a48={};var _0x29ce73={};var _0x5a2a62;var _0x409aaf;return db[_0xd222('0x42')]['findOne']({'where':{'id':_0x4ca51a[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x6da17c,null))[_0xd222('0x23')](function(_0x4da779){if(_0x4da779){_0x5a2a62=_0x4da779;_0x29ce73[_0xd222('0xda')]=_[_0xd222('0xdc')](db[_0xd222('0xe8')][_0xd222('0x43')]);_0x29ce73[_0xd222('0x4d')]=_[_0xd222('0xdc')](_0x4ca51a['query']);_0x29ce73[_0xd222('0xe1')]=_[_0xd222('0xdd')](_0x29ce73['model'],_0x29ce73[_0xd222('0x4d')]);_0x271a48[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x29ce73['model'],qs[_0xd222('0xde')](_0x4ca51a[_0xd222('0x4d')]['fields']));_0x271a48[_0xd222('0x53')]=_0x271a48['attributes'][_0xd222('0x74')]?_0x271a48[_0xd222('0x53')]:_0x29ce73['model'];_0x271a48[_0xd222('0xdf')]=qs[_0xd222('0xe0')](_0x4ca51a[_0xd222('0x4d')][_0xd222('0xe0')]);_0x271a48[_0xd222('0x4c')]=qs['filters'](_[_0xd222('0xe2')](_0x4ca51a[_0xd222('0x4d')],_0x29ce73['filters']));if(_0x4ca51a[_0xd222('0x4d')][_0xd222('0x38')]){_0x271a48['where']=_[_0xd222('0x5f')](_0x271a48[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x271a48[_0xd222('0x53')],function(_0x24283a){var _0x4f1e73={};_0x4f1e73[_0x24283a]={'$like':'%'+_0x4ca51a[_0xd222('0x4d')]['filter']+'%'};return _0x4f1e73;})});}_0x271a48=_[_0xd222('0x5f')]({},_0x271a48,_0x4ca51a[_0xd222('0xe3')]);return _0x5a2a62[_0xd222('0xe7')](_0x271a48);}})[_0xd222('0x23')](function(_0x2feeaf){if(_0x2feeaf){_0x409aaf=_0x2feeaf['length'];if(!_0x4ca51a[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x271a48[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x4ca51a[_0xd222('0x4d')][_0xd222('0x1f')]);_0x271a48[_0xd222('0x1d')]=qs[_0xd222('0x1d')](_0x4ca51a[_0xd222('0x4d')][_0xd222('0x1d')]);}return _0x5a2a62['getGroups'](_0x271a48);}})[_0xd222('0x23')](function(_0x2a257e){if(_0x2a257e){return _0x2a257e?{'count':_0x409aaf,'rows':_0x2a257e}:null;}})[_0xd222('0x23')](respondWithResult(_0x6da17c,null))[_0xd222('0x2d')](handleError(_0x6da17c,null));};exports['getRecordings']=function(_0x36cf27,_0x5633d6){var _0x1ab80a={'raw':!![],'where':{}};var _0x4e05f0={};var _0x5906e2={'count':0x0,'rows':[]};return db['User'][_0xd222('0x9e')]({'where':{'id':_0x36cf27[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x5633d6,null))[_0xd222('0x23')](function(_0x67adff){if(_0x67adff){_0x4e05f0[_0xd222('0xda')]=_[_0xd222('0xdc')](db[_0xd222('0xe9')][_0xd222('0x43')]);_0x4e05f0['query']=_[_0xd222('0xdc')](_0x36cf27[_0xd222('0x4d')]);_0x4e05f0[_0xd222('0xe1')]=_[_0xd222('0xdd')](_0x4e05f0[_0xd222('0xda')],_0x4e05f0[_0xd222('0x4d')]);_0x1ab80a[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x4e05f0[_0xd222('0xda')],qs[_0xd222('0xde')](_0x36cf27[_0xd222('0x4d')]['fields']));_0x1ab80a[_0xd222('0x53')]=_0x1ab80a[_0xd222('0x53')]['length']?_0x1ab80a[_0xd222('0x53')]:_0x4e05f0[_0xd222('0xda')];if(!_0x36cf27[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x1ab80a[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x36cf27[_0xd222('0x4d')][_0xd222('0x1f')]);_0x1ab80a['offset']=qs[_0xd222('0x1d')](_0x36cf27[_0xd222('0x4d')][_0xd222('0x1d')]);}_0x1ab80a['order']=qs[_0xd222('0xe0')](_0x36cf27[_0xd222('0x4d')][_0xd222('0xe0')]);_0x1ab80a[_0xd222('0x4c')]=qs['filters'](_[_0xd222('0xe2')](_0x36cf27['query'],_0x4e05f0[_0xd222('0xe1')]));_0x1ab80a['where']['UserId']=_0x67adff['id'];if(_0x36cf27[_0xd222('0x4d')][_0xd222('0x38')]){_0x1ab80a[_0xd222('0x4c')]=_['merge'](_0x1ab80a[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x1ab80a[_0xd222('0x53')],function(_0x5eb56e){var _0x49962f={};_0x49962f[_0x5eb56e]={'$like':'%'+_0x36cf27[_0xd222('0x4d')]['filter']+'%'};return _0x49962f;})});}_0x1ab80a=_[_0xd222('0x5f')]({},_0x1ab80a,_0x36cf27['options']);return db[_0xd222('0xe9')][_0xd222('0x20')]({'where':_0x1ab80a['where']})[_0xd222('0x23')](function(_0x328a95){_0x5906e2['count']=_0x328a95;if(_0x36cf27[_0xd222('0x4d')][_0xd222('0x4e')]){_0x1ab80a[_0xd222('0x4f')]=[{'all':!![]}];}return db[_0xd222('0xe9')][_0xd222('0x55')](_0x1ab80a);})[_0xd222('0x23')](function(_0x3301b9){_0x5906e2[_0xd222('0x56')]=_0x3301b9;return _0x5906e2;});}})[_0xd222('0x23')](respondWithFilteredResult(_0x5633d6,_0x1ab80a))['catch'](handleError(_0x5633d6,null));};exports[_0xd222('0xea')]=function(_0x1f6cbd,_0x256f1c){var _0x58a810={'raw':!![],'where':{}};var _0x44ebc9={};var _0x34a0be={'count':0x0,'rows':[]};return db[_0xd222('0x42')]['findOne']({'where':{'id':_0x1f6cbd['params']['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x256f1c,null))[_0xd222('0x23')](function(_0x5d97eb){if(_0x5d97eb){_0x44ebc9['model']=_[_0xd222('0xdc')](db[_0xd222('0xeb')][_0xd222('0x43')]);_0x44ebc9[_0xd222('0x4d')]=_[_0xd222('0xdc')](_0x1f6cbd[_0xd222('0x4d')]);_0x44ebc9[_0xd222('0xe1')]=_['intersection'](_0x44ebc9[_0xd222('0xda')],_0x44ebc9[_0xd222('0x4d')]);_0x58a810[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x44ebc9['model'],qs[_0xd222('0xde')](_0x1f6cbd[_0xd222('0x4d')][_0xd222('0xde')]));_0x58a810['attributes']=_0x58a810['attributes'][_0xd222('0x74')]?_0x58a810['attributes']:_0x44ebc9['model'];if(!_0x1f6cbd['query'][_0xd222('0xd3')](_0xd222('0xe5'))){_0x58a810[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x1f6cbd[_0xd222('0x4d')]['limit']);_0x58a810[_0xd222('0x1d')]=qs['offset'](_0x1f6cbd[_0xd222('0x4d')]['offset']);}_0x58a810[_0xd222('0xdf')]=qs[_0xd222('0xe0')](_0x1f6cbd[_0xd222('0x4d')][_0xd222('0xe0')]);_0x58a810['where']=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x1f6cbd['query'],_0x44ebc9[_0xd222('0xe1')]));_0x58a810[_0xd222('0x4c')][_0xd222('0xec')]=_0x5d97eb['id'];if(_0x1f6cbd[_0xd222('0x4d')][_0xd222('0x38')]){_0x58a810[_0xd222('0x4c')]=_['merge'](_0x58a810[_0xd222('0x4c')],{'$or':_['map'](_0x58a810[_0xd222('0x53')],function(_0x3c737a){var _0xf2e9d7={};_0xf2e9d7[_0x3c737a]={'$like':'%'+_0x1f6cbd[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0xf2e9d7;})});}_0x58a810=_[_0xd222('0x5f')]({},_0x58a810,_0x1f6cbd['options']);return db[_0xd222('0xeb')][_0xd222('0x20')]({'where':_0x58a810[_0xd222('0x4c')]})[_0xd222('0x23')](function(_0x2ccaa6){_0x34a0be['count']=_0x2ccaa6;if(_0x1f6cbd[_0xd222('0x4d')][_0xd222('0x4e')]){_0x58a810['include']=[{'all':!![]}];}return db[_0xd222('0xeb')][_0xd222('0x55')](_0x58a810);})['then'](function(_0x23541c){_0x34a0be[_0xd222('0x56')]=_0x23541c;return _0x34a0be;});}})[_0xd222('0x23')](respondWithFilteredResult(_0x256f1c,_0x58a810))[_0xd222('0x2d')](handleError(_0x256f1c,null));};exports[_0xd222('0xed')]=function(_0x243b50,_0x217c20){var _0x5718c2={};var _0x10ef0d={};var _0x40c990;var _0xe58648;return db[_0xd222('0x42')][_0xd222('0x9e')]({'where':{'id':_0x243b50[_0xd222('0x64')]['id']}})['then'](handleEntityNotFound(_0x217c20,null))[_0xd222('0x23')](function(_0x3ace9d){if(_0x3ace9d){_0x40c990=_0x3ace9d;_0x10ef0d[_0xd222('0xda')]=_[_0xd222('0xdc')](db['ChatInteraction'][_0xd222('0x43')]);_0x10ef0d[_0xd222('0x4d')]=_[_0xd222('0xdc')](_0x243b50[_0xd222('0x4d')]);_0x10ef0d[_0xd222('0xe1')]=_[_0xd222('0xdd')](_0x10ef0d[_0xd222('0xda')],_0x10ef0d['query']);_0x5718c2[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x10ef0d[_0xd222('0xda')],qs[_0xd222('0xde')](_0x243b50[_0xd222('0x4d')][_0xd222('0xde')]));_0x5718c2[_0xd222('0x53')]=_0x5718c2[_0xd222('0x53')][_0xd222('0x74')]?_0x5718c2[_0xd222('0x53')]:_0x10ef0d['model'];_0x5718c2['order']=qs[_0xd222('0xe0')](_0x243b50[_0xd222('0x4d')][_0xd222('0xe0')]);_0x5718c2[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x243b50[_0xd222('0x4d')],_0x10ef0d[_0xd222('0xe1')]));if(_0x243b50[_0xd222('0x4d')][_0xd222('0x38')]){_0x5718c2[_0xd222('0x4c')]=_['merge'](_0x5718c2[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x5718c2['attributes'],function(_0x21fa40){var _0x3f7b6c={};_0x3f7b6c[_0x21fa40]={'$like':'%'+_0x243b50[_0xd222('0x4d')]['filter']+'%'};return _0x3f7b6c;})});}_0x5718c2=_[_0xd222('0x5f')]({},_0x5718c2,_0x243b50['options']);return _0x40c990['getChatInteractions'](_0x5718c2);}})['then'](function(_0x175c91){if(_0x175c91){_0xe58648=_0x175c91[_0xd222('0x74')];if(!_0x243b50[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x5718c2[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x243b50['query'][_0xd222('0x1f')]);_0x5718c2['offset']=qs[_0xd222('0x1d')](_0x243b50[_0xd222('0x4d')][_0xd222('0x1d')]);}return _0x40c990[_0xd222('0xed')](_0x5718c2);}})[_0xd222('0x23')](function(_0x1ac675){if(_0x1ac675){return _0x1ac675?{'count':_0xe58648,'rows':_0x1ac675}:null;}})[_0xd222('0x23')](respondWithResult(_0x217c20,null))[_0xd222('0x2d')](handleError(_0x217c20,null));};exports[_0xd222('0xee')]=function(_0x3e6f10,_0x410bf3){var _0x3483e0={};var _0x5d8e85={};var _0x224de6;var _0x1989d8;return db[_0xd222('0x42')][_0xd222('0x9e')]({'where':{'id':_0x3e6f10[_0xd222('0x64')]['id']}})['then'](handleEntityNotFound(_0x410bf3,null))[_0xd222('0x23')](function(_0x1e1214){if(_0x1e1214){_0x224de6=_0x1e1214;_0x5d8e85[_0xd222('0xda')]=_['keys'](db['OpenchannelInteraction'][_0xd222('0x43')]);_0x5d8e85['query']=_[_0xd222('0xdc')](_0x3e6f10[_0xd222('0x4d')]);_0x5d8e85[_0xd222('0xe1')]=_[_0xd222('0xdd')](_0x5d8e85['model'],_0x5d8e85[_0xd222('0x4d')]);_0x3483e0[_0xd222('0x53')]=_['intersection'](_0x5d8e85['model'],qs['fields'](_0x3e6f10[_0xd222('0x4d')][_0xd222('0xde')]));_0x3483e0[_0xd222('0x53')]=_0x3483e0[_0xd222('0x53')][_0xd222('0x74')]?_0x3483e0[_0xd222('0x53')]:_0x5d8e85[_0xd222('0xda')];_0x3483e0['order']=qs[_0xd222('0xe0')](_0x3e6f10[_0xd222('0x4d')][_0xd222('0xe0')]);_0x3483e0[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x3e6f10[_0xd222('0x4d')],_0x5d8e85[_0xd222('0xe1')]));if(_0x3e6f10[_0xd222('0x4d')][_0xd222('0x38')]){_0x3483e0[_0xd222('0x4c')]=_[_0xd222('0x5f')](_0x3483e0[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x3483e0['attributes'],function(_0xafaada){var _0x15ec9e={};_0x15ec9e[_0xafaada]={'$like':'%'+_0x3e6f10[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0x15ec9e;})});}_0x3483e0=_[_0xd222('0x5f')]({},_0x3483e0,_0x3e6f10[_0xd222('0xe3')]);return _0x224de6[_0xd222('0xee')](_0x3483e0);}})[_0xd222('0x23')](function(_0x5542a2){if(_0x5542a2){_0x1989d8=_0x5542a2[_0xd222('0x74')];if(!_0x3e6f10[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x3483e0[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x3e6f10[_0xd222('0x4d')]['limit']);_0x3483e0['offset']=qs[_0xd222('0x1d')](_0x3e6f10[_0xd222('0x4d')][_0xd222('0x1d')]);}return _0x224de6[_0xd222('0xee')](_0x3483e0);}})[_0xd222('0x23')](function(_0x130c4d){if(_0x130c4d){return _0x130c4d?{'count':_0x1989d8,'rows':_0x130c4d}:null;}})[_0xd222('0x23')](respondWithResult(_0x410bf3,null))['catch'](handleError(_0x410bf3,null));};exports['getMailInteractions']=function(_0x295733,_0x2df921){var _0x2badd4={'raw':!![],'where':{}};var _0x28b285={};var _0x2cb897={'count':0x0,'rows':[]};return db[_0xd222('0x42')][_0xd222('0x9e')]({'where':{'id':_0x295733['params']['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x2df921,null))[_0xd222('0x23')](function(_0x2dca5d){if(_0x2dca5d){_0x28b285[_0xd222('0xda')]=_[_0xd222('0xdc')](db['MailInteraction'][_0xd222('0x43')]);_0x28b285[_0xd222('0x4d')]=_['keys'](_0x295733['query']);_0x28b285[_0xd222('0xe1')]=_[_0xd222('0xdd')](_0x28b285[_0xd222('0xda')],_0x28b285[_0xd222('0x4d')]);_0x2badd4[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x28b285['model'],qs[_0xd222('0xde')](_0x295733[_0xd222('0x4d')][_0xd222('0xde')]));_0x2badd4[_0xd222('0x53')]=_0x2badd4['attributes'][_0xd222('0x74')]?_0x2badd4['attributes']:_0x28b285[_0xd222('0xda')];if(!_0x295733[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x2badd4[_0xd222('0x1f')]=qs['limit'](_0x295733[_0xd222('0x4d')]['limit']);_0x2badd4[_0xd222('0x1d')]=qs[_0xd222('0x1d')](_0x295733['query'][_0xd222('0x1d')]);}_0x2badd4['order']=qs[_0xd222('0xe0')](_0x295733['query']['sort']);_0x2badd4[_0xd222('0x4c')]=qs['filters'](_[_0xd222('0xe2')](_0x295733[_0xd222('0x4d')],_0x28b285[_0xd222('0xe1')]));_0x2badd4[_0xd222('0x4c')][_0xd222('0xec')]=_0x2dca5d['id'];if(_0x295733[_0xd222('0x4d')][_0xd222('0x38')]){_0x2badd4[_0xd222('0x4c')]=_[_0xd222('0x5f')](_0x2badd4['where'],{'$or':_['map'](_0x2badd4[_0xd222('0x53')],function(_0x3aadaf){var _0x1e6d95={};_0x1e6d95[_0x3aadaf]={'$like':'%'+_0x295733['query'][_0xd222('0x38')]+'%'};return _0x1e6d95;})});}_0x2badd4=_[_0xd222('0x5f')]({},_0x2badd4,_0x295733[_0xd222('0xe3')]);return db['MailInteraction']['count']({'where':_0x2badd4['where']})[_0xd222('0x23')](function(_0x3ce6d6){_0x2cb897[_0xd222('0x20')]=_0x3ce6d6;if(_0x295733[_0xd222('0x4d')][_0xd222('0x4e')]){_0x2badd4['include']=[{'all':!![]}];}return db['MailInteraction'][_0xd222('0x55')](_0x2badd4);})[_0xd222('0x23')](function(_0xe09ec0){_0x2cb897[_0xd222('0x56')]=_0xe09ec0;return _0x2cb897;});}})[_0xd222('0x23')](respondWithFilteredResult(_0x2df921,_0x2badd4))[_0xd222('0x2d')](handleError(_0x2df921,null));};exports[_0xd222('0xef')]=function(_0x539382,_0x1273c4){var _0x422c09={};var _0x3bb9b7={};var _0x1e4a9b;var _0x112336;return db['User']['findOne']({'where':{'id':_0x539382[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x1273c4,null))[_0xd222('0x23')](function(_0x14e51c){if(_0x14e51c){_0x1e4a9b=_0x14e51c;_0x3bb9b7[_0xd222('0xda')]=_[_0xd222('0xdc')](db[_0xd222('0xf0')][_0xd222('0x43')]);_0x3bb9b7['query']=_['keys'](_0x539382[_0xd222('0x4d')]);_0x3bb9b7[_0xd222('0xe1')]=_[_0xd222('0xdd')](_0x3bb9b7['model'],_0x3bb9b7[_0xd222('0x4d')]);_0x422c09['attributes']=_['intersection'](_0x3bb9b7[_0xd222('0xda')],qs[_0xd222('0xde')](_0x539382[_0xd222('0x4d')]['fields']));_0x422c09[_0xd222('0x53')]=_0x422c09[_0xd222('0x53')][_0xd222('0x74')]?_0x422c09[_0xd222('0x53')]:_0x3bb9b7[_0xd222('0xda')];_0x422c09[_0xd222('0xdf')]=qs['sort'](_0x539382[_0xd222('0x4d')][_0xd222('0xe0')]);_0x422c09[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x539382['query'],_0x3bb9b7[_0xd222('0xe1')]));if(_0x539382[_0xd222('0x4d')]['filter']){_0x422c09[_0xd222('0x4c')]=_['merge'](_0x422c09[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x422c09[_0xd222('0x53')],function(_0x272019){var _0x14b054={};_0x14b054[_0x272019]={'$like':'%'+_0x539382[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0x14b054;})});}_0x422c09=_['merge']({},_0x422c09,_0x539382['options']);return _0x1e4a9b['getSmsInteractions'](_0x422c09);}})[_0xd222('0x23')](function(_0x35a272){if(_0x35a272){_0x112336=_0x35a272[_0xd222('0x74')];if(!_0x539382[_0xd222('0x4d')]['hasOwnProperty'](_0xd222('0xe5'))){_0x422c09[_0xd222('0x1f')]=qs['limit'](_0x539382['query'][_0xd222('0x1f')]);_0x422c09[_0xd222('0x1d')]=qs[_0xd222('0x1d')](_0x539382[_0xd222('0x4d')][_0xd222('0x1d')]);}return _0x1e4a9b[_0xd222('0xef')](_0x422c09);}})[_0xd222('0x23')](function(_0x5e8672){if(_0x5e8672){return _0x5e8672?{'count':_0x112336,'rows':_0x5e8672}:null;}})[_0xd222('0x23')](respondWithResult(_0x1273c4,null))[_0xd222('0x2d')](handleError(_0x1273c4,null));};exports[_0xd222('0xf1')]=function(_0x474de6,_0x9e6761){var _0x1a92a8={};var _0x2a4260={};var _0x3d4898;var _0x311bfc;return db['User'][_0xd222('0x9e')]({'where':{'id':_0x474de6[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x9e6761,null))[_0xd222('0x23')](function(_0x1fc44c){if(_0x1fc44c){_0x3d4898=_0x1fc44c;_0x2a4260[_0xd222('0xda')]=_[_0xd222('0xdc')](db[_0xd222('0xf2')][_0xd222('0x43')]);_0x2a4260[_0xd222('0x4d')]=_[_0xd222('0xdc')](_0x474de6[_0xd222('0x4d')]);_0x2a4260['filters']=_['intersection'](_0x2a4260[_0xd222('0xda')],_0x2a4260['query']);_0x1a92a8[_0xd222('0x53')]=_[_0xd222('0xdd')](_0x2a4260[_0xd222('0xda')],qs[_0xd222('0xde')](_0x474de6[_0xd222('0x4d')][_0xd222('0xde')]));_0x1a92a8[_0xd222('0x53')]=_0x1a92a8['attributes'][_0xd222('0x74')]?_0x1a92a8['attributes']:_0x2a4260['model'];_0x1a92a8[_0xd222('0xdf')]=qs[_0xd222('0xe0')](_0x474de6[_0xd222('0x4d')][_0xd222('0xe0')]);_0x1a92a8['where']=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x474de6[_0xd222('0x4d')],_0x2a4260[_0xd222('0xe1')]));if(_0x474de6[_0xd222('0x4d')][_0xd222('0x38')]){_0x1a92a8[_0xd222('0x4c')]=_[_0xd222('0x5f')](_0x1a92a8[_0xd222('0x4c')],{'$or':_['map'](_0x1a92a8[_0xd222('0x53')],function(_0x4e0e38){var _0xe0d3d1={};_0xe0d3d1[_0x4e0e38]={'$like':'%'+_0x474de6[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0xe0d3d1;})});}_0x1a92a8=_['merge']({},_0x1a92a8,_0x474de6['options']);return _0x3d4898[_0xd222('0xf1')](_0x1a92a8);}})[_0xd222('0x23')](function(_0x15ae30){if(_0x15ae30){_0x311bfc=_0x15ae30[_0xd222('0x74')];if(!_0x474de6[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x1a92a8['limit']=qs[_0xd222('0x1f')](_0x474de6[_0xd222('0x4d')][_0xd222('0x1f')]);_0x1a92a8['offset']=qs[_0xd222('0x1d')](_0x474de6[_0xd222('0x4d')][_0xd222('0x1d')]);}return _0x3d4898[_0xd222('0xf1')](_0x1a92a8);}})[_0xd222('0x23')](function(_0x1001a1){if(_0x1001a1){return _0x1001a1?{'count':_0x311bfc,'rows':_0x1001a1}:null;}})['then'](respondWithResult(_0x9e6761,null))[_0xd222('0x2d')](handleError(_0x9e6761,null));};exports['getWhatsappInteractions']=function(_0x141a5f,_0x1d11b5){var _0x3734ab={};var _0x2ad9cb={};var _0x5d5347;var _0x46c1a0;return db[_0xd222('0x42')][_0xd222('0x9e')]({'where':{'id':_0x141a5f[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x1d11b5,null))[_0xd222('0x23')](function(_0x34ef93){if(_0x34ef93){_0x5d5347=_0x34ef93;_0x2ad9cb[_0xd222('0xda')]=_[_0xd222('0xdc')](db[_0xd222('0xf3')][_0xd222('0x43')]);_0x2ad9cb['query']=_[_0xd222('0xdc')](_0x141a5f['query']);_0x2ad9cb[_0xd222('0xe1')]=_['intersection'](_0x2ad9cb[_0xd222('0xda')],_0x2ad9cb[_0xd222('0x4d')]);_0x3734ab[_0xd222('0x53')]=_['intersection'](_0x2ad9cb[_0xd222('0xda')],qs[_0xd222('0xde')](_0x141a5f[_0xd222('0x4d')]['fields']));_0x3734ab[_0xd222('0x53')]=_0x3734ab[_0xd222('0x53')][_0xd222('0x74')]?_0x3734ab[_0xd222('0x53')]:_0x2ad9cb[_0xd222('0xda')];_0x3734ab['order']=qs[_0xd222('0xe0')](_0x141a5f['query'][_0xd222('0xe0')]);_0x3734ab[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_['pick'](_0x141a5f[_0xd222('0x4d')],_0x2ad9cb['filters']));if(_0x141a5f[_0xd222('0x4d')]['filter']){_0x3734ab['where']=_[_0xd222('0x5f')](_0x3734ab['where'],{'$or':_[_0xd222('0x3a')](_0x3734ab['attributes'],function(_0x14fedc){var _0x9742ba={};_0x9742ba[_0x14fedc]={'$like':'%'+_0x141a5f[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0x9742ba;})});}_0x3734ab=_['merge']({},_0x3734ab,_0x141a5f[_0xd222('0xe3')]);return _0x5d5347[_0xd222('0xf4')](_0x3734ab);}})[_0xd222('0x23')](function(_0x38e509){if(_0x38e509){_0x46c1a0=_0x38e509['length'];if(!_0x141a5f[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x3734ab[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x141a5f[_0xd222('0x4d')][_0xd222('0x1f')]);_0x3734ab[_0xd222('0x1d')]=qs[_0xd222('0x1d')](_0x141a5f[_0xd222('0x4d')][_0xd222('0x1d')]);}return _0x5d5347[_0xd222('0xf4')](_0x3734ab);}})[_0xd222('0x23')](function(_0xfcd979){if(_0xfcd979){return _0xfcd979?{'count':_0x46c1a0,'rows':_0xfcd979}:null;}})[_0xd222('0x23')](respondWithResult(_0x1d11b5,null))[_0xd222('0x2d')](handleError(_0x1d11b5,null));};exports[_0xd222('0xf5')]=function(_0x101009,_0x5aab94,_0x34c593){var _0x44f8ce;var _0x5dd297;var _0x3253cc;var _0x24e141=!_['isNil'](_0x101009['params']['id'])?_0x101009[_0xd222('0x64')]['id']:!_[_0xd222('0x6e')](_0x101009[_0xd222('0x35')]['id'])?_0x101009[_0xd222('0x35')]['id']:null;return db[_0xd222('0x42')][_0xd222('0x3d')]({'where':{'id':_0x24e141,'role':{'$or':[_0xd222('0x33'),_0xd222('0x35'),_0xd222('0x2e')]}},'attributes':['id',_0xd222('0x3e'),_0xd222('0xf6'),_0xd222('0xf7'),_0xd222('0x32'),'internal','loginInPause']})['then'](function(_0x5ac825){if(_0x5ac825){if(_0x5ac825[_0xd222('0x32')]===_0xd222('0x2e')){_0x44f8ce=_0x5ac825;if(_0x101009[_0xd222('0x63')][_0xd222('0xa9')]){_0x3253cc=util[_0xd222('0xb5')](_0xd222('0xf8'),_0x44f8ce[_0x101009[_0xd222('0x63')][_0xd222('0xa9')]]);}else if(_0x101009[_0xd222('0x63')][_0xd222('0xf9')]){_0x3253cc=util[_0xd222('0xb5')](_0xd222('0xb6'),_0x101009[_0xd222('0x63')][_0xd222('0xf9')]);}else{_0x3253cc=util['format'](_0xd222('0xb6'),_0x44f8ce['name']);}socket['to'](util[_0xd222('0xb5')](_0xd222('0xfa'),_0x44f8ce[_0xd222('0x3e')]))[_0xd222('0x2f')]('user:forcelogout',{'user':{'id':_0x44f8ce['id'],'name':_0x44f8ce[_0xd222('0x3e')]},'ip':_0x101009[_0xd222('0xfb')]['x-forwarded-for']||_0x101009[_0xd222('0xfc')]['remoteAddress']||_0x101009['socket'][_0xd222('0xfd')]||_0x101009[_0xd222('0xfc')][_0xd222('0xfe')][_0xd222('0xfd')]});return db[_0xd222('0xb7')][_0xd222('0xbd')]({'where':{'membername':_0x44f8ce[_0xd222('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0xd222('0x96'))][(_0xd222('0x97'))](_0xd222('0xff'));}})['then'](function(){if(_0x44f8ce){return _0x44f8ce[_0xd222('0x100')]({'raw':!![]});}})[_0xd222('0x23')](function(_0x425f8f){if(_0x44f8ce){if(_0x425f8f){_0x5dd297=_0x425f8f;if(_0x5dd297[_0xd222('0x74')]){var _0x223e70=_0x5dd297[_0xd222('0x3a')](function(_0x47384e){var _0x5e28f3={'membername':_0x44f8ce[_0xd222('0x3e')],'UserId':_0x44f8ce['id'],'queue_name':_0x47384e[_0xd222('0x3e')],'VoiceQueueId':_0x47384e['id'],'interface':_0x3253cc,'paused':_0x44f8ce['loginInPause']||![],'penalty':_0x47384e[_0xd222('0x101')]||0x0};return db[_0xd222('0xb7')][_0xd222('0xb8')](_0x5e28f3);});return Promise['all'](_0x223e70);}}}})['then'](function(){if(_0x44f8ce){return db[_0xd222('0x102')][_0xd222('0x55')]({'where':{'membername':_0x44f8ce[_0xd222('0x3e')],'exitAt':null}});}})[_0xd222('0x23')](function(_0x41ece7){if(_0x44f8ce){var _0x301a8f=[];_0x41ece7[_0xd222('0x103')](function(_0x4adabc){_0x301a8f[_0xd222('0x54')](_0x4adabc[_0xd222('0x62')]({'exitAt':moment()[_0xd222('0xb5')](_0xd222('0x104'))}));});return Promise[_0xd222('0x61')](_0x301a8f);}})[_0xd222('0x23')](function(){if(_0x44f8ce){var _0x5e7ff7=[];var _0x3f84f6=[];var _0x573129=utils['getChannels']();var _0x39289c={'membername':_0x44f8ce[_0xd222('0x3e')],'interface':_0x3253cc,'enterAt':moment()[_0xd222('0xb5')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x44f8ce[_0xd222('0x32')],'internal':_0x44f8ce['internal']};_0x573129[_0xd222('0x103')](function(_0x4db608){_0x5e7ff7['push'](_['merge']({'channel':_0x4db608,'type':_0xd222('0x105'),'data1':_0x101009['body'][_0xd222('0x106')],'data2':_0x3253cc},_0x39289c));if(_0x44f8ce['loginInPause']){_0x3f84f6[_0xd222('0x54')](_[_0xd222('0x5f')]({'channel':_0x4db608,'type':_0xd222('0x107'),'data1':_0xd222('0x108')},_0x39289c));}});return db[_0xd222('0x102')][_0xd222('0x109')](_0x5e7ff7['concat'](_0x3f84f6),{'individualHooks':!![]});}})['then'](function(){if(_0x44f8ce){return _0x44f8ce[_0xd222('0x62')]({'online':!![],'lastLoginAt':moment()[_0xd222('0xb5')](_0xd222('0x104')),'voicePause':_0x44f8ce[_0xd222('0x10a')]||![],'mailPause':_0x44f8ce[_0xd222('0x10a')]||![],'chatPause':_0x44f8ce[_0xd222('0x10a')]||![],'faxPause':_0x44f8ce[_0xd222('0x10a')]||![],'smsPause':_0x44f8ce[_0xd222('0x10a')]||![],'openchannelPause':_0x44f8ce[_0xd222('0x10a')]||![],'whatsappPause':_0x44f8ce[_0xd222('0x10a')]||![],'pauseType':_0x44f8ce['loginInPause']?'LOGININPAUSE':null,'interface':_0x3253cc,'lastPauseAt':moment()[_0xd222('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xd222('0x23')](function(_0x1c4fca){if(_0x101009['isMiddleware']){return _0x34c593();}else{return Promise[_0xd222('0x10b')](_0x1c4fca)[_0xd222('0x23')](respondWithResult(_0x5aab94,null));}})['catch'](handleError(_0x5aab94,null));};exports['logout']=function(_0x3bb3dd,_0x8a6168){var _0x43ed15;return db[_0xd222('0x42')]['find']({'where':{'id':_0x3bb3dd[_0xd222('0x64')]['id'],'role':_0xd222('0x2e')},'attributes':['id',_0xd222('0x3e'),'role']})[_0xd222('0x23')](handleEntityNotFound(_0x8a6168,null))[_0xd222('0x23')](function(_0xf5314c){if(_0xf5314c){_0x43ed15=_0xf5314c;return db[_0xd222('0xb7')]['destroy']({'where':{'membername':_0x43ed15['name']},'individualHooks':!![]});}})[_0xd222('0x23')](function(){return db[_0xd222('0x102')][_0xd222('0x55')]({'where':{'membername':_0x43ed15[_0xd222('0x3e')],'exitAt':null}});})[_0xd222('0x23')](function(_0x5cef3a){var _0x144c4c=[];_0x5cef3a[_0xd222('0x103')](function(_0x4dd03d){_0x144c4c[_0xd222('0x54')](_0x4dd03d[_0xd222('0x62')]({'exitAt':moment()[_0xd222('0xb5')](_0xd222('0x104'))}));});return Promise[_0xd222('0x61')](_0x144c4c);})[_0xd222('0x23')](function(){return _0x43ed15['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd222('0x23')](respondWithResult(_0x8a6168,null))[_0xd222('0x2d')](handleError(_0x8a6168,null));};exports[_0xd222('0x10c')]=function(_0x213f44,_0x3248b1){var _0x3c68d2;return db['UserVoiceQueueRt'][_0xd222('0x62')]({'paused':0x1},{'where':{'UserId':_0x213f44['params']['id']},'individualHooks':!![]})[_0xd222('0x23')](function(){return db[_0xd222('0x42')][_0xd222('0x3d')]({'where':{'id':_0x213f44['params']['id'],'role':_0xd222('0x2e')},'attributes':['id',_0xd222('0x3e'),'role',_0xd222('0x69'),'interface',_0xd222('0xa7')]});})['then'](handleEntityNotFound(_0x3248b1,null))[_0xd222('0x23')](function(_0x58ae61){if(_0x58ae61){_0x3c68d2=_0x58ae61;return respondWithRpcPromise(_0xd222('0x10d'),_0xd222('0x10c'),{'id':_0x3c68d2['id'],'name':_0x3c68d2['name'],'pause':!![]});}})[_0xd222('0x23')](function(){if(_0x3c68d2){return db[_0xd222('0x102')]['findAll']({'where':{'membername':_0x3c68d2[_0xd222('0x3e')],'type':_0xd222('0x107'),'exitAt':null}});}})[_0xd222('0x23')](function(_0x59e136){if(_0x59e136['length']){var _0x587072=moment()[_0xd222('0xb5')](_0xd222('0x104'));for(var _0x4bb6a1=0x0,_0x22b0f0=_0x59e136[_0xd222('0x74')];_0x4bb6a1<_0x22b0f0;_0x4bb6a1++){_0x59e136[_0x4bb6a1][_0xd222('0x10e')]({'exitAt':_0x587072});}}})[_0xd222('0x23')](function(){var _0x2a78d4=[];var _0x4eaaf4=utils['getChannels']();_0x4eaaf4[_0xd222('0x103')](function(_0x5ffafd){_0x2a78d4['push']({'channel':_0x5ffafd,'membername':_0x3c68d2[_0xd222('0x3e')],'interface':_[_0xd222('0x6e')](_0x3c68d2['interface'])?util[_0xd222('0xb5')](_0xd222('0xb6'),_0x3c68d2[_0xd222('0x3e')]):_0x3c68d2[_0xd222('0xa9')],'type':_0xd222('0x107'),'enterAt':moment()[_0xd222('0xb5')](_0xd222('0x104')),'data1':_0x213f44[_0xd222('0x63')][_0xd222('0x10f')]||'DEFAULT\x20PAUSE','role':_0x3c68d2[_0xd222('0x32')],'internal':_0x3c68d2[_0xd222('0x69')]});});return db[_0xd222('0x102')][_0xd222('0x109')](_0x2a78d4,{'individualHooks':!![]});})[_0xd222('0x23')](function(){return _0x3c68d2['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x213f44[_0xd222('0x63')][_0xd222('0x10f')]||_0xd222('0x110'),'lastPauseAt':moment()[_0xd222('0xb5')](_0xd222('0x104'))});})[_0xd222('0x23')](respondWithResult(_0x3248b1,null))[_0xd222('0x2d')](handleError(_0x3248b1,null));};exports['unpause']=function(_0x294b02,_0x583670){if(_0x294b02[_0xd222('0x63')][_0xd222('0xa6')]&&!utils[_0xd222('0xaa')](_0x294b02['body']['channel'])){throw new APIBadRequestError(util[_0xd222('0xb5')](_0xd222('0x111'),_0x294b02[_0xd222('0x63')]['channel']));}return db[_0xd222('0x42')][_0xd222('0x3d')]({'where':{'id':_0x294b02[_0xd222('0x64')]['id']},'attributes':['id',_0xd222('0x3e'),_0xd222('0x32'),'internal','interface',_0xd222('0xa7'),_0xd222('0xa8'),_0xd222('0x112'),_0xd222('0x113'),_0xd222('0x114'),'openchannelPause',_0xd222('0x115'),'whatsappPause',_0xd222('0x116'),_0xd222('0x117')]})['then'](function(_0x506d2f){if(!_0x506d2f){throw new APINotFoundError(util[_0xd222('0xb5')](_0xd222('0x118'),_0x294b02[_0xd222('0x64')]['id']));}return _0x506d2f[_0xd222('0x119')](_0x294b02[_0xd222('0x63')]['channel']);})[_0xd222('0x23')](respondWithResult(_0x583670,null))[_0xd222('0x2d')](APIHandleError(_0x583670));};exports[_0xd222('0x11a')]=function(_0x6e812a,_0x5b4ebd){var _0x13c541={};var _0x49acf0={};var _0x59f350;var _0x2677c0;return db[_0xd222('0x42')][_0xd222('0x9e')]({'where':{'id':_0x6e812a[_0xd222('0x64')]['id']}})[_0xd222('0x23')](handleEntityNotFound(_0x5b4ebd,null))[_0xd222('0x23')](function(_0x4b251c){if(_0x4b251c){_0x59f350=_0x4b251c;_0x49acf0[_0xd222('0xda')]=_[_0xd222('0xdc')](db['Team'][_0xd222('0x43')]);_0x49acf0[_0xd222('0x4d')]=_[_0xd222('0xdc')](_0x6e812a['query']);_0x49acf0['filters']=_[_0xd222('0xdd')](_0x49acf0[_0xd222('0xda')],_0x49acf0[_0xd222('0x4d')]);_0x13c541['attributes']=_[_0xd222('0xdd')](_0x49acf0[_0xd222('0xda')],qs[_0xd222('0xde')](_0x6e812a['query']['fields']));_0x13c541['attributes']=_0x13c541['attributes'][_0xd222('0x74')]?_0x13c541['attributes']:_0x49acf0[_0xd222('0xda')];_0x13c541[_0xd222('0xdf')]=qs[_0xd222('0xe0')](_0x6e812a['query'][_0xd222('0xe0')]);_0x13c541[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x6e812a[_0xd222('0x4d')],_0x49acf0['filters']));if(_0x6e812a[_0xd222('0x4d')]['filter']){_0x13c541[_0xd222('0x4c')]=_[_0xd222('0x5f')](_0x13c541[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x13c541[_0xd222('0x53')],function(_0x525274){var _0x54dded={};_0x54dded[_0x525274]={'$like':'%'+_0x6e812a[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0x54dded;})});}_0x13c541=_['merge']({},_0x13c541,_0x6e812a[_0xd222('0xe3')]);return _0x59f350[_0xd222('0x11a')](_0x13c541);}})[_0xd222('0x23')](function(_0x23e8a5){if(_0x23e8a5){_0x2677c0=_0x23e8a5['length'];if(!_0x6e812a[_0xd222('0x4d')][_0xd222('0xd3')](_0xd222('0xe5'))){_0x13c541[_0xd222('0x1f')]=qs[_0xd222('0x1f')](_0x6e812a[_0xd222('0x4d')][_0xd222('0x1f')]);_0x13c541['offset']=qs['offset'](_0x6e812a[_0xd222('0x4d')][_0xd222('0x1d')]);}return _0x59f350[_0xd222('0x11a')](_0x13c541);}})[_0xd222('0x23')](function(_0x2dcbfc){if(_0x2dcbfc){return _0x2dcbfc?{'count':_0x2677c0,'rows':_0x2dcbfc}:null;}})[_0xd222('0x23')](respondWithResult(_0x5b4ebd,null))[_0xd222('0x2d')](handleError(_0x5b4ebd,null));};exports[_0xd222('0x11b')]=function(_0x2b824e,_0x581a48){var _0x15dab6=_0x2b824e[_0xd222('0x64')]['id'];var _0x1a2ae0=_0x2b824e[_0xd222('0x63')]?_0x2b824e[_0xd222('0x63')][_0xd222('0x67')]:null;var _0x1fd50c=[];return Promise['resolve']()[_0xd222('0x23')](function(){if(!_0x1a2ae0)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd222('0x23')](function(){return db[_0xd222('0x42')]['findOne']({'where':{'id':_0x15dab6}});})[_0xd222('0x23')](function(_0x553294){if(!_0x553294)throw new APINotFoundError(util['format'](_0xd222('0x118'),_0x2b824e[_0xd222('0x64')]['id']));return db[_0xd222('0x70')]['transaction'](function(_0x25781e){return _0x553294[_0xd222('0x11b')](_0x1a2ae0,{'transaction':_0x25781e})[_0xd222('0x23')](function(){return db[_0xd222('0x11c')][_0xd222('0x55')]({'where':{'id':{'$in':_0x1a2ae0}}});})[_0xd222('0x23')](function(_0x1a10f0){var _0x3816e7=_['map'](_0x1a10f0,function(_0x1db28c){return _0x1db28c[_0xd222('0x11d')]();});return Promise['all'](_0x3816e7);})['then'](function(_0x5121b9){_0x1fd50c=_[_0xd222('0x11e')](_0x5121b9);var _0x28db2e=_[_0xd222('0x3a')](_0x1fd50c,function(_0x53d30d){return _0x53d30d[_0xd222('0x11f')](_0x553294['id'],{'transaction':_0x25781e});});return Promise[_0xd222('0x61')](_0x28db2e);})[_0xd222('0x23')](function(){if(!_0x553294[_0xd222('0xa7')])return;var _0x1cb069=_['filter'](_0x1fd50c,function(_0x2a9bfd){return _0x2a9bfd[_0xd222('0x120')](_0xd222('0xa6'))===_0xd222('0x121');});var _0xd2ed96=_[_0xd222('0x3a')](_0x1cb069,function(_0xc7e8ed){return db[_0xd222('0xb7')][_0xd222('0xb8')]({'membername':_0x553294['name'],'UserId':_0x553294['id'],'queue_name':_0xc7e8ed[_0xd222('0x3e')],'VoiceQueueId':_0xc7e8ed['id'],'interface':_['isNil'](_0x553294[_0xd222('0xa9')])?util[_0xd222('0xb5')](_0xd222('0xb6'),_0x553294[_0xd222('0x3e')]):_0x553294[_0xd222('0xa9')],'paused':_0x553294[_0xd222('0xa8')]||![],'penalty':_0x553294['penalty']},{'transaction':_0x25781e});});return Promise[_0xd222('0x61')](_0xd2ed96);})[_0xd222('0x23')](function(){return db[_0xd222('0x122')][_0xd222('0x55')]({'where':{'teamId':{'$in':_0x1a2ae0}}});})[_0xd222('0x23')](function(_0x23c539){var _0x2c4795=_[_0xd222('0x3a')](_0x23c539,function(_0x468019){return db[_0xd222('0x123')][_0xd222('0x8e')]({'UserId':_0x553294['id'],'VoicePrefixId':_0x468019[_0xd222('0x124')]},{'transaction':_0x25781e});});return Promise[_0xd222('0x61')](_0x2c4795);});});})[_0xd222('0x23')](function(){for(var _0x54c47f=0x0;_0x54c47f<_0x1fd50c[_0xd222('0x74')];_0x54c47f++){var _0x26deb2=_0x1fd50c[_0x54c47f]['getDataValue'](_0xd222('0xa6'));var _0x318b8c=_0x26deb2+_0xd222('0xb1');socket['emit']('user'+_0x26deb2+'Queue:save',{'UserId':_0x15dab6,['queueField']:_0x1fd50c[_0x54c47f]['id']});}})[_0xd222('0x23')](respondWithStatusCode(_0x581a48,null))[_0xd222('0x2d')](APIHandleError(_0x581a48));};exports[_0xd222('0x125')]=function(_0x3ff90d,_0x32b08e){var _0x13693b=_0x3ff90d['params']['id'];var _0x2d051b=null;if(_0x3ff90d[_0xd222('0x4d')][_0xd222('0x67')]){_0x2d051b=_[_0xd222('0xbb')](_0x3ff90d[_0xd222('0x4d')][_0xd222('0x67')])?_0x3ff90d[_0xd222('0x4d')]['ids']:[_0x3ff90d[_0xd222('0x4d')][_0xd222('0x67')]];}var _0x2be1af=[];return Promise['resolve']()[_0xd222('0x23')](function(){if(!_0x2d051b)throw new APIBadRequestError(_0xd222('0x126'));})['then'](function(){return db[_0xd222('0x42')]['findOne']({'where':{'id':_0x13693b}});})[_0xd222('0x23')](function(_0x5aa38a){if(!_0x5aa38a)throw new APINotFoundError(util[_0xd222('0xb5')](_0xd222('0x118'),_0x3ff90d[_0xd222('0x64')]['id']));return db[_0xd222('0x70')][_0xd222('0x127')](function(_0x3cb98c){return _0x5aa38a[_0xd222('0x125')](_0x2d051b,{'transaction':_0x3cb98c})[_0xd222('0x23')](function(){return db['Team'][_0xd222('0x55')]({'where':{'id':{'$in':_0x2d051b}}});})[_0xd222('0x23')](function(_0x4254ac){var _0x23344d=_[_0xd222('0x3a')](_0x4254ac,function(_0x43a2b7){return _0x43a2b7[_0xd222('0x11d')]();});return Promise['all'](_0x23344d);})[_0xd222('0x23')](function(_0x5c2922){_0x2be1af=_[_0xd222('0x11e')](_0x5c2922);var _0x28345d=_['map'](_0x2be1af,function(_0x16de18){return _0x16de18['removeAgent'](_0x5aa38a['id'],{'transaction':_0x3cb98c});});return Promise[_0xd222('0x61')](_0x28345d);})['then'](function(){if(!_0x5aa38a[_0xd222('0xa7')])return;var _0x48e87d=_[_0xd222('0x38')](_0x2be1af,function(_0x108da6){return _0x108da6['getDataValue']('channel')===_0xd222('0x121');});var _0x56a078=_[_0xd222('0x3a')](_0x48e87d,function(_0x108302){return db[_0xd222('0xb7')][_0xd222('0xbd')]({'where':{'VoiceQueueId':_0x108302['id'],'UserId':_0x5aa38a['id']},'transaction':_0x3cb98c});});return Promise[_0xd222('0x61')](_0x56a078);})[_0xd222('0x23')](function(){return db[_0xd222('0x122')][_0xd222('0x55')]({'where':{'teamId':{'$in':_0x2d051b}}});})[_0xd222('0x23')](function(_0x2a90a0){var _0x3c8d8d=_[_0xd222('0x3a')](_0x2a90a0,function(_0x3e0149){return db[_0xd222('0x123')][_0xd222('0xbd')]({'where':{'UserId':_0x5aa38a['id'],'VoicePrefixId':_0x3e0149['VoicePrefixId']}},{'transaction':_0x3cb98c});});return Promise[_0xd222('0x61')](_0x3c8d8d);});});})[_0xd222('0x23')](function(){for(var _0x42faf1=0x0;_0x42faf1<_0x2be1af[_0xd222('0x74')];_0x42faf1++){var _0x2bb025=_0x2be1af[_0x42faf1]['getDataValue'](_0xd222('0xa6'));var _0x1af671=_0x2bb025+_0xd222('0xb1');socket['emit'](_0xd222('0x35')+_0x2bb025+'Queue:remove',{'UserId':_0x13693b,['queueField']:_0x2be1af[_0x42faf1]['id']});}})['then'](respondWithStatusCode(_0x32b08e,null))['catch'](APIHandleError(_0x32b08e));};exports[_0xd222('0x128')]=function(_0x58f951,_0x3eaf9){var _0x3cfe98={};var _0x5d80cd={};var _0x5c53a5;var _0x339dbd;return db['User'][_0xd222('0x9e')]({'where':{'id':_0x58f951[_0xd222('0x64')]['id']}})['then'](handleEntityNotFound(_0x3eaf9,null))[_0xd222('0x23')](function(_0x1df184){if(_0x1df184){_0x5c53a5=_0x1df184;_0x5d80cd['model']=_[_0xd222('0xdc')](db[_0xd222('0x129')][_0xd222('0x43')]);_0x5d80cd['query']=_[_0xd222('0xdc')](_0x58f951['query']);_0x5d80cd[_0xd222('0xe1')]=_[_0xd222('0xdd')](_0x5d80cd[_0xd222('0xda')],_0x5d80cd[_0xd222('0x4d')]);_0x3cfe98['attributes']=_['intersection'](_0x5d80cd[_0xd222('0xda')],qs[_0xd222('0xde')](_0x58f951['query'][_0xd222('0xde')]));_0x3cfe98['attributes']=_0x3cfe98[_0xd222('0x53')][_0xd222('0x74')]?_0x3cfe98['attributes']:_0x5d80cd[_0xd222('0xda')];_0x3cfe98[_0xd222('0xdf')]=qs['sort'](_0x58f951[_0xd222('0x4d')]['sort']);_0x3cfe98[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x58f951[_0xd222('0x4d')],_0x5d80cd[_0xd222('0xe1')]));if(_0x58f951[_0xd222('0x4d')][_0xd222('0x38')]){_0x3cfe98[_0xd222('0x4c')]=_[_0xd222('0x5f')](_0x3cfe98[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x3cfe98[_0xd222('0x53')],function(_0x583b3e){var _0x186d6f={};_0x186d6f[_0x583b3e]={'$like':'%'+_0x58f951[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0x186d6f;})});}_0x3cfe98=_[_0xd222('0x5f')]({},_0x3cfe98,_0x58f951[_0xd222('0xe3')]);return _0x5c53a5[_0xd222('0x128')](_0x3cfe98);}})[_0xd222('0x23')](function(_0x59500b){if(_0x59500b){_0x339dbd=_0x59500b[_0xd222('0x74')];if(!_0x58f951[_0xd222('0x4d')]['hasOwnProperty'](_0xd222('0xe5'))){_0x3cfe98[_0xd222('0x1f')]=qs['limit'](_0x58f951[_0xd222('0x4d')][_0xd222('0x1f')]);_0x3cfe98['offset']=qs['offset'](_0x58f951['query']['offset']);}return _0x5c53a5['getLists'](_0x3cfe98);}})[_0xd222('0x23')](function(_0x4548b4){if(_0x4548b4){return _0x4548b4?{'count':_0x339dbd,'rows':_0x4548b4}:null;}})[_0xd222('0x23')](respondWithResult(_0x3eaf9,null))[_0xd222('0x2d')](handleError(_0x3eaf9,null));};exports[_0xd222('0x12a')]=function(_0x2c20fd,_0x465cf0){var _0x35795b={};var _0xfaf224={};var _0x43a57d;return db[_0xd222('0x42')][_0xd222('0x9e')]({'where':{'id':_0x2c20fd[_0xd222('0x64')]['id']}})['then'](handleEntityNotFound(_0x465cf0,null))[_0xd222('0x23')](function(_0x56a083){if(_0x56a083){_0x43a57d=_0x56a083;_0xfaf224[_0xd222('0xda')]=_[_0xd222('0xdc')](db['User'][_0xd222('0x43')]);_0xfaf224[_0xd222('0x4d')]=_['keys'](_0x2c20fd[_0xd222('0x4d')]);_0xfaf224['filters']=_[_0xd222('0xdd')](_0xfaf224[_0xd222('0xda')],_0xfaf224[_0xd222('0x4d')]);_0x35795b[_0xd222('0x53')]=_['intersection'](_0xfaf224[_0xd222('0xda')],qs[_0xd222('0xde')](_0x2c20fd['query'][_0xd222('0xde')]));_0x35795b[_0xd222('0x53')]=_0x35795b['attributes'][_0xd222('0x74')]?_0x35795b[_0xd222('0x53')]:_0xfaf224[_0xd222('0xda')];_0x35795b['order']=qs['sort'](_0x2c20fd[_0xd222('0x4d')][_0xd222('0xe0')]);_0x35795b[_0xd222('0x4c')]=qs[_0xd222('0xe1')](_[_0xd222('0xe2')](_0x2c20fd['query'],_0xfaf224[_0xd222('0xe1')]));if(_0x2c20fd['query'][_0xd222('0x38')]){_0x35795b[_0xd222('0x4c')]=_['merge'](_0x35795b[_0xd222('0x4c')],{'$or':_[_0xd222('0x3a')](_0x35795b[_0xd222('0x53')],function(_0x1392ed){var _0x64bd62={};_0x64bd62[_0x1392ed]={'$like':'%'+_0x2c20fd[_0xd222('0x4d')][_0xd222('0x38')]+'%'};return _0x64bd62;})});}_0x35795b['model']=db[_0xd222('0x42')];_0x35795b['as']=_0xd222('0x36');_0x35795b=_[_0xd222('0x5f')]({},_0x35795b,_0x2c20fd[_0xd222('0xe3')]);return _0x43a57d[_0xd222('0x100')]({'include':[_0x35795b]});}})[_0xd222('0x23')](function(_0x359f6e){if(_0x359f6e){var _0x2f15d8={},_0x2d3f2e=[];for(var _0x2270b7=0x0;_0x2270b7<_0x359f6e[_0xd222('0x74')];_0x2270b7+=0x1){for(var _0x2fbc60=0x0,_0x131be6;_0x2fbc60<_0x359f6e[_0x2270b7][_0xd222('0x36')][_0xd222('0x74')];_0x2fbc60+=0x1){_0x131be6=_0x359f6e[_0x2270b7][_0xd222('0x36')][_0x2fbc60]['get']({'plain':!![]});_0x2f15d8[_0x131be6['id']]=_0x131be6;}}_0x2f15d8=_['values'](_0x2f15d8);for(var _0x193203=qs[_0xd222('0x1d')](_0x2c20fd['query'][_0xd222('0x1d')]);_0x193203<_0x2f15d8[_0xd222('0x74')]&&_0x2d3f2e[_0xd222('0x74')]=_0x579bfb[_0x5653('0x4d')]){throw new Error(_0x5653('0x4e'));}})[_0x5653('0x14')](function(){if(_0x2cb7ff){return db[_0x5653('0x24')]['destroy']({'where':{'membername':_0x2cb7ff['name']},'individualHooks':!![]});}})[_0x5653('0x14')](function(){if(_0x2cb7ff){return _0x2cb7ff[_0x5653('0x4f')]({'raw':!![]});}})[_0x5653('0x14')](function(_0x311fc2){if(_0x2cb7ff){if(_0x311fc2){var _0x398d96=[];_0x5dac9b=_0x311fc2;if(_0x5dac9b[_0x5653('0x27')]){for(var _0x46a2e8=0x0;_0x46a2e8<_0x5dac9b['length'];_0x46a2e8++){_0x398d96['push'](db[_0x5653('0x24')][_0x5653('0x50')]({'membername':_0x2cb7ff['name'],'UserId':_0x2cb7ff['id'],'queue_name':_0x5dac9b[_0x46a2e8][_0x5653('0x2c')],'VoiceQueueId':_0x5dac9b[_0x46a2e8]['id'],'interface':_0x5594c7,'paused':_0x2cb7ff[_0x5653('0x48')]||![],'penalty':_0x5dac9b[_0x46a2e8][_0x5653('0x51')]||0x0}));}return BPromise['all'](_0x398d96);}}}})[_0x5653('0x14')](function(){if(_0x2cb7ff){return db[_0x5653('0x31')][_0x5653('0xc')]({'where':{'membername':_0x2cb7ff[_0x5653('0x2c')],'exitAt':null}});}})[_0x5653('0x14')](function(_0xb0f45b){if(_0x2cb7ff){if(_0xb0f45b&&_0xb0f45b[_0x5653('0x27')]){var _0x171cc5=[];_0xb0f45b[_0x5653('0x2a')](function(_0x2c29c4){_0x171cc5['push'](_0x2c29c4[_0x5653('0x25')]({'exitAt':moment()['format'](_0x5653('0x28'))}));});return BPromise[_0x5653('0x44')](_0x171cc5);}}})['then'](function(){if(_0x2cb7ff){var _0x113f15=[];var _0x37705c=[];var _0x1242e9=utils['getChannels']();var _0xf67b7b={'membername':_0x2cb7ff['name'],'interface':_0x5594c7,'enterAt':moment()[_0x5653('0x21')](_0x5653('0x28')),'role':_0x2cb7ff[_0x5653('0x1f')],'internal':_0x2cb7ff[_0x5653('0x20')]};_0x1242e9[_0x5653('0x2a')](function(_0x80e89a){_0x113f15[_0x5653('0x2b')](_['merge']({'channel':_0x80e89a,'type':_0x5653('0x52'),'data1':'callysquare','data2':_0x5594c7},_0xf67b7b));if(_0x2cb7ff['loginInPause']){_0x37705c[_0x5653('0x2b')](_[_0x5653('0x53')]({'channel':_0x80e89a,'type':_0x5653('0x26'),'data1':_0x5653('0x54')},_0xf67b7b));}});return db[_0x5653('0x31')]['bulkCreate'](_0x113f15[_0x5653('0x55')](_0x37705c),{'individualHooks':!![]});}})[_0x5653('0x14')](function(){if(_0x2cb7ff){return _0x2cb7ff['update']({'online':!![],'lastLoginAt':moment()[_0x5653('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2cb7ff[_0x5653('0x48')]||![],'mailPause':_0x2cb7ff[_0x5653('0x48')]||![],'chatPause':_0x2cb7ff[_0x5653('0x48')]||![],'faxPause':_0x2cb7ff[_0x5653('0x48')]||![],'smsPause':_0x2cb7ff[_0x5653('0x48')]||![],'openchannelPause':_0x2cb7ff['loginInPause']||![],'pauseType':_0x2cb7ff['loginInPause']?_0x5653('0x54'):null,'lastPauseAt':moment()[_0x5653('0x21')](_0x5653('0x28')),'interface':_0x5594c7});}})['then'](function(_0x18efb3){_0xac4368(_0x18efb3);})[_0x5653('0x19')](function(_0xb7f690){_0x4fa76b(_0x4119cf[_0x5653('0x1a')](0x1f4,_0xb7f690['message']));});});}; \ No newline at end of file +var _0x6a65=['role','interface','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','format','body','type','internal','uniqueid','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','pauseType','lastPauseAt','unpause','LogoutUser','destroy','forEach','all','LoginUser','mobile','phone','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','loginInPause','PAUSE','LOGININPAUSE','bulkCreate','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','catch','message','error','ShowUser','PauseUser','name'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x6a65,0x89));var _0x56a6=function(_0x537e17,_0x631004){_0x537e17=_0x537e17-0x0;var _0x1fa820=_0x6a65[_0x537e17];return _0x1fa820;};'use strict';var _=require('lodash');var util=require(_0x56a6('0x0'));var moment=require(_0x56a6('0x1'));var BPromise=require(_0x56a6('0x2'));var Redis=require(_0x56a6('0x3'));var db=require(_0x56a6('0x4'))['db'];var utils=require(_0x56a6('0x5'));var logger=require(_0x56a6('0x6'))(_0x56a6('0x7'));var config=require(_0x56a6('0x8'));config[_0x56a6('0x9')]=_[_0x56a6('0xa')](config['redis'],{'host':_0x56a6('0xb'),'port':0x18eb});var socket=require(_0x56a6('0xc'))(new Redis(config[_0x56a6('0x9')]));require(_0x56a6('0xd'))[_0x56a6('0xe')](socket);exports[_0x56a6('0xf')]=function(_0xc80cf){var _0x541e4d=this;return new Promise(function(_0xe0fac5,_0x2f9344){return db[_0x56a6('0x10')][_0x56a6('0x11')]({'raw':_0xc80cf[_0x56a6('0x12')]?_0xc80cf[_0x56a6('0x12')][_0x56a6('0x13')]===undefined?!![]:![]:!![],'where':_0xc80cf[_0x56a6('0x12')]?_0xc80cf['options'][_0x56a6('0x14')]||null:null,'attributes':_0xc80cf['options']?_0xc80cf['options'][_0x56a6('0x15')]||null:null,'limit':_0xc80cf[_0x56a6('0x12')]?_0xc80cf[_0x56a6('0x12')][_0x56a6('0x16')]||null:null,'include':_0xc80cf[_0x56a6('0x12')]?_0xc80cf[_0x56a6('0x12')][_0x56a6('0x17')]?_[_0x56a6('0x18')](_0xc80cf[_0x56a6('0x12')]['include'],function(_0x234982){return{'model':db[_0x234982['model']],'as':_0x234982['as'],'attributes':_0x234982[_0x56a6('0x15')],'include':_0x234982['include']?_[_0x56a6('0x18')](_0x234982[_0x56a6('0x17')],function(_0x2f0970){return{'model':db[_0x2f0970[_0x56a6('0x19')]],'as':_0x2f0970['as'],'attributes':_0x2f0970[_0x56a6('0x15')],'include':_0x2f0970[_0x56a6('0x17')]?_[_0x56a6('0x18')](_0x2f0970['include'],function(_0x1f849a){return{'model':db[_0x1f849a['model']],'as':_0x1f849a['as'],'attributes':_0x1f849a[_0x56a6('0x15')]};}):[]};}):[]};}):[]:[]})[_0x56a6('0x1a')](function(_0x308d75){logger[_0x56a6('0x1b')]('GetUser',_0xc80cf);logger['debug']('GetUser',_0xc80cf,JSON[_0x56a6('0x1c')](_0x308d75));_0xe0fac5(_0x308d75);})[_0x56a6('0x1d')](function(_0x4b3ccf){logger['error']('GetUser',_0x4b3ccf[_0x56a6('0x1e')],_0xc80cf);_0x2f9344(_0x541e4d[_0x56a6('0x1f')](0x1f4,_0x4b3ccf[_0x56a6('0x1e')]));});});};exports[_0x56a6('0x20')]=function(_0x5eda5c){var _0xf87e84=this;return new Promise(function(_0x4ec5b1,_0x4d49fb){return db[_0x56a6('0x10')]['find']({'raw':_0x5eda5c['options']?_0x5eda5c[_0x56a6('0x12')][_0x56a6('0x13')]===undefined?!![]:![]:!![],'where':_0x5eda5c[_0x56a6('0x12')]?_0x5eda5c[_0x56a6('0x12')][_0x56a6('0x14')]||null:null,'attributes':_0x5eda5c['options']?_0x5eda5c['options'][_0x56a6('0x15')]||null:null,'include':_0x5eda5c[_0x56a6('0x12')]?_0x5eda5c[_0x56a6('0x12')][_0x56a6('0x17')]?_[_0x56a6('0x18')](_0x5eda5c[_0x56a6('0x12')][_0x56a6('0x17')],function(_0x15068d){return{'model':db[_0x15068d[_0x56a6('0x19')]],'as':_0x15068d['as'],'attributes':_0x15068d['attributes'],'include':_0x15068d[_0x56a6('0x17')]?_[_0x56a6('0x18')](_0x15068d['include'],function(_0x571859){return{'model':db[_0x571859['model']],'as':_0x571859['as'],'attributes':_0x571859[_0x56a6('0x15')],'include':_0x571859[_0x56a6('0x17')]?_[_0x56a6('0x18')](_0x571859[_0x56a6('0x17')],function(_0x2c9ffc){return{'model':db[_0x2c9ffc[_0x56a6('0x19')]],'as':_0x2c9ffc['as'],'attributes':_0x2c9ffc[_0x56a6('0x15')]};}):[]};}):[]};}):[]:[]})[_0x56a6('0x1a')](function(_0x1c5c37){logger['info'](_0x56a6('0x20'),_0x5eda5c);logger['debug']('ShowUser',_0x5eda5c,JSON['stringify'](_0x1c5c37));_0x4ec5b1(_0x1c5c37);})[_0x56a6('0x1d')](function(_0x306a00){logger[_0x56a6('0x1f')](_0x56a6('0x20'),_0x306a00[_0x56a6('0x1e')],_0x5eda5c);_0x4d49fb(_0xf87e84[_0x56a6('0x1f')](0x1f4,_0x306a00[_0x56a6('0x1e')]));});});};exports[_0x56a6('0x21')]=function(_0x4ef802){var _0x4ff01a;return db[_0x56a6('0x10')]['find']({'where':_0x4ef802['options'][_0x56a6('0x14')]||{},'attributes':['id',_0x56a6('0x22'),_0x56a6('0x23'),'internal',_0x56a6('0x24')]})[_0x56a6('0x1a')](function(_0x134c86){if(!_0x134c86){throw new Error(util['format'](_0x56a6('0x25'),_0x4ef802[_0x56a6('0x26')]['id']));}_0x4ff01a=_0x134c86;return db[_0x56a6('0x27')][_0x56a6('0x28')]({'paused':0x1},{'where':{'UserId':_0x4ff01a['id']},'individualHooks':!![]});})[_0x56a6('0x1a')](function(){return db[_0x56a6('0x29')]['findAll']({'where':{'membername':_0x4ff01a[_0x56a6('0x22')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x4c941f){if(_0x4c941f&&_0x4c941f[_0x56a6('0x2a')]){var _0x4028f5=moment()['format'](_0x56a6('0x2b'));for(var _0x5a2d97=0x0,_0x48bd8f=_0x4c941f[_0x56a6('0x2a')];_0x5a2d97<_0x48bd8f;_0x5a2d97++){_0x4c941f[_0x5a2d97][_0x56a6('0x2c')]({'exitAt':_0x4028f5});}}})[_0x56a6('0x1a')](function(){var _0x57b52c=[];var _0x4b40be=utils[_0x56a6('0x2d')]();_0x4b40be['forEach'](function(_0x5983fd){_0x57b52c[_0x56a6('0x2e')]({'channel':_0x5983fd,'membername':_0x4ff01a[_0x56a6('0x22')],'interface':_[_0x56a6('0x2f')](_0x4ff01a[_0x56a6('0x24')])?util['format'](_0x56a6('0x30'),_0x4ff01a[_0x56a6('0x22')]):_0x4ff01a[_0x56a6('0x24')],'type':'PAUSE','enterAt':moment()[_0x56a6('0x31')](_0x56a6('0x2b')),'data1':_0x4ef802[_0x56a6('0x32')][_0x56a6('0x33')]||'DEFAULT\x20PAUSE','role':_0x4ff01a[_0x56a6('0x23')],'internal':_0x4ff01a[_0x56a6('0x34')],'uniqueid':_0x4ef802[_0x56a6('0x32')][_0x56a6('0x35')]||null});});return db[_0x56a6('0x29')]['bulkCreate'](_0x57b52c,{'individualHooks':!![]});})[_0x56a6('0x1a')](function(){return _0x4ff01a['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4ef802['body']['type']||_0x56a6('0x36'),'lastPauseAt':moment()[_0x56a6('0x31')](_0x56a6('0x2b'))});})['catch'](function(_0x38d2cb){throw _0x38d2cb;});};exports[_0x56a6('0x37')]=function(_0x34deb1){return Promise[_0x56a6('0x38')]()[_0x56a6('0x1a')](function(){if(_0x34deb1['body']['channel']&&!utils['isValidChannel'](_0x34deb1[_0x56a6('0x32')][_0x56a6('0x39')])){throw new Error(util[_0x56a6('0x31')](_0x56a6('0x3a'),_0x34deb1[_0x56a6('0x32')][_0x56a6('0x39')]));}return db[_0x56a6('0x10')][_0x56a6('0x3b')]({'where':_0x34deb1[_0x56a6('0x12')][_0x56a6('0x14')]||{},'attributes':['id',_0x56a6('0x22'),_0x56a6('0x23'),_0x56a6('0x34'),'interface',_0x56a6('0x3c'),_0x56a6('0x3d'),_0x56a6('0x3e'),'chatPause','faxPause','openchannelPause','smsPause','whatsappPause',_0x56a6('0x3f'),_0x56a6('0x40')]});})['then'](function(_0x56f07a){if(!_0x56f07a){throw new Error(util[_0x56a6('0x31')](_0x56a6('0x25'),_0x34deb1[_0x56a6('0x26')]['id']));}return _0x56f07a[_0x56a6('0x41')](_0x34deb1[_0x56a6('0x32')][_0x56a6('0x39')],'system');})[_0x56a6('0x1d')](function(_0x1326e6){throw _0x1326e6;});};exports[_0x56a6('0x42')]=function(_0x31f6de){var _0x2b4425=this;return new Promise(function(_0x34a79a,_0x25db01){var _0x24e18f;return db[_0x56a6('0x10')][_0x56a6('0x3b')]({'where':_0x31f6de['options'][_0x56a6('0x14')]||{},'attributes':['id',_0x56a6('0x22')]})[_0x56a6('0x1a')](function(_0x4c30f6){if(_0x4c30f6){_0x24e18f=_0x4c30f6;return db[_0x56a6('0x27')][_0x56a6('0x43')]({'where':{'membername':_0x24e18f['name']},'individualHooks':!![]});}})['then'](function(){if(_0x24e18f){return db[_0x56a6('0x29')]['findAll']({'where':{'membername':_0x24e18f[_0x56a6('0x22')],'exitAt':null}});}})[_0x56a6('0x1a')](function(_0x5e46a4){if(_0x24e18f){if(_0x5e46a4&&_0x5e46a4[_0x56a6('0x2a')]){var _0x2f5ea7=[];_0x5e46a4[_0x56a6('0x44')](function(_0x5890cb){_0x2f5ea7[_0x56a6('0x2e')](_0x5890cb['update']({'exitAt':moment()[_0x56a6('0x31')](_0x56a6('0x2b'))}));});return BPromise[_0x56a6('0x45')](_0x2f5ea7);}}})[_0x56a6('0x1a')](function(){if(_0x24e18f){return _0x24e18f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x56a6('0x1a')](function(_0x377c59){_0x34a79a(_0x377c59);})[_0x56a6('0x1d')](function(_0x311245){_0x25db01(_0x2b4425[_0x56a6('0x1f')](0x1f4,_0x311245[_0x56a6('0x1e')]));});});};exports[_0x56a6('0x46')]=function(_0x5e1606){var _0x22d454=this;return new Promise(function(_0x3eab33,_0x950010){var _0x363d14;var _0x1f1020;var _0x182cf6;var _0x38c616;return db[_0x56a6('0x10')][_0x56a6('0x3b')]({'where':_0x5e1606[_0x56a6('0x12')]['where']||{},'attributes':['id',_0x56a6('0x22'),_0x56a6('0x23'),_0x56a6('0x47'),_0x56a6('0x48'),_0x56a6('0x34'),'loginInPause',_0x56a6('0x24')]})[_0x56a6('0x1a')](function(_0x326f10){if(_0x326f10){_0x363d14=_0x326f10;_0x38c616=_0x5e1606['body'][_0x56a6('0x24')]?_0x5e1606['body'][_0x56a6('0x24')]:util[_0x56a6('0x31')](_0x56a6('0x30'),_0x363d14[_0x56a6('0x22')]);return db[_0x56a6('0x10')]['count']({'where':{'role':_0x56a6('0x49'),'online':!![],'id':{'$ne':_0x363d14['id']}}});}})[_0x56a6('0x1a')](function(_0x100ba7){if(_0x100ba7){_0x182cf6=_0x100ba7;return require(_0x56a6('0x4a'))[_0x56a6('0x4b')]();}})[_0x56a6('0x1a')](function(_0x37438d){if(_0x37438d&&_0x37438d[_0x56a6('0x4c')]&&_0x182cf6>=_0x37438d[_0x56a6('0x4c')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x363d14){return db[_0x56a6('0x27')]['destroy']({'where':{'membername':_0x363d14[_0x56a6('0x22')]},'individualHooks':!![]});}})[_0x56a6('0x1a')](function(){if(_0x363d14){return _0x363d14[_0x56a6('0x4d')]({'raw':!![]});}})[_0x56a6('0x1a')](function(_0x2e0f7a){if(_0x363d14){if(_0x2e0f7a){var _0x12f211=[];_0x1f1020=_0x2e0f7a;if(_0x1f1020[_0x56a6('0x2a')]){for(var _0x5860e1=0x0;_0x5860e1<_0x1f1020[_0x56a6('0x2a')];_0x5860e1++){_0x12f211[_0x56a6('0x2e')](db[_0x56a6('0x27')][_0x56a6('0x4e')]({'membername':_0x363d14['name'],'UserId':_0x363d14['id'],'queue_name':_0x1f1020[_0x5860e1][_0x56a6('0x22')],'VoiceQueueId':_0x1f1020[_0x5860e1]['id'],'interface':_0x38c616,'paused':_0x363d14['loginInPause']||![],'penalty':_0x1f1020[_0x5860e1][_0x56a6('0x4f')]||0x0}));}return BPromise['all'](_0x12f211);}}}})[_0x56a6('0x1a')](function(){if(_0x363d14){return db[_0x56a6('0x29')]['findAll']({'where':{'membername':_0x363d14[_0x56a6('0x22')],'exitAt':null}});}})[_0x56a6('0x1a')](function(_0x2f47a0){if(_0x363d14){if(_0x2f47a0&&_0x2f47a0[_0x56a6('0x2a')]){var _0x14294e=[];_0x2f47a0[_0x56a6('0x44')](function(_0xa3cb86){_0x14294e[_0x56a6('0x2e')](_0xa3cb86[_0x56a6('0x28')]({'exitAt':moment()[_0x56a6('0x31')](_0x56a6('0x2b'))}));});return BPromise['all'](_0x14294e);}}})[_0x56a6('0x1a')](function(){if(_0x363d14){var _0x547f91=[];var _0x50f949=[];var _0x39094f=utils['getChannels']();var _0x1f7f32={'membername':_0x363d14[_0x56a6('0x22')],'interface':_0x38c616,'enterAt':moment()[_0x56a6('0x31')](_0x56a6('0x2b')),'role':_0x363d14['role'],'internal':_0x363d14[_0x56a6('0x34')]};_0x39094f[_0x56a6('0x44')](function(_0x338bba){_0x547f91[_0x56a6('0x2e')](_[_0x56a6('0x50')]({'channel':_0x338bba,'type':_0x56a6('0x51'),'data1':'callysquare','data2':_0x38c616},_0x1f7f32));if(_0x363d14[_0x56a6('0x52')]){_0x50f949[_0x56a6('0x2e')](_[_0x56a6('0x50')]({'channel':_0x338bba,'type':_0x56a6('0x53'),'data1':_0x56a6('0x54')},_0x1f7f32));}});return db['MemberReport'][_0x56a6('0x55')](_0x547f91['concat'](_0x50f949),{'individualHooks':!![]});}})[_0x56a6('0x1a')](function(){if(_0x363d14){return _0x363d14[_0x56a6('0x28')]({'online':!![],'lastLoginAt':moment()[_0x56a6('0x31')](_0x56a6('0x2b')),'voicePause':_0x363d14[_0x56a6('0x52')]||![],'mailPause':_0x363d14[_0x56a6('0x52')]||![],'chatPause':_0x363d14[_0x56a6('0x52')]||![],'faxPause':_0x363d14[_0x56a6('0x52')]||![],'smsPause':_0x363d14[_0x56a6('0x52')]||![],'openchannelPause':_0x363d14[_0x56a6('0x52')]||![],'pauseType':_0x363d14['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x56a6('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x38c616});}})[_0x56a6('0x1a')](function(_0x4eda39){_0x3eab33(_0x4eda39);})[_0x56a6('0x1d')](function(_0x49cc95){_0x950010(_0x22d454[_0x56a6('0x1f')](0x1f4,_0x49cc95[_0x56a6('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1ffd72b..9882938 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 _0xe6f6=['update','emit','./user.events','save','remove'];(function(_0x1c92ec,_0x5cfdbc){var _0x20119a=function(_0x3a0ce8){while(--_0x3a0ce8){_0x1c92ec['push'](_0x1c92ec['shift']());}};_0x20119a(++_0x5cfdbc);}(_0xe6f6,0x15b));var _0x6e6f=function(_0x1e3e3c,_0x87a9cc){_0x1e3e3c=_0x1e3e3c-0x0;var _0x46c741=_0xe6f6[_0x1e3e3c];return _0x46c741;};'use strict';var UserEvents=require(_0x6e6f('0x0'));var events=[_0x6e6f('0x1'),_0x6e6f('0x2'),_0x6e6f('0x3')];function createListener(_0x565cc0,_0x27c4f9){return function(_0xb56323){_0x27c4f9[_0x6e6f('0x4')](_0x565cc0,_0xb56323);};}function removeListener(_0x4d4f50,_0x47271b){return function(){UserEvents['removeListener'](_0x4d4f50,_0x47271b);};}exports['register']=function(_0x1b629f){for(var _0x394107=0x0,_0xafb8fc=events['length'];_0x394107<_0xafb8fc;_0x394107++){var _0x46ca96=events[_0x394107];var _0x37bbaf=createListener('user:'+_0x46ca96,_0x1b629f);UserEvents['on'](_0x46ca96,_0x37bbaf);}}; \ No newline at end of file +var _0x40bc=['register','length','user:','./user.events','save','update','emit','removeListener'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x40bc,0x153));var _0xc40b=function(_0x4502ec,_0x586393){_0x4502ec=_0x4502ec-0x0;var _0x36cf12=_0x40bc[_0x4502ec];return _0x36cf12;};'use strict';var UserEvents=require(_0xc40b('0x0'));var events=[_0xc40b('0x1'),'remove',_0xc40b('0x2')];function createListener(_0xd6ea13,_0x1dd0b9){return function(_0x323a5d){_0x1dd0b9[_0xc40b('0x3')](_0xd6ea13,_0x323a5d);};}function removeListener(_0x12ec33,_0x38f3ab){return function(){UserEvents[_0xc40b('0x4')](_0x12ec33,_0x38f3ab);};}exports[_0xc40b('0x5')]=function(_0x2bb4dd){for(var _0x46d2fc=0x0,_0x3c9062=events[_0xc40b('0x6')];_0x46d2fc<_0x3c9062;_0x46d2fc++){var _0x2b656b=events[_0x46d2fc];var _0x261838=createListener(_0xc40b('0x7')+_0x2b656b,_0x2bb4dd);UserEvents['on'](_0x2b656b,_0x261838);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d836e44..01cdc81 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(_0x1a71da,_0x56138a){var _0x5ca29d=function(_0x320d70){while(--_0x320d70){_0x1a71da['push'](_0x1a71da['shift']());}};_0x5ca29d(++_0x56138a);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b6e4b,_0x1cb37a){var _0x36f0a9=function(_0x4bf61c){while(--_0x4bf61c){_0x2b6e4b['push'](_0x2b6e4b['shift']());}};_0x36f0a9(++_0x1cb37a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ba0270b..171c0df 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 _0xdccf=['exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdccf,0x118));var _0xfdcc=function(_0x503cce,_0x1f5479){_0x503cce=_0x503cce-0x0;var _0x4ba2f5=_0xdccf[_0x503cce];return _0x4ba2f5;};'use strict';var Sequelize=require('sequelize');module[_0xfdcc('0x0')]={'penalty':{'type':Sequelize[_0xfdcc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe64b=['sequelize','INTEGER'];(function(_0x4789a4,_0x5b9016){var _0x2f2a51=function(_0x1de0c1){while(--_0x1de0c1){_0x4789a4['push'](_0x4789a4['shift']());}};_0x2f2a51(++_0x5b9016);}(_0xe64b,0xc4));var _0xbe64=function(_0x2bdb13,_0x3b6beb){_0x2bdb13=_0x2bdb13-0x0;var _0x162b92=_0xe64b[_0x2bdb13];return _0x162b92;};'use strict';var Sequelize=require(_0xbe64('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbe64('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index e5f08d0..cffab62 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 _0x5146=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues'];(function(_0x149989,_0x41684a){var _0x92453b=function(_0x22f566){while(--_0x22f566){_0x149989['push'](_0x149989['shift']());}};_0x92453b(++_0x41684a);}(_0x5146,0x120));var _0x6514=function(_0xfcabe5,_0x42e77f){_0xfcabe5=_0xfcabe5-0x0;var _0x4f9914=_0x5146[_0xfcabe5];return _0x4f9914;};'use strict';var _=require(_0x6514('0x0'));var util=require(_0x6514('0x1'));var logger=require(_0x6514('0x2'))(_0x6514('0x3'));var moment=require(_0x6514('0x4'));var BPromise=require('bluebird');var rp=require(_0x6514('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6514('0x6'));var config=require(_0x6514('0x7'));var attributes=require(_0x6514('0x8'));module[_0x6514('0x9')]=function(_0x240aa3,_0x6effeb){return _0x240aa3[_0x6514('0xa')]('UserChatQueue',attributes,{'tableName':_0x6514('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x122e=['rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x122e,0xc9));var _0xe122=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x122e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe122('0x0'));var util=require(_0xe122('0x1'));var logger=require(_0xe122('0x2'))(_0xe122('0x3'));var moment=require(_0xe122('0x4'));var BPromise=require(_0xe122('0x5'));var rp=require(_0xe122('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe122('0x7'));var config=require(_0xe122('0x8'));var attributes=require(_0xe122('0x9'));module[_0xe122('0xa')]=function(_0x4d46c5,_0x255cc0){return _0x4d46c5['define'](_0xe122('0xb'),attributes,{'tableName':_0xe122('0xc'),'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 0187d5a..4465926 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 _0xc205=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0xc205,0xb8));var _0x5c20=function(_0x13abc8,_0x589dd4){_0x13abc8=_0x13abc8-0x0;var _0x2566e3=_0xc205[_0x13abc8];return _0x2566e3;};'use strict';var _=require('lodash');var util=require(_0x5c20('0x0'));var moment=require(_0x5c20('0x1'));var BPromise=require(_0x5c20('0x2'));var rs=require(_0x5c20('0x3'));var fs=require('fs');var Redis=require(_0x5c20('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5c20('0x5'))(_0x5c20('0x6'));var config=require('../../config/environment');var jayson=require(_0x5c20('0x7'));var client=jayson[_0x5c20('0x8')][_0x5c20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a64e,_0x2e42fd,_0x159492){return new BPromise(function(_0x3ca467,_0x21e93){return client[_0x5c20('0xa')](_0x52a64e,_0x159492)[_0x5c20('0xb')](function(_0x5a5e2b){logger[_0x5c20('0xc')](_0x5c20('0xd'),_0x2e42fd,_0x5c20('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2e42fd,_0x5c20('0xe'),JSON[_0x5c20('0xf')](_0x5a5e2b));if(_0x5a5e2b[_0x5c20('0x10')]){if(_0x5a5e2b[_0x5c20('0x10')][_0x5c20('0x11')]===0x1f4){logger[_0x5c20('0x10')](_0x5c20('0xd'),_0x2e42fd,_0x5a5e2b[_0x5c20('0x10')][_0x5c20('0x12')]);return _0x21e93(_0x5a5e2b['error'][_0x5c20('0x12')]);}logger[_0x5c20('0x10')](_0x5c20('0xd'),_0x2e42fd,_0x5a5e2b['error'][_0x5c20('0x12')]);return _0x3ca467(_0x5a5e2b['error'][_0x5c20('0x12')]);}else{logger[_0x5c20('0xc')](_0x5c20('0xd'),_0x2e42fd,_0x5c20('0xe'));_0x3ca467(_0x5a5e2b[_0x5c20('0x13')][_0x5c20('0x12')]);}})[_0x5c20('0x14')](function(_0x4b0ec8){logger['error'](_0x5c20('0xd'),_0x2e42fd,_0x4b0ec8);_0x21e93(_0x4b0ec8);});});} \ No newline at end of file +var _0x2aac=['info','request\x20sent','debug','error','message','UserChatQueue,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2e60cc,_0x395c45){var _0x43ed87=function(_0x5c1eae){while(--_0x5c1eae){_0x2e60cc['push'](_0x2e60cc['shift']());}};_0x43ed87(++_0x395c45);}(_0x2aac,0x147));var _0xc2aa=function(_0x468232,_0x49d071){_0x468232=_0x468232-0x0;var _0x4d6c61=_0x2aac[_0x468232];return _0x4d6c61;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2aa('0x0'));var BPromise=require(_0xc2aa('0x1'));var rs=require(_0xc2aa('0x2'));var fs=require('fs');var Redis=require(_0xc2aa('0x3'));var db=require(_0xc2aa('0x4'))['db'];var utils=require(_0xc2aa('0x5'));var logger=require(_0xc2aa('0x6'))(_0xc2aa('0x7'));var config=require(_0xc2aa('0x8'));var jayson=require(_0xc2aa('0x9'));var client=jayson[_0xc2aa('0xa')][_0xc2aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe7b55,_0x447224,_0x49c846){return new BPromise(function(_0x1b7238,_0x48965f){return client[_0xc2aa('0xc')](_0xe7b55,_0x49c846)['then'](function(_0x4bf947){logger[_0xc2aa('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x447224,_0xc2aa('0xe'));logger[_0xc2aa('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x447224,_0xc2aa('0xe'),JSON['stringify'](_0x4bf947));if(_0x4bf947['error']){if(_0x4bf947[_0xc2aa('0x10')]['code']===0x1f4){logger[_0xc2aa('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x447224,_0x4bf947[_0xc2aa('0x10')]['message']);return _0x48965f(_0x4bf947[_0xc2aa('0x10')][_0xc2aa('0x11')]);}logger[_0xc2aa('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x447224,_0x4bf947['error']['message']);return _0x1b7238(_0x4bf947[_0xc2aa('0x10')]['message']);}else{logger[_0xc2aa('0xd')](_0xc2aa('0x12'),_0x447224,'request\x20sent');_0x1b7238(_0x4bf947[_0xc2aa('0x13')]['message']);}})['catch'](function(_0x221b6d){logger[_0xc2aa('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x447224,_0x221b6d);_0x48965f(_0x221b6d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0c9602f..78a3722 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4582a9,_0x52e47d){var _0x49c003=function(_0x2b228d){while(--_0x2b228d){_0x4582a9['push'](_0x4582a9['shift']());}};_0x49c003(++_0x52e47d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4679ed,_0x2c130f){var _0x54fe41=function(_0x3c6c26){while(--_0x3c6c26){_0x4679ed['push'](_0x4679ed['shift']());}};_0x54fe41(++_0x2c130f);}(_0x70e0,0x17b));var _0x070e=function(_0x88e956,_0x429b75){_0x88e956=_0x88e956-0x0;var _0x3f1f5e=_0x70e0[_0x88e956];return _0x3f1f5e;};'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 efa3bb5..2f5a46c 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 _0xfa98=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa98,0x165));var _0x8fa9=function(_0x520931,_0x242234){_0x520931=_0x520931-0x0;var _0x27f323=_0xfa98[_0x520931];return _0x27f323;};'use strict';var Sequelize=require(_0x8fa9('0x0'));module[_0x8fa9('0x1')]={'penalty':{'type':Sequelize[_0x8fa9('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8fa9('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9acd=['INTEGER','sequelize','exports'];(function(_0x1185f0,_0x2e0dae){var _0x11358f=function(_0x319d80){while(--_0x319d80){_0x1185f0['push'](_0x1185f0['shift']());}};_0x11358f(++_0x2e0dae);}(_0x9acd,0x1b1));var _0xd9ac=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9acd[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0xd9ac('0x0'));module[_0xd9ac('0x1')]={'penalty':{'type':Sequelize[_0xd9ac('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 44977f7..ce9493d 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 _0xe6ed=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','../../config/logger','api','moment','bluebird'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xe6ed,0x104));var _0xde6e=function(_0x2f2156,_0x222c85){_0x2f2156=_0x2f2156-0x0;var _0x3cacad=_0xe6ed[_0x2f2156];return _0x3cacad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xde6e('0x0'))(_0xde6e('0x1'));var moment=require(_0xde6e('0x2'));var BPromise=require(_0xde6e('0x3'));var rp=require(_0xde6e('0x4'));var fs=require('fs');var path=require(_0xde6e('0x5'));var rimraf=require(_0xde6e('0x6'));var config=require(_0xde6e('0x7'));var attributes=require(_0xde6e('0x8'));module['exports']=function(_0x46ad3d,_0x4e886e){return _0x46ad3d[_0xde6e('0x9')](_0xde6e('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb79f=['bluebird','path','rimraf','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x27eaa6,_0x43abcc){var _0xe0ae4b=function(_0x5c1f56){while(--_0x5c1f56){_0x27eaa6['push'](_0x27eaa6['shift']());}};_0xe0ae4b(++_0x43abcc);}(_0xb79f,0xeb));var _0xfb79=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0xb79f[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require(_0xfb79('0x0'));var util=require(_0xfb79('0x1'));var logger=require(_0xfb79('0x2'))(_0xfb79('0x3'));var moment=require(_0xfb79('0x4'));var BPromise=require(_0xfb79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb79('0x6'));var rimraf=require(_0xfb79('0x7'));var config=require(_0xfb79('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0xfb79('0x9')]=function(_0x1f1fc9,_0x1802cf){return _0x1f1fc9['define'](_0xfb79('0xa'),attributes,{'tableName':_0xfb79('0xb'),'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 6b5a82d..950f4a5 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 _0x8487=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x19a5d8,_0x347207){var _0x30104a=function(_0x292695){while(--_0x292695){_0x19a5d8['push'](_0x19a5d8['shift']());}};_0x30104a(++_0x347207);}(_0x8487,0x1a2));var _0x7848=function(_0x1b6830,_0x3bf1b2){_0x1b6830=_0x1b6830-0x0;var _0x1db629=_0x8487[_0x1b6830];return _0x1db629;};'use strict';var _=require(_0x7848('0x0'));var util=require(_0x7848('0x1'));var moment=require(_0x7848('0x2'));var BPromise=require(_0x7848('0x3'));var rs=require(_0x7848('0x4'));var fs=require('fs');var Redis=require(_0x7848('0x5'));var db=require(_0x7848('0x6'))['db'];var utils=require(_0x7848('0x7'));var logger=require('../../config/logger')(_0x7848('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7848('0x9')][_0x7848('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a2c7f,_0x15dcc0,_0x35350c){return new BPromise(function(_0x155c7e,_0x8c7cd6){return client[_0x7848('0xb')](_0x4a2c7f,_0x35350c)[_0x7848('0xc')](function(_0xe7596){logger[_0x7848('0xd')](_0x7848('0xe'),_0x15dcc0,_0x7848('0xf'));logger[_0x7848('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x15dcc0,_0x7848('0xf'),JSON[_0x7848('0x11')](_0xe7596));if(_0xe7596['error']){if(_0xe7596[_0x7848('0x12')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x15dcc0,_0xe7596[_0x7848('0x12')][_0x7848('0x13')]);return _0x8c7cd6(_0xe7596[_0x7848('0x12')]['message']);}logger['error'](_0x7848('0xe'),_0x15dcc0,_0xe7596['error'][_0x7848('0x13')]);return _0x155c7e(_0xe7596['error'][_0x7848('0x13')]);}else{logger[_0x7848('0xd')](_0x7848('0xe'),_0x15dcc0,'request\x20sent');_0x155c7e(_0xe7596[_0x7848('0x14')][_0x7848('0x13')]);}})['catch'](function(_0x22be03){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x15dcc0,_0x22be03);_0x8c7cd6(_0x22be03);});});} \ No newline at end of file +var _0xd00a=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4f6a8e,_0x2ca44b){var _0xdc60ce=function(_0x462c2b){while(--_0x462c2b){_0x4f6a8e['push'](_0x4f6a8e['shift']());}};_0xdc60ce(++_0x2ca44b);}(_0xd00a,0x112));var _0xad00=function(_0x283bec,_0x291a49){_0x283bec=_0x283bec-0x0;var _0x2f53f2=_0xd00a[_0x283bec];return _0x2f53f2;};'use strict';var _=require(_0xad00('0x0'));var util=require(_0xad00('0x1'));var moment=require(_0xad00('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad00('0x3'));var db=require(_0xad00('0x4'))['db'];var utils=require(_0xad00('0x5'));var logger=require(_0xad00('0x6'))(_0xad00('0x7'));var config=require(_0xad00('0x8'));var jayson=require(_0xad00('0x9'));var client=jayson['client'][_0xad00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21175a,_0x286d62,_0x24dccc){return new BPromise(function(_0x524c71,_0xc5bde4){return client['request'](_0x21175a,_0x24dccc)['then'](function(_0x42f79f){logger[_0xad00('0xb')](_0xad00('0xc'),_0x286d62,_0xad00('0xd'));logger[_0xad00('0xe')](_0xad00('0xf'),_0x286d62,_0xad00('0xd'),JSON['stringify'](_0x42f79f));if(_0x42f79f[_0xad00('0x10')]){if(_0x42f79f[_0xad00('0x10')][_0xad00('0x11')]===0x1f4){logger[_0xad00('0x10')](_0xad00('0xc'),_0x286d62,_0x42f79f[_0xad00('0x10')][_0xad00('0x12')]);return _0xc5bde4(_0x42f79f[_0xad00('0x10')]['message']);}logger[_0xad00('0x10')](_0xad00('0xc'),_0x286d62,_0x42f79f[_0xad00('0x10')][_0xad00('0x12')]);return _0x524c71(_0x42f79f[_0xad00('0x10')]['message']);}else{logger[_0xad00('0xb')](_0xad00('0xc'),_0x286d62,'request\x20sent');_0x524c71(_0x42f79f[_0xad00('0x13')][_0xad00('0x12')]);}})[_0xad00('0x14')](function(_0x5b3a95){logger[_0xad00('0x10')](_0xad00('0xc'),_0x286d62,_0x5b3a95);_0xc5bde4(_0x5b3a95);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e5d61c5..efe5bef 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xb1c204,_0xfea85c){var _0x499565=function(_0x466022){while(--_0x466022){_0xb1c204['push'](_0xb1c204['shift']());}};_0x499565(++_0xfea85c);}(_0xedd9,0xfc));var _0x9edd=function(_0x44af5f,_0x222091){_0x44af5f=_0x44af5f-0x0;var _0x19bf78=_0xedd9[_0x44af5f];return _0x19bf78;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4b2624,_0x279160){var _0x3eeadb=function(_0x4736d3){while(--_0x4736d3){_0x4b2624['push'](_0x4b2624['shift']());}};_0x3eeadb(++_0x279160);}(_0x70e0,0x17b));var _0x070e=function(_0x1d2f8c,_0x2925e3){_0x1d2f8c=_0x1d2f8c-0x0;var _0x1ef429=_0x70e0[_0x1d2f8c];return _0x1ef429;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index dc6934c..cd9420d 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 _0x1580=['INTEGER','exports'];(function(_0x15c5b8,_0x3b670f){var _0xd45fe6=function(_0x15a775){while(--_0x15a775){_0x15c5b8['push'](_0x15c5b8['shift']());}};_0xd45fe6(++_0x3b670f);}(_0x1580,0x6f));var _0x0158=function(_0x5967c7,_0x315747){_0x5967c7=_0x5967c7-0x0;var _0x247835=_0x1580[_0x5967c7];return _0x247835;};'use strict';var Sequelize=require('sequelize');module[_0x0158('0x0')]={'penalty':{'type':Sequelize[_0x0158('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x011c=['INTEGER','sequelize','exports'];(function(_0x55481c,_0x36715b){var _0x4c8bfb=function(_0x3b2d95){while(--_0x3b2d95){_0x55481c['push'](_0x55481c['shift']());}};_0x4c8bfb(++_0x36715b);}(_0x011c,0x8e));var _0xc011=function(_0x3c07f2,_0x1aed0d){_0x3c07f2=_0x3c07f2-0x0;var _0x1bc1a8=_0x011c[_0x3c07f2];return _0x1bc1a8;};'use strict';var Sequelize=require(_0xc011('0x0'));module[_0xc011('0x1')]={'penalty':{'type':Sequelize[_0xc011('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 a3dafcd..e5ecda2 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 _0x9d76=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','UserMailQueue','user_has_mail_queues','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d76,0x112));var _0x69d7=function(_0x1e4d1a,_0x42748e){_0x1e4d1a=_0x1e4d1a-0x0;var _0x5ee4c8=_0x9d76[_0x1e4d1a];return _0x5ee4c8;};'use strict';var _=require('lodash');var util=require(_0x69d7('0x0'));var logger=require(_0x69d7('0x1'))(_0x69d7('0x2'));var moment=require(_0x69d7('0x3'));var BPromise=require(_0x69d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69d7('0x5'));var rimraf=require(_0x69d7('0x6'));var config=require(_0x69d7('0x7'));var attributes=require(_0x69d7('0x8'));module['exports']=function(_0x552234,_0x165c79){return _0x552234['define'](_0x69d7('0x9'),attributes,{'tableName':_0x69d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f32=['./userMailQueue.attributes','user_has_mail_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x458fbd,_0x4feabc){var _0x758791=function(_0x413606){while(--_0x413606){_0x458fbd['push'](_0x458fbd['shift']());}};_0x758791(++_0x4feabc);}(_0x2f32,0x124));var _0x22f3=function(_0x3619a8,_0x287bf5){_0x3619a8=_0x3619a8-0x0;var _0x169b8e=_0x2f32[_0x3619a8];return _0x169b8e;};'use strict';var _=require(_0x22f3('0x0'));var util=require('util');var logger=require(_0x22f3('0x1'))('api');var moment=require(_0x22f3('0x2'));var BPromise=require(_0x22f3('0x3'));var rp=require(_0x22f3('0x4'));var fs=require('fs');var path=require(_0x22f3('0x5'));var rimraf=require(_0x22f3('0x6'));var config=require(_0x22f3('0x7'));var attributes=require(_0x22f3('0x8'));module['exports']=function(_0x2128f7,_0xf2ac9a){return _0x2128f7['define']('UserMailQueue',attributes,{'tableName':_0x22f3('0x9'),'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 4369257..1adc190 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x43d9f3,_0x3febcd){var _0x3083bb=function(_0x58f2f2){while(--_0x58f2f2){_0x43d9f3['push'](_0x43d9f3['shift']());}};_0x3083bb(++_0x3febcd);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34769d,_0x4691a6){var _0x35ddfa=function(_0x3cd3ab){while(--_0x3cd3ab){_0x34769d['push'](_0x34769d['shift']());}};_0x35ddfa(++_0x4691a6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x103762,_0x39d529){_0x103762=_0x103762-0x0;var _0x24844e=_0x7fbe[_0x103762];return _0x24844e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 31e3c22..8100d9b 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 _0xfd17=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfd17,0x117));var _0x7fd1=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xfd17[_0x2d3ab3];return _0x321f9e;};'use strict';var multer=require('multer');var util=require(_0x7fd1('0x0'));var path=require('path');var timeout=require(_0x7fd1('0x1'));var express=require('express');var router=express[_0x7fd1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7fd1('0x3'));var interaction=require(_0x7fd1('0x4'));var config=require(_0x7fd1('0x5'));var controller=require(_0x7fd1('0x6'));router['post']('/',auth[_0x7fd1('0x7')](),controller[_0x7fd1('0x8')]);module['exports']=router; \ No newline at end of file +var _0x2c62=['./userNotification.controller','post','isAuthenticated','sendUserNotification','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d38b3,_0x2e03a9){var _0x177894=function(_0x2c8cc1){while(--_0x2c8cc1){_0x5d38b3['push'](_0x5d38b3['shift']());}};_0x177894(++_0x2e03a9);}(_0x2c62,0x1d0));var _0x22c6=function(_0x12d336,_0x59b5d2){_0x12d336=_0x12d336-0x0;var _0x353dba=_0x2c62[_0x12d336];return _0x353dba;};'use strict';var multer=require('multer');var util=require(_0x22c6('0x0'));var path=require('path');var timeout=require(_0x22c6('0x1'));var express=require('express');var router=express[_0x22c6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x22c6('0x3'));var interaction=require(_0x22c6('0x4'));var config=require(_0x22c6('0x5'));var controller=require(_0x22c6('0x6'));router[_0x22c6('0x7')]('/',auth[_0x22c6('0x8')](),controller[_0x22c6('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 6c66392..6a472f3 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 _0xe17c=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x32be2c,_0x1bbef6){var _0x5a4e87=function(_0x344a1b){while(--_0x344a1b){_0x32be2c['push'](_0x32be2c['shift']());}};_0x5a4e87(++_0x1bbef6);}(_0xe17c,0x64));var _0xce17=function(_0x492d80,_0x33a971){_0x492d80=_0x492d80-0x0;var _0x345318=_0xe17c[_0x492d80];return _0x345318;};'use strict';var Sequelize=require(_0xce17('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xce17('0x1')]},'recipientsDescription':{'type':Sequelize[_0xce17('0x2')]},'beep':{'type':Sequelize[_0xce17('0x3')]}}; \ No newline at end of file +var _0x8af2=['exports','TEXT','BOOLEAN','sequelize'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8af2,0x1f3));var _0x28af=function(_0xf37ed0,_0x129488){_0xf37ed0=_0xf37ed0-0x0;var _0x41a958=_0x8af2[_0xf37ed0];return _0x41a958;};'use strict';var Sequelize=require(_0x28af('0x0'));module[_0x28af('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x28af('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x28af('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ca7d702..1d97514 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 _0x6198=['ids','includes','queue','replace','Queue','push','all','flatten','map','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/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','status','error','stack','name','send','hasOwnProperty','text','body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','findOne','html','render','startCase','toLowerCase','User','union'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x6198,0x14d));var _0x8619=function(_0x446a2b,_0x347d02){_0x446a2b=_0x446a2b-0x0;var _0x7e4101=_0x6198[_0x446a2b];return _0x7e4101;};'use strict';var emlformat=require(_0x8619('0x0'));var rimraf=require(_0x8619('0x1'));var zipdir=require(_0x8619('0x2'));var jsonpatch=require(_0x8619('0x3'));var rp=require(_0x8619('0x4'));var moment=require(_0x8619('0x5'));var BPromise=require(_0x8619('0x6'));var Mustache=require(_0x8619('0x7'));var util=require(_0x8619('0x8'));var path=require(_0x8619('0x9'));var sox=require(_0x8619('0xa'));var csv=require(_0x8619('0xb'));var ejs=require(_0x8619('0xc'));var fs=require('fs');var fs_extra=require(_0x8619('0xd'));var _=require(_0x8619('0xe'));var squel=require(_0x8619('0xf'));var crypto=require('crypto');var jsforce=require(_0x8619('0x10'));var deskjs=require(_0x8619('0x11'));var toCsv=require(_0x8619('0xb'));var querystring=require(_0x8619('0x12'));var Papa=require(_0x8619('0x13'));var Redis=require(_0x8619('0x14'));var authService=require(_0x8619('0x15'));var qs=require(_0x8619('0x16'));var as=require(_0x8619('0x17'));var hardwareService=require(_0x8619('0x18'));var logger=require(_0x8619('0x19'))(_0x8619('0x1a'));var utils=require(_0x8619('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x8619('0x1c'));var db=require('../../mysqldb')['db'];config[_0x8619('0x1d')]=_[_0x8619('0x1e')](config[_0x8619('0x1d')],{'host':_0x8619('0x1f'),'port':0x18eb});var socket=require(_0x8619('0x20'))(new Redis(config[_0x8619('0x1d')]));require(_0x8619('0x21'))[_0x8619('0x22')](socket);function respondWithStatusCode(_0x5ba65e,_0x423d5f){_0x423d5f=_0x423d5f||0xcc;return function(_0x8098c4){if(_0x8098c4){return _0x5ba65e[_0x8619('0x23')](_0x423d5f);}return _0x5ba65e['status'](_0x423d5f)[_0x8619('0x24')]();};}function respondWithResult(_0x24acfa,_0x2d84a5){_0x2d84a5=_0x2d84a5||0xc8;return function(_0x48c28e){if(_0x48c28e){return _0x24acfa['status'](_0x2d84a5)[_0x8619('0x25')](_0x48c28e);}};}function respondWithFilteredResult(_0x5cdaec,_0x21f3e8){return function(_0x5eca8e){if(_0x5eca8e){var _0x379939=typeof _0x21f3e8[_0x8619('0x26')]===_0x8619('0x27')&&typeof _0x21f3e8[_0x8619('0x28')]===_0x8619('0x27');var _0x3174e0=_0x5eca8e[_0x8619('0x29')];var _0x4727fa=_0x379939?0x0:_0x21f3e8['offset'];var _0x4964ec=_0x379939?_0x5eca8e[_0x8619('0x29')]:_0x21f3e8[_0x8619('0x26')]+_0x21f3e8[_0x8619('0x28')];var _0x17d29b;if(_0x4964ec>=_0x3174e0){_0x4964ec=_0x3174e0;_0x17d29b=0xc8;}else{_0x17d29b=0xce;}_0x5cdaec['status'](_0x17d29b);return _0x5cdaec[_0x8619('0x2a')]('Content-Range',_0x4727fa+'-'+_0x4964ec+'/'+_0x3174e0)[_0x8619('0x25')](_0x5eca8e);}return null;};}function patchUpdates(_0x1ecec3){return function(_0x176581){try{jsonpatch[_0x8619('0x2b')](_0x176581,_0x1ecec3,!![]);}catch(_0x49c918){return BPromise[_0x8619('0x2c')](_0x49c918);}return _0x176581[_0x8619('0x2d')]();};}function saveUpdates(_0x1f1cda,_0x483ea9){return function(_0x544ad5){if(_0x544ad5){return _0x544ad5[_0x8619('0x2e')](_0x1f1cda)[_0x8619('0x2f')](function(_0x45e9a2){return _0x45e9a2;});}return null;};}function removeEntity(_0x3c8476,_0x33e867){return function(_0x164fe7){if(_0x164fe7){return _0x164fe7[_0x8619('0x30')]()['then'](function(){_0x3c8476[_0x8619('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x347b7f,_0x1eea96){return function(_0x3f6e37){if(!_0x3f6e37){_0x347b7f[_0x8619('0x23')](0x194);}return _0x3f6e37;};}function handleError(_0x3fac7a,_0x2ef33a){_0x2ef33a=_0x2ef33a||0x1f4;return function(_0x2db8f1){logger[_0x8619('0x32')](_0x2db8f1[_0x8619('0x33')]);if(_0x2db8f1['name']){delete _0x2db8f1[_0x8619('0x34')];}_0x3fac7a[_0x8619('0x31')](_0x2ef33a)[_0x8619('0x35')](_0x2db8f1);};}exports['sendUserNotification']=function(_0x3d36cd,_0x590f7a,_0x410aa7){if(!_0x3d36cd['body'][_0x8619('0x36')](_0x8619('0x37'))&&!_0x3d36cd[_0x8619('0x38')][_0x8619('0x36')]('TemplateId')){throw new db[(_0x8619('0x39'))][(_0x8619('0x3a'))](_0x8619('0x3b'));}else{if(_0x3d36cd['body'][_0x8619('0x36')](_0x8619('0x3c'))&&!_0x3d36cd[_0x8619('0x38')]['hasOwnProperty'](_0x8619('0x3d'))){throw new db[(_0x8619('0x39'))]['ValidationError'](_0x8619('0x3e'));}if(!_0x3d36cd[_0x8619('0x38')][_0x8619('0x36')](_0x8619('0x3f'))){throw new db[(_0x8619('0x39'))][(_0x8619('0x3a'))](_0x8619('0x40'));}else{try{var _0x23125f=JSON['parse'](_0x3d36cd[_0x8619('0x38')]['recipients']);}catch(_0x3a311e){logger[_0x8619('0x32')](_0x3a311e);throw new db['Sequelize'][(_0x8619('0x3a'))](_0x8619('0x41'));}var _0x10d7f6=['chatqueue',_0x8619('0x42'),'mailqueue',_0x8619('0x43'),_0x8619('0x44'),_0x8619('0x45'),_0x8619('0x46'),_0x8619('0x47'),_0x8619('0x48')];if(_[_0x8619('0x49')](_0x23125f,function(_0x514403){return!_['includes'](_0x10d7f6,_0x514403[_0x8619('0x4a')]['toLowerCase']());})){throw new db['Sequelize'][(_0x8619('0x3a'))](_0x8619('0x4b'));}}}var _0x54428b={};_0x54428b['senderName']=_0x3d36cd[_0x8619('0x38')][_0x8619('0x36')](_0x8619('0x4c'))?_0x3d36cd['body']['senderName']:_0x3d36cd[_0x8619('0x48')][_0x8619('0x4d')];_0x54428b['recipientsDescription']=_['isEmpty'](_0x3d36cd['body'][_0x8619('0x4e')])?null:_0x3d36cd[_0x8619('0x38')][_0x8619('0x4e')];_0x54428b[_0x8619('0x4f')]=_0x3d36cd['body'][_0x8619('0x4f')]||![];_0x54428b[_0x8619('0x50')]=_0x3d36cd[_0x8619('0x48')]['id'];return getContent(_0x3d36cd[_0x8619('0x38')])['then'](function(_0x2a301a){_0x54428b[_0x8619('0x38')]=_0x2a301a;return getRecipients(_0x23125f);})['then'](function(_0x155ac1){_0x54428b[_0x8619('0x51')]=_['sortBy'](_0x155ac1)[_0x8619('0x52')](',');return db[_0x8619('0x53')][_0x8619('0x54')](function(_0x54dc43){return db[_0x8619('0x55')][_0x8619('0x56')](_0x54428b,{'raw':!![],'transaction':_0x54dc43})[_0x8619('0x2f')](function(_0x5df12f){var _0x3cc9b8={'sender':_0x54428b[_0x8619('0x4c')],'description':_0x54428b[_0x8619('0x4e')],'content':_0x54428b[_0x8619('0x38')],'beep':_0x54428b['beep']};_0x155ac1[_0x8619('0x57')](function(_0x56edd3){_0x3cc9b8[_0x8619('0x58')]=_0x56edd3;socket[_0x8619('0x59')](_0x8619('0x5a'),_0x3cc9b8);});return _0x5df12f;});});})['then'](respondWithResult(_0x590f7a,0xc9))[_0x8619('0x5b')](handleError(_0x590f7a,null));};function getContent(_0x176178){return new BPromise(function(_0x2639c1,_0x3011a9){if(_0x176178['text']){_0x2639c1(_0x176178[_0x8619('0x37')]);return;}return db['Template'][_0x8619('0x5c')]({'attributes':[_0x8619('0x5d')],'where':{'id':_0x176178['TemplateId']},'raw':!![]})[_0x8619('0x2f')](function(_0x40a6d1){if(!_0x40a6d1)throw new db[(_0x8619('0x39'))][(_0x8619('0x3a'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x45d892=Mustache[_0x8619('0x5e')](_0x40a6d1[_0x8619('0x5d')],_0x176178['view']);_0x2639c1(_0x45d892);})['catch'](function(_0x3a8364){_0x3011a9(_0x3a8364);});});}function getRecipients(_0x33f48b){return new BPromise(function(_0x437d81,_0x587399){var _0x2dbe16=[];var _0x40912f=[];_0x33f48b[_0x8619('0x57')](function(_0xb1cf8){var _0x27c48c=_[_0x8619('0x5f')](_0xb1cf8['model'][_0x8619('0x60')]());if(_0x27c48c===_0x8619('0x61')){_0x2dbe16=_[_0x8619('0x62')](_0x2dbe16,_0xb1cf8[_0x8619('0x63')]);}else{if(_[_0x8619('0x64')](_0x27c48c,_0x8619('0x65')))_0x27c48c=_0x27c48c[_0x8619('0x66')]('queue',_0x8619('0x67'));_0xb1cf8['ids'][_0x8619('0x57')](function(_0x3472ca){_0x40912f[_0x8619('0x68')](getAgents(_0x27c48c,_0x3472ca));});}});return BPromise[_0x8619('0x69')](_0x40912f)[_0x8619('0x2f')](function(_0x41b50a){_0x2dbe16=_[_0x8619('0x62')](_0x2dbe16,_[_0x8619('0x6a')](_0x41b50a));_0x437d81(_0x2dbe16);})['catch'](function(_0x47b9d4){_0x587399(_0x47b9d4);});});}function getAgents(_0x2125d1,_0x67373b){return new BPromise(function(_0x468ee1,_0xf73505){return db[_0x2125d1][_0x8619('0x5c')]({'where':{'id':_0x67373b}})[_0x8619('0x2f')](function(_0x5561a9){return _0x5561a9['getAgents']({'attributes':['id'],'raw':!![]})[_0x8619('0x2f')](function(_0x19cc19){var _0x288bd9=_[_0x8619('0x6b')](_0x19cc19,'id');_0x468ee1(_0x288bd9);});})[_0x8619('0x5b')](function(_0x24d4bb){_0xf73505(_0x24d4bb);});});} \ No newline at end of file +var _0x7927=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','Sequelize','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','emit','userNotification:send','catch'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x7927,0x1ac));var _0x7792=function(_0x1c3e07,_0x4d31a5){_0x1c3e07=_0x1c3e07-0x0;var _0x1defcb=_0x7927[_0x1c3e07];return _0x1defcb;};'use strict';var emlformat=require(_0x7792('0x0'));var rimraf=require(_0x7792('0x1'));var zipdir=require(_0x7792('0x2'));var jsonpatch=require(_0x7792('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7792('0x4'));var Mustache=require(_0x7792('0x5'));var util=require(_0x7792('0x6'));var path=require(_0x7792('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7792('0x8'));var fs=require('fs');var fs_extra=require(_0x7792('0x9'));var _=require(_0x7792('0xa'));var squel=require('squel');var crypto=require(_0x7792('0xb'));var jsforce=require(_0x7792('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7792('0xd'));var querystring=require(_0x7792('0xe'));var Papa=require(_0x7792('0xf'));var Redis=require(_0x7792('0x10'));var authService=require(_0x7792('0x11'));var qs=require(_0x7792('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7792('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7792('0x14'));var licenseUtil=require(_0x7792('0x15'));var db=require(_0x7792('0x16'))['db'];config[_0x7792('0x17')]=_[_0x7792('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7792('0x19'))(new Redis(config[_0x7792('0x17')]));require(_0x7792('0x1a'))['register'](socket);function respondWithStatusCode(_0x5a2a08,_0x126f00){_0x126f00=_0x126f00||0xcc;return function(_0x230f55){if(_0x230f55){return _0x5a2a08[_0x7792('0x1b')](_0x126f00);}return _0x5a2a08[_0x7792('0x1c')](_0x126f00)[_0x7792('0x1d')]();};}function respondWithResult(_0x4b36c8,_0x4cb31d){_0x4cb31d=_0x4cb31d||0xc8;return function(_0x5e1521){if(_0x5e1521){return _0x4b36c8[_0x7792('0x1c')](_0x4cb31d)['json'](_0x5e1521);}};}function respondWithFilteredResult(_0x187c50,_0x5e489a){return function(_0xb3e572){if(_0xb3e572){var _0x77b54a=typeof _0x5e489a['offset']===_0x7792('0x1e')&&typeof _0x5e489a[_0x7792('0x1f')]===_0x7792('0x1e');var _0x69db4b=_0xb3e572[_0x7792('0x20')];var _0x5b8257=_0x77b54a?0x0:_0x5e489a[_0x7792('0x21')];var _0x35f68b=_0x77b54a?_0xb3e572[_0x7792('0x20')]:_0x5e489a[_0x7792('0x21')]+_0x5e489a[_0x7792('0x1f')];var _0x5ae313;if(_0x35f68b>=_0x69db4b){_0x35f68b=_0x69db4b;_0x5ae313=0xc8;}else{_0x5ae313=0xce;}_0x187c50[_0x7792('0x1c')](_0x5ae313);return _0x187c50[_0x7792('0x22')](_0x7792('0x23'),_0x5b8257+'-'+_0x35f68b+'/'+_0x69db4b)[_0x7792('0x24')](_0xb3e572);}return null;};}function patchUpdates(_0x4e3453){return function(_0x40ae87){try{jsonpatch[_0x7792('0x25')](_0x40ae87,_0x4e3453,!![]);}catch(_0x80be18){return BPromise[_0x7792('0x26')](_0x80be18);}return _0x40ae87[_0x7792('0x27')]();};}function saveUpdates(_0x4004cf,_0x22f4f2){return function(_0x45f317){if(_0x45f317){return _0x45f317[_0x7792('0x28')](_0x4004cf)[_0x7792('0x29')](function(_0x52b12){return _0x52b12;});}return null;};}function removeEntity(_0x45d608,_0x4f5ecf){return function(_0x461a9f){if(_0x461a9f){return _0x461a9f[_0x7792('0x2a')]()[_0x7792('0x29')](function(){_0x45d608['status'](0xcc)[_0x7792('0x1d')]();});}};}function handleEntityNotFound(_0x1f69be,_0x3cbe9e){return function(_0x222fbd){if(!_0x222fbd){_0x1f69be[_0x7792('0x1b')](0x194);}return _0x222fbd;};}function handleError(_0x1c7ff6,_0x447b67){_0x447b67=_0x447b67||0x1f4;return function(_0x35a97d){logger[_0x7792('0x2b')](_0x35a97d[_0x7792('0x2c')]);if(_0x35a97d[_0x7792('0x2d')]){delete _0x35a97d['name'];}_0x1c7ff6['status'](_0x447b67)[_0x7792('0x2e')](_0x35a97d);};}exports[_0x7792('0x2f')]=function(_0x483d9b,_0x2f2c72,_0x3f5aa8){if(!_0x483d9b[_0x7792('0x30')][_0x7792('0x31')](_0x7792('0x32'))&&!_0x483d9b[_0x7792('0x30')][_0x7792('0x31')](_0x7792('0x33'))){throw new db['Sequelize'][(_0x7792('0x34'))](_0x7792('0x35'));}else{if(_0x483d9b[_0x7792('0x30')][_0x7792('0x31')]('TemplateId')&&!_0x483d9b[_0x7792('0x30')]['hasOwnProperty']('view')){throw new db['Sequelize']['ValidationError'](_0x7792('0x36'));}if(!_0x483d9b[_0x7792('0x30')]['hasOwnProperty']('recipients')){throw new db[(_0x7792('0x37'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x431330=JSON[_0x7792('0x38')](_0x483d9b['body'][_0x7792('0x39')]);}catch(_0x2aafc1){logger[_0x7792('0x2b')](_0x2aafc1);throw new db[(_0x7792('0x37'))][(_0x7792('0x34'))](_0x7792('0x3a'));}var _0x5123d2=[_0x7792('0x3b'),_0x7792('0x3c'),_0x7792('0x3d'),_0x7792('0x3e'),'smsqueue',_0x7792('0x3f'),_0x7792('0x40'),'team',_0x7792('0x41')];if(_[_0x7792('0x42')](_0x431330,function(_0x288098){return!_[_0x7792('0x43')](_0x5123d2,_0x288098[_0x7792('0x44')][_0x7792('0x45')]());})){throw new db[(_0x7792('0x37'))][(_0x7792('0x34'))](_0x7792('0x46'));}}}var _0x279616={};_0x279616[_0x7792('0x47')]=_0x483d9b['body'][_0x7792('0x31')](_0x7792('0x47'))?_0x483d9b['body']['senderName']:_0x483d9b['user'][_0x7792('0x48')];_0x279616[_0x7792('0x49')]=_[_0x7792('0x4a')](_0x483d9b['body'][_0x7792('0x49')])?null:_0x483d9b[_0x7792('0x30')][_0x7792('0x49')];_0x279616[_0x7792('0x4b')]=_0x483d9b[_0x7792('0x30')]['beep']||![];_0x279616[_0x7792('0x4c')]=_0x483d9b['user']['id'];return getContent(_0x483d9b[_0x7792('0x30')])[_0x7792('0x29')](function(_0x5231a8){_0x279616[_0x7792('0x30')]=_0x5231a8;return getRecipients(_0x431330);})['then'](function(_0x49ff9b){_0x279616[_0x7792('0x4d')]=_[_0x7792('0x4e')](_0x49ff9b)[_0x7792('0x4f')](',');return db[_0x7792('0x50')]['transaction'](function(_0xd55ad0){return db[_0x7792('0x51')][_0x7792('0x52')](_0x279616,{'raw':!![],'transaction':_0xd55ad0})['then'](function(_0xf1dcd){var _0x2dc82a={'sender':_0x279616[_0x7792('0x47')],'description':_0x279616['recipientsDescription'],'content':_0x279616['body'],'beep':_0x279616['beep']};_0x49ff9b[_0x7792('0x53')](function(_0x4cd80c){_0x2dc82a['recipient']=_0x4cd80c;socket[_0x7792('0x54')](_0x7792('0x55'),_0x2dc82a);});return _0xf1dcd;});});})[_0x7792('0x29')](respondWithResult(_0x2f2c72,0xc9))[_0x7792('0x56')](handleError(_0x2f2c72,null));};function getContent(_0x224ee9){return new BPromise(function(_0x207dc6,_0x36ba30){if(_0x224ee9['text']){_0x207dc6(_0x224ee9['text']);return;}return db['Template'][_0x7792('0x57')]({'attributes':[_0x7792('0x58')],'where':{'id':_0x224ee9['TemplateId']},'raw':!![]})[_0x7792('0x29')](function(_0x1303c5){if(!_0x1303c5)throw new db[(_0x7792('0x37'))]['ValidationError'](_0x7792('0x59'));var _0x11e63d=Mustache[_0x7792('0x5a')](_0x1303c5[_0x7792('0x58')],_0x224ee9[_0x7792('0x5b')]);_0x207dc6(_0x11e63d);})['catch'](function(_0x12f55d){_0x36ba30(_0x12f55d);});});}function getRecipients(_0x17b2ad){return new BPromise(function(_0x1f2fd6,_0x43f274){var _0x470b4d=[];var _0xd062ea=[];_0x17b2ad[_0x7792('0x53')](function(_0x329d83){var _0x3a2b5e=_[_0x7792('0x5c')](_0x329d83[_0x7792('0x44')]['toLowerCase']());if(_0x3a2b5e===_0x7792('0x5d')){_0x470b4d=_[_0x7792('0x5e')](_0x470b4d,_0x329d83[_0x7792('0x5f')]);}else{if(_[_0x7792('0x43')](_0x3a2b5e,_0x7792('0x60')))_0x3a2b5e=_0x3a2b5e[_0x7792('0x61')](_0x7792('0x60'),_0x7792('0x62'));_0x329d83[_0x7792('0x5f')][_0x7792('0x53')](function(_0x31b650){_0xd062ea[_0x7792('0x63')](getAgents(_0x3a2b5e,_0x31b650));});}});return BPromise[_0x7792('0x64')](_0xd062ea)[_0x7792('0x29')](function(_0x5dcc03){_0x470b4d=_[_0x7792('0x5e')](_0x470b4d,_[_0x7792('0x65')](_0x5dcc03));_0x1f2fd6(_0x470b4d);})[_0x7792('0x56')](function(_0x3b96ad){_0x43f274(_0x3b96ad);});});}function getAgents(_0x278bf0,_0x3d3bc9){return new BPromise(function(_0x31f1f5,_0x55418a){return db[_0x278bf0][_0x7792('0x57')]({'where':{'id':_0x3d3bc9}})[_0x7792('0x29')](function(_0x330121){return _0x330121['getAgents']({'attributes':['id'],'raw':!![]})[_0x7792('0x29')](function(_0x460e6c){var _0x3ec8f5=_[_0x7792('0x66')](_0x460e6c,'id');_0x31f1f5(_0x3ec8f5);});})[_0x7792('0x56')](function(_0x52a5f7){_0x55418a(_0x52a5f7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 80c175f..a659348 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 _0xb9fc=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x7370b0,_0x4ee350){var _0x351cdc=function(_0x225c7a){while(--_0x225c7a){_0x7370b0['push'](_0x7370b0['shift']());}};_0x351cdc(++_0x4ee350);}(_0xb9fc,0x1ef));var _0xcb9f=function(_0x1c9dec,_0x4585bd){_0x1c9dec=_0x1c9dec-0x0;var _0x2bc1eb=_0xb9fc[_0x1c9dec];return _0x2bc1eb;};'use strict';var EventEmitter=require(_0xcb9f('0x0'));var UserNotification=require(_0xcb9f('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xcb9f('0x2')](0x0);var events={'afterCreate':_0xcb9f('0x3'),'afterUpdate':_0xcb9f('0x4'),'afterDestroy':_0xcb9f('0x5')};function emitEvent(_0x18e693){return function(_0x4e7444,_0x3e654e,_0x21aa94){UserNotificationEvents[_0xcb9f('0x6')](_0x18e693+':'+_0x4e7444['id'],_0x4e7444);UserNotificationEvents['emit'](_0x18e693,_0x4e7444);_0x21aa94(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xcb9f('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xa07d=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xa07d,0xbe));var _0xda07=function(_0x557d81,_0x2a6677){_0x557d81=_0x557d81-0x0;var _0x13fb9c=_0xa07d[_0x557d81];return _0x13fb9c;};'use strict';var EventEmitter=require(_0xda07('0x0'));var UserNotification=require(_0xda07('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xda07('0x2')](0x0);var events={'afterCreate':_0xda07('0x3'),'afterUpdate':_0xda07('0x4'),'afterDestroy':_0xda07('0x5')};function emitEvent(_0x4a1bcb){return function(_0x12fff8,_0x15752d,_0x4e0ce4){UserNotificationEvents['emit'](_0x4a1bcb+':'+_0x12fff8['id'],_0x12fff8);UserNotificationEvents['emit'](_0x4a1bcb,_0x12fff8);_0x4e0ce4(null);};}for(var e in events){if(events[_0xda07('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index c34063b..477a781 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 _0xff8a=['exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x40e2b8,_0x3990e7){var _0x496c3a=function(_0x2bfd5f){while(--_0x2bfd5f){_0x40e2b8['push'](_0x40e2b8['shift']());}};_0x496c3a(++_0x3990e7);}(_0xff8a,0x17f));var _0xaff8=function(_0x3ba42b,_0x1663ed){_0x3ba42b=_0x3ba42b-0x0;var _0x5645c2=_0xff8a[_0x3ba42b];return _0x5645c2;};'use strict';var _=require('lodash');var util=require(_0xaff8('0x0'));var logger=require(_0xaff8('0x1'))(_0xaff8('0x2'));var moment=require(_0xaff8('0x3'));var BPromise=require('bluebird');var rp=require(_0xaff8('0x4'));var fs=require('fs');var path=require(_0xaff8('0x5'));var rimraf=require(_0xaff8('0x6'));var config=require(_0xaff8('0x7'));var attributes=require(_0xaff8('0x8'));module[_0xaff8('0x9')]=function(_0xee8e7e,_0x276268){return _0xee8e7e[_0xaff8('0xa')](_0xaff8('0xb'),attributes,{'tableName':_0xaff8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaff8('0xd')});}; \ No newline at end of file +var _0x06ee=['exports','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x56ec0d,_0x559db2){var _0x20981a=function(_0x5bb654){while(--_0x5bb654){_0x56ec0d['push'](_0x56ec0d['shift']());}};_0x20981a(++_0x559db2);}(_0x06ee,0x117));var _0xe06e=function(_0x190ace,_0x4b4a28){_0x190ace=_0x190ace-0x0;var _0x230d43=_0x06ee[_0x190ace];return _0x230d43;};'use strict';var _=require(_0xe06e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe06e('0x1'));var moment=require(_0xe06e('0x2'));var BPromise=require(_0xe06e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe06e('0x4'));var config=require(_0xe06e('0x5'));var attributes=require(_0xe06e('0x6'));module[_0xe06e('0x7')]=function(_0x336561,_0x445753){return _0x336561['define']('UserNotification',attributes,{'tableName':_0xe06e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe06e('0x9'),'collate':_0xe06e('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 693fe0d..13e607c 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 _0x956b=['./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x10b579,_0x329f13){var _0x5b4b7c=function(_0x4298d8){while(--_0x4298d8){_0x10b579['push'](_0x10b579['shift']());}};_0x5b4b7c(++_0x329f13);}(_0x956b,0xdd));var _0xb956=function(_0x4257e1,_0xb34aac){_0x4257e1=_0x4257e1-0x0;var _0x2f0329=_0x956b[_0x4257e1];return _0x2f0329;};'use strict';var _=require('lodash');var util=require(_0xb956('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb956('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb956('0x2'))['db'];var utils=require(_0xb956('0x3'));var logger=require(_0xb956('0x4'))(_0xb956('0x5'));var config=require(_0xb956('0x6'));var jayson=require(_0xb956('0x7'));var client=jayson[_0xb956('0x8')][_0xb956('0x9')]({'port':0x232a});config[_0xb956('0xa')]=_[_0xb956('0xb')](config[_0xb956('0xa')],{'host':_0xb956('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb956('0xd'))[_0xb956('0xe')](socket);function respondWithRpcPromise(_0x146088,_0x45f896,_0x106340){return new BPromise(function(_0x36931f,_0x45aee3){return client[_0xb956('0xf')](_0x146088,_0x106340)[_0xb956('0x10')](function(_0xfb5569){logger[_0xb956('0x11')](_0xb956('0x12'),_0x45f896,'request\x20sent');logger['debug'](_0xb956('0x13'),_0x45f896,_0xb956('0x14'),JSON[_0xb956('0x15')](_0xfb5569));if(_0xfb5569[_0xb956('0x16')]){if(_0xfb5569[_0xb956('0x16')][_0xb956('0x17')]===0x1f4){logger[_0xb956('0x16')](_0xb956('0x12'),_0x45f896,_0xfb5569[_0xb956('0x16')][_0xb956('0x18')]);return _0x45aee3(_0xfb5569[_0xb956('0x16')][_0xb956('0x18')]);}logger[_0xb956('0x16')]('UserNotification,\x20%s,\x20%s',_0x45f896,_0xfb5569[_0xb956('0x16')][_0xb956('0x18')]);return _0x36931f(_0xfb5569['error'][_0xb956('0x18')]);}else{logger[_0xb956('0x11')](_0xb956('0x12'),_0x45f896,_0xb956('0x14'));_0x36931f(_0xfb5569['result'][_0xb956('0x18')]);}})[_0xb956('0x19')](function(_0x575e05){logger[_0xb956('0x16')](_0xb956('0x12'),_0x45f896,_0x575e05);_0x45aee3(_0x575e05);});});} \ No newline at end of file +var _0x07a6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x07a6,0x127));var _0x607a=function(_0x522050,_0x51a520){_0x522050=_0x522050-0x0;var _0x50e3c5=_0x07a6[_0x522050];return _0x50e3c5;};'use strict';var _=require('lodash');var util=require(_0x607a('0x0'));var moment=require('moment');var BPromise=require(_0x607a('0x1'));var rs=require(_0x607a('0x2'));var fs=require('fs');var Redis=require(_0x607a('0x3'));var db=require(_0x607a('0x4'))['db'];var utils=require(_0x607a('0x5'));var logger=require(_0x607a('0x6'))(_0x607a('0x7'));var config=require(_0x607a('0x8'));var jayson=require(_0x607a('0x9'));var client=jayson[_0x607a('0xa')][_0x607a('0xb')]({'port':0x232a});config[_0x607a('0xc')]=_[_0x607a('0xd')](config[_0x607a('0xc')],{'host':_0x607a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x607a('0xc')]));require(_0x607a('0xf'))[_0x607a('0x10')](socket);function respondWithRpcPromise(_0x20eb69,_0x1cb99b,_0x578096){return new BPromise(function(_0x3acb70,_0x860a06){return client[_0x607a('0x11')](_0x20eb69,_0x578096)[_0x607a('0x12')](function(_0x55b066){logger[_0x607a('0x13')](_0x607a('0x14'),_0x1cb99b,_0x607a('0x15'));logger[_0x607a('0x16')](_0x607a('0x17'),_0x1cb99b,_0x607a('0x15'),JSON[_0x607a('0x18')](_0x55b066));if(_0x55b066['error']){if(_0x55b066['error'][_0x607a('0x19')]===0x1f4){logger[_0x607a('0x1a')](_0x607a('0x14'),_0x1cb99b,_0x55b066[_0x607a('0x1a')][_0x607a('0x1b')]);return _0x860a06(_0x55b066[_0x607a('0x1a')]['message']);}logger[_0x607a('0x1a')](_0x607a('0x14'),_0x1cb99b,_0x55b066['error'][_0x607a('0x1b')]);return _0x3acb70(_0x55b066['error'][_0x607a('0x1b')]);}else{logger['info'](_0x607a('0x14'),_0x1cb99b,_0x607a('0x15'));_0x3acb70(_0x55b066[_0x607a('0x1c')][_0x607a('0x1b')]);}})[_0x607a('0x1d')](function(_0x190f9a){logger['error'](_0x607a('0x14'),_0x1cb99b,_0x190f9a);_0x860a06(_0x190f9a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8d5915a..a36f56d 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 _0x8357=['save','remove','update','emit','removeListener','userNotification:','./userNotification.events'];(function(_0x47169b,_0x5267b3){var _0x56e7bc=function(_0x32fcd3){while(--_0x32fcd3){_0x47169b['push'](_0x47169b['shift']());}};_0x56e7bc(++_0x5267b3);}(_0x8357,0xe6));var _0x7835=function(_0x58f91b,_0x2ce1f8){_0x58f91b=_0x58f91b-0x0;var _0x348c4a=_0x8357[_0x58f91b];return _0x348c4a;};'use strict';var UserNotificationEvents=require(_0x7835('0x0'));var events=[_0x7835('0x1'),_0x7835('0x2'),_0x7835('0x3')];function createListener(_0x28c41b,_0x49c485){return function(_0x1273e5){_0x49c485[_0x7835('0x4')](_0x28c41b,_0x1273e5);};}function removeListener(_0x132fd8,_0x3321f3){return function(){UserNotificationEvents[_0x7835('0x5')](_0x132fd8,_0x3321f3);};}exports['register']=function(_0xb449c){for(var _0x4f7568=0x0,_0x7993a6=events['length'];_0x4f7568<_0x7993a6;_0x4f7568++){var _0x2283ea=events[_0x4f7568];var _0x58d9d7=createListener(_0x7835('0x6')+_0x2283ea,_0xb449c);UserNotificationEvents['on'](_0x2283ea,_0x58d9d7);}}; \ No newline at end of file +var _0xf1a8=['removeListener','length','userNotification:','./userNotification.events','remove','update','emit'];(function(_0x1ec836,_0x1ce2d6){var _0x4baf71=function(_0x5b640e){while(--_0x5b640e){_0x1ec836['push'](_0x1ec836['shift']());}};_0x4baf71(++_0x1ce2d6);}(_0xf1a8,0x1ed));var _0x8f1a=function(_0x429328,_0x2f5059){_0x429328=_0x429328-0x0;var _0x1b3886=_0xf1a8[_0x429328];return _0x1b3886;};'use strict';var UserNotificationEvents=require(_0x8f1a('0x0'));var events=['save',_0x8f1a('0x1'),_0x8f1a('0x2')];function createListener(_0x2f6ba6,_0x482b65){return function(_0x1b5f14){_0x482b65[_0x8f1a('0x3')](_0x2f6ba6,_0x1b5f14);};}function removeListener(_0x517a54,_0xc7e8ab){return function(){UserNotificationEvents[_0x8f1a('0x4')](_0x517a54,_0xc7e8ab);};}exports['register']=function(_0x5bc6a9){for(var _0x1d23f2=0x0,_0x3e8d30=events[_0x8f1a('0x5')];_0x1d23f2<_0x3e8d30;_0x1d23f2++){var _0x2c4f00=events[_0x1d23f2];var _0x3a825f=createListener(_0x8f1a('0x6')+_0x2c4f00,_0x5bc6a9);UserNotificationEvents['on'](_0x2c4f00,_0x3a825f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 42e0ad2..4763f9c 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x238b73,_0x5df76f){var _0x5966d9=function(_0x57802d){while(--_0x57802d){_0x238b73['push'](_0x238b73['shift']());}};_0x5966d9(++_0x5df76f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x21ab1b,_0x3ba991){var _0x63f5d7=function(_0x59188c){while(--_0x59188c){_0x21ab1b['push'](_0x21ab1b['shift']());}};_0x63f5d7(++_0x3ba991);}(_0x70e0,0x17b));var _0x070e=function(_0x5bc343,_0x4c7403){_0x5bc343=_0x5bc343-0x0;var _0x4c313d=_0x70e0[_0x5bc343];return _0x4c313d;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 7066c42..c7626c4 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 _0x41bd=['exports','sequelize'];(function(_0x465f09,_0x34e226){var _0x3b601d=function(_0x345b9f){while(--_0x345b9f){_0x465f09['push'](_0x465f09['shift']());}};_0x3b601d(++_0x34e226);}(_0x41bd,0xe5));var _0xd41b=function(_0x18af79,_0x80a733){_0x18af79=_0x18af79-0x0;var _0x118d75=_0x41bd[_0x18af79];return _0x118d75;};'use strict';var Sequelize=require(_0xd41b('0x0'));module[_0xd41b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x63b1=['sequelize','exports','INTEGER'];(function(_0x3dcaca,_0x4d8c05){var _0x321c44=function(_0x5f41ee){while(--_0x5f41ee){_0x3dcaca['push'](_0x3dcaca['shift']());}};_0x321c44(++_0x4d8c05);}(_0x63b1,0x96));var _0x163b=function(_0x1a577f,_0x22af63){_0x1a577f=_0x1a577f-0x0;var _0x21317d=_0x63b1[_0x1a577f];return _0x21317d;};'use strict';var Sequelize=require(_0x163b('0x0'));module[_0x163b('0x1')]={'penalty':{'type':Sequelize[_0x163b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index a020e27..834419a 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 _0x56fe=['define','lodash','util','../../config/logger','api','moment','bluebird','path','./userOpenchannelQueue.attributes','exports'];(function(_0x9909b1,_0x2cdef6){var _0x5757e2=function(_0x4fd899){while(--_0x4fd899){_0x9909b1['push'](_0x9909b1['shift']());}};_0x5757e2(++_0x2cdef6);}(_0x56fe,0xbf));var _0xe56f=function(_0x3c6607,_0x203e09){_0x3c6607=_0x3c6607-0x0;var _0x5c4529=_0x56fe[_0x3c6607];return _0x5c4529;};'use strict';var _=require(_0xe56f('0x0'));var util=require(_0xe56f('0x1'));var logger=require(_0xe56f('0x2'))(_0xe56f('0x3'));var moment=require(_0xe56f('0x4'));var BPromise=require(_0xe56f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe56f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe56f('0x7'));module[_0xe56f('0x8')]=function(_0x2736bb,_0x36dc37){return _0x2736bb[_0xe56f('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe763=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe763,0x14f));var _0x3e76=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xe763[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require(_0x3e76('0x0'));var util=require(_0x3e76('0x1'));var logger=require(_0x3e76('0x2'))('api');var moment=require(_0x3e76('0x3'));var BPromise=require(_0x3e76('0x4'));var rp=require(_0x3e76('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e76('0x6'));var config=require(_0x3e76('0x7'));var attributes=require(_0x3e76('0x8'));module['exports']=function(_0x17bafd,_0x2af184){return _0x17bafd[_0x3e76('0x9')](_0x3e76('0xa'),attributes,{'tableName':_0x3e76('0xb'),'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 6e8b00f..6d5719d 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 _0x65a5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x1eaa7f,_0x2a4568){var _0x1e3a07=function(_0x42c6a4){while(--_0x42c6a4){_0x1eaa7f['push'](_0x1eaa7f['shift']());}};_0x1e3a07(++_0x2a4568);}(_0x65a5,0x175));var _0x565a=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0x65a5[_0x456032];return _0x1a53cd;};'use strict';var _=require(_0x565a('0x0'));var util=require(_0x565a('0x1'));var moment=require('moment');var BPromise=require(_0x565a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x565a('0x3'));var db=require(_0x565a('0x4'))['db'];var utils=require(_0x565a('0x5'));var logger=require(_0x565a('0x6'))('rpc');var config=require(_0x565a('0x7'));var jayson=require(_0x565a('0x8'));var client=jayson[_0x565a('0x9')][_0x565a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x206df1,_0x5e01d1,_0x31e41d){return new BPromise(function(_0x42f7d8,_0x210af0){return client['request'](_0x206df1,_0x31e41d)[_0x565a('0xb')](function(_0x32564c){logger[_0x565a('0xc')](_0x565a('0xd'),_0x5e01d1,_0x565a('0xe'));logger[_0x565a('0xf')](_0x565a('0x10'),_0x5e01d1,'request\x20sent',JSON[_0x565a('0x11')](_0x32564c));if(_0x32564c[_0x565a('0x12')]){if(_0x32564c[_0x565a('0x12')][_0x565a('0x13')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5e01d1,_0x32564c['error']['message']);return _0x210af0(_0x32564c[_0x565a('0x12')]['message']);}logger[_0x565a('0x12')](_0x565a('0xd'),_0x5e01d1,_0x32564c['error']['message']);return _0x42f7d8(_0x32564c[_0x565a('0x12')][_0x565a('0x14')]);}else{logger[_0x565a('0xc')](_0x565a('0xd'),_0x5e01d1,_0x565a('0xe'));_0x42f7d8(_0x32564c['result'][_0x565a('0x14')]);}})['catch'](function(_0x454e82){logger['error'](_0x565a('0xd'),_0x5e01d1,_0x454e82);_0x210af0(_0x454e82);});});} \ No newline at end of file +var _0x865c=['error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x194ae9,_0x3c6e37){var _0x594efb=function(_0x51460b){while(--_0x51460b){_0x194ae9['push'](_0x194ae9['shift']());}};_0x594efb(++_0x3c6e37);}(_0x865c,0xd4));var _0xc865=function(_0x571679,_0x526921){_0x571679=_0x571679-0x0;var _0x5ccad8=_0x865c[_0x571679];return _0x5ccad8;};'use strict';var _=require('lodash');var util=require(_0xc865('0x0'));var moment=require(_0xc865('0x1'));var BPromise=require(_0xc865('0x2'));var rs=require(_0xc865('0x3'));var fs=require('fs');var Redis=require(_0xc865('0x4'));var db=require(_0xc865('0x5'))['db'];var utils=require(_0xc865('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc865('0x7'));var jayson=require(_0xc865('0x8'));var client=jayson[_0xc865('0x9')][_0xc865('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597eac,_0x26f0cf,_0x23337d){return new BPromise(function(_0x462117,_0x53fe56){return client[_0xc865('0xb')](_0x597eac,_0x23337d)[_0xc865('0xc')](function(_0x32df83){logger['info'](_0xc865('0xd'),_0x26f0cf,_0xc865('0xe'));logger[_0xc865('0xf')](_0xc865('0x10'),_0x26f0cf,'request\x20sent',JSON[_0xc865('0x11')](_0x32df83));if(_0x32df83[_0xc865('0x12')]){if(_0x32df83[_0xc865('0x12')][_0xc865('0x13')]===0x1f4){logger[_0xc865('0x12')](_0xc865('0xd'),_0x26f0cf,_0x32df83[_0xc865('0x12')][_0xc865('0x14')]);return _0x53fe56(_0x32df83[_0xc865('0x12')][_0xc865('0x14')]);}logger[_0xc865('0x12')](_0xc865('0xd'),_0x26f0cf,_0x32df83['error'][_0xc865('0x14')]);return _0x462117(_0x32df83[_0xc865('0x12')][_0xc865('0x14')]);}else{logger[_0xc865('0x15')](_0xc865('0xd'),_0x26f0cf,'request\x20sent');_0x462117(_0x32df83['result'][_0xc865('0x14')]);}})[_0xc865('0x16')](function(_0x4e346e){logger[_0xc865('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x26f0cf,_0x4e346e);_0x53fe56(_0x4e346e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8e50e0a..e77cc7f 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 _0x1155=['./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','create','post','clone','addSections','addResources','put','update','delete','destroy','removeSections','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x36bc91,_0x1e772b){var _0x4cb707=function(_0x3d8c00){while(--_0x3d8c00){_0x36bc91['push'](_0x36bc91['shift']());}};_0x4cb707(++_0x1e772b);}(_0x1155,0xf5));var _0x5115=function(_0x4f662a,_0x53efbd){_0x4f662a=_0x4f662a-0x0;var _0x1aa4d9=_0x1155[_0x4f662a];return _0x1aa4d9;};'use strict';var multer=require(_0x5115('0x0'));var util=require(_0x5115('0x1'));var path=require(_0x5115('0x2'));var timeout=require('connect-timeout');var express=require(_0x5115('0x3'));var router=express['Router']();var fs_extra=require(_0x5115('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5115('0x5'));var config=require(_0x5115('0x6'));var controller=require(_0x5115('0x7'));router[_0x5115('0x8')]('/',auth[_0x5115('0x9')](),controller[_0x5115('0xa')]);router[_0x5115('0x8')](_0x5115('0xb'),auth[_0x5115('0x9')](),controller[_0x5115('0xc')]);router['get'](_0x5115('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5115('0x8')](_0x5115('0xe'),auth[_0x5115('0x9')](),controller[_0x5115('0xf')]);router[_0x5115('0x8')](_0x5115('0x10'),auth[_0x5115('0x9')](),controller['getResources']);router['post']('/',auth[_0x5115('0x9')](),controller[_0x5115('0x11')]);router[_0x5115('0x12')]('/:id/clone',auth[_0x5115('0x9')](),controller[_0x5115('0x13')]);router['post']('/:id/sections',auth['isAuthenticated'](),controller[_0x5115('0x14')]);router[_0x5115('0x12')](_0x5115('0x10'),auth[_0x5115('0x9')](),controller[_0x5115('0x15')]);router[_0x5115('0x16')](_0x5115('0xd'),auth[_0x5115('0x9')](),controller[_0x5115('0x17')]);router[_0x5115('0x18')](_0x5115('0xd'),auth[_0x5115('0x9')](),controller[_0x5115('0x19')]);router[_0x5115('0x18')](_0x5115('0xe'),auth[_0x5115('0x9')](),controller[_0x5115('0x1a')]);router[_0x5115('0x18')]('/:id/resources',auth[_0x5115('0x9')](),controller['removeResources']);module[_0x5115('0x1b')]=router; \ No newline at end of file +var _0x3a27=['../../config/environment','isAuthenticated','index','/describe','describe','get','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addResources','/:id','delete','destroy','removeResources','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x416531,_0x482ca4){var _0x180967=function(_0x32d578){while(--_0x32d578){_0x416531['push'](_0x416531['shift']());}};_0x180967(++_0x482ca4);}(_0x3a27,0x1bc));var _0x73a2=function(_0xc7311f,_0x2eede6){_0xc7311f=_0xc7311f-0x0;var _0x166587=_0x3a27[_0xc7311f];return _0x166587;};'use strict';var multer=require(_0x73a2('0x0'));var util=require('util');var path=require(_0x73a2('0x1'));var timeout=require(_0x73a2('0x2'));var express=require(_0x73a2('0x3'));var router=express['Router']();var fs_extra=require(_0x73a2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73a2('0x5'));var config=require(_0x73a2('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x73a2('0x7')](),controller[_0x73a2('0x8')]);router['get'](_0x73a2('0x9'),auth['isAuthenticated'](),controller[_0x73a2('0xa')]);router[_0x73a2('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x73a2('0xb')](_0x73a2('0xc'),auth[_0x73a2('0x7')](),controller[_0x73a2('0xd')]);router[_0x73a2('0xb')](_0x73a2('0xe'),auth[_0x73a2('0x7')](),controller[_0x73a2('0xf')]);router[_0x73a2('0x10')]('/',auth[_0x73a2('0x7')](),controller[_0x73a2('0x11')]);router[_0x73a2('0x10')](_0x73a2('0x12'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x73a2('0xc'),auth[_0x73a2('0x7')](),controller['addSections']);router[_0x73a2('0x10')](_0x73a2('0xe'),auth[_0x73a2('0x7')](),controller[_0x73a2('0x13')]);router['put'](_0x73a2('0x14'),auth[_0x73a2('0x7')](),controller['update']);router[_0x73a2('0x15')](_0x73a2('0x14'),auth[_0x73a2('0x7')](),controller[_0x73a2('0x16')]);router[_0x73a2('0x15')](_0x73a2('0xc'),auth['isAuthenticated'](),controller['removeSections']);router['delete']('/:id/resources',auth['isAuthenticated'](),controller[_0x73a2('0x17')]);module[_0x73a2('0x18')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index df31ce8..b9276d5 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 _0x662b=['sequelize','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x3d3ddd,_0x59b504){var _0x52a4f9=function(_0x349a69){while(--_0x349a69){_0x3d3ddd['push'](_0x3d3ddd['shift']());}};_0x52a4f9(++_0x59b504);}(_0x662b,0x64));var _0xb662=function(_0x30777d,_0x17ec2b){_0x30777d=_0x30777d-0x0;var _0x2a7ac8=_0x662b[_0x30777d];return _0x2a7ac8;};'use strict';var Sequelize=require(_0xb662('0x0'));module[_0xb662('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb662('0x2')},'crudPermissions':{'type':Sequelize[_0xb662('0x3')],'set':function(_0x1e9999){this[_0xb662('0x4')](_0xb662('0x5'),_0x1e9999?_0x1e9999[_0xb662('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xb662('0x5'))?this[_0xb662('0x7')](_0xb662('0x5'))[_0xb662('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb662('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb662('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb662('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb662('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb662('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb662('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb662('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb662('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb662('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2a76=['name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x2dc3fd,_0x19fe99){var _0x201756=function(_0x59d6aa){while(--_0x59d6aa){_0x2dc3fd['push'](_0x2dc3fd['shift']());}};_0x201756(++_0x19fe99);}(_0x2a76,0x1a4));var _0x62a7=function(_0x315ad7,_0x452136){_0x315ad7=_0x315ad7-0x0;var _0xc397b0=_0x2a76[_0x315ad7];return _0xc397b0;};'use strict';var Sequelize=require(_0x62a7('0x0'));module[_0x62a7('0x1')]={'name':{'type':Sequelize[_0x62a7('0x2')],'allowNull':![],'unique':_0x62a7('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x37d028){this[_0x62a7('0x4')](_0x62a7('0x5'),_0x37d028?_0x37d028[_0x62a7('0x6')](''):[]);},'get':function(){return this[_0x62a7('0x7')](_0x62a7('0x5'))?this[_0x62a7('0x7')](_0x62a7('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x62a7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x62a7('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x62a7('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x62a7('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x62a7('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x62a7('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x62a7('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x62a7('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9d47c85..55d90d0 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 _0xc0b2=['params','options','find','create','get','createdAt','updatedAt','crudPermissions','body','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','push','removeSections','ids','getSections','enabled','sectionId','isEmpty','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','undefined','limit','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show'];(function(_0x72bd30,_0x330866){var _0x212c56=function(_0x338f94){while(--_0x338f94){_0x72bd30['push'](_0x72bd30['shift']());}};_0x212c56(++_0x330866);}(_0xc0b2,0x1f0));var _0x2c0b=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xc0b2[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require(_0x2c0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c0b('0x1'));var jsonpatch=require(_0x2c0b('0x2'));var rp=require(_0x2c0b('0x3'));var moment=require('moment');var BPromise=require(_0x2c0b('0x4'));var Mustache=require(_0x2c0b('0x5'));var util=require(_0x2c0b('0x6'));var path=require('path');var sox=require(_0x2c0b('0x7'));var csv=require(_0x2c0b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c0b('0x9'));var _=require(_0x2c0b('0xa'));var squel=require('squel');var crypto=require(_0x2c0b('0xb'));var jsforce=require(_0x2c0b('0xc'));var deskjs=require(_0x2c0b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2c0b('0xe'));var Papa=require(_0x2c0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c0b('0x10'));var as=require(_0x2c0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c0b('0x12'));var utils=require('../../config/utils');var config=require(_0x2c0b('0x13'));var licenseUtil=require(_0x2c0b('0x14'));var db=require(_0x2c0b('0x15'))['db'];config[_0x2c0b('0x16')]=_[_0x2c0b('0x17')](config['redis'],{'host':_0x2c0b('0x18'),'port':0x18eb});var socket=require(_0x2c0b('0x19'))(new Redis(config['redis']));require(_0x2c0b('0x1a'))['register'](socket);function respondWithStatusCode(_0x567559,_0x26b58f){_0x26b58f=_0x26b58f||0xcc;return function(_0x41e7c9){if(_0x41e7c9){return _0x567559[_0x2c0b('0x1b')](_0x26b58f);}return _0x567559[_0x2c0b('0x1c')](_0x26b58f)[_0x2c0b('0x1d')]();};}function respondWithResult(_0x33a259,_0x26b142){_0x26b142=_0x26b142||0xc8;return function(_0x540e54){if(_0x540e54){return _0x33a259[_0x2c0b('0x1c')](_0x26b142)['json'](_0x540e54);}};}function respondWithFilteredResult(_0x28137d,_0x52b46a){return function(_0x4db492){if(_0x4db492){var _0x4daf0c=typeof _0x52b46a['offset']===_0x2c0b('0x1e')&&typeof _0x52b46a[_0x2c0b('0x1f')]===_0x2c0b('0x1e');var _0x5d2741=_0x4db492['count'];var _0x35ec87=_0x4daf0c?0x0:_0x52b46a[_0x2c0b('0x20')];var _0x123365=_0x4daf0c?_0x4db492['count']:_0x52b46a['offset']+_0x52b46a[_0x2c0b('0x1f')];var _0x345115;if(_0x123365>=_0x5d2741){_0x123365=_0x5d2741;_0x345115=0xc8;}else{_0x345115=0xce;}_0x28137d['status'](_0x345115);return _0x28137d[_0x2c0b('0x21')]('Content-Range',_0x35ec87+'-'+_0x123365+'/'+_0x5d2741)[_0x2c0b('0x22')](_0x4db492);}return null;};}function patchUpdates(_0x355847){return function(_0x3ebf78){try{jsonpatch[_0x2c0b('0x23')](_0x3ebf78,_0x355847,!![]);}catch(_0x402b53){return BPromise[_0x2c0b('0x24')](_0x402b53);}return _0x3ebf78[_0x2c0b('0x25')]();};}function saveUpdates(_0x15cc79,_0x42ea02){return function(_0x309b8b){if(_0x309b8b){return _0x309b8b[_0x2c0b('0x26')](_0x15cc79)[_0x2c0b('0x27')](function(_0xb93959){return _0xb93959;});}return null;};}function removeEntity(_0xb187f5,_0x138c1b){return function(_0x50f040){if(_0x50f040){return _0x50f040[_0x2c0b('0x28')]()['then'](function(){_0xb187f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34689b,_0x2a697f){return function(_0x17cbc9){if(!_0x17cbc9){_0x34689b[_0x2c0b('0x1b')](0x194);}return _0x17cbc9;};}function handleError(_0x39db25,_0x9df41d){_0x9df41d=_0x9df41d||0x1f4;return function(_0xb665d8){logger[_0x2c0b('0x29')](_0xb665d8[_0x2c0b('0x2a')]);if(_0xb665d8[_0x2c0b('0x2b')]){delete _0xb665d8[_0x2c0b('0x2b')];}_0x39db25[_0x2c0b('0x1c')](_0x9df41d)[_0x2c0b('0x2c')](_0xb665d8);};}exports['index']=function(_0x45348f,_0x5a1b15){var _0x3bcf4f={},_0x3b9cf0={},_0x5f078a={'count':0x0,'rows':[]};var _0x2d917f=_['map'](db[_0x2c0b('0x2d')][_0x2c0b('0x2e')],function(_0x5851ba){return{'name':_0x5851ba[_0x2c0b('0x2f')],'type':_0x5851ba[_0x2c0b('0x30')][_0x2c0b('0x31')]};});_0x3b9cf0[_0x2c0b('0x32')]=_[_0x2c0b('0x33')](_0x2d917f,_0x2c0b('0x2b'));_0x3b9cf0['query']=_[_0x2c0b('0x34')](_0x45348f[_0x2c0b('0x35')]);_0x3b9cf0[_0x2c0b('0x36')]=_[_0x2c0b('0x37')](_0x3b9cf0['model'],_0x3b9cf0[_0x2c0b('0x35')]);_0x3bcf4f[_0x2c0b('0x38')]=_[_0x2c0b('0x37')](_0x3b9cf0[_0x2c0b('0x32')],qs[_0x2c0b('0x39')](_0x45348f[_0x2c0b('0x35')][_0x2c0b('0x39')]));_0x3bcf4f[_0x2c0b('0x38')]=_0x3bcf4f['attributes'][_0x2c0b('0x3a')]?_0x3bcf4f['attributes']:_0x3b9cf0[_0x2c0b('0x32')];if(!_0x45348f[_0x2c0b('0x35')][_0x2c0b('0x3b')](_0x2c0b('0x3c'))){_0x3bcf4f[_0x2c0b('0x1f')]=qs[_0x2c0b('0x1f')](_0x45348f[_0x2c0b('0x35')][_0x2c0b('0x1f')]);_0x3bcf4f[_0x2c0b('0x20')]=qs[_0x2c0b('0x20')](_0x45348f[_0x2c0b('0x35')][_0x2c0b('0x20')]);}_0x3bcf4f[_0x2c0b('0x3d')]=qs['sort'](_0x45348f[_0x2c0b('0x35')]['sort']);_0x3bcf4f[_0x2c0b('0x3e')]=qs['filters'](_[_0x2c0b('0x3f')](_0x45348f[_0x2c0b('0x35')],_0x3b9cf0[_0x2c0b('0x36')]),_0x2d917f);if(_0x45348f['query'][_0x2c0b('0x40')]){_0x3bcf4f[_0x2c0b('0x3e')]=_[_0x2c0b('0x41')](_0x3bcf4f[_0x2c0b('0x3e')],{'$or':_[_0x2c0b('0x33')](_0x2d917f,function(_0x50c3ab){if(_0x50c3ab[_0x2c0b('0x30')]!==_0x2c0b('0x42')){var _0x442fdd={};_0x442fdd[_0x50c3ab[_0x2c0b('0x2b')]]={'$like':'%'+_0x45348f[_0x2c0b('0x35')][_0x2c0b('0x40')]+'%'};return _0x442fdd;}})});}_0x3bcf4f=_['merge']({},_0x3bcf4f,_0x45348f['options']);var _0x51b43e={'where':_0x3bcf4f[_0x2c0b('0x3e')]};return db[_0x2c0b('0x2d')][_0x2c0b('0x43')](_0x51b43e)['then'](function(_0x5b9180){_0x5f078a[_0x2c0b('0x43')]=_0x5b9180;if(_0x45348f['query'][_0x2c0b('0x44')]){_0x3bcf4f[_0x2c0b('0x45')]=[{'all':!![]}];}return db[_0x2c0b('0x2d')][_0x2c0b('0x46')](_0x3bcf4f);})[_0x2c0b('0x27')](function(_0x27215e){_0x5f078a[_0x2c0b('0x47')]=_0x27215e;return _0x5f078a;})['then'](respondWithFilteredResult(_0x5a1b15,_0x3bcf4f))[_0x2c0b('0x48')](handleError(_0x5a1b15,null));};exports[_0x2c0b('0x49')]=function(_0x5c1b3a,_0x2c28ed){var _0x4cfd12={'raw':![],'where':{'id':_0x5c1b3a[_0x2c0b('0x4a')]['id']}},_0x2f3a87={};_0x2f3a87[_0x2c0b('0x32')]=_[_0x2c0b('0x34')](db[_0x2c0b('0x2d')][_0x2c0b('0x2e')]);_0x2f3a87[_0x2c0b('0x35')]=_['keys'](_0x5c1b3a[_0x2c0b('0x35')]);_0x2f3a87[_0x2c0b('0x36')]=_[_0x2c0b('0x37')](_0x2f3a87[_0x2c0b('0x32')],_0x2f3a87[_0x2c0b('0x35')]);_0x4cfd12[_0x2c0b('0x38')]=_['intersection'](_0x2f3a87['model'],qs[_0x2c0b('0x39')](_0x5c1b3a[_0x2c0b('0x35')][_0x2c0b('0x39')]));_0x4cfd12['attributes']=_0x4cfd12[_0x2c0b('0x38')]['length']?_0x4cfd12['attributes']:_0x2f3a87[_0x2c0b('0x32')];if(_0x5c1b3a[_0x2c0b('0x35')][_0x2c0b('0x44')]){_0x4cfd12[_0x2c0b('0x45')]=[{'all':!![]}];}_0x4cfd12=_[_0x2c0b('0x41')]({},_0x4cfd12,_0x5c1b3a[_0x2c0b('0x4b')]);return db[_0x2c0b('0x2d')][_0x2c0b('0x4c')](_0x4cfd12)[_0x2c0b('0x27')](handleEntityNotFound(_0x2c28ed,null))['then'](respondWithResult(_0x2c28ed,null))[_0x2c0b('0x48')](handleError(_0x2c28ed,null));};exports[_0x2c0b('0x4d')]=function(_0x2d296c,_0x3cd213){return db['UserProfile']['create'](_0x2d296c['body'],{})[_0x2c0b('0x27')](respondWithResult(_0x3cd213,0xc9))[_0x2c0b('0x48')](handleError(_0x3cd213,null));};exports['clone']=function(_0x3272d1,_0x361b07){var _0xff9b9c={'where':{'id':_0x3272d1['params']['id']}},_0x413dee={};_0x413dee['model']=_[_0x2c0b('0x34')](db[_0x2c0b('0x2d')][_0x2c0b('0x2e')]);_0xff9b9c[_0x2c0b('0x38')]=_[_0x2c0b('0x37')](_0x413dee[_0x2c0b('0x32')],qs[_0x2c0b('0x39')](_0x3272d1[_0x2c0b('0x35')][_0x2c0b('0x39')]));_0xff9b9c['attributes']=_0xff9b9c[_0x2c0b('0x38')][_0x2c0b('0x3a')]?_0xff9b9c[_0x2c0b('0x38')]:_0x413dee[_0x2c0b('0x32')];if(_0x3272d1[_0x2c0b('0x35')][_0x2c0b('0x44')]){_0xff9b9c[_0x2c0b('0x45')]=[{'all':!![]}];}_0xff9b9c=_[_0x2c0b('0x41')]({},_0xff9b9c,_0x3272d1[_0x2c0b('0x4b')]);return db[_0x2c0b('0x2d')]['find'](_0xff9b9c)['then'](handleEntityNotFound(_0x361b07,null))['then'](function(_0x4794d8){if(_0x4794d8){var _0x10d20b=_0x4794d8[_0x2c0b('0x4e')]({'plain':!![]});_0x10d20b=qs['omit'](_0x10d20b,['id',_0x2c0b('0x4f'),_0x2c0b('0x50'),_0x2c0b('0x51')]);_0x3272d1[_0x2c0b('0x52')]=_[_0x2c0b('0x53')](_0x3272d1[_0x2c0b('0x52')],['id','createdAt',_0x2c0b('0x50')]);return db[_0x2c0b('0x54')][_0x2c0b('0x55')](function(_0x247e57){return db[_0x2c0b('0x2d')][_0x2c0b('0x4d')](_[_0x2c0b('0x41')](_0x10d20b,_0x3272d1['body']),{'include':_0x3272d1[_0x2c0b('0x35')][_0x2c0b('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x247e57})[_0x2c0b('0x27')](function(_0x5853b6){var _0x44b350=_0x5853b6[_0x2c0b('0x4e')]({'plain':!![]});return db[_0x2c0b('0x56')][_0x2c0b('0x46')]({'where':{'userProfileId':_0x3272d1[_0x2c0b('0x4a')]['id']},'raw':!![]})[_0x2c0b('0x27')](function(_0xbead1){if(_0xbead1){return BPromise[_0x2c0b('0x57')](_0xbead1,function(_0x1a7ff6){return new BPromise(function(_0x485f3f,_0x4a96bb){if(_0x1a7ff6[_0x2c0b('0x58')]===null||_0x1a7ff6[_0x2c0b('0x58')]===0x1)_0x485f3f(null);return db[_0x2c0b('0x59')][_0x2c0b('0x46')]({'where':{'sectionId':_0x1a7ff6['id']},'raw':!![]})[_0x2c0b('0x27')](function(_0x5f4661){var _0x307e5b=_[_0x2c0b('0x33')](_0x5f4661,function(_0xbcbbef){return qs[_0x2c0b('0x53')](_0xbcbbef,['id',_0x2c0b('0x4f'),'updatedAt','sectionId']);});_0x485f3f(_0x307e5b);})[_0x2c0b('0x48')](function(_0x1ef351){_0x4a96bb(_0x1ef351);});})[_0x2c0b('0x27')](function(_0x52e2cd){var _0x329ebf=qs[_0x2c0b('0x53')](_0x1a7ff6,['id','createdAt',_0x2c0b('0x50')]);_0x329ebf[_0x2c0b('0x5a')]=_0x44b350['id'];if(_0x52e2cd)_0x329ebf[_0x2c0b('0x5b')]=_0x52e2cd;return _0x329ebf;})[_0x2c0b('0x27')](function(_0x386123){return db[_0x2c0b('0x56')][_0x2c0b('0x4d')](_0x386123,{'include':[{'model':db[_0x2c0b('0x59')],'as':_0x2c0b('0x5b')}],'raw':!![],'transaction':_0x247e57});});})[_0x2c0b('0x27')](function(){return _0x44b350;});}});});});}})[_0x2c0b('0x27')](respondWithResult(_0x361b07,0xc9))['catch'](handleError(_0x361b07,null));};exports[_0x2c0b('0x26')]=function(_0x1069c7,_0x11e4b8){if(_0x1069c7[_0x2c0b('0x52')]['id']){delete _0x1069c7['body']['id'];}return db['UserProfile'][_0x2c0b('0x4c')]({'where':{'id':_0x1069c7['params']['id']}})[_0x2c0b('0x27')](handleEntityNotFound(_0x11e4b8,null))[_0x2c0b('0x27')](saveUpdates(_0x1069c7['body'],null))[_0x2c0b('0x27')](respondWithResult(_0x11e4b8,null))['catch'](handleError(_0x11e4b8,null));};exports['destroy']=function(_0x2ebc78,_0x3110ec){return db[_0x2c0b('0x2d')]['find']({'where':{'id':_0x2ebc78['params']['id']}})['then'](handleEntityNotFound(_0x3110ec,null))[_0x2c0b('0x27')](removeEntity(_0x3110ec,null))[_0x2c0b('0x48')](handleError(_0x3110ec,null));};exports[_0x2c0b('0x5c')]=function(_0x43ab20,_0x46cbd0){return db[_0x2c0b('0x2d')][_0x2c0b('0x5c')]()[_0x2c0b('0x27')](respondWithResult(_0x46cbd0,null))['catch'](handleError(_0x46cbd0,null));};exports[_0x2c0b('0x5d')]=function(_0x3ed9c4,_0xbe2931){var _0x4adb44=_0x3ed9c4[_0x2c0b('0x52')];return db[_0x2c0b('0x2d')][_0x2c0b('0x4c')]({'where':{'id':_0x3ed9c4[_0x2c0b('0x4a')]['id']}})[_0x2c0b('0x27')](handleEntityNotFound(_0xbe2931,null))['then'](function(_0x1486e2){if(_0x1486e2){return db[_0x2c0b('0x54')][_0x2c0b('0x55')](function(_0x196d0e){return db[_0x2c0b('0x56')]['destroy']({'where':{'userProfileId':_0x3ed9c4[_0x2c0b('0x4a')]['id'],'sectionId':_['map'](_0x4adb44,function(_0xaf0e74){return _0xaf0e74['sectionId'];})},'transaction':_0x196d0e})[_0x2c0b('0x27')](function(){var _0x5c5909=_[_0x2c0b('0x33')](_0x4adb44,function(_0x3342f8){_0x3342f8[_0x2c0b('0x5a')]=_0x3ed9c4['params']['id'];return _0x3342f8;});var _0x253687=[];return BPromise[_0x2c0b('0x57')](_0x5c5909,function(_0x22e628){return db[_0x2c0b('0x56')][_0x2c0b('0x4d')](_0x22e628,{'include':[{'model':db[_0x2c0b('0x59')],'as':_0x2c0b('0x5b')}],'raw':!![],'transaction':_0x196d0e})[_0x2c0b('0x27')](function(_0x5b0519){_0x253687[_0x2c0b('0x5e')](_0x5b0519[_0x2c0b('0x4e')]({'plain':!![]}));});})[_0x2c0b('0x27')](function(){return _0x253687;});});});}})[_0x2c0b('0x27')](function(_0x5a6009){return _0x5a6009;})[_0x2c0b('0x27')](respondWithResult(_0xbe2931,null))[_0x2c0b('0x48')](handleError(_0xbe2931,null));};exports[_0x2c0b('0x5f')]=function(_0x2d86f7,_0x32e335){var _0x4842e9;return db[_0x2c0b('0x2d')][_0x2c0b('0x4c')]({'where':{'id':_0x2d86f7[_0x2c0b('0x4a')]['id']},'attributes':['id',_0x2c0b('0x2b')]})['then'](handleEntityNotFound(_0x32e335,null))[_0x2c0b('0x27')](function(_0xa665a){if(_0xa665a){_0x4842e9=_0xa665a;return db[_0x2c0b('0x56')][_0x2c0b('0x28')]({'where':{'userProfileId':_0x2d86f7[_0x2c0b('0x4a')]['id'],'sectionId':_0x2d86f7[_0x2c0b('0x35')][_0x2c0b('0x60')]}});}})[_0x2c0b('0x27')](function(){return _0x4842e9;})['then'](respondWithStatusCode(_0x32e335,null))[_0x2c0b('0x48')](handleError(_0x32e335,null));};exports[_0x2c0b('0x61')]=function(_0x178d39,_0x1a8204){var _0x531396=[];var _0xf903bb=[];return db[_0x2c0b('0x56')][_0x2c0b('0x46')]({'where':{'userProfileId':_0x178d39[_0x2c0b('0x4a')]['id']},'raw':!![]})[_0x2c0b('0x27')](function(_0x5cfd48){_0x531396=_[_0x2c0b('0x40')](_0x5cfd48,function(_0x1bb155){return _0x1bb155[_0x2c0b('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x1bb155[_0x2c0b('0x63')]);});if(!_[_0x2c0b('0x64')](_0x531396)){return _[_0x2c0b('0x33')](_0x531396,function(_0x5183c6){return _0x5183c6[_0x2c0b('0x63')];});}else{return;}})[_0x2c0b('0x27')](function(_0x12245b){if(_0x12245b)_0xf903bb=_0x12245b;if(_[_0x2c0b('0x65')](_0xf903bb,0x64)){var _0x5123be=_[_0x2c0b('0x4c')](_0x531396,{'sectionId':0x64});return hasDefaultDashboard(_0x5123be)['then'](function(_0x4ea443){return _[_0x2c0b('0x33')](_0x531396,function(_0x330a72){if(_0x330a72[_0x2c0b('0x63')]===0x64){_0x330a72[_0x2c0b('0x66')]=_0x4ea443;}return _0x330a72;});});}else{return;}})[_0x2c0b('0x27')](function(_0x3a905f){if(_0x3a905f)_0x531396=_0x3a905f;if(_[_0x2c0b('0x65')](_0xf903bb,0x3eb)){var _0xa437cb=_[_0x2c0b('0x4c')](_0x531396,{'sectionId':0x3eb});return getCustomDashboards(_0xa437cb)[_0x2c0b('0x27')](function(_0x2fca90){return _[_0x2c0b('0x33')](_0x531396,function(_0x148812){if(_0xa437cb['enabled']){if(_0x148812['sectionId']===0x3eb){_0x148812[_0x2c0b('0x66')]=_0x2fca90;}}else{if(_0x148812[_0x2c0b('0x63')]===0x64){if(!_0x148812[_0x2c0b('0x66')]){_0x148812[_0x2c0b('0x66')]=[];}_0x148812[_0x2c0b('0x66')]=_0x148812[_0x2c0b('0x66')][_0x2c0b('0x67')](_0x2fca90);}}return _0x148812;});});}else{return;}})['then'](function(_0x1a05b3){if(_0x1a05b3)_0x531396=_0x1a05b3;if(_[_0x2c0b('0x65')](_0xf903bb,0x709)){var _0x260643=_[_0x2c0b('0x4c')](_0x531396,{'sectionId':0x709});return getPlugins(_0x260643)[_0x2c0b('0x27')](function(_0xa01e7c){if(_0x260643[_0x2c0b('0x62')]){return _[_0x2c0b('0x33')](_0x531396,function(_0x1387ec){if(_0x1387ec[_0x2c0b('0x63')]===0x709){_0x1387ec[_0x2c0b('0x66')]=_0xa01e7c;}return _0x1387ec;});}else{var _0x11483f={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa01e7c};var _0x2671dc=_[_0x2c0b('0x33')](_0x531396);_0x2671dc[_0x2c0b('0x5e')](_0x11483f);return _0x2671dc;}});}else{return;}})[_0x2c0b('0x27')](function(_0x53ad2e){if(_0x53ad2e)_0x531396=_0x53ad2e;return _[_0x2c0b('0x40')](_0x531396,[_0x2c0b('0x62'),0x1]);})['then'](respondWithResult(_0x1a8204,null))[_0x2c0b('0x48')](handleError(_0x1a8204,null));};function hasDefaultDashboard(_0x41066a){var _0x569014=[0x65];return new BPromise(function(_0x24fdad,_0x5a1a6f){try{if(_0x41066a['autoAssociation']){_0x24fdad(_0x569014);}else{return db[_0x2c0b('0x59')][_0x2c0b('0x68')]({'where':{'sectionId':_0x41066a['id']},'raw':!![]})[_0x2c0b('0x27')](function(_0x238619){_0x238619?_0x24fdad(_0x569014):_0x24fdad();});}}catch(_0x540b5b){_0x5a1a6f(_0x540b5b);}});}function getCustomDashboards(_0x5cc8d6){var _0x2be854=[];return new BPromise(function(_0x1dee7a,_0x81f4b2){try{if(_0x5cc8d6[_0x2c0b('0x58')]){return db[_0x2c0b('0x69')][_0x2c0b('0x46')]({'raw':!![]})[_0x2c0b('0x27')](function(_0xf294ee){_0xf294ee['forEach'](function(_0x45b292){_0x2be854['push'](_0x45b292['id']+0x1869f);});_0x1dee7a(_0x2be854);});}else{return db[_0x2c0b('0x59')][_0x2c0b('0x46')]({'where':{'sectionId':_0x5cc8d6['id']},'raw':!![]})['then'](function(_0xa506aa){_0xa506aa[_0x2c0b('0x6a')](function(_0x45743a){_0x2be854[_0x2c0b('0x5e')](_0x45743a[_0x2c0b('0x6b')]+0x1869f);});_0x1dee7a(_0x2be854);});}}catch(_0x2a82d6){_0x81f4b2(_0x2a82d6);}});}function getPlugins(_0x4d704c){var _0x5ad7f0=[];return new BPromise(function(_0x21d708,_0x4f7700){try{if(_0x4d704c[_0x2c0b('0x58')]){return db['Plugin'][_0x2c0b('0x46')]({'raw':!![]})['then'](function(_0x562b73){_0x562b73[_0x2c0b('0x6a')](function(_0x33b8b9){_0x5ad7f0[_0x2c0b('0x5e')](_0x33b8b9['id']+0x15b38);});_0x21d708(_0x5ad7f0);});}else{return db['UserProfileResource'][_0x2c0b('0x46')]({'where':{'sectionId':_0x4d704c['id']},'raw':!![]})['then'](function(_0x3329d1){_0x3329d1[_0x2c0b('0x6a')](function(_0x6cd154){_0x5ad7f0[_0x2c0b('0x5e')](_0x6cd154[_0x2c0b('0x6b')]+0x15b38);});_0x21d708(_0x5ad7f0);});}}catch(_0x32a32d){_0x4f7700(_0x32a32d);}});}exports['addResources']=function(_0x22b197,_0x42d8a1){return db[_0x2c0b('0x2d')][_0x2c0b('0x4c')]({'where':{'id':_0x22b197[_0x2c0b('0x4a')]['id']}})[_0x2c0b('0x27')](handleEntityNotFound(_0x42d8a1,null))[_0x2c0b('0x27')](function(_0xabf9bc){if(_0xabf9bc){return db[_0x2c0b('0x54')]['transaction'](function(_0x44a236){return db[_0x2c0b('0x56')][_0x2c0b('0x46')]({'where':{'userProfileId':_0x22b197[_0x2c0b('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x2c0b('0x27')](function(_0xdfe71f){if(_0xdfe71f){return db[_0x2c0b('0x56')][_0x2c0b('0x28')]({'where':{'userProfileId':_0x22b197[_0x2c0b('0x4a')]['id'],'id':_['map'](_0xdfe71f,function(_0x5edc2a){return _0x5edc2a['id'];})},'transaction':_0x44a236});}})[_0x2c0b('0x27')](function(_0x21d419){var _0x21a1a5=_['map'](_0x22b197[_0x2c0b('0x52')],function(_0x31c82a){_0x31c82a['userProfileId']=_0x22b197['params']['id'];return _0x31c82a;});return db[_0x2c0b('0x56')][_0x2c0b('0x6c')](_0x21a1a5,{'raw':!![],'transaction':_0x44a236});})[_0x2c0b('0x27')](function(_0x5fee21){var _0x1b6c45=_[_0x2c0b('0x40')](_[_0x2c0b('0x33')](_0x5fee21,function(_0x38786b){return _0x38786b[_0x2c0b('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x1b6c45){return db[_0x2c0b('0x56')]['findAll']({'where':{'userProfileId':_0x22b197[_0x2c0b('0x4a')]['id'],'sectionId':_[_0x2c0b('0x33')](_0x1b6c45,function(_0x27a7b0){return _0x27a7b0[_0x2c0b('0x63')];})},'attributes':['id',_0x2c0b('0x63')],'raw':!![]})[_0x2c0b('0x27')](function(_0x56725c){var _0x3f459e=_['map'](_0x22b197[_0x2c0b('0x52')],function(_0x17bd3a){_0x17bd3a[_0x2c0b('0x5a')]=_0x22b197[_0x2c0b('0x4a')]['id'];return _0x17bd3a;});return db[_0x2c0b('0x59')][_0x2c0b('0x6c')](_0x3f459e,{'raw':!![],'transaction':_0x44a236});});}})[_0x2c0b('0x48')](handleError(_0x42d8a1,null));});}})[_0x2c0b('0x27')](function(_0x220ff6){var _0x4accd0=_[_0x2c0b('0x33')](_0x220ff6,function(_0x1c66a8){return _0x1c66a8['get']({'plain':!![]});});})['then'](respondWithResult(_0x42d8a1,null))[_0x2c0b('0x48')](handleError(_0x42d8a1,null));};exports['removeResources']=function(_0x1e20fa,_0x33d89e,_0x5eabf0){return db[_0x2c0b('0x2d')][_0x2c0b('0x4c')]({'where':{'id':_0x1e20fa[_0x2c0b('0x4a')]['id']}})[_0x2c0b('0x27')](handleEntityNotFound(_0x33d89e,null))[_0x2c0b('0x27')](function(_0x159a84){if(_0x159a84){return _0x159a84[_0x2c0b('0x6d')](_0x1e20fa[_0x2c0b('0x35')][_0x2c0b('0x60')]);}})[_0x2c0b('0x27')](respondWithStatusCode(_0x33d89e,null))[_0x2c0b('0x48')](handleError(_0x33d89e,null));};exports[_0x2c0b('0x6e')]=function(_0x2189f2,_0x3bca2d){var _0x5aad33={};if(!_0x2189f2['query'][_0x2c0b('0x6f')])throw new Error(_0x2c0b('0x70'));if(!_0x2189f2[_0x2c0b('0x35')][_0x2c0b('0x3b')](_0x2c0b('0x3c'))){_0x5aad33['limit']=qs[_0x2c0b('0x1f')](_0x2189f2[_0x2c0b('0x35')][_0x2c0b('0x1f')]);_0x5aad33[_0x2c0b('0x20')]=qs[_0x2c0b('0x20')](_0x2189f2[_0x2c0b('0x35')][_0x2c0b('0x20')]);}return db[_0x2c0b('0x2d')]['find']({'where':{'id':_0x2189f2[_0x2c0b('0x4a')]['id']}})['then'](function(_0x4f6320){if(!_0x4f6320)throw new Error(_0x2c0b('0x71')+_0x2189f2[_0x2c0b('0x4a')]['id']);return db[_0x2c0b('0x2d')]['getResources'](_0x2189f2);})[_0x2c0b('0x27')](respondWithFilteredResult(_0x3bca2d,_0x5aad33))[_0x2c0b('0x48')](handleError(_0x3bca2d,null));}; \ No newline at end of file +var _0x6204=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','clone','updatedAt','crudPermissions','omit','createdAt','sequelize','transaction','get','autoAssociation','UserProfileResource','sectionId','Resources','UserProfileSection','describe','addSections','userProfileId','each','removeSections','getSections','enabled','isEmpty','includes','subsections','concat','push','forEach','resourceId','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x6204,0x18f));var _0x4620=function(_0x202ae0,_0x21f6bc){_0x202ae0=_0x202ae0-0x0;var _0x81d7c4=_0x6204[_0x202ae0];return _0x81d7c4;};'use strict';var emlformat=require(_0x4620('0x0'));var rimraf=require(_0x4620('0x1'));var zipdir=require(_0x4620('0x2'));var jsonpatch=require(_0x4620('0x3'));var rp=require(_0x4620('0x4'));var moment=require(_0x4620('0x5'));var BPromise=require(_0x4620('0x6'));var Mustache=require(_0x4620('0x7'));var util=require('util');var path=require(_0x4620('0x8'));var sox=require(_0x4620('0x9'));var csv=require(_0x4620('0xa'));var ejs=require(_0x4620('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4620('0xc'));var jsforce=require(_0x4620('0xd'));var deskjs=require(_0x4620('0xe'));var toCsv=require(_0x4620('0xa'));var querystring=require(_0x4620('0xf'));var Papa=require(_0x4620('0x10'));var Redis=require(_0x4620('0x11'));var authService=require(_0x4620('0x12'));var qs=require(_0x4620('0x13'));var as=require(_0x4620('0x14'));var hardwareService=require(_0x4620('0x15'));var logger=require(_0x4620('0x16'))('api');var utils=require(_0x4620('0x17'));var config=require(_0x4620('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4620('0x19')]=_[_0x4620('0x1a')](config['redis'],{'host':_0x4620('0x1b'),'port':0x18eb});var socket=require(_0x4620('0x1c'))(new Redis(config[_0x4620('0x19')]));require('./userProfile.socket')[_0x4620('0x1d')](socket);function respondWithStatusCode(_0x491189,_0x16c306){_0x16c306=_0x16c306||0xcc;return function(_0xbe901d){if(_0xbe901d){return _0x491189[_0x4620('0x1e')](_0x16c306);}return _0x491189[_0x4620('0x1f')](_0x16c306)['end']();};}function respondWithResult(_0x484d46,_0x59a461){_0x59a461=_0x59a461||0xc8;return function(_0x52b262){if(_0x52b262){return _0x484d46[_0x4620('0x1f')](_0x59a461)[_0x4620('0x20')](_0x52b262);}};}function respondWithFilteredResult(_0x12b4c7,_0x29c6b1){return function(_0x2e7d55){if(_0x2e7d55){var _0x395ead=typeof _0x29c6b1[_0x4620('0x21')]===_0x4620('0x22')&&typeof _0x29c6b1[_0x4620('0x23')]===_0x4620('0x22');var _0x13ce2c=_0x2e7d55['count'];var _0x11022d=_0x395ead?0x0:_0x29c6b1[_0x4620('0x21')];var _0x53f371=_0x395ead?_0x2e7d55[_0x4620('0x24')]:_0x29c6b1[_0x4620('0x21')]+_0x29c6b1[_0x4620('0x23')];var _0x2da4a8;if(_0x53f371>=_0x13ce2c){_0x53f371=_0x13ce2c;_0x2da4a8=0xc8;}else{_0x2da4a8=0xce;}_0x12b4c7['status'](_0x2da4a8);return _0x12b4c7[_0x4620('0x25')](_0x4620('0x26'),_0x11022d+'-'+_0x53f371+'/'+_0x13ce2c)['json'](_0x2e7d55);}return null;};}function patchUpdates(_0x16585c){return function(_0xc07d1c){try{jsonpatch['apply'](_0xc07d1c,_0x16585c,!![]);}catch(_0x4394ea){return BPromise[_0x4620('0x27')](_0x4394ea);}return _0xc07d1c['save']();};}function saveUpdates(_0x3e4179,_0x7e868a){return function(_0x2ac811){if(_0x2ac811){return _0x2ac811[_0x4620('0x28')](_0x3e4179)[_0x4620('0x29')](function(_0x3875ab){return _0x3875ab;});}return null;};}function removeEntity(_0x11085e,_0x5c5f5f){return function(_0x2d95f3){if(_0x2d95f3){return _0x2d95f3[_0x4620('0x2a')]()[_0x4620('0x29')](function(){_0x11085e['status'](0xcc)[_0x4620('0x2b')]();});}};}function handleEntityNotFound(_0x3a5706,_0x155d3f){return function(_0x2dec12){if(!_0x2dec12){_0x3a5706['sendStatus'](0x194);}return _0x2dec12;};}function handleError(_0x2c38f4,_0x3ddf90){_0x3ddf90=_0x3ddf90||0x1f4;return function(_0x53d035){logger[_0x4620('0x2c')](_0x53d035[_0x4620('0x2d')]);if(_0x53d035[_0x4620('0x2e')]){delete _0x53d035[_0x4620('0x2e')];}_0x2c38f4[_0x4620('0x1f')](_0x3ddf90)['send'](_0x53d035);};}exports[_0x4620('0x2f')]=function(_0x220cbb,_0x5744f0){var _0x40ada4={},_0x387c66={},_0x5bf06b={'count':0x0,'rows':[]};var _0x44912f=_[_0x4620('0x30')](db[_0x4620('0x31')][_0x4620('0x32')],function(_0xfe39f9){return{'name':_0xfe39f9[_0x4620('0x33')],'type':_0xfe39f9[_0x4620('0x34')]['key']};});_0x387c66[_0x4620('0x35')]=_[_0x4620('0x30')](_0x44912f,_0x4620('0x2e'));_0x387c66[_0x4620('0x36')]=_[_0x4620('0x37')](_0x220cbb[_0x4620('0x36')]);_0x387c66[_0x4620('0x38')]=_[_0x4620('0x39')](_0x387c66['model'],_0x387c66[_0x4620('0x36')]);_0x40ada4[_0x4620('0x3a')]=_[_0x4620('0x39')](_0x387c66[_0x4620('0x35')],qs[_0x4620('0x3b')](_0x220cbb['query'][_0x4620('0x3b')]));_0x40ada4[_0x4620('0x3a')]=_0x40ada4[_0x4620('0x3a')][_0x4620('0x3c')]?_0x40ada4[_0x4620('0x3a')]:_0x387c66[_0x4620('0x35')];if(!_0x220cbb[_0x4620('0x36')][_0x4620('0x3d')](_0x4620('0x3e'))){_0x40ada4[_0x4620('0x23')]=qs['limit'](_0x220cbb['query'][_0x4620('0x23')]);_0x40ada4['offset']=qs[_0x4620('0x21')](_0x220cbb[_0x4620('0x36')]['offset']);}_0x40ada4[_0x4620('0x3f')]=qs['sort'](_0x220cbb['query'][_0x4620('0x40')]);_0x40ada4[_0x4620('0x41')]=qs['filters'](_[_0x4620('0x42')](_0x220cbb[_0x4620('0x36')],_0x387c66[_0x4620('0x38')]),_0x44912f);if(_0x220cbb['query']['filter']){_0x40ada4[_0x4620('0x41')]=_[_0x4620('0x43')](_0x40ada4[_0x4620('0x41')],{'$or':_[_0x4620('0x30')](_0x44912f,function(_0x1da1b2){if(_0x1da1b2[_0x4620('0x34')]!==_0x4620('0x44')){var _0x41e25b={};_0x41e25b[_0x1da1b2[_0x4620('0x2e')]]={'$like':'%'+_0x220cbb['query'][_0x4620('0x45')]+'%'};return _0x41e25b;}})});}_0x40ada4=_[_0x4620('0x43')]({},_0x40ada4,_0x220cbb[_0x4620('0x46')]);var _0x2123e0={'where':_0x40ada4[_0x4620('0x41')]};return db['UserProfile'][_0x4620('0x24')](_0x2123e0)[_0x4620('0x29')](function(_0x2988a1){_0x5bf06b['count']=_0x2988a1;if(_0x220cbb[_0x4620('0x36')][_0x4620('0x47')]){_0x40ada4[_0x4620('0x48')]=[{'all':!![]}];}return db[_0x4620('0x31')][_0x4620('0x49')](_0x40ada4);})[_0x4620('0x29')](function(_0x4d2e10){_0x5bf06b[_0x4620('0x4a')]=_0x4d2e10;return _0x5bf06b;})[_0x4620('0x29')](respondWithFilteredResult(_0x5744f0,_0x40ada4))['catch'](handleError(_0x5744f0,null));};exports[_0x4620('0x4b')]=function(_0x641f80,_0x402d38){var _0x2b92be={'raw':![],'where':{'id':_0x641f80[_0x4620('0x4c')]['id']}},_0x41309d={};_0x41309d[_0x4620('0x35')]=_[_0x4620('0x37')](db['UserProfile'][_0x4620('0x32')]);_0x41309d[_0x4620('0x36')]=_['keys'](_0x641f80[_0x4620('0x36')]);_0x41309d['filters']=_[_0x4620('0x39')](_0x41309d[_0x4620('0x35')],_0x41309d[_0x4620('0x36')]);_0x2b92be['attributes']=_['intersection'](_0x41309d['model'],qs[_0x4620('0x3b')](_0x641f80[_0x4620('0x36')][_0x4620('0x3b')]));_0x2b92be[_0x4620('0x3a')]=_0x2b92be[_0x4620('0x3a')][_0x4620('0x3c')]?_0x2b92be[_0x4620('0x3a')]:_0x41309d['model'];if(_0x641f80['query']['includeAll']){_0x2b92be[_0x4620('0x48')]=[{'all':!![]}];}_0x2b92be=_[_0x4620('0x43')]({},_0x2b92be,_0x641f80[_0x4620('0x46')]);return db[_0x4620('0x31')][_0x4620('0x4d')](_0x2b92be)[_0x4620('0x29')](handleEntityNotFound(_0x402d38,null))[_0x4620('0x29')](respondWithResult(_0x402d38,null))[_0x4620('0x4e')](handleError(_0x402d38,null));};exports[_0x4620('0x4f')]=function(_0x5c7a25,_0x3a4935){return db[_0x4620('0x31')][_0x4620('0x4f')](_0x5c7a25[_0x4620('0x50')],{})[_0x4620('0x29')](respondWithResult(_0x3a4935,0xc9))[_0x4620('0x4e')](handleError(_0x3a4935,null));};exports[_0x4620('0x51')]=function(_0x420695,_0x221deb){var _0x3f1e5a={'where':{'id':_0x420695[_0x4620('0x4c')]['id']}},_0x1c9258={};_0x1c9258[_0x4620('0x35')]=_['keys'](db[_0x4620('0x31')][_0x4620('0x32')]);_0x3f1e5a[_0x4620('0x3a')]=_[_0x4620('0x39')](_0x1c9258[_0x4620('0x35')],qs[_0x4620('0x3b')](_0x420695[_0x4620('0x36')][_0x4620('0x3b')]));_0x3f1e5a[_0x4620('0x3a')]=_0x3f1e5a[_0x4620('0x3a')][_0x4620('0x3c')]?_0x3f1e5a[_0x4620('0x3a')]:_0x1c9258[_0x4620('0x35')];if(_0x420695[_0x4620('0x36')]['includeAll']){_0x3f1e5a[_0x4620('0x48')]=[{'all':!![]}];}_0x3f1e5a=_[_0x4620('0x43')]({},_0x3f1e5a,_0x420695[_0x4620('0x46')]);return db[_0x4620('0x31')][_0x4620('0x4d')](_0x3f1e5a)[_0x4620('0x29')](handleEntityNotFound(_0x221deb,null))[_0x4620('0x29')](function(_0x26a8e7){if(_0x26a8e7){var _0x19f5d9=_0x26a8e7['get']({'plain':!![]});_0x19f5d9=qs['omit'](_0x19f5d9,['id','createdAt',_0x4620('0x52'),_0x4620('0x53')]);_0x420695[_0x4620('0x50')]=_[_0x4620('0x54')](_0x420695['body'],['id',_0x4620('0x55'),_0x4620('0x52')]);return db[_0x4620('0x56')][_0x4620('0x57')](function(_0x527d21){return db[_0x4620('0x31')]['create'](_[_0x4620('0x43')](_0x19f5d9,_0x420695[_0x4620('0x50')]),{'include':_0x420695[_0x4620('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x527d21})[_0x4620('0x29')](function(_0x31ae8b){var _0x17bd1b=_0x31ae8b[_0x4620('0x58')]({'plain':!![]});return db['UserProfileSection'][_0x4620('0x49')]({'where':{'userProfileId':_0x420695[_0x4620('0x4c')]['id']},'raw':!![]})[_0x4620('0x29')](function(_0x2206eb){if(_0x2206eb){return BPromise['each'](_0x2206eb,function(_0x35d75f){return new BPromise(function(_0x49e575,_0x2991ec){if(_0x35d75f[_0x4620('0x59')]===null||_0x35d75f['autoAssociation']===0x1)_0x49e575(null);return db[_0x4620('0x5a')][_0x4620('0x49')]({'where':{'sectionId':_0x35d75f['id']},'raw':!![]})[_0x4620('0x29')](function(_0x3e4ec5){var _0x498dd3=_['map'](_0x3e4ec5,function(_0x12ca08){return qs[_0x4620('0x54')](_0x12ca08,['id','createdAt',_0x4620('0x52'),_0x4620('0x5b')]);});_0x49e575(_0x498dd3);})[_0x4620('0x4e')](function(_0x1536d1){_0x2991ec(_0x1536d1);});})[_0x4620('0x29')](function(_0x3e8699){var _0x319e39=qs[_0x4620('0x54')](_0x35d75f,['id',_0x4620('0x55'),'updatedAt']);_0x319e39['userProfileId']=_0x17bd1b['id'];if(_0x3e8699)_0x319e39[_0x4620('0x5c')]=_0x3e8699;return _0x319e39;})[_0x4620('0x29')](function(_0x5e0e2c){return db[_0x4620('0x5d')][_0x4620('0x4f')](_0x5e0e2c,{'include':[{'model':db[_0x4620('0x5a')],'as':_0x4620('0x5c')}],'raw':!![],'transaction':_0x527d21});});})['then'](function(){return _0x17bd1b;});}});});});}})[_0x4620('0x29')](respondWithResult(_0x221deb,0xc9))[_0x4620('0x4e')](handleError(_0x221deb,null));};exports[_0x4620('0x28')]=function(_0x33d19c,_0x16015d){if(_0x33d19c[_0x4620('0x50')]['id']){delete _0x33d19c[_0x4620('0x50')]['id'];}return db[_0x4620('0x31')]['find']({'where':{'id':_0x33d19c[_0x4620('0x4c')]['id']}})[_0x4620('0x29')](handleEntityNotFound(_0x16015d,null))[_0x4620('0x29')](saveUpdates(_0x33d19c[_0x4620('0x50')],null))[_0x4620('0x29')](respondWithResult(_0x16015d,null))[_0x4620('0x4e')](handleError(_0x16015d,null));};exports[_0x4620('0x2a')]=function(_0x5eebe1,_0x277352){return db[_0x4620('0x31')][_0x4620('0x4d')]({'where':{'id':_0x5eebe1[_0x4620('0x4c')]['id']}})['then'](handleEntityNotFound(_0x277352,null))[_0x4620('0x29')](removeEntity(_0x277352,null))['catch'](handleError(_0x277352,null));};exports[_0x4620('0x5e')]=function(_0x438d81,_0x42744b){return db['UserProfile'][_0x4620('0x5e')]()[_0x4620('0x29')](respondWithResult(_0x42744b,null))['catch'](handleError(_0x42744b,null));};exports[_0x4620('0x5f')]=function(_0x1d66bb,_0x43240f){var _0x3581ba=_0x1d66bb[_0x4620('0x50')];return db['UserProfile'][_0x4620('0x4d')]({'where':{'id':_0x1d66bb[_0x4620('0x4c')]['id']}})['then'](handleEntityNotFound(_0x43240f,null))[_0x4620('0x29')](function(_0x6dcd2){if(_0x6dcd2){return db[_0x4620('0x56')]['transaction'](function(_0x26a675){return db[_0x4620('0x5d')]['destroy']({'where':{'userProfileId':_0x1d66bb[_0x4620('0x4c')]['id'],'sectionId':_[_0x4620('0x30')](_0x3581ba,function(_0x146020){return _0x146020[_0x4620('0x5b')];})},'transaction':_0x26a675})[_0x4620('0x29')](function(){var _0x5533a1=_[_0x4620('0x30')](_0x3581ba,function(_0xa04993){_0xa04993[_0x4620('0x60')]=_0x1d66bb['params']['id'];return _0xa04993;});var _0x3e7cc8=[];return BPromise[_0x4620('0x61')](_0x5533a1,function(_0x2a59a2){return db['UserProfileSection'][_0x4620('0x4f')](_0x2a59a2,{'include':[{'model':db['UserProfileResource'],'as':_0x4620('0x5c')}],'raw':!![],'transaction':_0x26a675})[_0x4620('0x29')](function(_0x31e333){_0x3e7cc8['push'](_0x31e333['get']({'plain':!![]}));});})[_0x4620('0x29')](function(){return _0x3e7cc8;});});});}})[_0x4620('0x29')](function(_0x2d0362){return _0x2d0362;})[_0x4620('0x29')](respondWithResult(_0x43240f,null))[_0x4620('0x4e')](handleError(_0x43240f,null));};exports[_0x4620('0x62')]=function(_0x38fe9e,_0x18e8f2){var _0x54d325;return db[_0x4620('0x31')]['find']({'where':{'id':_0x38fe9e[_0x4620('0x4c')]['id']},'attributes':['id',_0x4620('0x2e')]})[_0x4620('0x29')](handleEntityNotFound(_0x18e8f2,null))[_0x4620('0x29')](function(_0x3b95d6){if(_0x3b95d6){_0x54d325=_0x3b95d6;return db['UserProfileSection'][_0x4620('0x2a')]({'where':{'userProfileId':_0x38fe9e[_0x4620('0x4c')]['id'],'sectionId':_0x38fe9e['query']['ids']}});}})[_0x4620('0x29')](function(){return _0x54d325;})[_0x4620('0x29')](respondWithStatusCode(_0x18e8f2,null))[_0x4620('0x4e')](handleError(_0x18e8f2,null));};exports[_0x4620('0x63')]=function(_0x1d45e6,_0x4222fb){var _0x4c5460=[];var _0x1cb085=[];return db[_0x4620('0x5d')]['findAll']({'where':{'userProfileId':_0x1d45e6[_0x4620('0x4c')]['id']},'raw':!![]})['then'](function(_0x488b15){_0x4c5460=_[_0x4620('0x45')](_0x488b15,function(_0x3f5f0b){return _0x3f5f0b[_0x4620('0x64')]===0x1||_['includes']([0x3eb,0x709],_0x3f5f0b['sectionId']);});if(!_[_0x4620('0x65')](_0x4c5460)){return _[_0x4620('0x30')](_0x4c5460,function(_0x528636){return _0x528636[_0x4620('0x5b')];});}else{return;}})[_0x4620('0x29')](function(_0x4941a1){if(_0x4941a1)_0x1cb085=_0x4941a1;if(_[_0x4620('0x66')](_0x1cb085,0x64)){var _0x5ba3e8=_[_0x4620('0x4d')](_0x4c5460,{'sectionId':0x64});return hasDefaultDashboard(_0x5ba3e8)[_0x4620('0x29')](function(_0x4c8702){return _[_0x4620('0x30')](_0x4c5460,function(_0x57106e){if(_0x57106e[_0x4620('0x5b')]===0x64){_0x57106e['subsections']=_0x4c8702;}return _0x57106e;});});}else{return;}})[_0x4620('0x29')](function(_0x5ab9bc){if(_0x5ab9bc)_0x4c5460=_0x5ab9bc;if(_[_0x4620('0x66')](_0x1cb085,0x3eb)){var _0xcae5a2=_[_0x4620('0x4d')](_0x4c5460,{'sectionId':0x3eb});return getCustomDashboards(_0xcae5a2)['then'](function(_0x52472b){return _[_0x4620('0x30')](_0x4c5460,function(_0xcf4616){if(_0xcae5a2[_0x4620('0x64')]){if(_0xcf4616[_0x4620('0x5b')]===0x3eb){_0xcf4616[_0x4620('0x67')]=_0x52472b;}}else{if(_0xcf4616[_0x4620('0x5b')]===0x64){if(!_0xcf4616[_0x4620('0x67')]){_0xcf4616['subsections']=[];}_0xcf4616['subsections']=_0xcf4616['subsections'][_0x4620('0x68')](_0x52472b);}}return _0xcf4616;});});}else{return;}})[_0x4620('0x29')](function(_0x1c607e){if(_0x1c607e)_0x4c5460=_0x1c607e;if(_[_0x4620('0x66')](_0x1cb085,0x709)){var _0x5de8ad=_[_0x4620('0x4d')](_0x4c5460,{'sectionId':0x709});return getPlugins(_0x5de8ad)['then'](function(_0x8c3f01){if(_0x5de8ad[_0x4620('0x64')]){return _[_0x4620('0x30')](_0x4c5460,function(_0x1c3339){if(_0x1c3339[_0x4620('0x5b')]===0x709){_0x1c3339[_0x4620('0x67')]=_0x8c3f01;}return _0x1c3339;});}else{var _0x36086d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x8c3f01};var _0x4ce4c6=_[_0x4620('0x30')](_0x4c5460);_0x4ce4c6[_0x4620('0x69')](_0x36086d);return _0x4ce4c6;}});}else{return;}})[_0x4620('0x29')](function(_0x172629){if(_0x172629)_0x4c5460=_0x172629;return _[_0x4620('0x45')](_0x4c5460,[_0x4620('0x64'),0x1]);})['then'](respondWithResult(_0x4222fb,null))[_0x4620('0x4e')](handleError(_0x4222fb,null));};function hasDefaultDashboard(_0x54dd02){var _0x4191c3=[0x65];return new BPromise(function(_0x1a286d,_0xbef14d){try{if(_0x54dd02[_0x4620('0x59')]){_0x1a286d(_0x4191c3);}else{return db[_0x4620('0x5a')]['findOne']({'where':{'sectionId':_0x54dd02['id']},'raw':!![]})['then'](function(_0x400d37){_0x400d37?_0x1a286d(_0x4191c3):_0x1a286d();});}}catch(_0x43ef09){_0xbef14d(_0x43ef09);}});}function getCustomDashboards(_0x300468){var _0x283427=[];return new BPromise(function(_0x5a6e21,_0x36c169){try{if(_0x300468[_0x4620('0x59')]){return db['Dashboard'][_0x4620('0x49')]({'raw':!![]})['then'](function(_0x2631a7){_0x2631a7[_0x4620('0x6a')](function(_0x46797e){_0x283427[_0x4620('0x69')](_0x46797e['id']+0x1869f);});_0x5a6e21(_0x283427);});}else{return db[_0x4620('0x5a')][_0x4620('0x49')]({'where':{'sectionId':_0x300468['id']},'raw':!![]})[_0x4620('0x29')](function(_0x39e269){_0x39e269['forEach'](function(_0x9c9f80){_0x283427['push'](_0x9c9f80[_0x4620('0x6b')]+0x1869f);});_0x5a6e21(_0x283427);});}}catch(_0x3417e5){_0x36c169(_0x3417e5);}});}function getPlugins(_0x1580cd){var _0x1d3ade=[];return new BPromise(function(_0x7c1246,_0x57779e){try{if(_0x1580cd[_0x4620('0x59')]){return db['Plugin'][_0x4620('0x49')]({'raw':!![]})['then'](function(_0x32490a){_0x32490a[_0x4620('0x6a')](function(_0x1b8ce6){_0x1d3ade[_0x4620('0x69')](_0x1b8ce6['id']+0x15b38);});_0x7c1246(_0x1d3ade);});}else{return db['UserProfileResource'][_0x4620('0x49')]({'where':{'sectionId':_0x1580cd['id']},'raw':!![]})['then'](function(_0x175c95){_0x175c95['forEach'](function(_0x5befa4){_0x1d3ade[_0x4620('0x69')](_0x5befa4['resourceId']+0x15b38);});_0x7c1246(_0x1d3ade);});}}catch(_0x2f7f59){_0x57779e(_0x2f7f59);}});}exports[_0x4620('0x6c')]=function(_0x27e2ea,_0x4d9fe1){return db[_0x4620('0x31')][_0x4620('0x4d')]({'where':{'id':_0x27e2ea[_0x4620('0x4c')]['id']}})[_0x4620('0x29')](handleEntityNotFound(_0x4d9fe1,null))[_0x4620('0x29')](function(_0x3b8d4f){if(_0x3b8d4f){return db[_0x4620('0x56')][_0x4620('0x57')](function(_0x18bfd7){return db[_0x4620('0x5d')]['findAll']({'where':{'userProfileId':_0x27e2ea['params']['id']},'attributes':['id'],'raw':!![]})[_0x4620('0x29')](function(_0x185b06){if(_0x185b06){return db[_0x4620('0x5d')][_0x4620('0x2a')]({'where':{'userProfileId':_0x27e2ea[_0x4620('0x4c')]['id'],'id':_['map'](_0x185b06,function(_0x33fcc0){return _0x33fcc0['id'];})},'transaction':_0x18bfd7});}})['then'](function(_0x12f5f3){var _0x55896a=_[_0x4620('0x30')](_0x27e2ea['body'],function(_0x30c43b){_0x30c43b[_0x4620('0x60')]=_0x27e2ea[_0x4620('0x4c')]['id'];return _0x30c43b;});return db[_0x4620('0x5d')][_0x4620('0x6d')](_0x55896a,{'raw':!![],'transaction':_0x18bfd7});})['then'](function(_0x1e14c9){var _0x1e7216=_[_0x4620('0x45')](_[_0x4620('0x30')](_0x1e14c9,function(_0x2cd996){return _0x2cd996[_0x4620('0x58')]({'plain':!![]});}),{'includeAll':![]});if(_0x1e7216){return db[_0x4620('0x5d')][_0x4620('0x49')]({'where':{'userProfileId':_0x27e2ea[_0x4620('0x4c')]['id'],'sectionId':_[_0x4620('0x30')](_0x1e7216,function(_0x26fbdf){return _0x26fbdf[_0x4620('0x5b')];})},'attributes':['id',_0x4620('0x5b')],'raw':!![]})['then'](function(_0x4505f1){var _0x11ee52=_['map'](_0x27e2ea['body'],function(_0x363877){_0x363877['userProfileId']=_0x27e2ea['params']['id'];return _0x363877;});return db[_0x4620('0x5a')]['bulkCreate'](_0x11ee52,{'raw':!![],'transaction':_0x18bfd7});});}})[_0x4620('0x4e')](handleError(_0x4d9fe1,null));});}})[_0x4620('0x29')](function(_0x3b67fc){var _0x23db4f=_[_0x4620('0x30')](_0x3b67fc,function(_0x4cd690){return _0x4cd690['get']({'plain':!![]});});})['then'](respondWithResult(_0x4d9fe1,null))['catch'](handleError(_0x4d9fe1,null));};exports[_0x4620('0x6e')]=function(_0x5b1e1e,_0x3964f7,_0x5ab89a){return db['UserProfile']['find']({'where':{'id':_0x5b1e1e[_0x4620('0x4c')]['id']}})[_0x4620('0x29')](handleEntityNotFound(_0x3964f7,null))[_0x4620('0x29')](function(_0x440f9c){if(_0x440f9c){return _0x440f9c[_0x4620('0x6e')](_0x5b1e1e[_0x4620('0x36')][_0x4620('0x6f')]);}})[_0x4620('0x29')](respondWithStatusCode(_0x3964f7,null))['catch'](handleError(_0x3964f7,null));};exports['getResources']=function(_0x4a9476,_0x3a75e9){var _0x1927c1={};if(!_0x4a9476[_0x4620('0x36')][_0x4620('0x70')])throw new Error(_0x4620('0x71'));if(!_0x4a9476['query'][_0x4620('0x3d')]('nolimit')){_0x1927c1[_0x4620('0x23')]=qs[_0x4620('0x23')](_0x4a9476[_0x4620('0x36')][_0x4620('0x23')]);_0x1927c1['offset']=qs[_0x4620('0x21')](_0x4a9476['query'][_0x4620('0x21')]);}return db[_0x4620('0x31')]['find']({'where':{'id':_0x4a9476['params']['id']}})[_0x4620('0x29')](function(_0x22b476){if(!_0x22b476)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x4a9476[_0x4620('0x4c')]['id']);return db[_0x4620('0x31')]['getResources'](_0x4a9476);})[_0x4620('0x29')](respondWithFilteredResult(_0x3a75e9,_0x1927c1))['catch'](handleError(_0x3a75e9,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index aa9dcc8..8d77890 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 _0xf06c=['../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf06c,0xc7));var _0xcf06=function(_0x2f1cdd,_0x1ffdd7){_0x2f1cdd=_0x2f1cdd-0x0;var _0x5d0956=_0xf06c[_0x2f1cdd];return _0x5d0956;};'use strict';var EventEmitter=require(_0xcf06('0x0'));var UserProfile=require(_0xcf06('0x1'))['db'][_0xcf06('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcf06('0x3')](0x0);var events={'afterCreate':_0xcf06('0x4'),'afterUpdate':'update','afterDestroy':_0xcf06('0x5')};function emitEvent(_0x2b98f4){return function(_0x1d0c26,_0x49218b,_0x171d05){UserProfileEvents[_0xcf06('0x6')](_0x2b98f4+':'+_0x1d0c26['id'],_0x1d0c26);UserProfileEvents[_0xcf06('0x6')](_0x2b98f4,_0x1d0c26);_0x171d05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcf06('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x9536=['../../mysqldb','UserProfile','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9536,0x179));var _0x6953=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x9536[_0x26b8b5];return _0x2150a9;};'use strict';var EventEmitter=require(_0x6953('0x0'));var UserProfile=require(_0x6953('0x1'))['db'][_0x6953('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6953('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6953('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42fb54){return function(_0x3c32c7,_0x1dee7c,_0x3ba964){UserProfileEvents[_0x6953('0x5')](_0x42fb54+':'+_0x3c32c7['id'],_0x3c32c7);UserProfileEvents['emit'](_0x42fb54,_0x3c32c7);_0x3ba964(null);};}for(var e in events){if(events[_0x6953('0x6')](e)){var event=events[e];UserProfile[_0x6953('0x7')](e,emitEvent(event));}}module[_0x6953('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 8a2d0ef..61a25f6 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 _0x0985=['SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','trunks','variables','Plugin','extractedreports','Reports','reportId','metrics','charAt','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','find','all','ignore','autoAssociation','push','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','VIRTUAL','foreignKey','forEach','options','include','reportType','default','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','models','filter','findAll','associatedResources','map','catch','value','then','name','resolve','field','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts'];(function(_0x2bd7a0,_0x34d584){var _0xfaddd5=function(_0x43a70f){while(--_0x43a70f){_0x2bd7a0['push'](_0x2bd7a0['shift']());}};_0xfaddd5(++_0x34d584);}(_0x0985,0x121));var _0x5098=function(_0x2cefec,_0x5e026f){_0x2cefec=_0x2cefec-0x0;var _0x52cd08=_0x0985[_0x2cefec];return _0x52cd08;};'use strict';var _=require(_0x5098('0x0'));var attributes=require(_0x5098('0x1'));var squel=require(_0x5098('0x2'));module['exports']=function(_0x4060da){var _0x424391=_0x4060da[_0x5098('0x3')];function _0x9a3dab(_0x48f63c,_0x37c739){return new Promise(function(_0x49cd96,_0x3f0796){if(!_0x37c739)return _0x49cd96(null);var _0x6f3550=_0x37c739[_0x5098('0x4')]?{[_0x37c739[_0x5098('0x4')]['field']]:_0x37c739[_0x5098('0x4')]['value']}:undefined;return _0x424391[_0x48f63c][_0x5098('0x5')]({'where':_0x6f3550,'raw':!![]})['then'](function(_0x34751d){_0x37c739[_0x5098('0x6')]=_[_0x5098('0x7')](_0x34751d,'id');_0x49cd96(_0x37c739);})[_0x5098('0x8')](function(_0x49f15f){_0x3f0796(_0x49f15f);});});}function _0x108519(_0x58ca81,_0x3c260f){return new Promise(function(_0x3bce4c,_0x40167c){var _0xf7f4fe=_0x58ca81[_0x5098('0x4')]?{[_0x58ca81[_0x5098('0x4')]['field']]:_0x58ca81['filter'][_0x5098('0x9')]}:undefined;return _0x424391[_0x58ca81['model']]['findAll']({'where':_0xf7f4fe,'raw':!![]})[_0x5098('0xa')](function(_0x155b32){_0x3c260f[_0x5098('0x6')]=_[_0x5098('0x7')](_0x155b32,function(_0x4228e7){return _0x4228e7[_0x5098('0xb')];});_0x3bce4c(_0x3c260f);})[_0x5098('0x8')](function(_0x1778e2){_0x40167c(_0x1778e2);});});}function _0x16aab(_0x491efb,_0x21701f,_0x1ff8eb){if(!_0x21701f)return Promise[_0x5098('0xc')](null);return new Promise(function(_0x10307d,_0x2e60cf){return _0x424391['UserProfileResource'][_0x5098('0x5')]({'where':{'sectionId':_0x21701f['id']},'raw':!![]})[_0x5098('0xa')](function(_0x265f6a){if(_0x491efb['field']&&_0x491efb[_0x5098('0xd')]!=='id'){_0x21701f[_0x5098('0x6')]=_[_0x5098('0x7')](_0x265f6a,function(_0x24838b){return _0x24838b[_0x491efb[_0x5098('0xd')]];});}else{if(_0x1ff8eb===_0x5098('0xe')){_0x21701f[_0x5098('0x6')]=_['map'](_0x265f6a,function(_0x265320){return{'id':_0x265320[_0x5098('0xf')],'type':_0x265320['type']};});}else{_0x21701f[_0x5098('0x6')]=_[_0x5098('0x7')](_0x265f6a,function(_0x26bf8f){return _0x26bf8f[_0x5098('0xf')];});}}_0x10307d(_0x21701f);})[_0x5098('0x8')](function(_0x11c1c3){_0x2e60cf(_0x11c1c3);});});}function _0x11033d(_0x46d9fd,_0x41548d){var _0xfc877c={'parentSections':[]};switch(_0x46d9fd[_0x5098('0x10')]()){case _0x5098('0x11'):_0xfc877c['childModel']=_0x5098('0x12');break;case _0x5098('0x13'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x15');break;case _0x5098('0x16'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x17');_0xfc877c[_0x5098('0x18')]=[{'name':_0x5098('0x19'),'field':_0x5098('0xb'),'foreignKey':_0x5098('0x1a')}];break;case _0x5098('0x1b'):_0xfc877c['childModel']=_0x5098('0x1c');break;case _0x5098('0x1d'):_0xfc877c[_0x5098('0x14')]='CmContact';_0xfc877c[_0x5098('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0x5098('0x1e')}];break;case _0x5098('0x1f'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x20');break;case _0x5098('0x21'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x22');break;case _0x5098('0x23'):_0xfc877c['childModel']=_0x5098('0x24');break;case _0x5098('0x25'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x26');break;case _0x5098('0x27'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x28');break;case'faxqueues':_0xfc877c[_0x5098('0x14')]=_0x5098('0x29');break;case'faxaccounts':_0xfc877c['childModel']=_0x5098('0x2a');break;case _0x5098('0x2b'):case'internalroutes':case'outboundroutes':_0xfc877c[_0x5098('0x14')]=_0x5098('0x2c');break;case _0x5098('0x2d'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x2e');break;case _0x5098('0x2f'):_0xfc877c['childModel']=_0x5098('0x30');break;case _0x5098('0x31'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x32');_0xfc877c['parentSections']=[{'name':_0x5098('0x33'),'field':_0x5098('0xb'),'foreignKey':_0x5098('0x34'),'model':_0x5098('0x35'),'filter':{'field':_0x5098('0x36'),'value':['agent']}},{'name':_0x5098('0x37'),'field':_0x5098('0xb'),'foreignKey':_0x5098('0x34'),'model':_0x5098('0x35'),'filter':{'field':_0x5098('0x36'),'value':[_0x5098('0x38')]}},{'name':_0x5098('0x39'),'field':_0x5098('0xb'),'foreignKey':_0x5098('0x3a'),'model':_0x5098('0x3b'),'filter':{'field':_0x5098('0x3c'),'value':[_0x5098('0x3d')]}},{'name':_0x5098('0x3e'),'field':'name','foreignKey':_0x5098('0x3a'),'model':_0x5098('0x3b'),'filter':{'field':'type','value':[_0x5098('0x3f')]}}];break;case'musiconholds':_0xfc877c[_0x5098('0x14')]=_0x5098('0x40');break;case _0x5098('0x41'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x42');break;case _0x5098('0x43'):_0xfc877c[_0x5098('0x14')]='VoicePrefix';break;case _0x5098('0x44'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x45');break;case'mailqueues':_0xfc877c[_0x5098('0x14')]=_0x5098('0x46');break;case'mailaccounts':_0xfc877c[_0x5098('0x14')]=_0x5098('0x47');break;case _0x5098('0x48'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x49');break;case _0x5098('0x4a'):_0xfc877c[_0x5098('0x14')]='OpenchannelQueue';break;case _0x5098('0x4b'):_0xfc877c[_0x5098('0x14')]='OpenchannelAccount';break;case _0x5098('0x4c'):_0xfc877c[_0x5098('0x14')]='SmsQueue';break;case _0x5098('0x4d'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x4e');break;case'whatsappqueues':_0xfc877c[_0x5098('0x14')]=_0x5098('0x4f');break;case _0x5098('0x50'):_0xfc877c['childModel']=_0x5098('0x51');break;case _0x5098('0x52'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x53');break;case _0x5098('0x54'):case'queuecampaigns':_0xfc877c[_0x5098('0x14')]='VoiceQueue';if(_0x41548d){_0xfc877c['parentSections']=[{'name':'VoiceQueues'},{'name':_0x5098('0x3e')}];}break;case _0x5098('0x55'):case _0x5098('0x56'):case _0x5098('0x57'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x35');if(_0x41548d){_0xfc877c[_0x5098('0x18')]=[{'name':_0x5098('0x58'),'filter':{'field':_0x5098('0x36'),'value':[_0x5098('0x59'),_0x5098('0x5a')]},'ignore':!![]},{'name':_0x5098('0x33')},{'name':_0x5098('0x37')}];}break;case _0x5098('0x5b'):_0xfc877c[_0x5098('0x14')]='ZendeskAccount';break;case _0x5098('0x5c'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x5d');break;case _0x5098('0x5e'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x5f');break;case _0x5098('0x60'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x61');break;case _0x5098('0x62'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x63');break;case _0x5098('0x64'):_0xfc877c[_0x5098('0x14')]='ZohoAccount';break;case _0x5098('0x65'):_0xfc877c[_0x5098('0x14')]='User';break;case'cannedanswers':_0xfc877c['childModel']=_0x5098('0x66');break;case _0x5098('0x67'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x68');break;case _0x5098('0x69'):_0xfc877c['childModel']=_0x5098('0x6a');break;case _0x5098('0x6b'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x6c');break;case'pauses':_0xfc877c[_0x5098('0x14')]=_0x5098('0x6d');break;case _0x5098('0x6e'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x6f');break;case _0x5098('0x70'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x71');break;case _0x5098('0x72'):_0xfc877c[_0x5098('0x14')]=_0x5098('0x73');break;case _0x5098('0x74'):_0xfc877c[_0x5098('0x14')]='Template';break;case _0x5098('0x75'):_0xfc877c[_0x5098('0x14')]='Trigger';break;case _0x5098('0x76'):_0xfc877c[_0x5098('0x14')]='Trunk';break;case _0x5098('0x77'):_0xfc877c[_0x5098('0x14')]='Variable';break;case'plugins':_0xfc877c[_0x5098('0x14')]=_0x5098('0x78');break;case _0x5098('0x79'):_0xfc877c[_0x5098('0x14')]=_0x5098('0xe');_0xfc877c[_0x5098('0x18')]=[{'name':_0x5098('0x7a'),'field':'id','foreignKey':_0x5098('0x7b')}];break;case _0x5098('0x7c'):_0xfc877c[_0x5098('0x14')]='AnalyticMetric';break;}return _0xfc877c;}function _0x2d8b03(_0x4b43d3,_0x849170){var _0x3027a8=_0x4b43d3[_0x5098('0x7d')](0x0)['toUpperCase']()+_0x4b43d3[_0x5098('0x7e')](0x1);var _0xe6f505={'type':_0x424391['Sequelize'][_0x5098('0x7f')][_0x5098('0x80')],'raw':!![]};return new Promise(function(_0x51b45c,_0x7fae78){var _0x12d3c6=squel['select']()[_0x5098('0xd')](_0x5098('0x81')+_0x3027a8+_0x5098('0x82'),'id')[_0x5098('0xd')](_0x5098('0x83'))[_0x5098('0x84')](_0x5098('0x85')+_0x4b43d3+'_interactions','ui')[_0x5098('0x86')](_0x5098('0x87'),_0x849170['id']);return _0x424391[_0x5098('0x88')][_0x5098('0x89')](_0x12d3c6[_0x5098('0x8a')](),_0xe6f505)[_0x5098('0xa')](function(_0x4bc93d){_0x849170[_0x3027a8+_0x5098('0x8b')]=_0x4bc93d;_0x51b45c(_0x4bc93d);})[_0x5098('0x8')](function(_0x19df38){_0x7fae78(_0x19df38);});});}return _0x4060da[_0x5098('0x8c')](_0x5098('0x8d'),attributes,{'tableName':_0x5098('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x572095){var _0x1a1d80=require(_0x5098('0x8f'));var _0x518ae0={'raw':_0x572095[_0x5098('0x89')][_0x5098('0x90')],'where':{}};var _0x40c4af={};var _0x43c1a8={'count':0x0,'rows':[]};var _0x1b2b28=_0x572095['query'][_0x5098('0x91')];var _0x404128=_0x572095[_0x5098('0x89')]['mergeResources']||![];var _0xeea0f3=_0x11033d(_0x1b2b28,_0x404128);if(!_0xeea0f3['childModel'])throw new Error(_0x5098('0x92')+_0x1b2b28+'\x27');var _0x1da50b=[{'name':_0x1b2b28}];if(!_[_0x5098('0x93')](_0xeea0f3['parentSections']))_0x1da50b=_0xeea0f3['parentSections'];var _0x512536=[];for(var _0x29c36d=0x0;_0x29c36d<_0x1da50b[_0x5098('0x94')];_0x29c36d++){_0x512536['push'](_0x424391['UserProfileSection'][_0x5098('0x95')]({'where':{'userProfileId':_0x572095['params']['id'],'name':_0x1da50b[_0x29c36d][_0x5098('0xb')]},'raw':!![]}));}return Promise[_0x5098('0x96')](_0x512536)[_0x5098('0xa')](function(_0x5ca808){var _0xe139f9=_[_0x5098('0x4')](_0x5ca808,function(_0x35ec1e){return _0x35ec1e?_0x35ec1e:undefined;});var _0x5d79f6=_[_0x5098('0x4')](_0x1da50b,['ignore',!![]]);var _0x101b36=_[_0x5098('0x93')](_0xe139f9)&&_['isEmpty'](_0x5d79f6)?null:_['union'](_0x5d79f6,_0xe139f9);if(!_0x101b36)return null;var _0x5a5591=[];for(var _0x5b1f3c=0x0;_0x5b1f3c<_0x101b36[_0x5098('0x94')];_0x5b1f3c++){var _0x1a0dc0=_[_0x5098('0x95')](_0x1da50b,function(_0x4e62f9){return _0x101b36[_0x5b1f3c]?_0x4e62f9['name']===_0x101b36[_0x5b1f3c]['name']:null;});if(_0x1a0dc0){if(_0x101b36[_0x5b1f3c][_0x5098('0x97')]){_0x5a5591['push'](_0x9a3dab(_0xeea0f3[_0x5098('0x14')],_0x101b36[_0x5b1f3c]));}else{if(!_0x101b36[_0x5b1f3c][_0x5098('0x98')]){_0x5a5591[_0x5098('0x99')](_0x16aab(_0x1a0dc0,_0x101b36[_0x5b1f3c],_0xeea0f3[_0x5098('0x14')]));}else{if(_0x1a0dc0[_0x5098('0x9a')]){_0x5a5591[_0x5098('0x99')](_0x108519(_0x1a0dc0,_0x101b36[_0x5b1f3c]));}}}}}return Promise[_0x5098('0x96')](_0x5a5591);})[_0x5098('0xa')](function(_0x15c76c){var _0x524219=_0x15c76c;var _0x82d277=null;if(_0x524219){_0x82d277=_0x524219[_0x5098('0x94')]===0x1?_0x524219[0x0]:null;}if(!_0x82d277&&!_0x524219)return _0x43c1a8;var _0xca2808=_0x424391[_0xeea0f3[_0x5098('0x14')]][_0x5098('0x9b')];_0x40c4af['model']=_['keys'](_0xca2808);_0x40c4af[_0x5098('0x89')]=_[_0x5098('0x9c')](_0x572095[_0x5098('0x89')]);_0x40c4af[_0x5098('0x9d')]=_[_0x5098('0x9e')](_0x40c4af['model'],_0x40c4af[_0x5098('0x89')]);_0x518ae0[_0x5098('0x9f')]=_[_0x5098('0x9e')](_0x40c4af[_0x5098('0x9a')],_0x1a1d80[_0x5098('0xa0')](_0x572095[_0x5098('0x89')][_0x5098('0xa0')]));_0x518ae0[_0x5098('0x9f')]=_0x518ae0['attributes'][_0x5098('0x94')]?_0x518ae0[_0x5098('0x9f')]:_0x40c4af[_0x5098('0x9a')];if(!_0x572095[_0x5098('0x89')][_0x5098('0xa1')](_0x5098('0xa2'))){_0x518ae0[_0x5098('0xa3')]=_0x1a1d80[_0x5098('0xa3')](_0x572095[_0x5098('0x89')]['limit']);_0x518ae0[_0x5098('0xa4')]=_0x1a1d80['offset'](_0x572095[_0x5098('0x89')]['offset']);}_0x518ae0[_0x5098('0xa5')]=_0x1a1d80[_0x5098('0xa6')](_0x572095[_0x5098('0x89')]['sort']);_0x518ae0['where']=_0x1a1d80[_0x5098('0x9d')](_['pick'](_0x572095['query'],_0x40c4af[_0x5098('0x9d')]));if(_0x572095[_0x5098('0x89')][_0x5098('0x4')]){_0x518ae0[_0x5098('0x86')]=_[_0x5098('0xa7')](_0x518ae0[_0x5098('0x86')],{'$or':_[_0x5098('0x7')](_0xca2808,function(_0xa697aa){if(_0xa697aa[_0x5098('0x3c')]['key']!==_0x5098('0xa8')){var _0x3d1806={};_0x3d1806[_0xa697aa[_0x5098('0xd')]]={'$like':'%'+_0x572095[_0x5098('0x89')][_0x5098('0x4')]+'%'};return _0x3d1806;}})});}var _0x2e4b4d=[];var _0x1c5763=null;var _0x2be513={};if(_0x82d277){_0x1c5763=_[_0x5098('0x95')](_0x1da50b,['name',_0x82d277[_0x5098('0xb')]]);if(_0x1c5763['field']){_0x2be513={};if(_0xeea0f3[_0x5098('0x14')]==='AnalyticExtractedReport'){_0x2be513[_0x1c5763[_0x5098('0xa9')]]=_[_0x5098('0x7')](_0x82d277[_0x5098('0x6')],'id');}else{_0x2be513[_0x1c5763['foreignKey']]=_0x82d277[_0x5098('0x6')];}_0x2e4b4d[_0x5098('0x99')](_0x2be513);}else{_0x518ae0[_0x5098('0x86')]['id']=_0x82d277['associatedResources'];}}else{for(var _0x3cf028=0x0;_0x3cf028<_0x524219['length'];_0x3cf028++){_0x1c5763=_['find'](_0x1da50b,['name',_0x524219[_0x3cf028]['name']]);if(_0x1c5763[_0x5098('0xd')]){_0x2be513={};_0x2be513[_0x1c5763[_0x5098('0xa9')]]=_0x524219[_0x3cf028][_0x5098('0x6')];_0x2e4b4d[_0x5098('0x99')](_0x2be513);}else{if(!_0x518ae0['where']['id'])_0x518ae0[_0x5098('0x86')]['id']=[];_0x524219[_0x3cf028][_0x5098('0x6')][_0x5098('0xaa')](function(_0x39e7fc){_0x518ae0[_0x5098('0x86')]['id'][_0x5098('0x99')](_0x39e7fc);});}}}if(!_[_0x5098('0x93')](_0x2e4b4d)){_0x518ae0['where']=_[_0x5098('0xa7')](_0x518ae0[_0x5098('0x86')],{'$and':{'$or':_0x2e4b4d}});}_0x518ae0=_[_0x5098('0xa7')]({},_0x518ae0,_0x572095[_0x5098('0xab')]);if(_0x82d277&&!_0x82d277[_0x5098('0x98')]&&_0xeea0f3[_0x5098('0x14')]===_0x5098('0xe')){if(_0x572095['query']['includeAll']){_0x518ae0[_0x5098('0xac')]=[{'all':!![]}];}return _0x424391[_0xeea0f3[_0x5098('0x14')]][_0x5098('0x5')](_0x518ae0)['then'](function(_0x22beb6){var _0x50f284=[];_0x22beb6['forEach'](function(_0x3e6628){var _0x26f201;switch(_0x3e6628[_0x5098('0xad')]){case _0x5098('0xae'):_0x26f201=_['find'](_0x82d277[_0x5098('0x6')],function(_0x40b105){return _0x40b105['id']===_0x3e6628[_0x5098('0x7b')]&&_0x40b105[_0x5098('0x3c')]==='DefaultReports';});break;case'custom':_0x26f201=_[_0x5098('0x95')](_0x82d277[_0x5098('0x6')],function(_0x4163bc){return _0x4163bc['id']===_0x3e6628[_0x5098('0x7b')]&&_0x4163bc[_0x5098('0x3c')]===_0x5098('0xaf');});break;}if(_0x26f201)_0x50f284['push'](_0x3e6628);});_0x43c1a8[_0x5098('0xb0')]=_0x50f284[_0x5098('0x94')];_0x43c1a8[_0x5098('0xb1')]=_0x50f284;return _0x43c1a8;});}else{if(!_['isEmpty'](_0x572095[_0x5098('0x89')]['ids'])){_0x518ae0[_0x5098('0x86')]['id']=_0x518ae0[_0x5098('0x86')]['id']?_[_0x5098('0x9e')](_0x518ae0[_0x5098('0x86')]['id'],_0x572095[_0x5098('0x89')][_0x5098('0xb2')]):_0x572095[_0x5098('0x89')]['ids'];if(_0x572095['query']['customSorting']){_0x518ae0['order']=_0x572095[_0x5098('0x89')][_0x5098('0xb3')];}}if(_0x572095['query'][_0x5098('0xb4')]){_0x518ae0[_0x5098('0x86')]=_[_0x5098('0xa7')](_0x518ae0[_0x5098('0x86')],{'$and':_0x572095[_0x5098('0x89')][_0x5098('0xb4')]});}return _0x424391[_0xeea0f3[_0x5098('0x14')]][_0x5098('0xb0')]({'where':_0x518ae0['where']})[_0x5098('0xa')](function(_0x2f6e47){_0x43c1a8[_0x5098('0xb0')]=_0x2f6e47;if(_0x572095['query']['includeAll']){if(_0xeea0f3[_0x5098('0x14')]===_0x5098('0xb5')){_0x518ae0[_0x5098('0xac')]=[{'model':_0x424391['Tag'],'as':'Tags','attributes':['id',_0x5098('0xb'),_0x5098('0xb6')],'required':_0x572095[_0x5098('0x89')][_0x5098('0xb7')]?!![]:![]},{'model':_0x424391['Tag'],'as':_0x5098('0xb8'),'attributes':['id','name',_0x5098('0xb6')],'through':_0x572095[_0x5098('0x89')][_0x5098('0xb7')]?{'attributes':[],'where':{'TagId':_0x572095[_0x5098('0x89')]['tag']||undefined}}:{},'required':_0x572095[_0x5098('0x89')][_0x5098('0xb7')]?!![]:![]}];}else{_0x518ae0[_0x5098('0xac')]=[{'all':!![]}];}}return _0x424391[_0xeea0f3[_0x5098('0x14')]][_0x5098('0x5')](_0x518ae0);})['then'](function(_0x2aaa09){_0x43c1a8[_0x5098('0xb1')]=_0x2aaa09;if(_0x1b2b28===_0x5098('0x33')&&_0x572095['query'][_0x5098('0xb9')]===_0x5098('0xba')){var _0x1ec87a=[];for(var _0x29fcad=0x0;_0x29fcad<_0x43c1a8[_0x5098('0xb1')][_0x5098('0x94')];_0x29fcad++){_0x1ec87a['push'](_0x2d8b03('chat',_0x43c1a8[_0x5098('0xb1')][_0x29fcad][_0x5098('0xbb')]));_0x1ec87a['push'](_0x2d8b03(_0x5098('0xbc'),_0x43c1a8['rows'][_0x29fcad][_0x5098('0xbb')]));_0x1ec87a[_0x5098('0x99')](_0x2d8b03(_0x5098('0xbd'),_0x43c1a8['rows'][_0x29fcad][_0x5098('0xbb')]));_0x1ec87a[_0x5098('0x99')](_0x2d8b03(_0x5098('0xbe'),_0x43c1a8[_0x5098('0xb1')][_0x29fcad][_0x5098('0xbb')]));_0x1ec87a['push'](_0x2d8b03(_0x5098('0xbf'),_0x43c1a8[_0x5098('0xb1')][_0x29fcad]['dataValues']));_0x1ec87a[_0x5098('0x99')](_0x2d8b03(_0x5098('0xc0'),_0x43c1a8['rows'][_0x29fcad][_0x5098('0xbb')]));}return Promise[_0x5098('0x96')](_0x1ec87a)['then'](function(){return _0x43c1a8;});}return _0x43c1a8;});}});}}});}; \ No newline at end of file +var _0x49ee=['queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','VoiceQueue','VoiceQueues','users','agents','telephones','Telephones','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','toUpperCase','slice','QueryTypes','SELECT','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','openTabs','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatWebsite','faxaccounts','FaxAccount','internalroutes','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','agent','role','telephone','inbound','QueueCampaigns'];(function(_0x30f434,_0x4eae8c){var _0x4c76ea=function(_0xc98bdc){while(--_0xc98bdc){_0x30f434['push'](_0x30f434['shift']());}};_0x4c76ea(++_0x4eae8c);}(_0x49ee,0x88));var _0xe49e=function(_0x367f53,_0x417457){_0x367f53=_0x367f53-0x0;var _0x4c517f=_0x49ee[_0x367f53];return _0x4c517f;};'use strict';var _=require(_0xe49e('0x0'));var attributes=require(_0xe49e('0x1'));var squel=require(_0xe49e('0x2'));module[_0xe49e('0x3')]=function(_0x5a71c5){var _0x1d6cb5=_0x5a71c5[_0xe49e('0x4')];function _0x27b300(_0x264f36,_0x183ffa){return new Promise(function(_0x25eebd,_0x1a384c){if(!_0x183ffa)return _0x25eebd(null);var _0xb3e9ad=_0x183ffa['filter']?{[_0x183ffa[_0xe49e('0x5')][_0xe49e('0x6')]]:_0x183ffa[_0xe49e('0x5')][_0xe49e('0x7')]}:undefined;return _0x1d6cb5[_0x264f36][_0xe49e('0x8')]({'where':_0xb3e9ad,'raw':!![]})[_0xe49e('0x9')](function(_0x3652df){_0x183ffa[_0xe49e('0xa')]=_[_0xe49e('0xb')](_0x3652df,'id');_0x25eebd(_0x183ffa);})['catch'](function(_0x175011){_0x1a384c(_0x175011);});});}function _0x3a0e32(_0x9a7ceb,_0x367c3a){return new Promise(function(_0x3ee9cc,_0x1342c3){var _0xa55d00=_0x9a7ceb['filter']?{[_0x9a7ceb[_0xe49e('0x5')][_0xe49e('0x6')]]:_0x9a7ceb[_0xe49e('0x5')][_0xe49e('0x7')]}:undefined;return _0x1d6cb5[_0x9a7ceb[_0xe49e('0xc')]][_0xe49e('0x8')]({'where':_0xa55d00,'raw':!![]})[_0xe49e('0x9')](function(_0x2c8b73){_0x367c3a['associatedResources']=_[_0xe49e('0xb')](_0x2c8b73,function(_0x22fb9a){return _0x22fb9a[_0xe49e('0xd')];});_0x3ee9cc(_0x367c3a);})['catch'](function(_0x43450b){_0x1342c3(_0x43450b);});});}function _0x54e36e(_0x3f00ac,_0x259d0d,_0x104bbf){if(!_0x259d0d)return Promise[_0xe49e('0xe')](null);return new Promise(function(_0x425377,_0x53ffbf){return _0x1d6cb5[_0xe49e('0xf')][_0xe49e('0x8')]({'where':{'sectionId':_0x259d0d['id']},'raw':!![]})['then'](function(_0x4f9dbd){if(_0x3f00ac[_0xe49e('0x6')]&&_0x3f00ac['field']!=='id'){_0x259d0d['associatedResources']=_[_0xe49e('0xb')](_0x4f9dbd,function(_0x270458){return _0x270458[_0x3f00ac[_0xe49e('0x6')]];});}else{if(_0x104bbf===_0xe49e('0x10')){_0x259d0d[_0xe49e('0xa')]=_[_0xe49e('0xb')](_0x4f9dbd,function(_0x234575){return{'id':_0x234575[_0xe49e('0x11')],'type':_0x234575[_0xe49e('0x12')]};});}else{_0x259d0d[_0xe49e('0xa')]=_[_0xe49e('0xb')](_0x4f9dbd,function(_0x259638){return _0x259638['resourceId'];});}}_0x425377(_0x259d0d);})[_0xe49e('0x13')](function(_0x23bca5){_0x53ffbf(_0x23bca5);});});}function _0x9c160f(_0x33e0ca,_0x3cd1e1){var _0x356a89={'parentSections':[]};switch(_0x33e0ca[_0xe49e('0x14')]()){case'squareprojects':_0x356a89[_0xe49e('0x15')]=_0xe49e('0x16');break;case _0xe49e('0x17'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x18');break;case _0xe49e('0x19'):_0x356a89['childModel']=_0xe49e('0x1a');_0x356a89[_0xe49e('0x1b')]=[{'name':_0xe49e('0x1c'),'field':_0xe49e('0xd'),'foreignKey':_0xe49e('0x1d')}];break;case'projects':_0x356a89['childModel']='JscriptyProject';break;case _0xe49e('0x1e'):_0x356a89[_0xe49e('0x15')]='CmContact';_0x356a89[_0xe49e('0x1b')]=[{'name':_0xe49e('0x1f'),'field':'id','foreignKey':_0xe49e('0x20')}];break;case'lists':_0x356a89[_0xe49e('0x15')]=_0xe49e('0x21');break;case _0xe49e('0x22'):_0x356a89['childModel']=_0xe49e('0x23');break;case _0xe49e('0x24'):_0x356a89[_0xe49e('0x15')]='CmCustomField';break;case _0xe49e('0x25'):_0x356a89[_0xe49e('0x15')]='ChatQueue';break;case'chatwebsites':_0x356a89[_0xe49e('0x15')]=_0xe49e('0x26');break;case'faxqueues':_0x356a89[_0xe49e('0x15')]='FaxQueue';break;case _0xe49e('0x27'):_0x356a89['childModel']=_0xe49e('0x28');break;case'inboundroutes':case _0xe49e('0x29'):case'outboundroutes':_0x356a89['childModel']='VoiceExtension';break;case'contexts':_0x356a89['childModel']=_0xe49e('0x2a');break;case _0xe49e('0x2b'):_0x356a89[_0xe49e('0x15')]='VoiceMail';break;case _0xe49e('0x2c'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x2d');_0x356a89[_0xe49e('0x1b')]=[{'name':_0xe49e('0x2e'),'field':_0xe49e('0xd'),'foreignKey':_0xe49e('0x2f'),'model':_0xe49e('0x30'),'filter':{'field':'role','value':[_0xe49e('0x31')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0xe49e('0x30'),'filter':{'field':_0xe49e('0x32'),'value':[_0xe49e('0x33')]}},{'name':'VoiceQueues','field':_0xe49e('0xd'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xe49e('0x34')]}},{'name':_0xe49e('0x35'),'field':_0xe49e('0xd'),'foreignKey':_0xe49e('0x36'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xe49e('0x37')]}}];break;case _0xe49e('0x38'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x39');break;case _0xe49e('0x3a'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x3b');break;case _0xe49e('0x3c'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x3d');break;case _0xe49e('0x3e'):_0x356a89[_0xe49e('0x15')]='Campaign';break;case _0xe49e('0x3f'):_0x356a89[_0xe49e('0x15')]='MailQueue';break;case _0xe49e('0x40'):_0x356a89['childModel']=_0xe49e('0x41');break;case _0xe49e('0x42'):_0x356a89[_0xe49e('0x15')]='MailSubstatus';break;case _0xe49e('0x43'):_0x356a89[_0xe49e('0x15')]='OpenchannelQueue';break;case _0xe49e('0x44'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x45');break;case _0xe49e('0x46'):_0x356a89['childModel']=_0xe49e('0x47');break;case _0xe49e('0x48'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x49');break;case _0xe49e('0x4a'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x4b');break;case _0xe49e('0x4c'):_0x356a89['childModel']=_0xe49e('0x4d');break;case'teams':_0x356a89[_0xe49e('0x15')]=_0xe49e('0x4e');break;case _0xe49e('0x4f'):case _0xe49e('0x50'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x51');if(_0x3cd1e1){_0x356a89[_0xe49e('0x1b')]=[{'name':_0xe49e('0x52')},{'name':_0xe49e('0x35')}];}break;case _0xe49e('0x53'):case _0xe49e('0x54'):case _0xe49e('0x55'):_0x356a89[_0xe49e('0x15')]='User';if(_0x3cd1e1){_0x356a89[_0xe49e('0x1b')]=[{'name':'Users','filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xe49e('0x56')}];}break;case'zendeskaccounts':_0x356a89[_0xe49e('0x15')]='ZendeskAccount';break;case'salesforceaccounts':_0x356a89[_0xe49e('0x15')]=_0xe49e('0x57');break;case'freshdeskaccounts':_0x356a89[_0xe49e('0x15')]=_0xe49e('0x58');break;case _0xe49e('0x59'):_0x356a89['childModel']=_0xe49e('0x5a');break;case _0xe49e('0x5b'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x5c');break;case'zohoaccounts':_0x356a89[_0xe49e('0x15')]=_0xe49e('0x5d');break;case'vtigeraccounts':_0x356a89['childModel']=_0xe49e('0x30');break;case _0xe49e('0x5e'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x5f');break;case _0xe49e('0x60'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x61');break;case _0xe49e('0x62'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x63');break;case _0xe49e('0x64'):_0x356a89['childModel']=_0xe49e('0x65');break;case'pauses':_0x356a89[_0xe49e('0x15')]='Pause';break;case _0xe49e('0x66'):_0x356a89['childModel']=_0xe49e('0x67');break;case _0xe49e('0x68'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x69');break;case _0xe49e('0x6a'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x6b');break;case _0xe49e('0x6c'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x6d');break;case _0xe49e('0x6e'):_0x356a89[_0xe49e('0x15')]='Trigger';break;case _0xe49e('0x6f'):_0x356a89[_0xe49e('0x15')]='Trunk';break;case _0xe49e('0x70'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x71');break;case _0xe49e('0x72'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x73');break;case _0xe49e('0x74'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x10');_0x356a89['parentSections']=[{'name':_0xe49e('0x75'),'field':'id','foreignKey':'reportId'}];break;case _0xe49e('0x76'):_0x356a89[_0xe49e('0x15')]=_0xe49e('0x77');break;}return _0x356a89;}function _0x1a3df2(_0x28605f,_0x475e2e){var _0x41f39b=_0x28605f['charAt'](0x0)[_0xe49e('0x78')]()+_0x28605f[_0xe49e('0x79')](0x1);var _0x5c3986={'type':_0x1d6cb5['Sequelize'][_0xe49e('0x7a')][_0xe49e('0x7b')],'raw':!![]};return new Promise(function(_0x25b0d2,_0x38d667){var _0x377589=squel['select']()['field']('ui.'+_0x41f39b+_0xe49e('0x7c'),'id')['field'](_0xe49e('0x7d'))[_0xe49e('0x7e')](_0xe49e('0x7f')+_0x28605f+_0xe49e('0x80'),'ui')[_0xe49e('0x81')](_0xe49e('0x82'),_0x475e2e['id']);return _0x1d6cb5['sequelize'][_0xe49e('0x83')](_0x377589['toString'](),_0x5c3986)['then'](function(_0x3ead04){_0x475e2e[_0x41f39b+_0xe49e('0x84')]=_0x3ead04;_0x25b0d2(_0x3ead04);})['catch'](function(_0x38bda3){_0x38d667(_0x38bda3);});});}return _0x5a71c5[_0xe49e('0x85')](_0xe49e('0x86'),attributes,{'tableName':_0xe49e('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1303bc){var _0x5cad72=require(_0xe49e('0x88'));var _0x2afb42={'raw':_0x1303bc['query']['raw'],'where':{}};var _0x288d2c={};var _0xabcd18={'count':0x0,'rows':[]};var _0x543247=_0x1303bc[_0xe49e('0x83')]['section'];var _0x1079b2=_0x1303bc[_0xe49e('0x83')][_0xe49e('0x89')]||![];var _0x2112cc=_0x9c160f(_0x543247,_0x1079b2);if(!_0x2112cc[_0xe49e('0x15')])throw new Error(_0xe49e('0x8a')+_0x543247+'\x27');var _0x5f4775=[{'name':_0x543247}];if(!_[_0xe49e('0x8b')](_0x2112cc[_0xe49e('0x1b')]))_0x5f4775=_0x2112cc['parentSections'];var _0x296800=[];for(var _0x556fd7=0x0;_0x556fd7<_0x5f4775[_0xe49e('0x8c')];_0x556fd7++){_0x296800[_0xe49e('0x8d')](_0x1d6cb5[_0xe49e('0x8e')][_0xe49e('0x8f')]({'where':{'userProfileId':_0x1303bc[_0xe49e('0x90')]['id'],'name':_0x5f4775[_0x556fd7][_0xe49e('0xd')]},'raw':!![]}));}return Promise[_0xe49e('0x91')](_0x296800)['then'](function(_0x4b46f1){var _0x76759b=_['filter'](_0x4b46f1,function(_0x3e4d06){return _0x3e4d06?_0x3e4d06:undefined;});var _0x12350b=_[_0xe49e('0x5')](_0x5f4775,['ignore',!![]]);var _0x2381b7=_['isEmpty'](_0x76759b)&&_['isEmpty'](_0x12350b)?null:_['union'](_0x12350b,_0x76759b);if(!_0x2381b7)return null;var _0x363da9=[];for(var _0x3dd16c=0x0;_0x3dd16c<_0x2381b7[_0xe49e('0x8c')];_0x3dd16c++){var _0x9f66c3=_[_0xe49e('0x8f')](_0x5f4775,function(_0x22e661){return _0x2381b7[_0x3dd16c]?_0x22e661[_0xe49e('0xd')]===_0x2381b7[_0x3dd16c][_0xe49e('0xd')]:null;});if(_0x9f66c3){if(_0x2381b7[_0x3dd16c]['ignore']){_0x363da9['push'](_0x27b300(_0x2112cc['childModel'],_0x2381b7[_0x3dd16c]));}else{if(!_0x2381b7[_0x3dd16c]['autoAssociation']){_0x363da9[_0xe49e('0x8d')](_0x54e36e(_0x9f66c3,_0x2381b7[_0x3dd16c],_0x2112cc[_0xe49e('0x15')]));}else{if(_0x9f66c3['model']){_0x363da9[_0xe49e('0x8d')](_0x3a0e32(_0x9f66c3,_0x2381b7[_0x3dd16c]));}}}}}return Promise[_0xe49e('0x91')](_0x363da9);})[_0xe49e('0x9')](function(_0x47cd97){var _0x197752=_0x47cd97;var _0x4fdb83=null;if(_0x197752){_0x4fdb83=_0x197752['length']===0x1?_0x197752[0x0]:null;}if(!_0x4fdb83&&!_0x197752)return _0xabcd18;var _0x2c4194=_0x1d6cb5[_0x2112cc[_0xe49e('0x15')]][_0xe49e('0x92')];_0x288d2c[_0xe49e('0xc')]=_['keys'](_0x2c4194);_0x288d2c['query']=_[_0xe49e('0x93')](_0x1303bc[_0xe49e('0x83')]);_0x288d2c[_0xe49e('0x94')]=_[_0xe49e('0x95')](_0x288d2c[_0xe49e('0xc')],_0x288d2c['query']);_0x2afb42[_0xe49e('0x96')]=_['intersection'](_0x288d2c[_0xe49e('0xc')],_0x5cad72[_0xe49e('0x97')](_0x1303bc['query'][_0xe49e('0x97')]));_0x2afb42[_0xe49e('0x96')]=_0x2afb42[_0xe49e('0x96')][_0xe49e('0x8c')]?_0x2afb42['attributes']:_0x288d2c[_0xe49e('0xc')];if(!_0x1303bc[_0xe49e('0x83')][_0xe49e('0x98')](_0xe49e('0x99'))){_0x2afb42[_0xe49e('0x9a')]=_0x5cad72[_0xe49e('0x9a')](_0x1303bc[_0xe49e('0x83')][_0xe49e('0x9a')]);_0x2afb42['offset']=_0x5cad72[_0xe49e('0x9b')](_0x1303bc[_0xe49e('0x83')]['offset']);}_0x2afb42[_0xe49e('0x9c')]=_0x5cad72[_0xe49e('0x9d')](_0x1303bc[_0xe49e('0x83')][_0xe49e('0x9d')]);_0x2afb42[_0xe49e('0x81')]=_0x5cad72[_0xe49e('0x94')](_[_0xe49e('0x9e')](_0x1303bc[_0xe49e('0x83')],_0x288d2c[_0xe49e('0x94')]));if(_0x1303bc[_0xe49e('0x83')][_0xe49e('0x5')]){_0x2afb42[_0xe49e('0x81')]=_['merge'](_0x2afb42[_0xe49e('0x81')],{'$or':_[_0xe49e('0xb')](_0x2c4194,function(_0x2a83bc){if(_0x2a83bc['type'][_0xe49e('0x9f')]!==_0xe49e('0xa0')){var _0x447ee2={};_0x447ee2[_0x2a83bc[_0xe49e('0x6')]]={'$like':'%'+_0x1303bc[_0xe49e('0x83')][_0xe49e('0x5')]+'%'};return _0x447ee2;}})});}var _0x3eb00a=[];var _0x435f5b=null;var _0x513426={};if(_0x4fdb83){_0x435f5b=_['find'](_0x5f4775,[_0xe49e('0xd'),_0x4fdb83[_0xe49e('0xd')]]);if(_0x435f5b[_0xe49e('0x6')]){_0x513426={};if(_0x2112cc[_0xe49e('0x15')]===_0xe49e('0x10')){_0x513426[_0x435f5b[_0xe49e('0xa1')]]=_[_0xe49e('0xb')](_0x4fdb83[_0xe49e('0xa')],'id');}else{_0x513426[_0x435f5b[_0xe49e('0xa1')]]=_0x4fdb83['associatedResources'];}_0x3eb00a[_0xe49e('0x8d')](_0x513426);}else{_0x2afb42[_0xe49e('0x81')]['id']=_0x4fdb83[_0xe49e('0xa')];}}else{for(var _0x97700c=0x0;_0x97700c<_0x197752[_0xe49e('0x8c')];_0x97700c++){_0x435f5b=_['find'](_0x5f4775,['name',_0x197752[_0x97700c][_0xe49e('0xd')]]);if(_0x435f5b[_0xe49e('0x6')]){_0x513426={};_0x513426[_0x435f5b['foreignKey']]=_0x197752[_0x97700c][_0xe49e('0xa')];_0x3eb00a[_0xe49e('0x8d')](_0x513426);}else{if(!_0x2afb42['where']['id'])_0x2afb42[_0xe49e('0x81')]['id']=[];_0x197752[_0x97700c][_0xe49e('0xa')][_0xe49e('0xa2')](function(_0x168ab8){_0x2afb42[_0xe49e('0x81')]['id']['push'](_0x168ab8);});}}}if(!_[_0xe49e('0x8b')](_0x3eb00a)){_0x2afb42[_0xe49e('0x81')]=_[_0xe49e('0xa3')](_0x2afb42[_0xe49e('0x81')],{'$and':{'$or':_0x3eb00a}});}_0x2afb42=_[_0xe49e('0xa3')]({},_0x2afb42,_0x1303bc[_0xe49e('0xa4')]);if(_0x4fdb83&&!_0x4fdb83['autoAssociation']&&_0x2112cc['childModel']===_0xe49e('0x10')){if(_0x1303bc['query'][_0xe49e('0xa5')]){_0x2afb42[_0xe49e('0xa6')]=[{'all':!![]}];}return _0x1d6cb5[_0x2112cc[_0xe49e('0x15')]][_0xe49e('0x8')](_0x2afb42)[_0xe49e('0x9')](function(_0x347b18){var _0x1fe6cf=[];_0x347b18['forEach'](function(_0x5b29c8){var _0x24b0bd;switch(_0x5b29c8[_0xe49e('0xa7')]){case _0xe49e('0xa8'):_0x24b0bd=_[_0xe49e('0x8f')](_0x4fdb83[_0xe49e('0xa')],function(_0x294335){return _0x294335['id']===_0x5b29c8[_0xe49e('0xa9')]&&_0x294335['type']===_0xe49e('0xaa');});break;case _0xe49e('0xab'):_0x24b0bd=_[_0xe49e('0x8f')](_0x4fdb83[_0xe49e('0xa')],function(_0x4cbee9){return _0x4cbee9['id']===_0x5b29c8[_0xe49e('0xa9')]&&_0x4cbee9[_0xe49e('0x12')]===_0xe49e('0xac');});break;}if(_0x24b0bd)_0x1fe6cf[_0xe49e('0x8d')](_0x5b29c8);});_0xabcd18[_0xe49e('0xad')]=_0x1fe6cf['length'];_0xabcd18[_0xe49e('0xae')]=_0x1fe6cf;return _0xabcd18;});}else{if(!_['isEmpty'](_0x1303bc[_0xe49e('0x83')][_0xe49e('0xaf')])){_0x2afb42[_0xe49e('0x81')]['id']=_0x2afb42['where']['id']?_[_0xe49e('0x95')](_0x2afb42[_0xe49e('0x81')]['id'],_0x1303bc[_0xe49e('0x83')][_0xe49e('0xaf')]):_0x1303bc['query'][_0xe49e('0xaf')];if(_0x1303bc[_0xe49e('0x83')][_0xe49e('0xb0')]){_0x2afb42['order']=_0x1303bc[_0xe49e('0x83')][_0xe49e('0xb0')];}}if(_0x1303bc['query'][_0xe49e('0xb1')]){_0x2afb42[_0xe49e('0x81')]=_[_0xe49e('0xa3')](_0x2afb42['where'],{'$and':_0x1303bc['query'][_0xe49e('0xb1')]});}return _0x1d6cb5[_0x2112cc['childModel']][_0xe49e('0xad')]({'where':_0x2afb42['where']})[_0xe49e('0x9')](function(_0xe6459b){_0xabcd18[_0xe49e('0xad')]=_0xe6459b;if(_0x1303bc['query'][_0xe49e('0xa5')]){if(_0x2112cc[_0xe49e('0x15')]===_0xe49e('0xb2')){_0x2afb42[_0xe49e('0xa6')]=[{'model':_0x1d6cb5[_0xe49e('0x6b')],'as':_0xe49e('0xb3'),'attributes':['id','name',_0xe49e('0xb4')],'required':_0x1303bc[_0xe49e('0x83')][_0xe49e('0xb5')]?!![]:![]},{'model':_0x1d6cb5[_0xe49e('0x6b')],'as':_0xe49e('0xb6'),'attributes':['id',_0xe49e('0xd'),'color'],'through':_0x1303bc[_0xe49e('0x83')]['tag']?{'attributes':[],'where':{'TagId':_0x1303bc[_0xe49e('0x83')][_0xe49e('0xb5')]||undefined}}:{},'required':_0x1303bc[_0xe49e('0x83')]['tag']?!![]:![]}];}else{_0x2afb42[_0xe49e('0xa6')]=[{'all':!![]}];}}return _0x1d6cb5[_0x2112cc[_0xe49e('0x15')]][_0xe49e('0x8')](_0x2afb42);})['then'](function(_0x269552){_0xabcd18[_0xe49e('0xae')]=_0x269552;if(_0x543247==='Agents'&&_0x1303bc[_0xe49e('0x83')][_0xe49e('0xb7')]==='true'){var _0x2b7049=[];for(var _0x11315b=0x0;_0x11315b<_0xabcd18[_0xe49e('0xae')][_0xe49e('0x8c')];_0x11315b++){_0x2b7049[_0xe49e('0x8d')](_0x1a3df2(_0xe49e('0xb8'),_0xabcd18[_0xe49e('0xae')][_0x11315b][_0xe49e('0xb9')]));_0x2b7049[_0xe49e('0x8d')](_0x1a3df2('sms',_0xabcd18[_0xe49e('0xae')][_0x11315b][_0xe49e('0xb9')]));_0x2b7049['push'](_0x1a3df2(_0xe49e('0xba'),_0xabcd18[_0xe49e('0xae')][_0x11315b][_0xe49e('0xb9')]));_0x2b7049[_0xe49e('0x8d')](_0x1a3df2(_0xe49e('0xbb'),_0xabcd18[_0xe49e('0xae')][_0x11315b]['dataValues']));_0x2b7049['push'](_0x1a3df2(_0xe49e('0xbc'),_0xabcd18[_0xe49e('0xae')][_0x11315b][_0xe49e('0xb9')]));_0x2b7049[_0xe49e('0x8d')](_0x1a3df2(_0xe49e('0xbd'),_0xabcd18[_0xe49e('0xae')][_0x11315b][_0xe49e('0xb9')]));}return Promise[_0xe49e('0x91')](_0x2b7049)[_0xe49e('0x9')](function(){return _0xabcd18;});}return _0xabcd18;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e384a77..9ae12c9 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 _0xc1c6=['./userProfile.socket','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x2282da,_0x52eb53){var _0xaf90de=function(_0x4fffd2){while(--_0x4fffd2){_0x2282da['push'](_0x2282da['shift']());}};_0xaf90de(++_0x52eb53);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xf7d9e,_0x4f1286){_0xf7d9e=_0xf7d9e-0x0;var _0x3829c6=_0xc1c6[_0xf7d9e];return _0x3829c6;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});config['redis']=_[_0x6c1c('0x9')](config[_0x6c1c('0xa')],{'host':_0x6c1c('0xb'),'port':0x18eb});var socket=require(_0x6c1c('0xc'))(new Redis(config['redis']));require(_0x6c1c('0xd'))[_0x6c1c('0xe')](socket);function respondWithRpcPromise(_0x524d21,_0x147c7b,_0x36275f){return new BPromise(function(_0xb3bd12,_0x1137e8){return client['request'](_0x524d21,_0x36275f)[_0x6c1c('0xf')](function(_0x2a4fd4){logger[_0x6c1c('0x10')]('UserProfile,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));logger[_0x6c1c('0x12')](_0x6c1c('0x13'),_0x147c7b,'request\x20sent',JSON[_0x6c1c('0x14')](_0x2a4fd4));if(_0x2a4fd4['error']){if(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x16')]===0x1f4){logger[_0x6c1c('0x15')](_0x6c1c('0x17'),_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0x1137e8(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);}logger[_0x6c1c('0x15')]('UserProfile,\x20%s,\x20%s',_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0xb3bd12(_0x2a4fd4['error'][_0x6c1c('0x18')]);}else{logger[_0x6c1c('0x10')]('UserProfile,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));_0xb3bd12(_0x2a4fd4['result'][_0x6c1c('0x18')]);}})[_0x6c1c('0x19')](function(_0x5a3bb7){logger[_0x6c1c('0x15')]('UserProfile,\x20%s,\x20%s',_0x147c7b,_0x5a3bb7);_0x1137e8(_0x5a3bb7);});});} \ No newline at end of file +var _0x7669=['error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x53758c,_0x5664af){var _0x425eff=function(_0x3d0c89){while(--_0x3d0c89){_0x53758c['push'](_0x53758c['shift']());}};_0x425eff(++_0x5664af);}(_0x7669,0xe5));var _0x9766=function(_0x2a457e,_0x465501){_0x2a457e=_0x2a457e-0x0;var _0x4b7e33=_0x7669[_0x2a457e];return _0x4b7e33;};'use strict';var _=require(_0x9766('0x0'));var util=require(_0x9766('0x1'));var moment=require(_0x9766('0x2'));var BPromise=require('bluebird');var rs=require(_0x9766('0x3'));var fs=require('fs');var Redis=require(_0x9766('0x4'));var db=require(_0x9766('0x5'))['db'];var utils=require(_0x9766('0x6'));var logger=require(_0x9766('0x7'))(_0x9766('0x8'));var config=require('../../config/environment');var jayson=require(_0x9766('0x9'));var client=jayson[_0x9766('0xa')][_0x9766('0xb')]({'port':0x232a});config[_0x9766('0xc')]=_['defaults'](config[_0x9766('0xc')],{'host':_0x9766('0xd'),'port':0x18eb});var socket=require(_0x9766('0xe'))(new Redis(config[_0x9766('0xc')]));require(_0x9766('0xf'))['register'](socket);function respondWithRpcPromise(_0x11fda4,_0x4a2ce3,_0xb06699){return new BPromise(function(_0x52afa9,_0x3f66a4){return client['request'](_0x11fda4,_0xb06699)[_0x9766('0x10')](function(_0x55ac40){logger[_0x9766('0x11')](_0x9766('0x12'),_0x4a2ce3,'request\x20sent');logger['debug'](_0x9766('0x13'),_0x4a2ce3,'request\x20sent',JSON[_0x9766('0x14')](_0x55ac40));if(_0x55ac40['error']){if(_0x55ac40[_0x9766('0x15')][_0x9766('0x16')]===0x1f4){logger['error'](_0x9766('0x12'),_0x4a2ce3,_0x55ac40['error'][_0x9766('0x17')]);return _0x3f66a4(_0x55ac40[_0x9766('0x15')][_0x9766('0x17')]);}logger[_0x9766('0x15')](_0x9766('0x12'),_0x4a2ce3,_0x55ac40[_0x9766('0x15')]['message']);return _0x52afa9(_0x55ac40[_0x9766('0x15')][_0x9766('0x17')]);}else{logger[_0x9766('0x11')]('UserProfile,\x20%s,\x20%s',_0x4a2ce3,'request\x20sent');_0x52afa9(_0x55ac40['result'][_0x9766('0x17')]);}})[_0x9766('0x18')](function(_0x1a76e8){logger[_0x9766('0x15')](_0x9766('0x12'),_0x4a2ce3,_0x1a76e8);_0x3f66a4(_0x1a76e8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ba04724..658723d 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 _0x93d1=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','length'];(function(_0x547a41,_0x5970d8){var _0x5d93dd=function(_0x435c19){while(--_0x435c19){_0x547a41['push'](_0x547a41['shift']());}};_0x5d93dd(++_0x5970d8);}(_0x93d1,0xe1));var _0x193d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93d1[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0x193d('0x0'));var events=[_0x193d('0x1'),_0x193d('0x2'),_0x193d('0x3')];function createListener(_0x17be25,_0x27a457){return function(_0x6fd9e2){_0x27a457[_0x193d('0x4')](_0x17be25,_0x6fd9e2);};}function removeListener(_0x11fcd0,_0x335812){return function(){UserProfileEvents[_0x193d('0x5')](_0x11fcd0,_0x335812);};}exports['register']=function(_0x50eecb){for(var _0x49105d=0x0,_0x5e8a80=events[_0x193d('0x6')];_0x49105d<_0x5e8a80;_0x49105d++){var _0x13c47c=events[_0x49105d];var _0x377b37=createListener(_0x193d('0x7')+_0x13c47c,_0x50eecb);UserProfileEvents['on'](_0x13c47c,_0x377b37);}}; \ No newline at end of file +var _0x9718=['register','userProfile:','save','remove','update','emit','removeListener'];(function(_0x43c665,_0x1bc27c){var _0xe6a049=function(_0x319c44){while(--_0x319c44){_0x43c665['push'](_0x43c665['shift']());}};_0xe6a049(++_0x1bc27c);}(_0x9718,0x72));var _0x8971=function(_0x48d0b2,_0x429fe8){_0x48d0b2=_0x48d0b2-0x0;var _0x4d3bb0=_0x9718[_0x48d0b2];return _0x4d3bb0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x8971('0x0'),_0x8971('0x1'),_0x8971('0x2')];function createListener(_0x5789ae,_0x5055a5){return function(_0x571879){_0x5055a5[_0x8971('0x3')](_0x5789ae,_0x571879);};}function removeListener(_0x3472ef,_0x24f988){return function(){UserProfileEvents[_0x8971('0x4')](_0x3472ef,_0x24f988);};}exports[_0x8971('0x5')]=function(_0x2af77b){for(var _0x22a4bd=0x0,_0x142963=events['length'];_0x22a4bd<_0x142963;_0x22a4bd++){var _0x13e396=events[_0x22a4bd];var _0x3286a5=createListener(_0x8971('0x6')+_0x13e396,_0x2af77b);UserProfileEvents['on'](_0x13e396,_0x3286a5);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 90e21c2..5e7b430 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 _0x8bea=['connect-timeout','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x5ebefa,_0x3fae58){var _0x2fd025=function(_0x6d97c2){while(--_0x6d97c2){_0x5ebefa['push'](_0x5ebefa['shift']());}};_0x2fd025(++_0x3fae58);}(_0x8bea,0x116));var _0xa8be=function(_0x5bd2cc,_0xde799c){_0x5bd2cc=_0x5bd2cc-0x0;var _0x163414=_0x8bea[_0x5bd2cc];return _0x163414;};'use strict';var multer=require(_0xa8be('0x0'));var util=require('util');var path=require(_0xa8be('0x1'));var timeout=require(_0xa8be('0x2'));var express=require('express');var router=express[_0xa8be('0x3')]();var fs_extra=require(_0xa8be('0x4'));var auth=require(_0xa8be('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8be('0x6'));router[_0xa8be('0x7')]('/',auth[_0xa8be('0x8')](),controller[_0xa8be('0x9')]);router[_0xa8be('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xa8be('0xa')]);router[_0xa8be('0x7')](_0xa8be('0xb'),auth[_0xa8be('0x8')](),controller[_0xa8be('0xc')]);router[_0xa8be('0xd')]('/',auth[_0xa8be('0x8')](),controller[_0xa8be('0xe')]);router[_0xa8be('0xf')](_0xa8be('0xb'),auth[_0xa8be('0x8')](),controller[_0xa8be('0x10')]);router[_0xa8be('0x11')](_0xa8be('0xb'),auth['isAuthenticated'](),controller[_0xa8be('0x12')]);module[_0xa8be('0x13')]=router; \ No newline at end of file +var _0x8b41=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util'];(function(_0x477501,_0x10c7d9){var _0x5660a2=function(_0x226fb1){while(--_0x226fb1){_0x477501['push'](_0x477501['shift']());}};_0x5660a2(++_0x10c7d9);}(_0x8b41,0x8b));var _0x18b4=function(_0x32506e,_0x18ed00){_0x32506e=_0x32506e-0x0;var _0x3d0d81=_0x8b41[_0x32506e];return _0x3d0d81;};'use strict';var multer=require('multer');var util=require(_0x18b4('0x0'));var path=require('path');var timeout=require(_0x18b4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x18b4('0x2'));var auth=require(_0x18b4('0x3'));var interaction=require(_0x18b4('0x4'));var config=require(_0x18b4('0x5'));var controller=require(_0x18b4('0x6'));router[_0x18b4('0x7')]('/',auth[_0x18b4('0x8')](),controller[_0x18b4('0x9')]);router[_0x18b4('0x7')](_0x18b4('0xa'),auth[_0x18b4('0x8')](),controller[_0x18b4('0xb')]);router[_0x18b4('0x7')](_0x18b4('0xc'),auth[_0x18b4('0x8')](),controller[_0x18b4('0xd')]);router[_0x18b4('0xe')]('/',auth[_0x18b4('0x8')](),controller[_0x18b4('0xf')]);router['put'](_0x18b4('0xc'),auth[_0x18b4('0x8')](),controller[_0x18b4('0x10')]);router[_0x18b4('0x11')](_0x18b4('0xc'),auth[_0x18b4('0x8')](),controller[_0x18b4('0x12')]);module[_0x18b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a7388d0..afee06f 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 _0xb51f=['STRING','exports'];(function(_0x32e2b1,_0x373090){var _0x25ea39=function(_0x248fec){while(--_0x248fec){_0x32e2b1['push'](_0x32e2b1['shift']());}};_0x25ea39(++_0x373090);}(_0xb51f,0x1e5));var _0xfb51=function(_0xa601a2,_0x47718e){_0xa601a2=_0xa601a2-0x0;var _0x54af8a=_0xb51f[_0xa601a2];return _0x54af8a;};'use strict';var Sequelize=require('sequelize');module[_0xfb51('0x0')]={'name':{'type':Sequelize[_0xfb51('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xfb51('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7e62=['sequelize','exports','INTEGER','STRING'];(function(_0xc2178b,_0x1fd47f){var _0x586c27=function(_0x2a051a){while(--_0x2a051a){_0xc2178b['push'](_0xc2178b['shift']());}};_0x586c27(++_0x1fd47f);}(_0x7e62,0x104));var _0x27e6=function(_0x3ad2a8,_0x5b92d1){_0x3ad2a8=_0x3ad2a8-0x0;var _0x1df92f=_0x7e62[_0x3ad2a8];return _0x1df92f;};'use strict';var Sequelize=require(_0x27e6('0x0'));module[_0x27e6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x27e6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x27e6('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9b8c624..2066db4 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 _0x1a85=['describe','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','destroy'];(function(_0x51b107,_0x14db61){var _0x49e137=function(_0x3c63f1){while(--_0x3c63f1){_0x51b107['push'](_0x51b107['shift']());}};_0x49e137(++_0x14db61);}(_0x1a85,0x178));var _0x51a8=function(_0x26797a,_0x104240){_0x26797a=_0x26797a-0x0;var _0xeb5295=_0x1a85[_0x26797a];return _0xeb5295;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['UserProfileResource'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));};exports['describe']=function(_0x21c4da,_0xc89617){return db[_0x51a8('0x2a')][_0x51a8('0x4a')]()[_0x51a8('0x23')](respondWithResult(_0xc89617,null))[_0x51a8('0x41')](handleError(_0xc89617,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(_0x240860,_0x20c04d){var _0x40e288=function(_0x38a753){while(--_0x38a753){_0x240860['push'](_0x240860['shift']());}};_0x40e288(++_0x20c04d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x422b8,_0x2a823e){_0x422b8=_0x422b8-0x0;var _0x531ebc=_0x5f2f[_0x422b8];return _0x531ebc;};'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 87cd5f7..d31efca 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 _0x5298=['bluebird','request-promise','path','rimraf','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','moment'];(function(_0x26ba7a,_0x5e8eb2){var _0x57221c=function(_0x20c821){while(--_0x20c821){_0x26ba7a['push'](_0x26ba7a['shift']());}};_0x57221c(++_0x5e8eb2);}(_0x5298,0x123));var _0x8529=function(_0x508281,_0x45a585){_0x508281=_0x508281-0x0;var _0x1f109b=_0x5298[_0x508281];return _0x1f109b;};'use strict';var _=require(_0x8529('0x0'));var util=require(_0x8529('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8529('0x2'));var BPromise=require(_0x8529('0x3'));var rp=require(_0x8529('0x4'));var fs=require('fs');var path=require(_0x8529('0x5'));var rimraf=require(_0x8529('0x6'));var config=require('../../config/environment');var attributes=require(_0x8529('0x7'));module['exports']=function(_0x709094,_0x40ed6d){return _0x709094[_0x8529('0x8')](_0x8529('0x9'),attributes,{'tableName':_0x8529('0xa'),'paranoid':![],'indexes':[{'name':_0x8529('0xb'),'fields':[_0x8529('0xc'),_0x8529('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x123e=['lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0xcf4569,_0x1ce755){var _0x7fef=function(_0x374ab8){while(--_0x374ab8){_0xcf4569['push'](_0xcf4569['shift']());}};_0x7fef(++_0x1ce755);}(_0x123e,0x104));var _0xe123=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x123e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe123('0x0'));var util=require('util');var logger=require(_0xe123('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe123('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe123('0x3'));var rimraf=require(_0xe123('0x4'));var config=require(_0xe123('0x5'));var attributes=require(_0xe123('0x6'));module[_0xe123('0x7')]=function(_0x23c694,_0x40e758){return _0x23c694[_0xe123('0x8')]('UserProfileResource',attributes,{'tableName':_0xe123('0x9'),'paranoid':![],'indexes':[{'name':_0xe123('0xa'),'fields':[_0xe123('0xb'),_0xe123('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d665b26..6d361cf 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 _0x7e90=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x58df59,_0x1c10aa){var _0xd89c19=function(_0x3cdba9){while(--_0x3cdba9){_0x58df59['push'](_0x58df59['shift']());}};_0xd89c19(++_0x1c10aa);}(_0x7e90,0x119));var _0x07e9=function(_0x235a67,_0x5e9eca){_0x235a67=_0x235a67-0x0;var _0x40b140=_0x7e90[_0x235a67];return _0x40b140;};'use strict';var _=require('lodash');var util=require(_0x07e9('0x0'));var moment=require(_0x07e9('0x1'));var BPromise=require(_0x07e9('0x2'));var rs=require(_0x07e9('0x3'));var fs=require('fs');var Redis=require(_0x07e9('0x4'));var db=require(_0x07e9('0x5'))['db'];var utils=require(_0x07e9('0x6'));var logger=require(_0x07e9('0x7'))(_0x07e9('0x8'));var config=require(_0x07e9('0x9'));var jayson=require(_0x07e9('0xa'));var client=jayson[_0x07e9('0xb')][_0x07e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b1885,_0x39d36d,_0x2f6506){return new BPromise(function(_0x17b638,_0x39be6c){return client['request'](_0x4b1885,_0x2f6506)[_0x07e9('0xd')](function(_0x2160ad){logger[_0x07e9('0xe')](_0x07e9('0xf'),_0x39d36d,'request\x20sent');logger[_0x07e9('0x10')](_0x07e9('0x11'),_0x39d36d,_0x07e9('0x12'),JSON[_0x07e9('0x13')](_0x2160ad));if(_0x2160ad[_0x07e9('0x14')]){if(_0x2160ad[_0x07e9('0x14')][_0x07e9('0x15')]===0x1f4){logger[_0x07e9('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x39d36d,_0x2160ad['error']['message']);return _0x39be6c(_0x2160ad[_0x07e9('0x14')]['message']);}logger[_0x07e9('0x14')](_0x07e9('0xf'),_0x39d36d,_0x2160ad[_0x07e9('0x14')][_0x07e9('0x16')]);return _0x17b638(_0x2160ad[_0x07e9('0x14')][_0x07e9('0x16')]);}else{logger[_0x07e9('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x39d36d,'request\x20sent');_0x17b638(_0x2160ad[_0x07e9('0x17')][_0x07e9('0x16')]);}})['catch'](function(_0x139922){logger[_0x07e9('0x14')](_0x07e9('0xf'),_0x39d36d,_0x139922);_0x39be6c(_0x139922);});});} \ No newline at end of file +var _0xa573=['stringify','error','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x5554ab,_0x52b733){var _0x13642f=function(_0x12501d){while(--_0x12501d){_0x5554ab['push'](_0x5554ab['shift']());}};_0x13642f(++_0x52b733);}(_0xa573,0x1a7));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a57('0x0'));var util=require(_0x3a57('0x1'));var moment=require('moment');var BPromise=require(_0x3a57('0x2'));var rs=require(_0x3a57('0x3'));var fs=require('fs');var Redis=require(_0x3a57('0x4'));var db=require(_0x3a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a57('0x6'))(_0x3a57('0x7'));var config=require(_0x3a57('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a57('0x9')][_0x3a57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3964f5,_0x1a7517,_0x37bed9){return new BPromise(function(_0x33d767,_0x3db99b){return client[_0x3a57('0xb')](_0x3964f5,_0x37bed9)[_0x3a57('0xc')](function(_0x2f8d00){logger[_0x3a57('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x1a7517,_0x3a57('0xe'));logger[_0x3a57('0xf')](_0x3a57('0x10'),_0x1a7517,_0x3a57('0xe'),JSON[_0x3a57('0x11')](_0x2f8d00));if(_0x2f8d00[_0x3a57('0x12')]){if(_0x2f8d00[_0x3a57('0x12')]['code']===0x1f4){logger[_0x3a57('0x12')](_0x3a57('0x13'),_0x1a7517,_0x2f8d00['error'][_0x3a57('0x14')]);return _0x3db99b(_0x2f8d00['error'][_0x3a57('0x14')]);}logger[_0x3a57('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x1a7517,_0x2f8d00[_0x3a57('0x12')]['message']);return _0x33d767(_0x2f8d00[_0x3a57('0x12')][_0x3a57('0x14')]);}else{logger[_0x3a57('0xd')](_0x3a57('0x13'),_0x1a7517,'request\x20sent');_0x33d767(_0x2f8d00['result']['message']);}})[_0x3a57('0x15')](function(_0x51087b){logger[_0x3a57('0x12')](_0x3a57('0x13'),_0x1a7517,_0x51087b);_0x3db99b(_0x51087b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8e7f72f..3dd6b7d 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 _0xa364=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','index','/describe','describe','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x6a969b,_0x343a6e){var _0x4d8180=function(_0x15977b){while(--_0x15977b){_0x6a969b['push'](_0x6a969b['shift']());}};_0x4d8180(++_0x343a6e);}(_0xa364,0x1e5));var _0x4a36=function(_0xd73283,_0x123abd){_0xd73283=_0xd73283-0x0;var _0xb50931=_0xa364[_0xd73283];return _0xb50931;};'use strict';var multer=require('multer');var util=require(_0x4a36('0x0'));var path=require('path');var timeout=require(_0x4a36('0x1'));var express=require(_0x4a36('0x2'));var router=express[_0x4a36('0x3')]();var fs_extra=require(_0x4a36('0x4'));var auth=require(_0x4a36('0x5'));var interaction=require(_0x4a36('0x6'));var config=require(_0x4a36('0x7'));var controller=require(_0x4a36('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4a36('0x9')]);router['get'](_0x4a36('0xa'),auth['isAuthenticated'](),controller[_0x4a36('0xb')]);router[_0x4a36('0xc')](_0x4a36('0xd'),auth[_0x4a36('0xe')](),controller[_0x4a36('0xf')]);router[_0x4a36('0x10')]('/',auth[_0x4a36('0xe')](),controller[_0x4a36('0x11')]);router['put'](_0x4a36('0xd'),auth['isAuthenticated'](),controller[_0x4a36('0x12')]);router[_0x4a36('0x13')](_0x4a36('0xd'),auth['isAuthenticated'](),controller[_0x4a36('0x14')]);module[_0x4a36('0x15')]=router; \ No newline at end of file +var _0x3486=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x4b4197,_0x606d82){var _0x203195=function(_0x5124cc){while(--_0x5124cc){_0x4b4197['push'](_0x4b4197['shift']());}};_0x203195(++_0x606d82);}(_0x3486,0xd9));var _0x6348=function(_0x4fbf33,_0x318fbc){_0x4fbf33=_0x4fbf33-0x0;var _0x1997d2=_0x3486[_0x4fbf33];return _0x1997d2;};'use strict';var multer=require(_0x6348('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6348('0x1'));var express=require(_0x6348('0x2'));var router=express[_0x6348('0x3')]();var fs_extra=require(_0x6348('0x4'));var auth=require(_0x6348('0x5'));var interaction=require(_0x6348('0x6'));var config=require(_0x6348('0x7'));var controller=require(_0x6348('0x8'));router[_0x6348('0x9')]('/',auth[_0x6348('0xa')](),controller[_0x6348('0xb')]);router[_0x6348('0x9')](_0x6348('0xc'),auth[_0x6348('0xa')](),controller[_0x6348('0xd')]);router['get'](_0x6348('0xe'),auth[_0x6348('0xa')](),controller[_0x6348('0xf')]);router[_0x6348('0x10')]('/',auth['isAuthenticated'](),controller[_0x6348('0x11')]);router[_0x6348('0x12')](_0x6348('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6348('0x13')](_0x6348('0xe'),auth[_0x6348('0xa')](),controller[_0x6348('0x14')]);module[_0x6348('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index fe98f77..40e3d30 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 _0x58a4=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3cdaec,_0x5c9e03){var _0x2624e7=function(_0xf0c3c9){while(--_0xf0c3c9){_0x3cdaec['push'](_0x3cdaec['shift']());}};_0x2624e7(++_0x5c9e03);}(_0x58a4,0xbf));var _0x458a=function(_0x44db8e,_0x143b54){_0x44db8e=_0x44db8e-0x0;var _0x40667a=_0x58a4[_0x44db8e];return _0x40667a;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'name':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x458a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x458a('0x2')],'set':function(_0x362079){this[_0x458a('0x5')](_0x458a('0x6'),_0x362079?_0x362079[_0x458a('0x7')](''):[]);},'get':function(){return this[_0x458a('0x8')]('crudPermissions')?this['getDataValue'](_0x458a('0x6'))[_0x458a('0x9')](''):[];}}}; \ No newline at end of file +var _0xdb94=['INTEGER','BOOLEAN','crudPermissions','sequelize','exports','STRING'];(function(_0x1da5e9,_0x4f9a3a){var _0x1c62f8=function(_0x6227c8){while(--_0x6227c8){_0x1da5e9['push'](_0x1da5e9['shift']());}};_0x1c62f8(++_0x4f9a3a);}(_0xdb94,0xab));var _0x4db9=function(_0x96331f,_0x4de06f){_0x96331f=_0x96331f-0x0;var _0x526427=_0xdb94[_0x96331f];return _0x526427;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'name':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4db9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4db9('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4db9('0x2')],'set':function(_0x554bd5){this['setDataValue'](_0x4db9('0x5'),_0x554bd5?_0x554bd5['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4db9('0x5'))?this['getDataValue'](_0x4db9('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 2a10d8e..687f733 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 _0x300a=['sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','UserProfileSection','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2552c9,_0x47c37a){var _0x34ef3f=function(_0x324ac9){while(--_0x324ac9){_0x2552c9['push'](_0x2552c9['shift']());}};_0x34ef3f(++_0x47c37a);}(_0x300a,0x1ec));var _0xa300=function(_0x4f5c2a,_0x465535){_0x4f5c2a=_0x4f5c2a-0x0;var _0x1b2e6e=_0x300a[_0x4f5c2a];return _0x1b2e6e;};'use strict';var emlformat=require(_0xa300('0x0'));var rimraf=require(_0xa300('0x1'));var zipdir=require(_0xa300('0x2'));var jsonpatch=require(_0xa300('0x3'));var rp=require(_0xa300('0x4'));var moment=require(_0xa300('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa300('0x6'));var path=require(_0xa300('0x7'));var sox=require(_0xa300('0x8'));var csv=require(_0xa300('0x9'));var ejs=require(_0xa300('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa300('0xb'));var squel=require(_0xa300('0xc'));var crypto=require('crypto');var jsforce=require(_0xa300('0xd'));var deskjs=require(_0xa300('0xe'));var toCsv=require(_0xa300('0x9'));var querystring=require(_0xa300('0xf'));var Papa=require('papaparse');var Redis=require(_0xa300('0x10'));var authService=require(_0xa300('0x11'));var qs=require(_0xa300('0x12'));var as=require(_0xa300('0x13'));var hardwareService=require(_0xa300('0x14'));var logger=require(_0xa300('0x15'))(_0xa300('0x16'));var utils=require(_0xa300('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa300('0x18'));var db=require(_0xa300('0x19'))['db'];function respondWithStatusCode(_0x657fb8,_0x22a559){_0x22a559=_0x22a559||0xcc;return function(_0x4beff9){if(_0x4beff9){return _0x657fb8[_0xa300('0x1a')](_0x22a559);}return _0x657fb8[_0xa300('0x1b')](_0x22a559)[_0xa300('0x1c')]();};}function respondWithResult(_0x5cbc92,_0x274935){_0x274935=_0x274935||0xc8;return function(_0xcd9c2f){if(_0xcd9c2f){return _0x5cbc92[_0xa300('0x1b')](_0x274935)['json'](_0xcd9c2f);}};}function respondWithFilteredResult(_0x30755e,_0x2a255f){return function(_0xba3d16){if(_0xba3d16){var _0x204935=typeof _0x2a255f[_0xa300('0x1d')]===_0xa300('0x1e')&&typeof _0x2a255f['limit']===_0xa300('0x1e');var _0xecae18=_0xba3d16[_0xa300('0x1f')];var _0x2e184e=_0x204935?0x0:_0x2a255f['offset'];var _0x3b4bf1=_0x204935?_0xba3d16['count']:_0x2a255f['offset']+_0x2a255f[_0xa300('0x20')];var _0xa8c39b;if(_0x3b4bf1>=_0xecae18){_0x3b4bf1=_0xecae18;_0xa8c39b=0xc8;}else{_0xa8c39b=0xce;}_0x30755e[_0xa300('0x1b')](_0xa8c39b);return _0x30755e[_0xa300('0x21')](_0xa300('0x22'),_0x2e184e+'-'+_0x3b4bf1+'/'+_0xecae18)['json'](_0xba3d16);}return null;};}function patchUpdates(_0x49f3c9){return function(_0x197395){try{jsonpatch[_0xa300('0x23')](_0x197395,_0x49f3c9,!![]);}catch(_0x23a94e){return BPromise[_0xa300('0x24')](_0x23a94e);}return _0x197395['save']();};}function saveUpdates(_0x1ab879,_0x1040fe){return function(_0x1ba029){if(_0x1ba029){return _0x1ba029[_0xa300('0x25')](_0x1ab879)[_0xa300('0x26')](function(_0x1e0389){return _0x1e0389;});}return null;};}function removeEntity(_0x33e2ba,_0x3d6eb4){return function(_0x197d93){if(_0x197d93){return _0x197d93[_0xa300('0x27')]()['then'](function(){_0x33e2ba[_0xa300('0x1b')](0xcc)[_0xa300('0x1c')]();});}};}function handleEntityNotFound(_0x565fa8,_0x9d7480){return function(_0xaaa50f){if(!_0xaaa50f){_0x565fa8[_0xa300('0x1a')](0x194);}return _0xaaa50f;};}function handleError(_0x4eb44e,_0x3c1fdc){_0x3c1fdc=_0x3c1fdc||0x1f4;return function(_0x1d8547){logger['error'](_0x1d8547[_0xa300('0x28')]);if(_0x1d8547[_0xa300('0x29')]){delete _0x1d8547[_0xa300('0x29')];}_0x4eb44e[_0xa300('0x1b')](_0x3c1fdc)['send'](_0x1d8547);};}exports[_0xa300('0x2a')]=function(_0x75b8c8,_0x2a48be){var _0x19e73c={},_0x1816b6={},_0x32e26d={'count':0x0,'rows':[]};var _0x304654=_['map'](db[_0xa300('0x2b')][_0xa300('0x2c')],function(_0x37eff2){return{'name':_0x37eff2[_0xa300('0x2d')],'type':_0x37eff2['type']['key']};});_0x1816b6[_0xa300('0x2e')]=_[_0xa300('0x2f')](_0x304654,_0xa300('0x29'));_0x1816b6[_0xa300('0x30')]=_['keys'](_0x75b8c8[_0xa300('0x30')]);_0x1816b6[_0xa300('0x31')]=_[_0xa300('0x32')](_0x1816b6[_0xa300('0x2e')],_0x1816b6['query']);_0x19e73c[_0xa300('0x33')]=_[_0xa300('0x32')](_0x1816b6[_0xa300('0x2e')],qs[_0xa300('0x34')](_0x75b8c8[_0xa300('0x30')][_0xa300('0x34')]));_0x19e73c[_0xa300('0x33')]=_0x19e73c[_0xa300('0x33')][_0xa300('0x35')]?_0x19e73c['attributes']:_0x1816b6['model'];if(!_0x75b8c8[_0xa300('0x30')][_0xa300('0x36')]('nolimit')){_0x19e73c['limit']=qs[_0xa300('0x20')](_0x75b8c8[_0xa300('0x30')][_0xa300('0x20')]);_0x19e73c[_0xa300('0x1d')]=qs[_0xa300('0x1d')](_0x75b8c8[_0xa300('0x30')]['offset']);}_0x19e73c[_0xa300('0x37')]=qs[_0xa300('0x38')](_0x75b8c8[_0xa300('0x30')]['sort']);_0x19e73c[_0xa300('0x39')]=qs[_0xa300('0x31')](_['pick'](_0x75b8c8[_0xa300('0x30')],_0x1816b6[_0xa300('0x31')]),_0x304654);if(_0x75b8c8[_0xa300('0x30')][_0xa300('0x3a')]){_0x19e73c[_0xa300('0x39')]=_['merge'](_0x19e73c[_0xa300('0x39')],{'$or':_['map'](_0x304654,function(_0x31b0df){if(_0x31b0df[_0xa300('0x3b')]!==_0xa300('0x3c')){var _0x55b498={};_0x55b498[_0x31b0df[_0xa300('0x29')]]={'$like':'%'+_0x75b8c8[_0xa300('0x30')][_0xa300('0x3a')]+'%'};return _0x55b498;}})});}_0x19e73c=_[_0xa300('0x3d')]({},_0x19e73c,_0x75b8c8[_0xa300('0x3e')]);var _0x380837={'where':_0x19e73c[_0xa300('0x39')]};return db[_0xa300('0x2b')][_0xa300('0x1f')](_0x380837)[_0xa300('0x26')](function(_0x2531cd){_0x32e26d[_0xa300('0x1f')]=_0x2531cd;if(_0x75b8c8['query'][_0xa300('0x3f')]){_0x19e73c['include']=[{'all':!![]}];}return db[_0xa300('0x2b')]['findAll'](_0x19e73c);})['then'](function(_0x36cd1d){_0x32e26d[_0xa300('0x40')]=_0x36cd1d;return _0x32e26d;})[_0xa300('0x26')](respondWithFilteredResult(_0x2a48be,_0x19e73c))[_0xa300('0x41')](handleError(_0x2a48be,null));};exports[_0xa300('0x42')]=function(_0xd9b4fd,_0x3a529f){var _0x42821a={'raw':![],'where':{'id':_0xd9b4fd[_0xa300('0x43')]['id']}},_0x1e5063={};_0x1e5063[_0xa300('0x2e')]=_[_0xa300('0x44')](db['UserProfileSection']['rawAttributes']);_0x1e5063[_0xa300('0x30')]=_[_0xa300('0x44')](_0xd9b4fd[_0xa300('0x30')]);_0x1e5063[_0xa300('0x31')]=_['intersection'](_0x1e5063[_0xa300('0x2e')],_0x1e5063[_0xa300('0x30')]);_0x42821a[_0xa300('0x33')]=_[_0xa300('0x32')](_0x1e5063['model'],qs[_0xa300('0x34')](_0xd9b4fd['query'][_0xa300('0x34')]));_0x42821a['attributes']=_0x42821a[_0xa300('0x33')][_0xa300('0x35')]?_0x42821a[_0xa300('0x33')]:_0x1e5063[_0xa300('0x2e')];if(_0xd9b4fd[_0xa300('0x30')][_0xa300('0x3f')]){_0x42821a[_0xa300('0x45')]=[{'all':!![]}];}_0x42821a=_[_0xa300('0x3d')]({},_0x42821a,_0xd9b4fd[_0xa300('0x3e')]);return db[_0xa300('0x2b')][_0xa300('0x46')](_0x42821a)[_0xa300('0x26')](handleEntityNotFound(_0x3a529f,null))[_0xa300('0x26')](respondWithResult(_0x3a529f,null))['catch'](handleError(_0x3a529f,null));};exports[_0xa300('0x47')]=function(_0x11731b,_0x16141b){return db['UserProfileSection'][_0xa300('0x47')](_0x11731b['body'],{})['then'](respondWithResult(_0x16141b,0xc9))[_0xa300('0x41')](handleError(_0x16141b,null));};exports[_0xa300('0x25')]=function(_0x24486a,_0x25ca28){if(_0x24486a[_0xa300('0x48')]['id']){delete _0x24486a[_0xa300('0x48')]['id'];}return db[_0xa300('0x2b')][_0xa300('0x46')]({'where':{'id':_0x24486a[_0xa300('0x43')]['id']}})['then'](handleEntityNotFound(_0x25ca28,null))[_0xa300('0x26')](saveUpdates(_0x24486a[_0xa300('0x48')],null))[_0xa300('0x26')](respondWithResult(_0x25ca28,null))[_0xa300('0x41')](handleError(_0x25ca28,null));};exports[_0xa300('0x27')]=function(_0x4848fc,_0x4e16f9){return db[_0xa300('0x2b')][_0xa300('0x46')]({'where':{'id':_0x4848fc[_0xa300('0x43')]['id']}})[_0xa300('0x26')](handleEntityNotFound(_0x4e16f9,null))[_0xa300('0x26')](removeEntity(_0x4e16f9,null))[_0xa300('0x41')](handleError(_0x4e16f9,null));};exports[_0xa300('0x49')]=function(_0x4ead6f,_0x40427c){return db[_0xa300('0x2b')][_0xa300('0x49')]()['then'](respondWithResult(_0x40427c,null))[_0xa300('0x41')](handleError(_0x40427c,null));}; \ No newline at end of file +var _0x0ca9=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','UserProfileSection','includeAll','include','rows','show','params','rawAttributes','intersection','merge','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x48accc,_0x3142e9){var _0x460cc4=function(_0x4af897){while(--_0x4af897){_0x48accc['push'](_0x48accc['shift']());}};_0x460cc4(++_0x3142e9);}(_0x0ca9,0x16e));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x90ca('0x0'));var rimraf=require(_0x90ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90ca('0x2'));var rp=require(_0x90ca('0x3'));var moment=require('moment');var BPromise=require(_0x90ca('0x4'));var Mustache=require(_0x90ca('0x5'));var util=require(_0x90ca('0x6'));var path=require(_0x90ca('0x7'));var sox=require(_0x90ca('0x8'));var csv=require(_0x90ca('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90ca('0xa'));var _=require(_0x90ca('0xb'));var squel=require(_0x90ca('0xc'));var crypto=require(_0x90ca('0xd'));var jsforce=require(_0x90ca('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x90ca('0x9'));var querystring=require(_0x90ca('0xf'));var Papa=require(_0x90ca('0x10'));var Redis=require(_0x90ca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x90ca('0x12'));var as=require(_0x90ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90ca('0x14'))('api');var utils=require(_0x90ca('0x15'));var config=require(_0x90ca('0x16'));var licenseUtil=require(_0x90ca('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xccf4d7,_0x2b7f03){_0x2b7f03=_0x2b7f03||0xcc;return function(_0x4d0aa3){if(_0x4d0aa3){return _0xccf4d7['sendStatus'](_0x2b7f03);}return _0xccf4d7[_0x90ca('0x18')](_0x2b7f03)[_0x90ca('0x19')]();};}function respondWithResult(_0x2b0f75,_0xd920b){_0xd920b=_0xd920b||0xc8;return function(_0xad1075){if(_0xad1075){return _0x2b0f75[_0x90ca('0x18')](_0xd920b)['json'](_0xad1075);}};}function respondWithFilteredResult(_0x165ee6,_0x122ac7){return function(_0x2c8554){if(_0x2c8554){var _0x40db03=typeof _0x122ac7[_0x90ca('0x1a')]===_0x90ca('0x1b')&&typeof _0x122ac7['limit']===_0x90ca('0x1b');var _0x503efe=_0x2c8554['count'];var _0x223314=_0x40db03?0x0:_0x122ac7['offset'];var _0x1d4494=_0x40db03?_0x2c8554[_0x90ca('0x1c')]:_0x122ac7[_0x90ca('0x1a')]+_0x122ac7[_0x90ca('0x1d')];var _0xd8a19c;if(_0x1d4494>=_0x503efe){_0x1d4494=_0x503efe;_0xd8a19c=0xc8;}else{_0xd8a19c=0xce;}_0x165ee6[_0x90ca('0x18')](_0xd8a19c);return _0x165ee6[_0x90ca('0x1e')](_0x90ca('0x1f'),_0x223314+'-'+_0x1d4494+'/'+_0x503efe)[_0x90ca('0x20')](_0x2c8554);}return null;};}function patchUpdates(_0x334657){return function(_0x4a7315){try{jsonpatch['apply'](_0x4a7315,_0x334657,!![]);}catch(_0xc863b2){return BPromise[_0x90ca('0x21')](_0xc863b2);}return _0x4a7315[_0x90ca('0x22')]();};}function saveUpdates(_0x1adbdc,_0x5b53a8){return function(_0x5dd5f9){if(_0x5dd5f9){return _0x5dd5f9[_0x90ca('0x23')](_0x1adbdc)[_0x90ca('0x24')](function(_0x327d50){return _0x327d50;});}return null;};}function removeEntity(_0x6b605e,_0x31276){return function(_0x49904b){if(_0x49904b){return _0x49904b[_0x90ca('0x25')]()[_0x90ca('0x24')](function(){_0x6b605e[_0x90ca('0x18')](0xcc)[_0x90ca('0x19')]();});}};}function handleEntityNotFound(_0x357199,_0x3c7d0d){return function(_0x52f919){if(!_0x52f919){_0x357199[_0x90ca('0x26')](0x194);}return _0x52f919;};}function handleError(_0x3a62cc,_0x3d0eb7){_0x3d0eb7=_0x3d0eb7||0x1f4;return function(_0x5f0bb4){logger[_0x90ca('0x27')](_0x5f0bb4['stack']);if(_0x5f0bb4[_0x90ca('0x28')]){delete _0x5f0bb4[_0x90ca('0x28')];}_0x3a62cc[_0x90ca('0x18')](_0x3d0eb7)[_0x90ca('0x29')](_0x5f0bb4);};}exports[_0x90ca('0x2a')]=function(_0x258c19,_0x1861ca){var _0x4cbe0b={},_0x4bb8a0={},_0x5c222d={'count':0x0,'rows':[]};var _0x5c2f1e=_[_0x90ca('0x2b')](db['UserProfileSection']['rawAttributes'],function(_0x144500){return{'name':_0x144500[_0x90ca('0x2c')],'type':_0x144500['type'][_0x90ca('0x2d')]};});_0x4bb8a0[_0x90ca('0x2e')]=_[_0x90ca('0x2b')](_0x5c2f1e,_0x90ca('0x28'));_0x4bb8a0[_0x90ca('0x2f')]=_[_0x90ca('0x30')](_0x258c19[_0x90ca('0x2f')]);_0x4bb8a0[_0x90ca('0x31')]=_['intersection'](_0x4bb8a0[_0x90ca('0x2e')],_0x4bb8a0['query']);_0x4cbe0b['attributes']=_['intersection'](_0x4bb8a0[_0x90ca('0x2e')],qs[_0x90ca('0x32')](_0x258c19[_0x90ca('0x2f')]['fields']));_0x4cbe0b[_0x90ca('0x33')]=_0x4cbe0b['attributes'][_0x90ca('0x34')]?_0x4cbe0b['attributes']:_0x4bb8a0[_0x90ca('0x2e')];if(!_0x258c19[_0x90ca('0x2f')]['hasOwnProperty'](_0x90ca('0x35'))){_0x4cbe0b[_0x90ca('0x1d')]=qs[_0x90ca('0x1d')](_0x258c19[_0x90ca('0x2f')][_0x90ca('0x1d')]);_0x4cbe0b[_0x90ca('0x1a')]=qs['offset'](_0x258c19['query'][_0x90ca('0x1a')]);}_0x4cbe0b[_0x90ca('0x36')]=qs['sort'](_0x258c19['query'][_0x90ca('0x37')]);_0x4cbe0b[_0x90ca('0x38')]=qs['filters'](_[_0x90ca('0x39')](_0x258c19['query'],_0x4bb8a0[_0x90ca('0x31')]),_0x5c2f1e);if(_0x258c19[_0x90ca('0x2f')][_0x90ca('0x3a')]){_0x4cbe0b['where']=_['merge'](_0x4cbe0b[_0x90ca('0x38')],{'$or':_['map'](_0x5c2f1e,function(_0x178056){if(_0x178056[_0x90ca('0x3b')]!==_0x90ca('0x3c')){var _0x180981={};_0x180981[_0x178056[_0x90ca('0x28')]]={'$like':'%'+_0x258c19[_0x90ca('0x2f')][_0x90ca('0x3a')]+'%'};return _0x180981;}})});}_0x4cbe0b=_['merge']({},_0x4cbe0b,_0x258c19[_0x90ca('0x3d')]);var _0x3a2e33={'where':_0x4cbe0b[_0x90ca('0x38')]};return db[_0x90ca('0x3e')][_0x90ca('0x1c')](_0x3a2e33)[_0x90ca('0x24')](function(_0x369751){_0x5c222d[_0x90ca('0x1c')]=_0x369751;if(_0x258c19['query'][_0x90ca('0x3f')]){_0x4cbe0b[_0x90ca('0x40')]=[{'all':!![]}];}return db[_0x90ca('0x3e')]['findAll'](_0x4cbe0b);})['then'](function(_0x370266){_0x5c222d[_0x90ca('0x41')]=_0x370266;return _0x5c222d;})[_0x90ca('0x24')](respondWithFilteredResult(_0x1861ca,_0x4cbe0b))['catch'](handleError(_0x1861ca,null));};exports[_0x90ca('0x42')]=function(_0x34bcdb,_0x11d87a){var _0x186ad5={'raw':![],'where':{'id':_0x34bcdb[_0x90ca('0x43')]['id']}},_0xa14066={};_0xa14066[_0x90ca('0x2e')]=_[_0x90ca('0x30')](db[_0x90ca('0x3e')][_0x90ca('0x44')]);_0xa14066[_0x90ca('0x2f')]=_[_0x90ca('0x30')](_0x34bcdb[_0x90ca('0x2f')]);_0xa14066[_0x90ca('0x31')]=_[_0x90ca('0x45')](_0xa14066[_0x90ca('0x2e')],_0xa14066[_0x90ca('0x2f')]);_0x186ad5[_0x90ca('0x33')]=_['intersection'](_0xa14066['model'],qs['fields'](_0x34bcdb[_0x90ca('0x2f')][_0x90ca('0x32')]));_0x186ad5['attributes']=_0x186ad5[_0x90ca('0x33')][_0x90ca('0x34')]?_0x186ad5[_0x90ca('0x33')]:_0xa14066[_0x90ca('0x2e')];if(_0x34bcdb[_0x90ca('0x2f')][_0x90ca('0x3f')]){_0x186ad5[_0x90ca('0x40')]=[{'all':!![]}];}_0x186ad5=_[_0x90ca('0x46')]({},_0x186ad5,_0x34bcdb[_0x90ca('0x3d')]);return db[_0x90ca('0x3e')][_0x90ca('0x47')](_0x186ad5)[_0x90ca('0x24')](handleEntityNotFound(_0x11d87a,null))['then'](respondWithResult(_0x11d87a,null))[_0x90ca('0x48')](handleError(_0x11d87a,null));};exports[_0x90ca('0x49')]=function(_0x5e0b7e,_0x592c5e){return db[_0x90ca('0x3e')][_0x90ca('0x49')](_0x5e0b7e['body'],{})[_0x90ca('0x24')](respondWithResult(_0x592c5e,0xc9))[_0x90ca('0x48')](handleError(_0x592c5e,null));};exports[_0x90ca('0x23')]=function(_0x38d0cf,_0x53e529){if(_0x38d0cf[_0x90ca('0x4a')]['id']){delete _0x38d0cf[_0x90ca('0x4a')]['id'];}return db['UserProfileSection'][_0x90ca('0x47')]({'where':{'id':_0x38d0cf[_0x90ca('0x43')]['id']}})['then'](handleEntityNotFound(_0x53e529,null))[_0x90ca('0x24')](saveUpdates(_0x38d0cf['body'],null))[_0x90ca('0x24')](respondWithResult(_0x53e529,null))['catch'](handleError(_0x53e529,null));};exports[_0x90ca('0x25')]=function(_0x26d2f9,_0x5c26a2){return db['UserProfileSection']['find']({'where':{'id':_0x26d2f9[_0x90ca('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c26a2,null))['then'](removeEntity(_0x5c26a2,null))[_0x90ca('0x48')](handleError(_0x5c26a2,null));};exports[_0x90ca('0x4b')]=function(_0x3fcd9e,_0x28d2d7){return db[_0x90ca('0x3e')]['describe']()[_0x90ca('0x24')](respondWithResult(_0x28d2d7,null))[_0x90ca('0x48')](handleError(_0x28d2d7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 71fe19b..441f6ea 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 _0xede6=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x311f71,_0x1adbd7){var _0x318ac1=function(_0x33536e){while(--_0x33536e){_0x311f71['push'](_0x311f71['shift']());}};_0x318ac1(++_0x1adbd7);}(_0xede6,0x10a));var _0x6ede=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xede6[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x6ede('0x0'));var logger=require(_0x6ede('0x1'))(_0x6ede('0x2'));var moment=require(_0x6ede('0x3'));var BPromise=require(_0x6ede('0x4'));var rp=require(_0x6ede('0x5'));var fs=require('fs');var path=require(_0x6ede('0x6'));var rimraf=require(_0x6ede('0x7'));var config=require(_0x6ede('0x8'));var attributes=require(_0x6ede('0x9'));module[_0x6ede('0xa')]=function(_0x2fc458,_0x5c93d4){return _0x2fc458[_0x6ede('0xb')](_0x6ede('0xc'),attributes,{'tableName':_0x6ede('0xd'),'paranoid':![],'indexes':[{'name':_0x6ede('0xe'),'fields':[_0x6ede('0xf'),_0x6ede('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa13d=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define'];(function(_0x1dc4c4,_0xf617bf){var _0x2eb3c4=function(_0x51c4a9){while(--_0x51c4a9){_0x1dc4c4['push'](_0x1dc4c4['shift']());}};_0x2eb3c4(++_0xf617bf);}(_0xa13d,0x11d));var _0xda13=function(_0x15843a,_0x4ea098){_0x15843a=_0x15843a-0x0;var _0x3c6b6d=_0xa13d[_0x15843a];return _0x3c6b6d;};'use strict';var _=require(_0xda13('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xda13('0x1'));var BPromise=require(_0xda13('0x2'));var rp=require(_0xda13('0x3'));var fs=require('fs');var path=require(_0xda13('0x4'));var rimraf=require(_0xda13('0x5'));var config=require(_0xda13('0x6'));var attributes=require(_0xda13('0x7'));module['exports']=function(_0x3418e8,_0x1e1970){return _0x3418e8[_0xda13('0x8')](_0xda13('0x9'),attributes,{'tableName':_0xda13('0xa'),'paranoid':![],'indexes':[{'name':_0xda13('0xb'),'fields':[_0xda13('0xc'),_0xda13('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8e2325b..71a47d7 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 _0xf8a4=['UserProfileSection,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','ioredis','jayson/promise','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3f48ea,_0x50f60e){var _0x49454e=function(_0x42819c){while(--_0x42819c){_0x3f48ea['push'](_0x3f48ea['shift']());}};_0x49454e(++_0x50f60e);}(_0xf8a4,0xe1));var _0x4f8a=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xf8a4[_0x215e65];return _0xa85842;};'use strict';var _=require('lodash');var util=require(_0x4f8a('0x0'));var moment=require(_0x4f8a('0x1'));var BPromise=require(_0x4f8a('0x2'));var rs=require(_0x4f8a('0x3'));var fs=require('fs');var Redis=require(_0x4f8a('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(_0x4f8a('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28ebad,_0x1be21e,_0x41daae){return new BPromise(function(_0x4d08e8,_0x18b5ae){return client['request'](_0x28ebad,_0x41daae)[_0x4f8a('0x6')](function(_0x21bb5d){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1be21e,_0x4f8a('0x7'));logger[_0x4f8a('0x8')](_0x4f8a('0x9'),_0x1be21e,'request\x20sent',JSON['stringify'](_0x21bb5d));if(_0x21bb5d[_0x4f8a('0xa')]){if(_0x21bb5d[_0x4f8a('0xa')][_0x4f8a('0xb')]===0x1f4){logger[_0x4f8a('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x1be21e,_0x21bb5d[_0x4f8a('0xa')]['message']);return _0x18b5ae(_0x21bb5d[_0x4f8a('0xa')][_0x4f8a('0xc')]);}logger[_0x4f8a('0xa')](_0x4f8a('0xd'),_0x1be21e,_0x21bb5d['error'][_0x4f8a('0xc')]);return _0x4d08e8(_0x21bb5d[_0x4f8a('0xa')]['message']);}else{logger[_0x4f8a('0xe')](_0x4f8a('0xd'),_0x1be21e,_0x4f8a('0x7'));_0x4d08e8(_0x21bb5d[_0x4f8a('0xf')][_0x4f8a('0xc')]);}})[_0x4f8a('0x10')](function(_0x5070e2){logger['error'](_0x4f8a('0xd'),_0x1be21e,_0x5070e2);_0x18b5ae(_0x5070e2);});});} \ No newline at end of file +var _0x03ec=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x55d42f,_0x3f15d7){var _0x4a42f4=function(_0x873c62){while(--_0x873c62){_0x55d42f['push'](_0x55d42f['shift']());}};_0x4a42f4(++_0x3f15d7);}(_0x03ec,0x85));var _0xc03e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc03e('0x0'));var util=require(_0xc03e('0x1'));var moment=require('moment');var BPromise=require(_0xc03e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc03e('0x3'));var db=require(_0xc03e('0x4'))['db'];var utils=require(_0xc03e('0x5'));var logger=require('../../config/logger')(_0xc03e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc03e('0x7')][_0xc03e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b84f5,_0x1a1dd4,_0x4a61a8){return new BPromise(function(_0x66ee96,_0xbea888){return client[_0xc03e('0x9')](_0x5b84f5,_0x4a61a8)['then'](function(_0x231c51){logger[_0xc03e('0xa')](_0xc03e('0xb'),_0x1a1dd4,'request\x20sent');logger['debug'](_0xc03e('0xc'),_0x1a1dd4,_0xc03e('0xd'),JSON['stringify'](_0x231c51));if(_0x231c51['error']){if(_0x231c51[_0xc03e('0xe')][_0xc03e('0xf')]===0x1f4){logger[_0xc03e('0xe')](_0xc03e('0xb'),_0x1a1dd4,_0x231c51[_0xc03e('0xe')][_0xc03e('0x10')]);return _0xbea888(_0x231c51[_0xc03e('0xe')][_0xc03e('0x10')]);}logger[_0xc03e('0xe')](_0xc03e('0xb'),_0x1a1dd4,_0x231c51[_0xc03e('0xe')][_0xc03e('0x10')]);return _0x66ee96(_0x231c51[_0xc03e('0xe')][_0xc03e('0x10')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1a1dd4,'request\x20sent');_0x66ee96(_0x231c51[_0xc03e('0x11')]['message']);}})[_0xc03e('0x12')](function(_0x308355){logger[_0xc03e('0xe')](_0xc03e('0xb'),_0x1a1dd4,_0x308355);_0xbea888(_0x308355);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index eea12cc..078fbe1 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(_0x290612,_0x264e17){var _0x44aade=function(_0x3358d9){while(--_0x3358d9){_0x290612['push'](_0x290612['shift']());}};_0x44aade(++_0x264e17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1cf138,_0x27d445){var _0x245cc2=function(_0x1d1331){while(--_0x1d1331){_0x1cf138['push'](_0x1cf138['shift']());}};_0x245cc2(++_0x27d445);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0xcb91[_0x4067ac];return _0x53d74d;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 57aa288..4bdfbe8 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 _0x9d5d=['sequelize','exports','INTEGER'];(function(_0x56beb5,_0xc1a548){var _0x151d36=function(_0x25ac92){while(--_0x25ac92){_0x56beb5['push'](_0x56beb5['shift']());}};_0x151d36(++_0xc1a548);}(_0x9d5d,0xab));var _0xd9d5=function(_0x3d8833,_0x2f27fd){_0x3d8833=_0x3d8833-0x0;var _0x24ef33=_0x9d5d[_0x3d8833];return _0x24ef33;};'use strict';var Sequelize=require(_0xd9d5('0x0'));module[_0xd9d5('0x1')]={'penalty':{'type':Sequelize[_0xd9d5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02e2=['sequelize'];(function(_0x3013df,_0x369131){var _0x13e3fb=function(_0xe1ee4){while(--_0xe1ee4){_0x3013df['push'](_0x3013df['shift']());}};_0x13e3fb(++_0x369131);}(_0x02e2,0x155));var _0x202e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x02e2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x202e('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 ae7b344..db312ba 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 _0x126e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues'];(function(_0x237a7b,_0x4c9d3b){var _0x476c7b=function(_0x3124e2){while(--_0x3124e2){_0x237a7b['push'](_0x237a7b['shift']());}};_0x476c7b(++_0x4c9d3b);}(_0x126e,0x108));var _0xe126=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x126e[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0xe126('0x0'));var logger=require(_0xe126('0x1'))(_0xe126('0x2'));var moment=require(_0xe126('0x3'));var BPromise=require(_0xe126('0x4'));var rp=require(_0xe126('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe126('0x6'));var config=require(_0xe126('0x7'));var attributes=require(_0xe126('0x8'));module[_0xe126('0x9')]=function(_0x2f75a4,_0x2162bd){return _0x2f75a4[_0xe126('0xa')]('UserSmsQueue',attributes,{'tableName':_0xe126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x444e=['moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','../../config/logger'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0x444e,0xe8));var _0xe444=function(_0x14b979,_0x26da50){_0x14b979=_0x14b979-0x0;var _0x300657=_0x444e[_0x14b979];return _0x300657;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var logger=require(_0xe444('0x1'))('api');var moment=require(_0xe444('0x2'));var BPromise=require('bluebird');var rp=require(_0xe444('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var attributes=require(_0xe444('0x6'));module[_0xe444('0x7')]=function(_0x36ac3b,_0x1ddb27){return _0x36ac3b['define'](_0xe444('0x8'),attributes,{'tableName':'user_has_sms_queues','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 1a7af77..7653e2a 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 _0xc45a=['code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x4389ef,_0x3d390d){var _0xe001e8=function(_0x48ea0a){while(--_0x48ea0a){_0x4389ef['push'](_0x4389ef['shift']());}};_0xe001e8(++_0x3d390d);}(_0xc45a,0x15a));var _0xac45=function(_0x3ef69c,_0x1ef959){_0x3ef69c=_0x3ef69c-0x0;var _0x22f1b6=_0xc45a[_0x3ef69c];return _0x22f1b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac45('0x0'));var BPromise=require(_0xac45('0x1'));var rs=require(_0xac45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac45('0x3'))['db'];var utils=require(_0xac45('0x4'));var logger=require('../../config/logger')(_0xac45('0x5'));var config=require('../../config/environment');var jayson=require(_0xac45('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c863f,_0x244d25,_0x57a274){return new BPromise(function(_0xb94395,_0x97ac54){return client[_0xac45('0x7')](_0x2c863f,_0x57a274)[_0xac45('0x8')](function(_0x3727f8){logger[_0xac45('0x9')](_0xac45('0xa'),_0x244d25,_0xac45('0xb'));logger['debug'](_0xac45('0xc'),_0x244d25,_0xac45('0xb'),JSON['stringify'](_0x3727f8));if(_0x3727f8[_0xac45('0xd')]){if(_0x3727f8[_0xac45('0xd')][_0xac45('0xe')]===0x1f4){logger[_0xac45('0xd')](_0xac45('0xa'),_0x244d25,_0x3727f8[_0xac45('0xd')][_0xac45('0xf')]);return _0x97ac54(_0x3727f8['error'][_0xac45('0xf')]);}logger[_0xac45('0xd')](_0xac45('0xa'),_0x244d25,_0x3727f8[_0xac45('0xd')][_0xac45('0xf')]);return _0xb94395(_0x3727f8[_0xac45('0xd')][_0xac45('0xf')]);}else{logger['info'](_0xac45('0xa'),_0x244d25,_0xac45('0xb'));_0xb94395(_0x3727f8[_0xac45('0x10')][_0xac45('0xf')]);}})[_0xac45('0x11')](function(_0x4afd05){logger[_0xac45('0xd')](_0xac45('0xa'),_0x244d25,_0x4afd05);_0x97ac54(_0x4afd05);});});} \ No newline at end of file +var _0xbd9c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0xd984d5,_0x1d44e9){var _0x52f67a=function(_0xa839fa){while(--_0xa839fa){_0xd984d5['push'](_0xd984d5['shift']());}};_0x52f67a(++_0x1d44e9);}(_0xbd9c,0x166));var _0xcbd9=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xbd9c[_0x2e58c7];return _0x26eb00;};'use strict';var _=require(_0xcbd9('0x0'));var util=require(_0xcbd9('0x1'));var moment=require(_0xcbd9('0x2'));var BPromise=require(_0xcbd9('0x3'));var rs=require(_0xcbd9('0x4'));var fs=require('fs');var Redis=require(_0xcbd9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbd9('0x6'));var logger=require(_0xcbd9('0x7'))(_0xcbd9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcbd9('0x9')][_0xcbd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed76,_0x2bc5e7,_0x44a758){return new BPromise(function(_0xb3bdee,_0x3e64a2){return client[_0xcbd9('0xb')](_0x4bed76,_0x44a758)['then'](function(_0x3ad527){logger['info'](_0xcbd9('0xc'),_0x2bc5e7,_0xcbd9('0xd'));logger[_0xcbd9('0xe')](_0xcbd9('0xf'),_0x2bc5e7,'request\x20sent',JSON[_0xcbd9('0x10')](_0x3ad527));if(_0x3ad527['error']){if(_0x3ad527[_0xcbd9('0x11')]['code']===0x1f4){logger['error'](_0xcbd9('0xc'),_0x2bc5e7,_0x3ad527['error'][_0xcbd9('0x12')]);return _0x3e64a2(_0x3ad527['error']['message']);}logger[_0xcbd9('0x11')](_0xcbd9('0xc'),_0x2bc5e7,_0x3ad527[_0xcbd9('0x11')][_0xcbd9('0x12')]);return _0xb3bdee(_0x3ad527[_0xcbd9('0x11')][_0xcbd9('0x12')]);}else{logger[_0xcbd9('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2bc5e7,_0xcbd9('0xd'));_0xb3bdee(_0x3ad527['result'][_0xcbd9('0x12')]);}})[_0xcbd9('0x14')](function(_0xe09133){logger[_0xcbd9('0x11')](_0xcbd9('0xc'),_0x2bc5e7,_0xe09133);_0x3e64a2(_0xe09133);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 90b3fb0..1fd2134 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 _0x7620=['INTEGER','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7620,0x9b));var _0x0762=function(_0x12ee23,_0xacb61a){_0x12ee23=_0x12ee23-0x0;var _0x101a49=_0x7620[_0x12ee23];return _0x101a49;};'use strict';var Sequelize=require('sequelize');module[_0x0762('0x0')]={'UserId':{'type':Sequelize[_0x0762('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x0762('0x1')]}}; \ No newline at end of file +var _0x14ea=['exports','INTEGER'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x14ea,0x1b2));var _0xa14e=function(_0x448a9f,_0x3d2aa2){_0x448a9f=_0x448a9f-0x0;var _0x1a2bb5=_0x14ea[_0x448a9f];return _0x1a2bb5;};'use strict';var Sequelize=require('sequelize');module[_0xa14e('0x0')]={'UserId':{'type':Sequelize[_0xa14e('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xa14e('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index f69e64d..880ce42 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(_0x315685,_0x1c204d){var _0x5d28f1=function(_0x43c633){while(--_0x43c633){_0x315685['push'](_0x315685['shift']());}};_0x5d28f1(++_0x1c204d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x143933,_0x2da8c6){var _0x228d2a=function(_0x192a7a){while(--_0x192a7a){_0x143933['push'](_0x143933['shift']());}};_0x228d2a(++_0x2da8c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 bb11165..2657969 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x56dd70,_0x4b814a){var _0x45a6a5=function(_0x6502fa){while(--_0x6502fa){_0x56dd70['push'](_0x56dd70['shift']());}};_0x45a6a5(++_0x4b814a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xcb91[_0x41d02a];return _0x4c3983;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x36f6fb,_0x249aa3){var _0x39c006=function(_0x2ba353){while(--_0x2ba353){_0x36f6fb['push'](_0x36f6fb['shift']());}};_0x39c006(++_0x249aa3);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b9f5a67..345da6f 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 _0xc0c2=['INTEGER','exports'];(function(_0x127516,_0x39ee2d){var _0x3cdb6b=function(_0x3908da){while(--_0x3908da){_0x127516['push'](_0x127516['shift']());}};_0x3cdb6b(++_0x39ee2d);}(_0xc0c2,0x1b7));var _0x2c0c=function(_0x4ad6e4,_0x103161){_0x4ad6e4=_0x4ad6e4-0x0;var _0x11e62a=_0xc0c2[_0x4ad6e4];return _0x11e62a;};'use strict';var Sequelize=require('sequelize');module[_0x2c0c('0x0')]={'penalty':{'type':Sequelize[_0x2c0c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x71ba=['sequelize','exports','INTEGER'];(function(_0x10db58,_0x52fbe7){var _0x4ae57c=function(_0x3f1dfb){while(--_0x3f1dfb){_0x10db58['push'](_0x10db58['shift']());}};_0x4ae57c(++_0x52fbe7);}(_0x71ba,0x1c2));var _0xa71b=function(_0x414658,_0x32591f){_0x414658=_0x414658-0x0;var _0x3f33b8=_0x71ba[_0x414658];return _0x3f33b8;};'use strict';var Sequelize=require(_0xa71b('0x0'));module[_0xa71b('0x1')]={'penalty':{'type':Sequelize[_0xa71b('0x2')],'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 c3aec7e..c3d7ccc 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 _0x6414=['./userVoiceQueue.attributes','exports','UserVoiceQueue','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x2cbb61,_0x3557f7){var _0x1361b6=function(_0x30486c){while(--_0x30486c){_0x2cbb61['push'](_0x2cbb61['shift']());}};_0x1361b6(++_0x3557f7);}(_0x6414,0x159));var _0x4641=function(_0x42a65f,_0x1b1b85){_0x42a65f=_0x42a65f-0x0;var _0x316359=_0x6414[_0x42a65f];return _0x316359;};'use strict';var _=require('lodash');var util=require(_0x4641('0x0'));var logger=require(_0x4641('0x1'))('api');var moment=require(_0x4641('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4641('0x3'));var rimraf=require(_0x4641('0x4'));var config=require(_0x4641('0x5'));var attributes=require(_0x4641('0x6'));module[_0x4641('0x7')]=function(_0x441a84,_0x32893d){return _0x441a84['define'](_0x4641('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fc2=['request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird'];(function(_0x39da48,_0x3b213f){var _0x51f50b=function(_0x2329e8){while(--_0x2329e8){_0x39da48['push'](_0x39da48['shift']());}};_0x51f50b(++_0x3b213f);}(_0x7fc2,0xe5));var _0x27fc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7fc2[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x27fc('0x0'));var util=require(_0x27fc('0x1'));var logger=require('../../config/logger')(_0x27fc('0x2'));var moment=require(_0x27fc('0x3'));var BPromise=require(_0x27fc('0x4'));var rp=require(_0x27fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27fc('0x6'));var config=require(_0x27fc('0x7'));var attributes=require(_0x27fc('0x8'));module[_0x27fc('0x9')]=function(_0x5f269e,_0x3dbee9){return _0x5f269e[_0x27fc('0xa')](_0x27fc('0xb'),attributes,{'tableName':_0x27fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 6ff9c6e..1bed028 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 _0x6cb1=['message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x6cb1,0x10b));var _0x16cb=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6cb1[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x16cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16cb('0x1'));var fs=require('fs');var Redis=require(_0x16cb('0x2'));var db=require(_0x16cb('0x3'))['db'];var utils=require(_0x16cb('0x4'));var logger=require(_0x16cb('0x5'))(_0x16cb('0x6'));var config=require(_0x16cb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x16cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22c5f3,_0x5ad43b,_0x4ca20f){return new BPromise(function(_0x10432b,_0xc49ede){return client[_0x16cb('0x9')](_0x22c5f3,_0x4ca20f)[_0x16cb('0xa')](function(_0x4591d1){logger[_0x16cb('0xb')](_0x16cb('0xc'),_0x5ad43b,'request\x20sent');logger[_0x16cb('0xd')](_0x16cb('0xe'),_0x5ad43b,_0x16cb('0xf'),JSON[_0x16cb('0x10')](_0x4591d1));if(_0x4591d1['error']){if(_0x4591d1[_0x16cb('0x11')][_0x16cb('0x12')]===0x1f4){logger[_0x16cb('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5ad43b,_0x4591d1[_0x16cb('0x11')][_0x16cb('0x13')]);return _0xc49ede(_0x4591d1[_0x16cb('0x11')][_0x16cb('0x13')]);}logger[_0x16cb('0x11')](_0x16cb('0xc'),_0x5ad43b,_0x4591d1[_0x16cb('0x11')]['message']);return _0x10432b(_0x4591d1[_0x16cb('0x11')][_0x16cb('0x13')]);}else{logger[_0x16cb('0xb')](_0x16cb('0xc'),_0x5ad43b,_0x16cb('0xf'));_0x10432b(_0x4591d1[_0x16cb('0x14')]['message']);}})[_0x16cb('0x15')](function(_0x4e48c3){logger[_0x16cb('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5ad43b,_0x4e48c3);_0xc49ede(_0x4e48c3);});});} \ No newline at end of file +var _0x8987=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x28d252,_0x160cb9){var _0x48d8cb=function(_0x2946b4){while(--_0x2946b4){_0x28d252['push'](_0x28d252['shift']());}};_0x48d8cb(++_0x160cb9);}(_0x8987,0x1e4));var _0x7898=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x8987[_0x265aa2];return _0x447a3a;};'use strict';var _=require(_0x7898('0x0'));var util=require(_0x7898('0x1'));var moment=require('moment');var BPromise=require(_0x7898('0x2'));var rs=require(_0x7898('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7898('0x4'))['db'];var utils=require(_0x7898('0x5'));var logger=require('../../config/logger')(_0x7898('0x6'));var config=require(_0x7898('0x7'));var jayson=require(_0x7898('0x8'));var client=jayson[_0x7898('0x9')][_0x7898('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4acfd1,_0x3f32e7,_0x11e187){return new BPromise(function(_0x5abefe,_0xe2d17){return client[_0x7898('0xb')](_0x4acfd1,_0x11e187)[_0x7898('0xc')](function(_0xd006a){logger['info'](_0x7898('0xd'),_0x3f32e7,_0x7898('0xe'));logger[_0x7898('0xf')](_0x7898('0x10'),_0x3f32e7,_0x7898('0xe'),JSON[_0x7898('0x11')](_0xd006a));if(_0xd006a['error']){if(_0xd006a[_0x7898('0x12')]['code']===0x1f4){logger[_0x7898('0x12')](_0x7898('0xd'),_0x3f32e7,_0xd006a[_0x7898('0x12')]['message']);return _0xe2d17(_0xd006a['error'][_0x7898('0x13')]);}logger['error'](_0x7898('0xd'),_0x3f32e7,_0xd006a[_0x7898('0x12')][_0x7898('0x13')]);return _0x5abefe(_0xd006a[_0x7898('0x12')][_0x7898('0x13')]);}else{logger['info'](_0x7898('0xd'),_0x3f32e7,_0x7898('0xe'));_0x5abefe(_0xd006a[_0x7898('0x14')][_0x7898('0x13')]);}})[_0x7898('0x15')](function(_0x50eb5f){logger[_0x7898('0x12')](_0x7898('0xd'),_0x3f32e7,_0x50eb5f);_0xe2d17(_0x50eb5f);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 48e6ab9..3f4a573 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47f762,_0x106ece){var _0x4d2585=function(_0x4de06b){while(--_0x4de06b){_0x47f762['push'](_0x47f762['shift']());}};_0x4d2585(++_0x106ece);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x37b6af,_0x2dd5ac){var _0x4891ee=function(_0x159dc4){while(--_0x159dc4){_0x37b6af['push'](_0x37b6af['shift']());}};_0x4891ee(++_0x2dd5ac);}(_0x70e0,0x17b));var _0x070e=function(_0x53db3d,_0x5b887b){_0x53db3d=_0x53db3d-0x0;var _0x2bbf42=_0x70e0[_0x53db3d];return _0x2bbf42;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 27bedf1..e4fe759 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 _0x12cb=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x5ef823,_0x416058){var _0x4e7a92=function(_0x33d8c8){while(--_0x33d8c8){_0x5ef823['push'](_0x5ef823['shift']());}};_0x4e7a92(++_0x416058);}(_0x12cb,0xb9));var _0xb12c=function(_0x3f93d2,_0x172d76){_0x3f93d2=_0x3f93d2-0x0;var _0xb08069=_0x12cb[_0x3f93d2];return _0xb08069;};'use strict';var Sequelize=require(_0xb12c('0x0'));module[_0xb12c('0x1')]={'uniqueid':{'type':Sequelize[_0xb12c('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb12c('0x3')},'membername':{'type':Sequelize[_0xb12c('0x4')],'allowNull':![],'comment':_0xb12c('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb12c('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xb12c('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb12c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xb12c('0x4')],'allowNull':![],'unique':_0xb12c('0x5'),'comment':_0xb12c('0x3')},'penalty':{'type':Sequelize[_0xb12c('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb12c('0x2')](0xb),'defaultValue':0x0,'comment':_0xb12c('0x3')}}; \ No newline at end of file +var _0x5bbe=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x27d771,_0x1a50b2){var _0x2ba087=function(_0x1fcfa4){while(--_0x1fcfa4){_0x27d771['push'](_0x27d771['shift']());}};_0x2ba087(++_0x1a50b2);}(_0x5bbe,0x6e));var _0xe5bb=function(_0x52619f,_0x160a2c){_0x52619f=_0x52619f-0x0;var _0x3dc50d=_0x5bbe[_0x52619f];return _0x3dc50d;};'use strict';var Sequelize=require(_0xe5bb('0x0'));module[_0xe5bb('0x1')]={'uniqueid':{'type':Sequelize[_0xe5bb('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe5bb('0x3')},'membername':{'type':Sequelize[_0xe5bb('0x4')],'allowNull':![],'comment':_0xe5bb('0x3')},'UserId':{'type':Sequelize[_0xe5bb('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe5bb('0x5'),'comment':_0xe5bb('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe5bb('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe5bb('0x5'),'comment':_0xe5bb('0x3')},'penalty':{'type':Sequelize[_0xe5bb('0x2')](0xb),'defaultValue':0x0,'comment':_0xe5bb('0x3')},'paused':{'type':Sequelize[_0xe5bb('0x2')](0xb),'defaultValue':0x0,'comment':_0xe5bb('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6f0b891..573d9ab 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 _0x4e79=['setMaxListeners','update','remove','emit','hook','exports','events','UserVoiceQueueRt'];(function(_0x24b7bd,_0x527dd5){var _0x31883e=function(_0x40ee81){while(--_0x40ee81){_0x24b7bd['push'](_0x24b7bd['shift']());}};_0x31883e(++_0x527dd5);}(_0x4e79,0x6e));var _0x94e7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e79[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x94e7('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x94e7('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x94e7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x94e7('0x3'),'afterDestroy':_0x94e7('0x4')};function emitEvent(_0x250a24){return function(_0xf0b82b,_0x531f6c,_0x54450c){UserVoiceQueueRtEvents[_0x94e7('0x5')](_0x250a24+':'+_0xf0b82b['id'],_0xf0b82b);UserVoiceQueueRtEvents[_0x94e7('0x5')](_0x250a24,_0xf0b82b);_0x54450c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x94e7('0x6')](e,emitEvent(event));}}module[_0x94e7('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x30cd=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x3f9415,_0x5e8c93){var _0x57d56f=function(_0x5b708a){while(--_0x5b708a){_0x3f9415['push'](_0x3f9415['shift']());}};_0x57d56f(++_0x5e8c93);}(_0x30cd,0x146));var _0xd30c=function(_0x31490c,_0x3a51c6){_0x31490c=_0x31490c-0x0;var _0x4c7410=_0x30cd[_0x31490c];return _0x4c7410;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xd30c('0x0'))['db'][_0xd30c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd30c('0x2')](0x0);var events={'afterCreate':_0xd30c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32e568){return function(_0x129376,_0x3afe49,_0x417c53){UserVoiceQueueRtEvents[_0xd30c('0x4')](_0x32e568+':'+_0x129376['id'],_0x129376);UserVoiceQueueRtEvents[_0xd30c('0x4')](_0x32e568,_0x129376);_0x417c53(null);};}for(var e in events){if(events[_0xd30c('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xd30c('0x6')](e,emitEvent(event));}}module[_0xd30c('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 6ae27b9..da5a54e 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 _0x17e1=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5cd7fd,_0x4de617){var _0x5213ae=function(_0x49b2aa){while(--_0x49b2aa){_0x5cd7fd['push'](_0x5cd7fd['shift']());}};_0x5213ae(++_0x4de617);}(_0x17e1,0x93));var _0x117e=function(_0x472029,_0x55a9f8){_0x472029=_0x472029-0x0;var _0x343e08=_0x17e1[_0x472029];return _0x343e08;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x117e('0x0'));var moment=require(_0x117e('0x1'));var BPromise=require(_0x117e('0x2'));var rp=require(_0x117e('0x3'));var fs=require('fs');var path=require(_0x117e('0x4'));var rimraf=require(_0x117e('0x5'));var config=require(_0x117e('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x117e('0x7')]=function(_0x5377c5,_0x1c411b){return _0x5377c5[_0x117e('0x8')](_0x117e('0x9'),attributes,{'tableName':_0x117e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ea4=['util','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt'];(function(_0x48d368,_0x3df752){var _0x2fb7f8=function(_0x3c81e6){while(--_0x3c81e6){_0x48d368['push'](_0x48d368['shift']());}};_0x2fb7f8(++_0x3df752);}(_0x1ea4,0x8c));var _0x41ea=function(_0x374301,_0x8b29e6){_0x374301=_0x374301-0x0;var _0x256f7b=_0x1ea4[_0x374301];return _0x256f7b;};'use strict';var _=require('lodash');var util=require(_0x41ea('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x41ea('0x1'));var BPromise=require('bluebird');var rp=require(_0x41ea('0x2'));var fs=require('fs');var path=require(_0x41ea('0x3'));var rimraf=require(_0x41ea('0x4'));var config=require(_0x41ea('0x5'));var attributes=require(_0x41ea('0x6'));module[_0x41ea('0x7')]=function(_0x55a4ee,_0x278d02){return _0x55a4ee[_0x41ea('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0x41ea('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 5ec560f..2dbd804 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 _0xf14d=['register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userVoiceQueueRt.socket'];(function(_0x208e0d,_0xac9fb){var _0x47a23e=function(_0x45bca1){while(--_0x45bca1){_0x208e0d['push'](_0x208e0d['shift']());}};_0x47a23e(++_0xac9fb);}(_0xf14d,0x17f));var _0xdf14=function(_0x4a4044,_0x299e68){_0x4a4044=_0x4a4044-0x0;var _0x560d69=_0xf14d[_0x4a4044];return _0x560d69;};'use strict';var _=require(_0xdf14('0x0'));var util=require(_0xdf14('0x1'));var moment=require(_0xdf14('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(_0xdf14('0x3'));var logger=require(_0xdf14('0x4'))(_0xdf14('0x5'));var config=require(_0xdf14('0x6'));var jayson=require(_0xdf14('0x7'));var client=jayson[_0xdf14('0x8')][_0xdf14('0x9')]({'port':0x232a});config[_0xdf14('0xa')]=_[_0xdf14('0xb')](config[_0xdf14('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdf14('0xa')]));require(_0xdf14('0xc'))[_0xdf14('0xd')](socket);function respondWithRpcPromise(_0x739147,_0x2536ac,_0x1c074d){return new BPromise(function(_0x18259b,_0x49021c){return client[_0xdf14('0xe')](_0x739147,_0x1c074d)[_0xdf14('0xf')](function(_0x48da92){logger[_0xdf14('0x10')](_0xdf14('0x11'),_0x2536ac,_0xdf14('0x12'));logger[_0xdf14('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2536ac,'request\x20sent',JSON[_0xdf14('0x14')](_0x48da92));if(_0x48da92[_0xdf14('0x15')]){if(_0x48da92[_0xdf14('0x15')][_0xdf14('0x16')]===0x1f4){logger[_0xdf14('0x15')](_0xdf14('0x11'),_0x2536ac,_0x48da92[_0xdf14('0x15')]['message']);return _0x49021c(_0x48da92[_0xdf14('0x15')]['message']);}logger[_0xdf14('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2536ac,_0x48da92[_0xdf14('0x15')]['message']);return _0x18259b(_0x48da92['error']['message']);}else{logger[_0xdf14('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2536ac,'request\x20sent');_0x18259b(_0x48da92[_0xdf14('0x17')][_0xdf14('0x18')]);}})[_0xdf14('0x19')](function(_0x6b6f56){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2536ac,_0x6b6f56);_0x49021c(_0x6b6f56);});});}exports[_0xdf14('0x1a')]=function(_0x5ee176){var _0x518bf6=this;return new Promise(function(_0x16d843,_0x3cfed1){return db[_0xdf14('0x1b')][_0xdf14('0x1c')]({'raw':_0x5ee176[_0xdf14('0x1d')]?_0x5ee176['options'][_0xdf14('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ee176[_0xdf14('0x1d')]?_0x5ee176[_0xdf14('0x1d')][_0xdf14('0x1f')]||null:null,'attributes':[[db[_0xdf14('0x20')]['fn'](_0xdf14('0x21'),db[_0xdf14('0x20')]['fn']('IF',db[_0xdf14('0x20')][_0xdf14('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0xdf14('0x23')]]})[_0xdf14('0xf')](function(_0x35df8b){logger[_0xdf14('0x10')](_0xdf14('0x1a'),_0x5ee176);logger[_0xdf14('0x13')](_0xdf14('0x1a'),_0x5ee176,JSON[_0xdf14('0x14')](_0x35df8b));_0x16d843(_0x35df8b);})[_0xdf14('0x19')](function(_0x5cae18){logger[_0xdf14('0x15')](_0xdf14('0x1a'),_0x5cae18[_0xdf14('0x18')],_0x5ee176);_0x3cfed1(_0x518bf6[_0xdf14('0x15')](0x1f4,_0x5cae18[_0xdf14('0x18')]));});});}; \ No newline at end of file +var _0x5cc6=['outboundQueuePauses','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize'];(function(_0x36089c,_0x290a2d){var _0x5f5044=function(_0x2bf22b){while(--_0x2bf22b){_0x36089c['push'](_0x36089c['shift']());}};_0x5f5044(++_0x290a2d);}(_0x5cc6,0x6e));var _0x65cc=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x5cc6[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0x65cc('0x0'));var util=require(_0x65cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65cc('0x2'));var fs=require('fs');var Redis=require(_0x65cc('0x3'));var db=require(_0x65cc('0x4'))['db'];var utils=require(_0x65cc('0x5'));var logger=require(_0x65cc('0x6'))(_0x65cc('0x7'));var config=require(_0x65cc('0x8'));var jayson=require(_0x65cc('0x9'));var client=jayson[_0x65cc('0xa')][_0x65cc('0xb')]({'port':0x232a});config['redis']=_[_0x65cc('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x65cc('0xd'))(new Redis(config[_0x65cc('0xe')]));require(_0x65cc('0xf'))[_0x65cc('0x10')](socket);function respondWithRpcPromise(_0x1cc050,_0x122b92,_0x30f7b3){return new BPromise(function(_0x211d02,_0x2983d7){return client['request'](_0x1cc050,_0x30f7b3)['then'](function(_0x3fe8ae){logger[_0x65cc('0x11')](_0x65cc('0x12'),_0x122b92,_0x65cc('0x13'));logger['debug'](_0x65cc('0x14'),_0x122b92,'request\x20sent',JSON[_0x65cc('0x15')](_0x3fe8ae));if(_0x3fe8ae[_0x65cc('0x16')]){if(_0x3fe8ae[_0x65cc('0x16')][_0x65cc('0x17')]===0x1f4){logger[_0x65cc('0x16')](_0x65cc('0x12'),_0x122b92,_0x3fe8ae[_0x65cc('0x16')][_0x65cc('0x18')]);return _0x2983d7(_0x3fe8ae[_0x65cc('0x16')][_0x65cc('0x18')]);}logger[_0x65cc('0x16')](_0x65cc('0x12'),_0x122b92,_0x3fe8ae[_0x65cc('0x16')][_0x65cc('0x18')]);return _0x211d02(_0x3fe8ae[_0x65cc('0x16')][_0x65cc('0x18')]);}else{logger[_0x65cc('0x11')](_0x65cc('0x12'),_0x122b92,_0x65cc('0x13'));_0x211d02(_0x3fe8ae['result'][_0x65cc('0x18')]);}})[_0x65cc('0x19')](function(_0x4b0abc){logger[_0x65cc('0x16')](_0x65cc('0x12'),_0x122b92,_0x4b0abc);_0x2983d7(_0x4b0abc);});});}exports[_0x65cc('0x1a')]=function(_0x4383ec){var _0x124350=this;return new Promise(function(_0x15a44b,_0x3e2193){return db[_0x65cc('0x1b')][_0x65cc('0x1c')]({'raw':_0x4383ec[_0x65cc('0x1d')]?_0x4383ec[_0x65cc('0x1d')][_0x65cc('0x1e')]===undefined?!![]:![]:!![],'where':_0x4383ec[_0x65cc('0x1d')]?_0x4383ec['options'][_0x65cc('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x65cc('0x20'),db[_0x65cc('0x21')]['fn']('IF',db[_0x65cc('0x21')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x65cc('0x22')]]})[_0x65cc('0x23')](function(_0x131698){logger[_0x65cc('0x11')](_0x65cc('0x1a'),_0x4383ec);logger['debug'](_0x65cc('0x1a'),_0x4383ec,JSON[_0x65cc('0x15')](_0x131698));_0x15a44b(_0x131698);})[_0x65cc('0x19')](function(_0x35d2c2){logger['error']('GetVoiceQueueRtPauses',_0x35d2c2[_0x65cc('0x18')],_0x4383ec);_0x3e2193(_0x124350[_0x65cc('0x16')](0x1f4,_0x35d2c2[_0x65cc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c2b8fec..951ef5c 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 _0x4fb4=['userVoiceQueueRt:','save','remove','update','removeListener','register','length'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x4fb4,0x190));var _0x44fb=function(_0x150283,_0x3961ba){_0x150283=_0x150283-0x0;var _0x2abe9d=_0x4fb4[_0x150283];return _0x2abe9d;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x44fb('0x0'),_0x44fb('0x1'),_0x44fb('0x2')];function createListener(_0x29a2fe,_0x24e38d){return function(_0x42dbbb){_0x24e38d['emit'](_0x29a2fe,_0x42dbbb);};}function removeListener(_0xec6dce,_0x953327){return function(){UserVoiceQueueRtEvents[_0x44fb('0x3')](_0xec6dce,_0x953327);};}exports[_0x44fb('0x4')]=function(_0x375d33){for(var _0x173e70=0x0,_0x464af5=events[_0x44fb('0x5')];_0x173e70<_0x464af5;_0x173e70++){var _0x59aa6d=events[_0x173e70];var _0x87f716=createListener(_0x44fb('0x6')+_0x59aa6d,_0x375d33);UserVoiceQueueRtEvents['on'](_0x59aa6d,_0x87f716);}}; \ No newline at end of file +var _0x3dba=['emit','removeListener','register','update'];(function(_0x58cc71,_0x2191c8){var _0x49fc9e=function(_0xcbca19){while(--_0xcbca19){_0x58cc71['push'](_0x58cc71['shift']());}};_0x49fc9e(++_0x2191c8);}(_0x3dba,0x73));var _0xa3db=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0x3dba[_0xb99421];return _0x4b3ec7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save','remove',_0xa3db('0x0')];function createListener(_0x182106,_0x5c0fb2){return function(_0x3843af){_0x5c0fb2[_0xa3db('0x1')](_0x182106,_0x3843af);};}function removeListener(_0x20b644,_0x189a24){return function(){UserVoiceQueueRtEvents[_0xa3db('0x2')](_0x20b644,_0x189a24);};}exports[_0xa3db('0x3')]=function(_0x34b96f){for(var _0x51b39c=0x0,_0x5807bb=events['length'];_0x51b39c<_0x5807bb;_0x51b39c++){var _0x4f77df=events[_0x51b39c];var _0x3357f2=createListener('userVoiceQueueRt:'+_0x4f77df,_0x34b96f);UserVoiceQueueRtEvents['on'](_0x4f77df,_0x3357f2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 28c4518..58f3f60 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3e93c7,_0x9d5904){var _0xdba5b6=function(_0x3aadaa){while(--_0x3aadaa){_0x3e93c7['push'](_0x3e93c7['shift']());}};_0xdba5b6(++_0x9d5904);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3968c9,_0x346c1b){var _0x790570=function(_0x569dab){while(--_0x569dab){_0x3968c9['push'](_0x3968c9['shift']());}};_0x790570(++_0x346c1b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f3143a7..34b6e05 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 _0x5544=['sequelize','exports'];(function(_0x39a3ec,_0x4da1ad){var _0x143ed3=function(_0x5c3f31){while(--_0x5c3f31){_0x39a3ec['push'](_0x39a3ec['shift']());}};_0x143ed3(++_0x4da1ad);}(_0x5544,0x12e));var _0x4554=function(_0x40563c,_0x3e1a52){_0x40563c=_0x40563c-0x0;var _0x1a900c=_0x5544[_0x40563c];return _0x1a900c;};'use strict';var Sequelize=require(_0x4554('0x0'));module[_0x4554('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf8f9=['exports','sequelize'];(function(_0x1b8a95,_0xb61f6a){var _0x5c074f=function(_0x29e924){while(--_0x29e924){_0x1b8a95['push'](_0x1b8a95['shift']());}};_0x5c074f(++_0xb61f6a);}(_0xf8f9,0xbb));var _0x9f8f=function(_0x2781dd,_0x1ee6e4){_0x2781dd=_0x2781dd-0x0;var _0x4c29f9=_0xf8f9[_0x2781dd];return _0x4c29f9;};'use strict';var Sequelize=require(_0x9f8f('0x0'));module[_0x9f8f('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 b5279c1..c1103b5 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 _0x45d0=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x18c4a8,_0x96c52e){var _0x189ff1=function(_0x4a3ea8){while(--_0x4a3ea8){_0x18c4a8['push'](_0x18c4a8['shift']());}};_0x189ff1(++_0x96c52e);}(_0x45d0,0x9d));var _0x045d=function(_0x5cea79,_0x1f2d45){_0x5cea79=_0x5cea79-0x0;var _0x3f9c9c=_0x45d0[_0x5cea79];return _0x3f9c9c;};'use strict';var _=require(_0x045d('0x0'));var util=require(_0x045d('0x1'));var logger=require(_0x045d('0x2'))(_0x045d('0x3'));var moment=require(_0x045d('0x4'));var BPromise=require(_0x045d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x045d('0x6'));var rimraf=require(_0x045d('0x7'));var config=require(_0x045d('0x8'));var attributes=require(_0x045d('0x9'));module[_0x045d('0xa')]=function(_0x17d2c9,_0x216214){return _0x17d2c9[_0x045d('0xb')](_0x045d('0xc'),attributes,{'tableName':_0x045d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef4d=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2d6a9a,_0x4fa857){var _0x2f247f=function(_0x45db16){while(--_0x45db16){_0x2d6a9a['push'](_0x2d6a9a['shift']());}};_0x2f247f(++_0x4fa857);}(_0xef4d,0x10a));var _0xdef4=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xef4d[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0xdef4('0x0'));var util=require('util');var logger=require(_0xdef4('0x1'))(_0xdef4('0x2'));var moment=require(_0xdef4('0x3'));var BPromise=require(_0xdef4('0x4'));var rp=require(_0xdef4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdef4('0x6'));var config=require(_0xdef4('0x7'));var attributes=require(_0xdef4('0x8'));module[_0xdef4('0x9')]=function(_0x4961bc,_0x34a3db){return _0x4961bc[_0xdef4('0xa')](_0xdef4('0xb'),attributes,{'tableName':_0xdef4('0xc'),'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 740dd1e..13f27cc 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 _0xa7cf=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa7cf,0x1e2));var _0xfa7c=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0xa7cf[_0x3c504b];return _0x2e5354;};'use strict';var _=require(_0xfa7c('0x0'));var util=require(_0xfa7c('0x1'));var moment=require(_0xfa7c('0x2'));var BPromise=require(_0xfa7c('0x3'));var rs=require(_0xfa7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa7c('0x5'))['db'];var utils=require(_0xfa7c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa7c('0x7'));var jayson=require(_0xfa7c('0x8'));var client=jayson['client'][_0xfa7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xea24b9,_0x5b6851,_0x35f347){return new BPromise(function(_0x123924,_0x18e42f){return client[_0xfa7c('0xa')](_0xea24b9,_0x35f347)[_0xfa7c('0xb')](function(_0x2738ab){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x5b6851,_0xfa7c('0xc'));logger[_0xfa7c('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5b6851,_0xfa7c('0xc'),JSON[_0xfa7c('0xe')](_0x2738ab));if(_0x2738ab[_0xfa7c('0xf')]){if(_0x2738ab[_0xfa7c('0xf')][_0xfa7c('0x10')]===0x1f4){logger[_0xfa7c('0xf')](_0xfa7c('0x11'),_0x5b6851,_0x2738ab[_0xfa7c('0xf')][_0xfa7c('0x12')]);return _0x18e42f(_0x2738ab[_0xfa7c('0xf')]['message']);}logger[_0xfa7c('0xf')](_0xfa7c('0x11'),_0x5b6851,_0x2738ab['error'][_0xfa7c('0x12')]);return _0x123924(_0x2738ab[_0xfa7c('0xf')]['message']);}else{logger['info'](_0xfa7c('0x11'),_0x5b6851,_0xfa7c('0xc'));_0x123924(_0x2738ab[_0xfa7c('0x13')]['message']);}})['catch'](function(_0x1f58ad){logger[_0xfa7c('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b6851,_0x1f58ad);_0x18e42f(_0x1f58ad);});});} \ No newline at end of file +var _0xf85c=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','moment','bluebird','randomstring','ioredis'];(function(_0x8e7b56,_0x5665d7){var _0x142485=function(_0x39d5b9){while(--_0x39d5b9){_0x8e7b56['push'](_0x8e7b56['shift']());}};_0x142485(++_0x5665d7);}(_0xf85c,0x171));var _0xcf85=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xf85c[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require(_0xcf85('0x0'));var moment=require(_0xcf85('0x1'));var BPromise=require(_0xcf85('0x2'));var rs=require(_0xcf85('0x3'));var fs=require('fs');var Redis=require(_0xcf85('0x4'));var db=require(_0xcf85('0x5'))['db'];var utils=require(_0xcf85('0x6'));var logger=require(_0xcf85('0x7'))(_0xcf85('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf85('0x9'));var client=jayson[_0xcf85('0xa')][_0xcf85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a6d55,_0x39f275,_0x578ec4){return new BPromise(function(_0x1ac98b,_0x524d24){return client[_0xcf85('0xc')](_0x3a6d55,_0x578ec4)['then'](function(_0x1bb423){logger['info'](_0xcf85('0xd'),_0x39f275,_0xcf85('0xe'));logger[_0xcf85('0xf')](_0xcf85('0x10'),_0x39f275,_0xcf85('0xe'),JSON[_0xcf85('0x11')](_0x1bb423));if(_0x1bb423[_0xcf85('0x12')]){if(_0x1bb423[_0xcf85('0x12')][_0xcf85('0x13')]===0x1f4){logger['error'](_0xcf85('0xd'),_0x39f275,_0x1bb423[_0xcf85('0x12')][_0xcf85('0x14')]);return _0x524d24(_0x1bb423['error'][_0xcf85('0x14')]);}logger[_0xcf85('0x12')](_0xcf85('0xd'),_0x39f275,_0x1bb423[_0xcf85('0x12')][_0xcf85('0x14')]);return _0x1ac98b(_0x1bb423[_0xcf85('0x12')]['message']);}else{logger[_0xcf85('0x15')](_0xcf85('0xd'),_0x39f275,_0xcf85('0xe'));_0x1ac98b(_0x1bb423['result']['message']);}})['catch'](function(_0x515c52){logger['error'](_0xcf85('0xd'),_0x39f275,_0x515c52);_0x524d24(_0x515c52);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ef513bc..89af1c5 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 _0x0a34=['get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc315de,_0x5dc877){var _0x11a627=function(_0x4039d6){while(--_0x4039d6){_0xc315de['push'](_0xc315de['shift']());}};_0x11a627(++_0x5dc877);}(_0x0a34,0x12a));var _0x40a3=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x0a34[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require(_0x40a3('0x0'));var util=require(_0x40a3('0x1'));var path=require('path');var timeout=require(_0x40a3('0x2'));var express=require(_0x40a3('0x3'));var router=express[_0x40a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x40a3('0x5'));var interaction=require(_0x40a3('0x6'));var config=require(_0x40a3('0x7'));var controller=require('./variable.controller');router[_0x40a3('0x8')]('/',auth[_0x40a3('0x9')](),controller[_0x40a3('0xa')]);router[_0x40a3('0x8')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['show']);router[_0x40a3('0xc')]('/',auth[_0x40a3('0x9')](),controller[_0x40a3('0xd')]);router[_0x40a3('0xe')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['update']);router[_0x40a3('0xf')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['destroy']);module[_0x40a3('0x10')]=router; \ No newline at end of file +var _0x9224=['isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./variable.controller'];(function(_0x51f791,_0x446fa6){var _0x1290a5=function(_0x131e21){while(--_0x131e21){_0x51f791['push'](_0x51f791['shift']());}};_0x1290a5(++_0x446fa6);}(_0x9224,0xa3));var _0x4922=function(_0x3a28f4,_0xbd4a01){_0x3a28f4=_0x3a28f4-0x0;var _0x3a3689=_0x9224[_0x3a28f4];return _0x3a3689;};'use strict';var multer=require('multer');var util=require(_0x4922('0x0'));var path=require(_0x4922('0x1'));var timeout=require(_0x4922('0x2'));var express=require(_0x4922('0x3'));var router=express[_0x4922('0x4')]();var fs_extra=require(_0x4922('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4922('0x6'));router['get']('/',auth[_0x4922('0x7')](),controller[_0x4922('0x8')]);router[_0x4922('0x9')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0xb')]);router['post']('/',auth[_0x4922('0x7')](),controller[_0x4922('0xc')]);router['put'](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0xd')]);router[_0x4922('0xe')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0xf')]);module[_0x4922('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f3cbe8b..c3fdd6e 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 _0xca7d=['STRING','name'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0xca7d,0x182));var _0xdca7=function(_0x2392d0,_0x1aad4e){_0x2392d0=_0x2392d0-0x0;var _0x10f87a=_0xca7d[_0x2392d0];return _0x10f87a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdca7('0x0')],'unique':_0xdca7('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdca7('0x0')]}}; \ No newline at end of file +var _0xf897=['sequelize','exports','STRING','name'];(function(_0x39b9e9,_0x93ce8d){var _0x41de03=function(_0x50bf89){while(--_0x50bf89){_0x39b9e9['push'](_0x39b9e9['shift']());}};_0x41de03(++_0x93ce8d);}(_0xf897,0xe4));var _0x7f89=function(_0x3d75b6,_0x426c97){_0x3d75b6=_0x3d75b6-0x0;var _0x2cb724=_0xf897[_0x3d75b6];return _0x2cb724;};'use strict';var Sequelize=require(_0x7f89('0x0'));module[_0x7f89('0x1')]={'name':{'type':Sequelize[_0x7f89('0x2')],'unique':_0x7f89('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f89('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 564acb2..1657d7a 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 _0xf711=['destroy','Variables','UserProfileResource','error','stack','name','index','map','Variable','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x224a0a,_0x3588e9){var _0x3c7f1f=function(_0x1ada6f){while(--_0x1ada6f){_0x224a0a['push'](_0x224a0a['shift']());}};_0x3c7f1f(++_0x3588e9);}(_0xf711,0x1bc));var _0x1f71=function(_0x2bdb71,_0x210f1c){_0x2bdb71=_0x2bdb71-0x0;var _0x6a3923=_0xf711[_0x2bdb71];return _0x6a3923;};'use strict';var emlformat=require(_0x1f71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f71('0x2'));var moment=require(_0x1f71('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f71('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1f71('0x5'));var csv=require(_0x1f71('0x6'));var ejs=require(_0x1f71('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f71('0x8'));var squel=require('squel');var crypto=require(_0x1f71('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1f71('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1f71('0xb'));var Papa=require(_0x1f71('0xc'));var Redis=require(_0x1f71('0xd'));var authService=require(_0x1f71('0xe'));var qs=require(_0x1f71('0xf'));var as=require(_0x1f71('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f71('0x11'))(_0x1f71('0x12'));var utils=require(_0x1f71('0x13'));var config=require(_0x1f71('0x14'));var licenseUtil=require(_0x1f71('0x15'));var db=require(_0x1f71('0x16'))['db'];function respondWithStatusCode(_0x1695c8,_0x16fa46){_0x16fa46=_0x16fa46||0xcc;return function(_0x572831){if(_0x572831){return _0x1695c8[_0x1f71('0x17')](_0x16fa46);}return _0x1695c8[_0x1f71('0x18')](_0x16fa46)['end']();};}function respondWithResult(_0x1b9515,_0x56e41c){_0x56e41c=_0x56e41c||0xc8;return function(_0x10a781){if(_0x10a781){return _0x1b9515[_0x1f71('0x18')](_0x56e41c)[_0x1f71('0x19')](_0x10a781);}};}function respondWithFilteredResult(_0x567c0d,_0x3e5ad5){return function(_0x31e52f){if(_0x31e52f){var _0x4505a4=typeof _0x3e5ad5['offset']===_0x1f71('0x1a')&&typeof _0x3e5ad5[_0x1f71('0x1b')]===_0x1f71('0x1a');var _0x43ad08=_0x31e52f[_0x1f71('0x1c')];var _0x41db2c=_0x4505a4?0x0:_0x3e5ad5[_0x1f71('0x1d')];var _0x5b01cb=_0x4505a4?_0x31e52f[_0x1f71('0x1c')]:_0x3e5ad5[_0x1f71('0x1d')]+_0x3e5ad5[_0x1f71('0x1b')];var _0x2a2948;if(_0x5b01cb>=_0x43ad08){_0x5b01cb=_0x43ad08;_0x2a2948=0xc8;}else{_0x2a2948=0xce;}_0x567c0d['status'](_0x2a2948);return _0x567c0d['set'](_0x1f71('0x1e'),_0x41db2c+'-'+_0x5b01cb+'/'+_0x43ad08)['json'](_0x31e52f);}return null;};}function patchUpdates(_0x3d669e){return function(_0x4b9afe){try{jsonpatch[_0x1f71('0x1f')](_0x4b9afe,_0x3d669e,!![]);}catch(_0x43f407){return BPromise[_0x1f71('0x20')](_0x43f407);}return _0x4b9afe[_0x1f71('0x21')]();};}function saveUpdates(_0x65353a,_0x446586){return function(_0x5a3b05){if(_0x5a3b05){return _0x5a3b05[_0x1f71('0x22')](_0x65353a)[_0x1f71('0x23')](function(_0x2b2f2e){return _0x2b2f2e;});}return null;};}function removeEntity(_0x5efe70,_0xc68aec){return function(_0xbdc717){if(_0xbdc717){return _0xbdc717[_0x1f71('0x24')]()[_0x1f71('0x23')](function(){var _0x42663a=_0xbdc717['get']({'plain':!![]});var _0x153d09=_0x1f71('0x25');return db[_0x1f71('0x26')][_0x1f71('0x24')]({'where':{'type':_0x153d09,'resourceId':_0x42663a['id']}})[_0x1f71('0x23')](function(){return _0xbdc717;});})[_0x1f71('0x23')](function(){_0x5efe70[_0x1f71('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48764f,_0x91f54c){return function(_0x45b0ef){if(!_0x45b0ef){_0x48764f['sendStatus'](0x194);}return _0x45b0ef;};}function handleError(_0x513f73,_0x5966f4){_0x5966f4=_0x5966f4||0x1f4;return function(_0x12706d){logger[_0x1f71('0x27')](_0x12706d[_0x1f71('0x28')]);if(_0x12706d[_0x1f71('0x29')]){delete _0x12706d[_0x1f71('0x29')];}_0x513f73[_0x1f71('0x18')](_0x5966f4)['send'](_0x12706d);};}exports[_0x1f71('0x2a')]=function(_0x1f438f,_0x29ca1f){var _0x51ab49={},_0x37e4db={},_0x489b73={'count':0x0,'rows':[]};var _0x3e3610=_[_0x1f71('0x2b')](db[_0x1f71('0x2c')]['rawAttributes'],function(_0x4b2dfb){return{'name':_0x4b2dfb[_0x1f71('0x2d')],'type':_0x4b2dfb[_0x1f71('0x2e')][_0x1f71('0x2f')]};});_0x37e4db[_0x1f71('0x30')]=_[_0x1f71('0x2b')](_0x3e3610,'name');_0x37e4db[_0x1f71('0x31')]=_[_0x1f71('0x32')](_0x1f438f['query']);_0x37e4db[_0x1f71('0x33')]=_['intersection'](_0x37e4db[_0x1f71('0x30')],_0x37e4db['query']);_0x51ab49[_0x1f71('0x34')]=_['intersection'](_0x37e4db['model'],qs[_0x1f71('0x35')](_0x1f438f[_0x1f71('0x31')][_0x1f71('0x35')]));_0x51ab49[_0x1f71('0x34')]=_0x51ab49[_0x1f71('0x34')][_0x1f71('0x36')]?_0x51ab49[_0x1f71('0x34')]:_0x37e4db[_0x1f71('0x30')];if(!_0x1f438f[_0x1f71('0x31')][_0x1f71('0x37')]('nolimit')){_0x51ab49[_0x1f71('0x1b')]=qs[_0x1f71('0x1b')](_0x1f438f[_0x1f71('0x31')][_0x1f71('0x1b')]);_0x51ab49[_0x1f71('0x1d')]=qs[_0x1f71('0x1d')](_0x1f438f[_0x1f71('0x31')][_0x1f71('0x1d')]);}_0x51ab49[_0x1f71('0x38')]=qs['sort'](_0x1f438f['query']['sort']);_0x51ab49[_0x1f71('0x39')]=qs[_0x1f71('0x33')](_[_0x1f71('0x3a')](_0x1f438f[_0x1f71('0x31')],_0x37e4db['filters']),_0x3e3610);if(_0x1f438f[_0x1f71('0x31')][_0x1f71('0x3b')]){_0x51ab49[_0x1f71('0x39')]=_[_0x1f71('0x3c')](_0x51ab49[_0x1f71('0x39')],{'$or':_[_0x1f71('0x2b')](_0x3e3610,function(_0x13df4d){if(_0x13df4d[_0x1f71('0x2e')]!==_0x1f71('0x3d')){var _0x1fec28={};_0x1fec28[_0x13df4d['name']]={'$like':'%'+_0x1f438f[_0x1f71('0x31')]['filter']+'%'};return _0x1fec28;}})});}_0x51ab49=_['merge']({},_0x51ab49,_0x1f438f[_0x1f71('0x3e')]);var _0x217473={'where':_0x51ab49[_0x1f71('0x39')]};return db[_0x1f71('0x2c')]['count'](_0x217473)['then'](function(_0x53f1b5){_0x489b73[_0x1f71('0x1c')]=_0x53f1b5;if(_0x1f438f[_0x1f71('0x31')][_0x1f71('0x3f')]){_0x51ab49[_0x1f71('0x40')]=[{'all':!![]}];}return db[_0x1f71('0x2c')][_0x1f71('0x41')](_0x51ab49);})[_0x1f71('0x23')](function(_0x5f3c1f){_0x489b73[_0x1f71('0x42')]=_0x5f3c1f;return _0x489b73;})[_0x1f71('0x23')](respondWithFilteredResult(_0x29ca1f,_0x51ab49))[_0x1f71('0x43')](handleError(_0x29ca1f,null));};exports['show']=function(_0x265847,_0x35e664){var _0x43b8c3={'raw':!![],'where':{'id':_0x265847[_0x1f71('0x44')]['id']}},_0x52f403={};_0x52f403[_0x1f71('0x30')]=_[_0x1f71('0x32')](db[_0x1f71('0x2c')][_0x1f71('0x45')]);_0x52f403[_0x1f71('0x31')]=_['keys'](_0x265847['query']);_0x52f403[_0x1f71('0x33')]=_[_0x1f71('0x46')](_0x52f403[_0x1f71('0x30')],_0x52f403['query']);_0x43b8c3[_0x1f71('0x34')]=_[_0x1f71('0x46')](_0x52f403[_0x1f71('0x30')],qs['fields'](_0x265847[_0x1f71('0x31')][_0x1f71('0x35')]));_0x43b8c3[_0x1f71('0x34')]=_0x43b8c3[_0x1f71('0x34')]['length']?_0x43b8c3[_0x1f71('0x34')]:_0x52f403['model'];if(_0x265847['query'][_0x1f71('0x3f')]){_0x43b8c3['include']=[{'all':!![]}];}_0x43b8c3=_[_0x1f71('0x3c')]({},_0x43b8c3,_0x265847[_0x1f71('0x3e')]);return db[_0x1f71('0x2c')][_0x1f71('0x47')](_0x43b8c3)['then'](handleEntityNotFound(_0x35e664,null))[_0x1f71('0x23')](respondWithResult(_0x35e664,null))['catch'](handleError(_0x35e664,null));};exports[_0x1f71('0x48')]=function(_0x368c1e,_0x3b7e5b){return db[_0x1f71('0x2c')][_0x1f71('0x48')](_0x368c1e[_0x1f71('0x49')],{})[_0x1f71('0x23')](function(_0x3f61e7){var _0x1cabf7=_0x368c1e['user'][_0x1f71('0x4a')]({'plain':!![]});if(!_0x1cabf7)throw new Error(_0x1f71('0x4b'));if(_0x1cabf7['role']===_0x1f71('0x4c')){var _0x3d2834=_0x3f61e7['get']({'plain':!![]});var _0x766734=_0x1f71('0x25');return db[_0x1f71('0x4d')][_0x1f71('0x47')]({'where':{'name':_0x766734,'userProfileId':_0x1cabf7[_0x1f71('0x4e')]},'raw':!![]})[_0x1f71('0x23')](function(_0x5b2146){if(_0x5b2146&&_0x5b2146[_0x1f71('0x4f')]===0x0){return db['UserProfileResource'][_0x1f71('0x48')]({'name':_0x3d2834[_0x1f71('0x29')],'resourceId':_0x3d2834['id'],'type':_0x5b2146['name'],'sectionId':_0x5b2146['id']},{})[_0x1f71('0x23')](function(){return _0x3f61e7;});}else{return _0x3f61e7;}})[_0x1f71('0x43')](function(_0x5cb584){logger[_0x1f71('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cb584);throw _0x5cb584;});}return _0x3f61e7;})[_0x1f71('0x23')](respondWithResult(_0x3b7e5b,0xc9))[_0x1f71('0x43')](handleError(_0x3b7e5b,null));};exports[_0x1f71('0x22')]=function(_0x781bd8,_0x579fb5){if(_0x781bd8[_0x1f71('0x49')]['id']){delete _0x781bd8['body']['id'];}return db[_0x1f71('0x2c')]['find']({'where':{'id':_0x781bd8[_0x1f71('0x44')]['id']}})[_0x1f71('0x23')](handleEntityNotFound(_0x579fb5,null))[_0x1f71('0x23')](saveUpdates(_0x781bd8['body'],null))[_0x1f71('0x23')](respondWithResult(_0x579fb5,null))[_0x1f71('0x43')](handleError(_0x579fb5,null));};exports[_0x1f71('0x24')]=function(_0x1738a,_0x5db7f6){return db['Variable'][_0x1f71('0x47')]({'where':{'id':_0x1738a[_0x1f71('0x44')]['id']}})['then'](handleEntityNotFound(_0x5db7f6,null))[_0x1f71('0x23')](removeEntity(_0x5db7f6,null))[_0x1f71('0x43')](handleError(_0x5db7f6,null));}; \ No newline at end of file +var _0xabe9=['key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','Variable','fieldName','type'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xabe9,0x7b));var _0x9abe=function(_0x3a7487,_0x119415){_0x3a7487=_0x3a7487-0x0;var _0x47c731=_0xabe9[_0x3a7487];return _0x47c731;};'use strict';var emlformat=require(_0x9abe('0x0'));var rimraf=require(_0x9abe('0x1'));var zipdir=require(_0x9abe('0x2'));var jsonpatch=require(_0x9abe('0x3'));var rp=require(_0x9abe('0x4'));var moment=require(_0x9abe('0x5'));var BPromise=require(_0x9abe('0x6'));var Mustache=require(_0x9abe('0x7'));var util=require('util');var path=require(_0x9abe('0x8'));var sox=require(_0x9abe('0x9'));var csv=require(_0x9abe('0xa'));var ejs=require(_0x9abe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9abe('0xc'));var squel=require(_0x9abe('0xd'));var crypto=require('crypto');var jsforce=require(_0x9abe('0xe'));var deskjs=require(_0x9abe('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9abe('0x10'));var Papa=require('papaparse');var Redis=require(_0x9abe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9abe('0x12'));var as=require(_0x9abe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9abe('0x14'));var utils=require(_0x9abe('0x15'));var config=require(_0x9abe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9abe('0x17'))['db'];function respondWithStatusCode(_0x143b36,_0x258117){_0x258117=_0x258117||0xcc;return function(_0x3566fa){if(_0x3566fa){return _0x143b36[_0x9abe('0x18')](_0x258117);}return _0x143b36['status'](_0x258117)[_0x9abe('0x19')]();};}function respondWithResult(_0x4dc712,_0x51fc30){_0x51fc30=_0x51fc30||0xc8;return function(_0x37afc4){if(_0x37afc4){return _0x4dc712[_0x9abe('0x1a')](_0x51fc30)[_0x9abe('0x1b')](_0x37afc4);}};}function respondWithFilteredResult(_0x2157c5,_0x40d529){return function(_0x317994){if(_0x317994){var _0xa44d41=typeof _0x40d529[_0x9abe('0x1c')]===_0x9abe('0x1d')&&typeof _0x40d529[_0x9abe('0x1e')]==='undefined';var _0x57c15c=_0x317994[_0x9abe('0x1f')];var _0x546330=_0xa44d41?0x0:_0x40d529['offset'];var _0x3a5dee=_0xa44d41?_0x317994[_0x9abe('0x1f')]:_0x40d529[_0x9abe('0x1c')]+_0x40d529[_0x9abe('0x1e')];var _0x116d9b;if(_0x3a5dee>=_0x57c15c){_0x3a5dee=_0x57c15c;_0x116d9b=0xc8;}else{_0x116d9b=0xce;}_0x2157c5['status'](_0x116d9b);return _0x2157c5[_0x9abe('0x20')](_0x9abe('0x21'),_0x546330+'-'+_0x3a5dee+'/'+_0x57c15c)['json'](_0x317994);}return null;};}function patchUpdates(_0x1cbded){return function(_0x4fa0c8){try{jsonpatch[_0x9abe('0x22')](_0x4fa0c8,_0x1cbded,!![]);}catch(_0x3daa6d){return BPromise['reject'](_0x3daa6d);}return _0x4fa0c8[_0x9abe('0x23')]();};}function saveUpdates(_0x4f7558,_0x54c874){return function(_0x519a58){if(_0x519a58){return _0x519a58[_0x9abe('0x24')](_0x4f7558)[_0x9abe('0x25')](function(_0x5416d7){return _0x5416d7;});}return null;};}function removeEntity(_0x19a946,_0x440303){return function(_0x20a0d7){if(_0x20a0d7){return _0x20a0d7[_0x9abe('0x26')]()['then'](function(){var _0x18e51c=_0x20a0d7[_0x9abe('0x27')]({'plain':!![]});var _0xd7f9bc=_0x9abe('0x28');return db[_0x9abe('0x29')][_0x9abe('0x26')]({'where':{'type':_0xd7f9bc,'resourceId':_0x18e51c['id']}})['then'](function(){return _0x20a0d7;});})[_0x9abe('0x25')](function(){_0x19a946[_0x9abe('0x1a')](0xcc)[_0x9abe('0x19')]();});}};}function handleEntityNotFound(_0x2bcd2d,_0x405a77){return function(_0x1cd316){if(!_0x1cd316){_0x2bcd2d[_0x9abe('0x18')](0x194);}return _0x1cd316;};}function handleError(_0x434f72,_0x1b3f5a){_0x1b3f5a=_0x1b3f5a||0x1f4;return function(_0x536aed){logger[_0x9abe('0x2a')](_0x536aed[_0x9abe('0x2b')]);if(_0x536aed[_0x9abe('0x2c')]){delete _0x536aed['name'];}_0x434f72[_0x9abe('0x1a')](_0x1b3f5a)[_0x9abe('0x2d')](_0x536aed);};}exports['index']=function(_0x207757,_0x33f8e1){var _0x410830={},_0x8f8d65={},_0x21e870={'count':0x0,'rows':[]};var _0x5b1c12=_['map'](db[_0x9abe('0x2e')]['rawAttributes'],function(_0x5911e6){return{'name':_0x5911e6[_0x9abe('0x2f')],'type':_0x5911e6[_0x9abe('0x30')][_0x9abe('0x31')]};});_0x8f8d65[_0x9abe('0x32')]=_[_0x9abe('0x33')](_0x5b1c12,'name');_0x8f8d65[_0x9abe('0x34')]=_[_0x9abe('0x35')](_0x207757[_0x9abe('0x34')]);_0x8f8d65[_0x9abe('0x36')]=_[_0x9abe('0x37')](_0x8f8d65['model'],_0x8f8d65['query']);_0x410830['attributes']=_[_0x9abe('0x37')](_0x8f8d65['model'],qs[_0x9abe('0x38')](_0x207757[_0x9abe('0x34')][_0x9abe('0x38')]));_0x410830[_0x9abe('0x39')]=_0x410830[_0x9abe('0x39')][_0x9abe('0x3a')]?_0x410830['attributes']:_0x8f8d65[_0x9abe('0x32')];if(!_0x207757[_0x9abe('0x34')][_0x9abe('0x3b')](_0x9abe('0x3c'))){_0x410830[_0x9abe('0x1e')]=qs[_0x9abe('0x1e')](_0x207757[_0x9abe('0x34')][_0x9abe('0x1e')]);_0x410830['offset']=qs[_0x9abe('0x1c')](_0x207757[_0x9abe('0x34')][_0x9abe('0x1c')]);}_0x410830[_0x9abe('0x3d')]=qs[_0x9abe('0x3e')](_0x207757[_0x9abe('0x34')][_0x9abe('0x3e')]);_0x410830[_0x9abe('0x3f')]=qs[_0x9abe('0x36')](_['pick'](_0x207757[_0x9abe('0x34')],_0x8f8d65[_0x9abe('0x36')]),_0x5b1c12);if(_0x207757[_0x9abe('0x34')]['filter']){_0x410830[_0x9abe('0x3f')]=_[_0x9abe('0x40')](_0x410830[_0x9abe('0x3f')],{'$or':_[_0x9abe('0x33')](_0x5b1c12,function(_0x5456c8){if(_0x5456c8[_0x9abe('0x30')]!==_0x9abe('0x41')){var _0x491b53={};_0x491b53[_0x5456c8['name']]={'$like':'%'+_0x207757[_0x9abe('0x34')][_0x9abe('0x42')]+'%'};return _0x491b53;}})});}_0x410830=_[_0x9abe('0x40')]({},_0x410830,_0x207757['options']);var _0x3677c8={'where':_0x410830['where']};return db['Variable']['count'](_0x3677c8)['then'](function(_0x8790c6){_0x21e870['count']=_0x8790c6;if(_0x207757['query'][_0x9abe('0x43')]){_0x410830['include']=[{'all':!![]}];}return db[_0x9abe('0x2e')][_0x9abe('0x44')](_0x410830);})[_0x9abe('0x25')](function(_0x4a49d1){_0x21e870[_0x9abe('0x45')]=_0x4a49d1;return _0x21e870;})[_0x9abe('0x25')](respondWithFilteredResult(_0x33f8e1,_0x410830))[_0x9abe('0x46')](handleError(_0x33f8e1,null));};exports[_0x9abe('0x47')]=function(_0x1e904c,_0x2e6914){var _0xbbfa3d={'raw':!![],'where':{'id':_0x1e904c[_0x9abe('0x48')]['id']}},_0xf761e2={};_0xf761e2[_0x9abe('0x32')]=_[_0x9abe('0x35')](db[_0x9abe('0x2e')][_0x9abe('0x49')]);_0xf761e2[_0x9abe('0x34')]=_[_0x9abe('0x35')](_0x1e904c[_0x9abe('0x34')]);_0xf761e2[_0x9abe('0x36')]=_[_0x9abe('0x37')](_0xf761e2['model'],_0xf761e2['query']);_0xbbfa3d['attributes']=_[_0x9abe('0x37')](_0xf761e2[_0x9abe('0x32')],qs[_0x9abe('0x38')](_0x1e904c['query'][_0x9abe('0x38')]));_0xbbfa3d['attributes']=_0xbbfa3d['attributes']['length']?_0xbbfa3d[_0x9abe('0x39')]:_0xf761e2[_0x9abe('0x32')];if(_0x1e904c[_0x9abe('0x34')]['includeAll']){_0xbbfa3d[_0x9abe('0x4a')]=[{'all':!![]}];}_0xbbfa3d=_[_0x9abe('0x40')]({},_0xbbfa3d,_0x1e904c[_0x9abe('0x4b')]);return db['Variable'][_0x9abe('0x4c')](_0xbbfa3d)[_0x9abe('0x25')](handleEntityNotFound(_0x2e6914,null))[_0x9abe('0x25')](respondWithResult(_0x2e6914,null))[_0x9abe('0x46')](handleError(_0x2e6914,null));};exports['create']=function(_0x556e0a,_0x582cc3){return db[_0x9abe('0x2e')][_0x9abe('0x4d')](_0x556e0a[_0x9abe('0x4e')],{})[_0x9abe('0x25')](function(_0x3d4e20){var _0x1ed336=_0x556e0a[_0x9abe('0x4f')][_0x9abe('0x27')]({'plain':!![]});if(!_0x1ed336)throw new Error(_0x9abe('0x50'));if(_0x1ed336[_0x9abe('0x51')]===_0x9abe('0x4f')){var _0x5658ea=_0x3d4e20[_0x9abe('0x27')]({'plain':!![]});var _0x2666a7=_0x9abe('0x28');return db[_0x9abe('0x52')][_0x9abe('0x4c')]({'where':{'name':_0x2666a7,'userProfileId':_0x1ed336[_0x9abe('0x53')]},'raw':!![]})['then'](function(_0x5a6d12){if(_0x5a6d12&&_0x5a6d12[_0x9abe('0x54')]===0x0){return db[_0x9abe('0x29')][_0x9abe('0x4d')]({'name':_0x5658ea[_0x9abe('0x2c')],'resourceId':_0x5658ea['id'],'type':_0x5a6d12['name'],'sectionId':_0x5a6d12['id']},{})[_0x9abe('0x25')](function(){return _0x3d4e20;});}else{return _0x3d4e20;}})[_0x9abe('0x46')](function(_0x5a57b2){logger['error'](_0x9abe('0x55'),_0x5a57b2);throw _0x5a57b2;});}return _0x3d4e20;})['then'](respondWithResult(_0x582cc3,0xc9))[_0x9abe('0x46')](handleError(_0x582cc3,null));};exports[_0x9abe('0x24')]=function(_0x2188ec,_0x241e96){if(_0x2188ec[_0x9abe('0x4e')]['id']){delete _0x2188ec[_0x9abe('0x4e')]['id'];}return db[_0x9abe('0x2e')][_0x9abe('0x4c')]({'where':{'id':_0x2188ec['params']['id']}})[_0x9abe('0x25')](handleEntityNotFound(_0x241e96,null))['then'](saveUpdates(_0x2188ec[_0x9abe('0x4e')],null))['then'](respondWithResult(_0x241e96,null))[_0x9abe('0x46')](handleError(_0x241e96,null));};exports['destroy']=function(_0x2af477,_0x5edb63){return db['Variable'][_0x9abe('0x4c')]({'where':{'id':_0x2af477[_0x9abe('0x48')]['id']}})[_0x9abe('0x25')](handleEntityNotFound(_0x5edb63,null))[_0x9abe('0x25')](removeEntity(_0x5edb63,null))[_0x9abe('0x46')](handleError(_0x5edb63,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 54cc176..0f5f8c7 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 _0x0b46=['api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash','util','../../config/logger'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x0b46,0x1dd));var _0x60b4=function(_0x6b888e,_0x420fed){_0x6b888e=_0x6b888e-0x0;var _0x17d0f6=_0x0b46[_0x6b888e];return _0x17d0f6;};'use strict';var _=require(_0x60b4('0x0'));var util=require(_0x60b4('0x1'));var logger=require(_0x60b4('0x2'))(_0x60b4('0x3'));var moment=require('moment');var BPromise=require(_0x60b4('0x4'));var rp=require(_0x60b4('0x5'));var fs=require('fs');var path=require(_0x60b4('0x6'));var rimraf=require(_0x60b4('0x7'));var config=require(_0x60b4('0x8'));var attributes=require(_0x60b4('0x9'));module[_0x60b4('0xa')]=function(_0x2621cf,_0x2faf16){return _0x2621cf['define']('Variable',attributes,{'tableName':_0x60b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23db=['request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger','moment','bluebird'];(function(_0x1493b8,_0x1e59f0){var _0x2a62a9=function(_0x25630b){while(--_0x25630b){_0x1493b8['push'](_0x1493b8['shift']());}};_0x2a62a9(++_0x1e59f0);}(_0x23db,0x170));var _0xb23d=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x23db[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xb23d('0x0'));var util=require('util');var logger=require(_0xb23d('0x1'))('api');var moment=require(_0xb23d('0x2'));var BPromise=require(_0xb23d('0x3'));var rp=require(_0xb23d('0x4'));var fs=require('fs');var path=require(_0xb23d('0x5'));var rimraf=require(_0xb23d('0x6'));var config=require('../../config/environment');var attributes=require(_0xb23d('0x7'));module[_0xb23d('0x8')]=function(_0x4bd5eb,_0xe96fda){return _0x4bd5eb[_0xb23d('0x9')](_0xb23d('0xa'),attributes,{'tableName':_0xb23d('0xb'),'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 10ce8a7..e565e20 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0xffb982,_0x13e8f1){var _0x111c06=function(_0x162e70){while(--_0x162e70){_0xffb982['push'](_0xffb982['shift']());}};_0x111c06(++_0x13e8f1);}(_0x814b,0x1a2));var _0xb814=function(_0x101ccf,_0x37e172){_0x101ccf=_0x101ccf-0x0;var _0x99b0f1=_0x814b[_0x101ccf];return _0x99b0f1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa41a,0x6b));var _0xaa41=function(_0x3ee2e3,_0x17a747){_0x3ee2e3=_0x3ee2e3-0x0;var _0x4e2ced=_0xa41a[_0x3ee2e3];return _0x4e2ced;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 872930a..d1f2757 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 _0xa6a0=['migrations','exports','express','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/restart','restart','/migrations'];(function(_0x5b9e41,_0x3f57ec){var _0x515699=function(_0x5727db){while(--_0x5727db){_0x5b9e41['push'](_0x5b9e41['shift']());}};_0x515699(++_0x3f57ec);}(_0xa6a0,0x92));var _0x0a6a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa6a0[_0x1035c1];return _0x308d67;};'use strict';var express=require(_0x0a6a('0x0'));var router=express['Router']();var auth=require(_0x0a6a('0x1'));var controller=require(_0x0a6a('0x2'));router[_0x0a6a('0x3')]('/',controller['index']);router[_0x0a6a('0x3')](_0x0a6a('0x4'),auth[_0x0a6a('0x5')](),auth[_0x0a6a('0x6')](),controller[_0x0a6a('0x7')]);router[_0x0a6a('0x3')](_0x0a6a('0x8'),auth[_0x0a6a('0x5')](),auth[_0x0a6a('0x6')](),controller['reset']);router['get'](_0x0a6a('0x9'),auth['isAuthenticated'](),auth[_0x0a6a('0x6')](),controller[_0x0a6a('0xa')]);router[_0x0a6a('0x3')](_0x0a6a('0xb'),auth[_0x0a6a('0x5')](),controller[_0x0a6a('0xc')]);router[_0x0a6a('0x3')](_0x0a6a('0xd'),controller[_0x0a6a('0xe')]);module[_0x0a6a('0xf')]=router; \ No newline at end of file +var _0xd28e=['isAuthenticated','canUpdate','/reset','reset','/pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x182fae,_0x55fcef){var _0x55f7e9=function(_0x4eb15c){while(--_0x4eb15c){_0x182fae['push'](_0x182fae['shift']());}};_0x55f7e9(++_0x55fcef);}(_0xd28e,0x1b3));var _0xed28=function(_0x1e1e17,_0x2b9f1c){_0x1e1e17=_0x1e1e17-0x0;var _0x34353f=_0xd28e[_0x1e1e17];return _0x34353f;};'use strict';var express=require(_0xed28('0x0'));var router=express[_0xed28('0x1')]();var auth=require(_0xed28('0x2'));var controller=require(_0xed28('0x3'));router[_0xed28('0x4')]('/',controller[_0xed28('0x5')]);router[_0xed28('0x4')](_0xed28('0x6'),auth[_0xed28('0x7')](),auth[_0xed28('0x8')](),controller['fetch']);router['get'](_0xed28('0x9'),auth[_0xed28('0x7')](),auth[_0xed28('0x8')](),controller[_0xed28('0xa')]);router[_0xed28('0x4')](_0xed28('0xb'),auth[_0xed28('0x7')](),auth[_0xed28('0x8')](),controller['pull']);router['get'](_0xed28('0xc'),auth[_0xed28('0x7')](),controller[_0xed28('0xd')]);router[_0xed28('0x4')](_0xed28('0xe'),controller[_0xed28('0xf')]);module[_0xed28('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 aeb155c..425dbfc 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 _0xc48c=['master','json','info','git\x20fetch','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','length','replace','push','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','.js','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','2.0.0','status','fetch'];(function(_0x2c9585,_0x3e5ef0){var _0x52adef=function(_0x187c14){while(--_0x187c14){_0x2c9585['push'](_0x2c9585['shift']());}};_0x52adef(++_0x3e5ef0);}(_0xc48c,0x158));var _0xcc48=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc48c[_0x1facfa];return _0x9ec701;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xcc48('0x0'));var pkginfo=require(_0xcc48('0x1'))(module,_0xcc48('0x2'));var compareVersions=require(_0xcc48('0x3'));var exec=require(_0xcc48('0x4'))[_0xcc48('0x5')];var db=require(_0xcc48('0x6'))['db'];var config=require(_0xcc48('0x7'));var pm2=require('../../config/pm2');var logger=require(_0xcc48('0x8'))(_0xcc48('0x9'));var git=require(_0xcc48('0xa'))(config[_0xcc48('0xb')]);exports[_0xcc48('0xc')]=function(_0x371675,_0x3312ff){var _0xde5fc6={'current':module[_0xcc48('0xd')]['version'],'phonebar':0x2};if(_0x371675[_0xcc48('0xe')]&&_0x371675[_0xcc48('0xe')][_0xcc48('0xf')]){return git['fetch']()[_0xcc48('0x10')](function(_0x5d74e9,_0x3eb42f){_0xde5fc6['latest']=(_0x5d74e9?module['exports']['version']:_0x3eb42f['latest'])||_0xcc48('0x11');return _0x3312ff[_0xcc48('0x12')](0xc8)['json'](_0xde5fc6);});}else{return _0x3312ff[_0xcc48('0x12')](0xc8)['json'](_0xde5fc6);}};exports[_0xcc48('0x13')]=function(_0x41de83,_0x3c0f88){return git['fetch'](['origin',_0xcc48('0x14')],function(_0x30aec9){if(_0x30aec9){logger['error'](_0x30aec9);return _0x3c0f88[_0xcc48('0x12')](0x1f4)[_0xcc48('0x15')](_0x30aec9);}logger[_0xcc48('0x16')](_0xcc48('0x17'));return _0x3c0f88[_0xcc48('0x12')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xcc48('0x18')]=function(_0x20f016,_0x81a3e5){return git[_0xcc48('0x18')]([_0xcc48('0x19'),_0xcc48('0x1a')],function(_0x39ecb9){if(_0x39ecb9){logger[_0xcc48('0x1b')](_0x39ecb9);return _0x81a3e5['status'](0x1f4)['json'](_0x39ecb9);}logger[_0xcc48('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x81a3e5[_0xcc48('0x12')](0xc8)[_0xcc48('0x15')]({'output':_0xcc48('0x1c')});});};exports[_0xcc48('0x1d')]=function(_0x421cd9,_0xe0dc53){exec('npm\x20install\x20--production',function(_0x484493,_0xa6ed5,_0x38d053){logger[_0xcc48('0x16')](_0xa6ed5);logger['info'](_0x38d053);if(_0x484493){logger['error'](_0x484493);return _0xe0dc53[_0xcc48('0x12')](0x1f4)[_0xcc48('0x15')](_0x484493);}return _0xe0dc53[_0xcc48('0x12')](0xc8)[_0xcc48('0x15')]({'output':_0xa6ed5});});};exports['restart']=function(_0x354415,_0x2c401a){return pm2[_0xcc48('0x1e')](_0xcc48('0x1f'))[_0xcc48('0x20')](function(_0xd4b00f){logger[_0xcc48('0x16')](_0xcc48('0x21'),_0xd4b00f);return _0x2c401a[_0xcc48('0x12')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x12cc27){logger['error'](_0x12cc27);return _0x2c401a[_0xcc48('0x12')](0x1f4)[_0xcc48('0x15')](_0x12cc27);});};exports[_0xcc48('0x22')]=function(_0x20c147,_0x1e1ed7){var _0x361788=fs[_0xcc48('0x23')](path[_0xcc48('0x24')](config[_0xcc48('0xb')],'server',_0xcc48('0x22')));var _0x31355f=[];for(var _0x1d3682=0x0;_0x1d3682<_0x361788[_0xcc48('0x25')];_0x1d3682++){var _0x3e7e26=_0x361788[_0x1d3682][_0xcc48('0x26')]('.js','');if(compareVersions(module['exports'][_0xcc48('0x2')],_0x3e7e26)===-0x1){_0x31355f[_0xcc48('0x27')](_0x3e7e26);}}if(_0x31355f['length']){var _0x371f81=_0x31355f['sort'](compareVersions);var _0x121b41=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xcc48('0x28')],'modelName':_0xcc48('0x28'),'columnName':_0xcc48('0x2')},'migrations':{'params':[db[_0xcc48('0x29')][_0xcc48('0x2a')](),db[_0xcc48('0x29')][_0xcc48('0x2b')],function(){throw new Error(_0xcc48('0x2c'));}],'path':path[_0xcc48('0x24')](config['root'],_0xcc48('0x2d'),'migrations'),'pattern':/\.js$/}});_0x121b41['up']({'migrations':_[_0xcc48('0x2e')](_0x371f81,function(_0x330497){return _0x330497+_0xcc48('0x2f');})})[_0xcc48('0x20')](function(){return _0x1e1ed7[_0xcc48('0x12')](0xc8)[_0xcc48('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xcc48('0xd')]['version']+_0xcc48('0x30')+_['last'](_0x371f81),'migrations':_['join'](_0x371f81)});})[_0xcc48('0x31')](function(_0x5102e2){if(_0x5102e2 instanceof db[_0xcc48('0x29')][_0xcc48('0x32')]){return _0x1e1ed7[_0xcc48('0x12')](0xc8)[_0xcc48('0x15')]({'output':_0xcc48('0x33')});}else{return _0x1e1ed7[_0xcc48('0x12')](0x1f4)[_0xcc48('0x15')](_0x5102e2);}});}else{return _0x1e1ed7[_0xcc48('0x12')](0xc8)[_0xcc48('0x15')]({'output':_0xcc48('0x33')});}}; \ No newline at end of file +var _0x1804=['error','status','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','.js','length','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','2.0.0','json','fetch','origin'];(function(_0x31ead7,_0x2e9a7c){var _0x3516f0=function(_0x47fa36){while(--_0x47fa36){_0x31ead7['push'](_0x31ead7['shift']());}};_0x3516f0(++_0x2e9a7c);}(_0x1804,0x166));var _0x4180=function(_0x403b7e,_0x5995ad){_0x403b7e=_0x403b7e-0x0;var _0x2c3b8c=_0x1804[_0x403b7e];return _0x2c3b8c;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x4180('0x0'))(module,_0x4180('0x1'));var compareVersions=require(_0x4180('0x2'));var exec=require(_0x4180('0x3'))[_0x4180('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0x4180('0x5'));var pm2=require(_0x4180('0x6'));var logger=require(_0x4180('0x7'))('update');var git=require(_0x4180('0x8'))(config[_0x4180('0x9')]);exports[_0x4180('0xa')]=function(_0x28d176,_0x2438a){var _0x364a2a={'current':module[_0x4180('0xb')][_0x4180('0x1')],'phonebar':0x2};if(_0x28d176[_0x4180('0xc')]&&_0x28d176[_0x4180('0xc')][_0x4180('0xd')]){return git['fetch']()['tags'](function(_0x1dfc43,_0x24d527){_0x364a2a['latest']=(_0x1dfc43?module[_0x4180('0xb')][_0x4180('0x1')]:_0x24d527[_0x4180('0xd')])||_0x4180('0xe');return _0x2438a['status'](0xc8)[_0x4180('0xf')](_0x364a2a);});}else{return _0x2438a['status'](0xc8)[_0x4180('0xf')](_0x364a2a);}};exports[_0x4180('0x10')]=function(_0x6af9be,_0x54eff3){return git[_0x4180('0x10')]([_0x4180('0x11'),'master'],function(_0x52a90a){if(_0x52a90a){logger[_0x4180('0x12')](_0x52a90a);return _0x54eff3[_0x4180('0x13')](0x1f4)[_0x4180('0xf')](_0x52a90a);}logger[_0x4180('0x14')](_0x4180('0x15'));return _0x54eff3[_0x4180('0x13')](0xc8)[_0x4180('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x4180('0x16')]=function(_0x4f4e6a,_0x3b7b61){return git['reset']([_0x4180('0x17'),'FETCH_HEAD'],function(_0x146c66){if(_0x146c66){logger[_0x4180('0x12')](_0x146c66);return _0x3b7b61['status'](0x1f4)['json'](_0x146c66);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3b7b61[_0x4180('0x13')](0xc8)[_0x4180('0xf')]({'output':_0x4180('0x18')});});};exports[_0x4180('0x19')]=function(_0x4cef03,_0x36979d){exec('npm\x20install\x20--production',function(_0x138783,_0x402244,_0x332df){logger[_0x4180('0x14')](_0x402244);logger[_0x4180('0x14')](_0x332df);if(_0x138783){logger['error'](_0x138783);return _0x36979d['status'](0x1f4)[_0x4180('0xf')](_0x138783);}return _0x36979d[_0x4180('0x13')](0xc8)[_0x4180('0xf')]({'output':_0x402244});});};exports[_0x4180('0x1a')]=function(_0x1d0bde,_0x58643d){return pm2['restart'](_0x4180('0x1b'))[_0x4180('0x1c')](function(_0x9b5ef2){logger[_0x4180('0x14')](_0x4180('0x1d'),_0x9b5ef2);return _0x58643d[_0x4180('0x13')](0xc8)[_0x4180('0xf')]({'output':_0x4180('0x1e')});})[_0x4180('0x1f')](function(_0xde2650){logger[_0x4180('0x12')](_0xde2650);return _0x58643d[_0x4180('0x13')](0x1f4)[_0x4180('0xf')](_0xde2650);});};exports[_0x4180('0x20')]=function(_0x570fd6,_0x4361bd){var _0x509617=fs[_0x4180('0x21')](path['join'](config[_0x4180('0x9')],_0x4180('0x22'),_0x4180('0x20')));var _0x1198dc=[];for(var _0x4b69a7=0x0;_0x4b69a7<_0x509617['length'];_0x4b69a7++){var _0x3002f8=_0x509617[_0x4b69a7]['replace'](_0x4180('0x23'),'');if(compareVersions(module[_0x4180('0xb')]['version'],_0x3002f8)===-0x1){_0x1198dc['push'](_0x3002f8);}}if(_0x1198dc[_0x4180('0x24')]){var _0x41f8d2=_0x1198dc[_0x4180('0x25')](compareVersions);var _0x5b298e=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x4180('0x26'),'columnName':'version'},'migrations':{'params':[db[_0x4180('0x27')][_0x4180('0x28')](),db[_0x4180('0x27')]['constructor'],function(){throw new Error(_0x4180('0x29'));}],'path':path[_0x4180('0x2a')](config[_0x4180('0x9')],'server',_0x4180('0x20')),'pattern':/\.js$/}});_0x5b298e['up']({'migrations':_[_0x4180('0x2b')](_0x41f8d2,function(_0x5318d1){return _0x5318d1+_0x4180('0x23');})})[_0x4180('0x1c')](function(){return _0x4361bd[_0x4180('0x13')](0xc8)[_0x4180('0xf')]({'output':_0x4180('0x2c')+module[_0x4180('0xb')][_0x4180('0x1')]+_0x4180('0x2d')+_['last'](_0x41f8d2),'migrations':_[_0x4180('0x2a')](_0x41f8d2)});})['catch'](function(_0x2500a6){if(_0x2500a6 instanceof db[_0x4180('0x27')]['UniqueConstraintError']){return _0x4361bd[_0x4180('0x13')](0xc8)[_0x4180('0xf')]({'output':_0x4180('0x2e')});}else{return _0x4361bd['status'](0x1f4)['json'](_0x2500a6);}});}else{return _0x4361bd[_0x4180('0x13')](0xc8)[_0x4180('0xf')]({'output':_0x4180('0x2e')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 216eead..9d0c44a 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 _0x0a52=['isAuthenticated','/describe','describe','show','post','create','put','/:id','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get'];(function(_0x22fb53,_0x33b1de){var _0x5128eb=function(_0x5c268e){while(--_0x5c268e){_0x22fb53['push'](_0x22fb53['shift']());}};_0x5128eb(++_0x33b1de);}(_0x0a52,0x107));var _0x20a5=function(_0x1c6bfa,_0x6c61de){_0x1c6bfa=_0x1c6bfa-0x0;var _0x5a1500=_0x0a52[_0x1c6bfa];return _0x5a1500;};'use strict';var multer=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var path=require(_0x20a5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x20a5('0x3')]();var fs_extra=require(_0x20a5('0x4'));var auth=require(_0x20a5('0x5'));var interaction=require(_0x20a5('0x6'));var config=require('../../config/environment');var controller=require(_0x20a5('0x7'));router[_0x20a5('0x8')]('/',auth[_0x20a5('0x9')](),controller['index']);router['get'](_0x20a5('0xa'),auth[_0x20a5('0x9')](),controller[_0x20a5('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x20a5('0xc')]);router[_0x20a5('0xd')]('/',auth[_0x20a5('0x9')](),controller[_0x20a5('0xe')]);router[_0x20a5('0xf')](_0x20a5('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x20a5('0x10'),auth[_0x20a5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0111=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','util','path'];(function(_0x41a9c7,_0x4db5bf){var _0x436323=function(_0x2814b0){while(--_0x2814b0){_0x41a9c7['push'](_0x41a9c7['shift']());}};_0x436323(++_0x4db5bf);}(_0x0111,0x1ce));var _0x1011=function(_0x33911c,_0x2429de){_0x33911c=_0x33911c-0x0;var _0x33c5e4=_0x0111[_0x33911c];return _0x33c5e4;};'use strict';var multer=require('multer');var util=require(_0x1011('0x0'));var path=require(_0x1011('0x1'));var timeout=require(_0x1011('0x2'));var express=require(_0x1011('0x3'));var router=express['Router']();var fs_extra=require(_0x1011('0x4'));var auth=require(_0x1011('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1011('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x1011('0x7')]('/',auth[_0x1011('0x8')](),controller[_0x1011('0x9')]);router['get']('/describe',auth[_0x1011('0x8')](),controller['describe']);router[_0x1011('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1011('0xa')]);router['post']('/',auth[_0x1011('0x8')](),controller[_0x1011('0xb')]);router['put'](_0x1011('0xc'),auth[_0x1011('0x8')](),controller[_0x1011('0xd')]);router[_0x1011('0xe')](_0x1011('0xc'),auth['isAuthenticated'](),controller[_0x1011('0xf')]);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 041f5bc..2e2c21f 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 _0x8eba=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x1b3138,_0x53dbb6){var _0x290447=function(_0x1755fd){while(--_0x1755fd){_0x1b3138['push'](_0x1b3138['shift']());}};_0x290447(++_0x53dbb6);}(_0x8eba,0xc3));var _0xa8eb=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x8eba[_0x2dc96f];return _0xd012da;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa8eb('0x2')]},'queue':{'type':Sequelize[_0xa8eb('0x2')]},'interface':{'type':Sequelize[_0xa8eb('0x2')]},'membername':{'type':Sequelize[_0xa8eb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa8eb('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xa8eb('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xa8eb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa8eb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa8eb('0x5')]},'reason':{'type':Sequelize[_0xa8eb('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa8eb('0x2')]},'channelstate':{'type':Sequelize[_0xa8eb('0x5')]},'channelstatedesc':{'type':Sequelize[_0xa8eb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa8eb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa8eb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa8eb('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa8eb('0x2')]},'destchannel':{'type':Sequelize[_0xa8eb('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa8eb('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa8eb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa8eb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa8eb('0x2')]},'destlanguage':{'type':Sequelize[_0xa8eb('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa8eb('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa8eb('0x2')]},'destuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa8eb('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa8eb('0x2')],'comment':_0xa8eb('0x6')},'transferexten':{'type':Sequelize[_0xa8eb('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'agententerreason':{'type':Sequelize[_0xa8eb('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02a7=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN'];(function(_0x3897fe,_0x24fa8c){var _0x466fdf=function(_0x386372){while(--_0x386372){_0x3897fe['push'](_0x3897fe['shift']());}};_0x466fdf(++_0x24fa8c);}(_0x02a7,0x1a6));var _0x702a=function(_0x171715,_0x54a1d7){_0x171715=_0x171715-0x0;var _0x404561=_0x02a7[_0x171715];return _0x404561;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'type':{'type':Sequelize[_0x702a('0x1')]},'uniqueid':{'type':Sequelize[_0x702a('0x1')]},'calleridnum':{'type':Sequelize[_0x702a('0x1')]},'calleridname':{'type':Sequelize[_0x702a('0x1')]},'queue':{'type':Sequelize[_0x702a('0x1')]},'interface':{'type':Sequelize[_0x702a('0x1')]},'membername':{'type':Sequelize[_0x702a('0x1')]},'agentcalledAt':{'type':Sequelize[_0x702a('0x2')]},'agentconnectAt':{'type':Sequelize[_0x702a('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x702a('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x702a('0x1')]},'lastevent':{'type':Sequelize[_0x702a('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x702a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x702a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x702a('0x1')]},'connectedlinename':{'type':Sequelize[_0x702a('0x1')]},'language':{'type':Sequelize[_0x702a('0x1')]},'accountcode':{'type':Sequelize[_0x702a('0x1')]},'context':{'type':Sequelize[_0x702a('0x1')]},'exten':{'type':Sequelize[_0x702a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x702a('0x1')]},'destchannelstate':{'type':Sequelize[_0x702a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x702a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x702a('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x702a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x702a('0x1')]},'destlanguage':{'type':Sequelize[_0x702a('0x1')]},'destaccountcode':{'type':Sequelize[_0x702a('0x1')]},'destcontext':{'type':Sequelize[_0x702a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x702a('0x1')]},'destuniqueid':{'type':Sequelize[_0x702a('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x702a('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x702a('0x1')]},'transfer':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x702a('0x1')],'comment':_0x702a('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x702a('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 7c8de69..9ef5c75 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(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 c44415d..e1fa8ef 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 _0x9fc5=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid'];(function(_0x5f4749,_0x50acc3){var _0x57d267=function(_0x384399){while(--_0x384399){_0x5f4749['push'](_0x5f4749['shift']());}};_0x57d267(++_0x50acc3);}(_0x9fc5,0xb6));var _0x59fc=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x9fc5[_0x55969b];return _0x3d7fc1;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var logger=require(_0x59fc('0x1'))('api');var moment=require(_0x59fc('0x2'));var BPromise=require(_0x59fc('0x3'));var rp=require(_0x59fc('0x4'));var fs=require('fs');var path=require(_0x59fc('0x5'));var rimraf=require(_0x59fc('0x6'));var config=require(_0x59fc('0x7'));var attributes=require(_0x59fc('0x8'));module[_0x59fc('0x9')]=function(_0x4cb94d,_0x3bde0b){return _0x4cb94d[_0x59fc('0xa')](_0x59fc('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x59fc('0xc'),_0x59fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c3=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var moment=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var rp=require(_0x3e0c('0x5'));var fs=require('fs');var path=require(_0x3e0c('0x6'));var rimraf=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var attributes=require(_0x3e0c('0x9'));module['exports']=function(_0x530ebf,_0x163adf){return _0x530ebf[_0x3e0c('0xa')](_0x3e0c('0xb'),attributes,{'tableName':_0x3e0c('0xc'),'paranoid':![],'indexes':[{'fields':[_0x3e0c('0xd'),_0x3e0c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f1144d7..4f1b18b 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 _0xcb6d=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','where','attributes','limit'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xcb6d,0x180));var _0xdcb6=function(_0x224ee1,_0x3361bc){_0x224ee1=_0x224ee1-0x0;var _0xa84cef=_0xcb6d[_0x224ee1];return _0xa84cef;};'use strict';var _=require(_0xdcb6('0x0'));var util=require(_0xdcb6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdcb6('0x2'));var fs=require('fs');var Redis=require(_0xdcb6('0x3'));var db=require(_0xdcb6('0x4'))['db'];var utils=require(_0xdcb6('0x5'));var logger=require('../../config/logger')(_0xdcb6('0x6'));var config=require('../../config/environment');var jayson=require(_0xdcb6('0x7'));var client=jayson[_0xdcb6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6bc411,_0x12e99f,_0x384ad1){return new BPromise(function(_0x556937,_0x311440){return client[_0xdcb6('0x9')](_0x6bc411,_0x384ad1)[_0xdcb6('0xa')](function(_0x239055){logger[_0xdcb6('0xb')](_0xdcb6('0xc'),_0x12e99f,_0xdcb6('0xd'));logger[_0xdcb6('0xe')](_0xdcb6('0xf'),_0x12e99f,_0xdcb6('0xd'),JSON[_0xdcb6('0x10')](_0x239055));if(_0x239055[_0xdcb6('0x11')]){if(_0x239055[_0xdcb6('0x11')][_0xdcb6('0x12')]===0x1f4){logger['error'](_0xdcb6('0xc'),_0x12e99f,_0x239055['error'][_0xdcb6('0x13')]);return _0x311440(_0x239055[_0xdcb6('0x11')][_0xdcb6('0x13')]);}logger[_0xdcb6('0x11')](_0xdcb6('0xc'),_0x12e99f,_0x239055[_0xdcb6('0x11')]['message']);return _0x556937(_0x239055[_0xdcb6('0x11')][_0xdcb6('0x13')]);}else{logger[_0xdcb6('0xb')](_0xdcb6('0xc'),_0x12e99f,_0xdcb6('0xd'));_0x556937(_0x239055[_0xdcb6('0x14')][_0xdcb6('0x13')]);}})[_0xdcb6('0x15')](function(_0x3fa702){logger[_0xdcb6('0x11')](_0xdcb6('0xc'),_0x12e99f,_0x3fa702);_0x311440(_0x3fa702);});});}exports[_0xdcb6('0x16')]=function(_0x18b404){var _0x3f4eed=this;return new Promise(function(_0x1cc84e,_0x155192){return db[_0xdcb6('0x17')][_0xdcb6('0x18')](_0x18b404[_0xdcb6('0x19')],{'raw':_0x18b404['options']?_0x18b404[_0xdcb6('0x1a')][_0xdcb6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x49df8c){logger[_0xdcb6('0xb')]('CreateVoiceAgentReport',_0x18b404);logger[_0xdcb6('0xe')]('CreateVoiceAgentReport',_0x18b404,JSON[_0xdcb6('0x10')](_0x49df8c));_0x1cc84e(_0x49df8c);})[_0xdcb6('0x15')](function(_0x40e05f){logger[_0xdcb6('0x11')](_0xdcb6('0x16'),_0x40e05f['message'],_0x18b404);_0x155192(_0x3f4eed[_0xdcb6('0x11')](0x1f4,_0x40e05f[_0xdcb6('0x13')]));});});};exports[_0xdcb6('0x1c')]=function(_0x3c658c){var _0x31a96e=this;return new Promise(function(_0x58b936,_0xa40b52){return db[_0xdcb6('0x17')]['update'](_0x3c658c[_0xdcb6('0x19')],{'raw':_0x3c658c[_0xdcb6('0x1a')]?_0x3c658c[_0xdcb6('0x1a')][_0xdcb6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c658c[_0xdcb6('0x1a')]?_0x3c658c[_0xdcb6('0x1a')][_0xdcb6('0x1d')]||null:null,'attributes':_0x3c658c[_0xdcb6('0x1a')]?_0x3c658c['options'][_0xdcb6('0x1e')]||null:null,'limit':_0x3c658c['options']?_0x3c658c[_0xdcb6('0x1a')][_0xdcb6('0x1f')]||null:null})[_0xdcb6('0xa')](function(_0x1c34b3){logger['info'](_0xdcb6('0x1c'),_0x3c658c);logger[_0xdcb6('0xe')](_0xdcb6('0x1c'),_0x3c658c,JSON[_0xdcb6('0x10')](_0x1c34b3));_0x58b936(_0x1c34b3);})[_0xdcb6('0x15')](function(_0x991574){logger['error']('UpdateVoiceAgentReport',_0x991574['message'],_0x3c658c);_0xa40b52(_0x31a96e[_0xdcb6('0x11')](0x1f4,_0x991574[_0xdcb6('0x13')]));});});}; \ No newline at end of file +var _0x169f=['VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','update','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4f4c11,_0xdb6add){var _0x4dfd33=function(_0x163cfe){while(--_0x163cfe){_0x4f4c11['push'](_0x4f4c11['shift']());}};_0x4dfd33(++_0xdb6add);}(_0x169f,0xc4));var _0xf169=function(_0x2275b0,_0x29c8cb){_0x2275b0=_0x2275b0-0x0;var _0x2e29f7=_0x169f[_0x2275b0];return _0x2e29f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf169('0x0'));var BPromise=require(_0xf169('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf169('0x2'));var db=require(_0xf169('0x3'))['db'];var utils=require(_0xf169('0x4'));var logger=require(_0xf169('0x5'))(_0xf169('0x6'));var config=require(_0xf169('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf169('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x270e06,_0x4a7752,_0x115039){return new BPromise(function(_0x5d8b59,_0x2cbb63){return client[_0xf169('0x9')](_0x270e06,_0x115039)[_0xf169('0xa')](function(_0x2f81df){logger[_0xf169('0xb')](_0xf169('0xc'),_0x4a7752,'request\x20sent');logger['debug'](_0xf169('0xd'),_0x4a7752,_0xf169('0xe'),JSON[_0xf169('0xf')](_0x2f81df));if(_0x2f81df['error']){if(_0x2f81df[_0xf169('0x10')][_0xf169('0x11')]===0x1f4){logger[_0xf169('0x10')](_0xf169('0xc'),_0x4a7752,_0x2f81df[_0xf169('0x10')][_0xf169('0x12')]);return _0x2cbb63(_0x2f81df['error'][_0xf169('0x12')]);}logger[_0xf169('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x4a7752,_0x2f81df['error']['message']);return _0x5d8b59(_0x2f81df['error'][_0xf169('0x12')]);}else{logger[_0xf169('0xb')](_0xf169('0xc'),_0x4a7752,_0xf169('0xe'));_0x5d8b59(_0x2f81df[_0xf169('0x13')]['message']);}})[_0xf169('0x14')](function(_0x542502){logger[_0xf169('0x10')](_0xf169('0xc'),_0x4a7752,_0x542502);_0x2cbb63(_0x542502);});});}exports['CreateVoiceAgentReport']=function(_0x4b48a0){var _0x366134=this;return new Promise(function(_0x472e63,_0x19f467){return db[_0xf169('0x15')]['create'](_0x4b48a0[_0xf169('0x16')],{'raw':_0x4b48a0[_0xf169('0x17')]?_0x4b48a0['options'][_0xf169('0x18')]===undefined?!![]:![]:!![]})[_0xf169('0xa')](function(_0x1763d1){logger[_0xf169('0xb')](_0xf169('0x19'),_0x4b48a0);logger[_0xf169('0x1a')](_0xf169('0x19'),_0x4b48a0,JSON[_0xf169('0xf')](_0x1763d1));_0x472e63(_0x1763d1);})[_0xf169('0x14')](function(_0x2b1fdd){logger[_0xf169('0x10')](_0xf169('0x19'),_0x2b1fdd[_0xf169('0x12')],_0x4b48a0);_0x19f467(_0x366134['error'](0x1f4,_0x2b1fdd[_0xf169('0x12')]));});});};exports[_0xf169('0x1b')]=function(_0x37aa96){var _0x406d24=this;return new Promise(function(_0x15eec3,_0x4b71c0){return db[_0xf169('0x15')][_0xf169('0x1c')](_0x37aa96[_0xf169('0x16')],{'raw':_0x37aa96[_0xf169('0x17')]?_0x37aa96['options'][_0xf169('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37aa96[_0xf169('0x17')]?_0x37aa96[_0xf169('0x17')]['where']||null:null,'attributes':_0x37aa96[_0xf169('0x17')]?_0x37aa96['options'][_0xf169('0x1d')]||null:null,'limit':_0x37aa96[_0xf169('0x17')]?_0x37aa96[_0xf169('0x17')][_0xf169('0x1e')]||null:null})[_0xf169('0xa')](function(_0x2a6d6e){logger[_0xf169('0xb')](_0xf169('0x1b'),_0x37aa96);logger[_0xf169('0x1a')](_0xf169('0x1b'),_0x37aa96,JSON[_0xf169('0xf')](_0x2a6d6e));_0x15eec3(_0x2a6d6e);})[_0xf169('0x14')](function(_0x32c24e){logger[_0xf169('0x10')](_0xf169('0x1b'),_0x32c24e[_0xf169('0x12')],_0x37aa96);_0x4b71c0(_0x406d24[_0xf169('0x10')](0x1f4,_0x32c24e[_0xf169('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8d1611b..ef03aac 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 _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x4cdfbc,_0x54860f){var _0x41e6a1=function(_0x39771f){while(--_0x39771f){_0x4cdfbc['push'](_0x4cdfbc['shift']());}};_0x41e6a1(++_0x54860f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x390556,_0x5b64bd){_0x390556=_0x390556-0x0;var _0x11868e=_0x7fbe[_0x390556];return _0x11868e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x826a=['post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x548a44,_0x5f163f){var _0x587f46=function(_0x787758){while(--_0x787758){_0x548a44['push'](_0x548a44['shift']());}};_0x587f46(++_0x5f163f);}(_0x826a,0x1aa));var _0xa826=function(_0x877c7c,_0x3d9804){_0x877c7c=_0x877c7c-0x0;var _0x5f4e13=_0x826a[_0x877c7c];return _0x5f4e13;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),auth[_0xa826('0x8')](),controller[_0xa826('0xb')]);router[_0xa826('0x7')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0xe')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);router[_0xa826('0x10')]('/:id',auth[_0xa826('0x8')](),controller['update']);router[_0xa826('0x11')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0x12')]);module[_0xa826('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6c46f83..eb70c5b 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 _0x5942=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x5761de,_0x54c2b0){var _0x2d446f=function(_0x24296b){while(--_0x24296b){_0x5761de['push'](_0x5761de['shift']());}};_0x2d446f(++_0x54c2b0);}(_0x5942,0x16a));var _0x2594=function(_0x13e0b0,_0x207679){_0x13e0b0=_0x13e0b0-0x0;var _0xd62a77=_0x5942[_0x13e0b0];return _0xd62a77;};'use strict';var Sequelize=require(_0x2594('0x0'));module[_0x2594('0x1')]={'uniqueid':{'type':Sequelize[_0x2594('0x2')]},'type':{'type':Sequelize[_0x2594('0x3')](_0x2594('0x4'),_0x2594('0x5'),_0x2594('0x6'),_0x2594('0x7'),_0x2594('0x8'),_0x2594('0x9'))},'tag':{'type':Sequelize[_0x2594('0x2')]},'accountcode':{'type':Sequelize[_0x2594('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x2594('0x2')]},'callerid':{'type':Sequelize[_0x2594('0x2')]},'channel':{'type':Sequelize[_0x2594('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x2594('0x2')]},'lastdata':{'type':Sequelize[_0x2594('0xa')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x2594('0xb')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2594('0xb')]},'duration':{'type':Sequelize[_0x2594('0xc')]},'billableseconds':{'type':Sequelize[_0x2594('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2594('0x2')]},'amaflags':{'type':Sequelize[_0x2594('0x2')]},'userfield':{'type':Sequelize[_0x2594('0x2')]},'userDisposition':{'type':Sequelize[_0x2594('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2594('0x2')]},'note':{'type':Sequelize[_0x2594('0x2')]},'prefix':{'type':Sequelize[_0x2594('0x2')]},'routeid':{'type':Sequelize[_0x2594('0xc')]},'sipcallid':{'type':Sequelize[_0x2594('0x2')]}}; \ No newline at end of file +var _0x161a=['STRING','ENUM','internal','inbound-fax','outbound-fax','TEXT','DATE','INTEGER'];(function(_0x4ce1b9,_0x397a4b){var _0x2bb15d=function(_0x3790ad){while(--_0x3790ad){_0x4ce1b9['push'](_0x4ce1b9['shift']());}};_0x2bb15d(++_0x397a4b);}(_0x161a,0x140));var _0xa161=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x161a[_0x57fa7e];return _0x320671;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xa161('0x0')]},'type':{'type':Sequelize[_0xa161('0x1')]('inbound',_0xa161('0x2'),'outbound',_0xa161('0x3'),_0xa161('0x4'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa161('0x0')]},'source':{'type':Sequelize[_0xa161('0x0')]},'destination':{'type':Sequelize[_0xa161('0x0')]},'destinationcontext':{'type':Sequelize[_0xa161('0x0')]},'callerid':{'type':Sequelize[_0xa161('0x0')]},'channel':{'type':Sequelize[_0xa161('0x0')]},'destinationchannel':{'type':Sequelize[_0xa161('0x0')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xa161('0x5')]},'starttime':{'type':Sequelize[_0xa161('0x6')]},'systemanswertime':{'type':Sequelize[_0xa161('0x6')]},'answertime':{'type':Sequelize[_0xa161('0x6')]},'endtime':{'type':Sequelize[_0xa161('0x6')]},'duration':{'type':Sequelize[_0xa161('0x7')]},'billableseconds':{'type':Sequelize[_0xa161('0x7')]},'mohtime':{'type':Sequelize[_0xa161('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa161('0x0')]},'amaflags':{'type':Sequelize[_0xa161('0x0')]},'userfield':{'type':Sequelize[_0xa161('0x0')]},'userDisposition':{'type':Sequelize[_0xa161('0x0')]},'userSecondDisposition':{'type':Sequelize[_0xa161('0x0')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa161('0x0')]},'prefix':{'type':Sequelize[_0xa161('0x0')]},'routeid':{'type':Sequelize[_0xa161('0x7')]},'sipcallid':{'type':Sequelize[_0xa161('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 73e513d..d01a96a 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0xadb5,0xad));var _0x5adb=function(_0x1de773,_0x469878){_0x1de773=_0x1de773-0x0;var _0x3163f3=_0xadb5[_0x1de773];return _0x3163f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x2ef3,0xba));var _0x32ef=function(_0x54a1a7,_0x2e91a8){_0x54a1a7=_0x54a1a7-0x0;var _0x48862f=_0x2ef3[_0x54a1a7];return _0x48862f;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a79ba32..9552924 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 _0x37ca=['uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call'];(function(_0x50b372,_0x45ba03){var _0x206346=function(_0x35d40c){while(--_0x35d40c){_0x50b372['push'](_0x50b372['shift']());}};_0x206346(++_0x45ba03);}(_0x37ca,0x112));var _0xa37c=function(_0x4f7ff3,_0x4b6bfd){_0x4f7ff3=_0x4f7ff3-0x0;var _0x36ae8b=_0x37ca[_0x4f7ff3];return _0x36ae8b;};'use strict';var _=require(_0xa37c('0x0'));var util=require(_0xa37c('0x1'));var logger=require(_0xa37c('0x2'))('api');var moment=require(_0xa37c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa37c('0x4'));var fs=require('fs');var path=require(_0xa37c('0x5'));var rimraf=require(_0xa37c('0x6'));var config=require(_0xa37c('0x7'));var attributes=require(_0xa37c('0x8'));module['exports']=function(_0x537fcb,_0x36902a){return _0x537fcb[_0xa37c('0x9')](_0xa37c('0xa'),attributes,{'tableName':_0xa37c('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa37c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2444=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x5b55f7,_0x58af27){var _0x2482c0=function(_0x104d43){while(--_0x104d43){_0x5b55f7['push'](_0x5b55f7['shift']());}};_0x2482c0(++_0x58af27);}(_0x2444,0x153));var _0x4244=function(_0x2d8644,_0x25bb8f){_0x2d8644=_0x2d8644-0x0;var _0x4237f0=_0x2444[_0x2d8644];return _0x4237f0;};'use strict';var _=require('lodash');var util=require(_0x4244('0x0'));var logger=require(_0x4244('0x1'))(_0x4244('0x2'));var moment=require(_0x4244('0x3'));var BPromise=require(_0x4244('0x4'));var rp=require(_0x4244('0x5'));var fs=require('fs');var path=require(_0x4244('0x6'));var rimraf=require('rimraf');var config=require(_0x4244('0x7'));var attributes=require(_0x4244('0x8'));module[_0x4244('0x9')]=function(_0x29816e,_0x5d1f5a){return _0x29816e[_0x4244('0xa')](_0x4244('0xb'),attributes,{'tableName':_0x4244('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4244('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 56b2489..4e0c975 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 _0x2afa=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','moment','bluebird','ioredis'];(function(_0x472170,_0x12c0d8){var _0x45d98c=function(_0x33e80e){while(--_0x33e80e){_0x472170['push'](_0x472170['shift']());}};_0x45d98c(++_0x12c0d8);}(_0x2afa,0x11c));var _0xa2af=function(_0x47696f,_0x9ab868){_0x47696f=_0x47696f-0x0;var _0x2e60ab=_0x2afa[_0x47696f];return _0x2e60ab;};'use strict';var _=require(_0xa2af('0x0'));var util=require('util');var moment=require(_0xa2af('0x1'));var BPromise=require(_0xa2af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2af('0x3'));var db=require(_0xa2af('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2af('0x5'))(_0xa2af('0x6'));var config=require(_0xa2af('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa2af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e71f6,_0x5b76c8,_0x1ecf14){return new BPromise(function(_0x1e4b3d,_0x248b74){return client[_0xa2af('0x9')](_0x5e71f6,_0x1ecf14)[_0xa2af('0xa')](function(_0x4222b4){logger[_0xa2af('0xb')](_0xa2af('0xc'),_0x5b76c8,_0xa2af('0xd'));logger[_0xa2af('0xe')](_0xa2af('0xf'),_0x5b76c8,'request\x20sent',JSON[_0xa2af('0x10')](_0x4222b4));if(_0x4222b4['error']){if(_0x4222b4[_0xa2af('0x11')][_0xa2af('0x12')]===0x1f4){logger['error'](_0xa2af('0xc'),_0x5b76c8,_0x4222b4[_0xa2af('0x11')][_0xa2af('0x13')]);return _0x248b74(_0x4222b4[_0xa2af('0x11')][_0xa2af('0x13')]);}logger[_0xa2af('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5b76c8,_0x4222b4[_0xa2af('0x11')][_0xa2af('0x13')]);return _0x1e4b3d(_0x4222b4[_0xa2af('0x11')]['message']);}else{logger[_0xa2af('0xb')](_0xa2af('0xc'),_0x5b76c8,'request\x20sent');_0x1e4b3d(_0x4222b4[_0xa2af('0x14')][_0xa2af('0x13')]);}})['catch'](function(_0x1665c1){logger[_0xa2af('0x11')](_0xa2af('0xc'),_0x5b76c8,_0x1665c1);_0x248b74(_0x1665c1);});});}exports[_0xa2af('0x15')]=function(_0x4c4306){var _0x3c17e4=this;return new Promise(function(_0x5d843b,_0x43972d){return db[_0xa2af('0x16')][_0xa2af('0x17')]({'raw':_0x4c4306[_0xa2af('0x18')]?_0x4c4306[_0xa2af('0x18')][_0xa2af('0x19')]===undefined?!![]:![]:!![],'where':_0x4c4306[_0xa2af('0x18')]?_0x4c4306[_0xa2af('0x18')]['where']||null:null,'attributes':_0x4c4306[_0xa2af('0x18')]?_0x4c4306[_0xa2af('0x18')][_0xa2af('0x1a')]||null:null,'limit':_0x4c4306['options']?_0x4c4306[_0xa2af('0x18')][_0xa2af('0x1b')]||null:null,'include':_0x4c4306[_0xa2af('0x18')]?_0x4c4306[_0xa2af('0x18')][_0xa2af('0x1c')]?_[_0xa2af('0x1d')](_0x4c4306[_0xa2af('0x18')][_0xa2af('0x1c')],function(_0x4e38a8){return{'model':db[_0x4e38a8[_0xa2af('0x1e')]],'as':_0x4e38a8['as'],'attributes':_0x4e38a8[_0xa2af('0x1a')],'include':_0x4e38a8['include']?_['map'](_0x4e38a8[_0xa2af('0x1c')],function(_0x1184fe){return{'model':db[_0x1184fe[_0xa2af('0x1e')]],'as':_0x1184fe['as'],'attributes':_0x1184fe[_0xa2af('0x1a')],'include':_0x1184fe[_0xa2af('0x1c')]?_[_0xa2af('0x1d')](_0x1184fe[_0xa2af('0x1c')],function(_0xe09fee){return{'model':db[_0xe09fee[_0xa2af('0x1e')]],'as':_0xe09fee['as'],'attributes':_0xe09fee[_0xa2af('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa2af('0xa')](function(_0x5f179a){logger[_0xa2af('0xb')]('GetVoiceCallReport',_0x4c4306);logger[_0xa2af('0xe')](_0xa2af('0x15'),_0x4c4306,JSON[_0xa2af('0x10')](_0x5f179a));_0x5d843b(_0x5f179a);})[_0xa2af('0x1f')](function(_0x3d25a8){logger['error'](_0xa2af('0x15'),_0x3d25a8['message'],_0x4c4306);_0x43972d(_0x3c17e4[_0xa2af('0x11')](0x1f4,_0x3d25a8[_0xa2af('0x13')]));});});};exports[_0xa2af('0x20')]=function(_0x227ae9){var _0x5361d8=this;return new Promise(function(_0x30e1cf,_0xdf6d92){return db[_0xa2af('0x16')][_0xa2af('0x21')](_0x227ae9[_0xa2af('0x22')],{'raw':_0x227ae9[_0xa2af('0x18')]?_0x227ae9[_0xa2af('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa2af('0xa')](function(_0x31f2ed){logger[_0xa2af('0xb')](_0xa2af('0x20'),_0x227ae9);logger[_0xa2af('0xe')](_0xa2af('0x20'),_0x227ae9,JSON[_0xa2af('0x10')](_0x31f2ed));_0x30e1cf(_0x31f2ed);})[_0xa2af('0x1f')](function(_0x50a0f7){logger['error'](_0xa2af('0x20'),_0x50a0f7['message'],_0x227ae9);_0xdf6d92(_0x5361d8[_0xa2af('0x11')](0x1f4,_0x50a0f7[_0xa2af('0x13')]));});});};exports[_0xa2af('0x23')]=function(_0x17dd07){var _0x11dfb0=this;return new Promise(function(_0x49d673,_0x516cae){return db[_0xa2af('0x16')]['update'](_0x17dd07[_0xa2af('0x22')],{'raw':_0x17dd07[_0xa2af('0x18')]?_0x17dd07[_0xa2af('0x18')][_0xa2af('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17dd07[_0xa2af('0x18')]?_0x17dd07[_0xa2af('0x18')]['where']||null:null,'attributes':_0x17dd07['options']?_0x17dd07[_0xa2af('0x18')][_0xa2af('0x1a')]||null:null,'limit':_0x17dd07['options']?_0x17dd07['options'][_0xa2af('0x1b')]||null:null})[_0xa2af('0xa')](function(_0x3955ff){logger[_0xa2af('0xb')](_0xa2af('0x23'),_0x17dd07);logger[_0xa2af('0xe')](_0xa2af('0x23'),_0x17dd07,JSON[_0xa2af('0x10')](_0x3955ff));_0x49d673(_0x3955ff);})['catch'](function(_0x59ae9c){logger[_0xa2af('0x11')](_0xa2af('0x23'),_0x59ae9c[_0xa2af('0x13')],_0x17dd07);_0x516cae(_0x11dfb0['error'](0x1f4,_0x59ae9c['message']));});});}; \ No newline at end of file +var _0xc4a6=['update','UpdateVoiceCallReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','attributes','limit','include','model','map','debug','create','body','raw','CreateVoiceCallReport'];(function(_0x42a778,_0x3cde9f){var _0x216581=function(_0x357948){while(--_0x357948){_0x42a778['push'](_0x42a778['shift']());}};_0x216581(++_0x3cde9f);}(_0xc4a6,0x10c));var _0x6c4a=function(_0x4230f4,_0x38625b){_0x4230f4=_0x4230f4-0x0;var _0x4a12ac=_0xc4a6[_0x4230f4];return _0x4a12ac;};'use strict';var _=require(_0x6c4a('0x0'));var util=require(_0x6c4a('0x1'));var moment=require(_0x6c4a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c4a('0x3'));var db=require(_0x6c4a('0x4'))['db'];var utils=require(_0x6c4a('0x5'));var logger=require(_0x6c4a('0x6'))(_0x6c4a('0x7'));var config=require(_0x6c4a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6c4a('0x9')][_0x6c4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26d265,_0x105153,_0x42b1c8){return new BPromise(function(_0x100a42,_0x49c8a9){return client[_0x6c4a('0xb')](_0x26d265,_0x42b1c8)[_0x6c4a('0xc')](function(_0x1e0e68){logger[_0x6c4a('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x105153,_0x6c4a('0xe'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x105153,_0x6c4a('0xe'),JSON[_0x6c4a('0xf')](_0x1e0e68));if(_0x1e0e68[_0x6c4a('0x10')]){if(_0x1e0e68[_0x6c4a('0x10')][_0x6c4a('0x11')]===0x1f4){logger[_0x6c4a('0x10')](_0x6c4a('0x12'),_0x105153,_0x1e0e68['error'][_0x6c4a('0x13')]);return _0x49c8a9(_0x1e0e68[_0x6c4a('0x10')][_0x6c4a('0x13')]);}logger[_0x6c4a('0x10')](_0x6c4a('0x12'),_0x105153,_0x1e0e68[_0x6c4a('0x10')][_0x6c4a('0x13')]);return _0x100a42(_0x1e0e68[_0x6c4a('0x10')][_0x6c4a('0x13')]);}else{logger[_0x6c4a('0xd')](_0x6c4a('0x12'),_0x105153,_0x6c4a('0xe'));_0x100a42(_0x1e0e68[_0x6c4a('0x14')][_0x6c4a('0x13')]);}})[_0x6c4a('0x15')](function(_0x464f36){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x105153,_0x464f36);_0x49c8a9(_0x464f36);});});}exports[_0x6c4a('0x16')]=function(_0x12af38){var _0x36bfd9=this;return new Promise(function(_0x8e27e2,_0x140346){return db[_0x6c4a('0x17')][_0x6c4a('0x18')]({'raw':_0x12af38['options']?_0x12af38[_0x6c4a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x12af38[_0x6c4a('0x19')]?_0x12af38[_0x6c4a('0x19')]['where']||null:null,'attributes':_0x12af38[_0x6c4a('0x19')]?_0x12af38[_0x6c4a('0x19')][_0x6c4a('0x1a')]||null:null,'limit':_0x12af38['options']?_0x12af38[_0x6c4a('0x19')][_0x6c4a('0x1b')]||null:null,'include':_0x12af38['options']?_0x12af38[_0x6c4a('0x19')]['include']?_['map'](_0x12af38['options'][_0x6c4a('0x1c')],function(_0x25229f){return{'model':db[_0x25229f[_0x6c4a('0x1d')]],'as':_0x25229f['as'],'attributes':_0x25229f[_0x6c4a('0x1a')],'include':_0x25229f[_0x6c4a('0x1c')]?_[_0x6c4a('0x1e')](_0x25229f[_0x6c4a('0x1c')],function(_0x1f680c){return{'model':db[_0x1f680c[_0x6c4a('0x1d')]],'as':_0x1f680c['as'],'attributes':_0x1f680c['attributes'],'include':_0x1f680c[_0x6c4a('0x1c')]?_[_0x6c4a('0x1e')](_0x1f680c['include'],function(_0x364822){return{'model':db[_0x364822['model']],'as':_0x364822['as'],'attributes':_0x364822[_0x6c4a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6c4a('0xc')](function(_0x68be48){logger[_0x6c4a('0xd')](_0x6c4a('0x16'),_0x12af38);logger[_0x6c4a('0x1f')](_0x6c4a('0x16'),_0x12af38,JSON['stringify'](_0x68be48));_0x8e27e2(_0x68be48);})[_0x6c4a('0x15')](function(_0x38a7f7){logger[_0x6c4a('0x10')]('GetVoiceCallReport',_0x38a7f7[_0x6c4a('0x13')],_0x12af38);_0x140346(_0x36bfd9[_0x6c4a('0x10')](0x1f4,_0x38a7f7[_0x6c4a('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x149016){var _0x75e661=this;return new Promise(function(_0xaf7444,_0x373177){return db[_0x6c4a('0x17')][_0x6c4a('0x20')](_0x149016[_0x6c4a('0x21')],{'raw':_0x149016[_0x6c4a('0x19')]?_0x149016['options'][_0x6c4a('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x4fe27a){logger[_0x6c4a('0xd')]('CreateVoiceCallReport',_0x149016);logger['debug'](_0x6c4a('0x23'),_0x149016,JSON[_0x6c4a('0xf')](_0x4fe27a));_0xaf7444(_0x4fe27a);})['catch'](function(_0x49ac7c){logger[_0x6c4a('0x10')](_0x6c4a('0x23'),_0x49ac7c[_0x6c4a('0x13')],_0x149016);_0x373177(_0x75e661['error'](0x1f4,_0x49ac7c['message']));});});};exports['UpdateVoiceCallReport']=function(_0x4f79d7){var _0x15eeaa=this;return new Promise(function(_0x1687eb,_0x1cd6b3){return db[_0x6c4a('0x17')][_0x6c4a('0x24')](_0x4f79d7[_0x6c4a('0x21')],{'raw':_0x4f79d7[_0x6c4a('0x19')]?_0x4f79d7[_0x6c4a('0x19')][_0x6c4a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f79d7['options']?_0x4f79d7['options']['where']||null:null,'attributes':_0x4f79d7[_0x6c4a('0x19')]?_0x4f79d7[_0x6c4a('0x19')][_0x6c4a('0x1a')]||null:null,'limit':_0x4f79d7['options']?_0x4f79d7[_0x6c4a('0x19')][_0x6c4a('0x1b')]||null:null})['then'](function(_0xbefe22){logger['info'](_0x6c4a('0x25'),_0x4f79d7);logger['debug'](_0x6c4a('0x25'),_0x4f79d7,JSON[_0x6c4a('0xf')](_0xbefe22));_0x1687eb(_0xbefe22);})[_0x6c4a('0x15')](function(_0x187793){logger['error'](_0x6c4a('0x25'),_0x187793['message'],_0x4f79d7);_0x1cd6b3(_0x15eeaa[_0x6c4a('0x10')](0x1f4,_0x187793[_0x6c4a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 577b0e6..082c694 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 _0x1dd6=['show','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x1dd6,0x90));var _0x61dd=function(_0x580cb0,_0x1754c5){_0x580cb0=_0x580cb0-0x0;var _0xa11394=_0x1dd6[_0x580cb0];return _0xa11394;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x61dd('0x0'));var timeout=require(_0x61dd('0x1'));var express=require('express');var router=express[_0x61dd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x61dd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x61dd('0x4'));var controller=require(_0x61dd('0x5'));router['get']('/',auth[_0x61dd('0x6')](),controller['index']);router[_0x61dd('0x7')](_0x61dd('0x8'),auth[_0x61dd('0x6')](),controller[_0x61dd('0x9')]);router[_0x61dd('0xa')]('/',auth[_0x61dd('0x6')](),controller[_0x61dd('0xb')]);router[_0x61dd('0xc')](_0x61dd('0x8'),auth[_0x61dd('0x6')](),controller[_0x61dd('0xd')]);router[_0x61dd('0xe')]('/:id',auth[_0x61dd('0x6')](),controller[_0x61dd('0xf')]);module[_0x61dd('0x10')]=router; \ No newline at end of file +var _0x9f93=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3b9c02,_0x24655d){var _0x2bc33e=function(_0x5786b7){while(--_0x5786b7){_0x3b9c02['push'](_0x3b9c02['shift']());}};_0x2bc33e(++_0x24655d);}(_0x9f93,0xe3));var _0x39f9=function(_0x471286,_0x2cd25e){_0x471286=_0x471286-0x0;var _0x50e1a7=_0x9f93[_0x471286];return _0x50e1a7;};'use strict';var multer=require('multer');var util=require(_0x39f9('0x0'));var path=require('path');var timeout=require(_0x39f9('0x1'));var express=require('express');var router=express[_0x39f9('0x2')]();var fs_extra=require(_0x39f9('0x3'));var auth=require(_0x39f9('0x4'));var interaction=require(_0x39f9('0x5'));var config=require(_0x39f9('0x6'));var controller=require(_0x39f9('0x7'));router[_0x39f9('0x8')]('/',auth[_0x39f9('0x9')](),controller[_0x39f9('0xa')]);router['get'](_0x39f9('0xb'),auth[_0x39f9('0x9')](),controller[_0x39f9('0xc')]);router[_0x39f9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x39f9('0xe')]('/:id',auth[_0x39f9('0x9')](),controller['update']);router[_0x39f9('0xf')](_0x39f9('0xb'),auth['isAuthenticated'](),controller[_0x39f9('0x10')]);module[_0x39f9('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 a0bc4cc..febb5ad 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 _0xff76=['name','join','getDataValue','options','BOOLEAN','exports','STRING'];(function(_0x478829,_0x4ef2bb){var _0x59a14a=function(_0x11e88c){while(--_0x11e88c){_0x478829['push'](_0x478829['shift']());}};_0x59a14a(++_0x4ef2bb);}(_0xff76,0x75));var _0x6ff7=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xff76[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require('sequelize');module[_0x6ff7('0x0')]={'name':{'type':Sequelize[_0x6ff7('0x1')]},'prefix':{'type':Sequelize[_0x6ff7('0x1')],'unique':_0x6ff7('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x6ff7('0x1')],'set':function(_0x2323bf){this['setDataValue']('options',_0x2323bf?_0x2323bf[_0x6ff7('0x3')](''):[]);},'get':function(){return this[_0x6ff7('0x4')](_0x6ff7('0x5'))?this['getDataValue'](_0x6ff7('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x6ff7('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x6ff7('0x1')]},'record':{'type':Sequelize[_0x6ff7('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ff7('0x1')]}}; \ No newline at end of file +var _0xbd2f=['getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','options','join'];(function(_0x909707,_0x19a177){var _0xc63f4f=function(_0x30c4bd){while(--_0x30c4bd){_0x909707['push'](_0x909707['shift']());}};_0xc63f4f(++_0x19a177);}(_0xbd2f,0x1f2));var _0xfbd2=function(_0x3e60a,_0x16ebaa){_0x3e60a=_0x3e60a-0x0;var _0x480182=_0xbd2f[_0x3e60a];return _0x480182;};'use strict';var Sequelize=require('sequelize');module[_0xfbd2('0x0')]={'name':{'type':Sequelize[_0xfbd2('0x1')]},'prefix':{'type':Sequelize[_0xfbd2('0x1')],'unique':_0xfbd2('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x29543f){this[_0xfbd2('0x3')](_0xfbd2('0x4'),_0x29543f?_0x29543f[_0xfbd2('0x5')](''):[]);},'get':function(){return this[_0xfbd2('0x6')]('options')?this[_0xfbd2('0x6')](_0xfbd2('0x4'))[_0xfbd2('0x7')](''):[];}},'auth':{'type':Sequelize[_0xfbd2('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xfbd2('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xfbd2('0x1')]},'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 f2d7b9c..e03634c 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 _0x3098=['UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','options','catch','create','body','user','get','role','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x3572c0,_0x281bf1){var _0x5493fe=function(_0x461a90){while(--_0x461a90){_0x3572c0['push'](_0x3572c0['shift']());}};_0x5493fe(++_0x281bf1);}(_0x3098,0x86));var _0x8309=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x3098[_0x3f3f06];return _0x140feb;};'use strict';var emlformat=require(_0x8309('0x0'));var rimraf=require(_0x8309('0x1'));var zipdir=require(_0x8309('0x2'));var jsonpatch=require(_0x8309('0x3'));var rp=require('request-promise');var moment=require(_0x8309('0x4'));var BPromise=require(_0x8309('0x5'));var Mustache=require(_0x8309('0x6'));var util=require(_0x8309('0x7'));var path=require(_0x8309('0x8'));var sox=require(_0x8309('0x9'));var csv=require(_0x8309('0xa'));var ejs=require(_0x8309('0xb'));var fs=require('fs');var fs_extra=require(_0x8309('0xc'));var _=require(_0x8309('0xd'));var squel=require('squel');var crypto=require(_0x8309('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8309('0xf'));var toCsv=require(_0x8309('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8309('0x10'));var authService=require(_0x8309('0x11'));var qs=require(_0x8309('0x12'));var as=require(_0x8309('0x13'));var hardwareService=require(_0x8309('0x14'));var logger=require('../../config/logger')(_0x8309('0x15'));var utils=require(_0x8309('0x16'));var config=require(_0x8309('0x17'));var licenseUtil=require(_0x8309('0x18'));var db=require(_0x8309('0x19'))['db'];function respondWithStatusCode(_0x53ebac,_0x2473d2){_0x2473d2=_0x2473d2||0xcc;return function(_0x4a05c4){if(_0x4a05c4){return _0x53ebac[_0x8309('0x1a')](_0x2473d2);}return _0x53ebac['status'](_0x2473d2)[_0x8309('0x1b')]();};}function respondWithResult(_0x38bbc0,_0x419bff){_0x419bff=_0x419bff||0xc8;return function(_0x264867){if(_0x264867){return _0x38bbc0[_0x8309('0x1c')](_0x419bff)[_0x8309('0x1d')](_0x264867);}};}function respondWithFilteredResult(_0x3b7a1f,_0x5424cd){return function(_0x49e8a7){if(_0x49e8a7){var _0x2aefda=typeof _0x5424cd[_0x8309('0x1e')]===_0x8309('0x1f')&&typeof _0x5424cd[_0x8309('0x20')]===_0x8309('0x1f');var _0x28bfec=_0x49e8a7[_0x8309('0x21')];var _0x97f042=_0x2aefda?0x0:_0x5424cd['offset'];var _0x353f64=_0x2aefda?_0x49e8a7[_0x8309('0x21')]:_0x5424cd[_0x8309('0x1e')]+_0x5424cd[_0x8309('0x20')];var _0x1c86be;if(_0x353f64>=_0x28bfec){_0x353f64=_0x28bfec;_0x1c86be=0xc8;}else{_0x1c86be=0xce;}_0x3b7a1f[_0x8309('0x1c')](_0x1c86be);return _0x3b7a1f[_0x8309('0x22')](_0x8309('0x23'),_0x97f042+'-'+_0x353f64+'/'+_0x28bfec)[_0x8309('0x1d')](_0x49e8a7);}return null;};}function patchUpdates(_0x415490){return function(_0x3dc639){try{jsonpatch[_0x8309('0x24')](_0x3dc639,_0x415490,!![]);}catch(_0x5b252b){return BPromise['reject'](_0x5b252b);}return _0x3dc639[_0x8309('0x25')]();};}function saveUpdates(_0x1ffe6e,_0x39989f){return function(_0x37eaa7){if(_0x37eaa7){return _0x37eaa7[_0x8309('0x26')](_0x1ffe6e)[_0x8309('0x27')](function(_0x5d0096){return _0x5d0096;});}return null;};}function removeEntity(_0x25e62e,_0x350f51){return function(_0x3599da){if(_0x3599da){return _0x3599da['destroy']()[_0x8309('0x27')](function(){var _0x35c0e6=_0x3599da['get']({'plain':!![]});var _0x166902='ChanSpies';return db[_0x8309('0x28')]['destroy']({'where':{'type':_0x166902,'resourceId':_0x35c0e6['id']}})[_0x8309('0x27')](function(){return _0x3599da;});})[_0x8309('0x27')](function(){_0x25e62e[_0x8309('0x1c')](0xcc)[_0x8309('0x1b')]();});}};}function handleEntityNotFound(_0x590687,_0xe44493){return function(_0x26a378){if(!_0x26a378){_0x590687[_0x8309('0x1a')](0x194);}return _0x26a378;};}function handleError(_0x5f2f68,_0xbed74d){_0xbed74d=_0xbed74d||0x1f4;return function(_0x573fcd){logger[_0x8309('0x29')](_0x573fcd[_0x8309('0x2a')]);if(_0x573fcd[_0x8309('0x2b')]){delete _0x573fcd[_0x8309('0x2b')];}_0x5f2f68[_0x8309('0x1c')](_0xbed74d)[_0x8309('0x2c')](_0x573fcd);};}exports[_0x8309('0x2d')]=function(_0x45a763,_0x9c66b8){var _0x52628d={},_0x5680d8={},_0x3d829c={'count':0x0,'rows':[]};var _0x3fe2d1=_[_0x8309('0x2e')](db[_0x8309('0x2f')][_0x8309('0x30')],function(_0x379776){return{'name':_0x379776[_0x8309('0x31')],'type':_0x379776['type'][_0x8309('0x32')]};});_0x5680d8[_0x8309('0x33')]=_[_0x8309('0x2e')](_0x3fe2d1,_0x8309('0x2b'));_0x5680d8[_0x8309('0x34')]=_[_0x8309('0x35')](_0x45a763[_0x8309('0x34')]);_0x5680d8['filters']=_['intersection'](_0x5680d8['model'],_0x5680d8['query']);_0x52628d['attributes']=_[_0x8309('0x36')](_0x5680d8[_0x8309('0x33')],qs[_0x8309('0x37')](_0x45a763[_0x8309('0x34')][_0x8309('0x37')]));_0x52628d['attributes']=_0x52628d[_0x8309('0x38')][_0x8309('0x39')]?_0x52628d['attributes']:_0x5680d8[_0x8309('0x33')];if(!_0x45a763[_0x8309('0x34')][_0x8309('0x3a')](_0x8309('0x3b'))){_0x52628d[_0x8309('0x20')]=qs['limit'](_0x45a763['query'][_0x8309('0x20')]);_0x52628d['offset']=qs[_0x8309('0x1e')](_0x45a763[_0x8309('0x34')][_0x8309('0x1e')]);}_0x52628d['order']=qs[_0x8309('0x3c')](_0x45a763['query'][_0x8309('0x3c')]);_0x52628d[_0x8309('0x3d')]=qs[_0x8309('0x3e')](_[_0x8309('0x3f')](_0x45a763[_0x8309('0x34')],_0x5680d8[_0x8309('0x3e')]),_0x3fe2d1);if(_0x45a763[_0x8309('0x34')][_0x8309('0x40')]){_0x52628d[_0x8309('0x3d')]=_[_0x8309('0x41')](_0x52628d['where'],{'$or':_[_0x8309('0x2e')](_0x3fe2d1,function(_0x452fee){if(_0x452fee[_0x8309('0x42')]!==_0x8309('0x43')){var _0x4ecd62={};_0x4ecd62[_0x452fee[_0x8309('0x2b')]]={'$like':'%'+_0x45a763['query'][_0x8309('0x40')]+'%'};return _0x4ecd62;}})});}_0x52628d=_[_0x8309('0x41')]({},_0x52628d,_0x45a763['options']);var _0xd00993={'where':_0x52628d[_0x8309('0x3d')]};return db[_0x8309('0x2f')][_0x8309('0x21')](_0xd00993)[_0x8309('0x27')](function(_0x1eea45){_0x3d829c[_0x8309('0x21')]=_0x1eea45;if(_0x45a763[_0x8309('0x34')][_0x8309('0x44')]){_0x52628d[_0x8309('0x45')]=[{'all':!![]}];}return db[_0x8309('0x2f')]['findAll'](_0x52628d);})[_0x8309('0x27')](function(_0x269fcd){_0x3d829c[_0x8309('0x46')]=_0x269fcd;return _0x3d829c;})[_0x8309('0x27')](respondWithFilteredResult(_0x9c66b8,_0x52628d))['catch'](handleError(_0x9c66b8,null));};exports[_0x8309('0x47')]=function(_0xbf1309,_0x3a4342){var _0x6a9cd4={'raw':![],'where':{'id':_0xbf1309[_0x8309('0x48')]['id']}},_0x5edc96={};_0x5edc96[_0x8309('0x33')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x5edc96[_0x8309('0x34')]=_[_0x8309('0x35')](_0xbf1309['query']);_0x5edc96['filters']=_[_0x8309('0x36')](_0x5edc96[_0x8309('0x33')],_0x5edc96[_0x8309('0x34')]);_0x6a9cd4[_0x8309('0x38')]=_[_0x8309('0x36')](_0x5edc96[_0x8309('0x33')],qs[_0x8309('0x37')](_0xbf1309[_0x8309('0x34')][_0x8309('0x37')]));_0x6a9cd4[_0x8309('0x38')]=_0x6a9cd4[_0x8309('0x38')][_0x8309('0x39')]?_0x6a9cd4['attributes']:_0x5edc96[_0x8309('0x33')];if(_0xbf1309[_0x8309('0x34')]['includeAll']){_0x6a9cd4['include']=[{'all':!![]}];}_0x6a9cd4=_[_0x8309('0x41')]({},_0x6a9cd4,_0xbf1309[_0x8309('0x49')]);return db[_0x8309('0x2f')]['find'](_0x6a9cd4)['then'](handleEntityNotFound(_0x3a4342,null))[_0x8309('0x27')](respondWithResult(_0x3a4342,null))[_0x8309('0x4a')](handleError(_0x3a4342,null));};exports[_0x8309('0x4b')]=function(_0x421ff5,_0xa88f42){return db[_0x8309('0x2f')][_0x8309('0x4b')](_0x421ff5[_0x8309('0x4c')],{})[_0x8309('0x27')](function(_0x55e7b5){var _0x22e92a=_0x421ff5[_0x8309('0x4d')][_0x8309('0x4e')]({'plain':!![]});if(!_0x22e92a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22e92a[_0x8309('0x4f')]===_0x8309('0x4d')){var _0x57ace2=_0x55e7b5[_0x8309('0x4e')]({'plain':!![]});var _0x30b810=_0x8309('0x50');return db[_0x8309('0x51')][_0x8309('0x52')]({'where':{'name':_0x30b810,'userProfileId':_0x22e92a[_0x8309('0x53')]},'raw':!![]})[_0x8309('0x27')](function(_0x15d5fc){if(_0x15d5fc&&_0x15d5fc[_0x8309('0x54')]===0x0){return db[_0x8309('0x28')]['create']({'name':_0x57ace2[_0x8309('0x2b')],'resourceId':_0x57ace2['id'],'type':_0x15d5fc[_0x8309('0x2b')],'sectionId':_0x15d5fc['id']},{})[_0x8309('0x27')](function(){return _0x55e7b5;});}else{return _0x55e7b5;}})['catch'](function(_0x453365){logger[_0x8309('0x29')](_0x8309('0x55'),_0x453365);throw _0x453365;});}return _0x55e7b5;})[_0x8309('0x27')](respondWithResult(_0xa88f42,0xc9))[_0x8309('0x4a')](handleError(_0xa88f42,null));};exports[_0x8309('0x26')]=function(_0x4c25cf,_0x45f095){if(_0x4c25cf['body']['id']){delete _0x4c25cf['body']['id'];}return db[_0x8309('0x2f')][_0x8309('0x52')]({'where':{'id':_0x4c25cf['params']['id']}})[_0x8309('0x27')](handleEntityNotFound(_0x45f095,null))[_0x8309('0x27')](saveUpdates(_0x4c25cf[_0x8309('0x4c')],null))[_0x8309('0x27')](respondWithResult(_0x45f095,null))[_0x8309('0x4a')](handleError(_0x45f095,null));};exports[_0x8309('0x56')]=function(_0x3c0c4e,_0x17f7d3){return db['VoiceChanSpy'][_0x8309('0x52')]({'where':{'id':_0x3c0c4e[_0x8309('0x48')]['id']}})[_0x8309('0x27')](handleEntityNotFound(_0x17f7d3,null))['then'](removeEntity(_0x17f7d3,null))[_0x8309('0x4a')](handleError(_0x17f7d3,null));}; \ No newline at end of file +var _0x47fd=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','VoiceChanSpy','findAll','rows','catch','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0x47fd,0x13c));var _0xd47f=function(_0x132765,_0x2663cd){_0x132765=_0x132765-0x0;var _0x2f3263=_0x47fd[_0x132765];return _0x2f3263;};'use strict';var emlformat=require(_0xd47f('0x0'));var rimraf=require(_0xd47f('0x1'));var zipdir=require(_0xd47f('0x2'));var jsonpatch=require(_0xd47f('0x3'));var rp=require(_0xd47f('0x4'));var moment=require(_0xd47f('0x5'));var BPromise=require(_0xd47f('0x6'));var Mustache=require(_0xd47f('0x7'));var util=require(_0xd47f('0x8'));var path=require(_0xd47f('0x9'));var sox=require('sox');var csv=require(_0xd47f('0xa'));var ejs=require(_0xd47f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd47f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd47f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd47f('0xe'));var Papa=require(_0xd47f('0xf'));var Redis=require(_0xd47f('0x10'));var authService=require(_0xd47f('0x11'));var qs=require(_0xd47f('0x12'));var as=require(_0xd47f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd47f('0x14'))(_0xd47f('0x15'));var utils=require('../../config/utils');var config=require(_0xd47f('0x16'));var licenseUtil=require(_0xd47f('0x17'));var db=require(_0xd47f('0x18'))['db'];function respondWithStatusCode(_0x392009,_0x2aca02){_0x2aca02=_0x2aca02||0xcc;return function(_0x3fa73b){if(_0x3fa73b){return _0x392009['sendStatus'](_0x2aca02);}return _0x392009[_0xd47f('0x19')](_0x2aca02)[_0xd47f('0x1a')]();};}function respondWithResult(_0x18e12f,_0x38038f){_0x38038f=_0x38038f||0xc8;return function(_0xd6bb87){if(_0xd6bb87){return _0x18e12f[_0xd47f('0x19')](_0x38038f)[_0xd47f('0x1b')](_0xd6bb87);}};}function respondWithFilteredResult(_0x68fbd2,_0x3e1558){return function(_0x567f43){if(_0x567f43){var _0x4a1a6c=typeof _0x3e1558[_0xd47f('0x1c')]===_0xd47f('0x1d')&&typeof _0x3e1558['limit']===_0xd47f('0x1d');var _0x44973a=_0x567f43[_0xd47f('0x1e')];var _0x40c533=_0x4a1a6c?0x0:_0x3e1558[_0xd47f('0x1c')];var _0x5e5cf6=_0x4a1a6c?_0x567f43[_0xd47f('0x1e')]:_0x3e1558[_0xd47f('0x1c')]+_0x3e1558[_0xd47f('0x1f')];var _0x77e050;if(_0x5e5cf6>=_0x44973a){_0x5e5cf6=_0x44973a;_0x77e050=0xc8;}else{_0x77e050=0xce;}_0x68fbd2[_0xd47f('0x19')](_0x77e050);return _0x68fbd2[_0xd47f('0x20')](_0xd47f('0x21'),_0x40c533+'-'+_0x5e5cf6+'/'+_0x44973a)[_0xd47f('0x1b')](_0x567f43);}return null;};}function patchUpdates(_0x3663d3){return function(_0x1b93d3){try{jsonpatch[_0xd47f('0x22')](_0x1b93d3,_0x3663d3,!![]);}catch(_0x3f2e37){return BPromise[_0xd47f('0x23')](_0x3f2e37);}return _0x1b93d3['save']();};}function saveUpdates(_0x50f3f6,_0x336e1){return function(_0x58ee0b){if(_0x58ee0b){return _0x58ee0b[_0xd47f('0x24')](_0x50f3f6)[_0xd47f('0x25')](function(_0x117d9b){return _0x117d9b;});}return null;};}function removeEntity(_0x5695c5,_0x53a538){return function(_0x50b1d6){if(_0x50b1d6){return _0x50b1d6[_0xd47f('0x26')]()[_0xd47f('0x25')](function(){var _0x42873c=_0x50b1d6[_0xd47f('0x27')]({'plain':!![]});var _0x3f55b0='ChanSpies';return db[_0xd47f('0x28')]['destroy']({'where':{'type':_0x3f55b0,'resourceId':_0x42873c['id']}})['then'](function(){return _0x50b1d6;});})['then'](function(){_0x5695c5['status'](0xcc)[_0xd47f('0x1a')]();});}};}function handleEntityNotFound(_0x37e027,_0x5e2514){return function(_0x597440){if(!_0x597440){_0x37e027[_0xd47f('0x29')](0x194);}return _0x597440;};}function handleError(_0xcd94c7,_0x4da007){_0x4da007=_0x4da007||0x1f4;return function(_0x18d261){logger[_0xd47f('0x2a')](_0x18d261[_0xd47f('0x2b')]);if(_0x18d261[_0xd47f('0x2c')]){delete _0x18d261[_0xd47f('0x2c')];}_0xcd94c7[_0xd47f('0x19')](_0x4da007)['send'](_0x18d261);};}exports[_0xd47f('0x2d')]=function(_0x591042,_0x3f82b7){var _0x5df182={},_0x219a96={},_0x462e3d={'count':0x0,'rows':[]};var _0xd12466=_['map'](db['VoiceChanSpy'][_0xd47f('0x2e')],function(_0x20125a){return{'name':_0x20125a[_0xd47f('0x2f')],'type':_0x20125a[_0xd47f('0x30')][_0xd47f('0x31')]};});_0x219a96[_0xd47f('0x32')]=_[_0xd47f('0x33')](_0xd12466,_0xd47f('0x2c'));_0x219a96['query']=_[_0xd47f('0x34')](_0x591042[_0xd47f('0x35')]);_0x219a96[_0xd47f('0x36')]=_[_0xd47f('0x37')](_0x219a96[_0xd47f('0x32')],_0x219a96[_0xd47f('0x35')]);_0x5df182['attributes']=_[_0xd47f('0x37')](_0x219a96[_0xd47f('0x32')],qs[_0xd47f('0x38')](_0x591042[_0xd47f('0x35')]['fields']));_0x5df182[_0xd47f('0x39')]=_0x5df182[_0xd47f('0x39')][_0xd47f('0x3a')]?_0x5df182['attributes']:_0x219a96['model'];if(!_0x591042[_0xd47f('0x35')][_0xd47f('0x3b')](_0xd47f('0x3c'))){_0x5df182['limit']=qs[_0xd47f('0x1f')](_0x591042['query'][_0xd47f('0x1f')]);_0x5df182[_0xd47f('0x1c')]=qs[_0xd47f('0x1c')](_0x591042[_0xd47f('0x35')][_0xd47f('0x1c')]);}_0x5df182['order']=qs['sort'](_0x591042[_0xd47f('0x35')][_0xd47f('0x3d')]);_0x5df182[_0xd47f('0x3e')]=qs['filters'](_[_0xd47f('0x3f')](_0x591042[_0xd47f('0x35')],_0x219a96[_0xd47f('0x36')]),_0xd12466);if(_0x591042[_0xd47f('0x35')][_0xd47f('0x40')]){_0x5df182[_0xd47f('0x3e')]=_['merge'](_0x5df182[_0xd47f('0x3e')],{'$or':_[_0xd47f('0x33')](_0xd12466,function(_0x55c647){if(_0x55c647['type']!==_0xd47f('0x41')){var _0x5d866f={};_0x5d866f[_0x55c647[_0xd47f('0x2c')]]={'$like':'%'+_0x591042[_0xd47f('0x35')]['filter']+'%'};return _0x5d866f;}})});}_0x5df182=_[_0xd47f('0x42')]({},_0x5df182,_0x591042[_0xd47f('0x43')]);var _0x3803fc={'where':_0x5df182[_0xd47f('0x3e')]};return db[_0xd47f('0x44')]['count'](_0x3803fc)[_0xd47f('0x25')](function(_0x544a7e){_0x462e3d[_0xd47f('0x1e')]=_0x544a7e;if(_0x591042[_0xd47f('0x35')]['includeAll']){_0x5df182['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xd47f('0x45')](_0x5df182);})[_0xd47f('0x25')](function(_0x5567e5){_0x462e3d[_0xd47f('0x46')]=_0x5567e5;return _0x462e3d;})[_0xd47f('0x25')](respondWithFilteredResult(_0x3f82b7,_0x5df182))[_0xd47f('0x47')](handleError(_0x3f82b7,null));};exports['show']=function(_0x413134,_0x6c7382){var _0x33ebf4={'raw':![],'where':{'id':_0x413134['params']['id']}},_0x2a4a6e={};_0x2a4a6e[_0xd47f('0x32')]=_['keys'](db[_0xd47f('0x44')][_0xd47f('0x2e')]);_0x2a4a6e['query']=_[_0xd47f('0x34')](_0x413134[_0xd47f('0x35')]);_0x2a4a6e[_0xd47f('0x36')]=_[_0xd47f('0x37')](_0x2a4a6e[_0xd47f('0x32')],_0x2a4a6e[_0xd47f('0x35')]);_0x33ebf4[_0xd47f('0x39')]=_[_0xd47f('0x37')](_0x2a4a6e[_0xd47f('0x32')],qs[_0xd47f('0x38')](_0x413134['query']['fields']));_0x33ebf4[_0xd47f('0x39')]=_0x33ebf4[_0xd47f('0x39')]['length']?_0x33ebf4[_0xd47f('0x39')]:_0x2a4a6e[_0xd47f('0x32')];if(_0x413134['query'][_0xd47f('0x48')]){_0x33ebf4[_0xd47f('0x49')]=[{'all':!![]}];}_0x33ebf4=_[_0xd47f('0x42')]({},_0x33ebf4,_0x413134[_0xd47f('0x43')]);return db[_0xd47f('0x44')][_0xd47f('0x4a')](_0x33ebf4)['then'](handleEntityNotFound(_0x6c7382,null))[_0xd47f('0x25')](respondWithResult(_0x6c7382,null))[_0xd47f('0x47')](handleError(_0x6c7382,null));};exports['create']=function(_0x532c08,_0x174c65){return db['VoiceChanSpy'][_0xd47f('0x4b')](_0x532c08[_0xd47f('0x4c')],{})[_0xd47f('0x25')](function(_0x2f5038){var _0x4814bd=_0x532c08['user']['get']({'plain':!![]});if(!_0x4814bd)throw new Error(_0xd47f('0x4d'));if(_0x4814bd['role']==='user'){var _0x335968=_0x2f5038['get']({'plain':!![]});var _0x57bfae=_0xd47f('0x4e');return db[_0xd47f('0x4f')][_0xd47f('0x4a')]({'where':{'name':_0x57bfae,'userProfileId':_0x4814bd[_0xd47f('0x50')]},'raw':!![]})['then'](function(_0x513d34){if(_0x513d34&&_0x513d34[_0xd47f('0x51')]===0x0){return db['UserProfileResource'][_0xd47f('0x4b')]({'name':_0x335968['name'],'resourceId':_0x335968['id'],'type':_0x513d34[_0xd47f('0x2c')],'sectionId':_0x513d34['id']},{})['then'](function(){return _0x2f5038;});}else{return _0x2f5038;}})[_0xd47f('0x47')](function(_0xaac4f4){logger[_0xd47f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaac4f4);throw _0xaac4f4;});}return _0x2f5038;})[_0xd47f('0x25')](respondWithResult(_0x174c65,0xc9))[_0xd47f('0x47')](handleError(_0x174c65,null));};exports[_0xd47f('0x24')]=function(_0x3ac703,_0x58f343){if(_0x3ac703[_0xd47f('0x4c')]['id']){delete _0x3ac703[_0xd47f('0x4c')]['id'];}return db[_0xd47f('0x44')]['find']({'where':{'id':_0x3ac703['params']['id']}})[_0xd47f('0x25')](handleEntityNotFound(_0x58f343,null))[_0xd47f('0x25')](saveUpdates(_0x3ac703['body'],null))[_0xd47f('0x25')](respondWithResult(_0x58f343,null))[_0xd47f('0x47')](handleError(_0x58f343,null));};exports[_0xd47f('0x26')]=function(_0x444724,_0x49087d){return db['VoiceChanSpy'][_0xd47f('0x4a')]({'where':{'id':_0x444724[_0xd47f('0x52')]['id']}})[_0xd47f('0x25')](handleEntityNotFound(_0x49087d,null))[_0xd47f('0x25')](removeEntity(_0x49087d,null))['catch'](handleError(_0x49087d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 84a96e0..e0d08bf 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 _0x84cc=['context','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','voice_chanspy','length','bulkCreate','then','destroy','VoiceExtension','lodash','./voiceChanSpy.attributes'];(function(_0x4f6610,_0x11d9ae){var _0x44e7d3=function(_0x1c9b2f){while(--_0x1c9b2f){_0x4f6610['push'](_0x4f6610['shift']());}};_0x44e7d3(++_0x11d9ae);}(_0x84cc,0x11e));var _0xc84c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x84cc[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc84c('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xc84c('0x1'));var getUserApplications=function(_0x338841,_0x36d1ce,_0x1ccb7f){var _0x224995=0x1;var _0xdb1189=[];var _0x389436={'context':_0x36d1ce[_0xc84c('0x2')]||'from-sip','exten':util[_0xc84c('0x3')](_0xc84c('0x4'),_0x338841[_0xc84c('0x5')],_0x1ccb7f),'type':_0xc84c('0x6'),'isApp':![],'ChanSpyId':_0x338841['id'],'UserId':_0x36d1ce['id']};_0xdb1189[_0xc84c('0x7')](_[_0xc84c('0x8')]({'app':_0xc84c('0x9'),'appdata':util[_0xc84c('0x3')](_0xc84c('0xa'),_0xc84c('0xb')),'priority':_0x224995++},_0x389436));if(_0x338841[_0xc84c('0xc')]){_0xdb1189[_0xc84c('0x7')](_[_0xc84c('0x8')]({'app':_0xc84c('0xd'),'appdata':util[_0xc84c('0x3')](_0xc84c('0xe'),_0x338841[_0xc84c('0xf')]),'priority':_0x224995++},_0x389436));}if(_0x338841['auth']){_0xdb1189[_0xc84c('0x7')](_[_0xc84c('0x8')]({'app':_0xc84c('0x10'),'appdata':_0x338841[_0xc84c('0x11')],'priority':_0x224995++},_0x389436));}_0xdb1189[_0xc84c('0x7')](_['merge']({'app':_0xc84c('0x12'),'appdata':util[_0xc84c('0x3')](_0xc84c('0x13'),_0x36d1ce[_0xc84c('0x14')],_0x338841[_0xc84c('0x15')]?_0x338841[_0xc84c('0x15')][_0xc84c('0x16')](''):''),'priority':_0x224995++},_0x389436));if(_0x338841['record']){_0xdb1189['push'](_[_0xc84c('0x8')]({'app':_0xc84c('0x17'),'priority':_0x224995++},_0x389436));}return _0xdb1189;};var getChanSpyApplications=function(_0x4b70a9,_0x185e57){var _0x33a544=[];for(var _0x52f74c=0x0,_0x2e9ddc=0x1;_0x52f74c<_0x185e57['length'];_0x52f74c++,_0x2e9ddc=0x1){_0x33a544=_0x33a544[_0xc84c('0x18')](getUserApplications(_0x4b70a9,_0x185e57[_0x52f74c],_0x185e57[_0x52f74c]['internal']));if(_0x185e57[_0x52f74c][_0xc84c('0x19')]!=_0x185e57[_0x52f74c][_0xc84c('0x14')]){_0x33a544=_0x33a544[_0xc84c('0x18')](getUserApplications(_0x4b70a9,_0x185e57[_0x52f74c],_0x185e57[_0x52f74c]['name']));}}return _0x33a544;};var getChanSpyPromise=function(_0x212e54,_0x5333fc){return new BPromise(function(_0x14cd41,_0x34f79e){return _0x212e54[_0xc84c('0x1a')][_0xc84c('0x1b')]({'attributes':['id',_0xc84c('0x14'),_0xc84c('0x19')],'where':{'role':_0xc84c('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x446a86){if(_0x446a86){return _0x14cd41(getChanSpyApplications(_0x5333fc,_0x446a86));}return _0x14cd41([]);})[_0xc84c('0x1d')](function(_0x1e3137){_0x34f79e(_0x1e3137);});});};module['exports']=function(_0x5e100e,_0x173627){var _0x57083a=_0x5e100e['models'];return _0x5e100e['define']('VoiceChanSpy',attributes,{'tableName':_0xc84c('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x30c797,_0x4924ca,_0x759b){return getChanSpyPromise(_0x57083a,_0x30c797)['then'](function(_0x5cd57e){if(_0x5cd57e&&_0x5cd57e[_0xc84c('0x1f')]){return _0x57083a['VoiceExtension'][_0xc84c('0x20')](_0x5cd57e);}})[_0xc84c('0x21')](function(){_0x759b();})[_0xc84c('0x1d')](function(_0x32afd5){_0x759b(_0x32afd5);});},'afterUpdate':function(_0x3e9bb1,_0x407d9e,_0x4a0bef){return _0x57083a['VoiceExtension'][_0xc84c('0x22')]({'where':{'ChanSpyId':_0x3e9bb1['id']}})[_0xc84c('0x21')](function(){return getChanSpyPromise(_0x57083a,_0x3e9bb1);})[_0xc84c('0x21')](function(_0x200974){if(_0x200974&&_0x200974[_0xc84c('0x1f')]){return _0x57083a[_0xc84c('0x23')]['bulkCreate'](_0x200974);}})['then'](function(){_0x4a0bef();})[_0xc84c('0x1d')](function(_0x2b45b4){_0x4a0bef(_0x2b45b4);});},'afterDestroy':function(_0x4a4806,_0x1ec769,_0x567dfe){return _0x57083a[_0xc84c('0x23')][_0xc84c('0x22')]({'where':{'ChanSpyId':_0x4a4806['id']}})[_0xc84c('0x21')](function(){_0x567dfe();})[_0xc84c('0x1d')](function(_0x3ccf82){_0x567dfe(_0x3ccf82);});}}});}; \ No newline at end of file +var _0x2a34=['ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','findAll','then','catch','exports','define','voice_chanspy','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x2a34,0x154));var _0x42a3=function(_0x132363,_0x465530){_0x132363=_0x132363-0x0;var _0x45d461=_0x2a34[_0x132363];return _0x45d461;};'use strict';var _=require(_0x42a3('0x0'));var util=require(_0x42a3('0x1'));var BPromise=require(_0x42a3('0x2'));var attributes=require(_0x42a3('0x3'));var getUserApplications=function(_0x40f1bc,_0x2379d2,_0x65e651){var _0x34a600=0x1;var _0x2ab87a=[];var _0xf3a529={'context':_0x2379d2[_0x42a3('0x4')]||_0x42a3('0x5'),'exten':util['format'](_0x42a3('0x6'),_0x40f1bc[_0x42a3('0x7')],_0x65e651),'type':_0x42a3('0x8'),'isApp':![],'ChanSpyId':_0x40f1bc['id'],'UserId':_0x2379d2['id']};_0x2ab87a[_0x42a3('0x9')](_[_0x42a3('0xa')]({'app':_0x42a3('0xb'),'appdata':util[_0x42a3('0xc')](_0x42a3('0xd'),_0x42a3('0xe')),'priority':_0x34a600++},_0xf3a529));if(_0x40f1bc[_0x42a3('0xf')]){_0x2ab87a[_0x42a3('0x9')](_[_0x42a3('0xa')]({'app':_0x42a3('0x10'),'appdata':util[_0x42a3('0xc')](_0x42a3('0x11'),_0x40f1bc[_0x42a3('0x12')]),'priority':_0x34a600++},_0xf3a529));}if(_0x40f1bc['auth']){_0x2ab87a[_0x42a3('0x9')](_['merge']({'app':'Authenticate','appdata':_0x40f1bc[_0x42a3('0x13')],'priority':_0x34a600++},_0xf3a529));}_0x2ab87a[_0x42a3('0x9')](_[_0x42a3('0xa')]({'app':_0x42a3('0x14'),'appdata':util[_0x42a3('0xc')](_0x42a3('0x15'),_0x2379d2[_0x42a3('0x16')],_0x40f1bc['options']?_0x40f1bc[_0x42a3('0x17')]['join'](''):''),'priority':_0x34a600++},_0xf3a529));if(_0x40f1bc[_0x42a3('0xf')]){_0x2ab87a[_0x42a3('0x9')](_['merge']({'app':_0x42a3('0x18'),'priority':_0x34a600++},_0xf3a529));}return _0x2ab87a;};var getChanSpyApplications=function(_0x54f57b,_0x4832e2){var _0x5c38d3=[];for(var _0x2ac264=0x0,_0x51ad91=0x1;_0x2ac264<_0x4832e2[_0x42a3('0x19')];_0x2ac264++,_0x51ad91=0x1){_0x5c38d3=_0x5c38d3[_0x42a3('0x1a')](getUserApplications(_0x54f57b,_0x4832e2[_0x2ac264],_0x4832e2[_0x2ac264][_0x42a3('0x1b')]));if(_0x4832e2[_0x2ac264]['internal']!=_0x4832e2[_0x2ac264]['name']){_0x5c38d3=_0x5c38d3[_0x42a3('0x1a')](getUserApplications(_0x54f57b,_0x4832e2[_0x2ac264],_0x4832e2[_0x2ac264][_0x42a3('0x16')]));}}return _0x5c38d3;};var getChanSpyPromise=function(_0x3516cf,_0x412e6c){return new BPromise(function(_0x4372b8,_0x5c2438){return _0x3516cf['User'][_0x42a3('0x1c')]({'attributes':['id',_0x42a3('0x16'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x42a3('0x1d')](function(_0x30adf3){if(_0x30adf3){return _0x4372b8(getChanSpyApplications(_0x412e6c,_0x30adf3));}return _0x4372b8([]);})[_0x42a3('0x1e')](function(_0x10491e){_0x5c2438(_0x10491e);});});};module[_0x42a3('0x1f')]=function(_0x48e5f4,_0x575e70){var _0xbdf864=_0x48e5f4['models'];return _0x48e5f4[_0x42a3('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x42a3('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x233583,_0x26fe5c,_0x4c934a){return getChanSpyPromise(_0xbdf864,_0x233583)[_0x42a3('0x1d')](function(_0x5c69db){if(_0x5c69db&&_0x5c69db[_0x42a3('0x19')]){return _0xbdf864['VoiceExtension']['bulkCreate'](_0x5c69db);}})[_0x42a3('0x1d')](function(){_0x4c934a();})['catch'](function(_0x396d7d){_0x4c934a(_0x396d7d);});},'afterUpdate':function(_0x44ebb6,_0x4515c5,_0x532b82){return _0xbdf864[_0x42a3('0x22')]['destroy']({'where':{'ChanSpyId':_0x44ebb6['id']}})['then'](function(){return getChanSpyPromise(_0xbdf864,_0x44ebb6);})[_0x42a3('0x1d')](function(_0x2c8285){if(_0x2c8285&&_0x2c8285[_0x42a3('0x19')]){return _0xbdf864['VoiceExtension'][_0x42a3('0x23')](_0x2c8285);}})['then'](function(){_0x532b82();})[_0x42a3('0x1e')](function(_0x3e037a){_0x532b82(_0x3e037a);});},'afterDestroy':function(_0x40fcbf,_0x2b9f26,_0x5a22c8){return _0xbdf864[_0x42a3('0x22')]['destroy']({'where':{'ChanSpyId':_0x40fcbf['id']}})[_0x42a3('0x1d')](function(){_0x5a22c8();})[_0x42a3('0x1e')](function(_0x276822){_0x5a22c8(_0x276822);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 399f10e..0b7bf50 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 _0x6f2f=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','code','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6f2f[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('VoiceChanSpy,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x43114f,_0x2980a5){var _0x3d9eb9=function(_0x2289cc){while(--_0x2289cc){_0x43114f['push'](_0x43114f['shift']());}};_0x3d9eb9(++_0x2980a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb91[_0x125ff8];return _0x2d9ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 48959da..8ff73c8 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 _0xfd58=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','update','delete'];(function(_0x195864,_0x5b75b4){var _0x1d9e46=function(_0x4ff455){while(--_0x4ff455){_0x195864['push'](_0x195864['shift']());}};_0x1d9e46(++_0x5b75b4);}(_0xfd58,0x1a7));var _0x8fd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8fd5('0x0'));var util=require(_0x8fd5('0x1'));var path=require(_0x8fd5('0x2'));var timeout=require(_0x8fd5('0x3'));var express=require(_0x8fd5('0x4'));var router=express[_0x8fd5('0x5')]();var fs_extra=require(_0x8fd5('0x6'));var auth=require(_0x8fd5('0x7'));var interaction=require(_0x8fd5('0x8'));var config=require(_0x8fd5('0x9'));var controller=require('./voiceContext.controller');router[_0x8fd5('0xa')]('/',auth[_0x8fd5('0xb')](),controller['index']);router[_0x8fd5('0xa')]('/:id',auth[_0x8fd5('0xb')](),controller[_0x8fd5('0xc')]);router[_0x8fd5('0xd')]('/',auth[_0x8fd5('0xb')](),controller[_0x8fd5('0xe')]);router[_0x8fd5('0xf')]('/:id',auth[_0x8fd5('0xb')](),controller[_0x8fd5('0x10')]);router[_0x8fd5('0x11')](_0x8fd5('0x12'),auth[_0x8fd5('0xb')](),controller[_0x8fd5('0x13')]);module[_0x8fd5('0x14')]=router; \ No newline at end of file +var _0xd9ef=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x33ecde,_0x6ac1db){var _0x5c84ef=function(_0x3dc8a8){while(--_0x3dc8a8){_0x33ecde['push'](_0x33ecde['shift']());}};_0x5c84ef(++_0x6ac1db);}(_0xd9ef,0xc8));var _0xfd9e=function(_0x44f314,_0x765ee2){_0x44f314=_0x44f314-0x0;var _0x3fbd5c=_0xd9ef[_0x44f314];return _0x3fbd5c;};'use strict';var multer=require('multer');var util=require(_0xfd9e('0x0'));var path=require(_0xfd9e('0x1'));var timeout=require(_0xfd9e('0x2'));var express=require(_0xfd9e('0x3'));var router=express[_0xfd9e('0x4')]();var fs_extra=require(_0xfd9e('0x5'));var auth=require(_0xfd9e('0x6'));var interaction=require(_0xfd9e('0x7'));var config=require(_0xfd9e('0x8'));var controller=require('./voiceContext.controller');router[_0xfd9e('0x9')]('/',auth[_0xfd9e('0xa')](),controller['index']);router[_0xfd9e('0x9')](_0xfd9e('0xb'),auth[_0xfd9e('0xa')](),controller[_0xfd9e('0xc')]);router[_0xfd9e('0xd')]('/',auth[_0xfd9e('0xa')](),controller[_0xfd9e('0xe')]);router[_0xfd9e('0xf')]('/:id',auth[_0xfd9e('0xa')](),controller[_0xfd9e('0x10')]);router[_0xfd9e('0x11')](_0xfd9e('0xb'),auth['isAuthenticated'](),controller[_0xfd9e('0x12')]);module[_0xfd9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2f0d6ec..d7fe274 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 _0x883d=['exports','name','STRING','BOOLEAN','sequelize'];(function(_0x3d3109,_0xfc72e3){var _0x76e70b=function(_0x5e8247){while(--_0x5e8247){_0x3d3109['push'](_0x3d3109['shift']());}};_0x76e70b(++_0xfc72e3);}(_0x883d,0x130));var _0xd883=function(_0x5276bf,_0x1e212c){_0x5276bf=_0x5276bf-0x0;var _0x40268c=_0x883d[_0x5276bf];return _0x40268c;};'use strict';var Sequelize=require(_0xd883('0x0'));module[_0xd883('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd883('0x2')},'description':{'type':Sequelize[_0xd883('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd883('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x037b=['BOOLEAN','STRING','name'];(function(_0x45f8ed,_0x2c0a8d){var _0x490293=function(_0x968cad){while(--_0x968cad){_0x45f8ed['push'](_0x45f8ed['shift']());}};_0x490293(++_0x2c0a8d);}(_0x037b,0x196));var _0xb037=function(_0x4efcdb,_0x5f1854){_0x4efcdb=_0x4efcdb-0x0;var _0x284cb4=_0x037b[_0x4efcdb];return _0x284cb4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb037('0x0')],'unique':_0xb037('0x1')},'description':{'type':Sequelize[_0xb037('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb037('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 751c45d..559a836 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 _0xa5c5=['update','destroy','get','Contexts','stack','name','index','VoiceContext','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','readFileSync','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','params','body','join','root','chan_sip.so','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save'];(function(_0x5eb632,_0x42c01c){var _0xedadf7=function(_0x32d795){while(--_0x32d795){_0x5eb632['push'](_0x5eb632['shift']());}};_0xedadf7(++_0x42c01c);}(_0xa5c5,0x1cc));var _0x5a5c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa5c5[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a5c('0x0'));var zipdir=require(_0x5a5c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a5c('0x2'));var moment=require(_0x5a5c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5a5c('0x4'));var util=require(_0x5a5c('0x5'));var path=require('path');var sox=require(_0x5a5c('0x6'));var csv=require(_0x5a5c('0x7'));var ejs=require(_0x5a5c('0x8'));var fs=require('fs');var fs_extra=require(_0x5a5c('0x9'));var _=require('lodash');var squel=require(_0x5a5c('0xa'));var crypto=require(_0x5a5c('0xb'));var jsforce=require(_0x5a5c('0xc'));var deskjs=require(_0x5a5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5a5c('0xe'));var Papa=require(_0x5a5c('0xf'));var Redis=require(_0x5a5c('0x10'));var authService=require(_0x5a5c('0x11'));var qs=require(_0x5a5c('0x12'));var as=require(_0x5a5c('0x13'));var hardwareService=require(_0x5a5c('0x14'));var logger=require('../../config/logger')(_0x5a5c('0x15'));var utils=require(_0x5a5c('0x16'));var config=require(_0x5a5c('0x17'));var licenseUtil=require(_0x5a5c('0x18'));var db=require(_0x5a5c('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5a5c('0x1a')][_0x5a5c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xc33ad9,_0x299825,_0x5289d4,_0x129444){return new BPromise(function(_0x368adf,_0x5d77f5){var _0x2987ef=_0x129444||client;return _0x2987ef[_0x5a5c('0x1c')](_0xc33ad9,_0x5289d4)[_0x5a5c('0x1d')](function(_0x39fe69){logger[_0x5a5c('0x1e')](_0x5a5c('0x1f'),_0x299825,'request\x20sent');logger[_0x5a5c('0x20')](_0x5a5c('0x21'),_0x299825,'request\x20sent',JSON[_0x5a5c('0x22')](_0x39fe69));if(_0x39fe69[_0x5a5c('0x23')]){if(_0x39fe69[_0x5a5c('0x23')][_0x5a5c('0x24')]===0x1f4){logger[_0x5a5c('0x23')]('VoiceContext,\x20%s,\x20%s',_0x299825,_0x39fe69[_0x5a5c('0x23')][_0x5a5c('0x25')]);return _0x5d77f5(_0x39fe69[_0x5a5c('0x23')][_0x5a5c('0x25')]);}logger[_0x5a5c('0x23')](_0x5a5c('0x1f'),_0x299825,_0x39fe69[_0x5a5c('0x23')]['message']);return _0x368adf(_0x39fe69[_0x5a5c('0x23')][_0x5a5c('0x25')]);}else{logger['info'](_0x5a5c('0x1f'),_0x299825,'request\x20sent');_0x368adf(_0x39fe69['result'][_0x5a5c('0x25')]);}})[_0x5a5c('0x26')](function(_0x5bd88e){logger['error'](_0x5a5c('0x1f'),_0x299825,_0x5bd88e);_0x5d77f5(_0x5bd88e);});});}function respondWithStatusCode(_0x366126,_0x40d543){_0x40d543=_0x40d543||0xcc;return function(_0x1eb8f3){if(_0x1eb8f3){return _0x366126[_0x5a5c('0x27')](_0x40d543);}return _0x366126['status'](_0x40d543)[_0x5a5c('0x28')]();};}function respondWithResult(_0x1784f5,_0x73d2f8){_0x73d2f8=_0x73d2f8||0xc8;return function(_0x498179){if(_0x498179){return _0x1784f5[_0x5a5c('0x29')](_0x73d2f8)[_0x5a5c('0x2a')](_0x498179);}};}function respondWithFilteredResult(_0x59cd39,_0x5643ae){return function(_0x50360d){if(_0x50360d){var _0x3902a6=typeof _0x5643ae[_0x5a5c('0x2b')]===_0x5a5c('0x2c')&&typeof _0x5643ae['limit']===_0x5a5c('0x2c');var _0x1cc1e3=_0x50360d[_0x5a5c('0x2d')];var _0x378eee=_0x3902a6?0x0:_0x5643ae[_0x5a5c('0x2b')];var _0x3527ba=_0x3902a6?_0x50360d['count']:_0x5643ae['offset']+_0x5643ae['limit'];var _0x461c98;if(_0x3527ba>=_0x1cc1e3){_0x3527ba=_0x1cc1e3;_0x461c98=0xc8;}else{_0x461c98=0xce;}_0x59cd39[_0x5a5c('0x29')](_0x461c98);return _0x59cd39['set'](_0x5a5c('0x2e'),_0x378eee+'-'+_0x3527ba+'/'+_0x1cc1e3)[_0x5a5c('0x2a')](_0x50360d);}return null;};}function patchUpdates(_0x272ca3){return function(_0x4f53a7){try{jsonpatch[_0x5a5c('0x2f')](_0x4f53a7,_0x272ca3,!![]);}catch(_0x53851e){return BPromise[_0x5a5c('0x30')](_0x53851e);}return _0x4f53a7[_0x5a5c('0x31')]();};}function saveUpdates(_0x4ffdb1,_0xe1af83){return function(_0x443cd5){if(_0x443cd5){return _0x443cd5[_0x5a5c('0x32')](_0x4ffdb1)[_0x5a5c('0x1d')](function(_0x4d9423){return _0x4d9423;});}return null;};}function removeEntity(_0x4f4fa0,_0x9907c0){return function(_0x9c74b2){if(_0x9c74b2){return _0x9c74b2[_0x5a5c('0x33')]()['then'](function(){var _0x7eca1=_0x9c74b2[_0x5a5c('0x34')]({'plain':!![]});var _0x384c1c=_0x5a5c('0x35');return db['UserProfileResource'][_0x5a5c('0x33')]({'where':{'type':_0x384c1c,'resourceId':_0x7eca1['id']}})[_0x5a5c('0x1d')](function(){return _0x9c74b2;});})[_0x5a5c('0x1d')](function(){_0x4f4fa0[_0x5a5c('0x29')](0xcc)[_0x5a5c('0x28')]();});}};}function handleEntityNotFound(_0x11973d,_0x1f0968){return function(_0x426407){if(!_0x426407){_0x11973d['sendStatus'](0x194);}return _0x426407;};}function handleError(_0x536276,_0x1e9490){_0x1e9490=_0x1e9490||0x1f4;return function(_0x3d3d41){logger[_0x5a5c('0x23')](_0x3d3d41[_0x5a5c('0x36')]);if(_0x3d3d41[_0x5a5c('0x37')]){delete _0x3d3d41[_0x5a5c('0x37')];}_0x536276[_0x5a5c('0x29')](_0x1e9490)['send'](_0x3d3d41);};}exports[_0x5a5c('0x38')]=function(_0x40f624,_0x34d39b){var _0x28a662={},_0x5f2743={},_0x49a120={'count':0x0,'rows':[]};var _0x5d47bf=_['map'](db[_0x5a5c('0x39')][_0x5a5c('0x3a')],function(_0x1c2ba4){return{'name':_0x1c2ba4[_0x5a5c('0x3b')],'type':_0x1c2ba4['type'][_0x5a5c('0x3c')]};});_0x5f2743[_0x5a5c('0x3d')]=_[_0x5a5c('0x3e')](_0x5d47bf,_0x5a5c('0x37'));_0x5f2743[_0x5a5c('0x3f')]=_['keys'](_0x40f624[_0x5a5c('0x3f')]);_0x5f2743['filters']=_[_0x5a5c('0x40')](_0x5f2743[_0x5a5c('0x3d')],_0x5f2743[_0x5a5c('0x3f')]);_0x28a662[_0x5a5c('0x41')]=_[_0x5a5c('0x40')](_0x5f2743[_0x5a5c('0x3d')],qs[_0x5a5c('0x42')](_0x40f624[_0x5a5c('0x3f')][_0x5a5c('0x42')]));_0x28a662[_0x5a5c('0x41')]=_0x28a662[_0x5a5c('0x41')][_0x5a5c('0x43')]?_0x28a662[_0x5a5c('0x41')]:_0x5f2743[_0x5a5c('0x3d')];if(!_0x40f624['query'][_0x5a5c('0x44')](_0x5a5c('0x45'))){_0x28a662[_0x5a5c('0x46')]=qs['limit'](_0x40f624[_0x5a5c('0x3f')]['limit']);_0x28a662[_0x5a5c('0x2b')]=qs[_0x5a5c('0x2b')](_0x40f624['query'][_0x5a5c('0x2b')]);}_0x28a662['order']=qs[_0x5a5c('0x47')](_0x40f624[_0x5a5c('0x3f')][_0x5a5c('0x47')]);_0x28a662['where']=qs['filters'](_[_0x5a5c('0x48')](_0x40f624[_0x5a5c('0x3f')],_0x5f2743['filters']),_0x5d47bf);if(_0x40f624['query'][_0x5a5c('0x49')]){_0x28a662[_0x5a5c('0x4a')]=_[_0x5a5c('0x4b')](_0x28a662[_0x5a5c('0x4a')],{'$or':_['map'](_0x5d47bf,function(_0x376b68){if(_0x376b68[_0x5a5c('0x4c')]!==_0x5a5c('0x4d')){var _0x26ec3f={};_0x26ec3f[_0x376b68[_0x5a5c('0x37')]]={'$like':'%'+_0x40f624[_0x5a5c('0x3f')]['filter']+'%'};return _0x26ec3f;}})});}_0x28a662=_[_0x5a5c('0x4b')]({},_0x28a662,_0x40f624[_0x5a5c('0x4e')]);var _0x3cb55d={'where':_0x28a662[_0x5a5c('0x4a')]};return db[_0x5a5c('0x39')][_0x5a5c('0x2d')](_0x3cb55d)[_0x5a5c('0x1d')](function(_0x5059e4){_0x49a120[_0x5a5c('0x2d')]=_0x5059e4;if(_0x40f624[_0x5a5c('0x3f')][_0x5a5c('0x4f')]){_0x28a662[_0x5a5c('0x50')]=[{'all':!![]}];}return db[_0x5a5c('0x39')][_0x5a5c('0x51')](_0x28a662);})[_0x5a5c('0x1d')](function(_0x5af94f){_0x49a120[_0x5a5c('0x52')]=_0x5af94f;return _0x49a120;})[_0x5a5c('0x1d')](respondWithFilteredResult(_0x34d39b,_0x28a662))[_0x5a5c('0x26')](handleError(_0x34d39b,null));};exports[_0x5a5c('0x53')]=function(_0x158a6c,_0x548e24){var _0x13eb7c={'raw':![],'where':{'id':_0x158a6c['params']['id']}},_0x55701d={};_0x55701d['model']=_[_0x5a5c('0x54')](db[_0x5a5c('0x39')][_0x5a5c('0x3a')]);_0x55701d['query']=_[_0x5a5c('0x54')](_0x158a6c[_0x5a5c('0x3f')]);_0x55701d['filters']=_[_0x5a5c('0x40')](_0x55701d[_0x5a5c('0x3d')],_0x55701d[_0x5a5c('0x3f')]);_0x13eb7c[_0x5a5c('0x41')]=_[_0x5a5c('0x40')](_0x55701d[_0x5a5c('0x3d')],qs[_0x5a5c('0x42')](_0x158a6c[_0x5a5c('0x3f')][_0x5a5c('0x42')]));_0x13eb7c[_0x5a5c('0x41')]=_0x13eb7c[_0x5a5c('0x41')]['length']?_0x13eb7c[_0x5a5c('0x41')]:_0x55701d[_0x5a5c('0x3d')];if(_0x158a6c[_0x5a5c('0x3f')][_0x5a5c('0x4f')]){_0x13eb7c['include']=[{'all':!![]}];}_0x13eb7c=_[_0x5a5c('0x4b')]({},_0x13eb7c,_0x158a6c[_0x5a5c('0x4e')]);return db[_0x5a5c('0x39')][_0x5a5c('0x55')](_0x13eb7c)['then'](handleEntityNotFound(_0x548e24,null))['then'](respondWithResult(_0x548e24,null))[_0x5a5c('0x26')](handleError(_0x548e24,null));};exports[_0x5a5c('0x56')]=function(_0x121386,_0x18661b,_0x20facf){var _0x3b4608;return db[_0x5a5c('0x39')][_0x5a5c('0x56')](_0x121386['body'],{'raw':!![]})[_0x5a5c('0x1d')](function(_0x167691){_0x3b4608=_0x167691;return db[_0x5a5c('0x39')]['findAll']({'raw':!![]});})[_0x5a5c('0x1d')](function(_0x395d79){var _0xf02ead=fs[_0x5a5c('0x57')](path['join'](config['root'],_0x5a5c('0x58')),_0x5a5c('0x59'));var _0x481f6d=ejs['render'](_0xf02ead,{'contexts':_0x395d79||[]});fs[_0x5a5c('0x5a')](_0x5a5c('0x5b'),_0x481f6d);})[_0x5a5c('0x1d')](function(){return respondWithRpcPromise(_0x5a5c('0x5c'),_0x5a5c('0x56'),{'module':'chan_sip.so'});})['then'](function(){var _0x329be1=_0x121386[_0x5a5c('0x5d')][_0x5a5c('0x34')]({'plain':!![]});if(!_0x329be1)throw new Error(_0x5a5c('0x5e'));if(_0x329be1[_0x5a5c('0x5f')]===_0x5a5c('0x5d')){var _0x31389d=_0x3b4608[_0x5a5c('0x34')]({'plain':!![]});return db['UserProfileSection'][_0x5a5c('0x55')]({'where':{'name':'Contexts','userProfileId':_0x329be1[_0x5a5c('0x60')]},'raw':!![]})['then'](function(_0x5dce4d){if(_0x5dce4d&&_0x5dce4d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x31389d[_0x5a5c('0x37')],'resourceId':_0x31389d['id'],'type':_0x5dce4d[_0x5a5c('0x37')],'sectionId':_0x5dce4d['id']},{})[_0x5a5c('0x1d')](function(){return _0x3b4608;});}else{return _0x3b4608;}})['catch'](function(_0x1952e3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1952e3);throw _0x1952e3;});}return _0x3b4608;})[_0x5a5c('0x1d')](respondWithResult(_0x18661b,0xc9))[_0x5a5c('0x26')](handleError(_0x18661b,null));};exports[_0x5a5c('0x32')]=function(_0x54a199,_0x373833,_0x25fc5e){var _0x4da304;return db[_0x5a5c('0x39')][_0x5a5c('0x55')]({'where':{'id':_0x54a199[_0x5a5c('0x61')]['id']}})[_0x5a5c('0x1d')](handleEntityNotFound(_0x373833,null))[_0x5a5c('0x1d')](saveUpdates(_0x54a199[_0x5a5c('0x62')],null))[_0x5a5c('0x1d')](function(_0x1bb2dd){if(_0x1bb2dd){_0x4da304=_0x1bb2dd;return db[_0x5a5c('0x39')]['findAll']({'raw':!![]});}})[_0x5a5c('0x1d')](function(_0x2a4a4c){var _0x4f5a3f=fs[_0x5a5c('0x57')](path[_0x5a5c('0x63')](config[_0x5a5c('0x64')],_0x5a5c('0x58')),_0x5a5c('0x59'));var _0x257f84=ejs['render'](_0x4f5a3f,{'contexts':_0x2a4a4c||[]});fs[_0x5a5c('0x5a')](_0x5a5c('0x5b'),_0x257f84);})['then'](function(){return respondWithRpcPromise(_0x5a5c('0x5c'),_0x5a5c('0x32'),{'module':_0x5a5c('0x65')});})[_0x5a5c('0x1d')](function(){return _0x4da304;})['then'](respondWithResult(_0x373833,null))['catch'](handleError(_0x373833,null));};exports[_0x5a5c('0x33')]=function(_0x4bf200,_0x2b408a,_0x7caab2){var _0x228967;return db['VoiceContext'][_0x5a5c('0x55')]({'where':{'id':_0x4bf200[_0x5a5c('0x61')]['id']}})[_0x5a5c('0x1d')](handleEntityNotFound(_0x2b408a,null))[_0x5a5c('0x1d')](removeEntity(_0x2b408a,null))['then'](function(){return db[_0x5a5c('0x39')][_0x5a5c('0x51')]({'raw':!![]});})[_0x5a5c('0x1d')](function(_0x437584){var _0x138b64=fs[_0x5a5c('0x57')](path['join'](config[_0x5a5c('0x64')],_0x5a5c('0x58')),_0x5a5c('0x59'));var _0xafcb6b=ejs['render'](_0x138b64,{'contexts':_0x437584});fs[_0x5a5c('0x5a')](_0x5a5c('0x5b'),_0xafcb6b);return respondWithRpcPromise(_0x5a5c('0x5c'),_0x5a5c('0x33'),{'module':'chan_sip.so'});})[_0x5a5c('0x26')](handleError(_0x2b408a,null));}; \ No newline at end of file +var _0x6dc2=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceContext','includeAll','include','rows','show','params','length','find','create','join','root','utf8','render','writeFileSync','Reload','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/context.ejs','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','message','result','catch','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x6dc2,0x90));var _0x26dc=function(_0x264267,_0x21faff){_0x264267=_0x264267-0x0;var _0x3db65d=_0x6dc2[_0x264267];return _0x3db65d;};'use strict';var emlformat=require(_0x26dc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x26dc('0x1'));var moment=require('moment');var BPromise=require(_0x26dc('0x2'));var Mustache=require(_0x26dc('0x3'));var util=require(_0x26dc('0x4'));var path=require(_0x26dc('0x5'));var sox=require(_0x26dc('0x6'));var csv=require(_0x26dc('0x7'));var ejs=require(_0x26dc('0x8'));var fs=require('fs');var fs_extra=require(_0x26dc('0x9'));var _=require(_0x26dc('0xa'));var squel=require('squel');var crypto=require(_0x26dc('0xb'));var jsforce=require(_0x26dc('0xc'));var deskjs=require(_0x26dc('0xd'));var toCsv=require(_0x26dc('0x7'));var querystring=require(_0x26dc('0xe'));var Papa=require(_0x26dc('0xf'));var Redis=require(_0x26dc('0x10'));var authService=require(_0x26dc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x26dc('0x12'));var hardwareService=require(_0x26dc('0x13'));var logger=require(_0x26dc('0x14'))(_0x26dc('0x15'));var utils=require('../../config/utils');var config=require(_0x26dc('0x16'));var licenseUtil=require(_0x26dc('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x26dc('0x18'));var client=jayson[_0x26dc('0x19')][_0x26dc('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3fe087,_0x554ea6,_0x44bc05,_0x363721){return new BPromise(function(_0x1a6b38,_0xf21876){var _0x19994a=_0x363721||client;return _0x19994a[_0x26dc('0x1b')](_0x3fe087,_0x44bc05)['then'](function(_0x58d039){logger[_0x26dc('0x1c')](_0x26dc('0x1d'),_0x554ea6,_0x26dc('0x1e'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x554ea6,'request\x20sent',JSON['stringify'](_0x58d039));if(_0x58d039[_0x26dc('0x1f')]){if(_0x58d039[_0x26dc('0x1f')]['code']===0x1f4){logger['error'](_0x26dc('0x1d'),_0x554ea6,_0x58d039['error'][_0x26dc('0x20')]);return _0xf21876(_0x58d039[_0x26dc('0x1f')][_0x26dc('0x20')]);}logger[_0x26dc('0x1f')](_0x26dc('0x1d'),_0x554ea6,_0x58d039[_0x26dc('0x1f')][_0x26dc('0x20')]);return _0x1a6b38(_0x58d039[_0x26dc('0x1f')][_0x26dc('0x20')]);}else{logger['info'](_0x26dc('0x1d'),_0x554ea6,_0x26dc('0x1e'));_0x1a6b38(_0x58d039[_0x26dc('0x21')][_0x26dc('0x20')]);}})[_0x26dc('0x22')](function(_0xc518d){logger[_0x26dc('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x554ea6,_0xc518d);_0xf21876(_0xc518d);});});}function respondWithStatusCode(_0x50b42e,_0x13c4a9){_0x13c4a9=_0x13c4a9||0xcc;return function(_0x554e0f){if(_0x554e0f){return _0x50b42e['sendStatus'](_0x13c4a9);}return _0x50b42e['status'](_0x13c4a9)['end']();};}function respondWithResult(_0x2c3333,_0x13819b){_0x13819b=_0x13819b||0xc8;return function(_0x394c7b){if(_0x394c7b){return _0x2c3333['status'](_0x13819b)[_0x26dc('0x23')](_0x394c7b);}};}function respondWithFilteredResult(_0x2dc507,_0x43da65){return function(_0x2d0655){if(_0x2d0655){var _0x22cbad=typeof _0x43da65[_0x26dc('0x24')]===_0x26dc('0x25')&&typeof _0x43da65[_0x26dc('0x26')]===_0x26dc('0x25');var _0x33b4e9=_0x2d0655['count'];var _0xd80e99=_0x22cbad?0x0:_0x43da65[_0x26dc('0x24')];var _0x557e65=_0x22cbad?_0x2d0655[_0x26dc('0x27')]:_0x43da65[_0x26dc('0x24')]+_0x43da65['limit'];var _0x154b16;if(_0x557e65>=_0x33b4e9){_0x557e65=_0x33b4e9;_0x154b16=0xc8;}else{_0x154b16=0xce;}_0x2dc507[_0x26dc('0x28')](_0x154b16);return _0x2dc507['set'](_0x26dc('0x29'),_0xd80e99+'-'+_0x557e65+'/'+_0x33b4e9)[_0x26dc('0x23')](_0x2d0655);}return null;};}function patchUpdates(_0x347f4f){return function(_0x25b570){try{jsonpatch[_0x26dc('0x2a')](_0x25b570,_0x347f4f,!![]);}catch(_0x4efd1c){return BPromise[_0x26dc('0x2b')](_0x4efd1c);}return _0x25b570[_0x26dc('0x2c')]();};}function saveUpdates(_0x1dbe58,_0x3fe350){return function(_0x21ee9e){if(_0x21ee9e){return _0x21ee9e[_0x26dc('0x2d')](_0x1dbe58)[_0x26dc('0x2e')](function(_0x5e2576){return _0x5e2576;});}return null;};}function removeEntity(_0x3ee23c,_0x25379c){return function(_0x5c0360){if(_0x5c0360){return _0x5c0360[_0x26dc('0x2f')]()['then'](function(){var _0xa7af36=_0x5c0360['get']({'plain':!![]});var _0x58e827='Contexts';return db['UserProfileResource']['destroy']({'where':{'type':_0x58e827,'resourceId':_0xa7af36['id']}})['then'](function(){return _0x5c0360;});})['then'](function(){_0x3ee23c[_0x26dc('0x28')](0xcc)[_0x26dc('0x30')]();});}};}function handleEntityNotFound(_0x3f6213,_0x30fa58){return function(_0x107cef){if(!_0x107cef){_0x3f6213['sendStatus'](0x194);}return _0x107cef;};}function handleError(_0x377bb1,_0x30055e){_0x30055e=_0x30055e||0x1f4;return function(_0xdb9ab5){logger[_0x26dc('0x1f')](_0xdb9ab5[_0x26dc('0x31')]);if(_0xdb9ab5[_0x26dc('0x32')]){delete _0xdb9ab5['name'];}_0x377bb1[_0x26dc('0x28')](_0x30055e)[_0x26dc('0x33')](_0xdb9ab5);};}exports[_0x26dc('0x34')]=function(_0x35e115,_0x542458){var _0xe3ec27={},_0x429850={},_0x1b1297={'count':0x0,'rows':[]};var _0x4e85a3=_[_0x26dc('0x35')](db['VoiceContext'][_0x26dc('0x36')],function(_0x5986ac){return{'name':_0x5986ac[_0x26dc('0x37')],'type':_0x5986ac['type'][_0x26dc('0x38')]};});_0x429850[_0x26dc('0x39')]=_[_0x26dc('0x35')](_0x4e85a3,_0x26dc('0x32'));_0x429850[_0x26dc('0x3a')]=_[_0x26dc('0x3b')](_0x35e115['query']);_0x429850[_0x26dc('0x3c')]=_[_0x26dc('0x3d')](_0x429850['model'],_0x429850[_0x26dc('0x3a')]);_0xe3ec27[_0x26dc('0x3e')]=_[_0x26dc('0x3d')](_0x429850[_0x26dc('0x39')],qs[_0x26dc('0x3f')](_0x35e115['query']['fields']));_0xe3ec27[_0x26dc('0x3e')]=_0xe3ec27[_0x26dc('0x3e')]['length']?_0xe3ec27[_0x26dc('0x3e')]:_0x429850[_0x26dc('0x39')];if(!_0x35e115[_0x26dc('0x3a')][_0x26dc('0x40')](_0x26dc('0x41'))){_0xe3ec27[_0x26dc('0x26')]=qs['limit'](_0x35e115[_0x26dc('0x3a')][_0x26dc('0x26')]);_0xe3ec27[_0x26dc('0x24')]=qs[_0x26dc('0x24')](_0x35e115[_0x26dc('0x3a')][_0x26dc('0x24')]);}_0xe3ec27['order']=qs[_0x26dc('0x42')](_0x35e115[_0x26dc('0x3a')][_0x26dc('0x42')]);_0xe3ec27[_0x26dc('0x43')]=qs[_0x26dc('0x3c')](_[_0x26dc('0x44')](_0x35e115[_0x26dc('0x3a')],_0x429850[_0x26dc('0x3c')]),_0x4e85a3);if(_0x35e115[_0x26dc('0x3a')][_0x26dc('0x45')]){_0xe3ec27[_0x26dc('0x43')]=_[_0x26dc('0x46')](_0xe3ec27[_0x26dc('0x43')],{'$or':_[_0x26dc('0x35')](_0x4e85a3,function(_0x43966d){if(_0x43966d[_0x26dc('0x47')]!==_0x26dc('0x48')){var _0xc88a61={};_0xc88a61[_0x43966d[_0x26dc('0x32')]]={'$like':'%'+_0x35e115['query']['filter']+'%'};return _0xc88a61;}})});}_0xe3ec27=_[_0x26dc('0x46')]({},_0xe3ec27,_0x35e115[_0x26dc('0x49')]);var _0x3a2297={'where':_0xe3ec27['where']};return db[_0x26dc('0x4a')][_0x26dc('0x27')](_0x3a2297)[_0x26dc('0x2e')](function(_0x3f5a11){_0x1b1297[_0x26dc('0x27')]=_0x3f5a11;if(_0x35e115[_0x26dc('0x3a')][_0x26dc('0x4b')]){_0xe3ec27[_0x26dc('0x4c')]=[{'all':!![]}];}return db[_0x26dc('0x4a')]['findAll'](_0xe3ec27);})['then'](function(_0x16eeb9){_0x1b1297[_0x26dc('0x4d')]=_0x16eeb9;return _0x1b1297;})['then'](respondWithFilteredResult(_0x542458,_0xe3ec27))[_0x26dc('0x22')](handleError(_0x542458,null));};exports[_0x26dc('0x4e')]=function(_0xbb2dea,_0x459f42){var _0x1048fc={'raw':![],'where':{'id':_0xbb2dea[_0x26dc('0x4f')]['id']}},_0x58d43d={};_0x58d43d[_0x26dc('0x39')]=_[_0x26dc('0x3b')](db[_0x26dc('0x4a')][_0x26dc('0x36')]);_0x58d43d[_0x26dc('0x3a')]=_[_0x26dc('0x3b')](_0xbb2dea[_0x26dc('0x3a')]);_0x58d43d[_0x26dc('0x3c')]=_[_0x26dc('0x3d')](_0x58d43d[_0x26dc('0x39')],_0x58d43d[_0x26dc('0x3a')]);_0x1048fc[_0x26dc('0x3e')]=_['intersection'](_0x58d43d['model'],qs[_0x26dc('0x3f')](_0xbb2dea[_0x26dc('0x3a')][_0x26dc('0x3f')]));_0x1048fc[_0x26dc('0x3e')]=_0x1048fc[_0x26dc('0x3e')][_0x26dc('0x50')]?_0x1048fc[_0x26dc('0x3e')]:_0x58d43d[_0x26dc('0x39')];if(_0xbb2dea[_0x26dc('0x3a')][_0x26dc('0x4b')]){_0x1048fc[_0x26dc('0x4c')]=[{'all':!![]}];}_0x1048fc=_['merge']({},_0x1048fc,_0xbb2dea['options']);return db['VoiceContext'][_0x26dc('0x51')](_0x1048fc)[_0x26dc('0x2e')](handleEntityNotFound(_0x459f42,null))[_0x26dc('0x2e')](respondWithResult(_0x459f42,null))[_0x26dc('0x22')](handleError(_0x459f42,null));};exports['create']=function(_0x43984d,_0x42bd4c,_0x55f3c8){var _0x2aa065;return db['VoiceContext'][_0x26dc('0x52')](_0x43984d['body'],{'raw':!![]})[_0x26dc('0x2e')](function(_0x1ce421){_0x2aa065=_0x1ce421;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x26dc('0x2e')](function(_0x2d0be7){var _0x3e130d=fs['readFileSync'](path[_0x26dc('0x53')](config[_0x26dc('0x54')],'server/files/templates/context.ejs'),_0x26dc('0x55'));var _0x20a2af=ejs[_0x26dc('0x56')](_0x3e130d,{'contexts':_0x2d0be7||[]});fs[_0x26dc('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x20a2af);})['then'](function(){return respondWithRpcPromise(_0x26dc('0x58'),_0x26dc('0x52'),{'module':_0x26dc('0x59')});})['then'](function(){var _0xd15b3a=_0x43984d['user'][_0x26dc('0x5a')]({'plain':!![]});if(!_0xd15b3a)throw new Error(_0x26dc('0x5b'));if(_0xd15b3a['role']===_0x26dc('0x5c')){var _0x3acb39=_0x2aa065['get']({'plain':!![]});return db[_0x26dc('0x5d')]['find']({'where':{'name':_0x26dc('0x5e'),'userProfileId':_0xd15b3a[_0x26dc('0x5f')]},'raw':!![]})[_0x26dc('0x2e')](function(_0x4050c0){if(_0x4050c0&&_0x4050c0[_0x26dc('0x60')]===0x0){return db[_0x26dc('0x61')][_0x26dc('0x52')]({'name':_0x3acb39[_0x26dc('0x32')],'resourceId':_0x3acb39['id'],'type':_0x4050c0[_0x26dc('0x32')],'sectionId':_0x4050c0['id']},{})[_0x26dc('0x2e')](function(){return _0x2aa065;});}else{return _0x2aa065;}})[_0x26dc('0x22')](function(_0x57d32f){logger[_0x26dc('0x1f')](_0x26dc('0x62'),_0x57d32f);throw _0x57d32f;});}return _0x2aa065;})['then'](respondWithResult(_0x42bd4c,0xc9))[_0x26dc('0x22')](handleError(_0x42bd4c,null));};exports['update']=function(_0x398b12,_0x4ea849,_0x113d49){var _0x56d56e;return db[_0x26dc('0x4a')][_0x26dc('0x51')]({'where':{'id':_0x398b12[_0x26dc('0x4f')]['id']}})[_0x26dc('0x2e')](handleEntityNotFound(_0x4ea849,null))['then'](saveUpdates(_0x398b12['body'],null))[_0x26dc('0x2e')](function(_0x891ddd){if(_0x891ddd){_0x56d56e=_0x891ddd;return db[_0x26dc('0x4a')]['findAll']({'raw':!![]});}})[_0x26dc('0x2e')](function(_0x369ef8){var _0x20e4f1=fs[_0x26dc('0x63')](path[_0x26dc('0x53')](config[_0x26dc('0x54')],_0x26dc('0x64')),_0x26dc('0x55'));var _0x3c40b6=ejs[_0x26dc('0x56')](_0x20e4f1,{'contexts':_0x369ef8||[]});fs[_0x26dc('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3c40b6);})[_0x26dc('0x2e')](function(){return respondWithRpcPromise('Reload',_0x26dc('0x2d'),{'module':_0x26dc('0x59')});})[_0x26dc('0x2e')](function(){return _0x56d56e;})[_0x26dc('0x2e')](respondWithResult(_0x4ea849,null))['catch'](handleError(_0x4ea849,null));};exports[_0x26dc('0x2f')]=function(_0x14b73a,_0xf9db3,_0x42d4cd){var _0x3ddab1;return db['VoiceContext']['find']({'where':{'id':_0x14b73a[_0x26dc('0x4f')]['id']}})[_0x26dc('0x2e')](handleEntityNotFound(_0xf9db3,null))[_0x26dc('0x2e')](removeEntity(_0xf9db3,null))[_0x26dc('0x2e')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x26dc('0x2e')](function(_0x486ec7){var _0x58b625=fs[_0x26dc('0x63')](path['join'](config['root'],_0x26dc('0x64')),_0x26dc('0x55'));var _0x20abd1=ejs[_0x26dc('0x56')](_0x58b625,{'contexts':_0x486ec7});fs[_0x26dc('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x20abd1);return respondWithRpcPromise(_0x26dc('0x58'),_0x26dc('0x2f'),{'module':'chan_sip.so'});})[_0x26dc('0x22')](handleError(_0xf9db3,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 18cdd29..5cd0f24 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 _0x6dc9=['rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','util','../../config/logger','api','request-promise'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x6dc9,0x140));var _0x96dc=function(_0xdabb58,_0x2b2c15){_0xdabb58=_0xdabb58-0x0;var _0x10120e=_0x6dc9[_0xdabb58];return _0x10120e;};'use strict';var _=require('lodash');var util=require(_0x96dc('0x0'));var logger=require(_0x96dc('0x1'))(_0x96dc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x96dc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96dc('0x4'));var config=require(_0x96dc('0x5'));var attributes=require(_0x96dc('0x6'));module['exports']=function(_0x5683fa,_0x2e95d6){return _0x5683fa[_0x96dc('0x7')](_0x96dc('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf296=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf296,0x6a));var _0x6f29=function(_0x54f73e,_0x4946c1){_0x54f73e=_0x54f73e-0x0;var _0x5ed7cd=_0xf296[_0x54f73e];return _0x5ed7cd;};'use strict';var _=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var logger=require(_0x6f29('0x2'))(_0x6f29('0x3'));var moment=require(_0x6f29('0x4'));var BPromise=require(_0x6f29('0x5'));var rp=require(_0x6f29('0x6'));var fs=require('fs');var path=require(_0x6f29('0x7'));var rimraf=require(_0x6f29('0x8'));var config=require('../../config/environment');var attributes=require(_0x6f29('0x9'));module[_0x6f29('0xa')]=function(_0x3c09da,_0x4a8974){return _0x3c09da['define'](_0x6f29('0xb'),attributes,{'tableName':_0x6f29('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 79ac516..953937a 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 _0x9173=['client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x399546,_0x5598af){var _0x1687a3=function(_0x3f7fc2){while(--_0x3f7fc2){_0x399546['push'](_0x399546['shift']());}};_0x1687a3(++_0x5598af);}(_0x9173,0xb4));var _0x3917=function(_0x3bcf4f,_0x579fb7){_0x3bcf4f=_0x3bcf4f-0x0;var _0x68eda7=_0x9173[_0x3bcf4f];return _0x68eda7;};'use strict';var _=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var moment=require('moment');var BPromise=require(_0x3917('0x2'));var rs=require(_0x3917('0x3'));var fs=require('fs');var Redis=require(_0x3917('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3917('0x5'));var logger=require('../../config/logger')(_0x3917('0x6'));var config=require(_0x3917('0x7'));var jayson=require(_0x3917('0x8'));var client=jayson[_0x3917('0x9')][_0x3917('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d592,_0x181918,_0x27f513){return new BPromise(function(_0x11267b,_0x44d50e){return client[_0x3917('0xb')](_0x48d592,_0x27f513)[_0x3917('0xc')](function(_0x58282f){logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,'request\x20sent');logger[_0x3917('0xf')](_0x3917('0x10'),_0x181918,'request\x20sent',JSON['stringify'](_0x58282f));if(_0x58282f['error']){if(_0x58282f[_0x3917('0x11')][_0x3917('0x12')]===0x1f4){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);return _0x44d50e(_0x58282f['error'][_0x3917('0x13')]);}logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x58282f[_0x3917('0x11')]['message']);return _0x11267b(_0x58282f[_0x3917('0x11')][_0x3917('0x13')]);}else{logger[_0x3917('0xd')](_0x3917('0xe'),_0x181918,_0x3917('0x14'));_0x11267b(_0x58282f['result'][_0x3917('0x13')]);}})['catch'](function(_0x4912cd){logger[_0x3917('0x11')](_0x3917('0xe'),_0x181918,_0x4912cd);_0x44d50e(_0x4912cd);});});} \ No newline at end of file +var _0x9153=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9153,0xd8));var _0x3915=function(_0x2ee28e,_0x256f90){_0x2ee28e=_0x2ee28e-0x0;var _0x3cc792=_0x9153[_0x2ee28e];return _0x3cc792;};'use strict';var _=require(_0x3915('0x0'));var util=require(_0x3915('0x1'));var moment=require(_0x3915('0x2'));var BPromise=require(_0x3915('0x3'));var rs=require(_0x3915('0x4'));var fs=require('fs');var Redis=require(_0x3915('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3915('0x6'));var logger=require(_0x3915('0x7'))(_0x3915('0x8'));var config=require(_0x3915('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3915('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9265,_0x29174d,_0x1af44e){return new BPromise(function(_0x2f9362,_0x26476c){return client['request'](_0x4e9265,_0x1af44e)[_0x3915('0xb')](function(_0x50e0a4){logger['info'](_0x3915('0xc'),_0x29174d,_0x3915('0xd'));logger[_0x3915('0xe')](_0x3915('0xf'),_0x29174d,_0x3915('0xd'),JSON[_0x3915('0x10')](_0x50e0a4));if(_0x50e0a4[_0x3915('0x11')]){if(_0x50e0a4[_0x3915('0x11')][_0x3915('0x12')]===0x1f4){logger[_0x3915('0x11')]('VoiceContext,\x20%s,\x20%s',_0x29174d,_0x50e0a4[_0x3915('0x11')][_0x3915('0x13')]);return _0x26476c(_0x50e0a4['error'][_0x3915('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x29174d,_0x50e0a4[_0x3915('0x11')][_0x3915('0x13')]);return _0x2f9362(_0x50e0a4[_0x3915('0x11')][_0x3915('0x13')]);}else{logger['info'](_0x3915('0xc'),_0x29174d,_0x3915('0xd'));_0x2f9362(_0x50e0a4[_0x3915('0x14')][_0x3915('0x13')]);}})[_0x3915('0x15')](function(_0x494926){logger[_0x3915('0x11')](_0x3915('0xc'),_0x29174d,_0x494926);_0x26476c(_0x494926);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4078f6c..ba6b728 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 _0xbc8b=['create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x448ae2,_0x1676f5){var _0x4fdd34=function(_0x30e907){while(--_0x30e907){_0x448ae2['push'](_0x448ae2['shift']());}};_0x4fdd34(++_0x1676f5);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xbc8b[_0x4f83ca];return _0x1fbac3;};'use strict';var multer=require('multer');var util=require(_0xbbc8('0x0'));var path=require('path');var timeout=require(_0xbbc8('0x1'));var express=require(_0xbbc8('0x2'));var router=express[_0xbbc8('0x3')]();var fs_extra=require(_0xbbc8('0x4'));var auth=require(_0xbbc8('0x5'));var interaction=require(_0xbbc8('0x6'));var config=require('../../config/environment');var controller=require(_0xbbc8('0x7'));router[_0xbbc8('0x8')]('/',auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xa')]);router[_0xbbc8('0x8')]('/describe',auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xb')]);router['get'](_0xbbc8('0xc'),auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xd')]);router[_0xbbc8('0xe')]('/',auth[_0xbbc8('0x9')](),controller[_0xbbc8('0xf')]);router[_0xbbc8('0x10')](_0xbbc8('0xc'),auth[_0xbbc8('0x9')](),controller[_0xbbc8('0x11')]);router[_0xbbc8('0x12')](_0xbbc8('0xc'),auth['isAuthenticated'](),controller[_0xbbc8('0x13')]);module[_0xbbc8('0x14')]=router; \ No newline at end of file +var _0x2f14=['../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','exports','util','path','express','fs-extra','../../components/interaction/service'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2f14,0x199));var _0x42f1=function(_0x5656f1,_0x110a07){_0x5656f1=_0x5656f1-0x0;var _0x14a18d=_0x2f14[_0x5656f1];return _0x14a18d;};'use strict';var multer=require('multer');var util=require(_0x42f1('0x0'));var path=require(_0x42f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x42f1('0x2'));var router=express['Router']();var fs_extra=require(_0x42f1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x42f1('0x4'));var config=require(_0x42f1('0x5'));var controller=require(_0x42f1('0x6'));router[_0x42f1('0x7')]('/',auth[_0x42f1('0x8')](),controller[_0x42f1('0x9')]);router[_0x42f1('0x7')](_0x42f1('0xa'),auth[_0x42f1('0x8')](),controller['describe']);router[_0x42f1('0x7')](_0x42f1('0xb'),auth[_0x42f1('0x8')](),controller[_0x42f1('0xc')]);router[_0x42f1('0xd')]('/',auth[_0x42f1('0x8')](),controller['create']);router[_0x42f1('0xe')](_0x42f1('0xb'),auth[_0x42f1('0x8')](),controller[_0x42f1('0xf')]);router[_0x42f1('0x10')](_0x42f1('0xb'),auth[_0x42f1('0x8')](),controller['destroy']);module[_0x42f1('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 d15127f..826a519 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 _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x2c5e1b,_0xd16b91){var _0x25639f=function(_0x8add26){while(--_0x8add26){_0x2c5e1b['push'](_0x2c5e1b['shift']());}};_0x25639f(++_0xd16b91);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x29297e,_0x29adf8){_0x29297e=_0x29297e-0x0;var _0x503a6b=_0x6f0d[_0x29297e];return _0x503a6b;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x1892a3,_0x5e5d83){var _0x551b4e=function(_0x1c39cc){while(--_0x1c39cc){_0x1892a3['push'](_0x1892a3['shift']());}};_0x551b4e(++_0x5e5d83);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1afca37..5952df8 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 _0xf59a=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','apply','save','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','filters','includeAll','include','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra'];(function(_0x4f8c3e,_0x4152a2){var _0x1c050d=function(_0x20eeaa){while(--_0x20eeaa){_0x4f8c3e['push'](_0x4f8c3e['shift']());}};_0x1c050d(++_0x4152a2);}(_0xf59a,0x1ef));var _0xaf59=function(_0x40d304,_0x48eb7f){_0x40d304=_0x40d304-0x0;var _0x141519=_0xf59a[_0x40d304];return _0x141519;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf59('0x0'));var zipdir=require(_0xaf59('0x1'));var jsonpatch=require(_0xaf59('0x2'));var rp=require(_0xaf59('0x3'));var moment=require(_0xaf59('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xaf59('0x5'));var csv=require(_0xaf59('0x6'));var ejs=require(_0xaf59('0x7'));var fs=require('fs');var fs_extra=require(_0xaf59('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaf59('0x9'));var deskjs=require(_0xaf59('0xa'));var toCsv=require(_0xaf59('0x6'));var querystring=require('querystring');var Papa=require(_0xaf59('0xb'));var Redis=require('ioredis');var authService=require(_0xaf59('0xc'));var qs=require(_0xaf59('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf59('0xe'));var logger=require(_0xaf59('0xf'))('api');var utils=require(_0xaf59('0x10'));var config=require(_0xaf59('0x11'));var licenseUtil=require(_0xaf59('0x12'));var db=require(_0xaf59('0x13'))['db'];function respondWithStatusCode(_0x15f8a1,_0x142fdf){_0x142fdf=_0x142fdf||0xcc;return function(_0x1841f0){if(_0x1841f0){return _0x15f8a1['sendStatus'](_0x142fdf);}return _0x15f8a1[_0xaf59('0x14')](_0x142fdf)['end']();};}function respondWithResult(_0x538528,_0x59fea0){_0x59fea0=_0x59fea0||0xc8;return function(_0x11aedf){if(_0x11aedf){return _0x538528[_0xaf59('0x14')](_0x59fea0)[_0xaf59('0x15')](_0x11aedf);}};}function respondWithFilteredResult(_0x80ec15,_0x3f7561){return function(_0x1849f9){if(_0x1849f9){var _0x2d1dfc=typeof _0x3f7561[_0xaf59('0x16')]===_0xaf59('0x17')&&typeof _0x3f7561['limit']==='undefined';var _0x52965a=_0x1849f9['count'];var _0x30899e=_0x2d1dfc?0x0:_0x3f7561[_0xaf59('0x16')];var _0x23d11c=_0x2d1dfc?_0x1849f9[_0xaf59('0x18')]:_0x3f7561['offset']+_0x3f7561['limit'];var _0x49a95e;if(_0x23d11c>=_0x52965a){_0x23d11c=_0x52965a;_0x49a95e=0xc8;}else{_0x49a95e=0xce;}_0x80ec15['status'](_0x49a95e);return _0x80ec15[_0xaf59('0x19')]('Content-Range',_0x30899e+'-'+_0x23d11c+'/'+_0x52965a)[_0xaf59('0x15')](_0x1849f9);}return null;};}function patchUpdates(_0x44f9c6){return function(_0x5e323d){try{jsonpatch[_0xaf59('0x1a')](_0x5e323d,_0x44f9c6,!![]);}catch(_0x232abb){return BPromise['reject'](_0x232abb);}return _0x5e323d[_0xaf59('0x1b')]();};}function saveUpdates(_0x3d0aed,_0x196682){return function(_0x3938b6){if(_0x3938b6){return _0x3938b6['update'](_0x3d0aed)[_0xaf59('0x1c')](function(_0x24c1a6){return _0x24c1a6;});}return null;};}function removeEntity(_0x22dbcd,_0x59bc4f){return function(_0x5d343c){if(_0x5d343c){return _0x5d343c[_0xaf59('0x1d')]()[_0xaf59('0x1c')](function(){_0x22dbcd[_0xaf59('0x14')](0xcc)[_0xaf59('0x1e')]();});}};}function handleEntityNotFound(_0x10df7e,_0x4cadad){return function(_0x58b350){if(!_0x58b350){_0x10df7e[_0xaf59('0x1f')](0x194);}return _0x58b350;};}function handleError(_0x1c383b,_0x4666cb){_0x4666cb=_0x4666cb||0x1f4;return function(_0x32fd5f){logger[_0xaf59('0x20')](_0x32fd5f[_0xaf59('0x21')]);if(_0x32fd5f['name']){delete _0x32fd5f[_0xaf59('0x22')];}_0x1c383b[_0xaf59('0x14')](_0x4666cb)['send'](_0x32fd5f);};}exports[_0xaf59('0x23')]=function(_0x2f1e81,_0x345c92){var _0x1b1397={},_0x1429f8={},_0x265efd={'count':0x0,'rows':[]};var _0x501a9e=_[_0xaf59('0x24')](db[_0xaf59('0x25')][_0xaf59('0x26')],function(_0x242134){return{'name':_0x242134[_0xaf59('0x27')],'type':_0x242134[_0xaf59('0x28')][_0xaf59('0x29')]};});_0x1429f8[_0xaf59('0x2a')]=_[_0xaf59('0x24')](_0x501a9e,_0xaf59('0x22'));_0x1429f8[_0xaf59('0x2b')]=_[_0xaf59('0x2c')](_0x2f1e81[_0xaf59('0x2b')]);_0x1429f8['filters']=_[_0xaf59('0x2d')](_0x1429f8[_0xaf59('0x2a')],_0x1429f8[_0xaf59('0x2b')]);_0x1b1397['attributes']=_[_0xaf59('0x2d')](_0x1429f8[_0xaf59('0x2a')],qs[_0xaf59('0x2e')](_0x2f1e81[_0xaf59('0x2b')]['fields']));_0x1b1397[_0xaf59('0x2f')]=_0x1b1397[_0xaf59('0x2f')][_0xaf59('0x30')]?_0x1b1397[_0xaf59('0x2f')]:_0x1429f8[_0xaf59('0x2a')];if(!_0x2f1e81['query'][_0xaf59('0x31')](_0xaf59('0x32'))){_0x1b1397[_0xaf59('0x33')]=qs[_0xaf59('0x33')](_0x2f1e81[_0xaf59('0x2b')][_0xaf59('0x33')]);_0x1b1397[_0xaf59('0x16')]=qs[_0xaf59('0x16')](_0x2f1e81['query'][_0xaf59('0x16')]);}_0x1b1397[_0xaf59('0x34')]=qs[_0xaf59('0x35')](_0x2f1e81[_0xaf59('0x2b')]['sort']);_0x1b1397[_0xaf59('0x36')]=qs['filters'](_[_0xaf59('0x37')](_0x2f1e81['query'],_0x1429f8['filters']),_0x501a9e);if(_0x2f1e81[_0xaf59('0x2b')][_0xaf59('0x38')]){_0x1b1397[_0xaf59('0x36')]=_[_0xaf59('0x39')](_0x1b1397[_0xaf59('0x36')],{'$or':_[_0xaf59('0x24')](_0x501a9e,function(_0x41f031){if(_0x41f031['type']!==_0xaf59('0x3a')){var _0x5e6ab0={};_0x5e6ab0[_0x41f031['name']]={'$like':'%'+_0x2f1e81[_0xaf59('0x2b')]['filter']+'%'};return _0x5e6ab0;}})});}_0x1b1397=_[_0xaf59('0x39')]({},_0x1b1397,_0x2f1e81[_0xaf59('0x3b')]);var _0x22354c={'where':_0x1b1397[_0xaf59('0x36')]};return db[_0xaf59('0x25')][_0xaf59('0x18')](_0x22354c)[_0xaf59('0x1c')](function(_0x17c47e){_0x265efd[_0xaf59('0x18')]=_0x17c47e;if(_0x2f1e81[_0xaf59('0x2b')]['includeAll']){_0x1b1397['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x1b1397);})['then'](function(_0x379181){_0x265efd[_0xaf59('0x3c')]=_0x379181;return _0x265efd;})['then'](respondWithFilteredResult(_0x345c92,_0x1b1397))[_0xaf59('0x3d')](handleError(_0x345c92,null));};exports[_0xaf59('0x3e')]=function(_0x313caa,_0x1fc609){var _0x5b8e27={'raw':!![],'where':{'id':_0x313caa[_0xaf59('0x3f')]['id']}},_0x6c318d={};_0x6c318d[_0xaf59('0x2a')]=_[_0xaf59('0x2c')](db['VoiceDialReport'][_0xaf59('0x26')]);_0x6c318d[_0xaf59('0x2b')]=_[_0xaf59('0x2c')](_0x313caa[_0xaf59('0x2b')]);_0x6c318d[_0xaf59('0x40')]=_[_0xaf59('0x2d')](_0x6c318d[_0xaf59('0x2a')],_0x6c318d[_0xaf59('0x2b')]);_0x5b8e27[_0xaf59('0x2f')]=_['intersection'](_0x6c318d['model'],qs['fields'](_0x313caa[_0xaf59('0x2b')][_0xaf59('0x2e')]));_0x5b8e27[_0xaf59('0x2f')]=_0x5b8e27[_0xaf59('0x2f')][_0xaf59('0x30')]?_0x5b8e27[_0xaf59('0x2f')]:_0x6c318d['model'];if(_0x313caa[_0xaf59('0x2b')][_0xaf59('0x41')]){_0x5b8e27[_0xaf59('0x42')]=[{'all':!![]}];}_0x5b8e27=_[_0xaf59('0x39')]({},_0x5b8e27,_0x313caa['options']);return db['VoiceDialReport'][_0xaf59('0x43')](_0x5b8e27)[_0xaf59('0x1c')](handleEntityNotFound(_0x1fc609,null))[_0xaf59('0x1c')](respondWithResult(_0x1fc609,null))[_0xaf59('0x3d')](handleError(_0x1fc609,null));};exports[_0xaf59('0x44')]=function(_0x567608,_0x5f6821){return db[_0xaf59('0x25')][_0xaf59('0x44')](_0x567608['body'],{})[_0xaf59('0x1c')](respondWithResult(_0x5f6821,0xc9))[_0xaf59('0x3d')](handleError(_0x5f6821,null));};exports[_0xaf59('0x45')]=function(_0x304a66,_0x5df86d){if(_0x304a66['body']['id']){delete _0x304a66[_0xaf59('0x46')]['id'];}return db[_0xaf59('0x25')][_0xaf59('0x43')]({'where':{'id':_0x304a66[_0xaf59('0x3f')]['id']}})[_0xaf59('0x1c')](handleEntityNotFound(_0x5df86d,null))[_0xaf59('0x1c')](saveUpdates(_0x304a66['body'],null))['then'](respondWithResult(_0x5df86d,null))[_0xaf59('0x3d')](handleError(_0x5df86d,null));};exports[_0xaf59('0x1d')]=function(_0x16ebfd,_0xfc4937){return db['VoiceDialReport'][_0xaf59('0x43')]({'where':{'id':_0x16ebfd[_0xaf59('0x3f')]['id']}})['then'](handleEntityNotFound(_0xfc4937,null))[_0xaf59('0x1c')](removeEntity(_0xfc4937,null))['catch'](handleError(_0xfc4937,null));};exports[_0xaf59('0x47')]=function(_0x4c58be,_0x1ebeab){return db['VoiceDialReport'][_0xaf59('0x47')]()[_0xaf59('0x1c')](respondWithResult(_0x1ebeab,null))[_0xaf59('0x3d')](handleError(_0x1ebeab,null));}; \ No newline at end of file +var _0x02fa=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','apply','reject','update','then','destroy','end','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch','ejs','fs-extra','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x02fa,0xbe));var _0xa02f=function(_0x27f06e,_0x533879){_0x27f06e=_0x27f06e-0x0;var _0x3b49d3=_0x02fa[_0x27f06e];return _0x3b49d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa02f('0x0'));var jsonpatch=require(_0xa02f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa02f('0x2'));var fs=require('fs');var fs_extra=require(_0xa02f('0x3'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa02f('0x4'));var jsforce=require('jsforce');var deskjs=require(_0xa02f('0x5'));var toCsv=require(_0xa02f('0x6'));var querystring=require('querystring');var Papa=require(_0xa02f('0x7'));var Redis=require(_0xa02f('0x8'));var authService=require('../../components/auth/service');var qs=require(_0xa02f('0x9'));var as=require(_0xa02f('0xa'));var hardwareService=require(_0xa02f('0xb'));var logger=require('../../config/logger')(_0xa02f('0xc'));var utils=require('../../config/utils');var config=require(_0xa02f('0xd'));var licenseUtil=require(_0xa02f('0xe'));var db=require(_0xa02f('0xf'))['db'];function respondWithStatusCode(_0x16b9a7,_0x5589a2){_0x5589a2=_0x5589a2||0xcc;return function(_0x55d063){if(_0x55d063){return _0x16b9a7['sendStatus'](_0x5589a2);}return _0x16b9a7[_0xa02f('0x10')](_0x5589a2)['end']();};}function respondWithResult(_0x26dec3,_0x1e86d4){_0x1e86d4=_0x1e86d4||0xc8;return function(_0x38637f){if(_0x38637f){return _0x26dec3[_0xa02f('0x10')](_0x1e86d4)[_0xa02f('0x11')](_0x38637f);}};}function respondWithFilteredResult(_0x30212b,_0x1aa5c7){return function(_0x79fa06){if(_0x79fa06){var _0x52e389=typeof _0x1aa5c7['offset']===_0xa02f('0x12')&&typeof _0x1aa5c7[_0xa02f('0x13')]===_0xa02f('0x12');var _0x1a05d7=_0x79fa06['count'];var _0x69aa93=_0x52e389?0x0:_0x1aa5c7[_0xa02f('0x14')];var _0x2f7943=_0x52e389?_0x79fa06['count']:_0x1aa5c7['offset']+_0x1aa5c7['limit'];var _0x2279b5;if(_0x2f7943>=_0x1a05d7){_0x2f7943=_0x1a05d7;_0x2279b5=0xc8;}else{_0x2279b5=0xce;}_0x30212b['status'](_0x2279b5);return _0x30212b[_0xa02f('0x15')]('Content-Range',_0x69aa93+'-'+_0x2f7943+'/'+_0x1a05d7)[_0xa02f('0x11')](_0x79fa06);}return null;};}function patchUpdates(_0x448870){return function(_0x4f6d44){try{jsonpatch[_0xa02f('0x16')](_0x4f6d44,_0x448870,!![]);}catch(_0x3b71ae){return BPromise[_0xa02f('0x17')](_0x3b71ae);}return _0x4f6d44['save']();};}function saveUpdates(_0x499de1,_0x12aaf6){return function(_0x5bf878){if(_0x5bf878){return _0x5bf878[_0xa02f('0x18')](_0x499de1)[_0xa02f('0x19')](function(_0x484f7f){return _0x484f7f;});}return null;};}function removeEntity(_0x3e4f2a,_0x564352){return function(_0x53688f){if(_0x53688f){return _0x53688f[_0xa02f('0x1a')]()['then'](function(){_0x3e4f2a[_0xa02f('0x10')](0xcc)[_0xa02f('0x1b')]();});}};}function handleEntityNotFound(_0x295a06,_0x1dc342){return function(_0x5c4e71){if(!_0x5c4e71){_0x295a06['sendStatus'](0x194);}return _0x5c4e71;};}function handleError(_0x541850,_0x5ecb9b){_0x5ecb9b=_0x5ecb9b||0x1f4;return function(_0x48e0df){logger['error'](_0x48e0df[_0xa02f('0x1c')]);if(_0x48e0df[_0xa02f('0x1d')]){delete _0x48e0df[_0xa02f('0x1d')];}_0x541850[_0xa02f('0x10')](_0x5ecb9b)[_0xa02f('0x1e')](_0x48e0df);};}exports[_0xa02f('0x1f')]=function(_0x10b012,_0x51f3dd){var _0x355c19={},_0x20b6cf={},_0x354c61={'count':0x0,'rows':[]};var _0x2635ac=_[_0xa02f('0x20')](db[_0xa02f('0x21')][_0xa02f('0x22')],function(_0x467299){return{'name':_0x467299[_0xa02f('0x23')],'type':_0x467299[_0xa02f('0x24')][_0xa02f('0x25')]};});_0x20b6cf['model']=_[_0xa02f('0x20')](_0x2635ac,_0xa02f('0x1d'));_0x20b6cf[_0xa02f('0x26')]=_[_0xa02f('0x27')](_0x10b012[_0xa02f('0x26')]);_0x20b6cf[_0xa02f('0x28')]=_[_0xa02f('0x29')](_0x20b6cf[_0xa02f('0x2a')],_0x20b6cf['query']);_0x355c19[_0xa02f('0x2b')]=_[_0xa02f('0x29')](_0x20b6cf[_0xa02f('0x2a')],qs[_0xa02f('0x2c')](_0x10b012['query']['fields']));_0x355c19[_0xa02f('0x2b')]=_0x355c19[_0xa02f('0x2b')][_0xa02f('0x2d')]?_0x355c19['attributes']:_0x20b6cf[_0xa02f('0x2a')];if(!_0x10b012[_0xa02f('0x26')][_0xa02f('0x2e')](_0xa02f('0x2f'))){_0x355c19['limit']=qs[_0xa02f('0x13')](_0x10b012[_0xa02f('0x26')][_0xa02f('0x13')]);_0x355c19[_0xa02f('0x14')]=qs[_0xa02f('0x14')](_0x10b012[_0xa02f('0x26')][_0xa02f('0x14')]);}_0x355c19[_0xa02f('0x30')]=qs[_0xa02f('0x31')](_0x10b012[_0xa02f('0x26')][_0xa02f('0x31')]);_0x355c19['where']=qs[_0xa02f('0x28')](_[_0xa02f('0x32')](_0x10b012[_0xa02f('0x26')],_0x20b6cf[_0xa02f('0x28')]),_0x2635ac);if(_0x10b012['query'][_0xa02f('0x33')]){_0x355c19[_0xa02f('0x34')]=_[_0xa02f('0x35')](_0x355c19[_0xa02f('0x34')],{'$or':_[_0xa02f('0x20')](_0x2635ac,function(_0x2c44f3){if(_0x2c44f3['type']!==_0xa02f('0x36')){var _0x1f4fda={};_0x1f4fda[_0x2c44f3[_0xa02f('0x1d')]]={'$like':'%'+_0x10b012['query'][_0xa02f('0x33')]+'%'};return _0x1f4fda;}})});}_0x355c19=_[_0xa02f('0x35')]({},_0x355c19,_0x10b012['options']);var _0x41f3c2={'where':_0x355c19[_0xa02f('0x34')]};return db[_0xa02f('0x21')][_0xa02f('0x37')](_0x41f3c2)[_0xa02f('0x19')](function(_0x1450be){_0x354c61[_0xa02f('0x37')]=_0x1450be;if(_0x10b012[_0xa02f('0x26')][_0xa02f('0x38')]){_0x355c19[_0xa02f('0x39')]=[{'all':!![]}];}return db[_0xa02f('0x21')][_0xa02f('0x3a')](_0x355c19);})[_0xa02f('0x19')](function(_0x52d3d1){_0x354c61[_0xa02f('0x3b')]=_0x52d3d1;return _0x354c61;})[_0xa02f('0x19')](respondWithFilteredResult(_0x51f3dd,_0x355c19))[_0xa02f('0x3c')](handleError(_0x51f3dd,null));};exports[_0xa02f('0x3d')]=function(_0x4dd5d8,_0x271988){var _0x43d409={'raw':!![],'where':{'id':_0x4dd5d8[_0xa02f('0x3e')]['id']}},_0x463dc8={};_0x463dc8[_0xa02f('0x2a')]=_[_0xa02f('0x27')](db['VoiceDialReport'][_0xa02f('0x22')]);_0x463dc8[_0xa02f('0x26')]=_[_0xa02f('0x27')](_0x4dd5d8[_0xa02f('0x26')]);_0x463dc8[_0xa02f('0x28')]=_[_0xa02f('0x29')](_0x463dc8[_0xa02f('0x2a')],_0x463dc8[_0xa02f('0x26')]);_0x43d409[_0xa02f('0x2b')]=_[_0xa02f('0x29')](_0x463dc8[_0xa02f('0x2a')],qs['fields'](_0x4dd5d8[_0xa02f('0x26')][_0xa02f('0x2c')]));_0x43d409[_0xa02f('0x2b')]=_0x43d409[_0xa02f('0x2b')][_0xa02f('0x2d')]?_0x43d409[_0xa02f('0x2b')]:_0x463dc8[_0xa02f('0x2a')];if(_0x4dd5d8[_0xa02f('0x26')][_0xa02f('0x38')]){_0x43d409['include']=[{'all':!![]}];}_0x43d409=_[_0xa02f('0x35')]({},_0x43d409,_0x4dd5d8['options']);return db[_0xa02f('0x21')][_0xa02f('0x3f')](_0x43d409)[_0xa02f('0x19')](handleEntityNotFound(_0x271988,null))['then'](respondWithResult(_0x271988,null))[_0xa02f('0x3c')](handleError(_0x271988,null));};exports[_0xa02f('0x40')]=function(_0x452a7e,_0x33839f){return db[_0xa02f('0x21')][_0xa02f('0x40')](_0x452a7e[_0xa02f('0x41')],{})[_0xa02f('0x19')](respondWithResult(_0x33839f,0xc9))[_0xa02f('0x3c')](handleError(_0x33839f,null));};exports[_0xa02f('0x18')]=function(_0x195cbd,_0x5afdd6){if(_0x195cbd['body']['id']){delete _0x195cbd[_0xa02f('0x41')]['id'];}return db[_0xa02f('0x21')][_0xa02f('0x3f')]({'where':{'id':_0x195cbd[_0xa02f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5afdd6,null))[_0xa02f('0x19')](saveUpdates(_0x195cbd['body'],null))[_0xa02f('0x19')](respondWithResult(_0x5afdd6,null))[_0xa02f('0x3c')](handleError(_0x5afdd6,null));};exports[_0xa02f('0x1a')]=function(_0x1336d0,_0x44eb7a){return db[_0xa02f('0x21')][_0xa02f('0x3f')]({'where':{'id':_0x1336d0['params']['id']}})[_0xa02f('0x19')](handleEntityNotFound(_0x44eb7a,null))[_0xa02f('0x19')](removeEntity(_0x44eb7a,null))[_0xa02f('0x3c')](handleError(_0x44eb7a,null));};exports[_0xa02f('0x42')]=function(_0x35f1a9,_0x49a035){return db[_0xa02f('0x21')][_0xa02f('0x42')]()[_0xa02f('0x19')](respondWithResult(_0x49a035,null))['catch'](handleError(_0x49a035,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 8c33f2b..9919f92 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 _0x0fd8=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfebbb,_0x3416ad){var _0x29abf6=function(_0x5015ab){while(--_0x5015ab){_0xfebbb['push'](_0xfebbb['shift']());}};_0x29abf6(++_0x3416ad);}(_0x0fd8,0x94));var _0x80fd=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0fd8[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x80fd('0x0'));var util=require(_0x80fd('0x1'));var logger=require(_0x80fd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x80fd('0x3'));var rp=require(_0x80fd('0x4'));var fs=require('fs');var path=require(_0x80fd('0x5'));var rimraf=require(_0x80fd('0x6'));var config=require(_0x80fd('0x7'));var attributes=require(_0x80fd('0x8'));module[_0x80fd('0x9')]=function(_0x297d37,_0x29773f){return _0x297d37[_0x80fd('0xa')](_0x80fd('0xb'),attributes,{'tableName':_0x80fd('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xecd5=['bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api'];(function(_0x39ec3b,_0x853748){var _0x104228=function(_0x575224){while(--_0x575224){_0x39ec3b['push'](_0x39ec3b['shift']());}};_0x104228(++_0x853748);}(_0xecd5,0x110));var _0x5ecd=function(_0x2f9ec5,_0x3ea006){_0x2f9ec5=_0x2f9ec5-0x0;var _0x3509c1=_0xecd5[_0x2f9ec5];return _0x3509c1;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var moment=require('moment');var BPromise=require(_0x5ecd('0x3'));var rp=require(_0x5ecd('0x4'));var fs=require('fs');var path=require(_0x5ecd('0x5'));var rimraf=require(_0x5ecd('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ecd('0x7'));module['exports']=function(_0x1ddbad,_0x492eba){return _0x1ddbad['define'](_0x5ecd('0x8'),attributes,{'tableName':_0x5ecd('0x9'),'paranoid':![],'indexes':[{'fields':[_0x5ecd('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 74f2629..c3f59c0 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 _0x10a2=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','raw','catch','update','options','where','attributes','limit','UpdateVoiceDialReport','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x10a2,0x10f));var _0x210a=function(_0x2c5746,_0x4a0015){_0x2c5746=_0x2c5746-0x0;var _0x30ba4a=_0x10a2[_0x2c5746];return _0x30ba4a;};'use strict';var _=require(_0x210a('0x0'));var util=require('util');var moment=require(_0x210a('0x1'));var BPromise=require('bluebird');var rs=require(_0x210a('0x2'));var fs=require('fs');var Redis=require(_0x210a('0x3'));var db=require(_0x210a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x210a('0x5'));var config=require(_0x210a('0x6'));var jayson=require(_0x210a('0x7'));var client=jayson[_0x210a('0x8')][_0x210a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d1a6e,_0x18fca1,_0x23a108){return new BPromise(function(_0x42f955,_0x12eaa8){return client[_0x210a('0xa')](_0x4d1a6e,_0x23a108)[_0x210a('0xb')](function(_0x173d03){logger[_0x210a('0xc')](_0x210a('0xd'),_0x18fca1,_0x210a('0xe'));logger[_0x210a('0xf')](_0x210a('0x10'),_0x18fca1,'request\x20sent',JSON[_0x210a('0x11')](_0x173d03));if(_0x173d03[_0x210a('0x12')]){if(_0x173d03['error'][_0x210a('0x13')]===0x1f4){logger['error'](_0x210a('0xd'),_0x18fca1,_0x173d03[_0x210a('0x12')][_0x210a('0x14')]);return _0x12eaa8(_0x173d03[_0x210a('0x12')]['message']);}logger[_0x210a('0x12')](_0x210a('0xd'),_0x18fca1,_0x173d03[_0x210a('0x12')][_0x210a('0x14')]);return _0x42f955(_0x173d03['error'][_0x210a('0x14')]);}else{logger[_0x210a('0xc')](_0x210a('0xd'),_0x18fca1,'request\x20sent');_0x42f955(_0x173d03[_0x210a('0x15')]['message']);}})['catch'](function(_0x486c88){logger[_0x210a('0x12')](_0x210a('0xd'),_0x18fca1,_0x486c88);_0x12eaa8(_0x486c88);});});}exports[_0x210a('0x16')]=function(_0x9db86c){var _0x5a2589=this;return new Promise(function(_0x39974a,_0x56c716){return db[_0x210a('0x17')][_0x210a('0x18')](_0x9db86c[_0x210a('0x19')],{'raw':_0x9db86c['options']?_0x9db86c['options'][_0x210a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3fcd10){logger['info'](_0x210a('0x16'),_0x9db86c);logger[_0x210a('0xf')](_0x210a('0x16'),_0x9db86c,JSON[_0x210a('0x11')](_0x3fcd10));_0x39974a(_0x3fcd10);})[_0x210a('0x1b')](function(_0x2f0a67){logger['error']('CreateVoiceDialReport',_0x2f0a67[_0x210a('0x14')],_0x9db86c);_0x56c716(_0x5a2589[_0x210a('0x12')](0x1f4,_0x2f0a67[_0x210a('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x344c38){var _0x508a89=this;return new Promise(function(_0x124e4e,_0x26e8a9){return db['VoiceDialReport'][_0x210a('0x1c')](_0x344c38[_0x210a('0x19')],{'raw':_0x344c38[_0x210a('0x1d')]?_0x344c38[_0x210a('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x344c38[_0x210a('0x1d')]?_0x344c38[_0x210a('0x1d')][_0x210a('0x1e')]||null:null,'attributes':_0x344c38[_0x210a('0x1d')]?_0x344c38[_0x210a('0x1d')][_0x210a('0x1f')]||null:null,'limit':_0x344c38[_0x210a('0x1d')]?_0x344c38[_0x210a('0x1d')][_0x210a('0x20')]||null:null})[_0x210a('0xb')](function(_0x59f3c8){logger['info'](_0x210a('0x21'),_0x344c38);logger[_0x210a('0xf')]('UpdateVoiceDialReport',_0x344c38,JSON[_0x210a('0x11')](_0x59f3c8));_0x124e4e(_0x59f3c8);})[_0x210a('0x1b')](function(_0x421cc1){logger['error'](_0x210a('0x21'),_0x421cc1[_0x210a('0x14')],_0x344c38);_0x26e8a9(_0x508a89[_0x210a('0x12')](0x1f4,_0x421cc1[_0x210a('0x14')]));});});}; \ No newline at end of file +var _0x3ef2=['client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceDialReport','create','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x36eeb6,_0x46e22e){var _0x3e9e19=function(_0x488d7c){while(--_0x488d7c){_0x36eeb6['push'](_0x36eeb6['shift']());}};_0x3e9e19(++_0x46e22e);}(_0x3ef2,0x92));var _0x23ef=function(_0x41a736,_0x4e8484){_0x41a736=_0x41a736-0x0;var _0xca88f4=_0x3ef2[_0x41a736];return _0xca88f4;};'use strict';var _=require(_0x23ef('0x0'));var util=require(_0x23ef('0x1'));var moment=require(_0x23ef('0x2'));var BPromise=require(_0x23ef('0x3'));var rs=require(_0x23ef('0x4'));var fs=require('fs');var Redis=require(_0x23ef('0x5'));var db=require(_0x23ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x23ef('0x8'));var client=jayson[_0x23ef('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45ea09,_0x255003,_0x46e77d){return new BPromise(function(_0x3b26d6,_0x1618df){return client[_0x23ef('0xa')](_0x45ea09,_0x46e77d)[_0x23ef('0xb')](function(_0x334457){logger[_0x23ef('0xc')](_0x23ef('0xd'),_0x255003,_0x23ef('0xe'));logger[_0x23ef('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x255003,_0x23ef('0xe'),JSON[_0x23ef('0x10')](_0x334457));if(_0x334457[_0x23ef('0x11')]){if(_0x334457['error'][_0x23ef('0x12')]===0x1f4){logger[_0x23ef('0x11')](_0x23ef('0xd'),_0x255003,_0x334457[_0x23ef('0x11')][_0x23ef('0x13')]);return _0x1618df(_0x334457[_0x23ef('0x11')][_0x23ef('0x13')]);}logger[_0x23ef('0x11')](_0x23ef('0xd'),_0x255003,_0x334457[_0x23ef('0x11')][_0x23ef('0x13')]);return _0x3b26d6(_0x334457[_0x23ef('0x11')][_0x23ef('0x13')]);}else{logger['info'](_0x23ef('0xd'),_0x255003,_0x23ef('0xe'));_0x3b26d6(_0x334457[_0x23ef('0x14')][_0x23ef('0x13')]);}})[_0x23ef('0x15')](function(_0x34a7ec){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x255003,_0x34a7ec);_0x1618df(_0x34a7ec);});});}exports['CreateVoiceDialReport']=function(_0x8e1af5){var _0x274e9=this;return new Promise(function(_0x263db9,_0x14dc17){return db[_0x23ef('0x16')][_0x23ef('0x17')](_0x8e1af5['body'],{'raw':_0x8e1af5[_0x23ef('0x18')]?_0x8e1af5[_0x23ef('0x18')][_0x23ef('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3bb3f6){logger[_0x23ef('0xc')](_0x23ef('0x1a'),_0x8e1af5);logger[_0x23ef('0xf')](_0x23ef('0x1a'),_0x8e1af5,JSON['stringify'](_0x3bb3f6));_0x263db9(_0x3bb3f6);})[_0x23ef('0x15')](function(_0x567446){logger[_0x23ef('0x11')](_0x23ef('0x1a'),_0x567446['message'],_0x8e1af5);_0x14dc17(_0x274e9[_0x23ef('0x11')](0x1f4,_0x567446['message']));});});};exports[_0x23ef('0x1b')]=function(_0x10e5c1){var _0x46557b=this;return new Promise(function(_0xe8353c,_0x38bef5){return db[_0x23ef('0x16')]['update'](_0x10e5c1[_0x23ef('0x1c')],{'raw':_0x10e5c1[_0x23ef('0x18')]?_0x10e5c1[_0x23ef('0x18')][_0x23ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e5c1['options']?_0x10e5c1[_0x23ef('0x18')][_0x23ef('0x1d')]||null:null,'attributes':_0x10e5c1[_0x23ef('0x18')]?_0x10e5c1['options'][_0x23ef('0x1e')]||null:null,'limit':_0x10e5c1['options']?_0x10e5c1['options']['limit']||null:null})['then'](function(_0x4d2f0f){logger[_0x23ef('0xc')](_0x23ef('0x1b'),_0x10e5c1);logger[_0x23ef('0xf')](_0x23ef('0x1b'),_0x10e5c1,JSON[_0x23ef('0x10')](_0x4d2f0f));_0xe8353c(_0x4d2f0f);})[_0x23ef('0x15')](function(_0x576dfe){logger['error'](_0x23ef('0x1b'),_0x576dfe[_0x23ef('0x13')],_0x10e5c1);_0x38bef5(_0x46557b[_0x23ef('0x11')](0x1f4,_0x576dfe[_0x23ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 65a2aba..0c7d552 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 _0x412c=['/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x55f0d9,_0xbaa664){var _0x2a67d1=function(_0x1d6323){while(--_0x1d6323){_0x55f0d9['push'](_0x55f0d9['shift']());}};_0x2a67d1(++_0xbaa664);}(_0x412c,0x17d));var _0xc412=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x412c[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0xc412('0x0'));var util=require(_0xc412('0x1'));var path=require(_0xc412('0x2'));var timeout=require(_0xc412('0x3'));var express=require('express');var router=express[_0xc412('0x4')]();var fs_extra=require(_0xc412('0x5'));var auth=require(_0xc412('0x6'));var interaction=require(_0xc412('0x7'));var config=require(_0xc412('0x8'));var controller=require('./voiceExtension.controller');router[_0xc412('0x9')]('/',auth[_0xc412('0xa')](),controller[_0xc412('0xb')]);router[_0xc412('0x9')](_0xc412('0xc'),auth[_0xc412('0xa')](),controller['show']);router[_0xc412('0xd')]('/',auth[_0xc412('0xa')](),controller[_0xc412('0xe')]);router[_0xc412('0xd')](_0xc412('0xf'),auth[_0xc412('0xa')](),controller[_0xc412('0x10')]);router[_0xc412('0x11')](_0xc412('0xc'),auth[_0xc412('0xa')](),controller[_0xc412('0x12')]);router[_0xc412('0x13')](_0xc412('0xc'),auth['isAuthenticated'](),controller[_0xc412('0x14')]);module[_0xc412('0x15')]=router; \ No newline at end of file +var _0x12de=['/:id','show','post','/:id/applications','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x158068,_0x4b5e25){var _0x510292=function(_0x1d2f62){while(--_0x1d2f62){_0x158068['push'](_0x158068['shift']());}};_0x510292(++_0x4b5e25);}(_0x12de,0x1ec));var _0xe12d=function(_0x4516e2,_0x1d466e){_0x4516e2=_0x4516e2-0x0;var _0x168b13=_0x12de[_0x4516e2];return _0x168b13;};'use strict';var multer=require(_0xe12d('0x0'));var util=require('util');var path=require(_0xe12d('0x1'));var timeout=require(_0xe12d('0x2'));var express=require(_0xe12d('0x3'));var router=express[_0xe12d('0x4')]();var fs_extra=require(_0xe12d('0x5'));var auth=require(_0xe12d('0x6'));var interaction=require(_0xe12d('0x7'));var config=require(_0xe12d('0x8'));var controller=require('./voiceExtension.controller');router[_0xe12d('0x9')]('/',auth[_0xe12d('0xa')](),controller[_0xe12d('0xb')]);router[_0xe12d('0x9')](_0xe12d('0xc'),auth[_0xe12d('0xa')](),controller[_0xe12d('0xd')]);router[_0xe12d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe12d('0xe')](_0xe12d('0xf'),auth['isAuthenticated'](),controller['addApplications']);router['put'](_0xe12d('0xc'),auth[_0xe12d('0xa')](),controller['update']);router['delete'](_0xe12d('0xc'),auth[_0xe12d('0xa')](),controller[_0xe12d('0x10')]);module[_0xe12d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 0e9e911..934b82a 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 _0x556d=['compositeIndex','outbound','internal','outbound-fax','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING'];(function(_0xcf297f,_0x181a2b){var _0x6d418b=function(_0x130042){while(--_0x130042){_0xcf297f['push'](_0xcf297f['shift']());}};_0x6d418b(++_0x181a2b);}(_0x556d,0x1e7));var _0xd556=function(_0x277e83,_0xf3d267){_0x277e83=_0x277e83-0x0;var _0x39f1fb=_0x556d[_0x277e83];return _0x39f1fb;};'use strict';var Sequelize=require(_0xd556('0x0'));module[_0xd556('0x1')]={'context':{'type':Sequelize[_0xd556('0x2')],'allowNull':![],'unique':_0xd556('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd556('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xd556('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xd556('0x3')},'tag':{'type':Sequelize[_0xd556('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xd556('0x4'),_0xd556('0x5'),'inbound-fax',_0xd556('0x6'),'system','any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd556('0x2')],'allowNull':![],'defaultValue':_0xd556('0x7')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xd556('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd556('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd556('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd556('0x9')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xd556('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd556('0xb')],'get':function(_0x822382){return this[_0xd556('0xc')](_0xd556('0xd'));}},'alias':{'type':Sequelize[_0xd556('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4701=['outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax'];(function(_0x35ec01,_0x5c44ac){var _0x4f75d5=function(_0x23ea8f){while(--_0x23ea8f){_0x35ec01['push'](_0x35ec01['shift']());}};_0x4f75d5(++_0x5c44ac);}(_0x4701,0xee));var _0x1470=function(_0xbfc182,_0x591d62){_0xbfc182=_0xbfc182-0x0;var _0x2dc500=_0x4701[_0xbfc182];return _0x2dc500;};'use strict';var Sequelize=require('sequelize');module[_0x1470('0x0')]={'context':{'type':Sequelize[_0x1470('0x1')],'allowNull':![],'unique':_0x1470('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1470('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1470('0x3')},'appdata':{'type':Sequelize[_0x1470('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x1470('0x4')](_0x1470('0x5'),_0x1470('0x6'),_0x1470('0x7'),_0x1470('0x8'),_0x1470('0x9'),_0x1470('0xa'),_0x1470('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x1470('0x1')]},'interval':{'type':Sequelize[_0x1470('0x1')],'allowNull':![],'defaultValue':_0x1470('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x1470('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1470('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1470('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x1470('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1470('0xe')]},'recordingFormat':{'type':Sequelize[_0x1470('0x1')],'defaultValue':_0x1470('0xf')},'answer':{'type':Sequelize[_0x1470('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1470('0x10')],'get':function(_0x549a70){return this[_0x1470('0x11')](_0x1470('0x12'));}},'alias':{'type':Sequelize[_0x1470('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 df50494..1629c58 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 _0xdfe8=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','show','params','length','includeAll','catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','UserProfileResource','destroy','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys'];(function(_0x2aa8c3,_0x2b261b){var _0x3bea84=function(_0x4ce875){while(--_0x4ce875){_0x2aa8c3['push'](_0x2aa8c3['shift']());}};_0x3bea84(++_0x2b261b);}(_0xdfe8,0x8b));var _0x8dfe=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xdfe8[_0x17c483];return _0x112bdb;};'use strict';var _=require(_0x8dfe('0x0'));var Redis=require(_0x8dfe('0x1'));var qs=require(_0x8dfe('0x2'));var logger=require(_0x8dfe('0x3'))('api');var config=require(_0x8dfe('0x4'));var db=require('../../mysqldb')['db'];config[_0x8dfe('0x5')]=_[_0x8dfe('0x6')](config[_0x8dfe('0x5')],{'host':_0x8dfe('0x7'),'port':0x18eb});var socket=require(_0x8dfe('0x8'))(new Redis(config[_0x8dfe('0x5')]));require(_0x8dfe('0x9'))[_0x8dfe('0xa')](socket);function respondWithStatusCode(_0x5a271c,_0x2e938d){_0x2e938d=_0x2e938d||0xcc;return function(_0x361df0){if(_0x361df0){return _0x5a271c[_0x8dfe('0xb')](_0x2e938d);}return _0x5a271c[_0x8dfe('0xc')](_0x2e938d)[_0x8dfe('0xd')]();};}function respondWithResult(_0x2803eb,_0x1c4e7e){_0x1c4e7e=_0x1c4e7e||0xc8;return function(_0x56a36e){if(_0x56a36e){return _0x2803eb[_0x8dfe('0xc')](_0x1c4e7e)[_0x8dfe('0xe')](_0x56a36e);}};}function respondWithFilteredResult(_0x23466f,_0x50e8d7){return function(_0x41583a){if(_0x41583a){var _0x878553=typeof _0x50e8d7[_0x8dfe('0xf')]===_0x8dfe('0x10')&&typeof _0x50e8d7[_0x8dfe('0x11')]==='undefined';var _0x53d166=_0x41583a[_0x8dfe('0x12')];var _0xa0e8e1=_0x878553?0x0:_0x50e8d7['offset'];var _0x2a2dd7=_0x878553?_0x41583a[_0x8dfe('0x12')]:_0x50e8d7[_0x8dfe('0xf')]+_0x50e8d7[_0x8dfe('0x11')];var _0x249adc;if(_0x2a2dd7>=_0x53d166){_0x2a2dd7=_0x53d166;_0x249adc=0xc8;}else{_0x249adc=0xce;}_0x23466f[_0x8dfe('0xc')](_0x249adc);return _0x23466f[_0x8dfe('0x13')](_0x8dfe('0x14'),_0xa0e8e1+'-'+_0x2a2dd7+'/'+_0x53d166)[_0x8dfe('0xe')](_0x41583a);}return null;};}function removeEntity(_0x201279){return function(_0x48e304){if(_0x48e304){return _0x48e304['destroy']()[_0x8dfe('0x15')](function(){var _0x55c7e8=_0x48e304[_0x8dfe('0x16')]({'plain':!![]});var _0x39b3b1=[{'name':_0x8dfe('0x17'),'value':_0x8dfe('0x18'),'ignore':![]},{'name':_0x8dfe('0x19'),'value':_0x8dfe('0x1a'),'ignore':![]},{'name':_0x8dfe('0x1b'),'value':_0x8dfe('0x1c'),'ignore':![]}];var _0x436c8e=_(_0x39b3b1)[_0x8dfe('0x1d')](_0x8dfe('0x1e'))[_0x8dfe('0x1f')](_0x8dfe('0x20'))['value']();if(_[_0x8dfe('0x21')](_0x436c8e,_0x55c7e8['type'])){return;}var _0x4c453e=_[_0x8dfe('0x22')](_0x39b3b1,['value',_0x55c7e8[_0x8dfe('0x23')]])['name'];return db[_0x8dfe('0x24')][_0x8dfe('0x25')]({'where':{'type':_0x4c453e,'resourceId':_0x55c7e8['id']}})[_0x8dfe('0x15')](function(){return _0x48e304;});})[_0x8dfe('0x15')](function(){_0x201279['status'](0xcc)[_0x8dfe('0xd')]();});}};}function handleEntityNotFound(_0x3274ca){return function(_0x5391dd){if(!_0x5391dd){_0x3274ca[_0x8dfe('0xb')](0x194);}return _0x5391dd;};}function handleError(_0x368dd6,_0x1a678f){_0x1a678f=_0x1a678f||0x1f4;return function(_0x1895fe){logger[_0x8dfe('0x26')](_0x1895fe[_0x8dfe('0x27')]);if(_0x1895fe[_0x8dfe('0x28')]){delete _0x1895fe[_0x8dfe('0x28')];}_0x368dd6[_0x8dfe('0xc')](_0x1a678f)[_0x8dfe('0x29')](_0x1895fe);};}exports[_0x8dfe('0x2a')]=function(_0x2c0598,_0x3a3e7a){var _0x1a9673={},_0x4ed4fe={},_0x314597={'count':0x0,'rows':[]};var _0x1d94cf=_[_0x8dfe('0x1f')](db[_0x8dfe('0x2b')][_0x8dfe('0x2c')],function(_0x4f3efa){return{'name':_0x4f3efa[_0x8dfe('0x2d')],'type':_0x4f3efa[_0x8dfe('0x23')]['key']};});_0x4ed4fe[_0x8dfe('0x2e')]=_[_0x8dfe('0x1f')](_0x1d94cf,_0x8dfe('0x28'));_0x4ed4fe[_0x8dfe('0x2f')]=_[_0x8dfe('0x30')](_0x2c0598['query']);_0x4ed4fe[_0x8dfe('0x31')]=_['intersection'](_0x4ed4fe[_0x8dfe('0x2e')],_0x4ed4fe[_0x8dfe('0x2f')]);_0x1a9673['attributes']=_[_0x8dfe('0x32')](_0x4ed4fe[_0x8dfe('0x2e')],qs[_0x8dfe('0x33')](_0x2c0598[_0x8dfe('0x2f')][_0x8dfe('0x33')]));_0x1a9673['attributes']=_0x1a9673[_0x8dfe('0x34')]['length']?_0x1a9673[_0x8dfe('0x34')]:_0x4ed4fe[_0x8dfe('0x2e')];if(!_0x2c0598[_0x8dfe('0x2f')][_0x8dfe('0x35')](_0x8dfe('0x36'))){_0x1a9673[_0x8dfe('0x11')]=qs['limit'](_0x2c0598['query']['limit']);_0x1a9673[_0x8dfe('0xf')]=qs[_0x8dfe('0xf')](_0x2c0598[_0x8dfe('0x2f')][_0x8dfe('0xf')]);}_0x1a9673[_0x8dfe('0x37')]=qs[_0x8dfe('0x38')](_0x2c0598[_0x8dfe('0x2f')][_0x8dfe('0x38')]);_0x1a9673[_0x8dfe('0x39')]=qs[_0x8dfe('0x31')](_[_0x8dfe('0x3a')](_0x2c0598[_0x8dfe('0x2f')],_0x4ed4fe['filters']),_0x1d94cf);if(_0x2c0598[_0x8dfe('0x2f')][_0x8dfe('0x1d')]){_0x1a9673[_0x8dfe('0x39')]=_[_0x8dfe('0x3b')](_0x1a9673[_0x8dfe('0x39')],{'$or':_[_0x8dfe('0x1f')](_0x1d94cf,function(_0x551765){if(_0x551765[_0x8dfe('0x23')]!==_0x8dfe('0x3c')){var _0x334d3e={};_0x334d3e[_0x551765[_0x8dfe('0x28')]]={'$like':'%'+_0x2c0598['query'][_0x8dfe('0x1d')]+'%'};return _0x334d3e;}})});}_0x1a9673=_[_0x8dfe('0x3b')]({},_0x1a9673,_0x2c0598[_0x8dfe('0x3d')]);var _0x244964={'where':_0x1a9673[_0x8dfe('0x39')]};return db[_0x8dfe('0x2b')][_0x8dfe('0x12')](_0x244964)[_0x8dfe('0x15')](function(_0x431d39){_0x314597['count']=_0x431d39;if(_0x2c0598[_0x8dfe('0x2f')]['includeAll']){_0x1a9673['include']=[{'all':!![]}];}return db[_0x8dfe('0x2b')][_0x8dfe('0x3e')](_0x1a9673);})['then'](function(_0x59b79e){_0x314597['rows']=_0x59b79e;return _0x314597;})['then'](respondWithFilteredResult(_0x3a3e7a,_0x1a9673))['catch'](handleError(_0x3a3e7a,null));};exports[_0x8dfe('0x3f')]=function(_0x41ad3a,_0x18fad7){var _0x316c48={'raw':![],'where':{'id':_0x41ad3a[_0x8dfe('0x40')]['id']}},_0x58c7a6={};_0x58c7a6[_0x8dfe('0x2e')]=_[_0x8dfe('0x30')](db[_0x8dfe('0x2b')]['rawAttributes']);_0x58c7a6[_0x8dfe('0x2f')]=_[_0x8dfe('0x30')](_0x41ad3a['query']);_0x58c7a6['filters']=_[_0x8dfe('0x32')](_0x58c7a6[_0x8dfe('0x2e')],_0x58c7a6[_0x8dfe('0x2f')]);_0x316c48[_0x8dfe('0x34')]=_[_0x8dfe('0x32')](_0x58c7a6[_0x8dfe('0x2e')],qs['fields'](_0x41ad3a[_0x8dfe('0x2f')]['fields']));_0x316c48[_0x8dfe('0x34')]=_0x316c48[_0x8dfe('0x34')][_0x8dfe('0x41')]?_0x316c48[_0x8dfe('0x34')]:_0x58c7a6[_0x8dfe('0x2e')];if(_0x41ad3a[_0x8dfe('0x2f')][_0x8dfe('0x42')]){_0x316c48['include']=[{'all':!![]}];}_0x316c48=_[_0x8dfe('0x3b')]({},_0x316c48,_0x41ad3a[_0x8dfe('0x3d')]);return db[_0x8dfe('0x2b')][_0x8dfe('0x22')](_0x316c48)[_0x8dfe('0x15')](handleEntityNotFound(_0x18fad7,null))[_0x8dfe('0x15')](respondWithResult(_0x18fad7,null))[_0x8dfe('0x43')](handleError(_0x18fad7,null));};exports[_0x8dfe('0x25')]=function(_0x271850,_0x3e3cc8){return db['VoiceExtension']['find']({'where':{'id':_0x271850[_0x8dfe('0x40')]['id']}})[_0x8dfe('0x15')](handleEntityNotFound(_0x3e3cc8,null))[_0x8dfe('0x15')](removeEntity(_0x3e3cc8,null))[_0x8dfe('0x43')](handleError(_0x3e3cc8,null));};exports[_0x8dfe('0x44')]=function(_0xdc5066,_0x40e1ac){if(_0xdc5066[_0x8dfe('0x45')]['type']===_0x8dfe('0x1a')&&!_[_0x8dfe('0x46')](_0xdc5066[_0x8dfe('0x45')]['exten'],'_')){_0xdc5066['body'][_0x8dfe('0x47')]='_'[_0x8dfe('0x48')](_0xdc5066[_0x8dfe('0x45')]['exten']);}return db['VoiceExtension'][_0x8dfe('0x44')](_0xdc5066[_0x8dfe('0x45')],{'raw':![]})['then'](function(_0x23f7cd){var _0x134a2a=_0xdc5066[_0x8dfe('0x49')][_0x8dfe('0x16')]({'plain':!![]});if(!_0x134a2a)throw new Error(_0x8dfe('0x4a'));if(_0x134a2a[_0x8dfe('0x4b')]===_0x8dfe('0x49')){var _0x150f4c=_0x23f7cd[_0x8dfe('0x16')]({'plain':!![]});var _0x251284=[{'name':_0x8dfe('0x17'),'value':_0x8dfe('0x18')},{'name':_0x8dfe('0x19'),'value':_0x8dfe('0x1a')},{'name':'InternalRoutes','value':'internal'}];var _0xb0bbdd=_[_0x8dfe('0x22')](_0x251284,[_0x8dfe('0x20'),_0x150f4c['type']])[_0x8dfe('0x28')];return db[_0x8dfe('0x4c')][_0x8dfe('0x22')]({'where':{'name':_0xb0bbdd,'userProfileId':_0x134a2a['userProfileId']},'raw':!![]})[_0x8dfe('0x15')](function(_0x5dc33e){if(_0x5dc33e&&_0x5dc33e[_0x8dfe('0x4d')]===0x0){return db[_0x8dfe('0x24')][_0x8dfe('0x44')]({'name':_0x150f4c[_0x8dfe('0x28')],'resourceId':_0x150f4c['id'],'type':_0x5dc33e['name'],'sectionId':_0x5dc33e['id']},{})[_0x8dfe('0x15')](function(){return _0x23f7cd;});}else{return _0x23f7cd;}})[_0x8dfe('0x43')](function(_0x57c039){logger[_0x8dfe('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57c039);throw _0x57c039;});}return _0x23f7cd;})[_0x8dfe('0x15')](respondWithResult(_0x40e1ac,0xc9))[_0x8dfe('0x43')](handleError(_0x40e1ac,null));};exports['update']=function(_0x369627,_0x3d4a69){if(_0x369627['body']['id']){delete _0x369627[_0x8dfe('0x45')]['id'];}return db['VoiceExtension'][_0x8dfe('0x22')]({'where':{'id':_0x369627[_0x8dfe('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d4a69,null))[_0x8dfe('0x15')](function(_0x2b0287){if(_0x2b0287){return db['VoiceExtension'][_0x8dfe('0x4e')](_['pick'](_0x369627['body'],['exten',_0x8dfe('0x4f'),'description',_0x8dfe('0x50'),_0x8dfe('0x51'),_0x8dfe('0x52'),'alias']),{'where':{'context':_0x2b0287[_0x8dfe('0x4f')],'exten':_0x2b0287[_0x8dfe('0x47')]},'individualHooks':!![]})[_0x8dfe('0x15')](function(_0x386203){return _0x386203;});}return null;})[_0x8dfe('0x15')](respondWithStatusCode(_0x3d4a69,null))[_0x8dfe('0x43')](handleError(_0x3d4a69,null));};exports[_0x8dfe('0x53')]=function(_0x435c70,_0x398341){var _0x2d9f9f=_0x435c70[_0x8dfe('0x40')]['id'];var _0x25ad89=_0x435c70[_0x8dfe('0x45')];var _0x21677f=0xc8;var _0x138b0b=null;return db[_0x8dfe('0x54')][_0x8dfe('0x55')]({'isolationLevel':db[_0x8dfe('0x54')]['Transaction']['ISOLATION_LEVELS'][_0x8dfe('0x56')]},function(_0x37887b){return db[_0x8dfe('0x2b')][_0x8dfe('0x57')]({'where':{'id':_0x2d9f9f},'transaction':_0x37887b})[_0x8dfe('0x15')](function(_0x37abd7){if(_0x37abd7){return db[_0x8dfe('0x2b')]['destroy']({'where':{'VoiceExtensionId':_0x2d9f9f},'transaction':_0x37887b})[_0x8dfe('0x15')](function(){var _0x256158=_[_0x8dfe('0x1f')](_0x25ad89,function(_0x2f8233){_0x2f8233[_0x8dfe('0x58')]=_0x2d9f9f;_0x2f8233[_0x8dfe('0x59')]=!![];return _0x2f8233;});return _0x37abd7[_0x8dfe('0x5a')](_0x256158);})[_0x8dfe('0x15')](function(_0x51fdea){return db[_0x8dfe('0x2b')][_0x8dfe('0x5b')](_0x51fdea,{'transaction':_0x37887b});});}else{_0x21677f=0x194;_0x138b0b=[];}});})[_0x8dfe('0x15')](function(){if(_0x21677f!==0x194){return db[_0x8dfe('0x2b')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2d9f9f},'order':_0x8dfe('0x5c')})['then'](function(_0x2ebee2){_0x138b0b=_0x2ebee2;});}})[_0x8dfe('0x43')](function(_0x14713e){_0x21677f=0x1f4;logger[_0x8dfe('0x26')](_0x14713e['stack']);if(_0x14713e['name']){delete _0x14713e[_0x8dfe('0x28')];}_0x138b0b=_0x14713e;})[_0x8dfe('0x5d')](function(){if(_0x138b0b===null){_0x398341[_0x8dfe('0xb')](_0x21677f);}else{if(_0x21677f===0x1f4){_0x398341[_0x8dfe('0xc')](_0x21677f)['send'](_0x138b0b);}else{_0x398341[_0x8dfe('0xc')](_0x21677f)[_0x8dfe('0xe')](_0x138b0b);}}});}; \ No newline at end of file +var _0x3c37=['register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','type','find','UserProfileResource','stack','name','send','VoiceExtension','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','startsWith','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','./voiceExtension.socket'];(function(_0x74902c,_0x3ba41f){var _0x57aaf3=function(_0x36d726){while(--_0x36d726){_0x74902c['push'](_0x74902c['shift']());}};_0x57aaf3(++_0x3ba41f);}(_0x3c37,0x178));var _0x73c3=function(_0x1276f0,_0x2eaec8){_0x1276f0=_0x1276f0-0x0;var _0x400d8a=_0x3c37[_0x1276f0];return _0x400d8a;};'use strict';var _=require(_0x73c3('0x0'));var Redis=require(_0x73c3('0x1'));var qs=require(_0x73c3('0x2'));var logger=require(_0x73c3('0x3'))('api');var config=require('../../config/environment');var db=require(_0x73c3('0x4'))['db'];config[_0x73c3('0x5')]=_['defaults'](config[_0x73c3('0x5')],{'host':_0x73c3('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73c3('0x5')]));require(_0x73c3('0x7'))[_0x73c3('0x8')](socket);function respondWithStatusCode(_0x5eb476,_0x35836a){_0x35836a=_0x35836a||0xcc;return function(_0x20b5a6){if(_0x20b5a6){return _0x5eb476[_0x73c3('0x9')](_0x35836a);}return _0x5eb476[_0x73c3('0xa')](_0x35836a)['end']();};}function respondWithResult(_0x540847,_0x1d442f){_0x1d442f=_0x1d442f||0xc8;return function(_0x405656){if(_0x405656){return _0x540847[_0x73c3('0xa')](_0x1d442f)[_0x73c3('0xb')](_0x405656);}};}function respondWithFilteredResult(_0x4046d5,_0x387254){return function(_0x45fcbf){if(_0x45fcbf){var _0x39c397=typeof _0x387254['offset']===_0x73c3('0xc')&&typeof _0x387254[_0x73c3('0xd')]===_0x73c3('0xc');var _0x341cd9=_0x45fcbf[_0x73c3('0xe')];var _0x379e4b=_0x39c397?0x0:_0x387254[_0x73c3('0xf')];var _0xb8918=_0x39c397?_0x45fcbf[_0x73c3('0xe')]:_0x387254[_0x73c3('0xf')]+_0x387254[_0x73c3('0xd')];var _0x4e27ec;if(_0xb8918>=_0x341cd9){_0xb8918=_0x341cd9;_0x4e27ec=0xc8;}else{_0x4e27ec=0xce;}_0x4046d5[_0x73c3('0xa')](_0x4e27ec);return _0x4046d5[_0x73c3('0x10')](_0x73c3('0x11'),_0x379e4b+'-'+_0xb8918+'/'+_0x341cd9)['json'](_0x45fcbf);}return null;};}function removeEntity(_0x59fa1e){return function(_0x5e7060){if(_0x5e7060){return _0x5e7060[_0x73c3('0x12')]()[_0x73c3('0x13')](function(){var _0x4c3a46=_0x5e7060['get']({'plain':!![]});var _0x4d26e6=[{'name':_0x73c3('0x14'),'value':_0x73c3('0x15'),'ignore':![]},{'name':_0x73c3('0x16'),'value':_0x73c3('0x17'),'ignore':![]},{'name':_0x73c3('0x18'),'value':_0x73c3('0x19'),'ignore':![]}];var _0x48b56f=_(_0x4d26e6)['filter'](_0x73c3('0x1a'))[_0x73c3('0x1b')](_0x73c3('0x1c'))[_0x73c3('0x1c')]();if(_['includes'](_0x48b56f,_0x4c3a46[_0x73c3('0x1d')])){return;}var _0xa71808=_[_0x73c3('0x1e')](_0x4d26e6,[_0x73c3('0x1c'),_0x4c3a46[_0x73c3('0x1d')]])['name'];return db[_0x73c3('0x1f')][_0x73c3('0x12')]({'where':{'type':_0xa71808,'resourceId':_0x4c3a46['id']}})[_0x73c3('0x13')](function(){return _0x5e7060;});})[_0x73c3('0x13')](function(){_0x59fa1e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3104e0){return function(_0x3d0f55){if(!_0x3d0f55){_0x3104e0[_0x73c3('0x9')](0x194);}return _0x3d0f55;};}function handleError(_0x405c60,_0x75b339){_0x75b339=_0x75b339||0x1f4;return function(_0x39cd97){logger['error'](_0x39cd97[_0x73c3('0x20')]);if(_0x39cd97[_0x73c3('0x21')]){delete _0x39cd97['name'];}_0x405c60[_0x73c3('0xa')](_0x75b339)[_0x73c3('0x22')](_0x39cd97);};}exports['index']=function(_0x5d2588,_0x5878a5){var _0x508779={},_0x3cb57c={},_0x681529={'count':0x0,'rows':[]};var _0x2793f6=_['map'](db[_0x73c3('0x23')][_0x73c3('0x24')],function(_0x3f81c7){return{'name':_0x3f81c7[_0x73c3('0x25')],'type':_0x3f81c7[_0x73c3('0x1d')][_0x73c3('0x26')]};});_0x3cb57c[_0x73c3('0x27')]=_[_0x73c3('0x1b')](_0x2793f6,_0x73c3('0x21'));_0x3cb57c['query']=_['keys'](_0x5d2588[_0x73c3('0x28')]);_0x3cb57c['filters']=_[_0x73c3('0x29')](_0x3cb57c['model'],_0x3cb57c['query']);_0x508779['attributes']=_['intersection'](_0x3cb57c[_0x73c3('0x27')],qs['fields'](_0x5d2588['query'][_0x73c3('0x2a')]));_0x508779[_0x73c3('0x2b')]=_0x508779['attributes'][_0x73c3('0x2c')]?_0x508779['attributes']:_0x3cb57c['model'];if(!_0x5d2588[_0x73c3('0x28')][_0x73c3('0x2d')](_0x73c3('0x2e'))){_0x508779[_0x73c3('0xd')]=qs[_0x73c3('0xd')](_0x5d2588[_0x73c3('0x28')]['limit']);_0x508779['offset']=qs['offset'](_0x5d2588[_0x73c3('0x28')][_0x73c3('0xf')]);}_0x508779[_0x73c3('0x2f')]=qs[_0x73c3('0x30')](_0x5d2588[_0x73c3('0x28')]['sort']);_0x508779['where']=qs[_0x73c3('0x31')](_[_0x73c3('0x32')](_0x5d2588[_0x73c3('0x28')],_0x3cb57c['filters']),_0x2793f6);if(_0x5d2588[_0x73c3('0x28')][_0x73c3('0x33')]){_0x508779[_0x73c3('0x34')]=_[_0x73c3('0x35')](_0x508779[_0x73c3('0x34')],{'$or':_[_0x73c3('0x1b')](_0x2793f6,function(_0x41ff68){if(_0x41ff68[_0x73c3('0x1d')]!==_0x73c3('0x36')){var _0x5f137c={};_0x5f137c[_0x41ff68['name']]={'$like':'%'+_0x5d2588[_0x73c3('0x28')][_0x73c3('0x33')]+'%'};return _0x5f137c;}})});}_0x508779=_[_0x73c3('0x35')]({},_0x508779,_0x5d2588[_0x73c3('0x37')]);var _0x3bbbc4={'where':_0x508779['where']};return db[_0x73c3('0x23')]['count'](_0x3bbbc4)[_0x73c3('0x13')](function(_0x2e3203){_0x681529['count']=_0x2e3203;if(_0x5d2588[_0x73c3('0x28')][_0x73c3('0x38')]){_0x508779[_0x73c3('0x39')]=[{'all':!![]}];}return db[_0x73c3('0x23')][_0x73c3('0x3a')](_0x508779);})['then'](function(_0x54280d){_0x681529[_0x73c3('0x3b')]=_0x54280d;return _0x681529;})[_0x73c3('0x13')](respondWithFilteredResult(_0x5878a5,_0x508779))[_0x73c3('0x3c')](handleError(_0x5878a5,null));};exports[_0x73c3('0x3d')]=function(_0xd6b41b,_0x25e13c){var _0x5b06dc={'raw':![],'where':{'id':_0xd6b41b[_0x73c3('0x3e')]['id']}},_0x1c98e6={};_0x1c98e6[_0x73c3('0x27')]=_['keys'](db[_0x73c3('0x23')][_0x73c3('0x24')]);_0x1c98e6['query']=_[_0x73c3('0x3f')](_0xd6b41b[_0x73c3('0x28')]);_0x1c98e6['filters']=_[_0x73c3('0x29')](_0x1c98e6[_0x73c3('0x27')],_0x1c98e6[_0x73c3('0x28')]);_0x5b06dc[_0x73c3('0x2b')]=_[_0x73c3('0x29')](_0x1c98e6[_0x73c3('0x27')],qs[_0x73c3('0x2a')](_0xd6b41b[_0x73c3('0x28')][_0x73c3('0x2a')]));_0x5b06dc[_0x73c3('0x2b')]=_0x5b06dc[_0x73c3('0x2b')][_0x73c3('0x2c')]?_0x5b06dc[_0x73c3('0x2b')]:_0x1c98e6[_0x73c3('0x27')];if(_0xd6b41b[_0x73c3('0x28')]['includeAll']){_0x5b06dc[_0x73c3('0x39')]=[{'all':!![]}];}_0x5b06dc=_['merge']({},_0x5b06dc,_0xd6b41b[_0x73c3('0x37')]);return db[_0x73c3('0x23')][_0x73c3('0x1e')](_0x5b06dc)[_0x73c3('0x13')](handleEntityNotFound(_0x25e13c,null))[_0x73c3('0x13')](respondWithResult(_0x25e13c,null))[_0x73c3('0x3c')](handleError(_0x25e13c,null));};exports[_0x73c3('0x12')]=function(_0x549d15,_0x195a5a){return db[_0x73c3('0x23')][_0x73c3('0x1e')]({'where':{'id':_0x549d15[_0x73c3('0x3e')]['id']}})[_0x73c3('0x13')](handleEntityNotFound(_0x195a5a,null))[_0x73c3('0x13')](removeEntity(_0x195a5a,null))['catch'](handleError(_0x195a5a,null));};exports[_0x73c3('0x40')]=function(_0x3bf49a,_0x1cf988){if(_0x3bf49a[_0x73c3('0x41')][_0x73c3('0x1d')]===_0x73c3('0x17')&&!_[_0x73c3('0x42')](_0x3bf49a['body']['exten'],'_')){_0x3bf49a[_0x73c3('0x41')]['exten']='_'[_0x73c3('0x43')](_0x3bf49a[_0x73c3('0x41')]['exten']);}return db[_0x73c3('0x23')][_0x73c3('0x40')](_0x3bf49a['body'],{'raw':![]})[_0x73c3('0x13')](function(_0x20b0bd){var _0x7635f0=_0x3bf49a[_0x73c3('0x44')][_0x73c3('0x45')]({'plain':!![]});if(!_0x7635f0)throw new Error(_0x73c3('0x46'));if(_0x7635f0[_0x73c3('0x47')]===_0x73c3('0x44')){var _0x3a6bdd=_0x20b0bd[_0x73c3('0x45')]({'plain':!![]});var _0x265a98=[{'name':'InboundRoutes','value':_0x73c3('0x15')},{'name':'OutboundRoutes','value':_0x73c3('0x17')},{'name':'InternalRoutes','value':'internal'}];var _0x4e3127=_[_0x73c3('0x1e')](_0x265a98,[_0x73c3('0x1c'),_0x3a6bdd[_0x73c3('0x1d')]])['name'];return db[_0x73c3('0x48')][_0x73c3('0x1e')]({'where':{'name':_0x4e3127,'userProfileId':_0x7635f0[_0x73c3('0x49')]},'raw':!![]})[_0x73c3('0x13')](function(_0x2e804d){if(_0x2e804d&&_0x2e804d[_0x73c3('0x4a')]===0x0){return db[_0x73c3('0x1f')][_0x73c3('0x40')]({'name':_0x3a6bdd[_0x73c3('0x21')],'resourceId':_0x3a6bdd['id'],'type':_0x2e804d[_0x73c3('0x21')],'sectionId':_0x2e804d['id']},{})[_0x73c3('0x13')](function(){return _0x20b0bd;});}else{return _0x20b0bd;}})['catch'](function(_0x24e2bd){logger[_0x73c3('0x4b')](_0x73c3('0x4c'),_0x24e2bd);throw _0x24e2bd;});}return _0x20b0bd;})['then'](respondWithResult(_0x1cf988,0xc9))[_0x73c3('0x3c')](handleError(_0x1cf988,null));};exports['update']=function(_0x45b0ec,_0x36ba5e){if(_0x45b0ec[_0x73c3('0x41')]['id']){delete _0x45b0ec[_0x73c3('0x41')]['id'];}return db['VoiceExtension'][_0x73c3('0x1e')]({'where':{'id':_0x45b0ec['params']['id']}})[_0x73c3('0x13')](handleEntityNotFound(_0x36ba5e,null))[_0x73c3('0x13')](function(_0x41323d){if(_0x41323d){return db['VoiceExtension']['update'](_[_0x73c3('0x32')](_0x45b0ec[_0x73c3('0x41')],[_0x73c3('0x4d'),_0x73c3('0x4e'),_0x73c3('0x4f'),_0x73c3('0x50'),_0x73c3('0x51'),_0x73c3('0x52'),_0x73c3('0x53')]),{'where':{'context':_0x41323d[_0x73c3('0x4e')],'exten':_0x41323d[_0x73c3('0x4d')]},'individualHooks':!![]})[_0x73c3('0x13')](function(_0x4f8eda){return _0x4f8eda;});}return null;})[_0x73c3('0x13')](respondWithStatusCode(_0x36ba5e,null))['catch'](handleError(_0x36ba5e,null));};exports['addApplications']=function(_0x1e23ec,_0x5e228b){var _0x5ce485=_0x1e23ec[_0x73c3('0x3e')]['id'];var _0x1b3729=_0x1e23ec[_0x73c3('0x41')];var _0x306a3a=0xc8;var _0x190b51=null;return db[_0x73c3('0x54')][_0x73c3('0x55')]({'isolationLevel':db['sequelize'][_0x73c3('0x56')][_0x73c3('0x57')][_0x73c3('0x58')]},function(_0x27e97){return db[_0x73c3('0x23')][_0x73c3('0x59')]({'where':{'id':_0x5ce485},'transaction':_0x27e97})[_0x73c3('0x13')](function(_0x1a3e81){if(_0x1a3e81){return db[_0x73c3('0x23')][_0x73c3('0x12')]({'where':{'VoiceExtensionId':_0x5ce485},'transaction':_0x27e97})[_0x73c3('0x13')](function(){var _0x50e908=_[_0x73c3('0x1b')](_0x1b3729,function(_0x532f15){_0x532f15[_0x73c3('0x5a')]=_0x5ce485;_0x532f15[_0x73c3('0x5b')]=!![];return _0x532f15;});return _0x1a3e81[_0x73c3('0x5c')](_0x50e908);})['then'](function(_0x2aa317){return db[_0x73c3('0x23')][_0x73c3('0x5d')](_0x2aa317,{'transaction':_0x27e97});});}else{_0x306a3a=0x194;_0x190b51=[];}});})['then'](function(){if(_0x306a3a!==0x194){return db[_0x73c3('0x23')][_0x73c3('0x5e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5ce485},'order':_0x73c3('0x5f')})[_0x73c3('0x13')](function(_0x1d5985){_0x190b51=_0x1d5985;});}})[_0x73c3('0x3c')](function(_0x280b0a){_0x306a3a=0x1f4;logger[_0x73c3('0x4b')](_0x280b0a[_0x73c3('0x20')]);if(_0x280b0a[_0x73c3('0x21')]){delete _0x280b0a[_0x73c3('0x21')];}_0x190b51=_0x280b0a;})['finally'](function(){if(_0x190b51===null){_0x5e228b[_0x73c3('0x9')](_0x306a3a);}else{if(_0x306a3a===0x1f4){_0x5e228b[_0x73c3('0xa')](_0x306a3a)[_0x73c3('0x22')](_0x190b51);}else{_0x5e228b[_0x73c3('0xa')](_0x306a3a)[_0x73c3('0xb')](_0x190b51);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5cf2f62..68430ef 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 _0xdb85=['VoiceExtension','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2ff476,_0x45252a){var _0x3b6ae2=function(_0x5a3657){while(--_0x5a3657){_0x2ff476['push'](_0x2ff476['shift']());}};_0x3b6ae2(++_0x45252a);}(_0xdb85,0x116));var _0x5db8=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0xdb85[_0x2b8722];return _0x20c180;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x5db8('0x0'))['db'][_0x5db8('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5db8('0x2'),'afterUpdate':_0x5db8('0x3'),'afterDestroy':_0x5db8('0x4')};function emitEvent(_0x342603){return function(_0x309762,_0x35a3ec,_0x14ef5a){VoiceExtensionEvents[_0x5db8('0x5')](_0x342603+':'+_0x309762['id'],_0x309762);VoiceExtensionEvents[_0x5db8('0x5')](_0x342603,_0x309762);_0x14ef5a(null);};}for(var e in events){if(events[_0x5db8('0x6')](e)){var event=events[e];VoiceExtension[_0x5db8('0x7')](e,emitEvent(event));}}module[_0x5db8('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xaa3a=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xaa3a,0x138));var _0xaaa3=function(_0x5a0cb2,_0x43a6e4){_0x5a0cb2=_0x5a0cb2-0x0;var _0x32b526=_0xaa3a[_0x5a0cb2];return _0x32b526;};'use strict';var EventEmitter=require(_0xaaa3('0x0'));var VoiceExtension=require(_0xaaa3('0x1'))['db'][_0xaaa3('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xaaa3('0x3')](0x0);var events={'afterCreate':_0xaaa3('0x4'),'afterUpdate':'update','afterDestroy':_0xaaa3('0x5')};function emitEvent(_0x49ff5a){return function(_0x7cb255,_0x3d22d1,_0x2b1951){VoiceExtensionEvents['emit'](_0x49ff5a+':'+_0x7cb255['id'],_0x7cb255);VoiceExtensionEvents[_0xaaa3('0x6')](_0x49ff5a,_0x7cb255);_0x2b1951(null);};}for(var e in events){if(events[_0xaaa3('0x7')](e)){var event=events[e];VoiceExtension[_0xaaa3('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 4bb73aa..c035c51 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 _0x9946=['recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','param','split','phone','prefix','join','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','agi','priority','concat','last','define','VoiceExtension','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten','alias','Set','NoOp','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty'];(function(_0x58bdfe,_0x40894d){var _0x52279c=function(_0x2d6cb4){while(--_0x2d6cb4){_0x58bdfe['push'](_0x58bdfe['shift']());}};_0x52279c(++_0x40894d);}(_0x9946,0x82));var _0x6994=function(_0x383820,_0x19f933){_0x383820=_0x383820-0x0;var _0x3e3baa=_0x9946[_0x383820];return _0x3e3baa;};'use strict';var _=require(_0x6994('0x0'));var attributes=require(_0x6994('0x1'));module[_0x6994('0x2')]=function(_0x4820f1){var _0x2a7ae7=_0x4820f1[_0x6994('0x3')];function _0x52136b(_0x52472d){var _0x57610d=0x2;var _0x15c588=[{'type':_0x52472d[_0x6994('0x4')],'app':'Set','appdata':_0x6994('0x5')+_0x52472d[_0x6994('0x4')],'context':_0x52472d[_0x6994('0x6')],'exten':_0x52472d[_0x6994('0x7')],'priority':_0x57610d++,'VoiceExtensionId':_0x52472d['id']},{'type':_0x52472d[_0x6994('0x4')],'app':_0x52472d[_0x6994('0x8')]?_0x6994('0x9'):_0x6994('0xa'),'appdata':_0x52472d[_0x6994('0x8')]?'CDR(routeAlias)='+_0x52472d[_0x6994('0x8')]:_0x6994('0xb'),'context':_0x52472d[_0x6994('0x6')],'exten':_0x52472d[_0x6994('0x7')],'priority':_0x57610d++,'VoiceExtensionId':_0x52472d['id']}];if(_0x52472d[_0x6994('0x4')]==='inbound'){_0x15c588[_0x6994('0xc')]({'type':_0x6994('0xd'),'app':_0x6994('0x9'),'appdata':_0x6994('0xe')+_0x52472d['id'],'context':_0x52472d[_0x6994('0x6')],'exten':_0x52472d[_0x6994('0x7')],'priority':_0x57610d++,'VoiceExtensionId':_0x52472d['id']});}_0x15c588[_0x6994('0xc')]({'type':_0x52472d[_0x6994('0x4')],'app':_0x6994('0x9'),'appdata':_0x6994('0xf'),'context':_0x52472d[_0x6994('0x6')],'exten':_0x52472d[_0x6994('0x7')],'priority':_0x57610d++,'VoiceExtensionId':_0x52472d['id']},{'type':_0x52472d[_0x6994('0x4')],'app':_0x6994('0x9'),'appdata':_0x6994('0x10'),'context':_0x52472d[_0x6994('0x6')],'exten':_0x52472d[_0x6994('0x7')],'priority':_0x57610d++,'VoiceExtensionId':_0x52472d['id']},{'type':_0x52472d[_0x6994('0x4')],'app':_0x6994('0x9'),'appdata':_0x6994('0x11'),'context':_0x52472d['context'],'exten':_0x52472d[_0x6994('0x7')],'priority':_0x57610d++,'VoiceExtensionId':_0x52472d['id']});return _0x15c588;}function _0x2d850e(_0x4c2755){var _0x37d4c1=0x2;var _0x4f9ecb=[{'type':_0x6994('0x12'),'app':_0x6994('0x9'),'appdata':_0x6994('0x13'),'context':_0x4c2755['context'],'exten':_0x4c2755['exten'],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':_0x4c2755['alias']?'Set':_0x6994('0xa'),'appdata':_0x4c2755[_0x6994('0x8')]?_0x6994('0x14')+_0x4c2755[_0x6994('0x8')]:_0x6994('0xb'),'context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755['exten'],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':'Set','appdata':_0x6994('0x15')+(_0x4c2755[_0x6994('0x16')]?_0x6994('0x17')+_0x4c2755[_0x6994('0x16')]+'}':_0x6994('0x18')),'context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755[_0x6994('0x7')],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':_0x6994('0x9'),'appdata':'CDR(routeid)='+_0x4c2755['id'],'context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755[_0x6994('0x7')],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':_0x6994('0x19'),'appdata':_0x6994('0x1a')+(_0x37d4c1+0x2)+'):Goto('+(_0x37d4c1+0x1)+')','context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755[_0x6994('0x7')],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':'Set','appdata':_0x4c2755['cutdigits']?_0x6994('0x1b')+_0x4c2755[_0x6994('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x4c2755['context'],'exten':_0x4c2755['exten'],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755[_0x6994('0x7')],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':'Set','appdata':_0x6994('0x10'),'context':_0x4c2755['context'],'exten':_0x4c2755['exten'],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':_0x6994('0x9'),'appdata':_0x6994('0x11'),'context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755[_0x6994('0x7')],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':'outbound','app':_0x6994('0x9'),'appdata':_0x6994('0x1c')+_0x4c2755['id'],'context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755['exten'],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']}];if(_0x4c2755[_0x6994('0x1d')](_0x6994('0x1e'))&&_0x4c2755[_0x6994('0x1e')]!==_0x6994('0x1f')){_0x4f9ecb[_0x6994('0xc')]({'type':_0x6994('0x12'),'app':_0x6994('0x9'),'appdata':_0x6994('0x20'),'context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755[_0x6994('0x7')],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']},{'type':_0x6994('0x12'),'app':_0x6994('0x9'),'appdata':_0x6994('0x21')+_0x4c2755[_0x6994('0x1e')]||_0x6994('0x22'),'context':_0x4c2755[_0x6994('0x6')],'exten':_0x4c2755['exten'],'priority':_0x37d4c1++,'VoiceExtensionId':_0x4c2755['id']});}return _0x4f9ecb;}function _0x5452a1(_0x28dd90,_0x46fa59){var _0x275152=[{'name':_0x6994('0x23'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x6994('0x24'),'param':0x2},{'name':_0x6994('0x25'),'param':0x3}];var _0x392c6d={};var _0x2ec7a7=_0x46fa59['split'](',');var _0x37b820=[];for(var _0x2ff4ee=0x0;_0x2ff4ee<_0x275152[_0x6994('0x26')];_0x2ff4ee++){switch(_0x275152[_0x2ff4ee][_0x6994('0x27')]){case _0x6994('0x23'):_0x392c6d['trunk']=_0x2ec7a7[_0x275152[_0x2ff4ee][_0x6994('0x28')]][_0x6994('0x29')]('/')[0x1];_0x392c6d[_0x6994('0x2a')]=_0x2ec7a7[_0x275152[_0x2ff4ee][_0x6994('0x28')]]['split']('/')[0x2];_0x392c6d['prefix']=_0x392c6d['phone']?_0x392c6d[_0x6994('0x2a')][_0x6994('0x29')]('$')[0x0]:undefined;_0x392c6d[_0x6994('0x2a')]=_0x28dd90[_0x6994('0x16')]?(_0x392c6d[_0x6994('0x2b')]||'')+_0x6994('0x17')+_0x28dd90['cutdigits']+'}':(_0x392c6d[_0x6994('0x2b')]||'')+_0x6994('0x18');_0x37b820[_0x275152[_0x2ff4ee]['param']]=['SIP',_0x392c6d[_0x6994('0x23')],_0x392c6d[_0x6994('0x2a')]][_0x6994('0x2c')]('/');break;case _0x6994('0x24'):_0x392c6d[_0x6994('0x24')]=_0x2ec7a7[_0x275152[_0x2ff4ee][_0x6994('0x28')]];if(_0x28dd90['recordingFormat']!==_0x6994('0x1f')){if(_0x392c6d['options']['indexOf'](_0x6994('0x2d'))<0x0){_0x392c6d[_0x6994('0x24')]+=_0x6994('0x2d');}}else{_0x392c6d[_0x6994('0x24')]=_0x392c6d['options']['replace'](_0x6994('0x2d'),'');}_0x37b820[_0x275152[_0x2ff4ee][_0x6994('0x28')]]=_0x392c6d[_0x6994('0x24')];break;default:_0x37b820[_0x275152[_0x2ff4ee][_0x6994('0x28')]]=_0x2ec7a7[_0x275152[_0x2ff4ee][_0x6994('0x28')]];}}return _0x37b820[_0x6994('0x2c')](',');}function _0x346754(_0x44d61d,_0x22f7b1,_0x357f24){return new Promise(function(_0xb8c328,_0x56e2d8){var _0x40e49b=[];if(_[_0x6994('0x2e')](_0x22f7b1))return _0xb8c328(_0x40e49b);_0x2a7ae7['Interval'][_0x6994('0x2f')]({'attributes':['id',_0x6994('0x30'),_0x6994('0x31')],'raw':!![]})[_0x6994('0x32')](function(_0xb700cd){for(var _0x497cda=0x0,_0x4c27f4=0x0;_0x497cda<_0x22f7b1['length'];_0x497cda++,_0x4c27f4=0x0){var _0x5ae01d=_0x22f7b1[_0x497cda];var _0x2a4d52=[];var _0x3d0c3e=[];delete _0x5ae01d['id'];if(_0x5ae01d[_0x6994('0x30')]!=='*,*,*,*'){_0x5ae01d[_0x6994('0x33')]=[_0x5ae01d[_0x6994('0x30')]];}else{_0x5ae01d[_0x6994('0x33')]=_0x5ae01d[_0x6994('0x31')]?_[_0x6994('0x34')](_[_0x6994('0x35')](_0xb700cd,{'IntervalId':_0x5ae01d[_0x6994('0x31')]}),_0x6994('0x30')):[];}_0x5ae01d[_0x6994('0x6')]=_0x44d61d[_0x6994('0x6')];_0x5ae01d[_0x6994('0x7')]=_0x44d61d[_0x6994('0x7')];if(_0x5ae01d[_0x6994('0x4')])_0x5ae01d[_0x6994('0x4')]=_0x5ae01d[_0x6994('0x4')]['toLowerCase']();if(_0x44d61d['type']===_0x6994('0x12')){if(_0x5ae01d[_0x6994('0x1d')](_0x6994('0x36'))&&_0x5ae01d[_0x6994('0x36')]&&_0x5ae01d[_0x6994('0x36')]!=='--'){_0x2a4d52['push']({'type':_0x5ae01d[_0x6994('0x4')][_0x6994('0x37')](),'app':_0x6994('0x9'),'appdata':_0x6994('0x38')+_0x5ae01d['tag'],'context':_0x44d61d[_0x6994('0x6')],'exten':_0x44d61d[_0x6994('0x7')],'priority':_0x5ae01d[_0x6994('0x33')][_0x6994('0x26')]+_0x357f24+_0x4c27f4++,'VoiceExtensionId':_0x44d61d['id']});}_0x2a4d52[_0x6994('0xc')]({'type':_0x5ae01d[_0x6994('0x4')][_0x6994('0x37')](),'app':'ExecIf','appdata':_0x6994('0x39')+(_0x5ae01d[_0x6994('0x3a')]?_0x6994('0x3b')+_0x5ae01d[_0x6994('0x3a')]+')':_0x6994('0x3c')),'context':_0x44d61d[_0x6994('0x6')],'exten':_0x44d61d[_0x6994('0x7')],'priority':_0x5ae01d[_0x6994('0x33')][_0x6994('0x26')]+_0x357f24+_0x4c27f4++,'VoiceExtensionId':_0x44d61d['id']});}else{if(_0x5ae01d[_0x6994('0x1d')](_0x6994('0x3d'))){if([_0x6994('0x3e'),'playback'][_0x6994('0x3f')](_0x5ae01d[_0x6994('0x40')][_0x6994('0x37')]())&&_0x5ae01d[_0x6994('0x41')]!=='custom'){if(_0x5ae01d[_0x6994('0x3d')]){_0x2a4d52['push']({'type':_0x5ae01d['type'][_0x6994('0x37')](),'app':'ExecIf','appdata':_0x6994('0x42'),'context':_0x44d61d['context'],'exten':_0x44d61d['exten'],'priority':_0x5ae01d[_0x6994('0x33')]['length']+_0x357f24+_0x4c27f4++,'VoiceExtensionId':_0x44d61d['id']});_0x2a4d52[_0x6994('0xc')]({'type':_0x5ae01d[_0x6994('0x4')][_0x6994('0x37')](),'app':_0x6994('0x9'),'appdata':_0x6994('0x43'),'context':_0x44d61d[_0x6994('0x6')],'exten':_0x44d61d[_0x6994('0x7')],'priority':_0x5ae01d[_0x6994('0x33')]['length']+_0x357f24+_0x4c27f4++,'VoiceExtensionId':_0x44d61d['id']});}else{_0x2a4d52['push']({'type':_0x5ae01d[_0x6994('0x4')][_0x6994('0x37')](),'app':'ExecIf','appdata':_0x6994('0x44'),'context':_0x44d61d[_0x6994('0x6')],'exten':_0x44d61d['exten'],'priority':_0x5ae01d['intervals'][_0x6994('0x26')]+_0x357f24+_0x4c27f4++,'VoiceExtensionId':_0x44d61d['id']});_0x2a4d52['push']({'type':_0x5ae01d[_0x6994('0x4')][_0x6994('0x37')](),'app':_0x6994('0x9'),'appdata':_0x6994('0x45'),'context':_0x44d61d[_0x6994('0x6')],'exten':_0x44d61d[_0x6994('0x7')],'priority':_0x5ae01d['intervals'][_0x6994('0x26')]+_0x357f24+_0x4c27f4++,'VoiceExtensionId':_0x44d61d['id']});}}}}for(var _0x3fed25=0x0;_0x3fed25<_0x5ae01d[_0x6994('0x33')][_0x6994('0x26')];_0x3fed25++){var _0x10feea=_0x357f24+_0x5ae01d['intervals'][_0x6994('0x26')];var _0x1fac97=_0x3fed25===_0x5ae01d[_0x6994('0x33')]['length']-0x1?_0x357f24+_0x2a4d52[_0x6994('0x26')]+_0x3d0c3e['length']+0x2:_0x357f24+_0x3fed25+0x1;_0x2a4d52[_0x6994('0x46')](_0x3fed25,0x0,{'type':_0x44d61d[_0x6994('0x4')],'app':'GotoIfTime','appdata':_0x5ae01d[_0x6994('0x33')][_0x3fed25]+'?'+_0x44d61d[_0x6994('0x6')]+_0x6994('0x47')+_0x10feea+':'+_0x44d61d['context']+_0x6994('0x47')+_0x1fac97,'exten':_0x44d61d[_0x6994('0x7')],'context':_0x44d61d['context'],'priority':_0x357f24+_0x3fed25,'VoiceExtensionId':_0x44d61d['id']});}if(_0x5ae01d[_0x6994('0x41')]==='outboundDial'){_0x5ae01d[_0x6994('0x48')]=_0x5452a1(_0x44d61d,_0x5ae01d[_0x6994('0x48')]);}if(_0x5ae01d['appType']===_0x6994('0x49')){_0x2a4d52[_0x6994('0xc')]({'type':_0x5ae01d[_0x6994('0x4')][_0x6994('0x37')](),'app':_0x6994('0x9'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x44d61d['context'],'exten':_0x44d61d[_0x6994('0x7')],'priority':_0x5ae01d[_0x6994('0x33')][_0x6994('0x26')]+_0x357f24+_0x4c27f4++,'VoiceExtensionId':_0x44d61d['id']});}_0x5ae01d[_0x6994('0x4a')]=_0x2a4d52[_0x6994('0x26')]?_['last'](_0x2a4d52)[_0x6994('0x4a')]+0x1:_0x357f24;_0x40e49b=_[_0x6994('0x4b')](_0x40e49b,_0x2a4d52,[_0x5ae01d],_0x3d0c3e);_0x357f24=_[_0x6994('0x4c')](_0x40e49b)[_0x6994('0x4a')]+0x1;}return _0xb8c328(_0x40e49b);})['catch'](function(_0x4bc017){_0x56e2d8(_0x4bc017);});});}return _0x4820f1[_0x6994('0x4d')](_0x6994('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x27b8e9){var _0xb3d4ff=this['get']({'plain':!![]});var _0xeca5d2=_0xb3d4ff['type']==='outbound'?_0x2d850e(_0xb3d4ff):_0x52136b(_0xb3d4ff);return _0x346754(_0xb3d4ff,_0x27b8e9,_['last'](_0xeca5d2)['priority']+0x1)[_0x6994('0x32')](function(_0x596340){var _0x26aec7=_[_0x6994('0x4b')](_0xeca5d2,_0x596340);_0x26aec7[_0x6994('0xc')]({'type':_0xb3d4ff['type'],'app':_0x6994('0x4f'),'exten':_0xb3d4ff[_0x6994('0x7')],'context':_0xb3d4ff[_0x6994('0x6')],'priority':_['last'](_0x26aec7)[_0x6994('0x4a')]+0x1,'VoiceExtensionId':_0xb3d4ff['id']});return _0x26aec7;});}}});}; \ No newline at end of file +var _0x36b9=['push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','url','length','trunk','param','prefix','phone','split','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','ExecIf','Set(CALLERID(all)=','callerID','answer','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','lodash','exports','models','type','Set','CDR(type)=','alias','NoOp','No\x20alias\x20set','context','exten','inbound'];(function(_0x30e2ac,_0x569e21){var _0x4eaac5=function(_0x49d548){while(--_0x49d548){_0x30e2ac['push'](_0x30e2ac['shift']());}};_0x4eaac5(++_0x569e21);}(_0x36b9,0xe7));var _0x936b=function(_0x3a098f,_0x29845f){_0x3a098f=_0x3a098f-0x0;var _0x1853e1=_0x36b9[_0x3a098f];return _0x1853e1;};'use strict';var _=require(_0x936b('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x936b('0x1')]=function(_0x30815a){var _0x143635=_0x30815a[_0x936b('0x2')];function _0x19eab2(_0x4b4226){var _0x23a549=0x2;var _0x24f9d7=[{'type':_0x4b4226[_0x936b('0x3')],'app':_0x936b('0x4'),'appdata':_0x936b('0x5')+_0x4b4226[_0x936b('0x3')],'context':_0x4b4226['context'],'exten':_0x4b4226['exten'],'priority':_0x23a549++,'VoiceExtensionId':_0x4b4226['id']},{'type':_0x4b4226['type'],'app':_0x4b4226[_0x936b('0x6')]?_0x936b('0x4'):_0x936b('0x7'),'appdata':_0x4b4226[_0x936b('0x6')]?'CDR(routeAlias)='+_0x4b4226[_0x936b('0x6')]:_0x936b('0x8'),'context':_0x4b4226[_0x936b('0x9')],'exten':_0x4b4226[_0x936b('0xa')],'priority':_0x23a549++,'VoiceExtensionId':_0x4b4226['id']}];if(_0x4b4226['type']===_0x936b('0xb')){_0x24f9d7[_0x936b('0xc')]({'type':_0x936b('0xb'),'app':_0x936b('0x4'),'appdata':_0x936b('0xd')+_0x4b4226['id'],'context':_0x4b4226[_0x936b('0x9')],'exten':_0x4b4226[_0x936b('0xa')],'priority':_0x23a549++,'VoiceExtensionId':_0x4b4226['id']});}_0x24f9d7[_0x936b('0xc')]({'type':_0x4b4226[_0x936b('0x3')],'app':_0x936b('0x4'),'appdata':_0x936b('0xe'),'context':_0x4b4226[_0x936b('0x9')],'exten':_0x4b4226['exten'],'priority':_0x23a549++,'VoiceExtensionId':_0x4b4226['id']},{'type':_0x4b4226[_0x936b('0x3')],'app':_0x936b('0x4'),'appdata':_0x936b('0xf'),'context':_0x4b4226[_0x936b('0x9')],'exten':_0x4b4226[_0x936b('0xa')],'priority':_0x23a549++,'VoiceExtensionId':_0x4b4226['id']},{'type':_0x4b4226[_0x936b('0x3')],'app':_0x936b('0x4'),'appdata':_0x936b('0x10'),'context':_0x4b4226[_0x936b('0x9')],'exten':_0x4b4226[_0x936b('0xa')],'priority':_0x23a549++,'VoiceExtensionId':_0x4b4226['id']});return _0x24f9d7;}function _0x1b59fd(_0x30e5ea){var _0x343037=0x2;var _0x333b00=[{'type':_0x936b('0x11'),'app':_0x936b('0x4'),'appdata':_0x936b('0x12'),'context':_0x30e5ea[_0x936b('0x9')],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':_0x936b('0x11'),'app':_0x30e5ea[_0x936b('0x6')]?_0x936b('0x4'):_0x936b('0x7'),'appdata':_0x30e5ea[_0x936b('0x6')]?_0x936b('0x13')+_0x30e5ea[_0x936b('0x6')]:_0x936b('0x8'),'context':_0x30e5ea['context'],'exten':_0x30e5ea['exten'],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':'outbound','app':_0x936b('0x4'),'appdata':'CDR(destination)='+(_0x30e5ea[_0x936b('0x14')]?_0x936b('0x15')+_0x30e5ea[_0x936b('0x14')]+'}':_0x936b('0x16')),'context':_0x30e5ea[_0x936b('0x9')],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':_0x936b('0x11'),'app':_0x936b('0x4'),'appdata':_0x936b('0xd')+_0x30e5ea['id'],'context':_0x30e5ea['context'],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':'outbound','app':'ExecIf','appdata':_0x936b('0x17')+(_0x343037+0x2)+'):Goto('+(_0x343037+0x1)+')','context':_0x30e5ea['context'],'exten':_0x30e5ea['exten'],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':'outbound','app':_0x936b('0x4'),'appdata':_0x30e5ea['cutdigits']?_0x936b('0x18')+_0x30e5ea[_0x936b('0x14')]+'}':_0x936b('0x19'),'context':_0x30e5ea[_0x936b('0x9')],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':_0x936b('0x11'),'app':_0x936b('0x4'),'appdata':_0x936b('0xe'),'context':_0x30e5ea['context'],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':_0x936b('0x11'),'app':_0x936b('0x4'),'appdata':_0x936b('0xf'),'context':_0x30e5ea[_0x936b('0x9')],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':_0x936b('0x11'),'app':_0x936b('0x4'),'appdata':_0x936b('0x10'),'context':_0x30e5ea[_0x936b('0x9')],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':_0x936b('0x11'),'app':_0x936b('0x4'),'appdata':'outboundrouteid='+_0x30e5ea['id'],'context':_0x30e5ea[_0x936b('0x9')],'exten':_0x30e5ea['exten'],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']}];if(_0x30e5ea[_0x936b('0x1a')](_0x936b('0x1b'))&&_0x30e5ea['recordingFormat']!==_0x936b('0x1c')){_0x333b00[_0x936b('0xc')]({'type':_0x936b('0x11'),'app':_0x936b('0x4'),'appdata':_0x936b('0x1d'),'context':_0x30e5ea[_0x936b('0x9')],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']},{'type':'outbound','app':_0x936b('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x30e5ea[_0x936b('0x1b')]||_0x936b('0x1e'),'context':_0x30e5ea['context'],'exten':_0x30e5ea[_0x936b('0xa')],'priority':_0x343037++,'VoiceExtensionId':_0x30e5ea['id']});}return _0x333b00;}function _0xc11c5e(_0x37fb26,_0x32cfe1){var _0x5925e7=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x936b('0x1f'),'param':0x3}];var _0x1cb6a2={};var _0x3cd72f=_0x32cfe1['split'](',');var _0x48f167=[];for(var _0x2f860b=0x0;_0x2f860b<_0x5925e7[_0x936b('0x20')];_0x2f860b++){switch(_0x5925e7[_0x2f860b]['name']){case _0x936b('0x21'):_0x1cb6a2[_0x936b('0x21')]=_0x3cd72f[_0x5925e7[_0x2f860b][_0x936b('0x22')]]['split']('/')[0x1];_0x1cb6a2['phone']=_0x3cd72f[_0x5925e7[_0x2f860b]['param']]['split']('/')[0x2];_0x1cb6a2[_0x936b('0x23')]=_0x1cb6a2[_0x936b('0x24')]?_0x1cb6a2[_0x936b('0x24')][_0x936b('0x25')]('$')[0x0]:undefined;_0x1cb6a2['phone']=_0x37fb26[_0x936b('0x14')]?(_0x1cb6a2[_0x936b('0x23')]||'')+'${EXTEN:'+_0x37fb26[_0x936b('0x14')]+'}':(_0x1cb6a2[_0x936b('0x23')]||'')+'${EXTEN}';_0x48f167[_0x5925e7[_0x2f860b][_0x936b('0x22')]]=[_0x936b('0x26'),_0x1cb6a2[_0x936b('0x21')],_0x1cb6a2[_0x936b('0x24')]][_0x936b('0x27')]('/');break;case _0x936b('0x28'):_0x1cb6a2['options']=_0x3cd72f[_0x5925e7[_0x2f860b][_0x936b('0x22')]];if(_0x37fb26[_0x936b('0x1b')]!=='none'){if(_0x1cb6a2[_0x936b('0x28')][_0x936b('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x1cb6a2['options']+=_0x936b('0x2a');}}else{_0x1cb6a2['options']=_0x1cb6a2['options'][_0x936b('0x2b')](_0x936b('0x2a'),'');}_0x48f167[_0x5925e7[_0x2f860b][_0x936b('0x22')]]=_0x1cb6a2['options'];break;default:_0x48f167[_0x5925e7[_0x2f860b][_0x936b('0x22')]]=_0x3cd72f[_0x5925e7[_0x2f860b][_0x936b('0x22')]];}}return _0x48f167[_0x936b('0x27')](',');}function _0x3289fd(_0x4fd2f7,_0x550cd8,_0x2fd46a){return new Promise(function(_0x5e85bf,_0x3c6bc8){var _0x15dcc3=[];if(_[_0x936b('0x2c')](_0x550cd8))return _0x5e85bf(_0x15dcc3);_0x143635[_0x936b('0x2d')][_0x936b('0x2e')]({'attributes':['id',_0x936b('0x2f'),'IntervalId'],'raw':!![]})[_0x936b('0x30')](function(_0x514adb){for(var _0x206b42=0x0,_0x1d241a=0x0;_0x206b42<_0x550cd8[_0x936b('0x20')];_0x206b42++,_0x1d241a=0x0){var _0x581b0b=_0x550cd8[_0x206b42];var _0x157ed9=[];var _0x19c23e=[];delete _0x581b0b['id'];if(_0x581b0b[_0x936b('0x2f')]!==_0x936b('0x31')){_0x581b0b['intervals']=[_0x581b0b[_0x936b('0x2f')]];}else{_0x581b0b[_0x936b('0x32')]=_0x581b0b[_0x936b('0x33')]?_[_0x936b('0x34')](_[_0x936b('0x35')](_0x514adb,{'IntervalId':_0x581b0b[_0x936b('0x33')]}),_0x936b('0x2f')):[];}_0x581b0b[_0x936b('0x9')]=_0x4fd2f7[_0x936b('0x9')];_0x581b0b[_0x936b('0xa')]=_0x4fd2f7[_0x936b('0xa')];if(_0x581b0b[_0x936b('0x3')])_0x581b0b[_0x936b('0x3')]=_0x581b0b['type'][_0x936b('0x36')]();if(_0x4fd2f7[_0x936b('0x3')]==='outbound'){if(_0x581b0b[_0x936b('0x1a')](_0x936b('0x37'))&&_0x581b0b['tag']&&_0x581b0b['tag']!=='--'){_0x157ed9[_0x936b('0xc')]({'type':_0x581b0b[_0x936b('0x3')][_0x936b('0x36')](),'app':_0x936b('0x4'),'appdata':'CDR(tag)='+_0x581b0b['tag'],'context':_0x4fd2f7['context'],'exten':_0x4fd2f7[_0x936b('0xa')],'priority':_0x581b0b['intervals']['length']+_0x2fd46a+_0x1d241a++,'VoiceExtensionId':_0x4fd2f7['id']});}_0x157ed9[_0x936b('0xc')]({'type':_0x581b0b[_0x936b('0x3')]['toLowerCase'](),'app':_0x936b('0x38'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x581b0b['callerID']?_0x936b('0x39')+_0x581b0b[_0x936b('0x3a')]+')':'NoOp(No\x20number\x20available)'),'context':_0x4fd2f7['context'],'exten':_0x4fd2f7[_0x936b('0xa')],'priority':_0x581b0b[_0x936b('0x32')]['length']+_0x2fd46a+_0x1d241a++,'VoiceExtensionId':_0x4fd2f7['id']});}else{if(_0x581b0b[_0x936b('0x1a')](_0x936b('0x3b'))){if(['queue',_0x936b('0x3c')][_0x936b('0x3d')](_0x581b0b['app'][_0x936b('0x36')]())&&_0x581b0b[_0x936b('0x3e')]!==_0x936b('0x3f')){if(_0x581b0b['answer']){_0x157ed9[_0x936b('0xc')]({'type':_0x581b0b[_0x936b('0x3')][_0x936b('0x36')](),'app':_0x936b('0x38'),'appdata':_0x936b('0x40'),'context':_0x4fd2f7['context'],'exten':_0x4fd2f7[_0x936b('0xa')],'priority':_0x581b0b['intervals']['length']+_0x2fd46a+_0x1d241a++,'VoiceExtensionId':_0x4fd2f7['id']});_0x157ed9[_0x936b('0xc')]({'type':_0x581b0b['type'][_0x936b('0x36')](),'app':_0x936b('0x4'),'appdata':_0x936b('0x41'),'context':_0x4fd2f7[_0x936b('0x9')],'exten':_0x4fd2f7[_0x936b('0xa')],'priority':_0x581b0b[_0x936b('0x32')]['length']+_0x2fd46a+_0x1d241a++,'VoiceExtensionId':_0x4fd2f7['id']});}else{_0x157ed9['push']({'type':_0x581b0b[_0x936b('0x3')][_0x936b('0x36')](),'app':_0x936b('0x38'),'appdata':_0x936b('0x42'),'context':_0x4fd2f7['context'],'exten':_0x4fd2f7[_0x936b('0xa')],'priority':_0x581b0b[_0x936b('0x32')]['length']+_0x2fd46a+_0x1d241a++,'VoiceExtensionId':_0x4fd2f7['id']});_0x157ed9['push']({'type':_0x581b0b[_0x936b('0x3')][_0x936b('0x36')](),'app':_0x936b('0x4'),'appdata':_0x936b('0x43'),'context':_0x4fd2f7[_0x936b('0x9')],'exten':_0x4fd2f7[_0x936b('0xa')],'priority':_0x581b0b[_0x936b('0x32')]['length']+_0x2fd46a+_0x1d241a++,'VoiceExtensionId':_0x4fd2f7['id']});}}}}for(var _0x2b6c45=0x0;_0x2b6c45<_0x581b0b[_0x936b('0x32')]['length'];_0x2b6c45++){var _0x1fdd1e=_0x2fd46a+_0x581b0b[_0x936b('0x32')][_0x936b('0x20')];var _0x5cc9c5=_0x2b6c45===_0x581b0b[_0x936b('0x32')][_0x936b('0x20')]-0x1?_0x2fd46a+_0x157ed9['length']+_0x19c23e[_0x936b('0x20')]+0x2:_0x2fd46a+_0x2b6c45+0x1;_0x157ed9[_0x936b('0x44')](_0x2b6c45,0x0,{'type':_0x4fd2f7[_0x936b('0x3')],'app':_0x936b('0x45'),'appdata':_0x581b0b[_0x936b('0x32')][_0x2b6c45]+'?'+_0x4fd2f7[_0x936b('0x9')]+_0x936b('0x46')+_0x1fdd1e+':'+_0x4fd2f7[_0x936b('0x9')]+',${EXTEN},'+_0x5cc9c5,'exten':_0x4fd2f7[_0x936b('0xa')],'context':_0x4fd2f7[_0x936b('0x9')],'priority':_0x2fd46a+_0x2b6c45,'VoiceExtensionId':_0x4fd2f7['id']});}if(_0x581b0b[_0x936b('0x3e')]==='outboundDial'){_0x581b0b[_0x936b('0x47')]=_0xc11c5e(_0x4fd2f7,_0x581b0b[_0x936b('0x47')]);}if(_0x581b0b['appType']===_0x936b('0x48')){_0x157ed9[_0x936b('0xc')]({'type':_0x581b0b[_0x936b('0x3')][_0x936b('0x36')](),'app':_0x936b('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x4fd2f7['context'],'exten':_0x4fd2f7[_0x936b('0xa')],'priority':_0x581b0b[_0x936b('0x32')][_0x936b('0x20')]+_0x2fd46a+_0x1d241a++,'VoiceExtensionId':_0x4fd2f7['id']});}_0x581b0b[_0x936b('0x49')]=_0x157ed9['length']?_[_0x936b('0x4a')](_0x157ed9)['priority']+0x1:_0x2fd46a;_0x15dcc3=_[_0x936b('0x4b')](_0x15dcc3,_0x157ed9,[_0x581b0b],_0x19c23e);_0x2fd46a=_[_0x936b('0x4a')](_0x15dcc3)['priority']+0x1;}return _0x5e85bf(_0x15dcc3);})[_0x936b('0x4c')](function(_0x221efc){_0x3c6bc8(_0x221efc);});});}return _0x30815a[_0x936b('0x4d')](_0x936b('0x4e'),attributes,{'tableName':_0x936b('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x35d8e6){var _0x136c01=this[_0x936b('0x50')]({'plain':!![]});var _0x17bda7=_0x136c01['type']===_0x936b('0x11')?_0x1b59fd(_0x136c01):_0x19eab2(_0x136c01);return _0x3289fd(_0x136c01,_0x35d8e6,_[_0x936b('0x4a')](_0x17bda7)['priority']+0x1)[_0x936b('0x30')](function(_0x264376){var _0x260188=_[_0x936b('0x4b')](_0x17bda7,_0x264376);_0x260188[_0x936b('0xc')]({'type':_0x136c01[_0x936b('0x3')],'app':'Hangup','exten':_0x136c01[_0x936b('0xa')],'context':_0x136c01[_0x936b('0x9')],'priority':_[_0x936b('0x4a')](_0x260188)[_0x936b('0x49')]+0x1,'VoiceExtensionId':_0x136c01['id']});return _0x260188;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7e48d2e..1729552 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 _0x16cc=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','info','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x57af69,_0x12df5e){var _0x5ea86c=function(_0x257ad4){while(--_0x257ad4){_0x57af69['push'](_0x57af69['shift']());}};_0x5ea86c(++_0x12df5e);}(_0x16cc,0x120));var _0xc16c=function(_0x150943,_0xd44f4c){_0x150943=_0x150943-0x0;var _0x4db51f=_0x16cc[_0x150943];return _0x4db51f;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var moment=require(_0xc16c('0x1'));var BPromise=require(_0xc16c('0x2'));var rs=require(_0xc16c('0x3'));var fs=require('fs');var Redis=require(_0xc16c('0x4'));var db=require(_0xc16c('0x5'))['db'];var utils=require(_0xc16c('0x6'));var logger=require('../../config/logger')(_0xc16c('0x7'));var config=require(_0xc16c('0x8'));var jayson=require(_0xc16c('0x9'));var client=jayson[_0xc16c('0xa')]['http']({'port':0x232a});config[_0xc16c('0xb')]=_['defaults'](config[_0xc16c('0xb')],{'host':_0xc16c('0xc'),'port':0x18eb});var socket=require(_0xc16c('0xd'))(new Redis(config[_0xc16c('0xb')]));require('./voiceExtension.socket')[_0xc16c('0xe')](socket);function respondWithRpcPromise(_0x286c40,_0x3f3ff4,_0x462dcf){return new BPromise(function(_0x510afb,_0x2ccba4){return client[_0xc16c('0xf')](_0x286c40,_0x462dcf)[_0xc16c('0x10')](function(_0x4cb366){logger['info'](_0xc16c('0x11'),_0x3f3ff4,_0xc16c('0x12'));logger[_0xc16c('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3f3ff4,'request\x20sent',JSON['stringify'](_0x4cb366));if(_0x4cb366[_0xc16c('0x14')]){if(_0x4cb366[_0xc16c('0x14')][_0xc16c('0x15')]===0x1f4){logger[_0xc16c('0x14')](_0xc16c('0x11'),_0x3f3ff4,_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);return _0x2ccba4(_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);}logger[_0xc16c('0x14')](_0xc16c('0x11'),_0x3f3ff4,_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);return _0x510afb(_0x4cb366[_0xc16c('0x14')][_0xc16c('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x3f3ff4,_0xc16c('0x12'));_0x510afb(_0x4cb366[_0xc16c('0x17')][_0xc16c('0x16')]);}})[_0xc16c('0x18')](function(_0x432a0a){logger[_0xc16c('0x14')](_0xc16c('0x11'),_0x3f3ff4,_0x432a0a);_0x2ccba4(_0x432a0a);});});}exports[_0xc16c('0x19')]=function(_0x55dc03){var _0x4770d2=this;return new Promise(function(_0x37afc3,_0x121da2){return db[_0xc16c('0x1a')][_0xc16c('0x1b')]({'raw':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03[_0xc16c('0x1c')][_0xc16c('0x1d')]===undefined?!![]:![]:!![],'where':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03[_0xc16c('0x1c')][_0xc16c('0x1e')]||null:null,'attributes':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03[_0xc16c('0x1c')][_0xc16c('0x1f')]||null:null,'limit':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03['options']['limit']||null:null,'include':_0x55dc03[_0xc16c('0x1c')]?_0x55dc03['options'][_0xc16c('0x20')]?_[_0xc16c('0x21')](_0x55dc03['options'][_0xc16c('0x20')],function(_0x4eb194){return{'model':db[_0x4eb194[_0xc16c('0x22')]],'as':_0x4eb194['as'],'attributes':_0x4eb194[_0xc16c('0x1f')],'include':_0x4eb194['include']?_[_0xc16c('0x21')](_0x4eb194[_0xc16c('0x20')],function(_0x323b60){return{'model':db[_0x323b60['model']],'as':_0x323b60['as'],'attributes':_0x323b60[_0xc16c('0x1f')],'include':_0x323b60[_0xc16c('0x20')]?_['map'](_0x323b60[_0xc16c('0x20')],function(_0x1457d4){return{'model':db[_0x1457d4['model']],'as':_0x1457d4['as'],'attributes':_0x1457d4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc16c('0x10')](function(_0x4dd804){logger[_0xc16c('0x23')](_0xc16c('0x19'),_0x55dc03);logger[_0xc16c('0x13')]('GetVoiceExtension',_0x55dc03,JSON[_0xc16c('0x24')](_0x4dd804));_0x37afc3(_0x4dd804);})[_0xc16c('0x18')](function(_0xbe9a46){logger[_0xc16c('0x14')](_0xc16c('0x19'),_0xbe9a46[_0xc16c('0x16')],_0x55dc03);_0x121da2(_0x4770d2[_0xc16c('0x14')](0x1f4,_0xbe9a46[_0xc16c('0x16')]));});});}; \ No newline at end of file +var _0xab86=['attributes','limit','include','map','model','stringify','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where'];(function(_0x227e18,_0x253ef1){var _0x4ceb7d=function(_0x543599){while(--_0x543599){_0x227e18['push'](_0x227e18['shift']());}};_0x4ceb7d(++_0x253ef1);}(_0xab86,0x13e));var _0x6ab8=function(_0x15d6e9,_0x5850f8){_0x15d6e9=_0x15d6e9-0x0;var _0x1729df=_0xab86[_0x15d6e9];return _0x1729df;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var moment=require(_0x6ab8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab8('0x4'));var logger=require('../../config/logger')(_0x6ab8('0x5'));var config=require(_0x6ab8('0x6'));var jayson=require(_0x6ab8('0x7'));var client=jayson[_0x6ab8('0x8')][_0x6ab8('0x9')]({'port':0x232a});config[_0x6ab8('0xa')]=_[_0x6ab8('0xb')](config[_0x6ab8('0xa')],{'host':_0x6ab8('0xc'),'port':0x18eb});var socket=require(_0x6ab8('0xd'))(new Redis(config[_0x6ab8('0xa')]));require(_0x6ab8('0xe'))[_0x6ab8('0xf')](socket);function respondWithRpcPromise(_0x5127eb,_0x5ea6e6,_0x383594){return new BPromise(function(_0x5b7732,_0x18d3a3){return client[_0x6ab8('0x10')](_0x5127eb,_0x383594)[_0x6ab8('0x11')](function(_0x52d636){logger[_0x6ab8('0x12')](_0x6ab8('0x13'),_0x5ea6e6,'request\x20sent');logger[_0x6ab8('0x14')](_0x6ab8('0x15'),_0x5ea6e6,_0x6ab8('0x16'),JSON['stringify'](_0x52d636));if(_0x52d636[_0x6ab8('0x17')]){if(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x18')]===0x1f4){logger[_0x6ab8('0x17')](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x18d3a3(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);}logger['error'](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x5b7732(_0x52d636['error'][_0x6ab8('0x19')]);}else{logger[_0x6ab8('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5ea6e6,'request\x20sent');_0x5b7732(_0x52d636[_0x6ab8('0x1a')]['message']);}})[_0x6ab8('0x1b')](function(_0x292b36){logger[_0x6ab8('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x5ea6e6,_0x292b36);_0x18d3a3(_0x292b36);});});}exports[_0x6ab8('0x1c')]=function(_0x3de5b3){var _0x2d2a80=this;return new Promise(function(_0x312183,_0x5227c6){return db[_0x6ab8('0x1d')][_0x6ab8('0x1e')]({'raw':_0x3de5b3['options']?_0x3de5b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x3de5b3[_0x6ab8('0x1f')]?_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x20')]||null:null,'attributes':_0x3de5b3['options']?_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x21')]||null:null,'limit':_0x3de5b3['options']?_0x3de5b3['options'][_0x6ab8('0x22')]||null:null,'include':_0x3de5b3[_0x6ab8('0x1f')]?_0x3de5b3['options'][_0x6ab8('0x23')]?_[_0x6ab8('0x24')](_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x23')],function(_0x3ddaeb){return{'model':db[_0x3ddaeb[_0x6ab8('0x25')]],'as':_0x3ddaeb['as'],'attributes':_0x3ddaeb[_0x6ab8('0x21')],'include':_0x3ddaeb[_0x6ab8('0x23')]?_['map'](_0x3ddaeb['include'],function(_0x334e21){return{'model':db[_0x334e21['model']],'as':_0x334e21['as'],'attributes':_0x334e21[_0x6ab8('0x21')],'include':_0x334e21[_0x6ab8('0x23')]?_[_0x6ab8('0x24')](_0x334e21['include'],function(_0x525687){return{'model':db[_0x525687['model']],'as':_0x525687['as'],'attributes':_0x525687[_0x6ab8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6ab8('0x11')](function(_0x3723a7){logger[_0x6ab8('0x12')](_0x6ab8('0x1c'),_0x3de5b3);logger[_0x6ab8('0x14')](_0x6ab8('0x1c'),_0x3de5b3,JSON[_0x6ab8('0x26')](_0x3723a7));_0x312183(_0x3723a7);})[_0x6ab8('0x1b')](function(_0x1f6dbc){logger[_0x6ab8('0x17')](_0x6ab8('0x1c'),_0x1f6dbc[_0x6ab8('0x19')],_0x3de5b3);_0x5227c6(_0x2d2a80['error'](0x1f4,_0x1f6dbc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b77cf3c..969be2f 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x1308e7,_0x38e682){var _0x21a134=function(_0x2f02e3){while(--_0x2f02e3){_0x1308e7['push'](_0x1308e7['shift']());}};_0x21a134(++_0x38e682);}(_0x7a54,0x106));var _0x47a5=function(_0x49a758,_0x4d1aef){_0x49a758=_0x49a758-0x0;var _0x1874bd=_0x7a54[_0x49a758];return _0x1874bd;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x4d328,_0x236edc){var _0x15f764=function(_0x3c4f6d){while(--_0x3c4f6d){_0x4d328['push'](_0x4d328['shift']());}};_0x15f764(++_0x236edc);}(_0x4975,0x86));var _0x5497=function(_0x536a36,_0x4355ee){_0x536a36=_0x536a36-0x0;var _0x27d9ec=_0x4975[_0x536a36];return _0x27d9ec;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 42bb341..2216ebe 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 _0x5fdc=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id/messages','getMessages','create','put','/:id','update'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5fdc,0x127));var _0xc5fd=function(_0x5a58ba,_0x20d99b){_0x5a58ba=_0x5a58ba-0x0;var _0x45728c=_0x5fdc[_0x5a58ba];return _0x45728c;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var fs_extra=require(_0xc5fd('0x6'));var auth=require(_0xc5fd('0x7'));var interaction=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var controller=require(_0xc5fd('0xa'));router[_0xc5fd('0xb')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5fd('0xb')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc5fd('0x10')]);router[_0xc5fd('0x11')](_0xc5fd('0x12'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x13')]);router[_0xc5fd('0x14')]('/:id',auth[_0xc5fd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x68b3=['index','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xb5f159,_0x167a8f){var _0x297b51=function(_0x3b1d33){while(--_0x3b1d33){_0xb5f159['push'](_0xb5f159['shift']());}};_0x297b51(++_0x167a8f);}(_0x68b3,0x1d8));var _0x368b=function(_0x54be55,_0x17a6d0){_0x54be55=_0x54be55-0x0;var _0x1be660=_0x68b3[_0x54be55];return _0x1be660;};'use strict';var multer=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var path=require(_0x368b('0x2'));var timeout=require(_0x368b('0x3'));var express=require(_0x368b('0x4'));var router=express['Router']();var fs_extra=require(_0x368b('0x5'));var auth=require(_0x368b('0x6'));var interaction=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var controller=require('./voiceMail.controller');router[_0x368b('0x9')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0xb')]);router[_0x368b('0x9')](_0x368b('0xc'),auth[_0x368b('0xa')](),controller[_0x368b('0xd')]);router[_0x368b('0x9')](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0xf')]);router['post']('/',auth[_0x368b('0xa')](),controller[_0x368b('0x10')]);router[_0x368b('0x11')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x12')]);router[_0x368b('0x13')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a2e1658..f89b984 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 _0x7511=['email','trim','yes','ENUM','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x7c68e8,_0x87f909){var _0x3cfe01=function(_0x238060){while(--_0x238060){_0x7c68e8['push'](_0x7c68e8['shift']());}};_0x3cfe01(++_0x87f909);}(_0x7511,0x1ea));var _0x1751=function(_0x35197d,_0x33eda7){_0x35197d=_0x35197d-0x0;var _0x157a26=_0x7511[_0x35197d];return _0x157a26;};'use strict';var Sequelize=require(_0x1751('0x0'));module[_0x1751('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1751('0x2')],'defaultValue':_0x1751('0x3'),'unique':_0x1751('0x4')},'mailbox':{'type':Sequelize[_0x1751('0x2')],'defaultValue':'','allowNull':![],'unique':_0x1751('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1751('0x2')],'validate':{'isEmail':!![]},'set':function(_0xe8ac84){this[_0x1751('0x5')](_0x1751('0x6'),typeof _0xe8ac84==='string'&&_0xe8ac84['trim']()?_0xe8ac84[_0x1751('0x7')]():null);}},'pager':{'type':Sequelize[_0x1751('0x2')]},'tz':{'type':Sequelize[_0x1751('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x1751('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x1751('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x1751('0x2')]},'callback':{'type':Sequelize[_0x1751('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1751('0x9')](_0x1751('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1751('0x9')](_0x1751('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1751('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1751('0x9')](_0x1751('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1751('0x9')](_0x1751('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1751('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x1751('0x9')](_0x1751('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1751('0x9')](_0x1751('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1751('0x9')]('yes','no'),'defaultValue':_0x1751('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x1751('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x1751('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1751('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1751('0xb')],'get':function(){return this['getDataValue'](_0x1751('0xc'))+_0x1751('0xd')+this[_0x1751('0xe')](_0x1751('0xf'));}}}; \ No newline at end of file +var _0xbaea=['contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','exports','STRING','from-voicemail'];(function(_0x29183b,_0x8296f3){var _0x3cdbbf=function(_0x5d3909){while(--_0x5d3909){_0x29183b['push'](_0x29183b['shift']());}};_0x3cdbbf(++_0x8296f3);}(_0xbaea,0x81));var _0xabae=function(_0xf5b943,_0x3330e9){_0xf5b943=_0xf5b943-0x0;var _0x30da5a=_0xbaea[_0xf5b943];return _0x30da5a;};'use strict';var Sequelize=require(_0xabae('0x0'));module[_0xabae('0x1')]={'customer_id':{'type':Sequelize[_0xabae('0x2')]},'context':{'type':Sequelize[_0xabae('0x2')],'defaultValue':_0xabae('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xabae('0x2')],'defaultValue':'','allowNull':![],'unique':_0xabae('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xabae('0x2')]},'email':{'type':Sequelize[_0xabae('0x2')],'validate':{'isEmail':!![]},'set':function(_0x470e9e){this[_0xabae('0x5')](_0xabae('0x6'),typeof _0x470e9e===_0xabae('0x7')&&_0x470e9e[_0xabae('0x8')]()?_0x470e9e['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xabae('0x9')},'attach':{'type':Sequelize[_0xabae('0xa')](_0xabae('0xb'),'no'),'defaultValue':_0xabae('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0xabae('0xa')]('yes','no'),'defaultValue':_0xabae('0xb'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xabae('0x2')]},'review':{'type':Sequelize[_0xabae('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xabae('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xabae('0xa')](_0xabae('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xabae('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xabae('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xabae('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xabae('0xa')](_0xabae('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xabae('0xa')]('yes','no'),'defaultValue':_0xabae('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0xabae('0xa')](_0xabae('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xabae('0xa')](_0xabae('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xabae('0xb'),'no'),'defaultValue':_0xabae('0xb'),'allowNull':![]},'stamp':{'type':_0xabae('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xabae('0x2')]},'maxsecs':{'type':Sequelize[_0xabae('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xabae('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xabae('0xf')],'get':function(){return this['getDataValue'](_0xabae('0x10'))+_0xabae('0x11')+this[_0xabae('0x12')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index cc3eef3..c843d27 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc900=['body','params','findOne','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','Voicemails','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','catch','show','rawAttributes','keys','find','user','get','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xc900,0xb3));var _0x0c90=function(_0x32d491,_0x402352){_0x32d491=_0x32d491-0x0;var _0xb252af=_0xc900[_0x32d491];return _0xb252af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];function respondWithStatusCode(_0x50e7db,_0x459cdb){_0x459cdb=_0x459cdb||0xcc;return function(_0x26fc46){if(_0x26fc46){return _0x50e7db[_0x0c90('0x19')](_0x459cdb);}return _0x50e7db[_0x0c90('0x1a')](_0x459cdb)[_0x0c90('0x1b')]();};}function respondWithResult(_0x59ea8e,_0x467b32){_0x467b32=_0x467b32||0xc8;return function(_0x4451e0){if(_0x4451e0){return _0x59ea8e['status'](_0x467b32)[_0x0c90('0x1c')](_0x4451e0);}};}function respondWithFilteredResult(_0x3a492d,_0x3bd5e8){return function(_0x5bef7d){if(_0x5bef7d){var _0x5daeb7=typeof _0x3bd5e8[_0x0c90('0x1d')]===_0x0c90('0x1e')&&typeof _0x3bd5e8[_0x0c90('0x1f')]===_0x0c90('0x1e');var _0x276b92=_0x5bef7d[_0x0c90('0x20')];var _0x42321a=_0x5daeb7?0x0:_0x3bd5e8['offset'];var _0xc3bb47=_0x5daeb7?_0x5bef7d[_0x0c90('0x20')]:_0x3bd5e8[_0x0c90('0x1d')]+_0x3bd5e8[_0x0c90('0x1f')];var _0x594267;if(_0xc3bb47>=_0x276b92){_0xc3bb47=_0x276b92;_0x594267=0xc8;}else{_0x594267=0xce;}_0x3a492d[_0x0c90('0x1a')](_0x594267);return _0x3a492d[_0x0c90('0x21')](_0x0c90('0x22'),_0x42321a+'-'+_0xc3bb47+'/'+_0x276b92)[_0x0c90('0x1c')](_0x5bef7d);}return null;};}function patchUpdates(_0x315932){return function(_0xc08f54){try{jsonpatch['apply'](_0xc08f54,_0x315932,!![]);}catch(_0x365a42){return BPromise['reject'](_0x365a42);}return _0xc08f54[_0x0c90('0x23')]();};}function saveUpdates(_0x1a021e,_0x47b13c){return function(_0x2a053a){if(_0x2a053a){return _0x2a053a[_0x0c90('0x24')](_0x1a021e)[_0x0c90('0x25')](function(_0x86dee){return _0x86dee;});}return null;};}function removeEntity(_0x212164,_0x3b287c){return function(_0x4dfbc3){if(_0x4dfbc3){return _0x4dfbc3[_0x0c90('0x26')]()[_0x0c90('0x25')](function(){var _0x5695a2=_0x4dfbc3['get']({'plain':!![]});var _0x28d005=_0x0c90('0x27');return db[_0x0c90('0x28')][_0x0c90('0x26')]({'where':{'type':_0x28d005,'resourceId':_0x5695a2['id']}})['then'](function(){return _0x4dfbc3;});})[_0x0c90('0x25')](function(){_0x212164[_0x0c90('0x1a')](0xcc)[_0x0c90('0x1b')]();});}};}function handleEntityNotFound(_0x277d4a,_0x427c2b){return function(_0x114589){if(!_0x114589){_0x277d4a['sendStatus'](0x194);}return _0x114589;};}function handleError(_0x15de68,_0x22a47d){_0x22a47d=_0x22a47d||0x1f4;return function(_0x39f1b2){logger[_0x0c90('0x29')](_0x39f1b2['stack']);if(_0x39f1b2['name']){delete _0x39f1b2[_0x0c90('0x2a')];}_0x15de68[_0x0c90('0x1a')](_0x22a47d)[_0x0c90('0x2b')](_0x39f1b2);};}exports[_0x0c90('0x2c')]=function(_0x119e09,_0x562664){var _0x120136={},_0x50b156={},_0x478002={'count':0x0,'rows':[]};var _0x47a935=_[_0x0c90('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x886634){return{'name':_0x886634[_0x0c90('0x2e')],'type':_0x886634[_0x0c90('0x2f')][_0x0c90('0x30')]};});_0x50b156['model']=_[_0x0c90('0x2d')](_0x47a935,'name');_0x50b156[_0x0c90('0x31')]=_['keys'](_0x119e09[_0x0c90('0x31')]);_0x50b156[_0x0c90('0x32')]=_['intersection'](_0x50b156[_0x0c90('0x33')],_0x50b156[_0x0c90('0x31')]);_0x120136[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x50b156[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x36')]));_0x120136['attributes']=_0x120136[_0x0c90('0x34')][_0x0c90('0x37')]?_0x120136[_0x0c90('0x34')]:_0x50b156[_0x0c90('0x33')];if(!_0x119e09['query'][_0x0c90('0x38')](_0x0c90('0x39'))){_0x120136[_0x0c90('0x1f')]=qs[_0x0c90('0x1f')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x120136[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x119e09['query'][_0x0c90('0x1d')]);}_0x120136[_0x0c90('0x3a')]=qs['sort'](_0x119e09[_0x0c90('0x31')][_0x0c90('0x3b')]);_0x120136[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x119e09['query'],_0x50b156[_0x0c90('0x32')]),_0x47a935);if(_0x119e09[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x120136[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x120136[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x47a935,function(_0x1695dd){if(_0x1695dd[_0x0c90('0x2f')]!=='VIRTUAL'){var _0x2cd2c2={};_0x2cd2c2[_0x1695dd['name']]={'$like':'%'+_0x119e09[_0x0c90('0x31')]['filter']+'%'};return _0x2cd2c2;}})});}_0x120136=_[_0x0c90('0x3f')]({},_0x120136,_0x119e09[_0x0c90('0x40')]);var _0x49f8b4={'where':_0x120136['where']};return db[_0x0c90('0x41')]['count'](_0x49f8b4)[_0x0c90('0x25')](function(_0x4545bb){_0x478002[_0x0c90('0x20')]=_0x4545bb;if(_0x119e09['query'][_0x0c90('0x42')]){_0x120136[_0x0c90('0x43')]=[{'all':!![]}];}return db[_0x0c90('0x41')][_0x0c90('0x44')](_0x120136);})[_0x0c90('0x25')](function(_0x1184c4){_0x478002['rows']=_0x1184c4;return _0x478002;})[_0x0c90('0x25')](respondWithFilteredResult(_0x562664,_0x120136))[_0x0c90('0x45')](handleError(_0x562664,null));};exports[_0x0c90('0x46')]=function(_0x399115,_0x3c47c9){var _0x15d040={'raw':!![],'where':{'id':_0x399115['params']['id']}},_0x30b9df={};_0x30b9df[_0x0c90('0x33')]=_['keys'](db[_0x0c90('0x41')][_0x0c90('0x47')]);_0x30b9df[_0x0c90('0x31')]=_[_0x0c90('0x48')](_0x399115[_0x0c90('0x31')]);_0x30b9df[_0x0c90('0x32')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],_0x30b9df[_0x0c90('0x31')]);_0x15d040[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x399115[_0x0c90('0x31')][_0x0c90('0x36')]));_0x15d040['attributes']=_0x15d040[_0x0c90('0x34')][_0x0c90('0x37')]?_0x15d040[_0x0c90('0x34')]:_0x30b9df[_0x0c90('0x33')];if(_0x399115[_0x0c90('0x31')][_0x0c90('0x42')]){_0x15d040[_0x0c90('0x43')]=[{'all':!![]}];}_0x15d040=_[_0x0c90('0x3f')]({},_0x15d040,_0x399115[_0x0c90('0x40')]);return db[_0x0c90('0x41')][_0x0c90('0x49')](_0x15d040)[_0x0c90('0x25')](handleEntityNotFound(_0x3c47c9,null))[_0x0c90('0x25')](respondWithResult(_0x3c47c9,null))[_0x0c90('0x45')](handleError(_0x3c47c9,null));};exports['create']=function(_0x1b4aac,_0x38f492){return db['VoiceMail']['create'](_0x1b4aac['body'],{})[_0x0c90('0x25')](function(_0x1205d0){var _0x460cf9=_0x1b4aac[_0x0c90('0x4a')][_0x0c90('0x4b')]({'plain':!![]});if(!_0x460cf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460cf9[_0x0c90('0x4c')]===_0x0c90('0x4a')){var _0x2b756d=_0x1205d0['get']({'plain':!![]});var _0x119776=_0x0c90('0x27');return db[_0x0c90('0x4d')][_0x0c90('0x49')]({'where':{'name':_0x119776,'userProfileId':_0x460cf9[_0x0c90('0x4e')]},'raw':!![]})[_0x0c90('0x25')](function(_0x42c121){if(_0x42c121&&_0x42c121[_0x0c90('0x4f')]===0x0){return db[_0x0c90('0x28')][_0x0c90('0x50')]({'name':_0x2b756d['name'],'resourceId':_0x2b756d['id'],'type':_0x42c121[_0x0c90('0x2a')],'sectionId':_0x42c121['id']},{})['then'](function(){return _0x1205d0;});}else{return _0x1205d0;}})[_0x0c90('0x45')](function(_0x67539d){logger[_0x0c90('0x29')](_0x0c90('0x51'),_0x67539d);throw _0x67539d;});}return _0x1205d0;})[_0x0c90('0x25')](respondWithResult(_0x38f492,0xc9))[_0x0c90('0x45')](handleError(_0x38f492,null));};exports['update']=function(_0x4930fc,_0x5382d9){if(_0x4930fc['body']['id']){delete _0x4930fc[_0x0c90('0x52')]['id'];}return db[_0x0c90('0x41')][_0x0c90('0x49')]({'where':{'id':_0x4930fc['params']['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x5382d9,null))[_0x0c90('0x25')](saveUpdates(_0x4930fc['body'],null))[_0x0c90('0x25')](respondWithResult(_0x5382d9,null))['catch'](handleError(_0x5382d9,null));};exports[_0x0c90('0x26')]=function(_0x8951f2,_0x42398b){return db[_0x0c90('0x41')]['find']({'where':{'id':_0x8951f2[_0x0c90('0x53')]['id']}})['then'](handleEntityNotFound(_0x42398b,null))[_0x0c90('0x25')](removeEntity(_0x42398b,null))[_0x0c90('0x45')](handleError(_0x42398b,null));};exports['getMessages']=function(_0x52b437,_0x51c356,_0x221fba){return db[_0x0c90('0x41')][_0x0c90('0x54')]({'where':{'id':_0x52b437[_0x0c90('0x53')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x51c356,null))['then'](function(_0x3bfd01){var _0x25ab13;var _0x5ee971={},_0x3eb725={};_0x3eb725['model']=_[_0x0c90('0x48')](db[_0x0c90('0x55')]['rawAttributes']);_0x3eb725[_0x0c90('0x31')]=_['keys'](_0x52b437['query']);_0x3eb725['filters']=_[_0x0c90('0x35')](_0x3eb725[_0x0c90('0x33')],_0x3eb725[_0x0c90('0x31')]);_0x5ee971[_0x0c90('0x34')]=_['intersection'](_0x3eb725['model'],qs[_0x0c90('0x36')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x36')]));_0x5ee971['attributes']=_0x5ee971[_0x0c90('0x34')][_0x0c90('0x37')]?_0x5ee971[_0x0c90('0x34')]:_0x3eb725['model'];if(!_0x52b437[_0x0c90('0x31')][_0x0c90('0x38')](_0x0c90('0x39'))){_0x5ee971['limit']=qs[_0x0c90('0x1f')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x5ee971[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1d')]);}_0x5ee971[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x52b437['query']['sort']);_0x5ee971[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x52b437[_0x0c90('0x31')],_0x3eb725[_0x0c90('0x32')]));if(_0x52b437[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x5ee971[_0x0c90('0x34')],function(_0x309152){var _0x164d4d={};_0x164d4d[_0x309152]={'$like':'%'+_0x52b437[_0x0c90('0x31')]['filter']+'%'};return _0x164d4d;})});}_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'mailboxuser':_0x3bfd01['mailbox']});_0x5ee971=_['merge']({},_0x5ee971,_0x52b437[_0x0c90('0x40')]);return db['VoiceMailMessage'][_0x0c90('0x56')](_0x5ee971)[_0x0c90('0x25')](respondWithFilteredResult(_0x51c356,_0x5ee971));})['catch'](handleError(_0x51c356,null));}; \ No newline at end of file +var _0x6324=['then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','keys','query','filters','intersection','model','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','rawAttributes','hasOwnProperty','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x371d15,_0xd98587){var _0x32afdf=function(_0x587ba3){while(--_0x587ba3){_0x371d15['push'](_0x371d15['shift']());}};_0x32afdf(++_0xd98587);}(_0x6324,0x142));var _0x4632=function(_0x3303c0,_0x1eaa43){_0x3303c0=_0x3303c0-0x0;var _0x454848=_0x6324[_0x3303c0];return _0x454848;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){var _0x3b0823=_0x1e1b86[_0x4632('0x28')]({'plain':!![]});var _0xb074d=_0x4632('0x29');return db[_0x4632('0x2a')][_0x4632('0x27')]({'where':{'type':_0xb074d,'resourceId':_0x3b0823['id']}})[_0x4632('0x26')](function(){return _0x1e1b86;});})[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0x438354,_0x4d9098){return function(_0x57798a){if(!_0x57798a){_0x438354[_0x4632('0x18')](0x194);}return _0x57798a;};}function handleError(_0x244743,_0x2f6656){_0x2f6656=_0x2f6656||0x1f4;return function(_0x35a533){logger[_0x4632('0x2b')](_0x35a533[_0x4632('0x2c')]);if(_0x35a533[_0x4632('0x2d')]){delete _0x35a533['name'];}_0x244743[_0x4632('0x19')](_0x2f6656)[_0x4632('0x2e')](_0x35a533);};}exports['index']=function(_0x216119,_0x5316f7){var _0x6599ad={},_0x4cb661={},_0x4fda35={'count':0x0,'rows':[]};var _0x1973eb=_[_0x4632('0x2f')](db[_0x4632('0x30')]['rawAttributes'],function(_0x5ed4d6){return{'name':_0x5ed4d6[_0x4632('0x31')],'type':_0x5ed4d6[_0x4632('0x32')]['key']};});_0x4cb661['model']=_[_0x4632('0x2f')](_0x1973eb,_0x4632('0x2d'));_0x4cb661['query']=_[_0x4632('0x33')](_0x216119[_0x4632('0x34')]);_0x4cb661[_0x4632('0x35')]=_[_0x4632('0x36')](_0x4cb661[_0x4632('0x37')],_0x4cb661['query']);_0x6599ad[_0x4632('0x38')]=_[_0x4632('0x36')](_0x4cb661['model'],qs['fields'](_0x216119[_0x4632('0x34')]['fields']));_0x6599ad['attributes']=_0x6599ad[_0x4632('0x38')]['length']?_0x6599ad[_0x4632('0x38')]:_0x4cb661[_0x4632('0x37')];if(!_0x216119[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x6599ad[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x216119[_0x4632('0x34')][_0x4632('0x1e')]);_0x6599ad['offset']=qs['offset'](_0x216119[_0x4632('0x34')][_0x4632('0x1c')]);}_0x6599ad[_0x4632('0x3a')]=qs['sort'](_0x216119['query']['sort']);_0x6599ad[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x216119[_0x4632('0x34')],_0x4cb661[_0x4632('0x35')]),_0x1973eb);if(_0x216119[_0x4632('0x34')][_0x4632('0x3c')]){_0x6599ad[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x6599ad[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x1973eb,function(_0x21c6a5){if(_0x21c6a5[_0x4632('0x32')]!==_0x4632('0x3e')){var _0x3b6258={};_0x3b6258[_0x21c6a5['name']]={'$like':'%'+_0x216119[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x3b6258;}})});}_0x6599ad=_['merge']({},_0x6599ad,_0x216119[_0x4632('0x3f')]);var _0x1c39bc={'where':_0x6599ad['where']};return db[_0x4632('0x30')]['count'](_0x1c39bc)[_0x4632('0x26')](function(_0x28df3b){_0x4fda35[_0x4632('0x1f')]=_0x28df3b;if(_0x216119[_0x4632('0x34')]['includeAll']){_0x6599ad[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x30')][_0x4632('0x41')](_0x6599ad);})[_0x4632('0x26')](function(_0x5cc716){_0x4fda35['rows']=_0x5cc716;return _0x4fda35;})[_0x4632('0x26')](respondWithFilteredResult(_0x5316f7,_0x6599ad))[_0x4632('0x42')](handleError(_0x5316f7,null));};exports[_0x4632('0x43')]=function(_0x512db1,_0x330f21){var _0x1467c8={'raw':!![],'where':{'id':_0x512db1[_0x4632('0x44')]['id']}},_0x66598d={};_0x66598d[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')]['rawAttributes']);_0x66598d[_0x4632('0x34')]=_[_0x4632('0x33')](_0x512db1[_0x4632('0x34')]);_0x66598d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x66598d['model'],_0x66598d['query']);_0x1467c8[_0x4632('0x38')]=_[_0x4632('0x36')](_0x66598d[_0x4632('0x37')],qs[_0x4632('0x45')](_0x512db1['query'][_0x4632('0x45')]));_0x1467c8[_0x4632('0x38')]=_0x1467c8[_0x4632('0x38')][_0x4632('0x46')]?_0x1467c8[_0x4632('0x38')]:_0x66598d['model'];if(_0x512db1[_0x4632('0x34')][_0x4632('0x47')]){_0x1467c8[_0x4632('0x40')]=[{'all':!![]}];}_0x1467c8=_[_0x4632('0x3d')]({},_0x1467c8,_0x512db1[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0x1467c8)[_0x4632('0x26')](handleEntityNotFound(_0x330f21,null))[_0x4632('0x26')](respondWithResult(_0x330f21,null))[_0x4632('0x42')](handleError(_0x330f21,null));};exports[_0x4632('0x49')]=function(_0x517584,_0xc3ffd0){return db[_0x4632('0x30')][_0x4632('0x49')](_0x517584['body'],{})[_0x4632('0x26')](function(_0x5f4fb5){var _0x1309aa=_0x517584[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x1309aa)throw new Error(_0x4632('0x4b'));if(_0x1309aa[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x1f43b6=_0x5f4fb5[_0x4632('0x28')]({'plain':!![]});var _0x4e89e3=_0x4632('0x29');return db[_0x4632('0x4d')]['find']({'where':{'name':_0x4e89e3,'userProfileId':_0x1309aa[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x18cc47){if(_0x18cc47&&_0x18cc47[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x1f43b6[_0x4632('0x2d')],'resourceId':_0x1f43b6['id'],'type':_0x18cc47[_0x4632('0x2d')],'sectionId':_0x18cc47['id']},{})[_0x4632('0x26')](function(){return _0x5f4fb5;});}else{return _0x5f4fb5;}})[_0x4632('0x42')](function(_0x3e66d8){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x3e66d8);throw _0x3e66d8;});}return _0x5f4fb5;})[_0x4632('0x26')](respondWithResult(_0xc3ffd0,0xc9))[_0x4632('0x42')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x25')]=function(_0x32cd35,_0x6c2864){if(_0x32cd35[_0x4632('0x51')]['id']){delete _0x32cd35[_0x4632('0x51')]['id'];}return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x32cd35[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x6c2864,null))[_0x4632('0x26')](saveUpdates(_0x32cd35[_0x4632('0x51')],null))[_0x4632('0x26')](respondWithResult(_0x6c2864,null))['catch'](handleError(_0x6c2864,null));};exports[_0x4632('0x27')]=function(_0x433fea,_0x41409d){return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x433fea[_0x4632('0x44')]['id']}})['then'](handleEntityNotFound(_0x41409d,null))[_0x4632('0x26')](removeEntity(_0x41409d,null))[_0x4632('0x42')](handleError(_0x41409d,null));};exports[_0x4632('0x52')]=function(_0x4b91cf,_0x3aeefd,_0x334a8e){return db[_0x4632('0x30')][_0x4632('0x53')]({'where':{'id':_0x4b91cf[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3aeefd,null))[_0x4632('0x26')](function(_0x4658de){var _0x2965df;var _0x3abcbf={},_0x58d39a={};_0x58d39a[_0x4632('0x37')]=_[_0x4632('0x33')](db['VoiceMailMessage'][_0x4632('0x54')]);_0x58d39a['query']=_['keys'](_0x4b91cf[_0x4632('0x34')]);_0x58d39a[_0x4632('0x35')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],_0x58d39a[_0x4632('0x34')]);_0x3abcbf[_0x4632('0x38')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],qs[_0x4632('0x45')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x45')]));_0x3abcbf[_0x4632('0x38')]=_0x3abcbf[_0x4632('0x38')][_0x4632('0x46')]?_0x3abcbf['attributes']:_0x58d39a['model'];if(!_0x4b91cf[_0x4632('0x34')][_0x4632('0x55')](_0x4632('0x39'))){_0x3abcbf[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x4b91cf[_0x4632('0x34')]['limit']);_0x3abcbf[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x1c')]);}_0x3abcbf['order']=qs['sort'](_0x4b91cf[_0x4632('0x34')]['sort']);_0x3abcbf[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x56')](_0x4b91cf[_0x4632('0x34')],_0x58d39a[_0x4632('0x35')]));if(_0x4b91cf['query'][_0x4632('0x3c')]){_0x3abcbf[_0x4632('0x3b')]=_['merge'](_0x3abcbf['where'],{'$or':_[_0x4632('0x2f')](_0x3abcbf[_0x4632('0x38')],function(_0x47391f){var _0x3090d6={};_0x3090d6[_0x47391f]={'$like':'%'+_0x4b91cf['query']['filter']+'%'};return _0x3090d6;})});}_0x3abcbf['where']=_[_0x4632('0x3d')](_0x3abcbf['where'],{'mailboxuser':_0x4658de[_0x4632('0x57')]});_0x3abcbf=_[_0x4632('0x3d')]({},_0x3abcbf,_0x4b91cf[_0x4632('0x3f')]);return db[_0x4632('0x58')][_0x4632('0x59')](_0x3abcbf)[_0x4632('0x26')](respondWithFilteredResult(_0x3aeefd,_0x3abcbf));})[_0x4632('0x42')](handleError(_0x3aeefd,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d115a2c..f316921 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 _0x8888=['../../config/environment','exports','define','voice_voicemail','mailbox_context','mailbox','context','util','api','moment','request-promise','path','rimraf'];(function(_0x59a3b8,_0x3ce69b){var _0x44e0da=function(_0xfe40c9){while(--_0xfe40c9){_0x59a3b8['push'](_0x59a3b8['shift']());}};_0x44e0da(++_0x3ce69b);}(_0x8888,0x159));var _0x8888=function(_0x44a9b1,_0x36cc5a){_0x44a9b1=_0x44a9b1-0x0;var _0x52e311=_0x8888[_0x44a9b1];return _0x52e311;};'use strict';var _=require('lodash');var util=require(_0x8888('0x0'));var logger=require('../../config/logger')(_0x8888('0x1'));var moment=require(_0x8888('0x2'));var BPromise=require('bluebird');var rp=require(_0x8888('0x3'));var fs=require('fs');var path=require(_0x8888('0x4'));var rimraf=require(_0x8888('0x5'));var config=require(_0x8888('0x6'));var attributes=require('./voiceMail.attributes');module[_0x8888('0x7')]=function(_0x46be0a,_0x4d1d6e){return _0x46be0a[_0x8888('0x8')]('VoiceMail',attributes,{'tableName':_0x8888('0x9'),'paranoid':![],'indexes':[{'name':_0x8888('0xa'),'fields':[_0x8888('0xb'),_0x8888('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18fc=['define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x371487,_0x34a547){var _0x1feede=function(_0x1720da){while(--_0x1720da){_0x371487['push'](_0x371487['shift']());}};_0x1feede(++_0x34a547);}(_0x18fc,0xb9));var _0xc18f=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x18fc[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0xc18f('0x0'));var util=require('util');var logger=require(_0xc18f('0x1'))('api');var moment=require(_0xc18f('0x2'));var BPromise=require(_0xc18f('0x3'));var rp=require(_0xc18f('0x4'));var fs=require('fs');var path=require(_0xc18f('0x5'));var rimraf=require(_0xc18f('0x6'));var config=require(_0xc18f('0x7'));var attributes=require(_0xc18f('0x8'));module[_0xc18f('0x9')]=function(_0x4e18fd,_0x4b03a9){return _0x4e18fd[_0xc18f('0xa')](_0xc18f('0xb'),attributes,{'tableName':_0xc18f('0xc'),'paranoid':![],'indexes':[{'name':_0xc18f('0xd'),'fields':['mailbox',_0xc18f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8f15444..8f6405a 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 _0x4aab=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x4aab,0x110));var _0xb4aa=function(_0x27e2c9,_0x1483c7){_0x27e2c9=_0x27e2c9-0x0;var _0x55ca8c=_0x4aab[_0x27e2c9];return _0x55ca8c;};'use strict';var _=require(_0xb4aa('0x0'));var util=require(_0xb4aa('0x1'));var moment=require(_0xb4aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xb4aa('0x3'));var fs=require('fs');var Redis=require(_0xb4aa('0x4'));var db=require(_0xb4aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4aa('0x6'))(_0xb4aa('0x7'));var config=require(_0xb4aa('0x8'));var jayson=require(_0xb4aa('0x9'));var client=jayson['client'][_0xb4aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x98fd22,_0x16b56b,_0x2e0cec){return new BPromise(function(_0x19f5b8,_0x116c5c){return client[_0xb4aa('0xb')](_0x98fd22,_0x2e0cec)[_0xb4aa('0xc')](function(_0x1d3079){logger[_0xb4aa('0xd')](_0xb4aa('0xe'),_0x16b56b,'request\x20sent');logger['debug'](_0xb4aa('0xf'),_0x16b56b,_0xb4aa('0x10'),JSON[_0xb4aa('0x11')](_0x1d3079));if(_0x1d3079['error']){if(_0x1d3079['error']['code']===0x1f4){logger['error'](_0xb4aa('0xe'),_0x16b56b,_0x1d3079[_0xb4aa('0x12')]['message']);return _0x116c5c(_0x1d3079[_0xb4aa('0x12')][_0xb4aa('0x13')]);}logger[_0xb4aa('0x12')](_0xb4aa('0xe'),_0x16b56b,_0x1d3079['error'][_0xb4aa('0x13')]);return _0x19f5b8(_0x1d3079[_0xb4aa('0x12')][_0xb4aa('0x13')]);}else{logger[_0xb4aa('0xd')]('VoiceMail,\x20%s,\x20%s',_0x16b56b,_0xb4aa('0x10'));_0x19f5b8(_0x1d3079['result']['message']);}})[_0xb4aa('0x14')](function(_0xc663d7){logger[_0xb4aa('0x12')](_0xb4aa('0xe'),_0x16b56b,_0xc663d7);_0x116c5c(_0xc663d7);});});} \ No newline at end of file +var _0xcada=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x501c07,_0x1ab123){var _0x73f130=function(_0x2469b7){while(--_0x2469b7){_0x501c07['push'](_0x501c07['shift']());}};_0x73f130(++_0x1ab123);}(_0xcada,0xbd));var _0xacad=function(_0x5aff81,_0x40631b){_0x5aff81=_0x5aff81-0x0;var _0x3d3713=_0xcada[_0x5aff81];return _0x3d3713;};'use strict';var _=require(_0xacad('0x0'));var util=require(_0xacad('0x1'));var moment=require(_0xacad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacad('0x3'));var db=require(_0xacad('0x4'))['db'];var utils=require(_0xacad('0x5'));var logger=require(_0xacad('0x6'))('rpc');var config=require(_0xacad('0x7'));var jayson=require(_0xacad('0x8'));var client=jayson[_0xacad('0x9')][_0xacad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c24fa,_0x42ce84,_0x5174c3){return new BPromise(function(_0x57c662,_0x16d335){return client[_0xacad('0xb')](_0x1c24fa,_0x5174c3)[_0xacad('0xc')](function(_0x4989df){logger[_0xacad('0xd')](_0xacad('0xe'),_0x42ce84,_0xacad('0xf'));logger[_0xacad('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x42ce84,'request\x20sent',JSON[_0xacad('0x11')](_0x4989df));if(_0x4989df[_0xacad('0x12')]){if(_0x4989df[_0xacad('0x12')][_0xacad('0x13')]===0x1f4){logger['error'](_0xacad('0xe'),_0x42ce84,_0x4989df[_0xacad('0x12')][_0xacad('0x14')]);return _0x16d335(_0x4989df[_0xacad('0x12')][_0xacad('0x14')]);}logger[_0xacad('0x12')]('VoiceMail,\x20%s,\x20%s',_0x42ce84,_0x4989df[_0xacad('0x12')][_0xacad('0x14')]);return _0x57c662(_0x4989df[_0xacad('0x12')][_0xacad('0x14')]);}else{logger['info'](_0xacad('0xe'),_0x42ce84,_0xacad('0xf'));_0x57c662(_0x4989df[_0xacad('0x15')][_0xacad('0x14')]);}})[_0xacad('0x16')](function(_0x99d5dc){logger[_0xacad('0x12')](_0xacad('0xe'),_0x42ce84,_0x99d5dc);_0x16d335(_0x99d5dc);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6665b62..269681b 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 _0x3658=['index','/:id','/:id/download','download','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x3658,0x95));var _0x8365=function(_0x549820,_0x4f91f2){_0x549820=_0x549820-0x0;var _0x181413=_0x3658[_0x549820];return _0x181413;};'use strict';var multer=require(_0x8365('0x0'));var util=require(_0x8365('0x1'));var path=require('path');var timeout=require(_0x8365('0x2'));var express=require(_0x8365('0x3'));var router=express[_0x8365('0x4')]();var fs_extra=require(_0x8365('0x5'));var auth=require(_0x8365('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8365('0x7'));var controller=require(_0x8365('0x8'));router[_0x8365('0x9')]('/',auth[_0x8365('0xa')](),controller[_0x8365('0xb')]);router[_0x8365('0x9')](_0x8365('0xc'),auth[_0x8365('0xa')](),controller['show']);router['get'](_0x8365('0xd'),auth[_0x8365('0xa')](),controller[_0x8365('0xe')]);router['post']('/',auth[_0x8365('0xa')](),controller[_0x8365('0xf')]);router[_0x8365('0x10')]('/:id',auth[_0x8365('0xa')](),controller[_0x8365('0x11')]);router['delete'](_0x8365('0xc'),auth[_0x8365('0xa')](),controller[_0x8365('0x12')]);module[_0x8365('0x13')]=router; \ No newline at end of file +var _0x8983=['show','/:id/download','download','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated'];(function(_0x120891,_0x415544){var _0x2c52b7=function(_0x35ca89){while(--_0x35ca89){_0x120891['push'](_0x120891['shift']());}};_0x2c52b7(++_0x415544);}(_0x8983,0x1ac));var _0x3898=function(_0x31c32e,_0x4c2442){_0x31c32e=_0x31c32e-0x0;var _0x3d39b1=_0x8983[_0x31c32e];return _0x3d39b1;};'use strict';var multer=require(_0x3898('0x0'));var util=require(_0x3898('0x1'));var path=require(_0x3898('0x2'));var timeout=require(_0x3898('0x3'));var express=require(_0x3898('0x4'));var router=express[_0x3898('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3898('0x6'));var config=require(_0x3898('0x7'));var controller=require(_0x3898('0x8'));router[_0x3898('0x9')]('/',auth['isAuthenticated'](),controller[_0x3898('0xa')]);router[_0x3898('0x9')]('/:id',auth[_0x3898('0xb')](),controller[_0x3898('0xc')]);router[_0x3898('0x9')](_0x3898('0xd'),auth[_0x3898('0xb')](),controller[_0x3898('0xe')]);router[_0x3898('0xf')]('/',auth[_0x3898('0xb')](),controller['create']);router[_0x3898('0x10')](_0x3898('0x11'),auth[_0x3898('0xb')](),controller[_0x3898('0x12')]);router[_0x3898('0x13')](_0x3898('0x11'),auth[_0x3898('0xb')](),controller[_0x3898('0x14')]);module[_0x3898('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 631d125..70a5d1b 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 _0x9a6a=['VIRTUAL','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x49a9b1,_0x58f656){var _0x269b11=function(_0x2291bf){while(--_0x2291bf){_0x49a9b1['push'](_0x49a9b1['shift']());}};_0x269b11(++_0x58f656);}(_0x9a6a,0x1a6));var _0xa9a6=function(_0x2bc0ea,_0x554f1f){_0x2bc0ea=_0x2bc0ea-0x0;var _0x3f2107=_0x9a6a[_0x2bc0ea];return _0x3f2107;};'use strict';var Sequelize=require(_0xa9a6('0x0'));module[_0xa9a6('0x1')]={'name':{'type':Sequelize[_0xa9a6('0x2')],'get':function(_0x3e4e9a){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xa9a6('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xa9a6('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa9a6('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa9a6('0x6')](_0xa9a6('0x7'))}}; \ No newline at end of file +var _0x9d58=['sequelize','exports','VIRTUAL','STRING','long'];(function(_0x41393a,_0xb93e63){var _0x9d51cd=function(_0x378b37){while(--_0x378b37){_0x41393a['push'](_0x41393a['shift']());}};_0x9d51cd(++_0xb93e63);}(_0x9d58,0xff));var _0x89d5=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0x9d58[_0x47f4c2];return _0x22c63e;};'use strict';var Sequelize=require(_0x89d5('0x0'));module[_0x89d5('0x1')]={'name':{'type':Sequelize[_0x89d5('0x2')],'get':function(_0xd2ef18){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x89d5('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x89d5('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x89d5('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x89d5('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x89d5('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x89d5('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x89d5('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 71f8729..c48399e 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 _0x8751=['where','pick','merge','filter','include','findAll','catch','show','params','length','options','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort'];(function(_0x4d00af,_0x57680d){var _0x59c469=function(_0x181f68){while(--_0x181f68){_0x4d00af['push'](_0x4d00af['shift']());}};_0x59c469(++_0x57680d);}(_0x8751,0x68));var _0x1875=function(_0x13ecce,_0xe1b174){_0x13ecce=_0x13ecce-0x0;var _0x29f3ab=_0x8751[_0x13ecce];return _0x29f3ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1875('0x0'));var zipdir=require(_0x1875('0x1'));var jsonpatch=require(_0x1875('0x2'));var rp=require(_0x1875('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1875('0x4'));var util=require(_0x1875('0x5'));var path=require(_0x1875('0x6'));var sox=require(_0x1875('0x7'));var csv=require(_0x1875('0x8'));var ejs=require(_0x1875('0x9'));var fs=require('fs');var fs_extra=require(_0x1875('0xa'));var _=require('lodash');var squel=require(_0x1875('0xb'));var crypto=require(_0x1875('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1875('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1875('0xe'));var Papa=require(_0x1875('0xf'));var Redis=require(_0x1875('0x10'));var authService=require(_0x1875('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1875('0x12'));var hardwareService=require(_0x1875('0x13'));var logger=require('../../config/logger')(_0x1875('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1875('0x15'))['db'];function respondWithStatusCode(_0x4df44d,_0x52708a){_0x52708a=_0x52708a||0xcc;return function(_0x2a0952){if(_0x2a0952){return _0x4df44d[_0x1875('0x16')](_0x52708a);}return _0x4df44d['status'](_0x52708a)[_0x1875('0x17')]();};}function respondWithResult(_0x4d68ca,_0x488cd7){_0x488cd7=_0x488cd7||0xc8;return function(_0x571c17){if(_0x571c17){return _0x4d68ca[_0x1875('0x18')](_0x488cd7)[_0x1875('0x19')](_0x571c17);}};}function respondWithFilteredResult(_0x37aaa3,_0x3ae95b){return function(_0x219025){if(_0x219025){var _0x32b21f=typeof _0x3ae95b[_0x1875('0x1a')]===_0x1875('0x1b')&&typeof _0x3ae95b['limit']===_0x1875('0x1b');var _0x5ae986=_0x219025[_0x1875('0x1c')];var _0x45e1b3=_0x32b21f?0x0:_0x3ae95b[_0x1875('0x1a')];var _0x18aa1b=_0x32b21f?_0x219025['count']:_0x3ae95b['offset']+_0x3ae95b[_0x1875('0x1d')];var _0x23316b;if(_0x18aa1b>=_0x5ae986){_0x18aa1b=_0x5ae986;_0x23316b=0xc8;}else{_0x23316b=0xce;}_0x37aaa3[_0x1875('0x18')](_0x23316b);return _0x37aaa3[_0x1875('0x1e')](_0x1875('0x1f'),_0x45e1b3+'-'+_0x18aa1b+'/'+_0x5ae986)[_0x1875('0x19')](_0x219025);}return null;};}function patchUpdates(_0x3f5bd6){return function(_0x38a613){try{jsonpatch[_0x1875('0x20')](_0x38a613,_0x3f5bd6,!![]);}catch(_0x1f9bd7){return BPromise[_0x1875('0x21')](_0x1f9bd7);}return _0x38a613[_0x1875('0x22')]();};}function saveUpdates(_0x11d9ec,_0x14c779){return function(_0x350455){if(_0x350455){return _0x350455[_0x1875('0x23')](_0x11d9ec)[_0x1875('0x24')](function(_0x343260){return _0x343260;});}return null;};}function removeEntity(_0x413f51,_0x5667ac){return function(_0x1a4047){if(_0x1a4047){return _0x1a4047[_0x1875('0x25')]()[_0x1875('0x24')](function(){_0x413f51['status'](0xcc)[_0x1875('0x17')]();});}};}function handleEntityNotFound(_0x38c124,_0x4d5858){return function(_0x1cf2fc){if(!_0x1cf2fc){_0x38c124['sendStatus'](0x194);}return _0x1cf2fc;};}function handleError(_0x4e6bd7,_0x58fa29){_0x58fa29=_0x58fa29||0x1f4;return function(_0x15fbc6){logger[_0x1875('0x26')](_0x15fbc6['stack']);if(_0x15fbc6[_0x1875('0x27')]){delete _0x15fbc6[_0x1875('0x27')];}_0x4e6bd7[_0x1875('0x18')](_0x58fa29)['send'](_0x15fbc6);};}exports[_0x1875('0x28')]=function(_0x1a5bba,_0x2d42d3){var _0x397b65={},_0x30a1fa={},_0x3748d0={'count':0x0,'rows':[]};var _0x4c9412=_[_0x1875('0x29')](db[_0x1875('0x2a')][_0x1875('0x2b')],function(_0x44586a){return{'name':_0x44586a[_0x1875('0x2c')],'type':_0x44586a[_0x1875('0x2d')][_0x1875('0x2e')]};});_0x30a1fa[_0x1875('0x2f')]=_[_0x1875('0x30')](_[_0x1875('0x29')](_0x4c9412,'name'),[_0x1875('0x27')]);_0x30a1fa[_0x1875('0x31')]=_[_0x1875('0x32')](_0x1a5bba[_0x1875('0x31')]);_0x30a1fa[_0x1875('0x33')]=_['intersection'](_0x30a1fa[_0x1875('0x2f')],_0x30a1fa[_0x1875('0x31')]);_0x397b65[_0x1875('0x34')]=_[_0x1875('0x35')](_0x30a1fa[_0x1875('0x2f')],qs[_0x1875('0x36')](_0x1a5bba[_0x1875('0x31')]['fields']));_0x397b65['attributes']=_0x397b65[_0x1875('0x34')]['length']?_0x397b65['attributes']:_0x30a1fa[_0x1875('0x2f')];if(!_0x1a5bba[_0x1875('0x31')][_0x1875('0x37')](_0x1875('0x38'))){_0x397b65[_0x1875('0x1d')]=qs[_0x1875('0x1d')](_0x1a5bba[_0x1875('0x31')]['limit']);_0x397b65[_0x1875('0x1a')]=qs['offset'](_0x1a5bba[_0x1875('0x31')][_0x1875('0x1a')]);}_0x397b65['order']=qs[_0x1875('0x39')](_0x1a5bba[_0x1875('0x31')][_0x1875('0x39')]);_0x397b65[_0x1875('0x3a')]=qs[_0x1875('0x33')](_[_0x1875('0x3b')](_0x1a5bba['query'],_0x30a1fa[_0x1875('0x33')]),_0x4c9412);if(_0x1a5bba['query']['filter']){_0x397b65[_0x1875('0x3a')]=_[_0x1875('0x3c')](_0x397b65['where'],{'$or':_[_0x1875('0x29')](_0x4c9412,function(_0x233404){if(_0x233404[_0x1875('0x2d')]!=='VIRTUAL'){var _0x18f378={};_0x18f378[_0x233404['name']]={'$like':'%'+_0x1a5bba[_0x1875('0x31')][_0x1875('0x3d')]+'%'};return _0x18f378;}})});}_0x397b65=_[_0x1875('0x3c')]({},_0x397b65,_0x1a5bba['options']);var _0x1b32d6={'where':_0x397b65[_0x1875('0x3a')]};return db[_0x1875('0x2a')][_0x1875('0x1c')](_0x1b32d6)[_0x1875('0x24')](function(_0x5eb916){_0x3748d0['count']=_0x5eb916;if(_0x1a5bba[_0x1875('0x31')]['includeAll']){_0x397b65[_0x1875('0x3e')]=[{'all':!![]}];}return db[_0x1875('0x2a')][_0x1875('0x3f')](_0x397b65);})['then'](function(_0xc425){_0x3748d0['rows']=_0xc425;return _0x3748d0;})[_0x1875('0x24')](respondWithFilteredResult(_0x2d42d3,_0x397b65))[_0x1875('0x40')](handleError(_0x2d42d3,null));};exports[_0x1875('0x41')]=function(_0x25cded,_0x551431){var _0x1f8a7f={'raw':!![],'where':{'id':_0x25cded[_0x1875('0x42')]['id']}},_0x41ea5a={};_0x41ea5a[_0x1875('0x2f')]=_[_0x1875('0x32')](db['VoiceMailMessage'][_0x1875('0x2b')]);_0x41ea5a['query']=_[_0x1875('0x32')](_0x25cded[_0x1875('0x31')]);_0x41ea5a['filters']=_[_0x1875('0x35')](_0x41ea5a[_0x1875('0x2f')],_0x41ea5a[_0x1875('0x31')]);_0x1f8a7f[_0x1875('0x34')]=_[_0x1875('0x35')](_0x41ea5a[_0x1875('0x2f')],qs[_0x1875('0x36')](_0x25cded[_0x1875('0x31')][_0x1875('0x36')]));_0x1f8a7f[_0x1875('0x34')]=_0x1f8a7f[_0x1875('0x34')][_0x1875('0x43')]?_0x1f8a7f['attributes']:_0x41ea5a['model'];if(_0x25cded[_0x1875('0x31')]['includeAll']){_0x1f8a7f[_0x1875('0x3e')]=[{'all':!![]}];}_0x1f8a7f=_[_0x1875('0x3c')]({},_0x1f8a7f,_0x25cded[_0x1875('0x44')]);return db[_0x1875('0x2a')][_0x1875('0x45')](_0x1f8a7f)[_0x1875('0x24')](handleEntityNotFound(_0x551431,null))[_0x1875('0x24')](respondWithResult(_0x551431,null))[_0x1875('0x40')](handleError(_0x551431,null));};exports[_0x1875('0x46')]=function(_0xf7e09a,_0x23afe3){return db['VoiceMailMessage'][_0x1875('0x46')](_0xf7e09a['body'],{})['then'](respondWithResult(_0x23afe3,0xc9))['catch'](handleError(_0x23afe3,null));};exports[_0x1875('0x23')]=function(_0x50d537,_0x4d9bef){if(_0x50d537['body']['id']){delete _0x50d537[_0x1875('0x47')]['id'];}return db[_0x1875('0x2a')][_0x1875('0x45')]({'where':{'id':_0x50d537[_0x1875('0x42')]['id']}})[_0x1875('0x24')](handleEntityNotFound(_0x4d9bef,null))['then'](saveUpdates(_0x50d537[_0x1875('0x47')],null))[_0x1875('0x24')](respondWithResult(_0x4d9bef,null))[_0x1875('0x40')](handleError(_0x4d9bef,null));};exports[_0x1875('0x25')]=function(_0x2f9e95,_0x4ba9b0){return db['VoiceMailMessage']['find']({'where':{'id':_0x2f9e95[_0x1875('0x42')]['id']}})[_0x1875('0x24')](handleEntityNotFound(_0x4ba9b0,null))[_0x1875('0x24')](removeEntity(_0x4ba9b0,null))[_0x1875('0x40')](handleError(_0x4ba9b0,null));};exports[_0x1875('0x48')]=function(_0x2b310a,_0x2729a2,_0x31fad1){return db[_0x1875('0x2a')][_0x1875('0x45')]({'where':{'id':_0x2b310a[_0x1875('0x42')]['id']},'attributes':['id',_0x1875('0x49'),_0x1875('0x4a')]})[_0x1875('0x24')](handleEntityNotFound(_0x2729a2,null))[_0x1875('0x24')](function(_0x53b0ec){if(_0x53b0ec){if(!_0x53b0ec[_0x1875('0x49')]){throw new db[(_0x1875('0x4b'))]['ValidationError'](_0x1875('0x4c'));}var _0x23b3d1={'Content-Type':_0x1875('0x4d'),'Content-Disposition':_0x1875('0x4e')};if(_0x53b0ec[_0x1875('0x4a')]){_0x23b3d1[_0x1875('0x4f')]=_0x1875('0x50')+_0x53b0ec[_0x1875('0x4a')]+'.wav\x22';}_0x2729a2[_0x1875('0x1e')](_0x23b3d1);return _0x2729a2['send'](new Buffer(_0x53b0ec[_0x1875('0x49')]));}})['catch'](handleError(_0x2729a2,null));}; \ No newline at end of file +var _0x4770=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','msg_id','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x3e547e,_0x146006){var _0x3f6aae=function(_0x275f56){while(--_0x275f56){_0x3e547e['push'](_0x3e547e['shift']());}};_0x3f6aae(++_0x146006);}(_0x4770,0x148));var _0x0477=function(_0x322b7b,_0x3e94a2){_0x322b7b=_0x322b7b-0x0;var _0x4a75a6=_0x4770[_0x322b7b];return _0x4a75a6;};'use strict';var emlformat=require(_0x0477('0x0'));var rimraf=require(_0x0477('0x1'));var zipdir=require(_0x0477('0x2'));var jsonpatch=require(_0x0477('0x3'));var rp=require(_0x0477('0x4'));var moment=require(_0x0477('0x5'));var BPromise=require(_0x0477('0x6'));var Mustache=require(_0x0477('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0477('0x8'));var csv=require(_0x0477('0x9'));var ejs=require(_0x0477('0xa'));var fs=require('fs');var fs_extra=require(_0x0477('0xb'));var _=require('lodash');var squel=require(_0x0477('0xc'));var crypto=require(_0x0477('0xd'));var jsforce=require(_0x0477('0xe'));var deskjs=require(_0x0477('0xf'));var toCsv=require(_0x0477('0x9'));var querystring=require(_0x0477('0x10'));var Papa=require(_0x0477('0x11'));var Redis=require('ioredis');var authService=require(_0x0477('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0477('0x13'));var hardwareService=require(_0x0477('0x14'));var logger=require('../../config/logger')(_0x0477('0x15'));var utils=require(_0x0477('0x16'));var config=require(_0x0477('0x17'));var licenseUtil=require(_0x0477('0x18'));var db=require(_0x0477('0x19'))['db'];function respondWithStatusCode(_0x76be59,_0xb07d19){_0xb07d19=_0xb07d19||0xcc;return function(_0x10a181){if(_0x10a181){return _0x76be59[_0x0477('0x1a')](_0xb07d19);}return _0x76be59[_0x0477('0x1b')](_0xb07d19)[_0x0477('0x1c')]();};}function respondWithResult(_0xccbc03,_0xcb2cfb){_0xcb2cfb=_0xcb2cfb||0xc8;return function(_0x20e528){if(_0x20e528){return _0xccbc03['status'](_0xcb2cfb)[_0x0477('0x1d')](_0x20e528);}};}function respondWithFilteredResult(_0x27e6f1,_0x1ad80a){return function(_0x3ec0e0){if(_0x3ec0e0){var _0x14c230=typeof _0x1ad80a[_0x0477('0x1e')]===_0x0477('0x1f')&&typeof _0x1ad80a[_0x0477('0x20')]===_0x0477('0x1f');var _0x156798=_0x3ec0e0[_0x0477('0x21')];var _0x94edf1=_0x14c230?0x0:_0x1ad80a['offset'];var _0x585caf=_0x14c230?_0x3ec0e0[_0x0477('0x21')]:_0x1ad80a[_0x0477('0x1e')]+_0x1ad80a[_0x0477('0x20')];var _0x36bf28;if(_0x585caf>=_0x156798){_0x585caf=_0x156798;_0x36bf28=0xc8;}else{_0x36bf28=0xce;}_0x27e6f1[_0x0477('0x1b')](_0x36bf28);return _0x27e6f1['set']('Content-Range',_0x94edf1+'-'+_0x585caf+'/'+_0x156798)[_0x0477('0x1d')](_0x3ec0e0);}return null;};}function patchUpdates(_0x16729f){return function(_0x5ec621){try{jsonpatch[_0x0477('0x22')](_0x5ec621,_0x16729f,!![]);}catch(_0x2e6369){return BPromise[_0x0477('0x23')](_0x2e6369);}return _0x5ec621[_0x0477('0x24')]();};}function saveUpdates(_0x6e35db,_0x425c89){return function(_0xb28962){if(_0xb28962){return _0xb28962[_0x0477('0x25')](_0x6e35db)[_0x0477('0x26')](function(_0x4b5987){return _0x4b5987;});}return null;};}function removeEntity(_0x5dd6a4,_0x4d9587){return function(_0x283234){if(_0x283234){return _0x283234[_0x0477('0x27')]()[_0x0477('0x26')](function(){_0x5dd6a4[_0x0477('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff1323,_0x3c2620){return function(_0x435c4d){if(!_0x435c4d){_0xff1323[_0x0477('0x1a')](0x194);}return _0x435c4d;};}function handleError(_0x50beb6,_0x2cb808){_0x2cb808=_0x2cb808||0x1f4;return function(_0x36eade){logger['error'](_0x36eade[_0x0477('0x28')]);if(_0x36eade[_0x0477('0x29')]){delete _0x36eade['name'];}_0x50beb6[_0x0477('0x1b')](_0x2cb808)[_0x0477('0x2a')](_0x36eade);};}exports[_0x0477('0x2b')]=function(_0x2dd0e4,_0x369991){var _0x4d2a4c={},_0x5d54da={},_0x550de5={'count':0x0,'rows':[]};var _0x178f35=_['map'](db[_0x0477('0x2c')][_0x0477('0x2d')],function(_0x2e39c8){return{'name':_0x2e39c8[_0x0477('0x2e')],'type':_0x2e39c8[_0x0477('0x2f')][_0x0477('0x30')]};});_0x5d54da[_0x0477('0x31')]=_[_0x0477('0x32')](_[_0x0477('0x33')](_0x178f35,_0x0477('0x29')),['name']);_0x5d54da['query']=_['keys'](_0x2dd0e4[_0x0477('0x34')]);_0x5d54da['filters']=_[_0x0477('0x35')](_0x5d54da[_0x0477('0x31')],_0x5d54da[_0x0477('0x34')]);_0x4d2a4c[_0x0477('0x36')]=_[_0x0477('0x35')](_0x5d54da['model'],qs[_0x0477('0x37')](_0x2dd0e4[_0x0477('0x34')]['fields']));_0x4d2a4c[_0x0477('0x36')]=_0x4d2a4c['attributes']['length']?_0x4d2a4c[_0x0477('0x36')]:_0x5d54da[_0x0477('0x31')];if(!_0x2dd0e4[_0x0477('0x34')][_0x0477('0x38')](_0x0477('0x39'))){_0x4d2a4c[_0x0477('0x20')]=qs['limit'](_0x2dd0e4['query']['limit']);_0x4d2a4c[_0x0477('0x1e')]=qs[_0x0477('0x1e')](_0x2dd0e4[_0x0477('0x34')][_0x0477('0x1e')]);}_0x4d2a4c[_0x0477('0x3a')]=qs[_0x0477('0x3b')](_0x2dd0e4[_0x0477('0x34')][_0x0477('0x3b')]);_0x4d2a4c['where']=qs[_0x0477('0x3c')](_[_0x0477('0x3d')](_0x2dd0e4[_0x0477('0x34')],_0x5d54da[_0x0477('0x3c')]),_0x178f35);if(_0x2dd0e4['query'][_0x0477('0x3e')]){_0x4d2a4c[_0x0477('0x3f')]=_[_0x0477('0x40')](_0x4d2a4c[_0x0477('0x3f')],{'$or':_['map'](_0x178f35,function(_0x438e26){if(_0x438e26['type']!==_0x0477('0x41')){var _0x52ae21={};_0x52ae21[_0x438e26[_0x0477('0x29')]]={'$like':'%'+_0x2dd0e4[_0x0477('0x34')][_0x0477('0x3e')]+'%'};return _0x52ae21;}})});}_0x4d2a4c=_[_0x0477('0x40')]({},_0x4d2a4c,_0x2dd0e4[_0x0477('0x42')]);var _0x3a0894={'where':_0x4d2a4c[_0x0477('0x3f')]};return db['VoiceMailMessage'][_0x0477('0x21')](_0x3a0894)['then'](function(_0x308509){_0x550de5['count']=_0x308509;if(_0x2dd0e4[_0x0477('0x34')][_0x0477('0x43')]){_0x4d2a4c[_0x0477('0x44')]=[{'all':!![]}];}return db[_0x0477('0x2c')]['findAll'](_0x4d2a4c);})[_0x0477('0x26')](function(_0x478ea4){_0x550de5[_0x0477('0x45')]=_0x478ea4;return _0x550de5;})[_0x0477('0x26')](respondWithFilteredResult(_0x369991,_0x4d2a4c))[_0x0477('0x46')](handleError(_0x369991,null));};exports[_0x0477('0x47')]=function(_0x322468,_0x4f6bfa){var _0x3ca5fc={'raw':!![],'where':{'id':_0x322468[_0x0477('0x48')]['id']}},_0x5afbde={};_0x5afbde[_0x0477('0x31')]=_['keys'](db[_0x0477('0x2c')][_0x0477('0x2d')]);_0x5afbde[_0x0477('0x34')]=_[_0x0477('0x49')](_0x322468[_0x0477('0x34')]);_0x5afbde['filters']=_[_0x0477('0x35')](_0x5afbde[_0x0477('0x31')],_0x5afbde[_0x0477('0x34')]);_0x3ca5fc[_0x0477('0x36')]=_['intersection'](_0x5afbde[_0x0477('0x31')],qs[_0x0477('0x37')](_0x322468[_0x0477('0x34')][_0x0477('0x37')]));_0x3ca5fc['attributes']=_0x3ca5fc[_0x0477('0x36')]['length']?_0x3ca5fc['attributes']:_0x5afbde[_0x0477('0x31')];if(_0x322468[_0x0477('0x34')][_0x0477('0x43')]){_0x3ca5fc['include']=[{'all':!![]}];}_0x3ca5fc=_[_0x0477('0x40')]({},_0x3ca5fc,_0x322468[_0x0477('0x42')]);return db['VoiceMailMessage']['find'](_0x3ca5fc)[_0x0477('0x26')](handleEntityNotFound(_0x4f6bfa,null))[_0x0477('0x26')](respondWithResult(_0x4f6bfa,null))[_0x0477('0x46')](handleError(_0x4f6bfa,null));};exports[_0x0477('0x4a')]=function(_0x2e02fb,_0x53ac14){return db[_0x0477('0x2c')][_0x0477('0x4a')](_0x2e02fb[_0x0477('0x4b')],{})[_0x0477('0x26')](respondWithResult(_0x53ac14,0xc9))['catch'](handleError(_0x53ac14,null));};exports[_0x0477('0x25')]=function(_0x6ac0cd,_0x275b48){if(_0x6ac0cd[_0x0477('0x4b')]['id']){delete _0x6ac0cd[_0x0477('0x4b')]['id'];}return db[_0x0477('0x2c')][_0x0477('0x4c')]({'where':{'id':_0x6ac0cd['params']['id']}})['then'](handleEntityNotFound(_0x275b48,null))[_0x0477('0x26')](saveUpdates(_0x6ac0cd[_0x0477('0x4b')],null))[_0x0477('0x26')](respondWithResult(_0x275b48,null))[_0x0477('0x46')](handleError(_0x275b48,null));};exports[_0x0477('0x27')]=function(_0x37254a,_0x42b901){return db[_0x0477('0x2c')][_0x0477('0x4c')]({'where':{'id':_0x37254a['params']['id']}})[_0x0477('0x26')](handleEntityNotFound(_0x42b901,null))[_0x0477('0x26')](removeEntity(_0x42b901,null))[_0x0477('0x46')](handleError(_0x42b901,null));};exports[_0x0477('0x4d')]=function(_0x195984,_0x550561,_0x583883){return db[_0x0477('0x2c')][_0x0477('0x4c')]({'where':{'id':_0x195984[_0x0477('0x48')]['id']},'attributes':['id',_0x0477('0x4e'),'msg_id']})[_0x0477('0x26')](handleEntityNotFound(_0x550561,null))['then'](function(_0x119915){if(_0x119915){if(!_0x119915[_0x0477('0x4e')]){throw new db[(_0x0477('0x4f'))][(_0x0477('0x50'))](_0x0477('0x51'));}var _0x37c7bb={'Content-Type':_0x0477('0x52'),'Content-Disposition':_0x0477('0x53')};if(_0x119915['msg_id']){_0x37c7bb[_0x0477('0x54')]='attachment;\x20filename=\x22'+_0x119915[_0x0477('0x55')]+_0x0477('0x56');}_0x550561[_0x0477('0x57')](_0x37c7bb);return _0x550561[_0x0477('0x2a')](new Buffer(_0x119915[_0x0477('0x4e')]));}})[_0x0477('0x46')](handleError(_0x550561,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 265db57..c28a913 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 _0x7de4=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7de4,0xe6));var _0x47de=function(_0xff655,_0x447fdf){_0xff655=_0xff655-0x0;var _0x3d0d01=_0x7de4[_0xff655];return _0x3d0d01;};'use strict';var _=require(_0x47de('0x0'));var util=require(_0x47de('0x1'));var logger=require(_0x47de('0x2'))(_0x47de('0x3'));var moment=require(_0x47de('0x4'));var BPromise=require(_0x47de('0x5'));var rp=require(_0x47de('0x6'));var fs=require('fs');var path=require(_0x47de('0x7'));var rimraf=require('rimraf');var config=require(_0x47de('0x8'));var attributes=require(_0x47de('0x9'));module[_0x47de('0xa')]=function(_0x3b07a5,_0x5c6839){return _0x3b07a5[_0x47de('0xb')](_0x47de('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x47de('0xd'),'fields':[_0x47de('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8014=['VoiceMailMessage','voice_voicemail_messages','lodash','util','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x3b7db2,_0x5edd58){var _0x3a819e=function(_0x207221){while(--_0x207221){_0x3b7db2['push'](_0x3b7db2['shift']());}};_0x3a819e(++_0x5edd58);}(_0x8014,0x120));var _0x4801=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x8014[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x4801('0x0'));var util=require(_0x4801('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4801('0x2'));var rp=require(_0x4801('0x3'));var fs=require('fs');var path=require(_0x4801('0x4'));var rimraf=require('rimraf');var config=require(_0x4801('0x5'));var attributes=require(_0x4801('0x6'));module[_0x4801('0x7')]=function(_0x5cfb42,_0x2984d4){return _0x5cfb42[_0x4801('0x8')](_0x4801('0x9'),attributes,{'tableName':_0x4801('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a7c25b1..86249de 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 _0x3711=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x3711,0xe3));var _0x1371=function(_0x848ed0,_0x495e45){_0x848ed0=_0x848ed0-0x0;var _0x30bbc6=_0x3711[_0x848ed0];return _0x30bbc6;};'use strict';var _=require(_0x1371('0x0'));var util=require(_0x1371('0x1'));var moment=require(_0x1371('0x2'));var BPromise=require(_0x1371('0x3'));var rs=require(_0x1371('0x4'));var fs=require('fs');var Redis=require(_0x1371('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1371('0x6'));var logger=require(_0x1371('0x7'))(_0x1371('0x8'));var config=require(_0x1371('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1371('0xa')][_0x1371('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4edc72,_0x58c27c,_0x25b99f){return new BPromise(function(_0x592108,_0xea2cf8){return client['request'](_0x4edc72,_0x25b99f)[_0x1371('0xc')](function(_0x124a2c){logger[_0x1371('0xd')](_0x1371('0xe'),_0x58c27c,_0x1371('0xf'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x58c27c,_0x1371('0xf'),JSON[_0x1371('0x10')](_0x124a2c));if(_0x124a2c[_0x1371('0x11')]){if(_0x124a2c[_0x1371('0x11')][_0x1371('0x12')]===0x1f4){logger[_0x1371('0x11')](_0x1371('0xe'),_0x58c27c,_0x124a2c[_0x1371('0x11')][_0x1371('0x13')]);return _0xea2cf8(_0x124a2c[_0x1371('0x11')][_0x1371('0x13')]);}logger['error'](_0x1371('0xe'),_0x58c27c,_0x124a2c['error'][_0x1371('0x13')]);return _0x592108(_0x124a2c[_0x1371('0x11')][_0x1371('0x13')]);}else{logger[_0x1371('0xd')](_0x1371('0xe'),_0x58c27c,_0x1371('0xf'));_0x592108(_0x124a2c[_0x1371('0x14')][_0x1371('0x13')]);}})['catch'](function(_0x2731b3){logger[_0x1371('0x11')](_0x1371('0xe'),_0x58c27c,_0x2731b3);_0xea2cf8(_0x2731b3);});});} \ No newline at end of file +var _0x960f=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','debug','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis'];(function(_0x533828,_0x2097a9){var _0x46879f=function(_0x1fc297){while(--_0x1fc297){_0x533828['push'](_0x533828['shift']());}};_0x46879f(++_0x2097a9);}(_0x960f,0xa7));var _0xf960=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x960f[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0xf960('0x0'));var util=require(_0xf960('0x1'));var moment=require(_0xf960('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf960('0x3'));var db=require(_0xf960('0x4'))['db'];var utils=require(_0xf960('0x5'));var logger=require('../../config/logger')(_0xf960('0x6'));var config=require(_0xf960('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf960('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59fd2b,_0x21e98b,_0x1a6fb5){return new BPromise(function(_0x467b55,_0xb7ba5b){return client[_0xf960('0x9')](_0x59fd2b,_0x1a6fb5)[_0xf960('0xa')](function(_0x24c9f6){logger[_0xf960('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x21e98b,'request\x20sent');logger[_0xf960('0xc')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x21e98b,'request\x20sent',JSON[_0xf960('0xd')](_0x24c9f6));if(_0x24c9f6[_0xf960('0xe')]){if(_0x24c9f6['error']['code']===0x1f4){logger[_0xf960('0xe')](_0xf960('0xf'),_0x21e98b,_0x24c9f6['error'][_0xf960('0x10')]);return _0xb7ba5b(_0x24c9f6[_0xf960('0xe')][_0xf960('0x10')]);}logger[_0xf960('0xe')](_0xf960('0xf'),_0x21e98b,_0x24c9f6['error']['message']);return _0x467b55(_0x24c9f6['error'][_0xf960('0x10')]);}else{logger[_0xf960('0xb')](_0xf960('0xf'),_0x21e98b,'request\x20sent');_0x467b55(_0x24c9f6[_0xf960('0x11')][_0xf960('0x10')]);}})[_0xf960('0x12')](function(_0x3d7ae6){logger[_0xf960('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x21e98b,_0x3d7ae6);_0xb7ba5b(_0x3d7ae6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6b0216b..c3035e9 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 _0xc575=['post','create','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','/:id/sounds'];(function(_0x5a0fc2,_0x8ce4fb){var _0x4213f8=function(_0x352ab5){while(--_0x352ab5){_0x5a0fc2['push'](_0x5a0fc2['shift']());}};_0x4213f8(++_0x8ce4fb);}(_0xc575,0x1a7));var _0x5c57=function(_0x1d0343,_0x472470){_0x1d0343=_0x1d0343-0x0;var _0xeba613=_0xc575[_0x1d0343];return _0xeba613;};'use strict';var multer=require(_0x5c57('0x0'));var util=require(_0x5c57('0x1'));var path=require(_0x5c57('0x2'));var timeout=require(_0x5c57('0x3'));var express=require('express');var router=express[_0x5c57('0x4')]();var fs_extra=require(_0x5c57('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5c57('0x6'));var config=require(_0x5c57('0x7'));var controller=require(_0x5c57('0x8'));router['get']('/',auth[_0x5c57('0x9')](),controller['index']);router[_0x5c57('0xa')](_0x5c57('0xb'),auth['isAuthenticated'](),controller[_0x5c57('0xc')]);router[_0x5c57('0xa')](_0x5c57('0xd'),auth[_0x5c57('0x9')](),controller['getSounds']);router[_0x5c57('0xe')]('/',auth[_0x5c57('0x9')](),controller[_0x5c57('0xf')]);router[_0x5c57('0xe')]('/:id/sounds',auth[_0x5c57('0x9')](),controller[_0x5c57('0x10')]);router['put'](_0x5c57('0xb'),auth[_0x5c57('0x9')](),controller[_0x5c57('0x11')]);router[_0x5c57('0x12')]('/:id',auth[_0x5c57('0x9')](),controller[_0x5c57('0x13')]);router[_0x5c57('0x12')](_0x5c57('0x14'),auth[_0x5c57('0x9')](),controller[_0x5c57('0x15')]);module[_0x5c57('0x16')]=router; \ No newline at end of file +var _0xa31f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout'];(function(_0x179d49,_0x48303e){var _0x526708=function(_0x240c97){while(--_0x240c97){_0x179d49['push'](_0x179d49['shift']());}};_0x526708(++_0x48303e);}(_0xa31f,0x65));var _0xfa31=function(_0x4c60e6,_0x587d1e){_0x4c60e6=_0x4c60e6-0x0;var _0x25c447=_0xa31f[_0x4c60e6];return _0x25c447;};'use strict';var multer=require(_0xfa31('0x0'));var util=require(_0xfa31('0x1'));var path=require('path');var timeout=require(_0xfa31('0x2'));var express=require(_0xfa31('0x3'));var router=express[_0xfa31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfa31('0x5'));var interaction=require(_0xfa31('0x6'));var config=require(_0xfa31('0x7'));var controller=require(_0xfa31('0x8'));router[_0xfa31('0x9')]('/',auth[_0xfa31('0xa')](),controller[_0xfa31('0xb')]);router[_0xfa31('0x9')](_0xfa31('0xc'),auth[_0xfa31('0xa')](),controller[_0xfa31('0xd')]);router['get'](_0xfa31('0xe'),auth[_0xfa31('0xa')](),controller[_0xfa31('0xf')]);router['post']('/',auth[_0xfa31('0xa')](),controller[_0xfa31('0x10')]);router[_0xfa31('0x11')](_0xfa31('0xe'),auth[_0xfa31('0xa')](),controller[_0xfa31('0x12')]);router[_0xfa31('0x13')](_0xfa31('0xc'),auth[_0xfa31('0xa')](),controller[_0xfa31('0x14')]);router[_0xfa31('0x15')]('/:id',auth[_0xfa31('0xa')](),controller[_0xfa31('0x16')]);router[_0xfa31('0x15')](_0xfa31('0x17'),auth['isAuthenticated'](),controller[_0xfa31('0x18')]);module[_0xfa31('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c364f99..abe7384 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 _0xf160=['mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom'];(function(_0x289f96,_0x347d5f){var _0x2f5d92=function(_0x55e8e3){while(--_0x55e8e3){_0x289f96['push'](_0x289f96['shift']());}};_0x2f5d92(++_0x347d5f);}(_0xf160,0x1db));var _0x0f16=function(_0x584921,_0x51ac30){_0x584921=_0x584921-0x0;var _0x429a35=_0xf160[_0x584921];return _0x429a35;};'use strict';var Sequelize=require(_0x0f16('0x0'));module[_0x0f16('0x1')]={'name':{'type':Sequelize[_0x0f16('0x2')],'allowNull':![],'unique':_0x0f16('0x3')},'mode':{'type':Sequelize['ENUM'](_0x0f16('0x4'),'files',_0x0f16('0x5'),_0x0f16('0x6'),_0x0f16('0x7'),_0x0f16('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x0f16('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x0f16('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0f16('0x9')},'format':{'type':Sequelize[_0x0f16('0x2')],'allowNull':!![]},'stamp':{'type':_0x0f16('0xa')},'defaultEntry':{'type':Sequelize[_0x0f16('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x95c3=['BOOLEAN','sequelize','STRING','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP'];(function(_0x2a3bec,_0x3b5f19){var _0x25dea2=function(_0x2c6ed2){while(--_0x2c6ed2){_0x2a3bec['push'](_0x2a3bec['shift']());}};_0x25dea2(++_0x3b5f19);}(_0x95c3,0x1ae));var _0x395c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x95c3[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x395c('0x0'));module['exports']={'name':{'type':Sequelize[_0x395c('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x395c('0x2'),_0x395c('0x3'),_0x395c('0x4'),_0x395c('0x5'),_0x395c('0x6'),_0x395c('0x7')),'allowNull':!![],'defaultValue':_0x395c('0x3')},'directory':{'type':Sequelize[_0x395c('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x395c('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x395c('0x1')],'allowNull':!![],'defaultValue':_0x395c('0x8')},'format':{'type':Sequelize[_0x395c('0x1')],'allowNull':!![]},'stamp':{'type':_0x395c('0x9')},'defaultEntry':{'type':Sequelize[_0x395c('0xa')],'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 96f817f..554b578 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 _0xcef3=['include','catch','show','params','length','includeAll','find','body','create','sequelize','transaction','files','root','server/files/moh','mode','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','readdirSync','directory','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','join','server/files/sounds/converted','basename','extname','format','%s.%s','Sequelize','removeSound','Sound','getSounds','pick','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','end','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x5ee160,_0xc794a2){var _0x22915c=function(_0xd46e20){while(--_0xd46e20){_0x5ee160['push'](_0x5ee160['shift']());}};_0x22915c(++_0xc794a2);}(_0xcef3,0x95));var _0x3cef=function(_0x4b1f9c,_0x422fc9){_0x4b1f9c=_0x4b1f9c-0x0;var _0x3e0632=_0xcef3[_0x4b1f9c];return _0x3e0632;};'use strict';var emlformat=require(_0x3cef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3cef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3cef('0x2'));var moment=require(_0x3cef('0x3'));var BPromise=require(_0x3cef('0x4'));var Mustache=require(_0x3cef('0x5'));var util=require(_0x3cef('0x6'));var path=require(_0x3cef('0x7'));var sox=require(_0x3cef('0x8'));var csv=require(_0x3cef('0x9'));var ejs=require(_0x3cef('0xa'));var fs=require('fs');var fs_extra=require(_0x3cef('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3cef('0xc'));var deskjs=require(_0x3cef('0xd'));var toCsv=require(_0x3cef('0x9'));var querystring=require(_0x3cef('0xe'));var Papa=require(_0x3cef('0xf'));var Redis=require(_0x3cef('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3cef('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3cef('0x12'));var db=require(_0x3cef('0x13'))['db'];function respondWithStatusCode(_0x23fead,_0x5336c7){_0x5336c7=_0x5336c7||0xcc;return function(_0x48cf81){if(_0x48cf81){return _0x23fead[_0x3cef('0x14')](_0x5336c7);}return _0x23fead[_0x3cef('0x15')](_0x5336c7)['end']();};}function respondWithResult(_0x32207f,_0x854a17){_0x854a17=_0x854a17||0xc8;return function(_0x295557){if(_0x295557){return _0x32207f['status'](_0x854a17)[_0x3cef('0x16')](_0x295557);}};}function respondWithFilteredResult(_0x1fefff,_0x1dbcd5){return function(_0x318276){if(_0x318276){var _0x1da0ee=typeof _0x1dbcd5[_0x3cef('0x17')]===_0x3cef('0x18')&&typeof _0x1dbcd5['limit']===_0x3cef('0x18');var _0x555072=_0x318276[_0x3cef('0x19')];var _0x26b06c=_0x1da0ee?0x0:_0x1dbcd5[_0x3cef('0x17')];var _0x4da96b=_0x1da0ee?_0x318276[_0x3cef('0x19')]:_0x1dbcd5[_0x3cef('0x17')]+_0x1dbcd5[_0x3cef('0x1a')];var _0xb1d6bc;if(_0x4da96b>=_0x555072){_0x4da96b=_0x555072;_0xb1d6bc=0xc8;}else{_0xb1d6bc=0xce;}_0x1fefff[_0x3cef('0x15')](_0xb1d6bc);return _0x1fefff[_0x3cef('0x1b')]('Content-Range',_0x26b06c+'-'+_0x4da96b+'/'+_0x555072)['json'](_0x318276);}return null;};}function patchUpdates(_0x441b3c){return function(_0x36dbb6){try{jsonpatch[_0x3cef('0x1c')](_0x36dbb6,_0x441b3c,!![]);}catch(_0x41eff6){return BPromise[_0x3cef('0x1d')](_0x41eff6);}return _0x36dbb6[_0x3cef('0x1e')]();};}function saveUpdates(_0x1c63e8,_0x33a6f3){return function(_0x1c81d5){if(_0x1c81d5){return _0x1c81d5[_0x3cef('0x1f')](_0x1c63e8)[_0x3cef('0x20')](function(_0x3118f9){return _0x3118f9;});}return null;};}function removeEntity(_0x54697d,_0x244499){return function(_0x121a44){if(_0x121a44){return _0x121a44[_0x3cef('0x21')]()['then'](function(){var _0x596b93=_0x121a44[_0x3cef('0x22')]({'plain':!![]});var _0x46956a=_0x3cef('0x23');return db['UserProfileResource'][_0x3cef('0x21')]({'where':{'type':_0x46956a,'resourceId':_0x596b93['id']}})[_0x3cef('0x20')](function(){return _0x121a44;});})[_0x3cef('0x20')](function(){_0x54697d[_0x3cef('0x15')](0xcc)[_0x3cef('0x24')]();});}};}function handleEntityNotFound(_0x333f7a,_0x5570a7){return function(_0x50ef6d){if(!_0x50ef6d){_0x333f7a[_0x3cef('0x14')](0x194);}return _0x50ef6d;};}function handleError(_0x102b3b,_0x5c5282){_0x5c5282=_0x5c5282||0x1f4;return function(_0x306a09){logger['error'](_0x306a09[_0x3cef('0x25')]);if(_0x306a09[_0x3cef('0x26')]){delete _0x306a09[_0x3cef('0x26')];}_0x102b3b[_0x3cef('0x15')](_0x5c5282)[_0x3cef('0x27')](_0x306a09);};}exports[_0x3cef('0x28')]=function(_0x5b848d,_0x18fc85){var _0x309452={},_0x23fb8e={},_0x2de73e={'count':0x0,'rows':[]};var _0x38ddb6=_[_0x3cef('0x29')](db[_0x3cef('0x2a')][_0x3cef('0x2b')],function(_0x5543a2){return{'name':_0x5543a2['fieldName'],'type':_0x5543a2[_0x3cef('0x2c')]['key']};});_0x23fb8e[_0x3cef('0x2d')]=_[_0x3cef('0x29')](_0x38ddb6,_0x3cef('0x26'));_0x23fb8e[_0x3cef('0x2e')]=_[_0x3cef('0x2f')](_0x5b848d[_0x3cef('0x2e')]);_0x23fb8e[_0x3cef('0x30')]=_[_0x3cef('0x31')](_0x23fb8e[_0x3cef('0x2d')],_0x23fb8e[_0x3cef('0x2e')]);_0x309452[_0x3cef('0x32')]=_['intersection'](_0x23fb8e[_0x3cef('0x2d')],qs[_0x3cef('0x33')](_0x5b848d[_0x3cef('0x2e')][_0x3cef('0x33')]));_0x309452[_0x3cef('0x32')]=_0x309452['attributes']['length']?_0x309452[_0x3cef('0x32')]:_0x23fb8e[_0x3cef('0x2d')];if(!_0x5b848d['query'][_0x3cef('0x34')](_0x3cef('0x35'))){_0x309452[_0x3cef('0x1a')]=qs[_0x3cef('0x1a')](_0x5b848d[_0x3cef('0x2e')][_0x3cef('0x1a')]);_0x309452[_0x3cef('0x17')]=qs[_0x3cef('0x17')](_0x5b848d[_0x3cef('0x2e')][_0x3cef('0x17')]);}_0x309452[_0x3cef('0x36')]=qs['sort'](_0x5b848d[_0x3cef('0x2e')][_0x3cef('0x37')]);delete _0x5b848d[_0x3cef('0x2e')][_0x3cef('0x37')];_0x309452[_0x3cef('0x38')]=qs[_0x3cef('0x30')](_['pick'](_0x5b848d[_0x3cef('0x2e')],_0x23fb8e['filters']),_0x38ddb6);if(_0x5b848d[_0x3cef('0x2e')][_0x3cef('0x39')]){_0x309452[_0x3cef('0x38')]=_[_0x3cef('0x3a')](_0x309452[_0x3cef('0x38')],{'$or':_[_0x3cef('0x29')](_0x38ddb6,function(_0x18bf3c){if(_0x18bf3c[_0x3cef('0x2c')]!==_0x3cef('0x3b')){var _0x37f949={};_0x37f949[_0x18bf3c[_0x3cef('0x26')]]={'$like':'%'+_0x5b848d[_0x3cef('0x2e')]['filter']+'%'};return _0x37f949;}})});}_0x309452=_[_0x3cef('0x3a')]({},_0x309452,_0x5b848d[_0x3cef('0x3c')]);var _0x402a10={'where':_0x309452['where']};return db[_0x3cef('0x2a')]['count'](_0x402a10)['then'](function(_0x3f9e9e){_0x2de73e[_0x3cef('0x19')]=_0x3f9e9e;if(_0x5b848d[_0x3cef('0x2e')]['includeAll']){_0x309452[_0x3cef('0x3d')]=[{'all':!![]}];}return db[_0x3cef('0x2a')]['findAll'](_0x309452);})['then'](function(_0x331ffc){_0x2de73e['rows']=_0x331ffc;return _0x2de73e;})[_0x3cef('0x20')](respondWithFilteredResult(_0x18fc85,_0x309452))[_0x3cef('0x3e')](handleError(_0x18fc85,null));};exports[_0x3cef('0x3f')]=function(_0x93d89e,_0x2e8f68){var _0x38bb77={'raw':![],'where':{'id':_0x93d89e[_0x3cef('0x40')]['id']}},_0x5f0be9={};_0x5f0be9[_0x3cef('0x2d')]=_[_0x3cef('0x2f')](db[_0x3cef('0x2a')][_0x3cef('0x2b')]);_0x5f0be9['query']=_[_0x3cef('0x2f')](_0x93d89e['query']);_0x5f0be9[_0x3cef('0x30')]=_[_0x3cef('0x31')](_0x5f0be9['model'],_0x5f0be9[_0x3cef('0x2e')]);_0x38bb77[_0x3cef('0x32')]=_['intersection'](_0x5f0be9[_0x3cef('0x2d')],qs['fields'](_0x93d89e['query'][_0x3cef('0x33')]));_0x38bb77[_0x3cef('0x32')]=_0x38bb77[_0x3cef('0x32')][_0x3cef('0x41')]?_0x38bb77[_0x3cef('0x32')]:_0x5f0be9['model'];if(_0x93d89e['query'][_0x3cef('0x42')]){_0x38bb77['include']=[{'all':!![]}];}_0x38bb77=_[_0x3cef('0x3a')]({},_0x38bb77,_0x93d89e[_0x3cef('0x3c')]);return db[_0x3cef('0x2a')][_0x3cef('0x43')](_0x38bb77)['then'](handleEntityNotFound(_0x2e8f68,null))[_0x3cef('0x20')](respondWithResult(_0x2e8f68,null))[_0x3cef('0x3e')](handleError(_0x2e8f68,null));};exports[_0x3cef('0x1f')]=function(_0x5a0d13,_0x49ec00){if(_0x5a0d13[_0x3cef('0x44')]['id']){delete _0x5a0d13['body']['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5a0d13[_0x3cef('0x40')]['id']}})[_0x3cef('0x20')](handleEntityNotFound(_0x49ec00,null))['then'](saveUpdates(_0x5a0d13[_0x3cef('0x44')],null))['then'](respondWithResult(_0x49ec00,null))[_0x3cef('0x3e')](handleError(_0x49ec00,null));};exports[_0x3cef('0x45')]=function(_0x49cbc1,_0x193098,_0x4d221e){return db[_0x3cef('0x46')][_0x3cef('0x47')](function(_0x469dbe){if(_0x49cbc1[_0x3cef('0x44')]['mode']===_0x3cef('0x48')){_0x49cbc1[_0x3cef('0x44')]['directory']=path['join'](config[_0x3cef('0x49')],_0x3cef('0x4a'),_0x49cbc1['body'][_0x3cef('0x26')]);}return db[_0x3cef('0x2a')][_0x3cef('0x45')](_0x49cbc1['body'],{'transaction':_0x469dbe})[_0x3cef('0x20')](function(_0x3ce47f){if(_0x49cbc1['body'][_0x3cef('0x4b')]===_0x3cef('0x48')){fs[_0x3cef('0x4c')](_0x3ce47f['directory'],parseInt('0777',0x8));}var _0x2e4a52=_0x49cbc1[_0x3cef('0x4d')][_0x3cef('0x22')]({'plain':!![]});if(!_0x2e4a52)throw new Error(_0x3cef('0x4e'));if(_0x2e4a52['role']===_0x3cef('0x4d')){var _0x239b46=_0x3ce47f[_0x3cef('0x22')]({'plain':!![]});return db[_0x3cef('0x4f')][_0x3cef('0x43')]({'where':{'name':_0x3cef('0x23'),'userProfileId':_0x2e4a52[_0x3cef('0x50')]},'raw':!![]})['then'](function(_0x41837c){if(_0x41837c&&_0x41837c['autoAssociation']===0x0){return db[_0x3cef('0x51')][_0x3cef('0x45')]({'name':_0x239b46[_0x3cef('0x26')],'resourceId':_0x239b46['id'],'type':_0x41837c[_0x3cef('0x26')],'sectionId':_0x41837c['id']},{})[_0x3cef('0x20')](function(){return _0x3ce47f;});}else{return _0x3ce47f;}})['catch'](function(_0xf18b45){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf18b45);});}return _0x3ce47f;});})[_0x3cef('0x20')](respondWithResult(_0x193098,0xc9))[_0x3cef('0x3e')](handleError(_0x193098,null));};exports[_0x3cef('0x21')]=function(_0x1ff9ea,_0x43084e,_0x555a53){var _0x43526b;return db['VoiceMusicOnHold'][_0x3cef('0x43')]({'where':{'id':_0x1ff9ea[_0x3cef('0x40')]['id']}})[_0x3cef('0x20')](function(_0x1135dc){if(_0x1135dc){return db[_0x3cef('0x46')][_0x3cef('0x47')](function(_0x4fd4a8){return _0x1135dc['destroy']({'transaction':_0x4fd4a8,'raw':!![]})[_0x3cef('0x20')](function(_0x6a3a3f){if(_0x6a3a3f['directory']){fs[_0x3cef('0x52')](_0x6a3a3f[_0x3cef('0x53')])[_0x3cef('0x54')](function(_0x573dc5){fs[_0x3cef('0x55')](path['join'](_0x6a3a3f[_0x3cef('0x53')],_0x573dc5));});fs[_0x3cef('0x56')](_0x6a3a3f[_0x3cef('0x53')]);}return _0x6a3a3f;});})[_0x3cef('0x3e')](function(_0x445415){throw new db['Sequelize'][(_0x3cef('0x57'))](_0x445415[_0x3cef('0x58')]);});}})[_0x3cef('0x20')](handleEntityNotFound(_0x43084e,null))[_0x3cef('0x20')](removeEntity(_0x43084e,null))[_0x3cef('0x3e')](handleError(_0x43084e,null));};exports[_0x3cef('0x59')]=function(_0x2abd5d,_0x1a6b66,_0x5e0f8){return db[_0x3cef('0x46')]['transaction'](function(_0xe60808){var _0x3da1ab;return db[_0x3cef('0x2a')][_0x3cef('0x43')]({'where':{'id':_0x2abd5d['params']['id']}})['then'](function(_0x98b661){if(_0x98b661){_0x3da1ab=_0x98b661;return _0x98b661['addSound'](_0x2abd5d[_0x3cef('0x44')]['id'],{'transaction':_0xe60808});}})[_0x3cef('0x20')](function(_0x30fd8d){if(_0x30fd8d){return db['Sound'][_0x3cef('0x5a')]({'where':{'id':_0x2abd5d[_0x3cef('0x44')]['id']},'attributes':['id',_0x3cef('0x26'),_0x3cef('0x5b'),_0x3cef('0x5c'),_0x3cef('0x5d')],'raw':!![]});}})[_0x3cef('0x20')](function(_0x1c50ce){if(_0x1c50ce){var _0x1fac5c=path[_0x3cef('0x5e')](config[_0x3cef('0x49')],_0x3cef('0x5f'),util['format']('%s.%s',path[_0x3cef('0x60')](_0x1c50ce[_0x3cef('0x5b')],path[_0x3cef('0x61')](_0x1c50ce[_0x3cef('0x5b')])),_0x1c50ce[_0x3cef('0x5c')]));var _0x57b78a=path[_0x3cef('0x5e')](config[_0x3cef('0x49')],'server/files/moh',_0x3da1ab[_0x3cef('0x26')],util[_0x3cef('0x62')](_0x3cef('0x63'),_0x1c50ce[_0x3cef('0x26')],_0x1c50ce[_0x3cef('0x5c')]));fs['symlinkSync'](_0x1fac5c,_0x57b78a);return _0x1c50ce;}})[_0x3cef('0x3e')](function(_0x5d9d69){throw new db[(_0x3cef('0x64'))][(_0x3cef('0x57'))](_0x5d9d69[_0x3cef('0x58')]);});})[_0x3cef('0x20')](handleEntityNotFound(_0x1a6b66,null))['then'](respondWithResult(_0x1a6b66,0xc9))[_0x3cef('0x3e')](handleError(_0x1a6b66,null));};exports[_0x3cef('0x65')]=function(_0x3cbc71,_0x5f28d1,_0x21c6c6){return db[_0x3cef('0x46')]['transaction'](function(_0x225b02){var _0x117135;return db[_0x3cef('0x2a')][_0x3cef('0x5a')]({'where':{'id':_0x3cbc71[_0x3cef('0x40')]['id']}})[_0x3cef('0x20')](handleEntityNotFound(_0x5f28d1,null))[_0x3cef('0x20')](function(_0x68d73a){if(_0x68d73a){_0x117135=_0x68d73a;return _0x68d73a[_0x3cef('0x65')](_0x3cbc71[_0x3cef('0x40')]['id2']);}})['then'](function(_0x2dd235){if(_0x2dd235){return db[_0x3cef('0x66')][_0x3cef('0x5a')]({'where':{'id':_0x3cbc71['params']['id2']},'attributes':['id',_0x3cef('0x26'),_0x3cef('0x5b'),_0x3cef('0x5c'),_0x3cef('0x5d')],'raw':!![]});}})['then'](function(_0x2fc959){if(_0x2fc959){fs[_0x3cef('0x55')](path[_0x3cef('0x5e')](_0x117135['directory'],util[_0x3cef('0x62')](_0x3cef('0x63'),_0x2fc959[_0x3cef('0x26')],_0x2fc959[_0x3cef('0x5c')])));return _0x2fc959;}})[_0x3cef('0x3e')](function(_0x28f33b){throw new db['Sequelize'][(_0x3cef('0x57'))](_0x28f33b[_0x3cef('0x58')]);});})['then'](handleEntityNotFound(_0x5f28d1,null))[_0x3cef('0x20')](respondWithStatusCode(_0x5f28d1,0xcc))[_0x3cef('0x3e')](handleError(_0x5f28d1,null));};exports[_0x3cef('0x67')]=function(_0x378f4d,_0x3a8543,_0x6e99c0){var _0x5c220f={};var _0x57de50={};var _0x185cc8;var _0x29a32e;return db[_0x3cef('0x2a')][_0x3cef('0x5a')]({'where':{'id':_0x378f4d['params']['id']}})[_0x3cef('0x20')](handleEntityNotFound(_0x3a8543,null))[_0x3cef('0x20')](function(_0x9059c5){if(_0x9059c5){_0x185cc8=_0x9059c5;_0x57de50[_0x3cef('0x2d')]=_['keys'](db[_0x3cef('0x66')][_0x3cef('0x2b')]);_0x57de50[_0x3cef('0x2e')]=_['keys'](_0x378f4d[_0x3cef('0x2e')]);_0x57de50['filters']=_[_0x3cef('0x31')](_0x57de50[_0x3cef('0x2d')],_0x57de50[_0x3cef('0x2e')]);_0x5c220f[_0x3cef('0x32')]=_[_0x3cef('0x31')](_0x57de50[_0x3cef('0x2d')],qs[_0x3cef('0x33')](_0x378f4d['query'][_0x3cef('0x33')]));_0x5c220f[_0x3cef('0x32')]=_0x5c220f[_0x3cef('0x32')][_0x3cef('0x41')]?_0x5c220f[_0x3cef('0x32')]:_0x57de50[_0x3cef('0x2d')];_0x5c220f[_0x3cef('0x36')]=qs[_0x3cef('0x37')](_0x378f4d[_0x3cef('0x2e')][_0x3cef('0x37')]);_0x5c220f['where']=qs[_0x3cef('0x30')](_[_0x3cef('0x68')](_0x378f4d[_0x3cef('0x2e')],_0x57de50[_0x3cef('0x30')]));if(_0x378f4d[_0x3cef('0x2e')]['filter']){_0x5c220f[_0x3cef('0x38')]=_[_0x3cef('0x3a')](_0x5c220f[_0x3cef('0x38')],{'$or':_[_0x3cef('0x29')](_0x5c220f[_0x3cef('0x32')],function(_0x372c84){var _0x1114b4={};_0x1114b4[_0x372c84]={'$like':'%'+_0x378f4d[_0x3cef('0x2e')][_0x3cef('0x39')]+'%'};return _0x1114b4;})});}_0x5c220f=_[_0x3cef('0x3a')]({},_0x5c220f,_0x378f4d[_0x3cef('0x3c')]);return _0x185cc8['getSounds'](_0x5c220f);}})[_0x3cef('0x20')](function(_0x400879){if(_0x400879){_0x29a32e=_0x400879[_0x3cef('0x41')];if(!_0x378f4d[_0x3cef('0x2e')]['hasOwnProperty'](_0x3cef('0x35'))){_0x5c220f[_0x3cef('0x1a')]=qs[_0x3cef('0x1a')](_0x378f4d[_0x3cef('0x2e')]['limit']);_0x5c220f[_0x3cef('0x17')]=qs['offset'](_0x378f4d[_0x3cef('0x2e')]['offset']);}return _0x185cc8[_0x3cef('0x67')](_0x5c220f);}})[_0x3cef('0x20')](function(_0x3c9eb5){if(_0x3c9eb5){return _0x3c9eb5?{'count':_0x29a32e,'rows':_0x3c9eb5}:null;}})[_0x3cef('0x20')](respondWithResult(_0x3a8543,null))['catch'](handleError(_0x3a8543,null));}; \ No newline at end of file +var _0x201d=['../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','get','MusicOnHolds','UserProfileResource','destroy','then','error','name','send','map','VoiceMusicOnHold','rawAttributes','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','show','params','length','find','catch','update','body','create','sequelize','mode','files','directory','join','server/files/moh','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','removeSound','id2','pick','options','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x23306d,_0x3e9aca){var _0x4f5c6d=function(_0x5a2ca7){while(--_0x5a2ca7){_0x23306d['push'](_0x23306d['shift']());}};_0x4f5c6d(++_0x3e9aca);}(_0x201d,0xc5));var _0xd201=function(_0x2efcfa,_0x4f3277){_0x2efcfa=_0x2efcfa-0x0;var _0x5dfc72=_0x201d[_0x2efcfa];return _0x5dfc72;};'use strict';var emlformat=require(_0xd201('0x0'));var rimraf=require(_0xd201('0x1'));var zipdir=require(_0xd201('0x2'));var jsonpatch=require(_0xd201('0x3'));var rp=require(_0xd201('0x4'));var moment=require(_0xd201('0x5'));var BPromise=require(_0xd201('0x6'));var Mustache=require('mustache');var util=require(_0xd201('0x7'));var path=require(_0xd201('0x8'));var sox=require(_0xd201('0x9'));var csv=require(_0xd201('0xa'));var ejs=require(_0xd201('0xb'));var fs=require('fs');var fs_extra=require(_0xd201('0xc'));var _=require(_0xd201('0xd'));var squel=require(_0xd201('0xe'));var crypto=require(_0xd201('0xf'));var jsforce=require(_0xd201('0x10'));var deskjs=require(_0xd201('0x11'));var toCsv=require(_0xd201('0xa'));var querystring=require(_0xd201('0x12'));var Papa=require('papaparse');var Redis=require(_0xd201('0x13'));var authService=require(_0xd201('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd201('0x15'));var hardwareService=require(_0xd201('0x16'));var logger=require(_0xd201('0x17'))('api');var utils=require(_0xd201('0x18'));var config=require(_0xd201('0x19'));var licenseUtil=require(_0xd201('0x1a'));var db=require(_0xd201('0x1b'))['db'];function respondWithStatusCode(_0x5589b6,_0x9d493a){_0x9d493a=_0x9d493a||0xcc;return function(_0x5f19e7){if(_0x5f19e7){return _0x5589b6[_0xd201('0x1c')](_0x9d493a);}return _0x5589b6['status'](_0x9d493a)[_0xd201('0x1d')]();};}function respondWithResult(_0xc7775c,_0x34176a){_0x34176a=_0x34176a||0xc8;return function(_0x437e03){if(_0x437e03){return _0xc7775c['status'](_0x34176a)['json'](_0x437e03);}};}function respondWithFilteredResult(_0x22ebf8,_0x1b4da9){return function(_0x5985c0){if(_0x5985c0){var _0x2e6ff4=typeof _0x1b4da9[_0xd201('0x1e')]==='undefined'&&typeof _0x1b4da9[_0xd201('0x1f')]===_0xd201('0x20');var _0x4648af=_0x5985c0[_0xd201('0x21')];var _0x529713=_0x2e6ff4?0x0:_0x1b4da9[_0xd201('0x1e')];var _0x20f812=_0x2e6ff4?_0x5985c0[_0xd201('0x21')]:_0x1b4da9[_0xd201('0x1e')]+_0x1b4da9['limit'];var _0x392b6c;if(_0x20f812>=_0x4648af){_0x20f812=_0x4648af;_0x392b6c=0xc8;}else{_0x392b6c=0xce;}_0x22ebf8[_0xd201('0x22')](_0x392b6c);return _0x22ebf8['set'](_0xd201('0x23'),_0x529713+'-'+_0x20f812+'/'+_0x4648af)[_0xd201('0x24')](_0x5985c0);}return null;};}function patchUpdates(_0x30c7bc){return function(_0xd2543f){try{jsonpatch[_0xd201('0x25')](_0xd2543f,_0x30c7bc,!![]);}catch(_0x8e7e1){return BPromise[_0xd201('0x26')](_0x8e7e1);}return _0xd2543f[_0xd201('0x27')]();};}function saveUpdates(_0x113c4f,_0x57b5f4){return function(_0x204c90){if(_0x204c90){return _0x204c90['update'](_0x113c4f)['then'](function(_0x557d6a){return _0x557d6a;});}return null;};}function removeEntity(_0x1fc31f,_0x2ede05){return function(_0xfd93ad){if(_0xfd93ad){return _0xfd93ad['destroy']()['then'](function(){var _0x3cd65d=_0xfd93ad[_0xd201('0x28')]({'plain':!![]});var _0x1c90d5=_0xd201('0x29');return db[_0xd201('0x2a')][_0xd201('0x2b')]({'where':{'type':_0x1c90d5,'resourceId':_0x3cd65d['id']}})[_0xd201('0x2c')](function(){return _0xfd93ad;});})[_0xd201('0x2c')](function(){_0x1fc31f[_0xd201('0x22')](0xcc)[_0xd201('0x1d')]();});}};}function handleEntityNotFound(_0x30e52f,_0x5e29fc){return function(_0x52b9fe){if(!_0x52b9fe){_0x30e52f[_0xd201('0x1c')](0x194);}return _0x52b9fe;};}function handleError(_0x358e43,_0x1c3175){_0x1c3175=_0x1c3175||0x1f4;return function(_0x14db86){logger[_0xd201('0x2d')](_0x14db86['stack']);if(_0x14db86[_0xd201('0x2e')]){delete _0x14db86[_0xd201('0x2e')];}_0x358e43[_0xd201('0x22')](_0x1c3175)[_0xd201('0x2f')](_0x14db86);};}exports['index']=function(_0x379a91,_0x7ad93a){var _0x1fd65e={},_0x534bad={},_0x268f22={'count':0x0,'rows':[]};var _0x8f4a6e=_[_0xd201('0x30')](db[_0xd201('0x31')][_0xd201('0x32')],function(_0x418056){return{'name':_0x418056['fieldName'],'type':_0x418056['type']['key']};});_0x534bad[_0xd201('0x33')]=_[_0xd201('0x30')](_0x8f4a6e,_0xd201('0x2e'));_0x534bad['query']=_[_0xd201('0x34')](_0x379a91['query']);_0x534bad[_0xd201('0x35')]=_[_0xd201('0x36')](_0x534bad[_0xd201('0x33')],_0x534bad[_0xd201('0x37')]);_0x1fd65e[_0xd201('0x38')]=_[_0xd201('0x36')](_0x534bad['model'],qs[_0xd201('0x39')](_0x379a91[_0xd201('0x37')][_0xd201('0x39')]));_0x1fd65e[_0xd201('0x38')]=_0x1fd65e['attributes']['length']?_0x1fd65e[_0xd201('0x38')]:_0x534bad['model'];if(!_0x379a91[_0xd201('0x37')][_0xd201('0x3a')](_0xd201('0x3b'))){_0x1fd65e[_0xd201('0x1f')]=qs['limit'](_0x379a91[_0xd201('0x37')]['limit']);_0x1fd65e[_0xd201('0x1e')]=qs['offset'](_0x379a91[_0xd201('0x37')][_0xd201('0x1e')]);}_0x1fd65e[_0xd201('0x3c')]=qs[_0xd201('0x3d')](_0x379a91[_0xd201('0x37')][_0xd201('0x3d')]);delete _0x379a91[_0xd201('0x37')][_0xd201('0x3d')];_0x1fd65e['where']=qs[_0xd201('0x35')](_['pick'](_0x379a91['query'],_0x534bad[_0xd201('0x35')]),_0x8f4a6e);if(_0x379a91['query'][_0xd201('0x3e')]){_0x1fd65e[_0xd201('0x3f')]=_[_0xd201('0x40')](_0x1fd65e[_0xd201('0x3f')],{'$or':_['map'](_0x8f4a6e,function(_0x3c2083){if(_0x3c2083['type']!==_0xd201('0x41')){var _0x2380d0={};_0x2380d0[_0x3c2083['name']]={'$like':'%'+_0x379a91[_0xd201('0x37')][_0xd201('0x3e')]+'%'};return _0x2380d0;}})});}_0x1fd65e=_[_0xd201('0x40')]({},_0x1fd65e,_0x379a91['options']);var _0x4bd484={'where':_0x1fd65e[_0xd201('0x3f')]};return db[_0xd201('0x31')][_0xd201('0x21')](_0x4bd484)['then'](function(_0x1f85e4){_0x268f22['count']=_0x1f85e4;if(_0x379a91[_0xd201('0x37')][_0xd201('0x42')]){_0x1fd65e[_0xd201('0x43')]=[{'all':!![]}];}return db[_0xd201('0x31')]['findAll'](_0x1fd65e);})[_0xd201('0x2c')](function(_0x42e66e){_0x268f22['rows']=_0x42e66e;return _0x268f22;})[_0xd201('0x2c')](respondWithFilteredResult(_0x7ad93a,_0x1fd65e))['catch'](handleError(_0x7ad93a,null));};exports[_0xd201('0x44')]=function(_0xfbbfe4,_0x525bbd){var _0xe94a67={'raw':![],'where':{'id':_0xfbbfe4[_0xd201('0x45')]['id']}},_0x2c89f3={};_0x2c89f3[_0xd201('0x33')]=_['keys'](db[_0xd201('0x31')][_0xd201('0x32')]);_0x2c89f3[_0xd201('0x37')]=_[_0xd201('0x34')](_0xfbbfe4[_0xd201('0x37')]);_0x2c89f3['filters']=_['intersection'](_0x2c89f3[_0xd201('0x33')],_0x2c89f3[_0xd201('0x37')]);_0xe94a67[_0xd201('0x38')]=_['intersection'](_0x2c89f3['model'],qs[_0xd201('0x39')](_0xfbbfe4[_0xd201('0x37')][_0xd201('0x39')]));_0xe94a67['attributes']=_0xe94a67[_0xd201('0x38')][_0xd201('0x46')]?_0xe94a67[_0xd201('0x38')]:_0x2c89f3[_0xd201('0x33')];if(_0xfbbfe4[_0xd201('0x37')]['includeAll']){_0xe94a67[_0xd201('0x43')]=[{'all':!![]}];}_0xe94a67=_[_0xd201('0x40')]({},_0xe94a67,_0xfbbfe4['options']);return db[_0xd201('0x31')][_0xd201('0x47')](_0xe94a67)[_0xd201('0x2c')](handleEntityNotFound(_0x525bbd,null))[_0xd201('0x2c')](respondWithResult(_0x525bbd,null))[_0xd201('0x48')](handleError(_0x525bbd,null));};exports[_0xd201('0x49')]=function(_0x3f6af4,_0x50bfee){if(_0x3f6af4[_0xd201('0x4a')]['id']){delete _0x3f6af4[_0xd201('0x4a')]['id'];}return db[_0xd201('0x31')]['find']({'where':{'id':_0x3f6af4['params']['id']}})[_0xd201('0x2c')](handleEntityNotFound(_0x50bfee,null))['then'](saveUpdates(_0x3f6af4['body'],null))[_0xd201('0x2c')](respondWithResult(_0x50bfee,null))[_0xd201('0x48')](handleError(_0x50bfee,null));};exports[_0xd201('0x4b')]=function(_0x3a096b,_0x40ea32,_0x4b0b67){return db[_0xd201('0x4c')]['transaction'](function(_0xf14b89){if(_0x3a096b['body'][_0xd201('0x4d')]===_0xd201('0x4e')){_0x3a096b[_0xd201('0x4a')][_0xd201('0x4f')]=path[_0xd201('0x50')](config['root'],_0xd201('0x51'),_0x3a096b[_0xd201('0x4a')][_0xd201('0x2e')]);}return db[_0xd201('0x31')][_0xd201('0x4b')](_0x3a096b['body'],{'transaction':_0xf14b89})[_0xd201('0x2c')](function(_0x47fe8f){if(_0x3a096b['body'][_0xd201('0x4d')]===_0xd201('0x4e')){fs[_0xd201('0x52')](_0x47fe8f[_0xd201('0x4f')],parseInt('0777',0x8));}var _0x1767e8=_0x3a096b['user'][_0xd201('0x28')]({'plain':!![]});if(!_0x1767e8)throw new Error(_0xd201('0x53'));if(_0x1767e8[_0xd201('0x54')]===_0xd201('0x55')){var _0x3815f5=_0x47fe8f[_0xd201('0x28')]({'plain':!![]});return db[_0xd201('0x56')][_0xd201('0x47')]({'where':{'name':_0xd201('0x29'),'userProfileId':_0x1767e8['userProfileId']},'raw':!![]})[_0xd201('0x2c')](function(_0x43ed24){if(_0x43ed24&&_0x43ed24['autoAssociation']===0x0){return db[_0xd201('0x2a')]['create']({'name':_0x3815f5[_0xd201('0x2e')],'resourceId':_0x3815f5['id'],'type':_0x43ed24[_0xd201('0x2e')],'sectionId':_0x43ed24['id']},{})[_0xd201('0x2c')](function(){return _0x47fe8f;});}else{return _0x47fe8f;}})[_0xd201('0x48')](function(_0x25bca1){logger[_0xd201('0x2d')](_0xd201('0x57'),_0x25bca1);});}return _0x47fe8f;});})[_0xd201('0x2c')](respondWithResult(_0x40ea32,0xc9))['catch'](handleError(_0x40ea32,null));};exports['destroy']=function(_0x421042,_0x188d49,_0x2d70fe){var _0x2aa646;return db[_0xd201('0x31')][_0xd201('0x47')]({'where':{'id':_0x421042[_0xd201('0x45')]['id']}})[_0xd201('0x2c')](function(_0xc71b9d){if(_0xc71b9d){return db[_0xd201('0x4c')][_0xd201('0x58')](function(_0x209790){return _0xc71b9d[_0xd201('0x2b')]({'transaction':_0x209790,'raw':!![]})[_0xd201('0x2c')](function(_0x4d0e3b){if(_0x4d0e3b[_0xd201('0x4f')]){fs['readdirSync'](_0x4d0e3b[_0xd201('0x4f')])[_0xd201('0x59')](function(_0x507b1d){fs[_0xd201('0x5a')](path[_0xd201('0x50')](_0x4d0e3b['directory'],_0x507b1d));});fs[_0xd201('0x5b')](_0x4d0e3b['directory']);}return _0x4d0e3b;});})[_0xd201('0x48')](function(_0x1f5d2a){throw new db['Sequelize'][(_0xd201('0x5c'))](_0x1f5d2a[_0xd201('0x5d')]);});}})['then'](handleEntityNotFound(_0x188d49,null))[_0xd201('0x2c')](removeEntity(_0x188d49,null))['catch'](handleError(_0x188d49,null));};exports[_0xd201('0x5e')]=function(_0x389e79,_0x11dcbb,_0x50f7f4){return db[_0xd201('0x4c')]['transaction'](function(_0x2e765e){var _0x22baed;return db[_0xd201('0x31')]['find']({'where':{'id':_0x389e79[_0xd201('0x45')]['id']}})[_0xd201('0x2c')](function(_0x535c0c){if(_0x535c0c){_0x22baed=_0x535c0c;return _0x535c0c[_0xd201('0x5e')](_0x389e79[_0xd201('0x4a')]['id'],{'transaction':_0x2e765e});}})['then'](function(_0x596f65){if(_0x596f65){return db[_0xd201('0x5f')][_0xd201('0x60')]({'where':{'id':_0x389e79[_0xd201('0x4a')]['id']},'attributes':['id',_0xd201('0x2e'),_0xd201('0x61'),_0xd201('0x62'),'createdAt'],'raw':!![]});}})['then'](function(_0x1da208){if(_0x1da208){var _0x164cde=path[_0xd201('0x50')](config[_0xd201('0x63')],_0xd201('0x64'),util[_0xd201('0x65')](_0xd201('0x66'),path[_0xd201('0x67')](_0x1da208[_0xd201('0x61')],path[_0xd201('0x68')](_0x1da208[_0xd201('0x61')])),_0x1da208[_0xd201('0x62')]));var _0x235f63=path['join'](config[_0xd201('0x63')],_0xd201('0x51'),_0x22baed[_0xd201('0x2e')],util['format'](_0xd201('0x66'),_0x1da208['name'],_0x1da208['converted_format']));fs[_0xd201('0x69')](_0x164cde,_0x235f63);return _0x1da208;}})['catch'](function(_0x1f461a){throw new db[(_0xd201('0x6a'))][(_0xd201('0x5c'))](_0x1f461a[_0xd201('0x5d')]);});})[_0xd201('0x2c')](handleEntityNotFound(_0x11dcbb,null))['then'](respondWithResult(_0x11dcbb,0xc9))['catch'](handleError(_0x11dcbb,null));};exports[_0xd201('0x6b')]=function(_0x2ee111,_0x28b8ca,_0x930dfc){return db[_0xd201('0x4c')][_0xd201('0x58')](function(_0x47e93b){var _0x2ec728;return db[_0xd201('0x31')]['findOne']({'where':{'id':_0x2ee111[_0xd201('0x45')]['id']}})[_0xd201('0x2c')](handleEntityNotFound(_0x28b8ca,null))['then'](function(_0x27ee1b){if(_0x27ee1b){_0x2ec728=_0x27ee1b;return _0x27ee1b[_0xd201('0x6b')](_0x2ee111[_0xd201('0x45')][_0xd201('0x6c')]);}})[_0xd201('0x2c')](function(_0x10c871){if(_0x10c871){return db[_0xd201('0x5f')][_0xd201('0x60')]({'where':{'id':_0x2ee111['params'][_0xd201('0x6c')]},'attributes':['id',_0xd201('0x2e'),_0xd201('0x61'),_0xd201('0x62'),'createdAt'],'raw':!![]});}})[_0xd201('0x2c')](function(_0xc636ce){if(_0xc636ce){fs[_0xd201('0x5a')](path[_0xd201('0x50')](_0x2ec728['directory'],util[_0xd201('0x65')]('%s.%s',_0xc636ce[_0xd201('0x2e')],_0xc636ce[_0xd201('0x62')])));return _0xc636ce;}})[_0xd201('0x48')](function(_0xe06fed){throw new db[(_0xd201('0x6a'))][(_0xd201('0x5c'))](_0xe06fed['message']);});})[_0xd201('0x2c')](handleEntityNotFound(_0x28b8ca,null))[_0xd201('0x2c')](respondWithStatusCode(_0x28b8ca,0xcc))[_0xd201('0x48')](handleError(_0x28b8ca,null));};exports['getSounds']=function(_0x340d76,_0x36ba02,_0x37b1f2){var _0x5ee22d={};var _0x54d63b={};var _0x101d82;var _0x534265;return db[_0xd201('0x31')][_0xd201('0x60')]({'where':{'id':_0x340d76[_0xd201('0x45')]['id']}})['then'](handleEntityNotFound(_0x36ba02,null))[_0xd201('0x2c')](function(_0x4493ca){if(_0x4493ca){_0x101d82=_0x4493ca;_0x54d63b['model']=_['keys'](db['Sound'][_0xd201('0x32')]);_0x54d63b[_0xd201('0x37')]=_[_0xd201('0x34')](_0x340d76['query']);_0x54d63b[_0xd201('0x35')]=_[_0xd201('0x36')](_0x54d63b[_0xd201('0x33')],_0x54d63b[_0xd201('0x37')]);_0x5ee22d[_0xd201('0x38')]=_[_0xd201('0x36')](_0x54d63b[_0xd201('0x33')],qs[_0xd201('0x39')](_0x340d76[_0xd201('0x37')][_0xd201('0x39')]));_0x5ee22d[_0xd201('0x38')]=_0x5ee22d['attributes'][_0xd201('0x46')]?_0x5ee22d[_0xd201('0x38')]:_0x54d63b[_0xd201('0x33')];_0x5ee22d['order']=qs[_0xd201('0x3d')](_0x340d76[_0xd201('0x37')][_0xd201('0x3d')]);_0x5ee22d[_0xd201('0x3f')]=qs[_0xd201('0x35')](_[_0xd201('0x6d')](_0x340d76[_0xd201('0x37')],_0x54d63b[_0xd201('0x35')]));if(_0x340d76[_0xd201('0x37')]['filter']){_0x5ee22d[_0xd201('0x3f')]=_[_0xd201('0x40')](_0x5ee22d['where'],{'$or':_[_0xd201('0x30')](_0x5ee22d[_0xd201('0x38')],function(_0x1f9f94){var _0x2463cd={};_0x2463cd[_0x1f9f94]={'$like':'%'+_0x340d76[_0xd201('0x37')][_0xd201('0x3e')]+'%'};return _0x2463cd;})});}_0x5ee22d=_[_0xd201('0x40')]({},_0x5ee22d,_0x340d76[_0xd201('0x6e')]);return _0x101d82[_0xd201('0x6f')](_0x5ee22d);}})[_0xd201('0x2c')](function(_0x32769c){if(_0x32769c){_0x534265=_0x32769c['length'];if(!_0x340d76[_0xd201('0x37')][_0xd201('0x3a')]('nolimit')){_0x5ee22d[_0xd201('0x1f')]=qs[_0xd201('0x1f')](_0x340d76[_0xd201('0x37')][_0xd201('0x1f')]);_0x5ee22d[_0xd201('0x1e')]=qs[_0xd201('0x1e')](_0x340d76[_0xd201('0x37')][_0xd201('0x1e')]);}return _0x101d82['getSounds'](_0x5ee22d);}})[_0xd201('0x2c')](function(_0x422b2f){if(_0x422b2f){return _0x422b2f?{'count':_0x534265,'rows':_0x422b2f}:null;}})[_0xd201('0x2c')](respondWithResult(_0x36ba02,null))['catch'](handleError(_0x36ba02,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 8ad76ef..c474b4a 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 _0xfe8f=['api','bluebird','path','rimraf','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','../../config/logger'];(function(_0x1c9099,_0xdf8dfa){var _0x1df5d9=function(_0x4c573b){while(--_0x4c573b){_0x1c9099['push'](_0x1c9099['shift']());}};_0x1df5d9(++_0xdf8dfa);}(_0xfe8f,0x152));var _0xffe8=function(_0x428014,_0x2aab8c){_0x428014=_0x428014-0x0;var _0x512ad5=_0xfe8f[_0x428014];return _0x512ad5;};'use strict';var _=require(_0xffe8('0x0'));var util=require('util');var logger=require(_0xffe8('0x1'))(_0xffe8('0x2'));var moment=require('moment');var BPromise=require(_0xffe8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffe8('0x4'));var rimraf=require(_0xffe8('0x5'));var config=require('../../config/environment');var attributes=require(_0xffe8('0x6'));module[_0xffe8('0x7')]=function(_0x3f4995,_0x2fc705){return _0x3f4995[_0xffe8('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xffe8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ac=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x3c0edd,_0x522f7c){var _0x33b6c7=function(_0x233f4b){while(--_0x233f4b){_0x3c0edd['push'](_0x3c0edd['shift']());}};_0x33b6c7(++_0x522f7c);}(_0xf4ac,0x194));var _0xcf4a=function(_0x518a72,_0xea3782){_0x518a72=_0x518a72-0x0;var _0x497892=_0xf4ac[_0x518a72];return _0x497892;};'use strict';var _=require(_0xcf4a('0x0'));var util=require(_0xcf4a('0x1'));var logger=require(_0xcf4a('0x2'))(_0xcf4a('0x3'));var moment=require(_0xcf4a('0x4'));var BPromise=require(_0xcf4a('0x5'));var rp=require(_0xcf4a('0x6'));var fs=require('fs');var path=require(_0xcf4a('0x7'));var rimraf=require(_0xcf4a('0x8'));var config=require(_0xcf4a('0x9'));var attributes=require(_0xcf4a('0xa'));module[_0xcf4a('0xb')]=function(_0x5414ad,_0x375ff9){return _0x5414ad[_0xcf4a('0xc')](_0xcf4a('0xd'),attributes,{'tableName':_0xcf4a('0xe'),'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 9f28f15..133698c 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x2c69e9,_0x193e3e){var _0x3f9b49=function(_0x4e8266){while(--_0x4e8266){_0x2c69e9['push'](_0x2c69e9['shift']());}};_0x3f9b49(++_0x193e3e);}(_0xedd9,0xfc));var _0x9edd=function(_0xe59a92,_0x72558a){_0xe59a92=_0xe59a92-0x0;var _0x3f9246=_0xedd9[_0xe59a92];return _0x3f9246;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2c6153,_0x566230){var _0x4f936f=function(_0x4d34b2){while(--_0x4d34b2){_0x2c6153['push'](_0x2c6153['shift']());}};_0x4f936f(++_0x566230);}(_0x70e0,0x17b));var _0x070e=function(_0x3149dc,_0x49810b){_0x3149dc=_0x3149dc-0x0;var _0x22bdd6=_0x70e0[_0x3149dc];return _0x22bdd6;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e914344..894e229 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 _0x15cb=['removeAgents','removeTeams','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy'];(function(_0xdc8eac,_0x2ce7e4){var _0x47d9e5=function(_0x3abcdf){while(--_0x3abcdf){_0xdc8eac['push'](_0xdc8eac['shift']());}};_0x47d9e5(++_0x2ce7e4);}(_0x15cb,0x16f));var _0xb15c=function(_0x242824,_0x20502e){_0x242824=_0x242824-0x0;var _0x4b1f37=_0x15cb[_0x242824];return _0x4b1f37;};'use strict';var multer=require('multer');var util=require(_0xb15c('0x0'));var path=require('path');var timeout=require(_0xb15c('0x1'));var express=require('express');var router=express[_0xb15c('0x2')]();var fs_extra=require(_0xb15c('0x3'));var auth=require(_0xb15c('0x4'));var interaction=require(_0xb15c('0x5'));var config=require('../../config/environment');var controller=require(_0xb15c('0x6'));router[_0xb15c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb15c('0x7')](_0xb15c('0x8'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xa')]);router[_0xb15c('0x7')](_0xb15c('0xb'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xc')]);router['get'](_0xb15c('0xd'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xb15c('0xe'),auth[_0xb15c('0x9')](),controller[_0xb15c('0xf')]);router[_0xb15c('0x10')]('/',auth[_0xb15c('0x9')](),controller[_0xb15c('0x11')]);router['post']('/:id/users',auth[_0xb15c('0x9')](),controller['addAgents']);router[_0xb15c('0x10')](_0xb15c('0xe'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x12')]);router[_0xb15c('0x13')](_0xb15c('0xb'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x14')]);router[_0xb15c('0x15')](_0xb15c('0xb'),auth['isAuthenticated'](),controller[_0xb15c('0x16')]);router[_0xb15c('0x15')]('/:id/users',auth[_0xb15c('0x9')](),controller[_0xb15c('0x17')]);router[_0xb15c('0x15')](_0xb15c('0xe'),auth[_0xb15c('0x9')](),controller[_0xb15c('0x18')]);module[_0xb15c('0x19')]=router; \ No newline at end of file +var _0x0738=['index','/describe','describe','show','/:id/users','getAgents','post','addAgents','addTeams','put','/:id','update','delete','destroy','/:id/teams','removeTeams','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x3e7bec,_0x318bc0){var _0x1094d8=function(_0x54d849){while(--_0x54d849){_0x3e7bec['push'](_0x3e7bec['shift']());}};_0x1094d8(++_0x318bc0);}(_0x0738,0xb9));var _0x8073=function(_0x551b1c,_0x3584f9){_0x551b1c=_0x551b1c-0x0;var _0x131273=_0x0738[_0x551b1c];return _0x131273;};'use strict';var multer=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var path=require(_0x8073('0x2'));var timeout=require(_0x8073('0x3'));var express=require(_0x8073('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8073('0x5'));var interaction=require(_0x8073('0x6'));var config=require(_0x8073('0x7'));var controller=require(_0x8073('0x8'));router[_0x8073('0x9')]('/',auth[_0x8073('0xa')](),controller[_0x8073('0xb')]);router[_0x8073('0x9')](_0x8073('0xc'),auth[_0x8073('0xa')](),controller[_0x8073('0xd')]);router['get']('/:id',auth[_0x8073('0xa')](),controller[_0x8073('0xe')]);router['get'](_0x8073('0xf'),auth[_0x8073('0xa')](),controller[_0x8073('0x10')]);router[_0x8073('0x9')]('/:id/teams',auth[_0x8073('0xa')](),controller['getTeams']);router[_0x8073('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8073('0x11')](_0x8073('0xf'),auth['isAuthenticated'](),controller[_0x8073('0x12')]);router[_0x8073('0x11')]('/:id/teams',auth[_0x8073('0xa')](),controller[_0x8073('0x13')]);router[_0x8073('0x14')](_0x8073('0x15'),auth['isAuthenticated'](),controller[_0x8073('0x16')]);router[_0x8073('0x17')](_0x8073('0x15'),auth[_0x8073('0xa')](),controller[_0x8073('0x18')]);router[_0x8073('0x17')]('/:id/users',auth[_0x8073('0xa')](),controller['removeAgents']);router[_0x8073('0x17')](_0x8073('0x19'),auth['isAuthenticated'](),controller[_0x8073('0x1a')]);module[_0x8073('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 5b44784..a4606cf 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 _0xdb4d=['sequelize','exports','system-','getDataValue','STRING'];(function(_0x3beb25,_0x4bf00b){var _0xdbcf9d=function(_0x2a51b3){while(--_0x2a51b3){_0x3beb25['push'](_0x3beb25['shift']());}};_0xdbcf9d(++_0x4bf00b);}(_0xdb4d,0x1ea));var _0xddb4=function(_0x13d6be,_0x22a619){_0x13d6be=_0x13d6be-0x0;var _0x5a0eba=_0xdb4d[_0x13d6be];return _0x5a0eba;};'use strict';var Sequelize=require(_0xddb4('0x0'));module[_0xddb4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x3b0f03){return _0xddb4('0x2')+this[_0xddb4('0x3')]('name')+'-';}},'description':{'type':Sequelize[_0xddb4('0x4')]},'callerIdAll':{'type':Sequelize[_0xddb4('0x4')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7b8e=['sequelize','exports','STRING','name','system-','INTEGER'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7b8e,0x6c));var _0xe7b8=function(_0xd15168,_0xda0575){_0xd15168=_0xd15168-0x0;var _0xba16ed=_0x7b8e[_0xd15168];return _0xba16ed;};'use strict';var Sequelize=require(_0xe7b8('0x0'));module[_0xe7b8('0x1')]={'name':{'type':Sequelize[_0xe7b8('0x2')],'allowNull':![],'unique':_0xe7b8('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x308ae0){return _0xe7b8('0x4')+this['getDataValue'](_0xe7b8('0x3'))+'-';}},'description':{'type':Sequelize[_0xe7b8('0x2')]},'callerIdAll':{'type':Sequelize[_0xe7b8('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe7b8('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 2bc44b9..64741e4 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 _0x0972=['filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','create','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','system','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','get','Extensions\x20creation\x20failed','prefix','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','length','charAt','system-','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','addTeams','Team','findAll','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query'];(function(_0xc6fa7a,_0x38d01d){var _0x57f0ed=function(_0x3bd403){while(--_0x3bd403){_0xc6fa7a['push'](_0xc6fa7a['shift']());}};_0x57f0ed(++_0x38d01d);}(_0x0972,0x64));var _0x2097=function(_0x29eafb,_0x5b3960){_0x29eafb=_0x29eafb-0x0;var _0x3c0307=_0x0972[_0x29eafb];return _0x3c0307;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];config[_0x2097('0x1a')]=_[_0x2097('0x1b')](config[_0x2097('0x1a')],{'host':_0x2097('0x1c'),'port':0x18eb});var socket=require(_0x2097('0x1d'))(new Redis(config[_0x2097('0x1a')]));require(_0x2097('0x1e'))[_0x2097('0x1f')](socket);function respondWithStatusCode(_0x354387,_0x5d0a43){_0x5d0a43=_0x5d0a43||0xcc;return function(_0x639c14){if(_0x639c14){return _0x354387[_0x2097('0x20')](_0x5d0a43);}return _0x354387['status'](_0x5d0a43)['end']();};}function respondWithResult(_0x4fc8c5,_0x409deb){_0x409deb=_0x409deb||0xc8;return function(_0x588396){if(_0x588396){return _0x4fc8c5[_0x2097('0x21')](_0x409deb)[_0x2097('0x22')](_0x588396);}};}function respondWithFilteredResult(_0x43fec9,_0x1347e4){return function(_0x44c584){if(_0x44c584){var _0x53e2b4=typeof _0x1347e4[_0x2097('0x23')]===_0x2097('0x24')&&typeof _0x1347e4[_0x2097('0x25')]===_0x2097('0x24');var _0x1d3804=_0x44c584[_0x2097('0x26')];var _0x253f5d=_0x53e2b4?0x0:_0x1347e4[_0x2097('0x23')];var _0x5d8b9e=_0x53e2b4?_0x44c584['count']:_0x1347e4[_0x2097('0x23')]+_0x1347e4['limit'];var _0x227c00;if(_0x5d8b9e>=_0x1d3804){_0x5d8b9e=_0x1d3804;_0x227c00=0xc8;}else{_0x227c00=0xce;}_0x43fec9[_0x2097('0x21')](_0x227c00);return _0x43fec9['set'](_0x2097('0x27'),_0x253f5d+'-'+_0x5d8b9e+'/'+_0x1d3804)['json'](_0x44c584);}return null;};}function patchUpdates(_0x2e17c8){return function(_0xf32d3f){try{jsonpatch[_0x2097('0x28')](_0xf32d3f,_0x2e17c8,!![]);}catch(_0x20b93a){return BPromise[_0x2097('0x29')](_0x20b93a);}return _0xf32d3f[_0x2097('0x2a')]();};}function saveUpdates(_0x56390a,_0xae5f9){return function(_0x500234){if(_0x500234){return _0x500234[_0x2097('0x2b')](_0x56390a)[_0x2097('0x2c')](function(_0x345875){return _0x345875;});}return null;};}function removeEntity(_0x9f59bc,_0x499988){return function(_0x2d683a){if(_0x2d683a){return _0x2d683a[_0x2097('0x2d')]()['then'](function(){var _0x1229fc=_0x2d683a['get']({'plain':!![]});var _0x29b879='VoicePrefixes';return db[_0x2097('0x2e')][_0x2097('0x2d')]({'where':{'type':_0x29b879,'resourceId':_0x1229fc['id']}})[_0x2097('0x2c')](function(){return _0x2d683a;});})[_0x2097('0x2c')](function(){_0x9f59bc[_0x2097('0x21')](0xcc)[_0x2097('0x2f')]();});}};}function handleEntityNotFound(_0x450e0b,_0x4b443d){return function(_0x11242f){if(!_0x11242f){_0x450e0b[_0x2097('0x20')](0x194);}return _0x11242f;};}function handleError(_0x5cce55,_0x1398d0){_0x1398d0=_0x1398d0||0x1f4;return function(_0x41487d){logger['error'](_0x41487d['stack']);if(_0x41487d[_0x2097('0x30')]){delete _0x41487d[_0x2097('0x30')];}_0x5cce55[_0x2097('0x21')](_0x1398d0)[_0x2097('0x31')](_0x41487d);};}exports[_0x2097('0x32')]=function(_0x180654,_0x56c538){var _0xe1a381={},_0x56bb42={},_0x193160={'count':0x0,'rows':[]};var _0x3c36d3=_[_0x2097('0x33')](db[_0x2097('0x34')][_0x2097('0x35')],function(_0x395d9f){return{'name':_0x395d9f[_0x2097('0x36')],'type':_0x395d9f[_0x2097('0x37')][_0x2097('0x38')]};});_0x56bb42['model']=_[_0x2097('0x33')](_0x3c36d3,_0x2097('0x30'));_0x56bb42[_0x2097('0x39')]=_['keys'](_0x180654[_0x2097('0x39')]);_0x56bb42[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x56bb42[_0x2097('0x3c')],_0x56bb42['query']);_0xe1a381['attributes']=_['intersection'](_0x56bb42[_0x2097('0x3c')],qs[_0x2097('0x3d')](_0x180654[_0x2097('0x39')][_0x2097('0x3d')]));_0xe1a381[_0x2097('0x3e')]=_0xe1a381[_0x2097('0x3e')]['length']?_0xe1a381[_0x2097('0x3e')]:_0x56bb42[_0x2097('0x3c')];if(!_0x180654[_0x2097('0x39')][_0x2097('0x3f')](_0x2097('0x40'))){_0xe1a381[_0x2097('0x25')]=qs['limit'](_0x180654[_0x2097('0x39')][_0x2097('0x25')]);_0xe1a381[_0x2097('0x23')]=qs['offset'](_0x180654['query'][_0x2097('0x23')]);}_0xe1a381[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x180654[_0x2097('0x39')][_0x2097('0x42')]);_0xe1a381[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x180654[_0x2097('0x39')],_0x56bb42[_0x2097('0x3a')]),_0x3c36d3);if(_0x180654[_0x2097('0x39')][_0x2097('0x45')]){_0xe1a381['where']=_[_0x2097('0x46')](_0xe1a381[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x3c36d3,function(_0x483900){if(_0x483900[_0x2097('0x37')]!==_0x2097('0x47')){var _0x26d448={};_0x26d448[_0x483900[_0x2097('0x30')]]={'$like':'%'+_0x180654[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x26d448;}})});}_0xe1a381=_[_0x2097('0x46')]({},_0xe1a381,_0x180654[_0x2097('0x48')]);var _0x5ab893={'where':_0xe1a381[_0x2097('0x43')]};return db[_0x2097('0x34')][_0x2097('0x26')](_0x5ab893)[_0x2097('0x2c')](function(_0x12e0e2){_0x193160[_0x2097('0x26')]=_0x12e0e2;if(_0x180654[_0x2097('0x39')][_0x2097('0x49')]){_0xe1a381['include']=[{'all':!![]}];}return db[_0x2097('0x34')]['findAll'](_0xe1a381);})[_0x2097('0x2c')](function(_0x298e49){_0x193160[_0x2097('0x4a')]=_0x298e49;return _0x193160;})[_0x2097('0x2c')](respondWithFilteredResult(_0x56c538,_0xe1a381))[_0x2097('0x4b')](handleError(_0x56c538,null));};exports['show']=function(_0x2cf34e,_0x46ccbb){var _0x113c3b={'raw':![],'where':{'id':_0x2cf34e[_0x2097('0x4c')]['id']}},_0x39e0a4={};_0x39e0a4['model']=_[_0x2097('0x4d')](db[_0x2097('0x34')][_0x2097('0x35')]);_0x39e0a4[_0x2097('0x39')]=_[_0x2097('0x4d')](_0x2cf34e[_0x2097('0x39')]);_0x39e0a4[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x39e0a4['model'],_0x39e0a4[_0x2097('0x39')]);_0x113c3b[_0x2097('0x3e')]=_[_0x2097('0x3b')](_0x39e0a4[_0x2097('0x3c')],qs['fields'](_0x2cf34e['query']['fields']));_0x113c3b[_0x2097('0x3e')]=_0x113c3b[_0x2097('0x3e')]['length']?_0x113c3b[_0x2097('0x3e')]:_0x39e0a4[_0x2097('0x3c')];if(_0x2cf34e['query']['includeAll']){_0x113c3b[_0x2097('0x4e')]=[{'all':!![]}];}_0x113c3b=_[_0x2097('0x46')]({},_0x113c3b,_0x2cf34e[_0x2097('0x48')]);return db['VoicePrefix'][_0x2097('0x4f')](_0x113c3b)[_0x2097('0x2c')](handleEntityNotFound(_0x46ccbb,null))['then'](respondWithResult(_0x46ccbb,null))[_0x2097('0x4b')](handleError(_0x46ccbb,null));};exports[_0x2097('0x2d')]=function(_0xdfea21,_0xba6ef0){return db[_0x2097('0x34')]['find']({'where':{'id':_0xdfea21['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0xba6ef0,null))[_0x2097('0x2c')](removeEntity(_0xba6ef0,null))[_0x2097('0x4b')](handleError(_0xba6ef0,null));};exports['describe']=function(_0x5c1739,_0x144719){return db[_0x2097('0x34')]['describe']()[_0x2097('0x2c')](respondWithResult(_0x144719,null))[_0x2097('0x4b')](handleError(_0x144719,null));};exports[_0x2097('0x50')]=function(_0x33490e,_0x390a52){var _0x4a709a;return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x190859){return db['VoicePrefix'][_0x2097('0x50')](_0x33490e[_0x2097('0x53')],{'transaction':_0x190859})['then'](function(_0x12ba76){_0x4a709a=_0x12ba76['get']({'plain':!![]});return db[_0x2097('0x54')]['find']({'where':{'id':_0x4a709a['VoiceExtensionId']},'raw':!![]})['then'](function(_0x40cbe1){return createVoicePrefixExtensions(_0x4a709a,_0x40cbe1,_0x190859);});});})['then'](function(){var _0x54bea1=_0x33490e[_0x2097('0x55')]['get']({'plain':!![]});if(!_0x54bea1)throw new Error(_0x2097('0x56'));if(_0x54bea1[_0x2097('0x57')]==='user'){var _0x3e799f=_0x4a709a;return db[_0x2097('0x58')][_0x2097('0x4f')]({'where':{'name':_0x2097('0x59'),'userProfileId':_0x54bea1[_0x2097('0x5a')]},'raw':!![]})['then'](function(_0x2117e3){if(_0x2117e3&&_0x2117e3['autoAssociation']===0x0){return db[_0x2097('0x2e')][_0x2097('0x50')]({'name':_0x3e799f[_0x2097('0x30')],'resourceId':_0x3e799f['id'],'type':_0x2117e3['name'],'sectionId':_0x2117e3['id']},{})[_0x2097('0x2c')](function(){return _0x4a709a;});}else{return _0x4a709a;}})[_0x2097('0x4b')](function(_0x2f5016){logger[_0x2097('0x5b')](_0x2097('0x5c'),_0x2f5016);throw _0x2f5016;});}return _0x4a709a;})['then'](respondWithResult(_0x390a52,null))['catch'](handleError(_0x390a52,null));};function Extension(_0x265eac,_0x275578,_0x4cc782,_0x4ddb4b){this['context']='from-sip';this[_0x2097('0x5d')]=_0x265eac;this['app']=_0x4cc782;this[_0x2097('0x37')]=_0x2097('0x5e');this['description']=_0x2097('0x5f');this[_0x2097('0x60')]=_0x275578;this[_0x2097('0x61')]=_0x4ddb4b;}function createVoicePrefixExtensions(_0x103756,_0x2a2673,_0x60332a){return new BPromise(function(_0x15aa91,_0x8f7aaa){var _0x2ec365=new Extension(formatPrefixName(_0x103756['prefix']),0x1,_0x2097('0x62'),_0x2097('0x63'));_0x2ec365[_0x2097('0x64')]=_0x103756['id'];return db[_0x2097('0x54')][_0x2097('0x50')](_0x2ec365,{'transaction':_0x60332a})[_0x2097('0x2c')](function(_0x4befa9){var _0x43071d=_0x4befa9[_0x2097('0x65')]({'plain':!![]});var _0xcabda7=_[_0x2097('0x33')](addVoicePrefixExtensions(_0x103756,_0x2a2673),function(_0x1c4156){_0x1c4156['VoiceExtensionId']=_0x43071d['id'];_0x1c4156[_0x2097('0x64')]=_0x103756['id'];return _0x1c4156;});return db[_0x2097('0x54')]['bulkCreate'](_0xcabda7,{'transaction':_0x60332a})['then'](function(_0x580c1e){if(!_0x580c1e){return _0x8f7aaa(_0x2097('0x66'));}else{return _0x15aa91(_0x580c1e);}})[_0x2097('0x4b')](function(_0x319d3b){return _0x8f7aaa(_0x319d3b);});});;});};function addVoicePrefixExtensions(_0x3edb3e,_0x168703){var _0x18d90a=[];var _0x2e287b=formatPrefixName(_0x3edb3e[_0x2097('0x67')]);_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x2,'Set','CDR(prefix)='+_0x3edb3e[_0x2097('0x30')]));if(_0x3edb3e[_0x2097('0x69')]){_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x3,_0x2097('0x6a'),_0x2097('0x6b')+_0x3edb3e[_0x2097('0x69')]));}else{_0x18d90a['push'](new Extension(_0x2e287b,0x3,_0x2097('0x62'),_0x2097('0x6c')));}_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x4,_0x2097('0x6d'),_0x168703['context']+','+'${EXTEN:'+(0x8+_0x3edb3e[_0x2097('0x30')][_0x2097('0x6e')])+'}'+','+0x1));return _0x18d90a;}function formatPrefixName(_0x487f1f){var _0x3707da='_';for(var _0x426290=0x0;_0x426290<_0x487f1f[_0x2097('0x6e')];_0x426290++){if(_0x487f1f[_0x2097('0x6f')](_0x426290)=='-'){_0x3707da+=_0x487f1f[_0x2097('0x6f')](_0x426290);}else{_0x3707da+='['+_0x487f1f[_0x2097('0x6f')](_0x426290)+']';}}_0x3707da+='.';return _0x3707da;}exports[_0x2097('0x2b')]=function(_0x2c6f24,_0x54159e,_0x4533fd){var _0x283e2b=_0x2c6f24['body'];_0x283e2b[_0x2097('0x67')]=_0x2097('0x70')+_0x283e2b[_0x2097('0x30')]+'-';return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x46d6b5){return db[_0x2097('0x34')][_0x2097('0x2b')](_0x283e2b,{'where':{'id':_0x283e2b['id']},'transaction':_0x46d6b5})[_0x2097('0x2c')](function(){return db[_0x2097('0x54')][_0x2097('0x2d')]({'where':{'VoicePrefixId':_0x283e2b['id']},'transaction':_0x46d6b5})['then'](function(){return db[_0x2097('0x54')][_0x2097('0x4f')]({'where':{'id':_0x283e2b[_0x2097('0x71')]},'raw':!![]})[_0x2097('0x2c')](function(_0x3c9e03){return createVoicePrefixExtensions(_0x283e2b,_0x3c9e03,_0x46d6b5);});});});})['then'](function(){return db[_0x2097('0x34')][_0x2097('0x72')](_0x283e2b['id']);})[_0x2097('0x2c')](respondWithResult(_0x54159e,null))['catch'](handleError(_0x54159e,null));};exports[_0x2097('0x73')]=function(_0x545cd9,_0x364d3a,_0x4dcd9c){return db[_0x2097('0x34')]['find']({'where':{'id':_0x545cd9[_0x2097('0x4c')]['id']}})['then'](handleEntityNotFound(_0x364d3a,null))[_0x2097('0x2c')](function(_0x3dba80){if(_0x3dba80){return _0x3dba80[_0x2097('0x73')](_0x545cd9[_0x2097('0x53')][_0x2097('0x74')],_['omit'](_0x545cd9[_0x2097('0x53')],[_0x2097('0x74'),'id'])||{})[_0x2097('0x75')](function(_0x1f733c){for(var _0xa8416a=0x0;_0xa8416a<_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0x2097('0x6e')];_0xa8416a+=0x1){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':Number(_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0xa8416a]),'VoicePrefixId':Number(_0x545cd9[_0x2097('0x4c')]['id'])});}return _0x1f733c;});}})[_0x2097('0x2c')](respondWithResult(_0x364d3a,null))[_0x2097('0x4b')](handleError(_0x364d3a,null));};exports[_0x2097('0x78')]=function(_0x57a31e,_0x1a81de,_0x4bd44d){return db['VoicePrefix'][_0x2097('0x4f')]({'where':{'id':_0x57a31e[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x1a81de,null))['then'](function(_0x34b687){if(_0x34b687){return _0x34b687[_0x2097('0x78')](_0x57a31e[_0x2097('0x39')][_0x2097('0x74')])['then'](function(){if(_[_0x2097('0x79')](_0x57a31e['query'][_0x2097('0x74')])){for(var _0x385551=0x0;_0x385551<_0x57a31e[_0x2097('0x39')][_0x2097('0x74')]['length'];_0x385551+=0x1){socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e[_0x2097('0x39')]['ids'][_0x385551]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}}else{socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e['query'][_0x2097('0x74')]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}});}})[_0x2097('0x2c')](respondWithStatusCode(_0x1a81de,null))[_0x2097('0x4b')](handleError(_0x1a81de,null));};exports[_0x2097('0x7b')]=function(_0x5efe1e,_0x5d181f,_0x56d4c0){var _0xc7481d={};var _0x3f510d={};var _0x4213d0;var _0x16451c;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x5efe1e['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x5d181f,null))[_0x2097('0x2c')](function(_0x164ad3){if(_0x164ad3){_0x4213d0=_0x164ad3;_0x3f510d[_0x2097('0x3c')]=_[_0x2097('0x4d')](db[_0x2097('0x7d')][_0x2097('0x35')]);_0x3f510d['query']=_[_0x2097('0x4d')](_0x5efe1e[_0x2097('0x39')]);_0x3f510d[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x3f510d[_0x2097('0x3c')],_0x3f510d[_0x2097('0x39')]);_0xc7481d['attributes']=_['intersection'](_0x3f510d[_0x2097('0x3c')],qs['fields'](_0x5efe1e['query'][_0x2097('0x3d')]));_0xc7481d[_0x2097('0x3e')]=_0xc7481d[_0x2097('0x3e')][_0x2097('0x6e')]?_0xc7481d[_0x2097('0x3e')]:_0x3f510d[_0x2097('0x3c')];_0xc7481d[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x5efe1e['query'][_0x2097('0x42')]);_0xc7481d[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x5efe1e[_0x2097('0x39')],_0x3f510d['filters']));if(_0x5efe1e[_0x2097('0x39')][_0x2097('0x45')]){_0xc7481d[_0x2097('0x43')]=_[_0x2097('0x46')](_0xc7481d[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0xc7481d['attributes'],function(_0x33b0c0){var _0x79f858={};_0x79f858[_0x33b0c0]={'$like':'%'+_0x5efe1e['query']['filter']+'%'};return _0x79f858;})});}_0xc7481d=_['merge']({},_0xc7481d,_0x5efe1e['options']);return _0x4213d0[_0x2097('0x7b')](_0xc7481d);}})[_0x2097('0x2c')](function(_0x3fe29e){if(_0x3fe29e){_0x16451c=_0x3fe29e[_0x2097('0x6e')];if(!_0x5efe1e[_0x2097('0x39')]['hasOwnProperty'](_0x2097('0x40'))){_0xc7481d[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x5efe1e[_0x2097('0x39')][_0x2097('0x25')]);_0xc7481d[_0x2097('0x23')]=qs['offset'](_0x5efe1e[_0x2097('0x39')][_0x2097('0x23')]);}return _0x4213d0['getAgents'](_0xc7481d);}})[_0x2097('0x2c')](function(_0x358bc3){if(_0x358bc3){return _0x358bc3?{'count':_0x16451c,'rows':_0x358bc3}:null;}})[_0x2097('0x2c')](respondWithResult(_0x5d181f,null))[_0x2097('0x4b')](handleError(_0x5d181f,null));};exports[_0x2097('0x7e')]=function(_0x498a91,_0x3a7959,_0x35570d){var _0x86f89={};var _0x26a3e5={};var _0x25bb03;var _0x429c9e;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x498a91[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x3a7959,null))[_0x2097('0x2c')](function(_0x299a3e){if(_0x299a3e){_0x25bb03=_0x299a3e;_0x26a3e5[_0x2097('0x3c')]=_['keys'](db['Team'][_0x2097('0x35')]);_0x26a3e5['query']=_['keys'](_0x498a91[_0x2097('0x39')]);_0x26a3e5[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x26a3e5[_0x2097('0x3c')],_0x26a3e5[_0x2097('0x39')]);_0x86f89['attributes']=_['intersection'](_0x26a3e5[_0x2097('0x3c')],qs['fields'](_0x498a91[_0x2097('0x39')]['fields']));_0x86f89['attributes']=_0x86f89['attributes']['length']?_0x86f89['attributes']:_0x26a3e5[_0x2097('0x3c')];_0x86f89[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x498a91[_0x2097('0x39')][_0x2097('0x42')]);_0x86f89[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x498a91[_0x2097('0x39')],_0x26a3e5[_0x2097('0x3a')]));if(_0x498a91[_0x2097('0x39')][_0x2097('0x45')]){_0x86f89[_0x2097('0x43')]=_[_0x2097('0x46')](_0x86f89[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x86f89[_0x2097('0x3e')],function(_0x5e49bc){var _0x1e30c5={};_0x1e30c5[_0x5e49bc]={'$like':'%'+_0x498a91[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x1e30c5;})});}_0x86f89=_[_0x2097('0x46')]({},_0x86f89,_0x498a91[_0x2097('0x48')]);return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x1c5ec7){if(_0x1c5ec7){_0x429c9e=_0x1c5ec7[_0x2097('0x6e')];if(!_0x498a91[_0x2097('0x39')][_0x2097('0x3f')]('nolimit')){_0x86f89[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x498a91[_0x2097('0x39')][_0x2097('0x25')]);_0x86f89[_0x2097('0x23')]=qs[_0x2097('0x23')](_0x498a91['query']['offset']);}return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x2beb7a){if(_0x2beb7a){return _0x2beb7a?{'count':_0x429c9e,'rows':_0x2beb7a}:null;}})['then'](respondWithResult(_0x3a7959,null))[_0x2097('0x4b')](handleError(_0x3a7959,null));};exports[_0x2097('0x7f')]=function(_0x4eeac1,_0x459585,_0x436533){var _0x16405f=_0x4eeac1[_0x2097('0x53')][_0x2097('0x74')];var _0x41f718;return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x16405f},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id',_0x2097('0x30'),_0x2097('0x83'),_0x2097('0x84'),_0x2097('0x85')],'raw':!![]}]})[_0x2097('0x2c')](function(_0x44661a){if(_0x44661a){_0x41f718=_0x44661a;var _0x39e21f=_['flatMap'](_0x44661a,function(_0x2d211b){var _0x1ab39a=_0x2d211b[_0x2097('0x65')]({'plain':!![]});return _0x1ab39a[_0x2097('0x82')];});return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x4eeac1[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](function(_0xecd4fc){return db[_0x2097('0x51')]['transaction'](function(_0x2fb539){return _0xecd4fc[_0x2097('0x7f')](_0x16405f,{'transaction':_0x2fb539})[_0x2097('0x2c')](function(){return BPromise[_0x2097('0x86')](_0x41f718,function(_0x17c494){return db[_0x2097('0x87')][_0x2097('0x88')]({'TeamId':_0x17c494['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},{'transaction':_0x2fb539});});})['then'](function(){return BPromise[_0x2097('0x86')](_0x39e21f,function(_0x239570){return db[_0x2097('0x89')][_0x2097('0x8a')]({'where':{'UserId':_0x239570['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},'transaction':_0x2fb539});});})[_0x2097('0x2c')](function(){_0x39e21f[_0x2097('0x8b')](function(_0x51bb2f){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':_0x51bb2f['id'],'VoicePrefixId':_0xecd4fc['id']});});});});});}})['then'](respondWithStatusCode(_0x459585,null))[_0x2097('0x4b')](handleError(_0x459585,null));};exports[_0x2097('0x8c')]=function(_0x568de5,_0x473a54,_0x53a5ed){return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x568de5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id'],'raw':!![]}]})[_0x2097('0x2c')](handleEntityNotFound(_0x473a54,null))[_0x2097('0x2c')](function(_0x1909d8){var _0x2de4=_[_0x2097('0x33')](_0x1909d8,'id');var _0x43a1f8=[];var _0xb53629=[];var _0x516ed6=squel[_0x2097('0x8d')]();_0x516ed6[_0x2097('0x8e')]('tq.TeamId')['from'](_0x2097('0x8f'),'tq')[_0x2097('0x90')](_0x2097('0x91'),'ut',_0x2097('0x92'))[_0x2097('0x43')](_0x2097('0x93'),_0x568de5[_0x2097('0x4c')]['id']);for(var _0x5626f0=0x0;_0x5626f0<_0x1909d8[_0x2097('0x6e')];_0x5626f0+=0x1){let _0x45bbca=_0x1909d8[_0x5626f0];for(var _0x46fc92=0x0;_0x46fc92<_0x45bbca[_0x2097('0x82')][_0x2097('0x6e')];_0x46fc92+=0x1){let _0x357a5b=_0x45bbca[_0x2097('0x82')][_0x46fc92];var _0x3fcedc=_0x516ed6[_0x2097('0x94')]();_0x3fcedc[_0x2097('0x43')](_0x2097('0x95'),_0x357a5b['id']);_0xb53629['push'](db[_0x2097('0x51')][_0x2097('0x39')](_0x3fcedc['toString'](),{'type':db[_0x2097('0x51')][_0x2097('0x96')]['SELECT']})[_0x2097('0x2c')](function(_0xbe052f){if(_0xbe052f['length']===0x1){return _0x357a5b['id'];}else{var _0x32c5f1=_[_0x2097('0x97')](_[_0x2097('0x33')](_0xbe052f,_0x2097('0x98')),function(_0x456633){return _[_0x2097('0x99')](_0x2de4,_0x456633);});if(_0x32c5f1){return _0x357a5b['id'];}}}));}}return BPromise[_0x2097('0x9a')](_0xb53629)[_0x2097('0x2c')](function(_0x124d8f){_0x43a1f8=_(_0x43a1f8)[_0x2097('0x9b')](_0x124d8f)['compact']()[_0x2097('0x9c')]();return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x568de5[_0x2097('0x4c')]['id']}})['then'](function(_0x1b555e){return db['sequelize'][_0x2097('0x52')](function(_0x1ab515){return _0x1b555e[_0x2097('0x8c')](_0x568de5[_0x2097('0x39')][_0x2097('0x74')],{'transaction':_0x1ab515})[_0x2097('0x2c')](function(){if(!_[_0x2097('0x9d')](_0x43a1f8)){return _0x1b555e[_0x2097('0x78')](_0x43a1f8,{'transaction':_0x1ab515});}})[_0x2097('0x2c')](function(){_0x43a1f8['forEach'](function(_0x22fa5d){socket['emit']('userVoicePrefix:remove',{'UserId':_0x22fa5d,'VoicePrefixId':_0x1b555e['id']});});});});});});})['then'](respondWithStatusCode(_0x473a54,null))['catch'](handleError(_0x473a54,null));}; \ No newline at end of file +var _0x93e9=['VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','${EXTEN:','length','charAt','body','system-','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','options','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','catch','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','appdata','prefix','NoOp'];(function(_0x2af250,_0x14d084){var _0x4d7b02=function(_0x12a220){while(--_0x12a220){_0x2af250['push'](_0x2af250['shift']());}};_0x4d7b02(++_0x14d084);}(_0x93e9,0xcc));var _0x993e=function(_0x644668,_0x7e646d){_0x644668=_0x644668-0x0;var _0x4c9344=_0x93e9[_0x644668];return _0x4c9344;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];config['redis']=_['defaults'](config[_0x993e('0x19')],{'host':_0x993e('0x1a'),'port':0x18eb});var socket=require(_0x993e('0x1b'))(new Redis(config[_0x993e('0x19')]));require(_0x993e('0x1c'))[_0x993e('0x1d')](socket);function respondWithStatusCode(_0x34ddda,_0x20f32a){_0x20f32a=_0x20f32a||0xcc;return function(_0x2a184b){if(_0x2a184b){return _0x34ddda[_0x993e('0x1e')](_0x20f32a);}return _0x34ddda[_0x993e('0x1f')](_0x20f32a)[_0x993e('0x20')]();};}function respondWithResult(_0x3df0e7,_0x125322){_0x125322=_0x125322||0xc8;return function(_0x1f267f){if(_0x1f267f){return _0x3df0e7[_0x993e('0x1f')](_0x125322)[_0x993e('0x21')](_0x1f267f);}};}function respondWithFilteredResult(_0x526e06,_0x22f7cc){return function(_0x1acd21){if(_0x1acd21){var _0x3cc2b9=typeof _0x22f7cc[_0x993e('0x22')]===_0x993e('0x23')&&typeof _0x22f7cc[_0x993e('0x24')]==='undefined';var _0x11cd41=_0x1acd21[_0x993e('0x25')];var _0x1eaf57=_0x3cc2b9?0x0:_0x22f7cc[_0x993e('0x22')];var _0x130a8a=_0x3cc2b9?_0x1acd21[_0x993e('0x25')]:_0x22f7cc[_0x993e('0x22')]+_0x22f7cc[_0x993e('0x24')];var _0x4bbe9c;if(_0x130a8a>=_0x11cd41){_0x130a8a=_0x11cd41;_0x4bbe9c=0xc8;}else{_0x4bbe9c=0xce;}_0x526e06[_0x993e('0x1f')](_0x4bbe9c);return _0x526e06['set'](_0x993e('0x26'),_0x1eaf57+'-'+_0x130a8a+'/'+_0x11cd41)[_0x993e('0x21')](_0x1acd21);}return null;};}function patchUpdates(_0x32b09e){return function(_0x5ba2a1){try{jsonpatch[_0x993e('0x27')](_0x5ba2a1,_0x32b09e,!![]);}catch(_0x13db4e){return BPromise[_0x993e('0x28')](_0x13db4e);}return _0x5ba2a1[_0x993e('0x29')]();};}function saveUpdates(_0x3b45ef,_0x328d22){return function(_0xa1c83e){if(_0xa1c83e){return _0xa1c83e[_0x993e('0x2a')](_0x3b45ef)[_0x993e('0x2b')](function(_0x18f6ac){return _0x18f6ac;});}return null;};}function removeEntity(_0x3fe099,_0x3603fa){return function(_0x4fe471){if(_0x4fe471){return _0x4fe471[_0x993e('0x2c')]()[_0x993e('0x2b')](function(){var _0x52b727=_0x4fe471[_0x993e('0x2d')]({'plain':!![]});var _0x4f5cc1=_0x993e('0x2e');return db[_0x993e('0x2f')][_0x993e('0x2c')]({'where':{'type':_0x4f5cc1,'resourceId':_0x52b727['id']}})[_0x993e('0x2b')](function(){return _0x4fe471;});})['then'](function(){_0x3fe099['status'](0xcc)[_0x993e('0x20')]();});}};}function handleEntityNotFound(_0x466d63,_0x4a4f00){return function(_0x223af0){if(!_0x223af0){_0x466d63[_0x993e('0x1e')](0x194);}return _0x223af0;};}function handleError(_0x248354,_0x4c5ee3){_0x4c5ee3=_0x4c5ee3||0x1f4;return function(_0x2495b7){logger[_0x993e('0x30')](_0x2495b7[_0x993e('0x31')]);if(_0x2495b7[_0x993e('0x32')]){delete _0x2495b7[_0x993e('0x32')];}_0x248354['status'](_0x4c5ee3)[_0x993e('0x33')](_0x2495b7);};}exports['index']=function(_0x782298,_0x5ba163){var _0x1da357={},_0x567ed4={},_0x3b9c3c={'count':0x0,'rows':[]};var _0x2ce5d5=_[_0x993e('0x34')](db[_0x993e('0x35')][_0x993e('0x36')],function(_0x360e2d){return{'name':_0x360e2d['fieldName'],'type':_0x360e2d[_0x993e('0x37')]['key']};});_0x567ed4['model']=_[_0x993e('0x34')](_0x2ce5d5,'name');_0x567ed4[_0x993e('0x38')]=_[_0x993e('0x39')](_0x782298[_0x993e('0x38')]);_0x567ed4[_0x993e('0x3a')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],_0x567ed4[_0x993e('0x38')]);_0x1da357[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x567ed4[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x782298[_0x993e('0x38')][_0x993e('0x3e')]));_0x1da357[_0x993e('0x3d')]=_0x1da357[_0x993e('0x3d')]['length']?_0x1da357[_0x993e('0x3d')]:_0x567ed4[_0x993e('0x3c')];if(!_0x782298[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1da357[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x782298[_0x993e('0x38')][_0x993e('0x24')]);_0x1da357['offset']=qs[_0x993e('0x22')](_0x782298['query'][_0x993e('0x22')]);}_0x1da357[_0x993e('0x41')]=qs[_0x993e('0x42')](_0x782298[_0x993e('0x38')][_0x993e('0x42')]);_0x1da357[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x782298['query'],_0x567ed4[_0x993e('0x3a')]),_0x2ce5d5);if(_0x782298['query'][_0x993e('0x45')]){_0x1da357['where']=_[_0x993e('0x46')](_0x1da357[_0x993e('0x43')],{'$or':_[_0x993e('0x34')](_0x2ce5d5,function(_0x1f1327){if(_0x1f1327[_0x993e('0x37')]!==_0x993e('0x47')){var _0xb728cf={};_0xb728cf[_0x1f1327[_0x993e('0x32')]]={'$like':'%'+_0x782298['query'][_0x993e('0x45')]+'%'};return _0xb728cf;}})});}_0x1da357=_['merge']({},_0x1da357,_0x782298['options']);var _0x1a2712={'where':_0x1da357[_0x993e('0x43')]};return db[_0x993e('0x35')]['count'](_0x1a2712)[_0x993e('0x2b')](function(_0x40719d){_0x3b9c3c[_0x993e('0x25')]=_0x40719d;if(_0x782298['query']['includeAll']){_0x1da357['include']=[{'all':!![]}];}return db[_0x993e('0x35')][_0x993e('0x48')](_0x1da357);})[_0x993e('0x2b')](function(_0x539c9d){_0x3b9c3c[_0x993e('0x49')]=_0x539c9d;return _0x3b9c3c;})[_0x993e('0x2b')](respondWithFilteredResult(_0x5ba163,_0x1da357))['catch'](handleError(_0x5ba163,null));};exports[_0x993e('0x4a')]=function(_0x5f7563,_0x5074a6){var _0x258795={'raw':![],'where':{'id':_0x5f7563[_0x993e('0x4b')]['id']}},_0x576ea={};_0x576ea['model']=_['keys'](db['VoicePrefix'][_0x993e('0x36')]);_0x576ea[_0x993e('0x38')]=_[_0x993e('0x39')](_0x5f7563[_0x993e('0x38')]);_0x576ea['filters']=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],_0x576ea[_0x993e('0x38')]);_0x258795[_0x993e('0x3d')]=_[_0x993e('0x3b')](_0x576ea[_0x993e('0x3c')],qs['fields'](_0x5f7563['query'][_0x993e('0x3e')]));_0x258795[_0x993e('0x3d')]=_0x258795['attributes']['length']?_0x258795[_0x993e('0x3d')]:_0x576ea[_0x993e('0x3c')];if(_0x5f7563[_0x993e('0x38')][_0x993e('0x4c')]){_0x258795[_0x993e('0x4d')]=[{'all':!![]}];}_0x258795=_[_0x993e('0x46')]({},_0x258795,_0x5f7563['options']);return db[_0x993e('0x35')]['find'](_0x258795)[_0x993e('0x2b')](handleEntityNotFound(_0x5074a6,null))[_0x993e('0x2b')](respondWithResult(_0x5074a6,null))[_0x993e('0x4e')](handleError(_0x5074a6,null));};exports[_0x993e('0x2c')]=function(_0x2cba37,_0x276b99){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x2cba37['params']['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x276b99,null))[_0x993e('0x2b')](removeEntity(_0x276b99,null))[_0x993e('0x4e')](handleError(_0x276b99,null));};exports['describe']=function(_0x355912,_0x53c1e9){return db[_0x993e('0x35')][_0x993e('0x50')]()['then'](respondWithResult(_0x53c1e9,null))[_0x993e('0x4e')](handleError(_0x53c1e9,null));};exports[_0x993e('0x51')]=function(_0x579c43,_0x3809ef){var _0x207e27;return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x2e368e){return db['VoicePrefix']['create'](_0x579c43['body'],{'transaction':_0x2e368e})[_0x993e('0x2b')](function(_0x29f8a5){_0x207e27=_0x29f8a5[_0x993e('0x2d')]({'plain':!![]});return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x207e27[_0x993e('0x55')]},'raw':!![]})['then'](function(_0x3a897d){return createVoicePrefixExtensions(_0x207e27,_0x3a897d,_0x2e368e);});});})[_0x993e('0x2b')](function(){var _0x15c8ed=_0x579c43['user'][_0x993e('0x2d')]({'plain':!![]});if(!_0x15c8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c8ed['role']===_0x993e('0x56')){var _0x37d7b1=_0x207e27;return db['UserProfileSection'][_0x993e('0x4f')]({'where':{'name':'VoicePrefixes','userProfileId':_0x15c8ed[_0x993e('0x57')]},'raw':!![]})[_0x993e('0x2b')](function(_0x4a0dbd){if(_0x4a0dbd&&_0x4a0dbd['autoAssociation']===0x0){return db[_0x993e('0x2f')][_0x993e('0x51')]({'name':_0x37d7b1[_0x993e('0x32')],'resourceId':_0x37d7b1['id'],'type':_0x4a0dbd[_0x993e('0x32')],'sectionId':_0x4a0dbd['id']},{})[_0x993e('0x2b')](function(){return _0x207e27;});}else{return _0x207e27;}})[_0x993e('0x4e')](function(_0x4f9225){logger[_0x993e('0x30')](_0x993e('0x58'),_0x4f9225);throw _0x4f9225;});}return _0x207e27;})['then'](respondWithResult(_0x3809ef,null))[_0x993e('0x4e')](handleError(_0x3809ef,null));};function Extension(_0x473e00,_0x1b2113,_0x5ebaec,_0x426341){this[_0x993e('0x59')]=_0x993e('0x5a');this['exten']=_0x473e00;this[_0x993e('0x5b')]=_0x5ebaec;this[_0x993e('0x37')]=_0x993e('0x5c');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x1b2113;this[_0x993e('0x5d')]=_0x426341;}function createVoicePrefixExtensions(_0x98d16c,_0x3a3d29,_0x411484){return new BPromise(function(_0xc62106,_0x55a347){var _0x18367f=new Extension(formatPrefixName(_0x98d16c[_0x993e('0x5e')]),0x1,_0x993e('0x5f'),'Voice\x20Prefix');_0x18367f[_0x993e('0x60')]=_0x98d16c['id'];return db[_0x993e('0x54')][_0x993e('0x51')](_0x18367f,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x5e4ab1){var _0x54417b=_0x5e4ab1[_0x993e('0x2d')]({'plain':!![]});var _0x51cec9=_['map'](addVoicePrefixExtensions(_0x98d16c,_0x3a3d29),function(_0x17c7f7){_0x17c7f7[_0x993e('0x55')]=_0x54417b['id'];_0x17c7f7[_0x993e('0x60')]=_0x98d16c['id'];return _0x17c7f7;});return db[_0x993e('0x54')][_0x993e('0x61')](_0x51cec9,{'transaction':_0x411484})[_0x993e('0x2b')](function(_0x211204){if(!_0x211204){return _0x55a347(_0x993e('0x62'));}else{return _0xc62106(_0x211204);}})[_0x993e('0x4e')](function(_0x113395){return _0x55a347(_0x113395);});});;});};function addVoicePrefixExtensions(_0x300a93,_0x44def2){var _0x2ddc16=[];var _0x609430=formatPrefixName(_0x300a93[_0x993e('0x5e')]);_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x2,'Set',_0x993e('0x64')+_0x300a93[_0x993e('0x32')]));if(_0x300a93['callerIdAll']){_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'Set',_0x993e('0x65')+_0x300a93[_0x993e('0x66')]));}else{_0x2ddc16[_0x993e('0x63')](new Extension(_0x609430,0x3,'NoOp',_0x993e('0x67')));}_0x2ddc16['push'](new Extension(_0x609430,0x4,'goto',_0x44def2[_0x993e('0x59')]+','+_0x993e('0x68')+(0x8+_0x300a93[_0x993e('0x32')][_0x993e('0x69')])+'}'+','+0x1));return _0x2ddc16;}function formatPrefixName(_0x2a243a){var _0x5194de='_';for(var _0x120d51=0x0;_0x120d51<_0x2a243a[_0x993e('0x69')];_0x120d51++){if(_0x2a243a[_0x993e('0x6a')](_0x120d51)=='-'){_0x5194de+=_0x2a243a['charAt'](_0x120d51);}else{_0x5194de+='['+_0x2a243a[_0x993e('0x6a')](_0x120d51)+']';}}_0x5194de+='.';return _0x5194de;}exports['update']=function(_0x1ab10e,_0x6ef96,_0x42288d){var _0x5afba1=_0x1ab10e[_0x993e('0x6b')];_0x5afba1[_0x993e('0x5e')]=_0x993e('0x6c')+_0x5afba1[_0x993e('0x32')]+'-';return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x108cad){return db[_0x993e('0x35')][_0x993e('0x2a')](_0x5afba1,{'where':{'id':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db['VoiceExtension'][_0x993e('0x2c')]({'where':{'VoicePrefixId':_0x5afba1['id']},'transaction':_0x108cad})[_0x993e('0x2b')](function(){return db[_0x993e('0x54')][_0x993e('0x4f')]({'where':{'id':_0x5afba1[_0x993e('0x55')]},'raw':!![]})[_0x993e('0x2b')](function(_0x282c53){return createVoicePrefixExtensions(_0x5afba1,_0x282c53,_0x108cad);});});});})[_0x993e('0x2b')](function(){return db['VoicePrefix']['findById'](_0x5afba1['id']);})[_0x993e('0x2b')](respondWithResult(_0x6ef96,null))['catch'](handleError(_0x6ef96,null));};exports[_0x993e('0x6d')]=function(_0x444da6,_0x2ce913,_0x49788e){return db[_0x993e('0x35')]['find']({'where':{'id':_0x444da6[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x2ce913,null))[_0x993e('0x2b')](function(_0x40768a){if(_0x40768a){return _0x40768a[_0x993e('0x6d')](_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')],_[_0x993e('0x6f')](_0x444da6['body'],['ids','id'])||{})[_0x993e('0x70')](function(_0x5a70ff){for(var _0x2fb182=0x0;_0x2fb182<_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x993e('0x69')];_0x2fb182+=0x1){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':Number(_0x444da6[_0x993e('0x6b')][_0x993e('0x6e')][_0x2fb182]),'VoicePrefixId':Number(_0x444da6[_0x993e('0x4b')]['id'])});}return _0x5a70ff;});}})[_0x993e('0x2b')](respondWithResult(_0x2ce913,null))['catch'](handleError(_0x2ce913,null));};exports[_0x993e('0x73')]=function(_0x14347f,_0x4a0002,_0x4742d9){return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x14347f[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x4a0002,null))[_0x993e('0x2b')](function(_0x4157b6){if(_0x4157b6){return _0x4157b6[_0x993e('0x73')](_0x14347f[_0x993e('0x38')]['ids'])[_0x993e('0x2b')](function(){if(_[_0x993e('0x74')](_0x14347f[_0x993e('0x38')][_0x993e('0x6e')])){for(var _0x53ce16=0x0;_0x53ce16<_0x14347f['query'][_0x993e('0x6e')]['length'];_0x53ce16+=0x1){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')][_0x53ce16]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}}else{socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':Number(_0x14347f[_0x993e('0x38')][_0x993e('0x6e')]),'VoicePrefixId':Number(_0x14347f[_0x993e('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a0002,null))[_0x993e('0x4e')](handleError(_0x4a0002,null));};exports[_0x993e('0x76')]=function(_0x3abd3a,_0x278c2a,_0x3f6347){var _0x1a3967={};var _0x1079e7={};var _0x5c634a;var _0x47c3b6;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x3abd3a[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x278c2a,null))[_0x993e('0x2b')](function(_0x53b0c8){if(_0x53b0c8){_0x5c634a=_0x53b0c8;_0x1079e7['model']=_['keys'](db[_0x993e('0x78')][_0x993e('0x36')]);_0x1079e7[_0x993e('0x38')]=_[_0x993e('0x39')](_0x3abd3a[_0x993e('0x38')]);_0x1079e7['filters']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],_0x1079e7[_0x993e('0x38')]);_0x1a3967['attributes']=_[_0x993e('0x3b')](_0x1079e7[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x3e')]));_0x1a3967[_0x993e('0x3d')]=_0x1a3967['attributes'][_0x993e('0x69')]?_0x1a3967['attributes']:_0x1079e7['model'];_0x1a3967['order']=qs['sort'](_0x3abd3a[_0x993e('0x38')][_0x993e('0x42')]);_0x1a3967[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x3abd3a[_0x993e('0x38')],_0x1079e7[_0x993e('0x3a')]));if(_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]){_0x1a3967['where']=_[_0x993e('0x46')](_0x1a3967['where'],{'$or':_[_0x993e('0x34')](_0x1a3967[_0x993e('0x3d')],function(_0x3e7793){var _0x65c6f0={};_0x65c6f0[_0x3e7793]={'$like':'%'+_0x3abd3a[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x65c6f0;})});}_0x1a3967=_[_0x993e('0x46')]({},_0x1a3967,_0x3abd3a['options']);return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})[_0x993e('0x2b')](function(_0x285c93){if(_0x285c93){_0x47c3b6=_0x285c93['length'];if(!_0x3abd3a[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x1a3967['limit']=qs[_0x993e('0x24')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x24')]);_0x1a3967[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x3abd3a[_0x993e('0x38')][_0x993e('0x22')]);}return _0x5c634a[_0x993e('0x76')](_0x1a3967);}})['then'](function(_0x412d21){if(_0x412d21){return _0x412d21?{'count':_0x47c3b6,'rows':_0x412d21}:null;}})['then'](respondWithResult(_0x278c2a,null))[_0x993e('0x4e')](handleError(_0x278c2a,null));};exports[_0x993e('0x79')]=function(_0x4d6d94,_0x505f28,_0x4e2ccf){var _0x4506cb={};var _0x31e947={};var _0x7800d4;var _0x4e1fcf;return db[_0x993e('0x35')][_0x993e('0x77')]({'where':{'id':_0x4d6d94[_0x993e('0x4b')]['id']}})[_0x993e('0x2b')](handleEntityNotFound(_0x505f28,null))['then'](function(_0xc35545){if(_0xc35545){_0x7800d4=_0xc35545;_0x31e947['model']=_[_0x993e('0x39')](db['Team']['rawAttributes']);_0x31e947[_0x993e('0x38')]=_[_0x993e('0x39')](_0x4d6d94[_0x993e('0x38')]);_0x31e947[_0x993e('0x3a')]=_['intersection'](_0x31e947['model'],_0x31e947['query']);_0x4506cb[_0x993e('0x3d')]=_['intersection'](_0x31e947[_0x993e('0x3c')],qs[_0x993e('0x3e')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x3e')]));_0x4506cb[_0x993e('0x3d')]=_0x4506cb['attributes'][_0x993e('0x69')]?_0x4506cb[_0x993e('0x3d')]:_0x31e947['model'];_0x4506cb[_0x993e('0x41')]=qs['sort'](_0x4d6d94[_0x993e('0x38')][_0x993e('0x42')]);_0x4506cb[_0x993e('0x43')]=qs[_0x993e('0x3a')](_[_0x993e('0x44')](_0x4d6d94[_0x993e('0x38')],_0x31e947[_0x993e('0x3a')]));if(_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]){_0x4506cb['where']=_[_0x993e('0x46')](_0x4506cb['where'],{'$or':_[_0x993e('0x34')](_0x4506cb[_0x993e('0x3d')],function(_0x50dd66){var _0x48acd5={};_0x48acd5[_0x50dd66]={'$like':'%'+_0x4d6d94[_0x993e('0x38')][_0x993e('0x45')]+'%'};return _0x48acd5;})});}_0x4506cb=_['merge']({},_0x4506cb,_0x4d6d94[_0x993e('0x7a')]);return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0xc56e5a){if(_0xc56e5a){_0x4e1fcf=_0xc56e5a['length'];if(!_0x4d6d94[_0x993e('0x38')][_0x993e('0x3f')](_0x993e('0x40'))){_0x4506cb[_0x993e('0x24')]=qs[_0x993e('0x24')](_0x4d6d94['query'][_0x993e('0x24')]);_0x4506cb[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x4d6d94[_0x993e('0x38')][_0x993e('0x22')]);}return _0x7800d4[_0x993e('0x79')](_0x4506cb);}})[_0x993e('0x2b')](function(_0x5d2b00){if(_0x5d2b00){return _0x5d2b00?{'count':_0x4e1fcf,'rows':_0x5d2b00}:null;}})[_0x993e('0x2b')](respondWithResult(_0x505f28,null))['catch'](handleError(_0x505f28,null));};exports[_0x993e('0x7b')]=function(_0x8dc65,_0x4a5755,_0x43b5c5){var _0x4d53d1=_0x8dc65['body'][_0x993e('0x6e')];var _0x371be2;return db['Team'][_0x993e('0x48')]({'where':{'id':_0x4d53d1},'attributes':['id'],'include':[{'model':db[_0x993e('0x78')],'as':_0x993e('0x7c'),'attributes':['id',_0x993e('0x32'),'online',_0x993e('0x7d'),'interface'],'raw':!![]}]})[_0x993e('0x2b')](function(_0x5c9960){if(_0x5c9960){_0x371be2=_0x5c9960;var _0x4286a0=_[_0x993e('0x7e')](_0x5c9960,function(_0x2540e4){var _0x56a23a=_0x2540e4['get']({'plain':!![]});return _0x56a23a[_0x993e('0x7c')];});return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x8dc65[_0x993e('0x4b')]['id']}})['then'](function(_0x37409f){return db['sequelize'][_0x993e('0x53')](function(_0xa16043){return _0x37409f[_0x993e('0x7b')](_0x4d53d1,{'transaction':_0xa16043})['then'](function(){return BPromise[_0x993e('0x7f')](_0x371be2,function(_0x30f7a3){return db[_0x993e('0x80')][_0x993e('0x81')]({'TeamId':_0x30f7a3['id'],'VoicePrefixId':_0x8dc65[_0x993e('0x4b')]['id']},{'transaction':_0xa16043});});})[_0x993e('0x2b')](function(){return BPromise[_0x993e('0x7f')](_0x4286a0,function(_0x3e61d2){return db[_0x993e('0x82')]['findOrCreate']({'where':{'UserId':_0x3e61d2['id'],'VoicePrefixId':_0x8dc65['params']['id']},'transaction':_0xa16043});});})['then'](function(){_0x4286a0[_0x993e('0x83')](function(_0x47c230){socket[_0x993e('0x71')](_0x993e('0x72'),{'UserId':_0x47c230['id'],'VoicePrefixId':_0x37409f['id']});});});});});}})[_0x993e('0x2b')](respondWithStatusCode(_0x4a5755,null))[_0x993e('0x4e')](handleError(_0x4a5755,null));};exports['removeTeams']=function(_0x548dfb,_0x123dcd,_0x4e7340){return db[_0x993e('0x84')][_0x993e('0x48')]({'where':{'id':_0x548dfb[_0x993e('0x38')][_0x993e('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x993e('0x7c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x123dcd,null))['then'](function(_0x242374){var _0x1a3779=_[_0x993e('0x34')](_0x242374,'id');var _0x366809=[];var _0x11ba3a=[];var _0x1b2ca0=squel[_0x993e('0x85')]();_0x1b2ca0[_0x993e('0x86')](_0x993e('0x87'))[_0x993e('0x88')](_0x993e('0x89'),'tq')[_0x993e('0x8a')]('user_has_teams','ut',_0x993e('0x8b'))[_0x993e('0x43')](_0x993e('0x8c'),_0x548dfb[_0x993e('0x4b')]['id']);for(var _0x23ecf0=0x0;_0x23ecf0<_0x242374[_0x993e('0x69')];_0x23ecf0+=0x1){let _0x2fcfaa=_0x242374[_0x23ecf0];for(var _0x5303c9=0x0;_0x5303c9<_0x2fcfaa[_0x993e('0x7c')]['length'];_0x5303c9+=0x1){let _0x5d5dc8=_0x2fcfaa[_0x993e('0x7c')][_0x5303c9];var _0x102393=_0x1b2ca0[_0x993e('0x8d')]();_0x102393['where'](_0x993e('0x8e'),_0x5d5dc8['id']);_0x11ba3a[_0x993e('0x63')](db[_0x993e('0x52')][_0x993e('0x38')](_0x102393[_0x993e('0x8f')](),{'type':db[_0x993e('0x52')][_0x993e('0x90')]['SELECT']})[_0x993e('0x2b')](function(_0x6ee3c0){if(_0x6ee3c0['length']===0x1){return _0x5d5dc8['id'];}else{var _0x58fee1=_[_0x993e('0x91')](_[_0x993e('0x34')](_0x6ee3c0,_0x993e('0x92')),function(_0x2f0669){return _[_0x993e('0x93')](_0x1a3779,_0x2f0669);});if(_0x58fee1){return _0x5d5dc8['id'];}}}));}}return BPromise['all'](_0x11ba3a)[_0x993e('0x2b')](function(_0x3725b5){_0x366809=_(_0x366809)['union'](_0x3725b5)[_0x993e('0x94')]()['value']();return db[_0x993e('0x35')][_0x993e('0x4f')]({'where':{'id':_0x548dfb['params']['id']}})[_0x993e('0x2b')](function(_0x5ee2e0){return db[_0x993e('0x52')][_0x993e('0x53')](function(_0x289772){return _0x5ee2e0['removeTeams'](_0x548dfb['query'][_0x993e('0x6e')],{'transaction':_0x289772})[_0x993e('0x2b')](function(){if(!_[_0x993e('0x95')](_0x366809)){return _0x5ee2e0[_0x993e('0x73')](_0x366809,{'transaction':_0x289772});}})[_0x993e('0x2b')](function(){_0x366809[_0x993e('0x83')](function(_0x366f8f){socket[_0x993e('0x71')](_0x993e('0x75'),{'UserId':_0x366f8f,'VoicePrefixId':_0x5ee2e0['id']});});});});});});})['then'](respondWithStatusCode(_0x123dcd,null))[_0x993e('0x4e')](handleError(_0x123dcd,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 4de339f..b74b094 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 _0xa061=['../../mysqldb','VoicePrefix','save','emit','hook','exports'];(function(_0x3be6b5,_0x1e862c){var _0x1262f5=function(_0x46435e){while(--_0x46435e){_0x3be6b5['push'](_0x3be6b5['shift']());}};_0x1262f5(++_0x1e862c);}(_0xa061,0x6c));var _0x1a06=function(_0x306086,_0x494520){_0x306086=_0x306086-0x0;var _0x2f805d=_0xa061[_0x306086];return _0x2f805d;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x1a06('0x0'))['db'][_0x1a06('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a06('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4db0ab){return function(_0x3d056b,_0x489b5b,_0x360c28){VoicePrefixEvents[_0x1a06('0x3')](_0x4db0ab+':'+_0x3d056b['id'],_0x3d056b);VoicePrefixEvents[_0x1a06('0x3')](_0x4db0ab,_0x3d056b);_0x360c28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x1a06('0x4')](e,emitEvent(event));}}module[_0x1a06('0x5')]=VoicePrefixEvents; \ No newline at end of file +var _0x8d1e=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix'];(function(_0x3e0229,_0x166735){var _0xa7d64=function(_0x4e6227){while(--_0x4e6227){_0x3e0229['push'](_0x3e0229['shift']());}};_0xa7d64(++_0x166735);}(_0x8d1e,0xcc));var _0xe8d1=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0x8d1e[_0xb1b616];return _0x1259b0;};'use strict';var EventEmitter=require(_0xe8d1('0x0'));var VoicePrefix=require(_0xe8d1('0x1'))['db'][_0xe8d1('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe8d1('0x3')](0x0);var events={'afterCreate':_0xe8d1('0x4'),'afterUpdate':'update','afterDestroy':_0xe8d1('0x5')};function emitEvent(_0x2e5df6){return function(_0x2a9c27,_0x5d1414,_0x4b8185){VoicePrefixEvents[_0xe8d1('0x6')](_0x2e5df6+':'+_0x2a9c27['id'],_0x2a9c27);VoicePrefixEvents['emit'](_0x2e5df6,_0x2a9c27);_0x4b8185(null);};}for(var e in events){if(events[_0xe8d1('0x7')](e)){var event=events[e];VoicePrefix[_0xe8d1('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 0953760..3693335 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 _0xfc43=['exports','define','voice_prefixes','util','../../config/logger','api','moment','request-promise','path','./voicePrefix.attributes'];(function(_0x11a422,_0x5907a5){var _0x547177=function(_0x55ec90){while(--_0x55ec90){_0x11a422['push'](_0x11a422['shift']());}};_0x547177(++_0x5907a5);}(_0xfc43,0x7b));var _0x3fc4=function(_0x388117,_0x4ab1c5){_0x388117=_0x388117-0x0;var _0x2dcdcd=_0xfc43[_0x388117];return _0x2dcdcd;};'use strict';var _=require('lodash');var util=require(_0x3fc4('0x0'));var logger=require(_0x3fc4('0x1'))(_0x3fc4('0x2'));var moment=require(_0x3fc4('0x3'));var BPromise=require('bluebird');var rp=require(_0x3fc4('0x4'));var fs=require('fs');var path=require(_0x3fc4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fc4('0x6'));module[_0x3fc4('0x7')]=function(_0x41a58b,_0x268ee0){return _0x41a58b[_0x3fc4('0x8')]('VoicePrefix',attributes,{'tableName':_0x3fc4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb13c=['./voicePrefix.attributes','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x41a56b,_0x1defbf){var _0x1b6e53=function(_0x512dd0){while(--_0x512dd0){_0x41a56b['push'](_0x41a56b['shift']());}};_0x1b6e53(++_0x1defbf);}(_0xb13c,0x1ef));var _0xcb13=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0xb13c[_0x5c7a85];return _0x35290f;};'use strict';var _=require(_0xcb13('0x0'));var util=require(_0xcb13('0x1'));var logger=require(_0xcb13('0x2'))(_0xcb13('0x3'));var moment=require(_0xcb13('0x4'));var BPromise=require(_0xcb13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb13('0x6'));var rimraf=require(_0xcb13('0x7'));var config=require(_0xcb13('0x8'));var attributes=require(_0xcb13('0x9'));module['exports']=function(_0x3c3db0,_0x333f77){return _0x3c3db0['define'](_0xcb13('0xa'),attributes,{'tableName':_0xcb13('0xb'),'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 e81ab64..568fc70 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 _0x44fe=['http','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x49cbad,_0x3b5ea7){var _0x1711ae=function(_0x2cf964){while(--_0x2cf964){_0x49cbad['push'](_0x49cbad['shift']());}};_0x1711ae(++_0x3b5ea7);}(_0x44fe,0x16f));var _0xe44f=function(_0x5423ca,_0x4b7d7a){_0x5423ca=_0x5423ca-0x0;var _0x210162=_0x44fe[_0x5423ca];return _0x210162;};'use strict';var _=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var moment=require(_0xe44f('0x2'));var BPromise=require(_0xe44f('0x3'));var rs=require(_0xe44f('0x4'));var fs=require('fs');var Redis=require(_0xe44f('0x5'));var db=require(_0xe44f('0x6'))['db'];var utils=require(_0xe44f('0x7'));var logger=require(_0xe44f('0x8'))(_0xe44f('0x9'));var config=require(_0xe44f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe44f('0xb')]({'port':0x232a});config[_0xe44f('0xc')]=_['defaults'](config[_0xe44f('0xc')],{'host':_0xe44f('0xd'),'port':0x18eb});var socket=require(_0xe44f('0xe'))(new Redis(config[_0xe44f('0xc')]));require(_0xe44f('0xf'))['register'](socket);function respondWithRpcPromise(_0x12bdfb,_0x28ed63,_0x44b180){return new BPromise(function(_0x447184,_0x2d6ec5){return client[_0xe44f('0x10')](_0x12bdfb,_0x44b180)[_0xe44f('0x11')](function(_0xdb9b6c){logger[_0xe44f('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x28ed63,_0xe44f('0x13'));logger[_0xe44f('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x28ed63,_0xe44f('0x13'),JSON[_0xe44f('0x15')](_0xdb9b6c));if(_0xdb9b6c[_0xe44f('0x16')]){if(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x17')]===0x1f4){logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xdb9b6c[_0xe44f('0x16')]['message']);return _0x2d6ec5(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);}logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);return _0x447184(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);}else{logger[_0xe44f('0x12')](_0xe44f('0x18'),_0x28ed63,_0xe44f('0x13'));_0x447184(_0xdb9b6c[_0xe44f('0x1a')]['message']);}})['catch'](function(_0xf3b4df){logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xf3b4df);_0x2d6ec5(_0xf3b4df);});});} \ No newline at end of file +var _0x0eeb=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','lodash','util','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0eeb[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var moment=require(_0xb0ee('0x2'));var BPromise=require(_0xb0ee('0x3'));var rs=require(_0xb0ee('0x4'));var fs=require('fs');var Redis=require(_0xb0ee('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0ee('0x6'))(_0xb0ee('0x7'));var config=require(_0xb0ee('0x8'));var jayson=require(_0xb0ee('0x9'));var client=jayson[_0xb0ee('0xa')][_0xb0ee('0xb')]({'port':0x232a});config[_0xb0ee('0xc')]=_['defaults'](config[_0xb0ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb0ee('0xd'))(new Redis(config[_0xb0ee('0xc')]));require(_0xb0ee('0xe'))[_0xb0ee('0xf')](socket);function respondWithRpcPromise(_0x1d5d1b,_0x266794,_0x5516d4){return new BPromise(function(_0x4a7766,_0x74f27){return client[_0xb0ee('0x10')](_0x1d5d1b,_0x5516d4)['then'](function(_0x5b449c){logger[_0xb0ee('0x11')](_0xb0ee('0x12'),_0x266794,_0xb0ee('0x13'));logger[_0xb0ee('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x266794,_0xb0ee('0x13'),JSON['stringify'](_0x5b449c));if(_0x5b449c['error']){if(_0x5b449c['error'][_0xb0ee('0x15')]===0x1f4){logger[_0xb0ee('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x266794,_0x5b449c[_0xb0ee('0x16')][_0xb0ee('0x17')]);return _0x74f27(_0x5b449c[_0xb0ee('0x16')][_0xb0ee('0x17')]);}logger[_0xb0ee('0x16')](_0xb0ee('0x12'),_0x266794,_0x5b449c[_0xb0ee('0x16')][_0xb0ee('0x17')]);return _0x4a7766(_0x5b449c['error']['message']);}else{logger[_0xb0ee('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x266794,_0xb0ee('0x13'));_0x4a7766(_0x5b449c[_0xb0ee('0x18')]['message']);}})['catch'](function(_0x2d34d5){logger[_0xb0ee('0x16')](_0xb0ee('0x12'),_0x266794,_0x2d34d5);_0x74f27(_0x2d34d5);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b859d59..4d5f690 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 _0xea1a=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0xd531ba,_0x1ca64d){var _0x2fcd47=function(_0x472b50){while(--_0x472b50){_0xd531ba['push'](_0xd531ba['shift']());}};_0x2fcd47(++_0x1ca64d);}(_0xea1a,0x158));var _0xaea1=function(_0x180859,_0x172b04){_0x180859=_0x180859-0x0;var _0x24b617=_0xea1a[_0x180859];return _0x24b617;};'use strict';var VoicePrefixEvents=require(_0xaea1('0x0'));var events=[_0xaea1('0x1'),_0xaea1('0x2'),_0xaea1('0x3')];function createListener(_0x5018fa,_0x431e87){return function(_0x46cd3c){_0x431e87[_0xaea1('0x4')](_0x5018fa,_0x46cd3c);};}function removeListener(_0x4584dd,_0x3badb1){return function(){VoicePrefixEvents[_0xaea1('0x5')](_0x4584dd,_0x3badb1);};}exports[_0xaea1('0x6')]=function(_0x246ebc){for(var _0x5208c7=0x0,_0x884233=events[_0xaea1('0x7')];_0x5208c7<_0x884233;_0x5208c7++){var _0x3359a9=events[_0x5208c7];var _0x51ca63=createListener(_0xaea1('0x8')+_0x3359a9,_0x246ebc);VoicePrefixEvents['on'](_0x3359a9,_0x51ca63);}}; \ No newline at end of file +var _0x9348=['update','emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0xe0c566,_0x5497fd){var _0x221876=function(_0x2e6044){while(--_0x2e6044){_0xe0c566['push'](_0xe0c566['shift']());}};_0x221876(++_0x5497fd);}(_0x9348,0x10d));var _0x8934=function(_0x22e151,_0x507319){_0x22e151=_0x22e151-0x0;var _0x1c83ce=_0x9348[_0x22e151];return _0x1c83ce;};'use strict';var VoicePrefixEvents=require(_0x8934('0x0'));var events=[_0x8934('0x1'),_0x8934('0x2'),_0x8934('0x3')];function createListener(_0x46a231,_0x4a2577){return function(_0x34d032){_0x4a2577[_0x8934('0x4')](_0x46a231,_0x34d032);};}function removeListener(_0x5f34d7,_0x34f94c){return function(){VoicePrefixEvents[_0x8934('0x5')](_0x5f34d7,_0x34f94c);};}exports[_0x8934('0x6')]=function(_0x2bce03){for(var _0x4c70d7=0x0,_0x3ee9b9=events['length'];_0x4c70d7<_0x3ee9b9;_0x4c70d7++){var _0x284a62=events[_0x4c70d7];var _0x3734c5=createListener(_0x8934('0x7')+_0x284a62,_0x2bce03);VoicePrefixEvents['on'](_0x284a62,_0x3734c5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 80bedb6..d9031bc 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(_0x325c1d,_0xaac33){var _0x41620d=function(_0x44e13c){while(--_0x44e13c){_0x325c1d['push'](_0x325c1d['shift']());}};_0x41620d(++_0xaac33);}(_0xb10b,0x12a));var _0xbb10=function(_0x45416d,_0x1f42bf){_0x45416d=_0x45416d-0x0;var _0x4d8666=_0xb10b[_0x45416d];return _0x4d8666;};'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(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 2a672ef..09eb4f6 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 _0x3322=['Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','setDataValue','strategy','dialMethod','getDataValue','preview','booked','includes','INTEGER','yes','all','once','periodic_announce','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x3322,0x1eb));var _0x2332=function(_0x28ebe8,_0x1f7daa){_0x28ebe8=_0x28ebe8-0x0;var _0x5edfea=_0x3322[_0x28ebe8];return _0x5edfea;};'use strict';var Sequelize=require('sequelize');module[_0x2332('0x0')]={'name':{'type':Sequelize[_0x2332('0x1')],'allowNull':![],'unique':_0x2332('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x4'),_0x2332('0x5')),'allowNull':![],'defaultValue':_0x2332('0x4')},'musiconhold':{'type':Sequelize[_0x2332('0x1')],'defaultValue':_0x2332('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x2332('0x3')]('rr',_0x2332('0x7'),_0x2332('0x8'),_0x2332('0x9'),'random',_0x2332('0xa'),'linear',_0x2332('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x2332('0x7'),'set':function(_0x147c00){this[_0x2332('0xc')](_0x2332('0xd'),_0x147c00?_0x147c00:'rrmemory');},'get':function(){var _0x284ecc=this['getDataValue']('type');var _0x85f8ff=this['getDataValue'](_0x2332('0xe'));var _0x4f8626=this[_0x2332('0xf')](_0x2332('0xd'));if(_0x284ecc==='outbound'){if(_0x85f8ff===_0x2332('0x10')){return null;}if(_0x85f8ff===_0x2332('0x11')&&![_0x2332('0xa'),'roundrobin'][_0x2332('0x12')](_0x4f8626)){this[_0x2332('0xc')](_0x2332('0xd'),_0x2332('0xa'));}}return _0x4f8626;}},'servicelevel':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2332('0x13')](0xb)},'timeout':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2332('0x1')]},'weight':{'type':Sequelize[_0x2332('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2332('0x3')]('yes','no'),'defaultValue':_0x2332('0x14')},'autopause':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no',_0x2332('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2332('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x2332('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2332('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2332('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x2332('0x14'),'no'),'defaultValue':_0x2332('0x14')},'announce_holdtime':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no',_0x2332('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2332('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x14'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2332('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2332('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2332('0x1')]},'queue_youarenext':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x2332('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x2332('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4e41e8){this[_0x2332('0xc')](_0x2332('0x17'),_0x4e41e8?_0x4e41e8[_0x2332('0x18')](','):[]);},'get':function(){return this[_0x2332('0xf')](_0x2332('0x17'))?this[_0x2332('0xf')](_0x2332('0x17'))[_0x2332('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x2332('0x1')],'defaultValue':'yes','set':function(_0x4f978a){this[_0x2332('0xc')]('joinempty',_0x4f978a?_0x4f978a[_0x2332('0x18')](','):undefined);},'get':function(){return this[_0x2332('0xf')]('joinempty')?this[_0x2332('0xf')]('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2332('0x1')],'defaultValue':'no','set':function(_0x8cfef2){this['setDataValue'](_0x2332('0x1a'),_0x8cfef2?_0x8cfef2[_0x2332('0x18')](','):undefined);},'get':function(){return this[_0x2332('0xf')](_0x2332('0x1a'))?this[_0x2332('0xf')](_0x2332('0x1a'))[_0x2332('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x2332('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2332('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2332('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2332('0x1')]},'description':{'type':Sequelize[_0x2332('0x1')]},'acw':{'type':Sequelize[_0x2332('0x1b')],'defaultValue':0x0,'set':function(_0xc8cbdf){this[_0x2332('0xc')](_0x2332('0x1c'),_0xc8cbdf);if(_0xc8cbdf){if(this[_0x2332('0xf')](_0x2332('0x1d'))<0x2){this['setDataValue'](_0x2332('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2332('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2332('0x1b')],'defaultValue':0x0,'comment':_0x2332('0x1e')},'dialMethod':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x10'),_0x2332('0x1f'),'power',_0x2332('0x20'),'booked'),'defaultValue':_0x2332('0x1f'),'comment':_0x2332('0x21')},'dialLimitChannel':{'type':Sequelize[_0x2332('0x13')](0x4)[_0x2332('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2332('0x23')},'dialLimitQueue':{'type':Sequelize[_0x2332('0x13')](0x4)[_0x2332('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2332('0x24')},'dialPowerLevel':{'type':Sequelize[_0x2332('0x25')](0x2)[_0x2332('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x2332('0x3')](_0x2332('0x26'),_0x2332('0x27')),'defaultValue':_0x2332('0x27'),'comment':_0x2332('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2332('0x25')](0x2)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2332('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x2332('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2332('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2332('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2332('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x2332('0x1')],'defaultValue':_0x2332('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2332('0x2c')},'dialQueueProject':{'type':Sequelize[_0x2332('0x1')],'comment':_0x2332('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2332('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2332('0x13')](0x5)[_0x2332('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2332('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2332('0x13')](0x5)[_0x2332('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2332('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2332('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2332('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2332('0x32')},'dialTimezone':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2332('0x1')],'defaultValue':_0x2332('0x33')},'dialPrefix':{'type':Sequelize[_0x2332('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2332('0x3')]('always',_0x2332('0x34'),_0x2332('0x35')),'defaultValue':_0x2332('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2332('0x13')](0x9)[_0x2332('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2332('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x2332('0x13')](0x9)[_0x2332('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2332('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2332('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2332('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2332('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2332('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2332('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2332('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2332('0x13')](0x5)[_0x2332('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2332('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2332('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2332('0x3d')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x2332('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2332('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2332('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2332('0x3')]('DESC',_0x2332('0x40')),'defaultValue':_0x2332('0x41')},'dialQueueProject2':{'type':Sequelize[_0x2332('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2332('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2332('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2332('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2332('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2332('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x2332('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2332('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2332('0x13')](0x5)[_0x2332('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2332('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2332('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2332('0x13')](0x5)[_0x2332('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2332('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2332('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2332('0x13')],'allowNull':!![],'comment':_0x2332('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x2332('0x1b')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x384f1a){if(!_0x384f1a)this[_0x2332('0xc')]('mandatoryDispositionPauseId',null);this[_0x2332('0xc')](_0x2332('0x4b'),_0x384f1a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2332('0x13')](0x3)[_0x2332('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x2332('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2332('0x1b')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ab2=['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','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','includes','INTEGER','yes','once','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen'];(function(_0x317909,_0x567174){var _0x2b52a6=function(_0x365f7f){while(--_0x365f7f){_0x317909['push'](_0x317909['shift']());}};_0x2b52a6(++_0x567174);}(_0x6ab2,0x108));var _0x26ab=function(_0x3e6f35,_0x1fd10d){_0x3e6f35=_0x3e6f35-0x0;var _0x50c320=_0x6ab2[_0x3e6f35];return _0x50c320;};'use strict';var Sequelize=require(_0x26ab('0x0'));module[_0x26ab('0x1')]={'name':{'type':Sequelize[_0x26ab('0x2')],'allowNull':![],'unique':_0x26ab('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x26ab('0x4'),_0x26ab('0x5')),'allowNull':![],'defaultValue':_0x26ab('0x4')},'musiconhold':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':_0x26ab('0x6')},'announce':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x26ab('0x7')]('rr',_0x26ab('0x8'),_0x26ab('0x9'),_0x26ab('0xa'),_0x26ab('0xb'),'rrmemory',_0x26ab('0xc'),_0x26ab('0xd'),_0x26ab('0xe')),'allowNull':![],'defaultValue':_0x26ab('0x8'),'set':function(_0x2eb90e){this[_0x26ab('0xf')](_0x26ab('0x10'),_0x2eb90e?_0x2eb90e:_0x26ab('0x11'));},'get':function(){var _0x267b73=this[_0x26ab('0x12')](_0x26ab('0x13'));var _0x3744cc=this[_0x26ab('0x12')](_0x26ab('0x14'));var _0x3942ea=this[_0x26ab('0x12')](_0x26ab('0x10'));if(_0x267b73==='outbound'){if(_0x3744cc==='preview'){return null;}if(_0x3744cc===_0x26ab('0x15')&&!['rrmemory','roundrobin'][_0x26ab('0x16')](_0x3942ea)){this[_0x26ab('0xf')]('strategy',_0x26ab('0x11'));}}return _0x3942ea;}},'servicelevel':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x26ab('0x17')](0xb)},'timeout':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x26ab('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x26ab('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x26ab('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x26ab('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no'),'defaultValue':_0x26ab('0x18')},'announce_holdtime':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no',_0x26ab('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x26ab('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x26ab('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x26ab('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x26ab('0x2')]},'queue_quantity1':{'type':Sequelize[_0x26ab('0x2')]},'queue_quantity2':{'type':Sequelize[_0x26ab('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x26ab('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x991d50){this['setDataValue'](_0x26ab('0x1a'),_0x991d50?_0x991d50['join'](','):[]);},'get':function(){return this[_0x26ab('0x12')](_0x26ab('0x1a'))?this[_0x26ab('0x12')]('periodic_announce')[_0x26ab('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':_0x26ab('0x18'),'set':function(_0x6e13d3){this['setDataValue'](_0x26ab('0x1c'),_0x6e13d3?_0x6e13d3[_0x26ab('0x1d')](','):undefined);},'get':function(){return this[_0x26ab('0x12')](_0x26ab('0x1c'))?this['getDataValue'](_0x26ab('0x1c'))[_0x26ab('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':'no','set':function(_0x1b8fe5){this[_0x26ab('0xf')](_0x26ab('0x1e'),_0x1b8fe5?_0x1b8fe5[_0x26ab('0x1d')](','):undefined);},'get':function(){return this[_0x26ab('0x12')](_0x26ab('0x1e'))?this[_0x26ab('0x12')](_0x26ab('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x26ab('0x7')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x26ab('0x7')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x26ab('0x2')]},'description':{'type':Sequelize[_0x26ab('0x2')]},'acw':{'type':Sequelize[_0x26ab('0x1f')],'defaultValue':0x0,'set':function(_0x5cf48b){this[_0x26ab('0xf')]('acw',_0x5cf48b);if(_0x5cf48b){if(this[_0x26ab('0x12')]('wrapuptime')<0x2){this[_0x26ab('0xf')](_0x26ab('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x26ab('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x26ab('0x21')},'dialMethod':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x22'),_0x26ab('0x23'),'power',_0x26ab('0x24'),_0x26ab('0x15')),'defaultValue':_0x26ab('0x23'),'comment':_0x26ab('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x26ab('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x26ab('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x26ab('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x26ab('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x26ab('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x29'),_0x26ab('0x2a')),'defaultValue':_0x26ab('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x26ab('0x2b')](0x2)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x26ab('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x26ab('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x26ab('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x26ab('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x26ab('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':'tTxX','comment':_0x26ab('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x26ab('0x30')},'dialQueueProject':{'type':Sequelize[_0x26ab('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x26ab('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x26ab('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x26ab('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x26ab('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'comment':_0x26ab('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x26ab('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x26ab('0x37')},'dialTimezone':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x26ab('0x38')},'dialPrefix':{'type':Sequelize[_0x26ab('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x39'),_0x26ab('0x3a'),_0x26ab('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x26ab('0x1f')],'defaultValue':0x0,'comment':_0x26ab('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x26ab('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x26ab('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x26ab('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x26ab('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x26ab('0x17')](0x9)[_0x26ab('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x26ab('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x26ab('0x17')](0x9)[_0x26ab('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x26ab('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x26ab('0x17')](0x9)[_0x26ab('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x26ab('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x26ab('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x26ab('0x17')](0x9)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x26ab('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x26ab('0x17')](0x9)[_0x26ab('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x26ab('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x26ab('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x44'),_0x26ab('0x45')),'defaultValue':_0x26ab('0x44')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x26ab('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x26ab('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x26ab('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x26ab('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x26ab('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x26ab('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x26ab('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x26ab('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x26ab('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x26ab('0x17')](0x5)[_0x26ab('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x26ab('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x26ab('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x26ab('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26ab('0x17')],'allowNull':!![],'comment':_0x26ab('0x4d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x26ab('0x4e'),'set':function(_0x391d1c){if(!_0x391d1c)this[_0x26ab('0xf')](_0x26ab('0x4f'),null);this['setDataValue'](_0x26ab('0x50'),_0x391d1c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x26ab('0x17')](0x3)[_0x26ab('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x26ab('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x26ab('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x26ab('0x17')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x26ab('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ee7d870..cf090d1 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 _0x1cb9=['VoiceQueues','inbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','count','include','query','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','QueueCampaigns','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','CmHopper','nolimit','order','sort','pick','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','options','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','isEmpty','removeAgents','addAgents','spread','emit','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','phone','CmListId','toString','from','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)','onlyIfOpen','ListId','scheduledAt','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x1cb9,0x14e));var _0x91cb=function(_0x267d2b,_0x89e48a){_0x267d2b=_0x267d2b-0x0;var _0x2b1db1=_0x1cb9[_0x267d2b];return _0x2b1db1;};'use strict';var moment=require(_0x91cb('0x0'));var BPromise=require('bluebird');var util=require(_0x91cb('0x1'));var _=require(_0x91cb('0x2'));var squel=require(_0x91cb('0x3'));var Redis=require(_0x91cb('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x91cb('0x5'))(_0x91cb('0x6'));var config=require('../../config/environment');var db=require(_0x91cb('0x7'))['db'];config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var socket=require(_0x91cb('0xb'))(new Redis(config['redis']));require(_0x91cb('0xc'))['register'](socket);function respondWithStatusCode(_0x2fdfce,_0x4cf9ed){_0x4cf9ed=_0x4cf9ed||0xcc;return function(_0xa43e7a){if(_0xa43e7a){return _0x2fdfce[_0x91cb('0xd')](_0x4cf9ed);}return _0x2fdfce[_0x91cb('0xe')](_0x4cf9ed)[_0x91cb('0xf')]();};}function respondWithResult(_0x429928,_0x23ba9a){_0x23ba9a=_0x23ba9a||0xc8;return function(_0x21a0a5){if(_0x21a0a5){return _0x429928[_0x91cb('0xe')](_0x23ba9a)[_0x91cb('0x10')](_0x21a0a5);}};}function respondWithFilteredResult(_0x8c0097,_0x530d92){return function(_0x3c1f56){if(_0x3c1f56){var _0x366f09=typeof _0x530d92['offset']===_0x91cb('0x11')&&typeof _0x530d92[_0x91cb('0x12')]===_0x91cb('0x11');var _0x2c7d40=_0x3c1f56['count'];var _0x4cc6ef=_0x366f09?0x0:_0x530d92[_0x91cb('0x13')];var _0x3d22b7=_0x366f09?_0x3c1f56['count']:_0x530d92['offset']+_0x530d92[_0x91cb('0x12')];var _0xc3629e;if(_0x3d22b7>=_0x2c7d40){_0x3d22b7=_0x2c7d40;_0xc3629e=0xc8;}else{_0xc3629e=0xce;}_0x8c0097[_0x91cb('0xe')](_0xc3629e);return _0x8c0097['set'](_0x91cb('0x14'),_0x4cc6ef+'-'+_0x3d22b7+'/'+_0x2c7d40)[_0x91cb('0x10')](_0x3c1f56);}return null;};}function saveUpdates(_0x4f1554){return function(_0xc594e3){if(_0xc594e3){return _0xc594e3[_0x91cb('0x15')](_0x4f1554)[_0x91cb('0x16')](function(_0xcd1a78){return _0xcd1a78;});}return null;};}function removeEntity(_0x5cc1c3){return function(_0x3fba4f){if(_0x3fba4f){return _0x3fba4f[_0x91cb('0x17')]()['then'](function(){var _0x123847=_0x3fba4f['get']({'plain':!![]});var _0x55042a=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5b385a=_(_0x55042a)[_0x91cb('0x1a')](_0x91cb('0x1b'))[_0x91cb('0x1c')](_0x91cb('0x1d'))['value']();if(_[_0x91cb('0x1e')](_0x5b385a,_0x123847[_0x91cb('0x1f')])){return;}var _0x1fa837=_['find'](_0x55042a,[_0x91cb('0x1d'),_0x123847[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x21')][_0x91cb('0x17')]({'where':{'type':_0x1fa837,'resourceId':_0x123847['id']}})[_0x91cb('0x16')](function(){return _0x3fba4f;});})[_0x91cb('0x16')](function(){_0x5cc1c3[_0x91cb('0xe')](0xcc)[_0x91cb('0xf')]();});}};}function handleEntityNotFound(_0x4c8438){return function(_0x59bf3a){if(!_0x59bf3a){_0x4c8438[_0x91cb('0xd')](0x194);}return _0x59bf3a;};}function handleError(_0x554350,_0x1c67d2){_0x1c67d2=_0x1c67d2||0x1f4;return function(_0x34d372){logger[_0x91cb('0x22')](_0x34d372['stack']);if(_0x34d372[_0x91cb('0x20')]){delete _0x34d372['name'];}_0x554350[_0x91cb('0xe')](_0x1c67d2)[_0x91cb('0x23')](_0x34d372);};}exports[_0x91cb('0x24')]=function(_0x2fb473,_0x468908){var _0x504275={};var _0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x1c')](db[_0x91cb('0x25')][_0x91cb('0x26')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x27')],'type':_0x4944bd[_0x91cb('0x1f')][_0x91cb('0x28')]};});_0x504275=qs[_0x91cb('0x29')](_0x52670a,_0x2fb473);var _0xf296bc={'where':_0x504275[_0x91cb('0x2a')]};return db[_0x91cb('0x25')][_0x91cb('0x2b')](_0xf296bc)[_0x91cb('0x16')](function(_0x5e6ed3){_0x2f04a3[_0x91cb('0x2b')]=_0x5e6ed3;_0x504275[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x2fb473[_0x91cb('0x2d')]);return db[_0x91cb('0x25')]['findAll'](_0x504275);})[_0x91cb('0x16')](function(_0x74b443){_0x2f04a3[_0x91cb('0x2e')]=_0x74b443;return _0x2f04a3;})[_0x91cb('0x16')](respondWithFilteredResult(_0x468908,_0x504275))[_0x91cb('0x2f')](handleError(_0x468908,null));};exports['show']=function(_0x121c37,_0x5927cb){var _0x47fc17={'raw':![],'where':{'id':_0x121c37[_0x91cb('0x30')]['id']}},_0x479968={};_0x479968['model']=_[_0x91cb('0x31')](db['VoiceQueue']['rawAttributes']);_0x479968[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x121c37[_0x91cb('0x2d')]);_0x479968[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x479968['model'],_0x479968[_0x91cb('0x2d')]);_0x47fc17[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x479968[_0x91cb('0x35')],qs['fields'](_0x121c37['query'][_0x91cb('0x36')]));_0x47fc17[_0x91cb('0x34')]=_0x47fc17['attributes'][_0x91cb('0x37')]?_0x47fc17[_0x91cb('0x34')]:_0x479968['model'];if(_0x121c37[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x47fc17['include']=[{'all':!![]}];}_0x47fc17=_[_0x91cb('0x39')]({},_0x47fc17,_0x121c37['options']);return db[_0x91cb('0x25')][_0x91cb('0x3a')](_0x47fc17)[_0x91cb('0x16')](handleEntityNotFound(_0x5927cb,null))[_0x91cb('0x16')](respondWithResult(_0x5927cb,null))[_0x91cb('0x2f')](handleError(_0x5927cb,null));};exports[_0x91cb('0x3b')]=function(_0x5d0e37,_0xa90111){return db[_0x91cb('0x25')]['create'](_0x5d0e37[_0x91cb('0x3c')],{})['then'](function(_0x2c6102){var _0x2eac87=_0x5d0e37[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x2eac87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eac87[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0x2cf27e=_0x2c6102[_0x91cb('0x3e')]({'plain':!![]});var _0x42a7f3=[{'name':_0x91cb('0x18'),'value':_0x91cb('0x19')},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x3cc4c1=_['find'](_0x42a7f3,[_0x91cb('0x1d'),_0x2cf27e['type']])[_0x91cb('0x20')];return db['UserProfileSection'][_0x91cb('0x3a')]({'where':{'name':_0x3cc4c1,'userProfileId':_0x2eac87['userProfileId']},'raw':!![]})[_0x91cb('0x16')](function(_0x477131){if(_0x477131&&_0x477131[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0x2cf27e[_0x91cb('0x20')],'resourceId':_0x2cf27e['id'],'type':_0x477131[_0x91cb('0x20')],'sectionId':_0x477131['id']},{})['then'](function(){return _0x2c6102;});}else{return _0x2c6102;}})[_0x91cb('0x2f')](function(_0x2f1749){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x2f1749);throw _0x2f1749;});}return _0x2c6102;})[_0x91cb('0x16')](respondWithResult(_0xa90111,0xc9))[_0x91cb('0x2f')](handleError(_0xa90111,null));};exports[_0x91cb('0x44')]=function(_0x29d5a1,_0x396b81){var _0x4b26f6={'where':{'id':_0x29d5a1[_0x91cb('0x30')]['id']}},_0x7c22b3={};_0x7c22b3[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x25')][_0x91cb('0x26')]);_0x4b26f6[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x7c22b3['model'],qs[_0x91cb('0x36')](_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4b26f6[_0x91cb('0x34')]=_0x4b26f6['attributes'][_0x91cb('0x37')]?_0x4b26f6[_0x91cb('0x34')]:_0x7c22b3['model'];if(_0x29d5a1[_0x91cb('0x2d')]['includeAll']){_0x4b26f6[_0x91cb('0x2c')]=[{'all':!![]}];}_0x4b26f6=_['merge']({},_0x4b26f6,_0x29d5a1['options']);return db['VoiceQueue'][_0x91cb('0x3a')](_0x4b26f6)[_0x91cb('0x16')](handleEntityNotFound(_0x396b81,null))[_0x91cb('0x16')](function(_0x2f8384){if(_0x2f8384){var _0x333814=_0x2f8384['get']({'plain':!![]});_0x333814=qs['omit'](_0x333814,['id',_0x91cb('0x45'),_0x91cb('0x46')]);_0x29d5a1[_0x91cb('0x3c')]=_[_0x91cb('0x47')](_0x29d5a1['body'],['id','createdAt','updatedAt']);return db[_0x91cb('0x25')]['create'](_[_0x91cb('0x39')](_0x333814,_0x29d5a1['body']),{'include':_0x29d5a1[_0x91cb('0x2d')][_0x91cb('0x38')]?[{'all':!![]}]:undefined})[_0x91cb('0x16')](function(_0x649976){var _0x1884bc=_0x29d5a1[_0x91cb('0x3d')][_0x91cb('0x3e')]({'plain':!![]});if(!_0x1884bc)throw new Error(_0x91cb('0x48'));if(_0x1884bc[_0x91cb('0x3f')]===_0x91cb('0x3d')){var _0xd8f7c2=_0x649976['get']({'plain':!![]});var _0x1e445a=[{'name':_0x91cb('0x18'),'value':'inbound'},{'name':_0x91cb('0x40'),'value':_0x91cb('0x41')}];var _0x4bab7d=_[_0x91cb('0x3a')](_0x1e445a,[_0x91cb('0x1d'),_0xd8f7c2[_0x91cb('0x1f')]])[_0x91cb('0x20')];return db[_0x91cb('0x49')][_0x91cb('0x3a')]({'where':{'name':_0x4bab7d,'userProfileId':_0x1884bc[_0x91cb('0x4a')]},'raw':!![]})[_0x91cb('0x16')](function(_0x3320bd){if(_0x3320bd&&_0x3320bd[_0x91cb('0x42')]===0x0){return db[_0x91cb('0x21')]['create']({'name':_0xd8f7c2[_0x91cb('0x20')],'resourceId':_0xd8f7c2['id'],'type':_0x3320bd['name'],'sectionId':_0x3320bd['id']},{})[_0x91cb('0x16')](function(){return _0x649976;});}else{return _0x649976;}})['catch'](function(_0x3dfff9){logger[_0x91cb('0x22')](_0x91cb('0x43'),_0x3dfff9);throw _0x3dfff9;});}return _0x649976;});}})['then'](respondWithResult(_0x396b81,0xc9))[_0x91cb('0x2f')](handleError(_0x396b81,null));};exports[_0x91cb('0x15')]=function(_0x48dcf7,_0xef4754){if(_0x48dcf7[_0x91cb('0x3c')]['id']){delete _0x48dcf7[_0x91cb('0x3c')]['id'];}return db[_0x91cb('0x25')]['find']({'where':{'id':_0x48dcf7[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0xef4754,null))[_0x91cb('0x16')](saveUpdates(_0x48dcf7[_0x91cb('0x3c')],null))['then'](respondWithResult(_0xef4754,null))[_0x91cb('0x2f')](handleError(_0xef4754,null));};exports[_0x91cb('0x17')]=function(_0x5c2c01,_0x492b09){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x5c2c01[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x492b09,null))['then'](removeEntity(_0x492b09,null))['catch'](handleError(_0x492b09,null));};exports[_0x91cb('0x4b')]=function(_0x5c468a,_0x1b69ce){var _0x961ebf={'raw':![],'where':{}};var _0x33de58={};var _0x551836={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x5c468a[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1b69ce,null))[_0x91cb('0x16')](function(_0x2c1911){if(_0x2c1911){_0x33de58['model']=_[_0x91cb('0x31')](db[_0x91cb('0x4c')][_0x91cb('0x26')]);_0x33de58[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x5c468a[_0x91cb('0x2d')]);_0x33de58[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x33de58[_0x91cb('0x35')],_0x33de58[_0x91cb('0x2d')]);_0x961ebf[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x33de58['model'],qs[_0x91cb('0x36')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x961ebf[_0x91cb('0x34')]=_0x961ebf[_0x91cb('0x34')][_0x91cb('0x37')]?_0x961ebf[_0x91cb('0x34')]:_0x33de58['model'];if(!_0x5c468a[_0x91cb('0x2d')]['hasOwnProperty'](_0x91cb('0x4d'))){_0x961ebf[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x5c468a[_0x91cb('0x2d')]['limit']);_0x961ebf[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x961ebf[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x5c468a['query'][_0x91cb('0x4f')]);_0x961ebf[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x5c468a[_0x91cb('0x2d')],_0x33de58[_0x91cb('0x32')]));_0x961ebf[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x2c1911['id'];if(_0x5c468a[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x961ebf[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x961ebf[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x961ebf[_0x91cb('0x34')],function(_0x2605c3){var _0x1d9ded={};_0x1d9ded[_0x2605c3]={'$like':'%'+_0x5c468a['query'][_0x91cb('0x1a')]+'%'};return _0x1d9ded;})});}_0x961ebf=_[_0x91cb('0x39')]({},_0x961ebf,_0x5c468a['options']);return db[_0x91cb('0x4c')][_0x91cb('0x2b')]({'where':_0x961ebf[_0x91cb('0x2a')]})['then'](function(_0x45e26b){_0x551836[_0x91cb('0x2b')]=_0x45e26b;if(_0x5c468a['query']['includeAll']){_0x961ebf[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopper'][_0x91cb('0x52')](_0x961ebf);})[_0x91cb('0x16')](function(_0x4e11e3){_0x551836[_0x91cb('0x2e')]=_0x4e11e3;return _0x551836;});}})['then'](respondWithFilteredResult(_0x1b69ce,_0x961ebf))[_0x91cb('0x2f')](handleError(_0x1b69ce,null));};exports[_0x91cb('0x53')]=function(_0x4f827e,_0x5d8a7e){var _0x16a21f={'raw':!![],'where':{}};var _0x43be3e={};var _0x37666a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x91cb('0x54')]({'where':{'id':_0x4f827e[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x5d8a7e,null))[_0x91cb('0x16')](function(_0x570f6b){if(_0x570f6b){_0x43be3e[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x55')][_0x91cb('0x26')]);_0x43be3e[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x4f827e['query']);_0x43be3e['filters']=_[_0x91cb('0x33')](_0x43be3e['model'],_0x43be3e[_0x91cb('0x2d')]);_0x16a21f[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x43be3e[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x16a21f['attributes']=_0x16a21f[_0x91cb('0x34')][_0x91cb('0x37')]?_0x16a21f['attributes']:_0x43be3e[_0x91cb('0x35')];if(!_0x4f827e['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x16a21f[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x16a21f[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x16a21f[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x16a21f[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x4f827e[_0x91cb('0x2d')],_0x43be3e['filters']));_0x16a21f[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x570f6b['id'];if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x16a21f[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x16a21f[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x16a21f['attributes'],function(_0xb5c264){var _0xdee7f={};_0xdee7f[_0xb5c264]={'$like':'%'+_0x4f827e['query']['filter']+'%'};return _0xdee7f;})});}_0x16a21f=_[_0x91cb('0x39')]({},_0x16a21f,_0x4f827e['options']);return db['CmHopperHistory'][_0x91cb('0x2b')]({'where':_0x16a21f['where']})[_0x91cb('0x16')](function(_0x498382){_0x37666a[_0x91cb('0x2b')]=_0x498382;if(_0x4f827e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x16a21f[_0x91cb('0x2c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x91cb('0x52')](_0x16a21f);})[_0x91cb('0x16')](function(_0x42d07b){_0x37666a[_0x91cb('0x2e')]=_0x42d07b;return _0x37666a;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x5d8a7e,_0x16a21f))[_0x91cb('0x2f')](handleError(_0x5d8a7e,null));};exports[_0x91cb('0x57')]=function(_0x3cf8c5,_0x21dfd3){var _0x24facc={'raw':!![],'where':{}};var _0xafda63={};var _0x32704d={'count':0x0,'rows':[]};return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x3cf8c5[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x21dfd3,null))[_0x91cb('0x16')](function(_0x39fce4){if(_0x39fce4){_0xafda63[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x58')][_0x91cb('0x26')]);_0xafda63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3cf8c5[_0x91cb('0x2d')]);_0xafda63['filters']=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],_0xafda63[_0x91cb('0x2d')]);_0x24facc[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0xafda63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x24facc[_0x91cb('0x34')]=_0x24facc[_0x91cb('0x34')]['length']?_0x24facc[_0x91cb('0x34')]:_0xafda63['model'];if(!_0x3cf8c5['query'][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x24facc[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x24facc[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x24facc['order']=qs[_0x91cb('0x4f')](_0x3cf8c5[_0x91cb('0x2d')]['sort']);_0x24facc[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3cf8c5[_0x91cb('0x2d')],_0xafda63[_0x91cb('0x32')]));_0x24facc[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x39fce4['id'];if(_0x3cf8c5[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x24facc[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x24facc[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x24facc[_0x91cb('0x34')],function(_0x378cd0){var _0x538a8c={};_0x538a8c[_0x378cd0]={'$like':'%'+_0x3cf8c5['query'][_0x91cb('0x1a')]+'%'};return _0x538a8c;})});}_0x24facc=_[_0x91cb('0x39')]({},_0x24facc,_0x3cf8c5[_0x91cb('0x59')]);return db[_0x91cb('0x58')][_0x91cb('0x2b')]({'where':_0x24facc[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x5ac5cc){_0x32704d[_0x91cb('0x2b')]=_0x5ac5cc;if(_0x3cf8c5['query'][_0x91cb('0x38')]){_0x24facc[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x58')][_0x91cb('0x52')](_0x24facc);})[_0x91cb('0x16')](function(_0x4ac4dd){_0x32704d[_0x91cb('0x2e')]=_0x4ac4dd;return _0x32704d;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x21dfd3,_0x24facc))[_0x91cb('0x2f')](handleError(_0x21dfd3,null));};exports[_0x91cb('0x5a')]=function(_0x3a213e,_0x4e4003){var _0x4003c9={'raw':!![],'where':{}};var _0x9cff8f={};var _0x25a779={'count':0x0,'rows':[]};return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a213e['params']['id']}})['then'](handleEntityNotFound(_0x4e4003,null))[_0x91cb('0x16')](function(_0x182aa5){if(_0x182aa5){_0x9cff8f[_0x91cb('0x35')]=_[_0x91cb('0x31')](db['CmHopperBlack'][_0x91cb('0x26')]);_0x9cff8f[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x3a213e[_0x91cb('0x2d')]);_0x9cff8f['filters']=_['intersection'](_0x9cff8f[_0x91cb('0x35')],_0x9cff8f[_0x91cb('0x2d')]);_0x4003c9[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9cff8f[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x4003c9[_0x91cb('0x34')]=_0x4003c9[_0x91cb('0x34')][_0x91cb('0x37')]?_0x4003c9[_0x91cb('0x34')]:_0x9cff8f[_0x91cb('0x35')];if(!_0x3a213e['query']['hasOwnProperty'](_0x91cb('0x4d'))){_0x4003c9['limit']=qs[_0x91cb('0x12')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x4003c9[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x13')]);}_0x4003c9[_0x91cb('0x4e')]=qs['sort'](_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x4003c9[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x3a213e['query'],_0x9cff8f[_0x91cb('0x32')]));_0x4003c9[_0x91cb('0x2a')][_0x91cb('0x51')]=_0x182aa5['id'];if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x4003c9['where']=_[_0x91cb('0x39')](_0x4003c9[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x4003c9[_0x91cb('0x34')],function(_0x440ef4){var _0x2c2ed8={};_0x2c2ed8[_0x440ef4]={'$like':'%'+_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x2c2ed8;})});}_0x4003c9=_[_0x91cb('0x39')]({},_0x4003c9,_0x3a213e[_0x91cb('0x59')]);return db[_0x91cb('0x5b')][_0x91cb('0x2b')]({'where':_0x4003c9[_0x91cb('0x2a')]})[_0x91cb('0x16')](function(_0x7c84fc){_0x25a779[_0x91cb('0x2b')]=_0x7c84fc;if(_0x3a213e[_0x91cb('0x2d')][_0x91cb('0x38')]){_0x4003c9[_0x91cb('0x2c')]=[{'all':!![]}];}return db[_0x91cb('0x5b')][_0x91cb('0x52')](_0x4003c9);})[_0x91cb('0x16')](function(_0x275c80){_0x25a779[_0x91cb('0x2e')]=_0x275c80;return _0x25a779;});}})[_0x91cb('0x16')](respondWithFilteredResult(_0x4e4003,_0x4003c9))[_0x91cb('0x2f')](handleError(_0x4e4003,null));};exports['getTeams']=function(_0x16cf02,_0x2b8634){var _0x1eb46e={};var _0x261a3a={};var _0x16f334;var _0x5ca377;return db['VoiceQueue']['findOne']({'where':{'id':_0x16cf02['params']['id']}})['then'](handleEntityNotFound(_0x2b8634,null))[_0x91cb('0x16')](function(_0x46a6cc){if(_0x46a6cc){_0x16f334=_0x46a6cc;_0x261a3a[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x5c')][_0x91cb('0x26')]);_0x261a3a[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x16cf02[_0x91cb('0x2d')]);_0x261a3a[_0x91cb('0x32')]=_['intersection'](_0x261a3a[_0x91cb('0x35')],_0x261a3a[_0x91cb('0x2d')]);_0x1eb46e['attributes']=_[_0x91cb('0x33')](_0x261a3a[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x1eb46e[_0x91cb('0x34')]=_0x1eb46e[_0x91cb('0x34')]['length']?_0x1eb46e[_0x91cb('0x34')]:_0x261a3a[_0x91cb('0x35')];_0x1eb46e[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x1eb46e[_0x91cb('0x2a')]=qs['filters'](_[_0x91cb('0x50')](_0x16cf02['query'],_0x261a3a[_0x91cb('0x32')]));if(_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x1eb46e[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x1eb46e[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x1eb46e[_0x91cb('0x34')],function(_0x1c7c10){var _0x570cf0={};_0x570cf0[_0x1c7c10]={'$like':'%'+_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x570cf0;})});}_0x1eb46e=_[_0x91cb('0x39')]({},_0x1eb46e,_0x16cf02[_0x91cb('0x59')]);return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x189a87){if(_0x189a87){_0x5ca377=_0x189a87[_0x91cb('0x37')];if(!_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x1eb46e[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x16cf02['query'][_0x91cb('0x12')]);_0x1eb46e['offset']=qs[_0x91cb('0x13')](_0x16cf02[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x16f334[_0x91cb('0x5d')](_0x1eb46e);}})[_0x91cb('0x16')](function(_0x12da14){if(_0x12da14){return _0x12da14?{'count':_0x5ca377,'rows':_0x12da14}:null;}})[_0x91cb('0x16')](respondWithResult(_0x2b8634,null))[_0x91cb('0x2f')](handleError(_0x2b8634,null));};exports['addTeams']=function(_0x3353bf,_0x5b3658){var _0x3c1703=_0x3353bf[_0x91cb('0x3c')][_0x91cb('0x5e')];var _0x598663=_[_0x91cb('0x1c')](_0x3c1703,'id');return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x598663},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]}]})['then'](function(_0x469e62){if(_0x469e62){var _0x1e9441=_[_0x91cb('0x62')](_0x469e62,function(_0x1bb2de){var _0x129ea0=_0x1bb2de[_0x91cb('0x3e')]({'plain':!![]});_0x129ea0[_0x91cb('0x63')][_0x91cb('0x64')](function(_0x50b8d6){_0x50b8d6[_0x91cb('0x65')]=_[_0x91cb('0x3a')](_0x3c1703,{'id':_0x129ea0['id']})[_0x91cb('0x65')];});return _0x129ea0[_0x91cb('0x63')];});return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3353bf['params']['id']}})[_0x91cb('0x16')](function(_0x43b620){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x3b0bd5){return _0x43b620['addTeams'](_0x598663,{'transaction':_0x3b0bd5})[_0x91cb('0x16')](function(){return BPromise['each'](_0x3c1703,function(_0x58608e){return db[_0x91cb('0x68')][_0x91cb('0x69')]({'TeamId':_0x58608e['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id'],'penalty':_0x58608e[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise[_0x91cb('0x6a')](_0x1e9441,function(_0x20ef3d){return db[_0x91cb('0x6b')]['findOrCreate']({'where':{'UserId':_0x20ef3d['id'],'VoiceQueueId':_0x3353bf[_0x91cb('0x30')]['id']},'defaults':{'penalty':_0x20ef3d[_0x91cb('0x65')]},'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){return BPromise['each'](_['filter'](_0x1e9441,{'online':!![]}),function(_0x530565){return db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x530565[_0x91cb('0x20')],'UserId':_0x530565['id'],'queue_name':_0x43b620['name'],'VoiceQueueId':_0x43b620['id'],'interface':_[_0x91cb('0x6d')](_0x530565[_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x530565['name']):_0x530565[_0x91cb('0x61')],'paused':_0x530565[_0x91cb('0x60')]||![],'penalty':_0x530565[_0x91cb('0x65')]},{'transaction':_0x3b0bd5});});})[_0x91cb('0x16')](function(){_0x1e9441[_0x91cb('0x64')](function(_0x3c788e){socket['emit'](_0x91cb('0x70'),{'UserId':_0x3c788e['id'],'VoiceQueueId':_0x43b620['id']});});});});});}})[_0x91cb('0x16')](respondWithStatusCode(_0x5b3658,null))[_0x91cb('0x2f')](handleError(_0x5b3658,null));};exports[_0x91cb('0x71')]=function(_0x3782cd,_0x4b290e){return db[_0x91cb('0x5c')][_0x91cb('0x52')]({'where':{'id':_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')]},'attributes':['id'],'include':[{'model':db[_0x91cb('0x73')],'as':_0x91cb('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b290e,null))[_0x91cb('0x16')](function(_0x2bafae){var _0x27472a=_['map'](_0x2bafae,'id');var _0x59cb69=[];var _0x5d0f96=[];var _0x174325=squel[_0x91cb('0x74')]();_0x174325[_0x91cb('0x75')](_0x91cb('0x76'))['from'](_0x91cb('0x77'),'tq')[_0x91cb('0x78')](_0x91cb('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91cb('0x2a')]('VoiceQueueId\x20=\x20?',_0x3782cd[_0x91cb('0x30')]['id']);for(var _0x43b2e7=0x0;_0x43b2e7<_0x2bafae['length'];_0x43b2e7+=0x1){let _0x1b47fe=_0x2bafae[_0x43b2e7];for(var _0x1853de=0x0;_0x1853de<_0x1b47fe[_0x91cb('0x63')][_0x91cb('0x37')];_0x1853de+=0x1){let _0x376426=_0x1b47fe['Agents'][_0x1853de];var _0x22a6e6=_0x174325[_0x91cb('0x44')]();_0x22a6e6[_0x91cb('0x2a')](_0x91cb('0x7a'),_0x376426['id']);_0x5d0f96['push'](db[_0x91cb('0x66')]['query'](_0x22a6e6['toString'](),{'type':db['sequelize'][_0x91cb('0x7b')][_0x91cb('0x7c')]})[_0x91cb('0x16')](function(_0x4972c3){if(_0x4972c3[_0x91cb('0x37')]===0x1){return _0x376426['id'];}else{var _0x53dbb2=_[_0x91cb('0x7d')](_[_0x91cb('0x1c')](_0x4972c3,_0x91cb('0x7e')),function(_0x2a2a71){return _[_0x91cb('0x1e')](_0x27472a,_0x2a2a71);});if(_0x53dbb2){return _0x376426['id'];}}}));}}return BPromise[_0x91cb('0x7f')](_0x5d0f96)['then'](function(_0x5bfd2c){_0x59cb69=_(_0x59cb69)[_0x91cb('0x80')](_0x5bfd2c)['compact']()[_0x91cb('0x1d')]();return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x3782cd[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(_0x51d431){return db[_0x91cb('0x66')][_0x91cb('0x67')](function(_0x18ec67){return _0x51d431['removeTeams'](_0x3782cd[_0x91cb('0x2d')][_0x91cb('0x72')],{'transaction':_0x18ec67})['then'](function(){if(!_[_0x91cb('0x81')](_0x59cb69)){return _0x51d431[_0x91cb('0x82')](_0x59cb69,{'transaction':_0x18ec67})[_0x91cb('0x16')](function(){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0x3782cd[_0x91cb('0x30')]['id'],'UserId':_0x59cb69},'transaction':_0x18ec67});});}})['then'](function(){_0x59cb69[_0x91cb('0x64')](function(_0x5da781){socket['emit']('userVoiceQueue:remove',{'UserId':_0x5da781,'VoiceQueueId':_0x51d431['id']});});});});});});})[_0x91cb('0x16')](respondWithStatusCode(_0x4b290e,null))['catch'](handleError(_0x4b290e,null));};exports['addAgents']=function(_0x3c0211,_0x3710e9){var _0x395e21,_0x52b9af;return db['VoiceQueue'][_0x91cb('0x3a')]({'where':{'id':_0x3c0211[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x3710e9,null))[_0x91cb('0x16')](function(_0x3280a5){if(_0x3280a5){_0x52b9af=_0x3280a5;return _0x3280a5[_0x91cb('0x83')](_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x3c0211['body'],[_0x91cb('0x72'),'id'])||{})[_0x91cb('0x84')](function(_0x547b4d){for(var _0x1aef0b=0x0;_0x1aef0b<_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x91cb('0x37')];_0x1aef0b+=0x1){socket[_0x91cb('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')][_0x1aef0b]),'VoiceQueueId':Number(_0x3c0211[_0x91cb('0x30')]['id'])});}return _0x547b4d;});}})['then'](function(_0x4ba088){_0x395e21=_0x4ba088||[];if(_0x52b9af){return db[_0x91cb('0x73')][_0x91cb('0x52')]({'where':{'id':_0x3c0211[_0x91cb('0x3c')][_0x91cb('0x72')]},'attributes':['id',_0x91cb('0x20'),_0x91cb('0x5f'),_0x91cb('0x60'),_0x91cb('0x61')],'raw':!![]});}})['then'](function(_0x33b7a7){if(!_[_0x91cb('0x81')](_0x33b7a7)){var _0x4ac7b9=[];for(var _0x41c3ff=0x0;_0x41c3ff<_0x33b7a7[_0x91cb('0x37')];_0x41c3ff++){if(_0x33b7a7[_0x41c3ff]['online']){_0x4ac7b9[_0x91cb('0x86')](db[_0x91cb('0x6c')][_0x91cb('0x69')]({'membername':_0x33b7a7[_0x41c3ff][_0x91cb('0x20')],'UserId':_0x33b7a7[_0x41c3ff]['id'],'queue_name':_0x52b9af[_0x91cb('0x20')],'VoiceQueueId':_0x52b9af['id'],'interface':_['isNil'](_0x33b7a7[_0x41c3ff][_0x91cb('0x61')])?util[_0x91cb('0x6e')](_0x91cb('0x6f'),_0x33b7a7[_0x41c3ff][_0x91cb('0x20')]):_0x33b7a7[_0x41c3ff]['interface'],'paused':_0x33b7a7[_0x41c3ff][_0x91cb('0x60')]||![],'penalty':_0x3c0211['body'][_0x91cb('0x65')]||0x0}));}}return BPromise[_0x91cb('0x7f')](_0x4ac7b9);}})[_0x91cb('0x16')](function(){return _0x395e21;})[_0x91cb('0x16')](respondWithResult(_0x3710e9,null))[_0x91cb('0x2f')](handleError(_0x3710e9,null));};exports[_0x91cb('0x82')]=function(_0xd572bc,_0x1e7a48){return db[_0x91cb('0x25')]['find']({'where':{'id':_0xd572bc[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x1e7a48,null))[_0x91cb('0x16')](function(_0x51ef1c){if(_0x51ef1c){return _0x51ef1c[_0x91cb('0x82')](_0xd572bc['query'][_0x91cb('0x72')])['then'](function(){if(_[_0x91cb('0x87')](_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')])){for(var _0x10fe63=0x0;_0x10fe63<_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x91cb('0x37')];_0x10fe63+=0x1){socket['emit'](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')][_0x91cb('0x72')][_0x10fe63]),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}}else{socket[_0x91cb('0x85')](_0x91cb('0x88'),{'UserId':Number(_0xd572bc[_0x91cb('0x2d')]['ids']),'VoiceQueueId':Number(_0xd572bc[_0x91cb('0x30')]['id'])});}});}})[_0x91cb('0x16')](function(_0x219b5f){return db[_0x91cb('0x6c')][_0x91cb('0x17')]({'where':{'VoiceQueueId':_0xd572bc['params']['id'],'UserId':_0xd572bc['query']['ids']}})[_0x91cb('0x16')](function(){return _0x219b5f;});})[_0x91cb('0x16')](respondWithStatusCode(_0x1e7a48,null))['catch'](handleError(_0x1e7a48,null));};exports['getAgents']=function(_0x471c17,_0x6549a7){var _0x13564d={};var _0x3c1e63={};var _0x1f2d72;var _0x376adc;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x471c17['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x6549a7,null))[_0x91cb('0x16')](function(_0xf15400){if(_0xf15400){_0x1f2d72=_0xf15400;_0x3c1e63['model']=_[_0x91cb('0x31')](db[_0x91cb('0x73')][_0x91cb('0x26')]);_0x3c1e63[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x471c17[_0x91cb('0x2d')]);_0x3c1e63[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x3c1e63['model'],_0x3c1e63['query']);_0x13564d[_0x91cb('0x34')]=_['intersection'](_0x3c1e63[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x13564d['attributes']=_0x13564d[_0x91cb('0x34')][_0x91cb('0x37')]?_0x13564d[_0x91cb('0x34')]:_0x3c1e63[_0x91cb('0x35')];_0x13564d[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x13564d['where']=qs[_0x91cb('0x32')](_['pick'](_0x471c17[_0x91cb('0x2d')],_0x3c1e63[_0x91cb('0x32')]));if(_0x471c17['query'][_0x91cb('0x1a')]){_0x13564d[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x13564d[_0x91cb('0x2a')],{'$or':_['map'](_0x13564d[_0x91cb('0x34')],function(_0x1bef2b){var _0x5a38f7={};_0x5a38f7[_0x1bef2b]={'$like':'%'+_0x471c17[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x5a38f7;})});}_0x13564d=_[_0x91cb('0x39')]({},_0x13564d,_0x471c17[_0x91cb('0x59')]);return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x2f42ef){if(_0x2f42ef){_0x376adc=_0x2f42ef[_0x91cb('0x37')];if(!_0x471c17[_0x91cb('0x2d')][_0x91cb('0x56')]('nolimit')){_0x13564d[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x13564d[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x471c17[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1f2d72[_0x91cb('0x89')](_0x13564d);}})[_0x91cb('0x16')](function(_0x31cf76){if(_0x31cf76){return _0x31cf76?{'count':_0x376adc,'rows':_0x31cf76}:null;}})['then'](respondWithResult(_0x6549a7,null))[_0x91cb('0x2f')](handleError(_0x6549a7,null));};exports['getMembers']=function(_0x3a5022,_0x17141e){var _0x3e2c58={};var _0x11c67c={};var _0xf4b4ab;var _0x2fa5e3;return db[_0x91cb('0x25')]['findOne']({'where':{'id':_0x3a5022[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x17141e,null))[_0x91cb('0x16')](function(_0x4483fb){if(_0x4483fb){_0xf4b4ab=_0x4483fb;_0x11c67c['model']=_['keys'](db['UserVoiceQueueRt'][_0x91cb('0x26')]);_0x11c67c[_0x91cb('0x2d')]=_['keys'](_0x3a5022['query']);_0x11c67c['filters']=_[_0x91cb('0x33')](_0x11c67c[_0x91cb('0x35')],_0x11c67c['query']);_0x3e2c58['attributes']=_['intersection'](_0x11c67c[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x3a5022['query'][_0x91cb('0x36')]));_0x3e2c58[_0x91cb('0x34')]=_0x3e2c58['attributes']['length']?_0x3e2c58[_0x91cb('0x34')]:_0x11c67c[_0x91cb('0x35')];_0x3e2c58[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x3a5022[_0x91cb('0x2d')]['sort']);_0x3e2c58[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x3a5022[_0x91cb('0x2d')],_0x11c67c[_0x91cb('0x32')]));if(_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x3e2c58[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x3e2c58[_0x91cb('0x2a')],{'$or':_[_0x91cb('0x1c')](_0x3e2c58[_0x91cb('0x34')],function(_0x1ea132){var _0x3b1d97={};_0x3b1d97[_0x1ea132]={'$like':'%'+_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x3b1d97;})});}_0x3e2c58=_[_0x91cb('0x39')]({},_0x3e2c58,_0x3a5022[_0x91cb('0x59')]);return _0xf4b4ab[_0x91cb('0x8a')](_0x3e2c58);}})[_0x91cb('0x16')](function(_0x5cf6df){if(_0x5cf6df){_0x2fa5e3=_0x5cf6df['length'];if(!_0x3a5022['query'][_0x91cb('0x56')]('nolimit')){_0x3e2c58[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x12')]);_0x3e2c58[_0x91cb('0x13')]=qs[_0x91cb('0x13')](_0x3a5022[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0xf4b4ab['getMembers'](_0x3e2c58);}})['then'](function(_0x5f2de0){return _0x5f2de0?{'count':_0x2fa5e3,'rows':_0x5f2de0}:null;})[_0x91cb('0x16')](respondWithResult(_0x17141e,null))[_0x91cb('0x2f')](handleError(_0x17141e,null));};exports[_0x91cb('0x8b')]=function(_0x2b4e25,_0x4c044d){var _0x54c194={};var _0x3cfdcb={};var _0x1624b3;var _0x1e2acd;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2b4e25['params']['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x4c044d,null))['then'](function(_0x1e979e){if(_0x1e979e){_0x1624b3=_0x1e979e;_0x3cfdcb[_0x91cb('0x35')]=_['keys'](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x3cfdcb[_0x91cb('0x2d')]=_[_0x91cb('0x31')](_0x2b4e25[_0x91cb('0x2d')]);_0x3cfdcb['filters']=_[_0x91cb('0x33')](_0x3cfdcb[_0x91cb('0x35')],_0x3cfdcb[_0x91cb('0x2d')]);_0x54c194[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x3cfdcb['model'],qs[_0x91cb('0x36')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x54c194['attributes']=_0x54c194['attributes'][_0x91cb('0x37')]?_0x54c194['attributes']:_0x3cfdcb[_0x91cb('0x35')];_0x54c194[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2b4e25[_0x91cb('0x2d')]['sort']);_0x54c194[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_['pick'](_0x2b4e25[_0x91cb('0x2d')],_0x3cfdcb[_0x91cb('0x32')]));if(_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x54c194[_0x91cb('0x2a')]=_[_0x91cb('0x39')](_0x54c194['where'],{'$or':_[_0x91cb('0x1c')](_0x54c194['attributes'],function(_0x283743){var _0x44ffde={};_0x44ffde[_0x283743]={'$like':'%'+_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x1a')]+'%'};return _0x44ffde;})});}_0x54c194=_['merge']({},_0x54c194,_0x2b4e25[_0x91cb('0x59')]);return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})[_0x91cb('0x16')](function(_0x5e629){if(_0x5e629){_0x1e2acd=_0x5e629[_0x91cb('0x37')];if(!_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x54c194[_0x91cb('0x12')]=qs[_0x91cb('0x12')](_0x2b4e25['query'][_0x91cb('0x12')]);_0x54c194['offset']=qs[_0x91cb('0x13')](_0x2b4e25[_0x91cb('0x2d')][_0x91cb('0x13')]);}return _0x1624b3[_0x91cb('0x8b')](_0x54c194);}})['then'](function(_0x87f382){if(_0x87f382){return _0x87f382?{'count':_0x1e2acd,'rows':_0x87f382}:null;}})[_0x91cb('0x16')](respondWithResult(_0x4c044d,null))[_0x91cb('0x2f')](handleError(_0x4c044d,null));};exports['addLists']=function(_0x330123,_0x23bc13){var _0x175d85=moment()[_0x91cb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x97ba8,_0x4bc382;return db[_0x91cb('0x25')]['find']({'where':{'id':_0x330123[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x23bc13,null))[_0x91cb('0x16')](function(_0x399012){if(_0x399012){_0x4bc382=_0x399012;return _0x399012[_0x91cb('0x8d')](_0x330123['body']['ids'],_[_0x91cb('0x47')](_0x330123[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x571a6f){var _0x19596b;_0x97ba8=_0x571a6f||[];var _0x5b4849=[];if(_0x571a6f){for(var _0x39a183=0x0;_0x39a183<_0x571a6f[_0x91cb('0x37')];_0x39a183+=0x1){var _0x693690=_0x571a6f[_0x39a183][_0x91cb('0x3e')]({'plain':!![]});_0x4bc382[_0x91cb('0x8e')]=_0x330123[_0x91cb('0x3c')][_0x91cb('0x8e')]?_0x330123[_0x91cb('0x3c')]['dialCheckDuplicateType']:_0x4bc382['dialCheckDuplicateType'];switch(_0x4bc382['dialCheckDuplicateType']){case'always':_0x19596b=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')](['phone','scheduledAt',_0x91cb('0x93'),'ListId',_0x91cb('0x51'),_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27','scheduledAt')[_0x91cb('0x75')]('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690[_0x91cb('0x95')]['toString'](),'ListId')['field'](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x9d'))[_0x91cb('0x97')](_0x91cb('0x9e'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id']['toString']()))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa0'))['from'](_0x91cb('0x91'))[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))['toString']();break;case _0x91cb('0xa1'):_0x19596b=squel[_0x91cb('0x8f')]()['into'](_0x91cb('0x91'))['fromQuery']([_0x91cb('0x94'),'scheduledAt',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0x94'),_0x91cb('0x94'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))[_0x91cb('0x75')]('id',_0x91cb('0x93'))['field'](_0x693690[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))['field']('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))[_0x91cb('0x2a')](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())[_0x91cb('0x2a')](_0x91cb('0x9b'))[_0x91cb('0x2a')](_0x91cb('0x9c'),squel[_0x91cb('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0x91cb('0x97')]('cm_hopper')[_0x91cb('0x2a')](_0x91cb('0x9f'),_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')]())))[_0x91cb('0x96')]();break;default:_0x19596b=squel['insert']()[_0x91cb('0x90')](_0x91cb('0x91'))[_0x91cb('0x92')]([_0x91cb('0x94'),_0x91cb('0xa3'),_0x91cb('0x93'),_0x91cb('0xa2'),'VoiceQueueId',_0x91cb('0x45'),_0x91cb('0x46')],squel[_0x91cb('0x74')]()['field'](_0x91cb('0x94'),'phone')['field']('\x27'+_0x175d85+'\x27',_0x91cb('0xa3'))['field']('id',_0x91cb('0x93'))[_0x91cb('0x75')](_0x693690['CmListId'][_0x91cb('0x96')](),_0x91cb('0xa2'))[_0x91cb('0x75')](_0x330123[_0x91cb('0x30')]['id'][_0x91cb('0x96')](),_0x91cb('0x51'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))[_0x91cb('0x97')](_0x91cb('0x98'))['where'](_0x91cb('0x99'))[_0x91cb('0x2a')](_0x91cb('0x9a'),_0x693690[_0x91cb('0x95')][_0x91cb('0x96')]())['where'](_0x91cb('0x9b')))[_0x91cb('0x96')]();}_0x5b4849['push'](db[_0x91cb('0x66')]['query'](_0x19596b));}return BPromise[_0x91cb('0x7f')](_0x5b4849);}})['then'](function(){var _0x739447=[];var _0x2deed1=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xa4'))['fromQuery']([_0x91cb('0xa5'),_0x91cb('0x94'),'OrderBy','createdAt',_0x91cb('0x46')],squel[_0x91cb('0x74')]()[_0x91cb('0x75')](_0x91cb('0xa6'))['field'](_0x91cb('0xa7'))[_0x91cb('0x75')](_0x91cb('0xa8'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x45'))[_0x91cb('0x75')]('\x27'+_0x175d85+'\x27',_0x91cb('0x46'))['from'](_0x91cb('0xa9'),'ci')[_0x91cb('0x78')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x91cb('0x2a')](_0x91cb('0xaa'),_0x175d85)[_0x91cb('0x2a')](_0x91cb('0xab'),_0x91cb('0xac')))[_0x91cb('0x96')]();_0x739447[_0x91cb('0x86')](db[_0x91cb('0x66')]['query'](_0x2deed1));return BPromise[_0x91cb('0x7f')](_0x739447);})[_0x91cb('0x16')](function(){return _0x97ba8;})[_0x91cb('0x16')](respondWithResult(_0x23bc13,null))[_0x91cb('0x2f')](handleError(_0x23bc13,null));};exports[_0x91cb('0xad')]=function(_0x554923,_0x2fe556){return db[_0x91cb('0x25')]['find']({'where':{'id':_0x554923[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x2fe556,null))[_0x91cb('0x16')](function(_0x43958a){if(_0x43958a){return _0x43958a[_0x91cb('0xad')](_0x554923['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0x409a36){if(_0x409a36){return db[_0x91cb('0x4c')][_0x91cb('0x17')]({'where':{'ListId':_0x554923[_0x91cb('0x2d')][_0x91cb('0x72')],'VoiceQueueId':_0x554923[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](function(){return _0x409a36;});}})[_0x91cb('0x16')](respondWithStatusCode(_0x2fe556,null))['catch'](handleError(_0x2fe556,null));};exports[_0x91cb('0xae')]=function(_0x2d870d,_0x173761){var _0x2cf0d8={};var _0x9d63ff={};var _0x720de;var _0x80f0ba;return db[_0x91cb('0x25')][_0x91cb('0x54')]({'where':{'id':_0x2d870d[_0x91cb('0x30')]['id']}})['then'](handleEntityNotFound(_0x173761,null))[_0x91cb('0x16')](function(_0x800860){if(_0x800860){_0x720de=_0x800860;_0x9d63ff[_0x91cb('0x35')]=_[_0x91cb('0x31')](db[_0x91cb('0x8c')][_0x91cb('0x26')]);_0x9d63ff['query']=_['keys'](_0x2d870d[_0x91cb('0x2d')]);_0x9d63ff[_0x91cb('0x32')]=_[_0x91cb('0x33')](_0x9d63ff['model'],_0x9d63ff[_0x91cb('0x2d')]);_0x2cf0d8[_0x91cb('0x34')]=_[_0x91cb('0x33')](_0x9d63ff[_0x91cb('0x35')],qs[_0x91cb('0x36')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x36')]));_0x2cf0d8[_0x91cb('0x34')]=_0x2cf0d8[_0x91cb('0x34')][_0x91cb('0x37')]?_0x2cf0d8[_0x91cb('0x34')]:_0x9d63ff[_0x91cb('0x35')];_0x2cf0d8[_0x91cb('0x4e')]=qs[_0x91cb('0x4f')](_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x4f')]);_0x2cf0d8[_0x91cb('0x2a')]=qs[_0x91cb('0x32')](_[_0x91cb('0x50')](_0x2d870d['query'],_0x9d63ff[_0x91cb('0x32')]));if(_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x1a')]){_0x2cf0d8['where']=_['merge'](_0x2cf0d8['where'],{'$or':_[_0x91cb('0x1c')](_0x2cf0d8[_0x91cb('0x34')],function(_0x4370f6){var _0x5bc712={};_0x5bc712[_0x4370f6]={'$like':'%'+_0x2d870d['query'][_0x91cb('0x1a')]+'%'};return _0x5bc712;})});}_0x2cf0d8=_[_0x91cb('0x39')]({},_0x2cf0d8,_0x2d870d[_0x91cb('0x59')]);return _0x720de[_0x91cb('0xae')](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x182f2c){if(_0x182f2c){_0x80f0ba=_0x182f2c[_0x91cb('0x37')];if(!_0x2d870d[_0x91cb('0x2d')][_0x91cb('0x56')](_0x91cb('0x4d'))){_0x2cf0d8['limit']=qs['limit'](_0x2d870d[_0x91cb('0x2d')]['limit']);_0x2cf0d8[_0x91cb('0x13')]=qs['offset'](_0x2d870d['query'][_0x91cb('0x13')]);}return _0x720de['getBlackLists'](_0x2cf0d8);}})[_0x91cb('0x16')](function(_0x2ac9df){if(_0x2ac9df){return _0x2ac9df?{'count':_0x80f0ba,'rows':_0x2ac9df}:null;}})['then'](respondWithResult(_0x173761,null))[_0x91cb('0x2f')](handleError(_0x173761,null));};exports[_0x91cb('0xaf')]=function(_0x331381,_0x52ce8c){var _0x534968;return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x331381['params']['id']}})['then'](handleEntityNotFound(_0x52ce8c,null))['then'](function(_0x397397){if(_0x397397){return _0x397397[_0x91cb('0xaf')](_0x331381[_0x91cb('0x3c')][_0x91cb('0x72')],_['omit'](_0x331381[_0x91cb('0x3c')],[_0x91cb('0x72'),'id'])||{});}return null;})[_0x91cb('0x84')](function(_0x2a0c3c){var _0x30ef98;_0x534968=_0x2a0c3c||[];var _0x27d0ab=[];if(_0x2a0c3c){for(var _0x547db7=0x0;_0x547db7<_0x2a0c3c['length'];_0x547db7+=0x1){var _0x38d608=_0x2a0c3c[_0x547db7][_0x91cb('0x3e')]({'plain':!![]});_0x30ef98=squel[_0x91cb('0x8f')]()[_0x91cb('0x90')](_0x91cb('0xb0'))[_0x91cb('0x92')](['phone',_0x91cb('0x93'),_0x91cb('0xa2'),_0x91cb('0x51'),'createdAt',_0x91cb('0x46')],squel['select']()[_0x91cb('0x75')](_0x91cb('0x94'),'phone')[_0x91cb('0x75')]('id','ContactId')[_0x91cb('0x75')](_0x38d608[_0x91cb('0x95')][_0x91cb('0x96')](),_0x91cb('0xa2'))['field'](_0x331381[_0x91cb('0x30')]['id']['toString'](),_0x91cb('0x51'))['field']('NOW()',_0x91cb('0x45'))[_0x91cb('0x75')](_0x91cb('0xb1'),_0x91cb('0x46'))[_0x91cb('0x97')]('cm_contacts')['where'](_0x91cb('0x99'))['where'](_0x91cb('0x9a'),_0x38d608['CmListId'][_0x91cb('0x96')]())[_0x91cb('0x2a')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x27d0ab[_0x91cb('0x86')](db['sequelize'][_0x91cb('0x2d')](_0x30ef98));}return BPromise['all'](_0x27d0ab);}})['then'](function(){return _0x534968;})[_0x91cb('0x16')](respondWithResult(_0x52ce8c,null))[_0x91cb('0x2f')](handleError(_0x52ce8c,null));};exports[_0x91cb('0xb2')]=function(_0x4ef95b,_0x2f0269){return db[_0x91cb('0x25')][_0x91cb('0x3a')]({'where':{'id':_0x4ef95b[_0x91cb('0x30')]['id']}})[_0x91cb('0x16')](handleEntityNotFound(_0x2f0269,null))['then'](function(_0x5e1b97){if(_0x5e1b97){return _0x5e1b97[_0x91cb('0xb2')](_0x4ef95b['query'][_0x91cb('0x72')]);}})[_0x91cb('0x16')](function(_0xcb3114){if(_0xcb3114){return db[_0x91cb('0x5b')][_0x91cb('0x17')]({'where':{'ListId':_0x4ef95b['query'][_0x91cb('0x72')],'VoiceQueueId':_0x4ef95b['params']['id']}})[_0x91cb('0x16')](function(){return _0xcb3114;});}})['then'](respondWithStatusCode(_0x2f0269,null))[_0x91cb('0x2f')](handleError(_0x2f0269,null));}; \ No newline at end of file +var _0x55ca=['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','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x5bad5a,_0x1789ae){var _0x515cce=function(_0x5805b6){while(--_0x5805b6){_0x5bad5a['push'](_0x5bad5a['shift']());}};_0x515cce(++_0x1789ae);}(_0x55ca,0x126));var _0xa55c=function(_0x1602fd,_0x847115){_0x1602fd=_0x1602fd-0x0;var _0x1eaf42=_0x55ca[_0x1602fd];return _0x1eaf42;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8985d82..cdcb0cd 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 _0x6aef=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xee0701,_0x52c1c3){var _0x16c290=function(_0x7a6594){while(--_0x7a6594){_0xee0701['push'](_0xee0701['shift']());}};_0x16c290(++_0x52c1c3);}(_0x6aef,0x8a));var _0xf6ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aef[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf6ae('0x0'));var VoiceQueue=require(_0xf6ae('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf6ae('0x2')](0x0);var events={'afterCreate':_0xf6ae('0x3'),'afterUpdate':_0xf6ae('0x4'),'afterDestroy':_0xf6ae('0x5')};function emitEvent(_0x8ba534){return function(_0x9bc479,_0xef6895,_0x50c88f){VoiceQueueEvents[_0xf6ae('0x6')](_0x8ba534+':'+_0x9bc479['id'],_0x9bc479);VoiceQueueEvents['emit'](_0x8ba534,_0x9bc479);_0x50c88f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xf6ae('0x7')](e,emitEvent(event));}}module[_0xf6ae('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x1f9a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x1bbb03,_0x18c084){var _0x1ae659=function(_0x388937){while(--_0x388937){_0x1bbb03['push'](_0x1bbb03['shift']());}};_0x1ae659(++_0x18c084);}(_0x1f9a,0x1a6));var _0xa1f9=function(_0x341d16,_0x2fe25c){_0x341d16=_0x341d16-0x0;var _0x463524=_0x1f9a[_0x341d16];return _0x463524;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xa1f9('0x0'))['db'][_0xa1f9('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1f9('0x2'),'afterDestroy':_0xa1f9('0x3')};function emitEvent(_0x1e81da){return function(_0x59142e,_0x443a3c,_0x46223f){VoiceQueueEvents['emit'](_0x1e81da+':'+_0x59142e['id'],_0x59142e);VoiceQueueEvents[_0xa1f9('0x4')](_0x1e81da,_0x59142e);_0x46223f(null);};}for(var e in events){if(events[_0xa1f9('0x5')](e)){var event=events[e];VoiceQueue[_0xa1f9('0x6')](e,emitEvent(event));}}module[_0xa1f9('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c237895..1a6710e 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x9de8a7,_0x5d76ca){var _0x8265ba=function(_0x239819){while(--_0x239819){_0x9de8a7['push'](_0x9de8a7['shift']());}};_0x8265ba(++_0x5d76ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x3af859,_0x399a01){var _0x2264b1=function(_0x299b15){while(--_0x299b15){_0x3af859['push'](_0x3af859['shift']());}};_0x2264b1(++_0x399a01);}(_0xedd9,0xfc));var _0x9edd=function(_0x36163d,_0x243b96){_0x36163d=_0x36163d-0x0;var _0x17189f=_0xedd9[_0x36163d];return _0x17189f;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','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 e38a12a..dd397da 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 _0x696f=['../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','attributes','limit','include','map','model','then','ShowVoiceQueue','where','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0x696f,0x121));var _0xf696=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x696f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xf696('0x0'));var util=require(_0xf696('0x1'));var moment=require(_0xf696('0x2'));var BPromise=require(_0xf696('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf696('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf696('0x5'));var logger=require('../../config/logger')(_0xf696('0x6'));var config=require(_0xf696('0x7'));var jayson=require(_0xf696('0x8'));var client=jayson['client'][_0xf696('0x9')]({'port':0x232a});config[_0xf696('0xa')]=_[_0xf696('0xb')](config[_0xf696('0xa')],{'host':_0xf696('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf696('0xa')]));require(_0xf696('0xd'))[_0xf696('0xe')](socket);function respondWithRpcPromise(_0x2bd651,_0x145b08,_0x23a6f3){return new BPromise(function(_0x407d70,_0x224779){return client[_0xf696('0xf')](_0x2bd651,_0x23a6f3)['then'](function(_0x5814cc){logger[_0xf696('0x10')](_0xf696('0x11'),_0x145b08,'request\x20sent');logger[_0xf696('0x12')](_0xf696('0x13'),_0x145b08,_0xf696('0x14'),JSON[_0xf696('0x15')](_0x5814cc));if(_0x5814cc[_0xf696('0x16')]){if(_0x5814cc['error']['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x145b08,_0x5814cc[_0xf696('0x16')][_0xf696('0x17')]);return _0x224779(_0x5814cc['error'][_0xf696('0x17')]);}logger[_0xf696('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x145b08,_0x5814cc[_0xf696('0x16')]['message']);return _0x407d70(_0x5814cc[_0xf696('0x16')][_0xf696('0x17')]);}else{logger[_0xf696('0x10')](_0xf696('0x11'),_0x145b08,_0xf696('0x14'));_0x407d70(_0x5814cc['result']['message']);}})[_0xf696('0x18')](function(_0x44722c){logger[_0xf696('0x16')](_0xf696('0x11'),_0x145b08,_0x44722c);_0x224779(_0x44722c);});});}exports[_0xf696('0x19')]=function(_0x43da7b){var _0x487862=this;return new Promise(function(_0x2cc79e,_0x35f657){return db[_0xf696('0x1a')][_0xf696('0x1b')]({'raw':_0x43da7b[_0xf696('0x1c')]?_0x43da7b[_0xf696('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x43da7b[_0xf696('0x1c')]?_0x43da7b[_0xf696('0x1c')]['where']||null:null,'attributes':_0x43da7b[_0xf696('0x1c')]?_0x43da7b['options'][_0xf696('0x1d')]||null:null,'limit':_0x43da7b['options']?_0x43da7b['options'][_0xf696('0x1e')]||null:null,'include':_0x43da7b['options']?_0x43da7b[_0xf696('0x1c')][_0xf696('0x1f')]?_['map'](_0x43da7b[_0xf696('0x1c')][_0xf696('0x1f')],function(_0x393f9d){return{'model':db[_0x393f9d['model']],'as':_0x393f9d['as'],'attributes':_0x393f9d[_0xf696('0x1d')],'include':_0x393f9d['include']?_[_0xf696('0x20')](_0x393f9d['include'],function(_0x40226f){return{'model':db[_0x40226f[_0xf696('0x21')]],'as':_0x40226f['as'],'attributes':_0x40226f['attributes'],'include':_0x40226f['include']?_[_0xf696('0x20')](_0x40226f[_0xf696('0x1f')],function(_0x2085ec){return{'model':db[_0x2085ec[_0xf696('0x21')]],'as':_0x2085ec['as'],'attributes':_0x2085ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xf696('0x22')](function(_0x505346){logger[_0xf696('0x10')](_0xf696('0x19'),_0x43da7b);logger[_0xf696('0x12')](_0xf696('0x19'),_0x43da7b,JSON[_0xf696('0x15')](_0x505346));_0x2cc79e(_0x505346);})[_0xf696('0x18')](function(_0x1c721b){logger['error'](_0xf696('0x19'),_0x1c721b[_0xf696('0x17')],_0x43da7b);_0x35f657(_0x487862[_0xf696('0x16')](0x1f4,_0x1c721b[_0xf696('0x17')]));});});};exports[_0xf696('0x23')]=function(_0x12f0bc){var _0x2ba00f=this;return new Promise(function(_0x1779e9,_0xe19da0){return db[_0xf696('0x1a')]['find']({'raw':_0x12f0bc[_0xf696('0x1c')]?_0x12f0bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x12f0bc[_0xf696('0x1c')]?_0x12f0bc['options'][_0xf696('0x24')]||null:null,'attributes':_0x12f0bc[_0xf696('0x1c')]?_0x12f0bc['options'][_0xf696('0x1d')]||null:null,'include':_0x12f0bc[_0xf696('0x1c')]?_0x12f0bc['options'][_0xf696('0x1f')]?_[_0xf696('0x20')](_0x12f0bc[_0xf696('0x1c')][_0xf696('0x1f')],function(_0x33dd5e){return{'model':db[_0x33dd5e[_0xf696('0x21')]],'as':_0x33dd5e['as'],'attributes':_0x33dd5e[_0xf696('0x1d')],'include':_0x33dd5e[_0xf696('0x1f')]?_[_0xf696('0x20')](_0x33dd5e[_0xf696('0x1f')],function(_0x251d16){return{'model':db[_0x251d16[_0xf696('0x21')]],'as':_0x251d16['as'],'attributes':_0x251d16[_0xf696('0x1d')],'include':_0x251d16[_0xf696('0x1f')]?_[_0xf696('0x20')](_0x251d16[_0xf696('0x1f')],function(_0x45408e){return{'model':db[_0x45408e[_0xf696('0x21')]],'as':_0x45408e['as'],'attributes':_0x45408e[_0xf696('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf696('0x22')](function(_0x574918){logger[_0xf696('0x10')](_0xf696('0x23'),_0x12f0bc);logger['debug'](_0xf696('0x23'),_0x12f0bc,JSON[_0xf696('0x15')](_0x574918));_0x1779e9(_0x574918);})[_0xf696('0x18')](function(_0x128930){logger[_0xf696('0x16')](_0xf696('0x23'),_0x128930[_0xf696('0x17')],_0x12f0bc);_0xe19da0(_0x2ba00f[_0xf696('0x16')](0x1f4,_0x128930[_0xf696('0x17')]));});});}; \ No newline at end of file +var _0x9e1e=['result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','find','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3825f9,_0x216866){var _0x4ec345=function(_0x36c989){while(--_0x36c989){_0x3825f9['push'](_0x3825f9['shift']());}};_0x4ec345(++_0x216866);}(_0x9e1e,0x1b2));var _0xe9e1=function(_0x54a225,_0x478d65){_0x54a225=_0x54a225-0x0;var _0x30fc20=_0x9e1e[_0x54a225];return _0x30fc20;};'use strict';var _=require(_0xe9e1('0x0'));var util=require(_0xe9e1('0x1'));var moment=require(_0xe9e1('0x2'));var BPromise=require(_0xe9e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9e1('0x4'));var db=require(_0xe9e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9e1('0x6'))(_0xe9e1('0x7'));var config=require(_0xe9e1('0x8'));var jayson=require(_0xe9e1('0x9'));var client=jayson[_0xe9e1('0xa')][_0xe9e1('0xb')]({'port':0x232a});config['redis']=_[_0xe9e1('0xc')](config[_0xe9e1('0xd')],{'host':_0xe9e1('0xe'),'port':0x18eb});var socket=require(_0xe9e1('0xf'))(new Redis(config[_0xe9e1('0xd')]));require('./voiceQueue.socket')[_0xe9e1('0x10')](socket);function respondWithRpcPromise(_0x438817,_0x7d271e,_0x196310){return new BPromise(function(_0x242d47,_0x10c05f){return client[_0xe9e1('0x11')](_0x438817,_0x196310)[_0xe9e1('0x12')](function(_0x11f508){logger[_0xe9e1('0x13')](_0xe9e1('0x14'),_0x7d271e,_0xe9e1('0x15'));logger[_0xe9e1('0x16')](_0xe9e1('0x17'),_0x7d271e,_0xe9e1('0x15'),JSON[_0xe9e1('0x18')](_0x11f508));if(_0x11f508[_0xe9e1('0x19')]){if(_0x11f508[_0xe9e1('0x19')][_0xe9e1('0x1a')]===0x1f4){logger[_0xe9e1('0x19')](_0xe9e1('0x14'),_0x7d271e,_0x11f508[_0xe9e1('0x19')][_0xe9e1('0x1b')]);return _0x10c05f(_0x11f508[_0xe9e1('0x19')][_0xe9e1('0x1b')]);}logger[_0xe9e1('0x19')](_0xe9e1('0x14'),_0x7d271e,_0x11f508[_0xe9e1('0x19')][_0xe9e1('0x1b')]);return _0x242d47(_0x11f508[_0xe9e1('0x19')][_0xe9e1('0x1b')]);}else{logger[_0xe9e1('0x13')](_0xe9e1('0x14'),_0x7d271e,'request\x20sent');_0x242d47(_0x11f508[_0xe9e1('0x1c')][_0xe9e1('0x1b')]);}})[_0xe9e1('0x1d')](function(_0x3d7787){logger[_0xe9e1('0x19')](_0xe9e1('0x14'),_0x7d271e,_0x3d7787);_0x10c05f(_0x3d7787);});});}exports[_0xe9e1('0x1e')]=function(_0x624752){var _0xa6d80=this;return new Promise(function(_0x1fd3d0,_0x3e0f06){return db[_0xe9e1('0x1f')][_0xe9e1('0x20')]({'raw':_0x624752[_0xe9e1('0x21')]?_0x624752[_0xe9e1('0x21')][_0xe9e1('0x22')]===undefined?!![]:![]:!![],'where':_0x624752['options']?_0x624752[_0xe9e1('0x21')]['where']||null:null,'attributes':_0x624752[_0xe9e1('0x21')]?_0x624752[_0xe9e1('0x21')][_0xe9e1('0x23')]||null:null,'limit':_0x624752[_0xe9e1('0x21')]?_0x624752[_0xe9e1('0x21')][_0xe9e1('0x24')]||null:null,'include':_0x624752[_0xe9e1('0x21')]?_0x624752[_0xe9e1('0x21')][_0xe9e1('0x25')]?_[_0xe9e1('0x26')](_0x624752[_0xe9e1('0x21')][_0xe9e1('0x25')],function(_0x270763){return{'model':db[_0x270763['model']],'as':_0x270763['as'],'attributes':_0x270763['attributes'],'include':_0x270763[_0xe9e1('0x25')]?_['map'](_0x270763[_0xe9e1('0x25')],function(_0x6e90a2){return{'model':db[_0x6e90a2[_0xe9e1('0x27')]],'as':_0x6e90a2['as'],'attributes':_0x6e90a2[_0xe9e1('0x23')],'include':_0x6e90a2[_0xe9e1('0x25')]?_['map'](_0x6e90a2[_0xe9e1('0x25')],function(_0x1a3998){return{'model':db[_0x1a3998['model']],'as':_0x1a3998['as'],'attributes':_0x1a3998[_0xe9e1('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e9e05){logger[_0xe9e1('0x13')](_0xe9e1('0x1e'),_0x624752);logger['debug'](_0xe9e1('0x1e'),_0x624752,JSON[_0xe9e1('0x18')](_0x3e9e05));_0x1fd3d0(_0x3e9e05);})[_0xe9e1('0x1d')](function(_0x465e1b){logger[_0xe9e1('0x19')]('GetVoiceQueue',_0x465e1b[_0xe9e1('0x1b')],_0x624752);_0x3e0f06(_0xa6d80[_0xe9e1('0x19')](0x1f4,_0x465e1b[_0xe9e1('0x1b')]));});});};exports['ShowVoiceQueue']=function(_0x13db89){var _0x624d56=this;return new Promise(function(_0x4db663,_0x370174){return db[_0xe9e1('0x1f')][_0xe9e1('0x28')]({'raw':_0x13db89['options']?_0x13db89[_0xe9e1('0x21')][_0xe9e1('0x22')]===undefined?!![]:![]:!![],'where':_0x13db89[_0xe9e1('0x21')]?_0x13db89[_0xe9e1('0x21')]['where']||null:null,'attributes':_0x13db89['options']?_0x13db89[_0xe9e1('0x21')][_0xe9e1('0x23')]||null:null,'include':_0x13db89[_0xe9e1('0x21')]?_0x13db89[_0xe9e1('0x21')][_0xe9e1('0x25')]?_['map'](_0x13db89[_0xe9e1('0x21')][_0xe9e1('0x25')],function(_0x3c570a){return{'model':db[_0x3c570a[_0xe9e1('0x27')]],'as':_0x3c570a['as'],'attributes':_0x3c570a[_0xe9e1('0x23')],'include':_0x3c570a[_0xe9e1('0x25')]?_[_0xe9e1('0x26')](_0x3c570a[_0xe9e1('0x25')],function(_0x209624){return{'model':db[_0x209624[_0xe9e1('0x27')]],'as':_0x209624['as'],'attributes':_0x209624[_0xe9e1('0x23')],'include':_0x209624['include']?_[_0xe9e1('0x26')](_0x209624[_0xe9e1('0x25')],function(_0x274829){return{'model':db[_0x274829[_0xe9e1('0x27')]],'as':_0x274829['as'],'attributes':_0x274829[_0xe9e1('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe9e1('0x12')](function(_0x16576e){logger[_0xe9e1('0x13')](_0xe9e1('0x29'),_0x13db89);logger[_0xe9e1('0x16')](_0xe9e1('0x29'),_0x13db89,JSON[_0xe9e1('0x18')](_0x16576e));_0x4db663(_0x16576e);})[_0xe9e1('0x1d')](function(_0x363bb7){logger[_0xe9e1('0x19')](_0xe9e1('0x29'),_0x363bb7['message'],_0x13db89);_0x370174(_0x624d56['error'](0x1f4,_0x363bb7[_0xe9e1('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a84b3d6..2bdcf54 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 _0xffe9=['./voiceQueue.events','remove','update','emit','length','voiceQueue:'];(function(_0x24ea43,_0x433bff){var _0x58f368=function(_0x3c336a){while(--_0x3c336a){_0x24ea43['push'](_0x24ea43['shift']());}};_0x58f368(++_0x433bff);}(_0xffe9,0x1b0));var _0x9ffe=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xffe9[_0x1bf809];return _0x1caa4e;};'use strict';var VoiceQueueEvents=require(_0x9ffe('0x0'));var events=['save',_0x9ffe('0x1'),_0x9ffe('0x2')];function createListener(_0x570274,_0x2a345f){return function(_0x14ab5b){_0x2a345f[_0x9ffe('0x3')](_0x570274,_0x14ab5b);};}function removeListener(_0x5a358b,_0x53e369){return function(){VoiceQueueEvents['removeListener'](_0x5a358b,_0x53e369);};}exports['register']=function(_0x14bc97){for(var _0x465d5b=0x0,_0x328372=events[_0x9ffe('0x4')];_0x465d5b<_0x328372;_0x465d5b++){var _0x44fa47=events[_0x465d5b];var _0x2d72e2=createListener(_0x9ffe('0x5')+_0x44fa47,_0x14bc97);VoiceQueueEvents['on'](_0x44fa47,_0x2d72e2);}}; \ No newline at end of file +var _0x5e7f=['length','voiceQueue:','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x5c7de7,_0x284361){var _0x34eddc=function(_0x103ddb){while(--_0x103ddb){_0x5c7de7['push'](_0x5c7de7['shift']());}};_0x34eddc(++_0x284361);}(_0x5e7f,0x13a));var _0xf5e7=function(_0x536a13,_0x50ade7){_0x536a13=_0x536a13-0x0;var _0x2ba84b=_0x5e7f[_0x536a13];return _0x2ba84b;};'use strict';var VoiceQueueEvents=require(_0xf5e7('0x0'));var events=[_0xf5e7('0x1'),_0xf5e7('0x2'),_0xf5e7('0x3')];function createListener(_0x2a19d5,_0x3ecd51){return function(_0x2b2838){_0x3ecd51['emit'](_0x2a19d5,_0x2b2838);};}function removeListener(_0x4aeda2,_0x1392d8){return function(){VoiceQueueEvents[_0xf5e7('0x4')](_0x4aeda2,_0x1392d8);};}exports[_0xf5e7('0x5')]=function(_0x42bd48){for(var _0x51dbba=0x0,_0x247ec6=events[_0xf5e7('0x6')];_0x51dbba<_0x247ec6;_0x51dbba++){var _0x33cc91=events[_0x51dbba];var _0xde7fc9=createListener(_0xf5e7('0x7')+_0x33cc91,_0x42bd48);VoiceQueueEvents['on'](_0x33cc91,_0xde7fc9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d55b7c1..8130cfe 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 _0xbff3=['util','path','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','show','post','put','update','delete','/:id','destroy','exports','multer'];(function(_0x503ea4,_0x562c0a){var _0x22f2fb=function(_0x434305){while(--_0x434305){_0x503ea4['push'](_0x503ea4['shift']());}};_0x22f2fb(++_0x562c0a);}(_0xbff3,0x18f));var _0x3bff=function(_0x4fafba,_0x28c4fb){_0x4fafba=_0x4fafba-0x0;var _0x389d73=_0xbff3[_0x4fafba];return _0x389d73;};'use strict';var multer=require(_0x3bff('0x0'));var util=require(_0x3bff('0x1'));var path=require(_0x3bff('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3bff('0x3')]();var fs_extra=require(_0x3bff('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3bff('0x5'));var config=require('../../config/environment');var controller=require(_0x3bff('0x6'));router[_0x3bff('0x7')]('/',auth[_0x3bff('0x8')](),controller[_0x3bff('0x9')]);router[_0x3bff('0x7')]('/describe',auth[_0x3bff('0x8')](),controller['describe']);router[_0x3bff('0x7')](_0x3bff('0xa'),auth[_0x3bff('0x8')](),controller[_0x3bff('0xb')]);router[_0x3bff('0x7')]('/:id',auth[_0x3bff('0x8')](),controller[_0x3bff('0xc')]);router[_0x3bff('0xd')]('/',auth[_0x3bff('0x8')](),controller['create']);router[_0x3bff('0xe')]('/:id',auth[_0x3bff('0x8')](),controller[_0x3bff('0xf')]);router[_0x3bff('0x10')](_0x3bff('0x11'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x12')]);module[_0x3bff('0x13')]=router; \ No newline at end of file +var _0x7cae=['get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x372c5d,_0x35a1dc){var _0x168977=function(_0x218788){while(--_0x218788){_0x372c5d['push'](_0x372c5d['shift']());}};_0x168977(++_0x35a1dc);}(_0x7cae,0xd4));var _0xe7ca=function(_0x505733,_0x4f7706){_0x505733=_0x505733-0x0;var _0x4d7dad=_0x7cae[_0x505733];return _0x4d7dad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ca('0x0'));var timeout=require(_0xe7ca('0x1'));var express=require(_0xe7ca('0x2'));var router=express[_0xe7ca('0x3')]();var fs_extra=require(_0xe7ca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7ca('0x5'));var config=require(_0xe7ca('0x6'));var controller=require(_0xe7ca('0x7'));router[_0xe7ca('0x8')]('/',auth[_0xe7ca('0x9')](),controller[_0xe7ca('0xa')]);router[_0xe7ca('0x8')](_0xe7ca('0xb'),auth[_0xe7ca('0x9')](),controller[_0xe7ca('0xc')]);router[_0xe7ca('0x8')](_0xe7ca('0xd'),auth[_0xe7ca('0x9')](),controller[_0xe7ca('0xe')]);router['get'](_0xe7ca('0xf'),auth[_0xe7ca('0x9')](),controller[_0xe7ca('0x10')]);router['post']('/',auth[_0xe7ca('0x9')](),controller['create']);router['put'](_0xe7ca('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xe7ca('0x11')](_0xe7ca('0xf'),auth[_0xe7ca('0x9')](),controller[_0xe7ca('0x12')]);module[_0xe7ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 8e1035a..90816aa 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 _0x59ae=['STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x59ae,0x1cb));var _0xe59a=function(_0x18b4d7,_0x75f039){_0x18b4d7=_0x18b4d7-0x0;var _0x6afd45=_0x59ae[_0x18b4d7];return _0x6afd45;};'use strict';var Sequelize=require(_0xe59a('0x0'));var moment=require(_0xe59a('0x1'));module[_0xe59a('0x2')]={'type':{'type':Sequelize[_0xe59a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe59a('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xe59a('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xe59a('0x4')],'set':function(_0x5eec6d){var _0xc8c85d=moment(_0x5eec6d);var _0x1bbc79=moment(this[_0xe59a('0x5')](_0xe59a('0x6')))[_0xe59a('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5dac54=_0xc8c85d[_0xe59a('0x8')](_0x1bbc79,'seconds');this['setDataValue']('queuecallerleaveAt',_0x5eec6d);this[_0xe59a('0x9')](_0xe59a('0xa'),_0x5dac54||null);}},'position':{'type':Sequelize[_0xe59a('0xb')]},'count':{'type':Sequelize[_0xe59a('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xe59a('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe59a('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe59a('0x4')]},'queuecallerexit':{'type':Sequelize[_0xe59a('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe59a('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xe59a('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xe59a('0xb')]},'channel':{'type':Sequelize[_0xe59a('0x3')]},'connectedlinenum':{'type':Sequelize[_0xe59a('0x3')]},'connectedlinename':{'type':Sequelize[_0xe59a('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe59a('0x3')]},'exten':{'type':Sequelize[_0xe59a('0x3')]},'priority':{'type':Sequelize[_0xe59a('0x3')]},'holdtime':{'type':Sequelize[_0xe59a('0xb')]},'mohtime':{'type':Sequelize[_0xe59a('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe59a('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe59a('0x3')]},'transfer':{'type':Sequelize[_0xe59a('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe59a('0x3')],'comment':_0xe59a('0xd')},'transferexten':{'type':Sequelize[_0xe59a('0x3')]},'transferuniqueid':{'type':Sequelize[_0xe59a('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe59a('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xe59a('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0xe59a('0x3')]}}; \ No newline at end of file +var _0xf7e9=['FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE'];(function(_0x185806,_0x214ed2){var _0x5425e8=function(_0x57452c){while(--_0x57452c){_0x185806['push'](_0x185806['shift']());}};_0x5425e8(++_0x214ed2);}(_0xf7e9,0x1d1));var _0x9f7e=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0xf7e9[_0x1f5887];return _0x21774b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9f7e('0x0'));module[_0x9f7e('0x1')]={'type':{'type':Sequelize[_0x9f7e('0x2')]},'uniqueid':{'type':Sequelize[_0x9f7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9f7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x4fa459){var _0x3ee941=moment(_0x4fa459);var _0x3f96bb=moment(this[_0x9f7e('0x3')](_0x9f7e('0x4')))[_0x9f7e('0x5')](_0x9f7e('0x6'));var _0x556c4d=_0x3ee941[_0x9f7e('0x7')](_0x3f96bb,_0x9f7e('0x8'));this[_0x9f7e('0x9')](_0x9f7e('0xa'),_0x4fa459);this['setDataValue'](_0x9f7e('0xb'),_0x556c4d||null);}},'position':{'type':Sequelize[_0x9f7e('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x9f7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9f7e('0xe')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9f7e('0xe')]},'queuecallerexit':{'type':Sequelize[_0x9f7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9f7e('0xe')]},'queuecallerexitreason':{'type':Sequelize[_0x9f7e('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9f7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9f7e('0x2')]},'context':{'type':Sequelize[_0x9f7e('0x2')]},'exten':{'type':Sequelize[_0x9f7e('0x2')]},'priority':{'type':Sequelize[_0x9f7e('0x2')]},'holdtime':{'type':Sequelize[_0x9f7e('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9f7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9f7e('0x2')]},'transfer':{'type':Sequelize[_0x9f7e('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9f7e('0x2')],'comment':_0x9f7e('0xf')},'transferexten':{'type':Sequelize[_0x9f7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9f7e('0x2')]},'disposition':{'type':Sequelize[_0x9f7e('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9f7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x9f7e('0xc')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 0322694..ef9d606 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 _0xd023=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','eml-format'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xd023,0x1eb));var _0x3d02=function(_0x5bba11,_0xe514ce){_0x5bba11=_0x5bba11-0x0;var _0xfb4bb1=_0xd023[_0x5bba11];return _0xfb4bb1;};'use strict';var emlformat=require(_0x3d02('0x0'));var rimraf=require(_0x3d02('0x1'));var zipdir=require(_0x3d02('0x2'));var jsonpatch=require(_0x3d02('0x3'));var rp=require('request-promise');var moment=require(_0x3d02('0x4'));var BPromise=require(_0x3d02('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d02('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d02('0x7'));var fs=require('fs');var fs_extra=require(_0x3d02('0x8'));var _=require(_0x3d02('0x9'));var squel=require(_0x3d02('0xa'));var crypto=require('crypto');var jsforce=require(_0x3d02('0xb'));var deskjs=require(_0x3d02('0xc'));var toCsv=require(_0x3d02('0xd'));var querystring=require(_0x3d02('0xe'));var Papa=require(_0x3d02('0xf'));var Redis=require(_0x3d02('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3d02('0x11'));var as=require(_0x3d02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d02('0x13'))(_0x3d02('0x14'));var utils=require(_0x3d02('0x15'));var config=require(_0x3d02('0x16'));var licenseUtil=require(_0x3d02('0x17'));var db=require(_0x3d02('0x18'))['db'];config[_0x3d02('0x19')]=_[_0x3d02('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3d02('0x1b'))(new Redis(config['redis']));require(_0x3d02('0x1c'))[_0x3d02('0x1d')](socket);function respondWithStatusCode(_0x16ac05,_0x59b652){_0x59b652=_0x59b652||0xcc;return function(_0x4881bb){if(_0x4881bb){return _0x16ac05['sendStatus'](_0x59b652);}return _0x16ac05[_0x3d02('0x1e')](_0x59b652)[_0x3d02('0x1f')]();};}function respondWithResult(_0xd54baa,_0x2df27e){_0x2df27e=_0x2df27e||0xc8;return function(_0x5731c3){if(_0x5731c3){return _0xd54baa[_0x3d02('0x1e')](_0x2df27e)['json'](_0x5731c3);}};}function respondWithFilteredResult(_0x56ac6b,_0x2570fe){return function(_0x4d733c){if(_0x4d733c){var _0x21e4de=typeof _0x2570fe[_0x3d02('0x20')]===_0x3d02('0x21')&&typeof _0x2570fe[_0x3d02('0x22')]===_0x3d02('0x21');var _0x5a5d24=_0x4d733c[_0x3d02('0x23')];var _0x1e7cf8=_0x21e4de?0x0:_0x2570fe[_0x3d02('0x20')];var _0x2ef210=_0x21e4de?_0x4d733c[_0x3d02('0x23')]:_0x2570fe[_0x3d02('0x20')]+_0x2570fe[_0x3d02('0x22')];var _0x1569a9;if(_0x2ef210>=_0x5a5d24){_0x2ef210=_0x5a5d24;_0x1569a9=0xc8;}else{_0x1569a9=0xce;}_0x56ac6b[_0x3d02('0x1e')](_0x1569a9);return _0x56ac6b[_0x3d02('0x24')](_0x3d02('0x25'),_0x1e7cf8+'-'+_0x2ef210+'/'+_0x5a5d24)[_0x3d02('0x26')](_0x4d733c);}return null;};}function patchUpdates(_0x189eef){return function(_0x3cd9e3){try{jsonpatch[_0x3d02('0x27')](_0x3cd9e3,_0x189eef,!![]);}catch(_0x1b8fc2){return BPromise[_0x3d02('0x28')](_0x1b8fc2);}return _0x3cd9e3[_0x3d02('0x29')]();};}function saveUpdates(_0x12bbab,_0x52e65a){return function(_0x3fc63c){if(_0x3fc63c){return _0x3fc63c[_0x3d02('0x2a')](_0x12bbab)[_0x3d02('0x2b')](function(_0x427737){return _0x427737;});}return null;};}function removeEntity(_0x2c8ca5,_0x2d683f){return function(_0x44aa27){if(_0x44aa27){return _0x44aa27[_0x3d02('0x2c')]()[_0x3d02('0x2b')](function(){_0x2c8ca5[_0x3d02('0x1e')](0xcc)[_0x3d02('0x1f')]();});}};}function handleEntityNotFound(_0x203e8a,_0x3dfb54){return function(_0x58d9d5){if(!_0x58d9d5){_0x203e8a['sendStatus'](0x194);}return _0x58d9d5;};}function handleError(_0x24718f,_0x4b4658){_0x4b4658=_0x4b4658||0x1f4;return function(_0x4df68f){logger[_0x3d02('0x2d')](_0x4df68f['stack']);if(_0x4df68f[_0x3d02('0x2e')]){delete _0x4df68f[_0x3d02('0x2e')];}_0x24718f[_0x3d02('0x1e')](_0x4b4658)[_0x3d02('0x2f')](_0x4df68f);};}exports[_0x3d02('0x30')]=function(_0x129001,_0x34b0b1){var _0x206391={},_0x3719fc={},_0x344e83={'count':0x0,'rows':[]};var _0x1587b7=_[_0x3d02('0x31')](db[_0x3d02('0x32')][_0x3d02('0x33')],function(_0x5caa4f){return{'name':_0x5caa4f['fieldName'],'type':_0x5caa4f[_0x3d02('0x34')][_0x3d02('0x35')]};});_0x3719fc[_0x3d02('0x36')]=_[_0x3d02('0x31')](_0x1587b7,_0x3d02('0x2e'));_0x3719fc['query']=_[_0x3d02('0x37')](_0x129001['query']);_0x3719fc[_0x3d02('0x38')]=_[_0x3d02('0x39')](_0x3719fc[_0x3d02('0x36')],_0x3719fc[_0x3d02('0x3a')]);_0x206391[_0x3d02('0x3b')]=_[_0x3d02('0x39')](_0x3719fc[_0x3d02('0x36')],qs['fields'](_0x129001[_0x3d02('0x3a')][_0x3d02('0x3c')]));_0x206391[_0x3d02('0x3b')]=_0x206391[_0x3d02('0x3b')][_0x3d02('0x3d')]?_0x206391[_0x3d02('0x3b')]:_0x3719fc['model'];if(!_0x129001[_0x3d02('0x3a')]['hasOwnProperty']('nolimit')){_0x206391[_0x3d02('0x22')]=qs[_0x3d02('0x22')](_0x129001[_0x3d02('0x3a')][_0x3d02('0x22')]);_0x206391[_0x3d02('0x20')]=qs[_0x3d02('0x20')](_0x129001[_0x3d02('0x3a')]['offset']);}_0x206391[_0x3d02('0x3e')]=qs['sort'](_0x129001['query'][_0x3d02('0x3f')]);_0x206391[_0x3d02('0x40')]=qs[_0x3d02('0x38')](_[_0x3d02('0x41')](_0x129001['query'],_0x3719fc[_0x3d02('0x38')]),_0x1587b7);if(_0x129001[_0x3d02('0x3a')][_0x3d02('0x42')]){_0x206391[_0x3d02('0x40')]=_['merge'](_0x206391[_0x3d02('0x40')],{'$or':_[_0x3d02('0x31')](_0x1587b7,function(_0x536b27){if(_0x536b27[_0x3d02('0x34')]!=='VIRTUAL'){var _0xde29e0={};_0xde29e0[_0x536b27[_0x3d02('0x2e')]]={'$like':'%'+_0x129001[_0x3d02('0x3a')]['filter']+'%'};return _0xde29e0;}})});}_0x206391=_[_0x3d02('0x43')]({},_0x206391,_0x129001['options']);var _0x4fb1a7={'where':_0x206391[_0x3d02('0x40')]};return db['VoiceQueueReport'][_0x3d02('0x23')](_0x4fb1a7)[_0x3d02('0x2b')](function(_0x572773){_0x344e83['count']=_0x572773;if(_0x129001[_0x3d02('0x3a')][_0x3d02('0x44')]){_0x206391['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3d02('0x45')](_0x206391);})[_0x3d02('0x2b')](function(_0x4fbc17){_0x344e83[_0x3d02('0x46')]=_0x4fbc17;return _0x344e83;})[_0x3d02('0x2b')](respondWithFilteredResult(_0x34b0b1,_0x206391))[_0x3d02('0x47')](handleError(_0x34b0b1,null));};exports[_0x3d02('0x48')]=function(_0x5f0274,_0x3862ad){var _0x4fee27={'raw':![],'where':{'id':_0x5f0274[_0x3d02('0x49')]['id']}},_0x4d015d={};_0x4d015d[_0x3d02('0x36')]=_[_0x3d02('0x37')](db[_0x3d02('0x32')][_0x3d02('0x33')]);_0x4d015d['query']=_[_0x3d02('0x37')](_0x5f0274[_0x3d02('0x3a')]);_0x4d015d[_0x3d02('0x38')]=_[_0x3d02('0x39')](_0x4d015d[_0x3d02('0x36')],_0x4d015d[_0x3d02('0x3a')]);_0x4fee27[_0x3d02('0x3b')]=_[_0x3d02('0x39')](_0x4d015d[_0x3d02('0x36')],qs[_0x3d02('0x3c')](_0x5f0274[_0x3d02('0x3a')][_0x3d02('0x3c')]));_0x4fee27['attributes']=_0x4fee27[_0x3d02('0x3b')][_0x3d02('0x3d')]?_0x4fee27[_0x3d02('0x3b')]:_0x4d015d[_0x3d02('0x36')];if(_0x5f0274[_0x3d02('0x3a')][_0x3d02('0x44')]){_0x4fee27[_0x3d02('0x4a')]=[{'all':!![]}];}_0x4fee27=_[_0x3d02('0x43')]({},_0x4fee27,_0x5f0274[_0x3d02('0x4b')]);return db[_0x3d02('0x32')][_0x3d02('0x4c')](_0x4fee27)['then'](handleEntityNotFound(_0x3862ad,null))[_0x3d02('0x2b')](respondWithResult(_0x3862ad,null))[_0x3d02('0x47')](handleError(_0x3862ad,null));};exports['create']=function(_0x289df4,_0x4bf0bb){return db[_0x3d02('0x32')]['create'](_0x289df4[_0x3d02('0x4d')],{})['then'](respondWithResult(_0x4bf0bb,0xc9))['catch'](handleError(_0x4bf0bb,null));};exports['update']=function(_0x551fd0,_0x51ba7f){if(_0x551fd0[_0x3d02('0x4d')]['id']){delete _0x551fd0['body']['id'];}return db[_0x3d02('0x32')][_0x3d02('0x4c')]({'where':{'id':_0x551fd0[_0x3d02('0x49')]['id']}})[_0x3d02('0x2b')](handleEntityNotFound(_0x51ba7f,null))['then'](saveUpdates(_0x551fd0['body'],null))[_0x3d02('0x2b')](respondWithResult(_0x51ba7f,null))['catch'](handleError(_0x51ba7f,null));};exports[_0x3d02('0x2c')]=function(_0x2893e7,_0x63403a){return db['VoiceQueueReport']['find']({'where':{'id':_0x2893e7[_0x3d02('0x49')]['id']}})[_0x3d02('0x2b')](handleEntityNotFound(_0x63403a,null))[_0x3d02('0x2b')](removeEntity(_0x63403a,null))[_0x3d02('0x47')](handleError(_0x63403a,null));};exports[_0x3d02('0x4e')]=function(_0x451f4a,_0x5987cd){return db[_0x3d02('0x32')]['describe']()['then'](respondWithResult(_0x5987cd,null))[_0x3d02('0x47')](handleError(_0x5987cd,null));};exports[_0x3d02('0x4f')]=function(_0x503d06,_0xe20636){var _0x45e91f={},_0x5505a0={},_0x3c4bfb={'count':0x0,'rows':[]};_0x5505a0[_0x3d02('0x36')]=_['keys'](db[_0x3d02('0x32')][_0x3d02('0x33')]);_0x5505a0[_0x3d02('0x3a')]=_[_0x3d02('0x37')](_0x503d06[_0x3d02('0x3a')]);_0x5505a0[_0x3d02('0x38')]=_[_0x3d02('0x39')](_0x5505a0['model'],_0x5505a0[_0x3d02('0x3a')]);_0x45e91f['attributes']=_[_0x3d02('0x39')](_0x5505a0['model'],qs[_0x3d02('0x3c')](_0x503d06['query'][_0x3d02('0x3c')]));_0x45e91f['attributes']=_0x45e91f['attributes']['length']?_0x45e91f[_0x3d02('0x3b')]:_0x5505a0[_0x3d02('0x36')];if(!_0x503d06[_0x3d02('0x3a')][_0x3d02('0x50')](_0x3d02('0x51'))){_0x45e91f['limit']=qs[_0x3d02('0x22')](_0x503d06['query'][_0x3d02('0x22')]);_0x45e91f[_0x3d02('0x20')]=qs[_0x3d02('0x20')](_0x503d06['query']['offset']);}_0x45e91f[_0x3d02('0x3e')]=qs[_0x3d02('0x3f')](_0x503d06[_0x3d02('0x3a')][_0x3d02('0x3f')]);_0x45e91f[_0x3d02('0x40')]=qs[_0x3d02('0x38')](_[_0x3d02('0x41')](_0x503d06[_0x3d02('0x3a')],_0x5505a0[_0x3d02('0x38')]));if(_0x503d06[_0x3d02('0x3a')]['filter']){_0x45e91f[_0x3d02('0x40')]=_['merge'](_0x45e91f[_0x3d02('0x40')],{'$or':_[_0x3d02('0x31')](_0x45e91f['attributes'],function(_0x3b749f){var _0x41cdbe={};_0x41cdbe[_0x3b749f]={'$like':'%'+_0x503d06[_0x3d02('0x3a')][_0x3d02('0x42')]+'%'};return _0x41cdbe;})});}_0x45e91f=_[_0x3d02('0x43')]({},_0x45e91f,_0x503d06['options']);var _0x3a99f2={'where':_0x45e91f[_0x3d02('0x40')]};return db[_0x3d02('0x32')][_0x3d02('0x23')](_0x3a99f2)['then'](function(_0x4a0b36){_0x3c4bfb[_0x3d02('0x23')]=_0x4a0b36;if(_0x503d06[_0x3d02('0x3a')]['includeAll']){_0x45e91f[_0x3d02('0x4a')]=[{'all':!![]}];}return db[_0x3d02('0x32')][_0x3d02('0x45')](_0x45e91f);})[_0x3d02('0x2b')](function(_0x319bef){_0x3c4bfb[_0x3d02('0x46')]=_0x319bef;return _0x3c4bfb;})[_0x3d02('0x2b')](respondWithFilteredResult(_0xe20636,_0x45e91f,_0x3d02('0x4f')))[_0x3d02('0x47')](handleError(_0xe20636,null,_0x3d02('0x4f')));}; \ No newline at end of file +var _0x18e1=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','find','create','body','params','describe','getVoiceQueuesReport','nolimit','order','map','findAll','eml-format','zip-dir'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x18e1,0xa2));var _0x118e=function(_0x4d4775,_0x575478){_0x4d4775=_0x4d4775-0x0;var _0x171dde=_0x18e1[_0x4d4775];return _0x171dde;};'use strict';var emlformat=require(_0x118e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x118e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x118e('0x2'));var moment=require(_0x118e('0x3'));var BPromise=require(_0x118e('0x4'));var Mustache=require(_0x118e('0x5'));var util=require(_0x118e('0x6'));var path=require(_0x118e('0x7'));var sox=require(_0x118e('0x8'));var csv=require(_0x118e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x118e('0xa'));var _=require('lodash');var squel=require(_0x118e('0xb'));var crypto=require(_0x118e('0xc'));var jsforce=require(_0x118e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x118e('0x9'));var querystring=require(_0x118e('0xe'));var Papa=require(_0x118e('0xf'));var Redis=require(_0x118e('0x10'));var authService=require(_0x118e('0x11'));var qs=require(_0x118e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x118e('0x13'));var logger=require(_0x118e('0x14'))(_0x118e('0x15'));var utils=require('../../config/utils');var config=require(_0x118e('0x16'));var licenseUtil=require(_0x118e('0x17'));var db=require('../../mysqldb')['db'];config[_0x118e('0x18')]=_[_0x118e('0x19')](config[_0x118e('0x18')],{'host':_0x118e('0x1a'),'port':0x18eb});var socket=require(_0x118e('0x1b'))(new Redis(config[_0x118e('0x18')]));require(_0x118e('0x1c'))[_0x118e('0x1d')](socket);function respondWithStatusCode(_0x54628f,_0x39e30a){_0x39e30a=_0x39e30a||0xcc;return function(_0x504d43){if(_0x504d43){return _0x54628f[_0x118e('0x1e')](_0x39e30a);}return _0x54628f['status'](_0x39e30a)['end']();};}function respondWithResult(_0x50f76f,_0x41a7bf){_0x41a7bf=_0x41a7bf||0xc8;return function(_0x107765){if(_0x107765){return _0x50f76f[_0x118e('0x1f')](_0x41a7bf)['json'](_0x107765);}};}function respondWithFilteredResult(_0x17530a,_0x287267){return function(_0x19b6ef){if(_0x19b6ef){var _0x345e34=typeof _0x287267[_0x118e('0x20')]===_0x118e('0x21')&&typeof _0x287267[_0x118e('0x22')]==='undefined';var _0x257158=_0x19b6ef[_0x118e('0x23')];var _0x391031=_0x345e34?0x0:_0x287267[_0x118e('0x20')];var _0x1236d1=_0x345e34?_0x19b6ef[_0x118e('0x23')]:_0x287267[_0x118e('0x20')]+_0x287267[_0x118e('0x22')];var _0x339680;if(_0x1236d1>=_0x257158){_0x1236d1=_0x257158;_0x339680=0xc8;}else{_0x339680=0xce;}_0x17530a[_0x118e('0x1f')](_0x339680);return _0x17530a[_0x118e('0x24')](_0x118e('0x25'),_0x391031+'-'+_0x1236d1+'/'+_0x257158)[_0x118e('0x26')](_0x19b6ef);}return null;};}function patchUpdates(_0x27d9a4){return function(_0x3bf778){try{jsonpatch[_0x118e('0x27')](_0x3bf778,_0x27d9a4,!![]);}catch(_0x3d05b4){return BPromise[_0x118e('0x28')](_0x3d05b4);}return _0x3bf778['save']();};}function saveUpdates(_0x31c9ec,_0x5d09b0){return function(_0xa4ae27){if(_0xa4ae27){return _0xa4ae27[_0x118e('0x29')](_0x31c9ec)[_0x118e('0x2a')](function(_0x3cb95b){return _0x3cb95b;});}return null;};}function removeEntity(_0x39a9e3,_0x2eef56){return function(_0x42d552){if(_0x42d552){return _0x42d552[_0x118e('0x2b')]()[_0x118e('0x2a')](function(){_0x39a9e3[_0x118e('0x1f')](0xcc)[_0x118e('0x2c')]();});}};}function handleEntityNotFound(_0x288249,_0x141792){return function(_0x24370a){if(!_0x24370a){_0x288249['sendStatus'](0x194);}return _0x24370a;};}function handleError(_0x521dd6,_0x107e6f){_0x107e6f=_0x107e6f||0x1f4;return function(_0x14676e){logger['error'](_0x14676e[_0x118e('0x2d')]);if(_0x14676e[_0x118e('0x2e')]){delete _0x14676e['name'];}_0x521dd6[_0x118e('0x1f')](_0x107e6f)[_0x118e('0x2f')](_0x14676e);};}exports[_0x118e('0x30')]=function(_0x278304,_0xb0cd7a){var _0x34dcf3={},_0x28cf4e={},_0x43765d={'count':0x0,'rows':[]};var _0x4f78ae=_['map'](db[_0x118e('0x31')][_0x118e('0x32')],function(_0x4bf0cc){return{'name':_0x4bf0cc[_0x118e('0x33')],'type':_0x4bf0cc[_0x118e('0x34')]['key']};});_0x28cf4e[_0x118e('0x35')]=_['map'](_0x4f78ae,_0x118e('0x2e'));_0x28cf4e['query']=_[_0x118e('0x36')](_0x278304['query']);_0x28cf4e['filters']=_[_0x118e('0x37')](_0x28cf4e[_0x118e('0x35')],_0x28cf4e[_0x118e('0x38')]);_0x34dcf3['attributes']=_[_0x118e('0x37')](_0x28cf4e[_0x118e('0x35')],qs[_0x118e('0x39')](_0x278304[_0x118e('0x38')]['fields']));_0x34dcf3[_0x118e('0x3a')]=_0x34dcf3[_0x118e('0x3a')][_0x118e('0x3b')]?_0x34dcf3[_0x118e('0x3a')]:_0x28cf4e[_0x118e('0x35')];if(!_0x278304[_0x118e('0x38')][_0x118e('0x3c')]('nolimit')){_0x34dcf3[_0x118e('0x22')]=qs[_0x118e('0x22')](_0x278304[_0x118e('0x38')]['limit']);_0x34dcf3[_0x118e('0x20')]=qs[_0x118e('0x20')](_0x278304[_0x118e('0x38')][_0x118e('0x20')]);}_0x34dcf3['order']=qs[_0x118e('0x3d')](_0x278304[_0x118e('0x38')]['sort']);_0x34dcf3[_0x118e('0x3e')]=qs[_0x118e('0x3f')](_[_0x118e('0x40')](_0x278304[_0x118e('0x38')],_0x28cf4e['filters']),_0x4f78ae);if(_0x278304[_0x118e('0x38')][_0x118e('0x41')]){_0x34dcf3['where']=_[_0x118e('0x42')](_0x34dcf3[_0x118e('0x3e')],{'$or':_['map'](_0x4f78ae,function(_0x470b65){if(_0x470b65[_0x118e('0x34')]!=='VIRTUAL'){var _0x5d9108={};_0x5d9108[_0x470b65[_0x118e('0x2e')]]={'$like':'%'+_0x278304[_0x118e('0x38')]['filter']+'%'};return _0x5d9108;}})});}_0x34dcf3=_[_0x118e('0x42')]({},_0x34dcf3,_0x278304[_0x118e('0x43')]);var _0x4d9932={'where':_0x34dcf3[_0x118e('0x3e')]};return db[_0x118e('0x31')][_0x118e('0x23')](_0x4d9932)[_0x118e('0x2a')](function(_0x5b528a){_0x43765d[_0x118e('0x23')]=_0x5b528a;if(_0x278304[_0x118e('0x38')][_0x118e('0x44')]){_0x34dcf3[_0x118e('0x45')]=[{'all':!![]}];}return db[_0x118e('0x31')]['findAll'](_0x34dcf3);})[_0x118e('0x2a')](function(_0x2fc18c){_0x43765d[_0x118e('0x46')]=_0x2fc18c;return _0x43765d;})[_0x118e('0x2a')](respondWithFilteredResult(_0xb0cd7a,_0x34dcf3))[_0x118e('0x47')](handleError(_0xb0cd7a,null));};exports['show']=function(_0x1e8140,_0x303103){var _0x500f1c={'raw':![],'where':{'id':_0x1e8140['params']['id']}},_0x344fac={};_0x344fac['model']=_[_0x118e('0x36')](db[_0x118e('0x31')][_0x118e('0x32')]);_0x344fac[_0x118e('0x38')]=_[_0x118e('0x36')](_0x1e8140[_0x118e('0x38')]);_0x344fac[_0x118e('0x3f')]=_[_0x118e('0x37')](_0x344fac['model'],_0x344fac[_0x118e('0x38')]);_0x500f1c[_0x118e('0x3a')]=_[_0x118e('0x37')](_0x344fac[_0x118e('0x35')],qs[_0x118e('0x39')](_0x1e8140[_0x118e('0x38')]['fields']));_0x500f1c['attributes']=_0x500f1c['attributes'][_0x118e('0x3b')]?_0x500f1c[_0x118e('0x3a')]:_0x344fac[_0x118e('0x35')];if(_0x1e8140[_0x118e('0x38')]['includeAll']){_0x500f1c[_0x118e('0x45')]=[{'all':!![]}];}_0x500f1c=_['merge']({},_0x500f1c,_0x1e8140['options']);return db[_0x118e('0x31')][_0x118e('0x48')](_0x500f1c)[_0x118e('0x2a')](handleEntityNotFound(_0x303103,null))[_0x118e('0x2a')](respondWithResult(_0x303103,null))[_0x118e('0x47')](handleError(_0x303103,null));};exports[_0x118e('0x49')]=function(_0x1a11fe,_0x313a0f){return db[_0x118e('0x31')][_0x118e('0x49')](_0x1a11fe[_0x118e('0x4a')],{})[_0x118e('0x2a')](respondWithResult(_0x313a0f,0xc9))[_0x118e('0x47')](handleError(_0x313a0f,null));};exports[_0x118e('0x29')]=function(_0x50dde9,_0x3159fa){if(_0x50dde9[_0x118e('0x4a')]['id']){delete _0x50dde9[_0x118e('0x4a')]['id'];}return db[_0x118e('0x31')][_0x118e('0x48')]({'where':{'id':_0x50dde9[_0x118e('0x4b')]['id']}})[_0x118e('0x2a')](handleEntityNotFound(_0x3159fa,null))[_0x118e('0x2a')](saveUpdates(_0x50dde9[_0x118e('0x4a')],null))[_0x118e('0x2a')](respondWithResult(_0x3159fa,null))[_0x118e('0x47')](handleError(_0x3159fa,null));};exports['destroy']=function(_0xfb336a,_0x53a8c1){return db[_0x118e('0x31')][_0x118e('0x48')]({'where':{'id':_0xfb336a[_0x118e('0x4b')]['id']}})[_0x118e('0x2a')](handleEntityNotFound(_0x53a8c1,null))['then'](removeEntity(_0x53a8c1,null))['catch'](handleError(_0x53a8c1,null));};exports[_0x118e('0x4c')]=function(_0x3e9698,_0x5e5175){return db[_0x118e('0x31')]['describe']()['then'](respondWithResult(_0x5e5175,null))[_0x118e('0x47')](handleError(_0x5e5175,null));};exports[_0x118e('0x4d')]=function(_0x160662,_0x482558){var _0x491ab4={},_0x3b8cd5={},_0x441b97={'count':0x0,'rows':[]};_0x3b8cd5['model']=_[_0x118e('0x36')](db['VoiceQueueReport'][_0x118e('0x32')]);_0x3b8cd5['query']=_[_0x118e('0x36')](_0x160662['query']);_0x3b8cd5[_0x118e('0x3f')]=_['intersection'](_0x3b8cd5[_0x118e('0x35')],_0x3b8cd5[_0x118e('0x38')]);_0x491ab4[_0x118e('0x3a')]=_[_0x118e('0x37')](_0x3b8cd5[_0x118e('0x35')],qs['fields'](_0x160662[_0x118e('0x38')][_0x118e('0x39')]));_0x491ab4[_0x118e('0x3a')]=_0x491ab4[_0x118e('0x3a')]['length']?_0x491ab4['attributes']:_0x3b8cd5['model'];if(!_0x160662[_0x118e('0x38')][_0x118e('0x3c')](_0x118e('0x4e'))){_0x491ab4[_0x118e('0x22')]=qs['limit'](_0x160662[_0x118e('0x38')][_0x118e('0x22')]);_0x491ab4[_0x118e('0x20')]=qs[_0x118e('0x20')](_0x160662[_0x118e('0x38')][_0x118e('0x20')]);}_0x491ab4[_0x118e('0x4f')]=qs[_0x118e('0x3d')](_0x160662[_0x118e('0x38')][_0x118e('0x3d')]);_0x491ab4['where']=qs[_0x118e('0x3f')](_[_0x118e('0x40')](_0x160662[_0x118e('0x38')],_0x3b8cd5[_0x118e('0x3f')]));if(_0x160662[_0x118e('0x38')]['filter']){_0x491ab4[_0x118e('0x3e')]=_[_0x118e('0x42')](_0x491ab4[_0x118e('0x3e')],{'$or':_[_0x118e('0x50')](_0x491ab4[_0x118e('0x3a')],function(_0x42138c){var _0x3ea056={};_0x3ea056[_0x42138c]={'$like':'%'+_0x160662[_0x118e('0x38')][_0x118e('0x41')]+'%'};return _0x3ea056;})});}_0x491ab4=_[_0x118e('0x42')]({},_0x491ab4,_0x160662[_0x118e('0x43')]);var _0x2abcb6={'where':_0x491ab4['where']};return db['VoiceQueueReport'][_0x118e('0x23')](_0x2abcb6)['then'](function(_0x16b2a7){_0x441b97[_0x118e('0x23')]=_0x16b2a7;if(_0x160662[_0x118e('0x38')][_0x118e('0x44')]){_0x491ab4['include']=[{'all':!![]}];}return db[_0x118e('0x31')][_0x118e('0x51')](_0x491ab4);})[_0x118e('0x2a')](function(_0x5de290){_0x441b97[_0x118e('0x46')]=_0x5de290;return _0x441b97;})[_0x118e('0x2a')](respondWithFilteredResult(_0x482558,_0x491ab4,_0x118e('0x4d')))[_0x118e('0x47')](handleError(_0x482558,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index c3446b7..efb1371 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 _0x7280=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit'];(function(_0x3779da,_0x48d0dd){var _0x3c1185=function(_0x281d31){while(--_0x281d31){_0x3779da['push'](_0x3779da['shift']());}};_0x3c1185(++_0x48d0dd);}(_0x7280,0x107));var _0x0728=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7280[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x0728('0x0'));var VoiceQueueReport=require(_0x0728('0x1'))['db'][_0x0728('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0728('0x3')](0x0);var events={'afterCreate':_0x0728('0x4'),'afterUpdate':_0x0728('0x5'),'afterDestroy':'remove'};function emitEvent(_0x480038){return function(_0x30bcde,_0x4150aa,_0x41c207){VoiceQueueReportEvents['emit'](_0x480038+':'+_0x30bcde['id'],_0x30bcde);VoiceQueueReportEvents[_0x0728('0x6')](_0x480038,_0x30bcde);_0x41c207(null);};}for(var e in events){if(events[_0x0728('0x7')](e)){var event=events[e];VoiceQueueReport[_0x0728('0x8')](e,emitEvent(event));}}module[_0x0728('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0728=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x47fd45,_0x40dd67){var _0x363313=function(_0xb92163){while(--_0xb92163){_0x47fd45['push'](_0x47fd45['shift']());}};_0x363313(++_0x40dd67);}(_0x0728,0xd5));var _0x8072=function(_0x5cfec0,_0x1af0c9){_0x5cfec0=_0x5cfec0-0x0;var _0x2aaa31=_0x0728[_0x5cfec0];return _0x2aaa31;};'use strict';var EventEmitter=require(_0x8072('0x0'));var VoiceQueueReport=require(_0x8072('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8072('0x2')](0x0);var events={'afterCreate':_0x8072('0x3'),'afterUpdate':'update','afterDestroy':_0x8072('0x4')};function emitEvent(_0x406f0a){return function(_0x10ae82,_0x58c314,_0x236de9){VoiceQueueReportEvents[_0x8072('0x5')](_0x406f0a+':'+_0x10ae82['id'],_0x10ae82);VoiceQueueReportEvents['emit'](_0x406f0a,_0x10ae82);_0x236de9(null);};}for(var e in events){if(events[_0x8072('0x6')](e)){var event=events[e];VoiceQueueReport[_0x8072('0x7')](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 bc7c9ba..a0c7462 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 _0xfdf8=['path','../../config/environment','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0xfdf8,0x10d));var _0x8fdf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfdf8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8fdf('0x0'));var util=require(_0x8fdf('0x1'));var logger=require(_0x8fdf('0x2'))(_0x8fdf('0x3'));var moment=require(_0x8fdf('0x4'));var BPromise=require(_0x8fdf('0x5'));var rp=require(_0x8fdf('0x6'));var fs=require('fs');var path=require(_0x8fdf('0x7'));var rimraf=require('rimraf');var config=require(_0x8fdf('0x8'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x2f2194,_0x1b6e2f){return _0x2f2194['define'](_0x8fdf('0x9'),attributes,{'tableName':_0x8fdf('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8fdf('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf881=['bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','moment'];(function(_0x393cea,_0x2320ba){var _0x1d23b8=function(_0x23ba2c){while(--_0x23ba2c){_0x393cea['push'](_0x393cea['shift']());}};_0x1d23b8(++_0x2320ba);}(_0xf881,0x1d1));var _0x1f88=function(_0x4ae379,_0x21db70){_0x4ae379=_0x4ae379-0x0;var _0x2d54c1=_0xf881[_0x4ae379];return _0x2d54c1;};'use strict';var _=require(_0x1f88('0x0'));var util=require(_0x1f88('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1f88('0x2'));var BPromise=require(_0x1f88('0x3'));var rp=require(_0x1f88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f88('0x5'));var config=require(_0x1f88('0x6'));var attributes=require(_0x1f88('0x7'));module[_0x1f88('0x8')]=function(_0x4f563c,_0x4f4825){return _0x4f563c['define'](_0x1f88('0x9'),attributes,{'tableName':_0x1f88('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1f88('0xb')]},{'fields':[_0x1f88('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2b2613b..0f9089f 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 _0x5d39=['VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x5d39,0x111));var _0x95d3=function(_0x453414,_0x15c51c){_0x453414=_0x453414-0x0;var _0x308094=_0x5d39[_0x453414];return _0x308094;};'use strict';var _=require('lodash');var util=require(_0x95d3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x95d3('0x1'));var fs=require('fs');var Redis=require(_0x95d3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x95d3('0x3'));var logger=require(_0x95d3('0x4'))(_0x95d3('0x5'));var config=require('../../config/environment');var jayson=require(_0x95d3('0x6'));var client=jayson[_0x95d3('0x7')][_0x95d3('0x8')]({'port':0x232a});config[_0x95d3('0x9')]=_[_0x95d3('0xa')](config[_0x95d3('0x9')],{'host':_0x95d3('0xb'),'port':0x18eb});var socket=require(_0x95d3('0xc'))(new Redis(config[_0x95d3('0x9')]));require(_0x95d3('0xd'))[_0x95d3('0xe')](socket);function respondWithRpcPromise(_0x1f2910,_0x467f35,_0x8c76cc){return new BPromise(function(_0x45b99b,_0x5988d8){return client[_0x95d3('0xf')](_0x1f2910,_0x8c76cc)[_0x95d3('0x10')](function(_0x2ef80f){logger[_0x95d3('0x11')](_0x95d3('0x12'),_0x467f35,_0x95d3('0x13'));logger[_0x95d3('0x14')](_0x95d3('0x15'),_0x467f35,_0x95d3('0x13'),JSON['stringify'](_0x2ef80f));if(_0x2ef80f[_0x95d3('0x16')]){if(_0x2ef80f[_0x95d3('0x16')][_0x95d3('0x17')]===0x1f4){logger['error'](_0x95d3('0x12'),_0x467f35,_0x2ef80f[_0x95d3('0x16')]['message']);return _0x5988d8(_0x2ef80f[_0x95d3('0x16')][_0x95d3('0x18')]);}logger[_0x95d3('0x16')](_0x95d3('0x12'),_0x467f35,_0x2ef80f['error'][_0x95d3('0x18')]);return _0x45b99b(_0x2ef80f['error'][_0x95d3('0x18')]);}else{logger[_0x95d3('0x11')](_0x95d3('0x12'),_0x467f35,'request\x20sent');_0x45b99b(_0x2ef80f[_0x95d3('0x19')][_0x95d3('0x18')]);}})[_0x95d3('0x1a')](function(_0x48405d){logger[_0x95d3('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x467f35,_0x48405d);_0x5988d8(_0x48405d);});});}exports[_0x95d3('0x1b')]=function(_0x8046ee){var _0x314f78=this;return new Promise(function(_0x153a4e,_0x4ff452){return db[_0x95d3('0x1c')][_0x95d3('0x1d')]({'raw':_0x8046ee[_0x95d3('0x1e')]?_0x8046ee[_0x95d3('0x1e')][_0x95d3('0x1f')]===undefined?!![]:![]:!![],'where':_0x8046ee[_0x95d3('0x1e')]?_0x8046ee[_0x95d3('0x1e')][_0x95d3('0x20')]||null:null,'attributes':_0x8046ee['options']?_0x8046ee['options'][_0x95d3('0x21')]||null:null,'limit':_0x8046ee[_0x95d3('0x1e')]?_0x8046ee['options'][_0x95d3('0x22')]||null:null,'include':_0x8046ee[_0x95d3('0x1e')]?_0x8046ee[_0x95d3('0x1e')][_0x95d3('0x23')]?_[_0x95d3('0x24')](_0x8046ee[_0x95d3('0x1e')][_0x95d3('0x23')],function(_0x113a7a){return{'model':db[_0x113a7a['model']],'as':_0x113a7a['as'],'attributes':_0x113a7a[_0x95d3('0x21')],'include':_0x113a7a[_0x95d3('0x23')]?_[_0x95d3('0x24')](_0x113a7a[_0x95d3('0x23')],function(_0x2af6fe){return{'model':db[_0x2af6fe[_0x95d3('0x25')]],'as':_0x2af6fe['as'],'attributes':_0x2af6fe[_0x95d3('0x21')],'include':_0x2af6fe['include']?_['map'](_0x2af6fe['include'],function(_0x167139){return{'model':db[_0x167139[_0x95d3('0x25')]],'as':_0x167139['as'],'attributes':_0x167139[_0x95d3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2241c1){logger[_0x95d3('0x11')](_0x95d3('0x1b'),_0x8046ee);logger[_0x95d3('0x14')](_0x95d3('0x1b'),_0x8046ee,JSON['stringify'](_0x2241c1));_0x153a4e(_0x2241c1);})['catch'](function(_0x5889fc){logger[_0x95d3('0x16')]('GetVoiceQueueReport',_0x5889fc[_0x95d3('0x18')],_0x8046ee);_0x4ff452(_0x314f78[_0x95d3('0x16')](0x1f4,_0x5889fc[_0x95d3('0x18')]));});});};exports[_0x95d3('0x26')]=function(_0x337e49){var _0x283f75=this;return new Promise(function(_0x25c8cd,_0x21c8f6){return db[_0x95d3('0x1c')][_0x95d3('0x27')](_0x337e49[_0x95d3('0x28')],{'raw':_0x337e49[_0x95d3('0x1e')]?_0x337e49[_0x95d3('0x1e')][_0x95d3('0x1f')]===undefined?!![]:![]:!![]})[_0x95d3('0x10')](function(_0x294ef5){logger[_0x95d3('0x11')](_0x95d3('0x26'),_0x337e49);logger['debug'](_0x95d3('0x26'),_0x337e49,JSON[_0x95d3('0x29')](_0x294ef5));_0x25c8cd(_0x294ef5);})[_0x95d3('0x1a')](function(_0x54045e){logger['error'](_0x95d3('0x26'),_0x54045e['message'],_0x337e49);_0x21c8f6(_0x283f75['error'](0x1f4,_0x54045e[_0x95d3('0x18')]));});});};exports[_0x95d3('0x2a')]=function(_0x533569){var _0x54048f=this;return new Promise(function(_0x5d7b7b,_0x16f121){return db[_0x95d3('0x1c')]['update'](_0x533569[_0x95d3('0x28')],{'raw':_0x533569[_0x95d3('0x1e')]?_0x533569[_0x95d3('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x533569[_0x95d3('0x1e')]?_0x533569[_0x95d3('0x1e')]['where']||null:null,'attributes':_0x533569['options']?_0x533569[_0x95d3('0x1e')][_0x95d3('0x21')]||null:null,'limit':_0x533569[_0x95d3('0x1e')]?_0x533569[_0x95d3('0x1e')][_0x95d3('0x22')]||null:null})[_0x95d3('0x10')](function(_0xe75a8){logger['info'](_0x95d3('0x2a'),_0x533569);logger['debug'](_0x95d3('0x2a'),_0x533569,JSON[_0x95d3('0x29')](_0xe75a8));_0x5d7b7b(_0xe75a8);})[_0x95d3('0x1a')](function(_0x53e1b2){logger[_0x95d3('0x16')]('UpdateVoiceQueueReport',_0x53e1b2[_0x95d3('0x18')],_0x533569);_0x16f121(_0x54048f[_0x95d3('0x16')](0x1f4,_0x53e1b2[_0x95d3('0x18')]));});});}; \ No newline at end of file +var _0x921c=['info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VoiceQueueReport','findAll','options','raw','where','limit','map','include','model','attributes','GetVoiceQueueReport','debug','stringify','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then'];(function(_0xedc188,_0x14a4ac){var _0xb45698=function(_0xfb82ae){while(--_0xfb82ae){_0xedc188['push'](_0xedc188['shift']());}};_0xb45698(++_0x14a4ac);}(_0x921c,0x93));var _0xc921=function(_0x54a0cb,_0x1308dd){_0x54a0cb=_0x54a0cb-0x0;var _0x443cb7=_0x921c[_0x54a0cb];return _0x443cb7;};'use strict';var _=require(_0xc921('0x0'));var util=require(_0xc921('0x1'));var moment=require(_0xc921('0x2'));var BPromise=require(_0xc921('0x3'));var rs=require(_0xc921('0x4'));var fs=require('fs');var Redis=require(_0xc921('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc921('0x6'));var logger=require('../../config/logger')(_0xc921('0x7'));var config=require(_0xc921('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc921('0x9')][_0xc921('0xa')]({'port':0x232a});config[_0xc921('0xb')]=_[_0xc921('0xc')](config[_0xc921('0xb')],{'host':_0xc921('0xd'),'port':0x18eb});var socket=require(_0xc921('0xe'))(new Redis(config[_0xc921('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x235e53,_0x2b66b7,_0x52ec48){return new BPromise(function(_0x227cfa,_0x1de86f){return client[_0xc921('0xf')](_0x235e53,_0x52ec48)[_0xc921('0x10')](function(_0x572bef){logger[_0xc921('0x11')](_0xc921('0x12'),_0x2b66b7,_0xc921('0x13'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2b66b7,'request\x20sent',JSON['stringify'](_0x572bef));if(_0x572bef[_0xc921('0x14')]){if(_0x572bef[_0xc921('0x14')][_0xc921('0x15')]===0x1f4){logger[_0xc921('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2b66b7,_0x572bef[_0xc921('0x14')]['message']);return _0x1de86f(_0x572bef['error'][_0xc921('0x16')]);}logger[_0xc921('0x14')](_0xc921('0x12'),_0x2b66b7,_0x572bef[_0xc921('0x14')][_0xc921('0x16')]);return _0x227cfa(_0x572bef[_0xc921('0x14')][_0xc921('0x16')]);}else{logger[_0xc921('0x11')](_0xc921('0x12'),_0x2b66b7,_0xc921('0x13'));_0x227cfa(_0x572bef[_0xc921('0x17')]['message']);}})[_0xc921('0x18')](function(_0x2aff76){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2b66b7,_0x2aff76);_0x1de86f(_0x2aff76);});});}exports['GetVoiceQueueReport']=function(_0xc53e9a){var _0x351ac8=this;return new Promise(function(_0x47f5d2,_0x2262ea){return db[_0xc921('0x19')][_0xc921('0x1a')]({'raw':_0xc53e9a[_0xc921('0x1b')]?_0xc53e9a[_0xc921('0x1b')][_0xc921('0x1c')]===undefined?!![]:![]:!![],'where':_0xc53e9a[_0xc921('0x1b')]?_0xc53e9a[_0xc921('0x1b')][_0xc921('0x1d')]||null:null,'attributes':_0xc53e9a[_0xc921('0x1b')]?_0xc53e9a[_0xc921('0x1b')]['attributes']||null:null,'limit':_0xc53e9a[_0xc921('0x1b')]?_0xc53e9a[_0xc921('0x1b')][_0xc921('0x1e')]||null:null,'include':_0xc53e9a[_0xc921('0x1b')]?_0xc53e9a[_0xc921('0x1b')]['include']?_[_0xc921('0x1f')](_0xc53e9a[_0xc921('0x1b')][_0xc921('0x20')],function(_0x3cc680){return{'model':db[_0x3cc680[_0xc921('0x21')]],'as':_0x3cc680['as'],'attributes':_0x3cc680[_0xc921('0x22')],'include':_0x3cc680[_0xc921('0x20')]?_[_0xc921('0x1f')](_0x3cc680[_0xc921('0x20')],function(_0x490477){return{'model':db[_0x490477['model']],'as':_0x490477['as'],'attributes':_0x490477[_0xc921('0x22')],'include':_0x490477[_0xc921('0x20')]?_['map'](_0x490477['include'],function(_0x56de57){return{'model':db[_0x56de57[_0xc921('0x21')]],'as':_0x56de57['as'],'attributes':_0x56de57[_0xc921('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37e257){logger[_0xc921('0x11')](_0xc921('0x23'),_0xc53e9a);logger[_0xc921('0x24')]('GetVoiceQueueReport',_0xc53e9a,JSON[_0xc921('0x25')](_0x37e257));_0x47f5d2(_0x37e257);})[_0xc921('0x18')](function(_0x8c9be2){logger[_0xc921('0x14')](_0xc921('0x23'),_0x8c9be2[_0xc921('0x16')],_0xc53e9a);_0x2262ea(_0x351ac8[_0xc921('0x14')](0x1f4,_0x8c9be2['message']));});});};exports[_0xc921('0x26')]=function(_0x2fb25a){var _0x496cd8=this;return new Promise(function(_0x3efe53,_0x2f6639){return db[_0xc921('0x19')]['create'](_0x2fb25a[_0xc921('0x27')],{'raw':_0x2fb25a[_0xc921('0x1b')]?_0x2fb25a[_0xc921('0x1b')][_0xc921('0x1c')]===undefined?!![]:![]:!![]})[_0xc921('0x10')](function(_0xb2c279){logger['info'](_0xc921('0x26'),_0x2fb25a);logger[_0xc921('0x24')](_0xc921('0x26'),_0x2fb25a,JSON['stringify'](_0xb2c279));_0x3efe53(_0xb2c279);})['catch'](function(_0xf1ebc6){logger[_0xc921('0x14')](_0xc921('0x26'),_0xf1ebc6[_0xc921('0x16')],_0x2fb25a);_0x2f6639(_0x496cd8[_0xc921('0x14')](0x1f4,_0xf1ebc6[_0xc921('0x16')]));});});};exports[_0xc921('0x28')]=function(_0x4194c0){var _0x4308fb=this;return new Promise(function(_0x982728,_0x46d153){return db['VoiceQueueReport']['update'](_0x4194c0[_0xc921('0x27')],{'raw':_0x4194c0[_0xc921('0x1b')]?_0x4194c0['options'][_0xc921('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4194c0[_0xc921('0x1b')]?_0x4194c0[_0xc921('0x1b')][_0xc921('0x1d')]||null:null,'attributes':_0x4194c0[_0xc921('0x1b')]?_0x4194c0[_0xc921('0x1b')][_0xc921('0x22')]||null:null,'limit':_0x4194c0[_0xc921('0x1b')]?_0x4194c0['options'][_0xc921('0x1e')]||null:null})['then'](function(_0x46d4dc){logger['info'](_0xc921('0x28'),_0x4194c0);logger[_0xc921('0x24')](_0xc921('0x28'),_0x4194c0,JSON[_0xc921('0x25')](_0x46d4dc));_0x982728(_0x46d4dc);})[_0xc921('0x18')](function(_0x4629b1){logger[_0xc921('0x14')](_0xc921('0x28'),_0x4629b1[_0xc921('0x16')],_0x4194c0);_0x46d153(_0x4308fb[_0xc921('0x14')](0x1f4,_0x4629b1['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index afe5939..9e5fc7c 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 _0x0ab2=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener','register'];(function(_0xdc815e,_0x10ac44){var _0x19285c=function(_0x18187c){while(--_0x18187c){_0xdc815e['push'](_0xdc815e['shift']());}};_0x19285c(++_0x10ac44);}(_0x0ab2,0x9a));var _0x20ab=function(_0x4b129b,_0x15477f){_0x4b129b=_0x4b129b-0x0;var _0x2b89b7=_0x0ab2[_0x4b129b];return _0x2b89b7;};'use strict';var VoiceQueueReportEvents=require(_0x20ab('0x0'));var events=[_0x20ab('0x1'),_0x20ab('0x2'),_0x20ab('0x3')];function createListener(_0x217637,_0x1520c9){return function(_0x4cc8cc){_0x1520c9['emit'](_0x217637,_0x4cc8cc);};}function removeListener(_0x435fc9,_0x2c4d43){return function(){VoiceQueueReportEvents[_0x20ab('0x4')](_0x435fc9,_0x2c4d43);};}exports[_0x20ab('0x5')]=function(_0x35fdb5){for(var _0x362d27=0x0,_0x16d3fc=events[_0x20ab('0x6')];_0x362d27<_0x16d3fc;_0x362d27++){var _0x458cd9=events[_0x362d27];var _0x547349=createListener(_0x20ab('0x7')+_0x458cd9,_0x35fdb5);VoiceQueueReportEvents['on'](_0x458cd9,_0x547349);}}; \ No newline at end of file +var _0x59ce=['removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x1bd7b7,_0x18e7c4){var _0x46a408=function(_0x447563){while(--_0x447563){_0x1bd7b7['push'](_0x1bd7b7['shift']());}};_0x46a408(++_0x18e7c4);}(_0x59ce,0x92));var _0xe59c=function(_0x468f58,_0x78b8a){_0x468f58=_0x468f58-0x0;var _0x4a132b=_0x59ce[_0x468f58];return _0x4a132b;};'use strict';var VoiceQueueReportEvents=require(_0xe59c('0x0'));var events=[_0xe59c('0x1'),_0xe59c('0x2'),'update'];function createListener(_0x9cdd6a,_0x18c8c3){return function(_0x455361){_0x18c8c3[_0xe59c('0x3')](_0x9cdd6a,_0x455361);};}function removeListener(_0x2ea56e,_0x42a856){return function(){VoiceQueueReportEvents[_0xe59c('0x4')](_0x2ea56e,_0x42a856);};}exports['register']=function(_0x387c49){for(var _0x4ba903=0x0,_0x534601=events['length'];_0x4ba903<_0x534601;_0x4ba903++){var _0x2c1d11=events[_0x4ba903];var _0x101a79=createListener(_0xe59c('0x5')+_0x2c1d11,_0x387c49);VoiceQueueReportEvents['on'](_0x2c1d11,_0x101a79);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6aedd2c..3bd353d 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 _0xb333=['put','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','index','/:id','isAuthenticated','show','create'];(function(_0x460a70,_0x3e586d){var _0x96249d=function(_0x41d87e){while(--_0x41d87e){_0x460a70['push'](_0x460a70['shift']());}};_0x96249d(++_0x3e586d);}(_0xb333,0x12f));var _0x3b33=function(_0x12da4d,_0x33726d){_0x12da4d=_0x12da4d-0x0;var _0x3f0a42=_0xb333[_0x12da4d];return _0x3f0a42;};'use strict';var multer=require(_0x3b33('0x0'));var util=require('util');var path=require(_0x3b33('0x1'));var timeout=require('connect-timeout');var express=require(_0x3b33('0x2'));var router=express['Router']();var fs_extra=require(_0x3b33('0x3'));var auth=require(_0x3b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3b33('0x5'));var controller=require(_0x3b33('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3b33('0x7')]);router['get'](_0x3b33('0x8'),auth[_0x3b33('0x9')](),controller[_0x3b33('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b33('0xb')]);router[_0x3b33('0xc')](_0x3b33('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3b33('0xd')](_0x3b33('0x8'),auth[_0x3b33('0x9')](),controller[_0x3b33('0xe')]);module['exports']=router; \ No newline at end of file +var _0x05ce=['isAuthenticated','post','create','put','/:id','update','delete','destroy','util','path','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x524b78,_0x4d1c13){var _0x4f42fd=function(_0x195a26){while(--_0x195a26){_0x524b78['push'](_0x524b78['shift']());}};_0x4f42fd(++_0x4d1c13);}(_0x05ce,0xcc));var _0xe05c=function(_0x52cee6,_0x40a9f1){_0x52cee6=_0x52cee6-0x0;var _0x412bbb=_0x05ce[_0x52cee6];return _0x412bbb;};'use strict';var multer=require('multer');var util=require(_0xe05c('0x0'));var path=require(_0xe05c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe05c('0x2'));var config=require(_0xe05c('0x3'));var controller=require(_0xe05c('0x4'));router[_0xe05c('0x5')]('/',auth[_0xe05c('0x6')](),controller['index']);router[_0xe05c('0x5')]('/:id',auth[_0xe05c('0x6')](),controller['show']);router[_0xe05c('0x7')]('/',auth['isAuthenticated'](),controller[_0xe05c('0x8')]);router[_0xe05c('0x9')](_0xe05c('0xa'),auth['isAuthenticated'](),controller[_0xe05c('0xb')]);router[_0xe05c('0xc')](_0xe05c('0xa'),auth[_0xe05c('0x6')](),controller[_0xe05c('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 5d18508..f88a43e 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 _0x7664=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x33f6bb,_0x3fef47){var _0x8d95b0=function(_0x297ddf){while(--_0x297ddf){_0x33f6bb['push'](_0x33f6bb['shift']());}};_0x8d95b0(++_0x3fef47);}(_0x7664,0x17c));var _0x4766=function(_0x442c93,_0x4cf89a){_0x442c93=_0x442c93-0x0;var _0x1f3d13=_0x7664[_0x442c93];return _0x1f3d13;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x4766('0x0')]={'time':{'type':Sequelize[_0x4766('0x1')]},'callid':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4766('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4766('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x4766('0x3')](_0x4766('0x4'))}}; \ No newline at end of file +var _0xe914=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports','STRING','literal'];(function(_0xbdd1d9,_0x57c9c5){var _0x55da06=function(_0x452e03){while(--_0x452e03){_0xbdd1d9['push'](_0xbdd1d9['shift']());}};_0x55da06(++_0x57c9c5);}(_0xe914,0x13c));var _0x4e91=function(_0x3fa545,_0x19ff03){_0x3fa545=_0x3fa545-0x0;var _0x12b6dc=_0xe914[_0x3fa545];return _0x12b6dc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4e91('0x0'));module[_0x4e91('0x1')]={'time':{'type':Sequelize[_0x4e91('0x2')]},'callid':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4e91('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4e91('0x3')](_0x4e91('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 60c88e3..59a8a4a 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 _0xba5f=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','error','name','send','map','VoiceQueuesLog','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','fields','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x174d61,_0x25c3fc){var _0x3f5a42=function(_0x435a77){while(--_0x435a77){_0x174d61['push'](_0x174d61['shift']());}};_0x3f5a42(++_0x25c3fc);}(_0xba5f,0x83));var _0xfba5=function(_0x2f0d59,_0x3fa003){_0x2f0d59=_0x2f0d59-0x0;var _0x2d8052=_0xba5f[_0x2f0d59];return _0x2d8052;};'use strict';var emlformat=require(_0xfba5('0x0'));var rimraf=require(_0xfba5('0x1'));var zipdir=require(_0xfba5('0x2'));var jsonpatch=require(_0xfba5('0x3'));var rp=require(_0xfba5('0x4'));var moment=require(_0xfba5('0x5'));var BPromise=require(_0xfba5('0x6'));var Mustache=require(_0xfba5('0x7'));var util=require(_0xfba5('0x8'));var path=require(_0xfba5('0x9'));var sox=require('sox');var csv=require(_0xfba5('0xa'));var ejs=require(_0xfba5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfba5('0xc'));var squel=require(_0xfba5('0xd'));var crypto=require('crypto');var jsforce=require(_0xfba5('0xe'));var deskjs=require(_0xfba5('0xf'));var toCsv=require(_0xfba5('0xa'));var querystring=require(_0xfba5('0x10'));var Papa=require(_0xfba5('0x11'));var Redis=require(_0xfba5('0x12'));var authService=require(_0xfba5('0x13'));var qs=require(_0xfba5('0x14'));var as=require(_0xfba5('0x15'));var hardwareService=require(_0xfba5('0x16'));var logger=require('../../config/logger')(_0xfba5('0x17'));var utils=require(_0xfba5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xfba5('0x19'));var db=require(_0xfba5('0x1a'))['db'];function respondWithStatusCode(_0x3ed02c,_0x34f825){_0x34f825=_0x34f825||0xcc;return function(_0x312a94){if(_0x312a94){return _0x3ed02c[_0xfba5('0x1b')](_0x34f825);}return _0x3ed02c[_0xfba5('0x1c')](_0x34f825)[_0xfba5('0x1d')]();};}function respondWithResult(_0x3e6eae,_0x5431d4){_0x5431d4=_0x5431d4||0xc8;return function(_0x1ae2f7){if(_0x1ae2f7){return _0x3e6eae[_0xfba5('0x1c')](_0x5431d4)['json'](_0x1ae2f7);}};}function respondWithFilteredResult(_0x42fbae,_0x147b90){return function(_0x2d6226){if(_0x2d6226){var _0x309fcf=typeof _0x147b90['offset']===_0xfba5('0x1e')&&typeof _0x147b90[_0xfba5('0x1f')]===_0xfba5('0x1e');var _0x5500ec=_0x2d6226[_0xfba5('0x20')];var _0x137668=_0x309fcf?0x0:_0x147b90[_0xfba5('0x21')];var _0x7f5069=_0x309fcf?_0x2d6226[_0xfba5('0x20')]:_0x147b90['offset']+_0x147b90[_0xfba5('0x1f')];var _0x3619cf;if(_0x7f5069>=_0x5500ec){_0x7f5069=_0x5500ec;_0x3619cf=0xc8;}else{_0x3619cf=0xce;}_0x42fbae[_0xfba5('0x1c')](_0x3619cf);return _0x42fbae[_0xfba5('0x22')]('Content-Range',_0x137668+'-'+_0x7f5069+'/'+_0x5500ec)[_0xfba5('0x23')](_0x2d6226);}return null;};}function patchUpdates(_0x124416){return function(_0x52f25f){try{jsonpatch[_0xfba5('0x24')](_0x52f25f,_0x124416,!![]);}catch(_0x39aa6e){return BPromise[_0xfba5('0x25')](_0x39aa6e);}return _0x52f25f[_0xfba5('0x26')]();};}function saveUpdates(_0x311fc5,_0x3626ea){return function(_0x5b3cc2){if(_0x5b3cc2){return _0x5b3cc2[_0xfba5('0x27')](_0x311fc5)[_0xfba5('0x28')](function(_0x4db4d5){return _0x4db4d5;});}return null;};}function removeEntity(_0x4c0e2a,_0xe1256e){return function(_0x22e28a){if(_0x22e28a){return _0x22e28a['destroy']()[_0xfba5('0x28')](function(){_0x4c0e2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2c13,_0x24904a){return function(_0x266a65){if(!_0x266a65){_0x3d2c13[_0xfba5('0x1b')](0x194);}return _0x266a65;};}function handleError(_0x1a2cc3,_0x844797){_0x844797=_0x844797||0x1f4;return function(_0x1420c6){logger[_0xfba5('0x29')](_0x1420c6['stack']);if(_0x1420c6['name']){delete _0x1420c6[_0xfba5('0x2a')];}_0x1a2cc3[_0xfba5('0x1c')](_0x844797)[_0xfba5('0x2b')](_0x1420c6);};}exports['index']=function(_0x4c8309,_0x5616d9){var _0x176383={},_0x2bbffa={},_0x5ca353={'count':0x0,'rows':[]};var _0x54a917=_[_0xfba5('0x2c')](db[_0xfba5('0x2d')]['rawAttributes'],function(_0x2d0b48){return{'name':_0x2d0b48['fieldName'],'type':_0x2d0b48[_0xfba5('0x2e')][_0xfba5('0x2f')]};});_0x2bbffa[_0xfba5('0x30')]=_[_0xfba5('0x2c')](_0x54a917,_0xfba5('0x2a'));_0x2bbffa[_0xfba5('0x31')]=_[_0xfba5('0x32')](_0x4c8309['query']);_0x2bbffa['filters']=_[_0xfba5('0x33')](_0x2bbffa[_0xfba5('0x30')],_0x2bbffa[_0xfba5('0x31')]);_0x176383['attributes']=_[_0xfba5('0x33')](_0x2bbffa[_0xfba5('0x30')],qs['fields'](_0x4c8309[_0xfba5('0x31')]['fields']));_0x176383[_0xfba5('0x34')]=_0x176383[_0xfba5('0x34')][_0xfba5('0x35')]?_0x176383[_0xfba5('0x34')]:_0x2bbffa[_0xfba5('0x30')];if(!_0x4c8309[_0xfba5('0x31')][_0xfba5('0x36')](_0xfba5('0x37'))){_0x176383[_0xfba5('0x1f')]=qs[_0xfba5('0x1f')](_0x4c8309[_0xfba5('0x31')]['limit']);_0x176383[_0xfba5('0x21')]=qs[_0xfba5('0x21')](_0x4c8309[_0xfba5('0x31')][_0xfba5('0x21')]);}_0x176383[_0xfba5('0x38')]=qs[_0xfba5('0x39')](_0x4c8309['query']['sort']);_0x176383[_0xfba5('0x3a')]=qs[_0xfba5('0x3b')](_['pick'](_0x4c8309[_0xfba5('0x31')],_0x2bbffa[_0xfba5('0x3b')]),_0x54a917);if(_0x4c8309[_0xfba5('0x31')][_0xfba5('0x3c')]){_0x176383[_0xfba5('0x3a')]=_[_0xfba5('0x3d')](_0x176383[_0xfba5('0x3a')],{'$or':_[_0xfba5('0x2c')](_0x54a917,function(_0x1ba245){if(_0x1ba245[_0xfba5('0x2e')]!==_0xfba5('0x3e')){var _0x5556c0={};_0x5556c0[_0x1ba245['name']]={'$like':'%'+_0x4c8309[_0xfba5('0x31')]['filter']+'%'};return _0x5556c0;}})});}_0x176383=_[_0xfba5('0x3d')]({},_0x176383,_0x4c8309[_0xfba5('0x3f')]);var _0x3db3e5={'where':_0x176383[_0xfba5('0x3a')]};return db['VoiceQueuesLog']['count'](_0x3db3e5)[_0xfba5('0x28')](function(_0x11067d){_0x5ca353[_0xfba5('0x20')]=_0x11067d;if(_0x4c8309[_0xfba5('0x31')][_0xfba5('0x40')]){_0x176383[_0xfba5('0x41')]=[{'all':!![]}];}return db[_0xfba5('0x2d')]['findAll'](_0x176383);})[_0xfba5('0x28')](function(_0x57b055){_0x5ca353[_0xfba5('0x42')]=_0x57b055;return _0x5ca353;})[_0xfba5('0x28')](respondWithFilteredResult(_0x5616d9,_0x176383))[_0xfba5('0x43')](handleError(_0x5616d9,null));};exports[_0xfba5('0x44')]=function(_0xe08417,_0x21d584){var _0x2d3c32={'raw':!![],'where':{'id':_0xe08417['params']['id']}},_0x8d4b86={};_0x8d4b86[_0xfba5('0x30')]=_[_0xfba5('0x32')](db[_0xfba5('0x2d')][_0xfba5('0x45')]);_0x8d4b86['query']=_[_0xfba5('0x32')](_0xe08417[_0xfba5('0x31')]);_0x8d4b86[_0xfba5('0x3b')]=_[_0xfba5('0x33')](_0x8d4b86['model'],_0x8d4b86[_0xfba5('0x31')]);_0x2d3c32[_0xfba5('0x34')]=_[_0xfba5('0x33')](_0x8d4b86['model'],qs[_0xfba5('0x46')](_0xe08417[_0xfba5('0x31')][_0xfba5('0x46')]));_0x2d3c32[_0xfba5('0x34')]=_0x2d3c32[_0xfba5('0x34')][_0xfba5('0x35')]?_0x2d3c32[_0xfba5('0x34')]:_0x8d4b86['model'];if(_0xe08417[_0xfba5('0x31')][_0xfba5('0x40')]){_0x2d3c32[_0xfba5('0x41')]=[{'all':!![]}];}_0x2d3c32=_[_0xfba5('0x3d')]({},_0x2d3c32,_0xe08417['options']);return db[_0xfba5('0x2d')][_0xfba5('0x47')](_0x2d3c32)['then'](handleEntityNotFound(_0x21d584,null))[_0xfba5('0x28')](respondWithResult(_0x21d584,null))['catch'](handleError(_0x21d584,null));};exports[_0xfba5('0x48')]=function(_0x286a57,_0x4cf94f){return db[_0xfba5('0x2d')]['create'](_0x286a57[_0xfba5('0x49')],{})[_0xfba5('0x28')](respondWithResult(_0x4cf94f,0xc9))['catch'](handleError(_0x4cf94f,null));};exports[_0xfba5('0x27')]=function(_0x16e386,_0x50823c){if(_0x16e386['body']['id']){delete _0x16e386[_0xfba5('0x49')]['id'];}return db['VoiceQueuesLog'][_0xfba5('0x47')]({'where':{'id':_0x16e386[_0xfba5('0x4a')]['id']}})[_0xfba5('0x28')](handleEntityNotFound(_0x50823c,null))[_0xfba5('0x28')](saveUpdates(_0x16e386[_0xfba5('0x49')],null))['then'](respondWithResult(_0x50823c,null))[_0xfba5('0x43')](handleError(_0x50823c,null));};exports[_0xfba5('0x4b')]=function(_0x212124,_0xf2f945){return db[_0xfba5('0x2d')]['find']({'where':{'id':_0x212124[_0xfba5('0x4a')]['id']}})[_0xfba5('0x28')](handleEntityNotFound(_0xf2f945,null))[_0xfba5('0x28')](removeEntity(_0xf2f945,null))[_0xfba5('0x43')](handleError(_0xf2f945,null));}; \ No newline at end of file +var _0x38cd=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','VoiceQueuesLog','findAll','rows','catch','show','params','keys','includeAll','include','create','body','find','eml-format','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','apply','save','update','destroy','then','error','name','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection'];(function(_0x16d9bc,_0x5cc19d){var _0x4fe04a=function(_0x566cd2){while(--_0x566cd2){_0x16d9bc['push'](_0x16d9bc['shift']());}};_0x4fe04a(++_0x5cc19d);}(_0x38cd,0x64));var _0xd38c=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x38cd[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0xd38c('0x0'));var rimraf=require(_0xd38c('0x1'));var zipdir=require(_0xd38c('0x2'));var jsonpatch=require(_0xd38c('0x3'));var rp=require(_0xd38c('0x4'));var moment=require(_0xd38c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd38c('0x6'));var util=require(_0xd38c('0x7'));var path=require(_0xd38c('0x8'));var sox=require(_0xd38c('0x9'));var csv=require(_0xd38c('0xa'));var ejs=require(_0xd38c('0xb'));var fs=require('fs');var fs_extra=require(_0xd38c('0xc'));var _=require(_0xd38c('0xd'));var squel=require(_0xd38c('0xe'));var crypto=require(_0xd38c('0xf'));var jsforce=require(_0xd38c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd38c('0x11'));var Papa=require(_0xd38c('0x12'));var Redis=require(_0xd38c('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd38c('0x14'));var hardwareService=require(_0xd38c('0x15'));var logger=require(_0xd38c('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd38c('0x17'));var db=require(_0xd38c('0x18'))['db'];function respondWithStatusCode(_0x19bf10,_0x48f17f){_0x48f17f=_0x48f17f||0xcc;return function(_0x4c852b){if(_0x4c852b){return _0x19bf10[_0xd38c('0x19')](_0x48f17f);}return _0x19bf10[_0xd38c('0x1a')](_0x48f17f)[_0xd38c('0x1b')]();};}function respondWithResult(_0x92dc0c,_0x364976){_0x364976=_0x364976||0xc8;return function(_0x225cf7){if(_0x225cf7){return _0x92dc0c[_0xd38c('0x1a')](_0x364976)['json'](_0x225cf7);}};}function respondWithFilteredResult(_0x21ae12,_0x1423f8){return function(_0x1d8089){if(_0x1d8089){var _0x216a91=typeof _0x1423f8[_0xd38c('0x1c')]==='undefined'&&typeof _0x1423f8[_0xd38c('0x1d')]===_0xd38c('0x1e');var _0x3607b2=_0x1d8089['count'];var _0xb8627e=_0x216a91?0x0:_0x1423f8['offset'];var _0x3b1295=_0x216a91?_0x1d8089['count']:_0x1423f8[_0xd38c('0x1c')]+_0x1423f8[_0xd38c('0x1d')];var _0x5017fa;if(_0x3b1295>=_0x3607b2){_0x3b1295=_0x3607b2;_0x5017fa=0xc8;}else{_0x5017fa=0xce;}_0x21ae12[_0xd38c('0x1a')](_0x5017fa);return _0x21ae12[_0xd38c('0x1f')](_0xd38c('0x20'),_0xb8627e+'-'+_0x3b1295+'/'+_0x3607b2)[_0xd38c('0x21')](_0x1d8089);}return null;};}function patchUpdates(_0xa456a0){return function(_0x96f6e9){try{jsonpatch[_0xd38c('0x22')](_0x96f6e9,_0xa456a0,!![]);}catch(_0x1e8159){return BPromise['reject'](_0x1e8159);}return _0x96f6e9[_0xd38c('0x23')]();};}function saveUpdates(_0x302af7,_0x5d0297){return function(_0x340b1e){if(_0x340b1e){return _0x340b1e[_0xd38c('0x24')](_0x302af7)['then'](function(_0x42fa83){return _0x42fa83;});}return null;};}function removeEntity(_0x2d8093,_0xca7a28){return function(_0x22a719){if(_0x22a719){return _0x22a719[_0xd38c('0x25')]()[_0xd38c('0x26')](function(){_0x2d8093[_0xd38c('0x1a')](0xcc)[_0xd38c('0x1b')]();});}};}function handleEntityNotFound(_0x5069c9,_0x525448){return function(_0x3786b8){if(!_0x3786b8){_0x5069c9[_0xd38c('0x19')](0x194);}return _0x3786b8;};}function handleError(_0x2ccb40,_0xc57c96){_0xc57c96=_0xc57c96||0x1f4;return function(_0x3c05e2){logger[_0xd38c('0x27')](_0x3c05e2['stack']);if(_0x3c05e2[_0xd38c('0x28')]){delete _0x3c05e2['name'];}_0x2ccb40[_0xd38c('0x1a')](_0xc57c96)['send'](_0x3c05e2);};}exports['index']=function(_0x545049,_0x3b75ba){var _0x8de9c={},_0x38a64a={},_0x56b521={'count':0x0,'rows':[]};var _0x3c69ef=_[_0xd38c('0x29')](db['VoiceQueuesLog'][_0xd38c('0x2a')],function(_0xddc8d){return{'name':_0xddc8d[_0xd38c('0x2b')],'type':_0xddc8d[_0xd38c('0x2c')]['key']};});_0x38a64a[_0xd38c('0x2d')]=_[_0xd38c('0x29')](_0x3c69ef,'name');_0x38a64a['query']=_['keys'](_0x545049[_0xd38c('0x2e')]);_0x38a64a[_0xd38c('0x2f')]=_['intersection'](_0x38a64a[_0xd38c('0x2d')],_0x38a64a[_0xd38c('0x2e')]);_0x8de9c[_0xd38c('0x30')]=_[_0xd38c('0x31')](_0x38a64a[_0xd38c('0x2d')],qs[_0xd38c('0x32')](_0x545049[_0xd38c('0x2e')]['fields']));_0x8de9c[_0xd38c('0x30')]=_0x8de9c[_0xd38c('0x30')][_0xd38c('0x33')]?_0x8de9c['attributes']:_0x38a64a[_0xd38c('0x2d')];if(!_0x545049[_0xd38c('0x2e')][_0xd38c('0x34')](_0xd38c('0x35'))){_0x8de9c[_0xd38c('0x1d')]=qs['limit'](_0x545049[_0xd38c('0x2e')][_0xd38c('0x1d')]);_0x8de9c[_0xd38c('0x1c')]=qs[_0xd38c('0x1c')](_0x545049['query'][_0xd38c('0x1c')]);}_0x8de9c[_0xd38c('0x36')]=qs[_0xd38c('0x37')](_0x545049[_0xd38c('0x2e')]['sort']);_0x8de9c['where']=qs[_0xd38c('0x2f')](_[_0xd38c('0x38')](_0x545049[_0xd38c('0x2e')],_0x38a64a[_0xd38c('0x2f')]),_0x3c69ef);if(_0x545049['query'][_0xd38c('0x39')]){_0x8de9c[_0xd38c('0x3a')]=_[_0xd38c('0x3b')](_0x8de9c[_0xd38c('0x3a')],{'$or':_[_0xd38c('0x29')](_0x3c69ef,function(_0xa88d8){if(_0xa88d8[_0xd38c('0x2c')]!==_0xd38c('0x3c')){var _0xcbbe47={};_0xcbbe47[_0xa88d8[_0xd38c('0x28')]]={'$like':'%'+_0x545049[_0xd38c('0x2e')][_0xd38c('0x39')]+'%'};return _0xcbbe47;}})});}_0x8de9c=_[_0xd38c('0x3b')]({},_0x8de9c,_0x545049[_0xd38c('0x3d')]);var _0x537152={'where':_0x8de9c[_0xd38c('0x3a')]};return db['VoiceQueuesLog']['count'](_0x537152)['then'](function(_0x2ea010){_0x56b521[_0xd38c('0x3e')]=_0x2ea010;if(_0x545049[_0xd38c('0x2e')]['includeAll']){_0x8de9c['include']=[{'all':!![]}];}return db[_0xd38c('0x3f')][_0xd38c('0x40')](_0x8de9c);})[_0xd38c('0x26')](function(_0x2f4140){_0x56b521[_0xd38c('0x41')]=_0x2f4140;return _0x56b521;})['then'](respondWithFilteredResult(_0x3b75ba,_0x8de9c))[_0xd38c('0x42')](handleError(_0x3b75ba,null));};exports[_0xd38c('0x43')]=function(_0x59030b,_0x4539c6){var _0x23d953={'raw':!![],'where':{'id':_0x59030b[_0xd38c('0x44')]['id']}},_0x9b1d67={};_0x9b1d67[_0xd38c('0x2d')]=_[_0xd38c('0x45')](db['VoiceQueuesLog']['rawAttributes']);_0x9b1d67[_0xd38c('0x2e')]=_[_0xd38c('0x45')](_0x59030b[_0xd38c('0x2e')]);_0x9b1d67[_0xd38c('0x2f')]=_[_0xd38c('0x31')](_0x9b1d67[_0xd38c('0x2d')],_0x9b1d67[_0xd38c('0x2e')]);_0x23d953['attributes']=_[_0xd38c('0x31')](_0x9b1d67[_0xd38c('0x2d')],qs[_0xd38c('0x32')](_0x59030b[_0xd38c('0x2e')]['fields']));_0x23d953['attributes']=_0x23d953[_0xd38c('0x30')][_0xd38c('0x33')]?_0x23d953[_0xd38c('0x30')]:_0x9b1d67[_0xd38c('0x2d')];if(_0x59030b['query'][_0xd38c('0x46')]){_0x23d953[_0xd38c('0x47')]=[{'all':!![]}];}_0x23d953=_[_0xd38c('0x3b')]({},_0x23d953,_0x59030b[_0xd38c('0x3d')]);return db['VoiceQueuesLog']['find'](_0x23d953)[_0xd38c('0x26')](handleEntityNotFound(_0x4539c6,null))[_0xd38c('0x26')](respondWithResult(_0x4539c6,null))[_0xd38c('0x42')](handleError(_0x4539c6,null));};exports[_0xd38c('0x48')]=function(_0x35335f,_0x55c53e){return db[_0xd38c('0x3f')]['create'](_0x35335f[_0xd38c('0x49')],{})[_0xd38c('0x26')](respondWithResult(_0x55c53e,0xc9))[_0xd38c('0x42')](handleError(_0x55c53e,null));};exports['update']=function(_0x1b9ea7,_0x36fb2b){if(_0x1b9ea7[_0xd38c('0x49')]['id']){delete _0x1b9ea7[_0xd38c('0x49')]['id'];}return db[_0xd38c('0x3f')][_0xd38c('0x4a')]({'where':{'id':_0x1b9ea7[_0xd38c('0x44')]['id']}})[_0xd38c('0x26')](handleEntityNotFound(_0x36fb2b,null))[_0xd38c('0x26')](saveUpdates(_0x1b9ea7[_0xd38c('0x49')],null))[_0xd38c('0x26')](respondWithResult(_0x36fb2b,null))[_0xd38c('0x42')](handleError(_0x36fb2b,null));};exports[_0xd38c('0x25')]=function(_0x528acb,_0x30a6b9){return db[_0xd38c('0x3f')][_0xd38c('0x4a')]({'where':{'id':_0x528acb[_0xd38c('0x44')]['id']}})['then'](handleEntityNotFound(_0x30a6b9,null))['then'](removeEntity(_0x30a6b9,null))[_0xd38c('0x42')](handleError(_0x30a6b9,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ae13191..d37948b 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 _0x292b=['event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceQueuesLog'];(function(_0x242305,_0x1d1da9){var _0x7d03df=function(_0x5948c3){while(--_0x5948c3){_0x242305['push'](_0x242305['shift']());}};_0x7d03df(++_0x1d1da9);}(_0x292b,0x64));var _0xb292=function(_0x2e1b41,_0x17914a){_0x2e1b41=_0x2e1b41-0x0;var _0x163368=_0x292b[_0x2e1b41];return _0x163368;};'use strict';var _=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var logger=require(_0xb292('0x2'))(_0xb292('0x3'));var moment=require(_0xb292('0x4'));var BPromise=require(_0xb292('0x5'));var rp=require(_0xb292('0x6'));var fs=require('fs');var path=require(_0xb292('0x7'));var rimraf=require(_0xb292('0x8'));var config=require(_0xb292('0x9'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x4d2ef0,_0x13ffef){return _0x4d2ef0[_0xb292('0xa')](_0xb292('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xb292('0xc'),'fields':[_0xb292('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x42a1=['dtm','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','voice_queues_log','event_dtm'];(function(_0xffd8b0,_0x12c51f){var _0x301ba0=function(_0x103c05){while(--_0x103c05){_0xffd8b0['push'](_0xffd8b0['shift']());}};_0x301ba0(++_0x12c51f);}(_0x42a1,0x153));var _0x142a=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x42a1[_0x9729d7];return _0x3c4ac6;};'use strict';var _=require(_0x142a('0x0'));var util=require(_0x142a('0x1'));var logger=require(_0x142a('0x2'))(_0x142a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x142a('0x4'));var fs=require('fs');var path=require(_0x142a('0x5'));var rimraf=require(_0x142a('0x6'));var config=require(_0x142a('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x142a('0x8')]=function(_0x4788ed,_0x2119c9){return _0x4788ed[_0x142a('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x142a('0xa'),'paranoid':![],'indexes':[{'name':_0x142a('0xb'),'fields':['event',_0x142a('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5d8fa13..6e108db 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 _0x054f=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x054f,0x1a6));var _0xf054=function(_0x435a45,_0x7ce845){_0x435a45=_0x435a45-0x0;var _0x3b2f11=_0x054f[_0x435a45];return _0x3b2f11;};'use strict';var _=require(_0xf054('0x0'));var util=require(_0xf054('0x1'));var moment=require(_0xf054('0x2'));var BPromise=require(_0xf054('0x3'));var rs=require(_0xf054('0x4'));var fs=require('fs');var Redis=require(_0xf054('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf054('0x6'));var logger=require(_0xf054('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf054('0x8'));var client=jayson['client'][_0xf054('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x113205,_0x5a9681,_0x2e8bb8){return new BPromise(function(_0x155c76,_0x13d111){return client[_0xf054('0xa')](_0x113205,_0x2e8bb8)[_0xf054('0xb')](function(_0xfb30a9){logger[_0xf054('0xc')](_0xf054('0xd'),_0x5a9681,_0xf054('0xe'));logger[_0xf054('0xf')](_0xf054('0x10'),_0x5a9681,_0xf054('0xe'),JSON[_0xf054('0x11')](_0xfb30a9));if(_0xfb30a9[_0xf054('0x12')]){if(_0xfb30a9[_0xf054('0x12')]['code']===0x1f4){logger[_0xf054('0x12')](_0xf054('0xd'),_0x5a9681,_0xfb30a9[_0xf054('0x12')][_0xf054('0x13')]);return _0x13d111(_0xfb30a9[_0xf054('0x12')][_0xf054('0x13')]);}logger['error'](_0xf054('0xd'),_0x5a9681,_0xfb30a9[_0xf054('0x12')][_0xf054('0x13')]);return _0x155c76(_0xfb30a9[_0xf054('0x12')]['message']);}else{logger[_0xf054('0xc')](_0xf054('0xd'),_0x5a9681,_0xf054('0xe'));_0x155c76(_0xfb30a9['result'][_0xf054('0x13')]);}})[_0xf054('0x14')](function(_0x47f87c){logger['error'](_0xf054('0xd'),_0x5a9681,_0x47f87c);_0x13d111(_0x47f87c);});});} \ No newline at end of file +var _0xac92=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment'];(function(_0xaefb1b,_0x3e468d){var _0x5caefd=function(_0x374140){while(--_0x374140){_0xaefb1b['push'](_0xaefb1b['shift']());}};_0x5caefd(++_0x3e468d);}(_0xac92,0x7b));var _0x2ac9=function(_0x10c822,_0x34f02d){_0x10c822=_0x10c822-0x0;var _0x1eead8=_0xac92[_0x10c822];return _0x1eead8;};'use strict';var _=require(_0x2ac9('0x0'));var util=require(_0x2ac9('0x1'));var moment=require(_0x2ac9('0x2'));var BPromise=require(_0x2ac9('0x3'));var rs=require(_0x2ac9('0x4'));var fs=require('fs');var Redis=require(_0x2ac9('0x5'));var db=require(_0x2ac9('0x6'))['db'];var utils=require(_0x2ac9('0x7'));var logger=require('../../config/logger')(_0x2ac9('0x8'));var config=require(_0x2ac9('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14108f,_0x2246d9,_0x177a22){return new BPromise(function(_0x24edb4,_0x26f9c8){return client[_0x2ac9('0xa')](_0x14108f,_0x177a22)[_0x2ac9('0xb')](function(_0x4dfc91){logger[_0x2ac9('0xc')](_0x2ac9('0xd'),_0x2246d9,_0x2ac9('0xe'));logger[_0x2ac9('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2246d9,'request\x20sent',JSON[_0x2ac9('0x10')](_0x4dfc91));if(_0x4dfc91['error']){if(_0x4dfc91[_0x2ac9('0x11')][_0x2ac9('0x12')]===0x1f4){logger[_0x2ac9('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2246d9,_0x4dfc91[_0x2ac9('0x11')][_0x2ac9('0x13')]);return _0x26f9c8(_0x4dfc91[_0x2ac9('0x11')]['message']);}logger[_0x2ac9('0x11')](_0x2ac9('0xd'),_0x2246d9,_0x4dfc91[_0x2ac9('0x11')][_0x2ac9('0x13')]);return _0x24edb4(_0x4dfc91[_0x2ac9('0x11')]['message']);}else{logger[_0x2ac9('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2246d9,_0x2ac9('0xe'));_0x24edb4(_0x4dfc91[_0x2ac9('0x14')][_0x2ac9('0x13')]);}})['catch'](function(_0x22d971){logger[_0x2ac9('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2246d9,_0x22d971);_0x26f9c8(_0x22d971);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 58c3454..8f6a0ef 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 _0xa061=['isAuthenticated','index','/describe','describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa061,0xd8));var _0x1a06=function(_0x3fd203,_0x2f78ab){_0x3fd203=_0x3fd203-0x0;var _0x5e6d58=_0xa061[_0x3fd203];return _0x5e6d58;};'use strict';var multer=require('multer');var util=require(_0x1a06('0x0'));var path=require(_0x1a06('0x1'));var timeout=require(_0x1a06('0x2'));var express=require('express');var router=express[_0x1a06('0x3')]();var fs_extra=require(_0x1a06('0x4'));var auth=require(_0x1a06('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a06('0x6'));var controller=require(_0x1a06('0x7'));router[_0x1a06('0x8')]('/',auth[_0x1a06('0x9')](),controller[_0x1a06('0xa')]);router['get'](_0x1a06('0xb'),auth[_0x1a06('0x9')](),controller[_0x1a06('0xc')]);router['get'](_0x1a06('0xd'),auth[_0x1a06('0x9')](),controller['show']);router[_0x1a06('0x8')](_0x1a06('0xe'),auth[_0x1a06('0x9')](),controller[_0x1a06('0xf')]);router[_0x1a06('0x8')](_0x1a06('0x10'),controller['downloads']);router[_0x1a06('0x8')](_0x1a06('0x11'),auth[_0x1a06('0x9')](),controller['downloadTranscribe']);router[_0x1a06('0x12')]('/',auth[_0x1a06('0x9')](),controller[_0x1a06('0x13')]);router[_0x1a06('0x12')](_0x1a06('0x11'),auth[_0x1a06('0x9')](),controller['runTranscribe']);router[_0x1a06('0x14')](_0x1a06('0xd'),auth[_0x1a06('0x9')](),controller[_0x1a06('0x15')]);router[_0x1a06('0x16')]('/:id',auth[_0x1a06('0x9')](),controller[_0x1a06('0x17')]);module[_0x1a06('0x18')]=router; \ No newline at end of file +var _0xb31a=['/:id/transcribe','downloadTranscribe','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','downloads'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb31a,0x1cb));var _0xab31=function(_0x599760,_0x2155ff){_0x599760=_0x599760-0x0;var _0x437eed=_0xb31a[_0x599760];return _0x437eed;};'use strict';var multer=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var path=require('path');var timeout=require(_0xab31('0x2'));var express=require(_0xab31('0x3'));var router=express[_0xab31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xab31('0x5'));var interaction=require(_0xab31('0x6'));var config=require('../../config/environment');var controller=require(_0xab31('0x7'));router[_0xab31('0x8')]('/',auth[_0xab31('0x9')](),controller[_0xab31('0xa')]);router['get'](_0xab31('0xb'),auth[_0xab31('0x9')](),controller['describe']);router[_0xab31('0x8')](_0xab31('0xc'),auth[_0xab31('0x9')](),controller[_0xab31('0xd')]);router[_0xab31('0x8')]('/:id/download',auth[_0xab31('0x9')](),controller[_0xab31('0xe')]);router[_0xab31('0x8')]('/:id/downloads',controller[_0xab31('0xf')]);router[_0xab31('0x8')](_0xab31('0x10'),auth['isAuthenticated'](),controller[_0xab31('0x11')]);router[_0xab31('0x12')]('/',auth[_0xab31('0x9')](),controller[_0xab31('0x13')]);router[_0xab31('0x12')](_0xab31('0x10'),auth[_0xab31('0x9')](),controller['runTranscribe']);router[_0xab31('0x14')](_0xab31('0xc'),auth[_0xab31('0x9')](),controller[_0xab31('0x15')]);router[_0xab31('0x16')](_0xab31('0xc'),auth[_0xab31('0x9')](),controller[_0xab31('0x17')]);module[_0xab31('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 35d0638..39970a1 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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 aeb9875..f922695 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 _0x5ed9=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','VIRTUAL','merge','options','VoiceRecording','includeAll','include','findAll','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','Not\x20found','sequelize','col','token','$and','push','secrets','recording','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribeAccountId','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x161c31,_0x39936c){var _0x23821b=function(_0x37f33d){while(--_0x37f33d){_0x161c31['push'](_0x161c31['shift']());}};_0x23821b(++_0x39936c);}(_0x5ed9,0x83));var _0x95ed=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5ed9[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x95ed('0x0'));var rimraf=require(_0x95ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x95ed('0x2'));var moment=require('moment');var BPromise=require(_0x95ed('0x3'));var Mustache=require(_0x95ed('0x4'));var util=require('util');var path=require(_0x95ed('0x5'));var sox=require(_0x95ed('0x6'));var csv=require(_0x95ed('0x7'));var ejs=require(_0x95ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95ed('0x9'));var squel=require(_0x95ed('0xa'));var crypto=require(_0x95ed('0xb'));var jsforce=require(_0x95ed('0xc'));var deskjs=require(_0x95ed('0xd'));var toCsv=require(_0x95ed('0x7'));var querystring=require(_0x95ed('0xe'));var Papa=require(_0x95ed('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x95ed('0x10'));var Redis=require(_0x95ed('0x11'));var authService=require(_0x95ed('0x12'));var qs=require(_0x95ed('0x13'));var as=require(_0x95ed('0x14'));var hardwareService=require(_0x95ed('0x15'));var logger=require(_0x95ed('0x16'))(_0x95ed('0x17'));var utils=require(_0x95ed('0x18'));var config=require(_0x95ed('0x19'));var licenseUtil=require(_0x95ed('0x1a'));var db=require(_0x95ed('0x1b'))['db'];function respondWithStatusCode(_0x104333,_0x52cf62){_0x52cf62=_0x52cf62||0xcc;return function(_0x37c92a){if(_0x37c92a){return _0x104333['sendStatus'](_0x52cf62);}return _0x104333[_0x95ed('0x1c')](_0x52cf62)[_0x95ed('0x1d')]();};}function respondWithResult(_0x1f2bb3,_0x2dfd50){_0x2dfd50=_0x2dfd50||0xc8;return function(_0x17d455){if(_0x17d455){return _0x1f2bb3['status'](_0x2dfd50)[_0x95ed('0x1e')](_0x17d455);}};}function respondWithFilteredResult(_0x9a6f8f,_0x12ad03){return function(_0x13657e){if(_0x13657e){var _0x5beb62=typeof _0x12ad03[_0x95ed('0x1f')]===_0x95ed('0x20')&&typeof _0x12ad03[_0x95ed('0x21')]===_0x95ed('0x20');var _0x185b47=_0x13657e[_0x95ed('0x22')];var _0x2b4c07=_0x5beb62?0x0:_0x12ad03[_0x95ed('0x1f')];var _0xdfd7cd=_0x5beb62?_0x13657e[_0x95ed('0x22')]:_0x12ad03['offset']+_0x12ad03['limit'];var _0x2a2680;if(_0xdfd7cd>=_0x185b47){_0xdfd7cd=_0x185b47;_0x2a2680=0xc8;}else{_0x2a2680=0xce;}_0x9a6f8f[_0x95ed('0x1c')](_0x2a2680);return _0x9a6f8f[_0x95ed('0x23')](_0x95ed('0x24'),_0x2b4c07+'-'+_0xdfd7cd+'/'+_0x185b47)[_0x95ed('0x1e')](_0x13657e);}return null;};}function patchUpdates(_0x48c295){return function(_0x4bf507){try{jsonpatch[_0x95ed('0x25')](_0x4bf507,_0x48c295,!![]);}catch(_0x18e897){return BPromise[_0x95ed('0x26')](_0x18e897);}return _0x4bf507[_0x95ed('0x27')]();};}function saveUpdates(_0x2cd31e,_0x3daa2c){return function(_0x582b29){if(_0x582b29){return _0x582b29[_0x95ed('0x28')](_0x2cd31e)[_0x95ed('0x29')](function(_0x4fa9bb){return _0x4fa9bb;});}return null;};}function removeEntity(_0x1730c1,_0x5bf759){return function(_0x2d5026){if(_0x2d5026){return _0x2d5026[_0x95ed('0x2a')]()[_0x95ed('0x29')](function(){_0x1730c1[_0x95ed('0x1c')](0xcc)[_0x95ed('0x1d')]();});}};}function handleEntityNotFound(_0x4667ac,_0x2d8eeb){return function(_0x33c4fe){if(!_0x33c4fe){_0x4667ac[_0x95ed('0x2b')](0x194);}return _0x33c4fe;};}function handleError(_0x5981c4,_0x3de912){_0x3de912=_0x3de912||0x1f4;return function(_0x3b0c6e){logger[_0x95ed('0x2c')](_0x3b0c6e[_0x95ed('0x2d')]);if(_0x3b0c6e[_0x95ed('0x2e')]){delete _0x3b0c6e[_0x95ed('0x2e')];}_0x5981c4[_0x95ed('0x1c')](_0x3de912)[_0x95ed('0x2f')](_0x3b0c6e);};}exports['index']=function(_0xd39d4e,_0x396118){var _0x4dfe09={},_0x25af99={},_0x4dafec={'count':0x0,'rows':[]};var _0x1b00d4=_['map'](db['VoiceRecording'][_0x95ed('0x30')],function(_0x2e064a){return{'name':_0x2e064a[_0x95ed('0x31')],'type':_0x2e064a[_0x95ed('0x32')][_0x95ed('0x33')]};});_0x25af99[_0x95ed('0x34')]=_[_0x95ed('0x35')](_['map'](_0x1b00d4,_0x95ed('0x2e')),[_0x95ed('0x36')]);_0x25af99[_0x95ed('0x37')]=_[_0x95ed('0x38')](_0xd39d4e[_0x95ed('0x37')]);_0x25af99['filters']=_[_0x95ed('0x39')](_0x25af99[_0x95ed('0x34')],_0x25af99[_0x95ed('0x37')]);_0x4dfe09[_0x95ed('0x3a')]=_['intersection'](_0x25af99['model'],qs[_0x95ed('0x3b')](_0xd39d4e[_0x95ed('0x37')][_0x95ed('0x3b')]));_0x4dfe09[_0x95ed('0x3a')]=_0x4dfe09['attributes'][_0x95ed('0x3c')]?_0x4dfe09[_0x95ed('0x3a')]:_0x25af99[_0x95ed('0x34')];if(!_0xd39d4e[_0x95ed('0x37')][_0x95ed('0x3d')]('nolimit')){_0x4dfe09[_0x95ed('0x21')]=qs['limit'](_0xd39d4e[_0x95ed('0x37')][_0x95ed('0x21')]);_0x4dfe09[_0x95ed('0x1f')]=qs[_0x95ed('0x1f')](_0xd39d4e[_0x95ed('0x37')][_0x95ed('0x1f')]);}_0x4dfe09[_0x95ed('0x3e')]=qs[_0x95ed('0x3f')](_0xd39d4e[_0x95ed('0x37')]['sort']);_0x4dfe09[_0x95ed('0x40')]=qs['filters'](_[_0x95ed('0x41')](_0xd39d4e[_0x95ed('0x37')],_0x25af99[_0x95ed('0x42')]),_0x1b00d4);if(_0xd39d4e['query']['filter']){_0x4dfe09['where']=_['merge'](_0x4dfe09['where'],{'$or':_['map'](_0x1b00d4,function(_0x5802a1){if(_0x5802a1['type']!==_0x95ed('0x43')){var _0x2aaa9a={};_0x2aaa9a[_0x5802a1[_0x95ed('0x2e')]]={'$like':'%'+_0xd39d4e[_0x95ed('0x37')]['filter']+'%'};return _0x2aaa9a;}})});}_0x4dfe09=_[_0x95ed('0x44')]({},_0x4dfe09,_0xd39d4e[_0x95ed('0x45')]);var _0x21fbce={'where':_0x4dfe09[_0x95ed('0x40')]};return db[_0x95ed('0x46')][_0x95ed('0x22')](_0x21fbce)[_0x95ed('0x29')](function(_0x5272c3){_0x4dafec[_0x95ed('0x22')]=_0x5272c3;if(_0xd39d4e[_0x95ed('0x37')][_0x95ed('0x47')]){_0x4dfe09[_0x95ed('0x48')]=[{'all':!![]}];}return db[_0x95ed('0x46')][_0x95ed('0x49')](_0x4dfe09);})[_0x95ed('0x29')](function(_0x302aef){_0x4dafec['rows']=_0x302aef;return _0x4dafec;})[_0x95ed('0x29')](respondWithFilteredResult(_0x396118,_0x4dfe09))[_0x95ed('0x4a')](handleError(_0x396118,null));};exports[_0x95ed('0x4b')]=function(_0x16928a,_0x506ac3){var _0x20cb70={'raw':![],'where':{'id':_0x16928a[_0x95ed('0x4c')]['id']}},_0x33f462={};_0x33f462['model']=_['keys'](db['VoiceRecording'][_0x95ed('0x30')]);_0x33f462[_0x95ed('0x37')]=_[_0x95ed('0x38')](_0x16928a[_0x95ed('0x37')]);_0x33f462[_0x95ed('0x42')]=_[_0x95ed('0x39')](_0x33f462['model'],_0x33f462[_0x95ed('0x37')]);_0x20cb70[_0x95ed('0x3a')]=_[_0x95ed('0x39')](_0x33f462['model'],qs['fields'](_0x16928a[_0x95ed('0x37')][_0x95ed('0x3b')]));_0x20cb70[_0x95ed('0x3a')]=_0x20cb70[_0x95ed('0x3a')]['length']?_0x20cb70[_0x95ed('0x3a')]:_0x33f462[_0x95ed('0x34')];if(_0x16928a[_0x95ed('0x37')][_0x95ed('0x47')]){_0x20cb70[_0x95ed('0x48')]=[{'all':!![]}];}_0x20cb70=_['merge']({},_0x20cb70,_0x16928a[_0x95ed('0x45')]);return db[_0x95ed('0x46')][_0x95ed('0x4d')](_0x20cb70)[_0x95ed('0x29')](handleEntityNotFound(_0x506ac3,null))['then'](respondWithResult(_0x506ac3,null))['catch'](handleError(_0x506ac3,null));};exports[_0x95ed('0x4e')]=function(_0x2d3cdc,_0x560910){return db[_0x95ed('0x46')][_0x95ed('0x4e')](_0x2d3cdc[_0x95ed('0x4f')],{})[_0x95ed('0x29')](respondWithResult(_0x560910,0xc9))['catch'](handleError(_0x560910,null));};exports[_0x95ed('0x28')]=function(_0x4f7950,_0x597a38){if(_0x4f7950[_0x95ed('0x4f')]['id']){delete _0x4f7950[_0x95ed('0x4f')]['id'];}return db['VoiceRecording'][_0x95ed('0x4d')]({'where':{'id':_0x4f7950[_0x95ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x597a38,null))['then'](saveUpdates(_0x4f7950[_0x95ed('0x4f')],null))[_0x95ed('0x29')](respondWithResult(_0x597a38,null))[_0x95ed('0x4a')](handleError(_0x597a38,null));};exports[_0x95ed('0x50')]=function(_0x2da0a8,_0xdc2e20){return db[_0x95ed('0x46')][_0x95ed('0x50')]()[_0x95ed('0x29')](respondWithResult(_0xdc2e20,null))[_0x95ed('0x4a')](handleError(_0xdc2e20,null));};exports[_0x95ed('0x51')]=function(_0x37c788,_0x4c709d,_0x10cdb0){var _0xbbbdde=require(_0x95ed('0x52'));var _0x5c692f=![];var _0x28821d={};if(_0x37c788['query'][_0x95ed('0x32')]&&_0x37c788[_0x95ed('0x37')][_0x95ed('0x32')]===_0x95ed('0x53')){_0x28821d[_0x95ed('0x53')]=_0x37c788[_0x95ed('0x4c')]['id'];}else{_0x28821d['id']=_0x37c788['params']['id'];}return db[_0x95ed('0x46')][_0x95ed('0x4d')]({'where':_0x28821d,'attributes':['id',_0x95ed('0x54')],'raw':!![]})[_0x95ed('0x29')](handleEntityNotFound(_0x4c709d,null))[_0x95ed('0x29')](function(_0x4f4f29){if(_0x4f4f29){var _0x152a28=_0x4f4f29[_0x95ed('0x54')];var _0x1a9a76=util[_0x95ed('0x36')](_0x95ed('0x55'),_0x152a28);if(fs[_0x95ed('0x56')](_0x1a9a76)){_0x5c692f=!![];return _0xbbbdde[_0x95ed('0x57')](_0x1a9a76,_0x152a28,config['secrets']['recording'])[_0x95ed('0x29')](function(){return _0x4f4f29;});}return _0x4f4f29;}})[_0x95ed('0x29')](function(_0x68d5dc){if(_0x68d5dc){var _0x24b98e=_0x68d5dc[_0x95ed('0x54')];if(!fs['existsSync'](_0x24b98e)){throw new db[(_0x95ed('0x58'))][(_0x95ed('0x59'))](_0x95ed('0x5a'));}if(_0x68d5dc[_0x95ed('0x5b')]){return _0x4c709d['download'](_0x24b98e,_0x68d5dc[_0x95ed('0x5b')]+path[_0x95ed('0x5c')](_0x24b98e),function(){if(_0x5c692f){fs['unlink'](_0x24b98e);}});}else{return _0x4c709d[_0x95ed('0x51')](_0x24b98e,function(_0x2d50aa){if(_0x5c692f){fs['unlink'](_0x24b98e);}});}}})[_0x95ed('0x4a')](function(_0x4d5200){if(_0x4d5200['message']==='VoiceRecording\x20not\x20found'){_0x4c709d[_0x95ed('0x1c')](0x194)[_0x95ed('0x2f')](_0x95ed('0x5d'));}else{return handleError(_0x4c709d,null);}});};exports['downloads']=function(_0x5e1d95,_0x287528,_0x1ac7a3){var _0x5d51d=require(_0x95ed('0x52'));var _0xad0e08=![];var _0x24911f={'$and':[db[_0x95ed('0x5e')][_0x95ed('0x40')](db['sequelize']['fn']('MD5',db['sequelize'][_0x95ed('0x5f')](_0x95ed('0x53'))),_0x5e1d95['query'][_0x95ed('0x60')])]};if(_0x5e1d95[_0x95ed('0x37')][_0x95ed('0x32')]&&_0x5e1d95[_0x95ed('0x37')][_0x95ed('0x32')]===_0x95ed('0x53')){_0x24911f[_0x95ed('0x61')][_0x95ed('0x62')]({'uniqueid':_0x5e1d95[_0x95ed('0x4c')]['id']});}else{_0x24911f[_0x95ed('0x61')][_0x95ed('0x62')]({'id':_0x5e1d95[_0x95ed('0x4c')]['id']});}return db[_0x95ed('0x46')][_0x95ed('0x4d')]({'where':_0x24911f,'attributes':['id',_0x95ed('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x287528,null))[_0x95ed('0x29')](function(_0x4e0586){if(_0x4e0586){var _0x2cc1f5=util['format'](_0x95ed('0x55'),_0x4e0586[_0x95ed('0x54')]);if(fs[_0x95ed('0x56')](_0x2cc1f5)){_0xad0e08=!![];return _0x5d51d[_0x95ed('0x57')](_0x2cc1f5,_0x4e0586[_0x95ed('0x54')],config[_0x95ed('0x63')][_0x95ed('0x64')])['then'](function(){return _0x4e0586;});}return _0x4e0586;}})[_0x95ed('0x29')](function(_0x118a0a){if(_0x118a0a){if(!fs['existsSync'](_0x118a0a[_0x95ed('0x54')])){throw new db[(_0x95ed('0x58'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x118a0a[_0x95ed('0x5b')]){return _0x287528[_0x95ed('0x51')](_0x118a0a['value'],_0x118a0a['filename']+path[_0x95ed('0x5c')](_0x118a0a['value']),function(){if(_0xad0e08){fs[_0x95ed('0x65')](_0x118a0a[_0x95ed('0x54')]);}});}else{return _0x287528[_0x95ed('0x51')](_0x118a0a[_0x95ed('0x54')],function(_0xfb9f37){if(_0xad0e08){fs[_0x95ed('0x65')](_0x118a0a[_0x95ed('0x54')]);}});}}})[_0x95ed('0x4a')](handleError(_0x287528,null));};exports[_0x95ed('0x2a')]=function(_0x1a5aef,_0x1c5bd6){return db[_0x95ed('0x46')][_0x95ed('0x4d')]({'where':{'id':_0x1a5aef[_0x95ed('0x4c')]['id']}})[_0x95ed('0x29')](function(_0x1dac14){if(_[_0x95ed('0x66')](_0x1dac14)){throw new ReferenceError(_0x95ed('0x67'));}return _0x1dac14;})['then'](function(_0x407f58){var _0x3fd382=_0x407f58[_0x95ed('0x54')];logger[_0x95ed('0x68')](_0x95ed('0x69'),_0x3fd382);if(!_[_0x95ed('0x66')](_0x407f58[_0x95ed('0x54')])&&fs['existsSync'](_0x3fd382)){logger['info'](_0x95ed('0x6a')+_0x3fd382+_0x95ed('0x6b'));fs['unlinkSync'](_0x3fd382);}_0x3fd382=_0x3fd382+_0x95ed('0x6c');if(!_[_0x95ed('0x66')](_0x407f58[_0x95ed('0x54')])&&fs[_0x95ed('0x56')](_0x3fd382)){logger[_0x95ed('0x68')](_0x95ed('0x6a')+_0x3fd382+_0x95ed('0x6b'));fs[_0x95ed('0x6d')](_0x3fd382);}return _0x407f58;})[_0x95ed('0x29')](function(_0x48695f){if(!_0x48695f)throw new InternalError();return _0x48695f[_0x95ed('0x2a')]();})[_0x95ed('0x29')](function(){_0x1c5bd6[_0x95ed('0x1c')](0xcc)['end']();})[_0x95ed('0x4a')](handleError(_0x1c5bd6,null));};function getBucketslist(_0x30ef2a,_0x57521e,_0x12091d){return new Promise(function(_0x58261c,_0x3862b7){var _0x537d0a=new AWS['S3']({'accessKeyId':_0x57521e,'secretAccessKey':_0x30ef2a,'region':_0x12091d});_0x537d0a[_0x95ed('0x6e')]({},function(_0x608e18,_0x493f59){if(_0x608e18){return _0x3862b7(_0x608e18);}else{return _0x58261c(_0x493f59);}});});}function createBucket(_0x442b93,_0x2f7937,_0x388e4a,_0x323a24){return new Promise(function(_0x21c0bd,_0x212e40){var _0xf57e6e=new AWS['S3']({'accessKeyId':_0x2f7937,'secretAccessKey':_0x442b93,'region':_0x388e4a});_0xf57e6e[_0x95ed('0x6f')]({'Bucket':_0x323a24},function(_0x4ea517,_0xf4aa50){if(_0x4ea517){return _0x212e40(_0x4ea517);}else{return _0x21c0bd(_0xf4aa50);}});});}function uploadFile(_0x32e6b5,_0x32868a,_0x22a028,_0x5808b1,_0xec6a2,_0x456fc3){return new Promise(function(_0x38aa79,_0x332893){var _0x2aabb2=new AWS['S3']({'accessKeyId':_0x32868a,'secretAccessKey':_0x32e6b5,'region':_0x22a028});_0x2aabb2[_0x95ed('0x70')]({'Bucket':_0x5808b1,'Key':_0xec6a2,'Body':_0x456fc3},function(_0x21febd,_0x3ab644){if(_0x21febd){return _0x332893(_0x21febd);}else{return _0x38aa79(_0x3ab644);}});});}function startTranscribe(_0x581647,_0x405676,_0x11fd76,_0x12a4ff,_0x3586b6,_0x3e511c){return new Promise(function(_0x2f0537,_0x3259a5){var _0x4fbd72=new AWS[(_0x95ed('0x71'))]({'accessKeyId':_0x405676,'secretAccessKey':_0x581647,'region':_0x11fd76});_0x4fbd72[_0x95ed('0x72')]({'TranscriptionJobName':_0x12a4ff,'LanguageCode':_0x3586b6,'Media':{'MediaFileUri':_0x3e511c}},function(_0x170f22,_0x144a0b){if(_0x170f22){return _0x3259a5(_0x170f22);}else{return _0x2f0537(_0x144a0b);}});});}function transcribe(_0x118a31,_0x44cfd0,_0x4e6cf2,_0x51e28b,_0x3c778b,_0x43c5da,_0x58b057){return new Promise(function(_0x318f7e,_0x35d188){var _0x556787={};logger[_0x95ed('0x68')](util[_0x95ed('0x36')](_0x95ed('0x73'),_0x118a31,_0x3c778b));return uploadFile(_0x44cfd0,_0x4e6cf2,_0x51e28b,_0x3c778b,path['basename'](_0x43c5da),fs[_0x95ed('0x74')](_0x43c5da))[_0x95ed('0x29')](function(_0x520bba){logger[_0x95ed('0x68')](util['format'](_0x95ed('0x75'),_0x118a31,_0x3c778b,_0x520bba[_0x95ed('0x76')]));_0x556787['bucket']=_0x520bba['Bucket'];_0x556787['location']=_0x520bba[_0x95ed('0x76')];logger['info'](util[_0x95ed('0x36')](_0x95ed('0x77'),_0x118a31));return startTranscribe(_0x44cfd0,_0x4e6cf2,_0x51e28b,uuidv4(),_0x58b057,_0x520bba[_0x95ed('0x76')]);})[_0x95ed('0x29')](function(_0x58fdb3){logger[_0x95ed('0x68')](util[_0x95ed('0x36')](_0x95ed('0x78'),_0x118a31,_0x58fdb3['TranscriptionJob'][_0x95ed('0x79')]));_0x556787[_0x95ed('0x7a')]=_0x58fdb3[_0x95ed('0x7b')][_0x95ed('0x79')];_0x556787[_0x95ed('0x7c')]=_0x58fdb3['TranscriptionJob']['TranscriptionJobStatus'];return _0x318f7e(_0x556787);})[_0x95ed('0x4a')](function(_0x133efe){return _0x35d188(_0x133efe);});});}exports[_0x95ed('0x7d')]=function(_0x5d9c64,_0x2a4a58,_0x205315){var _0x419f0a;var _0x2ba907;var _0x39d6c4;var _0x316d7c=require(_0x95ed('0x52'));return db[_0x95ed('0x46')][_0x95ed('0x7e')]({'where':{'id':_0x5d9c64[_0x95ed('0x4c')]['id']}})[_0x95ed('0x29')](function(_0x1a0dcc){if(_0x1a0dcc){var _0x3431a7=util['format'](_0x95ed('0x55'),_0x1a0dcc[_0x95ed('0x54')]);if(fs[_0x95ed('0x56')](_0x3431a7)){cypher=!![];return _0x316d7c[_0x95ed('0x57')](_0x3431a7,_0x1a0dcc['value'],config[_0x95ed('0x63')][_0x95ed('0x64')])[_0x95ed('0x29')](function(){return _0x1a0dcc;});}return _0x1a0dcc;}})['then'](function(_0x5a4b61){if(!_0x5a4b61){throw new db[(_0x95ed('0x58'))][(_0x95ed('0x59'))](_0x95ed('0x7f'));}_0x2ba907=_0x5a4b61;return db['Setting'][_0x95ed('0x7e')]({'where':{'id':0x1}});})[_0x95ed('0x29')](handleEntityNotFound(_0x2a4a58,null))[_0x95ed('0x29')](function(_0x25013c){if(_0x25013c){_0x419f0a=_0x25013c;if(!_0x419f0a['transcribe']||!_0x419f0a[_0x95ed('0x80')]||!_0x419f0a['transcribeRegion']||!_0x419f0a['language']||!_0x419f0a[_0x95ed('0x81')]){throw new db['Sequelize'][(_0x95ed('0x59'))]('Transcribe\x20not\x20configured');}if(_0x5d9c64[_0x95ed('0x4f')][_0x95ed('0x82')]&&(!_0x419f0a[_0x95ed('0x83')]||!_0x419f0a[_0x95ed('0x84')]||!_0x419f0a[_0x95ed('0x85')]||!_0x419f0a[_0x95ed('0x86')]||!_0x419f0a[_0x95ed('0x81')])){throw new db[(_0x95ed('0x58'))][(_0x95ed('0x59'))](_0x95ed('0x87'));}return db[_0x95ed('0x88')]['findOne']({'where':{'id':_0x419f0a[_0x95ed('0x80')]}});}})[_0x95ed('0x29')](function(_0x58c6d7){if(!_0x58c6d7){throw new db[(_0x95ed('0x58'))][(_0x95ed('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x58c6d7[_0x95ed('0x89')]||!_0x58c6d7[_0x95ed('0x8a')]){throw new db['Sequelize'][(_0x95ed('0x59'))](_0x95ed('0x8b'));}_0x39d6c4=_0x58c6d7;return getBucketslist(_0x39d6c4[_0x95ed('0x89')],_0x39d6c4[_0x95ed('0x8a')],_0x419f0a['transcribeRegion']);})['then'](function(_0x37225a){if(_0x37225a&&_0x37225a[_0x95ed('0x8c')]){var _0x5269d6=_['find'](_0x37225a[_0x95ed('0x8c')],function(_0x5de611){return _0x5de611[_0x95ed('0x8d')]===_0x419f0a[_0x95ed('0x81')];});if(!_0x5269d6){logger[_0x95ed('0x68')](util[_0x95ed('0x36')](_0x95ed('0x8e'),_0x5d9c64['params']['id'],_0x419f0a[_0x95ed('0x81')]));return createBucket(_0x39d6c4[_0x95ed('0x89')],_0x39d6c4[_0x95ed('0x8a')],_0x419f0a[_0x95ed('0x8f')],_0x419f0a[_0x95ed('0x81')]);}logger['info'](util['format'](_0x95ed('0x90'),_0x5d9c64[_0x95ed('0x4c')]['id'],_0x419f0a[_0x95ed('0x81')]));return;}})[_0x95ed('0x29')](function(_0xcbe706){if(_0x2ba907['transcribeStatus']==='NEW'){return transcribe(_0x5d9c64['params']['id'],_0x39d6c4['data1'],_0x39d6c4['data2'],_0x419f0a[_0x95ed('0x8f')],_0x419f0a[_0x95ed('0x81')],_0x2ba907[_0x95ed('0x54')],_0x419f0a[_0x95ed('0x86')]);}else{logger[_0x95ed('0x68')](util[_0x95ed('0x36')](_0x95ed('0x91'),_0x5d9c64[_0x95ed('0x4c')]['id']));return{'transcribeStatus':_0x95ed('0x92')};}})[_0x95ed('0x29')](function(_0x5e8402){if(_0x5e8402){_0x5e8402['tempSentiment']=_0x5d9c64['body'][_0x95ed('0x82')];return _0x2ba907['updateAttributes'](_0x5e8402);}})[_0x95ed('0x29')](respondWithResult(_0x2a4a58,null))[_0x95ed('0x4a')](handleError(_0x2a4a58,null));};function writeFile(_0x21ba3d,_0x55d4d6){return new Promise(function(_0x272261,_0x2a12a7){fs['writeFile'](_0x55d4d6,_0x21ba3d,function(_0x24921b,_0x19f875){if(_0x24921b){return _0x2a12a7(_0x24921b);}else{return _0x272261(_0x19f875);}});});}exports['downloadTranscribe']=function(_0x574f2f,_0x5dd4d8,_0x133ea4){return db[_0x95ed('0x46')][_0x95ed('0x7e')]({'where':{'id':_0x574f2f['params']['id']}})[_0x95ed('0x29')](handleEntityNotFound(_0x5dd4d8))[_0x95ed('0x29')](function(_0x1e6568){if(_0x1e6568&&_0x1e6568['fileText']){var _0x30931d=_0x1e6568[_0x95ed('0x93')];var _0x243683=config[_0x95ed('0x94')]+_0x95ed('0x95')+_0x1e6568['id']+_0x95ed('0x96');if(fs[_0x95ed('0x56')](_0x243683)){return _0x243683;}return writeFile(_0x30931d,_0x243683)[_0x95ed('0x29')](function(){return _0x243683;});}else{throw new db[(_0x95ed('0x58'))]['ValidationError'](_0x95ed('0x97'));}})[_0x95ed('0x29')](function(_0x5c1943){return _0x5dd4d8['download'](_0x5c1943);})[_0x95ed('0x4a')](handleError(_0x5dd4d8));}; \ No newline at end of file +var _0x6cc3=['lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','map','format','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','MD5','token','push','$and','destroy','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','readFileSync','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra'];(function(_0x26be8b,_0x29bcd0){var _0x43e9bb=function(_0x21480b){while(--_0x21480b){_0x26be8b['push'](_0x26be8b['shift']());}};_0x43e9bb(++_0x29bcd0);}(_0x6cc3,0x88));var _0x36cc=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x6cc3[_0x29e0eb];return _0x597d2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36cc('0x1'));var rp=require(_0x36cc('0x2'));var moment=require(_0x36cc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x36cc('0x4'));var path=require('path');var sox=require(_0x36cc('0x5'));var csv=require(_0x36cc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36cc('0x7'));var _=require(_0x36cc('0x8'));var squel=require(_0x36cc('0x9'));var crypto=require(_0x36cc('0xa'));var jsforce=require(_0x36cc('0xb'));var deskjs=require(_0x36cc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x36cc('0xd'));var AWS=require(_0x36cc('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0x36cc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x36cc('0x10'));var as=require(_0x36cc('0x11'));var hardwareService=require(_0x36cc('0x12'));var logger=require(_0x36cc('0x13'))(_0x36cc('0x14'));var utils=require(_0x36cc('0x15'));var config=require(_0x36cc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f1c5f,_0x35710b){_0x35710b=_0x35710b||0xcc;return function(_0x1a18e3){if(_0x1a18e3){return _0x4f1c5f[_0x36cc('0x17')](_0x35710b);}return _0x4f1c5f[_0x36cc('0x18')](_0x35710b)[_0x36cc('0x19')]();};}function respondWithResult(_0x5c4df3,_0x3efa50){_0x3efa50=_0x3efa50||0xc8;return function(_0x599df5){if(_0x599df5){return _0x5c4df3[_0x36cc('0x18')](_0x3efa50)[_0x36cc('0x1a')](_0x599df5);}};}function respondWithFilteredResult(_0x4bb074,_0x5316fc){return function(_0x55604e){if(_0x55604e){var _0x112e2b=typeof _0x5316fc[_0x36cc('0x1b')]===_0x36cc('0x1c')&&typeof _0x5316fc[_0x36cc('0x1d')]==='undefined';var _0x2bcb64=_0x55604e[_0x36cc('0x1e')];var _0x422dc3=_0x112e2b?0x0:_0x5316fc[_0x36cc('0x1b')];var _0x327eb7=_0x112e2b?_0x55604e['count']:_0x5316fc['offset']+_0x5316fc[_0x36cc('0x1d')];var _0x6bedb6;if(_0x327eb7>=_0x2bcb64){_0x327eb7=_0x2bcb64;_0x6bedb6=0xc8;}else{_0x6bedb6=0xce;}_0x4bb074[_0x36cc('0x18')](_0x6bedb6);return _0x4bb074[_0x36cc('0x1f')]('Content-Range',_0x422dc3+'-'+_0x327eb7+'/'+_0x2bcb64)[_0x36cc('0x1a')](_0x55604e);}return null;};}function patchUpdates(_0x27b679){return function(_0x522db3){try{jsonpatch['apply'](_0x522db3,_0x27b679,!![]);}catch(_0x36498a){return BPromise[_0x36cc('0x20')](_0x36498a);}return _0x522db3['save']();};}function saveUpdates(_0x47883f,_0x270b5c){return function(_0x71cab9){if(_0x71cab9){return _0x71cab9[_0x36cc('0x21')](_0x47883f)[_0x36cc('0x22')](function(_0x1387c2){return _0x1387c2;});}return null;};}function removeEntity(_0x2314e4,_0x9b5a67){return function(_0x13cd6a){if(_0x13cd6a){return _0x13cd6a['destroy']()['then'](function(){_0x2314e4[_0x36cc('0x18')](0xcc)[_0x36cc('0x19')]();});}};}function handleEntityNotFound(_0x16d5c2,_0x4f638f){return function(_0x459c60){if(!_0x459c60){_0x16d5c2[_0x36cc('0x17')](0x194);}return _0x459c60;};}function handleError(_0x2fe9d1,_0x4962ea){_0x4962ea=_0x4962ea||0x1f4;return function(_0x50d901){logger['error'](_0x50d901[_0x36cc('0x23')]);if(_0x50d901[_0x36cc('0x24')]){delete _0x50d901['name'];}_0x2fe9d1[_0x36cc('0x18')](_0x4962ea)[_0x36cc('0x25')](_0x50d901);};}exports[_0x36cc('0x26')]=function(_0x3855a4,_0x3e902a){var _0xf8ab29={},_0x4de70f={},_0x19e015={'count':0x0,'rows':[]};var _0x24305b=_['map'](db[_0x36cc('0x27')][_0x36cc('0x28')],function(_0x28e767){return{'name':_0x28e767[_0x36cc('0x29')],'type':_0x28e767[_0x36cc('0x2a')]['key']};});_0x4de70f[_0x36cc('0x2b')]=_[_0x36cc('0x2c')](_[_0x36cc('0x2d')](_0x24305b,'name'),[_0x36cc('0x2e')]);_0x4de70f[_0x36cc('0x2f')]=_[_0x36cc('0x30')](_0x3855a4['query']);_0x4de70f[_0x36cc('0x31')]=_['intersection'](_0x4de70f[_0x36cc('0x2b')],_0x4de70f['query']);_0xf8ab29[_0x36cc('0x32')]=_[_0x36cc('0x33')](_0x4de70f[_0x36cc('0x2b')],qs[_0x36cc('0x34')](_0x3855a4[_0x36cc('0x2f')]['fields']));_0xf8ab29['attributes']=_0xf8ab29[_0x36cc('0x32')]['length']?_0xf8ab29[_0x36cc('0x32')]:_0x4de70f[_0x36cc('0x2b')];if(!_0x3855a4[_0x36cc('0x2f')][_0x36cc('0x35')]('nolimit')){_0xf8ab29[_0x36cc('0x1d')]=qs[_0x36cc('0x1d')](_0x3855a4[_0x36cc('0x2f')][_0x36cc('0x1d')]);_0xf8ab29[_0x36cc('0x1b')]=qs[_0x36cc('0x1b')](_0x3855a4[_0x36cc('0x2f')][_0x36cc('0x1b')]);}_0xf8ab29[_0x36cc('0x36')]=qs[_0x36cc('0x37')](_0x3855a4[_0x36cc('0x2f')]['sort']);_0xf8ab29['where']=qs[_0x36cc('0x31')](_['pick'](_0x3855a4[_0x36cc('0x2f')],_0x4de70f['filters']),_0x24305b);if(_0x3855a4[_0x36cc('0x2f')][_0x36cc('0x38')]){_0xf8ab29[_0x36cc('0x39')]=_['merge'](_0xf8ab29['where'],{'$or':_['map'](_0x24305b,function(_0x597815){if(_0x597815[_0x36cc('0x2a')]!==_0x36cc('0x3a')){var _0x99bdfc={};_0x99bdfc[_0x597815['name']]={'$like':'%'+_0x3855a4[_0x36cc('0x2f')][_0x36cc('0x38')]+'%'};return _0x99bdfc;}})});}_0xf8ab29=_[_0x36cc('0x3b')]({},_0xf8ab29,_0x3855a4[_0x36cc('0x3c')]);var _0x79a4b5={'where':_0xf8ab29[_0x36cc('0x39')]};return db[_0x36cc('0x27')][_0x36cc('0x1e')](_0x79a4b5)[_0x36cc('0x22')](function(_0x1b12a5){_0x19e015[_0x36cc('0x1e')]=_0x1b12a5;if(_0x3855a4[_0x36cc('0x2f')][_0x36cc('0x3d')]){_0xf8ab29[_0x36cc('0x3e')]=[{'all':!![]}];}return db[_0x36cc('0x27')]['findAll'](_0xf8ab29);})['then'](function(_0x2e0220){_0x19e015[_0x36cc('0x3f')]=_0x2e0220;return _0x19e015;})[_0x36cc('0x22')](respondWithFilteredResult(_0x3e902a,_0xf8ab29))[_0x36cc('0x40')](handleError(_0x3e902a,null));};exports[_0x36cc('0x41')]=function(_0x22bc1e,_0x7cba5f){var _0x365f86={'raw':![],'where':{'id':_0x22bc1e['params']['id']}},_0x3a4211={};_0x3a4211[_0x36cc('0x2b')]=_['keys'](db[_0x36cc('0x27')][_0x36cc('0x28')]);_0x3a4211[_0x36cc('0x2f')]=_[_0x36cc('0x30')](_0x22bc1e[_0x36cc('0x2f')]);_0x3a4211[_0x36cc('0x31')]=_[_0x36cc('0x33')](_0x3a4211['model'],_0x3a4211[_0x36cc('0x2f')]);_0x365f86[_0x36cc('0x32')]=_[_0x36cc('0x33')](_0x3a4211['model'],qs[_0x36cc('0x34')](_0x22bc1e[_0x36cc('0x2f')][_0x36cc('0x34')]));_0x365f86[_0x36cc('0x32')]=_0x365f86['attributes']['length']?_0x365f86[_0x36cc('0x32')]:_0x3a4211[_0x36cc('0x2b')];if(_0x22bc1e[_0x36cc('0x2f')][_0x36cc('0x3d')]){_0x365f86[_0x36cc('0x3e')]=[{'all':!![]}];}_0x365f86=_['merge']({},_0x365f86,_0x22bc1e[_0x36cc('0x3c')]);return db[_0x36cc('0x27')][_0x36cc('0x42')](_0x365f86)[_0x36cc('0x22')](handleEntityNotFound(_0x7cba5f,null))[_0x36cc('0x22')](respondWithResult(_0x7cba5f,null))['catch'](handleError(_0x7cba5f,null));};exports[_0x36cc('0x43')]=function(_0x2e4249,_0x5e96d1){return db[_0x36cc('0x27')]['create'](_0x2e4249[_0x36cc('0x44')],{})['then'](respondWithResult(_0x5e96d1,0xc9))[_0x36cc('0x40')](handleError(_0x5e96d1,null));};exports[_0x36cc('0x21')]=function(_0x747a52,_0x500ff2){if(_0x747a52[_0x36cc('0x44')]['id']){delete _0x747a52[_0x36cc('0x44')]['id'];}return db[_0x36cc('0x27')][_0x36cc('0x42')]({'where':{'id':_0x747a52['params']['id']}})[_0x36cc('0x22')](handleEntityNotFound(_0x500ff2,null))['then'](saveUpdates(_0x747a52['body'],null))[_0x36cc('0x22')](respondWithResult(_0x500ff2,null))[_0x36cc('0x40')](handleError(_0x500ff2,null));};exports[_0x36cc('0x45')]=function(_0x9064db,_0x2aba53){return db[_0x36cc('0x27')]['describe']()[_0x36cc('0x22')](respondWithResult(_0x2aba53,null))['catch'](handleError(_0x2aba53,null));};exports[_0x36cc('0x46')]=function(_0x1596ec,_0x508125,_0x277a0c){var _0x35fb2d=require(_0x36cc('0x47'));var _0x13768f=![];var _0x21c391={};if(_0x1596ec[_0x36cc('0x2f')]['type']&&_0x1596ec[_0x36cc('0x2f')][_0x36cc('0x2a')]===_0x36cc('0x48')){_0x21c391[_0x36cc('0x48')]=_0x1596ec[_0x36cc('0x49')]['id'];}else{_0x21c391['id']=_0x1596ec[_0x36cc('0x49')]['id'];}return db[_0x36cc('0x27')]['find']({'where':_0x21c391,'attributes':['id',_0x36cc('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x508125,null))[_0x36cc('0x22')](function(_0x221a55){if(_0x221a55){var _0x40b948=_0x221a55[_0x36cc('0x4a')];var _0x12e4e8=util[_0x36cc('0x2e')](_0x36cc('0x4b'),_0x40b948);if(fs['existsSync'](_0x12e4e8)){_0x13768f=!![];return _0x35fb2d[_0x36cc('0x4c')](_0x12e4e8,_0x40b948,config[_0x36cc('0x4d')][_0x36cc('0x4e')])['then'](function(){return _0x221a55;});}return _0x221a55;}})[_0x36cc('0x22')](function(_0x2b8d49){if(_0x2b8d49){var _0xcb30e=_0x2b8d49['value'];if(!fs[_0x36cc('0x4f')](_0xcb30e)){throw new db[(_0x36cc('0x50'))][(_0x36cc('0x51'))](_0x36cc('0x52'));}if(_0x2b8d49[_0x36cc('0x53')]){return _0x508125[_0x36cc('0x46')](_0xcb30e,_0x2b8d49[_0x36cc('0x53')]+path[_0x36cc('0x54')](_0xcb30e),function(){if(_0x13768f){fs[_0x36cc('0x55')](_0xcb30e);}});}else{return _0x508125[_0x36cc('0x46')](_0xcb30e,function(_0xce10ab){if(_0x13768f){fs[_0x36cc('0x55')](_0xcb30e);}});}}})[_0x36cc('0x40')](function(_0x6f8a4a){if(_0x6f8a4a[_0x36cc('0x56')]===_0x36cc('0x52')){_0x508125['status'](0x194)[_0x36cc('0x25')](_0x36cc('0x57'));}else{return handleError(_0x508125,null);}});};exports[_0x36cc('0x58')]=function(_0x5bebcd,_0x56a27c,_0x22a835){var _0x6af1e1=require(_0x36cc('0x47'));var _0x227865=![];var _0x5bbfe5={'$and':[db['sequelize']['where'](db['sequelize']['fn'](_0x36cc('0x59'),db['sequelize']['col'](_0x36cc('0x48'))),_0x5bebcd[_0x36cc('0x2f')][_0x36cc('0x5a')])]};if(_0x5bebcd[_0x36cc('0x2f')][_0x36cc('0x2a')]&&_0x5bebcd[_0x36cc('0x2f')][_0x36cc('0x2a')]===_0x36cc('0x48')){_0x5bbfe5['$and'][_0x36cc('0x5b')]({'uniqueid':_0x5bebcd[_0x36cc('0x49')]['id']});}else{_0x5bbfe5[_0x36cc('0x5c')][_0x36cc('0x5b')]({'id':_0x5bebcd[_0x36cc('0x49')]['id']});}return db[_0x36cc('0x27')][_0x36cc('0x42')]({'where':_0x5bbfe5,'attributes':['id',_0x36cc('0x4a')],'raw':!![]})[_0x36cc('0x22')](handleEntityNotFound(_0x56a27c,null))[_0x36cc('0x22')](function(_0x3028cf){if(_0x3028cf){var _0x41672c=util[_0x36cc('0x2e')](_0x36cc('0x4b'),_0x3028cf['value']);if(fs[_0x36cc('0x4f')](_0x41672c)){_0x227865=!![];return _0x6af1e1[_0x36cc('0x4c')](_0x41672c,_0x3028cf['value'],config[_0x36cc('0x4d')][_0x36cc('0x4e')])['then'](function(){return _0x3028cf;});}return _0x3028cf;}})[_0x36cc('0x22')](function(_0x148cce){if(_0x148cce){if(!fs[_0x36cc('0x4f')](_0x148cce[_0x36cc('0x4a')])){throw new db['Sequelize'][(_0x36cc('0x51'))](_0x36cc('0x52'));}if(_0x148cce['filename']){return _0x56a27c[_0x36cc('0x46')](_0x148cce['value'],_0x148cce[_0x36cc('0x53')]+path[_0x36cc('0x54')](_0x148cce[_0x36cc('0x4a')]),function(){if(_0x227865){fs[_0x36cc('0x55')](_0x148cce['value']);}});}else{return _0x56a27c[_0x36cc('0x46')](_0x148cce['value'],function(_0x1e7331){if(_0x227865){fs['unlink'](_0x148cce[_0x36cc('0x4a')]);}});}}})['catch'](handleError(_0x56a27c,null));};exports[_0x36cc('0x5d')]=function(_0x2a268f,_0x576d75){return db[_0x36cc('0x27')]['find']({'where':{'id':_0x2a268f[_0x36cc('0x49')]['id']}})['then'](function(_0x25d381){if(_[_0x36cc('0x5e')](_0x25d381)){throw new ReferenceError('Entity\x20not\x20found');}return _0x25d381;})['then'](function(_0x435a97){var _0x1ee110=_0x435a97[_0x36cc('0x4a')];logger[_0x36cc('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x1ee110);if(!_[_0x36cc('0x5e')](_0x435a97[_0x36cc('0x4a')])&&fs[_0x36cc('0x4f')](_0x1ee110)){logger[_0x36cc('0x5f')](_0x36cc('0x60')+_0x1ee110+_0x36cc('0x61'));fs[_0x36cc('0x62')](_0x1ee110);}_0x1ee110=_0x1ee110+'.cypher';if(!_['isNil'](_0x435a97['value'])&&fs[_0x36cc('0x4f')](_0x1ee110)){logger['info']('File:\x20\x22'+_0x1ee110+_0x36cc('0x61'));fs[_0x36cc('0x62')](_0x1ee110);}return _0x435a97;})[_0x36cc('0x22')](function(_0x439eac){if(!_0x439eac)throw new InternalError();return _0x439eac[_0x36cc('0x5d')]();})[_0x36cc('0x22')](function(){_0x576d75['status'](0xcc)['end']();})[_0x36cc('0x40')](handleError(_0x576d75,null));};function getBucketslist(_0xad88e,_0x2bc5ea,_0x5b15d2){return new Promise(function(_0x225b7d,_0x4e4591){var _0x332ebc=new AWS['S3']({'accessKeyId':_0x2bc5ea,'secretAccessKey':_0xad88e,'region':_0x5b15d2});_0x332ebc[_0x36cc('0x63')]({},function(_0x587b4d,_0x491d3e){if(_0x587b4d){return _0x4e4591(_0x587b4d);}else{return _0x225b7d(_0x491d3e);}});});}function createBucket(_0x133ee5,_0x486ae1,_0xced668,_0x5ed4af){return new Promise(function(_0x1e3a33,_0x259dcc){var _0x534c69=new AWS['S3']({'accessKeyId':_0x486ae1,'secretAccessKey':_0x133ee5,'region':_0xced668});_0x534c69[_0x36cc('0x64')]({'Bucket':_0x5ed4af},function(_0x9b75bc,_0x49d18b){if(_0x9b75bc){return _0x259dcc(_0x9b75bc);}else{return _0x1e3a33(_0x49d18b);}});});}function uploadFile(_0x5be0e3,_0x43feb5,_0x26838f,_0x512707,_0x127bd6,_0xdfbe96){return new Promise(function(_0x2d350c,_0x4b5c15){var _0x374aea=new AWS['S3']({'accessKeyId':_0x43feb5,'secretAccessKey':_0x5be0e3,'region':_0x26838f});_0x374aea[_0x36cc('0x65')]({'Bucket':_0x512707,'Key':_0x127bd6,'Body':_0xdfbe96},function(_0x5de136,_0x207918){if(_0x5de136){return _0x4b5c15(_0x5de136);}else{return _0x2d350c(_0x207918);}});});}function startTranscribe(_0x2c8c53,_0x43f677,_0x528ab2,_0x25a2ce,_0x37d46d,_0x8665da){return new Promise(function(_0x5e718b,_0x41e0ec){var _0x1b26fe=new AWS[(_0x36cc('0x66'))]({'accessKeyId':_0x43f677,'secretAccessKey':_0x2c8c53,'region':_0x528ab2});_0x1b26fe[_0x36cc('0x67')]({'TranscriptionJobName':_0x25a2ce,'LanguageCode':_0x37d46d,'Media':{'MediaFileUri':_0x8665da}},function(_0x579e9d,_0x172b18){if(_0x579e9d){return _0x41e0ec(_0x579e9d);}else{return _0x5e718b(_0x172b18);}});});}function transcribe(_0x487b4e,_0x45f425,_0x52d39a,_0x3d0d63,_0x4167dc,_0x303291,_0x313866){return new Promise(function(_0x587fc8,_0xdb8e75){var _0xf701ae={};logger[_0x36cc('0x5f')](util[_0x36cc('0x2e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x487b4e,_0x4167dc));return uploadFile(_0x45f425,_0x52d39a,_0x3d0d63,_0x4167dc,path['basename'](_0x303291),fs[_0x36cc('0x68')](_0x303291))[_0x36cc('0x22')](function(_0x3287fb){logger[_0x36cc('0x5f')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x487b4e,_0x4167dc,_0x3287fb[_0x36cc('0x69')]));_0xf701ae['bucket']=_0x3287fb[_0x36cc('0x6a')];_0xf701ae['location']=_0x3287fb[_0x36cc('0x69')];logger[_0x36cc('0x5f')](util[_0x36cc('0x2e')](_0x36cc('0x6b'),_0x487b4e));return startTranscribe(_0x45f425,_0x52d39a,_0x3d0d63,uuidv4(),_0x313866,_0x3287fb['Location']);})[_0x36cc('0x22')](function(_0x1d5847){logger[_0x36cc('0x5f')](util[_0x36cc('0x2e')](_0x36cc('0x6c'),_0x487b4e,_0x1d5847[_0x36cc('0x6d')][_0x36cc('0x6e')]));_0xf701ae[_0x36cc('0x6f')]=_0x1d5847[_0x36cc('0x6d')][_0x36cc('0x6e')];_0xf701ae[_0x36cc('0x70')]=_0x1d5847[_0x36cc('0x6d')]['TranscriptionJobStatus'];return _0x587fc8(_0xf701ae);})[_0x36cc('0x40')](function(_0x3a3ee0){return _0xdb8e75(_0x3a3ee0);});});}exports[_0x36cc('0x71')]=function(_0x1bf310,_0x4ed6c5,_0x201aa7){var _0x2e8f8a;var _0xeb4a23;var _0x2bb804;var _0x4cd986=require('../../components/encryptor');return db[_0x36cc('0x27')][_0x36cc('0x72')]({'where':{'id':_0x1bf310[_0x36cc('0x49')]['id']}})[_0x36cc('0x22')](function(_0x228e0b){if(_0x228e0b){var _0x3d6a39=util[_0x36cc('0x2e')](_0x36cc('0x4b'),_0x228e0b[_0x36cc('0x4a')]);if(fs['existsSync'](_0x3d6a39)){cypher=!![];return _0x4cd986[_0x36cc('0x4c')](_0x3d6a39,_0x228e0b[_0x36cc('0x4a')],config[_0x36cc('0x4d')][_0x36cc('0x4e')])['then'](function(){return _0x228e0b;});}return _0x228e0b;}})['then'](function(_0x510b4e){if(!_0x510b4e){throw new db[(_0x36cc('0x50'))][(_0x36cc('0x51'))](_0x36cc('0x73'));}_0xeb4a23=_0x510b4e;return db[_0x36cc('0x74')][_0x36cc('0x72')]({'where':{'id':0x1}});})[_0x36cc('0x22')](handleEntityNotFound(_0x4ed6c5,null))['then'](function(_0x4e3d48){if(_0x4e3d48){_0x2e8f8a=_0x4e3d48;if(!_0x2e8f8a[_0x36cc('0x75')]||!_0x2e8f8a[_0x36cc('0x76')]||!_0x2e8f8a[_0x36cc('0x77')]||!_0x2e8f8a[_0x36cc('0x78')]||!_0x2e8f8a[_0x36cc('0x79')]){throw new db['Sequelize'][(_0x36cc('0x51'))](_0x36cc('0x7a'));}if(_0x1bf310[_0x36cc('0x44')][_0x36cc('0x7b')]&&(!_0x2e8f8a[_0x36cc('0x7c')]||!_0x2e8f8a[_0x36cc('0x7d')]||!_0x2e8f8a['sentimentRegion']||!_0x2e8f8a['language']||!_0x2e8f8a['bucket'])){throw new db['Sequelize'][(_0x36cc('0x51'))](_0x36cc('0x7e'));}return db[_0x36cc('0x7f')]['findOne']({'where':{'id':_0x2e8f8a[_0x36cc('0x76')]}});}})[_0x36cc('0x22')](function(_0x2ce1ed){if(!_0x2ce1ed){throw new db[(_0x36cc('0x50'))][(_0x36cc('0x51'))](_0x36cc('0x80'));}if(!_0x2ce1ed[_0x36cc('0x81')]||!_0x2ce1ed[_0x36cc('0x82')]){throw new db[(_0x36cc('0x50'))][(_0x36cc('0x51'))]('Cloud\x20Provider\x20not\x20configured');}_0x2bb804=_0x2ce1ed;return getBucketslist(_0x2bb804[_0x36cc('0x81')],_0x2bb804[_0x36cc('0x82')],_0x2e8f8a[_0x36cc('0x77')]);})[_0x36cc('0x22')](function(_0x2fbcd7){if(_0x2fbcd7&&_0x2fbcd7['Buckets']){var _0x24974f=_[_0x36cc('0x42')](_0x2fbcd7[_0x36cc('0x83')],function(_0x4961d6){return _0x4961d6[_0x36cc('0x84')]===_0x2e8f8a[_0x36cc('0x79')];});if(!_0x24974f){logger['info'](util['format'](_0x36cc('0x85'),_0x1bf310['params']['id'],_0x2e8f8a['bucket']));return createBucket(_0x2bb804[_0x36cc('0x81')],_0x2bb804[_0x36cc('0x82')],_0x2e8f8a[_0x36cc('0x77')],_0x2e8f8a[_0x36cc('0x79')]);}logger['info'](util[_0x36cc('0x2e')](_0x36cc('0x86'),_0x1bf310[_0x36cc('0x49')]['id'],_0x2e8f8a['bucket']));return;}})[_0x36cc('0x22')](function(_0x5cb1ea){if(_0xeb4a23[_0x36cc('0x70')]===_0x36cc('0x87')){return transcribe(_0x1bf310['params']['id'],_0x2bb804['data1'],_0x2bb804[_0x36cc('0x82')],_0x2e8f8a['transcribeRegion'],_0x2e8f8a[_0x36cc('0x79')],_0xeb4a23[_0x36cc('0x4a')],_0x2e8f8a[_0x36cc('0x78')]);}else{logger[_0x36cc('0x5f')](util['format'](_0x36cc('0x88'),_0x1bf310[_0x36cc('0x49')]['id']));return{'transcribeStatus':_0x36cc('0x89')};}})[_0x36cc('0x22')](function(_0xf2e02){if(_0xf2e02){_0xf2e02['tempSentiment']=_0x1bf310[_0x36cc('0x44')]['runSentiment'];return _0xeb4a23[_0x36cc('0x8a')](_0xf2e02);}})['then'](respondWithResult(_0x4ed6c5,null))['catch'](handleError(_0x4ed6c5,null));};function writeFile(_0x1c1599,_0x771a3a){return new Promise(function(_0x5b6db9,_0x3194bb){fs['writeFile'](_0x771a3a,_0x1c1599,function(_0xb217c9,_0x1df1f5){if(_0xb217c9){return _0x3194bb(_0xb217c9);}else{return _0x5b6db9(_0x1df1f5);}});});}exports[_0x36cc('0x8b')]=function(_0xb7a5c7,_0x274e23,_0x12c6a5){return db[_0x36cc('0x27')][_0x36cc('0x72')]({'where':{'id':_0xb7a5c7[_0x36cc('0x49')]['id']}})[_0x36cc('0x22')](handleEntityNotFound(_0x274e23))[_0x36cc('0x22')](function(_0x26512f){if(_0x26512f&&_0x26512f[_0x36cc('0x8c')]){var _0x1732f2=_0x26512f[_0x36cc('0x8c')];var _0x3fdb76=config[_0x36cc('0x8d')]+_0x36cc('0x8e')+_0x26512f['id']+_0x36cc('0x8f');if(fs[_0x36cc('0x4f')](_0x3fdb76)){return _0x3fdb76;}return writeFile(_0x1732f2,_0x3fdb76)[_0x36cc('0x22')](function(){return _0x3fdb76;});}else{throw new db[(_0x36cc('0x50'))][(_0x36cc('0x51'))]('Transcript\x20not\x20available');}})[_0x36cc('0x22')](function(_0xe292dd){return _0x274e23[_0x36cc('0x46')](_0xe292dd);})[_0x36cc('0x40')](handleError(_0x274e23));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index fa2cd18..6eab5fb 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 _0x00bb=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x48c146,_0x552802){var _0x5c8afe=function(_0xff1546){while(--_0xff1546){_0x48c146['push'](_0x48c146['shift']());}};_0x5c8afe(++_0x552802);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var attributes=require(_0xb00b('0x0'));module[_0xb00b('0x1')]=function(_0x468a51,_0x54f40d){return _0x468a51[_0xb00b('0x2')]('VoiceRecording',attributes,{'tableName':_0xb00b('0x3'),'paranoid':![],'indexes':[{'name':_0xb00b('0x4'),'fields':['uniqueid']},{'name':_0xb00b('0x5'),'fields':[_0xb00b('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d97=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','exports','define'];(function(_0xd36ecf,_0xbc090b){var _0x15847a=function(_0x345247){while(--_0x345247){_0xd36ecf['push'](_0xd36ecf['shift']());}};_0x15847a(++_0xbc090b);}(_0x8d97,0x82));var _0x78d9=function(_0x539724,_0x120b2d){_0x539724=_0x539724-0x0;var _0x1752e5=_0x8d97[_0x539724];return _0x1752e5;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x78d9('0x0')]=function(_0x288fbe,_0x54c125){return _0x288fbe[_0x78d9('0x1')](_0x78d9('0x2'),attributes,{'tableName':_0x78d9('0x3'),'paranoid':![],'indexes':[{'name':_0x78d9('0x4'),'fields':[_0x78d9('0x4')]},{'name':'transcribeStatus','fields':[_0x78d9('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index befc875..b02f242 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 _0x0b0e=['secrets','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','update','options','where','attributes','UpdateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','body','existsSync','format','encryptFile','value'];(function(_0x8aff91,_0x6a8c42){var _0x413eff=function(_0x18df8f){while(--_0x18df8f){_0x8aff91['push'](_0x8aff91['shift']());}};_0x413eff(++_0x6a8c42);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x0b0e[_0x4776cc];return _0x427bda;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['UpdateVoiceRecording']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['VoiceRecording'][_0xe0b0('0x18')](_0x54a3eb['body'],{'raw':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb['options'][_0xe0b0('0x1a')]||null:null,'attributes':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb[_0xe0b0('0x19')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x19')]?_0x54a3eb['options']['limit']||null:null})[_0xe0b0('0xd')](function(_0x5512bb){logger[_0xe0b0('0xe')](_0xe0b0('0x1c'),_0x54a3eb);logger['debug'](_0xe0b0('0x1c'),_0x54a3eb,JSON['stringify'](_0x5512bb));_0x50a441(_0x5512bb);})[_0xe0b0('0x17')](function(_0x49a727){logger[_0xe0b0('0x13')]('UpdateVoiceRecording',_0x49a727[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44['error'](0x1f4,_0x49a727[_0xe0b0('0x14')]));});});};exports['CreateVoiceRecording']=function(_0x3c221d){var _0x5c5317=this;return new Promise(function(_0x362aba,_0x3c3bc2){var _0x1f1ebd=require(_0xe0b0('0x1d'));var _0x3ec2;return db[_0xe0b0('0x1e')]['findOne']({'attributes':['id',_0xe0b0('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xe0b0('0xd')](function(_0x5b7a64){_0x3ec2=_0x5b7a64;return db[_0xe0b0('0x20')][_0xe0b0('0x21')](_0x3c221d[_0xe0b0('0x22')]);})[_0xe0b0('0xd')](function(_0x3cdbd5){if(_0x3ec2[_0xe0b0('0x1f')]&&fs[_0xe0b0('0x23')](_0x3cdbd5['value'])){var _0x1854b8=util[_0xe0b0('0x24')]('%s.cypher',_0x3cdbd5['value']);return _0x1f1ebd[_0xe0b0('0x25')](_0x3cdbd5[_0xe0b0('0x26')],_0x1854b8,config[_0xe0b0('0x27')][_0xe0b0('0x28')])[_0xe0b0('0xd')](function(){fs['unlink'](_0x3cdbd5[_0xe0b0('0x26')]);logger[_0xe0b0('0xe')](_0xe0b0('0x29'));return _0x3cdbd5;});}return _0x3cdbd5;})[_0xe0b0('0xd')](function(_0x27158f){logger['info'](_0xe0b0('0x2a'),_0x3c221d);logger[_0xe0b0('0x10')](_0xe0b0('0x2a'),_0x3c221d,JSON[_0xe0b0('0x12')](_0x27158f));_0x362aba(_0x27158f);})[_0xe0b0('0x17')](function(_0x12eeb8){logger[_0xe0b0('0x13')](_0xe0b0('0x2a'),_0x12eeb8[_0xe0b0('0x14')],_0x3c221d);_0x3c3bc2(_0x5c5317[_0xe0b0('0x13')](0x1f4,_0x12eeb8[_0xe0b0('0x14')]));});});}; \ No newline at end of file +var _0xc6ac=['Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','stringify','catch','CreateVoiceRecording','../../components/encryptor'];(function(_0x2fd2d1,_0x1ef54d){var _0x496dee=function(_0x1a2f98){while(--_0x1a2f98){_0x2fd2d1['push'](_0x2fd2d1['shift']());}};_0x496dee(++_0x1ef54d);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x382600,_0x6d9abe){_0x382600=_0x382600-0x0;var _0x331672=_0xc6ac[_0x382600];return _0x331672;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')](_0x33079c[_0xcc6a('0x1b')],{'raw':_0x33079c['options']?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1e')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1f')]||null:null,'limit':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x20')]||null:null})[_0xcc6a('0xf')](function(_0x51be9a){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger[_0xcc6a('0x12')]('UpdateVoiceRecording',_0x33079c,JSON[_0xcc6a('0x21')](_0x51be9a));_0x2d9585(_0x51be9a);})[_0xcc6a('0x22')](function(_0x3a00e5){logger[_0xcc6a('0x15')](_0xcc6a('0x18'),_0x3a00e5[_0xcc6a('0x17')],_0x33079c);_0x412bc7(_0x12ef33['error'](0x1f4,_0x3a00e5[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x23')]=function(_0x3514f3){var _0x5f27e5=this;return new Promise(function(_0x3afb3a,_0x3dad72){var _0x4da301=require(_0xcc6a('0x24'));var _0x8b1b2b;return db[_0xcc6a('0x25')][_0xcc6a('0x26')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xcc6a('0xf')](function(_0x3cf14c){_0x8b1b2b=_0x3cf14c;return db[_0xcc6a('0x19')]['create'](_0x3514f3[_0xcc6a('0x1b')]);})['then'](function(_0x4f67d3){if(_0x8b1b2b[_0xcc6a('0x27')]&&fs[_0xcc6a('0x28')](_0x4f67d3[_0xcc6a('0x29')])){var _0x11b481=util[_0xcc6a('0x2a')](_0xcc6a('0x2b'),_0x4f67d3['value']);return _0x4da301[_0xcc6a('0x2c')](_0x4f67d3[_0xcc6a('0x29')],_0x11b481,config[_0xcc6a('0x2d')][_0xcc6a('0x2e')])[_0xcc6a('0xf')](function(){fs[_0xcc6a('0x2f')](_0x4f67d3[_0xcc6a('0x29')]);logger[_0xcc6a('0x10')]('CreateVoiceRecording\x20file\x20encrypted');return _0x4f67d3;});}return _0x4f67d3;})[_0xcc6a('0xf')](function(_0xc8c90c){logger[_0xcc6a('0x10')](_0xcc6a('0x23'),_0x3514f3);logger[_0xcc6a('0x12')](_0xcc6a('0x23'),_0x3514f3,JSON[_0xcc6a('0x21')](_0xc8c90c));_0x3afb3a(_0xc8c90c);})['catch'](function(_0x5d2287){logger['error']('CreateVoiceRecording',_0x5d2287['message'],_0x3514f3);_0x3dad72(_0x5f27e5[_0xcc6a('0x15')](0x1f4,_0x5d2287[_0xcc6a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4d41ca6..b01476d 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 _0x1200=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0xfeeef7,_0x47d5f8){var _0x1e16c2=function(_0x520f3f){while(--_0x520f3f){_0xfeeef7['push'](_0xfeeef7['shift']());}};_0x1e16c2(++_0x47d5f8);}(_0x1200,0x1c2));var _0x0120=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x1200[_0x45c48f];return _0xaf5037;};'use strict';var multer=require(_0x0120('0x0'));var util=require(_0x0120('0x1'));var path=require(_0x0120('0x2'));var timeout=require(_0x0120('0x3'));var express=require('express');var router=express[_0x0120('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0120('0x5'));var controller=require(_0x0120('0x6'));router[_0x0120('0x7')]('/',auth[_0x0120('0x8')](),controller[_0x0120('0x9')]);router[_0x0120('0x7')](_0x0120('0xa'),auth[_0x0120('0x8')](),controller[_0x0120('0xb')]);router[_0x0120('0x7')](_0x0120('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0120('0xd')]('/',auth[_0x0120('0x8')](),controller[_0x0120('0xe')]);router[_0x0120('0xf')](_0x0120('0xc'),auth[_0x0120('0x8')](),controller[_0x0120('0x10')]);router[_0x0120('0x11')](_0x0120('0xc'),auth[_0x0120('0x8')](),controller[_0x0120('0x12')]);module[_0x0120('0x13')]=router; \ No newline at end of file +var _0xcda9=['../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3afb73,_0xaa578f){var _0x5165f2=function(_0x142ac9){while(--_0x142ac9){_0x3afb73['push'](_0x3afb73['shift']());}};_0x5165f2(++_0xaa578f);}(_0xcda9,0x111));var _0x9cda=function(_0x21f78e,_0x54a66b){_0x21f78e=_0x21f78e-0x0;var _0x207ad2=_0xcda9[_0x21f78e];return _0x207ad2;};'use strict';var multer=require(_0x9cda('0x0'));var util=require(_0x9cda('0x1'));var path=require(_0x9cda('0x2'));var timeout=require(_0x9cda('0x3'));var express=require(_0x9cda('0x4'));var router=express[_0x9cda('0x5')]();var fs_extra=require(_0x9cda('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9cda('0x7'));var config=require('../../config/environment');var controller=require(_0x9cda('0x8'));router[_0x9cda('0x9')]('/',auth[_0x9cda('0xa')](),controller[_0x9cda('0xb')]);router[_0x9cda('0x9')](_0x9cda('0xc'),auth[_0x9cda('0xa')](),controller['describe']);router['get']('/:id',auth[_0x9cda('0xa')](),controller[_0x9cda('0xd')]);router[_0x9cda('0xe')]('/',auth['isAuthenticated'](),controller[_0x9cda('0xf')]);router['put'](_0x9cda('0x10'),auth[_0x9cda('0xa')](),controller[_0x9cda('0x11')]);router[_0x9cda('0x12')](_0x9cda('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x9cda('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 314f715..698754f 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 _0x45ac=['moment','blind','STRING','ENUM','sequelize'];(function(_0x10cf75,_0x2d0f55){var _0x593d74=function(_0x2b2f81){while(--_0x2b2f81){_0x10cf75['push'](_0x10cf75['shift']());}};_0x593d74(++_0x2d0f55);}(_0x45ac,0x153));var _0xc45a=function(_0x189029,_0x4acf21){_0x189029=_0x189029-0x0;var _0x234408=_0x45ac[_0x189029];return _0x234408;};'use strict';var Sequelize=require(_0xc45a('0x0'));var moment=require(_0xc45a('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xc45a('0x2'),'attended')},'result':{'type':Sequelize[_0xc45a('0x3')]},'transfererchannel':{'type':Sequelize[_0xc45a('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xc45a('0x3')]},'transferercalleridname':{'type':Sequelize[_0xc45a('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xc45a('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xc45a('0x3')]},'transferercontext':{'type':Sequelize[_0xc45a('0x3')]},'transfererexten':{'type':Sequelize[_0xc45a('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xc45a('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xc45a('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc45a('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc45a('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xc45a('0x3')]},'transfereecontext':{'type':Sequelize[_0xc45a('0x3')]},'transfereeexten':{'type':Sequelize[_0xc45a('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xc45a('0x3')]},'isexternal':{'type':Sequelize[_0xc45a('0x4')]('Yes','No')},'context':{'type':Sequelize[_0xc45a('0x3')]},'extension':{'type':Sequelize[_0xc45a('0x3')]}}; \ No newline at end of file +var _0xf21e=['STRING','Yes','moment','ENUM','blind'];(function(_0x1a3743,_0x3e8d02){var _0x795d17=function(_0x120a56){while(--_0x120a56){_0x1a3743['push'](_0x1a3743['shift']());}};_0x795d17(++_0x3e8d02);}(_0xf21e,0x138));var _0xef21=function(_0x3297d6,_0x11f231){_0x3297d6=_0x3297d6-0x0;var _0x29da4d=_0xf21e[_0x3297d6];return _0x29da4d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xef21('0x0'));module['exports']={'type':{'type':Sequelize[_0xef21('0x1')](_0xef21('0x2'),'attended')},'result':{'type':Sequelize[_0xef21('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xef21('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xef21('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xef21('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xef21('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xef21('0x3')]},'transfereechannel':{'type':Sequelize[_0xef21('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xef21('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xef21('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xef21('0x3')]},'transfereecontext':{'type':Sequelize[_0xef21('0x3')]},'transfereeexten':{'type':Sequelize[_0xef21('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xef21('0x3')]},'isexternal':{'type':Sequelize[_0xef21('0x1')](_0xef21('0x4'),'No')},'context':{'type':Sequelize[_0xef21('0x3')]},'extension':{'type':Sequelize[_0xef21('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a92c3a4..29702be 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 _0x20a6=['destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','length','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x20a6,0x117));var _0x620a=function(_0x4fa964,_0x10f9e6){_0x4fa964=_0x4fa964-0x0;var _0x2242a2=_0x20a6[_0x4fa964];return _0x2242a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x620a('0x0'));var zipdir=require(_0x620a('0x1'));var jsonpatch=require(_0x620a('0x2'));var rp=require(_0x620a('0x3'));var moment=require(_0x620a('0x4'));var BPromise=require(_0x620a('0x5'));var Mustache=require(_0x620a('0x6'));var util=require(_0x620a('0x7'));var path=require(_0x620a('0x8'));var sox=require(_0x620a('0x9'));var csv=require(_0x620a('0xa'));var ejs=require(_0x620a('0xb'));var fs=require('fs');var fs_extra=require(_0x620a('0xc'));var _=require(_0x620a('0xd'));var squel=require(_0x620a('0xe'));var crypto=require('crypto');var jsforce=require(_0x620a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x620a('0xa'));var querystring=require(_0x620a('0x10'));var Papa=require(_0x620a('0x11'));var Redis=require(_0x620a('0x12'));var authService=require(_0x620a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x620a('0x14'));var hardwareService=require(_0x620a('0x15'));var logger=require('../../config/logger')(_0x620a('0x16'));var utils=require(_0x620a('0x17'));var config=require(_0x620a('0x18'));var licenseUtil=require(_0x620a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d725d,_0x150d82){_0x150d82=_0x150d82||0xcc;return function(_0x58cbf4){if(_0x58cbf4){return _0x4d725d[_0x620a('0x1a')](_0x150d82);}return _0x4d725d[_0x620a('0x1b')](_0x150d82)[_0x620a('0x1c')]();};}function respondWithResult(_0x4d219e,_0x562e24){_0x562e24=_0x562e24||0xc8;return function(_0x131346){if(_0x131346){return _0x4d219e[_0x620a('0x1b')](_0x562e24)[_0x620a('0x1d')](_0x131346);}};}function respondWithFilteredResult(_0x2742df,_0x359fcb){return function(_0x5e3364){if(_0x5e3364){var _0x5ba96a=typeof _0x359fcb[_0x620a('0x1e')]===_0x620a('0x1f')&&typeof _0x359fcb[_0x620a('0x20')]===_0x620a('0x1f');var _0x31cb40=_0x5e3364[_0x620a('0x21')];var _0x1f3aad=_0x5ba96a?0x0:_0x359fcb[_0x620a('0x1e')];var _0x5ceb4a=_0x5ba96a?_0x5e3364[_0x620a('0x21')]:_0x359fcb[_0x620a('0x1e')]+_0x359fcb[_0x620a('0x20')];var _0x3d47eb;if(_0x5ceb4a>=_0x31cb40){_0x5ceb4a=_0x31cb40;_0x3d47eb=0xc8;}else{_0x3d47eb=0xce;}_0x2742df[_0x620a('0x1b')](_0x3d47eb);return _0x2742df[_0x620a('0x22')](_0x620a('0x23'),_0x1f3aad+'-'+_0x5ceb4a+'/'+_0x31cb40)[_0x620a('0x1d')](_0x5e3364);}return null;};}function patchUpdates(_0x203807){return function(_0x4036bc){try{jsonpatch[_0x620a('0x24')](_0x4036bc,_0x203807,!![]);}catch(_0x10535f){return BPromise[_0x620a('0x25')](_0x10535f);}return _0x4036bc[_0x620a('0x26')]();};}function saveUpdates(_0x1c3f7d,_0x1c70da){return function(_0x1e21b1){if(_0x1e21b1){return _0x1e21b1[_0x620a('0x27')](_0x1c3f7d)[_0x620a('0x28')](function(_0x10a616){return _0x10a616;});}return null;};}function removeEntity(_0x258486,_0x4820ba){return function(_0x49b0dd){if(_0x49b0dd){return _0x49b0dd[_0x620a('0x29')]()[_0x620a('0x28')](function(){_0x258486[_0x620a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31d050,_0x1cedcf){return function(_0x5f03ef){if(!_0x5f03ef){_0x31d050[_0x620a('0x1a')](0x194);}return _0x5f03ef;};}function handleError(_0x1858a2,_0x5eeb77){_0x5eeb77=_0x5eeb77||0x1f4;return function(_0xe4d2f){logger[_0x620a('0x2a')](_0xe4d2f[_0x620a('0x2b')]);if(_0xe4d2f[_0x620a('0x2c')]){delete _0xe4d2f[_0x620a('0x2c')];}_0x1858a2[_0x620a('0x1b')](_0x5eeb77)[_0x620a('0x2d')](_0xe4d2f);};}exports[_0x620a('0x2e')]=function(_0x3516c4,_0xe66db5){var _0x276aa4={},_0x511cc9={},_0x50368f={'count':0x0,'rows':[]};var _0x5309bb=_[_0x620a('0x2f')](db[_0x620a('0x30')][_0x620a('0x31')],function(_0x16d031){return{'name':_0x16d031[_0x620a('0x32')],'type':_0x16d031[_0x620a('0x33')][_0x620a('0x34')]};});_0x511cc9['model']=_[_0x620a('0x2f')](_0x5309bb,_0x620a('0x2c'));_0x511cc9[_0x620a('0x35')]=_['keys'](_0x3516c4['query']);_0x511cc9['filters']=_[_0x620a('0x36')](_0x511cc9[_0x620a('0x37')],_0x511cc9['query']);_0x276aa4[_0x620a('0x38')]=_[_0x620a('0x36')](_0x511cc9[_0x620a('0x37')],qs[_0x620a('0x39')](_0x3516c4['query'][_0x620a('0x39')]));_0x276aa4['attributes']=_0x276aa4['attributes']['length']?_0x276aa4[_0x620a('0x38')]:_0x511cc9[_0x620a('0x37')];if(!_0x3516c4['query'][_0x620a('0x3a')](_0x620a('0x3b'))){_0x276aa4['limit']=qs[_0x620a('0x20')](_0x3516c4['query'][_0x620a('0x20')]);_0x276aa4[_0x620a('0x1e')]=qs[_0x620a('0x1e')](_0x3516c4[_0x620a('0x35')][_0x620a('0x1e')]);}_0x276aa4['order']=qs[_0x620a('0x3c')](_0x3516c4[_0x620a('0x35')][_0x620a('0x3c')]);_0x276aa4['where']=qs[_0x620a('0x3d')](_[_0x620a('0x3e')](_0x3516c4[_0x620a('0x35')],_0x511cc9[_0x620a('0x3d')]),_0x5309bb);if(_0x3516c4[_0x620a('0x35')][_0x620a('0x3f')]){_0x276aa4[_0x620a('0x40')]=_[_0x620a('0x41')](_0x276aa4[_0x620a('0x40')],{'$or':_['map'](_0x5309bb,function(_0x1845d6){if(_0x1845d6[_0x620a('0x33')]!==_0x620a('0x42')){var _0x3e4c0a={};_0x3e4c0a[_0x1845d6[_0x620a('0x2c')]]={'$like':'%'+_0x3516c4[_0x620a('0x35')][_0x620a('0x3f')]+'%'};return _0x3e4c0a;}})});}_0x276aa4=_[_0x620a('0x41')]({},_0x276aa4,_0x3516c4[_0x620a('0x43')]);var _0x49e294={'where':_0x276aa4[_0x620a('0x40')]};return db[_0x620a('0x30')][_0x620a('0x21')](_0x49e294)[_0x620a('0x28')](function(_0x1de579){_0x50368f['count']=_0x1de579;if(_0x3516c4['query'][_0x620a('0x44')]){_0x276aa4[_0x620a('0x45')]=[{'all':!![]}];}return db[_0x620a('0x30')][_0x620a('0x46')](_0x276aa4);})['then'](function(_0x52ab29){_0x50368f['rows']=_0x52ab29;return _0x50368f;})[_0x620a('0x28')](respondWithFilteredResult(_0xe66db5,_0x276aa4))['catch'](handleError(_0xe66db5,null));};exports[_0x620a('0x47')]=function(_0x289911,_0x36c261){var _0x471bf8={'raw':!![],'where':{'id':_0x289911['params']['id']}},_0x583656={};_0x583656[_0x620a('0x37')]=_[_0x620a('0x48')](db['VoiceTransferReport'][_0x620a('0x31')]);_0x583656[_0x620a('0x35')]=_[_0x620a('0x48')](_0x289911[_0x620a('0x35')]);_0x583656[_0x620a('0x3d')]=_['intersection'](_0x583656[_0x620a('0x37')],_0x583656['query']);_0x471bf8['attributes']=_['intersection'](_0x583656['model'],qs[_0x620a('0x39')](_0x289911[_0x620a('0x35')][_0x620a('0x39')]));_0x471bf8[_0x620a('0x38')]=_0x471bf8[_0x620a('0x38')][_0x620a('0x49')]?_0x471bf8['attributes']:_0x583656[_0x620a('0x37')];if(_0x289911[_0x620a('0x35')][_0x620a('0x44')]){_0x471bf8[_0x620a('0x45')]=[{'all':!![]}];}_0x471bf8=_['merge']({},_0x471bf8,_0x289911[_0x620a('0x43')]);return db[_0x620a('0x30')][_0x620a('0x4a')](_0x471bf8)['then'](handleEntityNotFound(_0x36c261,null))[_0x620a('0x28')](respondWithResult(_0x36c261,null))[_0x620a('0x4b')](handleError(_0x36c261,null));};exports[_0x620a('0x4c')]=function(_0x177ebe,_0x364a54){return db[_0x620a('0x30')][_0x620a('0x4c')](_0x177ebe[_0x620a('0x4d')],{})['then'](respondWithResult(_0x364a54,0xc9))['catch'](handleError(_0x364a54,null));};exports['update']=function(_0x580dc2,_0x476eb4){if(_0x580dc2['body']['id']){delete _0x580dc2['body']['id'];}return db[_0x620a('0x30')][_0x620a('0x4a')]({'where':{'id':_0x580dc2[_0x620a('0x4e')]['id']}})[_0x620a('0x28')](handleEntityNotFound(_0x476eb4,null))[_0x620a('0x28')](saveUpdates(_0x580dc2[_0x620a('0x4d')],null))[_0x620a('0x28')](respondWithResult(_0x476eb4,null))[_0x620a('0x4b')](handleError(_0x476eb4,null));};exports[_0x620a('0x29')]=function(_0x153e5f,_0x33355f){return db[_0x620a('0x30')][_0x620a('0x4a')]({'where':{'id':_0x153e5f[_0x620a('0x4e')]['id']}})[_0x620a('0x28')](handleEntityNotFound(_0x33355f,null))['then'](removeEntity(_0x33355f,null))[_0x620a('0x4b')](handleError(_0x33355f,null));};exports[_0x620a('0x4f')]=function(_0x5538aa,_0x5e37a2){return db[_0x620a('0x30')][_0x620a('0x4f')]()[_0x620a('0x28')](respondWithResult(_0x5e37a2,null))[_0x620a('0x4b')](handleError(_0x5e37a2,null));}; \ No newline at end of file +var _0xaea4=['then','destroy','end','error','name','index','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update'];(function(_0x4dbaf2,_0x51c5cb){var _0x1739e8=function(_0x386783){while(--_0x386783){_0x4dbaf2['push'](_0x4dbaf2['shift']());}};_0x1739e8(++_0x51c5cb);}(_0xaea4,0xb9));var _0x4aea=function(_0x48d488,_0x1c2f91){_0x48d488=_0x48d488-0x0;var _0xc23a47=_0xaea4[_0x48d488];return _0xc23a47;};'use strict';var emlformat=require(_0x4aea('0x0'));var rimraf=require(_0x4aea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4aea('0x2'));var rp=require(_0x4aea('0x3'));var moment=require(_0x4aea('0x4'));var BPromise=require(_0x4aea('0x5'));var Mustache=require('mustache');var util=require(_0x4aea('0x6'));var path=require('path');var sox=require(_0x4aea('0x7'));var csv=require(_0x4aea('0x8'));var ejs=require(_0x4aea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4aea('0xa'));var crypto=require('crypto');var jsforce=require(_0x4aea('0xb'));var deskjs=require(_0x4aea('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4aea('0xd'));var Redis=require(_0x4aea('0xe'));var authService=require(_0x4aea('0xf'));var qs=require(_0x4aea('0x10'));var as=require(_0x4aea('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4aea('0x12'))(_0x4aea('0x13'));var utils=require(_0x4aea('0x14'));var config=require(_0x4aea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4aea('0x16'))['db'];function respondWithStatusCode(_0x385210,_0x3c208e){_0x3c208e=_0x3c208e||0xcc;return function(_0x53f128){if(_0x53f128){return _0x385210[_0x4aea('0x17')](_0x3c208e);}return _0x385210[_0x4aea('0x18')](_0x3c208e)['end']();};}function respondWithResult(_0x4b7875,_0x2e6af3){_0x2e6af3=_0x2e6af3||0xc8;return function(_0xfcab14){if(_0xfcab14){return _0x4b7875[_0x4aea('0x18')](_0x2e6af3)[_0x4aea('0x19')](_0xfcab14);}};}function respondWithFilteredResult(_0x303779,_0x35d39b){return function(_0x3962d5){if(_0x3962d5){var _0xee9a46=typeof _0x35d39b['offset']===_0x4aea('0x1a')&&typeof _0x35d39b[_0x4aea('0x1b')]===_0x4aea('0x1a');var _0x2823de=_0x3962d5[_0x4aea('0x1c')];var _0x347882=_0xee9a46?0x0:_0x35d39b[_0x4aea('0x1d')];var _0x31ad20=_0xee9a46?_0x3962d5[_0x4aea('0x1c')]:_0x35d39b[_0x4aea('0x1d')]+_0x35d39b[_0x4aea('0x1b')];var _0x7340ca;if(_0x31ad20>=_0x2823de){_0x31ad20=_0x2823de;_0x7340ca=0xc8;}else{_0x7340ca=0xce;}_0x303779['status'](_0x7340ca);return _0x303779[_0x4aea('0x1e')]('Content-Range',_0x347882+'-'+_0x31ad20+'/'+_0x2823de)[_0x4aea('0x19')](_0x3962d5);}return null;};}function patchUpdates(_0xc9dafa){return function(_0x35cf36){try{jsonpatch[_0x4aea('0x1f')](_0x35cf36,_0xc9dafa,!![]);}catch(_0x4e7860){return BPromise['reject'](_0x4e7860);}return _0x35cf36[_0x4aea('0x20')]();};}function saveUpdates(_0xcba3f1,_0x5f2603){return function(_0x10512c){if(_0x10512c){return _0x10512c[_0x4aea('0x21')](_0xcba3f1)[_0x4aea('0x22')](function(_0x20d77b){return _0x20d77b;});}return null;};}function removeEntity(_0x5af3c5,_0x55c5af){return function(_0x4bf73c){if(_0x4bf73c){return _0x4bf73c[_0x4aea('0x23')]()[_0x4aea('0x22')](function(){_0x5af3c5[_0x4aea('0x18')](0xcc)[_0x4aea('0x24')]();});}};}function handleEntityNotFound(_0x2f1169,_0x2768e5){return function(_0x3be0dc){if(!_0x3be0dc){_0x2f1169[_0x4aea('0x17')](0x194);}return _0x3be0dc;};}function handleError(_0x3aa75a,_0xbb5783){_0xbb5783=_0xbb5783||0x1f4;return function(_0x4e1e32){logger[_0x4aea('0x25')](_0x4e1e32['stack']);if(_0x4e1e32[_0x4aea('0x26')]){delete _0x4e1e32[_0x4aea('0x26')];}_0x3aa75a[_0x4aea('0x18')](_0xbb5783)['send'](_0x4e1e32);};}exports[_0x4aea('0x27')]=function(_0x2240d1,_0x6b895a){var _0xf0ee41={},_0x398dbf={},_0x3cc017={'count':0x0,'rows':[]};var _0x14b9f9=_['map'](db[_0x4aea('0x28')][_0x4aea('0x29')],function(_0x3bd021){return{'name':_0x3bd021[_0x4aea('0x2a')],'type':_0x3bd021['type'][_0x4aea('0x2b')]};});_0x398dbf[_0x4aea('0x2c')]=_['map'](_0x14b9f9,'name');_0x398dbf[_0x4aea('0x2d')]=_[_0x4aea('0x2e')](_0x2240d1[_0x4aea('0x2d')]);_0x398dbf[_0x4aea('0x2f')]=_['intersection'](_0x398dbf[_0x4aea('0x2c')],_0x398dbf[_0x4aea('0x2d')]);_0xf0ee41['attributes']=_[_0x4aea('0x30')](_0x398dbf[_0x4aea('0x2c')],qs[_0x4aea('0x31')](_0x2240d1[_0x4aea('0x2d')][_0x4aea('0x31')]));_0xf0ee41[_0x4aea('0x32')]=_0xf0ee41[_0x4aea('0x32')]['length']?_0xf0ee41[_0x4aea('0x32')]:_0x398dbf[_0x4aea('0x2c')];if(!_0x2240d1[_0x4aea('0x2d')][_0x4aea('0x33')](_0x4aea('0x34'))){_0xf0ee41[_0x4aea('0x1b')]=qs[_0x4aea('0x1b')](_0x2240d1[_0x4aea('0x2d')][_0x4aea('0x1b')]);_0xf0ee41[_0x4aea('0x1d')]=qs[_0x4aea('0x1d')](_0x2240d1[_0x4aea('0x2d')][_0x4aea('0x1d')]);}_0xf0ee41[_0x4aea('0x35')]=qs[_0x4aea('0x36')](_0x2240d1[_0x4aea('0x2d')][_0x4aea('0x36')]);_0xf0ee41[_0x4aea('0x37')]=qs['filters'](_['pick'](_0x2240d1['query'],_0x398dbf['filters']),_0x14b9f9);if(_0x2240d1['query']['filter']){_0xf0ee41[_0x4aea('0x37')]=_['merge'](_0xf0ee41[_0x4aea('0x37')],{'$or':_['map'](_0x14b9f9,function(_0x2ad0a7){if(_0x2ad0a7[_0x4aea('0x38')]!==_0x4aea('0x39')){var _0x193afc={};_0x193afc[_0x2ad0a7[_0x4aea('0x26')]]={'$like':'%'+_0x2240d1[_0x4aea('0x2d')][_0x4aea('0x3a')]+'%'};return _0x193afc;}})});}_0xf0ee41=_['merge']({},_0xf0ee41,_0x2240d1['options']);var _0x5cf801={'where':_0xf0ee41[_0x4aea('0x37')]};return db[_0x4aea('0x28')][_0x4aea('0x1c')](_0x5cf801)[_0x4aea('0x22')](function(_0xb8699d){_0x3cc017['count']=_0xb8699d;if(_0x2240d1[_0x4aea('0x2d')][_0x4aea('0x3b')]){_0xf0ee41[_0x4aea('0x3c')]=[{'all':!![]}];}return db[_0x4aea('0x28')][_0x4aea('0x3d')](_0xf0ee41);})[_0x4aea('0x22')](function(_0x2c3a6d){_0x3cc017[_0x4aea('0x3e')]=_0x2c3a6d;return _0x3cc017;})[_0x4aea('0x22')](respondWithFilteredResult(_0x6b895a,_0xf0ee41))[_0x4aea('0x3f')](handleError(_0x6b895a,null));};exports[_0x4aea('0x40')]=function(_0x2d4e0a,_0x1daef0){var _0xbed1ab={'raw':!![],'where':{'id':_0x2d4e0a[_0x4aea('0x41')]['id']}},_0x453baa={};_0x453baa[_0x4aea('0x2c')]=_[_0x4aea('0x2e')](db[_0x4aea('0x28')]['rawAttributes']);_0x453baa[_0x4aea('0x2d')]=_[_0x4aea('0x2e')](_0x2d4e0a[_0x4aea('0x2d')]);_0x453baa[_0x4aea('0x2f')]=_['intersection'](_0x453baa[_0x4aea('0x2c')],_0x453baa[_0x4aea('0x2d')]);_0xbed1ab['attributes']=_[_0x4aea('0x30')](_0x453baa[_0x4aea('0x2c')],qs[_0x4aea('0x31')](_0x2d4e0a[_0x4aea('0x2d')][_0x4aea('0x31')]));_0xbed1ab[_0x4aea('0x32')]=_0xbed1ab[_0x4aea('0x32')][_0x4aea('0x42')]?_0xbed1ab[_0x4aea('0x32')]:_0x453baa[_0x4aea('0x2c')];if(_0x2d4e0a[_0x4aea('0x2d')]['includeAll']){_0xbed1ab['include']=[{'all':!![]}];}_0xbed1ab=_[_0x4aea('0x43')]({},_0xbed1ab,_0x2d4e0a[_0x4aea('0x44')]);return db['VoiceTransferReport'][_0x4aea('0x45')](_0xbed1ab)[_0x4aea('0x22')](handleEntityNotFound(_0x1daef0,null))[_0x4aea('0x22')](respondWithResult(_0x1daef0,null))['catch'](handleError(_0x1daef0,null));};exports['create']=function(_0x39357d,_0x37a9d8){return db[_0x4aea('0x28')][_0x4aea('0x46')](_0x39357d[_0x4aea('0x47')],{})[_0x4aea('0x22')](respondWithResult(_0x37a9d8,0xc9))[_0x4aea('0x3f')](handleError(_0x37a9d8,null));};exports[_0x4aea('0x21')]=function(_0x37fa0a,_0x8c3558){if(_0x37fa0a['body']['id']){delete _0x37fa0a[_0x4aea('0x47')]['id'];}return db[_0x4aea('0x28')][_0x4aea('0x45')]({'where':{'id':_0x37fa0a['params']['id']}})[_0x4aea('0x22')](handleEntityNotFound(_0x8c3558,null))[_0x4aea('0x22')](saveUpdates(_0x37fa0a[_0x4aea('0x47')],null))[_0x4aea('0x22')](respondWithResult(_0x8c3558,null))[_0x4aea('0x3f')](handleError(_0x8c3558,null));};exports['destroy']=function(_0x518dca,_0x442b51){return db[_0x4aea('0x28')][_0x4aea('0x45')]({'where':{'id':_0x518dca[_0x4aea('0x41')]['id']}})[_0x4aea('0x22')](handleEntityNotFound(_0x442b51,null))[_0x4aea('0x22')](removeEntity(_0x442b51,null))[_0x4aea('0x3f')](handleError(_0x442b51,null));};exports[_0x4aea('0x48')]=function(_0x47defd,_0x1e69b9){return db['VoiceTransferReport'][_0x4aea('0x48')]()[_0x4aea('0x22')](respondWithResult(_0x1e69b9,null))['catch'](handleError(_0x1e69b9,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f219efc..7d7361e 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 _0x0ece=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer'];(function(_0x1681e0,_0x210512){var _0x2b90de=function(_0x3cf624){while(--_0x3cf624){_0x1681e0['push'](_0x1681e0['shift']());}};_0x2b90de(++_0x210512);}(_0x0ece,0x168));var _0xe0ec=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0ece[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe0ec('0x0'));var util=require(_0xe0ec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe0ec('0x2'));var BPromise=require(_0xe0ec('0x3'));var rp=require(_0xe0ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0ec('0x5'));var config=require(_0xe0ec('0x6'));var attributes=require(_0xe0ec('0x7'));module['exports']=function(_0x15ab9b,_0x8a4a77){return _0x15ab9b[_0xe0ec('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xe0ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19f2=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','bluebird','request-promise','path','../../config/environment'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x19f2,0x162));var _0x219f=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x19f2[_0x284506];return _0x1e9ee5;};'use strict';var _=require(_0x219f('0x0'));var util=require(_0x219f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x219f('0x2'));var rp=require(_0x219f('0x3'));var fs=require('fs');var path=require(_0x219f('0x4'));var rimraf=require('rimraf');var config=require(_0x219f('0x5'));var attributes=require(_0x219f('0x6'));module[_0x219f('0x7')]=function(_0x392539,_0x4f58e3){return _0x392539[_0x219f('0x8')](_0x219f('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 1e4d1da..a6ca541 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 _0x9554=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','moment','bluebird'];(function(_0x17425f,_0x5e2da9){var _0x39c976=function(_0x4d6ba0){while(--_0x4d6ba0){_0x17425f['push'](_0x17425f['shift']());}};_0x39c976(++_0x5e2da9);}(_0x9554,0x178));var _0x4955=function(_0x30ac56,_0xefd05b){_0x30ac56=_0x30ac56-0x0;var _0xefbc5d=_0x9554[_0x30ac56];return _0xefbc5d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4955('0x0'));var BPromise=require(_0x4955('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4955('0x2'))['db'];var utils=require(_0x4955('0x3'));var logger=require(_0x4955('0x4'))(_0x4955('0x5'));var config=require(_0x4955('0x6'));var jayson=require(_0x4955('0x7'));var client=jayson[_0x4955('0x8')][_0x4955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c8893,_0x4f3940,_0x593927){return new BPromise(function(_0x18ee16,_0xbd538){return client[_0x4955('0xa')](_0x5c8893,_0x593927)[_0x4955('0xb')](function(_0xb33da9){logger['info'](_0x4955('0xc'),_0x4f3940,_0x4955('0xd'));logger[_0x4955('0xe')](_0x4955('0xf'),_0x4f3940,'request\x20sent',JSON[_0x4955('0x10')](_0xb33da9));if(_0xb33da9[_0x4955('0x11')]){if(_0xb33da9[_0x4955('0x11')]['code']===0x1f4){logger[_0x4955('0x11')](_0x4955('0xc'),_0x4f3940,_0xb33da9[_0x4955('0x11')][_0x4955('0x12')]);return _0xbd538(_0xb33da9[_0x4955('0x11')][_0x4955('0x12')]);}logger['error'](_0x4955('0xc'),_0x4f3940,_0xb33da9[_0x4955('0x11')]['message']);return _0x18ee16(_0xb33da9[_0x4955('0x11')][_0x4955('0x12')]);}else{logger[_0x4955('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f3940,'request\x20sent');_0x18ee16(_0xb33da9['result'][_0x4955('0x12')]);}})[_0x4955('0x14')](function(_0x5a2867){logger[_0x4955('0x11')](_0x4955('0xc'),_0x4f3940,_0x5a2867);_0xbd538(_0x5a2867);});});}exports[_0x4955('0x15')]=function(_0x28286c){var _0x466cc9=this;return new Promise(function(_0x39511f,_0x443ade){return db[_0x4955('0x16')][_0x4955('0x17')](_0x28286c[_0x4955('0x18')],{'raw':_0x28286c[_0x4955('0x19')]?_0x28286c[_0x4955('0x19')][_0x4955('0x1a')]===undefined?!![]:![]:!![]})[_0x4955('0xb')](function(_0x2182b1){logger[_0x4955('0x13')](_0x4955('0x15'),_0x28286c);logger[_0x4955('0xe')](_0x4955('0x15'),_0x28286c,JSON[_0x4955('0x10')](_0x2182b1));_0x39511f(_0x2182b1);})[_0x4955('0x14')](function(_0x28e2d6){logger[_0x4955('0x11')](_0x4955('0x15'),_0x28e2d6[_0x4955('0x12')],_0x28286c);_0x443ade(_0x466cc9[_0x4955('0x11')](0x1f4,_0x28e2d6[_0x4955('0x12')]));});});}; \ No newline at end of file +var _0xcea4=['client','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','CreateVoiceTransferReport','create','body','options','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xcea4,0xc0));var _0x4cea=function(_0x34217a,_0x1f545a){_0x34217a=_0x34217a-0x0;var _0x23c2be=_0xcea4[_0x34217a];return _0x23c2be;};'use strict';var _=require(_0x4cea('0x0'));var util=require(_0x4cea('0x1'));var moment=require(_0x4cea('0x2'));var BPromise=require(_0x4cea('0x3'));var rs=require(_0x4cea('0x4'));var fs=require('fs');var Redis=require(_0x4cea('0x5'));var db=require(_0x4cea('0x6'))['db'];var utils=require(_0x4cea('0x7'));var logger=require('../../config/logger')(_0x4cea('0x8'));var config=require(_0x4cea('0x9'));var jayson=require(_0x4cea('0xa'));var client=jayson[_0x4cea('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e9f8d,_0x3a3908,_0x359f71){return new BPromise(function(_0x23fe48,_0x14926a){return client[_0x4cea('0xc')](_0x5e9f8d,_0x359f71)[_0x4cea('0xd')](function(_0x5b5e0d){logger[_0x4cea('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x3a3908,_0x4cea('0xf'));logger[_0x4cea('0x10')](_0x4cea('0x11'),_0x3a3908,_0x4cea('0xf'),JSON[_0x4cea('0x12')](_0x5b5e0d));if(_0x5b5e0d[_0x4cea('0x13')]){if(_0x5b5e0d[_0x4cea('0x13')][_0x4cea('0x14')]===0x1f4){logger['error'](_0x4cea('0x15'),_0x3a3908,_0x5b5e0d[_0x4cea('0x13')][_0x4cea('0x16')]);return _0x14926a(_0x5b5e0d[_0x4cea('0x13')][_0x4cea('0x16')]);}logger[_0x4cea('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x3a3908,_0x5b5e0d[_0x4cea('0x13')][_0x4cea('0x16')]);return _0x23fe48(_0x5b5e0d[_0x4cea('0x13')]['message']);}else{logger[_0x4cea('0xe')](_0x4cea('0x15'),_0x3a3908,_0x4cea('0xf'));_0x23fe48(_0x5b5e0d[_0x4cea('0x17')]['message']);}})['catch'](function(_0x1319b0){logger[_0x4cea('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x3a3908,_0x1319b0);_0x14926a(_0x1319b0);});});}exports[_0x4cea('0x18')]=function(_0x34a6c0){var _0x5b36a2=this;return new Promise(function(_0x8e1ff4,_0xe2041d){return db['VoiceTransferReport'][_0x4cea('0x19')](_0x34a6c0[_0x4cea('0x1a')],{'raw':_0x34a6c0[_0x4cea('0x1b')]?_0x34a6c0[_0x4cea('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5d932b){logger[_0x4cea('0xe')]('CreateVoiceTransferReport',_0x34a6c0);logger[_0x4cea('0x10')](_0x4cea('0x18'),_0x34a6c0,JSON[_0x4cea('0x12')](_0x5d932b));_0x8e1ff4(_0x5d932b);})[_0x4cea('0x1c')](function(_0x5602f9){logger['error'](_0x4cea('0x18'),_0x5602f9[_0x4cea('0x16')],_0x34a6c0);_0xe2041d(_0x5b36a2[_0x4cea('0x13')](0x1f4,_0x5602f9['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9449cd7..bfd6462 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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x563b94,_0x17a4ee){var _0x1f4d7f=function(_0x27a902){while(--_0x27a902){_0x563b94['push'](_0x563b94['shift']());}};_0x1f4d7f(++_0x17a4ee);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xb4e6[_0x16bb4b];return _0x8aeb84;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file +var _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0x15d58c,_0x3054f3){var _0x2637fd=function(_0xb4b472){while(--_0xb4b472){_0x15d58c['push'](_0x15d58c['shift']());}};_0x2637fd(++_0x3054f3);}(_0x153f,0x15b));var _0xf153=function(_0x29d2b4,_0x3ee8fc){_0x29d2b4=_0x29d2b4-0x0;var _0x15966b=_0x153f[_0x29d2b4];return _0x15966b;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 03c1446..fe7ea3d 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 _0xf290=['lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','name','status','send','then','error','code','message','result','catch','User','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','body','json','userId','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!'];(function(_0x7bdda5,_0x3358f5){var _0x45be29=function(_0x7b64ff){while(--_0x7b64ff){_0x7bdda5['push'](_0x7bdda5['shift']());}};_0x45be29(++_0x3358f5);}(_0xf290,0xde));var _0x0f29=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xf290[_0x219d87];return _0x22823d;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0f29('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x0f29('0x1'));var util=require('util');var BPromise=require(_0x0f29('0x2'));var jayson=require(_0x0f29('0x3'));var amiClient=jayson[_0x0f29('0x4')][_0x0f29('0x5')]({'port':0x232a});var logger=require(_0x0f29('0x6'))('webbarapi');var Redis=require(_0x0f29('0x7'));config['redis']=_[_0x0f29('0x8')](config[_0x0f29('0x9')],{'host':_0x0f29('0xa'),'port':0x18eb});var io=require(_0x0f29('0xb'))(new Redis(config[_0x0f29('0x9')]));var Schema=require(_0x0f29('0xc'));var originateValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'callNumber':{'type':_0x0f29('0xf'),'required':[!![],_0x0f29('0x10')]},'callerId':{'type':_0x0f29('0xf')},'callbackUrl':{'type':_0x0f29('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0f29('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':[!![],_0x0f29('0x11')]},'transferNumber':{'type':_0x0f29('0xf'),'required':[!![],_0x0f29('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x4ac37d,_0x2be27f,_0x3151a5){logger[_0x0f29('0x13')](_0x4ac37d,_0x2be27f,JSON[_0x0f29('0x14')](_0x3151a5));io['to'](_0x4ac37d)['emit'](_0x2be27f,_0x3151a5);}function handleError(_0x122bfa){return function(_0x5d72a5){console[_0x0f29('0x15')]('handleError:',_0x5d72a5,_0x5d72a5 instanceof RangeError);logger['error'](_0x5d72a5['stack']);if(_0x5d72a5 instanceof RangeError){if(_0x5d72a5[_0x0f29('0x16')]){delete _0x5d72a5[_0x0f29('0x16')];}_0x122bfa[_0x0f29('0x17')](0x194)[_0x0f29('0x18')](_0x5d72a5);}else{if(_0x5d72a5[_0x0f29('0x16')]){delete _0x5d72a5[_0x0f29('0x16')];}_0x122bfa[_0x0f29('0x17')](0x1f4)['send'](_0x5d72a5);}};}function checkError(){return function(_0x49d954){if(!_0x49d954){throw new RangeError('NotFound');}return _0x49d954;};}function respondWithRpcPromise(_0x5ab592,_0x55d92e){return new BPromise(function(_0x5d94b9,_0x38a1ce){var _0x4a9dd8=amiClient;return _0x4a9dd8['request'](_0x5ab592,_0x55d92e)[_0x0f29('0x19')](function(_0x1840e0){if(_0x1840e0[_0x0f29('0x1a')]){if(_0x1840e0[_0x0f29('0x1a')][_0x0f29('0x1b')]===0x1f4){return _0x38a1ce(_0x1840e0['error'][_0x0f29('0x1c')]);}return _0x5d94b9(_0x1840e0['error'][_0x0f29('0x1c')]);}else{_0x5d94b9(_0x1840e0[_0x0f29('0x1d')]);}})[_0x0f29('0x1e')](function(_0x28cfaa){_0x38a1ce(_0x28cfaa);});});}function getAgent(_0x57667b){return db[_0x0f29('0x1f')]['findOne']({'where':{'id':_0x57667b,'role':'agent'}})[_0x0f29('0x19')](checkError());}function getAgentCheckSession(_0x5c0202,_0x5bfcac){return new BPromise(function(_0x57dcc7,_0x4dd0b0){var _0x3c6ce9=respondWithRpcPromise(_0x0f29('0x20'));var _0x4cc5a0=getAgent(_0x5c0202);Promise[_0x0f29('0x21')]([_0x3c6ce9,_0x4cc5a0])[_0x0f29('0x19')](function(_0x274c9d){var _0x51e7dc=_0x274c9d[0x0];var _0x56e729=_0x274c9d[0x1];var _0x37ebcc=_['filter'](_0x51e7dc[_0x0f29('0x22')],function(_0x561c31){return _0x561c31['UserId']==_0x56e729['id']&&_0x561c31[_0x0f29('0x23')]==_0x5bfcac;});if(_0x37ebcc[_0x0f29('0x24')]==0x1){_0x57dcc7(_0x56e729);}else{_0x4dd0b0(new RangeError(_0x0f29('0x25')+_0x5bfcac+_0x0f29('0x26')));}});});}exports['originate']=function(_0x52a501,_0x3bb3c8){logger['info']('originate\x20fired:',_0x52a501[_0x0f29('0x27')]);var _0x5baebb=originateValidation[_0x0f29('0xc')](_0x52a501['body']);if(_0x5baebb['length']>0x0){return _0x3bb3c8[_0x0f29('0x17')](0x190)[_0x0f29('0x28')](_0x5baebb);}var _0x3ea452=_0x52a501[_0x0f29('0x27')][_0x0f29('0x29')];var _0x4d0504=_0x52a501[_0x0f29('0x27')]['callNumber'];var _0x2cc510=_0x52a501[_0x0f29('0x27')][_0x0f29('0x2a')];var _0x1320a3=_0x52a501['body'][_0x0f29('0x2b')];return getAgent(_0x3ea452)[_0x0f29('0x19')](function(_0x5be4fa){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x5be4fa['name']);emit(util['format'](_0x0f29('0x2d'),_0x5be4fa[_0x0f29('0x16')]),_0x0f29('0x2e'),{'callNumber':_0x4d0504,'callerId':_0x2cc510,'callbackUrl':_0x1320a3});return _0x3bb3c8[_0x0f29('0x17')](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x2f')});})['catch'](handleError(_0x3bb3c8));};exports[_0x0f29('0x30')]=function(_0x5a538e,_0x331dc7){logger['info'](_0x0f29('0x31'),_0x5a538e[_0x0f29('0x27')]);var _0x6d4c82=hangupValidation['validate'](_0x5a538e['body']);if(_0x6d4c82[_0x0f29('0x24')]>0x0){return _0x331dc7['status'](0x190)[_0x0f29('0x28')](_0x6d4c82);}var _0x3f49f8=_0x5a538e[_0x0f29('0x27')][_0x0f29('0x29')];var _0x9ae45d=_0x5a538e['body'][_0x0f29('0x23')];return getAgent(_0x3f49f8)[_0x0f29('0x19')](function(_0x42872b){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x42872b[_0x0f29('0x16')]);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x42872b[_0x0f29('0x16')]),'webbar:hangup',{'sessionId':_0x9ae45d});return _0x331dc7[_0x0f29('0x17')](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x33')});})[_0x0f29('0x1e')](handleError(_0x331dc7));};exports['answer']=function(_0x10e800,_0xfc9257){logger[_0x0f29('0x13')](_0x0f29('0x34'),_0x10e800[_0x0f29('0x27')]);var _0x56062d=answerValidation[_0x0f29('0xc')](_0x10e800[_0x0f29('0x27')]);if(_0x56062d[_0x0f29('0x24')]>0x0){return _0xfc9257['status'](0x190)[_0x0f29('0x28')](_0x56062d);}var _0x284279=_0x10e800[_0x0f29('0x27')][_0x0f29('0x29')];var _0x35f753=_0x10e800[_0x0f29('0x27')][_0x0f29('0x23')];return getAgent(_0x284279)[_0x0f29('0x19')](function(_0x4b6b6a){logger['info']('entityFound:',_0x4b6b6a[_0x0f29('0x16')]);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x4b6b6a[_0x0f29('0x16')]),_0x0f29('0x35'),{'sessionId':_0x35f753});return _0xfc9257[_0x0f29('0x17')](0xc8)['json']({'error':![],'message':_0x0f29('0x36')});})['catch'](handleError(_0xfc9257));};exports[_0x0f29('0x37')]=function(_0x57242c,_0x284036){logger[_0x0f29('0x13')](_0x0f29('0x38'),_0x57242c[_0x0f29('0x27')]);var _0x301fc8=holdValidation['validate'](_0x57242c[_0x0f29('0x27')]);if(_0x301fc8[_0x0f29('0x24')]>0x0){return _0x284036[_0x0f29('0x17')](0x190)['json'](_0x301fc8);}var _0x14b747=_0x57242c['body']['userId'];var _0x21c0a4=_0x57242c[_0x0f29('0x27')][_0x0f29('0x23')];return getAgent(_0x14b747)[_0x0f29('0x19')](function(_0x20aa53){logger[_0x0f29('0x13')]('entityFound:',_0x20aa53[_0x0f29('0x16')]);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x20aa53[_0x0f29('0x16')]),_0x0f29('0x39'),{'sessionId':_0x21c0a4});return _0x284036[_0x0f29('0x17')](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x3a')});})[_0x0f29('0x1e')](handleError(_0x284036));};exports[_0x0f29('0x3b')]=function(_0x5cd4a9,_0x5e4479){logger[_0x0f29('0x13')](_0x0f29('0x3c'),_0x5cd4a9[_0x0f29('0x27')]);var _0x178f21=unholdValidation['validate'](_0x5cd4a9[_0x0f29('0x27')]);if(_0x178f21[_0x0f29('0x24')]>0x0){return _0x5e4479[_0x0f29('0x17')](0x190)[_0x0f29('0x28')](_0x178f21);}var _0xbf8f22=_0x5cd4a9[_0x0f29('0x27')][_0x0f29('0x29')];var _0x59aeb9=_0x5cd4a9[_0x0f29('0x27')][_0x0f29('0x23')];return getAgent(_0xbf8f22)[_0x0f29('0x19')](function(_0x2c6a95){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x2c6a95['name']);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x2c6a95[_0x0f29('0x16')]),'webbar:unhold',{'sessionId':_0x59aeb9});return _0x5e4479[_0x0f29('0x17')](0xc8)['json']({'error':![],'message':_0x0f29('0x3d')});})['catch'](handleError(_0x5e4479));};exports[_0x0f29('0x3e')]=function(_0x3fcda8,_0x4a490a){logger[_0x0f29('0x13')](_0x0f29('0x3f'),_0x4a490a[_0x0f29('0x27')]);var _0x4a2c08=callsValidation[_0x0f29('0xc')](_0x3fcda8['body']);if(_0x4a2c08[_0x0f29('0x24')]>0x0){return _0x4a490a[_0x0f29('0x17')](0x190)['json'](_0x4a2c08);}var _0x1c46a6=_0x3fcda8[_0x0f29('0x27')]['userId'];var _0xbe013b=respondWithRpcPromise('VoiceChannels');var _0x1baaf8=getAgent(_0x1c46a6);return Promise['all']([_0xbe013b,_0x1baaf8])[_0x0f29('0x19')](function(_0x302d05){var _0x36a7df=_0x302d05[0x0];var _0x4ba5c3=_0x302d05[0x1];var _0x36e714=_[_0x0f29('0x40')](_0x36a7df[_0x0f29('0x22')],function(_0x46c22c){return _0x46c22c['UserId']==_0x4ba5c3['id'];});return _0x4a490a[_0x0f29('0x17')](0xc8)['json']({'count':_0x36e714[_0x0f29('0x24')],'rows':_0x36e714});})['catch'](handleError(_0x4a490a));};exports[_0x0f29('0x41')]=function(_0x3eafc8,_0x306b24){logger[_0x0f29('0x13')](_0x0f29('0x42'),_0x3eafc8[_0x0f29('0x27')]);var _0x272a9e=conferenceValidation['validate'](_0x3eafc8[_0x0f29('0x27')]);if(_0x272a9e['length']>0x0){return _0x306b24[_0x0f29('0x17')](0x190)[_0x0f29('0x28')](_0x272a9e);}var _0x357437=_0x3eafc8['body'][_0x0f29('0x29')];return getAgent(_0x357437)[_0x0f29('0x19')](function(_0x115dbe){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x115dbe['name']);emit(util['format'](_0x0f29('0x2d'),_0x115dbe[_0x0f29('0x16')]),_0x0f29('0x43'));return _0x306b24['status'](0xc8)['json']({'error':![],'message':_0x0f29('0x44')});})[_0x0f29('0x1e')](handleError(_0x306b24));};exports[_0x0f29('0x45')]=function(_0x4a7e9f,_0x520e92){logger['info'](_0x0f29('0x46'),_0x4a7e9f[_0x0f29('0x27')]);var _0x49a7b3=transferValidation[_0x0f29('0xc')](_0x4a7e9f[_0x0f29('0x27')]);if(_0x49a7b3['length']>0x0){return _0x520e92[_0x0f29('0x17')](0x190)['json'](_0x49a7b3);}var _0x41f20a=_0x4a7e9f[_0x0f29('0x27')]['userId'];var _0x2e423a=_0x4a7e9f[_0x0f29('0x27')][_0x0f29('0x23')];var _0x2d5ce4=_0x4a7e9f[_0x0f29('0x27')][_0x0f29('0x47')];return getAgent(_0x41f20a)['then'](function(_0x2babb0){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x2babb0['name']);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x2babb0['name']),_0x0f29('0x48'),{'sessionId':_0x2e423a,'transferNumber':_0x2d5ce4});return _0x520e92['status'](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x49')});})[_0x0f29('0x1e')](handleError(_0x520e92));}; \ No newline at end of file +var _0xf120=['validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','stack','name','status','request','then','error','result','catch','findOne','agent','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','info','hangup\x20fired:','sessionId','format','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter'];(function(_0x4fe196,_0x2ce8f1){var _0x50355e=function(_0x154f0f){while(--_0x154f0f){_0x4fe196['push'](_0x4fe196['shift']());}};_0x50355e(++_0x2ce8f1);}(_0xf120,0x179));var _0x0f12=function(_0x62bfbc,_0x2fbe4f){_0x62bfbc=_0x62bfbc-0x0;var _0x1b39e7=_0xf120[_0x62bfbc];return _0x1b39e7;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0f12('0x0'));var db=require(_0x0f12('0x1'))['db'];var config=require(_0x0f12('0x2'));var util=require('util');var BPromise=require(_0x0f12('0x3'));var jayson=require(_0x0f12('0x4'));var amiClient=jayson[_0x0f12('0x5')]['http']({'port':0x232a});var logger=require(_0x0f12('0x6'))(_0x0f12('0x7'));var Redis=require(_0x0f12('0x8'));config[_0x0f12('0x9')]=_[_0x0f12('0xa')](config[_0x0f12('0x9')],{'host':_0x0f12('0xb'),'port':0x18eb});var io=require(_0x0f12('0xc'))(new Redis(config['redis']));var Schema=require(_0x0f12('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0f12('0xe')]},'callNumber':{'type':_0x0f12('0xf'),'required':[!![],_0x0f12('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x0f12('0x11'),'required':[!![],_0x0f12('0xe')]},'sessionId':{'type':_0x0f12('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0f12('0x11'),'required':[!![],_0x0f12('0xe')]},'sessionId':{'type':_0x0f12('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0f12('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0f12('0xf'),'required':[!![],_0x0f12('0x12')]},'transferNumber':{'type':_0x0f12('0xf'),'required':[!![],_0x0f12('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x0f12('0x11'),'required':[!![],_0x0f12('0xe')]},'sessionId':{'type':_0x0f12('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0f12('0x11'),'required':[!![],_0x0f12('0xe')]},'sessionId':{'type':_0x0f12('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0f12('0x11'),'required':[!![],_0x0f12('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0f12('0x11'),'required':[!![],_0x0f12('0xe')]}});function emit(_0xeccb7c,_0x592617,_0x1db207){logger['info'](_0xeccb7c,_0x592617,JSON[_0x0f12('0x14')](_0x1db207));io['to'](_0xeccb7c)[_0x0f12('0x15')](_0x592617,_0x1db207);}function handleError(_0x28119e){return function(_0x12eb6c){console[_0x0f12('0x16')](_0x0f12('0x17'),_0x12eb6c,_0x12eb6c instanceof RangeError);logger['error'](_0x12eb6c[_0x0f12('0x18')]);if(_0x12eb6c instanceof RangeError){if(_0x12eb6c['name']){delete _0x12eb6c[_0x0f12('0x19')];}_0x28119e['status'](0x194)['send'](_0x12eb6c);}else{if(_0x12eb6c[_0x0f12('0x19')]){delete _0x12eb6c[_0x0f12('0x19')];}_0x28119e[_0x0f12('0x1a')](0x1f4)['send'](_0x12eb6c);}};}function checkError(){return function(_0x10a325){if(!_0x10a325){throw new RangeError('NotFound');}return _0x10a325;};}function respondWithRpcPromise(_0x26b2d7,_0x5b8598){return new BPromise(function(_0x9f283b,_0x379851){var _0x4f06bd=amiClient;return _0x4f06bd[_0x0f12('0x1b')](_0x26b2d7,_0x5b8598)[_0x0f12('0x1c')](function(_0x3a28ae){if(_0x3a28ae[_0x0f12('0x1d')]){if(_0x3a28ae[_0x0f12('0x1d')]['code']===0x1f4){return _0x379851(_0x3a28ae[_0x0f12('0x1d')]['message']);}return _0x9f283b(_0x3a28ae['error']['message']);}else{_0x9f283b(_0x3a28ae[_0x0f12('0x1e')]);}})[_0x0f12('0x1f')](function(_0xa67a43){_0x379851(_0xa67a43);});});}function getAgent(_0x13e737){return db['User'][_0x0f12('0x20')]({'where':{'id':_0x13e737,'role':_0x0f12('0x21')}})[_0x0f12('0x1c')](checkError());}function getAgentCheckSession(_0x5ca297,_0x13baa0){return new BPromise(function(_0x2fdde4,_0x8f43f9){var _0x5cb12b=respondWithRpcPromise(_0x0f12('0x22'));var _0x25a5dc=getAgent(_0x5ca297);Promise[_0x0f12('0x23')]([_0x5cb12b,_0x25a5dc])[_0x0f12('0x1c')](function(_0x1c7d2b){var _0x5693e4=_0x1c7d2b[0x0];var _0x5531ed=_0x1c7d2b[0x1];var _0x343ae0=_['filter'](_0x5693e4[_0x0f12('0x24')],function(_0x3c6ce5){return _0x3c6ce5[_0x0f12('0x25')]==_0x5531ed['id']&&_0x3c6ce5['sessionId']==_0x13baa0;});if(_0x343ae0[_0x0f12('0x26')]==0x1){_0x2fdde4(_0x5531ed);}else{_0x8f43f9(new RangeError(_0x0f12('0x27')+_0x13baa0+_0x0f12('0x28')));}});});}exports[_0x0f12('0x29')]=function(_0x1672da,_0x25d56e){logger['info'](_0x0f12('0x2a'),_0x1672da[_0x0f12('0x2b')]);var _0x3d49fe=originateValidation['validate'](_0x1672da[_0x0f12('0x2b')]);if(_0x3d49fe[_0x0f12('0x26')]>0x0){return _0x25d56e[_0x0f12('0x1a')](0x190)[_0x0f12('0x2c')](_0x3d49fe);}var _0x5a7d94=_0x1672da[_0x0f12('0x2b')][_0x0f12('0x2d')];var _0x3d0a71=_0x1672da[_0x0f12('0x2b')][_0x0f12('0x2e')];var _0x7efa57=_0x1672da[_0x0f12('0x2b')]['callerId'];var _0x15a508=_0x1672da[_0x0f12('0x2b')]['callbackUrl'];return getAgent(_0x5a7d94)[_0x0f12('0x1c')](function(_0x40715e){logger['info'](_0x0f12('0x2f'),_0x40715e[_0x0f12('0x19')]);emit(util['format'](_0x0f12('0x30'),_0x40715e['name']),_0x0f12('0x31'),{'callNumber':_0x3d0a71,'callerId':_0x7efa57,'callbackUrl':_0x15a508});return _0x25d56e[_0x0f12('0x1a')](0xc8)[_0x0f12('0x2c')]({'error':![],'message':_0x0f12('0x32')});})[_0x0f12('0x1f')](handleError(_0x25d56e));};exports[_0x0f12('0x33')]=function(_0x2912b8,_0x1d48a7){logger[_0x0f12('0x34')](_0x0f12('0x35'),_0x2912b8['body']);var _0x3be0b6=hangupValidation[_0x0f12('0xd')](_0x2912b8[_0x0f12('0x2b')]);if(_0x3be0b6['length']>0x0){return _0x1d48a7['status'](0x190)['json'](_0x3be0b6);}var _0x21791c=_0x2912b8[_0x0f12('0x2b')]['userId'];var _0x4bf268=_0x2912b8[_0x0f12('0x2b')][_0x0f12('0x36')];return getAgent(_0x21791c)[_0x0f12('0x1c')](function(_0x51b8c8){logger[_0x0f12('0x34')](_0x0f12('0x2f'),_0x51b8c8['name']);emit(util[_0x0f12('0x37')](_0x0f12('0x30'),_0x51b8c8[_0x0f12('0x19')]),_0x0f12('0x38'),{'sessionId':_0x4bf268});return _0x1d48a7[_0x0f12('0x1a')](0xc8)[_0x0f12('0x2c')]({'error':![],'message':_0x0f12('0x39')});})['catch'](handleError(_0x1d48a7));};exports[_0x0f12('0x3a')]=function(_0x5442c1,_0x3fdcce){logger[_0x0f12('0x34')]('answer\x20fired:',_0x5442c1[_0x0f12('0x2b')]);var _0x2232ec=answerValidation[_0x0f12('0xd')](_0x5442c1['body']);if(_0x2232ec['length']>0x0){return _0x3fdcce[_0x0f12('0x1a')](0x190)[_0x0f12('0x2c')](_0x2232ec);}var _0x106f93=_0x5442c1[_0x0f12('0x2b')]['userId'];var _0xbe1aca=_0x5442c1[_0x0f12('0x2b')][_0x0f12('0x36')];return getAgent(_0x106f93)[_0x0f12('0x1c')](function(_0x5d99a1){logger[_0x0f12('0x34')](_0x0f12('0x2f'),_0x5d99a1['name']);emit(util['format'](_0x0f12('0x30'),_0x5d99a1[_0x0f12('0x19')]),_0x0f12('0x3b'),{'sessionId':_0xbe1aca});return _0x3fdcce['status'](0xc8)['json']({'error':![],'message':_0x0f12('0x3c')});})[_0x0f12('0x1f')](handleError(_0x3fdcce));};exports['hold']=function(_0x40d53d,_0x526cce){logger[_0x0f12('0x34')](_0x0f12('0x3d'),_0x40d53d['body']);var _0x5b831e=holdValidation[_0x0f12('0xd')](_0x40d53d[_0x0f12('0x2b')]);if(_0x5b831e[_0x0f12('0x26')]>0x0){return _0x526cce[_0x0f12('0x1a')](0x190)[_0x0f12('0x2c')](_0x5b831e);}var _0x2f561c=_0x40d53d[_0x0f12('0x2b')][_0x0f12('0x2d')];var _0x5b265d=_0x40d53d[_0x0f12('0x2b')]['sessionId'];return getAgent(_0x2f561c)[_0x0f12('0x1c')](function(_0x52f1c2){logger['info'](_0x0f12('0x2f'),_0x52f1c2['name']);emit(util[_0x0f12('0x37')](_0x0f12('0x30'),_0x52f1c2[_0x0f12('0x19')]),_0x0f12('0x3e'),{'sessionId':_0x5b265d});return _0x526cce['status'](0xc8)[_0x0f12('0x2c')]({'error':![],'message':_0x0f12('0x3f')});})[_0x0f12('0x1f')](handleError(_0x526cce));};exports[_0x0f12('0x40')]=function(_0x48acec,_0x5382cc){logger[_0x0f12('0x34')](_0x0f12('0x41'),_0x48acec[_0x0f12('0x2b')]);var _0x1f69cd=unholdValidation[_0x0f12('0xd')](_0x48acec['body']);if(_0x1f69cd['length']>0x0){return _0x5382cc['status'](0x190)[_0x0f12('0x2c')](_0x1f69cd);}var _0x7719ec=_0x48acec[_0x0f12('0x2b')][_0x0f12('0x2d')];var _0x18c68b=_0x48acec[_0x0f12('0x2b')][_0x0f12('0x36')];return getAgent(_0x7719ec)[_0x0f12('0x1c')](function(_0x31ecc6){logger[_0x0f12('0x34')](_0x0f12('0x2f'),_0x31ecc6['name']);emit(util[_0x0f12('0x37')](_0x0f12('0x30'),_0x31ecc6[_0x0f12('0x19')]),_0x0f12('0x42'),{'sessionId':_0x18c68b});return _0x5382cc['status'](0xc8)['json']({'error':![],'message':_0x0f12('0x43')});})[_0x0f12('0x1f')](handleError(_0x5382cc));};exports[_0x0f12('0x44')]=function(_0x36d0f7,_0xff5bdf){logger[_0x0f12('0x34')](_0x0f12('0x45'),_0xff5bdf[_0x0f12('0x2b')]);var _0x5b2bb1=callsValidation[_0x0f12('0xd')](_0x36d0f7[_0x0f12('0x2b')]);if(_0x5b2bb1['length']>0x0){return _0xff5bdf[_0x0f12('0x1a')](0x190)[_0x0f12('0x2c')](_0x5b2bb1);}var _0x17054a=_0x36d0f7['body'][_0x0f12('0x2d')];var _0x14b337=respondWithRpcPromise(_0x0f12('0x22'));var _0x2ca6bb=getAgent(_0x17054a);return Promise[_0x0f12('0x23')]([_0x14b337,_0x2ca6bb])['then'](function(_0x1b4aa){var _0x51040a=_0x1b4aa[0x0];var _0xc7ab2b=_0x1b4aa[0x1];var _0x54f210=_[_0x0f12('0x46')](_0x51040a[_0x0f12('0x24')],function(_0x53bc13){return _0x53bc13[_0x0f12('0x25')]==_0xc7ab2b['id'];});return _0xff5bdf[_0x0f12('0x1a')](0xc8)['json']({'count':_0x54f210[_0x0f12('0x26')],'rows':_0x54f210});})['catch'](handleError(_0xff5bdf));};exports[_0x0f12('0x47')]=function(_0x59cd88,_0x1d6bb6){logger[_0x0f12('0x34')](_0x0f12('0x48'),_0x59cd88['body']);var _0x5f3bd9=conferenceValidation[_0x0f12('0xd')](_0x59cd88[_0x0f12('0x2b')]);if(_0x5f3bd9['length']>0x0){return _0x1d6bb6[_0x0f12('0x1a')](0x190)[_0x0f12('0x2c')](_0x5f3bd9);}var _0x5bd898=_0x59cd88[_0x0f12('0x2b')][_0x0f12('0x2d')];return getAgent(_0x5bd898)['then'](function(_0x259840){logger[_0x0f12('0x34')](_0x0f12('0x2f'),_0x259840[_0x0f12('0x19')]);emit(util[_0x0f12('0x37')](_0x0f12('0x30'),_0x259840[_0x0f12('0x19')]),_0x0f12('0x49'));return _0x1d6bb6[_0x0f12('0x1a')](0xc8)[_0x0f12('0x2c')]({'error':![],'message':_0x0f12('0x4a')});})[_0x0f12('0x1f')](handleError(_0x1d6bb6));};exports['transfer']=function(_0x10f7c3,_0x361dd5){logger[_0x0f12('0x34')](_0x0f12('0x4b'),_0x10f7c3[_0x0f12('0x2b')]);var _0x5b11f5=transferValidation[_0x0f12('0xd')](_0x10f7c3[_0x0f12('0x2b')]);if(_0x5b11f5[_0x0f12('0x26')]>0x0){return _0x361dd5['status'](0x190)[_0x0f12('0x2c')](_0x5b11f5);}var _0x531dac=_0x10f7c3[_0x0f12('0x2b')][_0x0f12('0x2d')];var _0x2d50ae=_0x10f7c3[_0x0f12('0x2b')]['sessionId'];var _0x3a0c70=_0x10f7c3['body'][_0x0f12('0x4c')];return getAgent(_0x531dac)[_0x0f12('0x1c')](function(_0x5d8a07){logger[_0x0f12('0x34')](_0x0f12('0x2f'),_0x5d8a07[_0x0f12('0x19')]);emit(util[_0x0f12('0x37')](_0x0f12('0x30'),_0x5d8a07[_0x0f12('0x19')]),'webbar:transfer',{'sessionId':_0x2d50ae,'transferNumber':_0x3a0c70});return _0x361dd5[_0x0f12('0x1a')](0xc8)[_0x0f12('0x2c')]({'error':![],'message':_0x0f12('0x4d')});})[_0x0f12('0x1f')](handleError(_0x361dd5));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 63933f0..684ce9b 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 _0x87c2=['fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addAnswer','addApplications','/:id/notify','notify','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2040dd,_0x156a63){var _0x27688f=function(_0xb90c80){while(--_0xb90c80){_0x2040dd['push'](_0x2040dd['shift']());}};_0x27688f(++_0x156a63);}(_0x87c2,0xf6));var _0x287c=function(_0x67b583,_0x309165){_0x67b583=_0x67b583-0x0;var _0x432c64=_0x87c2[_0x67b583];return _0x432c64;};'use strict';var multer=require(_0x287c('0x0'));var util=require(_0x287c('0x1'));var path=require(_0x287c('0x2'));var timeout=require(_0x287c('0x3'));var express=require(_0x287c('0x4'));var router=express[_0x287c('0x5')]();var fs_extra=require(_0x287c('0x6'));var auth=require(_0x287c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x287c('0x8'));var controller=require(_0x287c('0x9'));router[_0x287c('0xa')]('/',auth[_0x287c('0xb')](),controller[_0x287c('0xc')]);router[_0x287c('0xa')](_0x287c('0xd'),auth[_0x287c('0xb')](),controller[_0x287c('0xe')]);router[_0x287c('0xa')](_0x287c('0xf'),auth[_0x287c('0xb')](),controller[_0x287c('0x10')]);router[_0x287c('0xa')]('/:id/dispositions',auth[_0x287c('0xb')](),controller[_0x287c('0x11')]);router[_0x287c('0xa')](_0x287c('0x12'),auth[_0x287c('0xb')](),controller[_0x287c('0x13')]);router[_0x287c('0xa')](_0x287c('0x14'),auth[_0x287c('0xb')](),controller[_0x287c('0x15')]);router[_0x287c('0xa')](_0x287c('0x16'),auth[_0x287c('0xb')](),controller[_0x287c('0x17')]);router[_0x287c('0x18')]('/',auth[_0x287c('0xb')](),controller[_0x287c('0x19')]);router['post'](_0x287c('0x1a'),auth[_0x287c('0xb')](),controller['addDisposition']);router[_0x287c('0x18')](_0x287c('0x12'),auth['isAuthenticated'](),controller[_0x287c('0x1b')]);router[_0x287c('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x287c('0x18')]('/:id/applications',auth[_0x287c('0xb')](),controller[_0x287c('0x1c')]);router[_0x287c('0x18')](_0x287c('0x1d'),controller[_0x287c('0x1e')]);router[_0x287c('0x18')]('/:id/send',auth[_0x287c('0xb')](),controller['send']);router[_0x287c('0x1f')](_0x287c('0xf'),auth[_0x287c('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x287c('0x20')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x287c('0x12'),auth[_0x287c('0xb')](),controller['removeAnswers']);router[_0x287c('0x21')](_0x287c('0x14'),auth[_0x287c('0xb')](),controller[_0x287c('0x22')]);module[_0x287c('0x23')]=router; \ No newline at end of file +var _0x88d2=['isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAgents','notify','/:id/send','send','put','update','delete','/:id/dispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88d2,0x128));var _0x288d=function(_0x5a2e2e,_0x20f996){_0x5a2e2e=_0x5a2e2e-0x0;var _0x269b5f=_0x88d2[_0x5a2e2e];return _0x269b5f;};'use strict';var multer=require(_0x288d('0x0'));var util=require(_0x288d('0x1'));var path=require(_0x288d('0x2'));var timeout=require(_0x288d('0x3'));var express=require(_0x288d('0x4'));var router=express[_0x288d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x288d('0x6'));var controller=require(_0x288d('0x7'));router[_0x288d('0x8')]('/',auth['isAuthenticated'](),controller[_0x288d('0x9')]);router[_0x288d('0x8')]('/describe',auth[_0x288d('0xa')](),controller[_0x288d('0xb')]);router[_0x288d('0x8')](_0x288d('0xc'),auth['isAuthenticated'](),controller[_0x288d('0xd')]);router[_0x288d('0x8')]('/:id/dispositions',auth[_0x288d('0xa')](),controller[_0x288d('0xe')]);router['get'](_0x288d('0xf'),auth[_0x288d('0xa')](),controller[_0x288d('0x10')]);router[_0x288d('0x8')](_0x288d('0x11'),auth[_0x288d('0xa')](),controller[_0x288d('0x12')]);router[_0x288d('0x8')](_0x288d('0x13'),auth[_0x288d('0xa')](),controller[_0x288d('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x288d('0x15')]);router[_0x288d('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x288d('0x17')]);router[_0x288d('0x16')](_0x288d('0xf'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x288d('0x11'),auth[_0x288d('0xa')](),controller[_0x288d('0x18')]);router[_0x288d('0x16')](_0x288d('0x13'),auth[_0x288d('0xa')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x288d('0x19')]);router['post'](_0x288d('0x1a'),auth[_0x288d('0xa')](),controller[_0x288d('0x1b')]);router[_0x288d('0x1c')]('/:id',auth[_0x288d('0xa')](),controller[_0x288d('0x1d')]);router[_0x288d('0x1e')]('/:id',auth[_0x288d('0xa')](),controller['destroy']);router[_0x288d('0x1e')](_0x288d('0x1f'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x288d('0x1e')](_0x288d('0xf'),auth['isAuthenticated'](),controller[_0x288d('0x20')]);router['delete'](_0x288d('0x11'),auth[_0x288d('0xa')](),controller[_0x288d('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 781af56..f162f71 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 _0xd4ff=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0xd4ff,0x18b));var _0xfd4f=function(_0x59de83,_0x6fa077){_0x59de83=_0x59de83-0x0;var _0x2bbf39=_0xd4ff[_0x59de83];return _0x2bbf39;};'use strict';var Sequelize=require(_0xfd4f('0x0'));var rs=require(_0xfd4f('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfd4f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xfd4f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xfd4f('0x3')],'defaultValue':function(){return rs[_0xfd4f('0x4')]();}},'phone':{'type':Sequelize[_0xfd4f('0x3')]},'type':{'type':Sequelize[_0xfd4f('0x5')](_0xfd4f('0x6'),_0xfd4f('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xfd4f('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfd4f('0x8');}},'notificationSound':{'type':Sequelize[_0xfd4f('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xfd4f('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfd4f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfd4f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfd4f('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfd4f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfd4f('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfd4f('0x9')],'defaultValue':![],'comment':_0xfd4f('0xb'),'set':function(_0x37dccf){if(!_0x37dccf){this[_0xfd4f('0xc')](_0xfd4f('0xd'),null);}this['setDataValue'](_0xfd4f('0xe'),_0x37dccf);}},'description':{'type':Sequelize[_0xfd4f('0x3')]}}; \ No newline at end of file +var _0x034f=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','twilio'];(function(_0x1d7d8c,_0x35d527){var _0x2e52dd=function(_0x10bab5){while(--_0x10bab5){_0x1d7d8c['push'](_0x1d7d8c['shift']());}};_0x2e52dd(++_0x35d527);}(_0x034f,0x7f));var _0xf034=function(_0x226b60,_0x4fac70){_0x226b60=_0x226b60-0x0;var _0x3d566e=_0x034f[_0x226b60];return _0x3d566e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf034('0x0'));module[_0xf034('0x1')]={'name':{'type':Sequelize[_0xf034('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xf034('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xf034('0x2')],'defaultValue':function(){return rs[_0xf034('0x3')]();}},'phone':{'type':Sequelize[_0xf034('0x2')]},'type':{'type':Sequelize['ENUM'](_0xf034('0x4'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xf034('0x2')]},'authToken':{'type':Sequelize[_0xf034('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf034('0x5')],'defaultValue':function(){return _0xf034('0x6');}},'notificationSound':{'type':Sequelize[_0xf034('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf034('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf034('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf034('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf034('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf034('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf034('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf034('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf034('0x8')],'comment':_0xf034('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xf034('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c613f){if(!_0x3c613f){this['setDataValue'](_0xf034('0xa'),null);}this['setDataValue'](_0xf034('0xb'),_0x3c613f);}},'description':{'type':Sequelize[_0xf034('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a7b6200..1e58539 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 _0xc13c=['index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','includeAll','include','rows','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','sort','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','whatsapp','Applications','account','statuses','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','From','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','end','json','offset','undefined','count','limit','status','set','reject','save','update','WhatsappAccounts','UserProfileResource','destroy','sendStatus','stack','send'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc13c,0x155));var _0xcc13=function(_0x1b56ba,_0x14fea9){_0x1b56ba=_0x1b56ba-0x0;var _0x539e84=_0xc13c[_0x1b56ba];return _0x539e84;};'use strict';var emlformat=require(_0xcc13('0x0'));var rimraf=require(_0xcc13('0x1'));var zipdir=require(_0xcc13('0x2'));var jsonpatch=require(_0xcc13('0x3'));var rp=require(_0xcc13('0x4'));var moment=require('moment');var BPromise=require(_0xcc13('0x5'));var Mustache=require('mustache');var util=require(_0xcc13('0x6'));var path=require(_0xcc13('0x7'));var sox=require(_0xcc13('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc13('0x9'));var _=require('lodash');var squel=require(_0xcc13('0xa'));var crypto=require(_0xcc13('0xb'));var jsforce=require(_0xcc13('0xc'));var deskjs=require(_0xcc13('0xd'));var toCsv=require(_0xcc13('0xe'));var querystring=require(_0xcc13('0xf'));var Papa=require(_0xcc13('0x10'));var Redis=require(_0xcc13('0x11'));var authService=require(_0xcc13('0x12'));var qs=require(_0xcc13('0x13'));var as=require(_0xcc13('0x14'));var hardwareService=require(_0xcc13('0x15'));var logger=require('../../config/logger')(_0xcc13('0x16'));var utils=require(_0xcc13('0x17'));var config=require(_0xcc13('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc13('0x19'))['db'];config[_0xcc13('0x1a')]=_['defaults'](config[_0xcc13('0x1a')],{'host':_0xcc13('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc13('0x1c'))[_0xcc13('0x1d')](socket);var jayson=require(_0xcc13('0x1e'));var client=jayson['client'][_0xcc13('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3bc039,_0x2beaaa,_0x2ea14a,_0x4d5370){return new BPromise(function(_0x3463a0,_0x4676a9){var _0x4f8844=_0x4d5370||client;return _0x4f8844['request'](_0x3bc039,_0x2ea14a)[_0xcc13('0x20')](function(_0x424a21){logger[_0xcc13('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x2beaaa,_0xcc13('0x22'));logger[_0xcc13('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2beaaa,_0xcc13('0x22'),JSON[_0xcc13('0x24')](_0x424a21));if(_0x424a21[_0xcc13('0x25')]){if(_0x424a21[_0xcc13('0x25')][_0xcc13('0x26')]===0x1f4){logger['error'](_0xcc13('0x27'),_0x2beaaa,_0x424a21[_0xcc13('0x25')]['message']);return _0x4676a9(_0x424a21[_0xcc13('0x25')][_0xcc13('0x28')]);}logger['error'](_0xcc13('0x27'),_0x2beaaa,_0x424a21[_0xcc13('0x25')][_0xcc13('0x28')]);return _0x3463a0(_0x424a21[_0xcc13('0x25')][_0xcc13('0x28')]);}else{logger[_0xcc13('0x21')](_0xcc13('0x27'),_0x2beaaa,'request\x20sent');_0x3463a0(_0x424a21['result'][_0xcc13('0x28')]);}})[_0xcc13('0x29')](function(_0xb88ec7){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2beaaa,_0xb88ec7);_0x4676a9(_0xb88ec7);});});}function respondWithStatusCode(_0x4ca458,_0x2b6dc1){_0x2b6dc1=_0x2b6dc1||0xcc;return function(_0x31136b){if(_0x31136b){return _0x4ca458['sendStatus'](_0x2b6dc1);}return _0x4ca458['status'](_0x2b6dc1)[_0xcc13('0x2a')]();};}function respondWithResult(_0x21a25b,_0x4f43fa){_0x4f43fa=_0x4f43fa||0xc8;return function(_0x1b0baa){if(_0x1b0baa){return _0x21a25b['status'](_0x4f43fa)[_0xcc13('0x2b')](_0x1b0baa);}};}function respondWithFilteredResult(_0x484650,_0x3d647c){return function(_0x354d0a){if(_0x354d0a){var _0x525b32=typeof _0x3d647c[_0xcc13('0x2c')]===_0xcc13('0x2d')&&typeof _0x3d647c['limit']==='undefined';var _0x1491fe=_0x354d0a[_0xcc13('0x2e')];var _0x14553f=_0x525b32?0x0:_0x3d647c[_0xcc13('0x2c')];var _0x525e32=_0x525b32?_0x354d0a['count']:_0x3d647c[_0xcc13('0x2c')]+_0x3d647c[_0xcc13('0x2f')];var _0x4bdf46;if(_0x525e32>=_0x1491fe){_0x525e32=_0x1491fe;_0x4bdf46=0xc8;}else{_0x4bdf46=0xce;}_0x484650[_0xcc13('0x30')](_0x4bdf46);return _0x484650[_0xcc13('0x31')]('Content-Range',_0x14553f+'-'+_0x525e32+'/'+_0x1491fe)[_0xcc13('0x2b')](_0x354d0a);}return null;};}function patchUpdates(_0x4c6363){return function(_0xe86e1b){try{jsonpatch['apply'](_0xe86e1b,_0x4c6363,!![]);}catch(_0x5e157a){return BPromise[_0xcc13('0x32')](_0x5e157a);}return _0xe86e1b[_0xcc13('0x33')]();};}function saveUpdates(_0x5dafa4,_0x4ee0f5){return function(_0xc54aa6){if(_0xc54aa6){return _0xc54aa6[_0xcc13('0x34')](_0x5dafa4)[_0xcc13('0x20')](function(_0x3ac35e){return _0x3ac35e;});}return null;};}function removeEntity(_0x593461,_0x339b12){return function(_0x5a46d9){if(_0x5a46d9){return _0x5a46d9['destroy']()['then'](function(){var _0x102fd3=_0x5a46d9['get']({'plain':!![]});var _0x10eb7c=_0xcc13('0x35');return db[_0xcc13('0x36')][_0xcc13('0x37')]({'where':{'type':_0x10eb7c,'resourceId':_0x102fd3['id']}})[_0xcc13('0x20')](function(){return _0x5a46d9;});})[_0xcc13('0x20')](function(){_0x593461[_0xcc13('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea4e7,_0x59798c){return function(_0x3be19d){if(!_0x3be19d){_0x3ea4e7[_0xcc13('0x38')](0x194);}return _0x3be19d;};}function handleError(_0x399439,_0x4bd101){_0x4bd101=_0x4bd101||0x1f4;return function(_0x281285){logger[_0xcc13('0x25')](_0x281285[_0xcc13('0x39')]);if(_0x281285['name']){delete _0x281285['name'];}_0x399439['status'](_0x4bd101)[_0xcc13('0x3a')](_0x281285);};}exports[_0xcc13('0x3b')]=function(_0x581159,_0x4766b6){var _0x73435c={'include':[{'model':db[_0xcc13('0x3c')],'as':_0xcc13('0x3d')}]},_0x470e84={},_0x193eef={'count':0x0,'rows':[]};var _0x4153e7=_[_0xcc13('0x3e')](db[_0xcc13('0x3f')][_0xcc13('0x40')],function(_0x4429f9){return{'name':_0x4429f9[_0xcc13('0x41')],'type':_0x4429f9[_0xcc13('0x42')][_0xcc13('0x43')]};});_0x470e84[_0xcc13('0x44')]=_[_0xcc13('0x3e')](_0x4153e7,_0xcc13('0x45'));_0x470e84[_0xcc13('0x46')]=_['keys'](_0x581159[_0xcc13('0x46')]);_0x470e84[_0xcc13('0x47')]=_[_0xcc13('0x48')](_0x470e84[_0xcc13('0x44')],_0x470e84[_0xcc13('0x46')]);_0x73435c[_0xcc13('0x49')]=_[_0xcc13('0x48')](_0x470e84[_0xcc13('0x44')],qs[_0xcc13('0x4a')](_0x581159[_0xcc13('0x46')]['fields']));_0x73435c[_0xcc13('0x49')]=_0x73435c[_0xcc13('0x49')][_0xcc13('0x4b')]?_0x73435c[_0xcc13('0x49')]:_0x470e84['model'];if(!_0x581159[_0xcc13('0x46')][_0xcc13('0x4c')](_0xcc13('0x4d'))){_0x73435c['limit']=qs[_0xcc13('0x2f')](_0x581159[_0xcc13('0x46')][_0xcc13('0x2f')]);_0x73435c['offset']=qs['offset'](_0x581159[_0xcc13('0x46')]['offset']);}_0x73435c[_0xcc13('0x4e')]=qs['sort'](_0x581159[_0xcc13('0x46')]['sort']);_0x73435c[_0xcc13('0x4f')]=qs[_0xcc13('0x47')](_[_0xcc13('0x50')](_0x581159[_0xcc13('0x46')],_0x470e84[_0xcc13('0x47')]),_0x4153e7);if(_0x581159['query']['filter']){_0x73435c['where']=_[_0xcc13('0x51')](_0x73435c[_0xcc13('0x4f')],{'$or':_[_0xcc13('0x3e')](_0x4153e7,function(_0x355bb8){if(_0x355bb8['type']!=='VIRTUAL'){var _0x388a76={};_0x388a76[_0x355bb8['name']]={'$like':'%'+_0x581159[_0xcc13('0x46')][_0xcc13('0x52')]+'%'};return _0x388a76;}})});}_0x73435c=_[_0xcc13('0x51')]({},_0x73435c,_0x581159[_0xcc13('0x53')]);var _0x4d0396={'where':_0x73435c[_0xcc13('0x4f')]};return db[_0xcc13('0x3f')][_0xcc13('0x2e')](_0x4d0396)[_0xcc13('0x20')](function(_0x5cd348){_0x193eef[_0xcc13('0x2e')]=_0x5cd348;if(_0x581159[_0xcc13('0x46')][_0xcc13('0x54')]){_0x73435c[_0xcc13('0x55')]=[{'all':!![]}];}return db[_0xcc13('0x3f')]['findAll'](_0x73435c);})[_0xcc13('0x20')](function(_0x95ee4e){_0x193eef[_0xcc13('0x56')]=_0x95ee4e;return _0x193eef;})[_0xcc13('0x20')](respondWithFilteredResult(_0x4766b6,_0x73435c))[_0xcc13('0x29')](handleError(_0x4766b6,null));};exports[_0xcc13('0x57')]=function(_0x16f746,_0x29bb7f){var _0x124eb6={'raw':![],'where':{'id':_0x16f746[_0xcc13('0x58')]['id']},'include':[{'model':db[_0xcc13('0x3c')],'as':_0xcc13('0x3d')}]},_0x408416={};_0x408416[_0xcc13('0x44')]=_[_0xcc13('0x59')](db[_0xcc13('0x3f')]['rawAttributes']);_0x408416[_0xcc13('0x46')]=_[_0xcc13('0x59')](_0x16f746[_0xcc13('0x46')]);_0x408416[_0xcc13('0x47')]=_['intersection'](_0x408416[_0xcc13('0x44')],_0x408416[_0xcc13('0x46')]);_0x124eb6[_0xcc13('0x49')]=_['intersection'](_0x408416[_0xcc13('0x44')],qs['fields'](_0x16f746['query'][_0xcc13('0x4a')]));_0x124eb6[_0xcc13('0x49')]=_0x124eb6[_0xcc13('0x49')][_0xcc13('0x4b')]?_0x124eb6[_0xcc13('0x49')]:_0x408416[_0xcc13('0x44')];if(_0x16f746[_0xcc13('0x46')][_0xcc13('0x54')]){_0x124eb6[_0xcc13('0x55')]=[{'all':!![]}];}_0x124eb6=_['merge']({},_0x124eb6,_0x16f746[_0xcc13('0x53')]);return db[_0xcc13('0x3f')][_0xcc13('0x5a')](_0x124eb6)[_0xcc13('0x20')](handleEntityNotFound(_0x29bb7f,null))[_0xcc13('0x20')](respondWithResult(_0x29bb7f,null))[_0xcc13('0x29')](handleError(_0x29bb7f,null));};exports[_0xcc13('0x5b')]=function(_0x1680b9,_0x29e0ae){return db['WhatsappAccount'][_0xcc13('0x5b')](_0x1680b9['body'],{})[_0xcc13('0x20')](function(_0x49b47a){var _0x397fe3=_0x1680b9[_0xcc13('0x5c')][_0xcc13('0x5d')]({'plain':!![]});if(!_0x397fe3)throw new Error(_0xcc13('0x5e'));if(_0x397fe3[_0xcc13('0x5f')]==='user'){var _0x27fe0b=_0x49b47a[_0xcc13('0x5d')]({'plain':!![]});var _0x5d8031=_0xcc13('0x35');return db[_0xcc13('0x60')][_0xcc13('0x5a')]({'where':{'name':_0x5d8031,'userProfileId':_0x397fe3[_0xcc13('0x61')]},'raw':!![]})[_0xcc13('0x20')](function(_0x483900){if(_0x483900&&_0x483900[_0xcc13('0x62')]===0x0){return db[_0xcc13('0x36')]['create']({'name':_0x27fe0b[_0xcc13('0x45')],'resourceId':_0x27fe0b['id'],'type':_0x483900[_0xcc13('0x45')],'sectionId':_0x483900['id']},{})[_0xcc13('0x20')](function(){return _0x49b47a;});}else{return _0x49b47a;}})[_0xcc13('0x29')](function(_0x12943a){logger['error'](_0xcc13('0x63'),_0x12943a);throw _0x12943a;});}return _0x49b47a;})['then'](respondWithResult(_0x29e0ae,0xc9))['catch'](handleError(_0x29e0ae,null));};exports[_0xcc13('0x34')]=function(_0x498f4d,_0x136c8e){if(_0x498f4d[_0xcc13('0x64')]['id']){delete _0x498f4d[_0xcc13('0x64')]['id'];}return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x498f4d[_0xcc13('0x58')]['id']},'include':[{'model':db[_0xcc13('0x3c')],'as':_0xcc13('0x3d')}]})[_0xcc13('0x20')](handleEntityNotFound(_0x136c8e,null))[_0xcc13('0x20')](saveUpdates(_0x498f4d[_0xcc13('0x64')],null))[_0xcc13('0x20')](respondWithResult(_0x136c8e,null))[_0xcc13('0x29')](handleError(_0x136c8e,null));};exports['destroy']=function(_0x5747af,_0x5cc980){return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x5747af[_0xcc13('0x58')]['id']}})['then'](handleEntityNotFound(_0x5cc980,null))[_0xcc13('0x20')](removeEntity(_0x5cc980,null))[_0xcc13('0x29')](handleError(_0x5cc980,null));};exports[_0xcc13('0x65')]=function(_0x388d85,_0x25e886){return db[_0xcc13('0x3f')][_0xcc13('0x65')]()['then'](respondWithResult(_0x25e886,null))[_0xcc13('0x29')](handleError(_0x25e886,null));};exports[_0xcc13('0x66')]=function(_0x5a9c5e,_0x3461c9,_0x10dab3){if(_0x5a9c5e['body']['id']){delete _0x5a9c5e[_0xcc13('0x64')]['id'];}return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x5a9c5e[_0xcc13('0x58')]['id']}})[_0xcc13('0x20')](handleEntityNotFound(_0x3461c9,null))['then'](function(_0x904252){if(_0x904252){_0x5a9c5e[_0xcc13('0x64')][_0xcc13('0x67')]=_0x904252['id'];return db[_0xcc13('0x68')]['create'](_0x5a9c5e[_0xcc13('0x64')]);}})['then'](respondWithResult(_0x3461c9,null))[_0xcc13('0x29')](handleError(_0x3461c9,null));};exports[_0xcc13('0x69')]=function(_0x1459b0,_0x2622d7,_0x5e0cd8){var _0x567548={'raw':![],'where':{}};var _0x34386d={};var _0x367856={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xcc13('0x6a')]({'where':{'id':_0x1459b0['params']['id']}})['then'](handleEntityNotFound(_0x2622d7,null))[_0xcc13('0x20')](function(_0x377a73){if(_0x377a73){_0x34386d[_0xcc13('0x44')]=_[_0xcc13('0x59')](db['Disposition']['rawAttributes']);_0x34386d['query']=_[_0xcc13('0x59')](_0x1459b0['query']);_0x34386d[_0xcc13('0x47')]=_[_0xcc13('0x48')](_0x34386d[_0xcc13('0x44')],_0x34386d[_0xcc13('0x46')]);_0x567548[_0xcc13('0x49')]=_['intersection'](_0x34386d[_0xcc13('0x44')],qs[_0xcc13('0x4a')](_0x1459b0[_0xcc13('0x46')][_0xcc13('0x4a')]));_0x567548[_0xcc13('0x49')]=_0x567548['attributes']['length']?_0x567548[_0xcc13('0x49')]:_0x34386d[_0xcc13('0x44')];if(!_0x1459b0[_0xcc13('0x46')][_0xcc13('0x4c')](_0xcc13('0x4d'))){_0x567548[_0xcc13('0x2f')]=qs['limit'](_0x1459b0['query'][_0xcc13('0x2f')]);_0x567548['offset']=qs[_0xcc13('0x2c')](_0x1459b0[_0xcc13('0x46')]['offset']);}_0x567548['order']=qs[_0xcc13('0x6b')](_0x1459b0[_0xcc13('0x46')][_0xcc13('0x6b')]);_0x567548[_0xcc13('0x4f')]=qs['filters'](_[_0xcc13('0x50')](_0x1459b0[_0xcc13('0x46')],_0x34386d[_0xcc13('0x47')]));_0x567548['where'][_0xcc13('0x67')]=_0x377a73['id'];if(_0x1459b0['query']['filter']){_0x567548[_0xcc13('0x4f')]=_[_0xcc13('0x51')](_0x567548[_0xcc13('0x4f')],{'$or':_['map'](_0x567548[_0xcc13('0x49')],function(_0x9f3544){var _0x29c630={};_0x29c630[_0x9f3544]={'$like':'%'+_0x1459b0[_0xcc13('0x46')]['filter']+'%'};return _0x29c630;})});}_0x567548=_[_0xcc13('0x51')]({},_0x567548,_0x1459b0[_0xcc13('0x53')]);return db[_0xcc13('0x68')][_0xcc13('0x2e')]({'where':_0x567548[_0xcc13('0x4f')]})['then'](function(_0xf83428){_0x367856['count']=_0xf83428;if(_0x1459b0[_0xcc13('0x46')]['includeAll']){_0x567548[_0xcc13('0x55')]=[{'all':!![]}];}return db[_0xcc13('0x68')][_0xcc13('0x6c')](_0x567548);})['then'](function(_0x41cb02){_0x367856[_0xcc13('0x56')]=_0x41cb02;return _0x367856;});}})[_0xcc13('0x20')](respondWithFilteredResult(_0x2622d7,_0x567548))[_0xcc13('0x29')](handleError(_0x2622d7,null));};exports[_0xcc13('0x6d')]=function(_0x163b15,_0x48f5d6,_0x4e123a){return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x163b15[_0xcc13('0x58')]['id']}})[_0xcc13('0x20')](handleEntityNotFound(_0x48f5d6,null))['then'](function(_0x208a08){if(_0x208a08){return _0x208a08[_0xcc13('0x6d')](_0x163b15[_0xcc13('0x46')][_0xcc13('0x6e')]);}})[_0xcc13('0x20')](respondWithStatusCode(_0x48f5d6,null))[_0xcc13('0x29')](handleError(_0x48f5d6,null));};exports['addAnswer']=function(_0x28f73e,_0x1aff8e,_0x41ef2b){if(_0x28f73e['body']['id']){delete _0x28f73e['body']['id'];}return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x28f73e[_0xcc13('0x58')]['id']}})[_0xcc13('0x20')](handleEntityNotFound(_0x1aff8e,null))['then'](function(_0x136868){if(_0x136868){_0x28f73e[_0xcc13('0x64')][_0xcc13('0x67')]=_0x136868['id'];return db[_0xcc13('0x6f')][_0xcc13('0x5b')](_0x28f73e[_0xcc13('0x64')]);}})[_0xcc13('0x20')](respondWithResult(_0x1aff8e,null))[_0xcc13('0x29')](handleError(_0x1aff8e,null));};exports[_0xcc13('0x70')]=function(_0x5c3690,_0x31c5a2,_0xa0b124){var _0xd67414={'raw':![],'where':{}};var _0x3a522c={};var _0x389c0e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xcc13('0x6a')]({'where':{'id':_0x5c3690[_0xcc13('0x58')]['id']}})[_0xcc13('0x20')](handleEntityNotFound(_0x31c5a2,null))[_0xcc13('0x20')](function(_0x38deb7){if(_0x38deb7){_0x3a522c[_0xcc13('0x44')]=_[_0xcc13('0x59')](db[_0xcc13('0x6f')][_0xcc13('0x40')]);_0x3a522c[_0xcc13('0x46')]=_[_0xcc13('0x59')](_0x5c3690[_0xcc13('0x46')]);_0x3a522c[_0xcc13('0x47')]=_[_0xcc13('0x48')](_0x3a522c['model'],_0x3a522c[_0xcc13('0x46')]);_0xd67414['attributes']=_[_0xcc13('0x48')](_0x3a522c[_0xcc13('0x44')],qs[_0xcc13('0x4a')](_0x5c3690[_0xcc13('0x46')][_0xcc13('0x4a')]));_0xd67414[_0xcc13('0x49')]=_0xd67414['attributes'][_0xcc13('0x4b')]?_0xd67414[_0xcc13('0x49')]:_0x3a522c[_0xcc13('0x44')];if(!_0x5c3690[_0xcc13('0x46')][_0xcc13('0x4c')]('nolimit')){_0xd67414[_0xcc13('0x2f')]=qs[_0xcc13('0x2f')](_0x5c3690[_0xcc13('0x46')]['limit']);_0xd67414[_0xcc13('0x2c')]=qs[_0xcc13('0x2c')](_0x5c3690[_0xcc13('0x46')][_0xcc13('0x2c')]);}_0xd67414[_0xcc13('0x4e')]=qs['sort'](_0x5c3690[_0xcc13('0x46')][_0xcc13('0x6b')]);_0xd67414[_0xcc13('0x4f')]=qs['filters'](_['pick'](_0x5c3690['query'],_0x3a522c['filters']));_0xd67414[_0xcc13('0x4f')][_0xcc13('0x67')]=_0x38deb7['id'];if(_0x5c3690[_0xcc13('0x46')][_0xcc13('0x52')]){_0xd67414['where']=_[_0xcc13('0x51')](_0xd67414['where'],{'$or':_[_0xcc13('0x3e')](_0xd67414[_0xcc13('0x49')],function(_0x30fa08){var _0x5a6092={};_0x5a6092[_0x30fa08]={'$like':'%'+_0x5c3690[_0xcc13('0x46')][_0xcc13('0x52')]+'%'};return _0x5a6092;})});}_0xd67414=_[_0xcc13('0x51')]({},_0xd67414,_0x5c3690[_0xcc13('0x53')]);return db[_0xcc13('0x6f')][_0xcc13('0x2e')]({'where':_0xd67414['where']})['then'](function(_0x25bb56){_0x389c0e['count']=_0x25bb56;if(_0x5c3690[_0xcc13('0x46')][_0xcc13('0x54')]){_0xd67414[_0xcc13('0x55')]=[{'all':!![]}];}return db[_0xcc13('0x6f')][_0xcc13('0x6c')](_0xd67414);})['then'](function(_0x55fc82){_0x389c0e[_0xcc13('0x56')]=_0x55fc82;return _0x389c0e;});}})[_0xcc13('0x20')](respondWithFilteredResult(_0x31c5a2,_0xd67414))[_0xcc13('0x29')](handleError(_0x31c5a2,null));};exports[_0xcc13('0x71')]=function(_0x828b5b,_0x393504,_0x18d34f){return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x828b5b[_0xcc13('0x58')]['id']}})[_0xcc13('0x20')](handleEntityNotFound(_0x393504,null))[_0xcc13('0x20')](function(_0x145227){if(_0x145227){return _0x145227[_0xcc13('0x71')](_0x828b5b['query'][_0xcc13('0x6e')]);}})['then'](respondWithStatusCode(_0x393504,null))['catch'](handleError(_0x393504,null));};exports[_0xcc13('0x72')]=function(_0xbf14d9,_0x1cff95,_0x5eeb90){return db['WhatsappAccount'][_0xcc13('0x5a')]({'where':{'id':_0xbf14d9['params']['id']}})['then'](handleEntityNotFound(_0x1cff95,null))['then'](function(_0x545f2b){if(_0x545f2b){return _0x545f2b['addAgents'](_0xbf14d9[_0xcc13('0x64')][_0xcc13('0x6e')],_[_0xcc13('0x73')](_0xbf14d9[_0xcc13('0x64')],['ids','id'])||{})[_0xcc13('0x74')](function(_0x45999c){for(var _0x493522=0x0;_0x493522<_0xbf14d9['body'][_0xcc13('0x6e')][_0xcc13('0x4b')];_0x493522+=0x1){socket['emit'](_0xcc13('0x75'),{'UserId':Number(_0xbf14d9['body'][_0xcc13('0x6e')][_0x493522]),'WhatsappAccountId':Number(_0xbf14d9['params']['id'])});}return _0x45999c;});}})[_0xcc13('0x20')](respondWithResult(_0x1cff95,null))[_0xcc13('0x29')](handleError(_0x1cff95,null));};exports['removeAgents']=function(_0x475b8c,_0x1027e9,_0x674b32){return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x475b8c[_0xcc13('0x58')]['id']}})['then'](handleEntityNotFound(_0x1027e9,null))[_0xcc13('0x20')](function(_0x283e78){if(_0x283e78){return _0x283e78[_0xcc13('0x76')](_0x475b8c['query']['ids'])[_0xcc13('0x20')](function(){if(_[_0xcc13('0x77')](_0x475b8c[_0xcc13('0x46')][_0xcc13('0x6e')])){for(var _0xcc1dd2=0x0;_0xcc1dd2<_0x475b8c['query'][_0xcc13('0x6e')][_0xcc13('0x4b')];_0xcc1dd2+=0x1){socket[_0xcc13('0x78')](_0xcc13('0x79'),{'UserId':Number(_0x475b8c[_0xcc13('0x46')]['ids'][_0xcc1dd2]),'WhatsappAccountId':Number(_0x475b8c[_0xcc13('0x58')]['id'])});}}else{socket[_0xcc13('0x78')](_0xcc13('0x79'),{'UserId':Number(_0x475b8c['query'][_0xcc13('0x6e')]),'WhatsappAccountId':Number(_0x475b8c[_0xcc13('0x58')]['id'])});}});}})[_0xcc13('0x20')](respondWithStatusCode(_0x1027e9,null))[_0xcc13('0x29')](handleError(_0x1027e9,null));};exports[_0xcc13('0x7a')]=function(_0x5e2418,_0xd02ebb,_0x2ae072){var _0x36ac48={};var _0x78a879={};var _0x1c2ba3;var _0x41fc2a;return db['WhatsappAccount'][_0xcc13('0x6a')]({'where':{'id':_0x5e2418[_0xcc13('0x58')]['id']}})['then'](handleEntityNotFound(_0xd02ebb,null))[_0xcc13('0x20')](function(_0x10cc22){if(_0x10cc22){_0x1c2ba3=_0x10cc22;_0x78a879[_0xcc13('0x44')]=_[_0xcc13('0x59')](db['User'][_0xcc13('0x40')]);_0x78a879['query']=_[_0xcc13('0x59')](_0x5e2418[_0xcc13('0x46')]);_0x78a879[_0xcc13('0x47')]=_[_0xcc13('0x48')](_0x78a879[_0xcc13('0x44')],_0x78a879[_0xcc13('0x46')]);_0x36ac48[_0xcc13('0x49')]=_[_0xcc13('0x48')](_0x78a879['model'],qs[_0xcc13('0x4a')](_0x5e2418['query'][_0xcc13('0x4a')]));_0x36ac48[_0xcc13('0x49')]=_0x36ac48['attributes'][_0xcc13('0x4b')]?_0x36ac48[_0xcc13('0x49')]:_0x78a879[_0xcc13('0x44')];_0x36ac48['order']=qs[_0xcc13('0x6b')](_0x5e2418[_0xcc13('0x46')][_0xcc13('0x6b')]);_0x36ac48[_0xcc13('0x4f')]=qs['filters'](_[_0xcc13('0x50')](_0x5e2418[_0xcc13('0x46')],_0x78a879[_0xcc13('0x47')]));if(_0x5e2418[_0xcc13('0x46')][_0xcc13('0x52')]){_0x36ac48[_0xcc13('0x4f')]=_[_0xcc13('0x51')](_0x36ac48['where'],{'$or':_[_0xcc13('0x3e')](_0x36ac48[_0xcc13('0x49')],function(_0x4aeccc){var _0x1e0cc3={};_0x1e0cc3[_0x4aeccc]={'$like':'%'+_0x5e2418[_0xcc13('0x46')][_0xcc13('0x52')]+'%'};return _0x1e0cc3;})});}_0x36ac48=_[_0xcc13('0x51')]({},_0x36ac48,_0x5e2418[_0xcc13('0x53')]);return _0x1c2ba3[_0xcc13('0x7a')](_0x36ac48);}})[_0xcc13('0x20')](function(_0x4ccce3){if(_0x4ccce3){_0x41fc2a=_0x4ccce3[_0xcc13('0x4b')];if(!_0x5e2418[_0xcc13('0x46')][_0xcc13('0x4c')](_0xcc13('0x4d'))){_0x36ac48[_0xcc13('0x2f')]=qs['limit'](_0x5e2418[_0xcc13('0x46')][_0xcc13('0x2f')]);_0x36ac48[_0xcc13('0x2c')]=qs[_0xcc13('0x2c')](_0x5e2418['query'][_0xcc13('0x2c')]);}return _0x1c2ba3['getAgents'](_0x36ac48);}})[_0xcc13('0x20')](function(_0x16239a){if(_0x16239a){return _0x16239a?{'count':_0x41fc2a,'rows':_0x16239a}:null;}})[_0xcc13('0x20')](respondWithResult(_0xd02ebb,null))['catch'](handleError(_0xd02ebb,null));};exports['addApplications']=function(_0x246144,_0x3c0e26){var _0x237690=_0x246144['params']['id'];var _0x2c2377=_0x246144[_0xcc13('0x64')];var _0x273c34=0xc8;var _0x2628ed=null;return db[_0xcc13('0x7b')][_0xcc13('0x7c')]({'isolationLevel':db[_0xcc13('0x7b')][_0xcc13('0x7d')][_0xcc13('0x7e')]['READ_COMMITTED']},function(_0xd794e9){return db[_0xcc13('0x3f')]['findOne']({'where':{'id':_0x237690},'transaction':_0xd794e9})[_0xcc13('0x20')](function(_0x56ded9){if(_0x56ded9){return db[_0xcc13('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x237690},'transaction':_0xd794e9})[_0xcc13('0x20')](function(){var _0x217dc2=_[_0xcc13('0x3e')](_0x2c2377,function(_0xb74612){_0xb74612[_0xcc13('0x67')]=_0x237690;return _0xb74612;});return db[_0xcc13('0x7f')][_0xcc13('0x80')](_0x217dc2,{'transaction':_0xd794e9});});}else{_0x273c34=0x194;_0x2628ed=[];}});})[_0xcc13('0x20')](function(){if(_0x273c34!==0x194){return db['WhatsappApplication'][_0xcc13('0x81')]({'where':{'WhatsappAccountId':_0x237690},'order':'priority'})[_0xcc13('0x20')](function(_0x3422ba){_0x2628ed=_0x3422ba;});}})['catch'](function(_0x13db43){_0x273c34=0x1f4;logger[_0xcc13('0x25')](_0x13db43['stack']);if(_0x13db43[_0xcc13('0x45')]){delete _0x13db43[_0xcc13('0x45')];}_0x2628ed=_0x13db43;})['finally'](function(){if(_0x2628ed===null){_0x3c0e26[_0xcc13('0x38')](_0x273c34);}else{if(_0x273c34===0x1f4){_0x3c0e26['status'](_0x273c34)[_0xcc13('0x3a')](_0x2628ed);}else{_0x3c0e26[_0xcc13('0x30')](_0x273c34)[_0xcc13('0x2b')](_0x2628ed);}}});};exports[_0xcc13('0x82')]=function(_0x1f16c2,_0x1da3b0,_0x4f5e66){var _0x52ee93={};var _0x333894={};var _0x43fa78;var _0x40bb4f;return db[_0xcc13('0x3f')]['findOne']({'where':{'id':_0x1f16c2[_0xcc13('0x58')]['id']}})[_0xcc13('0x20')](handleEntityNotFound(_0x1da3b0,null))[_0xcc13('0x20')](function(_0x4ef275){if(_0x4ef275){_0x43fa78=_0x4ef275;_0x333894['model']=_['keys'](db[_0xcc13('0x7f')]['rawAttributes']);_0x333894[_0xcc13('0x46')]=_['keys'](_0x1f16c2['query']);_0x333894['filters']=_[_0xcc13('0x48')](_0x333894[_0xcc13('0x44')],_0x333894['query']);_0x52ee93['attributes']=_[_0xcc13('0x48')](_0x333894[_0xcc13('0x44')],qs['fields'](_0x1f16c2[_0xcc13('0x46')][_0xcc13('0x4a')]));_0x52ee93['attributes']=_0x52ee93['attributes'][_0xcc13('0x4b')]?_0x52ee93[_0xcc13('0x49')]:_0x333894['model'];_0x52ee93[_0xcc13('0x4e')]=qs[_0xcc13('0x6b')](_0x1f16c2['query'][_0xcc13('0x6b')]);_0x52ee93[_0xcc13('0x4f')]=qs[_0xcc13('0x47')](_[_0xcc13('0x50')](_0x1f16c2[_0xcc13('0x46')],_0x333894[_0xcc13('0x47')]));if(_0x1f16c2[_0xcc13('0x46')]['filter']){_0x52ee93[_0xcc13('0x4f')]=_[_0xcc13('0x51')](_0x52ee93[_0xcc13('0x4f')],{'$or':_[_0xcc13('0x3e')](_0x52ee93[_0xcc13('0x49')],function(_0x4c037c){var _0x546df8={};_0x546df8[_0x4c037c]={'$like':'%'+_0x1f16c2['query'][_0xcc13('0x52')]+'%'};return _0x546df8;})});}_0x52ee93=_['merge']({},_0x52ee93,_0x1f16c2[_0xcc13('0x53')]);return _0x43fa78[_0xcc13('0x82')](_0x52ee93);}})[_0xcc13('0x20')](function(_0x458326){if(_0x458326){_0x40bb4f=_0x458326['length'];if(!_0x1f16c2[_0xcc13('0x46')][_0xcc13('0x4c')]('nolimit')){_0x52ee93[_0xcc13('0x2f')]=qs[_0xcc13('0x2f')](_0x1f16c2[_0xcc13('0x46')][_0xcc13('0x2f')]);_0x52ee93[_0xcc13('0x2c')]=qs[_0xcc13('0x2c')](_0x1f16c2[_0xcc13('0x46')][_0xcc13('0x2c')]);}return _0x43fa78[_0xcc13('0x82')](_0x52ee93);}})[_0xcc13('0x20')](function(_0x27fbc6){if(_0x27fbc6){return _0x27fbc6?{'count':_0x40bb4f,'rows':_0x27fbc6}:null;}})[_0xcc13('0x20')](respondWithResult(_0x1da3b0,null))['catch'](handleError(_0x1da3b0,null));};exports['notify']=function(_0x1bec62,_0x566e5c,_0x4fa2e4){var _0x104bb8={'channel':_0xcc13('0x83')};var _0x5b8ee6=[];var _0x13f66d=[];var _0x35a89d={};return db[_0xcc13('0x3f')]['find']({'where':{'id':_0x1bec62[_0xcc13('0x58')]['id']},'include':[{'model':db[_0xcc13('0x7f')],'as':_0xcc13('0x84')}]})[_0xcc13('0x20')](handleEntityNotFound(_0x566e5c,null))['then'](function(_0x3728a7){_0x104bb8[_0xcc13('0x85')]=_0x3728a7;if(_0x104bb8[_0xcc13('0x85')]&&_0x104bb8[_0xcc13('0x85')][_0xcc13('0x42')]==='sinch'&&_0x1bec62['body'][_0xcc13('0x86')]){if(_0x1bec62[_0xcc13('0x64')]['statuses'][_0xcc13('0x4b')]===0x0)return;if(_0x1bec62['body']['statuses'][0x0]['state']!=='read')return;return db[_0xcc13('0x87')][_0xcc13('0x34')]({'read':!![],'readAt':_0x1bec62[_0xcc13('0x64')][_0xcc13('0x86')][0x0][_0xcc13('0x88')]},{'where':{'messageId':_0x1bec62[_0xcc13('0x64')]['statuses'][0x0][_0xcc13('0x89')]},'individualHooks':!![]})[_0xcc13('0x20')](function(_0x87fb84){return _0x566e5c[_0xcc13('0x30')](0xc8)[_0xcc13('0x2b')](_0x87fb84);});}_0x104bb8[_0xcc13('0x8a')]=_[_0xcc13('0x8b')](_0x3728a7['Applications'],[_0xcc13('0x8c')],['asc']);if(_0x104bb8[_0xcc13('0x85')][_0xcc13('0x84')]){delete _0x104bb8[_0xcc13('0x85')][_0xcc13('0x84')];}return db[_0xcc13('0x8d')][_0xcc13('0x65')]()[_0xcc13('0x20')](function(_0x45183a){if(!_0x45183a){throw new db[(_0xcc13('0x8e'))][(_0xcc13('0x8f'))](_0xcc13('0x90'));}_0x5b8ee6=_[_0xcc13('0x91')](_[_0xcc13('0x59')](_0x45183a),['createdAt',_0xcc13('0x92')]);_0x13f66d=_[_0xcc13('0x91')](_[_0xcc13('0x59')](_0x45183a),['createdAt',_0xcc13('0x92'),_0xcc13('0x93'),_0xcc13('0x94')]);_0x104bb8[_0xcc13('0x64')]={'mapKey':'mobile'};if(_0x104bb8['account']&&_0x104bb8['account'][_0xcc13('0x42')]==='twilio'){_0x104bb8[_0xcc13('0x64')][_0xcc13('0x95')]=_0x1bec62[_0xcc13('0x64')][_0xcc13('0x96')][_0xcc13('0x97')](_0xcc13('0x98'),'');_0x104bb8[_0xcc13('0x64')][_0xcc13('0x64')]=_0x1bec62[_0xcc13('0x64')][_0xcc13('0x99')];_0x104bb8[_0xcc13('0x64')][_0xcc13('0x9a')]=_0x1bec62[_0xcc13('0x64')][_0xcc13('0x9b')];}if(_0x104bb8[_0xcc13('0x85')]&&_0x104bb8[_0xcc13('0x85')][_0xcc13('0x42')]===_0xcc13('0x9c')){_0x104bb8[_0xcc13('0x64')]['from']=_0x1bec62[_0xcc13('0x64')][_0xcc13('0x9d')][0x0][_0xcc13('0x95')];_0x104bb8[_0xcc13('0x64')][_0xcc13('0x64')]=_0x1bec62[_0xcc13('0x64')][_0xcc13('0x9d')][0x0][_0xcc13('0x28')][_0xcc13('0x64')];_0x104bb8['body'][_0xcc13('0x9a')]=_0x1bec62[_0xcc13('0x64')]['notifications'][0x0]['message_id'];}if(_0x104bb8[_0xcc13('0x64')]['id']){delete _0x104bb8[_0xcc13('0x64')]['id'];}if(_[_0xcc13('0x9e')](_0x104bb8[_0xcc13('0x64')][_0xcc13('0x95')])){throw new db['Sequelize']['ValidationError'](_0xcc13('0x9f'));}if(_[_0xcc13('0x9e')](_0x104bb8['body'][_0xcc13('0x64')])||_0x104bb8[_0xcc13('0x64')]['body']===''){throw new db[(_0xcc13('0x8e'))][(_0xcc13('0x8f'))](_0xcc13('0xa0'));}if(_[_0xcc13('0x9e')](_0x104bb8[_0xcc13('0x64')][_0xcc13('0xa1')])){throw new db[(_0xcc13('0x8e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13f66d);}if(!_[_0xcc13('0xa2')](_0x13f66d,_0x104bb8[_0xcc13('0x64')]['mapKey'])){throw new db[(_0xcc13('0x8e'))][(_0xcc13('0x8f'))](_0xcc13('0xa3')+_0x13f66d);}_0x35a89d[_0x104bb8['body'][_0xcc13('0xa1')]]=_0x104bb8[_0xcc13('0x64')][_0xcc13('0x95')];return db[_0xcc13('0xa4')][_0xcc13('0x5a')]({'where':{'id':_0x104bb8[_0xcc13('0x85')][_0xcc13('0x94')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x35a89d,'limit':0x1,'order':[['updatedAt',_0xcc13('0xa5')]]}]});})['then'](handleEntityNotFound(_0x566e5c,null))['then'](function(_0x312e9e){if(_0x312e9e){_0x104bb8[_0xcc13('0xa6')]=_[_0xcc13('0x73')](_0x312e9e,[_0xcc13('0xa7')]);if(_0x312e9e[_0xcc13('0xa7')][_0xcc13('0x4b')]){return _0x312e9e[_0xcc13('0xa7')][0x0];}var _0x495810=_[_0xcc13('0xa8')](_0x104bb8[_0xcc13('0x64')],{'firstName':_0x104bb8[_0xcc13('0x64')][_0xcc13('0x95')],'ListId':_0x312e9e['id']});_0x495810[_0x104bb8['body']['mapKey']]=_0x104bb8['body'][_0xcc13('0x95')];return db[_0xcc13('0x8d')][_0xcc13('0x5b')](_0x495810,{'fields':_0x5b8ee6,'raw':!![]});}})[_0xcc13('0x20')](handleEntityNotFound(_0x566e5c,null))[_0xcc13('0x20')](function(_0x51e816){if(_0x51e816){_0x104bb8[_0xcc13('0xa9')]=_0x51e816;var _0x1f1e96={'ContactId':_0x51e816['id'],'phone':_0x104bb8['body'][_0xcc13('0x95')],'WhatsappAccountId':_0x1bec62[_0xcc13('0x58')]['id']};var _0x4521fb={'ContactId':_0x51e816['id'],'WhatsappAccountId':_0x1bec62[_0xcc13('0x58')]['id'],'closed':![]};return db[_0xcc13('0xaa')][_0xcc13('0x5a')]({'where':_0x4521fb})['then'](function(_0x206f96){if(_0x206f96){return[_0x206f96,![]];}return db[_0xcc13('0xaa')][_0xcc13('0x5b')](_0x1f1e96)['then'](function(_0x509cf9){return[_0x509cf9,!![]];});});}})[_0xcc13('0x74')](function(_0x392f43,_0x4ee7b0){_0x104bb8[_0xcc13('0xab')]=_0x392f43['get']({'plain':!![]});_0x104bb8[_0xcc13('0xab')][_0xcc13('0xac')]=![];if(_0x4ee7b0){if(_0x104bb8[_0xcc13('0x85')][_0xcc13('0xad')]){_0x104bb8[_0xcc13('0x8a')][_0xcc13('0xae')]({'id':0x0,'priority':_0x104bb8[_0xcc13('0x8a')][_0xcc13('0x4b')]+0x1,'app':_0xcc13('0xaf'),'appdata':'unmanaged','interval':_0xcc13('0xb0')});}_0x104bb8[_0xcc13('0xab')]['created']=!![];}return db[_0xcc13('0x87')][_0xcc13('0x5b')]({'phone':_0x104bb8['body'][_0xcc13('0x95')],'messageId':_0x104bb8[_0xcc13('0x64')][_0xcc13('0x9a')],'body':_0x104bb8[_0xcc13('0x64')][_0xcc13('0x64')],'WhatsappAccountId':_0x1bec62[_0xcc13('0x58')]['id'],'WhatsappInteractionId':_0x392f43['id'],'direction':'in','ContactId':_0x392f43[_0xcc13('0xb1')],'AttachmentId':_0x104bb8[_0xcc13('0x64')][_0xcc13('0xb2')]});})[_0xcc13('0x20')](function(_0x3ebc50){_0x104bb8[_0xcc13('0x28')]=_0x3ebc50;if(!_0x104bb8[_0xcc13('0xab')]['UserId'])return;return db['User'][_0xcc13('0x5a')]({'attributes':['id','name'],'where':{'id':_0x104bb8['interaction'][_0xcc13('0xb3')]}});})[_0xcc13('0x20')](function(_0x52d4fa){if(_0x52d4fa){_0x104bb8[_0xcc13('0x8a')][_0xcc13('0xb4')]({'id':0x0,'priority':0x0,'app':_0xcc13('0xb5'),'appdata':_0x52d4fa[_0xcc13('0x45')]+','+(_0x104bb8[_0xcc13('0x85')][_0xcc13('0xb6')]||0xa),'interval':_0xcc13('0xb0')});}if(!_0x104bb8[_0xcc13('0xab')][_0xcc13('0xb7')])return;return db[_0xcc13('0xb8')]['find']({'attributes':['id','name'],'where':{'id':_0x104bb8[_0xcc13('0xab')][_0xcc13('0xb7')]}});})[_0xcc13('0x20')](function(_0x97ba71){if(_0x97ba71){_0x104bb8['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xcc13('0xb9'),'appdata':_0x97ba71[_0xcc13('0x45')]+','+(_0x104bb8['account'][_0xcc13('0xba')]||0x12c),'interval':_0xcc13('0xb0')});}return respondWithRpcPromise(_0xcc13('0xbb'),_0xcc13('0xbc'),_0x104bb8);})[_0xcc13('0x20')](function(_0x4be06f){if(_0x4be06f){var _0xfafc44=0xc8;var _0x39c9b6=_0xcc13('0xbd');logger['info'](_0xcc13('0xbe'),_0x39c9b6,_0xfafc44,_0xcc13('0xbf'));logger['debug'](_0xcc13('0xc0'),_0x39c9b6,_0xfafc44,_0xcc13('0xbf'),JSON[_0xcc13('0x24')](_0x4be06f));if(_0x104bb8[_0xcc13('0x85')][_0xcc13('0x42')]===_0xcc13('0xc1')){return _0x566e5c['status'](_0xfafc44)[_0xcc13('0x31')](_0xcc13('0xc2'),_0xcc13('0xc3'))[_0xcc13('0x3a')]('\x0a');}else{return _0x566e5c[_0xcc13('0x30')](_0xfafc44)[_0xcc13('0x2b')](_0x4be06f);}}});})[_0xcc13('0x29')](handleError(_0x566e5c,null));};exports[_0xcc13('0x3a')]=function(_0x422033,_0x416956,_0x1e2508){var _0x2782a8,_0x501828,_0x5f14eb;if(_[_0xcc13('0x9e')](_0x422033[_0xcc13('0x64')][_0xcc13('0x64')])||_0x422033[_0xcc13('0x64')][_0xcc13('0x64')]===''){throw new db[(_0xcc13('0x8e'))]['ValidationError'](_0xcc13('0xa0'));}if(_['isNil'](_0x422033[_0xcc13('0x64')]['to'])){throw new db[(_0xcc13('0x8e'))][(_0xcc13('0x8f'))](_0xcc13('0xc4'));}_0x2782a8=_0x422033[_0xcc13('0x64')]['to'];return db[_0xcc13('0x3f')][_0xcc13('0x5a')]({'where':{'id':_0x422033[_0xcc13('0x58')]['id']},'include':[{'model':db[_0xcc13('0xa4')],'as':_0xcc13('0xc5'),'include':[{'model':db[_0xcc13('0x8d')],'as':'Contacts','where':{'mobile':_0x2782a8},'limit':0x1,'order':[[_0xcc13('0x92'),_0xcc13('0xa5')]]}]}]})[_0xcc13('0x20')](handleEntityNotFound(_0x416956,null))[_0xcc13('0x20')](function(_0x1bd8c4){if(_0x1bd8c4&&_0x1bd8c4[_0xcc13('0xc5')]){_0x501828=_0x1bd8c4['get']({'plain':!![]});if(_0x501828[_0xcc13('0xc5')]&&_0x501828[_0xcc13('0xc5')][_0xcc13('0xa7')][_0xcc13('0x4b')]){return _0x501828['List']['Contacts'][0x0];}return db[_0xcc13('0x8d')][_0xcc13('0x5b')](_[_0xcc13('0xa8')](_0x422033[_0xcc13('0x64')],{'firstName':_0x2782a8,'mobile':_0x2782a8,'phone':_0x2782a8,'ListId':_0x501828['ListId']}));}})[_0xcc13('0x20')](handleEntityNotFound(_0x416956,null))['then'](function(_0x5765b7){if(_0x5765b7){_0x5f14eb=_0x5765b7;return db[_0xcc13('0xaa')][_0xcc13('0x5a')]({'where':{'ContactId':_0x5f14eb['id'],'closed':![],'WhatsappAccountId':_0x501828['id']}})['then'](function(_0x377b47){if(_0x377b47){return[_0x377b47,![]];}return db[_0xcc13('0xaa')]['create']({'UserId':_0x422033[_0xcc13('0x5c')]['id'],'ContactId':_0x5f14eb['id'],'WhatsappAccountId':_0x501828['id'],'phone':_0x2782a8,'firstMsgDirection':'out','Messages':[_['merge'](_0x422033[_0xcc13('0x64')],{'read':![],'body':_0x422033[_0xcc13('0x64')][_0xcc13('0x64')],'phone':_0x2782a8,'WhatsappAccountId':_0x501828['id'],'UserId':_0x422033[_0xcc13('0x5c')]['id'],'ContactId':_0x5f14eb['id']})]},{'include':[{'model':db[_0xcc13('0x87')],'as':_0xcc13('0xc6')}]})[_0xcc13('0x20')](function(_0x28512c){return[_0x28512c,!![]];});});}})[_0xcc13('0x74')](function(_0x208d18,_0xf0bc17){if(_0xf0bc17){return _0x208d18;}return db[_0xcc13('0x87')][_0xcc13('0x5b')](_[_0xcc13('0x51')](_0x422033[_0xcc13('0x64')],{'read':![],'body':_0x422033[_0xcc13('0x64')][_0xcc13('0x64')],'phone':_0x2782a8,'WhatsappAccountId':_0x501828['id'],'WhatsappInteractionId':_0x208d18['id'],'UserId':_0x422033[_0xcc13('0x5c')]['id'],'ContactId':_0x5f14eb['id']}))[_0xcc13('0x20')](function(_0x404a77){_0x208d18[_0xcc13('0xc7')][_0xcc13('0xc6')]=[];_0x208d18[_0xcc13('0xc7')][_0xcc13('0xc6')]['push'](_0x404a77['dataValues']);return _0x208d18;});})[_0xcc13('0x20')](respondWithResult(_0x416956,null))[_0xcc13('0x29')](handleError(_0x416956,null));}; \ No newline at end of file +var _0x0de2=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappAccount','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','send','getApplications','notify','whatsapp','account','sinch','statuses','state','read','applications','orderBy','Applications','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','omit','Contacts','WhatsappInteraction','spread','interaction','created','autoclose','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','debug','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','rimraf','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x576f46,_0x56c0fd){var _0x5b58be=function(_0x3ba4a6){while(--_0x3ba4a6){_0x576f46['push'](_0x576f46['shift']());}};_0x5b58be(++_0x56c0fd);}(_0x0de2,0xa4));var _0x20de=function(_0x379ca9,_0x268f7f){_0x379ca9=_0x379ca9-0x0;var _0x8c3467=_0x0de2[_0x379ca9];return _0x8c3467;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20de('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x20de('0x1'));var moment=require(_0x20de('0x2'));var BPromise=require(_0x20de('0x3'));var Mustache=require(_0x20de('0x4'));var util=require('util');var path=require('path');var sox=require(_0x20de('0x5'));var csv=require('to-csv');var ejs=require(_0x20de('0x6'));var fs=require('fs');var fs_extra=require(_0x20de('0x7'));var _=require('lodash');var squel=require(_0x20de('0x8'));var crypto=require(_0x20de('0x9'));var jsforce=require(_0x20de('0xa'));var deskjs=require(_0x20de('0xb'));var toCsv=require(_0x20de('0xc'));var querystring=require(_0x20de('0xd'));var Papa=require(_0x20de('0xe'));var Redis=require('ioredis');var authService=require(_0x20de('0xf'));var qs=require(_0x20de('0x10'));var as=require(_0x20de('0x11'));var hardwareService=require(_0x20de('0x12'));var logger=require(_0x20de('0x13'))('api');var utils=require(_0x20de('0x14'));var config=require(_0x20de('0x15'));var licenseUtil=require(_0x20de('0x16'));var db=require(_0x20de('0x17'))['db'];config['redis']=_[_0x20de('0x18')](config[_0x20de('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x20de('0x1a'))(new Redis(config['redis']));require(_0x20de('0x1b'))[_0x20de('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x20de('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x8ab427,_0x54cf86,_0x59bff,_0x18b7c2){return new BPromise(function(_0x3b52b5,_0x55552f){var _0x4d76da=_0x18b7c2||client;return _0x4d76da[_0x20de('0x1e')](_0x8ab427,_0x59bff)[_0x20de('0x1f')](function(_0x51b571){logger[_0x20de('0x20')](_0x20de('0x21'),_0x54cf86,_0x20de('0x22'));logger['debug'](_0x20de('0x23'),_0x54cf86,_0x20de('0x22'),JSON[_0x20de('0x24')](_0x51b571));if(_0x51b571[_0x20de('0x25')]){if(_0x51b571[_0x20de('0x25')][_0x20de('0x26')]===0x1f4){logger[_0x20de('0x25')](_0x20de('0x21'),_0x54cf86,_0x51b571[_0x20de('0x25')][_0x20de('0x27')]);return _0x55552f(_0x51b571[_0x20de('0x25')][_0x20de('0x27')]);}logger[_0x20de('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x54cf86,_0x51b571['error'][_0x20de('0x27')]);return _0x3b52b5(_0x51b571['error'][_0x20de('0x27')]);}else{logger['info'](_0x20de('0x21'),_0x54cf86,_0x20de('0x22'));_0x3b52b5(_0x51b571[_0x20de('0x28')][_0x20de('0x27')]);}})['catch'](function(_0x4693c2){logger[_0x20de('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x54cf86,_0x4693c2);_0x55552f(_0x4693c2);});});}function respondWithStatusCode(_0x3124bd,_0x2a81bc){_0x2a81bc=_0x2a81bc||0xcc;return function(_0x48cca6){if(_0x48cca6){return _0x3124bd[_0x20de('0x29')](_0x2a81bc);}return _0x3124bd[_0x20de('0x2a')](_0x2a81bc)['end']();};}function respondWithResult(_0x4af5b2,_0x39d406){_0x39d406=_0x39d406||0xc8;return function(_0x22017b){if(_0x22017b){return _0x4af5b2[_0x20de('0x2a')](_0x39d406)[_0x20de('0x2b')](_0x22017b);}};}function respondWithFilteredResult(_0x346d3d,_0x3a0f37){return function(_0x32131e){if(_0x32131e){var _0x366839=typeof _0x3a0f37[_0x20de('0x2c')]===_0x20de('0x2d')&&typeof _0x3a0f37[_0x20de('0x2e')]===_0x20de('0x2d');var _0x4cd33c=_0x32131e[_0x20de('0x2f')];var _0x22ba5e=_0x366839?0x0:_0x3a0f37[_0x20de('0x2c')];var _0x1ffe28=_0x366839?_0x32131e['count']:_0x3a0f37[_0x20de('0x2c')]+_0x3a0f37[_0x20de('0x2e')];var _0x1c3f32;if(_0x1ffe28>=_0x4cd33c){_0x1ffe28=_0x4cd33c;_0x1c3f32=0xc8;}else{_0x1c3f32=0xce;}_0x346d3d['status'](_0x1c3f32);return _0x346d3d[_0x20de('0x30')](_0x20de('0x31'),_0x22ba5e+'-'+_0x1ffe28+'/'+_0x4cd33c)[_0x20de('0x2b')](_0x32131e);}return null;};}function patchUpdates(_0x2409f6){return function(_0x8bcc1f){try{jsonpatch[_0x20de('0x32')](_0x8bcc1f,_0x2409f6,!![]);}catch(_0x2a342d){return BPromise[_0x20de('0x33')](_0x2a342d);}return _0x8bcc1f[_0x20de('0x34')]();};}function saveUpdates(_0x2135cc,_0x1b6b09){return function(_0x32db70){if(_0x32db70){return _0x32db70[_0x20de('0x35')](_0x2135cc)[_0x20de('0x1f')](function(_0x3ce365){return _0x3ce365;});}return null;};}function removeEntity(_0x161f89,_0x3f5a0a){return function(_0x20eb91){if(_0x20eb91){return _0x20eb91[_0x20de('0x36')]()[_0x20de('0x1f')](function(){var _0x39e4ec=_0x20eb91[_0x20de('0x37')]({'plain':!![]});var _0x1b32fb=_0x20de('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x1b32fb,'resourceId':_0x39e4ec['id']}})[_0x20de('0x1f')](function(){return _0x20eb91;});})[_0x20de('0x1f')](function(){_0x161f89[_0x20de('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c38d9,_0x1886f1){return function(_0x137e99){if(!_0x137e99){_0x5c38d9[_0x20de('0x29')](0x194);}return _0x137e99;};}function handleError(_0x6f8150,_0x5109cb){_0x5109cb=_0x5109cb||0x1f4;return function(_0x2ca0d7){logger[_0x20de('0x25')](_0x2ca0d7[_0x20de('0x39')]);if(_0x2ca0d7[_0x20de('0x3a')]){delete _0x2ca0d7[_0x20de('0x3a')];}_0x6f8150[_0x20de('0x2a')](_0x5109cb)['send'](_0x2ca0d7);};}exports[_0x20de('0x3b')]=function(_0x536dbd,_0x51d38c){var _0x3a36ad={'include':[{'model':db[_0x20de('0x3c')],'as':_0x20de('0x3d')}]},_0x42b2c7={},_0x55bc6b={'count':0x0,'rows':[]};var _0x335e29=_[_0x20de('0x3e')](db['WhatsappAccount']['rawAttributes'],function(_0x3ed89f){return{'name':_0x3ed89f[_0x20de('0x3f')],'type':_0x3ed89f[_0x20de('0x40')][_0x20de('0x41')]};});_0x42b2c7[_0x20de('0x42')]=_[_0x20de('0x3e')](_0x335e29,'name');_0x42b2c7[_0x20de('0x43')]=_[_0x20de('0x44')](_0x536dbd[_0x20de('0x43')]);_0x42b2c7[_0x20de('0x45')]=_[_0x20de('0x46')](_0x42b2c7[_0x20de('0x42')],_0x42b2c7[_0x20de('0x43')]);_0x3a36ad[_0x20de('0x47')]=_[_0x20de('0x46')](_0x42b2c7[_0x20de('0x42')],qs[_0x20de('0x48')](_0x536dbd[_0x20de('0x43')][_0x20de('0x48')]));_0x3a36ad[_0x20de('0x47')]=_0x3a36ad['attributes'][_0x20de('0x49')]?_0x3a36ad[_0x20de('0x47')]:_0x42b2c7[_0x20de('0x42')];if(!_0x536dbd[_0x20de('0x43')][_0x20de('0x4a')](_0x20de('0x4b'))){_0x3a36ad[_0x20de('0x2e')]=qs['limit'](_0x536dbd['query']['limit']);_0x3a36ad[_0x20de('0x2c')]=qs['offset'](_0x536dbd[_0x20de('0x43')]['offset']);}_0x3a36ad['order']=qs[_0x20de('0x4c')](_0x536dbd[_0x20de('0x43')][_0x20de('0x4c')]);_0x3a36ad[_0x20de('0x4d')]=qs[_0x20de('0x45')](_[_0x20de('0x4e')](_0x536dbd['query'],_0x42b2c7[_0x20de('0x45')]),_0x335e29);if(_0x536dbd[_0x20de('0x43')][_0x20de('0x4f')]){_0x3a36ad[_0x20de('0x4d')]=_['merge'](_0x3a36ad[_0x20de('0x4d')],{'$or':_[_0x20de('0x3e')](_0x335e29,function(_0x460a4c){if(_0x460a4c[_0x20de('0x40')]!==_0x20de('0x50')){var _0x53f15d={};_0x53f15d[_0x460a4c[_0x20de('0x3a')]]={'$like':'%'+_0x536dbd['query'][_0x20de('0x4f')]+'%'};return _0x53f15d;}})});}_0x3a36ad=_[_0x20de('0x51')]({},_0x3a36ad,_0x536dbd[_0x20de('0x52')]);var _0x505dc1={'where':_0x3a36ad['where']};return db[_0x20de('0x53')][_0x20de('0x2f')](_0x505dc1)[_0x20de('0x1f')](function(_0x32b786){_0x55bc6b['count']=_0x32b786;if(_0x536dbd[_0x20de('0x43')][_0x20de('0x54')]){_0x3a36ad[_0x20de('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x20de('0x56')](_0x3a36ad);})[_0x20de('0x1f')](function(_0x5d9592){_0x55bc6b[_0x20de('0x57')]=_0x5d9592;return _0x55bc6b;})[_0x20de('0x1f')](respondWithFilteredResult(_0x51d38c,_0x3a36ad))[_0x20de('0x58')](handleError(_0x51d38c,null));};exports[_0x20de('0x59')]=function(_0xa19792,_0x432b0c){var _0x4391b9={'raw':![],'where':{'id':_0xa19792['params']['id']},'include':[{'model':db[_0x20de('0x3c')],'as':_0x20de('0x3d')}]},_0x551eba={};_0x551eba[_0x20de('0x42')]=_[_0x20de('0x44')](db['WhatsappAccount'][_0x20de('0x5a')]);_0x551eba['query']=_['keys'](_0xa19792['query']);_0x551eba[_0x20de('0x45')]=_['intersection'](_0x551eba[_0x20de('0x42')],_0x551eba[_0x20de('0x43')]);_0x4391b9[_0x20de('0x47')]=_[_0x20de('0x46')](_0x551eba[_0x20de('0x42')],qs[_0x20de('0x48')](_0xa19792['query'][_0x20de('0x48')]));_0x4391b9['attributes']=_0x4391b9[_0x20de('0x47')][_0x20de('0x49')]?_0x4391b9[_0x20de('0x47')]:_0x551eba[_0x20de('0x42')];if(_0xa19792[_0x20de('0x43')][_0x20de('0x54')]){_0x4391b9[_0x20de('0x55')]=[{'all':!![]}];}_0x4391b9=_[_0x20de('0x51')]({},_0x4391b9,_0xa19792[_0x20de('0x52')]);return db['WhatsappAccount'][_0x20de('0x5b')](_0x4391b9)[_0x20de('0x1f')](handleEntityNotFound(_0x432b0c,null))[_0x20de('0x1f')](respondWithResult(_0x432b0c,null))['catch'](handleError(_0x432b0c,null));};exports[_0x20de('0x5c')]=function(_0x2411dc,_0x4dfe73){return db[_0x20de('0x53')][_0x20de('0x5c')](_0x2411dc[_0x20de('0x5d')],{})[_0x20de('0x1f')](function(_0x5f19a4){var _0x268239=_0x2411dc[_0x20de('0x5e')][_0x20de('0x37')]({'plain':!![]});if(!_0x268239)throw new Error(_0x20de('0x5f'));if(_0x268239[_0x20de('0x60')]===_0x20de('0x5e')){var _0x208b4c=_0x5f19a4[_0x20de('0x37')]({'plain':!![]});var _0xf2bacd='WhatsappAccounts';return db['UserProfileSection'][_0x20de('0x5b')]({'where':{'name':_0xf2bacd,'userProfileId':_0x268239[_0x20de('0x61')]},'raw':!![]})[_0x20de('0x1f')](function(_0x3983bd){if(_0x3983bd&&_0x3983bd['autoAssociation']===0x0){return db['UserProfileResource'][_0x20de('0x5c')]({'name':_0x208b4c[_0x20de('0x3a')],'resourceId':_0x208b4c['id'],'type':_0x3983bd[_0x20de('0x3a')],'sectionId':_0x3983bd['id']},{})[_0x20de('0x1f')](function(){return _0x5f19a4;});}else{return _0x5f19a4;}})['catch'](function(_0x3bac6f){logger[_0x20de('0x25')](_0x20de('0x62'),_0x3bac6f);throw _0x3bac6f;});}return _0x5f19a4;})[_0x20de('0x1f')](respondWithResult(_0x4dfe73,0xc9))[_0x20de('0x58')](handleError(_0x4dfe73,null));};exports[_0x20de('0x35')]=function(_0x5ddc25,_0x39810f){if(_0x5ddc25['body']['id']){delete _0x5ddc25[_0x20de('0x5d')]['id'];}return db[_0x20de('0x53')][_0x20de('0x5b')]({'where':{'id':_0x5ddc25[_0x20de('0x63')]['id']},'include':[{'model':db[_0x20de('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x20de('0x1f')](handleEntityNotFound(_0x39810f,null))['then'](saveUpdates(_0x5ddc25[_0x20de('0x5d')],null))[_0x20de('0x1f')](respondWithResult(_0x39810f,null))['catch'](handleError(_0x39810f,null));};exports[_0x20de('0x36')]=function(_0x6a9dfb,_0x27bf0b){return db['WhatsappAccount'][_0x20de('0x5b')]({'where':{'id':_0x6a9dfb[_0x20de('0x63')]['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0x27bf0b,null))['then'](removeEntity(_0x27bf0b,null))[_0x20de('0x58')](handleError(_0x27bf0b,null));};exports[_0x20de('0x64')]=function(_0x39929e,_0x3e2a2f){return db[_0x20de('0x53')]['describe']()[_0x20de('0x1f')](respondWithResult(_0x3e2a2f,null))[_0x20de('0x58')](handleError(_0x3e2a2f,null));};exports[_0x20de('0x65')]=function(_0x1b8a91,_0x197557,_0x3caa43){if(_0x1b8a91[_0x20de('0x5d')]['id']){delete _0x1b8a91[_0x20de('0x5d')]['id'];}return db[_0x20de('0x53')][_0x20de('0x5b')]({'where':{'id':_0x1b8a91[_0x20de('0x63')]['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0x197557,null))[_0x20de('0x1f')](function(_0x3241b3){if(_0x3241b3){_0x1b8a91[_0x20de('0x5d')][_0x20de('0x66')]=_0x3241b3['id'];return db[_0x20de('0x67')][_0x20de('0x5c')](_0x1b8a91[_0x20de('0x5d')]);}})[_0x20de('0x1f')](respondWithResult(_0x197557,null))[_0x20de('0x58')](handleError(_0x197557,null));};exports[_0x20de('0x68')]=function(_0x128653,_0x45a68f,_0x174510){var _0x33b341={'raw':![],'where':{}};var _0x5d35c5={};var _0x3bca46={'count':0x0,'rows':[]};return db[_0x20de('0x53')][_0x20de('0x69')]({'where':{'id':_0x128653[_0x20de('0x63')]['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0x45a68f,null))['then'](function(_0x5bbf5f){if(_0x5bbf5f){_0x5d35c5['model']=_['keys'](db[_0x20de('0x67')][_0x20de('0x5a')]);_0x5d35c5[_0x20de('0x43')]=_[_0x20de('0x44')](_0x128653[_0x20de('0x43')]);_0x5d35c5[_0x20de('0x45')]=_[_0x20de('0x46')](_0x5d35c5[_0x20de('0x42')],_0x5d35c5['query']);_0x33b341[_0x20de('0x47')]=_[_0x20de('0x46')](_0x5d35c5[_0x20de('0x42')],qs[_0x20de('0x48')](_0x128653[_0x20de('0x43')][_0x20de('0x48')]));_0x33b341['attributes']=_0x33b341[_0x20de('0x47')][_0x20de('0x49')]?_0x33b341['attributes']:_0x5d35c5['model'];if(!_0x128653[_0x20de('0x43')][_0x20de('0x4a')](_0x20de('0x4b'))){_0x33b341['limit']=qs[_0x20de('0x2e')](_0x128653['query']['limit']);_0x33b341['offset']=qs['offset'](_0x128653['query'][_0x20de('0x2c')]);}_0x33b341[_0x20de('0x6a')]=qs[_0x20de('0x4c')](_0x128653[_0x20de('0x43')][_0x20de('0x4c')]);_0x33b341[_0x20de('0x4d')]=qs['filters'](_[_0x20de('0x4e')](_0x128653[_0x20de('0x43')],_0x5d35c5['filters']));_0x33b341[_0x20de('0x4d')][_0x20de('0x66')]=_0x5bbf5f['id'];if(_0x128653[_0x20de('0x43')][_0x20de('0x4f')]){_0x33b341[_0x20de('0x4d')]=_[_0x20de('0x51')](_0x33b341[_0x20de('0x4d')],{'$or':_[_0x20de('0x3e')](_0x33b341[_0x20de('0x47')],function(_0x2ae058){var _0x4b99f7={};_0x4b99f7[_0x2ae058]={'$like':'%'+_0x128653['query'][_0x20de('0x4f')]+'%'};return _0x4b99f7;})});}_0x33b341=_['merge']({},_0x33b341,_0x128653['options']);return db['Disposition'][_0x20de('0x2f')]({'where':_0x33b341[_0x20de('0x4d')]})['then'](function(_0xe3aa){_0x3bca46['count']=_0xe3aa;if(_0x128653[_0x20de('0x43')][_0x20de('0x54')]){_0x33b341[_0x20de('0x55')]=[{'all':!![]}];}return db[_0x20de('0x67')][_0x20de('0x56')](_0x33b341);})['then'](function(_0x1e0f65){_0x3bca46[_0x20de('0x57')]=_0x1e0f65;return _0x3bca46;});}})[_0x20de('0x1f')](respondWithFilteredResult(_0x45a68f,_0x33b341))['catch'](handleError(_0x45a68f,null));};exports['removeDispositions']=function(_0xdf94cc,_0x112168,_0x273415){return db[_0x20de('0x53')][_0x20de('0x5b')]({'where':{'id':_0xdf94cc['params']['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0x112168,null))[_0x20de('0x1f')](function(_0x291ac0){if(_0x291ac0){return _0x291ac0['removeDispositions'](_0xdf94cc['query'][_0x20de('0x6b')]);}})[_0x20de('0x1f')](respondWithStatusCode(_0x112168,null))[_0x20de('0x58')](handleError(_0x112168,null));};exports['addAnswer']=function(_0x4340da,_0xbbee0d,_0x1e3129){if(_0x4340da[_0x20de('0x5d')]['id']){delete _0x4340da[_0x20de('0x5d')]['id'];}return db[_0x20de('0x53')][_0x20de('0x5b')]({'where':{'id':_0x4340da[_0x20de('0x63')]['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0xbbee0d,null))[_0x20de('0x1f')](function(_0x33ff2d){if(_0x33ff2d){_0x4340da[_0x20de('0x5d')][_0x20de('0x66')]=_0x33ff2d['id'];return db[_0x20de('0x6c')][_0x20de('0x5c')](_0x4340da[_0x20de('0x5d')]);}})[_0x20de('0x1f')](respondWithResult(_0xbbee0d,null))[_0x20de('0x58')](handleError(_0xbbee0d,null));};exports[_0x20de('0x6d')]=function(_0x43d0b5,_0x55f97a,_0x3c654c){var _0x577ddb={'raw':![],'where':{}};var _0x3369f0={};var _0x132fbf={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x20de('0x69')]({'where':{'id':_0x43d0b5[_0x20de('0x63')]['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0x55f97a,null))[_0x20de('0x1f')](function(_0x22d9a2){if(_0x22d9a2){_0x3369f0[_0x20de('0x42')]=_['keys'](db[_0x20de('0x6c')][_0x20de('0x5a')]);_0x3369f0[_0x20de('0x43')]=_[_0x20de('0x44')](_0x43d0b5['query']);_0x3369f0[_0x20de('0x45')]=_[_0x20de('0x46')](_0x3369f0[_0x20de('0x42')],_0x3369f0[_0x20de('0x43')]);_0x577ddb['attributes']=_[_0x20de('0x46')](_0x3369f0[_0x20de('0x42')],qs[_0x20de('0x48')](_0x43d0b5['query'][_0x20de('0x48')]));_0x577ddb['attributes']=_0x577ddb[_0x20de('0x47')]['length']?_0x577ddb[_0x20de('0x47')]:_0x3369f0['model'];if(!_0x43d0b5[_0x20de('0x43')][_0x20de('0x4a')](_0x20de('0x4b'))){_0x577ddb[_0x20de('0x2e')]=qs['limit'](_0x43d0b5[_0x20de('0x43')][_0x20de('0x2e')]);_0x577ddb[_0x20de('0x2c')]=qs[_0x20de('0x2c')](_0x43d0b5['query'][_0x20de('0x2c')]);}_0x577ddb[_0x20de('0x6a')]=qs['sort'](_0x43d0b5[_0x20de('0x43')][_0x20de('0x4c')]);_0x577ddb[_0x20de('0x4d')]=qs[_0x20de('0x45')](_['pick'](_0x43d0b5[_0x20de('0x43')],_0x3369f0['filters']));_0x577ddb[_0x20de('0x4d')][_0x20de('0x66')]=_0x22d9a2['id'];if(_0x43d0b5[_0x20de('0x43')]['filter']){_0x577ddb[_0x20de('0x4d')]=_[_0x20de('0x51')](_0x577ddb[_0x20de('0x4d')],{'$or':_[_0x20de('0x3e')](_0x577ddb[_0x20de('0x47')],function(_0x574403){var _0x4eb3d9={};_0x4eb3d9[_0x574403]={'$like':'%'+_0x43d0b5[_0x20de('0x43')][_0x20de('0x4f')]+'%'};return _0x4eb3d9;})});}_0x577ddb=_[_0x20de('0x51')]({},_0x577ddb,_0x43d0b5[_0x20de('0x52')]);return db[_0x20de('0x6c')]['count']({'where':_0x577ddb[_0x20de('0x4d')]})[_0x20de('0x1f')](function(_0x16bf84){_0x132fbf[_0x20de('0x2f')]=_0x16bf84;if(_0x43d0b5[_0x20de('0x43')]['includeAll']){_0x577ddb[_0x20de('0x55')]=[{'all':!![]}];}return db[_0x20de('0x6c')][_0x20de('0x56')](_0x577ddb);})['then'](function(_0x27d392){_0x132fbf[_0x20de('0x57')]=_0x27d392;return _0x132fbf;});}})[_0x20de('0x1f')](respondWithFilteredResult(_0x55f97a,_0x577ddb))[_0x20de('0x58')](handleError(_0x55f97a,null));};exports['removeAnswers']=function(_0x2656d7,_0x4745da,_0x175262){return db['WhatsappAccount'][_0x20de('0x5b')]({'where':{'id':_0x2656d7[_0x20de('0x63')]['id']}})['then'](handleEntityNotFound(_0x4745da,null))['then'](function(_0x39788b){if(_0x39788b){return _0x39788b[_0x20de('0x6e')](_0x2656d7[_0x20de('0x43')][_0x20de('0x6b')]);}})[_0x20de('0x1f')](respondWithStatusCode(_0x4745da,null))[_0x20de('0x58')](handleError(_0x4745da,null));};exports[_0x20de('0x6f')]=function(_0x2166e9,_0x335deb,_0x247f19){return db[_0x20de('0x53')][_0x20de('0x5b')]({'where':{'id':_0x2166e9[_0x20de('0x63')]['id']}})['then'](handleEntityNotFound(_0x335deb,null))[_0x20de('0x1f')](function(_0x4008c3){if(_0x4008c3){return _0x4008c3[_0x20de('0x6f')](_0x2166e9[_0x20de('0x5d')]['ids'],_['omit'](_0x2166e9[_0x20de('0x5d')],[_0x20de('0x6b'),'id'])||{})['spread'](function(_0x1cf4d4){for(var _0x3d3599=0x0;_0x3d3599<_0x2166e9[_0x20de('0x5d')][_0x20de('0x6b')][_0x20de('0x49')];_0x3d3599+=0x1){socket[_0x20de('0x70')](_0x20de('0x71'),{'UserId':Number(_0x2166e9[_0x20de('0x5d')][_0x20de('0x6b')][_0x3d3599]),'WhatsappAccountId':Number(_0x2166e9[_0x20de('0x63')]['id'])});}return _0x1cf4d4;});}})['then'](respondWithResult(_0x335deb,null))[_0x20de('0x58')](handleError(_0x335deb,null));};exports['removeAgents']=function(_0x49048b,_0xf05e41,_0x157f3d){return db['WhatsappAccount'][_0x20de('0x5b')]({'where':{'id':_0x49048b[_0x20de('0x63')]['id']}})['then'](handleEntityNotFound(_0xf05e41,null))[_0x20de('0x1f')](function(_0x12e303){if(_0x12e303){return _0x12e303[_0x20de('0x72')](_0x49048b[_0x20de('0x43')][_0x20de('0x6b')])[_0x20de('0x1f')](function(){if(_[_0x20de('0x73')](_0x49048b['query'][_0x20de('0x6b')])){for(var _0x44e84c=0x0;_0x44e84c<_0x49048b['query'][_0x20de('0x6b')][_0x20de('0x49')];_0x44e84c+=0x1){socket['emit'](_0x20de('0x74'),{'UserId':Number(_0x49048b['query'][_0x20de('0x6b')][_0x44e84c]),'WhatsappAccountId':Number(_0x49048b[_0x20de('0x63')]['id'])});}}else{socket[_0x20de('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x49048b[_0x20de('0x43')][_0x20de('0x6b')]),'WhatsappAccountId':Number(_0x49048b[_0x20de('0x63')]['id'])});}});}})[_0x20de('0x1f')](respondWithStatusCode(_0xf05e41,null))[_0x20de('0x58')](handleError(_0xf05e41,null));};exports['getAgents']=function(_0x4e49ac,_0x50d534,_0x31922f){var _0x980ef={};var _0x3d5bb8={};var _0x1bb058;var _0x153ecb;return db[_0x20de('0x53')][_0x20de('0x69')]({'where':{'id':_0x4e49ac[_0x20de('0x63')]['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0x50d534,null))[_0x20de('0x1f')](function(_0x1239d0){if(_0x1239d0){_0x1bb058=_0x1239d0;_0x3d5bb8[_0x20de('0x42')]=_[_0x20de('0x44')](db[_0x20de('0x75')][_0x20de('0x5a')]);_0x3d5bb8[_0x20de('0x43')]=_[_0x20de('0x44')](_0x4e49ac['query']);_0x3d5bb8[_0x20de('0x45')]=_['intersection'](_0x3d5bb8['model'],_0x3d5bb8[_0x20de('0x43')]);_0x980ef[_0x20de('0x47')]=_['intersection'](_0x3d5bb8[_0x20de('0x42')],qs[_0x20de('0x48')](_0x4e49ac['query'][_0x20de('0x48')]));_0x980ef[_0x20de('0x47')]=_0x980ef['attributes'][_0x20de('0x49')]?_0x980ef[_0x20de('0x47')]:_0x3d5bb8[_0x20de('0x42')];_0x980ef[_0x20de('0x6a')]=qs[_0x20de('0x4c')](_0x4e49ac['query'][_0x20de('0x4c')]);_0x980ef['where']=qs[_0x20de('0x45')](_[_0x20de('0x4e')](_0x4e49ac[_0x20de('0x43')],_0x3d5bb8[_0x20de('0x45')]));if(_0x4e49ac[_0x20de('0x43')]['filter']){_0x980ef['where']=_['merge'](_0x980ef[_0x20de('0x4d')],{'$or':_[_0x20de('0x3e')](_0x980ef[_0x20de('0x47')],function(_0xcc021a){var _0x4f2dda={};_0x4f2dda[_0xcc021a]={'$like':'%'+_0x4e49ac['query'][_0x20de('0x4f')]+'%'};return _0x4f2dda;})});}_0x980ef=_[_0x20de('0x51')]({},_0x980ef,_0x4e49ac['options']);return _0x1bb058['getAgents'](_0x980ef);}})[_0x20de('0x1f')](function(_0x3d61bd){if(_0x3d61bd){_0x153ecb=_0x3d61bd['length'];if(!_0x4e49ac[_0x20de('0x43')][_0x20de('0x4a')]('nolimit')){_0x980ef[_0x20de('0x2e')]=qs[_0x20de('0x2e')](_0x4e49ac[_0x20de('0x43')][_0x20de('0x2e')]);_0x980ef[_0x20de('0x2c')]=qs[_0x20de('0x2c')](_0x4e49ac[_0x20de('0x43')][_0x20de('0x2c')]);}return _0x1bb058[_0x20de('0x76')](_0x980ef);}})[_0x20de('0x1f')](function(_0x2df4ef){if(_0x2df4ef){return _0x2df4ef?{'count':_0x153ecb,'rows':_0x2df4ef}:null;}})['then'](respondWithResult(_0x50d534,null))[_0x20de('0x58')](handleError(_0x50d534,null));};exports[_0x20de('0x77')]=function(_0x381d49,_0x52be76){var _0x132f48=_0x381d49[_0x20de('0x63')]['id'];var _0x553613=_0x381d49['body'];var _0x5334bc=0xc8;var _0x557b26=null;return db[_0x20de('0x78')][_0x20de('0x79')]({'isolationLevel':db[_0x20de('0x78')]['Transaction']['ISOLATION_LEVELS'][_0x20de('0x7a')]},function(_0x21785e){return db[_0x20de('0x53')][_0x20de('0x69')]({'where':{'id':_0x132f48},'transaction':_0x21785e})[_0x20de('0x1f')](function(_0x19a903){if(_0x19a903){return db[_0x20de('0x7b')][_0x20de('0x36')]({'where':{'WhatsappAccountId':_0x132f48},'transaction':_0x21785e})[_0x20de('0x1f')](function(){var _0x6081b7=_[_0x20de('0x3e')](_0x553613,function(_0xdb9c5e){_0xdb9c5e[_0x20de('0x66')]=_0x132f48;return _0xdb9c5e;});return db[_0x20de('0x7b')][_0x20de('0x7c')](_0x6081b7,{'transaction':_0x21785e});});}else{_0x5334bc=0x194;_0x557b26=[];}});})[_0x20de('0x1f')](function(){if(_0x5334bc!==0x194){return db[_0x20de('0x7b')][_0x20de('0x7d')]({'where':{'WhatsappAccountId':_0x132f48},'order':'priority'})[_0x20de('0x1f')](function(_0x1b08ca){_0x557b26=_0x1b08ca;});}})[_0x20de('0x58')](function(_0x2f5bf4){_0x5334bc=0x1f4;logger[_0x20de('0x25')](_0x2f5bf4[_0x20de('0x39')]);if(_0x2f5bf4[_0x20de('0x3a')]){delete _0x2f5bf4['name'];}_0x557b26=_0x2f5bf4;})['finally'](function(){if(_0x557b26===null){_0x52be76[_0x20de('0x29')](_0x5334bc);}else{if(_0x5334bc===0x1f4){_0x52be76[_0x20de('0x2a')](_0x5334bc)[_0x20de('0x7e')](_0x557b26);}else{_0x52be76[_0x20de('0x2a')](_0x5334bc)[_0x20de('0x2b')](_0x557b26);}}});};exports['getApplications']=function(_0x407ee7,_0x5b04f1,_0x38bca3){var _0x17b2f0={};var _0x3a5796={};var _0x484984;var _0x10b650;return db[_0x20de('0x53')][_0x20de('0x69')]({'where':{'id':_0x407ee7['params']['id']}})[_0x20de('0x1f')](handleEntityNotFound(_0x5b04f1,null))[_0x20de('0x1f')](function(_0x147b85){if(_0x147b85){_0x484984=_0x147b85;_0x3a5796[_0x20de('0x42')]=_[_0x20de('0x44')](db[_0x20de('0x7b')]['rawAttributes']);_0x3a5796[_0x20de('0x43')]=_[_0x20de('0x44')](_0x407ee7[_0x20de('0x43')]);_0x3a5796[_0x20de('0x45')]=_[_0x20de('0x46')](_0x3a5796['model'],_0x3a5796[_0x20de('0x43')]);_0x17b2f0[_0x20de('0x47')]=_[_0x20de('0x46')](_0x3a5796[_0x20de('0x42')],qs[_0x20de('0x48')](_0x407ee7[_0x20de('0x43')]['fields']));_0x17b2f0['attributes']=_0x17b2f0['attributes'][_0x20de('0x49')]?_0x17b2f0[_0x20de('0x47')]:_0x3a5796[_0x20de('0x42')];_0x17b2f0[_0x20de('0x6a')]=qs[_0x20de('0x4c')](_0x407ee7[_0x20de('0x43')][_0x20de('0x4c')]);_0x17b2f0[_0x20de('0x4d')]=qs['filters'](_['pick'](_0x407ee7[_0x20de('0x43')],_0x3a5796['filters']));if(_0x407ee7[_0x20de('0x43')][_0x20de('0x4f')]){_0x17b2f0[_0x20de('0x4d')]=_[_0x20de('0x51')](_0x17b2f0[_0x20de('0x4d')],{'$or':_[_0x20de('0x3e')](_0x17b2f0[_0x20de('0x47')],function(_0x476414){var _0x1f8dd5={};_0x1f8dd5[_0x476414]={'$like':'%'+_0x407ee7[_0x20de('0x43')][_0x20de('0x4f')]+'%'};return _0x1f8dd5;})});}_0x17b2f0=_[_0x20de('0x51')]({},_0x17b2f0,_0x407ee7[_0x20de('0x52')]);return _0x484984['getApplications'](_0x17b2f0);}})['then'](function(_0x62511b){if(_0x62511b){_0x10b650=_0x62511b[_0x20de('0x49')];if(!_0x407ee7[_0x20de('0x43')][_0x20de('0x4a')]('nolimit')){_0x17b2f0[_0x20de('0x2e')]=qs[_0x20de('0x2e')](_0x407ee7[_0x20de('0x43')]['limit']);_0x17b2f0[_0x20de('0x2c')]=qs['offset'](_0x407ee7[_0x20de('0x43')][_0x20de('0x2c')]);}return _0x484984[_0x20de('0x7f')](_0x17b2f0);}})['then'](function(_0x130f46){if(_0x130f46){return _0x130f46?{'count':_0x10b650,'rows':_0x130f46}:null;}})[_0x20de('0x1f')](respondWithResult(_0x5b04f1,null))[_0x20de('0x58')](handleError(_0x5b04f1,null));};exports[_0x20de('0x80')]=function(_0x11539d,_0x4d977c,_0x8db1e3){var _0x59adbc={'channel':_0x20de('0x81')};var _0x4cf96c=[];var _0x3d7170=[];var _0xe59000={};return db[_0x20de('0x53')]['find']({'where':{'id':_0x11539d['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x20de('0x1f')](handleEntityNotFound(_0x4d977c,null))[_0x20de('0x1f')](function(_0x5c8589){_0x59adbc[_0x20de('0x82')]=_0x5c8589;if(_0x59adbc[_0x20de('0x82')]&&_0x59adbc[_0x20de('0x82')][_0x20de('0x40')]===_0x20de('0x83')&&_0x11539d[_0x20de('0x5d')][_0x20de('0x84')]){if(_0x11539d[_0x20de('0x5d')][_0x20de('0x84')][_0x20de('0x49')]===0x0)return;if(_0x11539d[_0x20de('0x5d')][_0x20de('0x84')][0x0][_0x20de('0x85')]!==_0x20de('0x86'))return;return db['WhatsappMessage'][_0x20de('0x35')]({'read':!![],'readAt':_0x11539d[_0x20de('0x5d')][_0x20de('0x84')][0x0]['timestamp']},{'where':{'messageId':_0x11539d[_0x20de('0x5d')]['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x2542e3){return _0x4d977c[_0x20de('0x2a')](0xc8)[_0x20de('0x2b')](_0x2542e3);});}_0x59adbc[_0x20de('0x87')]=_[_0x20de('0x88')](_0x5c8589[_0x20de('0x89')],['priority'],['asc']);if(_0x59adbc['account'][_0x20de('0x89')]){delete _0x59adbc['account'][_0x20de('0x89')];}return db[_0x20de('0x8a')][_0x20de('0x64')]()[_0x20de('0x1f')](function(_0x578c88){if(!_0x578c88){throw new db[(_0x20de('0x8b'))][(_0x20de('0x8c'))]('no\x20available\x20attributes');}_0x4cf96c=_['difference'](_[_0x20de('0x44')](_0x578c88),[_0x20de('0x8d'),_0x20de('0x8e')]);_0x3d7170=_[_0x20de('0x8f')](_[_0x20de('0x44')](_0x578c88),[_0x20de('0x8d'),'updatedAt',_0x20de('0x90'),_0x20de('0x91')]);_0x59adbc[_0x20de('0x5d')]={'mapKey':_0x20de('0x92')};if(_0x59adbc[_0x20de('0x82')]&&_0x59adbc[_0x20de('0x82')][_0x20de('0x40')]===_0x20de('0x93')){_0x59adbc['body'][_0x20de('0x94')]=_0x11539d[_0x20de('0x5d')]['From'][_0x20de('0x95')](_0x20de('0x96'),'');_0x59adbc[_0x20de('0x5d')][_0x20de('0x5d')]=_0x11539d[_0x20de('0x5d')][_0x20de('0x97')];_0x59adbc['body'][_0x20de('0x98')]=_0x11539d[_0x20de('0x5d')][_0x20de('0x99')];}if(_0x59adbc['account']&&_0x59adbc[_0x20de('0x82')][_0x20de('0x40')]===_0x20de('0x83')){_0x59adbc[_0x20de('0x5d')]['from']=_0x11539d['body'][_0x20de('0x9a')][0x0][_0x20de('0x94')];_0x59adbc[_0x20de('0x5d')][_0x20de('0x5d')]=_0x11539d[_0x20de('0x5d')][_0x20de('0x9a')][0x0][_0x20de('0x27')][_0x20de('0x5d')];_0x59adbc[_0x20de('0x5d')]['messageId']=_0x11539d[_0x20de('0x5d')]['notifications'][0x0][_0x20de('0x9b')];}if(_0x59adbc[_0x20de('0x5d')]['id']){delete _0x59adbc[_0x20de('0x5d')]['id'];}if(_[_0x20de('0x9c')](_0x59adbc[_0x20de('0x5d')][_0x20de('0x94')])){throw new db[(_0x20de('0x8b'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x59adbc['body'][_0x20de('0x5d')])||_0x59adbc['body']['body']===''){throw new db['Sequelize'][(_0x20de('0x8c'))](_0x20de('0x9d'));}if(_[_0x20de('0x9c')](_0x59adbc[_0x20de('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x20de('0x8c'))](_0x20de('0x9e')+_0x3d7170);}if(!_[_0x20de('0x9f')](_0x3d7170,_0x59adbc[_0x20de('0x5d')][_0x20de('0xa0')])){throw new db['Sequelize'][(_0x20de('0x8c'))](_0x20de('0xa1')+_0x3d7170);}_0xe59000[_0x59adbc[_0x20de('0x5d')][_0x20de('0xa0')]]=_0x59adbc['body']['from'];return db['CmList']['find']({'where':{'id':_0x59adbc['account'][_0x20de('0x91')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xe59000,'limit':0x1,'order':[[_0x20de('0x8e'),_0x20de('0xa2')]]}]});})[_0x20de('0x1f')](handleEntityNotFound(_0x4d977c,null))[_0x20de('0x1f')](function(_0x318b32){if(_0x318b32){_0x59adbc[_0x20de('0xa3')]=_[_0x20de('0xa4')](_0x318b32,['Contacts']);if(_0x318b32[_0x20de('0xa5')][_0x20de('0x49')]){return _0x318b32[_0x20de('0xa5')][0x0];}var _0x5b3bb5=_[_0x20de('0x18')](_0x59adbc['body'],{'firstName':_0x59adbc[_0x20de('0x5d')][_0x20de('0x94')],'ListId':_0x318b32['id']});_0x5b3bb5[_0x59adbc[_0x20de('0x5d')][_0x20de('0xa0')]]=_0x59adbc['body'][_0x20de('0x94')];return db[_0x20de('0x8a')][_0x20de('0x5c')](_0x5b3bb5,{'fields':_0x4cf96c,'raw':!![]});}})[_0x20de('0x1f')](handleEntityNotFound(_0x4d977c,null))[_0x20de('0x1f')](function(_0xcf8089){if(_0xcf8089){_0x59adbc['contact']=_0xcf8089;var _0xefbbce={'ContactId':_0xcf8089['id'],'phone':_0x59adbc[_0x20de('0x5d')][_0x20de('0x94')],'WhatsappAccountId':_0x11539d[_0x20de('0x63')]['id']};var _0x213778={'ContactId':_0xcf8089['id'],'WhatsappAccountId':_0x11539d['params']['id'],'closed':![]};return db[_0x20de('0xa6')][_0x20de('0x5b')]({'where':_0x213778})[_0x20de('0x1f')](function(_0xa84e25){if(_0xa84e25){return[_0xa84e25,![]];}return db['WhatsappInteraction'][_0x20de('0x5c')](_0xefbbce)[_0x20de('0x1f')](function(_0x27e1ad){return[_0x27e1ad,!![]];});});}})[_0x20de('0xa7')](function(_0x2795e9,_0xa5e35a){_0x59adbc[_0x20de('0xa8')]=_0x2795e9[_0x20de('0x37')]({'plain':!![]});_0x59adbc[_0x20de('0xa8')][_0x20de('0xa9')]=![];if(_0xa5e35a){if(_0x59adbc['account'][_0x20de('0xaa')]){_0x59adbc[_0x20de('0x87')][_0x20de('0xab')]({'id':0x0,'priority':_0x59adbc[_0x20de('0x87')][_0x20de('0x49')]+0x1,'app':_0x20de('0xac'),'appdata':_0x20de('0xad'),'interval':'*,*,*,*'});}_0x59adbc[_0x20de('0xa8')][_0x20de('0xa9')]=!![];}return db[_0x20de('0xae')]['create']({'phone':_0x59adbc[_0x20de('0x5d')][_0x20de('0x94')],'messageId':_0x59adbc['body'][_0x20de('0x98')],'body':_0x59adbc[_0x20de('0x5d')][_0x20de('0x5d')],'WhatsappAccountId':_0x11539d[_0x20de('0x63')]['id'],'WhatsappInteractionId':_0x2795e9['id'],'direction':'in','ContactId':_0x2795e9[_0x20de('0xaf')],'AttachmentId':_0x59adbc['body'][_0x20de('0xb0')]});})[_0x20de('0x1f')](function(_0x1913cf){_0x59adbc['message']=_0x1913cf;if(!_0x59adbc['interaction'][_0x20de('0xb1')])return;return db[_0x20de('0x75')]['find']({'attributes':['id',_0x20de('0x3a')],'where':{'id':_0x59adbc[_0x20de('0xa8')][_0x20de('0xb1')]}});})[_0x20de('0x1f')](function(_0x28c942){if(_0x28c942){_0x59adbc['applications'][_0x20de('0xb2')]({'id':0x0,'priority':0x0,'app':_0x20de('0xb3'),'appdata':_0x28c942[_0x20de('0x3a')]+','+(_0x59adbc['account'][_0x20de('0xb4')]||0xa),'interval':_0x20de('0xb5')});}if(!_0x59adbc['interaction'][_0x20de('0xb6')])return;return db[_0x20de('0xb7')]['find']({'attributes':['id','name'],'where':{'id':_0x59adbc[_0x20de('0xa8')][_0x20de('0xb6')]}});})[_0x20de('0x1f')](function(_0x56cf77){if(_0x56cf77){_0x59adbc[_0x20de('0x87')][_0x20de('0xb2')]({'id':0x0,'priority':0x1,'app':_0x20de('0xb8'),'appdata':_0x56cf77[_0x20de('0x3a')]+','+(_0x59adbc[_0x20de('0x82')][_0x20de('0xb9')]||0x12c),'interval':_0x20de('0xb5')});}return respondWithRpcPromise(_0x20de('0xba'),_0x20de('0xbb'),_0x59adbc);})['then'](function(_0x5bd759){if(_0x5bd759){var _0x17f257=0xc8;var _0x2e270a=_0x20de('0xbc');logger[_0x20de('0x20')](_0x20de('0x23'),_0x2e270a,_0x17f257,'entity\x20found');logger[_0x20de('0xbd')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2e270a,_0x17f257,'entity\x20found',JSON[_0x20de('0x24')](_0x5bd759));if(_0x59adbc['account'][_0x20de('0x40')]===_0x20de('0x93')){return _0x4d977c['status'](_0x17f257)[_0x20de('0x30')](_0x20de('0xbe'),_0x20de('0xbf'))[_0x20de('0x7e')](_0x20de('0xc0'));}else{return _0x4d977c[_0x20de('0x2a')](_0x17f257)['json'](_0x5bd759);}}});})[_0x20de('0x58')](handleError(_0x4d977c,null));};exports[_0x20de('0x7e')]=function(_0x16ebff,_0x2e7e78,_0x754d24){var _0x3680eb,_0x248e0c,_0x453a1c;if(_['isNil'](_0x16ebff['body']['body'])||_0x16ebff[_0x20de('0x5d')]['body']===''){throw new db['Sequelize'][(_0x20de('0x8c'))](_0x20de('0x9d'));}if(_['isNil'](_0x16ebff[_0x20de('0x5d')]['to'])){throw new db['Sequelize'][(_0x20de('0x8c'))](_0x20de('0xc1'));}_0x3680eb=_0x16ebff[_0x20de('0x5d')]['to'];return db[_0x20de('0x53')][_0x20de('0x5b')]({'where':{'id':_0x16ebff[_0x20de('0x63')]['id']},'include':[{'model':db[_0x20de('0xc2')],'as':_0x20de('0xc3'),'include':[{'model':db[_0x20de('0x8a')],'as':'Contacts','where':{'mobile':_0x3680eb},'limit':0x1,'order':[[_0x20de('0x8e'),_0x20de('0xa2')]]}]}]})[_0x20de('0x1f')](handleEntityNotFound(_0x2e7e78,null))[_0x20de('0x1f')](function(_0x4c1886){if(_0x4c1886&&_0x4c1886['List']){_0x248e0c=_0x4c1886[_0x20de('0x37')]({'plain':!![]});if(_0x248e0c['List']&&_0x248e0c['List'][_0x20de('0xa5')][_0x20de('0x49')]){return _0x248e0c[_0x20de('0xc3')][_0x20de('0xa5')][0x0];}return db[_0x20de('0x8a')][_0x20de('0x5c')](_[_0x20de('0x18')](_0x16ebff[_0x20de('0x5d')],{'firstName':_0x3680eb,'mobile':_0x3680eb,'phone':_0x3680eb,'ListId':_0x248e0c[_0x20de('0x91')]}));}})['then'](handleEntityNotFound(_0x2e7e78,null))[_0x20de('0x1f')](function(_0x44d63f){if(_0x44d63f){_0x453a1c=_0x44d63f;return db[_0x20de('0xa6')][_0x20de('0x5b')]({'where':{'ContactId':_0x453a1c['id'],'closed':![],'WhatsappAccountId':_0x248e0c['id']}})['then'](function(_0x3c3d49){if(_0x3c3d49){return[_0x3c3d49,![]];}return db[_0x20de('0xa6')][_0x20de('0x5c')]({'UserId':_0x16ebff[_0x20de('0x5e')]['id'],'ContactId':_0x453a1c['id'],'WhatsappAccountId':_0x248e0c['id'],'phone':_0x3680eb,'firstMsgDirection':_0x20de('0xc4'),'Messages':[_[_0x20de('0x51')](_0x16ebff[_0x20de('0x5d')],{'read':![],'body':_0x16ebff[_0x20de('0x5d')][_0x20de('0x5d')],'phone':_0x3680eb,'WhatsappAccountId':_0x248e0c['id'],'UserId':_0x16ebff[_0x20de('0x5e')]['id'],'ContactId':_0x453a1c['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x20de('0xc5')}]})[_0x20de('0x1f')](function(_0x4b3e8d){return[_0x4b3e8d,!![]];});});}})[_0x20de('0xa7')](function(_0x4f357d,_0x19924){if(_0x19924){return _0x4f357d;}return db[_0x20de('0xae')]['create'](_[_0x20de('0x51')](_0x16ebff[_0x20de('0x5d')],{'read':![],'body':_0x16ebff[_0x20de('0x5d')]['body'],'phone':_0x3680eb,'WhatsappAccountId':_0x248e0c['id'],'WhatsappInteractionId':_0x4f357d['id'],'UserId':_0x16ebff[_0x20de('0x5e')]['id'],'ContactId':_0x453a1c['id']}))[_0x20de('0x1f')](function(_0x168854){_0x4f357d[_0x20de('0xc6')][_0x20de('0xc5')]=[];_0x4f357d[_0x20de('0xc6')][_0x20de('0xc5')][_0x20de('0xab')](_0x168854[_0x20de('0xc6')]);return _0x4f357d;});})[_0x20de('0x1f')](respondWithResult(_0x2e7e78,null))[_0x20de('0x58')](handleError(_0x2e7e78,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a370029..d2fd277 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 _0x2e0e=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x1e2511,_0x357735){var _0x54afec=function(_0x38cd00){while(--_0x38cd00){_0x1e2511['push'](_0x1e2511['shift']());}};_0x54afec(++_0x357735);}(_0x2e0e,0x1c8));var _0xe2e0=function(_0xdada88,_0x34118d){_0xdada88=_0xdada88-0x0;var _0x46b729=_0x2e0e[_0xdada88];return _0x46b729;};'use strict';var EventEmitter=require(_0xe2e0('0x0'));var WhatsappAccount=require(_0xe2e0('0x1'))['db'][_0xe2e0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe2e0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2e0('0x4'),'afterDestroy':_0xe2e0('0x5')};function emitEvent(_0x3fedda){return function(_0x46faa6,_0x4e8f32,_0x567854){WhatsappAccountEvents[_0xe2e0('0x6')](_0x3fedda+':'+_0x46faa6['id'],_0x46faa6);WhatsappAccountEvents[_0xe2e0('0x6')](_0x3fedda,_0x46faa6);_0x567854(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xe2e0('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xd9d5=['save','update','remove','emit','hasOwnProperty','events','setMaxListeners'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0xd9d5,0x75));var _0x5d9d=function(_0x17309f,_0x49f80b){_0x17309f=_0x17309f-0x0;var _0x18aa71=_0xd9d5[_0x17309f];return _0x18aa71;};'use strict';var EventEmitter=require(_0x5d9d('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5d9d('0x1')](0x0);var events={'afterCreate':_0x5d9d('0x2'),'afterUpdate':_0x5d9d('0x3'),'afterDestroy':_0x5d9d('0x4')};function emitEvent(_0x36629c){return function(_0x2e2b08,_0x17bfc5,_0xd71c1f){WhatsappAccountEvents[_0x5d9d('0x5')](_0x36629c+':'+_0x2e2b08['id'],_0x2e2b08);WhatsappAccountEvents[_0x5d9d('0x5')](_0x36629c,_0x2e2b08);_0xd71c1f(null);};}for(var e in events){if(events[_0x5d9d('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index ec12312..ad47ed3 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 _0x2029=['lodash','util','api','moment','bluebird','request-promise','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x2029,0x1a4));var _0x9202=function(_0xa4e3f2,_0x4445dd){_0xa4e3f2=_0xa4e3f2-0x0;var _0x3fe3be=_0x2029[_0xa4e3f2];return _0x3fe3be;};'use strict';var _=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var logger=require('../../config/logger')(_0x9202('0x2'));var moment=require(_0x9202('0x3'));var BPromise=require(_0x9202('0x4'));var rp=require(_0x9202('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9202('0x6'));var config=require('../../config/environment');var attributes=require(_0x9202('0x7'));module[_0x9202('0x8')]=function(_0x24ac97,_0x586bc5){return _0x24ac97[_0x9202('0x9')](_0x9202('0xa'),attributes,{'tableName':_0x9202('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x644b=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d89ce,_0x5d5e4b){var _0x494a2e=function(_0x1222b8){while(--_0x1222b8){_0x3d89ce['push'](_0x3d89ce['shift']());}};_0x494a2e(++_0x5d5e4b);}(_0x644b,0xa0));var _0xb644=function(_0x348021,_0x24fc80){_0x348021=_0x348021-0x0;var _0x426682=_0x644b[_0x348021];return _0x426682;};'use strict';var _=require(_0xb644('0x0'));var util=require(_0xb644('0x1'));var logger=require(_0xb644('0x2'))(_0xb644('0x3'));var moment=require(_0xb644('0x4'));var BPromise=require(_0xb644('0x5'));var rp=require(_0xb644('0x6'));var fs=require('fs');var path=require(_0xb644('0x7'));var rimraf=require(_0xb644('0x8'));var config=require(_0xb644('0x9'));var attributes=require(_0xb644('0xa'));module[_0xb644('0xb')]=function(_0x11eb76,_0x157b92){return _0x11eb76[_0xb644('0xc')]('WhatsappAccount',attributes,{'tableName':_0xb644('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 67d59ce..b709178 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 _0x59c5=['result','WhatsappAccount','find','options','raw','attributes','include','model','map','ShowWhatsappAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x105b3a,_0x3f146c){var _0x561a8f=function(_0x566e07){while(--_0x566e07){_0x105b3a['push'](_0x105b3a['shift']());}};_0x561a8f(++_0x3f146c);}(_0x59c5,0x132));var _0x559c=function(_0x38f900,_0x62602b){_0x38f900=_0x38f900-0x0;var _0x404fa2=_0x59c5[_0x38f900];return _0x404fa2;};'use strict';var _=require(_0x559c('0x0'));var util=require(_0x559c('0x1'));var moment=require(_0x559c('0x2'));var BPromise=require('bluebird');var rs=require(_0x559c('0x3'));var fs=require('fs');var Redis=require(_0x559c('0x4'));var db=require(_0x559c('0x5'))['db'];var utils=require(_0x559c('0x6'));var logger=require(_0x559c('0x7'))('rpc');var config=require(_0x559c('0x8'));var jayson=require(_0x559c('0x9'));var client=jayson[_0x559c('0xa')][_0x559c('0xb')]({'port':0x232a});config[_0x559c('0xc')]=_[_0x559c('0xd')](config[_0x559c('0xc')],{'host':_0x559c('0xe'),'port':0x18eb});var socket=require(_0x559c('0xf'))(new Redis(config[_0x559c('0xc')]));require('./whatsappAccount.socket')[_0x559c('0x10')](socket);function respondWithRpcPromise(_0x4bd462,_0x6bae6d,_0x219429){return new BPromise(function(_0x4f5ba7,_0x5d40a4){return client[_0x559c('0x11')](_0x4bd462,_0x219429)[_0x559c('0x12')](function(_0x58e702){logger[_0x559c('0x13')](_0x559c('0x14'),_0x6bae6d,'request\x20sent');logger[_0x559c('0x15')](_0x559c('0x16'),_0x6bae6d,_0x559c('0x17'),JSON[_0x559c('0x18')](_0x58e702));if(_0x58e702[_0x559c('0x19')]){if(_0x58e702['error']['code']===0x1f4){logger[_0x559c('0x19')](_0x559c('0x14'),_0x6bae6d,_0x58e702['error'][_0x559c('0x1a')]);return _0x5d40a4(_0x58e702[_0x559c('0x19')]['message']);}logger[_0x559c('0x19')](_0x559c('0x14'),_0x6bae6d,_0x58e702[_0x559c('0x19')][_0x559c('0x1a')]);return _0x4f5ba7(_0x58e702[_0x559c('0x19')]['message']);}else{logger[_0x559c('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x6bae6d,_0x559c('0x17'));_0x4f5ba7(_0x58e702[_0x559c('0x1b')][_0x559c('0x1a')]);}})['catch'](function(_0x51013c){logger[_0x559c('0x19')](_0x559c('0x14'),_0x6bae6d,_0x51013c);_0x5d40a4(_0x51013c);});});}exports['ShowWhatsappAccount']=function(_0x2a39ca){var _0x29be34=this;return new Promise(function(_0xef846c,_0x49395e){return db[_0x559c('0x1c')][_0x559c('0x1d')]({'raw':_0x2a39ca[_0x559c('0x1e')]?_0x2a39ca[_0x559c('0x1e')][_0x559c('0x1f')]===undefined?!![]:![]:!![],'where':_0x2a39ca['options']?_0x2a39ca[_0x559c('0x1e')]['where']||null:null,'attributes':_0x2a39ca[_0x559c('0x1e')]?_0x2a39ca[_0x559c('0x1e')][_0x559c('0x20')]||null:null,'include':_0x2a39ca['options']?_0x2a39ca['options'][_0x559c('0x21')]?_['map'](_0x2a39ca['options']['include'],function(_0x53e5f3){return{'model':db[_0x53e5f3[_0x559c('0x22')]],'as':_0x53e5f3['as'],'attributes':_0x53e5f3[_0x559c('0x20')],'include':_0x53e5f3[_0x559c('0x21')]?_[_0x559c('0x23')](_0x53e5f3[_0x559c('0x21')],function(_0x5ce75e){return{'model':db[_0x5ce75e['model']],'as':_0x5ce75e['as'],'attributes':_0x5ce75e[_0x559c('0x20')],'include':_0x5ce75e[_0x559c('0x21')]?_[_0x559c('0x23')](_0x5ce75e[_0x559c('0x21')],function(_0x1a49b5){return{'model':db[_0x1a49b5[_0x559c('0x22')]],'as':_0x1a49b5['as'],'attributes':_0x1a49b5[_0x559c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x559c('0x12')](function(_0xff096){logger['info']('ShowWhatsappAccount',_0x2a39ca);logger['debug'](_0x559c('0x24'),_0x2a39ca,JSON['stringify'](_0xff096));_0xef846c(_0xff096);})['catch'](function(_0x560c7f){logger[_0x559c('0x19')](_0x559c('0x24'),_0x560c7f[_0x559c('0x1a')],_0x2a39ca);_0x49395e(_0x29be34[_0x559c('0x19')](0x1f4,_0x560c7f[_0x559c('0x1a')]));});});}; \ No newline at end of file +var _0x11e3=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','debug','stringify','catch','lodash','util','moment'];(function(_0x3cddf,_0x1231f5){var _0x29cb91=function(_0x10b316){while(--_0x10b316){_0x3cddf['push'](_0x3cddf['shift']());}};_0x29cb91(++_0x1231f5);}(_0x11e3,0x6f));var _0x311e=function(_0x22e99b,_0x538c54){_0x22e99b=_0x22e99b-0x0;var _0x2b2c38=_0x11e3[_0x22e99b];return _0x2b2c38;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var moment=require(_0x311e('0x2'));var BPromise=require(_0x311e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x311e('0x4'));var db=require(_0x311e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x311e('0x6'))(_0x311e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x311e('0x8')][_0x311e('0x9')]({'port':0x232a});config[_0x311e('0xa')]=_[_0x311e('0xb')](config[_0x311e('0xa')],{'host':_0x311e('0xc'),'port':0x18eb});var socket=require(_0x311e('0xd'))(new Redis(config[_0x311e('0xa')]));require(_0x311e('0xe'))[_0x311e('0xf')](socket);function respondWithRpcPromise(_0x36b445,_0x2bde9f,_0x107912){return new BPromise(function(_0x5efdec,_0x3bab9b){return client['request'](_0x36b445,_0x107912)[_0x311e('0x10')](function(_0x33c300){logger[_0x311e('0x11')](_0x311e('0x12'),_0x2bde9f,'request\x20sent');logger['debug'](_0x311e('0x13'),_0x2bde9f,'request\x20sent',JSON['stringify'](_0x33c300));if(_0x33c300[_0x311e('0x14')]){if(_0x33c300[_0x311e('0x14')][_0x311e('0x15')]===0x1f4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x33c300[_0x311e('0x14')]['message']);return _0x3bab9b(_0x33c300[_0x311e('0x14')]['message']);}logger['error'](_0x311e('0x12'),_0x2bde9f,_0x33c300['error'][_0x311e('0x16')]);return _0x5efdec(_0x33c300['error'][_0x311e('0x16')]);}else{logger[_0x311e('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x2bde9f,_0x311e('0x17'));_0x5efdec(_0x33c300[_0x311e('0x18')][_0x311e('0x16')]);}})['catch'](function(_0x30b7b4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x30b7b4);_0x3bab9b(_0x30b7b4);});});}exports[_0x311e('0x19')]=function(_0x399fc2){var _0x47f42f=this;return new Promise(function(_0x3a6ccd,_0x5c0a69){return db[_0x311e('0x1a')][_0x311e('0x1b')]({'raw':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x1d')]===undefined?!![]:![]:!![],'where':_0x399fc2['options']?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1e')]||null:null,'attributes':_0x399fc2[_0x311e('0x1c')]?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1f')]||null:null,'include':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x20')]?_['map'](_0x399fc2[_0x311e('0x1c')][_0x311e('0x20')],function(_0x247cb2){return{'model':db[_0x247cb2[_0x311e('0x21')]],'as':_0x247cb2['as'],'attributes':_0x247cb2['attributes'],'include':_0x247cb2[_0x311e('0x20')]?_['map'](_0x247cb2[_0x311e('0x20')],function(_0x4de135){return{'model':db[_0x4de135[_0x311e('0x21')]],'as':_0x4de135['as'],'attributes':_0x4de135[_0x311e('0x1f')],'include':_0x4de135['include']?_[_0x311e('0x22')](_0x4de135[_0x311e('0x20')],function(_0x102b1c){return{'model':db[_0x102b1c[_0x311e('0x21')]],'as':_0x102b1c['as'],'attributes':_0x102b1c[_0x311e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x311e('0x10')](function(_0x8e00d0){logger[_0x311e('0x11')]('ShowWhatsappAccount',_0x399fc2);logger[_0x311e('0x23')](_0x311e('0x19'),_0x399fc2,JSON[_0x311e('0x24')](_0x8e00d0));_0x3a6ccd(_0x8e00d0);})[_0x311e('0x25')](function(_0x1c5b0b){logger[_0x311e('0x14')](_0x311e('0x19'),_0x1c5b0b[_0x311e('0x16')],_0x399fc2);_0x5c0a69(_0x47f42f[_0x311e('0x14')](0x1f4,_0x1c5b0b[_0x311e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 13e9cc0..396739b 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 _0x71cb=['update','removeListener','register','whatsappAccount:','save','remove'];(function(_0x345b38,_0x5b587a){var _0x2a92f7=function(_0x4a918f){while(--_0x4a918f){_0x345b38['push'](_0x345b38['shift']());}};_0x2a92f7(++_0x5b587a);}(_0x71cb,0x14e));var _0xb71c=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x71cb[_0x34bf97];return _0x292719;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xb71c('0x0'),_0xb71c('0x1'),_0xb71c('0x2')];function createListener(_0x37ac01,_0x360b6f){return function(_0x39b78f){_0x360b6f['emit'](_0x37ac01,_0x39b78f);};}function removeListener(_0x1b7974,_0xbd0ddf){return function(){WhatsappAccountEvents[_0xb71c('0x3')](_0x1b7974,_0xbd0ddf);};}exports[_0xb71c('0x4')]=function(_0x2605a3){for(var _0x3ff857=0x0,_0x35fb48=events['length'];_0x3ff857<_0x35fb48;_0x3ff857++){var _0x11e69e=events[_0x3ff857];var _0x4b507a=createListener(_0xb71c('0x5')+_0x11e69e,_0x2605a3);WhatsappAccountEvents['on'](_0x11e69e,_0x4b507a);}}; \ No newline at end of file +var _0xc6a1=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x42f154,_0x32110c){var _0x471993=function(_0x29154a){while(--_0x29154a){_0x42f154['push'](_0x42f154['shift']());}};_0x471993(++_0x32110c);}(_0xc6a1,0x151));var _0x1c6a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc6a1[_0x13d07a];return _0x5ee0ee;};'use strict';var WhatsappAccountEvents=require(_0x1c6a('0x0'));var events=[_0x1c6a('0x1'),_0x1c6a('0x2'),_0x1c6a('0x3')];function createListener(_0x29d6bb,_0x18dd13){return function(_0x5000d2){_0x18dd13[_0x1c6a('0x4')](_0x29d6bb,_0x5000d2);};}function removeListener(_0x37294e,_0x503814){return function(){WhatsappAccountEvents[_0x1c6a('0x5')](_0x37294e,_0x503814);};}exports[_0x1c6a('0x6')]=function(_0x4bdca1){for(var _0x1c0e0d=0x0,_0x3aa51e=events[_0x1c6a('0x7')];_0x1c0e0d<_0x3aa51e;_0x1c0e0d++){var _0x3e372c=events[_0x1c0e0d];var _0x3303c9=createListener(_0x1c6a('0x8')+_0x3e372c,_0x4bdca1);WhatsappAccountEvents['on'](_0x3e372c,_0x3303c9);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cd5dfa5..08ae8df 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 _0x7ba1=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x96b6a,_0x12471d){var _0x3e16f3=function(_0xa1fc4b){while(--_0xa1fc4b){_0x96b6a['push'](_0x96b6a['shift']());}};_0x3e16f3(++_0x12471d);}(_0x7ba1,0x17f));var _0x17ba=function(_0x1c8ed1,_0x5df36a){_0x1c8ed1=_0x1c8ed1-0x0;var _0xcbafb9=_0x7ba1[_0x1c8ed1];return _0xcbafb9;};'use strict';var multer=require(_0x17ba('0x0'));var util=require(_0x17ba('0x1'));var path=require(_0x17ba('0x2'));var timeout=require('connect-timeout');var express=require(_0x17ba('0x3'));var router=express[_0x17ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x17ba('0x5'));var interaction=require(_0x17ba('0x6'));var config=require(_0x17ba('0x7'));var controller=require(_0x17ba('0x8'));router[_0x17ba('0x9')]('/',auth[_0x17ba('0xa')](),controller['index']);router['get'](_0x17ba('0xb'),auth[_0x17ba('0xa')](),controller[_0x17ba('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x17ba('0xd')]);router[_0x17ba('0xe')](_0x17ba('0xb'),auth[_0x17ba('0xa')](),controller[_0x17ba('0xf')]);router[_0x17ba('0x10')]('/:id',auth[_0x17ba('0xa')](),controller[_0x17ba('0x11')]);module[_0x17ba('0x12')]=router; \ No newline at end of file +var _0xbc8c=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x2c4570,_0x21871d){var _0x26f4b0=function(_0x56b0dc){while(--_0x56b0dc){_0x2c4570['push'](_0x2c4570['shift']());}};_0x26f4b0(++_0x21871d);}(_0xbc8c,0x11b));var _0xcbc8=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xbc8c[_0x286726];return _0xcd4fe9;};'use strict';var multer=require(_0xcbc8('0x0'));var util=require('util');var path=require(_0xcbc8('0x1'));var timeout=require('connect-timeout');var express=require(_0xcbc8('0x2'));var router=express[_0xcbc8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcbc8('0x4'));var interaction=require(_0xcbc8('0x5'));var config=require(_0xcbc8('0x6'));var controller=require('./whatsappApplication.controller');router[_0xcbc8('0x7')]('/',auth['isAuthenticated'](),controller[_0xcbc8('0x8')]);router[_0xcbc8('0x7')](_0xcbc8('0x9'),auth[_0xcbc8('0xa')](),controller[_0xcbc8('0xb')]);router[_0xcbc8('0xc')]('/',auth[_0xcbc8('0xa')](),controller[_0xcbc8('0xd')]);router[_0xcbc8('0xe')](_0xcbc8('0x9'),auth[_0xcbc8('0xa')](),controller['update']);router[_0xcbc8('0xf')](_0xcbc8('0x9'),auth[_0xcbc8('0xa')](),controller[_0xcbc8('0x10')]);module[_0xcbc8('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index c670c74..fc1f05e 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 _0x433e=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x433e,0x1b7));var _0xe433=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x433e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe433('0x0'));module[_0xe433('0x1')]={'priority':{'type':Sequelize[_0xe433('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe433('0x3')],'allowNull':![],'defaultValue':_0xe433('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe433('0x3')]},'interval':{'type':Sequelize[_0xe433('0x3')],'defaultValue':_0xe433('0x5')}}; \ No newline at end of file +var _0x9679=['noop','*,*,*,*','exports','STRING'];(function(_0x441b57,_0x110df1){var _0x8bbacd=function(_0x543e85){while(--_0x543e85){_0x441b57['push'](_0x441b57['shift']());}};_0x8bbacd(++_0x110df1);}(_0x9679,0x132));var _0x9967=function(_0x4c9e3e,_0x46367b){_0x4c9e3e=_0x4c9e3e-0x0;var _0x16ffd2=_0x9679[_0x4c9e3e];return _0x16ffd2;};'use strict';var Sequelize=require('sequelize');module[_0x9967('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9967('0x1')],'allowNull':![],'defaultValue':_0x9967('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9967('0x1')]},'interval':{'type':Sequelize[_0x9967('0x1')],'defaultValue':_0x9967('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1c2d548..99c7e84 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 _0x2cc4=['index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name'];(function(_0x21ecdc,_0x3b9aa7){var _0x20d3be=function(_0x22b44){while(--_0x22b44){_0x21ecdc['push'](_0x21ecdc['shift']());}};_0x20d3be(++_0x3b9aa7);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x2cc4[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x42cc('0x0'));var rimraf=require(_0x42cc('0x1'));var zipdir=require(_0x42cc('0x2'));var jsonpatch=require(_0x42cc('0x3'));var rp=require('request-promise');var moment=require(_0x42cc('0x4'));var BPromise=require(_0x42cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x42cc('0x6'));var csv=require(_0x42cc('0x7'));var ejs=require(_0x42cc('0x8'));var fs=require('fs');var fs_extra=require(_0x42cc('0x9'));var _=require(_0x42cc('0xa'));var squel=require('squel');var crypto=require(_0x42cc('0xb'));var jsforce=require(_0x42cc('0xc'));var deskjs=require(_0x42cc('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x42cc('0xe'));var Redis=require(_0x42cc('0xf'));var authService=require(_0x42cc('0x10'));var qs=require(_0x42cc('0x11'));var as=require(_0x42cc('0x12'));var hardwareService=require(_0x42cc('0x13'));var logger=require(_0x42cc('0x14'))(_0x42cc('0x15'));var utils=require(_0x42cc('0x16'));var config=require(_0x42cc('0x17'));var licenseUtil=require(_0x42cc('0x18'));var db=require(_0x42cc('0x19'))['db'];function respondWithStatusCode(_0x5a21eb,_0x5d4911){_0x5d4911=_0x5d4911||0xcc;return function(_0x52ed54){if(_0x52ed54){return _0x5a21eb[_0x42cc('0x1a')](_0x5d4911);}return _0x5a21eb[_0x42cc('0x1b')](_0x5d4911)[_0x42cc('0x1c')]();};}function respondWithResult(_0x561a8d,_0x45ebd6){_0x45ebd6=_0x45ebd6||0xc8;return function(_0x4feb57){if(_0x4feb57){return _0x561a8d[_0x42cc('0x1b')](_0x45ebd6)['json'](_0x4feb57);}};}function respondWithFilteredResult(_0x3287a2,_0x21a34e){return function(_0x3e2fdf){if(_0x3e2fdf){var _0x394b8b=typeof _0x21a34e[_0x42cc('0x1d')]===_0x42cc('0x1e')&&typeof _0x21a34e[_0x42cc('0x1f')]===_0x42cc('0x1e');var _0x2ecb4e=_0x3e2fdf[_0x42cc('0x20')];var _0x50ccdb=_0x394b8b?0x0:_0x21a34e[_0x42cc('0x1d')];var _0x354b8f=_0x394b8b?_0x3e2fdf['count']:_0x21a34e['offset']+_0x21a34e[_0x42cc('0x1f')];var _0x4e0cc9;if(_0x354b8f>=_0x2ecb4e){_0x354b8f=_0x2ecb4e;_0x4e0cc9=0xc8;}else{_0x4e0cc9=0xce;}_0x3287a2[_0x42cc('0x1b')](_0x4e0cc9);return _0x3287a2[_0x42cc('0x21')](_0x42cc('0x22'),_0x50ccdb+'-'+_0x354b8f+'/'+_0x2ecb4e)[_0x42cc('0x23')](_0x3e2fdf);}return null;};}function patchUpdates(_0x197c32){return function(_0x31e781){try{jsonpatch[_0x42cc('0x24')](_0x31e781,_0x197c32,!![]);}catch(_0x4dc736){return BPromise[_0x42cc('0x25')](_0x4dc736);}return _0x31e781['save']();};}function saveUpdates(_0xbcd566,_0x26ea99){return function(_0x58c348){if(_0x58c348){return _0x58c348[_0x42cc('0x26')](_0xbcd566)[_0x42cc('0x27')](function(_0x4d6eee){return _0x4d6eee;});}return null;};}function removeEntity(_0x293aad,_0x4c9bcb){return function(_0x136e2b){if(_0x136e2b){return _0x136e2b['destroy']()[_0x42cc('0x27')](function(){_0x293aad[_0x42cc('0x1b')](0xcc)[_0x42cc('0x1c')]();});}};}function handleEntityNotFound(_0x58d4d6,_0x37c46b){return function(_0x5e1476){if(!_0x5e1476){_0x58d4d6[_0x42cc('0x1a')](0x194);}return _0x5e1476;};}function handleError(_0x39a076,_0x3d1d2f){_0x3d1d2f=_0x3d1d2f||0x1f4;return function(_0x326d40){logger[_0x42cc('0x28')](_0x326d40[_0x42cc('0x29')]);if(_0x326d40[_0x42cc('0x2a')]){delete _0x326d40['name'];}_0x39a076[_0x42cc('0x1b')](_0x3d1d2f)['send'](_0x326d40);};}exports[_0x42cc('0x2b')]=function(_0xd06eb7,_0x1f33c4){var _0x5682c3={},_0x906283={},_0x3bc2e3={'count':0x0,'rows':[]};var _0x190b35=_['map'](db['WhatsappApplication'][_0x42cc('0x2c')],function(_0x557042){return{'name':_0x557042[_0x42cc('0x2d')],'type':_0x557042[_0x42cc('0x2e')][_0x42cc('0x2f')]};});_0x906283[_0x42cc('0x30')]=_[_0x42cc('0x31')](_0x190b35,'name');_0x906283[_0x42cc('0x32')]=_['keys'](_0xd06eb7[_0x42cc('0x32')]);_0x906283['filters']=_[_0x42cc('0x33')](_0x906283[_0x42cc('0x30')],_0x906283[_0x42cc('0x32')]);_0x5682c3[_0x42cc('0x34')]=_[_0x42cc('0x33')](_0x906283[_0x42cc('0x30')],qs['fields'](_0xd06eb7[_0x42cc('0x32')][_0x42cc('0x35')]));_0x5682c3[_0x42cc('0x34')]=_0x5682c3['attributes']['length']?_0x5682c3['attributes']:_0x906283[_0x42cc('0x30')];if(!_0xd06eb7[_0x42cc('0x32')]['hasOwnProperty'](_0x42cc('0x36'))){_0x5682c3['limit']=qs[_0x42cc('0x1f')](_0xd06eb7[_0x42cc('0x32')][_0x42cc('0x1f')]);_0x5682c3['offset']=qs[_0x42cc('0x1d')](_0xd06eb7['query'][_0x42cc('0x1d')]);}_0x5682c3[_0x42cc('0x37')]=qs[_0x42cc('0x38')](_0xd06eb7[_0x42cc('0x32')][_0x42cc('0x38')]);_0x5682c3['where']=qs[_0x42cc('0x39')](_[_0x42cc('0x3a')](_0xd06eb7[_0x42cc('0x32')],_0x906283['filters']),_0x190b35);if(_0xd06eb7[_0x42cc('0x32')][_0x42cc('0x3b')]){_0x5682c3[_0x42cc('0x3c')]=_[_0x42cc('0x3d')](_0x5682c3['where'],{'$or':_['map'](_0x190b35,function(_0x964d73){if(_0x964d73[_0x42cc('0x2e')]!=='VIRTUAL'){var _0x550670={};_0x550670[_0x964d73[_0x42cc('0x2a')]]={'$like':'%'+_0xd06eb7[_0x42cc('0x32')][_0x42cc('0x3b')]+'%'};return _0x550670;}})});}_0x5682c3=_[_0x42cc('0x3d')]({},_0x5682c3,_0xd06eb7[_0x42cc('0x3e')]);var _0x4ea784={'where':_0x5682c3['where']};return db[_0x42cc('0x3f')][_0x42cc('0x20')](_0x4ea784)[_0x42cc('0x27')](function(_0x3be090){_0x3bc2e3[_0x42cc('0x20')]=_0x3be090;if(_0xd06eb7['query'][_0x42cc('0x40')]){_0x5682c3[_0x42cc('0x41')]=[{'all':!![]}];}return db[_0x42cc('0x3f')][_0x42cc('0x42')](_0x5682c3);})[_0x42cc('0x27')](function(_0x17688b){_0x3bc2e3[_0x42cc('0x43')]=_0x17688b;return _0x3bc2e3;})[_0x42cc('0x27')](respondWithFilteredResult(_0x1f33c4,_0x5682c3))[_0x42cc('0x44')](handleError(_0x1f33c4,null));};exports[_0x42cc('0x45')]=function(_0x3da228,_0xbb9462){var _0x117c1a={'raw':!![],'where':{'id':_0x3da228[_0x42cc('0x46')]['id']}},_0x27c543={};_0x27c543['model']=_['keys'](db[_0x42cc('0x3f')][_0x42cc('0x2c')]);_0x27c543[_0x42cc('0x32')]=_[_0x42cc('0x47')](_0x3da228[_0x42cc('0x32')]);_0x27c543[_0x42cc('0x39')]=_['intersection'](_0x27c543[_0x42cc('0x30')],_0x27c543[_0x42cc('0x32')]);_0x117c1a[_0x42cc('0x34')]=_[_0x42cc('0x33')](_0x27c543[_0x42cc('0x30')],qs[_0x42cc('0x35')](_0x3da228[_0x42cc('0x32')][_0x42cc('0x35')]));_0x117c1a[_0x42cc('0x34')]=_0x117c1a[_0x42cc('0x34')][_0x42cc('0x48')]?_0x117c1a['attributes']:_0x27c543['model'];if(_0x3da228[_0x42cc('0x32')][_0x42cc('0x40')]){_0x117c1a[_0x42cc('0x41')]=[{'all':!![]}];}_0x117c1a=_[_0x42cc('0x3d')]({},_0x117c1a,_0x3da228['options']);return db[_0x42cc('0x3f')]['find'](_0x117c1a)[_0x42cc('0x27')](handleEntityNotFound(_0xbb9462,null))['then'](respondWithResult(_0xbb9462,null))['catch'](handleError(_0xbb9462,null));};exports[_0x42cc('0x49')]=function(_0x5a964f,_0xab51d0){return db[_0x42cc('0x3f')][_0x42cc('0x49')](_0x5a964f[_0x42cc('0x4a')],{})[_0x42cc('0x27')](respondWithResult(_0xab51d0,0xc9))['catch'](handleError(_0xab51d0,null));};exports[_0x42cc('0x26')]=function(_0x43c414,_0xe1c4b9){if(_0x43c414[_0x42cc('0x4a')]['id']){delete _0x43c414[_0x42cc('0x4a')]['id'];}return db[_0x42cc('0x3f')]['find']({'where':{'id':_0x43c414[_0x42cc('0x46')]['id']}})[_0x42cc('0x27')](handleEntityNotFound(_0xe1c4b9,null))[_0x42cc('0x27')](saveUpdates(_0x43c414[_0x42cc('0x4a')],null))[_0x42cc('0x27')](respondWithResult(_0xe1c4b9,null))[_0x42cc('0x44')](handleError(_0xe1c4b9,null));};exports[_0x42cc('0x4b')]=function(_0x19c1ac,_0x475e58){return db['WhatsappApplication'][_0x42cc('0x4c')]({'where':{'id':_0x19c1ac[_0x42cc('0x46')]['id']}})['then'](handleEntityNotFound(_0x475e58,null))['then'](removeEntity(_0x475e58,null))[_0x42cc('0x44')](handleError(_0x475e58,null));}; \ No newline at end of file +var _0x27f3=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','WhatsappApplication','type','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','VIRTUAL','merge','include','findAll','catch','show','params','options','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x20ccbf,_0x289d03){var _0x5b4641=function(_0x53934a){while(--_0x53934a){_0x20ccbf['push'](_0x20ccbf['shift']());}};_0x5b4641(++_0x289d03);}(_0x27f3,0x1e9));var _0x327f=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x27f3[_0x14490c];return _0x2f6825;};'use strict';var emlformat=require(_0x327f('0x0'));var rimraf=require(_0x327f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x327f('0x2'));var rp=require(_0x327f('0x3'));var moment=require('moment');var BPromise=require(_0x327f('0x4'));var Mustache=require('mustache');var util=require(_0x327f('0x5'));var path=require(_0x327f('0x6'));var sox=require(_0x327f('0x7'));var csv=require(_0x327f('0x8'));var ejs=require(_0x327f('0x9'));var fs=require('fs');var fs_extra=require(_0x327f('0xa'));var _=require(_0x327f('0xb'));var squel=require(_0x327f('0xc'));var crypto=require('crypto');var jsforce=require(_0x327f('0xd'));var deskjs=require(_0x327f('0xe'));var toCsv=require(_0x327f('0x8'));var querystring=require(_0x327f('0xf'));var Papa=require(_0x327f('0x10'));var Redis=require(_0x327f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x327f('0x12'));var as=require(_0x327f('0x13'));var hardwareService=require(_0x327f('0x14'));var logger=require(_0x327f('0x15'))(_0x327f('0x16'));var utils=require(_0x327f('0x17'));var config=require(_0x327f('0x18'));var licenseUtil=require(_0x327f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30bdf6,_0x2d44ea){_0x2d44ea=_0x2d44ea||0xcc;return function(_0x22cf14){if(_0x22cf14){return _0x30bdf6[_0x327f('0x1a')](_0x2d44ea);}return _0x30bdf6[_0x327f('0x1b')](_0x2d44ea)[_0x327f('0x1c')]();};}function respondWithResult(_0x3dd9bb,_0x2a1c25){_0x2a1c25=_0x2a1c25||0xc8;return function(_0x4d72c3){if(_0x4d72c3){return _0x3dd9bb['status'](_0x2a1c25)[_0x327f('0x1d')](_0x4d72c3);}};}function respondWithFilteredResult(_0x378ed8,_0x40ae4f){return function(_0x67e1f4){if(_0x67e1f4){var _0x36731f=typeof _0x40ae4f[_0x327f('0x1e')]===_0x327f('0x1f')&&typeof _0x40ae4f[_0x327f('0x20')]===_0x327f('0x1f');var _0x38d11b=_0x67e1f4[_0x327f('0x21')];var _0x56e60c=_0x36731f?0x0:_0x40ae4f[_0x327f('0x1e')];var _0x19c63a=_0x36731f?_0x67e1f4[_0x327f('0x21')]:_0x40ae4f[_0x327f('0x1e')]+_0x40ae4f[_0x327f('0x20')];var _0x329e17;if(_0x19c63a>=_0x38d11b){_0x19c63a=_0x38d11b;_0x329e17=0xc8;}else{_0x329e17=0xce;}_0x378ed8[_0x327f('0x1b')](_0x329e17);return _0x378ed8[_0x327f('0x22')](_0x327f('0x23'),_0x56e60c+'-'+_0x19c63a+'/'+_0x38d11b)[_0x327f('0x1d')](_0x67e1f4);}return null;};}function patchUpdates(_0x57b1e5){return function(_0x2c18e8){try{jsonpatch[_0x327f('0x24')](_0x2c18e8,_0x57b1e5,!![]);}catch(_0x55b2a0){return BPromise[_0x327f('0x25')](_0x55b2a0);}return _0x2c18e8[_0x327f('0x26')]();};}function saveUpdates(_0x2737c4,_0x4742ab){return function(_0x37e959){if(_0x37e959){return _0x37e959['update'](_0x2737c4)[_0x327f('0x27')](function(_0x173cd2){return _0x173cd2;});}return null;};}function removeEntity(_0x321bef,_0x4eb966){return function(_0x1f1d98){if(_0x1f1d98){return _0x1f1d98[_0x327f('0x28')]()[_0x327f('0x27')](function(){_0x321bef[_0x327f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8a89b,_0x372a4e){return function(_0x222601){if(!_0x222601){_0xa8a89b[_0x327f('0x1a')](0x194);}return _0x222601;};}function handleError(_0x4664d3,_0x661ca0){_0x661ca0=_0x661ca0||0x1f4;return function(_0x1c22e4){logger['error'](_0x1c22e4[_0x327f('0x29')]);if(_0x1c22e4[_0x327f('0x2a')]){delete _0x1c22e4[_0x327f('0x2a')];}_0x4664d3['status'](_0x661ca0)[_0x327f('0x2b')](_0x1c22e4);};}exports[_0x327f('0x2c')]=function(_0x44598d,_0xc0489e){var _0x12587d={},_0x123c42={},_0x45b5a2={'count':0x0,'rows':[]};var _0x4d0621=_['map'](db[_0x327f('0x2d')]['rawAttributes'],function(_0x1a6e22){return{'name':_0x1a6e22['fieldName'],'type':_0x1a6e22[_0x327f('0x2e')]['key']};});_0x123c42['model']=_[_0x327f('0x2f')](_0x4d0621,_0x327f('0x2a'));_0x123c42[_0x327f('0x30')]=_[_0x327f('0x31')](_0x44598d['query']);_0x123c42[_0x327f('0x32')]=_[_0x327f('0x33')](_0x123c42[_0x327f('0x34')],_0x123c42[_0x327f('0x30')]);_0x12587d[_0x327f('0x35')]=_[_0x327f('0x33')](_0x123c42[_0x327f('0x34')],qs['fields'](_0x44598d[_0x327f('0x30')][_0x327f('0x36')]));_0x12587d[_0x327f('0x35')]=_0x12587d[_0x327f('0x35')][_0x327f('0x37')]?_0x12587d['attributes']:_0x123c42[_0x327f('0x34')];if(!_0x44598d[_0x327f('0x30')]['hasOwnProperty']('nolimit')){_0x12587d[_0x327f('0x20')]=qs[_0x327f('0x20')](_0x44598d[_0x327f('0x30')][_0x327f('0x20')]);_0x12587d[_0x327f('0x1e')]=qs['offset'](_0x44598d[_0x327f('0x30')]['offset']);}_0x12587d[_0x327f('0x38')]=qs[_0x327f('0x39')](_0x44598d[_0x327f('0x30')][_0x327f('0x39')]);_0x12587d[_0x327f('0x3a')]=qs[_0x327f('0x32')](_['pick'](_0x44598d[_0x327f('0x30')],_0x123c42['filters']),_0x4d0621);if(_0x44598d['query'][_0x327f('0x3b')]){_0x12587d['where']=_['merge'](_0x12587d[_0x327f('0x3a')],{'$or':_[_0x327f('0x2f')](_0x4d0621,function(_0x177c5e){if(_0x177c5e['type']!==_0x327f('0x3c')){var _0xce3980={};_0xce3980[_0x177c5e[_0x327f('0x2a')]]={'$like':'%'+_0x44598d[_0x327f('0x30')][_0x327f('0x3b')]+'%'};return _0xce3980;}})});}_0x12587d=_[_0x327f('0x3d')]({},_0x12587d,_0x44598d['options']);var _0x3ed04b={'where':_0x12587d[_0x327f('0x3a')]};return db[_0x327f('0x2d')]['count'](_0x3ed04b)[_0x327f('0x27')](function(_0x152e3a){_0x45b5a2['count']=_0x152e3a;if(_0x44598d['query']['includeAll']){_0x12587d[_0x327f('0x3e')]=[{'all':!![]}];}return db[_0x327f('0x2d')][_0x327f('0x3f')](_0x12587d);})[_0x327f('0x27')](function(_0x206509){_0x45b5a2['rows']=_0x206509;return _0x45b5a2;})[_0x327f('0x27')](respondWithFilteredResult(_0xc0489e,_0x12587d))[_0x327f('0x40')](handleError(_0xc0489e,null));};exports[_0x327f('0x41')]=function(_0x246e0c,_0x59bc55){var _0x59a4f8={'raw':!![],'where':{'id':_0x246e0c[_0x327f('0x42')]['id']}},_0x38cd2d={};_0x38cd2d['model']=_['keys'](db[_0x327f('0x2d')]['rawAttributes']);_0x38cd2d[_0x327f('0x30')]=_[_0x327f('0x31')](_0x246e0c['query']);_0x38cd2d[_0x327f('0x32')]=_[_0x327f('0x33')](_0x38cd2d['model'],_0x38cd2d['query']);_0x59a4f8[_0x327f('0x35')]=_[_0x327f('0x33')](_0x38cd2d[_0x327f('0x34')],qs[_0x327f('0x36')](_0x246e0c['query'][_0x327f('0x36')]));_0x59a4f8['attributes']=_0x59a4f8[_0x327f('0x35')][_0x327f('0x37')]?_0x59a4f8[_0x327f('0x35')]:_0x38cd2d[_0x327f('0x34')];if(_0x246e0c[_0x327f('0x30')]['includeAll']){_0x59a4f8[_0x327f('0x3e')]=[{'all':!![]}];}_0x59a4f8=_[_0x327f('0x3d')]({},_0x59a4f8,_0x246e0c[_0x327f('0x43')]);return db[_0x327f('0x2d')]['find'](_0x59a4f8)[_0x327f('0x27')](handleEntityNotFound(_0x59bc55,null))[_0x327f('0x27')](respondWithResult(_0x59bc55,null))[_0x327f('0x40')](handleError(_0x59bc55,null));};exports[_0x327f('0x44')]=function(_0x378f05,_0x5686d6){return db['WhatsappApplication'][_0x327f('0x44')](_0x378f05[_0x327f('0x45')],{})['then'](respondWithResult(_0x5686d6,0xc9))[_0x327f('0x40')](handleError(_0x5686d6,null));};exports[_0x327f('0x46')]=function(_0x3b4dee,_0x510093){if(_0x3b4dee[_0x327f('0x45')]['id']){delete _0x3b4dee[_0x327f('0x45')]['id'];}return db[_0x327f('0x2d')][_0x327f('0x47')]({'where':{'id':_0x3b4dee[_0x327f('0x42')]['id']}})[_0x327f('0x27')](handleEntityNotFound(_0x510093,null))[_0x327f('0x27')](saveUpdates(_0x3b4dee['body'],null))[_0x327f('0x27')](respondWithResult(_0x510093,null))['catch'](handleError(_0x510093,null));};exports[_0x327f('0x28')]=function(_0x3baf5c,_0x2004b7){return db[_0x327f('0x2d')]['find']({'where':{'id':_0x3baf5c['params']['id']}})[_0x327f('0x27')](handleEntityNotFound(_0x2004b7,null))[_0x327f('0x27')](removeEntity(_0x2004b7,null))['catch'](handleError(_0x2004b7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f40c36d..5f931c7 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 _0xac95=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./whatsappApplication.attributes'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xac95,0xa8));var _0x5ac9=function(_0x1f6aac,_0x4f0abe){_0x1f6aac=_0x1f6aac-0x0;var _0x3a2e87=_0xac95[_0x1f6aac];return _0x3a2e87;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var logger=require(_0x5ac9('0x2'))(_0x5ac9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ac9('0x4'));var fs=require('fs');var path=require(_0x5ac9('0x5'));var rimraf=require('rimraf');var config=require(_0x5ac9('0x6'));var attributes=require(_0x5ac9('0x7'));module['exports']=function(_0x1dc09a,_0x2bb4da){return _0x1dc09a[_0x5ac9('0x8')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ac9('0x9'),'collate':_0x5ac9('0xa')});}; \ No newline at end of file +var _0x3fc6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','whatsapp_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x3fc6,0x159));var _0x63fc=function(_0x41cee1,_0x21e87f){_0x41cee1=_0x41cee1-0x0;var _0x4eef0f=_0x3fc6[_0x41cee1];return _0x4eef0f;};'use strict';var _=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var logger=require(_0x63fc('0x2'))('api');var moment=require(_0x63fc('0x3'));var BPromise=require(_0x63fc('0x4'));var rp=require(_0x63fc('0x5'));var fs=require('fs');var path=require(_0x63fc('0x6'));var rimraf=require(_0x63fc('0x7'));var config=require(_0x63fc('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xdb65b8,_0x7d24f){return _0xdb65b8[_0x63fc('0x9')]('WhatsappApplication',attributes,{'tableName':_0x63fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63fc('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 2ed36be..f0d802e 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 _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e2dab,_0x5a85fe){var _0x1fbbd7=function(_0x343605){while(--_0x343605){_0x2e2dab['push'](_0x2e2dab['shift']());}};_0x1fbbd7(++_0x5a85fe);}(_0x032e,0x124));var _0xe032=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x032e[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x55e0,0xdc));var _0x055e=function(_0x2fd189,_0x277696){_0x2fd189=_0x2fd189-0x0;var _0xe55b3e=_0x55e0[_0x2fd189];return _0xe55b3e;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f8e6807..587113f 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 _0xcd59=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags'];(function(_0x5672cc,_0xef803c){var _0x35a223=function(_0x14e77a){while(--_0x14e77a){_0x5672cc['push'](_0x5672cc['shift']());}};_0x35a223(++_0xef803c);}(_0xcd59,0x14b));var _0x9cd5=function(_0x2d6faa,_0x442cd3){_0x2d6faa=_0x2d6faa-0x0;var _0x4f0bc0=_0xcd59[_0x2d6faa];return _0x4f0bc0;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xc')]);router[_0x9cd5('0xa')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller['describe']);router[_0x9cd5('0xa')](_0x9cd5('0xe'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0xa')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x11')]);router['get'](_0x9cd5('0x12'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x13')]);router[_0x9cd5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9cd5('0x14')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x15')]);router[_0x9cd5('0x14')](_0x9cd5('0x16'),auth['isAuthenticated'](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x19')),controller['addTags']);router['put']('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')]('whatsapp',_0x9cd5('0x1a')),controller[_0x9cd5('0x1b')]);router[_0x9cd5('0x1c')]('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x1d')),controller[_0x9cd5('0x1e')]);router[_0x9cd5('0x1c')]('/:id/tags',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x1f')]);module[_0x9cd5('0x20')]=router; \ No newline at end of file +var _0xf9d5=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','download','post','create','/:id/messages','/:id/tags','whatsapp','whatsappinteraction:addtags','tracked','whatsappinteraction:update','destroy','delete','removeTags','exports'];(function(_0x10b17b,_0x3df836){var _0x397582=function(_0x1a9ea4){while(--_0x1a9ea4){_0x10b17b['push'](_0x10b17b['shift']());}};_0x397582(++_0x3df836);}(_0xf9d5,0x122));var _0x5f9d=function(_0x3b677a,_0x274ecc){_0x3b677a=_0x3b677a-0x0;var _0x2e2eb6=_0xf9d5[_0x3b677a];return _0x2e2eb6;};'use strict';var multer=require('multer');var util=require(_0x5f9d('0x0'));var path=require(_0x5f9d('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f9d('0x2'));var router=express[_0x5f9d('0x3')]();var fs_extra=require(_0x5f9d('0x4'));var auth=require(_0x5f9d('0x5'));var interaction=require(_0x5f9d('0x6'));var config=require(_0x5f9d('0x7'));var controller=require(_0x5f9d('0x8'));router['get']('/',auth[_0x5f9d('0x9')](),controller['index']);router[_0x5f9d('0xa')](_0x5f9d('0xb'),auth['isAuthenticated'](),controller[_0x5f9d('0xc')]);router[_0x5f9d('0xa')](_0x5f9d('0xd'),auth[_0x5f9d('0x9')](),controller[_0x5f9d('0xe')]);router[_0x5f9d('0xa')]('/:id/messages',auth[_0x5f9d('0x9')](),controller[_0x5f9d('0xf')]);router['get']('/:id/download',auth[_0x5f9d('0x9')](),controller[_0x5f9d('0x10')]);router[_0x5f9d('0x11')]('/',auth['isAuthenticated'](),controller[_0x5f9d('0x12')]);router[_0x5f9d('0x11')](_0x5f9d('0x13'),auth[_0x5f9d('0x9')](),controller['addMessage']);router[_0x5f9d('0x11')](_0x5f9d('0x14'),auth[_0x5f9d('0x9')](),interaction['tracked'](_0x5f9d('0x15'),_0x5f9d('0x16')),controller['addTags']);router['put'](_0x5f9d('0xd'),auth[_0x5f9d('0x9')](),interaction[_0x5f9d('0x17')](_0x5f9d('0x15'),_0x5f9d('0x18')),controller['update']);router['delete']('/:id',auth[_0x5f9d('0x9')](),interaction['tracked'](_0x5f9d('0x15'),'whatsappinteraction:destroy'),controller[_0x5f9d('0x19')]);router[_0x5f9d('0x1a')](_0x5f9d('0x14'),auth['isAuthenticated'](),controller[_0x5f9d('0x1b')]);module[_0x5f9d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 412b45b..5f8c008 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 _0x4dfc=['STRING','ENUM','INTEGER','BOOLEAN','DATE'];(function(_0x5bb2d1,_0x12b5ee){var _0xb9a8db=function(_0x34ad19){while(--_0x34ad19){_0x5bb2d1['push'](_0x5bb2d1['shift']());}};_0xb9a8db(++_0x12b5ee);}(_0x4dfc,0xda));var _0xc4df=function(_0x4a563b,_0x36f42d){_0x4a563b=_0x4a563b-0x0;var _0x2935ef=_0x4dfc[_0x4a563b];return _0x2935ef;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xc4df('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc4df('0x1')]},'disposition':{'type':Sequelize[_0xc4df('0x2')]},'secondDisposition':{'type':Sequelize[_0xc4df('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc4df('0x2')]},'note':{'type':Sequelize[_0xc4df('0x2')]},'phone':{'type':Sequelize[_0xc4df('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc4df('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xc4df('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc4df('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc4df('0x4')]}}; \ No newline at end of file +var _0xb79a=['BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb79a,0x18e));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xab79('0x0'));var moment=require(_0xab79('0x1'));module['exports']={'closed':{'type':Sequelize[_0xab79('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab79('0x3')]},'disposition':{'type':Sequelize[_0xab79('0x4')]},'secondDisposition':{'type':Sequelize[_0xab79('0x4')]},'thirdDisposition':{'type':Sequelize[_0xab79('0x4')]},'note':{'type':Sequelize[_0xab79('0x4')]},'phone':{'type':Sequelize[_0xab79('0x4')]},'read1stAt':{'type':Sequelize[_0xab79('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xab79('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xab79('0x6')]('in',_0xab79('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xab79('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xab79('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 557dadc..99cfc7a 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 _0xd248=['WhatsappAccount','Account','User','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','existsSync','createReadStream','createWriteStream','basename','out','System','lastName','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','json','offset','undefined','set','Content-Range','update','then','end','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','limit','sort','where','WhatsappInteractionId','filter','map','$gte','split','format','count','rows','addTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','fullname','Contact','firstName','Attachment','Messages','createdAt','direction'];(function(_0x3dd038,_0x1325ba){var _0x1bb320=function(_0x1f7333){while(--_0x1f7333){_0x3dd038['push'](_0x3dd038['shift']());}};_0x1bb320(++_0x1325ba);}(_0xd248,0x11c));var _0x8d24=function(_0x55892c,_0xce573c){_0x55892c=_0x55892c-0x0;var _0x532bad=_0xd248[_0x55892c];return _0x532bad;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x8d24('0x0'));var moment=require(_0x8d24('0x1'));var BPromise=require('bluebird');var util=require(_0x8d24('0x2'));var path=require(_0x8d24('0x3'));var ejs=require(_0x8d24('0x4'));var fs=require('fs');var _=require(_0x8d24('0x5'));var Redis=require(_0x8d24('0x6'));var interaction=require(_0x8d24('0x7'));var qs=require(_0x8d24('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x8d24('0x9'))('api');var config=require('../../config/environment');var db=require(_0x8d24('0xa'))['db'];config['redis']=_[_0x8d24('0xb')](config[_0x8d24('0xc')],{'host':_0x8d24('0xd'),'port':0x18eb});var socket=require(_0x8d24('0xe'))(new Redis(config[_0x8d24('0xc')]));require(_0x8d24('0xf'))['register'](socket);function respondWithStatusCode(_0x58ce46,_0x166e53){_0x166e53=_0x166e53||0xcc;return function(_0x3c08ec){if(_0x3c08ec){return _0x58ce46[_0x8d24('0x10')](_0x166e53);}return _0x58ce46[_0x8d24('0x11')](_0x166e53)['end']();};}function respondWithResult(_0x30ef94,_0x5b3b87){_0x5b3b87=_0x5b3b87||0xc8;return function(_0x299e3d){if(_0x299e3d){return _0x30ef94[_0x8d24('0x11')](_0x5b3b87)[_0x8d24('0x12')](_0x299e3d);}};}function respondWithFilteredResult(_0x1b41e5,_0x2ef509){return function(_0x28e51b){if(_0x28e51b){var _0x38e0e9=typeof _0x2ef509[_0x8d24('0x13')]==='undefined'&&typeof _0x2ef509['limit']===_0x8d24('0x14');var _0x27a10d=_0x28e51b['count'];var _0x22ca81=_0x38e0e9?0x0:_0x2ef509[_0x8d24('0x13')];var _0x538a03=_0x38e0e9?_0x28e51b['count']:_0x2ef509[_0x8d24('0x13')]+_0x2ef509['limit'];var _0x1a6397;if(_0x538a03>=_0x27a10d){_0x538a03=_0x27a10d;_0x1a6397=0xc8;}else{_0x1a6397=0xce;}_0x1b41e5[_0x8d24('0x11')](_0x1a6397);return _0x1b41e5[_0x8d24('0x15')](_0x8d24('0x16'),_0x22ca81+'-'+_0x538a03+'/'+_0x27a10d)[_0x8d24('0x12')](_0x28e51b);}return null;};}function saveUpdates(_0xda6e53){return function(_0x396db2){if(_0x396db2){return _0x396db2[_0x8d24('0x17')](_0xda6e53)[_0x8d24('0x18')](function(_0x8f5147){return _0x8f5147;});}return null;};}function removeEntity(_0x28fe0e){return function(_0x108ed1){if(_0x108ed1){return _0x108ed1['destroy']()[_0x8d24('0x18')](function(){_0x28fe0e[_0x8d24('0x11')](0xcc)[_0x8d24('0x19')]();});}};}function handleEntityNotFound(_0x12e088){return function(_0x209eaa){if(!_0x209eaa){_0x12e088[_0x8d24('0x10')](0x194);}return _0x209eaa;};}function handleError(_0x46762c,_0x30dca9){_0x30dca9=_0x30dca9||0x1f4;return function(_0x256811){logger['error'](_0x256811[_0x8d24('0x1a')]);if(_0x256811[_0x8d24('0x1b')]){delete _0x256811['name'];}_0x46762c[_0x8d24('0x11')](_0x30dca9)[_0x8d24('0x1c')](_0x256811);};}exports[_0x8d24('0x1d')]=function(_0x53d040,_0x4b1057){var _0x306ff3={};var _0x59ea9d=_['map'](db[_0x8d24('0x1e')][_0x8d24('0x1f')],function(_0x293f09){return{'name':_0x293f09[_0x8d24('0x20')],'type':_0x293f09[_0x8d24('0x21')]['key']};});_0x306ff3=qs[_0x8d24('0x22')](_0x59ea9d,_0x53d040);return interaction[_0x8d24('0x23')](_0x8d24('0x24'),_0x53d040[_0x8d24('0x25')],_0x53d040[_0x8d24('0x26')],_0x306ff3,_0x59ea9d)[_0x8d24('0x18')](respondWithFilteredResult(_0x4b1057,_0x306ff3))[_0x8d24('0x27')](handleError(_0x4b1057,null));};exports[_0x8d24('0x28')]=function(_0x560b62,_0x497afa){var _0x10ad9f={'raw':![],'where':{'id':_0x560b62[_0x8d24('0x29')]['id']}},_0xcb02fd={};_0xcb02fd[_0x8d24('0x2a')]=_[_0x8d24('0x2b')](db[_0x8d24('0x1e')][_0x8d24('0x1f')]);_0xcb02fd['query']=_[_0x8d24('0x2b')](_0x560b62[_0x8d24('0x25')]);_0xcb02fd[_0x8d24('0x2c')]=_[_0x8d24('0x2d')](_0xcb02fd[_0x8d24('0x2a')],_0xcb02fd[_0x8d24('0x25')]);_0x10ad9f[_0x8d24('0x2e')]=_[_0x8d24('0x2d')](_0xcb02fd[_0x8d24('0x2a')],qs[_0x8d24('0x2f')](_0x560b62[_0x8d24('0x25')][_0x8d24('0x2f')]));_0x10ad9f['attributes']=_0x10ad9f['attributes'][_0x8d24('0x30')]?_0x10ad9f[_0x8d24('0x2e')]:_0xcb02fd[_0x8d24('0x2a')];if(_0x560b62['query'][_0x8d24('0x31')]){_0x10ad9f[_0x8d24('0x32')]=[{'all':!![]}];}_0x10ad9f=_[_0x8d24('0x33')]({},_0x10ad9f,_0x560b62[_0x8d24('0x34')]);return db['WhatsappInteraction']['find'](_0x10ad9f)[_0x8d24('0x18')](handleEntityNotFound(_0x497afa,null))[_0x8d24('0x18')](respondWithResult(_0x497afa,null))[_0x8d24('0x27')](handleError(_0x497afa,null));};exports[_0x8d24('0x35')]=function(_0x4d68b9,_0x177d5f){return db[_0x8d24('0x1e')]['create'](_0x4d68b9[_0x8d24('0x36')],{})[_0x8d24('0x18')](respondWithResult(_0x177d5f,0xc9))[_0x8d24('0x27')](handleError(_0x177d5f,null));};exports[_0x8d24('0x17')]=function(_0x1c0a3b,_0x3c97e1){if(_0x1c0a3b['body']['id']){delete _0x1c0a3b[_0x8d24('0x36')]['id'];}return db[_0x8d24('0x1e')][_0x8d24('0x37')]({'where':{'id':_0x1c0a3b[_0x8d24('0x29')]['id']}})[_0x8d24('0x18')](handleEntityNotFound(_0x3c97e1,null))[_0x8d24('0x18')](saveUpdates(_0x1c0a3b[_0x8d24('0x36')],null))[_0x8d24('0x18')](respondWithResult(_0x3c97e1,null))[_0x8d24('0x27')](handleError(_0x3c97e1,null));};exports[_0x8d24('0x38')]=function(_0xe8fcbf,_0x4756e5){return db[_0x8d24('0x1e')][_0x8d24('0x37')]({'where':{'id':_0xe8fcbf['params']['id']}})['then'](handleEntityNotFound(_0x4756e5,null))[_0x8d24('0x18')](removeEntity(_0x4756e5,null))['catch'](handleError(_0x4756e5,null));};exports[_0x8d24('0x39')]=function(_0x220748,_0x10bc6d){return db['WhatsappInteraction']['describe']()[_0x8d24('0x18')](respondWithResult(_0x10bc6d,null))['catch'](handleError(_0x10bc6d,null));};exports[_0x8d24('0x3a')]=function(_0xa102f6,_0x7f5893){return db[_0x8d24('0x3b')][_0x8d24('0x37')]({'where':{'id':_0xa102f6[_0x8d24('0x29')]['id']}})[_0x8d24('0x18')](handleEntityNotFound(_0x7f5893,null))['then'](function(_0x28df41){if(_0x28df41){return _0x28df41[_0x8d24('0x3a')](_0xa102f6[_0x8d24('0x36')][_0x8d24('0x3c')],_[_0x8d24('0x3d')](_0xa102f6[_0x8d24('0x36')],['ids','id'])||{});}})['then'](respondWithResult(_0x7f5893,null))[_0x8d24('0x27')](handleError(_0x7f5893,null));};exports[_0x8d24('0x3e')]=function(_0x122735,_0x20db7d){var _0x267f14={'raw':![],'where':{}};var _0x40ce4d={};var _0x2a98fa={'count':0x0,'rows':[]};return db[_0x8d24('0x1e')][_0x8d24('0x3f')]({'where':{'id':_0x122735[_0x8d24('0x29')]['id']}})[_0x8d24('0x18')](handleEntityNotFound(_0x20db7d,null))[_0x8d24('0x18')](function(_0x1141a8){if(_0x1141a8){_0x40ce4d['model']=_[_0x8d24('0x2b')](db[_0x8d24('0x3b')]['rawAttributes']);_0x40ce4d['query']=_[_0x8d24('0x2b')](_0x122735[_0x8d24('0x25')]);_0x40ce4d[_0x8d24('0x2c')]=_[_0x8d24('0x2d')](_0x40ce4d['model'],_0x40ce4d[_0x8d24('0x25')]);_0x267f14[_0x8d24('0x2e')]=_[_0x8d24('0x2d')](_0x40ce4d[_0x8d24('0x2a')],qs[_0x8d24('0x2f')](_0x122735[_0x8d24('0x25')][_0x8d24('0x2f')]));_0x267f14['attributes']=_0x267f14[_0x8d24('0x2e')][_0x8d24('0x30')]?_0x267f14[_0x8d24('0x2e')]:_0x40ce4d['model'];if(!_0x122735[_0x8d24('0x25')]['hasOwnProperty'](_0x8d24('0x40'))){_0x267f14[_0x8d24('0x41')]=qs[_0x8d24('0x41')](_0x122735['query'][_0x8d24('0x41')]);_0x267f14['offset']=qs['offset'](_0x122735['query'][_0x8d24('0x13')]);}_0x267f14['order']=qs[_0x8d24('0x42')](_0x122735[_0x8d24('0x25')][_0x8d24('0x42')]);_0x267f14[_0x8d24('0x43')]=qs['filters'](_['pick'](_0x122735['query'],_0x40ce4d['filters']));_0x267f14[_0x8d24('0x43')][_0x8d24('0x44')]=_0x1141a8['id'];if(_0x122735[_0x8d24('0x25')][_0x8d24('0x45')]){_0x267f14[_0x8d24('0x43')]=_[_0x8d24('0x33')](_0x267f14['where'],{'$or':_[_0x8d24('0x46')](_0x267f14[_0x8d24('0x2e')],function(_0x44fa87){var _0x332454={};_0x332454[_0x44fa87]={'$like':'%'+_0x122735[_0x8d24('0x25')]['filter']+'%'};return _0x332454;})});}if(_0x122735['query']['$gte']){var _0x2a78f3=_0x122735['query'][_0x8d24('0x47')][_0x8d24('0x48')](',');var _0x20c6e3={};_0x20c6e3[_0x2a78f3[0x0]]={'$gte':moment(_0x2a78f3[0x1])[_0x8d24('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x267f14[_0x8d24('0x43')]=_[_0x8d24('0x33')](_0x267f14[_0x8d24('0x43')],_0x20c6e3);}_0x267f14=_[_0x8d24('0x33')]({},_0x267f14,_0x122735['options']);return db['WhatsappMessage'][_0x8d24('0x4a')]({'where':_0x267f14[_0x8d24('0x43')]})[_0x8d24('0x18')](function(_0x5381eb){_0x2a98fa[_0x8d24('0x4a')]=_0x5381eb;if(_0x122735['query'][_0x8d24('0x31')]){_0x267f14['include']=[{'all':!![]}];}return db[_0x8d24('0x3b')][_0x8d24('0x23')](_0x267f14);})['then'](function(_0x5a1014){_0x2a98fa[_0x8d24('0x4b')]=_0x5a1014;return _0x2a98fa;});}})[_0x8d24('0x18')](respondWithFilteredResult(_0x20db7d,_0x267f14))['catch'](handleError(_0x20db7d,null));};exports[_0x8d24('0x4c')]=function(_0x2ec303,_0x634177){return db[_0x8d24('0x1e')][_0x8d24('0x37')]({'where':{'id':_0x2ec303[_0x8d24('0x29')]['id']}})['then'](handleEntityNotFound(_0x634177,null))[_0x8d24('0x18')](function(_0x43422b){if(_0x43422b){return _0x43422b['setTags'](_0x2ec303[_0x8d24('0x36')][_0x8d24('0x3c')],_[_0x8d24('0x3d')](_0x2ec303[_0x8d24('0x36')],[_0x8d24('0x3c'),'id'])||{})[_0x8d24('0x4d')](function(){return db['Tag'][_0x8d24('0x23')]({'attributes':['id',_0x8d24('0x1b'),_0x8d24('0x4e')],'where':{'id':_0x2ec303[_0x8d24('0x36')][_0x8d24('0x3c')]}});})[_0x8d24('0x18')](function(_0x33c2f1){socket[_0x8d24('0x4f')](_0x8d24('0x50'),{'id':Number(_0x2ec303[_0x8d24('0x29')]['id']),'tags':_0x33c2f1||[]});return{'id':Number(_0x2ec303[_0x8d24('0x29')]['id']),'tags':_0x33c2f1||[]};});}})[_0x8d24('0x18')](respondWithResult(_0x634177,null))[_0x8d24('0x27')](handleError(_0x634177,null));};exports['removeTags']=function(_0x57ef27,_0x31b340){return db[_0x8d24('0x1e')][_0x8d24('0x37')]({'where':{'id':_0x57ef27['params']['id']}})[_0x8d24('0x18')](handleEntityNotFound(_0x31b340,null))[_0x8d24('0x18')](function(_0x33a6ee){if(_0x33a6ee){return _0x33a6ee[_0x8d24('0x51')](_0x57ef27[_0x8d24('0x25')][_0x8d24('0x3c')]);}})[_0x8d24('0x18')](respondWithStatusCode(_0x31b340,null))[_0x8d24('0x27')](handleError(_0x31b340,null));};exports[_0x8d24('0x52')]=function(_0x47c162,_0x4fb500){var _0x5c0a7c=moment()[_0x8d24('0x53')]()[_0x8d24('0x54')]();var _0x979dba=path[_0x8d24('0x55')](config[_0x8d24('0x56')],_0x8d24('0x57'),'files',_0x8d24('0x58'));var _0x4c9315=path['join'](config[_0x8d24('0x56')],_0x8d24('0x57'),_0x8d24('0x59'),_0x8d24('0x5a'));var _0x1fa8ec=path[_0x8d24('0x55')](_0x979dba,_0x5c0a7c);var _0x211eb0=util[_0x8d24('0x49')](_0x8d24('0x5b'),_0x47c162[_0x8d24('0x29')]['id'],_0x5c0a7c);var _0x232127=path['join'](_0x979dba,_0x211eb0);var _0x173c82=[];_0x173c82[_0x8d24('0x5c')]({'model':db['User'],'as':'User','attributes':['id',_0x8d24('0x5d')],'raw':!![]});_0x173c82[_0x8d24('0x5c')]({'model':db['CmContact'],'as':_0x8d24('0x5e'),'attributes':['id',_0x8d24('0x5f'),'lastName'],'raw':!![]});if(_0x47c162[_0x8d24('0x25')][_0x8d24('0x5a')]){_0x173c82['push']({'model':db[_0x8d24('0x60')],'as':_0x8d24('0x60'),'raw':!![]});}var _0x45a483=[{'model':db['WhatsappMessage'],'as':_0x8d24('0x61'),'attributes':['id',_0x8d24('0x36'),_0x8d24('0x62'),_0x8d24('0x63'),'secret','read'],'include':_0x173c82}];_0x45a483[_0x8d24('0x5c')]({'model':db[_0x8d24('0x64')],'as':_0x8d24('0x65'),'attributes':['id','name']});_0x45a483[_0x8d24('0x5c')]({'model':db[_0x8d24('0x66')],'as':_0x8d24('0x67'),'attributes':['id',_0x8d24('0x5d')]});return db[_0x8d24('0x1e')][_0x8d24('0x37')]({'where':{'id':_0x47c162['params']['id']},'include':_0x45a483})[_0x8d24('0x18')](handleEntityNotFound(_0x4fb500,null))[_0x8d24('0x18')](function(_0x4b2d80){if(_0x4b2d80){var _0x12e220=_0x4b2d80[_0x8d24('0x68')]({'plain':!![]});fs[_0x8d24('0x69')](_0x1fa8ec);var _0x2610b8={'channel':_0x8d24('0x6a'),'account':_0x12e220[_0x8d24('0x65')][_0x8d24('0x1b')],'agent':_0x12e220['Owner']?_0x12e220[_0x8d24('0x67')][_0x8d24('0x5d')]:_0x8d24('0x6b'),'createdAt':moment(_0x12e220[_0x8d24('0x62')])[_0x8d24('0x49')](_0x8d24('0x6c'))[_0x8d24('0x54')](),'closedAt':_0x12e220[_0x8d24('0x6d')]?moment(_0x12e220[_0x8d24('0x6e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8d24('0x54')]():'','disposition':_0x12e220[_0x8d24('0x6f')],'messages':_(_0x12e220[_0x8d24('0x61')])['filter']({'secret':![]})[_0x8d24('0x46')](function(_0x10a3bd){if(_0x10a3bd['Attachment']){var _0x4d5417=path[_0x8d24('0x55')](_0x4c9315,_0x10a3bd['Attachment']['basename']);if(fs[_0x8d24('0x70')](_0x4d5417)){fs[_0x8d24('0x71')](_0x4d5417)['pipe'](fs[_0x8d24('0x72')](path['join'](_0x1fa8ec,_0x10a3bd['Attachment'][_0x8d24('0x73')])));}}return{'date':moment(_0x10a3bd[_0x8d24('0x62')])[_0x8d24('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8d24('0x54')](),'sender':_0x10a3bd[_0x8d24('0x63')]===_0x8d24('0x74')?_0x10a3bd[_0x8d24('0x66')]?_0x10a3bd[_0x8d24('0x66')][_0x8d24('0x5d')]:_0x8d24('0x75'):_0x10a3bd[_0x8d24('0x5e')][_0x8d24('0x5f')]+(_0x10a3bd['Contact'][_0x8d24('0x76')]?'\x20'+_0x10a3bd[_0x8d24('0x5e')][_0x8d24('0x76')]:''),'body':_0x10a3bd[_0x8d24('0x60')]?_0x10a3bd[_0x8d24('0x60')][_0x8d24('0x73')]:_0x10a3bd[_0x8d24('0x36')],'direction':_0x10a3bd[_0x8d24('0x63')]===_0x8d24('0x74')?'A':'C','secret':_0x10a3bd[_0x8d24('0x77')],'read':_0x10a3bd['read'],'attachment':_0x10a3bd[_0x8d24('0x60')]};})[_0x8d24('0x78')]()};return ejs[_0x8d24('0x79')](path['join'](config[_0x8d24('0x56')],'server',_0x8d24('0x7a'),_0x8d24('0x7b')),{'interaction':_0x2610b8})[_0x8d24('0x18')](function(_0x986d16){var _0x2016fd=path[_0x8d24('0x55')](_0x1fa8ec,_0x8d24('0x7c')+_0x12e220['id']+'-'+_0x5c0a7c+_0x8d24('0x7d'));var _0x2ad8c8={'path':_0x2016fd,'channel':_0x8d24('0x6a'),'interactionId':_0x12e220['id']};return pdf[_0x8d24('0x7e')](_0x986d16,_0x2ad8c8);})[_0x8d24('0x18')](function(){return new BPromise(function(_0x55ebb0,_0x28c328){zipdir(_0x1fa8ec,{'saveTo':_0x232127},function(_0x525606,_0x357ea2){if(_0x525606)return _0x28c328(_0x525606);return _0x55ebb0(_0x357ea2);});})[_0x8d24('0x18')](function(){return new BPromise(function(_0xbd40df,_0x1e561e){rimraf(_0x1fa8ec,function(_0x5d7b45){if(_0x5d7b45)_0x1e561e(_0x5d7b45);return _0xbd40df();});});})[_0x8d24('0x18')](function(){return _0x4fb500[_0x8d24('0x52')](_0x232127,_0x211eb0,function(_0x5d1492){if(_0x5d1492){console['log']('err',_0x5d1492);}else{fs[_0x8d24('0x7f')](_0x232127);}});});});}else{return _0x4fb500[_0x8d24('0x10')](0xc8);}})[_0x8d24('0x27')](handleError(_0x4fb500,null));}; \ No newline at end of file +var _0x72ec=['length','includeAll','include','merge','options','find','create','body','update','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','filters','nolimit','sort','where','pick','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','count','addTags','setTags','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','push','firstName','Attachment','Messages','createdAt','direction','read','Account','Owner','fullname','mkdirSync','Whatsapp','N.A.','disposition','basename','createReadStream','pipe','createWriteStream','out','Contact','lastName','secret','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','json','undefined','limit','offset','Content-Range','then','destroy','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','attributes','intersection','fields'];(function(_0x224b9b,_0x39ae3b){var _0x27efe0=function(_0xf1a128){while(--_0xf1a128){_0x224b9b['push'](_0x224b9b['shift']());}};_0x27efe0(++_0x39ae3b);}(_0x72ec,0xc3));var _0xc72e=function(_0x29d5ce,_0x1503e9){_0x29d5ce=_0x29d5ce-0x0;var _0x266f7b=_0x72ec[_0x29d5ce];return _0x266f7b;};'use strict';var rimraf=require(_0xc72e('0x0'));var zipdir=require(_0xc72e('0x1'));var moment=require(_0xc72e('0x2'));var BPromise=require(_0xc72e('0x3'));var util=require(_0xc72e('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc72e('0x5'));var Redis=require(_0xc72e('0x6'));var interaction=require(_0xc72e('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xc72e('0x8'))(_0xc72e('0x9'));var config=require(_0xc72e('0xa'));var db=require(_0xc72e('0xb'))['db'];config[_0xc72e('0xc')]=_[_0xc72e('0xd')](config[_0xc72e('0xc')],{'host':_0xc72e('0xe'),'port':0x18eb});var socket=require(_0xc72e('0xf'))(new Redis(config[_0xc72e('0xc')]));require(_0xc72e('0x10'))[_0xc72e('0x11')](socket);function respondWithStatusCode(_0x40af3a,_0x13dbaf){_0x13dbaf=_0x13dbaf||0xcc;return function(_0x56444e){if(_0x56444e){return _0x40af3a[_0xc72e('0x12')](_0x13dbaf);}return _0x40af3a['status'](_0x13dbaf)[_0xc72e('0x13')]();};}function respondWithResult(_0x54fa37,_0x286aa7){_0x286aa7=_0x286aa7||0xc8;return function(_0x47cd5c){if(_0x47cd5c){return _0x54fa37[_0xc72e('0x14')](_0x286aa7)[_0xc72e('0x15')](_0x47cd5c);}};}function respondWithFilteredResult(_0x2fb526,_0x3786c8){return function(_0x219695){if(_0x219695){var _0x2327a4=typeof _0x3786c8['offset']===_0xc72e('0x16')&&typeof _0x3786c8[_0xc72e('0x17')]==='undefined';var _0x5e2951=_0x219695['count'];var _0x97062d=_0x2327a4?0x0:_0x3786c8[_0xc72e('0x18')];var _0x5294ca=_0x2327a4?_0x219695['count']:_0x3786c8[_0xc72e('0x18')]+_0x3786c8['limit'];var _0x1f9966;if(_0x5294ca>=_0x5e2951){_0x5294ca=_0x5e2951;_0x1f9966=0xc8;}else{_0x1f9966=0xce;}_0x2fb526[_0xc72e('0x14')](_0x1f9966);return _0x2fb526['set'](_0xc72e('0x19'),_0x97062d+'-'+_0x5294ca+'/'+_0x5e2951)[_0xc72e('0x15')](_0x219695);}return null;};}function saveUpdates(_0x27df1f){return function(_0x277bd9){if(_0x277bd9){return _0x277bd9['update'](_0x27df1f)[_0xc72e('0x1a')](function(_0x4e64cc){return _0x4e64cc;});}return null;};}function removeEntity(_0x306d04){return function(_0x5ec293){if(_0x5ec293){return _0x5ec293[_0xc72e('0x1b')]()['then'](function(){_0x306d04[_0xc72e('0x14')](0xcc)[_0xc72e('0x13')]();});}};}function handleEntityNotFound(_0xa8c4c7){return function(_0x5a4e77){if(!_0x5a4e77){_0xa8c4c7[_0xc72e('0x12')](0x194);}return _0x5a4e77;};}function handleError(_0x3b86b0,_0x1a900c){_0x1a900c=_0x1a900c||0x1f4;return function(_0x14463f){logger['error'](_0x14463f[_0xc72e('0x1c')]);if(_0x14463f[_0xc72e('0x1d')]){delete _0x14463f[_0xc72e('0x1d')];}_0x3b86b0['status'](_0x1a900c)[_0xc72e('0x1e')](_0x14463f);};}exports[_0xc72e('0x1f')]=function(_0x71554e,_0x585aaf){var _0x433cfe={};var _0x44c04e=_[_0xc72e('0x20')](db[_0xc72e('0x21')][_0xc72e('0x22')],function(_0x575e35){return{'name':_0x575e35[_0xc72e('0x23')],'type':_0x575e35['type'][_0xc72e('0x24')]};});_0x433cfe=qs[_0xc72e('0x25')](_0x44c04e,_0x71554e);return interaction[_0xc72e('0x26')](_0xc72e('0x27'),_0x71554e[_0xc72e('0x28')],_0x71554e['user'],_0x433cfe,_0x44c04e)['then'](respondWithFilteredResult(_0x585aaf,_0x433cfe))[_0xc72e('0x29')](handleError(_0x585aaf,null));};exports[_0xc72e('0x2a')]=function(_0xbaba51,_0x4dc45d){var _0x56c97a={'raw':![],'where':{'id':_0xbaba51[_0xc72e('0x2b')]['id']}},_0x4ae320={};_0x4ae320[_0xc72e('0x2c')]=_[_0xc72e('0x2d')](db[_0xc72e('0x21')][_0xc72e('0x22')]);_0x4ae320[_0xc72e('0x28')]=_[_0xc72e('0x2d')](_0xbaba51[_0xc72e('0x28')]);_0x4ae320['filters']=_['intersection'](_0x4ae320['model'],_0x4ae320[_0xc72e('0x28')]);_0x56c97a[_0xc72e('0x2e')]=_[_0xc72e('0x2f')](_0x4ae320['model'],qs[_0xc72e('0x30')](_0xbaba51[_0xc72e('0x28')][_0xc72e('0x30')]));_0x56c97a[_0xc72e('0x2e')]=_0x56c97a[_0xc72e('0x2e')][_0xc72e('0x31')]?_0x56c97a['attributes']:_0x4ae320[_0xc72e('0x2c')];if(_0xbaba51[_0xc72e('0x28')][_0xc72e('0x32')]){_0x56c97a[_0xc72e('0x33')]=[{'all':!![]}];}_0x56c97a=_[_0xc72e('0x34')]({},_0x56c97a,_0xbaba51[_0xc72e('0x35')]);return db[_0xc72e('0x21')][_0xc72e('0x36')](_0x56c97a)[_0xc72e('0x1a')](handleEntityNotFound(_0x4dc45d,null))['then'](respondWithResult(_0x4dc45d,null))['catch'](handleError(_0x4dc45d,null));};exports['create']=function(_0x19d638,_0x16f864){return db[_0xc72e('0x21')][_0xc72e('0x37')](_0x19d638[_0xc72e('0x38')],{})[_0xc72e('0x1a')](respondWithResult(_0x16f864,0xc9))['catch'](handleError(_0x16f864,null));};exports[_0xc72e('0x39')]=function(_0x12353a,_0x1e0f89){if(_0x12353a[_0xc72e('0x38')]['id']){delete _0x12353a[_0xc72e('0x38')]['id'];}return db[_0xc72e('0x21')]['find']({'where':{'id':_0x12353a[_0xc72e('0x2b')]['id']}})[_0xc72e('0x1a')](handleEntityNotFound(_0x1e0f89,null))[_0xc72e('0x1a')](saveUpdates(_0x12353a[_0xc72e('0x38')],null))[_0xc72e('0x1a')](respondWithResult(_0x1e0f89,null))[_0xc72e('0x29')](handleError(_0x1e0f89,null));};exports[_0xc72e('0x1b')]=function(_0x5be347,_0x1d4e31){return db['WhatsappInteraction'][_0xc72e('0x36')]({'where':{'id':_0x5be347[_0xc72e('0x2b')]['id']}})[_0xc72e('0x1a')](handleEntityNotFound(_0x1d4e31,null))[_0xc72e('0x1a')](removeEntity(_0x1d4e31,null))[_0xc72e('0x29')](handleError(_0x1d4e31,null));};exports[_0xc72e('0x3a')]=function(_0x217a7a,_0xdeb38c){return db[_0xc72e('0x21')][_0xc72e('0x3a')]()[_0xc72e('0x1a')](respondWithResult(_0xdeb38c,null))['catch'](handleError(_0xdeb38c,null));};exports['addMessage']=function(_0xdd0e72,_0x559957){return db[_0xc72e('0x3b')][_0xc72e('0x36')]({'where':{'id':_0xdd0e72[_0xc72e('0x2b')]['id']}})[_0xc72e('0x1a')](handleEntityNotFound(_0x559957,null))[_0xc72e('0x1a')](function(_0x55f275){if(_0x55f275){return _0x55f275[_0xc72e('0x3c')](_0xdd0e72[_0xc72e('0x38')][_0xc72e('0x3d')],_[_0xc72e('0x3e')](_0xdd0e72[_0xc72e('0x38')],[_0xc72e('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x559957,null))[_0xc72e('0x29')](handleError(_0x559957,null));};exports[_0xc72e('0x3f')]=function(_0x51e2cb,_0x32c43c){var _0x10ad70={'raw':![],'where':{}};var _0x5904df={};var _0x2b781f={'count':0x0,'rows':[]};return db[_0xc72e('0x21')][_0xc72e('0x40')]({'where':{'id':_0x51e2cb[_0xc72e('0x2b')]['id']}})[_0xc72e('0x1a')](handleEntityNotFound(_0x32c43c,null))['then'](function(_0x1c6fe6){if(_0x1c6fe6){_0x5904df[_0xc72e('0x2c')]=_[_0xc72e('0x2d')](db['WhatsappMessage'][_0xc72e('0x22')]);_0x5904df[_0xc72e('0x28')]=_['keys'](_0x51e2cb[_0xc72e('0x28')]);_0x5904df[_0xc72e('0x41')]=_['intersection'](_0x5904df[_0xc72e('0x2c')],_0x5904df[_0xc72e('0x28')]);_0x10ad70[_0xc72e('0x2e')]=_['intersection'](_0x5904df['model'],qs['fields'](_0x51e2cb[_0xc72e('0x28')][_0xc72e('0x30')]));_0x10ad70['attributes']=_0x10ad70[_0xc72e('0x2e')][_0xc72e('0x31')]?_0x10ad70[_0xc72e('0x2e')]:_0x5904df['model'];if(!_0x51e2cb['query']['hasOwnProperty'](_0xc72e('0x42'))){_0x10ad70[_0xc72e('0x17')]=qs[_0xc72e('0x17')](_0x51e2cb[_0xc72e('0x28')][_0xc72e('0x17')]);_0x10ad70[_0xc72e('0x18')]=qs[_0xc72e('0x18')](_0x51e2cb[_0xc72e('0x28')][_0xc72e('0x18')]);}_0x10ad70['order']=qs[_0xc72e('0x43')](_0x51e2cb[_0xc72e('0x28')]['sort']);_0x10ad70[_0xc72e('0x44')]=qs[_0xc72e('0x41')](_[_0xc72e('0x45')](_0x51e2cb['query'],_0x5904df['filters']));_0x10ad70[_0xc72e('0x44')]['WhatsappInteractionId']=_0x1c6fe6['id'];if(_0x51e2cb['query']['filter']){_0x10ad70[_0xc72e('0x44')]=_[_0xc72e('0x34')](_0x10ad70[_0xc72e('0x44')],{'$or':_['map'](_0x10ad70[_0xc72e('0x2e')],function(_0x19b88a){var _0x270947={};_0x270947[_0x19b88a]={'$like':'%'+_0x51e2cb[_0xc72e('0x28')][_0xc72e('0x46')]+'%'};return _0x270947;})});}if(_0x51e2cb[_0xc72e('0x28')]['$gte']){var _0x42d029=_0x51e2cb[_0xc72e('0x28')]['$gte'][_0xc72e('0x47')](',');var _0x19f126={};_0x19f126[_0x42d029[0x0]]={'$gte':moment(_0x42d029[0x1])[_0xc72e('0x48')](_0xc72e('0x49'))};_0x10ad70['where']=_['merge'](_0x10ad70[_0xc72e('0x44')],_0x19f126);}_0x10ad70=_[_0xc72e('0x34')]({},_0x10ad70,_0x51e2cb[_0xc72e('0x35')]);return db[_0xc72e('0x3b')][_0xc72e('0x4a')]({'where':_0x10ad70[_0xc72e('0x44')]})[_0xc72e('0x1a')](function(_0x750042){_0x2b781f[_0xc72e('0x4a')]=_0x750042;if(_0x51e2cb['query']['includeAll']){_0x10ad70[_0xc72e('0x33')]=[{'all':!![]}];}return db[_0xc72e('0x3b')]['findAll'](_0x10ad70);})[_0xc72e('0x1a')](function(_0x6fa65e){_0x2b781f['rows']=_0x6fa65e;return _0x2b781f;});}})[_0xc72e('0x1a')](respondWithFilteredResult(_0x32c43c,_0x10ad70))['catch'](handleError(_0x32c43c,null));};exports[_0xc72e('0x4b')]=function(_0x337151,_0x97356c){return db[_0xc72e('0x21')][_0xc72e('0x36')]({'where':{'id':_0x337151[_0xc72e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x97356c,null))[_0xc72e('0x1a')](function(_0x37bc01){if(_0x37bc01){return _0x37bc01[_0xc72e('0x4c')](_0x337151['body'][_0xc72e('0x3d')],_['omit'](_0x337151[_0xc72e('0x38')],['ids','id'])||{})['spread'](function(){return db[_0xc72e('0x4d')][_0xc72e('0x26')]({'attributes':['id',_0xc72e('0x1d'),_0xc72e('0x4e')],'where':{'id':_0x337151[_0xc72e('0x38')][_0xc72e('0x3d')]}});})[_0xc72e('0x1a')](function(_0x29a8e2){socket['emit'](_0xc72e('0x4f'),{'id':Number(_0x337151[_0xc72e('0x2b')]['id']),'tags':_0x29a8e2||[]});return{'id':Number(_0x337151[_0xc72e('0x2b')]['id']),'tags':_0x29a8e2||[]};});}})[_0xc72e('0x1a')](respondWithResult(_0x97356c,null))[_0xc72e('0x29')](handleError(_0x97356c,null));};exports[_0xc72e('0x50')]=function(_0x364c1d,_0x5bf678){return db['WhatsappInteraction']['find']({'where':{'id':_0x364c1d[_0xc72e('0x2b')]['id']}})[_0xc72e('0x1a')](handleEntityNotFound(_0x5bf678,null))[_0xc72e('0x1a')](function(_0x5b98b8){if(_0x5b98b8){return _0x5b98b8[_0xc72e('0x50')](_0x364c1d[_0xc72e('0x28')][_0xc72e('0x3d')]);}})['then'](respondWithStatusCode(_0x5bf678,null))[_0xc72e('0x29')](handleError(_0x5bf678,null));};exports[_0xc72e('0x51')]=function(_0x2b24fd,_0x12c19e){var _0x3dcbf3=moment()[_0xc72e('0x52')]()[_0xc72e('0x53')]();var _0x27522b=path[_0xc72e('0x54')](config[_0xc72e('0x55')],'server',_0xc72e('0x56'),_0xc72e('0x57'));var _0x55f8d8=path[_0xc72e('0x54')](config[_0xc72e('0x55')],_0xc72e('0x58'),_0xc72e('0x56'),_0xc72e('0x59'));var _0xbcc88b=path[_0xc72e('0x54')](_0x27522b,_0x3dcbf3);var _0x407994=util[_0xc72e('0x48')](_0xc72e('0x5a'),_0x2b24fd['params']['id'],_0x3dcbf3);var _0x48e3a1=path[_0xc72e('0x54')](_0x27522b,_0x407994);var _0x13fd9f=[];_0x13fd9f['push']({'model':db[_0xc72e('0x5b')],'as':_0xc72e('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x13fd9f[_0xc72e('0x5c')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xc72e('0x5d'),'lastName'],'raw':!![]});if(_0x2b24fd[_0xc72e('0x28')][_0xc72e('0x59')]){_0x13fd9f['push']({'model':db[_0xc72e('0x5e')],'as':_0xc72e('0x5e'),'raw':!![]});}var _0x57a836=[{'model':db[_0xc72e('0x3b')],'as':_0xc72e('0x5f'),'attributes':['id',_0xc72e('0x38'),_0xc72e('0x60'),_0xc72e('0x61'),'secret',_0xc72e('0x62')],'include':_0x13fd9f}];_0x57a836[_0xc72e('0x5c')]({'model':db['WhatsappAccount'],'as':_0xc72e('0x63'),'attributes':['id','name']});_0x57a836[_0xc72e('0x5c')]({'model':db['User'],'as':_0xc72e('0x64'),'attributes':['id',_0xc72e('0x65')]});return db['WhatsappInteraction'][_0xc72e('0x36')]({'where':{'id':_0x2b24fd[_0xc72e('0x2b')]['id']},'include':_0x57a836})[_0xc72e('0x1a')](handleEntityNotFound(_0x12c19e,null))[_0xc72e('0x1a')](function(_0x1323f0){if(_0x1323f0){var _0x323d85=_0x1323f0['get']({'plain':!![]});fs[_0xc72e('0x66')](_0xbcc88b);var _0x27d5bb={'channel':_0xc72e('0x67'),'account':_0x323d85['Account'][_0xc72e('0x1d')],'agent':_0x323d85['Owner']?_0x323d85[_0xc72e('0x64')]['fullname']:_0xc72e('0x68'),'createdAt':moment(_0x323d85[_0xc72e('0x60')])['format'](_0xc72e('0x49'))[_0xc72e('0x53')](),'closedAt':_0x323d85['closed']?moment(_0x323d85['closedAt'])[_0xc72e('0x48')](_0xc72e('0x49'))[_0xc72e('0x53')]():'','disposition':_0x323d85[_0xc72e('0x69')],'messages':_(_0x323d85[_0xc72e('0x5f')])[_0xc72e('0x46')]({'secret':![]})[_0xc72e('0x20')](function(_0x5ea012){if(_0x5ea012[_0xc72e('0x5e')]){var _0x87118c=path[_0xc72e('0x54')](_0x55f8d8,_0x5ea012[_0xc72e('0x5e')][_0xc72e('0x6a')]);if(fs['existsSync'](_0x87118c)){fs[_0xc72e('0x6b')](_0x87118c)[_0xc72e('0x6c')](fs[_0xc72e('0x6d')](path[_0xc72e('0x54')](_0xbcc88b,_0x5ea012[_0xc72e('0x5e')][_0xc72e('0x6a')])));}}return{'date':moment(_0x5ea012[_0xc72e('0x60')])[_0xc72e('0x48')](_0xc72e('0x49'))[_0xc72e('0x53')](),'sender':_0x5ea012['direction']===_0xc72e('0x6e')?_0x5ea012[_0xc72e('0x5b')]?_0x5ea012[_0xc72e('0x5b')][_0xc72e('0x65')]:'System':_0x5ea012[_0xc72e('0x6f')][_0xc72e('0x5d')]+(_0x5ea012[_0xc72e('0x6f')][_0xc72e('0x70')]?'\x20'+_0x5ea012['Contact'][_0xc72e('0x70')]:''),'body':_0x5ea012[_0xc72e('0x5e')]?_0x5ea012[_0xc72e('0x5e')]['basename']:_0x5ea012[_0xc72e('0x38')],'direction':_0x5ea012[_0xc72e('0x61')]===_0xc72e('0x6e')?'A':'C','secret':_0x5ea012[_0xc72e('0x71')],'read':_0x5ea012[_0xc72e('0x62')],'attachment':_0x5ea012[_0xc72e('0x5e')]};})[_0xc72e('0x72')]()};return ejs[_0xc72e('0x73')](path[_0xc72e('0x54')](config[_0xc72e('0x55')],_0xc72e('0x58'),'views',_0xc72e('0x74')),{'interaction':_0x27d5bb})[_0xc72e('0x1a')](function(_0x4364da){var _0x5d630a=path[_0xc72e('0x54')](_0xbcc88b,_0xc72e('0x75')+_0x323d85['id']+'-'+_0x3dcbf3+_0xc72e('0x76'));var _0x40e978={'path':_0x5d630a,'channel':_0xc72e('0x67'),'interactionId':_0x323d85['id']};return pdf[_0xc72e('0x77')](_0x4364da,_0x40e978);})[_0xc72e('0x1a')](function(){return new BPromise(function(_0x1016b3,_0x300445){zipdir(_0xbcc88b,{'saveTo':_0x48e3a1},function(_0x511882,_0x1b7635){if(_0x511882)return _0x300445(_0x511882);return _0x1016b3(_0x1b7635);});})[_0xc72e('0x1a')](function(){return new BPromise(function(_0xca06ec,_0xd2749d){rimraf(_0xbcc88b,function(_0x12c1dd){if(_0x12c1dd)_0xd2749d(_0x12c1dd);return _0xca06ec();});});})[_0xc72e('0x1a')](function(){return _0x12c19e[_0xc72e('0x51')](_0x48e3a1,_0x407994,function(_0x1b3eea){if(_0x1b3eea){console[_0xc72e('0x78')](_0xc72e('0x79'),_0x1b3eea);}else{fs['unlinkSync'](_0x48e3a1);}});});});}else{return _0x12c19e[_0xc72e('0x12')](0xc8);}})['catch'](handleError(_0x12c19e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d642018..61ce2ec 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 _0x4522=['hook','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4522,0x1a0));var _0x2452=function(_0x1e6695,_0x1081ed){_0x1e6695=_0x1e6695-0x0;var _0x246392=_0x4522[_0x1e6695];return _0x246392;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x2452('0x0')];var WhatsappMessage=require(_0x2452('0x1'))['db'][_0x2452('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2452('0x3'),'afterUpdate':_0x2452('0x4'),'afterDestroy':_0x2452('0x5')};function emitEvent(_0x2f21dc){return function(_0x34ff44,_0x243893,_0x15fc69){_0x34ff44[_0x2452('0x6')]({'attributes':['id'],'raw':!![]})[_0x2452('0x7')](function(_0x149807){_0x34ff44[_0x2452('0x8')](_0x2452('0x9'),_0x149807[_0x2452('0xa')](function(_0x365b1f){return{'id':_0x365b1f['id']};}));return WhatsappMessage[_0x2452('0xb')]({'where':{'WhatsappInteractionId':_0x34ff44['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2452('0x7')](function(_0x5a38e0){_0x34ff44['setDataValue'](_0x2452('0xc'),_0x5a38e0['length']);WhatsappInteractionEvents['emit'](_0x2f21dc+':'+_0x34ff44['id'],_0x34ff44);WhatsappInteractionEvents[_0x2452('0xd')](_0x2f21dc,_0x34ff44);_0x15fc69(null);})[_0x2452('0xe')](_0x15fc69(null));};}for(var e in events){if(events[_0x2452('0xf')](e)){var event=events[e];WhatsappInteraction[_0x2452('0x10')](e,emitEvent(event));}}module[_0x2452('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xf2fa=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf2fa[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xaf2f('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xaf2f('0x1'))['db'][_0xaf2f('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xaf2f('0x3')](0x0);var events={'afterCreate':_0xaf2f('0x4'),'afterUpdate':_0xaf2f('0x5'),'afterDestroy':_0xaf2f('0x6')};function emitEvent(_0x96c9f7){return function(_0x4e2440,_0x48b333,_0x3709f9){_0x4e2440['getUsers']({'attributes':['id'],'raw':!![]})[_0xaf2f('0x7')](function(_0x2dfba7){_0x4e2440[_0xaf2f('0x8')](_0xaf2f('0x9'),_0x2dfba7[_0xaf2f('0xa')](function(_0x5e8ad0){return{'id':_0x5e8ad0['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x4e2440['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfd9db5){_0x4e2440[_0xaf2f('0x8')](_0xaf2f('0xb'),_0xfd9db5[_0xaf2f('0xc')]);WhatsappInteractionEvents[_0xaf2f('0xd')](_0x96c9f7+':'+_0x4e2440['id'],_0x4e2440);WhatsappInteractionEvents[_0xaf2f('0xd')](_0x96c9f7,_0x4e2440);_0x3709f9(null);})[_0xaf2f('0xe')](_0x3709f9(null));};}for(var e in events){if(events[_0xaf2f('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xaf2f('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f6be788..34c9684 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 _0xf5a1=['util','../../config/logger','api','bluebird','path','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x1b11a3,_0x259ead){var _0x2105df=function(_0x3a9559){while(--_0x3a9559){_0x1b11a3['push'](_0x1b11a3['shift']());}};_0x2105df(++_0x259ead);}(_0xf5a1,0x1bf));var _0x1f5a=function(_0x1c59a8,_0x23cc30){_0x1c59a8=_0x1c59a8-0x0;var _0x410cbb=_0xf5a1[_0x1c59a8];return _0x410cbb;};'use strict';var _=require(_0x1f5a('0x0'));var util=require(_0x1f5a('0x1'));var logger=require(_0x1f5a('0x2'))(_0x1f5a('0x3'));var moment=require('moment');var BPromise=require(_0x1f5a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f5a('0x5'));var rimraf=require('rimraf');var config=require(_0x1f5a('0x6'));var attributes=require(_0x1f5a('0x7'));module['exports']=function(_0x10cd1b,_0x1a896e){return _0x10cd1b[_0x1f5a('0x8')]('WhatsappInteraction',attributes,{'tableName':_0x1f5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4158b2,_0x262c26,_0x43c90f){if(_0x4158b2[_0x1f5a('0xa')](_0x1f5a('0xb'))){_0x4158b2['closedAt']=moment()[_0x1f5a('0xc')](_0x1f5a('0xd'));}_0x43c90f(null,_0x4158b2);}}});}; \ No newline at end of file +var _0xeb43=['define','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb43,0x7e));var _0x3eb4=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0xeb43[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0x3eb4('0x0'));var util=require(_0x3eb4('0x1'));var logger=require(_0x3eb4('0x2'))(_0x3eb4('0x3'));var moment=require('moment');var BPromise=require(_0x3eb4('0x4'));var rp=require(_0x3eb4('0x5'));var fs=require('fs');var path=require(_0x3eb4('0x6'));var rimraf=require('rimraf');var config=require(_0x3eb4('0x7'));var attributes=require(_0x3eb4('0x8'));module['exports']=function(_0x5d2944,_0x5c1db5){return _0x5d2944[_0x3eb4('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x3eb4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b979e,_0x2a828f,_0x4b65b2){if(_0x4b979e[_0x3eb4('0xb')](_0x3eb4('0xc'))){_0x4b979e['closedAt']=moment()[_0x3eb4('0xd')](_0x3eb4('0xe'));}_0x4b65b2(null,_0x4b979e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 77a95b4..5027d2b 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 _0xfa19=['request\x20sent','stringify','code','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','then','addTags','omit','ids','AddTags','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x1e0a7a,_0x443f13){var _0x1a022b=function(_0x47496d){while(--_0x47496d){_0x1e0a7a['push'](_0x1e0a7a['shift']());}};_0x1a022b(++_0x443f13);}(_0xfa19,0x174));var _0x9fa1=function(_0x48caad,_0x33a6ea){_0x48caad=_0x48caad-0x0;var _0x18071d=_0xfa19[_0x48caad];return _0x18071d;};'use strict';var _=require(_0x9fa1('0x0'));var util=require(_0x9fa1('0x1'));var moment=require(_0x9fa1('0x2'));var BPromise=require('bluebird');var rs=require(_0x9fa1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fa1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9fa1('0x5'));var config=require(_0x9fa1('0x6'));var jayson=require(_0x9fa1('0x7'));var client=jayson[_0x9fa1('0x8')][_0x9fa1('0x9')]({'port':0x232a});config[_0x9fa1('0xa')]=_['defaults'](config[_0x9fa1('0xa')],{'host':_0x9fa1('0xb'),'port':0x18eb});var socket=require(_0x9fa1('0xc'))(new Redis(config[_0x9fa1('0xa')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x267ccc,_0x5a005b,_0x5ed6dd){return new BPromise(function(_0x3f10a0,_0x37781d){return client[_0x9fa1('0xd')](_0x267ccc,_0x5ed6dd)['then'](function(_0x924e30){logger[_0x9fa1('0xe')](_0x9fa1('0xf'),_0x5a005b,'request\x20sent');logger[_0x9fa1('0x10')](_0x9fa1('0x11'),_0x5a005b,_0x9fa1('0x12'),JSON[_0x9fa1('0x13')](_0x924e30));if(_0x924e30['error']){if(_0x924e30['error'][_0x9fa1('0x14')]===0x1f4){logger[_0x9fa1('0x15')](_0x9fa1('0xf'),_0x5a005b,_0x924e30['error'][_0x9fa1('0x16')]);return _0x37781d(_0x924e30[_0x9fa1('0x15')][_0x9fa1('0x16')]);}logger[_0x9fa1('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x5a005b,_0x924e30['error']['message']);return _0x3f10a0(_0x924e30['error'][_0x9fa1('0x16')]);}else{logger[_0x9fa1('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x5a005b,'request\x20sent');_0x3f10a0(_0x924e30[_0x9fa1('0x17')][_0x9fa1('0x16')]);}})[_0x9fa1('0x18')](function(_0x40b189){logger['error'](_0x9fa1('0xf'),_0x5a005b,_0x40b189);_0x37781d(_0x40b189);});});}exports[_0x9fa1('0x19')]=function(_0x32e9fb){var _0x79902a=this;return new Promise(function(_0x155481,_0x40fb7f){return db[_0x9fa1('0x1a')][_0x9fa1('0x1b')](_0x32e9fb[_0x9fa1('0x1c')],{'raw':_0x32e9fb['options']?_0x32e9fb[_0x9fa1('0x1d')][_0x9fa1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e9fb['options']?_0x32e9fb['options'][_0x9fa1('0x1f')]||null:null,'attributes':_0x32e9fb['options']?_0x32e9fb[_0x9fa1('0x1d')][_0x9fa1('0x20')]||null:null,'limit':_0x32e9fb['options']?_0x32e9fb[_0x9fa1('0x1d')]['limit']||null:null})['then'](function(_0x509f36){logger[_0x9fa1('0xe')]('UpdateWhatsappInteraction',_0x32e9fb);logger[_0x9fa1('0x10')](_0x9fa1('0x19'),_0x32e9fb,JSON['stringify'](_0x509f36));_0x155481(_0x509f36);})[_0x9fa1('0x18')](function(_0x335442){logger[_0x9fa1('0x15')](_0x9fa1('0x19'),_0x335442[_0x9fa1('0x16')],_0x32e9fb);_0x40fb7f(_0x79902a[_0x9fa1('0x15')](0x1f4,_0x335442[_0x9fa1('0x16')]));});});};exports[_0x9fa1('0x21')]=function(_0x3087f9){return new Promise(function(_0x426e1e,_0x46fd30){return db[_0x9fa1('0x1a')]['find']({'where':_0x3087f9[_0x9fa1('0x1d')]?_0x3087f9['options'][_0x9fa1('0x1f')]||null:null})[_0x9fa1('0x22')](function(_0x61194a){if(_0x61194a){return _0x61194a[_0x9fa1('0x23')](_0x3087f9[_0x9fa1('0x1c')]['ids'],_[_0x9fa1('0x24')](_0x3087f9[_0x9fa1('0x1c')],[_0x9fa1('0x25'),'id'])||{});}})['spread'](function(_0x3b2fee){logger[_0x9fa1('0xe')](_0x9fa1('0x26'),_0x3087f9);logger[_0x9fa1('0x10')](_0x9fa1('0x26'),_0x3087f9,JSON[_0x9fa1('0x13')](_0x3b2fee));_0x426e1e(_0x3b2fee);})['catch'](function(_0x2cee70){logger[_0x9fa1('0x15')](_0x9fa1('0x26'),_0x2cee70[_0x9fa1('0x16')],_0x3087f9);_0x46fd30(_this[_0x9fa1('0x15')](0x1f4,_0x2cee70['message']));});});}; \ No newline at end of file +var _0x606d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateWhatsappInteraction','update','body','options','raw','limit','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','omit','AddTags','lodash','moment','bluebird'];(function(_0x2f34d8,_0x19466f){var _0x1303c5=function(_0x390c58){while(--_0x390c58){_0x2f34d8['push'](_0x2f34d8['shift']());}};_0x1303c5(++_0x19466f);}(_0x606d,0x72));var _0xd606=function(_0x41a7a9,_0xd7943f){_0x41a7a9=_0x41a7a9-0x0;var _0x5d2979=_0x606d[_0x41a7a9];return _0x5d2979;};'use strict';var _=require(_0xd606('0x0'));var util=require('util');var moment=require(_0xd606('0x1'));var BPromise=require(_0xd606('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd606('0x3'));var db=require(_0xd606('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd606('0x5'))(_0xd606('0x6'));var config=require(_0xd606('0x7'));var jayson=require(_0xd606('0x8'));var client=jayson[_0xd606('0x9')]['http']({'port':0x232a});config[_0xd606('0xa')]=_[_0xd606('0xb')](config[_0xd606('0xa')],{'host':_0xd606('0xc'),'port':0x18eb});var socket=require(_0xd606('0xd'))(new Redis(config['redis']));require(_0xd606('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e7161,_0x5b3403,_0x32e337){return new BPromise(function(_0x5cc2f7,_0x51a68c){return client[_0xd606('0xf')](_0x1e7161,_0x32e337)[_0xd606('0x10')](function(_0x59ff3b){logger[_0xd606('0x11')](_0xd606('0x12'),_0x5b3403,'request\x20sent');logger[_0xd606('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5b3403,_0xd606('0x14'),JSON[_0xd606('0x15')](_0x59ff3b));if(_0x59ff3b['error']){if(_0x59ff3b[_0xd606('0x16')][_0xd606('0x17')]===0x1f4){logger[_0xd606('0x16')](_0xd606('0x12'),_0x5b3403,_0x59ff3b['error']['message']);return _0x51a68c(_0x59ff3b[_0xd606('0x16')][_0xd606('0x18')]);}logger[_0xd606('0x16')](_0xd606('0x12'),_0x5b3403,_0x59ff3b[_0xd606('0x16')]['message']);return _0x5cc2f7(_0x59ff3b[_0xd606('0x16')][_0xd606('0x18')]);}else{logger[_0xd606('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x5b3403,_0xd606('0x14'));_0x5cc2f7(_0x59ff3b[_0xd606('0x19')][_0xd606('0x18')]);}})['catch'](function(_0x3f33d4){logger['error'](_0xd606('0x12'),_0x5b3403,_0x3f33d4);_0x51a68c(_0x3f33d4);});});}exports[_0xd606('0x1a')]=function(_0x26cb72){var _0x1a0d13=this;return new Promise(function(_0x74fbb,_0x4d55e3){return db['WhatsappInteraction'][_0xd606('0x1b')](_0x26cb72[_0xd606('0x1c')],{'raw':_0x26cb72['options']?_0x26cb72[_0xd606('0x1d')][_0xd606('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26cb72['options']?_0x26cb72[_0xd606('0x1d')]['where']||null:null,'attributes':_0x26cb72['options']?_0x26cb72[_0xd606('0x1d')]['attributes']||null:null,'limit':_0x26cb72[_0xd606('0x1d')]?_0x26cb72[_0xd606('0x1d')][_0xd606('0x1f')]||null:null})[_0xd606('0x10')](function(_0x3b5436){logger['info'](_0xd606('0x1a'),_0x26cb72);logger['debug']('UpdateWhatsappInteraction',_0x26cb72,JSON['stringify'](_0x3b5436));_0x74fbb(_0x3b5436);})[_0xd606('0x20')](function(_0x59d002){logger[_0xd606('0x16')](_0xd606('0x1a'),_0x59d002[_0xd606('0x18')],_0x26cb72);_0x4d55e3(_0x1a0d13[_0xd606('0x16')](0x1f4,_0x59d002[_0xd606('0x18')]));});});};exports[_0xd606('0x21')]=function(_0x430c41){return new Promise(function(_0x52273c,_0x1cd531){return db[_0xd606('0x22')][_0xd606('0x23')]({'where':_0x430c41[_0xd606('0x1d')]?_0x430c41['options'][_0xd606('0x24')]||null:null})[_0xd606('0x10')](function(_0x72e94b){if(_0x72e94b){return _0x72e94b['addTags'](_0x430c41[_0xd606('0x1c')]['ids'],_[_0xd606('0x25')](_0x430c41[_0xd606('0x1c')],['ids','id'])||{});}})['spread'](function(_0x9e984d){logger[_0xd606('0x11')](_0xd606('0x26'),_0x430c41);logger['debug'](_0xd606('0x26'),_0x430c41,JSON['stringify'](_0x9e984d));_0x52273c(_0x9e984d);})['catch'](function(_0x2c878c){logger[_0xd606('0x16')]('AddTags',_0x2c878c['message'],_0x430c41);_0x1cd531(_this['error'](0x1f4,_0x2c878c[_0xd606('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 930b3d2..c5f082c 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 _0x6872=['length','save','removeListener','register'];(function(_0x4b634f,_0x4c0372){var _0x302e3c=function(_0x1e3e3f){while(--_0x1e3e3f){_0x4b634f['push'](_0x4b634f['shift']());}};_0x302e3c(++_0x4c0372);}(_0x6872,0xd5));var _0x2687=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6872[_0x4e676e];return _0x336a3c;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x2687('0x0'),'remove','update'];function createListener(_0xcaa87c,_0x2b2ccb){return function(_0x326c8f){_0x2b2ccb['emit'](_0xcaa87c,_0x326c8f);};}function removeListener(_0x8f15fc,_0x4ef16b){return function(){WhatsappInteractionEvents[_0x2687('0x1')](_0x8f15fc,_0x4ef16b);};}exports[_0x2687('0x2')]=function(_0x294b56){for(var _0xb3bd09=0x0,_0x26c9c7=events[_0x2687('0x3')];_0xb3bd09<_0x26c9c7;_0xb3bd09++){var _0x2e4a79=events[_0xb3bd09];var _0x163e83=createListener('whatsappInteraction:'+_0x2e4a79,_0x294b56);WhatsappInteractionEvents['on'](_0x2e4a79,_0x163e83);}}; \ No newline at end of file +var _0x8eb2=['remove','removeListener','whatsappInteraction:','save'];(function(_0xb1d640,_0x71429e){var _0x4d6af9=function(_0x572bfa){while(--_0x572bfa){_0xb1d640['push'](_0xb1d640['shift']());}};_0x4d6af9(++_0x71429e);}(_0x8eb2,0x15b));var _0x28eb=function(_0x4f0f30,_0x3f184a){_0x4f0f30=_0x4f0f30-0x0;var _0x3893c1=_0x8eb2[_0x4f0f30];return _0x3893c1;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x28eb('0x0'),_0x28eb('0x1'),'update'];function createListener(_0x3555a7,_0x9f4fa6){return function(_0x3bcf78){_0x9f4fa6['emit'](_0x3555a7,_0x3bcf78);};}function removeListener(_0x1f781f,_0x516866){return function(){WhatsappInteractionEvents[_0x28eb('0x2')](_0x1f781f,_0x516866);};}exports['register']=function(_0x2d7826){for(var _0x47d816=0x0,_0xf3fb6=events['length'];_0x47d816<_0xf3fb6;_0x47d816++){var _0x127dc4=events[_0x47d816];var _0x15a0c0=createListener(_0x28eb('0x3')+_0x127dc4,_0x2d7826);WhatsappInteractionEvents['on'](_0x127dc4,_0x15a0c0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index cda92c1..b023503 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 _0xb60d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','/:id/status','status','put','update','/:id/accept','accept','delete','destroy','multer','util','path'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0xb60d,0xcd));var _0xdb60=function(_0x1415c3,_0x2b1bfe){_0x1415c3=_0x1415c3-0x0;var _0x2438cd=_0xb60d[_0x1415c3];return _0x2438cd;};'use strict';var multer=require(_0xdb60('0x0'));var util=require(_0xdb60('0x1'));var path=require(_0xdb60('0x2'));var timeout=require(_0xdb60('0x3'));var express=require(_0xdb60('0x4'));var router=express[_0xdb60('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb60('0x6'));var interaction=require(_0xdb60('0x7'));var config=require(_0xdb60('0x8'));var controller=require(_0xdb60('0x9'));router[_0xdb60('0xa')]('/',auth[_0xdb60('0xb')](),controller[_0xdb60('0xc')]);router[_0xdb60('0xa')](_0xdb60('0xd'),auth[_0xdb60('0xb')](),controller[_0xdb60('0xe')]);router[_0xdb60('0xa')](_0xdb60('0xf'),auth[_0xdb60('0xb')](),controller[_0xdb60('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller['create']);router[_0xdb60('0x11')](_0xdb60('0x12'),controller[_0xdb60('0x13')]);router[_0xdb60('0x14')](_0xdb60('0xf'),auth['isAuthenticated'](),controller[_0xdb60('0x15')]);router[_0xdb60('0x14')](_0xdb60('0x16'),auth['isAuthenticated'](),controller[_0xdb60('0x17')]);router[_0xdb60('0x14')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xdb60('0x18')](_0xdb60('0xf'),auth[_0xdb60('0xb')](),controller[_0xdb60('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb011=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','update','/:id/accept','reject','exports','util','path','connect-timeout','express'];(function(_0x335740,_0x5922dd){var _0x2b022d=function(_0x375c12){while(--_0x375c12){_0x335740['push'](_0x335740['shift']());}};_0x2b022d(++_0x5922dd);}(_0xb011,0x191));var _0x1b01=function(_0x4d5658,_0x3495b8){_0x4d5658=_0x4d5658-0x0;var _0x7c8f95=_0xb011[_0x4d5658];return _0x7c8f95;};'use strict';var multer=require('multer');var util=require(_0x1b01('0x0'));var path=require(_0x1b01('0x1'));var timeout=require(_0x1b01('0x2'));var express=require(_0x1b01('0x3'));var router=express[_0x1b01('0x4')]();var fs_extra=require(_0x1b01('0x5'));var auth=require(_0x1b01('0x6'));var interaction=require(_0x1b01('0x7'));var config=require(_0x1b01('0x8'));var controller=require(_0x1b01('0x9'));router[_0x1b01('0xa')]('/',auth[_0x1b01('0xb')](),controller[_0x1b01('0xc')]);router[_0x1b01('0xa')](_0x1b01('0xd'),auth[_0x1b01('0xb')](),controller[_0x1b01('0xe')]);router[_0x1b01('0xa')]('/:id',auth[_0x1b01('0xb')](),controller[_0x1b01('0xf')]);router['post']('/',auth[_0x1b01('0xb')](),interaction[_0x1b01('0x10')](_0x1b01('0x11'),_0x1b01('0x12')),controller[_0x1b01('0x13')]);router['post'](_0x1b01('0x14'),controller['status']);router[_0x1b01('0x15')](_0x1b01('0x16'),auth[_0x1b01('0xb')](),controller[_0x1b01('0x17')]);router[_0x1b01('0x15')](_0x1b01('0x18'),auth[_0x1b01('0xb')](),controller['accept']);router[_0x1b01('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0x1b01('0x19')]);router['delete'](_0x1b01('0x16'),auth[_0x1b01('0xb')](),controller['destroy']);module[_0x1b01('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 29aeb5f..c72e7d8 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 _0x54c1=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x8e4e90,_0x6d7185){var _0x1d9d2b=function(_0x3a63e7){while(--_0x3a63e7){_0x8e4e90['push'](_0x8e4e90['shift']());}};_0x1d9d2b(++_0x6d7185);}(_0x54c1,0x12b));var _0x154c=function(_0x56e3fb,_0x525ce0){_0x56e3fb=_0x56e3fb-0x0;var _0x5403d9=_0x54c1[_0x56e3fb];return _0x5403d9;};'use strict';var Sequelize=require(_0x154c('0x0'));module[_0x154c('0x1')]={'body':{'type':Sequelize[_0x154c('0x2')](_0x154c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x154c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x154c('0x5')]('in',_0x154c('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x154c('0x7')](0xbe)},'phone':{'type':Sequelize[_0x154c('0x7')]},'readAt':{'type':Sequelize[_0x154c('0x8')]},'secret':{'type':Sequelize[_0x154c('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x154c('0x2')]}}; \ No newline at end of file +var _0x17da=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5479df,_0x4f4814){var _0x4c78f2=function(_0x5d5e4a){while(--_0x5d5e4a){_0x5479df['push'](_0x5479df['shift']());}};_0x4c78f2(++_0x4f4814);}(_0x17da,0x167));var _0xa17d=function(_0x4d332a,_0x48d26d){_0x4d332a=_0x4d332a-0x0;var _0x5a22e3=_0x17da[_0x4d332a];return _0x5a22e3;};'use strict';var Sequelize=require(_0xa17d('0x0'));module['exports']={'body':{'type':Sequelize[_0xa17d('0x1')](_0xa17d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa17d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa17d('0x4')]('in',_0xa17d('0x5')),'defaultValue':_0xa17d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa17d('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa17d('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa17d('0x6')]},'providerResponse':{'type':Sequelize[_0xa17d('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9dfe5f4..e018c29 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 _0xea40=['stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','name','send','index','WhatsappMessage','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','update','body','find','destroy','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','QueryTypes','internal','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea40,0x180));var _0x0ea4=function(_0x8d5844,_0x48eb67){_0x8d5844=_0x8d5844-0x0;var _0x56726c=_0xea40[_0x8d5844];return _0x56726c;};'use strict';var emlformat=require(_0x0ea4('0x0'));var rimraf=require(_0x0ea4('0x1'));var zipdir=require(_0x0ea4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ea4('0x3'));var moment=require(_0x0ea4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0ea4('0x5'));var util=require(_0x0ea4('0x6'));var path=require(_0x0ea4('0x7'));var sox=require('sox');var csv=require(_0x0ea4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ea4('0x9'));var _=require(_0x0ea4('0xa'));var squel=require(_0x0ea4('0xb'));var crypto=require('crypto');var jsforce=require(_0x0ea4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0ea4('0xd'));var Papa=require(_0x0ea4('0xe'));var Redis=require(_0x0ea4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0ea4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ea4('0x11'));var logger=require(_0x0ea4('0x12'))(_0x0ea4('0x13'));var utils=require(_0x0ea4('0x14'));var config=require(_0x0ea4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ea4('0x16'))['db'];config[_0x0ea4('0x17')]=_[_0x0ea4('0x18')](config[_0x0ea4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ea4('0x19'))(new Redis(config[_0x0ea4('0x17')]));require(_0x0ea4('0x1a'))[_0x0ea4('0x1b')](socket);var jayson=require(_0x0ea4('0x1c'));var client=jayson[_0x0ea4('0x1d')][_0x0ea4('0x1e')]({'port':0x232c});var client9002=jayson[_0x0ea4('0x1d')][_0x0ea4('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3a8d2f,_0x2fbba2,_0x49ca96,_0x4978de){return new BPromise(function(_0x3e67c1,_0x3f9b96){var _0x4b14b9=_0x4978de||client;return _0x4b14b9[_0x0ea4('0x1f')](_0x3a8d2f,_0x49ca96)[_0x0ea4('0x20')](function(_0x472c43){logger[_0x0ea4('0x21')](_0x0ea4('0x22'),_0x2fbba2,_0x0ea4('0x23'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2fbba2,_0x0ea4('0x23'),JSON[_0x0ea4('0x24')](_0x472c43));if(_0x472c43[_0x0ea4('0x25')]){if(_0x472c43[_0x0ea4('0x25')][_0x0ea4('0x26')]===0x1f4){logger['error'](_0x0ea4('0x22'),_0x2fbba2,_0x472c43['error']['message']);return _0x3f9b96(_0x472c43['error'][_0x0ea4('0x27')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2fbba2,_0x472c43['error']['message']);return _0x3e67c1(_0x472c43['error'][_0x0ea4('0x27')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2fbba2,_0x0ea4('0x23'));_0x3e67c1(_0x472c43['result'][_0x0ea4('0x27')]);}})[_0x0ea4('0x28')](function(_0x111218){logger[_0x0ea4('0x25')](_0x0ea4('0x22'),_0x2fbba2,_0x111218);_0x3f9b96(_0x111218);});});}function respondWithStatusCode(_0x499d2d,_0x4bec9c){_0x4bec9c=_0x4bec9c||0xcc;return function(_0x2f07e1){if(_0x2f07e1){return _0x499d2d[_0x0ea4('0x29')](_0x4bec9c);}return _0x499d2d[_0x0ea4('0x2a')](_0x4bec9c)[_0x0ea4('0x2b')]();};}function respondWithResult(_0x52b7f4,_0x2cad3){_0x2cad3=_0x2cad3||0xc8;return function(_0x54ee4c){if(_0x54ee4c){return _0x52b7f4[_0x0ea4('0x2a')](_0x2cad3)[_0x0ea4('0x2c')](_0x54ee4c);}};}function respondWithFilteredResult(_0x55c2f9,_0x28b43d){return function(_0x1e1312){if(_0x1e1312){var _0x44ef08=typeof _0x28b43d[_0x0ea4('0x2d')]===_0x0ea4('0x2e')&&typeof _0x28b43d[_0x0ea4('0x2f')]===_0x0ea4('0x2e');var _0x48cb9a=_0x1e1312[_0x0ea4('0x30')];var _0xd42c81=_0x44ef08?0x0:_0x28b43d[_0x0ea4('0x2d')];var _0x3ca06c=_0x44ef08?_0x1e1312[_0x0ea4('0x30')]:_0x28b43d[_0x0ea4('0x2d')]+_0x28b43d[_0x0ea4('0x2f')];var _0x3735d5;if(_0x3ca06c>=_0x48cb9a){_0x3ca06c=_0x48cb9a;_0x3735d5=0xc8;}else{_0x3735d5=0xce;}_0x55c2f9['status'](_0x3735d5);return _0x55c2f9[_0x0ea4('0x31')]('Content-Range',_0xd42c81+'-'+_0x3ca06c+'/'+_0x48cb9a)[_0x0ea4('0x2c')](_0x1e1312);}return null;};}function patchUpdates(_0x2013d8){return function(_0x81458b){try{jsonpatch['apply'](_0x81458b,_0x2013d8,!![]);}catch(_0x2fdca5){return BPromise[_0x0ea4('0x32')](_0x2fdca5);}return _0x81458b[_0x0ea4('0x33')]();};}function saveUpdates(_0x800794,_0x161755){return function(_0x34b045){if(_0x34b045){return _0x34b045['update'](_0x800794)[_0x0ea4('0x20')](function(_0x5e9e48){return _0x5e9e48;});}return null;};}function removeEntity(_0x13e0a5,_0x1607d5){return function(_0x2c0678){if(_0x2c0678){return _0x2c0678['destroy']()[_0x0ea4('0x20')](function(){_0x13e0a5[_0x0ea4('0x2a')](0xcc)[_0x0ea4('0x2b')]();});}};}function handleEntityNotFound(_0x105c9f,_0x4589d4){return function(_0x441123){if(!_0x441123){_0x105c9f[_0x0ea4('0x29')](0x194);}return _0x441123;};}function handleError(_0x949337,_0x59ef51){_0x59ef51=_0x59ef51||0x1f4;return function(_0x30dd3c){logger[_0x0ea4('0x25')](_0x30dd3c['stack']);if(_0x30dd3c['name']){delete _0x30dd3c[_0x0ea4('0x34')];}_0x949337[_0x0ea4('0x2a')](_0x59ef51)[_0x0ea4('0x35')](_0x30dd3c);};}exports[_0x0ea4('0x36')]=function(_0x14033b,_0x3e1000){var _0x1c3b86={},_0x462e12={},_0x3fb684={'count':0x0,'rows':[]};var _0x8f655c=_['map'](db[_0x0ea4('0x37')]['rawAttributes'],function(_0x20f30c){return{'name':_0x20f30c['fieldName'],'type':_0x20f30c[_0x0ea4('0x38')][_0x0ea4('0x39')]};});_0x462e12[_0x0ea4('0x3a')]=_[_0x0ea4('0x3b')](_0x8f655c,_0x0ea4('0x34'));_0x462e12['query']=_[_0x0ea4('0x3c')](_0x14033b['query']);_0x462e12[_0x0ea4('0x3d')]=_[_0x0ea4('0x3e')](_0x462e12[_0x0ea4('0x3a')],_0x462e12[_0x0ea4('0x3f')]);_0x1c3b86[_0x0ea4('0x40')]=_[_0x0ea4('0x3e')](_0x462e12[_0x0ea4('0x3a')],qs[_0x0ea4('0x41')](_0x14033b[_0x0ea4('0x3f')][_0x0ea4('0x41')]));_0x1c3b86[_0x0ea4('0x40')]=_0x1c3b86[_0x0ea4('0x40')][_0x0ea4('0x42')]?_0x1c3b86['attributes']:_0x462e12['model'];if(!_0x14033b[_0x0ea4('0x3f')][_0x0ea4('0x43')]('nolimit')){_0x1c3b86[_0x0ea4('0x2f')]=qs[_0x0ea4('0x2f')](_0x14033b[_0x0ea4('0x3f')][_0x0ea4('0x2f')]);_0x1c3b86['offset']=qs[_0x0ea4('0x2d')](_0x14033b['query']['offset']);}_0x1c3b86[_0x0ea4('0x44')]=qs['sort'](_0x14033b[_0x0ea4('0x3f')]['sort']);_0x1c3b86[_0x0ea4('0x45')]=qs[_0x0ea4('0x3d')](_[_0x0ea4('0x46')](_0x14033b[_0x0ea4('0x3f')],_0x462e12[_0x0ea4('0x3d')]),_0x8f655c);if(_0x14033b['query']['filter']){_0x1c3b86['where']=_[_0x0ea4('0x47')](_0x1c3b86[_0x0ea4('0x45')],{'$or':_[_0x0ea4('0x3b')](_0x8f655c,function(_0x249bd2){if(_0x249bd2[_0x0ea4('0x38')]!==_0x0ea4('0x48')){var _0x1f0756={};_0x1f0756[_0x249bd2['name']]={'$like':'%'+_0x14033b[_0x0ea4('0x3f')][_0x0ea4('0x49')]+'%'};return _0x1f0756;}})});}_0x1c3b86=_[_0x0ea4('0x47')]({},_0x1c3b86,_0x14033b[_0x0ea4('0x4a')]);var _0x542931={'where':_0x1c3b86['where']};return db[_0x0ea4('0x37')][_0x0ea4('0x30')](_0x542931)[_0x0ea4('0x20')](function(_0xfce693){_0x3fb684[_0x0ea4('0x30')]=_0xfce693;if(_0x14033b[_0x0ea4('0x3f')][_0x0ea4('0x4b')]){_0x1c3b86[_0x0ea4('0x4c')]=[{'all':!![]}];}return db[_0x0ea4('0x37')][_0x0ea4('0x4d')](_0x1c3b86);})[_0x0ea4('0x20')](function(_0x5ce126){_0x3fb684[_0x0ea4('0x4e')]=_0x5ce126;return _0x3fb684;})[_0x0ea4('0x20')](respondWithFilteredResult(_0x3e1000,_0x1c3b86))[_0x0ea4('0x28')](handleError(_0x3e1000,null));};exports[_0x0ea4('0x4f')]=function(_0x2a2955,_0x3f8e42){var _0x49cfec={'raw':!![],'where':{'id':_0x2a2955[_0x0ea4('0x50')]['id']}},_0x56fa4f={};_0x56fa4f[_0x0ea4('0x3a')]=_['keys'](db[_0x0ea4('0x37')][_0x0ea4('0x51')]);_0x56fa4f['query']=_[_0x0ea4('0x3c')](_0x2a2955[_0x0ea4('0x3f')]);_0x56fa4f[_0x0ea4('0x3d')]=_[_0x0ea4('0x3e')](_0x56fa4f['model'],_0x56fa4f['query']);_0x49cfec[_0x0ea4('0x40')]=_[_0x0ea4('0x3e')](_0x56fa4f['model'],qs[_0x0ea4('0x41')](_0x2a2955[_0x0ea4('0x3f')][_0x0ea4('0x41')]));_0x49cfec[_0x0ea4('0x40')]=_0x49cfec['attributes'][_0x0ea4('0x42')]?_0x49cfec[_0x0ea4('0x40')]:_0x56fa4f[_0x0ea4('0x3a')];if(_0x2a2955[_0x0ea4('0x3f')]['includeAll']){_0x49cfec[_0x0ea4('0x4c')]=[{'all':!![]}];}_0x49cfec=_['merge']({},_0x49cfec,_0x2a2955[_0x0ea4('0x4a')]);return db[_0x0ea4('0x37')]['find'](_0x49cfec)[_0x0ea4('0x20')](handleEntityNotFound(_0x3f8e42,null))[_0x0ea4('0x20')](respondWithResult(_0x3f8e42,null))[_0x0ea4('0x28')](handleError(_0x3f8e42,null));};exports[_0x0ea4('0x52')]=function(_0x559629,_0xdb341e){return db[_0x0ea4('0x37')][_0x0ea4('0x52')](_0x559629['body'],{})[_0x0ea4('0x20')](respondWithResult(_0xdb341e,0xc9))[_0x0ea4('0x28')](handleError(_0xdb341e,null));};exports[_0x0ea4('0x53')]=function(_0x4db2f9,_0x31beed){if(_0x4db2f9[_0x0ea4('0x54')]['id']){delete _0x4db2f9[_0x0ea4('0x54')]['id'];}return db[_0x0ea4('0x37')][_0x0ea4('0x55')]({'where':{'id':_0x4db2f9[_0x0ea4('0x50')]['id']}})[_0x0ea4('0x20')](handleEntityNotFound(_0x31beed,null))[_0x0ea4('0x20')](saveUpdates(_0x4db2f9[_0x0ea4('0x54')],null))[_0x0ea4('0x20')](respondWithResult(_0x31beed,null))['catch'](handleError(_0x31beed,null));};exports[_0x0ea4('0x56')]=function(_0x4ba9fc,_0x2ca4d1){return db[_0x0ea4('0x37')][_0x0ea4('0x55')]({'where':{'id':_0x4ba9fc[_0x0ea4('0x50')]['id']}})[_0x0ea4('0x20')](handleEntityNotFound(_0x2ca4d1,null))[_0x0ea4('0x20')](removeEntity(_0x2ca4d1,null))['catch'](handleError(_0x2ca4d1,null));};exports[_0x0ea4('0x57')]=function(_0x2f7685,_0x19d965){return db[_0x0ea4('0x37')][_0x0ea4('0x57')]()[_0x0ea4('0x20')](respondWithResult(_0x19d965,null))['catch'](handleError(_0x19d965,null));};var interaction_log=require(_0x0ea4('0x12'))(_0x0ea4('0x58'));exports[_0x0ea4('0x59')]=function(_0x4ee452,_0x430aba,_0x583d1a){var _0x23b0a6={'agent':{},'channel':'whatsapp'};if(_0x4ee452[_0x0ea4('0x54')]['id']){delete _0x4ee452[_0x0ea4('0x54')]['id'];}_0x4ee452[_0x0ea4('0x54')][_0x0ea4('0x5a')]=!![];_0x4ee452[_0x0ea4('0x54')][_0x0ea4('0x5b')]=moment()['format'](_0x0ea4('0x5c'));_0x4ee452[_0x0ea4('0x54')][_0x0ea4('0x5d')]=_0x4ee452[_0x0ea4('0x54')]['UserId']||_0x4ee452['user']['id'];_0x23b0a6[_0x0ea4('0x5e')]['id']=_0x4ee452[_0x0ea4('0x54')][_0x0ea4('0x5d')];return db[_0x0ea4('0x37')][_0x0ea4('0x55')]({'where':{'id':_0x4ee452[_0x0ea4('0x50')]['id'],'UserId':null}})[_0x0ea4('0x20')](handleEntityNotFound(_0x430aba,null))['then'](saveUpdates(_0x4ee452['body'],null))[_0x0ea4('0x20')](function(_0x3e8617){if(_0x3e8617){_0x23b0a6[_0x0ea4('0x27')]=_0x3e8617[_0x0ea4('0x5f')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x3e8617[_0x0ea4('0x60')]}});}return null;})[_0x0ea4('0x20')](handleEntityNotFound(_0x430aba,null))[_0x0ea4('0x20')](function(_0x139422){if(_0x139422){return _0x139422[_0x0ea4('0x53')]({'UserId':_0x4ee452[_0x0ea4('0x54')]['UserId'],'read1stAt':_[_0x0ea4('0x61')](_0x139422[_0x0ea4('0x62')])?moment()[_0x0ea4('0x63')](_0x0ea4('0x5c')):undefined});}return null;})['then'](function(_0x243360){if(_0x243360){_0x23b0a6[_0x0ea4('0x64')]=_0x243360[_0x0ea4('0x5f')]({'plain':!![]});interaction_log['info'](_0x0ea4('0x65'),_0x4ee452[_0x0ea4('0x66')]['id'],_0x4ee452['user'][_0x0ea4('0x34')],_0x4ee452['user'][_0x0ea4('0x67')],_0x23b0a6[_0x0ea4('0x64')]['id'],_0x4ee452[_0x0ea4('0x54')]?JSON['stringify'](_0x4ee452[_0x0ea4('0x54')]):_0x0ea4('0x68'));return respondWithRpcPromise(_0x0ea4('0x69'),_0x0ea4('0x6a'),_0x23b0a6);}return null;})[_0x0ea4('0x20')](function(_0x316367){var _0x642260=_0x0ea4('0x6b')+_0x316367[_0x0ea4('0x27')][_0x0ea4('0x6c')];return db[_0x0ea4('0x6d')]['query'](_0x642260,{'type':db['Sequelize']['QueryTypes'][_0x0ea4('0x6e')],'raw':!![]})[_0x0ea4('0x20')](function(_0x387515){return _0x387515;});})[_0x0ea4('0x20')](function(_0x6fbe44){if(_0x6fbe44){_0x23b0a6[_0x0ea4('0x27')][_0x0ea4('0x6f')]=_0x6fbe44[0x0];if(!_0x4ee452['body']['UserId'])return;return db[_0x0ea4('0x70')][_0x0ea4('0x55')]({'where':{'id':_0x4ee452['body'][_0x0ea4('0x5d')],'role':_0x0ea4('0x5e')},'attributes':['id','name',_0x0ea4('0x71'),_0x0ea4('0x72'),'internal'],'raw':!![]});}return null;})[_0x0ea4('0x20')](function(_0x56db2e){if(!_0x56db2e)return null;_0x23b0a6[_0x0ea4('0x27')][_0x0ea4('0x5e')]=_0x56db2e;return _0x23b0a6;})[_0x0ea4('0x20')](function(_0x1d000b){if(_0x1d000b){if(_0x4ee452[_0x0ea4('0x54')][_0x0ea4('0x73')]){_0x23b0a6['message'][_0x0ea4('0x74')]=util['format'](_0x0ea4('0x75'),_0x4ee452[_0x0ea4('0x66')][_0x0ea4('0x34')]);_0x23b0a6[_0x0ea4('0x27')][_0x0ea4('0x76')]=_0x23b0a6[_0x0ea4('0x76')];_0x23b0a6[_0x0ea4('0x27')][_0x0ea4('0x77')]=_0x23b0a6[_0x0ea4('0x76')];_0x23b0a6[_0x0ea4('0x27')][_0x0ea4('0x78')]=_0x0ea4('0x59');return respondWithRpcPromise(_0x0ea4('0x79'),_0x0ea4('0x79'),{'event':_0x0ea4('0x7a'),'message':_0x23b0a6[_0x0ea4('0x27')]},client9002)[_0x0ea4('0x20')](function(){return _0x23b0a6;});}return _0x23b0a6;}return null;})['then'](respondWithResult(_0x430aba,null))[_0x0ea4('0x28')](handleError(_0x430aba,null));};var interaction_log=require(_0x0ea4('0x12'))('whatsapp-interactions');exports[_0x0ea4('0x32')]=function(_0x15a0cc,_0x3019f0,_0x1dde24){var _0x2dacdb={'agent':{},'channel':_0x0ea4('0x7b')};if(_0x15a0cc['body']['id']){delete _0x15a0cc[_0x0ea4('0x54')]['id'];}_0x15a0cc[_0x0ea4('0x54')][_0x0ea4('0x5d')]=_0x15a0cc[_0x0ea4('0x54')][_0x0ea4('0x5d')]||_0x15a0cc['user']['id'];_0x2dacdb['agent']['id']=_0x15a0cc[_0x0ea4('0x54')][_0x0ea4('0x5d')];return db['WhatsappMessage'][_0x0ea4('0x55')]({'where':{'id':_0x15a0cc[_0x0ea4('0x50')]['id'],'UserId':null}})[_0x0ea4('0x20')](handleEntityNotFound(_0x3019f0,null))['then'](function(_0x2cb817){if(_0x2cb817){_0x2dacdb['message']=_0x2cb817[_0x0ea4('0x5f')]({'plain':!![]});return db[_0x0ea4('0x7c')]['find']({'where':{'id':_0x2cb817[_0x0ea4('0x60')]}});}return null;})[_0x0ea4('0x20')](handleEntityNotFound(_0x3019f0,null))['then'](function(_0x425f4b){if(_0x425f4b){_0x2dacdb[_0x0ea4('0x64')]=_0x425f4b[_0x0ea4('0x5f')]({'plain':!![]});interaction_log[_0x0ea4('0x21')](_0x0ea4('0x7d'),_0x15a0cc[_0x0ea4('0x66')]['id'],_0x15a0cc[_0x0ea4('0x66')][_0x0ea4('0x34')],_0x15a0cc[_0x0ea4('0x66')][_0x0ea4('0x67')],_0x2dacdb[_0x0ea4('0x64')]['id'],_0x15a0cc['body']?JSON[_0x0ea4('0x24')](_0x15a0cc[_0x0ea4('0x54')]):_0x0ea4('0x68'));return respondWithRpcPromise('RejectMessage',_0x0ea4('0x7e'),_0x2dacdb);}return null;})['then'](function(_0x2fd0c8){var _0x3e00fb=_0x0ea4('0x6b')+_0x2fd0c8[_0x0ea4('0x27')][_0x0ea4('0x6c')];return db[_0x0ea4('0x6d')][_0x0ea4('0x3f')](_0x3e00fb,{'type':db[_0x0ea4('0x7f')][_0x0ea4('0x80')]['SELECT'],'raw':!![]})[_0x0ea4('0x20')](function(_0x5cd583){return _0x5cd583;});})[_0x0ea4('0x20')](function(_0x373238){if(_0x373238){_0x2dacdb[_0x0ea4('0x27')]['contact']=_0x373238[0x0];if(!_0x15a0cc[_0x0ea4('0x54')][_0x0ea4('0x5d')])return;return db[_0x0ea4('0x70')][_0x0ea4('0x55')]({'where':{'id':_0x15a0cc[_0x0ea4('0x54')]['UserId'],'role':_0x0ea4('0x5e')},'attributes':['id',_0x0ea4('0x34'),_0x0ea4('0x71'),_0x0ea4('0x72'),_0x0ea4('0x81')],'raw':!![]});}return null;})[_0x0ea4('0x20')](function(_0x393cda){if(!_0x393cda)return null;_0x2dacdb[_0x0ea4('0x27')]['agent']=_0x393cda;return _0x2dacdb;})[_0x0ea4('0x20')](function(_0x14b46f){if(_0x14b46f){_0x14b46f[_0x0ea4('0x27')][_0x0ea4('0x74')]=util[_0x0ea4('0x63')](_0x0ea4('0x75'),_0x15a0cc[_0x0ea4('0x66')][_0x0ea4('0x34')]);_0x14b46f[_0x0ea4('0x27')]['channel']=_0x2dacdb[_0x0ea4('0x76')];_0x14b46f[_0x0ea4('0x27')][_0x0ea4('0x77')]=_0x2dacdb[_0x0ea4('0x76')];_0x14b46f[_0x0ea4('0x27')]['event']=_0x0ea4('0x32');respondWithRpcPromise('EventManager',_0x0ea4('0x79'),{'event':_0x0ea4('0x82'),'message':_0x14b46f[_0x0ea4('0x27')]},client9002);return _0x2dacdb;}return null;})['then'](respondWithResult(_0x3019f0,null))['catch'](handleError(_0x3019f0,null));};exports[_0x0ea4('0x2a')]=function(_0x574d12,_0x3d4171,_0x5ce9f3){if(_0x574d12['body']['id']){delete _0x574d12[_0x0ea4('0x54')]['id'];}var _0x1eea84;return db[_0x0ea4('0x37')]['find']({'where':{'id':_0x574d12['params']['id']}})[_0x0ea4('0x20')](handleEntityNotFound(_0x3d4171,null))[_0x0ea4('0x20')](function(_0x3d856c){if(_0x3d856c){_0x1eea84=_0x3d856c;return db['WhatsappAccount'][_0x0ea4('0x55')]({'where':{'id':_0x3d856c[_0x0ea4('0x83')]}});}})[_0x0ea4('0x20')](handleEntityNotFound(_0x3d4171,null))['then'](function(_0x7353a2){if(_0x7353a2){logger[_0x0ea4('0x84')](_0x0ea4('0x85'),_0x0ea4('0x2a'),_0x0ea4('0x86'),_0x7353a2[_0x0ea4('0x38')],util[_0x0ea4('0x87')](_0x574d12[_0x0ea4('0x54')],{'showHidden':![],'depth':null}));switch(_0x7353a2['type']){case _0x0ea4('0x88'):if(_0x574d12[_0x0ea4('0x54')]['MessageSid']&&_0x574d12[_0x0ea4('0x54')]['MessageSid']===_0x1eea84[_0x0ea4('0x89')]&&_0x574d12[_0x0ea4('0x54')]['MessageStatus']&&_0x574d12[_0x0ea4('0x54')][_0x0ea4('0x8a')]==='read'){return _0x1eea84['update']({'read':!![]});}else{logger[_0x0ea4('0x25')](_0x0ea4('0x8b'),'status',_0x0ea4('0x88'),util[_0x0ea4('0x87')](_0x574d12[_0x0ea4('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1eea84;}})[_0x0ea4('0x20')](respondWithResult(_0x3d4171,null))[_0x0ea4('0x28')](handleError(_0x3d4171,null));}; \ No newline at end of file +var _0x2c8a=['isNil','read1stAt','[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','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','accept','acceptmessage','whatsapp-interactions','WhatsappInteraction','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','internal','event','EventManager','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','undefined','count','offset','limit','set','json','reject','save','update','destroy','stack','name','map','WhatsappMessage','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','length','find','create','body','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c8a,0x1df));var _0xa2c8=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x2c8a[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0xa2c8('0x0'));var rimraf=require(_0xa2c8('0x1'));var zipdir=require(_0xa2c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2c8('0x3'));var moment=require('moment');var BPromise=require(_0xa2c8('0x4'));var Mustache=require(_0xa2c8('0x5'));var util=require('util');var path=require(_0xa2c8('0x6'));var sox=require(_0xa2c8('0x7'));var csv=require(_0xa2c8('0x8'));var ejs=require(_0xa2c8('0x9'));var fs=require('fs');var fs_extra=require(_0xa2c8('0xa'));var _=require(_0xa2c8('0xb'));var squel=require(_0xa2c8('0xc'));var crypto=require(_0xa2c8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa2c8('0xe'));var toCsv=require(_0xa2c8('0x8'));var querystring=require('querystring');var Papa=require(_0xa2c8('0xf'));var Redis=require(_0xa2c8('0x10'));var authService=require(_0xa2c8('0x11'));var qs=require(_0xa2c8('0x12'));var as=require(_0xa2c8('0x13'));var hardwareService=require(_0xa2c8('0x14'));var logger=require(_0xa2c8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa2c8('0x16'));var licenseUtil=require(_0xa2c8('0x17'));var db=require(_0xa2c8('0x18'))['db'];config[_0xa2c8('0x19')]=_[_0xa2c8('0x1a')](config[_0xa2c8('0x19')],{'host':_0xa2c8('0x1b'),'port':0x18eb});var socket=require(_0xa2c8('0x1c'))(new Redis(config[_0xa2c8('0x19')]));require(_0xa2c8('0x1d'))[_0xa2c8('0x1e')](socket);var jayson=require(_0xa2c8('0x1f'));var client=jayson['client'][_0xa2c8('0x20')]({'port':0x232c});var client9002=jayson[_0xa2c8('0x21')][_0xa2c8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x46a11c,_0x2f02a3,_0x4b7bcf,_0x5eb28e){return new BPromise(function(_0x356ef1,_0x1aa08f){var _0x167a66=_0x5eb28e||client;return _0x167a66[_0xa2c8('0x22')](_0x46a11c,_0x4b7bcf)[_0xa2c8('0x23')](function(_0x300592){logger[_0xa2c8('0x24')](_0xa2c8('0x25'),_0x2f02a3,_0xa2c8('0x26'));logger[_0xa2c8('0x27')](_0xa2c8('0x28'),_0x2f02a3,_0xa2c8('0x26'),JSON[_0xa2c8('0x29')](_0x300592));if(_0x300592['error']){if(_0x300592['error'][_0xa2c8('0x2a')]===0x1f4){logger[_0xa2c8('0x2b')](_0xa2c8('0x25'),_0x2f02a3,_0x300592[_0xa2c8('0x2b')][_0xa2c8('0x2c')]);return _0x1aa08f(_0x300592[_0xa2c8('0x2b')][_0xa2c8('0x2c')]);}logger['error'](_0xa2c8('0x25'),_0x2f02a3,_0x300592['error'][_0xa2c8('0x2c')]);return _0x356ef1(_0x300592[_0xa2c8('0x2b')][_0xa2c8('0x2c')]);}else{logger[_0xa2c8('0x24')](_0xa2c8('0x25'),_0x2f02a3,_0xa2c8('0x26'));_0x356ef1(_0x300592[_0xa2c8('0x2d')]['message']);}})[_0xa2c8('0x2e')](function(_0x51a4f6){logger['error'](_0xa2c8('0x25'),_0x2f02a3,_0x51a4f6);_0x1aa08f(_0x51a4f6);});});}function respondWithStatusCode(_0x1d1417,_0x2a04de){_0x2a04de=_0x2a04de||0xcc;return function(_0x549372){if(_0x549372){return _0x1d1417[_0xa2c8('0x2f')](_0x2a04de);}return _0x1d1417[_0xa2c8('0x30')](_0x2a04de)[_0xa2c8('0x31')]();};}function respondWithResult(_0x60c559,_0x182f1c){_0x182f1c=_0x182f1c||0xc8;return function(_0x3f3798){if(_0x3f3798){return _0x60c559['status'](_0x182f1c)['json'](_0x3f3798);}};}function respondWithFilteredResult(_0x336b19,_0x12d6cf){return function(_0x377ed0){if(_0x377ed0){var _0x28573a=typeof _0x12d6cf['offset']==='undefined'&&typeof _0x12d6cf['limit']===_0xa2c8('0x32');var _0x53a423=_0x377ed0[_0xa2c8('0x33')];var _0x54c4d2=_0x28573a?0x0:_0x12d6cf[_0xa2c8('0x34')];var _0x5cf1c9=_0x28573a?_0x377ed0['count']:_0x12d6cf[_0xa2c8('0x34')]+_0x12d6cf[_0xa2c8('0x35')];var _0x2791bc;if(_0x5cf1c9>=_0x53a423){_0x5cf1c9=_0x53a423;_0x2791bc=0xc8;}else{_0x2791bc=0xce;}_0x336b19[_0xa2c8('0x30')](_0x2791bc);return _0x336b19[_0xa2c8('0x36')]('Content-Range',_0x54c4d2+'-'+_0x5cf1c9+'/'+_0x53a423)[_0xa2c8('0x37')](_0x377ed0);}return null;};}function patchUpdates(_0x545c6f){return function(_0x3a12ea){try{jsonpatch['apply'](_0x3a12ea,_0x545c6f,!![]);}catch(_0x352243){return BPromise[_0xa2c8('0x38')](_0x352243);}return _0x3a12ea[_0xa2c8('0x39')]();};}function saveUpdates(_0xd548ee,_0x316274){return function(_0x2187e4){if(_0x2187e4){return _0x2187e4[_0xa2c8('0x3a')](_0xd548ee)[_0xa2c8('0x23')](function(_0x2c9c67){return _0x2c9c67;});}return null;};}function removeEntity(_0x250b61,_0x3083de){return function(_0x45f781){if(_0x45f781){return _0x45f781[_0xa2c8('0x3b')]()[_0xa2c8('0x23')](function(){_0x250b61['status'](0xcc)[_0xa2c8('0x31')]();});}};}function handleEntityNotFound(_0x4f915d,_0x286485){return function(_0x37bece){if(!_0x37bece){_0x4f915d[_0xa2c8('0x2f')](0x194);}return _0x37bece;};}function handleError(_0xea3910,_0xbd7943){_0xbd7943=_0xbd7943||0x1f4;return function(_0x3e5497){logger['error'](_0x3e5497[_0xa2c8('0x3c')]);if(_0x3e5497[_0xa2c8('0x3d')]){delete _0x3e5497['name'];}_0xea3910[_0xa2c8('0x30')](_0xbd7943)['send'](_0x3e5497);};}exports['index']=function(_0x202cd2,_0x24e2d7){var _0x454e0f={},_0x551a7b={},_0x3646cc={'count':0x0,'rows':[]};var _0x43c670=_[_0xa2c8('0x3e')](db[_0xa2c8('0x3f')][_0xa2c8('0x40')],function(_0x29416c){return{'name':_0x29416c[_0xa2c8('0x41')],'type':_0x29416c['type']['key']};});_0x551a7b['model']=_[_0xa2c8('0x3e')](_0x43c670,_0xa2c8('0x3d'));_0x551a7b[_0xa2c8('0x42')]=_['keys'](_0x202cd2['query']);_0x551a7b[_0xa2c8('0x43')]=_[_0xa2c8('0x44')](_0x551a7b[_0xa2c8('0x45')],_0x551a7b[_0xa2c8('0x42')]);_0x454e0f[_0xa2c8('0x46')]=_[_0xa2c8('0x44')](_0x551a7b['model'],qs[_0xa2c8('0x47')](_0x202cd2[_0xa2c8('0x42')][_0xa2c8('0x47')]));_0x454e0f[_0xa2c8('0x46')]=_0x454e0f['attributes']['length']?_0x454e0f[_0xa2c8('0x46')]:_0x551a7b[_0xa2c8('0x45')];if(!_0x202cd2[_0xa2c8('0x42')]['hasOwnProperty'](_0xa2c8('0x48'))){_0x454e0f[_0xa2c8('0x35')]=qs[_0xa2c8('0x35')](_0x202cd2[_0xa2c8('0x42')]['limit']);_0x454e0f[_0xa2c8('0x34')]=qs[_0xa2c8('0x34')](_0x202cd2[_0xa2c8('0x42')]['offset']);}_0x454e0f[_0xa2c8('0x49')]=qs[_0xa2c8('0x4a')](_0x202cd2[_0xa2c8('0x42')][_0xa2c8('0x4a')]);_0x454e0f[_0xa2c8('0x4b')]=qs[_0xa2c8('0x43')](_[_0xa2c8('0x4c')](_0x202cd2['query'],_0x551a7b[_0xa2c8('0x43')]),_0x43c670);if(_0x202cd2['query'][_0xa2c8('0x4d')]){_0x454e0f['where']=_['merge'](_0x454e0f['where'],{'$or':_[_0xa2c8('0x3e')](_0x43c670,function(_0x14c00e){if(_0x14c00e['type']!==_0xa2c8('0x4e')){var _0x1a1a6b={};_0x1a1a6b[_0x14c00e[_0xa2c8('0x3d')]]={'$like':'%'+_0x202cd2[_0xa2c8('0x42')][_0xa2c8('0x4d')]+'%'};return _0x1a1a6b;}})});}_0x454e0f=_[_0xa2c8('0x4f')]({},_0x454e0f,_0x202cd2[_0xa2c8('0x50')]);var _0x4fab95={'where':_0x454e0f[_0xa2c8('0x4b')]};return db[_0xa2c8('0x3f')][_0xa2c8('0x33')](_0x4fab95)[_0xa2c8('0x23')](function(_0x5c9197){_0x3646cc[_0xa2c8('0x33')]=_0x5c9197;if(_0x202cd2[_0xa2c8('0x42')][_0xa2c8('0x51')]){_0x454e0f[_0xa2c8('0x52')]=[{'all':!![]}];}return db[_0xa2c8('0x3f')][_0xa2c8('0x53')](_0x454e0f);})[_0xa2c8('0x23')](function(_0x230b93){_0x3646cc[_0xa2c8('0x54')]=_0x230b93;return _0x3646cc;})[_0xa2c8('0x23')](respondWithFilteredResult(_0x24e2d7,_0x454e0f))['catch'](handleError(_0x24e2d7,null));};exports['show']=function(_0x2410a8,_0x21a2c){var _0x2b228c={'raw':!![],'where':{'id':_0x2410a8[_0xa2c8('0x55')]['id']}},_0x1f78f2={};_0x1f78f2[_0xa2c8('0x45')]=_[_0xa2c8('0x56')](db[_0xa2c8('0x3f')]['rawAttributes']);_0x1f78f2[_0xa2c8('0x42')]=_[_0xa2c8('0x56')](_0x2410a8[_0xa2c8('0x42')]);_0x1f78f2[_0xa2c8('0x43')]=_[_0xa2c8('0x44')](_0x1f78f2[_0xa2c8('0x45')],_0x1f78f2['query']);_0x2b228c[_0xa2c8('0x46')]=_[_0xa2c8('0x44')](_0x1f78f2[_0xa2c8('0x45')],qs[_0xa2c8('0x47')](_0x2410a8[_0xa2c8('0x42')][_0xa2c8('0x47')]));_0x2b228c['attributes']=_0x2b228c['attributes'][_0xa2c8('0x57')]?_0x2b228c[_0xa2c8('0x46')]:_0x1f78f2['model'];if(_0x2410a8[_0xa2c8('0x42')]['includeAll']){_0x2b228c['include']=[{'all':!![]}];}_0x2b228c=_['merge']({},_0x2b228c,_0x2410a8[_0xa2c8('0x50')]);return db['WhatsappMessage'][_0xa2c8('0x58')](_0x2b228c)[_0xa2c8('0x23')](handleEntityNotFound(_0x21a2c,null))[_0xa2c8('0x23')](respondWithResult(_0x21a2c,null))['catch'](handleError(_0x21a2c,null));};exports['create']=function(_0x33a0c9,_0x3f211f){return db['WhatsappMessage'][_0xa2c8('0x59')](_0x33a0c9[_0xa2c8('0x5a')],{})[_0xa2c8('0x23')](respondWithResult(_0x3f211f,0xc9))['catch'](handleError(_0x3f211f,null));};exports['update']=function(_0x10c2a2,_0x119219){if(_0x10c2a2[_0xa2c8('0x5a')]['id']){delete _0x10c2a2['body']['id'];}return db[_0xa2c8('0x3f')][_0xa2c8('0x58')]({'where':{'id':_0x10c2a2[_0xa2c8('0x55')]['id']}})['then'](handleEntityNotFound(_0x119219,null))[_0xa2c8('0x23')](saveUpdates(_0x10c2a2[_0xa2c8('0x5a')],null))[_0xa2c8('0x23')](respondWithResult(_0x119219,null))['catch'](handleError(_0x119219,null));};exports[_0xa2c8('0x3b')]=function(_0x4a9617,_0x5850a5){return db['WhatsappMessage']['find']({'where':{'id':_0x4a9617[_0xa2c8('0x55')]['id']}})['then'](handleEntityNotFound(_0x5850a5,null))[_0xa2c8('0x23')](removeEntity(_0x5850a5,null))[_0xa2c8('0x2e')](handleError(_0x5850a5,null));};exports[_0xa2c8('0x5b')]=function(_0x39fc9f,_0x3ab221){return db[_0xa2c8('0x3f')]['describe']()[_0xa2c8('0x23')](respondWithResult(_0x3ab221,null))[_0xa2c8('0x2e')](handleError(_0x3ab221,null));};var interaction_log=require(_0xa2c8('0x15'))('whatsapp-interactions');exports['accept']=function(_0x373d82,_0x570927,_0x48e3bd){var _0x2ad19d={'agent':{},'channel':_0xa2c8('0x5c')};if(_0x373d82[_0xa2c8('0x5a')]['id']){delete _0x373d82[_0xa2c8('0x5a')]['id'];}_0x373d82['body'][_0xa2c8('0x5d')]=!![];_0x373d82[_0xa2c8('0x5a')][_0xa2c8('0x5e')]=moment()[_0xa2c8('0x5f')](_0xa2c8('0x60'));_0x373d82['body'][_0xa2c8('0x61')]=_0x373d82['body'][_0xa2c8('0x61')]||_0x373d82[_0xa2c8('0x62')]['id'];_0x2ad19d[_0xa2c8('0x63')]['id']=_0x373d82['body']['UserId'];return db[_0xa2c8('0x3f')][_0xa2c8('0x58')]({'where':{'id':_0x373d82[_0xa2c8('0x55')]['id'],'UserId':null}})[_0xa2c8('0x23')](handleEntityNotFound(_0x570927,null))['then'](saveUpdates(_0x373d82[_0xa2c8('0x5a')],null))[_0xa2c8('0x23')](function(_0x11191b){if(_0x11191b){_0x2ad19d[_0xa2c8('0x2c')]=_0x11191b[_0xa2c8('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0xa2c8('0x58')]({'where':{'id':_0x11191b['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x570927,null))[_0xa2c8('0x23')](function(_0x116f93){if(_0x116f93){return _0x116f93[_0xa2c8('0x3a')]({'UserId':_0x373d82[_0xa2c8('0x5a')][_0xa2c8('0x61')],'read1stAt':_[_0xa2c8('0x65')](_0x116f93[_0xa2c8('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa2c8('0x23')](function(_0x259609){if(_0x259609){_0x2ad19d['interaction']=_0x259609[_0xa2c8('0x64')]({'plain':!![]});interaction_log[_0xa2c8('0x24')](_0xa2c8('0x67'),_0x373d82[_0xa2c8('0x62')]['id'],_0x373d82['user']['name'],_0x373d82[_0xa2c8('0x62')][_0xa2c8('0x68')],_0x2ad19d['interaction']['id'],_0x373d82[_0xa2c8('0x5a')]?JSON[_0xa2c8('0x29')](_0x373d82[_0xa2c8('0x5a')]):_0xa2c8('0x69'));return respondWithRpcPromise(_0xa2c8('0x6a'),_0xa2c8('0x6b'),_0x2ad19d);}return null;})[_0xa2c8('0x23')](function(_0x39694c){var _0x4415aa=_0xa2c8('0x6c')+_0x39694c[_0xa2c8('0x2c')][_0xa2c8('0x6d')];return db[_0xa2c8('0x6e')][_0xa2c8('0x42')](_0x4415aa,{'type':db[_0xa2c8('0x6f')][_0xa2c8('0x70')][_0xa2c8('0x71')],'raw':!![]})[_0xa2c8('0x23')](function(_0xde7a19){return _0xde7a19;});})[_0xa2c8('0x23')](function(_0x4b123c){if(_0x4b123c){_0x2ad19d['message'][_0xa2c8('0x72')]=_0x4b123c[0x0];if(!_0x373d82[_0xa2c8('0x5a')][_0xa2c8('0x61')])return;return db[_0xa2c8('0x73')]['find']({'where':{'id':_0x373d82[_0xa2c8('0x5a')]['UserId'],'role':_0xa2c8('0x63')},'attributes':['id','name','fullname',_0xa2c8('0x74'),'internal'],'raw':!![]});}return null;})[_0xa2c8('0x23')](function(_0x3cd0d3){if(!_0x3cd0d3)return null;_0x2ad19d[_0xa2c8('0x2c')]['agent']=_0x3cd0d3;return _0x2ad19d;})['then'](function(_0x3d48c8){if(_0x3d48c8){if(_0x373d82['body'][_0xa2c8('0x75')]){_0x2ad19d[_0xa2c8('0x2c')][_0xa2c8('0x76')]=util['format'](_0xa2c8('0x77'),_0x373d82[_0xa2c8('0x62')][_0xa2c8('0x3d')]);_0x2ad19d[_0xa2c8('0x2c')][_0xa2c8('0x78')]=_0x2ad19d[_0xa2c8('0x78')];_0x2ad19d[_0xa2c8('0x2c')][_0xa2c8('0x79')]=_0x2ad19d[_0xa2c8('0x78')];_0x2ad19d['message']['event']=_0xa2c8('0x7a');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xa2c8('0x7b'),'message':_0x2ad19d[_0xa2c8('0x2c')]},client9002)[_0xa2c8('0x23')](function(){return _0x2ad19d;});}return _0x2ad19d;}return null;})[_0xa2c8('0x23')](respondWithResult(_0x570927,null))[_0xa2c8('0x2e')](handleError(_0x570927,null));};var interaction_log=require('../../config/logger')(_0xa2c8('0x7c'));exports[_0xa2c8('0x38')]=function(_0x3e738e,_0x4599ab,_0x4d13bf){var _0x4b8d57={'agent':{},'channel':_0xa2c8('0x5c')};if(_0x3e738e[_0xa2c8('0x5a')]['id']){delete _0x3e738e[_0xa2c8('0x5a')]['id'];}_0x3e738e['body']['UserId']=_0x3e738e['body'][_0xa2c8('0x61')]||_0x3e738e[_0xa2c8('0x62')]['id'];_0x4b8d57[_0xa2c8('0x63')]['id']=_0x3e738e['body'][_0xa2c8('0x61')];return db[_0xa2c8('0x3f')][_0xa2c8('0x58')]({'where':{'id':_0x3e738e[_0xa2c8('0x55')]['id'],'UserId':null}})[_0xa2c8('0x23')](handleEntityNotFound(_0x4599ab,null))[_0xa2c8('0x23')](function(_0x9f6a04){if(_0x9f6a04){_0x4b8d57[_0xa2c8('0x2c')]=_0x9f6a04['get']({'plain':!![]});return db[_0xa2c8('0x7d')][_0xa2c8('0x58')]({'where':{'id':_0x9f6a04['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4599ab,null))['then'](function(_0x247ba1){if(_0x247ba1){_0x4b8d57[_0xa2c8('0x7e')]=_0x247ba1[_0xa2c8('0x64')]({'plain':!![]});interaction_log[_0xa2c8('0x24')](_0xa2c8('0x7f'),_0x3e738e[_0xa2c8('0x62')]['id'],_0x3e738e[_0xa2c8('0x62')]['name'],_0x3e738e[_0xa2c8('0x62')][_0xa2c8('0x68')],_0x4b8d57[_0xa2c8('0x7e')]['id'],_0x3e738e[_0xa2c8('0x5a')]?JSON[_0xa2c8('0x29')](_0x3e738e[_0xa2c8('0x5a')]):_0xa2c8('0x69'));return respondWithRpcPromise(_0xa2c8('0x80'),_0xa2c8('0x81'),_0x4b8d57);}return null;})[_0xa2c8('0x23')](function(_0x10ec72){var _0x9a3ec0=_0xa2c8('0x6c')+_0x10ec72[_0xa2c8('0x2c')][_0xa2c8('0x6d')];return db[_0xa2c8('0x6e')][_0xa2c8('0x42')](_0x9a3ec0,{'type':db[_0xa2c8('0x6f')][_0xa2c8('0x70')]['SELECT'],'raw':!![]})[_0xa2c8('0x23')](function(_0x5e741d){return _0x5e741d;});})[_0xa2c8('0x23')](function(_0x32fbd1){if(_0x32fbd1){_0x4b8d57[_0xa2c8('0x2c')]['contact']=_0x32fbd1[0x0];if(!_0x3e738e[_0xa2c8('0x5a')][_0xa2c8('0x61')])return;return db[_0xa2c8('0x73')][_0xa2c8('0x58')]({'where':{'id':_0x3e738e[_0xa2c8('0x5a')]['UserId'],'role':_0xa2c8('0x63')},'attributes':['id',_0xa2c8('0x3d'),_0xa2c8('0x82'),_0xa2c8('0x74'),_0xa2c8('0x83')],'raw':!![]});}return null;})['then'](function(_0x2bdea6){if(!_0x2bdea6)return null;_0x4b8d57[_0xa2c8('0x2c')][_0xa2c8('0x63')]=_0x2bdea6;return _0x4b8d57;})[_0xa2c8('0x23')](function(_0x415e59){if(_0x415e59){_0x415e59[_0xa2c8('0x2c')][_0xa2c8('0x76')]=util[_0xa2c8('0x5f')](_0xa2c8('0x77'),_0x3e738e[_0xa2c8('0x62')]['name']);_0x415e59[_0xa2c8('0x2c')][_0xa2c8('0x78')]=_0x4b8d57['channel'];_0x415e59[_0xa2c8('0x2c')][_0xa2c8('0x79')]=_0x4b8d57[_0xa2c8('0x78')];_0x415e59[_0xa2c8('0x2c')][_0xa2c8('0x84')]='reject';respondWithRpcPromise(_0xa2c8('0x85'),_0xa2c8('0x85'),{'event':_0xa2c8('0x86'),'message':_0x415e59[_0xa2c8('0x2c')]},client9002);return _0x4b8d57;}return null;})[_0xa2c8('0x23')](respondWithResult(_0x4599ab,null))[_0xa2c8('0x2e')](handleError(_0x4599ab,null));};exports[_0xa2c8('0x30')]=function(_0x15cd25,_0x87845b,_0x15887){if(_0x15cd25['body']['id']){delete _0x15cd25[_0xa2c8('0x5a')]['id'];}var _0x452218;return db[_0xa2c8('0x3f')][_0xa2c8('0x58')]({'where':{'id':_0x15cd25['params']['id']}})[_0xa2c8('0x23')](handleEntityNotFound(_0x87845b,null))[_0xa2c8('0x23')](function(_0x454344){if(_0x454344){_0x452218=_0x454344;return db['WhatsappAccount']['find']({'where':{'id':_0x454344[_0xa2c8('0x87')]}});}})['then'](handleEntityNotFound(_0x87845b,null))[_0xa2c8('0x23')](function(_0xc0e772){if(_0xc0e772){logger[_0xa2c8('0x27')](_0xa2c8('0x88'),'status',_0xa2c8('0x89'),_0xc0e772[_0xa2c8('0x8a')],util[_0xa2c8('0x8b')](_0x15cd25[_0xa2c8('0x5a')],{'showHidden':![],'depth':null}));switch(_0xc0e772[_0xa2c8('0x8a')]){case _0xa2c8('0x8c'):if(_0x15cd25[_0xa2c8('0x5a')][_0xa2c8('0x8d')]&&_0x15cd25['body'][_0xa2c8('0x8d')]===_0x452218[_0xa2c8('0x8e')]&&_0x15cd25['body'][_0xa2c8('0x8f')]&&_0x15cd25[_0xa2c8('0x5a')][_0xa2c8('0x8f')]===_0xa2c8('0x5d')){return _0x452218['update']({'read':!![]});}else{logger[_0xa2c8('0x2b')](_0xa2c8('0x90'),_0xa2c8('0x30'),'twilio',util['inspect'](_0x15cd25[_0xa2c8('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x452218;}})[_0xa2c8('0x23')](respondWithResult(_0x87845b,null))[_0xa2c8('0x2e')](handleError(_0x87845b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e2538b2..790955a 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 _0xea28=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xea28,0x13a));var _0x8ea2=function(_0x1852ee,_0x2249a0){_0x1852ee=_0x1852ee-0x0;var _0x149f9f=_0xea28[_0x1852ee];return _0x149f9f;};'use strict';var EventEmitter=require(_0x8ea2('0x0'));var WhatsappMessage=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8ea2('0x3')](0x0);var events={'afterCreate':_0x8ea2('0x4'),'afterUpdate':_0x8ea2('0x5'),'afterDestroy':_0x8ea2('0x6')};function emitEvent(_0x10f7bb){return function(_0x4b7cda,_0x9b45ab,_0x23aaf1){WhatsappMessageEvents[_0x8ea2('0x7')](_0x10f7bb+':'+_0x4b7cda['id'],_0x4b7cda);WhatsappMessageEvents['emit'](_0x10f7bb,_0x4b7cda);_0x23aaf1(null);};}for(var e in events){if(events[_0x8ea2('0x8')](e)){var event=events[e];WhatsappMessage[_0x8ea2('0x9')](e,emitEvent(event));}}module[_0x8ea2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xe5b5=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x128eb0,_0x480689){var _0x40824e=function(_0x2a6ac8){while(--_0x2a6ac8){_0x128eb0['push'](_0x128eb0['shift']());}};_0x40824e(++_0x480689);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0xe5b5[_0x316904];return _0xfa9a21;};'use strict';var EventEmitter=require(_0x5e5b('0x0'));var WhatsappMessage=require(_0x5e5b('0x1'))['db'][_0x5e5b('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x5e5b('0x3')](0x0);var events={'afterCreate':_0x5e5b('0x4'),'afterUpdate':_0x5e5b('0x5'),'afterDestroy':_0x5e5b('0x6')};function emitEvent(_0x3dc763){return function(_0xf20c6a,_0x20a50c,_0xdc6616){WhatsappMessageEvents[_0x5e5b('0x7')](_0x3dc763+':'+_0xf20c6a['id'],_0xf20c6a);WhatsappMessageEvents[_0x5e5b('0x7')](_0x3dc763,_0xf20c6a);_0xdc6616(null);};}for(var e in events){if(events[_0x5e5b('0x8')](e)){var event=events[e];WhatsappMessage[_0x5e5b('0x9')](e,emitEvent(event));}}module[_0x5e5b('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 7141c82..4c81e50 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 _0x3506=['sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','POST','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0x3506,0x86));var _0x6350=function(_0x376f7f,_0x4bff43){_0x376f7f=_0x376f7f-0x0;var _0x4fa4e4=_0x3506[_0x376f7f];return _0x4fa4e4;};'use strict';var _=require(_0x6350('0x0'));var util=require('util');var logger=require(_0x6350('0x1'))(_0x6350('0x2'));var moment=require(_0x6350('0x3'));var BPromise=require(_0x6350('0x4'));var rp=require(_0x6350('0x5'));var fetch=require(_0x6350('0x6'));var fs=require('fs');var path=require(_0x6350('0x7'));var rimraf=require(_0x6350('0x8'));var config=require(_0x6350('0x9'));var attributes=require(_0x6350('0xa'));module['exports']=function(_0x1cdad7,_0x1d46bb){return _0x1cdad7['define'](_0x6350('0xb'),attributes,{'tableName':_0x6350('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6350('0xd')]},{'name':_0x6350('0xe'),'fields':[_0x6350('0xf')],'type':_0x6350('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x233a95,_0x4eacd3,_0x26fb2d){var _0x170cb3=_0x1cdad7[_0x6350('0x11')];var _0x3e61a0=_0x233a95[_0x6350('0x12')]({'plain':!![]});if(_0x3e61a0[_0x6350('0x13')][_0x6350('0x14')]()==='in'||_0x3e61a0[_0x6350('0x13')][_0x6350('0x14')]()===_0x6350('0x15')&&!_0x3e61a0['secret']&&!_['isNil'](_0x3e61a0['UserId'])){_0x170cb3[_0x6350('0x16')][_0x6350('0x17')]({'where':{'id':_0x3e61a0[_0x6350('0x18')]}})[_0x6350('0x19')](function(_0xaaffa){if(_0xaaffa){_0xaaffa[_0x6350('0x1a')]({'lastMsgAt':_0x3e61a0['createdAt'],'lastMsgDirection':_0x3e61a0['direction'][_0x6350('0x14')]()});}})[_0x6350('0x1b')](function(_0x3f3b98){console[_0x6350('0x1c')](_0x3f3b98);});}if(_0x3e61a0['direction']===_0x6350('0x15')&&!_0x3e61a0['secret']){var _0x4aca39;_0x170cb3[_0x6350('0x1d')][_0x6350('0x1e')]({'where':{'id':_0x3e61a0[_0x6350('0x1f')]},'raw':!![]})[_0x6350('0x19')](function(_0x45a7fb){_0x4aca39=_0x45a7fb;if(_0x4aca39&&_0x4aca39['type']){switch(_0x4aca39[_0x6350('0x20')]){case _0x6350('0x21'):var _0x1a700c=require(_0x6350('0x21'));if(_0x4aca39[_0x6350('0x22')]&&_0x4aca39['authToken']&&_0x4aca39[_0x6350('0x23')]){var _0x8f76f6=new _0x1a700c(_0x4aca39[_0x6350('0x22')],_0x4aca39[_0x6350('0x24')]);_0x8f76f6[_0x6350('0x25')][_0x6350('0x26')]({'body':_0x3e61a0[_0x6350('0xf')],'to':'whatsapp:'+_0x3e61a0['phone'],'from':_0x6350('0x27')+_0x4aca39[_0x6350('0x23')],'statusCallback':_0x4aca39['remote']+_0x6350('0x28')+_0x3e61a0['id']+_0x6350('0x29')+_0x4aca39[_0x6350('0x2a')]})['then'](function(_0x17791e){if(_0x17791e[_0x6350('0x2b')]){return _0x233a95[_0x6350('0x1a')]({'messageId':_0x17791e[_0x6350('0x2b')]});}})['catch'](function(_0x42d619){logger[_0x6350('0x1c')](_0x6350('0x2c'),'afterCreate','twilio',util[_0x6350('0x2d')](_0x42d619,{'showHidden':![],'depth':null}));});}else{logger[_0x6350('0x1c')](_0x6350('0x2c'),_0x6350('0x2e'),_0x6350('0x21'),_0x6350('0x2f'));}break;case _0x6350('0x30'):var _0x2b1ec7=_0x4aca39[_0x6350('0x22')];var _0x3d9f0e=_0x4aca39[_0x6350('0x24')];var _0x986a56=_0x4aca39[_0x6350('0x31')]+'/whatsapp/v1/'+_0x2b1ec7+_0x6350('0x32');var _0x599cb1={'to':[_0x3e61a0['phone']],'message':{'type':'text','text':_0x3e61a0[_0x6350('0xf')]}};var _0x516d21={'method':_0x6350('0x33'),'uri':_0x986a56,'headers':{'Authorization':_0x6350('0x34')+_0x3d9f0e,'Content-Type':'application/json'},'body':_0x599cb1,'json':!![]};rp(_0x516d21)['then'](function(_0xe521e3){if(_0xe521e3[_0x6350('0x35')][0x0][_0x6350('0x36')]){return _0x233a95[_0x6350('0x1a')]({'messageId':_0xe521e3[_0x6350('0x35')][0x0][_0x6350('0x36')]});}})[_0x6350('0x1b')](function(_0x30cbaa){logger['err'](_0x6350('0x37'),_0x30cbaa);});break;}}})[_0x6350('0x38')](function(){_0x26fb2d();});}else{_0x26fb2d();}}},'charset':_0x6350('0x39'),'collate':_0x6350('0x3a')});}; \ No newline at end of file +var _0xe3be=['toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction'];(function(_0x52f740,_0x24ad23){var _0x319827=function(_0x40cfa3){while(--_0x40cfa3){_0x52f740['push'](_0x52f740['shift']());}};_0x319827(++_0x24ad23);}(_0xe3be,0x6b));var _0xee3b=function(_0x54a195,_0x106400){_0x54a195=_0x54a195-0x0;var _0x372bbb=_0xe3be[_0x54a195];return _0x372bbb;};'use strict';var _=require(_0xee3b('0x0'));var util=require(_0xee3b('0x1'));var logger=require(_0xee3b('0x2'))(_0xee3b('0x3'));var moment=require(_0xee3b('0x4'));var BPromise=require(_0xee3b('0x5'));var rp=require(_0xee3b('0x6'));var fetch=require(_0xee3b('0x7'));var fs=require('fs');var path=require(_0xee3b('0x8'));var rimraf=require('rimraf');var config=require(_0xee3b('0x9'));var attributes=require(_0xee3b('0xa'));module[_0xee3b('0xb')]=function(_0xcaeef2,_0xea4205){return _0xcaeef2[_0xee3b('0xc')]('WhatsappMessage',attributes,{'tableName':_0xee3b('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xee3b('0xe')]},{'name':_0xee3b('0xf'),'fields':[_0xee3b('0x10')],'type':_0xee3b('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x400610,_0x2fc6eb,_0x1be84d){var _0x11e532=_0xcaeef2[_0xee3b('0x12')];var _0x4ef3f0=_0x400610[_0xee3b('0x13')]({'plain':!![]});if(_0x4ef3f0[_0xee3b('0x14')]['toLowerCase']()==='in'||_0x4ef3f0[_0xee3b('0x14')][_0xee3b('0x15')]()===_0xee3b('0x16')&&!_0x4ef3f0[_0xee3b('0x17')]&&!_[_0xee3b('0x18')](_0x4ef3f0[_0xee3b('0x19')])){_0x11e532[_0xee3b('0x1a')][_0xee3b('0x1b')]({'where':{'id':_0x4ef3f0[_0xee3b('0x1c')]}})['then'](function(_0x178565){if(_0x178565){_0x178565[_0xee3b('0x1d')]({'lastMsgAt':_0x4ef3f0[_0xee3b('0x1e')],'lastMsgDirection':_0x4ef3f0[_0xee3b('0x14')][_0xee3b('0x15')]()});}})[_0xee3b('0x1f')](function(_0x12332d){console[_0xee3b('0x20')](_0x12332d);});}if(_0x4ef3f0[_0xee3b('0x14')]===_0xee3b('0x16')&&!_0x4ef3f0[_0xee3b('0x17')]){var _0x7a352b;_0x11e532[_0xee3b('0x21')][_0xee3b('0x22')]({'where':{'id':_0x4ef3f0[_0xee3b('0x23')]},'raw':!![]})[_0xee3b('0x24')](function(_0x2ba339){_0x7a352b=_0x2ba339;if(_0x7a352b&&_0x7a352b[_0xee3b('0x25')]){switch(_0x7a352b[_0xee3b('0x25')]){case'twilio':var _0x5535c4=require(_0xee3b('0x26'));if(_0x7a352b[_0xee3b('0x27')]&&_0x7a352b[_0xee3b('0x28')]&&_0x7a352b[_0xee3b('0x29')]){var _0x3a2e34=new _0x5535c4(_0x7a352b[_0xee3b('0x27')],_0x7a352b[_0xee3b('0x28')]);_0x3a2e34[_0xee3b('0x2a')][_0xee3b('0x2b')]({'body':_0x4ef3f0[_0xee3b('0x10')],'to':_0xee3b('0x2c')+_0x4ef3f0['phone'],'from':_0xee3b('0x2c')+_0x7a352b['phone'],'statusCallback':_0x7a352b[_0xee3b('0x2d')]+'/api/whatsapp/messages/'+_0x4ef3f0['id']+'/status?token='+_0x7a352b['token']})[_0xee3b('0x24')](function(_0x16741e){if(_0x16741e[_0xee3b('0x2e')]){return _0x400610[_0xee3b('0x1d')]({'messageId':_0x16741e[_0xee3b('0x2e')]});}})['catch'](function(_0x409a26){logger[_0xee3b('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xee3b('0x2f'),_0xee3b('0x26'),util[_0xee3b('0x30')](_0x409a26,{'showHidden':![],'depth':null}));});}else{logger[_0xee3b('0x20')](_0xee3b('0x31'),_0xee3b('0x2f'),_0xee3b('0x26'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xee3b('0x32'):var _0x36dad6=_0x7a352b[_0xee3b('0x27')];var _0x357c68=_0x7a352b['authToken'];var _0x36847b=_0x7a352b[_0xee3b('0x33')]+_0xee3b('0x34')+_0x36dad6+_0xee3b('0x35');var _0xf0ec73={'to':[_0x4ef3f0[_0xee3b('0x29')]],'message':{'type':_0xee3b('0x36'),'text':_0x4ef3f0['body']}};var _0x3c14d2={'method':_0xee3b('0x37'),'uri':_0x36847b,'headers':{'Authorization':_0xee3b('0x38')+_0x357c68,'Content-Type':_0xee3b('0x39')},'body':_0xf0ec73,'json':!![]};rp(_0x3c14d2)[_0xee3b('0x24')](function(_0x21bdfc){if(_0x21bdfc[_0xee3b('0x3a')][0x0][_0xee3b('0x3b')]){return _0x400610[_0xee3b('0x1d')]({'messageId':_0x21bdfc[_0xee3b('0x3a')][0x0]['message_id']});}})['catch'](function(_0x45e2be){logger[_0xee3b('0x3c')](_0xee3b('0x3d'),_0x45e2be);});break;}}})[_0xee3b('0x3e')](function(){_0x1be84d();});}else{_0x1be84d();}}},'charset':_0xee3b('0x3f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 26a4fbd..ea16cfe 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 _0x4016=['jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','WhatsappMessage,\x20%s,\x20%s','error','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x4016,0x184));var _0x6401=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4016[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x6401('0x0'));var util=require(_0x6401('0x1'));var moment=require(_0x6401('0x2'));var BPromise=require(_0x6401('0x3'));var rs=require(_0x6401('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6401('0x5'))['db'];var utils=require(_0x6401('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6401('0x7'));var jayson=require(_0x6401('0x8'));var client=jayson[_0x6401('0x9')]['http']({'port':0x232a});config['redis']=_[_0x6401('0xa')](config[_0x6401('0xb')],{'host':_0x6401('0xc'),'port':0x18eb});var socket=require(_0x6401('0xd'))(new Redis(config[_0x6401('0xb')]));require(_0x6401('0xe'))[_0x6401('0xf')](socket);function respondWithRpcPromise(_0x59356c,_0x3ab340,_0x45d87b){return new BPromise(function(_0x33b3e6,_0x3eec8c){return client['request'](_0x59356c,_0x45d87b)['then'](function(_0x17c619){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3ab340,_0x6401('0x10'));logger[_0x6401('0x11')](_0x6401('0x12'),_0x3ab340,_0x6401('0x10'),JSON[_0x6401('0x13')](_0x17c619));if(_0x17c619['error']){if(_0x17c619['error'][_0x6401('0x14')]===0x1f4){logger['error'](_0x6401('0x15'),_0x3ab340,_0x17c619[_0x6401('0x16')][_0x6401('0x17')]);return _0x3eec8c(_0x17c619[_0x6401('0x16')][_0x6401('0x17')]);}logger[_0x6401('0x16')](_0x6401('0x15'),_0x3ab340,_0x17c619[_0x6401('0x16')][_0x6401('0x17')]);return _0x33b3e6(_0x17c619[_0x6401('0x16')][_0x6401('0x17')]);}else{logger[_0x6401('0x18')](_0x6401('0x15'),_0x3ab340,_0x6401('0x10'));_0x33b3e6(_0x17c619['result']['message']);}})[_0x6401('0x19')](function(_0x5520bf){logger[_0x6401('0x16')](_0x6401('0x15'),_0x3ab340,_0x5520bf);_0x3eec8c(_0x5520bf);});});}exports[_0x6401('0x1a')]=function(_0x42e9e0){var _0x2b7e37=this;return new Promise(function(_0x22cd42,_0x22d565){return db[_0x6401('0x1b')][_0x6401('0x1c')](_0x42e9e0[_0x6401('0x1d')],{'raw':_0x42e9e0['options']?_0x42e9e0[_0x6401('0x1e')][_0x6401('0x1f')]===undefined?!![]:![]:!![]})[_0x6401('0x20')](function(_0x4a03dd){logger['info'](_0x6401('0x1a'),_0x42e9e0);logger[_0x6401('0x11')](_0x6401('0x1a'),_0x42e9e0,JSON['stringify'](_0x4a03dd));_0x22cd42(_0x4a03dd);})[_0x6401('0x19')](function(_0x2980b5){logger['error']('CreateWhatsappMessage',_0x2980b5[_0x6401('0x17')],_0x42e9e0);_0x22d565(_0x2b7e37[_0x6401('0x16')](0x1f4,_0x2980b5[_0x6401('0x17')]));});});}; \ No newline at end of file +var _0x791a=['message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','request\x20sent','debug','error','code','WhatsappMessage,\x20%s,\x20%s'];(function(_0x5045c0,_0x47c87c){var _0x1c892f=function(_0x3b59a5){while(--_0x3b59a5){_0x5045c0['push'](_0x5045c0['shift']());}};_0x1c892f(++_0x47c87c);}(_0x791a,0x1e5));var _0xa791=function(_0x3936dd,_0x28a5dd){_0x3936dd=_0x3936dd-0x0;var _0x2f1021=_0x791a[_0x3936dd];return _0x2f1021;};'use strict';var _=require('lodash');var util=require(_0xa791('0x0'));var moment=require(_0xa791('0x1'));var BPromise=require(_0xa791('0x2'));var rs=require(_0xa791('0x3'));var fs=require('fs');var Redis=require(_0xa791('0x4'));var db=require(_0xa791('0x5'))['db'];var utils=require(_0xa791('0x6'));var logger=require(_0xa791('0x7'))(_0xa791('0x8'));var config=require(_0xa791('0x9'));var jayson=require(_0xa791('0xa'));var client=jayson['client'][_0xa791('0xb')]({'port':0x232a});config['redis']=_[_0xa791('0xc')](config[_0xa791('0xd')],{'host':_0xa791('0xe'),'port':0x18eb});var socket=require(_0xa791('0xf'))(new Redis(config[_0xa791('0xd')]));require(_0xa791('0x10'))[_0xa791('0x11')](socket);function respondWithRpcPromise(_0x293703,_0xeae9a1,_0x4192e8){return new BPromise(function(_0x133b12,_0x5347b5){return client['request'](_0x293703,_0x4192e8)[_0xa791('0x12')](function(_0x3328c0){logger[_0xa791('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0xeae9a1,_0xa791('0x14'));logger[_0xa791('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xeae9a1,_0xa791('0x14'),JSON['stringify'](_0x3328c0));if(_0x3328c0[_0xa791('0x16')]){if(_0x3328c0['error'][_0xa791('0x17')]===0x1f4){logger['error'](_0xa791('0x18'),_0xeae9a1,_0x3328c0['error'][_0xa791('0x19')]);return _0x5347b5(_0x3328c0[_0xa791('0x16')]['message']);}logger[_0xa791('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0xeae9a1,_0x3328c0[_0xa791('0x16')][_0xa791('0x19')]);return _0x133b12(_0x3328c0[_0xa791('0x16')][_0xa791('0x19')]);}else{logger[_0xa791('0x13')](_0xa791('0x18'),_0xeae9a1,_0xa791('0x14'));_0x133b12(_0x3328c0[_0xa791('0x1a')]['message']);}})[_0xa791('0x1b')](function(_0x17f666){logger[_0xa791('0x16')](_0xa791('0x18'),_0xeae9a1,_0x17f666);_0x5347b5(_0x17f666);});});}exports[_0xa791('0x1c')]=function(_0x4e94c3){var _0xe645e9=this;return new Promise(function(_0x5af045,_0x52d685){return db[_0xa791('0x1d')][_0xa791('0x1e')](_0x4e94c3['body'],{'raw':_0x4e94c3[_0xa791('0x1f')]?_0x4e94c3['options'][_0xa791('0x20')]===undefined?!![]:![]:!![]})[_0xa791('0x12')](function(_0x567064){logger[_0xa791('0x13')](_0xa791('0x1c'),_0x4e94c3);logger[_0xa791('0x15')]('CreateWhatsappMessage',_0x4e94c3,JSON[_0xa791('0x21')](_0x567064));_0x5af045(_0x567064);})[_0xa791('0x1b')](function(_0x96f80d){logger[_0xa791('0x16')](_0xa791('0x1c'),_0x96f80d['message'],_0x4e94c3);_0x52d685(_0xe645e9[_0xa791('0x16')](0x1f4,_0x96f80d[_0xa791('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6d3abca..0104b11 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 _0x5ac3=['update','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x5d1f6f,_0x120955){var _0x281d2b=function(_0x28edc8){while(--_0x28edc8){_0x5d1f6f['push'](_0x5d1f6f['shift']());}};_0x281d2b(++_0x120955);}(_0x5ac3,0x1b0));var _0x35ac=function(_0x434fbb,_0x3f9342){_0x434fbb=_0x434fbb-0x0;var _0x444cf0=_0x5ac3[_0x434fbb];return _0x444cf0;};'use strict';var WhatsappMessageEvents=require(_0x35ac('0x0'));var events=[_0x35ac('0x1'),'remove',_0x35ac('0x2')];function createListener(_0x4a79b6,_0x1afd45){return function(_0x5df1b9){_0x1afd45['emit'](_0x4a79b6,_0x5df1b9);};}function removeListener(_0x23a135,_0x53c0a6){return function(){WhatsappMessageEvents[_0x35ac('0x3')](_0x23a135,_0x53c0a6);};}exports[_0x35ac('0x4')]=function(_0x1b4366){for(var _0x1f026f=0x0,_0x48db20=events[_0x35ac('0x5')];_0x1f026f<_0x48db20;_0x1f026f++){var _0x3a036a=events[_0x1f026f];var _0x29439c=createListener(_0x35ac('0x6')+_0x3a036a,_0x1b4366);WhatsappMessageEvents['on'](_0x3a036a,_0x29439c);}}; \ No newline at end of file +var _0xbc0d=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x35f4f6,_0x29131d){var _0x516d9f=function(_0x281f97){while(--_0x281f97){_0x35f4f6['push'](_0x35f4f6['shift']());}};_0x516d9f(++_0x29131d);}(_0xbc0d,0x15d));var _0xdbc0=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xbc0d[_0xbd08b4];return _0x314f1e;};'use strict';var WhatsappMessageEvents=require(_0xdbc0('0x0'));var events=[_0xdbc0('0x1'),_0xdbc0('0x2'),'update'];function createListener(_0x5df0d7,_0x4b47dd){return function(_0x42414e){_0x4b47dd[_0xdbc0('0x3')](_0x5df0d7,_0x42414e);};}function removeListener(_0x51e664,_0x388011){return function(){WhatsappMessageEvents[_0xdbc0('0x4')](_0x51e664,_0x388011);};}exports[_0xdbc0('0x5')]=function(_0x319e66){for(var _0x2ac7cb=0x0,_0x50c9e7=events[_0xdbc0('0x6')];_0x2ac7cb<_0x50c9e7;_0x2ac7cb++){var _0x34976f=events[_0x2ac7cb];var _0x5589c5=createListener(_0xdbc0('0x7')+_0x34976f,_0x319e66);WhatsappMessageEvents['on'](_0x34976f,_0x5589c5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 94ad5f3..0b341df 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 _0xda60=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','delete','destroy','removeTeams','multer','util','path'];(function(_0x55219a,_0x164725){var _0x45ecba=function(_0x2dc7ae){while(--_0x2dc7ae){_0x55219a['push'](_0x55219a['shift']());}};_0x45ecba(++_0x164725);}(_0xda60,0x69));var _0x0da6=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xda60[_0x5a2285];return _0x48f6ed;};'use strict';var multer=require(_0x0da6('0x0'));var util=require(_0x0da6('0x1'));var path=require(_0x0da6('0x2'));var timeout=require(_0x0da6('0x3'));var express=require(_0x0da6('0x4'));var router=express['Router']();var fs_extra=require(_0x0da6('0x5'));var auth=require(_0x0da6('0x6'));var interaction=require(_0x0da6('0x7'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x0da6('0x8')]('/',auth[_0x0da6('0x9')](),controller[_0x0da6('0xa')]);router['get']('/describe',auth[_0x0da6('0x9')](),controller[_0x0da6('0xb')]);router[_0x0da6('0x8')](_0x0da6('0xc'),auth[_0x0da6('0x9')](),controller[_0x0da6('0xd')]);router['get'](_0x0da6('0xe'),auth[_0x0da6('0x9')](),controller[_0x0da6('0xf')]);router[_0x0da6('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0da6('0x10')]);router[_0x0da6('0x8')]('/:id/users',auth[_0x0da6('0x9')](),controller[_0x0da6('0x11')]);router[_0x0da6('0x12')]('/',auth[_0x0da6('0x9')](),controller[_0x0da6('0x13')]);router['post'](_0x0da6('0x14'),auth[_0x0da6('0x9')](),controller[_0x0da6('0x15')]);router[_0x0da6('0x12')](_0x0da6('0x16'),auth[_0x0da6('0x9')](),controller[_0x0da6('0x17')]);router['put'](_0x0da6('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0da6('0x18')](_0x0da6('0xc'),auth['isAuthenticated'](),controller[_0x0da6('0x19')]);router['delete'](_0x0da6('0x14'),auth['isAuthenticated'](),controller[_0x0da6('0x1a')]);router[_0x0da6('0x18')](_0x0da6('0x16'),auth[_0x0da6('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9f46=['destroy','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../config/environment','./whatsappQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete'];(function(_0x15248e,_0x279106){var _0x127e68=function(_0x134237){while(--_0x134237){_0x15248e['push'](_0x15248e['shift']());}};_0x127e68(++_0x279106);}(_0x9f46,0xcf));var _0x69f4=function(_0x3ec510,_0x196121){_0x3ec510=_0x3ec510-0x0;var _0x30a8f7=_0x9f46[_0x3ec510];return _0x30a8f7;};'use strict';var multer=require(_0x69f4('0x0'));var util=require(_0x69f4('0x1'));var path=require(_0x69f4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x69f4('0x3')]();var fs_extra=require(_0x69f4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x69f4('0x5'));var controller=require(_0x69f4('0x6'));router[_0x69f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x69f4('0x8')]);router['get'](_0x69f4('0x9'),auth['isAuthenticated'](),controller[_0x69f4('0xa')]);router['get'](_0x69f4('0xb'),auth[_0x69f4('0xc')](),controller[_0x69f4('0xd')]);router[_0x69f4('0x7')](_0x69f4('0xe'),auth['isAuthenticated'](),controller[_0x69f4('0xf')]);router[_0x69f4('0x7')]('/:id/teams',auth[_0x69f4('0xc')](),controller[_0x69f4('0x10')]);router[_0x69f4('0x7')](_0x69f4('0x11'),auth[_0x69f4('0xc')](),controller[_0x69f4('0x12')]);router[_0x69f4('0x13')]('/',auth[_0x69f4('0xc')](),controller[_0x69f4('0x14')]);router[_0x69f4('0x13')](_0x69f4('0x15'),auth[_0x69f4('0xc')](),controller[_0x69f4('0x16')]);router[_0x69f4('0x13')](_0x69f4('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x69f4('0xc')](),controller[_0x69f4('0x17')]);router[_0x69f4('0x18')]('/:id',auth[_0x69f4('0xc')](),controller[_0x69f4('0x19')]);router[_0x69f4('0x18')](_0x69f4('0x15'),auth[_0x69f4('0xc')](),controller[_0x69f4('0x1a')]);router['delete'](_0x69f4('0x11'),auth[_0x69f4('0xc')](),controller[_0x69f4('0x1b')]);module[_0x69f4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 98233e1..e76f356 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 _0xbe02=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xbe02,0x146));var _0x2be0=function(_0x12d96f,_0xdf73b2){_0x12d96f=_0x12d96f-0x0;var _0x1dc4d5=_0xbe02[_0x12d96f];return _0x1dc4d5;};'use strict';var Sequelize=require(_0x2be0('0x0'));module[_0x2be0('0x1')]={'name':{'type':Sequelize[_0x2be0('0x2')],'unique':_0x2be0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2be0('0x4')](_0x2be0('0x5'),_0x2be0('0x6'),_0x2be0('0x7'))},'description':{'type':Sequelize[_0x2be0('0x2')]}}; \ No newline at end of file +var _0xffaa=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','ENUM'];(function(_0x19b9f5,_0x2ff200){var _0x89c067=function(_0x523a93){while(--_0x523a93){_0x19b9f5['push'](_0x19b9f5['shift']());}};_0x89c067(++_0x2ff200);}(_0xffaa,0x130));var _0xaffa=function(_0x17d71a,_0x1b01be){_0x17d71a=_0x17d71a-0x0;var _0x58c55c=_0xffaa[_0x17d71a];return _0x58c55c;};'use strict';var Sequelize=require(_0xaffa('0x0'));module[_0xaffa('0x1')]={'name':{'type':Sequelize[_0xaffa('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaffa('0x3')](_0xaffa('0x4'),_0xaffa('0x5'),_0xaffa('0x6'))},'description':{'type':Sequelize[_0xaffa('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5e2fc63..784a161 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 _0x39c1=['offset','undefined','Content-Range','update','then','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','getOptions','where','count','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','autoAssociation','find','destroy','describe','getMembers','UserWhatsappQueue','hasOwnProperty','nolimit','limit','order','sort','WhatsappQueueId','filter','map','findAndCountAll','UserId','whatsappPause','format','SIP','updatedAt','findOne','Team','pick','addTeams','ids','Agents','online','interface','sequelize','each','forEach','select','field','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','compact','value','transaction','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','User','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','sendStatus','status','end','json'];(function(_0x49cbb9,_0x1c995e){var _0x3fe136=function(_0x3e4a1c){while(--_0x3e4a1c){_0x49cbb9['push'](_0x49cbb9['shift']());}};_0x3fe136(++_0x1c995e);}(_0x39c1,0x148));var _0x139c=function(_0x20de57,_0x15a692){_0x20de57=_0x20de57-0x0;var _0x2b7920=_0x39c1[_0x20de57];return _0x2b7920;};'use strict';var BPromise=require(_0x139c('0x0'));var util=require('util');var _=require(_0x139c('0x1'));var squel=require(_0x139c('0x2'));var Redis=require(_0x139c('0x3'));var qs=require(_0x139c('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x139c('0x5'))['db'];config['redis']=_[_0x139c('0x6')](config[_0x139c('0x7')],{'host':_0x139c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x139c('0x7')]));require(_0x139c('0x9'))['register'](socket);function respondWithStatusCode(_0x40f9a0,_0x498971){_0x498971=_0x498971||0xcc;return function(_0x194586){if(_0x194586){return _0x40f9a0[_0x139c('0xa')](_0x498971);}return _0x40f9a0[_0x139c('0xb')](_0x498971)[_0x139c('0xc')]();};}function respondWithResult(_0x2bc6bd,_0x52d279){_0x52d279=_0x52d279||0xc8;return function(_0x4c500a){if(_0x4c500a){return _0x2bc6bd[_0x139c('0xb')](_0x52d279)[_0x139c('0xd')](_0x4c500a);}};}function respondWithFilteredResult(_0x5c3450,_0x2ce857){return function(_0x292aef){if(_0x292aef){var _0x2451f7=typeof _0x2ce857[_0x139c('0xe')]==='undefined'&&typeof _0x2ce857['limit']===_0x139c('0xf');var _0x23d0f1=_0x292aef['count'];var _0x308e92=_0x2451f7?0x0:_0x2ce857[_0x139c('0xe')];var _0x4a75aa=_0x2451f7?_0x292aef['count']:_0x2ce857[_0x139c('0xe')]+_0x2ce857['limit'];var _0x2e5531;if(_0x4a75aa>=_0x23d0f1){_0x4a75aa=_0x23d0f1;_0x2e5531=0xc8;}else{_0x2e5531=0xce;}_0x5c3450[_0x139c('0xb')](_0x2e5531);return _0x5c3450['set'](_0x139c('0x10'),_0x308e92+'-'+_0x4a75aa+'/'+_0x23d0f1)[_0x139c('0xd')](_0x292aef);}return null;};}function saveUpdates(_0x172a57){return function(_0x46a8cd){if(_0x46a8cd){return _0x46a8cd[_0x139c('0x11')](_0x172a57)[_0x139c('0x12')](function(_0x335671){return _0x335671;});}return null;};}function removeEntity(_0x2d0fff){return function(_0x1c0ab8){if(_0x1c0ab8){return _0x1c0ab8['destroy']()[_0x139c('0x12')](function(){var _0x2ce400=_0x1c0ab8['get']({'plain':!![]});var _0x4031f4='WhatsappQueues';return db[_0x139c('0x13')]['destroy']({'where':{'type':_0x4031f4,'resourceId':_0x2ce400['id']}})['then'](function(){return _0x1c0ab8;});})['then'](function(){_0x2d0fff[_0x139c('0xb')](0xcc)[_0x139c('0xc')]();});}};}function handleEntityNotFound(_0x447c20){return function(_0x291485){if(!_0x291485){_0x447c20[_0x139c('0xa')](0x194);}return _0x291485;};}function handleError(_0x2baad4,_0x5d8df7){_0x5d8df7=_0x5d8df7||0x1f4;return function(_0x5a6636){logger[_0x139c('0x14')](_0x5a6636[_0x139c('0x15')]);if(_0x5a6636[_0x139c('0x16')]){delete _0x5a6636['name'];}_0x2baad4['status'](_0x5d8df7)[_0x139c('0x17')](_0x5a6636);};}exports[_0x139c('0x18')]=function(_0x1c0dbd,_0x21eeaf){var _0x3b6180={};var _0x36d627={'count':0x0,'rows':[]};var _0x107401=_['map'](db[_0x139c('0x19')][_0x139c('0x1a')],function(_0x380c91){return{'name':_0x380c91['fieldName'],'type':_0x380c91[_0x139c('0x1b')][_0x139c('0x1c')]};});_0x3b6180=qs[_0x139c('0x1d')](_0x107401,_0x1c0dbd);var _0x4a411a={'where':_0x3b6180[_0x139c('0x1e')]};return db[_0x139c('0x19')][_0x139c('0x1f')](_0x4a411a)['then'](function(_0x4ec450){_0x36d627[_0x139c('0x1f')]=_0x4ec450;_0x3b6180[_0x139c('0x20')]=qs['include'](_0x1c0dbd[_0x139c('0x21')]);return db['WhatsappQueue'][_0x139c('0x22')](_0x3b6180);})[_0x139c('0x12')](function(_0x125172){_0x36d627[_0x139c('0x23')]=_0x125172;return _0x36d627;})['then'](respondWithFilteredResult(_0x21eeaf,_0x3b6180))[_0x139c('0x24')](handleError(_0x21eeaf,null));};exports[_0x139c('0x25')]=function(_0x5d4037,_0x4d467e){var _0x50c412={'raw':!![],'where':{'id':_0x5d4037[_0x139c('0x26')]['id']}},_0x3350a9={};_0x3350a9[_0x139c('0x27')]=_[_0x139c('0x28')](db[_0x139c('0x19')][_0x139c('0x1a')]);_0x3350a9['query']=_[_0x139c('0x28')](_0x5d4037[_0x139c('0x21')]);_0x3350a9[_0x139c('0x29')]=_[_0x139c('0x2a')](_0x3350a9[_0x139c('0x27')],_0x3350a9[_0x139c('0x21')]);_0x50c412[_0x139c('0x2b')]=_[_0x139c('0x2a')](_0x3350a9[_0x139c('0x27')],qs[_0x139c('0x2c')](_0x5d4037[_0x139c('0x21')]['fields']));_0x50c412[_0x139c('0x2b')]=_0x50c412['attributes'][_0x139c('0x2d')]?_0x50c412[_0x139c('0x2b')]:_0x3350a9[_0x139c('0x27')];if(_0x5d4037['query'][_0x139c('0x2e')]){_0x50c412[_0x139c('0x20')]=[{'all':!![]}];}_0x50c412=_[_0x139c('0x2f')]({},_0x50c412,_0x5d4037[_0x139c('0x30')]);return db[_0x139c('0x19')]['find'](_0x50c412)['then'](handleEntityNotFound(_0x4d467e,null))[_0x139c('0x12')](respondWithResult(_0x4d467e,null))[_0x139c('0x24')](handleError(_0x4d467e,null));};exports[_0x139c('0x31')]=function(_0x32abe0,_0x2d75c4){return db[_0x139c('0x19')]['create'](_0x32abe0[_0x139c('0x32')],{})[_0x139c('0x12')](function(_0x2a7e66){var _0x28960c=_0x32abe0[_0x139c('0x33')][_0x139c('0x34')]({'plain':!![]});if(!_0x28960c)throw new Error(_0x139c('0x35'));if(_0x28960c[_0x139c('0x36')]==='user'){var _0x491d04=_0x2a7e66[_0x139c('0x34')]({'plain':!![]});var _0x5e8561=_0x139c('0x37');return db[_0x139c('0x38')]['find']({'where':{'name':_0x5e8561,'userProfileId':_0x28960c['userProfileId']},'raw':!![]})[_0x139c('0x12')](function(_0x37e6f3){if(_0x37e6f3&&_0x37e6f3[_0x139c('0x39')]===0x0){return db['UserProfileResource'][_0x139c('0x31')]({'name':_0x491d04[_0x139c('0x16')],'resourceId':_0x491d04['id'],'type':_0x37e6f3[_0x139c('0x16')],'sectionId':_0x37e6f3['id']},{})[_0x139c('0x12')](function(){return _0x2a7e66;});}else{return _0x2a7e66;}})[_0x139c('0x24')](function(_0x308795){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x308795);throw _0x308795;});}return _0x2a7e66;})[_0x139c('0x12')](respondWithResult(_0x2d75c4,0xc9))[_0x139c('0x24')](handleError(_0x2d75c4,null));};exports[_0x139c('0x11')]=function(_0x10d1b1,_0x305238){if(_0x10d1b1[_0x139c('0x32')]['id']){delete _0x10d1b1[_0x139c('0x32')]['id'];}return db[_0x139c('0x19')][_0x139c('0x3a')]({'where':{'id':_0x10d1b1['params']['id']}})[_0x139c('0x12')](handleEntityNotFound(_0x305238,null))[_0x139c('0x12')](saveUpdates(_0x10d1b1['body'],null))[_0x139c('0x12')](respondWithResult(_0x305238,null))['catch'](handleError(_0x305238,null));};exports[_0x139c('0x3b')]=function(_0x478ac2,_0x23d57f){return db['WhatsappQueue'][_0x139c('0x3a')]({'where':{'id':_0x478ac2[_0x139c('0x26')]['id']}})['then'](handleEntityNotFound(_0x23d57f,null))[_0x139c('0x12')](removeEntity(_0x23d57f,null))[_0x139c('0x24')](handleError(_0x23d57f,null));};exports[_0x139c('0x3c')]=function(_0x220957,_0x4223f0){return db[_0x139c('0x19')]['describe']()[_0x139c('0x12')](respondWithResult(_0x4223f0,null))[_0x139c('0x24')](handleError(_0x4223f0,null));};exports[_0x139c('0x3d')]=function(_0x4d6c3f,_0x3b4d24){var _0x5cd34a={'raw':!![],'where':{}},_0x391877={},_0x1f5db5;return db[_0x139c('0x19')]['findOne']({'where':{'id':_0x4d6c3f['params']['id']}})['then'](handleEntityNotFound(_0x3b4d24,null))['then'](function(_0x3d03c5){if(_0x3d03c5){_0x1f5db5=_0x3d03c5[_0x139c('0x34')]({'plain':!![]});_0x391877[_0x139c('0x27')]=_[_0x139c('0x28')](db[_0x139c('0x3e')][_0x139c('0x1a')]);_0x391877[_0x139c('0x21')]=_[_0x139c('0x28')](_0x4d6c3f[_0x139c('0x21')]);_0x391877[_0x139c('0x29')]=_[_0x139c('0x2a')](_0x391877['model'],_0x391877[_0x139c('0x21')]);_0x5cd34a[_0x139c('0x2b')]=_[_0x139c('0x2a')](_0x391877[_0x139c('0x27')],qs[_0x139c('0x2c')](_0x4d6c3f[_0x139c('0x21')]['fields']));_0x5cd34a[_0x139c('0x2b')]=_0x5cd34a[_0x139c('0x2b')]['length']?_0x5cd34a[_0x139c('0x2b')]:_0x391877['model'];if(!_0x4d6c3f[_0x139c('0x21')][_0x139c('0x3f')](_0x139c('0x40'))){_0x5cd34a[_0x139c('0x41')]=qs[_0x139c('0x41')](_0x4d6c3f[_0x139c('0x21')][_0x139c('0x41')]);_0x5cd34a[_0x139c('0xe')]=qs[_0x139c('0xe')](_0x4d6c3f[_0x139c('0x21')]['offset']);}_0x5cd34a[_0x139c('0x42')]=qs[_0x139c('0x43')](_0x4d6c3f[_0x139c('0x21')][_0x139c('0x43')]);_0x5cd34a[_0x139c('0x1e')]=qs['filters'](_['pick'](_0x4d6c3f[_0x139c('0x21')],_0x391877[_0x139c('0x29')]));_0x5cd34a[_0x139c('0x1e')][_0x139c('0x44')]=_0x3d03c5['id'];if(_0x4d6c3f['query'][_0x139c('0x45')]){_0x5cd34a['where']=_[_0x139c('0x2f')](_0x5cd34a[_0x139c('0x1e')],{'$or':_[_0x139c('0x46')](_0x5cd34a[_0x139c('0x2b')],function(_0x30d4ed){var _0x3a6bd2={};_0x3a6bd2[_0x30d4ed]={'$like':'%'+_0x4d6c3f['query'][_0x139c('0x45')]+'%'};return _0x3a6bd2;})});}_0x5cd34a=_[_0x139c('0x2f')]({},_0x5cd34a,_0x4d6c3f[_0x139c('0x30')]);return db[_0x139c('0x3e')]['findAll'](_0x5cd34a);}})[_0x139c('0x12')](function(_0x5ef99e){if(_0x5ef99e){return db['User'][_0x139c('0x47')]({'where':{'id':_['map'](_0x5ef99e,_0x139c('0x48')),'role':'agent'},'attributes':['id',_0x139c('0x16'),_0x139c('0x49'),'updatedAt','createdAt']});}})[_0x139c('0x12')](function(_0x203010){if(_0x203010){return{'count':_0x203010[_0x139c('0x1f')],'rows':_[_0x139c('0x46')](_0x203010['rows'],function(_0x1c70d1){return{'membername':_0x1c70d1[_0x139c('0x16')],'UserId':_0x1c70d1['id'],'queue_name':_0x1f5db5[_0x139c('0x16')],'WhatsappQueueId':_0x1f5db5['id'],'interface':util[_0x139c('0x4a')]('%s/%s',_0x139c('0x4b'),_0x1c70d1[_0x139c('0x16')]),'penalty':0x0,'paused':_0x1c70d1[_0x139c('0x49')],'createdAt':_0x1c70d1['createdAt'],'updatedAt':_0x1c70d1[_0x139c('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x139c('0x12')](respondWithFilteredResult(_0x3b4d24,_0x5cd34a))[_0x139c('0x24')](handleError(_0x3b4d24,null));};exports['getTeams']=function(_0x555cd5,_0x292374){var _0x47447a={};var _0xb2dba1={};var _0x534383;var _0x1a851f;return db[_0x139c('0x19')][_0x139c('0x4d')]({'where':{'id':_0x555cd5['params']['id']}})['then'](handleEntityNotFound(_0x292374,null))[_0x139c('0x12')](function(_0xfc884e){if(_0xfc884e){_0x534383=_0xfc884e;_0xb2dba1[_0x139c('0x27')]=_[_0x139c('0x28')](db[_0x139c('0x4e')][_0x139c('0x1a')]);_0xb2dba1[_0x139c('0x21')]=_[_0x139c('0x28')](_0x555cd5['query']);_0xb2dba1[_0x139c('0x29')]=_[_0x139c('0x2a')](_0xb2dba1['model'],_0xb2dba1[_0x139c('0x21')]);_0x47447a['attributes']=_['intersection'](_0xb2dba1['model'],qs[_0x139c('0x2c')](_0x555cd5[_0x139c('0x21')]['fields']));_0x47447a[_0x139c('0x2b')]=_0x47447a['attributes'][_0x139c('0x2d')]?_0x47447a['attributes']:_0xb2dba1[_0x139c('0x27')];_0x47447a[_0x139c('0x42')]=qs['sort'](_0x555cd5[_0x139c('0x21')][_0x139c('0x43')]);_0x47447a[_0x139c('0x1e')]=qs['filters'](_[_0x139c('0x4f')](_0x555cd5['query'],_0xb2dba1[_0x139c('0x29')]));if(_0x555cd5[_0x139c('0x21')][_0x139c('0x45')]){_0x47447a[_0x139c('0x1e')]=_[_0x139c('0x2f')](_0x47447a[_0x139c('0x1e')],{'$or':_[_0x139c('0x46')](_0x47447a[_0x139c('0x2b')],function(_0x58b399){var _0x35cf78={};_0x35cf78[_0x58b399]={'$like':'%'+_0x555cd5[_0x139c('0x21')][_0x139c('0x45')]+'%'};return _0x35cf78;})});}_0x47447a=_[_0x139c('0x2f')]({},_0x47447a,_0x555cd5['options']);return _0x534383['getTeams'](_0x47447a);}})['then'](function(_0x3e9113){if(_0x3e9113){_0x1a851f=_0x3e9113[_0x139c('0x2d')];if(!_0x555cd5[_0x139c('0x21')][_0x139c('0x3f')]('nolimit')){_0x47447a[_0x139c('0x41')]=qs[_0x139c('0x41')](_0x555cd5[_0x139c('0x21')][_0x139c('0x41')]);_0x47447a['offset']=qs[_0x139c('0xe')](_0x555cd5[_0x139c('0x21')][_0x139c('0xe')]);}return _0x534383['getTeams'](_0x47447a);}})[_0x139c('0x12')](function(_0x2a05af){if(_0x2a05af){return _0x2a05af?{'count':_0x1a851f,'rows':_0x2a05af}:null;}})[_0x139c('0x12')](respondWithResult(_0x292374,null))[_0x139c('0x24')](handleError(_0x292374,null));};exports[_0x139c('0x50')]=function(_0x2465cc,_0x4daa60){var _0x5a45f8=_0x2465cc[_0x139c('0x32')][_0x139c('0x51')];return db[_0x139c('0x4e')][_0x139c('0x22')]({'where':{'id':_0x5a45f8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x139c('0x52'),'attributes':['id',_0x139c('0x16'),_0x139c('0x53'),'voicePause',_0x139c('0x54')],'raw':!![]}]})[_0x139c('0x12')](function(_0x4a173e){if(_0x4a173e){var _0x4e8a75=_['flatMap'](_0x4a173e,function(_0x3de004){var _0xbbf5f2=_0x3de004['get']({'plain':!![]});return _0xbbf5f2[_0x139c('0x52')];});return db[_0x139c('0x19')]['find']({'where':{'id':_0x2465cc['params']['id']}})[_0x139c('0x12')](function(_0x315776){return db[_0x139c('0x55')]['transaction'](function(_0x41e0c1){return _0x315776[_0x139c('0x50')](_0x5a45f8,{'transaction':_0x41e0c1})[_0x139c('0x12')](function(){return BPromise[_0x139c('0x56')](_0x4e8a75,function(_0x517049){return db[_0x139c('0x3e')]['findOrCreate']({'where':{'UserId':_0x517049['id'],'WhatsappQueueId':_0x2465cc['params']['id']},'transaction':_0x41e0c1});});})[_0x139c('0x12')](function(){_0x4e8a75[_0x139c('0x57')](function(_0x4ed711){socket['emit']('userWhatsappQueue:save',{'UserId':_0x4ed711['id'],'WhatsappQueueId':_0x315776['id']});});});});});}})['then'](respondWithStatusCode(_0x4daa60,null))[_0x139c('0x24')](handleError(_0x4daa60,null));};exports['removeTeams']=function(_0x5057ad,_0x58f18b){return db['Team']['findAll']({'where':{'id':_0x5057ad['query'][_0x139c('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x139c('0x52'),'attributes':['id'],'raw':!![]}]})[_0x139c('0x12')](handleEntityNotFound(_0x58f18b,null))[_0x139c('0x12')](function(_0x50a940){var _0x5b86a0=_[_0x139c('0x46')](_0x50a940,'id');var _0x365e23=[];var _0x4fa500=[];var _0x2cf2f4=squel[_0x139c('0x58')]();_0x2cf2f4[_0x139c('0x59')]('tq.TeamId')[_0x139c('0x5a')](_0x139c('0x5b'),'tq')[_0x139c('0x5c')]('user_has_teams','ut',_0x139c('0x5d'))['where'](_0x139c('0x5e'),_0x5057ad[_0x139c('0x26')]['id']);for(var _0x419186=0x0;_0x419186<_0x50a940[_0x139c('0x2d')];_0x419186+=0x1){let _0x579ce5=_0x50a940[_0x419186];for(var _0x204179=0x0;_0x204179<_0x579ce5[_0x139c('0x52')][_0x139c('0x2d')];_0x204179+=0x1){let _0x5cabf5=_0x579ce5[_0x139c('0x52')][_0x204179];var _0x33ccff=_0x2cf2f4['clone']();_0x33ccff[_0x139c('0x1e')](_0x139c('0x5f'),_0x5cabf5['id']);_0x4fa500[_0x139c('0x60')](db['sequelize'][_0x139c('0x21')](_0x33ccff[_0x139c('0x61')](),{'type':db[_0x139c('0x55')]['QueryTypes'][_0x139c('0x62')]})[_0x139c('0x12')](function(_0x4c189a){if(_0x4c189a[_0x139c('0x2d')]===0x1){return _0x5cabf5['id'];}else{var _0x48e03a=_[_0x139c('0x63')](_[_0x139c('0x46')](_0x4c189a,_0x139c('0x64')),function(_0x529ea6){return _['includes'](_0x5b86a0,_0x529ea6);});if(_0x48e03a){return _0x5cabf5['id'];}}}));}}return BPromise['all'](_0x4fa500)[_0x139c('0x12')](function(_0x10b002){_0x365e23=_(_0x365e23)['union'](_0x10b002)[_0x139c('0x65')]()[_0x139c('0x66')]();return db[_0x139c('0x19')][_0x139c('0x3a')]({'where':{'id':_0x5057ad[_0x139c('0x26')]['id']}})['then'](function(_0x12a5f7){return db['sequelize'][_0x139c('0x67')](function(_0x17e162){return _0x12a5f7[_0x139c('0x68')](_0x5057ad[_0x139c('0x21')][_0x139c('0x51')],{'transaction':_0x17e162})[_0x139c('0x12')](function(){if(!_[_0x139c('0x69')](_0x365e23)){return _0x12a5f7[_0x139c('0x6a')](_0x365e23,{'transaction':_0x17e162});}})[_0x139c('0x12')](function(){_0x365e23['forEach'](function(_0x5c85f2){socket[_0x139c('0x6b')](_0x139c('0x6c'),{'UserId':_0x5c85f2,'WhatsappQueueId':_0x12a5f7['id']});});});});});});})[_0x139c('0x12')](respondWithStatusCode(_0x58f18b,null))[_0x139c('0x24')](handleError(_0x58f18b,null));};exports[_0x139c('0x6d')]=function(_0x43e5d9,_0x16c836){return db['WhatsappQueue'][_0x139c('0x3a')]({'where':{'id':_0x43e5d9['params']['id']}})['then'](handleEntityNotFound(_0x16c836,null))[_0x139c('0x12')](function(_0x8c84ae){if(_0x8c84ae){return _0x8c84ae[_0x139c('0x6d')](_0x43e5d9[_0x139c('0x32')][_0x139c('0x51')],_['omit'](_0x43e5d9[_0x139c('0x32')],[_0x139c('0x51'),'id'])||{})[_0x139c('0x6e')](function(_0x3e760c){for(var _0x50d92a=0x0;_0x50d92a<_0x43e5d9[_0x139c('0x32')][_0x139c('0x51')][_0x139c('0x2d')];_0x50d92a+=0x1){socket[_0x139c('0x6b')]('userWhatsappQueue:save',{'UserId':Number(_0x43e5d9['body'][_0x139c('0x51')][_0x50d92a]),'WhatsappQueueId':Number(_0x43e5d9[_0x139c('0x26')]['id'])});}return _0x3e760c;});}})[_0x139c('0x12')](respondWithResult(_0x16c836,null))[_0x139c('0x24')](handleError(_0x16c836,null));};exports['removeAgents']=function(_0x5c711a,_0x2a22c3){return db[_0x139c('0x19')]['find']({'where':{'id':_0x5c711a['params']['id']}})[_0x139c('0x12')](handleEntityNotFound(_0x2a22c3,null))['then'](function(_0x68ce6b){if(_0x68ce6b){return _0x68ce6b[_0x139c('0x6a')](_0x5c711a[_0x139c('0x21')][_0x139c('0x51')])[_0x139c('0x12')](function(){if(_[_0x139c('0x6f')](_0x5c711a[_0x139c('0x21')][_0x139c('0x51')])){for(var _0x1a2f2e=0x0;_0x1a2f2e<_0x5c711a['query'][_0x139c('0x51')][_0x139c('0x2d')];_0x1a2f2e+=0x1){socket['emit'](_0x139c('0x6c'),{'UserId':Number(_0x5c711a[_0x139c('0x21')]['ids'][_0x1a2f2e]),'WhatsappQueueId':Number(_0x5c711a[_0x139c('0x26')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x5c711a[_0x139c('0x21')][_0x139c('0x51')]),'WhatsappQueueId':Number(_0x5c711a[_0x139c('0x26')]['id'])});}});}})[_0x139c('0x12')](respondWithStatusCode(_0x2a22c3,null))[_0x139c('0x24')](handleError(_0x2a22c3,null));};exports[_0x139c('0x70')]=function(_0x1363cf,_0x37906d){var _0x41406c={};var _0x2d2229={};var _0x972c7d;var _0x275278;return db[_0x139c('0x19')][_0x139c('0x4d')]({'where':{'id':_0x1363cf[_0x139c('0x26')]['id']}})[_0x139c('0x12')](handleEntityNotFound(_0x37906d,null))['then'](function(_0x570c58){if(_0x570c58){_0x972c7d=_0x570c58;_0x2d2229['model']=_[_0x139c('0x28')](db[_0x139c('0x71')][_0x139c('0x1a')]);_0x2d2229[_0x139c('0x21')]=_[_0x139c('0x28')](_0x1363cf[_0x139c('0x21')]);_0x2d2229['filters']=_['intersection'](_0x2d2229[_0x139c('0x27')],_0x2d2229[_0x139c('0x21')]);_0x41406c[_0x139c('0x2b')]=_[_0x139c('0x2a')](_0x2d2229[_0x139c('0x27')],qs['fields'](_0x1363cf[_0x139c('0x21')][_0x139c('0x2c')]));_0x41406c['attributes']=_0x41406c[_0x139c('0x2b')][_0x139c('0x2d')]?_0x41406c[_0x139c('0x2b')]:_0x2d2229[_0x139c('0x27')];_0x41406c[_0x139c('0x42')]=qs[_0x139c('0x43')](_0x1363cf[_0x139c('0x21')][_0x139c('0x43')]);_0x41406c['where']=qs[_0x139c('0x29')](_[_0x139c('0x4f')](_0x1363cf[_0x139c('0x21')],_0x2d2229['filters']));if(_0x1363cf[_0x139c('0x21')][_0x139c('0x45')]){_0x41406c[_0x139c('0x1e')]=_[_0x139c('0x2f')](_0x41406c['where'],{'$or':_[_0x139c('0x46')](_0x41406c['attributes'],function(_0x28b1ac){var _0x1f1268={};_0x1f1268[_0x28b1ac]={'$like':'%'+_0x1363cf['query'][_0x139c('0x45')]+'%'};return _0x1f1268;})});}_0x41406c=_['merge']({},_0x41406c,_0x1363cf['options']);return _0x972c7d[_0x139c('0x70')](_0x41406c);}})[_0x139c('0x12')](function(_0x33198d){if(_0x33198d){_0x275278=_0x33198d['length'];if(!_0x1363cf[_0x139c('0x21')]['hasOwnProperty'](_0x139c('0x40'))){_0x41406c[_0x139c('0x41')]=qs[_0x139c('0x41')](_0x1363cf[_0x139c('0x21')][_0x139c('0x41')]);_0x41406c['offset']=qs[_0x139c('0xe')](_0x1363cf['query']['offset']);}return _0x972c7d[_0x139c('0x70')](_0x41406c);}})[_0x139c('0x12')](function(_0x4ea8b0){if(_0x4ea8b0){return _0x4ea8b0?{'count':_0x275278,'rows':_0x4ea8b0}:null;}})[_0x139c('0x12')](respondWithResult(_0x37906d,null))[_0x139c('0x24')](handleError(_0x37906d,null));}; \ No newline at end of file +var _0xc298=['./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','key','getOptions','include','findAll','rows','catch','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','UserWhatsappQueue','hasOwnProperty','order','sort','where','WhatsappQueueId','filter','merge','UserId','agent','whatsappPause','createdAt','format','SIP','updatedAt','getTeams','Team','nolimit','addTeams','ids','User','Agents','online','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x36f258,_0xc0f029){var _0x56c047=function(_0x6cb165){while(--_0x6cb165){_0x36f258['push'](_0x36f258['shift']());}};_0x56c047(++_0xc0f029);}(_0xc298,0x160));var _0x8c29=function(_0x10a5a7,_0x241ba8){_0x10a5a7=_0x10a5a7-0x0;var _0x402f69=_0xc298[_0x10a5a7];return _0x402f69;};'use strict';var BPromise=require(_0x8c29('0x0'));var util=require('util');var _=require(_0x8c29('0x1'));var squel=require(_0x8c29('0x2'));var Redis=require(_0x8c29('0x3'));var qs=require(_0x8c29('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x8c29('0x5'));var db=require(_0x8c29('0x6'))['db'];config[_0x8c29('0x7')]=_[_0x8c29('0x8')](config[_0x8c29('0x7')],{'host':_0x8c29('0x9'),'port':0x18eb});var socket=require(_0x8c29('0xa'))(new Redis(config['redis']));require(_0x8c29('0xb'))['register'](socket);function respondWithStatusCode(_0x5118ab,_0x489f7a){_0x489f7a=_0x489f7a||0xcc;return function(_0xb6b019){if(_0xb6b019){return _0x5118ab[_0x8c29('0xc')](_0x489f7a);}return _0x5118ab[_0x8c29('0xd')](_0x489f7a)[_0x8c29('0xe')]();};}function respondWithResult(_0x291a16,_0x255ebc){_0x255ebc=_0x255ebc||0xc8;return function(_0x2a036d){if(_0x2a036d){return _0x291a16[_0x8c29('0xd')](_0x255ebc)[_0x8c29('0xf')](_0x2a036d);}};}function respondWithFilteredResult(_0x39733c,_0x457327){return function(_0x5a9237){if(_0x5a9237){var _0x419459=typeof _0x457327[_0x8c29('0x10')]===_0x8c29('0x11')&&typeof _0x457327[_0x8c29('0x12')]===_0x8c29('0x11');var _0x108000=_0x5a9237['count'];var _0x440959=_0x419459?0x0:_0x457327[_0x8c29('0x10')];var _0x3bd75f=_0x419459?_0x5a9237[_0x8c29('0x13')]:_0x457327['offset']+_0x457327[_0x8c29('0x12')];var _0x1724c5;if(_0x3bd75f>=_0x108000){_0x3bd75f=_0x108000;_0x1724c5=0xc8;}else{_0x1724c5=0xce;}_0x39733c[_0x8c29('0xd')](_0x1724c5);return _0x39733c[_0x8c29('0x14')](_0x8c29('0x15'),_0x440959+'-'+_0x3bd75f+'/'+_0x108000)[_0x8c29('0xf')](_0x5a9237);}return null;};}function saveUpdates(_0x355e9d){return function(_0x3fa660){if(_0x3fa660){return _0x3fa660[_0x8c29('0x16')](_0x355e9d)[_0x8c29('0x17')](function(_0x4a59fc){return _0x4a59fc;});}return null;};}function removeEntity(_0x5c0a27){return function(_0x39c14b){if(_0x39c14b){return _0x39c14b['destroy']()[_0x8c29('0x17')](function(){var _0xa28bac=_0x39c14b[_0x8c29('0x18')]({'plain':!![]});var _0xec225d=_0x8c29('0x19');return db[_0x8c29('0x1a')][_0x8c29('0x1b')]({'where':{'type':_0xec225d,'resourceId':_0xa28bac['id']}})[_0x8c29('0x17')](function(){return _0x39c14b;});})[_0x8c29('0x17')](function(){_0x5c0a27[_0x8c29('0xd')](0xcc)[_0x8c29('0xe')]();});}};}function handleEntityNotFound(_0x42a4fc){return function(_0x2ebf3a){if(!_0x2ebf3a){_0x42a4fc[_0x8c29('0xc')](0x194);}return _0x2ebf3a;};}function handleError(_0x150c3f,_0x13a445){_0x13a445=_0x13a445||0x1f4;return function(_0x371daf){logger[_0x8c29('0x1c')](_0x371daf[_0x8c29('0x1d')]);if(_0x371daf[_0x8c29('0x1e')]){delete _0x371daf[_0x8c29('0x1e')];}_0x150c3f['status'](_0x13a445)[_0x8c29('0x1f')](_0x371daf);};}exports[_0x8c29('0x20')]=function(_0x5daffd,_0x281c77){var _0xb7017e={};var _0x3aaa19={'count':0x0,'rows':[]};var _0x10324f=_[_0x8c29('0x21')](db[_0x8c29('0x22')]['rawAttributes'],function(_0x3da7e0){return{'name':_0x3da7e0['fieldName'],'type':_0x3da7e0['type'][_0x8c29('0x23')]};});_0xb7017e=qs[_0x8c29('0x24')](_0x10324f,_0x5daffd);var _0xf153d={'where':_0xb7017e['where']};return db[_0x8c29('0x22')][_0x8c29('0x13')](_0xf153d)[_0x8c29('0x17')](function(_0x196ccc){_0x3aaa19['count']=_0x196ccc;_0xb7017e[_0x8c29('0x25')]=qs[_0x8c29('0x25')](_0x5daffd['query']);return db['WhatsappQueue'][_0x8c29('0x26')](_0xb7017e);})[_0x8c29('0x17')](function(_0x175a7f){_0x3aaa19[_0x8c29('0x27')]=_0x175a7f;return _0x3aaa19;})[_0x8c29('0x17')](respondWithFilteredResult(_0x281c77,_0xb7017e))[_0x8c29('0x28')](handleError(_0x281c77,null));};exports['show']=function(_0x5b853b,_0x310a1c){var _0x26ab8f={'raw':!![],'where':{'id':_0x5b853b[_0x8c29('0x29')]['id']}},_0x332f18={};_0x332f18['model']=_[_0x8c29('0x2a')](db['WhatsappQueue'][_0x8c29('0x2b')]);_0x332f18[_0x8c29('0x2c')]=_['keys'](_0x5b853b[_0x8c29('0x2c')]);_0x332f18[_0x8c29('0x2d')]=_[_0x8c29('0x2e')](_0x332f18[_0x8c29('0x2f')],_0x332f18[_0x8c29('0x2c')]);_0x26ab8f['attributes']=_[_0x8c29('0x2e')](_0x332f18[_0x8c29('0x2f')],qs[_0x8c29('0x30')](_0x5b853b[_0x8c29('0x2c')][_0x8c29('0x30')]));_0x26ab8f[_0x8c29('0x31')]=_0x26ab8f['attributes'][_0x8c29('0x32')]?_0x26ab8f['attributes']:_0x332f18[_0x8c29('0x2f')];if(_0x5b853b[_0x8c29('0x2c')][_0x8c29('0x33')]){_0x26ab8f['include']=[{'all':!![]}];}_0x26ab8f=_['merge']({},_0x26ab8f,_0x5b853b[_0x8c29('0x34')]);return db[_0x8c29('0x22')]['find'](_0x26ab8f)[_0x8c29('0x17')](handleEntityNotFound(_0x310a1c,null))['then'](respondWithResult(_0x310a1c,null))['catch'](handleError(_0x310a1c,null));};exports[_0x8c29('0x35')]=function(_0x2f2ca3,_0x8e38b6){return db[_0x8c29('0x22')][_0x8c29('0x35')](_0x2f2ca3['body'],{})[_0x8c29('0x17')](function(_0x297129){var _0x4f507f=_0x2f2ca3[_0x8c29('0x36')]['get']({'plain':!![]});if(!_0x4f507f)throw new Error(_0x8c29('0x37'));if(_0x4f507f[_0x8c29('0x38')]==='user'){var _0xf725fd=_0x297129[_0x8c29('0x18')]({'plain':!![]});var _0x4cdfbb='WhatsappQueues';return db[_0x8c29('0x39')][_0x8c29('0x3a')]({'where':{'name':_0x4cdfbb,'userProfileId':_0x4f507f[_0x8c29('0x3b')]},'raw':!![]})[_0x8c29('0x17')](function(_0xf668d1){if(_0xf668d1&&_0xf668d1[_0x8c29('0x3c')]===0x0){return db[_0x8c29('0x1a')][_0x8c29('0x35')]({'name':_0xf725fd[_0x8c29('0x1e')],'resourceId':_0xf725fd['id'],'type':_0xf668d1[_0x8c29('0x1e')],'sectionId':_0xf668d1['id']},{})['then'](function(){return _0x297129;});}else{return _0x297129;}})['catch'](function(_0x2922a8){logger['error'](_0x8c29('0x3d'),_0x2922a8);throw _0x2922a8;});}return _0x297129;})[_0x8c29('0x17')](respondWithResult(_0x8e38b6,0xc9))[_0x8c29('0x28')](handleError(_0x8e38b6,null));};exports[_0x8c29('0x16')]=function(_0x3e85da,_0x3697e0){if(_0x3e85da[_0x8c29('0x3e')]['id']){delete _0x3e85da[_0x8c29('0x3e')]['id'];}return db[_0x8c29('0x22')][_0x8c29('0x3a')]({'where':{'id':_0x3e85da[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](handleEntityNotFound(_0x3697e0,null))[_0x8c29('0x17')](saveUpdates(_0x3e85da[_0x8c29('0x3e')],null))[_0x8c29('0x17')](respondWithResult(_0x3697e0,null))['catch'](handleError(_0x3697e0,null));};exports[_0x8c29('0x1b')]=function(_0xa73f96,_0x3b23fa){return db[_0x8c29('0x22')][_0x8c29('0x3a')]({'where':{'id':_0xa73f96[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](handleEntityNotFound(_0x3b23fa,null))[_0x8c29('0x17')](removeEntity(_0x3b23fa,null))[_0x8c29('0x28')](handleError(_0x3b23fa,null));};exports['describe']=function(_0x4b77e6,_0x18b7b1){return db[_0x8c29('0x22')]['describe']()[_0x8c29('0x17')](respondWithResult(_0x18b7b1,null))[_0x8c29('0x28')](handleError(_0x18b7b1,null));};exports['getMembers']=function(_0x2445e2,_0x1d5040){var _0x48076f={'raw':!![],'where':{}},_0x42d682={},_0xee9bc6;return db[_0x8c29('0x22')]['findOne']({'where':{'id':_0x2445e2[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](handleEntityNotFound(_0x1d5040,null))['then'](function(_0x3a54f3){if(_0x3a54f3){_0xee9bc6=_0x3a54f3['get']({'plain':!![]});_0x42d682['model']=_['keys'](db[_0x8c29('0x3f')][_0x8c29('0x2b')]);_0x42d682[_0x8c29('0x2c')]=_[_0x8c29('0x2a')](_0x2445e2[_0x8c29('0x2c')]);_0x42d682[_0x8c29('0x2d')]=_[_0x8c29('0x2e')](_0x42d682[_0x8c29('0x2f')],_0x42d682[_0x8c29('0x2c')]);_0x48076f[_0x8c29('0x31')]=_[_0x8c29('0x2e')](_0x42d682[_0x8c29('0x2f')],qs[_0x8c29('0x30')](_0x2445e2['query'][_0x8c29('0x30')]));_0x48076f[_0x8c29('0x31')]=_0x48076f[_0x8c29('0x31')][_0x8c29('0x32')]?_0x48076f[_0x8c29('0x31')]:_0x42d682[_0x8c29('0x2f')];if(!_0x2445e2[_0x8c29('0x2c')][_0x8c29('0x40')]('nolimit')){_0x48076f['limit']=qs[_0x8c29('0x12')](_0x2445e2['query'][_0x8c29('0x12')]);_0x48076f[_0x8c29('0x10')]=qs[_0x8c29('0x10')](_0x2445e2[_0x8c29('0x2c')][_0x8c29('0x10')]);}_0x48076f[_0x8c29('0x41')]=qs[_0x8c29('0x42')](_0x2445e2['query']['sort']);_0x48076f[_0x8c29('0x43')]=qs[_0x8c29('0x2d')](_['pick'](_0x2445e2['query'],_0x42d682[_0x8c29('0x2d')]));_0x48076f['where'][_0x8c29('0x44')]=_0x3a54f3['id'];if(_0x2445e2[_0x8c29('0x2c')][_0x8c29('0x45')]){_0x48076f['where']=_['merge'](_0x48076f[_0x8c29('0x43')],{'$or':_['map'](_0x48076f[_0x8c29('0x31')],function(_0x44456a){var _0x1c8eae={};_0x1c8eae[_0x44456a]={'$like':'%'+_0x2445e2[_0x8c29('0x2c')][_0x8c29('0x45')]+'%'};return _0x1c8eae;})});}_0x48076f=_[_0x8c29('0x46')]({},_0x48076f,_0x2445e2['options']);return db[_0x8c29('0x3f')]['findAll'](_0x48076f);}})[_0x8c29('0x17')](function(_0x460251){if(_0x460251){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x460251,_0x8c29('0x47')),'role':_0x8c29('0x48')},'attributes':['id',_0x8c29('0x1e'),_0x8c29('0x49'),'updatedAt',_0x8c29('0x4a')]});}})[_0x8c29('0x17')](function(_0x2b74a3){if(_0x2b74a3){return{'count':_0x2b74a3[_0x8c29('0x13')],'rows':_[_0x8c29('0x21')](_0x2b74a3[_0x8c29('0x27')],function(_0x5b63b9){return{'membername':_0x5b63b9[_0x8c29('0x1e')],'UserId':_0x5b63b9['id'],'queue_name':_0xee9bc6[_0x8c29('0x1e')],'WhatsappQueueId':_0xee9bc6['id'],'interface':util[_0x8c29('0x4b')]('%s/%s',_0x8c29('0x4c'),_0x5b63b9[_0x8c29('0x1e')]),'penalty':0x0,'paused':_0x5b63b9[_0x8c29('0x49')],'createdAt':_0x5b63b9[_0x8c29('0x4a')],'updatedAt':_0x5b63b9[_0x8c29('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d5040,_0x48076f))[_0x8c29('0x28')](handleError(_0x1d5040,null));};exports[_0x8c29('0x4e')]=function(_0x167e18,_0x3c528e){var _0x407584={};var _0x17a7dd={};var _0x4f95bf;var _0x485dd5;return db[_0x8c29('0x22')]['findOne']({'where':{'id':_0x167e18[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](handleEntityNotFound(_0x3c528e,null))[_0x8c29('0x17')](function(_0x5cc416){if(_0x5cc416){_0x4f95bf=_0x5cc416;_0x17a7dd[_0x8c29('0x2f')]=_['keys'](db[_0x8c29('0x4f')][_0x8c29('0x2b')]);_0x17a7dd['query']=_['keys'](_0x167e18[_0x8c29('0x2c')]);_0x17a7dd[_0x8c29('0x2d')]=_[_0x8c29('0x2e')](_0x17a7dd[_0x8c29('0x2f')],_0x17a7dd[_0x8c29('0x2c')]);_0x407584['attributes']=_[_0x8c29('0x2e')](_0x17a7dd[_0x8c29('0x2f')],qs[_0x8c29('0x30')](_0x167e18['query']['fields']));_0x407584[_0x8c29('0x31')]=_0x407584[_0x8c29('0x31')][_0x8c29('0x32')]?_0x407584[_0x8c29('0x31')]:_0x17a7dd[_0x8c29('0x2f')];_0x407584[_0x8c29('0x41')]=qs[_0x8c29('0x42')](_0x167e18['query'][_0x8c29('0x42')]);_0x407584['where']=qs[_0x8c29('0x2d')](_['pick'](_0x167e18[_0x8c29('0x2c')],_0x17a7dd['filters']));if(_0x167e18['query'][_0x8c29('0x45')]){_0x407584['where']=_[_0x8c29('0x46')](_0x407584[_0x8c29('0x43')],{'$or':_['map'](_0x407584[_0x8c29('0x31')],function(_0x4164dc){var _0x58afbc={};_0x58afbc[_0x4164dc]={'$like':'%'+_0x167e18[_0x8c29('0x2c')][_0x8c29('0x45')]+'%'};return _0x58afbc;})});}_0x407584=_[_0x8c29('0x46')]({},_0x407584,_0x167e18['options']);return _0x4f95bf[_0x8c29('0x4e')](_0x407584);}})['then'](function(_0x31294e){if(_0x31294e){_0x485dd5=_0x31294e[_0x8c29('0x32')];if(!_0x167e18[_0x8c29('0x2c')][_0x8c29('0x40')](_0x8c29('0x50'))){_0x407584['limit']=qs[_0x8c29('0x12')](_0x167e18[_0x8c29('0x2c')][_0x8c29('0x12')]);_0x407584[_0x8c29('0x10')]=qs[_0x8c29('0x10')](_0x167e18[_0x8c29('0x2c')][_0x8c29('0x10')]);}return _0x4f95bf[_0x8c29('0x4e')](_0x407584);}})[_0x8c29('0x17')](function(_0x5ee346){if(_0x5ee346){return _0x5ee346?{'count':_0x485dd5,'rows':_0x5ee346}:null;}})[_0x8c29('0x17')](respondWithResult(_0x3c528e,null))['catch'](handleError(_0x3c528e,null));};exports[_0x8c29('0x51')]=function(_0x185ead,_0x2ba7cf){var _0xb18c89=_0x185ead['body'][_0x8c29('0x52')];return db[_0x8c29('0x4f')][_0x8c29('0x26')]({'where':{'id':_0xb18c89},'attributes':['id'],'include':[{'model':db[_0x8c29('0x53')],'as':_0x8c29('0x54'),'attributes':['id',_0x8c29('0x1e'),_0x8c29('0x55'),'voicePause','interface'],'raw':!![]}]})[_0x8c29('0x17')](function(_0x537bd9){if(_0x537bd9){var _0x1d56d4=_['flatMap'](_0x537bd9,function(_0x4b41b9){var _0x4bf37a=_0x4b41b9['get']({'plain':!![]});return _0x4bf37a[_0x8c29('0x54')];});return db[_0x8c29('0x22')][_0x8c29('0x3a')]({'where':{'id':_0x185ead['params']['id']}})[_0x8c29('0x17')](function(_0x5d5b5d){return db[_0x8c29('0x56')]['transaction'](function(_0x5da93e){return _0x5d5b5d[_0x8c29('0x51')](_0xb18c89,{'transaction':_0x5da93e})['then'](function(){return BPromise[_0x8c29('0x57')](_0x1d56d4,function(_0x5895b3){return db[_0x8c29('0x3f')][_0x8c29('0x58')]({'where':{'UserId':_0x5895b3['id'],'WhatsappQueueId':_0x185ead['params']['id']},'transaction':_0x5da93e});});})[_0x8c29('0x17')](function(){_0x1d56d4[_0x8c29('0x59')](function(_0xd51310){socket[_0x8c29('0x5a')](_0x8c29('0x5b'),{'UserId':_0xd51310['id'],'WhatsappQueueId':_0x5d5b5d['id']});});});});});}})[_0x8c29('0x17')](respondWithStatusCode(_0x2ba7cf,null))[_0x8c29('0x28')](handleError(_0x2ba7cf,null));};exports[_0x8c29('0x5c')]=function(_0x2daf27,_0x523b45){return db[_0x8c29('0x4f')][_0x8c29('0x26')]({'where':{'id':_0x2daf27[_0x8c29('0x2c')][_0x8c29('0x52')]},'attributes':['id'],'include':[{'model':db[_0x8c29('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8c29('0x17')](handleEntityNotFound(_0x523b45,null))[_0x8c29('0x17')](function(_0x35e3c1){var _0x425d30=_[_0x8c29('0x21')](_0x35e3c1,'id');var _0x422324=[];var _0x2c43d4=[];var _0x1c788a=squel[_0x8c29('0x5d')]();_0x1c788a['field']('tq.TeamId')['from'](_0x8c29('0x5e'),'tq')[_0x8c29('0x5f')](_0x8c29('0x60'),'ut',_0x8c29('0x61'))['where'](_0x8c29('0x62'),_0x2daf27['params']['id']);for(var _0x18f6ca=0x0;_0x18f6ca<_0x35e3c1['length'];_0x18f6ca+=0x1){let _0x373f59=_0x35e3c1[_0x18f6ca];for(var _0x42b6ae=0x0;_0x42b6ae<_0x373f59[_0x8c29('0x54')][_0x8c29('0x32')];_0x42b6ae+=0x1){let _0x3a0631=_0x373f59[_0x8c29('0x54')][_0x42b6ae];var _0x593c18=_0x1c788a[_0x8c29('0x63')]();_0x593c18[_0x8c29('0x43')](_0x8c29('0x64'),_0x3a0631['id']);_0x2c43d4[_0x8c29('0x65')](db[_0x8c29('0x56')][_0x8c29('0x2c')](_0x593c18[_0x8c29('0x66')](),{'type':db[_0x8c29('0x56')][_0x8c29('0x67')][_0x8c29('0x68')]})['then'](function(_0xe0839a){if(_0xe0839a['length']===0x1){return _0x3a0631['id'];}else{var _0x289eab=_[_0x8c29('0x69')](_['map'](_0xe0839a,_0x8c29('0x6a')),function(_0x28d06b){return _[_0x8c29('0x6b')](_0x425d30,_0x28d06b);});if(_0x289eab){return _0x3a0631['id'];}}}));}}return BPromise[_0x8c29('0x6c')](_0x2c43d4)[_0x8c29('0x17')](function(_0x49ccff){_0x422324=_(_0x422324)[_0x8c29('0x6d')](_0x49ccff)[_0x8c29('0x6e')]()[_0x8c29('0x6f')]();return db[_0x8c29('0x22')][_0x8c29('0x3a')]({'where':{'id':_0x2daf27[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](function(_0xa21898){return db[_0x8c29('0x56')]['transaction'](function(_0x52f167){return _0xa21898[_0x8c29('0x5c')](_0x2daf27[_0x8c29('0x2c')]['ids'],{'transaction':_0x52f167})[_0x8c29('0x17')](function(){if(!_[_0x8c29('0x70')](_0x422324)){return _0xa21898[_0x8c29('0x71')](_0x422324,{'transaction':_0x52f167});}})[_0x8c29('0x17')](function(){_0x422324['forEach'](function(_0x27c79e){socket['emit'](_0x8c29('0x72'),{'UserId':_0x27c79e,'WhatsappQueueId':_0xa21898['id']});});});});});});})[_0x8c29('0x17')](respondWithStatusCode(_0x523b45,null))[_0x8c29('0x28')](handleError(_0x523b45,null));};exports[_0x8c29('0x73')]=function(_0x25036f,_0x23e98a){return db[_0x8c29('0x22')][_0x8c29('0x3a')]({'where':{'id':_0x25036f[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](handleEntityNotFound(_0x23e98a,null))[_0x8c29('0x17')](function(_0x2b6c3e){if(_0x2b6c3e){return _0x2b6c3e['addAgents'](_0x25036f[_0x8c29('0x3e')][_0x8c29('0x52')],_[_0x8c29('0x74')](_0x25036f[_0x8c29('0x3e')],[_0x8c29('0x52'),'id'])||{})[_0x8c29('0x75')](function(_0x18e6a7){for(var _0x3b3a25=0x0;_0x3b3a25<_0x25036f['body'][_0x8c29('0x52')]['length'];_0x3b3a25+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x25036f['body'][_0x8c29('0x52')][_0x3b3a25]),'WhatsappQueueId':Number(_0x25036f[_0x8c29('0x29')]['id'])});}return _0x18e6a7;});}})[_0x8c29('0x17')](respondWithResult(_0x23e98a,null))[_0x8c29('0x28')](handleError(_0x23e98a,null));};exports[_0x8c29('0x71')]=function(_0x2f9369,_0x495620){return db[_0x8c29('0x22')][_0x8c29('0x3a')]({'where':{'id':_0x2f9369[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](handleEntityNotFound(_0x495620,null))[_0x8c29('0x17')](function(_0x5d4dbb){if(_0x5d4dbb){return _0x5d4dbb[_0x8c29('0x71')](_0x2f9369[_0x8c29('0x2c')]['ids'])[_0x8c29('0x17')](function(){if(_[_0x8c29('0x76')](_0x2f9369[_0x8c29('0x2c')][_0x8c29('0x52')])){for(var _0x369d28=0x0;_0x369d28<_0x2f9369[_0x8c29('0x2c')]['ids'][_0x8c29('0x32')];_0x369d28+=0x1){socket[_0x8c29('0x5a')](_0x8c29('0x72'),{'UserId':Number(_0x2f9369[_0x8c29('0x2c')][_0x8c29('0x52')][_0x369d28]),'WhatsappQueueId':Number(_0x2f9369['params']['id'])});}}else{socket[_0x8c29('0x5a')]('userWhatsappQueue:remove',{'UserId':Number(_0x2f9369[_0x8c29('0x2c')][_0x8c29('0x52')]),'WhatsappQueueId':Number(_0x2f9369['params']['id'])});}});}})['then'](respondWithStatusCode(_0x495620,null))[_0x8c29('0x28')](handleError(_0x495620,null));};exports[_0x8c29('0x77')]=function(_0x3005c4,_0x49c780){var _0x8c8ab7={};var _0x339813={};var _0x4bb594;var _0x17a04b;return db[_0x8c29('0x22')][_0x8c29('0x78')]({'where':{'id':_0x3005c4[_0x8c29('0x29')]['id']}})[_0x8c29('0x17')](handleEntityNotFound(_0x49c780,null))['then'](function(_0x15d13f){if(_0x15d13f){_0x4bb594=_0x15d13f;_0x339813[_0x8c29('0x2f')]=_[_0x8c29('0x2a')](db[_0x8c29('0x53')]['rawAttributes']);_0x339813[_0x8c29('0x2c')]=_[_0x8c29('0x2a')](_0x3005c4['query']);_0x339813[_0x8c29('0x2d')]=_[_0x8c29('0x2e')](_0x339813['model'],_0x339813['query']);_0x8c8ab7['attributes']=_['intersection'](_0x339813[_0x8c29('0x2f')],qs['fields'](_0x3005c4[_0x8c29('0x2c')][_0x8c29('0x30')]));_0x8c8ab7[_0x8c29('0x31')]=_0x8c8ab7['attributes'][_0x8c29('0x32')]?_0x8c8ab7[_0x8c29('0x31')]:_0x339813[_0x8c29('0x2f')];_0x8c8ab7[_0x8c29('0x41')]=qs[_0x8c29('0x42')](_0x3005c4[_0x8c29('0x2c')][_0x8c29('0x42')]);_0x8c8ab7[_0x8c29('0x43')]=qs[_0x8c29('0x2d')](_['pick'](_0x3005c4[_0x8c29('0x2c')],_0x339813['filters']));if(_0x3005c4[_0x8c29('0x2c')][_0x8c29('0x45')]){_0x8c8ab7[_0x8c29('0x43')]=_[_0x8c29('0x46')](_0x8c8ab7['where'],{'$or':_[_0x8c29('0x21')](_0x8c8ab7['attributes'],function(_0x3ad18a){var _0x113b0c={};_0x113b0c[_0x3ad18a]={'$like':'%'+_0x3005c4[_0x8c29('0x2c')]['filter']+'%'};return _0x113b0c;})});}_0x8c8ab7=_[_0x8c29('0x46')]({},_0x8c8ab7,_0x3005c4[_0x8c29('0x34')]);return _0x4bb594[_0x8c29('0x77')](_0x8c8ab7);}})[_0x8c29('0x17')](function(_0x3a1292){if(_0x3a1292){_0x17a04b=_0x3a1292[_0x8c29('0x32')];if(!_0x3005c4[_0x8c29('0x2c')][_0x8c29('0x40')](_0x8c29('0x50'))){_0x8c8ab7[_0x8c29('0x12')]=qs['limit'](_0x3005c4['query'][_0x8c29('0x12')]);_0x8c8ab7['offset']=qs['offset'](_0x3005c4['query'][_0x8c29('0x10')]);}return _0x4bb594[_0x8c29('0x77')](_0x8c8ab7);}})[_0x8c29('0x17')](function(_0x2a0f27){if(_0x2a0f27){return _0x2a0f27?{'count':_0x17a04b,'rows':_0x2a0f27}:null;}})[_0x8c29('0x17')](respondWithResult(_0x49c780,null))[_0x8c29('0x28')](handleError(_0x49c780,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4d26bac..e3f67ed 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 _0x9939=['remove','emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x9939,0x180));var _0x9993=function(_0x56a6ba,_0x4e963f){_0x56a6ba=_0x56a6ba-0x0;var _0x1f934e=_0x9939[_0x56a6ba];return _0x1f934e;};'use strict';var EventEmitter=require(_0x9993('0x0'));var WhatsappQueue=require(_0x9993('0x1'))['db'][_0x9993('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9993('0x3')](0x0);var events={'afterCreate':_0x9993('0x4'),'afterUpdate':_0x9993('0x5'),'afterDestroy':_0x9993('0x6')};function emitEvent(_0x482f53){return function(_0x805b10,_0x12ac94,_0x10e63e){WhatsappQueueEvents[_0x9993('0x7')](_0x482f53+':'+_0x805b10['id'],_0x805b10);WhatsappQueueEvents[_0x9993('0x7')](_0x482f53,_0x805b10);_0x10e63e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x9993('0x8')](e,emitEvent(event));}}module[_0x9993('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x66eb=['WhatsappQueue','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x114cc6,_0x346569){var _0x4cfbbd=function(_0x16e4c9){while(--_0x16e4c9){_0x114cc6['push'](_0x114cc6['shift']());}};_0x4cfbbd(++_0x346569);}(_0x66eb,0xb5));var _0xb66e=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x66eb[_0x2aa48b];return _0x48caf8;};'use strict';var EventEmitter=require(_0xb66e('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb66e('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb66e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb66e('0x3')};function emitEvent(_0x1d3750){return function(_0x2015c6,_0x4d0bc1,_0x4d883c){WhatsappQueueEvents[_0xb66e('0x4')](_0x1d3750+':'+_0x2015c6['id'],_0x2015c6);WhatsappQueueEvents['emit'](_0x1d3750,_0x2015c6);_0x4d883c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xb66e('0x5')](e,emitEvent(event));}}module[_0xb66e('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d8f9447..ad49a7b 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 _0x4ad3=['../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b539b,_0x4143a8){var _0xa761f1=function(_0x2268f1){while(--_0x2268f1){_0x3b539b['push'](_0x3b539b['shift']());}};_0xa761f1(++_0x4143a8);}(_0x4ad3,0x125));var _0x34ad=function(_0x5b88f1,_0x9555f0){_0x5b88f1=_0x5b88f1-0x0;var _0x41f6c2=_0x4ad3[_0x5b88f1];return _0x41f6c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x34ad('0x0'))(_0x34ad('0x1'));var moment=require(_0x34ad('0x2'));var BPromise=require(_0x34ad('0x3'));var rp=require(_0x34ad('0x4'));var fs=require('fs');var path=require(_0x34ad('0x5'));var rimraf=require(_0x34ad('0x6'));var config=require(_0x34ad('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x34ad('0x8')]=function(_0x33c25d,_0x5d9639){return _0x33c25d[_0x34ad('0x9')](_0x34ad('0xa'),attributes,{'tableName':_0x34ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8231=['rimraf','../../config/environment','./whatsappQueue.attributes','whatsapp_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8231,0x1f3));var _0x1823=function(_0x1ab9a9,_0x3d66e5){_0x1ab9a9=_0x1ab9a9-0x0;var _0x389a6c=_0x8231[_0x1ab9a9];return _0x389a6c;};'use strict';var _=require('lodash');var util=require(_0x1823('0x0'));var logger=require(_0x1823('0x1'))(_0x1823('0x2'));var moment=require(_0x1823('0x3'));var BPromise=require('bluebird');var rp=require(_0x1823('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1823('0x5'));var config=require(_0x1823('0x6'));var attributes=require(_0x1823('0x7'));module['exports']=function(_0x5b6db1,_0x214376){return _0x5b6db1['define']('WhatsappQueue',attributes,{'tableName':_0x1823('0x8'),'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 78a8cda..6216794 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 _0x8d50=['result','catch','GetWhatsappQueue','findAll','options','raw','limit','include','model','attributes','map','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1e1226,_0x1b1410){var _0x2e34ee=function(_0x481a71){while(--_0x481a71){_0x1e1226['push'](_0x1e1226['shift']());}};_0x2e34ee(++_0x1b1410);}(_0x8d50,0x194));var _0x08d5=function(_0xa16b4e,_0x3d4f37){_0xa16b4e=_0xa16b4e-0x0;var _0x197bba=_0x8d50[_0xa16b4e];return _0x197bba;};'use strict';var _=require(_0x08d5('0x0'));var util=require(_0x08d5('0x1'));var moment=require(_0x08d5('0x2'));var BPromise=require(_0x08d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08d5('0x4'));var logger=require(_0x08d5('0x5'))('rpc');var config=require(_0x08d5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x08d5('0x7')][_0x08d5('0x8')]({'port':0x232a});config[_0x08d5('0x9')]=_[_0x08d5('0xa')](config[_0x08d5('0x9')],{'host':_0x08d5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x08d5('0xc'))[_0x08d5('0xd')](socket);function respondWithRpcPromise(_0x5d3d4d,_0x5a32c9,_0x24e121){return new BPromise(function(_0x3f228a,_0x3e45b5){return client[_0x08d5('0xe')](_0x5d3d4d,_0x24e121)[_0x08d5('0xf')](function(_0x162574){logger['info'](_0x08d5('0x10'),_0x5a32c9,_0x08d5('0x11'));logger[_0x08d5('0x12')](_0x08d5('0x13'),_0x5a32c9,_0x08d5('0x11'),JSON[_0x08d5('0x14')](_0x162574));if(_0x162574[_0x08d5('0x15')]){if(_0x162574[_0x08d5('0x15')][_0x08d5('0x16')]===0x1f4){logger[_0x08d5('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x5a32c9,_0x162574[_0x08d5('0x15')][_0x08d5('0x17')]);return _0x3e45b5(_0x162574[_0x08d5('0x15')][_0x08d5('0x17')]);}logger['error'](_0x08d5('0x10'),_0x5a32c9,_0x162574[_0x08d5('0x15')][_0x08d5('0x17')]);return _0x3f228a(_0x162574['error'][_0x08d5('0x17')]);}else{logger[_0x08d5('0x18')](_0x08d5('0x10'),_0x5a32c9,'request\x20sent');_0x3f228a(_0x162574[_0x08d5('0x19')][_0x08d5('0x17')]);}})[_0x08d5('0x1a')](function(_0x495a8d){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5a32c9,_0x495a8d);_0x3e45b5(_0x495a8d);});});}exports[_0x08d5('0x1b')]=function(_0x4226d5){var _0x5209ad=this;return new Promise(function(_0x4a1846,_0x5e571d){return db['WhatsappQueue'][_0x08d5('0x1c')]({'raw':_0x4226d5[_0x08d5('0x1d')]?_0x4226d5['options'][_0x08d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x4226d5[_0x08d5('0x1d')]?_0x4226d5[_0x08d5('0x1d')]['where']||null:null,'attributes':_0x4226d5[_0x08d5('0x1d')]?_0x4226d5[_0x08d5('0x1d')]['attributes']||null:null,'limit':_0x4226d5[_0x08d5('0x1d')]?_0x4226d5[_0x08d5('0x1d')][_0x08d5('0x1f')]||null:null,'include':_0x4226d5[_0x08d5('0x1d')]?_0x4226d5['options'][_0x08d5('0x20')]?_['map'](_0x4226d5[_0x08d5('0x1d')]['include'],function(_0x10245a){return{'model':db[_0x10245a[_0x08d5('0x21')]],'as':_0x10245a['as'],'attributes':_0x10245a[_0x08d5('0x22')],'include':_0x10245a[_0x08d5('0x20')]?_[_0x08d5('0x23')](_0x10245a['include'],function(_0x4cfc33){return{'model':db[_0x4cfc33[_0x08d5('0x21')]],'as':_0x4cfc33['as'],'attributes':_0x4cfc33['attributes'],'include':_0x4cfc33['include']?_[_0x08d5('0x23')](_0x4cfc33[_0x08d5('0x20')],function(_0x1126c4){return{'model':db[_0x1126c4[_0x08d5('0x21')]],'as':_0x1126c4['as'],'attributes':_0x1126c4[_0x08d5('0x22')]};}):[]};}):[]};}):[]:[]})[_0x08d5('0xf')](function(_0x44ec98){logger[_0x08d5('0x18')](_0x08d5('0x1b'),_0x4226d5);logger[_0x08d5('0x12')](_0x08d5('0x1b'),_0x4226d5,JSON['stringify'](_0x44ec98));_0x4a1846(_0x44ec98);})[_0x08d5('0x1a')](function(_0x31deed){logger[_0x08d5('0x15')](_0x08d5('0x1b'),_0x31deed[_0x08d5('0x17')],_0x4226d5);_0x5e571d(_0x5209ad[_0x08d5('0x15')](0x1f4,_0x31deed[_0x08d5('0x17')]));});});};exports[_0x08d5('0x24')]=function(_0x3065c4){var _0x32e310=this;return new Promise(function(_0x1a9a11,_0x5e989b){return db[_0x08d5('0x25')][_0x08d5('0x26')]({'raw':_0x3065c4[_0x08d5('0x1d')]?_0x3065c4[_0x08d5('0x1d')][_0x08d5('0x1e')]===undefined?!![]:![]:!![],'where':_0x3065c4['options']?_0x3065c4[_0x08d5('0x1d')]['where']||null:null,'attributes':_0x3065c4['options']?_0x3065c4[_0x08d5('0x1d')][_0x08d5('0x22')]||null:null,'include':_0x3065c4[_0x08d5('0x1d')]?_0x3065c4[_0x08d5('0x1d')][_0x08d5('0x20')]?_[_0x08d5('0x23')](_0x3065c4[_0x08d5('0x1d')][_0x08d5('0x20')],function(_0xe543ab){return{'model':db[_0xe543ab['model']],'as':_0xe543ab['as'],'attributes':_0xe543ab[_0x08d5('0x22')],'include':_0xe543ab[_0x08d5('0x20')]?_[_0x08d5('0x23')](_0xe543ab[_0x08d5('0x20')],function(_0x386231){return{'model':db[_0x386231['model']],'as':_0x386231['as'],'attributes':_0x386231[_0x08d5('0x22')],'include':_0x386231[_0x08d5('0x20')]?_[_0x08d5('0x23')](_0x386231[_0x08d5('0x20')],function(_0x40e38e){return{'model':db[_0x40e38e[_0x08d5('0x21')]],'as':_0x40e38e['as'],'attributes':_0x40e38e[_0x08d5('0x22')]};}):[]};}):[]};}):[]:[]})[_0x08d5('0xf')](function(_0x595bb6){logger[_0x08d5('0x18')](_0x08d5('0x24'),_0x3065c4);logger['debug'](_0x08d5('0x24'),_0x3065c4,JSON[_0x08d5('0x14')](_0x595bb6));_0x1a9a11(_0x595bb6);})[_0x08d5('0x1a')](function(_0x52226a){logger[_0x08d5('0x15')](_0x08d5('0x24'),_0x52226a[_0x08d5('0x17')],_0x3065c4);_0x5e989b(_0x32e310[_0x08d5('0x15')](0x1f4,_0x52226a[_0x08d5('0x17')]));});});}; \ No newline at end of file +var _0xa0dc=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','lodash','util','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa0dc,0x11d));var _0xca0d=function(_0x3bfbac,_0x2a25e4){_0x3bfbac=_0x3bfbac-0x0;var _0xd6c588=_0xa0dc[_0x3bfbac];return _0xd6c588;};'use strict';var _=require(_0xca0d('0x0'));var util=require(_0xca0d('0x1'));var moment=require(_0xca0d('0x2'));var BPromise=require('bluebird');var rs=require(_0xca0d('0x3'));var fs=require('fs');var Redis=require(_0xca0d('0x4'));var db=require(_0xca0d('0x5'))['db'];var utils=require(_0xca0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xca0d('0x7'));var client=jayson[_0xca0d('0x8')]['http']({'port':0x232a});config[_0xca0d('0x9')]=_['defaults'](config[_0xca0d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca0d('0x9')]));require(_0xca0d('0xa'))[_0xca0d('0xb')](socket);function respondWithRpcPromise(_0x235c2d,_0x3f918b,_0xb5f76a){return new BPromise(function(_0x1eda02,_0x25689f){return client[_0xca0d('0xc')](_0x235c2d,_0xb5f76a)[_0xca0d('0xd')](function(_0x453cea){logger[_0xca0d('0xe')](_0xca0d('0xf'),_0x3f918b,_0xca0d('0x10'));logger[_0xca0d('0x11')](_0xca0d('0x12'),_0x3f918b,_0xca0d('0x10'),JSON[_0xca0d('0x13')](_0x453cea));if(_0x453cea[_0xca0d('0x14')]){if(_0x453cea[_0xca0d('0x14')][_0xca0d('0x15')]===0x1f4){logger[_0xca0d('0x14')](_0xca0d('0xf'),_0x3f918b,_0x453cea[_0xca0d('0x14')]['message']);return _0x25689f(_0x453cea[_0xca0d('0x14')]['message']);}logger['error'](_0xca0d('0xf'),_0x3f918b,_0x453cea[_0xca0d('0x14')][_0xca0d('0x16')]);return _0x1eda02(_0x453cea[_0xca0d('0x14')]['message']);}else{logger[_0xca0d('0xe')](_0xca0d('0xf'),_0x3f918b,_0xca0d('0x10'));_0x1eda02(_0x453cea['result'][_0xca0d('0x16')]);}})[_0xca0d('0x17')](function(_0x433e9c){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x3f918b,_0x433e9c);_0x25689f(_0x433e9c);});});}exports[_0xca0d('0x18')]=function(_0x58c376){var _0x10fbc6=this;return new Promise(function(_0x5740ef,_0x45d604){return db[_0xca0d('0x19')][_0xca0d('0x1a')]({'raw':_0x58c376[_0xca0d('0x1b')]?_0x58c376['options'][_0xca0d('0x1c')]===undefined?!![]:![]:!![],'where':_0x58c376[_0xca0d('0x1b')]?_0x58c376[_0xca0d('0x1b')][_0xca0d('0x1d')]||null:null,'attributes':_0x58c376['options']?_0x58c376['options'][_0xca0d('0x1e')]||null:null,'limit':_0x58c376['options']?_0x58c376[_0xca0d('0x1b')][_0xca0d('0x1f')]||null:null,'include':_0x58c376[_0xca0d('0x1b')]?_0x58c376[_0xca0d('0x1b')][_0xca0d('0x20')]?_[_0xca0d('0x21')](_0x58c376['options']['include'],function(_0x233558){return{'model':db[_0x233558['model']],'as':_0x233558['as'],'attributes':_0x233558[_0xca0d('0x1e')],'include':_0x233558['include']?_['map'](_0x233558[_0xca0d('0x20')],function(_0x2bb12f){return{'model':db[_0x2bb12f[_0xca0d('0x22')]],'as':_0x2bb12f['as'],'attributes':_0x2bb12f[_0xca0d('0x1e')],'include':_0x2bb12f[_0xca0d('0x20')]?_[_0xca0d('0x21')](_0x2bb12f[_0xca0d('0x20')],function(_0x28ca12){return{'model':db[_0x28ca12[_0xca0d('0x22')]],'as':_0x28ca12['as'],'attributes':_0x28ca12['attributes']};}):[]};}):[]};}):[]:[]})[_0xca0d('0xd')](function(_0x1becb3){logger[_0xca0d('0xe')](_0xca0d('0x18'),_0x58c376);logger[_0xca0d('0x11')]('GetWhatsappQueue',_0x58c376,JSON[_0xca0d('0x13')](_0x1becb3));_0x5740ef(_0x1becb3);})[_0xca0d('0x17')](function(_0x1b62d0){logger[_0xca0d('0x14')]('GetWhatsappQueue',_0x1b62d0[_0xca0d('0x16')],_0x58c376);_0x45d604(_0x10fbc6[_0xca0d('0x14')](0x1f4,_0x1b62d0['message']));});});};exports[_0xca0d('0x23')]=function(_0x427e45){var _0x48eb16=this;return new Promise(function(_0x49d270,_0x3ead99){return db[_0xca0d('0x19')]['find']({'raw':_0x427e45[_0xca0d('0x1b')]?_0x427e45[_0xca0d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x427e45[_0xca0d('0x1b')]?_0x427e45['options']['where']||null:null,'attributes':_0x427e45[_0xca0d('0x1b')]?_0x427e45['options'][_0xca0d('0x1e')]||null:null,'include':_0x427e45[_0xca0d('0x1b')]?_0x427e45[_0xca0d('0x1b')][_0xca0d('0x20')]?_[_0xca0d('0x21')](_0x427e45[_0xca0d('0x1b')][_0xca0d('0x20')],function(_0x19dba6){return{'model':db[_0x19dba6[_0xca0d('0x22')]],'as':_0x19dba6['as'],'attributes':_0x19dba6[_0xca0d('0x1e')],'include':_0x19dba6[_0xca0d('0x20')]?_[_0xca0d('0x21')](_0x19dba6[_0xca0d('0x20')],function(_0x384ddd){return{'model':db[_0x384ddd[_0xca0d('0x22')]],'as':_0x384ddd['as'],'attributes':_0x384ddd[_0xca0d('0x1e')],'include':_0x384ddd[_0xca0d('0x20')]?_['map'](_0x384ddd[_0xca0d('0x20')],function(_0x3f3598){return{'model':db[_0x3f3598['model']],'as':_0x3f3598['as'],'attributes':_0x3f3598[_0xca0d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xca0d('0xd')](function(_0x3ebb31){logger['info'](_0xca0d('0x23'),_0x427e45);logger['debug']('ShowWhatsappQueue',_0x427e45,JSON[_0xca0d('0x13')](_0x3ebb31));_0x49d270(_0x3ebb31);})[_0xca0d('0x17')](function(_0x3e074b){logger['error']('ShowWhatsappQueue',_0x3e074b[_0xca0d('0x16')],_0x427e45);_0x3ead99(_0x48eb16['error'](0x1f4,_0x3e074b[_0xca0d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 56923af..ae81ab8 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 _0x580f=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x2a6bac,_0x893ebb){var _0x30fac6=function(_0x4fb495){while(--_0x4fb495){_0x2a6bac['push'](_0x2a6bac['shift']());}};_0x30fac6(++_0x893ebb);}(_0x580f,0x11d));var _0xf580=function(_0x533472,_0x5c44e4){_0x533472=_0x533472-0x0;var _0x36e5b4=_0x580f[_0x533472];return _0x36e5b4;};'use strict';var WhatsappQueueEvents=require(_0xf580('0x0'));var events=[_0xf580('0x1'),_0xf580('0x2'),'update'];function createListener(_0x4d2d4d,_0x1fa158){return function(_0x3362a5){_0x1fa158['emit'](_0x4d2d4d,_0x3362a5);};}function removeListener(_0xf7bcdd,_0x37e571){return function(){WhatsappQueueEvents['removeListener'](_0xf7bcdd,_0x37e571);};}exports[_0xf580('0x3')]=function(_0xeceedd){for(var _0xee2740=0x0,_0x191226=events[_0xf580('0x4')];_0xee2740<_0x191226;_0xee2740++){var _0x3b1827=events[_0xee2740];var _0x319be7=createListener(_0xf580('0x5')+_0x3b1827,_0xeceedd);WhatsappQueueEvents['on'](_0x3b1827,_0x319be7);}}; \ No newline at end of file +var _0x27f4=['emit','removeListener','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x595219,_0x2a8032){var _0x15103c=function(_0xfbac0c){while(--_0xfbac0c){_0x595219['push'](_0x595219['shift']());}};_0x15103c(++_0x2a8032);}(_0x27f4,0x6c));var _0x427f=function(_0xb9fe33,_0x47a545){_0xb9fe33=_0xb9fe33-0x0;var _0x15f7c2=_0x27f4[_0xb9fe33];return _0x15f7c2;};'use strict';var WhatsappQueueEvents=require(_0x427f('0x0'));var events=[_0x427f('0x1'),_0x427f('0x2'),_0x427f('0x3')];function createListener(_0x488452,_0x19a897){return function(_0x3d0a6a){_0x19a897[_0x427f('0x4')](_0x488452,_0x3d0a6a);};}function removeListener(_0x3b445d,_0x5c6e6a){return function(){WhatsappQueueEvents[_0x427f('0x5')](_0x3b445d,_0x5c6e6a);};}exports['register']=function(_0x185e3c){for(var _0x5dcc17=0x0,_0x4cc61a=events[_0x427f('0x6')];_0x5dcc17<_0x4cc61a;_0x5dcc17++){var _0x338f57=events[_0x5dcc17];var _0x43875f=createListener(_0x427f('0x7')+_0x338f57,_0x185e3c);WhatsappQueueEvents['on'](_0x338f57,_0x43875f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d35cae4..8a3557e 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 _0xd2c2=['delete','destroy','exports','util','path','express','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd2c2,0x1ce));var _0x2d2c=function(_0x3e719a,_0x1d06d9){_0x3e719a=_0x3e719a-0x0;var _0x4e1f22=_0xd2c2[_0x3e719a];return _0x4e1f22;};'use strict';var multer=require('multer');var util=require(_0x2d2c('0x0'));var path=require(_0x2d2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d2c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2d2c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2d2c('0x4'));router[_0x2d2c('0x5')]('/',auth[_0x2d2c('0x6')](),controller[_0x2d2c('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x2d2c('0x8')]);router[_0x2d2c('0x5')](_0x2d2c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2d2c('0xa')]('/',auth['isAuthenticated'](),controller[_0x2d2c('0xb')]);router[_0x2d2c('0xc')](_0x2d2c('0x9'),auth[_0x2d2c('0x6')](),controller[_0x2d2c('0xd')]);router[_0x2d2c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2d2c('0xf')]);module[_0x2d2c('0x10')]=router; \ No newline at end of file +var _0xb5c6=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','delete','multer'];(function(_0xfbd67b,_0x52b264){var _0x4ebec0=function(_0x1c3cc4){while(--_0x1c3cc4){_0xfbd67b['push'](_0xfbd67b['shift']());}};_0x4ebec0(++_0x52b264);}(_0xb5c6,0x19f));var _0x6b5c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb5c6[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x6b5c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b5c('0x1'));var express=require('express');var router=express[_0x6b5c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6b5c('0x3'));var interaction=require(_0x6b5c('0x4'));var config=require(_0x6b5c('0x5'));var controller=require(_0x6b5c('0x6'));router[_0x6b5c('0x7')]('/',auth[_0x6b5c('0x8')](),controller[_0x6b5c('0x9')]);router[_0x6b5c('0x7')](_0x6b5c('0xa'),auth['isAuthenticated'](),controller[_0x6b5c('0xb')]);router[_0x6b5c('0x7')](_0x6b5c('0xc'),auth[_0x6b5c('0x8')](),controller['show']);router['post']('/',auth[_0x6b5c('0x8')](),controller[_0x6b5c('0xd')]);router[_0x6b5c('0xe')]('/:id',auth[_0x6b5c('0x8')](),controller['update']);router[_0x6b5c('0xf')](_0x6b5c('0xc'),auth[_0x6b5c('0x8')](),controller['destroy']);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 b210fa2..1d4d3ab 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x52bd01,_0x4a0007){var _0x1f514d=function(_0x1a8d72){while(--_0x1a8d72){_0x52bd01['push'](_0x52bd01['shift']());}};_0x1f514d(++_0x4a0007);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1220b7,_0x62732a){var _0x11ebf2=function(_0x186c28){while(--_0x186c28){_0x1220b7['push'](_0x1220b7['shift']());}};_0x11ebf2(++_0x62732a);}(_0x7a54,0x106));var _0x47a5=function(_0x58a6e6,_0x3dcd5a){_0x58a6e6=_0x58a6e6-0x0;var _0x581418=_0x7a54[_0x58a6e6];return _0x581418;};'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 f1753fb..aaf500e 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 _0x8f59=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x17935e,_0x3d6d67){var _0x309298=function(_0x32c380){while(--_0x32c380){_0x17935e['push'](_0x17935e['shift']());}};_0x309298(++_0x3d6d67);}(_0x8f59,0x11d));var _0x98f5=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x8f59[_0x19d24c];return _0x2fae8d;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];function respondWithStatusCode(_0x259abe,_0x1f00e8){_0x1f00e8=_0x1f00e8||0xcc;return function(_0x160626){if(_0x160626){return _0x259abe[_0x98f5('0x18')](_0x1f00e8);}return _0x259abe[_0x98f5('0x19')](_0x1f00e8)['end']();};}function respondWithResult(_0x24a7a9,_0xbade31){_0xbade31=_0xbade31||0xc8;return function(_0x5b8bab){if(_0x5b8bab){return _0x24a7a9[_0x98f5('0x19')](_0xbade31)[_0x98f5('0x1a')](_0x5b8bab);}};}function respondWithFilteredResult(_0xaa951a,_0x4ae70d){return function(_0x2437e7){if(_0x2437e7){var _0xc7a49b=typeof _0x4ae70d[_0x98f5('0x1b')]==='undefined'&&typeof _0x4ae70d[_0x98f5('0x1c')]===_0x98f5('0x1d');var _0x574644=_0x2437e7[_0x98f5('0x1e')];var _0x51a567=_0xc7a49b?0x0:_0x4ae70d[_0x98f5('0x1b')];var _0x9e42dd=_0xc7a49b?_0x2437e7[_0x98f5('0x1e')]:_0x4ae70d[_0x98f5('0x1b')]+_0x4ae70d[_0x98f5('0x1c')];var _0xa4477c;if(_0x9e42dd>=_0x574644){_0x9e42dd=_0x574644;_0xa4477c=0xc8;}else{_0xa4477c=0xce;}_0xaa951a['status'](_0xa4477c);return _0xaa951a[_0x98f5('0x1f')]('Content-Range',_0x51a567+'-'+_0x9e42dd+'/'+_0x574644)[_0x98f5('0x1a')](_0x2437e7);}return null;};}function patchUpdates(_0x191f23){return function(_0x5deca0){try{jsonpatch[_0x98f5('0x20')](_0x5deca0,_0x191f23,!![]);}catch(_0x2933d1){return BPromise[_0x98f5('0x21')](_0x2933d1);}return _0x5deca0[_0x98f5('0x22')]();};}function saveUpdates(_0x3b2d9d,_0x3dc7c2){return function(_0x38b46d){if(_0x38b46d){return _0x38b46d['update'](_0x3b2d9d)[_0x98f5('0x23')](function(_0x49ee4e){return _0x49ee4e;});}return null;};}function removeEntity(_0xcb10d6,_0x495889){return function(_0x44bfbb){if(_0x44bfbb){return _0x44bfbb[_0x98f5('0x24')]()[_0x98f5('0x23')](function(){_0xcb10d6[_0x98f5('0x19')](0xcc)[_0x98f5('0x25')]();});}};}function handleEntityNotFound(_0x18052d,_0x46dbd4){return function(_0x58d506){if(!_0x58d506){_0x18052d[_0x98f5('0x18')](0x194);}return _0x58d506;};}function handleError(_0x2b80a1,_0x5d7423){_0x5d7423=_0x5d7423||0x1f4;return function(_0x1a1c55){logger[_0x98f5('0x26')](_0x1a1c55[_0x98f5('0x27')]);if(_0x1a1c55[_0x98f5('0x28')]){delete _0x1a1c55[_0x98f5('0x28')];}_0x2b80a1[_0x98f5('0x19')](_0x5d7423)[_0x98f5('0x29')](_0x1a1c55);};}exports[_0x98f5('0x2a')]=function(_0x576c4b,_0x4c10b8){var _0x428c85={},_0x71661e={},_0x18bb29={'count':0x0,'rows':[]};var _0x209d15=_[_0x98f5('0x2b')](db[_0x98f5('0x2c')]['rawAttributes'],function(_0x29e1f5){return{'name':_0x29e1f5[_0x98f5('0x2d')],'type':_0x29e1f5[_0x98f5('0x2e')][_0x98f5('0x2f')]};});_0x71661e[_0x98f5('0x30')]=_[_0x98f5('0x2b')](_0x209d15,'name');_0x71661e[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x576c4b[_0x98f5('0x31')]);_0x71661e[_0x98f5('0x33')]=_['intersection'](_0x71661e[_0x98f5('0x30')],_0x71661e[_0x98f5('0x31')]);_0x428c85[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x71661e[_0x98f5('0x30')],qs[_0x98f5('0x36')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x36')]));_0x428c85[_0x98f5('0x34')]=_0x428c85[_0x98f5('0x34')][_0x98f5('0x37')]?_0x428c85[_0x98f5('0x34')]:_0x71661e[_0x98f5('0x30')];if(!_0x576c4b[_0x98f5('0x31')][_0x98f5('0x38')](_0x98f5('0x39'))){_0x428c85[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x1c')]);_0x428c85['offset']=qs[_0x98f5('0x1b')](_0x576c4b['query']['offset']);}_0x428c85[_0x98f5('0x3a')]=qs[_0x98f5('0x3b')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3b')]);_0x428c85['where']=qs[_0x98f5('0x33')](_[_0x98f5('0x3c')](_0x576c4b[_0x98f5('0x31')],_0x71661e['filters']),_0x209d15);if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3d')]){_0x428c85['where']=_[_0x98f5('0x3e')](_0x428c85[_0x98f5('0x3f')],{'$or':_[_0x98f5('0x2b')](_0x209d15,function(_0x580f19){if(_0x580f19[_0x98f5('0x2e')]!==_0x98f5('0x40')){var _0x19f045={};_0x19f045[_0x580f19[_0x98f5('0x28')]]={'$like':'%'+_0x576c4b[_0x98f5('0x31')]['filter']+'%'};return _0x19f045;}})});}_0x428c85=_['merge']({},_0x428c85,_0x576c4b[_0x98f5('0x41')]);var _0x14faf2={'where':_0x428c85[_0x98f5('0x3f')]};return db[_0x98f5('0x2c')][_0x98f5('0x1e')](_0x14faf2)[_0x98f5('0x23')](function(_0x58064e){_0x18bb29['count']=_0x58064e;if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x42')]){_0x428c85[_0x98f5('0x43')]=[{'all':!![]}];}return db[_0x98f5('0x2c')]['findAll'](_0x428c85);})['then'](function(_0x2dafcd){_0x18bb29[_0x98f5('0x44')]=_0x2dafcd;return _0x18bb29;})[_0x98f5('0x23')](respondWithFilteredResult(_0x4c10b8,_0x428c85))[_0x98f5('0x45')](handleError(_0x4c10b8,null));};exports['show']=function(_0x51ae92,_0x3db067){var _0x3a191f={'raw':!![],'where':{'id':_0x51ae92['params']['id']}},_0x372c33={};_0x372c33[_0x98f5('0x30')]=_['keys'](db[_0x98f5('0x2c')]['rawAttributes']);_0x372c33[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x51ae92[_0x98f5('0x31')]);_0x372c33['filters']=_[_0x98f5('0x35')](_0x372c33[_0x98f5('0x30')],_0x372c33['query']);_0x3a191f[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x372c33['model'],qs[_0x98f5('0x36')](_0x51ae92['query'][_0x98f5('0x36')]));_0x3a191f[_0x98f5('0x34')]=_0x3a191f['attributes']['length']?_0x3a191f['attributes']:_0x372c33['model'];if(_0x51ae92[_0x98f5('0x31')]['includeAll']){_0x3a191f[_0x98f5('0x43')]=[{'all':!![]}];}_0x3a191f=_[_0x98f5('0x3e')]({},_0x3a191f,_0x51ae92[_0x98f5('0x41')]);return db[_0x98f5('0x2c')][_0x98f5('0x46')](_0x3a191f)[_0x98f5('0x23')](handleEntityNotFound(_0x3db067,null))['then'](respondWithResult(_0x3db067,null))[_0x98f5('0x45')](handleError(_0x3db067,null));};exports[_0x98f5('0x47')]=function(_0x4b3fa8,_0x2c3cef){return db[_0x98f5('0x2c')][_0x98f5('0x47')](_0x4b3fa8['body'],{})[_0x98f5('0x23')](respondWithResult(_0x2c3cef,0xc9))[_0x98f5('0x45')](handleError(_0x2c3cef,null));};exports[_0x98f5('0x48')]=function(_0x1d4b3b,_0x4a0cda){if(_0x1d4b3b[_0x98f5('0x49')]['id']){delete _0x1d4b3b[_0x98f5('0x49')]['id'];}return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x1d4b3b[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a0cda,null))[_0x98f5('0x23')](saveUpdates(_0x1d4b3b[_0x98f5('0x49')],null))['then'](respondWithResult(_0x4a0cda,null))[_0x98f5('0x45')](handleError(_0x4a0cda,null));};exports['destroy']=function(_0x27ed57,_0x4cb157){return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x27ed57[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cb157,null))[_0x98f5('0x23')](removeEntity(_0x4cb157,null))[_0x98f5('0x45')](handleError(_0x4cb157,null));};exports[_0x98f5('0x4b')]=function(_0x2953e3,_0xde3d2d){return db[_0x98f5('0x2c')][_0x98f5('0x4b')]()[_0x98f5('0x23')](respondWithResult(_0xde3d2d,null))[_0x98f5('0x45')](handleError(_0xde3d2d,null));}; \ No newline at end of file +var _0xbdb7=['then','findAll','rows','catch','params','rawAttributes','length','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2e17a7,_0x5b5efa){_0x2e17a7=_0x2e17a7-0x0;var _0x443505=_0xbdb7[_0x2e17a7];return _0x443505;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={},_0xd2d7be={},_0x25a1fe={'count':0x0,'rows':[]};var _0x365c02=_[_0x7bdb('0x28')](db[_0x7bdb('0x29')]['rawAttributes'],function(_0x388a45){return{'name':_0x388a45[_0x7bdb('0x2a')],'type':_0x388a45[_0x7bdb('0x2b')][_0x7bdb('0x2c')]};});_0xd2d7be[_0x7bdb('0x2d')]=_['map'](_0x365c02,_0x7bdb('0x25'));_0xd2d7be[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x371e8a[_0x7bdb('0x2e')]);_0xd2d7be['filters']=_['intersection'](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2e')]);_0x1e9996['attributes']=_[_0x7bdb('0x30')](_0xd2d7be['model'],qs[_0x7bdb('0x31')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x31')]));_0x1e9996['attributes']=_0x1e9996[_0x7bdb('0x32')]['length']?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x2d')];if(!_0x371e8a['query'][_0x7bdb('0x33')]('nolimit')){_0x1e9996['limit']=qs[_0x7bdb('0x1b')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x1b')]);_0x1e9996[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x371e8a[_0x7bdb('0x2e')]['offset']);}_0x1e9996[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x35')]);_0x1e9996[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x371e8a[_0x7bdb('0x2e')],_0xd2d7be[_0x7bdb('0x37')]),_0x365c02);if(_0x371e8a['query']['filter']){_0x1e9996[_0x7bdb('0x36')]=_[_0x7bdb('0x39')](_0x1e9996[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x28')](_0x365c02,function(_0x3732b2){if(_0x3732b2['type']!=='VIRTUAL'){var _0x27164f={};_0x27164f[_0x3732b2['name']]={'$like':'%'+_0x371e8a[_0x7bdb('0x2e')]['filter']+'%'};return _0x27164f;}})});}_0x1e9996=_[_0x7bdb('0x39')]({},_0x1e9996,_0x371e8a['options']);var _0x4cf3fa={'where':_0x1e9996[_0x7bdb('0x36')]};return db[_0x7bdb('0x29')][_0x7bdb('0x1c')](_0x4cf3fa)[_0x7bdb('0x3a')](function(_0x43c7d3){_0x25a1fe[_0x7bdb('0x1c')]=_0x43c7d3;if(_0x371e8a[_0x7bdb('0x2e')]['includeAll']){_0x1e9996['include']=[{'all':!![]}];}return db[_0x7bdb('0x29')][_0x7bdb('0x3b')](_0x1e9996);})[_0x7bdb('0x3a')](function(_0x3509e4){_0x25a1fe[_0x7bdb('0x3c')]=_0x3509e4;return _0x25a1fe;})[_0x7bdb('0x3a')](respondWithFilteredResult(_0x2e8e65,_0x1e9996))[_0x7bdb('0x3d')](handleError(_0x2e8e65,null));};exports['show']=function(_0x4a2ebc,_0x1bcbcd){var _0x8e893e={'raw':!![],'where':{'id':_0x4a2ebc[_0x7bdb('0x3e')]['id']}},_0x4636f8={};_0x4636f8['model']=_[_0x7bdb('0x2f')](db['WhatsappQueueReport'][_0x7bdb('0x3f')]);_0x4636f8[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x4a2ebc[_0x7bdb('0x2e')]);_0x4636f8[_0x7bdb('0x37')]=_[_0x7bdb('0x30')](_0x4636f8[_0x7bdb('0x2d')],_0x4636f8[_0x7bdb('0x2e')]);_0x8e893e[_0x7bdb('0x32')]=_['intersection'](_0x4636f8[_0x7bdb('0x2d')],qs[_0x7bdb('0x31')](_0x4a2ebc['query'][_0x7bdb('0x31')]));_0x8e893e['attributes']=_0x8e893e[_0x7bdb('0x32')][_0x7bdb('0x40')]?_0x8e893e[_0x7bdb('0x32')]:_0x4636f8[_0x7bdb('0x2d')];if(_0x4a2ebc[_0x7bdb('0x2e')]['includeAll']){_0x8e893e[_0x7bdb('0x41')]=[{'all':!![]}];}_0x8e893e=_[_0x7bdb('0x39')]({},_0x8e893e,_0x4a2ebc[_0x7bdb('0x42')]);return db[_0x7bdb('0x29')][_0x7bdb('0x43')](_0x8e893e)['then'](handleEntityNotFound(_0x1bcbcd,null))[_0x7bdb('0x3a')](respondWithResult(_0x1bcbcd,null))[_0x7bdb('0x3d')](handleError(_0x1bcbcd,null));};exports[_0x7bdb('0x44')]=function(_0xb26a9,_0x259007){return db[_0x7bdb('0x29')][_0x7bdb('0x44')](_0xb26a9[_0x7bdb('0x45')],{})[_0x7bdb('0x3a')](respondWithResult(_0x259007,0xc9))[_0x7bdb('0x3d')](handleError(_0x259007,null));};exports['update']=function(_0x189cf8,_0x58c4bc){if(_0x189cf8['body']['id']){delete _0x189cf8[_0x7bdb('0x45')]['id'];}return db[_0x7bdb('0x29')]['find']({'where':{'id':_0x189cf8[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x58c4bc,null))['then'](saveUpdates(_0x189cf8['body'],null))['then'](respondWithResult(_0x58c4bc,null))[_0x7bdb('0x3d')](handleError(_0x58c4bc,null));};exports[_0x7bdb('0x46')]=function(_0x2fab74,_0x46410c){return db[_0x7bdb('0x29')][_0x7bdb('0x43')]({'where':{'id':_0x2fab74[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x46410c,null))[_0x7bdb('0x3a')](removeEntity(_0x46410c,null))[_0x7bdb('0x3d')](handleError(_0x46410c,null));};exports['describe']=function(_0x299ef0,_0x4806e0){return db[_0x7bdb('0x29')][_0x7bdb('0x47')]()[_0x7bdb('0x3a')](respondWithResult(_0x4806e0,null))[_0x7bdb('0x3d')](handleError(_0x4806e0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0bd0847..1efc129 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 _0x8f30=['../../config/logger','api','request-promise','path','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x5e7c64,_0x31a899){var _0x36f339=function(_0x52fb33){while(--_0x52fb33){_0x5e7c64['push'](_0x5e7c64['shift']());}};_0x36f339(++_0x31a899);}(_0x8f30,0x1c1));var _0x08f3=function(_0x509051,_0x457a40){_0x509051=_0x509051-0x0;var _0x3fb3ea=_0x8f30[_0x509051];return _0x3fb3ea;};'use strict';var _=require(_0x08f3('0x0'));var util=require(_0x08f3('0x1'));var logger=require(_0x08f3('0x2'))(_0x08f3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x08f3('0x4'));var fs=require('fs');var path=require(_0x08f3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x08f3('0x6'));module['exports']=function(_0x2adbcc,_0x4953e2){return _0x2adbcc[_0x08f3('0x7')](_0x08f3('0x8'),attributes,{'tableName':_0x08f3('0x9'),'paranoid':![],'indexes':[{'name':_0x08f3('0xa'),'fields':[_0x08f3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4595=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x3405fa,_0x142bc8){var _0x569cbb=function(_0x3eed25){while(--_0x3eed25){_0x3405fa['push'](_0x3405fa['shift']());}};_0x569cbb(++_0x142bc8);}(_0x4595,0x161));var _0x5459=function(_0x3c8184,_0x24fd0f){_0x3c8184=_0x3c8184-0x0;var _0x3885bd=_0x4595[_0x3c8184];return _0x3885bd;};'use strict';var _=require(_0x5459('0x0'));var util=require(_0x5459('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5459('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5459('0x3'));var rimraf=require(_0x5459('0x4'));var config=require(_0x5459('0x5'));var attributes=require(_0x5459('0x6'));module[_0x5459('0x7')]=function(_0xd899c5,_0x2aa46b){return _0xd899c5[_0x5459('0x8')](_0x5459('0x9'),attributes,{'tableName':_0x5459('0xa'),'paranoid':![],'indexes':[{'name':_0x5459('0xb'),'fields':[_0x5459('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 3bb843a..56ef690 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 _0xf339=['catch','CreateWhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','attributes','limit','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1f4710,_0x44e08b){var _0x2a1f92=function(_0x39bbd){while(--_0x39bbd){_0x1f4710['push'](_0x1f4710['shift']());}};_0x2a1f92(++_0x44e08b);}(_0xf339,0x8a));var _0x9f33=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf339[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x9f33('0x0'));var moment=require(_0x9f33('0x1'));var BPromise=require(_0x9f33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f33('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f33('0x4'))(_0x9f33('0x5'));var config=require(_0x9f33('0x6'));var jayson=require(_0x9f33('0x7'));var client=jayson[_0x9f33('0x8')][_0x9f33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1da3d4,_0x9bd1a9,_0x4f233f){return new BPromise(function(_0x57539e,_0xf193b9){return client[_0x9f33('0xa')](_0x1da3d4,_0x4f233f)[_0x9f33('0xb')](function(_0x40c221){logger[_0x9f33('0xc')](_0x9f33('0xd'),_0x9bd1a9,'request\x20sent');logger[_0x9f33('0xe')](_0x9f33('0xf'),_0x9bd1a9,_0x9f33('0x10'),JSON[_0x9f33('0x11')](_0x40c221));if(_0x40c221['error']){if(_0x40c221[_0x9f33('0x12')][_0x9f33('0x13')]===0x1f4){logger[_0x9f33('0x12')](_0x9f33('0xd'),_0x9bd1a9,_0x40c221[_0x9f33('0x12')]['message']);return _0xf193b9(_0x40c221[_0x9f33('0x12')]['message']);}logger[_0x9f33('0x12')](_0x9f33('0xd'),_0x9bd1a9,_0x40c221[_0x9f33('0x12')][_0x9f33('0x14')]);return _0x57539e(_0x40c221[_0x9f33('0x12')][_0x9f33('0x14')]);}else{logger['info'](_0x9f33('0xd'),_0x9bd1a9,_0x9f33('0x10'));_0x57539e(_0x40c221[_0x9f33('0x15')]['message']);}})[_0x9f33('0x16')](function(_0x14cab7){logger[_0x9f33('0x12')](_0x9f33('0xd'),_0x9bd1a9,_0x14cab7);_0xf193b9(_0x14cab7);});});}exports[_0x9f33('0x17')]=function(_0x28be1d){var _0x50a13d=this;return new Promise(function(_0x3dd648,_0x1e1c1d){return db['WhatsappQueueReport']['create'](_0x28be1d[_0x9f33('0x18')],{'raw':_0x28be1d[_0x9f33('0x19')]?_0x28be1d[_0x9f33('0x19')][_0x9f33('0x1a')]===undefined?!![]:![]:!![]})[_0x9f33('0xb')](function(_0x4f2d14){logger[_0x9f33('0xc')](_0x9f33('0x17'),_0x28be1d);logger[_0x9f33('0xe')](_0x9f33('0x17'),_0x28be1d,JSON[_0x9f33('0x11')](_0x4f2d14));_0x3dd648(_0x4f2d14);})[_0x9f33('0x16')](function(_0x4be54e){logger[_0x9f33('0x12')](_0x9f33('0x17'),_0x4be54e[_0x9f33('0x14')],_0x28be1d);_0x1e1c1d(_0x50a13d['error'](0x1f4,_0x4be54e[_0x9f33('0x14')]));});});};exports[_0x9f33('0x1b')]=function(_0xac28de){var _0x394570=this;return new Promise(function(_0x1c5f47,_0x453725){return db[_0x9f33('0x1c')][_0x9f33('0x1d')](_0xac28de[_0x9f33('0x18')],{'raw':_0xac28de['options']?_0xac28de['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xac28de['options']?_0xac28de['options']['where']||null:null,'attributes':_0xac28de[_0x9f33('0x19')]?_0xac28de[_0x9f33('0x19')][_0x9f33('0x1e')]||null:null,'limit':_0xac28de[_0x9f33('0x19')]?_0xac28de[_0x9f33('0x19')][_0x9f33('0x1f')]||null:null})[_0x9f33('0xb')](function(_0xf8d0d6){logger[_0x9f33('0xc')](_0x9f33('0x1b'),_0xac28de);logger['debug'](_0x9f33('0x1b'),_0xac28de,JSON['stringify'](_0xf8d0d6));_0x1c5f47(_0xf8d0d6);})[_0x9f33('0x16')](function(_0x4ec885){logger[_0x9f33('0x12')](_0x9f33('0x1b'),_0x4ec885[_0x9f33('0x14')],_0xac28de);_0x453725(_0x394570[_0x9f33('0x12')](0x1f4,_0x4ec885[_0x9f33('0x14')]));});});}; \ No newline at end of file +var _0x7de1=['../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','then','stringify','UpdateWhatsappQueueReport','update','body','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x3f9979,_0x50fd5f){var _0x5deb2b=function(_0x550b7f){while(--_0x550b7f){_0x3f9979['push'](_0x3f9979['shift']());}};_0x5deb2b(++_0x50fd5f);}(_0x7de1,0x1cd));var _0x17de=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0x7de1[_0x1bb6aa];return _0x2ef28e;};'use strict';var _=require(_0x17de('0x0'));var util=require(_0x17de('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17de('0x2'));var fs=require('fs');var Redis=require(_0x17de('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x17de('0x4'))(_0x17de('0x5'));var config=require('../../config/environment');var jayson=require(_0x17de('0x6'));var client=jayson[_0x17de('0x7')][_0x17de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7ff1e5,_0x3a4d85,_0xf466d1){return new BPromise(function(_0x17665f,_0x303425){return client[_0x17de('0x9')](_0x7ff1e5,_0xf466d1)['then'](function(_0x33d927){logger[_0x17de('0xa')](_0x17de('0xb'),_0x3a4d85,_0x17de('0xc'));logger[_0x17de('0xd')](_0x17de('0xe'),_0x3a4d85,_0x17de('0xc'),JSON['stringify'](_0x33d927));if(_0x33d927['error']){if(_0x33d927['error']['code']===0x1f4){logger[_0x17de('0xf')](_0x17de('0xb'),_0x3a4d85,_0x33d927[_0x17de('0xf')][_0x17de('0x10')]);return _0x303425(_0x33d927[_0x17de('0xf')][_0x17de('0x10')]);}logger[_0x17de('0xf')](_0x17de('0xb'),_0x3a4d85,_0x33d927[_0x17de('0xf')]['message']);return _0x17665f(_0x33d927['error'][_0x17de('0x10')]);}else{logger['info'](_0x17de('0xb'),_0x3a4d85,'request\x20sent');_0x17665f(_0x33d927['result'][_0x17de('0x10')]);}})[_0x17de('0x11')](function(_0x53509b){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3a4d85,_0x53509b);_0x303425(_0x53509b);});});}exports[_0x17de('0x12')]=function(_0x1a4b60){var _0x488bee=this;return new Promise(function(_0x192a79,_0x11ab21){return db[_0x17de('0x13')][_0x17de('0x14')](_0x1a4b60['body'],{'raw':_0x1a4b60[_0x17de('0x15')]?_0x1a4b60[_0x17de('0x15')][_0x17de('0x16')]===undefined?!![]:![]:!![]})[_0x17de('0x17')](function(_0x155a77){logger[_0x17de('0xa')](_0x17de('0x12'),_0x1a4b60);logger[_0x17de('0xd')](_0x17de('0x12'),_0x1a4b60,JSON[_0x17de('0x18')](_0x155a77));_0x192a79(_0x155a77);})['catch'](function(_0x3a1fb6){logger[_0x17de('0xf')](_0x17de('0x12'),_0x3a1fb6['message'],_0x1a4b60);_0x11ab21(_0x488bee[_0x17de('0xf')](0x1f4,_0x3a1fb6[_0x17de('0x10')]));});});};exports[_0x17de('0x19')]=function(_0x237f30){var _0x15e52a=this;return new Promise(function(_0x5ef8cb,_0x5ad186){return db['WhatsappQueueReport'][_0x17de('0x1a')](_0x237f30[_0x17de('0x1b')],{'raw':_0x237f30[_0x17de('0x15')]?_0x237f30[_0x17de('0x15')][_0x17de('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x237f30[_0x17de('0x15')]?_0x237f30['options'][_0x17de('0x1c')]||null:null,'attributes':_0x237f30['options']?_0x237f30[_0x17de('0x15')][_0x17de('0x1d')]||null:null,'limit':_0x237f30[_0x17de('0x15')]?_0x237f30['options'][_0x17de('0x1e')]||null:null})[_0x17de('0x17')](function(_0xeb73cb){logger['info'](_0x17de('0x19'),_0x237f30);logger[_0x17de('0xd')](_0x17de('0x19'),_0x237f30,JSON[_0x17de('0x18')](_0xeb73cb));_0x5ef8cb(_0xeb73cb);})[_0x17de('0x11')](function(_0x4c27bc){logger[_0x17de('0xf')]('UpdateWhatsappQueueReport',_0x4c27bc[_0x17de('0x10')],_0x237f30);_0x5ad186(_0x15e52a['error'](0x1f4,_0x4c27bc[_0x17de('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index b62f8cb..1dc9071 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 _0x70b1=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','destroy'];(function(_0x72626b,_0x87a295){var _0x3e2ae1=function(_0x310fe0){while(--_0x310fe0){_0x72626b['push'](_0x72626b['shift']());}};_0x3e2ae1(++_0x87a295);}(_0x70b1,0x122));var _0x170b=function(_0x32cd29,_0x29f6bb){_0x32cd29=_0x32cd29-0x0;var _0x2f7e6e=_0x70b1[_0x32cd29];return _0x2f7e6e;};'use strict';var multer=require(_0x170b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x170b('0x1'));var router=express[_0x170b('0x2')]();var fs_extra=require(_0x170b('0x3'));var auth=require(_0x170b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x170b('0x5'));var controller=require(_0x170b('0x6'));router[_0x170b('0x7')]('/',auth[_0x170b('0x8')](),controller['index']);router[_0x170b('0x7')]('/describe',auth[_0x170b('0x8')](),controller[_0x170b('0x9')]);router['get'](_0x170b('0xa'),auth[_0x170b('0x8')](),controller[_0x170b('0xb')]);router['post']('/',auth[_0x170b('0x8')](),controller['create']);router[_0x170b('0xc')](_0x170b('0xa'),auth[_0x170b('0x8')](),controller[_0x170b('0xd')]);router[_0x170b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x170b('0xf')]);module[_0x170b('0x10')]=router; \ No newline at end of file +var _0x12ea=['/:id','post','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x17d1c9,_0xbbfa91){var _0x5521f6=function(_0x94c473){while(--_0x94c473){_0x17d1c9['push'](_0x17d1c9['shift']());}};_0x5521f6(++_0xbbfa91);}(_0x12ea,0x169));var _0xa12e=function(_0x133620,_0x296cd3){_0x133620=_0x133620-0x0;var _0x5e7fda=_0x12ea[_0x133620];return _0x5e7fda;};'use strict';var multer=require(_0xa12e('0x0'));var util=require(_0xa12e('0x1'));var path=require(_0xa12e('0x2'));var timeout=require(_0xa12e('0x3'));var express=require(_0xa12e('0x4'));var router=express['Router']();var fs_extra=require(_0xa12e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa12e('0x6'));var controller=require(_0xa12e('0x7'));router[_0xa12e('0x8')]('/',auth[_0xa12e('0x9')](),controller[_0xa12e('0xa')]);router[_0xa12e('0x8')](_0xa12e('0xb'),auth[_0xa12e('0x9')](),controller[_0xa12e('0xc')]);router[_0xa12e('0x8')](_0xa12e('0xd'),auth[_0xa12e('0x9')](),controller['show']);router[_0xa12e('0xe')]('/',auth[_0xa12e('0x9')](),controller['create']);router[_0xa12e('0xf')]('/:id',auth[_0xa12e('0x9')](),controller['update']);router['delete'](_0xa12e('0xd'),auth[_0xa12e('0x9')](),controller['destroy']);module[_0xa12e('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 53a6611..98d7eab 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 _0x4a1d=['sequelize','exports','STRING','ENUM','account','queue','DATE'];(function(_0x3be90e,_0x4eb546){var _0x2fae8f=function(_0x4d3f2){while(--_0x4d3f2){_0x3be90e['push'](_0x3be90e['shift']());}};_0x2fae8f(++_0x4eb546);}(_0x4a1d,0x77));var _0xd4a1=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x4a1d[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]={'uniqueid':{'type':Sequelize[_0xd4a1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd4a1('0x3')](_0xd4a1('0x4'),'agent',_0xd4a1('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd4a1('0x6')]}}; \ No newline at end of file +var _0x3176=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x539e6b,_0x184922){var _0x40a632=function(_0x30b9a8){while(--_0x30b9a8){_0x539e6b['push'](_0x539e6b['shift']());}};_0x40a632(++_0x184922);}(_0x3176,0x1d8));var _0x6317=function(_0x18b5a6,_0x5b97c9){_0x18b5a6=_0x18b5a6-0x0;var _0x4210ea=_0x3176[_0x18b5a6];return _0x4210ea;};'use strict';var Sequelize=require(_0x6317('0x0'));module[_0x6317('0x1')]={'uniqueid':{'type':Sequelize[_0x6317('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6317('0x3')](_0x6317('0x4'),_0x6317('0x5'),_0x6317('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6317('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index fe3ef9c..5248df6 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 _0xb6a1=['WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x2f8bc5,_0x12e3d1){var _0x2e4207=function(_0x217405){while(--_0x217405){_0x2f8bc5['push'](_0x2f8bc5['shift']());}};_0x2e4207(++_0x12e3d1);}(_0xb6a1,0x14d));var _0x1b6a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb6a1[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0x1b6a('0x0'));var rimraf=require(_0x1b6a('0x1'));var zipdir=require(_0x1b6a('0x2'));var jsonpatch=require(_0x1b6a('0x3'));var rp=require('request-promise');var moment=require(_0x1b6a('0x4'));var BPromise=require(_0x1b6a('0x5'));var Mustache=require(_0x1b6a('0x6'));var util=require('util');var path=require(_0x1b6a('0x7'));var sox=require('sox');var csv=require(_0x1b6a('0x8'));var ejs=require(_0x1b6a('0x9'));var fs=require('fs');var fs_extra=require(_0x1b6a('0xa'));var _=require('lodash');var squel=require(_0x1b6a('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b6a('0xc'));var deskjs=require(_0x1b6a('0xd'));var toCsv=require(_0x1b6a('0x8'));var querystring=require('querystring');var Papa=require(_0x1b6a('0xe'));var Redis=require(_0x1b6a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1b6a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b6a('0x11'))(_0x1b6a('0x12'));var utils=require(_0x1b6a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1b6a('0x14'));var db=require(_0x1b6a('0x15'))['db'];function respondWithStatusCode(_0x324d5b,_0x263c5b){_0x263c5b=_0x263c5b||0xcc;return function(_0x1adffd){if(_0x1adffd){return _0x324d5b['sendStatus'](_0x263c5b);}return _0x324d5b[_0x1b6a('0x16')](_0x263c5b)[_0x1b6a('0x17')]();};}function respondWithResult(_0x4985fa,_0x356129){_0x356129=_0x356129||0xc8;return function(_0x2cc1ff){if(_0x2cc1ff){return _0x4985fa[_0x1b6a('0x16')](_0x356129)[_0x1b6a('0x18')](_0x2cc1ff);}};}function respondWithFilteredResult(_0x2253da,_0x227ea7){return function(_0x22f1d2){if(_0x22f1d2){var _0xf834aa=typeof _0x227ea7[_0x1b6a('0x19')]===_0x1b6a('0x1a')&&typeof _0x227ea7[_0x1b6a('0x1b')]===_0x1b6a('0x1a');var _0x3062df=_0x22f1d2[_0x1b6a('0x1c')];var _0x31a74b=_0xf834aa?0x0:_0x227ea7['offset'];var _0xf3ab9c=_0xf834aa?_0x22f1d2['count']:_0x227ea7['offset']+_0x227ea7[_0x1b6a('0x1b')];var _0x46cc76;if(_0xf3ab9c>=_0x3062df){_0xf3ab9c=_0x3062df;_0x46cc76=0xc8;}else{_0x46cc76=0xce;}_0x2253da[_0x1b6a('0x16')](_0x46cc76);return _0x2253da[_0x1b6a('0x1d')](_0x1b6a('0x1e'),_0x31a74b+'-'+_0xf3ab9c+'/'+_0x3062df)[_0x1b6a('0x18')](_0x22f1d2);}return null;};}function patchUpdates(_0x4aaaaf){return function(_0x2497ec){try{jsonpatch[_0x1b6a('0x1f')](_0x2497ec,_0x4aaaaf,!![]);}catch(_0x5e5f6e){return BPromise[_0x1b6a('0x20')](_0x5e5f6e);}return _0x2497ec['save']();};}function saveUpdates(_0x519f69,_0x43ff9a){return function(_0x11f531){if(_0x11f531){return _0x11f531[_0x1b6a('0x21')](_0x519f69)[_0x1b6a('0x22')](function(_0x5347f7){return _0x5347f7;});}return null;};}function removeEntity(_0x2e23e4,_0x2b4a79){return function(_0x3c1b11){if(_0x3c1b11){return _0x3c1b11[_0x1b6a('0x23')]()['then'](function(){_0x2e23e4[_0x1b6a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bb8da,_0x3d65fe){return function(_0x4e307e){if(!_0x4e307e){_0x5bb8da['sendStatus'](0x194);}return _0x4e307e;};}function handleError(_0x4972fc,_0x494e85){_0x494e85=_0x494e85||0x1f4;return function(_0xa97d24){logger[_0x1b6a('0x24')](_0xa97d24[_0x1b6a('0x25')]);if(_0xa97d24[_0x1b6a('0x26')]){delete _0xa97d24[_0x1b6a('0x26')];}_0x4972fc[_0x1b6a('0x16')](_0x494e85)[_0x1b6a('0x27')](_0xa97d24);};}exports[_0x1b6a('0x28')]=function(_0x1220e0,_0x6f3094){var _0x108cfa={},_0x461cde={},_0x44b297={'count':0x0,'rows':[]};var _0x44f409=_[_0x1b6a('0x29')](db[_0x1b6a('0x2a')][_0x1b6a('0x2b')],function(_0x58312b){return{'name':_0x58312b[_0x1b6a('0x2c')],'type':_0x58312b[_0x1b6a('0x2d')][_0x1b6a('0x2e')]};});_0x461cde[_0x1b6a('0x2f')]=_[_0x1b6a('0x29')](_0x44f409,'name');_0x461cde[_0x1b6a('0x30')]=_[_0x1b6a('0x31')](_0x1220e0[_0x1b6a('0x30')]);_0x461cde[_0x1b6a('0x32')]=_[_0x1b6a('0x33')](_0x461cde['model'],_0x461cde[_0x1b6a('0x30')]);_0x108cfa[_0x1b6a('0x34')]=_[_0x1b6a('0x33')](_0x461cde[_0x1b6a('0x2f')],qs[_0x1b6a('0x35')](_0x1220e0['query'][_0x1b6a('0x35')]));_0x108cfa[_0x1b6a('0x34')]=_0x108cfa[_0x1b6a('0x34')]['length']?_0x108cfa[_0x1b6a('0x34')]:_0x461cde[_0x1b6a('0x2f')];if(!_0x1220e0[_0x1b6a('0x30')][_0x1b6a('0x36')](_0x1b6a('0x37'))){_0x108cfa[_0x1b6a('0x1b')]=qs[_0x1b6a('0x1b')](_0x1220e0['query'][_0x1b6a('0x1b')]);_0x108cfa[_0x1b6a('0x19')]=qs[_0x1b6a('0x19')](_0x1220e0['query'][_0x1b6a('0x19')]);}_0x108cfa[_0x1b6a('0x38')]=qs[_0x1b6a('0x39')](_0x1220e0[_0x1b6a('0x30')][_0x1b6a('0x39')]);_0x108cfa[_0x1b6a('0x3a')]=qs[_0x1b6a('0x32')](_[_0x1b6a('0x3b')](_0x1220e0[_0x1b6a('0x30')],_0x461cde['filters']),_0x44f409);if(_0x1220e0[_0x1b6a('0x30')][_0x1b6a('0x3c')]){_0x108cfa['where']=_[_0x1b6a('0x3d')](_0x108cfa[_0x1b6a('0x3a')],{'$or':_[_0x1b6a('0x29')](_0x44f409,function(_0x9b8da8){if(_0x9b8da8['type']!==_0x1b6a('0x3e')){var _0xd11b9b={};_0xd11b9b[_0x9b8da8[_0x1b6a('0x26')]]={'$like':'%'+_0x1220e0['query'][_0x1b6a('0x3c')]+'%'};return _0xd11b9b;}})});}_0x108cfa=_['merge']({},_0x108cfa,_0x1220e0['options']);var _0x50a9c0={'where':_0x108cfa[_0x1b6a('0x3a')]};return db[_0x1b6a('0x2a')]['count'](_0x50a9c0)['then'](function(_0xb2d3d8){_0x44b297[_0x1b6a('0x1c')]=_0xb2d3d8;if(_0x1220e0[_0x1b6a('0x30')][_0x1b6a('0x3f')]){_0x108cfa[_0x1b6a('0x40')]=[{'all':!![]}];}return db[_0x1b6a('0x2a')][_0x1b6a('0x41')](_0x108cfa);})[_0x1b6a('0x22')](function(_0x1fc4d){_0x44b297[_0x1b6a('0x42')]=_0x1fc4d;return _0x44b297;})[_0x1b6a('0x22')](respondWithFilteredResult(_0x6f3094,_0x108cfa))[_0x1b6a('0x43')](handleError(_0x6f3094,null));};exports[_0x1b6a('0x44')]=function(_0x126fa3,_0x5ba437){var _0x84f242={'raw':!![],'where':{'id':_0x126fa3[_0x1b6a('0x45')]['id']}},_0x54f0f5={};_0x54f0f5[_0x1b6a('0x2f')]=_['keys'](db[_0x1b6a('0x2a')][_0x1b6a('0x2b')]);_0x54f0f5[_0x1b6a('0x30')]=_[_0x1b6a('0x31')](_0x126fa3[_0x1b6a('0x30')]);_0x54f0f5[_0x1b6a('0x32')]=_['intersection'](_0x54f0f5[_0x1b6a('0x2f')],_0x54f0f5['query']);_0x84f242['attributes']=_['intersection'](_0x54f0f5[_0x1b6a('0x2f')],qs[_0x1b6a('0x35')](_0x126fa3[_0x1b6a('0x30')][_0x1b6a('0x35')]));_0x84f242[_0x1b6a('0x34')]=_0x84f242[_0x1b6a('0x34')][_0x1b6a('0x46')]?_0x84f242[_0x1b6a('0x34')]:_0x54f0f5[_0x1b6a('0x2f')];if(_0x126fa3[_0x1b6a('0x30')][_0x1b6a('0x3f')]){_0x84f242['include']=[{'all':!![]}];}_0x84f242=_[_0x1b6a('0x3d')]({},_0x84f242,_0x126fa3['options']);return db[_0x1b6a('0x2a')][_0x1b6a('0x47')](_0x84f242)[_0x1b6a('0x22')](handleEntityNotFound(_0x5ba437,null))[_0x1b6a('0x22')](respondWithResult(_0x5ba437,null))['catch'](handleError(_0x5ba437,null));};exports[_0x1b6a('0x48')]=function(_0x5316d0,_0x1c5943){return db[_0x1b6a('0x2a')][_0x1b6a('0x48')](_0x5316d0['body'],{})['then'](respondWithResult(_0x1c5943,0xc9))['catch'](handleError(_0x1c5943,null));};exports[_0x1b6a('0x21')]=function(_0x5efe5f,_0x2214ed){if(_0x5efe5f['body']['id']){delete _0x5efe5f[_0x1b6a('0x49')]['id'];}return db[_0x1b6a('0x2a')][_0x1b6a('0x47')]({'where':{'id':_0x5efe5f[_0x1b6a('0x45')]['id']}})[_0x1b6a('0x22')](handleEntityNotFound(_0x2214ed,null))[_0x1b6a('0x22')](saveUpdates(_0x5efe5f[_0x1b6a('0x49')],null))[_0x1b6a('0x22')](respondWithResult(_0x2214ed,null))['catch'](handleError(_0x2214ed,null));};exports[_0x1b6a('0x23')]=function(_0x3d9da8,_0x5b6ff1){return db[_0x1b6a('0x2a')][_0x1b6a('0x47')]({'where':{'id':_0x3d9da8[_0x1b6a('0x45')]['id']}})[_0x1b6a('0x22')](handleEntityNotFound(_0x5b6ff1,null))[_0x1b6a('0x22')](removeEntity(_0x5b6ff1,null))[_0x1b6a('0x43')](handleError(_0x5b6ff1,null));};exports[_0x1b6a('0x4a')]=function(_0x218095,_0x1d64f9){return db[_0x1b6a('0x2a')][_0x1b6a('0x4a')]()[_0x1b6a('0x22')](respondWithResult(_0x1d64f9,null))[_0x1b6a('0x43')](handleError(_0x1d64f9,null));}; \ No newline at end of file +var _0x2455=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','key','keys','filters','attributes','intersection','model','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x113299,_0x435768){var _0x194834=function(_0x488766){while(--_0x488766){_0x113299['push'](_0x113299['shift']());}};_0x194834(++_0x435768);}(_0x2455,0xd3));var _0x5245=function(_0x7d2272,_0x41f365){_0x7d2272=_0x7d2272-0x0;var _0x5bc56e=_0x2455[_0x7d2272];return _0x5bc56e;};'use strict';var emlformat=require(_0x5245('0x0'));var rimraf=require(_0x5245('0x1'));var zipdir=require(_0x5245('0x2'));var jsonpatch=require(_0x5245('0x3'));var rp=require(_0x5245('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5245('0x5'));var path=require(_0x5245('0x6'));var sox=require(_0x5245('0x7'));var csv=require(_0x5245('0x8'));var ejs=require(_0x5245('0x9'));var fs=require('fs');var fs_extra=require(_0x5245('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5245('0xb'));var jsforce=require(_0x5245('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5245('0x8'));var querystring=require(_0x5245('0xd'));var Papa=require(_0x5245('0xe'));var Redis=require('ioredis');var authService=require(_0x5245('0xf'));var qs=require(_0x5245('0x10'));var as=require(_0x5245('0x11'));var hardwareService=require(_0x5245('0x12'));var logger=require(_0x5245('0x13'))(_0x5245('0x14'));var utils=require(_0x5245('0x15'));var config=require(_0x5245('0x16'));var licenseUtil=require(_0x5245('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24e3a9,_0x122fd5){_0x122fd5=_0x122fd5||0xcc;return function(_0x4a032e){if(_0x4a032e){return _0x24e3a9[_0x5245('0x18')](_0x122fd5);}return _0x24e3a9[_0x5245('0x19')](_0x122fd5)[_0x5245('0x1a')]();};}function respondWithResult(_0x373f3e,_0x5236ac){_0x5236ac=_0x5236ac||0xc8;return function(_0x123288){if(_0x123288){return _0x373f3e[_0x5245('0x19')](_0x5236ac)[_0x5245('0x1b')](_0x123288);}};}function respondWithFilteredResult(_0x32b51f,_0x18aa4c){return function(_0x1b45a2){if(_0x1b45a2){var _0x21c0b8=typeof _0x18aa4c[_0x5245('0x1c')]===_0x5245('0x1d')&&typeof _0x18aa4c[_0x5245('0x1e')]===_0x5245('0x1d');var _0x5a4744=_0x1b45a2[_0x5245('0x1f')];var _0x2d5747=_0x21c0b8?0x0:_0x18aa4c[_0x5245('0x1c')];var _0x113907=_0x21c0b8?_0x1b45a2[_0x5245('0x1f')]:_0x18aa4c[_0x5245('0x1c')]+_0x18aa4c[_0x5245('0x1e')];var _0x3a32dc;if(_0x113907>=_0x5a4744){_0x113907=_0x5a4744;_0x3a32dc=0xc8;}else{_0x3a32dc=0xce;}_0x32b51f['status'](_0x3a32dc);return _0x32b51f[_0x5245('0x20')](_0x5245('0x21'),_0x2d5747+'-'+_0x113907+'/'+_0x5a4744)[_0x5245('0x1b')](_0x1b45a2);}return null;};}function patchUpdates(_0x1bc8bf){return function(_0x835e42){try{jsonpatch['apply'](_0x835e42,_0x1bc8bf,!![]);}catch(_0x4cc2cb){return BPromise[_0x5245('0x22')](_0x4cc2cb);}return _0x835e42[_0x5245('0x23')]();};}function saveUpdates(_0x41266e,_0x2998ac){return function(_0x53ce49){if(_0x53ce49){return _0x53ce49['update'](_0x41266e)[_0x5245('0x24')](function(_0xf04d29){return _0xf04d29;});}return null;};}function removeEntity(_0x3ba465,_0x4491ae){return function(_0x45db53){if(_0x45db53){return _0x45db53[_0x5245('0x25')]()[_0x5245('0x24')](function(){_0x3ba465['status'](0xcc)[_0x5245('0x1a')]();});}};}function handleEntityNotFound(_0x3f5a10,_0x5cc513){return function(_0x2ae391){if(!_0x2ae391){_0x3f5a10[_0x5245('0x18')](0x194);}return _0x2ae391;};}function handleError(_0x5e5847,_0x11cce5){_0x11cce5=_0x11cce5||0x1f4;return function(_0x4f0a2d){logger[_0x5245('0x26')](_0x4f0a2d[_0x5245('0x27')]);if(_0x4f0a2d['name']){delete _0x4f0a2d[_0x5245('0x28')];}_0x5e5847[_0x5245('0x19')](_0x11cce5)[_0x5245('0x29')](_0x4f0a2d);};}exports[_0x5245('0x2a')]=function(_0x20eb22,_0x4b26b9){var _0x3dd2f5={},_0x359153={},_0x1a5a5f={'count':0x0,'rows':[]};var _0x256c96=_['map'](db[_0x5245('0x2b')][_0x5245('0x2c')],function(_0x494a0a){return{'name':_0x494a0a[_0x5245('0x2d')],'type':_0x494a0a['type'][_0x5245('0x2e')]};});_0x359153['model']=_['map'](_0x256c96,_0x5245('0x28'));_0x359153['query']=_[_0x5245('0x2f')](_0x20eb22['query']);_0x359153[_0x5245('0x30')]=_['intersection'](_0x359153['model'],_0x359153['query']);_0x3dd2f5[_0x5245('0x31')]=_[_0x5245('0x32')](_0x359153[_0x5245('0x33')],qs[_0x5245('0x34')](_0x20eb22[_0x5245('0x35')][_0x5245('0x34')]));_0x3dd2f5[_0x5245('0x31')]=_0x3dd2f5[_0x5245('0x31')][_0x5245('0x36')]?_0x3dd2f5[_0x5245('0x31')]:_0x359153[_0x5245('0x33')];if(!_0x20eb22['query'][_0x5245('0x37')](_0x5245('0x38'))){_0x3dd2f5[_0x5245('0x1e')]=qs[_0x5245('0x1e')](_0x20eb22[_0x5245('0x35')]['limit']);_0x3dd2f5[_0x5245('0x1c')]=qs[_0x5245('0x1c')](_0x20eb22[_0x5245('0x35')][_0x5245('0x1c')]);}_0x3dd2f5[_0x5245('0x39')]=qs[_0x5245('0x3a')](_0x20eb22[_0x5245('0x35')][_0x5245('0x3a')]);_0x3dd2f5['where']=qs[_0x5245('0x30')](_[_0x5245('0x3b')](_0x20eb22[_0x5245('0x35')],_0x359153[_0x5245('0x30')]),_0x256c96);if(_0x20eb22[_0x5245('0x35')][_0x5245('0x3c')]){_0x3dd2f5[_0x5245('0x3d')]=_[_0x5245('0x3e')](_0x3dd2f5[_0x5245('0x3d')],{'$or':_[_0x5245('0x3f')](_0x256c96,function(_0x500a3e){if(_0x500a3e[_0x5245('0x40')]!==_0x5245('0x41')){var _0x462d39={};_0x462d39[_0x500a3e[_0x5245('0x28')]]={'$like':'%'+_0x20eb22['query'][_0x5245('0x3c')]+'%'};return _0x462d39;}})});}_0x3dd2f5=_[_0x5245('0x3e')]({},_0x3dd2f5,_0x20eb22[_0x5245('0x42')]);var _0x18d1a7={'where':_0x3dd2f5['where']};return db['WhatsappTransferReport'][_0x5245('0x1f')](_0x18d1a7)['then'](function(_0x44ddea){_0x1a5a5f['count']=_0x44ddea;if(_0x20eb22[_0x5245('0x35')]['includeAll']){_0x3dd2f5['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x5245('0x43')](_0x3dd2f5);})[_0x5245('0x24')](function(_0x3408a4){_0x1a5a5f[_0x5245('0x44')]=_0x3408a4;return _0x1a5a5f;})[_0x5245('0x24')](respondWithFilteredResult(_0x4b26b9,_0x3dd2f5))[_0x5245('0x45')](handleError(_0x4b26b9,null));};exports['show']=function(_0x4f6446,_0x481e95){var _0x5d90d9={'raw':!![],'where':{'id':_0x4f6446[_0x5245('0x46')]['id']}},_0x1cffb1={};_0x1cffb1[_0x5245('0x33')]=_[_0x5245('0x2f')](db[_0x5245('0x2b')][_0x5245('0x2c')]);_0x1cffb1[_0x5245('0x35')]=_[_0x5245('0x2f')](_0x4f6446['query']);_0x1cffb1['filters']=_[_0x5245('0x32')](_0x1cffb1[_0x5245('0x33')],_0x1cffb1['query']);_0x5d90d9[_0x5245('0x31')]=_[_0x5245('0x32')](_0x1cffb1['model'],qs[_0x5245('0x34')](_0x4f6446['query'][_0x5245('0x34')]));_0x5d90d9['attributes']=_0x5d90d9[_0x5245('0x31')][_0x5245('0x36')]?_0x5d90d9['attributes']:_0x1cffb1[_0x5245('0x33')];if(_0x4f6446[_0x5245('0x35')][_0x5245('0x47')]){_0x5d90d9[_0x5245('0x48')]=[{'all':!![]}];}_0x5d90d9=_[_0x5245('0x3e')]({},_0x5d90d9,_0x4f6446[_0x5245('0x42')]);return db[_0x5245('0x2b')][_0x5245('0x49')](_0x5d90d9)[_0x5245('0x24')](handleEntityNotFound(_0x481e95,null))[_0x5245('0x24')](respondWithResult(_0x481e95,null))[_0x5245('0x45')](handleError(_0x481e95,null));};exports[_0x5245('0x4a')]=function(_0x3acd66,_0xb52e23){return db[_0x5245('0x2b')][_0x5245('0x4a')](_0x3acd66[_0x5245('0x4b')],{})[_0x5245('0x24')](respondWithResult(_0xb52e23,0xc9))[_0x5245('0x45')](handleError(_0xb52e23,null));};exports[_0x5245('0x4c')]=function(_0x19da3f,_0x253861){if(_0x19da3f[_0x5245('0x4b')]['id']){delete _0x19da3f[_0x5245('0x4b')]['id'];}return db[_0x5245('0x2b')]['find']({'where':{'id':_0x19da3f[_0x5245('0x46')]['id']}})['then'](handleEntityNotFound(_0x253861,null))[_0x5245('0x24')](saveUpdates(_0x19da3f[_0x5245('0x4b')],null))['then'](respondWithResult(_0x253861,null))['catch'](handleError(_0x253861,null));};exports[_0x5245('0x25')]=function(_0x68eb02,_0x1c1422){return db[_0x5245('0x2b')]['find']({'where':{'id':_0x68eb02[_0x5245('0x46')]['id']}})[_0x5245('0x24')](handleEntityNotFound(_0x1c1422,null))[_0x5245('0x24')](removeEntity(_0x1c1422,null))[_0x5245('0x45')](handleError(_0x1c1422,null));};exports[_0x5245('0x4d')]=function(_0x5843be,_0x5ac2a2){return db[_0x5245('0x2b')][_0x5245('0x4d')]()[_0x5245('0x24')](respondWithResult(_0x5ac2a2,null))['catch'](handleError(_0x5ac2a2,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d2695cb..9bacb68 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 _0xc8bd=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x5465b1,_0x2fab19){var _0x87b4c=function(_0x3f0089){while(--_0x3f0089){_0x5465b1['push'](_0x5465b1['shift']());}};_0x87b4c(++_0x2fab19);}(_0xc8bd,0xe2));var _0xdc8b=function(_0x4e96a4,_0x207e09){_0x4e96a4=_0x4e96a4-0x0;var _0x1beafa=_0xc8bd[_0x4e96a4];return _0x1beafa;};'use strict';var _=require(_0xdc8b('0x0'));var util=require(_0xdc8b('0x1'));var logger=require(_0xdc8b('0x2'))(_0xdc8b('0x3'));var moment=require(_0xdc8b('0x4'));var BPromise=require(_0xdc8b('0x5'));var rp=require(_0xdc8b('0x6'));var fs=require('fs');var path=require(_0xdc8b('0x7'));var rimraf=require(_0xdc8b('0x8'));var config=require(_0xdc8b('0x9'));var attributes=require(_0xdc8b('0xa'));module[_0xdc8b('0xb')]=function(_0x4b2305,_0x4bd6c0){return _0x4b2305[_0xdc8b('0xc')](_0xdc8b('0xd'),attributes,{'tableName':_0xdc8b('0xe'),'paranoid':![],'indexes':[{'name':_0xdc8b('0xf'),'fields':[_0xdc8b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c3a=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappTransferReport','uniqueid'];(function(_0x49e5bd,_0x5c6768){var _0x4609ff=function(_0x45169e){while(--_0x45169e){_0x49e5bd['push'](_0x49e5bd['shift']());}};_0x4609ff(++_0x5c6768);}(_0x6c3a,0x1d4));var _0xa6c3=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x6c3a[_0x1a0600];return _0x734670;};'use strict';var _=require(_0xa6c3('0x0'));var util=require(_0xa6c3('0x1'));var logger=require(_0xa6c3('0x2'))('api');var moment=require(_0xa6c3('0x3'));var BPromise=require(_0xa6c3('0x4'));var rp=require(_0xa6c3('0x5'));var fs=require('fs');var path=require(_0xa6c3('0x6'));var rimraf=require('rimraf');var config=require(_0xa6c3('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xa6c3('0x8')]=function(_0x50f3c3,_0x585b01){return _0x50f3c3[_0xa6c3('0x9')](_0xa6c3('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xa6c3('0xb'),'fields':[_0xa6c3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 89dc8fb..e95f5a1 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 _0x0d1a=['client','request','then','info','request\x20sent','debug','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x130209,_0x2cc129){var _0x155fb7=function(_0x891a60){while(--_0x891a60){_0x130209['push'](_0x130209['shift']());}};_0x155fb7(++_0x2cc129);}(_0x0d1a,0x11d));var _0xa0d1=function(_0x4d3e47,_0x29e35){_0x4d3e47=_0x4d3e47-0x0;var _0x2c486e=_0x0d1a[_0x4d3e47];return _0x2c486e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa0d1('0x0'));var BPromise=require('bluebird');var rs=require(_0xa0d1('0x1'));var fs=require('fs');var Redis=require(_0xa0d1('0x2'));var db=require(_0xa0d1('0x3'))['db'];var utils=require(_0xa0d1('0x4'));var logger=require(_0xa0d1('0x5'))(_0xa0d1('0x6'));var config=require(_0xa0d1('0x7'));var jayson=require(_0xa0d1('0x8'));var client=jayson[_0xa0d1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bac46,_0x3430ca,_0x142daf){return new BPromise(function(_0x2c265d,_0x40bebd){return client[_0xa0d1('0xa')](_0x3bac46,_0x142daf)[_0xa0d1('0xb')](function(_0xa7c8bb){logger[_0xa0d1('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3430ca,_0xa0d1('0xd'));logger[_0xa0d1('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x3430ca,_0xa0d1('0xd'),JSON['stringify'](_0xa7c8bb));if(_0xa7c8bb['error']){if(_0xa7c8bb[_0xa0d1('0xf')][_0xa0d1('0x10')]===0x1f4){logger['error'](_0xa0d1('0x11'),_0x3430ca,_0xa7c8bb[_0xa0d1('0xf')][_0xa0d1('0x12')]);return _0x40bebd(_0xa7c8bb[_0xa0d1('0xf')][_0xa0d1('0x12')]);}logger[_0xa0d1('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3430ca,_0xa7c8bb[_0xa0d1('0xf')][_0xa0d1('0x12')]);return _0x2c265d(_0xa7c8bb[_0xa0d1('0xf')][_0xa0d1('0x12')]);}else{logger[_0xa0d1('0xc')](_0xa0d1('0x11'),_0x3430ca,_0xa0d1('0xd'));_0x2c265d(_0xa7c8bb[_0xa0d1('0x13')][_0xa0d1('0x12')]);}})[_0xa0d1('0x14')](function(_0x16e1f6){logger['error'](_0xa0d1('0x11'),_0x3430ca,_0x16e1f6);_0x40bebd(_0x16e1f6);});});} \ No newline at end of file +var _0x9deb=['../../config/environment','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9deb,0xfc));var _0xb9de=function(_0x3c925b,_0x5d4141){_0x3c925b=_0x3c925b-0x0;var _0x338062=_0x9deb[_0x3c925b];return _0x338062;};'use strict';var _=require(_0xb9de('0x0'));var util=require(_0xb9de('0x1'));var moment=require(_0xb9de('0x2'));var BPromise=require(_0xb9de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9de('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9de('0x5'));var logger=require(_0xb9de('0x6'))(_0xb9de('0x7'));var config=require(_0xb9de('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb9de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44ee1d,_0x200fee,_0x2bba03){return new BPromise(function(_0x1af109,_0x59c1ab){return client['request'](_0x44ee1d,_0x2bba03)[_0xb9de('0xa')](function(_0x1d4c42){logger[_0xb9de('0xb')](_0xb9de('0xc'),_0x200fee,_0xb9de('0xd'));logger['debug'](_0xb9de('0xe'),_0x200fee,_0xb9de('0xd'),JSON[_0xb9de('0xf')](_0x1d4c42));if(_0x1d4c42[_0xb9de('0x10')]){if(_0x1d4c42[_0xb9de('0x10')][_0xb9de('0x11')]===0x1f4){logger[_0xb9de('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x200fee,_0x1d4c42[_0xb9de('0x10')][_0xb9de('0x12')]);return _0x59c1ab(_0x1d4c42['error']['message']);}logger[_0xb9de('0x10')](_0xb9de('0xc'),_0x200fee,_0x1d4c42[_0xb9de('0x10')][_0xb9de('0x12')]);return _0x1af109(_0x1d4c42[_0xb9de('0x10')][_0xb9de('0x12')]);}else{logger[_0xb9de('0xb')](_0xb9de('0xc'),_0x200fee,_0xb9de('0xd'));_0x1af109(_0x1d4c42[_0xb9de('0x13')]['message']);}})['catch'](function(_0x2f2f4e){logger[_0xb9de('0x10')](_0xb9de('0xc'),_0x200fee,_0x2f2f4e);_0x59c1ab(_0x2f2f4e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9b80bb8..09e0e35 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6bb=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','info','start','filter','exitCode','number','length','Online\x20apps:','map','online','name','join','Offline\x20apps:','status','None','log'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0xa6bb,0x12c));var _0xba6b=function(_0x2eae6e,_0x12944a){_0x2eae6e=_0x2eae6e-0x0;var _0x24800b=_0xa6bb[_0x2eae6e];return _0x24800b;};'use strict';var _=require('lodash');var db=require(_0xba6b('0x0'))['db'];var seedDb=require(_0xba6b('0x1'));var checkLicense=require(_0xba6b('0x2'));var rpc=require(_0xba6b('0x3'));var config=require(_0xba6b('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0xba6b('0x5'));var pm2Config=require(_0xba6b('0x6'));var schedule=require(_0xba6b('0x7'));var chat=require(_0xba6b('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xba6b('0x9'));function main(){return db[_0xba6b('0xa')][_0xba6b('0xb')]()['then'](function(){if(config['seedDB']){return seedDb[_0xba6b('0xc')]();}})[_0xba6b('0xd')](function(){return checkLicense[_0xba6b('0xc')]();})[_0xba6b('0xd')](function(){return rpc[_0xba6b('0xe')]();})['then'](function(_0x17e6c8){logger[_0xba6b('0xf')](_0x17e6c8);return chat[_0xba6b('0x10')]();})['then'](function(){return whatsapp[_0xba6b('0x10')]();})[_0xba6b('0xd')](function(){return schedule[_0xba6b('0x10')]();})[_0xba6b('0xd')](function(){return transcribe['start']();})[_0xba6b('0xd')](function(){return provider['start']();})[_0xba6b('0xd')](function(_0x1adc27){logger[_0xba6b('0xf')](_0x1adc27);return pm2[_0xba6b('0x10')](pm2Config);})[_0xba6b('0xd')](function(_0x53ec00){var _0x309d5f=_0x53ec00[_0xba6b('0x11')](function(_0x50b58a){return typeof _0x50b58a[_0xba6b('0x12')]===_0xba6b('0x13')&&_0x50b58a['exitCode']>=0x0;});if(_0x309d5f['length']>0x0){throw new Error(_0x309d5f[_0xba6b('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x309d5f,function(_0x5a553c){return'\x22'+_0x5a553c['pm2_env']['name']+'\x22';}));}logger[_0xba6b('0xf')](_0xba6b('0x15'),_[_0xba6b('0x16')](_[_0xba6b('0x11')](_0x53ec00,{'status':_0xba6b('0x17')}),_0xba6b('0x18'))[_0xba6b('0x19')]());logger['info'](_0xba6b('0x1a'),_['map'](_['filter'](_0x53ec00,function(_0x13beca){return _0x13beca[_0xba6b('0x1b')]!==_0xba6b('0x17');}),_0xba6b('0x18'))['join']()||_0xba6b('0x1c'));console[_0xba6b('0x1d')]('App\x20Ready!');})[_0xba6b('0x1e')](function(_0xe73cf4){console[_0xba6b('0x1d')](_0xba6b('0x1f'),_0xe73cf4);logger[_0xba6b('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xe73cf4);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x5a63=['default','listen','info','start','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','filter','status','None','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x5a63,0xe3));var _0x35a6=function(_0x19dcdb,_0x18e723){_0x19dcdb=_0x19dcdb-0x0;var _0x295ea5=_0x5a63[_0x19dcdb];return _0x295ea5;};'use strict';var _=require(_0x35a6('0x0'));var db=require(_0x35a6('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0x35a6('0x2'));var config=require('./config/environment');var logger=require('./config/logger')(_0x35a6('0x3'));var pm2=require(_0x35a6('0x4'));var pm2Config=require(_0x35a6('0x5'));var schedule=require(_0x35a6('0x6'));var chat=require(_0x35a6('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x35a6('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x35a6('0x9')]['sync']()[_0x35a6('0xa')](function(){if(config['seedDB']){return seedDb[_0x35a6('0xb')]();}})[_0x35a6('0xa')](function(){return checkLicense[_0x35a6('0xb')]();})[_0x35a6('0xa')](function(){return rpc[_0x35a6('0xc')]();})['then'](function(_0x2899a8){logger[_0x35a6('0xd')](_0x2899a8);return chat[_0x35a6('0xe')]();})['then'](function(){return whatsapp[_0x35a6('0xe')]();})['then'](function(){return schedule[_0x35a6('0xe')]();})[_0x35a6('0xa')](function(){return transcribe[_0x35a6('0xe')]();})[_0x35a6('0xa')](function(){return provider[_0x35a6('0xe')]();})['then'](function(_0x436c0a){logger[_0x35a6('0xd')](_0x436c0a);return pm2[_0x35a6('0xe')](pm2Config);})[_0x35a6('0xa')](function(_0x250c7){var _0x30154b=_0x250c7['filter'](function(_0x32347a){return typeof _0x32347a[_0x35a6('0xf')]===_0x35a6('0x10')&&_0x32347a[_0x35a6('0xf')]>=0x0;});if(_0x30154b[_0x35a6('0x11')]>0x0){throw new Error(_0x30154b[_0x35a6('0x11')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x35a6('0x12')](_0x30154b,function(_0x4047d2){return'\x22'+_0x4047d2[_0x35a6('0x13')][_0x35a6('0x14')]+'\x22';}));}logger[_0x35a6('0xd')](_0x35a6('0x15'),_[_0x35a6('0x12')](_['filter'](_0x250c7,{'status':_0x35a6('0x16')}),_0x35a6('0x14'))[_0x35a6('0x17')]());logger['info'](_0x35a6('0x18'),_[_0x35a6('0x12')](_[_0x35a6('0x19')](_0x250c7,function(_0x4a68b6){return _0x4a68b6[_0x35a6('0x1a')]!==_0x35a6('0x16');}),'name')[_0x35a6('0x17')]()||_0x35a6('0x1b'));console['log']('App\x20Ready!');})[_0x35a6('0x1c')](function(_0x13f029){console[_0x35a6('0x1d')](_0x35a6('0x1e'),_0x13f029);logger[_0x35a6('0x1f')](_0x35a6('0x20'),_0x13f029);process[_0x35a6('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index fea5d4d..a68a16b 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 _0x1bd9=['getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','unshift','encryptString','join','sign','secret','secrets','payload','options','promisify','verify','randomBytes','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','session','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','then','forceDownload','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','User','find','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate'];(function(_0x261832,_0x5a24e6){var _0x186143=function(_0x54e5d8){while(--_0x54e5d8){_0x261832['push'](_0x261832['shift']());}};_0x186143(++_0x5a24e6);}(_0x1bd9,0xb9));var _0x91bd=function(_0x1763bd,_0x174df2){_0x1763bd=_0x1763bd-0x0;var _0x33efc2=_0x1bd9[_0x1763bd];return _0x33efc2;};'use strict';var db=require(_0x91bd('0x0'))['db'];var config=require(_0x91bd('0x1'));var hardwareConf=require(_0x91bd('0x2'));var licenseUtil=require(_0x91bd('0x3'));var encryptor=require(_0x91bd('0x4'));var _=require(_0x91bd('0x5'));var jwt=require(_0x91bd('0x6'));var expressJwt=require(_0x91bd('0x7'));var compose=require(_0x91bd('0x8'));var basicAuth=require(_0x91bd('0x9'));var crypto=require(_0x91bd('0xa'));var BPromise=require('bluebird');var util=require(_0x91bd('0xb'));var moment=require(_0x91bd('0xc'));var validateJwt=expressJwt({'secret':config['secrets'][_0x91bd('0xd')]});var userAttributes=['id','role',_0x91bd('0xe'),_0x91bd('0xf'),_0x91bd('0x10'),'email',_0x91bd('0x11'),_0x91bd('0x12'),_0x91bd('0x13'),_0x91bd('0x14'),_0x91bd('0x15'),_0x91bd('0x16'),_0x91bd('0x17'),_0x91bd('0x18'),'openchannelPause',_0x91bd('0x19'),_0x91bd('0x1a'),_0x91bd('0x1b'),'lastPauseAt',_0x91bd('0x1c'),_0x91bd('0x1d'),_0x91bd('0x1e'),_0x91bd('0x1f'),_0x91bd('0x20'),_0x91bd('0x21'),_0x91bd('0x22'),_0x91bd('0x23'),_0x91bd('0x24'),_0x91bd('0x25'),'phoneBarExpires',_0x91bd('0x26'),_0x91bd('0x27'),'phoneBarRemoteControlPort','hotdesk',_0x91bd('0x28'),_0x91bd('0x29'),_0x91bd('0x2a'),_0x91bd('0x2b'),_0x91bd('0x2c'),'downloadVoiceRecordings',_0x91bd('0x2d'),_0x91bd('0x2e'),'ignorePauseForPreviewCalls',_0x91bd('0x2f'),_0x91bd('0x30'),_0x91bd('0x31'),_0x91bd('0x32'),_0x91bd('0x33'),'smsAutoanswer','smsAutoanswerDelay',_0x91bd('0x34'),_0x91bd('0x35'),_0x91bd('0x36'),_0x91bd('0x37'),_0x91bd('0x38'),_0x91bd('0x39'),'messengerSoundNotification'];exports[_0x91bd('0x3a')]=function(){return this[_0x91bd('0x3b')](!![])[_0x91bd('0x3c')](function(_0x280dd4,_0x352e44,_0x15fb17){if(_0x280dd4[_0x91bd('0x3d')]){_0x15fb17();}else{return db[_0x91bd('0x3e')][_0x91bd('0x3f')]({'where':{'id':_0x280dd4[_0x91bd('0x40')]['id']},'attributes':['id',_0x91bd('0x41'),'disposition'],'raw':!![]})[_0x91bd('0x42')](function(_0x278cd9){if(_0x278cd9&&_0x278cd9[_0x91bd('0x41')]&&!_0x280dd4['query'][_0x91bd('0x43')]){return _0x352e44[_0x91bd('0x44')](_0x278cd9[_0x91bd('0x45')]===_0x91bd('0x46')?0x195:0x193)[_0x91bd('0x47')]({'message':_0x278cd9[_0x91bd('0x45')]===_0x91bd('0x46')?_0x91bd('0x48'):_0x91bd('0x49')});}else{_0x15fb17();}})[_0x91bd('0x4a')](function(_0x766d92){_0x15fb17(_0x766d92);});}});};exports[_0x91bd('0x3b')]=function isAuthenticated(_0x25cbd6){return compose()[_0x91bd('0x3c')](function(_0x17d300,_0x9f40b2,_0x3cf6cd){var _0x2059c1;if(_0x17d300['headers'][_0x91bd('0x4b')]){if(_[_0x91bd('0x4c')](_0x17d300[_0x91bd('0x4d')][_0x91bd('0x4b')],'Basic')){var _0x47c83b=basicAuth(_0x17d300);db[_0x91bd('0x4e')][_0x91bd('0x4f')]({'where':{'name':_0x47c83b[_0x91bd('0xf')]}})['then'](function(_0x40ba0b){if(!_0x40ba0b||!_0x40ba0b['authenticate'](_0x47c83b['pass'])){return _0x9f40b2[_0x91bd('0x44')](0x191)[_0x91bd('0x47')]({'message':'Wrong\x20credentials.'});}_0x17d300[_0x91bd('0x3d')]={'id':_0x40ba0b['id']};_0x3cf6cd();})[_0x91bd('0x4a')](function(_0x145487){_0x3cf6cd(_0x145487);});}else if(_[_0x91bd('0x4c')](_0x17d300[_0x91bd('0x4d')]['authorization'],'Bearer')){validateJwt(_0x17d300,_0x9f40b2,_0x3cf6cd);}else{if(_0x25cbd6){_0x3cf6cd();}else{return _0x9f40b2['status'](0x193)[_0x91bd('0x47')]({'message':_0x91bd('0x50')});}}}else if(_0x17d300[_0x91bd('0x51')][_0x91bd('0x52')]){try{var _0x16ef8d={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x91bd('0x53')]()};verifyJwt(_0x17d300[_0x91bd('0x51')][_0x91bd('0x52')],_0x16ef8d)[_0x91bd('0x42')](function(_0x119d76){return db[_0x91bd('0x4e')]['find']({'where':{'id':_0x119d76[_0x91bd('0x54')]}})[_0x91bd('0x42')](function(_0x2f5614){_0x2059c1=_0x2f5614;return db[_0x91bd('0x55')][_0x91bd('0x3f')]({'where':{'id':0x1},'attributes':[_0x91bd('0x56'),'blockDuration'],'raw':!![]});})['then'](function(_0x2c89b9){if(!_0x2059c1||!_[_0x91bd('0x57')](_0x2059c1['apiKeyNonce'],_0x119d76[_0x91bd('0x58')])){return _0x9f40b2[_0x91bd('0x44')](0x191)[_0x91bd('0x47')]({'message':_0x91bd('0x59')});}if(_0x2059c1['disabled']){return _0x9f40b2[_0x91bd('0x44')](0x191)[_0x91bd('0x47')]({'message':_0x91bd('0x5a')});}if(_0x2059c1[_0x91bd('0x5b')]){if(_0x2c89b9[_0x91bd('0x5c')]>0x0){if(moment(_0x2059c1[_0x91bd('0x5d')])[_0x91bd('0x5e')](_0x2c89b9['blockDuration'],_0x91bd('0x5f'))>moment()){return _0x9f40b2['status'](0x191)[_0x91bd('0x47')]({'message':_0x91bd('0x5a')});}}else{return _0x9f40b2[_0x91bd('0x44')](0x191)[_0x91bd('0x47')]({'message':_0x91bd('0x5a')});}}_0x17d300[_0x91bd('0x3d')]={'id':_0x2059c1['id']};_0x3cf6cd();});})['catch'](function(){return _0x9f40b2[_0x91bd('0x44')](0x191)[_0x91bd('0x47')]({'message':_0x91bd('0x5a')});});}catch(_0x5a2d4f){_0x3cf6cd(_0x5a2d4f);}}else if(_0x25cbd6){_0x3cf6cd();}else{return _0x9f40b2[_0x91bd('0x44')](0x193)['json']({'message':_0x91bd('0x50')});}})[_0x91bd('0x3c')](function(_0x19ca27,_0x1891c2,_0x41985a){if(_0x19ca27[_0x91bd('0x3d')]){db[_0x91bd('0x4e')][_0x91bd('0x4f')]({'where':{'id':_0x19ca27[_0x91bd('0x3d')]['id']},'attributes':userAttributes})[_0x91bd('0x42')](function(_0x572a2d){if(!_0x572a2d){return _0x1891c2[_0x91bd('0x44')](0x194)[_0x91bd('0x47')]({'message':_0x91bd('0x60')});}_0x19ca27[_0x91bd('0x3d')]=_0x572a2d;_0x41985a();})[_0x91bd('0x4a')](function(_0x5ad0bc){_0x41985a(_0x5ad0bc);});}else if(_0x25cbd6){_0x41985a();}else{return _0x1891c2[_0x91bd('0x44')](0x194)[_0x91bd('0x47')]({'message':_0x91bd('0x61')});}});};exports[_0x91bd('0x62')]=function canUpdate(){return compose()[_0x91bd('0x3c')](function(_0x561f16,_0x525508,_0x1ac17c){return licenseUtil[_0x91bd('0x63')]()[_0x91bd('0x42')](function(_0x3d0cb1){if(_0x3d0cb1[_0x91bd('0x64')]){_0x1ac17c();}else{return _0x525508[_0x91bd('0x44')](0x193)['json']({'message':'Forbidden'});}})[_0x91bd('0x4a')](function(_0x33dcab){_0x1ac17c(_0x33dcab);});});};exports[_0x91bd('0x65')]=function isWebrtcLicence(){return compose()[_0x91bd('0x3c')](function(_0x458d8a,_0x48d19f,_0x54786d){return licenseUtil[_0x91bd('0x63')]()[_0x91bd('0x42')](function(_0x2b52f0){if(_0x2b52f0['webrtc']){_0x54786d();}else{return _0x48d19f['status'](0x193)[_0x91bd('0x47')]({'message':_0x91bd('0x66')});}})[_0x91bd('0x4a')](function(_0x319d60){_0x54786d(_0x319d60);});});};exports[_0x91bd('0x67')]=function(_0x145d29,_0x572554,_0x49e285){_0x145d29['isMiddleware']=!![];return _0x49e285();};exports['signToken']=function signToken(_0x23d411){return signJwt(_0x23d411);};exports[_0x91bd('0x68')]=function(_0x4d90bd,_0x4236e6){if(!_0x4d90bd[_0x91bd('0x3d')]){return _0x4236e6[_0x91bd('0x44')](0x194)[_0x91bd('0x47')]({'message':_0x91bd('0x69')});}var _0x3c82f8={'payload':{'id':_0x4d90bd[_0x91bd('0x3d')]['id'],'role':_0x4d90bd[_0x91bd('0x3d')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3c82f8)[_0x91bd('0x42')](function(_0x3d5606){_0x4236e6['cookie'](_0x91bd('0x6a'),_0x3d5606);_0x4236e6[_0x91bd('0x6b')](_0x91bd('0x6c'));})[_0x91bd('0x4a')](function(_0x4cdbb6){return _0x4236e6[_0x91bd('0x44')](0x1f4)[_0x91bd('0x6d')](_0x4cdbb6);});};exports[_0x91bd('0x6e')]=function(_0x5237f7){if(_[_0x91bd('0x6f')](_0x5237f7['apiKeyNonce'])||_[_0x91bd('0x6f')](_0x5237f7[_0x91bd('0x70')])){return null;}else{return createJwt(_0x5237f7);}};exports[_0x91bd('0x71')]=function(_0x3d0e1e){_0x3d0e1e['apiKeyNonce']=generateNonce();_0x3d0e1e[_0x91bd('0x70')]=generateIssuedAt();return createJwt(_0x3d0e1e);};exports['regenerateApiKey']=function(_0x230512,_0x3ccc9b){var _0x2a1931=_0x230512[_0x91bd('0x51')][_0x91bd('0x52')];if(_0x2a1931){var _0x57fbf0={'nonce':_0x3ccc9b[_0x91bd('0x72')],'iat':_0x3ccc9b['apiKeyIat'],'audience':hardwareConf[_0x91bd('0x53')](),'issuer':hardwareConf[_0x91bd('0x53')]()};return verifyJwt(_0x2a1931,_0x57fbf0)['then'](function(){return generateApiKey(_0x3ccc9b);});}else{throw{'message':_0x91bd('0x73')};}};exports[_0x91bd('0x74')]=function(_0x26783e){var _0x5d694e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5d694e[_0x91bd('0x75')](_0x26783e))throw new db[(_0x91bd('0x76'))][(_0x91bd('0x77'))](_0x91bd('0x78'));return;};exports[_0x91bd('0x79')]=function(_0x22c4bf,_0x8c8cc4,_0x4c168d){var _0x5491d2=encryptor['decryptString'](_0x8c8cc4)['split'](',');for(var _0x32e2a0=0x0;_0x32e2a0<_0x4c168d;_0x32e2a0++){if(!_0x5491d2[_0x32e2a0])break;if(_0x22c4bf[_0x91bd('0x7a')]()===_0x5491d2[_0x32e2a0][_0x91bd('0x7a')]()){var _0x4339cc=util[_0x91bd('0x7b')](_0x91bd('0x7c'),_0x4c168d);if(_0x4c168d===0x1){_0x4339cc=_0x91bd('0x7d');}throw new db[(_0x91bd('0x76'))][(_0x91bd('0x77'))](_0x4339cc);}}return;};exports[_0x91bd('0x7e')]=function(_0x46c301,_0x42a181){var _0xb6cf6a=_0x42a181?encryptor['decryptString'](_0x42a181)[_0x91bd('0x7f')](','):[];if(_0xb6cf6a[_0x91bd('0x80')]===0x5){_0xb6cf6a['splice'](-0x1,0x1);}_0xb6cf6a[_0x91bd('0x81')](_0x46c301);return encryptor[_0x91bd('0x82')](_0xb6cf6a[_0x91bd('0x83')](','));};function signJwt(_0x4a52ea){var _0xbd989=BPromise['promisify'](jwt[_0x91bd('0x84')],{'context':jwt});var _0x4bf53a=_0x4a52ea[_0x91bd('0x85')]||config[_0x91bd('0x86')]['session'];return new BPromise(function(_0x4e50ce,_0x5cfa70){_0xbd989(_0x4a52ea[_0x91bd('0x87')],_0x4bf53a,_0x4a52ea[_0x91bd('0x88')])[_0x91bd('0x42')](function(_0x3be600){_0x4e50ce(_0x3be600);})[_0x91bd('0x4a')](function(_0x4c1ee8){_0x5cfa70(_0x4c1ee8);});});}function verifyJwt(_0x23c052,_0x303c81,_0x2f8dd5){var _0x5d8d88=BPromise[_0x91bd('0x89')](jwt[_0x91bd('0x8a')],{'context':jwt});var _0x391863=_0x2f8dd5||config[_0x91bd('0x86')][_0x91bd('0xd')];return new BPromise(function(_0x3221b9,_0xb9e657){_0x5d8d88(_0x23c052,_0x391863,_0x303c81)[_0x91bd('0x42')](function(_0x40745d){_0x3221b9(_0x40745d);})[_0x91bd('0x4a')](function(_0xd3c148){_0xb9e657(_0xd3c148);});});}function generateNonce(){return crypto[_0x91bd('0x8b')](0x10)[_0x91bd('0x8c')](_0x91bd('0x8d'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x91bd('0x8c')]();}function createJwt(_0x3a553c){var _0x2ecc54={'payload':{'iat':_0x3a553c[_0x91bd('0x70')],'nonce':_0x3a553c['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x3a553c['id'][_0x91bd('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x91bd('0x53')]()}};return signJwt(_0x2ecc54)[_0x91bd('0x42')](function(_0x7bd3b8){return{'iat':_0x3a553c[_0x91bd('0x70')],'nonce':_0x3a553c[_0x91bd('0x72')],'token':_0x7bd3b8};});} \ No newline at end of file +var _0x84f5=['Unknown\x20authorization\x20format','getUuid','query','find','Setting','allowedLoginAttempts','blockDuration','isEqual','disabled','blocked','add','minutes','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','encryptString','join','sign','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','fullname','name','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','forceDownload','status','unmanaged','Unmanaged.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','then','authenticate','pass','json','Wrong\x20credentials.','Bearer'];(function(_0x2c6c5a,_0xf19dff){var _0x16551b=function(_0x250909){while(--_0x250909){_0x2c6c5a['push'](_0x2c6c5a['shift']());}};_0x16551b(++_0xf19dff);}(_0x84f5,0xbc));var _0x584f=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x84f5[_0x3b594b];return _0x1ea5f8;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x584f('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x584f('0x1'));var encryptor=require(_0x584f('0x2'));var _=require(_0x584f('0x3'));var jwt=require(_0x584f('0x4'));var expressJwt=require(_0x584f('0x5'));var compose=require(_0x584f('0x6'));var basicAuth=require(_0x584f('0x7'));var crypto=require(_0x584f('0x8'));var BPromise=require(_0x584f('0x9'));var util=require('util');var moment=require(_0x584f('0xa'));var validateJwt=expressJwt({'secret':config[_0x584f('0xb')][_0x584f('0xc')]});var userAttributes=['id','role',_0x584f('0xd'),_0x584f('0xe'),_0x584f('0xf'),_0x584f('0x10'),'userpic','permissions',_0x584f('0x11'),_0x584f('0x12'),_0x584f('0x13'),_0x584f('0x14'),_0x584f('0x15'),_0x584f('0x16'),_0x584f('0x17'),_0x584f('0x18'),'showWebBar',_0x584f('0x19'),_0x584f('0x1a'),'crudPermissions',_0x584f('0x1b'),_0x584f('0x1c'),_0x584f('0x1d'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x584f('0x1e'),_0x584f('0x1f'),'phoneBarEnableDtmfTone',_0x584f('0x20'),_0x584f('0x21'),'phoneBarPrefixRequired',_0x584f('0x22'),_0x584f('0x23'),_0x584f('0x24'),'interface',_0x584f('0x25'),_0x584f('0x26'),'settingsEnabled',_0x584f('0x27'),_0x584f('0x28'),_0x584f('0x29'),_0x584f('0x2a'),_0x584f('0x2b'),'selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay',_0x584f('0x2c'),_0x584f('0x2d'),_0x584f('0x2e'),_0x584f('0x2f'),_0x584f('0x30'),'openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay',_0x584f('0x31'),_0x584f('0x32'),'messengerSoundNotification'];exports[_0x584f('0x33')]=function(){return this['isAuthenticated'](!![])[_0x584f('0x34')](function(_0x2a529f,_0xea6efd,_0x1ccd32){if(_0x2a529f[_0x584f('0x35')]){_0x1ccd32();}else{return db[_0x584f('0x36')][_0x584f('0x37')]({'where':{'id':_0x2a529f[_0x584f('0x38')]['id']},'attributes':['id',_0x584f('0x39'),_0x584f('0x3a')],'raw':!![]})['then'](function(_0xf02186){if(_0xf02186&&_0xf02186[_0x584f('0x39')]&&!_0x2a529f['query'][_0x584f('0x3b')]){return _0xea6efd[_0x584f('0x3c')](_0xf02186['disposition']===_0x584f('0x3d')?0x195:0x193)['json']({'message':_0xf02186[_0x584f('0x3a')]===_0x584f('0x3d')?_0x584f('0x3e'):'Forbidden.'});}else{_0x1ccd32();}})[_0x584f('0x3f')](function(_0x1806f9){_0x1ccd32(_0x1806f9);});}});};exports[_0x584f('0x40')]=function isAuthenticated(_0x207169){return compose()['use'](function(_0x2cce3f,_0x4c99a1,_0x29f9f3){var _0x268983;if(_0x2cce3f[_0x584f('0x41')]['authorization']){if(_[_0x584f('0x42')](_0x2cce3f[_0x584f('0x41')][_0x584f('0x43')],_0x584f('0x44'))){var _0x1004e7=basicAuth(_0x2cce3f);db[_0x584f('0x45')]['find']({'where':{'name':_0x1004e7[_0x584f('0xe')]}})[_0x584f('0x46')](function(_0x41798d){if(!_0x41798d||!_0x41798d[_0x584f('0x47')](_0x1004e7[_0x584f('0x48')])){return _0x4c99a1[_0x584f('0x3c')](0x191)[_0x584f('0x49')]({'message':_0x584f('0x4a')});}_0x2cce3f['user']={'id':_0x41798d['id']};_0x29f9f3();})[_0x584f('0x3f')](function(_0x5f3f35){_0x29f9f3(_0x5f3f35);});}else if(_['startsWith'](_0x2cce3f[_0x584f('0x41')][_0x584f('0x43')],_0x584f('0x4b'))){validateJwt(_0x2cce3f,_0x4c99a1,_0x29f9f3);}else{if(_0x207169){_0x29f9f3();}else{return _0x4c99a1[_0x584f('0x3c')](0x193)['json']({'message':_0x584f('0x4c')});}}}else if(_0x2cce3f['query']['apikey']){try{var _0x58f4bf={'audience':hardwareConf[_0x584f('0x4d')](),'issuer':hardwareConf[_0x584f('0x4d')]()};verifyJwt(_0x2cce3f[_0x584f('0x4e')]['apikey'],_0x58f4bf)[_0x584f('0x46')](function(_0x2ecac3){return db[_0x584f('0x45')][_0x584f('0x4f')]({'where':{'id':_0x2ecac3['sub']}})[_0x584f('0x46')](function(_0x41e270){_0x268983=_0x41e270;return db[_0x584f('0x50')][_0x584f('0x37')]({'where':{'id':0x1},'attributes':[_0x584f('0x51'),_0x584f('0x52')],'raw':!![]});})[_0x584f('0x46')](function(_0x2042bd){if(!_0x268983||!_[_0x584f('0x53')](_0x268983['apiKeyNonce'],_0x2ecac3['nonce'])){return _0x4c99a1['status'](0x191)[_0x584f('0x49')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x268983[_0x584f('0x54')]){return _0x4c99a1[_0x584f('0x3c')](0x191)[_0x584f('0x49')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x268983[_0x584f('0x55')]){if(_0x2042bd[_0x584f('0x52')]>0x0){if(moment(_0x268983['blockedAt'])[_0x584f('0x56')](_0x2042bd[_0x584f('0x52')],_0x584f('0x57'))>moment()){return _0x4c99a1[_0x584f('0x3c')](0x191)[_0x584f('0x49')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4c99a1[_0x584f('0x3c')](0x191)[_0x584f('0x49')]({'message':_0x584f('0x58')});}}_0x2cce3f[_0x584f('0x35')]={'id':_0x268983['id']};_0x29f9f3();});})['catch'](function(){return _0x4c99a1[_0x584f('0x3c')](0x191)[_0x584f('0x49')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x24cfca){_0x29f9f3(_0x24cfca);}}else if(_0x207169){_0x29f9f3();}else{return _0x4c99a1[_0x584f('0x3c')](0x193)['json']({'message':_0x584f('0x4c')});}})[_0x584f('0x34')](function(_0x30a9f8,_0x25cc7c,_0x21825c){if(_0x30a9f8['user']){db[_0x584f('0x45')][_0x584f('0x4f')]({'where':{'id':_0x30a9f8[_0x584f('0x35')]['id']},'attributes':userAttributes})[_0x584f('0x46')](function(_0x406333){if(!_0x406333){return _0x25cc7c[_0x584f('0x3c')](0x194)[_0x584f('0x49')]({'message':'User\x20not\x20found.'});}_0x30a9f8[_0x584f('0x35')]=_0x406333;_0x21825c();})['catch'](function(_0x4bcaf0){_0x21825c(_0x4bcaf0);});}else if(_0x207169){_0x21825c();}else{return _0x25cc7c['status'](0x194)[_0x584f('0x49')]({'message':_0x584f('0x59')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x584f('0x34')](function(_0x3b47b4,_0x1ed251,_0x24e982){return licenseUtil['getLicense']()[_0x584f('0x46')](function(_0xc3bc05){if(_0xc3bc05[_0x584f('0x5a')]){_0x24e982();}else{return _0x1ed251[_0x584f('0x3c')](0x193)[_0x584f('0x49')]({'message':_0x584f('0x5b')});}})['catch'](function(_0xb1c657){_0x24e982(_0xb1c657);});});};exports[_0x584f('0x5c')]=function isWebrtcLicence(){return compose()['use'](function(_0x1ec213,_0x3e7e73,_0x1c9889){return licenseUtil['getLicense']()[_0x584f('0x46')](function(_0x5ea6fa){if(_0x5ea6fa[_0x584f('0x5d')]){_0x1c9889();}else{return _0x3e7e73[_0x584f('0x3c')](0x193)[_0x584f('0x49')]({'message':_0x584f('0x5b')});}})[_0x584f('0x3f')](function(_0x433670){_0x1c9889(_0x433670);});});};exports[_0x584f('0x5e')]=function(_0x36ce20,_0x3185e5,_0x3736e0){_0x36ce20['isMiddleware']=!![];return _0x3736e0();};exports[_0x584f('0x5f')]=function signToken(_0x3398ba){return signJwt(_0x3398ba);};exports[_0x584f('0x60')]=function(_0x35646f,_0x471978){if(!_0x35646f[_0x584f('0x35')]){return _0x471978[_0x584f('0x3c')](0x194)[_0x584f('0x49')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1d024a={'payload':{'id':_0x35646f[_0x584f('0x35')]['id'],'role':_0x35646f[_0x584f('0x35')][_0x584f('0x61')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1d024a)['then'](function(_0x19f9c9){_0x471978[_0x584f('0x62')](_0x584f('0x63'),_0x19f9c9);_0x471978[_0x584f('0x64')](_0x584f('0x65'));})['catch'](function(_0x31a5c9){return _0x471978[_0x584f('0x3c')](0x1f4)[_0x584f('0x66')](_0x31a5c9);});};exports[_0x584f('0x67')]=function(_0xd1ebd0){if(_[_0x584f('0x68')](_0xd1ebd0['apiKeyNonce'])||_[_0x584f('0x68')](_0xd1ebd0[_0x584f('0x69')])){return null;}else{return createJwt(_0xd1ebd0);}};exports[_0x584f('0x6a')]=function(_0x226ac3){_0x226ac3[_0x584f('0x6b')]=generateNonce();_0x226ac3[_0x584f('0x69')]=generateIssuedAt();return createJwt(_0x226ac3);};exports[_0x584f('0x6c')]=function(_0x5e074e,_0x61f2be){var _0x150bb9=_0x5e074e[_0x584f('0x4e')]['apikey'];if(_0x150bb9){var _0x5cbf9e={'nonce':_0x61f2be['apiKeyNonce'],'iat':_0x61f2be[_0x584f('0x69')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x584f('0x4d')]()};return verifyJwt(_0x150bb9,_0x5cbf9e)[_0x584f('0x46')](function(){return generateApiKey(_0x61f2be);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x5b3764){var _0x391edc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x391edc[_0x584f('0x6d')](_0x5b3764))throw new db['Sequelize'][(_0x584f('0x6e'))](_0x584f('0x6f'));return;};exports[_0x584f('0x70')]=function(_0x2412e2,_0x42581d,_0x3b2a72){var _0x1aa174=encryptor[_0x584f('0x71')](_0x42581d)['split'](',');for(var _0x159c90=0x0;_0x159c90<_0x3b2a72;_0x159c90++){if(!_0x1aa174[_0x159c90])break;if(_0x2412e2[_0x584f('0x72')]()===_0x1aa174[_0x159c90]['toLowerCase']()){var _0x10313d=util[_0x584f('0x73')](_0x584f('0x74'),_0x3b2a72);if(_0x3b2a72===0x1){_0x10313d=_0x584f('0x75');}throw new db[(_0x584f('0x76'))][(_0x584f('0x6e'))](_0x10313d);}}return;};exports[_0x584f('0x77')]=function(_0x514f6d,_0x8b66ea){var _0x29e8f0=_0x8b66ea?encryptor['decryptString'](_0x8b66ea)['split'](','):[];if(_0x29e8f0['length']===0x5){_0x29e8f0['splice'](-0x1,0x1);}_0x29e8f0['unshift'](_0x514f6d);return encryptor[_0x584f('0x78')](_0x29e8f0[_0x584f('0x79')](','));};function signJwt(_0xc2c535){var _0x1d6c8f=BPromise['promisify'](jwt[_0x584f('0x7a')],{'context':jwt});var _0x14bb28=_0xc2c535['secret']||config[_0x584f('0xb')][_0x584f('0xc')];return new BPromise(function(_0x16d63e,_0x123d1d){_0x1d6c8f(_0xc2c535['payload'],_0x14bb28,_0xc2c535[_0x584f('0x7b')])[_0x584f('0x46')](function(_0x1bc99e){_0x16d63e(_0x1bc99e);})['catch'](function(_0x49c9b5){_0x123d1d(_0x49c9b5);});});}function verifyJwt(_0x385ca0,_0x534f72,_0xc29042){var _0x2de027=BPromise[_0x584f('0x7c')](jwt[_0x584f('0x7d')],{'context':jwt});var _0x2f4823=_0xc29042||config[_0x584f('0xb')][_0x584f('0xc')];return new BPromise(function(_0x457880,_0x2de623){_0x2de027(_0x385ca0,_0x2f4823,_0x534f72)['then'](function(_0x52e944){_0x457880(_0x52e944);})[_0x584f('0x3f')](function(_0x53054f){_0x2de623(_0x53054f);});});}function generateNonce(){return crypto[_0x584f('0x7e')](0x10)[_0x584f('0x7f')](_0x584f('0x80'));}function generateIssuedAt(){return Math[_0x584f('0x81')](Date[_0x584f('0x82')]()/0x3e8)[_0x584f('0x7f')]();}function createJwt(_0x25ea90){var _0x3fd61d={'payload':{'iat':_0x25ea90['apiKeyIat'],'nonce':_0x25ea90['apiKeyNonce']},'options':{'algorithm':_0x584f('0x83'),'subject':_0x25ea90['id'][_0x584f('0x7f')](),'issuer':hardwareConf[_0x584f('0x4d')](),'audience':hardwareConf[_0x584f('0x4d')]()}};return signJwt(_0x3fd61d)['then'](function(_0x4d50ff){return{'iat':_0x25ea90['apiKeyIat'],'nonce':_0x25ea90[_0x584f('0x6b')],'token':_0x4d50ff};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 87e38d8..ec870fd 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e1a=['CmContact','keys','startsWith','map','findOne','slice','all','length','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','default','where','fields','filter','clause','tags','user','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x5e1a,0xf6));var _0xa5e1=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x5e1a[_0x47a40b];return _0x19610c;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0xa5e1('0x0')]=function(_0x1f9d99,_0xeae0ab,_0x20c58a,_0x1ed7a3){var _0x577366={'count':0x0,'rows':[]};var _0x2d933a=sqlUtils[_0xa5e1('0x1')](_0xeae0ab,_0x1f9d99);if(_0x2d933a){return Promise[_0xa5e1('0x2')](_0x577366);}var _0x2313a9=sqlUtils[_0xa5e1('0x3')]();var _0x4ffb91={};var _0x54e509=![];var _0x32ef6d=![];return Promise['resolve']()['then'](function(){if(_0x1f9d99[_0xa5e1('0x4')]){return sqlUtils[_0xa5e1('0x5')](_0x1f9d99[_0xa5e1('0x4')],_0x1ed7a3);}else{return sqlUtils[_0xa5e1('0x6')](_0x1f9d99,_0x1ed7a3);}})[_0xa5e1('0x7')](function(_0xc86c0d){_0x2313a9['where'](_0xc86c0d[_0xa5e1('0x8')]);_0x2313a9[_0xa5e1('0x9')](_0xc86c0d[_0xa5e1('0xa')]);_0x2313a9[_0xa5e1('0x9')](_0xc86c0d[_0xa5e1('0xb')]);_0x2313a9[_0xa5e1('0x9')](_0xc86c0d['user'][_0xa5e1('0xc')]);_0x4ffb91=_0xc86c0d[_0xa5e1('0xd')];_0x32ef6d=_0xc86c0d[_0xa5e1('0xe')][_0xa5e1('0xf')];return sqlUtils[_0xa5e1('0x10')](_0xeae0ab,_0x1f9d99,_0x32ef6d);})[_0xa5e1('0x7')](function(_0xdc1791){_0x2313a9[_0xa5e1('0x9')](_0xdc1791);var _0x23313f=_0x1f9d99[_0xa5e1('0x4')]?_0x4ffb91[_0xa5e1('0x11')]:_0x1f9d99['tag'];_0x54e509=_0x23313f?!![]:![];return sqlUtils[_0xa5e1('0x12')](_0x2313a9,_0x23313f);})[_0xa5e1('0x7')](function(_0x49fb0f){_0x577366[_0xa5e1('0x13')]=_0x49fb0f;if(_0x577366['count']===0x0){return;}if(_0x1f9d99[_0xa5e1('0x14')]){_0x32ef6d=!![];}return sqlUtils[_0xa5e1('0x15')](_0x2313a9,_0x1f9d99[_0xa5e1('0xa')],_0x20c58a,_0x54e509,_0x4ffb91[_0xa5e1('0xc')],_0x32ef6d);})[_0xa5e1('0x7')](function(_0x307a92){if(!_0x307a92){return[];}return sqlUtils[_0xa5e1('0x16')](_0x307a92,_0x1f9d99,_0x20c58a);})[_0xa5e1('0x7')](function(_0x23e116){_0x577366[_0xa5e1('0x17')]=_0x23e116;return _0x577366;})[_0xa5e1('0x18')](function(_0x39a5d3){throw _0x39a5d3;});};exports[_0xa5e1('0x19')]=function(){var _0x3b51b7={};var _0x20128d=[];return db[_0xa5e1('0x1a')][_0xa5e1('0x19')]()[_0xa5e1('0x7')](function(_0x47b3ff){_0x3b51b7=_0x47b3ff;var _0x4bd0cb=Object[_0xa5e1('0x1b')](_0x3b51b7)['filter'](function(_0x4ce547){return _[_0xa5e1('0x1c')](_0x4ce547,'cf_')?_0x4ce547:undefined;});var _0x19104f=_0x4bd0cb[_0xa5e1('0x1d')](function(_0x24234a){return db['CmCustomField'][_0xa5e1('0x1e')]({'where':{'id':_0x24234a[_0xa5e1('0x1f')](0x3)},'raw':!![]});});return Promise[_0xa5e1('0x20')](_0x19104f);})[_0xa5e1('0x7')](function(_0xdcc9ae){for(var _0x20f2bd=0x0;_0x20f2bd<_0xdcc9ae[_0xa5e1('0x21')];_0x20f2bd++){if(_0xdcc9ae[_0x20f2bd]){var _0x3808c3='cf_'+_0xdcc9ae[_0x20f2bd]['id'];_0x3b51b7[_0x3808c3]['fieldType']=_0xdcc9ae[_0x20f2bd]['type'];}}_0x20128d=_['map'](Object['keys'](_0x3b51b7),function(_0x5cdd73){return{'name':_0x5cdd73,'type':_0x3b51b7[_0x5cdd73]['type']};});return _0x20128d;})[_0xa5e1('0x18')](function(_0x4bd63b){throw _0x4bd63b;});}; \ No newline at end of file +var _0x989d=['getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','fields','where','clause','tags','skip','ids','tag','countFilteredContacts','count','buildContactsQuery','rows','catch','describe','CmContact','filter','startsWith','cf_','map','CmCustomField','slice','all','length','type','findAll','skipContactsQuery','resolve'];(function(_0x954492,_0x22708b){var _0x15067e=function(_0xb70ab3){while(--_0xb70ab3){_0x954492['push'](_0x954492['shift']());}};_0x15067e(++_0x22708b);}(_0x989d,0x1af));var _0xd989=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x989d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0xd989('0x0')]=function(_0x40d12f,_0x54472e,_0x1f5295,_0x455ea6){var _0xc4922b={'count':0x0,'rows':[]};var _0x4e7ff=sqlUtils[_0xd989('0x1')](_0x54472e,_0x40d12f);if(_0x4e7ff){return Promise[_0xd989('0x2')](_0xc4922b);}var _0xea371c=sqlUtils[_0xd989('0x3')]();var _0x40a6ef={};var _0x51ca36=![];var _0x2bf062=![];return Promise[_0xd989('0x2')]()[_0xd989('0x4')](function(){if(_0x40d12f[_0xd989('0x5')]){return sqlUtils[_0xd989('0x6')](_0x40d12f[_0xd989('0x5')],_0x455ea6);}else{return sqlUtils[_0xd989('0x7')](_0x40d12f,_0x455ea6);}})[_0xd989('0x4')](function(_0x3d28c3){_0xea371c['where'](_0x3d28c3['default']);_0xea371c['where'](_0x3d28c3[_0xd989('0x8')]);_0xea371c[_0xd989('0x9')](_0x3d28c3['filter']);_0xea371c[_0xd989('0x9')](_0x3d28c3['user'][_0xd989('0xa')]);_0x40a6ef=_0x3d28c3[_0xd989('0xb')];_0x2bf062=_0x3d28c3['user'][_0xd989('0xc')];return sqlUtils['checkListsRestrictions'](_0x54472e,_0x40d12f,_0x2bf062);})['then'](function(_0x511bca){_0xea371c[_0xd989('0x9')](_0x511bca);var _0x32c6b3=_0x40d12f['search']?_0x40a6ef[_0xd989('0xd')]:_0x40d12f[_0xd989('0xe')];_0x51ca36=_0x32c6b3?!![]:![];return sqlUtils[_0xd989('0xf')](_0xea371c,_0x32c6b3);})[_0xd989('0x4')](function(_0x461572){_0xc4922b[_0xd989('0x10')]=_0x461572;if(_0xc4922b[_0xd989('0x10')]===0x0){return;}if(_0x40d12f['User']){_0x2bf062=!![];}return sqlUtils[_0xd989('0x11')](_0xea371c,_0x40d12f[_0xd989('0x8')],_0x1f5295,_0x51ca36,_0x40a6ef[_0xd989('0xa')],_0x2bf062);})[_0xd989('0x4')](function(_0x438970){if(!_0x438970){return[];}return sqlUtils['getFilteredContacts'](_0x438970,_0x40d12f,_0x1f5295);})['then'](function(_0x476cf7){_0xc4922b[_0xd989('0x12')]=_0x476cf7;return _0xc4922b;})[_0xd989('0x13')](function(_0x1be8fd){throw _0x1be8fd;});};exports[_0xd989('0x14')]=function(){var _0x422b60={};var _0x473c30=[];return db[_0xd989('0x15')][_0xd989('0x14')]()['then'](function(_0x1b56b1){_0x422b60=_0x1b56b1;var _0x4da336=Object['keys'](_0x422b60)[_0xd989('0x16')](function(_0x73d1fe){return _[_0xd989('0x17')](_0x73d1fe,_0xd989('0x18'))?_0x73d1fe:undefined;});var _0x5d0f91=_0x4da336[_0xd989('0x19')](function(_0x207dc7){return db[_0xd989('0x1a')]['findOne']({'where':{'id':_0x207dc7[_0xd989('0x1b')](0x3)},'raw':!![]});});return Promise[_0xd989('0x1c')](_0x5d0f91);})[_0xd989('0x4')](function(_0x11ed08){for(var _0x132265=0x0;_0x132265<_0x11ed08[_0xd989('0x1d')];_0x132265++){if(_0x11ed08[_0x132265]){var _0x491609=_0xd989('0x18')+_0x11ed08[_0x132265]['id'];_0x422b60[_0x491609]['fieldType']=_0x11ed08[_0x132265][_0xd989('0x1e')];}}_0x473c30=_[_0xd989('0x19')](Object['keys'](_0x422b60),function(_0x58ffb8){return{'name':_0x58ffb8,'type':_0x422b60[_0x58ffb8][_0xd989('0x1e')]};});return _0x473c30;})[_0xd989('0x13')](function(_0x516925){throw _0x516925;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 20d50fc..f9d345e 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3037=['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.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','buildExpression','default','text','value','start','end','Tag','split','and','tags','User','user','keys','map','some','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','fields','filter','role','agent','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','exports','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','search','ListId','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','tools_tags','firstName','lastName','mobile','email','updatedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length'];(function(_0x5b1097,_0x3ed62f){var _0x57979c=function(_0x512f68){while(--_0x512f68){_0x5b1097['push'](_0x5b1097['shift']());}};_0x57979c(++_0x3ed62f);}(_0x3037,0xa6));var _0x7303=function(_0x103581,_0x1cecb4){_0x103581=_0x103581-0x0;var _0x589051=_0x3037[_0x103581];return _0x589051;};'use strict';var _=require('lodash');var squel=require(_0x7303('0x0'));var as=require(_0x7303('0x1'));var qs=require('../parsers/qs');var utils=require(_0x7303('0x2'));var db=require(_0x7303('0x3'))['db'];function skipContactsQuery(_0x32a842,_0x532b40){var _0x27cafd=![];if(_0x32a842['role']==='agent'&&!_0x532b40[_0x7303('0x4')]&&!_0x532b40[_0x7303('0x5')]&&_0x532b40[_0x7303('0x6')]!==_0x7303('0x7')){_0x27cafd=!![];}return _0x27cafd;}function getContactsSubquery(){return squel['select']()[_0x7303('0x8')](_0x7303('0x9'),'c')[_0x7303('0xa')](_0x7303('0xb'));}function applyJoinClauses(_0xa1e0f9,_0xf04201){var _0x4809bb=_0xf04201?'c':_0x7303('0xc');_0xa1e0f9['left_join'](_0x7303('0xd'),'uc',_0x7303('0xe')+_0x4809bb+_0x7303('0xf'))[_0x7303('0x10')](_0x7303('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x4809bb+'.id')[_0x7303('0x10')](_0x7303('0x12'),'t','t.id\x20=\x20ct.TagId');return _0xa1e0f9;}function addFieldsToQuery(_0x4f2a38,_0x4e3135,_0x3ba6aa,_0x940fd0,_0x2c091e){var _0x1050e7=_0x2c091e?'c':_0x7303('0xc');if(!_0x4e3135){_0x4e3135=['id',_0x7303('0x13'),_0x7303('0x14'),'phone',_0x7303('0x15'),'fax',_0x7303('0x16'),'ListId','CompanyId','createdAt',_0x7303('0x17'),'deletedAt',_0x7303('0x18')];}else if(!_0x4e3135[_0x7303('0x19')]('id')){_0x4e3135[_0x7303('0x1a')]('id');}var _0x577682=_0x3ba6aa&&_0x2c091e||!_0x3ba6aa&&!_0x2c091e;if(_0x940fd0){_0x577682=_0x940fd0&&_0x2c091e||!_0x940fd0&&!_0x2c091e;}_0x4e3135[_0x7303('0x1b')](function(_0x5ca107){if(_0x5ca107===_0x7303('0x18')){if(_0x577682){_0x4f2a38[_0x7303('0x1c')](_0x7303('0x1d'),_0x5ca107);}else if(_0x3ba6aa||_0x940fd0){_0x4f2a38['field'](_0x1050e7+'.'+_0x5ca107);}}else{_0x4f2a38[_0x7303('0x1c')](_0x1050e7+'.'+_0x5ca107);}});return _0x4f2a38;}function getSqlClauses(){var _0x1a182b={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x7303('0x1e')](),'tags':{'clause':squel[_0x7303('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x1a182b;}function parseTagParameter(_0x38b0bd){var _0x4cd36e=squel[_0x7303('0x1e')]();if(_0x38b0bd){var _0x5b257b=utils['getSelectedTags'](_0x38b0bd);_0x5b257b['forEach'](function(_0x2f93fa){_0x4cd36e['or'](_0x7303('0x1f'),'%,'+_0x2f93fa+',%');});}return _0x4cd36e;}function parseSearchFilter(_0x74bdd4){var _0x29d267=squel['expr']();if(_0x74bdd4){var _0x7c85a=_0x74bdd4[_0x7303('0x20')]('\x5c','\x5c\x5c')[_0x7303('0x20')](/'/g,'\x27\x27');if(_0x7c85a['split']('\x20')[_0x7303('0x21')]>0x1){_0x29d267['or'](_0x7303('0x22'),qs[_0x7303('0x23')](_0x7c85a,!![]),null);}else{if(qs[_0x7303('0x24')](_0x7c85a)){_0x29d267['or'](_0x7303('0x25'),_0x7c85a+'%');_0x29d267['or'](_0x7303('0x26'),_0x7c85a+'%');_0x29d267['or']('c.mobile\x20LIKE\x20?',_0x7c85a+'%');_0x29d267['or'](_0x7303('0x27'),_0x7c85a+'%');}else if(qs['isEmail'](_0x7c85a)){_0x29d267['or'](_0x7303('0x28'),_0x7c85a+'%');}else{_0x29d267['or'](_0x7303('0x29'),'%'+_0x7c85a+'%');_0x29d267['or'](_0x7303('0x2a'),'%'+_0x7c85a+'%');_0x29d267['or']('c.email\x20LIKE\x20?','%'+_0x7c85a+'%');}}}return _0x29d267;}function parseAdvancedSearchFilter(_0x2543a7,_0xd0a8e8){var _0x1c88b3=getSqlClauses();var _0x305715=as[_0x7303('0x2b')](_0x2543a7);var _0x47778c=_0x305715[_0x7303('0x2c')];for(var _0x458812=0x0;_0x458812<_0x305715[_0x7303('0x2d')][_0x7303('0x21')];_0x458812++){var _0x2e151c=_0x305715[_0x7303('0x2d')][_0x458812];var _0x2f6df7='c';var _0x377a62=_[_0x7303('0x2e')](_0xd0a8e8,['name',_0x2e151c[_0x7303('0x1c')]]);if(_0x377a62){if(_0x2e151c['field']===_0x7303('0x2f')||_0x377a62[_0x7303('0x30')]===_0x7303('0x31')){_0x2e151c['castTo']='DATE';}var _0x272229=as[_0x7303('0x32')](_0x2f6df7,_0x377a62['type'],_0x2e151c);_0x1c88b3[_0x7303('0x33')][_0x47778c](_0x272229[_0x7303('0x34')],_0x272229[_0x7303('0x35')][_0x7303('0x36')],_0x272229[_0x7303('0x35')][_0x7303('0x37')]);}else{if(_0x2e151c['field']===_0x7303('0x38')){var _0x58a9c4=_0x2e151c[_0x7303('0x35')][_0x7303('0x39')](',')['map'](function(_0x496de4){return Number(_0x496de4);});var _0x5a7be4=parseTagParameter(_0x58a9c4);_0x1c88b3['tags']['clause'][_0x7303('0x3a')](_0x5a7be4);_0x1c88b3[_0x7303('0x3b')]['ids']=_0x58a9c4;}else if(_0x2e151c['field']===_0x7303('0x3c')){_0x1c88b3['user']['clause'][_0x7303('0x3a')]('uc.UserId\x20=\x20?',_0x2e151c[_0x7303('0x35')]);_0x1c88b3[_0x7303('0x3d')]['skip']=!![];}}}return _0x1c88b3;}function parseModelFields(_0x315d42,_0x595ba7){var _0x25b806=squel[_0x7303('0x1e')]();var _0x52dac=_(_0x315d42)[_0x7303('0x3e')]()[_0x7303('0x3f')](function(_0x303449){return _[_0x7303('0x40')](_0x595ba7,[_0x7303('0x41'),_0x303449])?_0x303449:undefined;})[_0x7303('0x42')]()[_0x7303('0x35')]();if(_0x315d42[_0x7303('0x43')]){_0x52dac['push']('Contact');}if(_0x315d42[_0x7303('0x3c')]){_0x52dac[_0x7303('0x1a')](_0x7303('0x3c'));}if(_0x52dac[_0x7303('0x21')]>0x0){_0x52dac['forEach'](function(_0xf0ba49){if(_0xf0ba49===_0x7303('0x5')){_0x25b806[_0x7303('0x3a')](_0x7303('0x44'),[][_0x7303('0x45')](_0x315d42[_0xf0ba49]));}else if(_0xf0ba49===_0x7303('0x43')){var _0x40475d='%'+_0x315d42[_0xf0ba49]+'%';_0x25b806[_0x7303('0x3a')](_0x7303('0x46'),_0x40475d);}else if(_0xf0ba49===_0x7303('0x3c')){_0x25b806['and'](_0x7303('0x47'),_0x315d42[_0xf0ba49]);}else{_0x25b806['and']('c.'+_0xf0ba49+'\x20=\x20?',_0x315d42[_0xf0ba49]);}});}return _0x25b806;}function parseQueryParameters(_0x131496,_0x5802e8){var _0x6cdb99=getSqlClauses();return Promise[_0x7303('0x48')]()[_0x7303('0x49')](function(){return parseModelFields(_0x131496,_0x5802e8);})['then'](function(_0x1c7f19){_0x6cdb99[_0x7303('0x4a')]['and'](_0x1c7f19);return parseTagParameter(_0x131496['tag']);})['then'](function(_0x470937){_0x6cdb99[_0x7303('0x3b')]['clause'][_0x7303('0x3a')](_0x470937);return parseSearchFilter(_0x131496['filter']);})['then'](function(_0x42917e){_0x6cdb99[_0x7303('0x4b')]=_0x42917e;return _0x6cdb99;});}function checkListsRestrictions(_0x29b8ab,_0x3da189,_0x560a36){var _0x318c7d=squel[_0x7303('0x1e')]();return Promise[_0x7303('0x48')]()[_0x7303('0x49')](function(){if(_0x3da189[_0x7303('0x4')]&&_0x29b8ab[_0x7303('0x4c')]===_0x7303('0x4d')&&!_0x560a36){return _0x29b8ab[_0x7303('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x7303('0x49')](function(_0x18a781){if(_0x18a781){if(_0x18a781[_0x7303('0x21')]===0x0){_0x318c7d['and'](_0x7303('0x4f'));}else{_0x318c7d['and'](_0x7303('0x44'),_[_0x7303('0x3f')](_0x18a781,'id'));}}})[_0x7303('0x49')](function(){return _0x318c7d;});}function buildContactsQuery(_0x22f794,_0x103237,_0x93459b,_0x36b1fd,_0x49a4d7,_0x59f0fb){if(_0x103237){_0x103237=_0x93459b['attributes'];}_0x22f794=addFieldsToQuery(_0x22f794,_0x103237,_0x36b1fd,_0x59f0fb,!![]);var _0x6cb975=squel['select']();_0x6cb975=addFieldsToQuery(_0x6cb975,_0x103237,_0x36b1fd,_0x59f0fb,![]);if(_0x36b1fd||_0x59f0fb){_0x22f794=applyJoinClauses(_0x22f794,!![]);_0x22f794[_0x7303('0x50')](_0x7303('0x51'));if(_0x93459b[_0x7303('0x52')]){_0x6cb975[_0x7303('0x52')](_0x93459b[_0x7303('0x52')]);}if(_0x93459b['offset']){_0x6cb975[_0x7303('0x53')](_0x93459b[_0x7303('0x53')]);}}else{_0x6cb975=applyJoinClauses(_0x6cb975,![]);_0x6cb975[_0x7303('0x50')](_0x7303('0x54'));if(_0x93459b['limit']){_0x22f794[_0x7303('0x52')](_0x93459b[_0x7303('0x52')]);}if(_0x93459b['offset']){_0x22f794[_0x7303('0x53')](_0x93459b[_0x7303('0x53')]);}}_0x6cb975['having'](_0x49a4d7);if(_0x93459b[_0x7303('0x55')]){_0x93459b[_0x7303('0x55')][_0x7303('0x1b')](function(_0x6dd925){_0x22f794['order']('c.'+_0x6dd925[0x0],_0x6dd925[0x1]===_0x7303('0x56')?![]:!![]);_0x6cb975['order'](_0x7303('0x57')+_0x6dd925[0x0],_0x6dd925[0x1]===_0x7303('0x56')?![]:!![]);});}_0x6cb975[_0x7303('0x8')](_0x22f794,'subqry');return _0x6cb975;}function getFilteredContacts(_0x3f7655){var _0x3fc244=[];return db[_0x7303('0x38')][_0x7303('0x58')]({'attributes':['id','name','color'],'raw':!![]})[_0x7303('0x49')](function(_0x35dd21){_0x3fc244=_[_0x7303('0x59')](_0x35dd21,'id');var _0x5cfaee={'type':db[_0x7303('0x5a')][_0x7303('0x5b')][_0x7303('0x5c')],'model':db[_0x7303('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7303('0x5e')]['query'](_0x3f7655[_0x7303('0x5f')](),_0x5cfaee);})[_0x7303('0x49')](function(_0x193856){_0x193856[_0x7303('0x1b')](function(_0x55f36f){if(_0x55f36f['TagIds']){_0x55f36f[_0x7303('0x60')]=[];_0x55f36f[_0x7303('0x18')][_0x7303('0x39')](',')[_0x7303('0x1b')](function(_0x348d5e){_0x55f36f['Tags'][_0x7303('0x1a')](_0x3fc244[_0x348d5e]);});}delete _0x55f36f[_0x7303('0x18')];});return _0x193856;});}function countFilteredContacts(_0x471e50,_0x3c5050){var _0x7a1027=_0x471e50[_0x7303('0x61')]();_0x7a1027[_0x7303('0x1c')](_0x7303('0x62'));_0x7a1027=applyJoinClauses(_0x7a1027,!![]);_0x471e50[_0x7303('0x50')]('c.id');var _0x2fdf80=utils['getSelectedTags'](_0x3c5050);if(!_['isEmpty'](_0x2fdf80)){_0x7a1027['where']('t.id\x20IN\x20?',_0x2fdf80);}var _0x3c8ba1={'type':db[_0x7303('0x5a')][_0x7303('0x5b')]['SELECT'],'raw':!![]};return db[_0x7303('0x5e')]['query'](_0x7a1027[_0x7303('0x5f')](),_0x3c8ba1)[_0x7303('0x49')](function(_0x44b671){return _0x44b671[0x0][_0x7303('0x62')];});}module[_0x7303('0x63')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xbf5c=['lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','from','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','firstName','lastName','phone','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','length','name','dateOfBirth','datetime','DATE','buildExpression','type','default','text','value','start','end','Tag','map','and','tags','user','uc.UserId\x20=\x20?','skip','keys','compact','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','then','fields','filter','resolve','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','subqry.','findAll','color','keyBy','SELECT','sequelize','query','Tags','getSelectedTags','t.id\x20IN\x20?','Sequelize','QueryTypes','toString','COUNT(*)','exports'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xbf5c,0x1f4));var _0xcbf5=function(_0x379296,_0xb721a1){_0x379296=_0x379296-0x0;var _0x2461d0=_0xbf5c[_0x379296];return _0x2461d0;};'use strict';var _=require(_0xcbf5('0x0'));var squel=require(_0xcbf5('0x1'));var as=require(_0xcbf5('0x2'));var qs=require('../parsers/qs');var utils=require(_0xcbf5('0x3'));var db=require(_0xcbf5('0x4'))['db'];function skipContactsQuery(_0x589eb3,_0x595f10){var _0x4f07b1=![];if(_0x589eb3[_0xcbf5('0x5')]===_0xcbf5('0x6')&&!_0x595f10[_0xcbf5('0x7')]&&!_0x595f10[_0xcbf5('0x8')]&&_0x595f10[_0xcbf5('0x9')]!=='true'){_0x4f07b1=!![];}return _0x4f07b1;}function getContactsSubquery(){return squel[_0xcbf5('0xa')]()[_0xcbf5('0xb')]('cm_contacts','c')[_0xcbf5('0xc')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x66b94b,_0x37c448){var _0x1fea52=_0x37c448?'c':_0xcbf5('0xd');_0x66b94b[_0xcbf5('0xe')](_0xcbf5('0xf'),'uc',_0xcbf5('0x10')+_0x1fea52+'.id')[_0xcbf5('0xe')](_0xcbf5('0x11'),'ct',_0xcbf5('0x12')+_0x1fea52+_0xcbf5('0x13'))['left_join']('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x66b94b;}function addFieldsToQuery(_0x12b3bd,_0xb592e5,_0x29a9e1,_0xb4021b,_0x24376f){var _0x1321e6=_0x24376f?'c':_0xcbf5('0xd');if(!_0xb592e5){_0xb592e5=['id',_0xcbf5('0x14'),_0xcbf5('0x15'),_0xcbf5('0x16'),'mobile',_0xcbf5('0x17'),_0xcbf5('0x18'),'ListId',_0xcbf5('0x19'),'createdAt',_0xcbf5('0x1a'),_0xcbf5('0x1b'),_0xcbf5('0x1c')];}else if(!_0xb592e5[_0xcbf5('0x1d')]('id')){_0xb592e5[_0xcbf5('0x1e')]('id');}var _0x322cb8=_0x29a9e1&&_0x24376f||!_0x29a9e1&&!_0x24376f;if(_0xb4021b){_0x322cb8=_0xb4021b&&_0x24376f||!_0xb4021b&&!_0x24376f;}_0xb592e5[_0xcbf5('0x1f')](function(_0x1ba4a2){if(_0x1ba4a2==='TagIds'){if(_0x322cb8){_0x12b3bd[_0xcbf5('0x20')](_0xcbf5('0x21'),_0x1ba4a2);}else if(_0x29a9e1||_0xb4021b){_0x12b3bd[_0xcbf5('0x20')](_0x1321e6+'.'+_0x1ba4a2);}}else{_0x12b3bd[_0xcbf5('0x20')](_0x1321e6+'.'+_0x1ba4a2);}});return _0x12b3bd;}function getSqlClauses(){var _0x245cde={'default':squel[_0xcbf5('0x22')](),'fields':squel[_0xcbf5('0x22')](),'filter':squel[_0xcbf5('0x22')](),'tags':{'clause':squel[_0xcbf5('0x22')](),'ids':null},'user':{'clause':squel[_0xcbf5('0x22')](),'skip':![]}};return _0x245cde;}function parseTagParameter(_0xe09046){var _0x188f82=squel[_0xcbf5('0x22')]();if(_0xe09046){var _0x5c4137=utils['getSelectedTags'](_0xe09046);_0x5c4137[_0xcbf5('0x1f')](function(_0x2cd1c4){_0x188f82['or'](_0xcbf5('0x23'),'%,'+_0x2cd1c4+',%');});}return _0x188f82;}function parseSearchFilter(_0x19e9f2){var _0x2924fd=squel[_0xcbf5('0x22')]();if(_0x19e9f2){var _0x4acc99=_0x19e9f2['replace']('\x5c','\x5c\x5c')[_0xcbf5('0x24')](/'/g,'\x27\x27');if(_0x4acc99[_0xcbf5('0x25')]('\x20')['length']>0x1){_0x2924fd['or'](_0xcbf5('0x26'),qs[_0xcbf5('0x27')](_0x4acc99,!![]),null);}else{if(qs['isNumeric'](_0x4acc99)){_0x2924fd['or'](_0xcbf5('0x28'),_0x4acc99+'%');_0x2924fd['or']('c.phone\x20LIKE\x20?',_0x4acc99+'%');_0x2924fd['or']('c.mobile\x20LIKE\x20?',_0x4acc99+'%');_0x2924fd['or']('c.fax\x20LIKE\x20?',_0x4acc99+'%');}else if(qs[_0xcbf5('0x29')](_0x4acc99)){_0x2924fd['or'](_0xcbf5('0x2a'),_0x4acc99+'%');}else{_0x2924fd['or'](_0xcbf5('0x2b'),'%'+_0x4acc99+'%');_0x2924fd['or'](_0xcbf5('0x2c'),'%'+_0x4acc99+'%');_0x2924fd['or'](_0xcbf5('0x2a'),'%'+_0x4acc99+'%');}}}return _0x2924fd;}function parseAdvancedSearchFilter(_0x4ab16f,_0x569d5c){var _0x171d55=getSqlClauses();var _0x829256=as[_0xcbf5('0x2d')](_0x4ab16f);var _0xdd2ec1=_0x829256['sqlOperator'];for(var _0x1f74b8=0x0;_0x1f74b8<_0x829256[_0xcbf5('0x2e')][_0xcbf5('0x2f')];_0x1f74b8++){var _0x48b188=_0x829256[_0xcbf5('0x2e')][_0x1f74b8];var _0x3ec197='c';var _0x11f989=_['find'](_0x569d5c,[_0xcbf5('0x30'),_0x48b188['field']]);if(_0x11f989){if(_0x48b188[_0xcbf5('0x20')]===_0xcbf5('0x31')||_0x11f989['fieldType']===_0xcbf5('0x32')){_0x48b188['castTo']=_0xcbf5('0x33');}var _0x3ee2ef=as[_0xcbf5('0x34')](_0x3ec197,_0x11f989[_0xcbf5('0x35')],_0x48b188);_0x171d55[_0xcbf5('0x36')][_0xdd2ec1](_0x3ee2ef[_0xcbf5('0x37')],_0x3ee2ef[_0xcbf5('0x38')][_0xcbf5('0x39')],_0x3ee2ef['value'][_0xcbf5('0x3a')]);}else{if(_0x48b188[_0xcbf5('0x20')]===_0xcbf5('0x3b')){var _0x1a882f=_0x48b188['value']['split'](',')[_0xcbf5('0x3c')](function(_0x381500){return Number(_0x381500);});var _0xff729e=parseTagParameter(_0x1a882f);_0x171d55['tags']['clause'][_0xcbf5('0x3d')](_0xff729e);_0x171d55[_0xcbf5('0x3e')]['ids']=_0x1a882f;}else if(_0x48b188[_0xcbf5('0x20')]==='User'){_0x171d55[_0xcbf5('0x3f')]['clause'][_0xcbf5('0x3d')](_0xcbf5('0x40'),_0x48b188['value']);_0x171d55[_0xcbf5('0x3f')][_0xcbf5('0x41')]=!![];}}}return _0x171d55;}function parseModelFields(_0x409221,_0x33a33b){var _0x7ede6b=squel[_0xcbf5('0x22')]();var _0x3c5318=_(_0x409221)[_0xcbf5('0x42')]()[_0xcbf5('0x3c')](function(_0x14e936){return _['some'](_0x33a33b,[_0xcbf5('0x30'),_0x14e936])?_0x14e936:undefined;})[_0xcbf5('0x43')]()['value']();if(_0x409221[_0xcbf5('0x44')]){_0x3c5318[_0xcbf5('0x1e')]('Contact');}if(_0x409221['User']){_0x3c5318[_0xcbf5('0x1e')](_0xcbf5('0x45'));}if(_0x3c5318['length']>0x0){_0x3c5318[_0xcbf5('0x1f')](function(_0x572830){if(_0x572830==='ListId'){_0x7ede6b['and'](_0xcbf5('0x46'),[]['concat'](_0x409221[_0x572830]));}else if(_0x572830===_0xcbf5('0x44')){var _0x401ca6='%'+_0x409221[_0x572830]+'%';_0x7ede6b[_0xcbf5('0x3d')](_0xcbf5('0x47'),_0x401ca6);}else if(_0x572830==='User'){_0x7ede6b['and']('uc.UserId\x20=\x20?',_0x409221[_0x572830]);}else{_0x7ede6b['and']('c.'+_0x572830+'\x20=\x20?',_0x409221[_0x572830]);}});}return _0x7ede6b;}function parseQueryParameters(_0xf99f63,_0x35e41b){var _0x2872e4=getSqlClauses();return Promise['resolve']()[_0xcbf5('0x48')](function(){return parseModelFields(_0xf99f63,_0x35e41b);})[_0xcbf5('0x48')](function(_0x55484c){_0x2872e4[_0xcbf5('0x49')][_0xcbf5('0x3d')](_0x55484c);return parseTagParameter(_0xf99f63['tag']);})[_0xcbf5('0x48')](function(_0x22c040){_0x2872e4[_0xcbf5('0x3e')]['clause'][_0xcbf5('0x3d')](_0x22c040);return parseSearchFilter(_0xf99f63[_0xcbf5('0x4a')]);})[_0xcbf5('0x48')](function(_0xbd9124){_0x2872e4['filter']=_0xbd9124;return _0x2872e4;});}function checkListsRestrictions(_0x4b2f24,_0x30e245,_0x34e3d4){var _0x1a8c5c=squel['expr']();return Promise[_0xcbf5('0x4b')]()[_0xcbf5('0x48')](function(){if(_0x30e245['search']&&_0x4b2f24[_0xcbf5('0x5')]==='agent'&&!_0x34e3d4){return _0x4b2f24[_0xcbf5('0x4c')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x44756d){if(_0x44756d){if(_0x44756d['length']===0x0){_0x1a8c5c[_0xcbf5('0x3d')](_0xcbf5('0x4d'));}else{_0x1a8c5c[_0xcbf5('0x3d')](_0xcbf5('0x46'),_['map'](_0x44756d,'id'));}}})[_0xcbf5('0x48')](function(){return _0x1a8c5c;});}function buildContactsQuery(_0x522ecb,_0x990769,_0x39ec0c,_0x467c6d,_0x22c6ea,_0x26a505){if(_0x990769){_0x990769=_0x39ec0c[_0xcbf5('0x4e')];}_0x522ecb=addFieldsToQuery(_0x522ecb,_0x990769,_0x467c6d,_0x26a505,!![]);var _0x851103=squel[_0xcbf5('0xa')]();_0x851103=addFieldsToQuery(_0x851103,_0x990769,_0x467c6d,_0x26a505,![]);if(_0x467c6d||_0x26a505){_0x522ecb=applyJoinClauses(_0x522ecb,!![]);_0x522ecb[_0xcbf5('0x4f')](_0xcbf5('0x50'));if(_0x39ec0c[_0xcbf5('0x51')]){_0x851103[_0xcbf5('0x51')](_0x39ec0c[_0xcbf5('0x51')]);}if(_0x39ec0c['offset']){_0x851103[_0xcbf5('0x52')](_0x39ec0c[_0xcbf5('0x52')]);}}else{_0x851103=applyJoinClauses(_0x851103,![]);_0x851103[_0xcbf5('0x4f')]('subqry.id');if(_0x39ec0c[_0xcbf5('0x51')]){_0x522ecb[_0xcbf5('0x51')](_0x39ec0c['limit']);}if(_0x39ec0c[_0xcbf5('0x52')]){_0x522ecb[_0xcbf5('0x52')](_0x39ec0c[_0xcbf5('0x52')]);}}_0x851103[_0xcbf5('0x53')](_0x22c6ea);if(_0x39ec0c[_0xcbf5('0x54')]){_0x39ec0c[_0xcbf5('0x54')][_0xcbf5('0x1f')](function(_0x2a281b){_0x522ecb[_0xcbf5('0x54')]('c.'+_0x2a281b[0x0],_0x2a281b[0x1]==='DESC'?![]:!![]);_0x851103[_0xcbf5('0x54')](_0xcbf5('0x55')+_0x2a281b[0x0],_0x2a281b[0x1]==='DESC'?![]:!![]);});}_0x851103[_0xcbf5('0xb')](_0x522ecb,'subqry');return _0x851103;}function getFilteredContacts(_0x11aa55){var _0x2d0154=[];return db[_0xcbf5('0x3b')][_0xcbf5('0x56')]({'attributes':['id',_0xcbf5('0x30'),_0xcbf5('0x57')],'raw':!![]})[_0xcbf5('0x48')](function(_0x213cc5){_0x2d0154=_[_0xcbf5('0x58')](_0x213cc5,'id');var _0x2cc20e={'type':db['Sequelize']['QueryTypes'][_0xcbf5('0x59')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xcbf5('0x5a')][_0xcbf5('0x5b')](_0x11aa55['toString'](),_0x2cc20e);})['then'](function(_0x2f9a43){_0x2f9a43[_0xcbf5('0x1f')](function(_0x2368b6){if(_0x2368b6[_0xcbf5('0x1c')]){_0x2368b6[_0xcbf5('0x5c')]=[];_0x2368b6[_0xcbf5('0x1c')][_0xcbf5('0x25')](',')['forEach'](function(_0x14a76a){_0x2368b6[_0xcbf5('0x5c')]['push'](_0x2d0154[_0x14a76a]);});}delete _0x2368b6[_0xcbf5('0x1c')];});return _0x2f9a43;});}function countFilteredContacts(_0x1f8358,_0xdb9a10){var _0x1a30e1=_0x1f8358['clone']();_0x1a30e1[_0xcbf5('0x20')]('COUNT(*)');_0x1a30e1=applyJoinClauses(_0x1a30e1,!![]);_0x1f8358[_0xcbf5('0x4f')]('c.id');var _0x2bf15c=utils[_0xcbf5('0x5d')](_0xdb9a10);if(!_['isEmpty'](_0x2bf15c)){_0x1a30e1[_0xcbf5('0xc')](_0xcbf5('0x5e'),_0x2bf15c);}var _0x25da91={'type':db[_0xcbf5('0x5f')][_0xcbf5('0x60')][_0xcbf5('0x59')],'raw':!![]};return db['sequelize']['query'](_0x1a30e1[_0xcbf5('0x61')](),_0x25da91)['then'](function(_0x4de7a1){return _0x4de7a1[0x0][_0xcbf5('0x62')];});}module[_0xcbf5('0x63')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c9bee5b..d7893e6 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 _0xbcc8=['unlink','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','write','close','decryptFile','createDecipher','end','final'];(function(_0x5e8763,_0x558211){var _0x286b08=function(_0x4ceb40){while(--_0x4ceb40){_0x5e8763['push'](_0x5e8763['shift']());}};_0x286b08(++_0x558211);}(_0xbcc8,0x154));var _0x8bcc=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xbcc8[_0xea35d1];return _0x1d7a7c;};'use strict';var crypto=require(_0x8bcc('0x0'));var fs=require('fs');var BPromise=require(_0x8bcc('0x1'));var _=require(_0x8bcc('0x2'));var config=require(_0x8bcc('0x3'));var logger=require(_0x8bcc('0x4'))(_0x8bcc('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x8bcc('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x8bcc('0x7')};if(config[_0x8bcc('0x8')]&&config['encrypt'][_0x8bcc('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x8bcc('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x8bcc('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8bcc('0xa')](',\x20');logger[_0x8bcc('0xb')](config[_0x8bcc('0x8')]['algorithm'],_0x8bcc('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x53b9a4){return AES_SUPPORTED_RX[_0x8bcc('0xd')](_0x53b9a4);}function getSupportedCiphers(){return crypto[_0x8bcc('0xe')]()[_0x8bcc('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x4b0449){return getSupportedCiphers()[_0x8bcc('0x10')](_0x4b0449)>-0x1;}function combineOptions(_0x38f952){var _0x47eeb3={};for(var _0x2f6551 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2f6551)){_0x47eeb3[_0x2f6551]=fileOptions[_0x2f6551];}}if(_0x38f952){for(var _0x3cabce in _0x38f952){if(_0x38f952[_0x8bcc('0x11')](_0x3cabce)){_0x47eeb3[_0x3cabce]=_0x38f952[_0x3cabce];}}}return _0x47eeb3;}exports[_0x8bcc('0x12')]=function(_0x305a25,_0x4f0557,_0x53b149,_0x38f7cb){return new BPromise(function(_0xba3ad1,_0x11fe5c){_0x38f7cb=combineOptions(_0x38f7cb);var _0x25c0eb=new Buffer(_0x53b149);var _0x12913c=fs[_0x8bcc('0x13')](_0x305a25);var _0x40f144=fs[_0x8bcc('0x14')](_0x4f0557);var _0x4d4e3e=crypto['createCipher'](_0x38f7cb[_0x8bcc('0x9')],_0x25c0eb);_0x12913c['on'](_0x8bcc('0x15'),function(_0x83d17d){var _0x3febc1=new Buffer(_0x4d4e3e[_0x8bcc('0x16')](_0x83d17d),_0x8bcc('0x17'));_0x40f144[_0x8bcc('0x18')](_0x3febc1);});_0x12913c['on']('end',function(){try{var _0x54c7e0=new Buffer(_0x4d4e3e['final'](_0x8bcc('0x17')),_0x8bcc('0x17'));_0x40f144[_0x8bcc('0x18')](_0x54c7e0);_0x40f144['end']();_0x40f144['on'](_0x8bcc('0x19'),function(){return _0xba3ad1(_0x4f0557);});}catch(_0x5ad744){fs['unlink'](_0x4f0557);return _0x11fe5c(_0x5ad744);}});});};exports[_0x8bcc('0x1a')]=function(_0x530e89,_0x879f96,_0x181837,_0x26ade0){return new BPromise(function(_0x45272f,_0x424b0e){_0x26ade0=combineOptions(_0x26ade0);var _0xbe316d=new Buffer(_0x181837);var _0x8b951a=fs[_0x8bcc('0x13')](_0x530e89);var _0x5b9c3f=fs[_0x8bcc('0x14')](_0x879f96);var _0x6b976c=crypto[_0x8bcc('0x1b')](_0x26ade0[_0x8bcc('0x9')],_0xbe316d);_0x8b951a['on'](_0x8bcc('0x15'),function(_0x338777){var _0x5880b7=new Buffer(_0x6b976c['update'](_0x338777),_0x8bcc('0x17'));_0x5b9c3f[_0x8bcc('0x18')](_0x5880b7);});_0x8b951a['on'](_0x8bcc('0x1c'),function(){try{var _0x2ea7b4=new Buffer(_0x6b976c[_0x8bcc('0x1d')](_0x8bcc('0x17')),'binary');_0x5b9c3f['write'](_0x2ea7b4);_0x5b9c3f[_0x8bcc('0x1c')]();_0x5b9c3f['on'](_0x8bcc('0x19'),function(){return _0x45272f(_0x879f96);});}catch(_0x3dbc8f){fs[_0x8bcc('0x1e')](_0x879f96);return _0x424b0e(_0x3dbc8f);}});});};exports[_0x8bcc('0x1f')]=function(_0x221194,_0x5d447f,_0x5afd23){var _0x303196=_0x5afd23||stringOptions[_0x8bcc('0x9')];var _0x499eb3=_0x5d447f||stringOptions[_0x8bcc('0x20')];var _0x4d5943=crypto[_0x8bcc('0x21')](_0x303196,_0x499eb3);var _0x2d8d7b=_0x4d5943[_0x8bcc('0x16')](_0x221194,_0x8bcc('0x22'),_0x8bcc('0x23'));_0x2d8d7b+=_0x4d5943['final'](_0x8bcc('0x23'));return _0x2d8d7b;};exports[_0x8bcc('0x24')]=function(_0x2e5e14,_0x21f112,_0x2860c7){var _0x4221fd=_0x2860c7||stringOptions[_0x8bcc('0x9')];var _0x559ed8=_0x21f112||stringOptions['secret'];var _0x5455b1=crypto[_0x8bcc('0x1b')](_0x4221fd,_0x559ed8);var _0x4e6fc4=_0x5455b1[_0x8bcc('0x16')](_0x2e5e14,_0x8bcc('0x23'),_0x8bcc('0x22'));_0x4e6fc4+=_0x5455b1[_0x8bcc('0x1d')]('utf8');return _0x4e6fc4;}; \ No newline at end of file +var _0x2b41=['secret','createCipher','utf8','base64','decryptString','bluebird','lodash','../../config/logger','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','write','end','final','close','unlink','decryptFile','createReadStream','createDecipher','encryptString'];(function(_0x173817,_0x648dfb){var _0x2c1119=function(_0x12b44b){while(--_0x12b44b){_0x173817['push'](_0x173817['shift']());}};_0x2c1119(++_0x648dfb);}(_0x2b41,0x170));var _0x12b4=function(_0x39b82f,_0x101ffc){_0x39b82f=_0x39b82f-0x0;var _0x1cbdd9=_0x2b41[_0x39b82f];return _0x1cbdd9;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x12b4('0x0'));var _=require(_0x12b4('0x1'));var config=require('../../config/environment');var logger=require(_0x12b4('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x12b4('0x3')][_0x12b4('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x12b4('0x5')};if(config[_0x12b4('0x6')]&&config[_0x12b4('0x6')][_0x12b4('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x12b4('0x7')]);if(isSupported){fileOptions[_0x12b4('0x7')]=config[_0x12b4('0x6')][_0x12b4('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x12b4('0x8')](',\x20');logger[_0x12b4('0x9')](config['encrypt']['algorithm'],_0x12b4('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x184215){return AES_SUPPORTED_RX['test'](_0x184215);}function getSupportedCiphers(){return crypto[_0x12b4('0xb')]()[_0x12b4('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0xa5e5a0){return getSupportedCiphers()['indexOf'](_0xa5e5a0)>-0x1;}function combineOptions(_0x1251af){var _0x349ae7={};for(var _0x4333a6 in fileOptions){if(fileOptions[_0x12b4('0xd')](_0x4333a6)){_0x349ae7[_0x4333a6]=fileOptions[_0x4333a6];}}if(_0x1251af){for(var _0x22bcff in _0x1251af){if(_0x1251af[_0x12b4('0xd')](_0x22bcff)){_0x349ae7[_0x22bcff]=_0x1251af[_0x22bcff];}}}return _0x349ae7;}exports[_0x12b4('0xe')]=function(_0x4b5101,_0x390083,_0x3519a5,_0x4f5257){return new BPromise(function(_0x54b8ff,_0x1f4be0){_0x4f5257=combineOptions(_0x4f5257);var _0x2c802e=new Buffer(_0x3519a5);var _0x1e79ff=fs['createReadStream'](_0x4b5101);var _0x1e444e=fs[_0x12b4('0xf')](_0x390083);var _0x24caca=crypto['createCipher'](_0x4f5257[_0x12b4('0x7')],_0x2c802e);_0x1e79ff['on'](_0x12b4('0x10'),function(_0xd1d658){var _0x44f7a8=new Buffer(_0x24caca[_0x12b4('0x11')](_0xd1d658),_0x12b4('0x12'));_0x1e444e[_0x12b4('0x13')](_0x44f7a8);});_0x1e79ff['on'](_0x12b4('0x14'),function(){try{var _0x40b211=new Buffer(_0x24caca[_0x12b4('0x15')](_0x12b4('0x12')),_0x12b4('0x12'));_0x1e444e[_0x12b4('0x13')](_0x40b211);_0x1e444e['end']();_0x1e444e['on'](_0x12b4('0x16'),function(){return _0x54b8ff(_0x390083);});}catch(_0x1a9b96){fs[_0x12b4('0x17')](_0x390083);return _0x1f4be0(_0x1a9b96);}});});};exports[_0x12b4('0x18')]=function(_0x40a5b1,_0x3eddbf,_0x1831a3,_0x315efb){return new BPromise(function(_0x4ed5da,_0x473888){_0x315efb=combineOptions(_0x315efb);var _0x563e13=new Buffer(_0x1831a3);var _0x56d216=fs[_0x12b4('0x19')](_0x40a5b1);var _0x297dda=fs[_0x12b4('0xf')](_0x3eddbf);var _0x88d69e=crypto[_0x12b4('0x1a')](_0x315efb[_0x12b4('0x7')],_0x563e13);_0x56d216['on'](_0x12b4('0x10'),function(_0x542b8c){var _0x1bd1a5=new Buffer(_0x88d69e[_0x12b4('0x11')](_0x542b8c),_0x12b4('0x12'));_0x297dda[_0x12b4('0x13')](_0x1bd1a5);});_0x56d216['on']('end',function(){try{var _0x4ccf42=new Buffer(_0x88d69e[_0x12b4('0x15')](_0x12b4('0x12')),_0x12b4('0x12'));_0x297dda[_0x12b4('0x13')](_0x4ccf42);_0x297dda[_0x12b4('0x14')]();_0x297dda['on'](_0x12b4('0x16'),function(){return _0x4ed5da(_0x3eddbf);});}catch(_0x3275a7){fs[_0x12b4('0x17')](_0x3eddbf);return _0x473888(_0x3275a7);}});});};exports[_0x12b4('0x1b')]=function(_0x566134,_0x5edcf9,_0x580dc9){var _0x384e2f=_0x580dc9||stringOptions['algorithm'];var _0x23f449=_0x5edcf9||stringOptions[_0x12b4('0x1c')];var _0x37faf2=crypto[_0x12b4('0x1d')](_0x384e2f,_0x23f449);var _0x38f164=_0x37faf2['update'](_0x566134,_0x12b4('0x1e'),'base64');_0x38f164+=_0x37faf2[_0x12b4('0x15')](_0x12b4('0x1f'));return _0x38f164;};exports[_0x12b4('0x20')]=function(_0x356be3,_0x5dd333,_0x3b4c61){var _0x2f78e8=_0x3b4c61||stringOptions[_0x12b4('0x7')];var _0x56c645=_0x5dd333||stringOptions[_0x12b4('0x1c')];var _0x341729=crypto[_0x12b4('0x1a')](_0x2f78e8,_0x56c645);var _0xf0d8e=_0x341729[_0x12b4('0x11')](_0x356be3,_0x12b4('0x1f'),_0x12b4('0x1e'));_0xf0d8e+=_0x341729[_0x12b4('0x15')](_0x12b4('0x1e'));return _0xf0d8e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 727b4d4..9a9c3ad 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 _0x8cc6=['rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','.csv','length','existsSync','join','mkdirSync','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','Completed','catch','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir'];(function(_0x1f6704,_0x106f36){var _0x4acab6=function(_0x398633){while(--_0x398633){_0x1f6704['push'](_0x1f6704['shift']());}};_0x4acab6(++_0x106f36);}(_0x8cc6,0x12c));var _0x68cc=function(_0x2fa631,_0x4a4c69){_0x2fa631=_0x2fa631-0x0;var _0xbda38c=_0x8cc6[_0x2fa631];return _0xbda38c;};'use strict';var util=require(_0x68cc('0x0'));var path=require(_0x68cc('0x1'));var _=require(_0x68cc('0x2'));var csv=require(_0x68cc('0x3'));var fs=require('fs');var BPromise=require(_0x68cc('0x4'));var zipdir=require(_0x68cc('0x5'));var rimraf=require(_0x68cc('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x68cc('0x7'))[_0x68cc('0x8')];var logger=require(_0x68cc('0x9'))(_0x68cc('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x68cc('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x36b2cd,_0x3b1803){var _0x3e0b40={'status':_0x36b2cd};var _0x2385ad={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b1803){_0x3e0b40[_0x68cc('0xc')]=_0x3b1803;}return db[_0x68cc('0xd')][_0x68cc('0xe')](_0x3e0b40,_0x2385ad);}function main(){var _0x1f2ba5=0x1388;var _0x4af662;logger[_0x68cc('0xf')](util[_0x68cc('0x10')](_0x68cc('0x11'),EXTRACTED_REPORT_ID,_0x68cc('0x12')));return db[_0x68cc('0x13')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x68cc('0x14'),_0x68cc('0x15')]})[_0x68cc('0x16')](function(_0x1b4793){if(_0x1b4793){_0x4af662=_0x1b4793;_0x1f2ba5=_0x4af662[_0x68cc('0x15')]||0x1388;}})[_0x68cc('0x16')](function(){return dbH['sequelize']['query'](util[_0x68cc('0x10')](_0x68cc('0x17'),QUERY),{'type':dbH[_0x68cc('0x18')]['QueryTypes'][_0x68cc('0x19')]});})[_0x68cc('0x16')](function(_0xd29ffb){if(!_0xd29ffb[0x0][_0x68cc('0x1a')]){return analyticExtractedReport(_0x68cc('0x1b'));}var _0x6b430f=[];var _0x45d16b=0x0;if(_0x4af662['split']){if(_0xd29ffb&&_0xd29ffb['length']){var _0x20b96e=_[_0x68cc('0x1c')](_0xd29ffb[0x0][_0x68cc('0x1a')]/_0x1f2ba5);var _0x18b0b6=Number[_0x68cc('0x1d')](_0xd29ffb[0x0][_0x68cc('0x1a')]/_0x1f2ba5)?_0xd29ffb[0x0][_0x68cc('0x1a')]%_0x1f2ba5:0x0;_0x20b96e[_0x68cc('0x1e')](function(_0x14482f){if(_0x14482f>0x0){_0x45d16b+=_0x1f2ba5;}_0x6b430f[_0x68cc('0x1f')](dbH[_0x68cc('0x18')]['query'](util['format'](_0x68cc('0x20'),QUERY,_0x1f2ba5,_0x45d16b),{'type':dbH[_0x68cc('0x18')][_0x68cc('0x21')][_0x68cc('0x19')]}));});if(_0x18b0b6>0x0){_0x45d16b+=_0x1f2ba5;_0x6b430f[_0x68cc('0x1f')](dbH[_0x68cc('0x18')][_0x68cc('0x22')](util[_0x68cc('0x10')](_0x68cc('0x20'),QUERY,_0x18b0b6,_0x45d16b),{'type':dbH[_0x68cc('0x18')][_0x68cc('0x21')]['SELECT']}));}}}else{_0x6b430f[_0x68cc('0x1f')](dbH[_0x68cc('0x18')][_0x68cc('0x22')](QUERY,{'type':dbH[_0x68cc('0x18')][_0x68cc('0x21')][_0x68cc('0x19')]}));}var _0x231d5b=path['dirname'](PATH);var _0x191747=path['basename'](PATH,_0x68cc('0x23'));var _0x331b25=_0x4af662[_0x68cc('0x14')]&&_0x6b430f[_0x68cc('0x24')]>0x1;var _0xeb2dac=[];if(!fs[_0x68cc('0x25')](path[_0x68cc('0x26')](_0x231d5b,_0x191747))&&_0x331b25){fs[_0x68cc('0x27')](path[_0x68cc('0x26')](_0x231d5b,_0x191747));}return BPromise['each'](_0x6b430f,function(_0x3b31fa){_0xeb2dac[_0x68cc('0x1f')](_0x3b31fa);})[_0x68cc('0x16')](function(){for(var _0x1d4af8=0x0;_0x1d4af8<_0xeb2dac[_0x68cc('0x24')];_0x1d4af8+=0x1){var _0x14ad6c;var _0x2d600d=_0xeb2dac[_0x1d4af8];if(_0x331b25){_0x14ad6c=path['join'](_0x231d5b,_0x191747,util[_0x68cc('0x10')](_0x68cc('0x28'),_0x191747,_0x1d4af8,'csv'));}else{_0x14ad6c=path[_0x68cc('0x26')](_0x231d5b,util[_0x68cc('0x10')](_0x68cc('0x29'),_0x191747,_0x68cc('0x2a')));}fs[_0x68cc('0x2b')](_0x14ad6c,csv(_0x2d600d));}})['then'](function(){if(_0x331b25){return new Promise(function(_0xd588a5){zipdir(path[_0x68cc('0x26')](_0x231d5b,_0x191747),{'saveTo':path[_0x68cc('0x26')](_0x231d5b,util['format']('%s.%s',_0x191747,_0x68cc('0x2c')))},function(_0x1f8e0f,_0x382d3c){rimraf(path[_0x68cc('0x26')](_0x231d5b,_0x191747),function(){});_0xd588a5(_0x68cc('0x2d'));});});}})['then'](function(){logger[_0x68cc('0xf')](util[_0x68cc('0x10')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x68cc('0x12')));return analyticExtractedReport(_0x68cc('0x2e'),_0x331b25?util[_0x68cc('0x10')](_0x68cc('0x29'),_0x191747,_0x331b25?_0x68cc('0x2c'):_0x68cc('0x2a')):null);});})[_0x68cc('0x2f')](function(_0x2b56a){logger['info'](util[_0x68cc('0x10')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x68cc('0x12')),util['inspect'](_0x2b56a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x68cc('0x30'));})[_0x68cc('0x31')](function(){process[_0x68cc('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3710=['%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','isInteger','forEach','push'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3710,0x1f2));var _0x0371=function(_0x390b06,_0x144936){_0x390b06=_0x390b06-0x0;var _0x12168d=_0x3710[_0x390b06];return _0x12168d;};'use strict';var util=require(_0x0371('0x0'));var path=require(_0x0371('0x1'));var _=require(_0x0371('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x0371('0x3'));var zipdir=require(_0x0371('0x4'));var rimraf=require(_0x0371('0x5'));var db=require(_0x0371('0x6'))['db'];var dbH=require(_0x0371('0x6'))[_0x0371('0x7')];var logger=require('../../config/logger')(_0x0371('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0371('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xa835f5,_0x59106b){var _0x396608={'status':_0xa835f5};var _0x5c1caa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59106b){_0x396608[_0x0371('0xa')]=_0x59106b;}return db[_0x0371('0xb')][_0x0371('0xc')](_0x396608,_0x5c1caa);}function main(){var _0xa19a51=0x1388;var _0x5e6d54;logger[_0x0371('0xd')](util['format'](_0x0371('0xe'),EXTRACTED_REPORT_ID,_0x0371('0xf')));return db[_0x0371('0x10')][_0x0371('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0371('0x12'),_0x0371('0x13')]})[_0x0371('0x14')](function(_0x26a506){if(_0x26a506){_0x5e6d54=_0x26a506;_0xa19a51=_0x5e6d54['splitSizeCsv']||0x1388;}})[_0x0371('0x14')](function(){return dbH[_0x0371('0x15')][_0x0371('0x16')](util[_0x0371('0x17')](_0x0371('0x18'),QUERY),{'type':dbH[_0x0371('0x15')][_0x0371('0x19')][_0x0371('0x1a')]});})[_0x0371('0x14')](function(_0x4739c3){if(!_0x4739c3[0x0][_0x0371('0x1b')]){return analyticExtractedReport(_0x0371('0x1c'));}var _0x582af0=[];var _0x517852=0x0;if(_0x5e6d54[_0x0371('0x12')]){if(_0x4739c3&&_0x4739c3['length']){var _0x531474=_['range'](_0x4739c3[0x0][_0x0371('0x1b')]/_0xa19a51);var _0xb8a5b2=Number[_0x0371('0x1d')](_0x4739c3[0x0][_0x0371('0x1b')]/_0xa19a51)?_0x4739c3[0x0][_0x0371('0x1b')]%_0xa19a51:0x0;_0x531474[_0x0371('0x1e')](function(_0x1f66ee){if(_0x1f66ee>0x0){_0x517852+=_0xa19a51;}_0x582af0[_0x0371('0x1f')](dbH[_0x0371('0x15')][_0x0371('0x16')](util[_0x0371('0x17')](_0x0371('0x20'),QUERY,_0xa19a51,_0x517852),{'type':dbH[_0x0371('0x15')][_0x0371('0x19')]['SELECT']}));});if(_0xb8a5b2>0x0){_0x517852+=_0xa19a51;_0x582af0['push'](dbH[_0x0371('0x15')]['query'](util[_0x0371('0x17')](_0x0371('0x20'),QUERY,_0xb8a5b2,_0x517852),{'type':dbH['sequelize'][_0x0371('0x19')][_0x0371('0x1a')]}));}}}else{_0x582af0['push'](dbH[_0x0371('0x15')][_0x0371('0x16')](QUERY,{'type':dbH[_0x0371('0x15')][_0x0371('0x19')][_0x0371('0x1a')]}));}var _0x4c1a0b=path['dirname'](PATH);var _0x10425b=path[_0x0371('0x21')](PATH,_0x0371('0x22'));var _0xb51ac0=_0x5e6d54[_0x0371('0x12')]&&_0x582af0[_0x0371('0x23')]>0x1;var _0x5a4144=[];if(!fs[_0x0371('0x24')](path[_0x0371('0x25')](_0x4c1a0b,_0x10425b))&&_0xb51ac0){fs[_0x0371('0x26')](path[_0x0371('0x25')](_0x4c1a0b,_0x10425b));}return BPromise[_0x0371('0x27')](_0x582af0,function(_0x47ea09){_0x5a4144[_0x0371('0x1f')](_0x47ea09);})[_0x0371('0x14')](function(){for(var _0x29c1ec=0x0;_0x29c1ec<_0x5a4144[_0x0371('0x23')];_0x29c1ec+=0x1){var _0x3b115f;var _0x1564c3=_0x5a4144[_0x29c1ec];if(_0xb51ac0){_0x3b115f=path[_0x0371('0x25')](_0x4c1a0b,_0x10425b,util[_0x0371('0x17')](_0x0371('0x28'),_0x10425b,_0x29c1ec,_0x0371('0x29')));}else{_0x3b115f=path[_0x0371('0x25')](_0x4c1a0b,util['format'](_0x0371('0x2a'),_0x10425b,'csv'));}fs[_0x0371('0x2b')](_0x3b115f,csv(_0x1564c3));}})[_0x0371('0x14')](function(){if(_0xb51ac0){return new Promise(function(_0x5d4ac9){zipdir(path[_0x0371('0x25')](_0x4c1a0b,_0x10425b),{'saveTo':path['join'](_0x4c1a0b,util['format']('%s.%s',_0x10425b,_0x0371('0x2c')))},function(_0x3e64f3,_0x38441e){rimraf(path[_0x0371('0x25')](_0x4c1a0b,_0x10425b),function(){});_0x5d4ac9('zip\x20finished');});});}})[_0x0371('0x14')](function(){logger['info'](util['format'](_0x0371('0x2d'),EXTRACTED_REPORT_ID,_0x0371('0xf')));return analyticExtractedReport(_0x0371('0x2e'),_0xb51ac0?util[_0x0371('0x17')](_0x0371('0x2a'),_0x10425b,_0xb51ac0?_0x0371('0x2c'):_0x0371('0x29')):null);});})[_0x0371('0x2f')](function(_0x54c2f4){logger[_0x0371('0xd')](util[_0x0371('0x17')](_0x0371('0x30'),EXTRACTED_REPORT_ID,_0x0371('0xf')),util[_0x0371('0x31')](_0x54c2f4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0371('0x32'));})[_0x0371('0x33')](function(){process[_0x0371('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 2669bb1..b014ddc 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 _0xb3d8=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','tableHeader','map','pick','toString','length','auto','body','chunk','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','margin','footer','Arial','right','Empty','find','splitSizePdf','then','split','range','num','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','QueryTypes','dirname','.pdf','existsSync','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','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','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xb3d8,0x6f));var _0x8b3d=function(_0x7d2b87,_0x160db0){_0x7d2b87=_0x7d2b87-0x0;var _0x2c7463=_0xb3d8[_0x7d2b87];return _0x2c7463;};'use strict';var _=require(_0x8b3d('0x0'));var fs=require('fs');var util=require(_0x8b3d('0x1'));var path=require(_0x8b3d('0x2'));var moment=require(_0x8b3d('0x3'));var htmlToPdfmake=require(_0x8b3d('0x4'));var PdfPrinter=require(_0x8b3d('0x5'));var zipdir=require(_0x8b3d('0x6'));var rimraf=require(_0x8b3d('0x7'));var JSDOM=require(_0x8b3d('0x8'))[_0x8b3d('0x9')];var window=new JSDOM('')[_0x8b3d('0xa')];var BPromise=require(_0x8b3d('0xb'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8b3d('0xc'))[_0x8b3d('0xd')];var logger=require(_0x8b3d('0xe'))(_0x8b3d('0xf'));var EXTRACTED_REPORT_ID=Number(process[_0x8b3d('0x10')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8b3d('0x10')][0x4];var NAME=process[_0x8b3d('0x10')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x467e9a,_0x601a93){var _0xc16fb2={'status':_0x467e9a};var _0x30c3cc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x601a93){_0xc16fb2[_0x8b3d('0x11')]=_0x601a93;}return db['AnalyticExtractedReport'][_0x8b3d('0x12')](_0xc16fb2,_0x30c3cc);}function getHeaders(_0x142a9d){return _['map'](_0x142a9d,function(_0x4378b0){return{'text':_0x4378b0,'style':_0x8b3d('0x13')};});}function getRows(_0x831c37,_0x1e6284){return _[_0x8b3d('0x14')](_0x1e6284,function(_0x3796b3){return _(_0x3796b3)[_0x8b3d('0x15')](_0x831c37)[_0x8b3d('0x14')](function(_0x268987){return _0x268987?_[_0x8b3d('0x16')](_0x268987):'';})['value']();});}function createTable(_0x1a3e18,_0xed608d){var _0x4e2138={'widths':_['fill'](Array(_0x1a3e18[_0x8b3d('0x17')]),0x91),'heights':function(_0x94ba7e){return _0x94ba7e===0x0?_0x8b3d('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x391cd=getHeaders(_0x1a3e18);_0x4e2138[_0x8b3d('0x19')]['push'](_0x391cd);var _0x4b37a0=getRows(_0x1a3e18,_0xed608d);_0x4e2138[_0x8b3d('0x19')]=_0x4e2138['body']['concat'](_0x4b37a0);return _0x4e2138;}function createTables(_0x4cdf30){var _0x478d2a=[];var _0x52e270=_[_0x8b3d('0x1a')](Object['keys'](_0x4cdf30[0x0]),0x5);_0x52e270[_0x8b3d('0x1b')](function(_0x1bb16b){_0x478d2a[_0x8b3d('0x1c')](createTable(_0x1bb16b,_0x4cdf30));});return _0x478d2a;}function getPDFDocDefinition(_0x476504){var _0x2a00f1=util[_0x8b3d('0x1d')](_0x8b3d('0x1e'),NAME,EXTRACTED_REPORT[_0x8b3d('0x1f')],moment(EXTRACTED_REPORT[_0x8b3d('0x20')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8b3d('0x1d')](FORMAT));var _0x437fea=[];for(var _0x4cf06b=0x0;_0x4cf06b<_0x476504['length'];_0x4cf06b++){var _0x4a7b86=[];if(_0x4cf06b===0x0){_0x4a7b86[_0x8b3d('0x1c')]({'text':_0x2a00f1,'style':_0x8b3d('0x21')});}var _0x3cbb52={'table':_0x476504[_0x4cf06b]};if(_0x4cf06b>0x0){_0x3cbb52[_0x8b3d('0x22')]='before';_0x3cbb52[_0x8b3d('0x23')]=[0x0,0x46,0x0,0x0];}_0x4a7b86[_0x8b3d('0x1c')](_0x3cbb52);_0x437fea[_0x8b3d('0x1c')](_0x4a7b86);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x437fea,'footer':function(_0x42e661,_0x3f6a5f){return{'text':_0x42e661[_0x8b3d('0x16')]()+'\x20/\x20'+_0x3f6a5f,'style':_0x8b3d('0x24')};},'defaultStyle':{'font':_0x8b3d('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x8b3d('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xff6d19){var _0x1c29ca=0x1388;var _0x354f0a;if(!_0xff6d19[0x0]['num']){return analyticExtractedReport(_0x8b3d('0x27'));}return db['Setting'][_0x8b3d('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8b3d('0x29')]})[_0x8b3d('0x2a')](function(_0x5f66a1){if(_0x5f66a1){_0x354f0a=_0x5f66a1;_0x1c29ca=_0x354f0a['splitSizePdf']||0x3e8;}})[_0x8b3d('0x2a')](function(){var _0x379cba=[];var _0x2ab673=0x0;if(_0x354f0a[_0x8b3d('0x2b')]){if(_0xff6d19&&_0xff6d19['length']){var _0x370a71=_[_0x8b3d('0x2c')](_0xff6d19[0x0][_0x8b3d('0x2d')]/_0x1c29ca);var _0x4ebbcb=Number[_0x8b3d('0x2e')](_0xff6d19[0x0][_0x8b3d('0x2d')]/_0x1c29ca)?_0xff6d19[0x0][_0x8b3d('0x2d')]%_0x1c29ca:0x0;_0x370a71[_0x8b3d('0x1b')](function(_0x1145a8){if(_0x1145a8>0x0){_0x2ab673+=_0x1c29ca;}_0x379cba[_0x8b3d('0x1c')](dbH['sequelize'][_0x8b3d('0x2f')](util[_0x8b3d('0x1d')](_0x8b3d('0x30'),QUERY,_0x1c29ca,_0x2ab673),{'type':dbH[_0x8b3d('0x31')]['QueryTypes'][_0x8b3d('0x32')]}));});if(_0x4ebbcb>0x0){_0x2ab673+=_0x1c29ca;_0x379cba[_0x8b3d('0x1c')](dbH[_0x8b3d('0x31')][_0x8b3d('0x2f')](util['format'](_0x8b3d('0x30'),QUERY,_0x4ebbcb,_0x2ab673),{'type':dbH[_0x8b3d('0x31')]['QueryTypes']['SELECT']}));}}}else{_0x379cba[_0x8b3d('0x1c')](dbH[_0x8b3d('0x31')][_0x8b3d('0x2f')](QUERY,{'type':dbH[_0x8b3d('0x31')][_0x8b3d('0x33')][_0x8b3d('0x32')]}));}var _0x25d771=path[_0x8b3d('0x34')](PATH);var _0x9e1f9=path['basename'](PATH,_0x8b3d('0x35'));var _0x3ec6a2=_0x354f0a[_0x8b3d('0x2b')]&&_0x379cba['length']>0x1;var _0x362563=[];if(!fs[_0x8b3d('0x36')](path[_0x8b3d('0x37')](_0x25d771,_0x9e1f9))&&_0x3ec6a2){fs[_0x8b3d('0x38')](path[_0x8b3d('0x37')](_0x25d771,_0x9e1f9));}return BPromise[_0x8b3d('0x39')](_0x379cba,function(_0xa9070e){_0x362563[_0x8b3d('0x1c')](_0xa9070e);})[_0x8b3d('0x2a')](function(){var _0x372477=[];for(var _0x30b01c=0x0;_0x30b01c<_0x362563[_0x8b3d('0x17')];_0x30b01c+=0x1){var _0x374e6d=_0x362563[_0x30b01c];var _0x553414=createTables(_['flatten'](_0x374e6d));var _0x371dae;var _0x38a6b3=getPDFDocDefinition(_0x553414);var _0x9c2c8e=getPDFPrinter();var _0x53119c=_0x9c2c8e['createPdfKitDocument'](_0x38a6b3);if(_0x3ec6a2){_0x371dae=path['join'](_0x25d771,_0x9e1f9,util['format'](_0x8b3d('0x3a'),_0x9e1f9,_0x30b01c,_0x8b3d('0x3b')));}else{_0x371dae=path[_0x8b3d('0x37')](_0x25d771,util['format'](_0x8b3d('0x3c'),_0x9e1f9,_0x8b3d('0x3b')));}_0x372477['push'](writePDFDocument(_0x53119c,_0x371dae));}return Promise[_0x8b3d('0x3d')](_0x372477);})[_0x8b3d('0x2a')](function(){if(_0x3ec6a2){return new Promise(function(_0x258df5){zipdir(path[_0x8b3d('0x37')](_0x25d771,_0x9e1f9),{'saveTo':path[_0x8b3d('0x37')](_0x25d771,util['format'](_0x8b3d('0x3c'),_0x9e1f9,_0x8b3d('0x3e')))},function(){rimraf(path[_0x8b3d('0x37')](_0x25d771,_0x9e1f9),function(){});_0x258df5(_0x8b3d('0x3f'));});});}})[_0x8b3d('0x2a')](function(){if(!_0x3ec6a2)return;rimraf(path[_0x8b3d('0x37')](_0x25d771,_0x9e1f9),function(){});})['then'](function(){logger[_0x8b3d('0x40')](util['format'](_0x8b3d('0x41'),EXTRACTED_REPORT_ID,_0x8b3d('0x42')));return analyticExtractedReport(_0x8b3d('0x43'),_0x3ec6a2?util[_0x8b3d('0x1d')](_0x8b3d('0x3c'),_0x9e1f9,_0x3ec6a2?_0x8b3d('0x3e'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x8b3d('0x44'),EXTRACTED_REPORT_ID,_0x8b3d('0x42')));return db[_0x8b3d('0x45')][_0x8b3d('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1634ed){EXTRACTED_REPORT=_0x1634ed;return dbH[_0x8b3d('0x31')][_0x8b3d('0x2f')](util[_0x8b3d('0x1d')](_0x8b3d('0x47'),QUERY),{'type':dbH[_0x8b3d('0x31')]['QueryTypes'][_0x8b3d('0x32')]});})[_0x8b3d('0x2a')](extractReport)[_0x8b3d('0x48')](function(_0x570fc7){logger[_0x8b3d('0x40')](util[_0x8b3d('0x1d')](_0x8b3d('0x49'),EXTRACTED_REPORT_ID,_0x8b3d('0x42')),util[_0x8b3d('0x4a')](_0x570fc7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8b3d('0x4b'));})['finally'](function(){process[_0x8b3d('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x22c714=new PdfPrinter({'Arial':{'normal':__dirname+_0x8b3d('0x4d'),'bold':__dirname+_0x8b3d('0x4e'),'italics':__dirname+_0x8b3d('0x4f'),'bolditalics':__dirname+_0x8b3d('0x50')}});return _0x22c714;}function getPDFDocDefinitionFromHTML(_0x5c7e0f,_0x414d23){var _0x3f3c45=util[_0x8b3d('0x1d')](_0x8b3d('0x51'),_0x414d23[_0x8b3d('0x52')],_0x414d23[_0x8b3d('0x53')]);var _0x18702b=moment()[_0x8b3d('0x1d')](_0x8b3d('0x54'))['toString']();var _0x2670a7=htmlToPdfmake(_0x5c7e0f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2670a7],'defaultStyle':{'font':_0x8b3d('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8b3d('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8b3d('0x55')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x69be70,_0x497cf1){return[{'text':util[_0x8b3d('0x1d')](_0x8b3d('0x56'),_0x3f3c45,_0x69be70,_0x497cf1,_0x18702b),'style':_0x8b3d('0x24')}];}};}function writePDFDocument(_0x5c4806,_0x2b4a19){return new Promise(function(_0x454b0c,_0x3ac9e2){var _0xa0d8e4=_0x5c4806[_0x8b3d('0x57')](fs['createWriteStream'](_0x2b4a19));_0xa0d8e4['on']('finish',function(){_0x454b0c(_0x8b3d('0x58'));});_0xa0d8e4['on'](_0x8b3d('0x59'),function(_0x1c2488){_0x3ac9e2(_0x1c2488);});_0x5c4806[_0x8b3d('0x5a')]();});}exports['createPdfFromHTML']=function(_0x524638,_0x311af2){var _0x1c9148=getPDFPrinter();var _0x7da987=getPDFDocDefinitionFromHTML(_0x524638,_0x311af2);var _0x54b225=_0x1c9148[_0x8b3d('0x5b')](_0x7da987);return writePDFDocument(_0x54b225,_0x311af2[_0x8b3d('0x2')])['catch'](function(_0x231d3f){throw _0x231d3f;});}; \ No newline at end of file +var _0x72ee=['map','tableHeader','toString','value','fill','auto','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','length','pageBreak','before','margin','landscape','\x20/\x20','Arial','Empty','Setting','splitSizePdf','then','range','num','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','basename','split','join','flatten','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update'];(function(_0x5079a5,_0x4b7a9e){var _0x24d579=function(_0x1ccbb1){while(--_0x1ccbb1){_0x5079a5['push'](_0x5079a5['shift']());}};_0x24d579(++_0x4b7a9e);}(_0x72ee,0xfa));var _0xe72e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x72ee[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe72e('0x0'));var fs=require('fs');var util=require(_0xe72e('0x1'));var path=require(_0xe72e('0x2'));var moment=require(_0xe72e('0x3'));var htmlToPdfmake=require(_0xe72e('0x4'));var PdfPrinter=require(_0xe72e('0x5'));var zipdir=require(_0xe72e('0x6'));var rimraf=require(_0xe72e('0x7'));var JSDOM=require(_0xe72e('0x8'))[_0xe72e('0x9')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0xe72e('0xa'))['db'];var dbH=require(_0xe72e('0xa'))[_0xe72e('0xb')];var logger=require(_0xe72e('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe72e('0xd')][0x2]);var QUERY=process[_0xe72e('0xd')][0x3];var PATH=process[_0xe72e('0xd')][0x4];var NAME=process[_0xe72e('0xd')][0x5];var FORMAT=_0xe72e('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cc374,_0x1a8292){var _0x226300={'status':_0x5cc374};var _0x470399={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a8292){_0x226300['savename']=_0x1a8292;}return db[_0xe72e('0xf')][_0xe72e('0x10')](_0x226300,_0x470399);}function getHeaders(_0x5a149a){return _[_0xe72e('0x11')](_0x5a149a,function(_0xd660f8){return{'text':_0xd660f8,'style':_0xe72e('0x12')};});}function getRows(_0x3e054a,_0x52e411){return _['map'](_0x52e411,function(_0x1f595f){return _(_0x1f595f)['pick'](_0x3e054a)[_0xe72e('0x11')](function(_0x5be087){return _0x5be087?_[_0xe72e('0x13')](_0x5be087):'';})[_0xe72e('0x14')]();});}function createTable(_0x4bd0db,_0x27d1c3){var _0x54a84b={'widths':_[_0xe72e('0x15')](Array(_0x4bd0db['length']),0x91),'heights':function(_0x574429){return _0x574429===0x0?_0xe72e('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3ddb7a=getHeaders(_0x4bd0db);_0x54a84b[_0xe72e('0x17')][_0xe72e('0x18')](_0x3ddb7a);var _0x4c5277=getRows(_0x4bd0db,_0x27d1c3);_0x54a84b[_0xe72e('0x17')]=_0x54a84b['body'][_0xe72e('0x19')](_0x4c5277);return _0x54a84b;}function createTables(_0x4d5628){var _0x4e5b80=[];var _0xe94d10=_[_0xe72e('0x1a')](Object[_0xe72e('0x1b')](_0x4d5628[0x0]),0x5);_0xe94d10['forEach'](function(_0x249929){_0x4e5b80[_0xe72e('0x18')](createTable(_0x249929,_0x4d5628));});return _0x4e5b80;}function getPDFDocDefinition(_0x4e6333){var _0x58388e=util[_0xe72e('0x1c')](_0xe72e('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xe72e('0x1e')])[_0xe72e('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xe72e('0x1f')])[_0xe72e('0x1c')](FORMAT));var _0x3cac56=[];for(var _0x31468c=0x0;_0x31468c<_0x4e6333[_0xe72e('0x20')];_0x31468c++){var _0xda3ddf=[];if(_0x31468c===0x0){_0xda3ddf[_0xe72e('0x18')]({'text':_0x58388e,'style':'header'});}var _0x490c01={'table':_0x4e6333[_0x31468c]};if(_0x31468c>0x0){_0x490c01[_0xe72e('0x21')]=_0xe72e('0x22');_0x490c01[_0xe72e('0x23')]=[0x0,0x46,0x0,0x0];}_0xda3ddf[_0xe72e('0x18')](_0x490c01);_0x3cac56[_0xe72e('0x18')](_0xda3ddf);}return{'pageSize':'A4','pageOrientation':_0xe72e('0x24'),'content':_0x3cac56,'footer':function(_0x15dd9e,_0x2b9c5c){return{'text':_0x15dd9e['toString']()+_0xe72e('0x25')+_0x2b9c5c,'style':'footer'};},'defaultStyle':{'font':_0xe72e('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x561e82){var _0x26b1d7=0x1388;var _0x214956;if(!_0x561e82[0x0]['num']){return analyticExtractedReport(_0xe72e('0x27'));}return db[_0xe72e('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe72e('0x29')]})[_0xe72e('0x2a')](function(_0x3b151c){if(_0x3b151c){_0x214956=_0x3b151c;_0x26b1d7=_0x214956['splitSizePdf']||0x3e8;}})[_0xe72e('0x2a')](function(){var _0x2737e2=[];var _0x1143ba=0x0;if(_0x214956['split']){if(_0x561e82&&_0x561e82['length']){var _0x447a25=_[_0xe72e('0x2b')](_0x561e82[0x0][_0xe72e('0x2c')]/_0x26b1d7);var _0x5cb77c=Number[_0xe72e('0x2d')](_0x561e82[0x0]['num']/_0x26b1d7)?_0x561e82[0x0]['num']%_0x26b1d7:0x0;_0x447a25['forEach'](function(_0x3ae7a4){if(_0x3ae7a4>0x0){_0x1143ba+=_0x26b1d7;}_0x2737e2[_0xe72e('0x18')](dbH['sequelize'][_0xe72e('0x2e')](util[_0xe72e('0x1c')](_0xe72e('0x2f'),QUERY,_0x26b1d7,_0x1143ba),{'type':dbH[_0xe72e('0x30')][_0xe72e('0x31')][_0xe72e('0x32')]}));});if(_0x5cb77c>0x0){_0x1143ba+=_0x26b1d7;_0x2737e2['push'](dbH[_0xe72e('0x30')][_0xe72e('0x2e')](util['format'](_0xe72e('0x2f'),QUERY,_0x5cb77c,_0x1143ba),{'type':dbH[_0xe72e('0x30')][_0xe72e('0x31')][_0xe72e('0x32')]}));}}}else{_0x2737e2[_0xe72e('0x18')](dbH[_0xe72e('0x30')][_0xe72e('0x2e')](QUERY,{'type':dbH[_0xe72e('0x30')][_0xe72e('0x31')]['SELECT']}));}var _0x4fda59=path['dirname'](PATH);var _0x304e3a=path[_0xe72e('0x33')](PATH,'.pdf');var _0x539a26=_0x214956[_0xe72e('0x34')]&&_0x2737e2[_0xe72e('0x20')]>0x1;var _0x1356a7=[];if(!fs['existsSync'](path[_0xe72e('0x35')](_0x4fda59,_0x304e3a))&&_0x539a26){fs['mkdirSync'](path['join'](_0x4fda59,_0x304e3a));}return BPromise['each'](_0x2737e2,function(_0x28c665){_0x1356a7['push'](_0x28c665);})[_0xe72e('0x2a')](function(){var _0x3fe072=[];for(var _0x4751de=0x0;_0x4751de<_0x1356a7[_0xe72e('0x20')];_0x4751de+=0x1){var _0x4788ae=_0x1356a7[_0x4751de];var _0x5d471e=createTables(_[_0xe72e('0x36')](_0x4788ae));var _0x7ea1d3;var _0x1648e2=getPDFDocDefinition(_0x5d471e);var _0x5af938=getPDFPrinter();var _0x1b1385=_0x5af938['createPdfKitDocument'](_0x1648e2);if(_0x539a26){_0x7ea1d3=path[_0xe72e('0x35')](_0x4fda59,_0x304e3a,util[_0xe72e('0x1c')](_0xe72e('0x37'),_0x304e3a,_0x4751de,_0xe72e('0x38')));}else{_0x7ea1d3=path['join'](_0x4fda59,util[_0xe72e('0x1c')](_0xe72e('0x39'),_0x304e3a,_0xe72e('0x38')));}_0x3fe072[_0xe72e('0x18')](writePDFDocument(_0x1b1385,_0x7ea1d3));}return Promise[_0xe72e('0x3a')](_0x3fe072);})[_0xe72e('0x2a')](function(){if(_0x539a26){return new Promise(function(_0x355978){zipdir(path[_0xe72e('0x35')](_0x4fda59,_0x304e3a),{'saveTo':path[_0xe72e('0x35')](_0x4fda59,util[_0xe72e('0x1c')](_0xe72e('0x39'),_0x304e3a,_0xe72e('0x3b')))},function(){rimraf(path[_0xe72e('0x35')](_0x4fda59,_0x304e3a),function(){});_0x355978(_0xe72e('0x3c'));});});}})[_0xe72e('0x2a')](function(){if(!_0x539a26)return;rimraf(path[_0xe72e('0x35')](_0x4fda59,_0x304e3a),function(){});})[_0xe72e('0x2a')](function(){logger[_0xe72e('0x3d')](util[_0xe72e('0x1c')](_0xe72e('0x3e'),EXTRACTED_REPORT_ID,_0xe72e('0x3f')));return analyticExtractedReport(_0xe72e('0x40'),_0x539a26?util['format']('%s.%s',_0x304e3a,_0x539a26?_0xe72e('0x3b'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xe72e('0x1c')](_0xe72e('0x41'),EXTRACTED_REPORT_ID,_0xe72e('0x3f')));return db[_0xe72e('0xf')][_0xe72e('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe72e('0x2a')](function(_0x13b83e){EXTRACTED_REPORT=_0x13b83e;return dbH['sequelize']['query'](util[_0xe72e('0x1c')](_0xe72e('0x43'),QUERY),{'type':dbH[_0xe72e('0x30')]['QueryTypes'][_0xe72e('0x32')]});})[_0xe72e('0x2a')](extractReport)[_0xe72e('0x44')](function(_0x411fca){logger[_0xe72e('0x3d')](util[_0xe72e('0x1c')](_0xe72e('0x45'),EXTRACTED_REPORT_ID,'PDF'),util[_0xe72e('0x46')](_0x411fca,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe72e('0x47'));})[_0xe72e('0x48')](function(){process[_0xe72e('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x411057=new PdfPrinter({'Arial':{'normal':__dirname+_0xe72e('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xe72e('0x4b'),'bolditalics':__dirname+_0xe72e('0x4c')}});return _0x411057;}function getPDFDocDefinitionFromHTML(_0x4ab776,_0x159b07){var _0x4b292e=util[_0xe72e('0x1c')](_0xe72e('0x4d'),_0x159b07[_0xe72e('0x4e')],_0x159b07[_0xe72e('0x4f')]);var _0x45d7b6=moment()['format'](_0xe72e('0x50'))[_0xe72e('0x13')]();var _0x386066=htmlToPdfmake(_0x4ab776,{'window':window,'tableAutoSize':!![]});return{'content':[_0x386066],'defaultStyle':{'font':_0xe72e('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe72e('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe72e('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xe72e('0x52'),'style':_0xe72e('0x53')}];},'footer':function(_0x479627,_0x1c0d9a){return[{'text':util[_0xe72e('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x4b292e,_0x479627,_0x1c0d9a,_0x45d7b6),'style':'footer'}];}};}function writePDFDocument(_0x42cc21,_0x2d0c56){return new Promise(function(_0x52d336,_0x33885f){var _0xf86938=_0x42cc21['pipe'](fs['createWriteStream'](_0x2d0c56));_0xf86938['on'](_0xe72e('0x54'),function(){_0x52d336('finish');});_0xf86938['on'](_0xe72e('0x55'),function(_0x1128ae){_0x33885f(_0x1128ae);});_0x42cc21[_0xe72e('0x56')]();});}exports[_0xe72e('0x57')]=function(_0x8a9b33,_0x456d1f){var _0x4fcd65=getPDFPrinter();var _0x3d9785=getPDFDocDefinitionFromHTML(_0x8a9b33,_0x456d1f);var _0x4c7717=_0x4fcd65[_0xe72e('0x58')](_0x3d9785);return writePDFDocument(_0x4c7717,_0x456d1f[_0xe72e('0x2')])[_0xe72e('0x44')](function(_0x2c552a){throw _0x2c552a;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c46af41..75b99c3 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 _0x6901=['splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','lodash','json2xls','rimraf','../../mysqldb','../../config/logger','argv','AnalyticExtractedReport','update','info','format','XLSX','Setting','split'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6901,0x100));var _0x1690=function(_0x29daa3,_0x2a5039){_0x29daa3=_0x29daa3-0x0;var _0x121af7=_0x6901[_0x29daa3];return _0x121af7;};'use strict';var util=require(_0x1690('0x0'));var path=require('path');var _=require(_0x1690('0x1'));var fs=require('fs');var json2xls=require(_0x1690('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x1690('0x3'));var db=require(_0x1690('0x4'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x1690('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1690('0x6')][0x3];var PATH=process[_0x1690('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1635f8,_0x13edbe){var _0x24ef20={'status':_0x1635f8};var _0x888ca9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x13edbe){_0x24ef20['savename']=_0x13edbe;}return db[_0x1690('0x7')][_0x1690('0x8')](_0x24ef20,_0x888ca9);}function main(){var _0x21f1ba=0x1388;var _0x2a82ae;logger[_0x1690('0x9')](util[_0x1690('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1690('0xb')));return db[_0x1690('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1690('0xd'),_0x1690('0xe')]})[_0x1690('0xf')](function(_0x37114f){if(_0x37114f){_0x2a82ae=_0x37114f;_0x21f1ba=_0x2a82ae[_0x1690('0xe')]||0x1388;}})[_0x1690('0xf')](function(){return dbH[_0x1690('0x10')][_0x1690('0x11')](util[_0x1690('0xa')](_0x1690('0x12'),QUERY),{'type':dbH['sequelize'][_0x1690('0x13')][_0x1690('0x14')]});})[_0x1690('0xf')](function(_0x5e0d7f){if(!_0x5e0d7f[0x0]['num']){return analyticExtractedReport(_0x1690('0x15'));}var _0x575010=[];var _0x1e2061=0x0;if(_0x2a82ae['split']){if(_0x5e0d7f&&_0x5e0d7f['length']){var _0x279032=_['range'](_0x5e0d7f[0x0][_0x1690('0x16')]/_0x21f1ba);var _0x2e1696=Number['isInteger'](_0x5e0d7f[0x0][_0x1690('0x16')]/_0x21f1ba)?_0x5e0d7f[0x0][_0x1690('0x16')]%_0x21f1ba:0x0;_0x279032[_0x1690('0x17')](function(_0x65414){if(_0x65414>0x0){_0x1e2061+=_0x21f1ba;}_0x575010['push'](dbH[_0x1690('0x10')]['query'](util[_0x1690('0xa')](_0x1690('0x18'),QUERY,_0x21f1ba,_0x1e2061),{'type':dbH[_0x1690('0x10')][_0x1690('0x13')][_0x1690('0x14')]}));});if(_0x2e1696>0x0){_0x1e2061+=_0x21f1ba;_0x575010[_0x1690('0x19')](dbH[_0x1690('0x10')][_0x1690('0x11')](util[_0x1690('0xa')](_0x1690('0x18'),QUERY,_0x2e1696,_0x1e2061),{'type':dbH[_0x1690('0x10')][_0x1690('0x13')][_0x1690('0x14')]}));}}}else{_0x575010[_0x1690('0x19')](dbH[_0x1690('0x10')][_0x1690('0x11')](QUERY,{'type':dbH[_0x1690('0x10')][_0x1690('0x13')]['SELECT']}));}var _0x1a81a4=path[_0x1690('0x1a')](PATH);var _0x5c1cf8=path[_0x1690('0x1b')](PATH,_0x1690('0x1c'));var _0x252e88=_0x2a82ae[_0x1690('0xd')]&&_0x575010['length']>0x1;var _0x30755f=[];if(!fs[_0x1690('0x1d')](path[_0x1690('0x1e')](_0x1a81a4,_0x5c1cf8))&&_0x252e88){fs[_0x1690('0x1f')](path[_0x1690('0x1e')](_0x1a81a4,_0x5c1cf8));}return BPromise[_0x1690('0x20')](_0x575010,function(_0x4fb78c){_0x30755f['push'](_0x4fb78c);})[_0x1690('0xf')](function(){for(var _0x536c54=0x0;_0x536c54<_0x30755f['length'];_0x536c54+=0x1){var _0x49bd71;var _0x197f60=_0x30755f[_0x536c54];if(_0x252e88){_0x49bd71=path[_0x1690('0x1e')](_0x1a81a4,_0x5c1cf8,util[_0x1690('0xa')](_0x1690('0x21'),_0x5c1cf8,_0x536c54,_0x1690('0x22')));}else{_0x49bd71=path[_0x1690('0x1e')](_0x1a81a4,util[_0x1690('0xa')]('%s.%s',_0x5c1cf8,_0x1690('0x22')));}fs[_0x1690('0x23')](_0x49bd71,json2xls(_0x197f60),_0x1690('0x24'));}})[_0x1690('0xf')](function(){if(_0x252e88){return new Promise(function(_0x584c7b){zipdir(path[_0x1690('0x1e')](_0x1a81a4,_0x5c1cf8),{'saveTo':path[_0x1690('0x1e')](_0x1a81a4,util['format'](_0x1690('0x25'),_0x5c1cf8,_0x1690('0x26')))},function(_0x58a7e5,_0xb89799){rimraf(path[_0x1690('0x1e')](_0x1a81a4,_0x5c1cf8),function(){});_0x584c7b(_0x1690('0x27'));});});}})[_0x1690('0xf')](function(){logger[_0x1690('0x9')](util[_0x1690('0xa')](_0x1690('0x28'),EXTRACTED_REPORT_ID,_0x1690('0xb')));return analyticExtractedReport('Completed',_0x252e88?util[_0x1690('0xa')](_0x1690('0x25'),_0x5c1cf8,_0x252e88?_0x1690('0x26'):_0x1690('0x22')):null);});})['catch'](function(_0x4e43fd){logger[_0x1690('0x9')](util[_0x1690('0xa')](_0x1690('0x29'),EXTRACTED_REPORT_ID,_0x1690('0xb')),util[_0x1690('0x2a')](_0x4e43fd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1690('0x2b'));})['finally'](function(){process[_0x1690('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1e8c=['binary','%s.%s','zip','zip\x20finished','info','Completed','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','range','num','forEach','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','writeFileSync'];(function(_0x4a764f,_0x228c14){var _0xfa7d86=function(_0x50822f){while(--_0x50822f){_0x4a764f['push'](_0x4a764f['shift']());}};_0xfa7d86(++_0x228c14);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0x1e8c[_0x152ea8];return _0x4c0ebe;};'use strict';var util=require('util');var path=require(_0xc1e8('0x0'));var _=require(_0xc1e8('0x1'));var fs=require('fs');var json2xls=require(_0xc1e8('0x2'));var BPromise=require(_0xc1e8('0x3'));var zipdir=require(_0xc1e8('0x4'));var rimraf=require(_0xc1e8('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc1e8('0x6'))[_0xc1e8('0x7')];var logger=require(_0xc1e8('0x8'))(_0xc1e8('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc1e8('0xa')][0x2]);var QUERY=process[_0xc1e8('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x457b9d,_0x40e7cd){var _0x3b5001={'status':_0x457b9d};var _0x48a012={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x40e7cd){_0x3b5001[_0xc1e8('0xb')]=_0x40e7cd;}return db[_0xc1e8('0xc')][_0xc1e8('0xd')](_0x3b5001,_0x48a012);}function main(){var _0x2c5f56=0x1388;var _0x24c6b0;logger['info'](util[_0xc1e8('0xe')](_0xc1e8('0xf'),EXTRACTED_REPORT_ID,_0xc1e8('0x10')));return db[_0xc1e8('0x11')][_0xc1e8('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc1e8('0x13'),_0xc1e8('0x14')]})[_0xc1e8('0x15')](function(_0x5c7253){if(_0x5c7253){_0x24c6b0=_0x5c7253;_0x2c5f56=_0x24c6b0[_0xc1e8('0x14')]||0x1388;}})[_0xc1e8('0x15')](function(){return dbH[_0xc1e8('0x16')][_0xc1e8('0x17')](util[_0xc1e8('0xe')](_0xc1e8('0x18'),QUERY),{'type':dbH[_0xc1e8('0x16')]['QueryTypes'][_0xc1e8('0x19')]});})[_0xc1e8('0x15')](function(_0x5418f1){if(!_0x5418f1[0x0]['num']){return analyticExtractedReport(_0xc1e8('0x1a'));}var _0x3e0325=[];var _0x41717a=0x0;if(_0x24c6b0[_0xc1e8('0x13')]){if(_0x5418f1&&_0x5418f1[_0xc1e8('0x1b')]){var _0x4b76da=_[_0xc1e8('0x1c')](_0x5418f1[0x0][_0xc1e8('0x1d')]/_0x2c5f56);var _0x408a64=Number['isInteger'](_0x5418f1[0x0][_0xc1e8('0x1d')]/_0x2c5f56)?_0x5418f1[0x0][_0xc1e8('0x1d')]%_0x2c5f56:0x0;_0x4b76da[_0xc1e8('0x1e')](function(_0x44171b){if(_0x44171b>0x0){_0x41717a+=_0x2c5f56;}_0x3e0325[_0xc1e8('0x1f')](dbH['sequelize'][_0xc1e8('0x17')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2c5f56,_0x41717a),{'type':dbH[_0xc1e8('0x16')][_0xc1e8('0x20')][_0xc1e8('0x19')]}));});if(_0x408a64>0x0){_0x41717a+=_0x2c5f56;_0x3e0325[_0xc1e8('0x1f')](dbH[_0xc1e8('0x16')][_0xc1e8('0x17')](util[_0xc1e8('0xe')](_0xc1e8('0x21'),QUERY,_0x408a64,_0x41717a),{'type':dbH[_0xc1e8('0x16')][_0xc1e8('0x20')][_0xc1e8('0x19')]}));}}}else{_0x3e0325[_0xc1e8('0x1f')](dbH[_0xc1e8('0x16')]['query'](QUERY,{'type':dbH[_0xc1e8('0x16')][_0xc1e8('0x20')][_0xc1e8('0x19')]}));}var _0xa8b370=path[_0xc1e8('0x22')](PATH);var _0x462e13=path[_0xc1e8('0x23')](PATH,'.xlsx');var _0x10af8c=_0x24c6b0[_0xc1e8('0x13')]&&_0x3e0325['length']>0x1;var _0x55f214=[];if(!fs['existsSync'](path[_0xc1e8('0x24')](_0xa8b370,_0x462e13))&&_0x10af8c){fs[_0xc1e8('0x25')](path[_0xc1e8('0x24')](_0xa8b370,_0x462e13));}return BPromise['each'](_0x3e0325,function(_0x225d35){_0x55f214[_0xc1e8('0x1f')](_0x225d35);})[_0xc1e8('0x15')](function(){for(var _0x556fb2=0x0;_0x556fb2<_0x55f214['length'];_0x556fb2+=0x1){var _0x1cf46a;var _0x57a72f=_0x55f214[_0x556fb2];if(_0x10af8c){_0x1cf46a=path[_0xc1e8('0x24')](_0xa8b370,_0x462e13,util[_0xc1e8('0xe')]('%s%d.%s',_0x462e13,_0x556fb2,'xlsx'));}else{_0x1cf46a=path[_0xc1e8('0x24')](_0xa8b370,util[_0xc1e8('0xe')]('%s.%s',_0x462e13,'xlsx'));}fs[_0xc1e8('0x26')](_0x1cf46a,json2xls(_0x57a72f),_0xc1e8('0x27'));}})[_0xc1e8('0x15')](function(){if(_0x10af8c){return new Promise(function(_0x113256){zipdir(path[_0xc1e8('0x24')](_0xa8b370,_0x462e13),{'saveTo':path[_0xc1e8('0x24')](_0xa8b370,util[_0xc1e8('0xe')](_0xc1e8('0x28'),_0x462e13,_0xc1e8('0x29')))},function(_0x331fe0,_0x3c8220){rimraf(path[_0xc1e8('0x24')](_0xa8b370,_0x462e13),function(){});_0x113256(_0xc1e8('0x2a'));});});}})['then'](function(){logger[_0xc1e8('0x2b')](util[_0xc1e8('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xc1e8('0x2c'),_0x10af8c?util['format'](_0xc1e8('0x28'),_0x462e13,_0x10af8c?_0xc1e8('0x29'):_0xc1e8('0x2d')):null);});})['catch'](function(_0x528def){logger[_0xc1e8('0x2b')](util['format'](_0xc1e8('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x528def,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc1e8('0x2f'));})[_0xc1e8('0x30')](function(){process[_0xc1e8('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d8a4344..2e91bb7 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 _0x0f65=['extensions','extension','find','Set','format','CDR(type)=%s','type','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','IntervalId','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','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0x0f65,0x124));var _0x50f6=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x0f65[_0x295314];return _0x584b0c;};'use strict';var _=require(_0x50f6('0x0'));var util=require(_0x50f6('0x1'));function rewrite(_0xd1d6be,_0x33106b){var _0x2089c6=this;return _0xd1d6be[_0x50f6('0x2')]['Interval'][_0x50f6('0x3')]({'raw':!![]})[_0x50f6('0x4')](function(_0x2acac3){_0x2089c6[_0x50f6('0x5')]=_0x2acac3;return _0xd1d6be[_0x50f6('0x2')][_0x50f6('0x6')][_0x50f6('0x3')]({'where':{'IntervalId':_0x33106b['IntervalId']},'raw':!![]});})[_0x50f6('0x4')](function(_0x311f12){return _0xd1d6be['models'][_0x50f6('0x6')][_0x50f6('0x3')]({'where':{'exten':{'$in':_[_0x50f6('0x7')](_['map'](_0x311f12,_0x50f6('0x8')))}},'order':[{'raw':_0x50f6('0x9')}],'raw':!![]});})['then'](function(_0x149906){var _0x4a16ae=_[_0x50f6('0xa')](_0x149906,{'priority':'1'});var _0x2138f7=_[_0x50f6('0xa')](_0x149906,{'isApp':0x1});var _0x20a270=_[_0x50f6('0xb')](_0x2138f7,'exten');var _0x5915bc=[_0x50f6('0xc'),_0x50f6('0xd')];var _0x220d02=[];var _0x3fa470=[];for(var _0x343fc7 in _0x20a270){if(_0x20a270[_0x50f6('0xe')](_0x343fc7)){_0x2089c6[_0x50f6('0xf')]=0x2;_0x2089c6[_0x50f6('0x10')]=[];_0x2089c6[_0x50f6('0x11')]=_[_0x50f6('0x12')](_0x4a16ae,{'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')]});_0x2089c6[_0x50f6('0x10')]['push']({'type':_0x20a270[_0x343fc7][0x0]['type'],'app':_0x50f6('0x13'),'appdata':util[_0x50f6('0x14')](_0x50f6('0x15'),_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')]),'context':_0x20a270[_0x343fc7][0x0]['context'],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});if(_0x20a270[_0x343fc7][0x0]['type']===_0x50f6('0x18')){_0x2089c6[_0x50f6('0x10')][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x1a')+_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')],'context':_0x20a270[_0x343fc7][0x0]['context'],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});}else if(_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')]===_0x50f6('0x1b')){if(_0x2089c6[_0x50f6('0x11')]){_0x2089c6[_0x50f6('0x10')]['push']({'type':_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x1c')+(_0x2089c6[_0x50f6('0x11')][_0x50f6('0x1d')]?'${EXTEN:'+_0x2089c6[_0x50f6('0x11')]['cutdigits']+'}':_0x50f6('0x1e')),'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0]['VoiceExtensionId']});}_0x2089c6[_0x50f6('0x10')][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0]['type'],'app':'Set','appdata':_0x50f6('0x1a')+_0x20a270[_0x343fc7][0x0]['VoiceExtensionId'],'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0]['VoiceExtensionId']});var _0x1ca79b=_0x2089c6[_0x50f6('0xf')]++;_0x2089c6['extensions'][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')],'app':_0x50f6('0x20'),'appdata':_0x50f6('0x21')+(_0x1ca79b+0x2)+_0x50f6('0x22')+(_0x1ca79b+0x1)+')','context':_0x20a270[_0x343fc7][0x0]['context'],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x1ca79b,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});if(_0x2089c6[_0x50f6('0x11')]){_0x2089c6[_0x50f6('0x10')]['push']({'type':_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')],'app':_0x50f6('0x13'),'appdata':_0x2089c6[_0x50f6('0x11')][_0x50f6('0x1d')]?_0x50f6('0x23')+_0x2089c6[_0x50f6('0x11')][_0x50f6('0x1d')]+'}':_0x50f6('0x24'),'context':_0x20a270[_0x343fc7][0x0]['context'],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0]['VoiceExtensionId']});}_0x2089c6[_0x50f6('0x10')][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x25')+_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')],'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0]['VoiceExtensionId']});if(_0x2089c6[_0x50f6('0x11')]&&_0x2089c6['extension'][_0x50f6('0xe')](_0x50f6('0x26'))&&_0x2089c6[_0x50f6('0x11')]['recordingFormat']!==_0x50f6('0x27')){_0x2089c6['extensions'][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0]['type'],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x28'),'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0]['VoiceExtensionId']});_0x2089c6[_0x50f6('0x10')][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x29')+_0x2089c6['extension']['recordingFormat']||_0x50f6('0x2a'),'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6['priority']++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});}}_0x2089c6[_0x50f6('0x10')][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0]['type'],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x2b'),'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0][_0x50f6('0x8')],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});_0x2089c6[_0x50f6('0x10')]['push']({'type':_0x20a270[_0x343fc7][0x0]['type'],'app':'Set','appdata':_0x50f6('0x2c'),'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0]['exten'],'priority':_0x2089c6['priority']++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});_0x2089c6[_0x50f6('0x10')]['push']({'type':_0x20a270[_0x343fc7][0x0][_0x50f6('0x16')],'app':'Set','appdata':_0x50f6('0x2d'),'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'exten':_0x20a270[_0x343fc7][0x0]['exten'],'priority':_0x2089c6[_0x50f6('0xf')]++,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0]['VoiceExtensionId']});for(var _0x475cb5=0x0,_0x22fff0=0x0;_0x475cb5<_0x20a270[_0x343fc7][_0x50f6('0x2e')];_0x475cb5+=0x1,_0x22fff0=0x0){var _0x2227de=_0x20a270[_0x343fc7][_0x475cb5];if(_0x2227de['type']){_0x2227de[_0x50f6('0x16')]=_0x2227de[_0x50f6('0x16')][_0x50f6('0x2f')]();}var _0x4dc60e=[];var _0x1167ec=[];delete _0x2227de['id'];delete _0x2227de['createdAt'];delete _0x2227de[_0x50f6('0x30')];var _0x1861de=_0x2227de[_0x50f6('0x31')]!=='*,*,*,*'?[_0x2227de[_0x50f6('0x31')]]:_0x2227de[_0x50f6('0x32')]?_[_0x50f6('0x33')](_['filter'](_0x2089c6['intervals'],{'IntervalId':_0x2227de['IntervalId']}),'interval'):[];if(_0x2227de['hasOwnProperty'](_0x50f6('0x34'))){if(_0x2227de[_0x50f6('0x34')]&&_0x2227de[_0x50f6('0x34')]!=='--'){_0x4dc60e['push']({'type':_0x2227de[_0x50f6('0x16')],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x35')+_0x2227de['tag'],'context':_0x2227de[_0x50f6('0x1f')],'exten':_0x2227de['exten'],'priority':_0x1861de[_0x50f6('0x2e')]+_0x2089c6[_0x50f6('0xf')]+_0x22fff0++,'VoiceExtensionId':_0x2227de[_0x50f6('0x17')]});}}if(_0x2227de[_0x50f6('0x16')]===_0x50f6('0x1b')&&_0x2227de[_0x50f6('0xe')]('callerID')){if(_0x2227de[_0x50f6('0x36')]){_0x4dc60e[_0x50f6('0x19')]({'type':_0x2227de['type'],'app':'ExecIf','appdata':_0x50f6('0x37')+_0x2227de[_0x50f6('0x36')]+')','context':_0x2227de[_0x50f6('0x1f')],'exten':_0x2227de['exten'],'priority':_0x1861de[_0x50f6('0x2e')]+_0x2089c6[_0x50f6('0xf')]+_0x22fff0++,'VoiceExtensionId':_0x2227de[_0x50f6('0x17')]});}else{_0x4dc60e[_0x50f6('0x19')]({'type':_0x2227de[_0x50f6('0x16')],'app':'ExecIf','appdata':_0x50f6('0x38'),'context':_0x2227de[_0x50f6('0x1f')],'exten':_0x2227de['exten'],'priority':_0x1861de[_0x50f6('0x2e')]+_0x2089c6[_0x50f6('0xf')]+_0x22fff0++,'VoiceExtensionId':_0x2227de['VoiceExtensionId']});}}if(_0x2227de[_0x50f6('0xe')](_0x50f6('0x39'))){if(_0x5915bc[_0x50f6('0x3a')](_0x2227de[_0x50f6('0x3b')]['toLowerCase']())>=0x0&&_0x2227de['appType']!==_0x50f6('0x3c')){if(_0x2227de[_0x50f6('0x39')]){_0x4dc60e[_0x50f6('0x19')]({'type':_0x2227de[_0x50f6('0x16')],'app':'ExecIf','appdata':_0x50f6('0x3d'),'context':_0x2227de['context'],'exten':_0x2227de[_0x50f6('0x8')],'priority':_0x1861de['length']+_0x2089c6[_0x50f6('0xf')]+_0x22fff0++,'VoiceExtensionId':_0x2227de[_0x50f6('0x17')]});_0x4dc60e['push']({'type':_0x2227de[_0x50f6('0x16')],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x3e'),'context':_0x2227de[_0x50f6('0x1f')],'exten':_0x2227de[_0x50f6('0x8')],'priority':_0x1861de[_0x50f6('0x2e')]+_0x2089c6[_0x50f6('0xf')]+_0x22fff0++,'VoiceExtensionId':_0x2227de[_0x50f6('0x17')]});}else{_0x4dc60e['push']({'type':_0x2227de['type'],'app':'ExecIf','appdata':_0x50f6('0x3f'),'context':_0x2227de[_0x50f6('0x1f')],'exten':_0x2227de[_0x50f6('0x8')],'priority':_0x1861de[_0x50f6('0x2e')]+_0x2089c6['priority']+_0x22fff0++,'VoiceExtensionId':_0x2227de[_0x50f6('0x17')]});_0x4dc60e[_0x50f6('0x19')]({'type':_0x2227de['type'],'app':_0x50f6('0x13'),'appdata':_0x50f6('0x40'),'context':_0x2227de['context'],'exten':_0x2227de['exten'],'priority':_0x1861de['length']+_0x2089c6[_0x50f6('0xf')]+_0x22fff0++,'VoiceExtensionId':_0x2227de[_0x50f6('0x17')]});}}}for(var _0x2ff02e=0x0;_0x2ff02e<_0x1861de[_0x50f6('0x2e')];_0x2ff02e+=0x1){var _0x4889ac=_0x2089c6[_0x50f6('0xf')]+_0x1861de[_0x50f6('0x2e')];var _0x2c1482=_0x2ff02e===_0x1861de[_0x50f6('0x2e')]-0x1?_0x2089c6[_0x50f6('0xf')]+_0x4dc60e['length']+_0x1167ec[_0x50f6('0x2e')]+0x2:_0x2089c6['priority']+_0x2ff02e+0x1;_0x4dc60e[_0x50f6('0x41')](_0x2ff02e,0x0,{'type':_0x2227de[_0x50f6('0x16')],'app':_0x50f6('0x42'),'appdata':_0x1861de[_0x2ff02e]+'?'+_0x2227de[_0x50f6('0x1f')]+_0x50f6('0x43')+_0x4889ac+':'+_0x2227de[_0x50f6('0x1f')]+',${EXTEN},'+_0x2c1482,'exten':_0x2227de['exten'],'context':_0x2227de[_0x50f6('0x1f')],'priority':_0x2089c6[_0x50f6('0xf')]+_0x2ff02e,'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});}_0x2227de[_0x50f6('0xf')]=_0x4dc60e[_0x50f6('0x2e')]?_[_0x50f6('0x44')](_0x4dc60e)[_0x50f6('0xf')]+0x1:_0x2089c6[_0x50f6('0xf')];_0x2089c6[_0x50f6('0xf')]=(_0x1167ec[_0x50f6('0x2e')]?_[_0x50f6('0x44')](_0x1167ec)[_0x50f6('0xf')]:_0x2227de[_0x50f6('0xf')])+0x1;_0x2089c6[_0x50f6('0x10')]=_[_0x50f6('0x45')](_0x2089c6['extensions'],_0x4dc60e,[_0x2227de],_0x1167ec);}_0x2089c6[_0x50f6('0x10')][_0x50f6('0x19')]({'type':_0x20a270[_0x343fc7][0x0]['type'],'app':_0x50f6('0x46'),'exten':_0x20a270[_0x343fc7][0x0]['exten'],'context':_0x20a270[_0x343fc7][0x0][_0x50f6('0x1f')],'priority':_0x2089c6['priority'],'VoiceExtensionId':_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]});_0x220d02[_0x50f6('0x19')](_0x20a270[_0x343fc7][0x0][_0x50f6('0x17')]);_0x3fa470=_[_0x50f6('0x45')](_0x3fa470,_0x2089c6['extensions']);}}return _0xd1d6be[_0x50f6('0x47')](function(_0x613120){return _0xd1d6be[_0x50f6('0x2')][_0x50f6('0x6')][_0x50f6('0x48')]({'where':{'VoiceExtensionId':{'$in':_0x220d02}},'transaction':_0x613120})[_0x50f6('0x4')](function(_0x143cf3){return _0xd1d6be[_0x50f6('0x2')][_0x50f6('0x6')][_0x50f6('0x49')](_['sortBy'](_0x3fa470,'priority'),{'transaction':_0x613120});});});})[_0x50f6('0x4a')](function(_0x432162){console[_0x50f6('0x4b')](_0x432162);});}exports[_0x50f6('0x4c')]=rewrite; \ No newline at end of file +var _0x2a69=['ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','$[${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','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','queue','playback','hasOwnProperty','priority','extension','extensions','push','type','inbound','Set','CDR(routeid)=','VoiceExtensionId','context','outbound','CDR(destination)=','cutdigits'];(function(_0x503ead,_0x4ac126){var _0x4830cb=function(_0xe4a720){while(--_0xe4a720){_0x503ead['push'](_0x503ead['shift']());}};_0x4830cb(++_0x4ac126);}(_0x2a69,0x12d));var _0x92a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2a69[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x92a6('0x0'));var util=require(_0x92a6('0x1'));function rewrite(_0x301b47,_0x3c6fdf){var _0x4aa5e2=this;return _0x301b47[_0x92a6('0x2')][_0x92a6('0x3')][_0x92a6('0x4')]({'raw':!![]})[_0x92a6('0x5')](function(_0x22228a){_0x4aa5e2[_0x92a6('0x6')]=_0x22228a;return _0x301b47[_0x92a6('0x2')][_0x92a6('0x7')][_0x92a6('0x4')]({'where':{'IntervalId':_0x3c6fdf[_0x92a6('0x8')]},'raw':!![]});})[_0x92a6('0x5')](function(_0x480937){return _0x301b47[_0x92a6('0x2')]['VoiceExtension'][_0x92a6('0x4')]({'where':{'exten':{'$in':_[_0x92a6('0x9')](_[_0x92a6('0xa')](_0x480937,_0x92a6('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0xfb4bd4){var _0xfb7ffd=_[_0x92a6('0xc')](_0xfb4bd4,{'priority':'1'});var _0x89c235=_[_0x92a6('0xc')](_0xfb4bd4,{'isApp':0x1});var _0x285cf4=_['groupBy'](_0x89c235,_0x92a6('0xb'));var _0x1f2088=[_0x92a6('0xd'),_0x92a6('0xe')];var _0x509f78=[];var _0x58fee6=[];for(var _0x5df9d1 in _0x285cf4){if(_0x285cf4[_0x92a6('0xf')](_0x5df9d1)){_0x4aa5e2[_0x92a6('0x10')]=0x2;_0x4aa5e2['extensions']=[];_0x4aa5e2[_0x92a6('0x11')]=_['find'](_0xfb7ffd,{'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x285cf4[_0x5df9d1][0x0]['type']),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});if(_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')]===_0x92a6('0x15')){_0x4aa5e2['extensions'][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x17')+_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});}else if(_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')]===_0x92a6('0x1a')){if(_0x4aa5e2[_0x92a6('0x11')]){_0x4aa5e2['extensions'][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':'Set','appdata':_0x92a6('0x1b')+(_0x4aa5e2[_0x92a6('0x11')]['cutdigits']?'${EXTEN:'+_0x4aa5e2[_0x92a6('0x11')][_0x92a6('0x1c')]+'}':'${EXTEN}'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});}_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x17')+_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});var _0x1e9dff=_0x4aa5e2[_0x92a6('0x10')]++;_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1e9dff+0x2)+_0x92a6('0x1e')+(_0x1e9dff+0x1)+')','context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x1e9dff,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});if(_0x4aa5e2[_0x92a6('0x11')]){_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x4aa5e2['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x4aa5e2[_0x92a6('0x11')][_0x92a6('0x1c')]+'}':_0x92a6('0x1f'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});}_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':'Set','appdata':_0x92a6('0x20')+_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});if(_0x4aa5e2['extension']&&_0x4aa5e2[_0x92a6('0x11')][_0x92a6('0xf')](_0x92a6('0x21'))&&_0x4aa5e2['extension'][_0x92a6('0x21')]!==_0x92a6('0x22')){_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x23'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x24')+_0x4aa5e2['extension'][_0x92a6('0x21')]||_0x92a6('0x25'),'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});}}_0x4aa5e2['extensions'][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x26'),'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x27'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x28'),'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2['priority']++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});for(var _0x15429e=0x0,_0x559bf8=0x0;_0x15429e<_0x285cf4[_0x5df9d1][_0x92a6('0x29')];_0x15429e+=0x1,_0x559bf8=0x0){var _0x32ced0=_0x285cf4[_0x5df9d1][_0x15429e];if(_0x32ced0[_0x92a6('0x14')]){_0x32ced0[_0x92a6('0x14')]=_0x32ced0[_0x92a6('0x14')]['toLowerCase']();}var _0x45fd0e=[];var _0x4fea42=[];delete _0x32ced0['id'];delete _0x32ced0[_0x92a6('0x2a')];delete _0x32ced0[_0x92a6('0x2b')];var _0x5a3c3a=_0x32ced0[_0x92a6('0x2c')]!==_0x92a6('0x2d')?[_0x32ced0[_0x92a6('0x2c')]]:_0x32ced0[_0x92a6('0x8')]?_[_0x92a6('0xa')](_[_0x92a6('0xc')](_0x4aa5e2[_0x92a6('0x6')],{'IntervalId':_0x32ced0[_0x92a6('0x8')]}),_0x92a6('0x2c')):[];if(_0x32ced0[_0x92a6('0xf')](_0x92a6('0x2e'))){if(_0x32ced0[_0x92a6('0x2e')]&&_0x32ced0[_0x92a6('0x2e')]!=='--'){_0x45fd0e['push']({'type':_0x32ced0[_0x92a6('0x14')],'app':'Set','appdata':'CDR(tag)='+_0x32ced0['tag'],'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a['length']+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});}}if(_0x32ced0[_0x92a6('0x14')]===_0x92a6('0x1a')&&_0x32ced0['hasOwnProperty']('callerID')){if(_0x32ced0['callerID']){_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0[_0x92a6('0x14')],'app':'ExecIf','appdata':_0x92a6('0x2f')+_0x32ced0['callerID']+')','context':_0x32ced0['context'],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a['length']+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});}else{_0x45fd0e['push']({'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x1d'),'appdata':_0x92a6('0x30'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});}}if(_0x32ced0[_0x92a6('0xf')](_0x92a6('0x31'))){if(_0x1f2088['indexOf'](_0x32ced0[_0x92a6('0x32')][_0x92a6('0x33')]())>=0x0&&_0x32ced0['appType']!==_0x92a6('0x34')){if(_0x32ced0[_0x92a6('0x31')]){_0x45fd0e['push']({'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x1d'),'appdata':_0x92a6('0x35'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0['exten'],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0[_0x92a6('0x18')]});}else{_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0['type'],'app':_0x92a6('0x1d'),'appdata':_0x92a6('0x36'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0['exten'],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2['priority']+_0x559bf8++,'VoiceExtensionId':_0x32ced0[_0x92a6('0x18')]});_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0['type'],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x37'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a['length']+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0[_0x92a6('0x18')]});}}}for(var _0x10316c=0x0;_0x10316c<_0x5a3c3a[_0x92a6('0x29')];_0x10316c+=0x1){var _0x5b4d49=_0x4aa5e2[_0x92a6('0x10')]+_0x5a3c3a[_0x92a6('0x29')];var _0x1e6cef=_0x10316c===_0x5a3c3a[_0x92a6('0x29')]-0x1?_0x4aa5e2[_0x92a6('0x10')]+_0x45fd0e[_0x92a6('0x29')]+_0x4fea42[_0x92a6('0x29')]+0x2:_0x4aa5e2[_0x92a6('0x10')]+_0x10316c+0x1;_0x45fd0e[_0x92a6('0x38')](_0x10316c,0x0,{'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x39'),'appdata':_0x5a3c3a[_0x10316c]+'?'+_0x32ced0['context']+_0x92a6('0x3a')+_0x5b4d49+':'+_0x32ced0['context']+',${EXTEN},'+_0x1e6cef,'exten':_0x32ced0[_0x92a6('0xb')],'context':_0x32ced0[_0x92a6('0x19')],'priority':_0x4aa5e2[_0x92a6('0x10')]+_0x10316c,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});}_0x32ced0[_0x92a6('0x10')]=_0x45fd0e[_0x92a6('0x29')]?_[_0x92a6('0x3b')](_0x45fd0e)[_0x92a6('0x10')]+0x1:_0x4aa5e2[_0x92a6('0x10')];_0x4aa5e2[_0x92a6('0x10')]=(_0x4fea42[_0x92a6('0x29')]?_[_0x92a6('0x3b')](_0x4fea42)[_0x92a6('0x10')]:_0x32ced0[_0x92a6('0x10')])+0x1;_0x4aa5e2['extensions']=_[_0x92a6('0x3c')](_0x4aa5e2['extensions'],_0x45fd0e,[_0x32ced0],_0x4fea42);}_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0]['type'],'app':_0x92a6('0x3d'),'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'priority':_0x4aa5e2[_0x92a6('0x10')],'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});_0x509f78[_0x92a6('0x13')](_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']);_0x58fee6=_[_0x92a6('0x3c')](_0x58fee6,_0x4aa5e2[_0x92a6('0x12')]);}}return _0x301b47[_0x92a6('0x3e')](function(_0x499447){return _0x301b47[_0x92a6('0x2')][_0x92a6('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x509f78}},'transaction':_0x499447})[_0x92a6('0x5')](function(_0x1c669a){return _0x301b47[_0x92a6('0x2')][_0x92a6('0x7')]['bulkCreate'](_[_0x92a6('0x3f')](_0x58fee6,_0x92a6('0x10')),{'transaction':_0x499447});});});})['catch'](function(_0x3187fa){console[_0x92a6('0x40')](_0x3187fa);});}exports[_0x92a6('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f223ffb..60c9e1a 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 _0xd07f=['ListId','NOW()','from','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','insert','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','outbound','BlackLists','Campaign','Lists','CampaignId','onlyIfOpen','all','cmContact,\x20%s,\x20%s','generalCheckHopper','message','finally','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','ioredis','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString'];(function(_0x59d957,_0x5dc0cb){var _0x406bdf=function(_0x319d80){while(--_0x319d80){_0x59d957['push'](_0x59d957['shift']());}};_0x406bdf(++_0x5dc0cb);}(_0xd07f,0x9a));var _0xfd07=function(_0x5daefa,_0x3d8a1b){_0x5daefa=_0x5daefa-0x0;var _0x1698c1=_0xd07f[_0x5daefa];return _0x1698c1;};'use strict';var BPromise=require('bluebird');var util=require(_0xfd07('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0xfd07('0x1'));var Papa=require(_0xfd07('0x2'));var Redis=require(_0xfd07('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xfd07('0x4'))(_0xfd07('0x5'));config[_0xfd07('0x6')]=_[_0xfd07('0x7')](config[_0xfd07('0x6')],{'host':_0xfd07('0x8'),'port':0x18eb});var socket=require(_0xfd07('0x9'))(new Redis(config[_0xfd07('0x6')]));require(_0xfd07('0xa'))['register'](socket);try{if(!process[_0xfd07('0xb')][0x2]||process['argv'][0x2]===_0xfd07('0xc')||process[_0xfd07('0xb')][0x2]===_0xfd07('0xd')){throw new Error(_0xfd07('0xe'));}var FILEPATH=process[_0xfd07('0xb')][0x2];if(!process[_0xfd07('0xb')][0x3]||process[_0xfd07('0xb')][0x3]===_0xfd07('0xc')||process[_0xfd07('0xb')][0x3]===_0xfd07('0xd')||!process[_0xfd07('0xb')][0x4]||process[_0xfd07('0xb')][0x4]===_0xfd07('0xc')||process['argv'][0x4]==='null'){throw new Error(_0xfd07('0xf'));}var FIELDS=_[_0xfd07('0x10')](process[_0xfd07('0xb')][0x3][_0xfd07('0x11')](','),process[_0xfd07('0xb')][0x4][_0xfd07('0x11')](','));if(!process[_0xfd07('0xb')][0x5]||process[_0xfd07('0xb')][0x5]==='undefined'||process[_0xfd07('0xb')][0x5]==='null'){throw new Error(_0xfd07('0x12'));}var LISTID=process[_0xfd07('0xb')][0x5];var COMPANYID=process[_0xfd07('0xb')][0x6]&&process[_0xfd07('0xb')][0x6]!==_0xfd07('0xc')&&process['argv'][0x6]!==_0xfd07('0xd')?process['argv'][0x6]:null;var DUPLICATES=process[_0xfd07('0xb')][0x7]&&process[_0xfd07('0xb')][0x7]!=='undefined'&&process[_0xfd07('0xb')][0x7]!==_0xfd07('0xd')?process[_0xfd07('0xb')][0x7]:null;if(!process[_0xfd07('0xb')][0x8]||process[_0xfd07('0xb')][0x8]===_0xfd07('0xc')||process['argv'][0x8]==='null'){throw new Error(_0xfd07('0x13'));}var SOCKET_TIMESTAMP=process[_0xfd07('0xb')][0x8];}catch(_0x24477e){logger[_0xfd07('0x14')](_0x24477e);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(_0x9b925d,_0x1e5e02,_0x1d3f4a,_0x3e6671){var _0x356db3={'message':_0x1e5e02};_0x356db3[_0x9b925d]=!![];if(_0x1d3f4a){_0x356db3[_0xfd07('0x15')]=_0x1d3f4a;}if(_0x3e6671){_0x356db3[_0xfd07('0x16')]=_0x3e6671;}return _0x356db3;}function isEmail(_0x287524){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))*$/[_0xfd07('0x17')](_0x287524);}function checkRow(_0x1e642b,_0x26409d,_0x348d4e){return new BPromise(function(_0x5d8929,_0x56963a){if(_[_0xfd07('0x18')](_0x1e642b)){return _0x56963a(handleCheckRowError(_0xfd07('0x14'),_0xfd07('0x19'),null,_0x348d4e));}if(_0x1e642b[_0xfd07('0x1a')]&&_0x1e642b['errors'][_0xfd07('0x1b')]){var _0x2c3d22=_['map'](_0x1e642b[_0xfd07('0x1a')],'message')[_0xfd07('0x1c')](';');return _0x56963a(handleCheckRowError(_0xfd07('0x14'),_0x2c3d22,null,_0x348d4e));}var _0x6b5c3c={};for(var _0x452099 in FIELDS){if(FIELDS['hasOwnProperty'](_0x452099)&&FIELDS[_0x452099]){_0x6b5c3c[_0x452099]=_0x1e642b['data'][0x0][FIELDS[_0x452099]]||_0x1e642b[_0xfd07('0x1d')][0x0]['\ufeff'+FIELDS[_0x452099]];}}if(!_0x6b5c3c[_0xfd07('0x1e')]){return _0x56963a(handleCheckRowError(_0xfd07('0x14'),_0xfd07('0x1f'),null,_0x348d4e));}if(!_0x6b5c3c[_0xfd07('0x20')]){return _0x56963a(handleCheckRowError(_0xfd07('0x14'),_0xfd07('0x21'),null,_0x348d4e));}if(_0x6b5c3c[_0xfd07('0x22')]){var _0x648aef=moment(_0x6b5c3c[_0xfd07('0x22')],_0xfd07('0x23'));if(!_0x648aef[_0xfd07('0x24')]()){return _0x56963a(handleCheckRowError('error',_0xfd07('0x25'),null,_0x348d4e));}}if(_0x6b5c3c[_0xfd07('0x26')]){if(!isEmail(_0x6b5c3c[_0xfd07('0x26')])){return _0x56963a(handleCheckRowError(_0xfd07('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x348d4e));}}_0x6b5c3c['ListId']=LISTID;_0x6b5c3c[_0xfd07('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xfd07('0x1b')]&&_0x26409d){var _0x1438f6={};for(var _0x53e060=0x0,_0x2fd62b=DUPLICATES[_0xfd07('0x1b')];_0x53e060<_0x2fd62b;_0x53e060+=0x1){_0x1438f6[DUPLICATES[_0x53e060]]=_0x6b5c3c[DUPLICATES[_0x53e060]];}var _0x4a1b6b=_[_0xfd07('0x28')](_0x26409d,_0x1438f6);if(_0x4a1b6b){return _0x56963a(handleCheckRowError(_0xfd07('0x29'),_0xfd07('0x2a'),_0x4a1b6b,_0x348d4e));}}return db[_0xfd07('0x2b')]['create'](_0x6b5c3c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x6b5c3c)})[_0xfd07('0x2c')](function(_0x5d9254){if(DUPLICATES&&DUPLICATES[_0xfd07('0x1b')]&&_0x26409d){_0x26409d[_0xfd07('0x2d')](_[_0xfd07('0x2e')](_0x6b5c3c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5d9254['id'];return _0x5d8929();})[_0xfd07('0x2f')](function(_0x39b34f){return _0x56963a(handleCheckRowError(_0xfd07('0x14'),_0xfd07('0x30')+(_0x39b34f['message']||JSON[_0xfd07('0x31')](_0x39b34f)),null,_0x348d4e));});});}function checkHopper(){function _0x1a721c(){return function(_0x1a4b85){logger[_0xfd07('0x14')]('cmContact',_0xfd07('0x32'),util[_0xfd07('0x33')](_0x1a4b85,{'showHidden':![],'depth':null}));};}var _0x16a22f=function(_0x311d23,_0x215ba6){var _0x4e5fa1=squel['insert']()[_0xfd07('0x34')](_0xfd07('0x35'))[_0xfd07('0x36')]([_0xfd07('0x20'),_0xfd07('0x37'),_0xfd07('0x38'),'ListId',_0x215ba6,_0xfd07('0x39'),_0xfd07('0x3a')],squel[_0xfd07('0x3b')]()['field']('phone',_0xfd07('0x20'))[_0xfd07('0x3c')]('NOW()',_0xfd07('0x37'))[_0xfd07('0x3c')]('id',_0xfd07('0x38'))[_0xfd07('0x3c')](LISTID[_0xfd07('0x3d')](),_0xfd07('0x3e'))['field'](_0x311d23['id']['toString'](),_0x215ba6)[_0xfd07('0x3c')](_0xfd07('0x3f'),_0xfd07('0x39'))[_0xfd07('0x3c')](_0xfd07('0x3f'),'updatedAt')[_0xfd07('0x40')]('cm_contacts')['where'](_0xfd07('0x41'))[_0xfd07('0x42')]('ListId\x20=\x20?',LISTID[_0xfd07('0x3d')]())['where'](_0xfd07('0x43'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xfd07('0x3b')]()['field'](_0xfd07('0x20'))[_0xfd07('0x40')]('cm_hopper')['where'](_0x215ba6+_0xfd07('0x44'),_0x311d23['id'][_0xfd07('0x3d')]())))[_0xfd07('0x3d')]();return _0x4e5fa1;};var _0x5a496a=function(_0x18a84d,_0x236453){var _0xcbfcc3=squel[_0xfd07('0x45')]()['into'](_0xfd07('0x35'))[_0xfd07('0x36')]([_0xfd07('0x20'),_0xfd07('0x37'),'ContactId',_0xfd07('0x3e'),_0x236453,_0xfd07('0x39'),_0xfd07('0x3a')],squel['select']()[_0xfd07('0x3c')](_0xfd07('0x20'),_0xfd07('0x20'))[_0xfd07('0x3c')](_0xfd07('0x3f'),_0xfd07('0x37'))[_0xfd07('0x3c')]('id',_0xfd07('0x38'))['field'](LISTID['toString'](),_0xfd07('0x3e'))[_0xfd07('0x3c')](_0x18a84d['id']['toString'](),_0x236453)['field'](_0xfd07('0x3f'),_0xfd07('0x39'))[_0xfd07('0x3c')](_0xfd07('0x3f'),_0xfd07('0x3a'))[_0xfd07('0x40')](_0xfd07('0x46'))[_0xfd07('0x42')](_0xfd07('0x41'))[_0xfd07('0x42')](_0xfd07('0x47'),LISTID[_0xfd07('0x3d')]())[_0xfd07('0x42')](_0xfd07('0x48'),squel['str'](hopperContacts))['where'](_0xfd07('0x43'))[_0xfd07('0x42')](_0xfd07('0x49'),squel[_0xfd07('0x3b')]()[_0xfd07('0x3c')](_0xfd07('0x4a'))[_0xfd07('0x40')](_0xfd07('0x4b'))[_0xfd07('0x42')](_0x236453+_0xfd07('0x44'),_0x18a84d['id'][_0xfd07('0x3d')]()))['where'](_0xfd07('0x49'),squel[_0xfd07('0x3b')]()[_0xfd07('0x3c')](_0xfd07('0x20'))['from']('cm_hopper')[_0xfd07('0x42')](_0x236453+_0xfd07('0x44'),_0x18a84d['id'][_0xfd07('0x3d')]())))['toString']();return _0xcbfcc3;};function _0x2fa2b6(_0xf9478f,_0x297174){var _0x256d5e=squel[_0xfd07('0x45')]()[_0xfd07('0x34')](_0xfd07('0x35'))[_0xfd07('0x36')](['phone',_0xfd07('0x37'),_0xfd07('0x38'),_0xfd07('0x3e'),_0x297174,_0xfd07('0x39'),_0xfd07('0x3a')],squel[_0xfd07('0x3b')]()[_0xfd07('0x3c')](_0xfd07('0x20'),_0xfd07('0x20'))[_0xfd07('0x3c')](_0xfd07('0x3f'),_0xfd07('0x37'))['field']('id','ContactId')['field'](LISTID[_0xfd07('0x3d')](),_0xfd07('0x3e'))[_0xfd07('0x3c')](_0xf9478f['id']['toString'](),_0x297174)[_0xfd07('0x3c')](_0xfd07('0x3f'),_0xfd07('0x39'))[_0xfd07('0x3c')](_0xfd07('0x3f'),_0xfd07('0x3a'))[_0xfd07('0x40')](_0xfd07('0x46'))[_0xfd07('0x42')](_0xfd07('0x41'))['where'](_0xfd07('0x47'),LISTID[_0xfd07('0x3d')]())[_0xfd07('0x42')](_0xfd07('0x48'),squel[_0xfd07('0x4c')](hopperContacts))[_0xfd07('0x42')](_0xfd07('0x43')))[_0xfd07('0x3d')]();return _0x256d5e;}function _0x201bde(_0x131122,_0x50d498){var _0x29eceb=squel['insert']()['into'](_0xfd07('0x4d'))[_0xfd07('0x36')](['phone','ContactId','ListId',_0x50d498,_0xfd07('0x39'),_0xfd07('0x3a')],squel[_0xfd07('0x3b')]()[_0xfd07('0x3c')](_0xfd07('0x20'),_0xfd07('0x20'))[_0xfd07('0x3c')]('id',_0xfd07('0x38'))[_0xfd07('0x3c')](LISTID[_0xfd07('0x3d')](),_0xfd07('0x3e'))['field'](_0x131122['id']['toString'](),_0x50d498)['field'](_0xfd07('0x3f'),_0xfd07('0x39'))['field'](_0xfd07('0x3f'),'updatedAt')[_0xfd07('0x40')](_0xfd07('0x46'))[_0xfd07('0x42')](_0xfd07('0x41'))[_0xfd07('0x42')]('ListId\x20=\x20?',LISTID[_0xfd07('0x3d')]())[_0xfd07('0x42')](_0xfd07('0x48'),squel[_0xfd07('0x4c')](hopperContacts))[_0xfd07('0x42')](_0xfd07('0x43')))['toString']();return _0x29eceb;}return db[_0xfd07('0x4e')][_0xfd07('0x4f')]({'where':{'type':'outbound'},'attributes':['id',_0xfd07('0x50')],'include':[{'model':db[_0xfd07('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xfd07('0x2c')](function(_0x526dd3){var _0x5b3a39=[];if(_0x526dd3){var _0x53c233;for(var _0x11005d=0x0,_0x271d91;_0x11005d<_0x526dd3['length'];_0x11005d+=0x1){_0x271d91=_0x526dd3[_0x11005d][_0xfd07('0x52')]({'plain':!![]});switch(_0x271d91[_0xfd07('0x50')]){case _0xfd07('0x53'):_0x5b3a39['push'](db[_0xfd07('0x54')][_0xfd07('0x55')](_0x5a496a(_0x271d91,_0xfd07('0x56')))[_0xfd07('0x2c')](function(){})[_0xfd07('0x2f')](_0x1a721c()));break;case'onlyIfOpen':_0x5b3a39[_0xfd07('0x2d')](db[_0xfd07('0x54')][_0xfd07('0x55')](_0x16a22f(_0x271d91,_0xfd07('0x56')))[_0xfd07('0x2c')](function(){})['catch'](_0x1a721c()));break;default:_0x5b3a39[_0xfd07('0x2d')](db[_0xfd07('0x54')][_0xfd07('0x55')](_0x2fa2b6(_0x271d91,'VoiceQueueId'))[_0xfd07('0x2c')](function(){})['catch'](_0x1a721c()));}}}return _0x5b3a39;})['all']()[_0xfd07('0x2c')](function(){return db[_0xfd07('0x4e')][_0xfd07('0x4f')]({'where':{'type':_0xfd07('0x57')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xfd07('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x4e589f){var _0x39b603=[];if(_0x4e589f){var _0x394833;for(var _0x4cd96b=0x0,_0x36e241;_0x4cd96b<_0x4e589f[_0xfd07('0x1b')];_0x4cd96b+=0x1){_0x36e241=_0x4e589f[_0x4cd96b][_0xfd07('0x52')]({'plain':!![]});_0x39b603[_0xfd07('0x2d')](db['sequelize'][_0xfd07('0x55')](_0x201bde(_0x36e241,_0xfd07('0x56')))['then'](function(){})[_0xfd07('0x2f')](_0x1a721c()));}}return _0x39b603;})['all']();})[_0xfd07('0x2c')](function(){return db[_0xfd07('0x59')][_0xfd07('0x4f')]({'attributes':['id',_0xfd07('0x50')],'include':[{'model':db[_0xfd07('0x51')],'as':_0xfd07('0x5a'),'where':{'id':LISTID}}]})[_0xfd07('0x2c')](function(_0x1f8a14){var _0x823077=[];if(_0x1f8a14){for(var _0x26103f=0x0,_0x5a01bb;_0x26103f<_0x1f8a14[_0xfd07('0x1b')];_0x26103f+=0x1){_0x5a01bb=_0x1f8a14[_0x26103f][_0xfd07('0x52')]({'plain':!![]});switch(_0x5a01bb['dialCheckDuplicateType']){case _0xfd07('0x53'):_0x823077['push'](db['sequelize']['query'](_0x5a496a(_0x5a01bb,_0xfd07('0x5b')))[_0xfd07('0x2c')](function(){})[_0xfd07('0x2f')](_0x1a721c()));break;case _0xfd07('0x5c'):_0x823077[_0xfd07('0x2d')](db['sequelize'][_0xfd07('0x55')](_0x16a22f(_0x5a01bb,_0xfd07('0x5b')))[_0xfd07('0x2c')](function(){})['catch'](_0x1a721c()));break;default:_0x823077[_0xfd07('0x2d')](db[_0xfd07('0x54')]['query'](_0x2fa2b6(_0x5a01bb,'CampaignId'))[_0xfd07('0x2c')](function(){})[_0xfd07('0x2f')](_0x1a721c()));}}}return _0x823077;})[_0xfd07('0x5d')]();})[_0xfd07('0x2c')](function(){return db[_0xfd07('0x59')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xfd07('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x3662d8){var _0x41ecab=[];if(_0x3662d8){for(var _0xf9c02c=0x0,_0x260d43;_0xf9c02c<_0x3662d8['length'];_0xf9c02c+=0x1){_0x260d43=_0x3662d8[_0xf9c02c][_0xfd07('0x52')]({'plain':!![]});_0x41ecab[_0xfd07('0x2d')](db[_0xfd07('0x54')][_0xfd07('0x55')](_0x201bde(_0x260d43,'CampaignId'))[_0xfd07('0x2c')](function(){})[_0xfd07('0x2f')](_0x1a721c()));}}return _0x41ecab;})['all']();})[_0xfd07('0x2f')](function(_0x49460d){logger[_0xfd07('0x14')](_0xfd07('0x5e'),_0xfd07('0x5f'),_0x49460d[_0xfd07('0x60')]);});}var processPromises=function(_0x22f1df){return BPromise[_0xfd07('0x5d')](promises)[_0xfd07('0x2c')](function(_0x5e74ac){})['catch'](function(_0x17f3e8){logger[_0xfd07('0x14')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x17f3e8));})[_0xfd07('0x61')](function(){socket[_0xfd07('0x62')](_0xfd07('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x22f1df){return _0x22f1df['resume']();}});};var endCsv=function(){return BPromise[_0xfd07('0x64')]()[_0xfd07('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xfd07('0x2c')](function(){socket['emit'](_0xfd07('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x29bf25){logger[_0xfd07('0x14')](_0xfd07('0x65'),JSON['stringify'](_0x29bf25));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0xfd07('0x66')](_0xfd07('0x67'));endCsv();});function main(){return BPromise[_0xfd07('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xfd07('0x11')](',');return db[_0xfd07('0x2b')][_0xfd07('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4c97b3){var _0x46f8fc=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfd07('0x68')](_0x46f8fc,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20ff03,_0xb42b77){total+=0x1;var _0x2922f6=total;promises[_0xfd07('0x2d')](checkRow(_0x20ff03,_0x4c97b3,_0x2922f6)[_0xfd07('0x2c')](function(){success+=0x1;})[_0xfd07('0x2f')](function(_0x312396){if(_0x312396[_0xfd07('0x14')]){errors+=0x1;delete _0x312396[_0xfd07('0x14')];}else if(_0x312396[_0xfd07('0x29')]){duplicates+=0x1;delete _0x312396[_0xfd07('0x29')];}rows[_0xfd07('0x2d')](_0x312396);}));if(total%0xc8===0x0){_0xb42b77[_0xfd07('0x69')]();return processPromises(_0xb42b77);}},'complete':function(){return processPromises()[_0xfd07('0x2c')](function(){logger[_0xfd07('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2b06c3,_0x2566d3){logger[_0xfd07('0x66')](_0xfd07('0x6a'),JSON[_0xfd07('0x31')](_0x2b06c3));endCsv();}});})[_0xfd07('0x2f')](function(_0x471caf){logger['error'](_0xfd07('0x6b'),JSON[_0xfd07('0x31')](_0x471caf));});}main(); \ No newline at end of file +var _0xfdd0=['outbound','dialCheckDuplicateType','Lists','get','always','push','sequelize','query','VoiceQueueId','findAll','CmList','BlackLists','all','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','create','then','pick','catch','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','phone','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','updatedAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0xfdd0,0x1dd));var _0x0fdd=function(_0x3c1a53,_0x583c4a){_0x3c1a53=_0x3c1a53-0x0;var _0x2bbfd5=_0xfdd0[_0x3c1a53];return _0x2bbfd5;};'use strict';var BPromise=require(_0x0fdd('0x0'));var util=require(_0x0fdd('0x1'));var _=require(_0x0fdd('0x2'));var fs=require('fs');var squel=require(_0x0fdd('0x3'));var Papa=require('papaparse');var Redis=require(_0x0fdd('0x4'));var db=require(_0x0fdd('0x5'))['db'];var config=require(_0x0fdd('0x6'));var logger=require('../../../config/logger')(_0x0fdd('0x7'));config[_0x0fdd('0x8')]=_[_0x0fdd('0x9')](config[_0x0fdd('0x8')],{'host':_0x0fdd('0xa'),'port':0x18eb});var socket=require(_0x0fdd('0xb'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x0fdd('0xc')](socket);try{if(!process[_0x0fdd('0xd')][0x2]||process[_0x0fdd('0xd')][0x2]===_0x0fdd('0xe')||process['argv'][0x2]===_0x0fdd('0xf')){throw new Error(_0x0fdd('0x10'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x0fdd('0xd')][0x3]===_0x0fdd('0xe')||process[_0x0fdd('0xd')][0x3]===_0x0fdd('0xf')||!process[_0x0fdd('0xd')][0x4]||process[_0x0fdd('0xd')][0x4]===_0x0fdd('0xe')||process[_0x0fdd('0xd')][0x4]===_0x0fdd('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x0fdd('0x11')](process[_0x0fdd('0xd')][0x3][_0x0fdd('0x12')](','),process[_0x0fdd('0xd')][0x4][_0x0fdd('0x12')](','));if(!process['argv'][0x5]||process[_0x0fdd('0xd')][0x5]==='undefined'||process[_0x0fdd('0xd')][0x5]===_0x0fdd('0xf')){throw new Error(_0x0fdd('0x13'));}var LISTID=process[_0x0fdd('0xd')][0x5];var COMPANYID=process[_0x0fdd('0xd')][0x6]&&process[_0x0fdd('0xd')][0x6]!==_0x0fdd('0xe')&&process['argv'][0x6]!==_0x0fdd('0xf')?process[_0x0fdd('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0fdd('0xd')][0x7]!==_0x0fdd('0xe')&&process[_0x0fdd('0xd')][0x7]!==_0x0fdd('0xf')?process[_0x0fdd('0xd')][0x7]:null;if(!process[_0x0fdd('0xd')][0x8]||process[_0x0fdd('0xd')][0x8]===_0x0fdd('0xe')||process[_0x0fdd('0xd')][0x8]===_0x0fdd('0xf')){throw new Error(_0x0fdd('0x14'));}var SOCKET_TIMESTAMP=process[_0x0fdd('0xd')][0x8];}catch(_0x152eb4){logger[_0x0fdd('0x15')](_0x152eb4);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(_0x490fba,_0x37f23b,_0x108e63,_0xc5b13f){var _0x2d8659={'message':_0x37f23b};_0x2d8659[_0x490fba]=!![];if(_0x108e63){_0x2d8659[_0x0fdd('0x16')]=_0x108e63;}if(_0xc5b13f){_0x2d8659[_0x0fdd('0x17')]=_0xc5b13f;}return _0x2d8659;}function isEmail(_0x288033){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))*$/[_0x0fdd('0x18')](_0x288033);}function checkRow(_0x873f40,_0x52a58e,_0x2c2319){return new BPromise(function(_0x1fef42,_0x4032ce){if(_[_0x0fdd('0x19')](_0x873f40)){return _0x4032ce(handleCheckRowError(_0x0fdd('0x15'),_0x0fdd('0x1a'),null,_0x2c2319));}if(_0x873f40['errors']&&_0x873f40['errors'][_0x0fdd('0x1b')]){var _0x351da0=_[_0x0fdd('0x1c')](_0x873f40['errors'],_0x0fdd('0x1d'))['join'](';');return _0x4032ce(handleCheckRowError(_0x0fdd('0x15'),_0x351da0,null,_0x2c2319));}var _0x2c98ee={};for(var _0x2e4c34 in FIELDS){if(FIELDS[_0x0fdd('0x1e')](_0x2e4c34)&&FIELDS[_0x2e4c34]){_0x2c98ee[_0x2e4c34]=_0x873f40[_0x0fdd('0x1f')][0x0][FIELDS[_0x2e4c34]]||_0x873f40['data'][0x0]['\ufeff'+FIELDS[_0x2e4c34]];}}if(!_0x2c98ee[_0x0fdd('0x20')]){return _0x4032ce(handleCheckRowError(_0x0fdd('0x15'),_0x0fdd('0x21'),null,_0x2c2319));}if(!_0x2c98ee['phone']){return _0x4032ce(handleCheckRowError(_0x0fdd('0x15'),_0x0fdd('0x22'),null,_0x2c2319));}if(_0x2c98ee['birthDate']){var _0x258ab9=moment(_0x2c98ee[_0x0fdd('0x23')],_0x0fdd('0x24'));if(!_0x258ab9['isValid']()){return _0x4032ce(handleCheckRowError(_0x0fdd('0x15'),_0x0fdd('0x25'),null,_0x2c2319));}}if(_0x2c98ee['email']){if(!isEmail(_0x2c98ee[_0x0fdd('0x26')])){return _0x4032ce(handleCheckRowError(_0x0fdd('0x15'),_0x0fdd('0x27'),null,_0x2c2319));}}_0x2c98ee[_0x0fdd('0x28')]=LISTID;_0x2c98ee['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0fdd('0x1b')]&&_0x52a58e){var _0x1d19f9={};for(var _0x596058=0x0,_0x1a73f4=DUPLICATES['length'];_0x596058<_0x1a73f4;_0x596058+=0x1){_0x1d19f9[DUPLICATES[_0x596058]]=_0x2c98ee[DUPLICATES[_0x596058]];}var _0x17a8ae=_[_0x0fdd('0x29')](_0x52a58e,_0x1d19f9);if(_0x17a8ae){return _0x4032ce(handleCheckRowError(_0x0fdd('0x2a'),_0x0fdd('0x2b'),_0x17a8ae,_0x2c2319));}}return db['CmContact'][_0x0fdd('0x2c')](_0x2c98ee,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2c98ee)})[_0x0fdd('0x2d')](function(_0x3a47aa){if(DUPLICATES&&DUPLICATES[_0x0fdd('0x1b')]&&_0x52a58e){_0x52a58e['push'](_[_0x0fdd('0x2e')](_0x2c98ee,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3a47aa['id'];return _0x1fef42();})[_0x0fdd('0x2f')](function(_0x281c1a){return _0x4032ce(handleCheckRowError(_0x0fdd('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x281c1a[_0x0fdd('0x1d')]||JSON[_0x0fdd('0x30')](_0x281c1a)),null,_0x2c2319));});});}function checkHopper(){function _0x5644d2(){return function(_0x1775c9){logger[_0x0fdd('0x15')]('cmContact',_0x0fdd('0x31'),util[_0x0fdd('0x32')](_0x1775c9,{'showHidden':![],'depth':null}));};}var _0x52f5a2=function(_0x3e38ad,_0x1351fa){var _0x48f398=squel[_0x0fdd('0x33')]()['into'](_0x0fdd('0x34'))[_0x0fdd('0x35')]([_0x0fdd('0x36'),'scheduledAt',_0x0fdd('0x37'),_0x0fdd('0x28'),_0x1351fa,_0x0fdd('0x38'),'updatedAt'],squel[_0x0fdd('0x39')]()['field'](_0x0fdd('0x36'),'phone')[_0x0fdd('0x3a')](_0x0fdd('0x3b'),_0x0fdd('0x3c'))[_0x0fdd('0x3a')]('id',_0x0fdd('0x37'))[_0x0fdd('0x3a')](LISTID['toString'](),_0x0fdd('0x28'))[_0x0fdd('0x3a')](_0x3e38ad['id'][_0x0fdd('0x3d')](),_0x1351fa)[_0x0fdd('0x3a')](_0x0fdd('0x3b'),'createdAt')['field']('NOW()','updatedAt')[_0x0fdd('0x3e')](_0x0fdd('0x3f'))[_0x0fdd('0x40')](_0x0fdd('0x41'))[_0x0fdd('0x40')](_0x0fdd('0x42'),LISTID[_0x0fdd('0x3d')]())[_0x0fdd('0x40')](_0x0fdd('0x43'))['where'](_0x0fdd('0x44'),squel['select']()['field'](_0x0fdd('0x36'))[_0x0fdd('0x3e')](_0x0fdd('0x34'))[_0x0fdd('0x40')](_0x1351fa+_0x0fdd('0x45'),_0x3e38ad['id']['toString']())))[_0x0fdd('0x3d')]();return _0x48f398;};var _0x218e71=function(_0x42256e,_0x1380f0){var _0x330bf2=squel[_0x0fdd('0x33')]()[_0x0fdd('0x46')]('cm_hopper')[_0x0fdd('0x35')]([_0x0fdd('0x36'),_0x0fdd('0x3c'),_0x0fdd('0x37'),_0x0fdd('0x28'),_0x1380f0,_0x0fdd('0x38'),_0x0fdd('0x47')],squel['select']()[_0x0fdd('0x3a')]('phone',_0x0fdd('0x36'))[_0x0fdd('0x3a')](_0x0fdd('0x3b'),_0x0fdd('0x3c'))[_0x0fdd('0x3a')]('id',_0x0fdd('0x37'))['field'](LISTID['toString'](),_0x0fdd('0x28'))[_0x0fdd('0x3a')](_0x42256e['id']['toString'](),_0x1380f0)[_0x0fdd('0x3a')]('NOW()',_0x0fdd('0x38'))['field'](_0x0fdd('0x3b'),_0x0fdd('0x47'))[_0x0fdd('0x3e')](_0x0fdd('0x3f'))[_0x0fdd('0x40')]('deletedAt\x20IS\x20NULL')[_0x0fdd('0x40')]('ListId\x20=\x20?',LISTID['toString']())[_0x0fdd('0x40')](_0x0fdd('0x48'),squel[_0x0fdd('0x49')](hopperContacts))[_0x0fdd('0x40')](_0x0fdd('0x43'))[_0x0fdd('0x40')](_0x0fdd('0x44'),squel[_0x0fdd('0x39')]()['field'](_0x0fdd('0x4a'))[_0x0fdd('0x3e')](_0x0fdd('0x4b'))[_0x0fdd('0x40')](_0x1380f0+'\x20=\x20?',_0x42256e['id'][_0x0fdd('0x3d')]()))[_0x0fdd('0x40')](_0x0fdd('0x44'),squel[_0x0fdd('0x39')]()[_0x0fdd('0x3a')](_0x0fdd('0x36'))['from'](_0x0fdd('0x34'))['where'](_0x1380f0+_0x0fdd('0x45'),_0x42256e['id'][_0x0fdd('0x3d')]())))['toString']();return _0x330bf2;};function _0x1a5764(_0x3e7001,_0x4a8974){var _0x55642b=squel[_0x0fdd('0x33')]()[_0x0fdd('0x46')]('cm_hopper')[_0x0fdd('0x35')]([_0x0fdd('0x36'),_0x0fdd('0x3c'),_0x0fdd('0x37'),_0x0fdd('0x28'),_0x4a8974,_0x0fdd('0x38'),'updatedAt'],squel[_0x0fdd('0x39')]()[_0x0fdd('0x3a')](_0x0fdd('0x36'),_0x0fdd('0x36'))['field']('NOW()','scheduledAt')[_0x0fdd('0x3a')]('id','ContactId')['field'](LISTID[_0x0fdd('0x3d')](),'ListId')[_0x0fdd('0x3a')](_0x3e7001['id']['toString'](),_0x4a8974)['field']('NOW()',_0x0fdd('0x38'))[_0x0fdd('0x3a')]('NOW()',_0x0fdd('0x47'))[_0x0fdd('0x3e')](_0x0fdd('0x3f'))[_0x0fdd('0x40')](_0x0fdd('0x41'))[_0x0fdd('0x40')](_0x0fdd('0x42'),LISTID[_0x0fdd('0x3d')]())[_0x0fdd('0x40')](_0x0fdd('0x48'),squel[_0x0fdd('0x49')](hopperContacts))[_0x0fdd('0x40')](_0x0fdd('0x43')))[_0x0fdd('0x3d')]();return _0x55642b;}function _0x2fe2e3(_0x5c7703,_0xfe310){var _0x18994e=squel[_0x0fdd('0x33')]()[_0x0fdd('0x46')](_0x0fdd('0x4c'))[_0x0fdd('0x35')]([_0x0fdd('0x36'),_0x0fdd('0x37'),_0x0fdd('0x28'),_0xfe310,'createdAt',_0x0fdd('0x47')],squel[_0x0fdd('0x39')]()[_0x0fdd('0x3a')](_0x0fdd('0x36'),'phone')[_0x0fdd('0x3a')]('id',_0x0fdd('0x37'))[_0x0fdd('0x3a')](LISTID[_0x0fdd('0x3d')](),'ListId')[_0x0fdd('0x3a')](_0x5c7703['id'][_0x0fdd('0x3d')](),_0xfe310)[_0x0fdd('0x3a')](_0x0fdd('0x3b'),_0x0fdd('0x38'))[_0x0fdd('0x3a')](_0x0fdd('0x3b'),_0x0fdd('0x47'))[_0x0fdd('0x3e')](_0x0fdd('0x3f'))['where']('deletedAt\x20IS\x20NULL')[_0x0fdd('0x40')](_0x0fdd('0x42'),LISTID[_0x0fdd('0x3d')]())[_0x0fdd('0x40')](_0x0fdd('0x48'),squel[_0x0fdd('0x49')](hopperContacts))[_0x0fdd('0x40')](_0x0fdd('0x43')))[_0x0fdd('0x3d')]();return _0x18994e;}return db[_0x0fdd('0x4d')]['findAll']({'where':{'type':_0x0fdd('0x4e')},'attributes':['id',_0x0fdd('0x4f')],'include':[{'model':db['CmList'],'as':_0x0fdd('0x50'),'where':{'id':LISTID}}]})[_0x0fdd('0x2d')](function(_0x307970){var _0x5907c9=[];if(_0x307970){var _0x169eca;for(var _0x33966a=0x0,_0x5ca7d0;_0x33966a<_0x307970['length'];_0x33966a+=0x1){_0x5ca7d0=_0x307970[_0x33966a][_0x0fdd('0x51')]({'plain':!![]});switch(_0x5ca7d0[_0x0fdd('0x4f')]){case _0x0fdd('0x52'):_0x5907c9[_0x0fdd('0x53')](db[_0x0fdd('0x54')][_0x0fdd('0x55')](_0x218e71(_0x5ca7d0,_0x0fdd('0x56')))['then'](function(){})[_0x0fdd('0x2f')](_0x5644d2()));break;case'onlyIfOpen':_0x5907c9[_0x0fdd('0x53')](db['sequelize'][_0x0fdd('0x55')](_0x52f5a2(_0x5ca7d0,_0x0fdd('0x56')))['then'](function(){})[_0x0fdd('0x2f')](_0x5644d2()));break;default:_0x5907c9[_0x0fdd('0x53')](db[_0x0fdd('0x54')][_0x0fdd('0x55')](_0x1a5764(_0x5ca7d0,_0x0fdd('0x56')))[_0x0fdd('0x2d')](function(){})[_0x0fdd('0x2f')](_0x5644d2()));}}}return _0x5907c9;})['all']()[_0x0fdd('0x2d')](function(){return db[_0x0fdd('0x4d')][_0x0fdd('0x57')]({'where':{'type':_0x0fdd('0x4e')},'attributes':['id'],'include':[{'model':db[_0x0fdd('0x58')],'as':_0x0fdd('0x59'),'where':{'id':LISTID}}]})[_0x0fdd('0x2d')](function(_0x2c7e5d){var _0x1a3f7f=[];if(_0x2c7e5d){var _0xb33925;for(var _0x57063e=0x0,_0x3a0eaf;_0x57063e<_0x2c7e5d['length'];_0x57063e+=0x1){_0x3a0eaf=_0x2c7e5d[_0x57063e][_0x0fdd('0x51')]({'plain':!![]});_0x1a3f7f['push'](db[_0x0fdd('0x54')][_0x0fdd('0x55')](_0x2fe2e3(_0x3a0eaf,_0x0fdd('0x56')))[_0x0fdd('0x2d')](function(){})['catch'](_0x5644d2()));}}return _0x1a3f7f;})[_0x0fdd('0x5a')]();})['then'](function(){return db['Campaign'][_0x0fdd('0x57')]({'attributes':['id',_0x0fdd('0x4f')],'include':[{'model':db[_0x0fdd('0x58')],'as':_0x0fdd('0x50'),'where':{'id':LISTID}}]})[_0x0fdd('0x2d')](function(_0x305313){var _0x3a1da9=[];if(_0x305313){for(var _0x2c926e=0x0,_0x363817;_0x2c926e<_0x305313[_0x0fdd('0x1b')];_0x2c926e+=0x1){_0x363817=_0x305313[_0x2c926e][_0x0fdd('0x51')]({'plain':!![]});switch(_0x363817[_0x0fdd('0x4f')]){case _0x0fdd('0x52'):_0x3a1da9[_0x0fdd('0x53')](db[_0x0fdd('0x54')][_0x0fdd('0x55')](_0x218e71(_0x363817,_0x0fdd('0x5b')))['then'](function(){})[_0x0fdd('0x2f')](_0x5644d2()));break;case _0x0fdd('0x5c'):_0x3a1da9['push'](db[_0x0fdd('0x54')][_0x0fdd('0x55')](_0x52f5a2(_0x363817,_0x0fdd('0x5b')))[_0x0fdd('0x2d')](function(){})[_0x0fdd('0x2f')](_0x5644d2()));break;default:_0x3a1da9['push'](db['sequelize'][_0x0fdd('0x55')](_0x1a5764(_0x363817,_0x0fdd('0x5b')))[_0x0fdd('0x2d')](function(){})[_0x0fdd('0x2f')](_0x5644d2()));}}}return _0x3a1da9;})[_0x0fdd('0x5a')]();})['then'](function(){return db['Campaign'][_0x0fdd('0x57')]({'attributes':['id'],'include':[{'model':db[_0x0fdd('0x58')],'as':_0x0fdd('0x59'),'where':{'id':LISTID}}]})[_0x0fdd('0x2d')](function(_0x3528e5){var _0x2ae0e7=[];if(_0x3528e5){for(var _0x2dec05=0x0,_0x6f30aa;_0x2dec05<_0x3528e5['length'];_0x2dec05+=0x1){_0x6f30aa=_0x3528e5[_0x2dec05][_0x0fdd('0x51')]({'plain':!![]});_0x2ae0e7[_0x0fdd('0x53')](db[_0x0fdd('0x54')][_0x0fdd('0x55')](_0x2fe2e3(_0x6f30aa,_0x0fdd('0x5b')))[_0x0fdd('0x2d')](function(){})[_0x0fdd('0x2f')](_0x5644d2()));}}return _0x2ae0e7;})[_0x0fdd('0x5a')]();})[_0x0fdd('0x2f')](function(_0x1c0bfd){logger[_0x0fdd('0x15')](_0x0fdd('0x5d'),_0x0fdd('0x5e'),_0x1c0bfd[_0x0fdd('0x1d')]);});}var processPromises=function(_0x410987){return BPromise[_0x0fdd('0x5a')](promises)[_0x0fdd('0x2d')](function(_0x55b5bd){})[_0x0fdd('0x2f')](function(_0x440297){logger[_0x0fdd('0x15')](_0x0fdd('0x5f'),JSON['stringify'](_0x440297));})['finally'](function(){socket[_0x0fdd('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x410987){return _0x410987[_0x0fdd('0x61')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0fdd('0x2d')](function(){socket[_0x0fdd('0x60')](_0x0fdd('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0fdd('0x63')](FILEPATH);}catch(_0x29df0){logger[_0x0fdd('0x15')](_0x0fdd('0x64'),JSON[_0x0fdd('0x30')](_0x29df0));}finally{process[_0x0fdd('0x65')](0x0);}});};process['on'](_0x0fdd('0x66'),function(){logger[_0x0fdd('0x67')](_0x0fdd('0x68'));endCsv();});function main(){return BPromise[_0x0fdd('0x69')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0fdd('0x12')](',');return db[_0x0fdd('0x6a')][_0x0fdd('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0fdd('0x2d')](function(_0x5a8787){var _0x3a357d=fs[_0x0fdd('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3a357d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x48d7d3,_0x20440c){total+=0x1;var _0x40a4ee=total;promises[_0x0fdd('0x53')](checkRow(_0x48d7d3,_0x5a8787,_0x40a4ee)[_0x0fdd('0x2d')](function(){success+=0x1;})[_0x0fdd('0x2f')](function(_0x374bf7){if(_0x374bf7[_0x0fdd('0x15')]){errors+=0x1;delete _0x374bf7[_0x0fdd('0x15')];}else if(_0x374bf7['duplicate']){duplicates+=0x1;delete _0x374bf7[_0x0fdd('0x2a')];}rows['push'](_0x374bf7);}));if(total%0xc8===0x0){_0x20440c[_0x0fdd('0x6c')]();return processPromises(_0x20440c);}},'complete':function(){return processPromises()[_0x0fdd('0x2d')](function(){logger[_0x0fdd('0x67')](_0x0fdd('0x6d'));endCsv();});},'error':function(_0x4a37a2,_0x1ec832){logger[_0x0fdd('0x67')](_0x0fdd('0x6e'),JSON[_0x0fdd('0x30')](_0x4a37a2));endCsv();}});})['catch'](function(_0x53d942){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x53d942));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a007f6b..8dfc110 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 _0x88d0=['scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','error','message','exit','errors','code','info','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','header','ContactItemType','name','_description','writeFileSync','parse','rows','data','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','.id\x20=\x20','join','CmContact','findAll','AdditionalPhones','then','length','split','push','all','isNil','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','insert','cm_hopper_black','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId'];(function(_0x5e3cef,_0x3c57f5){var _0x34c370=function(_0x4bc3e4){while(--_0x4bc3e4){_0x5e3cef['push'](_0x5e3cef['shift']());}};_0x34c370(++_0x3c57f5);}(_0x88d0,0x11c));var _0x088d=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x88d0[_0xd22d95];return _0x15d7a3;};'use strict';var fs=require('fs');var path=require(_0x088d('0x0'));var _=require(_0x088d('0x1'));var Papa=require(_0x088d('0x2'));var util=require('util');var BPromise=require(_0x088d('0x3'));var moment=require('moment');var squel=require(_0x088d('0x4'));var Redis=require(_0x088d('0x5'));var db=require(_0x088d('0x6'))['db'];var config=require(_0x088d('0x7'));var shared=require(_0x088d('0x8'));var logger=require('../../../config/logger')('import');config['redis']=_['defaults'](config[_0x088d('0x9')],{'host':_0x088d('0xa'),'port':0x18eb});var socket=require(_0x088d('0xb'))(new Redis(config[_0x088d('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x088d('0xc')](_0x088d('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x088d('0xc')](_0x088d('0xd'));function isEmail(_0x315f5f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x315f5f);}function selectNotIn(_0x5d9348,_0x4211a8,_0x1abb29,_0x27da6a,_0xf3085){return squel[_0x088d('0xe')]()[_0x088d('0xf')]('phone')[_0x088d('0x10')](_0x27da6a)['join'](_0x4211a8,null,_0x4211a8+_0x088d('0x11')+_0x27da6a+'.'+_0x1abb29)['where'](_0x27da6a+'.'+_0x1abb29+'\x20=\x20'+_0x5d9348+'.'+_0x1abb29)['where'](_0x4211a8+'.dialCheckDuplicateType\x20IN\x20('+_0xf3085[_0x088d('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x17708d,_0xac33e5){promisesAdditionalPhones=[];return db[_0x088d('0x13')][_0x088d('0x14')]({'raw':!![],'attributes':['id',_0x088d('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x088d('0x16')](function(_0x340c2e){if(_0x340c2e!==null){var _0x106e07=[];for(var _0x4c1a23=0x0;_0x4c1a23<_0x340c2e[_0x088d('0x17')];_0x4c1a23++){var _0x339732=_0x340c2e[_0x4c1a23];_0x106e07['push'](insertAdditionalPhones(_0x339732));}}Promise['all'](_0x106e07)[_0x088d('0x16')](function(){_0x17708d({'val':0x1});});});});}function insertAdditionalPhones(_0x7fd825){return new Promise(function(_0x126ecf,_0x240558){var _0x1ca280=_0x7fd825[_0x088d('0x15')];var _0x142213=_0x1ca280[_0x088d('0x18')](';');var _0x364082=[];orderBy=0x0;for(var _0x5e6573=0x0;_0x5e6573<_0x142213[_0x088d('0x17')];_0x5e6573++){_0x364082[_0x088d('0x19')](splitAdditionalPhone(_0x7fd825['id'],_0x142213[_0x5e6573]));}Promise[_0x088d('0x1a')](_0x364082)[_0x088d('0x16')](function(){_0x126ecf({'val':_0x142213[_0x088d('0x17')]});});});}function splitAdditionalPhone(_0x5d6e97,_0x459bca){return new Promise(function(_0x19e3e5,_0x4c406f){var _0xeb4643=_0x459bca['split'](':');var _0x2aa676=_0xeb4643[0x0];var _0x3a6132=_0xeb4643[0x1];if(!_[_0x088d('0x1b')](_0x3a6132)){var _0x161c93=_0x3a6132['split']('|');var _0x4997cd=[];for(var _0x5542bf=0x0;_0x5542bf<_0x161c93['length'];_0x5542bf++){if(_0x161c93[_0x5542bf]!==''){var _0x4d7ab6=_[_0x088d('0x1c')](promisesAdditionalPhones,{'contactId':_0x5d6e97,'phone':_0x161c93[_0x5542bf]});if(_0x4d7ab6[_0x088d('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x088d('0x19')]({'contactId':_0x5d6e97,'contactTypeId':_0x2aa676,'phone':_0x161c93[_0x5542bf],'orderBy':orderBy});}}}_0x19e3e5({'ok':0x1});}else _0x19e3e5({'res':0x0});});}function createAdditionalPhone(_0x3760ca,_0x2b0f7b,_0x4f5fa0,_0x32e5b9){var _0x3fd979='';var _0x4511b8='';var _0x9335be=_0x4f5fa0[_0x088d('0x18')]('§');_0x3fd979=_0x9335be[0x0];if(_0x9335be['length']==0x2)_0x4511b8=_0x9335be[0x1];return new Promise(function(_0x3a6e37,_0x661464){return db['CmContactHasItem'][_0x088d('0x1d')]({'where':{'CmContactId':_0x3760ca,'item':_0x3fd979}})[_0x088d('0x16')](function(_0x349480){if(_0x349480){return db[_0x088d('0x1e')][_0x088d('0x1f')]({'ItemTypeId':_0x2b0f7b,'description':_0x4511b8,'OrderBy':_0x32e5b9},{'where':{'CmContactId':_0x3760ca,'item':_0x3fd979}})['then'](function(_0x1f5bb1){_0x3a6e37({'res':_0x088d('0x20')});});}else{return db[_0x088d('0x1e')][_0x088d('0x21')]({'CmContactId':_0x3760ca,'item':_0x3fd979,'description':_0x4511b8,'ItemTypeId':_0x2b0f7b,'OrderBy':_0x32e5b9,'ItemClass':_0x088d('0x22')})[_0x088d('0x16')](function(_0x286e45){_0x3a6e37({'res':_0x088d('0x23')});});}});});}function insertCmHopper(_0x37eb3b,_0x2a6ead,_0x112bb4,_0x1b4c79,_0x123e62){var _0x4a9c95=[_0x088d('0x24'),_0x088d('0x25'),_0x088d('0x26'),_0x088d('0x27'),_0x2a6ead+'.'+_0x1b4c79,_0x088d('0x28'),_0x088d('0x29'),_0x088d('0x2a'),_0x088d('0x2b'),'\x22'+_0x123e62+'\x22'];return squel['insert']()[_0x088d('0x2c')](_0x088d('0x2d'))[_0x088d('0x2e')]([_0x088d('0x2f'),_0x088d('0x30'),_0x088d('0x31'),_0x088d('0x32'),_0x1b4c79,_0x088d('0x33'),_0x088d('0x34'),_0x088d('0x35'),'UserId',_0x088d('0x36')],squel[_0x088d('0xe')]()[_0x088d('0x37')](_0x4a9c95)[_0x088d('0x10')](_0x2a6ead)[_0x088d('0x12')](_0x088d('0x38'),null,_0x088d('0x39')+_0x2a6ead+_0x088d('0x3a'))[_0x088d('0x12')](_0x112bb4,null,_0x112bb4+_0x088d('0x11')+_0x2a6ead+'.'+_0x1b4c79)[_0x088d('0x3b')](_0x2a6ead+_0x088d('0x3c'),_0x37eb3b)[_0x088d('0x3b')](_0x088d('0x3d'),NOW)[_0x088d('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a6ead,_0x112bb4,_0x1b4c79,'cm_hopper',[_0x088d('0x3e'),_0x088d('0x3f')]))[_0x088d('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a6ead,_0x112bb4,_0x1b4c79,_0x088d('0x2d'),[_0x088d('0x3e')])))['toString']();}function insertCmHopperBlack(_0xf6cd3f,_0x1f5220,_0x378665,_0x12b579){var _0x122248=[_0x088d('0x24'),_0x088d('0x26'),_0x088d('0x27'),_0x1f5220+'.'+_0x12b579,_0x088d('0x28'),_0x088d('0x29')];return squel[_0x088d('0x40')]()['into'](_0x088d('0x41'))['fromQuery'](['phone',_0x088d('0x31'),_0x088d('0x32'),_0x12b579,_0x088d('0x33'),_0x088d('0x34')],squel['select']()[_0x088d('0x37')](_0x122248)[_0x088d('0x10')](_0x1f5220)[_0x088d('0x12')](_0x088d('0x38'),null,_0x088d('0x39')+_0x1f5220+'.CmListId')[_0x088d('0x12')](_0x378665,null,_0x378665+_0x088d('0x11')+_0x1f5220+'.'+_0x12b579)['where'](_0x1f5220+_0x088d('0x3c'),_0xf6cd3f)[_0x088d('0x3b')](_0x088d('0x3d'),NOW)[_0x088d('0x3b')](_0x088d('0x42'),squel[_0x088d('0xe')]()[_0x088d('0xf')](_0x088d('0x2f'))[_0x088d('0x10')](_0x088d('0x41'))[_0x088d('0x3b')](_0x088d('0x43'),_0xf6cd3f)[_0x088d('0x3b')](_0x12b579+_0x088d('0x44')+_0x1f5220+'.'+_0x12b579)))[_0x088d('0x45')]();}function insertTzCmHopper(_0x9fc203,_0x4eca7d,_0x42c200,_0x59452e,_0x1869a2,_0x573173){var _0x6af268=[_0x088d('0x24'),_0x088d('0x46')+_0x573173+_0x088d('0x47'),_0x088d('0x26'),_0x088d('0x27'),_0x4eca7d+'.'+_0x59452e,_0x088d('0x28'),_0x088d('0x29'),'cm_contacts.priority',_0x088d('0x2b'),'\x22'+_0x1869a2+'\x22'];var _0x13ebac=squel[_0x088d('0x40')]()['into'](_0x088d('0x2d'))[_0x088d('0x2e')]([_0x088d('0x2f'),_0x088d('0x30'),'ContactId','ListId',_0x59452e,_0x088d('0x33'),'updatedAt',_0x088d('0x35'),_0x088d('0x48'),'recallme'],squel[_0x088d('0xe')]()[_0x088d('0x37')](_0x6af268)['from'](_0x4eca7d)[_0x088d('0x12')](_0x088d('0x38'),null,_0x088d('0x39')+_0x4eca7d+_0x088d('0x3a'))[_0x088d('0x12')](_0x42c200,null,_0x42c200+_0x088d('0x11')+_0x4eca7d+'.'+_0x59452e)[_0x088d('0x12')](_0x573173,null,_0x573173+_0x088d('0x11')+_0x4eca7d+'.'+_0x59452e)[_0x088d('0x3b')](_0x4eca7d+_0x088d('0x3c'),_0x9fc203)['where'](_0x088d('0x3d'),NOW)[_0x088d('0x3b')](_0x088d('0x42'),selectNotIn(_0x4eca7d,_0x42c200,_0x59452e,_0x088d('0x2d'),[_0x088d('0x3e'),_0x088d('0x3f')]))[_0x088d('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4eca7d,_0x42c200,_0x59452e,_0x088d('0x2d'),['\x22always\x22'])))['toString']();return _0x13ebac;}function insertTzCmHopperBlack(_0x14db29,_0x2b68e2,_0x11d97d,_0x1d552d){var _0x32e578=[_0x088d('0x24'),_0x088d('0x26'),_0x088d('0x27'),_0x2b68e2+'.'+_0x1d552d,_0x088d('0x28'),_0x088d('0x29')];return squel[_0x088d('0x40')]()[_0x088d('0x2c')](_0x088d('0x41'))[_0x088d('0x2e')]([_0x088d('0x2f'),_0x088d('0x31'),_0x088d('0x32'),_0x1d552d,_0x088d('0x33'),'updatedAt'],squel['select']()['fields'](_0x32e578)[_0x088d('0x10')](_0x2b68e2)[_0x088d('0x12')](_0x088d('0x38'),null,_0x088d('0x39')+_0x2b68e2+_0x088d('0x3a'))[_0x088d('0x12')](_0x11d97d,null,_0x11d97d+_0x088d('0x11')+_0x2b68e2+'.'+_0x1d552d)[_0x088d('0x3b')](_0x2b68e2+'.CmListId\x20=\x20?',_0x14db29)[_0x088d('0x3b')](_0x088d('0x3d'),NOW)[_0x088d('0x3b')](_0x088d('0x42'),squel['select']()['field']('phone')['from'](_0x088d('0x41'))[_0x088d('0x3b')](_0x088d('0x43'),_0x14db29)['where'](_0x1d552d+'\x20=\x20'+_0x2b68e2+'.'+_0x1d552d)))[_0x088d('0x45')]();}function insertCmHopperAdditionalPhones(_0x24d014){var _0x514f9a=[_0x088d('0x49'),_0x088d('0x4a'),_0x088d('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x088d('0x40')]()[_0x088d('0x2c')](_0x088d('0x4c'))['fromQuery']([_0x088d('0x4d'),_0x088d('0x2f'),_0x088d('0x4e'),'createdAt',_0x088d('0x34')],squel[_0x088d('0xe')]()[_0x088d('0x37')](_0x514f9a)[_0x088d('0x10')]('cm_hopper')[_0x088d('0x12')]('cm_contacts',null,_0x088d('0x4f'))[_0x088d('0x12')](_0x088d('0x50'),null,_0x088d('0x51'))['where'](_0x088d('0x52'),_0x24d014)[_0x088d('0x3b')](_0x088d('0x3d'),NOW))[_0x088d('0x45')]();}function insertCmContact(_0x5a9371,_0x300c94,_0x42380d,_0x25c89f){var _0x3b5d21=_[_0x088d('0x53')](_[_0x088d('0x54')](_0x25c89f),['ListId',_0x088d('0x55'),_0x088d('0x33'),_0x088d('0x34'),_0x088d('0x56')]);return squel[_0x088d('0x40')]()[_0x088d('0x2c')](_0x088d('0x38'))['fromQuery'](_0x3b5d21,squel[_0x088d('0xe')]()['fields'](_0x3b5d21)[_0x088d('0x10')](_0x300c94)[_0x088d('0x3b')]('('+_0x42380d[_0x088d('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x088d('0xe')]()[_0x088d('0x37')](_0x42380d)['from'](_0x088d('0x38'))[_0x088d('0x3b')](_0x088d('0x43'),_0x5a9371)['where'](_0x088d('0x57')))[_0x088d('0x3b')](_0x088d('0x58'),squel['select']()[_0x088d('0xf')](_0x088d('0x59'),_0x088d('0x5a'))[_0x088d('0x10')](_0x300c94)[_0x088d('0x5b')](_0x42380d['join'](','))))[_0x088d('0x45')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x116503){logger[_0x088d('0x5c')](_0x116503[_0x088d('0x5d')]);process[_0x088d('0x5e')](0x1);}function handleError(_0x9c5072,_0x1e4ef3){stats[_0x088d('0x5f')][_0x088d('0x19')]({'name':_0x1e4ef3[_0x088d('0x60')],'message':_0x1e4ef3[_0x088d('0x5d')],'row':_0x9c5072});}function handleQuery(_0x2f14f2){logger[_0x088d('0x61')](_0x2f14f2);return db['sequelize']['query'](_0x2f14f2)[_0x088d('0x62')](function(_0x408014){results['push'](_0x408014);})[_0x088d('0x63')](function(_0x23f091){logger[_0x088d('0x5c')](_0x23f091[_0x088d('0x5d')]);});}function updateTzCampaigns(_0x649807){return new Promise(function(_0x3cd8f0,_0x4f94d9){var _0x2f02c4=squel['select']()[_0x088d('0x37')](['campaigns.id',_0x088d('0x64')])['from'](_0x088d('0x65'))['join'](_0x088d('0x66'),null,_0x088d('0x67'))[_0x088d('0x3b')]('campaigns_has_cm_lists.CmListId='+_0x649807);db[_0x088d('0x68')][_0x088d('0x69')](_0x2f02c4['toString']())[_0x088d('0x62')](function(_0x213058){var _0x1e9965=[];for(var _0x386fea=0x0;_0x386fea<_0x213058[_0x088d('0x17')];_0x386fea++){_0x1e9965[_0x088d('0x19')](getTimezoneData(_0x213058[_0x386fea],tmp_campaigns));}BPromise[_0x088d('0x1a')](_0x1e9965)[_0x088d('0x16')](function(){_0x3cd8f0({'val':0x1});});})[_0x088d('0x63')](function(_0x1c1511){logger[_0x088d('0x5c')](_0x1c1511[_0x088d('0x5d')]);_0x3cd8f0({'val':0x0});});});}function updateTzVoiceQueues(_0xe275d3){return new Promise(function(_0xa11e6c,_0x47c7ce){var _0x1cba4=squel[_0x088d('0xe')]()[_0x088d('0x37')]([_0x088d('0x6a'),_0x088d('0x6b')])[_0x088d('0x10')](_0x088d('0x6c'))[_0x088d('0x12')]('voice_queues_has_cm_lists',null,_0x088d('0x6d'))['where'](_0x088d('0x6e')+_0xe275d3);db[_0x088d('0x68')][_0x088d('0x69')](_0x1cba4[_0x088d('0x45')]())[_0x088d('0x62')](function(_0x5ca2eb){var _0x16e036=[];for(var _0x283dd1=0x0;_0x283dd1<_0x5ca2eb['length'];_0x283dd1++){_0x16e036[_0x088d('0x19')](getTimezoneData(_0x5ca2eb[_0x283dd1],tmp_voice_queues));}BPromise[_0x088d('0x1a')](_0x16e036)['then'](function(){_0xa11e6c({'val':0x1});});})[_0x088d('0x63')](function(_0x2e0d06){logger['error'](_0x2e0d06[_0x088d('0x5d')]);_0xa11e6c({'val':0x0});});});}function getTimezoneData(_0x37863c,_0x22ec69){return new Promise(function(_0x7cdd3e,_0x5c6de4){var _0x2c7204=shared[_0x088d('0x6f')];var _0x31d0ef=_0x2c7204[_0x37863c[_0x088d('0x70')]];if(_[_0x088d('0x1b')](_0x31d0ef)){_0x7cdd3e({'ret':0x1});}else{var _0x480beb=_0x31d0ef[_0x088d('0x71')];var _0x122a11=squel[_0x088d('0x40')]()[_0x088d('0x2c')](_0x22ec69)[_0x088d('0x72')]('id',_0x37863c['id'])[_0x088d('0x72')](_0x088d('0x73'),_0x480beb)[_0x088d('0x72')](_0x088d('0x70'),_0x37863c[_0x088d('0x70')])['toString']();return db['sequelize'][_0x088d('0x69')](_0x122a11)[_0x088d('0x62')](function(_0x2d26b7){_0x7cdd3e({'ret':0x1});})[_0x088d('0x63')](function(_0x51f65c){logger[_0x088d('0x5c')](_0x51f65c[_0x088d('0x5d')]);_0x5c6de4({'ret':0x1});});}});}function handleTZQuery(_0xf24b0f){logger[_0x088d('0x61')](_0xf24b0f);return db['sequelize'][_0x088d('0x69')](_0xf24b0f)[_0x088d('0x62')](function(_0x5d1a82){})[_0x088d('0x63')](function(_0xc5487c){logger[_0x088d('0x5c')](_0xc5487c[_0x088d('0x5d')]);});}function main(_0x4bca16,_0x1907f7,_0x45f51d,_0xf3f61c){logger[_0x088d('0x61')](_0x088d('0x74'),_0x4bca16,JSON['stringify'](_0x1907f7));process[_0x088d('0x75')](_0x088d('0x76'));var _0x422645=_0x1907f7[_0x088d('0x77')];var _0x221d5a=_[_0x088d('0x78')](_0x422645);var _0x8dfae4=_0x1907f7[_0x088d('0x79')];var _0x2b5a9f=path['join'](config[_0x088d('0x7a')],_0x088d('0x7b'),_0x8dfae4+_0x088d('0x7c'));hasTZ=_[_0x088d('0x54')](_0x422645)['includes']('dialTimezone');var _0x101af4=_[_0x088d('0x54')](_0x422645)[_0x088d('0x12')]();logger[_0x088d('0x61')](_0x088d('0x7d'),_0x101af4);db[_0x088d('0x7e')]['findAll']({'raw':!![],'attributes':['id',_0x088d('0x7f')]})[_0x088d('0x16')](function(_0x26add8){for(var _0x5c7c40=0x0;_0x5c7c40<_0x26add8[_0x088d('0x17')];_0x5c7c40++){if(_0x26add8[_0x5c7c40][_0x088d('0x7f')]in _0x422645){contactItemTypes[_0x088d('0x19')](_0x26add8[_0x5c7c40]);delete _0x221d5a[_0x26add8[_0x5c7c40]['name']];hasAdditionalPhones=!![];}for(var _0x2f5e27 in _0x422645){if(_0x26add8[_0x5c7c40]['name']+_0x088d('0x80')===_0x2f5e27){phoneDescriptions['push']({'itemTypeId':_0x26add8[_0x5c7c40]['id'],'description':_0x2f5e27});delete _0x221d5a[_0x2f5e27];}}}if(hasAdditionalPhones)_0x221d5a[_0x088d('0x15')]='';var _0x70e036=_['keys'](_0x221d5a)[_0x088d('0x12')]();logger['info'](_0x088d('0x7d'),_0x70e036);fs[_0x088d('0x81')](_0x2b5a9f,_0x70e036+'\x0a');Papa[_0x088d('0x82')](fs['createReadStream'](_0x4bca16),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bf41a,_0x1c1dcc){try{for(var _0x3ff8cd=0x0,_0x1d4659=[];_0x3ff8cd<_0x5bf41a['data'][_0x088d('0x17')];_0x3ff8cd++){stats[_0x088d('0x83')]+=0x1;if(_0x5bf41a[_0x088d('0x5f')][_0x3ff8cd]){handleError(_0x5bf41a[_0x088d('0x84')][_0x3ff8cd],_0x5bf41a[_0x088d('0x5f')][_0x3ff8cd]);}else{var _0x587a62=[];var _0x407b0d=[];var _0x2f6b96={};for(var _0x599306 in _0x422645){let _0x2884f5=contactItemTypes[_0x088d('0x85')](_0x49c112=>_0x49c112['name']===_0x599306);let _0x73891a=contactItemTypes[_0x088d('0x85')](_0x3be48a=>_0x3be48a[_0x088d('0x7f')]+_0x088d('0x80')===_0x599306);if(_[_0x088d('0x1b')](_0x2884f5)&&_[_0x088d('0x1b')](_0x73891a)){if(_0x422645[_0x088d('0x86')](_0x599306)){if(_0x5bf41a[_0x088d('0x84')][_0x3ff8cd][_0x422645[_0x599306]]){var _0x220b38=_[_0x088d('0x87')](_0x5bf41a['data'][_0x3ff8cd][_0x422645[_0x599306]][_0x088d('0x88')](/"/g,'\x27'));switch(_0x599306){case _0x088d('0x30'):var _0x330367=moment(_0x220b38,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x330367[_0x088d('0x89')]()){_0x1d4659['push']('\x22'+_0x220b38+'\x22');}else{_0x587a62[_0x088d('0x19')](_0x088d('0x8a'));}break;case _0x088d('0x35'):var _0x3521a1=parseInt(_0x220b38);_0x220b38=_[_0x088d('0x8b')](_0x3521a1)||_0x3521a1<0x0||_0x3521a1>0x4?_0xf3f61c?0x3:0x2:_0x3521a1;_0x1d4659[_0x088d('0x19')]('\x22'+_0x220b38+'\x22');break;case _0x088d('0x48'):var _0x4c6e4f=parseInt(_0x220b38);if(_[_0x088d('0x8c')](_0x4c6e4f)&&_[_0x088d('0x8d')](_0x45f51d,_0x4c6e4f)){_0x1d4659[_0x088d('0x19')]('\x22'+_0x4c6e4f+'\x22');}else{_0x587a62[_0x088d('0x19')](_0x088d('0x8e'));}break;case _0x088d('0x8f'):if(isEmail(_0x220b38)){_0x1d4659['push']('\x22'+_0x220b38+'\x22');}else{_0x587a62[_0x088d('0x19')](_0x088d('0x90'));}break;case _0x088d('0x91'):var _0x5b2cfc=moment(_0x220b38,'YYYY-MM-DD',!![]);if(_0x5b2cfc[_0x088d('0x89')]()){_0x1d4659['push']('\x22'+_0x220b38+'\x22');}else{_0x587a62[_0x088d('0x19')](_0x088d('0x92'));}break;case _0x088d('0x70'):var _0x6ffe93=shared[_0x088d('0x6f')];var _0x2db23a=_0x6ffe93[_0x220b38];if(!_[_0x088d('0x1b')](_0x2db23a)){var _0x42739c=_0x2db23a[_0x088d('0x71')];_0x1d4659[_0x088d('0x19')]('\x22'+_0x220b38+'\x22');_0x1d4659[_0x088d('0x19')]('\x22'+_0x42739c+'\x22');}break;default:_0x1d4659[_0x088d('0x19')]('\x22'+_0x220b38+'\x22');}}else{switch(_0x599306){case'firstName':case'phone':_0x587a62['push'](_0x599306+_0x088d('0x93'));break;default:_0x1d4659[_0x088d('0x19')]('\x22\x22');}}}}else{var _0x58c1fd='';if(!_[_0x088d('0x1b')](_0x2884f5)){if(!_0x2f6b96[_0x088d('0x86')](_0x2884f5['id'])){if(!_[_0x088d('0x1b')](_0x5bf41a[_0x088d('0x84')][_0x3ff8cd][_0x422645[_0x599306]])){var _0x220b38=_[_0x088d('0x87')](_0x5bf41a[_0x088d('0x84')][_0x3ff8cd][_0x422645[_0x599306]][_0x088d('0x88')](/"/g,'\x27'));var _0x120148=phoneDescriptions[_0x088d('0x85')](_0x26ebd4=>_0x26ebd4[_0x088d('0x94')]===_0x2884f5['id']);if(!_['isNil'](_0x120148)){var _0x27e3d7=_[_0x088d('0x87')](_0x5bf41a[_0x088d('0x84')][_0x3ff8cd][_0x422645[_0x120148['description']]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x27e3d7))_0x220b38=_0x220b38+'§'+_0x27e3d7;}if(_0x58c1fd=='')_0x58c1fd=_0x220b38;else _0x58c1fd+='|'+_0x220b38;}_0x407b0d[_0x088d('0x19')](_0x2884f5['id']+':'+_0x58c1fd);_0x2f6b96[_0x2884f5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d4659[_0x088d('0x19')]('\x22'+_0x407b0d[_0x088d('0x12')](';')+'\x22');}if(_0x587a62[_0x088d('0x17')]){handleError(_0x5bf41a[_0x088d('0x84')][_0x3ff8cd],{'code':_0x088d('0x95'),'message':_0x587a62[_0x088d('0x12')]()});}else{fs[_0x088d('0x96')](_0x2b5a9f,_0x1d4659[_0x088d('0x12')]()+'\x0a');}_0x1d4659=[];}if(!(stats[_0x088d('0x83')]%0xc8)){socket[_0x088d('0x97')](_0x088d('0x98')+_0x8dfae4,stats);stats[_0x088d('0x5f')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x1c1dcc[_0x088d('0x99')]();}}catch(_0x442fae){handleError(_0x5bf41a[_0x088d('0x84')][_0x3ff8cd],{'code':_0x088d('0x9a'),'message':_0x442fae[_0x088d('0x5d')]});logger['error']('step',_0x442fae['message']);}},'complete':function(){try{var _0x38656c=[];var _0x10317d=[];var _0x137985='cm_contacts';if(_0x1907f7[_0x088d('0x9b')]&&_0x1907f7[_0x088d('0x9b')][_0x088d('0x17')]){_0x137985=_0x088d('0x9c')+_0x8dfae4;_0x38656c['push'](_0x088d('0x9d')+_0x137985+_0x088d('0x9e'));}tmp_campaigns=_0x088d('0x9f')+_0x8dfae4;tmp_voice_queues=_0x088d('0xa0')+_0x8dfae4;_0x10317d[_0x088d('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x10317d['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x088d('0xa1')](_0x10317d,handleTZQuery)[_0x088d('0x16')](function(_0x30413d){updateTzCampaigns(_0x1907f7[_0x088d('0x32')])[_0x088d('0x16')](function(_0x3b0bd4){updateTzVoiceQueues(_0x1907f7[_0x088d('0x32')])['then'](function(_0x253616){if(hasTZ)_0x70e036=_0x70e036[_0x088d('0x88')](_0x088d('0x70'),_0x088d('0xa2'));var _0x2c68f1=util[_0x088d('0xc')](_0x088d('0xa3'),_0x2b5a9f,_0x137985,_0x70e036,_0x1907f7['ListId'],_0x1907f7[_0x088d('0x55')]||null,NOW,NOW);if(_[_0x088d('0x1b')](_0x422645[_0x088d('0x30')])){_0x2c68f1+=',\x20scheduledAt\x20=\x20NOW()';}_0x38656c['push'](_0x2c68f1);if(_0x1907f7[_0x088d('0x9b')]&&_0x1907f7[_0x088d('0x9b')]['length']){_0x38656c[_0x088d('0x19')](insertCmContact(_0x1907f7[_0x088d('0x32')],_0x137985,_0x1907f7[_0x088d('0x9b')],_0x422645));_0x38656c[_0x088d('0x19')]('DROP\x20TABLE\x20'+_0x137985+';');}BPromise['each'](_0x38656c,handleQuery)[_0x088d('0x16')](function(_0x519656){BPromise['all']([handleAdditionalPhones()])[_0x088d('0x16')](function(){_0x38656c=[];for(var _0x359a2e=0x0;_0x359a2e\x20\x20');}var _0x1a5d8f=path[_0x088d('0x12')](config['root'],'server/files/tmp',process[_0x088d('0xaf')][0x2]);if(!fs[_0x088d('0xb0')](_0x1a5d8f)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x160b50={};try{_0x160b50=JSON[_0x088d('0x82')](process['argv'][0x3]);if(!_0x160b50['binding']){throw new Error(_0x088d('0xb1'));}if(!_0x160b50[_0x088d('0x77')][_0x088d('0x2f')]){throw new Error(_0x088d('0xb2'));}if(!_0x160b50['binding']['firstName']){throw new Error(_0x088d('0xb3'));}var _0x472efa=0x0;if(_0x160b50[_0x088d('0x77')]['UserId']){_0x472efa=0x1;}if(!_0x160b50[_0x088d('0x32')]){throw new Error(_0x088d('0xb4'));}}catch(_0x2e237c){throw new Error(_0x088d('0xb5'));}var _0x2739fa=[];try{_0x2739fa=_[_0x088d('0xb6')](JSON['parse'](process[_0x088d('0xaf')][0x4]),'id');}catch(_0x1a402e){logger[_0x088d('0x61')](_0x088d('0xb7'));}main(_0x1a5d8f,_0x160b50,_0x2739fa,_0x472efa);}validate();process['on'](_0x088d('0xb8'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xbcda=['cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','code','message','info','sequelize','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','isNil','set','offset','dialTimezone','main','stringify','start','clone','root','server/files/tmp','keys','includes','header','ContactItemType','findAll','name','_description','writeFileSync','createReadStream','data','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','YYYY-MM-DD','firstName','trim','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','each',',\x20scheduledAt\x20=\x20NOW()','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','unlink','complete','argv','arguments\x20\x20\x20','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','then','length','all','AdditionalPhones','push','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','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','toString','cm_hopper_black','select','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];(function(_0x352ed9,_0x44aa56){var _0x16c275=function(_0x4895b3){while(--_0x4895b3){_0x352ed9['push'](_0x352ed9['shift']());}};_0x16c275(++_0x44aa56);}(_0xbcda,0x11f));var _0xabcd=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xbcda[_0x31cb5f];return _0x586042;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xabcd('0x0'));var Papa=require(_0xabcd('0x1'));var util=require(_0xabcd('0x2'));var BPromise=require(_0xabcd('0x3'));var moment=require(_0xabcd('0x4'));var squel=require(_0xabcd('0x5'));var Redis=require(_0xabcd('0x6'));var db=require(_0xabcd('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0xabcd('0x8'))(_0xabcd('0x9'));config[_0xabcd('0xa')]=_[_0xabcd('0xb')](config[_0xabcd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xabcd('0xc'))(new Redis(config[_0xabcd('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xabcd('0xd')](_0xabcd('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0xa78b64){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))*$/[_0xabcd('0xf')](_0xa78b64);}function selectNotIn(_0x54a0b4,_0xb46269,_0x4cf70d,_0x5d12f1,_0x376ca2){return squel['select']()[_0xabcd('0x10')](_0xabcd('0x11'))[_0xabcd('0x12')](_0x5d12f1)[_0xabcd('0x13')](_0xb46269,null,_0xb46269+_0xabcd('0x14')+_0x5d12f1+'.'+_0x4cf70d)[_0xabcd('0x15')](_0x5d12f1+'.'+_0x4cf70d+_0xabcd('0x16')+_0x54a0b4+'.'+_0x4cf70d)[_0xabcd('0x15')](_0xb46269+'.dialCheckDuplicateType\x20IN\x20('+_0x376ca2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x494bc8,_0x3ecf22){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xabcd('0x17')](function(_0x3581b8){if(_0x3581b8!==null){var _0x517c48=[];for(var _0x391f52=0x0;_0x391f52<_0x3581b8[_0xabcd('0x18')];_0x391f52++){var _0x47bfcb=_0x3581b8[_0x391f52];_0x517c48['push'](insertAdditionalPhones(_0x47bfcb));}}Promise[_0xabcd('0x19')](_0x517c48)['then'](function(){_0x494bc8({'val':0x1});});});});}function insertAdditionalPhones(_0x2e0721){return new Promise(function(_0x886a67,_0x83f869){var _0x13f13c=_0x2e0721[_0xabcd('0x1a')];var _0x29e64f=_0x13f13c['split'](';');var _0x20eb99=[];orderBy=0x0;for(var _0x1be838=0x0;_0x1be838<_0x29e64f['length'];_0x1be838++){_0x20eb99[_0xabcd('0x1b')](splitAdditionalPhone(_0x2e0721['id'],_0x29e64f[_0x1be838]));}Promise['all'](_0x20eb99)[_0xabcd('0x17')](function(){_0x886a67({'val':_0x29e64f[_0xabcd('0x18')]});});});}function splitAdditionalPhone(_0x135d92,_0x5e87d3){return new Promise(function(_0x33015d,_0x5569f8){var _0x3de173=_0x5e87d3[_0xabcd('0x1c')](':');var _0x215dd7=_0x3de173[0x0];var _0x193205=_0x3de173[0x1];if(!_['isNil'](_0x193205)){var _0x9ac90d=_0x193205[_0xabcd('0x1c')]('|');var _0x1c3568=[];for(var _0x17e256=0x0;_0x17e256<_0x9ac90d[_0xabcd('0x18')];_0x17e256++){if(_0x9ac90d[_0x17e256]!==''){var _0x14f546=_[_0xabcd('0x1d')](promisesAdditionalPhones,{'contactId':_0x135d92,'phone':_0x9ac90d[_0x17e256]});if(_0x14f546[_0xabcd('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xabcd('0x1b')]({'contactId':_0x135d92,'contactTypeId':_0x215dd7,'phone':_0x9ac90d[_0x17e256],'orderBy':orderBy});}}}_0x33015d({'ok':0x1});}else _0x33015d({'res':0x0});});}function createAdditionalPhone(_0x46ec64,_0x1a12f1,_0x21073c,_0x4fcf11){var _0xa732bf='';var _0x5a1aa1='';var _0x33adea=_0x21073c[_0xabcd('0x1c')]('§');_0xa732bf=_0x33adea[0x0];if(_0x33adea[_0xabcd('0x18')]==0x2)_0x5a1aa1=_0x33adea[0x1];return new Promise(function(_0x276f92,_0x104a8d){return db[_0xabcd('0x1e')][_0xabcd('0x1f')]({'where':{'CmContactId':_0x46ec64,'item':_0xa732bf}})[_0xabcd('0x17')](function(_0x2862ad){if(_0x2862ad){return db['CmContactHasItem'][_0xabcd('0x20')]({'ItemTypeId':_0x1a12f1,'description':_0x5a1aa1,'OrderBy':_0x4fcf11},{'where':{'CmContactId':_0x46ec64,'item':_0xa732bf}})[_0xabcd('0x17')](function(_0x115366){_0x276f92({'res':_0xabcd('0x21')});});}else{return db[_0xabcd('0x1e')][_0xabcd('0x22')]({'CmContactId':_0x46ec64,'item':_0xa732bf,'description':_0x5a1aa1,'ItemTypeId':_0x1a12f1,'OrderBy':_0x4fcf11,'ItemClass':_0xabcd('0x23')})[_0xabcd('0x17')](function(_0x180e94){_0x276f92({'res':_0xabcd('0x24')});});}});});}function insertCmHopper(_0x45f68b,_0xafb107,_0xb4813f,_0x1f87d3,_0x1b0554){var _0x5ad5f7=[_0xabcd('0x25'),_0xabcd('0x26'),_0xabcd('0x27'),_0xabcd('0x28'),_0xafb107+'.'+_0x1f87d3,_0xabcd('0x29'),_0xabcd('0x2a'),_0xabcd('0x2b'),'cm_contacts.UserId','\x22'+_0x1b0554+'\x22'];return squel[_0xabcd('0x2c')]()[_0xabcd('0x2d')]('cm_hopper')[_0xabcd('0x2e')]([_0xabcd('0x11'),_0xabcd('0x2f'),_0xabcd('0x30'),_0xabcd('0x31'),_0x1f87d3,_0xabcd('0x32'),_0xabcd('0x33'),_0xabcd('0x34'),_0xabcd('0x35'),'recallme'],squel['select']()[_0xabcd('0x36')](_0x5ad5f7)[_0xabcd('0x12')](_0xafb107)['join'](_0xabcd('0x37'),null,_0xabcd('0x38')+_0xafb107+_0xabcd('0x39'))['join'](_0xb4813f,null,_0xb4813f+_0xabcd('0x14')+_0xafb107+'.'+_0x1f87d3)[_0xabcd('0x15')](_0xafb107+_0xabcd('0x3a'),_0x45f68b)[_0xabcd('0x15')](_0xabcd('0x3b'),NOW)[_0xabcd('0x15')](_0xabcd('0x3c'),selectNotIn(_0xafb107,_0xb4813f,_0x1f87d3,_0xabcd('0x3d'),[_0xabcd('0x3e'),'\x22onlyIfOpen\x22']))[_0xabcd('0x15')](_0xabcd('0x3c'),selectNotIn(_0xafb107,_0xb4813f,_0x1f87d3,_0xabcd('0x3d'),[_0xabcd('0x3e')])))[_0xabcd('0x3f')]();}function insertCmHopperBlack(_0x69c604,_0xb6892,_0x2e5dac,_0x37523f){var _0x31cebc=[_0xabcd('0x25'),_0xabcd('0x27'),_0xabcd('0x28'),_0xb6892+'.'+_0x37523f,_0xabcd('0x29'),_0xabcd('0x2a')];return squel[_0xabcd('0x2c')]()['into'](_0xabcd('0x40'))['fromQuery']([_0xabcd('0x11'),_0xabcd('0x30'),_0xabcd('0x31'),_0x37523f,_0xabcd('0x32'),'updatedAt'],squel['select']()[_0xabcd('0x36')](_0x31cebc)['from'](_0xb6892)[_0xabcd('0x13')](_0xabcd('0x37'),null,_0xabcd('0x38')+_0xb6892+_0xabcd('0x39'))[_0xabcd('0x13')](_0x2e5dac,null,_0x2e5dac+_0xabcd('0x14')+_0xb6892+'.'+_0x37523f)[_0xabcd('0x15')](_0xb6892+_0xabcd('0x3a'),_0x69c604)['where'](_0xabcd('0x3b'),NOW)[_0xabcd('0x15')](_0xabcd('0x3c'),squel[_0xabcd('0x41')]()[_0xabcd('0x10')](_0xabcd('0x11'))[_0xabcd('0x12')](_0xabcd('0x40'))[_0xabcd('0x15')](_0xabcd('0x42'),_0x69c604)[_0xabcd('0x15')](_0x37523f+_0xabcd('0x16')+_0xb6892+'.'+_0x37523f)))[_0xabcd('0x3f')]();}function insertTzCmHopper(_0x2ab189,_0x42ebf5,_0x186a90,_0x329066,_0xd4f4af,_0x4f85c7){var _0x24a2cb=[_0xabcd('0x25'),_0xabcd('0x43')+_0x4f85c7+_0xabcd('0x44'),_0xabcd('0x27'),_0xabcd('0x28'),_0x42ebf5+'.'+_0x329066,_0xabcd('0x29'),_0xabcd('0x2a'),'cm_contacts.priority',_0xabcd('0x45'),'\x22'+_0xd4f4af+'\x22'];var _0x25709f=squel[_0xabcd('0x2c')]()['into']('cm_hopper')[_0xabcd('0x2e')](['phone',_0xabcd('0x2f'),'ContactId',_0xabcd('0x31'),_0x329066,'createdAt',_0xabcd('0x33'),'priority',_0xabcd('0x35'),'recallme'],squel[_0xabcd('0x41')]()[_0xabcd('0x36')](_0x24a2cb)[_0xabcd('0x12')](_0x42ebf5)[_0xabcd('0x13')](_0xabcd('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x42ebf5+_0xabcd('0x39'))[_0xabcd('0x13')](_0x186a90,null,_0x186a90+_0xabcd('0x14')+_0x42ebf5+'.'+_0x329066)[_0xabcd('0x13')](_0x4f85c7,null,_0x4f85c7+_0xabcd('0x14')+_0x42ebf5+'.'+_0x329066)[_0xabcd('0x15')](_0x42ebf5+_0xabcd('0x3a'),_0x2ab189)[_0xabcd('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xabcd('0x15')](_0xabcd('0x3c'),selectNotIn(_0x42ebf5,_0x186a90,_0x329066,_0xabcd('0x3d'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xabcd('0x15')](_0xabcd('0x3c'),selectNotIn(_0x42ebf5,_0x186a90,_0x329066,'cm_hopper',[_0xabcd('0x3e')])))[_0xabcd('0x3f')]();return _0x25709f;}function insertTzCmHopperBlack(_0xf1123f,_0x590f11,_0x21ecfd,_0x569cc4){var _0x20ca3c=[_0xabcd('0x25'),_0xabcd('0x27'),_0xabcd('0x28'),_0x590f11+'.'+_0x569cc4,_0xabcd('0x29'),'cm_contacts.updatedAt'];return squel[_0xabcd('0x2c')]()['into'](_0xabcd('0x40'))[_0xabcd('0x2e')]([_0xabcd('0x11'),'ContactId',_0xabcd('0x31'),_0x569cc4,_0xabcd('0x32'),_0xabcd('0x33')],squel['select']()[_0xabcd('0x36')](_0x20ca3c)[_0xabcd('0x12')](_0x590f11)[_0xabcd('0x13')](_0xabcd('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x590f11+_0xabcd('0x39'))[_0xabcd('0x13')](_0x21ecfd,null,_0x21ecfd+_0xabcd('0x14')+_0x590f11+'.'+_0x569cc4)[_0xabcd('0x15')](_0x590f11+'.CmListId\x20=\x20?',_0xf1123f)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xabcd('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xabcd('0x10')](_0xabcd('0x11'))[_0xabcd('0x12')](_0xabcd('0x40'))['where'](_0xabcd('0x42'),_0xf1123f)[_0xabcd('0x15')](_0x569cc4+_0xabcd('0x16')+_0x590f11+'.'+_0x569cc4)))['toString']();}function insertCmHopperAdditionalPhones(_0x52d010){var _0x4af0f9=[_0xabcd('0x46'),_0xabcd('0x47'),_0xabcd('0x48'),_0xabcd('0x49'),_0xabcd('0x4a')];return squel[_0xabcd('0x2c')]()['into'](_0xabcd('0x4b'))[_0xabcd('0x2e')](['CmHopperId','phone',_0xabcd('0x4c'),'createdAt','updatedAt'],squel[_0xabcd('0x41')]()['fields'](_0x4af0f9)[_0xabcd('0x12')](_0xabcd('0x3d'))[_0xabcd('0x13')](_0xabcd('0x37'),null,_0xabcd('0x4d'))[_0xabcd('0x13')](_0xabcd('0x4e'),null,_0xabcd('0x4f'))[_0xabcd('0x15')](_0xabcd('0x50'),_0x52d010)['where'](_0xabcd('0x3b'),NOW))[_0xabcd('0x3f')]();}function insertCmContact(_0x3c834b,_0x5a6ec8,_0x42c254,_0x2ff9d0){var _0x5d72c5=_['concat'](_['keys'](_0x2ff9d0),['ListId',_0xabcd('0x51'),'createdAt',_0xabcd('0x33'),'scheduledAt']);return squel['insert']()[_0xabcd('0x2d')]('cm_contacts')[_0xabcd('0x2e')](_0x5d72c5,squel[_0xabcd('0x41')]()[_0xabcd('0x36')](_0x5d72c5)[_0xabcd('0x12')](_0x5a6ec8)[_0xabcd('0x15')]('('+_0x42c254[_0xabcd('0x13')](',')+_0xabcd('0x52'),squel[_0xabcd('0x41')]()[_0xabcd('0x36')](_0x42c254)[_0xabcd('0x12')](_0xabcd('0x37'))[_0xabcd('0x15')](_0xabcd('0x42'),_0x3c834b)[_0xabcd('0x15')](_0xabcd('0x53')))[_0xabcd('0x15')](_0xabcd('0x54'),squel[_0xabcd('0x41')]()['field'](_0xabcd('0x55'),_0xabcd('0x56'))['from'](_0x5a6ec8)[_0xabcd('0x57')](_0x42c254['join'](','))))[_0xabcd('0x3f')]();}function handleStop(){logger['info'](_0xabcd('0x58'));stopped=!![];}function handleUncaughtException(_0xcf50df){logger['error'](_0xcf50df['message']);process[_0xabcd('0x59')](0x1);}function handleError(_0x45b3a4,_0x186f9f){stats[_0xabcd('0x5a')]['push']({'name':_0x186f9f[_0xabcd('0x5b')],'message':_0x186f9f[_0xabcd('0x5c')],'row':_0x45b3a4});}function handleQuery(_0x58a9ca){logger[_0xabcd('0x5d')](_0x58a9ca);return db[_0xabcd('0x5e')][_0xabcd('0x5f')](_0x58a9ca)[_0xabcd('0x60')](function(_0x159acf){results[_0xabcd('0x1b')](_0x159acf);})[_0xabcd('0x61')](function(_0x4eaeae){logger[_0xabcd('0x62')](_0x4eaeae[_0xabcd('0x5c')]);});}function updateTzCampaigns(_0x3377bc){return new Promise(function(_0x59e030,_0x190c61){var _0x9ee5b5=squel[_0xabcd('0x41')]()[_0xabcd('0x36')]([_0xabcd('0x63'),_0xabcd('0x64')])[_0xabcd('0x12')](_0xabcd('0x65'))['join']('campaigns_has_cm_lists',null,_0xabcd('0x66'))['where'](_0xabcd('0x67')+_0x3377bc);db[_0xabcd('0x5e')]['query'](_0x9ee5b5[_0xabcd('0x3f')]())[_0xabcd('0x60')](function(_0x6dddf9){var _0x51a565=[];for(var _0x289115=0x0;_0x289115<_0x6dddf9['length'];_0x289115++){_0x51a565[_0xabcd('0x1b')](getTimezoneData(_0x6dddf9[_0x289115],tmp_campaigns));}BPromise[_0xabcd('0x19')](_0x51a565)[_0xabcd('0x17')](function(){_0x59e030({'val':0x1});});})[_0xabcd('0x61')](function(_0x940b35){logger[_0xabcd('0x62')](_0x940b35[_0xabcd('0x5c')]);_0x59e030({'val':0x0});});});}function updateTzVoiceQueues(_0x503c1a){return new Promise(function(_0x528fe2,_0x226ae2){var _0x2fcda6=squel[_0xabcd('0x41')]()[_0xabcd('0x36')]([_0xabcd('0x68'),_0xabcd('0x69')])[_0xabcd('0x12')](_0xabcd('0x6a'))[_0xabcd('0x13')](_0xabcd('0x6b'),null,_0xabcd('0x6c'))[_0xabcd('0x15')](_0xabcd('0x6d')+_0x503c1a);db['sequelize'][_0xabcd('0x5f')](_0x2fcda6[_0xabcd('0x3f')]())[_0xabcd('0x60')](function(_0x2036be){var _0x297168=[];for(var _0x50c372=0x0;_0x50c372<_0x2036be[_0xabcd('0x18')];_0x50c372++){_0x297168[_0xabcd('0x1b')](getTimezoneData(_0x2036be[_0x50c372],tmp_voice_queues));}BPromise[_0xabcd('0x19')](_0x297168)[_0xabcd('0x17')](function(){_0x528fe2({'val':0x1});});})[_0xabcd('0x61')](function(_0x38c145){logger[_0xabcd('0x62')](_0x38c145['message']);_0x528fe2({'val':0x0});});});}function getTimezoneData(_0x37eaba,_0x3c5773){return new Promise(function(_0x1b9091,_0x1aa70f){var _0x2aa71d=shared[_0xabcd('0x6e')];var _0xa878a2=_0x2aa71d[_0x37eaba['dialTimezone']];if(_[_0xabcd('0x6f')](_0xa878a2)){_0x1b9091({'ret':0x1});}else{var _0x5b1862=_0xa878a2['utcOffset'];var _0x37a930=squel['insert']()[_0xabcd('0x2d')](_0x3c5773)[_0xabcd('0x70')]('id',_0x37eaba['id'])[_0xabcd('0x70')](_0xabcd('0x71'),_0x5b1862)[_0xabcd('0x70')](_0xabcd('0x72'),_0x37eaba[_0xabcd('0x72')])[_0xabcd('0x3f')]();return db[_0xabcd('0x5e')][_0xabcd('0x5f')](_0x37a930)['spread'](function(_0x22ae1e){_0x1b9091({'ret':0x1});})[_0xabcd('0x61')](function(_0xff7a58){logger[_0xabcd('0x62')](_0xff7a58['message']);_0x1aa70f({'ret':0x1});});}});}function handleTZQuery(_0x9cbaa7){logger['info'](_0x9cbaa7);return db[_0xabcd('0x5e')][_0xabcd('0x5f')](_0x9cbaa7)['spread'](function(_0x1ec000){})[_0xabcd('0x61')](function(_0x35a498){logger[_0xabcd('0x62')](_0x35a498[_0xabcd('0x5c')]);});}function main(_0x3ad515,_0x104603,_0x5ce0be,_0x332413){logger['info'](_0xabcd('0x73'),_0x3ad515,JSON[_0xabcd('0x74')](_0x104603));process['send'](_0xabcd('0x75'));var _0x6b359e=_0x104603['binding'];var _0x3f61ff=_[_0xabcd('0x76')](_0x6b359e);var _0x2b9af2=_0x104603['socket_timestamp'];var _0x25d9e4=path[_0xabcd('0x13')](config[_0xabcd('0x77')],_0xabcd('0x78'),_0x2b9af2+'.csv');hasTZ=_[_0xabcd('0x79')](_0x6b359e)[_0xabcd('0x7a')]('dialTimezone');var _0x374621=_[_0xabcd('0x79')](_0x6b359e)[_0xabcd('0x13')]();logger['info'](_0xabcd('0x7b'),_0x374621);db[_0xabcd('0x7c')][_0xabcd('0x7d')]({'raw':!![],'attributes':['id',_0xabcd('0x7e')]})[_0xabcd('0x17')](function(_0x5ee2ff){for(var _0x38c71e=0x0;_0x38c71e<_0x5ee2ff['length'];_0x38c71e++){if(_0x5ee2ff[_0x38c71e][_0xabcd('0x7e')]in _0x6b359e){contactItemTypes[_0xabcd('0x1b')](_0x5ee2ff[_0x38c71e]);delete _0x3f61ff[_0x5ee2ff[_0x38c71e]['name']];hasAdditionalPhones=!![];}for(var _0x488e94 in _0x6b359e){if(_0x5ee2ff[_0x38c71e]['name']+_0xabcd('0x7f')===_0x488e94){phoneDescriptions['push']({'itemTypeId':_0x5ee2ff[_0x38c71e]['id'],'description':_0x488e94});delete _0x3f61ff[_0x488e94];}}}if(hasAdditionalPhones)_0x3f61ff[_0xabcd('0x1a')]='';var _0x32fe49=_[_0xabcd('0x79')](_0x3f61ff)[_0xabcd('0x13')]();logger[_0xabcd('0x5d')](_0xabcd('0x7b'),_0x32fe49);fs[_0xabcd('0x80')](_0x25d9e4,_0x32fe49+'\x0a');Papa['parse'](fs[_0xabcd('0x81')](_0x3ad515),{'header':!![],'skipEmptyLines':!![],'step':function(_0x48e902,_0x8f7a64){try{for(var _0x565d06=0x0,_0x478abb=[];_0x565d06<_0x48e902[_0xabcd('0x82')][_0xabcd('0x18')];_0x565d06++){stats['rows']+=0x1;if(_0x48e902['errors'][_0x565d06]){handleError(_0x48e902['data'][_0x565d06],_0x48e902[_0xabcd('0x5a')][_0x565d06]);}else{var _0x1e25a8=[];var _0x148c3d=[];var _0x57ce2f={};for(var _0x5365f9 in _0x6b359e){let _0x11f65d=contactItemTypes['find'](_0x35dbc0=>_0x35dbc0[_0xabcd('0x7e')]===_0x5365f9);let _0x5964f5=contactItemTypes[_0xabcd('0x83')](_0x3880f5=>_0x3880f5[_0xabcd('0x7e')]+_0xabcd('0x7f')===_0x5365f9);if(_[_0xabcd('0x6f')](_0x11f65d)&&_[_0xabcd('0x6f')](_0x5964f5)){if(_0x6b359e[_0xabcd('0x84')](_0x5365f9)){if(_0x48e902['data'][_0x565d06][_0x6b359e[_0x5365f9]]){var _0x1680df=_['trim'](_0x48e902[_0xabcd('0x82')][_0x565d06][_0x6b359e[_0x5365f9]][_0xabcd('0x85')](/"/g,'\x27'));switch(_0x5365f9){case _0xabcd('0x2f'):var _0x4cf4b=moment(_0x1680df,_0xabcd('0xe'),!![]);if(_0x4cf4b[_0xabcd('0x86')]()){_0x478abb['push']('\x22'+_0x1680df+'\x22');}else{_0x1e25a8[_0xabcd('0x1b')](_0xabcd('0x87'));}break;case _0xabcd('0x34'):var _0x3e376c=parseInt(_0x1680df);_0x1680df=_[_0xabcd('0x88')](_0x3e376c)||_0x3e376c<0x0||_0x3e376c>0x4?_0x332413?0x3:0x2:_0x3e376c;_0x478abb[_0xabcd('0x1b')]('\x22'+_0x1680df+'\x22');break;case _0xabcd('0x35'):var _0x20e7e6=parseInt(_0x1680df);if(_[_0xabcd('0x89')](_0x20e7e6)&&_[_0xabcd('0x7a')](_0x5ce0be,_0x20e7e6)){_0x478abb[_0xabcd('0x1b')]('\x22'+_0x20e7e6+'\x22');}else{_0x1e25a8[_0xabcd('0x1b')]('agent\x20not\x20exists');}break;case _0xabcd('0x8a'):if(isEmail(_0x1680df)){_0x478abb['push']('\x22'+_0x1680df+'\x22');}else{_0x1e25a8[_0xabcd('0x1b')](_0xabcd('0x8b'));}break;case'dateOfBirth':var _0x3638d9=moment(_0x1680df,_0xabcd('0x8c'),!![]);if(_0x3638d9[_0xabcd('0x86')]()){_0x478abb[_0xabcd('0x1b')]('\x22'+_0x1680df+'\x22');}else{_0x1e25a8[_0xabcd('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xabcd('0x72'):var _0x192b6f=shared[_0xabcd('0x6e')];var _0x403856=_0x192b6f[_0x1680df];if(!_['isNil'](_0x403856)){var _0x2f686b=_0x403856['utcOffset'];_0x478abb[_0xabcd('0x1b')]('\x22'+_0x1680df+'\x22');_0x478abb['push']('\x22'+_0x2f686b+'\x22');}break;default:_0x478abb[_0xabcd('0x1b')]('\x22'+_0x1680df+'\x22');}}else{switch(_0x5365f9){case _0xabcd('0x8d'):case _0xabcd('0x11'):_0x1e25a8[_0xabcd('0x1b')](_0x5365f9+'\x20not\x20specified');break;default:_0x478abb['push']('\x22\x22');}}}}else{var _0x42e68d='';if(!_[_0xabcd('0x6f')](_0x11f65d)){if(!_0x57ce2f[_0xabcd('0x84')](_0x11f65d['id'])){if(!_['isNil'](_0x48e902[_0xabcd('0x82')][_0x565d06][_0x6b359e[_0x5365f9]])){var _0x1680df=_[_0xabcd('0x8e')](_0x48e902[_0xabcd('0x82')][_0x565d06][_0x6b359e[_0x5365f9]][_0xabcd('0x85')](/"/g,'\x27'));var _0xd7d820=phoneDescriptions[_0xabcd('0x83')](_0xb3b51=>_0xb3b51[_0xabcd('0x8f')]===_0x11f65d['id']);if(!_[_0xabcd('0x6f')](_0xd7d820)){var _0x5ce526=_[_0xabcd('0x8e')](_0x48e902[_0xabcd('0x82')][_0x565d06][_0x6b359e[_0xd7d820[_0xabcd('0x90')]]][_0xabcd('0x85')](/"/g,'\x27'));if(!_['isNil'](_0x5ce526))_0x1680df=_0x1680df+'§'+_0x5ce526;}if(_0x42e68d=='')_0x42e68d=_0x1680df;else _0x42e68d+='|'+_0x1680df;}_0x148c3d['push'](_0x11f65d['id']+':'+_0x42e68d);_0x57ce2f[_0x11f65d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x478abb[_0xabcd('0x1b')]('\x22'+_0x148c3d['join'](';')+'\x22');}if(_0x1e25a8[_0xabcd('0x18')]){handleError(_0x48e902['data'][_0x565d06],{'code':_0xabcd('0x91'),'message':_0x1e25a8[_0xabcd('0x13')]()});}else{fs[_0xabcd('0x92')](_0x25d9e4,_0x478abb['join']()+'\x0a');}_0x478abb=[];}if(!(stats[_0xabcd('0x93')]%0xc8)){socket[_0xabcd('0x94')](_0xabcd('0x95')+_0x2b9af2,stats);stats[_0xabcd('0x5a')]=[];}}if(stopped){logger['info'](_0xabcd('0x96'));_0x8f7a64['abort']();}}catch(_0x4ace1d){handleError(_0x48e902[_0xabcd('0x82')][_0x565d06],{'code':'SystemError','message':_0x4ace1d[_0xabcd('0x5c')]});logger[_0xabcd('0x62')](_0xabcd('0x97'),_0x4ace1d['message']);}},'complete':function(){try{var _0x268204=[];var _0xb08cbb=[];var _0x106d0b='cm_contacts';if(_0x104603[_0xabcd('0x98')]&&_0x104603[_0xabcd('0x98')][_0xabcd('0x18')]){_0x106d0b=_0xabcd('0x99')+_0x2b9af2;_0x268204[_0xabcd('0x1b')](_0xabcd('0x9a')+_0x106d0b+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xabcd('0x9b')+_0x2b9af2;tmp_voice_queues=_0xabcd('0x9c')+_0x2b9af2;_0xb08cbb[_0xabcd('0x1b')](_0xabcd('0x9a')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0xb08cbb['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xabcd('0x9d')](_0xb08cbb,handleTZQuery)['then'](function(_0x3b2437){updateTzCampaigns(_0x104603[_0xabcd('0x31')])[_0xabcd('0x17')](function(_0x39c37f){updateTzVoiceQueues(_0x104603[_0xabcd('0x31')])['then'](function(_0x111817){if(hasTZ)_0x32fe49=_0x32fe49[_0xabcd('0x85')](_0xabcd('0x72'),'dialTimezone,utcOffset');var _0x47aa51=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',_0x25d9e4,_0x106d0b,_0x32fe49,_0x104603['ListId'],_0x104603[_0xabcd('0x51')]||null,NOW,NOW);if(_[_0xabcd('0x6f')](_0x6b359e[_0xabcd('0x2f')])){_0x47aa51+=_0xabcd('0x9e');}_0x268204[_0xabcd('0x1b')](_0x47aa51);if(_0x104603[_0xabcd('0x98')]&&_0x104603[_0xabcd('0x98')]['length']){_0x268204['push'](insertCmContact(_0x104603[_0xabcd('0x31')],_0x106d0b,_0x104603[_0xabcd('0x98')],_0x6b359e));_0x268204['push']('DROP\x20TABLE\x20'+_0x106d0b+';');}BPromise['each'](_0x268204,handleQuery)[_0xabcd('0x17')](function(_0x4b0616){BPromise[_0xabcd('0x19')]([handleAdditionalPhones()])[_0xabcd('0x17')](function(){_0x268204=[];for(var _0x441f2d=0x0;_0x441f2d\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','No\x20agent\x20available','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYYMMDDHHmmss','field','phone','from','join','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','error','message','split','length','filter','CmContactHasItem','then','updated','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.scheduledat','cm_contacts.id'];(function(_0x3c5e8b,_0x17513d){var _0x1784b6=function(_0x31cb23){while(--_0x31cb23){_0x3c5e8b['push'](_0x3c5e8b['shift']());}};_0x1784b6(++_0x17513d);}(_0x7a40,0x197));var _0x07a4=function(_0x22e9a1,_0x1d3a53){_0x22e9a1=_0x22e9a1-0x0;var _0x5bff12=_0x7a40[_0x22e9a1];return _0x5bff12;};'use strict';var fs=require('fs');var path=require(_0x07a4('0x0'));var _=require(_0x07a4('0x1'));var Papa=require(_0x07a4('0x2'));var util=require('util');var BPromise=require(_0x07a4('0x3'));var moment=require(_0x07a4('0x4'));var squel=require(_0x07a4('0x5'));var Redis=require(_0x07a4('0x6'));var db=require(_0x07a4('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x07a4('0x8'))(_0x07a4('0x9'));config[_0x07a4('0xa')]=_[_0x07a4('0xb')](config[_0x07a4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x07a4('0xc'))(new Redis(config[_0x07a4('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x07a4('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x07a4('0xd')](_0x07a4('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x495e43){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x495e43);}function selectNotIn(_0x3ce657,_0x52e8ce,_0x44342a,_0x56b2e2,_0x77165b){return squel['select']()[_0x07a4('0xf')](_0x07a4('0x10'))[_0x07a4('0x11')](_0x56b2e2)[_0x07a4('0x12')](_0x52e8ce,null,_0x52e8ce+'.id\x20=\x20'+_0x56b2e2+'.'+_0x44342a)[_0x07a4('0x13')](_0x56b2e2+'.'+_0x44342a+_0x07a4('0x14')+_0x3ce657+'.'+_0x44342a)[_0x07a4('0x13')](_0x52e8ce+'.dialCheckDuplicateType\x20IN\x20('+_0x77165b[_0x07a4('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4c1893,_0x2af9c7){promisesAdditionalPhones=[];promisesContact=[];return db[_0x07a4('0x15')][_0x07a4('0x16')](_0x07a4('0x17')+tempTableName)[_0x07a4('0x18')](function(_0x97372b){if(_0x97372b!==null){var _0x2c5481=[];for(var _0x42443d=0x0;_0x42443d<_0x97372b['length'];_0x42443d++){var _0x3777ae=_0x97372b[_0x42443d];if(!_[_0x07a4('0x19')](_0x3777ae[_0x07a4('0x10')])){if(!_[_0x07a4('0x19')](_0x3777ae[_0x07a4('0x1a')]))_0x2c5481['push'](insertAdditionalPhones(_0x3777ae));promisesContact[_0x07a4('0x1b')]({'contact':_0x3777ae});}}}Promise['all'](_0x2c5481)['then'](function(){_0x4c1893({'val':0x1});});})['catch'](function(_0x417fda){logger[_0x07a4('0x1c')](_0x417fda[_0x07a4('0x1d')]);});});}function insertAdditionalPhones(_0x4d8450){return new Promise(function(_0x2dcb30,_0x464a98){var _0x1090e9=_0x4d8450[_0x07a4('0x1a')];if(_[_0x07a4('0x19')](_0x1090e9))_0x464a98({'val':0x0});else{var _0x162367=_0x1090e9[_0x07a4('0x1e')](';');var _0x38a411=[];orderBy=0x0;for(var _0xdea92f=0x0;_0xdea92f<_0x162367['length'];_0xdea92f++){_0x38a411[_0x07a4('0x1b')](splitAdditionalPhone(_0x4d8450['id'],_0x162367[_0xdea92f]));}Promise['all'](_0x38a411)['then'](function(){_0x2dcb30({'val':_0x162367[_0x07a4('0x1f')]});});}});}function splitAdditionalPhone(_0x36760b,_0x34b133){return new Promise(function(_0x4bb70f,_0x223dd2){var _0x1287ab=_0x34b133[_0x07a4('0x1e')](':');var _0x16a84a=_0x1287ab[0x0];var _0x517ae2=_0x1287ab[0x1];if(_0x517ae2!==''){var _0x364700=_0x517ae2['split']('|');var _0x955cee=[];for(var _0x2b2cb9=0x0;_0x2b2cb9<_0x364700[_0x07a4('0x1f')];_0x2b2cb9++){if(_0x364700[_0x2b2cb9]!==''){var _0x4a0b36=_[_0x07a4('0x20')](promisesAdditionalPhones,{'contactId':_0x36760b,'phone':_0x364700[_0x2b2cb9]});if(_0x4a0b36['length']==0x0){orderBy++;promisesAdditionalPhones[_0x07a4('0x1b')]({'contactId':_0x36760b,'contactTypeId':_0x16a84a,'phone':_0x364700[_0x2b2cb9],'orderBy':orderBy});}}}_0x4bb70f({'ok':0x1});}else _0x4bb70f({'res':0x0});});}function createAdditionalPhone(_0x52e6e2,_0x570232,_0x5593b9,_0x11e048){var _0x425802='';var _0x154676='';var _0x51e6ff=_0x5593b9[_0x07a4('0x1e')]('§');_0x425802=_0x51e6ff[0x0];if(_0x51e6ff['length']==0x2)_0x154676=_0x51e6ff[0x1];return new Promise(function(_0x30313b,_0x1dcdf7){return db[_0x07a4('0x21')]['findOne']({'where':{'CmContactId':_0x52e6e2,'item':_0x425802}})[_0x07a4('0x22')](function(_0x4d9308){if(_0x4d9308){return db['CmContactHasItem']['update']({'ItemTypeId':_0x570232,'description':_0x154676,'OrderBy':_0x11e048},{'where':{'CmContactId':_0x52e6e2,'item':_0x425802}})[_0x07a4('0x22')](function(_0x440b65){_0x30313b({'res':_0x07a4('0x23')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x52e6e2,'item':_0x425802,'ItemTypeId':_0x570232,'description':_0x154676,'OrderBy':_0x11e048,'ItemClass':_0x07a4('0x24')})[_0x07a4('0x22')](function(_0x455cc2){_0x30313b({'res':_0x07a4('0x25')});});}});});}function updateContact(_0xa42c7e){return new Promise(function(_0x4878e0,_0x40d338){var _0x546443=_0xa42c7e['id'];delete _0xa42c7e['id'];return db[_0x07a4('0x26')][_0x07a4('0x27')](_0xa42c7e,{'where':{'id':_0x546443}})[_0x07a4('0x22')](function(_0x3400bd){updatedRows+=0x1;return db[_0x07a4('0x28')][_0x07a4('0x27')]({'phone':_0xa42c7e['phone']},{'where':{'ContactId':_0x546443}})['then'](function(_0x4cd280){_0x4878e0({'ret':'OK'});});});});}function insertCmHopper(_0x1d15ea,_0x7f74ea,_0x47e3ce,_0x2b1f3c,_0x449836){var _0x338951=['cm_contacts.phone',_0x07a4('0x29'),_0x07a4('0x2a'),_0x07a4('0x2b'),_0x7f74ea+'.'+_0x2b1f3c,'cm_contacts.createdAt',_0x07a4('0x2c'),'cm_contacts.priority',_0x07a4('0x2d'),'\x22'+_0x449836+'\x22'];return squel[_0x07a4('0x2e')]()[_0x07a4('0x2f')](_0x07a4('0x30'))[_0x07a4('0x31')]([_0x07a4('0x10'),_0x07a4('0x32'),_0x07a4('0x33'),'ListId',_0x2b1f3c,_0x07a4('0x34'),'updatedAt',_0x07a4('0x35'),_0x07a4('0x36'),_0x07a4('0x37')],squel[_0x07a4('0x38')]()[_0x07a4('0x39')](_0x338951)[_0x07a4('0x11')](_0x7f74ea)['join']('cm_contacts',null,_0x07a4('0x3a')+_0x7f74ea+_0x07a4('0x3b'))['join'](_0x47e3ce,null,_0x47e3ce+_0x07a4('0x3c')+_0x7f74ea+'.'+_0x2b1f3c)[_0x07a4('0x13')](_0x7f74ea+_0x07a4('0x3d'),_0x1d15ea)['where'](_0x07a4('0x3e'),NOW)[_0x07a4('0x13')](_0x07a4('0x3f'),selectNotIn(_0x7f74ea,_0x47e3ce,_0x2b1f3c,_0x07a4('0x30'),[_0x07a4('0x40'),_0x07a4('0x41')]))[_0x07a4('0x13')](_0x07a4('0x3f'),selectNotIn(_0x7f74ea,_0x47e3ce,_0x2b1f3c,_0x07a4('0x30'),[_0x07a4('0x40')])))[_0x07a4('0x42')]();}function insertCmHopperBlack(_0xedc859,_0x213d38,_0x5def49,_0x109450){var _0x311f17=[_0x07a4('0x43'),'cm_contacts.id','cm_contacts.ListId',_0x213d38+'.'+_0x109450,_0x07a4('0x44'),_0x07a4('0x2c')];return squel[_0x07a4('0x2e')]()[_0x07a4('0x2f')](_0x07a4('0x45'))[_0x07a4('0x31')](['phone',_0x07a4('0x33'),_0x07a4('0x46'),_0x109450,'createdAt',_0x07a4('0x47')],squel['select']()[_0x07a4('0x39')](_0x311f17)[_0x07a4('0x11')](_0x213d38)[_0x07a4('0x12')](_0x07a4('0x48'),null,_0x07a4('0x3a')+_0x213d38+_0x07a4('0x3b'))['join'](_0x5def49,null,_0x5def49+_0x07a4('0x3c')+_0x213d38+'.'+_0x109450)[_0x07a4('0x13')](_0x213d38+'.CmListId\x20=\x20?',_0xedc859)[_0x07a4('0x13')](_0x07a4('0x3e'),NOW)[_0x07a4('0x13')](_0x07a4('0x3f'),squel['select']()[_0x07a4('0xf')](_0x07a4('0x10'))[_0x07a4('0x11')](_0x07a4('0x45'))[_0x07a4('0x13')](_0x07a4('0x49'),_0xedc859)[_0x07a4('0x13')](_0x109450+'\x20=\x20?',_0x213d38+'.'+_0x109450)))['toString']();}function insertCmHopperAdditionalPhones(_0x57c9ff){var _0x56c09a=[_0x07a4('0x4a'),'cm_contact_has_items.item',_0x07a4('0x4b'),'cm_contact_has_items.createdAt',_0x07a4('0x4c')];return squel[_0x07a4('0x2e')]()[_0x07a4('0x2f')](_0x07a4('0x4d'))[_0x07a4('0x31')]([_0x07a4('0x4e'),_0x07a4('0x10'),'OrderBy',_0x07a4('0x34'),_0x07a4('0x47')],squel['select']()[_0x07a4('0x39')](_0x56c09a)[_0x07a4('0x11')](_0x07a4('0x30'))[_0x07a4('0x12')](_0x07a4('0x48'),null,_0x07a4('0x4f'))[_0x07a4('0x12')]('cm_contact_has_items',null,_0x07a4('0x50'))['where'](_0x07a4('0x51'),_0x57c9ff)[_0x07a4('0x13')](_0x07a4('0x3e'),NOW))['toString']();}function insertCmContact(_0x20e06f,_0x13134b,_0x595a27,_0x191b9e){var _0xa1b8e3=_[_0x07a4('0x52')](_[_0x07a4('0x53')](_0x191b9e),['ListId','CompanyId',_0x07a4('0x34'),_0x07a4('0x47')]);return squel[_0x07a4('0x2e')]()[_0x07a4('0x2f')]('cm_contacts')[_0x07a4('0x31')](_0xa1b8e3,squel[_0x07a4('0x38')]()[_0x07a4('0x39')](_0xa1b8e3)[_0x07a4('0x11')](_0x13134b)[_0x07a4('0x13')]('('+_0x595a27[_0x07a4('0x12')](',')+_0x07a4('0x54'),squel['select']()[_0x07a4('0x39')](_0x595a27)[_0x07a4('0x11')](_0x07a4('0x48'))['where'](_0x07a4('0x49'),_0x20e06f))[_0x07a4('0x13')]('id\x20IN\x20?',squel[_0x07a4('0x38')]()['field'](_0x07a4('0x55'),'min_id')[_0x07a4('0x11')](_0x13134b)[_0x07a4('0x56')](_0x595a27[_0x07a4('0x12')](','))))[_0x07a4('0x42')]();}function handleStop(){logger[_0x07a4('0x57')](_0x07a4('0x58'));stopped=!![];}function handleUncaughtException(_0x20197d){logger[_0x07a4('0x1c')](_0x20197d[_0x07a4('0x1d')]);process[_0x07a4('0x59')](0x1);}function handleError(_0x30b10f,_0x5ab336){stats[_0x07a4('0x5a')][_0x07a4('0x1b')]({'name':_0x5ab336['code'],'message':_0x5ab336['message'],'row':_0x30b10f});}function handleQuery(_0x2d79dc){logger['info'](_0x2d79dc);return db['sequelize']['query'](_0x2d79dc)['spread'](function(_0x800cb7){results[_0x07a4('0x1b')](_0x800cb7);})[_0x07a4('0x5b')](function(_0x47df70){logger[_0x07a4('0x1c')](_0x47df70[_0x07a4('0x1d')]);});}function main(_0x55f3f6,_0x86c34f,_0x264836,_0x28b996){logger[_0x07a4('0x57')]('main',_0x55f3f6,JSON[_0x07a4('0x5c')](_0x86c34f));process[_0x07a4('0x5d')]('start');var _0x5a821d=_0x86c34f[_0x07a4('0x5e')];var _0x36253a=_[_0x07a4('0x5f')](_0x5a821d);var _0x9b2144=_0x86c34f[_0x07a4('0x60')];var _0x2608ad=path[_0x07a4('0x12')](config[_0x07a4('0x61')],_0x07a4('0x62'),_0x9b2144+_0x07a4('0x63'));logger[_0x07a4('0x57')](_0x07a4('0x64'),_0x86c34f);db['ContactItemType'][_0x07a4('0x65')]({'raw':!![],'attributes':['id',_0x07a4('0x66')]})['then'](function(_0x484b4b){for(var _0x291ee5=0x0;_0x291ee5<_0x484b4b['length'];_0x291ee5++){if(_0x484b4b[_0x291ee5]['name']in _0x5a821d){contactItemTypes['push'](_0x484b4b[_0x291ee5]);delete _0x36253a[_0x484b4b[_0x291ee5][_0x07a4('0x66')]];hasAdditionalPhones=!![];}for(var _0x23baf2 in _0x5a821d){if(_0x484b4b[_0x291ee5][_0x07a4('0x66')]+_0x07a4('0x67')===_0x23baf2){phoneDescriptions[_0x07a4('0x1b')]({'itemTypeId':_0x484b4b[_0x291ee5]['id'],'description':_0x23baf2});delete _0x36253a[_0x23baf2];}}}if(hasAdditionalPhones)_0x36253a[_0x07a4('0x1a')]='';var _0x4255dd=_[_0x07a4('0x53')](_0x36253a)[_0x07a4('0x12')]();logger[_0x07a4('0x57')](_0x07a4('0x68'),_0x4255dd);fs[_0x07a4('0x69')](_0x2608ad,_0x4255dd+'\x0a');Papa[_0x07a4('0x6a')](fs['createReadStream'](_0x55f3f6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x120662,_0x2003ec){try{for(var _0x4880fc=0x0,_0x4963e1=[];_0x4880fc<_0x120662[_0x07a4('0x6b')][_0x07a4('0x1f')];_0x4880fc++){stats[_0x07a4('0x6c')]+=0x1;if(_0x120662[_0x07a4('0x5a')][_0x4880fc]){handleError(_0x120662[_0x07a4('0x6b')][_0x4880fc],_0x120662[_0x07a4('0x5a')][_0x4880fc]);}else{var _0x2f4e8c=[];var _0x32fe4c=[];var _0x34fd8b={};for(var _0x1b0338 in _0x5a821d){let _0x5acb7d=contactItemTypes[_0x07a4('0x6d')](_0x942ce7=>_0x942ce7[_0x07a4('0x66')]===_0x1b0338);let _0x1f8e24=contactItemTypes[_0x07a4('0x6d')](_0x4437ec=>_0x4437ec[_0x07a4('0x66')]+'_description'===_0x1b0338);if(_['isNil'](_0x5acb7d)&&_[_0x07a4('0x19')](_0x1f8e24)){if(_0x5a821d[_0x07a4('0x6e')](_0x1b0338)){if(_0x120662[_0x07a4('0x6b')][_0x4880fc][_0x5a821d[_0x1b0338]]){var _0x3fdbaf=_['trim'](_0x120662[_0x07a4('0x6b')][_0x4880fc][_0x5a821d[_0x1b0338]][_0x07a4('0x6f')](/"/g,'\x27'));switch(_0x1b0338){case'scheduledat':var _0x5e8739=moment(_0x3fdbaf,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5e8739[_0x07a4('0x70')]()){_0x4963e1[_0x07a4('0x1b')]('\x22'+_0x3fdbaf+'\x22');}else{_0x2f4e8c[_0x07a4('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x07a4('0x35'):var _0x465c4a=parseInt(_0x3fdbaf);_0x3fdbaf=_[_0x07a4('0x71')](_0x465c4a)||_0x465c4a<0x0||_0x465c4a>0x4?_0x28b996?0x3:0x2:_0x465c4a;_0x4963e1[_0x07a4('0x1b')]('\x22'+_0x3fdbaf+'\x22');break;case _0x07a4('0x36'):var _0x191645=parseInt(_0x3fdbaf);if(_[_0x07a4('0x72')](_0x191645)&&_[_0x07a4('0x73')](_0x264836,_0x191645)){_0x4963e1['push']('\x22'+_0x191645+'\x22');}else{_0x2f4e8c[_0x07a4('0x1b')]('agent\x20not\x20exists');}break;case _0x07a4('0x74'):if(isEmail(_0x3fdbaf)){_0x4963e1[_0x07a4('0x1b')]('\x22'+_0x3fdbaf+'\x22');}else{_0x2f4e8c[_0x07a4('0x1b')](_0x07a4('0x75'));}break;case _0x07a4('0x76'):var _0x132b24=moment(_0x3fdbaf,'YYYY-MM-DD',!![]);if(_0x132b24[_0x07a4('0x70')]()){_0x4963e1['push']('\x22'+_0x3fdbaf+'\x22');}else{_0x2f4e8c[_0x07a4('0x1b')](_0x07a4('0x77'));}break;default:_0x4963e1[_0x07a4('0x1b')]('\x22'+_0x3fdbaf+'\x22');}}else{switch(_0x1b0338){case _0x07a4('0x78'):case _0x07a4('0x10'):_0x2f4e8c['push'](_0x1b0338+_0x07a4('0x79'));break;default:_0x4963e1[_0x07a4('0x1b')]('\x22\x22');}}}}else{var _0x344008='';if(!_['isNil'](_0x5acb7d)){if(!_0x34fd8b[_0x07a4('0x6e')](_0x5acb7d['id'])){for(var _0x278753=0x0;_0x278753<_0x5a821d[_0x1b0338][_0x07a4('0x1f')];_0x278753++){var _0x3fdbaf=_['trim'](_0x120662[_0x07a4('0x6b')][_0x4880fc][_0x5a821d[_0x1b0338][_0x278753]][_0x07a4('0x6f')](/"/g,'\x27'));var _0x1b17fc=phoneDescriptions[_0x07a4('0x6d')](_0x5c15f1=>_0x5c15f1[_0x07a4('0x7a')]===_0x5acb7d['id']);if(!_[_0x07a4('0x19')](_0x1b17fc)){var _0x53fce3=_[_0x07a4('0x7b')](_0x120662[_0x07a4('0x6b')][_0x4880fc][_0x5a821d[_0x1b17fc[_0x07a4('0x7c')]][0x0]][_0x07a4('0x6f')](/"/g,'\x27'));if(!_['isNil'](_0x53fce3))_0x3fdbaf=_0x3fdbaf+'§'+_0x53fce3;}if(_0x344008=='')_0x344008=_0x3fdbaf;else _0x344008+='|'+_0x3fdbaf;}_0x32fe4c['push'](_0x5acb7d['id']+':'+_0x344008);_0x34fd8b[_0x5acb7d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4963e1['push']('\x22'+_0x32fe4c[_0x07a4('0x12')](';')+'\x22');}if(_0x2f4e8c[_0x07a4('0x1f')]){handleError(_0x120662[_0x07a4('0x6b')][_0x4880fc],{'code':_0x07a4('0x7d'),'message':_0x2f4e8c[_0x07a4('0x12')]()});}else{fs['appendFileSync'](_0x2608ad,_0x4963e1[_0x07a4('0x12')]()+'\x0a');}_0x4963e1=[];}if(!(stats[_0x07a4('0x6c')]%0xc8)){socket[_0x07a4('0x7e')]('contact:import:'+_0x9b2144,stats);stats[_0x07a4('0x5a')]=[];}}if(stopped){logger[_0x07a4('0x57')](_0x07a4('0x7f'));_0x2003ec[_0x07a4('0x80')]();}}catch(_0x59046f){handleError(_0x120662['data'][_0x4880fc],{'code':_0x07a4('0x81'),'message':_0x59046f[_0x07a4('0x1d')]});logger[_0x07a4('0x1c')](_0x07a4('0x82'),_0x59046f[_0x07a4('0x1d')]);}},'complete':function(){try{var _0x364d59=[];var _0x4e5b62=tempTableName;_0x364d59[_0x07a4('0x1b')]('CREATE\x20TABLE\x20'+_0x4e5b62+'\x20LIKE\x20cm_contacts;');logger[_0x07a4('0x57')](_0x07a4('0x83'),contactItemTypes['length']);var _0xe67509=util[_0x07a4('0xd')](_0x07a4('0x84'),_0x2608ad,_0x4e5b62,_0x4255dd,_0x86c34f[_0x07a4('0x46')],_0x86c34f[_0x07a4('0x85')]||null,NOW,NOW);if(_['isNil'](_0x5a821d[_0x07a4('0x32')])){_0xe67509+=_0x07a4('0x86');}_0x364d59[_0x07a4('0x1b')](_0xe67509);BPromise[_0x07a4('0x87')](_0x364d59,handleQuery)[_0x07a4('0x22')](function(_0x4db711){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x364d59=[];for(var _0x140d7f=0x0;_0x140d7f_0xa559ad[_0xaef0('0x70')]===_0x5d0b8b);let _0x23341b=contactItemTypes[_0xaef0('0x78')](_0x384c84=>_0x384c84[_0xaef0('0x70')]+_0xaef0('0x71')===_0x5d0b8b);if(_[_0xaef0('0x1d')](_0x28b1a8)&&_[_0xaef0('0x1d')](_0x23341b)){if(_0x165d39[_0xaef0('0x79')](_0x5d0b8b)){if(_0x43219e[_0xaef0('0x76')][_0x571ffd][_0x165d39[_0x5d0b8b]]){var _0x58dfb3=_[_0xaef0('0x7a')](_0x43219e[_0xaef0('0x76')][_0x571ffd][_0x165d39[_0x5d0b8b]][_0xaef0('0x7b')](/"/g,'\x27'));switch(_0x5d0b8b){case _0xaef0('0x38'):var _0x3f426b=moment(_0x58dfb3,_0xaef0('0xf'),!![]);if(_0x3f426b[_0xaef0('0x7c')]()){_0x8492b1[_0xaef0('0x26')]('\x22'+_0x58dfb3+'\x22');}else{_0x1ce5f2[_0xaef0('0x26')](_0xaef0('0x7d'));}break;case _0xaef0('0x39'):var _0x18a8d6=parseInt(_0x58dfb3);_0x58dfb3=_[_0xaef0('0x7e')](_0x18a8d6)||_0x18a8d6<0x0||_0x18a8d6>0x4?_0x2dad6c?0x3:0x2:_0x18a8d6;_0x8492b1[_0xaef0('0x26')]('\x22'+_0x58dfb3+'\x22');break;case'UserId':var _0x429d15=parseInt(_0x58dfb3);if(_[_0xaef0('0x7f')](_0x429d15)&&_['includes'](_0xfddf,_0x429d15)){_0x8492b1['push']('\x22'+_0x429d15+'\x22');}else{_0x1ce5f2[_0xaef0('0x26')](_0xaef0('0x80'));}break;case _0xaef0('0x81'):if(isEmail(_0x58dfb3)){_0x8492b1['push']('\x22'+_0x58dfb3+'\x22');}else{_0x1ce5f2['push'](_0xaef0('0x82'));}break;case _0xaef0('0x83'):var _0x46a41d=moment(_0x58dfb3,'YYYY-MM-DD',!![]);if(_0x46a41d[_0xaef0('0x7c')]()){_0x8492b1[_0xaef0('0x26')]('\x22'+_0x58dfb3+'\x22');}else{_0x1ce5f2['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x8492b1[_0xaef0('0x26')]('\x22'+_0x58dfb3+'\x22');}}else{switch(_0x5d0b8b){case'firstName':case _0xaef0('0x30'):_0x1ce5f2[_0xaef0('0x26')](_0x5d0b8b+_0xaef0('0x84'));break;default:_0x8492b1[_0xaef0('0x26')]('\x22\x22');}}}}else{var _0x282598='';if(!_[_0xaef0('0x1d')](_0x28b1a8)){if(!_0x14599a['hasOwnProperty'](_0x28b1a8['id'])){for(var _0x44506f=0x0;_0x44506f<_0x165d39[_0x5d0b8b][_0xaef0('0x24')];_0x44506f++){var _0x58dfb3=_[_0xaef0('0x7a')](_0x43219e[_0xaef0('0x76')][_0x571ffd][_0x165d39[_0x5d0b8b][_0x44506f]][_0xaef0('0x7b')](/"/g,'\x27'));var _0x242eae=phoneDescriptions['find'](_0x3dcaea=>_0x3dcaea[_0xaef0('0x85')]===_0x28b1a8['id']);if(!_[_0xaef0('0x1d')](_0x242eae)){var _0x5e4cf1=_[_0xaef0('0x7a')](_0x43219e[_0xaef0('0x76')][_0x571ffd][_0x165d39[_0x242eae[_0xaef0('0x86')]][0x0]][_0xaef0('0x7b')](/"/g,'\x27'));if(!_[_0xaef0('0x1d')](_0x5e4cf1))_0x58dfb3=_0x58dfb3+'§'+_0x5e4cf1;}if(_0x282598=='')_0x282598=_0x58dfb3;else _0x282598+='|'+_0x58dfb3;}_0x314e4e[_0xaef0('0x26')](_0x28b1a8['id']+':'+_0x282598);_0x14599a[_0x28b1a8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x8492b1['push']('\x22'+_0x314e4e['join'](';')+'\x22');}if(_0x1ce5f2[_0xaef0('0x24')]){handleError(_0x43219e[_0xaef0('0x76')][_0x571ffd],{'code':_0xaef0('0x87'),'message':_0x1ce5f2[_0xaef0('0x14')]()});}else{fs[_0xaef0('0x88')](_0x495ad9,_0x8492b1[_0xaef0('0x14')]()+'\x0a');}_0x8492b1=[];}if(!(stats['rows']%0xc8)){socket[_0xaef0('0x89')](_0xaef0('0x8a')+_0x30cebc,stats);stats[_0xaef0('0x61')]=[];}}if(stopped){logger['info'](_0xaef0('0x8b'));_0x2d8b22['abort']();}}catch(_0x2afb9d){handleError(_0x43219e[_0xaef0('0x76')][_0x571ffd],{'code':_0xaef0('0x8c'),'message':_0x2afb9d['message']});logger[_0xaef0('0x22')](_0xaef0('0x8d'),_0x2afb9d[_0xaef0('0x5f')]);}},'complete':function(){try{var _0x25f19a=[];var _0x41f34c=tempTableName;_0x25f19a[_0xaef0('0x26')](_0xaef0('0x8e')+_0x41f34c+_0xaef0('0x8f'));logger[_0xaef0('0x5d')](_0xaef0('0x90'),contactItemTypes[_0xaef0('0x24')]);var _0x1b80b7=util['format'](_0xaef0('0x91'),_0x495ad9,_0x41f34c,_0x399795,_0x34a65c[_0xaef0('0x4b')],_0x34a65c[_0xaef0('0x58')]||null,NOW,NOW);if(_[_0xaef0('0x1d')](_0x165d39[_0xaef0('0x38')])){_0x1b80b7+=_0xaef0('0x92');}_0x25f19a[_0xaef0('0x26')](_0x1b80b7);BPromise[_0xaef0('0x93')](_0x25f19a,handleQuery)['then'](function(_0xfdaa0b){BPromise[_0xaef0('0x1f')]([handleAdditionalPhones()])[_0xaef0('0x20')](function(){_0x25f19a=[];for(var _0x34d777=0x0;_0x34d777\x20\x20');}var _0x5c423d=path[_0xaef0('0x14')](config[_0xaef0('0x6a')],_0xaef0('0x6b'),process['argv'][0x2]);if(!fs[_0xaef0('0x9b')](_0x5c423d)){throw new Error(_0xaef0('0x9c'));}var _0x4af657={};try{_0x4af657=JSON['parse'](process['argv'][0x3]);if(!_0x4af657['binding']){throw new Error(_0xaef0('0x9d'));}var _0x26de67=0x0;if(_0x4af657[_0xaef0('0x67')][_0xaef0('0x3a')]){_0x26de67=0x1;}if(!_0x4af657[_0xaef0('0x4b')]){throw new Error(_0xaef0('0x9e'));}}catch(_0x5ea070){throw new Error('body\x20id\x20mandatory');}var _0x44596c=[];try{_0x44596c=_[_0xaef0('0x9f')](JSON[_0xaef0('0x74')](process[_0xaef0('0x9a')][0x4]),'id');}catch(_0x320592){logger[_0xaef0('0x5d')](_0xaef0('0xa0'));}main(_0x5c423d,_0x4af657,_0x44596c,_0x26de67);}validate();process['on'](_0xaef0('0xa1'),handleStop);process['on'](_0xaef0('0xa2'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 1b553e8..562d42f 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 _0xd11c=['push','variable','calleridnum','Outbound\x20Call','getDescriptions','keyValue','calleridname','Call\x20To','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','outbound','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd11c,0x18f));var _0xcd11=function(_0x2eb1f9,_0x1b14fd){_0x2eb1f9=_0x2eb1f9-0x0;var _0x9d0ac=_0xd11c[_0x2eb1f9];return _0x9d0ac;};'use strict';exports[_0xcd11('0x0')]=function(_0x4b9e33,_0x2159b5){var _0x184b49=[{'type':_0xcd11('0x1'),'content':_0xcd11('0x2'),'variableName':null}];switch(_0x4b9e33[_0xcd11('0x3')]()){case _0xcd11('0x4'):switch(_0x2159b5['toLowerCase']()){case _0xcd11('0x5'):_0x184b49[_0xcd11('0x6')]({'type':_0xcd11('0x7'),'content':'','variableName':'queue'});_0x184b49[_0xcd11('0x6')]({'type':'variable','content':'','variableName':_0xcd11('0x8')});break;case'outbound':_0x184b49[_0xcd11('0x6')]({'type':'string','content':_0xcd11('0x9'),'variableName':null});_0x184b49['push']({'type':_0xcd11('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x184b49;};exports[_0xcd11('0xa')]=function(_0xb775a7,_0x1efa34){var _0x4f2cae=[];switch(_0xb775a7[_0xcd11('0x3')]()){case _0xcd11('0x4'):switch(_0x1efa34[_0xcd11('0x3')]()){case'inbound':_0x4f2cae=[{'type':_0xcd11('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xcd11('0xb'),'content':'','key':'Caller\x20Number','keyType':_0xcd11('0x7'),'variableName':_0xcd11('0x8')},{'type':_0xcd11('0xb'),'content':'','key':'Caller\x20Name','keyType':_0xcd11('0x7'),'variableName':_0xcd11('0xc')},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0xd'),'keyType':'variable','variableName':'destexten'},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0xe'),'keyType':_0xcd11('0x7'),'variableName':_0xcd11('0xf')},{'type':'keyValue','content':'','key':_0xcd11('0x10'),'keyType':_0xcd11('0x7'),'variableName':'uniqueid'},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x11'),'keyType':'variable','variableName':_0xcd11('0x12')},{'type':_0xcd11('0x1'),'content':_0xcd11('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x14'),'keyType':'variable','variableName':_0xcd11('0x15')},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x16'),'keyType':'variable','variableName':_0xcd11('0x17')},{'type':_0xcd11('0x1'),'content':_0xcd11('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xcd11('0x19'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x1a'),'keyType':_0xcd11('0x7'),'variableName':_0xcd11('0x1b')},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x1c'),'keyType':_0xcd11('0x7'),'variableName':_0xcd11('0x1d')},{'type':_0xcd11('0xb'),'content':'','key':'Hold\x20Time','keyType':_0xcd11('0x7'),'variableName':_0xcd11('0x1e')},{'type':'keyValue','content':'','key':_0xcd11('0x1f'),'keyType':'variable','variableName':_0xcd11('0x20')}];break;case _0xcd11('0x21'):_0x4f2cae=[{'type':'string','content':_0xcd11('0x22'),'variableName':null},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x23'),'keyType':_0xcd11('0x7'),'keyContent':'','variableName':_0xcd11('0x17')},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x24'),'keyType':_0xcd11('0x7'),'keyContent':'','variableName':_0xcd11('0x25')},{'type':_0xcd11('0xb'),'content':'','key':'UniqueId','keyType':_0xcd11('0x7'),'keyContent':'','variableName':_0xcd11('0x26')},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x11'),'keyType':_0xcd11('0x7'),'keyContent':'','variableName':_0xcd11('0x27')},{'type':_0xcd11('0x1'),'content':_0xcd11('0x18')},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x28'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0xcd11('0x7'),'keyContent':'','variableName':_0xcd11('0x29')},{'type':_0xcd11('0xb'),'content':'','key':'Duration','keyType':_0xcd11('0x7'),'keyContent':'','variableName':_0xcd11('0x2a')},{'type':_0xcd11('0xb'),'content':'','key':_0xcd11('0x2b'),'keyType':_0xcd11('0x7'),'keyContent':'','variableName':_0xcd11('0x2c')}];break;}}return _0x4f2cae;}; \ No newline at end of file +var _0xf5e0=['Hold\x20Time','holdtime','talktime','outbound','destcalleridnum','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','billableseconds','getSubjects','string','toLowerCase','push','variable','calleridnum','Outbound\x20Call','voice','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To','destexten','Queue','queue','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete'];(function(_0x955f00,_0x549b7d){var _0x282d5b=function(_0xdb54){while(--_0xdb54){_0x955f00['push'](_0x955f00['shift']());}};_0x282d5b(++_0x549b7d);}(_0xf5e0,0x10a));var _0x0f5e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf5e0[_0x21a9d9];return _0x46adce;};'use strict';exports[_0x0f5e('0x0')]=function(_0x2d7ccf,_0x1c0dd6){var _0x3458e1=[{'type':_0x0f5e('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x2d7ccf[_0x0f5e('0x2')]()){case'voice':switch(_0x1c0dd6[_0x0f5e('0x2')]()){case'inbound':_0x3458e1[_0x0f5e('0x3')]({'type':_0x0f5e('0x4'),'content':'','variableName':'queue'});_0x3458e1['push']({'type':'variable','content':'','variableName':_0x0f5e('0x5')});break;case'outbound':_0x3458e1['push']({'type':_0x0f5e('0x1'),'content':_0x0f5e('0x6'),'variableName':null});_0x3458e1['push']({'type':_0x0f5e('0x4'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3458e1;};exports['getDescriptions']=function(_0x2188f7,_0x52dc36){var _0x53f252=[];switch(_0x2188f7[_0x0f5e('0x2')]()){case _0x0f5e('0x7'):switch(_0x52dc36['toLowerCase']()){case _0x0f5e('0x8'):_0x53f252=[{'type':'string','content':_0x0f5e('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0xb'),'keyType':'variable','variableName':_0x0f5e('0x5')},{'type':_0x0f5e('0xa'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':'calleridname'},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0xc'),'keyType':'variable','variableName':_0x0f5e('0xd')},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0xe'),'keyType':'variable','variableName':_0x0f5e('0xf')},{'type':_0x0f5e('0xa'),'content':'','key':'UniqueId','keyType':_0x0f5e('0x4'),'variableName':_0x0f5e('0x10')},{'type':'keyValue','content':'','key':_0x0f5e('0x11'),'keyType':_0x0f5e('0x4'),'variableName':'agentcalledAt'},{'type':'string','content':_0x0f5e('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0x13'),'keyType':_0x0f5e('0x4'),'variableName':_0x0f5e('0x14')},{'type':'keyValue','content':'','key':_0x0f5e('0x15'),'keyType':_0x0f5e('0x4'),'variableName':'destcalleridnum'},{'type':'string','content':_0x0f5e('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0f5e('0x17'),'keyType':_0x0f5e('0x4'),'variableName':_0x0f5e('0x18')},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0x19'),'keyType':_0x0f5e('0x4'),'variableName':_0x0f5e('0x1a')},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0x1b'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x0f5e('0x1c'),'keyType':_0x0f5e('0x4'),'variableName':_0x0f5e('0x1d')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x0f5e('0x1e')}];break;case _0x0f5e('0x1f'):_0x53f252=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x0f5e('0xa'),'content':'','key':'Called\x20Number','keyType':_0x0f5e('0x4'),'keyContent':'','variableName':_0x0f5e('0x20')},{'type':_0x0f5e('0xa'),'content':'','key':'Member\x20Name','keyType':_0x0f5e('0x4'),'keyContent':'','variableName':_0x0f5e('0x21')},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0x22'),'keyType':'variable','keyContent':'','variableName':_0x0f5e('0x10')},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0x11'),'keyType':'variable','keyContent':'','variableName':_0x0f5e('0x23')},{'type':_0x0f5e('0x1'),'content':_0x0f5e('0x16')},{'type':'keyValue','content':'','key':_0x0f5e('0x24'),'keyType':_0x0f5e('0x4'),'keyContent':'','variableName':_0x0f5e('0x25')},{'type':_0x0f5e('0xa'),'content':'','key':_0x0f5e('0x26'),'keyType':'variable','keyContent':'','variableName':_0x0f5e('0x27')},{'type':'keyValue','content':'','key':_0x0f5e('0x28'),'keyType':_0x0f5e('0x4'),'keyContent':'','variableName':'duration'},{'type':_0x0f5e('0xa'),'content':'','key':'Billable\x20Time','keyType':_0x0f5e('0x4'),'keyContent':'','variableName':_0x0f5e('0x29')}];break;}}return _0x53f252;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 7c79051..31f5ee4 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 _0x56c6=['having','tags','checkAccountsRestrictions','group','ids','tag','count','length','clause','order','forEach','closed','getClosedOrderClause','DESC','getFilteredInteractions','rows','catch','tracked','clone','omit','fax','mobile','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseQueryParameters','where','body','contact','fields','filter','user'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x56c6,0xae));var _0x656c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56c6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x656c('0x0'));var sqlUtils=require(_0x656c('0x1'));var utils=require(_0x656c('0x2'));exports[_0x656c('0x3')]=function(_0x2e6a76,_0xec1a3f,_0x2f1704,_0xd73aeb,_0xc56352){var _0x50b55d={'count':0x0,'rows':[]};var _0x2b73ac=sqlUtils[_0x656c('0x4')](_0x2e6a76,_0x2f1704,_0xec1a3f);if(_0x2b73ac){return Promise[_0x656c('0x5')](_0x50b55d);}var _0x59df76=sqlUtils[_0x656c('0x6')](_0x2e6a76);var _0x429add={};return Promise[_0x656c('0x5')]()[_0x656c('0x7')](function(){if(_0xec1a3f[_0x656c('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0xec1a3f[_0x656c('0x8')],_0xc56352);}else{return sqlUtils[_0x656c('0x9')](_0x2e6a76,_0xec1a3f,_0xc56352);}})[_0x656c('0x7')](function(_0x2404f2){_0x59df76[_0x656c('0xa')](_0x2404f2[_0x656c('0xb')]);_0x59df76[_0x656c('0xa')](_0x2404f2[_0x656c('0xc')]);_0x59df76['where'](_0x2404f2['default']);_0x59df76['where'](_0x2404f2[_0x656c('0xd')]);_0x59df76[_0x656c('0xa')](_0x2404f2[_0x656c('0xe')]);_0x59df76[_0x656c('0xa')](_0x2404f2[_0x656c('0xf')]);_0x59df76[_0x656c('0x10')](_0x2404f2['read']);_0x429add=_0x2404f2[_0x656c('0x11')];return sqlUtils[_0x656c('0x12')](_0x2e6a76,_0x2f1704,_0xec1a3f);})[_0x656c('0x7')](function(_0x19e593){_0x59df76[_0x656c('0xa')](_0x19e593);_0x59df76[_0x656c('0x13')]('i.id');var _0xf2858a=_0xec1a3f[_0x656c('0x8')]?_0x429add[_0x656c('0x14')]:_0xec1a3f[_0x656c('0x15')];return sqlUtils['countFilteredInteractions'](_0x59df76,_0xf2858a);})[_0x656c('0x7')](function(_0x5ba899){_0x50b55d[_0x656c('0x16')]=_0x5ba899[_0x656c('0x17')];if(_0x50b55d[_0x656c('0x16')]===0x0){return[];}_0x59df76[_0x656c('0x10')](_0x429add[_0x656c('0x18')]);if(_0xd73aeb[_0x656c('0x19')]){_0xd73aeb[_0x656c('0x19')][_0x656c('0x1a')](function(_0x361aac){var _0x57613e=_0x361aac[0x0]==='contactName'?_0x361aac[0x0]:'i.'+_0x361aac[0x0];_0x59df76['order'](_0x57613e,_0x361aac[0x1]==='DESC'?![]:!![]);if(_0x361aac[0x0]===_0x656c('0x1b')){var _0x115cdd=sqlUtils[_0x656c('0x1c')](_0x2e6a76,_0xec1a3f);_0x59df76[_0x656c('0x19')](_0x115cdd,_0x361aac[0x1]===_0x656c('0x1d')?![]:!![]);}});}return sqlUtils[_0x656c('0x1e')](_0x2e6a76,_0x59df76,_0xec1a3f,_0xd73aeb);})[_0x656c('0x7')](function(_0x4b4365){_0x50b55d[_0x656c('0x1f')]=_0x4b4365;return _0x50b55d;})[_0x656c('0x20')](function(_0x4ebeeb){throw _0x4ebeeb;});};exports[_0x656c('0x21')]=function(_0x1a55a6,_0x55f29c){return function(_0x383c6d,_0x54692a,_0x1b14e3){var _0x1120eb=_0x383c6d[_0x656c('0xf')];var _0x8d3f90={};var _0x16cda8=_0x383c6d['query'];if(_0x8d3f90){_0x8d3f90=_[_0x656c('0x22')](_0x383c6d[_0x656c('0xb')]);_0x8d3f90=_[_0x656c('0x23')](_0x8d3f90,['body','html','phone',_0x656c('0x24'),_0x656c('0x25')]);}utils['updateUser'](_0x1120eb,_0x8d3f90,_0x16cda8,_0x1a55a6,_0x55f29c);_0x1b14e3(null);};}; \ No newline at end of file +var _0x330a=['search','parseAdvancedSearchFilter','where','contact','default','fields','filter','user','read','tags','group','ids','count','length','having','clause','forEach','contactName','order','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','query','clone','body','omit','fax','updateUser','lodash','./sql-utils','./utils','findAll','then'];(function(_0x4d63ac,_0x4c051b){var _0x287c4a=function(_0xe082cb){while(--_0xe082cb){_0x4d63ac['push'](_0x4d63ac['shift']());}};_0x287c4a(++_0x4c051b);}(_0x330a,0x1b7));var _0xa330=function(_0x2f8b0f,_0x2654eb){_0x2f8b0f=_0x2f8b0f-0x0;var _0x384196=_0x330a[_0x2f8b0f];return _0x384196;};'use strict';var _=require(_0xa330('0x0'));var sqlUtils=require(_0xa330('0x1'));var utils=require(_0xa330('0x2'));exports[_0xa330('0x3')]=function(_0xb0bf98,_0x43135d,_0x385095,_0x5b38b9,_0x435ece){var _0x5d84ea={'count':0x0,'rows':[]};var _0x56c698=sqlUtils['skipInteractionsQuery'](_0xb0bf98,_0x385095,_0x43135d);if(_0x56c698){return Promise['resolve'](_0x5d84ea);}var _0x182419=sqlUtils['getInteractionsQuery'](_0xb0bf98);var _0x4f3546={};return Promise['resolve']()[_0xa330('0x4')](function(){if(_0x43135d[_0xa330('0x5')]){return sqlUtils[_0xa330('0x6')](_0x43135d[_0xa330('0x5')],_0x435ece);}else{return sqlUtils['parseQueryParameters'](_0xb0bf98,_0x43135d,_0x435ece);}})[_0xa330('0x4')](function(_0x52d413){_0x182419[_0xa330('0x7')](_0x52d413['body']);_0x182419['where'](_0x52d413[_0xa330('0x8')]);_0x182419[_0xa330('0x7')](_0x52d413[_0xa330('0x9')]);_0x182419[_0xa330('0x7')](_0x52d413[_0xa330('0xa')]);_0x182419['where'](_0x52d413[_0xa330('0xb')]);_0x182419['where'](_0x52d413[_0xa330('0xc')]);_0x182419['having'](_0x52d413[_0xa330('0xd')]);_0x4f3546=_0x52d413[_0xa330('0xe')];return sqlUtils['checkAccountsRestrictions'](_0xb0bf98,_0x385095,_0x43135d);})['then'](function(_0x3bba46){_0x182419[_0xa330('0x7')](_0x3bba46);_0x182419[_0xa330('0xf')]('i.id');var _0xcd63e3=_0x43135d[_0xa330('0x5')]?_0x4f3546[_0xa330('0x10')]:_0x43135d['tag'];return sqlUtils['countFilteredInteractions'](_0x182419,_0xcd63e3);})[_0xa330('0x4')](function(_0x5fd8c4){_0x5d84ea[_0xa330('0x11')]=_0x5fd8c4[_0xa330('0x12')];if(_0x5d84ea[_0xa330('0x11')]===0x0){return[];}_0x182419[_0xa330('0x13')](_0x4f3546[_0xa330('0x14')]);if(_0x5b38b9['order']){_0x5b38b9['order'][_0xa330('0x15')](function(_0x4c58f9){var _0x1b8d7f=_0x4c58f9[0x0]===_0xa330('0x16')?_0x4c58f9[0x0]:'i.'+_0x4c58f9[0x0];_0x182419[_0xa330('0x17')](_0x1b8d7f,_0x4c58f9[0x1]===_0xa330('0x18')?![]:!![]);if(_0x4c58f9[0x0]===_0xa330('0x19')){var _0x2a720d=sqlUtils[_0xa330('0x1a')](_0xb0bf98,_0x43135d);_0x182419[_0xa330('0x17')](_0x2a720d,_0x4c58f9[0x1]===_0xa330('0x18')?![]:!![]);}});}return sqlUtils[_0xa330('0x1b')](_0xb0bf98,_0x182419,_0x43135d,_0x5b38b9);})['then'](function(_0x89dd36){_0x5d84ea[_0xa330('0x1c')]=_0x89dd36;return _0x5d84ea;})[_0xa330('0x1d')](function(_0x20adb2){throw _0x20adb2;});};exports[_0xa330('0x1e')]=function(_0x22f82a,_0x1d3cd3){return function(_0x2b8d68,_0x4454ad,_0x605f03){var _0x3601b4=_0x2b8d68[_0xa330('0xc')];var _0x1eac51={};var _0x3051aa=_0x2b8d68[_0xa330('0x1f')];if(_0x1eac51){_0x1eac51=_[_0xa330('0x20')](_0x2b8d68[_0xa330('0x21')]);_0x1eac51=_[_0xa330('0x22')](_0x1eac51,[_0xa330('0x21'),'html','phone',_0xa330('0x23'),'mobile']);}utils[_0xa330('0x24')](_0x3601b4,_0x1eac51,_0x3051aa,_0x22f82a,_0x1d3cd3);_0x605f03(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 8803fd6..03886f5 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb077=['Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','toString','Setting','findOne','enableEmailPreview','all','COUNT(*)','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','./utils','getAccountFK','agent','search','field','name','from','tools_tags','getInteractionFK','user_has_','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','openchannel','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','text','start','end','unreadMessages','value','read','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','plainBody','keys','some','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','resolve','then','fields','tag','filter','get','capitalize','Websites','Accounts','role','\x20IS\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','query','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb077,0x168));var _0x7b07=function(_0x115186,_0x3904e4){_0x115186=_0x115186-0x0;var _0x1356b0=_0xb077[_0x115186];return _0x1356b0;};'use strict';var _=require(_0x7b07('0x0'));var squel=require(_0x7b07('0x1'));var as=require(_0x7b07('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x7b07('0x3'))['updateInteraction'];var utils=require(_0x7b07('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x4de5ec,_0x1bd8a6,_0x3bfdfc){var _0x205b51=![];var _0x244332=utils[_0x7b07('0x5')](_0x4de5ec);if(_0x1bd8a6['role']===_0x7b07('0x6')&&!_0x3bfdfc[_0x7b07('0x7')]&&!_0x3bfdfc[_0x244332]){_0x205b51=!![];}return _0x205b51;}function getTagsQuery(){return squel['select']()[_0x7b07('0x8')]('id')[_0x7b07('0x8')](_0x7b07('0x9'))[_0x7b07('0x8')]('color')[_0x7b07('0xa')](_0x7b07('0xb'));}function getUsersQuery(_0x15bbf7,_0x137d52){var _0x3ee79b=utils[_0x7b07('0xc')](_0x15bbf7);var _0x311423=_0x7b07('0xd')+_0x15bbf7+'_interactions';var _0x1f0968=squel['select']()[_0x7b07('0x8')]('u.id')['field'](_0x7b07('0xe'))[_0x7b07('0x8')](_0x7b07('0xf')+_0x3ee79b)[_0x7b07('0xa')](_0x311423,'ui')[_0x7b07('0x10')](_0x7b07('0x11'),'u',_0x7b07('0x12'));if(_0x137d52[_0x7b07('0x13')]>0x0){_0x1f0968[_0x7b07('0x14')]('ui.'+_0x3ee79b+_0x7b07('0x15'),_[_0x7b07('0x16')](_0x137d52,'id'));}return _0x1f0968;}function getInteractionsQuery(_0x37ce23){var _0x56c08c=utils[_0x7b07('0x17')](_0x37ce23);var _0x3260f9=utils['getAccountFK'](_0x37ce23);var _0x2a6497=utils['getInteractionFK'](_0x37ce23);return squel[_0x7b07('0x18')]()[_0x7b07('0xa')](_0x56c08c['interactions'],'i')[_0x7b07('0x10')]('cm_contacts','c',_0x7b07('0x19'))[_0x7b07('0x10')](_0x7b07('0x11'),'o',_0x7b07('0x1a'))['left_join'](_0x56c08c[_0x7b07('0x1b')],'a','a.id\x20=\x20i.'+_0x3260f9)[_0x7b07('0x10')](_0x56c08c['messages'],'me',_0x7b07('0x1c')+_0x2a6497+_0x7b07('0x1d'))[_0x7b07('0x10')](_0x56c08c[_0x7b07('0x1e')],'it',_0x7b07('0x1f')+_0x2a6497+'\x20=\x20i.id')[_0x7b07('0x10')]('tools_tags','t',_0x7b07('0x20'));}function getSqlClauses(){var _0x1f2d8d={'body':squel[_0x7b07('0x21')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x7b07('0x21')](),'filter':squel[_0x7b07('0x21')](),'read':squel[_0x7b07('0x21')](),'tags':{'clause':squel[_0x7b07('0x21')](),'ids':null},'user':squel[_0x7b07('0x21')]()};return _0x1f2d8d;}function parseTagParameter(_0x35fe4a){var _0x41c296=squel[_0x7b07('0x21')]();if(_0x35fe4a){var _0xc0882c=utils[_0x7b07('0x22')](_0x35fe4a);_0xc0882c[_0x7b07('0x23')](function(_0x1b5f37){_0x41c296['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1b5f37+',%');});}return _0x41c296;}function parseReadParameter(_0x58aab8){var _0x56c295='';if(_0x58aab8){_0x56c295=_0x7b07('0x24');if(_0x58aab8==='1'){_0x56c295=_0x56c295[_0x7b07('0x25')](_0x7b07('0x26'),'=');}else{_0x56c295=_0x56c295[_0x7b07('0x25')](_0x7b07('0x26'),'>');}}return _0x56c295;}function parseSearchFilter(_0x1da047,_0x530e81){var _0xdbc552=squel[_0x7b07('0x21')]();if(_0x530e81){var _0x3ae4b2=_0x530e81[_0x7b07('0x25')]('\x5c','\x5c\x5c')[_0x7b07('0x25')](/'/g,'\x27\x27');if(qs[_0x7b07('0x27')](_0x3ae4b2)){_0xdbc552['or']('i.id\x20LIKE\x20?',_0x3ae4b2+'%');if([_0x7b07('0x28'),_0x7b07('0x29')][_0x7b07('0x2a')](_0x1da047)){_0xdbc552['or'](_0x7b07('0x2b'),_0x3ae4b2+'%');}else if(_0x1da047==='fax'){_0xdbc552['or']('i.fax\x20LIKE\x20?',_0x3ae4b2+'%');}else if(_0x1da047===_0x7b07('0x2c')){_0xdbc552['or']('i.from\x20LIKE\x20?',_0x3ae4b2+'%');}}else if(_0x1da047==='mail'&&qs['isEmail'](_0x3ae4b2)){_0xdbc552['or']('c.email\x20LIKE\x20?',_0x3ae4b2+'%');}else{if(_0x1da047===_0x7b07('0x2d')){_0xdbc552['or'](_0x7b07('0x2e'),qs[_0x7b07('0x2f')](_0x3ae4b2,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3ae4b2));}else if(_0x1da047!==_0x7b07('0x30')){_0xdbc552['or'](_0x7b07('0x31'),qs[_0x7b07('0x2f')](_0x3ae4b2));}_0xdbc552['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3ae4b2,!![]),null);}}return _0xdbc552;}function parseAdvancedSearchFilter(_0xc1e7ab,_0x527b17){var _0x108947=getSqlClauses();var _0x42d40a=as[_0x7b07('0x32')](_0xc1e7ab);var _0x260572=_0x42d40a[_0x7b07('0x33')];for(var _0x5b9eb5=0x0;_0x5b9eb5<_0x42d40a[_0x7b07('0x34')]['length'];_0x5b9eb5++){var _0x2951d4=_0x42d40a['conditions'][_0x5b9eb5];var _0xd5a514='i';var _0x19b2dd=_[_0x7b07('0x35')](_0x527b17,[_0x7b07('0x9'),_0x2951d4['field']]);if(_0x19b2dd){var _0x67f26e=as['buildExpression'](_0xd5a514,_0x19b2dd[_0x7b07('0x36')],_0x2951d4);_0x108947['default'][_0x260572](_0x67f26e[_0x7b07('0x37')],_0x67f26e['value'][_0x7b07('0x38')],_0x67f26e['value'][_0x7b07('0x39')]);}else{switch(_0x2951d4[_0x7b07('0x8')]){case _0x7b07('0x3a'):var _0x34d498=parseReadParameter(_0x2951d4[_0x7b07('0x3b')]);_0x108947[_0x7b07('0x3c')][_0x7b07('0x3d')](_0x34d498);break;case _0x7b07('0x3e'):if(_0x2951d4[_0x7b07('0x3f')]===_0x7b07('0x40')){if(_0x2951d4[_0x7b07('0x3b')][_0x7b07('0x41')]('\x20')['length']>0x1){_0x108947[_0x7b07('0x42')][_0x260572](_0x7b07('0x43'),qs[_0x7b07('0x2f')](_0x2951d4[_0x7b07('0x3b')],!![]),null);}else{var _0xa1390='%'+_0x2951d4[_0x7b07('0x3b')]+'%';_0x108947[_0x7b07('0x42')][_0x260572](_0x7b07('0x44'),_0xa1390,_0xa1390,_0xa1390);}}else{_0x19b2dd=_[_0x7b07('0x35')](_0x527b17,[_0x7b07('0x9'),_0x7b07('0x45')]);_0x2951d4[_0x7b07('0x8')]=_0x7b07('0x45');_0x67f26e=as['buildExpression'](_0xd5a514,_0x19b2dd[_0x7b07('0x36')],_0x2951d4);_0x108947[_0x7b07('0x42')][_0x260572](_0x67f26e[_0x7b07('0x37')],_0x67f26e[_0x7b07('0x3b')]['start'],_0x67f26e[_0x7b07('0x3b')][_0x7b07('0x39')]);}break;case _0x7b07('0x46'):var _0x3a716f=_0x2951d4['value']['split'](',')[_0x7b07('0x16')](function(_0x216779){return Number(_0x216779);});var _0x57a9bf=parseTagParameter(_0x3a716f);_0x108947[_0x7b07('0x47')]['clause'][_0x7b07('0x3d')](_0x57a9bf);_0x108947[_0x7b07('0x47')][_0x7b07('0x48')]=_0x3a716f;break;case _0x7b07('0x49'):if(_0x2951d4['operator']===_0x7b07('0x40')){_0x108947['user'][_0x260572](_0x7b07('0x4a'),'%'+_0x2951d4['value']+'%',null);}else{_0x19b2dd=_[_0x7b07('0x35')](_0x527b17,[_0x7b07('0x9'),_0x7b07('0x4b')]);_0x2951d4[_0x7b07('0x8')]=_0x7b07('0x4b');_0x67f26e=as[_0x7b07('0x4c')](_0xd5a514,_0x19b2dd[_0x7b07('0x36')],_0x2951d4);_0x108947['user'][_0x260572](_0x67f26e[_0x7b07('0x37')],_0x67f26e[_0x7b07('0x3b')][_0x7b07('0x38')],_0x67f26e[_0x7b07('0x3b')][_0x7b07('0x39')]);}break;case _0x7b07('0x4d'):case _0x7b07('0x4e'):_0x67f26e=as[_0x7b07('0x4c')]('me',null,_0x2951d4);_0x108947[_0x7b07('0x4d')][_0x260572](_0x67f26e[_0x7b07('0x37')],_0x67f26e[_0x7b07('0x3b')][_0x7b07('0x38')],_0x67f26e[_0x7b07('0x3b')]['end']);break;}}}return _0x108947;}function parseModelFields(_0x3bb308,_0x39cdf8,_0x3bf43f){var _0x7e4f81=utils['getAccountFK'](_0x3bb308);var _0x4bfec6=squel[_0x7b07('0x21')]();var _0x13ed0d=_(_0x39cdf8)[_0x7b07('0x4f')]()[_0x7b07('0x16')](function(_0x1352d5){return _[_0x7b07('0x50')](_0x3bf43f,[_0x7b07('0x9'),_0x1352d5])?_0x1352d5:undefined;})['compact']()['value']();if(_0x13ed0d[_0x7b07('0x13')]>0x0){_0x13ed0d['forEach'](function(_0x296841){if(_0x296841===_0x7e4f81){_0x4bfec6[_0x7b07('0x3d')]('i.'+_0x7e4f81+_0x7b07('0x15'),[]['concat'](_0x39cdf8[_0x296841]));}else if(_0x296841===_0x7b07('0x51')){var _0x57536b=JSON[_0x7b07('0x52')](_0x39cdf8[_0x296841])['$gte'];var _0x1d081c=JSON[_0x7b07('0x52')](_0x39cdf8[_0x296841])[_0x7b07('0x53')];_0x4bfec6['and'](_0x7b07('0x54'),_0x57536b,_0x1d081c);}else{if(_0x39cdf8[_0x296841]==='null'){_0x4bfec6['and']('i.'+_0x296841+'\x20IS\x20NULL');}else{_0x4bfec6['and']('i.'+_0x296841+'\x20=\x20?',_0x39cdf8[_0x296841]);}}});}return _0x4bfec6;}function parseQueryParameters(_0x120835,_0x331c46,_0x2806df){var _0x3ecde9=getSqlClauses();return Promise[_0x7b07('0x55')]()[_0x7b07('0x56')](function(){return parseModelFields(_0x120835,_0x331c46,_0x2806df);})[_0x7b07('0x56')](function(_0x2b1e31){_0x3ecde9[_0x7b07('0x57')]['and'](_0x2b1e31);return parseReadParameter(_0x331c46['read']);})[_0x7b07('0x56')](function(_0x3bd352){_0x3ecde9[_0x7b07('0x3c')][_0x7b07('0x3d')](_0x3bd352);return parseTagParameter(_0x331c46[_0x7b07('0x58')]);})[_0x7b07('0x56')](function(_0x3d1cd4){_0x3ecde9[_0x7b07('0x47')]['clause'][_0x7b07('0x3d')](_0x3d1cd4);return parseSearchFilter(_0x120835,_0x331c46[_0x7b07('0x59')]);})[_0x7b07('0x56')](function(_0xebe68e){_0x3ecde9[_0x7b07('0x59')]=_0xebe68e;return _0x3ecde9;});}function checkAccountsRestrictions(_0x3903e6,_0x5a8bd8,_0x5f1f0b){var _0x4c264c=utils['getAccountFK'](_0x3903e6);var _0x37f9d0=_0x7b07('0x5a')+_[_0x7b07('0x5b')](_0x3903e6)+(_0x3903e6==='chat'?_0x7b07('0x5c'):_0x7b07('0x5d'));var _0x5d5823=squel[_0x7b07('0x21')]();return Promise[_0x7b07('0x55')]()[_0x7b07('0x56')](function(){if(_0x5f1f0b['search']&&_0x5a8bd8[_0x7b07('0x5e')]===_0x7b07('0x6')){return _0x5a8bd8[_0x37f9d0]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x427d2d){if(_0x427d2d){if(_0x427d2d[_0x7b07('0x13')]===0x0){_0x5d5823[_0x7b07('0x3d')]('i.'+_0x4c264c+_0x7b07('0x5f'));}else{_0x5d5823[_0x7b07('0x3d')]('i.'+_0x4c264c+'\x20IN\x20?',_[_0x7b07('0x16')](_0x427d2d,'id'));}}else if(!_0x5f1f0b[_0x4c264c]){_0x5d5823['and']('i.'+_0x4c264c+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x5d5823;});}function getClosedOrderClause(_0x351b3b,_0x2edee5){var _0x53fc5e='';var _0x1c5ea6=[_0x7b07('0x60'),'i.secondDisposition',_0x7b07('0x61')];if(_0x351b3b==='mail'){_0x1c5ea6[_0x7b07('0x62')](_0x7b07('0x63'));}if(_0x2edee5[_0x7b07('0x64')]==='0'&&_0x351b3b===_0x7b07('0x2d')){_0x53fc5e='i.substatus';}else{if(_0x2edee5['closed']==='1'){_0x1c5ea6[_0x7b07('0x65')]();}_0x53fc5e=_0x7b07('0x66')+_0x1c5ea6[_0x7b07('0x67')](',\x20')+')';}return _0x53fc5e;}function getFilteredInteractions(_0x6d2d6b,_0x384832,_0x3b2f23,_0x5b308b){var _0x1ab785=utils[_0x7b07('0xc')](_0x6d2d6b);var _0x3ff54e=_['capitalize'](_0x6d2d6b)+_0x7b07('0x68');var _0xe381e4=[];var _0x37a076=getTagsQuery();var _0x109157={'type':db[_0x7b07('0x69')][_0x7b07('0x6a')][_0x7b07('0x6b')],'raw':!![]};var _0x12c670=[];var _0x24000a=[];return db['sequelize'][_0x7b07('0x6c')](_0x37a076['toString'](),_0x109157)['then'](function(_0x2eafc1){_0xe381e4=_['keyBy'](_0x2eafc1,'id');_0x109157=_[_0x7b07('0x6d')](_0x109157,{'model':db[_0x3ff54e],'mapToModel':!![],'nest':!![]});if(_0x3b2f23['fields']){_0x5b308b[_0x7b07('0x6e')][_0x7b07('0x23')](function(_0x4a441a){_0x384832[_0x7b07('0x8')]('i.'+_0x4a441a);});}else{_0x384832[_0x7b07('0x8')](_0x7b07('0x6f'),_0x7b07('0x3a'));_0x384832[_0x7b07('0x8')](_0x7b07('0x70'),_0x7b07('0x71'));_0x384832['field'](_0x7b07('0x72'),_0x7b07('0x73'));if(_0x6d2d6b===_0x7b07('0x2d')){_0x384832[_0x7b07('0x8')](_0x7b07('0x74'),_0x7b07('0x75'));_0x384832[_0x7b07('0x8')](_0x7b07('0x76'),_0x7b07('0x77'));_0x384832['field'](_0x7b07('0x78'));_0x384832['field'](_0x7b07('0x79'));_0x384832[_0x7b07('0x8')](_0x7b07('0x7a'));_0x384832['field'](_0x7b07('0x7b'));_0x384832[_0x7b07('0x8')]('i.closedAt');_0x384832[_0x7b07('0x8')](_0x7b07('0x7c'));_0x384832[_0x7b07('0x8')](_0x7b07('0x7d'));_0x384832[_0x7b07('0x8')](_0x7b07('0x7e'));_0x384832[_0x7b07('0x8')](_0x7b07('0x7f'));_0x384832[_0x7b07('0x8')](_0x7b07('0x61'));_0x384832['field'](_0x7b07('0x80'));_0x384832[_0x7b07('0x8')](_0x7b07('0x60'));_0x384832[_0x7b07('0x8')](_0x7b07('0x63'));_0x384832[_0x7b07('0x8')]('i.to');_0x384832[_0x7b07('0x8')](_0x7b07('0x81'));_0x384832['field'](_0x7b07('0x82'));_0x384832[_0x7b07('0x8')](_0x7b07('0x83'));}else if(_0x6d2d6b===_0x7b07('0x2c')){_0x384832[_0x7b07('0x8')]('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',_0x7b07('0x77'));}else{_0x384832[_0x7b07('0x8')](_0x7b07('0x84'),_0x7b07('0x77'));}if(_0x6d2d6b!==_0x7b07('0x2d')){_0x384832[_0x7b07('0x8')](_0x7b07('0x85'));}_0x384832['field'](_0x7b07('0x86'),_0x7b07('0x87'));_0x384832[_0x7b07('0x8')](_0x7b07('0x88'),'Contact.lastName');_0x384832[_0x7b07('0x8')]('c.email','Contact.email');_0x384832['field'](_0x7b07('0x89'),_0x7b07('0x8a'));_0x384832[_0x7b07('0x8')](_0x7b07('0x8b'),_0x7b07('0x8c'));_0x384832[_0x7b07('0x8')]('c.fax',_0x7b07('0x8d'));_0x384832[_0x7b07('0x8')](_0x7b07('0x8e'),_0x7b07('0x8f'));_0x384832[_0x7b07('0x8')](_0x7b07('0x90'),_0x7b07('0x91'));_0x384832[_0x7b07('0x8')](_0x7b07('0x92'),_0x7b07('0x93'));}if(_0x5b308b[_0x7b07('0x94')]){_0x384832[_0x7b07('0x94')](_0x5b308b[_0x7b07('0x94')]);}if(_0x5b308b[_0x7b07('0x95')]){_0x384832[_0x7b07('0x95')](_0x5b308b[_0x7b07('0x95')]);}return db[_0x7b07('0x96')][_0x7b07('0x6c')](_0x384832['toString'](),_0x109157);})[_0x7b07('0x56')](function(_0x3e7d9f){_0x12c670=_0x3e7d9f;var _0x27e644=getUsersQuery(_0x6d2d6b,_0x12c670);return db['sequelize'][_0x7b07('0x6c')](_0x27e644[_0x7b07('0x97')](),_0x109157);})['then'](function(_0x37e5c4){_0x24000a=_['groupBy'](_0x37e5c4,_0x1ab785);if(_0x6d2d6b===_0x7b07('0x2d')){return db[_0x7b07('0x98')][_0x7b07('0x99')]({'attributes':[_0x7b07('0x9a')],'raw':!![]});}})[_0x7b07('0x56')](function(_0x2c8d53){var _0x3022d4=_0x2c8d53?_0x2c8d53[_0x7b07('0x9a')]:undefined;var _0x34d57e=_0x12c670[_0x7b07('0x16')](function(_0x2b5e57){return updateInteraction(_0x2b5e57,_0xe381e4,_0x24000a,_0x3022d4);});return Promise[_0x7b07('0x9b')](_0x34d57e);});}function countFilteredInteractions(_0x1d4c8b,_0x35cc25){var _0x4dd9e0=_0x1d4c8b['clone']();_0x4dd9e0['field'](_0x7b07('0x9c'));_0x4dd9e0['field'](_0x7b07('0x6f'),_0x7b07('0x3a'));var _0x3ac60a=utils[_0x7b07('0x22')](_0x35cc25);if(!_['isEmpty'](_0x3ac60a)){_0x4dd9e0[_0x7b07('0x14')](_0x7b07('0x9d'),_0x3ac60a);}var _0x1237d0={'type':db[_0x7b07('0x69')]['QueryTypes'][_0x7b07('0x6b')],'raw':!![]};return db[_0x7b07('0x96')][_0x7b07('0x6c')](_0x4dd9e0['toString'](),_0x1237d0);}module[_0x7b07('0x9e')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xc658=['i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','type','default','text','value','unreadMessages','read','and','operator','$substring','contact','ContactId','start','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','body','end','some','compact','\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','filter','get','capitalize','chat','Websites','Accounts','role','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','findOne','enableEmailPreview','all','clone','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','search','select','field','name','color','from','_interactions','u.id','u.fullname','ui.','left_join','users','length','where','map','getInteractionsTables','getInteractionFK','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','messages','me.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric'];(function(_0x3d82d7,_0x3907bc){var _0x53f478=function(_0x426bae){while(--_0x426bae){_0x3d82d7['push'](_0x3d82d7['shift']());}};_0x53f478(++_0x3907bc);}(_0xc658,0x11f));var _0x8c65=function(_0x429f18,_0x2894bc){_0x429f18=_0x429f18-0x0;var _0x5dbe82=_0xc658[_0x429f18];return _0x5dbe82;};'use strict';var _=require(_0x8c65('0x0'));var squel=require('squel');var as=require(_0x8c65('0x1'));var qs=require(_0x8c65('0x2'));var updateInteraction=require('./update-interaction')[_0x8c65('0x3')];var utils=require(_0x8c65('0x4'));var db=require(_0x8c65('0x5'))['db'];function skipInteractionsQuery(_0x366441,_0x2b0240,_0x403942){var _0x1b6a75=![];var _0x534a32=utils[_0x8c65('0x6')](_0x366441);if(_0x2b0240['role']==='agent'&&!_0x403942[_0x8c65('0x7')]&&!_0x403942[_0x534a32]){_0x1b6a75=!![];}return _0x1b6a75;}function getTagsQuery(){return squel[_0x8c65('0x8')]()['field']('id')[_0x8c65('0x9')](_0x8c65('0xa'))['field'](_0x8c65('0xb'))[_0x8c65('0xc')]('tools_tags');}function getUsersQuery(_0x4c327d,_0x460cad){var _0x34fa94=utils['getInteractionFK'](_0x4c327d);var _0x45a57f='user_has_'+_0x4c327d+_0x8c65('0xd');var _0x30bacf=squel[_0x8c65('0x8')]()['field'](_0x8c65('0xe'))[_0x8c65('0x9')](_0x8c65('0xf'))[_0x8c65('0x9')](_0x8c65('0x10')+_0x34fa94)[_0x8c65('0xc')](_0x45a57f,'ui')[_0x8c65('0x11')](_0x8c65('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x460cad[_0x8c65('0x13')]>0x0){_0x30bacf[_0x8c65('0x14')]('ui.'+_0x34fa94+'\x20IN\x20?',_[_0x8c65('0x15')](_0x460cad,'id'));}return _0x30bacf;}function getInteractionsQuery(_0x1a7e5c){var _0x4c42ef=utils[_0x8c65('0x16')](_0x1a7e5c);var _0x33ebc9=utils['getAccountFK'](_0x1a7e5c);var _0x412658=utils[_0x8c65('0x17')](_0x1a7e5c);return squel[_0x8c65('0x8')]()[_0x8c65('0xc')](_0x4c42ef[_0x8c65('0x18')],'i')[_0x8c65('0x11')]('cm_contacts','c',_0x8c65('0x19'))[_0x8c65('0x11')](_0x8c65('0x12'),'o',_0x8c65('0x1a'))['left_join'](_0x4c42ef['accounts'],'a','a.id\x20=\x20i.'+_0x33ebc9)['left_join'](_0x4c42ef[_0x8c65('0x1b')],'me',_0x8c65('0x1c')+_0x412658+_0x8c65('0x1d'))[_0x8c65('0x11')](_0x4c42ef['interactionsTags'],'it',_0x8c65('0x1e')+_0x412658+_0x8c65('0x1d'))[_0x8c65('0x11')](_0x8c65('0x1f'),'t',_0x8c65('0x20'));}function getSqlClauses(){var _0x46bdfa={'body':squel['expr'](),'contact':squel[_0x8c65('0x21')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x8c65('0x21')](),'ids':null},'user':squel[_0x8c65('0x21')]()};return _0x46bdfa;}function parseTagParameter(_0x3d18d5){var _0x15fd36=squel[_0x8c65('0x21')]();if(_0x3d18d5){var _0x55d323=utils[_0x8c65('0x22')](_0x3d18d5);_0x55d323[_0x8c65('0x23')](function(_0x52532b){_0x15fd36['or'](_0x8c65('0x24'),'%,'+_0x52532b+',%');});}return _0x15fd36;}function parseReadParameter(_0x55540d){var _0x1e6680='';if(_0x55540d){_0x1e6680=_0x8c65('0x25');if(_0x55540d==='1'){_0x1e6680=_0x1e6680[_0x8c65('0x26')](_0x8c65('0x27'),'=');}else{_0x1e6680=_0x1e6680[_0x8c65('0x26')](_0x8c65('0x27'),'>');}}return _0x1e6680;}function parseSearchFilter(_0x4e039f,_0x5d04e8){var _0x3ed639=squel[_0x8c65('0x21')]();if(_0x5d04e8){var _0x1f30c2=_0x5d04e8[_0x8c65('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8c65('0x28')](_0x1f30c2)){_0x3ed639['or'](_0x8c65('0x29'),_0x1f30c2+'%');if([_0x8c65('0x2a'),_0x8c65('0x2b')][_0x8c65('0x2c')](_0x4e039f)){_0x3ed639['or']('i.phone\x20LIKE\x20?',_0x1f30c2+'%');}else if(_0x4e039f===_0x8c65('0x2d')){_0x3ed639['or']('i.fax\x20LIKE\x20?',_0x1f30c2+'%');}else if(_0x4e039f==='openchannel'){_0x3ed639['or'](_0x8c65('0x2e'),_0x1f30c2+'%');}}else if(_0x4e039f==='mail'&&qs['isEmail'](_0x1f30c2)){_0x3ed639['or'](_0x8c65('0x2f'),_0x1f30c2+'%');}else{if(_0x4e039f===_0x8c65('0x30')){_0x3ed639['or'](_0x8c65('0x31'),qs['getFullTextValue'](_0x1f30c2,!![]))['or'](_0x8c65('0x32'),qs[_0x8c65('0x33')](_0x1f30c2));}else if(_0x4e039f!==_0x8c65('0x2d')){_0x3ed639['or'](_0x8c65('0x34'),qs[_0x8c65('0x33')](_0x1f30c2));}_0x3ed639['or'](_0x8c65('0x35'),qs['getFullTextValue'](_0x1f30c2,!![]),null);}}return _0x3ed639;}function parseAdvancedSearchFilter(_0x5e9a56,_0x4ba042){var _0x156986=getSqlClauses();var _0x1a57f8=as['parseSearch'](_0x5e9a56);var _0x5dc66e=_0x1a57f8[_0x8c65('0x36')];for(var _0x355443=0x0;_0x355443<_0x1a57f8['conditions'][_0x8c65('0x13')];_0x355443++){var _0x209e33=_0x1a57f8[_0x8c65('0x37')][_0x355443];var _0xe6e9f5='i';var _0x344733=_[_0x8c65('0x38')](_0x4ba042,[_0x8c65('0xa'),_0x209e33[_0x8c65('0x9')]]);if(_0x344733){var _0x9c67e0=as[_0x8c65('0x39')](_0xe6e9f5,_0x344733[_0x8c65('0x3a')],_0x209e33);_0x156986[_0x8c65('0x3b')][_0x5dc66e](_0x9c67e0[_0x8c65('0x3c')],_0x9c67e0[_0x8c65('0x3d')]['start'],_0x9c67e0[_0x8c65('0x3d')]['end']);}else{switch(_0x209e33[_0x8c65('0x9')]){case _0x8c65('0x3e'):var _0x152be5=parseReadParameter(_0x209e33[_0x8c65('0x3d')]);_0x156986[_0x8c65('0x3f')][_0x8c65('0x40')](_0x152be5);break;case'Contact':if(_0x209e33[_0x8c65('0x41')]===_0x8c65('0x42')){if(_0x209e33[_0x8c65('0x3d')]['split']('\x20')[_0x8c65('0x13')]>0x1){_0x156986['contact'][_0x5dc66e](_0x8c65('0x35'),qs[_0x8c65('0x33')](_0x209e33[_0x8c65('0x3d')],!![]),null);}else{var _0x1ff6f5='%'+_0x209e33[_0x8c65('0x3d')]+'%';_0x156986[_0x8c65('0x43')][_0x5dc66e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1ff6f5,_0x1ff6f5,_0x1ff6f5);}}else{_0x344733=_[_0x8c65('0x38')](_0x4ba042,['name',_0x8c65('0x44')]);_0x209e33[_0x8c65('0x9')]=_0x8c65('0x44');_0x9c67e0=as['buildExpression'](_0xe6e9f5,_0x344733[_0x8c65('0x3a')],_0x209e33);_0x156986[_0x8c65('0x43')][_0x5dc66e](_0x9c67e0[_0x8c65('0x3c')],_0x9c67e0['value'][_0x8c65('0x45')],_0x9c67e0[_0x8c65('0x3d')]['end']);}break;case'Tag':var _0x35c7a3=_0x209e33['value']['split'](',')['map'](function(_0x1de512){return Number(_0x1de512);});var _0x26090d=parseTagParameter(_0x35c7a3);_0x156986[_0x8c65('0x46')][_0x8c65('0x47')][_0x8c65('0x40')](_0x26090d);_0x156986['tags']['ids']=_0x35c7a3;break;case _0x8c65('0x48'):if(_0x209e33['operator']===_0x8c65('0x42')){_0x156986[_0x8c65('0x49')][_0x5dc66e](_0x8c65('0x4a'),'%'+_0x209e33[_0x8c65('0x3d')]+'%',null);}else{_0x344733=_[_0x8c65('0x38')](_0x4ba042,[_0x8c65('0xa'),_0x8c65('0x4b')]);_0x209e33[_0x8c65('0x9')]='UserId';_0x9c67e0=as[_0x8c65('0x39')](_0xe6e9f5,_0x344733['type'],_0x209e33);_0x156986[_0x8c65('0x49')][_0x5dc66e](_0x9c67e0['text'],_0x9c67e0['value'][_0x8c65('0x45')],_0x9c67e0[_0x8c65('0x3d')]['end']);}break;case'body':case _0x8c65('0x4c'):_0x9c67e0=as[_0x8c65('0x39')]('me',null,_0x209e33);_0x156986[_0x8c65('0x4d')][_0x5dc66e](_0x9c67e0['text'],_0x9c67e0['value'][_0x8c65('0x45')],_0x9c67e0[_0x8c65('0x3d')][_0x8c65('0x4e')]);break;}}}return _0x156986;}function parseModelFields(_0x3e1467,_0x450e41,_0x21e908){var _0x138780=utils['getAccountFK'](_0x3e1467);var _0x16e397=squel[_0x8c65('0x21')]();var _0x44b00c=_(_0x450e41)['keys']()[_0x8c65('0x15')](function(_0x1b0503){return _[_0x8c65('0x4f')](_0x21e908,[_0x8c65('0xa'),_0x1b0503])?_0x1b0503:undefined;})[_0x8c65('0x50')]()[_0x8c65('0x3d')]();if(_0x44b00c[_0x8c65('0x13')]>0x0){_0x44b00c['forEach'](function(_0x2e59eb){if(_0x2e59eb===_0x138780){_0x16e397[_0x8c65('0x40')]('i.'+_0x138780+_0x8c65('0x51'),[]['concat'](_0x450e41[_0x2e59eb]));}else if(_0x2e59eb===_0x8c65('0x52')){var _0x5c1cb4=JSON[_0x8c65('0x53')](_0x450e41[_0x2e59eb])['$gte'];var _0x1939b3=JSON[_0x8c65('0x53')](_0x450e41[_0x2e59eb])[_0x8c65('0x54')];_0x16e397['and'](_0x8c65('0x55'),_0x5c1cb4,_0x1939b3);}else{if(_0x450e41[_0x2e59eb]===_0x8c65('0x56')){_0x16e397[_0x8c65('0x40')]('i.'+_0x2e59eb+_0x8c65('0x57'));}else{_0x16e397[_0x8c65('0x40')]('i.'+_0x2e59eb+_0x8c65('0x58'),_0x450e41[_0x2e59eb]);}}});}return _0x16e397;}function parseQueryParameters(_0x2d5a5c,_0x53a6ce,_0x3912ee){var _0x1bd799=getSqlClauses();return Promise[_0x8c65('0x59')]()['then'](function(){return parseModelFields(_0x2d5a5c,_0x53a6ce,_0x3912ee);})[_0x8c65('0x5a')](function(_0x4c00b6){_0x1bd799[_0x8c65('0x5b')][_0x8c65('0x40')](_0x4c00b6);return parseReadParameter(_0x53a6ce[_0x8c65('0x3f')]);})[_0x8c65('0x5a')](function(_0x4cd805){_0x1bd799[_0x8c65('0x3f')][_0x8c65('0x40')](_0x4cd805);return parseTagParameter(_0x53a6ce['tag']);})[_0x8c65('0x5a')](function(_0xfe71e){_0x1bd799[_0x8c65('0x46')][_0x8c65('0x47')][_0x8c65('0x40')](_0xfe71e);return parseSearchFilter(_0x2d5a5c,_0x53a6ce['filter']);})[_0x8c65('0x5a')](function(_0x5e14de){_0x1bd799[_0x8c65('0x5c')]=_0x5e14de;return _0x1bd799;});}function checkAccountsRestrictions(_0x42ef03,_0x2bd60b,_0x3fe3e7){var _0x30a957=utils[_0x8c65('0x6')](_0x42ef03);var _0x81a1e4=_0x8c65('0x5d')+_[_0x8c65('0x5e')](_0x42ef03)+(_0x42ef03===_0x8c65('0x5f')?_0x8c65('0x60'):_0x8c65('0x61'));var _0x4fc678=squel[_0x8c65('0x21')]();return Promise[_0x8c65('0x59')]()[_0x8c65('0x5a')](function(){if(_0x3fe3e7[_0x8c65('0x7')]&&_0x2bd60b[_0x8c65('0x62')]===_0x8c65('0x63')){return _0x2bd60b[_0x81a1e4]({'attributes':['id'],'raw':!![]});}})[_0x8c65('0x5a')](function(_0x11b60a){if(_0x11b60a){if(_0x11b60a[_0x8c65('0x13')]===0x0){_0x4fc678[_0x8c65('0x40')]('i.'+_0x30a957+'\x20IS\x20NULL');}else{_0x4fc678[_0x8c65('0x40')]('i.'+_0x30a957+_0x8c65('0x51'),_[_0x8c65('0x15')](_0x11b60a,'id'));}}else if(!_0x3fe3e7[_0x30a957]){_0x4fc678[_0x8c65('0x40')]('i.'+_0x30a957+_0x8c65('0x64'));}})[_0x8c65('0x5a')](function(){return _0x4fc678;});}function getClosedOrderClause(_0x43f04b,_0x4f995b){var _0x11e6f9='';var _0x5e8d28=[_0x8c65('0x65'),_0x8c65('0x66'),_0x8c65('0x67')];if(_0x43f04b===_0x8c65('0x30')){_0x5e8d28['unshift']('i.substatus');}if(_0x4f995b[_0x8c65('0x68')]==='0'&&_0x43f04b===_0x8c65('0x30')){_0x11e6f9=_0x8c65('0x69');}else{if(_0x4f995b['closed']==='1'){_0x5e8d28[_0x8c65('0x6a')]();}_0x11e6f9=_0x8c65('0x6b')+_0x5e8d28[_0x8c65('0x6c')](',\x20')+')';}return _0x11e6f9;}function getFilteredInteractions(_0x3c330f,_0x359fdb,_0x2dbe18,_0x1d8fd2){var _0x5b543d=utils[_0x8c65('0x17')](_0x3c330f);var _0x13fd2f=_[_0x8c65('0x5e')](_0x3c330f)+_0x8c65('0x6d');var _0x3da671=[];var _0x113348=getTagsQuery();var _0x4c538d={'type':db[_0x8c65('0x6e')][_0x8c65('0x6f')][_0x8c65('0x70')],'raw':!![]};var _0x2a2a22=[];var _0xd138e3=[];return db['sequelize'][_0x8c65('0x71')](_0x113348[_0x8c65('0x72')](),_0x4c538d)[_0x8c65('0x5a')](function(_0x4cd4de){_0x3da671=_[_0x8c65('0x73')](_0x4cd4de,'id');_0x4c538d=_[_0x8c65('0x74')](_0x4c538d,{'model':db[_0x13fd2f],'mapToModel':!![],'nest':!![]});if(_0x2dbe18[_0x8c65('0x5b')]){_0x1d8fd2[_0x8c65('0x75')]['forEach'](function(_0x454fbb){_0x359fdb[_0x8c65('0x9')]('i.'+_0x454fbb);});}else{_0x359fdb[_0x8c65('0x9')](_0x8c65('0x76'),_0x8c65('0x3e'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x77'),_0x8c65('0x78'));_0x359fdb[_0x8c65('0x9')]('a.mandatoryDisposition',_0x8c65('0x79'));if(_0x3c330f===_0x8c65('0x30')){_0x359fdb[_0x8c65('0x9')](_0x8c65('0x7a'),'Account.email');_0x359fdb['field'](_0x8c65('0x7b'),_0x8c65('0x7c'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x7d'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x7e'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x7f'));_0x359fdb['field'](_0x8c65('0x80'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x81'));_0x359fdb[_0x8c65('0x9')]('i.attach');_0x359fdb[_0x8c65('0x9')](_0x8c65('0x82'));_0x359fdb['field']('i.lastMsgDirection');_0x359fdb[_0x8c65('0x9')](_0x8c65('0x83'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x67'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x66'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x65'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x69'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x84'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x85'));_0x359fdb['field'](_0x8c65('0x86'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x87'));}else if(_0x3c330f===_0x8c65('0x88')){_0x359fdb[_0x8c65('0x9')](_0x8c65('0x89'),'contactName');}else{_0x359fdb[_0x8c65('0x9')](_0x8c65('0x8a'),_0x8c65('0x7c'));}if(_0x3c330f!==_0x8c65('0x30')){_0x359fdb[_0x8c65('0x9')]('i.*');}_0x359fdb[_0x8c65('0x9')](_0x8c65('0x8b'),_0x8c65('0x8c'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x8d'),_0x8c65('0x8e'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x8f'),_0x8c65('0x90'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x91'),_0x8c65('0x92'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x93'),'Contact.mobile');_0x359fdb[_0x8c65('0x9')](_0x8c65('0x94'),_0x8c65('0x95'));_0x359fdb['field']('o.fullname',_0x8c65('0x96'));_0x359fdb[_0x8c65('0x9')](_0x8c65('0x97'),'Owner.internal');_0x359fdb[_0x8c65('0x9')](_0x8c65('0x98'),_0x8c65('0x99'));}if(_0x1d8fd2['limit']){_0x359fdb[_0x8c65('0x9a')](_0x1d8fd2[_0x8c65('0x9a')]);}if(_0x1d8fd2[_0x8c65('0x9b')]){_0x359fdb[_0x8c65('0x9b')](_0x1d8fd2['offset']);}return db[_0x8c65('0x9c')][_0x8c65('0x71')](_0x359fdb[_0x8c65('0x72')](),_0x4c538d);})[_0x8c65('0x5a')](function(_0x5bfe0a){_0x2a2a22=_0x5bfe0a;var _0x17fa04=getUsersQuery(_0x3c330f,_0x2a2a22);return db[_0x8c65('0x9c')][_0x8c65('0x71')](_0x17fa04[_0x8c65('0x72')](),_0x4c538d);})[_0x8c65('0x5a')](function(_0x24b29a){_0xd138e3=_[_0x8c65('0x9d')](_0x24b29a,_0x5b543d);if(_0x3c330f===_0x8c65('0x30')){return db['Setting'][_0x8c65('0x9e')]({'attributes':[_0x8c65('0x9f')],'raw':!![]});}})[_0x8c65('0x5a')](function(_0x517c62){var _0x1287b7=_0x517c62?_0x517c62[_0x8c65('0x9f')]:undefined;var _0xe621ef=_0x2a2a22[_0x8c65('0x15')](function(_0x103f8b){return updateInteraction(_0x103f8b,_0x3da671,_0xd138e3,_0x1287b7);});return Promise[_0x8c65('0xa0')](_0xe621ef);});}function countFilteredInteractions(_0x21e79b,_0xe61b1f){var _0x2025bd=_0x21e79b[_0x8c65('0xa1')]();_0x2025bd['field']('COUNT(*)');_0x2025bd[_0x8c65('0x9')](_0x8c65('0x76'),_0x8c65('0x3e'));var _0xc48ac7=utils['getSelectedTags'](_0xe61b1f);if(!_['isEmpty'](_0xc48ac7)){_0x2025bd[_0x8c65('0x14')](_0x8c65('0xa2'),_0xc48ac7);}var _0x401aec={'type':db[_0x8c65('0x6e')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x8c65('0x9c')]['query'](_0x2025bd[_0x8c65('0x72')](),_0x401aec);}module[_0x8c65('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 5a569b9..d885fe1 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9702=['abandoned','total','closed','UserId','disposition','findOne','out','plainBody','-id','trimStart','catch','updateInteraction','Users','TagIds','then','Tags','lodash','../../mysqldb','fullname','split','push','waiting','talking','answered'];(function(_0x4fd9b9,_0x4baad2){var _0x41907a=function(_0x9d862a){while(--_0x9d862a){_0x4fd9b9['push'](_0x4fd9b9['shift']());}};_0x41907a(++_0x4baad2);}(_0x9702,0x190));var _0x2970=function(_0x13d8fa,_0x72014e){_0x13d8fa=_0x13d8fa-0x0;var _0x31a366=_0x9702[_0x13d8fa];return _0x31a366;};'use strict';var _=require(_0x2970('0x0'));var db=require(_0x2970('0x1'))['db'];function getInteractionUsers(_0xe9ae95,_0x1141ea){return new Promise(function(_0x1ffdd8,_0x5ac0de){try{var _0x4392b1=[];if(_0x1141ea[_0xe9ae95]){_0x4392b1=_0x1141ea[_0xe9ae95]['map'](function(_0x2d827f){return{'id':_0x2d827f['id'],'fullname':_0x2d827f[_0x2970('0x2')]};});}return _0x1ffdd8(_0x4392b1);}catch(_0x21f95a){_0x5ac0de(_0x21f95a);}});}function getInteractionTags(_0xf728e0,_0x31fc65){var _0x5472d5=[];if(_0xf728e0){_0xf728e0[_0x2970('0x3')](',')['forEach'](function(_0x40fc94){_0x5472d5[_0x2970('0x4')](_0x31fc65[_0x40fc94]);});}return _0x5472d5;}function updateWaitingCounter(_0x5d3393){if(_0x5d3393[_0x2970('0x5')]){_0x5d3393[_0x2970('0x5')]-=0x1;}}function updateInteractionCounters(_0x3e4da9){_0x3e4da9['waiting']=0x0;_0x3e4da9[_0x2970('0x6')]=0x0;_0x3e4da9[_0x2970('0x7')]=0x0;_0x3e4da9['unmanaged']=0x0;_0x3e4da9[_0x2970('0x8')]=0x0;_0x3e4da9[_0x2970('0x9')]=0x0;if(_0x3e4da9[_0x2970('0xa')]){if(_0x3e4da9['disposition']===_0x2970('0x8')){_0x3e4da9['abandoned']+=0x1;updateWaitingCounter(_0x3e4da9);}if(_0x3e4da9[_0x2970('0xb')]){_0x3e4da9[_0x2970('0x7')]+=0x1;if(_0x3e4da9[_0x2970('0x6')]){_0x3e4da9[_0x2970('0x6')]-=0x1;}}else{if(_0x3e4da9[_0x2970('0xc')]){_0x3e4da9['unmanaged']+=0x1;updateWaitingCounter(_0x3e4da9);}}}else{if(!_0x3e4da9['UserId']){_0x3e4da9['waiting']+=0x1;}if(_0x3e4da9[_0x2970('0xb')]){_0x3e4da9['talking']+=0x1;updateWaitingCounter(_0x3e4da9);}}_0x3e4da9[_0x2970('0x9')]+=0x1;return _0x3e4da9;}function getLastMessageText(_0x40e117){return db['MailMessage'][_0x2970('0xd')]({'where':{'$and':[{'MailInteractionId':_0x40e117['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2970('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2970('0xf')],'order':_0x2970('0x10'),'raw':!![]})['then'](function(_0x287d7b){if(_0x287d7b&&_0x287d7b[_0x2970('0xf')]){_0x40e117['lastMsgText']=_[_0x2970('0x11')](_0x287d7b[_0x2970('0xf')]);}return _0x40e117;})[_0x2970('0x12')](function(_0x3f7321){throw _0x3f7321;});}exports[_0x2970('0x13')]=function(_0x53d066,_0x3ac630,_0xe02a62,_0x4bbc67){return new Promise(function(_0x2d59ec,_0xd1070d){return getInteractionUsers(_0x53d066['id'],_0xe02a62)['then'](function(_0x586571){_0x53d066[_0x2970('0x14')]=_0x586571;return getInteractionTags(_0x53d066[_0x2970('0x15')],_0x3ac630);})[_0x2970('0x16')](function(_0x374889){_0x53d066[_0x2970('0x17')]=_0x374889;delete _0x53d066[_0x2970('0x15')];return updateInteractionCounters(_0x53d066);})[_0x2970('0x16')](function(_0x4f86ac){if(_0x4bbc67){return getLastMessageText(_0x4f86ac);}else{return _0x4f86ac;}})[_0x2970('0x16')](function(_0x252232){_0x2d59ec(_0x252232);})['catch'](function(_0x502de8){_0xd1070d(_0x502de8);});});}; \ No newline at end of file +var _0x7630=['disposition','UserId','talking','MailMessage','out','plainBody','-id','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','map','fullname','push','waiting','answered','unmanaged','abandoned','total','closed'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x7630,0x122));var _0x0763=function(_0x3cb2a6,_0x16408e){_0x3cb2a6=_0x3cb2a6-0x0;var _0x3dfa80=_0x7630[_0x3cb2a6];return _0x3dfa80;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x254d87,_0x51d1bf){return new Promise(function(_0xfd3b63,_0x4e55ca){try{var _0x129fd3=[];if(_0x51d1bf[_0x254d87]){_0x129fd3=_0x51d1bf[_0x254d87][_0x0763('0x0')](function(_0x12ed7a){return{'id':_0x12ed7a['id'],'fullname':_0x12ed7a[_0x0763('0x1')]};});}return _0xfd3b63(_0x129fd3);}catch(_0x1dc3f7){_0x4e55ca(_0x1dc3f7);}});}function getInteractionTags(_0x4497ff,_0x26c02b){var _0x4b1288=[];if(_0x4497ff){_0x4497ff['split'](',')['forEach'](function(_0x37372e){_0x4b1288[_0x0763('0x2')](_0x26c02b[_0x37372e]);});}return _0x4b1288;}function updateWaitingCounter(_0x206d19){if(_0x206d19[_0x0763('0x3')]){_0x206d19['waiting']-=0x1;}}function updateInteractionCounters(_0x5d0cca){_0x5d0cca[_0x0763('0x3')]=0x0;_0x5d0cca['talking']=0x0;_0x5d0cca[_0x0763('0x4')]=0x0;_0x5d0cca[_0x0763('0x5')]=0x0;_0x5d0cca[_0x0763('0x6')]=0x0;_0x5d0cca[_0x0763('0x7')]=0x0;if(_0x5d0cca[_0x0763('0x8')]){if(_0x5d0cca[_0x0763('0x9')]===_0x0763('0x6')){_0x5d0cca['abandoned']+=0x1;updateWaitingCounter(_0x5d0cca);}if(_0x5d0cca[_0x0763('0xa')]){_0x5d0cca['answered']+=0x1;if(_0x5d0cca[_0x0763('0xb')]){_0x5d0cca['talking']-=0x1;}}else{if(_0x5d0cca[_0x0763('0x9')]){_0x5d0cca['unmanaged']+=0x1;updateWaitingCounter(_0x5d0cca);}}}else{if(!_0x5d0cca[_0x0763('0xa')]){_0x5d0cca['waiting']+=0x1;}if(_0x5d0cca[_0x0763('0xa')]){_0x5d0cca[_0x0763('0xb')]+=0x1;updateWaitingCounter(_0x5d0cca);}}_0x5d0cca[_0x0763('0x7')]+=0x1;return _0x5d0cca;}function getLastMessageText(_0x2213dc){return db[_0x0763('0xc')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x2213dc['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0763('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0763('0xe')],'order':_0x0763('0xf'),'raw':!![]})['then'](function(_0x1f7d3b){if(_0x1f7d3b&&_0x1f7d3b[_0x0763('0xe')]){_0x2213dc['lastMsgText']=_[_0x0763('0x10')](_0x1f7d3b['plainBody']);}return _0x2213dc;})[_0x0763('0x11')](function(_0x520c36){throw _0x520c36;});}exports[_0x0763('0x12')]=function(_0x3a9e20,_0x293adb,_0x26320d,_0x323281){return new Promise(function(_0x4d3f4d,_0x3c30b9){return getInteractionUsers(_0x3a9e20['id'],_0x26320d)[_0x0763('0x13')](function(_0x4ba17c){_0x3a9e20[_0x0763('0x14')]=_0x4ba17c;return getInteractionTags(_0x3a9e20[_0x0763('0x15')],_0x293adb);})[_0x0763('0x13')](function(_0x213be4){_0x3a9e20[_0x0763('0x16')]=_0x213be4;delete _0x3a9e20['TagIds'];return updateInteractionCounters(_0x3a9e20);})['then'](function(_0x3f61a6){if(_0x323281){return getLastMessageText(_0x3f61a6);}else{return _0x3f61a6;}})[_0x0763('0x13')](function(_0x277a79){_0x4d3f4d(_0x277a79);})[_0x0763('0x11')](function(_0x2ce740){_0x3c30b9(_0x2ce740);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index e5e5445..2319b32 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa556=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','Website','Account','capitalize','upperFirst','InteractionId','chat','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray'];(function(_0x5b95a4,_0x4fd570){var _0x5e273d=function(_0x7c36fa){while(--_0x7c36fa){_0x5b95a4['push'](_0x5b95a4['shift']());}};_0x5e273d(++_0x4fd570);}(_0xa556,0x9a));var _0x6a55=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xa556[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0x6a55('0x0'));var db=require(_0x6a55('0x1'))['db'];var loggers={'openchannel':require(_0x6a55('0x2'))(_0x6a55('0x3')),'mail':require('../../config/logger')(_0x6a55('0x4')),'fax':require(_0x6a55('0x2'))(_0x6a55('0x5')),'sms':require(_0x6a55('0x2'))(_0x6a55('0x6')),'chat':require(_0x6a55('0x2'))(_0x6a55('0x7')),'whatsapp':require(_0x6a55('0x2'))('whatsapp-interactions')};function getAccountFK(_0x3a6acf){return _['capitalize'](_0x3a6acf)+(_0x3a6acf==='chat'?_0x6a55('0x8'):_0x6a55('0x9'))+'Id';}function getInteractionFK(_0x106a11){return _[_0x6a55('0xa')](_0x106a11)+'InteractionId';}function getInteractionId(_0x188559,_0x4624a3,_0x44fbcb){if(_0x188559&&_0x188559[_[_0x6a55('0xb')](_0x44fbcb)+'InteractionId']){return _0x188559[_[_0x6a55('0xb')](_0x44fbcb)+_0x6a55('0xc')];}else if(_0x188559&&_0x188559['id']){return _0x188559['id'];}else if(_0x4624a3&&_0x4624a3['id']){return _0x4624a3['id'];}else{return'unknown';}}function getInteractionsTables(_0x140088){return{'accounts':_0x140088+'_'+(_0x140088===_0x6a55('0xd')?_0x6a55('0xe'):_0x6a55('0xf')),'interactions':_0x140088+_0x6a55('0x10'),'interactionsTags':_0x140088+_0x6a55('0x11'),'messages':_0x140088+'_messages','userInteractions':_0x6a55('0x12')+_0x140088+_0x6a55('0x10')};}function getSelectedTags(_0x8d741e){var _0x4a5a0a=[];if(_0x8d741e){_0x4a5a0a=Array[_0x6a55('0x13')](_0x8d741e)?_0x8d741e:[_0x8d741e];}return _0x4a5a0a;}function log(_0x151dac,_0x4c3c47,_0x195cf0,_0x5d463d,_0x5a4dfc,_0x3eaf38){loggers[_0x5a4dfc[_0x6a55('0x14')]()][_0x151dac](_0x6a55('0x15'),_0x3eaf38[_0x6a55('0x16')](),_0x4c3c47?_0x4c3c47['id']:null,_0x4c3c47?_0x4c3c47[_0x6a55('0x17')]:null,_0x4c3c47?_0x4c3c47[_0x6a55('0x18')]:null,getInteractionId(_0x195cf0,_0x5d463d,_0x5a4dfc),_0x195cf0?JSON[_0x6a55('0x19')](_0x195cf0):_0x6a55('0x1a'));}function updateUser(_0x330a84,_0x1f3eaf,_0x2e9cbd,_0x217fce,_0x3abb74){db[_['upperFirst'](_0x217fce)+_0x6a55('0x1b')]['findOne']({'where':{'id':getInteractionId(_0x1f3eaf,_0x2e9cbd,_0x217fce)}})['then'](function(_0x56f604){if(_0x56f604){return _0x56f604['update']({'UserId':_0x330a84?_0x330a84['id']:null});}})['then'](function(_0x3a40cc){if(_0x3a40cc){log('info',_0x330a84,_0x1f3eaf,_0x2e9cbd,_0x217fce,_0x3abb74);}})['catch'](function(){log('error',_0x330a84,_0x1f3eaf,_0x2e9cbd,_0x217fce,_0x3abb74);});}module[_0x6a55('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x58b7=['sms-interactions','chat-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions'];(function(_0x19f40f,_0x522003){var _0x4d4a85=function(_0x1024e9){while(--_0x1024e9){_0x19f40f['push'](_0x19f40f['shift']());}};_0x4d4a85(++_0x522003);}(_0x58b7,0x18e));var _0x758b=function(_0x5d260f,_0x8f1c41){_0x5d260f=_0x5d260f-0x0;var _0x5d3465=_0x58b7[_0x5d260f];return _0x5d3465;};'use strict';var _=require(_0x758b('0x0'));var db=require(_0x758b('0x1'))['db'];var loggers={'openchannel':require(_0x758b('0x2'))('openchannel-interactions'),'mail':require(_0x758b('0x2'))(_0x758b('0x3')),'fax':require('../../config/logger')(_0x758b('0x4')),'sms':require(_0x758b('0x2'))(_0x758b('0x5')),'chat':require(_0x758b('0x2'))(_0x758b('0x6')),'whatsapp':require(_0x758b('0x2'))('whatsapp-interactions')};function getAccountFK(_0x58d99f){return _['capitalize'](_0x58d99f)+(_0x58d99f===_0x758b('0x7')?_0x758b('0x8'):_0x758b('0x9'))+'Id';}function getInteractionFK(_0x5dd806){return _[_0x758b('0xa')](_0x5dd806)+_0x758b('0xb');}function getInteractionId(_0x27d511,_0x11de54,_0x169e0a){if(_0x27d511&&_0x27d511[_[_0x758b('0xc')](_0x169e0a)+_0x758b('0xb')]){return _0x27d511[_['upperFirst'](_0x169e0a)+_0x758b('0xb')];}else if(_0x27d511&&_0x27d511['id']){return _0x27d511['id'];}else if(_0x11de54&&_0x11de54['id']){return _0x11de54['id'];}else{return'unknown';}}function getInteractionsTables(_0x37ea96){return{'accounts':_0x37ea96+'_'+(_0x37ea96===_0x758b('0x7')?_0x758b('0xd'):_0x758b('0xe')),'interactions':_0x37ea96+_0x758b('0xf'),'interactionsTags':_0x37ea96+_0x758b('0x10'),'messages':_0x37ea96+_0x758b('0x11'),'userInteractions':_0x758b('0x12')+_0x37ea96+_0x758b('0xf')};}function getSelectedTags(_0x118c0b){var _0xa8d903=[];if(_0x118c0b){_0xa8d903=Array[_0x758b('0x13')](_0x118c0b)?_0x118c0b:[_0x118c0b];}return _0xa8d903;}function log(_0x1e71f1,_0xf5a0bf,_0x15c767,_0x485853,_0xd8caaf,_0xbcdb7a){loggers[_0xd8caaf[_0x758b('0x14')]()][_0x1e71f1](_0x758b('0x15'),_0xbcdb7a[_0x758b('0x16')](),_0xf5a0bf?_0xf5a0bf['id']:null,_0xf5a0bf?_0xf5a0bf[_0x758b('0x17')]:null,_0xf5a0bf?_0xf5a0bf['role']:null,getInteractionId(_0x15c767,_0x485853,_0xd8caaf),_0x15c767?JSON['stringify'](_0x15c767):'null');}function updateUser(_0x57a372,_0x246ff6,_0x1ad7d3,_0x517925,_0x5e24d1){db[_['upperFirst'](_0x517925)+'Interaction'][_0x758b('0x18')]({'where':{'id':getInteractionId(_0x246ff6,_0x1ad7d3,_0x517925)}})[_0x758b('0x19')](function(_0x544028){if(_0x544028){return _0x544028[_0x758b('0x1a')]({'UserId':_0x57a372?_0x57a372['id']:null});}})[_0x758b('0x19')](function(_0x16c23e){if(_0x16c23e){log(_0x758b('0x1b'),_0x57a372,_0x246ff6,_0x1ad7d3,_0x517925,_0x5e24d1);}})[_0x758b('0x1c')](function(){log(_0x758b('0x1d'),_0x57a372,_0x246ff6,_0x1ad7d3,_0x517925,_0x5e24d1);});}module[_0x758b('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 6370d89..de88973 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 _0x8587=['users','User','admin','user','crypto','util','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','catch'];(function(_0x1a2420,_0x5ac944){var _0x557347=function(_0x40d777){while(--_0x40d777){_0x1a2420['push'](_0x1a2420['shift']());}};_0x557347(++_0x5ac944);}(_0x8587,0xf7));var _0x7858=function(_0x2fd251,_0x28c956){_0x2fd251=_0x2fd251-0x0;var _0x2d14eb=_0x8587[_0x2fd251];return _0x2d14eb;};'use strict';var crypto=require(_0x7858('0x0'));var util=require(_0x7858('0x1'));var compose=require('composable-middleware');var db=require(_0x7858('0x2'))['db'];var config=require(_0x7858('0x3'));function getValueFromLicense(_0x264213,_0x2edbe4){if(_0x264213&&_0x2edbe4){if(_0x2edbe4['data1']&&_0x2edbe4[_0x7858('0x4')]){var _0x4402eb=_0x2edbe4[_0x7858('0x5')];var _0x540edc=_0x2edbe4['license'];var _0x198a6b=_0x4402eb[_0x7858('0x6')]('-')[0x4];var _0x24a444=_0x4402eb['split']('-')[0x0];var _0x42d9e3=crypto[_0x7858('0x7')](_0x7858('0x8'),util[_0x7858('0x9')](_0x7858('0xa'),_0x198a6b,_0x4402eb,_0x24a444));var _0x201a20=_0x42d9e3['update'](_0x540edc,_0x7858('0xb'),_0x7858('0xc'));_0x201a20+=_0x42d9e3[_0x7858('0xd')](_0x7858('0xc'));var _0x4df248=JSON[_0x7858('0xe')](_0x201a20);return _0x4df248[_0x7858('0xf')](_0x264213)?_0x4df248[_0x264213]:null;}}return null;}function isLimit(_0x1576aa,_0x8b40ca,_0x2b1ae4,_0x7206ff){var _0x79adf3=_0x8b40ca;return compose()[_0x7858('0x10')](function(_0x39dd35,_0x5dd1b9,_0x50bd75){return db['License'][_0x7858('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x7858('0x12')](function(_0x5bb162){var _0x21a7d5=getValueFromLicense(_0x1576aa,_0x5bb162);return _0x21a7d5?_0x21a7d5:_0x79adf3;})[_0x7858('0x12')](function(_0x2349c2){_0x79adf3=_0x2349c2;return _0x2b1ae4[_0x7858('0x13')](_0x7206ff);})[_0x7858('0x12')](function(_0x233b30){if(_0x233b30>=_0x79adf3){return _0x5dd1b9[_0x7858('0x14')](0x193)[_0x7858('0x15')]({'message':util[_0x7858('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1576aa)});}_0x50bd75();})[_0x7858('0x16')](function(_0x10f445){_0x50bd75(_0x10f445);});});}function isUserLimit(){return isLimit(_0x7858('0x17'),0x1,db[_0x7858('0x18')],{'where':{'$or':[{'role':_0x7858('0x19')},{'role':_0x7858('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x592f=['../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','crypto','composable-middleware'];(function(_0x816f33,_0x5bb361){var _0x2da24e=function(_0x3be4bd){while(--_0x3be4bd){_0x816f33['push'](_0x816f33['shift']());}};_0x2da24e(++_0x5bb361);}(_0x592f,0xa6));var _0xf592=function(_0x403994,_0xc79a1d){_0x403994=_0x403994-0x0;var _0x117cf6=_0x592f[_0x403994];return _0x117cf6;};'use strict';var crypto=require(_0xf592('0x0'));var util=require('util');var compose=require(_0xf592('0x1'));var db=require(_0xf592('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2ffd08,_0x33393e){if(_0x2ffd08&&_0x33393e){if(_0x33393e[_0xf592('0x3')]&&_0x33393e[_0xf592('0x4')]){var _0x1897a2=_0x33393e[_0xf592('0x3')];var _0xe72838=_0x33393e[_0xf592('0x4')];var _0x4eb98a=_0x1897a2[_0xf592('0x5')]('-')[0x4];var _0x1d4f7b=_0x1897a2['split']('-')[0x0];var _0x15b9c2=crypto[_0xf592('0x6')](_0xf592('0x7'),util[_0xf592('0x8')](_0xf592('0x9'),_0x4eb98a,_0x1897a2,_0x1d4f7b));var _0x5ee577=_0x15b9c2['update'](_0xe72838,_0xf592('0xa'),_0xf592('0xb'));_0x5ee577+=_0x15b9c2[_0xf592('0xc')]('utf8');var _0x2c60a3=JSON[_0xf592('0xd')](_0x5ee577);return _0x2c60a3['hasOwnProperty'](_0x2ffd08)?_0x2c60a3[_0x2ffd08]:null;}}return null;}function isLimit(_0x1ce757,_0xe9f9de,_0x5ba9c9,_0x192836){var _0x13bf11=_0xe9f9de;return compose()['use'](function(_0x4b1e30,_0x1f9499,_0x1af111){return db[_0xf592('0xe')][_0xf592('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xf592('0x10')](function(_0x2dac55){var _0x2507d8=getValueFromLicense(_0x1ce757,_0x2dac55);return _0x2507d8?_0x2507d8:_0x13bf11;})[_0xf592('0x10')](function(_0x2fc034){_0x13bf11=_0x2fc034;return _0x5ba9c9['count'](_0x192836);})[_0xf592('0x10')](function(_0x4faffe){if(_0x4faffe>=_0x13bf11){return _0x1f9499[_0xf592('0x11')](0x193)[_0xf592('0x12')]({'message':util['format'](_0xf592('0x13'),_0x1ce757)});}_0x1af111();})['catch'](function(_0x192faa){_0x1af111(_0x192faa);});});}function isUserLimit(){return isLimit(_0xf592('0x14'),0x1,db[_0xf592('0x15')],{'where':{'$or':[{'role':_0xf592('0x16')},{'role':_0xf592('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9fd5552..a22493e 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 _0xbaa7=['map','buildExpression','DATE','operator','$between','value','includes','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','=\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','utcOffset','add','hours','minutes','seconds','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','shift','match','forEach','filter','indexOf'];(function(_0x4a2ba2,_0x5901b9){var _0x1d09fd=function(_0x28648b){while(--_0x28648b){_0x4a2ba2['push'](_0x4a2ba2['shift']());}};_0x1d09fd(++_0x5901b9);}(_0xbaa7,0x1c6));var _0x7baa=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xbaa7[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var moment=require(_0x7baa('0x0'));exports[_0x7baa('0x1')]=function(_0x15a742){var _0x2c78ba={'conditions':[]};_0x2c78ba[_0x7baa('0x2')]=_['startsWith'](_0x15a742,_0x7baa('0x3'))?'or':_0x7baa('0x4');var _0x3939fd=_0x15a742[_0x7baa('0x5')](_0x7baa('0x6'),'')['replace'](_0x7baa('0x3'),'')[_0x7baa('0x7')]('||');for(var _0x25386a=0x0;_0x25386a<_0x3939fd[_0x7baa('0x8')];_0x25386a++){var _0x285d24=_0x3939fd[_0x25386a]['split'](':=');var _0x32cd42=_0x285d24[0x0];var _0x188e3f=_0x285d24['slice'](0x1);_0x188e3f['forEach'](function(_0x159e6b){var _0x41d8eb=_0x159e6b['split']('[')[_0x7baa('0x9')]();var _0x57ab78=_0x159e6b[_0x7baa('0xa')](/\[(.*?)\]/g);_0x57ab78[_0x7baa('0xb')](function(_0x2dffb9){var _0xdc553d=_0x2dffb9['split']('[')[_0x7baa('0xc')](function(_0x1bb4a1){return _0x1bb4a1[_0x7baa('0xd')](']')>-0x1;})[_0x7baa('0xe')](function(_0x56b12a){return _0x56b12a[_0x7baa('0x7')](']')[0x0];})[0x0];_0x2c78ba['conditions']['push']({'field':_0x32cd42,'operator':_0x41d8eb,'value':_0xdc553d});});});}return _0x2c78ba;};exports[_0x7baa('0xf')]=function(_0x490a4d,_0x44cbee,_0x274227){var _0x584c6a={};if(_0x44cbee===_0x7baa('0x10')){if(_0x274227[_0x7baa('0x11')]==='$eq'){_0x274227[_0x7baa('0x11')]=_0x7baa('0x12');_0x274227[_0x7baa('0x13')]+=','+_0x274227[_0x7baa('0x13')];}else if(_[_0x7baa('0x14')](['$gt',_0x7baa('0x15')],_0x274227[_0x7baa('0x11')])){_0x274227[_0x7baa('0x13')]=moment(_0x274227['value'])['add'](0x1,_0x7baa('0x16'))[_0x7baa('0x17')](_0x7baa('0x18'));}}if(_0x274227[_0x7baa('0x19')]){_0x44cbee=_0x274227[_0x7baa('0x19')];_0x584c6a[_0x7baa('0x1a')]=_0x7baa('0x1b')+_0x490a4d+'.'+_0x274227[_0x7baa('0x1c')]+'\x20AS\x20'+_0x274227[_0x7baa('0x19')]+')\x20'+parseOperator(_0x274227[_0x7baa('0x11')]);}else{_0x584c6a[_0x7baa('0x1a')]=_0x490a4d+'.'+_0x274227[_0x7baa('0x1c')]+'\x20'+parseOperator(_0x274227[_0x7baa('0x11')]);}if(_['includes']([_0x7baa('0x1d'),'$notIn'],_0x274227['operator']))_0x584c6a['text']='('+_0x584c6a[_0x7baa('0x1a')]+_0x7baa('0x1e')+_0x490a4d+'.'+_0x274227['field']+'\x20IS\x20NULL)';_0x584c6a[_0x7baa('0x13')]=parseValue(_0x44cbee,_0x274227[_0x7baa('0x11')],_0x274227[_0x7baa('0x13')]);return _0x584c6a;};function parseOperator(_0x5323c6){var _0x57a445;switch(_0x5323c6){case _0x7baa('0x1f'):_0x57a445=_0x7baa('0x20');break;case _0x7baa('0x21'):_0x57a445=_0x7baa('0x22');break;case _0x7baa('0x23'):_0x57a445=_0x7baa('0x24');break;case _0x7baa('0x1d'):_0x57a445='<>\x20?';break;case _0x7baa('0x25'):case'$startsWith':case _0x7baa('0x26'):_0x57a445=_0x7baa('0x27');break;case _0x7baa('0x28'):_0x57a445=_0x7baa('0x29');break;case'$gt':_0x57a445=_0x7baa('0x2a');break;case _0x7baa('0x15'):_0x57a445=_0x7baa('0x2b');break;case _0x7baa('0x2c'):_0x57a445='>=\x20?';break;case _0x7baa('0x12'):_0x57a445=_0x7baa('0x2d');break;}return _0x57a445;}function parseValue(_0x3428f7,_0x46bb83,_0x5c03bb){var _0x20e6e0={'start':undefined,'end':undefined};switch(_0x46bb83){case'$in':case'$notIn':_0x20e6e0[_0x7baa('0x2e')]=_0x5c03bb['split'](',');break;case _0x7baa('0x25'):_0x20e6e0[_0x7baa('0x2e')]='%'+_0x5c03bb+'%';break;case'$startsWith':_0x20e6e0[_0x7baa('0x2e')]=_0x5c03bb+'%';break;case _0x7baa('0x26'):_0x20e6e0[_0x7baa('0x2e')]='%'+_0x5c03bb;break;case _0x7baa('0x12'):var _0x20ca56=_0x5c03bb[_0x7baa('0x7')](',');var _0x5c03bb=_0x20ca56[_0x7baa('0x9')]();var _0x43e760=_0x20ca56['pop']();if(_0x3428f7===_0x7baa('0x10')){_0x5c03bb=moment(_0x5c03bb)['utcOffset'](0x0,!![])[_0x7baa('0x17')]();_0x43e760=moment(_0x43e760)[_0x7baa('0x2f')](0x0,!![])[_0x7baa('0x30')](0x17,_0x7baa('0x31'))[_0x7baa('0x30')](0x3b,_0x7baa('0x32'))[_0x7baa('0x30')](0x3b,_0x7baa('0x33'))[_0x7baa('0x17')]();}_0x20e6e0={'start':_0x5c03bb,'end':_0x43e760};break;default:_0x20e6e0[_0x7baa('0x2e')]=_0x5c03bb;break;}return _0x20e6e0;} \ No newline at end of file +var _0x60ff=['<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','format','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','replace','split','length','slice','forEach','shift','match','map','push','buildExpression','DATE','$eq','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','operator','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne'];(function(_0x221713,_0x5cd6ec){var _0x850bc1=function(_0x239aac){while(--_0x239aac){_0x221713['push'](_0x221713['shift']());}};_0x850bc1(++_0x5cd6ec);}(_0x60ff,0x130));var _0xf60f=function(_0x34f9aa,_0x2bc3c4){_0x34f9aa=_0x34f9aa-0x0;var _0x50977c=_0x60ff[_0x34f9aa];return _0x50977c;};'use strict';var _=require(_0xf60f('0x0'));var moment=require('moment');exports[_0xf60f('0x1')]=function(_0x5778b9){var _0x367359={'conditions':[]};_0x367359[_0xf60f('0x2')]=_[_0xf60f('0x3')](_0x5778b9,_0xf60f('0x4'))?'or':'and';var _0xfd950c=_0x5778b9[_0xf60f('0x5')]('[$and]','')[_0xf60f('0x5')](_0xf60f('0x4'),'')[_0xf60f('0x6')]('||');for(var _0xade10a=0x0;_0xade10a<_0xfd950c[_0xf60f('0x7')];_0xade10a++){var _0x4ea7e2=_0xfd950c[_0xade10a]['split'](':=');var _0xb54906=_0x4ea7e2[0x0];var _0x4c07a9=_0x4ea7e2[_0xf60f('0x8')](0x1);_0x4c07a9[_0xf60f('0x9')](function(_0x4a8b35){var _0x59d934=_0x4a8b35[_0xf60f('0x6')]('[')[_0xf60f('0xa')]();var _0x522d51=_0x4a8b35[_0xf60f('0xb')](/\[(.*?)\]/g);_0x522d51[_0xf60f('0x9')](function(_0x437181){var _0x548726=_0x437181['split']('[')['filter'](function(_0x7b2e15){return _0x7b2e15['indexOf'](']')>-0x1;})[_0xf60f('0xc')](function(_0xda1fb6){return _0xda1fb6['split'](']')[0x0];})[0x0];_0x367359['conditions'][_0xf60f('0xd')]({'field':_0xb54906,'operator':_0x59d934,'value':_0x548726});});});}return _0x367359;};exports[_0xf60f('0xe')]=function(_0x231ade,_0x186aeb,_0x1baa62){var _0x35d51a={};if(_0x186aeb===_0xf60f('0xf')){if(_0x1baa62['operator']===_0xf60f('0x10')){_0x1baa62['operator']='$between';_0x1baa62[_0xf60f('0x11')]+=','+_0x1baa62[_0xf60f('0x11')];}else if(_[_0xf60f('0x12')]([_0xf60f('0x13'),_0xf60f('0x14')],_0x1baa62['operator'])){_0x1baa62[_0xf60f('0x11')]=moment(_0x1baa62[_0xf60f('0x11')])[_0xf60f('0x15')](0x1,_0xf60f('0x16'))['format'](_0xf60f('0x17'));}}if(_0x1baa62[_0xf60f('0x18')]){_0x186aeb=_0x1baa62[_0xf60f('0x18')];_0x35d51a[_0xf60f('0x19')]=_0xf60f('0x1a')+_0x231ade+'.'+_0x1baa62[_0xf60f('0x1b')]+_0xf60f('0x1c')+_0x1baa62[_0xf60f('0x18')]+')\x20'+parseOperator(_0x1baa62[_0xf60f('0x1d')]);}else{_0x35d51a['text']=_0x231ade+'.'+_0x1baa62[_0xf60f('0x1b')]+'\x20'+parseOperator(_0x1baa62[_0xf60f('0x1d')]);}if(_[_0xf60f('0x12')](['$ne',_0xf60f('0x1e')],_0x1baa62['operator']))_0x35d51a[_0xf60f('0x19')]='('+_0x35d51a[_0xf60f('0x19')]+_0xf60f('0x1f')+_0x231ade+'.'+_0x1baa62[_0xf60f('0x1b')]+_0xf60f('0x20');_0x35d51a[_0xf60f('0x11')]=parseValue(_0x186aeb,_0x1baa62[_0xf60f('0x1d')],_0x1baa62[_0xf60f('0x11')]);return _0x35d51a;};function parseOperator(_0x670896){var _0x3d853c;switch(_0x670896){case _0xf60f('0x21'):_0x3d853c=_0xf60f('0x22');break;case _0xf60f('0x1e'):_0x3d853c=_0xf60f('0x23');break;case _0xf60f('0x10'):_0x3d853c=_0xf60f('0x24');break;case _0xf60f('0x25'):_0x3d853c=_0xf60f('0x26');break;case _0xf60f('0x27'):case'$startsWith':case _0xf60f('0x28'):_0x3d853c=_0xf60f('0x29');break;case _0xf60f('0x2a'):_0x3d853c=_0xf60f('0x2b');break;case _0xf60f('0x13'):_0x3d853c=_0xf60f('0x2c');break;case'$lte':_0x3d853c='<=\x20?';break;case _0xf60f('0x2d'):_0x3d853c=_0xf60f('0x2e');break;case _0xf60f('0x2f'):_0x3d853c=_0xf60f('0x30');break;}return _0x3d853c;}function parseValue(_0x368d56,_0x38c5c7,_0x1ce217){var _0x482c7a={'start':undefined,'end':undefined};switch(_0x38c5c7){case _0xf60f('0x21'):case _0xf60f('0x1e'):_0x482c7a[_0xf60f('0x31')]=_0x1ce217['split'](',');break;case'$substring':_0x482c7a[_0xf60f('0x31')]='%'+_0x1ce217+'%';break;case _0xf60f('0x32'):_0x482c7a[_0xf60f('0x31')]=_0x1ce217+'%';break;case _0xf60f('0x28'):_0x482c7a[_0xf60f('0x31')]='%'+_0x1ce217;break;case _0xf60f('0x2f'):var _0x4e0127=_0x1ce217[_0xf60f('0x6')](',');var _0x1ce217=_0x4e0127[_0xf60f('0xa')]();var _0x17c42e=_0x4e0127[_0xf60f('0x33')]();if(_0x368d56===_0xf60f('0xf')){_0x1ce217=moment(_0x1ce217)[_0xf60f('0x34')](0x0,!![])[_0xf60f('0x35')]();_0x17c42e=moment(_0x17c42e)[_0xf60f('0x34')](0x0,!![])[_0xf60f('0x15')](0x17,_0xf60f('0x36'))[_0xf60f('0x15')](0x3b,_0xf60f('0x37'))[_0xf60f('0x15')](0x3b,_0xf60f('0x38'))[_0xf60f('0x35')]();}_0x482c7a={'start':_0x1ce217,'end':_0x17c42e};break;default:_0x482c7a[_0xf60f('0x31')]=_0x1ce217;break;}return _0x482c7a;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index b587e62..9ae8129 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 _0xc826=['col','priority','unsigned','substr','DESC','ASC','omit','isEmpty','isString','length','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','join','query','$id','map','intersection','attributes','nolimit','order','sort','where','pick','filter','columns','value','merge','lower','include','includeAll','push','lodash','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','filters','find','type','DATE','isPlainObject','$gte','format','$lte','YYYY-MM-DD','utc','name','uniqueid','isArray','limit','offset','indexOf','cast'];(function(_0x1f5a63,_0x511504){var _0x30bb7a=function(_0x476310){while(--_0x476310){_0x1f5a63['push'](_0x1f5a63['shift']());}};_0x30bb7a(++_0x511504);}(_0xc826,0x12e));var _0x6c82=function(_0x50b552,_0x427184){_0x50b552=_0x50b552-0x0;var _0x5c4116=_0xc826[_0x50b552];return _0x5c4116;};'use strict';var _=require(_0x6c82('0x0'));var sequelize=require('sequelize');var moment=require(_0x6c82('0x1'));var db=require(_0x6c82('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2ebed4){var _0x774f24=['ne'];try{var _0x21e13e=JSON[_0x6c82('0x3')](_0x2ebed4);var _0xa0482a=Object[_0x6c82('0x4')](_0x21e13e)[0x0];return _0x774f24[_0x6c82('0x5')](_0xa0482a);}catch(_0x4d762b){return![];}}function getOperatorValue(_0x34a182){var _0x482229=JSON[_0x6c82('0x3')](_0x34a182);var _0x260810=Object['keys'](_0x482229)[0x0];var _0x4cc6d7=_0x482229[_0x260810];return{['$'+_0x260810]:_0x4cc6d7};}function parseIncludeModel(_0x1d072f){var _0x3c0724=JSON[_0x6c82('0x3')](_0x1d072f);return{'model':db[_0x3c0724[_0x6c82('0x6')]],'as':_0x3c0724[_0x6c82('0x7')],'attributes':_0x3c0724[_0x6c82('0x8')],'raw':_0x3c0724[_0x6c82('0x9')]};}exports[_0x6c82('0x8')]=function(_0x478cb6){var _0x9efbd0=null;if(_0x478cb6){_0x9efbd0=_0x478cb6[_0x6c82('0xa')](',');}return _0x9efbd0;};exports[_0x6c82('0xb')]=function(_0x153edd,_0x27f860){var _0x100d75={};if(!_['isEmpty'](_0x153edd)){_['forOwn'](_0x153edd,function(_0xab4115,_0x5ccf35){try{if(_0x27f860){var _0x333fda=_[_0x6c82('0xc')](_0x27f860,{'name':_0x5ccf35})||{};if(hasSequelizeOperator(_0xab4115)){_0x100d75[_0x5ccf35]=getOperatorValue(_0xab4115);}else if(_0x333fda[_0x6c82('0xd')]===_0x6c82('0xe')&&_[_0x6c82('0xf')](_0xab4115)){var _0x609615=JSON[_0x6c82('0x3')](_0xab4115);var _0x155be3={'$gte':moment(moment(_0x609615[_0x6c82('0x10')])[_0x6c82('0x11')]('YYYY-MM-DD'))['utc']()[_0x6c82('0x11')](),'$lte':moment(moment(_0x609615[_0x6c82('0x12')])[_0x6c82('0x11')](_0x6c82('0x13')))[_0x6c82('0x14')]()['subtract'](0x1,'s')[_0x6c82('0x11')]()};_0x100d75[_0x5ccf35]=_0x155be3;}else if(_0x333fda[_0x6c82('0x15')]===_0x6c82('0x16')){_0x100d75[_0x5ccf35]=_0xab4115;}else{_0x100d75[_0x5ccf35]=_[_0x6c82('0x17')](_0xab4115)?_0xab4115:JSON[_0x6c82('0x3')](_0xab4115);}}else{_0x100d75[_0x5ccf35]=_[_0x6c82('0x17')](_0xab4115)?_0xab4115:JSON['parse'](_0xab4115);}}catch(_0x49dd94){_0x100d75[_0x5ccf35]=_0xab4115[_0x6c82('0xa')](',');}});}return _0x100d75;};exports[_0x6c82('0x18')]=function(_0x4780ab){_0x4780ab=parseInt(_0x4780ab,0xa);if(!_0x4780ab||_0x4780ab<0x0){_0x4780ab=LIMIT_VALUE;}return _0x4780ab;};exports[_0x6c82('0x19')]=function(_0x218361){_0x218361=parseInt(_0x218361,0xa);if(!_0x218361||_0x218361<0x0){_0x218361=0x0;}return _0x218361;};exports['sort']=function(_0x1a9d20){var _0x31c9d7,_0x42755c=null;if(_0x1a9d20){_0x31c9d7=_0x1a9d20[_0x6c82('0xa')](',');_0x42755c=_['map'](_0x31c9d7,function(_0x134a4f){if(_0x134a4f[_0x6c82('0x1a')]('-')===0x0){return[_0x134a4f==='priority'?sequelize[_0x6c82('0x1b')](sequelize[_0x6c82('0x1c')](_0x6c82('0x1d')),_0x6c82('0x1e')):_0x134a4f[_0x6c82('0x1f')](0x1),_0x6c82('0x20')];}else{return[_0x134a4f===_0x6c82('0x1d')?sequelize[_0x6c82('0x1b')](sequelize['col'](_0x6c82('0x1d')),_0x6c82('0x1e')):_0x134a4f,_0x6c82('0x21')];}});}return _0x42755c;};exports[_0x6c82('0x22')]=function(_0x3ec9f1,_0x3d5739){if(_[_0x6c82('0x23')](_0x3ec9f1)){return _0x3ec9f1;}if(_['isArray'](_0x3ec9f1)){for(var _0x50d660=0x0;_0x50d660<_0x3ec9f1['length'];_0x50d660+=0x1){_0x3ec9f1[_0x50d660]=this[_0x6c82('0x22')](_0x3ec9f1[_0x50d660],_0x3d5739);}return _0x3ec9f1;}if(!_['isObject'](_0x3ec9f1)){return _0x3ec9f1;}if(_[_0x6c82('0x24')](_0x3d5739)){_0x3d5739=[_0x3d5739];}if(!_['isArray'](_0x3d5739)){return _0x3ec9f1;}for(var _0x522938=0x0;_0x522938<_0x3d5739[_0x6c82('0x25')];_0x522938+=0x1){_[_0x6c82('0x26')](_0x3ec9f1,_0x3d5739[_0x522938]);}for(var _0x3443fa in _0x3ec9f1){if(_0x3ec9f1[_0x6c82('0x27')](_0x3443fa)){_0x3ec9f1[_0x3443fa]=this['omit'](_0x3ec9f1[_0x3443fa],_0x3d5739);}}return _0x3ec9f1;};exports[_0x6c82('0x28')]=function(_0x5c1ba4){return _0x5c1ba4[_0x6c82('0x29')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x6c82('0x2a')]=function(_0x35e8da){return _0x35e8da[_0x6c82('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0x6c82('0x2b')]=function(_0x1b8e47,_0x58734e){var _0x1349c3=[];var _0x5deabf=/[ `!@#$%^&*()_\-?~]/;var _0x3ddb33=_0x58734e?_0x6c82('0x2c'):_0x6c82('0x2d');_0x1b8e47[_0x6c82('0xa')](/[ ,]+/)['forEach'](function(_0x262f7c){_0x262f7c=_0x262f7c['replace'](/([^:]")"+/g,'$1');_0x262f7c='+'+_0x262f7c+'*';var _0x574c1d=_0x262f7c[_0x6c82('0x29')](_0x5deabf);if(_0x574c1d){_0x262f7c='\x22'+_0x262f7c+'\x22';}_0x1349c3['push'](_0x262f7c);});_0x3ddb33=_0x3ddb33[_0x6c82('0x2e')](_0x6c82('0x2d'),_0x1349c3[_0x6c82('0x2f')]('\x20'));return _0x3ddb33;};exports['getOptions']=function(_0x35555a,_0x8c6637,_0x1601e2){var _0x5119ae={},_0x36f0b0={};if(_0x8c6637[_0x6c82('0x30')][_0x6c82('0x31')]){_0x8c6637[_0x6c82('0x30')]['id']=_0x8c6637['query'][_0x6c82('0x31')];delete _0x8c6637[_0x6c82('0x30')][_0x6c82('0x31')];}_0x5119ae[_0x6c82('0x6')]=_[_0x6c82('0x32')](_0x35555a,_0x6c82('0x15'));_0x5119ae[_0x6c82('0x30')]=_[_0x6c82('0x4')](_0x8c6637[_0x6c82('0x30')]);_0x5119ae['filters']=_[_0x6c82('0x33')](_0x5119ae[_0x6c82('0x6')],_0x5119ae[_0x6c82('0x30')]);_0x36f0b0['attributes']=_[_0x6c82('0x33')](_0x5119ae[_0x6c82('0x6')],this[_0x6c82('0x8')](_0x8c6637[_0x6c82('0x30')][_0x6c82('0x8')]));_0x36f0b0['attributes']=_0x36f0b0[_0x6c82('0x34')][_0x6c82('0x25')]?_0x36f0b0[_0x6c82('0x34')]:_0x5119ae[_0x6c82('0x6')];if(!_0x8c6637[_0x6c82('0x30')][_0x6c82('0x27')](_0x6c82('0x35'))){_0x36f0b0['limit']=this[_0x6c82('0x18')](_0x8c6637[_0x6c82('0x30')][_0x6c82('0x18')]);_0x36f0b0[_0x6c82('0x19')]=this['offset'](_0x8c6637[_0x6c82('0x30')]['offset']);}_0x36f0b0[_0x6c82('0x36')]=this[_0x6c82('0x37')](_0x8c6637[_0x6c82('0x30')][_0x6c82('0x37')]);_0x36f0b0[_0x6c82('0x38')]=this[_0x6c82('0xb')](_[_0x6c82('0x39')](_0x8c6637['query'],_0x5119ae[_0x6c82('0xb')]),_0x35555a);if(_0x8c6637['query'][_0x6c82('0x3a')]){var _0x5a6844=_0x35555a;var _0x5ac3ba=_0x8c6637[_0x6c82('0x30')][_0x6c82('0x3a')];if(typeof _0x5ac3ba==='object'){_0x5a6844=_[_0x6c82('0x3a')](_0x35555a,function(_0x1f249c){return _[_0x6c82('0x5')](_0x5ac3ba[_0x6c82('0x3b')],_0x1f249c[_0x6c82('0x15')]);});_0x5ac3ba=_0x5ac3ba[_0x6c82('0x3c')];}_0x36f0b0[_0x6c82('0x38')]=_[_0x6c82('0x3d')](_0x36f0b0[_0x6c82('0x38')],{'$or':_[_0x6c82('0x32')](_0x5a6844,function(_0x5d788f){if(_0x5d788f[_0x6c82('0xd')]!=='VIRTUAL'){if(_0x1601e2){return sequelize[_0x6c82('0x38')](sequelize['fn'](_0x6c82('0x3e'),sequelize[_0x6c82('0x1c')](_0x5d788f[_0x6c82('0x15')])),{'$like':sequelize['fn']('lower','%'+_0x8c6637[_0x6c82('0x30')][_0x6c82('0x3a')]+'%')});}else{var _0x49ff68={};_0x49ff68[_0x5d788f[_0x6c82('0x15')]]={'$like':'%'+_0x8c6637[_0x6c82('0x30')][_0x6c82('0x3a')]+'%'};return _0x49ff68;}}})});}_0x36f0b0=_[_0x6c82('0x3d')]({},_0x36f0b0,_0x8c6637['options']);return _0x36f0b0;};exports[_0x6c82('0x3f')]=function(_0x2bb0c7){var _0x5d881d=[];if(_0x2bb0c7[_0x6c82('0x40')]){_0x5d881d[_0x6c82('0x41')]({'all':!![]});}else if(_0x2bb0c7[_0x6c82('0x3f')]){if(Array[_0x6c82('0x17')](_0x2bb0c7['include'])){_0x5d881d=Object[_0x6c82('0x4')](_0x2bb0c7[_0x6c82('0x3f')])[_0x6c82('0x32')](function(_0x13bdc8){return parseIncludeModel(_0x2bb0c7['include'][_0x13bdc8]);});}else{var _0x15e4bb=parseIncludeModel(_0x2bb0c7[_0x6c82('0x3f')]);_0x5d881d[_0x6c82('0x41')](_0x15e4bb);}}return _0x5d881d;}; \ No newline at end of file +var _0x9772=['filter','object','includes','columns','merge','VIRTUAL','lower','options','include','lodash','../../mysqldb','parse','keys','model','alias','fields','raw','split','forOwn','find','type','DATE','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','limit','offset','sort','map','col','priority','unsigned','substr','DESC','cast','ASC','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','join','query','$id','filters','intersection','attributes','nolimit','where','pick'];(function(_0x435ca0,_0x28e991){var _0x316ddb=function(_0x380cb8){while(--_0x380cb8){_0x435ca0['push'](_0x435ca0['shift']());}};_0x316ddb(++_0x28e991);}(_0x9772,0x189));var _0x2977=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x9772[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x2977('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require(_0x2977('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4f48ce){var _0x6e1582=['ne'];try{var _0x454c90=JSON[_0x2977('0x2')](_0x4f48ce);var _0x3eb4a0=Object[_0x2977('0x3')](_0x454c90)[0x0];return _0x6e1582['includes'](_0x3eb4a0);}catch(_0x9d95f3){return![];}}function getOperatorValue(_0x347741){var _0x49fc81=JSON[_0x2977('0x2')](_0x347741);var _0x473577=Object['keys'](_0x49fc81)[0x0];var _0x1df08f=_0x49fc81[_0x473577];return{['$'+_0x473577]:_0x1df08f};}function parseIncludeModel(_0x1ac290){var _0x1bc0f3=JSON[_0x2977('0x2')](_0x1ac290);return{'model':db[_0x1bc0f3[_0x2977('0x4')]],'as':_0x1bc0f3[_0x2977('0x5')],'attributes':_0x1bc0f3[_0x2977('0x6')],'raw':_0x1bc0f3[_0x2977('0x7')]};}exports[_0x2977('0x6')]=function(_0x4145db){var _0x235407=null;if(_0x4145db){_0x235407=_0x4145db[_0x2977('0x8')](',');}return _0x235407;};exports['filters']=function(_0x542614,_0x5cfd22){var _0xaefba0={};if(!_['isEmpty'](_0x542614)){_[_0x2977('0x9')](_0x542614,function(_0x41ca35,_0x25e095){try{if(_0x5cfd22){var _0x5d7fbe=_[_0x2977('0xa')](_0x5cfd22,{'name':_0x25e095})||{};if(hasSequelizeOperator(_0x41ca35)){_0xaefba0[_0x25e095]=getOperatorValue(_0x41ca35);}else if(_0x5d7fbe[_0x2977('0xb')]===_0x2977('0xc')&&_['isPlainObject'](_0x41ca35)){var _0x4e2870=JSON[_0x2977('0x2')](_0x41ca35);var _0x3eda6e={'$gte':moment(moment(_0x4e2870['$gte'])['format'](_0x2977('0xd')))[_0x2977('0xe')]()[_0x2977('0xf')](),'$lte':moment(moment(_0x4e2870['$lte'])[_0x2977('0xf')](_0x2977('0xd')))[_0x2977('0xe')]()[_0x2977('0x10')](0x1,'s')['format']()};_0xaefba0[_0x25e095]=_0x3eda6e;}else if(_0x5d7fbe[_0x2977('0x11')]===_0x2977('0x12')){_0xaefba0[_0x25e095]=_0x41ca35;}else{_0xaefba0[_0x25e095]=_[_0x2977('0x13')](_0x41ca35)?_0x41ca35:JSON[_0x2977('0x2')](_0x41ca35);}}else{_0xaefba0[_0x25e095]=_[_0x2977('0x13')](_0x41ca35)?_0x41ca35:JSON[_0x2977('0x2')](_0x41ca35);}}catch(_0x4a1a16){_0xaefba0[_0x25e095]=_0x41ca35[_0x2977('0x8')](',');}});}return _0xaefba0;};exports[_0x2977('0x14')]=function(_0x24496f){_0x24496f=parseInt(_0x24496f,0xa);if(!_0x24496f||_0x24496f<0x0){_0x24496f=LIMIT_VALUE;}return _0x24496f;};exports[_0x2977('0x15')]=function(_0x299a4e){_0x299a4e=parseInt(_0x299a4e,0xa);if(!_0x299a4e||_0x299a4e<0x0){_0x299a4e=0x0;}return _0x299a4e;};exports[_0x2977('0x16')]=function(_0x56836c){var _0x391d72,_0x52efea=null;if(_0x56836c){_0x391d72=_0x56836c[_0x2977('0x8')](',');_0x52efea=_[_0x2977('0x17')](_0x391d72,function(_0x51d7a3){if(_0x51d7a3['indexOf']('-')===0x0){return[_0x51d7a3==='priority'?sequelize['cast'](sequelize[_0x2977('0x18')](_0x2977('0x19')),_0x2977('0x1a')):_0x51d7a3[_0x2977('0x1b')](0x1),_0x2977('0x1c')];}else{return[_0x51d7a3===_0x2977('0x19')?sequelize[_0x2977('0x1d')](sequelize['col'](_0x2977('0x19')),_0x2977('0x1a')):_0x51d7a3,_0x2977('0x1e')];}});}return _0x52efea;};exports[_0x2977('0x1f')]=function(_0x1a23eb,_0x840275){if(_[_0x2977('0x20')](_0x1a23eb)){return _0x1a23eb;}if(_['isArray'](_0x1a23eb)){for(var _0x4f7bd0=0x0;_0x4f7bd0<_0x1a23eb[_0x2977('0x21')];_0x4f7bd0+=0x1){_0x1a23eb[_0x4f7bd0]=this[_0x2977('0x1f')](_0x1a23eb[_0x4f7bd0],_0x840275);}return _0x1a23eb;}if(!_[_0x2977('0x22')](_0x1a23eb)){return _0x1a23eb;}if(_[_0x2977('0x23')](_0x840275)){_0x840275=[_0x840275];}if(!_[_0x2977('0x13')](_0x840275)){return _0x1a23eb;}for(var _0x5a5ae3=0x0;_0x5a5ae3<_0x840275[_0x2977('0x21')];_0x5a5ae3+=0x1){_[_0x2977('0x24')](_0x1a23eb,_0x840275[_0x5a5ae3]);}for(var _0x4e3a99 in _0x1a23eb){if(_0x1a23eb[_0x2977('0x25')](_0x4e3a99)){_0x1a23eb[_0x4e3a99]=this[_0x2977('0x1f')](_0x1a23eb[_0x4e3a99],_0x840275);}}return _0x1a23eb;};exports[_0x2977('0x26')]=function(_0x17feda){return _0x17feda[_0x2977('0x27')](RegExp(_0x2977('0x28')))?!![]:![];};exports['isEmail']=function(_0x6ef04c){return _0x6ef04c[_0x2977('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x2977('0x29')]=function(_0x552e24,_0x7cca93){var _0x1f3666=[];var _0x353c9a=/[ `!@#$%^&*()_\-?~]/;var _0x518372=_0x7cca93?_0x2977('0x2a'):_0x2977('0x2b');_0x552e24['split'](/[ ,]+/)[_0x2977('0x2c')](function(_0x5ebf2f){_0x5ebf2f=_0x5ebf2f['replace'](/([^:]")"+/g,'$1');_0x5ebf2f='+'+_0x5ebf2f+'*';var _0x21ca0c=_0x5ebf2f[_0x2977('0x27')](_0x353c9a);if(_0x21ca0c){_0x5ebf2f='\x22'+_0x5ebf2f+'\x22';}_0x1f3666[_0x2977('0x2d')](_0x5ebf2f);});_0x518372=_0x518372['replace']('{EXPR}',_0x1f3666[_0x2977('0x2e')]('\x20'));return _0x518372;};exports['getOptions']=function(_0x1c23f1,_0x292917,_0x494cd2){var _0x3bd961={},_0x2865ad={};if(_0x292917[_0x2977('0x2f')][_0x2977('0x30')]){_0x292917[_0x2977('0x2f')]['id']=_0x292917[_0x2977('0x2f')]['$id'];delete _0x292917[_0x2977('0x2f')][_0x2977('0x30')];}_0x3bd961[_0x2977('0x4')]=_[_0x2977('0x17')](_0x1c23f1,_0x2977('0x11'));_0x3bd961[_0x2977('0x2f')]=_[_0x2977('0x3')](_0x292917['query']);_0x3bd961[_0x2977('0x31')]=_[_0x2977('0x32')](_0x3bd961[_0x2977('0x4')],_0x3bd961['query']);_0x2865ad['attributes']=_[_0x2977('0x32')](_0x3bd961[_0x2977('0x4')],this['fields'](_0x292917[_0x2977('0x2f')][_0x2977('0x6')]));_0x2865ad[_0x2977('0x33')]=_0x2865ad[_0x2977('0x33')][_0x2977('0x21')]?_0x2865ad[_0x2977('0x33')]:_0x3bd961['model'];if(!_0x292917[_0x2977('0x2f')]['hasOwnProperty'](_0x2977('0x34'))){_0x2865ad[_0x2977('0x14')]=this[_0x2977('0x14')](_0x292917[_0x2977('0x2f')]['limit']);_0x2865ad[_0x2977('0x15')]=this[_0x2977('0x15')](_0x292917[_0x2977('0x2f')][_0x2977('0x15')]);}_0x2865ad['order']=this[_0x2977('0x16')](_0x292917['query'][_0x2977('0x16')]);_0x2865ad[_0x2977('0x35')]=this[_0x2977('0x31')](_[_0x2977('0x36')](_0x292917[_0x2977('0x2f')],_0x3bd961['filters']),_0x1c23f1);if(_0x292917[_0x2977('0x2f')]['filter']){var _0x610772=_0x1c23f1;var _0x2105d0=_0x292917['query'][_0x2977('0x37')];if(typeof _0x2105d0===_0x2977('0x38')){_0x610772=_[_0x2977('0x37')](_0x1c23f1,function(_0x59547c){return _[_0x2977('0x39')](_0x2105d0[_0x2977('0x3a')],_0x59547c[_0x2977('0x11')]);});_0x2105d0=_0x2105d0['value'];}_0x2865ad['where']=_[_0x2977('0x3b')](_0x2865ad['where'],{'$or':_[_0x2977('0x17')](_0x610772,function(_0x2ec2a6){if(_0x2ec2a6[_0x2977('0xb')]!==_0x2977('0x3c')){if(_0x494cd2){return sequelize['where'](sequelize['fn'](_0x2977('0x3d'),sequelize[_0x2977('0x18')](_0x2ec2a6[_0x2977('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x292917['query']['filter']+'%')});}else{var _0x2b8a7b={};_0x2b8a7b[_0x2ec2a6[_0x2977('0x11')]]={'$like':'%'+_0x292917['query'][_0x2977('0x37')]+'%'};return _0x2b8a7b;}}})});}_0x2865ad=_[_0x2977('0x3b')]({},_0x2865ad,_0x292917[_0x2977('0x3e')]);return _0x2865ad;};exports['include']=function(_0x2dddfd){var _0x2a1eec=[];if(_0x2dddfd['includeAll']){_0x2a1eec[_0x2977('0x2d')]({'all':!![]});}else if(_0x2dddfd[_0x2977('0x3f')]){if(Array[_0x2977('0x13')](_0x2dddfd[_0x2977('0x3f')])){_0x2a1eec=Object[_0x2977('0x3')](_0x2dddfd['include'])['map'](function(_0x2a0386){return parseIncludeModel(_0x2dddfd[_0x2977('0x3f')][_0x2a0386]);});}else{var _0x2fe7e1=parseIncludeModel(_0x2dddfd['include']);_0x2a1eec[_0x2977('0x2d')](_0x2fe7e1);}}return _0x2a1eec;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index cf23660..a4d0aa0 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['findOne','getAgents','all','flatten','map','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','fullname','mailPause','openchannelPause','voicePause','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','pauseType','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','value','filterAgentAttributes','name','faxStatusTime','whatsappStatusTime','mailCurrentCapacity','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','chatPause','faxPause','smsPause','whatsappPause','every','filter','length','idle','unknown','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','busy','getAgentStatus','isArray','startCase','Queue'];(function(_0xd09b88,_0x4ea6c5){var _0x573ebc=function(_0x2b9288){while(--_0x2b9288){_0xd09b88['push'](_0xd09b88['shift']());}};_0x573ebc(++_0x4ea6c5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0x5fc3[_0x5f49c0];return _0x5ab653;};'use strict';var _=require(_0x35fc('0x0'));var jayson=require(_0x35fc('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x35fc('0x2')][_0x35fc('0x3')]({'port':0x232a});var routingClient=jayson[_0x35fc('0x2')][_0x35fc('0x3')]({'port':0x232c});function isAgentPaused(_0xb4f9ce,_0x5e75e6){var _0x2d1404=[_0xb4f9ce[_0x35fc('0x4')],_0xb4f9ce[_0x35fc('0x5')],_0xb4f9ce['mailPause'],_0xb4f9ce['openchannelPause'],_0xb4f9ce[_0x35fc('0x6')],_0xb4f9ce['voicePause'],_0xb4f9ce[_0x35fc('0x7')]];if(!_0x5e75e6)return _[_0x35fc('0x8')](_0x2d1404);var _0xc72d93=_[_0x35fc('0x9')](_0x2d1404);return _0xc72d93[_0x35fc('0xa')]>0x0&&_0xc72d93[_0x35fc('0xa')]<_0x2d1404[_0x35fc('0xa')]?!![]:![];}function isIdle(_0x565f95){return _0x565f95===_0x35fc('0xb')||_0x565f95===_0x35fc('0xc')||_0x565f95==='unavailable'||_0x565f95===_0x35fc('0xd')||_[_0x35fc('0xe')](_0x565f95);}function isAgentIdle(_0x5021d4){if(_0x5021d4[_0x35fc('0xf')]!==_0x35fc('0xb')&&_0x5021d4['voicePause']){_0x5021d4['voiceStatus']=_0x35fc('0x10');return![];}return _['every']([_0x5021d4[_0x35fc('0x11')],_0x5021d4[_0x35fc('0x12')],_0x5021d4[_0x35fc('0x13')],_0x5021d4[_0x35fc('0x14')],_0x5021d4[_0x35fc('0x15')],_0x5021d4['voiceStatus'],_0x5021d4['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x35fc('0x16')](function(_0x229d56){if(_0x229d56[_0x35fc('0x17')]){throw new Error(_0x35fc('0x18'));}var _0x227a49=_0x229d56[_0x35fc('0x19')];return routingClient['request'](_0x35fc('0x1a'),{})[_0x35fc('0x16')](function(_0x553677){if(_0x553677[_0x35fc('0x17')]){throw new Error(_0x35fc('0x1b'));}var _0x2e513b=_0x553677['result'];return _[_0x35fc('0x1c')]({},_0x227a49,_0x2e513b);});})[_0x35fc('0x1d')](function(_0x465eb3){throw _0x465eb3;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x402cff){var _0x350a27=_0x35fc('0xc');if(isAgentPaused(_0x402cff))_0x350a27=_0x35fc('0x10');else if(isAgentPaused(_0x402cff,!![]))_0x350a27=_0x35fc('0x1e');else if(isAgentIdle(_0x402cff))_0x350a27=_0x35fc('0xb');else _0x350a27=_0x35fc('0x1f');return _0x350a27;}exports[_0x35fc('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x2405e8,_0x427eae){var _0x5bd2b8=_[_0x35fc('0x21')](_0x2405e8)?_0x2405e8:[_0x2405e8];var _0xd5399f=_[_0x35fc('0x22')](_0x427eae)+_0x35fc('0x23');var _0x3b4743=_['map'](_0x5bd2b8,function(_0x33f5e8){return db[_0xd5399f][_0x35fc('0x24')]({'where':{'id':_0x33f5e8}})['then'](function(_0x265324){if(!_0x265324)return[];return _0x265324[_0x35fc('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x35fc('0x26')](_0x3b4743)['then'](function(_0x4086e9){var _0x598d7a=_(_0x4086e9)[_0x35fc('0x27')]()[_0x35fc('0x28')]('id')['uniq']()['value']();return _0x598d7a;});}exports[_0x35fc('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58edb6,_0x274208,_0x1a5d92){try{if(_0x274208['length']>0x0){_0x58edb6=_0x58edb6[_0x35fc('0x9')](function(_0x645eac){return _0x274208[_0x35fc('0x2a')](_0x645eac['id']);});}var _0x9f3c8a=_0x58edb6[_0x35fc('0x9')](function(_0x134dfa){var _0x11ccdb=_0x35fc('0x1f');if(isAgentIdle(_0x134dfa)){_0x11ccdb='idle';}return _0x11ccdb===_0x1a5d92;});return _[_0x35fc('0x28')](_0x9f3c8a,'id');}catch(_0x220931){throw _0x220931;}}exports[_0x35fc('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x52acc5,_0xe79f52,_0x16f067){return Promise[_0x35fc('0x2c')]()[_0x35fc('0x16')](function(){if(_0xe79f52[_0x35fc('0xa')]>0x0){_0x52acc5=_0x52acc5[_0x35fc('0x9')](function(_0x222ddb){return _0xe79f52[_0x35fc('0x2a')](_0x222ddb['id']);});}return _0x52acc5;})[_0x35fc('0x16')](function(){return db[_0x35fc('0x2d')]['findAll']({'attributes':['id','name',_0x35fc('0x2e'),'chatPause',_0x35fc('0x5'),_0x35fc('0x2f'),_0x35fc('0x30'),_0x35fc('0x6'),_0x35fc('0x31'),_0x35fc('0x7'),'pauseType'],'where':{'id':{'$in':_[_0x35fc('0x28')](_0x52acc5,'id')}},'raw':!![]});})[_0x35fc('0x16')](function(_0x46b9ef){return _0x46b9ef[_0x35fc('0x28')](function(_0x2bbd36){var _0x2f823b=_['find'](_0x52acc5,['id',_0x2bbd36['id']]);var _0x2483be=filterAgentAttributes(_0x2f823b);_[_0x35fc('0x1c')](_0x2bbd36,_0x2483be);_0x2bbd36[_0x35fc('0x32')]=getAgentStatus(_0x2bbd36);return _0x2bbd36;});})['then'](function(_0x2c657d){var _0x48d223=sortAgentsByStatus(_0x2c657d,_0x16f067);return _[_0x35fc('0x28')](_0x48d223,'id');})[_0x35fc('0x1d')](function(_0x266a11){throw _0x266a11;});}exports[_0x35fc('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4de4b7){var _0x54fcf1={'fields':[],'order':null};var _0x59e4fb=_0x4de4b7[_0x35fc('0x34')](',');_0x54fcf1['fields']=_[_0x35fc('0x9')](_0x59e4fb,function(_0x4b4d4a){if(!_0x4b4d4a[_0x35fc('0x2a')](_0x35fc('0x32'))){return!![];}_0x54fcf1[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x4b4d4a,'-')?_0x35fc('0x37'):_0x35fc('0x38');return![];});return _0x54fcf1;}exports[_0x35fc('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x4ec0dc){if(!_0x4ec0dc){_0x4ec0dc=_0x35fc('0x3a');}if(_0x4ec0dc[_0x35fc('0x2a')]('fullname')&&!_0x4ec0dc[_0x35fc('0x2a')](_0x35fc('0x3b'))){var _0x1aac67=_0x4ec0dc[_0x35fc('0x3c')](0x0,_0x4ec0dc[_0x35fc('0x3d')](_0x35fc('0x2e')));_0x4ec0dc+=','+_0x1aac67+'internal';}return _0x4ec0dc;}exports[_0x35fc('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x267858,_0x392806){var _0x52543b=_0x267858[_0x35fc('0x3f')](function(_0x350a96,_0x596919){if(_0x350a96[_0x35fc('0x32')]===_0x596919[_0x35fc('0x32')]){if(_0x350a96[_0x35fc('0x32')]===_0x35fc('0x10')){if(_0x392806===_0x35fc('0x37')){return(_0x350a96[_0x35fc('0x40')]||'')<(_0x596919[_0x35fc('0x40')]||'')||_0x350a96[_0x35fc('0x2e')]['toLowerCase']()>_0x596919['fullname'][_0x35fc('0x41')]()?0x1:-0x1;}else{return(_0x350a96[_0x35fc('0x40')]||'')<(_0x596919['pauseType']||'')||_0x350a96['fullname']['toLowerCase']()>_0x596919[_0x35fc('0x2e')][_0x35fc('0x41')]()?-0x1:0x1;}}else{if(_0x392806==='DESC'){return _0x350a96[_0x35fc('0x2e')][_0x35fc('0x41')]()<_0x596919[_0x35fc('0x2e')][_0x35fc('0x41')]()?0x1:-0x1;}else{return _0x350a96['fullname']['toLowerCase']()<_0x596919['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x392806==='DESC'){return _0x350a96[_0x35fc('0x32')]<_0x596919[_0x35fc('0x32')]?0x1:-0x1;}else{return _0x350a96['globalStatus']<_0x596919[_0x35fc('0x32')]?-0x1:0x1;}}});return _0x52543b;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x13d16c){var _0x40797d=[_0x35fc('0x42'),_0x35fc('0x43'),_0x35fc('0x44'),'lastPauseAt',_0x35fc('0x40'),_0x35fc('0x45'),'internal',_0x35fc('0x46'),_0x35fc('0x4'),_0x35fc('0x30'),_0x35fc('0x2f'),'smsPause',_0x35fc('0x7'),'faxPause','voicePause',_0x35fc('0x47'),_0x35fc('0x48'),_0x35fc('0x49'),_0x35fc('0x4a'),_0x35fc('0x4b'),_0x35fc('0x4c'),_0x35fc('0x4d'),_0x35fc('0x4e'),'mailCurrentCapacity',_0x35fc('0x4f'),_0x35fc('0x50'),_0x35fc('0x51'),_0x35fc('0x11'),_0x35fc('0x14'),_0x35fc('0x13'),_0x35fc('0x15'),_0x35fc('0x52'),_0x35fc('0x12'),_0x35fc('0xf'),_0x35fc('0x53'),_0x35fc('0x54'),_0x35fc('0x55'),_0x35fc('0x56'),'whatsappStatusTime','faxStatusTime',_0x35fc('0x57'),_0x35fc('0x58'),_0x35fc('0x59'),_0x35fc('0x5a'),_0x35fc('0x5b'),_0x35fc('0x5c'),'routealias'];var _0x4f024c=[_0x35fc('0x4'),_0x35fc('0x30'),_0x35fc('0x2f'),_0x35fc('0x6'),'whatsappPause',_0x35fc('0x5'),_0x35fc('0x31'),'online'];var _0x199a00=_(_0x13d16c)[_0x35fc('0x5d')](_0x4f024c)['pick'](_0x40797d)[_0x35fc('0x5e')]();return _0x199a00;}exports[_0x35fc('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x35fc('0x60'),_0x35fc('0x2e'),'role','internal','online',_0x35fc('0x32'),_0x35fc('0x42'),'lastLoginAt',_0x35fc('0x40'),_0x35fc('0x45'),_0x35fc('0x5'),_0x35fc('0x4'),_0x35fc('0x2f'),'openchannelPause',_0x35fc('0x6'),_0x35fc('0x31'),_0x35fc('0x7'),'chatStatus',_0x35fc('0x12'),_0x35fc('0x13'),'openchannelStatus',_0x35fc('0x15'),_0x35fc('0xf'),_0x35fc('0x52'),_0x35fc('0x53'),_0x35fc('0x61'),_0x35fc('0x55'),_0x35fc('0x54'),_0x35fc('0x56'),'voiceStatusTime',_0x35fc('0x62'),_0x35fc('0x47'),_0x35fc('0x4c'),'mailCapacity',_0x35fc('0x48'),'smsCapacity','whatsappCapacity','chatCurrentCapacity',_0x35fc('0x51'),_0x35fc('0x63'),_0x35fc('0x4e'),_0x35fc('0x4f'),_0x35fc('0x50'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold','queue',_0x35fc('0x64'),_0x35fc('0x5a')];}exports[_0x35fc('0x65')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x9957=['sort','toLowerCase','userpic','online','lastPauseAt','address','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','name','role','lastLoginAt','whatsappPause','mailStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','chatCapacity','mailCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','filter','getAgentIdsByStatus','includes','User','findAll','fullname','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var db=require(_0x7995('0x2'))['db'];var amiClient=jayson[_0x7995('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x7995('0x3')][_0x7995('0x4')]({'port':0x232c});function isAgentPaused(_0x1902b4,_0x462a03){var _0x576d89=[_0x1902b4[_0x7995('0x5')],_0x1902b4[_0x7995('0x6')],_0x1902b4[_0x7995('0x7')],_0x1902b4[_0x7995('0x8')],_0x1902b4[_0x7995('0x9')],_0x1902b4[_0x7995('0xa')],_0x1902b4['whatsappPause']];if(!_0x462a03)return _[_0x7995('0xb')](_0x576d89);var _0x1cad37=_['filter'](_0x576d89);return _0x1cad37[_0x7995('0xc')]>0x0&&_0x1cad37[_0x7995('0xc')]<_0x576d89[_0x7995('0xc')]?!![]:![];}function isIdle(_0x35b5fe){return _0x35b5fe===_0x7995('0xd')||_0x35b5fe===_0x7995('0xe')||_0x35b5fe===_0x7995('0xf')||_0x35b5fe==='ringing'||_[_0x7995('0x10')](_0x35b5fe);}function isAgentIdle(_0x41c652){if(_0x41c652['voiceStatus']!==_0x7995('0xd')&&_0x41c652[_0x7995('0xa')]){_0x41c652[_0x7995('0x11')]=_0x7995('0x12');return![];}return _[_0x7995('0xb')]([_0x41c652[_0x7995('0x13')],_0x41c652[_0x7995('0x14')],_0x41c652['mailStatus'],_0x41c652['openchannelStatus'],_0x41c652[_0x7995('0x15')],_0x41c652[_0x7995('0x11')],_0x41c652[_0x7995('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x2202ce){if(_0x2202ce[_0x7995('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2eeacc=_0x2202ce['result'];return routingClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x291317){if(_0x291317[_0x7995('0x1a')]){throw new Error(_0x7995('0x1b'));}var _0x4faa60=_0x291317['result'];return _[_0x7995('0x1c')]({},_0x2eeacc,_0x4faa60);});})['catch'](function(_0x555f74){throw _0x555f74;});}exports[_0x7995('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3d463e){var _0x4cbe10=_0x7995('0xe');if(isAgentPaused(_0x3d463e))_0x4cbe10='pause';else if(isAgentPaused(_0x3d463e,!![]))_0x4cbe10='*pause';else if(isAgentIdle(_0x3d463e))_0x4cbe10=_0x7995('0xd');else _0x4cbe10=_0x7995('0x1e');return _0x4cbe10;}exports[_0x7995('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x1a8568,_0x460924){var _0x1c278a=_['isArray'](_0x1a8568)?_0x1a8568:[_0x1a8568];var _0x32a09a=_[_0x7995('0x20')](_0x460924)+_0x7995('0x21');var _0x285437=_[_0x7995('0x22')](_0x1c278a,function(_0x13bc35){return db[_0x32a09a][_0x7995('0x23')]({'where':{'id':_0x13bc35}})[_0x7995('0x19')](function(_0x59405a){if(!_0x59405a)return[];return _0x59405a[_0x7995('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7995('0x25')](_0x285437)[_0x7995('0x19')](function(_0x268ce7){var _0x3a3fcf=_(_0x268ce7)[_0x7995('0x26')]()['map']('id')[_0x7995('0x27')]()['value']();return _0x3a3fcf;});}exports[_0x7995('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x49bc7e,_0xf16cc2,_0x132a42){try{if(_0xf16cc2[_0x7995('0xc')]>0x0){_0x49bc7e=_0x49bc7e['filter'](function(_0x9b2a15){return _0xf16cc2['includes'](_0x9b2a15['id']);});}var _0x456a28=_0x49bc7e[_0x7995('0x29')](function(_0x4253e5){var _0x574574='busy';if(isAgentIdle(_0x4253e5)){_0x574574='idle';}return _0x574574===_0x132a42;});return _[_0x7995('0x22')](_0x456a28,'id');}catch(_0xe6b0b3){throw _0xe6b0b3;}}exports[_0x7995('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b874d,_0x2e3493,_0x1ca460){return Promise['resolve']()['then'](function(){if(_0x2e3493[_0x7995('0xc')]>0x0){_0x2b874d=_0x2b874d['filter'](function(_0x553671){return _0x2e3493[_0x7995('0x2b')](_0x553671['id']);});}return _0x2b874d;})[_0x7995('0x19')](function(){return db[_0x7995('0x2c')][_0x7995('0x2d')]({'attributes':['id','name',_0x7995('0x2e'),_0x7995('0x5'),'faxPause','mailPause','openchannelPause',_0x7995('0x9'),_0x7995('0xa'),'whatsappPause',_0x7995('0x2f')],'where':{'id':{'$in':_['map'](_0x2b874d,'id')}},'raw':!![]});})[_0x7995('0x19')](function(_0x1cb058){return _0x1cb058[_0x7995('0x22')](function(_0x5014d2){var _0x52d76d=_[_0x7995('0x30')](_0x2b874d,['id',_0x5014d2['id']]);var _0x5e67fe=filterAgentAttributes(_0x52d76d);_['merge'](_0x5014d2,_0x5e67fe);_0x5014d2[_0x7995('0x31')]=getAgentStatus(_0x5014d2);return _0x5014d2;});})[_0x7995('0x19')](function(_0x5212ff){var _0x1baa15=sortAgentsByStatus(_0x5212ff,_0x1ca460);return _[_0x7995('0x22')](_0x1baa15,'id');})[_0x7995('0x32')](function(_0x18667c){throw _0x18667c;});}exports[_0x7995('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x53002a){var _0x2d4285={'fields':[],'order':null};var _0x242713=_0x53002a[_0x7995('0x34')](',');_0x2d4285[_0x7995('0x35')]=_['filter'](_0x242713,function(_0x2be2c0){if(!_0x2be2c0[_0x7995('0x2b')](_0x7995('0x31'))){return!![];}_0x2d4285[_0x7995('0x36')]=_[_0x7995('0x37')](_0x2be2c0,'-')?_0x7995('0x38'):'ASC';return![];});return _0x2d4285;}exports[_0x7995('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x3be298){if(!_0x3be298){_0x3be298=_0x7995('0x3a');}if(_0x3be298[_0x7995('0x2b')](_0x7995('0x2e'))&&!_0x3be298[_0x7995('0x2b')](_0x7995('0x3b'))){var _0x270c0e=_0x3be298[_0x7995('0x3c')](0x0,_0x3be298[_0x7995('0x3d')](_0x7995('0x2e')));_0x3be298+=','+_0x270c0e+_0x7995('0x3b');}return _0x3be298;}exports[_0x7995('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x53cda2,_0x50a98e){var _0x334dff=_0x53cda2[_0x7995('0x3f')](function(_0x58523e,_0x4b0855){if(_0x58523e[_0x7995('0x31')]===_0x4b0855['globalStatus']){if(_0x58523e['globalStatus']===_0x7995('0x12')){if(_0x50a98e===_0x7995('0x38')){return(_0x58523e[_0x7995('0x2f')]||'')<(_0x4b0855['pauseType']||'')||_0x58523e[_0x7995('0x2e')]['toLowerCase']()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x58523e['pauseType']||'')<(_0x4b0855[_0x7995('0x2f')]||'')||_0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x50a98e===_0x7995('0x38')){return _0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()<_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x58523e['fullname'][_0x7995('0x40')]()<_0x4b0855['fullname'][_0x7995('0x40')]()?-0x1:0x1;}}}else{if(_0x50a98e==='DESC'){return _0x58523e[_0x7995('0x31')]<_0x4b0855['globalStatus']?0x1:-0x1;}else{return _0x58523e[_0x7995('0x31')]<_0x4b0855[_0x7995('0x31')]?-0x1:0x1;}}});return _0x334dff;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3e9e62){var _0x336ff2=[_0x7995('0x41'),_0x7995('0x42'),'lastLoginAt',_0x7995('0x43'),_0x7995('0x2f'),_0x7995('0x43'),'internal',_0x7995('0x44'),_0x7995('0x5'),_0x7995('0x8'),_0x7995('0x7'),_0x7995('0x9'),'whatsappPause',_0x7995('0x6'),_0x7995('0xa'),'chatCapacity',_0x7995('0x45'),'mailCapacity',_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x48'),_0x7995('0x49'),_0x7995('0x4a'),_0x7995('0x4b'),_0x7995('0x4c'),'whatsappCurrentCapacity',_0x7995('0x4d'),_0x7995('0x13'),_0x7995('0x4e'),'mailStatus',_0x7995('0x15'),_0x7995('0x16'),_0x7995('0x14'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0x7995('0x4f'),_0x7995('0x50'),'whatsappStatusTime',_0x7995('0x51'),_0x7995('0x52'),_0x7995('0x53'),_0x7995('0x54'),_0x7995('0x55'),'phoneBarEnableScreenRecordingByAgent',_0x7995('0x56'),'routealias'];var _0x14fe7f=[_0x7995('0x5'),_0x7995('0x8'),'mailPause','smsPause','whatsappPause','faxPause',_0x7995('0xa'),_0x7995('0x42')];var _0x1a861c=_(_0x3e9e62)[_0x7995('0x57')](_0x14fe7f)[_0x7995('0x58')](_0x336ff2)[_0x7995('0x59')]();return _0x1a861c;}exports[_0x7995('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7995('0x5b'),_0x7995('0x2e'),_0x7995('0x5c'),_0x7995('0x3b'),_0x7995('0x42'),_0x7995('0x31'),_0x7995('0x41'),_0x7995('0x5d'),_0x7995('0x2f'),_0x7995('0x43'),_0x7995('0x6'),_0x7995('0x5'),'mailPause',_0x7995('0x8'),_0x7995('0x9'),_0x7995('0xa'),_0x7995('0x5e'),'chatStatus','faxStatus',_0x7995('0x5f'),_0x7995('0x4e'),_0x7995('0x15'),_0x7995('0x11'),'whatsappStatus',_0x7995('0x60'),_0x7995('0x51'),_0x7995('0x4f'),_0x7995('0x61'),'smsStatusTime','voiceStatusTime',_0x7995('0x62'),_0x7995('0x63'),_0x7995('0x48'),_0x7995('0x64'),_0x7995('0x45'),_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x49'),_0x7995('0x4d'),'mailCurrentCapacity',_0x7995('0x4a'),_0x7995('0x4c'),_0x7995('0x65'),_0x7995('0x66'),'phoneBarEnableAutomaticScreenRecording','destconnectedlinenum',_0x7995('0x67'),_0x7995('0x53'),'routealias',_0x7995('0x55')];}exports[_0x7995('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 1e73887..b7ed615 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ab0=['invalid','onHold','ringing','talking','unavailable','unknown','message','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','map','get','available','busy','outbound','pTalking','originated','find','pick','initializeQueues','lodash','client','http','loggedIn','paused','waiting','inUse'];(function(_0x4d2e86,_0x26c307){var _0x24d1bc=function(_0x58dc11){while(--_0x58dc11){_0x4d2e86['push'](_0x4d2e86['shift']());}};_0x24d1bc(++_0x26c307);}(_0x8ab0,0x1b2));var _0x08ab=function(_0x1f35da,_0x50e571){_0x1f35da=_0x1f35da-0x0;var _0x4f2f21=_0x8ab0[_0x1f35da];return _0x4f2f21;};'use strict';var _=require(_0x08ab('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson[_0x08ab('0x1')][_0x08ab('0x2')]({'port':0x232a});var routingClient=jayson[_0x08ab('0x1')][_0x08ab('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x08ab('0x3'),_0x08ab('0x4'),_0x08ab('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x08ab('0x6'),_0x08ab('0x7'),'loggedInDb','notInUse',_0x08ab('0x8'),_0x08ab('0x9'),'ringInUse',_0x08ab('0xa'),_0x08ab('0xb'),_0x08ab('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0x08ab('0xd'),_0x08ab('0xe'),_0x08ab('0xf'),'dialMethod',_0x08ab('0x10'),_0x08ab('0x11'),_0x08ab('0x12'),_0x08ab('0x13'),'erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor',_0x08ab('0x14'),'dialPredictiveIntervalMaxThreshold',_0x08ab('0x15'),_0x08ab('0x16'),_0x08ab('0x17'),_0x08ab('0x18'),_0x08ab('0x19'),'predictiveIntervalDroppedCallsCallersExit',_0x08ab('0x1a'),_0x08ab('0x1b')];function getRealtimeQueues(_0x19c64d,_0x1f352f){var _0x53b7cb=_0x1f352f===_0x08ab('0x1c')?amiClient:routingClient;return _0x53b7cb[_0x08ab('0x1d')](_[_0x08ab('0x1e')](_0x1f352f)+_0x08ab('0x1f'),_0x19c64d)['then'](function(_0x401cbf){if(_0x401cbf[_0x08ab('0x20')])throw new Error(util[_0x08ab('0x21')](_0x08ab('0x22'),_0x1f352f));return _0x401cbf[_0x08ab('0x23')];})['catch'](function(_0x44c211){throw _0x44c211;});}exports[_0x08ab('0x24')]=getRealtimeQueues;function initializeQueues(_0x312010,_0x4bdc67,_0xd1d345,_0x5d9260){var _0x15635f=DEFAULT_QUEUE_ATTRIBUTES;if(_0xd1d345==='voice'){if(_0x5d9260===_0x08ab('0x25')){_0x15635f=_0x15635f[_0x08ab('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5d9260==='outbound'){_0x15635f=_0x15635f[_0x08ab('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x312010[_0x08ab('0x27')](function(_0x33fa0b){var _0x374cf2=_0x33fa0b[_0x08ab('0x28')]({'plain':!![]});_0x374cf2[_0x08ab('0x4')]=0x0;_0x374cf2['loggedInDb']=0x0;_0x374cf2[_0x08ab('0x3')]=0x0;_0x374cf2[_0x08ab('0x29')]=0x0;_0x374cf2[_0x08ab('0x5')]=0x0;if(_0xd1d345===_0x08ab('0x1c')){_0x374cf2['talking']=0x0;_0x374cf2[_0x08ab('0x2a')]=0x0;if(_0x5d9260===_0x08ab('0x2b')){_0x374cf2[_0x08ab('0x2c')]=0x0;_0x374cf2[_0x08ab('0x2d')]=0x0;}}var _0x375245=_[_0x08ab('0x2e')](_0x4bdc67,['id',_0x374cf2['id']]);if(_0x375245){_['merge'](_0x374cf2,_[_0x08ab('0x2f')](_0x375245,_0x15635f));}return _0x374cf2;});}exports[_0x08ab('0x30')]=initializeQueues; \ No newline at end of file +var _0xc88e=['dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','talking','busy','find','merge','pick','initializeQueues','jayson/promise','util','client','http','paused','waiting','inUse','loggedInDb','notInUse','onHold','ringInUse','unavailable','unknown','originated','message'];(function(_0x584308,_0x1379b3){var _0x45865b=function(_0x145a82){while(--_0x145a82){_0x584308['push'](_0x584308['shift']());}};_0x45865b(++_0x1379b3);}(_0xc88e,0x8d));var _0xec88=function(_0x152e48,_0x25f775){_0x152e48=_0x152e48-0x0;var _0x30b1a4=_0xc88e[_0x152e48];return _0x30b1a4;};'use strict';var _=require('lodash');var jayson=require(_0xec88('0x0'));var util=require(_0xec88('0x1'));var amiClient=jayson[_0xec88('0x2')][_0xec88('0x3')]({'port':0x232a});var routingClient=jayson[_0xec88('0x2')][_0xec88('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0xec88('0x4'),_0xec88('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xec88('0x6'),'invalid',_0xec88('0x7'),_0xec88('0x8'),_0xec88('0x9'),'ringing',_0xec88('0xa'),'talking',_0xec88('0xb'),_0xec88('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xec88('0xd'),_0xec88('0xe'),'statusMessage',_0xec88('0xf'),_0xec88('0x10'),_0xec88('0x11'),_0xec88('0x12'),_0xec88('0x13'),_0xec88('0x14'),_0xec88('0x15'),_0xec88('0x16'),_0xec88('0x17'),'dialPredictiveInterval',_0xec88('0x18'),_0xec88('0x19'),_0xec88('0x1a'),_0xec88('0x1b'),_0xec88('0x1c'),_0xec88('0x1d'),_0xec88('0x1e'),_0xec88('0x1f'),_0xec88('0x20')];function getRealtimeQueues(_0x144027,_0x456348){var _0x56db33=_0x456348===_0xec88('0x21')?amiClient:routingClient;return _0x56db33['request'](_[_0xec88('0x22')](_0x456348)+_0xec88('0x23'),_0x144027)[_0xec88('0x24')](function(_0x4ada54){if(_0x4ada54[_0xec88('0x25')])throw new Error(util[_0xec88('0x26')](_0xec88('0x27'),_0x456348));return _0x4ada54['result'];})[_0xec88('0x28')](function(_0x4db712){throw _0x4db712;});}exports[_0xec88('0x29')]=getRealtimeQueues;function initializeQueues(_0x5109d3,_0x3e9deb,_0x2c7a79,_0x49198a){var _0x234466=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2c7a79===_0xec88('0x21')){if(_0x49198a===_0xec88('0x2a')){_0x234466=_0x234466[_0xec88('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x49198a===_0xec88('0x2c')){_0x234466=_0x234466[_0xec88('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5109d3[_0xec88('0x2d')](function(_0x4e2f80){var _0x5ac125=_0x4e2f80['get']({'plain':!![]});_0x5ac125[_0xec88('0x4')]=0x0;_0x5ac125[_0xec88('0x7')]=0x0;_0x5ac125['loggedIn']=0x0;_0x5ac125['available']=0x0;_0x5ac125[_0xec88('0x5')]=0x0;if(_0x2c7a79===_0xec88('0x21')){_0x5ac125[_0xec88('0x2e')]=0x0;_0x5ac125[_0xec88('0x2f')]=0x0;if(_0x49198a===_0xec88('0x2c')){_0x5ac125['pTalking']=0x0;_0x5ac125['originated']=0x0;}}var _0x1e8041=_[_0xec88('0x30')](_0x3e9deb,['id',_0x5ac125['id']]);if(_0x1e8041){_[_0xec88('0x31')](_0x5ac125,_[_0xec88('0x32')](_0x1e8041,_0x234466));}return _0x5ac125;});}exports[_0xec88('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6e28bb8..fbb00ec 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(_0x3a544a,_0x73a217){var _0x342f1e=function(_0x519dce){while(--_0x519dce){_0x3a544a['push'](_0x3a544a['shift']());}};_0x342f1e(++_0x73a217);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 _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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 844bf41..c495ef2 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 _0x7098=['hostname','macAddress','ipAddress','md5','update','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','hex','platform','test','licenseToken','win32','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7098,0x1c3));var _0x8709=function(_0x3ca3be,_0x51ffc6){_0x3ca3be=_0x3ca3be-0x0;var _0xfb75b2=_0x7098[_0x3ca3be];return _0xfb75b2;};'use strict';var _=require(_0x8709('0x0'));var os=require('os');var crypto=require(_0x8709('0x1'));var machine=require(_0x8709('0x2'));var exec=require(_0x8709('0x3'))[_0x8709('0x4')];var config=require(_0x8709('0x5'));function getInterfaces(){var _0x6e7edc=[];var _0x58bdfa=os[_0x8709('0x6')]();var _0x4d5c20=_[_0x8709('0x7')](_[_0x8709('0x8')](_0x58bdfa));for(var _0x59196f=0x0;_0x59196f<_0x4d5c20['length'];_0x59196f++){var _0xca47de=_0x58bdfa[_0x4d5c20[_0x59196f]][_0x8709('0x9')](function(_0xe78563){return _0xe78563[_0x8709('0xa')]===_0x8709('0xb')&&_0xe78563['internal']===![];});_0x6e7edc=_0x6e7edc[_0x8709('0xc')](_0xca47de);}return _0x6e7edc;}function getFirstInterface(){var _0x4f2db9=_[_0x8709('0xd')](getInterfaces());return{'macAddress':_0x4f2db9&&_0x4f2db9[_0x8709('0xe')]?_0x4f2db9[_0x8709('0xe')]:_0x8709('0xf'),'ipAddress':_0x4f2db9&&_0x4f2db9[_0x8709('0x10')]?_0x4f2db9[_0x8709('0x10')]:_0x8709('0x11')};}exports[_0x8709('0x12')]=getFirstInterface;function getCPUhash(){var _0x55f715=_[_0x8709('0x7')](os[_0x8709('0x13')]()[_0x8709('0x14')](function(_0x43d985){return _0x43d985[_0x8709('0x15')];}))[_0x8709('0x16')](':');return crypto[_0x8709('0x17')]('md5')['update'](_0x55f715)['digest'](_0x8709('0x18'));}exports['getUuid']=function(){var _0x50bc65=os[_0x8709('0x19')]();var _0xd253b3=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0xd253b3[_0x8709('0x1a')](config['licenseToken'])){return config[_0x8709('0x1b')];}else if(_0x50bc65===_0x8709('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x8709('0x1d')]('\x0d\x0a','');}else{var _0x883c0a=getFirstInterface();var _0x168696=getCPUhash();var _0x3ef0b9=_0x168696+'|'+os[_0x8709('0x1e')]()+'|'+_0x883c0a[_0x8709('0x1f')]+'|'+_0x883c0a[_0x8709('0x20')];var _0x3caf9e=crypto[_0x8709('0x17')](_0x8709('0x21'))[_0x8709('0x22')](_0x3ef0b9)[_0x8709('0x23')]('hex');return _0x3caf9e[_0x8709('0x24')](0x0,0x8)+'-'+_0x3caf9e['substring'](0x8,0xc)+'-'+_0x3caf9e[_0x8709('0x24')](0xc,0x10)+'-'+_0x3caf9e[_0x8709('0x24')](0x10,0x14)+'-'+_0x3caf9e[_0x8709('0x24')](0x14);}}; \ No newline at end of file +var _0xd996=['orderBy','keys','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','map','model','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces'];(function(_0x298c58,_0x3e4795){var _0x513c38=function(_0x9e4e19){while(--_0x9e4e19){_0x298c58['push'](_0x298c58['shift']());}};_0x513c38(++_0x3e4795);}(_0xd996,0xfb));var _0x6d99=function(_0x2f0bed,_0x4911f1){_0x2f0bed=_0x2f0bed-0x0;var _0x31fa87=_0xd996[_0x2f0bed];return _0x31fa87;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x6d99('0x0'));var machine=require(_0x6d99('0x1'));var exec=require('child_process')[_0x6d99('0x2')];var config=require(_0x6d99('0x3'));function getInterfaces(){var _0x20c08c=[];var _0x53bffd=os[_0x6d99('0x4')]();var _0x319f87=_[_0x6d99('0x5')](_[_0x6d99('0x6')](_0x53bffd));for(var _0x5c3670=0x0;_0x5c3670<_0x319f87['length'];_0x5c3670++){var _0x488db6=_0x53bffd[_0x319f87[_0x5c3670]][_0x6d99('0x7')](function(_0x761d8e){return _0x761d8e[_0x6d99('0x8')]===_0x6d99('0x9')&&_0x761d8e[_0x6d99('0xa')]===![];});_0x20c08c=_0x20c08c[_0x6d99('0xb')](_0x488db6);}return _0x20c08c;}function getFirstInterface(){var _0x211117=_[_0x6d99('0xc')](getInterfaces());return{'macAddress':_0x211117&&_0x211117[_0x6d99('0xd')]?_0x211117[_0x6d99('0xd')]:'00:00:00:00:00:00','ipAddress':_0x211117&&_0x211117[_0x6d99('0xe')]?_0x211117[_0x6d99('0xe')]:_0x6d99('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4897f0=_[_0x6d99('0x5')](os['cpus']()[_0x6d99('0x10')](function(_0x1495a1){return _0x1495a1[_0x6d99('0x11')];}))['join'](':');return crypto['createHash']('md5')[_0x6d99('0x12')](_0x4897f0)[_0x6d99('0x13')](_0x6d99('0x14'));}exports[_0x6d99('0x15')]=function(){var _0x258a2f=os[_0x6d99('0x16')]();var _0xce7e02=/[0-9a-f-]{36}/;if(config[_0x6d99('0x17')]&&_0xce7e02[_0x6d99('0x18')](config['licenseToken'])){return config[_0x6d99('0x17')];}else if(_0x258a2f===_0x6d99('0x19')){return exec(_0x6d99('0x1a'),{'encoding':_0x6d99('0x1b')})['replace']('\x0d\x0a','');}else{var _0x15e8be=getFirstInterface();var _0x37b1eb=getCPUhash();var _0x110e13=_0x37b1eb+'|'+os[_0x6d99('0x1c')]()+'|'+_0x15e8be[_0x6d99('0x1d')]+'|'+_0x15e8be[_0x6d99('0x1e')];var _0x322b28=crypto['createHash']('md5')[_0x6d99('0x12')](_0x110e13)[_0x6d99('0x13')](_0x6d99('0x14'));return _0x322b28['substring'](0x0,0x8)+'-'+_0x322b28['substring'](0x8,0xc)+'-'+_0x322b28[_0x6d99('0x1f')](0xc,0x10)+'-'+_0x322b28['substring'](0x10,0x14)+'-'+_0x322b28[_0x6d99('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 545c055..8442f75 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 _0xc18a=['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','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','data2','active','info'];(function(_0x5266e7,_0x97b16b){var _0x5470f1=function(_0x10258e){while(--_0x10258e){_0x5266e7['push'](_0x5266e7['shift']());}};_0x5470f1(++_0x97b16b);}(_0xc18a,0x199));var _0xac18=function(_0x5201a9,_0x4250dc){_0x5201a9=_0x5201a9-0x0;var _0xaa7d8b=_0xc18a[_0x5201a9];return _0xaa7d8b;};'use strict';var util=require(_0xac18('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xac18('0x1'));var pkginfo=require(_0xac18('0x2'))(module,_0xac18('0x3'));var db=require(_0xac18('0x4'))['db'];var encryptor=require(_0xac18('0x5'));var hardware=require('./hardware');var logger=require(_0xac18('0x6'))(_0xac18('0x7'));var HOST=_0xac18('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4573e0){return new BPromise(function(_0x391edb,_0x5b6484){var _0x43256f=util[_0xac18('0x9')](_0xac18('0xa'),HOST,_0x4573e0,module['exports'][_0xac18('0x3')]);if(oldToken){_0x43256f=util[_0xac18('0x9')](_0xac18('0xb'),HOST,_0x4573e0,module[_0xac18('0xc')][_0xac18('0x3')],oldToken);}var _0x5188ba={'uri':_0x43256f,'method':_0xac18('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5188ba)[_0xac18('0xe')](function(_0xbc64f5){_0x391edb(_0xbc64f5);})[_0xac18('0xf')](function(_0x59bd4c){_0x5b6484(_0x59bd4c);});});}function manageLicense(_0x4042b2,_0x2fddc3){var _0x1766a0=_0x2fddc3[_0xac18('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x1766a0[_0xac18('0x11')]!==_0x4042b2&&!_0x1766a0[_0xac18('0x12')]){oldToken=_0x1766a0[_0xac18('0x11')];}httpRequest(_0x4042b2)[_0xac18('0xe')](function(_0x241b5e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x241b5e[_0xac18('0x13')]){isOldTokenSent=![];if(!_0x1766a0['license']&&_0x1766a0[_0xac18('0x7')]!=_0x241b5e['license']||_0x1766a0[_0xac18('0x7')]&&_0x1766a0['data2']){logger[_0xac18('0x14')](_0xac18('0x15'));}if(_0x1766a0[_0xac18('0x7')]&&!_0x1766a0['data2']&&_0x1766a0['license']!=_0x241b5e[_0xac18('0x7')]){logger[_0xac18('0x14')](_0xac18('0x16'));}if(_0x1766a0[_0xac18('0x7')]&&!_0x1766a0[_0xac18('0x12')]&&_0x1766a0[_0xac18('0x7')]==_0x241b5e[_0xac18('0x7')]){return _0x2fddc3;}return _0x2fddc3[_0xac18('0x17')]({'data1':_0x4042b2,'data2':null,'license':_0x241b5e[_0xac18('0x7')]});}else{if(_0x241b5e[_0xac18('0x7')]||_0x1766a0['license']){if(!_0x1766a0[_0xac18('0x12')]){if(_0x1766a0['data1']==_0x4042b2){GRAY_PERIOD_REASON=_0xac18('0x18');logger['info'](_0xac18('0x19'));}else{GRAY_PERIOD_REASON=_0xac18('0x1a');logger[_0xac18('0x14')](_0xac18('0x1b'),_0x1766a0[_0xac18('0x11')],_0x4042b2);}logger[_0xac18('0x14')](_0xac18('0x1c'),GRAY_PERIOD_REASON[_0xac18('0x1d')](),moment()['format'](_0xac18('0x1e')));return _0x2fddc3[_0xac18('0x17')]({'data2':encryptor[_0xac18('0x1f')](moment()[_0xac18('0x9')](_0xac18('0x1e')))});}else{if(moment()[_0xac18('0x20')](encryptor[_0xac18('0x21')](_0x1766a0[_0xac18('0x12')]),_0xac18('0x22'))>DAYS){logger[_0xac18('0x14')](_0xac18('0x23'),moment()[_0xac18('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2fddc3['update']({'data1':_0x4042b2,'data2':null,'license':null});}}}else{if(_0x1766a0[_0xac18('0x11')]!=_0x4042b2){logger[_0xac18('0x14')](_0xac18('0x1b'),_0x1766a0['data1'],_0x4042b2);return _0x2fddc3['update']({'data1':_0x4042b2,'data2':null,'license':null});}}}return _0x2fddc3;})['then'](function(_0x2be98e){_0x2fddc3=_0x2be98e;})[_0xac18('0xf')](function(_0x5cd31c){logger[_0xac18('0x24')](_0x5cd31c[_0xac18('0x25')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xac18('0x26')](),_0x2fddc3);},TIME);});}function defaultLicense(){var _0x5b5e86=hardware[_0xac18('0x26')]();if(_0x5b5e86){return db['License'][_0xac18('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x5b5e86}})[_0xac18('0x28')](function(_0x15c7e8,_0x21f3dd){logger[_0xac18('0x14')](_0xac18('0x29'),_0x5b5e86);manageLicense(_0x5b5e86,_0x15c7e8);})[_0xac18('0xf')](function(_0x9f3d99){logger[_0xac18('0x24')](_0x9f3d99[_0xac18('0x25')]);});}}exports[_0xac18('0x2a')]=defaultLicense; \ No newline at end of file +var _0x19e2=['https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x19e2,0x1ef));var _0x219e=function(_0x2a217b,_0xb039df){_0x2a217b=_0x2a217b-0x0;var _0x29a6ac=_0x19e2[_0x2a217b];return _0x29a6ac;};'use strict';var util=require(_0x219e('0x0'));var moment=require(_0x219e('0x1'));var rp=require(_0x219e('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x219e('0x3'))(module,'version');var db=require(_0x219e('0x4'))['db'];var encryptor=require(_0x219e('0x5'));var hardware=require(_0x219e('0x6'));var logger=require(_0x219e('0x7'))(_0x219e('0x8'));var HOST=_0x219e('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x48a0be){return new BPromise(function(_0x2fe781,_0x2fe1c6){var _0x2e5712=util['format'](_0x219e('0xa'),HOST,_0x48a0be,module[_0x219e('0xb')][_0x219e('0xc')]);if(oldToken){_0x2e5712=util['format'](_0x219e('0xd'),HOST,_0x48a0be,module[_0x219e('0xb')]['version'],oldToken);}var _0x73fb47={'uri':_0x2e5712,'method':_0x219e('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x73fb47)[_0x219e('0xf')](function(_0x33c4f5){_0x2fe781(_0x33c4f5);})[_0x219e('0x10')](function(_0x413485){_0x2fe1c6(_0x413485);});});}function manageLicense(_0x21a904,_0x573c35){var _0x1333aa=_0x573c35[_0x219e('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x1333aa[_0x219e('0x12')]!==_0x21a904&&!_0x1333aa[_0x219e('0x13')]){oldToken=_0x1333aa[_0x219e('0x12')];}httpRequest(_0x21a904)[_0x219e('0xf')](function(_0x386e05){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x386e05[_0x219e('0x14')]){isOldTokenSent=![];if(!_0x1333aa['license']&&_0x1333aa[_0x219e('0x8')]!=_0x386e05[_0x219e('0x8')]||_0x1333aa[_0x219e('0x8')]&&_0x1333aa[_0x219e('0x13')]){logger[_0x219e('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1333aa[_0x219e('0x8')]&&!_0x1333aa[_0x219e('0x13')]&&_0x1333aa['license']!=_0x386e05['license']){logger['info'](_0x219e('0x16'));}if(_0x1333aa[_0x219e('0x8')]&&!_0x1333aa[_0x219e('0x13')]&&_0x1333aa[_0x219e('0x8')]==_0x386e05[_0x219e('0x8')]){return _0x573c35;}return _0x573c35['update']({'data1':_0x21a904,'data2':null,'license':_0x386e05['license']});}else{if(_0x386e05[_0x219e('0x8')]||_0x1333aa['license']){if(!_0x1333aa['data2']){if(_0x1333aa[_0x219e('0x12')]==_0x21a904){GRAY_PERIOD_REASON='Disabled';logger[_0x219e('0x15')](_0x219e('0x17'));}else{GRAY_PERIOD_REASON=_0x219e('0x18');logger[_0x219e('0x15')](_0x219e('0x19'),_0x1333aa[_0x219e('0x12')],_0x21a904);}logger[_0x219e('0x15')](_0x219e('0x1a'),GRAY_PERIOD_REASON[_0x219e('0x1b')](),moment()[_0x219e('0x1c')](_0x219e('0x1d')));return _0x573c35[_0x219e('0x1e')]({'data2':encryptor['encryptString'](moment()[_0x219e('0x1c')](_0x219e('0x1d')))});}else{if(moment()[_0x219e('0x1f')](encryptor[_0x219e('0x20')](_0x1333aa['data2']),_0x219e('0x21'))>DAYS){logger['info'](_0x219e('0x22'),moment()[_0x219e('0x1c')](_0x219e('0x1d')));isOldTokenSent=![];return _0x573c35[_0x219e('0x1e')]({'data1':_0x21a904,'data2':null,'license':null});}}}else{if(_0x1333aa['data1']!=_0x21a904){logger[_0x219e('0x15')](_0x219e('0x19'),_0x1333aa[_0x219e('0x12')],_0x21a904);return _0x573c35[_0x219e('0x1e')]({'data1':_0x21a904,'data2':null,'license':null});}}}return _0x573c35;})[_0x219e('0xf')](function(_0x574f96){_0x573c35=_0x574f96;})[_0x219e('0x10')](function(_0x4cf35a){logger[_0x219e('0x23')](_0x4cf35a['message']);})[_0x219e('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x219e('0x25')](),_0x573c35);},TIME);});}function defaultLicense(){var _0x53a560=hardware[_0x219e('0x25')]();if(_0x53a560){return db[_0x219e('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x53a560}})[_0x219e('0x27')](function(_0x2c2c5a,_0x358f8d){logger[_0x219e('0x15')](_0x219e('0x28'),_0x53a560);manageLicense(_0x53a560,_0x2c2c5a);})[_0x219e('0x10')](function(_0x53f979){logger['error'](_0x53f979['message']);});}}exports[_0x219e('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 65f0410..5051686 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 _0x4baf=['count','admin','telephone','users','forEach','pick','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','machineUuid','gray','days','grayReason','changed','disabled','message','User','findAll','role','COUNT','sequelize'];(function(_0x46198b,_0x2fe700){var _0x464d14=function(_0xde224f){while(--_0xde224f){_0x46198b['push'](_0x46198b['shift']());}};_0x464d14(++_0x2fe700);}(_0x4baf,0xb5));var _0xf4ba=function(_0x465cf5,_0x569415){_0x465cf5=_0x465cf5-0x0;var _0x1a2c15=_0x4baf[_0x465cf5];return _0x1a2c15;};'use strict';var util=require(_0xf4ba('0x0'));var _=require(_0xf4ba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0xf4ba('0x2'));var db=require(_0xf4ba('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf4ba('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf4ba('0x5'),'machineUuid':hardware[_0xf4ba('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf4ba('0x7'),'machineUuid':hardware[_0xf4ba('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x434df3){return new BPromise(function(_0x5b03c8,_0x1f9906){return db[_0xf4ba('0x8')]['find'](_[_0xf4ba('0x9')](_0x434df3,{'raw':!![],'where':{'id':0x1}}))[_0xf4ba('0xa')](function(_0x3b29b4){return checkLicense(_0x3b29b4,null);})[_0xf4ba('0xa')](function(_0x357460){_0x5b03c8(_0x357460);return;})[_0xf4ba('0xb')](function(_0x1a9629){_0x1f9906(_0x1a9629);});});}function checkLicense(_0x44d593,_0x5f46da){if(!_0x44d593){demoLicense[_0xf4ba('0xc')]=_0x44d593[_0xf4ba('0xd')];return demoLicense;}try{var _0x2c381f=_0x5f46da||_0x44d593[_0xf4ba('0xe')];if(_[_0xf4ba('0xf')](_0x2c381f)){throw new Error(_0xf4ba('0x10'));}var _0x1f2178=_0x44d593[_0xf4ba('0xd')];var _0x364a39=_0x44d593[_0xf4ba('0x11')];var _0x226b55=_0x1f2178[_0xf4ba('0x12')]('-')[0x4];var _0x43ab58=_0x1f2178[_0xf4ba('0x12')]('-')[0x0];var _0xe909e=encryptor[_0xf4ba('0x13')](_0x2c381f,util['format'](_0xf4ba('0x14'),_0x226b55,_0x1f2178,_0x43ab58));var _0x1503da=JSON[_0xf4ba('0x15')](_0xe909e);_0x1503da['demo']=![];_0x1503da['uuid']=_0x1f2178;_0x1503da[_0xf4ba('0x16')]=hardware['getUuid']();if(_0x364a39){var _0x5b8127=encryptor[_0xf4ba('0x13')](_0x364a39);_0x1503da[_0xf4ba('0x17')]=_0x5b8127;_0x1503da['deadline']=moment(_0x5b8127)['add'](0x7,_0xf4ba('0x18'))['format']();_0x1503da[_0xf4ba('0x19')]=_0x1503da[_0xf4ba('0xc')]!=_0x1503da['machineUuid']?_0xf4ba('0x1a'):_0xf4ba('0x1b');}return _0x1503da;}catch(_0x57a242){breakingLicense[_0xf4ba('0xc')]=_0x44d593['data1'];breakingLicense[_0xf4ba('0x1c')]=_0x57a242['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x195c97,_0x5937f7){getLicense()['then'](function(_0x4c3311){return db[_0xf4ba('0x1d')][_0xf4ba('0x1e')]({'attributes':[_0xf4ba('0x1f'),[db['sequelize']['fn'](_0xf4ba('0x20'),db[_0xf4ba('0x21')]['col'](_0xf4ba('0x1f'))),_0xf4ba('0x22')]],'group':_0xf4ba('0x1f'),'where':{'role':{'$or':[_0xf4ba('0x23'),'user',_0xf4ba('0x24')]}},'raw':!![]})[_0xf4ba('0xa')](function(_0x2de47f){var _0x1c3960={'user':_0x4c3311[_0xf4ba('0x25')]||0x0,'telephone':_0x4c3311['telephones']||0x0};_0x2de47f[_0xf4ba('0x26')](function(_0x534efa){var _0x3f7e7d=_0x534efa[_0xf4ba('0x1f')]===_0xf4ba('0x23')?'user':_0x534efa[_0xf4ba('0x1f')];_0x1c3960[_0x3f7e7d]-=_0x534efa[_0xf4ba('0x22')];if(_0x1c3960[_0x3f7e7d]<0x0)_0x1c3960[_0x3f7e7d]=0x0;});_0x195c97(_0x1c3960);return;});})['catch'](function(_0x3f5f73){_0x5937f7(_0x3f5f73);});});}function checkUserLimits(_0x3e4a33){return new BPromise(function(_0x4bacab,_0x2a1eea){getLimits()[_0xf4ba('0xa')](function(_0x33e11e){var _0x3b4d51=_[_0xf4ba('0x27')](_['countBy'](_0x3e4a33,_0xf4ba('0x1f')),[_0xf4ba('0x23'),_0xf4ba('0x28'),_0xf4ba('0x24')]);var _0x49facc=(_0x3b4d51[_0xf4ba('0x23')]||0x0)+(_0x3b4d51[_0xf4ba('0x28')]||0x0);var _0x1879a7=_0x3b4d51[_0xf4ba('0x24')]||0x0;if(_0x49facc>_0x33e11e['user'])return _0x2a1eea(_0xf4ba('0x29'));if(_0x1879a7>_0x33e11e[_0xf4ba('0x24')])return _0x2a1eea(_0xf4ba('0x2a'));return _0x4bacab();})[_0xf4ba('0xb')](function(_0x1d0cec){_0x2a1eea(_0x1d0cec);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x128d=['pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','decryptString','format','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','sequelize','count','admin','user','telephone','telephones','forEach','role'];(function(_0x2c699e,_0x5e9d6c){var _0x5844e3=function(_0x45b361){while(--_0x45b361){_0x2c699e['push'](_0x2c699e['shift']());}};_0x5844e3(++_0x5e9d6c);}(_0x128d,0xe0));var _0xd128=function(_0x404207,_0x44ed93){_0x404207=_0x404207-0x0;var _0x701bb=_0x128d[_0x404207];return _0x701bb;};'use strict';var util=require(_0xd128('0x0'));var _=require(_0xd128('0x1'));var moment=require(_0xd128('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xd128('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd128('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd128('0x5'),'machineUuid':hardware[_0xd128('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd128('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd128('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x51eaae){return new BPromise(function(_0x5b690f,_0x277689){return db[_0xd128('0x8')][_0xd128('0x9')](_[_0xd128('0xa')](_0x51eaae,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x59e5fe){return checkLicense(_0x59e5fe,null);})[_0xd128('0xb')](function(_0x34a71b){_0x5b690f(_0x34a71b);return;})[_0xd128('0xc')](function(_0x3594ad){_0x277689(_0x3594ad);});});}function checkLicense(_0x8ef7c6,_0x3718f5){if(!_0x8ef7c6){demoLicense[_0xd128('0xd')]=_0x8ef7c6[_0xd128('0xe')];return demoLicense;}try{var _0x18a5b3=_0x3718f5||_0x8ef7c6[_0xd128('0xf')];if(_[_0xd128('0x10')](_0x18a5b3)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x11b749=_0x8ef7c6['data1'];var _0xcbb642=_0x8ef7c6[_0xd128('0x11')];var _0x4ea876=_0x11b749['split']('-')[0x4];var _0x3fc441=_0x11b749[_0xd128('0x12')]('-')[0x0];var _0x370cbd=encryptor[_0xd128('0x13')](_0x18a5b3,util[_0xd128('0x14')]('%s:%s:%s',_0x4ea876,_0x11b749,_0x3fc441));var _0x2d8d82=JSON[_0xd128('0x15')](_0x370cbd);_0x2d8d82[_0xd128('0x16')]=![];_0x2d8d82['uuid']=_0x11b749;_0x2d8d82[_0xd128('0x17')]=hardware[_0xd128('0x6')]();if(_0xcbb642){var _0x14f9ff=encryptor[_0xd128('0x13')](_0xcbb642);_0x2d8d82[_0xd128('0x18')]=_0x14f9ff;_0x2d8d82[_0xd128('0x19')]=moment(_0x14f9ff)[_0xd128('0x1a')](0x7,_0xd128('0x1b'))[_0xd128('0x14')]();_0x2d8d82[_0xd128('0x1c')]=_0x2d8d82[_0xd128('0xd')]!=_0x2d8d82['machineUuid']?_0xd128('0x1d'):_0xd128('0x1e');}return _0x2d8d82;}catch(_0x48bc32){breakingLicense[_0xd128('0xd')]=_0x8ef7c6['data1'];breakingLicense[_0xd128('0x1f')]=_0x48bc32[_0xd128('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2e77d9,_0xdfb782){getLicense()[_0xd128('0xb')](function(_0x54b4d2){return db['User']['findAll']({'attributes':['role',[db[_0xd128('0x20')]['fn']('COUNT',db[_0xd128('0x20')]['col']('role')),_0xd128('0x21')]],'group':'role','where':{'role':{'$or':[_0xd128('0x22'),_0xd128('0x23'),_0xd128('0x24')]}},'raw':!![]})['then'](function(_0x3e046d){var _0x4992c1={'user':_0x54b4d2['users']||0x0,'telephone':_0x54b4d2[_0xd128('0x25')]||0x0};_0x3e046d[_0xd128('0x26')](function(_0x3d737){var _0x104beb=_0x3d737[_0xd128('0x27')]==='admin'?_0xd128('0x23'):_0x3d737[_0xd128('0x27')];_0x4992c1[_0x104beb]-=_0x3d737[_0xd128('0x21')];if(_0x4992c1[_0x104beb]<0x0)_0x4992c1[_0x104beb]=0x0;});_0x2e77d9(_0x4992c1);return;});})[_0xd128('0xc')](function(_0x25e583){_0xdfb782(_0x25e583);});});}function checkUserLimits(_0x4b82ba){return new BPromise(function(_0x1f15d9,_0x412418){getLimits()[_0xd128('0xb')](function(_0x1c25ad){var _0xb11954=_[_0xd128('0x28')](_['countBy'](_0x4b82ba,_0xd128('0x27')),[_0xd128('0x22'),'user',_0xd128('0x24')]);var _0x33d973=(_0xb11954[_0xd128('0x22')]||0x0)+(_0xb11954[_0xd128('0x23')]||0x0);var _0x59918a=_0xb11954['telephone']||0x0;if(_0x33d973>_0x1c25ad[_0xd128('0x23')])return _0x412418(_0xd128('0x29'));if(_0x59918a>_0x1c25ad['telephone'])return _0x412418(_0xd128('0x2a'));return _0x1f15d9();})[_0xd128('0xc')](function(_0x3e58e4){_0x412418(_0x3e58e4);});});}module[_0xd128('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index a0eb51b..a81a457 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 _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0x2124a6,_0x4b788c){var _0x23e704=function(_0x367b3d){while(--_0x367b3d){_0x2124a6['push'](_0x2124a6['shift']());}};_0x23e704(++_0x4b788c);}(_0x1893,0xa2));var _0x3189=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0x1893[_0x10c778];return _0x4e9fb2;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xda2d=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x49ebd1,_0xc25c3f){var _0x382d3a=function(_0x4eef4c){while(--_0x4eef4c){_0x49ebd1['push'](_0x49ebd1['shift']());}};_0x382d3a(++_0xc25c3f);}(_0xda2d,0x102));var _0xdda2=function(_0x517deb,_0x203249){_0x517deb=_0x517deb-0x0;var _0x13b401=_0xda2d[_0x517deb];return _0x13b401;};'use strict';module['exports']={'DOMAIN':_0xdda2('0x0'),'SESSION_SECRET':_0xdda2('0x1'),'GOOGLE_ID':_0xdda2('0x2'),'GOOGLE_SECRET':_0xdda2('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 6d17dc7..db72e1e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64b4=['fileLogger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64b4,0x150));var _0x464b=function(_0x21655c,_0x1c12fc){_0x21655c=_0x21655c-0x0;var _0xfdb1f=_0x64b4[_0x21655c];return _0xfdb1f;};'use strict';var fileLogger=require('../utils/loggers')[_0x464b('0x0')];module['exports']=fileLogger; \ No newline at end of file +var _0x85c0=['fileLogger','../utils/loggers'];(function(_0x513c1e,_0x2aa160){var _0xfaf0d0=function(_0x4068af){while(--_0x4068af){_0x513c1e['push'](_0x513c1e['shift']());}};_0xfaf0d0(++_0x2aa160);}(_0x85c0,0x133));var _0x085c=function(_0x43666c,_0x489465){_0x43666c=_0x43666c-0x0;var _0x28c896=_0x85c0[_0x43666c];return _0x28c896;};'use strict';var fileLogger=require(_0x085c('0x0'))[_0x085c('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index cec66b7..cc72012 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 _0xcd83=['../../services/xdr/index.js','../../config/environment','resolve','join','root','legacy-libs','express','ami','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x2cfda5,_0x44c2e4){var _0x3d1751=function(_0x549806){while(--_0x549806){_0x2cfda5['push'](_0x2cfda5['shift']());}};_0x3d1751(++_0x44c2e4);}(_0xcd83,0x69));var _0x3cd8=function(_0x203144,_0x628613){_0x203144=_0x203144-0x0;var _0x36b664=_0xcd83[_0x203144];return _0x36b664;};'use strict';var path=require('path');var cfg=require(_0x3cd8('0x0'));var env={'NODE_PATH':path[_0x3cd8('0x1')](path[_0x3cd8('0x2')](cfg[_0x3cd8('0x3')],_0x3cd8('0x4')))};var pm2config={'apps':[{'name':_0x3cd8('0x5'),'script':path[_0x3cd8('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x3cd8('0x6'),'script':path[_0x3cd8('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x3cd8('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x3cd8('0x7'),'script':path[_0x3cd8('0x2')](__dirname,_0x3cd8('0x8')),'env':env},{'name':_0x3cd8('0x9'),'script':path[_0x3cd8('0x2')](__dirname,_0x3cd8('0xa')),'env':env},{'name':_0x3cd8('0xb'),'script':path['join'](__dirname,_0x3cd8('0xc')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x08aa=['join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/routing/index.js','xdr','path','../../config/environment','resolve'];(function(_0x5ef055,_0x1cb5ed){var _0x4a7d1e=function(_0x1339b8){while(--_0x1339b8){_0x5ef055['push'](_0x5ef055['shift']());}};_0x4a7d1e(++_0x1cb5ed);}(_0x08aa,0x72));var _0xa08a=function(_0x124399,_0x5e220c){_0x124399=_0x124399-0x0;var _0x18a1c9=_0x08aa[_0x124399];return _0x18a1c9;};'use strict';var path=require(_0xa08a('0x0'));var cfg=require(_0xa08a('0x1'));var env={'NODE_PATH':path[_0xa08a('0x2')](path[_0xa08a('0x3')](cfg[_0xa08a('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xa08a('0x5'),'script':path[_0xa08a('0x3')](__dirname,_0xa08a('0x6')),'env':env},{'name':_0xa08a('0x7'),'script':path[_0xa08a('0x3')](__dirname,_0xa08a('0x8')),'env':env},{'name':_0xa08a('0x9'),'script':path[_0xa08a('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xa08a('0xa'),'script':path[_0xa08a('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0xa08a('0x3')](__dirname,_0xa08a('0xb')),'env':env},{'name':_0xa08a('0xc'),'script':path[_0xa08a('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2488059..10e15ec 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 _0xa850=['connect','start','then','disconnect','stop','restart','list','delete','dump','pm2','bluebird','./config'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0xa850,0x1dd));var _0x0a85=function(_0x5853e7,_0x1fb641){_0x5853e7=_0x5853e7-0x0;var _0x44c248=_0xa850[_0x5853e7];return _0x44c248;};'use strict';var pm2=require(_0x0a85('0x0'));var BPromise=require(_0x0a85('0x1'));var config=require(_0x0a85('0x2'));function connect(){return new BPromise(function(_0x1ebdc9,_0x1c37bb){return pm2[_0x0a85('0x3')](function(_0x4acb08){if(_0x4acb08){return _0x1c37bb(_0x4acb08);}return _0x1ebdc9('connected');});});};exports[_0x0a85('0x4')]=function(_0xa69d31){return connect()[_0x0a85('0x5')](function(){return new BPromise(function(_0x34fd23,_0x20d625){return pm2['start'](_0xa69d31,function(_0x440f20,_0x42a89e){if(_0x440f20){return _0x20d625(_0x440f20);}pm2[_0x0a85('0x6')]();return _0x34fd23(_0x42a89e);});});});};exports[_0x0a85('0x7')]=function(_0x1f71b6){return connect()[_0x0a85('0x5')](function(){return new BPromise(function(_0xb6abaf,_0x2c85d7){return pm2[_0x0a85('0x7')](_0x1f71b6,function(_0x56c80d,_0x46c25b){if(_0x56c80d){return _0x2c85d7(_0x56c80d);}pm2['disconnect']();return _0xb6abaf(_0x46c25b);});});});};exports[_0x0a85('0x8')]=function(_0x7c26f6){return connect()['then'](function(){return new BPromise(function(_0x2d190c,_0x4ece0b){return pm2['restart'](_0x7c26f6,function(_0x2b182a,_0xcd0296){if(_0x2b182a){return _0x4ece0b(_0x2b182a);}pm2[_0x0a85('0x6')]();return _0x2d190c(_0xcd0296);});});});};exports[_0x0a85('0x9')]=function(){return connect()[_0x0a85('0x5')](function(){return new BPromise(function(_0x5a18ca,_0x378ff7){return pm2['list'](function(_0x511f9f,_0x467904){if(_0x511f9f){return _0x378ff7(_0x511f9f);}pm2['disconnect']();return _0x5a18ca(_0x467904);});});});};exports['describe']=function(_0x1041eb){return connect()['then'](function(){return new BPromise(function(_0x4eebc3,_0xf15275){return pm2['describe'](_0x1041eb,function(_0x334622,_0x375ed5){if(_0x334622){return _0xf15275(_0x334622);}pm2[_0x0a85('0x6')]();return _0x4eebc3(_0x375ed5);});});});};exports['delete']=function(_0x2827b2){return connect()['then'](function(){return new BPromise(function(_0x2b84ec,_0x5a96b0){return pm2[_0x0a85('0xa')](_0x2827b2,function(_0x22bbaa,_0x3f0cf4){if(_0x22bbaa){return _0x5a96b0(_0x22bbaa);}pm2['disconnect']();return _0x2b84ec(_0x3f0cf4);});});});};exports[_0x0a85('0xb')]=function(){return connect()[_0x0a85('0x5')](function(){return new BPromise(function(_0x48e72d,_0x17c506){return pm2[_0x0a85('0xb')](function(_0xd6f82e){if(_0xd6f82e){return _0x17c506(_0xd6f82e);}return _0x48e72d('saved');});});});}; \ No newline at end of file +var _0xfe60=['pm2','bluebird','connect','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x4859ff,_0x1b0362){var _0x446603=function(_0x4d81a8){while(--_0x4d81a8){_0x4859ff['push'](_0x4859ff['shift']());}};_0x446603(++_0x1b0362);}(_0xfe60,0x15c));var _0x0fe6=function(_0x330b85,_0x15ef0d){_0x330b85=_0x330b85-0x0;var _0x3cb76d=_0xfe60[_0x330b85];return _0x3cb76d;};'use strict';var pm2=require(_0x0fe6('0x0'));var BPromise=require(_0x0fe6('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x4de914,_0x49bb85){return pm2[_0x0fe6('0x2')](function(_0x82ecdf){if(_0x82ecdf){return _0x49bb85(_0x82ecdf);}return _0x4de914('connected');});});};exports['start']=function(_0x311274){return connect()[_0x0fe6('0x3')](function(){return new BPromise(function(_0x276c6a,_0x13d077){return pm2['start'](_0x311274,function(_0x4533bd,_0x23aadd){if(_0x4533bd){return _0x13d077(_0x4533bd);}pm2[_0x0fe6('0x4')]();return _0x276c6a(_0x23aadd);});});});};exports[_0x0fe6('0x5')]=function(_0xbd33e8){return connect()[_0x0fe6('0x3')](function(){return new BPromise(function(_0x198986,_0x3b8405){return pm2[_0x0fe6('0x5')](_0xbd33e8,function(_0x2725e1,_0x26ee97){if(_0x2725e1){return _0x3b8405(_0x2725e1);}pm2['disconnect']();return _0x198986(_0x26ee97);});});});};exports[_0x0fe6('0x6')]=function(_0x31815a){return connect()[_0x0fe6('0x3')](function(){return new BPromise(function(_0x430324,_0x39e89e){return pm2[_0x0fe6('0x6')](_0x31815a,function(_0xb1ad02,_0x200169){if(_0xb1ad02){return _0x39e89e(_0xb1ad02);}pm2[_0x0fe6('0x4')]();return _0x430324(_0x200169);});});});};exports[_0x0fe6('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2e5978,_0x2dd5ac){return pm2[_0x0fe6('0x7')](function(_0x4d7f7f,_0x3c0c88){if(_0x4d7f7f){return _0x2dd5ac(_0x4d7f7f);}pm2[_0x0fe6('0x4')]();return _0x2e5978(_0x3c0c88);});});});};exports[_0x0fe6('0x8')]=function(_0x2df1d9){return connect()[_0x0fe6('0x3')](function(){return new BPromise(function(_0x2f87d9,_0x4e1b0a){return pm2['describe'](_0x2df1d9,function(_0x5c6e03,_0x295bf6){if(_0x5c6e03){return _0x4e1b0a(_0x5c6e03);}pm2[_0x0fe6('0x4')]();return _0x2f87d9(_0x295bf6);});});});};exports['delete']=function(_0xdf9b9){return connect()[_0x0fe6('0x3')](function(){return new BPromise(function(_0xf164bf,_0x52e264){return pm2[_0x0fe6('0x9')](_0xdf9b9,function(_0x36af97,_0x29d9ab){if(_0x36af97){return _0x52e264(_0x36af97);}pm2[_0x0fe6('0x4')]();return _0xf164bf(_0x29d9ab);});});});};exports[_0x0fe6('0xa')]=function(){return connect()[_0x0fe6('0x3')](function(){return new BPromise(function(_0x301e84,_0x389850){return pm2[_0x0fe6('0xa')](function(_0x3dec1f){if(_0x3dec1f){return _0x389850(_0x3dec1f);}return _0x301e84(_0x0fe6('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5af367c..7067f00 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 _0xf6e8=['error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../logger','redis','localhost','socket.io-emitter','Setting','find','then','ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch'];(function(_0x564d9e,_0x48a0a8){var _0xafca2e=function(_0xcc1834){while(--_0xcc1834){_0x564d9e['push'](_0x564d9e['shift']());}};_0xafca2e(++_0x48a0a8);}(_0xf6e8,0x17a));var _0x8f6e=function(_0x6255ea,_0x9935a8){_0x6255ea=_0x6255ea-0x0;var _0x10592c=_0xf6e8[_0x6255ea];return _0x10592c;};'use strict';var _=require(_0x8f6e('0x0'));var moment=require('moment');var Redis=require(_0x8f6e('0x1'));var util=require(_0x8f6e('0x2'));var config=require(_0x8f6e('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x8f6e('0x4'))('schedule');config[_0x8f6e('0x5')]=_['defaults'](config[_0x8f6e('0x5')],{'host':_0x8f6e('0x6'),'port':0x18eb});var io=require(_0x8f6e('0x7'))(new Redis(config[_0x8f6e('0x5')]));function closeInteractions(){var _0x320031=0x0;var _0x4b58c6=[];return db[_0x8f6e('0x8')][_0x8f6e('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x8f6e('0xa')](function(_0x55d192){_0x320031=_0x55d192['chatTimeout'];if(_0x320031){return db[_0x8f6e('0xb')][_0x8f6e('0xc')]({'raw':!![],'attributes':['id',_0x8f6e('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8f6e('0xe')](_0x55d192[_0x8f6e('0xf')],_0x8f6e('0x10'))}}});}else{return[];}})['then'](function(_0x18bd79){if(_0x18bd79&&_0x18bd79['length']){_0x4b58c6=_[_0x8f6e('0x11')](_0x18bd79||[],'id');logger[_0x8f6e('0x12')](_0x8f6e('0x13'),_0x4b58c6[_0x8f6e('0x14')]());return db[_0x8f6e('0xb')][_0x8f6e('0x15')]({'closeReason':_0x8f6e('0x16'),'disposition':_0x8f6e('0x17'),'closed':!![],'closedAt':moment()[_0x8f6e('0x18')](_0x8f6e('0x19'))},{'where':{'id':_0x4b58c6}});}})[_0x8f6e('0xa')](function(){if(_0x4b58c6&&_0x4b58c6['length']){logger[_0x8f6e('0x12')](_0x8f6e('0x1a'),_0x4b58c6[_0x8f6e('0x14')]());for(var _0x5b9cb9=0x0;_0x5b9cb9<_0x4b58c6['length'];_0x5b9cb9++){io[_0x8f6e('0x1b')](_0x8f6e('0x1c'),{'id':_0x4b58c6[_0x5b9cb9],'closed':!![]});}}})[_0x8f6e('0x1d')](function(_0x51bfaf){logger[_0x8f6e('0x1e')](_0x8f6e('0x1f'),_0x51bfaf?util[_0x8f6e('0x20')](_0x51bfaf,{'showHidden':![],'depth':null}):'');});}exports[_0x8f6e('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfd69=['../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','lodash','util'];(function(_0x2a2234,_0x463438){var _0x217793=function(_0x3d7222){while(--_0x3d7222){_0x2a2234['push'](_0x2a2234['shift']());}};_0x217793(++_0x463438);}(_0xfd69,0x132));var _0x9fd6=function(_0x577750,_0xef6974){_0x577750=_0x577750-0x0;var _0x530ef1=_0xfd69[_0x577750];return _0x530ef1;};'use strict';var _=require(_0x9fd6('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x9fd6('0x1'));var config=require(_0x9fd6('0x2'));var db=require(_0x9fd6('0x3'))['db'];var logger=require(_0x9fd6('0x4'))(_0x9fd6('0x5'));config['redis']=_[_0x9fd6('0x6')](config['redis'],{'host':_0x9fd6('0x7'),'port':0x18eb});var io=require(_0x9fd6('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x24de85=0x0;var _0x4dc8f4=[];return db['Setting'][_0x9fd6('0x9')]({'raw':!![],'attributes':['id',_0x9fd6('0xa')],'where':{'id':0x1}})[_0x9fd6('0xb')](function(_0x22a1fa){_0x24de85=_0x22a1fa['chatTimeout'];if(_0x24de85){return db[_0x9fd6('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x9fd6('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x22a1fa[_0x9fd6('0xa')],_0x9fd6('0xe'))}}});}else{return[];}})[_0x9fd6('0xb')](function(_0x413ffe){if(_0x413ffe&&_0x413ffe[_0x9fd6('0xf')]){_0x4dc8f4=_['map'](_0x413ffe||[],'id');logger[_0x9fd6('0x10')](_0x9fd6('0x11'),_0x4dc8f4[_0x9fd6('0x12')]());return db[_0x9fd6('0xc')]['update']({'closeReason':_0x9fd6('0x13'),'disposition':_0x9fd6('0x14'),'closed':!![],'closedAt':moment()['format'](_0x9fd6('0x15'))},{'where':{'id':_0x4dc8f4}});}})[_0x9fd6('0xb')](function(){if(_0x4dc8f4&&_0x4dc8f4[_0x9fd6('0xf')]){logger[_0x9fd6('0x10')](_0x9fd6('0x16'),_0x4dc8f4[_0x9fd6('0x12')]());for(var _0x306b13=0x0;_0x306b13<_0x4dc8f4[_0x9fd6('0xf')];_0x306b13++){io[_0x9fd6('0x17')](_0x9fd6('0x18'),{'id':_0x4dc8f4[_0x306b13],'closed':!![]});}}})['catch'](function(_0x577b4d){logger[_0x9fd6('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0x577b4d?util[_0x9fd6('0x1a')](_0x577b4d,{'showHidden':![],'depth':null}):'');});}exports[_0x9fd6('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 2c47732..0d3b73e 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 _0x7b25=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7b25,0x14b));var _0x57b2=function(_0x3cd174,_0x57739a){_0x3cd174=_0x3cd174-0x0;var _0x1f0532=_0x7b25[_0x3cd174];return _0x1f0532;};'use strict';function start(){var _0x4f4910=require(_0x57b2('0x0'));return _0x4f4910[_0x57b2('0x1')]();}module[_0x57b2('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xfd3f=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x124dcf,_0x39e488){var _0x2c8cd1=function(_0x3fb21d){while(--_0x3fb21d){_0x124dcf['push'](_0x124dcf['shift']());}};_0x2c8cd1(++_0x39e488);}(_0xfd3f,0x124));var _0xffd3=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xfd3f[_0x172747];return _0x509692;};'use strict';function start(){var _0x2079cd=require(_0xffd3('0x0'));return _0x2079cd[_0xffd3('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index e2d69c9..24c5d83 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 _0xa3c1=['subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','add','start','add\x20cron','stop\x20cron','startAt','endAt','update','update\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined'];(function(_0x1b5191,_0x5649ee){var _0x19e29a=function(_0x1e7edc){while(--_0x1e7edc){_0x1b5191['push'](_0x1b5191['shift']());}};_0x19e29a(++_0x5649ee);}(_0xa3c1,0x12a));var _0x1a3c=function(_0x8263e5,_0x446309){_0x8263e5=_0x8263e5-0x0;var _0x43677b=_0xa3c1[_0x8263e5];return _0x43677b;};'use strict';var fs=require('fs');var util=require(_0x1a3c('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x1a3c('0x1'));var CronJobManager=require(_0x1a3c('0x2'));var jayson=require(_0x1a3c('0x3'));var BPromise=require(_0x1a3c('0x4'));var logger=require(_0x1a3c('0x5'))(_0x1a3c('0x6'));var db=require(_0x1a3c('0x7'))['db'];var analyticCustomReportController=require(_0x1a3c('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x1a3c('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x42cd07,_0x48fb34){return function(){logger[_0x1a3c('0xa')](_0x1a3c('0xb'),_0x42cd07[_0x1a3c('0xc')]);var _0x33435d=!![];var _0x1726ec=_0x42cd07[_0x1a3c('0xd')][_0x1a3c('0xe')]();var _0x38c1e3={'account':_0x1726ec,'message':{'from':util[_0x1a3c('0xf')]('\x22%s\x22\x20<%s>',_0x42cd07[_0x1a3c('0xd')]['name'],_0x42cd07[_0x1a3c('0xd')][_0x1a3c('0xc')]||_0x42cd07[_0x1a3c('0xd')]['Smtp']['user']),'to':_0x42cd07[_0x1a3c('0xc')],'cc':_0x42cd07['cc'],'bcc':_0x42cd07[_0x1a3c('0x10')],'subject':util[_0x1a3c('0xf')](_0x1a3c('0x11'),_0x48fb34[_0x1a3c('0x12')],_0x42cd07[_0x1a3c('0x13')],_0x42cd07[_0x1a3c('0x14')])}};var _0x355a72=path[_0x1a3c('0x15')](__dirname,'../../files/reports');var _0x1d9b12=_0x48fb34[_0x1a3c('0x16')];var _0x49abf6=util[_0x1a3c('0xf')](_0x1a3c('0x17'),path[_0x1a3c('0x18')](_0x48fb34[_0x1a3c('0x16')],path[_0x1a3c('0x19')](_0x48fb34['savename'])),'zip');var _0x1632b3=path[_0x1a3c('0x15')](_0x355a72,_0x1d9b12);var _0xcf08c6=path['join'](_0x355a72,_0x49abf6);if(fs['existsSync'](_0x1632b3)){_0x48fb34[_0x1a3c('0x1a')]=_0x1a3c('0x1b');_0x38c1e3[_0x1a3c('0x1c')][_0x1a3c('0x1d')]=[{'filename':_0x1d9b12,'path':_0x1632b3}];_0x38c1e3[_0x1a3c('0x1c')][_0x1a3c('0x1e')]=util[_0x1a3c('0xf')](_0x1a3c('0x1f'),JSON[_0x1a3c('0x20')](_0x48fb34,null,0x2));}else if(fs[_0x1a3c('0x21')](_0xcf08c6)){_0x48fb34[_0x1a3c('0x1a')]='Sent';_0x38c1e3[_0x1a3c('0x1c')][_0x1a3c('0x1d')]=[{'filename':_0x49abf6,'path':_0xcf08c6}];}else{_0x38c1e3['message'][_0x1a3c('0x1e')]=_0x1a3c('0x22');if(!_0x42cd07[_0x1a3c('0x23')]){_0x33435d=![];logger[_0x1a3c('0xa')](_0x1a3c('0x24'));}}if(_0x33435d){return client['request']('SendMail',_0x38c1e3)[_0x1a3c('0x25')](function(_0x185f87){if(_0x185f87['error']){return logger[_0x1a3c('0x26')](_0x1a3c('0x27'),JSON[_0x1a3c('0x20')](_0x185f87));}return logger[_0x1a3c('0xa')](_0x1a3c('0x28'));})[_0x1a3c('0x29')](function(_0x2da670){return logger['error']('error\x20mail',JSON['stringify'](_0x2da670));});}};}function handleError(){return function(_0x30d612){return logger['error'](JSON[_0x1a3c('0x20')](_0x30d612));};}function handleResult(_0x19f2ba){return function(_0x15aa8c){logger[_0x1a3c('0xa')](_0x1a3c('0x2a'),JSON['stringify'](_0x15aa8c));if(_0x19f2ba[_0x1a3c('0xd')]&&_0x19f2ba['MailAccount'][_0x1a3c('0x2b')]&&!_['isNil'](_0x19f2ba[_0x1a3c('0xc')])){setTimeout(handleSendEmail(_0x19f2ba,_0x15aa8c),0x3c*0x3e8);}};}function handleJob(_0x369ce8){return function(){try{if(_[_0x1a3c('0x2c')](_0x369ce8[_0x1a3c('0x13')])){return logger[_0x1a3c('0xa')](_0x1a3c('0x2d'));}if(_[_0x1a3c('0x2c')](_0x369ce8['subtractUnit'])){return logger[_0x1a3c('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x20645d={'startDate':moment()[_0x1a3c('0x2e')](_0x369ce8[_0x1a3c('0x13')],_0x369ce8[_0x1a3c('0x14')])['format'](_0x1a3c('0x2f')),'endDate':moment()['format'](_0x1a3c('0x2f')),'type':_0x1a3c('0x30'),'output':_0x369ce8[_0x1a3c('0x31')],'name':_0x369ce8[_0x1a3c('0x12')]};if(!_[_0x1a3c('0x2c')](_0x369ce8[_0x1a3c('0x32')])){logger[_0x1a3c('0xa')](_0x1a3c('0x33'),_0x369ce8[_0x1a3c('0x32')]);return analyticDefaultReportController[_0x1a3c('0x34')]({'id':_0x369ce8['DefaultReportId']},_0x20645d)[_0x1a3c('0x25')](handleResult(_0x369ce8))[_0x1a3c('0x29')](handleError());}if(!_[_0x1a3c('0x2c')](_0x369ce8[_0x1a3c('0x35')])){logger[_0x1a3c('0xa')](_0x1a3c('0x36'),_0x369ce8[_0x1a3c('0x35')]);return analyticCustomReportController[_0x1a3c('0x34')]({'id':_0x369ce8[_0x1a3c('0x35')]},_0x20645d)[_0x1a3c('0x25')](handleResult(_0x369ce8))[_0x1a3c('0x29')](handleError());}}catch(_0x3564e5){logger[_0x1a3c('0x26')](JSON[_0x1a3c('0x20')](_0x3564e5));}return logger[_0x1a3c('0xa')](_0x1a3c('0x37'));};}function getJobs(_0x1bbf3f){var _0x5dfaa2={};if(_0x1bbf3f){_0x5dfaa2['id']=_0x1bbf3f;}return db['Schedule'][_0x1a3c('0x38')]({'where':_0x5dfaa2,'include':[{'model':db[_0x1a3c('0xd')],'attributes':['id',_0x1a3c('0x12'),_0x1a3c('0xc')],'include':[{'model':db[_0x1a3c('0x39')],'as':_0x1a3c('0x2b'),'include':[{'model':db['CloudProvider'],'as':_0x1a3c('0x3a')}]}]}]})['then'](function(_0x118b31){var _0x40e62c=_[_0x1a3c('0x3b')](manager['jobs']);var _0x35efe0=_[_0x1a3c('0x3c')](_0x118b31,function(_0x51a611){return _0x51a611['id'][_0x1a3c('0x3d')]();});var _0x93fdca=_[_0x1a3c('0x3e')](_0x118b31,function(_0x3d4411){return _0x3d4411['id'][_0x1a3c('0x3d')]();});var _0x313d98=_0x1bbf3f?_0x35efe0:_[_0x1a3c('0x3f')](_0x35efe0,_0x40e62c);var _0x2c80ee=_['intersection'](_0x35efe0,_0x40e62c);var _0x1b003c=_[_0x1a3c('0x3f')](_0x40e62c,_0x35efe0);var _0x1c0b61;var _0x28c30b;for(_0x1c0b61=0x0;_0x1c0b61<_0x1b003c['length']&&!_0x1bbf3f;_0x1c0b61+=0x1){_0x28c30b=_0x1b003c[_0x1c0b61]['toString']();if(manager[_0x1a3c('0x40')](_0x28c30b)){manager[_0x1a3c('0x41')](_0x28c30b);manager[_0x1a3c('0x42')](_0x28c30b);logger[_0x1a3c('0xa')](_0x1a3c('0x43'),_0x28c30b);}}logger[_0x1a3c('0xa')](_0x1a3c('0x44'),JSON[_0x1a3c('0x20')](_0x313d98));for(_0x1c0b61=0x0;_0x1c0b61<_0x313d98[_0x1a3c('0x45')];_0x1c0b61+=0x1){_0x28c30b=_0x313d98[_0x1c0b61]['toString']();logger[_0x1a3c('0xa')](_0x1a3c('0x46'),_0x28c30b);if(_0x1bbf3f){logger[_0x1a3c('0xa')](_0x1a3c('0x47'),_0x1bbf3f);logger[_0x1a3c('0xa')](JSON[_0x1a3c('0x20')](_0x93fdca[_0x28c30b]));BPromise[_0x1a3c('0x48')]()[_0x1a3c('0x25')](handleJob(_0x93fdca[_0x28c30b]));logger[_0x1a3c('0xa')](_0x1a3c('0x49'),_0x93fdca[_0x28c30b][_0x1a3c('0x12')],_0x93fdca[_0x28c30b][_0x1a3c('0x4a')]);}else if(_0x93fdca[_0x28c30b][_0x1a3c('0x4a')]&&_0x93fdca[_0x28c30b][_0x1a3c('0x4b')]&&moment()[_0x1a3c('0x4c')](_0x93fdca[_0x28c30b]['startAt'],_0x93fdca[_0x28c30b]['endAt'])){manager[_0x1a3c('0x4d')](_0x28c30b,_0x93fdca[_0x28c30b][_0x1a3c('0x4a')],handleJob(_0x93fdca[_0x28c30b]));manager[_0x1a3c('0x4e')](_0x28c30b);logger[_0x1a3c('0xa')](_0x1a3c('0x4f'),_0x93fdca[_0x28c30b][_0x1a3c('0x12')],_0x93fdca[_0x28c30b]['cron']);}else if(manager[_0x1a3c('0x40')](_0x28c30b)){manager['stop'](_0x28c30b);manager[_0x1a3c('0x42')](_0x28c30b);logger['info'](_0x1a3c('0x50'),_0x93fdca[_0x28c30b][_0x1a3c('0x12')],_0x93fdca[_0x28c30b]['cron']);}}for(_0x1c0b61=0x0,_0x28c30b;_0x1c0b61<_0x2c80ee[_0x1a3c('0x45')]&&!_0x1bbf3f;_0x1c0b61+=0x1){_0x28c30b=_0x2c80ee[_0x1c0b61][_0x1a3c('0x3d')]();if(manager[_0x1a3c('0x40')](_0x28c30b)){if(_0x93fdca[_0x28c30b]['cron']&&_0x93fdca[_0x28c30b][_0x1a3c('0x4b')]&&moment()['isBetween'](_0x93fdca[_0x28c30b][_0x1a3c('0x51')],_0x93fdca[_0x28c30b][_0x1a3c('0x52')])){manager[_0x1a3c('0x53')](_0x28c30b,_0x93fdca[_0x28c30b]['cron'],handleJob(_0x93fdca[_0x28c30b]));logger[_0x1a3c('0xa')](_0x1a3c('0x54'),_0x93fdca[_0x28c30b]['name'],_0x93fdca[_0x28c30b][_0x1a3c('0x4a')]);}else{manager[_0x1a3c('0x41')](_0x28c30b);manager['deleteJob'](_0x28c30b);logger[_0x1a3c('0xa')]('stop\x20cron',_0x93fdca[_0x28c30b]['name'],_0x93fdca[_0x28c30b][_0x1a3c('0x4a')]);}}}})[_0x1a3c('0x29')](function(_0x57809a){logger['error'](JSON['stringify'](_0x57809a));});}exports[_0x1a3c('0x55')]=function(_0x200962){return getJobs(_0x200962);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3306=['intersection','length','exists','stop','deleteJob','delete\x20cron','index','resolve','cron','active','isBetween','startAt','add','start','update','update\x20cron','stop\x20cron','run','util','moment','jayson/promise','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','format','%s.%s','basename','extname','zip','join','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','existsSync','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error\x20mail','email\x20sent','error','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','toString','difference'];(function(_0x5ad0e0,_0x380ab5){var _0x34ed13=function(_0x5f49fa){while(--_0x5f49fa){_0x5ad0e0['push'](_0x5ad0e0['shift']());}};_0x34ed13(++_0x380ab5);}(_0x3306,0x1ec));var _0x6330=function(_0x5a2049,_0x62745c){_0x5a2049=_0x5a2049-0x0;var _0x14699b=_0x3306[_0x5a2049];return _0x14699b;};'use strict';var fs=require('fs');var util=require(_0x6330('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x6330('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6330('0x2'));var BPromise=require('bluebird');var logger=require(_0x6330('0x3'))(_0x6330('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x6330('0x5'));var analyticDefaultReportController=require(_0x6330('0x6'));var client=jayson[_0x6330('0x7')][_0x6330('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xd06a5c,_0x3a6cff){return function(){logger[_0x6330('0x9')](_0x6330('0xa'),_0xd06a5c[_0x6330('0xb')]);var _0x58f37e=!![];var _0x2f933c=_0xd06a5c['MailAccount'][_0x6330('0xc')]();var _0xf8d2c7={'account':_0x2f933c,'message':{'from':util['format'](_0x6330('0xd'),_0xd06a5c[_0x6330('0xe')][_0x6330('0xf')],_0xd06a5c[_0x6330('0xe')][_0x6330('0xb')]||_0xd06a5c[_0x6330('0xe')][_0x6330('0x10')]['user']),'to':_0xd06a5c[_0x6330('0xb')],'cc':_0xd06a5c['cc'],'bcc':_0xd06a5c['bcc'],'subject':util['format'](_0x6330('0x11'),_0x3a6cff[_0x6330('0xf')],_0xd06a5c['subtractNumber'],_0xd06a5c[_0x6330('0x12')])}};var _0x16f5ee=path['join'](__dirname,_0x6330('0x13'));var _0xbc533d=_0x3a6cff[_0x6330('0x14')];var _0x1173c1=util[_0x6330('0x15')](_0x6330('0x16'),path[_0x6330('0x17')](_0x3a6cff[_0x6330('0x14')],path[_0x6330('0x18')](_0x3a6cff[_0x6330('0x14')])),_0x6330('0x19'));var _0x1ccfbd=path[_0x6330('0x1a')](_0x16f5ee,_0xbc533d);var _0x618cec=path[_0x6330('0x1a')](_0x16f5ee,_0x1173c1);if(fs['existsSync'](_0x1ccfbd)){_0x3a6cff[_0x6330('0x1b')]=_0x6330('0x1c');_0xf8d2c7['message'][_0x6330('0x1d')]=[{'filename':_0xbc533d,'path':_0x1ccfbd}];_0xf8d2c7[_0x6330('0x1e')][_0x6330('0x1f')]=util['format'](_0x6330('0x20'),JSON[_0x6330('0x21')](_0x3a6cff,null,0x2));}else if(fs[_0x6330('0x22')](_0x618cec)){_0x3a6cff[_0x6330('0x1b')]='Sent';_0xf8d2c7['message']['attachments']=[{'filename':_0x1173c1,'path':_0x618cec}];}else{_0xf8d2c7[_0x6330('0x1e')][_0x6330('0x1f')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xd06a5c[_0x6330('0x23')]){_0x58f37e=![];logger['info'](_0x6330('0x24'));}}if(_0x58f37e){return client['request'](_0x6330('0x25'),_0xf8d2c7)[_0x6330('0x26')](function(_0x48f435){if(_0x48f435['error']){return logger['error'](_0x6330('0x27'),JSON[_0x6330('0x21')](_0x48f435));}return logger['info'](_0x6330('0x28'));})['catch'](function(_0x414e8d){return logger[_0x6330('0x29')](_0x6330('0x27'),JSON[_0x6330('0x21')](_0x414e8d));});}};}function handleError(){return function(_0x3be985){return logger['error'](JSON[_0x6330('0x21')](_0x3be985));};}function handleResult(_0xd1f260){return function(_0x265056){logger[_0x6330('0x9')](_0x6330('0x2a'),JSON[_0x6330('0x21')](_0x265056));if(_0xd1f260[_0x6330('0xe')]&&_0xd1f260[_0x6330('0xe')]['Smtp']&&!_[_0x6330('0x2b')](_0xd1f260[_0x6330('0xb')])){setTimeout(handleSendEmail(_0xd1f260,_0x265056),0x3c*0x3e8);}};}function handleJob(_0x998dbf){return function(){try{if(_[_0x6330('0x2b')](_0x998dbf[_0x6330('0x2c')])){return logger['info'](_0x6330('0x2d'));}if(_['isNil'](_0x998dbf['subtractUnit'])){return logger[_0x6330('0x9')](_0x6330('0x2e'));}var _0x28bda2={'startDate':moment()[_0x6330('0x2f')](_0x998dbf[_0x6330('0x2c')],_0x998dbf[_0x6330('0x12')])[_0x6330('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x6330('0x15')](_0x6330('0x30')),'type':_0x6330('0x31'),'output':_0x998dbf['output'],'name':_0x998dbf[_0x6330('0xf')]};if(!_[_0x6330('0x2b')](_0x998dbf[_0x6330('0x32')])){logger[_0x6330('0x9')]('exec\x20defaul\x20report\x20id:%s',_0x998dbf[_0x6330('0x32')]);return analyticDefaultReportController[_0x6330('0x33')]({'id':_0x998dbf[_0x6330('0x32')]},_0x28bda2)[_0x6330('0x26')](handleResult(_0x998dbf))[_0x6330('0x34')](handleError());}if(!_[_0x6330('0x2b')](_0x998dbf[_0x6330('0x35')])){logger[_0x6330('0x9')](_0x6330('0x36'),_0x998dbf[_0x6330('0x35')]);return analyticCustomReportController['runReport']({'id':_0x998dbf[_0x6330('0x35')]},_0x28bda2)[_0x6330('0x26')](handleResult(_0x998dbf))[_0x6330('0x34')](handleError());}}catch(_0x2035f0){logger['error'](JSON[_0x6330('0x21')](_0x2035f0));}return logger[_0x6330('0x9')]('no\x20report\x20id');};}function getJobs(_0x4ccd84){var _0x392fb0={};if(_0x4ccd84){_0x392fb0['id']=_0x4ccd84;}return db[_0x6330('0x37')][_0x6330('0x38')]({'where':_0x392fb0,'include':[{'model':db[_0x6330('0xe')],'attributes':['id',_0x6330('0xf'),'email'],'include':[{'model':db[_0x6330('0x39')],'as':'Smtp','include':[{'model':db[_0x6330('0x3a')],'as':_0x6330('0x3a')}]}]}]})['then'](function(_0x30d60e){var _0x1573d6=_['keys'](manager['jobs']);var _0x20ab92=_['map'](_0x30d60e,function(_0x59bb9b){return _0x59bb9b['id'][_0x6330('0x3b')]();});var _0x428ee9=_['keyBy'](_0x30d60e,function(_0x3a096e){return _0x3a096e['id'][_0x6330('0x3b')]();});var _0x12c92c=_0x4ccd84?_0x20ab92:_[_0x6330('0x3c')](_0x20ab92,_0x1573d6);var _0xcd0a9f=_[_0x6330('0x3d')](_0x20ab92,_0x1573d6);var _0xfc0e70=_[_0x6330('0x3c')](_0x1573d6,_0x20ab92);var _0x36d82b;var _0x45cc6f;for(_0x36d82b=0x0;_0x36d82b<_0xfc0e70[_0x6330('0x3e')]&&!_0x4ccd84;_0x36d82b+=0x1){_0x45cc6f=_0xfc0e70[_0x36d82b][_0x6330('0x3b')]();if(manager[_0x6330('0x3f')](_0x45cc6f)){manager[_0x6330('0x40')](_0x45cc6f);manager[_0x6330('0x41')](_0x45cc6f);logger[_0x6330('0x9')](_0x6330('0x42'),_0x45cc6f);}}logger[_0x6330('0x9')]('toRun',JSON['stringify'](_0x12c92c));for(_0x36d82b=0x0;_0x36d82b<_0x12c92c[_0x6330('0x3e')];_0x36d82b+=0x1){_0x45cc6f=_0x12c92c[_0x36d82b][_0x6330('0x3b')]();logger['info'](_0x6330('0x43'),_0x45cc6f);if(_0x4ccd84){logger[_0x6330('0x9')]('my\x20id',_0x4ccd84);logger[_0x6330('0x9')](JSON['stringify'](_0x428ee9[_0x45cc6f]));BPromise[_0x6330('0x44')]()[_0x6330('0x26')](handleJob(_0x428ee9[_0x45cc6f]));logger['info']('run\x20job',_0x428ee9[_0x45cc6f][_0x6330('0xf')],_0x428ee9[_0x45cc6f][_0x6330('0x45')]);}else if(_0x428ee9[_0x45cc6f][_0x6330('0x45')]&&_0x428ee9[_0x45cc6f][_0x6330('0x46')]&&moment()[_0x6330('0x47')](_0x428ee9[_0x45cc6f][_0x6330('0x48')],_0x428ee9[_0x45cc6f]['endAt'])){manager[_0x6330('0x49')](_0x45cc6f,_0x428ee9[_0x45cc6f][_0x6330('0x45')],handleJob(_0x428ee9[_0x45cc6f]));manager[_0x6330('0x4a')](_0x45cc6f);logger['info']('add\x20cron',_0x428ee9[_0x45cc6f][_0x6330('0xf')],_0x428ee9[_0x45cc6f][_0x6330('0x45')]);}else if(manager[_0x6330('0x3f')](_0x45cc6f)){manager['stop'](_0x45cc6f);manager['deleteJob'](_0x45cc6f);logger['info']('stop\x20cron',_0x428ee9[_0x45cc6f]['name'],_0x428ee9[_0x45cc6f][_0x6330('0x45')]);}}for(_0x36d82b=0x0,_0x45cc6f;_0x36d82b<_0xcd0a9f[_0x6330('0x3e')]&&!_0x4ccd84;_0x36d82b+=0x1){_0x45cc6f=_0xcd0a9f[_0x36d82b][_0x6330('0x3b')]();if(manager[_0x6330('0x3f')](_0x45cc6f)){if(_0x428ee9[_0x45cc6f][_0x6330('0x45')]&&_0x428ee9[_0x45cc6f]['active']&&moment()['isBetween'](_0x428ee9[_0x45cc6f][_0x6330('0x48')],_0x428ee9[_0x45cc6f]['endAt'])){manager[_0x6330('0x4b')](_0x45cc6f,_0x428ee9[_0x45cc6f][_0x6330('0x45')],handleJob(_0x428ee9[_0x45cc6f]));logger['info'](_0x6330('0x4c'),_0x428ee9[_0x45cc6f]['name'],_0x428ee9[_0x45cc6f][_0x6330('0x45')]);}else{manager['stop'](_0x45cc6f);manager['deleteJob'](_0x45cc6f);logger[_0x6330('0x9')](_0x6330('0x4d'),_0x428ee9[_0x45cc6f][_0x6330('0xf')],_0x428ee9[_0x45cc6f][_0x6330('0x45')]);}}}})[_0x6330('0x34')](function(_0x575f37){logger[_0x6330('0x29')](JSON['stringify'](_0x575f37));});}exports[_0x6330('0x4e')]=function(_0x339af1){return getJobs(_0x339af1);};exports[_0x6330('0x4a')]=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 93867d6..79dc7b9 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 _0x13b6=['[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','SequelizeValidationError','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','CloudProvider','catch','name','error'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x13b6,0x97));var _0x613b=function(_0x1498a9,_0x47adcd){_0x1498a9=_0x1498a9-0x0;var _0x1acfd6=_0x13b6[_0x1498a9];return _0x1acfd6;};var _=require(_0x613b('0x0'));var AWS=require('aws-sdk');var rp=require(_0x613b('0x1'));var util=require(_0x613b('0x2'));var BPromise=require(_0x613b('0x3'));var db=require(_0x613b('0x4'))['db'];var logger=require('../../config/logger')(_0x613b('0x5'));function getTranscriptionJob(_0x1dc7f9,_0x451191,_0x50fb84,_0x44d5d8){return new Promise(function(_0x1c746e,_0x312a27){var _0x593a18=new AWS[(_0x613b('0x6'))]({'accessKeyId':_0x451191,'secretAccessKey':_0x1dc7f9,'region':_0x50fb84});_0x593a18['getTranscriptionJob']({'TranscriptionJobName':_0x44d5d8},function(_0xf83c34,_0x4abb96){if(_0xf83c34){return _0x312a27(_0xf83c34);}else{return _0x1c746e(_0x4abb96);}});});}function sentiment(_0x5a7415,_0x1cef76,_0x37dbc7,_0x2fac8d,_0x402c15){return new Promise(function(_0x40cd30,_0x5989f7){var _0x51a45f=new AWS[(_0x613b('0x7'))]({'accessKeyId':_0x1cef76,'secretAccessKey':_0x5a7415,'region':_0x37dbc7});_0x51a45f['detectSentiment']({'Text':_0x2fac8d,'LanguageCode':_0x402c15[_0x613b('0x8')](0x0,0x2)},function(_0x579400,_0x59829f){if(_0x579400){return _0x5989f7(_0x579400);}else{return _0x40cd30(_0x59829f);}});});}function checkTranscribeJob(_0x2f6cd6,_0x408b5f,_0x1567cd){var _0x4afa45;return new BPromise(function(_0x1d31f8,_0x2931ee){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0xb'),_0x2f6cd6['id'],_0x2f6cd6[_0x613b('0xc')]));return getTranscriptionJob(_0x1567cd[_0x613b('0xd')],_0x1567cd[_0x613b('0xe')],_0x408b5f[_0x613b('0xf')],_0x2f6cd6[_0x613b('0xc')])['then'](function(_0xa74b30){logger[_0x613b('0x9')](util[_0x613b('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2f6cd6['id'],_0x2f6cd6['transcribeName'],_0xa74b30[_0x613b('0x10')]['TranscriptionJobStatus']));if(!_0x2f6cd6[_0x613b('0x11')]){switch(_0xa74b30['TranscriptionJob'][_0x613b('0x12')]){case _0x613b('0x13'):var _0x34cd14={'transcribeStatus':_0xa74b30[_0x613b('0x10')][_0x613b('0x12')],'fileUri':_0xa74b30[_0x613b('0x10')][_0x613b('0x14')]['TranscriptFileUri']};logger[_0x613b('0x9')](util[_0x613b('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x2f6cd6['id']));return rp({'uri':_0xa74b30['TranscriptionJob'][_0x613b('0x14')][_0x613b('0x15')],'json':!![]})[_0x613b('0x16')](function(_0x425ebb){logger[_0x613b('0x9')](util['format'](_0x613b('0x17'),_0x2f6cd6['id']));if(_0x425ebb&&_0x425ebb['results']&&_0x425ebb[_0x613b('0x18')][_0x613b('0x19')]&&_0x425ebb[_0x613b('0x18')][_0x613b('0x19')]['length']){_0x34cd14[_0x613b('0x11')]='';for(var _0x4eb354=0x0;_0x4eb354<_0x425ebb[_0x613b('0x18')]['transcripts'][_0x613b('0x1a')];_0x4eb354++){_0x34cd14[_0x613b('0x11')]+=_0x425ebb[_0x613b('0x18')][_0x613b('0x19')][_0x4eb354][_0x613b('0x1b')]+'';}}return _0x2f6cd6[_0x613b('0x1c')](_0x34cd14);})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));if(!_0x2f6cd6[_0x613b('0x1e')]){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x20'));}if(!_0x408b5f[_0x613b('0x21')]||!_0x408b5f[_0x613b('0x22')]||!_0x408b5f[_0x613b('0x23')]||!_0x408b5f[_0x613b('0x24')]||!_0x408b5f[_0x613b('0x25')]){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x26'));}if(!_0x34cd14[_0x613b('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x408b5f[_0x613b('0x22')]===_0x1567cd['id']){return _0x1567cd;}else{return db['CloudProvider'][_0x613b('0x27')]({'where':{'id':_settings[_0x613b('0x22')]}});}})['then'](function(_0x3306ee){if(!_0x3306ee){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x29'));}if(!_0x3306ee[_0x613b('0xd')]||!_0x3306ee[_0x613b('0xe')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x2a'));}_0x4afa45=_0x3306ee;logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x2b'),_0x2f6cd6['id']));return sentiment(_0x4afa45[_0x613b('0xd')],_0x4afa45['data2'],_0x408b5f[_0x613b('0x23')],_0x34cd14[_0x613b('0x11')],_0x408b5f[_0x613b('0x24')]);})[_0x613b('0x16')](function(_0x5e577e){logger['info'](util[_0x613b('0xa')](_0x613b('0x2c'),_0x2f6cd6['id']));return _0x2f6cd6[_0x613b('0x1c')]({'sentiment':_0x5e577e[_0x613b('0x2d')],'sPositive':_0x5e577e[_0x613b('0x2e')][_0x613b('0x2f')],'sNegative':_0x5e577e[_0x613b('0x2e')]['Negative'],'sMixed':_0x5e577e[_0x613b('0x2e')][_0x613b('0x30')],'sNeutral':_0x5e577e[_0x613b('0x2e')][_0x613b('0x31')]});})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));_0x1d31f8();});case _0x613b('0x32'):return _0x2f6cd6[_0x613b('0x1c')]({'transcribeStatus':_0x613b('0x32'),'failureReason':_0xa74b30[_0x613b('0x10')][_0x613b('0x33')]})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));_0x1d31f8();});default:logger[_0x613b('0x9')](util['format'](_0x613b('0x34'),_0x2f6cd6['id']));break;}}else{return BPromise[_0x613b('0x35')]()[_0x613b('0x16')](function(){if(!_0x2f6cd6[_0x613b('0x1e')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x20'));}if(!_0x408b5f[_0x613b('0x21')]||!_0x408b5f[_0x613b('0x22')]||!_0x408b5f[_0x613b('0x23')]||!_0x408b5f[_0x613b('0x24')]||!_0x408b5f['bucket']){throw new db[(_0x613b('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2f6cd6[_0x613b('0x11')]){throw new Error(_0x613b('0x36'));}if(_0x408b5f[_0x613b('0x22')]===_0x1567cd['id']){return _0x1567cd;}else{return db[_0x613b('0x37')]['findOne']({'where':{'id':_settings[_0x613b('0x22')]}});}})['then'](function(_0x33671a){if(!_0x33671a){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x29'));}if(!_0x33671a['data1']||!_0x33671a['data2']){throw new db['Sequelize']['ValidationError'](_0x613b('0x2a'));}_0x4afa45=_0x33671a;logger['info'](util[_0x613b('0xa')](_0x613b('0x2b'),_0x2f6cd6['id']));return sentiment(_0x4afa45['data1'],_0x4afa45[_0x613b('0xe')],_0x408b5f[_0x613b('0x23')],_0x2f6cd6[_0x613b('0x11')],_0x408b5f[_0x613b('0x24')]);})['then'](function(_0x5c184a){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x2c'),_0x2f6cd6['id']));return _0x2f6cd6['update']({'sentiment':_0x5c184a['Sentiment'],'sPositive':_0x5c184a[_0x613b('0x2e')][_0x613b('0x2f')],'sNegative':_0x5c184a[_0x613b('0x2e')]['Negative'],'sMixed':_0x5c184a['SentimentScore'][_0x613b('0x30')],'sNeutral':_0x5c184a[_0x613b('0x2e')][_0x613b('0x31')],'transcribeStatus':_0x613b('0x13')});})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));_0x1d31f8();});}})[_0x613b('0x38')](function(_0x2b856e){if(_0x2b856e){if(!_0x2b856e[_0x613b('0x39')]||_0x2b856e[_0x613b('0x39')]!=='SequelizeValidationError'){logger[_0x613b('0x3a')](util[_0x613b('0xa')](_0x613b('0x3b'),_0x2f6cd6['id']),util[_0x613b('0x3c')](_0x2b856e,{'showHidden':![],'depth':null}));}}_0x1d31f8();});});}function checkTranscribe(){var _0x20f32b;var _0x5dcb8e;var _0x1e6226;return db[_0x613b('0x3d')][_0x613b('0x3e')]({'where':{'transcribeStatus':_0x613b('0x3f')}})[_0x613b('0x16')](function(_0x31f2d1){if(!_0x31f2d1||!_0x31f2d1[_0x613b('0x1a')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x40'));}_0x20f32b=_0x31f2d1;return db[_0x613b('0x41')][_0x613b('0x27')]({'where':{'id':0x1}});})[_0x613b('0x16')](function(_0x77daf3){if(!_0x77daf3){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x42'));}_0x5dcb8e=_0x77daf3;if(!_0x5dcb8e[_0x613b('0x5')]||!_0x5dcb8e[_0x613b('0x43')]||!_0x5dcb8e['transcribeRegion']||!_0x5dcb8e[_0x613b('0x24')]||!_0x5dcb8e[_0x613b('0x25')]){throw new db[(_0x613b('0x1f'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x613b('0x37')][_0x613b('0x27')]({'where':{'id':_0x5dcb8e[_0x613b('0x43')]}});})['then'](function(_0x23116e){if(!_0x23116e){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x29'));}if(!_0x23116e[_0x613b('0xd')]||!_0x23116e[_0x613b('0xe')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x2a'));}_0x1e6226=_0x23116e;var _0x5ef07a=[];_0x20f32b[_0x613b('0x44')](function(_0x2bab8f){_0x5ef07a['push'](checkTranscribeJob(_0x2bab8f,_0x5dcb8e,_0x1e6226));});return BPromise['all'](_0x5ef07a);})[_0x613b('0x38')](function(_0x56a788){if(_0x56a788){if(!_0x56a788['name']||_0x56a788[_0x613b('0x39')]!==_0x613b('0x45')){logger[_0x613b('0x3a')](util[_0x613b('0x3c')](_0x56a788,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x13b6=['[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','SequelizeValidationError','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','CloudProvider','catch','name','error'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x13b6,0x97));var _0x613b=function(_0x3e61d2,_0x573fb2){_0x3e61d2=_0x3e61d2-0x0;var _0x4d5af0=_0x13b6[_0x3e61d2];return _0x4d5af0;};var _=require(_0x613b('0x0'));var AWS=require('aws-sdk');var rp=require(_0x613b('0x1'));var util=require(_0x613b('0x2'));var BPromise=require(_0x613b('0x3'));var db=require(_0x613b('0x4'))['db'];var logger=require('../../config/logger')(_0x613b('0x5'));function getTranscriptionJob(_0x1dc7f9,_0x451191,_0x50fb84,_0x44d5d8){return new Promise(function(_0x1c746e,_0x312a27){var _0x593a18=new AWS[(_0x613b('0x6'))]({'accessKeyId':_0x451191,'secretAccessKey':_0x1dc7f9,'region':_0x50fb84});_0x593a18['getTranscriptionJob']({'TranscriptionJobName':_0x44d5d8},function(_0xf83c34,_0x4abb96){if(_0xf83c34){return _0x312a27(_0xf83c34);}else{return _0x1c746e(_0x4abb96);}});});}function sentiment(_0x5a7415,_0x1cef76,_0x37dbc7,_0x2fac8d,_0x402c15){return new Promise(function(_0x40cd30,_0x5989f7){var _0x51a45f=new AWS[(_0x613b('0x7'))]({'accessKeyId':_0x1cef76,'secretAccessKey':_0x5a7415,'region':_0x37dbc7});_0x51a45f['detectSentiment']({'Text':_0x2fac8d,'LanguageCode':_0x402c15[_0x613b('0x8')](0x0,0x2)},function(_0x579400,_0x59829f){if(_0x579400){return _0x5989f7(_0x579400);}else{return _0x40cd30(_0x59829f);}});});}function checkTranscribeJob(_0x2f6cd6,_0x408b5f,_0x1567cd){var _0x4afa45;return new BPromise(function(_0x1d31f8,_0x2931ee){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0xb'),_0x2f6cd6['id'],_0x2f6cd6[_0x613b('0xc')]));return getTranscriptionJob(_0x1567cd[_0x613b('0xd')],_0x1567cd[_0x613b('0xe')],_0x408b5f[_0x613b('0xf')],_0x2f6cd6[_0x613b('0xc')])['then'](function(_0xa74b30){logger[_0x613b('0x9')](util[_0x613b('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2f6cd6['id'],_0x2f6cd6['transcribeName'],_0xa74b30[_0x613b('0x10')]['TranscriptionJobStatus']));if(!_0x2f6cd6[_0x613b('0x11')]){switch(_0xa74b30['TranscriptionJob'][_0x613b('0x12')]){case _0x613b('0x13'):var _0x34cd14={'transcribeStatus':_0xa74b30[_0x613b('0x10')][_0x613b('0x12')],'fileUri':_0xa74b30[_0x613b('0x10')][_0x613b('0x14')]['TranscriptFileUri']};logger[_0x613b('0x9')](util[_0x613b('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x2f6cd6['id']));return rp({'uri':_0xa74b30['TranscriptionJob'][_0x613b('0x14')][_0x613b('0x15')],'json':!![]})[_0x613b('0x16')](function(_0x425ebb){logger[_0x613b('0x9')](util['format'](_0x613b('0x17'),_0x2f6cd6['id']));if(_0x425ebb&&_0x425ebb['results']&&_0x425ebb[_0x613b('0x18')][_0x613b('0x19')]&&_0x425ebb[_0x613b('0x18')][_0x613b('0x19')]['length']){_0x34cd14[_0x613b('0x11')]='';for(var _0x4eb354=0x0;_0x4eb354<_0x425ebb[_0x613b('0x18')]['transcripts'][_0x613b('0x1a')];_0x4eb354++){_0x34cd14[_0x613b('0x11')]+=_0x425ebb[_0x613b('0x18')][_0x613b('0x19')][_0x4eb354][_0x613b('0x1b')]+'';}}return _0x2f6cd6[_0x613b('0x1c')](_0x34cd14);})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));if(!_0x2f6cd6[_0x613b('0x1e')]){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x20'));}if(!_0x408b5f[_0x613b('0x21')]||!_0x408b5f[_0x613b('0x22')]||!_0x408b5f[_0x613b('0x23')]||!_0x408b5f[_0x613b('0x24')]||!_0x408b5f[_0x613b('0x25')]){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x26'));}if(!_0x34cd14[_0x613b('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x408b5f[_0x613b('0x22')]===_0x1567cd['id']){return _0x1567cd;}else{return db['CloudProvider'][_0x613b('0x27')]({'where':{'id':_settings[_0x613b('0x22')]}});}})['then'](function(_0x3306ee){if(!_0x3306ee){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x29'));}if(!_0x3306ee[_0x613b('0xd')]||!_0x3306ee[_0x613b('0xe')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x2a'));}_0x4afa45=_0x3306ee;logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x2b'),_0x2f6cd6['id']));return sentiment(_0x4afa45[_0x613b('0xd')],_0x4afa45['data2'],_0x408b5f[_0x613b('0x23')],_0x34cd14[_0x613b('0x11')],_0x408b5f[_0x613b('0x24')]);})[_0x613b('0x16')](function(_0x5e577e){logger['info'](util[_0x613b('0xa')](_0x613b('0x2c'),_0x2f6cd6['id']));return _0x2f6cd6[_0x613b('0x1c')]({'sentiment':_0x5e577e[_0x613b('0x2d')],'sPositive':_0x5e577e[_0x613b('0x2e')][_0x613b('0x2f')],'sNegative':_0x5e577e[_0x613b('0x2e')]['Negative'],'sMixed':_0x5e577e[_0x613b('0x2e')][_0x613b('0x30')],'sNeutral':_0x5e577e[_0x613b('0x2e')][_0x613b('0x31')]});})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));_0x1d31f8();});case _0x613b('0x32'):return _0x2f6cd6[_0x613b('0x1c')]({'transcribeStatus':_0x613b('0x32'),'failureReason':_0xa74b30[_0x613b('0x10')][_0x613b('0x33')]})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));_0x1d31f8();});default:logger[_0x613b('0x9')](util['format'](_0x613b('0x34'),_0x2f6cd6['id']));break;}}else{return BPromise[_0x613b('0x35')]()[_0x613b('0x16')](function(){if(!_0x2f6cd6[_0x613b('0x1e')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x20'));}if(!_0x408b5f[_0x613b('0x21')]||!_0x408b5f[_0x613b('0x22')]||!_0x408b5f[_0x613b('0x23')]||!_0x408b5f[_0x613b('0x24')]||!_0x408b5f['bucket']){throw new db[(_0x613b('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2f6cd6[_0x613b('0x11')]){throw new Error(_0x613b('0x36'));}if(_0x408b5f[_0x613b('0x22')]===_0x1567cd['id']){return _0x1567cd;}else{return db[_0x613b('0x37')]['findOne']({'where':{'id':_settings[_0x613b('0x22')]}});}})['then'](function(_0x33671a){if(!_0x33671a){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x29'));}if(!_0x33671a['data1']||!_0x33671a['data2']){throw new db['Sequelize']['ValidationError'](_0x613b('0x2a'));}_0x4afa45=_0x33671a;logger['info'](util[_0x613b('0xa')](_0x613b('0x2b'),_0x2f6cd6['id']));return sentiment(_0x4afa45['data1'],_0x4afa45[_0x613b('0xe')],_0x408b5f[_0x613b('0x23')],_0x2f6cd6[_0x613b('0x11')],_0x408b5f[_0x613b('0x24')]);})['then'](function(_0x5c184a){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x2c'),_0x2f6cd6['id']));return _0x2f6cd6['update']({'sentiment':_0x5c184a['Sentiment'],'sPositive':_0x5c184a[_0x613b('0x2e')][_0x613b('0x2f')],'sNegative':_0x5c184a[_0x613b('0x2e')]['Negative'],'sMixed':_0x5c184a['SentimentScore'][_0x613b('0x30')],'sNeutral':_0x5c184a[_0x613b('0x2e')][_0x613b('0x31')],'transcribeStatus':_0x613b('0x13')});})[_0x613b('0x16')](function(){logger[_0x613b('0x9')](util[_0x613b('0xa')](_0x613b('0x1d'),_0x2f6cd6['id']));_0x1d31f8();});}})[_0x613b('0x38')](function(_0x2b856e){if(_0x2b856e){if(!_0x2b856e[_0x613b('0x39')]||_0x2b856e[_0x613b('0x39')]!=='SequelizeValidationError'){logger[_0x613b('0x3a')](util[_0x613b('0xa')](_0x613b('0x3b'),_0x2f6cd6['id']),util[_0x613b('0x3c')](_0x2b856e,{'showHidden':![],'depth':null}));}}_0x1d31f8();});});}function checkTranscribe(){var _0x20f32b;var _0x5dcb8e;var _0x1e6226;return db[_0x613b('0x3d')][_0x613b('0x3e')]({'where':{'transcribeStatus':_0x613b('0x3f')}})[_0x613b('0x16')](function(_0x31f2d1){if(!_0x31f2d1||!_0x31f2d1[_0x613b('0x1a')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x40'));}_0x20f32b=_0x31f2d1;return db[_0x613b('0x41')][_0x613b('0x27')]({'where':{'id':0x1}});})[_0x613b('0x16')](function(_0x77daf3){if(!_0x77daf3){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x42'));}_0x5dcb8e=_0x77daf3;if(!_0x5dcb8e[_0x613b('0x5')]||!_0x5dcb8e[_0x613b('0x43')]||!_0x5dcb8e['transcribeRegion']||!_0x5dcb8e[_0x613b('0x24')]||!_0x5dcb8e[_0x613b('0x25')]){throw new db[(_0x613b('0x1f'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x613b('0x37')][_0x613b('0x27')]({'where':{'id':_0x5dcb8e[_0x613b('0x43')]}});})['then'](function(_0x23116e){if(!_0x23116e){throw new db[(_0x613b('0x1f'))]['ValidationError'](_0x613b('0x29'));}if(!_0x23116e[_0x613b('0xd')]||!_0x23116e[_0x613b('0xe')]){throw new db[(_0x613b('0x1f'))][(_0x613b('0x28'))](_0x613b('0x2a'));}_0x1e6226=_0x23116e;var _0x5ef07a=[];_0x20f32b[_0x613b('0x44')](function(_0x2bab8f){_0x5ef07a['push'](checkTranscribeJob(_0x2bab8f,_0x5dcb8e,_0x1e6226));});return BPromise['all'](_0x5ef07a);})[_0x613b('0x38')](function(_0x56a788){if(_0x56a788){if(!_0x56a788['name']||_0x56a788[_0x613b('0x39')]!==_0x613b('0x45')){logger[_0x613b('0x3a')](util[_0x613b('0x3c')](_0x56a788,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 4339b25..73ec04e 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 _0x858c=['catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','../../mysqldb','../logger','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','YYYY-MM-DD\x20HH:mm:ss','info','join','emit','whatsappInteraction:update'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x858c,0x17e));var _0xc858=function(_0x1cfb6b,_0x52b3c6){_0x1cfb6b=_0x1cfb6b-0x0;var _0x48d2d3=_0x858c[_0x1cfb6b];return _0x48d2d3;};'use strict';var _=require(_0xc858('0x0'));var moment=require('moment');var Redis=require(_0xc858('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0xc858('0x2'))['db'];var logger=require(_0xc858('0x3'))('schedule');config[_0xc858('0x4')]=_['defaults'](config['redis'],{'host':_0xc858('0x5'),'port':0x18eb});var io=require(_0xc858('0x6'))(new Redis(config[_0xc858('0x4')]));function closeInteractions(){var _0x3e0ae9=[];return db[_0xc858('0x7')][_0xc858('0x8')]({'raw':!![],'attributes':['id',_0xc858('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xc858('0xa')](0x18,_0xc858('0xb'))}}})['then'](function(_0x52c46f){if(_0x52c46f&&_0x52c46f[_0xc858('0xc')]){_0x3e0ae9=_[_0xc858('0xd')](_0x52c46f||[],'id');logger['info'](_0xc858('0xe'),_0x3e0ae9['join']());return db[_0xc858('0x7')][_0xc858('0xf')]({'closeReason':_0xc858('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xc858('0x11')](_0xc858('0x12'))},{'where':{'id':_0x3e0ae9}});}})['then'](function(){if(_0x3e0ae9&&_0x3e0ae9[_0xc858('0xc')]){logger[_0xc858('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3e0ae9[_0xc858('0x14')]());for(var _0x45c34b=0x0;_0x45c34b<_0x3e0ae9[_0xc858('0xc')];_0x45c34b++){io[_0xc858('0x15')](_0xc858('0x16'),{'id':_0x3e0ae9[_0x45c34b],'closed':!![]});}}})[_0xc858('0x17')](function(_0x126535){logger[_0xc858('0x18')](_0xc858('0x19'),_0x126535?util[_0xc858('0x1a')](_0x126535,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2c49=['localhost','socket.io-emitter','redis','WhatsappInteraction','findAll','lastMsgAt','subtract','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','defaults'];(function(_0x169dab,_0x345d63){var _0x20b4af=function(_0x39d539){while(--_0x39d539){_0x169dab['push'](_0x169dab['shift']());}};_0x20b4af(++_0x345d63);}(_0x2c49,0xc3));var _0x92c4=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x2c49[_0x53afe9];return _0x396396;};'use strict';var _=require(_0x92c4('0x0'));var moment=require(_0x92c4('0x1'));var Redis=require(_0x92c4('0x2'));var util=require(_0x92c4('0x3'));var config=require(_0x92c4('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x92c4('0x5'))(_0x92c4('0x6'));config['redis']=_[_0x92c4('0x7')](config['redis'],{'host':_0x92c4('0x8'),'port':0x18eb});var io=require(_0x92c4('0x9'))(new Redis(config[_0x92c4('0xa')]));function closeInteractions(){var _0x3079a8=[];return db[_0x92c4('0xb')][_0x92c4('0xc')]({'raw':!![],'attributes':['id',_0x92c4('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x92c4('0xe')](0x18,'hours')}}})['then'](function(_0x792a63){if(_0x792a63&&_0x792a63[_0x92c4('0xf')]){_0x3079a8=_[_0x92c4('0x10')](_0x792a63||[],'id');logger['info'](_0x92c4('0x11'),_0x3079a8[_0x92c4('0x12')]());return db[_0x92c4('0xb')][_0x92c4('0x13')]({'closeReason':_0x92c4('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3079a8}});}})[_0x92c4('0x15')](function(){if(_0x3079a8&&_0x3079a8[_0x92c4('0xf')]){logger['info'](_0x92c4('0x16'),_0x3079a8[_0x92c4('0x12')]());for(var _0x1944d1=0x0;_0x1944d1<_0x3079a8['length'];_0x1944d1++){io[_0x92c4('0x17')]('whatsappInteraction:update',{'id':_0x3079a8[_0x1944d1],'closed':!![]});}}})[_0x92c4('0x18')](function(_0x38e7b7){logger[_0x92c4('0x19')](_0x92c4('0x1a'),_0x38e7b7?util[_0x92c4('0x1b')](_0x38e7b7,{'showHidden':![],'depth':null}):'');});}exports[_0x92c4('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6bee78f..247e85d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1337=['contacts2','catch','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper','finished\x20populating','hopper1'];(function(_0x24500f,_0x4f2e64){var _0x5b93d4=function(_0x16fa91){while(--_0x16fa91){_0x24500f['push'](_0x24500f['shift']());}};_0x5b93d4(++_0x4f2e64);}(_0x1337,0x112));var _0x7133=function(_0x360423,_0x1e05d0){_0x360423=_0x360423-0x0;var _0xe29430=_0x1337[_0x360423];return _0xe29430;};'use strict';var util=require('util');var db=require(_0x7133('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x7133('0x1')+i,'lastName':_0x7133('0x2')+i,'phone':0xf879fb460+i,'email':_0x7133('0x3')+i+_0x7133('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x7133('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7133('0x5')](),'updatedAt':Date[_0x7133('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7133('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x7133('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7133('0x5')]()});}db[_0x7133('0x6')][_0x7133('0x7')]({'where':{}})['then'](function(){return db[_0x7133('0x6')][_0x7133('0x8')](contacts);})[_0x7133('0x9')](function(){console[_0x7133('0xa')]('finished\x20populating',_0x7133('0xb'));return db['CmHopper'][_0x7133('0x7')]({'where':{}});})[_0x7133('0x9')](function(){return db[_0x7133('0xc')]['bulkCreate'](hopper);})[_0x7133('0x9')](function(){console['log'](_0x7133('0xd'),_0x7133('0xe'));return db[_0x7133('0x6')][_0x7133('0x8')](contacts2);})[_0x7133('0x9')](function(){console[_0x7133('0xa')](_0x7133('0xd'),_0x7133('0xf'));return db[_0x7133('0xc')][_0x7133('0x8')](hopper2);})['then'](function(){console[_0x7133('0xa')](_0x7133('0xd'),'hopper2');})[_0x7133('0x10')](function(_0x30140f){console[_0x7133('0xa')](_0x30140f);}); \ No newline at end of file +var _0xc967=['now','innocenzo.biondo','destroy','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','@xcally.com'];(function(_0x4af9dd,_0x2e24fe){var _0x6c3ee0=function(_0xd05278){while(--_0xd05278){_0x4af9dd['push'](_0x4af9dd['shift']());}};_0x6c3ee0(++_0x2e24fe);}(_0xc967,0x11b));var _0x7c96=function(_0x3fad25,_0xe77c05){_0x3fad25=_0x3fad25-0x0;var _0x3817ee=_0xc967[_0x3fad25];return _0x3817ee;};'use strict';var util=require(_0x7c96('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7c96('0x1')]({'id':i,'firstName':_0x7c96('0x2')+i,'lastName':_0x7c96('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7c96('0x4')});}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[_0x7c96('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7c96('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7c96('0x6')+i+_0x7c96('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7c96('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x7c96('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7c96('0x5')](),'updatedAt':Date[_0x7c96('0x5')]()});}db['CmContact'][_0x7c96('0x7')]({'where':{}})[_0x7c96('0x8')](function(){return db[_0x7c96('0x9')][_0x7c96('0xa')](contacts);})['then'](function(){console[_0x7c96('0xb')](_0x7c96('0xc'),'contacts1');return db[_0x7c96('0xd')][_0x7c96('0x7')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x7c96('0xa')](hopper);})['then'](function(){console[_0x7c96('0xb')]('finished\x20populating',_0x7c96('0xe'));return db[_0x7c96('0x9')][_0x7c96('0xa')](contacts2);})['then'](function(){console[_0x7c96('0xb')](_0x7c96('0xc'),_0x7c96('0xf'));return db[_0x7c96('0xd')][_0x7c96('0xa')](hopper2);})[_0x7c96('0x8')](function(){console['log'](_0x7c96('0xc'),_0x7c96('0x10'));})[_0x7c96('0x11')](function(_0x12564d){console[_0x7c96('0xb')](_0x12564d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b55a23e..3447264 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4aee=['%s%s@xcally.com','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','util','../mysqldb','push','%s%s','agent','format'];(function(_0x813834,_0x3fbdf2){var _0x49580d=function(_0x2daf7b){while(--_0x2daf7b){_0x813834['push'](_0x813834['shift']());}};_0x49580d(++_0x3fbdf2);}(_0x4aee,0x1e0));var _0xe4ae=function(_0x28a0fc,_0xa7129a){_0x28a0fc=_0x28a0fc-0x0;var _0x25a428=_0x4aee[_0x28a0fc];return _0x25a428;};'use strict';var util=require(_0xe4ae('0x0'));var db=require(_0xe4ae('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe4ae('0x2')]({'name':util['format'](_0xe4ae('0x3'),_0xe4ae('0x4'),i),'fullname':util[_0xe4ae('0x5')]('%s%s',_0xe4ae('0x4'),i),'email':util['format'](_0xe4ae('0x6'),'agent',i),'role':_0xe4ae('0x4'),'password':'password','internal':0xfa0+i,'type':_0xe4ae('0x7'),'transport':['udp','ws',_0xe4ae('0x8')],'disallow':[_0xe4ae('0x9')],'allow':[_0xe4ae('0xa')],'defaultuser':util['format'](_0xe4ae('0x3'),_0xe4ae('0x4'),i),'encryption':_0xe4ae('0xb'),'avpf':'yes','force_avp':'yes','icesupport':'yes','dtlsenable':_0xe4ae('0xb'),'dtlsverify':'no','dtlscertfile':_0xe4ae('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xe4ae('0x5')](_0xe4ae('0xd'),util[_0xe4ae('0x5')](_0xe4ae('0x3'),_0xe4ae('0x4'),i),0xfa0+i)});}db[_0xe4ae('0xe')][_0xe4ae('0xf')](users)['then'](function(){console[_0xe4ae('0x10')]('add\x20user');})[_0xe4ae('0x11')](function(_0x31b6ad){console[_0xe4ae('0x10')](_0x31b6ad);}); \ No newline at end of file +var _0xa9ea=['format','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','add\x20user','catch','util','../mysqldb','push','%s%s'];(function(_0x34c36b,_0x16313b){var _0x1f0133=function(_0x45967b){while(--_0x45967b){_0x34c36b['push'](_0x34c36b['shift']());}};_0x1f0133(++_0x16313b);}(_0xa9ea,0x14c));var _0xaa9e=function(_0x5eb874,_0x3d849f){_0x5eb874=_0x5eb874-0x0;var _0x5bbbd0=_0xa9ea[_0x5eb874];return _0x5bbbd0;};'use strict';var util=require(_0xaa9e('0x0'));var db=require(_0xaa9e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaa9e('0x2')]({'name':util['format'](_0xaa9e('0x3'),'agent',i),'fullname':util[_0xaa9e('0x4')]('%s%s',_0xaa9e('0x5'),i),'email':util[_0xaa9e('0x4')](_0xaa9e('0x6'),'agent',i),'role':_0xaa9e('0x5'),'password':_0xaa9e('0x7'),'internal':0xfa0+i,'type':_0xaa9e('0x8'),'transport':[_0xaa9e('0x9'),'ws',_0xaa9e('0xa')],'disallow':[_0xaa9e('0xb')],'allow':[_0xaa9e('0xc')],'defaultuser':util[_0xaa9e('0x4')](_0xaa9e('0x3'),_0xaa9e('0x5'),i),'encryption':_0xaa9e('0xd'),'avpf':_0xaa9e('0xd'),'force_avp':'yes','icesupport':_0xaa9e('0xd'),'dtlsenable':_0xaa9e('0xd'),'dtlsverify':'no','dtlscertfile':_0xaa9e('0xe'),'dtlsprivatekey':_0xaa9e('0xf'),'dtlssetup':_0xaa9e('0x10'),'callerid':util[_0xaa9e('0x4')](_0xaa9e('0x11'),util[_0xaa9e('0x4')](_0xaa9e('0x3'),_0xaa9e('0x5'),i),0xfa0+i)});}db[_0xaa9e('0x12')]['bulkCreate'](users)['then'](function(){console['log'](_0xaa9e('0x13'));})[_0xaa9e('0x14')](function(_0x3fc2a2){console['log'](_0x3fc2a2);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d3318d5..0461fbb 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f96=['SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','user','ChatQueues','MailQueue','OpenchannelQueues','Trunk','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','chat','fax','sms','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','leave','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3f96,0x1d3));var _0x63f9=function(_0x3b196e,_0x2ba212){_0x3b196e=_0x3b196e-0x0;var _0x5732ec=_0x3f96[_0x3b196e];return _0x5732ec;};'use strict';var _=require(_0x63f9('0x0'));var util=require(_0x63f9('0x1'));var BPromise=require(_0x63f9('0x2'));var db=require(_0x63f9('0x3'))['db'];var config=require(_0x63f9('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x63f9('0x5'),'model':db[_0x63f9('0x6')],'attributes':['id',_0x63f9('0x7'),_0x63f9('0x8')],'raw':!![],'where':{'role':_0x63f9('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x63f9('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x63f9('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x63f9('0x7')],'where':{'role':_0x63f9('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x63f9('0xb')],'where':{'type':_0x63f9('0xc')}};function getAssociatedResources(_0x201069,_0x217c80,_0x45cb1f){return db[_0x63f9('0xd')][_0x63f9('0xe')]({'where':{'name':_0x201069,'userProfileId':_0x217c80},'raw':!![]})[_0x63f9('0xf')](function(_0x584e7c){if(_0x584e7c){if(_0x584e7c[_0x63f9('0x10')]){switch(_0x201069){case _0x63f9('0x11'):case'ChatQueues':case _0x63f9('0x12'):case _0x63f9('0x13'):case _0x63f9('0x14'):case'OpenchannelQueues':case _0x63f9('0x15'):return db[_0x45cb1f][_0x63f9('0x16')](queryQueues);case _0x63f9('0x17'):return db[_0x45cb1f][_0x63f9('0x16')](queryTelephones);case _0x63f9('0x18'):return db[_0x45cb1f][_0x63f9('0x16')](queryTrunks);case _0x63f9('0x19'):return db[_0x45cb1f]['findAll'](queryCampaigns);}}else{return db[_0x63f9('0x1a')]['findAll']({'attributes':[_0x63f9('0x1b')],'where':{'sectionId':_0x584e7c['id']},'raw':!![]})['then'](function(_0x47050b){if(_0x47050b){var _0x1fa6dd={'where':{'id':_[_0x63f9('0x1c')](_0x47050b,_0x63f9('0x1b'))},'raw':!![]};switch(_0x45cb1f){case _0x63f9('0x6'):_0x1fa6dd[_0x63f9('0x1d')][_0x63f9('0x8')]='telephone';break;case _0x63f9('0x1e'):_0x1fa6dd[_0x63f9('0x1d')][_0x63f9('0xb')]=_0x63f9('0xc');break;}return db[_0x45cb1f][_0x63f9('0x16')](_0x1fa6dd);}else{return[];}});}}else{return[];}})['then'](function(_0x1e309f){return _0x1e309f;});}function joinOrLeaveQueues(_0x30aa4d,_0x3633d3,_0x4877e1,_0x3b85c0){_0x30aa4d[_0x3633d3](util[_0x63f9('0x1f')](_0x63f9('0x20'),_0x4877e1,_0x3b85c0[_0x63f9('0x7')]));if(_0x3b85c0[_0x63f9('0x5')]){for(var _0x537a11=0x0;_0x537a11<_0x3b85c0['Agents'][_0x63f9('0x21')];_0x537a11+=0x1){_0x30aa4d[_0x3633d3](util[_0x63f9('0x1f')](_0x63f9('0x22'),_0x3b85c0[_0x63f9('0x5')][_0x537a11][_0x63f9('0x7')]));}}}function joinOrLeave(_0x261284,_0x3720c9,_0x549454){var _0x5994c1;if(_0x261284[_0x63f9('0x23')][_0x63f9('0x24')]['id']){db[_0x63f9('0x6')][_0x63f9('0x25')]({'attributes':['id',_0x63f9('0x7'),_0x63f9('0x8'),_0x63f9('0x26')],'where':{'id':_0x261284[_0x63f9('0x23')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x63f9('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x63f9('0x28')],'as':_0x63f9('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x63f9('0x2a')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x63f9('0x2b')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x63f9('0x2c')],'as':_0x63f9('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x63f9('0x2e')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x63f9('0xf')](function(_0x3e6728){if(_0x3e6728){_0x5994c1=_0x3e6728;_0x261284[_0x3720c9](util[_0x63f9('0x1f')](_0x63f9('0x22'),_0x3e6728[_0x63f9('0x7')]));var _0x921ebf=[];switch(_0x3e6728['role']){case _0x63f9('0x2f'):_0x261284[_0x3720c9](_0x63f9('0x30'));_0x261284[_0x3720c9](_0x63f9('0x31'));if(queryQueues[_0x63f9('0x32')](_0x63f9('0x33'))){delete queryQueues[_0x63f9('0x33')];}_0x921ebf[_0x63f9('0x34')](db[_0x63f9('0x35')][_0x63f9('0x16')](queryQueues));_0x921ebf['push'](db[_0x63f9('0x36')]['findAll'](queryQueues));_0x921ebf[_0x63f9('0x34')](db[_0x63f9('0x37')][_0x63f9('0x16')](queryQueues));_0x921ebf[_0x63f9('0x34')](db[_0x63f9('0x38')]['findAll'](queryQueues));_0x921ebf[_0x63f9('0x34')](db['MailQueue']['findAll'](queryQueues));_0x921ebf[_0x63f9('0x34')](db[_0x63f9('0x39')][_0x63f9('0x16')](queryQueues));_0x921ebf['push'](db[_0x63f9('0x3a')]['findAll'](queryQueues));_0x921ebf[_0x63f9('0x34')](db[_0x63f9('0x6')][_0x63f9('0x16')](queryTelephones));_0x921ebf['push'](db['Trunk'][_0x63f9('0x16')](queryTrunks));_0x921ebf[_0x63f9('0x34')](db[_0x63f9('0x1e')][_0x63f9('0x16')](queryCampaigns));_0x921ebf['push'](db[_0x63f9('0x6')][_0x63f9('0x16')](queryAgents));break;case _0x63f9('0x3b'):_0x261284[_0x3720c9](_0x63f9('0x30'));_0x261284[_0x3720c9]('voice:outbound');_0x921ebf[_0x63f9('0x34')](getAssociatedResources(_0x63f9('0x11'),_0x3e6728[_0x63f9('0x26')],_0x63f9('0x35')));_0x921ebf[_0x63f9('0x34')](getAssociatedResources(_0x63f9('0x3c'),_0x3e6728[_0x63f9('0x26')],_0x63f9('0x36')));_0x921ebf[_0x63f9('0x34')](getAssociatedResources('FaxQueues',_0x3e6728[_0x63f9('0x26')],_0x63f9('0x37')));_0x921ebf[_0x63f9('0x34')](getAssociatedResources(_0x63f9('0x13'),_0x3e6728[_0x63f9('0x26')],_0x63f9('0x38')));_0x921ebf['push'](getAssociatedResources(_0x63f9('0x14'),_0x3e6728[_0x63f9('0x26')],_0x63f9('0x3d')));_0x921ebf[_0x63f9('0x34')](getAssociatedResources(_0x63f9('0x3e'),_0x3e6728[_0x63f9('0x26')],_0x63f9('0x39')));_0x921ebf[_0x63f9('0x34')](getAssociatedResources('WhatsappQueues',_0x3e6728['userProfileId'],'WhatsappQueue'));_0x921ebf['push'](getAssociatedResources(_0x63f9('0x17'),_0x3e6728[_0x63f9('0x26')],_0x63f9('0x6')));_0x921ebf[_0x63f9('0x34')](getAssociatedResources(_0x63f9('0x18'),_0x3e6728[_0x63f9('0x26')],_0x63f9('0x3f')));_0x921ebf[_0x63f9('0x34')](getAssociatedResources(_0x63f9('0x19'),_0x3e6728['userProfileId'],_0x63f9('0x1e')));_0x921ebf['push'](db[_0x63f9('0x6')]['findAll'](queryAgents));break;case _0x63f9('0x9'):_0x261284[_0x3720c9](_0x63f9('0x30'));_0x261284[_0x3720c9](_0x63f9('0x31'));_0x921ebf['push'](_0x3e6728[_0x63f9('0x40')]({'attributes':['id',_0x63f9('0x7')]}));_0x921ebf[_0x63f9('0x34')](_0x3e6728['getChatQueues']({'attributes':['id','name']}));_0x921ebf[_0x63f9('0x34')](_0x3e6728[_0x63f9('0x41')]({'attributes':['id',_0x63f9('0x7')]}));_0x921ebf[_0x63f9('0x34')](_0x3e6728[_0x63f9('0x42')]({'attributes':['id',_0x63f9('0x7')]}));_0x921ebf['push'](_0x3e6728[_0x63f9('0x43')]({'attributes':['id',_0x63f9('0x7')]}));_0x921ebf['push'](_0x3e6728[_0x63f9('0x44')]({'attributes':['id',_0x63f9('0x7')]}));_0x921ebf[_0x63f9('0x34')](_0x3e6728['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x63f9('0x45')](_0x921ebf);}})[_0x63f9('0xf')](function(_0x59a779){if(_0x59a779&&_0x59a779[_0x63f9('0x21')]){for(var _0x293e7e=0x0;_0x293e7e<_0x59a779[_0x63f9('0x21')];_0x293e7e+=0x1){for(var _0x29c4c9=0x0;_0x29c4c9<_0x59a779[_0x293e7e][_0x63f9('0x21')];_0x29c4c9+=0x1){switch(_0x293e7e){case 0x0:joinOrLeaveQueues(_0x261284,_0x3720c9,'voice',_0x59a779[_0x293e7e][_0x29c4c9]);break;case 0x1:joinOrLeaveQueues(_0x261284,_0x3720c9,_0x63f9('0x46'),_0x59a779[_0x293e7e][_0x29c4c9]);break;case 0x2:joinOrLeaveQueues(_0x261284,_0x3720c9,_0x63f9('0x47'),_0x59a779[_0x293e7e][_0x29c4c9]);break;case 0x3:joinOrLeaveQueues(_0x261284,_0x3720c9,_0x63f9('0x48'),_0x59a779[_0x293e7e][_0x29c4c9]);break;case 0x4:joinOrLeaveQueues(_0x261284,_0x3720c9,'mail',_0x59a779[_0x293e7e][_0x29c4c9]);break;case 0x5:joinOrLeaveQueues(_0x261284,_0x3720c9,'openchannel',_0x59a779[_0x293e7e][_0x29c4c9]);break;case 0x6:joinOrLeaveQueues(_0x261284,_0x3720c9,'whatsapp',_0x59a779[_0x293e7e][_0x29c4c9]);break;case 0x7:if(_0x5994c1['role']!==_0x63f9('0x9'))_0x261284[_0x3720c9](util[_0x63f9('0x1f')](_0x63f9('0x49'),_0x59a779[_0x293e7e][_0x29c4c9]['name']));break;case 0x8:if(_0x5994c1['role']!==_0x63f9('0x9'))_0x261284[_0x3720c9](util[_0x63f9('0x1f')](_0x63f9('0x4a'),_0x59a779[_0x293e7e][_0x29c4c9][_0x63f9('0x7')]));break;case 0x9:if(_0x5994c1[_0x63f9('0x8')]!==_0x63f9('0x9'))_0x261284[_0x3720c9](util[_0x63f9('0x1f')](_0x63f9('0x4b'),_0x59a779[_0x293e7e][_0x29c4c9]['type'],_0x59a779[_0x293e7e][_0x29c4c9][_0x63f9('0x7')]));break;case 0xa:_0x261284[_0x3720c9](util[_0x63f9('0x1f')]('user:%s',_0x59a779[_0x293e7e][_0x29c4c9][_0x63f9('0x7')]));break;}}}}})[_0x63f9('0xf')](function(){if(_0x3720c9==='leave'){var _0x168d54=_['map'](_0x5994c1[_0x63f9('0x27')],'id');return _0x5994c1[_0x63f9('0x4c')](_0x168d54)[_0x63f9('0xf')](function(){for(var _0x3c6967=0x0;_0x3c6967<_0x168d54[_0x63f9('0x21')];_0x3c6967+=0x1){_0x549454[_0x63f9('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x168d54[_0x3c6967]),'UserId':Number(_0x5994c1['id'])});}});}})[_0x63f9('0xf')](function(){if(_0x3720c9==='leave'){var _0x7e6f23=_[_0x63f9('0x1c')](_0x5994c1['MailInteractions'],'id');return _0x5994c1[_0x63f9('0x4e')](_0x7e6f23)['then'](function(){for(var _0xfab8b4=0x0;_0xfab8b4<_0x7e6f23[_0x63f9('0x21')];_0xfab8b4+=0x1){_0x549454['emit'](_0x63f9('0x4f'),{'MailInteractionId':Number(_0x7e6f23[_0xfab8b4]),'UserId':Number(_0x5994c1['id'])});}});}})['then'](function(){if(_0x3720c9===_0x63f9('0x50')){var _0x3a35a2=_['map'](_0x5994c1[_0x63f9('0x51')],'id');return _0x5994c1[_0x63f9('0x52')](_0x3a35a2)[_0x63f9('0xf')](function(){for(var _0x591c80=0x0;_0x591c80<_0x3a35a2['length'];_0x591c80+=0x1){_0x549454[_0x63f9('0x4d')](_0x63f9('0x53'),{'FaxInteractionId':Number(_0x3a35a2[_0x591c80]),'UserId':Number(_0x5994c1['id'])});}});}})['then'](function(){if(_0x3720c9===_0x63f9('0x50')){var _0x3d6e70=_['map'](_0x5994c1[_0x63f9('0x54')],'id');return _0x5994c1[_0x63f9('0x55')](_0x3d6e70)[_0x63f9('0xf')](function(){for(var _0x4d2df8=0x0;_0x4d2df8<_0x3d6e70[_0x63f9('0x21')];_0x4d2df8+=0x1){_0x549454[_0x63f9('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3d6e70[_0x4d2df8]),'UserId':Number(_0x5994c1['id'])});}});}})[_0x63f9('0xf')](function(){if(_0x3720c9==='leave'){var _0x194d19=_['map'](_0x5994c1[_0x63f9('0x2d')],'id');return _0x5994c1[_0x63f9('0x56')](_0x194d19)[_0x63f9('0xf')](function(){for(var _0x25965d=0x0;_0x25965d<_0x194d19[_0x63f9('0x21')];_0x25965d+=0x1){_0x549454['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x194d19[_0x25965d]),'UserId':Number(_0x5994c1['id'])});}});}})[_0x63f9('0xf')](function(){if(_0x3720c9===_0x63f9('0x50')){var _0x3cbdb9=_[_0x63f9('0x1c')](_0x5994c1['WhatsappInteractions'],'id');return _0x5994c1[_0x63f9('0x57')](_0x3cbdb9)[_0x63f9('0xf')](function(){for(var _0x489080=0x0;_0x489080<_0x3cbdb9['length'];_0x489080+=0x1){_0x549454[_0x63f9('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3cbdb9[_0x489080]),'UserId':Number(_0x5994c1['id'])});}});}})[_0x63f9('0x58')](function(_0x3726d0){_0x261284[_0x63f9('0x59')](_0x3726d0);});}}function onDisconnect(_0x547590,_0x13c50b){joinOrLeave(_0x547590,'leave',_0x13c50b);}function onConnect(_0x287d8c){joinOrLeave(_0x287d8c,_0x63f9('0x5a'));}exports[_0x63f9('0x5b')]=function(_0x1d98d6){_0x1d98d6['on'](_0x63f9('0x5c'),function(_0x2daea9){_0x2daea9[_0x63f9('0x5d')](0x0);_0x2daea9[_0x63f9('0x5e')]=_0x2daea9[_0x63f9('0x5f')]['connection'][_0x63f9('0x60')]+':'+_0x2daea9['request'][_0x63f9('0x5c')][_0x63f9('0x61')];_0x2daea9[_0x63f9('0x62')]=new Date();_0x2daea9[_0x63f9('0x59')]=function(_0x5f1294){console[_0x63f9('0x59')](_0x63f9('0x63')+_0x2daea9['nsp'][_0x63f9('0x7')]+'['+_0x2daea9[_0x63f9('0x5e')]+']',_0x5f1294);};_0x2daea9['on'](_0x63f9('0x64'),function(){onDisconnect(_0x2daea9,_0x1d98d6);_0x2daea9['log'](_0x63f9('0x65'));});onConnect(_0x2daea9);_0x2daea9[_0x63f9('0x59')]('CONNECTED');});}; \ No newline at end of file +var _0x29b6=['telephone','format','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:outbound','userProfileId','MailQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','length','fax','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where'];(function(_0x8fab0,_0x1f8342){var _0x386ba8=function(_0xd7e569){while(--_0xd7e569){_0x8fab0['push'](_0x8fab0['shift']());}};_0x386ba8(++_0x1f8342);}(_0x29b6,0x17e));var _0x629b=function(_0x5e06a9,_0x4b322b){_0x5e06a9=_0x5e06a9-0x0;var _0x398372=_0x29b6[_0x5e06a9];return _0x398372;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var BPromise=require(_0x629b('0x2'));var db=require(_0x629b('0x3'))['db'];var config=require(_0x629b('0x4'));var queryQueues={'attributes':['id',_0x629b('0x5')],'include':[{'as':_0x629b('0x6'),'model':db[_0x629b('0x7')],'attributes':['id',_0x629b('0x5'),_0x629b('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x629b('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x629b('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x629b('0x5')],'where':{'role':_0x629b('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x629b('0x5'),'type'],'where':{'type':_0x629b('0xa')}};function getAssociatedResources(_0x1b586f,_0x579fcf,_0x28c152){return db[_0x629b('0xb')][_0x629b('0xc')]({'where':{'name':_0x1b586f,'userProfileId':_0x579fcf},'raw':!![]})[_0x629b('0xd')](function(_0x34efc3){if(_0x34efc3){if(_0x34efc3[_0x629b('0xe')]){switch(_0x1b586f){case _0x629b('0xf'):case _0x629b('0x10'):case _0x629b('0x11'):case _0x629b('0x12'):case'MailQueues':case'OpenchannelQueues':case _0x629b('0x13'):return db[_0x28c152][_0x629b('0x14')](queryQueues);case _0x629b('0x15'):return db[_0x28c152]['findAll'](queryTelephones);case _0x629b('0x16'):return db[_0x28c152][_0x629b('0x14')](queryTrunks);case _0x629b('0x17'):return db[_0x28c152][_0x629b('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x629b('0x14')]({'attributes':[_0x629b('0x18')],'where':{'sectionId':_0x34efc3['id']},'raw':!![]})[_0x629b('0xd')](function(_0xa79d91){if(_0xa79d91){var _0x2c1f4f={'where':{'id':_['map'](_0xa79d91,_0x629b('0x18'))},'raw':!![]};switch(_0x28c152){case'User':_0x2c1f4f[_0x629b('0x19')][_0x629b('0x8')]=_0x629b('0x1a');break;case'Campaign':_0x2c1f4f[_0x629b('0x19')]['type']=_0x629b('0xa');break;}return db[_0x28c152]['findAll'](_0x2c1f4f);}else{return[];}});}}else{return[];}})[_0x629b('0xd')](function(_0x56edea){return _0x56edea;});}function joinOrLeaveQueues(_0x38c832,_0x15091c,_0x38d070,_0x4f3d16){_0x38c832[_0x15091c](util[_0x629b('0x1b')]('%s:queue:%s',_0x38d070,_0x4f3d16[_0x629b('0x5')]));if(_0x4f3d16[_0x629b('0x6')]){for(var _0x16d70a=0x0;_0x16d70a<_0x4f3d16[_0x629b('0x6')]['length'];_0x16d70a+=0x1){_0x38c832[_0x15091c](util[_0x629b('0x1b')]('user:%s',_0x4f3d16[_0x629b('0x6')][_0x16d70a][_0x629b('0x5')]));}}}function joinOrLeave(_0x24c8a2,_0x5f2d6d,_0x457813){var _0x1e773e;if(_0x24c8a2[_0x629b('0x1c')][_0x629b('0x1d')]['id']){db[_0x629b('0x7')][_0x629b('0x1e')]({'attributes':['id',_0x629b('0x5'),'role','userProfileId'],'where':{'id':_0x24c8a2['handshake']['query']['id']},'include':[{'model':db[_0x629b('0x1f')],'as':_0x629b('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x629b('0x21')],'as':_0x629b('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x629b('0x23')],'as':_0x629b('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x629b('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x629b('0x26')],'as':_0x629b('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x629b('0x28')],'as':_0x629b('0x29'),'attributes':['id'],'raw':!![]}]})[_0x629b('0xd')](function(_0x3ef549){if(_0x3ef549){_0x1e773e=_0x3ef549;_0x24c8a2[_0x5f2d6d](util[_0x629b('0x1b')]('user:%s',_0x3ef549['name']));var _0x6fd15=[];switch(_0x3ef549[_0x629b('0x8')]){case'admin':_0x24c8a2[_0x5f2d6d](_0x629b('0x2a'));_0x24c8a2[_0x5f2d6d]('voice:outbound');if(queryQueues[_0x629b('0x2b')](_0x629b('0x2c'))){delete queryQueues['include'];}_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x2e')][_0x629b('0x14')](queryQueues));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x2f')][_0x629b('0x14')](queryQueues));_0x6fd15['push'](db[_0x629b('0x30')][_0x629b('0x14')](queryQueues));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x31')][_0x629b('0x14')](queryQueues));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x32')][_0x629b('0x14')](queryQueues));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x33')][_0x629b('0x14')](queryQueues));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x34')]['findAll'](queryQueues));_0x6fd15['push'](db[_0x629b('0x7')][_0x629b('0x14')](queryTelephones));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x35')]['findAll'](queryTrunks));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x36')][_0x629b('0x14')](queryCampaigns));_0x6fd15[_0x629b('0x2d')](db['User'][_0x629b('0x14')](queryAgents));break;case _0x629b('0x37'):_0x24c8a2[_0x5f2d6d](_0x629b('0x2a'));_0x24c8a2[_0x5f2d6d](_0x629b('0x38'));_0x6fd15[_0x629b('0x2d')](getAssociatedResources('VoiceQueues',_0x3ef549[_0x629b('0x39')],_0x629b('0x2e')));_0x6fd15[_0x629b('0x2d')](getAssociatedResources(_0x629b('0x10'),_0x3ef549[_0x629b('0x39')],_0x629b('0x2f')));_0x6fd15[_0x629b('0x2d')](getAssociatedResources(_0x629b('0x11'),_0x3ef549[_0x629b('0x39')],'FaxQueue'));_0x6fd15[_0x629b('0x2d')](getAssociatedResources(_0x629b('0x12'),_0x3ef549['userProfileId'],_0x629b('0x31')));_0x6fd15[_0x629b('0x2d')](getAssociatedResources(_0x629b('0x3a'),_0x3ef549[_0x629b('0x39')],'MailQueue'));_0x6fd15['push'](getAssociatedResources(_0x629b('0x3b'),_0x3ef549[_0x629b('0x39')],_0x629b('0x33')));_0x6fd15[_0x629b('0x2d')](getAssociatedResources(_0x629b('0x13'),_0x3ef549['userProfileId'],_0x629b('0x34')));_0x6fd15[_0x629b('0x2d')](getAssociatedResources(_0x629b('0x15'),_0x3ef549[_0x629b('0x39')],_0x629b('0x7')));_0x6fd15['push'](getAssociatedResources('Trunks',_0x3ef549[_0x629b('0x39')],_0x629b('0x35')));_0x6fd15[_0x629b('0x2d')](getAssociatedResources(_0x629b('0x17'),_0x3ef549[_0x629b('0x39')],_0x629b('0x36')));_0x6fd15[_0x629b('0x2d')](db[_0x629b('0x7')]['findAll'](queryAgents));break;case _0x629b('0x9'):_0x24c8a2[_0x5f2d6d](_0x629b('0x2a'));_0x24c8a2[_0x5f2d6d](_0x629b('0x38'));_0x6fd15[_0x629b('0x2d')](_0x3ef549[_0x629b('0x3c')]({'attributes':['id','name']}));_0x6fd15['push'](_0x3ef549[_0x629b('0x3d')]({'attributes':['id',_0x629b('0x5')]}));_0x6fd15[_0x629b('0x2d')](_0x3ef549[_0x629b('0x3e')]({'attributes':['id','name']}));_0x6fd15[_0x629b('0x2d')](_0x3ef549['getSmsQueues']({'attributes':['id',_0x629b('0x5')]}));_0x6fd15[_0x629b('0x2d')](_0x3ef549['getMailQueues']({'attributes':['id',_0x629b('0x5')]}));_0x6fd15[_0x629b('0x2d')](_0x3ef549[_0x629b('0x3f')]({'attributes':['id',_0x629b('0x5')]}));_0x6fd15[_0x629b('0x2d')](_0x3ef549[_0x629b('0x40')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x6fd15);}})[_0x629b('0xd')](function(_0x18e1c8){if(_0x18e1c8&&_0x18e1c8[_0x629b('0x41')]){for(var _0x1ef21d=0x0;_0x1ef21d<_0x18e1c8[_0x629b('0x41')];_0x1ef21d+=0x1){for(var _0x3b91a5=0x0;_0x3b91a5<_0x18e1c8[_0x1ef21d][_0x629b('0x41')];_0x3b91a5+=0x1){switch(_0x1ef21d){case 0x0:joinOrLeaveQueues(_0x24c8a2,_0x5f2d6d,'voice',_0x18e1c8[_0x1ef21d][_0x3b91a5]);break;case 0x1:joinOrLeaveQueues(_0x24c8a2,_0x5f2d6d,'chat',_0x18e1c8[_0x1ef21d][_0x3b91a5]);break;case 0x2:joinOrLeaveQueues(_0x24c8a2,_0x5f2d6d,_0x629b('0x42'),_0x18e1c8[_0x1ef21d][_0x3b91a5]);break;case 0x3:joinOrLeaveQueues(_0x24c8a2,_0x5f2d6d,'sms',_0x18e1c8[_0x1ef21d][_0x3b91a5]);break;case 0x4:joinOrLeaveQueues(_0x24c8a2,_0x5f2d6d,_0x629b('0x43'),_0x18e1c8[_0x1ef21d][_0x3b91a5]);break;case 0x5:joinOrLeaveQueues(_0x24c8a2,_0x5f2d6d,'openchannel',_0x18e1c8[_0x1ef21d][_0x3b91a5]);break;case 0x6:joinOrLeaveQueues(_0x24c8a2,_0x5f2d6d,_0x629b('0x44'),_0x18e1c8[_0x1ef21d][_0x3b91a5]);break;case 0x7:if(_0x1e773e[_0x629b('0x8')]!==_0x629b('0x9'))_0x24c8a2[_0x5f2d6d](util[_0x629b('0x1b')](_0x629b('0x45'),_0x18e1c8[_0x1ef21d][_0x3b91a5][_0x629b('0x5')]));break;case 0x8:if(_0x1e773e[_0x629b('0x8')]!==_0x629b('0x9'))_0x24c8a2[_0x5f2d6d](util['format'](_0x629b('0x46'),_0x18e1c8[_0x1ef21d][_0x3b91a5]['name']));break;case 0x9:if(_0x1e773e[_0x629b('0x8')]!==_0x629b('0x9'))_0x24c8a2[_0x5f2d6d](util['format'](_0x629b('0x47'),_0x18e1c8[_0x1ef21d][_0x3b91a5]['type'],_0x18e1c8[_0x1ef21d][_0x3b91a5]['name']));break;case 0xa:_0x24c8a2[_0x5f2d6d](util[_0x629b('0x1b')](_0x629b('0x48'),_0x18e1c8[_0x1ef21d][_0x3b91a5][_0x629b('0x5')]));break;}}}}})[_0x629b('0xd')](function(){if(_0x5f2d6d==='leave'){var _0x2aec26=_[_0x629b('0x49')](_0x1e773e['ChatInteractions'],'id');return _0x1e773e[_0x629b('0x4a')](_0x2aec26)[_0x629b('0xd')](function(){for(var _0x3f757b=0x0;_0x3f757b<_0x2aec26['length'];_0x3f757b+=0x1){_0x457813[_0x629b('0x4b')](_0x629b('0x4c'),{'ChatInteractionId':Number(_0x2aec26[_0x3f757b]),'UserId':Number(_0x1e773e['id'])});}});}})[_0x629b('0xd')](function(){if(_0x5f2d6d===_0x629b('0x4d')){var _0x28e9e0=_['map'](_0x1e773e['MailInteractions'],'id');return _0x1e773e[_0x629b('0x4e')](_0x28e9e0)[_0x629b('0xd')](function(){for(var _0x2038c7=0x0;_0x2038c7<_0x28e9e0[_0x629b('0x41')];_0x2038c7+=0x1){_0x457813[_0x629b('0x4b')](_0x629b('0x4f'),{'MailInteractionId':Number(_0x28e9e0[_0x2038c7]),'UserId':Number(_0x1e773e['id'])});}});}})['then'](function(){if(_0x5f2d6d==='leave'){var _0x11495b=_[_0x629b('0x49')](_0x1e773e[_0x629b('0x24')],'id');return _0x1e773e[_0x629b('0x50')](_0x11495b)[_0x629b('0xd')](function(){for(var _0x1d31fc=0x0;_0x1d31fc<_0x11495b['length'];_0x1d31fc+=0x1){_0x457813['emit'](_0x629b('0x51'),{'FaxInteractionId':Number(_0x11495b[_0x1d31fc]),'UserId':Number(_0x1e773e['id'])});}});}})[_0x629b('0xd')](function(){if(_0x5f2d6d==='leave'){var _0x4a71c0=_[_0x629b('0x49')](_0x1e773e[_0x629b('0x25')],'id');return _0x1e773e[_0x629b('0x52')](_0x4a71c0)[_0x629b('0xd')](function(){for(var _0x1b4779=0x0;_0x1b4779<_0x4a71c0[_0x629b('0x41')];_0x1b4779+=0x1){_0x457813['emit'](_0x629b('0x53'),{'SmsInteractionId':Number(_0x4a71c0[_0x1b4779]),'UserId':Number(_0x1e773e['id'])});}});}})[_0x629b('0xd')](function(){if(_0x5f2d6d===_0x629b('0x4d')){var _0x5ccef5=_[_0x629b('0x49')](_0x1e773e[_0x629b('0x27')],'id');return _0x1e773e[_0x629b('0x54')](_0x5ccef5)['then'](function(){for(var _0x5d1f09=0x0;_0x5d1f09<_0x5ccef5[_0x629b('0x41')];_0x5d1f09+=0x1){_0x457813[_0x629b('0x4b')](_0x629b('0x55'),{'OpenchannelInteractionId':Number(_0x5ccef5[_0x5d1f09]),'UserId':Number(_0x1e773e['id'])});}});}})['then'](function(){if(_0x5f2d6d===_0x629b('0x4d')){var _0x228710=_[_0x629b('0x49')](_0x1e773e[_0x629b('0x29')],'id');return _0x1e773e[_0x629b('0x56')](_0x228710)[_0x629b('0xd')](function(){for(var _0x48544e=0x0;_0x48544e<_0x228710[_0x629b('0x41')];_0x48544e+=0x1){_0x457813[_0x629b('0x4b')](_0x629b('0x57'),{'WhatsappInteractionId':Number(_0x228710[_0x48544e]),'UserId':Number(_0x1e773e['id'])});}});}})[_0x629b('0x58')](function(_0x25d9e9){_0x24c8a2[_0x629b('0x59')](_0x25d9e9);});}}function onDisconnect(_0x528d33,_0x4824a8){joinOrLeave(_0x528d33,_0x629b('0x4d'),_0x4824a8);}function onConnect(_0x45b3a1){joinOrLeave(_0x45b3a1,_0x629b('0x5a'));}exports[_0x629b('0x5b')]=function(_0x3d6e03){_0x3d6e03['on'](_0x629b('0x5c'),function(_0x38d69c){_0x38d69c[_0x629b('0x5d')](0x0);_0x38d69c[_0x629b('0x5e')]=_0x38d69c[_0x629b('0x5f')][_0x629b('0x5c')][_0x629b('0x60')]+':'+_0x38d69c[_0x629b('0x5f')]['connection'][_0x629b('0x61')];_0x38d69c['connectedAt']=new Date();_0x38d69c[_0x629b('0x59')]=function(_0x4d7d24){console['log'](_0x629b('0x62')+_0x38d69c['nsp']['name']+'['+_0x38d69c['address']+']',_0x4d7d24);};_0x38d69c['on'](_0x629b('0x63'),function(){onDisconnect(_0x38d69c,_0x3d6e03);_0x38d69c[_0x629b('0x59')](_0x629b('0x64'));});onConnect(_0x38d69c);_0x38d69c[_0x629b('0x59')](_0x629b('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4cab5d7..8a8ea6a 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 _0xbf01=['OpenchannelMessage','EventManager','then','info','error','code','Trigger,\x20%s','get','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','SELECT','contact','UserId','format','SIP/%s','agent','catch','channel','offlineMessage','opened','resolve','interface','name','AfterCreate','closed','changed','substatus','sequelize','Sequelize','QueryTypes','find','fullname','email','internal','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','Sms','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction'];(function(_0x2af29a,_0x4f44bc){var _0x5ef02f=function(_0x4349ef){while(--_0x4349ef){_0x2af29a['push'](_0x2af29a['shift']());}};_0x5ef02f(++_0x4f44bc);}(_0xbf01,0x78));var _0x1bf0=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xbf01[_0x151721];return _0x2deaa7;};'use strict';var util=require(_0x1bf0('0x0'));var db=require(_0x1bf0('0x1'))['db'];var jayson=require(_0x1bf0('0x2'));var logger=require(_0x1bf0('0x3'))('triggers');var client=jayson[_0x1bf0('0x4')][_0x1bf0('0x5')]({'port':0x232a});var triggers=[{'channel':_0x1bf0('0x6'),'model':_0x1bf0('0x7'),'event':_0x1bf0('0x8'),'condition':_0x1bf0('0x9'),'callback':afterCreate},{'channel':_0x1bf0('0x6'),'model':_0x1bf0('0x7'),'event':_0x1bf0('0xa'),'condition':_0x1bf0('0xb'),'callback':afterUpdate},{'channel':_0x1bf0('0x6'),'model':_0x1bf0('0xc'),'event':'afterCreate','condition':_0x1bf0('0xd'),'callback':afterCreateMessage},{'channel':_0x1bf0('0x6'),'model':_0x1bf0('0xe'),'event':'afterCreate','condition':_0x1bf0('0xd'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x1bf0('0xf'),'event':_0x1bf0('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x1bf0('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1bf0('0x10'),'model':'SmsMessage','event':_0x1bf0('0x8'),'condition':_0x1bf0('0xd'),'callback':afterCreateMessage},{'channel':_0x1bf0('0x11'),'model':_0x1bf0('0x12'),'event':'afterCreate','condition':_0x1bf0('0x9'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x1bf0('0x12'),'event':_0x1bf0('0xa'),'condition':_0x1bf0('0xb'),'callback':afterUpdate},{'channel':_0x1bf0('0x11'),'model':_0x1bf0('0x13'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1bf0('0x14'),'model':_0x1bf0('0x15'),'event':_0x1bf0('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0x1bf0('0x15'),'event':_0x1bf0('0xa'),'condition':_0x1bf0('0xb'),'callback':afterUpdate},{'channel':'Fax','model':_0x1bf0('0x16'),'event':'afterCreate','condition':_0x1bf0('0xd'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x1bf0('0x17'),'event':_0x1bf0('0x8'),'condition':_0x1bf0('0x9'),'callback':afterCreate},{'channel':'Mail','model':_0x1bf0('0x17'),'event':'afterUpdate','condition':_0x1bf0('0xb'),'callback':afterUpdate},{'channel':_0x1bf0('0x18'),'model':_0x1bf0('0x19'),'event':_0x1bf0('0x8'),'condition':_0x1bf0('0xd'),'callback':afterCreateMessage},{'channel':_0x1bf0('0x1a'),'model':_0x1bf0('0x1b'),'event':_0x1bf0('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x1bf0('0x1b'),'event':_0x1bf0('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1bf0('0x1a'),'model':_0x1bf0('0x1c'),'event':_0x1bf0('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x55133a){return client['request'](_0x1bf0('0x1d'),_0x55133a)[_0x1bf0('0x1e')](function(_0x2c43b0){logger[_0x1bf0('0x1f')]('Trigger,\x20%s',_0x1bf0('0x1d'),_0x2c43b0);if(_0x2c43b0[_0x1bf0('0x20')]){if(_0x2c43b0['error'][_0x1bf0('0x21')]===0x1f4){logger['error']('Trigger,\x20%s',_0x1bf0('0x1d'),_0x2c43b0[_0x1bf0('0x20')]);}}})['catch'](function(_0x4156d2){logger['error'](_0x1bf0('0x22'),_0x1bf0('0x1d'),_0x4156d2);});}function afterCreateMessage(_0x10794f){return function(_0x1d2478){_0x1d2478=_0x1d2478[_0x1bf0('0x23')]({'plain':!![]});_0x1d2478['channel']=_0x10794f;_0x1d2478[_0x1bf0('0x24')]=_0x10794f;_0x1d2478[_0x1bf0('0x25')]=_0x1d2478[_0x1bf0('0x26')];Promise['resolve']()['then'](function(){if(typeof _0x1d2478[_0x1bf0('0x27')]===_0x1bf0('0x28'))return null;var _0x3b7d91=_0x1bf0('0x29')+_0x1d2478[_0x1bf0('0x27')];return db['sequelize'][_0x1bf0('0x2a')](_0x3b7d91,{'type':db['Sequelize']['QueryTypes'][_0x1bf0('0x2b')],'raw':!![]});})[_0x1bf0('0x1e')](function(_0xbad31f){if(_0xbad31f){_0x1d2478[_0x1bf0('0x2c')]=_0xbad31f[0x0];}if(typeof _0x1d2478[_0x1bf0('0x2d')]===_0x1bf0('0x28'))return;return getAgent(_0x1d2478[_0x1bf0('0x2d')]);})[_0x1bf0('0x1e')](function(_0x45f309){if(_0x45f309){_0x1d2478['interface']=util[_0x1bf0('0x2e')](_0x1bf0('0x2f'),_0x45f309['name']);_0x1d2478[_0x1bf0('0x30')]=_0x45f309;_0x1d2478['channel']=_0x10794f;return request({'event':'incomingmessage','message':_0x1d2478});}else{return request({'event':'outgoingmessage','message':_0x1d2478});}})[_0x1bf0('0x31')](function(_0x5f3f71){logger[_0x1bf0('0x20')](_0x1bf0('0x22'),'AfterCreateMessage',_0x5f3f71);});};}function afterCreateOfflineMessage(_0x38fa38){return function(_0x2090df){_0x2090df=_0x2090df[_0x1bf0('0x23')]({'plain':!![]});_0x2090df[_0x1bf0('0x32')]=_0x38fa38;_0x2090df[_0x1bf0('0x24')]=_0x38fa38;_0x2090df[_0x1bf0('0x25')]=_0x1bf0('0x33');return request({'event':_0x2090df[_0x1bf0('0x25')],'message':_0x2090df});};}function afterCreate(_0x496ac8,_0xf0087d){return function(_0x1db4e8){_0x1db4e8=_0x1db4e8[_0x1bf0('0x23')]({'plain':!![]});_0x1db4e8[_0x1bf0('0x32')]=_0x496ac8;_0x1db4e8['motionChannel']=_0x496ac8;_0x1db4e8['event']=_0x1bf0('0x34');Promise[_0x1bf0('0x35')]()[_0x1bf0('0x1e')](function(){var _0x4e0858=_0x1bf0('0x29')+_0x1db4e8['ContactId'];return db['sequelize'][_0x1bf0('0x2a')](_0x4e0858,{'type':db['Sequelize']['QueryTypes'][_0x1bf0('0x2b')],'raw':!![]});})['then'](function(_0x4b64d3){if(_0x4b64d3){_0x1db4e8[_0x1bf0('0x2c')]=_0x4b64d3[0x0];}if(typeof _0x1db4e8['UserId']==='undefined')return;return getAgent(_0x1db4e8[_0x1bf0('0x2d')]);})[_0x1bf0('0x1e')](function(_0x4e999e){if(_0x4e999e){_0x1db4e8[_0x1bf0('0x36')]=util[_0x1bf0('0x2e')](_0x1bf0('0x2f'),_0x4e999e[_0x1bf0('0x37')]);_0x1db4e8[_0x1bf0('0x30')]=_0x4e999e;}return request({'event':_0xf0087d,'message':_0x1db4e8});})['catch'](function(_0x217562){logger[_0x1bf0('0x20')](_0x1bf0('0x22'),_0x1bf0('0x38'),_0x217562);});};}function afterUpdate(_0x316e9a){return function(_0x3feab2){var _0x8ed612=_0x3feab2['changed'](_0x1bf0('0x39'))&&_0x3feab2[_0x1bf0('0x39')];var _0x4c996c=_0x3feab2[_0x1bf0('0x3a')](_0x1bf0('0x3b'));if(_0x8ed612||_0x4c996c){var _0x1d8d06=_0x8ed612?_0x1bf0('0xb'):_0x1bf0('0x3b');var _0x5984ab=_0x3feab2[_0x1bf0('0x23')]({'plain':!![]});_0x5984ab[_0x1bf0('0x32')]=_0x316e9a;_0x5984ab[_0x1bf0('0x24')]=_0x316e9a;_0x5984ab[_0x1bf0('0x25')]=_0x8ed612?_0x1bf0('0x39'):_0x1bf0('0x3b');var _0xfd5440=_0x1bf0('0x29')+_0x5984ab[_0x1bf0('0x27')];return db[_0x1bf0('0x3c')][_0x1bf0('0x2a')](_0xfd5440,{'type':db[_0x1bf0('0x3d')][_0x1bf0('0x3e')][_0x1bf0('0x2b')],'raw':!![]})[_0x1bf0('0x1e')](function(_0x338609){if(_0x338609){_0x5984ab[_0x1bf0('0x2c')]=_0x338609[0x0];}if(typeof _0x5984ab[_0x1bf0('0x2d')]===_0x1bf0('0x28'))return;return getAgent(_0x5984ab[_0x1bf0('0x2d')]);})[_0x1bf0('0x1e')](function(_0x3bde01){if(_0x3bde01){_0x5984ab['interface']=util['format']('SIP/%s',_0x3bde01[_0x1bf0('0x37')]);_0x5984ab[_0x1bf0('0x30')]=_0x3bde01;}return request({'event':_0x1d8d06,'message':_0x5984ab});})[_0x1bf0('0x31')](function(_0x118613){logger[_0x1bf0('0x20')]('Trigger,\x20%s','AfterUpdate',_0x118613);});}};}function getAgent(_0x28dbb6){return db['User'][_0x1bf0('0x3f')]({'where':{'id':_0x28dbb6},'attributes':['id',_0x1bf0('0x37'),_0x1bf0('0x40'),_0x1bf0('0x41'),_0x1bf0('0x42')],'raw':!![]})[_0x1bf0('0x1e')](function(_0x48ec6d){return _0x48ec6d;});}exports[_0x1bf0('0x43')]=function(){for(var _0x254588=0x0;_0x254588=_0xe17573[_0x91f1('0x14')]){throw Error(_0x91f1('0x15'));}_0x211ffd(_0x13d6a8);})[_0x91f1('0x16')](function(_0x46b222){_0x95eaba(_0x46b222);});});}; \ No newline at end of file +var _0xd014=['mail','chat','fax','openchannel','toLowerCase','includes','clearBlockUser','isUndefined','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','./license/util','voice'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xd014,0x1ea));var _0x4d01=function(_0x2170ed,_0xe46dbf){_0x2170ed=_0x2170ed-0x0;var _0x4dd2ca=_0xd014[_0x2170ed];return _0x4dd2ca;};'use strict';var _=require(_0x4d01('0x0'));var BPromise=require('bluebird');var db=require(_0x4d01('0x1'))['db'];var util=require(_0x4d01('0x2'));var channels=[_0x4d01('0x3'),_0x4d01('0x4'),_0x4d01('0x5'),_0x4d01('0x6'),'sms','whatsapp',_0x4d01('0x7')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x25c7b8){_0x25c7b8=_0x25c7b8[_0x4d01('0x8')]();return _[_0x4d01('0x9')](channels,_0x25c7b8);};exports[_0x4d01('0xa')]=function(_0x2a06fb,_0x5536d3,_0x4e7c3a,_0x2cec6b){var _0x5e3009={'loginAttempts':_0x5536d3,'blocked':_0x4e7c3a};if(!_[_0x4d01('0xb')](_0x2cec6b)){_0x5e3009['blockedAt']=_0x2cec6b;}return _0x2a06fb['updateAttributes'](_0x5e3009);};exports[_0x4d01('0xc')]=function(_0x5b9f07){return new BPromise(function(_0x4842df,_0x1652a4){var _0x1cb2a5=0x0;if(_0x5b9f07[_0x4d01('0xd')]!=='agent'){_0x4842df(_0x5b9f07);}db['User'][_0x4d01('0xe')]({'where':{'role':_0x4d01('0xf'),'online':!![],'id':{'$ne':_0x5b9f07['id']}}})[_0x4d01('0x10')](function(_0x22d1b2){_0x1cb2a5=_0x22d1b2;return util[_0x4d01('0xc')]();})[_0x4d01('0x10')](function(_0x2b14eb){if(_0x2b14eb&&_0x2b14eb[_0x4d01('0x11')]&&_0x1cb2a5>=_0x2b14eb['agents']){throw Error(_0x4d01('0x12'));}_0x4842df(_0x5b9f07);})['catch'](function(_0x4f8a01){_0x1652a4(_0x4f8a01);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 154802e..f4ae870 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c65=['status','exports','util','../config/logger','api','Internal\x20Server\x20Error','Error','Bad\x20Request','name','inherits','message','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','OutOfInterval','Resource\x20Conflict','Conflict','error','statusMessage'];(function(_0x4607c7,_0x24a84f){var _0x24737c=function(_0x393a99){while(--_0x393a99){_0x4607c7['push'](_0x4607c7['shift']());}};_0x24737c(++_0x24a84f);}(_0x8c65,0x178));var _0x58c6=function(_0x19c788,_0x2cf31d){_0x19c788=_0x19c788-0x0;var _0x364e70=_0x8c65[_0x19c788];return _0x364e70;};'use strict';var util=require(_0x58c6('0x0'));var logger=require(_0x58c6('0x1'))(_0x58c6('0x2'));var APIError=function(_0x39f537,_0x342ea2){this['message']=_0x39f537||_0x58c6('0x3');this['name']=_0x342ea2||_0x58c6('0x4');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x50a414){this['message']=_0x50a414||_0x58c6('0x5');this[_0x58c6('0x6')]=_0x58c6('0x5');util[_0x58c6('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x21ed4b){this[_0x58c6('0x8')]=_0x21ed4b||_0x58c6('0x9');this[_0x58c6('0x6')]='Forbidden';util[_0x58c6('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0xfdab01){this[_0x58c6('0x8')]=_0xfdab01||_0x58c6('0xa');this['name']=_0x58c6('0xb');util[_0x58c6('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x42d11a){this[_0x58c6('0x8')]=_0x42d11a||_0x58c6('0xc');this['name']=_0x58c6('0xd');this[_0x58c6('0xe')]=0x193;this['details']={'type':_0x58c6('0xf')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1b5404){this[_0x58c6('0x8')]=_0x1b5404||_0x58c6('0x10');this[_0x58c6('0x6')]=_0x58c6('0x11');util[_0x58c6('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0xd77751){switch(_0xd77751){case'Bad\x20Request':return 0x190;case _0x58c6('0x9'),_0x58c6('0xd'):return 0x193;case'Not\x20Found':return 0x194;case _0x58c6('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x6405fb){if(_0x6405fb===_0x58c6('0xd'))return _0x6405fb;return null;}function handleError(_0x146616){return function(_0xa88e3b){logger[_0x58c6('0x12')](_0xa88e3b['stack']);var _0x45447a=getStatusCode(_0xa88e3b['name']);var _0x16fee3=getCustomStatusMessage(_0xa88e3b[_0x58c6('0x6')]);if(_0xa88e3b[_0x58c6('0x6')]){delete _0xa88e3b[_0x58c6('0x6')];}if(_0x16fee3){_0x146616[_0x58c6('0x13')]=_0x16fee3;}return _0x146616[_0x58c6('0x14')](_0x45447a)['send'](_0xa88e3b);};}module[_0x58c6('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x88c2=['../config/logger','api','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','OutOfInterval','Conflict','error','statusMessage','util'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x88c2,0x1af));var _0x288c=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x88c2[_0x44268d];return _0x4be92d;};'use strict';var util=require(_0x288c('0x0'));var logger=require(_0x288c('0x1'))(_0x288c('0x2'));var APIError=function(_0x1a6495,_0x56af83){this[_0x288c('0x3')]=_0x1a6495||_0x288c('0x4');this[_0x288c('0x5')]=_0x56af83||'Error';util[_0x288c('0x6')](APIError,Error);};var APIBadRequestError=function(_0x5e75dd){this['message']=_0x5e75dd||_0x288c('0x7');this[_0x288c('0x5')]=_0x288c('0x7');util[_0x288c('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x4a25bf){this[_0x288c('0x3')]=_0x4a25bf||_0x288c('0x8');this[_0x288c('0x5')]=_0x288c('0x8');util[_0x288c('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x185440){this[_0x288c('0x3')]=_0x185440||_0x288c('0x9');this[_0x288c('0x5')]=_0x288c('0xa');util[_0x288c('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3359cd){this[_0x288c('0x3')]=_0x3359cd||_0x288c('0xb');this['name']=_0x288c('0xc');this[_0x288c('0xd')]=0x193;this['details']={'type':_0x288c('0xe')};util[_0x288c('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1707f3){this['message']=_0x1707f3||'Resource\x20Conflict';this[_0x288c('0x5')]=_0x288c('0xf');util[_0x288c('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x17f34b){switch(_0x17f34b){case _0x288c('0x7'):return 0x190;case _0x288c('0x8'),'Out\x20Of\x20Interval':return 0x193;case _0x288c('0xa'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4e9bc){if(_0x4e9bc===_0x288c('0xc'))return _0x4e9bc;return null;}function handleError(_0x139a1b){return function(_0x5c562d){logger[_0x288c('0x10')](_0x5c562d['stack']);var _0x245090=getStatusCode(_0x5c562d[_0x288c('0x5')]);var _0x10d372=getCustomStatusMessage(_0x5c562d['name']);if(_0x5c562d[_0x288c('0x5')]){delete _0x5c562d[_0x288c('0x5')];}if(_0x10d372){_0x139a1b[_0x288c('0x11')]=_0x10d372;}return _0x139a1b['status'](_0x245090)['send'](_0x5c562d);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f14ff72..6a341f0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x459c=['status','render','404'];(function(_0xa961c5,_0xdd9ef0){var _0x33e6bf=function(_0x55f981){while(--_0x55f981){_0xa961c5['push'](_0xa961c5['shift']());}};_0x33e6bf(++_0xdd9ef0);}(_0x459c,0x12b));var _0xc459=function(_0xce5c26,_0x1ffb7d){_0xce5c26=_0xce5c26-0x0;var _0x4c3715=_0x459c[_0xce5c26];return _0x4c3715;};'use strict';module['exports'][0x194]=function pageNotFound(_0x19931b,_0x58d519){var _0x24ff5f=_0xc459('0x0');var _0x29fdaa=0x194;var _0x1ad1f0={'status':_0x29fdaa};_0x58d519[_0xc459('0x1')](_0x1ad1f0[_0xc459('0x1')]);_0x58d519[_0xc459('0x2')](_0x24ff5f,{},function(_0x14bdb6,_0x58493e){if(_0x14bdb6){return _0x58d519[_0xc459('0x1')](_0x1ad1f0[_0xc459('0x1')])['json'](_0x1ad1f0);}_0x58d519['send'](_0x58493e);});}; \ No newline at end of file +var _0x557d=['status','json','send','exports'];(function(_0x2b39b4,_0x1aedfc){var _0x437214=function(_0x4a9e2d){while(--_0x4a9e2d){_0x2b39b4['push'](_0x2b39b4['shift']());}};_0x437214(++_0x1aedfc);}(_0x557d,0xcb));var _0xd557=function(_0x23bf5d,_0x3fa335){_0x23bf5d=_0x23bf5d-0x0;var _0x5b040d=_0x557d[_0x23bf5d];return _0x5b040d;};'use strict';module[_0xd557('0x0')][0x194]=function pageNotFound(_0x1b3a44,_0x157a69){var _0x103eb0='404';var _0x479f66=0x194;var _0x2ee354={'status':_0x479f66};_0x157a69[_0xd557('0x1')](_0x2ee354['status']);_0x157a69['render'](_0x103eb0,{},function(_0x479940,_0x7f3f34){if(_0x479940){return _0x157a69['status'](_0x2ee354[_0xd557('0x1')])[_0xd557('0x2')](_0x2ee354);}_0x157a69[_0xd557('0x3')](_0x7f3f34);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index c2093a2..163fcf8 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c99=['OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','UserMailQueue','ChatQueue','ChatQueues','FaxQueues','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceExtension','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','Items','Dispositions','FaxAccountId','CannedAnswer','Interactions','Exntensions','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','chat_group_has_users','Contacts','CompanyId','Phones','CmContactId','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','FaxApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','ContactItemType','ItemType','ItemTypeId','Hopper','CmHopperId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Field','Variable','SugarcrmField','Description','DeskAccount','VariableId','Subjects','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','VtigerField','Dynamics365Field','FreshsalesAccount','FromId','SessionId','ProjectId','user_has_teams','team_has_fax_queues','team_has_sms_queues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','FromUserId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','utf8mb4','database','username','options','password','User','import','../api/user/user.model','../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','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model'];(function(_0x456b95,_0x1d99e7){var _0x4d46d4=function(_0x517de8){while(--_0x517de8){_0x456b95['push'](_0x456b95['shift']());}};_0x4d46d4(++_0x1d99e7);}(_0x0c99,0x1af));var _0x90c9=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x0c99[_0x2998db];return _0x115fea;};'use strict';var config=require(_0x90c9('0x0'));var Sequelize=require(_0x90c9('0x1'));var _=require(_0x90c9('0x2'));var jstz=require('jstz');var timezone=jstz[_0x90c9('0x3')]();config[_0x90c9('0x1')]=_[_0x90c9('0x4')](config[_0x90c9('0x1')],{'database':'motion2','username':_0x90c9('0x5'),'password':_0x90c9('0x6'),'options':{'host':_0x90c9('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x90c9('0x8')](),'define':{'charset':_0x90c9('0x9'),'collate':_0x90c9('0xa')}}});config[_0x90c9('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':_0x90c9('0x5'),'password':_0x90c9('0x6'),'options':{'host':_0x90c9('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x90c9('0xc')},'logging':![],'timezone':timezone[_0x90c9('0x8')](),'define':{'charset':_0x90c9('0x9'),'collate':_0x90c9('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x90c9('0x1')][_0x90c9('0xd')],config['sequelize'][_0x90c9('0xe')],config[_0x90c9('0x1')]['password'],config[_0x90c9('0x1')][_0x90c9('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x90c9('0xb')][_0x90c9('0xd')],config[_0x90c9('0xb')][_0x90c9('0xe')],config['sequelizeHistory'][_0x90c9('0x10')],config[_0x90c9('0xb')]['options'])};db[_0x90c9('0x11')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x13'));db['VoiceChanSpy']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x14'));db[_0x90c9('0x15')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x16'));db['VoiceExtension']=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x17'));db[_0x90c9('0x18')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x19'));db[_0x90c9('0x1a')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x1b'));db[_0x90c9('0x1c')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x1d'));db[_0x90c9('0x1e')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x1f'));db[_0x90c9('0x20')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/voiceMail/voiceMail.model');db[_0x90c9('0x21')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x22'));db[_0x90c9('0x23')]=db['sequelize']['import'](_0x90c9('0x24'));db[_0x90c9('0x25')]=db['sequelize'][_0x90c9('0x12')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x90c9('0x1')]['import'](_0x90c9('0x26'));db['VoiceQueueReport']=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x27'));db[_0x90c9('0x28')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x29'));db[_0x90c9('0x2a')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x2b'));db[_0x90c9('0x2c')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x2d'));db[_0x90c9('0x2e')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x2f'));db[_0x90c9('0x30')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x31'));db[_0x90c9('0x32')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x33'));db['UserMailQueue']=db[_0x90c9('0x1')]['import'](_0x90c9('0x34'));db[_0x90c9('0x35')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x36'));db[_0x90c9('0x37')]=db['sequelize']['import'](_0x90c9('0x38'));db[_0x90c9('0x39')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x90c9('0x3a')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x90c9('0x3b')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x3c'));db[_0x90c9('0x3d')]=db['sequelize'][_0x90c9('0x12')]('../api/mailServerOut/mailServerOut.model');db[_0x90c9('0x3e')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x3f'));db['MailQueue']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x40'));db[_0x90c9('0x41')]=db['sequelize']['import'](_0x90c9('0x42'));db['MailInteraction']=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x90c9('0x43')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x44'));db[_0x90c9('0x45')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x46'));db[_0x90c9('0x47')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x48'));db[_0x90c9('0x49')]=db['sequelize']['import']('../api/dashboard/dashboard.model');db[_0x90c9('0x4a')]=db['sequelize'][_0x90c9('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x90c9('0x4b')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/faxAccount/faxAccount.model');db[_0x90c9('0x4c')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x4d'));db[_0x90c9('0x4e')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x4f'));db[_0x90c9('0x50')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x51'));db[_0x90c9('0x52')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x53'));db[_0x90c9('0x54')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x55'));db['SmsAccount']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x56'));db[_0x90c9('0x57')]=db['sequelize'][_0x90c9('0x12')]('../api/smsApplication/smsApplication.model');db[_0x90c9('0x58')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x59'));db[_0x90c9('0x5a')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x5b'));db['OpenchannelAccount']=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x5c'));db['OpenchannelApplication']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x5d'));db['OpenchannelInteraction']=db['sequelize'][_0x90c9('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x90c9('0x5e')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x5f'));db[_0x90c9('0x60')]=db['sequelize']['import'](_0x90c9('0x61'));db[_0x90c9('0x62')]=db['sequelize']['import'](_0x90c9('0x63'));db[_0x90c9('0x64')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x65'));db[_0x90c9('0x66')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/chatApplication/chatApplication.model');db[_0x90c9('0x67')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x68'));db[_0x90c9('0x69')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x6a'));db[_0x90c9('0x6b')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x6c'));db[_0x90c9('0x6d')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x6e'));db[_0x90c9('0x6f')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x70'));db[_0x90c9('0x71')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x72'));db[_0x90c9('0x73')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x74'));db[_0x90c9('0x75')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x76'));db[_0x90c9('0x77')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x78'));db[_0x90c9('0x79')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x90c9('0x7a')]=db['sequelize']['import'](_0x90c9('0x7b'));db[_0x90c9('0x7c')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x7d'));db['CannedAnswer']=db['sequelize']['import'](_0x90c9('0x7e'));db[_0x90c9('0x7f')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x80'));db[_0x90c9('0x81')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/condition/condition.model');db[_0x90c9('0x82')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x83'));db['Pause']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x84'));db[_0x90c9('0x85')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/cdr/cdr.model');db[_0x90c9('0x86')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x87'));db[_0x90c9('0x88')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x89'));db[_0x90c9('0x8a')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/sound/sound.model');db[_0x90c9('0x8b')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x8c'));db['ContactItemType']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x8d'));db[_0x90c9('0x8e')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x8f'));db[_0x90c9('0x90')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x91'));db['Template']=db[_0x90c9('0x1')]['import'](_0x90c9('0x92'));db['Trigger']=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x93'));db['Variable']=db['sequelize']['import'](_0x90c9('0x94'));db[_0x90c9('0x95')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x96'));db['IntegrationReport']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x97'));db[_0x90c9('0x98')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x99'));db['AnalyticDefaultReport']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x9a'));db[_0x90c9('0x9b')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x9c'));db[_0x90c9('0x9d')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x9e'));db[_0x90c9('0x9f')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x90c9('0xa0')]=db[_0x90c9('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x90c9('0xa1')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xa2'));db['SalesforceConfiguration']=db[_0x90c9('0x1')]['import'](_0x90c9('0xa3'));db[_0x90c9('0xa4')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xa5'));db[_0x90c9('0xa6')]=db['sequelize']['import'](_0x90c9('0xa7'));db[_0x90c9('0xa8')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xa9'));db['SugarcrmField']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xaa'));db['DeskAccount']=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xab'));db[_0x90c9('0xac')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xad'));db[_0x90c9('0xae')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/intDeskField/intDeskField.model');db[_0x90c9('0xaf')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xb0'));db[_0x90c9('0xb1')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xb2'));db[_0x90c9('0xb3')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xb4'));db[_0x90c9('0xb5')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xb6'));db['ZendeskConfiguration']=db[_0x90c9('0x1')]['import'](_0x90c9('0xb7'));db[_0x90c9('0xb8')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xb9'));db['FreshdeskAccount']=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x90c9('0xba')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xbb'));db[_0x90c9('0xbc')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xbd'));db['VtigerAccount']=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xbe'));db['VtigerConfiguration']=db['sequelize'][_0x90c9('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize']['import'](_0x90c9('0xbf'));db[_0x90c9('0xc0')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xc1'));db[_0x90c9('0xc2')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x90c9('0xc3')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xc4'));db[_0x90c9('0xc5')]=db['sequelize']['import'](_0x90c9('0xc6'));db[_0x90c9('0xc7')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xc8'));db['FreshsalesAccount']=db[_0x90c9('0x1')]['import'](_0x90c9('0xc9'));db[_0x90c9('0xca')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x90c9('0xcb')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xcc'));db[_0x90c9('0x95')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/integration/integration.model');db['Network']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xcd'));db[_0x90c9('0xce')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xcf'));db[_0x90c9('0xd0')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xd1'));db[_0x90c9('0xd2')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xd3'));db[_0x90c9('0xd4')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xd5'));db[_0x90c9('0xd6')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xd7'));db[_0x90c9('0xd8')]=db['sequelize']['import'](_0x90c9('0xd9'));db[_0x90c9('0xda')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xdb'));db[_0x90c9('0xdc')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xdd'));db[_0x90c9('0xde')]=db[_0x90c9('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x90c9('0xdf')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xe0'));db[_0x90c9('0xe1')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xe2'));db[_0x90c9('0xe3')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0xe4'));db['SquareRecording']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xe5'));db[_0x90c9('0xe6')]=db[_0x90c9('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x90c9('0xe7')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xe8'));db[_0x90c9('0xe9')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xea'));db[_0x90c9('0xeb')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xec'));db[_0x90c9('0xed')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xee'));db[_0x90c9('0xef')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xf0'));db['Plugin']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xf1'));db[_0x90c9('0xf2')]=db[_0x90c9('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xf3'));db['FaxTransferReport']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0xf4'));db[_0x90c9('0xf5')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xf6'));db['SmsTransferReport']=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/smsTransferReport/smsTransferReport.model');db[_0x90c9('0xf7')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xf8'));db[_0x90c9('0xf9')]=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x90c9('0xfa')]=db['sequelize']['import'](_0x90c9('0xfb'));db[_0x90c9('0xfc')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xfd'));db[_0x90c9('0xfe')]=db[_0x90c9('0x1')]['import'](_0x90c9('0xff'));db[_0x90c9('0x100')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x101'));db[_0x90c9('0x102')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x103'));db[_0x90c9('0x104')]=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x105'));db[_0x90c9('0x106')]=db[_0x90c9('0x1')]['import'](_0x90c9('0x107'));db[_0x90c9('0x108')]=db[_0x90c9('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x90c9('0x109')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x10a'));db['WhatsappTransferReport']=db['sequelize'][_0x90c9('0x12')](_0x90c9('0x10b'));db['WhatsappQueue']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x10c'));db[_0x90c9('0x10d')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x10e'));db['TeamVoiceQueue']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x10f'));db['TeamVoicePrefix']=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x110'));db['UserVoicePrefix']=db[_0x90c9('0x1')][_0x90c9('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x90c9('0x111')]=db[_0x90c9('0x1')]['import']('../api/user-setting/user-setting.model');db[_0x90c9('0x112')]=db[_0x90c9('0x1')][_0x90c9('0x12')](_0x90c9('0x113'));db[_0x90c9('0x11')][_0x90c9('0x114')](db[_0x90c9('0x20')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x114')](db[_0x90c9('0x111')],{'as':_0x90c9('0x116'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x115')});db['User'][_0x90c9('0x118')](db[_0x90c9('0x1c')],{'as':_0x90c9('0x119'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x118')](db[_0x90c9('0x2e')],{'as':_0x90c9('0x11a'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x118')](db['VoiceExtension'],{'as':_0x90c9('0x11b'),'onDelete':_0x90c9('0x117'),'hooks':!![]});db['User'][_0x90c9('0x118')](db[_0x90c9('0x75')],{'as':_0x90c9('0x11c'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x118')](db[_0x90c9('0x77')],{'as':_0x90c9('0x11d'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x118')](db['ReportAgentPreview'],{'as':_0x90c9('0x11e'),'foreignKey':_0x90c9('0x115')});db['User'][_0x90c9('0x118')](db[_0x90c9('0x11f')],{'as':'OpenchannelInteractions','foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x118')](db['ChatInteraction'],{'as':_0x90c9('0x120'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x118')](db[_0x90c9('0x58')],{'as':_0x90c9('0x121'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11')][_0x90c9('0x118')](db['FaxInteraction'],{'as':_0x90c9('0x122'),'foreignKey':'UserId'});db[_0x90c9('0x11')][_0x90c9('0x118')](db[_0x90c9('0x123')],{'as':_0x90c9('0x124'),'foreignKey':_0x90c9('0x115')});db['User'][_0x90c9('0x118')](db[_0x90c9('0x106')],{'as':_0x90c9('0x125'),'foreignKey':'UserId'});db[_0x90c9('0x11')]['hasMany'](db[_0x90c9('0x100')],{'as':'UserNotifications','foreignKey':_0x90c9('0x126')});db['User']['hasMany'](db['CmHopper'],{'as':_0x90c9('0x127'),'foreignKey':_0x90c9('0x115'),'onDelete':_0x90c9('0x128')});db[_0x90c9('0x11')][_0x90c9('0x129')](db[_0x90c9('0xfa')],{'as':_0x90c9('0xfa'),'foreignKey':_0x90c9('0x12a')});db['User'][_0x90c9('0x12b')](db[_0x90c9('0x69')],{'as':'Groups','through':'chat_group_has_users'});db['User'][_0x90c9('0x12b')](db[_0x90c9('0x6f')],{'as':'Contacts','through':_0x90c9('0x12c')});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x12d'),'through':_0x90c9('0x12e')});db['User']['belongsToMany'](db[_0x90c9('0xe7')],{'through':'user_has_teams'});db['User'][_0x90c9('0x12b')](db[_0x90c9('0x123')],{'as':'MailInteractions','through':_0x90c9('0x12f')});db[_0x90c9('0x11')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x90c9('0x130')});db[_0x90c9('0x11')][_0x90c9('0x12b')](db['FaxInteraction'],{'as':_0x90c9('0x122'),'through':_0x90c9('0x131')});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x58')],{'as':_0x90c9('0x121'),'through':_0x90c9('0x132')});db[_0x90c9('0x11')]['belongsToMany'](db[_0x90c9('0x11f')],{'as':'OpenchannelInteractions','through':_0x90c9('0x133')});db[_0x90c9('0x11')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x90c9('0x125'),'through':'user_has_whatsapp_interactions'});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x1a')],{'as':_0x90c9('0x134'),'through':'UserVoiceQueue','required':![]});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0xf9')],{'as':_0x90c9('0x135'),'through':_0x90c9('0x136'),'required':![]});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x137')],{'as':_0x90c9('0x138'),'through':_0x90c9('0x139'),'required':![]});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x13a')],{'as':_0x90c9('0x13b'),'through':_0x90c9('0x32'),'required':![],'hooks':!![]});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x52')],{'as':_0x90c9('0x13c'),'through':_0x90c9('0x35'),'required':![]});db['User'][_0x90c9('0x12b')](db['SmsQueue'],{'as':'SmsQueues','through':_0x90c9('0x37'),'required':![]});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x60')],{'as':'OpenchannelQueues','through':_0x90c9('0x39'),'required':![]});db[_0x90c9('0x11')][_0x90c9('0x12b')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x90c9('0x3a'),'required':![]});db['User'][_0x90c9('0x12b')](db['CmList'],{'through':_0x90c9('0x12e')});db['User'][_0x90c9('0x12b')](db[_0x90c9('0x62')],{'as':'ChatWebsites','through':_0x90c9('0x13d')});db['User'][_0x90c9('0x12b')](db[_0x90c9('0x4b')],{'as':_0x90c9('0x13e'),'through':'user_has_fax_accounts'});db[_0x90c9('0x11')]['belongsToMany'](db[_0x90c9('0x3e')],{'as':_0x90c9('0x13f'),'through':_0x90c9('0x140')});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x141')],{'as':_0x90c9('0x142'),'through':'user_has_openchannel_accounts'});db['User'][_0x90c9('0x12b')](db[_0x90c9('0x143')],{'as':_0x90c9('0x144'),'through':_0x90c9('0x145')});db[_0x90c9('0x11')][_0x90c9('0x12b')](db[_0x90c9('0x102')],{'as':'WhatsappAccounts','through':_0x90c9('0x146')});db[_0x90c9('0x147')][_0x90c9('0x118')](db['VoiceExtension'],{'as':_0x90c9('0x148'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x149')});db['VoiceContext']['hasMany'](db[_0x90c9('0x14a')],{'onDelete':_0x90c9('0x117')});db[_0x90c9('0x14a')][_0x90c9('0x118')](db[_0x90c9('0x14a')],{'as':_0x90c9('0x14b'),'onDelete':'cascade'});db[_0x90c9('0x18')][_0x90c9('0x12b')](db[_0x90c9('0x8a')],{'as':_0x90c9('0x14c'),'through':_0x90c9('0x14d')});db[_0x90c9('0x1a')][_0x90c9('0x118')](db[_0x90c9('0x2e')],{'as':'Members','foreignKey':_0x90c9('0x14e')});db[_0x90c9('0x1a')][_0x90c9('0x118')](db['CmHopper'],{'as':_0x90c9('0x127'),'foreignKey':_0x90c9('0x14e')});db[_0x90c9('0x1a')][_0x90c9('0x118')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x90c9('0x14e')});db[_0x90c9('0x1a')][_0x90c9('0x118')](db[_0x90c9('0x77')],{'as':_0x90c9('0x14f'),'foreignKey':_0x90c9('0x14e')});db[_0x90c9('0x1a')]['hasMany'](db['ReportAgentPreview'],{'as':_0x90c9('0x11e'),'foreignKey':_0x90c9('0x14e')});db[_0x90c9('0x1a')][_0x90c9('0x118')](db[_0x90c9('0x73')],{'as':_0x90c9('0x150'),'foreignKey':_0x90c9('0x14e')});db[_0x90c9('0x1a')]['hasMany'](db['JscriptySessionReport'],{'as':_0x90c9('0x151'),'foreignKey':_0x90c9('0x14e')});db[_0x90c9('0x1a')][_0x90c9('0x129')](db['Trunk'],{'as':_0x90c9('0x2a'),'foreignKey':_0x90c9('0x152')});db[_0x90c9('0x1a')][_0x90c9('0x129')](db['Trunk'],{'as':_0x90c9('0x153'),'foreignKey':_0x90c9('0x154')});db[_0x90c9('0x1a')][_0x90c9('0x129')](db[_0x90c9('0x82')],{'as':_0x90c9('0x82'),'foreignKey':_0x90c9('0x155')});db[_0x90c9('0x1a')]['belongsTo'](db[_0x90c9('0x156')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x90c9('0x1a')][_0x90c9('0x12b')](db['CmList'],{'as':'Lists','through':_0x90c9('0x157')});db['VoiceQueue'][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':_0x90c9('0x30')});db[_0x90c9('0x1a')][_0x90c9('0x12b')](db[_0x90c9('0xe7')],{'as':_0x90c9('0x159'),'through':_0x90c9('0x15a')});db[_0x90c9('0x1a')]['belongsToMany'](db[_0x90c9('0xf7')],{'as':_0x90c9('0x15b'),'through':_0x90c9('0x15c')});db[_0x90c9('0x1c')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':_0x90c9('0x11'),'foreignKey':_0x90c9('0x115')});db['ScreenRecording'][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':'User','foreignKey':'UserId'});db[_0x90c9('0x20')][_0x90c9('0x118')](db[_0x90c9('0x21')],{'as':_0x90c9('0x15d'),'onDelete':'cascade','foreignKey':_0x90c9('0x15e'),'sourceKey':_0x90c9('0x15f')});db[_0x90c9('0x21')][_0x90c9('0x129')](db[_0x90c9('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x90c9('0x15f')});db[_0x90c9('0x23')][_0x90c9('0x118')](db[_0x90c9('0x160')],{'as':'QueueCalls','foreignKey':_0x90c9('0x161'),'constraints':![]});db['VoiceCallReport'][_0x90c9('0x118')](db[_0x90c9('0x162')],{'as':'AgentReports','foreignKey':_0x90c9('0x161'),'constraints':![]});db[_0x90c9('0x23')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':'User','foreignKey':_0x90c9('0x115')});db[_0x90c9('0x23')][_0x90c9('0x129')](db['CmContact'],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x3b')]['belongsTo'](db[_0x90c9('0x3e')],{'as':'MailAccount','foreignKey':_0x90c9('0x165')});db[_0x90c9('0x3b')][_0x90c9('0x129')](db['CloudProvider'],{'as':_0x90c9('0x10d'),'foreignKey':_0x90c9('0x166'),'onDelete':_0x90c9('0x167')});db[_0x90c9('0x3d')]['belongsTo'](db[_0x90c9('0x3e')],{'as':_0x90c9('0x3e'),'foreignKey':_0x90c9('0x165')});db[_0x90c9('0x3d')][_0x90c9('0x129')](db[_0x90c9('0x10d')],{'as':_0x90c9('0x10d'),'foreignKey':_0x90c9('0x166'),'onDelete':_0x90c9('0x167')});db[_0x90c9('0x3e')][_0x90c9('0x114')](db[_0x90c9('0x3b')],{'as':_0x90c9('0x168'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x3e')][_0x90c9('0x114')](db['MailServerOut'],{'as':_0x90c9('0x169'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x3e')][_0x90c9('0x118')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x90c9('0x165'),'onDelete':'cascade'});db[_0x90c9('0x3e')][_0x90c9('0x118')](db['CannedAnswer'],{'as':_0x90c9('0x16a'),'foreignKey':_0x90c9('0x165')});db[_0x90c9('0x3e')][_0x90c9('0x118')](db[_0x90c9('0x43')],{'as':_0x90c9('0x15d'),'foreignKey':_0x90c9('0x165')});db[_0x90c9('0x3e')][_0x90c9('0x118')](db['MailInteraction'],{'as':'Interactions'});db['MailAccount'][_0x90c9('0x118')](db['MailApplication'],{'as':_0x90c9('0x14b'),'foreignKey':_0x90c9('0x165'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x3e')][_0x90c9('0x129')](db['CmList'],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0x3e')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0x90c9('0x16d')});db[_0x90c9('0x3e')][_0x90c9('0x129')](db[_0x90c9('0x156')],{'as':_0x90c9('0x16e'),'foreignKey':_0x90c9('0x16f')});db[_0x90c9('0x3e')]['belongsToMany'](db['User'],{'as':_0x90c9('0x158'),'through':_0x90c9('0x140')});db[_0x90c9('0x137')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':_0x90c9('0x139')});db[_0x90c9('0x137')]['belongsToMany'](db['Team'],{'through':_0x90c9('0x170'),'as':_0x90c9('0x159')});db[_0x90c9('0x123')]['hasMany'](db[_0x90c9('0x43')],{'as':_0x90c9('0x15d'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x171')});db[_0x90c9('0x123')][_0x90c9('0x129')](db[_0x90c9('0x3e')],{'as':_0x90c9('0x172'),'foreignKey':'MailAccountId'});db[_0x90c9('0x123')]['belongsTo'](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db['MailInteraction']['belongsTo'](db['User'],{'as':_0x90c9('0x173'),'foreignKey':_0x90c9('0x115')});db['MailInteraction'][_0x90c9('0x12b')](db[_0x90c9('0x8b')],{'through':_0x90c9('0x174'),'as':_0x90c9('0x175')});db[_0x90c9('0x123')][_0x90c9('0x12b')](db[_0x90c9('0x8b')],{'through':_0x90c9('0x174'),'as':'ThroughTags'});db[_0x90c9('0x123')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x176'),'through':_0x90c9('0x12f'),'foreignKey':_0x90c9('0x171')});db[_0x90c9('0x43')][_0x90c9('0x118')](db[_0x90c9('0xef')],{'as':'Attachments','onDelete':_0x90c9('0x117')});db[_0x90c9('0x43')]['belongsTo'](db[_0x90c9('0x11')],{'as':_0x90c9('0x11')});db[_0x90c9('0x43')][_0x90c9('0x129')](db['CmContact'],{'onDelete':'cascade','as':_0x90c9('0x163')});db['MailMessage']['belongsTo'](db[_0x90c9('0x123')],{'as':_0x90c9('0x177'),'foreignKey':_0x90c9('0x171')});db[_0x90c9('0x43')]['belongsTo'](db[_0x90c9('0x3e')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x165')});db[_0x90c9('0x43')][_0x90c9('0x129')](db[_0x90c9('0x62')],{'as':_0x90c9('0x62'),'foreignKey':_0x90c9('0x178')});db['MailMessage'][_0x90c9('0x129')](db[_0x90c9('0x179')],{'as':_0x90c9('0x179'),'foreignKey':_0x90c9('0x17a')});db[_0x90c9('0x45')]['belongsTo'](db['User'],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x45')][_0x90c9('0x129')](db[_0x90c9('0x137')],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x45')][_0x90c9('0x129')](db['MailAccount'],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x45')]['belongsTo'](db[_0x90c9('0x82')],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x155')});db[_0x90c9('0x45')][_0x90c9('0x129')](db[_0x90c9('0x8b')],{'onDelete':_0x90c9('0x167'),'foreignKey':'TagId'});db[_0x90c9('0x47')][_0x90c9('0x129')](db[_0x90c9('0x3e')],{});db[_0x90c9('0x47')][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0x47')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x47')]['belongsTo'](db[_0x90c9('0x123')],{});db['MailQueueReport'][_0x90c9('0x129')](db[_0x90c9('0x43')],{});db[_0x90c9('0x47')][_0x90c9('0x129')](db[_0x90c9('0x11')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0x90c9('0x49')][_0x90c9('0x118')](db[_0x90c9('0x4a')],{'as':_0x90c9('0x17b'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x4b')][_0x90c9('0x118')](db['Disposition'],{'as':_0x90c9('0x17c'),'foreignKey':_0x90c9('0x17d'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x4b')][_0x90c9('0x118')](db[_0x90c9('0x17e')],{'as':_0x90c9('0x16a'),'foreignKey':'FaxAccountId'});db[_0x90c9('0x4b')]['hasMany'](db['FaxInteraction'],{'as':_0x90c9('0x17f')});db[_0x90c9('0x4b')][_0x90c9('0x118')](db[_0x90c9('0x4c')],{'as':_0x90c9('0x14b'),'foreignKey':_0x90c9('0x17d'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x4b')][_0x90c9('0x118')](db['VoiceExtension'],{'as':_0x90c9('0x180'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x4b')][_0x90c9('0x118')](db[_0x90c9('0x50')],{'as':_0x90c9('0x15d')});db[_0x90c9('0x4b')]['belongsTo'](db[_0x90c9('0x2a')],{'as':_0x90c9('0x2a')});db[_0x90c9('0x4b')]['belongsTo'](db[_0x90c9('0xf7')],{'as':'List','foreignKey':_0x90c9('0x16c')});db['FaxAccount'][_0x90c9('0x129')](db[_0x90c9('0x156')],{'as':_0x90c9('0x16e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x90c9('0x4b')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':'Agents','through':_0x90c9('0x181')});db['FaxApplication'][_0x90c9('0x129')](db[_0x90c9('0x11')],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x4c')][_0x90c9('0x129')](db['FaxQueue'],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x4c')][_0x90c9('0x129')](db['FaxAccount'],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x4c')][_0x90c9('0x129')](db[_0x90c9('0x8b')],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x182')});db[_0x90c9('0x4e')]['hasMany'](db['FaxMessage'],{'as':_0x90c9('0x15d'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x183')});db['FaxInteraction'][_0x90c9('0x129')](db['FaxAccount'],{'as':'Account','foreignKey':_0x90c9('0x17d')});db[_0x90c9('0x4e')][_0x90c9('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0x90c9('0x164')});db[_0x90c9('0x4e')]['belongsTo'](db['User'],{'as':_0x90c9('0x173'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x4e')][_0x90c9('0x12b')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x90c9('0x175')});db[_0x90c9('0x4e')][_0x90c9('0x12b')](db[_0x90c9('0x8b')],{'through':_0x90c9('0x184'),'as':'ThroughTags'});db['FaxInteraction'][_0x90c9('0x12b')](db['User'],{'as':'Users','through':_0x90c9('0x131'),'foreignKey':_0x90c9('0x183')});db[_0x90c9('0x50')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x11')});db['FaxMessage'][_0x90c9('0x129')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x90c9('0x183')});db[_0x90c9('0x50')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x163')});db[_0x90c9('0x50')][_0x90c9('0x129')](db[_0x90c9('0xef')],{'as':_0x90c9('0xef'),'foreignKey':'AttachmentId'});db[_0x90c9('0x50')][_0x90c9('0x129')](db[_0x90c9('0x4b')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x90c9('0x52')][_0x90c9('0x12b')](db['User'],{'as':_0x90c9('0x158'),'through':_0x90c9('0x35')});db[_0x90c9('0x52')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':_0x90c9('0x159')});db['FaxQueueReport']['belongsTo'](db[_0x90c9('0x4b')],{});db['FaxQueueReport'][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0x54')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x54')][_0x90c9('0x129')](db[_0x90c9('0x4e')],{});db[_0x90c9('0x54')][_0x90c9('0x129')](db[_0x90c9('0x50')],{});db[_0x90c9('0x54')][_0x90c9('0x129')](db[_0x90c9('0x11')],{});db[_0x90c9('0x54')][_0x90c9('0x129')](db[_0x90c9('0x52')],{});db[_0x90c9('0x143')][_0x90c9('0x118')](db['Disposition'],{'as':_0x90c9('0x17c'),'foreignKey':_0x90c9('0x185'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x143')]['hasMany'](db['CannedAnswer'],{'as':_0x90c9('0x16a'),'foreignKey':_0x90c9('0x185')});db[_0x90c9('0x143')][_0x90c9('0x118')](db[_0x90c9('0x186')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x90c9('0x143')][_0x90c9('0x118')](db[_0x90c9('0x58')],{'as':_0x90c9('0x17f')});db[_0x90c9('0x143')]['hasMany'](db[_0x90c9('0x57')],{'as':_0x90c9('0x14b'),'foreignKey':_0x90c9('0x185'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x143')]['belongsTo'](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0x143')][_0x90c9('0x129')](db[_0x90c9('0x156')],{'as':_0x90c9('0x16e'),'foreignKey':_0x90c9('0x16f')});db[_0x90c9('0x143')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':'user_has_sms_accounts'});db[_0x90c9('0x57')][_0x90c9('0x129')](db['User'],{'onDelete':_0x90c9('0x167')});db['SmsApplication'][_0x90c9('0x129')](db[_0x90c9('0x5a')],{'onDelete':_0x90c9('0x167')});db['SmsApplication'][_0x90c9('0x129')](db[_0x90c9('0x143')],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x57')][_0x90c9('0x129')](db['Interval'],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x155')});db['SmsApplication'][_0x90c9('0x129')](db['Tag'],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x182')});db['SmsInteraction'][_0x90c9('0x118')](db[_0x90c9('0x186')],{'as':_0x90c9('0x15d'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x187')});db[_0x90c9('0x58')][_0x90c9('0x129')](db['SmsAccount'],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x185')});db[_0x90c9('0x58')][_0x90c9('0x129')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x90c9('0x58')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':_0x90c9('0x173'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x58')][_0x90c9('0x12b')](db[_0x90c9('0x8b')],{'through':_0x90c9('0x188'),'as':_0x90c9('0x175')});db[_0x90c9('0x58')]['belongsToMany'](db['Tag'],{'through':_0x90c9('0x188'),'as':_0x90c9('0x189')});db['SmsInteraction'][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x176'),'through':_0x90c9('0x132'),'foreignKey':_0x90c9('0x187')});db[_0x90c9('0x186')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':_0x90c9('0x11')});db[_0x90c9('0x186')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x163')});db[_0x90c9('0x186')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x177'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x90c9('0x129')](db[_0x90c9('0x143')],{'as':_0x90c9('0x172'),'foreignKey':'SmsAccountId'});db[_0x90c9('0x5a')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':_0x90c9('0x37'),'foreignKey':_0x90c9('0x18a')});db[_0x90c9('0x5a')]['belongsToMany'](db[_0x90c9('0xe7')],{'through':'team_has_sms_queues','as':_0x90c9('0x159')});db[_0x90c9('0x141')]['hasMany'](db[_0x90c9('0x7f')],{'as':_0x90c9('0x17c'),'foreignKey':_0x90c9('0x18b'),'onDelete':_0x90c9('0x117')});db['OpenchannelAccount'][_0x90c9('0x118')](db[_0x90c9('0x17e')],{'as':_0x90c9('0x16a'),'foreignKey':_0x90c9('0x18b')});db[_0x90c9('0x141')][_0x90c9('0x118')](db[_0x90c9('0x11f')],{'as':_0x90c9('0x17f'),'foreignKey':'OpenchannelAccountId'});db[_0x90c9('0x141')]['hasMany'](db[_0x90c9('0x5e')],{'as':'Messages','foreignKey':_0x90c9('0x18b')});db[_0x90c9('0x141')][_0x90c9('0x118')](db[_0x90c9('0x18c')],{'as':_0x90c9('0x14b'),'foreignKey':_0x90c9('0x18b'),'onDelete':'cascade'});db[_0x90c9('0x141')][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0x90c9('0x129')](db['Pause'],{'as':_0x90c9('0x16e'),'foreignKey':_0x90c9('0x16f')});db['OpenchannelAccount'][_0x90c9('0x12b')](db['User'],{'as':_0x90c9('0x158'),'through':_0x90c9('0x18d')});db[_0x90c9('0x18c')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x18c')][_0x90c9('0x129')](db[_0x90c9('0x60')],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x18e')});db[_0x90c9('0x18c')][_0x90c9('0x129')](db[_0x90c9('0x141')],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x18b')});db[_0x90c9('0x18c')][_0x90c9('0x129')](db[_0x90c9('0x82')],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x155')});db['OpenchannelApplication'][_0x90c9('0x129')](db[_0x90c9('0x8b')],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x182')});db['OpenchannelInteraction']['hasMany'](db[_0x90c9('0x5e')],{'as':_0x90c9('0x15d'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x18f')});db[_0x90c9('0x11f')][_0x90c9('0x129')](db[_0x90c9('0x141')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x18b')});db['OpenchannelInteraction'][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':'ContactId'});db[_0x90c9('0x11f')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':_0x90c9('0x173'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x11f')][_0x90c9('0x12b')](db[_0x90c9('0x8b')],{'through':_0x90c9('0x190'),'as':_0x90c9('0x175')});db[_0x90c9('0x11f')]['belongsToMany'](db[_0x90c9('0x8b')],{'through':_0x90c9('0x190'),'as':_0x90c9('0x189')});db[_0x90c9('0x11f')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x176'),'through':_0x90c9('0x133'),'foreignKey':_0x90c9('0x18f')});db[_0x90c9('0x5e')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x11')});db[_0x90c9('0x5e')][_0x90c9('0x129')](db['CmContact'],{'onDelete':_0x90c9('0x117'),'as':'Contact'});db[_0x90c9('0x5e')]['belongsTo'](db[_0x90c9('0x11f')],{'onDelete':_0x90c9('0x117'),'as':'Interaction','foreignKey':_0x90c9('0x18f')});db[_0x90c9('0x5e')]['belongsTo'](db[_0x90c9('0xef')],{'as':_0x90c9('0xef'),'foreignKey':_0x90c9('0x191')});db[_0x90c9('0x5e')][_0x90c9('0x129')](db[_0x90c9('0x141')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x18b')});db[_0x90c9('0x60')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':_0x90c9('0x39'),'foreignKey':_0x90c9('0x18e')});db['OpenchannelQueue']['belongsToMany'](db[_0x90c9('0xe7')],{'through':_0x90c9('0x192'),'as':_0x90c9('0x159')});db[_0x90c9('0x62')][_0x90c9('0x118')](db['Disposition'],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x90c9('0x62')][_0x90c9('0x118')](db[_0x90c9('0x17e')],{'as':_0x90c9('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x90c9('0x62')][_0x90c9('0x118')](db[_0x90c9('0x6b')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x90c9('0x118')](db[_0x90c9('0x67')],{'as':'Interactions'});db[_0x90c9('0x62')][_0x90c9('0x118')](db[_0x90c9('0x66')],{'as':_0x90c9('0x14b'),'foreignKey':_0x90c9('0x178'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x62')][_0x90c9('0x118')](db[_0x90c9('0x193')],{'as':'Messages'});db[_0x90c9('0x62')]['belongsTo'](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0x62')][_0x90c9('0x129')](db[_0x90c9('0x82')],{'as':'Interval','foreignKey':_0x90c9('0x155')});db[_0x90c9('0x62')][_0x90c9('0x129')](db[_0x90c9('0x3e')],{'as':_0x90c9('0x3e'),'foreignKey':_0x90c9('0x165')});db[_0x90c9('0x62')][_0x90c9('0x129')](db[_0x90c9('0x156')],{'as':'mandatoryDispositionPause','foreignKey':_0x90c9('0x16f')});db[_0x90c9('0x62')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':_0x90c9('0x13d')});db[_0x90c9('0x64')][_0x90c9('0x129')](db[_0x90c9('0x141')],{});db[_0x90c9('0x64')][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db['OpenchannelQueueReport'][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':'Contact','foreignKey':_0x90c9('0x164')});db['OpenchannelQueueReport'][_0x90c9('0x129')](db['OpenchannelInteraction'],{});db[_0x90c9('0x64')]['belongsTo'](db[_0x90c9('0x5e')],{});db[_0x90c9('0x64')][_0x90c9('0x129')](db[_0x90c9('0x11')],{});db[_0x90c9('0x64')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x90c9('0x66')][_0x90c9('0x129')](db['User'],{'as':_0x90c9('0x194'),'foreignKey':'UserId','onDelete':'restrict'});db['ChatApplication'][_0x90c9('0x129')](db[_0x90c9('0x13a')],{'as':_0x90c9('0x195'),'foreignKey':_0x90c9('0x196'),'onDelete':_0x90c9('0x167')});db[_0x90c9('0x66')][_0x90c9('0x129')](db['ChatWebsite'],{'as':_0x90c9('0x197'),'foreignKey':'ChatWebsiteId','onDelete':_0x90c9('0x167')});db[_0x90c9('0x66')][_0x90c9('0x129')](db['Tag'],{'onDelete':_0x90c9('0x167'),'foreignKey':_0x90c9('0x182')});db[_0x90c9('0x67')][_0x90c9('0x118')](db['ChatMessage'],{'as':_0x90c9('0x15d'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x198')});db[_0x90c9('0x67')][_0x90c9('0x129')](db[_0x90c9('0x62')],{'as':'Account','foreignKey':_0x90c9('0x178')});db[_0x90c9('0x67')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x67')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x90c9('0x67')]['belongsToMany'](db['Tag'],{'through':_0x90c9('0x199'),'as':_0x90c9('0x175')});db[_0x90c9('0x67')]['belongsToMany'](db[_0x90c9('0x8b')],{'through':_0x90c9('0x199'),'as':_0x90c9('0x189')});db['ChatInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0x90c9('0x130'),'foreignKey':'ChatInteractionId'});db[_0x90c9('0x193')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x11')});db['ChatMessage'][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'onDelete':'cascade','as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x193')][_0x90c9('0x129')](db['ChatInteraction'],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x177'),'foreignKey':_0x90c9('0x198')});db['ChatMessage'][_0x90c9('0x129')](db['Attachment'],{'as':'Attachment','foreignKey':_0x90c9('0x191')});db[_0x90c9('0x193')][_0x90c9('0x129')](db[_0x90c9('0x62')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x178')});db[_0x90c9('0x179')][_0x90c9('0x118')](db[_0x90c9('0xef')],{'as':_0x90c9('0x19a'),'foreignKey':_0x90c9('0x17a'),'onDelete':_0x90c9('0x117'),'hooks':!![]});db[_0x90c9('0x179')]['belongsTo'](db['CmContact'],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x179')][_0x90c9('0x129')](db[_0x90c9('0x62')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x178')});db['ChatQueue'][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':_0x90c9('0x32'),'hooks':!![]});db[_0x90c9('0x13a')][_0x90c9('0x12b')](db[_0x90c9('0xe7')],{'through':_0x90c9('0x19b'),'as':'Teams'});db[_0x90c9('0x69')][_0x90c9('0x118')](db[_0x90c9('0xd0')],{'as':_0x90c9('0x15d'),'foreignKey':_0x90c9('0x19c'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x69')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':'Members','through':_0x90c9('0x19d')});db['ChatProactiveAction']['belongsTo'](db[_0x90c9('0x62')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x90c9('0x6d')][_0x90c9('0x118')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x19e'),'foreignKey':_0x90c9('0x19f')});db[_0x90c9('0x6f')]['hasMany'](db[_0x90c9('0x8e')],{'as':_0x90c9('0x1a0'),'foreignKey':_0x90c9('0x1a1')});db[_0x90c9('0x6f')][_0x90c9('0x118')](db['CmHopper'],{'as':_0x90c9('0x127'),'foreignKey':'ContactId'});db[_0x90c9('0x6f')][_0x90c9('0x118')](db[_0x90c9('0x75')],{'as':_0x90c9('0x11c'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x6f')]['hasMany'](db[_0x90c9('0x77')],{'as':'HopperHistories','foreignKey':_0x90c9('0x164')});db[_0x90c9('0x6f')][_0x90c9('0x118')](db[_0x90c9('0x11e')],{'as':_0x90c9('0x11e'),'foreignKey':'ContactId'});db[_0x90c9('0x6f')][_0x90c9('0x118')](db[_0x90c9('0xd6')],{'as':_0x90c9('0x151'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0x6f')][_0x90c9('0x118')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x90c9('0x164'),'onDelete':_0x90c9('0x167')});db[_0x90c9('0x6f')][_0x90c9('0x118')](db[_0x90c9('0x67')],{'as':_0x90c9('0x120'),'foreignKey':_0x90c9('0x164'),'onDelete':_0x90c9('0x167')});db[_0x90c9('0x6f')][_0x90c9('0x118')](db[_0x90c9('0x58')],{'as':_0x90c9('0x121'),'foreignKey':_0x90c9('0x164'),'onDelete':_0x90c9('0x167')});db['CmContact'][_0x90c9('0x118')](db[_0x90c9('0x4e')],{'as':'FaxInteractions','foreignKey':_0x90c9('0x164'),'onDelete':_0x90c9('0x167')});db[_0x90c9('0x6f')][_0x90c9('0x118')](db[_0x90c9('0x123')],{'as':_0x90c9('0x124'),'foreignKey':_0x90c9('0x164'),'onDelete':_0x90c9('0x167')});db[_0x90c9('0x6f')][_0x90c9('0x129')](db[_0x90c9('0x6d')],{'as':'Company','foreignKey':'CompanyId'});db[_0x90c9('0x6f')]['belongsTo'](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x6f')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':'Users','through':_0x90c9('0x12c')});db['CmContact']['belongsToMany'](db[_0x90c9('0x8b')],{'as':_0x90c9('0x175'),'through':_0x90c9('0x1a2')});db['CmContact'][_0x90c9('0x12b')](db[_0x90c9('0x8b')],{'through':_0x90c9('0x1a2'),'as':'ThroughTags'});db[_0x90c9('0x71')][_0x90c9('0x118')](db[_0x90c9('0x90')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0x90c9('0x71')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':'Contact','foreignKey':_0x90c9('0x164'),'onDelete':_0x90c9('0x117')});db['CmHopper'][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':'List','foreignKey':_0x90c9('0x16c'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x71')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':_0x90c9('0x194'),'foreignKey':_0x90c9('0x115')});db[_0x90c9('0x71')][_0x90c9('0x129')](db[_0x90c9('0x1a')],{'as':_0x90c9('0x195'),'foreignKey':_0x90c9('0x14e'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x71')][_0x90c9('0x129')](db[_0x90c9('0xeb')],{'as':_0x90c9('0xeb'),'foreignKey':_0x90c9('0x1a3'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x71')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':_0x90c9('0x173'),'foreignKey':_0x90c9('0x1a4')});db[_0x90c9('0x73')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x73')][_0x90c9('0x129')](db['CmList'],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c'),'onDelete':'cascade'});db['CmHopperBlack'][_0x90c9('0x129')](db[_0x90c9('0x1a')],{'as':_0x90c9('0x195'),'foreignKey':_0x90c9('0x14e'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x73')][_0x90c9('0x129')](db[_0x90c9('0xeb')],{'as':_0x90c9('0xeb'),'foreignKey':_0x90c9('0x1a3'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x7c')][_0x90c9('0x118')](db[_0x90c9('0x81')],{'as':{'plural':_0x90c9('0x1a5'),'singular':'OneAll'},'foreignKey':_0x90c9('0x1a6'),'onDelete':_0x90c9('0x117'),'hooks':!![]});db[_0x90c9('0x7c')][_0x90c9('0x118')](db['Condition'],{'as':{'plural':_0x90c9('0x1a7'),'singular':'OneAny'},'foreignKey':_0x90c9('0x1a8'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x90c9('0x118')](db['Action'],{'as':_0x90c9('0x1a9'),'foreignKey':_0x90c9('0x1aa'),'onDelete':_0x90c9('0x117'),'hooks':!![]});db[_0x90c9('0x7f')][_0x90c9('0x118')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x90c9('0x1ab'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x82')][_0x90c9('0x118')](db[_0x90c9('0x82')],{'as':_0x90c9('0x1ac'),'foreignKey':_0x90c9('0x155'),'onDelete':_0x90c9('0x117'),'hooks':!![],'required':![]});db[_0x90c9('0x82')][_0x90c9('0x118')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':'restrict'});db[_0x90c9('0x82')][_0x90c9('0x118')](db[_0x90c9('0x45')],{'as':'MailApplications','foreignKey':_0x90c9('0x155')});db[_0x90c9('0x82')][_0x90c9('0x118')](db[_0x90c9('0x66')],{'as':'ChatApplications','foreignKey':_0x90c9('0x155')});db['Interval'][_0x90c9('0x118')](db['FaxApplication'],{'as':_0x90c9('0x1ad'),'foreignKey':_0x90c9('0x155')});db[_0x90c9('0x82')][_0x90c9('0x118')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x90c9('0x155')});db[_0x90c9('0x88')][_0x90c9('0x129')](db[_0x90c9('0x3e')],{});db[_0x90c9('0x88')]['belongsTo'](db[_0x90c9('0x1ae')],{'foreignKey':_0x90c9('0x1af')});db['Schedule'][_0x90c9('0x129')](db['AnalyticCustomReport'],{'foreignKey':_0x90c9('0x1b0')});db[_0x90c9('0x8a')][_0x90c9('0x12b')](db[_0x90c9('0x18')],{'as':'Mohs','through':_0x90c9('0x14d'),'onDelete':_0x90c9('0x167')});db['Tag'][_0x90c9('0x12b')](db['CmContact'],{'through':_0x90c9('0x1a2')});db[_0x90c9('0x8b')][_0x90c9('0x12b')](db[_0x90c9('0x67')],{'through':_0x90c9('0x199')});db['Tag'][_0x90c9('0x12b')](db[_0x90c9('0x123')],{'through':_0x90c9('0x174')});db[_0x90c9('0x8b')][_0x90c9('0x12b')](db[_0x90c9('0x58')],{'through':_0x90c9('0x188')});db[_0x90c9('0x8b')][_0x90c9('0x12b')](db[_0x90c9('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x90c9('0x8b')]['belongsToMany'](db[_0x90c9('0x11f')],{'through':_0x90c9('0x190')});db['Tag'][_0x90c9('0x12b')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x90c9('0x8e')]['belongsTo'](db[_0x90c9('0x1b1')],{'as':_0x90c9('0x1b2'),'foreignKey':_0x90c9('0x1b3')});db[_0x90c9('0x90')]['belongsTo'](db[_0x90c9('0x71')],{'as':_0x90c9('0x1b4'),'foreignKey':_0x90c9('0x1b5')});db[_0x90c9('0x8e')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x1a1')});db[_0x90c9('0x1b6')][_0x90c9('0x118')](db['Condition'],{'as':{'plural':_0x90c9('0x1b7'),'singular':_0x90c9('0x1b8')},'foreignKey':_0x90c9('0x1b9'),'onDelete':_0x90c9('0x117'),'hooks':!![]});db['Trigger'][_0x90c9('0x118')](db[_0x90c9('0x81')],{'as':{'plural':_0x90c9('0x1ba'),'singular':_0x90c9('0x1bb')},'foreignKey':_0x90c9('0x1bc'),'onDelete':_0x90c9('0x117'),'hooks':!![]});db[_0x90c9('0x1b6')]['hasMany'](db['Action'],{'as':_0x90c9('0x1a9'),'foreignKey':_0x90c9('0x1bd'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x90c9('0x118')](db[_0x90c9('0x9f')],{'as':_0x90c9('0x1be'),'onDelete':'cascade','foreignKey':_0x90c9('0x1b0'),'hooks':!![]});db[_0x90c9('0x1ae')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x90c9('0x117'),'foreignKey':'DefaultReportId'});db[_0x90c9('0x9d')][_0x90c9('0x118')](db['AnalyticFieldReport'],{'as':_0x90c9('0x1be'),'onDelete':_0x90c9('0x117'),'foreignKey':'MetricId'});db[_0x90c9('0x9f')][_0x90c9('0x129')](db[_0x90c9('0x9d')],{'foreignKey':_0x90c9('0x1bf')});db[_0x90c9('0xa1')][_0x90c9('0x118')](db[_0x90c9('0x1c0')],{'as':_0x90c9('0x1c1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x90c9('0x1c0')]['hasMany'](db[_0x90c9('0xa4')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0x1c0')][_0x90c9('0x118')](db[_0x90c9('0xa4')],{'as':_0x90c9('0x1c3'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0x1c0')][_0x90c9('0x118')](db[_0x90c9('0xa4')],{'as':'Fields','onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0x1c0')][_0x90c9('0x129')](db[_0x90c9('0xa1')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xa4')][_0x90c9('0x118')](db['SalesforceField'],{'as':_0x90c9('0x1c7'),'foreignKey':'SubjectId'});db[_0x90c9('0xa4')][_0x90c9('0x118')](db[_0x90c9('0xa4')],{'as':'Description','foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xa4')][_0x90c9('0x118')](db[_0x90c9('0xa4')],{'as':_0x90c9('0x1c8'),'foreignKey':_0x90c9('0x1c5')});db['SalesforceField'][_0x90c9('0x129')](db['Variable'],{'as':_0x90c9('0x1c9'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x90c9('0x118')](db[_0x90c9('0xa8')],{'as':_0x90c9('0x1c1'),'onDelete':_0x90c9('0x117'),'foreignKey':'AccountId'});db['SugarcrmConfiguration']['hasMany'](db[_0x90c9('0x1ca')],{'as':'Subjects','onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c2')});db['SugarcrmConfiguration'][_0x90c9('0x118')](db[_0x90c9('0x1ca')],{'as':_0x90c9('0x1c3'),'onDelete':_0x90c9('0x117'),'foreignKey':'DescriptionId'});db[_0x90c9('0xa8')][_0x90c9('0x118')](db['SugarcrmField'],{'as':_0x90c9('0x1be'),'onDelete':_0x90c9('0x117'),'foreignKey':'FieldId'});db[_0x90c9('0xa8')][_0x90c9('0x129')](db[_0x90c9('0xa6')],{'as':_0x90c9('0x172'),'foreignKey':'AccountId'});db[_0x90c9('0x1ca')][_0x90c9('0x118')](db[_0x90c9('0x1ca')],{'as':'Subject','foreignKey':_0x90c9('0x1c2')});db['SugarcrmField']['hasMany'](db[_0x90c9('0x1ca')],{'as':_0x90c9('0x1cb'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0x1ca')][_0x90c9('0x118')](db[_0x90c9('0x1ca')],{'as':_0x90c9('0x1c8'),'foreignKey':'FieldId'});db[_0x90c9('0x1ca')][_0x90c9('0x129')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['DeskAccount'][_0x90c9('0x118')](db[_0x90c9('0xac')],{'as':_0x90c9('0x1c1'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xac')][_0x90c9('0x118')](db[_0x90c9('0xae')],{'as':'Subjects','onDelete':_0x90c9('0x117'),'foreignKey':'SubjectId'});db[_0x90c9('0xac')][_0x90c9('0x118')](db['DeskField'],{'as':'Descriptions','onDelete':_0x90c9('0x117'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x90c9('0x118')](db[_0x90c9('0xae')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xac')][_0x90c9('0x129')](db[_0x90c9('0x1cc')],{'as':_0x90c9('0x172'),'foreignKey':'AccountId'});db[_0x90c9('0xac')][_0x90c9('0x12b')](db[_0x90c9('0x8b')],{'through':'int_desk_configuration_has_tags'});db['DeskField']['hasMany'](db[_0x90c9('0xae')],{'as':_0x90c9('0x1c7'),'foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0xae')][_0x90c9('0x118')](db[_0x90c9('0xae')],{'as':_0x90c9('0x1cb'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xae')][_0x90c9('0x118')](db[_0x90c9('0xae')],{'as':'Field','foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xae')]['belongsTo'](db[_0x90c9('0x1c9')],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db['ZohoAccount'][_0x90c9('0x118')](db['ZohoConfiguration'],{'as':_0x90c9('0x1c1'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xb1')][_0x90c9('0x118')](db[_0x90c9('0xb3')],{'as':_0x90c9('0x1ce'),'onDelete':_0x90c9('0x117'),'foreignKey':'SubjectId'});db[_0x90c9('0xb1')]['hasMany'](db[_0x90c9('0xb3')],{'as':_0x90c9('0x1c3'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xb1')]['hasMany'](db[_0x90c9('0xb3')],{'as':'Fields','onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c5')});db['ZohoConfiguration'][_0x90c9('0x129')](db[_0x90c9('0xaf')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xb3')][_0x90c9('0x118')](db[_0x90c9('0xb3')],{'as':_0x90c9('0x1c7'),'foreignKey':_0x90c9('0x1c2')});db['ZohoField']['hasMany'](db[_0x90c9('0xb3')],{'as':'Description','foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xb3')][_0x90c9('0x118')](db[_0x90c9('0xb3')],{'as':'Field','foreignKey':_0x90c9('0x1c5')});db['ZohoField'][_0x90c9('0x129')](db[_0x90c9('0x1c9')],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db[_0x90c9('0xb5')][_0x90c9('0x118')](db['ZendeskConfiguration'],{'as':_0x90c9('0x1c1'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c6')});db['ZendeskConfiguration']['hasMany'](db[_0x90c9('0xb8')],{'as':_0x90c9('0x1ce'),'foreignKey':'SubjectId'});db[_0x90c9('0x1cf')][_0x90c9('0x118')](db[_0x90c9('0xb8')],{'as':_0x90c9('0x1c3'),'foreignKey':'DescriptionId'});db[_0x90c9('0x1cf')][_0x90c9('0x118')](db[_0x90c9('0xb8')],{'as':'Fields','foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0x1cf')][_0x90c9('0x129')](db[_0x90c9('0xb5')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0x1cf')][_0x90c9('0x12b')](db['Tag'],{'through':_0x90c9('0x1d0')});db[_0x90c9('0xb8')][_0x90c9('0x118')](db['ZendeskField'],{'as':_0x90c9('0x1c7'),'foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0xb8')][_0x90c9('0x118')](db['ZendeskField'],{'as':'Description','foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xb8')]['hasMany'](db[_0x90c9('0xb8')],{'as':_0x90c9('0x1c8'),'foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xb8')]['belongsTo'](db[_0x90c9('0x1c9')],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db[_0x90c9('0x1d1')][_0x90c9('0x118')](db['FreshdeskConfiguration'],{'as':_0x90c9('0x1c1'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xba')][_0x90c9('0x118')](db[_0x90c9('0xbc')],{'as':_0x90c9('0x1ce'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0xba')][_0x90c9('0x118')](db[_0x90c9('0xbc')],{'as':'Descriptions','onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c4')});db['FreshdeskConfiguration']['hasMany'](db[_0x90c9('0xbc')],{'as':_0x90c9('0x1be'),'onDelete':'cascade','foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xba')]['belongsTo'](db[_0x90c9('0x1d1')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xba')]['belongsToMany'](db['Tag'],{'through':_0x90c9('0x1d2')});db[_0x90c9('0xbc')]['hasMany'](db[_0x90c9('0xbc')],{'as':_0x90c9('0x1c7'),'foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0xbc')][_0x90c9('0x118')](db[_0x90c9('0xbc')],{'as':_0x90c9('0x1cb'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xbc')][_0x90c9('0x118')](db['FreshdeskField'],{'as':_0x90c9('0x1c8'),'foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xbc')][_0x90c9('0x129')](db['Variable'],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db[_0x90c9('0x1d3')][_0x90c9('0x118')](db[_0x90c9('0x1d4')],{'as':_0x90c9('0x1c1'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0x1d4')][_0x90c9('0x118')](db[_0x90c9('0x1d5')],{'as':_0x90c9('0x1ce'),'foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0x1d4')]['hasMany'](db[_0x90c9('0x1d5')],{'as':_0x90c9('0x1c3'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x90c9('0x118')](db[_0x90c9('0x1d5')],{'as':'Fields','foreignKey':'FieldId'});db['VtigerConfiguration']['belongsTo'](db[_0x90c9('0x1d3')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0x1d5')]['hasMany'](db[_0x90c9('0x1d5')],{'as':_0x90c9('0x1c7'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0x90c9('0x1cb'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0x1d5')]['hasMany'](db['VtigerField'],{'as':_0x90c9('0x1c8'),'foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0x1d5')][_0x90c9('0x129')](db['Variable'],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db[_0x90c9('0xc0')][_0x90c9('0x118')](db[_0x90c9('0xc2')],{'as':_0x90c9('0x1c1'),'onDelete':'cascade','foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xc2')][_0x90c9('0x118')](db[_0x90c9('0xc3')],{'as':_0x90c9('0x1ce'),'foreignKey':'SubjectId'});db[_0x90c9('0xc2')]['hasMany'](db[_0x90c9('0xc3')],{'as':'Descriptions','foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xc2')][_0x90c9('0x118')](db['ServicenowField'],{'as':_0x90c9('0x1be'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x90c9('0x129')](db[_0x90c9('0xc0')],{'as':_0x90c9('0x172'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xc3')][_0x90c9('0x118')](db[_0x90c9('0xc3')],{'as':'Subject','foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0xc3')][_0x90c9('0x118')](db[_0x90c9('0xc3')],{'as':_0x90c9('0x1cb'),'foreignKey':'DescriptionId'});db[_0x90c9('0xc3')][_0x90c9('0x118')](db['ServicenowField'],{'as':_0x90c9('0x1c8'),'foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xc3')][_0x90c9('0x129')](db['Variable'],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db['Dynamics365Account'][_0x90c9('0x118')](db[_0x90c9('0xc7')],{'as':_0x90c9('0x1c1'),'onDelete':'cascade','foreignKey':_0x90c9('0x1c6')});db['Dynamics365Account'][_0x90c9('0x129')](db[_0x90c9('0x10d')],{'as':'CloudProvider','foreignKey':_0x90c9('0x166')});db[_0x90c9('0xc7')]['hasMany'](db[_0x90c9('0x1d6')],{'as':'Subjects','onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0xc7')][_0x90c9('0x118')](db[_0x90c9('0x1d6')],{'as':'Descriptions','onDelete':_0x90c9('0x117'),'foreignKey':'DescriptionId'});db[_0x90c9('0xc7')][_0x90c9('0x118')](db[_0x90c9('0x1d6')],{'as':'Fields','onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xc7')][_0x90c9('0x129')](db[_0x90c9('0xc5')],{'as':'Account','foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0x1d6')][_0x90c9('0x118')](db['Dynamics365Field'],{'as':_0x90c9('0x1c7'),'foreignKey':_0x90c9('0x1c2')});db[_0x90c9('0x1d6')][_0x90c9('0x118')](db['Dynamics365Field'],{'as':_0x90c9('0x1cb'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0x1d6')][_0x90c9('0x118')](db[_0x90c9('0x1d6')],{'as':_0x90c9('0x1c8'),'foreignKey':_0x90c9('0x1c5')});db['Dynamics365Field'][_0x90c9('0x129')](db[_0x90c9('0x1c9')],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db[_0x90c9('0x1d7')][_0x90c9('0x118')](db[_0x90c9('0xca')],{'as':_0x90c9('0x1c1'),'onDelete':_0x90c9('0x117'),'foreignKey':_0x90c9('0x1c6')});db[_0x90c9('0xca')]['hasMany'](db[_0x90c9('0xcb')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x90c9('0xca')]['hasMany'](db[_0x90c9('0xcb')],{'as':_0x90c9('0x1c3'),'foreignKey':_0x90c9('0x1c4')});db[_0x90c9('0xca')][_0x90c9('0x118')](db[_0x90c9('0xcb')],{'as':'Fields','foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xca')][_0x90c9('0x129')](db[_0x90c9('0x1d7')],{'as':_0x90c9('0x172'),'foreignKey':'AccountId'});db[_0x90c9('0xcb')][_0x90c9('0x118')](db[_0x90c9('0xcb')],{'as':_0x90c9('0x1c7'),'foreignKey':_0x90c9('0x1c2')});db['FreshsalesField'][_0x90c9('0x118')](db[_0x90c9('0xcb')],{'as':_0x90c9('0x1cb'),'foreignKey':'DescriptionId'});db[_0x90c9('0xcb')][_0x90c9('0x118')](db[_0x90c9('0xcb')],{'as':_0x90c9('0x1c8'),'foreignKey':_0x90c9('0x1c5')});db[_0x90c9('0xcb')][_0x90c9('0x129')](db[_0x90c9('0x1c9')],{'as':_0x90c9('0x1c9'),'foreignKey':_0x90c9('0x1cd')});db[_0x90c9('0xce')][_0x90c9('0x129')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0xce')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':_0x90c9('0x163'),'foreignKey':_0x90c9('0x164')});db[_0x90c9('0xce')][_0x90c9('0x129')](db[_0x90c9('0x67')],{});db[_0x90c9('0xce')][_0x90c9('0x129')](db[_0x90c9('0x193')],{});db[_0x90c9('0xce')][_0x90c9('0x129')](db['User'],{});db[_0x90c9('0xce')]['belongsTo'](db[_0x90c9('0x13a')],{});db[_0x90c9('0xd0')][_0x90c9('0x129')](db['User'],{'onDelete':'cascade','foreignKey':_0x90c9('0x1d8')});db[_0x90c9('0xd0')][_0x90c9('0x129')](db['User'],{'onDelete':_0x90c9('0x117'),'foreignKey':'ToId'});db[_0x90c9('0xd6')][_0x90c9('0x118')](db[_0x90c9('0xd4')],{'foreignKey':_0x90c9('0x1d9'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0xd6')][_0x90c9('0x118')](db[_0x90c9('0xd2')],{'foreignKey':_0x90c9('0x1d9'),'onDelete':_0x90c9('0x117')});db['SmsQueueReport']['belongsTo'](db[_0x90c9('0x143')],{});db['SmsQueueReport'][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0xd8')][_0x90c9('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0x90c9('0x164')});db['SmsQueueReport'][_0x90c9('0x129')](db[_0x90c9('0x58')],{});db[_0x90c9('0xd8')][_0x90c9('0x129')](db['SmsMessage'],{});db[_0x90c9('0xd8')]['belongsTo'](db['User'],{});db[_0x90c9('0xd8')][_0x90c9('0x129')](db['SmsQueue'],{});db['JscriptyProject'][_0x90c9('0x118')](db[_0x90c9('0xd6')],{'foreignKey':_0x90c9('0x1da')});db[_0x90c9('0xde')][_0x90c9('0x118')](db['JscriptyQuestionReport'],{'foreignKey':_0x90c9('0x1da')});db[_0x90c9('0xde')]['hasMany'](db[_0x90c9('0xd2')],{'foreignKey':'ProjectId'});db['Team']['belongsToMany'](db[_0x90c9('0x11')],{'as':'Agents','through':_0x90c9('0x1db')});db['Team'][_0x90c9('0x12b')](db['VoiceQueue'],{'through':_0x90c9('0x15a'),'as':_0x90c9('0x134')});db[_0x90c9('0xe7')]['belongsToMany'](db[_0x90c9('0x137')],{'through':'team_has_mail_queues','as':_0x90c9('0x138')});db[_0x90c9('0xe7')][_0x90c9('0x12b')](db['ChatQueue'],{'through':_0x90c9('0x19b'),'as':_0x90c9('0x13b')});db[_0x90c9('0xe7')][_0x90c9('0x12b')](db['FaxQueue'],{'through':_0x90c9('0x1dc'),'as':_0x90c9('0x13c')});db['Team'][_0x90c9('0x12b')](db[_0x90c9('0x5a')],{'through':_0x90c9('0x1dd'),'as':_0x90c9('0x1de')});db['Team'][_0x90c9('0x12b')](db['OpenchannelQueue'],{'through':_0x90c9('0x192'),'as':_0x90c9('0x1df')});db[_0x90c9('0xe7')][_0x90c9('0x12b')](db[_0x90c9('0x1e0')],{'through':'team_has_whatsapp_queues','as':_0x90c9('0x1e1')});db[_0x90c9('0xe7')][_0x90c9('0x12b')](db[_0x90c9('0xf9')],{'through':_0x90c9('0x1e2'),'as':'VoicePrefixes'});db[_0x90c9('0xeb')][_0x90c9('0x118')](db[_0x90c9('0x71')],{'as':_0x90c9('0x127'),'foreignKey':_0x90c9('0x1a3')});db[_0x90c9('0xeb')][_0x90c9('0x118')](db[_0x90c9('0x75')],{'as':_0x90c9('0x11c'),'foreignKey':'CampaignId'});db[_0x90c9('0xeb')][_0x90c9('0x118')](db[_0x90c9('0x77')],{'as':_0x90c9('0x14f'),'foreignKey':_0x90c9('0x1a3')});db[_0x90c9('0xeb')]['hasMany'](db['CmHopperBlack'],{'as':_0x90c9('0x150'),'foreignKey':_0x90c9('0x1a3')});db[_0x90c9('0xeb')][_0x90c9('0x129')](db[_0x90c9('0x2a')],{'as':_0x90c9('0x2a'),'foreignKey':_0x90c9('0x152')});db[_0x90c9('0xeb')][_0x90c9('0x129')](db[_0x90c9('0x2a')],{'as':_0x90c9('0x153'),'foreignKey':_0x90c9('0x154')});db['Campaign'][_0x90c9('0x129')](db[_0x90c9('0x82')],{'as':'Interval','foreignKey':_0x90c9('0x155')});db[_0x90c9('0xeb')][_0x90c9('0x129')](db[_0x90c9('0xe3')],{'as':_0x90c9('0xe3'),'foreignKey':_0x90c9('0x1e3')});db[_0x90c9('0xeb')][_0x90c9('0x12b')](db[_0x90c9('0xf7')],{'as':'Lists','through':_0x90c9('0x1e4')});db[_0x90c9('0xeb')][_0x90c9('0x12b')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x15b'),'through':_0x90c9('0x1e5')});db['Attachment'][_0x90c9('0x129')](db[_0x90c9('0x179')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x90c9('0xf2')]['belongsTo'](db[_0x90c9('0x43')],{});db['MailTransferReport'][_0x90c9('0x129')](db[_0x90c9('0x123')],{});db['MailTransferReport'][_0x90c9('0x129')](db[_0x90c9('0x3e')],{'foreignKey':_0x90c9('0x1e6'),'as':'FromAccount'});db[_0x90c9('0xf2')]['belongsTo'](db[_0x90c9('0x11')],{'foreignKey':'FromUserId','as':_0x90c9('0x1e7')});db[_0x90c9('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0x90c9('0x1e8'),'as':_0x90c9('0x1e9')});db['MailTransferReport'][_0x90c9('0x129')](db['MailQueue'],{'foreignKey':_0x90c9('0x1ea'),'as':_0x90c9('0x1eb')});db[_0x90c9('0xf2')][_0x90c9('0x129')](db[_0x90c9('0x3e')],{'foreignKey':_0x90c9('0x1ec'),'as':_0x90c9('0x1ed')});db[_0x90c9('0x1ee')][_0x90c9('0x129')](db[_0x90c9('0x193')],{});db[_0x90c9('0x1ee')][_0x90c9('0x129')](db['ChatInteraction'],{});db[_0x90c9('0x1ee')][_0x90c9('0x129')](db[_0x90c9('0x62')],{'foreignKey':_0x90c9('0x1ef'),'as':_0x90c9('0x1f0')});db[_0x90c9('0x1ee')]['belongsTo'](db[_0x90c9('0x11')],{'foreignKey':_0x90c9('0x1f1'),'as':_0x90c9('0x1e7')});db['ChatTransferReport']['belongsTo'](db[_0x90c9('0x11')],{'foreignKey':_0x90c9('0x1e8'),'as':'ToAgent'});db[_0x90c9('0x1ee')][_0x90c9('0x129')](db['ChatQueue'],{'foreignKey':_0x90c9('0x1f2'),'as':_0x90c9('0x1eb')});db[_0x90c9('0x1ee')][_0x90c9('0x129')](db[_0x90c9('0x62')],{'foreignKey':_0x90c9('0x1f3'),'as':_0x90c9('0x1ed')});db[_0x90c9('0x1f4')]['belongsTo'](db[_0x90c9('0x50')],{});db[_0x90c9('0x1f4')][_0x90c9('0x129')](db[_0x90c9('0x4e')],{});db[_0x90c9('0x1f4')][_0x90c9('0x129')](db['FaxAccount'],{'foreignKey':_0x90c9('0x1f5'),'as':_0x90c9('0x1f0')});db[_0x90c9('0x1f4')]['belongsTo'](db[_0x90c9('0x11')],{'foreignKey':'FromUserId','as':_0x90c9('0x1e7')});db[_0x90c9('0x1f4')]['belongsTo'](db[_0x90c9('0x11')],{'foreignKey':_0x90c9('0x1e8'),'as':_0x90c9('0x1e9')});db[_0x90c9('0x1f4')][_0x90c9('0x129')](db[_0x90c9('0x52')],{'foreignKey':'ToFaxQueueId','as':_0x90c9('0x1eb')});db[_0x90c9('0x1f4')][_0x90c9('0x129')](db[_0x90c9('0x4b')],{'foreignKey':_0x90c9('0x1f6'),'as':_0x90c9('0x1ed')});db[_0x90c9('0xf5')][_0x90c9('0x129')](db[_0x90c9('0x5e')],{});db[_0x90c9('0xf5')][_0x90c9('0x129')](db[_0x90c9('0x11f')],{});db[_0x90c9('0xf5')]['belongsTo'](db[_0x90c9('0x141')],{'foreignKey':_0x90c9('0x1f7'),'as':_0x90c9('0x1f0')});db[_0x90c9('0xf5')][_0x90c9('0x129')](db['User'],{'foreignKey':_0x90c9('0x1f1'),'as':_0x90c9('0x1e7')});db[_0x90c9('0xf5')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'foreignKey':'ToUserId','as':_0x90c9('0x1e9')});db[_0x90c9('0xf5')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x90c9('0x1f8'),'as':'ToQueue'});db[_0x90c9('0xf5')]['belongsTo'](db[_0x90c9('0x141')],{'foreignKey':_0x90c9('0x1f9'),'as':_0x90c9('0x1ed')});db[_0x90c9('0x1fa')][_0x90c9('0x129')](db[_0x90c9('0x186')],{});db[_0x90c9('0x1fa')][_0x90c9('0x129')](db[_0x90c9('0x58')],{});db[_0x90c9('0x1fa')][_0x90c9('0x129')](db[_0x90c9('0x143')],{'foreignKey':_0x90c9('0x1fb'),'as':_0x90c9('0x1f0')});db[_0x90c9('0x1fa')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'foreignKey':_0x90c9('0x1f1'),'as':_0x90c9('0x1e7')});db[_0x90c9('0x1fa')][_0x90c9('0x129')](db['User'],{'foreignKey':_0x90c9('0x1e8'),'as':'ToAgent'});db['SmsTransferReport'][_0x90c9('0x129')](db[_0x90c9('0x5a')],{'foreignKey':_0x90c9('0x1fc'),'as':_0x90c9('0x1eb')});db[_0x90c9('0x1fa')][_0x90c9('0x129')](db['SmsAccount'],{'foreignKey':_0x90c9('0x1fd'),'as':_0x90c9('0x1ed')});db[_0x90c9('0xf7')][_0x90c9('0x118')](db[_0x90c9('0x7f')],{'as':_0x90c9('0x17c'),'foreignKey':_0x90c9('0x16c'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0xf7')][_0x90c9('0x118')](db['CmCustomField'],{'as':_0x90c9('0x1fe'),'foreignKey':_0x90c9('0x16c')});db['CmList']['hasMany'](db['CmContact'],{'as':_0x90c9('0x19e'),'onDelete':_0x90c9('0x117'),'foreignKey':'ListId'});db['CmList'][_0x90c9('0x118')](db[_0x90c9('0x75')],{'as':_0x90c9('0x11c'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0xf7')][_0x90c9('0x118')](db[_0x90c9('0x77')],{'as':_0x90c9('0x11d'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0xf7')][_0x90c9('0x118')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x90c9('0xf7')]['belongsToMany'](db[_0x90c9('0x1a')],{'as':_0x90c9('0x1ff'),'through':_0x90c9('0x157')});db['CmList'][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':_0x90c9('0x158'),'through':_0x90c9('0x12e')});db['VoicePrefix']['hasMany'](db[_0x90c9('0x14a')],{'as':_0x90c9('0x11b'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0xf9')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':'Agents','through':_0x90c9('0x136')});db['VoicePrefix'][_0x90c9('0x12b')](db[_0x90c9('0xe7')],{'through':_0x90c9('0x1e2'),'as':_0x90c9('0x159')});db['UserProfile'][_0x90c9('0x118')](db[_0x90c9('0x11')],{'as':_0x90c9('0x176'),'foreignKey':'userProfileId'});db[_0x90c9('0xfa')][_0x90c9('0x118')](db[_0x90c9('0xfc')],{'as':'UserProfileSections','foreignKey':_0x90c9('0x12a'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0xfc')]['hasMany'](db[_0x90c9('0xfe')],{'as':_0x90c9('0x200'),'foreignKey':_0x90c9('0x201'),'onDelete':'cascade'});db[_0x90c9('0x102')][_0x90c9('0x118')](db[_0x90c9('0x7f')],{'as':_0x90c9('0x17c'),'foreignKey':_0x90c9('0x202'),'onDelete':_0x90c9('0x117')});db[_0x90c9('0x102')]['hasMany'](db[_0x90c9('0x17e')],{'as':_0x90c9('0x16a'),'foreignKey':_0x90c9('0x202')});db[_0x90c9('0x102')][_0x90c9('0x118')](db[_0x90c9('0x108')],{'as':_0x90c9('0x15d'),'foreignKey':_0x90c9('0x202')});db[_0x90c9('0x102')][_0x90c9('0x118')](db[_0x90c9('0x106')],{'as':_0x90c9('0x17f')});db['WhatsappAccount'][_0x90c9('0x118')](db[_0x90c9('0x104')],{'as':_0x90c9('0x14b'),'foreignKey':_0x90c9('0x202'),'onDelete':'cascade'});db[_0x90c9('0x102')][_0x90c9('0x129')](db[_0x90c9('0xf7')],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db['WhatsappAccount'][_0x90c9('0x129')](db[_0x90c9('0x156')],{'as':_0x90c9('0x16e'),'foreignKey':_0x90c9('0x16f')});db[_0x90c9('0x102')][_0x90c9('0x12b')](db['User'],{'as':_0x90c9('0x158'),'through':_0x90c9('0x146')});db[_0x90c9('0x104')]['belongsTo'](db[_0x90c9('0x11')],{'onDelete':_0x90c9('0x167')});db['WhatsappApplication'][_0x90c9('0x129')](db[_0x90c9('0x1e0')],{'onDelete':'restrict'});db[_0x90c9('0x104')][_0x90c9('0x129')](db[_0x90c9('0x102')],{'onDelete':_0x90c9('0x167')});db[_0x90c9('0x104')][_0x90c9('0x129')](db[_0x90c9('0x82')],{'onDelete':'restrict','foreignKey':_0x90c9('0x155')});db[_0x90c9('0x104')][_0x90c9('0x129')](db[_0x90c9('0x8b')],{'onDelete':_0x90c9('0x167'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x90c9('0x118')](db[_0x90c9('0x108')],{'as':_0x90c9('0x15d'),'onDelete':'cascade','foreignKey':_0x90c9('0x203')});db[_0x90c9('0x106')]['belongsTo'](db[_0x90c9('0x102')],{'as':'Account','foreignKey':_0x90c9('0x202')});db[_0x90c9('0x106')]['belongsTo'](db[_0x90c9('0x6f')],{'as':'Contact','foreignKey':_0x90c9('0x164')});db[_0x90c9('0x106')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'as':_0x90c9('0x173'),'foreignKey':_0x90c9('0x115')});db['WhatsappInteraction']['belongsToMany'](db[_0x90c9('0x8b')],{'through':_0x90c9('0x204'),'as':_0x90c9('0x175')});db[_0x90c9('0x106')][_0x90c9('0x12b')](db['Tag'],{'through':_0x90c9('0x204'),'as':_0x90c9('0x189')});db[_0x90c9('0x106')]['belongsToMany'](db[_0x90c9('0x11')],{'as':'Users','through':_0x90c9('0x205'),'foreignKey':_0x90c9('0x203')});db[_0x90c9('0x108')]['belongsTo'](db[_0x90c9('0x11')],{'as':_0x90c9('0x11')});db[_0x90c9('0x108')]['belongsTo'](db[_0x90c9('0x6f')],{'onDelete':'cascade','as':'Contact'});db[_0x90c9('0x108')][_0x90c9('0x129')](db[_0x90c9('0x106')],{'onDelete':_0x90c9('0x117'),'as':_0x90c9('0x177'),'foreignKey':_0x90c9('0x203')});db[_0x90c9('0x108')][_0x90c9('0x129')](db[_0x90c9('0x102')],{'as':_0x90c9('0x172'),'foreignKey':'WhatsappAccountId'});db[_0x90c9('0x109')][_0x90c9('0x129')](db[_0x90c9('0x102')],{});db[_0x90c9('0x109')][_0x90c9('0x129')](db['CmList'],{'as':_0x90c9('0x16b'),'foreignKey':_0x90c9('0x16c')});db[_0x90c9('0x109')][_0x90c9('0x129')](db[_0x90c9('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x90c9('0x109')][_0x90c9('0x129')](db[_0x90c9('0x106')],{});db[_0x90c9('0x109')][_0x90c9('0x129')](db[_0x90c9('0x1e0')],{});db[_0x90c9('0x109')][_0x90c9('0x129')](db['WhatsappMessage'],{});db[_0x90c9('0x109')][_0x90c9('0x129')](db[_0x90c9('0x11')],{});db['WhatsappTransferReport'][_0x90c9('0x129')](db['WhatsappMessage'],{});db[_0x90c9('0x206')][_0x90c9('0x129')](db[_0x90c9('0x106')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x90c9('0x102')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db['WhatsappTransferReport'][_0x90c9('0x129')](db[_0x90c9('0x102')],{'foreignKey':_0x90c9('0x207'),'as':_0x90c9('0x1ed')});db['WhatsappTransferReport'][_0x90c9('0x129')](db[_0x90c9('0x1e0')],{'foreignKey':_0x90c9('0x208'),'as':'ToQueue'});db[_0x90c9('0x206')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'foreignKey':_0x90c9('0x1f1'),'as':_0x90c9('0x1e7')});db[_0x90c9('0x206')][_0x90c9('0x129')](db[_0x90c9('0x11')],{'foreignKey':_0x90c9('0x1e8'),'as':_0x90c9('0x1e9')});db[_0x90c9('0x1e0')][_0x90c9('0x12b')](db[_0x90c9('0x11')],{'as':'Agents','through':_0x90c9('0x3a'),'foreignKey':_0x90c9('0x209')});db[_0x90c9('0x1e0')][_0x90c9('0x12b')](db[_0x90c9('0xe7')],{'through':_0x90c9('0x20a'),'as':_0x90c9('0x159')});db[_0x90c9('0x111')]['belongsTo'](db[_0x90c9('0x11')],{'as':_0x90c9('0x20b'),'foreignKey':_0x90c9('0x115'),'onDelete':'cascade','hooks':!![]});db[_0x90c9('0x10d')][_0x90c9('0x114')](db['Dynamics365Account'],{'as':_0x90c9('0xc5'),'onDelete':'restrict'});db['CloudProvider'][_0x90c9('0x114')](db[_0x90c9('0x3b')],{'as':_0x90c9('0x168'),'onDelete':_0x90c9('0x167')});db['CloudProvider'][_0x90c9('0x114')](db[_0x90c9('0x3d')],{'as':_0x90c9('0x169'),'onDelete':_0x90c9('0x167')});module[_0x90c9('0x20c')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbcc2=['Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','MailQueueReport','Items','FaxAccountId','Answers','FaxApplication','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','TagId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatProactiveAction','ProactiveActions','OpenchannelQueueReport','Agent','ChatQueue','Queue','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','Contacts','Phones','SmsInteractions','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','Action','ParentId','ChatApplications','FaxApplications','SmsApplications','Schedule','AnalyticDefaultReport','DefaultReportId','CustomReportId','chat_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','Actions','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Field','VariableId','Subjects','Description','DeskField','ZohoAccount','ZohoConfiguration','ZendeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','FreshsalesAccount','ChatQueueReport','FromId','SessionId','JscriptyAnswerReport','JscriptyProject','ProjectId','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','CampaignId','ChatOfflineMessageId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','ToAgent','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserVoicePrefix','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Smtp','exports','../config/environment','lodash','determine','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','options','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','../api/schedule/schedule.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','CmHopper','Hoppers','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','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','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceCallReport','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailAccountId','Imap','Disposition','Dispositions','Interactions','List','ListId','user_has_mail_accounts','MailQueue','team_has_mail_queues','MailInteractionId','Account'];(function(_0x29aca7,_0x21c650){var _0x1db0a0=function(_0x45b5ea){while(--_0x45b5ea){_0x29aca7['push'](_0x29aca7['shift']());}};_0x1db0a0(++_0x21c650);}(_0xbcc2,0x93));var _0x2bcc=function(_0x250bbc,_0x3297f3){_0x250bbc=_0x250bbc-0x0;var _0x489e34=_0xbcc2[_0x250bbc];return _0x489e34;};'use strict';var config=require(_0x2bcc('0x0'));var Sequelize=require('sequelize');var _=require(_0x2bcc('0x1'));var jstz=require('jstz');var timezone=jstz[_0x2bcc('0x2')]();config[_0x2bcc('0x3')]=_['defaultsDeep'](config['sequelize'],{'database':_0x2bcc('0x4'),'username':_0x2bcc('0x5'),'password':_0x2bcc('0x6'),'options':{'host':_0x2bcc('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x2bcc('0x8')},'logging':![],'timezone':timezone[_0x2bcc('0x9')](),'define':{'charset':_0x2bcc('0xa'),'collate':_0x2bcc('0xb')}}});config[_0x2bcc('0xc')]=_['defaultsDeep'](config[_0x2bcc('0xc')],{'database':_0x2bcc('0x4'),'username':_0x2bcc('0x5'),'password':_0x2bcc('0x6'),'options':{'host':_0x2bcc('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x2bcc('0x8')},'logging':![],'timezone':timezone[_0x2bcc('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2bcc('0x3')][_0x2bcc('0xd')],config[_0x2bcc('0x3')]['username'],config[_0x2bcc('0x3')]['password'],config[_0x2bcc('0x3')][_0x2bcc('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2bcc('0xc')][_0x2bcc('0xd')],config['sequelizeHistory']['username'],config[_0x2bcc('0xc')][_0x2bcc('0xf')],config['sequelizeHistory'][_0x2bcc('0xe')])};db[_0x2bcc('0x10')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x12'));db[_0x2bcc('0x13')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x14'));db[_0x2bcc('0x15')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize']['import'](_0x2bcc('0x16'));db[_0x2bcc('0x17')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x18'));db[_0x2bcc('0x19')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x1a'));db[_0x2bcc('0x1b')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x2bcc('0x1c')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x1d'));db['VoiceMail']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x1e'));db[_0x2bcc('0x1f')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x20'));db[_0x2bcc('0x21')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x22'));db[_0x2bcc('0x23')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x24'));db['VoiceQueueReport']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x2bcc('0x25')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x2bcc('0x11')]('../api/trunk/trunk.model');db[_0x2bcc('0x26')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x27'));db[_0x2bcc('0x28')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x29'));db['UserVoiceQueue']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x2a'));db[_0x2bcc('0x2b')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x2c'));db['UserMailQueue']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x2d'));db[_0x2bcc('0x2e')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x2f'));db['UserSmsQueue']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x30'));db['UserOpenchannelQueue']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x31'));db[_0x2bcc('0x32')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x2bcc('0x33')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x34'));db[_0x2bcc('0x35')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x36'));db['MailAccount']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x37'));db['MailQueue']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x38'));db['MailInteraction']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x39'));db[_0x2bcc('0x3a')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x3b'));db[_0x2bcc('0x3c')]=db['sequelize']['import'](_0x2bcc('0x3d'));db['MailQueueReport']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x3e'));db[_0x2bcc('0x3f')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/dashboard/dashboard.model');db[_0x2bcc('0x40')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x41'));db[_0x2bcc('0x42')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x43'));db['FaxApplication']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/faxApplication/faxApplication.model');db[_0x2bcc('0x44')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x45'));db['FaxMessage']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x46'));db[_0x2bcc('0x47')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x48'));db[_0x2bcc('0x49')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x4a'));db[_0x2bcc('0x4b')]=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db[_0x2bcc('0x4c')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/smsApplication/smsApplication.model');db[_0x2bcc('0x4d')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0x2bcc('0x4e')]=db[_0x2bcc('0x3')]['import']('../api/smsMessage/smsMessage.model');db[_0x2bcc('0x4f')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x50'));db[_0x2bcc('0x51')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x52'));db['OpenchannelApplication']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x53'));db[_0x2bcc('0x54')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x55'));db[_0x2bcc('0x56')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x57'));db[_0x2bcc('0x58')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x59'));db[_0x2bcc('0x5a')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x5b'));db['OpenchannelQueueReport']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x5c'));db[_0x2bcc('0x5d')]=db['sequelize'][_0x2bcc('0x11')]('../api/chatApplication/chatApplication.model');db[_0x2bcc('0x5e')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x5f'));db[_0x2bcc('0x60')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x61'));db['ChatOfflineMessage']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x62'));db['ChatQueue']=db['sequelize'][_0x2bcc('0x11')]('../api/chatQueue/chatQueue.model');db[_0x2bcc('0x63')]=db['sequelize']['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x64'));db['CmCompany']=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db[_0x2bcc('0x65')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x66'));db['CmHopper']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x67'));db[_0x2bcc('0x68')]=db[_0x2bcc('0x3')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x2bcc('0x69')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x6a'));db[_0x2bcc('0x6b')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x2bcc('0x6c')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x6d'));db['Action']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x6e'));db[_0x2bcc('0x6f')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x70'));db[_0x2bcc('0x71')]=db[_0x2bcc('0x3')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x72'));db['Condition']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x73'));db['Interval']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x74'));db[_0x2bcc('0x75')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x76'));db['Cdr']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x77'));db['VoiceQueuesLog']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x78'));db['Sound']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/sound/sound.model');db['Tag']=db['sequelize'][_0x2bcc('0x11')]('../api/tag/tag.model');db[_0x2bcc('0x79')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/contactItemType/contactItemType.model');db[_0x2bcc('0x7a')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x7b'));db[_0x2bcc('0x7c')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x7d'));db[_0x2bcc('0x7e')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x7f'));db[_0x2bcc('0x80')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/trigger/trigger.model');db[_0x2bcc('0x81')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x82'));db[_0x2bcc('0x83')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/integration/integration.model');db[_0x2bcc('0x84')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x85'));db[_0x2bcc('0x86')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x87'));db['AnalyticDefaultReport']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x88'));db[_0x2bcc('0x89')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x2bcc('0x8a')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x8b'));db[_0x2bcc('0x8c')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x2bcc('0x8d')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x8e'));db['SalesforceAccount']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x2bcc('0x8f')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x90'));db['SalesforceField']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x91'));db[_0x2bcc('0x92')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x93'));db[_0x2bcc('0x94')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0x95'));db[_0x2bcc('0x96')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x97'));db[_0x2bcc('0x98')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x99'));db[_0x2bcc('0x9a')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x9b'));db['DeskField']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x9c'));db['ZohoAccount']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0x9d'));db['ZohoConfiguration']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0x9e'));db[_0x2bcc('0x9f')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/intZohoField/intZohoField.model');db[_0x2bcc('0xa0')]=db[_0x2bcc('0x3')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xa1'));db[_0x2bcc('0xa2')]=db[_0x2bcc('0x3')]['import']('../api/intZendeskField/intZendeskField.model');db[_0x2bcc('0xa3')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xa4'));db[_0x2bcc('0xa5')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xa6'));db[_0x2bcc('0xa7')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xa8'));db['VtigerAccount']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xa9'));db[_0x2bcc('0xaa')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xab'));db[_0x2bcc('0xac')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xad'));db[_0x2bcc('0xae')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xaf'));db[_0x2bcc('0xb0')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xb1'));db[_0x2bcc('0xb2')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xb3'));db[_0x2bcc('0xb4')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xb5'));db[_0x2bcc('0xb6')]=db[_0x2bcc('0x3')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x2bcc('0xb7')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xb8'));db['FreshsalesAccount']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xb9'));db[_0x2bcc('0xba')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x2bcc('0xbb')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xbc'));db[_0x2bcc('0x83')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xbd'));db[_0x2bcc('0xbe')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xbf'));db['ChatQueueReport']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xc0'));db[_0x2bcc('0xc1')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xc2'));db['JscriptyAnswerReport']=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xc3'));db[_0x2bcc('0xc4')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xc5'));db['JscriptySessionReport']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xc6'));db[_0x2bcc('0xc7')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xc8'));db[_0x2bcc('0xc9')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xca'));db[_0x2bcc('0xcb')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xcc'));db['JscriptyProject']=db[_0x2bcc('0x3')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x2bcc('0xcd')]=db['sequelize'][_0x2bcc('0x11')]('../api/setting/setting.model');db[_0x2bcc('0xce')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xcf'));db[_0x2bcc('0xd0')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xd1'));db[_0x2bcc('0xd2')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xd3'));db[_0x2bcc('0xd4')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xd5'));db[_0x2bcc('0xd6')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xd7'));db[_0x2bcc('0xd8')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xd9'));db[_0x2bcc('0xda')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xdb'));db[_0x2bcc('0xdc')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xdd'));db['Plugin']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/plugin/plugin.model');db[_0x2bcc('0xde')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xdf'));db[_0x2bcc('0xe0')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xe1'));db[_0x2bcc('0xe2')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xe3'));db[_0x2bcc('0xe4')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x2bcc('0xe5')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xe6'));db['CmList']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xe7'));db[_0x2bcc('0xe8')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xe9'));db[_0x2bcc('0xea')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/userProfile/userProfile.model');db[_0x2bcc('0xeb')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xec'));db['UserProfileResource']=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xed'));db['UserNotification']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/userNotification/userNotification.model');db[_0x2bcc('0xee')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/whatsappAccount/whatsappAccount.model');db[_0x2bcc('0xef')]=db['sequelize'][_0x2bcc('0x11')](_0x2bcc('0xf0'));db[_0x2bcc('0xf1')]=db['sequelize'][_0x2bcc('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xf2'));db[_0x2bcc('0xf3')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x2bcc('0xf4')]=db['sequelize'][_0x2bcc('0x11')]('../api/whatsappQueue/whatsappQueue.model');db[_0x2bcc('0xf5')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xf6'));db[_0x2bcc('0xf7')]=db[_0x2bcc('0x3')][_0x2bcc('0x11')](_0x2bcc('0xf8'));db['TeamVoicePrefix']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x2bcc('0x3')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x2bcc('0xf9')]=db[_0x2bcc('0x3')]['import'](_0x2bcc('0xfa'));db['MailInteractionHasTag']=db[_0x2bcc('0x3')][_0x2bcc('0x11')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x2bcc('0x10')][_0x2bcc('0xfb')](db[_0x2bcc('0xfc')],{'as':_0x2bcc('0xfc'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10')][_0x2bcc('0xfb')](db['UserSetting'],{'as':_0x2bcc('0xff'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0xfe')});db['User'][_0x2bcc('0x100')](db['VoiceRecording'],{'as':_0x2bcc('0x101'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10')][_0x2bcc('0x100')](db[_0x2bcc('0x28')],{'as':_0x2bcc('0x102'),'foreignKey':_0x2bcc('0xfe')});db['User']['hasMany'](db[_0x2bcc('0x103')],{'as':_0x2bcc('0x104'),'onDelete':_0x2bcc('0xfd'),'hooks':!![]});db['User']['hasMany'](db[_0x2bcc('0x68')],{'as':_0x2bcc('0x105'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10')]['hasMany'](db[_0x2bcc('0x69')],{'as':_0x2bcc('0x106'),'foreignKey':'UserId'});db[_0x2bcc('0x10')][_0x2bcc('0x100')](db[_0x2bcc('0x6b')],{'as':_0x2bcc('0x6b'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10')][_0x2bcc('0x100')](db[_0x2bcc('0x54')],{'as':_0x2bcc('0x107'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10')]['hasMany'](db[_0x2bcc('0x5e')],{'as':_0x2bcc('0x108'),'foreignKey':'UserId'});db[_0x2bcc('0x10')][_0x2bcc('0x100')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x2bcc('0x10')]['hasMany'](db['FaxInteraction'],{'as':_0x2bcc('0x109'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10')][_0x2bcc('0x100')](db[_0x2bcc('0x10a')],{'as':_0x2bcc('0x10b'),'foreignKey':'UserId'});db['User'][_0x2bcc('0x100')](db[_0x2bcc('0xf1')],{'as':_0x2bcc('0x10c'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10')][_0x2bcc('0x100')](db[_0x2bcc('0x10d')],{'as':_0x2bcc('0x10e'),'foreignKey':_0x2bcc('0x10f')});db[_0x2bcc('0x10')][_0x2bcc('0x100')](db[_0x2bcc('0x110')],{'as':_0x2bcc('0x111'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x2bcc('0x10')][_0x2bcc('0x112')](db[_0x2bcc('0xea')],{'as':_0x2bcc('0xea'),'foreignKey':_0x2bcc('0x113')});db[_0x2bcc('0x10')]['belongsToMany'](db[_0x2bcc('0x63')],{'as':_0x2bcc('0x114'),'through':_0x2bcc('0x115')});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0x65')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x2bcc('0x10')]['belongsToMany'](db['CmList'],{'as':_0x2bcc('0x117'),'through':_0x2bcc('0x118')});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0x119')],{'through':_0x2bcc('0x11a')});db[_0x2bcc('0x10')]['belongsToMany'](db['MailInteraction'],{'as':_0x2bcc('0x10b'),'through':_0x2bcc('0x11b')});db['User'][_0x2bcc('0x116')](db[_0x2bcc('0x5e')],{'as':_0x2bcc('0x108'),'through':_0x2bcc('0x11c')});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db['FaxInteraction'],{'as':_0x2bcc('0x109'),'through':_0x2bcc('0x11d')});db['User'][_0x2bcc('0x116')](db[_0x2bcc('0x4d')],{'as':'SmsInteractions','through':_0x2bcc('0x11e')});db[_0x2bcc('0x10')]['belongsToMany'](db[_0x2bcc('0x54')],{'as':_0x2bcc('0x107'),'through':_0x2bcc('0x11f')});db[_0x2bcc('0x10')]['belongsToMany'](db[_0x2bcc('0xf1')],{'as':'WhatsappInteractions','through':_0x2bcc('0x120')});db[_0x2bcc('0x10')]['belongsToMany'](db['VoiceQueue'],{'as':_0x2bcc('0x121'),'through':_0x2bcc('0x122'),'required':![]});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0xe8')],{'as':_0x2bcc('0x123'),'through':'UserVoicePrefix','required':![]});db[_0x2bcc('0x10')]['belongsToMany'](db['MailQueue'],{'as':_0x2bcc('0x124'),'through':_0x2bcc('0x125'),'required':![]});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db['ChatQueue'],{'as':_0x2bcc('0x126'),'through':_0x2bcc('0x2b'),'required':![],'hooks':!![]});db['User'][_0x2bcc('0x116')](db[_0x2bcc('0x47')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0x4f')],{'as':_0x2bcc('0x127'),'through':_0x2bcc('0x128'),'required':![]});db['User']['belongsToMany'](db[_0x2bcc('0x58')],{'as':_0x2bcc('0x129'),'through':'UserOpenchannelQueue','required':![]});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0xf4')],{'as':_0x2bcc('0x12a'),'through':_0x2bcc('0x32'),'required':![]});db[_0x2bcc('0x10')]['belongsToMany'](db[_0x2bcc('0x12b')],{'through':'cm_user_has_lists'});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0x5a')],{'as':_0x2bcc('0x12c'),'through':_0x2bcc('0x12d')});db['User'][_0x2bcc('0x116')](db['FaxAccount'],{'as':_0x2bcc('0x12e'),'through':_0x2bcc('0x12f')});db['User'][_0x2bcc('0x116')](db[_0x2bcc('0x130')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db['User'][_0x2bcc('0x116')](db[_0x2bcc('0x51')],{'as':'OpenchannelAccounts','through':_0x2bcc('0x131')});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0x4b')],{'as':_0x2bcc('0x132'),'through':_0x2bcc('0x133')});db[_0x2bcc('0x10')][_0x2bcc('0x116')](db[_0x2bcc('0xee')],{'as':_0x2bcc('0x134'),'through':'user_has_whatsapp_accounts'});db[_0x2bcc('0x13')][_0x2bcc('0x100')](db[_0x2bcc('0x103')],{'as':_0x2bcc('0x135'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x136')});db['VoiceContext'][_0x2bcc('0x100')](db[_0x2bcc('0x103')],{'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x103')][_0x2bcc('0x100')](db['VoiceExtension'],{'as':_0x2bcc('0x137'),'onDelete':'cascade'});db[_0x2bcc('0x17')][_0x2bcc('0x116')](db[_0x2bcc('0x138')],{'as':_0x2bcc('0x139'),'through':_0x2bcc('0x13a')});db[_0x2bcc('0x19')]['hasMany'](db[_0x2bcc('0x28')],{'as':_0x2bcc('0x13b'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x2bcc('0x100')](db[_0x2bcc('0x110')],{'as':_0x2bcc('0x111'),'foreignKey':_0x2bcc('0x13c')});db[_0x2bcc('0x19')]['hasMany'](db['CmHopperFinal'],{'as':_0x2bcc('0x105'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x2bcc('0x100')](db[_0x2bcc('0x69')],{'as':_0x2bcc('0x13d'),'foreignKey':_0x2bcc('0x13c')});db[_0x2bcc('0x19')][_0x2bcc('0x100')](db['ReportAgentPreview'],{'as':_0x2bcc('0x6b'),'foreignKey':_0x2bcc('0x13c')});db['VoiceQueue'][_0x2bcc('0x100')](db[_0x2bcc('0x13e')],{'as':_0x2bcc('0x13f'),'foreignKey':'VoiceQueueId'});db[_0x2bcc('0x19')][_0x2bcc('0x100')](db[_0x2bcc('0x140')],{'as':_0x2bcc('0x141'),'foreignKey':'VoiceQueueId'});db[_0x2bcc('0x19')][_0x2bcc('0x112')](db[_0x2bcc('0x142')],{'as':'Trunk','foreignKey':_0x2bcc('0x143')});db[_0x2bcc('0x19')][_0x2bcc('0x112')](db[_0x2bcc('0x142')],{'as':_0x2bcc('0x144'),'foreignKey':_0x2bcc('0x145')});db['VoiceQueue']['belongsTo'](db[_0x2bcc('0x146')],{'as':_0x2bcc('0x146'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0x19')][_0x2bcc('0x112')](db['Pause'],{'as':_0x2bcc('0x148'),'foreignKey':_0x2bcc('0x149')});db[_0x2bcc('0x19')][_0x2bcc('0x116')](db['CmList'],{'as':_0x2bcc('0x117'),'through':_0x2bcc('0x14a')});db[_0x2bcc('0x19')]['belongsToMany'](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x122')});db[_0x2bcc('0x19')][_0x2bcc('0x116')](db['Team'],{'as':_0x2bcc('0x14c'),'through':_0x2bcc('0xf7')});db[_0x2bcc('0x19')][_0x2bcc('0x116')](db[_0x2bcc('0x12b')],{'as':'BlackLists','through':_0x2bcc('0x14d')});db[_0x2bcc('0x1b')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x10'),'foreignKey':'UserId'});db[_0x2bcc('0x1c')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':'User','foreignKey':_0x2bcc('0xfe')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':_0x2bcc('0x14e'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x14f'),'sourceKey':_0x2bcc('0x150')});db['VoiceMailMessage'][_0x2bcc('0x112')](db['VoiceMail'],{'foreignKey':_0x2bcc('0x14f'),'targetKey':_0x2bcc('0x150')});db['VoiceCallReport']['hasMany'](db[_0x2bcc('0x151')],{'as':_0x2bcc('0x152'),'foreignKey':_0x2bcc('0x153'),'constraints':![]});db[_0x2bcc('0x154')]['hasMany'](db['VoiceAgentReport'],{'as':_0x2bcc('0x155'),'foreignKey':_0x2bcc('0x153'),'constraints':![]});db[_0x2bcc('0x154')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x10'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x154')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x33')][_0x2bcc('0x112')](db[_0x2bcc('0x130')],{'as':_0x2bcc('0x130'),'foreignKey':'MailAccountId'});db['MailServerIn'][_0x2bcc('0x112')](db[_0x2bcc('0xf5')],{'as':_0x2bcc('0xf5'),'foreignKey':_0x2bcc('0x158'),'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x35')]['belongsTo'](db[_0x2bcc('0x130')],{'as':_0x2bcc('0x130'),'foreignKey':_0x2bcc('0x15a')});db['MailServerOut']['belongsTo'](db[_0x2bcc('0xf5')],{'as':_0x2bcc('0xf5'),'foreignKey':_0x2bcc('0x158'),'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x130')][_0x2bcc('0xfb')](db[_0x2bcc('0x33')],{'as':_0x2bcc('0x15b'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x130')][_0x2bcc('0xfb')](db[_0x2bcc('0x35')],{'as':'Smtp','onDelete':_0x2bcc('0xfd')});db['MailAccount'][_0x2bcc('0x100')](db[_0x2bcc('0x15c')],{'as':_0x2bcc('0x15d'),'foreignKey':_0x2bcc('0x15a'),'onDelete':_0x2bcc('0xfd')});db['MailAccount'][_0x2bcc('0x100')](db[_0x2bcc('0x71')],{'as':'Answers','foreignKey':_0x2bcc('0x15a')});db['MailAccount'][_0x2bcc('0x100')](db[_0x2bcc('0x3a')],{'as':_0x2bcc('0x14e'),'foreignKey':_0x2bcc('0x15a')});db[_0x2bcc('0x130')][_0x2bcc('0x100')](db['MailInteraction'],{'as':_0x2bcc('0x15e')});db['MailAccount'][_0x2bcc('0x100')](db[_0x2bcc('0x3c')],{'as':_0x2bcc('0x137'),'foreignKey':_0x2bcc('0x15a'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x130')][_0x2bcc('0x112')](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0x130')][_0x2bcc('0x112')](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0x2bcc('0x130')]['belongsTo'](db[_0x2bcc('0x75')],{'as':_0x2bcc('0x148'),'foreignKey':_0x2bcc('0x149')});db[_0x2bcc('0x130')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x161')});db[_0x2bcc('0x162')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db[_0x2bcc('0x119')],{'through':_0x2bcc('0x163'),'as':_0x2bcc('0x14c')});db[_0x2bcc('0x10a')][_0x2bcc('0x100')](db[_0x2bcc('0x3a')],{'as':_0x2bcc('0x14e'),'onDelete':'cascade','foreignKey':_0x2bcc('0x164')});db[_0x2bcc('0x10a')][_0x2bcc('0x112')](db[_0x2bcc('0x130')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x15a')});db[_0x2bcc('0x10a')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x10a')][_0x2bcc('0x112')](db['User'],{'as':_0x2bcc('0x166'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x10a')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':_0x2bcc('0x168'),'as':_0x2bcc('0x169')});db[_0x2bcc('0x10a')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':'mail_interaction_has_tags','as':_0x2bcc('0x16a')});db[_0x2bcc('0x10a')]['belongsToMany'](db['User'],{'as':_0x2bcc('0x16b'),'through':_0x2bcc('0x11b'),'foreignKey':_0x2bcc('0x164')});db[_0x2bcc('0x3a')]['hasMany'](db[_0x2bcc('0xdc')],{'as':_0x2bcc('0x16c'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x3a')]['belongsTo'](db['User'],{'as':_0x2bcc('0x10')});db['MailMessage'][_0x2bcc('0x112')](db['CmContact'],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x156')});db[_0x2bcc('0x3a')][_0x2bcc('0x112')](db[_0x2bcc('0x10a')],{'as':_0x2bcc('0x16d'),'foreignKey':_0x2bcc('0x164')});db['MailMessage'][_0x2bcc('0x112')](db['MailAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x15a')});db[_0x2bcc('0x3a')][_0x2bcc('0x112')](db[_0x2bcc('0x5a')],{'as':_0x2bcc('0x5a'),'foreignKey':_0x2bcc('0x16e')});db[_0x2bcc('0x3a')][_0x2bcc('0x112')](db[_0x2bcc('0x16f')],{'as':_0x2bcc('0x16f'),'foreignKey':'ChatOfflineMessageId'});db[_0x2bcc('0x3c')]['belongsTo'](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x3c')][_0x2bcc('0x112')](db['MailQueue'],{'onDelete':'restrict'});db[_0x2bcc('0x3c')][_0x2bcc('0x112')](db[_0x2bcc('0x130')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x3c')][_0x2bcc('0x112')](db[_0x2bcc('0x146')],{'onDelete':_0x2bcc('0x159'),'foreignKey':'IntervalId'});db[_0x2bcc('0x3c')][_0x2bcc('0x112')](db[_0x2bcc('0x167')],{'onDelete':_0x2bcc('0x159'),'foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db[_0x2bcc('0x130')],{});db[_0x2bcc('0x170')][_0x2bcc('0x112')](db['CmList'],{'as':'List','foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0x170')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db['MailQueueReport'][_0x2bcc('0x112')](db['MailInteraction'],{});db[_0x2bcc('0x170')][_0x2bcc('0x112')](db[_0x2bcc('0x3a')],{});db['MailQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{});db[_0x2bcc('0x170')][_0x2bcc('0x112')](db['MailQueue'],{});db[_0x2bcc('0x3f')]['hasMany'](db[_0x2bcc('0x40')],{'as':_0x2bcc('0x171'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x42')]['hasMany'](db[_0x2bcc('0x15c')],{'as':_0x2bcc('0x15d'),'foreignKey':_0x2bcc('0x172'),'onDelete':_0x2bcc('0xfd')});db['FaxAccount'][_0x2bcc('0x100')](db['CannedAnswer'],{'as':_0x2bcc('0x173'),'foreignKey':_0x2bcc('0x172')});db['FaxAccount'][_0x2bcc('0x100')](db[_0x2bcc('0x44')],{'as':_0x2bcc('0x15e')});db[_0x2bcc('0x42')][_0x2bcc('0x100')](db[_0x2bcc('0x174')],{'as':_0x2bcc('0x137'),'foreignKey':_0x2bcc('0x172'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x42')][_0x2bcc('0x100')](db[_0x2bcc('0x103')],{'as':_0x2bcc('0x175'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x42')]['hasMany'](db[_0x2bcc('0x176')],{'as':'Messages'});db['FaxAccount'][_0x2bcc('0x112')](db[_0x2bcc('0x142')],{'as':_0x2bcc('0x142')});db[_0x2bcc('0x42')]['belongsTo'](db['CmList'],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160')});db['FaxAccount'][_0x2bcc('0x112')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x2bcc('0x149')});db['FaxAccount']['belongsToMany'](db['User'],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x12f')});db[_0x2bcc('0x174')]['belongsTo'](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0x159')});db['FaxApplication'][_0x2bcc('0x112')](db[_0x2bcc('0x47')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x174')][_0x2bcc('0x112')](db[_0x2bcc('0x42')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x174')][_0x2bcc('0x112')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x2bcc('0x44')][_0x2bcc('0x100')](db[_0x2bcc('0x176')],{'as':'Messages','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x177')});db['FaxInteraction']['belongsTo'](db['FaxAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x172')});db[_0x2bcc('0x44')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x44')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x166'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x44')][_0x2bcc('0x116')](db['Tag'],{'through':_0x2bcc('0x178'),'as':_0x2bcc('0x169')});db[_0x2bcc('0x44')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':'fax_interaction_has_tags','as':_0x2bcc('0x16a')});db['FaxInteraction']['belongsToMany'](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x16b'),'through':_0x2bcc('0x11d'),'foreignKey':_0x2bcc('0x177')});db['FaxMessage'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x10')});db['FaxMessage']['belongsTo'](db[_0x2bcc('0x44')],{'as':_0x2bcc('0x16d'),'foreignKey':'FaxInteractionId'});db[_0x2bcc('0x176')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'onDelete':_0x2bcc('0xfd'),'as':'Contact'});db['FaxMessage'][_0x2bcc('0x112')](db[_0x2bcc('0xdc')],{'as':'Attachment','foreignKey':_0x2bcc('0x179')});db['FaxMessage']['belongsTo'](db[_0x2bcc('0x42')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x172')});db[_0x2bcc('0x47')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x2e')});db[_0x2bcc('0x47')][_0x2bcc('0x116')](db[_0x2bcc('0x119')],{'through':_0x2bcc('0x17a'),'as':_0x2bcc('0x14c')});db[_0x2bcc('0x49')]['belongsTo'](db[_0x2bcc('0x42')],{});db[_0x2bcc('0x49')][_0x2bcc('0x112')](db[_0x2bcc('0x12b')],{'as':'List','foreignKey':_0x2bcc('0x160')});db['FaxQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x49')][_0x2bcc('0x112')](db[_0x2bcc('0x44')],{});db['FaxQueueReport']['belongsTo'](db[_0x2bcc('0x176')],{});db['FaxQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{});db['FaxQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x47')],{});db[_0x2bcc('0x4b')]['hasMany'](db['Disposition'],{'as':_0x2bcc('0x15d'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x2bcc('0x4b')][_0x2bcc('0x100')](db['CannedAnswer'],{'as':_0x2bcc('0x173'),'foreignKey':_0x2bcc('0x17b')});db['SmsAccount'][_0x2bcc('0x100')](db['SmsMessage'],{'as':_0x2bcc('0x14e'),'foreignKey':'SmsAccountId'});db[_0x2bcc('0x4b')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db[_0x2bcc('0x4b')][_0x2bcc('0x100')](db[_0x2bcc('0x4c')],{'as':_0x2bcc('0x137'),'foreignKey':_0x2bcc('0x17b'),'onDelete':'cascade'});db[_0x2bcc('0x4b')][_0x2bcc('0x112')](db['CmList'],{'as':'List','foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0x4b')][_0x2bcc('0x112')](db['Pause'],{'as':_0x2bcc('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2bcc('0x4b')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0x159')});db['SmsApplication'][_0x2bcc('0x112')](db['SmsQueue'],{'onDelete':_0x2bcc('0x159')});db['SmsApplication'][_0x2bcc('0x112')](db[_0x2bcc('0x4b')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x4c')][_0x2bcc('0x112')](db[_0x2bcc('0x146')],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0x4c')][_0x2bcc('0x112')](db[_0x2bcc('0x167')],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x17c')});db[_0x2bcc('0x4d')][_0x2bcc('0x100')](db[_0x2bcc('0x4e')],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x2bcc('0x112')](db['SmsAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x17b')});db[_0x2bcc('0x4d')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db['SmsInteraction']['belongsTo'](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x166'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x4d')][_0x2bcc('0x116')](db['Tag'],{'through':_0x2bcc('0x17d'),'as':_0x2bcc('0x169')});db[_0x2bcc('0x4d')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':_0x2bcc('0x17d'),'as':_0x2bcc('0x16a')});db[_0x2bcc('0x4d')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':'Users','through':_0x2bcc('0x11e'),'foreignKey':_0x2bcc('0x17e')});db[_0x2bcc('0x4e')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':'User'});db[_0x2bcc('0x4e')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x156')});db[_0x2bcc('0x4e')][_0x2bcc('0x112')](db[_0x2bcc('0x4d')],{'onDelete':'cascade','as':_0x2bcc('0x16d'),'foreignKey':_0x2bcc('0x17e')});db[_0x2bcc('0x4e')][_0x2bcc('0x112')](db['SmsAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x17b')});db[_0x2bcc('0x4f')]['belongsToMany'](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x128'),'foreignKey':_0x2bcc('0x17f')});db[_0x2bcc('0x4f')][_0x2bcc('0x116')](db['Team'],{'through':_0x2bcc('0x180'),'as':_0x2bcc('0x14c')});db[_0x2bcc('0x51')][_0x2bcc('0x100')](db[_0x2bcc('0x15c')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x51')][_0x2bcc('0x100')](db[_0x2bcc('0x71')],{'as':_0x2bcc('0x173'),'foreignKey':_0x2bcc('0x181')});db['OpenchannelAccount'][_0x2bcc('0x100')](db['OpenchannelInteraction'],{'as':_0x2bcc('0x15e'),'foreignKey':_0x2bcc('0x181')});db[_0x2bcc('0x51')][_0x2bcc('0x100')](db[_0x2bcc('0x56')],{'as':'Messages','foreignKey':_0x2bcc('0x181')});db[_0x2bcc('0x51')]['hasMany'](db[_0x2bcc('0x182')],{'as':'Applications','foreignKey':_0x2bcc('0x181'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x51')][_0x2bcc('0x112')](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':'ListId'});db[_0x2bcc('0x51')][_0x2bcc('0x112')](db[_0x2bcc('0x75')],{'as':_0x2bcc('0x148'),'foreignKey':_0x2bcc('0x149')});db['OpenchannelAccount']['belongsToMany'](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x182')][_0x2bcc('0x112')](db[_0x2bcc('0x58')],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x183')});db[_0x2bcc('0x182')][_0x2bcc('0x112')](db['OpenchannelAccount'],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x181')});db[_0x2bcc('0x182')][_0x2bcc('0x112')](db[_0x2bcc('0x146')],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0x182')][_0x2bcc('0x112')](db['Tag'],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x17c')});db['OpenchannelInteraction']['hasMany'](db[_0x2bcc('0x56')],{'as':'Messages','onDelete':_0x2bcc('0xfd'),'foreignKey':'OpenchannelInteractionId'});db[_0x2bcc('0x54')][_0x2bcc('0x112')](db['OpenchannelAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x181')});db[_0x2bcc('0x54')]['belongsTo'](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':'ContactId'});db[_0x2bcc('0x54')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x166'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x54')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':_0x2bcc('0x184'),'as':_0x2bcc('0x169')});db[_0x2bcc('0x54')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':_0x2bcc('0x184'),'as':_0x2bcc('0x16a')});db['OpenchannelInteraction']['belongsToMany'](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x16b'),'through':_0x2bcc('0x11f'),'foreignKey':_0x2bcc('0x185')});db[_0x2bcc('0x56')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x10')});db['OpenchannelMessage'][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x156')});db['OpenchannelMessage'][_0x2bcc('0x112')](db[_0x2bcc('0x54')],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x16d'),'foreignKey':'OpenchannelInteractionId'});db[_0x2bcc('0x56')][_0x2bcc('0x112')](db['Attachment'],{'as':_0x2bcc('0xdc'),'foreignKey':'AttachmentId'});db[_0x2bcc('0x56')][_0x2bcc('0x112')](db[_0x2bcc('0x51')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x181')});db[_0x2bcc('0x58')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x2bcc('0x183')});db[_0x2bcc('0x58')][_0x2bcc('0x116')](db[_0x2bcc('0x119')],{'through':'team_has_openchannel_queues','as':_0x2bcc('0x14c')});db[_0x2bcc('0x5a')][_0x2bcc('0x100')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x2bcc('0x16e'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x5a')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x2bcc('0x16e')});db[_0x2bcc('0x5a')][_0x2bcc('0x100')](db[_0x2bcc('0x186')],{'as':_0x2bcc('0x187')});db['ChatWebsite']['hasMany'](db[_0x2bcc('0x5e')],{'as':_0x2bcc('0x15e')});db[_0x2bcc('0x5a')]['hasMany'](db['ChatApplication'],{'as':'Applications','foreignKey':_0x2bcc('0x16e'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x5a')][_0x2bcc('0x100')](db['ChatMessage'],{'as':'Messages'});db[_0x2bcc('0x5a')][_0x2bcc('0x112')](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':'ListId'});db[_0x2bcc('0x5a')]['belongsTo'](db['Interval'],{'as':_0x2bcc('0x146'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0x5a')][_0x2bcc('0x112')](db[_0x2bcc('0x130')],{'as':_0x2bcc('0x130'),'foreignKey':_0x2bcc('0x15a')});db[_0x2bcc('0x5a')][_0x2bcc('0x112')](db['Pause'],{'as':_0x2bcc('0x148'),'foreignKey':_0x2bcc('0x149')});db[_0x2bcc('0x5a')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x2bcc('0x112')](db['OpenchannelAccount'],{});db[_0x2bcc('0x188')][_0x2bcc('0x112')](db['CmList'],{'as':'List','foreignKey':_0x2bcc('0x160')});db['OpenchannelQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x188')][_0x2bcc('0x112')](db[_0x2bcc('0x54')],{});db[_0x2bcc('0x188')][_0x2bcc('0x112')](db[_0x2bcc('0x56')],{});db['OpenchannelQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{});db[_0x2bcc('0x188')][_0x2bcc('0x112')](db[_0x2bcc('0x58')],{});db[_0x2bcc('0x5d')][_0x2bcc('0x112')](db['User'],{'as':_0x2bcc('0x189'),'foreignKey':_0x2bcc('0xfe'),'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x5d')][_0x2bcc('0x112')](db[_0x2bcc('0x18a')],{'as':_0x2bcc('0x18b'),'foreignKey':_0x2bcc('0x18c'),'onDelete':'restrict'});db[_0x2bcc('0x5d')][_0x2bcc('0x112')](db['ChatWebsite'],{'as':_0x2bcc('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x5d')]['belongsTo'](db[_0x2bcc('0x167')],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x17c')});db['ChatInteraction'][_0x2bcc('0x100')](db[_0x2bcc('0x60')],{'as':'Messages','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x18e')});db[_0x2bcc('0x5e')][_0x2bcc('0x112')](db[_0x2bcc('0x5a')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x16e')});db['ChatInteraction'][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x5e')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x166'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x5e')][_0x2bcc('0x116')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x2bcc('0x169')});db['ChatInteraction']['belongsToMany'](db[_0x2bcc('0x167')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0x2bcc('0x5e')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x16b'),'through':_0x2bcc('0x11c'),'foreignKey':_0x2bcc('0x18e')});db[_0x2bcc('0x60')][_0x2bcc('0x112')](db['User'],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x10')});db['ChatMessage'][_0x2bcc('0x112')](db['CmContact'],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db['ChatMessage'][_0x2bcc('0x112')](db['ChatInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x2bcc('0x18e')});db[_0x2bcc('0x60')][_0x2bcc('0x112')](db[_0x2bcc('0xdc')],{'as':_0x2bcc('0xdc'),'foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0x2bcc('0x5a')],{'as':_0x2bcc('0x165'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x2bcc('0x100')](db['Attachment'],{'as':_0x2bcc('0x16c'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0x2bcc('0x16f')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x16f')][_0x2bcc('0x112')](db['ChatWebsite'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x16e')});db['ChatQueue'][_0x2bcc('0x116')](db['User'],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x2b'),'hooks':!![]});db[_0x2bcc('0x18a')][_0x2bcc('0x116')](db[_0x2bcc('0x119')],{'through':_0x2bcc('0x18f'),'as':_0x2bcc('0x14c')});db[_0x2bcc('0x63')]['hasMany'](db[_0x2bcc('0xc1')],{'as':_0x2bcc('0x14e'),'foreignKey':_0x2bcc('0x190'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x63')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':'Members','through':_0x2bcc('0x115')});db[_0x2bcc('0x186')][_0x2bcc('0x112')](db[_0x2bcc('0x5a')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x2bcc('0x191')][_0x2bcc('0x100')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x192'),'foreignKey':'CompanyId'});db['CmContact'][_0x2bcc('0x100')](db[_0x2bcc('0x7a')],{'as':_0x2bcc('0x193'),'foreignKey':'CmContactId'});db['CmContact']['hasMany'](db[_0x2bcc('0x110')],{'as':_0x2bcc('0x111'),'foreignKey':_0x2bcc('0x157')});db['CmContact'][_0x2bcc('0x100')](db[_0x2bcc('0x68')],{'as':'HopperFinals','foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x65')][_0x2bcc('0x100')](db[_0x2bcc('0x69')],{'as':_0x2bcc('0x13d'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x65')]['hasMany'](db[_0x2bcc('0x6b')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db['CmContact'][_0x2bcc('0x100')](db[_0x2bcc('0x140')],{'as':'JscriptySessions','foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0x65')][_0x2bcc('0x100')](db[_0x2bcc('0x54')],{'as':_0x2bcc('0x107'),'foreignKey':'ContactId','onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x65')]['hasMany'](db[_0x2bcc('0x5e')],{'as':_0x2bcc('0x108'),'foreignKey':_0x2bcc('0x157'),'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x65')][_0x2bcc('0x100')](db[_0x2bcc('0x4d')],{'as':_0x2bcc('0x194'),'foreignKey':'ContactId','onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x65')][_0x2bcc('0x100')](db['FaxInteraction'],{'as':_0x2bcc('0x109'),'foreignKey':'ContactId','onDelete':_0x2bcc('0x159')});db['CmContact'][_0x2bcc('0x100')](db[_0x2bcc('0x10a')],{'as':'MailInteractions','foreignKey':_0x2bcc('0x157'),'onDelete':_0x2bcc('0x159')});db['CmContact'][_0x2bcc('0x112')](db[_0x2bcc('0x191')],{'as':_0x2bcc('0x195'),'foreignKey':_0x2bcc('0x196')});db[_0x2bcc('0x65')][_0x2bcc('0x112')](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160'),'onDelete':_0x2bcc('0xfd')});db['CmContact'][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x16b'),'through':_0x2bcc('0x197')});db[_0x2bcc('0x65')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'as':_0x2bcc('0x169'),'through':_0x2bcc('0x198')});db['CmContact'][_0x2bcc('0x116')](db['Tag'],{'through':_0x2bcc('0x198'),'as':_0x2bcc('0x16a')});db[_0x2bcc('0x110')][_0x2bcc('0x100')](db['CmHopperAdditionalPhone'],{'as':_0x2bcc('0x199'),'foreignKey':_0x2bcc('0x19a')});db[_0x2bcc('0x110')][_0x2bcc('0x112')](db['CmContact'],{'as':_0x2bcc('0x156'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x2bcc('0x110')]['belongsTo'](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160'),'onDelete':_0x2bcc('0xfd')});db['CmHopper'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x189'),'foreignKey':_0x2bcc('0xfe')});db[_0x2bcc('0x110')][_0x2bcc('0x112')](db[_0x2bcc('0x19')],{'as':_0x2bcc('0x18b'),'foreignKey':_0x2bcc('0x13c'),'onDelete':_0x2bcc('0xfd')});db['CmHopper']['belongsTo'](db['Campaign'],{'as':_0x2bcc('0xd8'),'foreignKey':'CampaignId','onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x110')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x166'),'foreignKey':_0x2bcc('0x19b')});db[_0x2bcc('0x13e')][_0x2bcc('0x112')](db['CmContact'],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157'),'onDelete':_0x2bcc('0xfd')});db['CmHopperBlack']['belongsTo'](db['CmList'],{'as':_0x2bcc('0x15f'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x2bcc('0x13e')][_0x2bcc('0x112')](db[_0x2bcc('0x19')],{'as':_0x2bcc('0x18b'),'foreignKey':_0x2bcc('0x13c'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x13e')]['belongsTo'](db[_0x2bcc('0xd8')],{'as':_0x2bcc('0xd8'),'foreignKey':'CampaignId','onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x6f')][_0x2bcc('0x100')](db[_0x2bcc('0x19c')],{'as':{'plural':_0x2bcc('0x19d'),'singular':_0x2bcc('0x19e')},'foreignKey':_0x2bcc('0x19f'),'onDelete':_0x2bcc('0xfd'),'hooks':!![]});db[_0x2bcc('0x6f')][_0x2bcc('0x100')](db['Condition'],{'as':{'plural':_0x2bcc('0x1a0'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x2bcc('0xfd'),'hooks':!![]});db[_0x2bcc('0x6f')][_0x2bcc('0x100')](db[_0x2bcc('0x1a1')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x2bcc('0xfd'),'hooks':!![]});db[_0x2bcc('0x15c')][_0x2bcc('0x100')](db[_0x2bcc('0x15c')],{'as':_0x2bcc('0x15d'),'foreignKey':_0x2bcc('0x1a2'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x146')]['hasMany'](db[_0x2bcc('0x146')],{'as':'Intervals','foreignKey':_0x2bcc('0x147'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x2bcc('0x146')][_0x2bcc('0x100')](db['VoiceExtension'],{'as':_0x2bcc('0x104'),'foreignKey':_0x2bcc('0x147'),'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x146')][_0x2bcc('0x100')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0x146')]['hasMany'](db[_0x2bcc('0x5d')],{'as':_0x2bcc('0x1a3'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0x146')][_0x2bcc('0x100')](db[_0x2bcc('0x174')],{'as':_0x2bcc('0x1a4'),'foreignKey':_0x2bcc('0x147')});db['Interval']['hasMany'](db[_0x2bcc('0x4c')],{'as':_0x2bcc('0x1a5'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0x1a6')]['belongsTo'](db[_0x2bcc('0x130')],{});db[_0x2bcc('0x1a6')][_0x2bcc('0x112')](db[_0x2bcc('0x1a7')],{'foreignKey':_0x2bcc('0x1a8')});db[_0x2bcc('0x1a6')]['belongsTo'](db[_0x2bcc('0x86')],{'foreignKey':_0x2bcc('0x1a9')});db['Sound']['belongsToMany'](db[_0x2bcc('0x17')],{'as':'Mohs','through':_0x2bcc('0x13a'),'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0x167')][_0x2bcc('0x116')](db[_0x2bcc('0x65')],{'through':'cm_contact_has_tags'});db[_0x2bcc('0x167')]['belongsToMany'](db[_0x2bcc('0x5e')],{'through':_0x2bcc('0x1aa')});db[_0x2bcc('0x167')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x2bcc('0x167')][_0x2bcc('0x116')](db['SmsInteraction'],{'through':_0x2bcc('0x17d')});db[_0x2bcc('0x167')][_0x2bcc('0x116')](db[_0x2bcc('0x44')],{'through':_0x2bcc('0x178')});db[_0x2bcc('0x167')][_0x2bcc('0x116')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x2bcc('0x116')](db[_0x2bcc('0xf1')],{'through':_0x2bcc('0x1ab')});db[_0x2bcc('0x7a')][_0x2bcc('0x112')](db[_0x2bcc('0x79')],{'as':_0x2bcc('0x1ac'),'foreignKey':_0x2bcc('0x1ad')});db[_0x2bcc('0x7c')][_0x2bcc('0x112')](db['CmHopper'],{'as':_0x2bcc('0x1ae'),'foreignKey':_0x2bcc('0x19a')});db[_0x2bcc('0x7a')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x1af')});db[_0x2bcc('0x80')][_0x2bcc('0x100')](db[_0x2bcc('0x19c')],{'as':{'plural':_0x2bcc('0x1b0'),'singular':'AllCondition'},'foreignKey':_0x2bcc('0x1b1'),'onDelete':'cascade','hooks':!![]});db[_0x2bcc('0x80')][_0x2bcc('0x100')](db[_0x2bcc('0x19c')],{'as':{'plural':'AnyConditions','singular':_0x2bcc('0x1b2')},'foreignKey':_0x2bcc('0x1b3'),'onDelete':_0x2bcc('0xfd'),'hooks':!![]});db['Trigger'][_0x2bcc('0x100')](db[_0x2bcc('0x1a1')],{'as':_0x2bcc('0x1b4'),'foreignKey':'TriggerId','onDelete':_0x2bcc('0xfd'),'hooks':!![]});db[_0x2bcc('0x86')][_0x2bcc('0x100')](db[_0x2bcc('0x8c')],{'as':_0x2bcc('0x1b5'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x2bcc('0x1a7')][_0x2bcc('0x100')](db[_0x2bcc('0x8c')],{'as':_0x2bcc('0x1b5'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1a8')});db[_0x2bcc('0x8a')][_0x2bcc('0x100')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b6')});db[_0x2bcc('0x8c')][_0x2bcc('0x112')](db['AnalyticMetric'],{'foreignKey':_0x2bcc('0x1b6')});db[_0x2bcc('0x1b7')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x2bcc('0x1b8'),'onDelete':'cascade','foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0x8f')][_0x2bcc('0x100')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x2bcc('0xfd'),'foreignKey':'SubjectId'});db[_0x2bcc('0x8f')]['hasMany'](db[_0x2bcc('0x1ba')],{'as':_0x2bcc('0x1bb'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bc')});db[_0x2bcc('0x8f')][_0x2bcc('0x100')](db[_0x2bcc('0x1ba')],{'as':'Fields','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x8f')][_0x2bcc('0x112')](db[_0x2bcc('0x1b7')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0x1ba')][_0x2bcc('0x100')](db[_0x2bcc('0x1ba')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db['SalesforceField'][_0x2bcc('0x100')](db[_0x2bcc('0x1ba')],{'as':'Description','foreignKey':_0x2bcc('0x1bc')});db['SalesforceField'][_0x2bcc('0x100')](db['SalesforceField'],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x1ba')][_0x2bcc('0x112')](db['Variable'],{'as':_0x2bcc('0x81'),'foreignKey':_0x2bcc('0x1c1')});db['SugarcrmAccount'][_0x2bcc('0x100')](db[_0x2bcc('0x94')],{'as':_0x2bcc('0x1b8'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0x94')][_0x2bcc('0x100')](db[_0x2bcc('0x96')],{'as':_0x2bcc('0x1c2'),'onDelete':_0x2bcc('0xfd'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x2bcc('0x100')](db[_0x2bcc('0x96')],{'as':'Descriptions','onDelete':_0x2bcc('0xfd'),'foreignKey':'DescriptionId'});db[_0x2bcc('0x94')][_0x2bcc('0x100')](db[_0x2bcc('0x96')],{'as':_0x2bcc('0x1b5'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x94')][_0x2bcc('0x112')](db[_0x2bcc('0x92')],{'as':_0x2bcc('0x165'),'foreignKey':'AccountId'});db[_0x2bcc('0x96')]['hasMany'](db[_0x2bcc('0x96')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0x96')][_0x2bcc('0x100')](db[_0x2bcc('0x96')],{'as':_0x2bcc('0x1c3'),'foreignKey':'DescriptionId'});db[_0x2bcc('0x96')]['hasMany'](db[_0x2bcc('0x96')],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x96')][_0x2bcc('0x112')](db['Variable'],{'as':_0x2bcc('0x81'),'foreignKey':_0x2bcc('0x1c1')});db[_0x2bcc('0x98')][_0x2bcc('0x100')](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x2bcc('0x9a')]['hasMany'](db[_0x2bcc('0x1c4')],{'as':_0x2bcc('0x1c2'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0x9a')][_0x2bcc('0x100')](db[_0x2bcc('0x1c4')],{'as':'Descriptions','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bc')});db['DeskConfiguration'][_0x2bcc('0x100')](db[_0x2bcc('0x1c4')],{'as':_0x2bcc('0x1b5'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x9a')]['belongsTo'](db['DeskAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0x9a')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':'int_desk_configuration_has_tags'});db[_0x2bcc('0x1c4')][_0x2bcc('0x100')](db[_0x2bcc('0x1c4')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db['DeskField']['hasMany'](db[_0x2bcc('0x1c4')],{'as':_0x2bcc('0x1c3'),'foreignKey':'DescriptionId'});db['DeskField'][_0x2bcc('0x100')](db[_0x2bcc('0x1c4')],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db['DeskField'][_0x2bcc('0x112')](db[_0x2bcc('0x81')],{'as':'Variable','foreignKey':_0x2bcc('0x1c1')});db[_0x2bcc('0x1c5')]['hasMany'](db[_0x2bcc('0x1c6')],{'as':_0x2bcc('0x1b8'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0x1c6')][_0x2bcc('0x100')](db[_0x2bcc('0x9f')],{'as':_0x2bcc('0x1c2'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0x1c6')]['hasMany'](db[_0x2bcc('0x9f')],{'as':_0x2bcc('0x1bb'),'onDelete':_0x2bcc('0xfd'),'foreignKey':'DescriptionId'});db[_0x2bcc('0x1c6')]['hasMany'](db[_0x2bcc('0x9f')],{'as':'Fields','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x1c6')][_0x2bcc('0x112')](db[_0x2bcc('0x1c5')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0x9f')][_0x2bcc('0x100')](db[_0x2bcc('0x9f')],{'as':_0x2bcc('0x1be'),'foreignKey':'SubjectId'});db[_0x2bcc('0x9f')][_0x2bcc('0x100')](db[_0x2bcc('0x9f')],{'as':'Description','foreignKey':_0x2bcc('0x1bc')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x9f')][_0x2bcc('0x112')](db[_0x2bcc('0x81')],{'as':'Variable','foreignKey':_0x2bcc('0x1c1')});db['ZendeskAccount'][_0x2bcc('0x100')](db[_0x2bcc('0x1c7')],{'as':_0x2bcc('0x1b8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2bcc('0x1c7')][_0x2bcc('0x100')](db[_0x2bcc('0xa2')],{'as':_0x2bcc('0x1c2'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0x1c7')][_0x2bcc('0x100')](db[_0x2bcc('0xa2')],{'as':_0x2bcc('0x1bb'),'foreignKey':'DescriptionId'});db[_0x2bcc('0x1c7')][_0x2bcc('0x100')](db[_0x2bcc('0xa2')],{'as':_0x2bcc('0x1b5'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0x1c7')][_0x2bcc('0x112')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0x1c7')][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':'int_zendesk_configuration_has_tags'});db[_0x2bcc('0xa2')]['hasMany'](db[_0x2bcc('0xa2')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xa2')]['hasMany'](db[_0x2bcc('0xa2')],{'as':_0x2bcc('0x1c3'),'foreignKey':_0x2bcc('0x1bc')});db['ZendeskField'][_0x2bcc('0x100')](db[_0x2bcc('0xa2')],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xa2')][_0x2bcc('0x112')](db[_0x2bcc('0x81')],{'as':'Variable','foreignKey':_0x2bcc('0x1c1')});db[_0x2bcc('0xa3')][_0x2bcc('0x100')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b9')});db['FreshdeskConfiguration'][_0x2bcc('0x100')](db[_0x2bcc('0xa7')],{'as':'Subjects','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xa5')][_0x2bcc('0x100')](db[_0x2bcc('0xa7')],{'as':_0x2bcc('0x1bb'),'onDelete':_0x2bcc('0xfd'),'foreignKey':'DescriptionId'});db[_0x2bcc('0xa5')][_0x2bcc('0x100')](db['FreshdeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xa5')][_0x2bcc('0x112')](db['FreshdeskAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0xa5')]['belongsToMany'](db['Tag'],{'through':_0x2bcc('0x1c8')});db['FreshdeskField'][_0x2bcc('0x100')](db['FreshdeskField'],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xa7')][_0x2bcc('0x100')](db[_0x2bcc('0xa7')],{'as':'Description','foreignKey':_0x2bcc('0x1bc')});db[_0x2bcc('0xa7')][_0x2bcc('0x100')](db[_0x2bcc('0xa7')],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xa7')][_0x2bcc('0x112')](db['Variable'],{'as':_0x2bcc('0x81'),'foreignKey':_0x2bcc('0x1c1')});db[_0x2bcc('0x1c9')]['hasMany'](db[_0x2bcc('0xaa')],{'as':_0x2bcc('0x1b8'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0xaa')]['hasMany'](db[_0x2bcc('0xac')],{'as':_0x2bcc('0x1c2'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xaa')]['hasMany'](db['VtigerField'],{'as':_0x2bcc('0x1bb'),'foreignKey':_0x2bcc('0x1bc')});db[_0x2bcc('0xaa')][_0x2bcc('0x100')](db[_0x2bcc('0xac')],{'as':_0x2bcc('0x1b5'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xaa')]['belongsTo'](db[_0x2bcc('0x1c9')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1b9')});db['VtigerField']['hasMany'](db[_0x2bcc('0xac')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xac')][_0x2bcc('0x100')](db[_0x2bcc('0xac')],{'as':_0x2bcc('0x1c3'),'foreignKey':'DescriptionId'});db[_0x2bcc('0xac')][_0x2bcc('0x100')](db[_0x2bcc('0xac')],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xac')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x2bcc('0xae')]['hasMany'](db[_0x2bcc('0xb0')],{'as':_0x2bcc('0x1b8'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0xb0')][_0x2bcc('0x100')](db[_0x2bcc('0xb2')],{'as':_0x2bcc('0x1c2'),'foreignKey':_0x2bcc('0x1bf')});db['ServicenowConfiguration'][_0x2bcc('0x100')](db[_0x2bcc('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x2bcc('0xb0')][_0x2bcc('0x100')](db['ServicenowField'],{'as':_0x2bcc('0x1b5'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xb0')][_0x2bcc('0x112')](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x2bcc('0xb2')][_0x2bcc('0x100')](db[_0x2bcc('0xb2')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xb2')][_0x2bcc('0x100')](db[_0x2bcc('0xb2')],{'as':_0x2bcc('0x1c3'),'foreignKey':_0x2bcc('0x1bc')});db[_0x2bcc('0xb2')][_0x2bcc('0x100')](db['ServicenowField'],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db['ServicenowField']['belongsTo'](db['Variable'],{'as':_0x2bcc('0x81'),'foreignKey':_0x2bcc('0x1c1')});db[_0x2bcc('0xb4')][_0x2bcc('0x100')](db[_0x2bcc('0xb6')],{'as':'Configurations','onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0xb4')][_0x2bcc('0x112')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x2bcc('0x158')});db[_0x2bcc('0xb6')]['hasMany'](db[_0x2bcc('0xb7')],{'as':_0x2bcc('0x1c2'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xb6')][_0x2bcc('0x100')](db[_0x2bcc('0xb7')],{'as':_0x2bcc('0x1bb'),'onDelete':_0x2bcc('0xfd'),'foreignKey':'DescriptionId'});db[_0x2bcc('0xb6')][_0x2bcc('0x100')](db[_0x2bcc('0xb7')],{'as':_0x2bcc('0x1b5'),'onDelete':'cascade','foreignKey':_0x2bcc('0x1bd')});db['Dynamics365Configuration']['belongsTo'](db[_0x2bcc('0xb4')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0xb7')][_0x2bcc('0x100')](db[_0x2bcc('0xb7')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xb7')]['hasMany'](db[_0x2bcc('0xb7')],{'as':_0x2bcc('0x1c3'),'foreignKey':'DescriptionId'});db[_0x2bcc('0xb7')][_0x2bcc('0x100')](db[_0x2bcc('0xb7')],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xb7')][_0x2bcc('0x112')](db['Variable'],{'as':_0x2bcc('0x81'),'foreignKey':_0x2bcc('0x1c1')});db[_0x2bcc('0x1ca')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x2bcc('0x1b8'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0xba')]['hasMany'](db[_0x2bcc('0xbb')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x2bcc('0xba')][_0x2bcc('0x100')](db['FreshsalesField'],{'as':_0x2bcc('0x1bb'),'foreignKey':_0x2bcc('0x1bc')});db[_0x2bcc('0xba')]['hasMany'](db['FreshsalesField'],{'as':_0x2bcc('0x1b5'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xba')]['belongsTo'](db['FreshsalesAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1b9')});db[_0x2bcc('0xbb')][_0x2bcc('0x100')](db[_0x2bcc('0xbb')],{'as':_0x2bcc('0x1be'),'foreignKey':_0x2bcc('0x1bf')});db[_0x2bcc('0xbb')][_0x2bcc('0x100')](db[_0x2bcc('0xbb')],{'as':_0x2bcc('0x1c3'),'foreignKey':_0x2bcc('0x1bc')});db[_0x2bcc('0xbb')][_0x2bcc('0x100')](db['FreshsalesField'],{'as':_0x2bcc('0x1c0'),'foreignKey':_0x2bcc('0x1bd')});db[_0x2bcc('0xbb')][_0x2bcc('0x112')](db[_0x2bcc('0x81')],{'as':_0x2bcc('0x81'),'foreignKey':_0x2bcc('0x1c1')});db[_0x2bcc('0x1cb')]['belongsTo'](db['ChatWebsite'],{});db[_0x2bcc('0x1cb')][_0x2bcc('0x112')](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0x1cb')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db['ChatQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x5e')],{});db[_0x2bcc('0x1cb')]['belongsTo'](db[_0x2bcc('0x60')],{});db['ChatQueueReport'][_0x2bcc('0x112')](db['User'],{});db[_0x2bcc('0x1cb')][_0x2bcc('0x112')](db[_0x2bcc('0x18a')],{});db[_0x2bcc('0xc1')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1cc')});db['ChatInternalMessage'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0xfd'),'foreignKey':'ToId'});db[_0x2bcc('0x140')][_0x2bcc('0x100')](db['JscriptyQuestionReport'],{'foreignKey':_0x2bcc('0x1cd'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0x140')][_0x2bcc('0x100')](db[_0x2bcc('0x1ce')],{'foreignKey':_0x2bcc('0x1cd'),'onDelete':_0x2bcc('0xfd')});db['SmsQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x4b')],{});db[_0x2bcc('0xc7')]['belongsTo'](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0xc7')][_0x2bcc('0x112')](db['CmContact'],{'as':_0x2bcc('0x156'),'foreignKey':'ContactId'});db[_0x2bcc('0xc7')]['belongsTo'](db[_0x2bcc('0x4d')],{});db['SmsQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x4e')],{});db['SmsQueueReport'][_0x2bcc('0x112')](db['User'],{});db['SmsQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x4f')],{});db[_0x2bcc('0x1cf')][_0x2bcc('0x100')](db[_0x2bcc('0x140')],{'foreignKey':'ProjectId'});db[_0x2bcc('0x1cf')][_0x2bcc('0x100')](db[_0x2bcc('0xc4')],{'foreignKey':_0x2bcc('0x1d0')});db[_0x2bcc('0x1cf')][_0x2bcc('0x100')](db['JscriptyAnswerReport'],{'foreignKey':_0x2bcc('0x1d0')});db['Team'][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':'user_has_teams'});db[_0x2bcc('0x119')][_0x2bcc('0x116')](db[_0x2bcc('0x19')],{'through':_0x2bcc('0xf7'),'as':'VoiceQueues'});db[_0x2bcc('0x119')][_0x2bcc('0x116')](db[_0x2bcc('0x162')],{'through':'team_has_mail_queues','as':_0x2bcc('0x124')});db[_0x2bcc('0x119')][_0x2bcc('0x116')](db[_0x2bcc('0x18a')],{'through':_0x2bcc('0x18f'),'as':_0x2bcc('0x126')});db[_0x2bcc('0x119')][_0x2bcc('0x116')](db['FaxQueue'],{'through':_0x2bcc('0x17a'),'as':_0x2bcc('0x1d1')});db[_0x2bcc('0x119')][_0x2bcc('0x116')](db['SmsQueue'],{'through':_0x2bcc('0x180'),'as':'SmsQueues'});db[_0x2bcc('0x119')][_0x2bcc('0x116')](db[_0x2bcc('0x58')],{'through':_0x2bcc('0x1d2'),'as':_0x2bcc('0x129')});db['Team'][_0x2bcc('0x116')](db[_0x2bcc('0xf4')],{'through':_0x2bcc('0x1d3'),'as':_0x2bcc('0x12a')});db[_0x2bcc('0x119')]['belongsToMany'](db[_0x2bcc('0xe8')],{'through':_0x2bcc('0x1d4'),'as':_0x2bcc('0x123')});db[_0x2bcc('0xd8')]['hasMany'](db[_0x2bcc('0x110')],{'as':_0x2bcc('0x111'),'foreignKey':_0x2bcc('0x1d5')});db[_0x2bcc('0xd8')][_0x2bcc('0x100')](db[_0x2bcc('0x68')],{'as':_0x2bcc('0x105'),'foreignKey':_0x2bcc('0x1d5')});db[_0x2bcc('0xd8')][_0x2bcc('0x100')](db[_0x2bcc('0x69')],{'as':_0x2bcc('0x13d'),'foreignKey':_0x2bcc('0x1d5')});db[_0x2bcc('0xd8')][_0x2bcc('0x100')](db[_0x2bcc('0x13e')],{'as':_0x2bcc('0x13f'),'foreignKey':_0x2bcc('0x1d5')});db['Campaign'][_0x2bcc('0x112')](db[_0x2bcc('0x142')],{'as':_0x2bcc('0x142'),'foreignKey':'TrunkId'});db[_0x2bcc('0xd8')][_0x2bcc('0x112')](db[_0x2bcc('0x142')],{'as':_0x2bcc('0x144'),'foreignKey':_0x2bcc('0x145')});db['Campaign']['belongsTo'](db['Interval'],{'as':_0x2bcc('0x146'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0xd8')][_0x2bcc('0x112')](db['SquareProject'],{'as':_0x2bcc('0xd0'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x2bcc('0x116')](db[_0x2bcc('0x12b')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x2bcc('0xd8')][_0x2bcc('0x116')](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x2bcc('0xdc')][_0x2bcc('0x112')](db[_0x2bcc('0x16f')],{'as':_0x2bcc('0x16f'),'foreignKey':_0x2bcc('0x1d6')});db['MailTransferReport']['belongsTo'](db[_0x2bcc('0x3a')],{});db[_0x2bcc('0xde')][_0x2bcc('0x112')](db['MailInteraction'],{});db[_0x2bcc('0xde')][_0x2bcc('0x112')](db[_0x2bcc('0x130')],{'foreignKey':_0x2bcc('0x1d7'),'as':_0x2bcc('0x1d8')});db[_0x2bcc('0xde')]['belongsTo'](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1d9'),'as':_0x2bcc('0x1da')});db[_0x2bcc('0xde')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1db'),'as':'ToAgent'});db[_0x2bcc('0xde')][_0x2bcc('0x112')](db[_0x2bcc('0x162')],{'foreignKey':_0x2bcc('0x1dc'),'as':_0x2bcc('0x1dd')});db['MailTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0x130')],{'foreignKey':_0x2bcc('0x1de'),'as':_0x2bcc('0x1df')});db['ChatTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0x60')],{});db['ChatTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0x5e')],{});db[_0x2bcc('0xe0')][_0x2bcc('0x112')](db[_0x2bcc('0x5a')],{'foreignKey':_0x2bcc('0x1e0'),'as':'FromAccount'});db['ChatTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1d9'),'as':_0x2bcc('0x1da')});db[_0x2bcc('0xe0')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['ChatTransferReport']['belongsTo'](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x2bcc('0x1dd')});db['ChatTransferReport']['belongsTo'](db[_0x2bcc('0x5a')],{'foreignKey':_0x2bcc('0x1e1'),'as':_0x2bcc('0x1df')});db['FaxTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0x176')],{});db[_0x2bcc('0xe2')]['belongsTo'](db[_0x2bcc('0x44')],{});db[_0x2bcc('0xe2')][_0x2bcc('0x112')](db[_0x2bcc('0x42')],{'foreignKey':'FromFaxAccountId','as':_0x2bcc('0x1d8')});db[_0x2bcc('0xe2')][_0x2bcc('0x112')](db['User'],{'foreignKey':_0x2bcc('0x1d9'),'as':_0x2bcc('0x1da')});db['FaxTransferReport']['belongsTo'](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1db'),'as':_0x2bcc('0x1e2')});db['FaxTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0x47')],{'foreignKey':'ToFaxQueueId','as':_0x2bcc('0x1dd')});db[_0x2bcc('0xe2')][_0x2bcc('0x112')](db['FaxAccount'],{'foreignKey':_0x2bcc('0x1e3'),'as':_0x2bcc('0x1df')});db[_0x2bcc('0xe4')][_0x2bcc('0x112')](db[_0x2bcc('0x56')],{});db[_0x2bcc('0xe4')][_0x2bcc('0x112')](db[_0x2bcc('0x54')],{});db[_0x2bcc('0xe4')][_0x2bcc('0x112')](db[_0x2bcc('0x51')],{'foreignKey':_0x2bcc('0x1e4'),'as':'FromAccount'});db[_0x2bcc('0xe4')][_0x2bcc('0x112')](db['User'],{'foreignKey':_0x2bcc('0x1d9'),'as':'FromAgent'});db[_0x2bcc('0xe4')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1db'),'as':_0x2bcc('0x1e2')});db['OpenchannelTransferReport'][_0x2bcc('0x112')](db['OpenchannelQueue'],{'foreignKey':_0x2bcc('0x1e5'),'as':_0x2bcc('0x1dd')});db[_0x2bcc('0xe4')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x2bcc('0x1df')});db[_0x2bcc('0xe5')][_0x2bcc('0x112')](db[_0x2bcc('0x4e')],{});db[_0x2bcc('0xe5')][_0x2bcc('0x112')](db[_0x2bcc('0x4d')],{});db['SmsTransferReport'][_0x2bcc('0x112')](db['SmsAccount'],{'foreignKey':_0x2bcc('0x1e6'),'as':_0x2bcc('0x1d8')});db[_0x2bcc('0xe5')]['belongsTo'](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1d9'),'as':_0x2bcc('0x1da')});db[_0x2bcc('0xe5')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1db'),'as':'ToAgent'});db[_0x2bcc('0xe5')][_0x2bcc('0x112')](db[_0x2bcc('0x4f')],{'foreignKey':_0x2bcc('0x1e7'),'as':_0x2bcc('0x1dd')});db['SmsTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0x4b')],{'foreignKey':_0x2bcc('0x1e8'),'as':_0x2bcc('0x1df')});db[_0x2bcc('0x12b')][_0x2bcc('0x100')](db[_0x2bcc('0x15c')],{'as':_0x2bcc('0x15d'),'foreignKey':'ListId','onDelete':_0x2bcc('0xfd')});db['CmList']['hasMany'](db[_0x2bcc('0x6c')],{'as':'CustomFields','foreignKey':_0x2bcc('0x160')});db['CmList'][_0x2bcc('0x100')](db['CmContact'],{'as':_0x2bcc('0x192'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0x12b')][_0x2bcc('0x100')](db[_0x2bcc('0x68')],{'as':'HopperFinals','foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0x12b')][_0x2bcc('0x100')](db[_0x2bcc('0x69')],{'as':_0x2bcc('0x106'),'foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0x12b')][_0x2bcc('0x100')](db[_0x2bcc('0x6b')],{'as':_0x2bcc('0x6b'),'foreignKey':_0x2bcc('0x160')});db['CmList'][_0x2bcc('0x116')](db['VoiceQueue'],{'as':_0x2bcc('0x1e9'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x118')});db[_0x2bcc('0xe8')]['hasMany'](db[_0x2bcc('0x103')],{'as':'Extensions','onDelete':_0x2bcc('0xfd')});db['VoicePrefix'][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x1ea')});db['VoicePrefix'][_0x2bcc('0x116')](db['Team'],{'through':_0x2bcc('0x1d4'),'as':_0x2bcc('0x14c')});db[_0x2bcc('0xea')][_0x2bcc('0x100')](db['User'],{'as':_0x2bcc('0x16b'),'foreignKey':_0x2bcc('0x113')});db[_0x2bcc('0xea')][_0x2bcc('0x100')](db[_0x2bcc('0xeb')],{'as':_0x2bcc('0x1eb'),'foreignKey':'userProfileId','onDelete':_0x2bcc('0xfd')});db['UserProfileSection'][_0x2bcc('0x100')](db[_0x2bcc('0x1ec')],{'as':'Resources','foreignKey':_0x2bcc('0x1ed'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0xee')][_0x2bcc('0x100')](db[_0x2bcc('0x15c')],{'as':_0x2bcc('0x15d'),'foreignKey':'WhatsappAccountId','onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0xee')]['hasMany'](db[_0x2bcc('0x71')],{'as':'Answers','foreignKey':_0x2bcc('0x1ee')});db[_0x2bcc('0xee')]['hasMany'](db[_0x2bcc('0x1ef')],{'as':_0x2bcc('0x14e'),'foreignKey':_0x2bcc('0x1ee')});db[_0x2bcc('0xee')][_0x2bcc('0x100')](db[_0x2bcc('0xf1')],{'as':_0x2bcc('0x15e')});db[_0x2bcc('0xee')][_0x2bcc('0x100')](db[_0x2bcc('0xef')],{'as':_0x2bcc('0x137'),'foreignKey':_0x2bcc('0x1ee'),'onDelete':_0x2bcc('0xfd')});db[_0x2bcc('0xee')][_0x2bcc('0x112')](db[_0x2bcc('0x12b')],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160')});db[_0x2bcc('0xee')][_0x2bcc('0x112')](db[_0x2bcc('0x75')],{'as':_0x2bcc('0x148'),'foreignKey':_0x2bcc('0x149')});db['WhatsappAccount'][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication']['belongsTo'](db[_0x2bcc('0x10')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0xef')][_0x2bcc('0x112')](db['WhatsappQueue'],{'onDelete':_0x2bcc('0x159')});db['WhatsappApplication'][_0x2bcc('0x112')](db[_0x2bcc('0xee')],{'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0xef')][_0x2bcc('0x112')](db[_0x2bcc('0x146')],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x147')});db[_0x2bcc('0xef')][_0x2bcc('0x112')](db['Tag'],{'onDelete':_0x2bcc('0x159'),'foreignKey':_0x2bcc('0x17c')});db['WhatsappInteraction'][_0x2bcc('0x100')](db['WhatsappMessage'],{'as':_0x2bcc('0x14e'),'onDelete':_0x2bcc('0xfd'),'foreignKey':_0x2bcc('0x1f0')});db[_0x2bcc('0xf1')][_0x2bcc('0x112')](db[_0x2bcc('0xee')],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1ee')});db['WhatsappInteraction'][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0xf1')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x166'),'foreignKey':'UserId'});db[_0x2bcc('0xf1')]['belongsToMany'](db[_0x2bcc('0x167')],{'through':_0x2bcc('0x1ab'),'as':_0x2bcc('0x169')});db['WhatsappInteraction'][_0x2bcc('0x116')](db[_0x2bcc('0x167')],{'through':_0x2bcc('0x1ab'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x2bcc('0x116')](db['User'],{'as':_0x2bcc('0x16b'),'through':_0x2bcc('0x120'),'foreignKey':_0x2bcc('0x1f0')});db['WhatsappMessage'][_0x2bcc('0x112')](db['User'],{'as':'User'});db[_0x2bcc('0x1ef')][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x156')});db[_0x2bcc('0x1ef')][_0x2bcc('0x112')](db['WhatsappInteraction'],{'onDelete':_0x2bcc('0xfd'),'as':_0x2bcc('0x16d'),'foreignKey':'WhatsappInteractionId'});db[_0x2bcc('0x1ef')][_0x2bcc('0x112')](db['WhatsappAccount'],{'as':_0x2bcc('0x165'),'foreignKey':_0x2bcc('0x1ee')});db[_0x2bcc('0xf3')][_0x2bcc('0x112')](db[_0x2bcc('0xee')],{});db[_0x2bcc('0xf3')]['belongsTo'](db['CmList'],{'as':_0x2bcc('0x15f'),'foreignKey':_0x2bcc('0x160')});db['WhatsappQueueReport'][_0x2bcc('0x112')](db[_0x2bcc('0x65')],{'as':_0x2bcc('0x156'),'foreignKey':_0x2bcc('0x157')});db[_0x2bcc('0xf3')]['belongsTo'](db[_0x2bcc('0xf1')],{});db['WhatsappQueueReport'][_0x2bcc('0x112')](db['WhatsappQueue'],{});db[_0x2bcc('0xf3')][_0x2bcc('0x112')](db['WhatsappMessage'],{});db[_0x2bcc('0xf3')][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{});db[_0x2bcc('0x1f1')][_0x2bcc('0x112')](db[_0x2bcc('0x1ef')],{});db[_0x2bcc('0x1f1')][_0x2bcc('0x112')](db[_0x2bcc('0xf1')],{});db['WhatsappTransferReport'][_0x2bcc('0x112')](db[_0x2bcc('0xee')],{'foreignKey':_0x2bcc('0x1f2'),'as':'FromAccount'});db[_0x2bcc('0x1f1')]['belongsTo'](db[_0x2bcc('0xee')],{'foreignKey':_0x2bcc('0x1f3'),'as':_0x2bcc('0x1df')});db[_0x2bcc('0x1f1')][_0x2bcc('0x112')](db['WhatsappQueue'],{'foreignKey':_0x2bcc('0x1f4'),'as':_0x2bcc('0x1dd')});db[_0x2bcc('0x1f1')]['belongsTo'](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1d9'),'as':_0x2bcc('0x1da')});db['WhatsappTransferReport']['belongsTo'](db[_0x2bcc('0x10')],{'foreignKey':_0x2bcc('0x1db'),'as':'ToAgent'});db[_0x2bcc('0xf4')][_0x2bcc('0x116')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x14b'),'through':_0x2bcc('0x32'),'foreignKey':_0x2bcc('0x1f5')});db[_0x2bcc('0xf4')][_0x2bcc('0x116')](db[_0x2bcc('0x119')],{'through':_0x2bcc('0x1d3'),'as':'Teams'});db['UserSetting'][_0x2bcc('0x112')](db[_0x2bcc('0x10')],{'as':_0x2bcc('0x1f6'),'foreignKey':'UserId','onDelete':_0x2bcc('0xfd'),'hooks':!![]});db[_0x2bcc('0xf5')][_0x2bcc('0xfb')](db[_0x2bcc('0xb4')],{'as':_0x2bcc('0xb4'),'onDelete':_0x2bcc('0x159')});db['CloudProvider'][_0x2bcc('0xfb')](db[_0x2bcc('0x33')],{'as':_0x2bcc('0x15b'),'onDelete':_0x2bcc('0x159')});db[_0x2bcc('0xf5')]['hasOne'](db['MailServerOut'],{'as':_0x2bcc('0x1f7'),'onDelete':_0x2bcc('0x159')});module[_0x2bcc('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 24ca5a4..538cfcb 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe855=['./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.8.1','/plugins','route','get','sendFile','resolve','appPath','/index.html','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','/api/users','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages'];(function(_0x21fe44,_0x553d95){var _0x280884=function(_0x1b149f){while(--_0x1b149f){_0x21fe44['push'](_0x21fe44['shift']());}};_0x280884(++_0x553d95);}(_0xe855,0xd2));var _0x5e85=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0xe855[_0x531d15];return _0x271a18;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x5e85('0x0'));var config=require(_0x5e85('0x1'));var setupLoggers=require(_0x5e85('0x2'))[_0x5e85('0x3')];var clientSideLogs=require(_0x5e85('0x4'));exports['default']=function(_0x500cdb){return setupLoggers(_0x500cdb)[_0x5e85('0x5')](function(){_0x500cdb['use'](_0x5e85('0x6'),require('./api/user'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x8'),require(_0x5e85('0x9')));_0x500cdb[_0x5e85('0x7')]('/api/voice/contexts',require(_0x5e85('0xa')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xb'),require(_0x5e85('0xc')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xd'),require('./api/voiceMusicOnHold'));_0x500cdb['use']('/api/voice/queues',require(_0x5e85('0xe')));_0x500cdb['use'](_0x5e85('0xf'),require(_0x5e85('0x10')));_0x500cdb[_0x5e85('0x7')]('/api/screen/recordings',require('./api/screenRecording'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x11'),require(_0x5e85('0x12')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x13'),require('./api/voiceMailMessage'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x14'),require('./api/voiceCallReport'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x15'),require('./api/voiceDialReport'));_0x500cdb['use'](_0x5e85('0x16'),require('./api/voiceAgentReport'));_0x500cdb[_0x5e85('0x7')]('/api/voice/queues/reports',require(_0x5e85('0x17')));_0x500cdb['use'](_0x5e85('0x18'),require(_0x5e85('0x19')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x1a'),require(_0x5e85('0x1b')));_0x500cdb['use'](_0x5e85('0x1c'),require(_0x5e85('0x1d')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x1e'),require(_0x5e85('0x1f')));_0x500cdb[_0x5e85('0x7')]('/api/mail/accounts',require('./api/mailAccount'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x20'),require('./api/mailQueue'));_0x500cdb[_0x5e85('0x7')]('/api/mail/substatuses',require(_0x5e85('0x21')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x22'),require(_0x5e85('0x23')));_0x500cdb['use'](_0x5e85('0x24'),require('./api/mailMessage'));_0x500cdb['use'](_0x5e85('0x25'),require(_0x5e85('0x26')));_0x500cdb['use']('/api/mail/reports/queue',require(_0x5e85('0x27')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x28'),require(_0x5e85('0x29')));_0x500cdb['use'](_0x5e85('0x2a'),require('./api/dashboardItem'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x2b'),require(_0x5e85('0x2c')));_0x500cdb['use'](_0x5e85('0x2d'),require(_0x5e85('0x2e')));_0x500cdb[_0x5e85('0x7')]('/api/fax/interactions',require(_0x5e85('0x2f')));_0x500cdb['use'](_0x5e85('0x30'),require(_0x5e85('0x31')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x32'),require(_0x5e85('0x33')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x34'),require(_0x5e85('0x35')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x36'),require(_0x5e85('0x37')));_0x500cdb['use'](_0x5e85('0x38'),require(_0x5e85('0x39')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x3a'),require(_0x5e85('0x3b')));_0x500cdb['use'](_0x5e85('0x3c'),require(_0x5e85('0x3d')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x3e'),require(_0x5e85('0x3f')));_0x500cdb[_0x5e85('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x500cdb[_0x5e85('0x7')]('/api/openchannel/applications',require(_0x5e85('0x40')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x41'),require(_0x5e85('0x42')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x43'),require('./api/openchannelMessage'));_0x500cdb[_0x5e85('0x7')]('/api/openchannel/queues',require(_0x5e85('0x44')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x45'),require(_0x5e85('0x46')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x47'),require('./api/openchannelQueueReport'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x48'),require(_0x5e85('0x49')));_0x500cdb[_0x5e85('0x7')]('/api/chat/interactions',require(_0x5e85('0x4a')));_0x500cdb['use'](_0x5e85('0x4b'),require('./api/chatMessage'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x4c'),require(_0x5e85('0x4d')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x4e'),require(_0x5e85('0x4f')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x50'),require(_0x5e85('0x51')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x52'),require(_0x5e85('0x53')));_0x500cdb[_0x5e85('0x7')]('/api/cm/companies',require(_0x5e85('0x54')));_0x500cdb[_0x5e85('0x7')]('/api/cm/contacts',require(_0x5e85('0x55')));_0x500cdb['use'](_0x5e85('0x56'),require(_0x5e85('0x57')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x58'),require(_0x5e85('0x59')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x5a'),require(_0x5e85('0x5b')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x5c'),require(_0x5e85('0x5d')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x5e'),require('./api/cmCustomField'));_0x500cdb[_0x5e85('0x7')]('/api/actions',require(_0x5e85('0x5f')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x60'),require(_0x5e85('0x61')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x62'),require(_0x5e85('0x63')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x64'),require(_0x5e85('0x65')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x66'),require('./api/condition'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x67'),require(_0x5e85('0x68')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x69'),require(_0x5e85('0x6a')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x6b'),require('./api/cdr'));_0x500cdb['use']('/api/voiceQueuesLog',require(_0x5e85('0x6c')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x6d'),require(_0x5e85('0x6e')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x6f'),require(_0x5e85('0x70')));_0x500cdb[_0x5e85('0x7')]('/api/tags',require(_0x5e85('0x71')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x72'),require('./api/contactItemType'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x73'),require('./api/cmContactHasItem'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x74'),require(_0x5e85('0x75')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x76'),require(_0x5e85('0x77')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x78'),require(_0x5e85('0x79')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x7a'),require(_0x5e85('0x7b')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x7c'),require('./api/integration'));_0x500cdb[_0x5e85('0x7')]('/api/integrations/reports',require(_0x5e85('0x7d')));_0x500cdb['use'](_0x5e85('0x7e'),require(_0x5e85('0x7f')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x80'),require(_0x5e85('0x81')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x82'),require('./api/analyticExtractedReport'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x83'),require(_0x5e85('0x84')));_0x500cdb['use'](_0x5e85('0x85'),require(_0x5e85('0x86')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x87'),require(_0x5e85('0x88')));_0x500cdb['use'](_0x5e85('0x89'),require(_0x5e85('0x8a')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x8b'),require(_0x5e85('0x8c')));_0x500cdb[_0x5e85('0x7')]('/api/integrations/salesforce/fields',require(_0x5e85('0x8d')));_0x500cdb[_0x5e85('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x5e85('0x8e')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x8f'),require(_0x5e85('0x90')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x91'),require(_0x5e85('0x92')));_0x500cdb['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x500cdb[_0x5e85('0x7')]('/api/integrations/desk/configurations',require(_0x5e85('0x93')));_0x500cdb['use'](_0x5e85('0x94'),require(_0x5e85('0x95')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x96'),require(_0x5e85('0x97')));_0x500cdb[_0x5e85('0x7')]('/api/integrations/zoho/configurations',require(_0x5e85('0x98')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x99'),require(_0x5e85('0x9a')));_0x500cdb[_0x5e85('0x7')]('/api/integrations/zendesk/accounts',require(_0x5e85('0x9b')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x9c'),require(_0x5e85('0x9d')));_0x500cdb['use'](_0x5e85('0x9e'),require(_0x5e85('0x9f')));_0x500cdb[_0x5e85('0x7')]('/api/integrations/freshdesk/accounts',require(_0x5e85('0xa0')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xa1'),require(_0x5e85('0xa2')));_0x500cdb['use']('/api/integrations/freshdesk/fields',require(_0x5e85('0xa3')));_0x500cdb[_0x5e85('0x7')]('/api/integrations/vtiger/accounts',require(_0x5e85('0xa4')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xa5'),require(_0x5e85('0xa6')));_0x500cdb['use'](_0x5e85('0xa7'),require('./api/intVtigerField'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xa8'),require('./api/intServicenowAccount'));_0x500cdb['use']('/api/integrations/servicenow/configurations',require(_0x5e85('0xa9')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xaa'),require(_0x5e85('0xab')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xac'),require(_0x5e85('0xad')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xae'),require('./api/intDynamics365Configuration'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xaf'),require(_0x5e85('0xb0')));_0x500cdb[_0x5e85('0x7')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xb1'),require(_0x5e85('0xb2')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xb3'),require(_0x5e85('0xb4')));_0x500cdb[_0x5e85('0x7')]('/api/networks',require(_0x5e85('0xb5')));_0x500cdb['use'](_0x5e85('0xb6'),require(_0x5e85('0xb7')));_0x500cdb['use'](_0x5e85('0xb8'),require(_0x5e85('0xb9')));_0x500cdb['use']('/api/jscripty/answers/reports',require(_0x5e85('0xba')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xbb'),require('./api/jscriptyQuestionReport'));_0x500cdb['use'](_0x5e85('0xbc'),require(_0x5e85('0xbd')));_0x500cdb[_0x5e85('0x7')]('/api/sms/reports/queue',require(_0x5e85('0xbe')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xbf'),require('./api/squareReport'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xc0'),require(_0x5e85('0xc1')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xc2'),require(_0x5e85('0xc3')));_0x500cdb['use'](_0x5e85('0xc4'),require(_0x5e85('0xc5')));_0x500cdb['use'](_0x5e85('0xc6'),require('./api/squareOdbc'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xc7'),require(_0x5e85('0xc8')));_0x500cdb['use']('/api/square/recordings',require(_0x5e85('0xc9')));_0x500cdb['use'](_0x5e85('0xca'),require(_0x5e85('0xcb')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xcc'),require(_0x5e85('0xcd')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xce'),require(_0x5e85('0xcf')));_0x500cdb['use'](_0x5e85('0xd0'),require(_0x5e85('0xd1')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xd2'),require(_0x5e85('0xd3')));_0x500cdb[_0x5e85('0x7')]('/api/attachments',require('./api/attachment'));_0x500cdb[_0x5e85('0x7')]('/api/plugins',require(_0x5e85('0xd4')));_0x500cdb[_0x5e85('0x7')]('/api/mail/reports/transfer',require(_0x5e85('0xd5')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xd6'),require('./api/chatTransferReport'));_0x500cdb['use'](_0x5e85('0xd7'),require(_0x5e85('0xd8')));_0x500cdb['use'](_0x5e85('0xd9'),require(_0x5e85('0xda')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xdb'),require(_0x5e85('0xdc')));_0x500cdb[_0x5e85('0x7')]('/api/cm/lists',require('./api/cmList'));_0x500cdb[_0x5e85('0x7')]('/api/voice/prefixes',require(_0x5e85('0xdd')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xde'),require(_0x5e85('0xdf')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xe0'),require(_0x5e85('0xe1')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xe2'),require('./api/userProfileResource'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xe3'),require(_0x5e85('0xe4')));_0x500cdb[_0x5e85('0x7')]('/api/whatsapp/accounts',require(_0x5e85('0xe5')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xe6'),require('./api/whatsappApplication'));_0x500cdb['use'](_0x5e85('0xe7'),require(_0x5e85('0xe8')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xe9'),require('./api/whatsappMessage'));_0x500cdb['use']('/api/whatsapp/reports/queue',require(_0x5e85('0xea')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xeb'),require(_0x5e85('0xec')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xed'),require('./api/whatsappQueue'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xee'),require(_0x5e85('0xef')));_0x500cdb['use'](_0x5e85('0xf0'),require(_0x5e85('0xf1')));_0x500cdb[_0x5e85('0x7')]('/api/user-settings',require(_0x5e85('0xf2')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xf3'),require(_0x5e85('0xf4')));_0x500cdb[_0x5e85('0x7')]('/api/auth/local',require(_0x5e85('0xf5')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xf6'),require('./api/authGoogle'));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xf7'),require('./api/authActiveDirectory'));_0x500cdb[_0x5e85('0x7')]('/api/jira',require(_0x5e85('0xf8')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xf9'),require(_0x5e85('0xfa')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xfb'),require('./api/version'));_0x500cdb[_0x5e85('0x7')]('/api/system',require('./api/system'));_0x500cdb[_0x5e85('0x7')]('/api/pm2',require(_0x5e85('0xfc')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0xfd'),require(_0x5e85('0xfe')));_0x500cdb['use'](_0x5e85('0xff'),clientSideLogs);_0x500cdb['use'](_0x5e85('0x100'),express[_0x5e85('0x101')](path[_0x5e85('0x102')](config[_0x5e85('0x103')],'/apidoc')));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x104'),express[_0x5e85('0x101')](path[_0x5e85('0x102')](config[_0x5e85('0x103')],_0x5e85('0x104'))));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x105'),express[_0x5e85('0x101')](path[_0x5e85('0x102')](config[_0x5e85('0x103')],_0x5e85('0x105'))));_0x500cdb[_0x5e85('0x7')]('/snippet',express[_0x5e85('0x101')](path['join'](config['root'],_0x5e85('0x106'),_0x5e85('0x107'))));_0x500cdb[_0x5e85('0x7')](_0x5e85('0x108'),express[_0x5e85('0x101')](path[_0x5e85('0x102')](config[_0x5e85('0x103')],'/server/files/plugins')));_0x500cdb[_0x5e85('0x109')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x5e85('0x10a')](errors[0x194]);_0x500cdb[_0x5e85('0x109')]('/*')[_0x5e85('0x10a')](function(_0x5a5f52,_0xe6aae3){_0xe6aae3[_0x5e85('0x10b')](path[_0x5e85('0x10c')](_0x500cdb[_0x5e85('0x10a')](_0x5e85('0x10d'))+_0x5e85('0x10e')));});return _0x500cdb;});}; \ No newline at end of file +var _0xb025=['./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/user-setting','/api/mail_interaction_has_tags','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.8.1','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','get','appPath','/index.html','path','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./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/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./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/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports'];(function(_0x313dab,_0x53179c){var _0x18ee37=function(_0x5f43a0){while(--_0x5f43a0){_0x313dab['push'](_0x313dab['shift']());}};_0x18ee37(++_0x53179c);}(_0xb025,0x16f));var _0x5b02=function(_0x505dec,_0x474af5){_0x505dec=_0x505dec-0x0;var _0x291af4=_0xb025[_0x505dec];return _0x291af4;};'use strict';var path=require(_0x5b02('0x0'));var express=require('express');var errors=require(_0x5b02('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x5b02('0x2'))[_0x5b02('0x3')];var clientSideLogs=require(_0x5b02('0x4'));exports[_0x5b02('0x5')]=function(_0x34a68a){return setupLoggers(_0x34a68a)['then'](function(){_0x34a68a[_0x5b02('0x6')](_0x5b02('0x7'),require('./api/user'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x8'),require(_0x5b02('0x9')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xa'),require(_0x5b02('0xb')));_0x34a68a['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x34a68a['use'](_0x5b02('0xc'),require(_0x5b02('0xd')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xe'),require(_0x5b02('0xf')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x10'),require(_0x5b02('0x11')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x12'),require(_0x5b02('0x13')));_0x34a68a[_0x5b02('0x6')]('/api/voice/mails',require(_0x5b02('0x14')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x15'),require(_0x5b02('0x16')));_0x34a68a[_0x5b02('0x6')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x17'),require('./api/voiceDialReport'));_0x34a68a[_0x5b02('0x6')]('/api/voice/agents/reports',require(_0x5b02('0x18')));_0x34a68a[_0x5b02('0x6')]('/api/voice/queues/reports',require(_0x5b02('0x19')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x1a'),require(_0x5b02('0x1b')));_0x34a68a['use']('/api/trunks',require(_0x5b02('0x1c')));_0x34a68a['use'](_0x5b02('0x1d'),require(_0x5b02('0x1e')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x1f'),require('./api/mailServerOut'));_0x34a68a[_0x5b02('0x6')]('/api/mail/accounts',require(_0x5b02('0x20')));_0x34a68a['use'](_0x5b02('0x21'),require('./api/mailQueue'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x22'),require(_0x5b02('0x23')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x24'),require(_0x5b02('0x25')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x26'),require(_0x5b02('0x27')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x28'),require(_0x5b02('0x29')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x2a'),require(_0x5b02('0x2b')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x2c'),require(_0x5b02('0x2d')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x2e'),require(_0x5b02('0x2f')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x30'),require(_0x5b02('0x31')));_0x34a68a['use']('/api/fax/applications',require(_0x5b02('0x32')));_0x34a68a[_0x5b02('0x6')]('/api/fax/interactions',require(_0x5b02('0x33')));_0x34a68a[_0x5b02('0x6')]('/api/fax/messages',require(_0x5b02('0x34')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x35'),require(_0x5b02('0x36')));_0x34a68a['use'](_0x5b02('0x37'),require(_0x5b02('0x38')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x39'),require('./api/smsAccount'));_0x34a68a['use']('/api/sms/applications',require(_0x5b02('0x3a')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x3b'),require(_0x5b02('0x3c')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x3d'),require('./api/smsMessage'));_0x34a68a[_0x5b02('0x6')]('/api/sms/queues',require(_0x5b02('0x3e')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x3f'),require(_0x5b02('0x40')));_0x34a68a['use'](_0x5b02('0x41'),require(_0x5b02('0x42')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x43'),require('./api/openchannelInteraction'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x44'),require('./api/openchannelMessage'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x45'),require(_0x5b02('0x46')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x47'),require(_0x5b02('0x48')));_0x34a68a[_0x5b02('0x6')]('/api/openchannel/reports/queue',require(_0x5b02('0x49')));_0x34a68a[_0x5b02('0x6')]('/api/chat/applications',require(_0x5b02('0x4a')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x4b'),require(_0x5b02('0x4c')));_0x34a68a[_0x5b02('0x6')]('/api/chat/messages',require(_0x5b02('0x4d')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x4e'),require(_0x5b02('0x4f')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x50'),require(_0x5b02('0x51')));_0x34a68a['use'](_0x5b02('0x52'),require(_0x5b02('0x53')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x54'),require('./api/chatProactiveAction'));_0x34a68a['use'](_0x5b02('0x55'),require(_0x5b02('0x56')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x57'),require(_0x5b02('0x58')));_0x34a68a['use']('/api/cm/hopper',require(_0x5b02('0x59')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x5a'),require(_0x5b02('0x5b')));_0x34a68a[_0x5b02('0x6')]('/api/cm/hopper_final',require(_0x5b02('0x5c')));_0x34a68a[_0x5b02('0x6')]('/api/cm/hopper_history',require(_0x5b02('0x5d')));_0x34a68a['use'](_0x5b02('0x5e'),require(_0x5b02('0x5f')));_0x34a68a['use'](_0x5b02('0x60'),require(_0x5b02('0x61')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x62'),require(_0x5b02('0x63')));_0x34a68a['use'](_0x5b02('0x64'),require(_0x5b02('0x65')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x66'),require('./api/disposition'));_0x34a68a[_0x5b02('0x6')]('/api/conditions',require(_0x5b02('0x67')));_0x34a68a['use'](_0x5b02('0x68'),require(_0x5b02('0x69')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x6a'),require(_0x5b02('0x6b')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x6c'),require(_0x5b02('0x6d')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x6e'),require('./api/voiceQueuesLog'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x6f'),require(_0x5b02('0x70')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x71'),require(_0x5b02('0x72')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x73'),require(_0x5b02('0x74')));_0x34a68a['use']('/api/contact_item_types',require(_0x5b02('0x75')));_0x34a68a['use'](_0x5b02('0x76'),require(_0x5b02('0x77')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x78'),require(_0x5b02('0x79')));_0x34a68a['use'](_0x5b02('0x7a'),require('./api/template'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x7b'),require('./api/trigger'));_0x34a68a['use'](_0x5b02('0x7c'),require(_0x5b02('0x7d')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x7e'),require(_0x5b02('0x7f')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x80'),require(_0x5b02('0x81')));_0x34a68a['use']('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x34a68a[_0x5b02('0x6')]('/api/analytics/default_reports',require(_0x5b02('0x82')));_0x34a68a['use'](_0x5b02('0x83'),require('./api/analyticExtractedReport'));_0x34a68a['use'](_0x5b02('0x84'),require(_0x5b02('0x85')));_0x34a68a['use'](_0x5b02('0x86'),require(_0x5b02('0x87')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x88'),require(_0x5b02('0x89')));_0x34a68a['use'](_0x5b02('0x8a'),require(_0x5b02('0x8b')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x8c'),require('./api/intSalesforceConfiguration'));_0x34a68a[_0x5b02('0x6')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x8d'),require(_0x5b02('0x8e')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x8f'),require(_0x5b02('0x90')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x91'),require('./api/intSugarcrmField'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x92'),require(_0x5b02('0x93')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x94'),require('./api/intDeskConfiguration'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x95'),require(_0x5b02('0x96')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x97'),require(_0x5b02('0x98')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x99'),require(_0x5b02('0x9a')));_0x34a68a['use'](_0x5b02('0x9b'),require(_0x5b02('0x9c')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x9d'),require(_0x5b02('0x9e')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x9f'),require('./api/intZendeskConfiguration'));_0x34a68a['use'](_0x5b02('0xa0'),require(_0x5b02('0xa1')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xa2'),require(_0x5b02('0xa3')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xa4'),require(_0x5b02('0xa5')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xa6'),require(_0x5b02('0xa7')));_0x34a68a[_0x5b02('0x6')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xa8'),require(_0x5b02('0xa9')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xaa'),require(_0x5b02('0xab')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xac'),require(_0x5b02('0xad')));_0x34a68a['use'](_0x5b02('0xae'),require('./api/intServicenowConfiguration'));_0x34a68a[_0x5b02('0x6')]('/api/integrations/servicenow/fields',require(_0x5b02('0xaf')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xb0'),require(_0x5b02('0xb1')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xb2'),require(_0x5b02('0xb3')));_0x34a68a['use'](_0x5b02('0xb4'),require('./api/intDynamics365Field'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xb5'),require(_0x5b02('0xb6')));_0x34a68a[_0x5b02('0x6')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xb7'),require(_0x5b02('0xb8')));_0x34a68a['use']('/api/networks',require(_0x5b02('0xb9')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xba'),require(_0x5b02('0xbb')));_0x34a68a['use'](_0x5b02('0xbc'),require(_0x5b02('0xbd')));_0x34a68a['use'](_0x5b02('0xbe'),require(_0x5b02('0xbf')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xc0'),require(_0x5b02('0xc1')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xc2'),require(_0x5b02('0xc3')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xc4'),require(_0x5b02('0xc5')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xc6'),require(_0x5b02('0xc7')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xc8'),require('./api/squareReportDetail'));_0x34a68a['use']('/api/jscripty/projects',require(_0x5b02('0xc9')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xca'),require(_0x5b02('0xcb')));_0x34a68a[_0x5b02('0x6')]('/api/square/odbc',require('./api/squareOdbc'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xcc'),require('./api/squareProject'));_0x34a68a[_0x5b02('0x6')]('/api/square/recordings',require('./api/squareRecording'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xcd'),require(_0x5b02('0xce')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xcf'),require(_0x5b02('0xd0')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xd1'),require(_0x5b02('0xd2')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xd3'),require(_0x5b02('0xd4')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xd5'),require(_0x5b02('0xd6')));_0x34a68a[_0x5b02('0x6')]('/api/attachments',require(_0x5b02('0xd7')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xd8'),require(_0x5b02('0xd9')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xda'),require(_0x5b02('0xdb')));_0x34a68a[_0x5b02('0x6')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x34a68a[_0x5b02('0x6')]('/api/fax/reports/transfer',require(_0x5b02('0xdc')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xdd'),require(_0x5b02('0xde')));_0x34a68a['use'](_0x5b02('0xdf'),require('./api/smsTransferReport'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xe0'),require(_0x5b02('0xe1')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xe2'),require('./api/voicePrefix'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xe3'),require(_0x5b02('0xe4')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xe5'),require(_0x5b02('0xe6')));_0x34a68a['use']('/api/userProfile/resources',require('./api/userProfileResource'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xe7'),require(_0x5b02('0xe8')));_0x34a68a['use'](_0x5b02('0xe9'),require('./api/whatsappAccount'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xea'),require(_0x5b02('0xeb')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xec'),require(_0x5b02('0xed')));_0x34a68a['use']('/api/whatsapp/messages',require(_0x5b02('0xee')));_0x34a68a[_0x5b02('0x6')]('/api/whatsapp/reports/queue',require(_0x5b02('0xef')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xf0'),require(_0x5b02('0xf1')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xf2'),require('./api/whatsappQueue'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xf3'),require(_0x5b02('0xf4')));_0x34a68a['use']('/api/realtime',require('./api/realtime'));_0x34a68a[_0x5b02('0x6')]('/api/user-settings',require(_0x5b02('0xf5')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xf6'),require('./api/mailInteractionHasTag'));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xf7'),require(_0x5b02('0xf8')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xf9'),require(_0x5b02('0xfa')));_0x34a68a['use'](_0x5b02('0xfb'),require(_0x5b02('0xfc')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0xfd'),require('./api/jira'));_0x34a68a['use'](_0x5b02('0xfe'),require(_0x5b02('0xff')));_0x34a68a['use'](_0x5b02('0x100'),require(_0x5b02('0x101')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x102'),require(_0x5b02('0x103')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x104'),require(_0x5b02('0x105')));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x106'),require(_0x5b02('0x107')));_0x34a68a['use'](_0x5b02('0x108'),clientSideLogs);_0x34a68a[_0x5b02('0x6')](_0x5b02('0x109'),express[_0x5b02('0x10a')](path[_0x5b02('0x10b')](config[_0x5b02('0x10c')],_0x5b02('0x109'))));_0x34a68a[_0x5b02('0x6')]('/www',express[_0x5b02('0x10a')](path['join'](config['root'],_0x5b02('0x10d'))));_0x34a68a[_0x5b02('0x6')](_0x5b02('0x10e'),express['static'](path[_0x5b02('0x10b')](config[_0x5b02('0x10c')],_0x5b02('0x10e'))));_0x34a68a['use'](_0x5b02('0x10f'),express[_0x5b02('0x10a')](path['join'](config[_0x5b02('0x10c')],_0x5b02('0x110'),_0x5b02('0x111'))));_0x34a68a[_0x5b02('0x6')]('/plugins',express['static'](path[_0x5b02('0x10b')](config['root'],_0x5b02('0x112'))));_0x34a68a[_0x5b02('0x113')](_0x5b02('0x114'))['get'](errors[0x194]);_0x34a68a[_0x5b02('0x113')]('/*')['get'](function(_0x4002df,_0x1ab656){_0x1ab656[_0x5b02('0x115')](path['resolve'](_0x34a68a[_0x5b02('0x116')](_0x5b02('0x117'))+_0x5b02('0x118')));});return _0x34a68a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a00bc7f..a276353 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5f6=['../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/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','log','../config/triggers','default','jayson/promise','lodash','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc'];(function(_0xc41a22,_0x133f2a){var _0x4e8ca6=function(_0x30e5cd){while(--_0x30e5cd){_0xc41a22['push'](_0xc41a22['shift']());}};_0x4e8ca6(++_0x133f2a);}(_0xe5f6,0xbd));var _0x6e5f=function(_0xd05169,_0x4fa4e6){_0xd05169=_0xd05169-0x0;var _0x3d1525=_0xe5f6[_0xd05169];return _0x3d1525;};'use strict';var jayson=require(_0x6e5f('0x0'));var _=require(_0x6e5f('0x1'));var config=require('../config/environment');exports[_0x6e5f('0x2')]=function(){return new Promise(function(_0x374de3,_0x475e47){var _0x1a180d={};_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x3')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x4')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x6')));_0x1a180d=_['merge'](_0x1a180d,require('../api/voiceRecording/voiceRecording.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x7')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x8')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x9')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0xa')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/memberReport/memberReport.rpc'));_0x1a180d=_['merge'](_0x1a180d,require('../api/trunk/trunk.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0xb')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0xc')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/mailServerIn/mailServerIn.rpc'));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0xd')));_0x1a180d=_['merge'](_0x1a180d,require('../api/mailQueue/mailQueue.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0xe')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0xf')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x10')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x11')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x12')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x13')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x14')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/faxMessage/faxMessage.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x15')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x16')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x17')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x18')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x19')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x1a')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x1b')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x1c')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x1d')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x1e')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x1f')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x20')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x21')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x22')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x23')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x24')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x25')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x26')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/pause/pause.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x27')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x28')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x29')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x2a')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x2b')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x2c')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x2d')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x2e')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x2f')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x30')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x31')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x32')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x33')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x34')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require('../api/squareReport/squareReport.rpc'));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x35')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x36')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x37')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x38')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x39')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x3a')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x3b')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x3c')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x3d')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x3e')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x3f')));_0x1a180d=_[_0x6e5f('0x5')](_0x1a180d,require(_0x6e5f('0x40')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x41')));_0x1a180d=_['merge'](_0x1a180d,require(_0x6e5f('0x42')));var _0xe5cd91=jayson['server'](_0x1a180d)[_0x6e5f('0x43')]();var _0x302e39=config[_0x6e5f('0x44')][_0x6e5f('0x45')]||config[_0x6e5f('0x45')]+0x1;var _0x33e92b=config['rpc']['ip']||'localhost';_0xe5cd91['on']('error',function(_0xf948){return _0x475e47(_0xf948);});_0xe5cd91['listen'](_0x302e39,_0x33e92b,function(){console[_0x6e5f('0x46')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x33e92b,_0x302e39);require(_0x6e5f('0x47'))[_0x6e5f('0x48')]();return _0x374de3('RPC\x20listening\x20on\x20'+_0x33e92b+':'+_0x302e39);});});}; \ No newline at end of file +var _0xd652=['../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','listen','log','default','RPC\x20listening\x20on\x20','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd652,0x1b3));var _0x2d65=function(_0x47d200,_0x1f2e18){_0x47d200=_0x47d200-0x0;var _0x480ce5=_0xd652[_0x47d200];return _0x480ce5;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2d65('0x0'));var config=require(_0x2d65('0x1'));exports['listen']=function(){return new Promise(function(_0x30ea81,_0x1bd060){var _0x38116d={};_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x3')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x4')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x5')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x6')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x7')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x8')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x9')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/memberReport/memberReport.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0xa')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0xb')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0xc')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0xd')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0xe')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0xf')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/mailInteraction/mailInteraction.rpc'));_0x38116d=_['merge'](_0x38116d,require('../api/mailMessage/mailMessage.rpc'));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x10')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x11')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x12')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x13')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/faxInteraction/faxInteraction.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x14')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x15')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x16')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x17')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x18')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/smsQueue/smsQueue.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x19')));_0x38116d=_['merge'](_0x38116d,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x1a')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x1b')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/chatInteraction/chatInteraction.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x1c')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x1d')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/cmContact/cmContact.rpc'));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x1e')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x1f')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x20')));_0x38116d=_['merge'](_0x38116d,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x21')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x22')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/pause/pause.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/sound/sound.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x23')));_0x38116d=_['merge'](_0x38116d,require('../api/template/template.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x24')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x25')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x26')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x27')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x28')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x29')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x2a')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x2b')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x2c')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x2d')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x2e')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x2f')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x30')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x31')));_0x38116d=_['merge'](_0x38116d,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x32')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x33')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x34')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x35')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x36')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/campaign/campaign.rpc'));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x37')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x38')));_0x38116d=_['merge'](_0x38116d,require(_0x2d65('0x39')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x3a')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x3b')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require(_0x2d65('0x3c')));_0x38116d=_[_0x2d65('0x2')](_0x38116d,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x36e624=jayson[_0x2d65('0x3d')](_0x38116d)[_0x2d65('0x3e')]();var _0x499f16=config[_0x2d65('0x3f')][_0x2d65('0x40')]||config[_0x2d65('0x40')]+0x1;var _0xa01ea5=config['rpc']['ip']||'localhost';_0x36e624['on']('error',function(_0x5a7816){return _0x1bd060(_0x5a7816);});_0x36e624[_0x2d65('0x41')](_0x499f16,_0xa01ea5,function(){console[_0x2d65('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0xa01ea5,_0x499f16);require('../config/triggers')[_0x2d65('0x43')]();return _0x30ea81(_0x2d65('0x44')+_0xa01ea5+':'+_0x499f16);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 097f65c..1387e5c 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 _0x7409=['isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','GOTO\x20%s\x20%s\x20%s','recordFile','wav','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','exec','AGI','wait','WAIT','label','exports','util','lodash','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','ready','toLowerCase','substring','520-Invalid','search','indexOf','startsWith','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','inherits','prototype','sendRequest','sync','answer','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22'];(function(_0x4f4bb5,_0x59db4f){var _0x54ce24=function(_0x3a300d){while(--_0x3a300d){_0x4f4bb5['push'](_0x4f4bb5['shift']());}};_0x54ce24(++_0x59db4f);}(_0x7409,0x6e));var _0x9740=function(_0x1b515f,_0x52aa6b){_0x1b515f=_0x1b515f-0x0;var _0x66ff73=_0x7409[_0x1b515f];return _0x66ff73;};'use strict';var util=require(_0x9740('0x0'));var _=require(_0x9740('0x1'));var EventEmitter=require('events')[_0x9740('0x2')];var AGIReply=require(_0x9740('0x3'));var AGIError=require(_0x9740('0x4'));function AGIChannel(_0x437957){var _0x1109e2=this,_0x2c15f1=new AGIReply(),_0xf40233=![],_0x2bb453={};EventEmitter[_0x9740('0x5')](_0x1109e2);_0x437957['setEncoding'](_0x9740('0x6'));_0x437957[_0x9740('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2c15f1[_0x9740('0x8')]('utf8');_0x2c15f1['on'](_0x9740('0x9'),function(_0x2dc9a6){for(var _0x449412 in _0x2dc9a6){_0x1109e2[_0x449412]=_0x2dc9a6[_0x449412];}_0x1109e2['emit'](_0x9740('0xa'));});_0x2c15f1['on']('line',function(_0x1a6ff9){if(_0x1a6ff9[_0x9740('0xb')]()=='hangup'){_0x1109e2['emit']('hangup');return;}if(_0x1a6ff9[_0x9740('0xc')](0x0,0xb)==_0x9740('0xd')){_0xf40233=!![];}if(_0xf40233){_0x2bb453['rx']+=_0x1a6ff9+'\x0a';if(_0x1a6ff9[_0x9740('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0xf40233=![];}}else{_0x2bb453['rx']=_0x1a6ff9;}if(_0xf40233){return;}if(typeof _0x2bb453['cb']=='function'){var _0x5263b3=_0x2bb453['rx']['substring'](0x0,0x3),_0x5a6773=null,_0x4adaae=null;_0x5263b3=parseInt(_0x5263b3);if(isNaN(_0x5263b3)){_0x2bb453['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x5263b3!=0xc8){_0x2bb453['cb'](null,{'code':_0x5263b3,'result':-0x1,'extra':'KO'});return;}_0x5a6773=_0x2bb453['rx'][_0x9740('0xc')](0x4)['replace']('result=','');if(_0x5a6773[_0x9740('0xf')]('\x20')!=-0x1){_0x5a6773=_0x5a6773['substr'](0x0,_0x5a6773[_0x9740('0xf')]('\x20'));}if(_[_0x9740('0x10')](_0x5a6773,'-1')){_0x5a6773=parseInt(_0x5a6773);}_0x4adaae=_0x2bb453['rx'][_0x9740('0x11')]('\x20');if(_0x4adaae[_0x9740('0x12')]==0x3){_0x4adaae=_0x4adaae[0x2]['substring'](0x1,_0x4adaae[0x2][_0x9740('0x12')]-0x1);}else if(_0x4adaae['length']>0x3){var _0x35e98c=/\((.+)\)/;var _0x3fc496=_0x2bb453['rx'][_0x9740('0x13')](_0x35e98c);if(_0x3fc496){_0x4adaae=_0x3fc496[0x1];}else{_0x4adaae=null;}}else{_0x4adaae=null;}_0x2bb453['cb'](null,{'code':_0x5263b3,'result':_0x5a6773,'extra':_0x4adaae});}});_0x437957['on'](_0x9740('0x14'),function(_0x22843a){_0x1109e2[_0x9740('0x15')](_0x9740('0x14'),new AGIError(_0x9740('0x16'),_0x22843a[_0x9740('0x17')]));});_0x437957['on']('close',function(){_0x1109e2[_0x9740('0x15')](_0x9740('0x18'),new AGIError(_0x9740('0x19')));});_0x437957['on'](_0x9740('0x1a'),function(){_0x1109e2[_0x9740('0x15')](_0x9740('0x1a'),new AGIError(_0x9740('0x1b')));_0x437957[_0x9740('0x1c')]();});_0x437957['pipe'](_0x2c15f1);this[_0x9740('0x1d')]=function(_0x47b7f1,_0x1f8a78){var _0x47b7f1=_0x47b7f1||'',_0x1f8a78=typeof _0x1f8a78==_0x9740('0x1e')?_0x1f8a78:new Function();_0x2bb453={'tx':_0x47b7f1,'rx':'','cb':_0x1f8a78};_0x437957[_0x9740('0x1f')](_0x47b7f1+'\x0a');},this[_0x9740('0x18')]=function(){_0x437957['destroy']();};}util[_0x9740('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x9740('0x21')][_0x9740('0x22')]=function(_0x617a14){return this[_0x9740('0x1d')][_0x9740('0x23')](this,_0x617a14);};AGIChannel[_0x9740('0x21')][_0x9740('0x24')]=function(){return this[_0x9740('0x22')]('ANSWER');};AGIChannel[_0x9740('0x21')]['getData']=function(_0x4e5074,_0x4b8d88,_0x4d2e0d){_0x4e5074=_0x4e5074===undefined?_0x9740('0x25'):_0x4e5074;_0x4b8d88=_0x4b8d88===undefined?'5':_0x4b8d88;_0x4d2e0d=_0x4d2e0d===undefined?'1':_0x4d2e0d;return this[_0x9740('0x22')](util[_0x9740('0x26')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4e5074,_0x4b8d88*0x3e8,_0x4d2e0d));};AGIChannel[_0x9740('0x21')][_0x9740('0x27')]=function(_0x311e1b){_0x311e1b=_0x311e1b||_0x9740('0x28');return this['sendRequest'](util[_0x9740('0x26')](_0x9740('0x29'),_0x311e1b));};AGIChannel[_0x9740('0x21')]['exec']=function(_0x248577,_0x3f6800){if(_[_0x9740('0x2a')](_0x3f6800)){return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x2b'),_0x248577,_0x3f6800[_0x9740('0x2c')](',')));}return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x2b'),_0x248577,_0x3f6800));};AGIChannel['prototype'][_0x9740('0x2d')]=function(_0x10308b){return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x2e'),_0x10308b));};AGIChannel[_0x9740('0x21')]['setExtension']=function(_0x1247aa){return this['sendRequest'](util['format'](_0x9740('0x2f'),_0x1247aa));};AGIChannel[_0x9740('0x21')][_0x9740('0x30')]=function(_0x28d71d){return this[_0x9740('0x22')](util['format'](_0x9740('0x31'),_0x28d71d));};AGIChannel[_0x9740('0x21')][_0x9740('0x32')]=function(){return this[_0x9740('0x22')](_0x9740('0x33'));};AGIChannel[_0x9740('0x21')][_0x9740('0x34')]=function(_0x4615e5,_0x33bb9c){var _0x52299=_[_0x9740('0x35')](_0x33bb9c)||_[_0x9740('0x36')](_0x33bb9c)?_0x33bb9c[_0x9740('0x37')]():_0x33bb9c;return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x38'),_0x4615e5,_0x52299?_0x52299[_0x9740('0x37')]()[_0x9740('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9740('0x21')][_0x9740('0x3a')]=function(_0x28021a,_0x16595c){return this['sendRequest'](util[_0x9740('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x28021a,_0x16595c));};AGIChannel[_0x9740('0x21')][_0x9740('0x3b')]=function(_0x41f596,_0x3612a1){return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x3c'),_0x41f596,_0x3612a1));};AGIChannel['prototype']['sayPhonetic']=function(_0x54018a,_0x275f64){return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x3d'),_0x54018a,_0x275f64));};AGIChannel[_0x9740('0x21')]['continueAt']=function(_0xbd74de,_0x44fdf2,_0x43f3ff){_0x44fdf2=_0x44fdf2||this[_0x9740('0x3e')];_0x43f3ff=_0x43f3ff||0x1;this[_0x9740('0x2d')](_0xbd74de);this[_0x9740('0x3f')](_0x44fdf2);this['setPriority'](_0x43f3ff);return this[_0x9740('0x27')](util[_0x9740('0x26')](_0x9740('0x40'),_0xbd74de,_0x44fdf2,_0x43f3ff));};AGIChannel['prototype']['getVariable']=function(_0x62bf4e){return this[_0x9740('0x22')](util[_0x9740('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x62bf4e));};AGIChannel[_0x9740('0x21')][_0x9740('0x41')]=function(_0x16eab4,_0x5ec601,_0x26cb51,_0x170951,_0x8db5aa,_0x351b7b){_0x5ec601=_0x5ec601||_0x9740('0x42');_0x26cb51=_0x26cb51||'';_0x170951=_0x170951===undefined?-0x1:_0x170951==='-1'?-0x1:_0x170951*0x3e8;_0x8db5aa=_0x8db5aa===undefined?'':'s='+_0x8db5aa;_0x351b7b=_0x351b7b?'BEEP':'';return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x43'),_0x16eab4,_0x5ec601,_0x26cb51,_0x170951,_0x351b7b,_0x8db5aa));};AGIChannel['prototype'][_0x9740('0x44')]=function(_0x3d6637,_0x51fc28){_0x51fc28=_0x51fc28||'';return this[_0x9740('0x22')](util[_0x9740('0x26')](_0x9740('0x45'),_0x3d6637,_0x51fc28));};AGIChannel[_0x9740('0x21')]['agi']=function(_0x7ed308){return this[_0x9740('0x46')](_0x9740('0x47'),_0x7ed308);};AGIChannel[_0x9740('0x21')][_0x9740('0x48')]=function(_0x1141c3){return this['exec'](_0x9740('0x49'),_0x1141c3);};AGIChannel[_0x9740('0x21')][_0x9740('0x14')]=function(_0x1c05e3,_0x53e84b){this[_0x9740('0x27')](util[_0x9740('0x26')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1c05e3['id'],_0x1c05e3[_0x9740('0x4a')],_0x53e84b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9740('0x4b')]=AGIChannel; \ No newline at end of file +var _0x36c3=['join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','prototype','sendRequest','command','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','format','isArray','EXEC\x20%s\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x36c3,0x1a6));var _0x336c=function(_0x2bfb31,_0xdd9aae){_0x2bfb31=_0x2bfb31-0x0;var _0x2b00ce=_0x36c3[_0x2bfb31];return _0x2b00ce;};'use strict';var util=require(_0x336c('0x0'));var _=require(_0x336c('0x1'));var EventEmitter=require('events')[_0x336c('0x2')];var AGIReply=require(_0x336c('0x3'));var AGIError=require(_0x336c('0x4'));function AGIChannel(_0x194993){var _0x32aed2=this,_0x2b1194=new AGIReply(),_0x39ed12=![],_0x4e4c07={};EventEmitter[_0x336c('0x5')](_0x32aed2);_0x194993[_0x336c('0x6')](_0x336c('0x7'));_0x194993[_0x336c('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2b1194[_0x336c('0x6')]('utf8');_0x2b1194['on'](_0x336c('0x9'),function(_0x1e6f42){for(var _0x3b4f93 in _0x1e6f42){_0x32aed2[_0x3b4f93]=_0x1e6f42[_0x3b4f93];}_0x32aed2[_0x336c('0xa')](_0x336c('0xb'));});_0x2b1194['on'](_0x336c('0xc'),function(_0x33ced0){if(_0x33ced0[_0x336c('0xd')]()==_0x336c('0xe')){_0x32aed2[_0x336c('0xa')](_0x336c('0xe'));return;}if(_0x33ced0[_0x336c('0xf')](0x0,0xb)==_0x336c('0x10')){_0x39ed12=!![];}if(_0x39ed12){_0x4e4c07['rx']+=_0x33ced0+'\x0a';if(_0x33ced0[_0x336c('0x11')](_0x336c('0x12'))!=-0x1){_0x39ed12=![];}}else{_0x4e4c07['rx']=_0x33ced0;}if(_0x39ed12){return;}if(typeof _0x4e4c07['cb']==_0x336c('0x13')){var _0x94b601=_0x4e4c07['rx'][_0x336c('0xf')](0x0,0x3),_0x4b08f8=null,_0x592a5b=null;_0x94b601=parseInt(_0x94b601);if(isNaN(_0x94b601)){_0x4e4c07['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x94b601!=0xc8){_0x4e4c07['cb'](null,{'code':_0x94b601,'result':-0x1,'extra':'KO'});return;}_0x4b08f8=_0x4e4c07['rx'][_0x336c('0xf')](0x4)[_0x336c('0x14')](_0x336c('0x15'),'');if(_0x4b08f8[_0x336c('0x16')]('\x20')!=-0x1){_0x4b08f8=_0x4b08f8['substr'](0x0,_0x4b08f8[_0x336c('0x16')]('\x20'));}if(_[_0x336c('0x17')](_0x4b08f8,'-1')){_0x4b08f8=parseInt(_0x4b08f8);}_0x592a5b=_0x4e4c07['rx']['split']('\x20');if(_0x592a5b[_0x336c('0x18')]==0x3){_0x592a5b=_0x592a5b[0x2]['substring'](0x1,_0x592a5b[0x2][_0x336c('0x18')]-0x1);}else if(_0x592a5b['length']>0x3){var _0x20f10a=/\((.+)\)/;var _0x4ca365=_0x4e4c07['rx'][_0x336c('0x19')](_0x20f10a);if(_0x4ca365){_0x592a5b=_0x4ca365[0x1];}else{_0x592a5b=null;}}else{_0x592a5b=null;}_0x4e4c07['cb'](null,{'code':_0x94b601,'result':_0x4b08f8,'extra':_0x592a5b});}});_0x194993['on'](_0x336c('0x1a'),function(_0x4a46ff){_0x32aed2['emit'](_0x336c('0x1a'),new AGIError(_0x336c('0x1b'),_0x4a46ff[_0x336c('0x1c')]));});_0x194993['on'](_0x336c('0x1d'),function(){_0x32aed2[_0x336c('0xa')]('close',new AGIError(_0x336c('0x1e')));});_0x194993['on']('timeout',function(){_0x32aed2['emit']('timeout',new AGIError(_0x336c('0x1f')));_0x194993[_0x336c('0x20')]();});_0x194993[_0x336c('0x21')](_0x2b1194);this['command']=function(_0x5adb5f,_0x5b6cc3){var _0x5adb5f=_0x5adb5f||'',_0x5b6cc3=typeof _0x5b6cc3=='function'?_0x5b6cc3:new Function();_0x4e4c07={'tx':_0x5adb5f,'rx':'','cb':_0x5b6cc3};_0x194993[_0x336c('0x22')](_0x5adb5f+'\x0a');},this[_0x336c('0x1d')]=function(){_0x194993[_0x336c('0x20')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x336c('0x23')][_0x336c('0x24')]=function(_0x24f8ca){return this[_0x336c('0x25')]['sync'](this,_0x24f8ca);};AGIChannel[_0x336c('0x23')][_0x336c('0x26')]=function(){return this[_0x336c('0x24')](_0x336c('0x27'));};AGIChannel[_0x336c('0x23')][_0x336c('0x28')]=function(_0x567bfa,_0x23db11,_0x3d2442){_0x567bfa=_0x567bfa===undefined?_0x336c('0x29'):_0x567bfa;_0x23db11=_0x23db11===undefined?'5':_0x23db11;_0x3d2442=_0x3d2442===undefined?'1':_0x3d2442;return this[_0x336c('0x24')](util['format'](_0x336c('0x2a'),_0x567bfa,_0x23db11*0x3e8,_0x3d2442));};AGIChannel[_0x336c('0x23')]['noop']=function(_0x5476ff){_0x5476ff=_0x5476ff||'NO\x20MESSAGE';return this[_0x336c('0x24')](util[_0x336c('0x2b')]('VERBOSE\x20\x22%s\x22',_0x5476ff));};AGIChannel['prototype']['exec']=function(_0x209c2b,_0x37782a){if(_[_0x336c('0x2c')](_0x37782a)){return this[_0x336c('0x24')](util[_0x336c('0x2b')](_0x336c('0x2d'),_0x209c2b,_0x37782a[_0x336c('0x2e')](',')));}return this['sendRequest'](util[_0x336c('0x2b')](_0x336c('0x2d'),_0x209c2b,_0x37782a));};AGIChannel[_0x336c('0x23')][_0x336c('0x2f')]=function(_0x4d187c){return this[_0x336c('0x24')](util[_0x336c('0x2b')]('SET\x20CONTEXT\x20%s',_0x4d187c));};AGIChannel[_0x336c('0x23')][_0x336c('0x30')]=function(_0x5cadc4){return this[_0x336c('0x24')](util[_0x336c('0x2b')](_0x336c('0x31'),_0x5cadc4));};AGIChannel[_0x336c('0x23')][_0x336c('0x32')]=function(_0x3c3bb2){return this[_0x336c('0x24')](util[_0x336c('0x2b')]('SET\x20PRIORITY\x20%s',_0x3c3bb2));};AGIChannel[_0x336c('0x23')][_0x336c('0xe')]=function(){return this[_0x336c('0x24')](_0x336c('0x33'));};AGIChannel[_0x336c('0x23')][_0x336c('0x34')]=function(_0x6d823a,_0x223c86){var _0x18d37b=_[_0x336c('0x35')](_0x223c86)||_['isNumber'](_0x223c86)?_0x223c86[_0x336c('0x36')]():_0x223c86;return this[_0x336c('0x24')](util[_0x336c('0x2b')](_0x336c('0x37'),_0x6d823a,_0x18d37b?_0x18d37b[_0x336c('0x36')]()[_0x336c('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x336c('0x23')][_0x336c('0x38')]=function(_0x364a0a,_0xf9c76a){return this['sendRequest'](util[_0x336c('0x2b')](_0x336c('0x39'),_0x364a0a,_0xf9c76a));};AGIChannel[_0x336c('0x23')]['sayDigits']=function(_0x2d436a,_0x154bc0){return this[_0x336c('0x24')](util[_0x336c('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x2d436a,_0x154bc0));};AGIChannel[_0x336c('0x23')][_0x336c('0x3a')]=function(_0x478b10,_0xb9cbf9){return this[_0x336c('0x24')](util[_0x336c('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x478b10,_0xb9cbf9));};AGIChannel[_0x336c('0x23')][_0x336c('0x3b')]=function(_0xdd7677,_0x28688b,_0x5405c9){_0x28688b=_0x28688b||this[_0x336c('0x3c')];_0x5405c9=_0x5405c9||0x1;this[_0x336c('0x2f')](_0xdd7677);this[_0x336c('0x30')](_0x28688b);this[_0x336c('0x32')](_0x5405c9);return this[_0x336c('0x3d')](util['format'](_0x336c('0x3e'),_0xdd7677,_0x28688b,_0x5405c9));};AGIChannel[_0x336c('0x23')][_0x336c('0x3f')]=function(_0x5b2f25){return this[_0x336c('0x24')](util[_0x336c('0x2b')]('GET\x20VARIABLE\x20\x22%s\x22',_0x5b2f25));};AGIChannel[_0x336c('0x23')][_0x336c('0x40')]=function(_0x1d2a2d,_0x4777c1,_0x57936a,_0x367850,_0x38e781,_0x515fd9){_0x4777c1=_0x4777c1||_0x336c('0x41');_0x57936a=_0x57936a||'';_0x367850=_0x367850===undefined?-0x1:_0x367850==='-1'?-0x1:_0x367850*0x3e8;_0x38e781=_0x38e781===undefined?'':'s='+_0x38e781;_0x515fd9=_0x515fd9?_0x336c('0x42'):'';return this['sendRequest'](util[_0x336c('0x2b')](_0x336c('0x43'),_0x1d2a2d,_0x4777c1,_0x57936a,_0x367850,_0x515fd9,_0x38e781));};AGIChannel[_0x336c('0x23')][_0x336c('0x44')]=function(_0x4b414e,_0x28d205){_0x28d205=_0x28d205||'';return this[_0x336c('0x24')](util[_0x336c('0x2b')](_0x336c('0x45'),_0x4b414e,_0x28d205));};AGIChannel[_0x336c('0x23')][_0x336c('0x46')]=function(_0x11ff51){return this[_0x336c('0x47')](_0x336c('0x48'),_0x11ff51);};AGIChannel['prototype'][_0x336c('0x49')]=function(_0x46b61b){return this[_0x336c('0x47')](_0x336c('0x4a'),_0x46b61b);};AGIChannel[_0x336c('0x23')][_0x336c('0x1a')]=function(_0x41e794,_0xbfac47){this[_0x336c('0x3d')](util[_0x336c('0x2b')](_0x336c('0x4b'),_0x41e794['id'],_0x41e794[_0x336c('0x4c')],_0xbfac47));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x336c('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1501f33..3ac9051 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 _0x0c56=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0xd7aa3c,_0x752535){var _0x5a4093=function(_0x182b5a){while(--_0x182b5a){_0xd7aa3c['push'](_0xd7aa3c['shift']());}};_0x5a4093(++_0x752535);}(_0x0c56,0xbd));var _0x60c5=function(_0x2d77ea,_0xfb3ddb){_0x2d77ea=_0x2d77ea-0x0;var _0x58fc67=_0x0c56[_0x2d77ea];return _0x58fc67;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x60c5('0x0'),'E_AGI_ARGUMENT_PORT':_0x60c5('0x1'),'E_AGI_SERVER_ERROR':_0x60c5('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x60c5('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x60c5('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x60c5('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x60c5('0x6'),'E_AGI_IVR_ENTRY':_0x60c5('0x7')};function AGIError(_0x4d4108){var _0x4d4108=_0x4d4108||null,_0x28276e=_0x28276e||[],_0x58cc38=0x1,_0x2bfb9c='';if(!error[_0x4d4108]){_0x4d4108=_0x60c5('0x8');}_0x28276e[_0x60c5('0x9')](error[_0x4d4108]);while(arguments[_0x58cc38]){_0x28276e[_0x60c5('0x9')](arguments[_0x58cc38]);_0x58cc38++;}_0x2bfb9c=util[_0x60c5('0xa')]['apply'](util,_0x28276e);this[_0x60c5('0xb')]=_0x2bfb9c;this[_0x60c5('0xc')]=_0x4d4108;}module[_0x60c5('0xd')]=AGIError; \ No newline at end of file +var _0x9480=['apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0xf7c541,_0xa92764){var _0x59bbda=function(_0x3c7076){while(--_0x3c7076){_0xf7c541['push'](_0xf7c541['shift']());}};_0x59bbda(++_0xa92764);}(_0x9480,0x189));var _0x0948=function(_0x5d1229,_0x3a8f10){_0x5d1229=_0x5d1229-0x0;var _0x1b1d85=_0x9480[_0x5d1229];return _0x1b1d85;};'use strict';var util=require(_0x0948('0x0'));var error={'E_AGI_UNDEFINED':_0x0948('0x1'),'E_AGI_ARGUMENT_PORT':_0x0948('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x0948('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x0948('0x4'),'E_AGI_SOCKET_ERROR':_0x0948('0x5'),'E_AGI_SOCKET_CLOSE':_0x0948('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x0948('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0948('0x8')};function AGIError(_0x2e32ab){var _0x2e32ab=_0x2e32ab||null,_0x4e5919=_0x4e5919||[],_0x37ff0a=0x1,_0x47f826='';if(!error[_0x2e32ab]){_0x2e32ab='E_AGI_UNDEFINED';}_0x4e5919[_0x0948('0x9')](error[_0x2e32ab]);while(arguments[_0x37ff0a]){_0x4e5919['push'](arguments[_0x37ff0a]);_0x37ff0a++;}_0x47f826=util['format'][_0x0948('0xa')](util,_0x4e5919);this[_0x0948('0xb')]=_0x47f826;this['name']=_0x2e32ab;}module[_0x0948('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index cf65abf..eef9334 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffbe=['subscribe','agi','emit','error','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','./error','../../config/environment','redis','defaults'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0xffbe,0xe8));var _0xeffb=function(_0x30b72e,_0x3ade6c){_0x30b72e=_0x30b72e-0x0;var _0x1c7aa2=_0xffbe[_0x30b72e];return _0x1c7aa2;};'use strict';var _=require(_0xeffb('0x0'));var EventEmitter=require(_0xeffb('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0xeffb('0x2'));var config=require(_0xeffb('0x3'));config[_0xeffb('0x4')]=_[_0xeffb('0x5')](config[_0xeffb('0x4')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xeffb('0x4')]);sub[_0xeffb('0x6')](_0xeffb('0x7'),function(_0x3d1b0c){if(_0x3d1b0c)return eventEmitter[_0xeffb('0x8')](_0xeffb('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x3d1b0c));});sub['on']('message',function(_0x4f287c,_0x2b9930){if(_0x4f287c!=='agi')return;try{var _0x504135=JSON[_0xeffb('0xa')](_0x2b9930);eventEmitter[_0xeffb('0x8')](_0xeffb('0xb'),_0x504135);}catch(_0x4bb354){eventEmitter[_0xeffb('0x8')]('error',new AGIError(_0xeffb('0xc'),_0x4bb354));}});module[_0xeffb('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x8e1d=['emit','projectUpdate','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR','message'];(function(_0x241b57,_0x2cc1c7){var _0x151b9e=function(_0x13d569){while(--_0x13d569){_0x241b57['push'](_0x241b57['shift']());}};_0x151b9e(++_0x2cc1c7);}(_0x8e1d,0x1d3));var _0xd8e1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8e1d[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd8e1('0x0'));var EventEmitter=require(_0xd8e1('0x1'))[_0xd8e1('0x2')];var Redis=require(_0xd8e1('0x3'));var AGIError=require(_0xd8e1('0x4'));var config=require(_0xd8e1('0x5'));config[_0xd8e1('0x6')]=_['defaults'](config[_0xd8e1('0x6')],{'host':_0xd8e1('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xd8e1('0x6')]);sub[_0xd8e1('0x8')](_0xd8e1('0x9'),function(_0x525b2c){if(_0x525b2c)return eventEmitter['emit'](_0xd8e1('0xa'),new AGIError(_0xd8e1('0xb'),_0x525b2c));});sub['on'](_0xd8e1('0xc'),function(_0x41c04b,_0x147c2f){if(_0x41c04b!=='agi')return;try{var _0x53310a=JSON['parse'](_0x147c2f);eventEmitter[_0xd8e1('0xd')](_0xd8e1('0xe'),_0x53310a);}catch(_0x383b86){eventEmitter['emit']('error',new AGIError(_0xd8e1('0xb'),_0x383b86));}});module[_0xd8e1('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 1c010df..044627a 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 _0x8ce7=['numberOfEdges','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','menu','getsecretdigits','vertices','prototype','addVertex','edges','size','relations'];(function(_0xecd898,_0x3ccff1){var _0x3ac04d=function(_0x52a712){while(--_0x52a712){_0xecd898['push'](_0xecd898['shift']());}};_0x3ac04d(++_0x3ccff1);}(_0x8ce7,0x98));var _0x78ce=function(_0x5234a6,_0x314a5d){_0x5234a6=_0x5234a6-0x0;var _0x1f8955=_0x8ce7[_0x5234a6];return _0x1f8955;};'use strict';var _=require(_0x78ce('0x0'));var logger=require(_0x78ce('0x1'))('agi');var verticesWithRetry=[_0x78ce('0x2'),'getdigits',_0x78ce('0x3')];var Graph=function(){this[_0x78ce('0x4')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x78ce('0x5')][_0x78ce('0x6')]=function(_0x12abdc){this[_0x78ce('0x4')][_0x12abdc['id']]=_0x12abdc;this[_0x78ce('0x7')][_0x12abdc['id']]=[];};Graph[_0x78ce('0x5')]['addEdge']=function(_0x72c20c,_0x17e2f9,_0x20540d){this[_0x78ce('0x7')][_0x72c20c]['push']({'target':_0x17e2f9,'condition':_0x20540d});this['numberOfEdges']+=0x1;};Graph[_0x78ce('0x5')][_0x78ce('0x8')]=function(){return _[_0x78ce('0x8')](this[_0x78ce('0x4')]);};Graph['prototype'][_0x78ce('0x9')]=function(){return this[_0x78ce('0xa')];};Graph[_0x78ce('0x5')]['getVertex']=function(_0x2f0a5a){return this[_0x78ce('0x4')][_0x2f0a5a];};Graph[_0x78ce('0x5')][_0x78ce('0xb')]=function(_0xd8a79f,_0x25ebcb){if(!this[_0x78ce('0x4')][_0xd8a79f]){return logger[_0x78ce('0xc')](_0x78ce('0xd'));}var _0x39e751=_0x25ebcb(this[_0x78ce('0x4')][_0xd8a79f]);if(!_0x39e751){return logger[_0x78ce('0xc')]('stop\x20traverse');}if(this[_0x78ce('0x7')][_0xd8a79f][_0x78ce('0xe')]===0x0){return logger[_0x78ce('0xc')](_0x78ce('0xf'));}for(var _0x1e4a26=0x0,_0xd3bbf8=[],_0x59b1b0=![];_0x1e4a26\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','catch','[LICENSE]','listening','connection','close','lodash','syncho'];(function(_0x1243e3,_0x1ab305){var _0x199056=function(_0x326a45){while(--_0x326a45){_0x1243e3['push'](_0x1243e3['shift']());}};_0x199056(++_0x1ab305);}(_0xac1d,0xf2));var _0xdac1=function(_0x2b6f73,_0x3b30c2){_0x2b6f73=_0x2b6f73-0x0;var _0x17a610=_0xac1d[_0x2b6f73];return _0x17a610;};'use strict';var _=require(_0xdac1('0x0'));var syncho=require(_0xdac1('0x1'));var util=require(_0xdac1('0x2'));var config=require('../../config/environment');var logger=require(_0xdac1('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xdac1('0x4'));var Project=require('./project');var AGIEmitter=require(_0xdac1('0x5'))['EventEmitter'];var projects=[];config[_0xdac1('0x6')]=_[_0xdac1('0x7')](config[_0xdac1('0x6')],{'ip':_0xdac1('0x8'),'port':0x11dd});AGIEmitter['on'](_0xdac1('0x9'),projectUpdateHandler);function connectionHandler(_0x1afe9d){process[_0xdac1('0xa')](function(){syncho(function(){try{setChannelVariables(_0x1afe9d);agiHandler(_0x1afe9d);}catch(_0x5e40c8){logger[_0xdac1('0xb')](_0x5e40c8[_0xdac1('0xc')]);}});});}function projectUpdateHandler(_0x4e2fb2){try{var _0x5a2cce=_[_0xdac1('0xd')](projects,['id',_0x4e2fb2['id']]);if(_0x5a2cce>-0x1){if(_0x4e2fb2[_0xdac1('0xe')]===!![]){projects[_0xdac1('0xf')](_0x5a2cce,0x1);}else{projects[_0x5a2cce]=_0x4e2fb2;}}else{projects[_0xdac1('0x10')](_0x4e2fb2);}}catch(_0xaa2926){logger[_0xdac1('0xb')](_0xaa2926[_0xdac1('0xc')]);}}function listeningHandler(){console[_0xdac1('0x11')](_0xdac1('0x12'),config[_0xdac1('0x6')][_0xdac1('0x13')]);logger['info'](util['format'](_0xdac1('0x14'),config['agi']['ip'],config[_0xdac1('0x6')][_0xdac1('0x13')]));}function errorHandler(_0x4c4129){if(_0x4c4129&&_0x4c4129[_0xdac1('0x15')]&&_0x4c4129[_0xdac1('0x16')]){logger[_0xdac1('0xb')](util[_0xdac1('0x17')](_0xdac1('0x18'),_0x4c4129[_0xdac1('0x15')],_0x4c4129[_0xdac1('0x16')]));}else{logger[_0xdac1('0xb')](util[_0xdac1('0x17')](_0xdac1('0x19'),_0x4c4129[_0xdac1('0xc')]));}}function closeHandler(){logger[_0xdac1('0x1a')](util['format'](_0xdac1('0x1b'),this['arg_1'],this[_0xdac1('0x1c')],this[_0xdac1('0x1d')],this[_0xdac1('0x1e')],this[_0xdac1('0x1f')]));try{createSquareReport(this);}catch(_0x2220cb){logger[_0xdac1('0xb')](_0x2220cb['stack']);}}function timeoutHandler(){logger[_0xdac1('0x1a')](util[_0xdac1('0x17')](_0xdac1('0x20'),this['arg_1'],this[_0xdac1('0x1c')],this[_0xdac1('0x1d')],this[_0xdac1('0x1e')],this[_0xdac1('0x1f')]));}function hangupHandler(){logger[_0xdac1('0x1a')](util[_0xdac1('0x17')](_0xdac1('0x21'),this[_0xdac1('0x22')],this[_0xdac1('0x1c')],this['callerid'],this[_0xdac1('0x1e')],this['uniqueid']));this[_0xdac1('0x23')]=!![];}function createSquareReport(_0x21bdcf,_0x279f3f){rpc['createSquareReport'](_0x21bdcf)['then'](function(_0x2d1bb2){if(_0x279f3f){_0x279f3f(null,_0x2d1bb2);}})['catch'](function(_0x24d2aa){if(_0x279f3f){_0x279f3f(null,_0x24d2aa);}});}function setChannelVariables(_0x4739bd){for(var _0x552fd0 in _0x4739bd){if(_0x4739bd[_0xdac1('0x24')](_0x552fd0)){if(_0x552fd0['indexOf'](_0xdac1('0x25'))===0x0){_0x4739bd[_0x552fd0[_0xdac1('0x26')](0x4)]=_0x4739bd[_0x552fd0];delete _0x4739bd[_0x552fd0];}}}}function agiHandler(_0x1b3969){logger[_0xdac1('0x27')](_0xdac1('0x28'),JSON[_0xdac1('0x29')](_0x1b3969,null,0x2));logger[_0xdac1('0x1a')](util[_0xdac1('0x17')](_0xdac1('0x2a'),_0x1b3969[_0xdac1('0x22')],_0x1b3969[_0xdac1('0x1c')],_0x1b3969[_0xdac1('0x1d')],_0x1b3969[_0xdac1('0x1e')],_0x1b3969[_0xdac1('0x1f')]));_0x1b3969['on'](_0xdac1('0xb'),errorHandler);_0x1b3969['on']('close',closeHandler);_0x1b3969['on'](_0xdac1('0x2b'),timeoutHandler);_0x1b3969[_0xdac1('0x23')]=![];_0x1b3969['on']('hangup',hangupHandler);var _0x361067=_['find'](projects,[_0xdac1('0x15'),_0x1b3969[_0xdac1('0x22')]]);if(!_0x361067)return Project[_0xdac1('0x2c')](_0x1b3969);if(!_0x361067[_0xdac1('0x2d')])return Project[_0xdac1('0x2e')](_0x1b3969);return Project[_0xdac1('0x2f')](_0x361067,_0x1b3969);}function main(){var _0x3f707d;return utilLicense[_0xdac1('0x30')]()['then'](function(_0x2b72ef){if(!_0x2b72ef)return;if(_0x2b72ef[_0xdac1('0x31')]){if(_0x2b72ef[_0xdac1('0x32')]&&_0x2b72ef[_0xdac1('0x32')]>0x0){logger[_0xdac1('0x1a')](util[_0xdac1('0x17')](_0xdac1('0x33'),_0x2b72ef['callysquare']));_0x3f707d=_0x2b72ef[_0xdac1('0x32')];}else{logger[_0xdac1('0x1a')](_0xdac1('0x34'));}}else{logger['info'](_0xdac1('0x35'));_0x3f707d=-0x1;}})[_0xdac1('0x36')](function(){return Project[_0xdac1('0x37')]();})[_0xdac1('0x36')](function(_0xf806b2){projects=_0xf806b2;return;})[_0xdac1('0x38')](function(_0x1fe37c){logger[_0xdac1('0xb')](_0xdac1('0x39'),_0x1fe37c['stack']);})['finally'](function(){var _0xdde223=require('./server')(config[_0xdac1('0x6')][_0xdac1('0x13')],config[_0xdac1('0x6')]['ip'],_0x3f707d);_0xdde223['on'](_0xdac1('0xb'),errorHandler);_0xdde223['on'](_0xdac1('0x3a'),listeningHandler);_0xdde223['on'](_0xdac1('0x3b'),connectionHandler);_0xdde223['on'](_0xdac1('0x3c'),closeHandler);});}main(); \ No newline at end of file +var _0x247b=['indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','lodash','util','../../config/environment','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','findIndex','push','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x247b,0xc4));var _0xb247=function(_0x5dfd95,_0x5cb476){_0x5dfd95=_0x5dfd95-0x0;var _0xc24ef3=_0x247b[_0x5dfd95];return _0xc24ef3;};'use strict';var _=require(_0xb247('0x0'));var syncho=require('syncho');var util=require(_0xb247('0x1'));var config=require(_0xb247('0x2'));var logger=require('../../config/logger')(_0xb247('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0xb247('0x4'));var Project=require(_0xb247('0x5'));var AGIEmitter=require(_0xb247('0x6'))[_0xb247('0x7')];var projects=[];config['agi']=_[_0xb247('0x8')](config[_0xb247('0x3')],{'ip':_0xb247('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x553469){process[_0xb247('0xa')](function(){syncho(function(){try{setChannelVariables(_0x553469);agiHandler(_0x553469);}catch(_0x3b1121){logger[_0xb247('0xb')](_0x3b1121['stack']);}});});}function projectUpdateHandler(_0x57f5e7){try{var _0x5ae3c3=_[_0xb247('0xc')](projects,['id',_0x57f5e7['id']]);if(_0x5ae3c3>-0x1){if(_0x57f5e7['deleted']===!![]){projects['splice'](_0x5ae3c3,0x1);}else{projects[_0x5ae3c3]=_0x57f5e7;}}else{projects[_0xb247('0xd')](_0x57f5e7);}}catch(_0x2a9b27){logger[_0xb247('0xb')](_0x2a9b27[_0xb247('0xe')]);}}function listeningHandler(){console[_0xb247('0xf')](_0xb247('0x10'),config['agi'][_0xb247('0x11')]);logger[_0xb247('0x12')](util[_0xb247('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0xb247('0x3')][_0xb247('0x11')]));}function errorHandler(_0x2ce349){if(_0x2ce349&&_0x2ce349[_0xb247('0x14')]&&_0x2ce349[_0xb247('0x15')]){logger[_0xb247('0xb')](util['format'](_0xb247('0x16'),_0x2ce349['name'],_0x2ce349[_0xb247('0x15')]));}else{logger[_0xb247('0xb')](util['format'](_0xb247('0x17'),_0x2ce349[_0xb247('0xe')]));}}function closeHandler(){logger[_0xb247('0x12')](util[_0xb247('0x13')](_0xb247('0x18'),this[_0xb247('0x19')],this[_0xb247('0x1a')],this[_0xb247('0x1b')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x48f506){logger[_0xb247('0xb')](_0x48f506['stack']);}}function timeoutHandler(){logger[_0xb247('0x12')](util[_0xb247('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb247('0x19')],this[_0xb247('0x1a')],this[_0xb247('0x1b')],this[_0xb247('0x1c')],this[_0xb247('0x1d')]));}function hangupHandler(){logger[_0xb247('0x12')](util[_0xb247('0x13')](_0xb247('0x1e'),this['arg_1'],this['calleridname'],this[_0xb247('0x1b')],this[_0xb247('0x1c')],this['uniqueid']));this[_0xb247('0x1f')]=!![];}function createSquareReport(_0x269886,_0x4d362e){rpc[_0xb247('0x20')](_0x269886)[_0xb247('0x21')](function(_0x1612d8){if(_0x4d362e){_0x4d362e(null,_0x1612d8);}})[_0xb247('0x22')](function(_0x4d4eb0){if(_0x4d362e){_0x4d362e(null,_0x4d4eb0);}});}function setChannelVariables(_0x3e5b24){for(var _0x3bf726 in _0x3e5b24){if(_0x3e5b24[_0xb247('0x23')](_0x3bf726)){if(_0x3bf726[_0xb247('0x24')](_0xb247('0x25'))===0x0){_0x3e5b24[_0x3bf726[_0xb247('0x26')](0x4)]=_0x3e5b24[_0x3bf726];delete _0x3e5b24[_0x3bf726];}}}}function agiHandler(_0x2e0193){logger[_0xb247('0x27')](_0xb247('0x28'),JSON[_0xb247('0x29')](_0x2e0193,null,0x2));logger[_0xb247('0x12')](util[_0xb247('0x13')](_0xb247('0x2a'),_0x2e0193[_0xb247('0x19')],_0x2e0193[_0xb247('0x1a')],_0x2e0193[_0xb247('0x1b')],_0x2e0193['dnid'],_0x2e0193[_0xb247('0x1d')]));_0x2e0193['on'](_0xb247('0xb'),errorHandler);_0x2e0193['on'](_0xb247('0x2b'),closeHandler);_0x2e0193['on'](_0xb247('0x2c'),timeoutHandler);_0x2e0193[_0xb247('0x1f')]=![];_0x2e0193['on'](_0xb247('0x2d'),hangupHandler);var _0x1c80a3=_['find'](projects,[_0xb247('0x14'),_0x2e0193['arg_1']]);if(!_0x1c80a3)return Project['handleNotFound'](_0x2e0193);if(!_0x1c80a3[_0xb247('0x2e')])return Project[_0xb247('0x2f')](_0x2e0193);return Project[_0xb247('0x30')](_0x1c80a3,_0x2e0193);}function main(){var _0xe84688;return utilLicense['getLicense']()[_0xb247('0x21')](function(_0x4b7e05){if(!_0x4b7e05)return;if(_0x4b7e05[_0xb247('0x31')]){if(_0x4b7e05[_0xb247('0x32')]&&_0x4b7e05[_0xb247('0x32')]>0x0){logger['info'](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x4b7e05['callysquare']));_0xe84688=_0x4b7e05[_0xb247('0x32')];}else{logger[_0xb247('0x12')](_0xb247('0x33'));}}else{logger[_0xb247('0x12')](_0xb247('0x34'));_0xe84688=-0x1;}})[_0xb247('0x21')](function(){return Project[_0xb247('0x35')]();})[_0xb247('0x21')](function(_0x30c965){projects=_0x30c965;return;})[_0xb247('0x22')](function(_0x45b499){logger['error'](_0xb247('0x36'),_0x45b499['stack']);})[_0xb247('0x37')](function(){var _0x24c71d=require(_0xb247('0x38'))(config['agi'][_0xb247('0x11')],config[_0xb247('0x3')]['ip'],_0xe84688);_0x24c71d['on'](_0xb247('0xb'),errorHandler);_0x24c71d['on']('listening',listeningHandler);_0x24c71d['on'](_0xb247('0x39'),connectionHandler);_0x24c71d['on'](_0xb247('0x2b'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 38c6c33..848e060 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 _0x47b4=['jayson/promise','client','http','request','then','error','message','result'];(function(_0x5b9f44,_0x4f041e){var _0x3a5fee=function(_0x850a5){while(--_0x850a5){_0x5b9f44['push'](_0x5b9f44['shift']());}};_0x3a5fee(++_0x4f041e);}(_0x47b4,0x100));var _0x447b=function(_0x2ae3ff,_0x3dd1bc){_0x2ae3ff=_0x2ae3ff-0x0;var _0x156a28=_0x47b4[_0x2ae3ff];return _0x156a28;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x447b('0x0'));var client=jayson[_0x447b('0x1')][_0x447b('0x2')]({'port':0x232b});function request(_0x48d3d3,_0x435407){return new BPromise(function(_0x391779,_0x46625f){return client[_0x447b('0x3')](_0x48d3d3,_0x435407)[_0x447b('0x4')](function(_0xf1b5d1){if(_0xf1b5d1['error']){return _0x46625f(_0xf1b5d1[_0x447b('0x5')][_0x447b('0x6')]);}else{return _0x391779(_0xf1b5d1[_0x447b('0x7')]);}})['catch'](function(_0x562d3d){return _0x46625f(_0x562d3d);});});}exports['sendMailMessage']=function(_0x10b585,_0x440978){return request('SendMail',{'account':_0x10b585,'message':_0x440978});}; \ No newline at end of file +var _0x16a6=['result','catch','sendMailMessage','SendMail','bluebird','client','then','error'];(function(_0x2d400c,_0x3f0099){var _0x5c8682=function(_0x21168d){while(--_0x21168d){_0x2d400c['push'](_0x2d400c['shift']());}};_0x5c8682(++_0x3f0099);}(_0x16a6,0x164));var _0x616a=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x16a6[_0x4503df];return _0x3f1b2b;};'use strict';var BPromise=require(_0x616a('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x616a('0x1')]['http']({'port':0x232b});function request(_0x5e2390,_0x1578e){return new BPromise(function(_0x2658b5,_0x329010){return client['request'](_0x5e2390,_0x1578e)[_0x616a('0x2')](function(_0x1ca466){if(_0x1ca466[_0x616a('0x3')]){return _0x329010(_0x1ca466[_0x616a('0x3')]['message']);}else{return _0x2658b5(_0x1ca466[_0x616a('0x4')]);}})[_0x616a('0x5')](function(_0x107643){return _0x329010(_0x107643);});});}exports[_0x616a('0x6')]=function(_0x7c7143,_0x28d067){return request(_0x616a('0x7'),{'account':_0x7c7143,'message':_0x28d067});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 208a98f..93aafc7 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x440b=['[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','moment','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','evtHangup','response','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS','clear'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x440b,0x17a));var _0xb440=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x440b[_0xfc0976];return _0x23579f;};'use strict';var _=require(_0xb440('0x0'));var moment=require(_0xb440('0x1'));var parser=require('xml2json');var util=require(_0xb440('0x2'));var logger=require(_0xb440('0x3'))(_0xb440('0x4'));var rpc=require(_0xb440('0x5'));var mailRpc=require(_0xb440('0x6'));var Graph=require(_0xb440('0x7'));var Vertices=require(_0xb440('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x177eb6){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x177eb6[_0xb440('0x9')]);return[];});}function addVertex(_0x4c4c9e,_0x32fa7e,_0xb88b98){_0x32fa7e[_0xb440('0xa')]=_0xb88b98;if(_0x32fa7e[_0xb440('0xb')](_0xb440('0xc'))){_0x32fa7e[_0xb440('0xd')]=parseInt(_0x32fa7e[_0xb440('0xc')],0xa);}_0x4c4c9e['addVertex'](_[_0xb440('0xe')](_0x32fa7e,_0xb440('0xf')));}function initGraph(_0x66a4cc,_0x2f8f58){var _0x3442f4=new Graph();for(var _0x3c41f1 in _0x66a4cc){if(_0x66a4cc[_0xb440('0xb')](_0x3c41f1)){if(_[_0xb440('0x10')](_0x66a4cc[_0x3c41f1])){for(var _0x46a5e6=0x0;_0x46a5e6<_0x66a4cc[_0x3c41f1][_0xb440('0x11')];_0x46a5e6+=0x1){addVertex(_0x3442f4,_0x66a4cc[_0x3c41f1][_0x46a5e6],_0x3c41f1);}}else{addVertex(_0x3442f4,_0x66a4cc[_0x3c41f1],_0x3c41f1);}}}for(var _0x1a3c3b=0x0;_0x1a3c3b<_0x2f8f58[_0xb440('0x11')];_0x1a3c3b+=0x1){if(_0x2f8f58[_0x1a3c3b][_0xb440('0x12')]&&_0x2f8f58[_0x1a3c3b][_0xb440('0x13')]){_0x3442f4[_0xb440('0x14')](_0x2f8f58[_0x1a3c3b][_0xb440('0x12')],_0x2f8f58[_0x1a3c3b][_0xb440('0x13')],_0x2f8f58[_0x1a3c3b][_0xb440('0x15')]);}}return _0x3442f4;}function getRoot(_0x23e2fa){return parser[_0xb440('0x16')](_0x23e2fa,{'object':!![]})[_0xb440('0x17')][_0xb440('0x18')];}function inspect(_0x5e0094){return util['inspect'](_0x5e0094,{'showHidden':![],'depth':null});}function initialize(_0x541a4a,_0x4139e7){var _0x353f32=getRoot(_0x541a4a[_0xb440('0x19')]);if(!_0x353f32||!_0x353f32[_0xb440('0x1a')])return;var _0x3c9f37,_0x263008,_0x21204a;logger[_0xb440('0x1b')](_0xb440('0x18'),JSON[_0xb440('0x1c')](_0x353f32,null,0x2));_0x4139e7[_0xb440('0x1d')]=moment()[_0xb440('0x1e')](_0xb440('0x1f'));_0x3c9f37=initGraph(_[_0xb440('0xe')](_0x353f32,_0xb440('0xf')),_0x353f32['mxCell']);_0x263008=new Vertices(_0x4139e7,rpc,mailRpc);logger[_0xb440('0x20')](util[_0xb440('0x1e')](_0xb440('0x21'),_0x4139e7['arg_1'],_0x4139e7[_0xb440('0x22')],_0x4139e7[_0xb440('0x23')],_0x4139e7['dnid'],_0x4139e7['uniqueid']));_0x3c9f37['traverseBFS'](_0x353f32['start']['id'],function(_0x4186c){try{_0x4186c=_0x263008['clear'](_0x4186c);logger[_0xb440('0x1b')](_0xb440('0x24'),JSON['stringify'](_0x4186c,null,0x2));if(_0x4186c[_0xb440('0xa')]===_0xb440('0x25')){logger[_0xb440('0x20')](_0xb440('0x26'));_0x4139e7[_0xb440('0x27')]=_0x4186c[_0xb440('0x27')]||_0x4139e7[_0xb440('0x27')];_0x4139e7[_0xb440('0x28')]=_0x4186c['extension'];_0x4139e7[_0xb440('0x29')]=_0x4186c[_0xb440('0x29')]?_0x4186c['priority']-0x1:0x1;return null;}else if(_0x4186c&&_0x263008[_0x4186c[_0xb440('0xa')]]){_0x21204a=_0x263008[_0x4186c[_0xb440('0xa')]](_0x4186c);logger[_0xb440('0x20')]('response',JSON[_0xb440('0x1c')](_0x21204a,null,0x2));if(_0x21204a&&_0x21204a['code']===AGI_CODE_SUCCESS&&_0x21204a[_0xb440('0x2a')]!==AGI_RESULT_ERROR&&!_0x4139e7[_0xb440('0x2b')]){logger[_0xb440('0x1b')](_0xb440('0x2c'),inspect(_0x21204a));return _[_0xb440('0x2d')](_0x21204a['result'])?null:_0x21204a[_0xb440('0x2a')][_0xb440('0x2e')]();}else{logger[_0xb440('0x2f')](_0xb440('0x2c'),inspect(_0x21204a));return null;}}else{logger[_0xb440('0x2f')](_0xb440('0x30'));return null;}}catch(_0x5ade90){logger[_0xb440('0x2f')](_0x5ade90[_0xb440('0x9')]);return null;}});if(_0x353f32[_0xb440('0x31')]){logger['info'](util['format'](_0xb440('0x32'),_0x4139e7[_0xb440('0x33')],_0x4139e7['calleridname'],_0x4139e7[_0xb440('0x23')],_0x4139e7[_0xb440('0x34')],_0x4139e7[_0xb440('0x35')]));_0x3c9f37[_0xb440('0x36')](_0x353f32[_0xb440('0x31')]['id'],function(_0x267723){try{_0x267723=_0x263008[_0xb440('0x37')](_0x267723);logger[_0xb440('0x1b')](_0xb440('0x24'),JSON[_0xb440('0x1c')](_0x267723,null,0x2));if(_0x267723&&_0x263008[_0x267723['agicommand']]){_0x21204a=_0x263008[_0x267723[_0xb440('0xa')]](_0x267723);if(_0x21204a){logger[_0xb440('0x1b')](_0xb440('0x2c'),inspect(_0x21204a));return _[_0xb440('0x2d')](_0x21204a['result'])?null:_0x21204a[_0xb440('0x2a')]['toString']();}else{logger[_0xb440('0x2f')](_0xb440('0x2c'),inspect(_0x21204a));return null;}}else{logger['error'](_0xb440('0x30'));return null;}}catch(_0x24ec5e){logger['error'](_0x24ec5e[_0xb440('0x9')]);return null;}});}logger[_0xb440('0x20')](util['format'](_0xb440('0x38'),_0x4139e7[_0xb440('0x33')],_0x4139e7[_0xb440('0x22')],_0x4139e7[_0xb440('0x23')],_0x4139e7['dnid'],_0x4139e7[_0xb440('0x35')]));logger[_0xb440('0x20')](util[_0xb440('0x1e')](_0xb440('0x39'),_0x4139e7[_0xb440('0x27')],_0x4139e7[_0xb440('0x28')],parseInt(_0x4139e7[_0xb440('0x29')],0xa)+0x1));_0x4139e7[_0xb440('0x3a')](_0x4139e7['context'],_0x4139e7[_0xb440('0x28')],parseInt(_0x4139e7[_0xb440('0x29')],0xa)+0x1);_0x4139e7[_0xb440('0x3b')]();}function handleNotFound(_0x585164){logger[_0xb440('0x2f')](util[_0xb440('0x1e')](_0xb440('0x3c'),_0x585164[_0xb440('0x33')]));_0x585164[_0xb440('0x3a')](_0x585164[_0xb440('0x27')],_0x585164[_0xb440('0x28')],parseInt(_0x585164[_0xb440('0x29')],0xa)+0x1);_0x585164['close']();}function handleUnpublished(_0x56ae81){logger['error'](util[_0xb440('0x1e')](_0xb440('0x3d'),_0x56ae81['arg_1']));_0x56ae81['continueAt'](_0x56ae81[_0xb440('0x27')],_0x56ae81['extension'],parseInt(_0x56ae81[_0xb440('0x29')],0xa)+0x1);_0x56ae81['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x93f4=['info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','close','continueAt','exports','xml2json','../../config/logger','agi','./rpc','./graph','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','source','target','value','toJson','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','vertex','gotoc'];(function(_0x164bf1,_0x1d2e1d){var _0xfd8cea=function(_0x2c8668){while(--_0x2c8668){_0x164bf1['push'](_0x164bf1['shift']());}};_0xfd8cea(++_0x1d2e1d);}(_0x93f4,0x1dc));var _0x493f=function(_0x5789f4,_0x19db7c){_0x5789f4=_0x5789f4-0x0;var _0x4598e6=_0x93f4[_0x5789f4];return _0x4598e6;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x493f('0x0'));var util=require('util');var logger=require(_0x493f('0x1'))(_0x493f('0x2'));var rpc=require(_0x493f('0x3'));var mailRpc=require('./mailRpc');var Graph=require(_0x493f('0x4'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x493f('0x5')]()['catch'](function(_0x2fede3){logger['error'](_0x493f('0x6'),_0x2fede3[_0x493f('0x7')]);return[];});}function addVertex(_0x21b820,_0x50c675,_0x167a87){_0x50c675[_0x493f('0x8')]=_0x167a87;if(_0x50c675[_0x493f('0x9')](_0x493f('0xa'))){_0x50c675[_0x493f('0xb')]=parseInt(_0x50c675[_0x493f('0xa')],0xa);}_0x21b820[_0x493f('0xc')](_[_0x493f('0xd')](_0x50c675,_0x493f('0xe')));}function initGraph(_0xe571f7,_0x376c96){var _0x269498=new Graph();for(var _0x577548 in _0xe571f7){if(_0xe571f7[_0x493f('0x9')](_0x577548)){if(_[_0x493f('0xf')](_0xe571f7[_0x577548])){for(var _0x221cab=0x0;_0x221cab<_0xe571f7[_0x577548]['length'];_0x221cab+=0x1){addVertex(_0x269498,_0xe571f7[_0x577548][_0x221cab],_0x577548);}}else{addVertex(_0x269498,_0xe571f7[_0x577548],_0x577548);}}}for(var _0x5e20f4=0x0;_0x5e20f4<_0x376c96['length'];_0x5e20f4+=0x1){if(_0x376c96[_0x5e20f4][_0x493f('0x10')]&&_0x376c96[_0x5e20f4][_0x493f('0x11')]){_0x269498['addEdge'](_0x376c96[_0x5e20f4][_0x493f('0x10')],_0x376c96[_0x5e20f4][_0x493f('0x11')],_0x376c96[_0x5e20f4][_0x493f('0x12')]);}}return _0x269498;}function getRoot(_0x18583c){return parser[_0x493f('0x13')](_0x18583c,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x5d419e){return util[_0x493f('0x14')](_0x5d419e,{'showHidden':![],'depth':null});}function initialize(_0x2d8365,_0x42fae6){var _0x3fd1b1=getRoot(_0x2d8365[_0x493f('0x15')]);if(!_0x3fd1b1||!_0x3fd1b1[_0x493f('0x16')])return;var _0x23eb28,_0x708d78,_0xebfa9a;logger[_0x493f('0x17')]('root',JSON[_0x493f('0x18')](_0x3fd1b1,null,0x2));_0x42fae6[_0x493f('0x19')]=moment()['format'](_0x493f('0x1a'));_0x23eb28=initGraph(_[_0x493f('0xd')](_0x3fd1b1,_0x493f('0xe')),_0x3fd1b1[_0x493f('0xe')]);_0x708d78=new Vertices(_0x42fae6,rpc,mailRpc);logger['info'](util[_0x493f('0x1b')](_0x493f('0x1c'),_0x42fae6[_0x493f('0x1d')],_0x42fae6[_0x493f('0x1e')],_0x42fae6['callerid'],_0x42fae6[_0x493f('0x1f')],_0x42fae6[_0x493f('0x20')]));_0x23eb28[_0x493f('0x21')](_0x3fd1b1[_0x493f('0x16')]['id'],function(_0x53a2e5){try{_0x53a2e5=_0x708d78[_0x493f('0x22')](_0x53a2e5);logger[_0x493f('0x17')](_0x493f('0x23'),JSON[_0x493f('0x18')](_0x53a2e5,null,0x2));if(_0x53a2e5[_0x493f('0x8')]===_0x493f('0x24')){logger[_0x493f('0x25')](_0x493f('0x26'));_0x42fae6[_0x493f('0x27')]=_0x53a2e5[_0x493f('0x27')]||_0x42fae6['context'];_0x42fae6[_0x493f('0x28')]=_0x53a2e5['extension'];_0x42fae6[_0x493f('0x29')]=_0x53a2e5[_0x493f('0x29')]?_0x53a2e5[_0x493f('0x29')]-0x1:0x1;return null;}else if(_0x53a2e5&&_0x708d78[_0x53a2e5[_0x493f('0x8')]]){_0xebfa9a=_0x708d78[_0x53a2e5[_0x493f('0x8')]](_0x53a2e5);logger[_0x493f('0x25')](_0x493f('0x2a'),JSON[_0x493f('0x18')](_0xebfa9a,null,0x2));if(_0xebfa9a&&_0xebfa9a[_0x493f('0x2b')]===AGI_CODE_SUCCESS&&_0xebfa9a[_0x493f('0x2c')]!==AGI_RESULT_ERROR&&!_0x42fae6['evtHangup']){logger[_0x493f('0x17')](_0x493f('0x2a'),inspect(_0xebfa9a));return _[_0x493f('0x2d')](_0xebfa9a['result'])?null:_0xebfa9a['result'][_0x493f('0x2e')]();}else{logger[_0x493f('0x2f')](_0x493f('0x2a'),inspect(_0xebfa9a));return null;}}else{logger['error'](_0x493f('0x30'));return null;}}catch(_0x3be9ef){logger['error'](_0x3be9ef[_0x493f('0x7')]);return null;}});if(_0x3fd1b1[_0x493f('0x31')]){logger[_0x493f('0x25')](util[_0x493f('0x1b')](_0x493f('0x32'),_0x42fae6['arg_1'],_0x42fae6[_0x493f('0x1e')],_0x42fae6[_0x493f('0x33')],_0x42fae6[_0x493f('0x1f')],_0x42fae6['uniqueid']));_0x23eb28[_0x493f('0x21')](_0x3fd1b1[_0x493f('0x31')]['id'],function(_0x30efa2){try{_0x30efa2=_0x708d78[_0x493f('0x22')](_0x30efa2);logger[_0x493f('0x17')](_0x493f('0x23'),JSON[_0x493f('0x18')](_0x30efa2,null,0x2));if(_0x30efa2&&_0x708d78[_0x30efa2['agicommand']]){_0xebfa9a=_0x708d78[_0x30efa2[_0x493f('0x8')]](_0x30efa2);if(_0xebfa9a){logger[_0x493f('0x17')](_0x493f('0x2a'),inspect(_0xebfa9a));return _[_0x493f('0x2d')](_0xebfa9a[_0x493f('0x2c')])?null:_0xebfa9a[_0x493f('0x2c')][_0x493f('0x2e')]();}else{logger[_0x493f('0x2f')]('response',inspect(_0xebfa9a));return null;}}else{logger[_0x493f('0x2f')](_0x493f('0x30'));return null;}}catch(_0x1f8210){logger[_0x493f('0x2f')](_0x1f8210['stack']);return null;}});}logger['info'](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42fae6[_0x493f('0x1d')],_0x42fae6['calleridname'],_0x42fae6[_0x493f('0x33')],_0x42fae6['dnid'],_0x42fae6[_0x493f('0x20')]));logger['info'](util['format'](_0x493f('0x34'),_0x42fae6[_0x493f('0x27')],_0x42fae6[_0x493f('0x28')],parseInt(_0x42fae6[_0x493f('0x29')],0xa)+0x1));_0x42fae6['continueAt'](_0x42fae6[_0x493f('0x27')],_0x42fae6[_0x493f('0x28')],parseInt(_0x42fae6[_0x493f('0x29')],0xa)+0x1);_0x42fae6['close']();}function handleNotFound(_0x1e0e43){logger[_0x493f('0x2f')](util[_0x493f('0x1b')](_0x493f('0x35'),_0x1e0e43[_0x493f('0x1d')]));_0x1e0e43['continueAt'](_0x1e0e43[_0x493f('0x27')],_0x1e0e43[_0x493f('0x28')],parseInt(_0x1e0e43[_0x493f('0x29')],0xa)+0x1);_0x1e0e43[_0x493f('0x36')]();}function handleUnpublished(_0x2a7855){logger[_0x493f('0x2f')](util[_0x493f('0x1b')]('Project\x20%s\x20not\x20published',_0x2a7855[_0x493f('0x1d')]));_0x2a7855[_0x493f('0x37')](_0x2a7855[_0x493f('0x27')],_0x2a7855[_0x493f('0x28')],parseInt(_0x2a7855[_0x493f('0x29')],0xa)+0x1);_0x2a7855[_0x493f('0x36')]();}module[_0x493f('0x38')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 0955bb7..bbc3d15 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 _0xa216=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','exports','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x3d2aab,_0x5ef2ab){var _0x54ae2e=function(_0x79af68){while(--_0x79af68){_0x3d2aab['push'](_0x3d2aab['shift']());}};_0x54ae2e(++_0x5ef2ab);}(_0xa216,0xf4));var _0x6a21=function(_0x44abd2,_0x2d34c8){_0x44abd2=_0x44abd2-0x0;var _0x4938dc=_0xa216[_0x44abd2];return _0x4938dc;};'use strict';var util=require('util');var Transform=require(_0x6a21('0x0'))[_0x6a21('0x1')];function AGIReply(_0x195742){Transform[_0x6a21('0x2')](this,_0x195742);this[_0x6a21('0x3')]='';this[_0x6a21('0x4')]=![];}util[_0x6a21('0x5')](AGIReply,Transform);AGIReply[_0x6a21('0x6')][_0x6a21('0x7')]=function(_0x58e6f4,_0x20bd8d,_0x1f7406){var _0x5c728a='\x0a',_0x4aaa02=['\x0a\x0a',_0x6a21('0x8')],_0x5cdb92=-0x1,_0x3f6b1d=-0x1,_0x5e573c='',_0x5eb2b3=0x0,_0x18722f='',_0x2ffb01='';this[_0x6a21('0x3')]+=_0x58e6f4[_0x6a21('0x9')]();_0x18722f=this[_0x6a21('0x3')];if(!this['_inBody']){_0x5eb2b3=0x0;while(_0x4aaa02[_0x5eb2b3]){while((_0x3f6b1d=_0x18722f[_0x6a21('0xa')](_0x4aaa02[_0x5eb2b3]))!=-0x1){_0x5e573c=_0x4aaa02[_0x5eb2b3];_0x2ffb01=_0x18722f[_0x6a21('0xb')](0x0,_0x3f6b1d);_0x18722f=_0x18722f[_0x6a21('0xb')](_0x3f6b1d+_0x5e573c[_0x6a21('0xc')]);var _0x28eef8=_0x2ffb01['split'](_0x5c728a),_0x1a036c=0x0,_0x5c1536={},_0xabe87b='',_0x850cd0='',_0x4ffb65=-0x1;while(_0x28eef8[_0x1a036c]){_0x4ffb65=_0x28eef8[_0x1a036c][_0x6a21('0xa')](':');if(_0x4ffb65!=-0x1){_0xabe87b=_0x28eef8[_0x1a036c][_0x6a21('0xd')](0x0,_0x4ffb65)[_0x6a21('0xe')]();_0x850cd0=_0x28eef8[_0x1a036c][_0x6a21('0xd')](_0x4ffb65+0x1)[_0x6a21('0xe')]();if(_0xabe87b[_0x6a21('0xc')]>0x0){_0x5c1536[_0xabe87b]=_0x850cd0;}}else{}_0x1a036c++;}this[_0x6a21('0xf')](_0x6a21('0x10'),_0x5c1536);this[_0x6a21('0x4')]=!![];}_0x5eb2b3++;}this[_0x6a21('0x3')]=_0x18722f;}else{while((_0x5cdb92=_0x18722f[_0x6a21('0xa')](_0x5c728a))!=-0x1){_0x2ffb01=_0x18722f[_0x6a21('0xb')](0x0,_0x5cdb92);this[_0x6a21('0xf')]('line',_0x2ffb01);_0x18722f=_0x18722f[_0x6a21('0xb')](_0x5cdb92+_0x5c728a[_0x6a21('0xc')]);}this[_0x6a21('0x3')]=_0x18722f;}_0x1f7406();};module[_0x6a21('0x11')]=AGIReply; \ No newline at end of file +var _0x4561=['_inBody','prototype','_transform','toString','substring','length','split','indexOf','trim','emit','headers','line','exports','_localBuffer'];(function(_0x17310d,_0xd4ce28){var _0x520fc4=function(_0x526cab){while(--_0x526cab){_0x17310d['push'](_0x17310d['shift']());}};_0x520fc4(++_0xd4ce28);}(_0x4561,0x1a3));var _0x1456=function(_0x1a0b73,_0x3c607b){_0x1a0b73=_0x1a0b73-0x0;var _0x38bfa8=_0x4561[_0x1a0b73];return _0x38bfa8;};'use strict';var util=require('util');var Transform=require('stream')['Transform'];function AGIReply(_0x461f31){Transform['call'](this,_0x461f31);this[_0x1456('0x0')]='';this[_0x1456('0x1')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x1456('0x2')][_0x1456('0x3')]=function(_0x15fbf1,_0x401509,_0xde8113){var _0x4da317='\x0a',_0x477688=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x446bf9=-0x1,_0xf359cd=-0x1,_0x42e9c6='',_0x580f28=0x0,_0x59773e='',_0x42061e='';this[_0x1456('0x0')]+=_0x15fbf1[_0x1456('0x4')]();_0x59773e=this[_0x1456('0x0')];if(!this['_inBody']){_0x580f28=0x0;while(_0x477688[_0x580f28]){while((_0xf359cd=_0x59773e['indexOf'](_0x477688[_0x580f28]))!=-0x1){_0x42e9c6=_0x477688[_0x580f28];_0x42061e=_0x59773e[_0x1456('0x5')](0x0,_0xf359cd);_0x59773e=_0x59773e[_0x1456('0x5')](_0xf359cd+_0x42e9c6[_0x1456('0x6')]);var _0x7daaeb=_0x42061e[_0x1456('0x7')](_0x4da317),_0x20a6ea=0x0,_0x53a585={},_0x3c2b8c='',_0xca39d0='',_0xfb89de=-0x1;while(_0x7daaeb[_0x20a6ea]){_0xfb89de=_0x7daaeb[_0x20a6ea][_0x1456('0x8')](':');if(_0xfb89de!=-0x1){_0x3c2b8c=_0x7daaeb[_0x20a6ea]['slice'](0x0,_0xfb89de)[_0x1456('0x9')]();_0xca39d0=_0x7daaeb[_0x20a6ea]['slice'](_0xfb89de+0x1)[_0x1456('0x9')]();if(_0x3c2b8c['length']>0x0){_0x53a585[_0x3c2b8c]=_0xca39d0;}}else{}_0x20a6ea++;}this[_0x1456('0xa')](_0x1456('0xb'),_0x53a585);this['_inBody']=!![];}_0x580f28++;}this[_0x1456('0x0')]=_0x59773e;}else{while((_0x446bf9=_0x59773e[_0x1456('0x8')](_0x4da317))!=-0x1){_0x42061e=_0x59773e[_0x1456('0x5')](0x0,_0x446bf9);this['emit'](_0x1456('0xc'),_0x42061e);_0x59773e=_0x59773e[_0x1456('0x5')](_0x446bf9+_0x4da317[_0x1456('0x6')]);}this[_0x1456('0x0')]=_0x59773e;}_0xde8113();};module[_0x1456('0xd')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c18c183..b50156c 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 _0x502a=['CloudProvider','email','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','moment','client','http','request','then','error','result','catch','GetSquareProjects','name','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x502a,0xd8));var _0xa502=function(_0x5bcdb8,_0xf781f8){_0x5bcdb8=_0x5bcdb8-0x0;var _0x303140=_0x502a[_0x5bcdb8];return _0x303140;};'use strict';var _=require(_0xa502('0x0'));var moment=require(_0xa502('0x1'));var jayson=require('jayson/promise');var client=jayson[_0xa502('0x2')][_0xa502('0x3')]({'port':0x2329});function request(_0x56597d,_0x4818e9){return new Promise(function(_0x309222,_0x5c89a6){return client[_0xa502('0x4')](_0x56597d,_0x4818e9)[_0xa502('0x5')](function(_0x15e29f){if(_0x15e29f[_0xa502('0x6')]){return _0x5c89a6(_0x15e29f[_0xa502('0x6')]['message']);}else{return _0x309222(_0x15e29f[_0xa502('0x7')]);}})[_0xa502('0x8')](function(_0x4d30f2){return _0x5c89a6(_0x4d30f2);});});}exports['getSquareProjects']=function(){return request(_0xa502('0x9'),{'options':{'raw':![],'attributes':['id',_0xa502('0xa'),'production']}});};exports[_0xa502('0xb')]=function(_0x12fb93){return request(_0xa502('0xc'),{'options':{'raw':![],'where':{'name':_0x12fb93},'attributes':['production']}});};exports[_0xa502('0xd')]=function(_0x9f2ebd){return request(_0xa502('0xe'),{'options':{'raw':![],'where':{'id':_0x9f2ebd},'include':[{'model':'MailServerOut','as':_0xa502('0xf'),'include':[{'model':_0xa502('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0xa502('0xa'),_0xa502('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x3dc656){return request(_0xa502('0xc'),{'options':{'where':{'id':_0x3dc656},'attributes':[_0xa502('0xa')]}});};exports['getVoiceQueueById']=function(_0x10a43c){return request(_0xa502('0x12'),{'options':{'where':{'id':_0x10a43c},'attributes':[_0xa502('0xa')]}});};exports['getVariableById']=function(_0x2db786){return request(_0xa502('0x13'),{'options':{'where':{'id':_0x2db786},'attributes':[_0xa502('0xa')]}});};exports[_0xa502('0x14')]=function(_0x15b8d8){return request(_0xa502('0x15'),{'options':{'where':{'id':_0x15b8d8},'attributes':[_0xa502('0x16')]}});};exports[_0xa502('0x17')]=function(_0x2e76b8){return request(_0xa502('0x18'),{'options':{'where':{'id':_0x2e76b8},'attributes':[_0xa502('0xa')]}});};exports[_0xa502('0x19')]=function(_0x1d2f3d){return request(_0xa502('0x1a'),{'options':{'where':{'phone':_0x1d2f3d[_0xa502('0x1b')]},'attributes':['id']}});};exports[_0xa502('0x1c')]=function(_0x35ed38){return request(_0xa502('0x1d'),{'options':{'where':{'id':_0x35ed38},'attributes':['name']}});};exports['getSoundById']=function(_0x23ddd7){return request(_0xa502('0x1e'),{'options':{'where':{'id':_0x23ddd7},'attributes':[_0xa502('0x1f')]}});};exports[_0xa502('0x20')]=function(_0x3cd020){return request(_0xa502('0x21'),{'options':{'raw':![],'where':{'id':_0x3cd020},'include':[{'model':_0xa502('0x22'),'as':_0xa502('0x23')}]}});};exports[_0xa502('0x24')]=function(_0x2dda13){return request(_0xa502('0x25'),{'options':{'where':{'id':_0x2dda13},'attributes':['id',_0xa502('0xa')]}});};exports['createSmsMessage']=function(_0x3edc73){return request(_0xa502('0x26'),{'body':_0x3edc73});};exports[_0xa502('0x27')]=function(_0x1fd61d){return request(_0xa502('0x28'),{'body':_0x1fd61d});};exports[_0xa502('0x29')]=function(_0x23a51d){return request('CreateSquareReport',{'body':_['merge'](_0x23a51d,{'project_name':_0x23a51d[_0xa502('0x2a')],'prev_project_name':_0x23a51d['arg_2']||'','is_subproject':_0x23a51d[_0xa502('0x2b')]?!![]:![],'leaveAt':moment()[_0xa502('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xa502('0x2d')]=function(_0x1fa8ff){return request('CreateSquareRecording',{'body':_0x1fa8ff});};exports[_0xa502('0x2e')]=function(_0x5d05b7){return request(_0xa502('0x2f'),{'body':_0x5d05b7});};exports['createCmContact']=function(_0x522122){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x522122[_0xa502('0x1b')],'ListId':_0x522122[_0xa502('0x30')]}}})['then'](function(_0x595e57){if(_0x595e57){return _0x595e57;}return request(_0xa502('0x31'),{'body':_0x522122});});};exports[_0xa502('0x32')]=function(_0x4fccea){return request(_0xa502('0x33'),{'options':{'where':{'id':_0x4fccea},'attributes':[_0xa502('0xa')]}});};exports['agentLogin']=function(_0xd1e939,_0x3e4a98){return request(_0xa502('0x34'),{'body':{'interface':_0x3e4a98},'options':{'where':_0xd1e939}});};exports[_0xa502('0x35')]=function(_0x4eae3e,_0x4f9d9c,_0x2c794e){return request(_0xa502('0x36'),{'body':{'type':_0x4f9d9c,'uniqueid':_0x2c794e},'options':{'where':_0x4eae3e}});};exports[_0xa502('0x37')]=function(_0x283c54){return request(_0xa502('0x38'),{'body':{},'options':{'where':_0x283c54}});};exports[_0xa502('0x39')]=function(_0x2bbfed){return request('LogoutUser',{'body':{},'options':{'where':_0x2bbfed}});}; \ No newline at end of file +var _0x956a=['agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','moment','jayson/promise','client','http','error','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','agentLogin','LoginUser'];(function(_0xdc0397,_0x20d1f1){var _0x553d02=function(_0x364781){while(--_0x364781){_0xdc0397['push'](_0xdc0397['shift']());}};_0x553d02(++_0x20d1f1);}(_0x956a,0xb6));var _0xa956=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x956a[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var moment=require(_0xa956('0x0'));var jayson=require(_0xa956('0x1'));var client=jayson[_0xa956('0x2')][_0xa956('0x3')]({'port':0x2329});function request(_0x12daaa,_0x24b6c4){return new Promise(function(_0x331696,_0x38c808){return client['request'](_0x12daaa,_0x24b6c4)['then'](function(_0x283ac0){if(_0x283ac0[_0xa956('0x4')]){return _0x38c808(_0x283ac0[_0xa956('0x4')]['message']);}else{return _0x331696(_0x283ac0[_0xa956('0x5')]);}})[_0xa956('0x6')](function(_0x1265dd){return _0x38c808(_0x1265dd);});});}exports[_0xa956('0x7')]=function(){return request(_0xa956('0x8'),{'options':{'raw':![],'attributes':['id',_0xa956('0x9'),_0xa956('0xa')]}});};exports['getSquareProject']=function(_0x1b5e23){return request(_0xa956('0xb'),{'options':{'raw':![],'where':{'name':_0x1b5e23},'attributes':['production']}});};exports[_0xa956('0xc')]=function(_0x10b1b0){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x10b1b0},'include':[{'model':'MailServerOut','as':_0xa956('0xd'),'include':[{'model':_0xa956('0xe'),'as':_0xa956('0xe')}]}],'attributes':['id','name',_0xa956('0xf')],'smtp':!![]}});};exports[_0xa956('0x10')]=function(_0x21d323){return request('ShowSquareProject',{'options':{'where':{'id':_0x21d323},'attributes':['name']}});};exports[_0xa956('0x11')]=function(_0x48ac9f){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x48ac9f},'attributes':[_0xa956('0x9')]}});};exports[_0xa956('0x12')]=function(_0x2044d2){return request('ShowVariable',{'options':{'where':{'id':_0x2044d2},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1e74d4){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1e74d4},'attributes':[_0xa956('0x13')]}});};exports[_0xa956('0x14')]=function(_0x5681ce){return request(_0xa956('0x15'),{'options':{'where':{'id':_0x5681ce},'attributes':[_0xa956('0x9')]}});};exports[_0xa956('0x16')]=function(_0x5c7baf){return request('GetContactByPhone',{'options':{'where':{'phone':_0x5c7baf[_0xa956('0x17')]},'attributes':['id']}});};exports[_0xa956('0x18')]=function(_0x2b23bc){return request(_0xa956('0x19'),{'options':{'where':{'id':_0x2b23bc},'attributes':['name']}});};exports['getSoundById']=function(_0x4ae9ef){return request(_0xa956('0x1a'),{'options':{'where':{'id':_0x4ae9ef},'attributes':[_0xa956('0x1b')]}});};exports[_0xa956('0x1c')]=function(_0x2af038){return request(_0xa956('0x1d'),{'options':{'raw':![],'where':{'id':_0x2af038},'include':[{'model':_0xa956('0x1e'),'as':_0xa956('0x1f')}]}});};exports[_0xa956('0x20')]=function(_0x450ab7){return request(_0xa956('0x21'),{'options':{'where':{'id':_0x450ab7},'attributes':['id',_0xa956('0x9')]}});};exports['createSmsMessage']=function(_0x1d7fd9){return request(_0xa956('0x22'),{'body':_0x1d7fd9});};exports['createSquareDetailsReport']=function(_0xc59ab0){return request(_0xa956('0x23'),{'body':_0xc59ab0});};exports[_0xa956('0x24')]=function(_0x238d16){return request(_0xa956('0x25'),{'body':_['merge'](_0x238d16,{'project_name':_0x238d16[_0xa956('0x26')],'prev_project_name':_0x238d16[_0xa956('0x27')]||'','is_subproject':_0x238d16[_0xa956('0x27')]?!![]:![],'leaveAt':moment()[_0xa956('0x28')](_0xa956('0x29'))})});};exports[_0xa956('0x2a')]=function(_0x443877){return request(_0xa956('0x2b'),{'body':_0x443877});};exports[_0xa956('0x2c')]=function(_0x4ae8bb){return request(_0xa956('0x2d'),{'body':_0x4ae8bb});};exports[_0xa956('0x2e')]=function(_0x1f5005){return request(_0xa956('0x2f'),{'options':{'raw':![],'where':{'phone':_0x1f5005[_0xa956('0x17')],'ListId':_0x1f5005[_0xa956('0x30')]}}})[_0xa956('0x31')](function(_0x1c43c6){if(_0x1c43c6){return _0x1c43c6;}return request(_0xa956('0x32'),{'body':_0x1f5005});});};exports[_0xa956('0x33')]=function(_0x52288c){return request('ShowPause',{'options':{'where':{'id':_0x52288c},'attributes':[_0xa956('0x9')]}});};exports[_0xa956('0x34')]=function(_0x561ef8,_0x5aaabc){return request(_0xa956('0x35'),{'body':{'interface':_0x5aaabc},'options':{'where':_0x561ef8}});};exports[_0xa956('0x36')]=function(_0x3386dc,_0x462e21,_0x41e442){return request(_0xa956('0x37'),{'body':{'type':_0x462e21,'uniqueid':_0x41e442},'options':{'where':_0x3386dc}});};exports[_0xa956('0x38')]=function(_0x33b13a){return request(_0xa956('0x39'),{'body':{},'options':{'where':_0x33b13a}});};exports[_0xa956('0x3a')]=function(_0x568245){return request('LogoutUser',{'body':{},'options':{'where':_0x568245}});}; \ 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 1affa2b..3a6532d 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 _0x7c1f=['./lex','exports','./polly'];(function(_0x3215a0,_0x223a3c){var _0x21ef9c=function(_0x156d0d){while(--_0x156d0d){_0x3215a0['push'](_0x3215a0['shift']());}};_0x21ef9c(++_0x223a3c);}(_0x7c1f,0x194));var _0xf7c1=function(_0x33c97a,_0x3ceb8f){_0x33c97a=_0x33c97a-0x0;var _0x4ffca2=_0x7c1f[_0x33c97a];return _0x4ffca2;};var polly=require(_0xf7c1('0x0'));var lex=require(_0xf7c1('0x1'));module[_0xf7c1('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x13fe=['./polly','./lex','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13fe,0x138));var _0xe13f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x13fe[_0x2b4411];return _0x8e41ef;};var polly=require(_0xe13f('0x0'));var lex=require(_0xe13f('0x1'));module[_0xe13f('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a5c9bd8..fcc1570 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 _0xaa88=['exports','./lib/api'];(function(_0x5e7ce7,_0x35c79f){var _0x5a9c31=function(_0x2ad940){while(--_0x2ad940){_0x5e7ce7['push'](_0x5e7ce7['shift']());}};_0x5a9c31(++_0x35c79f);}(_0xaa88,0x137));var _0x8aa8=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0xaa88[_0x56b138];return _0x3df878;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ No newline at end of file +var _0xf109=['./lib/api','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf109,0xce));var _0x9f10=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf109[_0x5d6456];return _0x4d66c1;};'use strict';var lex=require(_0x9f10('0x0'));module[_0x9f10('0x1')]=function(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517){return lex(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517);}; \ 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 5699be8..fba83f7 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(_0x36b892,_0x397c1c){var _0x5d6dbb=function(_0x5eec4c){while(--_0x5eec4c){_0x36b892['push'](_0x36b892['shift']());}};_0x5d6dbb(++_0x397c1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x4cb1da,_0x5b62ba){var _0x5f6b0c=function(_0x170de4){while(--_0x170de4){_0x4cb1da['push'](_0x4cb1da['shift']());}};_0x5f6b0c(++_0x5b62ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 1283833..7cde5e6 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 _0x6046=['exports','./lib/api'];(function(_0x983093,_0x277a9a){var _0x54ed36=function(_0x11cc00){while(--_0x11cc00){_0x983093['push'](_0x983093['shift']());}};_0x54ed36(++_0x277a9a);}(_0x6046,0xd7));var _0x6604=function(_0x11e83d,_0x512bb8){_0x11e83d=_0x11e83d-0x0;var _0x1f1d32=_0x6046[_0x11e83d];return _0x1f1d32;};'use strict';var polly=require(_0x6604('0x0'));module[_0x6604('0x1')]=function(_0x76ff2,_0x2e11fe,_0x34f576,_0x1f534a,_0x5ae8eb,_0x2fab7f,_0x1d22a2){return polly(_0x76ff2,_0x2e11fe,_0x34f576,_0x1f534a,_0x5ae8eb,_0x2fab7f,_0x1d22a2);}; \ No newline at end of file +var _0xf83c=['./lib/api','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf83c,0xe2));var _0xcf83=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xf83c[_0x102ff9];return _0x24fa97;};'use strict';var polly=require(_0xcf83('0x0'));module[_0xcf83('0x1')]=function(_0x2beb91,_0x44c997,_0x1796ce,_0x299e1b,_0x50c2b0,_0x347cc2,_0x27cc9f){return polly(_0x2beb91,_0x44c997,_0x1796ce,_0x299e1b,_0x50c2b0,_0x347cc2,_0x27cc9f);}; \ 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 6086d37..f3e5b9c 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 _0x14cf=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x529ce2,_0x21a34d){var _0x58d1b2=function(_0x479e15){while(--_0x479e15){_0x529ce2['push'](_0x529ce2['shift']());}};_0x58d1b2(++_0x21a34d);}(_0x14cf,0x65));var _0xf14c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x14cf[_0x6131cd];return _0x47e916;};'use strict';var fs=require('fs');var path=require(_0xf14c('0x0'));var BPromise=require(_0xf14c('0x1'));var rs=require(_0xf14c('0x2'));var AWS=require(_0xf14c('0x3'));function pollyResult(_0x9229a8,_0x11cf0c,_0x518676){return new BPromise(function(_0xba31c2,_0xa5c0e1){_0x9229a8[_0xf14c('0x4')](_0x11cf0c,function(_0x38b396,_0x47971e){if(_0x38b396){_0xa5c0e1(_0x38b396);}else if(_0x47971e){if(_0x47971e[_0xf14c('0x5')]instanceof Buffer){fs['writeFile'](_0x518676,_0x47971e['AudioStream'],function(_0x1e63c0){if(_0x1e63c0){_0xa5c0e1(_0x1e63c0);}else{_0xba31c2();}});}else{_0xa5c0e1(new Error(_0xf14c('0x6')));}}else{_0xa5c0e1(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xf14c('0x7')]=function(_0x26c66e,_0x1b0068,_0x11e9e1,_0x1a3ffb,_0x5898c9,_0x8ce211,_0x33bf24){var _0x8bdc9=new AWS[(_0xf14c('0x8'))]({'accessKeyId':_0x26c66e,'secretAccessKey':_0x1b0068,'region':_0x11e9e1});var _0x2bbd89={'Text':_0x5898c9,'TextType':_0x8ce211||_0xf14c('0x9'),'OutputFormat':_0xf14c('0xa'),'VoiceId':_0x1a3ffb};return pollyResult(_0x8bdc9,_0x2bbd89,_0x33bf24);}; \ No newline at end of file +var _0xf62e=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x22b30c,_0x3a9b2f){var _0x5bec9c=function(_0x3197bb){while(--_0x3197bb){_0x22b30c['push'](_0x22b30c['shift']());}};_0x5bec9c(++_0x3a9b2f);}(_0xf62e,0x7a));var _0xef62=function(_0xfed303,_0x227f36){_0xfed303=_0xfed303-0x0;var _0x3a0721=_0xf62e[_0xfed303];return _0x3a0721;};'use strict';var fs=require('fs');var path=require(_0xef62('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0xef62('0x1'));function pollyResult(_0x9ec1d9,_0x21af3d,_0x5ccf00){return new BPromise(function(_0x4b400e,_0x1ed6e2){_0x9ec1d9[_0xef62('0x2')](_0x21af3d,function(_0xcdb1be,_0x3d2d36){if(_0xcdb1be){_0x1ed6e2(_0xcdb1be);}else if(_0x3d2d36){if(_0x3d2d36[_0xef62('0x3')]instanceof Buffer){fs[_0xef62('0x4')](_0x5ccf00,_0x3d2d36[_0xef62('0x3')],function(_0x546305){if(_0x546305){_0x1ed6e2(_0x546305);}else{_0x4b400e();}});}else{_0x1ed6e2(new Error(_0xef62('0x5')));}}else{_0x1ed6e2(new Error(_0xef62('0x6')));}});});}module['exports']=function(_0x53aa59,_0x247c85,_0x23e927,_0x43c88e,_0x3ea4fe,_0x555f2e,_0x6865b){var _0x3fe882=new AWS[(_0xef62('0x7'))]({'accessKeyId':_0x53aa59,'secretAccessKey':_0x247c85,'region':_0x23e927});var _0x10499d={'Text':_0x3ea4fe,'TextType':_0x555f2e||_0xef62('0x8'),'OutputFormat':'mp3','VoiceId':_0x43c88e};return pollyResult(_0x3fe882,_0x10499d,_0x6865b);}; \ 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 26ff65b..e418775 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x37acf4,_0xd8dea,_0x5502e0,_0x51373d){return asr(_0x37acf4,_0xd8dea,_0x5502e0);}; \ No newline at end of file +var _0x67e4=['./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x67e4,0x1d7));var _0x467e=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x67e4[_0x3fe042];return _0x7d4a1f;};'use strict';var asr=require(_0x467e('0x0'));module['exports']=function(_0x5cef11,_0xe47ee5,_0x4e6348,_0x3f4469){return asr(_0x5cef11,_0xe47ee5,_0x4e6348);}; \ 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 4ce20a0..7e06282 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 _0x07c3=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x07c3,0x1bf));var _0x307c=function(_0x3ce301,_0x858468){_0x3ce301=_0x3ce301-0x0;var _0x323499=_0x07c3[_0x3ce301];return _0x323499;};'use strict';var url=require(_0x307c('0x0'));var BPromise=require(_0x307c('0x1'));var fs=require('fs');var host=_0x307c('0x2');module[_0x307c('0x3')]=function(_0x39fd38,_0x8b0b1c,_0x3b8f6e){return new BPromise(function(_0x186b09,_0x52cf54){var _0x37adf4;if(typeof _0x39fd38!==_0x307c('0x4')||_0x39fd38[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x6'));}if(typeof _0x8b0b1c!==_0x307c('0x4')||_0x8b0b1c[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x7'));}if(typeof _0x3b8f6e!==_0x307c('0x8')&&(typeof _0x3b8f6e!==_0x307c('0x4')||_0x3b8f6e[_0x307c('0x5')]===0x0)){return _0x52cf54(_0x307c('0x9'));}try{_0x37adf4=fs[_0x307c('0xa')](_0x39fd38)[_0x307c('0xb')](_0x307c('0xc'));}catch(_0x3c4a4c){return _0x52cf54(_0x3c4a4c);}return _0x186b09({'method':'POST','uri':host+_0x307c('0xd')+_0x8b0b1c,'body':{'config':{'encoding':_0x307c('0xe'),'sampleRateHertz':_0x307c('0xf'),'languageCode':_0x3b8f6e},'audio':{'content':_0x37adf4}},'json':!![]});});}; \ No newline at end of file +var _0xee5b=['filepath\x20should\x20be\x20a\x20string','string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','length'];(function(_0x243a9b,_0x1bcf3f){var _0x5e9308=function(_0x345c82){while(--_0x345c82){_0x243a9b['push'](_0x243a9b['shift']());}};_0x5e9308(++_0x1bcf3f);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1df149,_0x5c34bc){_0x1df149=_0x1df149-0x0;var _0x11e224=_0xee5b[_0x1df149];return _0x11e224;};'use strict';var url=require(_0xbee5('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xbee5('0x1');module[_0xbee5('0x2')]=function(_0x4f850a,_0x1893e4,_0x2b93c2){return new BPromise(function(_0x2eb857,_0x210159){var _0x4bd202;if(typeof _0x4f850a!=='string'||_0x4f850a[_0xbee5('0x3')]===0x0){return _0x210159(_0xbee5('0x4'));}if(typeof _0x1893e4!==_0xbee5('0x5')||_0x1893e4[_0xbee5('0x3')]===0x0){return _0x210159('key\x20should\x20be\x20a\x20string');}if(typeof _0x2b93c2!=='undefined'&&(typeof _0x2b93c2!=='string'||_0x2b93c2['length']===0x0)){return _0x210159('lang\x20should\x20be\x20a\x20string');}try{_0x4bd202=fs[_0xbee5('0x6')](_0x4f850a)[_0xbee5('0x7')](_0xbee5('0x8'));}catch(_0x20f717){return _0x210159(_0x20f717);}return _0x2eb857({'method':'POST','uri':host+_0xbee5('0x9')+_0x1893e4,'body':{'config':{'encoding':_0xbee5('0xa'),'sampleRateHertz':_0xbee5('0xb'),'languageCode':_0x2b93c2},'audio':{'content':_0x4bd202}},'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 6a48e16..bdf9052 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 _0x96ca=['./asr'];(function(_0x2caef6,_0xbb3fb1){var _0x18163d=function(_0x5a71c7){while(--_0x5a71c7){_0x2caef6['push'](_0x2caef6['shift']());}};_0x18163d(++_0xbb3fb1);}(_0x96ca,0x1dc));var _0xa96c=function(_0x32b9c9,_0x5881e6){_0x32b9c9=_0x32b9c9-0x0;var _0x1a837f=_0x96ca[_0x32b9c9];return _0x1a837f;};var asr=require(_0xa96c('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x24b1=['./asr','exports'];(function(_0x58ea14,_0x35a22c){var _0x31db61=function(_0x51b6df){while(--_0x51b6df){_0x58ea14['push'](_0x58ea14['shift']());}};_0x31db61(++_0x35a22c);}(_0x24b1,0x16a));var _0x124b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x24b1[_0x4b369d];return _0x571a98;};var asr=require(_0x124b('0x0'));module[_0x124b('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index a789ea3..72bfd31 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 _0x95a7=['ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','pipe','end','https:','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','generate','then','unlink','chmodSync','777','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','voice','audioConfig','text:synthesize','POST','tmp','.mp3','from','writeFile','split','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','data','writeFileSync','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','transcript','alternatives','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0x95a7,0x117));var _0x795a=function(_0x27fa35,_0x189cc7){_0x27fa35=_0x27fa35-0x0;var _0x5b257e=_0x95a7[_0x27fa35];return _0x5b257e;};'use strict';var apiai=require(_0x795a('0x0'));var BPromise=require(_0x795a('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x795a('0x2'));var https=require(_0x795a('0x3'));var md5=require(_0x795a('0x4'));var path=require('path');var querystring=require(_0x795a('0x5'));var rp=require(_0x795a('0x6'));var rs=require(_0x795a('0x7'));var sox=require(_0x795a('0x8'));var tts=require(_0x795a('0x9'));var urlParse=require(_0x795a('0xa'))['parse'];var util=require('util');var aws=require(_0x795a('0xb'));var google=require('./google');var sestek=require(_0x795a('0xc'));var tilde=require(_0x795a('0xd'));var logger=require(_0x795a('0xe'))(_0x795a('0xf'));var ISPEECH_API=_0x795a('0x10');function downloadFile(_0x3aa302,_0x2ce280){return new BPromise(function(_0x4c883f,_0xba6fa){var _0x3ec051=urlParse(_0x3aa302);var _0x245492=_0x3ec051[_0x795a('0x11')]==='https:'?https:http;var _0x383008={'host':_0x3ec051['host'],'path':_0x3ec051[_0x795a('0x12')],'headers':{'user-agent':_0x795a('0x13')}};_0x245492[_0x795a('0x14')](_0x383008,function(_0x4dea60){if(_0x4dea60[_0x795a('0x15')]!==0xc8){logger['error'](_0x795a('0x16')+_0x3aa302+_0x795a('0x17')+_0x4dea60[_0x795a('0x15')]+'\x20('+_0x4dea60[_0x795a('0x18')]+')');_0xba6fa(new Error(_0x795a('0x16')+_0x3aa302+_0x795a('0x17')+_0x4dea60['statusCode']+'\x20('+_0x4dea60[_0x795a('0x18')]+')'));return;}var _0x24b598=fs[_0x795a('0x19')](_0x2ce280);_0x24b598['on']('finish',function(){logger[_0x795a('0x1a')](_0x795a('0x1b'));_0x24b598['close'](_0x4c883f);});_0x24b598['on']('error',function(_0x2e9be7){fs['unlink'](_0x2ce280);logger[_0x795a('0x1c')]('download\x20error',_0x2e9be7);_0xba6fa(_0x2e9be7);});_0x4dea60[_0x795a('0x1d')](_0x24b598);})['on'](_0x795a('0x1c'),function(_0x4b6f1a){logger['error'](_0x4b6f1a);_0xba6fa(_0x4b6f1a);})[_0x795a('0x1e')]();});}function uploadFile(_0x4eeb46){return new BPromise(function(_0xac6619,_0x5a0700){var _0x5308e1=urlParse(_0x4eeb46);var _0x4dc987=_0x5308e1[_0x795a('0x11')]===_0x795a('0x1f')?https:http;var _0x2ff98f={'host':_0x5308e1['host'],'path':_0x5308e1[_0x795a('0x12')],'headers':{'user-agent':'WHAT_EVER'}};_0x4dc987[_0x795a('0x14')](_0x2ff98f,function(_0x36e049){if(_0x36e049[_0x795a('0x15')]!==0xc8){_0x5a0700(new Error(_0x795a('0x16')+_0x4eeb46+_0x795a('0x17')+_0x36e049[_0x795a('0x15')]+'\x20('+_0x36e049[_0x795a('0x18')]+')'));return;}var _0x5038a1='';_0x36e049['on']('data',function(_0x588a46){_0x5038a1+=_0x588a46;});_0x36e049['on'](_0x795a('0x1e'),function(){_0xac6619(_0x5038a1);});})['on'](_0x795a('0x1c'),function(_0xdd5b90){_0x5a0700(_0xdd5b90);})[_0x795a('0x1e')]();});}function convertFile(_0x279765,_0x558990){return new BPromise(function(_0x5d8885,_0x5da5bf){var _0x181012=sox[_0x795a('0x20')](_0x279765,_0x558990,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x181012['on'](_0x795a('0x1c'),function(_0x4a4cc9){logger[_0x795a('0x1c')](_0x795a('0x21'),_0x4a4cc9);_0x5da5bf(_0x4a4cc9);});_0x181012['on']('end',function(){logger[_0x795a('0x1a')](_0x795a('0x22'));_0x5d8885();});_0x181012[_0x795a('0x23')]();});}function base64Decode(_0x23ebae,_0x184b2f){var _0x4f31d9=path[_0x795a('0x24')](__dirname,'tmp',rs[_0x795a('0x25')](0x4)+'.wav');fs['writeFileSync'](_0x4f31d9,_0x23ebae,'base64');return convertFile(_0x4f31d9,_0x184b2f)[_0x795a('0x26')](function(){try{fs[_0x795a('0x27')](_0x4f31d9);fs[_0x795a('0x28')](_0x184b2f,_0x795a('0x29'));}catch(_0x3aef85){logger['error'](_0x3aef85);}return _0x184b2f['split']('.')[0x0];});}function base64Encode(_0x38e4b5){var _0x169d79=fs[_0x795a('0x2a')](_0x38e4b5);return new Buffer(_0x169d79)[_0x795a('0x2b')](_0x795a('0x2c'));}exports[_0x795a('0x2d')]=function(_0x217bab,_0x1cf382,_0x133ae9,_0x77f537,_0x3e75d1,_0x3371cc){var _0x4ede73,_0x265bba;var _0x4359a9=_0x795a('0x2e');var _0x59e064='?key='+_0x217bab;var _0x36144d={};if(_0x1cf382==='ssml'){_0x36144d['input']={'ssml':_0x133ae9};}else{_0x36144d['input']={'text':_0x133ae9};};_0x36144d[_0x795a('0x2f')]={'languageCode':_0x77f537,'ssmlGender':_0x3e75d1};_0x36144d[_0x795a('0x30')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1dda5f={'url':_0x4359a9+_0x795a('0x31')+_0x59e064,'method':_0x795a('0x32'),'json':!![],'body':_0x36144d};return rp(_0x1dda5f)[_0x795a('0x26')](function(_0x465d88){return new BPromise(function(_0x4d7321,_0x467a2d){_0x4ede73=path[_0x795a('0x24')](__dirname,_0x795a('0x33'),rs['generate'](0x4)+_0x795a('0x34'));var _0x4291ae=Buffer[_0x795a('0x35')](_0x465d88['audioContent'],_0x795a('0x2c'));return fs[_0x795a('0x36')](_0x4ede73,_0x4291ae,function(_0x243a28){_0x467a2d(_0x243a28);},function(_0x94feaa){fs[_0x795a('0x28')](_0x4ede73,_0x795a('0x29'));_0x4d7321(_0x94feaa);});});})['then'](function(_0x42d409){_0x265bba=path[_0x795a('0x24')](__dirname,_0x795a('0x33'),rs['generate'](0x4)+'.wav');return convertFile(_0x4ede73,_0x265bba);})[_0x795a('0x26')](function(){try{fs[_0x795a('0x27')](_0x4ede73);fs[_0x795a('0x28')](_0x265bba,_0x795a('0x29'));}catch(_0x3e8a27){logger[_0x795a('0x1c')](_0x3e8a27);}logger[_0x795a('0x1a')]('googleCloudTTS\x20path',_0x265bba[_0x795a('0x37')]('.')[0x0]);return _0x265bba[_0x795a('0x37')]('.')[0x0];});};exports['googleTTS']=function(_0x240093,_0x2422a4){var _0xbc1f2e='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x525d7b,_0x2acfee;var _0x328618;var _0x15b849={'encoding':'utf8','method':_0x795a('0x32'),'timeout':0x2710,'url':_0xbc1f2e,'headers':{'Content-Type':_0x795a('0x38')},'body':_0x795a('0x39')+encodeURIComponent(JSON[_0x795a('0x3a')]([[[_0x795a('0x3b'),JSON['stringify']([_0x240093,_0x2422a4||'en',![],_0x795a('0x3c')]),null,'generic']]]))};return rp(_0x15b849)[_0x795a('0x26')](function(_0x351bc4){try{_0x328618=eval(_0x351bc4[_0x795a('0x3d')](0x5))[0x0][0x2];}catch(_0x47d10f){throw new Error(_0x795a('0x3e')+_0x351bc4['data']);}if(!_0x328618){if(_0x240093[_0x795a('0x3f')]>0xc8){throw new Error(_0x795a('0x40'));}else{throw new Error(_0x795a('0x41')+_0x2422a4+_0x795a('0x42'));}}try{_0x328618=eval(_0x328618)[0x0];}catch(_0x4379fe){throw new Error(_0x795a('0x3e')+res[_0x795a('0x43')]);}const _0x4e8892=_0x328618;_0x525d7b=path[_0x795a('0x24')](__dirname,_0x795a('0x33'),rs[_0x795a('0x25')](0x4)+'.mp3');fs[_0x795a('0x44')](_0x525d7b,_0x328618,{'encoding':_0x795a('0x2c')});_0x2acfee=path[_0x795a('0x24')](__dirname,_0x795a('0x33'),rs[_0x795a('0x25')](0x4)+_0x795a('0x45'));return convertFile(_0x525d7b,_0x2acfee);})[_0x795a('0x26')](function(){try{fs[_0x795a('0x27')](_0x525d7b);fs[_0x795a('0x28')](_0x2acfee,_0x795a('0x29'));}catch(_0xc6c386){logger[_0x795a('0x1c')](_0xc6c386);}logger[_0x795a('0x1a')](_0x795a('0x46'),_0x2acfee['split']('.')[0x0]);return _0x2acfee['split']('.')[0x0];});};exports[_0x795a('0x47')]=function(_0x1d37bb,_0x555257,_0x308d5d){return google[_0x795a('0x48')](_0x1d37bb,_0x555257,_0x308d5d)[_0x795a('0x26')](function(_0x1a7903){logger[_0x795a('0x1a')](_0x1a7903[_0x795a('0x49')]);return rp(_0x1a7903);})[_0x795a('0x26')](function(_0x29942f){var _0x2a2042='';var _0x17347f=0x0;try{fs[_0x795a('0x27')](_0x1d37bb);}catch(_0x56e844){logger['error'](_0x56e844);}if(_0x29942f&&_0x29942f[_0x795a('0x4a')]){_0x2a2042=_0x29942f[_0x795a('0x4a')][_0x795a('0x4b')](function(_0x17029a){return _0x17029a&&_0x17029a['alternatives'][0x0]&&_0x17029a['alternatives'][0x0][_0x795a('0x4c')]?_0x17029a[_0x795a('0x4d')][0x0][_0x795a('0x4c')]:'';})[_0x795a('0x4e')]('\x0a');_0x17347f=_0x29942f[_0x795a('0x4a')][_0x795a('0x4b')](function(_0x365eae){return _0x365eae&&_0x365eae[_0x795a('0x4d')][0x0]&&_0x365eae[_0x795a('0x4d')][0x0][_0x795a('0x4f')]?_0x365eae['alternatives'][0x0][_0x795a('0x4f')]:0x0;})[_0x795a('0x4e')]('\x0a');}logger[_0x795a('0x1a')](_0x795a('0x50'),_0x2a2042);logger[_0x795a('0x1a')]('googleASR\x20confidence',_0x17347f);return{'transcript':_0x2a2042,'confidence':_0x17347f};})[_0x795a('0x51')](function(_0x454cef){logger[_0x795a('0x1c')](_0x795a('0x52'),_0x454cef['statusCode'],_0x454cef[_0x795a('0x53')],_0x454cef[_0x795a('0x54')]);});};exports[_0x795a('0x55')]=function(_0x24e4f8,_0x59f802,_0x34037b,_0xe0b312){var _0x38a7f2=apiai(_0x59f802,{'language':_0xe0b312||'en'});return _0x38a7f2[_0x795a('0x56')](_0x34037b,{'sessionId':md5(_0x24e4f8)})[_0x795a('0x26')](function(_0x559b47){logger[_0x795a('0x1a')](JSON['stringify'](_0x559b47));return{'source':_0x559b47[_0x795a('0x57')]['source'],'resolvedQuery':_0x559b47[_0x795a('0x57')][_0x795a('0x58')],'action':_0x559b47['result'][_0x795a('0x59')],'actionIncomplete':_0x559b47[_0x795a('0x57')][_0x795a('0x5a')],'speech':_0x559b47[_0x795a('0x57')][_0x795a('0x5b')]['speech'],'score':_0x559b47[_0x795a('0x57')][_0x795a('0x5c')],'statusCode':_0x559b47[_0x795a('0x5d')][_0x795a('0x5e')],'endConversation':_0x559b47[_0x795a('0x57')]['metadata'][_0x795a('0x5f')]||![],'isFallbackIntent':_0x559b47[_0x795a('0x57')][_0x795a('0x60')][_0x795a('0x61')]};});};exports[_0x795a('0x62')]=function(_0x282896,_0x1bddbf,_0x2413ff,_0xdcc56d,_0x48332a,_0x4417bc){var _0x269b4d=_0xdcc56d[_0x795a('0x63')](/\\n/g,'\x0a');var _0x3da315={'credentials':{'private_key':_0x269b4d,'client_email':_0x2413ff}};var _0x394630=new dialogflow[(_0x795a('0x64'))](_0x3da315);var _0x7747dc=_0x394630[_0x795a('0x65')](_0x1bddbf,md5(_0x282896));var _0x1ba281={'session':_0x7747dc,'queryInput':{'text':{'text':_0x48332a,'languageCode':_0x4417bc}}};return _0x394630[_0x795a('0x66')](_0x1ba281)[_0x795a('0x26')](function(_0x599976){if(_0x599976&&_0x599976[_0x795a('0x3f')]){logger[_0x795a('0x1a')](_0x795a('0x67'),JSON[_0x795a('0x3a')](_0x599976));var _0x3f8dd2=_0x599976[0x0];if(_0x3f8dd2){var _0x1d7fb0={'action':_0x3f8dd2[_0x795a('0x68')][_0x795a('0x59')],'allRequiredParamsPresent':_0x3f8dd2['queryResult'][_0x795a('0x69')],'endConversation':_0x3f8dd2[_0x795a('0x68')]['diagnosticInfo']&&_0x3f8dd2[_0x795a('0x68')][_0x795a('0x6a')][_0x795a('0x6b')]?_0x3f8dd2[_0x795a('0x68')]['diagnosticInfo'][_0x795a('0x6b')][_0x795a('0x6c')][_0x795a('0x6d')]:![],'fulfillmentText':_0x3f8dd2[_0x795a('0x68')][_0x795a('0x6e')],'intentName':_0x3f8dd2[_0x795a('0x68')][_0x795a('0x6f')][_0x795a('0x53')],'intentDisplayName':_0x3f8dd2[_0x795a('0x68')]['intent']['displayName'],'isFallbackIntent':_0x3f8dd2[_0x795a('0x68')][_0x795a('0x6f')][_0x795a('0x70')],'languageCode':_0x3f8dd2['queryResult'][_0x795a('0x71')],'queryText':_0x3f8dd2['queryResult'][_0x795a('0x72')],'responseId':_0x3f8dd2[_0x795a('0x73')],'score':_0x3f8dd2['queryResult'][_0x795a('0x74')],'speech':_0x3f8dd2[_0x795a('0x68')][_0x795a('0x6e')],'providerResponse':JSON[_0x795a('0x3a')](_0x599976)};return _0x1d7fb0;}}});};exports[_0x795a('0x75')]=function(_0x2e665d,_0x4fa99b,_0x13174f,_0x2a0e47){return tilde[_0x795a('0x48')](_0x2e665d,_0x4fa99b,_0x13174f,_0x2a0e47)[_0x795a('0x26')](function(_0x210b03){try{fs[_0x795a('0x27')](_0x2e665d);}catch(_0x436acc){logger['error'](_0x436acc);}logger[_0x795a('0x1a')](_0x795a('0x76'),_0x210b03[_0x795a('0x4c')]);logger[_0x795a('0x1a')](_0x795a('0x77'),_0x210b03[_0x795a('0x4f')]);return _0x210b03;});};exports[_0x795a('0x78')]=function(_0x36b367,_0x9b5937,_0x10c602,_0x179e47,_0x4e5c31,_0x484763){var _0x4012be=path[_0x795a('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x795a('0x34'));var _0x1ccddc;return aws['polly'](_0x36b367,_0x9b5937,_0x10c602,_0x179e47,_0x4e5c31,_0x484763,_0x4012be)['then'](function(){_0x1ccddc=path['resolve'](__dirname,_0x795a('0x33'),rs['generate'](0x4)+_0x795a('0x45'));return convertFile(_0x4012be,_0x1ccddc);})[_0x795a('0x26')](function(){try{fs[_0x795a('0x27')](_0x4012be);fs['chmodSync'](_0x1ccddc,_0x795a('0x29'));}catch(_0x5148fe){logger[_0x795a('0x1c')](_0x5148fe);}return _0x1ccddc[_0x795a('0x37')]('.')[0x0];});};exports[_0x795a('0x79')]=function(_0x43324e,_0x430c5e,_0x13969c,_0x3ec0f6,_0x85a62f,_0x3d94ed){return aws[_0x795a('0x7a')](_0x43324e,_0x430c5e,_0x13969c,_0x3ec0f6,_0x85a62f,_0x3d94ed)['then'](function(_0x34611d){logger[_0x795a('0x1a')](JSON[_0x795a('0x3a')](_0x34611d));return _0x34611d;});};exports[_0x795a('0x7b')]=function(_0x2b9dcd,_0x421d4d,_0x5b28c4,_0x6a8d85){var _0x140321=util[_0x795a('0x7c')](_0x795a('0x7d'),ISPEECH_API,_0x2b9dcd,encodeURIComponent(_0x421d4d),_0x5b28c4,_0x6a8d85);var _0x42a777=path[_0x795a('0x24')](__dirname,_0x795a('0x33'),rs['generate'](0x4)+_0x795a('0x34'));var _0x87643d;return downloadFile(_0x140321,_0x42a777)[_0x795a('0x26')](function(){_0x87643d=path[_0x795a('0x24')](__dirname,_0x795a('0x33'),rs[_0x795a('0x25')](0x4)+'.wav');return convertFile(_0x42a777,_0x87643d);})[_0x795a('0x26')](function(){try{fs[_0x795a('0x27')](_0x42a777);fs['chmodSync'](_0x87643d,_0x795a('0x29'));}catch(_0x10f9d4){logger['error'](_0x10f9d4);}return _0x87643d['split']('.')[0x0];});};exports[_0x795a('0x7e')]=function(_0x556152,_0x30ad2b,_0x511623,_0x54da0d){var _0x5d7faf=util[_0x795a('0x7c')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x30ad2b,_0x511623,base64Encode(_0x556152),_0x54da0d?util[_0x795a('0x7c')]('model=%s',encodeURIComponent(_0x54da0d)):_0x795a('0x7f'));return uploadFile(_0x5d7faf)['then'](function(_0x2ed1da){return querystring['parse'](_0x2ed1da);});};exports[_0x795a('0x80')]=function(_0x1c7c28,_0x36d4a3){return sestek['nda'](_0x1c7c28,_0x36d4a3)[_0x795a('0x26')](function(_0x3cfff5){logger[_0x795a('0x1a')](JSON[_0x795a('0x3a')](_0x3cfff5));var _0x186525={'speech':_0x3cfff5['text'],'action':_0x3cfff5['channelData']?_0x3cfff5[_0x795a('0x81')][_0x795a('0x82')]:undefined,'actiondata':_0x3cfff5[_0x795a('0x81')]?_0x3cfff5[_0x795a('0x81')][_0x795a('0x83')]:undefined};if(_0x3cfff5[_0x795a('0x81')]&&_0x3cfff5[_0x795a('0x81')][_0x795a('0x84')]){return base64Decode(_0x3cfff5['channelData'][_0x795a('0x84')][_0x795a('0x85')],path[_0x795a('0x24')](__dirname,_0x795a('0x33'),rs[_0x795a('0x25')](0x4)+'.wav'))[_0x795a('0x26')](function(_0x2396a0){_0x186525['audiofile']=_0x2396a0;return _0x186525;});}return _0x186525;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x4e0d=['createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','get','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','from','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','resolvedQuery','actionIncomplete','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','awsPolly','.mp3','polly','awsLex','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','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','statusCode'];(function(_0x3669e5,_0x409cf8){var _0x27ed1b=function(_0x507b7c){while(--_0x507b7c){_0x3669e5['push'](_0x3669e5['shift']());}};_0x27ed1b(++_0x409cf8);}(_0x4e0d,0x193));var _0xd4e0=function(_0x2af253,_0x73ae9){_0x2af253=_0x2af253-0x0;var _0x5979d4=_0x4e0d[_0x2af253];return _0x5979d4;};'use strict';var apiai=require(_0xd4e0('0x0'));var BPromise=require(_0xd4e0('0x1'));var dialogflow=require(_0xd4e0('0x2'));var fs=require('fs');var http=require(_0xd4e0('0x3'));var https=require(_0xd4e0('0x4'));var md5=require(_0xd4e0('0x5'));var path=require(_0xd4e0('0x6'));var querystring=require(_0xd4e0('0x7'));var rp=require(_0xd4e0('0x8'));var rs=require(_0xd4e0('0x9'));var sox=require(_0xd4e0('0xa'));var tts=require(_0xd4e0('0xb'));var urlParse=require(_0xd4e0('0xc'))[_0xd4e0('0xd')];var util=require(_0xd4e0('0xe'));var aws=require(_0xd4e0('0xf'));var google=require(_0xd4e0('0x10'));var sestek=require(_0xd4e0('0x11'));var tilde=require(_0xd4e0('0x12'));var logger=require('../../../config/logger')(_0xd4e0('0x13'));var ISPEECH_API=_0xd4e0('0x14');function downloadFile(_0x121320,_0x3824d3){return new BPromise(function(_0x4d291a,_0x31baab){var _0x28c1cd=urlParse(_0x121320);var _0x3b801f=_0x28c1cd[_0xd4e0('0x15')]==='https:'?https:http;var _0x285a33={'host':_0x28c1cd[_0xd4e0('0x16')],'path':_0x28c1cd[_0xd4e0('0x6')],'headers':{'user-agent':_0xd4e0('0x17')}};_0x3b801f['get'](_0x285a33,function(_0x3e5885){if(_0x3e5885['statusCode']!==0xc8){logger[_0xd4e0('0x18')]('request\x20to\x20'+_0x121320+_0xd4e0('0x19')+_0x3e5885['statusCode']+'\x20('+_0x3e5885[_0xd4e0('0x1a')]+')');_0x31baab(new Error(_0xd4e0('0x1b')+_0x121320+_0xd4e0('0x19')+_0x3e5885[_0xd4e0('0x1c')]+'\x20('+_0x3e5885['statusMessage']+')'));return;}var _0x24f1f6=fs[_0xd4e0('0x1d')](_0x3824d3);_0x24f1f6['on'](_0xd4e0('0x1e'),function(){logger[_0xd4e0('0x1f')](_0xd4e0('0x20'));_0x24f1f6[_0xd4e0('0x21')](_0x4d291a);});_0x24f1f6['on'](_0xd4e0('0x18'),function(_0x49c333){fs[_0xd4e0('0x22')](_0x3824d3);logger['error'](_0xd4e0('0x23'),_0x49c333);_0x31baab(_0x49c333);});_0x3e5885[_0xd4e0('0x24')](_0x24f1f6);})['on'](_0xd4e0('0x18'),function(_0x2de5da){logger[_0xd4e0('0x18')](_0x2de5da);_0x31baab(_0x2de5da);})[_0xd4e0('0x25')]();});}function uploadFile(_0x1bb301){return new BPromise(function(_0x58df96,_0x8c4035){var _0x55980c=urlParse(_0x1bb301);var _0x2d628d=_0x55980c[_0xd4e0('0x15')]===_0xd4e0('0x26')?https:http;var _0x2110a5={'host':_0x55980c[_0xd4e0('0x16')],'path':_0x55980c[_0xd4e0('0x6')],'headers':{'user-agent':_0xd4e0('0x17')}};_0x2d628d[_0xd4e0('0x27')](_0x2110a5,function(_0x3372a4){if(_0x3372a4[_0xd4e0('0x1c')]!==0xc8){_0x8c4035(new Error(_0xd4e0('0x1b')+_0x1bb301+_0xd4e0('0x19')+_0x3372a4['statusCode']+'\x20('+_0x3372a4['statusMessage']+')'));return;}var _0x2f7f46='';_0x3372a4['on'](_0xd4e0('0x28'),function(_0x5f36f4){_0x2f7f46+=_0x5f36f4;});_0x3372a4['on'](_0xd4e0('0x25'),function(){_0x58df96(_0x2f7f46);});})['on'](_0xd4e0('0x18'),function(_0x55c081){_0x8c4035(_0x55c081);})['end']();});}function convertFile(_0x307ca8,_0x3e298f){return new BPromise(function(_0x37981b,_0x5b9ed6){var _0x4e880a=sox[_0xd4e0('0x29')](_0x307ca8,_0x3e298f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4e880a['on'](_0xd4e0('0x18'),function(_0x1c1c02){logger[_0xd4e0('0x18')](_0xd4e0('0x2a'),_0x1c1c02);_0x5b9ed6(_0x1c1c02);});_0x4e880a['on'](_0xd4e0('0x25'),function(){logger[_0xd4e0('0x1f')](_0xd4e0('0x2b'));_0x37981b();});_0x4e880a[_0xd4e0('0x2c')]();});}function base64Decode(_0x1ce326,_0x20f641){var _0x1abbab=path[_0xd4e0('0x2d')](__dirname,_0xd4e0('0x2e'),rs['generate'](0x4)+_0xd4e0('0x2f'));fs[_0xd4e0('0x30')](_0x1abbab,_0x1ce326,_0xd4e0('0x31'));return convertFile(_0x1abbab,_0x20f641)[_0xd4e0('0x32')](function(){try{fs[_0xd4e0('0x22')](_0x1abbab);fs[_0xd4e0('0x33')](_0x20f641,_0xd4e0('0x34'));}catch(_0x6c2890){logger[_0xd4e0('0x18')](_0x6c2890);}return _0x20f641['split']('.')[0x0];});}function base64Encode(_0x2308c7){var _0x20e89e=fs[_0xd4e0('0x35')](_0x2308c7);return new Buffer(_0x20e89e)[_0xd4e0('0x36')](_0xd4e0('0x31'));}exports[_0xd4e0('0x37')]=function(_0x5cc879,_0x33ee99,_0x2bf899,_0x4ce8e7,_0x462619,_0x2240f8){var _0x32e6a2,_0x54fd69;var _0x4dca3a=_0xd4e0('0x38');var _0x3709e2='?key='+_0x5cc879;var _0x3d3201={};if(_0x33ee99===_0xd4e0('0x39')){_0x3d3201[_0xd4e0('0x3a')]={'ssml':_0x2bf899};}else{_0x3d3201[_0xd4e0('0x3a')]={'text':_0x2bf899};};_0x3d3201[_0xd4e0('0x3b')]={'languageCode':_0x4ce8e7,'ssmlGender':_0x462619};_0x3d3201[_0xd4e0('0x3c')]={'audioEncoding':_0xd4e0('0x3d'),'sampleRateHertz':0x1f40};var _0x5c40b4={'url':_0x4dca3a+_0xd4e0('0x3e')+_0x3709e2,'method':_0xd4e0('0x3f'),'json':!![],'body':_0x3d3201};return rp(_0x5c40b4)[_0xd4e0('0x32')](function(_0x2727d6){return new BPromise(function(_0x5b7a20,_0x591d65){_0x32e6a2=path[_0xd4e0('0x2d')](__dirname,'tmp',rs[_0xd4e0('0x40')](0x4)+'.mp3');var _0x4136d4=Buffer[_0xd4e0('0x41')](_0x2727d6['audioContent'],'base64');return fs['writeFile'](_0x32e6a2,_0x4136d4,function(_0x16a905){_0x591d65(_0x16a905);},function(_0x2f9d6d){fs[_0xd4e0('0x33')](_0x32e6a2,_0xd4e0('0x34'));_0x5b7a20(_0x2f9d6d);});});})[_0xd4e0('0x32')](function(_0x30eb2){_0x54fd69=path[_0xd4e0('0x2d')](__dirname,_0xd4e0('0x2e'),rs['generate'](0x4)+_0xd4e0('0x2f'));return convertFile(_0x32e6a2,_0x54fd69);})[_0xd4e0('0x32')](function(){try{fs[_0xd4e0('0x22')](_0x32e6a2);fs[_0xd4e0('0x33')](_0x54fd69,'777');}catch(_0x3a5345){logger['error'](_0x3a5345);}logger[_0xd4e0('0x1f')](_0xd4e0('0x42'),_0x54fd69[_0xd4e0('0x43')]('.')[0x0]);return _0x54fd69['split']('.')[0x0];});};exports['googleTTS']=function(_0x457ae7,_0x4989c8){var _0x80be8c=_0xd4e0('0x44');var _0x3e85a4,_0x2efa38;var _0x2eabf9;var _0x448502={'encoding':_0xd4e0('0x45'),'method':_0xd4e0('0x3f'),'timeout':0x2710,'url':_0x80be8c,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xd4e0('0x46')]([[[_0xd4e0('0x47'),JSON[_0xd4e0('0x46')]([_0x457ae7,_0x4989c8||'en',![],'null']),null,_0xd4e0('0x48')]]]))};return rp(_0x448502)['then'](function(_0x2f187f){try{_0x2eabf9=eval(_0x2f187f[_0xd4e0('0x49')](0x5))[0x0][0x2];}catch(_0xaa76dd){throw new Error(_0xd4e0('0x4a')+_0x2f187f[_0xd4e0('0x28')]);}if(!_0x2eabf9){if(_0x457ae7[_0xd4e0('0x4b')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd4e0('0x4c')+_0x4989c8+_0xd4e0('0x4d'));}}try{_0x2eabf9=eval(_0x2eabf9)[0x0];}catch(_0x345455){throw new Error(_0xd4e0('0x4a')+res[_0xd4e0('0x28')]);}const _0x535fdf=_0x2eabf9;_0x3e85a4=path['resolve'](__dirname,_0xd4e0('0x2e'),rs[_0xd4e0('0x40')](0x4)+'.mp3');fs['writeFileSync'](_0x3e85a4,_0x2eabf9,{'encoding':'base64'});_0x2efa38=path['resolve'](__dirname,_0xd4e0('0x2e'),rs[_0xd4e0('0x40')](0x4)+_0xd4e0('0x2f'));return convertFile(_0x3e85a4,_0x2efa38);})[_0xd4e0('0x32')](function(){try{fs[_0xd4e0('0x22')](_0x3e85a4);fs['chmodSync'](_0x2efa38,'777');}catch(_0x449b56){logger[_0xd4e0('0x18')](_0x449b56);}logger[_0xd4e0('0x1f')](_0xd4e0('0x4e'),_0x2efa38[_0xd4e0('0x43')]('.')[0x0]);return _0x2efa38['split']('.')[0x0];});};exports[_0xd4e0('0x4f')]=function(_0x2b277d,_0x5e49c0,_0x59e142){return google[_0xd4e0('0x50')](_0x2b277d,_0x5e49c0,_0x59e142)['then'](function(_0x1f7591){logger['info'](_0x1f7591[_0xd4e0('0x51')]);return rp(_0x1f7591);})[_0xd4e0('0x32')](function(_0x5dcd12){var _0x721a61='';var _0x2e8504=0x0;try{fs[_0xd4e0('0x22')](_0x2b277d);}catch(_0x43df49){logger['error'](_0x43df49);}if(_0x5dcd12&&_0x5dcd12[_0xd4e0('0x52')]){_0x721a61=_0x5dcd12[_0xd4e0('0x52')][_0xd4e0('0x53')](function(_0x3ac19e){return _0x3ac19e&&_0x3ac19e[_0xd4e0('0x54')][0x0]&&_0x3ac19e[_0xd4e0('0x54')][0x0][_0xd4e0('0x55')]?_0x3ac19e['alternatives'][0x0]['transcript']:'';})[_0xd4e0('0x56')]('\x0a');_0x2e8504=_0x5dcd12[_0xd4e0('0x52')][_0xd4e0('0x53')](function(_0x8e015c){return _0x8e015c&&_0x8e015c[_0xd4e0('0x54')][0x0]&&_0x8e015c['alternatives'][0x0][_0xd4e0('0x57')]?_0x8e015c[_0xd4e0('0x54')][0x0][_0xd4e0('0x57')]:0x0;})['join']('\x0a');}logger[_0xd4e0('0x1f')]('googleASR\x20transcription',_0x721a61);logger[_0xd4e0('0x1f')](_0xd4e0('0x58'),_0x2e8504);return{'transcript':_0x721a61,'confidence':_0x2e8504};})[_0xd4e0('0x59')](function(_0x15bfc8){logger[_0xd4e0('0x18')](_0xd4e0('0x5a'),_0x15bfc8[_0xd4e0('0x1c')],_0x15bfc8[_0xd4e0('0x5b')],_0x15bfc8[_0xd4e0('0x5c')]);});};exports['googleDialogflow']=function(_0x2609e9,_0x470293,_0x1f2504,_0x28dc8c){var _0x5412c3=apiai(_0x470293,{'language':_0x28dc8c||'en'});return _0x5412c3[_0xd4e0('0x5d')](_0x1f2504,{'sessionId':md5(_0x2609e9)})[_0xd4e0('0x32')](function(_0x384a77){logger['info'](JSON[_0xd4e0('0x46')](_0x384a77));return{'source':_0x384a77['result'][_0xd4e0('0x5e')],'resolvedQuery':_0x384a77[_0xd4e0('0x5f')][_0xd4e0('0x60')],'action':_0x384a77[_0xd4e0('0x5f')]['action'],'actionIncomplete':_0x384a77['result'][_0xd4e0('0x61')],'speech':_0x384a77[_0xd4e0('0x5f')]['fulfillment'][_0xd4e0('0x62')],'score':_0x384a77[_0xd4e0('0x5f')][_0xd4e0('0x63')],'statusCode':_0x384a77[_0xd4e0('0x64')][_0xd4e0('0x65')],'endConversation':_0x384a77[_0xd4e0('0x5f')]['metadata'][_0xd4e0('0x66')]||![],'isFallbackIntent':_0x384a77[_0xd4e0('0x5f')][_0xd4e0('0x67')][_0xd4e0('0x68')]};});};exports[_0xd4e0('0x69')]=function(_0x20c4f8,_0x26a4a4,_0x225025,_0x3f84d6,_0x318976,_0x169726){var _0x537c42=_0x3f84d6[_0xd4e0('0x6a')](/\\n/g,'\x0a');var _0x2b5608={'credentials':{'private_key':_0x537c42,'client_email':_0x225025}};var _0x517144=new dialogflow[(_0xd4e0('0x6b'))](_0x2b5608);var _0xc755f4=_0x517144[_0xd4e0('0x6c')](_0x26a4a4,md5(_0x20c4f8));var _0x47fca6={'session':_0xc755f4,'queryInput':{'text':{'text':_0x318976,'languageCode':_0x169726}}};return _0x517144[_0xd4e0('0x6d')](_0x47fca6)[_0xd4e0('0x32')](function(_0x5c0ca5){if(_0x5c0ca5&&_0x5c0ca5[_0xd4e0('0x4b')]){logger['info'](_0xd4e0('0x6e'),JSON['stringify'](_0x5c0ca5));var _0x2874cb=_0x5c0ca5[0x0];if(_0x2874cb){var _0x8734f4={'action':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x70')],'allRequiredParamsPresent':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x71')],'endConversation':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x72')]&&_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x72')]['fields']?_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x72')]['fields'][_0xd4e0('0x73')]['boolValue']:![],'fulfillmentText':_0x2874cb['queryResult'][_0xd4e0('0x74')],'intentName':_0x2874cb['queryResult'][_0xd4e0('0x75')][_0xd4e0('0x5b')],'intentDisplayName':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x75')][_0xd4e0('0x76')],'isFallbackIntent':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x75')][_0xd4e0('0x77')],'languageCode':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x78')],'queryText':_0x2874cb['queryResult'][_0xd4e0('0x79')],'responseId':_0x2874cb['responseId'],'score':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x7a')],'speech':_0x2874cb[_0xd4e0('0x6f')][_0xd4e0('0x74')],'providerResponse':JSON[_0xd4e0('0x46')](_0x5c0ca5)};return _0x8734f4;}}});};exports[_0xd4e0('0x7b')]=function(_0x5904f2,_0x231504,_0x3aada8,_0x40bf87){return tilde[_0xd4e0('0x50')](_0x5904f2,_0x231504,_0x3aada8,_0x40bf87)['then'](function(_0x4c7b22){try{fs[_0xd4e0('0x22')](_0x5904f2);}catch(_0x417f25){logger[_0xd4e0('0x18')](_0x417f25);}logger[_0xd4e0('0x1f')]('Tilde\x20ASR\x20transcription',_0x4c7b22['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x4c7b22[_0xd4e0('0x57')]);return _0x4c7b22;});};exports[_0xd4e0('0x7c')]=function(_0x49759d,_0x576c11,_0xe8877b,_0x14d708,_0x293bb7,_0x3a6421){var _0x479056=path[_0xd4e0('0x2d')](__dirname,_0xd4e0('0x2e'),rs[_0xd4e0('0x40')](0x4)+_0xd4e0('0x7d'));var _0x542ebb;return aws[_0xd4e0('0x7e')](_0x49759d,_0x576c11,_0xe8877b,_0x14d708,_0x293bb7,_0x3a6421,_0x479056)[_0xd4e0('0x32')](function(){_0x542ebb=path[_0xd4e0('0x2d')](__dirname,_0xd4e0('0x2e'),rs[_0xd4e0('0x40')](0x4)+_0xd4e0('0x2f'));return convertFile(_0x479056,_0x542ebb);})[_0xd4e0('0x32')](function(){try{fs[_0xd4e0('0x22')](_0x479056);fs['chmodSync'](_0x542ebb,_0xd4e0('0x34'));}catch(_0x103801){logger[_0xd4e0('0x18')](_0x103801);}return _0x542ebb[_0xd4e0('0x43')]('.')[0x0];});};exports[_0xd4e0('0x7f')]=function(_0x3c08a0,_0xb3517f,_0x4ee91a,_0x2d83b8,_0x3f6ef9,_0x315b68){return aws[_0xd4e0('0x80')](_0x3c08a0,_0xb3517f,_0x4ee91a,_0x2d83b8,_0x3f6ef9,_0x315b68)[_0xd4e0('0x32')](function(_0x3c7ffb){logger[_0xd4e0('0x1f')](JSON[_0xd4e0('0x46')](_0x3c7ffb));return _0x3c7ffb;});};exports['ispeechTTS']=function(_0x726f61,_0xc15ac9,_0x16ae6b,_0xfb16b6){var _0x3ef3de=util[_0xd4e0('0x81')](_0xd4e0('0x82'),ISPEECH_API,_0x726f61,encodeURIComponent(_0xc15ac9),_0x16ae6b,_0xfb16b6);var _0x4e80ab=path[_0xd4e0('0x2d')](__dirname,'tmp',rs[_0xd4e0('0x40')](0x4)+'.mp3');var _0x3f91be;return downloadFile(_0x3ef3de,_0x4e80ab)[_0xd4e0('0x32')](function(){_0x3f91be=path[_0xd4e0('0x2d')](__dirname,_0xd4e0('0x2e'),rs[_0xd4e0('0x40')](0x4)+'.wav');return convertFile(_0x4e80ab,_0x3f91be);})[_0xd4e0('0x32')](function(){try{fs['unlink'](_0x4e80ab);fs[_0xd4e0('0x33')](_0x3f91be,_0xd4e0('0x34'));}catch(_0xb2b990){logger[_0xd4e0('0x18')](_0xb2b990);}return _0x3f91be[_0xd4e0('0x43')]('.')[0x0];});};exports[_0xd4e0('0x83')]=function(_0x3943d1,_0x2d8e41,_0x42e5c6,_0x1b0ed4){var _0x282f3f=util[_0xd4e0('0x81')](_0xd4e0('0x84'),ISPEECH_API,_0x2d8e41,_0x42e5c6,base64Encode(_0x3943d1),_0x1b0ed4?util['format'](_0xd4e0('0x85'),encodeURIComponent(_0x1b0ed4)):_0xd4e0('0x86'));return uploadFile(_0x282f3f)['then'](function(_0x4ee971){return querystring[_0xd4e0('0xd')](_0x4ee971);});};exports['sestekNDA']=function(_0x49f685,_0x5b4fd3){return sestek[_0xd4e0('0x87')](_0x49f685,_0x5b4fd3)['then'](function(_0x4c915b){logger[_0xd4e0('0x1f')](JSON['stringify'](_0x4c915b));var _0x56d67d={'speech':_0x4c915b[_0xd4e0('0x88')],'action':_0x4c915b['channelData']?_0x4c915b[_0xd4e0('0x89')][_0xd4e0('0x8a')]:undefined,'actiondata':_0x4c915b[_0xd4e0('0x89')]?_0x4c915b[_0xd4e0('0x89')][_0xd4e0('0x8b')]:undefined};if(_0x4c915b[_0xd4e0('0x89')]&&_0x4c915b[_0xd4e0('0x89')][_0xd4e0('0x8c')]){return base64Decode(_0x4c915b['channelData'][_0xd4e0('0x8c')][_0xd4e0('0x8d')],path['resolve'](__dirname,_0xd4e0('0x2e'),rs['generate'](0x4)+_0xd4e0('0x2f')))[_0xd4e0('0x32')](function(_0x39087c){_0x56d67d[_0xd4e0('0x8e')]=_0x39087c;return _0x56d67d;});}return _0x56d67d;});};exports[_0xd4e0('0x8f')]=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 569914d..15d581b 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 _0xb2e9=['./nda','exports'];(function(_0x3ff205,_0x332e6c){var _0x19b811=function(_0x4c04fd){while(--_0x4c04fd){_0x3ff205['push'](_0x3ff205['shift']());}};_0x19b811(++_0x332e6c);}(_0xb2e9,0x1b8));var _0x9b2e=function(_0xcc28d,_0x555258){_0xcc28d=_0xcc28d-0x0;var _0xe3b1d4=_0xb2e9[_0xcc28d];return _0xe3b1d4;};var nda=require(_0x9b2e('0x0'));module[_0x9b2e('0x1')]={'nda':nda}; \ No newline at end of file +var _0x3327=['exports'];(function(_0x4a4fb8,_0x1c8af){var _0x1d27c8=function(_0x56ae4f){while(--_0x56ae4f){_0x4a4fb8['push'](_0x4a4fb8['shift']());}};_0x1d27c8(++_0x1c8af);}(_0x3327,0x1e9));var _0x7332=function(_0x2eb218,_0x75c037){_0x2eb218=_0x2eb218-0x0;var _0x53588f=_0x3327[_0x2eb218];return _0x53588f;};var nda=require('./nda');module[_0x7332('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ab0d9c7..c8bc8d5 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 _0x0e9f=['AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','exports','ndauth_url','/token','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','project','channelData','ProjectName','ndagenerate_audio','body'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0e9f,0x116));var _0xf0e9=function(_0x5e8f61,_0x47d08e){_0x5e8f61=_0x5e8f61-0x0;var _0x2a0de1=_0x0e9f[_0x5e8f61];return _0x2a0de1;};'use strict';var rp=require(_0xf0e9('0x0'));var url=require(_0xf0e9('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0xf0e9('0x2')]=function(_0x4c067c,_0x4b7f25){var _0x2d2d99={'method':'POST','uri':url['resolve'](_0x4b7f25[_0xf0e9('0x3')],_0xf0e9('0x4')),'form':{'grant_type':'password','username':_0x4b7f25[_0xf0e9('0x5')],'password':_0x4b7f25['password']},'json':!![]};return rp(_0x2d2d99)[_0xf0e9('0x6')](function(_0x2fa08f){var _0x106ba0={'method':'POST','uri':url['resolve'](_0x4b7f25[_0xf0e9('0x7')],_0xf0e9('0x8')),'body':{'type':_0x4b7f25[_0xf0e9('0x9')]||'message','channelId':_0xf0e9('0xa'),'conversation':{'id':_0x4c067c[_0xf0e9('0xb')]},'from':{'id':_0x4c067c[_0xf0e9('0xc')],'name':_0x4c067c['calleridname']},'recipient':{'id':_0x4c067c[_0xf0e9('0xd')],'name':_0x4c067c[_0xf0e9('0xe')]},'text':_0x4b7f25[_0xf0e9('0xf')],'channelData':{}},'headers':{'Authorization':_0xf0e9('0x10')+_0x2fa08f['access_token']},'json':!![]};if(_0x4b7f25[_0xf0e9('0x11')]){_0x106ba0['body'][_0xf0e9('0x12')][_0xf0e9('0x13')]=_0x4b7f25['project'];}if(_0x4b7f25[_0xf0e9('0x14')]=='1'){_0x106ba0[_0xf0e9('0x15')][_0xf0e9('0x12')][_0xf0e9('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf0e9('0x17')};}if(_0x4b7f25[_0xf0e9('0x18')]){_0x106ba0['body'][_0xf0e9('0x12')][_0xf0e9('0x19')]=_0x4b7f25['custom_action'];if(_0x4b7f25[_0xf0e9('0x1a')]){_0x106ba0[_0xf0e9('0x15')][_0xf0e9('0x12')][_0xf0e9('0x1b')]=_0x4b7f25['custom_action_data'];}}logger[_0xf0e9('0x1c')](JSON[_0xf0e9('0x1d')](_0x106ba0));return rp(_0x106ba0);});}; \ No newline at end of file +var _0x1020=['request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data'];(function(_0x4b92a8,_0x2c7d6c){var _0x54bcb9=function(_0x1c9ff2){while(--_0x1c9ff2){_0x4b92a8['push'](_0x4b92a8['shift']());}};_0x54bcb9(++_0x2c7d6c);}(_0x1020,0x1a4));var _0x0102=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0x1020[_0x4bacb6];return _0x58c029;};'use strict';var rp=require(_0x0102('0x0'));var url=require('url');var logger=require(_0x0102('0x1'))(_0x0102('0x2'));module[_0x0102('0x3')]=function(_0x15aee5,_0x1240be){var _0x26cecd={'method':_0x0102('0x4'),'uri':url[_0x0102('0x5')](_0x1240be[_0x0102('0x6')],_0x0102('0x7')),'form':{'grant_type':_0x0102('0x8'),'username':_0x1240be[_0x0102('0x9')],'password':_0x1240be['password']},'json':!![]};return rp(_0x26cecd)[_0x0102('0xa')](function(_0x1aa60e){var _0x43df9f={'method':'POST','uri':url['resolve'](_0x1240be[_0x0102('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1240be['ndaactivity_type']||_0x0102('0xc'),'channelId':_0x0102('0xd'),'conversation':{'id':_0x15aee5[_0x0102('0xe')]},'from':{'id':_0x15aee5[_0x0102('0xf')],'name':_0x15aee5[_0x0102('0x10')]},'recipient':{'id':_0x15aee5['dnid'],'name':_0x15aee5[_0x0102('0x11')]},'text':_0x1240be[_0x0102('0x12')],'channelData':{}},'headers':{'Authorization':_0x0102('0x13')+_0x1aa60e[_0x0102('0x14')]},'json':!![]};if(_0x1240be[_0x0102('0x15')]){_0x43df9f[_0x0102('0x16')][_0x0102('0x17')][_0x0102('0x18')]=_0x1240be[_0x0102('0x15')];}if(_0x1240be['ndagenerate_audio']=='1'){_0x43df9f['body'][_0x0102('0x17')][_0x0102('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0102('0x1a')};}if(_0x1240be[_0x0102('0x1b')]){_0x43df9f[_0x0102('0x16')][_0x0102('0x17')][_0x0102('0x1c')]=_0x1240be[_0x0102('0x1b')];if(_0x1240be[_0x0102('0x1d')]){_0x43df9f[_0x0102('0x16')][_0x0102('0x17')]['CustomActionData']=_0x1240be[_0x0102('0x1d')];}}logger['info'](JSON['stringify'](_0x43df9f));return rp(_0x43df9f);});}; \ 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 55ec913..57d2b99 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 _0x24f9=['./lib/api','exports'];(function(_0x369447,_0x522e7a){var _0x11746e=function(_0x43728e){while(--_0x43728e){_0x369447['push'](_0x369447['shift']());}};_0x11746e(++_0x522e7a);}(_0x24f9,0x98));var _0x924f=function(_0x29eb95,_0x4e2c8e){_0x29eb95=_0x29eb95-0x0;var _0x10633c=_0x24f9[_0x29eb95];return _0x10633c;};'use strict';var asr=require(_0x924f('0x0'));module[_0x924f('0x1')]=function(_0x3260a7,_0x1be341,_0x291290,_0xb1b8d){return asr(_0x3260a7,_0x1be341,_0x291290,_0xb1b8d);}; \ No newline at end of file +var _0x26c9=['./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x26c9,0x199));var _0x926c=function(_0x54da7a,_0x3ea62f){_0x54da7a=_0x54da7a-0x0;var _0x210d15=_0x26c9[_0x54da7a];return _0x210d15;};'use strict';var asr=require(_0x926c('0x0'));module['exports']=function(_0x339e28,_0x225ac6,_0x1e0e31,_0x589754){return asr(_0x339e28,_0x225ac6,_0x1e0e31,_0x589754);}; \ 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 eece73a..c615302 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 _0x9c7f=['exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','unix','send','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','close','lodash','moment','crypto','agi'];(function(_0x1cea67,_0x2cf3dd){var _0x4ee686=function(_0xc58bd0){while(--_0xc58bd0){_0x1cea67['push'](_0x1cea67['shift']());}};_0x4ee686(++_0x2cf3dd);}(_0x9c7f,0x106));var _0xf9c7=function(_0x54f948,_0x291c02){_0x54f948=_0x54f948-0x0;var _0x76ff8c=_0x9c7f[_0x54f948];return _0x76ff8c;};'use strict';var BPromise=require('bluebird');var _=require(_0xf9c7('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf9c7('0x1'));var crypto=require(_0xf9c7('0x2'));var logger=require('../../../../../../config/logger')(_0xf9c7('0x3'));module[_0xf9c7('0x4')]=function(_0x41871a,_0x47342d,_0x1d429f,_0x2f542b){return new BPromise(function(_0x2a3134,_0x3fb444){logger[_0xf9c7('0x5')]('Tilde\x20URI',_0x2f542b||_0xf9c7('0x6'));var _0x2eb877=new WebSocket(_0x2f542b||_0xf9c7('0x6'),{'perMessageDeflate':![]});var _0x3320e1='';var _0x25ae07='0';var _0x4c5c87='1';var _0x3d5d73=_0xf9c7('0x7');function _0x1a2c00(_0x3a4855){var _0xd99d95=crypto[_0xf9c7('0x8')](_0xf9c7('0x9'));_0xd99d95[_0xf9c7('0xa')](_0x3a4855);return _0xd99d95['digest'](_0xf9c7('0xb'));}function _0x49b12c(){try{logger[_0xf9c7('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x57a265=moment()[_0xf9c7('0xc')]();var _0x5b54b8=_0x1a2c00(_0x57a265+_0x47342d+_0x1d429f);_0x2eb877[_0xf9c7('0xd')](JSON['stringify']({'appID':_0x47342d,'timestamp':_0x57a265,'appKey':_0x5b54b8}));var _0x330f76=fs[_0xf9c7('0xe')](_0x41871a);_0x330f76['on'](_0xf9c7('0xf'),function(_0x2bda62){_0x2eb877[_0xf9c7('0xd')](_0x2bda62);});_0x330f76['on']('close',function(){_0x2eb877[_0xf9c7('0xd')](_0xf9c7('0x10'));});}catch(_0x558eca){logger[_0xf9c7('0x11')](_0xf9c7('0x12'),JSON[_0xf9c7('0x13')](_0x558eca));_0x2eb877[_0xf9c7('0x14')]();}}function _0x55a2ea(_0x4cf2e7){try{if(_0x4cf2e7){var _0x144e6d=JSON[_0xf9c7('0x15')](_0x4cf2e7);switch(_0x144e6d['status']){case 0x0:if(_0x144e6d[_0xf9c7('0x16')]){if(_0x144e6d['result'][_0xf9c7('0x17')]){logger[_0xf9c7('0x5')](_0xf9c7('0x18'),JSON[_0xf9c7('0x13')](_0x144e6d[_0xf9c7('0x16')]['hypotheses']));_0x3320e1=_0x144e6d['result']['hypotheses'][0x0][_0xf9c7('0x19')];_0x25ae07=_0x144e6d[_0xf9c7('0x16')][_0xf9c7('0x1a')][0x0]['likelihood'];_0x4c5c87='0';_0x3d5d73=_0xf9c7('0x1b');_0x2eb877[_0xf9c7('0x14')]();}}break;case 0x1:logger[_0xf9c7('0x5')](_0xf9c7('0x7'));_0x4c5c87='1';_0x3d5d73='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf9c7('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4c5c87='2';_0x3d5d73=_0xf9c7('0x1c');break;case 0x9:logger[_0xf9c7('0x5')](_0xf9c7('0x1d'));_0x4c5c87='9';_0x3d5d73=_0xf9c7('0x1d');break;case 0xa:logger['info'](_0xf9c7('0x1e'));_0x4c5c87='10';_0x3d5d73=_0xf9c7('0x1e');break;case 0xb:logger[_0xf9c7('0x5')](_0xf9c7('0x1f'));_0x4c5c87='11';_0x3d5d73=_0xf9c7('0x1f');}}}catch(_0x3ff6c2){logger[_0xf9c7('0x11')](_0xf9c7('0x20'),JSON[_0xf9c7('0x13')](_0x3ff6c2));_0x2eb877[_0xf9c7('0x14')]();}}function _0x3058d9(){logger[_0xf9c7('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x2a3134({'transcript':_0x3320e1,'confidence':_0x25ae07,'status':_0x4c5c87,'status_message':_0x3d5d73});}function _0x37752a(_0x20816f){logger[_0xf9c7('0x11')](_0xf9c7('0x21'));if(!_[_0xf9c7('0x22')](_0x20816f)){logger[_0xf9c7('0x11')](_['isObject'](_0x20816f)?JSON['stringify'](_0x20816f):_0x20816f);}}_0x2eb877['on'](_0xf9c7('0x23'),_0x49b12c);_0x2eb877['on'](_0xf9c7('0x24'),_0x55a2ea);_0x2eb877['on'](_0xf9c7('0x25'),_0x3058d9);_0x2eb877['on']('error',_0x37752a);});}; \ No newline at end of file +var _0x321b=['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','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','stringify','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message'];(function(_0x9f0857,_0x10fb0c){var _0x41011e=function(_0x4a2167){while(--_0x4a2167){_0x9f0857['push'](_0x9f0857['shift']());}};_0x41011e(++_0x10fb0c);}(_0x321b,0x156));var _0xb321=function(_0x9a34e4,_0x3bbc44){_0x9a34e4=_0x9a34e4-0x0;var _0x30cd29=_0x321b[_0x9a34e4];return _0x30cd29;};'use strict';var BPromise=require('bluebird');var _=require(_0xb321('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb321('0x1'));var crypto=require(_0xb321('0x2'));var logger=require(_0xb321('0x3'))('agi');module[_0xb321('0x4')]=function(_0x5eb85b,_0x2bb6a5,_0x3a6bd0,_0xbd2979){return new BPromise(function(_0x54188c,_0x3b8682){logger[_0xb321('0x5')](_0xb321('0x6'),_0xbd2979||_0xb321('0x7'));var _0x3ca844=new WebSocket(_0xbd2979||_0xb321('0x7'),{'perMessageDeflate':![]});var _0x381025='';var _0x195773='0';var _0xf6bb64='1';var _0x2e66e2=_0xb321('0x8');function _0x171a45(_0x3366c6){var _0x5e14ca=crypto[_0xb321('0x9')]('sha1');_0x5e14ca[_0xb321('0xa')](_0x3366c6);return _0x5e14ca['digest'](_0xb321('0xb'));}function _0x13ad48(){try{logger[_0xb321('0x5')](_0xb321('0xc'));var _0x293b65=moment()[_0xb321('0xd')]();var _0x2e4f02=_0x171a45(_0x293b65+_0x2bb6a5+_0x3a6bd0);_0x3ca844[_0xb321('0xe')](JSON['stringify']({'appID':_0x2bb6a5,'timestamp':_0x293b65,'appKey':_0x2e4f02}));var _0x1a38a4=fs[_0xb321('0xf')](_0x5eb85b);_0x1a38a4['on'](_0xb321('0x10'),function(_0x344c86){_0x3ca844['send'](_0x344c86);});_0x1a38a4['on'](_0xb321('0x11'),function(){_0x3ca844[_0xb321('0xe')]('EOS');});}catch(_0x276f2e){logger[_0xb321('0x12')](_0xb321('0x13'),JSON[_0xb321('0x14')](_0x276f2e));_0x3ca844['terminate']();}}function _0x1effce(_0x186bda){try{if(_0x186bda){var _0x12dc49=JSON['parse'](_0x186bda);switch(_0x12dc49[_0xb321('0x15')]){case 0x0:if(_0x12dc49[_0xb321('0x16')]){if(_0x12dc49[_0xb321('0x16')][_0xb321('0x17')]){logger[_0xb321('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0xb321('0x14')](_0x12dc49[_0xb321('0x16')][_0xb321('0x18')]));_0x381025=_0x12dc49[_0xb321('0x16')]['hypotheses'][0x0][_0xb321('0x19')];_0x195773=_0x12dc49[_0xb321('0x16')]['hypotheses'][0x0][_0xb321('0x1a')];_0xf6bb64='0';_0x2e66e2=_0xb321('0x1b');_0x3ca844[_0xb321('0x1c')]();}}break;case 0x1:logger['info'](_0xb321('0x8'));_0xf6bb64='1';_0x2e66e2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xb321('0x1d'));_0xf6bb64='2';_0x2e66e2=_0xb321('0x1d');break;case 0x9:logger[_0xb321('0x5')](_0xb321('0x1e'));_0xf6bb64='9';_0x2e66e2=_0xb321('0x1e');break;case 0xa:logger[_0xb321('0x5')](_0xb321('0x1f'));_0xf6bb64='10';_0x2e66e2='Authentication\x20failed.';break;case 0xb:logger[_0xb321('0x5')](_0xb321('0x20'));_0xf6bb64='11';_0x2e66e2='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x42641b){logger[_0xb321('0x12')](_0xb321('0x21'),JSON[_0xb321('0x14')](_0x42641b));_0x3ca844[_0xb321('0x1c')]();}}function _0x355eb7(){logger[_0xb321('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x54188c({'transcript':_0x381025,'confidence':_0x195773,'status':_0xf6bb64,'status_message':_0x2e66e2});}function _0x53be7b(_0x33501e){logger[_0xb321('0x12')](_0xb321('0x22'));if(!_[_0xb321('0x23')](_0x33501e)){logger[_0xb321('0x12')](_['isObject'](_0x33501e)?JSON['stringify'](_0x33501e):_0x33501e);}}_0x3ca844['on'](_0xb321('0x24'),_0x13ad48);_0x3ca844['on'](_0xb321('0x25'),_0x1effce);_0x3ca844['on'](_0xb321('0x11'),_0x355eb7);_0x3ca844['on'](_0xb321('0x12'),_0x53be7b);});}; \ 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 835e1a4..3e2292a 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 _0xd0c2=['./asr'];(function(_0x756aca,_0x295527){var _0x26acd7=function(_0x32d259){while(--_0x32d259){_0x756aca['push'](_0x756aca['shift']());}};_0x26acd7(++_0x295527);}(_0xd0c2,0xd9));var _0x2d0c=function(_0x26ab60,_0x32211d){_0x26ab60=_0x26ab60-0x0;var _0x1891e0=_0xd0c2[_0x26ab60];return _0x1891e0;};var asr=require(_0x2d0c('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x7162=['./asr','exports'];(function(_0x4fc11a,_0x2b9879){var _0x3e15bf=function(_0x23554f){while(--_0x23554f){_0x4fc11a['push'](_0x4fc11a['shift']());}};_0x3e15bf(++_0x2b9879);}(_0x7162,0x160));var _0x2716=function(_0x283ab7,_0x351d73){_0x283ab7=_0x283ab7-0x0;var _0x537c53=_0x7162[_0x283ab7];return _0x537c53;};var asr=require(_0x2716('0x0'));module[_0x2716('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 75b9e06..e445fda 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0xe706,0xa3));var _0x6e70=function(_0x8969c2,_0xc524b7){_0x8969c2=_0x8969c2-0x0;var _0x519f23=_0xe706[_0x8969c2];return _0x519f23;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 915a7c6..4ea14bf 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 _0x950a=['Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','response','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','condition','true','false','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20found','sms_text','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawHeaders','rawBody','getsecretdigits','channel','rpc','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','number','includes','POST','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','clone','isString','isPlainObject','isArray','length','recursiveNodeIndex','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','getVariable','getAndSetVariable','extra','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x950a,0x111));var _0xa950=function(_0x12b0a7,_0x543d32){_0x12b0a7=_0x12b0a7-0x0;var _0x57931e=_0x950a[_0x12b0a7];return _0x57931e;};'use strict';var fs=require('fs');var util=require(_0xa950('0x0'));var _=require(_0xa950('0x1'));var sh=require(_0xa950('0x2'));var odbc=require(_0xa950('0x3'))();var rs=require('randomstring');var moment=require(_0xa950('0x4'));var Mustache=require(_0xa950('0x5'));var rp=require(_0xa950('0x6'));var logger=require(_0xa950('0x7'))('agi');var config=require(_0xa950('0x8'));var scripts=require(_0xa950('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xa950('0xa'),_0xa950('0xb')];var verticesWithRetry=['menu','getdigits',_0xa950('0xc')];var AGIVertices=function(_0x12ef5a,_0x7d87b2,_0x2c77da){this[_0xa950('0xd')]=_0x12ef5a;this[_0xa950('0xe')]=_0x7d87b2;this['mailRpc']=_0x2c77da;};AGIVertices['prototype']['getVariable']=function(_0x2bccea,_0x48c1b5){this[_0xa950('0xe')][_0xa950('0xf')](_0x2bccea)[_0xa950('0x10')](function(_0x524c56){_0x48c1b5(null,_0x524c56?_0x524c56[_0xa950('0x11')]:![]);})['catch'](function(_0x10e64a){_0x48c1b5(_0x10e64a);});};AGIVertices[_0xa950('0x12')][_0xa950('0x13')]=function(_0x4c217c,_0xf1582){this[_0xa950('0xe')][_0xa950('0x14')](_0x4c217c)['then'](function(_0x24fb36){_0xf1582(null,_0x24fb36?_0x24fb36[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x5d5f4c){_0xf1582(_0x5d5f4c);});};AGIVertices[_0xa950('0x12')][_0xa950('0x16')]=function(_0x1598a8,_0x4df9d1){this[_0xa950('0xe')][_0xa950('0x17')](_0x1598a8)[_0xa950('0x10')](function(_0x1021da){_0x4df9d1(null,_0x1021da?_0x1021da[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x2b0e44){_0x4df9d1(_0x2b0e44);});};AGIVertices[_0xa950('0x12')][_0xa950('0x18')]=function(_0x18266c,_0x28fedf){this[_0xa950('0xe')][_0xa950('0x19')](_0x18266c)['then'](function(_0x3c7f18){_0x28fedf(null,_0x3c7f18?_0x3c7f18[_0xa950('0x1a')]:![]);})['catch'](function(_0x1f9894){_0x28fedf(_0x1f9894);});};AGIVertices[_0xa950('0x12')]['getUser']=function(_0x2e6f72,_0x5ad191){this[_0xa950('0xe')][_0xa950('0x1b')](_0x2e6f72)[_0xa950('0x10')](function(_0x36a16c){_0x5ad191(null,_0x36a16c?_0x36a16c['name']:![]);})[_0xa950('0x15')](function(_0x3f4633){_0x5ad191(_0x3f4633);});};AGIVertices[_0xa950('0x12')][_0xa950('0x1c')]=function(_0x292c73,_0x22e2c1){this[_0xa950('0xe')][_0xa950('0x1d')](_0x292c73)[_0xa950('0x10')](function(_0xc4894b){_0x22e2c1(null,_0xc4894b?_0xc4894b[_0xa950('0x11')]:![]);})[_0xa950('0x15')](function(_0x43f8c8){_0x22e2c1(_0x43f8c8);});};AGIVertices['prototype'][_0xa950('0x1e')]=function(_0x288934,_0x3f37f8){var _0x1aa96a=this;this[_0xa950('0xe')][_0xa950('0x1f')](_0x288934)[_0xa950('0x10')](function(_0x52e133){_0x3f37f8(null,_0x52e133?_0x1aa96a[_0xa950('0x20')](_0x52e133[_0xa950('0x21')]):![]);})['catch'](function(_0x44ee6e){_0x3f37f8(_0x44ee6e);});};AGIVertices[_0xa950('0x12')][_0xa950('0x22')]=function(_0x1875eb,_0x152f53){this[_0xa950('0xe')][_0xa950('0x23')](_0x1875eb)[_0xa950('0x10')](function(_0x203703){_0x152f53(null,_0x203703?_0x203703:![]);})[_0xa950('0x15')](function(_0x4de9f0){_0x152f53(_0x4de9f0);});};AGIVertices[_0xa950('0x12')]['sendMailMessage']=function(_0x565933,_0x26ee82,_0x5db455){this[_0xa950('0x24')][_0xa950('0x25')](_0x565933,_0x26ee82)[_0xa950('0x10')](function(){_0x5db455(null);})[_0xa950('0x15')](function(_0x55f3da){_0x5db455(_0x55f3da);});};AGIVertices[_0xa950('0x12')]['getIntervals']=function(_0x45846c,_0x2306f8){this['rpc']['getIntervalById'](_0x45846c)[_0xa950('0x10')](function(_0x1ccbed){if(_0x1ccbed){if(_0x1ccbed[_0xa950('0x26')]){_0x2306f8(null,[_0x1ccbed[_0xa950('0x27')]]);}else{_0x2306f8(null,_[_0xa950('0x28')](_0x1ccbed[_0xa950('0x29')],'interval'));}}else{_0x2306f8(null,![]);}})['catch'](function(_0x356258){_0x2306f8(_0x356258);});};AGIVertices['prototype'][_0xa950('0x20')]=function(_0x11a061){return util[_0xa950('0x2a')](_0xa950('0x2b'),FILES_PATH,_0x11a061);};AGIVertices[_0xa950('0x12')][_0xa950('0x2c')]=function(_0xd7f55d,_0x3cc798,_0x1ba2fd){odbc[_0xa950('0x2d')](_0xd7f55d,function(_0x55d7d9){if(_0x55d7d9){logger[_0xa950('0x2e')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x55d7d9);_0x1ba2fd(_0x55d7d9);}else{logger[_0xa950('0x2f')](_0xa950('0x30'));odbc['query'](_0x3cc798,function(_0x4c6588,_0x3d49f4){if(_0x4c6588){logger[_0xa950('0x2f')]('Error\x20executing\x20query\x20%s',_0x3cc798);_0x1ba2fd(_0x4c6588);}else{logger[_0xa950('0x2f')](_0xa950('0x31'),_0x3cc798);odbc['close'](function(_0x213a58){if(_0x213a58){logger[_0xa950('0x2e')](_0xa950('0x32'),_0x213a58);}_0x1ba2fd(null,_0x3d49f4);});}});}});};AGIVertices[_0xa950('0x12')][_0xa950('0x33')]=function(_0x35cfcc,_0x4253ce){this[_0xa950('0xe')]['getSmsAccountById'](_0x35cfcc)[_0xa950('0x10')](function(_0x1764b2){_0x4253ce(null,_0x1764b2?_0x1764b2:![]);})['catch'](function(_0x732bc1){_0x4253ce(_0x732bc1);});};AGIVertices[_0xa950('0x12')][_0xa950('0x34')]=function(_0x57205b,_0x25c9f3){this[_0xa950('0xe')][_0xa950('0x34')](_0x57205b)['then'](function(_0x545090){_0x25c9f3(null,_0x545090);})[_0xa950('0x15')](function(_0x75ff6c){_0x25c9f3(_0x75ff6c);});};AGIVertices[_0xa950('0x12')]['createSquareDetailsReport']=function(_0x49a235,_0x51f5a5,_0x41619f){this[_0xa950('0xe')][_0xa950('0x35')]({'uniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'node':_0x49a235['label'],'application':_0x49a235[_0xa950('0x37')],'data':_0x51f5a5||null,'project_name':this[_0xa950('0xd')]['arg_1'],'callerid':this['channel'][_0xa950('0x38')]})[_0xa950('0x10')](function(_0x4f34b2){if(_0x41619f){_0x41619f(null,_0x4f34b2);}})['catch'](function(_0x5040c1){if(_0x41619f){_0x41619f(_0x5040c1);}});};AGIVertices['prototype'][_0xa950('0x39')]=function(_0x3cc04b,_0x5ae175,_0x5672c3,_0x286881){this['rpc'][_0xa950('0x39')]({'uniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'callerid':this[_0xa950('0xd')][_0xa950('0x38')],'calleridname':this[_0xa950('0xd')][_0xa950('0x3a')],'context':this[_0xa950('0xd')]['context'],'extension':this[_0xa950('0xd')]['extension'],'priority':this[_0xa950('0xd')][_0xa950('0x3b')],'accountcode':this[_0xa950('0xd')][_0xa950('0x3c')],'dnid':this[_0xa950('0xd')][_0xa950('0x3d')],'projectName':this[_0xa950('0xd')][_0xa950('0x3e')],'saveName':_0x5ae175,'filename':_0x3cc04b[_0xa950('0x3f')]||_0x5ae175,'savePath':_0x5672c3})['then'](function(_0x3cf01c){_0x286881(null,_0x3cf01c);})[_0xa950('0x15')](function(_0x36ddb8){_0x286881(_0x36ddb8);});};AGIVertices[_0xa950('0x12')][_0xa950('0x40')]=function(_0x5a2b2f,_0x237152,_0xde68b2,_0x3f0bb5,_0x84a54){this[_0xa950('0xe')][_0xa950('0x40')]({'uniqueid':this[_0xa950('0xd')]['uniqueid'],'body':_0x5a2b2f,'direction':_0x237152,'providerName':_0xde68b2,'providerResponse':_0x3f0bb5})[_0xa950('0x10')](function(_0x13a66d){if(_0x84a54){_0x84a54(null,_0x13a66d);}})[_0xa950('0x15')](function(_0x4a163f){if(_0x84a54){_0x84a54(_0x4a163f);}});};AGIVertices['prototype'][_0xa950('0x41')]=function(_0x26216c,_0x38c370){this[_0xa950('0xe')][_0xa950('0x41')]({'firstName':_[_0xa950('0x42')](_0x26216c[_0xa950('0x11')])||_[_0xa950('0x43')](_0x26216c['name'])?_0xa950('0x44')+Math[_0xa950('0x45')]():_0x26216c[_0xa950('0x11')],'lastName':_[_0xa950('0x42')](_0x26216c[_0xa950('0x46')])||_['isNil'](_0x26216c[_0xa950('0x46')])?null:_0x26216c['lastName'],'phone':_0x26216c[_0xa950('0x47')],'ListId':_0x26216c[_0xa950('0x48')],'scheduledat':_0x26216c[_0xa950('0x49')],'callbackUniqueid':this[_0xa950('0xd')][_0xa950('0x36')],'tags':_0xa950('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x26216c['scheduledAt']['toString'](),'priority':_0x26216c[_0xa950('0x4b')]})[_0xa950('0x10')](function(_0x1303a9){_0x38c370(null,_0x1303a9);})[_0xa950('0x15')](function(_0x447459){_0x38c370(_0x447459);});};AGIVertices[_0xa950('0x12')][_0xa950('0x4c')]=function(_0x18700a,_0x5e16e7){this[_0xa950('0xe')]['getPauseById'](_0x18700a)[_0xa950('0x10')](function(_0x4e0fdc){_0x5e16e7(null,_0x4e0fdc?_0x4e0fdc[_0xa950('0x11')]:![]);})['catch'](function(_0x292de6){_0x5e16e7(_0x292de6);});};AGIVertices['prototype'][_0xa950('0x4d')]=function(_0x3e536e,_0x3ead91,_0x3d6e1b){var _0x46cfe4={'role':'agent'};_0x46cfe4[_0x3e536e]=this[_0xa950('0xd')][_0xa950('0x38')];this[_0xa950('0xe')][_0xa950('0x4d')](_0x46cfe4,_0x3ead91,this[_0xa950('0xd')]['uniqueid'])[_0xa950('0x10')](function(_0x117a56){_0x3d6e1b(null,_[_0xa950('0x43')](_0x117a56)?![]:!![]);})[_0xa950('0x15')](function(_0x35e7dc){logger['error'](_0x35e7dc);_0x3d6e1b(null,![]);});};AGIVertices[_0xa950('0x12')]['agentUnpause']=function(_0x5a32c1,_0x2eff92){var _0xcb3b8d={'role':_0xa950('0x4e')};_0xcb3b8d[_0x5a32c1]=this[_0xa950('0xd')]['callerid'];this['rpc'][_0xa950('0x4f')](_0xcb3b8d)[_0xa950('0x10')](function(_0x32ed18){_0x2eff92(null,_['isNil'](_0x32ed18)?![]:!![]);})[_0xa950('0x15')](function(_0x47697b){logger[_0xa950('0x2e')](_0x47697b);_0x2eff92(null,![]);});};AGIVertices[_0xa950('0x12')][_0xa950('0x50')]=function(_0x8972fb,_0x302500){var _0x3d10a8={'role':_0xa950('0x4e')};_0x3d10a8[_0x8972fb]=this['channel'][_0xa950('0x38')];this['rpc'][_0xa950('0x50')](_0x3d10a8)[_0xa950('0x10')](function(_0x285eaa){_0x302500(null,_[_0xa950('0x43')](_0x285eaa)?![]:!![]);})[_0xa950('0x15')](function(_0x2cca83){logger[_0xa950('0x2e')](_0x2cca83);_0x302500(null,![]);});};AGIVertices[_0xa950('0x12')][_0xa950('0x51')]=function(_0x2e6663,_0x120ea9){var _0x15301e={'role':_0xa950('0x4e')};_0x15301e[_0x2e6663]=this['channel']['callerid'];var _0x15e399=_0x2e6663!=_0xa950('0x52')?util[_0xa950('0x2a')](_0xa950('0x53'),_0xa950('0x54'),this[_0xa950('0xd')][_0xa950('0x38')]):undefined;this['rpc'][_0xa950('0x51')](_0x15301e,_0x15e399)[_0xa950('0x10')](function(_0x297be4){_0x120ea9(null,_[_0xa950('0x43')](_0x297be4)?![]:!![]);})[_0xa950('0x15')](function(_0x2cf13f){logger[_0xa950('0x2e')](_0x2cf13f);_0x120ea9(null,![]);});};AGIVertices[_0xa950('0x12')]['shellCommand']=function(_0x386a16,_0x3d4ed6){sh[_0xa950('0x55')](_[_0xa950('0x56')](_0x386a16),function(_0x3a0060,_0x5b79cf){var _0x2b7744=_0x5b79cf[_0xa950('0x57')](/(\r\n|\n|\r)/gm,'');_0x3d4ed6(null,_0x2b7744);});};AGIVertices[_0xa950('0x12')][_0xa950('0x58')]=function(_0x123bf6,_0x579378){scripts[_0xa950('0x58')](_0x123bf6[_0xa950('0x59')],_0x123bf6[_0xa950('0x5a')]||'text',_0x123bf6[_0xa950('0x5b')],_0x123bf6[_0xa950('0x5c')]||_0xa950('0x5d'),_0x123bf6[_0xa950('0x5e')]||'MALE',_0x123bf6[_0xa950('0x5f')]||_0xa950('0x60'))['then'](function(_0xda1471){_0x579378(null,_0xda1471);})[_0xa950('0x15')](function(_0x23a645){_0x579378(_0x23a645);});};AGIVertices[_0xa950('0x12')][_0xa950('0x61')]=function(_0x1215bb,_0x17b60c){scripts[_0xa950('0x61')](_0x1215bb[_0xa950('0x5b')],_0x1215bb[_0xa950('0x62')]||'en',0x1)[_0xa950('0x10')](function(_0x14fb0c){_0x17b60c(null,_0x14fb0c);})[_0xa950('0x15')](function(_0x59ef65){_0x17b60c(_0x59ef65);});};AGIVertices['prototype']['restAPI']=function(_0x5b88c9,_0xd6b04f){var _0x22066c={'uri':_0x5b88c9[_0xa950('0x63')],'method':_0x5b88c9['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5b88c9[_0xa950('0x64')])===_0xa950('0x65')&&parseInt(_0x5b88c9[_0xa950('0x64')])>=0x1?parseInt(_0x5b88c9[_0xa950('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xa950('0x66')]([_0xa950('0x67'),_0xa950('0x68')],_0x22066c['method'][_0xa950('0x69')]())){try{_0x22066c[_0xa950('0x6a')]=_0x5b88c9[_0xa950('0xb')]?JSON[_0xa950('0x6b')](_0x5b88c9[_0xa950('0xb')]):{};}catch(_0x14f3bb){logger[_0xa950('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x14f3bb);}}try{_0x22066c[_0xa950('0x6c')]=_0x5b88c9[_0xa950('0xa')]?JSON['parse'](_0x5b88c9[_0xa950('0xa')]):{};}catch(_0x15f4c3){logger[_0xa950('0x2e')](_0xa950('0x6d'),_0x15f4c3);}if(_0x5b88c9[_0xa950('0x6e')]){try{var _0x2cdfe8=require(_0x5b88c9[_0xa950('0x6e')])['sync'](this,_0x22066c);_0x22066c[_0xa950('0x6f')]=Mustache[_0xa950('0x70')](_0x5b88c9[_0xa950('0x63')],_0x2cdfe8,{},['$$','$$']);if(_0x22066c[_0xa950('0x6c')]){_0x22066c[_0xa950('0x6c')]=JSON[_0xa950('0x6b')](Mustache['render'](JSON[_0xa950('0x71')](_0x22066c[_0xa950('0x6c')]),_0x2cdfe8,{},['$$','$$']));}if(_0x22066c['body']){_0x22066c['body']=JSON['parse'](Mustache['render'](JSON[_0xa950('0x71')](_0x22066c[_0xa950('0x6a')]),_0x2cdfe8,{},['$$','$$']));}}catch(_0x4925f5){logger[_0xa950('0x2e')](_0xa950('0x72'),_0x4925f5);}}rp(_0x22066c)['then'](function(_0x2760ef){var _0x98722={'statusCode':_0x2760ef[_0xa950('0x73')]||0xc8,'statusMessage':_0x2760ef['statusMessage']||'OK','headers':_0x2760ef['headers']||{},'body':_0x2760ef[_0xa950('0x6a')]||{}};_0xd6b04f(null,_0x98722);})[_0xa950('0x15')](function(_0x3210e5){var _0xdddf1f={'statusCode':_0x3210e5[_0xa950('0x73')]||0x1f4,'statusMessage':_0x3210e5[_0xa950('0x74')]||_0xa950('0x75'),'headers':_0x3210e5[_0xa950('0x76')][_0xa950('0x6c')]||{},'body':_0x3210e5[_0xa950('0x76')][_0xa950('0x6a')]||{}};_0xd6b04f(null,_0xdddf1f);});};AGIVertices[_0xa950('0x12')]['googleDialogflow']=function(_0x40133e,_0x56822f){scripts[_0xa950('0x77')](this[_0xa950('0xd')]['uniqueid'],_0x40133e[_0xa950('0x78')],_0x40133e[_0xa950('0x5b')],_0x40133e['dialogflow_language']||'en')[_0xa950('0x10')](function(_0x1924c0){_0x56822f(null,_0x1924c0);})['catch'](function(_0x2b6fb0){_0x56822f(_0x2b6fb0);});};AGIVertices['prototype'][_0xa950('0x79')]=function(_0x459323,_0x5bef31){scripts[_0xa950('0x79')](this[_0xa950('0xd')][_0xa950('0x36')],_0x459323[_0xa950('0x7a')],_0x459323[_0xa950('0x7b')],_0x459323[_0xa950('0x7c')],_0x459323[_0xa950('0x5b')],_0x459323[_0xa950('0x7d')]||'en')['then'](function(_0x462803){_0x5bef31(null,_0x462803);})[_0xa950('0x15')](function(_0x3de108){_0x5bef31(_0x3de108);});};AGIVertices[_0xa950('0x12')][_0xa950('0x7e')]=function(_0x1fb819,_0x52b0ad){scripts[_0xa950('0x7e')](this[_0xa950('0xd')],_0x1fb819)['then'](function(_0x5e0d1f){_0x52b0ad(null,_0x5e0d1f);})[_0xa950('0x15')](function(_0x2bbd70){_0x52b0ad(_0x2bbd70);});};AGIVertices[_0xa950('0x12')][_0xa950('0x7f')]=function(_0x54cb84,_0x5e0732){scripts[_0xa950('0x7f')](_0x54cb84[_0xa950('0x78')],_0x54cb84[_0xa950('0x5b')],_0x54cb84[_0xa950('0x80')]||_0xa950('0x5d'),_0x54cb84[_0xa950('0x81')])[_0xa950('0x10')](function(_0x32cc2c){_0x5e0732(null,_0x32cc2c);})['catch'](function(_0x281eca){_0x5e0732(_0x281eca);});};AGIVertices[_0xa950('0x12')]['ispeechASR']=function(_0x18fe7a,_0x153953,_0x11f20b){scripts[_0xa950('0x82')](_0x153953,_0x18fe7a[_0xa950('0x78')],_0x18fe7a['ispeech_asr_language']||'en-US',this[_0xa950('0x83')](_0x18fe7a[_0xa950('0x84')])?_0x18fe7a['model']:undefined)[_0xa950('0x10')](function(_0x4fe3e3){_0x11f20b(null,_0x4fe3e3);})[_0xa950('0x15')](function(_0x2db6de){_0x11f20b(_0x2db6de);});};AGIVertices[_0xa950('0x12')]['awsPolly']=function(_0x5027e4,_0x13f325){scripts['awsPolly'](_0x5027e4[_0xa950('0x85')],_0x5027e4[_0xa950('0x86')],_0x5027e4[_0xa950('0x87')],_0x5027e4[_0xa950('0x88')]||'Amy',_0x5027e4[_0xa950('0x5b')],_0x5027e4['aws_text_type']||_0xa950('0x5b'))[_0xa950('0x10')](function(_0x4c0b9c){_0x13f325(null,_0x4c0b9c);})[_0xa950('0x15')](function(_0x5c5d80){_0x13f325(_0x5c5d80);});};AGIVertices[_0xa950('0x12')][_0xa950('0x89')]=function(_0x5839f7,_0x3afbfc){scripts[_0xa950('0x89')](this[_0xa950('0xd')][_0xa950('0x36')],_0x5839f7['aws_access_key_id'],_0x5839f7['aws_secret_access_key'],_0x5839f7[_0xa950('0x8a')],_0x5839f7[_0xa950('0x5b')],_0x5839f7[_0xa950('0x8b')])[_0xa950('0x10')](function(_0x26db07){_0x3afbfc(null,_0x26db07);})[_0xa950('0x15')](function(_0xdf4b31){_0x3afbfc(_0xdf4b31);});};AGIVertices[_0xa950('0x12')]['googleASR']=function(_0x487daa,_0x5e70e9,_0x4091f7){scripts[_0xa950('0x8c')](_0x5e70e9,_0x487daa[_0xa950('0x78')],_0x487daa['google_asr_language']||_0xa950('0x5d'))['then'](function(_0x1adfc8){_0x4091f7(null,_0x1adfc8);})[_0xa950('0x15')](function(_0x4b1ad5){_0x4091f7(_0x4b1ad5);});};AGIVertices[_0xa950('0x12')]['tildeASR']=function(_0x168840,_0x2c8e76,_0x3b746e){scripts[_0xa950('0x8d')](_0x2c8e76,_0x168840['appid'],_0x168840[_0xa950('0x8e')],_0x168840[_0xa950('0x6f')])['then'](function(_0x8f32eb){_0x3b746e(null,_0x8f32eb);})[_0xa950('0x15')](function(_0x27a22){_0x3b746e(_0x27a22);});};AGIVertices[_0xa950('0x12')][_0xa950('0x8f')]=function(_0x54166e){var _0x3b5afe=_[_0xa950('0x66')](verticesWithRetry,_0x54166e[_0xa950('0x37')])?_0x54166e:_[_0xa950('0x90')](_0x54166e);for(var _0x52b82d in _0x3b5afe){if(_0x3b5afe['hasOwnProperty'](_0x52b82d)){if(_0x3b5afe[_0x52b82d]&&_[_0xa950('0x91')](_0x3b5afe[_0x52b82d])){if(_['includes'](recursiveMapAttributes,_0x52b82d)){_0x3b5afe[_0x52b82d]=this['replaceObjectAllVariables'](_0x3b5afe[_0x52b82d]);}else{_0x3b5afe[_0x52b82d]=this['replaceAllVariables'](_0x3b5afe[_0x52b82d]);}}}}return _0x3b5afe;};AGIVertices[_0xa950('0x12')]['recursiveNodeIndex']=function(_0x2bf63d){for(var _0x399a54 in _0x2bf63d){if(_0x2bf63d['hasOwnProperty'](_0x399a54)){if(_[_0xa950('0x92')](_0x2bf63d[_0x399a54])){this['recursiveNodeIndex'](_0x2bf63d[_0x399a54]);}else if(_[_0xa950('0x93')](_0x2bf63d[_0x399a54])){for(var _0x2c1701=0x0;_0x2c1701<_0x2bf63d[_0x399a54][_0xa950('0x94')];_0x2c1701++){this[_0xa950('0x95')](_0x2bf63d[_0x399a54][_0x2c1701]);}}else if(_[_0xa950('0x91')](_0x2bf63d[_0x399a54])){_0x2bf63d[_0x399a54]=this['replaceAllVariables'](_0x2bf63d[_0x399a54]);}}}};AGIVertices[_0xa950('0x12')][_0xa950('0x96')]=function(_0x4ead40,_0x5a2f9d){for(var _0xec6116 in _0x4ead40){if(_0x4ead40[_0xa950('0x97')](_0xec6116)){if(_['isPlainObject'](_0x4ead40[_0xec6116])){if(!_['isEmpty'](_0x4ead40[_0xec6116])){this[_0xa950('0x96')](_0x4ead40[_0xec6116],util['format'](_0xa950('0x98'),_0x5a2f9d,_0xec6116));}}else if(_['isArray'](_0x4ead40[_0xec6116])){for(var _0x44ea18=0x0;_0x44ea18<_0x4ead40[_0xec6116][_0xa950('0x94')];_0x44ea18++){this[_0xa950('0x96')](_0x4ead40[_0xec6116][_0x44ea18],util[_0xa950('0x2a')](_0xa950('0x98'),_0x5a2f9d,_0xec6116+'['+_0x44ea18+']'));}}else{if(!_[_0xa950('0x43')](_0x4ead40[_0xec6116])){this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x98'),_0x5a2f9d,_0xec6116),_0x4ead40[_0xec6116]);}}}}};AGIVertices[_0xa950('0x12')][_0xa950('0x9a')]=function(_0x457e05){try{var _0x424558=JSON[_0xa950('0x6b')](_0x457e05);this['recursiveNodeIndex'](_0x424558);return JSON[_0xa950('0x71')](_0x424558);}catch(_0x4fa226){return this['replaceAllVariables'](_0x457e05);}};AGIVertices[_0xa950('0x12')][_0xa950('0x9b')]=function(_0x16dd29){var _0x57d6c3=_0x16dd29[_0xa950('0x9c')]('{');for(var _0x2804c7=0x1;_0x2804c7<_0x57d6c3['length'];_0x2804c7+=0x1){var _0x1d8746=_0x57d6c3[_0x2804c7]['split']('}');if(_0x1d8746[_0xa950('0x94')]>0x1){_0x16dd29=_0x16dd29[_0xa950('0x9d')]('{'+_0x1d8746[0x0]+'}',this[_0xa950('0xd')][_0xa950('0x9e')](_0x1d8746[0x0])['extra']||_0x1d8746[0x0]);}}if(_0x57d6c3[_0xa950('0x94')]===0x1){return _0x16dd29['toString']();}return this['replaceAllVariables'](_0x16dd29);};AGIVertices[_0xa950('0x12')][_0xa950('0x9f')]=function(_0x4c03ea,_0x54af7a){var _0x545b45=this['channel'][_0xa950('0x9e')](_0x4c03ea);if(_0x545b45['result']===-0x1){return _0x545b45;}logger[_0xa950('0x2f')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x54af7a,_0x545b45[_0xa950('0xa0')]));return this['channel'][_0xa950('0x99')](_0x54af7a,_0x545b45[_0xa950('0xa0')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x83')]=function(_0x5a07bc){return _0x5a07bc&&_0x5a07bc!=='0'&&_0x5a07bc!=='-1'&&_0x5a07bc!=='';};AGIVertices[_0xa950('0x12')][_0xa950('0xa1')]=function(_0x540f41){this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x540f41,'-');_0x540f41[_0xa950('0xa3')]=_0x540f41[_0xa950('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa950('0x12')]['mrcpsynth']=function(_0xde9b99){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xa4'),_0xde9b99[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0xde9b99[_0xa950('0x5b')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xa6'));}var _0x475266='\x22'+_0xde9b99[_0xa950('0x5b')]+'\x22';if(this[_0xa950('0x83')](_0xde9b99[_0xa950('0x76')])){_0x475266+=','+_0xde9b99[_0xa950('0x76')];}var _0x450843=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x475266);if(_0x450843[_0xa950('0xa8')]===-0x1){return _0x450843;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xaa'),_0x475266));};AGIVertices['prototype'][_0xa950('0xab')]=function(_0x55cee6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xac'),_0x55cee6['label']));if(!this['isConfigured'](_0x55cee6[_0xa950('0xad')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xae'));}var _0x529118=_0x55cee6[_0xa950('0xad')];if(this['isConfigured'](_0x55cee6['options'])){_0x529118+=','+_0x55cee6[_0xa950('0x76')];}var _0x5e2ae6=this[_0xa950('0xd')]['exec']('MRCPRecog',_0x529118);if(_0x5e2ae6['result']===-0x1){return _0x5e2ae6;}var _0x30a200=this[_0xa950('0x9f')](_0xa950('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x30a200[_0xa950('0xa8')]===-0x1){return _0x30a200;}var _0x524dcf=this[_0xa950('0x9f')](_0xa950('0xb0'),_0xa950('0xb1'));if(_0x524dcf[_0xa950('0xa8')]===-0x1){return _0x524dcf;}var _0x4e77e4=this[_0xa950('0x9f')](_0xa950('0xb2'),_0xa950('0xb3'));if(_0x4e77e4['result']===-0x1){return _0x4e77e4;}return this['channel']['noop'](util[_0xa950('0x2a')](_0xa950('0xb4'),_0x529118));};AGIVertices[_0xa950('0x12')][_0xa950('0xb5')]=function(_0x955cc2){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xb6'),_0x955cc2[_0xa950('0xa5')]));return this[_0xa950('0xd')]['agi']([_0x955cc2[_0xa950('0xb7')],_0x955cc2[_0xa950('0xb8')]]);};AGIVertices[_0xa950('0x12')][_0xa950('0xb9')]=function(_0x458e7b){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xba'),_0x458e7b[_0xa950('0xa5')]));if(this[_0xa950('0x83')](_0x458e7b[_0xa950('0x64')])){logger[_0xa950('0x2f')](util['format'](_0xa950('0xbb'),_0x458e7b['timeout']));var _0x5600d3=this[_0xa950('0xd')][_0xa950('0xbc')](_0x458e7b[_0xa950('0x64')]);if(_0x5600d3['result']===-0x1){return _0x5600d3;}}return this[_0xa950('0xd')][_0xa950('0xb9')]();};AGIVertices[_0xa950('0x12')][_0xa950('0x4a')]=function(_0x5b5eb6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xbd'),_0x5b5eb6[_0xa950('0xa5')]));if(!this['isConfigured'](_0x5b5eb6['list_id'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x5b5eb6,_0xa950('0xbe'));}_0x5b5eb6[_0xa950('0x49')]=moment();if(this[_0xa950('0x83')](_0x5b5eb6[_0xa950('0xbf')])){_0x5b5eb6[_0xa950('0x49')]=moment()['add'](_0x5b5eb6[_0xa950('0xbf')],_0xa950('0xc0'));}if(!this[_0xa950('0x83')](_0x5b5eb6['callback_priority'])){_0x5b5eb6[_0xa950('0x4b')]=0x2;}this[_0xa950('0x41')]['sync'](this,_0x5b5eb6);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc1'),_0x5b5eb6[_0xa950('0x47')],_0x5b5eb6[_0xa950('0x48')],_0x5b5eb6[_0xa950('0x49')]));};AGIVertices[_0xa950('0x12')][_0xa950('0xc2')]=function(_0x4232d7){logger[_0xa950('0x2f')](util['format'](_0xa950('0xc3'),_0x4232d7[_0xa950('0xa5')]));var _0x5b2375=this['channel'][_0xa950('0x55')](_0x4232d7['application'],_0x4232d7['options']);if(_0x5b2375[_0xa950('0xa8')]===-0x1){return _0x5b2375;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),_0x4232d7['application'],_0x4232d7[_0xa950('0x76')]));};AGIVertices[_0xa950('0x12')][_0xa950('0xc5')]=function(_0x327581){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xc6'),_0x327581[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x327581[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}var _0x939bba='\x22'+_0x327581['text']+'\x22';if(this[_0xa950('0x83')](_0x327581[_0xa950('0x76')])){_0x939bba+=','+_0x327581[_0xa950('0x76')];}var _0x2f7b03=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x939bba);if(_0x2f7b03['result']===-0x1){return _0x2f7b03;}return this[_0xa950('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x939bba));};AGIVertices[_0xa950('0x12')][_0xa950('0xc7')]=function(_0x3348b1){logger['info'](util[_0xa950('0x2a')](_0xa950('0xc8'),_0x3348b1['label']));if(!this[_0xa950('0x83')](_0x3348b1[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}var _0x20612c='\x22'+_0x3348b1['text']+'\x22';if(this[_0xa950('0x83')](_0x3348b1[_0xa950('0x76')])){_0x20612c+=','+_0x3348b1[_0xa950('0x76')];}var _0x3bf03b=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xa7'),_0x20612c);if(_0x3bf03b[_0xa950('0xa8')]===-0x1){return _0x3bf03b;}return this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xaa'),_0x20612c));};AGIVertices[_0xa950('0x12')]['lumenvoxasr']=function(_0x49e653){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x49e653[_0xa950('0xa5')]));if(!this['isConfigured'](_0x49e653[_0xa950('0xad')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20grammar\x20configured');}var _0x42cbb6=_0x49e653[_0xa950('0xad')];if(this[_0xa950('0x83')](_0x49e653[_0xa950('0x76')])){_0x42cbb6+=','+_0x49e653[_0xa950('0x76')];}var _0x52409a=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0xc9'),_0x42cbb6);if(_0x52409a[_0xa950('0xa8')]===-0x1){return _0x52409a;}var _0x276b1c=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xa950('0xca'));if(_0x276b1c[_0xa950('0xa8')]===-0x1){return _0x276b1c;}var _0xaf6083=this['getAndSetVariable'](_0xa950('0xb0'),_0xa950('0xcb'));if(_0xaf6083[_0xa950('0xa8')]===-0x1){return _0xaf6083;}var _0x1af0cb=this[_0xa950('0x9f')](_0xa950('0xb2'),_0xa950('0xcc'));if(_0x1af0cb[_0xa950('0xa8')]===-0x1){return _0x1af0cb;}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x42cbb6));};AGIVertices[_0xa950('0x12')][_0xa950('0xcd')]=function(_0x38f32e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x38f32e[_0xa950('0xa5')]));if(!this['isConfigured'](_0x38f32e[_0xa950('0xad')])){return this['channel'][_0xa950('0xa9')]('no\x20grammar\x20configured');}var _0x5926ae=_0x38f32e[_0xa950('0xad')];if(this[_0xa950('0x83')](_0x38f32e['options'])){_0x5926ae+=','+_0x38f32e[_0xa950('0x76')];}var _0x3b34e6=this['channel'][_0xa950('0x55')](_0xa950('0xc9'),_0x5926ae);if(_0x3b34e6[_0xa950('0xa8')]===-0x1){return _0x3b34e6;}var _0x11a270=this[_0xa950('0x9f')]('RECOG_CONFIDENCE()',_0xa950('0xce'));if(_0x11a270[_0xa950('0xa8')]===-0x1){return _0x11a270;}var _0x3cd57b=this[_0xa950('0x9f')](_0xa950('0xb0'),_0xa950('0xcf'));if(_0x3cd57b[_0xa950('0xa8')]===-0x1){return _0x3cd57b;}var _0x2aab5f=this['getAndSetVariable'](_0xa950('0xb2'),_0xa950('0xd0'));if(_0x2aab5f[_0xa950('0xa8')]===-0x1){return _0x2aab5f;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xb4'),_0x5926ae));};AGIVertices[_0xa950('0x12')][_0xa950('0xd1')]=function(_0x2be65d){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xd2'),_0x2be65d['label']));if(!this[_0xa950('0x83')](_0x2be65d[_0xa950('0xd3')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,_0xa950('0xd4'));}var _0x1b0269=this[_0xa950('0x18')][_0xa950('0xa2')](this,_0x2be65d[_0xa950('0xd3')]);if(!_0x1b0269){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,'no\x20odbc\x20database\x20found');}if(!this[_0xa950('0x83')](_0x2be65d['query'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2be65d,'no\x20query\x20configured');}var _0x4edb28=_0x2be65d[_0xa950('0xd5')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xd6'),_0x4edb28));var _0x277cf8=this[_0xa950('0x2c')][_0xa950('0xa2')](this,_0x1b0269,_0x4edb28);this[_0xa950('0x35')]['sync'](this,_0x2be65d,_0x4edb28);if(!this[_0xa950('0x83')](_0x2be65d[_0xa950('0xd7')])){return this['channel'][_0xa950('0xa9')](_0xa950('0xd8'));}var _0x1ad303=this[_0xa950('0x9e')]['sync'](this,_0x2be65d['variable_id']);if(!_0x1ad303){return this[_0xa950('0xd')]['error'](_0x2be65d,_0xa950('0xd9'));}var _0x2a3ba0=this;_0x277cf8[_0xa950('0xda')](function(_0x1e845f,_0xcf25eb){Object['keys'](_0x1e845f)[_0xa950('0xda')](function(_0x22a08f){_0x2a3ba0['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xdb'),_0x1ad303,_0xcf25eb,_0x22a08f),_0x1e845f[_0x22a08f]);});});this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xdc'),_0x1ad303),_0x277cf8[_0xa950('0x94')]);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xdd'),_0x1ad303));};AGIVertices[_0xa950('0x12')][_0xa950('0xde')]=function(_0x1b35f8){logger[_0xa950('0xdf')](util[_0xa950('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1b35f8[_0xa950('0xa5')]));if(!this['isConfigured'](_0x1b35f8[_0xa950('0xe0')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1b35f8,_0xa950('0xe1'));}var _0x2014ef=this[_0xa950('0xe2')]['sync'](this,_0x1b35f8[_0xa950('0xe0')]);if(!_0x2014ef){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1b35f8,_0xa950('0xe3'));}var _0x556b80=this[_0xa950('0xd')]['exec'](_0xa950('0xe4'),[util[_0xa950('0x2a')](_0xa950('0xe5'),_0x2014ef),_0x1b35f8['timeout'],_0x1b35f8[_0xa950('0xe6')],_0x1b35f8[_0xa950('0x63')]]);if(_0x556b80[_0xa950('0xa8')]===-0x1){return _0x556b80;}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0xe7'),_0xa950('0xe4')));};AGIVertices[_0xa950('0x12')][_0xa950('0xe8')]=function(_0x91e6cb){logger[_0xa950('0x2f')](util['format'](_0xa950('0xe9'),_0x91e6cb[_0xa950('0xa5')]));if(!this['isConfigured'](_0x91e6cb['key'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xea'));}if(!this['isConfigured'](_0x91e6cb[_0xa950('0x5b')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xa6'));}this['channel'][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x91e6cb);this['createSquareMessage'](_0x91e6cb[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xec'),_0x91e6cb[_0xa950('0x5b')]));var _0x1c6cd9=this[_0xa950('0x77')][_0xa950('0xa2')](this,_0x91e6cb);if(_0x1c6cd9){for(var _0x6a45e8 in _0x1c6cd9){if(_0x1c6cd9['hasOwnProperty'](_0x6a45e8)){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xed'),_0x6a45e8[_0xa950('0x69')]()),_0x1c6cd9[_0x6a45e8]);}}this[_0xa950('0x40')](_0x1c6cd9[_0xa950('0xee')],'out','dialogflow','');return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('Dialogflow\x20Result\x20%s',_0x1c6cd9[_0xa950('0xee')]));}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x91e6cb,_0xa950('0xef'));};AGIVertices[_0xa950('0x12')]['dialogflowV2']=function(_0x6b17a8){logger['info'](util['format'](_0xa950('0xf0'),_0x6b17a8[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x6b17a8['dialogflowV2_project_id'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xf1'));}if(!this[_0xa950('0x83')](_0x6b17a8['client_email'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xf2'));}if(!this[_0xa950('0x83')](_0x6b17a8[_0xa950('0x7c')])){return this[_0xa950('0xd')]['noop'](_0xa950('0xf3'));}if(!this[_0xa950('0x83')](_0x6b17a8[_0xa950('0x7d')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20anguage\x20configured');}if(!this[_0xa950('0x83')](_0x6b17a8['text'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xeb')]=!![];this['createSquareDetailsReport'](_0x6b17a8);this['createSquareMessage'](_0x6b17a8[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0xf4'),_0x6b17a8[_0xa950('0x5b')]));var _0x2a219e=this[_0xa950('0x79')][_0xa950('0xa2')](this,_0x6b17a8);if(_0x2a219e){for(var _0x497e47 in _0x2a219e){if(_0x2a219e[_0xa950('0x97')](_0x497e47)){if(_0x497e47!=='providerResponse'){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0xed'),_0x497e47[_0xa950('0x69')]()),_0x2a219e[_0x497e47]);}}}this[_0xa950('0x40')](_0x2a219e[_0xa950('0xee')],_0xa950('0xf5'),'dialogflowV2',_0x2a219e[_0xa950('0xf6')]);return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xf7'),_0x2a219e[_0xa950('0xee')]));}return this['channel']['error'](_0x6b17a8,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xa950('0x12')][_0xa950('0xf8')]=function(_0x2ac74f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0xf9'),_0x2ac74f['label']));if(!this['isConfigured'](_0x2ac74f['ndauth_url'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xfa'));}if(!this[_0xa950('0x83')](_0x2ac74f[_0xa950('0xfb')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20username\x20configured');}if(!this[_0xa950('0x83')](_0x2ac74f[_0xa950('0xfc')])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x2ac74f[_0xa950('0xfd')])){return this['channel'][_0xa950('0xa9')](_0xa950('0xa6'));}this['channel'][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x2ac74f);this['createSquareMessage'](_0x2ac74f[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xfe'),_0x2ac74f['text']));var _0x5e8902=this[_0xa950('0x7e')][_0xa950('0xa2')](this,_0x2ac74f);if(_0x5e8902){for(var _0x1aef67 in _0x5e8902){if(_0x5e8902[_0xa950('0x97')](_0x1aef67)){this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')]('SESTEK_NDA_%s',_0x1aef67[_0xa950('0x69')]()),_0x5e8902[_0x1aef67]);}}this[_0xa950('0x40')](_0x5e8902[_0xa950('0xee')],'out','sesteknda','');if(_0x5e8902[_0xa950('0xff')]){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x100'),_0x5e8902['audiofile']));var _0x2a831d=this[_0xa950('0xd')][_0xa950('0x101')](_0x5e8902[_0xa950('0xff')]);try{fs['unlink'](_0x5e8902[_0xa950('0xff')]+_0xa950('0x102'));}catch(_0x55fe1e){logger[_0xa950('0x2e')](_0x55fe1e);}return _0x2a831d;}else{return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x103'),_0x5e8902[_0xa950('0xee')]));}}return this[_0xa950('0xd')]['error'](_0x2ac74f,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa950('0x12')]['end']=function(_0x39e818){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x104'),_0x39e818[_0xa950('0xa5')]));return this[_0xa950('0xd')]['noop'](_0xa950('0x105'));};AGIVertices[_0xa950('0x12')][_0xa950('0x106')]=function(_0x41b90c){logger['info'](util[_0xa950('0x2a')](_0xa950('0x107'),_0x41b90c['label']));var _0x2718e5='';if(_0x41b90c[_0xa950('0x108')]){if(!this[_0xa950('0x83')](_0x41b90c[_0xa950('0x108')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x41b90c,_0xa950('0x109'));}else{var _0x1ff9e3=parseInt(_0x41b90c['trunk_id'],0xa);if(isNaN(_0x1ff9e3)){_0x2718e5=_0x41b90c[_0xa950('0x108')];}else{_0x2718e5=this[_0xa950('0x1c')][_0xa950('0xa2')](this,_0x41b90c[_0xa950('0x108')]);if(!_0x2718e5){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x41b90c,'no\x20trunk\x20found');}}}}else if(_0x41b90c[_0xa950('0x10a')]){_0x2718e5=_0x41b90c[_0xa950('0x10a')];}else{return this[_0xa950('0xd')]['error'](_0x41b90c,_0xa950('0x109'));}var _0x3a765b=this[_0xa950('0xd')][_0xa950('0x55')]('DIAL',[util[_0xa950('0x2a')]('SIP/%s/%s',_0x2718e5,_0x41b90c[_0xa950('0x47')]),_0x41b90c[_0xa950('0x64')],_0x41b90c[_0xa950('0xe6')],_0x41b90c[_0xa950('0x63')]]);if(_0x3a765b[_0xa950('0xa8')]===-0x1){return _0x3a765b;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Executed\x20command\x20%s',_0xa950('0xe4')));};AGIVertices[_0xa950('0x12')][_0xa950('0x10b')]=function(_0x4e4edf){logger['info'](util[_0xa950('0x2a')](_0xa950('0x10c'),_0x4e4edf[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0xa9')]('finally');};AGIVertices[_0xa950('0x12')][_0xa950('0x10d')]=function(_0x16f8e8){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x10e'),_0x16f8e8[_0xa950('0xa5')]));if(_0x16f8e8['retry']===0x0){return this[_0xa950('0xa1')](_0x16f8e8);}_0x16f8e8['retry']-=0x1;if(!this['isConfigured'](_0x16f8e8['file_id'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0x10f'));}var _0x1f149e=this[_0xa950('0x1e')]['sync'](this,_0x16f8e8[_0xa950('0x110')]);if(!_0x1f149e){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0x111'));}if(!this['isConfigured'](_0x16f8e8['variable_id'])){return this[_0xa950('0xd')]['error'](_0xa950('0xd8'));}var _0x388cb7=this[_0xa950('0xd')]['getData'](_0x1f149e,_0x16f8e8[_0xa950('0x112')],_0x16f8e8[_0xa950('0x113')]);var _0x224209=_0x388cb7['result']?_0x388cb7[_0xa950('0xa8')][_0xa950('0x114')]():'';logger[_0xa950('0x2f')](_0xa950('0x115'),JSON[_0xa950('0x71')](_0x388cb7));if(_0x388cb7['result']===-0x1){this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,_0x224209);return _0x388cb7;}else if(_0x388cb7[_0xa950('0xa0')]===_0xa950('0x64')){_0x388cb7[_0xa950('0xa8')]=_0x224209[_0xa950('0x94')]>=parseInt(_0x16f8e8[_0xa950('0x116')])?'x':'i';}else{_0x388cb7[_0xa950('0xa8')]=_0x224209[_0xa950('0x94')]>=parseInt(_0x16f8e8[_0xa950('0x116')])&&_0x224209[_0xa950('0x94')]<=parseInt(_0x16f8e8[_0xa950('0x113')])?'x':'i';}var _0x227aa4=this['getVariable']['sync'](this,_0x16f8e8[_0xa950('0xd7')]);if(!_0x227aa4){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x16f8e8,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](_0x227aa4,_0x224209);if(this[_0xa950('0x83')](_0x16f8e8[_0xa950('0x117')])){var _0x3d4b1d=parseInt(_0x16f8e8[_0xa950('0x117')],0xa);var _0x18013d=rs[_0xa950('0x118')]({'charset':'*','length':_0x3d4b1d});var _0x1b249b=_0x224209[_0xa950('0x94')];if(_0x1b249b>0x0){if(_0x1b249b>_0x3d4b1d){this['createSquareDetailsReport']['sync'](this,_0x16f8e8,_0x16f8e8['hiddendigitspos']===_0xa950('0x119')?_0x18013d+_0x224209['substr'](_0x3d4b1d):_0x224209[_0xa950('0x11a')](0x0,_0x1b249b-_0x3d4b1d)+_0x18013d);}else{this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x16f8e8,rs[_0xa950('0x118')]({'charset':'*','length':_0x1b249b}));}}else{this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,'');}}else{this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x16f8e8,_0x224209);}return _0x388cb7;};AGIVertices[_0xa950('0x12')][_0xa950('0xc')]=function(_0x164826){logger[_0xa950('0x2f')](util['format'](_0xa950('0x11b'),_0x164826[_0xa950('0xa5')]));return this[_0xa950('0x10d')](_0x164826);};AGIVertices[_0xa950('0x12')][_0xa950('0x11c')]=function(_0x4906a9){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x11d'),_0x4906a9['label']));this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x4906a9,_0x4906a9['goalname']);return this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x11e'),_0x4906a9[_0xa950('0x11f')]));};AGIVertices['prototype'][_0xa950('0x120')]=function(_0x2bd873){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x121'),_0x2bd873[_0xa950('0xa5')]));if(!this['isConfigured'](_0x2bd873[_0xa950('0x85')])||!this[_0xa950('0x83')](_0x2bd873[_0xa950('0x86')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x122'));}if(!this[_0xa950('0x83')](_0x2bd873['text'])){return this[_0xa950('0xd')]['noop']('no\x20text\x20configured');}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x123'),_0x2bd873[_0xa950('0x5b')]));var _0x1e48db=this['awsPolly'][_0xa950('0xa2')](this,_0x2bd873);if(_0x1e48db){this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x124'),_0x1e48db));var _0x44b70e=this['channel'][_0xa950('0x101')](_0x1e48db);try{fs[_0xa950('0x125')](_0x1e48db+_0xa950('0x102'));}catch(_0x2356a0){logger[_0xa950('0x2e')](_0x2356a0);}return _0x44b70e;}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2bd873,_0xa950('0x126'));};AGIVertices['prototype']['awslex']=function(_0x19c7a6){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x127'),_0x19c7a6[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x19c7a6[_0xa950('0x85')])||!this[_0xa950('0x83')](_0x19c7a6[_0xa950('0x86')])){return this[_0xa950('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xa950('0x83')](_0x19c7a6['aws_bot_name'])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x128'));}if(!this[_0xa950('0x83')](_0x19c7a6['text'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xeb')]=!![];this[_0xa950('0x35')](_0x19c7a6);this[_0xa950('0x40')](_0x19c7a6[_0xa950('0x5b')],'in','','');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x19c7a6[_0xa950('0x5b')]));var _0x4e0373=this[_0xa950('0x89')]['sync'](this,_0x19c7a6);if(_0x4e0373){for(var _0x48d853 in _0x4e0373){if(_0x4e0373['hasOwnProperty'](_0x48d853)&&_['isString'](_0x4e0373[_0x48d853])){this[_0xa950('0xd')]['setVariable'](util[_0xa950('0x2a')](_0xa950('0x129'),_0x48d853[_0xa950('0x69')]()),_0x4e0373[_0x48d853]);}}if(_[_0xa950('0x43')](_0x4e0373[_0xa950('0x74')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x12a'));}else{this[_0xa950('0x40')](_0x4e0373[_0xa950('0x74')],_0xa950('0xf5'),_0xa950('0x12b'),'');return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x12c'),_0x4e0373['message']));}}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x19c7a6,_0xa950('0x12d'));};AGIVertices['prototype'][_0xa950('0x12e')]=function(_0x5d3662){logger[_0xa950('0x2f')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5d3662[_0xa950('0xa5')],_0x5d3662[_0xa950('0x64')]));if(!this['isConfigured'](_0x5d3662[_0xa950('0x78')])){return this['channel'][_0xa950('0xa9')]('no\x20key\x20configured');}var _0x48a3c4=_0xa950('0x12f');var _0x151ccb=util[_0xa950('0x2a')](_0xa950('0x130'),FILES_PATH,rs[_0xa950('0x118')](0x4));var _0xc95f7e=util[_0xa950('0x2a')](_0xa950('0x98'),_0x151ccb,_0x48a3c4);var _0x2cf752=!![];if(_0x5d3662[_0xa950('0x131')]==='NOBEEP'){_0x2cf752=![];}var _0x57876f=this[_0xa950('0xd')][_0xa950('0x132')](_0x151ccb,_0x48a3c4,_0x5d3662[_0xa950('0x133')],_0x5d3662[_0xa950('0x64')],undefined,_0x2cf752);if(_0x57876f[_0xa950('0xa8')]!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x134'),_0xc95f7e));var _0x22819d=this[_0xa950('0x8c')][_0xa950('0xa2')](this,_0x5d3662,_0xc95f7e);if(_0x22819d){for(var _0x174082 in _0x22819d){if(_0x22819d[_0xa950('0x97')](_0x174082)){this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')]('GOOGLE_ASR_%s',_0x174082[_0xa950('0x69')]()),_0x22819d[_0x174082]);}}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x135'),JSON['stringify'](_0x22819d)));}}return _0x57876f;};AGIVertices[_0xa950('0x12')]['tildeasr']=function(_0x4d016c){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x136'),_0x4d016c['label']));if(!this[_0xa950('0x83')](_0x4d016c[_0xa950('0x137')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x138'));}if(!this[_0xa950('0x83')](_0x4d016c[_0xa950('0x8e')])){return this['channel']['noop'](_0xa950('0x139'));}var _0x53347b=_0xa950('0x12f');var _0x157f90=util[_0xa950('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2df3c8=util[_0xa950('0x2a')](_0xa950('0x98'),_0x157f90,_0x53347b);var _0x4322a4=!![];if(_0x4d016c[_0xa950('0x131')]===_0xa950('0x13a')){_0x4322a4=![];}var _0x3ccf59=this['channel'][_0xa950('0x132')](_0x157f90,_0x53347b,_0x4d016c[_0xa950('0x133')],_0x4d016c[_0xa950('0x64')],undefined,_0x4322a4);if(_0x3ccf59['result']!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x13b'),_0x2df3c8));var _0x1f4aa3=this[_0xa950('0x8d')][_0xa950('0xa2')](this,_0x4d016c,_0x2df3c8);if(_0x1f4aa3){for(var _0x36a987 in _0x1f4aa3){if(_0x1f4aa3[_0xa950('0x97')](_0x36a987)){this[_0xa950('0xd')]['setVariable'](util[_0xa950('0x2a')]('TILDE_ASR_%s',_0x36a987[_0xa950('0x69')]()),_0x1f4aa3[_0x36a987]);}}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x13c'),JSON[_0xa950('0x71')](_0x1f4aa3)));}}return _0x3ccf59;};AGIVertices[_0xa950('0x12')][_0xa950('0x13d')]=function(_0x275f28){logger['info'](util[_0xa950('0x2a')](_0xa950('0x13e'),_0x275f28[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x13f')](_0x275f28[_0xa950('0x140')],_0x275f28[_0xa950('0x141')],_0x275f28[_0xa950('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0x4566d4){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4566d4[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x4566d4[_0xa950('0x142')])){return this[_0xa950('0xd')]['error'](_0x4566d4,'no\x20condition\x20configured');}try{var _0x14ce6b=eval(_0x4566d4['condition'])?_0xa950('0x143'):_0xa950('0x144');this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4566d4[_0xa950('0x142')],_0x14ce6b));return{'code':0xc8,'result':_0x14ce6b};}catch(_0x4b7a2c){return{'code':0xc8,'result':_0xa950('0x144')};}};AGIVertices['prototype'][_0xa950('0x145')]=function(_0x18203b){logger[_0xa950('0x2f')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x18203b[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x18203b[_0xa950('0x146')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x18203b,_0xa950('0x147'));}var _0x240f85=this[_0xa950('0x148')][_0xa950('0xa2')](this,_0x18203b[_0xa950('0x146')]);if(!_0x240f85){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x18203b,_0xa950('0x149'));}for(var _0x4feeca=0x0;_0x4feeca<_0x240f85['length'];_0x4feeca+=0x1){var _0x4d2a33=this['channel'][_0xa950('0x9e')](util['format']('IFTIME(%s?true:false)',_0x240f85[_0x4feeca]));if(_0x4d2a33[_0xa950('0xa8')]===-0x1){return _0x4d2a33;}logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0x4d2a33['extra']));if(_0x4d2a33['extra']===_0xa950('0x143')){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14a'),_0x240f85[_0x4feeca],'true'));this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0xa950('0x143')));return{'code':0xc8,'result':_0xa950('0x143')};}else{logger[_0xa950('0x2f')](util['format'](_0xa950('0x14a'),_0x240f85[_0x4feeca],_0xa950('0x144')));this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('IFTIME\x20%s\x20%s',_0x240f85[_0x4feeca],_0xa950('0x144')));}}return{'code':0xc8,'result':_0xa950('0x144')};};AGIVertices[_0xa950('0x12')][_0xa950('0x14b')]=function(_0x541098){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14c'),_0x541098[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x14b')]();};AGIVertices[_0xa950('0x12')][_0xa950('0x14d')]=function(_0x335494){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x14e'),_0x335494[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x335494['key'])){return this[_0xa950('0xd')]['noop'](_0xa950('0xea'));}var _0xeb6aaf=_0xa950('0x12f');var _0x4ce1a7=util[_0xa950('0x2a')](_0xa950('0x130'),FILES_PATH,rs[_0xa950('0x118')](0x4));var _0x4f1cab=util[_0xa950('0x2a')](_0xa950('0x98'),_0x4ce1a7,_0xeb6aaf);var _0x3da5d5=!![];if(_0x335494[_0xa950('0x131')]==='NOBEEP'){_0x3da5d5=![];}var _0x47c82b=this['channel'][_0xa950('0x132')](_0x4ce1a7,_0xeb6aaf,_0x335494['intKey'],_0x335494[_0xa950('0x64')],undefined,_0x3da5d5);if(_0x47c82b[_0xa950('0xa8')]!==-0x1){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x14f'),_0x4f1cab));var _0x2c5307=this[_0xa950('0x82')][_0xa950('0xa2')](this,_0x335494,_0x4f1cab);if(_0x2c5307){for(var _0x81789a in _0x2c5307){if(_0x2c5307[_0xa950('0x97')](_0x81789a)){this[_0xa950('0xd')][_0xa950('0x99')](util['format'](_0xa950('0x150'),_0x81789a[_0xa950('0x69')]()),_0x2c5307[_0x81789a]);}}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x151'),JSON[_0xa950('0x71')](_0x2c5307)));}}return _0x47c82b;};AGIVertices[_0xa950('0x12')][_0xa950('0x152')]=function(_0x3287c7){logger[_0xa950('0x2f')](util['format'](_0xa950('0x153'),_0x3287c7[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x3287c7[_0xa950('0x78')])){return this['channel'][_0xa950('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x3287c7[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x154'),_0x3287c7[_0xa950('0x5b')]));var _0xeec1de=this[_0xa950('0x7f')][_0xa950('0xa2')](this,_0x3287c7);if(_0xeec1de){this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x14f'),_0xeec1de));var _0x3d5eaa=this['channel'][_0xa950('0x101')](_0xeec1de,_0x3287c7[_0xa950('0x133')]);try{fs[_0xa950('0x125')](_0xeec1de+_0xa950('0x102'));}catch(_0x1938ee){logger['error'](_0x1938ee);}return _0x3d5eaa;}return this[_0xa950('0xd')][_0xa950('0x2e')](_0x3287c7,_0xa950('0x155'));};AGIVertices['prototype']['login']=function(_0x38785d){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x156'),_0x38785d[_0xa950('0xa5')]));if(!this['isConfigured'](_0x38785d['findBy'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x38785d,_0xa950('0x157'));}logger[_0xa950('0x2f')](util['format'](_0xa950('0x158'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));var _0x2a67cd=this['agentLogin'][_0xa950('0xa2')](this,_0x38785d['findBy']);if(_0x2a67cd){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel'][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));this[_0xa950('0xd')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xa950('0x38')],_0x38785d[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15d')};}};AGIVertices[_0xa950('0x12')][_0xa950('0x15e')]=function(_0x4b97bb){logger[_0xa950('0x2f')](util['format'](_0xa950('0x15f'),_0x4b97bb[_0xa950('0xa5')]));if(!this['isConfigured'](_0x4b97bb[_0xa950('0x159')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x4b97bb,_0xa950('0x157'));}logger['info'](util[_0xa950('0x2a')](_0xa950('0x158'),this['channel'][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));var _0x254458=this[_0xa950('0x50')][_0xa950('0xa2')](this,_0x4b97bb[_0xa950('0x159')]);if(_0x254458){logger['info'](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')]['callerid'],_0x4b97bb['findBy']));this['channel']['noop'](util['format'](_0xa950('0x15a'),this[_0xa950('0xd')]['callerid'],_0x4b97bb[_0xa950('0x159')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xa950('0x2a')](_0xa950('0x15c'),this[_0xa950('0xd')][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel'][_0xa950('0x38')],_0x4b97bb[_0xa950('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa950('0x160')]=function(_0x57f37e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x161'),_0x57f37e[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x57f37e['operation'])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x57f37e,_0xa950('0x162'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x163'),_0x57f37e[_0xa950('0x164')]));var _0x4918c9=eval(_0x57f37e['operation']);if(!this[_0xa950('0x83')](_0x57f37e['variable_id'])){return this['channel'][_0xa950('0xa9')](_0xa950('0xd8'));}var _0x122912=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x57f37e[_0xa950('0xd7')]);if(!_0x122912){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x57f37e,_0xa950('0xd9'));}if(_[_0xa950('0x93')](_0x4918c9)){var _0x2b8df0=this;_0x4918c9[_0xa950('0xda')](function(_0x1b1586,_0x54cf35){_0x2b8df0[_0xa950('0xd')]['setVariable'](util['format'](_0xa950('0x165'),_0x122912,_0x54cf35),_0x1b1586);});return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x166'),_0x122912));}else{return this[_0xa950('0xd')]['setVariable'](_0x122912,_0x4918c9);}};AGIVertices[_0xa950('0x12')][_0xa950('0x167')]=function(_0x74da7f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x168'),_0x74da7f['label']));if(_0x74da7f[_0xa950('0xa3')]===0x0){return this[_0xa950('0xa1')](_0x74da7f);}_0x74da7f[_0xa950('0xa3')]-=0x1;if(!this[_0xa950('0x83')](_0x74da7f[_0xa950('0x110')])){return this['channel'][_0xa950('0x2e')](_0x74da7f,'no\x20file\x20audio\x20selected');}var _0x630382=this['getSound'][_0xa950('0xa2')](this,_0x74da7f[_0xa950('0x110')]);if(!_0x630382){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x74da7f,_0xa950('0x111'));}var _0x11f9ce=this[_0xa950('0xd')][_0xa950('0x169')](_0x630382,_0x74da7f[_0xa950('0x112')],_0x74da7f[_0xa950('0x16a')]);var _0x48d6bf=_0x11f9ce[_0xa950('0xa8')];if(_0x11f9ce[_0xa950('0xa8')]===-0x1){this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x74da7f,'-1');return _0x11f9ce;}else if(_0x11f9ce[_0xa950('0xa0')]===_0xa950('0x64')){_0x11f9ce['result']=_0x11f9ce[_0xa950('0xa8')][_0xa950('0x94')]>0x0?_0x11f9ce[_0xa950('0xa8')]:'t';}else if(_[_0xa950('0x42')](_0x11f9ce['result'])){_0x11f9ce['result']='#';_0x48d6bf='#';}if(!this[_0xa950('0x83')](_0x74da7f['variable_id'])){this[_0xa950('0xd')]['noop'](_0xa950('0xd8'));}else{var _0x21b6ad=this['getVariable']['sync'](this,_0x74da7f[_0xa950('0xd7')]);if(!_0x21b6ad){return this[_0xa950('0xd')]['error'](_0x74da7f,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](_0x21b6ad,_0x48d6bf);}this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x74da7f,_0x48d6bf);return _0x11f9ce;};AGIVertices[_0xa950('0x12')]['noop']=function(_0x7ac442){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x16b'),_0x7ac442[_0xa950('0xa5')]));return this['channel'][_0xa950('0xa9')](_0x7ac442[_0xa950('0x16c')]||_0x7ac442[_0xa950('0xa5')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x16d')]=function(_0x519d96){logger[_0xa950('0x2f')](util['format'](_0xa950('0x16e'),_0x519d96[_0xa950('0xa5')]));if(!this['isConfigured'](_0x519d96[_0xa950('0x159')])){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x519d96,_0xa950('0x157'));}logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));var _0x125fb1=this[_0xa950('0x4c')][_0xa950('0xa2')](this,_0x519d96[_0xa950('0x16f')]);var _0x5d1a40=this[_0xa950('0x4d')][_0xa950('0xa2')](this,_0x519d96[_0xa950('0x159')],_0x125fb1);if(_0x5d1a40){logger['info'](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa950('0xd')][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this['channel'][_0xa950('0x38')],_0x519d96[_0xa950('0x159')]));return{'code':0xc8,'result':_0xa950('0x15d')};}};AGIVertices[_0xa950('0x12')][_0xa950('0x170')]=function(_0x46e29f){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x171'),_0x46e29f[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x46e29f[_0xa950('0x110')])){return this['channel'][_0xa950('0x2e')](_0x46e29f,_0xa950('0x10f'));}var _0x52260d=this['getSound'][_0xa950('0xa2')](this,_0x46e29f[_0xa950('0x110')]);if(!_0x52260d){return this[_0xa950('0xd')]['error'](_0x46e29f,_0xa950('0x111'));}var _0x188542=this[_0xa950('0xd')][_0xa950('0x55')]('PLAYBACK',[_0x52260d,_0x46e29f[_0xa950('0xe6')]]);if(_0x188542[_0xa950('0xa8')]===-0x1){return _0x188542;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),'PLAYBACK',_0x52260d));};AGIVertices[_0xa950('0x12')][_0xa950('0x172')]=function(_0x50bbef){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x173'),_0x50bbef['label']));if(!this['isConfigured'](_0x50bbef['queue_id'])){return this[_0xa950('0xd')]['error'](_0x50bbef,'no\x20queue\x20selected');}var _0x56c3d5='';var _0x19b738=parseInt(_0x50bbef['queue_id'],0xa);if(isNaN(_0x19b738)){_0x56c3d5=_0x50bbef[_0xa950('0x174')];}else{_0x56c3d5=this[_0xa950('0x13')]['sync'](this,_0x50bbef[_0xa950('0x174')]);if(!_0x56c3d5){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x50bbef,_0xa950('0x175'));}}var _0x437554='';if(this[_0xa950('0x83')](_0x50bbef[_0xa950('0x110')])){var _0x1705c6=this['getSound'][_0xa950('0xa2')](this,_0x50bbef[_0xa950('0x110')]);if(_0x1705c6){_0x437554=_0x1705c6;}}this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x50bbef,_0x56c3d5);if(_0x50bbef[_0xa950('0xe6')]['indexOf']('x')<0x0){_0x50bbef[_0xa950('0xe6')]+='x';}if(_0x50bbef[_0xa950('0xe6')][_0xa950('0x176')]('X')<0x0){_0x50bbef[_0xa950('0xe6')]+='X';}this[_0xa950('0xd')]['setVariable'](_0xa950('0x177'),_0x56c3d5?_0x56c3d5[_0xa950('0x178')]():'');var _0x40c38f=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0x179'),[_0x56c3d5,_0x50bbef['opts'],_0x50bbef[_0xa950('0x63')],_0x437554,_0x50bbef['timeout'],_0x50bbef[_0xa950('0xb5')],_0x50bbef[_0xa950('0x17a')],_0x50bbef[_0xa950('0x17b')],'',_0x50bbef[_0xa950('0x17c')]]);if(_0x40c38f[_0xa950('0xa8')]===-0x1){return _0x40c38f;}return this['channel'][_0xa950('0xa9')](util['format'](_0xa950('0xc4'),_0xa950('0x179'),_0x56c3d5));};AGIVertices[_0xa950('0x12')][_0xa950('0x17d')]=function(_0x261d33){logger[_0xa950('0x2f')](util['format'](_0xa950('0x17e'),_0x261d33['label']));var _0x2cf67c=_0x261d33[_0xa950('0x17f')]||_0xa950('0x12f');var _0x55f3ad=util['format'](_0xa950('0x180'),this[_0xa950('0xd')][_0xa950('0x36')],rs[_0xa950('0x118')](0x5));var _0x5e8d50=util[_0xa950('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x55f3ad,_0x2cf67c);var _0x28818e=util[_0xa950('0x2a')]('%s/recordings/%s',FILES_PATH,_0x55f3ad);this[_0xa950('0x39')]['sync'](this,_0x261d33,_0x55f3ad,_0x5e8d50);this[_0xa950('0xd')][_0xa950('0x99')]('RECORDING_SAVENAME',_0x55f3ad);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x28818e,_0x2cf67c,_0x261d33['escape_digits'],_0x261d33[_0xa950('0x64')]);return this['channel'][_0xa950('0x132')](_0x28818e,_0x2cf67c,_0x261d33[_0xa950('0x181')],_0x261d33[_0xa950('0x64')],undefined,!![]);};AGIVertices['prototype'][_0xa950('0x182')]=function(_0x528888){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x183'),_0x528888[_0xa950('0xa5')]));if(!this['isConfigured'](_0x528888[_0xa950('0x63')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x184'));}var _0x14865d=this[_0xa950('0x185')][_0xa950('0xa2')](this,_0x528888);logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x186'),util[_0xa950('0x187')](_0x14865d,{'showHidden':![],'depth':null})));if(!this[_0xa950('0x83')](_0x528888[_0xa950('0xd7')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x188'));}var _0x1a2f1e=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x528888[_0xa950('0xd7')]);if(!_0x1a2f1e){return this[_0xa950('0xd')]['error'](_0x528888,_0xa950('0xd9'));}this[_0xa950('0xd')][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x189'),_0x1a2f1e),_0x14865d['statusCode']?_0x14865d['statusCode']:_0xa950('0x18a'));this['channel'][_0xa950('0x99')](util[_0xa950('0x2a')](_0xa950('0x18b'),_0x1a2f1e),_0x14865d[_0xa950('0x18c')]?_0x14865d[_0xa950('0x18c')]:'OK');if(_0x14865d[_0xa950('0x6a')]){try{this['saveRestApiResult'](_0x14865d[_0xa950('0x6a')],_0x1a2f1e);}catch(_0x334d24){logger[_0xa950('0x2e')](util[_0xa950('0x2a')](_0xa950('0x18d'),_0x1a2f1e));}}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format']('variable\x20%s\x20set',_0x1a2f1e));};AGIVertices['prototype']['saydigits']=function(_0x52f7b0){logger[_0xa950('0x2f')](util['format'](_0xa950('0x18e'),_0x52f7b0[_0xa950('0xa5')]));return this[_0xa950('0xd')]['sayDigits'](_0x52f7b0['digits'][_0xa950('0x57')](/\s+/g,''),_0x52f7b0[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x18f')]=function(_0x3050c0){logger['info'](util[_0xa950('0x2a')](_0xa950('0x190'),_0x3050c0[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x191')](_0x3050c0[_0xa950('0x65')]['replace'](/\s+/g,''),_0x3050c0[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x192')]=function(_0x5dc882){logger['info'](util[_0xa950('0x2a')](_0xa950('0x193'),_0x5dc882[_0xa950('0xa5')]));return this[_0xa950('0xd')][_0xa950('0x194')](_0x5dc882['text'],_0x5dc882[_0xa950('0x181')]);};AGIVertices[_0xa950('0x12')]['sendMail']=function(_0x14cefb){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x195'),_0x14cefb['label']));if(!this[_0xa950('0x83')](_0x14cefb[_0xa950('0x196')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x197'));}var _0x3bdc61=this[_0xa950('0x22')]['sync'](this,_0x14cefb['account_id']);if(!_0x3bdc61||!_0x3bdc61[_0xa950('0x198')]){return this[_0xa950('0xd')]['error'](_0x14cefb,'no\x20mail\x20account\x20found');}var _0x24f031={'from':util[_0xa950('0x2a')](_0xa950('0x199'),_0x3bdc61[_0xa950('0x11')],_0x3bdc61[_0xa950('0x19a')]||_0x3bdc61[_0xa950('0x198')][_0xa950('0x19b')]),'to':_0x14cefb['to']||'','cc':_0x14cefb['cc']||'','bcc':_0x14cefb['bcc']||'','subject':_0x14cefb[_0xa950('0x19c')],'html':_0x14cefb[_0xa950('0x5b')],'text':_0x14cefb[_0xa950('0x5b')]};if(this['isConfigured'](_0x14cefb[_0xa950('0x19d')])){}logger[_0xa950('0xdf')](_0xa950('0x19e'),JSON[_0xa950('0x71')](_0x24f031));this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x14cefb,_0x14cefb[_0xa950('0x196')]);this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3bdc61[_0xa950('0x11')]));this[_0xa950('0x25')][_0xa950('0xa2')](this,_0x3bdc61['smtpOptions'],_0x24f031);return this['channel'][_0xa950('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa950('0x12')][_0xa950('0x19f')]=function(_0x5a7fa9){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1a0'),_0x5a7fa9['label']));return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1a1'));};AGIVertices[_0xa950('0x12')]['sendSMS']=function(_0x1a1909){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1a2'),_0x1a1909[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x1a1909['sms_account_id'])){return this[_0xa950('0xd')]['noop']('no\x20sms\x20account\x20configured');}var _0x653f3b=this[_0xa950('0x33')][_0xa950('0xa2')](this,_0x1a1909['sms_account_id']);if(!_0x653f3b){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1a1909,_0xa950('0x1a3'));}var _0x494532={'body':_0x1a1909[_0xa950('0x1a4')],'phone':_0x1a1909['to']||'','SmsAccountId':_0x653f3b['id']};logger[_0xa950('0xdf')]('sendSMS\x20message',JSON[_0xa950('0x71')](_0x494532));this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x1a1909,_0x1a1909[_0xa950('0x1a5')]);this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1a6'),_0x653f3b['name']));this[_0xa950('0x34')][_0xa950('0xa2')](this,_0x494532);return this[_0xa950('0xd')][_0xa950('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa950('0x12')][_0xa950('0x1a7')]=function(_0x1a72e5){logger[_0xa950('0x2f')](util[_0xa950('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1a72e5['label']));if(!this[_0xa950('0x83')](_0x1a72e5[_0xa950('0xd7')])){return this[_0xa950('0xd')]['error'](_0x1a72e5,'no\x20variable\x20selected');}var _0x2b52bf=this[_0xa950('0x9e')][_0xa950('0xa2')](this,_0x1a72e5['variable_id']);if(!_0x2b52bf){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x1a72e5,_0xa950('0xd9'));}return this['channel']['setVariable'](_0x2b52bf,_0x1a72e5[_0xa950('0x1a8')]);};AGIVertices[_0xa950('0x12')][_0xa950('0x1a9')]=function(_0x4b0b90){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1aa'),_0x4b0b90['label']));this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ab'));var _0x5161bd=this[_0xa950('0xd')][_0xa950('0x9e')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x5161bd[_0xa950('0xa0')])){this[_0xa950('0xd')][_0xa950('0x36')]=_0x5161bd[_0xa950('0xa0')];}if(_0x4b0b90[_0xa950('0xb9')]===_0xa950('0x1ac')){this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ad'));return this['channel'][_0xa950('0xb9')]();}return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0x1ae'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1af')]=function(_0x2e3868){logger['info'](util['format'](_0xa950('0x1b0'),_0x2e3868[_0xa950('0xa5')]));if(!this['isConfigured'](_0x2e3868[_0xa950('0x1b1')])){return this[_0xa950('0xd')]['error'](_0x2e3868,_0xa950('0x1b2'));}var _0x844d71=this['getSquareProject']['sync'](this,_0x2e3868['project_id']);if(!this[_0xa950('0x83')](_0x844d71)){return this['channel'][_0xa950('0x2e')](_0x2e3868,util['format'](_0xa950('0x1b3'),_0x2e3868[_0xa950('0x1b1')]));}if(_0x844d71===this[_0xa950('0xd')][_0xa950('0x3e')]){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x2e3868,_0xa950('0x1b4'));}this['createSquareDetailsReport'][_0xa950('0xa2')](this,_0x2e3868,_0x844d71);var _0x412e04=this['channel'][_0xa950('0x55')]('AGI',util[_0xa950('0x2a')](_0xa950('0x1b5'),config[_0xa950('0xb5')][_0xa950('0x1b6')]||'127.0.0.1',_0x844d71,this['channel'][_0xa950('0x3e')]));if(_0x412e04[_0xa950('0xa8')]===-0x1){return _0x412e04;}return this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')]('Executed\x20command\x20%s\x20%s',_0xa950('0x1b7'),_0x844d71));};AGIVertices[_0xa950('0x12')][_0xa950('0x1b8')]=function(_0x1f65be){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1b9'),_0x1f65be[_0xa950('0xa5')]));var _0x20f540=this['shellCommand'][_0xa950('0xa2')](this,_0x1f65be['command']);this[_0xa950('0x35')][_0xa950('0xa2')](this,_0x1f65be,_0x1f65be[_0xa950('0xb7')]);if(this[_0xa950('0x83')](_0x1f65be[_0xa950('0xd7')])){var _0x568c83=this['getVariable'][_0xa950('0xa2')](this,_0x1f65be[_0xa950('0xd7')]);if(_0x568c83){this[_0xa950('0xd')][_0xa950('0x99')](_0x568c83,_0x20f540);return this['channel'][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1ba'),_0x1f65be['command'],_0x568c83));}}return this[_0xa950('0xd')][_0xa950('0xa9')](util['format'](_0xa950('0x1bb'),_0x1f65be[_0xa950('0xb7')]));};AGIVertices[_0xa950('0x12')]['google_cloud_tts']=function(_0x2b0cac){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1bc'),_0x2b0cac[_0xa950('0xa5')]));_0x2b0cac[_0xa950('0x5b')]=_0x2b0cac[_0xa950('0x5b')][_0xa950('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa950('0x83')](_0x2b0cac[_0xa950('0x59')])){return this[_0xa950('0xd')]['noop'](_0xa950('0x1bd'));}if(!this[_0xa950('0x83')](_0x2b0cac['text'])){return this[_0xa950('0xd')][_0xa950('0xa9')]('no\x20text\x20configured');}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1be'),_0x2b0cac[_0xa950('0x5b')]));var _0x2ec3b0=this['googleCloudTTS'][_0xa950('0xa2')](this,_0x2b0cac);if(_0x2ec3b0){this[_0xa950('0xd')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2ec3b0));var _0x34886b=this[_0xa950('0xd')]['streamFile'](_0x2ec3b0);try{fs[_0xa950('0x125')](_0x2ec3b0+_0xa950('0x102'));}catch(_0x42ad6f){logger[_0xa950('0x2e')](_0x42ad6f);}return _0x34886b;}return this['channel']['error'](_0x2b0cac,_0xa950('0x1bf'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1c0')]=function(_0x4dbffd){logger['info'](util[_0xa950('0x2a')](_0xa950('0x1c1'),_0x4dbffd[_0xa950('0xa5')]));_0x4dbffd[_0xa950('0x5b')]=_0x4dbffd[_0xa950('0x5b')][_0xa950('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa950('0x83')](_0x4dbffd[_0xa950('0x5b')])){return this[_0xa950('0xd')][_0xa950('0xa9')](_0xa950('0xa6'));}this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x1c2'),_0x4dbffd['text']));var _0x31a58e=this[_0xa950('0x61')][_0xa950('0xa2')](this,_0x4dbffd);if(_0x31a58e){this['channel'][_0xa950('0xa9')](util['format'](_0xa950('0x1c3'),_0x31a58e));var _0x37505c=this[_0xa950('0xd')][_0xa950('0x101')](_0x31a58e);try{fs[_0xa950('0x125')](_0x31a58e+_0xa950('0x102'));}catch(_0x583e66){logger[_0xa950('0x2e')](_0x583e66);}return _0x37505c;}return this['channel'][_0xa950('0x2e')](_0x4dbffd,_0xa950('0x1c4'));};AGIVertices[_0xa950('0x12')][_0xa950('0x1c5')]=function(_0x1eb94e){logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x1c6'),_0x1eb94e[_0xa950('0xa5')]));if(!this['isConfigured'](_0x1eb94e['findBy'])){return this['channel'][_0xa950('0x2e')](_0x1eb94e,_0xa950('0x157'));}logger[_0xa950('0x2f')](util['format'](_0xa950('0x158'),this[_0xa950('0xd')]['callerid'],_0x1eb94e[_0xa950('0x159')]));var _0x42b76e=this['agentUnpause'][_0xa950('0xa2')](this,_0x1eb94e[_0xa950('0x159')]);if(_0x42b76e){logger[_0xa950('0x2f')](util['format'](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e[_0xa950('0x159')]));this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0x15a'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e['findBy']));return{'code':0xc8,'result':_0xa950('0x15b')};}else{logger[_0xa950('0x2f')](util[_0xa950('0x2a')](_0xa950('0x15c'),this['channel']['callerid'],_0x1eb94e[_0xa950('0x159')]));this[_0xa950('0xd')]['noop'](util[_0xa950('0x2a')](_0xa950('0x15c'),this[_0xa950('0xd')][_0xa950('0x38')],_0x1eb94e[_0xa950('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa950('0x12')]['voicemail']=function(_0x18f68a){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1c7'),_0x18f68a[_0xa950('0xa5')]));var _0x551740=this[_0xa950('0xd')][_0xa950('0x55')](_0xa950('0x1c8'),[_0x18f68a[_0xa950('0x1c9')],_0x18f68a['options']]);if(_0x551740[_0xa950('0xa8')]===-0x1){return _0x551740;}return this[_0xa950('0xd')][_0xa950('0xa9')](util[_0xa950('0x2a')](_0xa950('0xc4'),_0xa950('0x1c8'),_0x18f68a[_0xa950('0x1c9')]));};AGIVertices[_0xa950('0x12')][_0xa950('0x1ca')]=function(_0x3b4065){logger[_0xa950('0x2f')](util['format'](_0xa950('0x1cb'),_0x3b4065[_0xa950('0xa5')]));if(!this[_0xa950('0x83')](_0x3b4065[_0xa950('0xd7')])){return this[_0xa950('0xd')]['error'](_0x3b4065,'no\x20variable\x20selected');}var _0x2746e1=this['getVariable']['sync'](this,_0x3b4065[_0xa950('0xd7')]);if(!_0x2746e1){return this[_0xa950('0xd')][_0xa950('0x2e')](_0x3b4065,_0xa950('0xd9'));}var _0x13ed62=this[_0xa950('0xd')][_0xa950('0x9e')](_0x2746e1);return{'code':0xc8,'result':_0x13ed62[_0xa950('0xa0')]?_0x13ed62[_0xa950('0xa0')]:'-'};};String[_0xa950('0x12')][_0xa950('0x9d')]=function(_0x3d02b8,_0x542c32){return this['split'](_0x3d02b8)[_0xa950('0x1cc')](_0x542c32);};module[_0xa950('0x1cd')]=AGIVertices; \ No newline at end of file +var _0x826a=['getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','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','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','calleridname','accountcode','dnid','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','PUT','toUpperCase','body','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','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','includes','isString','hasOwnProperty','isPlainObject','recursiveNodeIndex','length','isEmpty','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','replaceAllVariables','replaceAll','extra','getAndSetVariable','result','isConfigured','maxRetry','retry','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','dial','debug','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.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\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','agi','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','lodash','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById'];(function(_0x58c239,_0x1788bc){var _0x1cd7cb=function(_0x4359b5){while(--_0x4359b5){_0x58c239['push'](_0x58c239['shift']());}};_0x1cd7cb(++_0x1788bc);}(_0x826a,0x1aa));var _0xa826=function(_0x5e6f88,_0x23c5b0){_0x5e6f88=_0x5e6f88-0x0;var _0x191a80=_0x826a[_0x5e6f88];return _0x191a80;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xa826('0x0'));var sh=require('shelljs');var odbc=require(_0xa826('0x1'))();var rs=require('randomstring');var moment=require(_0xa826('0x2'));var Mustache=require(_0xa826('0x3'));var rp=require(_0xa826('0x4'));var logger=require(_0xa826('0x5'))('agi');var config=require(_0xa826('0x6'));var scripts=require(_0xa826('0x7'));var FILES_PATH=_0xa826('0x8');var recursiveMapAttributes=[_0xa826('0x9'),_0xa826('0xa')];var verticesWithRetry=[_0xa826('0xb'),_0xa826('0xc'),_0xa826('0xd')];var AGIVertices=function(_0xc348d2,_0x428c70,_0xe662ee){this[_0xa826('0xe')]=_0xc348d2;this[_0xa826('0xf')]=_0x428c70;this[_0xa826('0x10')]=_0xe662ee;};AGIVertices[_0xa826('0x11')][_0xa826('0x12')]=function(_0x48df82,_0xbd22fc){this['rpc'][_0xa826('0x13')](_0x48df82)[_0xa826('0x14')](function(_0x286500){_0xbd22fc(null,_0x286500?_0x286500[_0xa826('0x15')]:![]);})[_0xa826('0x16')](function(_0x40838f){_0xbd22fc(_0x40838f);});};AGIVertices[_0xa826('0x11')]['getVoiceQueue']=function(_0x74f6ec,_0x5c6cee){this[_0xa826('0xf')][_0xa826('0x17')](_0x74f6ec)['then'](function(_0x512ba9){_0x5c6cee(null,_0x512ba9?_0x512ba9['name']:![]);})[_0xa826('0x16')](function(_0x4f25bd){_0x5c6cee(_0x4f25bd);});};AGIVertices['prototype'][_0xa826('0x18')]=function(_0x142474,_0x2e15e2){this['rpc'][_0xa826('0x19')](_0x142474)[_0xa826('0x14')](function(_0x258915){_0x2e15e2(null,_0x258915?_0x258915[_0xa826('0x15')]:![]);})[_0xa826('0x16')](function(_0x48930f){_0x2e15e2(_0x48930f);});};AGIVertices[_0xa826('0x11')][_0xa826('0x1a')]=function(_0x229b90,_0x57e96e){this['rpc'][_0xa826('0x1b')](_0x229b90)[_0xa826('0x14')](function(_0xd8ca56){_0x57e96e(null,_0xd8ca56?_0xd8ca56[_0xa826('0x1c')]:![]);})[_0xa826('0x16')](function(_0x4e0f43){_0x57e96e(_0x4e0f43);});};AGIVertices[_0xa826('0x11')][_0xa826('0x1d')]=function(_0x3272fb,_0x5d410f){this['rpc'][_0xa826('0x1e')](_0x3272fb)[_0xa826('0x14')](function(_0x3b43da){_0x5d410f(null,_0x3b43da?_0x3b43da['name']:![]);})[_0xa826('0x16')](function(_0x26ef25){_0x5d410f(_0x26ef25);});};AGIVertices[_0xa826('0x11')][_0xa826('0x1f')]=function(_0x1ec8a8,_0x4d6909){this[_0xa826('0xf')]['getTrunkById'](_0x1ec8a8)[_0xa826('0x14')](function(_0x174f16){_0x4d6909(null,_0x174f16?_0x174f16['name']:![]);})[_0xa826('0x16')](function(_0xfa4d94){_0x4d6909(_0xfa4d94);});};AGIVertices[_0xa826('0x11')][_0xa826('0x20')]=function(_0x1107a4,_0x3c6307){var _0x14e836=this;this[_0xa826('0xf')][_0xa826('0x21')](_0x1107a4)[_0xa826('0x14')](function(_0x1e35de){_0x3c6307(null,_0x1e35de?_0x14e836[_0xa826('0x22')](_0x1e35de[_0xa826('0x23')]):![]);})[_0xa826('0x16')](function(_0x2253c7){_0x3c6307(_0x2253c7);});};AGIVertices[_0xa826('0x11')]['getMailAccount']=function(_0x19bd84,_0x5e8210){this[_0xa826('0xf')][_0xa826('0x24')](_0x19bd84)[_0xa826('0x14')](function(_0x27d779){_0x5e8210(null,_0x27d779?_0x27d779:![]);})[_0xa826('0x16')](function(_0x5d40f5){_0x5e8210(_0x5d40f5);});};AGIVertices['prototype'][_0xa826('0x25')]=function(_0x6bf769,_0xd666b7,_0x45a69e){this['mailRpc'][_0xa826('0x25')](_0x6bf769,_0xd666b7)[_0xa826('0x14')](function(){_0x45a69e(null);})['catch'](function(_0x24472b){_0x45a69e(_0x24472b);});};AGIVertices['prototype'][_0xa826('0x26')]=function(_0x40093a,_0x1b41d8){this[_0xa826('0xf')][_0xa826('0x27')](_0x40093a)['then'](function(_0x16f535){if(_0x16f535){if(_0x16f535[_0xa826('0x28')]){_0x1b41d8(null,[_0x16f535[_0xa826('0x29')]]);}else{_0x1b41d8(null,_[_0xa826('0x2a')](_0x16f535[_0xa826('0x2b')],_0xa826('0x29')));}}else{_0x1b41d8(null,![]);}})[_0xa826('0x16')](function(_0x1aaeae){_0x1b41d8(_0x1aaeae);});};AGIVertices[_0xa826('0x11')][_0xa826('0x22')]=function(_0xd82ea2){return util['format'](_0xa826('0x2c'),FILES_PATH,_0xd82ea2);};AGIVertices['prototype'][_0xa826('0x2d')]=function(_0x4d8c2a,_0x179c29,_0x2bae70){odbc[_0xa826('0x2e')](_0x4d8c2a,function(_0x17bef8){if(_0x17bef8){logger[_0xa826('0x2f')](_0xa826('0x30'),_0x17bef8);_0x2bae70(_0x17bef8);}else{logger[_0xa826('0x31')](_0xa826('0x32'));odbc[_0xa826('0x33')](_0x179c29,function(_0xb1a771,_0x583ff0){if(_0xb1a771){logger[_0xa826('0x31')]('Error\x20executing\x20query\x20%s',_0x179c29);_0x2bae70(_0xb1a771);}else{logger[_0xa826('0x31')](_0xa826('0x34'),_0x179c29);odbc[_0xa826('0x35')](function(_0x5899d0){if(_0x5899d0){logger[_0xa826('0x2f')](_0xa826('0x36'),_0x5899d0);}_0x2bae70(null,_0x583ff0);});}});}});};AGIVertices['prototype'][_0xa826('0x37')]=function(_0x47d9f1,_0x51d765){this[_0xa826('0xf')][_0xa826('0x38')](_0x47d9f1)[_0xa826('0x14')](function(_0x308d4){_0x51d765(null,_0x308d4?_0x308d4:![]);})[_0xa826('0x16')](function(_0x322187){_0x51d765(_0x322187);});};AGIVertices['prototype'][_0xa826('0x39')]=function(_0x4a538c,_0x2be07c){this[_0xa826('0xf')][_0xa826('0x39')](_0x4a538c)[_0xa826('0x14')](function(_0x5e9a3d){_0x2be07c(null,_0x5e9a3d);})[_0xa826('0x16')](function(_0x34017e){_0x2be07c(_0x34017e);});};AGIVertices[_0xa826('0x11')][_0xa826('0x3a')]=function(_0x258e57,_0x53b70e,_0x3f7df5){this[_0xa826('0xf')][_0xa826('0x3a')]({'uniqueid':this[_0xa826('0xe')][_0xa826('0x3b')],'node':_0x258e57[_0xa826('0x3c')],'application':_0x258e57[_0xa826('0x3d')],'data':_0x53b70e||null,'project_name':this[_0xa826('0xe')][_0xa826('0x3e')],'callerid':this[_0xa826('0xe')][_0xa826('0x3f')]})[_0xa826('0x14')](function(_0x52189f){if(_0x3f7df5){_0x3f7df5(null,_0x52189f);}})[_0xa826('0x16')](function(_0xb2d355){if(_0x3f7df5){_0x3f7df5(_0xb2d355);}});};AGIVertices[_0xa826('0x11')]['createSquareRecording']=function(_0x24122e,_0x247348,_0x94fb6f,_0x3e98c2){this[_0xa826('0xf')]['createSquareRecording']({'uniqueid':this[_0xa826('0xe')][_0xa826('0x3b')],'callerid':this[_0xa826('0xe')][_0xa826('0x3f')],'calleridname':this[_0xa826('0xe')][_0xa826('0x40')],'context':this[_0xa826('0xe')]['context'],'extension':this[_0xa826('0xe')]['extension'],'priority':this['channel']['priority'],'accountcode':this[_0xa826('0xe')][_0xa826('0x41')],'dnid':this[_0xa826('0xe')][_0xa826('0x42')],'projectName':this['channel'][_0xa826('0x3e')],'saveName':_0x247348,'filename':_0x24122e['file']||_0x247348,'savePath':_0x94fb6f})['then'](function(_0xedcbc2){_0x3e98c2(null,_0xedcbc2);})[_0xa826('0x16')](function(_0x494df9){_0x3e98c2(_0x494df9);});};AGIVertices[_0xa826('0x11')][_0xa826('0x43')]=function(_0x57f237,_0x5a87bf,_0x5b238e,_0x4c469a,_0x5782a0){this['rpc']['createSquareMessage']({'uniqueid':this[_0xa826('0xe')]['uniqueid'],'body':_0x57f237,'direction':_0x5a87bf,'providerName':_0x5b238e,'providerResponse':_0x4c469a})[_0xa826('0x14')](function(_0x486b6c){if(_0x5782a0){_0x5782a0(null,_0x486b6c);}})[_0xa826('0x16')](function(_0x28d232){if(_0x5782a0){_0x5782a0(_0x28d232);}});};AGIVertices[_0xa826('0x11')][_0xa826('0x44')]=function(_0x27f3a8,_0x52cf5e){this[_0xa826('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x27f3a8[_0xa826('0x15')])||_[_0xa826('0x45')](_0x27f3a8['name'])?_0xa826('0x46')+Math[_0xa826('0x47')]():_0x27f3a8[_0xa826('0x15')],'lastName':_['isEmpty'](_0x27f3a8[_0xa826('0x48')])||_[_0xa826('0x45')](_0x27f3a8[_0xa826('0x48')])?null:_0x27f3a8[_0xa826('0x48')],'phone':_0x27f3a8[_0xa826('0x49')],'ListId':_0x27f3a8[_0xa826('0x4a')],'scheduledat':_0x27f3a8[_0xa826('0x4b')],'callbackUniqueid':this[_0xa826('0xe')]['uniqueid'],'tags':_0xa826('0x4c'),'description':_0xa826('0x4d')+_0x27f3a8[_0xa826('0x4b')][_0xa826('0x4e')](),'priority':_0x27f3a8[_0xa826('0x4f')]})['then'](function(_0x176e2c){_0x52cf5e(null,_0x176e2c);})[_0xa826('0x16')](function(_0x2f2ee5){_0x52cf5e(_0x2f2ee5);});};AGIVertices['prototype'][_0xa826('0x50')]=function(_0x1623e2,_0x4d62d0){this[_0xa826('0xf')][_0xa826('0x51')](_0x1623e2)[_0xa826('0x14')](function(_0x1cd13d){_0x4d62d0(null,_0x1cd13d?_0x1cd13d[_0xa826('0x15')]:![]);})[_0xa826('0x16')](function(_0x21469f){_0x4d62d0(_0x21469f);});};AGIVertices[_0xa826('0x11')][_0xa826('0x52')]=function(_0x2287ea,_0x1745ea,_0x4a7ba6){var _0x39132b={'role':_0xa826('0x53')};_0x39132b[_0x2287ea]=this[_0xa826('0xe')][_0xa826('0x3f')];this[_0xa826('0xf')][_0xa826('0x52')](_0x39132b,_0x1745ea,this[_0xa826('0xe')][_0xa826('0x3b')])['then'](function(_0x330789){_0x4a7ba6(null,_[_0xa826('0x45')](_0x330789)?![]:!![]);})[_0xa826('0x16')](function(_0x5c0df1){logger[_0xa826('0x2f')](_0x5c0df1);_0x4a7ba6(null,![]);});};AGIVertices[_0xa826('0x11')][_0xa826('0x54')]=function(_0x4c9f11,_0x547694){var _0x459a40={'role':_0xa826('0x53')};_0x459a40[_0x4c9f11]=this[_0xa826('0xe')][_0xa826('0x3f')];this['rpc'][_0xa826('0x54')](_0x459a40)[_0xa826('0x14')](function(_0x1260da){_0x547694(null,_[_0xa826('0x45')](_0x1260da)?![]:!![]);})[_0xa826('0x16')](function(_0x46bc53){logger[_0xa826('0x2f')](_0x46bc53);_0x547694(null,![]);});};AGIVertices[_0xa826('0x11')][_0xa826('0x55')]=function(_0x564cfb,_0x542806){var _0x5d257b={'role':'agent'};_0x5d257b[_0x564cfb]=this[_0xa826('0xe')][_0xa826('0x3f')];this[_0xa826('0xf')][_0xa826('0x55')](_0x5d257b)[_0xa826('0x14')](function(_0x23541c){_0x542806(null,_['isNil'](_0x23541c)?![]:!![]);})[_0xa826('0x16')](function(_0x3da3f5){logger[_0xa826('0x2f')](_0x3da3f5);_0x542806(null,![]);});};AGIVertices['prototype'][_0xa826('0x56')]=function(_0x27d05e,_0x24341c){var _0x146cb0={'role':_0xa826('0x53')};_0x146cb0[_0x27d05e]=this[_0xa826('0xe')][_0xa826('0x3f')];var _0x460cbb=_0x27d05e!=_0xa826('0x57')?util[_0xa826('0x58')](_0xa826('0x59'),_0xa826('0x5a'),this[_0xa826('0xe')][_0xa826('0x3f')]):undefined;this[_0xa826('0xf')]['agentLogin'](_0x146cb0,_0x460cbb)[_0xa826('0x14')](function(_0x4cc3ae){_0x24341c(null,_[_0xa826('0x45')](_0x4cc3ae)?![]:!![]);})['catch'](function(_0x36dd93){logger['error'](_0x36dd93);_0x24341c(null,![]);});};AGIVertices[_0xa826('0x11')][_0xa826('0x5b')]=function(_0x46cc87,_0x545eaa){sh['exec'](_['trim'](_0x46cc87),function(_0x16222c,_0x281f63){var _0x268369=_0x281f63['replace'](/(\r\n|\n|\r)/gm,'');_0x545eaa(null,_0x268369);});};AGIVertices[_0xa826('0x11')][_0xa826('0x5c')]=function(_0x19e39f,_0x425fe2){scripts['googleCloudTTS'](_0x19e39f[_0xa826('0x5d')],_0x19e39f[_0xa826('0x5e')]||_0xa826('0x5f'),_0x19e39f[_0xa826('0x5f')],_0x19e39f[_0xa826('0x60')]||'en-US',_0x19e39f['ssmlGender']||_0xa826('0x61'),_0x19e39f[_0xa826('0x62')]||_0xa826('0x63'))[_0xa826('0x14')](function(_0x235870){_0x425fe2(null,_0x235870);})['catch'](function(_0x5c73c0){_0x425fe2(_0x5c73c0);});};AGIVertices[_0xa826('0x11')][_0xa826('0x64')]=function(_0x3339a9,_0x3912af){scripts[_0xa826('0x64')](_0x3339a9[_0xa826('0x5f')],_0x3339a9['google_tts_language']||'en',0x1)[_0xa826('0x14')](function(_0x518507){_0x3912af(null,_0x518507);})[_0xa826('0x16')](function(_0xf7f2de){_0x3912af(_0xf7f2de);});};AGIVertices['prototype'][_0xa826('0x65')]=function(_0x556a5d,_0x108510){var _0x4791e2={'uri':_0x556a5d[_0xa826('0x66')],'method':_0x556a5d[_0xa826('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x556a5d[_0xa826('0x68')])===_0xa826('0x69')&&parseInt(_0x556a5d[_0xa826('0x68')])>=0x1?parseInt(_0x556a5d[_0xa826('0x68')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xa826('0x6a')],_0x4791e2['method'][_0xa826('0x6b')]())){try{_0x4791e2[_0xa826('0x6c')]=_0x556a5d[_0xa826('0xa')]?JSON['parse'](_0x556a5d[_0xa826('0xa')]):{};}catch(_0x3c4ea8){logger[_0xa826('0x2f')](_0xa826('0x6d'),_0x3c4ea8);}}try{_0x4791e2[_0xa826('0x6e')]=_0x556a5d['rawHeaders']?JSON[_0xa826('0x6f')](_0x556a5d[_0xa826('0x9')]):{};}catch(_0x31c2f3){logger[_0xa826('0x2f')](_0xa826('0x70'),_0x31c2f3);}if(_0x556a5d[_0xa826('0x71')]){try{var _0x22cc5c=require(_0x556a5d[_0xa826('0x71')])[_0xa826('0x72')](this,_0x4791e2);_0x4791e2[_0xa826('0x73')]=Mustache['render'](_0x556a5d[_0xa826('0x66')],_0x22cc5c,{},['$$','$$']);if(_0x4791e2[_0xa826('0x6e')]){_0x4791e2['headers']=JSON['parse'](Mustache[_0xa826('0x74')](JSON[_0xa826('0x75')](_0x4791e2['headers']),_0x22cc5c,{},['$$','$$']));}if(_0x4791e2[_0xa826('0x6c')]){_0x4791e2[_0xa826('0x6c')]=JSON[_0xa826('0x6f')](Mustache[_0xa826('0x74')](JSON['stringify'](_0x4791e2['body']),_0x22cc5c,{},['$$','$$']));}}catch(_0x46ec4a){logger[_0xa826('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x46ec4a);}}rp(_0x4791e2)[_0xa826('0x14')](function(_0x16510b){var _0xfc6c6e={'statusCode':_0x16510b[_0xa826('0x76')]||0xc8,'statusMessage':_0x16510b[_0xa826('0x77')]||'OK','headers':_0x16510b[_0xa826('0x6e')]||{},'body':_0x16510b[_0xa826('0x6c')]||{}};_0x108510(null,_0xfc6c6e);})[_0xa826('0x16')](function(_0x4e7e2a){var _0xca2123={'statusCode':_0x4e7e2a[_0xa826('0x76')]||0x1f4,'statusMessage':_0x4e7e2a[_0xa826('0x78')]||_0xa826('0x79'),'headers':_0x4e7e2a['options'][_0xa826('0x6e')]||{},'body':_0x4e7e2a[_0xa826('0x7a')][_0xa826('0x6c')]||{}};_0x108510(null,_0xca2123);});};AGIVertices[_0xa826('0x11')][_0xa826('0x7b')]=function(_0x123838,_0x2d7707){scripts['googleDialogflow'](this[_0xa826('0xe')][_0xa826('0x3b')],_0x123838[_0xa826('0x7c')],_0x123838[_0xa826('0x5f')],_0x123838[_0xa826('0x7d')]||'en')[_0xa826('0x14')](function(_0x5a55fa){_0x2d7707(null,_0x5a55fa);})[_0xa826('0x16')](function(_0x43de97){_0x2d7707(_0x43de97);});};AGIVertices[_0xa826('0x11')]['googleDialogflowV2']=function(_0x149068,_0x4d4ea8){scripts[_0xa826('0x7e')](this[_0xa826('0xe')]['uniqueid'],_0x149068[_0xa826('0x7f')],_0x149068[_0xa826('0x80')],_0x149068['private_key'],_0x149068[_0xa826('0x5f')],_0x149068['dialogflowV2_language']||'en')[_0xa826('0x14')](function(_0x1ecd0a){_0x4d4ea8(null,_0x1ecd0a);})[_0xa826('0x16')](function(_0x2de5c0){_0x4d4ea8(_0x2de5c0);});};AGIVertices[_0xa826('0x11')][_0xa826('0x81')]=function(_0x5a113e,_0x31cb45){scripts[_0xa826('0x81')](this[_0xa826('0xe')],_0x5a113e)[_0xa826('0x14')](function(_0x498a5d){_0x31cb45(null,_0x498a5d);})[_0xa826('0x16')](function(_0x2a56d6){_0x31cb45(_0x2a56d6);});};AGIVertices[_0xa826('0x11')][_0xa826('0x82')]=function(_0xcc1524,_0x2ff2b0){scripts[_0xa826('0x82')](_0xcc1524[_0xa826('0x7c')],_0xcc1524['text'],_0xcc1524['ispeech_tts_language']||_0xa826('0x83'),_0xcc1524[_0xa826('0x84')])[_0xa826('0x14')](function(_0x2d5c2a){_0x2ff2b0(null,_0x2d5c2a);})[_0xa826('0x16')](function(_0x5b5d4e){_0x2ff2b0(_0x5b5d4e);});};AGIVertices['prototype'][_0xa826('0x85')]=function(_0x5378cc,_0x4820a0,_0x39d5d8){scripts[_0xa826('0x85')](_0x4820a0,_0x5378cc[_0xa826('0x7c')],_0x5378cc[_0xa826('0x86')]||'en-US',this['isConfigured'](_0x5378cc[_0xa826('0x87')])?_0x5378cc[_0xa826('0x87')]:undefined)[_0xa826('0x14')](function(_0x3bc26e){_0x39d5d8(null,_0x3bc26e);})[_0xa826('0x16')](function(_0x146c77){_0x39d5d8(_0x146c77);});};AGIVertices['prototype'][_0xa826('0x88')]=function(_0x1cc899,_0x171b13){scripts[_0xa826('0x88')](_0x1cc899[_0xa826('0x89')],_0x1cc899['aws_secret_access_key'],_0x1cc899[_0xa826('0x8a')],_0x1cc899['aws_polly_voice']||_0xa826('0x8b'),_0x1cc899[_0xa826('0x5f')],_0x1cc899[_0xa826('0x8c')]||_0xa826('0x5f'))[_0xa826('0x14')](function(_0x1ff7b8){_0x171b13(null,_0x1ff7b8);})[_0xa826('0x16')](function(_0x34e4fb){_0x171b13(_0x34e4fb);});};AGIVertices['prototype'][_0xa826('0x8d')]=function(_0x30e3e2,_0x333871){scripts[_0xa826('0x8d')](this[_0xa826('0xe')][_0xa826('0x3b')],_0x30e3e2[_0xa826('0x89')],_0x30e3e2[_0xa826('0x8e')],_0x30e3e2[_0xa826('0x8f')],_0x30e3e2[_0xa826('0x5f')],_0x30e3e2[_0xa826('0x90')])['then'](function(_0x140106){_0x333871(null,_0x140106);})[_0xa826('0x16')](function(_0x35db21){_0x333871(_0x35db21);});};AGIVertices[_0xa826('0x11')][_0xa826('0x91')]=function(_0x3c8449,_0x4c6826,_0x2477b5){scripts[_0xa826('0x91')](_0x4c6826,_0x3c8449[_0xa826('0x7c')],_0x3c8449['google_asr_language']||_0xa826('0x83'))['then'](function(_0x29d84b){_0x2477b5(null,_0x29d84b);})[_0xa826('0x16')](function(_0x5f4500){_0x2477b5(_0x5f4500);});};AGIVertices['prototype'][_0xa826('0x92')]=function(_0x196088,_0x56259e,_0x5a9ef3){scripts[_0xa826('0x92')](_0x56259e,_0x196088['appid'],_0x196088[_0xa826('0x93')],_0x196088['uri'])['then'](function(_0x189c1c){_0x5a9ef3(null,_0x189c1c);})['catch'](function(_0x21a8a4){_0x5a9ef3(_0x21a8a4);});};AGIVertices['prototype'][_0xa826('0x94')]=function(_0x50f3b6){var _0x4eaa94=_[_0xa826('0x95')](verticesWithRetry,_0x50f3b6[_0xa826('0x3d')])?_0x50f3b6:_['clone'](_0x50f3b6);for(var _0x3f87f1 in _0x4eaa94){if(_0x4eaa94['hasOwnProperty'](_0x3f87f1)){if(_0x4eaa94[_0x3f87f1]&&_[_0xa826('0x96')](_0x4eaa94[_0x3f87f1])){if(_[_0xa826('0x95')](recursiveMapAttributes,_0x3f87f1)){_0x4eaa94[_0x3f87f1]=this['replaceObjectAllVariables'](_0x4eaa94[_0x3f87f1]);}else{_0x4eaa94[_0x3f87f1]=this['replaceAllVariables'](_0x4eaa94[_0x3f87f1]);}}}}return _0x4eaa94;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x390cfe){for(var _0x48e9fa in _0x390cfe){if(_0x390cfe[_0xa826('0x97')](_0x48e9fa)){if(_[_0xa826('0x98')](_0x390cfe[_0x48e9fa])){this[_0xa826('0x99')](_0x390cfe[_0x48e9fa]);}else if(_['isArray'](_0x390cfe[_0x48e9fa])){for(var _0x3df606=0x0;_0x3df606<_0x390cfe[_0x48e9fa][_0xa826('0x9a')];_0x3df606++){this[_0xa826('0x99')](_0x390cfe[_0x48e9fa][_0x3df606]);}}else if(_[_0xa826('0x96')](_0x390cfe[_0x48e9fa])){_0x390cfe[_0x48e9fa]=this['replaceAllVariables'](_0x390cfe[_0x48e9fa]);}}}};AGIVertices[_0xa826('0x11')]['saveRestApiResult']=function(_0x3650b1,_0x404181){for(var _0x14c0f4 in _0x3650b1){if(_0x3650b1[_0xa826('0x97')](_0x14c0f4)){if(_[_0xa826('0x98')](_0x3650b1[_0x14c0f4])){if(!_[_0xa826('0x9b')](_0x3650b1[_0x14c0f4])){this[_0xa826('0x9c')](_0x3650b1[_0x14c0f4],util[_0xa826('0x58')](_0xa826('0x9d'),_0x404181,_0x14c0f4));}}else if(_[_0xa826('0x9e')](_0x3650b1[_0x14c0f4])){for(var _0x46d8f1=0x0;_0x46d8f1<_0x3650b1[_0x14c0f4][_0xa826('0x9a')];_0x46d8f1++){this[_0xa826('0x9c')](_0x3650b1[_0x14c0f4][_0x46d8f1],util[_0xa826('0x58')]('%s.%s',_0x404181,_0x14c0f4+'['+_0x46d8f1+']'));}}else{if(!_[_0xa826('0x45')](_0x3650b1[_0x14c0f4])){this['channel'][_0xa826('0x9f')](util[_0xa826('0x58')](_0xa826('0x9d'),_0x404181,_0x14c0f4),_0x3650b1[_0x14c0f4]);}}}}};AGIVertices[_0xa826('0x11')][_0xa826('0xa0')]=function(_0x2188e7){try{var _0xd7104e=JSON[_0xa826('0x6f')](_0x2188e7);this[_0xa826('0x99')](_0xd7104e);return JSON[_0xa826('0x75')](_0xd7104e);}catch(_0x3c168d){return this[_0xa826('0xa1')](_0x2188e7);}};AGIVertices['prototype'][_0xa826('0xa1')]=function(_0xeecfbb){var _0x2e4378=_0xeecfbb['split']('{');for(var _0x32641d=0x1;_0x32641d<_0x2e4378[_0xa826('0x9a')];_0x32641d+=0x1){var _0xbfd094=_0x2e4378[_0x32641d]['split']('}');if(_0xbfd094[_0xa826('0x9a')]>0x1){_0xeecfbb=_0xeecfbb[_0xa826('0xa2')]('{'+_0xbfd094[0x0]+'}',this[_0xa826('0xe')][_0xa826('0x12')](_0xbfd094[0x0])[_0xa826('0xa3')]||_0xbfd094[0x0]);}}if(_0x2e4378[_0xa826('0x9a')]===0x1){return _0xeecfbb[_0xa826('0x4e')]();}return this['replaceAllVariables'](_0xeecfbb);};AGIVertices[_0xa826('0x11')][_0xa826('0xa4')]=function(_0x18dcc4,_0x25f615){var _0xc4f67d=this[_0xa826('0xe')][_0xa826('0x12')](_0x18dcc4);if(_0xc4f67d[_0xa826('0xa5')]===-0x1){return _0xc4f67d;}logger[_0xa826('0x31')](util[_0xa826('0x58')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x25f615,_0xc4f67d[_0xa826('0xa3')]));return this[_0xa826('0xe')]['setVariable'](_0x25f615,_0xc4f67d[_0xa826('0xa3')]);};AGIVertices[_0xa826('0x11')][_0xa826('0xa6')]=function(_0x4dc4ad){return _0x4dc4ad&&_0x4dc4ad!=='0'&&_0x4dc4ad!=='-1'&&_0x4dc4ad!=='';};AGIVertices[_0xa826('0x11')][_0xa826('0xa7')]=function(_0xf84cd7){this[_0xa826('0x3a')][_0xa826('0x72')](this,_0xf84cd7,'-');_0xf84cd7[_0xa826('0xa8')]=_0xf84cd7['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x42348a){logger[_0xa826('0x31')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x42348a[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x42348a[_0xa826('0x5f')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xaa'));}var _0xde5c19='\x22'+_0x42348a[_0xa826('0x5f')]+'\x22';if(this[_0xa826('0xa6')](_0x42348a['options'])){_0xde5c19+=','+_0x42348a[_0xa826('0x7a')];}var _0x31446d=this[_0xa826('0xe')][_0xa826('0xab')](_0xa826('0xac'),_0xde5c19);if(_0x31446d['result']===-0x1){return _0x31446d;}return this['channel'][_0xa826('0xa9')](util[_0xa826('0x58')]('Executed\x20command\x20MRCPSynth\x20%s',_0xde5c19));};AGIVertices[_0xa826('0x11')][_0xa826('0xad')]=function(_0x569194){logger[_0xa826('0x31')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x569194['label']));if(!this['isConfigured'](_0x569194[_0xa826('0xae')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xaf'));}var _0x2d75d2=_0x569194['grammar'];if(this['isConfigured'](_0x569194[_0xa826('0x7a')])){_0x2d75d2+=','+_0x569194[_0xa826('0x7a')];}var _0xa67bf6=this['channel']['exec'](_0xa826('0xb0'),_0x2d75d2);if(_0xa67bf6[_0xa826('0xa5')]===-0x1){return _0xa67bf6;}var _0x5691d0=this['getAndSetVariable'](_0xa826('0xb1'),_0xa826('0xb2'));if(_0x5691d0['result']===-0x1){return _0x5691d0;}var _0x1a6579=this['getAndSetVariable'](_0xa826('0xb3'),_0xa826('0xb4'));if(_0x1a6579[_0xa826('0xa5')]===-0x1){return _0x1a6579;}var _0x4af25a=this[_0xa826('0xa4')]('RECOG_INSTANCE()',_0xa826('0xb5'));if(_0x4af25a['result']===-0x1){return _0x4af25a;}return this[_0xa826('0xe')][_0xa826('0xa9')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2d75d2));};AGIVertices[_0xa826('0x11')]['agi']=function(_0x302398){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0xb6'),_0x302398[_0xa826('0x3c')]));return this[_0xa826('0xe')]['agi']([_0x302398[_0xa826('0xb7')],_0x302398['args']]);};AGIVertices[_0xa826('0x11')]['answer']=function(_0x41b8bb){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0xb8'),_0x41b8bb[_0xa826('0x3c')]));if(this[_0xa826('0xa6')](_0x41b8bb[_0xa826('0x68')])){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0xb9'),_0x41b8bb[_0xa826('0x68')]));var _0x456322=this[_0xa826('0xe')][_0xa826('0xba')](_0x41b8bb[_0xa826('0x68')]);if(_0x456322[_0xa826('0xa5')]===-0x1){return _0x456322;}}return this[_0xa826('0xe')][_0xa826('0xbb')]();};AGIVertices[_0xa826('0x11')][_0xa826('0x4c')]=function(_0x2ebe18){logger['info'](util[_0xa826('0x58')](_0xa826('0xbc'),_0x2ebe18[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x2ebe18[_0xa826('0x4a')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x2ebe18,_0xa826('0xbd'));}_0x2ebe18['scheduledAt']=moment();if(this[_0xa826('0xa6')](_0x2ebe18[_0xa826('0xbe')])){_0x2ebe18[_0xa826('0x4b')]=moment()[_0xa826('0xbf')](_0x2ebe18[_0xa826('0xbe')],'minutes');}if(!this['isConfigured'](_0x2ebe18['callback_priority'])){_0x2ebe18[_0xa826('0x4f')]=0x2;}this[_0xa826('0x44')][_0xa826('0x72')](this,_0x2ebe18);return this[_0xa826('0xe')]['noop'](util['format'](_0xa826('0xc0'),_0x2ebe18[_0xa826('0x49')],_0x2ebe18[_0xa826('0x4a')],_0x2ebe18['scheduledAt']));};AGIVertices[_0xa826('0x11')][_0xa826('0xc1')]=function(_0x5d000e){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0xc2'),_0x5d000e[_0xa826('0x3c')]));var _0x220e4c=this[_0xa826('0xe')][_0xa826('0xab')](_0x5d000e[_0xa826('0xc3')],_0x5d000e[_0xa826('0x7a')]);if(_0x220e4c[_0xa826('0xa5')]===-0x1){return _0x220e4c;}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xc4'),_0x5d000e[_0xa826('0xc3')],_0x5d000e['options']));};AGIVertices['prototype'][_0xa826('0xc5')]=function(_0x67f459){logger[_0xa826('0x31')](util['format'](_0xa826('0xc6'),_0x67f459[_0xa826('0x3c')]));if(!this['isConfigured'](_0x67f459[_0xa826('0x5f')])){return this['channel'][_0xa826('0xa9')](_0xa826('0xaa'));}var _0x5df3b8='\x22'+_0x67f459[_0xa826('0x5f')]+'\x22';if(this[_0xa826('0xa6')](_0x67f459[_0xa826('0x7a')])){_0x5df3b8+=','+_0x67f459[_0xa826('0x7a')];}var _0x2ef4f5=this['channel']['exec'](_0xa826('0xac'),_0x5df3b8);if(_0x2ef4f5[_0xa826('0xa5')]===-0x1){return _0x2ef4f5;}return this['channel'][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xc7'),_0x5df3b8));};AGIVertices[_0xa826('0x11')]['sestektts']=function(_0x5dc952){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0xc8'),_0x5dc952[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x5dc952[_0xa826('0x5f')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xaa'));}var _0x51a40b='\x22'+_0x5dc952[_0xa826('0x5f')]+'\x22';if(this[_0xa826('0xa6')](_0x5dc952[_0xa826('0x7a')])){_0x51a40b+=','+_0x5dc952[_0xa826('0x7a')];}var _0xf984be=this[_0xa826('0xe')]['exec'](_0xa826('0xac'),_0x51a40b);if(_0xf984be[_0xa826('0xa5')]===-0x1){return _0xf984be;}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xc7'),_0x51a40b));};AGIVertices['prototype'][_0xa826('0xc9')]=function(_0x446123){logger[_0xa826('0x31')](util[_0xa826('0x58')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x446123['label']));if(!this['isConfigured'](_0x446123[_0xa826('0xae')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xaf'));}var _0x5059eb=_0x446123[_0xa826('0xae')];if(this[_0xa826('0xa6')](_0x446123['options'])){_0x5059eb+=','+_0x446123[_0xa826('0x7a')];}var _0x9c54d4=this[_0xa826('0xe')][_0xa826('0xab')](_0xa826('0xb0'),_0x5059eb);if(_0x9c54d4[_0xa826('0xa5')]===-0x1){return _0x9c54d4;}var _0x1e07ad=this[_0xa826('0xa4')]('RECOG_CONFIDENCE()',_0xa826('0xca'));if(_0x1e07ad['result']===-0x1){return _0x1e07ad;}var _0x6d6fd7=this[_0xa826('0xa4')](_0xa826('0xb3'),_0xa826('0xcb'));if(_0x6d6fd7[_0xa826('0xa5')]===-0x1){return _0x6d6fd7;}var _0x36f2d1=this[_0xa826('0xa4')](_0xa826('0xcc'),_0xa826('0xcd'));if(_0x36f2d1['result']===-0x1){return _0x36f2d1;}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xce'),_0x5059eb));};AGIVertices['prototype']['sestekasr']=function(_0x49c909){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0xcf'),_0x49c909[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x49c909[_0xa826('0xae')])){return this[_0xa826('0xe')][_0xa826('0xa9')]('no\x20grammar\x20configured');}var _0x2fd6cc=_0x49c909['grammar'];if(this[_0xa826('0xa6')](_0x49c909['options'])){_0x2fd6cc+=','+_0x49c909[_0xa826('0x7a')];}var _0x5a18e1=this[_0xa826('0xe')][_0xa826('0xab')]('MRCPRecog',_0x2fd6cc);if(_0x5a18e1[_0xa826('0xa5')]===-0x1){return _0x5a18e1;}var _0x5e548e=this[_0xa826('0xa4')]('RECOG_CONFIDENCE()',_0xa826('0xd0'));if(_0x5e548e[_0xa826('0xa5')]===-0x1){return _0x5e548e;}var _0x41d9a2=this[_0xa826('0xa4')](_0xa826('0xb3'),_0xa826('0xd1'));if(_0x41d9a2['result']===-0x1){return _0x41d9a2;}var _0x3d371e=this['getAndSetVariable']('RECOG_INSTANCE()',_0xa826('0xd2'));if(_0x3d371e['result']===-0x1){return _0x3d371e;}return this['channel']['noop'](util[_0xa826('0x58')](_0xa826('0xce'),_0x2fd6cc));};AGIVertices[_0xa826('0x11')][_0xa826('0xd3')]=function(_0x2a186f){logger['info'](util[_0xa826('0x58')](_0xa826('0xd4'),_0x2a186f['label']));if(!this[_0xa826('0xa6')](_0x2a186f[_0xa826('0xd5')])){return this['channel'][_0xa826('0x2f')](_0x2a186f,_0xa826('0xd6'));}var _0x4746f7=this[_0xa826('0x1a')]['sync'](this,_0x2a186f[_0xa826('0xd5')]);if(!_0x4746f7){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x2a186f,'no\x20odbc\x20database\x20found');}if(!this[_0xa826('0xa6')](_0x2a186f[_0xa826('0x33')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x2a186f,_0xa826('0xd7'));}var _0x4147a1=_0x2a186f[_0xa826('0x33')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xa826('0x58')](_0xa826('0xd8'),_0x4147a1));var _0x47fecf=this[_0xa826('0x2d')][_0xa826('0x72')](this,_0x4746f7,_0x4147a1);this[_0xa826('0x3a')]['sync'](this,_0x2a186f,_0x4147a1);if(!this[_0xa826('0xa6')](_0x2a186f[_0xa826('0xd9')])){return this['channel']['noop'](_0xa826('0xda'));}var _0x45ce85=this['getVariable'][_0xa826('0x72')](this,_0x2a186f[_0xa826('0xd9')]);if(!_0x45ce85){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x2a186f,_0xa826('0xdb'));}var _0x4176d0=this;_0x47fecf[_0xa826('0xdc')](function(_0x518b94,_0x2ebe9c){Object[_0xa826('0xdd')](_0x518b94)[_0xa826('0xdc')](function(_0x2c7f00){_0x4176d0[_0xa826('0xe')][_0xa826('0x9f')](util[_0xa826('0x58')]('%s[%s][%s]',_0x45ce85,_0x2ebe9c,_0x2c7f00),_0x518b94[_0x2c7f00]);});});this[_0xa826('0xe')][_0xa826('0x9f')](util[_0xa826('0x58')](_0xa826('0xde'),_0x45ce85),_0x47fecf['length']);return this['channel'][_0xa826('0xa9')](util[_0xa826('0x58')]('variable\x20%s\x20set',_0x45ce85));};AGIVertices['prototype'][_0xa826('0xdf')]=function(_0x2df8e5){logger[_0xa826('0xe0')](util[_0xa826('0x58')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2df8e5[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x2df8e5[_0xa826('0xe1')])){return this['channel'][_0xa826('0x2f')](_0x2df8e5,_0xa826('0xe2'));}var _0x1c65f3=this['getUser'][_0xa826('0x72')](this,_0x2df8e5[_0xa826('0xe1')]);if(!_0x1c65f3){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x2df8e5,'no\x20user\x20found');}var _0x420f50=this['channel'][_0xa826('0xab')](_0xa826('0xe3'),[util[_0xa826('0x58')](_0xa826('0xe4'),_0x1c65f3),_0x2df8e5[_0xa826('0x68')],_0x2df8e5[_0xa826('0xe5')],_0x2df8e5[_0xa826('0x66')]]);if(_0x420f50[_0xa826('0xa5')]===-0x1){return _0x420f50;}return this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0xe6'),_0xa826('0xe3')));};AGIVertices[_0xa826('0x11')][_0xa826('0xe7')]=function(_0x456b95){logger['info'](util[_0xa826('0x58')](_0xa826('0xe8'),_0x456b95[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x456b95[_0xa826('0x7c')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xe9'));}if(!this[_0xa826('0xa6')](_0x456b95[_0xa826('0x5f')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xaa'));}this['channel'][_0xa826('0xea')]=!![];this['createSquareDetailsReport'](_0x456b95);this[_0xa826('0x43')](_0x456b95[_0xa826('0x5f')],'in','','');this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0xeb'),_0x456b95[_0xa826('0x5f')]));var _0x11f5f2=this[_0xa826('0x7b')][_0xa826('0x72')](this,_0x456b95);if(_0x11f5f2){for(var _0x482c19 in _0x11f5f2){if(_0x11f5f2[_0xa826('0x97')](_0x482c19)){this[_0xa826('0xe')][_0xa826('0x9f')](util[_0xa826('0x58')](_0xa826('0xec'),_0x482c19['toUpperCase']()),_0x11f5f2[_0x482c19]);}}this[_0xa826('0x43')](_0x11f5f2[_0xa826('0xed')],_0xa826('0xee'),'dialogflow','');return this[_0xa826('0xe')][_0xa826('0xa9')](util['format'](_0xa826('0xef'),_0x11f5f2[_0xa826('0xed')]));}return this[_0xa826('0xe')][_0xa826('0x2f')](_0x456b95,_0xa826('0xf0'));};AGIVertices[_0xa826('0x11')][_0xa826('0xf1')]=function(_0x1204e0){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0xf2'),_0x1204e0[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x1204e0[_0xa826('0x7f')])){return this[_0xa826('0xe')][_0xa826('0xa9')]('no\x20project_id\x20configured');}if(!this[_0xa826('0xa6')](_0x1204e0[_0xa826('0x80')])){return this['channel']['noop'](_0xa826('0xf3'));}if(!this[_0xa826('0xa6')](_0x1204e0['private_key'])){return this[_0xa826('0xe')][_0xa826('0xa9')]('no\x20private_key\x20configured');}if(!this[_0xa826('0xa6')](_0x1204e0[_0xa826('0xf4')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xf5'));}if(!this[_0xa826('0xa6')](_0x1204e0['text'])){return this['channel']['noop'](_0xa826('0xaa'));}this[_0xa826('0xe')][_0xa826('0xea')]=!![];this[_0xa826('0x3a')](_0x1204e0);this['createSquareMessage'](_0x1204e0[_0xa826('0x5f')],'in','','');this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0xf6'),_0x1204e0[_0xa826('0x5f')]));var _0x464b01=this[_0xa826('0x7e')][_0xa826('0x72')](this,_0x1204e0);if(_0x464b01){for(var _0x5b9490 in _0x464b01){if(_0x464b01[_0xa826('0x97')](_0x5b9490)){if(_0x5b9490!=='providerResponse'){this[_0xa826('0xe')][_0xa826('0x9f')](util[_0xa826('0x58')](_0xa826('0xec'),_0x5b9490[_0xa826('0x6b')]()),_0x464b01[_0x5b9490]);}}}this[_0xa826('0x43')](_0x464b01[_0xa826('0xed')],_0xa826('0xee'),_0xa826('0xf1'),_0x464b01[_0xa826('0xf7')]);return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xf8'),_0x464b01[_0xa826('0xed')]));}return this[_0xa826('0xe')][_0xa826('0x2f')](_0x1204e0,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xa826('0x11')][_0xa826('0xf9')]=function(_0x392440){logger[_0xa826('0x31')](util['format'](_0xa826('0xfa'),_0x392440['label']));if(!this[_0xa826('0xa6')](_0x392440[_0xa826('0xfb')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xfc'));}if(!this[_0xa826('0xa6')](_0x392440[_0xa826('0xfd')])){return this['channel'][_0xa826('0xa9')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x392440[_0xa826('0xfe')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xff'));}if(!this['isConfigured'](_0x392440['ndassistant_url'])){return this['channel'][_0xa826('0xa9')]('no\x20text\x20configured');}this[_0xa826('0xe')][_0xa826('0xea')]=!![];this['createSquareDetailsReport'](_0x392440);this[_0xa826('0x43')](_0x392440[_0xa826('0x5f')],'in','','');this[_0xa826('0xe')][_0xa826('0xa9')](util['format'](_0xa826('0x100'),_0x392440['text']));var _0x2aeaf3=this[_0xa826('0x81')][_0xa826('0x72')](this,_0x392440);if(_0x2aeaf3){for(var _0x251a07 in _0x2aeaf3){if(_0x2aeaf3[_0xa826('0x97')](_0x251a07)){this[_0xa826('0xe')][_0xa826('0x9f')](util['format']('SESTEK_NDA_%s',_0x251a07[_0xa826('0x6b')]()),_0x2aeaf3[_0x251a07]);}}this[_0xa826('0x43')](_0x2aeaf3[_0xa826('0xed')],_0xa826('0xee'),_0xa826('0xf9'),'');if(_0x2aeaf3[_0xa826('0x101')]){this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0x102'),_0x2aeaf3[_0xa826('0x101')]));var _0xdf828e=this['channel'][_0xa826('0x103')](_0x2aeaf3[_0xa826('0x101')]);try{fs[_0xa826('0x104')](_0x2aeaf3['audiofile']+_0xa826('0x105'));}catch(_0x324991){logger[_0xa826('0x2f')](_0x324991);}return _0xdf828e;}else{return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x106'),_0x2aeaf3['speech']));}}return this[_0xa826('0xe')][_0xa826('0x2f')](_0x392440,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa826('0x11')][_0xa826('0x107')]=function(_0x4cb211){logger['info'](util['format'](_0xa826('0x108'),_0x4cb211[_0xa826('0x3c')]));return this['channel'][_0xa826('0xa9')](_0xa826('0x107'));};AGIVertices['prototype'][_0xa826('0x109')]=function(_0x1f8e11){logger['info'](util[_0xa826('0x58')](_0xa826('0x10a'),_0x1f8e11[_0xa826('0x3c')]));var _0x39edac='';if(_0x1f8e11['trunk_id']){if(!this['isConfigured'](_0x1f8e11['trunk_id'])){return this[_0xa826('0xe')]['error'](_0x1f8e11,'no\x20trunk\x20selected');}else{var _0x3bab3e=parseInt(_0x1f8e11[_0xa826('0x10b')],0xa);if(isNaN(_0x3bab3e)){_0x39edac=_0x1f8e11[_0xa826('0x10b')];}else{_0x39edac=this[_0xa826('0x1f')][_0xa826('0x72')](this,_0x1f8e11[_0xa826('0x10b')]);if(!_0x39edac){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x1f8e11,_0xa826('0x10c'));}}}}else if(_0x1f8e11['trunk_name']){_0x39edac=_0x1f8e11[_0xa826('0x10d')];}else{return this[_0xa826('0xe')]['error'](_0x1f8e11,'no\x20trunk\x20selected');}var _0x1231e5=this['channel'][_0xa826('0xab')]('DIAL',[util[_0xa826('0x58')](_0xa826('0x10e'),_0x39edac,_0x1f8e11['phone']),_0x1f8e11[_0xa826('0x68')],_0x1f8e11[_0xa826('0xe5')],_0x1f8e11[_0xa826('0x66')]]);if(_0x1231e5[_0xa826('0xa5')]===-0x1){return _0x1231e5;}return this['channel'][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xe6'),_0xa826('0xe3')));};AGIVertices[_0xa826('0x11')]['finally']=function(_0x5170f2){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x10f'),_0x5170f2['label']));return this[_0xa826('0xe')]['noop'](_0xa826('0x110'));};AGIVertices[_0xa826('0x11')][_0xa826('0xc')]=function(_0x13edc4){logger[_0xa826('0x31')](util[_0xa826('0x58')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x13edc4[_0xa826('0x3c')]));if(_0x13edc4[_0xa826('0xa8')]===0x0){return this[_0xa826('0xa7')](_0x13edc4);}_0x13edc4['retry']-=0x1;if(!this[_0xa826('0xa6')](_0x13edc4[_0xa826('0x111')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x13edc4,'no\x20file\x20audio\x20selected');}var _0x4a81cc=this['getSound']['sync'](this,_0x13edc4[_0xa826('0x111')]);if(!_0x4a81cc){return this['channel'][_0xa826('0x2f')](_0x13edc4,_0xa826('0x112'));}if(!this[_0xa826('0xa6')](_0x13edc4[_0xa826('0xd9')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0xa826('0xda'));}var _0x328a53=this[_0xa826('0xe')][_0xa826('0x113')](_0x4a81cc,_0x13edc4[_0xa826('0x114')],_0x13edc4[_0xa826('0x115')]);var _0x425efe=_0x328a53['result']?_0x328a53[_0xa826('0xa5')]['toString']():'';logger[_0xa826('0x31')](_0xa826('0x116'),JSON[_0xa826('0x75')](_0x328a53));if(_0x328a53[_0xa826('0xa5')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x13edc4,_0x425efe);return _0x328a53;}else if(_0x328a53['extra']===_0xa826('0x68')){_0x328a53[_0xa826('0xa5')]=_0x425efe[_0xa826('0x9a')]>=parseInt(_0x13edc4[_0xa826('0x117')])?'x':'i';}else{_0x328a53[_0xa826('0xa5')]=_0x425efe[_0xa826('0x9a')]>=parseInt(_0x13edc4[_0xa826('0x117')])&&_0x425efe[_0xa826('0x9a')]<=parseInt(_0x13edc4[_0xa826('0x115')])?'x':'i';}var _0x3d0d8a=this[_0xa826('0x12')]['sync'](this,_0x13edc4[_0xa826('0xd9')]);if(!_0x3d0d8a){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x13edc4,'no\x20variable\x20found');}this['channel'][_0xa826('0x9f')](_0x3d0d8a,_0x425efe);if(this[_0xa826('0xa6')](_0x13edc4[_0xa826('0x118')])){var _0x4b6cc0=parseInt(_0x13edc4[_0xa826('0x118')],0xa);var _0x2937e6=rs[_0xa826('0x119')]({'charset':'*','length':_0x4b6cc0});var _0x29495a=_0x425efe['length'];if(_0x29495a>0x0){if(_0x29495a>_0x4b6cc0){this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x13edc4,_0x13edc4[_0xa826('0x11a')]==='first'?_0x2937e6+_0x425efe[_0xa826('0x11b')](_0x4b6cc0):_0x425efe['substr'](0x0,_0x29495a-_0x4b6cc0)+_0x2937e6);}else{this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x13edc4,rs['generate']({'charset':'*','length':_0x29495a}));}}else{this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x13edc4,'');}}else{this['createSquareDetailsReport'][_0xa826('0x72')](this,_0x13edc4,_0x425efe);}return _0x328a53;};AGIVertices[_0xa826('0x11')]['getsecretdigits']=function(_0x123a99){logger['info'](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x123a99[_0xa826('0x3c')]));return this[_0xa826('0xc')](_0x123a99);};AGIVertices[_0xa826('0x11')][_0xa826('0x11c')]=function(_0xecfc65){logger[_0xa826('0x31')](util['format'](_0xa826('0x11d'),_0xecfc65[_0xa826('0x3c')]));this['createSquareDetailsReport']['sync'](this,_0xecfc65,_0xecfc65[_0xa826('0x11e')]);return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x11f'),_0xecfc65['goalname']));};AGIVertices[_0xa826('0x11')]['awspolly']=function(_0x34ab3f){logger[_0xa826('0x31')](util['format'](_0xa826('0x120'),_0x34ab3f[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x34ab3f[_0xa826('0x89')])||!this['isConfigured'](_0x34ab3f[_0xa826('0x8e')])){return this[_0xa826('0xe')][_0xa826('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xa826('0xa6')](_0x34ab3f[_0xa826('0x5f')])){return this['channel'][_0xa826('0xa9')](_0xa826('0xaa'));}this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x121'),_0x34ab3f[_0xa826('0x5f')]));var _0x29a8f7=this[_0xa826('0x88')][_0xa826('0x72')](this,_0x34ab3f);if(_0x29a8f7){this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0x122'),_0x29a8f7));var _0x2b120d=this[_0xa826('0xe')][_0xa826('0x103')](_0x29a8f7);try{fs[_0xa826('0x104')](_0x29a8f7+_0xa826('0x105'));}catch(_0x5b55e5){logger['error'](_0x5b55e5);}return _0x2b120d;}return this[_0xa826('0xe')][_0xa826('0x2f')](_0x34ab3f,_0xa826('0x123'));};AGIVertices[_0xa826('0x11')][_0xa826('0x124')]=function(_0x2bd101){logger['info'](util[_0xa826('0x58')](_0xa826('0x125'),_0x2bd101[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x2bd101['aws_access_key_id'])||!this[_0xa826('0xa6')](_0x2bd101[_0xa826('0x8e')])){return this['channel'][_0xa826('0xa9')](_0xa826('0x126'));}if(!this[_0xa826('0xa6')](_0x2bd101['aws_bot_name'])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x2bd101[_0xa826('0x5f')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xaa'));}this[_0xa826('0xe')]['bot']=!![];this[_0xa826('0x3a')](_0x2bd101);this[_0xa826('0x43')](_0x2bd101['text'],'in','','');this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x127'),_0x2bd101['text']));var _0x2b0f4b=this[_0xa826('0x8d')][_0xa826('0x72')](this,_0x2bd101);if(_0x2b0f4b){for(var _0x49d177 in _0x2b0f4b){if(_0x2b0f4b['hasOwnProperty'](_0x49d177)&&_[_0xa826('0x96')](_0x2b0f4b[_0x49d177])){this[_0xa826('0xe')][_0xa826('0x9f')](util[_0xa826('0x58')](_0xa826('0x128'),_0x49d177['toUpperCase']()),_0x2b0f4b[_0x49d177]);}}if(_['isNil'](_0x2b0f4b[_0xa826('0x78')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0x129'));}else{this[_0xa826('0x43')](_0x2b0f4b[_0xa826('0x78')],'out',_0xa826('0x12a'),'');return this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0x12b'),_0x2b0f4b[_0xa826('0x78')]));}}return this[_0xa826('0xe')]['error'](_0x2bd101,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0xa826('0x12c')]=function(_0xfbd179){logger['info'](util[_0xa826('0x58')](_0xa826('0x12d'),_0xfbd179[_0xa826('0x3c')],_0xfbd179[_0xa826('0x68')]));if(!this[_0xa826('0xa6')](_0xfbd179[_0xa826('0x7c')])){return this[_0xa826('0xe')][_0xa826('0xa9')]('no\x20key\x20configured');}var _0x594798='wav';var _0x441d75=util[_0xa826('0x58')]('%s/recordings/%s',FILES_PATH,rs[_0xa826('0x119')](0x4));var _0x7bf01d=util[_0xa826('0x58')](_0xa826('0x9d'),_0x441d75,_0x594798);var _0x48c51d=!![];if(_0xfbd179[_0xa826('0x12e')]===_0xa826('0x12f')){_0x48c51d=![];}var _0x34b9c6=this[_0xa826('0xe')]['recordFile'](_0x441d75,_0x594798,_0xfbd179[_0xa826('0x130')],_0xfbd179[_0xa826('0x68')],undefined,_0x48c51d);if(_0x34b9c6[_0xa826('0xa5')]!==-0x1){this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x131'),_0x7bf01d));var _0x43a2bd=this[_0xa826('0x91')][_0xa826('0x72')](this,_0xfbd179,_0x7bf01d);if(_0x43a2bd){for(var _0x52ef21 in _0x43a2bd){if(_0x43a2bd['hasOwnProperty'](_0x52ef21)){this['channel'][_0xa826('0x9f')](util[_0xa826('0x58')]('GOOGLE_ASR_%s',_0x52ef21[_0xa826('0x6b')]()),_0x43a2bd[_0x52ef21]);}}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x132'),JSON[_0xa826('0x75')](_0x43a2bd)));}}return _0x34b9c6;};AGIVertices[_0xa826('0x11')][_0xa826('0x133')]=function(_0x4e297d){logger['info'](util[_0xa826('0x58')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4e297d['label']));if(!this[_0xa826('0xa6')](_0x4e297d[_0xa826('0x134')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0x135'));}if(!this['isConfigured'](_0x4e297d[_0xa826('0x93')])){return this[_0xa826('0xe')]['noop'](_0xa826('0x136'));}var _0x39a1e3='wav';var _0x4306c9=util[_0xa826('0x58')](_0xa826('0x137'),FILES_PATH,rs['generate'](0x4));var _0x5bea8e=util[_0xa826('0x58')](_0xa826('0x9d'),_0x4306c9,_0x39a1e3);var _0x37ef64=!![];if(_0x4e297d['beep']===_0xa826('0x12f')){_0x37ef64=![];}var _0x34a64c=this[_0xa826('0xe')][_0xa826('0x138')](_0x4306c9,_0x39a1e3,_0x4e297d[_0xa826('0x130')],_0x4e297d['timeout'],undefined,_0x37ef64);if(_0x34a64c[_0xa826('0xa5')]!==-0x1){this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x139'),_0x5bea8e));var _0x4908ef=this[_0xa826('0x92')][_0xa826('0x72')](this,_0x4e297d,_0x5bea8e);if(_0x4908ef){for(var _0x12d514 in _0x4908ef){if(_0x4908ef['hasOwnProperty'](_0x12d514)){this[_0xa826('0xe')]['setVariable'](util[_0xa826('0x58')](_0xa826('0x13a'),_0x12d514[_0xa826('0x6b')]()),_0x4908ef[_0x12d514]);}}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')]('TildeASR\x20Result\x20%s',JSON[_0xa826('0x75')](_0x4908ef)));}}return _0x34a64c;};AGIVertices['prototype'][_0xa826('0x13b')]=function(_0x2120c9){logger['info'](util[_0xa826('0x58')](_0xa826('0x13c'),_0x2120c9[_0xa826('0x3c')]));return this[_0xa826('0xe')][_0xa826('0x13d')](_0x2120c9[_0xa826('0x13e')],_0x2120c9[_0xa826('0x13f')],_0x2120c9[_0xa826('0x140')]);};AGIVertices[_0xa826('0x11')][_0xa826('0x141')]=function(_0x5fe7b6){logger['info'](util[_0xa826('0x58')](_0xa826('0x142'),_0x5fe7b6['label']));if(!this[_0xa826('0xa6')](_0x5fe7b6[_0xa826('0x143')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x5fe7b6,_0xa826('0x144'));}try{var _0x47585b=eval(_0x5fe7b6['condition'])?_0xa826('0x145'):_0xa826('0x146');this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')]('EVAL\x20CONDITION\x20%s\x20%s',_0x5fe7b6[_0xa826('0x143')],_0x47585b));return{'code':0xc8,'result':_0x47585b};}catch(_0x16990b){return{'code':0xc8,'result':_0xa826('0x146')};}};AGIVertices[_0xa826('0x11')][_0xa826('0x147')]=function(_0x74c509){logger['info'](util[_0xa826('0x58')](_0xa826('0x148'),_0x74c509['label']));if(!this[_0xa826('0xa6')](_0x74c509['interval_id'])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x74c509,_0xa826('0x149'));}var _0x556d89=this['getIntervals'][_0xa826('0x72')](this,_0x74c509[_0xa826('0x14a')]);if(!_0x556d89){return this[_0xa826('0xe')]['error'](_0x74c509,_0xa826('0x14b'));}for(var _0x5ac0fc=0x0;_0x5ac0fc<_0x556d89['length'];_0x5ac0fc+=0x1){var _0x20e2a5=this[_0xa826('0xe')][_0xa826('0x12')](util[_0xa826('0x58')](_0xa826('0x14c'),_0x556d89[_0x5ac0fc]));if(_0x20e2a5['result']===-0x1){return _0x20e2a5;}logger[_0xa826('0x31')](util[_0xa826('0x58')]('IFTIME\x20%s\x20%s',_0x556d89[_0x5ac0fc],_0x20e2a5[_0xa826('0xa3')]));if(_0x20e2a5[_0xa826('0xa3')]===_0xa826('0x145')){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x14d'),_0x556d89[_0x5ac0fc],_0xa826('0x145')));this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0x14d'),_0x556d89[_0x5ac0fc],_0xa826('0x145')));return{'code':0xc8,'result':'true'};}else{logger[_0xa826('0x31')](util['format']('IFTIME\x20%s\x20%s',_0x556d89[_0x5ac0fc],_0xa826('0x146')));this[_0xa826('0xe')][_0xa826('0xa9')](util['format'](_0xa826('0x14d'),_0x556d89[_0x5ac0fc],'false'));}}return{'code':0xc8,'result':_0xa826('0x146')};};AGIVertices[_0xa826('0x11')][_0xa826('0x14e')]=function(_0x21910b){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x14f'),_0x21910b['label']));return this[_0xa826('0xe')]['hangup']();};AGIVertices['prototype'][_0xa826('0x150')]=function(_0x3df346){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x151'),_0x3df346[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x3df346[_0xa826('0x7c')])){return this[_0xa826('0xe')]['noop'](_0xa826('0xe9'));}var _0x31a6af=_0xa826('0x152');var _0x36954e=util[_0xa826('0x58')](_0xa826('0x137'),FILES_PATH,rs[_0xa826('0x119')](0x4));var _0x3d6150=util['format'](_0xa826('0x9d'),_0x36954e,_0x31a6af);var _0x4db008=!![];if(_0x3df346[_0xa826('0x12e')]==='NOBEEP'){_0x4db008=![];}var _0x43e652=this[_0xa826('0xe')][_0xa826('0x138')](_0x36954e,_0x31a6af,_0x3df346[_0xa826('0x130')],_0x3df346[_0xa826('0x68')],undefined,_0x4db008);if(_0x43e652[_0xa826('0xa5')]!==-0x1){this[_0xa826('0xe')]['noop'](util['format'](_0xa826('0x153'),_0x3d6150));var _0x4bd7f7=this['ispeechASR'][_0xa826('0x72')](this,_0x3df346,_0x3d6150);if(_0x4bd7f7){for(var _0x15f7ed in _0x4bd7f7){if(_0x4bd7f7[_0xa826('0x97')](_0x15f7ed)){this['channel'][_0xa826('0x9f')](util[_0xa826('0x58')](_0xa826('0x154'),_0x15f7ed[_0xa826('0x6b')]()),_0x4bd7f7[_0x15f7ed]);}}return this[_0xa826('0xe')][_0xa826('0xa9')](util['format'](_0xa826('0x155'),JSON['stringify'](_0x4bd7f7)));}}return _0x43e652;};AGIVertices[_0xa826('0x11')][_0xa826('0x156')]=function(_0x551957){logger['info'](util[_0xa826('0x58')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x551957[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x551957['key'])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xe9'));}if(!this[_0xa826('0xa6')](_0x551957['text'])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xaa'));}this[_0xa826('0xe')][_0xa826('0xa9')](util['format'](_0xa826('0x157'),_0x551957[_0xa826('0x5f')]));var _0x17aae4=this[_0xa826('0x82')]['sync'](this,_0x551957);if(_0x17aae4){this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0x153'),_0x17aae4));var _0x480ec5=this['channel'][_0xa826('0x103')](_0x17aae4,_0x551957[_0xa826('0x130')]);try{fs[_0xa826('0x104')](_0x17aae4+_0xa826('0x105'));}catch(_0x3c3671){logger[_0xa826('0x2f')](_0x3c3671);}return _0x480ec5;}return this['channel']['error'](_0x551957,_0xa826('0x158'));};AGIVertices[_0xa826('0x11')]['login']=function(_0x36b1e0){logger[_0xa826('0x31')](util[_0xa826('0x58')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x36b1e0[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x36b1e0['findBy'])){return this[_0xa826('0xe')]['error'](_0x36b1e0,_0xa826('0x159'));}logger['info'](util[_0xa826('0x58')](_0xa826('0x15a'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x36b1e0[_0xa826('0x15b')]));var _0x3c76b=this[_0xa826('0x56')][_0xa826('0x72')](this,_0x36b1e0[_0xa826('0x15b')]);if(_0x3c76b){logger[_0xa826('0x31')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa826('0xe')][_0xa826('0x3f')],_0x36b1e0[_0xa826('0x15b')]));this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x15c'),this['channel'][_0xa826('0x3f')],_0x36b1e0[_0xa826('0x15b')]));return{'code':0xc8,'result':_0xa826('0x15d')};}else{logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x15e'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x36b1e0[_0xa826('0x15b')]));this[_0xa826('0xe')][_0xa826('0xa9')](util['format'](_0xa826('0x15e'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x36b1e0[_0xa826('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa826('0x11')][_0xa826('0x15f')]=function(_0xf33143){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x160'),_0xf33143['label']));if(!this['isConfigured'](_0xf33143[_0xa826('0x15b')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0xf33143,_0xa826('0x159'));}logger['info'](util[_0xa826('0x58')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa826('0xe')][_0xa826('0x3f')],_0xf33143[_0xa826('0x15b')]));var _0x51701c=this[_0xa826('0x55')]['sync'](this,_0xf33143[_0xa826('0x15b')]);if(_0x51701c){logger[_0xa826('0x31')](util['format'](_0xa826('0x15c'),this[_0xa826('0xe')][_0xa826('0x3f')],_0xf33143[_0xa826('0x15b')]));this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0x15c'),this['channel'][_0xa826('0x3f')],_0xf33143['findBy']));return{'code':0xc8,'result':_0xa826('0x15d')};}else{logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x15e'),this['channel']['callerid'],_0xf33143[_0xa826('0x15b')]));this[_0xa826('0xe')][_0xa826('0xa9')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa826('0xe')][_0xa826('0x3f')],_0xf33143[_0xa826('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa826('0x11')][_0xa826('0x161')]=function(_0x32e087){logger[_0xa826('0x31')](util[_0xa826('0x58')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x32e087['label']));if(!this['isConfigured'](_0x32e087[_0xa826('0x162')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x32e087,'no\x20operation\x20configured');}this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')](_0xa826('0x163'),_0x32e087[_0xa826('0x162')]));var _0x1304ce=eval(_0x32e087[_0xa826('0x162')]);if(!this[_0xa826('0xa6')](_0x32e087['variable_id'])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xda'));}var _0xfa089=this['getVariable'][_0xa826('0x72')](this,_0x32e087['variable_id']);if(!_0xfa089){return this[_0xa826('0xe')]['error'](_0x32e087,'no\x20variable\x20found');}if(_[_0xa826('0x9e')](_0x1304ce)){var _0x24e446=this;_0x1304ce[_0xa826('0xdc')](function(_0x52a51e,_0x38def1){_0x24e446[_0xa826('0xe')][_0xa826('0x9f')](util[_0xa826('0x58')]('%s[%s]',_0xfa089,_0x38def1),_0x52a51e);});return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x164'),_0xfa089));}else{return this[_0xa826('0xe')][_0xa826('0x9f')](_0xfa089,_0x1304ce);}};AGIVertices[_0xa826('0x11')]['menu']=function(_0x284e70){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x165'),_0x284e70[_0xa826('0x3c')]));if(_0x284e70['retry']===0x0){return this['maxRetry'](_0x284e70);}_0x284e70[_0xa826('0xa8')]-=0x1;if(!this[_0xa826('0xa6')](_0x284e70['file_id'])){return this['channel'][_0xa826('0x2f')](_0x284e70,_0xa826('0x166'));}var _0x312607=this[_0xa826('0x20')][_0xa826('0x72')](this,_0x284e70[_0xa826('0x111')]);if(!_0x312607){return this['channel']['error'](_0x284e70,'no\x20file\x20audio\x20found');}var _0x5404c8=this[_0xa826('0xe')][_0xa826('0x113')](_0x312607,_0x284e70[_0xa826('0x114')],_0x284e70[_0xa826('0x167')]);var _0x13b1de=_0x5404c8['result'];if(_0x5404c8[_0xa826('0xa5')]===-0x1){this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x284e70,'-1');return _0x5404c8;}else if(_0x5404c8['extra']==='timeout'){_0x5404c8['result']=_0x5404c8[_0xa826('0xa5')][_0xa826('0x9a')]>0x0?_0x5404c8['result']:'t';}else if(_[_0xa826('0x9b')](_0x5404c8[_0xa826('0xa5')])){_0x5404c8[_0xa826('0xa5')]='#';_0x13b1de='#';}if(!this[_0xa826('0xa6')](_0x284e70[_0xa826('0xd9')])){this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0xda'));}else{var _0x1cb9ca=this[_0xa826('0x12')][_0xa826('0x72')](this,_0x284e70[_0xa826('0xd9')]);if(!_0x1cb9ca){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x284e70,_0xa826('0xdb'));}this[_0xa826('0xe')][_0xa826('0x9f')](_0x1cb9ca,_0x13b1de);}this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x284e70,_0x13b1de);return _0x5404c8;};AGIVertices['prototype'][_0xa826('0xa9')]=function(_0x1d199b){logger['info'](util[_0xa826('0x58')](_0xa826('0x168'),_0x1d199b['label']));return this[_0xa826('0xe')][_0xa826('0xa9')](_0x1d199b['output']||_0x1d199b[_0xa826('0x3c')]);};AGIVertices['prototype']['pause']=function(_0x3dce20){logger[_0xa826('0x31')](util['format'](_0xa826('0x169'),_0x3dce20[_0xa826('0x3c')]));if(!this['isConfigured'](_0x3dce20[_0xa826('0x15b')])){return this['channel'][_0xa826('0x2f')](_0x3dce20,'no\x20find\x20by\x20configured');}logger[_0xa826('0x31')](util['format'](_0xa826('0x15a'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x3dce20['findBy']));var _0x2bbc47=this[_0xa826('0x50')][_0xa826('0x72')](this,_0x3dce20[_0xa826('0x16a')]);var _0x213d56=this['agentPause'][_0xa826('0x72')](this,_0x3dce20[_0xa826('0x15b')],_0x2bbc47);if(_0x213d56){logger[_0xa826('0x31')](util[_0xa826('0x58')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa826('0xe')]['callerid'],_0x3dce20[_0xa826('0x15b')]));this[_0xa826('0xe')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa826('0xe')][_0xa826('0x3f')],_0x3dce20[_0xa826('0x15b')]));return{'code':0xc8,'result':_0xa826('0x15d')};}else{logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x15e'),this[_0xa826('0xe')]['callerid'],_0x3dce20[_0xa826('0x15b')]));this['channel'][_0xa826('0xa9')](util['format'](_0xa826('0x15c'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x3dce20[_0xa826('0x15b')]));return{'code':0xc8,'result':_0xa826('0x16b')};}};AGIVertices['prototype'][_0xa826('0x16c')]=function(_0x3b4f65){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x16d'),_0x3b4f65[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x3b4f65[_0xa826('0x111')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x3b4f65,_0xa826('0x166'));}var _0x263bf3=this[_0xa826('0x20')][_0xa826('0x72')](this,_0x3b4f65[_0xa826('0x111')]);if(!_0x263bf3){return this['channel'][_0xa826('0x2f')](_0x3b4f65,_0xa826('0x112'));}var _0x5948e8=this[_0xa826('0xe')]['exec'](_0xa826('0x16e'),[_0x263bf3,_0x3b4f65[_0xa826('0xe5')]]);if(_0x5948e8[_0xa826('0xa5')]===-0x1){return _0x5948e8;}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')]('Executed\x20command\x20%s\x20%s',_0xa826('0x16e'),_0x263bf3));};AGIVertices[_0xa826('0x11')]['queue']=function(_0x4d1f7){logger[_0xa826('0x31')](util[_0xa826('0x58')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4d1f7[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x4d1f7[_0xa826('0x16f')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x4d1f7,'no\x20queue\x20selected');}var _0x5536d6='';var _0x214547=parseInt(_0x4d1f7['queue_id'],0xa);if(isNaN(_0x214547)){_0x5536d6=_0x4d1f7[_0xa826('0x16f')];}else{_0x5536d6=this[_0xa826('0x170')][_0xa826('0x72')](this,_0x4d1f7[_0xa826('0x16f')]);if(!_0x5536d6){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x4d1f7,'no\x20queue\x20found');}}var _0xd72688='';if(this[_0xa826('0xa6')](_0x4d1f7[_0xa826('0x111')])){var _0x15dda9=this[_0xa826('0x20')][_0xa826('0x72')](this,_0x4d1f7['file_id']);if(_0x15dda9){_0xd72688=_0x15dda9;}}this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x4d1f7,_0x5536d6);if(_0x4d1f7['opts'][_0xa826('0x171')]('x')<0x0){_0x4d1f7[_0xa826('0xe5')]+='x';}if(_0x4d1f7[_0xa826('0xe5')]['indexOf']('X')<0x0){_0x4d1f7['opts']+='X';}this[_0xa826('0xe')]['setVariable'](_0xa826('0x172'),_0x5536d6?_0x5536d6[_0xa826('0x173')]():'');var _0x2b49f2=this[_0xa826('0xe')][_0xa826('0xab')]('QUEUE',[_0x5536d6,_0x4d1f7['opts'],_0x4d1f7[_0xa826('0x66')],_0xd72688,_0x4d1f7[_0xa826('0x68')],_0x4d1f7[_0xa826('0x174')],_0x4d1f7[_0xa826('0x175')],_0x4d1f7['gosub'],'',_0x4d1f7[_0xa826('0x176')]]);if(_0x2b49f2['result']===-0x1){return _0x2b49f2;}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xc4'),_0xa826('0x177'),_0x5536d6));};AGIVertices[_0xa826('0x11')][_0xa826('0x178')]=function(_0x4116df){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x179'),_0x4116df['label']));var _0x331e4d=_0x4116df[_0xa826('0x17a')]||_0xa826('0x152');var _0x1284a7=util[_0xa826('0x58')]('%s_%s',this[_0xa826('0xe')][_0xa826('0x3b')],rs[_0xa826('0x119')](0x5));var _0xced34b=util[_0xa826('0x58')](_0xa826('0x17b'),FILES_PATH,_0x1284a7,_0x331e4d);var _0x17348c=util[_0xa826('0x58')]('%s/recordings/%s',FILES_PATH,_0x1284a7);this[_0xa826('0x17c')][_0xa826('0x72')](this,_0x4116df,_0x1284a7,_0xced34b);this[_0xa826('0xe')][_0xa826('0x9f')](_0xa826('0x17d'),_0x1284a7);logger[_0xa826('0x31')](_0xa826('0x17e'),_0x17348c,_0x331e4d,_0x4116df[_0xa826('0x17f')],_0x4116df[_0xa826('0x68')]);return this['channel']['recordFile'](_0x17348c,_0x331e4d,_0x4116df[_0xa826('0x17f')],_0x4116df[_0xa826('0x68')],undefined,!![]);};AGIVertices['prototype'][_0xa826('0x180')]=function(_0xf2ab69){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x181'),_0xf2ab69['label']));if(!this[_0xa826('0xa6')](_0xf2ab69['url'])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0x182'));}var _0x275f19=this[_0xa826('0x65')][_0xa826('0x72')](this,_0xf2ab69);logger['info'](util[_0xa826('0x58')](_0xa826('0x183'),util[_0xa826('0x184')](_0x275f19,{'showHidden':![],'depth':null})));if(!this[_0xa826('0xa6')](_0xf2ab69['variable_id'])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0x185'));}var _0x38f0af=this['getVariable'][_0xa826('0x72')](this,_0xf2ab69[_0xa826('0xd9')]);if(!_0x38f0af){return this[_0xa826('0xe')]['error'](_0xf2ab69,_0xa826('0xdb'));}this[_0xa826('0xe')]['setVariable'](util[_0xa826('0x58')]('%s_STATUS_CODE',_0x38f0af),_0x275f19[_0xa826('0x76')]?_0x275f19[_0xa826('0x76')]:_0xa826('0x186'));this[_0xa826('0xe')][_0xa826('0x9f')](util[_0xa826('0x58')](_0xa826('0x187'),_0x38f0af),_0x275f19['statusMessage']?_0x275f19[_0xa826('0x77')]:'OK');if(_0x275f19[_0xa826('0x6c')]){try{this[_0xa826('0x9c')](_0x275f19['body'],_0x38f0af);}catch(_0x3791cf){logger[_0xa826('0x2f')](util[_0xa826('0x58')](_0xa826('0x188'),_0x38f0af));}}return this['channel'][_0xa826('0xa9')](util['format'](_0xa826('0x189'),_0x38f0af));};AGIVertices['prototype'][_0xa826('0x18a')]=function(_0x326d8e){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x18b'),_0x326d8e['label']));return this[_0xa826('0xe')][_0xa826('0x18c')](_0x326d8e[_0xa826('0x18d')][_0xa826('0x18e')](/\s+/g,''),_0x326d8e[_0xa826('0x17f')]);};AGIVertices[_0xa826('0x11')][_0xa826('0x18f')]=function(_0x2143e7){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x190'),_0x2143e7['label']));return this['channel'][_0xa826('0x191')](_0x2143e7[_0xa826('0x69')][_0xa826('0x18e')](/\s+/g,''),_0x2143e7[_0xa826('0x17f')]);};AGIVertices['prototype'][_0xa826('0x192')]=function(_0x2f7dcb){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x193'),_0x2f7dcb[_0xa826('0x3c')]));return this[_0xa826('0xe')][_0xa826('0x194')](_0x2f7dcb[_0xa826('0x5f')],_0x2f7dcb[_0xa826('0x17f')]);};AGIVertices[_0xa826('0x11')]['sendMail']=function(_0x26f895){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x195'),_0x26f895['label']));if(!this['isConfigured'](_0x26f895[_0xa826('0x196')])){return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0x197'));}var _0x5745d0=this[_0xa826('0x198')][_0xa826('0x72')](this,_0x26f895['account_id']);if(!_0x5745d0||!_0x5745d0[_0xa826('0x199')]){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x26f895,'no\x20mail\x20account\x20found');}var _0x3b9e2b={'from':util[_0xa826('0x58')](_0xa826('0x19a'),_0x5745d0['name'],_0x5745d0[_0xa826('0x19b')]||_0x5745d0[_0xa826('0x199')]['user']),'to':_0x26f895['to']||'','cc':_0x26f895['cc']||'','bcc':_0x26f895[_0xa826('0x19c')]||'','subject':_0x26f895['subject'],'html':_0x26f895[_0xa826('0x5f')],'text':_0x26f895[_0xa826('0x5f')]};if(this[_0xa826('0xa6')](_0x26f895[_0xa826('0x19d')])){}logger[_0xa826('0xe0')](_0xa826('0x19e'),JSON[_0xa826('0x75')](_0x3b9e2b));this['createSquareDetailsReport']['sync'](this,_0x26f895,_0x26f895[_0xa826('0x196')]);this[_0xa826('0xe')][_0xa826('0xa9')](util['format'](_0xa826('0x19f'),_0x5745d0[_0xa826('0x15')]));this['sendMailMessage']['sync'](this,_0x5745d0[_0xa826('0x1a0')],_0x3b9e2b);return this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0x1a1'));};AGIVertices[_0xa826('0x11')]['sendFax']=function(_0x10395){logger['info'](util['format'](_0xa826('0x1a2'),_0x10395[_0xa826('0x3c')]));return this[_0xa826('0xe')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x3d642b){logger['info'](util[_0xa826('0x58')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3d642b[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x3d642b[_0xa826('0x1a3')])){return this[_0xa826('0xe')]['noop'](_0xa826('0x1a4'));}var _0x2482fd=this['getSmsAccount'][_0xa826('0x72')](this,_0x3d642b[_0xa826('0x1a3')]);if(!_0x2482fd){return this[_0xa826('0xe')]['error'](_0x3d642b,_0xa826('0x1a5'));}var _0x4c7b74={'body':_0x3d642b[_0xa826('0x1a6')],'phone':_0x3d642b['to']||'','SmsAccountId':_0x2482fd['id']};logger[_0xa826('0xe0')](_0xa826('0x1a7'),JSON[_0xa826('0x75')](_0x4c7b74));this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x3d642b,_0x3d642b['sms_account_id']);this['channel']['noop'](util[_0xa826('0x58')](_0xa826('0x1a8'),_0x2482fd[_0xa826('0x15')]));this[_0xa826('0x39')][_0xa826('0x72')](this,_0x4c7b74);return this[_0xa826('0xe')][_0xa826('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa826('0x11')][_0xa826('0x1a9')]=function(_0x31b354){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x1aa'),_0x31b354['label']));if(!this[_0xa826('0xa6')](_0x31b354[_0xa826('0xd9')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x31b354,'no\x20variable\x20selected');}var _0x24765e=this[_0xa826('0x12')][_0xa826('0x72')](this,_0x31b354['variable_id']);if(!_0x24765e){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x31b354,_0xa826('0xdb'));}return this[_0xa826('0xe')][_0xa826('0x9f')](_0x24765e,_0x31b354[_0xa826('0x1ab')]);};AGIVertices[_0xa826('0x11')][_0xa826('0x1ac')]=function(_0x1d20d1){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x1ad'),_0x1d20d1[_0xa826('0x3c')]));this['channel'][_0xa826('0xa9')](_0xa826('0x1ae'));var _0xc9b5e6=this['channel'][_0xa826('0x12')]('XMCS-UNIQUEID');if(!_[_0xa826('0x9b')](_0xc9b5e6['extra'])){this[_0xa826('0xe')][_0xa826('0x3b')]=_0xc9b5e6['extra'];}if(_0x1d20d1['answer']===_0xa826('0x1af')){this[_0xa826('0xe')][_0xa826('0xa9')](_0xa826('0x1b0'));return this[_0xa826('0xe')]['answer']();}return this['channel'][_0xa826('0xa9')](_0xa826('0x1b1'));};AGIVertices['prototype'][_0xa826('0x1b2')]=function(_0x380029){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x1b3'),_0x380029[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x380029['project_id'])){return this['channel'][_0xa826('0x2f')](_0x380029,_0xa826('0x1b4'));}var _0x5532ec=this['getSquareProject'][_0xa826('0x72')](this,_0x380029[_0xa826('0x1b5')]);if(!this[_0xa826('0xa6')](_0x5532ec)){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x380029,util[_0xa826('0x58')](_0xa826('0x1b6'),_0x380029[_0xa826('0x1b5')]));}if(_0x5532ec===this['channel'][_0xa826('0x3e')]){return this['channel'][_0xa826('0x2f')](_0x380029,_0xa826('0x1b7'));}this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x380029,_0x5532ec);var _0x5325d0=this['channel']['exec'](_0xa826('0x1b8'),util[_0xa826('0x58')](_0xa826('0x1b9'),config[_0xa826('0x174')]['host']||'127.0.0.1',_0x5532ec,this[_0xa826('0xe')][_0xa826('0x3e')]));if(_0x5325d0['result']===-0x1){return _0x5325d0;}return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xc4'),_0xa826('0x1b8'),_0x5532ec));};AGIVertices[_0xa826('0x11')]['system']=function(_0x4b80a3){logger[_0xa826('0x31')](util[_0xa826('0x58')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4b80a3[_0xa826('0x3c')]));var _0x22e619=this[_0xa826('0x5b')][_0xa826('0x72')](this,_0x4b80a3[_0xa826('0xb7')]);this[_0xa826('0x3a')][_0xa826('0x72')](this,_0x4b80a3,_0x4b80a3['command']);if(this['isConfigured'](_0x4b80a3[_0xa826('0xd9')])){var _0x865f2c=this['getVariable'][_0xa826('0x72')](this,_0x4b80a3['variable_id']);if(_0x865f2c){this[_0xa826('0xe')]['setVariable'](_0x865f2c,_0x22e619);return this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x1ba'),_0x4b80a3[_0xa826('0xb7')],_0x865f2c));}}return this[_0xa826('0xe')]['noop'](util[_0xa826('0x58')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4b80a3['command']));};AGIVertices['prototype'][_0xa826('0x1bb')]=function(_0x267048){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x1bc'),_0x267048[_0xa826('0x3c')]));_0x267048[_0xa826('0x5f')]=_0x267048[_0xa826('0x5f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa826('0xa6')](_0x267048[_0xa826('0x5d')])){return this[_0xa826('0xe')]['noop'](_0xa826('0x1bd'));}if(!this[_0xa826('0xa6')](_0x267048[_0xa826('0x5f')])){return this[_0xa826('0xe')][_0xa826('0xa9')]('no\x20text\x20configured');}this['channel'][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x1be'),_0x267048[_0xa826('0x5f')]));var _0x51c04e=this[_0xa826('0x5c')]['sync'](this,_0x267048);if(_0x51c04e){this['channel'][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x1bf'),_0x51c04e));var _0x1e7085=this[_0xa826('0xe')]['streamFile'](_0x51c04e);try{fs[_0xa826('0x104')](_0x51c04e+_0xa826('0x105'));}catch(_0x3b9f9c){logger[_0xa826('0x2f')](_0x3b9f9c);}return _0x1e7085;}return this[_0xa826('0xe')][_0xa826('0x2f')](_0x267048,_0xa826('0x1c0'));};AGIVertices[_0xa826('0x11')][_0xa826('0x1c1')]=function(_0x2b0d2d){logger[_0xa826('0x31')](util[_0xa826('0x58')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2b0d2d[_0xa826('0x3c')]));_0x2b0d2d['text']=_0x2b0d2d[_0xa826('0x5f')][_0xa826('0x18e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa826('0xa6')](_0x2b0d2d[_0xa826('0x5f')])){return this['channel'][_0xa826('0xa9')]('no\x20text\x20configured');}this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x1c2'),_0x2b0d2d[_0xa826('0x5f')]));var _0x119ed5=this['googleTTS'][_0xa826('0x72')](this,_0x2b0d2d);if(_0x119ed5){this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x1c3'),_0x119ed5));var _0x1466ba=this['channel'][_0xa826('0x103')](_0x119ed5);try{fs[_0xa826('0x104')](_0x119ed5+_0xa826('0x105'));}catch(_0x3d1d93){logger[_0xa826('0x2f')](_0x3d1d93);}return _0x1466ba;}return this['channel'][_0xa826('0x2f')](_0x2b0d2d,_0xa826('0x1c4'));};AGIVertices[_0xa826('0x11')][_0xa826('0x1c5')]=function(_0x22578a){logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x1c6'),_0x22578a[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x22578a[_0xa826('0x15b')])){return this[_0xa826('0xe')]['error'](_0x22578a,_0xa826('0x159'));}logger[_0xa826('0x31')](util[_0xa826('0x58')](_0xa826('0x15a'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x22578a[_0xa826('0x15b')]));var _0x134733=this['agentUnpause'][_0xa826('0x72')](this,_0x22578a[_0xa826('0x15b')]);if(_0x134733){logger['info'](util[_0xa826('0x58')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x22578a[_0xa826('0x15b')]));this[_0xa826('0xe')][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0x15c'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x22578a[_0xa826('0x15b')]));return{'code':0xc8,'result':_0xa826('0x15d')};}else{logger[_0xa826('0x31')](util[_0xa826('0x58')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa826('0xe')][_0xa826('0x3f')],_0x22578a[_0xa826('0x15b')]));this['channel']['noop'](util[_0xa826('0x58')](_0xa826('0x15e'),this[_0xa826('0xe')][_0xa826('0x3f')],_0x22578a[_0xa826('0x15b')]));return{'code':0xc8,'result':_0xa826('0x16b')};}};AGIVertices[_0xa826('0x11')]['voicemail']=function(_0x3eaed5){logger['info'](util[_0xa826('0x58')](_0xa826('0x1c7'),_0x3eaed5[_0xa826('0x3c')]));var _0x546d55=this[_0xa826('0xe')]['exec'](_0xa826('0x1c8'),[_0x3eaed5[_0xa826('0x1c9')],_0x3eaed5[_0xa826('0x7a')]]);if(_0x546d55[_0xa826('0xa5')]===-0x1){return _0x546d55;}return this['channel'][_0xa826('0xa9')](util[_0xa826('0x58')](_0xa826('0xc4'),'VOICEMAIL',_0x3eaed5['mailbox']));};AGIVertices[_0xa826('0x11')][_0xa826('0x1ca')]=function(_0x591590){logger[_0xa826('0x31')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x591590[_0xa826('0x3c')]));if(!this[_0xa826('0xa6')](_0x591590[_0xa826('0xd9')])){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x591590,'no\x20variable\x20selected');}var _0x4e3320=this[_0xa826('0x12')]['sync'](this,_0x591590[_0xa826('0xd9')]);if(!_0x4e3320){return this[_0xa826('0xe')][_0xa826('0x2f')](_0x591590,_0xa826('0xdb'));}var _0x260d2b=this['channel']['getVariable'](_0x4e3320);return{'code':0xc8,'result':_0x260d2b[_0xa826('0xa3')]?_0x260d2b[_0xa826('0xa3')]:'-'};};String[_0xa826('0x11')][_0xa826('0xa2')]=function(_0x196eac,_0x456b26){return this['split'](_0x196eac)[_0xa826('0x1cb')](_0x456b26);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2796606..87ebf23 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 _0x786b=['all','savePause','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','bind','hanguprequest','syncHangupRequest','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[ACW][START]\x20%s','message','pauseType','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%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'];(function(_0x376415,_0x122c2b){var _0x1bc436=function(_0x3d9723){while(--_0x3d9723){_0x376415['push'](_0x376415['shift']());}};_0x1bc436(++_0x122c2b);}(_0x786b,0x164));var _0xb786=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x786b[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xb786('0x0'));var moment=require(_0xb786('0x1'));var ami=require(_0xb786('0x2'));var logger=require(_0xb786('0x3'))(_0xb786('0x4'));var RpcUser=require(_0xb786('0x5'));var RpcVoiceAgentReport=require(_0xb786('0x6'));function Acw(_0x18386d){this[_0xb786('0x7')]=_0x18386d[_0xb786('0x7')];this[_0xb786('0x8')]=_0x18386d['agents'];this['timers']=_0x18386d[_0xb786('0x9')];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0xb786('0xa')](this));ami['on'](_0xb786('0xb'),this[_0xb786('0xc')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xb786('0xa')](this));ami['on'](_0xb786('0xd'),this[_0xb786('0xe')][_0xb786('0xa')](this));ami['on']('attendedtransfer',this[_0xb786('0xf')][_0xb786('0xa')](this));ami['on'](_0xb786('0x10'),this[_0xb786('0x11')][_0xb786('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0xb786('0x12')][_0xb786('0xa')](this));}function getDiff(_0x1f1446){var _0x3c5a88=moment()[_0xb786('0x13')](0x0);var _0x140d61=moment(_0x1f1446)[_0xb786('0x13')](0x0);return _0x3c5a88[_0xb786('0x14')](_0x140d61,_0xb786('0x15'));}Acw[_0xb786('0x16')]['updateAcw']=function(_0x13bf92,_0x2891a4){var _0x52b84a=this;var _0x4d1edc=getDiff(_0x52b84a[_0xb786('0x9')][_0x13bf92][_0xb786('0x17')]);clearTimeout(_0x52b84a[_0xb786('0x9')][_0x13bf92][_0xb786('0x18')]);_0x52b84a[_0xb786('0x9')][_0x13bf92][_0xb786('0x18')]=![];return RpcVoiceAgentReport[_0xb786('0x19')]({'acwtime':_0x4d1edc},_0x52b84a[_0xb786('0x9')][_0x13bf92][_0xb786('0x1a')],_0x13bf92)['then'](function(_0x3f7f81){logger[_0xb786('0x1b')](_0xb786('0x1c'),_0x2891a4,_0x4d1edc,_0x3f7f81);})[_0xb786('0x1d')](function(_0x655d44){logger[_0xb786('0x1e')]('[%s][UPDATE][ERRORS:%s]',_0x2891a4,_0x655d44);})[_0xb786('0x1f')](function(){delete _0x52b84a[_0xb786('0x9')][_0x13bf92];});};Acw['prototype'][_0xb786('0x20')]=function(_0x39be5b){try{var _0x188fe8=this;var _0x3a0463=this['channels'][_0x39be5b]['interface'];var _0x3c7598=this[_0xb786('0x21')][_0x39be5b][_0xb786('0x22')];var _0x523208=this[_0xb786('0x7')][_0x3c7598];var _0x225f1b=![];var _0xf56765=_0xb786('0x23');if(_0x523208[_0xb786('0x24')]&&_0x523208[_0xb786('0x25')][_0xb786('0x26')]){_0x225f1b=!![];_0xf56765=_0x523208[_0xb786('0x25')][_0xb786('0x26')];}return ami[_0xb786('0x27')]({'action':_0xb786('0x28'),'interface':_0x3a0463,'paused':!![],'reason':_0xf56765})[_0xb786('0x29')](function(){if(_0x188fe8[_0xb786('0x8')][_0x3a0463]){return RpcUser[_0xb786('0x2a')](_0x188fe8[_0xb786('0x8')][_0x3a0463]['id'])['then'](function(_0x5439f6){if(!_0x5439f6||_0x5439f6[_0xb786('0x2b')]){logger[_0xb786('0x1b')](_0xb786('0x2c'),_0x39be5b,_0x3a0463,_0x3c7598);return;}logger[_0xb786('0x1b')](_0xb786('0x2d'),_0x39be5b,_0x3a0463,_0x3c7598);var _0x153f75=_0x188fe8['channels'][_0x39be5b][_0xb786('0x2e')]&&_0x188fe8[_0xb786('0x21')][_0x39be5b][_0xb786('0x2f')]?_0x188fe8[_0xb786('0x21')][_0x39be5b]['destlinkedid']:_0x39be5b;return RpcUser['savePause'](_0x188fe8[_0xb786('0x8')][_0x3a0463],_0xf56765,_0x153f75)['then'](function(_0x41f01c){_0x188fe8[_0xb786('0x7')][_0x3c7598][_0xb786('0x30')]-=0x1;_0x188fe8[_0xb786('0x7')][_0x3c7598]['paused']+=0x1;return _0x41f01c;});})['then'](function(_0x4cfb0f){if(_0x225f1b||!_0x4cfb0f){return;}_0x188fe8['timers'][_0x3a0463]={};logger[_0xb786('0x1b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x39be5b,_0x188fe8['voiceQueues'][_0x3c7598]['acwTimeout'],_0x3a0463,_0x3c7598);_0x188fe8[_0xb786('0x9')][_0x3a0463][_0xb786('0x18')]=setTimeout(_0x188fe8[_0xb786('0x31')][_0xb786('0xa')](_0x188fe8,_0x3a0463),_0x188fe8[_0xb786('0x7')][_0x3c7598][_0xb786('0x32')]*0x3e8);_0x188fe8[_0xb786('0x9')][_0x3a0463][_0xb786('0x17')]=moment()[_0xb786('0x33')](_0xb786('0x34'));_0x188fe8[_0xb786('0x9')][_0x3a0463]['uniqueid']=_0x39be5b;_0x188fe8[_0xb786('0x9')][_0x3a0463][_0xb786('0x22')]=_0x3c7598;_0x188fe8[_0xb786('0x9')][_0x3a0463]['updateAcw']=_0x188fe8[_0xb786('0x35')]['bind'](_0x188fe8,_0x3a0463,_0x39be5b);});}})['catch'](function(){logger[_0xb786('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x39be5b,_0x188fe8[_0xb786('0x7')][_0x3c7598][_0xb786('0x32')],_0x3a0463,_0x3c7598);})[_0xb786('0x1f')](function(){delete _0x188fe8['channels'][_0x39be5b];});}catch(_0x53a22d){logger[_0xb786('0x1e')](_0xb786('0x36'),_0x53a22d[_0xb786('0x37')]);}};Acw['prototype'][_0xb786('0x31')]=function(_0xb9d184){try{var _0x391fff=this;if(_0x391fff[_0xb786('0x9')][_0xb9d184]){_0x391fff['timers'][_0xb9d184][_0xb786('0x18')]=![];var _0x40bf27=_0x391fff[_0xb786('0x9')][_0xb9d184][_0xb786('0x1a')];var _0xa2df0d=_0x391fff[_0xb786('0x9')][_0xb9d184][_0xb786('0x22')];var _0x5f4063=_0x391fff[_0xb786('0x7')][_0xa2df0d][_0xb786('0x32')];logger[_0xb786('0x1b')]('[%s][TIMER][STOP][AGENT:%s]',_0x40bf27,_0xb9d184);RpcUser[_0xb786('0x2a')](this[_0xb786('0x8')][_0xb9d184]['id'])[_0xb786('0x29')](function(_0x4b571d){if(_0x4b571d[_0xb786('0x38')]===_0xb786('0x23')){return RpcUser[_0xb786('0x39')](_0x391fff['agents'][_0xb9d184]);}});RpcVoiceAgentReport['update']({'acwtime':_0x5f4063,'agentacw':!![]},_0x40bf27,_0xb9d184)[_0xb786('0x29')](function(_0x5a3ab8){logger[_0xb786('0x1b')](_0xb786('0x1c'),_0x40bf27,_0x5f4063,_0x5a3ab8);})[_0xb786('0x1d')](function(_0x2b13d4){logger[_0xb786('0x1e')](_0xb786('0x3a'),_0x40bf27,_0x2b13d4);});}else{logger[_0xb786('0x1e')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0xb9d184);if(_0x391fff[_0xb786('0x9')]){logger[_0xb786('0x1b')](_0xb786('0x3b'),JSON[_0xb786('0x3c')](_0x391fff[_0xb786('0x9')]));}}}catch(_0x2a6ab2){logger['error']('[ACW][STOP]\x20%s',_0x2a6ab2[_0xb786('0x37')]);}};Acw[_0xb786('0x16')]['syncAgentConnect']=function(_0x58b209){try{if(this[_0xb786('0x7')][_0x58b209['queue']]&&(this[_0xb786('0x7')][_0x58b209[_0xb786('0x22')]][_0xb786('0x4')]||this['voiceQueues'][_0x58b209[_0xb786('0x22')]][_0xb786('0x24')])){if(this[_0xb786('0x8')][_0x58b209[_0xb786('0x3d')]]){this[_0xb786('0x21')][_0x58b209[_0xb786('0x1a')]]={'queue':_0x58b209['queue'],'interface':_0x58b209['interface'],'destlinkedid':_0x58b209[_0xb786('0x2f')]};}}}catch(_0x39cb94){logger['error'](_0xb786('0x3e'),_0x39cb94[_0xb786('0x37')]);}};Acw['prototype'][_0xb786('0x12')]=function(_0x5bd536){try{if(this[_0xb786('0x7')][_0x5bd536[_0xb786('0x22')]]&&(this[_0xb786('0x7')][_0x5bd536[_0xb786('0x22')]][_0xb786('0x4')]||this['voiceQueues'][_0x5bd536[_0xb786('0x22')]][_0xb786('0x24')])){if(this[_0xb786('0x8')][_0x5bd536[_0xb786('0x3d')]]){this[_0xb786('0x21')][_0x5bd536['uniqueid']]={'queue':_0x5bd536[_0xb786('0x22')],'interface':_0x5bd536[_0xb786('0x3d')]};}}}catch(_0x4a8e41){logger[_0xb786('0x1e')](_0xb786('0x3f'),_0x4a8e41['message']);}};Acw[_0xb786('0x16')]['syncHangupRequest']=function(_0x589167){try{if(this[_0xb786('0x21')][_0x589167['uniqueid']]&&_['isUndefined'](this[_0xb786('0x21')][_0x589167['uniqueid']][_0xb786('0x2e')])){logger['info'](_0xb786('0x40'),_0x589167[_0xb786('0x1a')]);this[_0xb786('0x20')](_0x589167['uniqueid']);}else if(this[_0xb786('0x21')][_0x589167[_0xb786('0x41')]]&&_[_0xb786('0x42')](this['channels'][_0x589167[_0xb786('0x41')]][_0xb786('0x2e')])){logger['info'](_0xb786('0x43'),_0x589167['linkedid']);this['startAcw'](_0x589167[_0xb786('0x41')]);}}catch(_0x1dcd17){logger[_0xb786('0x1e')](_0xb786('0x44'),_0x1dcd17[_0xb786('0x37')]);}};Acw[_0xb786('0x16')][_0xb786('0x45')]=function(_0x2c8d38){try{if(this[_0xb786('0x21')][_0x2c8d38['uniqueid']]&&this[_0xb786('0x21')][_0x2c8d38[_0xb786('0x1a')]][_0xb786('0x2e')]){logger[_0xb786('0x1b')](_0xb786('0x46'),_0x2c8d38[_0xb786('0x1a')]);this['startAcw'](_0x2c8d38['uniqueid']);}else if(this[_0xb786('0x21')][_0x2c8d38[_0xb786('0x41')]]&&this[_0xb786('0x21')][_0x2c8d38[_0xb786('0x41')]]['attended']){logger['info'](_0xb786('0x47'),_0x2c8d38[_0xb786('0x41')]);this[_0xb786('0x20')](_0x2c8d38[_0xb786('0x41')]);}}catch(_0x13daf7){logger[_0xb786('0x1e')](_0xb786('0x48'),_0x13daf7[_0xb786('0x37')]);}};Acw[_0xb786('0x16')][_0xb786('0xf')]=function(_0x5a5986){try{if(!_[_0xb786('0x49')](this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4a')]])){this[_0xb786('0x20')](_0x5a5986[_0xb786('0x4a')]);if(this[_0xb786('0x21')][_0x5a5986['secondtransfereruniqueid']]){this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4b')]][_0xb786('0x2e')]=!![];this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4c')]]=this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4b')]];delete this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4b')]];}}else if(!_[_0xb786('0x49')](this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4c')]])){this[_0xb786('0x20')](_0x5a5986['transfertargetuniqueid']);if(this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4d')]]){this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4d')]][_0xb786('0x2e')]=!![];this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4a')]]=this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4d')]];delete this[_0xb786('0x21')][_0x5a5986[_0xb786('0x4d')]];}}}catch(_0x40ad1c){logger[_0xb786('0x1e')](_0xb786('0x4e'),_0x40ad1c['message']);}};Acw[_0xb786('0x16')][_0xb786('0x11')]=function(_0x1300e9){try{if(this[_0xb786('0x21')][_0x1300e9[_0xb786('0x4f')]]){logger[_0xb786('0x1b')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x1300e9[_0xb786('0x4f')]));this['startAcw'](_0x1300e9[_0xb786('0x4f')]);}else if(this['channels'][_0x1300e9[_0xb786('0x50')]]){logger[_0xb786('0x1b')](_0xb786('0x51'),JSON[_0xb786('0x3c')](_0x1300e9['transfererlinkedid']));this[_0xb786('0x20')](_0x1300e9[_0xb786('0x50')]);}}catch(_0x5256da){logger[_0xb786('0x1e')](_0xb786('0x52'),_0x5256da['message']);}};Acw[_0xb786('0x16')][_0xb786('0xe')]=function(_0x4c5a41){try{if(this[_0xb786('0x7')][_0x4c5a41[_0xb786('0x22')]]&&this['voiceQueues'][_0x4c5a41['queue']][_0xb786('0x53')]===_0xb786('0x54')){if(this[_0xb786('0x8')][_0x4c5a41[_0xb786('0x3d')]]){logger[_0xb786('0x1b')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x4c5a41['uniqueid'],_0x4c5a41[_0xb786('0x3d')],_0x4c5a41[_0xb786('0x22')]);return RpcUser[_0xb786('0x55')](this[_0xb786('0x8')][_0x4c5a41[_0xb786('0x3d')]],_0xb786('0x56'),_0x4c5a41[_0xb786('0x1a')]);}}}catch(_0x2819cb){logger[_0xb786('0x1e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2819cb['message']);}};module[_0xb786('0x57')]=Acw; \ No newline at end of file +var _0xf377=['secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','../ami','acw','../rpc/user','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timers','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','[ACW][START]\x20%s','stopAcw','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','destlinkedid','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid'];(function(_0x215cd1,_0x35a363){var _0x4440f8=function(_0x233d78){while(--_0x233d78){_0x215cd1['push'](_0x215cd1['shift']());}};_0x4440f8(++_0x35a363);}(_0xf377,0x1bf));var _0x7f37=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf377[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x7f37('0x0'));var moment=require('moment');var ami=require(_0x7f37('0x1'));var logger=require('../../../config/logger')(_0x7f37('0x2'));var RpcUser=require(_0x7f37('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5b9ded){this[_0x7f37('0x4')]=_0x5b9ded[_0x7f37('0x4')];this[_0x7f37('0x5')]=_0x5b9ded['agents'];this['timers']=_0x5b9ded['timers'];this[_0x7f37('0x6')]={};ami['on'](_0x7f37('0x7'),this[_0x7f37('0x8')][_0x7f37('0x9')](this));ami['on']('hanguprequest',this[_0x7f37('0xa')][_0x7f37('0x9')](this));ami['on'](_0x7f37('0xb'),this[_0x7f37('0xc')]['bind'](this));ami['on'](_0x7f37('0xd'),this[_0x7f37('0xe')][_0x7f37('0x9')](this));ami['on'](_0x7f37('0xf'),this[_0x7f37('0x10')][_0x7f37('0x9')](this));ami['on']('blindtransfer',this[_0x7f37('0x11')][_0x7f37('0x9')](this));ami['on'](_0x7f37('0x12'),this[_0x7f37('0x13')][_0x7f37('0x9')](this));}function getDiff(_0x35b3ed){var _0x231dd5=moment()[_0x7f37('0x14')](0x0);var _0x4afc5b=moment(_0x35b3ed)[_0x7f37('0x14')](0x0);return _0x231dd5[_0x7f37('0x15')](_0x4afc5b,_0x7f37('0x16'));}Acw[_0x7f37('0x17')][_0x7f37('0x18')]=function(_0x30c902,_0x3370b1){var _0x56a8f0=this;var _0xf76e0f=getDiff(_0x56a8f0['timers'][_0x30c902][_0x7f37('0x19')]);clearTimeout(_0x56a8f0[_0x7f37('0x1a')][_0x30c902]['timer']);_0x56a8f0[_0x7f37('0x1a')][_0x30c902][_0x7f37('0x1b')]=![];return RpcVoiceAgentReport[_0x7f37('0x1c')]({'acwtime':_0xf76e0f},_0x56a8f0[_0x7f37('0x1a')][_0x30c902][_0x7f37('0x1d')],_0x30c902)['then'](function(_0x4328da){logger[_0x7f37('0x1e')](_0x7f37('0x1f'),_0x3370b1,_0xf76e0f,_0x4328da);})[_0x7f37('0x20')](function(_0x50a535){logger[_0x7f37('0x21')](_0x7f37('0x22'),_0x3370b1,_0x50a535);})[_0x7f37('0x23')](function(){delete _0x56a8f0[_0x7f37('0x1a')][_0x30c902];});};Acw[_0x7f37('0x17')]['startAcw']=function(_0x3338ba){try{var _0x4c8ebb=this;var _0x1492be=this[_0x7f37('0x6')][_0x3338ba][_0x7f37('0x24')];var _0x1ecf26=this[_0x7f37('0x6')][_0x3338ba][_0x7f37('0x25')];var _0x9e05bb=this['voiceQueues'][_0x1ecf26];var _0x3eb0d3=![];var _0xd3bd68=_0x7f37('0x26');if(_0x9e05bb[_0x7f37('0x27')]&&_0x9e05bb[_0x7f37('0x28')][_0x7f37('0x29')]){_0x3eb0d3=!![];_0xd3bd68=_0x9e05bb['mandatoryDispositionPause'][_0x7f37('0x29')];}return ami[_0x7f37('0x2a')]({'action':_0x7f37('0x2b'),'interface':_0x1492be,'paused':!![],'reason':_0xd3bd68})[_0x7f37('0x2c')](function(){if(_0x4c8ebb[_0x7f37('0x5')][_0x1492be]){return RpcUser[_0x7f37('0x2d')](_0x4c8ebb[_0x7f37('0x5')][_0x1492be]['id'])[_0x7f37('0x2c')](function(_0x1f2d31){if(!_0x1f2d31||_0x1f2d31['voicePause']){logger[_0x7f37('0x1e')](_0x7f37('0x2e'),_0x3338ba,_0x1492be,_0x1ecf26);return;}logger[_0x7f37('0x1e')](_0x7f37('0x2f'),_0x3338ba,_0x1492be,_0x1ecf26);var _0x5007c6=_0x4c8ebb['channels'][_0x3338ba][_0x7f37('0x30')]&&_0x4c8ebb['channels'][_0x3338ba]['destlinkedid']?_0x4c8ebb['channels'][_0x3338ba]['destlinkedid']:_0x3338ba;return RpcUser[_0x7f37('0x31')](_0x4c8ebb[_0x7f37('0x5')][_0x1492be],_0xd3bd68,_0x5007c6)[_0x7f37('0x2c')](function(_0x32d238){_0x4c8ebb[_0x7f37('0x4')][_0x1ecf26][_0x7f37('0x32')]-=0x1;_0x4c8ebb['voiceQueues'][_0x1ecf26]['paused']+=0x1;return _0x32d238;});})['then'](function(_0xb39183){if(_0x3eb0d3||!_0xb39183){return;}_0x4c8ebb['timers'][_0x1492be]={};logger[_0x7f37('0x1e')](_0x7f37('0x33'),_0x3338ba,_0x4c8ebb['voiceQueues'][_0x1ecf26][_0x7f37('0x34')],_0x1492be,_0x1ecf26);_0x4c8ebb[_0x7f37('0x1a')][_0x1492be][_0x7f37('0x1b')]=setTimeout(_0x4c8ebb['stopAcw'][_0x7f37('0x9')](_0x4c8ebb,_0x1492be),_0x4c8ebb[_0x7f37('0x4')][_0x1ecf26][_0x7f37('0x34')]*0x3e8);_0x4c8ebb['timers'][_0x1492be][_0x7f37('0x19')]=moment()[_0x7f37('0x35')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c8ebb[_0x7f37('0x1a')][_0x1492be][_0x7f37('0x1d')]=_0x3338ba;_0x4c8ebb[_0x7f37('0x1a')][_0x1492be][_0x7f37('0x25')]=_0x1ecf26;_0x4c8ebb[_0x7f37('0x1a')][_0x1492be]['updateAcw']=_0x4c8ebb[_0x7f37('0x18')][_0x7f37('0x9')](_0x4c8ebb,_0x1492be,_0x3338ba);});}})['catch'](function(){logger[_0x7f37('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3338ba,_0x4c8ebb['voiceQueues'][_0x1ecf26][_0x7f37('0x34')],_0x1492be,_0x1ecf26);})['finally'](function(){delete _0x4c8ebb['channels'][_0x3338ba];});}catch(_0x2ff47a){logger['error'](_0x7f37('0x36'),_0x2ff47a['message']);}};Acw[_0x7f37('0x17')][_0x7f37('0x37')]=function(_0x3b0611){try{var _0x511633=this;if(_0x511633[_0x7f37('0x1a')][_0x3b0611]){_0x511633[_0x7f37('0x1a')][_0x3b0611]['timer']=![];var _0x2877f6=_0x511633[_0x7f37('0x1a')][_0x3b0611][_0x7f37('0x1d')];var _0x145f58=_0x511633['timers'][_0x3b0611][_0x7f37('0x25')];var _0x14bfa7=_0x511633['voiceQueues'][_0x145f58][_0x7f37('0x34')];logger[_0x7f37('0x1e')](_0x7f37('0x38'),_0x2877f6,_0x3b0611);RpcUser[_0x7f37('0x2d')](this[_0x7f37('0x5')][_0x3b0611]['id'])[_0x7f37('0x2c')](function(_0x3dcc29){if(_0x3dcc29[_0x7f37('0x39')]===_0x7f37('0x26')){return RpcUser[_0x7f37('0x3a')](_0x511633[_0x7f37('0x5')][_0x3b0611]);}});RpcVoiceAgentReport['update']({'acwtime':_0x14bfa7,'agentacw':!![]},_0x2877f6,_0x3b0611)[_0x7f37('0x2c')](function(_0xd24404){logger[_0x7f37('0x1e')](_0x7f37('0x1f'),_0x2877f6,_0x14bfa7,_0xd24404);})['catch'](function(_0xcaf78c){logger[_0x7f37('0x21')]('[%s][UPDATE][ERRORS:%s]',_0x2877f6,_0xcaf78c);});}else{logger[_0x7f37('0x21')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3b0611);if(_0x511633['timers']){logger[_0x7f37('0x1e')](_0x7f37('0x3b'),JSON[_0x7f37('0x3c')](_0x511633['timers']));}}}catch(_0x5aff1a){logger[_0x7f37('0x21')](_0x7f37('0x3d'),_0x5aff1a[_0x7f37('0x3e')]);}};Acw[_0x7f37('0x17')][_0x7f37('0x8')]=function(_0x5a321b){try{if(this[_0x7f37('0x4')][_0x5a321b[_0x7f37('0x25')]]&&(this[_0x7f37('0x4')][_0x5a321b[_0x7f37('0x25')]]['acw']||this[_0x7f37('0x4')][_0x5a321b[_0x7f37('0x25')]]['mandatoryDisposition'])){if(this['agents'][_0x5a321b[_0x7f37('0x24')]]){this[_0x7f37('0x6')][_0x5a321b['uniqueid']]={'queue':_0x5a321b[_0x7f37('0x25')],'interface':_0x5a321b[_0x7f37('0x24')],'destlinkedid':_0x5a321b[_0x7f37('0x3f')]};}}}catch(_0x28d342){logger[_0x7f37('0x21')](_0x7f37('0x40'),_0x28d342[_0x7f37('0x3e')]);}};Acw[_0x7f37('0x17')][_0x7f37('0x13')]=function(_0x45a7da){try{if(this[_0x7f37('0x4')][_0x45a7da[_0x7f37('0x25')]]&&(this['voiceQueues'][_0x45a7da[_0x7f37('0x25')]][_0x7f37('0x2')]||this[_0x7f37('0x4')][_0x45a7da[_0x7f37('0x25')]][_0x7f37('0x27')])){if(this[_0x7f37('0x5')][_0x45a7da[_0x7f37('0x24')]]){this[_0x7f37('0x6')][_0x45a7da['uniqueid']]={'queue':_0x45a7da['queue'],'interface':_0x45a7da[_0x7f37('0x24')]};}}}catch(_0x53f6e0){logger[_0x7f37('0x21')]('[ACW][syncAgentConnectPreview]\x20%s',_0x53f6e0['message']);}};Acw[_0x7f37('0x17')][_0x7f37('0xa')]=function(_0x2ba6c2){try{if(this['channels'][_0x2ba6c2['uniqueid']]&&_[_0x7f37('0x41')](this[_0x7f37('0x6')][_0x2ba6c2[_0x7f37('0x1d')]][_0x7f37('0x30')])){logger[_0x7f37('0x1e')](_0x7f37('0x42'),_0x2ba6c2[_0x7f37('0x1d')]);this[_0x7f37('0x43')](_0x2ba6c2[_0x7f37('0x1d')]);}else if(this[_0x7f37('0x6')][_0x2ba6c2[_0x7f37('0x44')]]&&_[_0x7f37('0x41')](this[_0x7f37('0x6')][_0x2ba6c2[_0x7f37('0x44')]][_0x7f37('0x30')])){logger['info'](_0x7f37('0x45'),_0x2ba6c2[_0x7f37('0x44')]);this[_0x7f37('0x43')](_0x2ba6c2[_0x7f37('0x44')]);}}catch(_0x430fce){logger[_0x7f37('0x21')](_0x7f37('0x46'),_0x430fce['message']);}};Acw[_0x7f37('0x17')][_0x7f37('0xc')]=function(_0x5862e2){try{if(this[_0x7f37('0x6')][_0x5862e2['uniqueid']]&&this['channels'][_0x5862e2[_0x7f37('0x1d')]][_0x7f37('0x30')]){logger[_0x7f37('0x1e')](_0x7f37('0x47'),_0x5862e2['uniqueid']);this[_0x7f37('0x43')](_0x5862e2[_0x7f37('0x1d')]);}else if(this[_0x7f37('0x6')][_0x5862e2[_0x7f37('0x44')]]&&this[_0x7f37('0x6')][_0x5862e2[_0x7f37('0x44')]][_0x7f37('0x30')]){logger[_0x7f37('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5862e2[_0x7f37('0x44')]);this['startAcw'](_0x5862e2['linkedid']);}}catch(_0x393a75){logger[_0x7f37('0x21')](_0x7f37('0x48'),_0x393a75[_0x7f37('0x3e')]);}};Acw[_0x7f37('0x17')]['syncAttendedTransfer']=function(_0x3886ae){try{if(!_[_0x7f37('0x49')](this['channels'][_0x3886ae[_0x7f37('0x4a')]])){this[_0x7f37('0x43')](_0x3886ae['transfereeuniqueid']);if(this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4b')]]){this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4b')]]['attended']=!![];this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4c')]]=this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4b')]];delete this[_0x7f37('0x6')][_0x3886ae['secondtransfereruniqueid']];}}else if(!_['isNil'](this['channels'][_0x3886ae[_0x7f37('0x4c')]])){this[_0x7f37('0x43')](_0x3886ae['transfertargetuniqueid']);if(this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4d')]]){this[_0x7f37('0x6')][_0x3886ae['origtransfereruniqueid']][_0x7f37('0x30')]=!![];this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4a')]]=this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4d')]];delete this[_0x7f37('0x6')][_0x3886ae[_0x7f37('0x4d')]];}}}catch(_0x1e0821){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x1e0821['message']);}};Acw['prototype'][_0x7f37('0x11')]=function(_0x538eaf){try{if(this[_0x7f37('0x6')][_0x538eaf[_0x7f37('0x4e')]]){logger[_0x7f37('0x1e')](_0x7f37('0x4f'),JSON['stringify'](_0x538eaf[_0x7f37('0x4e')]));this[_0x7f37('0x43')](_0x538eaf[_0x7f37('0x4e')]);}else if(this['channels'][_0x538eaf[_0x7f37('0x50')]]){logger[_0x7f37('0x1e')](_0x7f37('0x51'),JSON[_0x7f37('0x3c')](_0x538eaf[_0x7f37('0x50')]));this[_0x7f37('0x43')](_0x538eaf[_0x7f37('0x50')]);}}catch(_0x3e5077){logger[_0x7f37('0x21')](_0x7f37('0x52'),_0x3e5077[_0x7f37('0x3e')]);}};Acw[_0x7f37('0x17')][_0x7f37('0xe')]=function(_0x22d34a){try{if(this[_0x7f37('0x4')][_0x22d34a[_0x7f37('0x25')]]&&this[_0x7f37('0x4')][_0x22d34a[_0x7f37('0x25')]][_0x7f37('0x53')]==='all'){if(this['agents'][_0x22d34a[_0x7f37('0x24')]]){logger[_0x7f37('0x1e')](_0x7f37('0x54'),_0x22d34a['uniqueid'],_0x22d34a[_0x7f37('0x24')],_0x22d34a[_0x7f37('0x25')]);return RpcUser[_0x7f37('0x31')](this[_0x7f37('0x5')][_0x22d34a[_0x7f37('0x24')]],_0x7f37('0x55'),_0x22d34a['uniqueid']);}}}catch(_0x226fd5){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x226fd5[_0x7f37('0x3e')]);}};module[_0x7f37('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f909766..603096f 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 _0xe7f8=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionSipPeerStatus','actionCoreShowChannels','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','ami','../../config/environment','asterisk','port','username','keepConnected','Action','action','error','format','inspect','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown'];(function(_0x3bbd0e,_0x54966f){var _0x1075e3=function(_0x579205){while(--_0x579205){_0x3bbd0e['push'](_0x3bbd0e['shift']());}};_0x1075e3(++_0x54966f);}(_0xe7f8,0x16a));var _0x8e7f=function(_0x1de86e,_0x38211a){_0x1de86e=_0x1de86e-0x0;var _0x54ad49=_0xe7f8[_0x1de86e];return _0x54ad49;};'use strict';var Manager=require(_0x8e7f('0x0'));var BPromise=require(_0x8e7f('0x1'));var util=require('util');var logger=require('../../config/logger')(_0x8e7f('0x2'));var config=require(_0x8e7f('0x3'));var ami=new Manager(config[_0x8e7f('0x4')][_0x8e7f('0x5')],config['asterisk']['ip'],config[_0x8e7f('0x4')][_0x8e7f('0x6')],config[_0x8e7f('0x4')]['password'],!![]);ami[_0x8e7f('0x7')]();ami[_0x8e7f('0x8')]=BPromise['promisify'](ami[_0x8e7f('0x9')]);function error(_0x45fa8b){logger[_0x8e7f('0xa')](util[_0x8e7f('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8e7f('0x4')]['username'],config[_0x8e7f('0x4')]['ip'],config[_0x8e7f('0x4')][_0x8e7f('0x5')],util[_0x8e7f('0xc')](_0x45fa8b,![],null)));}function close(){logger['error'](util[_0x8e7f('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x8e7f('0x4')][_0x8e7f('0x6')],config[_0x8e7f('0x4')]['ip'],config[_0x8e7f('0x4')][_0x8e7f('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x8e7f('0x8')]({'action':'sipshowregistry'});};};ami[_0x8e7f('0xd')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x8e7f('0x8')]({'action':_0x8e7f('0xe')});};};ami[_0x8e7f('0xf')]=function(){return function(){return ami[_0x8e7f('0x8')]({'action':_0x8e7f('0x10')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8e7f('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0x8e7f('0x11')](util[_0x8e7f('0xb')](_0x8e7f('0x12'),config['asterisk'][_0x8e7f('0x6')],config['asterisk']['ip'],config[_0x8e7f('0x4')][_0x8e7f('0x5')]));ami[_0x8e7f('0x13')](_0x8e7f('0xa'),error);ami[_0x8e7f('0x13')](_0x8e7f('0x14'),close);}ami['on']('connect',connect);ami['on'](_0x8e7f('0x15'),function(_0x5700eb){logger[_0x8e7f('0x11')](util[_0x8e7f('0xb')](_0x8e7f('0x16'),config[_0x8e7f('0x4')][_0x8e7f('0x6')],config[_0x8e7f('0x4')]['ip'],config[_0x8e7f('0x4')][_0x8e7f('0x5')],util[_0x8e7f('0xc')](_0x5700eb,![],null)));});ami['on'](_0x8e7f('0x17'),function(){logger[_0x8e7f('0x11')](util['format'](_0x8e7f('0x18'),config[_0x8e7f('0x4')]['username'],config['asterisk']['ip'],config['asterisk']['port']));return Promise[_0x8e7f('0x19')]()[_0x8e7f('0x1a')](ami[_0x8e7f('0x1b')]())[_0x8e7f('0x1a')](ami[_0x8e7f('0xd')]())[_0x8e7f('0x1a')](ami[_0x8e7f('0x1c')]())[_0x8e7f('0x1a')](ami['actionQueueSummary']())['then'](ami[_0x8e7f('0x1d')]())[_0x8e7f('0x1e')](function(_0x1dc2c9){logger[_0x8e7f('0xa')](_0x8e7f('0x1f'),util[_0x8e7f('0xc')](_0x1dc2c9,{'showHidden':![],'depth':null}));});});ami[_0x8e7f('0x13')](_0x8e7f('0xa'),error);ami[_0x8e7f('0x13')](_0x8e7f('0x14'),close);module['exports']=ami; \ No newline at end of file +var _0x32a4=['promisify','action','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','close','exports','util','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','Action'];(function(_0x7ea11,_0x431e81){var _0x3abcda=function(_0x2dd600){while(--_0x2dd600){_0x7ea11['push'](_0x7ea11['shift']());}};_0x3abcda(++_0x431e81);}(_0x32a4,0x7f));var _0x432a=function(_0x5da730,_0x27c81c){_0x5da730=_0x5da730-0x0;var _0x459c62=_0x32a4[_0x5da730];return _0x459c62;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x432a('0x0'));var logger=require(_0x432a('0x1'))(_0x432a('0x2'));var config=require(_0x432a('0x3'));var ami=new Manager(config[_0x432a('0x4')][_0x432a('0x5')],config[_0x432a('0x4')]['ip'],config[_0x432a('0x4')][_0x432a('0x6')],config['asterisk']['password'],!![]);ami[_0x432a('0x7')]();ami[_0x432a('0x8')]=BPromise[_0x432a('0x9')](ami[_0x432a('0xa')]);function error(_0x5f13ad){logger[_0x432a('0xb')](util[_0x432a('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x432a('0x4')]['ip'],config[_0x432a('0x4')][_0x432a('0x5')],util['inspect'](_0x5f13ad,![],null)));}function close(){logger[_0x432a('0xb')](util[_0x432a('0xc')](_0x432a('0xd'),config[_0x432a('0x4')][_0x432a('0x6')],config[_0x432a('0x4')]['ip'],config[_0x432a('0x4')][_0x432a('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x432a('0x8')]({'action':_0x432a('0xe')});};};ami[_0x432a('0xf')]=function(){return function(){return ami[_0x432a('0x8')]({'action':'devicestatelist'});};};ami[_0x432a('0x10')]=function(){return function(){return ami['Action']({'action':_0x432a('0x11')});};};ami[_0x432a('0x12')]=function(){return function(){return ami['Action']({'action':_0x432a('0x13')});};};ami[_0x432a('0x14')]=function(){return function(){return ami['Action']({'action':_0x432a('0x15')});};};function connect(){logger[_0x432a('0x16')](util['format'](_0x432a('0x17'),config[_0x432a('0x4')][_0x432a('0x6')],config[_0x432a('0x4')]['ip'],config[_0x432a('0x4')]['port']));ami[_0x432a('0x18')](_0x432a('0xb'),error);ami['once']('close',close);}ami['on'](_0x432a('0x19'),connect);ami['on']('shutdown',function(_0x9c1c26){logger[_0x432a('0x16')](util[_0x432a('0xc')](_0x432a('0x1a'),config[_0x432a('0x4')][_0x432a('0x6')],config[_0x432a('0x4')]['ip'],config[_0x432a('0x4')]['port'],util[_0x432a('0x1b')](_0x9c1c26,![],null)));});ami['on'](_0x432a('0x1c'),function(){logger['info'](util[_0x432a('0xc')](_0x432a('0x1d'),config[_0x432a('0x4')][_0x432a('0x6')],config[_0x432a('0x4')]['ip'],config[_0x432a('0x4')][_0x432a('0x5')]));return Promise['resolve']()[_0x432a('0x1e')](ami['actionSipShowRegistry']())['then'](ami[_0x432a('0xf')]())[_0x432a('0x1e')](ami[_0x432a('0x10')]())['then'](ami['actionQueueSummary']())['then'](ami[_0x432a('0x14')]())[_0x432a('0x1f')](function(_0xf7deaa){logger[_0x432a('0xb')]('[ami.js][fullybooted]',util['inspect'](_0xf7deaa,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x432a('0x18')](_0x432a('0x20'),close);module[_0x432a('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a1a9ee4..81d33e2 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x1a7b49,_0x54e5e3){var _0x23c8a1=function(_0x3b7165){while(--_0x3b7165){_0x1a7b49['push'](_0x1a7b49['shift']());}};_0x23c8a1(++_0x54e5e3);}(_0xaa88,0x137));var _0x8aa8=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xaa88[_0x3c2a69];return _0x596bc8;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x70e0,0x17b));var _0x070e=function(_0x228594,_0x210ce6){_0x228594=_0x228594-0x0;var _0x59fc8c=_0x70e0[_0x228594];return _0x59fc8c;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 785af41..ec6fcdb 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 _0xdf94=['talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','online','length','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','Agent','launchHandleIvr','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','milliseconds','[handlePredictive]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','unlockContact','outboundReCallsDay','dialRecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','getContactDialerIvr','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','undefined','not_inuse','getContactDialer','checkContactEmpty','[countReScheduled]\x20','RUNNING','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','exports','util','lodash','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\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','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','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','erlangCalls','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','contacts','NO_AVAILABLE_CONTACTS','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','isEmpty','Intervals','NULL_INTERVAL','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','content','true','indexOf','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','resolve','dialTimezone','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','callProgressDetecting','variable','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialAMDActive','[syncHangupInAMDIvr]','MACHINE','dialGlobalMaxRetry','reason19\x20machine....','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','outboundUnknownCallsDay','Unknow','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available'];(function(_0xa16ef8,_0x40cc48){var _0x40ab63=function(_0x2fb788){while(--_0x2fb788){_0xa16ef8['push'](_0xa16ef8['shift']());}};_0x40ab63(++_0x40cc48);}(_0xdf94,0xe1));var _0x4df9=function(_0x57db49,_0x11cbbf){_0x57db49=_0x57db49-0x0;var _0x4316ed=_0xdf94[_0x57db49];return _0x4316ed;};'use strict';var util=require(_0x4df9('0x0'));var _=require(_0x4df9('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x4df9('0x2'));var utils=require(_0x4df9('0x3'));var hopperUtils=require(_0x4df9('0x4'));var ut=require('../preview/util/util');var config=require(_0x4df9('0x5'));var logger=require(_0x4df9('0x6'))(_0x4df9('0x7'));var loggerBooked=require(_0x4df9('0x6'))(_0x4df9('0x8'));var loggerPredictive=require(_0x4df9('0x6'))(_0x4df9('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0x4df9('0xa'));var loggerSyncQueueSummary=require(_0x4df9('0x6'))(_0x4df9('0xb'));var ami=require(_0x4df9('0xc'));config[_0x4df9('0xd')]=_[_0x4df9('0xe')](config[_0x4df9('0xd')],{'host':_0x4df9('0xf'),'port':0x18eb});var io=require(_0x4df9('0x10'))(new Redis(config['redis']));var cmHopper=require(_0x4df9('0x11'));var voiceQueueRt=require(_0x4df9('0x12'));var RpcSetting=require(_0x4df9('0x13'));var Interval=require(_0x4df9('0x14'));var Action=require(_0x4df9('0x15'));var History=require(_0x4df9('0x16'));var Final=require(_0x4df9('0x17'));var AgentComplete=require(_0x4df9('0x18'));var QueueCallerAbandon=require(_0x4df9('0x19'));var Hangup=require(_0x4df9('0x1a'));var ipAgi=process[_0x4df9('0x1b')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4df9('0x1c')]['enqueue']=function(_0x185608){this['tail']=this[_0x4df9('0x1d')]?this[_0x4df9('0x1d')][_0x4df9('0x1e')](_0x185608):_0x185608();};function Dialer(_0x5c9ccd,_0x44ec0e){this[_0x4df9('0x1f')]=new Sequence();this[_0x4df9('0x20')]=_0x44ec0e;this[_0x4df9('0x21')]=_0x5c9ccd[_0x4df9('0x21')];this['campaigns']=_0x5c9ccd[_0x4df9('0x22')];this[_0x4df9('0x23')]=_0x5c9ccd[_0x4df9('0x23')];this[_0x4df9('0x24')]=_0x5c9ccd[_0x4df9('0x24')];this['maxNumberOriginate']=config[_0x4df9('0x25')]||0x2;this[_0x4df9('0x26')]={};this[_0x4df9('0x27')]={};this[_0x4df9('0x28')]={};this[_0x4df9('0x29')]={};this[_0x4df9('0x2a')]={};this[_0x4df9('0x2b')]={};this[_0x4df9('0x2c')]={};this[_0x4df9('0x2d')]={};this[_0x4df9('0x2e')]={};this[_0x4df9('0x2f')]={};this['queuesSummary']={};ami['on'](_0x4df9('0x30'),this[_0x4df9('0x31')]['bind'](this));ami['on'](_0x4df9('0x32'),this[_0x4df9('0x33')][_0x4df9('0x34')](this));ami['on']('originateresponse',this[_0x4df9('0x35')][_0x4df9('0x34')](this));ami['on'](_0x4df9('0x36'),this[_0x4df9('0x37')][_0x4df9('0x34')](this));ami['on'](_0x4df9('0x38'),this['syncQueueSummary'][_0x4df9('0x34')](this));ami['on'](_0x4df9('0x39'),this[_0x4df9('0x3a')][_0x4df9('0x34')](this));ami['on'](_0x4df9('0x3b'),this['syncHangup']['bind'](this));ami['on'](_0x4df9('0x3c'),this[_0x4df9('0x3d')][_0x4df9('0x34')](this));ami['on'](_0x4df9('0x3e'),this[_0x4df9('0x3f')][_0x4df9('0x34')](this));ami['on'](_0x4df9('0x40'),this[_0x4df9('0x41')][_0x4df9('0x34')](this));ami['on'](_0x4df9('0x42'),this[_0x4df9('0x43')][_0x4df9('0x34')](this));this[_0x4df9('0x44')]();this[_0x4df9('0x45')]();RpcSetting[_0x4df9('0x46')]()[_0x4df9('0x47')](function(_0x75c17d){previewRecallmeReminderInterval=_0x75c17d[_0x4df9('0x48')];});}function isNotNull(_0x4214cb){return _0x4214cb!==null&&!_[_0x4df9('0x49')](_0x4214cb);}function msgResponse(_0x1c884b,_0x22c9de,_0x46cf98){return{'action':_0x1c884b,'response':_0x22c9de,'message':_0x46cf98,'stack':_0x46cf98};}function emit(_0x3571ea,_0x173144,_0x331b6a){io['to'](_0x3571ea)[_0x4df9('0x4a')](_0x173144,_0x331b6a);}function emitOutboundVoiceQueueSummary(_0x3210f3){if(_0x3210f3[_0x4df9('0x4b')]===_0x4df9('0x4c')){logger[_0x4df9('0x4d')](_0x4df9('0x4e'),util[_0x4df9('0x4f')](_0x3210f3,{'showHidden':![],'depth':null}));emit(util[_0x4df9('0x50')](_0x4df9('0x51'),_0x3210f3['name']),_0x4df9('0x52'),_0x3210f3);}}function checkGetDataPredictive(_0x53c3eb){if(isNotNull(_0x53c3eb)&&!_['isEmpty'](_0x53c3eb)){loggerPredictive[_0x4df9('0x53')](_0x4df9('0x54'));loggerPredictive['info'](_0x4df9('0x55'),_0x53c3eb['predictiveIntervalTotalCalls']);loggerPredictive[_0x4df9('0x53')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53c3eb[_0x4df9('0x56')]);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x57'),_0x53c3eb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x4df9('0x58'),_0x53c3eb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53c3eb[_0x4df9('0x59')]);loggerPredictive[_0x4df9('0x53')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53c3eb[_0x4df9('0x5a')]);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x5b'));if(_0x53c3eb[_0x4df9('0x5c')]>0x0){if(!_[_0x4df9('0x49')](_0x53c3eb[_0x4df9('0x5a')])&&_0x53c3eb[_0x4df9('0x5a')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x4df9('0x49')](_0x53c3eb['predictiveIntervalAvgHoldtime'])&&_0x53c3eb[_0x4df9('0x59')]>0x0){return!![];}loggerPredictive[_0x4df9('0x53')](_0x4df9('0x5d'));}else{loggerPredictive[_0x4df9('0x53')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x4df9('0x5e'));}return![];}function mergeDataErlangB(_0xa7e701){return function(_0x5c4558){loggerPredictive['info'](_0x4df9('0x5f'));loggerPredictive[_0x4df9('0x53')](_0x4df9('0x60'),_0x5c4558[_0x4df9('0x61')]);loggerPredictive['info'](_0x4df9('0x62'),_0x5c4558['erlangCallToSecond']);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x63'),_0x5c4558[_0x4df9('0x64')]);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x65'),_0x5c4558[_0x4df9('0x66')]);loggerPredictive['info'](_0x4df9('0x63'),_0x5c4558[_0x4df9('0x64')]);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x5b'));_[_0x4df9('0x67')](_0xa7e701,_0x5c4558);};}function ifInterval(_0x3da417,_0x456d57){if(_[_0x4df9('0x49')](_0x456d57)){return![];}return utils[_0x4df9('0x68')](undefined,_0x456d57)<_0x3da417*0x3c;}function clearPredictiveAttributes(_0x3133cf){if(_0x3133cf[_0x4df9('0x2c')]){_0x3133cf[_0x4df9('0x2c')]=undefined;loggerPredictive['debug'](_0x3133cf['name'],_0x4df9('0x69'));}if(_0x3133cf['startPredictive']){_0x3133cf[_0x4df9('0x2b')]=undefined;loggerPredictive['debug'](_0x3133cf[_0x4df9('0x6a')],_0x4df9('0x6b'));}if(_0x3133cf['handlePredictive']){clearInterval(_0x3133cf[_0x4df9('0x6c')]);_0x3133cf[_0x4df9('0x6c')]=undefined;loggerPredictive[_0x4df9('0x4d')](_0x3133cf['name'],_0x4df9('0x6d'));}}function loggerCatchPredictive(_0x28ab54,_0xb4b021){return function(_0xe8a59b){loggerPredictive[_0x4df9('0x6e')](_0xb4b021[_0x4df9('0x6a')],_0x28ab54);loggerPredictive['error'](_0xe8a59b[_0x4df9('0x6f')]);clearPredictiveAttributes(_0xb4b021);};}function loggerCatch(_0x28707b){return function(_0x44eb87){logger[_0x4df9('0x6e')](_0x28707b,util[_0x4df9('0x4f')](_0x44eb87,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2cc944,_0x154325,_0x26a8d7){return function(_0x5a3a28){utils[_0x4df9('0x70')](_0x154325,_0x26a8d7,0x0);_0x154325['temp']=0x0;logger[_0x4df9('0x6e')](_0x2cc944,util[_0x4df9('0x4f')](_0x5a3a28,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x183204){return function(_0x2feb00){if(isNotNull(_0x2feb00)&&isNotNull(_0x2feb00[0x0])){if(_0x2feb00[0x0][_0x4df9('0x71')]>0x0){_0x183204[_0x4df9('0x72')]=utils[_0x4df9('0x73')]['CONTACTS_RESCHEDULED'];logger[_0x4df9('0x53')]('[getContactDialer2][ReScheduled]'+_0x183204['name'],_0x2feb00[0x0][_0x4df9('0x71')],_0x4df9('0x74'));}else{_0x183204[_0x4df9('0x72')]=utils['CAMPAIGN_STATUS'][_0x4df9('0x75')];logger[_0x4df9('0x53')]('[getContactDialer2][Empty]'+_0x183204[_0x4df9('0x6a')]);}}};}function createObjHistory(_0x275ee0,_0x57cb31,_0x35b69c,_0x1fb771,_0x472419){_0x275ee0[_0x4df9('0x72')]=_0x35b69c;var _0x48de8d=new Action(_0x275ee0,_0x57cb31);var _0x376873=new History(_0x48de8d);_0x376873['state']=_0x1fb771;_0x376873[_0x4df9('0x76')]=_0x472419;_0x376873['endtime']=_0x48de8d[_0x4df9('0x77')];return _0x376873;}function unlockQueueStatus(_0x30045d,_0x44f62f){setTimeout(function(){if(_[_0x4df9('0x49')](_0x30045d[_0x4df9('0x78')])){loggerBooked[_0x4df9('0x6e')](_0x4df9('0x79'),_0x44f62f);}_0x30045d[_0x4df9('0x78')]=!![];loggerBooked['info'](_0x4df9('0x7a'),_0x44f62f,JSON[_0x4df9('0x7b')](_[_0x4df9('0x7c')](_0x30045d,[_0x4df9('0x6a'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x1e3824){return function(){if(!isNotNull(_0x1e3824[_0x4df9('0x7d')])){_0x1e3824['message']=utils[_0x4df9('0x73')]['NULL_INTERVAL'];throw _0x1e3824[_0x4df9('0x6a')]+_0x4df9('0x7e');}if(!isNotNull(_0x1e3824[_0x4df9('0x7d')]['Intervals'])){_0x1e3824[_0x4df9('0x72')]=utils[_0x4df9('0x73')]['NULL_INTERVAL'];throw _0x1e3824[_0x4df9('0x6a')]+_0x4df9('0x7e');}if(!isNotNull(_[_0x4df9('0x7f')](_0x1e3824['Interval'][_0x4df9('0x80')]))){_0x1e3824[_0x4df9('0x72')]=utils[_0x4df9('0x73')][_0x4df9('0x81')];throw _0x1e3824[_0x4df9('0x6a')]+_0x4df9('0x7e');}};}function checkIsIVRCampaignActive(_0x549bbb){return function(){if(!utils[_0x4df9('0x82')](_0x549bbb)){_0x549bbb['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x549bbb[_0x4df9('0x6a')]+_0x4df9('0x83');}};}function emitCampaignSummary(_0x9d6d83){if(utils[_0x4df9('0x84')](_0x9d6d83)){emit(util['format'](_0x4df9('0x85'),_0x9d6d83[_0x4df9('0x6a')]),_0x4df9('0x86'),_0x9d6d83);}}function loggerCatchQueueSummary(_0x51d0fe,_0x11ee59){return function(_0x73738a){clearPredictiveAttributes(_0x11ee59);emitCampaignSummary(_0x11ee59);loggerSyncQueueSummary[_0x4df9('0x4d')](_0x51d0fe,util[_0x4df9('0x4f')](_0x73738a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3e27e9){if(_0x3e27e9[_0x4df9('0x87')]){if(_0x3e27e9[_0x4df9('0x88')]===0x0){_0x3e27e9[_0x4df9('0x87')]=![];_0x3e27e9[_0x4df9('0x72')]=utils[_0x4df9('0x73')][_0x4df9('0x89')];loggerSyncQueueSummary[_0x4df9('0x4d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3e27e9[_0x4df9('0x6a')],'is\x20not\x20active');}else{_0x3e27e9[_0x4df9('0x72')]=utils[_0x4df9('0x73')][_0x4df9('0x8a')];loggerSyncQueueSummary[_0x4df9('0x4d')](_0x4df9('0x8b'),_0x3e27e9[_0x4df9('0x6a')],'is\x20disactive');}emitCampaignSummary(_0x3e27e9);}}function myreject(_0x41fcb8){return function(_0x1612b0){return _0x41fcb8(msgResponse('[ifTime][Action]',_0x4df9('0x8c'),JSON[_0x4df9('0x7b')](_0x1612b0)));};}Dialer[_0x4df9('0x1c')][_0x4df9('0x8d')]=function(_0x1b26f6){return!_[_0x4df9('0x49')](_0x1b26f6)&&_0x1b26f6&&!_['isUndefined'](_0x1b26f6['name'])&&!_[_0x4df9('0x49')](_0x1b26f6['active'])&&_0x1b26f6[_0x4df9('0x8e')]&&(this[_0x4df9('0x24')][util[_0x4df9('0x50')](_0x4df9('0x8f'),_0x1b26f6[_0x4df9('0x6a')])][_0x4df9('0x90')]===_0x4df9('0x91')||this[_0x4df9('0x24')][util['format'](_0x4df9('0x8f'),_0x1b26f6['name'])][_0x4df9('0x90')]===_0x4df9('0x92'));};Dialer[_0x4df9('0x1c')][_0x4df9('0x93')]=function(_0x1a258a){var _0x3d875a=this;return function(){if(!_0x3d875a[_0x4df9('0x8d')](_0x1a258a[_0x4df9('0x94')])){if(!_0x3d875a[_0x4df9('0x8d')](_0x1a258a[_0x4df9('0x95')])){_0x1a258a[_0x4df9('0x72')]=utils['CAMPAIGN_STATUS'][_0x4df9('0x96')];throw _0x1a258a[_0x4df9('0x6a')]+_0x4df9('0x97');}}};};Dialer[_0x4df9('0x1c')][_0x4df9('0x98')]=function(_0xb4d70a,_0x28b177,_0x16ff10,_0x1798e5){var _0x44cf75=this;return function(){var _0x1ceab0=!![];return _0x44cf75[_0x4df9('0x99')](_0xb4d70a,_0x28b177,_0x16ff10,_0x1798e5,_0x1ceab0);};};Dialer[_0x4df9('0x1c')][_0x4df9('0x9a')]=function(_0xefbc2a,_0x464a39,_0x3509d6,_0x1339ac){var _0x5d3589=this;return function(){var _0x40af57=![];return _0x5d3589[_0x4df9('0x99')](_0xefbc2a[_0x4df9('0x80')],_0x464a39,_0x3509d6,_0x1339ac,_0x40af57);};};Dialer[_0x4df9('0x1c')][_0x4df9('0x99')]=function(_0x149e2e,_0x54e08f,_0x333617,_0x587471,_0x295ccc){var _0x1f1451=[];return new Promise(function(_0x311ff7,_0x20419b){if(!isNotNull(_0x149e2e)){_0x587471[_0x4df9('0x72')]=utils[_0x4df9('0x73')][_0x4df9('0x81')];return _0x20419b(msgResponse(_0x4df9('0x9b'),'Failure',_0x333617+_0x4df9('0x9c')));}if(_[_0x4df9('0x7f')](_0x149e2e)){_0x587471[_0x4df9('0x72')]=utils[_0x4df9('0x73')]['EMPTY_INTERVAL'];return _0x20419b(msgResponse('ifTime',_0x4df9('0x9d'),_0x333617+_0x4df9('0x9e')));}if(_0x54e08f&&_[_0x4df9('0x49')](config[_0x4df9('0x9f')][_0x54e08f])){_0x587471[_0x4df9('0x72')]=utils[_0x4df9('0x73')][_0x4df9('0xa0')];return _0x20419b(msgResponse(_0x4df9('0x9b'),_0x4df9('0x9d'),_0x333617+_0x4df9('0xa1')+_0x54e08f));}if(_[_0x4df9('0xa2')](_0x149e2e)){for(var _0x59af60=0x0;_0x59af60<_0x149e2e['length'];_0x59af60+=0x1){_0x1f1451[_0x4df9('0xa3')](ami[_0x4df9('0xa4')]({'action':_0x4df9('0xa5'),'command':util['format'](_0x4df9('0xa6'),_0x149e2e[_0x59af60]['interval'],!_[_0x4df9('0x49')](config[_0x4df9('0x9f')][_0x54e08f])?_0x54e08f:'')})[_0x4df9('0x47')](function(_0xd165e8){return _0xd165e8[_0x4df9('0xa7')]['indexOf'](_0x4df9('0xa8'))>=0x0;})['catch'](myreject(_0x20419b)));}}else{_0x1f1451[_0x4df9('0xa3')](ami[_0x4df9('0xa4')]({'action':_0x4df9('0xa5'),'command':util[_0x4df9('0x50')](_0x4df9('0xa6'),_0x149e2e,!_[_0x4df9('0x49')](config[_0x4df9('0x9f')][_0x54e08f])?_0x54e08f:'')})['then'](function(_0x11b577){return _0x11b577[_0x4df9('0xa7')][_0x4df9('0xa9')](_0x4df9('0xa8'))>=0x0;})[_0x4df9('0xaa')](myreject(_0x20419b)));}Promise[_0x4df9('0xab')](_0x1f1451)['then'](function(_0x50c7ba){var _0x517bee=_[_0x4df9('0xac')](_0x50c7ba);if(_0x517bee){return _0x311ff7(_0x517bee);}else{_0x587471['message']=_0x295ccc?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x4df9('0x73')][_0x4df9('0xad')];return _0x20419b(msgResponse(_0x4df9('0xae'),_0x4df9('0x9d'),'Global:\x20'+_0x295ccc+'\x20'+_0x333617+_0x4df9('0xaf')+util['inspect'](_0x149e2e,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x54e08f));}})[_0x4df9('0xaa')](function(_0x33f89f){return _0x20419b(msgResponse('ifTime',_0x4df9('0x9d'),JSON[_0x4df9('0x7b')](_0x33f89f)));});});};Dialer[_0x4df9('0x1c')]['loopCampaigns']=function(){var _0xdd9f60=this;return cmHopper[_0x4df9('0xb0')]({'active':![]},{'where':{'active':!![]}})[_0x4df9('0x47')](function(){setInterval(function(){_0xdd9f60['syncCampaigns']();},0x3e8);});};Dialer[_0x4df9('0x1c')][_0x4df9('0xb1')]=function(){var _0x44864f=this;var _0x1b55df;for(var _0x52bb9f in this[_0x4df9('0x22')]){if(typeof this[_0x4df9('0x22')][_0x52bb9f]!=='undefined'){_0x1b55df=this[_0x4df9('0x22')][_0x52bb9f];if(utils['isIVRCampaign'](_0x1b55df)&&utils[_0x4df9('0x82')](_0x1b55df)){_0x1b55df[_0x4df9('0x87')]=!![];Promise[_0x4df9('0xb2')]()[_0x4df9('0x47')](checkIsIVRCampaignActive(_0x1b55df))['then'](checkInterval(_0x1b55df))[_0x4df9('0x47')](_0x44864f[_0x4df9('0x93')](_0x1b55df))['then'](_0x44864f[_0x4df9('0x98')](_0x1b55df['dialGlobalInterval'],_0x1b55df[_0x4df9('0xb3')],_0x1b55df[_0x4df9('0x6a')],_0x1b55df))[_0x4df9('0x47')](_0x44864f[_0x4df9('0x9a')](_0x1b55df['Interval'],_0x1b55df[_0x4df9('0xb3')],_0x1b55df[_0x4df9('0x6a')],_0x1b55df))[_0x4df9('0x47')](_0x44864f['launchHandleIvr'](_0x1b55df))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x1b55df));}else{notSendMessagesCampaign(_0x1b55df);}}}};Dialer[_0x4df9('0x1c')][_0x4df9('0xb4')]=function(_0x549f5f){if(_0x549f5f[_0x4df9('0xb5')]!=='predictive'){clearPredictiveAttributes(_0x549f5f);}switch(_0x549f5f[_0x4df9('0xb5')]){case _0x4df9('0xb6'):this[_0x4df9('0xb7')](_0x549f5f,0x1);break;case _0x4df9('0xb8'):this[_0x4df9('0xb7')](_0x549f5f,_0x549f5f[_0x4df9('0xb9')]);break;case'predictive':this[_0x4df9('0x9')](_0x549f5f);break;case _0x4df9('0x8'):this[_0x4df9('0xb7')](_0x549f5f,0x1);break;default:logger[_0x4df9('0x6e')](_0x4df9('0xba'),_0x549f5f['name'],_0x4df9('0xbb'));}};Dialer[_0x4df9('0x1c')]['ifTime']=function(_0x419823,_0x143ab8){var _0x10c924=_0x419823['dialTimezone'];var _0x5867e6=_0x143ab8?_0x419823[_0x4df9('0xbc')]:_0x419823['Interval'][_0x4df9('0x80')];logger[_0x4df9('0xbd')]('Dialer::ifTime()',_0x5867e6,_0x10c924,_0x419823['name'],util[_0x4df9('0x50')]('Voice\x20Queue\x20%s\x20$s',_0x419823[_0x4df9('0x6a')],_0x419823['id']));var _0x22b609=null;return Interval['intervalIftime'](_0x5867e6,_0x10c924)[_0x4df9('0x47')](function(_0x21ce5f){if(_0x21ce5f===!![]){return _0x21ce5f;}else{_0x419823[_0x4df9('0x72')]=_0x143ab8?utils['CAMPAIGN_STATUS'][_0x4df9('0xbe')]:utils['CAMPAIGN_STATUS'][_0x4df9('0xad')];_0x22b609=msgResponse(_0x4df9('0xae'),_0x4df9('0x9d'),'Global:\x20'+_0x143ab8+'\x20'+_0x419823[_0x4df9('0x6a')]+_0x4df9('0xaf')+util[_0x4df9('0x4f')](_0x5867e6,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x10c924);}if(_0x22b609!==null){logger[_0x4df9('0xbd')](_0x4df9('0xbf'),_0x22b609);_0x22b609['isGlobal']=_0x143ab8;throw _0x22b609;}})[_0x4df9('0xaa')](function(_0x13e5aa){logger[_0x4df9('0x6e')](_0x4df9('0xc0'),_0x13e5aa);throw msgResponse(_0x4df9('0xc1'),_0x4df9('0x8c'),util[_0x4df9('0x4f')](_0x13e5aa,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x4df9('0x31')]=function(_0xd15af1){if(this[_0x4df9('0x21')][_0xd15af1[_0x4df9('0xc2')]]){if(this[_0x4df9('0x29')][_0xd15af1[_0x4df9('0xc3')]]&&this[_0x4df9('0x29')][_0xd15af1['uniqueid']]['type']!==_0x4df9('0xc4')){this['updateOriginated'](this[_0x4df9('0x21')][_0xd15af1[_0x4df9('0xc2')]]);this[_0x4df9('0x29')][_0xd15af1[_0x4df9('0xc3')]][_0x4df9('0xc5')]=moment()['format'](_0x4df9('0xc6'));}}};Dialer[_0x4df9('0x1c')][_0x4df9('0x37')]=function(_0x144b48){var _0x115cb8=this[_0x4df9('0x29')][_0x144b48[_0x4df9('0xc3')]];if(this[_0x4df9('0x21')][_0x144b48[_0x4df9('0xc2')]]){if(_0x115cb8&&_0x115cb8['type']!==_0x4df9('0xc4')){delete this[_0x4df9('0x29')][_0x144b48[_0x4df9('0xc3')]];this[_0x4df9('0x21')][_0x144b48['queue']][_0x4df9('0xc7')]+=0x1;var _0x17b067=new AgentComplete(_0x115cb8,_0x144b48);if(_0x144b48[_0x4df9('0xc8')]===_0x4df9('0xc9')){_0x17b067[_0x4df9('0xca')]=this['voiceQueues'][_0x144b48[_0x4df9('0xc2')]][_0x4df9('0xcb')]&&this[_0x4df9('0x21')][_0x144b48[_0x4df9('0xc2')]]['dialAgiAfterHangupAgent']?moment()[_0x4df9('0x50')](_0x4df9('0xc6')):undefined;}hopperUtils[_0x4df9('0xcc')](_0x17b067)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0xcd')));hopperUtils[_0x4df9('0xce')](_0x17b067)['catch'](loggerCatch(_0x4df9('0xcf')));}}};Dialer[_0x4df9('0x1c')][_0x4df9('0x33')]=function(_0x3c0be8){var _0x47c9e2=this[_0x4df9('0x29')][_0x3c0be8['uniqueid']];var _0x40b0c8=this;var _0xaf3225=![];var _0x441ce6;var _0xd536fc;if(this[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]]){if(_0x47c9e2&&_0x47c9e2[_0x4df9('0x4b')]!==_0x4df9('0xc4')){delete this[_0x4df9('0x29')][_0x3c0be8[_0x4df9('0xc3')]];this['updateOriginated'](this[_0x4df9('0x21')][_0x3c0be8['queue']]);_0x47c9e2[_0x4df9('0xd0')]=moment()[_0x4df9('0x50')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2701d9=new QueueCallerAbandon(_0x47c9e2,_0x3c0be8);if(utils['getSeconds'](_0x47c9e2['droptime'],_0x47c9e2[_0x4df9('0xd1')])>=_0x47c9e2[_0x4df9('0xd2')]){this['voiceQueues'][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xd3')]+=0x1;this[_0x4df9('0x21')][_0x3c0be8['queue']][_0x4df9('0xd4')]+=0x1;this[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xd5')]+=0x1;_0x2701d9[_0x4df9('0xd6')]=0xa;_0x2701d9['statedesc']=_0x4df9('0xd7');_0x2701d9[_0x4df9('0xd8')]=_0x4df9('0xd9');_0x2701d9['agiafterat']=this['voiceQueues'][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xcb')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2701d9['countdropretry']+=0x1;_0x2701d9[_0x4df9('0xda')]+=0x1;_0x441ce6=this[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xdb')];_0xd536fc=this[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xdc')];hopperUtils[_0x4df9('0xdd')](_0x2701d9,_0x2701d9[_0x4df9('0xd6')],_0x47c9e2[_0x4df9('0xde')])[_0x4df9('0x47')](function(_0x3ff47a){_0xaf3225=_0x3ff47a[_0x4df9('0xdf')]==0x1;if(_0x2701d9[_0x4df9('0xe0')]>=_0x40b0c8[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xe1')]){_0x40b0c8[_0x4df9('0xe2')](_0x2701d9,_0x3ff47a['additional']);}else{hopperUtils[_0x4df9('0xe3')]({'active':![],'countdropretry':_0x2701d9[_0x4df9('0xe0')],'scheduledat':moment()[_0x4df9('0xe4')](_0x40b0c8[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]]['dialDropRetryFrequency'],_0x4df9('0xe5'))[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x47c9e2['ContactId'],'ListId':_0x47c9e2[_0x4df9('0xe6')],'VoiceQueueId':_0x47c9e2[_0x4df9('0xe7')]||undefined,'CampaignId':_0x47c9e2[_0x4df9('0xe8')]||undefined})['catch'](loggerCatch(_0x4df9('0xe9')));var _0x545a1a=new History(_0x2701d9);_0x545a1a[_0x4df9('0xd6')]=0xa;_0x545a1a[_0x4df9('0x76')]=_0x4df9('0xd7');_0x545a1a['starttime']=moment()[_0x4df9('0x50')](_0x4df9('0xc6'));_0x545a1a[_0x4df9('0xea')]=_0x545a1a['starttime'];_0x545a1a['calleridname']=_0x2701d9[_0x4df9('0xeb')];_0x545a1a[_0x4df9('0xec')]=_0x2701d9['calleridnum'];hopperUtils[_0x4df9('0xcc')](_0x545a1a)['catch'](loggerCatch(_0x4df9('0xed')));}})[_0x4df9('0x47')](function(){if(_0xaf3225)hopperUtils[_0x4df9('0xee')](_0x2701d9,_0x441ce6,_0xd536fc)[_0x4df9('0x47')](function(){return 0x1;});});}else{this[_0x4df9('0x21')][_0x3c0be8['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xef')]+=0x1;_0x2701d9[_0x4df9('0xd6')]=0xb;_0x2701d9['statedesc']='Abandoned';_0x2701d9[_0x4df9('0xd8')]=_0x4df9('0xf0');_0x2701d9[_0x4df9('0xf1')]+=0x1;_0x2701d9[_0x4df9('0xda')]+=0x1;_0x441ce6=this[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xf2')];_0xd536fc=this['voiceQueues'][_0x3c0be8['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x4df9('0xdd')](_0x2701d9,_0x2701d9[_0x4df9('0xd6')],_0x47c9e2[_0x4df9('0xde')])[_0x4df9('0x47')](function(_0x280135){if(_0x2701d9[_0x4df9('0xf1')]>=_0x40b0c8[_0x4df9('0x21')][_0x3c0be8[_0x4df9('0xc2')]][_0x4df9('0xf3')]){_0x40b0c8[_0x4df9('0xe2')](_0x2701d9,_0x280135[_0x4df9('0xdf')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2701d9['countabandonedretry'],'scheduledat':moment()[_0x4df9('0xe4')](_0x40b0c8[_0x4df9('0x21')][_0x3c0be8['queue']][_0x4df9('0xf2')],_0x4df9('0xe5'))[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x47c9e2[_0x4df9('0xf4')],'ListId':_0x47c9e2[_0x4df9('0xe6')],'VoiceQueueId':_0x47c9e2[_0x4df9('0xe7')]||undefined,'CampaignId':_0x47c9e2[_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch(_0x4df9('0xf5')));var _0x437c41=new History(_0x2701d9);_0x437c41[_0x4df9('0xd6')]=0xb;_0x437c41['statedesc']='Abandoned';_0x437c41[_0x4df9('0x77')]=moment()[_0x4df9('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x437c41[_0x4df9('0xea')]=_0x437c41[_0x4df9('0x77')];_0x437c41[_0x4df9('0xeb')]=_0x2701d9[_0x4df9('0xeb')];_0x437c41[_0x4df9('0xec')]=_0x2701d9[_0x4df9('0xec')];hopperUtils[_0x4df9('0xcc')](_0x437c41)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0xf6')));}})[_0x4df9('0x47')](function(){if(_0xaf3225)hopperUtils[_0x4df9('0xee')](_0x2701d9,_0x441ce6,_0xd536fc)[_0x4df9('0x47')](function(){return 0x1;});});}}}};Dialer[_0x4df9('0x1c')][_0x4df9('0x3d')]=function(_0x11c266){if(this[_0x4df9('0x27')][_0x11c266[_0x4df9('0xc3')]]){this['actions'][_0x11c266[_0x4df9('0xc3')]][_0x4df9('0xf7')]=_0x11c266[_0x4df9('0xf7')];}if(this[_0x4df9('0x29')][_0x11c266[_0x4df9('0xc3')]]){this[_0x4df9('0x29')][_0x11c266[_0x4df9('0xc3')]][_0x4df9('0xf7')]=_0x11c266[_0x4df9('0xf7')];}};Dialer[_0x4df9('0x1c')]['syncQueueMember']=function(_0x733b12){if(!this['actions'][_0x733b12[_0x4df9('0xf8')]]){return;}var _0x14dfbd=this['voiceQueues'][this[_0x4df9('0x27')][_0x733b12[_0x4df9('0xf8')]]['queue']][_0x4df9('0xf9')]||_0x4df9('0xfa');if(_0x14dfbd===_0x4df9('0xfb')){if(this[_0x4df9('0x27')][_0x733b12[_0x4df9('0xf8')]]&&_[_0x4df9('0xfc')](this[_0x4df9('0x27')][_0x733b12['actionid']][_0x4df9('0xfd')])&&_0x733b12['status']==='1'&&_0x733b12[_0x4df9('0xfe')]==='0'){if(this['agents'][_0x733b12[_0x4df9('0xff')]]){if(!this[_0x4df9('0x23')][_0x733b12[_0x4df9('0xff')]][_0x4df9('0xfd')]){this[_0x4df9('0x23')][_0x733b12['stateinterface']][_0x4df9('0xfd')]=!![];this[_0x4df9('0x27')][_0x733b12['actionid']][_0x4df9('0xfd')]=!![];this[_0x4df9('0x27')][_0x733b12['actionid']][_0x4df9('0xff')]=_0x733b12['stateinterface'];}}}}else if(_0x14dfbd==='rrmemory'){if(this['actions'][_0x733b12[_0x4df9('0xf8')]]){if(this[_0x4df9('0x23')][_0x733b12[_0x4df9('0xff')]]){this[_0x4df9('0x27')][_0x733b12['actionid']][_0x4df9('0xff')]=_0x733b12[_0x4df9('0xff')];if(_[_0x4df9('0xfc')](this['queueBooked'][this[_0x4df9('0x27')][_0x733b12['actionid']][_0x4df9('0xc2')]])){this[_0x4df9('0x2e')][this[_0x4df9('0x27')][_0x733b12['actionid']][_0x4df9('0xc2')]]=[];}this['queueBooked'][this['actions'][_0x733b12[_0x4df9('0xf8')]][_0x4df9('0xc2')]][_0x4df9('0xa3')](_[_0x4df9('0x67')](_['pick'](this[_0x4df9('0x27')][_0x733b12[_0x4df9('0xf8')]],[_0x4df9('0x100'),_0x4df9('0xff')]),{'status':_0x733b12['status'],'paused':_0x733b12['paused']}));}}}};Dialer[_0x4df9('0x1c')][_0x4df9('0x43')]=function(_0x333175){if(!this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]]){return;}var _0x3bc8e7=this;var _0x11a764=this[_0x4df9('0x21')][this[_0x4df9('0x27')][_0x333175['actionid']][_0x4df9('0xc2')]];var _0x4a1b02=_0x11a764[_0x4df9('0xf9')]||_0x4df9('0xfa');if(_0x4a1b02==='roundrobin'){if(this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]]&&this[_0x4df9('0x27')][_0x333175['actionid']][_0x4df9('0xff')]){this[_0x4df9('0x20')][_0x4df9('0x101')](this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]][_0x4df9('0x100')],this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]]['stateinterface'])['catch'](function(_0x39188d){logger[_0x4df9('0x6e')](_0x4df9('0x102'),util['inspect'](_0x39188d,{'showHidden':![],'depth':null}));})[_0x4df9('0x1e')](function(){_0x3bc8e7[_0x4df9('0x103')](_0x3bc8e7[_0x4df9('0x21')][_0x3bc8e7[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xc2')]]);_0x3bc8e7[_0x4df9('0x23')][_0x3bc8e7[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xff')]][_0x4df9('0xfd')]=![];delete _0x3bc8e7[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]];unlockQueueStatus(_0x11a764);});}else{this[_0x4df9('0x103')](this[_0x4df9('0x21')][this['actions'][_0x333175[_0x4df9('0xf8')]]['queue']]);hopperUtils[_0x4df9('0xe3')]({'active':![],'ContactId':this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]]['ContactId'],'ListId':this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]]['ListId'],'VoiceQueueId':this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xe7')]||undefined,'CampaignId':this['actions'][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]];unlockQueueStatus(_0x11a764);}}else if(_0x4a1b02===_0x4df9('0xfa')){var _0x2c9bb2;if(this[_0x4df9('0x27')][_0x333175['actionid']]&&!_[_0x4df9('0x7f')](this[_0x4df9('0x2e')][this[_0x4df9('0x27')][_0x333175['actionid']][_0x4df9('0xc2')]])){if(this[_0x4df9('0x2f')][_0x3bc8e7[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xc2')]]){this[_0x4df9('0x2f')][_0x3bc8e7['actions'][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xc2')]]=this['queueBookedRR'][this[_0x4df9('0x27')][_0x333175['actionid']][_0x4df9('0xc2')]]?this[_0x4df9('0x2f')][this['actions'][_0x333175['actionid']][_0x4df9('0xc2')]]:this['queueBooked'][this['actions'][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xc2')]]?this[_0x4df9('0x2e')][this[_0x4df9('0x27')][_0x333175[_0x4df9('0xf8')]][_0x4df9('0xc2')]][_0x4df9('0x104')]||0x0:0x0;}this['queueBooked'][this[_0x4df9('0x27')][_0x333175['actionid']][_0x4df9('0xc2')]][_0x4df9('0x104')]=this[_0x4df9('0x2f')][this[_0x4df9('0x27')][_0x333175['actionid']][_0x4df9('0xc2')]];for(var _0x47ca54=0x0;_0x47ca54=_0x22c7fc['dialGlobalMaxRetry']){_0x56d07f[_0x4df9('0x126')](_0x2401d3,_0x597d2f,_0x5a98d9,'reason19\x20machine....');}else{if(_0x2401d3[_0x4df9('0x120')]>=_0x22c7fc[_0x4df9('0x127')]){_0x56d07f[_0x4df9('0x128')](_0x2401d3,_0x597d2f,_0x5a98d9,_0x4df9('0x129'));}else{hopperUtils[_0x4df9('0xe3')]({'active':![],'countmachineretry':_0x2401d3[_0x4df9('0x120')],'scheduledat':moment()[_0x4df9('0xe4')](_0x22c7fc['dialMachineRetryFrequency'],_0x4df9('0xe5'))[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x2401d3[_0x4df9('0xf4')],'ListId':_0x2401d3['ListId'],'VoiceQueueId':_0x2401d3['VoiceQueueId']||undefined,'CampaignId':_0x2401d3['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x597d2f({'reschedule':0x1});}}});}if(_0x335c15['type']===_0x4df9('0xc4')&&this[_0x4df9('0x22')][_0x335c15[_0x4df9('0xc2')]][_0x4df9('0x12a')]&&_0x212f71['value']==='HANGUP'){delete this['uniqueId'][_0x212f71[_0x4df9('0xc3')]];this[_0x4df9('0x103')](this[_0x4df9('0x22')][_0x335c15[_0x4df9('0xc2')]]);_0xab9cf6=new Hangup(_0x335c15,_0x212f71);_0xab9cf6[_0x4df9('0xd6')]=0x12;_0xab9cf6[_0x4df9('0x76')]=_0x4df9('0x117');_0xab9cf6[_0x4df9('0x118')]=_0x4df9('0x119');ami[_0x4df9('0x4a')](_0x4df9('0x11a'),ut[_0x4df9('0x11b')](_0xab9cf6,_0x4df9('0x11c')));this[_0x4df9('0x11d')](_0xab9cf6,'[syncHangupInAMDIvr][createHistory]',_0x4df9('0x12b'));}if(_0x335c15[_0x4df9('0x4b')]===_0x4df9('0xc4')&&this[_0x4df9('0x22')][_0x335c15[_0x4df9('0xc2')]]['dialAMDActive']&&_0x212f71[_0x4df9('0x114')]===_0x4df9('0x12c')){return new Promise(function(_0x56c78b,_0x34961f){delete _0x56d07f[_0x4df9('0x29')][_0x212f71[_0x4df9('0xc3')]];_0x56d07f[_0x4df9('0x103')](_0x56d07f['campaigns'][_0x335c15[_0x4df9('0xc2')]]);_0x56d07f[_0x4df9('0x22')][_0x335c15[_0x4df9('0xc2')]][_0x4df9('0xc7')]+=0x1;_0x56d07f[_0x4df9('0x22')][_0x335c15[_0x4df9('0xc2')]][_0x4df9('0x116')]+=0x1;var _0x2b3ec2=_0x56d07f[_0x4df9('0x22')][_0x335c15[_0x4df9('0xc2')]];var _0x43ac35=new Hangup(_0x335c15,_0x212f71);_0x43ac35['state']=0x13;_0x43ac35[_0x4df9('0x76')]='Machine';_0x43ac35[_0x4df9('0x118')]=_0x4df9('0x119');_0x43ac35[_0x4df9('0x120')]+=0x1;_0x43ac35[_0x4df9('0xda')]+=0x1;_0x43ac35['amd']=!![];ami[_0x4df9('0x4a')]('custom:amd',ut['buildObj'](_0x43ac35,_0x4df9('0x11c')));hopperUtils['createHistory'](_0x43ac35)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x43ac35[_0x4df9('0x122')]+_0x43ac35[_0x4df9('0x123')]+_0x43ac35['countnoanswerretry']+_0x43ac35['countnosuchnumberretry']+_0x43ac35[_0x4df9('0xe0')]+_0x43ac35['countabandonedretry']+_0x43ac35[_0x4df9('0x120')]+_0x43ac35[_0x4df9('0x125')]>=_0x2b3ec2[_0x4df9('0x12d')]){_0x56d07f['stateGlobal'](_0x43ac35,_0x56c78b,_0x34961f,_0x4df9('0x12e'));}else{if(_0x43ac35['countmachineretry']>=_0x2b3ec2[_0x4df9('0x127')]){_0x56d07f[_0x4df9('0x128')](_0x43ac35,_0x56c78b,_0x34961f,_0x4df9('0x129'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x43ac35[_0x4df9('0x120')],'scheduledat':moment()[_0x4df9('0xe4')](_0x2b3ec2[_0x4df9('0x12f')],_0x4df9('0xe5'))['format'](_0x4df9('0xc6')),'ContactId':_0x43ac35[_0x4df9('0xf4')],'ListId':_0x43ac35[_0x4df9('0xe6')],'VoiceQueueId':_0x43ac35[_0x4df9('0xe7')]||undefined,'CampaignId':_0x43ac35[_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch('[rescheduleContact][Machine]'));_0x56c78b({'reschedule':0x1});}}});}}};Dialer[_0x4df9('0x1c')][_0x4df9('0x130')]=function(_0x28d1a6){var _0x4c181a=this['uniqueId'][_0x28d1a6[_0x4df9('0xc3')]];var _0x5a8d13;if(_0x4c181a&&_0x4c181a[_0x4df9('0x4b')]===_0x4df9('0xc4')){delete this[_0x4df9('0x29')][_0x28d1a6[_0x4df9('0xc3')]];this[_0x4df9('0x103')](this[_0x4df9('0x22')][_0x4c181a[_0x4df9('0xc2')]]);this[_0x4df9('0x22')][_0x4c181a[_0x4df9('0xc2')]][_0x4df9('0x131')]+=0x1;_0x5a8d13=new Hangup(_0x4c181a,_0x28d1a6);hopperUtils[_0x4df9('0xcc')](_0x5a8d13)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x132')));hopperUtils['moveContactManagedDialer'](_0x5a8d13)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x133')));}if(_0x4c181a&&_0x4c181a['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x4c181a[_0x4df9('0xc2')]][_0x4df9('0x134')])){delete this[_0x4df9('0x29')][_0x28d1a6[_0x4df9('0xc3')]];this[_0x4df9('0x103')](this[_0x4df9('0x21')][_0x4c181a[_0x4df9('0xc2')]]);this['voiceQueues'][_0x4c181a['queue']][_0x4df9('0xc7')]+=0x1;this[_0x4df9('0x21')][_0x4c181a[_0x4df9('0xc2')]][_0x4df9('0x116')]+=0x1;_0x5a8d13=new Hangup(_0x4c181a,_0x28d1a6);_0x5a8d13[_0x4df9('0xd6')]=0x10;_0x5a8d13[_0x4df9('0x76')]=_0x4df9('0x135');_0x5a8d13[_0x4df9('0x118')]='AGI';hopperUtils[_0x4df9('0xcc')](_0x5a8d13)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x132')));hopperUtils[_0x4df9('0xce')](_0x5a8d13)['catch'](loggerCatch(_0x4df9('0x133')));}if(_0x4c181a&&_0x4c181a[_0x4df9('0x4b')]!==_0x4df9('0xc4')&&!isNotNull(this[_0x4df9('0x21')][_0x4c181a[_0x4df9('0xc2')]][_0x4df9('0x134')])){if(_0x28d1a6[_0x4df9('0x136')]==='Normal\x20Clearing'){delete this[_0x4df9('0x29')][_0x28d1a6[_0x4df9('0xc3')]];this[_0x4df9('0x21')][_0x4c181a[_0x4df9('0xc2')]][_0x4df9('0xc7')]+=0x1;const _0x24cd91=new AgentComplete(_0x4c181a,_0x28d1a6);_0x24cd91[_0x4df9('0xe8')]=this[_0x4df9('0x21')][_0x4c181a[_0x4df9('0xc2')]]['id'];hopperUtils['createHistory'](_0x24cd91)[_0x4df9('0xaa')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x4df9('0xce')](_0x24cd91)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0xcf')));}else{delete this[_0x4df9('0x29')][_0x28d1a6[_0x4df9('0xc3')]];this[_0x4df9('0x103')](this['voiceQueues'][_0x4c181a[_0x4df9('0xc2')]]);this[_0x4df9('0x21')][_0x4c181a['queue']][_0x4df9('0x137')]+=0x1;_0x5a8d13=new Hangup(_0x4c181a,_0x28d1a6);_0x5a8d13['state']=0xc;_0x5a8d13['statedesc']=_0x28d1a6[_0x4df9('0x136')];_0x5a8d13['membername']=_0x4df9('0x138');hopperUtils['createHistory'](_0x5a8d13)['catch'](loggerCatch(_0x4df9('0x132')));hopperUtils['moveContactManagedDialer'](_0x5a8d13)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x133')));}}};Dialer[_0x4df9('0x1c')]['syncQueueSummary']=function(_0x367c5d){var _0x2ebce3=this;if(!_0x2ebce3['queuesSummary'][_0x367c5d[_0x4df9('0x6a')]]){_0x2ebce3[_0x4df9('0x139')][_0x367c5d[_0x4df9('0x6a')]]={'running':![]};}else if(_0x2ebce3[_0x4df9('0x139')][_0x367c5d[_0x4df9('0x6a')]][_0x4df9('0x13a')]===!![]){return;}else if(_0x2ebce3[_0x4df9('0x139')][_0x367c5d['name']][_0x4df9('0x13a')]===![]){_0x2ebce3[_0x4df9('0x139')][_0x367c5d[_0x4df9('0x6a')]]['running']=!![];}var _0xfec325=_0x2ebce3[_0x4df9('0x21')][_0x367c5d[_0x4df9('0x6a')]];var _0x5c20c5=_0xfec325[_0x4df9('0x72')]!==utils[_0x4df9('0x73')][_0x4df9('0x89')];var _0x83f91b=utils[_0x4df9('0x13b')](_0xfec325);_0xfec325['statusMessage']=utils[_0x4df9('0x13c')](_0xfec325,_0x2ebce3['trunks']);Promise['resolve']()[_0x4df9('0x47')](function(){if(_0xfec325[_0x4df9('0x13d')]===utils[_0x4df9('0x73')][_0x4df9('0x89')]){if(_0x5c20c5){clearPredictiveAttributes(_0xfec325);_0x367c5d[_0x4df9('0x2b')]=undefined;_0x367c5d[_0x4df9('0x2c')]=undefined;}if(_0xfec325[_0x4df9('0x13d')]===utils[_0x4df9('0x73')][_0x4df9('0x89')]){_0x367c5d[_0x4df9('0x13e')]=0x0;_0x367c5d[_0x4df9('0xfe')]=0x0;_0x367c5d['inUse']=0x0;_0x367c5d[_0x4df9('0x13f')]=0x0;_0x367c5d[_0x4df9('0x140')]=0x0;}}else if(_0xfec325[_0x4df9('0x13d')]===utils[_0x4df9('0x73')][_0x4df9('0x141')]&&!_0x83f91b){return _0x2ebce3['ifTime'](_0xfec325,!![])[_0x4df9('0x47')](function(){return _0x2ebce3[_0x4df9('0x9b')](_0xfec325,![]);})[_0x4df9('0x47')](function(){return _0x2ebce3[_0x4df9('0xb4')](_0xfec325);})['catch'](function(_0x135ad1){loggerSyncQueueSummary[_0x4df9('0x4d')](_0x4df9('0x142'),util['inspect'](_0x135ad1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xfec325);});}else{clearPredictiveAttributes(_0xfec325);}})[_0x4df9('0x47')](function(){var _0x5e4d93=_0x367c5d['compareToOutboundQueue'](_0xfec325);if(_0x5e4d93||_0xfec325[_0x4df9('0x143')]){_0xfec325['queueSummaryCountersUpdated']=![];_0x367c5d[_0x4df9('0x144')](_0xfec325);Object[_0x4df9('0x145')](_0xfec325,_0x367c5d);emitOutboundVoiceQueueSummary(_0x367c5d);}_0x2ebce3[_0x4df9('0x139')][_0xfec325[_0x4df9('0x6a')]]['running']=![];})[_0x4df9('0xaa')](function(_0x1df228){logger[_0x4df9('0x6e')](_0x4df9('0x142'),util[_0x4df9('0x4f')](_0x1df228,{'showHidden':![],'depth':null}));_0x2ebce3[_0x4df9('0x139')][_0xfec325[_0x4df9('0x6a')]]['running']=![];});};Dialer[_0x4df9('0x1c')][_0x4df9('0x3a')]=_[_0x4df9('0x146')](function(){var _0x58eb69=_['filter'](this['voiceQueues'],function(_0xaf27c9){return _0xaf27c9[_0x4df9('0x147')];});var _0x56cfe6=_[_0x4df9('0x148')](this[_0x4df9('0x23')],function(_0x566f91){return _0x566f91[_0x4df9('0x149')]&&_0x566f91[_0x4df9('0x90')]===_0x4df9('0x91');});if(_0x58eb69[_0x4df9('0x14a')]>0x0&&_0x56cfe6[_0x4df9('0x14a')]>0x0){return Promise[_0x4df9('0xb2')]()['then'](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x58eb69,'id'),previewRecallmeReminderInterval,_[_0x4df9('0x14b')](_0x56cfe6,'id')))['then'](function(_0x4db459){for(var _0x4e66c1=0x0;_0x4e66c1<_0x4db459[_0x4df9('0x14a')];_0x4e66c1++){var _0x367365=_0x4db459[_0x4e66c1]['Agent'][_0x4df9('0x6a')];if(_0x367365)io['to'](util[_0x4df9('0x50')](_0x4df9('0x14c'),_0x367365))[_0x4df9('0x4a')](_0x4df9('0x14d'),{'hopper':_0x4db459[_0x4e66c1]});}})[_0x4df9('0xaa')](function(_0x9bfbb4){logger[_0x4df9('0x6e')](_0x4df9('0x14e'),_0x9bfbb4);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4df9('0x1c')][_0x4df9('0x45')]=function(){var _0x17f27f=this;setInterval(function(){_0x17f27f['clearZombieChannels'](_0x17f27f['uniqueId'],_0x4df9('0x14f'));_0x17f27f[_0x4df9('0x150')](_0x17f27f[_0x4df9('0x27')],_0x4df9('0x151'));},0x32c8);};Dialer['prototype'][_0x4df9('0x150')]=function(_0x103fd0,_0x3f00b1){var _0x2eaada=this;for(var _0x55bd98 in _0x103fd0){if(typeof _0x103fd0[_0x55bd98]!=='undefined'){this[_0x4df9('0x1f')][_0x4df9('0x152')](function(){if(!_[_0x4df9('0xfc')](_0x103fd0[_0x55bd98])){return ami[_0x4df9('0xa4')]({'action':'status','channel':_0x103fd0[_0x55bd98][_0x4df9('0xf7')]})[_0x4df9('0xaa')](function(_0x1e2bb5){if(_0x1e2bb5['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x103fd0[_0x55bd98]&&_0x103fd0[_0x55bd98]['type']!==_0x4df9('0xc4')){_0x2eaada[_0x4df9('0x103')](_0x2eaada[_0x4df9('0x21')][_0x103fd0[_0x55bd98]['queue']]);logger[_0x4df9('0x6e')](_0x4df9('0x153'),_0x3f00b1,_0x55bd98,_0x103fd0[_0x55bd98][_0x4df9('0xc2')]);delete _0x103fd0[_0x55bd98];}if(_0x103fd0[_0x55bd98]&&_0x103fd0[_0x55bd98][_0x4df9('0x4b')]===_0x4df9('0xc4')){_0x2eaada['updateOriginated'](_0x2eaada[_0x4df9('0x22')][_0x103fd0[_0x55bd98][_0x4df9('0xc2')]]);logger[_0x4df9('0x6e')](_0x4df9('0x154'),_0x3f00b1,_0x55bd98,_0x103fd0[_0x55bd98][_0x4df9('0xc2')]);delete _0x103fd0[_0x55bd98];}},0x2328);}});}});}}};Dialer['prototype'][_0x4df9('0x155')]=function(_0x2dbe5c){return Promise[_0x4df9('0xb2')]()[_0x4df9('0x47')](voiceQueueRt[_0x4df9('0x155')](_0x2dbe5c))[_0x4df9('0xaa')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x4df9('0x1c')][_0x4df9('0x103')]=function(_0x1a1cf3){if(!_[_0x4df9('0x49')](_0x1a1cf3)&&_0x1a1cf3!==null){if(typeof _0x1a1cf3[_0x4df9('0x88')]!=='undefined'){if(_0x1a1cf3[_0x4df9('0x88')]>0x0){_0x1a1cf3['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4df9('0x6e')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x4df9('0x1c')]['loggerHandler']=function(_0x5f3263,_0x1f149d){var _0x5d2baf=this;return function(_0xca7728){_0x5d2baf[_0x4df9('0x103')](_0x1f149d);logger[_0x4df9('0x6e')](_0x5f3263,util[_0x4df9('0x4f')](_0xca7728,{'showHidden':![],'depth':null}));};};Dialer[_0x4df9('0x1c')]['emptyContact']=function(_0x398099,_0x55cb5f,_0xc7e272){var _0x5a34db={'state':0x19,'statedesc':_0x4df9('0x156')};this[_0x4df9('0x103')](_0x55cb5f);this[_0x4df9('0x11d')](_['merge'](_0x5a34db,_[_0x4df9('0x7c')](_0xc7e272,[_0x4df9('0xf4'),_0x4df9('0xe6'),_0x4df9('0x157'),_0x4df9('0xe7'),_0x4df9('0xe8')])),'[emptyContact][createHistory]',_0x4df9('0x158'));logger[_0x4df9('0x6e')](_0x398099);};Dialer[_0x4df9('0x1c')][_0x4df9('0x11d')]=function(_0x17c5af,_0x2d812c,_0x1e4a81){hopperUtils[_0x4df9('0xcc')](_0x17c5af)[_0x4df9('0xaa')](loggerCatch(_0x2d812c));hopperUtils[_0x4df9('0xce')](_0x17c5af)['catch'](loggerCatch(_0x1e4a81));};Dialer[_0x4df9('0x1c')][_0x4df9('0xe2')]=function(_0x1c209b,_0x1fc8f0){hopperUtils['createHistory'](_0x1c209b)['catch'](loggerCatch(_0x4df9('0xcd')));if(_0x1fc8f0==0x0){hopperUtils[_0x4df9('0xce')](_0x1c209b)['catch'](loggerCatch(_0x4df9('0x159')));}};Dialer[_0x4df9('0x1c')]['checkPreviewRecallReminder']=function(_0x2b0e7f){return Promise[_0x4df9('0xb2')]()['then'](cmHopper[_0x4df9('0x15a')](_0x2b0e7f['id'],previewRecallmeReminderInterval))[_0x4df9('0x47')](function(_0x11ea2a){for(var _0x46fb12=0x0;_0x46fb12<_0x11ea2a[_0x4df9('0x14a')];_0x46fb12++){var _0x21d4ed=_0x11ea2a[_0x46fb12][_0x4df9('0x15b')]['name'];if(_0x21d4ed)io['to'](util[_0x4df9('0x50')]('user:%s',_0x21d4ed))[_0x4df9('0x4a')](_0x4df9('0x14d'),{'hopper':_0x11ea2a[_0x46fb12]});}})[_0x4df9('0xaa')](function(){});};Dialer['prototype'][_0x4df9('0x15c')]=function(_0xeab491){var _0x4ef4d2=this;return function(){_0x4ef4d2[_0x4df9('0x15d')](_0xeab491);};};Dialer[_0x4df9('0x1c')]['actionOriginate']=function(_0x51f1f3,_0x38bc17){var _0x36054d=this;var _0x395de7=uuid['v4']();this[_0x4df9('0x27')][_0x395de7]=new Action(_0x51f1f3,_0x38bc17,_0x395de7);return new Promise(function(_0x4ded19,_0x422ba3){if(_[_0x4df9('0x49')](_0x51f1f3)&&typeof _0x51f1f3!==_0x4df9('0x15e')){return _0x422ba3(msgResponse(_0x4df9('0x15f'),_0x4df9('0x9d'),_0x4df9('0x160')));}if(_[_0x4df9('0x49')](_0x38bc17[_0x4df9('0x161')])||_0x38bc17[_0x4df9('0x161')]===null){return _0x422ba3(msgResponse(_0x4df9('0x15f'),_0x4df9('0x9d'),_0x4df9('0x162')));}var _0x5aeff0={'XMD-CALLERID':_0x36054d[_0x4df9('0x27')][_0x395de7][_0x4df9('0x163')](),'XMD-AGI':_0x51f1f3['dialQueueProject']?util[_0x4df9('0x50')]('\x22agi://%s/square,%s\x22',ipAgi,_0x51f1f3['dialQueueProject']):_0x4df9('0x164'),'XMD-AGIAFTER':_0x51f1f3[_0x4df9('0xcb')]?util[_0x4df9('0x50')](_0x4df9('0x165'),ipAgi,_0x51f1f3[_0x4df9('0xcb')]):'NONE','XMD-QUEUE':utils[_0x4df9('0x166')](_0x51f1f3)?util['format'](_0x4df9('0x167'),_0x51f1f3['name'],_0x51f1f3['dialQueueOptions']||'',_0x51f1f3[_0x4df9('0x168')]?'c':'',_0x51f1f3[_0x4df9('0xd2')]||0x3):_0x4df9('0x164'),'XMD-CONTACTID':_0x38bc17[_0x4df9('0xf4')],'XMD-CDRTYPE':_0x4df9('0x7'),'CALLERID(all)':_0x36054d[_0x4df9('0x27')][_0x395de7][_0x4df9('0x163')](),'XMD-AMD':_0x51f1f3[_0x4df9('0x12a')]?_0x4df9('0x141'):_0x4df9('0x164'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x51f1f3['dialAMDActive']){_0x5aeff0[_0x4df9('0x169')]=_0x51f1f3['dialAMDInitialSilence']||0x9c4;_0x5aeff0[_0x4df9('0x16a')]=_0x51f1f3[_0x4df9('0x16b')]||0x5dc;_0x5aeff0[_0x4df9('0x16c')]=_0x51f1f3['dialAMDAfterGreetingSilence']||0x320;_0x5aeff0[_0x4df9('0x16d')]=_0x51f1f3[_0x4df9('0x16e')]||0x1388;_0x5aeff0[_0x4df9('0x16f')]=_0x51f1f3[_0x4df9('0x170')]||0x64;_0x5aeff0['XMD-AMDBETWEENWORDSSILENCE']=_0x51f1f3[_0x4df9('0x171')]||0x32;_0x5aeff0['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x51f1f3[_0x4df9('0x172')]||0x3;_0x5aeff0['XMD-AMDSILENCETHRESHOLD']=_0x51f1f3[_0x4df9('0x173')]||0x100;_0x5aeff0['XMD-AMDMAXIMUMWORDLENGTH']=_0x51f1f3[_0x4df9('0x174')]||0x1388;}if(utils[_0x4df9('0x166')](_0x51f1f3)){_0x5aeff0[_0x4df9('0x175')]=_0x38bc17['VoiceQueueId'];}else{_0x5aeff0[_0x4df9('0x176')]=_0x38bc17[_0x4df9('0xe8')];}var _0xcbeafc=utils[_0x4df9('0x177')](_0x38bc17[_0x4df9('0x178')]);Object['assign'](_0x5aeff0,_0xcbeafc);var _0x3bca16=_0x36054d[_0x4df9('0x8d')](_0x51f1f3[_0x4df9('0x94')])?utils[_0x4df9('0x179')](_0x51f1f3['Trunk']['callerid'],_0x51f1f3[_0x4df9('0x17a')],_0x51f1f3[_0x4df9('0x17b')]>0x0?utils[_0x4df9('0x17c')](_0x51f1f3[_0x4df9('0x17d')],_0x51f1f3[_0x4df9('0x17b')]):_0x51f1f3[_0x4df9('0x17d')]):utils[_0x4df9('0x179')](_['isNil'](_0x51f1f3['TrunkBackup'])?_0x51f1f3[_0x4df9('0x94')][_0x4df9('0x17e')]:_0x51f1f3[_0x4df9('0x95')]['callerid'],_0x51f1f3[_0x4df9('0x17a')],_0x51f1f3[_0x4df9('0x17b')]>0x0?utils[_0x4df9('0x17c')](_0x51f1f3[_0x4df9('0x17d')],_0x51f1f3[_0x4df9('0x17b')]):_0x51f1f3[_0x4df9('0x17d')]);if(_0x3bca16){_0x5aeff0[_0x4df9('0x17f')]=_0x36054d['actions'][_0x395de7][_0x4df9('0x180')]=utils[_0x4df9('0x181')](_0x3bca16);_0x5aeff0['XMD-ORIGINATECALLERIDNUM']=_0x38bc17[_0x4df9('0x161')];}_0x51f1f3['variables']=_0x5aeff0;return ami[_0x4df9('0xa4')]({'actionid':_0x395de7,'action':_0x4df9('0x15f'),'channel':_0x36054d[_0x4df9('0x8d')](_0x51f1f3[_0x4df9('0x94')])?util[_0x4df9('0x50')](_0x4df9('0x182'),_0x51f1f3[_0x4df9('0x94')]['name'],isNotNull(_0x51f1f3['dialPrefix'])?_0x51f1f3[_0x4df9('0x183')][_0x4df9('0x184')]()||'':'',_0x51f1f3[_0x4df9('0x185')]>0x0?_0x38bc17[_0x4df9('0x161')][_0x4df9('0x186')](_0x51f1f3[_0x4df9('0x185')]):_0x38bc17['phone']):util['format'](_0x4df9('0x182'),_[_0x4df9('0xfc')](_0x51f1f3[_0x4df9('0x95')])?_0x51f1f3[_0x4df9('0x94')][_0x4df9('0x6a')]:_0x51f1f3[_0x4df9('0x95')][_0x4df9('0x6a')],isNotNull(_0x51f1f3['dialPrefix'])?_0x51f1f3['dialPrefix'][_0x4df9('0x184')]()||'':'',_0x51f1f3['dialCutDigit']>0x0?_0x38bc17[_0x4df9('0x161')][_0x4df9('0x186')](_0x51f1f3[_0x4df9('0x185')]):_0x38bc17[_0x4df9('0x161')]),'callerid':_0x3bca16,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x5aeff0,'timeout':(_0x51f1f3[_0x4df9('0x187')]||0x1e)*0x3e8,'async':!![],'channelid':_0x395de7})[_0x4df9('0x47')](function(_0x18354f){return _0x4ded19(_0x18354f);})[_0x4df9('0xaa')](function(_0x99b3fd){_0x51f1f3[_0x4df9('0x188')]+=0x1;var _0x4b4317=new History(_0x36054d[_0x4df9('0x27')][_0x395de7]);logger[_0x4df9('0x6e')](util[_0x4df9('0x50')](_0x4df9('0x189'),JSON['stringify'](_0x99b3fd)));_0x4b4317[_0x4df9('0xd6')]=0xe;_0x4b4317['statedesc']=_0x4df9('0x18a');_0x4b4317[_0x4df9('0x77')]=moment()[_0x4df9('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b4317['endtime']=_0x4b4317[_0x4df9('0x77')];hopperUtils[_0x4df9('0xcc')](_0x4b4317)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x18b')));_0x36054d[_0x4df9('0xce')](_0x4b4317)['catch'](loggerCatch('[originate][error]'))[_0x4df9('0x1e')](function(){delete _0x36054d[_0x4df9('0x27')][_0x395de7];return _0x422ba3(msgResponse(_0x4df9('0x15f'),_0x4df9('0x8c'),'originate\x20action\x20Error'));});});});};Dialer[_0x4df9('0x1c')]['checkRetriveMax']=function(_0x531a6a,_0x5b66b1,_0x30e82e){var _0x1b5db5=new History(_0x5b66b1);if(_0x1b5db5[_0x4df9('0x122')]+_0x1b5db5[_0x4df9('0x123')]+_0x1b5db5[_0x4df9('0x124')]+_0x1b5db5[_0x4df9('0x18c')]+_0x1b5db5[_0x4df9('0xe0')]+_0x1b5db5['countabandonedretry']+_0x1b5db5[_0x4df9('0x120')]+_0x1b5db5['countagentrejectretry']>=_0x30e82e[_0x4df9('0x12d')]-0x1){return!![];}switch(_0x531a6a){case 0x3:if(_0x1b5db5[_0x4df9('0x124')]>=_0x30e82e[_0x4df9('0x18d')]-0x1){return!![];}hopperUtils[_0x4df9('0xe3')]({'active':![],'countnoanswerretry':_0x1b5db5['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x4df9('0xe4')](_0x30e82e[_0x4df9('0x18e')],_0x4df9('0xe5'))[_0x4df9('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b5db5[_0x4df9('0xf4')],'ListId':_0x1b5db5[_0x4df9('0xe6')],'VoiceQueueId':_0x1b5db5['VoiceQueueId']||undefined,'CampaignId':_0x1b5db5[_0x4df9('0xe8')]||undefined})['catch'](loggerCatch(_0x4df9('0x18f')));break;case 0x5:if(_0x1b5db5[_0x4df9('0x122')]>=_0x30e82e[_0x4df9('0x190')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1b5db5['countbusyretry']+=0x1,'scheduledat':moment()[_0x4df9('0xe4')](_0x30e82e['dialBusyRetryFrequency'],_0x4df9('0xe5'))[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x1b5db5[_0x4df9('0xf4')],'ListId':_0x1b5db5[_0x4df9('0xe6')],'VoiceQueueId':_0x1b5db5['VoiceQueueId']||undefined,'CampaignId':_0x1b5db5[_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x191')));break;case 0x8:if(_0x1b5db5[_0x4df9('0x123')]>=_0x30e82e[_0x4df9('0x192')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1b5db5[_0x4df9('0x123')]+=0x1,'scheduledat':moment()['add'](_0x30e82e[_0x4df9('0x193')],'minutes')[_0x4df9('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b5db5[_0x4df9('0xf4')],'ListId':_0x1b5db5['ListId'],'VoiceQueueId':_0x1b5db5[_0x4df9('0xe7')]||undefined,'CampaignId':_0x1b5db5[_0x4df9('0xe8')]||undefined})['catch'](loggerCatch(_0x4df9('0x194')));break;case 0x0:if(_0x1b5db5[_0x4df9('0x18c')]>=_0x30e82e[_0x4df9('0x195')]-0x1){return!![];}else{hopperUtils[_0x4df9('0xe3')]({'active':![],'countnosuchnumberretry':_0x1b5db5['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x4df9('0xe4')](_0x30e82e[_0x4df9('0x196')],_0x4df9('0xe5'))[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x1b5db5[_0x4df9('0xf4')],'ListId':_0x1b5db5[_0x4df9('0xe6')],'VoiceQueueId':_0x1b5db5[_0x4df9('0xe7')]||undefined,'CampaignId':_0x1b5db5[_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1b5db5[_0x4df9('0xe0')]>=_0x30e82e[_0x4df9('0xe1')]-0x1){return!![];}hopperUtils[_0x4df9('0xe3')]({'active':![],'countdropretry':_0x1b5db5[_0x4df9('0xe0')]+=0x1,'scheduledat':moment()['add'](_0x30e82e['dialDropRetryFrequency'],_0x4df9('0xe5'))[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x1b5db5[_0x4df9('0xf4')],'ListId':_0x1b5db5[_0x4df9('0xe6')],'VoiceQueueId':_0x1b5db5[_0x4df9('0xe7')]||undefined,'CampaignId':_0x1b5db5[_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch(_0x4df9('0xe9')));break;case 0xb:if(_0x1b5db5[_0x4df9('0xf1')]>=_0x30e82e['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1b5db5[_0x4df9('0xf1')]+=0x1,'scheduledat':moment()[_0x4df9('0xe4')](_0x30e82e[_0x4df9('0xf2')],_0x4df9('0xe5'))[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x1b5db5['ContactId'],'ListId':_0x1b5db5['ListId'],'VoiceQueueId':_0x1b5db5[_0x4df9('0xe7')]||undefined,'CampaignId':_0x1b5db5[_0x4df9('0xe8')]||undefined})['catch'](loggerCatch(_0x4df9('0xf5')));break;case 0x13:if(_0x1b5db5['countmachineretry']>=_0x30e82e['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x4df9('0xe3')]({'active':![],'countmachineretry':_0x1b5db5[_0x4df9('0x120')]+=0x1,'scheduledat':moment()[_0x4df9('0xe4')](_0x30e82e[_0x4df9('0x12f')],'minutes')[_0x4df9('0x50')](_0x4df9('0xc6')),'ContactId':_0x1b5db5[_0x4df9('0xf4')],'ListId':_0x1b5db5[_0x4df9('0xe6')],'VoiceQueueId':_0x1b5db5[_0x4df9('0xe7')]||undefined,'CampaignId':_0x1b5db5[_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x197')));break;case 0x14:if(_0x1b5db5[_0x4df9('0x125')]>=_0x30e82e[_0x4df9('0x198')]-0x1){return!![];}hopperUtils[_0x4df9('0xe3')]({'active':![],'countagentrejectretry':_0x1b5db5[_0x4df9('0x125')]+=0x1,'scheduledat':moment()[_0x4df9('0xe4')](_0x30e82e[_0x4df9('0x199')],_0x4df9('0xe5'))['format'](_0x4df9('0xc6')),'ContactId':_0x1b5db5[_0x4df9('0xf4')],'ListId':_0x1b5db5[_0x4df9('0xe6')],'VoiceQueueId':_0x1b5db5[_0x4df9('0xe7')]||undefined,'CampaignId':_0x1b5db5['CampaignId']||undefined})[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x19a')));break;default:return!![];}};Dialer[_0x4df9('0x1c')][_0x4df9('0x110')]=function(_0x32a507,_0x23ed36,_0x1b1742){var _0x3bf6f1=this;var _0x390fe5=new History(_0x32a507);var _0xd2d028=![];var _0x1aa8c3;var _0x119721;return new Promise(function(_0x2b4f22,_0x4c74d7){if(_['isUndefined'](_0x23ed36)&&typeof _0x23ed36!=='object'){return _0x4c74d7(msgResponse(_0x4df9('0x19b'),_0x4df9('0x9d'),_0x4df9('0x19c')));}if(_[_0x4df9('0x49')](_0x1b1742)&&typeof _0x1b1742!==_0x4df9('0x15e')){return _0x4c74d7(msgResponse(_0x4df9('0x19b'),_0x4df9('0x9d'),'evt\x20is\x20undefine'));}hopperUtils[_0x4df9('0xdd')](_0x390fe5,_0x1b1742[_0x4df9('0xc8')],_0x23ed36)['then'](function(_0x16f189){if(_0x16f189[_0x4df9('0xdf')]==0x1)_0xd2d028=!![];switch(_0x1b1742[_0x4df9('0xc8')]){case'0':_0x23ed36['outboundNoSuchCallsDay']+=0x1;_0x390fe5[_0x4df9('0xd6')]=0x0;_0x390fe5['statedesc']=_0x4df9('0x19d');_0x390fe5['countnosuchnumberretry']+=0x1;_0x390fe5[_0x4df9('0xda')]+=0x1;ami['emit'](_0x4df9('0x19e'),ut[_0x4df9('0x11b')](_0x32a507,_0x4df9('0x19f')));_0x1aa8c3=_0x23ed36[_0x4df9('0x196')];_0x119721=_0x23ed36['callAdditionalPhoneAfterMin'];hopperUtils[_0x4df9('0xcc')](_0x390fe5)['catch'](loggerCatch(_0x4df9('0x121')));if(_0x3bf6f1[_0x4df9('0x1a0')](0x0,_0x32a507,_0x23ed36)&&!_0xd2d028){if(_0x390fe5[_0x4df9('0x18c')]>=_0x23ed36['dialNoSuchNumberMaxRetry']){_0x3bf6f1['createStateFinal'](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1a1'));}else{_0x3bf6f1[_0x4df9('0x126')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1a1'));}}break;case'3':_0x23ed36[_0x4df9('0x1a2')]+=0x1;_0x390fe5['state']=0x3;_0x390fe5['statedesc']=_0x4df9('0x1a3');_0x390fe5[_0x4df9('0x124')]+=0x1;_0x390fe5[_0x4df9('0xda')]+=0x1;var _0x3d96fc=ut[_0x4df9('0x1a4')](_0x32a507,_0x23ed36);ami[_0x4df9('0x4a')](_0x4df9('0x1a5'),_0x3d96fc);_0x1aa8c3=_0x23ed36[_0x4df9('0x18e')];_0x119721=_0x23ed36['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x390fe5)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x1a6')));if(_0x3bf6f1[_0x4df9('0x1a0')](0x3,_0x32a507,_0x23ed36)&&!_0xd2d028){if(_0x390fe5[_0x4df9('0x124')]>=_0x23ed36['dialNoAnswerMaxRetry']){_0x3bf6f1[_0x4df9('0x128')](_0x390fe5,_0x2b4f22,_0x4c74d7,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3bf6f1[_0x4df9('0x126')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1a7'));}}break;case'5':_0x23ed36[_0x4df9('0x1a8')]+=0x1;_0x390fe5[_0x4df9('0xd6')]=0x5;_0x390fe5['statedesc']=_0x4df9('0x1a9');_0x390fe5[_0x4df9('0x122')]+=0x1;_0x390fe5[_0x4df9('0xda')]+=0x1;ami[_0x4df9('0x4a')](_0x4df9('0x1aa'),ut[_0x4df9('0x11b')](_0x32a507,'busy'));_0x1aa8c3=_0x23ed36['dialBusyRetryFrequency'];_0x119721=_0x23ed36[_0x4df9('0xdc')];hopperUtils[_0x4df9('0xcc')](_0x390fe5)[_0x4df9('0xaa')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x3bf6f1[_0x4df9('0x1a0')](0x5,_0x32a507,_0x23ed36)&&!_0xd2d028){if(_0x390fe5['countbusyretry']>=_0x23ed36[_0x4df9('0x190')]){_0x3bf6f1['createStateFinal'](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1ab'));}else{_0x3bf6f1[_0x4df9('0x126')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1ab'));}}break;case'8':_0x23ed36[_0x4df9('0x1ac')]+=0x1;_0x390fe5['state']=0x8;_0x390fe5[_0x4df9('0x76')]=_0x4df9('0x1ad');_0x390fe5[_0x4df9('0x123')]+=0x1;_0x390fe5[_0x4df9('0xda')]+=0x1;_0x1aa8c3=_0x23ed36[_0x4df9('0x193')];_0x119721=_0x23ed36[_0x4df9('0xdc')];ami[_0x4df9('0x4a')](_0x4df9('0x1ae'),ut['buildObj'](_0x32a507,_0x4df9('0x1af')));hopperUtils['createHistory'](_0x390fe5)['catch'](loggerCatch(_0x4df9('0x1b0')));if(_0x3bf6f1[_0x4df9('0x1a0')](0x8,_0x32a507,_0x23ed36)&&!_0xd2d028){if(_0x390fe5['countcongestionretry']>=_0x23ed36[_0x4df9('0x192')]){_0x3bf6f1[_0x4df9('0x128')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1b1'));}else{_0x3bf6f1['stateGlobal'](_0x390fe5,_0x2b4f22,_0x4c74d7,'reason\x208\x20congestion');}}break;case'11':_0x23ed36[_0x4df9('0x1b2')]+=0x1;_0x390fe5[_0x4df9('0xd6')]=0xb;_0x390fe5[_0x4df9('0x76')]=_0x4df9('0x1b3');_0x390fe5[_0x4df9('0xf1')]+=0x1;_0x390fe5[_0x4df9('0xda')]+=0x1;_0x1aa8c3=_0x23ed36['dialAbandonedRetryFrequency'];_0x119721=_0x23ed36[_0x4df9('0xdc')];hopperUtils['createHistory'](_0x390fe5)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0xf6')));if(_0x3bf6f1['checkRetriveMax'](0xb,_0x32a507,_0x23ed36)&&!_0xd2d028){if(_0x390fe5[_0x4df9('0xf1')]>=_0x23ed36[_0x4df9('0xf3')]){_0x3bf6f1[_0x4df9('0x128')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1b4'));}else{_0x3bf6f1[_0x4df9('0x126')](_0x390fe5,_0x2b4f22,_0x4c74d7,'reason\x2011\x20abandoned');}}break;case'20':_0x23ed36[_0x4df9('0x1b5')]+=0x1;_0x390fe5[_0x4df9('0xd6')]=0x14;_0x390fe5[_0x4df9('0x76')]=_0x4df9('0x1b6');_0x390fe5['countagentrejectretry']+=0x1;_0x390fe5['countglobal']+=0x1;_0x1aa8c3=_0x23ed36[_0x4df9('0x199')];_0x119721=_0x23ed36[_0x4df9('0xdc')];ami['emit']('custom:agentreject',ut[_0x4df9('0x11b')](_0x32a507,_0x4df9('0x1b7')));hopperUtils[_0x4df9('0xcc')](_0x390fe5)[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x1b8')));if(_0x3bf6f1[_0x4df9('0x1a0')](0x14,_0x32a507,_0x23ed36)&&!_0xd2d028){if(_0x390fe5[_0x4df9('0x125')]>=_0x23ed36['dialAgentRejectMaxRetry']){_0x3bf6f1['createStateFinal'](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1b9'));}else{_0x3bf6f1[_0x4df9('0x126')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x4df9('0x1b9'));}}break;default:_0x23ed36['outboundUnknownCallsDay']+=0x1;_0x390fe5[_0x4df9('0xd6')]=0xc;_0x390fe5[_0x4df9('0x76')]=_0x1b1742[_0x4df9('0xc8')];_0x1aa8c3=_0x23ed36[_0x4df9('0x199')];_0x119721=_0x23ed36['callAdditionalPhoneAfterMin'];hopperUtils[_0x4df9('0xcc')](_0x390fe5)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3bf6f1[_0x4df9('0x1a0')](_0x1b1742[_0x4df9('0xc8')],_0x32a507,_0x23ed36)&&!_0xd2d028){if(_0x390fe5[_0x4df9('0x122')]+_0x390fe5['countcongestionretry']+_0x390fe5[_0x4df9('0x124')]+_0x390fe5['countnosuchnumberretry']+_0x390fe5[_0x4df9('0xe0')]+_0x390fe5[_0x4df9('0xf1')]+_0x390fe5[_0x4df9('0x120')]+_0x390fe5[_0x4df9('0x125')]>=_0x23ed36[_0x4df9('0x12d')]){_0x3bf6f1[_0x4df9('0x126')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x1b1742[_0x4df9('0xc8')]);}else{_0x3bf6f1[_0x4df9('0x128')](_0x390fe5,_0x2b4f22,_0x4c74d7,_0x1b1742['reason']);}}}})[_0x4df9('0x47')](function(){if(_0xd2d028){hopperUtils['swapAdditionalPhones'](_0x390fe5,_0x1aa8c3,_0x119721)[_0x4df9('0x47')](function(){return _0x2b4f22(0x1);});}});});};Dialer[_0x4df9('0x1c')][_0x4df9('0x126')]=function(_0x3471c3,_0x265a2b,_0x5a9226,_0x571045){var _0xa9f440=new Final(_0x3471c3);_0xa9f440[_0x4df9('0xd6')]=0xf;_0xa9f440[_0x4df9('0x76')]=_0x4df9('0x1ba');this['createStateFinal'](_0xa9f440,_0x265a2b,_0x5a9226,_0x571045);};Dialer['prototype']['createStateFinal']=function(_0x5bbc48,_0x547175,_0x3119f5,_0x5e78e8){hopperUtils[_0x4df9('0xce')](_0x5bbc48)[_0x4df9('0x47')](function(){return _0x547175(msgResponse(_0x4df9('0x19b'),'Success',_0x5e78e8));})[_0x4df9('0xaa')](function(){return _0x3119f5(msgResponse('[moveContactManagedDialer][0]','Failure',_0x4df9('0x1bb')));});};Dialer[_0x4df9('0x1c')][_0x4df9('0x9')]=function(_0x2df9fe){var _0x521086=_0x2df9fe['dialPredictiveOptimizationPercentage']/0x64;var _0x473ae8=_0x2df9fe[_0x4df9('0xd4')]/(_0x2df9fe[_0x4df9('0xd4')]+_0x2df9fe[_0x4df9('0xc7')]);var _0xe2394e=Math[_0x4df9('0x1bc')](_0x2df9fe[_0x4df9('0x1bd')]*(_0x2df9fe[_0x4df9('0x1be')]/0x64));var _0x35b93a=Math[_0x4df9('0x1bc')](_0x2df9fe[_0x4df9('0x1bd')]*(_0x2df9fe[_0x4df9('0x1bf')]/0x64));var _0x17a374=_0x2df9fe[_0x4df9('0x13e')]+_0x2df9fe['talking'];var _0x58e8c0=Math[_0x4df9('0x1c0')](_0x2df9fe[_0x4df9('0x61')]*_0x2df9fe[_0x4df9('0x64')]*_0x2df9fe[_0x4df9('0x1c1')]*_0x2df9fe[_0x4df9('0x1c2')]);if(_['isUndefined'](_0x2df9fe[_0x4df9('0x2c')])){if(!_[_0x4df9('0x49')](_0x2df9fe['startPredictive'])){_0x2df9fe[_0x4df9('0x2b')]=undefined;loggerPredictive['error'](_0x4df9('0x1c3'),_0x4df9('0x1c4'));}if(!_[_0x4df9('0x49')](_0x2df9fe[_0x4df9('0x6c')])){loggerPredictive[_0x4df9('0x6e')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2df9fe[_0x4df9('0x6c')]);_0x2df9fe[_0x4df9('0x6c')]=undefined;}_0x2df9fe[_0x4df9('0x2c')]=moment()[_0x4df9('0x50')](_0x4df9('0xc6'));loggerPredictive[_0x4df9('0x53')](_0x2df9fe[_0x4df9('0x6a')],_0x4df9('0x1c5'),_0x2df9fe['startProgressive']);this[_0x4df9('0xb7')](_0x2df9fe,0x1);}else if(ifInterval(_0x2df9fe['dialPredictiveInterval'],_0x2df9fe['startProgressive'])){this[_0x4df9('0xb7')](_0x2df9fe,0x1);loggerPredictiveCalls[_0x4df9('0x53')](_0x4df9('0x1c6'),_0x2df9fe[_0x4df9('0x2c')],_0x2df9fe['name']);_0x2df9fe[_0x4df9('0x61')]=0x0;_0x2df9fe['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x521086<_0x473ae8&&_0x2df9fe[_0x4df9('0x1c7')]===_0x4df9('0x1c8')){clearPredictiveAttributes(_0x2df9fe);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x1c9'),_0x4df9('0x1ca'),_0x473ae8,_0x4df9('0x2c'),_0x2df9fe[_0x4df9('0x6a')]);}else if(_0x58e8c0<_0x2df9fe[_0x4df9('0xd5')]&&_0x2df9fe[_0x4df9('0x1c7')]===_0x4df9('0x1c8')){clearPredictiveAttributes(_0x2df9fe);loggerPredictive['info'](_0x4df9('0x1cb'),_0x4df9('0x1cc'),_0x58e8c0,_0x4df9('0x1cd'),_0x2df9fe['predictiveIntervalErlangCallsDroppedCalls'],_0x4df9('0x2c'),_0x2df9fe['name']);}else if(!ifInterval(_0x2df9fe[_0x4df9('0x1ce')],_0x2df9fe[_0x4df9('0x2c')])&&_[_0x4df9('0x49')](_0x2df9fe[_0x4df9('0x2b')])&&!_[_0x4df9('0x49')](_0x2df9fe[_0x4df9('0x2c')])){_0x2df9fe[_0x4df9('0x2b')]=moment()['format'](_0x4df9('0xc6'));loggerPredictive[_0x4df9('0x53')](_0x2df9fe[_0x4df9('0x6a')],_0x4df9('0x1cf'),_0x2df9fe['startPredictive']);hopperUtils[_0x4df9('0x1d0')](_0x2df9fe['dialPredictiveInterval'])[_0x4df9('0x47')](this[_0x4df9('0x1d1')](_0x2df9fe))['then'](mergeDataErlangB(_0x2df9fe))['then'](this[_0x4df9('0x1d2')](_0x2df9fe))[_0x4df9('0xaa')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2df9fe));}else if(!ifInterval(_0x2df9fe[_0x4df9('0x1ce')],_0x2df9fe[_0x4df9('0x2b')])){_0x2df9fe[_0x4df9('0xd5')]=0x0;_0x2df9fe[_0x4df9('0x2b')]=moment()[_0x4df9('0x50')](_0x4df9('0xc6'));loggerPredictive['info'](_0x2df9fe['name'],'recalculate\x20predictive\x20at',_0x2df9fe[_0x4df9('0x2b')]);clearInterval(_0x2df9fe[_0x4df9('0x6c')]);_0x2df9fe[_0x4df9('0x6c')]=undefined;hopperUtils[_0x4df9('0x1d0')](_0x2df9fe[_0x4df9('0x1ce')])[_0x4df9('0x47')](this[_0x4df9('0x1d1')](_0x2df9fe))[_0x4df9('0x47')](mergeDataErlangB(_0x2df9fe))['then'](this['startMethodPredictive'](_0x2df9fe))[_0x4df9('0xaa')](loggerCatchPredictive(_0x4df9('0x1d3'),_0x2df9fe));}else if(_0x2df9fe[_0x4df9('0x1bd')]&&_0x17a374<_0x2df9fe[_0x4df9('0x1bd')]-_0x35b93a){clearPredictiveAttributes(_0x2df9fe);loggerPredictive[_0x4df9('0x53')](_0x2df9fe[_0x4df9('0x6a')],_0x4df9('0x1d4'),_0x17a374,_0x4df9('0x1d5'),_0x2df9fe[_0x4df9('0x1bd')],'-',_0x35b93a,'=',_0x2df9fe[_0x4df9('0x1bd')]-_0x35b93a,')');}else if(_0x2df9fe[_0x4df9('0x1bd')]&&_0x17a374>_0x2df9fe[_0x4df9('0x1bd')]+_0xe2394e){clearPredictiveAttributes(_0x2df9fe);loggerPredictive[_0x4df9('0x53')](_0x2df9fe[_0x4df9('0x6a')],_0x4df9('0x1d4'),_0x17a374,')\x20are\x20more\x20than\x20threshold\x20(',_0x2df9fe['predictiveIntervalAvailable'],'+',_0xe2394e,'=',_0x2df9fe[_0x4df9('0x1bd')]+_0xe2394e,')');}};Dialer['prototype'][_0x4df9('0x1d1')]=function(_0x4b4f19){var _0x24e7d0=this;return function(_0x209d0d){return new Promise(function(_0xa7bfd6,_0x2fbc47){_[_0x4df9('0x67')](_0x4b4f19,_0x209d0d[0x0]);if(checkGetDataPredictive(_0x209d0d[0x0])){var _0x12c3ef=_0x4b4f19[_0x4df9('0x1bd')]=_0x4b4f19[_0x4df9('0x13f')]+_0x4b4f19['available'];var _0x5b9e66=_0x4b4f19[_0x4df9('0x1ce')]*0x3c;var _0x4453b1=_0x209d0d[0x0][_0x4df9('0x5a')]+_0x209d0d[0x0][_0x4df9('0x59')];var _0x13e552=(_0x209d0d[0x0][_0x4df9('0x56')]+_0x209d0d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x209d0d[0x0][_0x4df9('0x1d6')])/_0x209d0d[0x0]['predictiveIntervalTotalCalls'];_0x4b4f19[_0x4df9('0x1c1')]=_0x13e552>0x0?_0x13e552:0x1;switch(_0x4b4f19['dialPredictiveOptimization']){case _0x4df9('0x1c8'):var _0x5dc65d=_0x4b4f19[_0x4df9('0x1d7')]/0x64;return _0x24e7d0[_0x4df9('0x1d8')](_0x12c3ef,_0x5b9e66,_0x4453b1,_0x13e552,_0x5dc65d)[_0x4df9('0x47')](function(_0x5bdfb5){return _0xa7bfd6(_0x5bdfb5);});case _0x4df9('0x1d9'):var _0x1d1c93=_0x4b4f19[_0x4df9('0x1d7')]/0x64;return _0x24e7d0[_0x4df9('0x1da')](_0x12c3ef,_0x5b9e66,_0x4453b1,_0x13e552,_0x1d1c93)[_0x4df9('0x47')](function(_0x5288de){return _0xa7bfd6(_0x5288de);});default:return _0x2fbc47(msgResponse(_0x4df9('0x1db'),_0x4df9('0x9d'),_0x4df9('0x1dc')));}}else{return _0x2fbc47(msgResponse(_0x4df9('0x1db'),_0x4df9('0x9d'),'check\x20failure'));}});};};Dialer['prototype'][_0x4df9('0x1dd')]=function(_0x15d40c){var _0x1650e8=this;return function(_0x75eb9a){return new Promise(function(_0x10280b,_0x1feb34){_[_0x4df9('0x67')](_0x15d40c,_0x75eb9a[0x0]);if(checkGetDataPredictive(_0x75eb9a[0x0])){loggerPredictive[_0x4df9('0x53')](JSON[_0x4df9('0x7b')](_0x75eb9a[0x0]));if(_0x15d40c[_0x4df9('0x1c7')]===_0x4df9('0x1c8')){return _0x1650e8[_0x4df9('0x155')](_0x15d40c['id'])[_0x4df9('0x47')](function(_0x5b7b4e){var _0x3d2c4d=_0x15d40c[_0x4df9('0x1de')]-_0x5b7b4e[0x0][_0x4df9('0x1df')];var _0x56d9ad=_0x15d40c[_0x4df9('0x1ce')]*0x3c;var _0x52a502=_0x75eb9a[0x0]['predictiveIntervalAvgTalktime']+_0x75eb9a[0x0]['predictiveIntervalAvgHoldtime'];var _0x2c2bad=(_0x75eb9a[0x0]['predictiveIntervalAnsweredCalls']+_0x75eb9a[0x0][_0x4df9('0xd3')]+_0x75eb9a[0x0][_0x4df9('0x1d6')])/_0x75eb9a[0x0][_0x4df9('0x5c')];var _0x85313a=_0x15d40c['dialPredictiveOptimizationPercentage']/0x64;_0x15d40c[_0x4df9('0x1e0')]=_0x5b7b4e[0x0][_0x4df9('0x1df')]||0x0;_0x15d40c[_0x4df9('0x1c1')]=_0x2c2bad>0x0?_0x2c2bad:0x1;return _0x1650e8[_0x4df9('0x1d8')](_0x3d2c4d,_0x56d9ad,_0x52a502,_0x2c2bad,_0x85313a);})[_0x4df9('0x47')](function(_0x1e31f1){return _0x10280b(_0x1e31f1);})['catch'](function(_0xb020bd){return _0x1feb34(msgResponse(_0x4df9('0x1e1'),_0x4df9('0x9d'),JSON[_0x4df9('0x7b')](_0xb020bd)));});}if(_0x15d40c[_0x4df9('0x1c7')]==='agentBusyFactor'){return _0x1650e8[_0x4df9('0x155')](_0x15d40c['id'])[_0x4df9('0x47')](function(_0x5bbc8c){var _0x5bbfb4=_0x15d40c['loggedIn']-_0x5bbc8c[0x0][_0x4df9('0x1df')];var _0x5180c0=_0x15d40c[_0x4df9('0x1ce')]*0x3c;var _0x13fedc=_0x75eb9a[0x0][_0x4df9('0x5a')]+_0x75eb9a[0x0]['predictiveIntervalAvgHoldtime'];var _0x41f40d=(_0x75eb9a[0x0][_0x4df9('0x56')]+_0x75eb9a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x75eb9a[0x0][_0x4df9('0x1d6')])/_0x75eb9a[0x0][_0x4df9('0x5c')];var _0x490a64=_0x15d40c[_0x4df9('0x1d7')]/0x64;_0x15d40c[_0x4df9('0x1e0')]=_0x5bbc8c[0x0][_0x4df9('0x1df')]||0x0;_0x15d40c['predictiveIntervalHitRate']=_0x41f40d>0x0?_0x41f40d:0x1;return _0x1650e8[_0x4df9('0x1da')](_0x5bbfb4,_0x5180c0,_0x13fedc,_0x41f40d,_0x490a64);})['then'](function(_0x3dcae3){return _0x10280b(_0x3dcae3);})['catch'](function(_0x4eb9de){return _0x1feb34(msgResponse(_0x4df9('0x1e1'),_0x4df9('0x9d'),JSON[_0x4df9('0x7b')](_0x4eb9de)));});}}else{return _0x1feb34(msgResponse(_0x4df9('0x1db'),_0x4df9('0x9d'),_0x4df9('0x1e2')));}});};};Dialer[_0x4df9('0x1c')]['startMethodPredictive']=function(_0x1b0fb9){var _0x15f56e=this;return function(){var _0x58b1e3=0x0;var _0x24455f=Math[_0x4df9('0x1c0')](_0x1b0fb9['erlangCallToSecond']*0x3e8);if(_0x24455f>0x0){_0x24455f=_0x24455f<0x64?0x64:_0x24455f;loggerPredictive[_0x4df9('0x53')](_0x1b0fb9[_0x4df9('0x6a')],'one\x20call\x20every:',_0x24455f,_0x4df9('0x1e3'));_0x1b0fb9[_0x4df9('0x6c')]=setInterval(function(){_0x15f56e[_0x4df9('0x6c')](_0x1b0fb9);loggerPredictiveCalls['info'](_0x4df9('0x1e4'),_0x58b1e3+=0x1);},_0x24455f);}else{loggerPredictive[_0x4df9('0x53')](_0x1b0fb9[_0x4df9('0x6a')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x4df9('0x1c')]['checkContactBlack']=function(_0x30ae3a,_0xb7407d){var _0x44ee3a=this;return function(_0xdeec1a){if(_['isEmpty'](_0xdeec1a)){if(_[_0x4df9('0xfc')](_0xb7407d[_0x4df9('0x157')])||!_0xb7407d['recallme']){if(_0x30ae3a['dialMethod']===_0x4df9('0x8')){_0x30ae3a[_0x4df9('0x78')]=_['isUndefined'](_0x30ae3a['queueStatusComplete'])?!![]:_0x30ae3a[_0x4df9('0x78')];var _0x1c2b8e=uuid['v4']();_0x44ee3a[_0x4df9('0x27')][_0x1c2b8e]=new Action(_0x30ae3a,_0xb7407d,_0x1c2b8e);loggerBooked['info']('[booked][checkContactBlack]',_0x1c2b8e,_0x4df9('0x1e5'),JSON[_0x4df9('0x7b')](_0x30ae3a[_0x4df9('0x78')]),_0x4df9('0x1e6'),_0x30ae3a['name']);if(_0x30ae3a[_0x4df9('0x78')]){_0x30ae3a['queueStatusComplete']=![];_0x44ee3a[_0x4df9('0x2e')][_0x44ee3a['actions'][_0x1c2b8e][_0x4df9('0xc2')]]=[];ami['Action']({'actionid':_0x1c2b8e,'action':_0x4df9('0x1e7'),'queue':_0x30ae3a[_0x4df9('0x6a')]})[_0x4df9('0xaa')](function(){_0x44ee3a[_0x4df9('0x103')](_0x30ae3a);hopperUtils[_0x4df9('0xe3')]({'active':![],'ContactId':_0x44ee3a[_0x4df9('0x27')][_0x1c2b8e][_0x4df9('0xf4')],'ListId':_0x44ee3a[_0x4df9('0x27')][_0x1c2b8e][_0x4df9('0xe6')],'VoiceQueueId':_0x44ee3a[_0x4df9('0x27')][_0x1c2b8e][_0x4df9('0xe7')]||undefined,'CampaignId':_0x44ee3a['actions'][_0x1c2b8e][_0x4df9('0xe8')]||undefined})['catch'](loggerCatch(_0x4df9('0x1e8')));delete _0x44ee3a['actions'][_0x1c2b8e];});}else{loggerBooked[_0x4df9('0x53')](_0x4df9('0x1e9'),JSON[_0x4df9('0x7b')](_0x30ae3a[_0x4df9('0x78')]),_0x4df9('0x1e6'),_0x30ae3a['name']);_0x44ee3a[_0x4df9('0x103')](_0x30ae3a);hopperUtils[_0x4df9('0xe3')]({'active':![],'ContactId':_0x44ee3a['actions'][_0x1c2b8e][_0x4df9('0xf4')],'ListId':_0x44ee3a[_0x4df9('0x27')][_0x1c2b8e][_0x4df9('0xe6')],'VoiceQueueId':_0x44ee3a[_0x4df9('0x27')][_0x1c2b8e][_0x4df9('0xe7')]||undefined,'CampaignId':_0x44ee3a['actions'][_0x1c2b8e][_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x1e8')));delete _0x44ee3a[_0x4df9('0x27')][_0x1c2b8e];}}else{return _0x44ee3a[_0x4df9('0x1ea')](_0x30ae3a,_0xb7407d);}}else{if(utils[_0x4df9('0x68')](undefined,_0xb7407d[_0x4df9('0x1eb')])<_0x30ae3a['dialRecallMeTimeout']*0x3c){if(_0xb7407d[_0x4df9('0x15b')]&&!_0xb7407d[_0x4df9('0x15b')]['voicePause']){_0x44ee3a[_0x4df9('0x20')]['run'](_0xb7407d['id'])[_0x4df9('0x1e')](function(){_0x44ee3a[_0x4df9('0x103')](_0x30ae3a);});}else{hopperUtils[_0x4df9('0x1ec')]({'active':![]},_0xb7407d['id'],0x1)['finally'](function(){_0x44ee3a['updateOriginated'](_0x30ae3a);});}}else{_0x30ae3a[_0x4df9('0x1ed')]+=0x1;_0x44ee3a['updateOriginated'](_0x30ae3a);if(_0x30ae3a[_0x4df9('0x1ee')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb7407d[_0x4df9('0xf4')],'ListId':_0xb7407d['ListId'],'VoiceQueueId':_0xb7407d[_0x4df9('0xe7')]||undefined,'CampaignId':_0xb7407d[_0x4df9('0xe8')]||undefined})[_0x4df9('0xaa')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x4df9('0xcc')](createObjHistory(_0x30ae3a,_0xb7407d,utils[_0x4df9('0x73')]['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x1ef')));}else{_0x44ee3a['saveInDb'](createObjHistory(_0x30ae3a,_0xb7407d,utils['CAMPAIGN_STATUS'][_0x4df9('0x1f0')],0x16,_0x4df9('0x1f1')),'[Originate][HistoryRecallClose][historyCatch]',_0x4df9('0x1f2'));}}}}else{_0x30ae3a['outboundBlacklistCallsDay']+=0x1;_0x44ee3a[_0x4df9('0x11d')](createObjHistory(_0x30ae3a,_0xb7407d,utils[_0x4df9('0x73')][_0x4df9('0x1f3')],0xd,_0x4df9('0x1f4')),_0x4df9('0x1f5'),_0x4df9('0x1f6'));throw _0x4df9('0x1f7');}};};Dialer[_0x4df9('0x1c')][_0x4df9('0x15d')]=function(_0x1a5e5a){var _0x12d1b8=this;var _0x47751b=_0x1a5e5a['limitCalls']-_0x1a5e5a[_0x4df9('0x88')];emitCampaignSummary(_0x1a5e5a);if(_0x47751b>0x0&&_0x1a5e5a[_0x4df9('0x1f8')]==0x0){if(_0x47751b>this[_0x4df9('0x25')]){_0x47751b=this[_0x4df9('0x25')];}_0x1a5e5a[_0x4df9('0x1f8')]=0x1;hopperUtils[_0x4df9('0x1f9')](_0x1a5e5a,_0x47751b)['then'](function(_0x32d31e){_0x1a5e5a[_0x4df9('0x1f8')]=0x0;if(_0x32d31e){if(!utils['checkContactEmpty'](_0x32d31e)){_0x1a5e5a[_0x4df9('0x72')]=utils[_0x4df9('0x73')][_0x4df9('0x75')];logger[_0x4df9('0x53')](_0x4df9('0x1fa')+_0x1a5e5a[_0x4df9('0x6a')]);}else{_0x1a5e5a['originated']+=_0x32d31e['length'];_0x1a5e5a['message']=utils[_0x4df9('0x73')]['RUNNING'];for(var _0x4b7fa1=0x0;_0x4b7fa1<_0x32d31e['length'];_0x4b7fa1+=0x1){_0x1a5e5a[_0x4df9('0x1fb')]+=0x1;if(_[_0x4df9('0xfc')](_0x32d31e[_0x4b7fa1])||_['isNil'](_0x32d31e[_0x4b7fa1]['Contact'])||_['isNil'](_0x32d31e[_0x4b7fa1][_0x4df9('0x161')])){_0x12d1b8[_0x4df9('0x1fc')]('[actionOriginate]\x20',_0x1a5e5a,_0x32d31e[_0x4b7fa1]);}else{hopperUtils[_0x4df9('0x1fd')](_[_0x4df9('0x7c')](_0x32d31e[_0x4b7fa1],[_0x4df9('0xe8'),_0x4df9('0x161')]))[_0x4df9('0x47')](_0x12d1b8[_0x4df9('0x1fe')](_0x1a5e5a,_0x32d31e[_0x4b7fa1]))[_0x4df9('0xaa')](_0x12d1b8[_0x4df9('0x1ff')](_0x4df9('0x200'),_0x1a5e5a));}}}}})[_0x4df9('0xaa')](loggerGetContactDialer(_0x4df9('0x201'),_0x1a5e5a,_0x47751b));}};Dialer[_0x4df9('0x1c')][_0x4df9('0xb7')]=function(_0x49c02a,_0x1f5b2e){var _0x49a6c7=this;var _0x5f2b3d=[];if(_0x1f5b2e<0x1||_0x49c02a[_0x4df9('0xb5')]===_0x4df9('0x8')){_0x1f5b2e=0x1;}var _0x419886=Math[_0x4df9('0x1c0')](_0x49c02a[_0x4df9('0x13e')]*_0x1f5b2e)-_0x49c02a[_0x4df9('0x88')];if(_0x49c02a['dialLimitQueue']>0x0){var _0x410fd4=_0x49c02a[_0x4df9('0x202')]-_0x49c02a['originated']-_0x49c02a[_0x4df9('0x13f')]-_0x49c02a[_0x4df9('0x140')];if(_0x419886>_0x410fd4){_0x419886=_0x410fd4;}}if(_0x419886>0x0&&_0x49c02a[_0x4df9('0x1f8')]==0x0){if(_0x49c02a['dialMethod']===_0x4df9('0x8')){_0x419886=0x1;}if(_0x419886>this[_0x4df9('0x25')]){_0x419886=this[_0x4df9('0x25')];}for(var _0x5bd74c in this['agents']){if(typeof this[_0x4df9('0x23')][_0x5bd74c]!==_0x4df9('0x203')){if(this['agents'][_0x5bd74c][_0x4df9('0xd6')]===_0x4df9('0x204')&&this[_0x4df9('0x23')][_0x5bd74c][_0x4df9('0x90')]===_0x4df9('0x91')){_0x5f2b3d[_0x4df9('0xa3')](this[_0x4df9('0x23')][_0x5bd74c]['id']);}}}_0x49c02a[_0x4df9('0x1f8')]=0x1;hopperUtils[_0x4df9('0x205')](_0x49c02a,_0x5f2b3d,_0x419886)[_0x4df9('0x47')](function(_0x4d3cf0){_0x49c02a[_0x4df9('0x1f8')]=0x0;if(_0x4d3cf0){if(!utils[_0x4df9('0x206')](_0x4d3cf0)){hopperUtils['countReScheduled'](_0x49c02a)[_0x4df9('0x47')](sendMessageReschedule(_0x49c02a))[_0x4df9('0xaa')](loggerCatch(_0x4df9('0x207')));}else{_0x49c02a[_0x4df9('0x88')]+=_0x4d3cf0[_0x4df9('0x14a')];_0x49c02a['message']=_0x49c02a[_0x4df9('0xb5')]===_0x4df9('0x8')?utils[_0x4df9('0x73')][_0x4df9('0x141')]:utils['CAMPAIGN_STATUS'][_0x4df9('0x208')];for(var _0x2d10b0=0x0;_0x2d10b0<_0x4d3cf0[_0x4df9('0x14a')];_0x2d10b0+=0x1){if(_[_0x4df9('0xfc')](_0x4d3cf0[_0x2d10b0])||_['isNil'](_0x4d3cf0[_0x2d10b0][_0x4df9('0x178')])||_['isNil'](_0x4d3cf0[_0x2d10b0][_0x4df9('0x161')])){_0x49a6c7[_0x4df9('0x1fc')](_0x4df9('0x209'),_0x49c02a,_0x4d3cf0[_0x2d10b0]);}else{hopperUtils[_0x4df9('0x20a')](_[_0x4df9('0x7c')](_0x4d3cf0[_0x2d10b0],[_0x4df9('0xe7'),_0x4df9('0x161')]))[_0x4df9('0x47')](_0x49a6c7[_0x4df9('0x1fe')](_0x49c02a,_0x4d3cf0[_0x2d10b0]))['catch'](_0x49a6c7[_0x4df9('0x1ff')](_0x4df9('0x209'),_0x49c02a));}}}}})[_0x4df9('0xaa')](loggerGetContactDialer(_0x4df9('0x20b'),_0x49c02a,_0x419886));}};Dialer[_0x4df9('0x1c')][_0x4df9('0x6c')]=function(_0x8ee783){if(_0x8ee783[_0x4df9('0x202')]>0x0){var _0x5321d6=_0x8ee783['dialLimitQueue']-_0x8ee783[_0x4df9('0x88')]-_0x8ee783[_0x4df9('0x13f')];if(_0x5321d6>0x0&&_0x8ee783[_0x4df9('0x1f8')]==0x0){this[_0x4df9('0x20c')](_0x8ee783);}else{loggerPredictiveCalls[_0x4df9('0x53')](_0x4df9('0x20d'));}}else{this[_0x4df9('0x20c')](_0x8ee783);}};Dialer[_0x4df9('0x1c')][_0x4df9('0x20c')]=function(_0x2f109f){var _0x3e3918=this;var _0x501965=[];_0x2f109f[_0x4df9('0x88')]+=0x1;for(var _0x579ae5 in this[_0x4df9('0x23')]){if(typeof this[_0x4df9('0x23')][_0x579ae5]!==_0x4df9('0x203')){if(this[_0x4df9('0x23')][_0x579ae5][_0x4df9('0xd6')]===_0x4df9('0x204')&&this[_0x4df9('0x23')][_0x579ae5][_0x4df9('0x90')]===_0x4df9('0x91')){_0x501965[_0x4df9('0xa3')](this[_0x4df9('0x23')][_0x579ae5]['id']);}}}_0x2f109f[_0x4df9('0x1f8')]=0x1;return this[_0x4df9('0x205')](_0x2f109f['id'],_0x501965,0x1,_0x2f109f[_0x4df9('0x20e')],_0x2f109f)[_0x4df9('0x47')](function(_0x44a2c3){_0x2f109f[_0x4df9('0x1f8')]=0x1;if(_0x44a2c3){if(!utils['checkContactEmpty'](_0x44a2c3)){utils[_0x4df9('0x70')](_0x2f109f,0x1,0x0);return hopperUtils[_0x4df9('0x20f')](_0x2f109f)['then'](sendMessageReschedule(_0x2f109f))[_0x4df9('0xaa')](loggerCatch('[countReScheduled]\x20'));}else{_0x2f109f[_0x4df9('0x72')]=utils[_0x4df9('0x73')][_0x4df9('0x208')];if(_['isNil'](_0x44a2c3[0x0])||_[_0x4df9('0xfc')](_0x44a2c3[0x0][_0x4df9('0x178')])||_['isNil'](_0x44a2c3[0x0][_0x4df9('0x161')])){_0x3e3918[_0x4df9('0x1fc')](_0x4df9('0x209'),_0x2f109f,_0x44a2c3[0x0]);}else{return hopperUtils[_0x4df9('0x20a')](_[_0x4df9('0x7c')](_0x44a2c3[0x0],['VoiceQueueId',_0x4df9('0x161')]))[_0x4df9('0x47')](_0x3e3918[_0x4df9('0x1fe')](_0x2f109f,_0x44a2c3[0x0]))[_0x4df9('0xaa')](_0x3e3918['loggerHandler'](_0x4df9('0x210'),_0x2f109f));}}}})[_0x4df9('0xaa')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2f109f,0x1));};Dialer[_0x4df9('0x1c')][_0x4df9('0x1d8')]=function(_0x192b00,_0x19ed95,_0x9cbdd1,_0x701bbf,_0x50be21,_0x5199a2){loggerPredictive[_0x4df9('0x53')](_0x4df9('0x211'));loggerPredictive[_0x4df9('0x53')](_0x4df9('0x212'),_0x192b00);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x213'),_0x19ed95);loggerPredictive[_0x4df9('0x53')]('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',_0x9cbdd1);loggerPredictive['info'](_0x4df9('0x214'),_0x701bbf);loggerPredictive[_0x4df9('0x53')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50be21);loggerPredictive['info'](_0x4df9('0x5b'));return new Promise(function(_0x5bc54d,_0xfe100e){if(_0x192b00<=0x0||isNaN(_0x192b00)){return _0xfe100e(msgResponse(_0x4df9('0x215'),'Error',_0x4df9('0x216')+_0x192b00));}if(_0x9cbdd1<=0x0||isNaN(_0x9cbdd1)){return _0xfe100e(msgResponse(_0x4df9('0x215'),'Error',_0x4df9('0x217')+_0x9cbdd1));}if(_0x701bbf<=0x0||isNaN(_0x701bbf)){return _0xfe100e(msgResponse(_0x4df9('0x215'),'Error','p\x20=\x20'+_0x701bbf));}if(_0x19ed95<=0x0||isNaN(_0x19ed95)){return _0xfe100e(msgResponse(_0x4df9('0x215'),_0x4df9('0x8c'),'interval\x20=\x20'+_0x19ed95));}if(_0x50be21<=0x0||isNaN(_0x50be21)){return _0xfe100e(msgResponse(_0x4df9('0x215'),_0x4df9('0x8c'),_0x4df9('0x218')+_0x50be21));}_0x5199a2=_0x5199a2||0x0;var _0x1a7110=0x1/_0x9cbdd1;var _0x145350=0x0;var _0xb6eef=0x0;var _0x3ba27a=0x0;var _0x5ea082=0x0;for(var _0x2bcd2b=0x0;_0x3ba27a<_0x50be21;_0x2bcd2b+=0x1){_0xb6eef=_0x2bcd2b/_0x19ed95;_0x145350=(_0x701bbf*_0xb6eef+_0x5199a2)/_0x1a7110;_0x3ba27a=utils[_0x4df9('0x219')](_0x145350,_0x192b00);_0x5ea082=_0x145350/_0x192b00*(0x1-utils[_0x4df9('0x219')](_0x145350,_0x192b00));}return _0x5bc54d({'erlangCalls':_0x2bcd2b,'erlangCallToSecond':_0x19ed95/_0x2bcd2b,'erlangAbandonmentRate':_0x3ba27a,'erlangBusyFactor':_0x5ea082});});};Dialer[_0x4df9('0x1c')][_0x4df9('0x1da')]=function(_0x12b36a,_0xe13703,_0x255c08,_0xcbc488,_0x33e14c,_0x41d2e2){loggerPredictive[_0x4df9('0x53')](_0x4df9('0x21a'));loggerPredictive[_0x4df9('0x53')](_0x4df9('0x212'),_0x12b36a);loggerPredictive[_0x4df9('0x53')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe13703);loggerPredictive[_0x4df9('0x53')]('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',_0x255c08);loggerPredictive['info'](_0x4df9('0x214'),_0xcbc488);loggerPredictive[_0x4df9('0x53')](_0x4df9('0x21b'),_0x33e14c);loggerPredictive[_0x4df9('0x53')]('---------------------------');return new Promise(function(_0x22de2d,_0x2b5b57){if(_0x12b36a<=0x0||isNaN(_0x12b36a)){return _0x2b5b57(msgResponse(_0x4df9('0x21c'),_0x4df9('0x8c'),'m\x20=\x20'+_0x12b36a));}if(_0x255c08<=0x0||isNaN(_0x255c08)){return _0x2b5b57(msgResponse(_0x4df9('0x21c'),_0x4df9('0x8c'),_0x4df9('0x217')+_0x255c08));}if(_0xcbc488<=0x0||isNaN(_0xcbc488)){return _0x2b5b57(msgResponse(_0x4df9('0x21c'),'Error',_0x4df9('0x21d')+_0xcbc488));}if(_0xe13703<=0x0||isNaN(_0xe13703)){return _0x2b5b57(msgResponse('[busyFactor]',_0x4df9('0x8c'),_0x4df9('0x21e')+_0xe13703));}if(_0x33e14c<=0x0||isNaN(_0x33e14c)){return _0x2b5b57(msgResponse(_0x4df9('0x21c'),_0x4df9('0x8c'),'Umin\x20=\x20'+_0x33e14c));}_0x41d2e2=_0x41d2e2||0x0;var _0x226795=0x1/_0x255c08;var _0x4f78cf=0x0;var _0xfab22d=0x0;var _0x283692=0x0;var _0x38db8c=0x0;for(var _0x585f8d=0x0;_0x38db8c<_0x33e14c;_0x585f8d+=0x1){_0xfab22d=_0x585f8d/_0xe13703;_0x4f78cf=(_0xcbc488*_0xfab22d+_0x41d2e2)/_0x226795;_0x283692=utils[_0x4df9('0x219')](_0x4f78cf,_0x12b36a);_0x38db8c=_0x4f78cf/_0x12b36a*(0x1-utils['erlangb'](_0x4f78cf,_0x12b36a));}return _0x22de2d({'erlangCalls':_0x585f8d,'erlangCallToSecond':_0xe13703/_0x585f8d,'erlangAbandonmentRate':_0x283692,'erlangBusyFactor':_0x38db8c});});};module[_0x4df9('0x21f')]=Dialer; \ No newline at end of file +var _0x3a9c=['message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','Error','stringify','isTrunkReachable','active','status','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','content','indexOf','true','iftime\x20%s,%s','catch','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','OVERTIME_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','updateOriginated','queue','ivr','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','additional','minutes','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','ContactId','ListId','[rescheduleContact][Abandoned]','channel','syncQueueMember','actionid','roundrobin','isNil','locked','stateinterface','rrmemory','pick','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','rescheduleContact','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','getQueue','Success','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr]','countbusyretry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','Unknow','queuesSummary','running','INACTIVE','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','temp','contactsRescheduled'];(function(_0x1c1930,_0x279a6e){var _0x52bc81=function(_0xd37875){while(--_0xd37875){_0x1c1930['push'](_0x1c1930['shift']());}};_0x52bc81(++_0x279a6e);}(_0x3a9c,0x1be));var _0xc3a9=function(_0x5a1d98,_0x513921){_0x5a1d98=_0x5a1d98-0x0;var _0x1e8a81=_0x3a9c[_0x5a1d98];return _0x1e8a81;};'use strict';var util=require(_0xc3a9('0x0'));var _=require(_0xc3a9('0x1'));var uuid=require(_0xc3a9('0x2'));var moment=require(_0xc3a9('0x3'));var rr=require('rr');var Redis=require(_0xc3a9('0x4'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require(_0xc3a9('0x5'));var config=require(_0xc3a9('0x6'));var logger=require(_0xc3a9('0x7'))(_0xc3a9('0x8'));var loggerBooked=require(_0xc3a9('0x7'))(_0xc3a9('0x9'));var loggerPredictive=require(_0xc3a9('0x7'))(_0xc3a9('0xa'));var loggerPredictiveCalls=require(_0xc3a9('0x7'))(_0xc3a9('0xb'));var loggerSyncQueueSummary=require(_0xc3a9('0x7'))(_0xc3a9('0xc'));var ami=require(_0xc3a9('0xd'));config[_0xc3a9('0xe')]=_[_0xc3a9('0xf')](config[_0xc3a9('0xe')],{'host':_0xc3a9('0x10'),'port':0x18eb});var io=require(_0xc3a9('0x11'))(new Redis(config[_0xc3a9('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xc3a9('0x12'));var Interval=require('../rpc/interval');var Action=require(_0xc3a9('0x13'));var History=require(_0xc3a9('0x14'));var Final=require(_0xc3a9('0x15'));var AgentComplete=require(_0xc3a9('0x16'));var QueueCallerAbandon=require(_0xc3a9('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0xc3a9('0x18')][_0xc3a9('0x19')]||_0xc3a9('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xc3a9('0x1b')][_0xc3a9('0x1c')]=function(_0x152864){this[_0xc3a9('0x1d')]=this[_0xc3a9('0x1d')]?this[_0xc3a9('0x1d')]['finally'](_0x152864):_0x152864();};function Dialer(_0x2841a5,_0x3bae34){this['sequence']=new Sequence();this[_0xc3a9('0x1e')]=_0x3bae34;this[_0xc3a9('0x1f')]=_0x2841a5['voiceQueues'];this[_0xc3a9('0x20')]=_0x2841a5[_0xc3a9('0x20')];this[_0xc3a9('0x21')]=_0x2841a5[_0xc3a9('0x21')];this['trunks']=_0x2841a5[_0xc3a9('0x22')];this[_0xc3a9('0x23')]=config[_0xc3a9('0x23')]||0x2;this['channels']={};this[_0xc3a9('0x24')]={};this[_0xc3a9('0x25')]={};this[_0xc3a9('0x26')]={};this['optionPredictive']={};this[_0xc3a9('0x27')]={};this[_0xc3a9('0x28')]={};this[_0xc3a9('0x29')]={};this[_0xc3a9('0x2a')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0xc3a9('0x2b'),this[_0xc3a9('0x2c')][_0xc3a9('0x2d')](this));ami['on']('queuecallerabandon',this[_0xc3a9('0x2e')][_0xc3a9('0x2d')](this));ami['on'](_0xc3a9('0x2f'),this[_0xc3a9('0x30')][_0xc3a9('0x2d')](this));ami['on'](_0xc3a9('0x31'),this[_0xc3a9('0x32')][_0xc3a9('0x2d')](this));ami['on'](_0xc3a9('0x33'),this[_0xc3a9('0xc')]['bind'](this));ami['on'](_0xc3a9('0x34'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xc3a9('0x35'),this[_0xc3a9('0x36')][_0xc3a9('0x2d')](this));ami['on'](_0xc3a9('0x37'),this[_0xc3a9('0x38')][_0xc3a9('0x2d')](this));ami['on'](_0xc3a9('0x39'),this[_0xc3a9('0x3a')][_0xc3a9('0x2d')](this));ami['on'](_0xc3a9('0x3b'),this['syncQueueMember'][_0xc3a9('0x2d')](this));ami['on'](_0xc3a9('0x3c'),this[_0xc3a9('0x3d')][_0xc3a9('0x2d')](this));this[_0xc3a9('0x3e')]();this[_0xc3a9('0x3f')]();RpcSetting[_0xc3a9('0x40')]()[_0xc3a9('0x41')](function(_0x385536){previewRecallmeReminderInterval=_0x385536[_0xc3a9('0x42')];});}function isNotNull(_0x1e9515){return _0x1e9515!==null&&!_[_0xc3a9('0x43')](_0x1e9515);}function msgResponse(_0x58f230,_0x1ed55f,_0x185073){return{'action':_0x58f230,'response':_0x1ed55f,'message':_0x185073,'stack':_0x185073};}function emit(_0x46d369,_0x3fd674,_0x31c1f9){io['to'](_0x46d369)[_0xc3a9('0x44')](_0x3fd674,_0x31c1f9);}function emitOutboundVoiceQueueSummary(_0x3fabcb){if(_0x3fabcb[_0xc3a9('0x45')]===_0xc3a9('0x46')){logger[_0xc3a9('0x47')](_0xc3a9('0x48'),util[_0xc3a9('0x49')](_0x3fabcb,{'showHidden':![],'depth':null}));emit(util[_0xc3a9('0x4a')]('voice:queue:%s',_0x3fabcb[_0xc3a9('0x4b')]),_0xc3a9('0x4c'),_0x3fabcb);}}function checkGetDataPredictive(_0x704aa8){if(isNotNull(_0x704aa8)&&!_[_0xc3a9('0x4d')](_0x704aa8)){loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x4f'));loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x50'),_0x704aa8[_0xc3a9('0x51')]);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x52'),_0x704aa8[_0xc3a9('0x53')]);loggerPredictive[_0xc3a9('0x4e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x704aa8['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xc3a9('0x4e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x704aa8['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x54'),_0x704aa8[_0xc3a9('0x55')]);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x56'),_0x704aa8[_0xc3a9('0x57')]);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x58'));if(_0x704aa8[_0xc3a9('0x51')]>0x0){if(!_[_0xc3a9('0x43')](_0x704aa8['predictiveIntervalAvgTalktime'])&&_0x704aa8[_0xc3a9('0x57')]>0x0){return!![];}loggerPredictive['info'](_0xc3a9('0x59'));if(!_[_0xc3a9('0x43')](_0x704aa8[_0xc3a9('0x55')])&&_0x704aa8[_0xc3a9('0x55')]>0x0){return!![];}loggerPredictive[_0xc3a9('0x4e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x5a'));}return![];}function mergeDataErlangB(_0x56802f){return function(_0x22eaf2){loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x5b'));loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x5c'),_0x22eaf2[_0xc3a9('0x5d')]);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x5e'),_0x22eaf2[_0xc3a9('0x5f')]);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x60'),_0x22eaf2[_0xc3a9('0x61')]);loggerPredictive[_0xc3a9('0x4e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22eaf2['erlangBusyFactor']);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x60'),_0x22eaf2[_0xc3a9('0x61')]);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x58'));_[_0xc3a9('0x62')](_0x56802f,_0x22eaf2);};}function ifInterval(_0x56e8d5,_0x571cb5){if(_['isUndefined'](_0x571cb5)){return![];}return utils[_0xc3a9('0x63')](undefined,_0x571cb5)<_0x56e8d5*0x3c;}function clearPredictiveAttributes(_0x11206b){if(_0x11206b[_0xc3a9('0x28')]){_0x11206b['startProgressive']=undefined;loggerPredictive['debug'](_0x11206b['name'],_0xc3a9('0x64'));}if(_0x11206b['startPredictive']){_0x11206b[_0xc3a9('0x27')]=undefined;loggerPredictive['debug'](_0x11206b['name'],_0xc3a9('0x65'));}if(_0x11206b['handlePredictive']){clearInterval(_0x11206b[_0xc3a9('0x66')]);_0x11206b[_0xc3a9('0x66')]=undefined;loggerPredictive[_0xc3a9('0x47')](_0x11206b[_0xc3a9('0x4b')],_0xc3a9('0x67'));}}function loggerCatchPredictive(_0x2fabd1,_0x5f4853){return function(_0x16304b){loggerPredictive[_0xc3a9('0x68')](_0x5f4853['name'],_0x2fabd1);loggerPredictive[_0xc3a9('0x68')](_0x16304b[_0xc3a9('0x69')]);clearPredictiveAttributes(_0x5f4853);};}function loggerCatch(_0xc06b3b){return function(_0x48d29e){logger[_0xc3a9('0x68')](_0xc06b3b,util[_0xc3a9('0x49')](_0x48d29e,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x10717d,_0x3ec0a3,_0x1c507d){return function(_0x3a1f6a){utils['checkContactLowerLimitOriginate'](_0x3ec0a3,_0x1c507d,0x0);_0x3ec0a3[_0xc3a9('0x6a')]=0x0;logger['error'](_0x10717d,util[_0xc3a9('0x49')](_0x3a1f6a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x45d820){return function(_0x35b884){if(isNotNull(_0x35b884)&&isNotNull(_0x35b884[0x0])){if(_0x35b884[0x0][_0xc3a9('0x6b')]>0x0){_0x45d820[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x6e')];logger[_0xc3a9('0x4e')](_0xc3a9('0x6f')+_0x45d820[_0xc3a9('0x4b')],_0x35b884[0x0][_0xc3a9('0x6b')],_0xc3a9('0x70'));}else{_0x45d820[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x71')];logger[_0xc3a9('0x4e')](_0xc3a9('0x72')+_0x45d820['name']);}}};}function createObjHistory(_0x29cd1c,_0x45d7fe,_0x464688,_0x313c61,_0x22b38e){_0x29cd1c[_0xc3a9('0x6c')]=_0x464688;var _0x3a2b87=new Action(_0x29cd1c,_0x45d7fe);var _0x571cff=new History(_0x3a2b87);_0x571cff[_0xc3a9('0x73')]=_0x313c61;_0x571cff['statedesc']=_0x22b38e;_0x571cff[_0xc3a9('0x74')]=_0x3a2b87[_0xc3a9('0x75')];return _0x571cff;}function unlockQueueStatus(_0x4615bf,_0x5582dc){setTimeout(function(){if(_[_0xc3a9('0x43')](_0x4615bf[_0xc3a9('0x76')])){loggerBooked[_0xc3a9('0x68')](_0xc3a9('0x77'),_0x5582dc);}_0x4615bf[_0xc3a9('0x76')]=!![];loggerBooked['info'](_0xc3a9('0x78'),_0x5582dc,JSON['stringify'](_['pick'](_0x4615bf,[_0xc3a9('0x4b'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x353c7d){return function(){if(!isNotNull(_0x353c7d[_0xc3a9('0x79')])){_0x353c7d['message']=utils['CAMPAIGN_STATUS'][_0xc3a9('0x7a')];throw _0x353c7d['name']+_0xc3a9('0x7b');}if(!isNotNull(_0x353c7d[_0xc3a9('0x79')][_0xc3a9('0x7c')])){_0x353c7d[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x7a')];throw _0x353c7d[_0xc3a9('0x4b')]+_0xc3a9('0x7b');}if(!isNotNull(_['isEmpty'](_0x353c7d['Interval']['Intervals']))){_0x353c7d['message']=utils[_0xc3a9('0x6d')][_0xc3a9('0x7a')];throw _0x353c7d[_0xc3a9('0x4b')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x569d20){return function(){if(!utils[_0xc3a9('0x7d')](_0x569d20)){_0x569d20['message']=utils[_0xc3a9('0x6d')]['INACTIVE'];throw _0x569d20[_0xc3a9('0x4b')]+_0xc3a9('0x7e');}};}function emitCampaignSummary(_0x5a19d7){if(utils[_0xc3a9('0x7f')](_0x5a19d7)){emit(util[_0xc3a9('0x4a')](_0xc3a9('0x80'),_0x5a19d7[_0xc3a9('0x4b')]),'campaign:save',_0x5a19d7);}}function loggerCatchQueueSummary(_0x12b8e6,_0x129077){return function(_0x1f291a){clearPredictiveAttributes(_0x129077);emitCampaignSummary(_0x129077);loggerSyncQueueSummary[_0xc3a9('0x47')](_0x12b8e6,util[_0xc3a9('0x49')](_0x1f291a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1e1a56){if(_0x1e1a56['sendMessageOneNotActive']){if(_0x1e1a56['originated']===0x0){_0x1e1a56[_0xc3a9('0x81')]=![];_0x1e1a56[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')]['INACTIVE'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1e1a56[_0xc3a9('0x4b')],_0xc3a9('0x82'));}else{_0x1e1a56[_0xc3a9('0x6c')]=utils['CAMPAIGN_STATUS'][_0xc3a9('0x83')];loggerSyncQueueSummary['debug'](_0xc3a9('0x84'),_0x1e1a56[_0xc3a9('0x4b')],'is\x20disactive');}emitCampaignSummary(_0x1e1a56);}}function myreject(_0x53bc59){return function(_0x56065a){return _0x53bc59(msgResponse(_0xc3a9('0x85'),_0xc3a9('0x86'),JSON[_0xc3a9('0x87')](_0x56065a)));};}Dialer[_0xc3a9('0x1b')][_0xc3a9('0x88')]=function(_0x5b931e){return!_[_0xc3a9('0x43')](_0x5b931e)&&_0x5b931e&&!_['isUndefined'](_0x5b931e['name'])&&!_[_0xc3a9('0x43')](_0x5b931e['active'])&&_0x5b931e[_0xc3a9('0x89')]&&(this[_0xc3a9('0x22')][util[_0xc3a9('0x4a')]('SIP/%s',_0x5b931e[_0xc3a9('0x4b')])][_0xc3a9('0x8a')]==='reachable'||this[_0xc3a9('0x22')][util[_0xc3a9('0x4a')](_0xc3a9('0x8b'),_0x5b931e[_0xc3a9('0x4b')])][_0xc3a9('0x8a')]===_0xc3a9('0x8c'));};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x8d')]=function(_0x1eeb7e){var _0x5440a1=this;return function(){if(!_0x5440a1[_0xc3a9('0x88')](_0x1eeb7e[_0xc3a9('0x8e')])){if(!_0x5440a1[_0xc3a9('0x88')](_0x1eeb7e['TrunkBackup'])){_0x1eeb7e[_0xc3a9('0x6c')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x1eeb7e[_0xc3a9('0x4b')]+_0xc3a9('0x8f');}}};};Dialer['prototype'][_0xc3a9('0x90')]=function(_0x4e6261,_0x294e64,_0x4fa5b4,_0x328708){var _0x2389d8=this;return function(){var _0x529df2=!![];return _0x2389d8[_0xc3a9('0x91')](_0x4e6261,_0x294e64,_0x4fa5b4,_0x328708,_0x529df2);};};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x92')]=function(_0x51ea3d,_0x56a468,_0x2618de,_0x4bc117){var _0x17f98a=this;return function(){var _0x3945c1=![];return _0x17f98a[_0xc3a9('0x91')](_0x51ea3d[_0xc3a9('0x7c')],_0x56a468,_0x2618de,_0x4bc117,_0x3945c1);};};Dialer[_0xc3a9('0x1b')]['ifTimeIvr']=function(_0x564bbf,_0x2c6b59,_0x360699,_0x404e04,_0x2fd747){var _0x4758e3=[];return new Promise(function(_0x1049cc,_0x57f42b){if(!isNotNull(_0x564bbf)){_0x404e04[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x7a')];return _0x57f42b(msgResponse(_0xc3a9('0x93'),_0xc3a9('0x94'),_0x360699+_0xc3a9('0x95')));}if(_[_0xc3a9('0x4d')](_0x564bbf)){_0x404e04[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x96')];return _0x57f42b(msgResponse(_0xc3a9('0x93'),'Failure',_0x360699+'\x20Intervals\x20is\x20empty\x20'));}if(_0x2c6b59&&_['isUndefined'](config[_0xc3a9('0x97')][_0x2c6b59])){_0x404e04[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x98')];return _0x57f42b(msgResponse(_0xc3a9('0x93'),_0xc3a9('0x94'),_0x360699+_0xc3a9('0x99')+_0x2c6b59));}if(_[_0xc3a9('0x9a')](_0x564bbf)){for(var _0xf0885b=0x0;_0xf0885b<_0x564bbf[_0xc3a9('0x9b')];_0xf0885b+=0x1){_0x4758e3[_0xc3a9('0x9c')](ami[_0xc3a9('0x9d')]({'action':_0xc3a9('0x9e'),'command':util[_0xc3a9('0x4a')]('iftime\x20%s,%s',_0x564bbf[_0xf0885b][_0xc3a9('0x9f')],!_[_0xc3a9('0x43')](config['timezones'][_0x2c6b59])?_0x2c6b59:'')})[_0xc3a9('0x41')](function(_0x4ed90a){return _0x4ed90a[_0xc3a9('0xa0')][_0xc3a9('0xa1')](_0xc3a9('0xa2'))>=0x0;})['catch'](myreject(_0x57f42b)));}}else{_0x4758e3[_0xc3a9('0x9c')](ami[_0xc3a9('0x9d')]({'action':'command','command':util[_0xc3a9('0x4a')](_0xc3a9('0xa3'),_0x564bbf,!_['isUndefined'](config[_0xc3a9('0x97')][_0x2c6b59])?_0x2c6b59:'')})[_0xc3a9('0x41')](function(_0x99ed75){return _0x99ed75['content'][_0xc3a9('0xa1')]('true')>=0x0;})[_0xc3a9('0xa4')](myreject(_0x57f42b)));}Promise[_0xc3a9('0xa5')](_0x4758e3)['then'](function(_0x298dcc){var _0x40f4f1=_['some'](_0x298dcc);if(_0x40f4f1){return _0x1049cc(_0x40f4f1);}else{_0x404e04[_0xc3a9('0x6c')]=_0x2fd747?utils['CAMPAIGN_STATUS'][_0xc3a9('0xa6')]:utils[_0xc3a9('0x6d')]['OVERTIME_INTERVAL'];return _0x57f42b(msgResponse(_0xc3a9('0xa7'),'Failure','Global:\x20'+_0x2fd747+'\x20'+_0x360699+_0xc3a9('0xa8')+util[_0xc3a9('0x49')](_0x564bbf,{'showHidden':![],'depth':null})+_0xc3a9('0xa9')+_0x2c6b59));}})[_0xc3a9('0xa4')](function(_0x3db8e2){return _0x57f42b(msgResponse(_0xc3a9('0x93'),_0xc3a9('0x94'),JSON[_0xc3a9('0x87')](_0x3db8e2)));});});};Dialer['prototype'][_0xc3a9('0x3e')]=function(){var _0x355000=this;return cmHopper[_0xc3a9('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0xc3a9('0x41')](function(){setInterval(function(){_0x355000['syncCampaigns']();},0x3e8);});};Dialer[_0xc3a9('0x1b')][_0xc3a9('0xab')]=function(){var _0x20edb2=this;var _0x584b80;for(var _0x26c470 in this['campaigns']){if(typeof this['campaigns'][_0x26c470]!==_0xc3a9('0xac')){_0x584b80=this[_0xc3a9('0x20')][_0x26c470];if(utils['isIVRCampaign'](_0x584b80)&&utils[_0xc3a9('0x7d')](_0x584b80)){_0x584b80['sendMessageOneNotActive']=!![];Promise[_0xc3a9('0xad')]()[_0xc3a9('0x41')](checkIsIVRCampaignActive(_0x584b80))[_0xc3a9('0x41')](checkInterval(_0x584b80))['then'](_0x20edb2[_0xc3a9('0x8d')](_0x584b80))[_0xc3a9('0x41')](_0x20edb2[_0xc3a9('0x90')](_0x584b80[_0xc3a9('0xae')],_0x584b80[_0xc3a9('0xaf')],_0x584b80[_0xc3a9('0x4b')],_0x584b80))[_0xc3a9('0x41')](_0x20edb2[_0xc3a9('0x92')](_0x584b80['Interval'],_0x584b80[_0xc3a9('0xaf')],_0x584b80['name'],_0x584b80))[_0xc3a9('0x41')](_0x20edb2[_0xc3a9('0xb0')](_0x584b80))[_0xc3a9('0xa4')](loggerCatchQueueSummary('[syncCampaigns]',_0x584b80));}else{notSendMessagesCampaign(_0x584b80);}}}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0xb1')]=function(_0xdf7503){if(_0xdf7503[_0xc3a9('0xb2')]!==_0xc3a9('0xa')){clearPredictiveAttributes(_0xdf7503);}switch(_0xdf7503[_0xc3a9('0xb2')]){case _0xc3a9('0xb3'):this['handlePower'](_0xdf7503,0x1);break;case _0xc3a9('0xb4'):this[_0xc3a9('0xb5')](_0xdf7503,_0xdf7503[_0xc3a9('0xb6')]);break;case _0xc3a9('0xa'):this[_0xc3a9('0xa')](_0xdf7503);break;case'booked':this[_0xc3a9('0xb5')](_0xdf7503,0x1);break;default:logger[_0xc3a9('0x68')](_0xc3a9('0xb7'),_0xdf7503[_0xc3a9('0x4b')],_0xc3a9('0xb8'));}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x93')]=function(_0x1e7774,_0x5f188e){var _0x392fe7=_0x1e7774['dialTimezone'];var _0x5408d6=_0x5f188e?_0x1e7774[_0xc3a9('0xae')]:_0x1e7774[_0xc3a9('0x79')][_0xc3a9('0x7c')];logger['silly'](_0xc3a9('0xb9'),_0x5408d6,_0x392fe7,_0x1e7774['name'],util[_0xc3a9('0x4a')](_0xc3a9('0xba'),_0x1e7774[_0xc3a9('0x4b')],_0x1e7774['id']));var _0x2a53a5=null;return Interval['intervalIftime'](_0x5408d6,_0x392fe7)[_0xc3a9('0x41')](function(_0x3b2b95){if(_0x3b2b95===!![]){return _0x3b2b95;}else{_0x1e7774[_0xc3a9('0x6c')]=_0x5f188e?utils[_0xc3a9('0x6d')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0xc3a9('0xbb')];_0x2a53a5=msgResponse('[ifTime][promiseAll]',_0xc3a9('0x94'),'Global:\x20'+_0x5f188e+'\x20'+_0x1e7774[_0xc3a9('0x4b')]+_0xc3a9('0xa8')+util[_0xc3a9('0x49')](_0x5408d6,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x392fe7);}if(_0x2a53a5!==null){logger[_0xc3a9('0xbc')](_0xc3a9('0xbd'),_0x2a53a5);_0x2a53a5[_0xc3a9('0xbe')]=_0x5f188e;throw _0x2a53a5;}})[_0xc3a9('0xa4')](function(_0x2b806a){logger[_0xc3a9('0x68')](_0xc3a9('0xbf'),_0x2b806a);throw msgResponse(_0xc3a9('0x85'),'Error',util[_0xc3a9('0x49')](_0x2b806a,{'showHidden':![],'depth':null}));});};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x2c')]=function(_0x1ce43e){if(this['voiceQueues'][_0x1ce43e['queue']]){if(this[_0xc3a9('0x26')][_0x1ce43e[_0xc3a9('0xc0')]]&&this[_0xc3a9('0x26')][_0x1ce43e[_0xc3a9('0xc0')]][_0xc3a9('0x45')]!=='ivr'){this[_0xc3a9('0xc1')](this[_0xc3a9('0x1f')][_0x1ce43e[_0xc3a9('0xc2')]]);this[_0xc3a9('0x26')][_0x1ce43e[_0xc3a9('0xc0')]]['answertime']=moment()[_0xc3a9('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xc3a9('0x1b')]['syncAgentComplete']=function(_0x5320e5){var _0x177ea7=this['uniqueId'][_0x5320e5[_0xc3a9('0xc0')]];if(this[_0xc3a9('0x1f')][_0x5320e5[_0xc3a9('0xc2')]]){if(_0x177ea7&&_0x177ea7[_0xc3a9('0x45')]!==_0xc3a9('0xc3')){delete this['uniqueId'][_0x5320e5[_0xc3a9('0xc0')]];this[_0xc3a9('0x1f')][_0x5320e5['queue']][_0xc3a9('0xc4')]+=0x1;var _0x27b20e=new AgentComplete(_0x177ea7,_0x5320e5);if(_0x5320e5[_0xc3a9('0xc5')]===_0xc3a9('0xc6')){_0x27b20e['agiafterat']=this[_0xc3a9('0x1f')][_0x5320e5[_0xc3a9('0xc2')]][_0xc3a9('0xc7')]&&this[_0xc3a9('0x1f')][_0x5320e5[_0xc3a9('0xc2')]][_0xc3a9('0xc8')]?moment()['format'](_0xc3a9('0xc9')):undefined;}hopperUtils[_0xc3a9('0xca')](_0x27b20e)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xcb')));hopperUtils[_0xc3a9('0xcc')](_0x27b20e)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xcd')));}}};Dialer['prototype'][_0xc3a9('0x2e')]=function(_0x19c844){var _0x29b2fb=this[_0xc3a9('0x26')][_0x19c844['uniqueid']];var _0x105b48=this;var _0x220b86=![];var _0x59e830;var _0x461b15;if(this[_0xc3a9('0x1f')][_0x19c844[_0xc3a9('0xc2')]]){if(_0x29b2fb&&_0x29b2fb[_0xc3a9('0x45')]!==_0xc3a9('0xc3')){delete this[_0xc3a9('0x26')][_0x19c844[_0xc3a9('0xc0')]];this['updateOriginated'](this[_0xc3a9('0x1f')][_0x19c844['queue']]);_0x29b2fb[_0xc3a9('0xce')]=moment()['format'](_0xc3a9('0xc9'));var _0xa462d6=new QueueCallerAbandon(_0x29b2fb,_0x19c844);if(utils[_0xc3a9('0x63')](_0x29b2fb[_0xc3a9('0xce')],_0x29b2fb[_0xc3a9('0xcf')])>=_0x29b2fb[_0xc3a9('0xd0')]){this[_0xc3a9('0x1f')][_0x19c844[_0xc3a9('0xc2')]][_0xc3a9('0xd1')]+=0x1;this['voiceQueues'][_0x19c844['queue']][_0xc3a9('0xd2')]+=0x1;this['voiceQueues'][_0x19c844[_0xc3a9('0xc2')]][_0xc3a9('0xd3')]+=0x1;_0xa462d6[_0xc3a9('0x73')]=0xa;_0xa462d6[_0xc3a9('0xd4')]=_0xc3a9('0xd5');_0xa462d6[_0xc3a9('0xd6')]=_0xc3a9('0xd7');_0xa462d6[_0xc3a9('0xd8')]=this['voiceQueues'][_0x19c844[_0xc3a9('0xc2')]][_0xc3a9('0xc7')]?moment()[_0xc3a9('0x4a')](_0xc3a9('0xc9')):undefined;_0xa462d6[_0xc3a9('0xd9')]+=0x1;_0xa462d6[_0xc3a9('0xda')]+=0x1;_0x59e830=this[_0xc3a9('0x1f')][_0x19c844[_0xc3a9('0xc2')]][_0xc3a9('0xdb')];_0x461b15=this[_0xc3a9('0x1f')][_0x19c844['queue']][_0xc3a9('0xdc')];hopperUtils[_0xc3a9('0xdd')](_0xa462d6,_0xa462d6[_0xc3a9('0x73')],_0x29b2fb[_0xc3a9('0xde')])[_0xc3a9('0x41')](function(_0x41a13b){_0x220b86=_0x41a13b['additional']==0x1;if(_0xa462d6[_0xc3a9('0xd9')]>=_0x105b48[_0xc3a9('0x1f')][_0x19c844[_0xc3a9('0xc2')]][_0xc3a9('0xdf')]){_0x105b48[_0xc3a9('0xe0')](_0xa462d6,_0x41a13b[_0xc3a9('0xe1')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xa462d6[_0xc3a9('0xd9')],'scheduledat':moment()['add'](_0x105b48['voiceQueues'][_0x19c844['queue']][_0xc3a9('0xdb')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x29b2fb['ContactId'],'ListId':_0x29b2fb['ListId'],'VoiceQueueId':_0x29b2fb[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x29b2fb[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xe5')));var _0x57797a=new History(_0xa462d6);_0x57797a[_0xc3a9('0x73')]=0xa;_0x57797a['statedesc']=_0xc3a9('0xd5');_0x57797a[_0xc3a9('0x75')]=moment()[_0xc3a9('0x4a')](_0xc3a9('0xc9'));_0x57797a['endtime']=_0x57797a['starttime'];_0x57797a[_0xc3a9('0xe6')]=_0xa462d6[_0xc3a9('0xe6')];_0x57797a[_0xc3a9('0xe7')]=_0xa462d6[_0xc3a9('0xe7')];hopperUtils[_0xc3a9('0xca')](_0x57797a)[_0xc3a9('0xa4')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xc3a9('0x41')](function(){if(_0x220b86)hopperUtils[_0xc3a9('0xe8')](_0xa462d6,_0x59e830,_0x461b15)[_0xc3a9('0x41')](function(){return 0x1;});});}else{this[_0xc3a9('0x1f')][_0x19c844['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xc3a9('0x1f')][_0x19c844['queue']][_0xc3a9('0xe9')]+=0x1;_0xa462d6[_0xc3a9('0x73')]=0xb;_0xa462d6[_0xc3a9('0xd4')]=_0xc3a9('0xea');_0xa462d6[_0xc3a9('0xd6')]='CALLEREXIT';_0xa462d6[_0xc3a9('0xeb')]+=0x1;_0xa462d6[_0xc3a9('0xda')]+=0x1;_0x59e830=this[_0xc3a9('0x1f')][_0x19c844['queue']][_0xc3a9('0xec')];_0x461b15=this[_0xc3a9('0x1f')][_0x19c844[_0xc3a9('0xc2')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0xa462d6,_0xa462d6[_0xc3a9('0x73')],_0x29b2fb[_0xc3a9('0xde')])[_0xc3a9('0x41')](function(_0x1f3800){if(_0xa462d6[_0xc3a9('0xeb')]>=_0x105b48[_0xc3a9('0x1f')][_0x19c844[_0xc3a9('0xc2')]][_0xc3a9('0xed')]){_0x105b48[_0xc3a9('0xe0')](_0xa462d6,_0x1f3800['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xa462d6[_0xc3a9('0xeb')],'scheduledat':moment()[_0xc3a9('0xee')](_0x105b48['voiceQueues'][_0x19c844[_0xc3a9('0xc2')]][_0xc3a9('0xec')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')](_0xc3a9('0xc9')),'ContactId':_0x29b2fb[_0xc3a9('0xef')],'ListId':_0x29b2fb[_0xc3a9('0xf0')],'VoiceQueueId':_0x29b2fb[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x29b2fb[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xf1')));var _0x28dda7=new History(_0xa462d6);_0x28dda7[_0xc3a9('0x73')]=0xb;_0x28dda7['statedesc']=_0xc3a9('0xea');_0x28dda7[_0xc3a9('0x75')]=moment()[_0xc3a9('0x4a')](_0xc3a9('0xc9'));_0x28dda7['endtime']=_0x28dda7[_0xc3a9('0x75')];_0x28dda7[_0xc3a9('0xe6')]=_0xa462d6[_0xc3a9('0xe6')];_0x28dda7[_0xc3a9('0xe7')]=_0xa462d6[_0xc3a9('0xe7')];hopperUtils[_0xc3a9('0xca')](_0x28dda7)[_0xc3a9('0xa4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xc3a9('0x41')](function(){if(_0x220b86)hopperUtils[_0xc3a9('0xe8')](_0xa462d6,_0x59e830,_0x461b15)[_0xc3a9('0x41')](function(){return 0x1;});});}}}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x38')]=function(_0x1432d2){if(this['actions'][_0x1432d2[_0xc3a9('0xc0')]]){this['actions'][_0x1432d2[_0xc3a9('0xc0')]][_0xc3a9('0xf2')]=_0x1432d2['channel'];}if(this[_0xc3a9('0x26')][_0x1432d2['uniqueid']]){this['uniqueId'][_0x1432d2['uniqueid']]['channel']=_0x1432d2[_0xc3a9('0xf2')];}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0xf3')]=function(_0x1f40ec){if(!this[_0xc3a9('0x24')][_0x1f40ec[_0xc3a9('0xf4')]]){return;}var _0x493958=this['voiceQueues'][this[_0xc3a9('0x24')][_0x1f40ec['actionid']][_0xc3a9('0xc2')]]['strategy']||'rrmemory';if(_0x493958===_0xc3a9('0xf5')){if(this[_0xc3a9('0x24')][_0x1f40ec[_0xc3a9('0xf4')]]&&_[_0xc3a9('0xf6')](this[_0xc3a9('0x24')][_0x1f40ec['actionid']][_0xc3a9('0xf7')])&&_0x1f40ec['status']==='1'&&_0x1f40ec['paused']==='0'){if(this['agents'][_0x1f40ec[_0xc3a9('0xf8')]]){if(!this[_0xc3a9('0x21')][_0x1f40ec[_0xc3a9('0xf8')]][_0xc3a9('0xf7')]){this[_0xc3a9('0x21')][_0x1f40ec[_0xc3a9('0xf8')]][_0xc3a9('0xf7')]=!![];this[_0xc3a9('0x24')][_0x1f40ec['actionid']][_0xc3a9('0xf7')]=!![];this[_0xc3a9('0x24')][_0x1f40ec[_0xc3a9('0xf4')]][_0xc3a9('0xf8')]=_0x1f40ec[_0xc3a9('0xf8')];}}}}else if(_0x493958===_0xc3a9('0xf9')){if(this[_0xc3a9('0x24')][_0x1f40ec['actionid']]){if(this[_0xc3a9('0x21')][_0x1f40ec[_0xc3a9('0xf8')]]){this[_0xc3a9('0x24')][_0x1f40ec['actionid']]['stateinterface']=_0x1f40ec[_0xc3a9('0xf8')];if(_[_0xc3a9('0xf6')](this[_0xc3a9('0x2a')][this['actions'][_0x1f40ec[_0xc3a9('0xf4')]][_0xc3a9('0xc2')]])){this[_0xc3a9('0x2a')][this[_0xc3a9('0x24')][_0x1f40ec[_0xc3a9('0xf4')]]['queue']]=[];}this[_0xc3a9('0x2a')][this['actions'][_0x1f40ec[_0xc3a9('0xf4')]]['queue']][_0xc3a9('0x9c')](_[_0xc3a9('0x62')](_[_0xc3a9('0xfa')](this['actions'][_0x1f40ec[_0xc3a9('0xf4')]],[_0xc3a9('0xfb'),'stateinterface']),{'status':_0x1f40ec[_0xc3a9('0x8a')],'paused':_0x1f40ec['paused']}));}}}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x3d')]=function(_0x54d081){if(!this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]]){return;}var _0x4bae3c=this;var _0x19d88f=this[_0xc3a9('0x1f')][this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]]['queue']];var _0x36f484=_0x19d88f['strategy']||_0xc3a9('0xf9');if(_0x36f484===_0xc3a9('0xf5')){if(this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]]&&this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xf8')]){this[_0xc3a9('0x1e')][_0xc3a9('0xfc')](this[_0xc3a9('0x24')][_0x54d081['actionid']][_0xc3a9('0xfb')],this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]]['stateinterface'])[_0xc3a9('0xa4')](function(_0x21d677){logger['error'](_0xc3a9('0xfd'),util[_0xc3a9('0x49')](_0x21d677,{'showHidden':![],'depth':null}));})[_0xc3a9('0xfe')](function(){_0x4bae3c[_0xc3a9('0xc1')](_0x4bae3c[_0xc3a9('0x1f')][_0x4bae3c[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xc2')]]);_0x4bae3c[_0xc3a9('0x21')][_0x4bae3c['actions'][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xf8')]]['locked']=![];delete _0x4bae3c[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]];unlockQueueStatus(_0x19d88f);});}else{this[_0xc3a9('0xc1')](this['voiceQueues'][this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xc2')]]);hopperUtils[_0xc3a9('0xff')]({'active':![],'ContactId':this['actions'][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xef')],'ListId':this[_0xc3a9('0x24')][_0x54d081['actionid']]['ListId'],'VoiceQueueId':this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xe3')]||undefined,'CampaignId':this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x100')));delete this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]];unlockQueueStatus(_0x19d88f);}}else if(_0x36f484===_0xc3a9('0xf9')){var _0x18e8b3;if(this[_0xc3a9('0x24')][_0x54d081['actionid']]&&!_['isEmpty'](this[_0xc3a9('0x2a')][this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]]['queue']])){if(this[_0xc3a9('0x101')][_0x4bae3c[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]]['queue']]){this[_0xc3a9('0x101')][_0x4bae3c[_0xc3a9('0x24')][_0x54d081['actionid']][_0xc3a9('0xc2')]]=this['queueBookedRR'][this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xc2')]]?this[_0xc3a9('0x101')][this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xc2')]]:this[_0xc3a9('0x2a')][this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]]['queue']]?this[_0xc3a9('0x2a')][this[_0xc3a9('0x24')][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xc2')]][_0xc3a9('0x102')]||0x0:0x0;}this[_0xc3a9('0x2a')][this['actions'][_0x54d081[_0xc3a9('0xf4')]][_0xc3a9('0xc2')]][_0xc3a9('0x102')]=this['queueBookedRR'][this['actions'][_0x54d081[_0xc3a9('0xf4')]]['queue']];for(var _0x3c7e5d=0x0;_0x3c7e5d=_0x53d301[_0xc3a9('0x125')]){_0x348880[_0xc3a9('0x126')](_0x175319,_0x251e57,_0x186793,_0xc3a9('0x127'));}else{if(_0x175319[_0xc3a9('0x11f')]>=_0x53d301[_0xc3a9('0x128')]){_0x348880[_0xc3a9('0x129')](_0x175319,_0x251e57,_0x186793,_0xc3a9('0x12a'));}else{hopperUtils[_0xc3a9('0xff')]({'active':![],'countmachineretry':_0x175319[_0xc3a9('0x11f')],'scheduledat':moment()['add'](_0x53d301['dialMachineRetryFrequency'],_0xc3a9('0xe2'))[_0xc3a9('0x4a')](_0xc3a9('0xc9')),'ContactId':_0x175319[_0xc3a9('0xef')],'ListId':_0x175319['ListId'],'VoiceQueueId':_0x175319[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x175319['CampaignId']||undefined})['catch'](loggerCatch(_0xc3a9('0x12b')));_0x251e57({'reschedule':0x1});}}});}if(_0xdbeb69[_0xc3a9('0x45')]==='ivr'&&this['campaigns'][_0xdbeb69[_0xc3a9('0xc2')]][_0xc3a9('0x112')]&&_0x421f3a[_0xc3a9('0x113')]===_0xc3a9('0x114')){delete this[_0xc3a9('0x26')][_0x421f3a[_0xc3a9('0xc0')]];this[_0xc3a9('0xc1')](this[_0xc3a9('0x20')][_0xdbeb69[_0xc3a9('0xc2')]]);_0x253838=new Hangup(_0xdbeb69,_0x421f3a);_0x253838[_0xc3a9('0x73')]=0x12;_0x253838[_0xc3a9('0xd4')]=_0xc3a9('0x12c');_0x253838[_0xc3a9('0x116')]=_0xc3a9('0x117');ami[_0xc3a9('0x44')](_0xc3a9('0x118'),ut['buildObj'](_0x253838,'amd'));this[_0xc3a9('0x11b')](_0x253838,'[syncHangupInAMDIvr][createHistory]',_0xc3a9('0x12d'));}if(_0xdbeb69['type']==='ivr'&&this['campaigns'][_0xdbeb69[_0xc3a9('0xc2')]]['dialAMDActive']&&_0x421f3a[_0xc3a9('0x113')]===_0xc3a9('0x11d')){return new Promise(function(_0x4fabb9,_0x4fb7c5){delete _0x348880[_0xc3a9('0x26')][_0x421f3a[_0xc3a9('0xc0')]];_0x348880[_0xc3a9('0xc1')](_0x348880[_0xc3a9('0x20')][_0xdbeb69['queue']]);_0x348880[_0xc3a9('0x20')][_0xdbeb69[_0xc3a9('0xc2')]][_0xc3a9('0xc4')]+=0x1;_0x348880[_0xc3a9('0x20')][_0xdbeb69[_0xc3a9('0xc2')]][_0xc3a9('0x115')]+=0x1;var _0x1b10b2=_0x348880['campaigns'][_0xdbeb69[_0xc3a9('0xc2')]];var _0x1daa76=new Hangup(_0xdbeb69,_0x421f3a);_0x1daa76['state']=0x13;_0x1daa76['statedesc']=_0xc3a9('0x11e');_0x1daa76[_0xc3a9('0x116')]=_0xc3a9('0x117');_0x1daa76[_0xc3a9('0x11f')]+=0x1;_0x1daa76['countglobal']+=0x1;_0x1daa76['amd']=!![];ami[_0xc3a9('0x44')](_0xc3a9('0x118'),ut[_0xc3a9('0x119')](_0x1daa76,'amd'));hopperUtils[_0xc3a9('0xca')](_0x1daa76)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x120')));if(_0x1daa76[_0xc3a9('0x12e')]+_0x1daa76[_0xc3a9('0x121')]+_0x1daa76[_0xc3a9('0x122')]+_0x1daa76[_0xc3a9('0x123')]+_0x1daa76[_0xc3a9('0xd9')]+_0x1daa76[_0xc3a9('0xeb')]+_0x1daa76['countmachineretry']+_0x1daa76[_0xc3a9('0x124')]>=_0x1b10b2[_0xc3a9('0x125')]){_0x348880[_0xc3a9('0x126')](_0x1daa76,_0x4fabb9,_0x4fb7c5,_0xc3a9('0x127'));}else{if(_0x1daa76['countmachineretry']>=_0x1b10b2[_0xc3a9('0x128')]){_0x348880[_0xc3a9('0x129')](_0x1daa76,_0x4fabb9,_0x4fb7c5,_0xc3a9('0x12a'));}else{hopperUtils[_0xc3a9('0xff')]({'active':![],'countmachineretry':_0x1daa76['countmachineretry'],'scheduledat':moment()[_0xc3a9('0xee')](_0x1b10b2[_0xc3a9('0x12f')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')](_0xc3a9('0xc9')),'ContactId':_0x1daa76[_0xc3a9('0xef')],'ListId':_0x1daa76[_0xc3a9('0xf0')],'VoiceQueueId':_0x1daa76[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x1daa76[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x12b')));_0x4fabb9({'reschedule':0x1});}}});}}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x36')]=function(_0x3e5f72){var _0x25f8e1=this['uniqueId'][_0x3e5f72[_0xc3a9('0xc0')]];var _0x1151f5;if(_0x25f8e1&&_0x25f8e1['type']==='ivr'){delete this[_0xc3a9('0x26')][_0x3e5f72[_0xc3a9('0xc0')]];this[_0xc3a9('0xc1')](this[_0xc3a9('0x20')][_0x25f8e1[_0xc3a9('0xc2')]]);this[_0xc3a9('0x20')][_0x25f8e1[_0xc3a9('0xc2')]][_0xc3a9('0x130')]+=0x1;_0x1151f5=new Hangup(_0x25f8e1,_0x3e5f72);hopperUtils[_0xc3a9('0xca')](_0x1151f5)[_0xc3a9('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1151f5)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x131')));}if(_0x25f8e1&&_0x25f8e1[_0xc3a9('0x45')]!==_0xc3a9('0xc3')&&isNotNull(this[_0xc3a9('0x1f')][_0x25f8e1[_0xc3a9('0xc2')]]['dialQueueProject'])){delete this[_0xc3a9('0x26')][_0x3e5f72[_0xc3a9('0xc0')]];this[_0xc3a9('0xc1')](this['voiceQueues'][_0x25f8e1[_0xc3a9('0xc2')]]);this[_0xc3a9('0x1f')][_0x25f8e1['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xc3a9('0x1f')][_0x25f8e1[_0xc3a9('0xc2')]][_0xc3a9('0x115')]+=0x1;_0x1151f5=new Hangup(_0x25f8e1,_0x3e5f72);_0x1151f5[_0xc3a9('0x73')]=0x10;_0x1151f5[_0xc3a9('0xd4')]=_0xc3a9('0x132');_0x1151f5[_0xc3a9('0x116')]='AGI';hopperUtils[_0xc3a9('0xca')](_0x1151f5)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x133')));hopperUtils[_0xc3a9('0xcc')](_0x1151f5)['catch'](loggerCatch(_0xc3a9('0x131')));}if(_0x25f8e1&&_0x25f8e1[_0xc3a9('0x45')]!=='ivr'&&!isNotNull(this[_0xc3a9('0x1f')][_0x25f8e1[_0xc3a9('0xc2')]]['dialQueueProject'])){if(_0x3e5f72[_0xc3a9('0x134')]===_0xc3a9('0x135')){delete this[_0xc3a9('0x26')][_0x3e5f72[_0xc3a9('0xc0')]];this['voiceQueues'][_0x25f8e1[_0xc3a9('0xc2')]][_0xc3a9('0xc4')]+=0x1;const _0x1b0dd5=new AgentComplete(_0x25f8e1,_0x3e5f72);_0x1b0dd5['CampaignId']=this[_0xc3a9('0x1f')][_0x25f8e1[_0xc3a9('0xc2')]]['id'];hopperUtils['createHistory'](_0x1b0dd5)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xcb')));hopperUtils[_0xc3a9('0xcc')](_0x1b0dd5)['catch'](loggerCatch(_0xc3a9('0xcd')));}else{delete this[_0xc3a9('0x26')][_0x3e5f72[_0xc3a9('0xc0')]];this[_0xc3a9('0xc1')](this[_0xc3a9('0x1f')][_0x25f8e1[_0xc3a9('0xc2')]]);this['voiceQueues'][_0x25f8e1[_0xc3a9('0xc2')]][_0xc3a9('0x136')]+=0x1;_0x1151f5=new Hangup(_0x25f8e1,_0x3e5f72);_0x1151f5['state']=0xc;_0x1151f5[_0xc3a9('0xd4')]=_0x3e5f72[_0xc3a9('0x134')];_0x1151f5[_0xc3a9('0x116')]=_0xc3a9('0x137');hopperUtils[_0xc3a9('0xca')](_0x1151f5)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x133')));hopperUtils['moveContactManagedDialer'](_0x1151f5)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x131')));}}};Dialer[_0xc3a9('0x1b')]['syncQueueSummary']=function(_0x1a2dd6){var _0xbb9b5d=this;if(!_0xbb9b5d[_0xc3a9('0x138')][_0x1a2dd6['name']]){_0xbb9b5d[_0xc3a9('0x138')][_0x1a2dd6[_0xc3a9('0x4b')]]={'running':![]};}else if(_0xbb9b5d[_0xc3a9('0x138')][_0x1a2dd6[_0xc3a9('0x4b')]]['running']===!![]){return;}else if(_0xbb9b5d[_0xc3a9('0x138')][_0x1a2dd6[_0xc3a9('0x4b')]]['running']===![]){_0xbb9b5d[_0xc3a9('0x138')][_0x1a2dd6['name']][_0xc3a9('0x139')]=!![];}var _0x316cb3=_0xbb9b5d[_0xc3a9('0x1f')][_0x1a2dd6[_0xc3a9('0x4b')]];var _0x2f4197=_0x316cb3[_0xc3a9('0x6c')]!==utils[_0xc3a9('0x6d')][_0xc3a9('0x13a')];var _0x40125f=utils[_0xc3a9('0x13b')](_0x316cb3);_0x316cb3[_0xc3a9('0x13c')]=utils[_0xc3a9('0x13d')](_0x316cb3,_0xbb9b5d['trunks']);Promise[_0xc3a9('0xad')]()[_0xc3a9('0x41')](function(){if(_0x316cb3[_0xc3a9('0x13c')]===utils[_0xc3a9('0x6d')]['INACTIVE']){if(_0x2f4197){clearPredictiveAttributes(_0x316cb3);_0x1a2dd6[_0xc3a9('0x27')]=undefined;_0x1a2dd6[_0xc3a9('0x28')]=undefined;}if(_0x316cb3['statusMessage']===utils['CAMPAIGN_STATUS'][_0xc3a9('0x13a')]){_0x1a2dd6[_0xc3a9('0x13e')]=0x0;_0x1a2dd6[_0xc3a9('0x103')]=0x0;_0x1a2dd6[_0xc3a9('0x13f')]=0x0;_0x1a2dd6[_0xc3a9('0x140')]=0x0;_0x1a2dd6['pTalking']=0x0;}}else if(_0x316cb3['statusMessage']===utils[_0xc3a9('0x6d')][_0xc3a9('0x141')]&&!_0x40125f){return _0xbb9b5d[_0xc3a9('0x93')](_0x316cb3,!![])[_0xc3a9('0x41')](function(){return _0xbb9b5d[_0xc3a9('0x93')](_0x316cb3,![]);})[_0xc3a9('0x41')](function(){return _0xbb9b5d[_0xc3a9('0xb1')](_0x316cb3);})[_0xc3a9('0xa4')](function(_0x38b25b){loggerSyncQueueSummary[_0xc3a9('0x47')](_0xc3a9('0x142'),util[_0xc3a9('0x49')](_0x38b25b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x316cb3);});}else{clearPredictiveAttributes(_0x316cb3);}})[_0xc3a9('0x41')](function(){var _0x475e9b=_0x1a2dd6[_0xc3a9('0x143')](_0x316cb3);if(_0x475e9b||_0x316cb3[_0xc3a9('0x144')]){_0x316cb3['queueSummaryCountersUpdated']=![];_0x1a2dd6[_0xc3a9('0x145')](_0x316cb3);Object[_0xc3a9('0x146')](_0x316cb3,_0x1a2dd6);emitOutboundVoiceQueueSummary(_0x1a2dd6);}_0xbb9b5d[_0xc3a9('0x138')][_0x316cb3[_0xc3a9('0x4b')]][_0xc3a9('0x139')]=![];})[_0xc3a9('0xa4')](function(_0x2ab2a4){logger[_0xc3a9('0x68')](_0xc3a9('0x142'),util[_0xc3a9('0x49')](_0x2ab2a4,{'showHidden':![],'depth':null}));_0xbb9b5d[_0xc3a9('0x138')][_0x316cb3[_0xc3a9('0x4b')]][_0xc3a9('0x139')]=![];});};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x147')]=_[_0xc3a9('0x148')](function(){var _0x3ce5b6=_[_0xc3a9('0x149')](this[_0xc3a9('0x1f')],function(_0x5199db){return _0x5199db[_0xc3a9('0x14a')];});var _0x4a1574=_[_0xc3a9('0x149')](this[_0xc3a9('0x21')],function(_0x4def35){return _0x4def35[_0xc3a9('0x14b')]&&_0x4def35[_0xc3a9('0x8a')]===_0xc3a9('0x14c');});if(_0x3ce5b6[_0xc3a9('0x9b')]>0x0&&_0x4a1574[_0xc3a9('0x9b')]>0x0){return Promise[_0xc3a9('0xad')]()['then'](cmHopper[_0xc3a9('0x14d')](_[_0xc3a9('0x14e')](_0x3ce5b6,'id'),previewRecallmeReminderInterval,_[_0xc3a9('0x14e')](_0x4a1574,'id')))[_0xc3a9('0x41')](function(_0x5485ae){for(var _0x51a567=0x0;_0x51a567<_0x5485ae[_0xc3a9('0x9b')];_0x51a567++){var _0x582370=_0x5485ae[_0x51a567][_0xc3a9('0x14f')][_0xc3a9('0x4b')];if(_0x582370)io['to'](util['format'](_0xc3a9('0x150'),_0x582370))['emit'](_0xc3a9('0x151'),{'hopper':_0x5485ae[_0x51a567]});}})[_0xc3a9('0xa4')](function(_0x4533a2){logger[_0xc3a9('0x68')](_0xc3a9('0x152'),_0x4533a2);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xc3a9('0x1b')]['loopClearZombieChannels']=function(){var _0x4a37d8=this;setInterval(function(){_0x4a37d8[_0xc3a9('0x153')](_0x4a37d8[_0xc3a9('0x26')],_0xc3a9('0x154'));_0x4a37d8[_0xc3a9('0x153')](_0x4a37d8[_0xc3a9('0x24')],_0xc3a9('0x155'));},0x32c8);};Dialer['prototype'][_0xc3a9('0x153')]=function(_0x587679,_0x33a6d6){var _0xac0e02=this;for(var _0x25c9bc in _0x587679){if(typeof _0x587679[_0x25c9bc]!=='undefined'){this[_0xc3a9('0x156')][_0xc3a9('0x1c')](function(){if(!_[_0xc3a9('0xf6')](_0x587679[_0x25c9bc])){return ami['Action']({'action':'status','channel':_0x587679[_0x25c9bc][_0xc3a9('0xf2')]})[_0xc3a9('0xa4')](function(_0x1c43d8){if(_0x1c43d8[_0xc3a9('0x6c')]===_0xc3a9('0x157')){setTimeout(function(){if(_0x587679[_0x25c9bc]&&_0x587679[_0x25c9bc][_0xc3a9('0x45')]!=='ivr'){_0xac0e02[_0xc3a9('0xc1')](_0xac0e02['voiceQueues'][_0x587679[_0x25c9bc][_0xc3a9('0xc2')]]);logger[_0xc3a9('0x68')](_0xc3a9('0x158'),_0x33a6d6,_0x25c9bc,_0x587679[_0x25c9bc][_0xc3a9('0xc2')]);delete _0x587679[_0x25c9bc];}if(_0x587679[_0x25c9bc]&&_0x587679[_0x25c9bc][_0xc3a9('0x45')]===_0xc3a9('0xc3')){_0xac0e02[_0xc3a9('0xc1')](_0xac0e02[_0xc3a9('0x20')][_0x587679[_0x25c9bc][_0xc3a9('0xc2')]]);logger[_0xc3a9('0x68')](_0xc3a9('0x159'),_0x33a6d6,_0x25c9bc,_0x587679[_0x25c9bc][_0xc3a9('0xc2')]);delete _0x587679[_0x25c9bc];}},0x2328);}});}});}}};Dialer['prototype'][_0xc3a9('0x15a')]=function(_0x48bd8f){return Promise[_0xc3a9('0xad')]()['then'](voiceQueueRt[_0xc3a9('0x15a')](_0x48bd8f))[_0xc3a9('0xa4')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xc3a9('0x1b')][_0xc3a9('0xc1')]=function(_0x4ddaf3){if(!_['isUndefined'](_0x4ddaf3)&&_0x4ddaf3!==null){if(typeof _0x4ddaf3[_0xc3a9('0x15b')]!=='undefined'){if(_0x4ddaf3[_0xc3a9('0x15b')]>0x0){_0x4ddaf3[_0xc3a9('0x15b')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xc3a9('0x68')](_0xc3a9('0x15c'));}};Dialer['prototype']['loggerHandler']=function(_0x3b9f06,_0xb70f4e){var _0x30fe31=this;return function(_0x4a515f){_0x30fe31['updateOriginated'](_0xb70f4e);logger[_0xc3a9('0x68')](_0x3b9f06,util[_0xc3a9('0x49')](_0x4a515f,{'showHidden':![],'depth':null}));};};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x15d')]=function(_0x44f6a6,_0x54eb94,_0x3fa3f2){var _0x31508e={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x54eb94);this[_0xc3a9('0x11b')](_[_0xc3a9('0x62')](_0x31508e,_[_0xc3a9('0xfa')](_0x3fa3f2,['ContactId',_0xc3a9('0xf0'),_0xc3a9('0x15e'),'VoiceQueueId',_0xc3a9('0xe4')])),_0xc3a9('0x15f'),'[emptyContact]');logger['error'](_0x44f6a6);};Dialer['prototype'][_0xc3a9('0x11b')]=function(_0x5bd7d5,_0x35704b,_0x35d598){hopperUtils[_0xc3a9('0xca')](_0x5bd7d5)['catch'](loggerCatch(_0x35704b));hopperUtils[_0xc3a9('0xcc')](_0x5bd7d5)[_0xc3a9('0xa4')](loggerCatch(_0x35d598));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x526ddb,_0x3e5c8b){hopperUtils['createHistory'](_0x526ddb)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xcb')));if(_0x3e5c8b==0x0){hopperUtils[_0xc3a9('0xcc')](_0x526ddb)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x160')));}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x152')]=function(_0x442a91){return Promise['resolve']()[_0xc3a9('0x41')](cmHopper[_0xc3a9('0x14d')](_0x442a91['id'],previewRecallmeReminderInterval))['then'](function(_0xaf857b){for(var _0x47a714=0x0;_0x47a714<_0xaf857b[_0xc3a9('0x9b')];_0x47a714++){var _0x2bb1d4=_0xaf857b[_0x47a714]['Agent'][_0xc3a9('0x4b')];if(_0x2bb1d4)io['to'](util[_0xc3a9('0x4a')](_0xc3a9('0x150'),_0x2bb1d4))[_0xc3a9('0x44')](_0xc3a9('0x151'),{'hopper':_0xaf857b[_0x47a714]});}})[_0xc3a9('0xa4')](function(){});};Dialer[_0xc3a9('0x1b')][_0xc3a9('0xb0')]=function(_0x233b8f){var _0x266eb0=this;return function(){_0x266eb0['handleIvr'](_0x233b8f);};};Dialer['prototype']['actionOriginate']=function(_0x5c9b3b,_0x4a7c18){var _0x34dcab=this;var _0x4920b3=uuid['v4']();this['actions'][_0x4920b3]=new Action(_0x5c9b3b,_0x4a7c18,_0x4920b3);return new Promise(function(_0x1cd34b,_0x3eeee0){if(_[_0xc3a9('0x43')](_0x5c9b3b)&&typeof _0x5c9b3b!==_0xc3a9('0x161')){return _0x3eeee0(msgResponse('originate',_0xc3a9('0x94'),_0xc3a9('0x162')));}if(_[_0xc3a9('0x43')](_0x4a7c18[_0xc3a9('0x163')])||_0x4a7c18['phone']===null){return _0x3eeee0(msgResponse(_0xc3a9('0x164'),_0xc3a9('0x94'),_0xc3a9('0x165')));}var _0x21f805={'XMD-CALLERID':_0x34dcab['actions'][_0x4920b3][_0xc3a9('0x166')](),'XMD-AGI':_0x5c9b3b[_0xc3a9('0x167')]?util[_0xc3a9('0x4a')](_0xc3a9('0x168'),ipAgi,_0x5c9b3b[_0xc3a9('0x167')]):_0xc3a9('0x169'),'XMD-AGIAFTER':_0x5c9b3b[_0xc3a9('0xc7')]?util[_0xc3a9('0x4a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5c9b3b[_0xc3a9('0xc7')]):'NONE','XMD-QUEUE':utils[_0xc3a9('0x16a')](_0x5c9b3b)?util['format']('\x22%s,%s%s,,,%s\x22',_0x5c9b3b[_0xc3a9('0x4b')],_0x5c9b3b[_0xc3a9('0x16b')]||'',_0x5c9b3b['dialAgiAfterHangupAgent']?'c':'',_0x5c9b3b[_0xc3a9('0xd0')]||0x3):_0xc3a9('0x169'),'XMD-CONTACTID':_0x4a7c18[_0xc3a9('0xef')],'XMD-CDRTYPE':_0xc3a9('0x8'),'CALLERID(all)':_0x34dcab[_0xc3a9('0x24')][_0x4920b3][_0xc3a9('0x166')](),'XMD-AMD':_0x5c9b3b[_0xc3a9('0x112')]?'ACTIVE':_0xc3a9('0x169'),'XMD-DESTINATION':_0xc3a9('0x111')};if(_0x5c9b3b[_0xc3a9('0x112')]){_0x21f805[_0xc3a9('0x16c')]=_0x5c9b3b[_0xc3a9('0x16d')]||0x9c4;_0x21f805['XMD-AMDGREETING']=_0x5c9b3b[_0xc3a9('0x16e')]||0x5dc;_0x21f805[_0xc3a9('0x16f')]=_0x5c9b3b[_0xc3a9('0x170')]||0x320;_0x21f805[_0xc3a9('0x171')]=_0x5c9b3b['dialAMDTotalAnalysisTime']||0x1388;_0x21f805[_0xc3a9('0x172')]=_0x5c9b3b[_0xc3a9('0x173')]||0x64;_0x21f805[_0xc3a9('0x174')]=_0x5c9b3b[_0xc3a9('0x175')]||0x32;_0x21f805['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5c9b3b['dialAMDMaximumNumberOfWords']||0x3;_0x21f805[_0xc3a9('0x176')]=_0x5c9b3b[_0xc3a9('0x177')]||0x100;_0x21f805['XMD-AMDMAXIMUMWORDLENGTH']=_0x5c9b3b[_0xc3a9('0x178')]||0x1388;}if(utils[_0xc3a9('0x16a')](_0x5c9b3b)){_0x21f805[_0xc3a9('0x179')]=_0x4a7c18[_0xc3a9('0xe3')];}else{_0x21f805[_0xc3a9('0x17a')]=_0x4a7c18[_0xc3a9('0xe4')];}var _0x24da6b=utils[_0xc3a9('0x17b')](_0x4a7c18[_0xc3a9('0x17c')]);Object[_0xc3a9('0x146')](_0x21f805,_0x24da6b);var _0x3c7e36=_0x34dcab[_0xc3a9('0x88')](_0x5c9b3b[_0xc3a9('0x8e')])?utils['getCallerId'](_0x5c9b3b['Trunk'][_0xc3a9('0x17d')],_0x5c9b3b[_0xc3a9('0x17e')],_0x5c9b3b[_0xc3a9('0x17f')]>0x0?utils[_0xc3a9('0x180')](_0x5c9b3b[_0xc3a9('0x181')],_0x5c9b3b[_0xc3a9('0x17f')]):_0x5c9b3b[_0xc3a9('0x181')]):utils[_0xc3a9('0x182')](_['isNil'](_0x5c9b3b[_0xc3a9('0x183')])?_0x5c9b3b[_0xc3a9('0x8e')][_0xc3a9('0x17d')]:_0x5c9b3b[_0xc3a9('0x183')][_0xc3a9('0x17d')],_0x5c9b3b[_0xc3a9('0x17e')],_0x5c9b3b[_0xc3a9('0x17f')]>0x0?utils[_0xc3a9('0x180')](_0x5c9b3b[_0xc3a9('0x181')],_0x5c9b3b[_0xc3a9('0x17f')]):_0x5c9b3b['dialOriginateCallerIdNumber']);if(_0x3c7e36){_0x21f805[_0xc3a9('0x184')]=_0x34dcab[_0xc3a9('0x24')][_0x4920b3][_0xc3a9('0x185')]=utils[_0xc3a9('0x186')](_0x3c7e36);_0x21f805[_0xc3a9('0x187')]=_0x4a7c18[_0xc3a9('0x163')];}_0x5c9b3b['variables']=_0x21f805;return ami[_0xc3a9('0x9d')]({'actionid':_0x4920b3,'action':_0xc3a9('0x164'),'channel':_0x34dcab['isTrunkReachable'](_0x5c9b3b[_0xc3a9('0x8e')])?util[_0xc3a9('0x4a')]('SIP/%s/%s%s',_0x5c9b3b[_0xc3a9('0x8e')][_0xc3a9('0x4b')],isNotNull(_0x5c9b3b[_0xc3a9('0x188')])?_0x5c9b3b[_0xc3a9('0x188')][_0xc3a9('0x189')]()||'':'',_0x5c9b3b[_0xc3a9('0x18a')]>0x0?_0x4a7c18[_0xc3a9('0x163')][_0xc3a9('0x18b')](_0x5c9b3b['dialCutDigit']):_0x4a7c18[_0xc3a9('0x163')]):util[_0xc3a9('0x4a')]('SIP/%s/%s%s',_[_0xc3a9('0xf6')](_0x5c9b3b[_0xc3a9('0x183')])?_0x5c9b3b[_0xc3a9('0x8e')][_0xc3a9('0x4b')]:_0x5c9b3b['TrunkBackup'][_0xc3a9('0x4b')],isNotNull(_0x5c9b3b[_0xc3a9('0x188')])?_0x5c9b3b[_0xc3a9('0x188')][_0xc3a9('0x189')]()||'':'',_0x5c9b3b[_0xc3a9('0x18a')]>0x0?_0x4a7c18[_0xc3a9('0x163')][_0xc3a9('0x18b')](_0x5c9b3b[_0xc3a9('0x18a')]):_0x4a7c18[_0xc3a9('0x163')]),'callerid':_0x3c7e36,'Exten':_0xc3a9('0x111'),'Context':'from-sip','Priority':'1','variable':_0x21f805,'timeout':(_0x5c9b3b[_0xc3a9('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4920b3})[_0xc3a9('0x41')](function(_0x568945){return _0x1cd34b(_0x568945);})[_0xc3a9('0xa4')](function(_0x524a06){_0x5c9b3b[_0xc3a9('0x18d')]+=0x1;var _0x53a19a=new History(_0x34dcab[_0xc3a9('0x24')][_0x4920b3]);logger[_0xc3a9('0x68')](util[_0xc3a9('0x4a')](_0xc3a9('0x18e'),JSON['stringify'](_0x524a06)));_0x53a19a[_0xc3a9('0x73')]=0xe;_0x53a19a[_0xc3a9('0xd4')]=_0xc3a9('0x18f');_0x53a19a['starttime']=moment()[_0xc3a9('0x4a')](_0xc3a9('0xc9'));_0x53a19a[_0xc3a9('0x74')]=_0x53a19a[_0xc3a9('0x75')];hopperUtils[_0xc3a9('0xca')](_0x53a19a)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x190')));_0x34dcab[_0xc3a9('0xcc')](_0x53a19a)['catch'](loggerCatch(_0xc3a9('0x190')))[_0xc3a9('0xfe')](function(){delete _0x34dcab['actions'][_0x4920b3];return _0x3eeee0(msgResponse(_0xc3a9('0x164'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x191')]=function(_0x4ac911,_0x2f22c0,_0x49906a){var _0x24ad62=new History(_0x2f22c0);if(_0x24ad62[_0xc3a9('0x12e')]+_0x24ad62['countcongestionretry']+_0x24ad62[_0xc3a9('0x122')]+_0x24ad62[_0xc3a9('0x123')]+_0x24ad62[_0xc3a9('0xd9')]+_0x24ad62['countabandonedretry']+_0x24ad62[_0xc3a9('0x11f')]+_0x24ad62[_0xc3a9('0x124')]>=_0x49906a[_0xc3a9('0x125')]-0x1){return!![];}switch(_0x4ac911){case 0x3:if(_0x24ad62[_0xc3a9('0x122')]>=_0x49906a['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xc3a9('0xff')]({'active':![],'countnoanswerretry':_0x24ad62[_0xc3a9('0x122')]+=0x1,'scheduledat':moment()[_0xc3a9('0xee')](_0x49906a['dialNoAnswerRetryFrequency'],_0xc3a9('0xe2'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62[_0xc3a9('0xf0')],'VoiceQueueId':_0x24ad62[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x24ad62['CampaignId']||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x192')));break;case 0x5:if(_0x24ad62['countbusyretry']>=_0x49906a[_0xc3a9('0x193')]-0x1){return!![];}hopperUtils[_0xc3a9('0xff')]({'active':![],'countbusyretry':_0x24ad62[_0xc3a9('0x12e')]+=0x1,'scheduledat':moment()['add'](_0x49906a[_0xc3a9('0x194')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')](_0xc3a9('0xc9')),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62['ListId'],'VoiceQueueId':_0x24ad62[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x24ad62[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x195')));break;case 0x8:if(_0x24ad62[_0xc3a9('0x121')]>=_0x49906a[_0xc3a9('0x196')]-0x1){return!![];}hopperUtils[_0xc3a9('0xff')]({'active':![],'countcongestionretry':_0x24ad62[_0xc3a9('0x121')]+=0x1,'scheduledat':moment()[_0xc3a9('0xee')](_0x49906a[_0xc3a9('0x197')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')](_0xc3a9('0xc9')),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62[_0xc3a9('0xf0')],'VoiceQueueId':_0x24ad62['VoiceQueueId']||undefined,'CampaignId':_0x24ad62[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x198')));break;case 0x0:if(_0x24ad62[_0xc3a9('0x123')]>=_0x49906a[_0xc3a9('0x199')]-0x1){return!![];}else{hopperUtils[_0xc3a9('0xff')]({'active':![],'countnosuchnumberretry':_0x24ad62['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x49906a[_0xc3a9('0x19a')],_0xc3a9('0xe2'))['format'](_0xc3a9('0xc9')),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62[_0xc3a9('0xf0')],'VoiceQueueId':_0x24ad62['VoiceQueueId']||undefined,'CampaignId':_0x24ad62[_0xc3a9('0xe4')]||undefined})['catch'](loggerCatch(_0xc3a9('0x19b')));}break;case 0xa:if(_0x24ad62[_0xc3a9('0xd9')]>=_0x49906a[_0xc3a9('0xdf')]-0x1){return!![];}hopperUtils[_0xc3a9('0xff')]({'active':![],'countdropretry':_0x24ad62[_0xc3a9('0xd9')]+=0x1,'scheduledat':moment()[_0xc3a9('0xee')](_0x49906a[_0xc3a9('0xdb')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62[_0xc3a9('0xf0')],'VoiceQueueId':_0x24ad62[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x24ad62[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xe5')));break;case 0xb:if(_0x24ad62[_0xc3a9('0xeb')]>=_0x49906a[_0xc3a9('0xed')]-0x1){return!![];}hopperUtils[_0xc3a9('0xff')]({'active':![],'countabandonedretry':_0x24ad62[_0xc3a9('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x49906a[_0xc3a9('0xec')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62['ListId'],'VoiceQueueId':_0x24ad62['VoiceQueueId']||undefined,'CampaignId':_0x24ad62['CampaignId']||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0xf1')));break;case 0x13:if(_0x24ad62[_0xc3a9('0x11f')]>=_0x49906a['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xc3a9('0xff')]({'active':![],'countmachineretry':_0x24ad62[_0xc3a9('0x11f')]+=0x1,'scheduledat':moment()[_0xc3a9('0xee')](_0x49906a[_0xc3a9('0x12f')],'minutes')[_0xc3a9('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62[_0xc3a9('0xf0')],'VoiceQueueId':_0x24ad62[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x24ad62[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x12b')));break;case 0x14:if(_0x24ad62[_0xc3a9('0x124')]>=_0x49906a[_0xc3a9('0x19c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x24ad62[_0xc3a9('0x124')]+=0x1,'scheduledat':moment()['add'](_0x49906a[_0xc3a9('0x19d')],_0xc3a9('0xe2'))[_0xc3a9('0x4a')](_0xc3a9('0xc9')),'ContactId':_0x24ad62[_0xc3a9('0xef')],'ListId':_0x24ad62[_0xc3a9('0xf0')],'VoiceQueueId':_0x24ad62['VoiceQueueId']||undefined,'CampaignId':_0x24ad62[_0xc3a9('0xe4')]||undefined})[_0xc3a9('0xa4')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x19e')]=function(_0x511db4,_0x36b852,_0x5e12f9){var _0x4fa218=this;var _0x9401b=new History(_0x511db4);var _0x595d7f=![];var _0x684cca;var _0x30778f;return new Promise(function(_0x475c7f,_0x2a5c26){if(_['isUndefined'](_0x36b852)&&typeof _0x36b852!==_0xc3a9('0x161')){return _0x2a5c26(msgResponse('[callProgressDetecting]',_0xc3a9('0x94'),'entity\x20is\x20undefine'));}if(_[_0xc3a9('0x43')](_0x5e12f9)&&typeof _0x5e12f9!==_0xc3a9('0x161')){return _0x2a5c26(msgResponse(_0xc3a9('0x19f'),_0xc3a9('0x94'),'evt\x20is\x20undefine'));}hopperUtils[_0xc3a9('0xdd')](_0x9401b,_0x5e12f9[_0xc3a9('0xc5')],_0x36b852)[_0xc3a9('0x41')](function(_0x30a331){if(_0x30a331[_0xc3a9('0xe1')]==0x1)_0x595d7f=!![];switch(_0x5e12f9[_0xc3a9('0xc5')]){case'0':_0x36b852['outboundNoSuchCallsDay']+=0x1;_0x9401b['state']=0x0;_0x9401b[_0xc3a9('0xd4')]=_0xc3a9('0x1a0');_0x9401b[_0xc3a9('0x123')]+=0x1;_0x9401b[_0xc3a9('0xda')]+=0x1;ami[_0xc3a9('0x44')](_0xc3a9('0x1a1'),ut['buildObj'](_0x511db4,_0xc3a9('0x1a2')));_0x684cca=_0x36b852[_0xc3a9('0x19a')];_0x30778f=_0x36b852['callAdditionalPhoneAfterMin'];hopperUtils[_0xc3a9('0xca')](_0x9401b)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x120')));if(_0x4fa218[_0xc3a9('0x191')](0x0,_0x511db4,_0x36b852)&&!_0x595d7f){if(_0x9401b[_0xc3a9('0x123')]>=_0x36b852[_0xc3a9('0x199')]){_0x4fa218['createStateFinal'](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1a3'));}else{_0x4fa218[_0xc3a9('0x126')](_0x9401b,_0x475c7f,_0x2a5c26,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x36b852[_0xc3a9('0x1a4')]+=0x1;_0x9401b[_0xc3a9('0x73')]=0x3;_0x9401b[_0xc3a9('0xd4')]=_0xc3a9('0x1a5');_0x9401b['countnoanswerretry']+=0x1;_0x9401b[_0xc3a9('0xda')]+=0x1;var _0x193944=ut[_0xc3a9('0x1a6')](_0x511db4,_0x36b852);ami['emit']('custom:agentnoanswer',_0x193944);_0x684cca=_0x36b852[_0xc3a9('0x1a7')];_0x30778f=_0x36b852[_0xc3a9('0xdc')];hopperUtils[_0xc3a9('0xca')](_0x9401b)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x1a8')));if(_0x4fa218[_0xc3a9('0x191')](0x3,_0x511db4,_0x36b852)&&!_0x595d7f){if(_0x9401b[_0xc3a9('0x122')]>=_0x36b852[_0xc3a9('0x1a9')]){_0x4fa218[_0xc3a9('0x129')](_0x9401b,_0x475c7f,_0x2a5c26,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4fa218[_0xc3a9('0x126')](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1aa'));}}break;case'5':_0x36b852[_0xc3a9('0x1ab')]+=0x1;_0x9401b[_0xc3a9('0x73')]=0x5;_0x9401b[_0xc3a9('0xd4')]=_0xc3a9('0x1ac');_0x9401b['countbusyretry']+=0x1;_0x9401b['countglobal']+=0x1;ami[_0xc3a9('0x44')](_0xc3a9('0x1ad'),ut[_0xc3a9('0x119')](_0x511db4,_0xc3a9('0x1ae')));_0x684cca=_0x36b852['dialBusyRetryFrequency'];_0x30778f=_0x36b852[_0xc3a9('0xdc')];hopperUtils[_0xc3a9('0xca')](_0x9401b)[_0xc3a9('0xa4')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4fa218[_0xc3a9('0x191')](0x5,_0x511db4,_0x36b852)&&!_0x595d7f){if(_0x9401b[_0xc3a9('0x12e')]>=_0x36b852[_0xc3a9('0x193')]){_0x4fa218[_0xc3a9('0x129')](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1af'));}else{_0x4fa218['stateGlobal'](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1af'));}}break;case'8':_0x36b852[_0xc3a9('0x1b0')]+=0x1;_0x9401b['state']=0x8;_0x9401b[_0xc3a9('0xd4')]=_0xc3a9('0x1b1');_0x9401b[_0xc3a9('0x121')]+=0x1;_0x9401b[_0xc3a9('0xda')]+=0x1;_0x684cca=_0x36b852[_0xc3a9('0x197')];_0x30778f=_0x36b852[_0xc3a9('0xdc')];ami[_0xc3a9('0x44')](_0xc3a9('0x1b2'),ut[_0xc3a9('0x119')](_0x511db4,_0xc3a9('0x1b3')));hopperUtils['createHistory'](_0x9401b)[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x1b4')));if(_0x4fa218[_0xc3a9('0x191')](0x8,_0x511db4,_0x36b852)&&!_0x595d7f){if(_0x9401b[_0xc3a9('0x121')]>=_0x36b852[_0xc3a9('0x196')]){_0x4fa218[_0xc3a9('0x129')](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1b5'));}else{_0x4fa218[_0xc3a9('0x126')](_0x9401b,_0x475c7f,_0x2a5c26,'reason\x208\x20congestion');}}break;case'11':_0x36b852[_0xc3a9('0x1b6')]+=0x1;_0x9401b[_0xc3a9('0x73')]=0xb;_0x9401b[_0xc3a9('0xd4')]='Abandoned';_0x9401b[_0xc3a9('0xeb')]+=0x1;_0x9401b[_0xc3a9('0xda')]+=0x1;_0x684cca=_0x36b852['dialAbandonedRetryFrequency'];_0x30778f=_0x36b852['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x9401b)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4fa218[_0xc3a9('0x191')](0xb,_0x511db4,_0x36b852)&&!_0x595d7f){if(_0x9401b[_0xc3a9('0xeb')]>=_0x36b852['dialAbandonedMaxRetry']){_0x4fa218[_0xc3a9('0x129')](_0x9401b,_0x475c7f,_0x2a5c26,'reason\x2011\x20abandoned');}else{_0x4fa218[_0xc3a9('0x126')](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1b7'));}}break;case'20':_0x36b852[_0xc3a9('0x1b8')]+=0x1;_0x9401b['state']=0x14;_0x9401b[_0xc3a9('0xd4')]='AgentReject';_0x9401b[_0xc3a9('0x124')]+=0x1;_0x9401b['countglobal']+=0x1;_0x684cca=_0x36b852[_0xc3a9('0x19d')];_0x30778f=_0x36b852[_0xc3a9('0xdc')];ami[_0xc3a9('0x44')]('custom:agentreject',ut[_0xc3a9('0x119')](_0x511db4,_0xc3a9('0x1b9')));hopperUtils['createHistory'](_0x9401b)['catch'](loggerCatch(_0xc3a9('0x1ba')));if(_0x4fa218['checkRetriveMax'](0x14,_0x511db4,_0x36b852)&&!_0x595d7f){if(_0x9401b[_0xc3a9('0x124')]>=_0x36b852[_0xc3a9('0x19c')]){_0x4fa218[_0xc3a9('0x129')](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1bb'));}else{_0x4fa218[_0xc3a9('0x126')](_0x9401b,_0x475c7f,_0x2a5c26,_0xc3a9('0x1bb'));}}break;default:_0x36b852[_0xc3a9('0x136')]+=0x1;_0x9401b[_0xc3a9('0x73')]=0xc;_0x9401b[_0xc3a9('0xd4')]=_0x5e12f9[_0xc3a9('0xc5')];_0x684cca=_0x36b852['dialAgentRejectRetryFrequency'];_0x30778f=_0x36b852['callAdditionalPhoneAfterMin'];hopperUtils[_0xc3a9('0xca')](_0x9401b)['catch'](loggerCatch(_0xc3a9('0x1bc')));if(_0x4fa218[_0xc3a9('0x191')](_0x5e12f9[_0xc3a9('0xc5')],_0x511db4,_0x36b852)&&!_0x595d7f){if(_0x9401b[_0xc3a9('0x12e')]+_0x9401b[_0xc3a9('0x121')]+_0x9401b[_0xc3a9('0x122')]+_0x9401b[_0xc3a9('0x123')]+_0x9401b[_0xc3a9('0xd9')]+_0x9401b[_0xc3a9('0xeb')]+_0x9401b[_0xc3a9('0x11f')]+_0x9401b[_0xc3a9('0x124')]>=_0x36b852['dialGlobalMaxRetry']){_0x4fa218['stateGlobal'](_0x9401b,_0x475c7f,_0x2a5c26,_0x5e12f9[_0xc3a9('0xc5')]);}else{_0x4fa218[_0xc3a9('0x129')](_0x9401b,_0x475c7f,_0x2a5c26,_0x5e12f9[_0xc3a9('0xc5')]);}}}})['then'](function(){if(_0x595d7f){hopperUtils['swapAdditionalPhones'](_0x9401b,_0x684cca,_0x30778f)[_0xc3a9('0x41')](function(){return _0x475c7f(0x1);});}});});};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x126')]=function(_0x372e00,_0x1b87a4,_0x16df84,_0x1ae87f){var _0x4e6ebb=new Final(_0x372e00);_0x4e6ebb[_0xc3a9('0x73')]=0xf;_0x4e6ebb[_0xc3a9('0xd4')]=_0xc3a9('0x1bd');this[_0xc3a9('0x129')](_0x4e6ebb,_0x1b87a4,_0x16df84,_0x1ae87f);};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x129')]=function(_0x4c5a24,_0x3ffcd1,_0x4cf5eb,_0x5069f0){hopperUtils[_0xc3a9('0xcc')](_0x4c5a24)[_0xc3a9('0x41')](function(){return _0x3ffcd1(msgResponse(_0xc3a9('0x19f'),_0xc3a9('0x10d'),_0x5069f0));})['catch'](function(){return _0x4cf5eb(msgResponse(_0xc3a9('0x1be'),_0xc3a9('0x94'),_0xc3a9('0x1bf')));});};Dialer[_0xc3a9('0x1b')][_0xc3a9('0xa')]=function(_0x416349){var _0x289e93=_0x416349[_0xc3a9('0x1c0')]/0x64;var _0x9df433=_0x416349[_0xc3a9('0xd2')]/(_0x416349[_0xc3a9('0xd2')]+_0x416349[_0xc3a9('0xc4')]);var _0x5a1f72=Math[_0xc3a9('0x1c1')](_0x416349[_0xc3a9('0x1c2')]*(_0x416349[_0xc3a9('0x1c3')]/0x64));var _0x5d03c1=Math[_0xc3a9('0x1c1')](_0x416349['predictiveIntervalAvailable']*(_0x416349['predictiveIntervalMinThreshold']/0x64));var _0x5215f3=_0x416349['available']+_0x416349[_0xc3a9('0x140')];var _0x901681=Math[_0xc3a9('0x1c4')](_0x416349['erlangCalls']*_0x416349['erlangAbandonmentRate']*_0x416349[_0xc3a9('0x1c5')]*_0x416349['predictiveIntervalMultiplicativeFactor']);if(_[_0xc3a9('0x43')](_0x416349['startProgressive'])){if(!_[_0xc3a9('0x43')](_0x416349[_0xc3a9('0x27')])){_0x416349[_0xc3a9('0x27')]=undefined;loggerPredictive[_0xc3a9('0x68')](_0xc3a9('0x1c6'),_0xc3a9('0x1c7'));}if(!_[_0xc3a9('0x43')](_0x416349[_0xc3a9('0x66')])){loggerPredictive['error'](_0xc3a9('0x1c6'),_0xc3a9('0x1c8'));clearInterval(_0x416349['handlePredictive']);_0x416349['handlePredictive']=undefined;}_0x416349[_0xc3a9('0x28')]=moment()[_0xc3a9('0x4a')](_0xc3a9('0xc9'));loggerPredictive[_0xc3a9('0x4e')](_0x416349[_0xc3a9('0x4b')],_0xc3a9('0x1c9'),_0x416349['startProgressive']);this[_0xc3a9('0xb5')](_0x416349,0x1);}else if(ifInterval(_0x416349[_0xc3a9('0x1ca')],_0x416349[_0xc3a9('0x28')])){this['handlePower'](_0x416349,0x1);loggerPredictiveCalls[_0xc3a9('0x4e')](_0xc3a9('0x1cb'),_0x416349[_0xc3a9('0x28')],_0x416349[_0xc3a9('0x4b')]);_0x416349[_0xc3a9('0x5d')]=0x0;_0x416349[_0xc3a9('0xd3')]=0x0;}else if(_0x289e93<_0x9df433&&_0x416349[_0xc3a9('0x1cc')]===_0xc3a9('0x1cd')){clearPredictiveAttributes(_0x416349);loggerPredictive['info'](_0xc3a9('0x1ce'),_0xc3a9('0x1cf'),_0x9df433,_0xc3a9('0x28'),_0x416349[_0xc3a9('0x4b')]);}else if(_0x901681<_0x416349['predictiveIntervalErlangCallsDroppedCalls']&&_0x416349[_0xc3a9('0x1cc')]===_0xc3a9('0x1cd')){clearPredictiveAttributes(_0x416349);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x1d0'),'Max\x20Drop\x20',_0x901681,_0xc3a9('0x1d1'),_0x416349[_0xc3a9('0xd3')],'startProgressive',_0x416349[_0xc3a9('0x4b')]);}else if(!ifInterval(_0x416349[_0xc3a9('0x1ca')],_0x416349[_0xc3a9('0x28')])&&_['isUndefined'](_0x416349[_0xc3a9('0x27')])&&!_[_0xc3a9('0x43')](_0x416349[_0xc3a9('0x28')])){_0x416349[_0xc3a9('0x27')]=moment()[_0xc3a9('0x4a')](_0xc3a9('0xc9'));loggerPredictive[_0xc3a9('0x4e')](_0x416349[_0xc3a9('0x4b')],'started\x20in\x20predictive\x20at',_0x416349[_0xc3a9('0x27')]);hopperUtils[_0xc3a9('0x1d2')](_0x416349[_0xc3a9('0x1ca')])[_0xc3a9('0x41')](this[_0xc3a9('0x1d3')](_0x416349))['then'](mergeDataErlangB(_0x416349))['then'](this['startMethodPredictive'](_0x416349))['catch'](loggerCatchPredictive(_0xc3a9('0x1d4'),_0x416349));}else if(!ifInterval(_0x416349[_0xc3a9('0x1ca')],_0x416349[_0xc3a9('0x27')])){_0x416349[_0xc3a9('0xd3')]=0x0;_0x416349[_0xc3a9('0x27')]=moment()['format'](_0xc3a9('0xc9'));loggerPredictive[_0xc3a9('0x4e')](_0x416349[_0xc3a9('0x4b')],_0xc3a9('0x1d5'),_0x416349[_0xc3a9('0x27')]);clearInterval(_0x416349['handlePredictive']);_0x416349['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x416349[_0xc3a9('0x1ca')])[_0xc3a9('0x41')](this[_0xc3a9('0x1d3')](_0x416349))[_0xc3a9('0x41')](mergeDataErlangB(_0x416349))[_0xc3a9('0x41')](this[_0xc3a9('0x1d6')](_0x416349))[_0xc3a9('0xa4')](loggerCatchPredictive(_0xc3a9('0x1d7'),_0x416349));}else if(_0x416349['predictiveIntervalAvailable']&&_0x5215f3<_0x416349[_0xc3a9('0x1c2')]-_0x5d03c1){clearPredictiveAttributes(_0x416349);loggerPredictive[_0xc3a9('0x4e')](_0x416349['name'],_0xc3a9('0x1d8'),_0x5215f3,_0xc3a9('0x1d9'),_0x416349[_0xc3a9('0x1c2')],'-',_0x5d03c1,'=',_0x416349[_0xc3a9('0x1c2')]-_0x5d03c1,')');}else if(_0x416349['predictiveIntervalAvailable']&&_0x5215f3>_0x416349['predictiveIntervalAvailable']+_0x5a1f72){clearPredictiveAttributes(_0x416349);loggerPredictive[_0xc3a9('0x4e')](_0x416349['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5215f3,_0xc3a9('0x1da'),_0x416349[_0xc3a9('0x1c2')],'+',_0x5a1f72,'=',_0x416349[_0xc3a9('0x1c2')]+_0x5a1f72,')');}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x1d3')]=function(_0x444cc0){var _0x21074e=this;return function(_0xf03572){return new Promise(function(_0x331f2d,_0x86f0c6){_['merge'](_0x444cc0,_0xf03572[0x0]);if(checkGetDataPredictive(_0xf03572[0x0])){var _0x2c2bff=_0x444cc0['predictiveIntervalAvailable']=_0x444cc0[_0xc3a9('0x140')]+_0x444cc0[_0xc3a9('0x13e')];var _0x2e84ad=_0x444cc0[_0xc3a9('0x1ca')]*0x3c;var _0x1e9adb=_0xf03572[0x0]['predictiveIntervalAvgTalktime']+_0xf03572[0x0]['predictiveIntervalAvgHoldtime'];var _0x57873f=(_0xf03572[0x0][_0xc3a9('0x53')]+_0xf03572[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xf03572[0x0][_0xc3a9('0x1db')])/_0xf03572[0x0][_0xc3a9('0x51')];_0x444cc0['predictiveIntervalHitRate']=_0x57873f>0x0?_0x57873f:0x1;switch(_0x444cc0['dialPredictiveOptimization']){case _0xc3a9('0x1cd'):var _0x1e4f1b=_0x444cc0[_0xc3a9('0x1c0')]/0x64;return _0x21074e[_0xc3a9('0x1dc')](_0x2c2bff,_0x2e84ad,_0x1e9adb,_0x57873f,_0x1e4f1b)[_0xc3a9('0x41')](function(_0x3fcda9){return _0x331f2d(_0x3fcda9);});case _0xc3a9('0x1dd'):var _0xbf763b=_0x444cc0[_0xc3a9('0x1c0')]/0x64;return _0x21074e[_0xc3a9('0x1de')](_0x2c2bff,_0x2e84ad,_0x1e9adb,_0x57873f,_0xbf763b)['then'](function(_0x42238b){return _0x331f2d(_0x42238b);});default:return _0x86f0c6(msgResponse(_0xc3a9('0x1df'),_0xc3a9('0x94'),_0xc3a9('0x1e0')));}}else{return _0x86f0c6(msgResponse(_0xc3a9('0x1df'),_0xc3a9('0x94'),_0xc3a9('0x1e1')));}});};};Dialer['prototype'][_0xc3a9('0x1e2')]=function(_0x5291e3){var _0x2ca928=this;return function(_0xab3a7){return new Promise(function(_0x1ca274,_0x2e6288){_[_0xc3a9('0x62')](_0x5291e3,_0xab3a7[0x0]);if(checkGetDataPredictive(_0xab3a7[0x0])){loggerPredictive['info'](JSON[_0xc3a9('0x87')](_0xab3a7[0x0]));if(_0x5291e3['dialPredictiveOptimization']===_0xc3a9('0x1cd')){return _0x2ca928[_0xc3a9('0x15a')](_0x5291e3['id'])['then'](function(_0x35eff3){var _0xcc7c0f=_0x5291e3[_0xc3a9('0x1e3')]-_0x35eff3[0x0]['outboundQueuePauses'];var _0x245312=_0x5291e3[_0xc3a9('0x1ca')]*0x3c;var _0x5f1e36=_0xab3a7[0x0]['predictiveIntervalAvgTalktime']+_0xab3a7[0x0]['predictiveIntervalAvgHoldtime'];var _0x4ad6e2=(_0xab3a7[0x0][_0xc3a9('0x53')]+_0xab3a7[0x0][_0xc3a9('0xd1')]+_0xab3a7[0x0][_0xc3a9('0x1db')])/_0xab3a7[0x0]['predictiveIntervalTotalCalls'];var _0x552146=_0x5291e3[_0xc3a9('0x1c0')]/0x64;_0x5291e3[_0xc3a9('0x1e4')]=_0x35eff3[0x0][_0xc3a9('0x1e5')]||0x0;_0x5291e3[_0xc3a9('0x1c5')]=_0x4ad6e2>0x0?_0x4ad6e2:0x1;return _0x2ca928['abandonmentRate'](_0xcc7c0f,_0x245312,_0x5f1e36,_0x4ad6e2,_0x552146);})[_0xc3a9('0x41')](function(_0x30cfa1){return _0x1ca274(_0x30cfa1);})[_0xc3a9('0xa4')](function(_0x498ace){return _0x2e6288(msgResponse(_0xc3a9('0x1e6'),'Failure',JSON['stringify'](_0x498ace)));});}if(_0x5291e3[_0xc3a9('0x1cc')]===_0xc3a9('0x1dd')){return _0x2ca928[_0xc3a9('0x15a')](_0x5291e3['id'])[_0xc3a9('0x41')](function(_0x29c8ec){var _0x58d29c=_0x5291e3['loggedIn']-_0x29c8ec[0x0]['outboundQueuePauses'];var _0x25141b=_0x5291e3[_0xc3a9('0x1ca')]*0x3c;var _0x480c78=_0xab3a7[0x0][_0xc3a9('0x57')]+_0xab3a7[0x0][_0xc3a9('0x55')];var _0x366776=(_0xab3a7[0x0]['predictiveIntervalAnsweredCalls']+_0xab3a7[0x0][_0xc3a9('0xd1')]+_0xab3a7[0x0][_0xc3a9('0x1db')])/_0xab3a7[0x0]['predictiveIntervalTotalCalls'];var _0x25e86d=_0x5291e3['dialPredictiveOptimizationPercentage']/0x64;_0x5291e3[_0xc3a9('0x1e4')]=_0x29c8ec[0x0]['outboundQueuePauses']||0x0;_0x5291e3['predictiveIntervalHitRate']=_0x366776>0x0?_0x366776:0x1;return _0x2ca928[_0xc3a9('0x1de')](_0x58d29c,_0x25141b,_0x480c78,_0x366776,_0x25e86d);})['then'](function(_0x2b7c2e){return _0x1ca274(_0x2b7c2e);})[_0xc3a9('0xa4')](function(_0x2d15ca){return _0x2e6288(msgResponse(_0xc3a9('0x1e6'),_0xc3a9('0x94'),JSON[_0xc3a9('0x87')](_0x2d15ca)));});}}else{return _0x2e6288(msgResponse(_0xc3a9('0x1df'),'Failure',_0xc3a9('0x1e1')));}});};};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x1d6')]=function(_0x330b6b){var _0xd011b=this;return function(){var _0x498b49=0x0;var _0x5a66f4=Math['floor'](_0x330b6b['erlangCallToSecond']*0x3e8);if(_0x5a66f4>0x0){_0x5a66f4=_0x5a66f4<0x64?0x64:_0x5a66f4;loggerPredictive[_0xc3a9('0x4e')](_0x330b6b[_0xc3a9('0x4b')],'one\x20call\x20every:',_0x5a66f4,_0xc3a9('0x1e7'));_0x330b6b['handlePredictive']=setInterval(function(){_0xd011b[_0xc3a9('0x66')](_0x330b6b);loggerPredictiveCalls[_0xc3a9('0x4e')](_0xc3a9('0x1e8'),_0x498b49+=0x1);},_0x5a66f4);}else{loggerPredictive[_0xc3a9('0x4e')](_0x330b6b[_0xc3a9('0x4b')],_0xc3a9('0x1e9'));}};};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x1ea')]=function(_0x307c65,_0x27e543){var _0x241c91=this;return function(_0x5266c2){if(_['isEmpty'](_0x5266c2)){if(_['isNil'](_0x27e543[_0xc3a9('0x15e')])||!_0x27e543['recallme']){if(_0x307c65[_0xc3a9('0xb2')]===_0xc3a9('0x9')){_0x307c65['queueStatusComplete']=_[_0xc3a9('0x43')](_0x307c65[_0xc3a9('0x76')])?!![]:_0x307c65[_0xc3a9('0x76')];var _0x3fea60=uuid['v4']();_0x241c91[_0xc3a9('0x24')][_0x3fea60]=new Action(_0x307c65,_0x27e543,_0x3fea60);loggerBooked['info'](_0xc3a9('0x1eb'),_0x3fea60,_0xc3a9('0x1ec'),JSON['stringify'](_0x307c65[_0xc3a9('0x76')]),_0xc3a9('0x1ed'),_0x307c65[_0xc3a9('0x4b')]);if(_0x307c65[_0xc3a9('0x76')]){_0x307c65[_0xc3a9('0x76')]=![];_0x241c91['queueBooked'][_0x241c91[_0xc3a9('0x24')][_0x3fea60][_0xc3a9('0xc2')]]=[];ami[_0xc3a9('0x9d')]({'actionid':_0x3fea60,'action':_0xc3a9('0x1ee'),'queue':_0x307c65['name']})[_0xc3a9('0xa4')](function(){_0x241c91['updateOriginated'](_0x307c65);hopperUtils[_0xc3a9('0xff')]({'active':![],'ContactId':_0x241c91['actions'][_0x3fea60][_0xc3a9('0xef')],'ListId':_0x241c91[_0xc3a9('0x24')][_0x3fea60]['ListId'],'VoiceQueueId':_0x241c91[_0xc3a9('0x24')][_0x3fea60][_0xc3a9('0xe3')]||undefined,'CampaignId':_0x241c91[_0xc3a9('0x24')][_0x3fea60][_0xc3a9('0xe4')]||undefined})['catch'](loggerCatch(_0xc3a9('0x1ef')));delete _0x241c91[_0xc3a9('0x24')][_0x3fea60];});}else{loggerBooked[_0xc3a9('0x4e')]('[booked][checkContactBlack][else]',JSON[_0xc3a9('0x87')](_0x307c65[_0xc3a9('0x76')]),_0xc3a9('0x1ed'),_0x307c65[_0xc3a9('0x4b')]);_0x241c91[_0xc3a9('0xc1')](_0x307c65);hopperUtils[_0xc3a9('0xff')]({'active':![],'ContactId':_0x241c91['actions'][_0x3fea60][_0xc3a9('0xef')],'ListId':_0x241c91[_0xc3a9('0x24')][_0x3fea60][_0xc3a9('0xf0')],'VoiceQueueId':_0x241c91['actions'][_0x3fea60][_0xc3a9('0xe3')]||undefined,'CampaignId':_0x241c91[_0xc3a9('0x24')][_0x3fea60][_0xc3a9('0xe4')]||undefined})['catch'](loggerCatch(_0xc3a9('0x1ef')));delete _0x241c91[_0xc3a9('0x24')][_0x3fea60];}}else{return _0x241c91[_0xc3a9('0x1f0')](_0x307c65,_0x27e543);}}else{if(utils['getSeconds'](undefined,_0x27e543[_0xc3a9('0x1f1')])<_0x307c65['dialRecallMeTimeout']*0x3c){if(_0x27e543[_0xc3a9('0x14f')]&&!_0x27e543['Agent'][_0xc3a9('0x1f2')]){_0x241c91[_0xc3a9('0x1e')][_0xc3a9('0xfc')](_0x27e543['id'])[_0xc3a9('0xfe')](function(){_0x241c91[_0xc3a9('0xc1')](_0x307c65);});}else{hopperUtils[_0xc3a9('0x1f3')]({'active':![]},_0x27e543['id'],0x1)['finally'](function(){_0x241c91[_0xc3a9('0xc1')](_0x307c65);});}}else{_0x307c65[_0xc3a9('0x1f4')]+=0x1;_0x241c91[_0xc3a9('0xc1')](_0x307c65);if(_0x307c65[_0xc3a9('0x1f5')]){hopperUtils[_0xc3a9('0xff')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x27e543['ContactId'],'ListId':_0x27e543['ListId'],'VoiceQueueId':_0x27e543[_0xc3a9('0xe3')]||undefined,'CampaignId':_0x27e543['CampaignId']||undefined})[_0xc3a9('0xa4')](loggerCatch(_0xc3a9('0x1f6')));hopperUtils[_0xc3a9('0xca')](createObjHistory(_0x307c65,_0x27e543,utils[_0xc3a9('0x6d')][_0xc3a9('0x1f7')],0x17,_0xc3a9('0x1f8')))['catch'](loggerCatch(_0xc3a9('0x1f9')));}else{_0x241c91['saveInDb'](createObjHistory(_0x307c65,_0x27e543,utils['CAMPAIGN_STATUS'][_0xc3a9('0x1fa')],0x16,_0xc3a9('0x1fb')),_0xc3a9('0x1fc'),_0xc3a9('0x1fd'));}}}}else{_0x307c65[_0xc3a9('0x1fe')]+=0x1;_0x241c91[_0xc3a9('0x11b')](createObjHistory(_0x307c65,_0x27e543,utils[_0xc3a9('0x6d')][_0xc3a9('0x1ff')],0xd,_0xc3a9('0x200')),_0xc3a9('0x201'),_0xc3a9('0x202'));throw _0xc3a9('0x203');}};};Dialer['prototype'][_0xc3a9('0x204')]=function(_0x4be779){var _0x40d469=this;var _0x35258e=_0x4be779['limitCalls']-_0x4be779['originated'];emitCampaignSummary(_0x4be779);if(_0x35258e>0x0&&_0x4be779[_0xc3a9('0x6a')]==0x0){if(_0x35258e>this['maxNumberOriginate']){_0x35258e=this['maxNumberOriginate'];}_0x4be779['temp']=0x1;hopperUtils[_0xc3a9('0x205')](_0x4be779,_0x35258e)[_0xc3a9('0x41')](function(_0x382b36){_0x4be779[_0xc3a9('0x6a')]=0x0;if(_0x382b36){if(!utils['checkContactEmpty'](_0x382b36)){_0x4be779[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x71')];logger[_0xc3a9('0x4e')](_0xc3a9('0x206')+_0x4be779['name']);}else{_0x4be779[_0xc3a9('0x15b')]+=_0x382b36[_0xc3a9('0x9b')];_0x4be779[_0xc3a9('0x6c')]=utils[_0xc3a9('0x6d')][_0xc3a9('0x207')];for(var _0x10514d=0x0;_0x10514d<_0x382b36['length'];_0x10514d+=0x1){_0x4be779[_0xc3a9('0x208')]+=0x1;if(_[_0xc3a9('0xf6')](_0x382b36[_0x10514d])||_[_0xc3a9('0xf6')](_0x382b36[_0x10514d]['Contact'])||_[_0xc3a9('0xf6')](_0x382b36[_0x10514d][_0xc3a9('0x163')])){_0x40d469[_0xc3a9('0x15d')]('[actionOriginate]\x20',_0x4be779,_0x382b36[_0x10514d]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xc3a9('0xfa')](_0x382b36[_0x10514d],[_0xc3a9('0xe4'),_0xc3a9('0x163')]))[_0xc3a9('0x41')](_0x40d469[_0xc3a9('0x1ea')](_0x4be779,_0x382b36[_0x10514d]))[_0xc3a9('0xa4')](_0x40d469[_0xc3a9('0x209')](_0xc3a9('0x20a'),_0x4be779));}}}}})[_0xc3a9('0xa4')](loggerGetContactDialer(_0xc3a9('0x20b'),_0x4be779,_0x35258e));}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0xb5')]=function(_0x4a619f,_0x80eba5){var _0x3b1c00=this;var _0x4ca13b=[];if(_0x80eba5<0x1||_0x4a619f[_0xc3a9('0xb2')]===_0xc3a9('0x9')){_0x80eba5=0x1;}var _0x470fd0=Math['floor'](_0x4a619f[_0xc3a9('0x13e')]*_0x80eba5)-_0x4a619f['originated'];if(_0x4a619f[_0xc3a9('0x20c')]>0x0){var _0x2b4297=_0x4a619f[_0xc3a9('0x20c')]-_0x4a619f[_0xc3a9('0x15b')]-_0x4a619f[_0xc3a9('0x140')]-_0x4a619f[_0xc3a9('0x20d')];if(_0x470fd0>_0x2b4297){_0x470fd0=_0x2b4297;}}if(_0x470fd0>0x0&&_0x4a619f['temp']==0x0){if(_0x4a619f[_0xc3a9('0xb2')]==='booked'){_0x470fd0=0x1;}if(_0x470fd0>this[_0xc3a9('0x23')]){_0x470fd0=this[_0xc3a9('0x23')];}for(var _0x26195e in this[_0xc3a9('0x21')]){if(typeof this[_0xc3a9('0x21')][_0x26195e]!==_0xc3a9('0xac')){if(this[_0xc3a9('0x21')][_0x26195e][_0xc3a9('0x73')]===_0xc3a9('0x20e')&&this['agents'][_0x26195e][_0xc3a9('0x8a')]==='reachable'){_0x4ca13b[_0xc3a9('0x9c')](this['agents'][_0x26195e]['id']);}}}_0x4a619f[_0xc3a9('0x6a')]=0x1;hopperUtils[_0xc3a9('0x20f')](_0x4a619f,_0x4ca13b,_0x470fd0)[_0xc3a9('0x41')](function(_0x3f7cd6){_0x4a619f[_0xc3a9('0x6a')]=0x0;if(_0x3f7cd6){if(!utils[_0xc3a9('0x210')](_0x3f7cd6)){hopperUtils[_0xc3a9('0x211')](_0x4a619f)[_0xc3a9('0x41')](sendMessageReschedule(_0x4a619f))['catch'](loggerCatch(_0xc3a9('0x212')));}else{_0x4a619f[_0xc3a9('0x15b')]+=_0x3f7cd6[_0xc3a9('0x9b')];_0x4a619f[_0xc3a9('0x6c')]=_0x4a619f[_0xc3a9('0xb2')]==='booked'?utils['CAMPAIGN_STATUS'][_0xc3a9('0x141')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x4e77a4=0x0;_0x4e77a4<_0x3f7cd6[_0xc3a9('0x9b')];_0x4e77a4+=0x1){if(_[_0xc3a9('0xf6')](_0x3f7cd6[_0x4e77a4])||_[_0xc3a9('0xf6')](_0x3f7cd6[_0x4e77a4][_0xc3a9('0x17c')])||_[_0xc3a9('0xf6')](_0x3f7cd6[_0x4e77a4][_0xc3a9('0x163')])){_0x3b1c00[_0xc3a9('0x15d')](_0xc3a9('0x213'),_0x4a619f,_0x3f7cd6[_0x4e77a4]);}else{hopperUtils[_0xc3a9('0x214')](_[_0xc3a9('0xfa')](_0x3f7cd6[_0x4e77a4],[_0xc3a9('0xe3'),_0xc3a9('0x163')]))[_0xc3a9('0x41')](_0x3b1c00[_0xc3a9('0x1ea')](_0x4a619f,_0x3f7cd6[_0x4e77a4]))[_0xc3a9('0xa4')](_0x3b1c00[_0xc3a9('0x209')](_0xc3a9('0x213'),_0x4a619f));}}}}})[_0xc3a9('0xa4')](loggerGetContactDialer(_0xc3a9('0x215'),_0x4a619f,_0x470fd0));}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x66')]=function(_0x31d555){if(_0x31d555[_0xc3a9('0x20c')]>0x0){var _0x20584f=_0x31d555[_0xc3a9('0x20c')]-_0x31d555[_0xc3a9('0x15b')]-_0x31d555['talking'];if(_0x20584f>0x0&&_0x31d555[_0xc3a9('0x6a')]==0x0){this[_0xc3a9('0x216')](_0x31d555);}else{loggerPredictiveCalls[_0xc3a9('0x4e')]('[handlePredictive][limitChannel]');}}else{this[_0xc3a9('0x216')](_0x31d555);}};Dialer[_0xc3a9('0x1b')][_0xc3a9('0x216')]=function(_0x23b57f){var _0xc25800=this;var _0x2e7264=[];_0x23b57f['originated']+=0x1;for(var _0x525167 in this[_0xc3a9('0x21')]){if(typeof this['agents'][_0x525167]!==_0xc3a9('0xac')){if(this[_0xc3a9('0x21')][_0x525167][_0xc3a9('0x73')]===_0xc3a9('0x20e')&&this['agents'][_0x525167][_0xc3a9('0x8a')]==='reachable'){_0x2e7264[_0xc3a9('0x9c')](this['agents'][_0x525167]['id']);}}}_0x23b57f[_0xc3a9('0x6a')]=0x1;return this[_0xc3a9('0x20f')](_0x23b57f['id'],_0x2e7264,0x1,_0x23b57f[_0xc3a9('0x217')],_0x23b57f)['then'](function(_0x41646c){_0x23b57f[_0xc3a9('0x6a')]=0x1;if(_0x41646c){if(!utils[_0xc3a9('0x210')](_0x41646c)){utils[_0xc3a9('0x218')](_0x23b57f,0x1,0x0);return hopperUtils[_0xc3a9('0x211')](_0x23b57f)[_0xc3a9('0x41')](sendMessageReschedule(_0x23b57f))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x23b57f['message']=utils[_0xc3a9('0x6d')][_0xc3a9('0x207')];if(_[_0xc3a9('0xf6')](_0x41646c[0x0])||_[_0xc3a9('0xf6')](_0x41646c[0x0][_0xc3a9('0x17c')])||_[_0xc3a9('0xf6')](_0x41646c[0x0][_0xc3a9('0x163')])){_0xc25800['emptyContact']('[actionOriginate]\x20',_0x23b57f,_0x41646c[0x0]);}else{return hopperUtils[_0xc3a9('0x214')](_['pick'](_0x41646c[0x0],[_0xc3a9('0xe3'),_0xc3a9('0x163')]))['then'](_0xc25800['checkContactBlack'](_0x23b57f,_0x41646c[0x0]))[_0xc3a9('0xa4')](_0xc25800[_0xc3a9('0x209')](_0xc3a9('0x219'),_0x23b57f));}}}})[_0xc3a9('0xa4')](loggerGetContactDialer('[getContactDialerPredictive]',_0x23b57f,0x1));};Dialer[_0xc3a9('0x1b')]['abandonmentRate']=function(_0x4e458e,_0x466eda,_0x9068e7,_0x41a035,_0x505e36,_0x3edd62){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xc3a9('0x21a'),_0x4e458e);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x21b'),_0x466eda);loggerPredictive[_0xc3a9('0x4e')]('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',_0x9068e7);loggerPredictive[_0xc3a9('0x4e')]('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',_0x41a035);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x21c'),_0x505e36);loggerPredictive[_0xc3a9('0x4e')]('---------------------------');return new Promise(function(_0x4f0ee6,_0x1bd8e8){if(_0x4e458e<=0x0||isNaN(_0x4e458e)){return _0x1bd8e8(msgResponse(_0xc3a9('0x21d'),_0xc3a9('0x86'),_0xc3a9('0x21e')+_0x4e458e));}if(_0x9068e7<=0x0||isNaN(_0x9068e7)){return _0x1bd8e8(msgResponse('[abandonmentRate]','Error',_0xc3a9('0x21f')+_0x9068e7));}if(_0x41a035<=0x0||isNaN(_0x41a035)){return _0x1bd8e8(msgResponse(_0xc3a9('0x21d'),_0xc3a9('0x86'),_0xc3a9('0x220')+_0x41a035));}if(_0x466eda<=0x0||isNaN(_0x466eda)){return _0x1bd8e8(msgResponse('[abandonmentRate]','Error',_0xc3a9('0x221')+_0x466eda));}if(_0x505e36<=0x0||isNaN(_0x505e36)){return _0x1bd8e8(msgResponse('[abandonmentRate]',_0xc3a9('0x86'),_0xc3a9('0x222')+_0x505e36));}_0x3edd62=_0x3edd62||0x0;var _0x55c692=0x1/_0x9068e7;var _0x14ff1e=0x0;var _0x471563=0x0;var _0x331441=0x0;var _0x2cfe71=0x0;for(var _0x285437=0x0;_0x331441<_0x505e36;_0x285437+=0x1){_0x471563=_0x285437/_0x466eda;_0x14ff1e=(_0x41a035*_0x471563+_0x3edd62)/_0x55c692;_0x331441=utils[_0xc3a9('0x223')](_0x14ff1e,_0x4e458e);_0x2cfe71=_0x14ff1e/_0x4e458e*(0x1-utils[_0xc3a9('0x223')](_0x14ff1e,_0x4e458e));}return _0x4f0ee6({'erlangCalls':_0x285437,'erlangCallToSecond':_0x466eda/_0x285437,'erlangAbandonmentRate':_0x331441,'erlangBusyFactor':_0x2cfe71});});};Dialer[_0xc3a9('0x1b')]['busyFactor']=function(_0x1eea0b,_0x7afbf8,_0x3668ab,_0x77a028,_0x3e2fcb,_0x290f63){loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x224'));loggerPredictive['info'](_0xc3a9('0x21a'),_0x1eea0b);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x21b'),_0x7afbf8);loggerPredictive['info'](_0xc3a9('0x225'),_0x3668ab);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x226'),_0x77a028);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x227'),_0x3e2fcb);loggerPredictive[_0xc3a9('0x4e')](_0xc3a9('0x58'));return new Promise(function(_0x539cb6,_0x5d907c){if(_0x1eea0b<=0x0||isNaN(_0x1eea0b)){return _0x5d907c(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x1eea0b));}if(_0x3668ab<=0x0||isNaN(_0x3668ab)){return _0x5d907c(msgResponse(_0xc3a9('0x228'),_0xc3a9('0x86'),_0xc3a9('0x21f')+_0x3668ab));}if(_0x77a028<=0x0||isNaN(_0x77a028)){return _0x5d907c(msgResponse(_0xc3a9('0x228'),_0xc3a9('0x86'),_0xc3a9('0x220')+_0x77a028));}if(_0x7afbf8<=0x0||isNaN(_0x7afbf8)){return _0x5d907c(msgResponse(_0xc3a9('0x228'),_0xc3a9('0x86'),_0xc3a9('0x221')+_0x7afbf8));}if(_0x3e2fcb<=0x0||isNaN(_0x3e2fcb)){return _0x5d907c(msgResponse(_0xc3a9('0x228'),_0xc3a9('0x86'),'Umin\x20=\x20'+_0x3e2fcb));}_0x290f63=_0x290f63||0x0;var _0x3185ab=0x1/_0x3668ab;var _0x236f76=0x0;var _0x4fc13c=0x0;var _0x40e70f=0x0;var _0x54c0c3=0x0;for(var _0x2d69ad=0x0;_0x54c0c3<_0x3e2fcb;_0x2d69ad+=0x1){_0x4fc13c=_0x2d69ad/_0x7afbf8;_0x236f76=(_0x77a028*_0x4fc13c+_0x290f63)/_0x3185ab;_0x40e70f=utils[_0xc3a9('0x223')](_0x236f76,_0x1eea0b);_0x54c0c3=_0x236f76/_0x1eea0b*(0x1-utils['erlangb'](_0x236f76,_0x1eea0b));}return _0x539cb6({'erlangCalls':_0x2d69ad,'erlangCallToSecond':_0x7afbf8/_0x2d69ad,'erlangAbandonmentRate':_0x40e70f,'erlangBusyFactor':_0x54c0c3});});};module[_0xc3a9('0x229')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 2182ccf..b8fcf19 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf304=['scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','exports','util','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0xcdb1b2,_0x938fba){var _0x2454a8=function(_0x1b0fbe){while(--_0x1b0fbe){_0xcdb1b2['push'](_0xcdb1b2['shift']());}};_0x2454a8(++_0x938fba);}(_0xf304,0x175));var _0x4f30=function(_0x5042a8,_0x2d66a5){_0x5042a8=_0x5042a8-0x0;var _0x51b197=_0xf304[_0x5042a8];return _0x51b197;};'use strict';var util=require(_0x4f30('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x353cc7,_0x4f1abb,_0x2b78ec){var _0x501f2f='';if(!_[_0x4f30('0x1')](_0x4f1abb)&&_0x4f30('0x2')===typeof _0x4f1abb){_0x501f2f+=_0x4f1abb;}if(!_[_0x4f30('0x1')](_0x2b78ec)&&_0x4f30('0x2')===typeof _0x2b78ec){_0x501f2f+='\x20'+_0x2b78ec;}if(_0x501f2f!==''){return _0x501f2f;}return _0x353cc7;}function Action(_0x5493a7,_0x493857,_0x25678a){this[_0x4f30('0x3')]=_0x5493a7;this[_0x4f30('0x4')]=_0x25678a||undefined;this[_0x4f30('0x5')]=checkNameSurname(_0x493857[_0x4f30('0x6')]['phone'],_0x493857[_0x4f30('0x6')][_0x4f30('0x7')],_0x493857[_0x4f30('0x6')][_0x4f30('0x8')]);this[_0x4f30('0x9')]=_0x493857['phone'];this[_0x4f30('0xa')]=_0x5493a7[_0x4f30('0x5')];this[_0x4f30('0xb')]=_0x493857['active']||![];this[_0x4f30('0xc')]=_0x5493a7[_0x4f30('0xc')];this[_0x4f30('0xd')]=_0x5493a7[_0x4f30('0xd')]||0x3;this[_0x4f30('0xe')]=_0x493857[_0x4f30('0xe')];this[_0x4f30('0xf')]=_0x493857[_0x4f30('0xf')];this[_0x4f30('0x10')]=_0x493857[_0x4f30('0x10')];this['countnoanswerretry']=_0x493857['countnoanswerretry'];this[_0x4f30('0x11')]=_0x493857[_0x4f30('0x11')];this[_0x4f30('0x12')]=_0x493857[_0x4f30('0x12')];this[_0x4f30('0x13')]=_0x493857[_0x4f30('0x13')];this[_0x4f30('0x14')]=_0x493857[_0x4f30('0x14')];this[_0x4f30('0x15')]=_0x493857[_0x4f30('0x15')];this['ContactId']=_0x493857[_0x4f30('0x16')];this[_0x4f30('0x17')]=_0x493857[_0x4f30('0x17')];this[_0x4f30('0x18')]=_0x493857[_0x4f30('0x18')];this[_0x4f30('0x19')]=_0x493857[_0x4f30('0x19')];this[_0x4f30('0x1a')]=_0x493857['CampaignId'];this[_0x4f30('0x1b')]=_0x493857['id'];this[_0x4f30('0x1c')]=_0x493857[_0x4f30('0x6')][_0x4f30('0x7')]||'';this[_0x4f30('0x1d')]=moment()[_0x4f30('0x1e')](_0x4f30('0x1f'));this[_0x4f30('0x20')]=_0x493857[_0x4f30('0x20')];this[_0x4f30('0x21')]=_0x493857[_0x4f30('0x21')];this[_0x4f30('0x22')]=_0x493857[_0x4f30('0x22')];this['recallme']=_0x493857[_0x4f30('0x23')];this['originatecalleridnum']='';this[_0x4f30('0x24')]='';}Action[_0x4f30('0x25')][_0x4f30('0x26')]=function(){return util[_0x4f30('0x1e')](_0x4f30('0x27'),this[_0x4f30('0x5')],this[_0x4f30('0x3')]['dialCutDigit']>0x0?this[_0x4f30('0x9')][_0x4f30('0x28')](this[_0x4f30('0x3')][_0x4f30('0x29')]):this['number']);};Action[_0x4f30('0x25')]['getQueue']=function(){return this['queue'];};module[_0x4f30('0x2a')]=Action; \ No newline at end of file +var _0xe805=['CampaignId','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','exports','util','lodash','isNil','voiceQueue','Contact','phone','firstName','number','queue','name','active','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ListId','UserId','VoiceQueueId'];(function(_0x569e89,_0x326af6){var _0x958857=function(_0x14d54b){while(--_0x14d54b){_0x569e89['push'](_0x569e89['shift']());}};_0x958857(++_0x326af6);}(_0xe805,0x82));var _0x5e80=function(_0x5f3947,_0x41ac98){_0x5f3947=_0x5f3947-0x0;var _0x45e083=_0xe805[_0x5f3947];return _0x45e083;};'use strict';var util=require(_0x5e80('0x0'));var _=require(_0x5e80('0x1'));var moment=require('moment');function checkNameSurname(_0x25abba,_0x469964,_0x3c4102){var _0x1ade5d='';if(!_[_0x5e80('0x2')](_0x469964)&&'string'===typeof _0x469964){_0x1ade5d+=_0x469964;}if(!_[_0x5e80('0x2')](_0x3c4102)&&'string'===typeof _0x3c4102){_0x1ade5d+='\x20'+_0x3c4102;}if(_0x1ade5d!==''){return _0x1ade5d;}return _0x25abba;}function Action(_0x224d76,_0x5ec351,_0x9ae01d){this[_0x5e80('0x3')]=_0x224d76;this['uniqueid']=_0x9ae01d||undefined;this['name']=checkNameSurname(_0x5ec351[_0x5e80('0x4')][_0x5e80('0x5')],_0x5ec351[_0x5e80('0x4')][_0x5e80('0x6')],_0x5ec351[_0x5e80('0x4')]['lastName']);this[_0x5e80('0x7')]=_0x5ec351[_0x5e80('0x5')];this[_0x5e80('0x8')]=_0x224d76[_0x5e80('0x9')];this[_0x5e80('0xa')]=_0x5ec351[_0x5e80('0xa')]||![];this['type']=_0x224d76['type'];this[_0x5e80('0xb')]=_0x224d76[_0x5e80('0xb')]||0x3;this[_0x5e80('0xc')]=_0x5ec351['scheduledat'];this[_0x5e80('0xd')]=_0x5ec351['countbusyretry'];this['countcongestionretry']=_0x5ec351['countcongestionretry'];this[_0x5e80('0xe')]=_0x5ec351[_0x5e80('0xe')];this[_0x5e80('0xf')]=_0x5ec351['countnosuchnumberretry'];this[_0x5e80('0x10')]=_0x5ec351[_0x5e80('0x10')];this['countabandonedretry']=_0x5ec351[_0x5e80('0x11')];this[_0x5e80('0x12')]=_0x5ec351[_0x5e80('0x12')];this['countagentrejectretry']=_0x5ec351['countagentrejectretry'];this['ContactId']=_0x5ec351['ContactId'];this[_0x5e80('0x13')]=_0x5ec351[_0x5e80('0x13')];this[_0x5e80('0x14')]=_0x5ec351[_0x5e80('0x14')];this['VoiceQueueId']=_0x5ec351[_0x5e80('0x15')];this[_0x5e80('0x16')]=_0x5ec351[_0x5e80('0x16')];this['idHopper']=_0x5ec351['id'];this[_0x5e80('0x17')]=_0x5ec351[_0x5e80('0x4')][_0x5e80('0x6')]||'';this['starttime']=moment()['format'](_0x5e80('0x18'));this[_0x5e80('0x19')]=_0x5ec351['callback'];this[_0x5e80('0x1a')]=_0x5ec351[_0x5e80('0x1a')];this[_0x5e80('0x1b')]=_0x5ec351[_0x5e80('0x1b')];this['recallme']=_0x5ec351[_0x5e80('0x1c')];this[_0x5e80('0x1d')]='';this[_0x5e80('0x1e')]='';}Action[_0x5e80('0x1f')][_0x5e80('0x20')]=function(){return util['format'](_0x5e80('0x21'),this['name'],this[_0x5e80('0x3')]['dialCutDigit']>0x0?this[_0x5e80('0x7')][_0x5e80('0x22')](this[_0x5e80('0x3')][_0x5e80('0x23')]):this[_0x5e80('0x7')]);};Action[_0x5e80('0x1f')][_0x5e80('0x24')]=function(){return this[_0x5e80('0x8')];};module[_0x5e80('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index db8f11d..f8156b5 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f07=['statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state'];(function(_0xff3eaa,_0x48ce55){var _0x1a21c2=function(_0x18d497){while(--_0x18d497){_0xff3eaa['push'](_0xff3eaa['shift']());}};_0x1a21c2(++_0x48ce55);}(_0x0f07,0xa9));var _0x70f0=function(_0x487fb0,_0x3f3bb3){_0x487fb0=_0x487fb0-0x0;var _0x17b270=_0x0f07[_0x487fb0];return _0x17b270;};'use strict';var moment=require(_0x70f0('0x0'));var utils=require(_0x70f0('0x1'));function AgentComplete(_0x10c81c,_0x1abe83){this[_0x70f0('0x2')]=0x4;this[_0x70f0('0x3')]=_0x70f0('0x4');this[_0x70f0('0x5')]=_0x10c81c[_0x70f0('0x5')];this[_0x70f0('0x6')]=_0x10c81c['type'];this['campaigntype']=_0x10c81c[_0x70f0('0x6')]===_0x70f0('0x7')?_0x70f0('0x8'):_0x10c81c[_0x70f0('0x6')];this[_0x70f0('0x9')]=_0x10c81c[_0x70f0('0x9')];this[_0x70f0('0xa')]=_0x10c81c[_0x70f0('0xa')];this[_0x70f0('0xb')]=_0x10c81c[_0x70f0('0xb')];this[_0x70f0('0xc')]=_0x10c81c[_0x70f0('0x9')]+_0x10c81c[_0x70f0('0xa')]+_0x10c81c[_0x70f0('0xb')]+_0x10c81c[_0x70f0('0xd')]+_0x10c81c['countdropretry']+_0x10c81c[_0x70f0('0xe')]+_0x10c81c[_0x70f0('0xf')]+_0x10c81c[_0x70f0('0x10')];this['countnosuchnumberretry']=_0x10c81c[_0x70f0('0xd')];this[_0x70f0('0x11')]=_0x10c81c[_0x70f0('0x11')];this['countabandonedretry']=_0x10c81c[_0x70f0('0xe')];this[_0x70f0('0xf')]=_0x10c81c[_0x70f0('0xf')];this[_0x70f0('0x10')]=_0x10c81c[_0x70f0('0x10')];this[_0x70f0('0x12')]=_0x1abe83[_0x70f0('0x12')];this['calleridname']=_0x10c81c[_0x70f0('0x13')];this['calleridnum']=_0x10c81c['number'];this[_0x70f0('0x14')]=_0x10c81c['starttime'];this[_0x70f0('0x15')]=_0x10c81c[_0x70f0('0x15')];this[_0x70f0('0x16')]=_0x10c81c[_0x70f0('0x16')];this[_0x70f0('0x17')]=moment()[_0x70f0('0x18')](_0x70f0('0x19'));this['ringtime']=utils['getSeconds'](_0x10c81c[_0x70f0('0x15')],_0x10c81c[_0x70f0('0x14')]);this[_0x70f0('0x1a')]=utils[_0x70f0('0x1b')](_0x10c81c[_0x70f0('0x16')],_0x10c81c[_0x70f0('0x15')]);this[_0x70f0('0x1c')]=utils[_0x70f0('0x1b')](this['endtime'],_0x10c81c[_0x70f0('0x16')]);this[_0x70f0('0x8')]=_0x1abe83[_0x70f0('0x8')];this[_0x70f0('0x1d')]=_0x1abe83[_0x70f0('0x1d')];this[_0x70f0('0x1e')]=_0x1abe83['reason'];this[_0x70f0('0x1f')]=_0x10c81c[_0x70f0('0x1f')];this[_0x70f0('0x20')]=_0x10c81c[_0x70f0('0x20')];this[_0x70f0('0x21')]=_0x10c81c[_0x70f0('0x21')];this['recallme']=_0x10c81c[_0x70f0('0x22')];this['ContactId']=_0x10c81c['ContactId'];this[_0x70f0('0x23')]=_0x10c81c[_0x70f0('0x23')];this[_0x70f0('0x24')]=_0x10c81c[_0x70f0('0x24')];this['VoiceQueueId']=_0x10c81c[_0x70f0('0x25')];this[_0x70f0('0x26')]=_0x10c81c[_0x70f0('0x26')];this[_0x70f0('0x27')]=_0x10c81c[_0x70f0('0x27')]||'';this[_0x70f0('0x28')]=_0x10c81c['originatecalleridname']||'';this[_0x70f0('0x29')]=_0x10c81c[_0x70f0('0x29')];}module[_0x70f0('0x2a')]=AgentComplete; \ No newline at end of file +var _0x46d0=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','endtime','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0x46d0,0xd6));var _0x046d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46d0[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var utils=require(_0x046d('0x0'));function AgentComplete(_0x374b58,_0x126a69){this[_0x046d('0x1')]=0x4;this[_0x046d('0x2')]='Answer';this[_0x046d('0x3')]=_0x374b58[_0x046d('0x3')];this[_0x046d('0x4')]=_0x374b58['type'];this[_0x046d('0x5')]=_0x374b58[_0x046d('0x4')]==='outbound'?_0x046d('0x6'):_0x374b58[_0x046d('0x4')];this[_0x046d('0x7')]=_0x374b58[_0x046d('0x7')];this[_0x046d('0x8')]=_0x374b58[_0x046d('0x8')];this[_0x046d('0x9')]=_0x374b58[_0x046d('0x9')];this[_0x046d('0xa')]=_0x374b58[_0x046d('0x7')]+_0x374b58[_0x046d('0x8')]+_0x374b58[_0x046d('0x9')]+_0x374b58['countnosuchnumberretry']+_0x374b58[_0x046d('0xb')]+_0x374b58[_0x046d('0xc')]+_0x374b58[_0x046d('0xd')]+_0x374b58[_0x046d('0xe')];this[_0x046d('0xf')]=_0x374b58['countnosuchnumberretry'];this[_0x046d('0xb')]=_0x374b58[_0x046d('0xb')];this[_0x046d('0xc')]=_0x374b58['countabandonedretry'];this[_0x046d('0xd')]=_0x374b58[_0x046d('0xd')];this[_0x046d('0xe')]=_0x374b58['countagentrejectretry'];this[_0x046d('0x10')]=_0x126a69['uniqueid'];this[_0x046d('0x11')]=_0x374b58[_0x046d('0x12')];this[_0x046d('0x13')]=_0x374b58[_0x046d('0x14')];this[_0x046d('0x15')]=_0x374b58[_0x046d('0x15')];this[_0x046d('0x16')]=_0x374b58[_0x046d('0x16')];this[_0x046d('0x17')]=_0x374b58[_0x046d('0x17')];this['endtime']=moment()[_0x046d('0x18')](_0x046d('0x19'));this[_0x046d('0x1a')]=utils[_0x046d('0x1b')](_0x374b58['responsetime'],_0x374b58[_0x046d('0x15')]);this['holdtime']=utils[_0x046d('0x1b')](_0x374b58[_0x046d('0x17')],_0x374b58[_0x046d('0x16')]);this[_0x046d('0x1c')]=utils[_0x046d('0x1b')](this[_0x046d('0x1d')],_0x374b58['answertime']);this[_0x046d('0x6')]=_0x126a69[_0x046d('0x6')];this['membername']=_0x126a69['membername'];this[_0x046d('0x1e')]=_0x126a69[_0x046d('0x1e')];this['callback']=_0x374b58[_0x046d('0x1f')];this[_0x046d('0x20')]=_0x374b58[_0x046d('0x20')];this[_0x046d('0x21')]=_0x374b58[_0x046d('0x21')];this[_0x046d('0x22')]=_0x374b58[_0x046d('0x22')];this['ContactId']=_0x374b58['ContactId'];this[_0x046d('0x23')]=_0x374b58['ListId'];this[_0x046d('0x24')]=_0x374b58[_0x046d('0x24')];this[_0x046d('0x25')]=_0x374b58[_0x046d('0x25')];this[_0x046d('0x26')]=_0x374b58[_0x046d('0x26')];this[_0x046d('0x27')]=_0x374b58[_0x046d('0x27')]||'';this[_0x046d('0x28')]=_0x374b58[_0x046d('0x28')]||'';this[_0x046d('0x29')]=_0x374b58[_0x046d('0x29')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 55529f1..c321452 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33e9=['calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry'];(function(_0x4639ad,_0x1dd5f9){var _0x412ee6=function(_0x3f9c45){while(--_0x3f9c45){_0x4639ad['push'](_0x4639ad['shift']());}};_0x412ee6(++_0x1dd5f9);}(_0x33e9,0x1e3));var _0x933e=function(_0xe41e9d,_0xc92c61){_0xe41e9d=_0xe41e9d-0x0;var _0x1943c1=_0x33e9[_0xe41e9d];return _0x1943c1;};'use strict';function Final(_0x139aff){this[_0x933e('0x0')]=_0x139aff['uniqueid'];this['scheduledat']=_0x139aff['scheduledat'];this[_0x933e('0x1')]=_0x139aff[_0x933e('0x1')];this[_0x933e('0x2')]=_0x139aff[_0x933e('0x1')]==='outbound'?_0x933e('0x3'):_0x139aff['type'];this['countbusyretry']=_0x139aff[_0x933e('0x4')];this[_0x933e('0x5')]=_0x139aff[_0x933e('0x5')];this['countnoanswerretry']=_0x139aff['countnoanswerretry'];this[_0x933e('0x6')]=_0x139aff['countbusyretry']+_0x139aff[_0x933e('0x5')]+_0x139aff['countnoanswerretry']+_0x139aff['countnosuchnumberretry']+_0x139aff[_0x933e('0x7')]+_0x139aff['countabandonedretry']+_0x139aff[_0x933e('0x8')]+_0x139aff[_0x933e('0x9')];this[_0x933e('0xa')]=_0x139aff[_0x933e('0xa')];this[_0x933e('0x7')]=_0x139aff[_0x933e('0x7')];this[_0x933e('0xb')]=_0x139aff[_0x933e('0xb')];this[_0x933e('0x8')]=_0x139aff[_0x933e('0x8')];this[_0x933e('0x9')]=_0x139aff[_0x933e('0x9')];this[_0x933e('0x3')]=_0x139aff[_0x933e('0x3')];this[_0x933e('0xc')]=_0x139aff['calleridname'];this[_0x933e('0xd')]=_0x139aff['calleridnum'];this['starttime']=_0x139aff['starttime'];this['responsetime']=_0x139aff[_0x933e('0xe')];this[_0x933e('0xf')]=_0x139aff[_0x933e('0xe')];this['ringtime']=_0x139aff[_0x933e('0x10')]||0x0;this['holdtime']=_0x139aff[_0x933e('0x11')]||0x0;this[_0x933e('0x12')]=_0x139aff['talktime']||0x0;this[_0x933e('0x13')]=_0x139aff[_0x933e('0x13')];this[_0x933e('0x14')]=_0x139aff[_0x933e('0x14')];this[_0x933e('0x15')]=_0x139aff[_0x933e('0x15')];this['recallme']=_0x139aff[_0x933e('0x16')];this[_0x933e('0x17')]=_0x139aff[_0x933e('0x17')];this[_0x933e('0x18')]=_0x139aff['ListId'];this[_0x933e('0x19')]=_0x139aff[_0x933e('0x19')];this[_0x933e('0x1a')]=_0x139aff['VoiceQueueId'];this['CampaignId']=_0x139aff[_0x933e('0x1b')];this[_0x933e('0x1c')]=_0x139aff['originatecalleridnum']||'';this[_0x933e('0x1d')]=_0x139aff['originatecalleridname']||'';this[_0x933e('0x1e')]=_0x139aff['state'];this[_0x933e('0x1f')]=_0x139aff['statedesc'];}module[_0x933e('0x20')]=Final; \ No newline at end of file +var _0xd4e6=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd4e6,0xfd));var _0x6d4e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xd4e6[_0x12d033];return _0x3b4e80;};'use strict';function Final(_0xef9183){this[_0x6d4e('0x0')]=_0xef9183[_0x6d4e('0x0')];this[_0x6d4e('0x1')]=_0xef9183[_0x6d4e('0x1')];this[_0x6d4e('0x2')]=_0xef9183[_0x6d4e('0x2')];this[_0x6d4e('0x3')]=_0xef9183[_0x6d4e('0x2')]===_0x6d4e('0x4')?_0x6d4e('0x5'):_0xef9183[_0x6d4e('0x2')];this['countbusyretry']=_0xef9183['countbusyretry'];this[_0x6d4e('0x6')]=_0xef9183[_0x6d4e('0x6')];this[_0x6d4e('0x7')]=_0xef9183[_0x6d4e('0x7')];this['countglobal']=_0xef9183[_0x6d4e('0x8')]+_0xef9183[_0x6d4e('0x6')]+_0xef9183[_0x6d4e('0x7')]+_0xef9183[_0x6d4e('0x9')]+_0xef9183[_0x6d4e('0xa')]+_0xef9183[_0x6d4e('0xb')]+_0xef9183[_0x6d4e('0xc')]+_0xef9183['countagentrejectretry'];this[_0x6d4e('0x9')]=_0xef9183[_0x6d4e('0x9')];this[_0x6d4e('0xa')]=_0xef9183[_0x6d4e('0xa')];this[_0x6d4e('0xb')]=_0xef9183[_0x6d4e('0xb')];this[_0x6d4e('0xc')]=_0xef9183[_0x6d4e('0xc')];this[_0x6d4e('0xd')]=_0xef9183[_0x6d4e('0xd')];this[_0x6d4e('0x5')]=_0xef9183[_0x6d4e('0x5')];this[_0x6d4e('0xe')]=_0xef9183[_0x6d4e('0xe')];this['calleridnum']=_0xef9183[_0x6d4e('0xf')];this['starttime']=_0xef9183[_0x6d4e('0x10')];this['responsetime']=_0xef9183['responsetime'];this['endtime']=_0xef9183['responsetime'];this[_0x6d4e('0x11')]=_0xef9183[_0x6d4e('0x11')]||0x0;this['holdtime']=_0xef9183[_0x6d4e('0x12')]||0x0;this[_0x6d4e('0x13')]=_0xef9183[_0x6d4e('0x13')]||0x0;this[_0x6d4e('0x14')]=_0xef9183[_0x6d4e('0x14')];this['callbackuniqueid']=_0xef9183['callbackuniqueid'];this['callbackat']=_0xef9183[_0x6d4e('0x15')];this[_0x6d4e('0x16')]=_0xef9183['recallme'];this[_0x6d4e('0x17')]=_0xef9183['ContactId'];this['ListId']=_0xef9183[_0x6d4e('0x18')];this[_0x6d4e('0x19')]=_0xef9183[_0x6d4e('0x19')];this['VoiceQueueId']=_0xef9183[_0x6d4e('0x1a')];this[_0x6d4e('0x1b')]=_0xef9183[_0x6d4e('0x1b')];this[_0x6d4e('0x1c')]=_0xef9183[_0x6d4e('0x1c')]||'';this[_0x6d4e('0x1d')]=_0xef9183['originatecalleridname']||'';this['state']=_0xef9183[_0x6d4e('0x1e')];this['statedesc']=_0xef9183[_0x6d4e('0x1f')];}module[_0x6d4e('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 127d812..a9ec3b4 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4620=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','getSeconds','endtime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x1dcc5d,_0x123a75){var _0x1f638e=function(_0x29e719){while(--_0x29e719){_0x1dcc5d['push'](_0x1dcc5d['shift']());}};_0x1f638e(++_0x123a75);}(_0x4620,0xb3));var _0x0462=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0x4620[_0x54ea7a];return _0x65a10d;};'use strict';var moment=require('moment');var utils=require(_0x0462('0x0'));function Hangup(_0x4cec67,_0x433dc8){this[_0x0462('0x1')]=0x4;this[_0x0462('0x2')]=_0x0462('0x3');this[_0x0462('0x4')]=_0x4cec67[_0x0462('0x4')];this[_0x0462('0x5')]=_0x4cec67['type'];this[_0x0462('0x6')]=_0x4cec67[_0x0462('0x5')]===_0x0462('0x7')?_0x0462('0x8'):_0x4cec67[_0x0462('0x5')];this[_0x0462('0x9')]=_0x4cec67[_0x0462('0x9')]||![];this[_0x0462('0xa')]=_0x4cec67[_0x0462('0xa')];this['countcongestionretry']=_0x4cec67['countcongestionretry'];this[_0x0462('0xb')]=_0x4cec67['countnoanswerretry'];this[_0x0462('0xc')]=_0x4cec67[_0x0462('0xa')]+_0x4cec67[_0x0462('0xd')]+_0x4cec67[_0x0462('0xb')]+_0x4cec67[_0x0462('0xe')]+_0x4cec67[_0x0462('0xf')]+_0x4cec67[_0x0462('0x10')]+_0x4cec67['countmachineretry']+_0x4cec67['countagentrejectretry'];this['countnosuchnumberretry']=_0x4cec67[_0x0462('0xe')];this[_0x0462('0xf')]=_0x4cec67[_0x0462('0xf')];this['countabandonedretry']=_0x4cec67[_0x0462('0x10')];this[_0x0462('0x11')]=_0x4cec67[_0x0462('0x11')];this[_0x0462('0x12')]=_0x4cec67[_0x0462('0x12')];this[_0x0462('0x13')]=_0x433dc8[_0x0462('0x13')];this[_0x0462('0x14')]=_0x4cec67['name'];this[_0x0462('0x15')]=_0x4cec67[_0x0462('0x16')];this['starttime']=_0x4cec67[_0x0462('0x17')];this[_0x0462('0x18')]=_0x4cec67[_0x0462('0x18')];this['endtime']=moment()['format'](_0x0462('0x19'));this['ringtime']=utils['getSeconds'](_0x4cec67[_0x0462('0x18')],_0x4cec67['starttime']);this[_0x0462('0x1a')]=0x0;this[_0x0462('0x1b')]=utils[_0x0462('0x1c')](this[_0x0462('0x1d')],_0x4cec67[_0x0462('0x18')]);this[_0x0462('0x8')]=_0x4cec67['queue'];this[_0x0462('0x1e')]='IVR';this[_0x0462('0x1f')]=_0x433dc8[_0x0462('0x20')];this['callback']=_0x4cec67[_0x0462('0x21')];this[_0x0462('0x22')]=_0x4cec67[_0x0462('0x22')];this[_0x0462('0x23')]=_0x4cec67[_0x0462('0x23')];this[_0x0462('0x24')]=_0x4cec67[_0x0462('0x24')];this['ContactId']=_0x4cec67[_0x0462('0x25')];this[_0x0462('0x26')]=_0x4cec67[_0x0462('0x26')];this[_0x0462('0x27')]=_0x4cec67[_0x0462('0x27')];this[_0x0462('0x28')]=_0x4cec67[_0x0462('0x28')];this[_0x0462('0x29')]=_0x4cec67[_0x0462('0x29')];}module[_0x0462('0x2a')]=Hangup; \ No newline at end of file +var _0xbbaa=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0xa9abef,_0x4a48ea){var _0x10f346=function(_0x407704){while(--_0x407704){_0xa9abef['push'](_0xa9abef['shift']());}};_0x10f346(++_0x4a48ea);}(_0xbbaa,0x1ee));var _0xabba=function(_0x26c4c4,_0x2f22c5){_0x26c4c4=_0x26c4c4-0x0;var _0x3804dc=_0xbbaa[_0x26c4c4];return _0x3804dc;};'use strict';var moment=require(_0xabba('0x0'));var utils=require('../utils');function Hangup(_0x1b7a00,_0x595948){this['state']=0x4;this[_0xabba('0x1')]=_0xabba('0x2');this[_0xabba('0x3')]=_0x1b7a00['scheduledat'];this[_0xabba('0x4')]=_0x1b7a00[_0xabba('0x4')];this['campaigntype']=_0x1b7a00['type']===_0xabba('0x5')?_0xabba('0x6'):_0x1b7a00[_0xabba('0x4')];this['amd']=_0x1b7a00[_0xabba('0x7')]||![];this[_0xabba('0x8')]=_0x1b7a00['countbusyretry'];this[_0xabba('0x9')]=_0x1b7a00['countcongestionretry'];this[_0xabba('0xa')]=_0x1b7a00[_0xabba('0xa')];this[_0xabba('0xb')]=_0x1b7a00[_0xabba('0x8')]+_0x1b7a00[_0xabba('0x9')]+_0x1b7a00[_0xabba('0xa')]+_0x1b7a00[_0xabba('0xc')]+_0x1b7a00[_0xabba('0xd')]+_0x1b7a00[_0xabba('0xe')]+_0x1b7a00[_0xabba('0xf')]+_0x1b7a00[_0xabba('0x10')];this[_0xabba('0xc')]=_0x1b7a00[_0xabba('0xc')];this['countdropretry']=_0x1b7a00[_0xabba('0xd')];this[_0xabba('0xe')]=_0x1b7a00[_0xabba('0xe')];this['countmachineretry']=_0x1b7a00[_0xabba('0xf')];this['countagentrejectretry']=_0x1b7a00['countagentrejectretry'];this['uniqueid']=_0x595948[_0xabba('0x11')];this[_0xabba('0x12')]=_0x1b7a00['name'];this[_0xabba('0x13')]=_0x1b7a00[_0xabba('0x14')];this[_0xabba('0x15')]=_0x1b7a00[_0xabba('0x15')];this[_0xabba('0x16')]=_0x1b7a00[_0xabba('0x16')];this[_0xabba('0x17')]=moment()['format'](_0xabba('0x18'));this[_0xabba('0x19')]=utils['getSeconds'](_0x1b7a00[_0xabba('0x16')],_0x1b7a00[_0xabba('0x15')]);this['holdtime']=0x0;this['talktime']=utils[_0xabba('0x1a')](this[_0xabba('0x17')],_0x1b7a00['responsetime']);this[_0xabba('0x6')]=_0x1b7a00[_0xabba('0x6')];this[_0xabba('0x1b')]='IVR';this['reason']=_0x595948[_0xabba('0x1c')];this['callback']=_0x1b7a00[_0xabba('0x1d')];this[_0xabba('0x1e')]=_0x1b7a00['callbackuniqueid'];this['callbackat']=_0x1b7a00[_0xabba('0x1f')];this[_0xabba('0x20')]=_0x1b7a00['recallme'];this[_0xabba('0x21')]=_0x1b7a00[_0xabba('0x21')];this['ListId']=_0x1b7a00[_0xabba('0x22')];this[_0xabba('0x23')]=_0x1b7a00[_0xabba('0x23')];this[_0xabba('0x24')]=_0x1b7a00[_0xabba('0x24')];this[_0xabba('0x25')]=_0x1b7a00[_0xabba('0x25')];}module[_0xabba('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 019e59a..cbd8249 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x670a=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','campaigntype','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2ebc59,_0x573404){var _0x3503a8=function(_0x3f4457){while(--_0x3f4457){_0x2ebc59['push'](_0x2ebc59['shift']());}};_0x3503a8(++_0x573404);}(_0x670a,0x1d7));var _0xa670=function(_0x5b7bf1,_0x413f7f){_0x5b7bf1=_0x5b7bf1-0x0;var _0x3d31c0=_0x670a[_0x5b7bf1];return _0x3d31c0;};'use strict';var utils=require(_0xa670('0x0'));function History(_0x19b109){this['uniqueid']=_0x19b109[_0xa670('0x1')];this[_0xa670('0x2')]=_0x19b109[_0xa670('0x2')]||undefined;this['type']=_0x19b109['type'];this[_0xa670('0x3')]=_0x19b109[_0xa670('0x4')]===_0xa670('0x5')?'queue':_0x19b109[_0xa670('0x4')];this[_0xa670('0x6')]=_0x19b109['countbusyretry'];this['countcongestionretry']=_0x19b109[_0xa670('0x7')];this['countnoanswerretry']=_0x19b109[_0xa670('0x8')];this[_0xa670('0x9')]=_0x19b109[_0xa670('0x6')]+_0x19b109[_0xa670('0x7')]+_0x19b109[_0xa670('0x8')]+_0x19b109['countnosuchnumberretry']+_0x19b109[_0xa670('0xa')]+_0x19b109[_0xa670('0xb')]+_0x19b109[_0xa670('0xc')]+_0x19b109[_0xa670('0xd')];this[_0xa670('0xe')]=_0x19b109[_0xa670('0xe')];this[_0xa670('0xa')]=_0x19b109[_0xa670('0xa')];this[_0xa670('0xb')]=_0x19b109['countabandonedretry'];this[_0xa670('0xc')]=_0x19b109[_0xa670('0xc')];this[_0xa670('0xd')]=_0x19b109['countagentrejectretry'];this[_0xa670('0xf')]=_0x19b109['queue'];this['calleridname']=_0x19b109[_0xa670('0x10')];this[_0xa670('0x11')]=_0x19b109[_0xa670('0x12')];this[_0xa670('0x13')]=_0x19b109[_0xa670('0x13')];this[_0xa670('0x14')]=_0x19b109['responsetime'];this['endtime']=_0x19b109[_0xa670('0x14')];this[_0xa670('0x15')]=utils[_0xa670('0x16')](_0x19b109['responsetime'],_0x19b109[_0xa670('0x13')]);this['holdtime']=0x0;this[_0xa670('0x17')]=0x0;this[_0xa670('0x18')]=_0x19b109[_0xa670('0x18')];this[_0xa670('0x19')]=_0x19b109[_0xa670('0x19')];this['callbackat']=_0x19b109['callbackat'];this[_0xa670('0x1a')]=_0x19b109[_0xa670('0x1a')];this[_0xa670('0x1b')]=_0x19b109[_0xa670('0x1b')];this['ListId']=_0x19b109[_0xa670('0x1c')];this['UserId']=_0x19b109[_0xa670('0x1d')];this[_0xa670('0x1e')]=_0x19b109[_0xa670('0x1e')];this[_0xa670('0x1f')]=_0x19b109[_0xa670('0x1f')];this['originatecalleridnum']=_0x19b109[_0xa670('0x20')]||'';this[_0xa670('0x21')]=_0x19b109['originatecalleridname']||'';this[_0xa670('0x22')]=_0x19b109[_0xa670('0x22')];this[_0xa670('0x23')]=_0x19b109['statedesc'];}module[_0xa670('0x24')]=History; \ No newline at end of file +var _0x8a0f=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x8a0f,0x1b4));var _0xf8a0=function(_0x4a465e,_0x2b5398){_0x4a465e=_0x4a465e-0x0;var _0x2a7a4b=_0x8a0f[_0x4a465e];return _0x2a7a4b;};'use strict';var utils=require('../utils');function History(_0x5eedb6){this[_0xf8a0('0x0')]=_0x5eedb6[_0xf8a0('0x0')];this[_0xf8a0('0x1')]=_0x5eedb6['scheduledat']||undefined;this['type']=_0x5eedb6[_0xf8a0('0x2')];this['campaigntype']=_0x5eedb6[_0xf8a0('0x2')]===_0xf8a0('0x3')?'queue':_0x5eedb6[_0xf8a0('0x2')];this[_0xf8a0('0x4')]=_0x5eedb6[_0xf8a0('0x4')];this[_0xf8a0('0x5')]=_0x5eedb6['countcongestionretry'];this[_0xf8a0('0x6')]=_0x5eedb6[_0xf8a0('0x6')];this[_0xf8a0('0x7')]=_0x5eedb6[_0xf8a0('0x4')]+_0x5eedb6[_0xf8a0('0x5')]+_0x5eedb6[_0xf8a0('0x6')]+_0x5eedb6[_0xf8a0('0x8')]+_0x5eedb6[_0xf8a0('0x9')]+_0x5eedb6[_0xf8a0('0xa')]+_0x5eedb6[_0xf8a0('0xb')]+_0x5eedb6[_0xf8a0('0xc')];this['countnosuchnumberretry']=_0x5eedb6[_0xf8a0('0x8')];this[_0xf8a0('0x9')]=_0x5eedb6[_0xf8a0('0x9')];this['countabandonedretry']=_0x5eedb6[_0xf8a0('0xa')];this[_0xf8a0('0xb')]=_0x5eedb6[_0xf8a0('0xb')];this[_0xf8a0('0xc')]=_0x5eedb6['countagentrejectretry'];this['queue']=_0x5eedb6['queue'];this[_0xf8a0('0xd')]=_0x5eedb6['name'];this[_0xf8a0('0xe')]=_0x5eedb6[_0xf8a0('0xf')];this[_0xf8a0('0x10')]=_0x5eedb6[_0xf8a0('0x10')];this[_0xf8a0('0x11')]=_0x5eedb6[_0xf8a0('0x11')];this[_0xf8a0('0x12')]=_0x5eedb6[_0xf8a0('0x11')];this[_0xf8a0('0x13')]=utils[_0xf8a0('0x14')](_0x5eedb6['responsetime'],_0x5eedb6[_0xf8a0('0x10')]);this[_0xf8a0('0x15')]=0x0;this[_0xf8a0('0x16')]=0x0;this['callback']=_0x5eedb6[_0xf8a0('0x17')];this[_0xf8a0('0x18')]=_0x5eedb6[_0xf8a0('0x18')];this[_0xf8a0('0x19')]=_0x5eedb6['callbackat'];this[_0xf8a0('0x1a')]=_0x5eedb6['recallme'];this[_0xf8a0('0x1b')]=_0x5eedb6['ContactId'];this[_0xf8a0('0x1c')]=_0x5eedb6[_0xf8a0('0x1c')];this[_0xf8a0('0x1d')]=_0x5eedb6[_0xf8a0('0x1d')];this['VoiceQueueId']=_0x5eedb6[_0xf8a0('0x1e')];this[_0xf8a0('0x1f')]=_0x5eedb6['CampaignId'];this[_0xf8a0('0x20')]=_0x5eedb6[_0xf8a0('0x20')]||'';this['originatecalleridname']=_0x5eedb6[_0xf8a0('0x21')]||'';this[_0xf8a0('0x22')]=_0x5eedb6['state'];this[_0xf8a0('0x23')]=_0x5eedb6['statedesc'];}module[_0xf8a0('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index a3dab49..5011703 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc19b=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x3f1e3a,_0x269acf){var _0x1d0eb2=function(_0x54e784){while(--_0x54e784){_0x3f1e3a['push'](_0x3f1e3a['shift']());}};_0x1d0eb2(++_0x269acf);}(_0xc19b,0xbb));var _0xbc19=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xc19b[_0x2d61b2];return _0x12df89;};'use strict';var utils=require(_0xbc19('0x0'));function QueueCallerAbandon(_0xe6237b,_0x509ba3){this[_0xbc19('0x1')]=_0xe6237b[_0xbc19('0x1')];this[_0xbc19('0x2')]=_0xe6237b[_0xbc19('0x2')];this[_0xbc19('0x3')]=_0xe6237b['type']===_0xbc19('0x4')?_0xbc19('0x5'):_0xe6237b[_0xbc19('0x2')];this[_0xbc19('0x6')]=_0xe6237b['countbusyretry'];this[_0xbc19('0x7')]=_0xe6237b[_0xbc19('0x7')];this[_0xbc19('0x8')]=_0xe6237b[_0xbc19('0x8')];this[_0xbc19('0x9')]=_0xe6237b[_0xbc19('0x6')]+_0xe6237b[_0xbc19('0x7')]+_0xe6237b[_0xbc19('0x8')]+_0xe6237b[_0xbc19('0xa')]+_0xe6237b['countdropretry']+_0xe6237b[_0xbc19('0xb')]+_0xe6237b[_0xbc19('0xc')]+_0xe6237b['countagentrejectretry'];this['countnosuchnumberretry']=_0xe6237b['countnosuchnumberretry'];this[_0xbc19('0xd')]=_0xe6237b['countdropretry'];this['countabandonedretry']=_0xe6237b['countabandonedretry'];this[_0xbc19('0xc')]=_0xe6237b[_0xbc19('0xc')];this[_0xbc19('0xe')]=_0xe6237b[_0xbc19('0xe')];this[_0xbc19('0xf')]=_0x509ba3['uniqueid'];this[_0xbc19('0x10')]=_0xe6237b['name'];this[_0xbc19('0x11')]=_0xe6237b[_0xbc19('0x12')];this['starttime']=_0xe6237b[_0xbc19('0x13')];this[_0xbc19('0x14')]=_0xe6237b[_0xbc19('0x14')];this['droptime']=_0xe6237b[_0xbc19('0x15')];this[_0xbc19('0x16')]=_0xe6237b[_0xbc19('0x16')];this[_0xbc19('0x17')]=this['droptime'];this[_0xbc19('0x18')]=utils[_0xbc19('0x19')](_0xe6237b['responsetime'],_0xe6237b[_0xbc19('0x13')]);this[_0xbc19('0x1a')]=utils[_0xbc19('0x19')](this[_0xbc19('0x15')],_0xe6237b[_0xbc19('0x14')]);this['talktime']=0x0;this[_0xbc19('0x5')]=_0x509ba3[_0xbc19('0x5')];this[_0xbc19('0x1b')]=_0x509ba3[_0xbc19('0x1c')];this[_0xbc19('0x1d')]=_0x509ba3['reason'];this['callback']=_0xe6237b[_0xbc19('0x1e')];this[_0xbc19('0x1f')]=_0xe6237b[_0xbc19('0x1f')];this[_0xbc19('0x20')]=_0xe6237b[_0xbc19('0x20')];this[_0xbc19('0x21')]=_0xe6237b[_0xbc19('0x21')];this[_0xbc19('0x22')]=_0xe6237b['ContactId'];this[_0xbc19('0x23')]=_0xe6237b[_0xbc19('0x23')];this[_0xbc19('0x24')]=_0xe6237b[_0xbc19('0x24')];this[_0xbc19('0x25')]=_0xe6237b[_0xbc19('0x25')];this[_0xbc19('0x26')]=_0xe6237b[_0xbc19('0x26')];this[_0xbc19('0x27')]=_0xe6237b[_0xbc19('0x27')]||'';this['originatecalleridname']=_0xe6237b['originatecalleridname']||'';this['agiafterat']=_0xe6237b[_0xbc19('0x28')];this['state']=_0xe6237b[_0xbc19('0x29')];this['statedesc']=_0xe6237b[_0xbc19('0x2a')];}module[_0xbc19('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xe018=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xe018,0xc9));var _0x8e01=function(_0x206d5a,_0x320dad){_0x206d5a=_0x206d5a-0x0;var _0x576110=_0xe018[_0x206d5a];return _0x576110;};'use strict';var utils=require(_0x8e01('0x0'));function QueueCallerAbandon(_0x434540,_0x403904){this['scheduledat']=_0x434540[_0x8e01('0x1')];this['type']=_0x434540[_0x8e01('0x2')];this[_0x8e01('0x3')]=_0x434540['type']==='outbound'?_0x8e01('0x4'):_0x434540[_0x8e01('0x2')];this['countbusyretry']=_0x434540[_0x8e01('0x5')];this[_0x8e01('0x6')]=_0x434540[_0x8e01('0x6')];this[_0x8e01('0x7')]=_0x434540[_0x8e01('0x7')];this[_0x8e01('0x8')]=_0x434540[_0x8e01('0x5')]+_0x434540['countcongestionretry']+_0x434540[_0x8e01('0x7')]+_0x434540[_0x8e01('0x9')]+_0x434540[_0x8e01('0xa')]+_0x434540[_0x8e01('0xb')]+_0x434540[_0x8e01('0xc')]+_0x434540['countagentrejectretry'];this['countnosuchnumberretry']=_0x434540[_0x8e01('0x9')];this[_0x8e01('0xa')]=_0x434540[_0x8e01('0xa')];this[_0x8e01('0xb')]=_0x434540[_0x8e01('0xb')];this[_0x8e01('0xc')]=_0x434540[_0x8e01('0xc')];this[_0x8e01('0xd')]=_0x434540[_0x8e01('0xd')];this[_0x8e01('0xe')]=_0x403904['uniqueid'];this[_0x8e01('0xf')]=_0x434540[_0x8e01('0x10')];this[_0x8e01('0x11')]=_0x434540['number'];this['starttime']=_0x434540[_0x8e01('0x12')];this[_0x8e01('0x13')]=_0x434540['responsetime'];this[_0x8e01('0x14')]=_0x434540[_0x8e01('0x14')];this[_0x8e01('0x15')]=_0x434540[_0x8e01('0x15')];this['endtime']=this['droptime'];this[_0x8e01('0x16')]=utils['getSeconds'](_0x434540['responsetime'],_0x434540[_0x8e01('0x12')]);this[_0x8e01('0x17')]=utils[_0x8e01('0x18')](this[_0x8e01('0x14')],_0x434540[_0x8e01('0x13')]);this[_0x8e01('0x19')]=0x0;this[_0x8e01('0x4')]=_0x403904['queue'];this[_0x8e01('0x1a')]=_0x403904[_0x8e01('0x1b')];this[_0x8e01('0x1c')]=_0x403904[_0x8e01('0x1c')];this[_0x8e01('0x1d')]=_0x434540[_0x8e01('0x1d')];this[_0x8e01('0x1e')]=_0x434540[_0x8e01('0x1e')];this['callbackat']=_0x434540[_0x8e01('0x1f')];this['recallme']=_0x434540['recallme'];this[_0x8e01('0x20')]=_0x434540['ContactId'];this['ListId']=_0x434540['ListId'];this[_0x8e01('0x21')]=_0x434540[_0x8e01('0x21')];this[_0x8e01('0x22')]=_0x434540[_0x8e01('0x22')];this['CampaignId']=_0x434540[_0x8e01('0x23')];this['originatecalleridnum']=_0x434540[_0x8e01('0x24')]||'';this[_0x8e01('0x25')]=_0x434540[_0x8e01('0x25')]||'';this[_0x8e01('0x26')]=_0x434540['agiafterat'];this[_0x8e01('0x27')]=_0x434540['state'];this[_0x8e01('0x28')]=_0x434540[_0x8e01('0x28')];}module[_0x8e01('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 44e551d..a54f934 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0424=['../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialerIvr]','getContactDialerIvr','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone'];(function(_0x5e1a75,_0x1bc259){var _0x233634=function(_0x41b6ba){while(--_0x41b6ba){_0x5e1a75['push'](_0x5e1a75['shift']());}};_0x233634(++_0x1bc259);}(_0x0424,0x159));var _0x4042=function(_0x39fe3f,_0x38b8eb){_0x39fe3f=_0x39fe3f-0x0;var _0x50d483=_0x0424[_0x39fe3f];return _0x50d483;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x4042('0x0'));var cmHopper=require(_0x4042('0x1'));var cmHopperAdditionalPhone=require(_0x4042('0x2'));var cmHopperBlack=require(_0x4042('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x3cd879){return util['inspect'](_0x3cd879,{'showHidden':![],'depth':null});}function getContactDialer(_0x491eae,_0x20d8df,_0x24fdfd){return cmHopper[_0x4042('0x4')](_0x491eae['id'],_0x20d8df,_0x24fdfd,_0x491eae[_0x4042('0x5')])[_0x4042('0x6')](function(_0xa5310f){_0x491eae[_0x4042('0x7')]=0x0;logger['error']('[getContactDialer]',inspectError(_0xa5310f));});}exports[_0x4042('0x4')]=getContactDialer;function getContactDialerIvr(_0x117143,_0x103e4a){return cmHopper['getContactDialerIvr'](_0x117143['id'],_0x103e4a,_0x117143[_0x4042('0x5')])[_0x4042('0x6')](function(_0x2376a4){_0x117143[_0x4042('0x7')]=0x0;logger[_0x4042('0x8')](_0x4042('0x9'),inspectError(_0x2376a4));});}exports[_0x4042('0xa')]=getContactDialerIvr;function countReScheduled(_0x3b5a73){return cmHopper['countReScheduled'](_0x3b5a73)[_0x4042('0x6')](function(_0x357838){logger['error'](_0x4042('0xb'),inspectError(_0x357838));});}exports[_0x4042('0xc')]=countReScheduled;function rescheduleContact(_0x3e876b){return cmHopper[_0x4042('0xd')](_0x3e876b)[_0x4042('0x6')](function(_0x1ff3ca){logger[_0x4042('0x8')]('[rescheduleContact]',inspectError(_0x1ff3ca));});}exports[_0x4042('0xd')]=rescheduleContact;function unlockContact(_0x291e5c,_0x50206f,_0x28087d){return cmHopper[_0x4042('0xe')](_0x291e5c,_0x50206f,_0x28087d)[_0x4042('0x6')](function(_0x1c3328){logger[_0x4042('0x8')](_0x4042('0xf'),inspectError(_0x1c3328));});}exports[_0x4042('0xe')]=unlockContact;function moveContactManagedDialer(_0x10cb93){return cmHopper[_0x4042('0x10')](_0x10cb93)['catch'](function(_0xe5c1ec){logger['error'](_0x4042('0x11'),inspectError(_0xe5c1ec));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xca9ca6){return cmHopperBlack[_0x4042('0x12')](_0xca9ca6)[_0x4042('0x6')](function(_0x2cd5ca){logger['error'](_0x4042('0x13'),inspectError(_0x2cd5ca));});}exports[_0x4042('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x14d36c){return cmHopperBlack[_0x4042('0x14')](_0x14d36c)['catch'](function(_0x42b518){logger[_0x4042('0x8')](_0x4042('0x15'),inspectError(_0x42b518));});}exports[_0x4042('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x352631,_0x548093,_0x1f9d4a){return cmHopperAdditionalPhone[_0x4042('0x16')](_0x352631,_0x548093,_0x1f9d4a)['catch'](function(_0x1daee8){logger['error'](_0x4042('0x17'),inspectError(_0x1daee8));});}exports[_0x4042('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3f5a64,_0x5d5c6d,_0x461c5e){return cmHopperAdditionalPhone[_0x4042('0x18')](_0x3f5a64,_0x5d5c6d,_0x461c5e)[_0x4042('0x6')](function(_0xbdadc8){logger[_0x4042('0x8')]('[swapAdditionalPhone]',inspectError(_0xbdadc8));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1d8d48){return cmHopperHistory[_0x4042('0x19')](_0x1d8d48)[_0x4042('0x6')](function(_0x3e5c02){logger[_0x4042('0x8')](_0x4042('0x1a'),inspectError(_0x3e5c02));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x33733b){return cmHopperHistory[_0x4042('0x1b')](_0x33733b)['catch'](function(_0xae26c2){logger[_0x4042('0x8')](_0x4042('0x1c'),inspectError(_0xae26c2));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xadb5=['countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]'];(function(_0x13f91f,_0x387803){var _0x6d49b0=function(_0x4a8afa){while(--_0x4a8afa){_0x13f91f['push'](_0x13f91f['shift']());}};_0x6d49b0(++_0x387803);}(_0xadb5,0xad));var _0x5adb=function(_0x5e5af0,_0x3e6709){_0x5e5af0=_0x5e5af0-0x0;var _0x277fb1=_0xadb5[_0x5e5af0];return _0x277fb1;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('dialer');var cmHopper=require(_0x5adb('0x1'));var cmHopperAdditionalPhone=require(_0x5adb('0x2'));var cmHopperBlack=require(_0x5adb('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x248dc6){return util[_0x5adb('0x4')](_0x248dc6,{'showHidden':![],'depth':null});}function getContactDialer(_0x2e3ef4,_0x4cb1d1,_0x35a5d3){return cmHopper[_0x5adb('0x5')](_0x2e3ef4['id'],_0x4cb1d1,_0x35a5d3,_0x2e3ef4[_0x5adb('0x6')])[_0x5adb('0x7')](function(_0xdf3776){_0x2e3ef4[_0x5adb('0x8')]=0x0;logger[_0x5adb('0x9')](_0x5adb('0xa'),inspectError(_0xdf3776));});}exports[_0x5adb('0x5')]=getContactDialer;function getContactDialerIvr(_0x7293ab,_0x34f59d){return cmHopper[_0x5adb('0xb')](_0x7293ab['id'],_0x34f59d,_0x7293ab[_0x5adb('0x6')])[_0x5adb('0x7')](function(_0x563d86){_0x7293ab['temp']=0x0;logger[_0x5adb('0x9')](_0x5adb('0xc'),inspectError(_0x563d86));});}exports[_0x5adb('0xb')]=getContactDialerIvr;function countReScheduled(_0x53b772){return cmHopper[_0x5adb('0xd')](_0x53b772)['catch'](function(_0x2a0b70){logger['error'](_0x5adb('0xe'),inspectError(_0x2a0b70));});}exports[_0x5adb('0xd')]=countReScheduled;function rescheduleContact(_0x44abe3){return cmHopper['rescheduleContact'](_0x44abe3)[_0x5adb('0x7')](function(_0x34af2c){logger[_0x5adb('0x9')]('[rescheduleContact]',inspectError(_0x34af2c));});}exports[_0x5adb('0xf')]=rescheduleContact;function unlockContact(_0x518823,_0x367d82,_0x42a482){return cmHopper[_0x5adb('0x10')](_0x518823,_0x367d82,_0x42a482)[_0x5adb('0x7')](function(_0x1c0f97){logger[_0x5adb('0x9')](_0x5adb('0x11'),inspectError(_0x1c0f97));});}exports[_0x5adb('0x10')]=unlockContact;function moveContactManagedDialer(_0xb953a6){return cmHopper['moveContactManagedDialer'](_0xb953a6)[_0x5adb('0x7')](function(_0x5de028){logger[_0x5adb('0x9')]('[moveContactManagedDialer]',inspectError(_0x5de028));});}exports[_0x5adb('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x50e84f){return cmHopperBlack['checkIsBlackList'](_0x50e84f)[_0x5adb('0x7')](function(_0x1bed20){logger[_0x5adb('0x9')](_0x5adb('0x13'),inspectError(_0x1bed20));});}exports[_0x5adb('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x5af69d){return cmHopperBlack[_0x5adb('0x15')](_0x5af69d)['catch'](function(_0x4e9f16){logger[_0x5adb('0x9')](_0x5adb('0x16'),inspectError(_0x4e9f16));});}exports[_0x5adb('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1a8014,_0x1e9ccf,_0x413911){return cmHopperAdditionalPhone[_0x5adb('0x17')](_0x1a8014,_0x1e9ccf,_0x413911)['catch'](function(_0x4b1957){logger[_0x5adb('0x9')](_0x5adb('0x18'),inspectError(_0x4b1957));});}exports[_0x5adb('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xeb556c,_0x49f203,_0x2fee18){return cmHopperAdditionalPhone[_0x5adb('0x19')](_0xeb556c,_0x49f203,_0x2fee18)['catch'](function(_0x1feecf){logger[_0x5adb('0x9')](_0x5adb('0x1a'),inspectError(_0x1feecf));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x13ad1d){return cmHopperHistory[_0x5adb('0x1b')](_0x13ad1d)[_0x5adb('0x7')](function(_0x2c64a3){logger[_0x5adb('0x9')](_0x5adb('0x1c'),inspectError(_0x2c64a3));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x49992e){return cmHopperHistory['createHistory'](_0x49992e)[_0x5adb('0x7')](function(_0x1eac55){logger[_0x5adb('0x9')](_0x5adb('0x1d'),inspectError(_0x1eac55));});}exports[_0x5adb('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index c6fc883..25cdb71 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27b1=['decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','description','XMD-','toUpperCase','substring','setXMDContactVariables','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','active','milliseconds','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error'];(function(_0x5b33c7,_0x4bb8c5){var _0x20dd87=function(_0x45e768){while(--_0x45e768){_0x5b33c7['push'](_0x5b33c7['shift']());}};_0x20dd87(++_0x4bb8c5);}(_0x27b1,0xb4));var _0x127b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x27b1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x127b('0x0'));var util=require(_0x127b('0x1'));var logger=require(_0x127b('0x2'))('dialer');var timezones=require(_0x127b('0x3'))[_0x127b('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x127b('0x5'),'BLACKLIST':_0x127b('0x6'),'CONTACTS_RESCHEDULED':_0x127b('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x127b('0x8'),'EMPTY_INTERVAL':_0x127b('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x127b('0xa'),'NULL_INTERVAL':_0x127b('0xb'),'OVERTIME_INTERVAL':_0x127b('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x127b('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x127b('0xe'),'UNKNOWN_TIMEZONE':_0x127b('0xf'),'UNREACHABLE_TRUNK':_0x127b('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5d5fe9){return _0x5d5fe9[_0x127b('0x11')]==='preview';}exports[_0x127b('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x449fd3){return _0x449fd3['type']===_0x127b('0x13');}exports[_0x127b('0x14')]=isIVRCampaign;function isOutboundQueue(_0x180f81){return _0x180f81[_0x127b('0x15')]===_0x127b('0x16');}exports[_0x127b('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x3bb81f){return _0x3bb81f['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x50b276){return _0x50b276[_0x127b('0x18')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x530b2b,_0x4f295e){var _0x17c619=moment(_0x530b2b)[_0x127b('0x19')](0x0);var _0x3e696b=moment(_0x4f295e)[_0x127b('0x19')](0x0);return _0x17c619['diff'](_0x3e696b,_0x127b('0x1a'));}exports[_0x127b('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x18ffa8,_0x5a04cc){var _0x24f150=![];var _0x60e3fc=_0x18ffa8['dialMethod']!==_0x5a04cc['dialMethod']||_0x18ffa8['dialActive']!==_0x5a04cc[_0x127b('0x1c')]||_0x18ffa8[_0x127b('0x1d')]!==_0x5a04cc[_0x127b('0x1d')];var _0x1a0977=_0x18ffa8[_0x127b('0x1e')]!==_0x5a04cc[_0x127b('0x1e')]||_0x18ffa8[_0x127b('0x1f')]!==_0x5a04cc[_0x127b('0x1f')]||_0x18ffa8[_0x127b('0x20')]!==_0x5a04cc[_0x127b('0x20')]||_0x18ffa8[_0x127b('0x21')]!==_0x5a04cc['paused']||_0x18ffa8[_0x127b('0x22')]!==_0x5a04cc['talking']||_0x18ffa8[_0x127b('0x23')]!==_0x5a04cc['pTalking']||_0x18ffa8[_0x127b('0x24')]!==_0x5a04cc['waiting']||_0x18ffa8[_0x127b('0x25')]!==_0x5a04cc[_0x127b('0x25')]||_0x18ffa8[_0x127b('0x26')]!==_0x5a04cc[_0x127b('0x26')];if(_0x18ffa8[_0x127b('0x27')]&&_0x5a04cc['Trunk']){_0x24f150=_0x18ffa8[_0x127b('0x27')]['name']!==_0x5a04cc[_0x127b('0x27')][_0x127b('0x28')]||_0x18ffa8['Trunk'][_0x127b('0x18')]!==_0x5a04cc[_0x127b('0x27')][_0x127b('0x18')];}return _0x60e3fc||_0x1a0977||_0x24f150;}exports[_0x127b('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x41d335){var _0x1d59b7=null;var _0xb78fa1=_0x41d335[_0x127b('0x2a')];if(_[_0x127b('0x2b')](_0x41d335[_0x127b('0x2c')])||_['isNil'](_0x41d335[_0x127b('0x2d')])||_[_0x127b('0x2b')](_0x41d335[_0x127b('0x2d')]['Intervals'])){_0x1d59b7=CAMPAIGN_STATUS[_0x127b('0x2e')];}else if(_[_0x127b('0x2f')](_0x41d335[_0x127b('0x2c')])||_[_0x127b('0x2f')](_0x41d335[_0x127b('0x2d')][_0x127b('0x30')])){_0x1d59b7=CAMPAIGN_STATUS[_0x127b('0x31')];}else if(_0xb78fa1&&!timezones[_0xb78fa1]){_0x1d59b7=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x1d59b7;}function checkAnyValidTrunk(_0x2f8f91,_0x50c034){var _0x4aad3c=null;var _0x119dec=_0x127b('0x32');var _0x5ad3f5=[_0x127b('0x33'),'unmonitored'];var _0x1b830a=!![];if(_0x2f8f91[_0x127b('0x27')]&&_0x2f8f91[_0x127b('0x27')][_0x127b('0x18')]){_0x119dec+=_0x2f8f91[_0x127b('0x27')][_0x127b('0x28')];_0x4aad3c=_0x50c034[_0x119dec];_0x1b830a=_0x5ad3f5[_0x127b('0x34')](_0x4aad3c[_0x127b('0x35')]);}else if(_0x2f8f91[_0x127b('0x36')]&&_0x2f8f91['TrunkBackup'][_0x127b('0x18')]){_0x119dec+=_0x2f8f91[_0x127b('0x36')][_0x127b('0x28')];_0x4aad3c=_0x50c034[_0x119dec];_0x1b830a=_0x5ad3f5[_0x127b('0x34')](_0x4aad3c[_0x127b('0x35')]);}return _0x1b830a;}function getQueueCampaignStatusMessage(_0x2d2ec9,_0x59f725){var _0x122d84=CAMPAIGN_STATUS['ACTIVE'];var _0x7278c1=isPreviewCampaign(_0x2d2ec9);if(!isQueueCampaignActive(_0x2d2ec9)){if(_0x7278c1){_0x122d84=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2d2ec9[_0x127b('0x26')]===0x0&&_0x2d2ec9[_0x127b('0x22')]===0x0&&_0x2d2ec9['waiting']===0x0&&(_0x2d2ec9[_0x127b('0x23')]||0x0)===0x0){_0x122d84=CAMPAIGN_STATUS[_0x127b('0x37')];}else{_0x122d84=CAMPAIGN_STATUS[_0x127b('0x38')];}}}else if(_0x2d2ec9[_0x127b('0x1f')]===0x0){_0x122d84=CAMPAIGN_STATUS[_0x127b('0x39')];}else if(!checkAnyValidTrunk(_0x2d2ec9,_0x59f725)){_0x122d84=CAMPAIGN_STATUS[_0x127b('0x3a')];}else if(!isPreviewCampaign(_0x2d2ec9)){var _0x5a42ee=checkAnyValidQueueCampaignInterval(_0x2d2ec9);if(_0x5a42ee){_0x122d84=_0x5a42ee;}}return _0x122d84;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1260f9){var _0x1e8242=CAMPAIGN_STATUS[_0x127b('0x38')];if(_0x1260f9[_0x127b('0x26')]===0x0&&_0x1260f9[_0x127b('0x22')]===0x0&&_0x1260f9[_0x127b('0x24')]===0x0&&(_0x1260f9[_0x127b('0x23')]||0x0)===0x0){_0x1e8242=CAMPAIGN_STATUS[_0x127b('0x37')];}return _0x1e8242;}exports[_0x127b('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5a5ddb){var _0x48e5b2=_0x5a5ddb['match'](/"(.*?)"/);return _0x48e5b2?_0x48e5b2[0x1]:_0x5a5ddb;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x363f31,_0x1637ea,_0x1b319a){if(!_[_0x127b('0x3c')](_0x1b319a)&&typeof _0x1b319a===_0x127b('0x3d')&&!_[_0x127b('0x2f')](_0x1b319a)){if(!_['isUndefined'](_0x1637ea)&&typeof _0x1637ea===_0x127b('0x3d')&&!_['isEmpty'](_0x1637ea)){return util[_0x127b('0x3e')](_0x127b('0x3f'),_0x1637ea,_0x1b319a);}return util[_0x127b('0x3e')]('\x22%s\x22\x20<%s>',_0x1b319a,_0x1b319a);}if(!_[_0x127b('0x3c')](_0x363f31)&&typeof _0x363f31===_0x127b('0x3d')&&!_['isEmpty'](_0x363f31)){return _0x363f31;}return'\x22\x22\x20<>';}exports[_0x127b('0x40')]=getCallerId;function getCallerIdRandom(_0x496c9f,_0x2cbfca){var _0x10d553;var _0x287649;var _0x26ac92;if(_0x2cbfca<=0x0){_0x2cbfca=0x1;}_0x10d553=new RegExp(_0x127b('0x41')+_0x2cbfca+'}$');_0x287649=Math[_0x127b('0x42')](0xa,_0x2cbfca-0x1);_0x26ac92=Math[_0x127b('0x42')](0xa,_0x2cbfca)-0x1;return util['format']('%s',_[_0x127b('0x43')](_0x496c9f,_0x10d553,_[_0x127b('0x44')](_0x287649,_0x26ac92)[_0x127b('0x45')]()));}exports[_0x127b('0x46')]=getCallerIdRandom;function decrementOriginate(_0xef567e){if(_0xef567e['originated']&&_0xef567e[_0x127b('0x26')]>0x0){_0xef567e[_0x127b('0x26')]-=0x1;}else{logger[_0x127b('0x47')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x127b('0x48')]=decrementOriginate;function checkContactEmpty(_0x458478){return _0x458478&&_0x458478[_0x127b('0x49')]>0x0;}exports[_0x127b('0x4a')]=checkContactEmpty;function erlangb(_0x1b505d,_0x40a8b3){if(_0x40a8b3===0x0){return 0x0;}var _0x283cd5=0x1;for(var _0x360a22=0x1;_0x360a22<=_0x40a8b3;_0x360a22+=0x1){_0x283cd5=0x1+_0x283cd5*_0x360a22/_0x1b505d;}return 0x1/_0x283cd5;}exports[_0x127b('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x5aaa91,_0x151003,_0x22a305){if(_0x151003>_0x22a305){for(var _0x5e4b40=0x0;_0x5e4b40<_0x151003-_0x22a305;_0x5e4b40+=0x1){decrementOriginate(_0x5aaa91);}}}exports[_0x127b('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x32a447){var _0x1524d5={};var _0x10658c=['id',_0x127b('0x4d'),_0x127b('0x4e'),'updatedAt'];const _0x4f139c=0xfa;if(_0x32a447){for(var _0x4773b8 in _0x32a447){if(typeof _0x32a447[_0x4773b8]!=='undefined'){if(!_['isNil'](_0x32a447[_0x4773b8])&&!_0x10658c[_0x127b('0x34')](_0x4773b8)){if(_0x4773b8===_0x127b('0x4f')&&_0x32a447[_0x4773b8][_0x127b('0x49')]>_0x4f139c){_0x1524d5[_0x127b('0x50')+_0x4773b8[_0x127b('0x51')]()]=_0x32a447[_0x4773b8][_0x127b('0x45')]()[_0x127b('0x52')](0x0,_0x4f139c);}else{_0x1524d5[_0x127b('0x50')+_0x4773b8[_0x127b('0x51')]()]=_0x32a447[_0x4773b8];}}}}}return _0x1524d5;}exports[_0x127b('0x53')]=setXMDContactVariables; \ No newline at end of file +var _0x4e4d=['AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','TrunkBackup','includes','status','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','string','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','pow','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','erlangb','createdAt','tags','updatedAt','undefined','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','timezones','BLACKLIST','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x3c3cca,_0x40c35d){var _0x185eb5=function(_0x2f95c3){while(--_0x2f95c3){_0x3c3cca['push'](_0x3c3cca['shift']());}};_0x185eb5(++_0x40c35d);}(_0x4e4d,0x18b));var _0xd4e4=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x4e4d[_0x2053ea];return _0x2232c4;};'use strict';var _=require(_0xd4e4('0x0'));var moment=require(_0xd4e4('0x1'));var util=require(_0xd4e4('0x2'));var logger=require(_0xd4e4('0x3'))(_0xd4e4('0x4'));var timezones=require('../../../../config/environment/shared')[_0xd4e4('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xd4e4('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xd4e4('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xd4e4('0x8'),'INACTIVE':_0xd4e4('0x9'),'NO_AGENTS_LOGGED':_0xd4e4('0xa'),'NO_AVAILABLE_CONTACTS':_0xd4e4('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xd4e4('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xd4e4('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xd4e4('0xe'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xd4e4('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x97cd1a){return _0x97cd1a[_0xd4e4('0x10')]===_0xd4e4('0x11');}exports[_0xd4e4('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x4e9cfe){return _0x4e9cfe[_0xd4e4('0x13')]===_0xd4e4('0x14');}exports[_0xd4e4('0x15')]=isIVRCampaign;function isOutboundQueue(_0x422700){return _0x422700[_0xd4e4('0x13')]===_0xd4e4('0x16');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x41fde2){return _0x41fde2[_0xd4e4('0x17')];}exports[_0xd4e4('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x9dc6e1){return _0x9dc6e1[_0xd4e4('0x19')];}exports[_0xd4e4('0x1a')]=isIVRCampaignActive;function getSeconds(_0x4d43b4,_0x3784c3){var _0x1660d6=moment(_0x4d43b4)[_0xd4e4('0x1b')](0x0);var _0x49066d=moment(_0x3784c3)[_0xd4e4('0x1b')](0x0);return _0x1660d6['diff'](_0x49066d,_0xd4e4('0x1c'));}exports[_0xd4e4('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x2dea1e,_0x3b68af){var _0x5e1a8d=![];var _0x373579=_0x2dea1e[_0xd4e4('0x10')]!==_0x3b68af[_0xd4e4('0x10')]||_0x2dea1e[_0xd4e4('0x17')]!==_0x3b68af[_0xd4e4('0x17')]||_0x2dea1e[_0xd4e4('0x1e')]!==_0x3b68af[_0xd4e4('0x1e')];var _0x5effd2=_0x2dea1e['available']!==_0x3b68af[_0xd4e4('0x1f')]||_0x2dea1e[_0xd4e4('0x20')]!==_0x3b68af['loggedIn']||_0x2dea1e['loggedInDb']!==_0x3b68af[_0xd4e4('0x21')]||_0x2dea1e[_0xd4e4('0x22')]!==_0x3b68af[_0xd4e4('0x22')]||_0x2dea1e[_0xd4e4('0x23')]!==_0x3b68af[_0xd4e4('0x23')]||_0x2dea1e[_0xd4e4('0x24')]!==_0x3b68af[_0xd4e4('0x24')]||_0x2dea1e[_0xd4e4('0x25')]!==_0x3b68af[_0xd4e4('0x25')]||_0x2dea1e[_0xd4e4('0x26')]!==_0x3b68af[_0xd4e4('0x26')]||_0x2dea1e[_0xd4e4('0x27')]!==_0x3b68af[_0xd4e4('0x27')];if(_0x2dea1e['Trunk']&&_0x3b68af['Trunk']){_0x5e1a8d=_0x2dea1e[_0xd4e4('0x28')]['name']!==_0x3b68af[_0xd4e4('0x28')][_0xd4e4('0x29')]||_0x2dea1e['Trunk'][_0xd4e4('0x19')]!==_0x3b68af[_0xd4e4('0x28')][_0xd4e4('0x19')];}return _0x373579||_0x5effd2||_0x5e1a8d;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5add3a){var _0x589b30=null;var _0xaeed7a=_0x5add3a[_0xd4e4('0x2a')];if(_[_0xd4e4('0x2b')](_0x5add3a[_0xd4e4('0x2c')])||_['isNil'](_0x5add3a['Interval'])||_[_0xd4e4('0x2b')](_0x5add3a[_0xd4e4('0x2d')][_0xd4e4('0x2e')])){_0x589b30=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xd4e4('0x2f')](_0x5add3a[_0xd4e4('0x2c')])||_['isEmpty'](_0x5add3a[_0xd4e4('0x2d')][_0xd4e4('0x2e')])){_0x589b30=CAMPAIGN_STATUS[_0xd4e4('0x30')];}else if(_0xaeed7a&&!timezones[_0xaeed7a]){_0x589b30=CAMPAIGN_STATUS[_0xd4e4('0x31')];}return _0x589b30;}function checkAnyValidTrunk(_0xf77b9,_0x373bef){var _0x1a7036=null;var _0x45cbcd=_0xd4e4('0x32');var _0x3f5657=[_0xd4e4('0x33'),_0xd4e4('0x34')];var _0x4533eb=!![];if(_0xf77b9[_0xd4e4('0x28')]&&_0xf77b9[_0xd4e4('0x28')][_0xd4e4('0x19')]){_0x45cbcd+=_0xf77b9[_0xd4e4('0x28')][_0xd4e4('0x29')];_0x1a7036=_0x373bef[_0x45cbcd];_0x4533eb=_0x3f5657['includes'](_0x1a7036['status']);}else if(_0xf77b9[_0xd4e4('0x35')]&&_0xf77b9[_0xd4e4('0x35')][_0xd4e4('0x19')]){_0x45cbcd+=_0xf77b9['TrunkBackup'][_0xd4e4('0x29')];_0x1a7036=_0x373bef[_0x45cbcd];_0x4533eb=_0x3f5657[_0xd4e4('0x36')](_0x1a7036[_0xd4e4('0x37')]);}return _0x4533eb;}function getQueueCampaignStatusMessage(_0x35e227,_0x1e689b){var _0x477da7=CAMPAIGN_STATUS[_0xd4e4('0x38')];var _0x5aee41=isPreviewCampaign(_0x35e227);if(!isQueueCampaignActive(_0x35e227)){if(_0x5aee41){_0x477da7=CAMPAIGN_STATUS[_0xd4e4('0x39')];}else{if(_0x35e227[_0xd4e4('0x27')]===0x0&&_0x35e227[_0xd4e4('0x23')]===0x0&&_0x35e227[_0xd4e4('0x25')]===0x0&&(_0x35e227['pTalking']||0x0)===0x0){_0x477da7=CAMPAIGN_STATUS[_0xd4e4('0x39')];}else{_0x477da7=CAMPAIGN_STATUS[_0xd4e4('0x3a')];}}}else if(_0x35e227[_0xd4e4('0x20')]===0x0){_0x477da7=CAMPAIGN_STATUS[_0xd4e4('0x3b')];}else if(!checkAnyValidTrunk(_0x35e227,_0x1e689b)){_0x477da7=CAMPAIGN_STATUS[_0xd4e4('0x3c')];}else if(!isPreviewCampaign(_0x35e227)){var _0x3a0bca=checkAnyValidQueueCampaignInterval(_0x35e227);if(_0x3a0bca){_0x477da7=_0x3a0bca;}}return _0x477da7;}exports[_0xd4e4('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xa6bdd9){var _0x2e9c1e=CAMPAIGN_STATUS['DISACTIVED'];if(_0xa6bdd9[_0xd4e4('0x27')]===0x0&&_0xa6bdd9[_0xd4e4('0x23')]===0x0&&_0xa6bdd9[_0xd4e4('0x25')]===0x0&&(_0xa6bdd9[_0xd4e4('0x24')]||0x0)===0x0){_0x2e9c1e=CAMPAIGN_STATUS[_0xd4e4('0x39')];}return _0x2e9c1e;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x213584){var _0x39acb8=_0x213584[_0xd4e4('0x3e')](/"(.*?)"/);return _0x39acb8?_0x39acb8[0x1]:_0x213584;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x107af8,_0x170425,_0x58c197){if(!_['isUndefined'](_0x58c197)&&typeof _0x58c197===_0xd4e4('0x3f')&&!_[_0xd4e4('0x2f')](_0x58c197)){if(!_['isUndefined'](_0x170425)&&typeof _0x170425==='string'&&!_[_0xd4e4('0x2f')](_0x170425)){return util[_0xd4e4('0x40')](_0xd4e4('0x41'),_0x170425,_0x58c197);}return util[_0xd4e4('0x40')](_0xd4e4('0x41'),_0x58c197,_0x58c197);}if(!_[_0xd4e4('0x42')](_0x107af8)&&typeof _0x107af8===_0xd4e4('0x3f')&&!_[_0xd4e4('0x2f')](_0x107af8)){return _0x107af8;}return _0xd4e4('0x43');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x27e321,_0x5bca91){var _0xd8066b;var _0x4ad555;var _0xb6423e;if(_0x5bca91<=0x0){_0x5bca91=0x1;}_0xd8066b=new RegExp('\x5cw{0,'+_0x5bca91+'}$');_0x4ad555=Math[_0xd4e4('0x44')](0xa,_0x5bca91-0x1);_0xb6423e=Math[_0xd4e4('0x44')](0xa,_0x5bca91)-0x1;return util[_0xd4e4('0x40')]('%s',_['replace'](_0x27e321,_0xd8066b,_[_0xd4e4('0x45')](_0x4ad555,_0xb6423e)['toString']()));}exports[_0xd4e4('0x46')]=getCallerIdRandom;function decrementOriginate(_0x722a85){if(_0x722a85[_0xd4e4('0x27')]&&_0x722a85[_0xd4e4('0x27')]>0x0){_0x722a85[_0xd4e4('0x27')]-=0x1;}else{logger['error'](_0xd4e4('0x47'));}}exports[_0xd4e4('0x48')]=decrementOriginate;function checkContactEmpty(_0x4afbce){return _0x4afbce&&_0x4afbce[_0xd4e4('0x49')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x4979a7,_0x17ed85){if(_0x17ed85===0x0){return 0x0;}var _0xea914a=0x1;for(var _0x3915c8=0x1;_0x3915c8<=_0x17ed85;_0x3915c8+=0x1){_0xea914a=0x1+_0xea914a*_0x3915c8/_0x4979a7;}return 0x1/_0xea914a;}exports[_0xd4e4('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x2738e8,_0x400383,_0x5ba1a9){if(_0x400383>_0x5ba1a9){for(var _0x4adb32=0x0;_0x4adb32<_0x400383-_0x5ba1a9;_0x4adb32+=0x1){decrementOriginate(_0x2738e8);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x66d04c){var _0x3b847a={};var _0x23933b=['id',_0xd4e4('0x4b'),_0xd4e4('0x4c'),_0xd4e4('0x4d')];const _0x2022ce=0xfa;if(_0x66d04c){for(var _0x5ed2a1 in _0x66d04c){if(typeof _0x66d04c[_0x5ed2a1]!==_0xd4e4('0x4e')){if(!_[_0xd4e4('0x2b')](_0x66d04c[_0x5ed2a1])&&!_0x23933b[_0xd4e4('0x36')](_0x5ed2a1)){if(_0x5ed2a1==='description'&&_0x66d04c[_0x5ed2a1][_0xd4e4('0x49')]>_0x2022ce){_0x3b847a['XMD-'+_0x5ed2a1[_0xd4e4('0x4f')]()]=_0x66d04c[_0x5ed2a1]['toString']()['substring'](0x0,_0x2022ce);}else{_0x3b847a['XMD-'+_0x5ed2a1[_0xd4e4('0x4f')]()]=_0x66d04c[_0x5ed2a1];}}}}}return _0x3b847a;}exports[_0xd4e4('0x50')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1f8453a..821f4f5 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(_0x5eba57,_0xff922f){var _0x4b128c=function(_0x354427){while(--_0x354427){_0x5eba57['push'](_0x5eba57['shift']());}};_0x4b128c(++_0xff922f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x52849b,_0x190993){var _0x2413f8=function(_0x206e38){while(--_0x206e38){_0x52849b['push'](_0x52849b['shift']());}};_0x2413f8(++_0x190993);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 27a9afc..55cb380 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 _0x9d67=['SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','exten','localstationid','uniqueid','name','info','\x20syncNewchannel\x20','channel','prototype','syncVarSet','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','error','stringify','catch','\x20receiveFax\x20','merge','pick','response','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','addVariables','ext','isTrunkReachable','isNil','active'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9d67,0x78));var _0x79d6=function(_0x1f231d,_0x4813a9){_0x1f231d=_0x1f231d-0x0;var _0x58e9ba=_0x9d67[_0x1f231d];return _0x58e9ba;};'use strict';var util=require(_0x79d6('0x0'));var _=require(_0x79d6('0x1'));var BPromise=require(_0x79d6('0x2'));var uuid=require('uuid');var moment=require(_0x79d6('0x3'));var path=require(_0x79d6('0x4'));var tiff2pdf=require(_0x79d6('0x5'));var gs=require(_0x79d6('0x6'));var logger=require('../../../config/logger')(_0x79d6('0x7'));var ami=require(_0x79d6('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x79d6('0x9'));var ut=require(_0x79d6('0xa'));var Action=require('./action');var faxAccount=require(_0x79d6('0xb'));var attachment=require(_0x79d6('0xc'));var faxMessage=require(_0x79d6('0xd'));function Fax(_0x407d22){this[_0x79d6('0xe')]={};this[_0x79d6('0xf')]=_0x407d22[_0x79d6('0xf')];this[_0x79d6('0x10')]=_0x407d22[_0x79d6('0x10')];this[_0x79d6('0x11')]={};ami['on']('newchannel',this[_0x79d6('0x12')][_0x79d6('0x13')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x79d6('0x14'),this['syncNewState'][_0x79d6('0x13')](this));ami['on'](_0x79d6('0x15'),this[_0x79d6('0x16')][_0x79d6('0x13')](this));ami['on'](_0x79d6('0x17'),this[_0x79d6('0x18')]['bind'](this));ami['on'](_0x79d6('0x19'),this['syncReceiveFax'][_0x79d6('0x13')](this));ami['on'](_0x79d6('0x1a'),this[_0x79d6('0x1b')][_0x79d6('0x13')](this));ami['on'](_0x79d6('0x1c'),this[_0x79d6('0x1d')][_0x79d6('0x13')](this));}Fax['prototype'][_0x79d6('0x12')]=function(_0x1c5e6d){if(_0x1c5e6d[_0x79d6('0x1e')]==='from-voip-provider'){for(var _0x5aba9d in this[_0x79d6('0xf')]){if(this[_0x79d6('0xf')][_0x79d6('0x1f')](_0x5aba9d)){if(_0x1c5e6d[_0x79d6('0x20')]===this[_0x79d6('0xf')][_0x5aba9d][_0x79d6('0x21')]){this[_0x79d6('0xe')][_0x1c5e6d[_0x79d6('0x22')]]={};this[_0x79d6('0xe')][_0x1c5e6d['uniqueid']]['channel']=_0x1c5e6d['channel'];this[_0x79d6('0xe')][_0x1c5e6d[_0x79d6('0x22')]]['id']=this[_0x79d6('0xf')][_0x5aba9d]['id'];this['channels'][_0x1c5e6d[_0x79d6('0x22')]][_0x79d6('0x23')]=this[_0x79d6('0xf')][_0x5aba9d][_0x79d6('0x23')];logger[_0x79d6('0x24')](_0x1c5e6d[_0x79d6('0x22')],_0x79d6('0x25'));}}}}if(this[_0x79d6('0x11')][_0x1c5e6d[_0x79d6('0x22')]]){this['channels'][_0x1c5e6d[_0x79d6('0x22')]]={};this[_0x79d6('0xe')][_0x1c5e6d['uniqueid']][_0x79d6('0x26')]=_0x1c5e6d[_0x79d6('0x26')];logger[_0x79d6('0x24')](_0x1c5e6d['uniqueid'],_0x79d6('0x25'));}};Fax[_0x79d6('0x27')][_0x79d6('0x28')]=function(_0xdfab05){if(this[_0x79d6('0xe')][_0xdfab05['uniqueid']]){for(var _0x38d993 in _0xdfab05[_0x79d6('0x29')]){if(_0xdfab05[_0x79d6('0x29')]['hasOwnProperty'](_0x38d993)){this['channels'][_0xdfab05['uniqueid']][_0x38d993]=_0xdfab05[_0x79d6('0x2a')];}}}};Fax['prototype'][_0x79d6('0x2b')]=function(_0x10d585){if(this[_0x79d6('0xe')][_0x10d585[_0x79d6('0x22')]]){this[_0x79d6('0xe')][_0x10d585[_0x79d6('0x22')]][_0x79d6('0x2c')]=_0x10d585[_0x79d6('0x2c')];this[_0x79d6('0xe')][_0x10d585[_0x79d6('0x22')]]['channelstatedesc']=_0x10d585[_0x79d6('0x2d')];}};Fax['prototype'][_0x79d6('0x16')]=function(_0x524161){if(this[_0x79d6('0xe')][_0x524161['uniqueid']]){for(var _0x46411f in _0x524161[_0x79d6('0x29')]){if(_0x524161[_0x79d6('0x29')][_0x79d6('0x1f')](_0x46411f)){this[_0x79d6('0xe')][_0x524161[_0x79d6('0x22')]][_0x46411f]=_0x524161[_0x79d6('0x2a')];}}}};Fax[_0x79d6('0x27')][_0x79d6('0x18')]=function(_0x499410){if(this['channels'][_0x499410[_0x79d6('0x22')]]){this['channels'][_0x499410['uniqueid']][_0x79d6('0x2e')]=_0x499410[_0x79d6('0x2e')];this[_0x79d6('0xe')][_0x499410['uniqueid']][_0x79d6('0x2f')]=_0x499410[_0x79d6('0x2f')];this['channels'][_0x499410['uniqueid']][_0x79d6('0x21')]=_0x499410[_0x79d6('0x21')];this[_0x79d6('0xe')][_0x499410[_0x79d6('0x22')]][_0x79d6('0x30')]=_0x499410[_0x79d6('0x30')];logger[_0x79d6('0x24')](_0x499410[_0x79d6('0x22')],'\x20syncFaxStatus\x20');}};Fax[_0x79d6('0x27')][_0x79d6('0x31')]=function(_0x7507f){var _0x50c9c4=this;if(this['channels'][_0x7507f['uniqueid']]){var _0x2610e8=this[_0x79d6('0xe')][_0x7507f[_0x79d6('0x22')]]['id'];this[_0x79d6('0xe')][_0x7507f['uniqueid']][_0x79d6('0x32')]=_0x7507f[_0x79d6('0x32')];this[_0x79d6('0xe')][_0x7507f['uniqueid']][_0x79d6('0x33')]=_0x7507f[_0x79d6('0x33')];this[_0x79d6('0xe')][_0x7507f[_0x79d6('0x22')]][_0x79d6('0x21')]=_0x7507f[_0x79d6('0x21')];this['channels'][_0x7507f['uniqueid']][_0x79d6('0x34')]=_0x7507f[_0x79d6('0x34')];this[_0x79d6('0xe')][_0x7507f[_0x79d6('0x22')]]['transferrate']=_0x7507f['transferrate'];this[_0x79d6('0xe')][_0x7507f[_0x79d6('0x22')]]['filename']=_0x7507f[_0x79d6('0x30')];this[_0x79d6('0xe')][_0x7507f[_0x79d6('0x22')]]['calleridnum']=_0x7507f[_0x79d6('0x35')];if(this[_0x79d6('0xe')][_0x7507f['uniqueid']][_0x79d6('0x33')]>0x0){tiff2pdf(_0x7507f[_0x79d6('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x12c4a9){logger[_0x79d6('0x24')](_0x7507f[_0x79d6('0x22')],_0x79d6('0x36'),_0x12c4a9['message']);attachment[_0x79d6('0x37')]({'name':path[_0x79d6('0x38')](_0x7507f['filename'])[_0x79d6('0x23')],'basename':path[_0x79d6('0x38')](_0x7507f[_0x79d6('0x30')])[_0x79d6('0x23')]+_0x79d6('0x39'),'type':'application/pdf'})['then'](function(_0x35f8aa){faxAccount['notify'](_0x2610e8,{'from':_0x7507f[_0x79d6('0x35')],'mapKey':'fax','body':path[_0x79d6('0x38')](_0x7507f[_0x79d6('0x30')])[_0x79d6('0x23')]+_0x79d6('0x39'),'AttachmentId':_0x35f8aa['id']})['catch'](function(_0x517921){logger[_0x79d6('0x3a')](_0x7507f[_0x79d6('0x22')],'\x20notify\x20',JSON[_0x79d6('0x3b')](_0x517921));});})[_0x79d6('0x3c')](function(_0x5944d0){logger[_0x79d6('0x3a')](_0x7507f[_0x79d6('0x22')],_0x79d6('0x3d'),JSON[_0x79d6('0x3b')](_0x5944d0));});});}logger[_0x79d6('0x24')](_0x7507f['uniqueid'],_0x79d6('0x3d'));}};Fax[_0x79d6('0x27')][_0x79d6('0x1d')]=function(_0x3eeea6){if(this[_0x79d6('0x11')][_0x3eeea6[_0x79d6('0x22')]]){_[_0x79d6('0x3e')](this[_0x79d6('0xe')][_0x3eeea6[_0x79d6('0x22')]],_[_0x79d6('0x3f')](_0x3eeea6,[_0x79d6('0x40'),'reason']));}};function updateStatus(_0x3f0409){if(_0x3f0409['AttachmentId']){faxMessage[_0x79d6('0x41')](_0x3f0409['AttachmentId'],{'failMessage':_0x79d6('0x42')})[_0x79d6('0x43')](function(_0x55ff08){ut[_0x79d6('0x44')]('[Fax][Message][Error][Updated]',_0x55ff08);})['catch'](function(_0x3ada98){ut[_0x79d6('0x44')](_0x79d6('0x45'),_0x3ada98);});}else{ut[_0x79d6('0x44')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x79d6('0x27')][_0x79d6('0x46')]=function(_0x22f477,_0x5412d1,_0x3847e0){var _0x28d062=this;var _0x43e8ae={};if(_0x5412d1){_0x43e8ae={'read':_0x5412d1};}else{_0x43e8ae={'failMessage':_0x3847e0};}if(this[_0x79d6('0x11')][_0x22f477]['AttachmentId']){faxMessage['update'](this[_0x79d6('0x11')][_0x22f477]['AttachmentId'],_0x43e8ae)[_0x79d6('0x43')](function(_0x57d3c8){ut[_0x79d6('0x44')](_0x79d6('0x47'),_0x57d3c8);})[_0x79d6('0x3c')](function(_0x108785){ut[_0x79d6('0x44')]('[Fax][Message][NoUpdate1]',_0x108785);})['finally'](function(){delete _0x28d062[_0x79d6('0xe')][_0x22f477];delete _0x28d062[_0x79d6('0x11')][_0x22f477];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x79d6('0xe')][_0x22f477];delete this[_0x79d6('0x11')][_0x22f477];}};Fax['prototype']['syncHangup']=function(_0x1f0ca5){var _0x2e2349=this;if(this[_0x79d6('0xe')][_0x1f0ca5[_0x79d6('0x22')]]){if(this[_0x79d6('0x11')][_0x1f0ca5['uniqueid']]){this[_0x79d6('0xe')][_0x1f0ca5[_0x79d6('0x22')]]['id']=this['actions'][_0x1f0ca5[_0x79d6('0x22')]]['id'];this['channels'][_0x1f0ca5[_0x79d6('0x22')]][_0x79d6('0x23')]=this[_0x79d6('0x11')][_0x1f0ca5[_0x79d6('0x22')]][_0x79d6('0x23')];}logger[_0x79d6('0x24')](_0x1f0ca5['uniqueid'],this[_0x79d6('0x11')][_0x1f0ca5[_0x79d6('0x22')]]?_0x79d6('0x48'):_0x79d6('0x49'),JSON[_0x79d6('0x3b')](this[_0x79d6('0xe')][_0x1f0ca5[_0x79d6('0x22')]]));if(this['actions'][_0x1f0ca5[_0x79d6('0x22')]]){if(this['channels'][_0x1f0ca5[_0x79d6('0x22')]][_0x79d6('0x4a')]>0x0&&this[_0x79d6('0xe')][_0x1f0ca5[_0x79d6('0x22')]][_0x79d6('0x17')]===_0x79d6('0x4b')){this[_0x79d6('0x46')](_0x1f0ca5[_0x79d6('0x22')],!![]);}else{this[_0x79d6('0x46')](_0x1f0ca5[_0x79d6('0x22')],![],this[_0x79d6('0xe')][_0x1f0ca5[_0x79d6('0x22')]][_0x79d6('0x4c')]?_0x79d6('0x4d')+this[_0x79d6('0xe')][_0x1f0ca5['uniqueid']][_0x79d6('0x4c')]:_0x79d6('0x4e'));}}}};Fax['prototype'][_0x79d6('0x4f')]=function(_0x1c3532){var _0x23b675=this;return new BPromise(function(_0x542495,_0x23436c){_0x23b675['execOriginate'](_0x1c3532,_0x23b675[_0x79d6('0xf')][_0x1c3532[_0x79d6('0x50')]])[_0x79d6('0x43')](function(_0x2ee502){ut[_0x79d6('0x44')](_0x79d6('0x51'),_0x2ee502);_0x542495(ut[_0x79d6('0x52')]('Fax\x20received'));})[_0x79d6('0x3c')](function(_0x3d6e0f){ut[_0x79d6('0x44')]('[Fax][execOriginate][failure]',_0x3d6e0f);updateStatus(_0x1c3532);_0x23436c(ut[_0x79d6('0x52')](_0x79d6('0x53')));});});};Fax[_0x79d6('0x27')]['checkAfterSend']=function(_0x3226e9){var _0x3f7439=this;return new BPromise(function(_0x3bb76a,_0x307cc7){var _0x19d2d5=_0x3f7439[_0x79d6('0x54')](_0x3f7439['faxAccounts'][_0x3226e9[_0x79d6('0x50')]][_0x79d6('0x55')],_0x3226e9);if(_0x19d2d5[_0x79d6('0x56')]){_0x3bb76a(ut[_0x79d6('0x52')](_0x79d6('0x57')));}else{_0x307cc7(ut[_0x79d6('0x52')](_0x19d2d5['message']));}});};function originate(_0x50dca5,_0x3c879b,_0x1537fa){return new BPromise(function(_0x4e5b36,_0x27120b){if(_0x1537fa){var _0x6a876c=util[_0x79d6('0x58')](_0x79d6('0x59'),path[_0x79d6('0x38')](_0x50dca5[_0x79d6('0x4')])[_0x79d6('0x23')],_0x50dca5[_0x79d6('0x4')]);gs[_0x79d6('0x5a')](_0x6a876c)[_0x79d6('0x43')](function(){_0x50dca5[_0x79d6('0x4')]=util[_0x79d6('0x58')](_0x79d6('0x5b'),path[_0x79d6('0x38')](_0x50dca5['path'])[_0x79d6('0x5c')],path[_0x79d6('0x38')](_0x50dca5[_0x79d6('0x4')])[_0x79d6('0x23')]);_0x3c879b[_0x79d6('0x5d')]=_0x50dca5[_0x79d6('0x4')];ut[_0x79d6('0x44')]('Convert\x20pdf\x20to\x20tif','');ami[_0x79d6('0x5e')](ut['variablesAction'](_0x50dca5,_0x3c879b))[_0x79d6('0x43')](function(_0x5c176a){_0x4e5b36(_0x5c176a);})[_0x79d6('0x3c')](function(_0x51ea25){_0x27120b(_0x51ea25);});})[_0x79d6('0x3c')](function(_0x2a7b2b){_0x27120b(_0x2a7b2b);});}else{ami[_0x79d6('0x5e')](ut['variablesAction'](_0x50dca5,_0x3c879b))[_0x79d6('0x43')](function(_0x5dff28){_0x4e5b36(_0x5dff28);})['catch'](function(_0x24cafc){_0x27120b(_0x24cafc);});}});}Fax[_0x79d6('0x27')]['execOriginate']=function(_0x595391,_0x521747){var _0x2c553d=this;return new BPromise(function(_0x7a809f,_0x2a228f){var _0x4fb4f5=uuid['v4']();var _0x48b77=ut[_0x79d6('0x5f')](_0x595391,_0x521747);_0x2c553d[_0x79d6('0x11')][_0x4fb4f5]=new Action(_0x4fb4f5,_0x521747,_0x595391);var _0x518a52=_0x2c553d[_0x79d6('0x11')][_0x4fb4f5];if(path[_0x79d6('0x38')](_0x595391['path'])[_0x79d6('0x60')]===_0x79d6('0x39')){originate(_0x518a52,_0x48b77,!![])[_0x79d6('0x43')](function(_0x2b4826){_0x7a809f(_0x2b4826);})[_0x79d6('0x3c')](function(_0x46f55d){_0x2a228f(_0x46f55d);});}else{originate(_0x518a52,_0x48b77,![])[_0x79d6('0x43')](function(_0x47973a){_0x7a809f(_0x47973a);})[_0x79d6('0x3c')](function(_0x310107){_0x2a228f(_0x310107);});}});};Fax[_0x79d6('0x27')][_0x79d6('0x61')]=function(_0x54bbe1){return!_[_0x79d6('0x62')](_0x54bbe1)&&!_[_0x79d6('0x62')](_0x54bbe1[_0x79d6('0x23')])&&!_['isNil'](_0x54bbe1[_0x79d6('0x63')])&&_0x54bbe1[_0x79d6('0x63')]&&!_['isNil'](this[_0x79d6('0x10')][util[_0x79d6('0x58')]('SIP/%s',_0x54bbe1[_0x79d6('0x23')])])&&!_[_0x79d6('0x62')](this[_0x79d6('0x10')][util[_0x79d6('0x58')](_0x79d6('0x64'),_0x54bbe1[_0x79d6('0x23')])][_0x79d6('0x2f')])&&(this['trunks'][util[_0x79d6('0x58')](_0x79d6('0x64'),_0x54bbe1[_0x79d6('0x23')])][_0x79d6('0x2f')]===_0x79d6('0x65')||this[_0x79d6('0x10')][util['format'](_0x79d6('0x64'),_0x54bbe1[_0x79d6('0x23')])][_0x79d6('0x2f')]===_0x79d6('0x66'));};Fax['prototype'][_0x79d6('0x54')]=function(_0x62310c,_0x5b2005){if(!this['isTrunkReachable'](_0x62310c)){ut[_0x79d6('0x44')](_0x79d6('0x67'),_[_0x79d6('0x62')](_0x62310c)?'':_0x62310c[_0x79d6('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x79d6('0x68')};}if(_[_0x79d6('0x62')](_0x5b2005['fax'])){ut['logger'](_0x79d6('0x69'),JSON['stringify'](_0x5b2005));return{'isValid':![],'message':_0x79d6('0x6a')};}if(_[_0x79d6('0x62')](_0x5b2005[_0x79d6('0x4')])){ut[_0x79d6('0x44')](_0x79d6('0x6b'),JSON['stringify'](_0x5b2005));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x79d6('0x6c')};};module[_0x79d6('0x6d')]=Fax; \ No newline at end of file +var _0x42d3=['prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','remotestationid','pagestransferred','resolution','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','notify','fax','.pdf','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','uuid','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse'];(function(_0x34473f,_0x2b9c5c){var _0x25cf6f=function(_0x4214a2){while(--_0x4214a2){_0x34473f['push'](_0x34473f['shift']());}};_0x25cf6f(++_0x2b9c5c);}(_0x42d3,0x13c));var _0x342d=function(_0x4650b7,_0x5a5b4c){_0x4650b7=_0x4650b7-0x0;var _0x5eee6c=_0x42d3[_0x4650b7];return _0x5eee6c;};'use strict';var util=require('util');var _=require(_0x342d('0x0'));var BPromise=require('bluebird');var uuid=require(_0x342d('0x1'));var moment=require('moment');var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x342d('0x2'));var logger=require(_0x342d('0x3'))('fax');var ami=require(_0x342d('0x4'));var rpcDb=require('./rpcDb');var Channel=require(_0x342d('0x5'));var ut=require(_0x342d('0x6'));var Action=require(_0x342d('0x7'));var faxAccount=require(_0x342d('0x8'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x342d('0x9'));function Fax(_0x5b4c1b){this[_0x342d('0xa')]={};this[_0x342d('0xb')]=_0x5b4c1b['faxAccounts'];this[_0x342d('0xc')]=_0x5b4c1b[_0x342d('0xc')];this[_0x342d('0xd')]={};ami['on'](_0x342d('0xe'),this[_0x342d('0xf')][_0x342d('0x10')](this));ami['on'](_0x342d('0x11'),this[_0x342d('0x12')][_0x342d('0x10')](this));ami['on'](_0x342d('0x13'),this[_0x342d('0x14')]['bind'](this));ami['on'](_0x342d('0x15'),this['syncNewExten']['bind'](this));ami['on'](_0x342d('0x16'),this[_0x342d('0x17')][_0x342d('0x10')](this));ami['on'](_0x342d('0x18'),this['syncReceiveFax']['bind'](this));ami['on'](_0x342d('0x19'),this[_0x342d('0x1a')]['bind'](this));ami['on'](_0x342d('0x1b'),this[_0x342d('0x1c')][_0x342d('0x10')](this));}Fax[_0x342d('0x1d')][_0x342d('0xf')]=function(_0xef1282){if(_0xef1282[_0x342d('0x1e')]===_0x342d('0x1f')){for(var _0x249e40 in this['faxAccounts']){if(this['faxAccounts'][_0x342d('0x20')](_0x249e40)){if(_0xef1282['exten']===this[_0x342d('0xb')][_0x249e40][_0x342d('0x21')]){this[_0x342d('0xa')][_0xef1282[_0x342d('0x22')]]={};this[_0x342d('0xa')][_0xef1282[_0x342d('0x22')]][_0x342d('0x23')]=_0xef1282[_0x342d('0x23')];this[_0x342d('0xa')][_0xef1282[_0x342d('0x22')]]['id']=this[_0x342d('0xb')][_0x249e40]['id'];this['channels'][_0xef1282['uniqueid']]['name']=this['faxAccounts'][_0x249e40][_0x342d('0x24')];logger[_0x342d('0x25')](_0xef1282[_0x342d('0x22')],_0x342d('0x26'));}}}}if(this[_0x342d('0xd')][_0xef1282['uniqueid']]){this[_0x342d('0xa')][_0xef1282['uniqueid']]={};this[_0x342d('0xa')][_0xef1282['uniqueid']][_0x342d('0x23')]=_0xef1282['channel'];logger[_0x342d('0x25')](_0xef1282[_0x342d('0x22')],_0x342d('0x26'));}};Fax[_0x342d('0x1d')][_0x342d('0x12')]=function(_0x39f0ab){if(this[_0x342d('0xa')][_0x39f0ab[_0x342d('0x22')]]){for(var _0x33aeaa in _0x39f0ab[_0x342d('0x27')]){if(_0x39f0ab[_0x342d('0x27')][_0x342d('0x20')](_0x33aeaa)){this[_0x342d('0xa')][_0x39f0ab['uniqueid']][_0x33aeaa]=_0x39f0ab[_0x342d('0x28')];}}}};Fax[_0x342d('0x1d')][_0x342d('0x14')]=function(_0xff1145){if(this[_0x342d('0xa')][_0xff1145[_0x342d('0x22')]]){this[_0x342d('0xa')][_0xff1145[_0x342d('0x22')]][_0x342d('0x29')]=_0xff1145['channelstate'];this['channels'][_0xff1145[_0x342d('0x22')]][_0x342d('0x2a')]=_0xff1145[_0x342d('0x2a')];}};Fax[_0x342d('0x1d')]['syncNewExten']=function(_0xdf2cfa){if(this[_0x342d('0xa')][_0xdf2cfa[_0x342d('0x22')]]){for(var _0x2cfb29 in _0xdf2cfa[_0x342d('0x27')]){if(_0xdf2cfa['variable'][_0x342d('0x20')](_0x2cfb29)){this[_0x342d('0xa')][_0xdf2cfa['uniqueid']][_0x2cfb29]=_0xdf2cfa[_0x342d('0x28')];}}}};Fax[_0x342d('0x1d')][_0x342d('0x17')]=function(_0x2a62c7){if(this[_0x342d('0xa')][_0x2a62c7[_0x342d('0x22')]]){this['channels'][_0x2a62c7[_0x342d('0x22')]][_0x342d('0x2b')]=_0x2a62c7['operation'];this[_0x342d('0xa')][_0x2a62c7[_0x342d('0x22')]][_0x342d('0x2c')]=_0x2a62c7[_0x342d('0x2c')];this[_0x342d('0xa')][_0x2a62c7[_0x342d('0x22')]][_0x342d('0x21')]=_0x2a62c7['localstationid'];this[_0x342d('0xa')][_0x2a62c7[_0x342d('0x22')]]['filename']=_0x2a62c7['filename'];logger[_0x342d('0x25')](_0x2a62c7[_0x342d('0x22')],'\x20syncFaxStatus\x20');}};Fax[_0x342d('0x1d')]['syncReceiveFax']=function(_0x57fdf7){var _0x22a6a0=this;if(this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]]){var _0x5991c9=this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]]['id'];this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]][_0x342d('0x2d')]=_0x57fdf7[_0x342d('0x2d')];this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]][_0x342d('0x2e')]=_0x57fdf7[_0x342d('0x2e')];this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]][_0x342d('0x21')]=_0x57fdf7[_0x342d('0x21')];this['channels'][_0x57fdf7[_0x342d('0x22')]][_0x342d('0x2f')]=_0x57fdf7['resolution'];this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]]['transferrate']=_0x57fdf7['transferrate'];this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]][_0x342d('0x30')]=_0x57fdf7[_0x342d('0x30')];this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]][_0x342d('0x31')]=_0x57fdf7[_0x342d('0x31')];if(this[_0x342d('0xa')][_0x57fdf7[_0x342d('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x57fdf7['filename'],_0x342d('0x32'),function(_0x2c1f9c){logger['info'](_0x57fdf7['uniqueid'],_0x342d('0x33'),_0x2c1f9c[_0x342d('0x34')]);attachment['create']({'name':path[_0x342d('0x35')](_0x57fdf7[_0x342d('0x30')])[_0x342d('0x24')],'basename':path['parse'](_0x57fdf7[_0x342d('0x30')])[_0x342d('0x24')]+'.pdf','type':_0x342d('0x36')})['then'](function(_0x5714ea){faxAccount[_0x342d('0x37')](_0x5991c9,{'from':_0x57fdf7['calleridnum'],'mapKey':_0x342d('0x38'),'body':path[_0x342d('0x35')](_0x57fdf7[_0x342d('0x30')])[_0x342d('0x24')]+_0x342d('0x39'),'AttachmentId':_0x5714ea['id']})['catch'](function(_0x50987a){logger[_0x342d('0x3a')](_0x57fdf7['uniqueid'],_0x342d('0x3b'),JSON[_0x342d('0x3c')](_0x50987a));});})[_0x342d('0x3d')](function(_0x29e0bb){logger['error'](_0x57fdf7[_0x342d('0x22')],'\x20receiveFax\x20',JSON[_0x342d('0x3c')](_0x29e0bb));});});}logger['info'](_0x57fdf7['uniqueid'],_0x342d('0x3e'));}};Fax['prototype'][_0x342d('0x1c')]=function(_0x3b5172){if(this[_0x342d('0xd')][_0x3b5172[_0x342d('0x22')]]){_[_0x342d('0x3f')](this[_0x342d('0xa')][_0x3b5172[_0x342d('0x22')]],_[_0x342d('0x40')](_0x3b5172,[_0x342d('0x41'),_0x342d('0x42')]));}};function updateStatus(_0x5796d2){if(_0x5796d2[_0x342d('0x43')]){faxMessage[_0x342d('0x44')](_0x5796d2[_0x342d('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x342d('0x45')](function(_0x46a0ae){ut['logger']('[Fax][Message][Error][Updated]',_0x46a0ae);})[_0x342d('0x3d')](function(_0x2ff268){ut[_0x342d('0x46')](_0x342d('0x47'),_0x2ff268);});}else{ut[_0x342d('0x46')](_0x342d('0x48'));}}Fax[_0x342d('0x1d')][_0x342d('0x49')]=function(_0x1a5c3d,_0x197cb8,_0x262217){var _0x14736b=this;var _0x26b6e7={};if(_0x197cb8){_0x26b6e7={'read':_0x197cb8};}else{_0x26b6e7={'failMessage':_0x262217};}if(this['actions'][_0x1a5c3d][_0x342d('0x43')]){faxMessage[_0x342d('0x44')](this[_0x342d('0xd')][_0x1a5c3d]['AttachmentId'],_0x26b6e7)['then'](function(_0x53590a){ut[_0x342d('0x46')](_0x342d('0x4a'),_0x53590a);})['catch'](function(_0x3dedf1){ut[_0x342d('0x46')]('[Fax][Message][NoUpdate1]',_0x3dedf1);})[_0x342d('0x4b')](function(){delete _0x14736b['channels'][_0x1a5c3d];delete _0x14736b['actions'][_0x1a5c3d];});}else{ut[_0x342d('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0x342d('0xa')][_0x1a5c3d];delete this[_0x342d('0xd')][_0x1a5c3d];}};Fax[_0x342d('0x1d')][_0x342d('0x1a')]=function(_0x3452ab){var _0x540f1c=this;if(this[_0x342d('0xa')][_0x3452ab['uniqueid']]){if(this[_0x342d('0xd')][_0x3452ab[_0x342d('0x22')]]){this[_0x342d('0xa')][_0x3452ab['uniqueid']]['id']=this[_0x342d('0xd')][_0x3452ab[_0x342d('0x22')]]['id'];this['channels'][_0x3452ab[_0x342d('0x22')]][_0x342d('0x24')]=this[_0x342d('0xd')][_0x3452ab[_0x342d('0x22')]]['name'];}logger[_0x342d('0x25')](_0x3452ab[_0x342d('0x22')],this[_0x342d('0xd')][_0x3452ab[_0x342d('0x22')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x342d('0x3c')](this['channels'][_0x3452ab[_0x342d('0x22')]]));if(this[_0x342d('0xd')][_0x3452ab[_0x342d('0x22')]]){if(this[_0x342d('0xa')][_0x3452ab['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3452ab[_0x342d('0x22')]][_0x342d('0x16')]==='SUCCESS'){this['updateStatus'](_0x3452ab[_0x342d('0x22')],!![]);}else{this['updateStatus'](_0x3452ab['uniqueid'],![],this['channels'][_0x3452ab[_0x342d('0x22')]][_0x342d('0x4c')]?_0x342d('0x4d')+this[_0x342d('0xa')][_0x3452ab[_0x342d('0x22')]][_0x342d('0x4c')]:_0x342d('0x4e'));}}}};Fax[_0x342d('0x1d')][_0x342d('0x4f')]=function(_0x43fa7c){var _0x1036df=this;return new BPromise(function(_0x234513,_0x3066c1){_0x1036df[_0x342d('0x50')](_0x43fa7c,_0x1036df['faxAccounts'][_0x43fa7c[_0x342d('0x51')]])[_0x342d('0x45')](function(_0x169c12){ut['logger'](_0x342d('0x52'),_0x169c12);_0x234513(ut['message'](_0x342d('0x53')));})['catch'](function(_0x2d4f3e){ut[_0x342d('0x46')](_0x342d('0x54'),_0x2d4f3e);updateStatus(_0x43fa7c);_0x3066c1(ut[_0x342d('0x34')](_0x342d('0x55')));});});};Fax[_0x342d('0x1d')][_0x342d('0x56')]=function(_0x59c312){var _0x435de5=this;return new BPromise(function(_0x1bdb55,_0x119c0d){var _0x2f8446=_0x435de5[_0x342d('0x57')](_0x435de5[_0x342d('0xb')][_0x59c312[_0x342d('0x51')]][_0x342d('0x58')],_0x59c312);if(_0x2f8446[_0x342d('0x59')]){_0x1bdb55(ut[_0x342d('0x34')]('Trunk\x20Reachable'));}else{_0x119c0d(ut[_0x342d('0x34')](_0x2f8446[_0x342d('0x34')]));}});};function originate(_0x5b618a,_0x45761e,_0x3a1636){return new BPromise(function(_0x4ccafb,_0x59ac37){if(_0x3a1636){var _0x198879=util[_0x342d('0x5a')](_0x342d('0x5b'),path[_0x342d('0x35')](_0x5b618a['path'])[_0x342d('0x24')],_0x5b618a[_0x342d('0x5c')]);gs[_0x342d('0x5d')](_0x198879)[_0x342d('0x45')](function(){_0x5b618a['path']=util[_0x342d('0x5a')](_0x342d('0x5e'),path[_0x342d('0x35')](_0x5b618a[_0x342d('0x5c')])[_0x342d('0x5f')],path[_0x342d('0x35')](_0x5b618a[_0x342d('0x5c')])[_0x342d('0x24')]);_0x45761e[_0x342d('0x60')]=_0x5b618a[_0x342d('0x5c')];ut[_0x342d('0x46')](_0x342d('0x61'),'');ami[_0x342d('0x62')](ut['variablesAction'](_0x5b618a,_0x45761e))[_0x342d('0x45')](function(_0x53f586){_0x4ccafb(_0x53f586);})[_0x342d('0x3d')](function(_0x1f235a){_0x59ac37(_0x1f235a);});})[_0x342d('0x3d')](function(_0x401dda){_0x59ac37(_0x401dda);});}else{ami[_0x342d('0x62')](ut[_0x342d('0x63')](_0x5b618a,_0x45761e))[_0x342d('0x45')](function(_0x59243f){_0x4ccafb(_0x59243f);})[_0x342d('0x3d')](function(_0x55eafd){_0x59ac37(_0x55eafd);});}});}Fax[_0x342d('0x1d')]['execOriginate']=function(_0x32021c,_0xfac21){var _0x292764=this;return new BPromise(function(_0x148fbb,_0x5dfeaf){var _0x588fbc=uuid['v4']();var _0x4cc926=ut[_0x342d('0x64')](_0x32021c,_0xfac21);_0x292764[_0x342d('0xd')][_0x588fbc]=new Action(_0x588fbc,_0xfac21,_0x32021c);var _0x333cf2=_0x292764['actions'][_0x588fbc];if(path[_0x342d('0x35')](_0x32021c[_0x342d('0x5c')])[_0x342d('0x65')]===_0x342d('0x39')){originate(_0x333cf2,_0x4cc926,!![])['then'](function(_0x3bbd10){_0x148fbb(_0x3bbd10);})[_0x342d('0x3d')](function(_0x4e8fcf){_0x5dfeaf(_0x4e8fcf);});}else{originate(_0x333cf2,_0x4cc926,![])[_0x342d('0x45')](function(_0x109b25){_0x148fbb(_0x109b25);})['catch'](function(_0x34bfa4){_0x5dfeaf(_0x34bfa4);});}});};Fax[_0x342d('0x1d')][_0x342d('0x66')]=function(_0x4603f2){return!_[_0x342d('0x67')](_0x4603f2)&&!_[_0x342d('0x67')](_0x4603f2[_0x342d('0x24')])&&!_[_0x342d('0x67')](_0x4603f2['active'])&&_0x4603f2[_0x342d('0x68')]&&!_[_0x342d('0x67')](this[_0x342d('0xc')][util[_0x342d('0x5a')](_0x342d('0x69'),_0x4603f2[_0x342d('0x24')])])&&!_['isNil'](this[_0x342d('0xc')][util[_0x342d('0x5a')](_0x342d('0x69'),_0x4603f2[_0x342d('0x24')])][_0x342d('0x2c')])&&(this[_0x342d('0xc')][util[_0x342d('0x5a')](_0x342d('0x69'),_0x4603f2[_0x342d('0x24')])][_0x342d('0x2c')]===_0x342d('0x6a')||this[_0x342d('0xc')][util[_0x342d('0x5a')](_0x342d('0x69'),_0x4603f2[_0x342d('0x24')])][_0x342d('0x2c')]===_0x342d('0x6b'));};Fax[_0x342d('0x1d')][_0x342d('0x57')]=function(_0x25dda4,_0x570a17){if(!this[_0x342d('0x66')](_0x25dda4)){ut['logger'](_0x342d('0x6c'),_[_0x342d('0x67')](_0x25dda4)?'':_0x25dda4['name']+_0x342d('0x6d'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x342d('0x67')](_0x570a17[_0x342d('0x38')])){ut['logger'](_0x342d('0x6e'),JSON['stringify'](_0x570a17));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x342d('0x67')](_0x570a17[_0x342d('0x5c')])){ut['logger'](_0x342d('0x6f'),JSON['stringify'](_0x570a17));return{'isValid':![],'message':_0x342d('0x70')};}return{'isValid':!![],'message':_0x342d('0x71')};};module[_0x342d('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 4d1d5c5..766ddc8 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 _0x4601=['preview','lodash','../rpc/faxAccount','error','notify','then','catch','[Notify]\x20','../../../config/logger'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x4601,0xaa));var _0x1460=function(_0x26ca3d,_0x268075){_0x26ca3d=_0x26ca3d-0x0;var _0x3a23cd=_0x4601[_0x26ca3d];return _0x3a23cd;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x1460('0x0'))(_0x1460('0x1'));var _=require(_0x1460('0x2'));var faxAccount=require(_0x1460('0x3'));function loggerCatch(_0x5d7abb){return function(_0xc75639){logger[_0x1460('0x4')](_0x5d7abb,util['inspect'](_0xc75639,{'showHidden':![],'depth':null}));};}exports[_0x1460('0x5')]=function(_0xf03a0a,_0x20d7b1){return BPromise['resolve']()[_0x1460('0x6')](faxAccount['notify'](_0xf03a0a,_0x20d7b1))[_0x1460('0x7')](loggerCatch(_0x1460('0x8')));}; \ No newline at end of file +var _0xbeba=['inspect','notify','resolve','then','catch','../../../config/logger','preview','lodash','error'];(function(_0x24c539,_0x132c61){var _0x336caa=function(_0x1abd55){while(--_0x1abd55){_0x24c539['push'](_0x24c539['shift']());}};_0x336caa(++_0x132c61);}(_0xbeba,0x68));var _0xabeb=function(_0x4a9048,_0x2c0d8c){_0x4a9048=_0x4a9048-0x0;var _0x173edf=_0xbeba[_0x4a9048];return _0x173edf;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xabeb('0x0'))(_0xabeb('0x1'));var _=require(_0xabeb('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2f5296){return function(_0x31c755){logger[_0xabeb('0x3')](_0x2f5296,util[_0xabeb('0x4')](_0x31c755,{'showHidden':![],'depth':null}));};}exports[_0xabeb('0x5')]=function(_0x3be54f,_0x450653){return BPromise[_0xabeb('0x6')]()[_0xabeb('0x7')](faxAccount[_0xabeb('0x5')](_0x3be54f,_0x450653))[_0xabeb('0x8')](loggerCatch('[Notify]\x20'));}; \ 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 3c8f24c..637f561 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 _0xcd0f=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax'];(function(_0x5b76b8,_0x3f9084){var _0xe1cb2c=function(_0x5f5cc0){while(--_0x5f5cc0){_0x5b76b8['push'](_0x5b76b8['shift']());}};_0xe1cb2c(++_0x3f9084);}(_0xcd0f,0xbc));var _0xfcd0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcd0f[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xfcd0('0x0'));var logger=require('../../../../config/logger')(_0xfcd0('0x1'));var BPromise=require(_0xfcd0('0x2'));var exec=require(_0xfcd0('0x3'))[_0xfcd0('0x4')];exports[_0xfcd0('0x5')]=function(_0x1fe960){return new BPromise(function(_0xc7e68f,_0x2570cb){exec(_0x1fe960,function(_0x1a949a,_0x52e7c6,_0x1edab2){logger[_0xfcd0('0x6')](_0xfcd0('0x7'),_0x52e7c6);if(_0x1a949a){logger[_0xfcd0('0x6')](_0xfcd0('0x7'),_0xfcd0('0x8'),util[_0xfcd0('0x9')](_0x1a949a,{'showHidden':![],'depth':null}),_0x52e7c6,_0x1edab2);_0x2570cb(_0x1a949a);}_0xc7e68f(_0x52e7c6);});});}; \ No newline at end of file +var _0xc5aa=['Exec\x20gs','info','\x20Error\x20:','inspect','../../../../config/logger','bluebird','child_process','exec','execute'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5aa,0xc1));var _0xac5a=function(_0x343065,_0x169907){_0x343065=_0x343065-0x0;var _0x1d208b=_0xc5aa[_0x343065];return _0x1d208b;};'use strict';var util=require('util');var logger=require(_0xac5a('0x0'))('fax');var BPromise=require(_0xac5a('0x1'));var exec=require(_0xac5a('0x2'))[_0xac5a('0x3')];exports[_0xac5a('0x4')]=function(_0x2f6f66){return new BPromise(function(_0x2f86b6,_0x2104a4){exec(_0x2f6f66,function(_0x4ce81b,_0x3a1620,_0x421ebd){logger['info'](_0xac5a('0x5'),_0x3a1620);if(_0x4ce81b){logger[_0xac5a('0x6')](_0xac5a('0x5'),_0xac5a('0x7'),util[_0xac5a('0x8')](_0x4ce81b,{'showHidden':![],'depth':null}),_0x3a1620,_0x421ebd);_0x2104a4(_0x4ce81b);}_0x2f86b6(_0x3a1620);});});}; \ 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 2dfd70b..05c8144 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 _0x0110=['fax','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','from-sip','\x22%s\x22\x20<%s>','lodash'];(function(_0x27dd44,_0xb55cf4){var _0x30a8e4=function(_0x320b07){while(--_0x320b07){_0x27dd44['push'](_0x27dd44['shift']());}};_0x30a8e4(++_0xb55cf4);}(_0x0110,0x107));var _0x0011=function(_0x583c16,_0x55c1f4){_0x583c16=_0x583c16-0x0;var _0x31e246=_0x0110[_0x583c16];return _0x31e246;};'use strict';var util=require('util');var _=require(_0x0011('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x0011('0x1'));exports['message']=function(_0x270c2d){return{'message':_0x270c2d};};exports[_0x0011('0x2')]=function(_0x43da5d,_0x1966a7){logger[_0x0011('0x3')](_0x43da5d,util[_0x0011('0x4')](_0x1966a7,{'showHidden':![],'depth':null}));};exports[_0x0011('0x5')]=function(_0x419d9b,_0x305695){var _0x514ec2={'XMF-ECM':_0x305695[_0x0011('0x6')],'XMF-HEADERINFO':_0x305695[_0x0011('0x7')],'XMF-MINRATE':_0x305695['minrate'],'XMF-MAXRATE':_0x305695[_0x0011('0x8')],'XMF-MODEM':util[_0x0011('0x9')](_0x0011('0xa'),_0x305695[_0x0011('0xb')]),'XMF-GATEWAY':_0x305695[_0x0011('0xc')],'XMF-FAXDETECT':_0x305695[_0x0011('0xd')],'XMF-T38TIMEOUT':_0x305695[_0x0011('0xe')],'XMF-LOCALSTATIONID':_0x305695[_0x0011('0xf')],'XMF-PATH':_0x419d9b[_0x0011('0x10')]};return _0x514ec2;};exports[_0x0011('0x11')]=function(_0x3acfaf,_0x3aa4ef){return{'actionid':_0x3acfaf[_0x0011('0x12')],'action':_0x0011('0x13'),'channel':_0x3acfaf['channel'],'Exten':'xcally-motion-fax','Context':_0x0011('0x14'),'Priority':'1','callerid':util['format'](_0x0011('0x15'),_0x3acfaf[_0x0011('0x7')]?_0x3acfaf['headerinfo']:'',_0x3acfaf[_0x0011('0xf')]),'variable':_0x3aa4ef,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3acfaf[_0x0011('0x12')]};}; \ No newline at end of file +var _0xb762=['from-sip','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message','logger','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x55ff21,_0x1540f0){var _0x4baf37=function(_0x51128b){while(--_0x51128b){_0x55ff21['push'](_0x55ff21['shift']());}};_0x4baf37(++_0x1540f0);}(_0xb762,0x128));var _0x2b76=function(_0x17c35a,_0x5f3cac){_0x17c35a=_0x17c35a-0x0;var _0x580a46=_0xb762[_0x17c35a];return _0x580a46;};'use strict';var util=require(_0x2b76('0x0'));var _=require(_0x2b76('0x1'));var moment=require('moment');var logger=require(_0x2b76('0x2'))(_0x2b76('0x3'));exports[_0x2b76('0x4')]=function(_0x2916fb){return{'message':_0x2916fb};};exports[_0x2b76('0x5')]=function(_0x5cb57b,_0x2ad1bf){logger['info'](_0x5cb57b,util['inspect'](_0x2ad1bf,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x213a1f,_0x2aca07){var _0x1bb539={'XMF-ECM':_0x2aca07[_0x2b76('0x6')],'XMF-HEADERINFO':_0x2aca07[_0x2b76('0x7')],'XMF-MINRATE':_0x2aca07[_0x2b76('0x8')],'XMF-MAXRATE':_0x2aca07[_0x2b76('0x9')],'XMF-MODEM':util[_0x2b76('0xa')](_0x2b76('0xb'),_0x2aca07[_0x2b76('0xc')]),'XMF-GATEWAY':_0x2aca07['gateway'],'XMF-FAXDETECT':_0x2aca07['faxdetect'],'XMF-T38TIMEOUT':_0x2aca07[_0x2b76('0xd')],'XMF-LOCALSTATIONID':_0x2aca07['localstationid'],'XMF-PATH':_0x213a1f[_0x2b76('0xe')]};return _0x1bb539;};exports['variablesAction']=function(_0x4898b8,_0x483988){return{'actionid':_0x4898b8[_0x2b76('0xf')],'action':_0x2b76('0x10'),'channel':_0x4898b8[_0x2b76('0x11')],'Exten':_0x2b76('0x12'),'Context':_0x2b76('0x13'),'Priority':'1','callerid':util[_0x2b76('0xa')](_0x2b76('0x14'),_0x4898b8[_0x2b76('0x7')]?_0x4898b8[_0x2b76('0x7')]:'',_0x4898b8['localstationid']),'variable':_0x483988,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4898b8[_0x2b76('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 7c08319..6527903 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 _0x8387=['moment','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','catch','util'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x8387,0x15d));var _0x7838=function(_0x12a24f,_0x819b79){_0x12a24f=_0x12a24f-0x0;var _0x526080=_0x8387[_0x12a24f];return _0x526080;};'use strict';var util=require(_0x7838('0x0'));var moment=require(_0x7838('0x1'));var server=require('./server');var Realtime=require(_0x7838('0x2'));var Report=require(_0x7838('0x3'));var Acw=require(_0x7838('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x7838('0x5'));var Preview=require(_0x7838('0x6'));var Fax=require(_0x7838('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x7838('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x7838('0x9'));var template=require(_0x7838('0xa'));var cmHopperHistory=require(_0x7838('0xb'));var campaign=require(_0x7838('0xc'));var voiceExtension=require(_0x7838('0xd'));var faxAccount=require(_0x7838('0xe'));var zendesk=require(_0x7838('0xf'));var salesforce=require(_0x7838('0x10'));var sugarcrm=require(_0x7838('0x11'));var freshdesk=require(_0x7838('0x12'));var desk=require(_0x7838('0x13'));var zoho=require(_0x7838('0x14'));var vtiger=require(_0x7838('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7838('0x16'));var dynamics365=require(_0x7838('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x7838('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7838('0x19')](_0x7838('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7838('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7838('0x1b')]()[_0x7838('0x1c')](user[_0x7838('0x1d')]())[_0x7838('0x1c')](realtime[_0x7838('0x1e')]())[_0x7838('0x1c')](user['getTelephones']())[_0x7838('0x1c')](realtime[_0x7838('0x1f')]())[_0x7838('0x1c')](trunk['getTrunks']())[_0x7838('0x1c')](realtime[_0x7838('0x20')]())[_0x7838('0x1c')](voiceQueue[_0x7838('0x21')]())[_0x7838('0x1c')](realtime[_0x7838('0x22')]())[_0x7838('0x1c')](trigger[_0x7838('0x23')]())[_0x7838('0x1c')](realtime[_0x7838('0x24')]())['then'](template[_0x7838('0x25')]())[_0x7838('0x1c')](realtime[_0x7838('0x26')]())['then'](zendesk[_0x7838('0x27')]())['then'](realtime[_0x7838('0x28')]())['then'](salesforce[_0x7838('0x29')]())['then'](realtime[_0x7838('0x2a')]())[_0x7838('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0x7838('0x1c')](realtime[_0x7838('0x2b')]())[_0x7838('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0x7838('0x1c')](desk['getDeskAccounts']())[_0x7838('0x1c')](realtime[_0x7838('0x2c')]())['then'](zoho[_0x7838('0x2d')]())['then'](realtime[_0x7838('0x2e')]())[_0x7838('0x1c')](vtiger[_0x7838('0x2f')]())[_0x7838('0x1c')](realtime[_0x7838('0x30')]())[_0x7838('0x1c')](freshsales[_0x7838('0x31')]())['then'](realtime[_0x7838('0x32')]())[_0x7838('0x1c')](servicenow['getServicenowAccounts']())[_0x7838('0x1c')](realtime['initServicenowAccounts']())[_0x7838('0x1c')](dynamics365[_0x7838('0x33')]())[_0x7838('0x1c')](realtime[_0x7838('0x34')]())[_0x7838('0x1c')](campaign[_0x7838('0x35')]())[_0x7838('0x1c')](realtime['initCampaigns']())[_0x7838('0x1c')](voiceExtension[_0x7838('0x36')]())[_0x7838('0x1c')](realtime[_0x7838('0x37')]())[_0x7838('0x1c')](faxAccount[_0x7838('0x38')]())[_0x7838('0x1c')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0x7838('0x1b')]()[_0x7838('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x7838('0x1c')](realtime[_0x7838('0x39')]())[_0x7838('0x1c')](cmHopperHistory[_0x7838('0x3a')]())[_0x7838('0x1c')](realtime[_0x7838('0x3b')]())[_0x7838('0x1c')](cmHopperHistory[_0x7838('0x3c')]())[_0x7838('0x1c')](realtime[_0x7838('0x3d')]())['then'](voiceCallReport[_0x7838('0x3e')]())[_0x7838('0x1c')](realtime[_0x7838('0x3f')]())['catch'](function(_0x379fe0){logger[_0x7838('0x40')](_0x7838('0x41'),util[_0x7838('0x42')](_0x379fe0,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7838('0x43')](realtime,preview,fax)[_0x7838('0x1c')](function(){return initRealtime();})[_0x7838('0x1c')](function(){return initParams();})[_0x7838('0x1c')](function(){report[_0x7838('0x44')]();setInterval(initRealtime,0x1388);})[_0x7838('0x45')](function(_0x2e8050){logger[_0x7838('0x40')]('[index.js][main]',util[_0x7838('0x42')](_0x2e8050,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x743e=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','listen','sync','catch','error','[index.js][main]','moment','./server','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','then','initAgents','getTelephones','getTrunks','getVoiceQueues','getTriggers','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x743e,0x125));var _0xe743=function(_0x26c3cb,_0x66682f){_0x26c3cb=_0x26c3cb-0x0;var _0x2cb4ad=_0x743e[_0x26c3cb];return _0x2cb4ad;};'use strict';var util=require('util');var moment=require(_0xe743('0x0'));var server=require(_0xe743('0x1'));var Realtime=require('./realtime');var Report=require(_0xe743('0x2'));var Acw=require(_0xe743('0x3'));var Trigger=require('./trigger');var Dialer=require(_0xe743('0x4'));var Preview=require(_0xe743('0x5'));var Fax=require('./fax');var user=require(_0xe743('0x6'));var voiceQueue=require(_0xe743('0x7'));var voiceQueueReport=require(_0xe743('0x8'));var voiceCallReport=require(_0xe743('0x9'));var trunk=require(_0xe743('0xa'));var trigger=require(_0xe743('0xb'));var template=require(_0xe743('0xc'));var cmHopperHistory=require(_0xe743('0xd'));var campaign=require(_0xe743('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xe743('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xe743('0x10'));var sugarcrm=require(_0xe743('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe743('0x12'));var zoho=require(_0xe743('0x13'));var vtiger=require(_0xe743('0x14'));var freshsales=require(_0xe743('0x15'));var servicenow=require(_0xe743('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe743('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe743('0x17')](_0xe743('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xe743('0x19')](user['getAgents']())[_0xe743('0x19')](realtime[_0xe743('0x1a')]())[_0xe743('0x19')](user[_0xe743('0x1b')]())['then'](realtime['initTelephones']())['then'](trunk[_0xe743('0x1c')]())[_0xe743('0x19')](realtime['initTrunks']())['then'](voiceQueue[_0xe743('0x1d')]())[_0xe743('0x19')](realtime['initVoiceQueues']())['then'](trigger[_0xe743('0x1e')]())[_0xe743('0x19')](realtime['initTriggers']())[_0xe743('0x19')](template['getTemplates']())[_0xe743('0x19')](realtime['initTemplates']())[_0xe743('0x19')](zendesk['getZendeskAccounts']())['then'](realtime[_0xe743('0x1f')]())[_0xe743('0x19')](salesforce['getSalesforceAccounts']())['then'](realtime[_0xe743('0x20')]())[_0xe743('0x19')](sugarcrm[_0xe743('0x21')]())[_0xe743('0x19')](realtime[_0xe743('0x22')]())['then'](freshdesk[_0xe743('0x23')]())[_0xe743('0x19')](realtime[_0xe743('0x24')]())['then'](desk[_0xe743('0x25')]())[_0xe743('0x19')](realtime[_0xe743('0x26')]())[_0xe743('0x19')](zoho[_0xe743('0x27')]())[_0xe743('0x19')](realtime[_0xe743('0x28')]())[_0xe743('0x19')](vtiger[_0xe743('0x29')]())[_0xe743('0x19')](realtime[_0xe743('0x2a')]())[_0xe743('0x19')](freshsales[_0xe743('0x2b')]())[_0xe743('0x19')](realtime[_0xe743('0x2c')]())['then'](servicenow[_0xe743('0x2d')]())[_0xe743('0x19')](realtime[_0xe743('0x2e')]())[_0xe743('0x19')](dynamics365[_0xe743('0x2f')]())[_0xe743('0x19')](realtime[_0xe743('0x30')]())[_0xe743('0x19')](campaign[_0xe743('0x31')]())[_0xe743('0x19')](realtime['initCampaigns']())[_0xe743('0x19')](voiceExtension[_0xe743('0x32')]())[_0xe743('0x19')](realtime[_0xe743('0x33')]())[_0xe743('0x19')](faxAccount[_0xe743('0x34')]())[_0xe743('0x19')](realtime[_0xe743('0x35')]())[_0xe743('0x19')](function(){return realtime;});}function initParams(){return Promise[_0xe743('0x36')]()[_0xe743('0x19')](voiceQueueReport[_0xe743('0x37')]())[_0xe743('0x19')](realtime[_0xe743('0x38')]())['then'](cmHopperHistory[_0xe743('0x39')]())[_0xe743('0x19')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xe743('0x19')](realtime[_0xe743('0x3a')]())[_0xe743('0x19')](voiceCallReport[_0xe743('0x3b')]())[_0xe743('0x19')](realtime[_0xe743('0x3c')]())['catch'](function(_0x4f334f){logger['error'](_0xe743('0x3d'),util[_0xe743('0x3e')](_0x4f334f,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe743('0x3f')](realtime,preview,fax)[_0xe743('0x19')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xe743('0x19')](function(){report[_0xe743('0x40')]();setInterval(initRealtime,0x1388);})[_0xe743('0x41')](function(_0x11892d){logger[_0xe743('0x42')](_0xe743('0x43'),util[_0xe743('0x3e')](_0x11892d,{'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 964f654..f88511f 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 _0x2867=['../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','voiceStatus','toNumber','format','status','stringify','emit','user:ami:update','omit','user:presence','exports','lodash','moment','md5','ioredis'];(function(_0x1406a8,_0x1d8027){var _0x136ed8=function(_0x4c625f){while(--_0x4c625f){_0x1406a8['push'](_0x1406a8['shift']());}};_0x136ed8(++_0x1d8027);}(_0x2867,0xc4));var _0x7286=function(_0x198541,_0x2e1dea){_0x198541=_0x198541-0x0;var _0x24c19a=_0x2867[_0x198541];return _0x24c19a;};'use strict';var _=require(_0x7286('0x0'));var util=require('util');var moment=require(_0x7286('0x1'));var md5=require(_0x7286('0x2'));var Redis=require(_0x7286('0x3'));var config=require(_0x7286('0x4'));config[_0x7286('0x5')]=_['defaults'](config[_0x7286('0x5')],{'host':_0x7286('0x6'),'port':0x18eb});var io=require(_0x7286('0x7'))(new Redis(config[_0x7286('0x5')]));function Agent(_0x122a24){this['id']=_0x122a24['id']||0x0;this['name']=_0x122a24[_0x7286('0x8')]||'';this[_0x7286('0x9')]=_0x122a24[_0x7286('0x9')]||'';this[_0x7286('0xa')]=_0x122a24['accountcode']||'';this[_0x7286('0xb')]=_0x122a24[_0x7286('0xb')]||'';this[_0x7286('0xc')]='unknown';this[_0x7286('0xd')]=0x0;this['status']=_0x7286('0xe');this[_0x7286('0xf')]='';this[_0x7286('0x10')]='';this[_0x7286('0x11')]='';this[_0x7286('0x12')]='';this[_0x7286('0x13')]=_0x122a24[_0x7286('0x13')]||![];this['voiceStatus']=_0x7286('0xe');this[_0x7286('0x14')]=0x0;this[_0x7286('0x15')]='';this[_0x7286('0x16')]='';this[_0x7286('0x17')]=![];this['local']=![];this[_0x7286('0x2')]='';}Agent[_0x7286('0x18')][_0x7286('0x19')]=function(_0x405248){var _0x3c53a2;if(_0x405248&&_0x405248[_0x7286('0xc')]){_0x3c53a2=_0x405248[_0x7286('0xc')]['toLowerCase']();switch(_0x3c53a2){case _0x7286('0x1a'):_0x3c53a2=_0x7286('0x1b');break;case _0x7286('0x1c'):_0x3c53a2=_0x7286('0x1d');break;}}if(_0x3c53a2&&this[_0x7286('0x1e')]!==_0x3c53a2||_0x405248['statePause']){this['voiceStatusTime']=_[_0x7286('0x1f')](moment()[_0x7286('0x20')]('x'));}if(_0x3c53a2){this['voiceStatus']=_0x3c53a2;}var _0x5d01ba={'id':this['id'],'name':this[_0x7286('0x8')],'email':this[_0x7286('0x9')],'accountcode':this[_0x7286('0xa')],'fullname':this['fullname'],'state':this[_0x7286('0xc')],'stateTime':this[_0x7286('0xd')],'status':this[_0x7286('0x21')],'address':this[_0x7286('0xf')],'online':this[_0x7286('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x7286('0x14')],'voiceStatusCallerIdNumber':this[_0x7286('0x15')],'voiceStatusQueue':this[_0x7286('0x16')],'interface':this[_0x7286('0x12')],'onhold':this[_0x7286('0x17')]};var _0x2fde1d=md5(JSON[_0x7286('0x22')](_0x5d01ba));if(this[_0x7286('0x2')]!==_0x2fde1d){this[_0x7286('0x2')]=_0x2fde1d;io['to'](util['format']('user:%s',_0x5d01ba[_0x7286('0x8')]))[_0x7286('0x23')](_0x7286('0x24'),_[_0x7286('0x25')](_0x5d01ba,[_0x7286('0x13')]));io['emit'](_0x7286('0x26'),_0x5d01ba);}};module[_0x7286('0x27')]=Agent; \ No newline at end of file +var _0x9740=['voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','state','idle','inuse','statePause','toNumber','format','status','stringify','user:%s','user:ami:update','omit','emit','exports','lodash','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','unknown','address','phone','mobile','interface','online'];(function(_0x1a2cce,_0xda7ae5){var _0x208a76=function(_0x4032ce){while(--_0x4032ce){_0x1a2cce['push'](_0x1a2cce['shift']());}};_0x208a76(++_0xda7ae5);}(_0x9740,0x84));var _0x0974=function(_0x24c7ab,_0x1a44d0){_0x24c7ab=_0x24c7ab-0x0;var _0x3bf4c4=_0x9740[_0x24c7ab];return _0x3bf4c4;};'use strict';var _=require(_0x0974('0x0'));var util=require(_0x0974('0x1'));var moment=require(_0x0974('0x2'));var md5=require(_0x0974('0x3'));var Redis=require(_0x0974('0x4'));var config=require('../../../config/environment');config[_0x0974('0x5')]=_[_0x0974('0x6')](config['redis'],{'host':_0x0974('0x7'),'port':0x18eb});var io=require(_0x0974('0x8'))(new Redis(config[_0x0974('0x5')]));function Agent(_0x3f1fb9){this['id']=_0x3f1fb9['id']||0x0;this[_0x0974('0x9')]=_0x3f1fb9['name']||'';this[_0x0974('0xa')]=_0x3f1fb9['email']||'';this['accountcode']=_0x3f1fb9[_0x0974('0xb')]||'';this[_0x0974('0xc')]=_0x3f1fb9[_0x0974('0xc')]||'';this['state']='unknown';this[_0x0974('0xd')]=0x0;this['status']=_0x0974('0xe');this[_0x0974('0xf')]='';this[_0x0974('0x10')]='';this[_0x0974('0x11')]='';this[_0x0974('0x12')]='';this[_0x0974('0x13')]=_0x3f1fb9[_0x0974('0x13')]||![];this[_0x0974('0x14')]=_0x0974('0xe');this[_0x0974('0x15')]=0x0;this[_0x0974('0x16')]='';this['voiceStatusQueue']='';this[_0x0974('0x17')]=![];this[_0x0974('0x18')]=![];this[_0x0974('0x3')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x521642){var _0x3abcca;if(_0x521642&&_0x521642[_0x0974('0x19')]){_0x3abcca=_0x521642[_0x0974('0x19')]['toLowerCase']();switch(_0x3abcca){case'not_inuse':_0x3abcca=_0x0974('0x1a');break;case _0x0974('0x1b'):_0x3abcca='talking';break;}}if(_0x3abcca&&this[_0x0974('0x14')]!==_0x3abcca||_0x521642[_0x0974('0x1c')]){this[_0x0974('0x15')]=_[_0x0974('0x1d')](moment()[_0x0974('0x1e')]('x'));}if(_0x3abcca){this[_0x0974('0x14')]=_0x3abcca;}var _0x45557c={'id':this['id'],'name':this[_0x0974('0x9')],'email':this[_0x0974('0xa')],'accountcode':this[_0x0974('0xb')],'fullname':this[_0x0974('0xc')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x0974('0x1f')],'address':this[_0x0974('0xf')],'online':this[_0x0974('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x0974('0x15')],'voiceStatusCallerIdNumber':this[_0x0974('0x16')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x0974('0x12')],'onhold':this[_0x0974('0x17')]};var _0x4ec343=md5(JSON[_0x0974('0x20')](_0x45557c));if(this['md5']!==_0x4ec343){this[_0x0974('0x3')]=_0x4ec343;io['to'](util[_0x0974('0x1e')](_0x0974('0x21'),_0x45557c[_0x0974('0x9')]))['emit'](_0x0974('0x22'),_[_0x0974('0x23')](_0x45557c,[_0x0974('0x13')]));io[_0x0974('0x24')]('user:presence',_0x45557c);}};module[_0x0974('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b439b01..a51b589 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 _0x7607=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x35db5e,_0x2a8ffd){var _0x3834a6=function(_0x5116a8){while(--_0x5116a8){_0x35db5e['push'](_0x35db5e['shift']());}};_0x3834a6(++_0x2a8ffd);}(_0x7607,0xc6));var _0x7760=function(_0x424f6c,_0x2d43f3){_0x424f6c=_0x424f6c-0x0;var _0x423da8=_0x7607[_0x424f6c];return _0x423da8;};'use strict';function Campaign(_0x37a620){this['id']=_0x37a620['id']||0x0;this[_0x7760('0x0')]=_0x37a620['name']||'';this[_0x7760('0x1')]=_0x37a620[_0x7760('0x1')]||_0x7760('0x2');this[_0x7760('0x3')]=0x0;this[_0x7760('0x4')]=0x0;this[_0x7760('0x5')]=0x0;this[_0x7760('0x6')]=0x0;this['message']='';this[_0x7760('0x7')]=!![];this[_0x7760('0x8')]=_0x37a620['active'];this[_0x7760('0x9')]=_0x37a620[_0x7760('0x9')];this[_0x7760('0xa')]=_0x37a620[_0x7760('0xa')]||null;this[_0x7760('0xb')]=_0x37a620[_0x7760('0xb')]?_0x37a620[_0x7760('0xb')]:null;this[_0x7760('0xc')]=_0x37a620['dialOriginateCallerIdName'];this[_0x7760('0xd')]=_0x37a620[_0x7760('0xd')];this['dialOriginateTimeout']=_0x37a620[_0x7760('0xe')]||0x1e;this[_0x7760('0xf')]=_0x37a620[_0x7760('0xf')];this[_0x7760('0x10')]=_0x37a620['dialCongestionRetryFrequency'];this[_0x7760('0x11')]=_0x37a620[_0x7760('0x11')];this[_0x7760('0x12')]=_0x37a620[_0x7760('0x12')];this[_0x7760('0x13')]=_0x37a620['dialNoAnswerMaxRetry'];this[_0x7760('0x14')]=_0x37a620['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x37a620['dialGlobalMaxRetry'];this[_0x7760('0x15')]=_0x37a620[_0x7760('0x15')]||0x3;this[_0x7760('0x16')]=_0x37a620[_0x7760('0x16')]||0x96;this[_0x7760('0x17')]=_0x37a620[_0x7760('0x17')]||0x3;this[_0x7760('0x18')]=_0x37a620[_0x7760('0x18')]||0x96;this[_0x7760('0x19')]=_0x37a620[_0x7760('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x37a620[_0x7760('0x1a')]||0x96;this[_0x7760('0x1b')]=_0x37a620['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x37a620[_0x7760('0x1c')]||0x96;this[_0x7760('0x1d')]=_0x37a620[_0x7760('0x1d')]||0x3;this[_0x7760('0x1e')]=_0x37a620[_0x7760('0x1e')]||0x96;this[_0x7760('0x1f')]=_0x37a620[_0x7760('0x1f')]||_0x7760('0x20');this['dialPrefix']=_0x37a620['dialPrefix']||undefined;this[_0x7760('0x21')]=_0x37a620['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x37a620['dialCutDigit']||undefined;this[_0x7760('0x22')]=_0x37a620[_0x7760('0x22')]?_0x37a620['TrunkBackup']:undefined;this[_0x7760('0x23')]=_0x37a620[_0x7760('0x23')]?_0x37a620[_0x7760('0x23')]:undefined;this[_0x7760('0x24')]=_0x37a620[_0x7760('0x24')]?_0x37a620[_0x7760('0x24')]:undefined;this['SquareProject']=_0x37a620[_0x7760('0x25')]?_0x37a620[_0x7760('0x25')]:undefined;this[_0x7760('0x26')]=_0x37a620[_0x7760('0x25')]?_0x37a620[_0x7760('0x25')]['name']:undefined;this[_0x7760('0x27')]=_0x37a620['dialAMDActive']||![];this[_0x7760('0x28')]=_0x37a620['dialAMDInitialSilence'];this[_0x7760('0x29')]=_0x37a620[_0x7760('0x29')];this[_0x7760('0x2a')]=_0x37a620[_0x7760('0x2a')];this[_0x7760('0x2b')]=_0x37a620[_0x7760('0x2b')];this[_0x7760('0x2c')]=_0x37a620[_0x7760('0x2c')];this[_0x7760('0x2d')]=_0x37a620[_0x7760('0x2d')];this[_0x7760('0x2e')]=_0x37a620[_0x7760('0x2e')];this['dialAMDSilenceThreshold']=_0x37a620['dialAMDSilenceThreshold'];this[_0x7760('0x2f')]=_0x37a620['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xc01c=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0xfc3e1d,_0x217955){var _0xe90e7=function(_0x4929d3){while(--_0x4929d3){_0xfc3e1d['push'](_0xfc3e1d['shift']());}};_0xe90e7(++_0x217955);}(_0xc01c,0x184));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x3afeed){this['id']=_0x3afeed['id']||0x0;this[_0xcc01('0x0')]=_0x3afeed[_0xcc01('0x0')]||'';this[_0xcc01('0x1')]=_0x3afeed[_0xcc01('0x1')]||_0xcc01('0x2');this[_0xcc01('0x3')]=0x0;this[_0xcc01('0x4')]=0x0;this[_0xcc01('0x5')]=0x0;this[_0xcc01('0x6')]=0x0;this['message']='';this[_0xcc01('0x7')]=!![];this[_0xcc01('0x8')]=_0x3afeed['active'];this['limitCalls']=_0x3afeed[_0xcc01('0x9')];this['dialTimezone']=_0x3afeed[_0xcc01('0xa')]||null;this['dialGlobalInterval']=_0x3afeed[_0xcc01('0xb')]?_0x3afeed[_0xcc01('0xb')]:null;this[_0xcc01('0xc')]=_0x3afeed[_0xcc01('0xc')];this[_0xcc01('0xd')]=_0x3afeed[_0xcc01('0xd')];this[_0xcc01('0xe')]=_0x3afeed[_0xcc01('0xe')]||0x1e;this[_0xcc01('0xf')]=_0x3afeed[_0xcc01('0xf')];this['dialCongestionRetryFrequency']=_0x3afeed[_0xcc01('0x10')];this[_0xcc01('0x11')]=_0x3afeed[_0xcc01('0x11')];this[_0xcc01('0x12')]=_0x3afeed[_0xcc01('0x12')];this[_0xcc01('0x13')]=_0x3afeed['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x3afeed[_0xcc01('0x14')];this[_0xcc01('0x15')]=_0x3afeed['dialGlobalMaxRetry'];this[_0xcc01('0x16')]=_0x3afeed[_0xcc01('0x16')]||0x3;this[_0xcc01('0x17')]=_0x3afeed[_0xcc01('0x17')]||0x96;this[_0xcc01('0x18')]=_0x3afeed[_0xcc01('0x18')]||0x3;this['dialDropRetryFrequency']=_0x3afeed[_0xcc01('0x19')]||0x96;this[_0xcc01('0x1a')]=_0x3afeed[_0xcc01('0x1a')]||0x3;this[_0xcc01('0x1b')]=_0x3afeed[_0xcc01('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x3afeed[_0xcc01('0x1c')]||0x3;this[_0xcc01('0x1d')]=_0x3afeed[_0xcc01('0x1d')]||0x96;this[_0xcc01('0x1e')]=_0x3afeed['dialAgentRejectMaxRetry']||0x3;this[_0xcc01('0x1f')]=_0x3afeed['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x3afeed[_0xcc01('0x20')]||_0xcc01('0x21');this[_0xcc01('0x22')]=_0x3afeed[_0xcc01('0x22')]||undefined;this[_0xcc01('0x23')]=_0x3afeed['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xcc01('0x24')]=_0x3afeed[_0xcc01('0x24')]||undefined;this[_0xcc01('0x25')]=_0x3afeed['TrunkBackup']?_0x3afeed[_0xcc01('0x25')]:undefined;this[_0xcc01('0x26')]=_0x3afeed[_0xcc01('0x26')]?_0x3afeed['Trunk']:undefined;this[_0xcc01('0x27')]=_0x3afeed[_0xcc01('0x27')]?_0x3afeed[_0xcc01('0x27')]:undefined;this[_0xcc01('0x28')]=_0x3afeed[_0xcc01('0x28')]?_0x3afeed['SquareProject']:undefined;this[_0xcc01('0x29')]=_0x3afeed['SquareProject']?_0x3afeed[_0xcc01('0x28')][_0xcc01('0x0')]:undefined;this[_0xcc01('0x2a')]=_0x3afeed[_0xcc01('0x2a')]||![];this[_0xcc01('0x2b')]=_0x3afeed[_0xcc01('0x2b')];this['dialAMDGreeting']=_0x3afeed[_0xcc01('0x2c')];this[_0xcc01('0x2d')]=_0x3afeed['dialAMDAfterGreetingSilence'];this[_0xcc01('0x2e')]=_0x3afeed[_0xcc01('0x2e')];this['dialAMDMinWordLength']=_0x3afeed[_0xcc01('0x2f')];this[_0xcc01('0x30')]=_0x3afeed['dialAMDBetweenWordsSilence'];this[_0xcc01('0x31')]=_0x3afeed[_0xcc01('0x31')];this[_0xcc01('0x32')]=_0x3afeed[_0xcc01('0x32')];this[_0xcc01('0x33')]=_0x3afeed[_0xcc01('0x33')];}module[_0xcc01('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8b6c9fc..0088586 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 _0xa32b=['queue','transfercalleridnum','mohtime','exports','starttime','destinationchannel','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','lastapplication','lastdata','duration','billableseconds','monitor'];(function(_0x21c1ca,_0x346fb1){var _0x26a416=function(_0x333302){while(--_0x333302){_0x21c1ca['push'](_0x21c1ca['shift']());}};_0x26a416(++_0x346fb1);}(_0xa32b,0x68));var _0xba32=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0xa32b[_0x1265fa];return _0x1fe35e;};'use strict';function Channel(){this[_0xba32('0x0')]=null;this['channel']='';this[_0xba32('0x1')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0xba32('0x2')]=undefined;this[_0xba32('0x3')]=undefined;this[_0xba32('0x4')]=0x0;this['context']='';this[_0xba32('0x5')]=0x0;this[_0xba32('0x6')]=0x0;this[_0xba32('0x7')]=0x0;this[_0xba32('0x8')]=![];this[_0xba32('0x9')]=null;this['endtime']=null;this[_0xba32('0xa')]=![];this['abandoned']=![];this[_0xba32('0xb')]='';this[_0xba32('0xc')]='';this[_0xba32('0xd')]=0x0;this[_0xba32('0xe')]=0x0;this['holdtime']=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0xba32('0xf')]=![];this['monitorFilename']=null;this[_0xba32('0x10')]=null;this['monitors']=[];this[_0xba32('0x11')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0xba32('0x12')]=0x0;}module[_0xba32('0x13')]=Channel; \ No newline at end of file +var _0xa9fc=['abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','context','uniqueid','answertime','unmanaged'];(function(_0x4e7174,_0x38e967){var _0x220d4f=function(_0x3446db){while(--_0x3446db){_0x4e7174['push'](_0x4e7174['shift']());}};_0x220d4f(++_0x38e967);}(_0xa9fc,0x19f));var _0xca9f=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0xa9fc[_0x39cd3c];return _0x47a0ae;};'use strict';function Channel(){this[_0xca9f('0x0')]=null;this[_0xca9f('0x1')]='';this[_0xca9f('0x2')]='';this[_0xca9f('0x3')]=0x0;this[_0xca9f('0x4')]='';this['connectedlinenum']=undefined;this[_0xca9f('0x5')]=undefined;this['accountcode']=0x0;this[_0xca9f('0x6')]='';this[_0xca9f('0x7')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this['answered']=![];this[_0xca9f('0x8')]=null;this['endtime']=null;this[_0xca9f('0x9')]=![];this[_0xca9f('0xa')]=![];this[_0xca9f('0xb')]='';this[_0xca9f('0xc')]='';this[_0xca9f('0xd')]=0x0;this[_0xca9f('0xe')]=0x0;this[_0xca9f('0xf')]=0x0;this[_0xca9f('0x10')]=null;this['tag']=null;this[_0xca9f('0x11')]=null;this[_0xca9f('0x12')]=![];this[_0xca9f('0x13')]=null;this[_0xca9f('0x14')]=null;this['monitors']=[];this[_0xca9f('0x15')]=undefined;this[_0xca9f('0x16')]=undefined;this['transferType']=undefined;this[_0xca9f('0x17')]=0x0;}module[_0xca9f('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 821bdb1..59658d4 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 _0x39c0=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x257037,_0x5cdce0){var _0x4d871e=function(_0xdcb8ff){while(--_0xdcb8ff){_0x257037['push'](_0x257037['shift']());}};_0x4d871e(++_0x5cdce0);}(_0x39c0,0xc8));var _0x039c=function(_0x1f3af4,_0x552c3d){_0x1f3af4=_0x1f3af4-0x0;var _0x3629aa=_0x39c0[_0x1f3af4];return _0x3629aa;};'use strict';function DeskAccount(_0x46da29){this['id']=_0x46da29['id']||0x0;this[_0x039c('0x0')]=_0x46da29['name']||'';this[_0x039c('0x1')]=_0x46da29[_0x039c('0x1')]||'';this['remoteUri']=_0x46da29[_0x039c('0x2')]||'';this[_0x039c('0x3')]=_0x46da29[_0x039c('0x3')]||'';this[_0x039c('0x4')]=_0x46da29['password']||'';this[_0x039c('0x5')]=_0x46da29[_0x039c('0x5')]||'';this[_0x039c('0x6')]=_0x46da29[_0x039c('0x6')]||'';this[_0x039c('0x7')]=_0x46da29[_0x039c('0x7')]||'';this[_0x039c('0x8')]=_0x46da29[_0x039c('0x8')]||'';this[_0x039c('0x9')]=_0x46da29['type']||'';this[_0x039c('0xa')]=_0x46da29[_0x039c('0xa')]||'';this[_0x039c('0xb')]=_0x46da29[_0x039c('0xb')]||{};}module[_0x039c('0xc')]=DeskAccount; \ No newline at end of file +var _0xd8d5=['token','tokenSecret','type','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x33e7de,_0xc5ee96){var _0x3461ba=function(_0x4571a0){while(--_0x4571a0){_0x33e7de['push'](_0x33e7de['shift']());}};_0x3461ba(++_0xc5ee96);}(_0xd8d5,0xd1));var _0x5d8d=function(_0x4fe71b,_0x943c8c){_0x4fe71b=_0x4fe71b-0x0;var _0x240a85=_0xd8d5[_0x4fe71b];return _0x240a85;};'use strict';function DeskAccount(_0x4618d0){this['id']=_0x4618d0['id']||0x0;this['name']=_0x4618d0[_0x5d8d('0x0')]||'';this['username']=_0x4618d0[_0x5d8d('0x1')]||'';this[_0x5d8d('0x2')]=_0x4618d0[_0x5d8d('0x2')]||'';this[_0x5d8d('0x3')]=_0x4618d0[_0x5d8d('0x3')]||'';this['password']=_0x4618d0[_0x5d8d('0x4')]||'';this['consumerKey']=_0x4618d0[_0x5d8d('0x5')]||'';this[_0x5d8d('0x6')]=_0x4618d0[_0x5d8d('0x6')]||'';this['token']=_0x4618d0[_0x5d8d('0x7')]||'';this[_0x5d8d('0x8')]=_0x4618d0['tokenSecret']||'';this[_0x5d8d('0x9')]=_0x4618d0['type']||'';this['serverUrl']=_0x4618d0['serverUrl']||'';this[_0x5d8d('0xa')]=_0x4618d0[_0x5d8d('0xa')]||{};}module[_0x5d8d('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 9556140..e2f412f 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 _0xf25d=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x3c98c7,_0x5cc20c){var _0x59d663=function(_0x40b5d6){while(--_0x40b5d6){_0x3c98c7['push'](_0x3c98c7['shift']());}};_0x59d663(++_0x5cc20c);}(_0xf25d,0xfa));var _0xdf25=function(_0x366d91,_0x4abd6c){_0x366d91=_0x366d91-0x0;var _0x11ac2c=_0xf25d[_0x366d91];return _0x11ac2c;};'use strict';function Dynamics365Account(_0x118511){this['id']=_0x118511['id']||0x0;this[_0xdf25('0x0')]=_0x118511[_0xdf25('0x0')]||'';this[_0xdf25('0x1')]=_0x118511['username']||'';this[_0xdf25('0x2')]=_0x118511[_0xdf25('0x2')]||'';this[_0xdf25('0x3')]=_0x118511[_0xdf25('0x3')]||'';this[_0xdf25('0x4')]=_0x118511['tenantId']||'';this[_0xdf25('0x5')]=_0x118511[_0xdf25('0x5')]||'';this[_0xdf25('0x6')]=_0x118511[_0xdf25('0x6')]||{};this['serverUrl']=_0x118511[_0xdf25('0x7')]||'';this[_0xdf25('0x8')]=_0x118511[_0xdf25('0x8')]||![];this[_0xdf25('0x9')]=_0x118511[_0xdf25('0x9')]||{};this[_0xdf25('0xa')]=_0x118511[_0xdf25('0xa')]||{};}module[_0xdf25('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x3f51=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x180113,_0x278c40){var _0x1835f3=function(_0x3efbbd){while(--_0x3efbbd){_0x180113['push'](_0x180113['shift']());}};_0x1835f3(++_0x278c40);}(_0x3f51,0x13a));var _0x13f5=function(_0x5c0c18,_0x510b7c){_0x5c0c18=_0x5c0c18-0x0;var _0x1da780=_0x3f51[_0x5c0c18];return _0x1da780;};'use strict';function Dynamics365Account(_0x1bb93c){this['id']=_0x1bb93c['id']||0x0;this[_0x13f5('0x0')]=_0x1bb93c[_0x13f5('0x0')]||'';this[_0x13f5('0x1')]=_0x1bb93c['username']||'';this['password']=_0x1bb93c[_0x13f5('0x2')]||'';this[_0x13f5('0x3')]=_0x1bb93c[_0x13f5('0x3')]||'';this[_0x13f5('0x4')]=_0x1bb93c[_0x13f5('0x4')]||'';this['clientId']=_0x1bb93c[_0x13f5('0x5')]||'';this[_0x13f5('0x6')]=_0x1bb93c[_0x13f5('0x6')]||{};this[_0x13f5('0x7')]=_0x1bb93c[_0x13f5('0x7')]||'';this[_0x13f5('0x8')]=_0x1bb93c[_0x13f5('0x8')]||![];this[_0x13f5('0x9')]=_0x1bb93c[_0x13f5('0x9')]||{};this[_0x13f5('0xa')]=_0x1bb93c[_0x13f5('0xa')]||{};}module[_0x13f5('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 65b4914..8442cc8 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 _0xd7b7=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description'];(function(_0x4c4683,_0x241657){var _0x78ee7e=function(_0x4c9489){while(--_0x4c9489){_0x4c4683['push'](_0x4c4683['shift']());}};_0x78ee7e(++_0x241657);}(_0xd7b7,0xed));var _0x7d7b=function(_0x5ba13d,_0x306e9f){_0x5ba13d=_0x5ba13d-0x0;var _0x165560=_0xd7b7[_0x5ba13d];return _0x165560;};'use strict';function FaxAccount(_0x1b9df7){this['id']=_0x1b9df7['id']||0x0;this['name']=_0x1b9df7['name']||'';this[_0x7d7b('0x0')]=_0x1b9df7[_0x7d7b('0x0')];this[_0x7d7b('0x1')]=_0x1b9df7[_0x7d7b('0x1')];this['headerinfo']=_0x1b9df7[_0x7d7b('0x2')];this[_0x7d7b('0x3')]=_0x1b9df7[_0x7d7b('0x3')];this[_0x7d7b('0x4')]=_0x1b9df7[_0x7d7b('0x4')]||0x960;this[_0x7d7b('0x5')]=_0x1b9df7['maxrate']||0x3840;this['modem']=_0x1b9df7[_0x7d7b('0x6')]||_0x7d7b('0x7');this[_0x7d7b('0x8')]=_0x1b9df7[_0x7d7b('0x8')]||'no';this['faxdetect']=_0x1b9df7[_0x7d7b('0x9')]||'no';this[_0x7d7b('0xa')]=_0x1b9df7['t38timeout']||0x1388;this[_0x7d7b('0xb')]=_0x1b9df7[_0x7d7b('0xb')]||_0x7d7b('0xc');this[_0x7d7b('0xd')]=_0x1b9df7[_0x7d7b('0xd')]?_0x1b9df7[_0x7d7b('0xd')]:undefined;this['ListId']=_0x1b9df7[_0x7d7b('0xe')];this[_0x7d7b('0xf')]=_0x1b9df7[_0x7d7b('0xf')];}module[_0x7d7b('0x10')]=FaxAccount; \ No newline at end of file +var _0xb5cf=['ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb5cf,0xac));var _0xfb5c=function(_0x525a3c,_0x40d7a4){_0x525a3c=_0x525a3c-0x0;var _0x3531cd=_0xb5cf[_0x525a3c];return _0x3531cd;};'use strict';function FaxAccount(_0x143777){this['id']=_0x143777['id']||0x0;this['name']=_0x143777[_0xfb5c('0x0')]||'';this[_0xfb5c('0x1')]=_0x143777[_0xfb5c('0x1')];this[_0xfb5c('0x2')]=_0x143777[_0xfb5c('0x2')];this[_0xfb5c('0x3')]=_0x143777[_0xfb5c('0x3')];this[_0xfb5c('0x4')]=_0x143777['localstationid'];this[_0xfb5c('0x5')]=_0x143777['minrate']||0x960;this['maxrate']=_0x143777[_0xfb5c('0x6')]||0x3840;this[_0xfb5c('0x7')]=_0x143777[_0xfb5c('0x7')]||_0xfb5c('0x8');this[_0xfb5c('0x9')]=_0x143777['gateway']||'no';this[_0xfb5c('0xa')]=_0x143777['faxdetect']||'no';this[_0xfb5c('0xb')]=_0x143777[_0xfb5c('0xb')]||0x1388;this['tech']=_0x143777[_0xfb5c('0xc')]||_0xfb5c('0xd');this[_0xfb5c('0xe')]=_0x143777['Trunk']?_0x143777[_0xfb5c('0xe')]:undefined;this[_0xfb5c('0xf')]=_0x143777['ListId'];this[_0xfb5c('0x10')]=_0x143777[_0xfb5c('0x10')];}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 a5f666c..e0a2561 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 _0xfaaf=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x36da90,_0x2edbc5){var _0x394e43=function(_0x31e07b){while(--_0x31e07b){_0x36da90['push'](_0x36da90['shift']());}};_0x394e43(++_0x2edbc5);}(_0xfaaf,0x9d));var _0xffaa=function(_0xfa44b8,_0x3e6c66){_0xfa44b8=_0xfa44b8-0x0;var _0x20dcad=_0xfaaf[_0xfa44b8];return _0x20dcad;};'use strict';function FreshdeskAccount(_0x48e0a6){this['id']=_0x48e0a6['id']||0x0;this[_0xffaa('0x0')]=_0x48e0a6[_0xffaa('0x0')]||'';this[_0xffaa('0x1')]=_0x48e0a6[_0xffaa('0x1')]||'';this[_0xffaa('0x2')]=_0x48e0a6[_0xffaa('0x3')]||'';this['remoteUri']=_0x48e0a6[_0xffaa('0x4')]||'';this[_0xffaa('0x5')]=_0x48e0a6[_0xffaa('0x5')]||'';this[_0xffaa('0x6')]=_0x48e0a6[_0xffaa('0x6')]||{};}module[_0xffaa('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x449e=['exports','name','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x555a74,_0x27195a){var _0x75132e=function(_0x4a0aac){while(--_0x4a0aac){_0x555a74['push'](_0x555a74['shift']());}};_0x75132e(++_0x27195a);}(_0x449e,0xc5));var _0xe449=function(_0x25baed,_0x82e3da){_0x25baed=_0x25baed-0x0;var _0x5e854f=_0x449e[_0x25baed];return _0x5e854f;};'use strict';function FreshdeskAccount(_0x4751ab){this['id']=_0x4751ab['id']||0x0;this[_0xe449('0x0')]=_0x4751ab[_0xe449('0x0')]||'';this['username']=_0x4751ab['username']||'';this[_0xe449('0x1')]=_0x4751ab[_0xe449('0x2')]||'';this[_0xe449('0x3')]=_0x4751ab[_0xe449('0x3')]||'';this[_0xe449('0x4')]=_0x4751ab[_0xe449('0x4')]||'';this[_0xe449('0x5')]=_0x4751ab[_0xe449('0x5')]||{};}module[_0xe449('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 49d39e7..49598fe 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 _0xe647=['username','apiKey','remoteUri','serverUrl','Configurations','name'];(function(_0x3f227f,_0x4ff30e){var _0x4b2f8c=function(_0x449e0e){while(--_0x449e0e){_0x3f227f['push'](_0x3f227f['shift']());}};_0x4b2f8c(++_0x4ff30e);}(_0xe647,0x16d));var _0x7e64=function(_0x40f5e8,_0x1ea7a7){_0x40f5e8=_0x40f5e8-0x0;var _0x2005bf=_0xe647[_0x40f5e8];return _0x2005bf;};'use strict';function FreshsalesAccount(_0x5579e6){this['id']=_0x5579e6['id']||0x0;this[_0x7e64('0x0')]=_0x5579e6['name']||'';this[_0x7e64('0x1')]=_0x5579e6[_0x7e64('0x1')]||'';this[_0x7e64('0x2')]=_0x5579e6['token']||'';this['remoteUri']=_0x5579e6[_0x7e64('0x3')]||'';this[_0x7e64('0x4')]=_0x5579e6[_0x7e64('0x4')]||'';this[_0x7e64('0x5')]=_0x5579e6[_0x7e64('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x14f5=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x14f5,0xae));var _0x514f=function(_0x31b913,_0x1712df){_0x31b913=_0x31b913-0x0;var _0x1e16dd=_0x14f5[_0x31b913];return _0x1e16dd;};'use strict';function FreshsalesAccount(_0x356f2f){this['id']=_0x356f2f['id']||0x0;this[_0x514f('0x0')]=_0x356f2f['name']||'';this[_0x514f('0x1')]=_0x356f2f[_0x514f('0x1')]||'';this[_0x514f('0x2')]=_0x356f2f['token']||'';this[_0x514f('0x3')]=_0x356f2f[_0x514f('0x3')]||'';this['serverUrl']=_0x356f2f[_0x514f('0x4')]||'';this[_0x514f('0x5')]=_0x356f2f[_0x514f('0x5')]||{};}module[_0x514f('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c7f63a3..3ff56e9 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 _0xddfc=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','holdtime','assigned','lastAssignedTo','motionChannel','voice','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerabandon','queuecallercomplete'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xddfc,0x184));var _0xcddf=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xddfc[_0x27af45];return _0x18df21;};'use strict';function QueueReport(){this[_0xcddf('0x0')]=_0xcddf('0x1');this['uniqueid']='';this[_0xcddf('0x2')]='';this[_0xcddf('0x3')]='';this[_0xcddf('0x4')]='';this[_0xcddf('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0xcddf('0x6')]=![];this['queuecallerabandonAt']=null;this[_0xcddf('0x7')]=![];this[_0xcddf('0x8')]=null;this[_0xcddf('0x9')]=![];this[_0xcddf('0xa')]=null;this['originalposition']=0x1;this[_0xcddf('0xb')]='';this[_0xcddf('0xc')]='';this[_0xcddf('0xd')]='';this['accountcode']='';this[_0xcddf('0xe')]='';this['exten']='';this['priority']='';this[_0xcddf('0xf')]=0x0;this[_0xcddf('0x10')]=![];this[_0xcddf('0x11')]='';this[_0xcddf('0x12')]=_0xcddf('0x13');this['routealias']=null;this['mohtime']=0x0;this[_0xcddf('0x14')]={};}module[_0xcddf('0x15')]=QueueReport; \ No newline at end of file +var _0x47c9=['inbound','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','lastAssignedTo','voice','routealias','mohtime','variables','exports'];(function(_0xce3a7c,_0x4c9c07){var _0x6b5fa8=function(_0x1d2e47){while(--_0x1d2e47){_0xce3a7c['push'](_0xce3a7c['shift']());}};_0x6b5fa8(++_0x4c9c07);}(_0x47c9,0xf2));var _0x947c=function(_0x112a66,_0x447f66){_0x112a66=_0x112a66-0x0;var _0x3230e7=_0x47c9[_0x112a66];return _0x3230e7;};'use strict';function QueueReport(){this['type']=_0x947c('0x0');this[_0x947c('0x1')]='';this['calleridnum']='';this['calleridname']='';this[_0x947c('0x2')]='';this[_0x947c('0x3')]=null;this[_0x947c('0x4')]=null;this[_0x947c('0x5')]=0x1;this['count']=0x1;this[_0x947c('0x6')]=![];this[_0x947c('0x7')]=null;this[_0x947c('0x8')]=![];this[_0x947c('0x9')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x947c('0xa')]=0x1;this[_0x947c('0xb')]='';this[_0x947c('0xc')]='';this[_0x947c('0xd')]='';this[_0x947c('0xe')]='';this['context']='';this[_0x947c('0xf')]='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0x947c('0x10')]='';this['motionChannel']=_0x947c('0x11');this[_0x947c('0x12')]=null;this[_0x947c('0x13')]=0x0;this[_0x947c('0x14')]={};}module[_0x947c('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 42dfd92..8ebf4d6 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 _0x60e0=['type','integrationTab','serverUrl','Configurations','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0x60e0,0x176));var _0x060e=function(_0x3a26f3,_0x269720){_0x3a26f3=_0x3a26f3-0x0;var _0x46c58c=_0x60e0[_0x3a26f3];return _0x46c58c;};'use strict';function SalesforceAccount(_0x1f401c){this['id']=_0x1f401c['id']||0x0;this['name']=_0x1f401c['name']||'';this[_0x060e('0x0')]=_0x1f401c['username']||'';this[_0x060e('0x1')]=_0x1f401c[_0x060e('0x1')]||'';this[_0x060e('0x2')]=_0x1f401c[_0x060e('0x2')]||'';this[_0x060e('0x3')]=_0x1f401c['clientId']||'';this[_0x060e('0x4')]=_0x1f401c[_0x060e('0x4')]||'';this[_0x060e('0x5')]=_0x1f401c['securityToken']||'';this['type']=_0x1f401c[_0x060e('0x6')]||_0x060e('0x7');this[_0x060e('0x8')]=_0x1f401c[_0x060e('0x8')]||'';this[_0x060e('0x9')]=_0x1f401c['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x7b77=['integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x8e2c4f,_0x2b16be){var _0x50c270=function(_0x1146cf){while(--_0x1146cf){_0x8e2c4f['push'](_0x8e2c4f['shift']());}};_0x50c270(++_0x2b16be);}(_0x7b77,0x179));var _0x77b7=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x7b77[_0x2dd390];return _0x3afe47;};'use strict';function SalesforceAccount(_0x3c0df3){this['id']=_0x3c0df3['id']||0x0;this[_0x77b7('0x0')]=_0x3c0df3[_0x77b7('0x0')]||'';this[_0x77b7('0x1')]=_0x3c0df3['username']||'';this[_0x77b7('0x2')]=_0x3c0df3[_0x77b7('0x2')]||'';this[_0x77b7('0x3')]=_0x3c0df3['password']||'';this[_0x77b7('0x4')]=_0x3c0df3[_0x77b7('0x4')]||'';this[_0x77b7('0x5')]=_0x3c0df3[_0x77b7('0x5')]||'';this[_0x77b7('0x6')]=_0x3c0df3[_0x77b7('0x6')]||'';this['type']=_0x3c0df3[_0x77b7('0x7')]||_0x77b7('0x8');this[_0x77b7('0x9')]=_0x3c0df3['serverUrl']||'';this[_0x77b7('0xa')]=_0x3c0df3['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d2195a9..ffaceda 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 _0xedda=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xedda,0x1d8));var _0xaedd=function(_0x2c908c,_0x2caecc){_0x2c908c=_0x2c908c-0x0;var _0x4218e0=_0xedda[_0x2c908c];return _0x4218e0;};'use strict';function ServicenowAccount(_0x3a43da){this['id']=_0x3a43da['id']||0x0;this[_0xaedd('0x0')]=_0x3a43da[_0xaedd('0x0')]||'';this['username']=_0x3a43da[_0xaedd('0x1')]||'';this[_0xaedd('0x2')]=_0x3a43da[_0xaedd('0x2')]||'';this[_0xaedd('0x3')]=_0x3a43da['remoteUri']||'';this[_0xaedd('0x4')]=_0x3a43da[_0xaedd('0x4')]||'';this[_0xaedd('0x5')]=_0x3a43da[_0xaedd('0x5')]||{};}module[_0xaedd('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb949=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xb949,0xa2));var _0x9b94=function(_0x2a5a01,_0x16b284){_0x2a5a01=_0x2a5a01-0x0;var _0x48708b=_0xb949[_0x2a5a01];return _0x48708b;};'use strict';function ServicenowAccount(_0x457e4e){this['id']=_0x457e4e['id']||0x0;this[_0x9b94('0x0')]=_0x457e4e[_0x9b94('0x0')]||'';this[_0x9b94('0x1')]=_0x457e4e['username']||'';this['password']=_0x457e4e[_0x9b94('0x2')]||'';this[_0x9b94('0x3')]=_0x457e4e[_0x9b94('0x3')]||'';this[_0x9b94('0x4')]=_0x457e4e['serverUrl']||'';this['Configurations']=_0x457e4e[_0x9b94('0x5')]||{};}module[_0x9b94('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 16dbb05..575a8d4 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 _0xf542=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x2fc7b2,_0x559057){var _0x26642c=function(_0x141223){while(--_0x141223){_0x2fc7b2['push'](_0x2fc7b2['shift']());}};_0x26642c(++_0x559057);}(_0xf542,0x7b));var _0x2f54=function(_0x87fa07,_0x3600b7){_0x87fa07=_0x87fa07-0x0;var _0x61a0a8=_0xf542[_0x87fa07];return _0x61a0a8;};'use strict';function SugarcrmAccount(_0x38cd70){this['id']=_0x38cd70['id']||0x0;this[_0x2f54('0x0')]=_0x38cd70[_0x2f54('0x0')]||'';this[_0x2f54('0x1')]=_0x38cd70[_0x2f54('0x1')]||'';this[_0x2f54('0x2')]=_0x38cd70[_0x2f54('0x2')]||'';this[_0x2f54('0x3')]=_0x38cd70[_0x2f54('0x3')]||'';this[_0x2f54('0x4')]=_0x38cd70[_0x2f54('0x4')]||'';this[_0x2f54('0x5')]=_0x38cd70[_0x2f54('0x5')]||{};}module[_0x2f54('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x0985=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x0985,0xac));var _0x5098=function(_0x58e8a9,_0x23e67b){_0x58e8a9=_0x58e8a9-0x0;var _0x4be180=_0x0985[_0x58e8a9];return _0x4be180;};'use strict';function SugarcrmAccount(_0x12b854){this['id']=_0x12b854['id']||0x0;this[_0x5098('0x0')]=_0x12b854['name']||'';this[_0x5098('0x1')]=_0x12b854['username']||'';this[_0x5098('0x2')]=_0x12b854[_0x5098('0x2')]||'';this[_0x5098('0x3')]=_0x12b854[_0x5098('0x3')]||'';this[_0x5098('0x4')]=_0x12b854[_0x5098('0x4')]||'';this['Configurations']=_0x12b854[_0x5098('0x5')]||{};}module[_0x5098('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 20c44df..f9cbe61 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 _0x4c73=['stateTime','address','exports','name','accountcode','state','unknown'];(function(_0x1bbe54,_0xdc2c1b){var _0x1c5952=function(_0x4cfe8f){while(--_0x4cfe8f){_0x1bbe54['push'](_0x1bbe54['shift']());}};_0x1c5952(++_0xdc2c1b);}(_0x4c73,0x14c));var _0x34c7=function(_0x5134a4,_0x59fab5){_0x5134a4=_0x5134a4-0x0;var _0x86f0e5=_0x4c73[_0x5134a4];return _0x86f0e5;};'use strict';function Telephone(_0x5ad266){this['id']=_0x5ad266['id']||0x0;this[_0x34c7('0x0')]=_0x5ad266[_0x34c7('0x0')]||'';this[_0x34c7('0x1')]=_0x5ad266[_0x34c7('0x1')]||'';this[_0x34c7('0x2')]=_0x34c7('0x3');this[_0x34c7('0x4')]=0x0;this['status']=_0x34c7('0x3');this[_0x34c7('0x5')]='';}module[_0x34c7('0x6')]=Telephone; \ No newline at end of file +var _0x65a6=['exports','name','accountcode','unknown'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x65a6,0xa5));var _0x665a=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x65a6[_0x17e771];return _0x1f3a6d;};'use strict';function Telephone(_0x803ba4){this['id']=_0x803ba4['id']||0x0;this[_0x665a('0x0')]=_0x803ba4['name']||'';this[_0x665a('0x1')]=_0x803ba4['accountcode']||'';this['state']=_0x665a('0x2');this['stateTime']=0x0;this['status']=_0x665a('0x2');this['address']='';}module[_0x665a('0x3')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 32925cd..45fc608 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(_0x3bf5ac,_0x14e1a6){var _0x7b10ae=function(_0x19c2dc){while(--_0x19c2dc){_0x3bf5ac['push'](_0x3bf5ac['shift']());}};_0x7b10ae(++_0x14e1a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0xb10b[_0x42d2af];return _0x1d6d63;};'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(_0x17ce18,_0x6efe8){var _0x55e2d7=function(_0x2fc74f){while(--_0x2fc74f){_0x17ce18['push'](_0x17ce18['shift']());}};_0x55e2d7(++_0x6efe8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 0d4f445..6b781f9 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x1a3887,_0x1ac61a){var _0x27c171=function(_0x174670){while(--_0x174670){_0x1a3887['push'](_0x1a3887['shift']());}};_0x27c171(++_0x1ac61a);}(_0xda3f,0xec));var _0xfda3=function(_0xbcd8b8,_0x379b19){_0xbcd8b8=_0xbcd8b8-0x0;var _0x4d949a=_0xda3f[_0xbcd8b8];return _0x4d949a;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a85,0x178));var _0x51a8=function(_0xb1496a,_0x190543){_0xb1496a=_0xb1496a-0x0;var _0x301916=_0x1a85[_0xb1496a];return _0x301916;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 80365cb..88dbcbb 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 _0x0859=['domainport','stateRegistry','address','defaultuser','exports','name','state','unknown','stateTime','status','registry','indexOf','split'];(function(_0x4e71c7,_0x3e1caa){var _0x393c05=function(_0x553809){while(--_0x553809){_0x4e71c7['push'](_0x4e71c7['shift']());}};_0x393c05(++_0x3e1caa);}(_0x0859,0x6d));var _0x9085=function(_0x17534d,_0x267006){_0x17534d=_0x17534d-0x0;var _0x2ff3f0=_0x0859[_0x17534d];return _0x2ff3f0;};'use strict';function Trunk(_0x237ecc){this['id']=_0x237ecc['id']||0x0;this['active']=_0x237ecc['active']||![];this[_0x9085('0x0')]=_0x237ecc['name']||'';this[_0x9085('0x1')]=_0x9085('0x2');this[_0x9085('0x3')]=0x0;this[_0x9085('0x4')]=_0x9085('0x2');this[_0x9085('0x5')]=_0x237ecc['registry']&&_0x237ecc[_0x9085('0x5')][_0x9085('0x6')](':')?_0x237ecc[_0x9085('0x5')][_0x9085('0x7')](':')[0x0]:'';this['host']='';this['port']='';this['domain']='';this[_0x9085('0x8')]='';this['refresh']='';this[_0x9085('0x9')]=_0x9085('0x2');this['registrationtime']='';this[_0x9085('0xa')]='';this['defaultuser']=_0x237ecc[_0x9085('0xb')]||'';}module[_0x9085('0xc')]=Trunk; \ No newline at end of file +var _0x9dcc=['unknown','stateTime','status','registry','indexOf','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state'];(function(_0x4a4003,_0x398f34){var _0x37f7bf=function(_0x9f8c7b){while(--_0x9f8c7b){_0x4a4003['push'](_0x4a4003['shift']());}};_0x37f7bf(++_0x398f34);}(_0x9dcc,0x1dd));var _0xc9dc=function(_0x21b36b,_0x222146){_0x21b36b=_0x21b36b-0x0;var _0x2bdbc8=_0x9dcc[_0x21b36b];return _0x2bdbc8;};'use strict';function Trunk(_0x1831b8){this['id']=_0x1831b8['id']||0x0;this[_0xc9dc('0x0')]=_0x1831b8[_0xc9dc('0x0')]||![];this[_0xc9dc('0x1')]=_0x1831b8['name']||'';this[_0xc9dc('0x2')]=_0xc9dc('0x3');this[_0xc9dc('0x4')]=0x0;this[_0xc9dc('0x5')]='unknown';this[_0xc9dc('0x6')]=_0x1831b8[_0xc9dc('0x6')]&&_0x1831b8[_0xc9dc('0x6')][_0xc9dc('0x7')](':')?_0x1831b8[_0xc9dc('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0xc9dc('0x8')]='';this[_0xc9dc('0x9')]='';this[_0xc9dc('0xa')]='';this['refresh']='';this[_0xc9dc('0xb')]=_0xc9dc('0x3');this[_0xc9dc('0xc')]='';this[_0xc9dc('0xd')]='';this[_0xc9dc('0xe')]=_0x1831b8[_0xc9dc('0xe')]||'';}module[_0xc9dc('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 850b23e..27356c7 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 _0x69f2=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x1c1872,_0x5bcd82){var _0x3d747e=function(_0x1b5e8b){while(--_0x1b5e8b){_0x1c1872['push'](_0x1c1872['shift']());}};_0x3d747e(++_0x5bcd82);}(_0x69f2,0xc6));var _0x269f=function(_0x2f5fbf,_0x1cdcaa){_0x2f5fbf=_0x2f5fbf-0x0;var _0x591528=_0x69f2[_0x2f5fbf];return _0x591528;};'use strict';function voiceExtension(_0x576a76){this['id']=_0x576a76['id']||0x0;this['exten']=_0x576a76[_0x269f('0x0')]||'';this[_0x269f('0x1')]=_0x576a76[_0x269f('0x1')]||_0x269f('0x2');this[_0x269f('0x3')]=_0x576a76[_0x269f('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x4fc2=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fc2,0x1c5));var _0x24fc=function(_0x599960,_0x292b74){_0x599960=_0x599960-0x0;var _0xae3b3c=_0x4fc2[_0x599960];return _0xae3b3c;};'use strict';function voiceExtension(_0x21a5e5){this['id']=_0x21a5e5['id']||0x0;this[_0x24fc('0x0')]=_0x21a5e5[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x21a5e5[_0x24fc('0x1')]||_0x24fc('0x2');this['mandatoryDisposition']=_0x21a5e5[_0x24fc('0x3')]||![];}module[_0x24fc('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 f0fa611..5883057 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 _0xf360=['outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','inUse','notInUse','onHold','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay'];(function(_0x3cd590,_0x54deaa){var _0x149858=function(_0x8b1312){while(--_0x8b1312){_0x3cd590['push'](_0x3cd590['shift']());}};_0x149858(++_0x54deaa);}(_0xf360,0x9e));var _0x0f36=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf360[_0x13d07a];return _0x5ee0ee;};'use strict';var monitorFormat={'wav':_0x0f36('0x0'),'wav49':_0x0f36('0x1'),'gsm':_0x0f36('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x0f36('0x3'),'linear':'linear','random':_0x0f36('0x4'),'ringall':_0x0f36('0x5'),'rr':_0x0f36('0x6'),'rrmemory':'rrmemory','rrordered':_0x0f36('0x7'),'wrandom':_0x0f36('0x8')};function VoiceQueue(_0x13d262){this['id']=_0x13d262['id']||0x0;this[_0x0f36('0x9')]=_0x13d262[_0x0f36('0x9')]||'';this[_0x0f36('0xa')]=_0x13d262[_0x0f36('0xa')]||'';this[_0x0f36('0xb')]=_0x13d262['type']||_0x0f36('0xc');this[_0x0f36('0xd')]=0x0;this[_0x0f36('0xe')]=0x0;this[_0x0f36('0xf')]=0x0;this[_0x0f36('0x10')]=0x0;this[_0x0f36('0x11')]=0x0;this['sumBillable']=0x0;this[_0x0f36('0x12')]=0x0;this[_0x0f36('0x13')]=0x0;this[_0x0f36('0x14')]=0x0;this['busy']=0x0;this[_0x0f36('0x15')]=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x0f36('0x16')]=0x0;this[_0x0f36('0x17')]=0x0;this['paused']=0x0;this[_0x0f36('0x18')]=0x0;this[_0x0f36('0x19')]=0x0;this[_0x0f36('0x1a')]=0x0;this[_0x0f36('0x1b')]=0x0;this['unknown']=0x0;this[_0x0f36('0x1c')]=_0x13d262['acw']||![];this[_0x0f36('0x1d')]=_0x13d262[_0x0f36('0x1d')]||0xa;this[_0x0f36('0x1e')]=_0x13d262[_0x0f36('0x1e')]||'no';this[_0x0f36('0x1f')]=!![];this[_0x0f36('0x20')]='';this[_0x0f36('0x21')]='';this['originated']=0x0;this['temp']=0x0;this[_0x0f36('0x22')]=_0x13d262[_0x0f36('0x22')]||null;this['dialGlobalInterval']=_0x13d262['dialGlobalInterval']?_0x13d262[_0x0f36('0x23')]:null;this[_0x0f36('0x24')]=_0x13d262['dialActive'];this[_0x0f36('0x25')]=_0x13d262[_0x0f36('0x25')]||'progressive';this[_0x0f36('0x26')]=_0x13d262['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x13d262[_0x0f36('0x27')]||0x0;this[_0x0f36('0x28')]=_0x13d262['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x13d262[_0x0f36('0x29')]||_0x0f36('0x2a');this['dialPredictiveOptimizationPercentage']=_0x13d262[_0x0f36('0x2b')]||0.03;this['dialPredictiveInterval']=_0x13d262[_0x0f36('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0x13d262[_0x0f36('0x2d')]||_0x0f36('0x2e');this[_0x0f36('0x2f')]=_0x13d262['dialOriginateCallerIdNumber']||_0x0f36('0x2e');this[_0x0f36('0x30')]=_0x13d262[_0x0f36('0x30')]||0x1e;this['dialQueueOptions']=_0x13d262[_0x0f36('0x31')]||_0x0f36('0x32');this[_0x0f36('0x33')]=_0x13d262[_0x0f36('0x33')]||0x3;this['dialQueueProject']=_0x13d262[_0x0f36('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x13d262[_0x0f36('0x35')]||0x3;this['dialCongestionRetryFrequency']=_0x13d262[_0x0f36('0x36')]||0x96;this[_0x0f36('0x37')]=_0x13d262[_0x0f36('0x37')]||0x3;this[_0x0f36('0x38')]=_0x13d262['dialBusyRetryFrequency']||0x96;this[_0x0f36('0x39')]=_0x13d262['dialNoAnswerMaxRetry']||0x3;this[_0x0f36('0x3a')]=_0x13d262[_0x0f36('0x3a')]||0x96;this[_0x0f36('0x3b')]=_0x13d262[_0x0f36('0x3b')]||0x3;this[_0x0f36('0x3c')]=_0x13d262['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0f36('0x3d')]=_0x13d262[_0x0f36('0x3d')]||0x3;this[_0x0f36('0x3e')]=_0x13d262[_0x0f36('0x3e')]||0x96;this[_0x0f36('0x3f')]=_0x13d262['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x13d262[_0x0f36('0x40')]||0x96;this[_0x0f36('0x41')]=_0x13d262[_0x0f36('0x41')]||0x3;this[_0x0f36('0x42')]=_0x13d262[_0x0f36('0x42')]||0x96;this['dialAgentRejectMaxRetry']=_0x13d262[_0x0f36('0x43')]||0x3;this['dialAgentRejectRetryFrequency']=_0x13d262[_0x0f36('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x13d262[_0x0f36('0x45')]||0x3;this['dialGlobalMaxRetry']=_0x13d262[_0x0f36('0x46')]||0x4;this[_0x0f36('0x47')]=_0x13d262[_0x0f36('0x47')]?_0x13d262[_0x0f36('0x47')]:undefined;this[_0x0f36('0x48')]=_0x13d262[_0x0f36('0x48')]?_0x13d262[_0x0f36('0x48')]:undefined;this[_0x0f36('0x49')]=_0x13d262[_0x0f36('0x49')]||undefined;this[_0x0f36('0x4a')]=_0x13d262[_0x0f36('0x4a')]?_0x13d262[_0x0f36('0x4a')]:undefined;this[_0x0f36('0x4b')]=_0x13d262[_0x0f36('0x4b')]||_0x0f36('0x4c');this[_0x0f36('0x4d')]=_0x13d262['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0f36('0x4e')]=_0x13d262['dialCutDigit']||undefined;this[_0x0f36('0x4f')]=strategy[_0x13d262[_0x0f36('0x4f')]];this['queueStatusComplete']=!![];this[_0x0f36('0x50')]=_0x13d262[_0x0f36('0x50')]||![];this['dialAMDInitialSilence']=_0x13d262[_0x0f36('0x51')];this[_0x0f36('0x52')]=_0x13d262[_0x0f36('0x52')];this['dialAMDAfterGreetingSilence']=_0x13d262['dialAMDAfterGreetingSilence'];this[_0x0f36('0x53')]=_0x13d262[_0x0f36('0x53')];this[_0x0f36('0x54')]=_0x13d262[_0x0f36('0x54')];this[_0x0f36('0x55')]=_0x13d262['dialAMDBetweenWordsSilence'];this[_0x0f36('0x56')]=_0x13d262['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x13d262[_0x0f36('0x57')];this['dialAMDMaximumWordLength']=_0x13d262[_0x0f36('0x58')];this[_0x0f36('0x59')]=0x0;this['pTalking']=0x0;this['timeout']=_0x13d262['timeout'];this[_0x0f36('0x5a')]=0x0;this[_0x0f36('0x5b')]=0x0;this[_0x0f36('0x5c')]=0x0;this[_0x0f36('0x5d')]=0x0;this[_0x0f36('0x5e')]=0x0;this[_0x0f36('0x5f')]=0x0;this[_0x0f36('0x60')]=0x0;this[_0x0f36('0x61')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x0f36('0x62')]=0x0;this[_0x0f36('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x0f36('0x64')]=0x0;this[_0x0f36('0x65')]=0x0;this['startProgressive']=undefined;this[_0x0f36('0x66')]=undefined;this[_0x0f36('0x67')]=undefined;this[_0x0f36('0x68')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x0f36('0x69')]=0x0;this[_0x0f36('0x6a')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x0f36('0x6b')]=0x0;this[_0x0f36('0x6c')]=0x0;this[_0x0f36('0x6d')]=0x0;this[_0x0f36('0x6e')]=0x0;this[_0x0f36('0x6f')]=_0x13d262['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x13d262['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x0f36('0x70')]=0x0;this[_0x0f36('0x71')]=0x1;this['erlangCalls']=0x0;this[_0x0f36('0x72')]=0x0;this[_0x0f36('0x73')]=0x0;this[_0x0f36('0x74')]=0x0;this['dialRecallMeTimeout']=_0x13d262['dialRecallMeTimeout']||0x1e;this[_0x0f36('0x75')]=_0x13d262[_0x0f36('0x75')]||![];this['dialPreviewAutoRecallMe']=!!_0x13d262[_0x0f36('0x76')]||![];this['dialPreviewRecallmeReminder']=!!_0x13d262[_0x0f36('0x77')]||![];this[_0x0f36('0x78')]=_0x13d262[_0x0f36('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x13d262['dialAgiAfterHangupClient']||![];this[_0x0f36('0x79')]=_0x13d262[_0x0f36('0x79')]||![];this[_0x0f36('0xa')]=monitorFormat[_0x13d262['monitor_format']]?monitorFormat[_0x13d262['monitor_format']]:undefined;this[_0x0f36('0x7a')]=_0x13d262[_0x0f36('0x7a')]||![];this[_0x0f36('0x7b')]=_0x13d262[_0x0f36('0x7b')]?_0x13d262['mandatoryDispositionPause']:undefined;this[_0x0f36('0x7c')]=![];}module[_0x0f36('0x7d')]=VoiceQueue; \ No newline at end of file +var _0xfcf8=['predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','busy','invalid','loggedIn','notInUse','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold'];(function(_0x5bda8f,_0x375070){var _0xb1474d=function(_0x58acaf){while(--_0x58acaf){_0x5bda8f['push'](_0x5bda8f['shift']());}};_0xb1474d(++_0x375070);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfcf8[_0x2d7f0e];return _0x110b07;};'use strict';var monitorFormat={'wav':_0x8fcf('0x0'),'wav49':_0x8fcf('0x1'),'gsm':_0x8fcf('0x2')};var strategy={'fewestcalls':_0x8fcf('0x3'),'leastrecent':_0x8fcf('0x4'),'linear':_0x8fcf('0x5'),'random':'random','ringall':_0x8fcf('0x6'),'rr':_0x8fcf('0x7'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x8fcf('0x8')};function VoiceQueue(_0x50416f){this['id']=_0x50416f['id']||0x0;this[_0x8fcf('0x9')]=_0x50416f[_0x8fcf('0x9')]||'';this[_0x8fcf('0xa')]=_0x50416f[_0x8fcf('0xa')]||'';this[_0x8fcf('0xb')]=_0x50416f[_0x8fcf('0xb')]||_0x8fcf('0xc');this['waiting']=0x0;this[_0x8fcf('0xd')]=0x0;this[_0x8fcf('0xe')]=0x0;this[_0x8fcf('0xf')]=0x0;this[_0x8fcf('0x10')]=0x0;this['sumBillable']=0x0;this[_0x8fcf('0x11')]=0x0;this[_0x8fcf('0x12')]=0x0;this['available']=0x0;this[_0x8fcf('0x13')]=0x0;this['inUse']=0x0;this[_0x8fcf('0x14')]=0x0;this[_0x8fcf('0x15')]=0x0;this[_0x8fcf('0x16')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x8fcf('0x17')]=0x0;this[_0x8fcf('0x18')]=0x0;this[_0x8fcf('0x19')]=0x0;this[_0x8fcf('0x1a')]=0x0;this[_0x8fcf('0x1b')]=0x0;this[_0x8fcf('0x1c')]=_0x50416f[_0x8fcf('0x1c')]||![];this[_0x8fcf('0x1d')]=_0x50416f[_0x8fcf('0x1d')]||0xa;this[_0x8fcf('0x1e')]=_0x50416f[_0x8fcf('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0x8fcf('0x1f')]='';this[_0x8fcf('0x20')]='';this[_0x8fcf('0x21')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x50416f[_0x8fcf('0x22')]||null;this[_0x8fcf('0x23')]=_0x50416f[_0x8fcf('0x23')]?_0x50416f[_0x8fcf('0x23')]:null;this[_0x8fcf('0x24')]=_0x50416f['dialActive'];this[_0x8fcf('0x25')]=_0x50416f[_0x8fcf('0x25')]||_0x8fcf('0x26');this[_0x8fcf('0x27')]=_0x50416f[_0x8fcf('0x27')]||0x0;this[_0x8fcf('0x28')]=_0x50416f[_0x8fcf('0x28')]||0x0;this[_0x8fcf('0x29')]=_0x50416f[_0x8fcf('0x29')]||0x1;this[_0x8fcf('0x2a')]=_0x50416f[_0x8fcf('0x2a')]||_0x8fcf('0x2b');this[_0x8fcf('0x2c')]=_0x50416f[_0x8fcf('0x2c')]||0.03;this[_0x8fcf('0x2d')]=_0x50416f['dialPredictiveInterval']||0x258;this[_0x8fcf('0x2e')]=_0x50416f[_0x8fcf('0x2e')]||'anonymous';this[_0x8fcf('0x2f')]=_0x50416f['dialOriginateCallerIdNumber']||_0x8fcf('0x30');this['dialOriginateTimeout']=_0x50416f['dialOriginateTimeout']||0x1e;this[_0x8fcf('0x31')]=_0x50416f[_0x8fcf('0x31')]||'tTxX';this['dialQueueTimeout']=_0x50416f['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x50416f['dialQueueProject']||undefined;this[_0x8fcf('0x32')]=_0x50416f['dialCongestionMaxRetry']||0x3;this[_0x8fcf('0x33')]=_0x50416f[_0x8fcf('0x33')]||0x96;this['dialBusyMaxRetry']=_0x50416f['dialBusyMaxRetry']||0x3;this[_0x8fcf('0x34')]=_0x50416f[_0x8fcf('0x34')]||0x96;this[_0x8fcf('0x35')]=_0x50416f[_0x8fcf('0x35')]||0x3;this[_0x8fcf('0x36')]=_0x50416f['dialNoAnswerRetryFrequency']||0x96;this[_0x8fcf('0x37')]=_0x50416f['dialNoSuchNumberMaxRetry']||0x3;this[_0x8fcf('0x38')]=_0x50416f['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8fcf('0x39')]=_0x50416f['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x50416f[_0x8fcf('0x3a')]||0x96;this[_0x8fcf('0x3b')]=_0x50416f['dialAbandonedMaxRetry']||0x3;this[_0x8fcf('0x3c')]=_0x50416f[_0x8fcf('0x3c')]||0x96;this[_0x8fcf('0x3d')]=_0x50416f[_0x8fcf('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x50416f['dialMachineRetryFrequency']||0x96;this[_0x8fcf('0x3e')]=_0x50416f['dialAgentRejectMaxRetry']||0x3;this[_0x8fcf('0x3f')]=_0x50416f[_0x8fcf('0x3f')]||0x96;this[_0x8fcf('0x40')]=_0x50416f[_0x8fcf('0x40')]||0x3;this[_0x8fcf('0x41')]=_0x50416f[_0x8fcf('0x41')]||0x4;this['Trunk']=_0x50416f[_0x8fcf('0x42')]?_0x50416f['Trunk']:undefined;this[_0x8fcf('0x43')]=_0x50416f[_0x8fcf('0x43')]?_0x50416f[_0x8fcf('0x43')]:undefined;this['dialPrefix']=_0x50416f[_0x8fcf('0x44')]||undefined;this[_0x8fcf('0x45')]=_0x50416f[_0x8fcf('0x45')]?_0x50416f[_0x8fcf('0x45')]:undefined;this[_0x8fcf('0x46')]=_0x50416f[_0x8fcf('0x46')]||_0x8fcf('0x47');this[_0x8fcf('0x48')]=_0x50416f['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8fcf('0x49')]=_0x50416f[_0x8fcf('0x49')]||undefined;this[_0x8fcf('0x4a')]=strategy[_0x50416f['strategy']];this[_0x8fcf('0x4b')]=!![];this[_0x8fcf('0x4c')]=_0x50416f['dialAMDActive']||![];this[_0x8fcf('0x4d')]=_0x50416f['dialAMDInitialSilence'];this[_0x8fcf('0x4e')]=_0x50416f[_0x8fcf('0x4e')];this[_0x8fcf('0x4f')]=_0x50416f[_0x8fcf('0x4f')];this[_0x8fcf('0x50')]=_0x50416f['dialAMDTotalAnalysisTime'];this[_0x8fcf('0x51')]=_0x50416f['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x50416f[_0x8fcf('0x52')];this['dialAMDMaximumNumberOfWords']=_0x50416f[_0x8fcf('0x53')];this[_0x8fcf('0x54')]=_0x50416f[_0x8fcf('0x54')];this['dialAMDMaximumWordLength']=_0x50416f[_0x8fcf('0x55')];this['outboundRejectCallsDay']=0x0;this[_0x8fcf('0x56')]=0x0;this[_0x8fcf('0x57')]=_0x50416f[_0x8fcf('0x57')];this[_0x8fcf('0x58')]=0x0;this[_0x8fcf('0x59')]=0x0;this[_0x8fcf('0x5a')]=0x0;this[_0x8fcf('0x5b')]=0x0;this[_0x8fcf('0x5c')]=0x0;this[_0x8fcf('0x5d')]=0x0;this[_0x8fcf('0x5e')]=0x0;this[_0x8fcf('0x5f')]=0x0;this[_0x8fcf('0x60')]=0x0;this[_0x8fcf('0x61')]=0x0;this[_0x8fcf('0x62')]=0x0;this[_0x8fcf('0x63')]=0x0;this[_0x8fcf('0x64')]=0x0;this[_0x8fcf('0x65')]=0x0;this[_0x8fcf('0x66')]=undefined;this[_0x8fcf('0x67')]=undefined;this[_0x8fcf('0x68')]=undefined;this[_0x8fcf('0x69')]=1.05;this[_0x8fcf('0x6a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x8fcf('0x6b')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x8fcf('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x8fcf('0x6d')]=_0x50416f[_0x8fcf('0x6e')]||0x14;this[_0x8fcf('0x6f')]=_0x50416f['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x8fcf('0x70')]=0x0;this[_0x8fcf('0x71')]=0x0;this[_0x8fcf('0x72')]=0x1;this[_0x8fcf('0x73')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x8fcf('0x74')]=0x0;this[_0x8fcf('0x75')]=_0x50416f[_0x8fcf('0x75')]||0x1e;this[_0x8fcf('0x76')]=_0x50416f[_0x8fcf('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x50416f[_0x8fcf('0x77')]||![];this[_0x8fcf('0x78')]=!!_0x50416f['dialPreviewRecallmeReminder']||![];this[_0x8fcf('0x79')]=_0x50416f[_0x8fcf('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x50416f[_0x8fcf('0x7a')]||![];this[_0x8fcf('0x7b')]=_0x50416f[_0x8fcf('0x7b')]||![];this[_0x8fcf('0xa')]=monitorFormat[_0x50416f['monitor_format']]?monitorFormat[_0x50416f[_0x8fcf('0xa')]]:undefined;this[_0x8fcf('0x7c')]=_0x50416f['mandatoryDisposition']||![];this[_0x8fcf('0x7d')]=_0x50416f[_0x8fcf('0x7d')]?_0x50416f[_0x8fcf('0x7d')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x8fcf('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index c04690e..1c134d8 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4f5=['loggedInDb','paused','talking','waiting','available','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','total','type','unavailable','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','loggedin','callers','length','SIP/','online','incall','includes','status','unknown','keys','queue','dialer','exten','some','prototype','outboundNoAnswerCallsDay','loggedIn'];(function(_0x45e8bb,_0x53de02){var _0x1c9197=function(_0x595b13){while(--_0x595b13){_0x45e8bb['push'](_0x45e8bb['shift']());}};_0x1c9197(++_0x53de02);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x3b8ed6,_0x3b5bb6){_0x3b8ed6=_0x3b8ed6-0x0;var _0x2e6223=_0xc4f5[_0x3b8ed6];return _0x2e6223;};'use strict';var INBOUND_COUNTERS=['available',_0x5c4f('0x0'),_0x5c4f('0x1'),_0x5c4f('0x2'),'ringing',_0x5c4f('0x3'),_0x5c4f('0x4')];var OUTBOUND_COUNTERS=[_0x5c4f('0x5'),_0x5c4f('0x6'),_0x5c4f('0x7'),'loggedIn',_0x5c4f('0x1'),_0x5c4f('0x8'),_0x5c4f('0x9'),_0x5c4f('0xa'),_0x5c4f('0xb'),'outboundBusyCallsDay',_0x5c4f('0xc'),'outboundNoAnswerCallsDay',_0x5c4f('0xd'),'outboundReCallsDay',_0x5c4f('0xe'),_0x5c4f('0xf'),_0x5c4f('0x2'),_0x5c4f('0x10'),_0x5c4f('0x3'),_0x5c4f('0x11'),_0x5c4f('0x12'),'total',_0x5c4f('0x4')];function VoiceQueueSummary(_0x16cbfc){this['id']=_0x16cbfc['id'];this['name']=_0x16cbfc[_0x5c4f('0x13')];this[_0x5c4f('0x14')]=_0x16cbfc[_0x5c4f('0x14')];this[_0x5c4f('0x15')]=_0x16cbfc[_0x5c4f('0x15')]||0x0;this['answered']=_0x16cbfc['answered']||0x0;this[_0x5c4f('0x5')]=_0x16cbfc[_0x5c4f('0x5')]||0x0;this[_0x5c4f('0x16')]=_0x16cbfc[_0x5c4f('0x16')]||0x0;this[_0x5c4f('0x7')]=_0x16cbfc['inUse']||0x0;this['invalid']=_0x16cbfc[_0x5c4f('0x17')]||0x0;this['loggedIn']=_0x16cbfc['loggedIn']||0x0;this[_0x5c4f('0x1')]=_0x16cbfc['loggedInDb']||0x0;this[_0x5c4f('0x18')]=_0x16cbfc[_0x5c4f('0x18')]||0x0;this[_0x5c4f('0x19')]=_0x16cbfc[_0x5c4f('0x19')]||0x0;this[_0x5c4f('0x2')]=_0x16cbfc[_0x5c4f('0x2')]||0x0;this[_0x5c4f('0x1a')]=_0x16cbfc[_0x5c4f('0x1a')]||0x0;this[_0x5c4f('0x1b')]=_0x16cbfc['ringInUse'];this[_0x5c4f('0x11')]=_0x16cbfc[_0x5c4f('0x11')];this[_0x5c4f('0x12')]=_0x16cbfc[_0x5c4f('0x12')];this['sumHoldTime']=_0x16cbfc['sumHoldTime']||0x0;this[_0x5c4f('0x3')]=_0x16cbfc[_0x5c4f('0x3')]||0x0;this[_0x5c4f('0x1c')]=_0x16cbfc[_0x5c4f('0x1c')]||0x0;this[_0x5c4f('0x1d')]=_0x16cbfc[_0x5c4f('0x1d')];this[_0x5c4f('0x1e')]=_0x16cbfc[_0x5c4f('0x1e')]||0x0;this['unknown']=_0x16cbfc['unknown']||0x0;this[_0x5c4f('0x1f')]=_0x16cbfc[_0x5c4f('0x1f')]||0x0;this[_0x5c4f('0x4')]=_0x16cbfc[_0x5c4f('0x4')]||0x0;if(_0x16cbfc['type']===_0x5c4f('0x20')){this[_0x5c4f('0x10')]=_0x16cbfc[_0x5c4f('0x10')]||0x0;this[_0x5c4f('0x21')]=_0x16cbfc[_0x5c4f('0x21')];this['dialMethod']=_0x16cbfc[_0x5c4f('0x22')];this[_0x5c4f('0x23')]=_0x16cbfc[_0x5c4f('0x23')];this[_0x5c4f('0x24')]=_0x16cbfc[_0x5c4f('0x24')];this[_0x5c4f('0x25')]=_0x16cbfc['dialOriginateTimeout'];this[_0x5c4f('0x26')]=_0x16cbfc[_0x5c4f('0x26')];this[_0x5c4f('0x27')]=_0x16cbfc[_0x5c4f('0x27')];this['outboundAnswerAgiCallsDay']=_0x16cbfc['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x16cbfc[_0x5c4f('0xa')];this[_0x5c4f('0xb')]=_0x16cbfc[_0x5c4f('0xb')];this[_0x5c4f('0x28')]=_0x16cbfc[_0x5c4f('0x28')];this[_0x5c4f('0xc')]=_0x16cbfc[_0x5c4f('0xc')];this[_0x5c4f('0x29')]=_0x16cbfc[_0x5c4f('0x29')];this[_0x5c4f('0x2a')]=_0x16cbfc[_0x5c4f('0x2a')];this[_0x5c4f('0x2b')]=_0x16cbfc[_0x5c4f('0x2b')];this['outboundNoAnswerCallsDay']=_0x16cbfc['outboundNoAnswerCallsDay'];this[_0x5c4f('0xd')]=_0x16cbfc['outboundNoSuchCallsDay'];this[_0x5c4f('0x2c')]=_0x16cbfc[_0x5c4f('0x2c')];this[_0x5c4f('0x2d')]=_0x16cbfc[_0x5c4f('0x2d')];this[_0x5c4f('0xe')]=_0x16cbfc[_0x5c4f('0xe')];this[_0x5c4f('0xf')]=_0x16cbfc['outboundUnknownCallsDay'];this[_0x5c4f('0x2e')]=_0x16cbfc[_0x5c4f('0x2e')];this[_0x5c4f('0x2f')]=_0x16cbfc['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x16cbfc['predictiveIntervalAvgTalktime'];this[_0x5c4f('0x30')]=_0x16cbfc[_0x5c4f('0x30')];this[_0x5c4f('0x31')]=_0x16cbfc[_0x5c4f('0x31')];this[_0x5c4f('0x32')]=_0x16cbfc['predictiveIntervalErlangCalls'];this[_0x5c4f('0x33')]=_0x16cbfc[_0x5c4f('0x33')];this['predictiveIntervalHitRate']=_0x16cbfc[_0x5c4f('0x34')];this[_0x5c4f('0x35')]=_0x16cbfc['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x16cbfc[_0x5c4f('0x36')];this[_0x5c4f('0x37')]=_0x16cbfc['predictiveIntervalAvailable'];this[_0x5c4f('0x38')]=_0x16cbfc[_0x5c4f('0x38')];this[_0x5c4f('0x8')]=_0x16cbfc[_0x5c4f('0x8')];this[_0x5c4f('0x39')]=_0x16cbfc['erlangCalls'];this[_0x5c4f('0x3a')]=_0x16cbfc['erlangCallToSecond'];this[_0x5c4f('0x3b')]=_0x16cbfc[_0x5c4f('0x3b')];this[_0x5c4f('0x3c')]=_0x16cbfc[_0x5c4f('0x3c')];this[_0x5c4f('0x3d')]=_0x16cbfc[_0x5c4f('0x3d')];this[_0x5c4f('0x3e')]=_0x16cbfc[_0x5c4f('0x3e')];this[_0x5c4f('0x3f')]=_0x16cbfc['message'];this['statusMessage']=_0x16cbfc[_0x5c4f('0x40')];}if(_0x16cbfc[_0x5c4f('0x41')]){this['Trunk']={'id':_0x16cbfc[_0x5c4f('0x41')]['id'],'name':_0x16cbfc[_0x5c4f('0x41')][_0x5c4f('0x13')],'active':_0x16cbfc[_0x5c4f('0x41')][_0x5c4f('0x42')],'callerid':_0x16cbfc[_0x5c4f('0x41')]['callerid']};}}VoiceQueueSummary['prototype']['createReport']=function(_0x29a409,_0x573e5b,_0x1a3f1c,_0x3c5f91){this[_0x5c4f('0x1')]=0x0;this[_0x5c4f('0x3')]=0x0;this['paused']=0x0;this['unknown']=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0x5c4f('0x16')]=0x0;this[_0x5c4f('0x17')]=0x0;this[_0x5c4f('0x1e')]=0x0;this[_0x5c4f('0x1a')]=0x0;this[_0x5c4f('0x1b')]=0x0;this[_0x5c4f('0x18')]=0x0;if(_0x1a3f1c){if(_0x1a3f1c[_0x5c4f('0x5')]){this[_0x5c4f('0x5')]=Number(_0x1a3f1c[_0x5c4f('0x5')]);}if(_0x1a3f1c[_0x5c4f('0x43')]){this[_0x5c4f('0x0')]=Number(_0x1a3f1c[_0x5c4f('0x43')]);}if(_0x1a3f1c[_0x5c4f('0x44')]){this[_0x5c4f('0x4')]=Number(_0x1a3f1c[_0x5c4f('0x44')]);}}for(var _0x219616=0x0;_0x219616<_0x29a409[_0x5c4f('0x45')];_0x219616++){var _0x776b8b=_0x573e5b[_0x5c4f('0x46')+_0x29a409[_0x219616][_0x5c4f('0x13')]];if(_0x776b8b&&_0x776b8b[_0x5c4f('0x47')]){this[_0x5c4f('0x1')]+=0x1;}if(_0x29a409[_0x219616][_0x5c4f('0x48')]==='1'){this['talking']+=0x1;}if(_0x29a409[_0x219616][_0x5c4f('0x2')]==='1'&&!['2','7','8'][_0x5c4f('0x49')](_0x29a409[_0x219616]['status'])){this[_0x5c4f('0x2')]+=0x1;}switch(_0x29a409[_0x219616][_0x5c4f('0x4a')]){case'0':this[_0x5c4f('0x4b')]+=0x1;break;case'1':this[_0x5c4f('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x5c4f('0x16')]+=0x1;break;case'4':this[_0x5c4f('0x17')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x5c4f('0x1a')]+=0x1;break;case'7':this[_0x5c4f('0x1b')]+=0x1;break;case'8':this[_0x5c4f('0x18')]+=0x1;break;}}if(this[_0x5c4f('0x22')]==='booked'){var _0x40d428=Object[_0x5c4f('0x4c')](_0x3c5f91);for(var _0x337e67=0x0;_0x337e67<_0x40d428[_0x5c4f('0x45')];_0x337e67++){var _0x1af61e=_0x40d428[_0x337e67];var _0x3ec782=_0x3c5f91[_0x1af61e];if(_0x3ec782[_0x5c4f('0x4d')]===this[_0x5c4f('0x13')]&&_0x3ec782[_0x5c4f('0x1d')]===_0x5c4f('0x4e')&&_0x3ec782[_0x5c4f('0x4f')]==='xcally-motion-preview'){this[_0x5c4f('0x3')]+=0x1;}}if(this[_0x5c4f('0x3')]>this[_0x5c4f('0x7')]){this[_0x5c4f('0x3')]=this[_0x5c4f('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x509ec2){var _0x22c35=![];if(_0x509ec2){_0x22c35=INBOUND_COUNTERS[_0x5c4f('0x50')](function(_0x380ab2){return this[_0x380ab2]!==_0x509ec2[_0x380ab2];},this);}return _0x22c35;};VoiceQueueSummary[_0x5c4f('0x51')]['compareToOutboundQueue']=function(_0x4f0d76){var _0x2b63a3=![];var _0x4be204=![];var _0x3b02cd=![];if(_0x4f0d76){_0x2b63a3=this[_0x5c4f('0x22')]!==_0x4f0d76[_0x5c4f('0x22')]||this[_0x5c4f('0x21')]!==_0x4f0d76[_0x5c4f('0x21')]||this[_0x5c4f('0x3f')]!==_0x4f0d76[_0x5c4f('0x3f')]||this[_0x5c4f('0x40')]!==_0x4f0d76[_0x5c4f('0x40')];_0x4be204=OUTBOUND_COUNTERS[_0x5c4f('0x50')](function(_0x52e220){return this[_0x52e220]!==_0x4f0d76[_0x52e220];},this);if(this[_0x5c4f('0x41')]&&_0x4f0d76[_0x5c4f('0x41')]){_0x3b02cd=this[_0x5c4f('0x41')]['name']!==_0x4f0d76[_0x5c4f('0x41')][_0x5c4f('0x13')]||this[_0x5c4f('0x41')][_0x5c4f('0x42')]!==_0x4f0d76[_0x5c4f('0x41')]['active'];}}return _0x2b63a3||_0x4be204||_0x3b02cd;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x20eece){this['answered']=_0x20eece[_0x5c4f('0x6')];this[_0x5c4f('0x3f')]=_0x20eece['message'];this[_0x5c4f('0x40')]=_0x20eece[_0x5c4f('0x40')];this[_0x5c4f('0x8')]=_0x20eece[_0x5c4f('0x8')];this[_0x5c4f('0x9')]=_0x20eece[_0x5c4f('0x9')];this[_0x5c4f('0xa')]=_0x20eece[_0x5c4f('0xa')];this[_0x5c4f('0xb')]=_0x20eece[_0x5c4f('0xb')];this[_0x5c4f('0x28')]=_0x20eece[_0x5c4f('0x28')];this[_0x5c4f('0xc')]=_0x20eece[_0x5c4f('0xc')];this[_0x5c4f('0x52')]=_0x20eece[_0x5c4f('0x52')];this[_0x5c4f('0xd')]=_0x20eece['outboundNoSuchCallsDay'];this[_0x5c4f('0x2d')]=_0x20eece['outboundReCallsDay'];this[_0x5c4f('0xe')]=_0x20eece[_0x5c4f('0xe')];this[_0x5c4f('0xf')]=_0x20eece[_0x5c4f('0xf')];this[_0x5c4f('0x11')]=_0x20eece[_0x5c4f('0x11')];this[_0x5c4f('0x12')]=_0x20eece[_0x5c4f('0x12')];this[_0x5c4f('0x1c')]=_0x20eece[_0x5c4f('0x1c')];if(this[_0x5c4f('0x22')]==='preview'){this[_0x5c4f('0x10')]=_0x20eece['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xd8ee=['unknown','unmanaged','type','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','xcally-motion-preview','prototype','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedInDb','paused','ringing','waiting','answered','inUse','loggedIn','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','talking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','unavailable'];(function(_0x481f07,_0x4c31c6){var _0x259d7f=function(_0x1ed40e){while(--_0x1ed40e){_0x481f07['push'](_0x481f07['shift']());}};_0x259d7f(++_0x4c31c6);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x3048f7,_0x558a03){_0x3048f7=_0x3048f7-0x0;var _0x265b65=_0xd8ee[_0x3048f7];return _0x265b65;};'use strict';var INBOUND_COUNTERS=[_0xed8e('0x0'),'loggedIn',_0xed8e('0x1'),_0xed8e('0x2'),_0xed8e('0x3'),'talking',_0xed8e('0x4')];var OUTBOUND_COUNTERS=[_0xed8e('0x0'),_0xed8e('0x5'),_0xed8e('0x6'),_0xed8e('0x7'),_0xed8e('0x1'),'originated',_0xed8e('0x8'),_0xed8e('0x9'),_0xed8e('0xa'),_0xed8e('0xb'),_0xed8e('0xc'),_0xed8e('0xd'),_0xed8e('0xe'),'outboundReCallsDay','outboundRejectCallsDay',_0xed8e('0xf'),'paused','pTalking',_0xed8e('0x10'),'sumBillable',_0xed8e('0x11'),_0xed8e('0x12'),'waiting'];function VoiceQueueSummary(_0x36426e){this['id']=_0x36426e['id'];this[_0xed8e('0x13')]=_0x36426e['name'];this[_0xed8e('0x14')]=_0x36426e['strategy'];this[_0xed8e('0x15')]=_0x36426e[_0xed8e('0x15')]||0x0;this[_0xed8e('0x5')]=_0x36426e[_0xed8e('0x5')]||0x0;this[_0xed8e('0x0')]=_0x36426e[_0xed8e('0x0')]||0x0;this[_0xed8e('0x16')]=_0x36426e[_0xed8e('0x16')]||0x0;this[_0xed8e('0x6')]=_0x36426e[_0xed8e('0x6')]||0x0;this[_0xed8e('0x17')]=_0x36426e[_0xed8e('0x17')]||0x0;this[_0xed8e('0x7')]=_0x36426e['loggedIn']||0x0;this[_0xed8e('0x1')]=_0x36426e['loggedInDb']||0x0;this[_0xed8e('0x18')]=_0x36426e[_0xed8e('0x18')]||0x0;this['notInUse']=_0x36426e[_0xed8e('0x19')]||0x0;this[_0xed8e('0x2')]=_0x36426e[_0xed8e('0x2')]||0x0;this['ringing']=_0x36426e['ringing']||0x0;this['ringInUse']=_0x36426e[_0xed8e('0x1a')];this[_0xed8e('0x1b')]=_0x36426e[_0xed8e('0x1b')];this[_0xed8e('0x11')]=_0x36426e['sumDuration'];this['sumHoldTime']=_0x36426e[_0xed8e('0x1c')]||0x0;this[_0xed8e('0x10')]=_0x36426e[_0xed8e('0x10')]||0x0;this[_0xed8e('0x12')]=_0x36426e[_0xed8e('0x12')]||0x0;this['type']=_0x36426e['type'];this[_0xed8e('0x1d')]=_0x36426e['unavailable']||0x0;this[_0xed8e('0x1e')]=_0x36426e[_0xed8e('0x1e')]||0x0;this['unmanaged']=_0x36426e[_0xed8e('0x1f')]||0x0;this[_0xed8e('0x4')]=_0x36426e['waiting']||0x0;if(_0x36426e[_0xed8e('0x20')]==='outbound'){this['pTalking']=_0x36426e[_0xed8e('0x21')]||0x0;this[_0xed8e('0x22')]=_0x36426e[_0xed8e('0x22')];this[_0xed8e('0x23')]=_0x36426e[_0xed8e('0x23')];this[_0xed8e('0x24')]=_0x36426e[_0xed8e('0x24')];this[_0xed8e('0x25')]=_0x36426e[_0xed8e('0x25')];this[_0xed8e('0x26')]=_0x36426e[_0xed8e('0x26')];this['dialPrefix']=_0x36426e['dialPrefix'];this['temp']=_0x36426e[_0xed8e('0x27')];this[_0xed8e('0x28')]=_0x36426e['outboundAnswerAgiCallsDay'];this[_0xed8e('0x9')]=_0x36426e['outboundAnswerCallsDay'];this[_0xed8e('0xa')]=_0x36426e[_0xed8e('0xa')];this[_0xed8e('0xb')]=_0x36426e[_0xed8e('0xb')];this[_0xed8e('0xc')]=_0x36426e[_0xed8e('0xc')];this[_0xed8e('0x29')]=_0x36426e[_0xed8e('0x29')];this[_0xed8e('0x2a')]=_0x36426e['outboundDropCallsDayCallersExit'];this[_0xed8e('0x2b')]=_0x36426e[_0xed8e('0x2b')];this[_0xed8e('0xd')]=_0x36426e[_0xed8e('0xd')];this[_0xed8e('0xe')]=_0x36426e[_0xed8e('0xe')];this[_0xed8e('0x2c')]=_0x36426e[_0xed8e('0x2c')];this[_0xed8e('0x2d')]=_0x36426e[_0xed8e('0x2d')];this[_0xed8e('0x2e')]=_0x36426e[_0xed8e('0x2e')];this[_0xed8e('0xf')]=_0x36426e[_0xed8e('0xf')];this[_0xed8e('0x2f')]=_0x36426e[_0xed8e('0x2f')];this[_0xed8e('0x30')]=_0x36426e[_0xed8e('0x30')];this[_0xed8e('0x31')]=_0x36426e[_0xed8e('0x31')];this[_0xed8e('0x32')]=_0x36426e[_0xed8e('0x32')];this[_0xed8e('0x33')]=_0x36426e[_0xed8e('0x33')];this[_0xed8e('0x34')]=_0x36426e['predictiveIntervalErlangCalls'];this[_0xed8e('0x35')]=_0x36426e[_0xed8e('0x35')];this[_0xed8e('0x36')]=_0x36426e[_0xed8e('0x36')];this[_0xed8e('0x37')]=_0x36426e['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x36426e[_0xed8e('0x38')];this['predictiveIntervalAvailable']=_0x36426e[_0xed8e('0x39')];this[_0xed8e('0x3a')]=_0x36426e[_0xed8e('0x3a')];this[_0xed8e('0x3b')]=_0x36426e[_0xed8e('0x3b')];this[_0xed8e('0x3c')]=_0x36426e[_0xed8e('0x3c')];this[_0xed8e('0x3d')]=_0x36426e[_0xed8e('0x3d')];this['erlangAbandonmentRate']=_0x36426e['erlangAbandonmentRate'];this[_0xed8e('0x3e')]=_0x36426e[_0xed8e('0x3e')];this[_0xed8e('0x3f')]=_0x36426e[_0xed8e('0x3f')];this[_0xed8e('0x40')]=_0x36426e['startProgressive'];this['message']=_0x36426e[_0xed8e('0x41')];this[_0xed8e('0x42')]=_0x36426e[_0xed8e('0x42')];}if(_0x36426e[_0xed8e('0x43')]){this[_0xed8e('0x43')]={'id':_0x36426e[_0xed8e('0x43')]['id'],'name':_0x36426e[_0xed8e('0x43')][_0xed8e('0x13')],'active':_0x36426e[_0xed8e('0x43')][_0xed8e('0x44')],'callerid':_0x36426e['Trunk'][_0xed8e('0x45')]};}}VoiceQueueSummary['prototype'][_0xed8e('0x46')]=function(_0x246837,_0x46e360,_0x36ae79,_0x2e3116){this['loggedInDb']=0x0;this['talking']=0x0;this[_0xed8e('0x2')]=0x0;this['unknown']=0x0;this[_0xed8e('0x19')]=0x0;this['inUse']=0x0;this[_0xed8e('0x16')]=0x0;this[_0xed8e('0x17')]=0x0;this[_0xed8e('0x1d')]=0x0;this[_0xed8e('0x3')]=0x0;this[_0xed8e('0x1a')]=0x0;this[_0xed8e('0x18')]=0x0;if(_0x36ae79){if(_0x36ae79['available']){this['available']=Number(_0x36ae79[_0xed8e('0x0')]);}if(_0x36ae79[_0xed8e('0x47')]){this['loggedIn']=Number(_0x36ae79[_0xed8e('0x47')]);}if(_0x36ae79[_0xed8e('0x48')]){this[_0xed8e('0x4')]=Number(_0x36ae79['callers']);}}for(var _0x50fd08=0x0;_0x50fd08<_0x246837[_0xed8e('0x49')];_0x50fd08++){var _0x314dce=_0x46e360['SIP/'+_0x246837[_0x50fd08][_0xed8e('0x13')]];if(_0x314dce&&_0x314dce[_0xed8e('0x4a')]){this[_0xed8e('0x1')]+=0x1;}if(_0x246837[_0x50fd08][_0xed8e('0x4b')]==='1'){this[_0xed8e('0x10')]+=0x1;}if(_0x246837[_0x50fd08][_0xed8e('0x2')]==='1'&&!['2','7','8'][_0xed8e('0x4c')](_0x246837[_0x50fd08][_0xed8e('0x4d')])){this[_0xed8e('0x2')]+=0x1;}switch(_0x246837[_0x50fd08][_0xed8e('0x4d')]){case'0':this[_0xed8e('0x1e')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xed8e('0x6')]+=0x1;break;case'3':this[_0xed8e('0x16')]+=0x1;break;case'4':this[_0xed8e('0x17')]+=0x1;break;case'5':this[_0xed8e('0x1d')]+=0x1;break;case'6':this[_0xed8e('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xed8e('0x18')]+=0x1;break;}}if(this['dialMethod']===_0xed8e('0x4e')){var _0x47d3e8=Object[_0xed8e('0x4f')](_0x2e3116);for(var _0x44721d=0x0;_0x44721d<_0x47d3e8[_0xed8e('0x49')];_0x44721d++){var _0x5c5916=_0x47d3e8[_0x44721d];var _0x1f36d4=_0x2e3116[_0x5c5916];if(_0x1f36d4[_0xed8e('0x50')]===this[_0xed8e('0x13')]&&_0x1f36d4[_0xed8e('0x20')]==='dialer'&&_0x1f36d4['exten']===_0xed8e('0x51')){this[_0xed8e('0x10')]+=0x1;}}if(this['talking']>this[_0xed8e('0x6')]){this[_0xed8e('0x10')]=this[_0xed8e('0x6')];}this[_0xed8e('0x21')]=0x0;}return this;};VoiceQueueSummary[_0xed8e('0x52')]['compareToInboundQueue']=function(_0x45694b){var _0x342198=![];if(_0x45694b){_0x342198=INBOUND_COUNTERS[_0xed8e('0x53')](function(_0x47c588){return this[_0x47c588]!==_0x45694b[_0x47c588];},this);}return _0x342198;};VoiceQueueSummary[_0xed8e('0x52')][_0xed8e('0x54')]=function(_0x423e0d){var _0x86ffe0=![];var _0x54fde2=![];var _0x90229b=![];if(_0x423e0d){_0x86ffe0=this[_0xed8e('0x23')]!==_0x423e0d[_0xed8e('0x23')]||this['dialActive']!==_0x423e0d['dialActive']||this['message']!==_0x423e0d[_0xed8e('0x41')]||this[_0xed8e('0x42')]!==_0x423e0d[_0xed8e('0x42')];_0x54fde2=OUTBOUND_COUNTERS[_0xed8e('0x53')](function(_0xd12d22){return this[_0xd12d22]!==_0x423e0d[_0xd12d22];},this);if(this['Trunk']&&_0x423e0d[_0xed8e('0x43')]){_0x90229b=this[_0xed8e('0x43')]['name']!==_0x423e0d[_0xed8e('0x43')][_0xed8e('0x13')]||this['Trunk']['active']!==_0x423e0d['Trunk']['active'];}}return _0x86ffe0||_0x54fde2||_0x90229b;};VoiceQueueSummary[_0xed8e('0x52')][_0xed8e('0x55')]=function(_0x5ec049){this[_0xed8e('0x5')]=_0x5ec049[_0xed8e('0x5')];this[_0xed8e('0x41')]=_0x5ec049[_0xed8e('0x41')];this[_0xed8e('0x42')]=_0x5ec049['statusMessage'];this['originated']=_0x5ec049[_0xed8e('0x3b')];this['outboundAbandonedCallsDay']=_0x5ec049[_0xed8e('0x8')];this[_0xed8e('0x9')]=_0x5ec049[_0xed8e('0x9')];this[_0xed8e('0xa')]=_0x5ec049[_0xed8e('0xa')];this[_0xed8e('0xb')]=_0x5ec049[_0xed8e('0xb')];this['outboundCongestionCallsDay']=_0x5ec049[_0xed8e('0xc')];this[_0xed8e('0xd')]=_0x5ec049[_0xed8e('0xd')];this[_0xed8e('0xe')]=_0x5ec049[_0xed8e('0xe')];this[_0xed8e('0x2d')]=_0x5ec049[_0xed8e('0x2d')];this[_0xed8e('0x2e')]=_0x5ec049[_0xed8e('0x2e')];this[_0xed8e('0xf')]=_0x5ec049['outboundUnknownCallsDay'];this[_0xed8e('0x1b')]=_0x5ec049['sumBillable'];this[_0xed8e('0x11')]=_0x5ec049[_0xed8e('0x11')];this[_0xed8e('0x12')]=_0x5ec049[_0xed8e('0x12')];if(this[_0xed8e('0x23')]===_0xed8e('0x56')){this['pTalking']=_0x5ec049['pTalking'];}};module[_0xed8e('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b872f29..387a469 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 _0x3f80=['username','accessKey','serverUrl','Configurations','exports','name'];(function(_0xa68020,_0x22b1e6){var _0x40080a=function(_0x4742c5){while(--_0x4742c5){_0xa68020['push'](_0xa68020['shift']());}};_0x40080a(++_0x22b1e6);}(_0x3f80,0xa7));var _0x03f8=function(_0x260911,_0x345ebb){_0x260911=_0x260911-0x0;var _0x49e3b5=_0x3f80[_0x260911];return _0x49e3b5;};'use strict';function VtigerAccount(_0x3a5e9a){this['id']=_0x3a5e9a['id']||0x0;this[_0x03f8('0x0')]=_0x3a5e9a[_0x03f8('0x0')]||'';this[_0x03f8('0x1')]=_0x3a5e9a[_0x03f8('0x1')]||'';this[_0x03f8('0x2')]=_0x3a5e9a[_0x03f8('0x2')]||'';this['remoteUri']=_0x3a5e9a['remoteUri']||'';this[_0x03f8('0x3')]=_0x3a5e9a[_0x03f8('0x3')]||'';this[_0x03f8('0x4')]=_0x3a5e9a[_0x03f8('0x4')]||{};}module[_0x03f8('0x5')]=VtigerAccount; \ No newline at end of file +var _0xb255=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x95fa9d,_0x1e3ed6){var _0x3140a2=function(_0x2f8f0f){while(--_0x2f8f0f){_0x95fa9d['push'](_0x95fa9d['shift']());}};_0x3140a2(++_0x1e3ed6);}(_0xb255,0x79));var _0x5b25=function(_0x4c4feb,_0x10e2a7){_0x4c4feb=_0x4c4feb-0x0;var _0x1f06f3=_0xb255[_0x4c4feb];return _0x1f06f3;};'use strict';function VtigerAccount(_0x18bb8d){this['id']=_0x18bb8d['id']||0x0;this[_0x5b25('0x0')]=_0x18bb8d[_0x5b25('0x0')]||'';this[_0x5b25('0x1')]=_0x18bb8d[_0x5b25('0x1')]||'';this['accessKey']=_0x18bb8d[_0x5b25('0x2')]||'';this[_0x5b25('0x3')]=_0x18bb8d[_0x5b25('0x3')]||'';this['serverUrl']=_0x18bb8d[_0x5b25('0x4')]||'';this[_0x5b25('0x5')]=_0x18bb8d[_0x5b25('0x5')]||{};}module[_0x5b25('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 07d171a..9a0275c 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 _0x347e=['Configurations','exports','name','username','password','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x326734,_0x38f794){var _0x2b08b1=function(_0x4f16e8){while(--_0x4f16e8){_0x326734['push'](_0x326734['shift']());}};_0x2b08b1(++_0x38f794);}(_0x347e,0x8e));var _0xe347=function(_0xbc256d,_0x2a5cc6){_0xbc256d=_0xbc256d-0x0;var _0x3d74c9=_0x347e[_0xbc256d];return _0x3d74c9;};'use strict';function ZendeskAccount(_0x3fdb14){this['id']=_0x3fdb14['id']||0x0;this[_0xe347('0x0')]=_0x3fdb14[_0xe347('0x0')]||'';this[_0xe347('0x1')]=_0x3fdb14[_0xe347('0x1')]||'';this[_0xe347('0x2')]=_0x3fdb14[_0xe347('0x2')]||'';this['token']=_0x3fdb14['token']||'';this['remoteUri']=_0x3fdb14[_0xe347('0x3')]||'';this[_0xe347('0x4')]=_0x3fdb14[_0xe347('0x4')]||'';this[_0xe347('0x5')]=_0x3fdb14['type']||_0xe347('0x6');this[_0xe347('0x7')]=_0x3fdb14[_0xe347('0x7')]||'';this[_0xe347('0x8')]=_0x3fdb14['Configurations']||{};}module[_0xe347('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xa9b5=['name','username','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9b5,0x64));var _0x5a9b=function(_0x44c4a0,_0x1196c8){_0x44c4a0=_0x44c4a0-0x0;var _0x23445e=_0xa9b5[_0x44c4a0];return _0x23445e;};'use strict';function ZendeskAccount(_0x5d7640){this['id']=_0x5d7640['id']||0x0;this[_0x5a9b('0x0')]=_0x5d7640[_0x5a9b('0x0')]||'';this[_0x5a9b('0x1')]=_0x5d7640['username']||'';this['password']=_0x5d7640['password']||'';this[_0x5a9b('0x2')]=_0x5d7640['token']||'';this['remoteUri']=_0x5d7640[_0x5a9b('0x3')]||'';this[_0x5a9b('0x4')]=_0x5d7640[_0x5a9b('0x4')]||'';this[_0x5a9b('0x5')]=_0x5d7640[_0x5a9b('0x5')]||_0x5a9b('0x6');this[_0x5a9b('0x7')]=_0x5d7640[_0x5a9b('0x7')]||'';this[_0x5a9b('0x8')]=_0x5d7640['Configurations']||{};}module[_0x5a9b('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5352239..bd9de8d 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 _0x3afe=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x29ba7f,_0x1bc35f){var _0x10330e=function(_0x2a6594){while(--_0x2a6594){_0x29ba7f['push'](_0x29ba7f['shift']());}};_0x10330e(++_0x1bc35f);}(_0x3afe,0x1ee));var _0xe3af=function(_0x195a3b,_0x6e9cf1){_0x195a3b=_0x195a3b-0x0;var _0x3b915f=_0x3afe[_0x195a3b];return _0x3b915f;};'use strict';function ZohoAccount(_0x43e7bf){this['id']=_0x43e7bf['id']||0x0;this[_0xe3af('0x0')]=_0x43e7bf[_0xe3af('0x0')]||'';this[_0xe3af('0x1')]=_0x43e7bf[_0xe3af('0x1')]||'';this[_0xe3af('0x2')]=_0x43e7bf[_0xe3af('0x2')]||'';this[_0xe3af('0x3')]=_0x43e7bf['zone']||'';this[_0xe3af('0x4')]=_0x43e7bf[_0xe3af('0x4')]||'';this[_0xe3af('0x5')]=_0x43e7bf['clientSecret']||'';this[_0xe3af('0x6')]=_0x43e7bf[_0xe3af('0x6')]||'';this[_0xe3af('0x7')]=_0x43e7bf['code']||'';this['refreshToken']=_0x43e7bf[_0xe3af('0x8')]||'';this[_0xe3af('0x9')]=_0x43e7bf['Configurations']||{};}module[_0xe3af('0xa')]=ZohoAccount; \ No newline at end of file +var _0x8a97=['exports','name','description','host','zone','clientId','serverUrl','code','refreshToken','Configurations'];(function(_0x1f0a53,_0x5f37ee){var _0x496a93=function(_0x2e02b1){while(--_0x2e02b1){_0x1f0a53['push'](_0x1f0a53['shift']());}};_0x496a93(++_0x5f37ee);}(_0x8a97,0x187));var _0x78a9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8a97[_0x126558];return _0x1f6d14;};'use strict';function ZohoAccount(_0x1121d7){this['id']=_0x1121d7['id']||0x0;this[_0x78a9('0x0')]=_0x1121d7[_0x78a9('0x0')]||'';this[_0x78a9('0x1')]=_0x1121d7[_0x78a9('0x1')]||'';this[_0x78a9('0x2')]=_0x1121d7[_0x78a9('0x2')]||'';this[_0x78a9('0x3')]=_0x1121d7['zone']||'';this[_0x78a9('0x4')]=_0x1121d7[_0x78a9('0x4')]||'';this['clientSecret']=_0x1121d7['clientSecret']||'';this[_0x78a9('0x5')]=_0x1121d7[_0x78a9('0x5')]||'';this[_0x78a9('0x6')]=_0x1121d7[_0x78a9('0x6')]||'';this['refreshToken']=_0x1121d7[_0x78a9('0x7')]||'';this['Configurations']=_0x1121d7[_0x78a9('0x8')]||{};}module[_0x78a9('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 0da2c79..01b86a5 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 _0x781d=['calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','Agent','UserId','VoiceQueueId','prototype','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','membername','name','channelAgent','format','SIP/%s'];(function(_0x520005,_0x3b4536){var _0x2bfd4e=function(_0x497642){while(--_0x497642){_0x520005['push'](_0x520005['shift']());}};_0x2bfd4e(++_0x3b4536);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var util=require(_0xd781('0x0'));var _=require(_0xd781('0x1'));var moment=require('moment');function checkNameSurname(_0x5c1007,_0xb125bf,_0x44a72d){var _0x3cd308='';if(!_[_0xd781('0x2')](_0xb125bf)&&_0xd781('0x3')===typeof _0xb125bf){_0x3cd308+=_0xb125bf;}if(!_[_0xd781('0x2')](_0x44a72d)&&_0xd781('0x3')===typeof _0x44a72d){_0x3cd308+='\x20'+_0x44a72d;}if(_0x3cd308!==''){return _0x3cd308;}return _0x5c1007;}function Action(_0x1d4f4e,_0x830b,_0x2f98ee,_0x5a07f0,_0x133509){this[_0xd781('0x4')]=_0x2f98ee||undefined;this[_0xd781('0x5')]=_0x1d4f4e['id'];this[_0xd781('0x6')]=_0x830b['name'];this[_0xd781('0x7')]=_0x830b['type'];this[_0xd781('0x8')]=_0xd781('0x6');this['dialAnswer']=![];this[_0xd781('0x9')]=_[_0xd781('0x2')](_0x1d4f4e['Agent'])?undefined:_0x1d4f4e['Agent'][_0xd781('0xa')];this[_0xd781('0xb')]=this[_0xd781('0x9')]?util[_0xd781('0xc')](_0xd781('0xd'),this[_0xd781('0x9')]):_0x5a07f0||undefined;this[_0xd781('0xe')]=checkNameSurname(_0x1d4f4e[_0xd781('0xf')][_0xd781('0x10')],_0x1d4f4e[_0xd781('0xf')][_0xd781('0x11')],_0x1d4f4e['Contact'][_0xd781('0x12')]);this[_0xd781('0x13')]=_0x1d4f4e['active']||![];this[_0xd781('0x14')]=_0x1d4f4e['phone'];this[_0xd781('0x15')]=_0x1d4f4e[_0xd781('0x15')];this[_0xd781('0x16')]=_0x1d4f4e[_0xd781('0x16')]||0x0;this[_0xd781('0x17')]=_0x1d4f4e[_0xd781('0x17')]||0x0;this[_0xd781('0x18')]=_0x1d4f4e['countnoanswerretry']||0x0;this[_0xd781('0x19')]=(_0x1d4f4e[_0xd781('0x16')]||0x0)+(_0x1d4f4e[_0xd781('0x17')]||0x0)+(_0x1d4f4e[_0xd781('0x18')]||0x0)+(_0x1d4f4e[_0xd781('0x1a')]||0x0)+(_0x1d4f4e[_0xd781('0x1b')]||0x0)+(_0x1d4f4e[_0xd781('0x1c')]||0x0)+(_0x1d4f4e[_0xd781('0x1d')]||0x0)+(_0x1d4f4e['countagentrejectretry']||0x0);this[_0xd781('0x1a')]=_0x1d4f4e[_0xd781('0x1a')]||0x0;this[_0xd781('0x1b')]=_0x1d4f4e[_0xd781('0x1b')]||0x0;this[_0xd781('0x1c')]=_0x1d4f4e[_0xd781('0x1c')]||0x0;this[_0xd781('0x1d')]=_0x1d4f4e['countmachineretry']||0x0;this[_0xd781('0x1e')]=_0x1d4f4e['countagentrejectretry']||0x0;this['callback']=_0x1d4f4e[_0xd781('0x1f')];this['callbackuniqueid']=_0x1d4f4e[_0xd781('0x20')];this[_0xd781('0x21')]=_0x1d4f4e[_0xd781('0x21')];this[_0xd781('0x22')]=_0x1d4f4e[_0xd781('0x22')];this[_0xd781('0x23')]=_0x1d4f4e[_0xd781('0x23')];this[_0xd781('0x24')]=_0x1d4f4e[_0xd781('0x24')];this['UserId']=_['isNil'](_0x1d4f4e[_0xd781('0x25')])?_0x1d4f4e[_0xd781('0x26')]:_0x1d4f4e[_0xd781('0x25')]['id'];this['VoiceQueueId']=_0x1d4f4e[_0xd781('0x27')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xd781('0x28')]['getCaller']=function(){return util[_0xd781('0xc')](_0xd781('0x29'),this['calleridname'],this['number']);};module[_0xd781('0x2a')]=Action; \ No newline at end of file +var _0x3266=['callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0x3266,0x6a));var _0x6326=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x3266[_0x456fb1];return _0x4083d6;};'use strict';var util=require(_0x6326('0x0'));var _=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));function checkNameSurname(_0x2bed83,_0x545df7,_0x6b67c0){var _0x29aef3='';if(!_[_0x6326('0x3')](_0x545df7)&&_0x6326('0x4')===typeof _0x545df7){_0x29aef3+=_0x545df7;}if(!_['isNil'](_0x6b67c0)&&_0x6326('0x4')===typeof _0x6b67c0){_0x29aef3+='\x20'+_0x6b67c0;}if(_0x29aef3!==''){return _0x29aef3;}return _0x2bed83;}function Action(_0x5f38a3,_0x25ecd8,_0x44460c,_0x14208e,_0x5402e5){this[_0x6326('0x5')]=_0x44460c||undefined;this['idContact']=_0x5f38a3['id'];this[_0x6326('0x6')]=_0x25ecd8[_0x6326('0x7')];this[_0x6326('0x8')]=_0x25ecd8[_0x6326('0x8')];this[_0x6326('0x9')]='queue';this[_0x6326('0xa')]=![];this[_0x6326('0xb')]=_[_0x6326('0x3')](_0x5f38a3[_0x6326('0xc')])?undefined:_0x5f38a3[_0x6326('0xc')][_0x6326('0x7')];this[_0x6326('0xd')]=this[_0x6326('0xb')]?util[_0x6326('0xe')](_0x6326('0xf'),this['membername']):_0x14208e||undefined;this['calleridname']=checkNameSurname(_0x5f38a3[_0x6326('0x10')][_0x6326('0x11')],_0x5f38a3['Contact'][_0x6326('0x12')],_0x5f38a3['Contact'][_0x6326('0x13')]);this[_0x6326('0x14')]=_0x5f38a3[_0x6326('0x14')]||![];this[_0x6326('0x15')]=_0x5f38a3[_0x6326('0x11')];this[_0x6326('0x16')]=_0x5f38a3['scheduledat'];this[_0x6326('0x17')]=_0x5f38a3['countbusyretry']||0x0;this['countcongestionretry']=_0x5f38a3['countcongestionretry']||0x0;this['countnoanswerretry']=_0x5f38a3['countnoanswerretry']||0x0;this['countglobal']=(_0x5f38a3[_0x6326('0x17')]||0x0)+(_0x5f38a3[_0x6326('0x18')]||0x0)+(_0x5f38a3[_0x6326('0x19')]||0x0)+(_0x5f38a3['countnosuchnumberretry']||0x0)+(_0x5f38a3['countdropretry']||0x0)+(_0x5f38a3[_0x6326('0x1a')]||0x0)+(_0x5f38a3[_0x6326('0x1b')]||0x0)+(_0x5f38a3[_0x6326('0x1c')]||0x0);this[_0x6326('0x1d')]=_0x5f38a3[_0x6326('0x1d')]||0x0;this[_0x6326('0x1e')]=_0x5f38a3[_0x6326('0x1e')]||0x0;this['countabandonedretry']=_0x5f38a3[_0x6326('0x1a')]||0x0;this['countmachineretry']=_0x5f38a3[_0x6326('0x1b')]||0x0;this[_0x6326('0x1c')]=_0x5f38a3[_0x6326('0x1c')]||0x0;this[_0x6326('0x1f')]=_0x5f38a3[_0x6326('0x1f')];this[_0x6326('0x20')]=_0x5f38a3[_0x6326('0x20')];this[_0x6326('0x21')]=_0x5f38a3[_0x6326('0x21')];this[_0x6326('0x22')]=_0x5f38a3[_0x6326('0x22')];this['ContactId']=_0x5f38a3[_0x6326('0x23')];this[_0x6326('0x24')]=_0x5f38a3['ListId'];this['UserId']=_['isNil'](_0x5f38a3[_0x6326('0xc')])?_0x5f38a3['UserId']:_0x5f38a3[_0x6326('0xc')]['id'];this[_0x6326('0x25')]=_0x5f38a3['VoiceQueueId'];this[_0x6326('0x26')]='';this[_0x6326('0x27')]='';}Action[_0x6326('0x28')][_0x6326('0x29')]=function(){return util[_0x6326('0xe')](_0x6326('0x2a'),this[_0x6326('0x2b')],this[_0x6326('0x2c')]);};module[_0x6326('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9ca8870..99af307 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x4be4bc,_0x544eb5){var _0x494f7a=function(_0x45c0c6){while(--_0x45c0c6){_0x4be4bc['push'](_0x4be4bc['shift']());}};_0x494f7a(++_0x544eb5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x3e98e2,_0x2f210c){var _0x39f87d=function(_0x4f2bec){while(--_0x4f2bec){_0x3e98e2['push'](_0x3e98e2['shift']());}};_0x39f87d(++_0x2f210c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index af0e9d4..abb798e 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 _0x6704=['error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','active','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6704,0x17b));var _0x4670=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0x6704[_0x15f27e];return _0x18da4f;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x4670('0x0'))('preview');var cmHopper=require(_0x4670('0x1'));var cmHopperHistory=require(_0x4670('0x2'));var cmHopperBlack=require(_0x4670('0x3'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x4670('0x4'));function loggerCatch(_0x5b65fa){return function(_0x105e23){logger[_0x4670('0x5')](_0x5b65fa,util[_0x4670('0x6')](_0x105e23,{'showHidden':![],'depth':null}));};}function create(_0x3e2bdd){return cmHopperHistory[_0x4670('0x7')](_0x3e2bdd)[_0x4670('0x8')](loggerCatch(_0x4670('0x9')));}function createAgent(_0x4c20e6){return BPromise[_0x4670('0xa')]()[_0x4670('0xb')](agentReportPreview[_0x4670('0x7')](_0x4c20e6))['catch'](loggerCatch(_0x4670('0x9')));}function moveContact(_0x263bce){return cmHopper[_0x4670('0xc')](_0x263bce,!![])[_0x4670('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x4670('0xd')]=function(_0x4b2125){return cmHopperBlack['checkIsBlackList'](_0x4b2125)[_0x4670('0x8')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x4670('0xe')]=function(_0x3e77c9){return BPromise[_0x4670('0xa')]()[_0x4670('0xb')](cmHopper[_0x4670('0xe')](_0x3e77c9))['catch'](loggerCatch(_0x4670('0xf')));};exports[_0x4670('0x7')]=function(_0x5a866d,_0x160ef1){create(_0x5a866d)[_0x4670('0x8')](loggerCatch(_0x160ef1));moveContact(_0x5a866d)[_0x4670('0x8')](loggerCatch(_0x160ef1));};exports[_0x4670('0x10')]=function(_0x5053b1,_0x597cef){createAgent(_0x5053b1)['catch'](loggerCatch(_0x597cef));};exports[_0x4670('0x11')]=function(_0x29e79b,_0x4a8f79){create(_0x29e79b)[_0x4670('0x8')](loggerCatch(_0x4a8f79));};exports['createCustomerFinal']=function(_0x2d4a6e,_0x240b5a){moveContact(_0x2d4a6e)[_0x4670('0x8')](loggerCatch(_0x240b5a));};exports['rescheduleContact']=function(_0x2f0280,_0x1f3107,_0xe5befd){if(_0x1f3107){_0x2f0280['UserId']=null;}if(_0xe5befd){_0x2f0280[_0x4670('0x12')]=![];}return cmHopper[_0x4670('0x13')](_0x2f0280)[_0x4670('0x8')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x4f950b){return cmHopper[_0x4670('0x14')](_0x4f950b)[_0x4670('0x8')](loggerCatch(_0x4670('0x15')));};exports[_0x4670('0x16')]=function(_0x47b085){return cmHopper[_0x4670('0x16')]({'UserId':null},_0x47b085,0x1)['catch'](loggerCatch(_0x4670('0x17')));};exports[_0x4670('0x18')]=function(_0x368038){return cmHopper[_0x4670('0x16')]({'active':![]},_0x368038,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x2cae80){var _0x13a467={};_0x13a467[_0x4670('0x19')]=_0x2cae80[_0x4670('0x19')];_0x13a467[_0x4670('0x1a')]=_0x2cae80[_0x4670('0x1a')];_0x13a467[_0x4670('0x1b')]=_0x2cae80[_0x4670('0x1b')];_0x13a467[_0x4670('0x1c')]=_0x2cae80[_0x4670('0x1c')];_0x13a467[_0x4670('0x1d')]=_0x2cae80['queue'];_0x13a467[_0x4670('0x1e')]=_0x2cae80['answertime'];_0x13a467[_0x4670('0x1f')]=_0x2cae80[_0x4670('0x20')];_0x13a467['queuecallercomplete']=0x1;_0x13a467[_0x4670('0x21')]=_0x2cae80[_0x4670('0x22')];_0x13a467[_0x4670('0x23')]=_0x2cae80[_0x4670('0x24')];_0x13a467[_0x4670('0x25')]=_0x4670('0x26');_0x13a467[_0x4670('0x27')]=_0x4670('0x28');_0x13a467[_0x4670('0x29')]=0x0;_0x13a467[_0x4670('0x2a')]=0x1;_0x13a467[_0x4670('0x2b')]=_0x2cae80[_0x4670('0x24')];_0x13a467[_0x4670('0x2c')]=_0x4670('0x2d');return BPromise[_0x4670('0xa')]()[_0x4670('0xb')](voiceQueueReport['create'](_0x13a467))[_0x4670('0x8')](loggerCatch(_0x4670('0x2e')));};exports[_0x4670('0x2f')]=function(_0x7225af,_0x50c393){return BPromise[_0x4670('0xa')]()[_0x4670('0xb')](cmHopper['getContactRecallMe'](_0x7225af,_0x50c393))[_0x4670('0x8')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x22ccfe){return cmHopper[_0x4670('0x13')](_0x22ccfe,!![],!![])[_0x4670('0x8')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd8f6=['assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','holdtime'];(function(_0x2a10ea,_0x328c19){var _0x20df49=function(_0x4e184a){while(--_0x4e184a){_0x2a10ea['push'](_0x2a10ea['shift']());}};_0x20df49(++_0x328c19);}(_0xd8f6,0x103));var _0x6d8f=function(_0x3709bf,_0x11f187){_0x3709bf=_0x3709bf-0x0;var _0x360a5a=_0xd8f6[_0x3709bf];return _0x360a5a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x6d8f('0x0'))(_0x6d8f('0x1'));var cmHopper=require(_0x6d8f('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6d8f('0x3'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6d8f('0x4'));function loggerCatch(_0x271988){return function(_0x52c284){logger[_0x6d8f('0x5')](_0x271988,util[_0x6d8f('0x6')](_0x52c284,{'showHidden':![],'depth':null}));};}function create(_0x16ef24){return cmHopperHistory[_0x6d8f('0x7')](_0x16ef24)[_0x6d8f('0x8')](loggerCatch(_0x6d8f('0x9')));}function createAgent(_0xfe1915){return BPromise['resolve']()['then'](agentReportPreview[_0x6d8f('0x7')](_0xfe1915))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x51f207){return cmHopper['moveContactManagedDialer'](_0x51f207,!![])['catch'](loggerCatch(_0x6d8f('0xa')));}exports[_0x6d8f('0xb')]=function(_0x45a053){return cmHopperBlack['checkIsBlackList'](_0x45a053)[_0x6d8f('0x8')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6d8f('0xc')]=function(_0x5f2f52){return BPromise[_0x6d8f('0xd')]()[_0x6d8f('0xe')](cmHopper['getContactPreview'](_0x5f2f52))[_0x6d8f('0x8')](loggerCatch(_0x6d8f('0xf')));};exports[_0x6d8f('0x7')]=function(_0x23186a,_0x509265){create(_0x23186a)[_0x6d8f('0x8')](loggerCatch(_0x509265));moveContact(_0x23186a)[_0x6d8f('0x8')](loggerCatch(_0x509265));};exports[_0x6d8f('0x10')]=function(_0x19128e,_0x47fc79){createAgent(_0x19128e)[_0x6d8f('0x8')](loggerCatch(_0x47fc79));};exports[_0x6d8f('0x11')]=function(_0x2ad399,_0x1bb686){create(_0x2ad399)['catch'](loggerCatch(_0x1bb686));};exports['createCustomerFinal']=function(_0x208ad5,_0x511dc7){moveContact(_0x208ad5)[_0x6d8f('0x8')](loggerCatch(_0x511dc7));};exports[_0x6d8f('0x12')]=function(_0x2a86b8,_0xbd6998,_0x1d1bbe){if(_0xbd6998){_0x2a86b8[_0x6d8f('0x13')]=null;}if(_0x1d1bbe){_0x2a86b8[_0x6d8f('0x14')]=![];}return cmHopper['rescheduleContact'](_0x2a86b8)[_0x6d8f('0x8')](loggerCatch(_0x6d8f('0x15')));};exports['countReScheduled']=function(_0x45bb1f){return cmHopper['countReScheduled'](_0x45bb1f)['catch'](loggerCatch(_0x6d8f('0x16')));};exports[_0x6d8f('0x17')]=function(_0x5d3d33){return cmHopper[_0x6d8f('0x17')]({'UserId':null},_0x5d3d33,0x1)[_0x6d8f('0x8')](loggerCatch(_0x6d8f('0x18')));};exports[_0x6d8f('0x19')]=function(_0x375d7c){return cmHopper[_0x6d8f('0x17')]({'active':![]},_0x375d7c,0x1)[_0x6d8f('0x8')](loggerCatch(_0x6d8f('0x1a')));};exports[_0x6d8f('0x1b')]=function(_0x3790c4){var _0xb99a3={};_0xb99a3[_0x6d8f('0x1c')]=_0x3790c4[_0x6d8f('0x1c')];_0xb99a3['uniqueid']=_0x3790c4['uniqueid'];_0xb99a3['calleridnum']=_0x3790c4['calleridnum'];_0xb99a3[_0x6d8f('0x1d')]=_0x3790c4[_0x6d8f('0x1d')];_0xb99a3[_0x6d8f('0x1e')]=_0x3790c4[_0x6d8f('0x1e')];_0xb99a3['queuecallerjoinAt']=_0x3790c4[_0x6d8f('0x1f')];_0xb99a3[_0x6d8f('0x20')]=_0x3790c4[_0x6d8f('0x1f')];_0xb99a3[_0x6d8f('0x21')]=0x1;_0xb99a3[_0x6d8f('0x22')]=_0x3790c4[_0x6d8f('0x23')];_0xb99a3['connectedlinename']=_0x3790c4[_0x6d8f('0x24')];_0xb99a3[_0x6d8f('0x25')]=_0x6d8f('0x26');_0xb99a3['exten']=_0x6d8f('0x27');_0xb99a3[_0x6d8f('0x28')]=0x0;_0xb99a3[_0x6d8f('0x29')]=0x1;_0xb99a3[_0x6d8f('0x2a')]=_0x3790c4[_0x6d8f('0x24')];_0xb99a3[_0x6d8f('0x2b')]=_0x6d8f('0x2c');return BPromise['resolve']()['then'](voiceQueueReport['create'](_0xb99a3))['catch'](loggerCatch(_0x6d8f('0x2d')));};exports['getContactRecallMe']=function(_0x4577be,_0x18c129){return BPromise['resolve']()['then'](cmHopper[_0x6d8f('0x2e')](_0x4577be,_0x18c129))[_0x6d8f('0x8')](loggerCatch(_0x6d8f('0x2f')));};exports[_0x6d8f('0x30')]=function(_0x11f7c9){return cmHopper['rescheduleContact'](_0x11f7c9,!![],!![])[_0x6d8f('0x8')](loggerCatch(_0x6d8f('0x31')));}; \ 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 d416dfe..be45d1d 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 _0x706a=['xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','info','inspect','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','logLookAgent','logCustomer','statedesc','endtime','ringtime','getSeconds','talktime','answertime','variablesAction','BOOKED','originate','channelAgent','from-sip','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','membername','countglobal','callbackat','recallme','UserId','sipcallid','xmd-queue'];(function(_0x587923,_0xfa59dc){var _0x373532=function(_0x57d3ed){while(--_0x57d3ed){_0x587923['push'](_0x587923['shift']());}};_0x373532(++_0xfa59dc);}(_0x706a,0xac));var _0xa706=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0x706a[_0x223c0d];return _0x207827;};'use strict';var util=require(_0xa706('0x0'));var _=require(_0xa706('0x1'));var moment=require(_0xa706('0x2'));var logger=require(_0xa706('0x3'))(_0xa706('0x4'));var ipAgi=process[_0xa706('0x5')][_0xa706('0x6')]||_0xa706('0x7');var utils=require(_0xa706('0x8'));exports['loggerCatch']=function(_0x6bb7a2){return function(_0x12291f){logger[_0xa706('0x9')](_0x6bb7a2,util['inspect'](_0x12291f,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x303218,_0x3c70e8){logger[_0xa706('0xa')](_0x303218,util[_0xa706('0xb')](_0x3c70e8,{'showHidden':![],'depth':null}));};exports[_0xa706('0xc')]=function(_0xc89cda,_0x20afa0){logger[_0xa706('0x9')](_0xc89cda,util[_0xa706('0xb')](_0x20afa0,{'showHidden':![],'depth':null}));};exports[_0xa706('0xd')]=function(_0x53185b){return function(_0x452b9c){logger[_0xa706('0xa')](_0x53185b,util[_0xa706('0xb')](_0x452b9c,{'showHidden':![],'depth':null}));};};exports[_0xa706('0xe')]=function(_0x546428,_0x56a029,_0x2a71b2){return{'message':_0x546428,'unlock':_0x56a029,'active':_0x2a71b2};};exports[_0xa706('0xf')]=function(_0x1dd765,_0x105fd5,_0x1fcfe9){if(!_['isUndefined'](_0x1fcfe9)&&_0xa706('0x10')===typeof _0x1fcfe9&&!_[_0xa706('0x11')](_0x1fcfe9)){if(!_[_0xa706('0x12')](_0x105fd5)&&_0xa706('0x10')===typeof _0x105fd5&&!_['isEmpty'](_0x105fd5)){return util[_0xa706('0x13')](_0xa706('0x14'),_0x105fd5,_0x1fcfe9);}return util[_0xa706('0x13')](_0xa706('0x14'),_0x1fcfe9,_0x1fcfe9);}if(!_['isUndefined'](_0x1dd765)&&'string'===typeof _0x1dd765&&!_['isEmpty'](_0x1dd765)){return _0x1dd765;}return _0xa706('0x15');};exports[_0xa706('0x16')]=function(_0x365133){if(_[_0xa706('0x17')](_0x365133)){return![];}return _0x365133;};exports['addVariables']=function(_0x369359,_0x4288aa,_0x80b83d,_0x5b7a99,_0x1769d5,_0x45965d){var _0x4d9146={'XMD-QUEUE':_0x4288aa['Queue']?_0x4288aa['Queue'][_0xa706('0x18')]:'','XMD-CALLERID':_0x5b7a99,'XMD-CALLERID-PREVIEW':_0x45965d?util[_0xa706('0x13')]('\x22%s\x22\x20<%s>',_0x45965d[_0xa706('0x19')],_0x45965d[_0xa706('0x1a')]):_0x5b7a99,'XMD-DIALID':_0x1769d5,'XMD-CONTACTID':_0x4288aa[_0xa706('0x1b')],'XMD-CDRTYPE':_0xa706('0x1c'),'CALLERID(all)':_0x5b7a99,'XMD-VOICEQUEUEID':_0x4288aa[_0xa706('0x1d')],'XMD-DIALCHANNEL':_0x80b83d,'XMD-DIALTIMEOUT':_0x369359[_0xa706('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xa706('0x13')](_0xa706('0x1f'),_0x369359[_0xa706('0x20')]?'g':'',_[_0xa706('0x11')](_0x369359['monitor_format'])?'':_0xa706('0x21')),'XMD-DIALURL':_0x369359['dialPreviewUrl']||'','XMD-AGI':_0x369359['dialQueueProject']?util[_0xa706('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x369359[_0xa706('0x22')]):'NONE','XMD-AGIAFTER':_0x369359[_0xa706('0x20')]?util[_0xa706('0x13')](_0xa706('0x23'),ipAgi,_0x369359['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x45965d?_0x45965d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x45965d?_0x45965d[_0xa706('0x24')]:'','XMD-DESTINATION':_0xa706('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xa706('0x11')](_0x369359[_0xa706('0x26')])){_0x4d9146[util[_0xa706('0x13')]('%s',_0xa706('0x27'))]=_0x369359[_0xa706('0x26')];_0x4d9146[util[_0xa706('0x13')]('%s',_0xa706('0x28'))]=_0x1769d5;}return _0x4d9146;};exports[_0xa706('0x29')]=function(_0x455413){var _0x564bb7={};for(var _0x202fa8 in _0x455413){if(_0x455413[_0xa706('0x2a')](_0x202fa8)){_0x564bb7[util['format']('%s',_[_0xa706('0x2b')](_0x202fa8))]=_0x455413[_0x202fa8];}}return{'variables':_0x564bb7};};exports['updateOriginated']=function(_0x287d90,_0x11832a){if(!_[_0xa706('0x17')](_0x287d90)){if(_0x287d90[_0xa706('0x2a')](_0xa706('0x2c'))){if(_0x287d90['originated']>0x0){_0x287d90[_0xa706('0x2c')]-=0x1;}else{logger[_0xa706('0x9')](_0xa706('0x2d'),_0x11832a);}}}else{logger[_0xa706('0x9')](_0xa706('0x2e'),_0x11832a);}};exports['logBlacklist']=function(_0x4d6e7c){var _0x4b9a4c=moment()[_0xa706('0x13')](_0xa706('0x2f'));_0x4d6e7c[_0xa706('0x30')]=0xd;_0x4d6e7c['statedesc']=_0xa706('0x31');_0x4d6e7c[_0xa706('0x32')]=_0x4b9a4c;_0x4d6e7c[_0xa706('0x33')]=_0x4b9a4c;_0x4d6e7c['endtime']=_0x4b9a4c;};exports['logAgent']=function(_0x454196,_0x371fd4,_0x4f77b9){var _0x419d70=moment()['format'](_0xa706('0x2f'));_0x454196[_0xa706('0x30')]=_0x371fd4;_0x454196['statedesc']=_0x4f77b9;_0x454196['responsetime']=_0x419d70;_0x454196['ringtime']=utils['getSeconds'](_0x454196['responsetime'],_0x454196[_0xa706('0x32')]);};exports[_0xa706('0x34')]=function(_0x10b605,_0xd80ade,_0x8c2987){_0x10b605['membername']=_0xd80ade;_0x10b605['UserId']=_0x8c2987;};exports[_0xa706('0x35')]=function(_0x4bb785,_0x1f4db0,_0x242748){var _0x281145=moment()[_0xa706('0x13')](_0xa706('0x2f'));_0x4bb785[_0xa706('0x30')]=_0x1f4db0;_0x4bb785[_0xa706('0x36')]=_0x242748;_0x4bb785[_0xa706('0x33')]=_0x4bb785['responsetime']?_0x4bb785[_0xa706('0x33')]:_0x281145;_0x4bb785[_0xa706('0x37')]=_0x4bb785[_0xa706('0x37')]?_0x4bb785[_0xa706('0x37')]:_0x281145;_0x4bb785[_0xa706('0x38')]=utils[_0xa706('0x39')](_0x4bb785[_0xa706('0x33')]||0x0,_0x4bb785[_0xa706('0x32')]||0x0);_0x4bb785[_0xa706('0x3a')]=_0x4bb785[_0xa706('0x3b')]?utils['getSeconds'](_0x4bb785['endtime'],_0x4bb785['answertime']):0x0;};exports['isFailure']=function(_0x43c296){return _0x43c296==='Failure';};exports[_0xa706('0x3c')]=function(_0x141904,_0x2aa7c9,_0x594c8b,_0x233039,_0x2f6144){var _0x4c54ed=_0x233039?'RECALL':_0x141904[_0xa706('0x19')];_0x4c54ed=_0x2f6144?_0xa706('0x3d'):_0x4c54ed;return{'actionid':_0x141904['uniqueid'],'action':_0xa706('0x3e'),'channel':_0x141904[_0xa706('0x3f')],'callerid':util[_0xa706('0x13')](_0xa706('0x14'),_0x4c54ed,_0x141904[_0xa706('0x1a')]),'Exten':_0xa706('0x25'),'Context':_0xa706('0x40'),'Priority':'1','variable':_0x594c8b,'timeout':(_0x2aa7c9['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x141904['uniqueid']};};exports[_0xa706('0x41')]=function(_0x4e1a25){return _0x4e1a25['countbusyretry']+_0x4e1a25['countcongestionretry']+_0x4e1a25[_0xa706('0x42')]+_0x4e1a25[_0xa706('0x43')]+_0x4e1a25[_0xa706('0x44')];};exports['cloneAction']=function(_0x4d3022){var _0xde50bd=_[_0xa706('0x45')](_0x4d3022);_0xde50bd[_0xa706('0x30')]=0xf;_0xde50bd[_0xa706('0x36')]=_0xa706('0x46');return _0xde50bd;};exports[_0xa706('0x47')]=function(_0x2c7130,_0x1c967d,_0x412f79){var _0x1a3bec={};_0x1a3bec[_0x1c967d]=_0x2c7130[_0x1c967d];_0x1a3bec[_0xa706('0x48')]=![];_0x1a3bec[_0xa706('0x49')]=moment()[_0xa706('0x4a')](_0x412f79,_0xa706('0x4b'))[_0xa706('0x13')](_0xa706('0x2f'));_0x1a3bec[_0xa706('0x1b')]=_0x2c7130['ContactId'];_0x1a3bec[_0xa706('0x4c')]=_0x2c7130[_0xa706('0x4c')];_0x1a3bec[_0xa706('0x1d')]=_0x2c7130[_0xa706('0x1d')]||undefined;return _0x1a3bec;};exports[_0xa706('0x4d')]=function(_0x1f1430,_0x26412c){if(!_[_0xa706('0x17')](_0x1f1430)){if(_0x1f1430[_0xa706('0x4e')]>0x0){_0x1f1430[_0xa706('0x4e')]-=0x1;}else{logger[_0xa706('0x9')](_0x26412c,_0xa706('0x4f'));}}else{logger[_0xa706('0x9')](_0x26412c,_0xa706('0x50'));}};exports[_0xa706('0x51')]=function(_0x105c30){if(_0x105c30<=0x0){return!![];}return![];};function buildObj(_0x1c7b1f,_0x5845dc,_0x468f47){_0x1c7b1f[_0xa706('0x52')]=_0x5845dc;_0x1c7b1f[_0xa706('0x18')]=_0x1c7b1f[_0xa706('0x53')];_0x1c7b1f[_0xa706('0x54')]=_0x1c7b1f[_0xa706('0x3f')];_0x1c7b1f[_0xa706('0x55')]=_0xa706('0x56');if(_0x468f47){_0x1c7b1f['mandatoryDisposition']=_0x468f47[_0xa706('0x57')];}return _0x1c7b1f;}exports[_0xa706('0x58')]=buildObj;exports[_0xa706('0x59')]=function(_0x706a9c){var _0x577d53=[];for(var _0x490ee7 in _0x706a9c){if(_0x706a9c[_0xa706('0x2a')](_0x490ee7)){if(!_[_0xa706('0x17')](_0x706a9c[_0x490ee7])&&_0x706a9c[_0x490ee7][_0xa706('0x30')]===_0xa706('0x5a')&&_0x706a9c[_0x490ee7][_0xa706('0x5b')]===_0xa706('0x5c')){_0x577d53[_0xa706('0x5d')](_0x706a9c[_0x490ee7]['id']);}}}return _0x577d53;};exports[_0xa706('0x5e')]=function(_0x38bccc){var _0xc32480=moment()['milliseconds'](0x0);var _0x1b467c=moment(_0x38bccc)[_0xa706('0x5f')](0x0);return _0xc32480['diff'](_0x1b467c,_0xa706('0x60'));};exports[_0xa706('0x61')]=function(_0x8886ef){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x8886ef['ContactId'],'ListId':_0x8886ef[_0xa706('0x4c')],'VoiceQueueId':_0x8886ef[_0xa706('0x1d')]||undefined,'CampaignId':_0x8886ef[_0xa706('0x62')]||undefined};};exports[_0xa706('0x63')]=function(_0x549101){if(_0x549101==='uniqueid'||_0x549101===_0xa706('0x64')||_0x549101===_0xa706('0x53')||_0x549101==='type'||_0x549101==='campaigntype'||_0x549101==='dialAnswer'||_0x549101===_0xa706('0x65')||_0x549101===_0xa706('0x3f')||_0x549101==='calleridname'||_0x549101===_0xa706('0x48')||_0x549101===_0xa706('0x1a')||_0x549101===_0xa706('0x49')||_0x549101==='countbusyretry'||_0x549101==='countcongestionretry'||_0x549101===_0xa706('0x42')||_0x549101===_0xa706('0x66')||_0x549101==='callback'||_0x549101==='callbackuniqueid'||_0x549101===_0xa706('0x67')||_0x549101===_0xa706('0x68')||_0x549101===_0xa706('0x1b')||_0x549101===_0xa706('0x4c')||_0x549101===_0xa706('0x69')||_0x549101===_0xa706('0x1d')||_0x549101===_0xa706('0x6a')||_0x549101==='xmd-voicequeueid'||_0x549101===_0xa706('0x6b')||_0x549101===_0xa706('0x6c')||_0x549101===_0xa706('0x6d')||_0x549101===_0xa706('0x6e')||_0x549101===_0xa706('0x6f')||_0x549101===_0xa706('0x70')||_0x549101===_0xa706('0x71')||_0x549101===_0xa706('0x72')||_0x549101===_0xa706('0x73')||_0x549101===_0xa706('0x74')||_0x549101===_0xa706('0x75')||_0x549101===_0xa706('0x76')||_0x549101===_0xa706('0x77')||_0x549101==='rtpaudioqos'||_0x549101===_0xa706('0x78')||_0x549101===_0xa706('0x79')||_0x549101===_0xa706('0x7a')||_0x549101==='rtpaudioqosloss'||_0x549101===_0xa706('0x7b')||_0x549101===_0xa706('0x7c')||_0x549101==='rtpaudioqosrttbridged'||_0x549101===_0xa706('0x7d')||_0x549101===_0xa706('0x78')||_0x549101===_0xa706('0x79')||_0x549101===_0xa706('0x7a')||_0x549101==='rtpaudioqosloss'||_0x549101===_0xa706('0x7b')||_0x549101==='rtpaudioqosrtt'||_0x549101==='rtpaudioqosrttbridged'||_0x549101===_0xa706('0x7e')||_0x549101===_0xa706('0x7f')||_0x549101==='state'||_0x549101===_0xa706('0x36')){return![];}return!![];};exports[_0xa706('0x80')]=function(_0xc84538,_0x31b2f4){var _0x336a96,_0x14337a,_0x523561;if(_0x31b2f4<=0x0){_0x31b2f4=0x1;}_0x336a96=new RegExp(_0xa706('0x81')+_0x31b2f4+'}$');_0x14337a=Math[_0xa706('0x82')](0xa,_0x31b2f4-0x1);_0x523561=Math[_0xa706('0x82')](0xa,_0x31b2f4)-0x1;return util[_0xa706('0x13')]('%s',_[_0xa706('0x83')](_0xc84538,_0x336a96,_['random'](_0x14337a,_0x523561)));};exports[_0xa706('0x84')]=function(_0x18d7e1){var _0x2bbef5=_0x18d7e1[_0xa706('0x85')](/"(.*?)"/);return _0x2bbef5?_0x2bbef5[0x1]:_0x18d7e1;};exports[_0xa706('0x86')]=function(_0x5baf8f){var _0x31a18b=_0x5baf8f[_0xa706('0x85')](/<(.*?)>/);return _0x31a18b?_0x31a18b[0x1]:_0x5baf8f;};function buildNoAnswerEventPayload(_0x425c2d,_0x59dbf2){var _0x18dc82=buildObj(_0x425c2d,_0xa706('0x87'));if(!_[_0xa706('0x11')](_0x59dbf2[_0xa706('0x88')])){Object[_0xa706('0x89')](_0x59dbf2[_0xa706('0x88')])[_0xa706('0x8a')](function(_0x199add){_0x18dc82[_0x199add[_0xa706('0x8b')]()]=_0x59dbf2[_0xa706('0x88')][_0x199add];});}return _0x18dc82;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x375e=['xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','inspect','logger','info','loggerError','error','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','responsetime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','cloneAction','clone','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','push','getDiff','milliseconds','seconds','createBody','idContact','type','dialAnswer','calleridnum','countnoanswerretry','countglobal','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout'];(function(_0x4ecae4,_0x6b1079){var _0x57a84e=function(_0x2c67f4){while(--_0x2c67f4){_0x4ecae4['push'](_0x4ecae4['shift']());}};_0x57a84e(++_0x6b1079);}(_0x375e,0x1b4));var _0xe375=function(_0x3cec9a,_0x31880c){_0x3cec9a=_0x3cec9a-0x0;var _0x1c172c=_0x375e[_0x3cec9a];return _0x1c172c;};'use strict';var util=require(_0xe375('0x0'));var _=require('lodash');var moment=require(_0xe375('0x1'));var logger=require(_0xe375('0x2'))(_0xe375('0x3'));var ipAgi=process[_0xe375('0x4')][_0xe375('0x5')]||'127.0.0.1';var utils=require(_0xe375('0x6'));exports['loggerCatch']=function(_0x565a1e){return function(_0x2abf51){logger['error'](_0x565a1e,util[_0xe375('0x7')](_0x2abf51,{'showHidden':![],'depth':null}));};};exports[_0xe375('0x8')]=function(_0x49a51f,_0x1c27e){logger[_0xe375('0x9')](_0x49a51f,util[_0xe375('0x7')](_0x1c27e,{'showHidden':![],'depth':null}));};exports[_0xe375('0xa')]=function(_0x53b743,_0x8a2f1){logger[_0xe375('0xb')](_0x53b743,util[_0xe375('0x7')](_0x8a2f1,{'showHidden':![],'depth':null}));};exports[_0xe375('0xc')]=function(_0x18e28e){return function(_0x204a40){logger[_0xe375('0x9')](_0x18e28e,util[_0xe375('0x7')](_0x204a40,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x55246e,_0x5752ea,_0x43ebe7){return{'message':_0x55246e,'unlock':_0x5752ea,'active':_0x43ebe7};};exports[_0xe375('0xd')]=function(_0x26f91e,_0x8cfc74,_0x3fb383){if(!_[_0xe375('0xe')](_0x3fb383)&&_0xe375('0xf')===typeof _0x3fb383&&!_['isEmpty'](_0x3fb383)){if(!_[_0xe375('0xe')](_0x8cfc74)&&_0xe375('0xf')===typeof _0x8cfc74&&!_[_0xe375('0x10')](_0x8cfc74)){return util['format']('\x22%s\x22\x20<%s>',_0x8cfc74,_0x3fb383);}return util[_0xe375('0x11')](_0xe375('0x12'),_0x3fb383,_0x3fb383);}if(!_[_0xe375('0xe')](_0x26f91e)&&'string'===typeof _0x26f91e&&!_[_0xe375('0x10')](_0x26f91e)){return _0x26f91e;}return _0xe375('0x13');};exports[_0xe375('0x14')]=function(_0x390483){if(_[_0xe375('0x15')](_0x390483)){return![];}return _0x390483;};exports[_0xe375('0x16')]=function(_0xc3384e,_0x54c2c3,_0x1b53e5,_0x4c15bf,_0x51b6bf,_0x8cd9c7){var _0x57aef9={'XMD-QUEUE':_0x54c2c3['Queue']?_0x54c2c3[_0xe375('0x17')][_0xe375('0x18')]:'','XMD-CALLERID':_0x4c15bf,'XMD-CALLERID-PREVIEW':_0x8cd9c7?util[_0xe375('0x11')](_0xe375('0x12'),_0x8cd9c7[_0xe375('0x19')],_0x8cd9c7['calleridnum']):_0x4c15bf,'XMD-DIALID':_0x51b6bf,'XMD-CONTACTID':_0x54c2c3[_0xe375('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4c15bf,'XMD-VOICEQUEUEID':_0x54c2c3[_0xe375('0x1b')],'XMD-DIALCHANNEL':_0x1b53e5,'XMD-DIALTIMEOUT':_0xc3384e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xe375('0x1c'),_0xc3384e[_0xe375('0x1d')]?'g':'',_[_0xe375('0x10')](_0xc3384e['monitor_format'])?'':_0xe375('0x1e')),'XMD-DIALURL':_0xc3384e[_0xe375('0x1f')]||'','XMD-AGI':_0xc3384e[_0xe375('0x20')]?util[_0xe375('0x11')](_0xe375('0x21'),ipAgi,_0xc3384e[_0xe375('0x20')]):_0xe375('0x22'),'XMD-AGIAFTER':_0xc3384e['dialQueueProject2']?util[_0xe375('0x11')](_0xe375('0x21'),ipAgi,_0xc3384e[_0xe375('0x1d')]):_0xe375('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x8cd9c7?_0x8cd9c7[_0xe375('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x8cd9c7?_0x8cd9c7[_0xe375('0x24')]:'','XMD-DESTINATION':_0xe375('0x25'),'SIPADDHEADER':_0xe375('0x26')};if(!_[_0xe375('0x10')](_0xc3384e['monitor_format'])){_0x57aef9[util[_0xe375('0x11')]('%s',_0xe375('0x27'))]=_0xc3384e[_0xe375('0x28')];_0x57aef9[util['format']('%s',_0xe375('0x29'))]=_0x51b6bf;}return _0x57aef9;};exports[_0xe375('0x2a')]=function(_0x45d1ca){var _0x3f3a83={};for(var _0x116b51 in _0x45d1ca){if(_0x45d1ca['hasOwnProperty'](_0x116b51)){_0x3f3a83[util['format']('%s',_[_0xe375('0x2b')](_0x116b51))]=_0x45d1ca[_0x116b51];}}return{'variables':_0x3f3a83};};exports[_0xe375('0x2c')]=function(_0x26f64b,_0x560d18){if(!_[_0xe375('0x15')](_0x26f64b)){if(_0x26f64b[_0xe375('0x2d')](_0xe375('0x2e'))){if(_0x26f64b[_0xe375('0x2e')]>0x0){_0x26f64b[_0xe375('0x2e')]-=0x1;}else{logger[_0xe375('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x560d18);}}}else{logger['error'](_0xe375('0x2f'),_0x560d18);}};exports['logBlacklist']=function(_0x18cfc3){var _0x48012a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x18cfc3[_0xe375('0x30')]=0xd;_0x18cfc3[_0xe375('0x31')]=_0xe375('0x32');_0x18cfc3[_0xe375('0x33')]=_0x48012a;_0x18cfc3[_0xe375('0x34')]=_0x48012a;_0x18cfc3['endtime']=_0x48012a;};exports['logAgent']=function(_0x50d88c,_0x51afc3,_0x1c8d04){var _0xd6bc4=moment()[_0xe375('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x50d88c[_0xe375('0x30')]=_0x51afc3;_0x50d88c['statedesc']=_0x1c8d04;_0x50d88c[_0xe375('0x34')]=_0xd6bc4;_0x50d88c['ringtime']=utils[_0xe375('0x35')](_0x50d88c[_0xe375('0x34')],_0x50d88c[_0xe375('0x33')]);};exports[_0xe375('0x36')]=function(_0x41e864,_0xf5d82c,_0x5b13e6){_0x41e864[_0xe375('0x37')]=_0xf5d82c;_0x41e864[_0xe375('0x38')]=_0x5b13e6;};exports[_0xe375('0x39')]=function(_0x3eb0cf,_0x18a404,_0x47ae23){var _0x332092=moment()[_0xe375('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3eb0cf['state']=_0x18a404;_0x3eb0cf[_0xe375('0x31')]=_0x47ae23;_0x3eb0cf[_0xe375('0x34')]=_0x3eb0cf[_0xe375('0x34')]?_0x3eb0cf[_0xe375('0x34')]:_0x332092;_0x3eb0cf[_0xe375('0x3a')]=_0x3eb0cf[_0xe375('0x3a')]?_0x3eb0cf[_0xe375('0x3a')]:_0x332092;_0x3eb0cf[_0xe375('0x3b')]=utils[_0xe375('0x35')](_0x3eb0cf['responsetime']||0x0,_0x3eb0cf[_0xe375('0x33')]||0x0);_0x3eb0cf['talktime']=_0x3eb0cf['answertime']?utils['getSeconds'](_0x3eb0cf[_0xe375('0x3a')],_0x3eb0cf[_0xe375('0x3c')]):0x0;};exports[_0xe375('0x3d')]=function(_0x2ddf8c){return _0x2ddf8c===_0xe375('0x3e');};exports[_0xe375('0x3f')]=function(_0x1a3772,_0x21a7d3,_0x28bc30,_0x1e8e80,_0x4d28ce){var _0x2f0d8f=_0x1e8e80?_0xe375('0x40'):_0x1a3772['calleridname'];_0x2f0d8f=_0x4d28ce?_0xe375('0x41'):_0x2f0d8f;return{'actionid':_0x1a3772['uniqueid'],'action':_0xe375('0x42'),'channel':_0x1a3772[_0xe375('0x43')],'callerid':util[_0xe375('0x11')](_0xe375('0x12'),_0x2f0d8f,_0x1a3772['calleridnum']),'Exten':_0xe375('0x25'),'Context':_0xe375('0x44'),'Priority':'1','variable':_0x28bc30,'timeout':(_0x21a7d3['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1a3772['uniqueid']};};exports[_0xe375('0x45')]=function(_0x5d10c6){return _0x5d10c6[_0xe375('0x46')]+_0x5d10c6[_0xe375('0x47')]+_0x5d10c6['countnoanswerretry']+_0x5d10c6['countagentrejectretry']+_0x5d10c6['countnosuchnumberretry'];};exports[_0xe375('0x48')]=function(_0x451749){var _0x1e7964=_[_0xe375('0x49')](_0x451749);_0x1e7964['state']=0xf;_0x1e7964[_0xe375('0x31')]='Global';return _0x1e7964;};exports[_0xe375('0x4a')]=function(_0x4ebb46,_0xd82b61,_0x7d4e93){var _0x4e9a8d={};_0x4e9a8d[_0xd82b61]=_0x4ebb46[_0xd82b61];_0x4e9a8d[_0xe375('0x4b')]=![];_0x4e9a8d[_0xe375('0x4c')]=moment()[_0xe375('0x4d')](_0x7d4e93,'minutes')[_0xe375('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e9a8d[_0xe375('0x1a')]=_0x4ebb46[_0xe375('0x1a')];_0x4e9a8d['ListId']=_0x4ebb46[_0xe375('0x4e')];_0x4e9a8d[_0xe375('0x1b')]=_0x4ebb46[_0xe375('0x1b')]||undefined;return _0x4e9a8d;};exports[_0xe375('0x4f')]=function(_0x17eab4,_0x5a30d7){if(!_[_0xe375('0x15')](_0x17eab4)){if(_0x17eab4['pTalking']>0x0){_0x17eab4[_0xe375('0x50')]-=0x1;}else{logger[_0xe375('0xb')](_0x5a30d7,_0xe375('0x51'));}}else{logger['error'](_0x5a30d7,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xe375('0x52')]=function(_0x201e1a){if(_0x201e1a<=0x0){return!![];}return![];};function buildObj(_0x39baa6,_0x2f1a08,_0x335c2a){_0x39baa6[_0xe375('0x53')]=_0x2f1a08;_0x39baa6['name']=_0x39baa6[_0xe375('0x54')];_0x39baa6[_0xe375('0x55')]=_0x39baa6[_0xe375('0x43')];_0x39baa6[_0xe375('0x56')]=_0xe375('0x57');if(_0x335c2a){_0x39baa6[_0xe375('0x58')]=_0x335c2a[_0xe375('0x58')];}return _0x39baa6;}exports[_0xe375('0x59')]=buildObj;exports[_0xe375('0x5a')]=function(_0xe46c9){var _0xe4bb69=[];for(var _0x476385 in _0xe46c9){if(_0xe46c9['hasOwnProperty'](_0x476385)){if(!_[_0xe375('0x15')](_0xe46c9[_0x476385])&&_0xe46c9[_0x476385][_0xe375('0x30')]===_0xe375('0x5b')&&_0xe46c9[_0x476385][_0xe375('0x5c')]==='reachable'){_0xe4bb69[_0xe375('0x5d')](_0xe46c9[_0x476385]['id']);}}}return _0xe4bb69;};exports[_0xe375('0x5e')]=function(_0x5e9ea1){var _0x59ddc3=moment()[_0xe375('0x5f')](0x0);var _0x128d7d=moment(_0x5e9ea1)[_0xe375('0x5f')](0x0);return _0x59ddc3['diff'](_0x128d7d,_0xe375('0x60'));};exports[_0xe375('0x61')]=function(_0x3f651f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3f651f[_0xe375('0x1a')],'ListId':_0x3f651f[_0xe375('0x4e')],'VoiceQueueId':_0x3f651f[_0xe375('0x1b')]||undefined,'CampaignId':_0x3f651f['CampaignId']||undefined};};exports['filterKey']=function(_0x1d8630){if(_0x1d8630==='uniqueid'||_0x1d8630===_0xe375('0x62')||_0x1d8630===_0xe375('0x54')||_0x1d8630===_0xe375('0x63')||_0x1d8630==='campaigntype'||_0x1d8630===_0xe375('0x64')||_0x1d8630==='membername'||_0x1d8630===_0xe375('0x43')||_0x1d8630===_0xe375('0x19')||_0x1d8630===_0xe375('0x4b')||_0x1d8630===_0xe375('0x65')||_0x1d8630===_0xe375('0x4c')||_0x1d8630===_0xe375('0x46')||_0x1d8630===_0xe375('0x47')||_0x1d8630===_0xe375('0x66')||_0x1d8630===_0xe375('0x67')||_0x1d8630==='callback'||_0x1d8630===_0xe375('0x68')||_0x1d8630==='callbackat'||_0x1d8630===_0xe375('0x69')||_0x1d8630===_0xe375('0x1a')||_0x1d8630===_0xe375('0x4e')||_0x1d8630===_0xe375('0x38')||_0x1d8630===_0xe375('0x1b')||_0x1d8630===_0xe375('0x6a')||_0x1d8630===_0xe375('0x6b')||_0x1d8630===_0xe375('0x6c')||_0x1d8630===_0xe375('0x6d')||_0x1d8630==='xmd-listid'||_0x1d8630===_0xe375('0x6e')||_0x1d8630===_0xe375('0x6f')||_0x1d8630===_0xe375('0x70')||_0x1d8630===_0xe375('0x71')||_0x1d8630==='xmd-dialchannel'||_0x1d8630==='xmd-contactid'||_0x1d8630===_0xe375('0x72')||_0x1d8630==='xmd-callerid'||_0x1d8630===_0xe375('0x73')||_0x1d8630===_0xe375('0x74')||_0x1d8630===_0xe375('0x75')||_0x1d8630==='rtpaudioqosbridged'||_0x1d8630===_0xe375('0x76')||_0x1d8630===_0xe375('0x77')||_0x1d8630===_0xe375('0x78')||_0x1d8630===_0xe375('0x79')||_0x1d8630==='rtpaudioqosrtt'||_0x1d8630===_0xe375('0x7a')||_0x1d8630===_0xe375('0x75')||_0x1d8630===_0xe375('0x7b')||_0x1d8630===_0xe375('0x76')||_0x1d8630===_0xe375('0x77')||_0x1d8630===_0xe375('0x78')||_0x1d8630==='rtpaudioqoslossbridged'||_0x1d8630==='rtpaudioqosrtt'||_0x1d8630===_0xe375('0x7a')||_0x1d8630==='bridgepeer'||_0x1d8630===_0xe375('0x7c')||_0x1d8630==='state'||_0x1d8630===_0xe375('0x31')){return![];}return!![];};exports[_0xe375('0x7d')]=function(_0x22c6df,_0x5ae17f){var _0x44f5a0,_0x379cc6,_0x95be4c;if(_0x5ae17f<=0x0){_0x5ae17f=0x1;}_0x44f5a0=new RegExp(_0xe375('0x7e')+_0x5ae17f+'}$');_0x379cc6=Math[_0xe375('0x7f')](0xa,_0x5ae17f-0x1);_0x95be4c=Math[_0xe375('0x7f')](0xa,_0x5ae17f)-0x1;return util[_0xe375('0x11')]('%s',_[_0xe375('0x80')](_0x22c6df,_0x44f5a0,_[_0xe375('0x81')](_0x379cc6,_0x95be4c)));};exports[_0xe375('0x82')]=function(_0x4e709e){var _0x37992e=_0x4e709e[_0xe375('0x83')](/"(.*?)"/);return _0x37992e?_0x37992e[0x1]:_0x4e709e;};exports[_0xe375('0x84')]=function(_0x451ca4){var _0x1528c6=_0x451ca4[_0xe375('0x83')](/<(.*?)>/);return _0x1528c6?_0x1528c6[0x1]:_0x451ca4;};function buildNoAnswerEventPayload(_0xcf7f7,_0x5f078b){var _0x24ade0=buildObj(_0xcf7f7,'noanswer');if(!_[_0xe375('0x10')](_0x5f078b[_0xe375('0x85')])){Object[_0xe375('0x86')](_0x5f078b[_0xe375('0x85')])[_0xe375('0x87')](function(_0x28e055){_0x24ade0[_0x28e055['toLowerCase']()]=_0x5f078b[_0xe375('0x85')][_0x28e055];});}return _0x24ade0;}exports[_0xe375('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a813926..b525892 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 _0x2f91=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x2f91,0x13e));var _0x12f9=function(_0x272406,_0x698e55){_0x272406=_0x272406-0x0;var _0x3ce3bc=_0x2f91[_0x272406];return _0x3ce3bc;};'use strict';exports[_0x12f9('0x0')]={'queue':{'type':_0x12f9('0x1'),'required':!![]},'interface':{'type':_0x12f9('0x1'),'required':!![]},'membername':{'type':_0x12f9('0x1'),'required':!![]},'penalty':{'type':_0x12f9('0x2'),'required':![]},'paused':{'type':_0x12f9('0x3'),'required':![]}};exports[_0x12f9('0x4')]={'queue':{'type':_0x12f9('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x12f9('0x5')]={'interface':{'type':_0x12f9('0x1'),'required':!![]},'paused':{'type':_0x12f9('0x3')},'reason':{'type':_0x12f9('0x1'),'required':![]}};exports[_0x12f9('0x6')]={'module':{'type':_0x12f9('0x1'),'required':![]}};exports[_0x12f9('0x7')]={'uniqueid':{'type':_0x12f9('0x1'),'required':!![]}};exports[_0x12f9('0x8')]={'uniqueid':{'type':_0x12f9('0x1'),'required':!![]},'filename':{'type':_0x12f9('0x1')},'format':{'type':_0x12f9('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x12f9('0x1'),'required':!![]}};exports[_0x12f9('0x9')]={'uniqueid':{'type':_0x12f9('0x1'),'required':!![]},'exten':{'type':_0x12f9('0x1'),'required':!![]},'context':{'type':_0x12f9('0x1')}}; \ No newline at end of file +var _0x2478=['string','number','boolean','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x3b59d5,_0x1e23f2){var _0x30cc91=function(_0x54815d){while(--_0x54815d){_0x3b59d5['push'](_0x3b59d5['shift']());}};_0x30cc91(++_0x1e23f2);}(_0x2478,0x1bf));var _0x8247=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2478[_0x4b7895];return _0x264180;};'use strict';exports[_0x8247('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8247('0x1'),'required':!![]},'membername':{'type':_0x8247('0x1'),'required':!![]},'penalty':{'type':_0x8247('0x2'),'required':![]},'paused':{'type':_0x8247('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x8247('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x8247('0x3')},'reason':{'type':_0x8247('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x8247('0x4')]={'uniqueid':{'type':_0x8247('0x1'),'required':!![]}};exports[_0x8247('0x5')]={'uniqueid':{'type':_0x8247('0x1'),'required':!![]},'filename':{'type':_0x8247('0x1')},'format':{'type':_0x8247('0x1')},'mixmonitorid':{'type':_0x8247('0x1')}};exports[_0x8247('0x6')]={'uniqueid':{'type':_0x8247('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x8247('0x1'),'required':!![]},'exten':{'type':_0x8247('0x1'),'required':!![]},'context':{'type':_0x8247('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 76218d4..ab3e95b 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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../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','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x392e44,_0x42c2af){_0x392e44=_0x392e44-0x0;var _0xb4d56=_0x2032[_0x392e44];return _0xb4d56;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file +var _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../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','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2032,0xd9));var _0x2203=function(_0x3dad57,_0x1dd8b3){_0x3dad57=_0x3dad57-0x0;var _0x47a6b5=_0x2032[_0x3dad57];return _0x47a6b5;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 171e6e9..7ccfad2 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x388a=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x547af,_0x17abff){var _0x22f7f4=function(_0x5f0384){while(--_0x5f0384){_0x547af['push'](_0x547af['shift']());}};_0x22f7f4(++_0x17abff);}(_0x388a,0xf5));var _0xa388=function(_0x13c3fb,_0x417b53){_0x13c3fb=_0x13c3fb-0x0;var _0xccf16=_0x388a[_0x13c3fb];return _0xccf16;};'use strict';function mergeDBDataToRealtime(_0x39f9e6,_0xb2344a){var _0x5cf41=Object['assign']({},_0x39f9e6);for(var _0x397e50 in _0xb2344a){if(_0x5cf41[_0xa388('0x0')](_0x397e50)){_0x5cf41[_0x397e50]=_0xb2344a[_0x397e50];}}return _0x5cf41;}exports[_0xa388('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x27fa=['hasOwnProperty','assign'];(function(_0x5d62b6,_0x4aa007){var _0x1b88d9=function(_0x277af3){while(--_0x277af3){_0x5d62b6['push'](_0x5d62b6['shift']());}};_0x1b88d9(++_0x4aa007);}(_0x27fa,0xcd));var _0xa27f=function(_0x2f4890,_0x322b01){_0x2f4890=_0x2f4890-0x0;var _0x330734=_0x27fa[_0x2f4890];return _0x330734;};'use strict';function mergeDBDataToRealtime(_0x4bd399,_0x11d3d3){var _0x48aa7d=Object[_0xa27f('0x0')]({},_0x4bd399);for(var _0x5d93fc in _0x11d3d3){if(_0x48aa7d[_0xa27f('0x1')](_0x5d93fc)){_0x48aa7d[_0x5d93fc]=_0x11d3d3[_0x5d93fc];}}return _0x48aa7d;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index bd839a0..94d62b1 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 _0x58c6=['./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','keys','channel','split','getAgentByInternal','calleridnum','internal','destination','exten','lastapplication','lastdata','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','voiceDialReport','attendedTransfer','moment','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport'];(function(_0x462fba,_0x286286){var _0x3691af=function(_0x537707){while(--_0x537707){_0x462fba['push'](_0x462fba['shift']());}};_0x3691af(++_0x286286);}(_0x58c6,0x153));var _0x658c=function(_0x33d63e,_0x3268e5){_0x33d63e=_0x33d63e-0x0;var _0x30ed75=_0x58c6[_0x33d63e];return _0x30ed75;};'use strict';var _=require('lodash');var moment=require(_0x658c('0x0'));var util=require('util');var config=require(_0x658c('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x658c('0x2'));var RpcVoiceCallReport=require(_0x658c('0x3'));var RpcVoiceDialReport=require(_0x658c('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x658c('0x5'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x658c('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x658c('0x7'));var VoiceAgentReport=require(_0x658c('0x8'));var VoiceDialReport=require(_0x658c('0x9'));var UserReport=require(_0x658c('0xa'));function Report(_0x5f56c4){this['realtime']=_0x5f56c4;this['agents']=_0x5f56c4[_0x658c('0xb')];this[_0x658c('0xc')]=_0x5f56c4[_0x658c('0xc')];}Report[_0x658c('0xd')][_0x658c('0xe')]=function(_0x435d97){var _0x9f032d=new VoiceQueueReport(this['realtime']);var _0x405862=new VoiceAgentReport(this[_0x658c('0xf')]);var _0x585489=new VoiceDialReport(this['realtime']);var _0x33ff34=new VoiceCallReport(this[_0x658c('0xf')]);var _0x326c32=new UserReport(this[_0x658c('0xf')]);if(config['xdr']&&config[_0x658c('0x10')][_0x658c('0x11')]){ami['on']('custom:voiceQueueReport',this[_0x658c('0x12')][_0x658c('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x658c('0x14')]['bind'](this));ami['on'](_0x658c('0x15'),this[_0x658c('0x16')]['bind'](this));ami['on'](_0x658c('0x17'),this['voiceDialReport'][_0x658c('0x13')](this));ami['on'](_0x658c('0x18'),this[_0x658c('0x19')][_0x658c('0x13')](this));ami['on'](_0x658c('0x1a'),this['attendedTransfer'][_0x658c('0x13')](this));}};Report[_0x658c('0xd')][_0x658c('0x1b')]=function(_0x3cd686){var _0x39bdc7;_0x39bdc7=_[_0x658c('0x1c')](this[_0x658c('0xb')],function(_0x515d36){return _0x515d36[_0x658c('0x1d')]==_0x3cd686||_0x515d36[_0x658c('0x1e')]==_0x3cd686;});if(_[_0x658c('0x1f')](_0x39bdc7)){var _0x4a87ce=_[_0x658c('0x1c')](this['telephones'],function(_0x7af297){return _0x7af297[_0x658c('0x1d')]==_0x3cd686||_0x7af297[_0x658c('0x1e')]==_0x3cd686;});if(_0x4a87ce){_0x39bdc7=_[_0x658c('0x1c')](this[_0x658c('0xb')],function(_0x45a50f){return _0x45a50f[_0x658c('0x20')]==util['format'](_0x658c('0x21'),_0x4a87ce['name']);});}}return _0x39bdc7;};Report[_0x658c('0xd')]['voiceQueueReport']=function(_0x19773a){for(var _0x380e89=0x0;_0x380e89<_0x19773a[_0x658c('0x22')];_0x380e89+=0x1){var _0x229bf0=this[_0x658c('0x1b')](_0x19773a[_0x380e89][_0x658c('0x23')]);if(_0x229bf0){_0x19773a[_0x380e89][_0x658c('0x1d')]=_0x229bf0[_0x658c('0x1d')];_0x19773a[_0x380e89][_0x658c('0x24')]=!![];_0x19773a[_0x380e89][_0x658c('0x25')]=_0x229bf0[_0x658c('0x1e')];_0x19773a[_0x380e89][_0x658c('0x20')]=_[_0x658c('0x1f')](_0x229bf0['interface'])?util['format']('SIP/%s',_0x229bf0[_0x658c('0x1e')]):_0x229bf0[_0x658c('0x20')];if(_0x19773a[_0x380e89][_0x658c('0x26')]){_0x19773a[_0x380e89]['queuecallercompleteAt']=moment()[_0x658c('0x27')](_0x658c('0x28'));}if(_0x19773a[_0x380e89][_0x658c('0x29')]){_0x19773a[_0x380e89][_0x658c('0x2a')]=moment()[_0x658c('0x27')](_0x658c('0x28'));}RpcMemberReport[_0x658c('0x12')](_0x19773a[_0x380e89]);}RpcVoiceQueueReport[_0x658c('0x2b')](_0x19773a[_0x380e89]);}};function extractCalleridNumber(_0x41bd18){var _0x26c3e8=_0x41bd18['match'](/<(.*?)>/);return _0x26c3e8?_0x26c3e8[0x1]:_0x41bd18;}Report[_0x658c('0xd')]['getAgentByInternal']=function(_0x127b75){for(var _0x44a083=0x0;_0x44a083',_0x314f8a[_0x658c('0x40')],_0x314f8a[_0x658c('0x30')]);}if(RpcVoiceTransferReport[_0x658c('0x41')][_0x314f8a[_0x658c('0x42')]]){var _0x2851ae=RpcVoiceTransferReport[_0x658c('0x41')][_0x314f8a[_0x658c('0x42')]];_0x2851ae[_0x658c('0x43')]=_0x314f8a[_0x658c('0x44')];RpcVoiceTransferReport['blindTransfer'](_0x2851ae);delete RpcVoiceTransferReport['transfers'][_0x314f8a['linkedid']];}if(_['isNil'](_0x314f8a['type'])){_0x314f8a[_0x658c('0x45')]=this['getCallType'](_0x314f8a);}if(_[_0x658c('0x1f')](_0x314f8a[_0x658c('0x46')])){var _0x41fe13=_0x314f8a[_0x658c('0x2d')][_0x658c('0x2e')]('-')[0x0];var _0x44d8e5=this['agents'][_0x41fe13];if(!_0x44d8e5)_0x44d8e5=this[_0x658c('0x2f')](_0x314f8a[_0x658c('0x1d')]);if(_0x44d8e5){_0x314f8a[_0x658c('0x46')]=_0x44d8e5['id'];_0x314f8a[_0x658c('0x47')]=_0x44d8e5[_0x658c('0x1e')];}}RpcVoiceCallReport['create'](_0x314f8a);if(_0x314f8a[_0x658c('0x48')]){for(var _0x1ff3a3=0x0;_0x1ff3a3<_0x314f8a[_0x658c('0x49')][_0x658c('0x22')];_0x1ff3a3+=0x1){_0x314f8a[_0x658c('0x4a')]=_0x314f8a[_0x658c('0x49')][_0x1ff3a3][_0x658c('0x4b')];_0x314f8a[_0x658c('0x4c')]=_0x314f8a[_0x658c('0x49')][_0x1ff3a3][_0x658c('0x4c')];if(_0x314f8a[_0x658c('0x33')]=='xcally-motion-preview'){_0x314f8a[_0x658c('0x30')]=_0x314f8a[_0x658c('0x23')];_0x314f8a['calleridname']=_0x314f8a[_0x658c('0x4d')];_0x314f8a['connectedlinenum']=_0x314f8a['accountcode'];_0x314f8a[_0x658c('0x4d')]=_0x314f8a[_0x658c('0x47')];_0x314f8a[_0x658c('0x33')]=_0x314f8a[_0x658c('0x3c')];}else if(_0x314f8a[_0x658c('0x33')]=='xcally-motion-dialer'){_0x314f8a[_0x658c('0x30')]=_0x314f8a[_0x658c('0x32')];_0x314f8a[_0x658c('0x33')]=_0x314f8a[_0x658c('0x3c')];}RpcVoiceRecording[_0x658c('0x2b')](_0x314f8a);}}};Report[_0x658c('0xd')][_0x658c('0x16')]=function(_0x32c59b){if(_[_0x658c('0x4e')](_0x32c59b)){_0x32c59b[_0x658c('0x4f')](function(_0x69c516){RpcVoiceAgentReport[_0x658c('0x2b')](_0x69c516);});}else{RpcVoiceAgentReport[_0x658c('0x2b')](_0x32c59b);}};Report['prototype']['voiceDialReport']=function(_0x126563){RpcVoiceDialReport['create'](_0x126563);var _0x1a6d1f;var _0x583aff;var _0x2d3988=_0x126563[_0x658c('0x2d')];if(_['startsWith'](_0x2d3988,'Local')){_0x583aff=_0x2d3988[_0x658c('0x50')](_0x2d3988[_0x658c('0x51')]('/')+0x1,_0x2d3988['indexOf']('@'));_0x1a6d1f=_[_0x658c('0x1c')](this['agents'],function(_0x3734d5){return _0x3734d5[_0x658c('0x52')]==_0x583aff||_0x3734d5[_0x658c('0x53')]==_0x583aff||_0x3734d5[_0x658c('0x1d')]==_0x583aff;});}else{_0x583aff=_0x2d3988[_0x658c('0x50')](_0x2d3988[_0x658c('0x51')]('/')+0x1,_0x2d3988[_0x658c('0x54')]('-'));_0x1a6d1f=this[_0x658c('0x1b')](_0x583aff);}if(_0x1a6d1f){_0x126563[_0x658c('0x20')]=_['isNil'](_0x1a6d1f[_0x658c('0x20')])?util['format'](_0x658c('0x21'),_0x1a6d1f[_0x658c('0x1e')]):_0x1a6d1f[_0x658c('0x20')];_0x126563[_0x658c('0x47')]=_0x1a6d1f[_0x658c('0x1e')];_0x126563[_0x658c('0x1d')]=_0x1a6d1f[_0x658c('0x1d')];RpcMemberReport[_0x658c('0x55')](_0x126563);}};Report[_0x658c('0xd')][_0x658c('0x19')]=function(_0x2559a2){RpcVoiceTransferReport[_0x658c('0x41')][_0x2559a2['transfererlinkedid']]=_0x2559a2;};Report[_0x658c('0xd')][_0x658c('0x56')]=function(_0x5be96e){RpcVoiceTransferReport[_0x658c('0x56')](_0x5be96e);};module['exports']=Report; \ No newline at end of file +var _0x13f6=['./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','assigned','interface','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','keys','getCallType','channel','getAgentByInternal','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','split','monitor','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','substring','indexOf','find','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport'];(function(_0xe2c5d0,_0x1b522e){var _0x63bca0=function(_0x4c15d2){while(--_0x4c15d2){_0xe2c5d0['push'](_0xe2c5d0['shift']());}};_0x63bca0(++_0x1b522e);}(_0x13f6,0x16f));var _0x613f=function(_0x5144ea,_0x450cb7){_0x5144ea=_0x5144ea-0x0;var _0x5bd085=_0x13f6[_0x5144ea];return _0x5bd085;};'use strict';var _=require(_0x613f('0x0'));var moment=require(_0x613f('0x1'));var util=require(_0x613f('0x2'));var config=require('../../../config/environment');var ami=require(_0x613f('0x3'));var RpcVoiceAgentReport=require(_0x613f('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x613f('0x5'));var RpcMemberReport=require(_0x613f('0x6'));var RpcVoiceQueueReport=require(_0x613f('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x613f('0x8'));var VoiceQueueReport=require(_0x613f('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x613f('0xa'));var VoiceDialReport=require(_0x613f('0xb'));var UserReport=require(_0x613f('0xc'));function Report(_0x381e3f){this[_0x613f('0xd')]=_0x381e3f;this[_0x613f('0xe')]=_0x381e3f[_0x613f('0xe')];this[_0x613f('0xf')]=_0x381e3f[_0x613f('0xf')];}Report[_0x613f('0x10')][_0x613f('0x11')]=function(_0x3be013){var _0x40a9ec=new VoiceQueueReport(this['realtime']);var _0x315f96=new VoiceAgentReport(this[_0x613f('0xd')]);var _0x4ad6e9=new VoiceDialReport(this[_0x613f('0xd')]);var _0x4424ee=new VoiceCallReport(this[_0x613f('0xd')]);var _0x10664c=new UserReport(this[_0x613f('0xd')]);if(config[_0x613f('0x12')]&&config[_0x613f('0x12')][_0x613f('0x13')]){ami['on'](_0x613f('0x14'),this[_0x613f('0x15')][_0x613f('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x613f('0x17')][_0x613f('0x16')](this));ami['on'](_0x613f('0x18'),this[_0x613f('0x19')][_0x613f('0x16')](this));ami['on'](_0x613f('0x1a'),this['voiceDialReport'][_0x613f('0x16')](this));ami['on']('blindtransfer',this[_0x613f('0x1b')]['bind'](this));ami['on'](_0x613f('0x1c'),this[_0x613f('0x1d')][_0x613f('0x16')](this));}};Report[_0x613f('0x10')][_0x613f('0x1e')]=function(_0x726b9b){var _0x58dc6e;_0x58dc6e=_['find'](this['agents'],function(_0x362bf2){return _0x362bf2[_0x613f('0x1f')]==_0x726b9b||_0x362bf2[_0x613f('0x20')]==_0x726b9b;});if(_[_0x613f('0x21')](_0x58dc6e)){var _0x1d16c9=_['find'](this[_0x613f('0xf')],function(_0x4edb6d){return _0x4edb6d['accountcode']==_0x726b9b||_0x4edb6d[_0x613f('0x20')]==_0x726b9b;});if(_0x1d16c9){_0x58dc6e=_['find'](this[_0x613f('0xe')],function(_0x1c086b){return _0x1c086b['interface']==util[_0x613f('0x22')](_0x613f('0x23'),_0x1d16c9[_0x613f('0x20')]);});}}return _0x58dc6e;};Report['prototype'][_0x613f('0x15')]=function(_0x555722){for(var _0x1bd1fa=0x0;_0x1bd1fa<_0x555722[_0x613f('0x24')];_0x1bd1fa+=0x1){var _0x456712=this[_0x613f('0x1e')](_0x555722[_0x1bd1fa][_0x613f('0x25')]);if(_0x456712){_0x555722[_0x1bd1fa][_0x613f('0x1f')]=_0x456712['accountcode'];_0x555722[_0x1bd1fa][_0x613f('0x26')]=!![];_0x555722[_0x1bd1fa]['lastAssignedTo']=_0x456712['name'];_0x555722[_0x1bd1fa][_0x613f('0x27')]=_[_0x613f('0x21')](_0x456712[_0x613f('0x27')])?util[_0x613f('0x22')](_0x613f('0x23'),_0x456712[_0x613f('0x20')]):_0x456712[_0x613f('0x27')];if(_0x555722[_0x1bd1fa]['queuecallercomplete']){_0x555722[_0x1bd1fa]['queuecallercompleteAt']=moment()[_0x613f('0x22')](_0x613f('0x28'));}if(_0x555722[_0x1bd1fa][_0x613f('0x29')]){_0x555722[_0x1bd1fa][_0x613f('0x2a')]=moment()[_0x613f('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x613f('0x15')](_0x555722[_0x1bd1fa]);}RpcVoiceQueueReport[_0x613f('0x2b')](_0x555722[_0x1bd1fa]);}};function extractCalleridNumber(_0x1faa79){var _0x15833d=_0x1faa79[_0x613f('0x2c')](/<(.*?)>/);return _0x15833d?_0x15833d[0x1]:_0x1faa79;}Report[_0x613f('0x10')]['getAgentByInternal']=function(_0x25bc19){for(var _0x4d32a6=0x0;_0x4d32a60x0?!![]:![];if(!_0x5e12b4){return this[_0xfcc4('0x1c')](this[_0xfcc4('0x17')][_0xfcc4('0x66')]);}};VoiceQueueReport[_0xfcc4('0xc')][_0xfcc4('0x67')]=function(_0x439143){var _0x44852f=this[_0xfcc4('0x17')]['id'];if(this[_0xfcc4('0x17')][_0xfcc4('0x5d')][_0x44852f]&&this[_0xfcc4('0x17')][_0xfcc4('0x5d')][_0x44852f][_0x439143[_0xfcc4('0x5c')]]){this[_0xfcc4('0x17')][_0xfcc4('0x5d')][_0x44852f][_0x439143['actionid']]['agents'][_0xfcc4('0x68')](_0x439143);}};VoiceQueueReport[_0xfcc4('0xc')][_0xfcc4('0x69')]=function(_0x161401){var _0x1b29c8=this;try{if(this[_0xfcc4('0x6a')](_0x161401)&&this[_0xfcc4('0x6a')](_0x161401['queue'])){logger[_0xfcc4('0x48')](_0xfcc4('0x6b'),util[_0xfcc4('0x40')](_0x161401,{'showHidden':![],'depth':null}));var _0x44c4f1=this[_0xfcc4('0x15')][_0x161401[_0xfcc4('0x4b')]];if(_0x44c4f1){logger[_0xfcc4('0x48')](_0xfcc4('0x6c'),_0x44c4f1[_0xfcc4('0x56')]);this[_0xfcc4('0x17')][_0xfcc4('0x60')][_0x44c4f1[_0xfcc4('0x56')]]={'summaryEvent':_0x161401};this['summary']['statusRequests']+=0x1;return ami['Action']({'action':_0xfcc4('0x5d'),'queue':_0x44c4f1[_0xfcc4('0x56')]})[_0xfcc4('0x5b')](function(_0x2b1abb){if(!_0x1b29c8[_0xfcc4('0x17')][_0xfcc4('0x5d')][_0x161401['actionid']]){_0x1b29c8['summary'][_0xfcc4('0x5d')][_0x161401[_0xfcc4('0x5c')]]={};}_0x1b29c8[_0xfcc4('0x17')][_0xfcc4('0x5d')][_0x161401[_0xfcc4('0x5c')]][_0x2b1abb[_0xfcc4('0x5c')]]={'queue':_0x44c4f1['name'],'agents':[]};})[_0xfcc4('0x3c')](function(_0x3799ba){throw _0x3799ba;});}}}catch(_0x1944ec){logger[_0xfcc4('0x3e')](_0xfcc4('0x5e'),util[_0xfcc4('0x40')](_0x1944ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfcc4('0xc')][_0xfcc4('0x1c')]=function(_0x1fad1e){if(this[_0xfcc4('0x17')][_0xfcc4('0x6d')]>0x0){this[_0xfcc4('0x17')][_0xfcc4('0x66')]=_0x1fad1e;return;}logger[_0xfcc4('0x48')](_0xfcc4('0x6e'),util[_0xfcc4('0x40')](_0x1fad1e,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xfcc4('0x46')](_0xfcc4('0x6f'),{});};VoiceQueueReport[_0xfcc4('0xc')][_0xfcc4('0x21')]=function(_0x100f9b){try{if(this[_0xfcc4('0x6a')](_0x100f9b)){logger['debug'](_0xfcc4('0x70'),_0x100f9b['uniqueid'],util[_0xfcc4('0x40')](_0x100f9b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xfcc4('0x10')][_0x100f9b[_0xfcc4('0x49')]])){this[_0xfcc4('0x10')][_0x100f9b['uniqueid']]=[];}if(_['isUndefined'](this[_0xfcc4('0x13')][_0x100f9b[_0xfcc4('0x49')]])){this[_0xfcc4('0x13')][_0x100f9b[_0xfcc4('0x49')]]={};}var _0x31cd50=new QueueReport();_0x31cd50[_0xfcc4('0x4b')]=_0x100f9b['queue'];_0x31cd50['type']=this[_0xfcc4('0x15')][_0x31cd50[_0xfcc4('0x4b')]]&&this[_0xfcc4('0x15')][_0x31cd50[_0xfcc4('0x4b')]]['type']?this[_0xfcc4('0x15')][_0x31cd50[_0xfcc4('0x4b')]][_0xfcc4('0x53')]||'inbound':_0xfcc4('0x54');_0x31cd50[_0xfcc4('0x71')]=moment()[_0xfcc4('0x50')](_0xfcc4('0x72'));_0x31cd50[_0xfcc4('0x73')]=_0x100f9b[_0xfcc4('0x73')];_0x31cd50[_0xfcc4('0x74')]=_0x100f9b[_0xfcc4('0x74')];_0x31cd50[_0xfcc4('0x49')]=_0x100f9b[_0xfcc4('0x49')];_0x31cd50[_0xfcc4('0x75')]=this[_0xfcc4('0x13')][_0x100f9b[_0xfcc4('0x49')]][_0xfcc4('0x75')];logger[_0xfcc4('0x76')](_0xfcc4('0x77'),_0x31cd50[_0xfcc4('0x4b')],_0x31cd50[_0xfcc4('0x53')]);Object[_0xfcc4('0x62')](_0x31cd50,_[_0xfcc4('0x78')](_0x100f9b,_[_0xfcc4('0x79')](_0x31cd50)));this['queueReports'][_0x100f9b[_0xfcc4('0x49')]][_0xfcc4('0x68')](_0x31cd50);this[_0xfcc4('0x13')][_0x100f9b[_0xfcc4('0x49')]]=_0x31cd50;this[_0xfcc4('0x47')](_0x31cd50,_0xfcc4('0x20'));}}catch(_0x5c1f80){logger[_0xfcc4('0x3e')](_0xfcc4('0x70'),_0x100f9b['uniqueid'],util[_0xfcc4('0x40')](_0x5c1f80,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfcc4('0xc')][_0xfcc4('0x22')]=function(_0xd20f53){try{if(this[_0xfcc4('0x6a')](_0xd20f53)){logger[_0xfcc4('0x48')]('[%s][voiceQueueReport][queuecallerabandon]',_0xd20f53['uniqueid'],util[_0xfcc4('0x40')](_0xd20f53,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xd20f53[_0xfcc4('0x49')]]){var _0x50c2ce=_[_0xfcc4('0x7a')](this[_0xfcc4('0x10')][_0xd20f53['uniqueid']]);_0x50c2ce[_0xfcc4('0x36')]=![];_0x50c2ce[_0xfcc4('0x7b')]=null;_0x50c2ce[_0xfcc4('0x7c')]=_0xd20f53[_0xfcc4('0x7c')];_0x50c2ce[_0xfcc4('0x7d')]=_0xd20f53['originalposition'];_0x50c2ce[_0xfcc4('0x35')]=!![];_0x50c2ce[_0xfcc4('0x7e')]=moment()[_0xfcc4('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x50c2ce['queuecallerexitreason']='ABANDONED';_0x50c2ce[_0xfcc4('0x7f')]=null;logger[_0xfcc4('0x76')](_0xfcc4('0x80'),_0x50c2ce[_0xfcc4('0x4b')],_0x50c2ce['type']);this[_0xfcc4('0x13')][_0xd20f53[_0xfcc4('0x49')]]=_0x50c2ce;this[_0xfcc4('0x45')](_0x50c2ce,_0xfcc4('0x35'));}}}catch(_0x12fb2d){logger['error'](_0xfcc4('0x81'),_0xd20f53['uniqueid'],util[_0xfcc4('0x40')](_0x12fb2d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfcc4('0xc')][_0xfcc4('0x23')]=function(_0x27e615){try{if(this[_0xfcc4('0x6a')](_0x27e615)){logger[_0xfcc4('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x27e615[_0xfcc4('0x49')],util[_0xfcc4('0x40')](_0x27e615,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x27e615[_0xfcc4('0x49')]]){var _0x21d892=_['last'](this[_0xfcc4('0x10')][_0x27e615[_0xfcc4('0x49')]]);_0x21d892['queuecallerleaveAt']=moment()[_0xfcc4('0x50')](_0xfcc4('0x72'));_0x21d892[_0xfcc4('0x82')]=_0x27e615[_0xfcc4('0x82')];_0x21d892[_0xfcc4('0x83')]=_0x27e615['connectedlinename'];logger[_0xfcc4('0x76')](_0xfcc4('0x84'),_0x21d892['queue'],_0x21d892[_0xfcc4('0x53')],_0x27e615[_0xfcc4('0x82')],_0x27e615['connectedlinename']);this['channels'][_0x27e615['uniqueid']]=_0x21d892;this[_0xfcc4('0x47')](_0x21d892,_0xfcc4('0x85'));}}}catch(_0x1417a8){logger[_0xfcc4('0x3e')](_0xfcc4('0x86'),_0x27e615[_0xfcc4('0x49')],util[_0xfcc4('0x40')](_0x1417a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfcc4('0xc')][_0xfcc4('0x87')]=function(_0x2d877d){try{if(this[_0xfcc4('0x6a')](_0x2d877d)){logger[_0xfcc4('0x48')](_0xfcc4('0x88'),_0x2d877d['uniqueid'],util['inspect'](_0x2d877d,{'showHidden':![],'depth':null}));if(this[_0xfcc4('0x10')][_0x2d877d['uniqueid']]){var _0x270150=_[_0xfcc4('0x7a')](this[_0xfcc4('0x10')][_0x2d877d[_0xfcc4('0x49')]]);_0x270150[_0xfcc4('0x36')]=!![];_0x270150[_0xfcc4('0x4e')]=_0xfcc4('0x89');logger[_0xfcc4('0x76')](_0xfcc4('0x8a'),_0x270150[_0xfcc4('0x4b')],_0x270150['type']);}}}catch(_0xdaf85b){logger[_0xfcc4('0x3e')](_0xfcc4('0x88'),_0x2d877d[_0xfcc4('0x49')],util[_0xfcc4('0x40')](_0xdaf85b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfcc4('0x8b')]=function(_0x27897c){try{if(this[_0xfcc4('0x6a')](_0x27897c)){logger['debug'](_0xfcc4('0x8c'),_0x27897c[_0xfcc4('0x49')],util['inspect'](_0x27897c,{'showHidden':![],'depth':null}));if(this[_0xfcc4('0x10')][_0x27897c['uniqueid']]){var _0x362e2b=_['last'](this[_0xfcc4('0x10')][_0x27897c[_0xfcc4('0x49')]]);_0x362e2b['queuecallerabandon']=![];_0x362e2b[_0xfcc4('0x7e')]=null;_0x362e2b[_0xfcc4('0x8d')]=!![];_0x362e2b[_0xfcc4('0x7f')]=_0x27897c[_0xfcc4('0x8e')];_0x362e2b[_0xfcc4('0x7c')]=_0x27897c[_0xfcc4('0x7c')];_0x362e2b[_0xfcc4('0x36')]=!![];_0x362e2b[_0xfcc4('0x34')]=![];_0x362e2b[_0xfcc4('0x8f')]=null;if(!_0x362e2b['transfer']){if(_0x27897c[_0xfcc4('0x90')]==_0xfcc4('0x91')){_0x362e2b['queuecallerexitreason']=_0xfcc4('0x92');logger[_0xfcc4('0x76')](_0xfcc4('0x93'),_0x362e2b[_0xfcc4('0x4b')],_0x362e2b[_0xfcc4('0x53')]);}else{if(_[_0xfcc4('0x94')](_0x27897c[_0xfcc4('0x3b')]['toLowerCase'](),_0xfcc4('0x95'))){if(this[_0xfcc4('0x10')][_0x27897c[_0xfcc4('0x96')]]){var _0xd2d14c=_[_0xfcc4('0x7a')](this[_0xfcc4('0x10')][_0x27897c['linkedid']]);_0xd2d14c[_0xfcc4('0x36')]=![];_0xd2d14c[_0xfcc4('0x34')]=!![];_0xd2d14c[_0xfcc4('0x8f')]=moment(_0x362e2b['queuecallerjoinAt'])[_0xfcc4('0x97')](_0x27897c[_0xfcc4('0x7c')],_0xfcc4('0x98'))[_0xfcc4('0x50')](_0xfcc4('0x72'));_0xd2d14c[_0xfcc4('0x4e')]=_0xfcc4('0x99');_0xd2d14c[_0xfcc4('0x91')]=!![];_0xd2d14c['transfertype']=_0xfcc4('0x9a');_0xd2d14c[_0xfcc4('0x9b')]=_0x27897c['destexten'];_0xd2d14c['transferuniqueid']=_0x27897c[_0xfcc4('0x49')];logger[_0xfcc4('0x76')](_0xfcc4('0x9c'),_0xd2d14c[_0xfcc4('0x4b')],_0xd2d14c[_0xfcc4('0x53')]);var _0x4e7796=this[_0xfcc4('0x10')][_0x27897c[_0xfcc4('0x96')]];this[_0xfcc4('0x10')][_0x27897c['linkedid']]=this[_0xfcc4('0x10')][_0x27897c[_0xfcc4('0x49')]];this[_0xfcc4('0x10')][_0x27897c[_0xfcc4('0x49')]]=_0x4e7796;}}else{_0x362e2b['queuecallerexitreason']=_0xfcc4('0x9d')+_0x27897c[_0xfcc4('0x90')][_0xfcc4('0x9e')]();logger['info'](_0xfcc4('0x9f'),_0x362e2b[_0xfcc4('0x4b')],_0x362e2b['type'],_0x362e2b[_0xfcc4('0x4e')]);}}}this[_0xfcc4('0x13')][_0x27897c[_0xfcc4('0x49')]]=_0x362e2b;}}}catch(_0x50bfc1){logger[_0xfcc4('0x3e')](_0xfcc4('0x8c'),_0x27897c[_0xfcc4('0x49')],util[_0xfcc4('0x40')](_0x50bfc1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfcc4('0xc')]['syncVarSet']=function(_0x46b0d3){try{if(this[_0xfcc4('0x6a')](_0x46b0d3)){logger[_0xfcc4('0x48')]('[%s][voiceQueueReport][varset]',_0x46b0d3['uniqueid'],util[_0xfcc4('0x40')](_0x46b0d3,{'showHidden':![],'depth':null}));this['addVariable'](_0x46b0d3['uniqueid'],_[_0xfcc4('0x79')](_0x46b0d3['variable'])[0x0],_0x46b0d3[_0xfcc4('0xa0')]);if(this[_0xfcc4('0x10')][_0x46b0d3['uniqueid']]){var _0x92a9f7=_[_0xfcc4('0x7a')](this['queueReports'][_0x46b0d3[_0xfcc4('0x49')]]);if(_0x92a9f7){if(this[_0xfcc4('0x6a')](_0x46b0d3[_0xfcc4('0xa1')])&&this[_0xfcc4('0x6a')](_0x46b0d3[_0xfcc4('0xa1')]['queuestatus'])){switch(_0x46b0d3['value']){case'CONTINUE':_0x92a9f7[_0xfcc4('0x34')]=![];_0x92a9f7[_0xfcc4('0x8f')]=null;break;case _0xfcc4('0xa2'):_0x92a9f7[_0xfcc4('0xa3')]=_0xfcc4('0xa4');_0x92a9f7[_0xfcc4('0x34')]=!![];_0x92a9f7['queuecallerexitAt']=moment()[_0xfcc4('0x50')](_0xfcc4('0x72'));_0x92a9f7[_0xfcc4('0xa5')]=moment()[_0xfcc4('0x50')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfcc4('0x48')](_0xfcc4('0xa6'),_0x46b0d3[_0xfcc4('0x49')],util[_0xfcc4('0x40')](_0x92a9f7,{'showHidden':![],'depth':null}));ami[_0xfcc4('0x46')](_0xfcc4('0xa7'),_0x92a9f7);break;default:_0x92a9f7[_0xfcc4('0x34')]=!![];_0x92a9f7[_0xfcc4('0x8f')]=moment()['format'](_0xfcc4('0x72'));_0x92a9f7[_0xfcc4('0xa5')]=moment()[_0xfcc4('0x50')]('YYYY-MM-DD\x20HH:mm:ss');}_0x92a9f7[_0xfcc4('0x35')]=![];_0x92a9f7[_0xfcc4('0x7e')]=null;_0x92a9f7[_0xfcc4('0x4e')]=_0x46b0d3['value'];this['channels'][_0x46b0d3[_0xfcc4('0x49')]]=_0x92a9f7;this[_0xfcc4('0x45')](_0x92a9f7,'varset');}else if(this[_0xfcc4('0x6a')](_0x46b0d3[_0xfcc4('0xa1')])&&this[_0xfcc4('0x6a')](_0x46b0d3[_0xfcc4('0xa1')][_0xfcc4('0xa8')])){if(!_0x92a9f7[_0xfcc4('0x35')]){_0x92a9f7[_0xfcc4('0x34')]=!![];_0x92a9f7[_0xfcc4('0x8f')]=moment()[_0xfcc4('0x50')](_0xfcc4('0x72'));_0x92a9f7[_0xfcc4('0x4e')]='EXITWITHKEY';_0x92a9f7['queuecallerleaveAt']=moment()[_0xfcc4('0x50')](_0xfcc4('0x72'));this[_0xfcc4('0x13')][_0x46b0d3[_0xfcc4('0x49')]]=_0x92a9f7;}}logger[_0xfcc4('0x76')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x46b0d3[_0xfcc4('0x49')],_0x92a9f7[_0xfcc4('0x4b')],_0x92a9f7[_0xfcc4('0x53')],_[_0xfcc4('0x79')](_0x46b0d3['variable'])[0x0],_0x46b0d3[_0xfcc4('0xa0')]);_0x92a9f7[_0xfcc4('0x18')]=this[_0xfcc4('0x18')][_0x46b0d3[_0xfcc4('0x49')]];}}}}catch(_0x2a2bc1){logger['error']('[%s][voiceQueueReport][varset]',_0x46b0d3['uniqueid'],util['inspect'](_0x2a2bc1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfcc4('0xa9')]=function(_0x24f05f,_0x354bca,_0x1a956e){var _0x206bc4=[_0xfcc4('0xaa'),_0xfcc4('0xab'),_0xfcc4('0xac'),'rtpaudioqosjitterbridged',_0xfcc4('0xad'),_0xfcc4('0xae'),_0xfcc4('0xaf'),_0xfcc4('0xb0'),'sipcallid',_0xfcc4('0xb1'),_0xfcc4('0xb2'),'bridgepvtcallid','membercalls',_0xfcc4('0xb3'),_0xfcc4('0xb4'),_0xfcc4('0xb5'),_0xfcc4('0x8e'),_0xfcc4('0xb6'),_0xfcc4('0xb7')];if(!_[_0xfcc4('0x39')](_0x354bca)&&!_[_0xfcc4('0xb8')](_0x206bc4,_0x354bca)){if(_['isUndefined'](this[_0xfcc4('0x18')][_0x24f05f])){this[_0xfcc4('0x18')][_0x24f05f]={};}this[_0xfcc4('0x18')][_0x24f05f][_0x354bca]=_0x1a956e;}};VoiceQueueReport[_0xfcc4('0xc')]['handleHangup']=function(_0x53e8ba,_0x48bfa8,_0x2641b8){try{var _0x284f46={};if(this[_0xfcc4('0x10')][_0x53e8ba]){for(var _0x481b92=0x0;_0x481b920x0?!![]:![];if(!_0x30622e){return this['syncQueueSummaryComplete'](this[_0xd6ef('0x16')][_0xd6ef('0x6f')]);}};VoiceQueueReport['prototype'][_0xd6ef('0x1d')]=function(_0x1d59bc){var _0x529ac6=this['summary']['id'];if(this['summary'][_0xd6ef('0x64')][_0x529ac6]&&this[_0xd6ef('0x16')][_0xd6ef('0x64')][_0x529ac6][_0x1d59bc[_0xd6ef('0x63')]]){this[_0xd6ef('0x16')][_0xd6ef('0x64')][_0x529ac6][_0x1d59bc['actionid']][_0xd6ef('0x11')][_0xd6ef('0x70')](_0x1d59bc);}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0x19')]=function(_0x148abf){var _0x58200b=this;try{if(this[_0xd6ef('0x5b')](_0x148abf)&&this[_0xd6ef('0x5b')](_0x148abf[_0xd6ef('0x4e')])){logger[_0xd6ef('0x4b')](_0xd6ef('0x71'),util[_0xd6ef('0x40')](_0x148abf,{'showHidden':![],'depth':null}));var _0x4b74fa=this[_0xd6ef('0x14')][_0x148abf[_0xd6ef('0x4e')]];if(_0x4b74fa){logger[_0xd6ef('0x4b')](_0xd6ef('0x72'),_0x4b74fa[_0xd6ef('0x59')]);this[_0xd6ef('0x16')][_0xd6ef('0x5f')][_0x4b74fa['name']]={'summaryEvent':_0x148abf};this[_0xd6ef('0x16')][_0xd6ef('0x6e')]+=0x1;return ami[_0xd6ef('0x5e')]({'action':_0xd6ef('0x64'),'queue':_0x4b74fa[_0xd6ef('0x59')]})[_0xd6ef('0x73')](function(_0x855636){if(!_0x58200b[_0xd6ef('0x16')][_0xd6ef('0x64')][_0x148abf[_0xd6ef('0x63')]]){_0x58200b['summary'][_0xd6ef('0x64')][_0x148abf['actionid']]={};}_0x58200b[_0xd6ef('0x16')][_0xd6ef('0x64')][_0x148abf[_0xd6ef('0x63')]][_0x855636[_0xd6ef('0x63')]]={'queue':_0x4b74fa[_0xd6ef('0x59')],'agents':[]};})[_0xd6ef('0x60')](function(_0x2c2de7){throw _0x2c2de7;});}}}catch(_0x249bc4){logger['error']('[voiceQueueReport][queuesummary]',util['inspect'](_0x249bc4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0x1c')]=function(_0x2e931d){if(this['summary'][_0xd6ef('0x6e')]>0x0){this[_0xd6ef('0x16')][_0xd6ef('0x6f')]=_0x2e931d;return;}logger[_0xd6ef('0x4b')](_0xd6ef('0x74'),util['inspect'](_0x2e931d,{'showHidden':![],'depth':null}));this[_0xd6ef('0x16')]=initializeSummary();ami[_0xd6ef('0x4a')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0x21')]=function(_0xf1cb89){try{if(this[_0xd6ef('0x5b')](_0xf1cb89)){logger['debug'](_0xd6ef('0x75'),_0xf1cb89[_0xd6ef('0x4d')],util[_0xd6ef('0x40')](_0xf1cb89,{'showHidden':![],'depth':null}));if(_[_0xd6ef('0x5c')](this[_0xd6ef('0x41')][_0xf1cb89[_0xd6ef('0x4d')]])){this[_0xd6ef('0x41')][_0xf1cb89['uniqueid']]=[];}if(_[_0xd6ef('0x5c')](this[_0xd6ef('0x12')][_0xf1cb89[_0xd6ef('0x4d')]])){this[_0xd6ef('0x12')][_0xf1cb89[_0xd6ef('0x4d')]]={};}var _0xb8a506=new QueueReport();_0xb8a506['queue']=_0xf1cb89[_0xd6ef('0x4e')];_0xb8a506[_0xd6ef('0x57')]=this[_0xd6ef('0x14')][_0xb8a506[_0xd6ef('0x4e')]]&&this[_0xd6ef('0x14')][_0xb8a506[_0xd6ef('0x4e')]][_0xd6ef('0x57')]?this[_0xd6ef('0x14')][_0xb8a506[_0xd6ef('0x4e')]][_0xd6ef('0x57')]||_0xd6ef('0x6c'):_0xd6ef('0x6c');_0xb8a506[_0xd6ef('0x76')]=moment()[_0xd6ef('0x53')](_0xd6ef('0x77'));_0xb8a506[_0xd6ef('0x78')]=_0xf1cb89[_0xd6ef('0x78')];_0xb8a506[_0xd6ef('0x79')]=_0xf1cb89[_0xd6ef('0x79')];_0xb8a506[_0xd6ef('0x4d')]=_0xf1cb89['uniqueid'];_0xb8a506[_0xd6ef('0x7a')]=this['channels'][_0xf1cb89['uniqueid']][_0xd6ef('0x7a')];logger['info'](_0xd6ef('0x7b'),_0xb8a506[_0xd6ef('0x4e')],_0xb8a506['type']);Object[_0xd6ef('0x6b')](_0xb8a506,_['pick'](_0xf1cb89,_[_0xd6ef('0x7c')](_0xb8a506)));this['queueReports'][_0xf1cb89['uniqueid']][_0xd6ef('0x70')](_0xb8a506);this[_0xd6ef('0x12')][_0xf1cb89[_0xd6ef('0x4d')]]=_0xb8a506;this[_0xd6ef('0x7d')](_0xb8a506,_0xd6ef('0x20'));}}catch(_0x5d246d){logger[_0xd6ef('0x42')](_0xd6ef('0x75'),_0xf1cb89[_0xd6ef('0x4d')],util[_0xd6ef('0x40')](_0x5d246d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0x23')]=function(_0x54877e){try{if(this[_0xd6ef('0x5b')](_0x54877e)){logger[_0xd6ef('0x4b')](_0xd6ef('0x7e'),_0x54877e['uniqueid'],util[_0xd6ef('0x40')](_0x54877e,{'showHidden':![],'depth':null}));if(this[_0xd6ef('0x41')][_0x54877e[_0xd6ef('0x4d')]]){var _0x30b19a=_['last'](this[_0xd6ef('0x41')][_0x54877e['uniqueid']]);_0x30b19a['queuecallercomplete']=![];_0x30b19a[_0xd6ef('0x7f')]=null;_0x30b19a[_0xd6ef('0x80')]=_0x54877e[_0xd6ef('0x80')];_0x30b19a[_0xd6ef('0x81')]=_0x54877e[_0xd6ef('0x81')];_0x30b19a[_0xd6ef('0x22')]=!![];_0x30b19a['queuecallerabandonAt']=moment()[_0xd6ef('0x53')](_0xd6ef('0x77'));_0x30b19a[_0xd6ef('0x51')]=_0xd6ef('0x82');_0x30b19a[_0xd6ef('0x83')]=null;logger[_0xd6ef('0x84')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x30b19a[_0xd6ef('0x4e')],_0x30b19a['type']);this[_0xd6ef('0x12')][_0x54877e[_0xd6ef('0x4d')]]=_0x30b19a;this[_0xd6ef('0x48')](_0x30b19a,'queuecallerabandon');}}}catch(_0x4b9c8b){logger[_0xd6ef('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x54877e[_0xd6ef('0x4d')],util['inspect'](_0x4b9c8b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0x24')]=function(_0x2fd3a1){try{if(this[_0xd6ef('0x5b')](_0x2fd3a1)){logger[_0xd6ef('0x4b')](_0xd6ef('0x85'),_0x2fd3a1[_0xd6ef('0x4d')],util['inspect'](_0x2fd3a1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2fd3a1[_0xd6ef('0x4d')]]){var _0x3d599a=_[_0xd6ef('0x86')](this[_0xd6ef('0x41')][_0x2fd3a1[_0xd6ef('0x4d')]]);_0x3d599a[_0xd6ef('0x87')]=moment()['format'](_0xd6ef('0x77'));_0x3d599a[_0xd6ef('0x88')]=_0x2fd3a1['connectedlinenum'];_0x3d599a[_0xd6ef('0x89')]=_0x2fd3a1[_0xd6ef('0x89')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3d599a[_0xd6ef('0x4e')],_0x3d599a[_0xd6ef('0x57')],_0x2fd3a1[_0xd6ef('0x88')],_0x2fd3a1[_0xd6ef('0x89')]);this[_0xd6ef('0x12')][_0x2fd3a1[_0xd6ef('0x4d')]]=_0x3d599a;this[_0xd6ef('0x7d')](_0x3d599a,_0xd6ef('0x8a'));}}}catch(_0x19397f){logger[_0xd6ef('0x42')]('[%s][voiceQueueReport][queuecallerleave]',_0x2fd3a1['uniqueid'],util[_0xd6ef('0x40')](_0x19397f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0x8b')]=function(_0x1f5d2b){try{if(this[_0xd6ef('0x5b')](_0x1f5d2b)){logger[_0xd6ef('0x4b')](_0xd6ef('0x8c'),_0x1f5d2b['uniqueid'],util[_0xd6ef('0x40')](_0x1f5d2b,{'showHidden':![],'depth':null}));if(this[_0xd6ef('0x41')][_0x1f5d2b[_0xd6ef('0x4d')]]){var _0x31e7e3=_[_0xd6ef('0x86')](this['queueReports'][_0x1f5d2b['uniqueid']]);_0x31e7e3['queuecallercomplete']=!![];_0x31e7e3[_0xd6ef('0x51')]='COMPLETEDBYAGENT';logger[_0xd6ef('0x84')](_0xd6ef('0x8d'),_0x31e7e3['queue'],_0x31e7e3[_0xd6ef('0x57')]);}}}catch(_0x422908){logger[_0xd6ef('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x1f5d2b[_0xd6ef('0x4d')],util[_0xd6ef('0x40')](_0x422908,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x59e677){try{if(this[_0xd6ef('0x5b')](_0x59e677)){logger[_0xd6ef('0x4b')](_0xd6ef('0x8e'),_0x59e677['uniqueid'],util['inspect'](_0x59e677,{'showHidden':![],'depth':null}));if(this[_0xd6ef('0x41')][_0x59e677['uniqueid']]){var _0x2169b6=_[_0xd6ef('0x86')](this[_0xd6ef('0x41')][_0x59e677[_0xd6ef('0x4d')]]);_0x2169b6[_0xd6ef('0x22')]=![];_0x2169b6[_0xd6ef('0x8f')]=null;_0x2169b6['assigned']=!![];_0x2169b6[_0xd6ef('0x83')]=_0x59e677[_0xd6ef('0x90')];_0x2169b6[_0xd6ef('0x80')]=_0x59e677['holdtime'];_0x2169b6[_0xd6ef('0x91')]=!![];_0x2169b6[_0xd6ef('0x39')]=![];_0x2169b6['queuecallerexitAt']=null;if(!_0x2169b6['transfer']){if(_0x59e677[_0xd6ef('0x92')]==_0xd6ef('0x93')){_0x2169b6[_0xd6ef('0x51')]=_0xd6ef('0x94');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2169b6[_0xd6ef('0x4e')],_0x2169b6[_0xd6ef('0x57')]);}else{if(_[_0xd6ef('0x95')](_0x59e677[_0xd6ef('0x3c')]['toLowerCase'](),_0xd6ef('0x96'))){if(this['queueReports'][_0x59e677[_0xd6ef('0x97')]]){var _0xfd0074=_[_0xd6ef('0x86')](this['queueReports'][_0x59e677[_0xd6ef('0x97')]]);_0xfd0074[_0xd6ef('0x91')]=![];_0xfd0074['queuecallerexit']=!![];_0xfd0074[_0xd6ef('0x98')]=moment(_0x2169b6[_0xd6ef('0x76')])[_0xd6ef('0x99')](_0x59e677[_0xd6ef('0x80')],_0xd6ef('0x9a'))[_0xd6ef('0x53')](_0xd6ef('0x77'));_0xfd0074[_0xd6ef('0x51')]=_0xd6ef('0x9b');_0xfd0074[_0xd6ef('0x93')]=!![];_0xfd0074[_0xd6ef('0x9c')]='FORWARD';_0xfd0074[_0xd6ef('0x9d')]=_0x59e677['destexten'];_0xfd0074[_0xd6ef('0x9e')]=_0x59e677[_0xd6ef('0x4d')];logger[_0xd6ef('0x84')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xfd0074[_0xd6ef('0x4e')],_0xfd0074['type']);var _0x4056bf=this['queueReports'][_0x59e677['linkedid']];this['queueReports'][_0x59e677[_0xd6ef('0x97')]]=this[_0xd6ef('0x41')][_0x59e677[_0xd6ef('0x4d')]];this[_0xd6ef('0x41')][_0x59e677[_0xd6ef('0x4d')]]=_0x4056bf;}}else{_0x2169b6[_0xd6ef('0x51')]=_0xd6ef('0x9f')+_0x59e677[_0xd6ef('0x92')][_0xd6ef('0xa0')]();logger[_0xd6ef('0x84')](_0xd6ef('0xa1'),_0x2169b6[_0xd6ef('0x4e')],_0x2169b6[_0xd6ef('0x57')],_0x2169b6['queuecallerexitreason']);}}}this[_0xd6ef('0x12')][_0x59e677[_0xd6ef('0x4d')]]=_0x2169b6;}}}catch(_0x2c3bd5){logger[_0xd6ef('0x42')](_0xd6ef('0x8e'),_0x59e677[_0xd6ef('0x4d')],util['inspect'](_0x2c3bd5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0xa2')]=function(_0x36de00){try{if(this[_0xd6ef('0x5b')](_0x36de00)){logger[_0xd6ef('0x4b')](_0xd6ef('0xa3'),_0x36de00[_0xd6ef('0x4d')],util[_0xd6ef('0x40')](_0x36de00,{'showHidden':![],'depth':null}));this[_0xd6ef('0xa4')](_0x36de00[_0xd6ef('0x4d')],_[_0xd6ef('0x7c')](_0x36de00[_0xd6ef('0xa5')])[0x0],_0x36de00[_0xd6ef('0xa6')]);if(this[_0xd6ef('0x41')][_0x36de00['uniqueid']]){var _0x5282f5=_['last'](this['queueReports'][_0x36de00[_0xd6ef('0x4d')]]);if(_0x5282f5){if(this['isNotNull'](_0x36de00[_0xd6ef('0xa5')])&&this[_0xd6ef('0x5b')](_0x36de00[_0xd6ef('0xa5')][_0xd6ef('0x64')])){switch(_0x36de00[_0xd6ef('0xa6')]){case _0xd6ef('0xa7'):_0x5282f5[_0xd6ef('0x39')]=![];_0x5282f5[_0xd6ef('0x98')]=null;break;case'TIMEOUT':_0x5282f5['lastevent']=_0xd6ef('0xa8');_0x5282f5['queuecallerexit']=!![];_0x5282f5[_0xd6ef('0x98')]=moment()[_0xd6ef('0x53')](_0xd6ef('0x77'));_0x5282f5[_0xd6ef('0x87')]=moment()[_0xd6ef('0x53')](_0xd6ef('0x77'));logger[_0xd6ef('0x4b')](_0xd6ef('0xa9'),_0x36de00[_0xd6ef('0x4d')],util[_0xd6ef('0x40')](_0x5282f5,{'showHidden':![],'depth':null}));ami['emit'](_0xd6ef('0xaa'),_0x5282f5);break;default:_0x5282f5[_0xd6ef('0x39')]=!![];_0x5282f5[_0xd6ef('0x98')]=moment()['format'](_0xd6ef('0x77'));_0x5282f5[_0xd6ef('0x87')]=moment()[_0xd6ef('0x53')](_0xd6ef('0x77'));}_0x5282f5['queuecallerabandon']=![];_0x5282f5[_0xd6ef('0x8f')]=null;_0x5282f5[_0xd6ef('0x51')]=_0x36de00[_0xd6ef('0xa6')];this['channels'][_0x36de00['uniqueid']]=_0x5282f5;this[_0xd6ef('0x48')](_0x5282f5,_0xd6ef('0x27'));}else if(this[_0xd6ef('0x5b')](_0x36de00[_0xd6ef('0xa5')])&&this[_0xd6ef('0x5b')](_0x36de00[_0xd6ef('0xa5')][_0xd6ef('0xab')])){if(!_0x5282f5[_0xd6ef('0x22')]){_0x5282f5[_0xd6ef('0x39')]=!![];_0x5282f5[_0xd6ef('0x98')]=moment()['format'](_0xd6ef('0x77'));_0x5282f5[_0xd6ef('0x51')]=_0xd6ef('0xac');_0x5282f5[_0xd6ef('0x87')]=moment()[_0xd6ef('0x53')](_0xd6ef('0x77'));this[_0xd6ef('0x12')][_0x36de00[_0xd6ef('0x4d')]]=_0x5282f5;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x36de00[_0xd6ef('0x4d')],_0x5282f5[_0xd6ef('0x4e')],_0x5282f5[_0xd6ef('0x57')],_[_0xd6ef('0x7c')](_0x36de00['variable'])[0x0],_0x36de00[_0xd6ef('0xa6')]);_0x5282f5[_0xd6ef('0x17')]=this[_0xd6ef('0x17')][_0x36de00[_0xd6ef('0x4d')]];}}}}catch(_0x542c64){logger[_0xd6ef('0x42')]('[%s][voiceQueueReport][varset]',_0x36de00[_0xd6ef('0x4d')],util['inspect'](_0x542c64,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0xa4')]=function(_0x45c2db,_0x5deb33,_0x3b24b9){var _0x34b552=[_0xd6ef('0xad'),_0xd6ef('0xae'),_0xd6ef('0xaf'),_0xd6ef('0xb0'),_0xd6ef('0xb1'),_0xd6ef('0xb2'),_0xd6ef('0xb3'),_0xd6ef('0xb4'),_0xd6ef('0xb5'),_0xd6ef('0xb6'),_0xd6ef('0xb7'),'bridgepvtcallid','membercalls',_0xd6ef('0xb8'),'memberinterface','memberlastcall','membername',_0xd6ef('0xb9'),'memberrealtime'];if(!_[_0xd6ef('0x3b')](_0x5deb33)&&!_[_0xd6ef('0xba')](_0x34b552,_0x5deb33)){if(_[_0xd6ef('0x5c')](this[_0xd6ef('0x17')][_0x45c2db])){this[_0xd6ef('0x17')][_0x45c2db]={};}this[_0xd6ef('0x17')][_0x45c2db][_0x5deb33]=_0x3b24b9;}};VoiceQueueReport[_0xd6ef('0xb')][_0xd6ef('0xbb')]=function(_0x83cc73,_0x3f0bbc,_0x2d4083){try{var _0x5abd15={};if(this[_0xd6ef('0x41')][_0x83cc73]){for(var _0x2584f8=0x0;_0x2584f8=0x0?moment(_0x1441da[_0x3656('0x18')])[_0x3656('0xe')](_0x1441da[_0x3656('0x17')],_0x3656('0xf')):null,'data1':_0x3656('0x19'),'data2':_0x1441da[_0x3656('0x14')],'data3':_0x1441da['exten'],'data4':_0x1441da[_0x3656('0x1a')]||null,'role':_0x3656('0x1b'),'internal':_0x1441da[_0x3656('0x14')]?_[_0x3656('0x1c')](_0x1441da[_0x3656('0x14')]):undefined,'uniqueid':_0x1441da['uniqueid']},'log':_0x3656('0x7')});}; \ No newline at end of file +var _0xdefa=['interface','TALKING','queuecallerleaveAt','seconds','calleridnum','queue','agent','toNumber','accountcode','uniqueid','voiceDialReport','starttime','endtime','diff','exten','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s'];(function(_0x5dc500,_0x1e0a12){var _0x4ad41d=function(_0x460bde){while(--_0x460bde){_0x5dc500['push'](_0x5dc500['shift']());}};_0x4ad41d(++_0x1e0a12);}(_0xdefa,0xdb));var _0xadef=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdefa[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0xadef('0x0'));var _=require(_0xadef('0x1'));var util=require(_0xadef('0x2'));var client=require(_0xadef('0x3'));exports[_0xadef('0x4')]=function(_0x4dfe47){var _0x5b82ec=_0x4dfe47[_0xadef('0x5')]||_0x4dfe47['queuecallerexitAt'];return client[_0xadef('0x6')](_0xadef('0x7'),{'body':{'channel':_0xadef('0x8'),'membername':_0x4dfe47[_0xadef('0x9')],'interface':_[_0xadef('0xa')](_0x4dfe47['interface'])?util[_0xadef('0xb')](_0xadef('0xc'),_0x4dfe47[_0xadef('0x9')]):_0x4dfe47[_0xadef('0xd')],'type':_0xadef('0xe'),'enterAt':_0x4dfe47['queuecallerleaveAt'],'exitAt':_0x5b82ec,'duration':moment(_0x5b82ec)['diff'](_0x4dfe47[_0xadef('0xf')],_0xadef('0x10')),'data1':'inbound','data2':_0x4dfe47[_0xadef('0x11')],'data3':_0x4dfe47['exten'],'data4':null,'data5':_0x4dfe47[_0xadef('0x12')],'role':_0xadef('0x13'),'internal':_0x4dfe47['accountcode']?_[_0xadef('0x14')](_0x4dfe47[_0xadef('0x15')]):undefined,'uniqueid':_0x4dfe47[_0xadef('0x16')]},'log':_0xadef('0x7')});};exports[_0xadef('0x17')]=function(_0x21174b){return client[_0xadef('0x6')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x21174b['membername'],'interface':_0x21174b[_0xadef('0xd')],'type':_0xadef('0xe'),'enterAt':_0x21174b[_0xadef('0x18')],'exitAt':_0x21174b[_0xadef('0x19')],'duration':moment(_0x21174b['endtime'])['diff'](_0x21174b[_0xadef('0x18')],'seconds')>=0x0?moment(_0x21174b['endtime'])[_0xadef('0x1a')](_0x21174b[_0xadef('0x18')],_0xadef('0x10')):null,'data1':'outbound','data2':_0x21174b[_0xadef('0x15')],'data3':_0x21174b[_0xadef('0x1b')],'data4':_0x21174b[_0xadef('0x1c')]||null,'role':_0xadef('0x13'),'internal':_0x21174b[_0xadef('0x15')]?_[_0xadef('0x14')](_0x21174b[_0xadef('0x15')]):undefined,'uniqueid':_0x21174b['uniqueid']},'log':_0xadef('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4005d53..7c4487a 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 _0xb5fb=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb5fb,0x172));var _0xbb5f=function(_0x194cf8,_0x536123){_0x194cf8=_0x194cf8-0x0;var _0x17444f=_0xb5fb[_0x194cf8];return _0x17444f;};'use strict';var client=require(_0xbb5f('0x0'));exports[_0xbb5f('0x1')]=function(){return client[_0xbb5f('0x2')](_0xbb5f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbb5f('0x4'),_0xbb5f('0x5')]},'log':_0xbb5f('0x6')});}; \ No newline at end of file +var _0x1339=['getSettings','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x5a3785,_0x2de636){var _0x4d058a=function(_0x2852fc){while(--_0x2852fc){_0x5a3785['push'](_0x5a3785['shift']());}};_0x4d058a(++_0x2de636);}(_0x1339,0x1bf));var _0x9133=function(_0x42b33d,_0x554fda){_0x42b33d=_0x42b33d-0x0;var _0x2d3019=_0x1339[_0x42b33d];return _0x2d3019;};'use strict';var client=require(_0x9133('0x0'));exports[_0x9133('0x1')]=function(){return client['Request'](_0x9133('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9133('0x3'),'previewRecallmeReminderInterval']},'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 c42afae..ecede08 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 _0x02a4=['GetTemplate','name','html','../client','Request'];(function(_0x383415,_0x9c6e73){var _0x4c6640=function(_0x589d10){while(--_0x589d10){_0x383415['push'](_0x383415['shift']());}};_0x4c6640(++_0x9c6e73);}(_0x02a4,0x19d));var _0x402a=function(_0x4da15a,_0x26af7f){_0x4da15a=_0x4da15a-0x0;var _0x522981=_0x02a4[_0x4da15a];return _0x522981;};'use strict';var client=require(_0x402a('0x0'));exports['getTemplates']=function(_0x4ef56c){return function(_0x267453){return client[_0x402a('0x1')](_0x402a('0x2'),{'options':{'raw':!![],'attributes':['id',_0x402a('0x3'),_0x402a('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xd159=['name','../client','getTemplates','GetTemplate'];(function(_0xa3abcf,_0x32eae6){var _0x2b86d2=function(_0x3b3f80){while(--_0x3b3f80){_0xa3abcf['push'](_0xa3abcf['shift']());}};_0x2b86d2(++_0x32eae6);}(_0xd159,0x19d));var _0x9d15=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd159[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x9d15('0x0'));exports[_0x9d15('0x1')]=function(_0x3f9fcf){return function(_0x25c6df){return client['Request'](_0x9d15('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9d15('0x3'),'html']},'log':_0x9d15('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2eccd2c..90059e2 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 _0xc96a=['data7','../client','getTriggers','GetTrigger','name','channel','status','Condition','operator','value','AnyConditions','field','Action','action','data2','data4','data5','data6'];(function(_0x2151cd,_0x34dfdd){var _0x3df912=function(_0x96ddd1){while(--_0x96ddd1){_0x2151cd['push'](_0x2151cd['shift']());}};_0x3df912(++_0x34dfdd);}(_0xc96a,0xfd));var _0xac96=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xc96a[_0x32b993];return _0x482780;};'use strict';var client=require(_0xac96('0x0'));exports[_0xac96('0x1')]=function(_0x29f9a1){return function(_0x48cc99){return client['Request'](_0xac96('0x2'),{'options':{'raw':![],'attributes':['id',_0xac96('0x3'),_0xac96('0x4'),_0xac96('0x5')],'include':[{'model':_0xac96('0x6'),'as':'AllConditions','attributes':['id','field',_0xac96('0x7'),_0xac96('0x8')]},{'model':'Condition','as':_0xac96('0x9'),'attributes':['id',_0xac96('0xa'),'operator',_0xac96('0x8')]},{'model':_0xac96('0xb'),'as':'Actions','attributes':['id',_0xac96('0xc'),'data1',_0xac96('0xd'),'data3',_0xac96('0xe'),_0xac96('0xf'),_0xac96('0x10'),_0xac96('0x11')]}]},'log':_0xac96('0x2')});};}; \ No newline at end of file +var _0xeb49=['operator','value','AnyConditions','Actions','action','data1','data2','data3','data4','data6','data7','GetTrigger','getTriggers','name','status','field'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xeb49,0x12c));var _0x9eb4=function(_0x4d9738,_0x576e2c){_0x4d9738=_0x4d9738-0x0;var _0x2d636f=_0xeb49[_0x4d9738];return _0x2d636f;};'use strict';var client=require('../client');exports[_0x9eb4('0x0')]=function(_0x531250){return function(_0xc0d81c){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x9eb4('0x1'),'channel',_0x9eb4('0x2')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x9eb4('0x3'),_0x9eb4('0x4'),_0x9eb4('0x5')]},{'model':'Condition','as':_0x9eb4('0x6'),'attributes':['id','field',_0x9eb4('0x4'),_0x9eb4('0x5')]},{'model':'Action','as':_0x9eb4('0x7'),'attributes':['id',_0x9eb4('0x8'),_0x9eb4('0x9'),_0x9eb4('0xa'),_0x9eb4('0xb'),_0x9eb4('0xc'),'data5',_0x9eb4('0xd'),_0x9eb4('0xe')]}]},'log':_0x9eb4('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ac29810..44b5c57 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 _0x4953=['registry','../client','getTrunks','Request','GetTrunk'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x4953,0x10a));var _0x3495=function(_0x43cce6,_0x40c102){_0x43cce6=_0x43cce6-0x0;var _0x4ef752=_0x4953[_0x43cce6];return _0x4ef752;};'use strict';var client=require(_0x3495('0x0'));exports[_0x3495('0x1')]=function(_0x2cca73){return function(_0x1c5e7a){return client[_0x3495('0x2')](_0x3495('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3495('0x4'),'defaultuser']},'log':_0x3495('0x3')});};}; \ No newline at end of file +var _0xcf3f=['defaultuser','GetTrunk','../client','getTrunks','Request'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0xcf3f,0xb1));var _0xfcf3=function(_0x57d32e,_0x1555fd){_0x57d32e=_0x57d32e-0x0;var _0x3d0891=_0xcf3f[_0x57d32e];return _0x3d0891;};'use strict';var client=require(_0xfcf3('0x0'));exports[_0xfcf3('0x1')]=function(_0x159f24){return function(_0x477127){return client[_0xfcf3('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xfcf3('0x3')]},'log':_0xfcf3('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 304faf8..86169b3 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x132f2b,_0x1a8953){var _0x3952a7=function(_0x49075c){while(--_0x49075c){_0x132f2b['push'](_0x132f2b['shift']());}};_0x3952a7(++_0x1a8953);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x57368a,_0x5dba55){var _0x5b607d=function(_0x487319){while(--_0x487319){_0x57368a['push'](_0x57368a['shift']());}};_0x5b607d(++_0x5dba55);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xcb91[_0x20aadb];return _0x520018;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f7189ad..6b17e3a 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 _0x671e=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x671e,0x1e6));var _0xe671=function(_0x254bba,_0x20b4aa){_0x254bba=_0x254bba-0x0;var _0x475099=_0x671e[_0x254bba];return _0x475099;};'use strict';var client=require(_0xe671('0x0'));exports[_0xe671('0x1')]=function(_0x425f09){return client[_0xe671('0x2')](_0xe671('0x3'),{'body':_0x425f09,'log':_0xe671('0x3')});};exports[_0xe671('0x4')]=function(_0x436a24,_0x4f47ed,_0x1e02f5){return client['Request'](_0xe671('0x5'),{'body':_0x436a24,'options':{'where':{'uniqueid':_0x4f47ed,'interface':_0x1e02f5,'agentcomplete':!![]}},'log':_0xe671('0x5')});}; \ No newline at end of file +var _0xd08c=['create','Request','update','UpdateVoiceAgentReport','../client'];(function(_0x23c9d6,_0x24971d){var _0xeb4299=function(_0x50a49e){while(--_0x50a49e){_0x23c9d6['push'](_0x23c9d6['shift']());}};_0xeb4299(++_0x24971d);}(_0xd08c,0x126));var _0xcd08=function(_0x49486d,_0xb2272d){_0x49486d=_0x49486d-0x0;var _0x2eaa7d=_0xd08c[_0x49486d];return _0x2eaa7d;};'use strict';var client=require(_0xcd08('0x0'));exports[_0xcd08('0x1')]=function(_0x1ccadc){return client[_0xcd08('0x2')]('CreateVoiceAgentReport',{'body':_0x1ccadc,'log':'CreateVoiceAgentReport'});};exports[_0xcd08('0x3')]=function(_0x58982a,_0x1e46f3,_0x213c83){return client[_0xcd08('0x2')]('UpdateVoiceAgentReport',{'body':_0x58982a,'options':{'where':{'uniqueid':_0x1e46f3,'interface':_0x213c83,'agentcomplete':!![]}},'log':_0xcd08('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 892d07b..09b1399 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 _0xd33c=['endOf','day','type','disposition','duration','billableseconds','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3b9570,_0x4ead31){var _0x28acdd=function(_0x59b847){while(--_0x59b847){_0x3b9570['push'](_0x3b9570['shift']());}};_0x28acdd(++_0x4ead31);}(_0xd33c,0x7e));var _0xcd33=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xd33c[_0x18cd5b];return _0x5eaa52;};'use strict';var moment=require('moment');var util=require(_0xcd33('0x0'));var _=require(_0xcd33('0x1'));var client=require(_0xcd33('0x2'));exports['create']=function(_0x3bf5ed){return client[_0xcd33('0x3')](_0xcd33('0x4'),{'body':_[_0xcd33('0x5')](_0x3bf5ed,{'source':_0x3bf5ed[_0xcd33('0x6')],'destinationcontext':_0x3bf5ed[_0xcd33('0x7')],'callerid':_0x3bf5ed[_0xcd33('0x8')],'amaflags':_0xcd33('0x9')}),'log':_0xcd33('0x4')});};exports[_0xcd33('0xa')]=function(){return function(){return client[_0xcd33('0x3')](_0xcd33('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')[_0xcd33('0xc')](_0xcd33('0xd')),moment()[_0xcd33('0xe')](_0xcd33('0xf'))[_0xcd33('0xc')](_0xcd33('0xd'))]}},'attributes':[_0xcd33('0x10'),_0xcd33('0x11'),_0xcd33('0x12'),_0xcd33('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xf623=['disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x100b8d,_0x1d5879){var _0x8f8590=function(_0x14341e){while(--_0x14341e){_0x100b8d['push'](_0x100b8d['shift']());}};_0x8f8590(++_0x1d5879);}(_0xf623,0x130));var _0x3f62=function(_0x25a4a1,_0x516862){_0x25a4a1=_0x25a4a1-0x0;var _0x3cac71=_0xf623[_0x25a4a1];return _0x3cac71;};'use strict';var moment=require('moment');var util=require(_0x3f62('0x0'));var _=require(_0x3f62('0x1'));var client=require(_0x3f62('0x2'));exports['create']=function(_0x34ad35){return client[_0x3f62('0x3')](_0x3f62('0x4'),{'body':_[_0x3f62('0x5')](_0x34ad35,{'source':_0x34ad35[_0x3f62('0x6')],'destinationcontext':_0x34ad35['context'],'callerid':_0x34ad35['callerid'],'amaflags':_0x3f62('0x7')}),'log':_0x3f62('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x3f62('0x3')](_0x3f62('0x8'),{'options':{'where':{'type':[_0x3f62('0x9')],'createdAt':{'$between':[moment()[_0x3f62('0xa')](_0x3f62('0xb'))[_0x3f62('0xc')](_0x3f62('0xd')),moment()[_0x3f62('0xe')](_0x3f62('0xb'))[_0x3f62('0xc')](_0x3f62('0xd'))]}},'attributes':[_0x3f62('0xf'),_0x3f62('0x10'),_0x3f62('0x11'),_0x3f62('0x12')]},'log':_0x3f62('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8f4ae69..0a2401d 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 _0xedde=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5c658b,_0x550dce){var _0x3ca95f=function(_0xa6aca8){while(--_0xa6aca8){_0x5c658b['push'](_0x5c658b['shift']());}};_0x3ca95f(++_0x550dce);}(_0xedde,0x104));var _0xeedd=function(_0x5a7921,_0x16dc6d){_0x5a7921=_0x5a7921-0x0;var _0x4acca6=_0xedde[_0x5a7921];return _0x4acca6;};'use strict';var client=require(_0xeedd('0x0'));exports[_0xeedd('0x1')]=function(_0x4a5919){return client[_0xeedd('0x2')](_0xeedd('0x3'),{'body':_0x4a5919,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x5f29=['../client','create','Request','CreateVoiceDialReport'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5f29,0xf4));var _0x95f2=function(_0x3fe2ef,_0x211196){_0x3fe2ef=_0x3fe2ef-0x0;var _0x1fa60b=_0x5f29[_0x3fe2ef];return _0x1fa60b;};'use strict';var client=require(_0x95f2('0x0'));exports[_0x95f2('0x1')]=function(_0x2b326e){return client[_0x95f2('0x2')](_0x95f2('0x3'),{'body':_0x2b326e,'log':_0x95f2('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index a636eb4..e628b57 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 _0xfa2f=['Request','exten','recordingFormat','getVoiceExtensions'];(function(_0x46006d,_0x80409a){var _0x3cd7d2=function(_0x297055){while(--_0x297055){_0x46006d['push'](_0x46006d['shift']());}};_0x3cd7d2(++_0x80409a);}(_0xfa2f,0xe8));var _0xffa2=function(_0x11b60e,_0x37f28c){_0x11b60e=_0x11b60e-0x0;var _0x198caf=_0xfa2f[_0x11b60e];return _0x198caf;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xffa2('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xffa2('0x1'),_0xffa2('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xffa2('0x3')});};}; \ No newline at end of file +var _0x5712=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x37c15f,_0x25a57c){var _0xc7048a=function(_0x3a09ee){while(--_0x3a09ee){_0x37c15f['push'](_0x37c15f['shift']());}};_0xc7048a(++_0x25a57c);}(_0x5712,0x140));var _0x2571=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5712[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x2571('0x0'));exports[_0x2571('0x1')]=function(){return function(){return client[_0x2571('0x2')](_0x2571('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2571('0x4'),_0x2571('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x2571('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 273658d..d507731 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 _0xb430=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x4914b5,_0x56a613){var _0x5634dd=function(_0x34d8ff){while(--_0x34d8ff){_0x4914b5['push'](_0x4914b5['shift']());}};_0x5634dd(++_0x56a613);}(_0xb430,0x19d));var _0x0b43=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb430[_0x13ea00];return _0x1f7347;};'use strict';var client=require('../client');exports[_0x0b43('0x0')]=function(){return function(){return client['Request'](_0x0b43('0x1'),{'options':{'raw':![],'attributes':['id',_0x0b43('0x2'),'acw',_0x0b43('0x3'),_0x0b43('0x4'),_0x0b43('0x5'),_0x0b43('0x6'),_0x0b43('0x7'),'dialMethod','dialLimitChannel',_0x0b43('0x8'),'dialPowerLevel',_0x0b43('0x9'),_0x0b43('0xa'),'dialPredictiveInterval',_0x0b43('0xb'),_0x0b43('0xc'),_0x0b43('0xd'),_0x0b43('0xe'),_0x0b43('0xf'),'dialQueueProject',_0x0b43('0x10'),_0x0b43('0x11'),_0x0b43('0x12'),'dialBusyRetryFrequency',_0x0b43('0x13'),_0x0b43('0x14'),_0x0b43('0x15'),_0x0b43('0x16'),'dialGlobalInterval','dialPrefix',_0x0b43('0x17'),_0x0b43('0x18'),'dialAMDInitialSilence','dialAMDGreeting',_0x0b43('0x19'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x0b43('0x1a'),_0x0b43('0x1b'),_0x0b43('0x1c'),_0x0b43('0x1d'),_0x0b43('0x1e'),'dialRecallMeTimeout','dialRecallInQueue',_0x0b43('0x1f'),_0x0b43('0x20'),_0x0b43('0x21'),_0x0b43('0x22'),'monitor_format',_0x0b43('0x23'),_0x0b43('0x24'),_0x0b43('0x25'),_0x0b43('0x26'),_0x0b43('0x27'),_0x0b43('0x28'),_0x0b43('0x29'),_0x0b43('0x2a'),'dialAbandonedRetryFrequency',_0x0b43('0x2b'),_0x0b43('0x2c'),_0x0b43('0x2d'),'dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x0b43('0x2e'),_0x0b43('0x2f'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x0b43('0x30'),'as':_0x0b43('0x30'),'attributes':['id',_0x0b43('0x2'),_0x0b43('0x31'),_0x0b43('0x32')]},{'model':_0x0b43('0x33'),'as':_0x0b43('0x34'),'attributes':['id',_0x0b43('0x2')]},{'model':'Trunk','as':_0x0b43('0x35'),'attributes':['id','name',_0x0b43('0x31'),_0x0b43('0x32')]},{'model':_0x0b43('0x36'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x0b43('0x36'),'as':_0x0b43('0x37'),'attributes':['id',_0x0b43('0x2'),_0x0b43('0x38')]}]}]},'log':_0x0b43('0x0')});};}; \ No newline at end of file +var _0x58f0=['dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','active','Pause','TrunkBackup','callerid','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x58a846,_0x1ba9c0){var _0x233c01=function(_0x4eba2a){while(--_0x4eba2a){_0x58a846['push'](_0x58a846['shift']());}};_0x233c01(++_0x1ba9c0);}(_0x58f0,0xe9));var _0x058f=function(_0x3e2558,_0x326ffd){_0x3e2558=_0x3e2558-0x0;var _0x44b5de=_0x58f0[_0x3e2558];return _0x44b5de;};'use strict';var client=require('../client');exports[_0x058f('0x0')]=function(){return function(){return client[_0x058f('0x1')](_0x058f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x058f('0x3'),_0x058f('0x4'),_0x058f('0x5'),_0x058f('0x6'),_0x058f('0x7'),_0x058f('0x8'),_0x058f('0x9'),_0x058f('0xa'),'dialLimitQueue',_0x058f('0xb'),_0x058f('0xc'),_0x058f('0xd'),_0x058f('0xe'),_0x058f('0xf'),_0x058f('0x10'),_0x058f('0x11'),_0x058f('0x12'),_0x058f('0x13'),_0x058f('0x14'),_0x058f('0x15'),_0x058f('0x16'),_0x058f('0x17'),'dialBusyRetryFrequency',_0x058f('0x18'),_0x058f('0x19'),_0x058f('0x1a'),_0x058f('0x1b'),_0x058f('0x1c'),_0x058f('0x1d'),_0x058f('0x1e'),'dialAMDActive',_0x058f('0x1f'),'dialAMDGreeting',_0x058f('0x20'),_0x058f('0x21'),_0x058f('0x22'),_0x058f('0x23'),_0x058f('0x24'),_0x058f('0x25'),_0x058f('0x26'),'timeout','dialRecallMeTimeout',_0x058f('0x27'),_0x058f('0x28'),_0x058f('0x29'),_0x058f('0x2a'),'dialQueueProject2',_0x058f('0x6'),_0x058f('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x058f('0x2c'),_0x058f('0x2d'),'dialDropMaxRetry',_0x058f('0x2e'),_0x058f('0x2f'),'dialAbandonedRetryFrequency',_0x058f('0x30'),'dialMachineRetryFrequency',_0x058f('0x31'),_0x058f('0x32'),'mandatoryDisposition',_0x058f('0x33'),_0x058f('0x34'),_0x058f('0x35'),_0x058f('0x36')],'include':[{'model':_0x058f('0x37'),'as':_0x058f('0x37'),'attributes':['id',_0x058f('0x38'),'callerid',_0x058f('0x39')]},{'model':_0x058f('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0x058f('0x38')]},{'model':_0x058f('0x37'),'as':_0x058f('0x3b'),'attributes':['id',_0x058f('0x38'),_0x058f('0x3c'),'active']},{'model':'Interval','as':_0x058f('0x3d'),'attributes':['id',_0x058f('0x38')],'include':[{'model':_0x058f('0x3d'),'as':_0x058f('0x3e'),'attributes':['id',_0x058f('0x38'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d9b4ba9..f8ab200 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(_0x32f4e5,_0x32cc12){var _0x389f19=function(_0x442165){while(--_0x442165){_0x32f4e5['push'](_0x32f4e5['shift']());}};_0x389f19(++_0x32cc12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x1d3991,_0x3f7830){var _0x530406=function(_0x3b9704){while(--_0x3b9704){_0x1d3991['push'](_0x1d3991['shift']());}};_0x530406(++_0x3f7830);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 57609ef..158f252 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 _0x0160=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x0160,0x16f));var _0x0016=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x0160[_0x5be7aa];return _0x215408;};'use strict';var client=require('../client');exports[_0x0016('0x0')]=function(_0x1b2dbc){return function(){return client['Request'](_0x0016('0x1'),{'options':{'where':{'VoiceQueueId':_0x1b2dbc,'paused':!![]},'raw':!![]},'log':_0x0016('0x0')});};}; \ No newline at end of file +var _0xf6f6=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x5e779b,_0x1ffd91){var _0x38c513=function(_0x40543a){while(--_0x40543a){_0x5e779b['push'](_0x5e779b['shift']());}};_0x38c513(++_0x1ffd91);}(_0xf6f6,0x1c8));var _0x6f6f=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0xf6f6[_0xa9eaa0];return _0x30897a;};'use strict';var client=require(_0x6f6f('0x0'));exports[_0x6f6f('0x1')]=function(_0x856bc7){return function(){return client[_0x6f6f('0x2')](_0x6f6f('0x3'),{'options':{'where':{'VoiceQueueId':_0x856bc7,'paused':!![]},'raw':!![]},'log':_0x6f6f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 65915ab..2a43fea 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(_0x3a76dc,_0xae7e49){var _0x69a761=function(_0x4bd482){while(--_0x4bd482){_0x3a76dc['push'](_0x3a76dc['shift']());}};_0x69a761(++_0xae7e49);}(_0x7a54,0x106));var _0x47a5=function(_0x1bcb37,_0x551902){_0x1bcb37=_0x1bcb37-0x0;var _0x4fefdb=_0x7a54[_0x1bcb37];return _0x4fefdb;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x26eac8,_0x41da19){var _0x536ced=function(_0xa9a392){while(--_0xa9a392){_0x26eac8['push'](_0x26eac8['shift']());}};_0x536ced(++_0x41da19);}(_0x7a54,0x106));var _0x47a5=function(_0x5f1dd7,_0x1fbfaf){_0x5f1dd7=_0x5f1dd7-0x0;var _0x324422=_0x7a54[_0x5f1dd7];return _0x324422;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 57ba94c..ec70f69 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 _0xdef6=['transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x30ca0e,_0x59f1be){var _0x2a73a8=function(_0x59499e){while(--_0x59499e){_0x30ca0e['push'](_0x30ca0e['shift']());}};_0x2a73a8(++_0x59f1be);}(_0xdef6,0x19c));var _0x6def=function(_0x23461e,_0x1aadf0){_0x23461e=_0x23461e-0x0;var _0x5133ec=_0xdef6[_0x23461e];return _0x5133ec;};'use strict';var client=require(_0x6def('0x0'));exports[_0x6def('0x1')]={};exports['blindTransfer']=function(_0x563461){return client[_0x6def('0x2')](_0x6def('0x3'),{'body':{'result':_0x563461[_0x6def('0x4')],'transfererchannel':_0x563461[_0x6def('0x5')],'transferercalleridnum':_0x563461[_0x6def('0x6')],'transferercalleridname':_0x563461[_0x6def('0x7')],'transfererconnectedlinenum':_0x563461[_0x6def('0x8')],'transfererconnectedlinename':_0x563461[_0x6def('0x9')],'transfereraccountcode':_0x563461[_0x6def('0xa')],'transferercontext':_0x563461[_0x6def('0xb')],'transfererexten':_0x563461[_0x6def('0xc')],'transfererlinkedid':_0x563461[_0x6def('0xd')],'transfereechannel':_0x563461[_0x6def('0xe')],'transfereecalleridnum':_0x563461['transfereecalleridnum'],'transfereecalleridname':_0x563461[_0x6def('0xf')],'transfereeconnectedlinenum':_0x563461[_0x6def('0x10')],'transfereeconnectedlinename':_0x563461[_0x6def('0x11')],'transfereeaccountcode':_0x563461[_0x6def('0x12')],'transfereecontext':_0x563461['transfereecontext'],'transfereeexten':_0x563461['transfereeexten'],'transfereelinkedid':_0x563461[_0x6def('0x13')],'isexternal':_0x563461[_0x6def('0x14')],'context':_0x563461[_0x6def('0x15')],'extension':_0x563461[_0x6def('0x16')],'type':_0x6def('0x17')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x46d226){return client[_0x6def('0x2')](_0x6def('0x3'),{'body':{'result':_0x46d226[_0x6def('0x4')],'transfererchannel':_0x46d226[_0x6def('0x18')],'transferercalleridnum':_0x46d226[_0x6def('0x19')],'transferercalleridname':_0x46d226[_0x6def('0x1a')],'transfererconnectedlinenum':_0x46d226['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x46d226[_0x6def('0x1b')],'transfereraccountcode':_0x46d226[_0x6def('0x1c')],'transferercontext':_0x46d226[_0x6def('0x1d')],'transfererexten':_0x46d226[_0x6def('0x1e')],'transfererlinkedid':_0x46d226[_0x6def('0x1f')],'transfereechannel':_0x46d226[_0x6def('0x20')],'transfereecalleridnum':_0x46d226[_0x6def('0x21')],'transfereecalleridname':_0x46d226['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x46d226[_0x6def('0x22')],'transfereeconnectedlinename':_0x46d226[_0x6def('0x23')],'transfereeaccountcode':_0x46d226[_0x6def('0x24')],'transfereecontext':_0x46d226[_0x6def('0x25')],'transfereeexten':_0x46d226[_0x6def('0x26')],'transfereelinkedid':_0x46d226[_0x6def('0x27')],'isexternal':_0x46d226[_0x6def('0x14')],'context':_0x46d226[_0x6def('0x28')],'extension':_0x46d226[_0x6def('0x29')],'type':_0x6def('0x2a')},'log':_0x6def('0x3')});}; \ No newline at end of file +var _0x7db7=['../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereelinkedid','isexternal','extension','blind','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','attended'];(function(_0x4b75c8,_0x3e9df0){var _0x12f683=function(_0x403d97){while(--_0x403d97){_0x4b75c8['push'](_0x4b75c8['shift']());}};_0x12f683(++_0x3e9df0);}(_0x7db7,0xaf));var _0x77db=function(_0x3200e6,_0x1c55a2){_0x3200e6=_0x3200e6-0x0;var _0x1843c3=_0x7db7[_0x3200e6];return _0x1843c3;};'use strict';var client=require(_0x77db('0x0'));exports['transfers']={};exports[_0x77db('0x1')]=function(_0x2bd598){return client[_0x77db('0x2')](_0x77db('0x3'),{'body':{'result':_0x2bd598[_0x77db('0x4')],'transfererchannel':_0x2bd598[_0x77db('0x5')],'transferercalleridnum':_0x2bd598[_0x77db('0x6')],'transferercalleridname':_0x2bd598[_0x77db('0x7')],'transfererconnectedlinenum':_0x2bd598['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2bd598[_0x77db('0x8')],'transfereraccountcode':_0x2bd598['transfereraccountcode'],'transferercontext':_0x2bd598[_0x77db('0x9')],'transfererexten':_0x2bd598[_0x77db('0xa')],'transfererlinkedid':_0x2bd598['transfererlinkedid'],'transfereechannel':_0x2bd598[_0x77db('0xb')],'transfereecalleridnum':_0x2bd598['transfereecalleridnum'],'transfereecalleridname':_0x2bd598[_0x77db('0xc')],'transfereeconnectedlinenum':_0x2bd598['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2bd598[_0x77db('0xd')],'transfereeaccountcode':_0x2bd598['transfereeaccountcode'],'transfereecontext':_0x2bd598[_0x77db('0xe')],'transfereeexten':_0x2bd598['transfereeexten'],'transfereelinkedid':_0x2bd598[_0x77db('0xf')],'isexternal':_0x2bd598[_0x77db('0x10')],'context':_0x2bd598['context'],'extension':_0x2bd598[_0x77db('0x11')],'type':_0x77db('0x12')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x52b4af){return client[_0x77db('0x2')](_0x77db('0x3'),{'body':{'result':_0x52b4af['result'],'transfererchannel':_0x52b4af[_0x77db('0x13')],'transferercalleridnum':_0x52b4af['origtransferercalleridnum'],'transferercalleridname':_0x52b4af['origtransferercalleridname'],'transfererconnectedlinenum':_0x52b4af['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x52b4af[_0x77db('0x14')],'transfereraccountcode':_0x52b4af[_0x77db('0x15')],'transferercontext':_0x52b4af[_0x77db('0x16')],'transfererexten':_0x52b4af[_0x77db('0x17')],'transfererlinkedid':_0x52b4af[_0x77db('0x18')],'transfereechannel':_0x52b4af[_0x77db('0x19')],'transfereecalleridnum':_0x52b4af[_0x77db('0x1a')],'transfereecalleridname':_0x52b4af[_0x77db('0x1b')],'transfereeconnectedlinenum':_0x52b4af[_0x77db('0x1c')],'transfereeconnectedlinename':_0x52b4af[_0x77db('0x1d')],'transfereeaccountcode':_0x52b4af[_0x77db('0x1e')],'transfereecontext':_0x52b4af[_0x77db('0x1f')],'transfereeexten':_0x52b4af[_0x77db('0x20')],'transfereelinkedid':_0x52b4af['transfertargetlinkedid'],'isexternal':_0x52b4af['isexternal'],'context':_0x52b4af[_0x77db('0x21')],'extension':_0x52b4af['origtransfererexten'],'type':_0x77db('0x22')},'log':_0x77db('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index a18969b..259b84d 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0xefa47b,_0x46cc54){var _0x1a3cfd=function(_0x480237){while(--_0x480237){_0xefa47b['push'](_0xefa47b['shift']());}};_0x1a3cfd(++_0x46cc54);}(_0xb10b,0x12a));var _0xbb10=function(_0x128443,_0x2fe025){_0x128443=_0x128443-0x0;var _0x1a4ce1=_0xb10b[_0x128443];return _0x1a4ce1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x37b8c3,_0x3fb33d){var _0x2ddaa4=function(_0x2ee3c9){while(--_0x2ee3c9){_0x37b8c3['push'](_0x37b8c3['shift']());}};_0x2ddaa4(++_0x3fb33d);}(_0x7a54,0x106));var _0x47a5=function(_0x4ed7e8,_0x54d543){_0x4ed7e8=_0x4ed7e8-0x0;var _0x267799=_0x7a54[_0x4ed7e8];return _0x267799;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 46c0442..92195ea 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 _0x945a=['resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','firstName','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','format','trigger:%s','action','merge','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','$or','routeId','calleridnum','lastName','phone','mobile','scheduledAt','updatedAt','union'];(function(_0x2fbd85,_0x3cf0b2){var _0x362087=function(_0x59142e){while(--_0x59142e){_0x2fbd85['push'](_0x2fbd85['shift']());}};_0x362087(++_0x3cf0b2);}(_0x945a,0x1d2));var _0xa945=function(_0xb68176,_0x8222d3){_0xb68176=_0xb68176-0x0;var _0x43758a=_0x945a[_0xb68176];return _0x43758a;};'use strict';var _=require('lodash');var BPromise=require(_0xa945('0x0'));var Redis=require(_0xa945('0x1'));var util=require(_0xa945('0x2'));var config=require('../../../../config/environment');var logger=require(_0xa945('0x3'))(_0xa945('0x4'));var cmContactRpc=require(_0xa945('0x5'));config[_0xa945('0x6')]=_['defaults'](config[_0xa945('0x6')],{'host':_0xa945('0x7'),'port':0x18eb});var io=require(_0xa945('0x8'))(new Redis(config[_0xa945('0x6')]));function emit(_0x401c7b,_0x8f268b,_0x553e1c,_0x106331,_0x597a52){logger[_0xa945('0x9')](_0xa945('0xa'),_0x401c7b,_0x8f268b['id'],_0x553e1c,_0x106331,JSON['stringify'](_0x597a52));io['to'](_0x553e1c)[_0xa945('0xb')](_0x106331,_0x597a52);}exports[_0xa945('0xc')]=function(_0x2542dc,_0xf72320,_0x1848f0,_0x1f698c){var _0x28b06c,_0x5c852f;var _0x1f9f10={};var _0x3becf1;var _0x533262=Number(_0x1848f0[_0xa945('0xd')]);var _0x353011=_0x1848f0[_0xa945('0xe')]?Boolean(Number(_0x1848f0['data2'])):![];var _0x4d415b;var _0x352cd7=![];if(!_[_0xa945('0xf')](_0x1848f0[_0xa945('0x10')])){if(_0x1848f0['data5']=='1')_0x352cd7=!![];}if(!_0x352cd7){if(_0x1f698c[_0xa945('0x11')]){_0x1f9f10['id']=_0x1f698c['xmd-contactid'];}}if(!_0x1f9f10['id']){_0x1f9f10[_0xa945('0x12')]=_0x533262;_0x4d415b=_0x1848f0['data3']&&_0x1848f0[_0xa945('0x13')]!=='0'?_0x1848f0['data3']['split'](','):['phone'];_0x1f9f10[_0xa945('0x14')]=_['map'](_0x4d415b,function(_0x166ae0){var _0xf8f75d={};_0xf8f75d[_0x166ae0]=_0x1f698c[_0xa945('0x15')]?_0x1f698c['destcalleridnum']:_0x1f698c[_0xa945('0x16')];return _0xf8f75d;});_0x3becf1=_0x1f698c['routeId']?_0x1f698c['destcalleridnum']:_0x1f698c[_0xa945('0x16')];}var _0x5a361d=['id','firstName',_0xa945('0x17'),_0xa945('0x18'),_0xa945('0x19'),'fax',_0xa945('0x12'),'createdAt',_0xa945('0x1a'),_0xa945('0x1b')];var _0x473571=_[_0xa945('0x1c')](_0x5a361d,_0x4d415b);BPromise[_0xa945('0x1d')]()[_0xa945('0x1e')](cmContactRpc[_0xa945('0x1f')]({'attributes':_0x473571,'where':_0x1f9f10,'phone':_0x3becf1}))[_0xa945('0x1e')](function(_0x919f9f){_0x5c852f=_0x919f9f;if(!_[_0xa945('0x20')](_0x5c852f)){if(_0x5c852f['length']===0x1){_0x28b06c=_0x5c852f[0x0];logger[_0xa945('0x9')](_0xa945('0x21'),_0x1f698c[_0xa945('0x22')],_0xf72320['id'],_0x28b06c['id']);}else{logger[_0xa945('0x9')](_0xa945('0x23'),_0x1f698c[_0xa945('0x22')],_0xf72320['id'],_[_0xa945('0x24')](_0x5c852f,'id')[_0xa945('0x25')](','));}return;}else{logger[_0xa945('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1f698c[_0xa945('0x22')],_0xf72320['id']);var _0x3e67d2={'ListId':_0x533262};var _0x3e1c95=_0x1848f0[_0xa945('0x26')]&&_0x1848f0['data4']!=='0'?_0x1848f0['data4']:'phone';if(_0x353011){logger[_0xa945('0x9')](_0xa945('0x27'),_0x1f698c[_0xa945('0x22')],_0xf72320['id']);_0x3e67d2[_0x3e1c95]=_[_0xa945('0xf')](_0x1f698c['routeId'])?_0x1f698c[_0xa945('0x16')]:_0x1f698c[_0xa945('0x28')];if(_[_0xa945('0xf')](_0x1f698c[_0xa945('0x15')])){_0x3e67d2[_0xa945('0x29')]=_0x1f698c[_0xa945('0x2a')]&&_0x1f698c[_0xa945('0x2a')]!==''?_0x1f698c[_0xa945('0x2a')]:_0xa945('0x2b');}else{_0x3e67d2['firstName']=_0x1f698c[_0xa945('0x2c')]&&_0x1f698c[_0xa945('0x2c')]!==_0xa945('0x2d')?_0x1f698c[_0xa945('0x2c')]:_0xa945('0x2b');}return BPromise['resolve']()[_0xa945('0x1e')](cmContactRpc[_0xa945('0x2e')](_0x3e67d2))[_0xa945('0x1e')](function(_0x5484f7){_0x28b06c=_0x5484f7;_0x5c852f[_0xa945('0x2f')](_0x5484f7);if(_0x28b06c){logger[_0xa945('0x9')](_0xa945('0x30'),_0x1f698c[_0xa945('0x22')],_0xf72320['id'],_0x28b06c['id']);}return;});}else{logger['info'](_0xa945('0x31'),_0x1f698c[_0xa945('0x22')],_0xf72320['id']);_0x3e67d2[_0x3e1c95]=_[_0xa945('0xf')](_0x1f698c[_0xa945('0x15')])?_0x1f698c['calleridnum']:_0x1f698c['destcalleridnum'];if(_[_0xa945('0xf')](_0x1f698c[_0xa945('0x15')])){_0x3e67d2['firstName']=_0x1f698c[_0xa945('0x2a')]&&_0x1f698c['calleridname']!==_0xa945('0x2d')?_0x1f698c[_0xa945('0x2a')]:'Unknown';}else{_0x3e67d2[_0xa945('0x29')]=_0x1f698c[_0xa945('0x2c')]&&_0x1f698c['destcalleridname']!==_0xa945('0x2d')?_0x1f698c[_0xa945('0x2c')]:_0xa945('0x2b');}_0x28b06c=_0x3e67d2;_0x5c852f[_0xa945('0x2f')](_0x3e67d2);return;}}})[_0xa945('0x1e')](function(){if(_0x2542dc){emit(_0x1f698c['uniqueid'],_0xf72320,util['format'](_0xa945('0x32'),_0x2542dc['name']),util[_0xa945('0x33')](_0xa945('0x34'),_0x1848f0[_0xa945('0x35')]['toLowerCase']()),{'evt':_[_0xa945('0x36')](_0x1f698c,{'autoCreate':_0x353011}),'contact':_0x28b06c===undefined?{}:_0x28b06c,'contacts':_0x5c852f['length']===0x0?undefined:_0x5c852f});}});}; \ No newline at end of file +var _0xb170=['data2','data5','xmd-contactid','ListId','data3','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','createdAt','updatedAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','destcalleridname','','Unknown','resolve','createContact','[CM][%s][%s]\x20Contact\x20created:%s','push','format','user:%s','name','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1'];(function(_0x129110,_0x5e7856){var _0x47a068=function(_0x398c40){while(--_0x398c40){_0x129110['push'](_0x129110['shift']());}};_0x47a068(++_0x5e7856);}(_0xb170,0xd1));var _0x0b17=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb170[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x0b17('0x0'));var BPromise=require(_0x0b17('0x1'));var Redis=require(_0x0b17('0x2'));var util=require(_0x0b17('0x3'));var config=require(_0x0b17('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x0b17('0x5'));config[_0x0b17('0x6')]=_[_0x0b17('0x7')](config['redis'],{'host':_0x0b17('0x8'),'port':0x18eb});var io=require(_0x0b17('0x9'))(new Redis(config[_0x0b17('0x6')]));function emit(_0x51239a,_0x9defd,_0x3faabe,_0x1a9943,_0x48ca7b){logger[_0x0b17('0xa')](_0x0b17('0xb'),_0x51239a,_0x9defd['id'],_0x3faabe,_0x1a9943,JSON[_0x0b17('0xc')](_0x48ca7b));io['to'](_0x3faabe)[_0x0b17('0xd')](_0x1a9943,_0x48ca7b);}exports['exec']=function(_0xe5c016,_0x5e0efb,_0x5ea2cc,_0x346a59){var _0x534885,_0x529489;var _0xa2f6c2={};var _0x1c8481;var _0x45ad3d=Number(_0x5ea2cc[_0x0b17('0xe')]);var _0x31afa8=_0x5ea2cc[_0x0b17('0xf')]?Boolean(Number(_0x5ea2cc[_0x0b17('0xf')])):![];var _0x7e435e;var _0x649108=![];if(!_['isNil'](_0x5ea2cc[_0x0b17('0x10')])){if(_0x5ea2cc[_0x0b17('0x10')]=='1')_0x649108=!![];}if(!_0x649108){if(_0x346a59[_0x0b17('0x11')]){_0xa2f6c2['id']=_0x346a59['xmd-contactid'];}}if(!_0xa2f6c2['id']){_0xa2f6c2[_0x0b17('0x12')]=_0x45ad3d;_0x7e435e=_0x5ea2cc[_0x0b17('0x13')]&&_0x5ea2cc[_0x0b17('0x13')]!=='0'?_0x5ea2cc['data3']['split'](','):['phone'];_0xa2f6c2[_0x0b17('0x14')]=_[_0x0b17('0x15')](_0x7e435e,function(_0x2a22fb){var _0x2c45ff={};_0x2c45ff[_0x2a22fb]=_0x346a59[_0x0b17('0x16')]?_0x346a59[_0x0b17('0x17')]:_0x346a59[_0x0b17('0x18')];return _0x2c45ff;});_0x1c8481=_0x346a59[_0x0b17('0x16')]?_0x346a59['destcalleridnum']:_0x346a59[_0x0b17('0x18')];}var _0x2dbc5f=['id',_0x0b17('0x19'),_0x0b17('0x1a'),_0x0b17('0x1b'),_0x0b17('0x1c'),'fax',_0x0b17('0x12'),_0x0b17('0x1d'),'scheduledAt',_0x0b17('0x1e')];var _0x1be7f4=_[_0x0b17('0x1f')](_0x2dbc5f,_0x7e435e);BPromise['resolve']()[_0x0b17('0x20')](cmContactRpc['getContacts']({'attributes':_0x1be7f4,'where':_0xa2f6c2,'phone':_0x1c8481}))[_0x0b17('0x20')](function(_0x1567c5){_0x529489=_0x1567c5;if(!_[_0x0b17('0x21')](_0x529489)){if(_0x529489[_0x0b17('0x22')]===0x1){_0x534885=_0x529489[0x0];logger[_0x0b17('0xa')](_0x0b17('0x23'),_0x346a59['uniqueid'],_0x5e0efb['id'],_0x534885['id']);}else{logger[_0x0b17('0xa')](_0x0b17('0x24'),_0x346a59[_0x0b17('0x25')],_0x5e0efb['id'],_[_0x0b17('0x15')](_0x529489,'id')['join'](','));}return;}else{logger[_0x0b17('0xa')](_0x0b17('0x26'),_0x346a59[_0x0b17('0x25')],_0x5e0efb['id']);var _0x1629c2={'ListId':_0x45ad3d};var _0x4b6bde=_0x5ea2cc[_0x0b17('0x27')]&&_0x5ea2cc[_0x0b17('0x27')]!=='0'?_0x5ea2cc['data4']:'phone';if(_0x31afa8){logger['info'](_0x0b17('0x28'),_0x346a59[_0x0b17('0x25')],_0x5e0efb['id']);_0x1629c2[_0x4b6bde]=_[_0x0b17('0x29')](_0x346a59['routeId'])?_0x346a59[_0x0b17('0x18')]:_0x346a59[_0x0b17('0x17')];if(_[_0x0b17('0x29')](_0x346a59[_0x0b17('0x16')])){_0x1629c2[_0x0b17('0x19')]=_0x346a59[_0x0b17('0x2a')]&&_0x346a59[_0x0b17('0x2a')]!==''?_0x346a59[_0x0b17('0x2a')]:'Unknown';}else{_0x1629c2[_0x0b17('0x19')]=_0x346a59[_0x0b17('0x2b')]&&_0x346a59[_0x0b17('0x2b')]!==_0x0b17('0x2c')?_0x346a59[_0x0b17('0x2b')]:_0x0b17('0x2d');}return BPromise[_0x0b17('0x2e')]()[_0x0b17('0x20')](cmContactRpc[_0x0b17('0x2f')](_0x1629c2))['then'](function(_0x176c8d){_0x534885=_0x176c8d;_0x529489['push'](_0x176c8d);if(_0x534885){logger['info'](_0x0b17('0x30'),_0x346a59[_0x0b17('0x25')],_0x5e0efb['id'],_0x534885['id']);}return;});}else{logger[_0x0b17('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x346a59['uniqueid'],_0x5e0efb['id']);_0x1629c2[_0x4b6bde]=_[_0x0b17('0x29')](_0x346a59['routeId'])?_0x346a59['calleridnum']:_0x346a59[_0x0b17('0x17')];if(_[_0x0b17('0x29')](_0x346a59[_0x0b17('0x16')])){_0x1629c2['firstName']=_0x346a59[_0x0b17('0x2a')]&&_0x346a59[_0x0b17('0x2a')]!==_0x0b17('0x2c')?_0x346a59[_0x0b17('0x2a')]:_0x0b17('0x2d');}else{_0x1629c2[_0x0b17('0x19')]=_0x346a59[_0x0b17('0x2b')]&&_0x346a59['destcalleridname']!==_0x0b17('0x2c')?_0x346a59['destcalleridname']:_0x0b17('0x2d');}_0x534885=_0x1629c2;_0x529489[_0x0b17('0x31')](_0x1629c2);return;}}})[_0x0b17('0x20')](function(){if(_0xe5c016){emit(_0x346a59[_0x0b17('0x25')],_0x5e0efb,util[_0x0b17('0x32')](_0x0b17('0x33'),_0xe5c016[_0x0b17('0x34')]),util[_0x0b17('0x32')]('trigger:%s',_0x5ea2cc[_0x0b17('0x35')][_0x0b17('0x36')]()),{'evt':_[_0x0b17('0x37')](_0x346a59,{'autoCreate':_0x31afa8}),'contact':_0x534885===undefined?{}:_0x534885,'contacts':_0x529489[_0x0b17('0x22')]===0x0?undefined:_0x529489});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2f17d4f..ac162bd 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 _0xbb32=['agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','util','lodash','mustache','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:offlineMessage','emit','stringify','prototype','clone','undefined','motionChannel','voice','debug','inspect','checkTriggers','interface','checkTrigger','merge','variables','Actions','length','action','contactmanager','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','uriLocation','data4','800','data5','windowHeight','data6','600','winApplication','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','exec','integration','queue','routeId','urlforward','script','parse','query','search','channel','AllConditions','every','checkConditions','some','AnyConditions','evt','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event'];(function(_0x4be634,_0x2b1a67){var _0x2df900=function(_0x4fabea){while(--_0x4fabea){_0x4be634['push'](_0x4be634['shift']());}};_0x2df900(++_0x2b1a67);}(_0xbb32,0x18f));var _0x2bb3=function(_0x4f526c,_0x6c4dbe){_0x4f526c=_0x4f526c-0x0;var _0x38a51e=_0xbb32[_0x4f526c];return _0x38a51e;};'use strict';var util=require(_0x2bb3('0x0'));var _=require(_0x2bb3('0x1'));var url=require('url');var Mustache=require(_0x2bb3('0x2'));var Redis=require(_0x2bb3('0x3'));var urlforward=require(_0x2bb3('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x2bb3('0x5'));var config=require(_0x2bb3('0x6'));var logger=require(_0x2bb3('0x7'))(_0x2bb3('0x8'));var ami=require(_0x2bb3('0x9'));config[_0x2bb3('0xa')]=_[_0x2bb3('0xb')](config[_0x2bb3('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x2bb3('0xc'))(new Redis(config[_0x2bb3('0xa')]));var operators={'equals':function(_0x8dacdc,_0xa35bea){return _0x8dacdc==_0xa35bea;},'not_equals':function(_0x5c8d07,_0x451168){return _0x5c8d07!=_0x451168;}};var barAndWebActions=[_0x2bb3('0xd'),_0x2bb3('0xe'),_0x2bb3('0xf')];function Trigger(_0x2594eb){this[_0x2bb3('0x10')]=_0x2594eb[_0x2bb3('0x10')];this[_0x2bb3('0x11')]=_0x2594eb[_0x2bb3('0x11')];this['voiceQueues']=_0x2594eb[_0x2bb3('0x12')];this['templates']=_0x2594eb[_0x2bb3('0x13')];this[_0x2bb3('0x14')]=_0x2594eb[_0x2bb3('0x14')];this[_0x2bb3('0x15')]=_0x2594eb[_0x2bb3('0x15')];this[_0x2bb3('0x16')]=_0x2594eb[_0x2bb3('0x16')];this[_0x2bb3('0x17')]=_0x2594eb['salesforceAccounts'];this['sugarcrmAccounts']=_0x2594eb[_0x2bb3('0x18')];this[_0x2bb3('0x19')]=_0x2594eb[_0x2bb3('0x19')];this['deskAccounts']=_0x2594eb[_0x2bb3('0x1a')];this[_0x2bb3('0x1b')]=_0x2594eb[_0x2bb3('0x1b')];this['servicenowAccounts']=_0x2594eb[_0x2bb3('0x1c')];this['dynamics365Accounts']=_0x2594eb[_0x2bb3('0x1d')];this['freshsalesAccounts']=_0x2594eb['freshsalesAccounts'];this[_0x2bb3('0x1e')]={'zendesk':this[_0x2bb3('0x15')],'salesforce':this[_0x2bb3('0x17')],'freshdesk':this[_0x2bb3('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x2bb3('0x19')],'desk':this[_0x2bb3('0x1a')],'vtiger':this[_0x2bb3('0x1b')],'dynamics365':this[_0x2bb3('0x1d')],'freshsales':this[_0x2bb3('0x1f')],'servicenow':this[_0x2bb3('0x1c')]};ami['on'](_0x2bb3('0x20'),this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on']('custom:agentconnect',this[_0x2bb3('0x21')]['bind'](this));ami['on'](_0x2bb3('0x23'),this[_0x2bb3('0x21')]['bind'](this));ami['on'](_0x2bb3('0x24'),this['syncCustomEvent'][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x25'),this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x26'),this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x27'),this[_0x2bb3('0x21')]['bind'](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x28'),this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x29'),this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x2a'),this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x2b'),this['syncCustomEvent'][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x2c'),this[_0x2bb3('0x2d')]['bind'](this));ami['on']('custom:dialconnect',this[_0x2bb3('0x2d')][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x2e'),this[_0x2bb3('0x2d')][_0x2bb3('0x22')](this));ami['on']('custom:newinteraction',this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0x2bb3('0x2f'),this['syncCustomEvent'][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x30'),this[_0x2bb3('0x21')]['bind'](this));ami['on'](_0x2bb3('0x31'),this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:rejectmessage',this[_0x2bb3('0x21')][_0x2bb3('0x22')](this));ami['on'](_0x2bb3('0x32'),this['syncCustomEvent'][_0x2bb3('0x22')](this));}Trigger['prototype'][_0x2bb3('0x33')]=function(_0x5a811d,_0x9b740a,_0x1cade6){logger['info'](_0x5a811d,_0x9b740a,JSON[_0x2bb3('0x34')](_0x1cade6));io['to'](_0x5a811d)[_0x2bb3('0x33')](_0x9b740a,_0x1cade6);};Trigger[_0x2bb3('0x35')][_0x2bb3('0x21')]=function(_0x1c66d4){var _0x884ecb=_[_0x2bb3('0x36')](_0x1c66d4);if(typeof _0x884ecb['motionChannel']===_0x2bb3('0x37')){_0x884ecb[_0x2bb3('0x38')]=_0x2bb3('0x39');}logger[_0x2bb3('0x3a')]('syncCustomEvent',util[_0x2bb3('0x3b')](_0x884ecb,{'showHidden':!![],'depth':null}));this[_0x2bb3('0x3c')](_0x884ecb);};Trigger['prototype'][_0x2bb3('0x2d')]=function(_0x326dbb){if(this[_0x2bb3('0x11')][_0x326dbb[_0x2bb3('0x3d')]]){this[_0x2bb3('0x21')](_0x326dbb);}};Trigger[_0x2bb3('0x35')][_0x2bb3('0x3c')]=function(_0x58fcc1){var _0x343600;for(var _0x47e6ee in this[_0x2bb3('0x10')]){if(this[_0x2bb3('0x10')]['hasOwnProperty'](_0x47e6ee)){if(this['triggers'][_0x47e6ee]['status']){_0x343600=this[_0x2bb3('0x3e')](this[_0x2bb3('0x10')][_0x47e6ee],_0x58fcc1);if(_0x343600){_[_0x2bb3('0x3f')](_0x58fcc1,_0x58fcc1[_0x2bb3('0x40')]);for(var _0x2789ea=0x0,_0x1df941,_0x120217,_0x1f9f5d;_0x2789ea0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x5fc3[_0x221ba2];return _0x47d08e;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7565d24..2fc4e3c 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 _0x0458=['info','systemuserid','userId','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','%2b','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','customField','idField','indexOf','ticketType','incident','Subjects','getString','Descriptions','Fields','phonecall','queue','/contacts(','callDirection','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','GET','Bearer\x20','4.0','isNil','email','length','internalemailaddress','isdisabled'];(function(_0x1ab78f,_0x3a395f){var _0x5eabb4=function(_0x30e736){while(--_0x30e736){_0x1ab78f['push'](_0x1ab78f['shift']());}};_0x5eabb4(++_0x3a395f);}(_0x0458,0x11c));var _0x8045=function(_0x3124e7,_0x505923){_0x3124e7=_0x3124e7-0x0;var _0x1bd92b=_0x0458[_0x3124e7];return _0x1bd92b;};'use strict';var _=require('lodash');var rp=require(_0x8045('0x0'));var util=require('util');var intUtil=require(_0x8045('0x1'));var md5=require(_0x8045('0x2'));var Redis=require(_0x8045('0x3'));var logger=require(_0x8045('0x4'))(_0x8045('0x5'));var config=require('../../../../config/environment');config[_0x8045('0x6')]=_[_0x8045('0x7')](config[_0x8045('0x6')],{'host':_0x8045('0x8'),'port':0x18eb});var io=require(_0x8045('0x9'))(new Redis(config[_0x8045('0x6')]));function getAuthToken(_0x36c44a,_0x372582,_0x4ab5af){if(_0x36c44a[_0x8045('0xa')]){_0x36c44a['remoteUri']=_0x36c44a[_0x8045('0xb')][_0x8045('0xc')];_0x36c44a[_0x8045('0xd')]=_0x36c44a['CloudProvider'][_0x8045('0xe')];return Promise[_0x8045('0xf')](_0x36c44a[_0x8045('0xb')][_0x8045('0x10')]);}var _0x3053f0={'method':_0x8045('0x11'),'uri':_0x372582,'form':{'client_id':_0x36c44a[_0x8045('0x12')],'resource':_0x36c44a[_0x8045('0x13')],'username':_0x36c44a[_0x8045('0x14')],'password':_0x36c44a[_0x8045('0x15')],'grant_type':_0x8045('0x15'),'client_secret':_0x36c44a[_0x8045('0x16')]},'json':!![]};return rp(_0x3053f0)['then'](function(_0x4b5122){return _0x4b5122[_0x8045('0x17')];})[_0x8045('0x18')](function(_0x41b649){logger[_0x8045('0x19')]('['+[_0x4ab5af['toUpperCase']()]+_0x8045('0x1a'));return _0x41b649[_0x8045('0x1b')];});}function getUser(_0x172491,_0x23671d,_0x29fefa,_0x218c41,_0x42d0a4,_0x3f028f){return new Promise(function(_0x59dbcb,_0x568348){return getAuthToken(_0x23671d,_0x218c41,_0x3f028f)[_0x8045('0x1c')](function(_0x187fb1){var _0x33ae7c={'method':_0x8045('0x1d'),'uri':_0x42d0a4+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x8045('0x1e')+_0x187fb1,'OData-Version':_0x8045('0x1f')},'json':!![]};return rp(_0x33ae7c);})[_0x8045('0x1c')](function(_0x117713){var _0x2aaac0=_0x117713['value'];var _0x5bc24d=![];var _0x31f0ce=null;if(!_[_0x8045('0x20')](_0x29fefa)){if(intUtil['validateEmail'](_0x29fefa['email'])){_0x172491['userEmail']=_0x29fefa[_0x8045('0x21')];for(_0x31f0ce=0x0;_0x31f0ce<_0x2aaac0[_0x8045('0x22')];_0x31f0ce++){if(_0x2aaac0[_0x31f0ce][_0x8045('0x23')]===_0x29fefa[_0x8045('0x21')]&&!_0x2aaac0[_0x31f0ce][_0x8045('0x24')]){_0x5bc24d=!![];logger[_0x8045('0x25')]('['+[_0x3f028f['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x2aaac0[_0x31f0ce][_0x8045('0x26')]+'!');_0x172491[_0x8045('0x27')]=_0x2aaac0[_0x31f0ce][_0x8045('0x26')];}}}}if(!_0x5bc24d){logger['info']('['+[_0x3f028f[_0x8045('0x28')]()]+_0x8045('0x29'));_0x172491[_0x8045('0x2a')]=_0x23671d[_0x8045('0x14')];for(_0x31f0ce=0x0;_0x31f0ce<_0x2aaac0[_0x8045('0x22')];_0x31f0ce++){if(_0x2aaac0[_0x31f0ce][_0x8045('0x23')]===_0x23671d['username']){_0x172491[_0x8045('0x27')]=_0x2aaac0[_0x31f0ce]['systemuserid'];}}}_0x59dbcb(_0x172491);})['catch'](function(_0x601a09){_0x568348(_0x601a09[_0x8045('0x1b')]);});});}function createEndUser(_0x295e35,_0x5183c3,_0x3a088d,_0x5cd009,_0x12834b,_0x4a0b0f,_0x25b44f){return new Promise(function(_0xd44bbf,_0x347d72){return getAuthToken(_0x5183c3,_0x3a088d,_0x4a0b0f)[_0x8045('0x1c')](function(_0x408aeb){var _0x8584d2=_0x4a0b0f[_0x8045('0x2b')]()===_0x8045('0x2c')?_0x12834b[_0x8045('0x2d')]:_0x12834b[_0x8045('0x2e')];var _0x571985={'method':_0x8045('0x11'),'uri':_0x5cd009+_0x8045('0x2f'),'body':{'fullname':_0x8584d2,'firstname':_0x8584d2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8045('0x30')+_0x295e35['userId']+')'},'headers':{'Authorization':_0x8045('0x1e')+_0x408aeb,'OData-Version':_0x8045('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x571985['body'][_0x25b44f]=_0x8584d2;return rp(_0x571985);})[_0x8045('0x1c')](function(_0x3c6f85){var _0x47fefc=_0x3c6f85[_0x8045('0x31')][_0x8045('0x32')];var _0x539091=_0x47fefc[_0x8045('0x33')](_0x47fefc[_0x8045('0x34')]('(')+0x1,_0x47fefc['lastIndexOf'](')'));_0x295e35[_0x8045('0x35')]=_0x539091;_0xd44bbf(_0x295e35);})[_0x8045('0x18')](function(_0x154508){_0x347d72(_0x154508[_0x8045('0x1b')]);});});}function getEndUser(_0x8a890c,_0x3f4095,_0x5976b7,_0x3889fd,_0x22da7f,_0x2f220c,_0x219e36,_0xb014f8){var _0x252bec=_0x2f220c[_0x8045('0x2b')]()==='outbound'?_0x22da7f[_0x8045('0x2d')]:_0x22da7f[_0x8045('0x2e')];return getAuthToken(_0x3f4095,_0x5976b7,_0x2f220c)[_0x8045('0x1c')](function(_0x184d8d){_0xb014f8=_0xb014f8?_0xb014f8:'telephone1';var _0x59e756={'method':_0x8045('0x1d'),'uri':_0x3889fd+'contacts?$select='+_0xb014f8+'&$filter='+_0xb014f8+'\x20eq\x20\x27'+_0x252bec['replace']('+',_0x8045('0x36'))+'\x27','headers':{'Authorization':_0x8045('0x1e')+_0x184d8d,'If-None-Match':null,'OData-Version':_0x8045('0x1f')},'json':!![]};return rp(_0x59e756);})[_0x8045('0x1c')](function(_0xd6cf29){var _0x4d4e2c=![];if(!_0xd6cf29)return _0x4d4e2c;var _0x2d981e=_0xd6cf29[_0x8045('0x37')];for(var _0x3e48a0=0x0;_0x3e48a0<_0x2d981e[_0x8045('0x22')];_0x3e48a0++){if(_0x2d981e[_0x3e48a0][_0xb014f8]===_0x252bec){_0x4d4e2c=!![];_0x8a890c[_0x8045('0x35')]=_0x2d981e[_0x3e48a0][_0x8045('0x38')];}}return _0x4d4e2c;})[_0x8045('0x1c')](function(_0x4bfb67){if(_0x4bfb67)return _0x8a890c;if(_0x219e36===_0x8045('0x39')){logger['info']('['+[_0x2f220c[_0x8045('0x28')]()]+_0x8045('0x3a'));return _0x8a890c;}return createEndUser(_0x8a890c,_0x3f4095,_0x5976b7,_0x3889fd,_0x22da7f,_0x2f220c,_0xb014f8)[_0x8045('0x1c')](function(_0x59f16e){logger[_0x8045('0x25')]('['+[_0x2f220c[_0x8045('0x28')]()]+_0x8045('0x3b'),_0x59f16e[_0x8045('0x35')]);return _0x59f16e;});});}function getCustomFields(_0x139f8e,_0x39eff2,_0x1b4a46){var _0x203f18={};if(_0x139f8e[_0x8045('0x22')]>0x0){_[_0x8045('0x3c')](_0x139f8e,function(_0x231533){if(_[_0x8045('0x3d')]([_0x8045('0x3e'),_0x8045('0x3f')],_0x231533['type'])&&_0x231533['nameField']&&!_0x231533[_0x8045('0x40')]){var _0x2f68a8=_0x231533[_0x8045('0x41')][_0x8045('0x2b')]();var _0x3d8ad7=_0x2f68a8[_0x8045('0x33')](0x0,_0x2f68a8['indexOf']('_'));var _0x56bc31=_0x2f68a8[_0x8045('0x33')](_0x2f68a8[_0x8045('0x42')]('_')+0x1);if(_0x3d8ad7===_0x1b4a46){_0x203f18[_0x56bc31]=_0x231533['content'];}}});}return _0x203f18;}function getTicket(_0x196fea,_0x4cc160,_0xff4eb7,_0x4e61ac,_0x531bad,_0x287b07,_0x3db745){return new Promise(function(_0x23066a,_0x514867){var _0x54b388;return getAuthToken(_0x4cc160,_0xff4eb7,_0x3db745)[_0x8045('0x1c')](function(_0x17777e){if(_0x287b07[_0x8045('0x43')]===_0x8045('0x44')){_0x54b388={'method':'POST','uri':_0x4e61ac+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x287b07[_0x8045('0x45')],_0x531bad,'\x20'),'description':intUtil[_0x8045('0x46')](_0x287b07[_0x8045('0x47')],_0x531bad,'\x0a'),'customerid_contact@odata.bind':_0x196fea['enduserId']?'/contacts('+_0x196fea['enduserId']+')':undefined,'ownerid@odata.bind':_0x8045('0x30')+_0x196fea['userId']+')','caseorigincode':'1'},getCustomFields(_0x287b07[_0x8045('0x48')],_0x531bad,_0x287b07[_0x8045('0x43')])),'headers':{'Authorization':_0x8045('0x1e')+_0x17777e,'OData-Version':_0x8045('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x287b07[_0x8045('0x43')]===_0x8045('0x49')){var _0x2f9fd7=_0x196fea[_0x8045('0x35')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x196fea[_0x8045('0x27')]+')','participationtypemask':_0x196fea['callDirection']===_0x8045('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x8045('0x4b')+_0x196fea[_0x8045('0x35')]+')','participationtypemask':_0x196fea['callDirection']===_0x8045('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8045('0x30')+_0x196fea[_0x8045('0x27')]+')','participationtypemask':_0x196fea[_0x8045('0x4c')]===_0x8045('0x4a')?0x2:0x1}];_0x54b388={'method':_0x8045('0x11'),'uri':_0x4e61ac+_0x8045('0x4d'),'body':Object['assign']({},{'subject':intUtil[_0x8045('0x46')](_0x287b07[_0x8045('0x45')],_0x531bad,'\x20'),'phonenumber':String(_0x531bad[_0x8045('0x2e')]),'description':intUtil['getString'](_0x287b07['Descriptions'],_0x531bad,'\x0a'),'regardingobjectid_contact@odata.bind':_0x196fea[_0x8045('0x35')]?_0x8045('0x4b')+_0x196fea[_0x8045('0x35')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x196fea['userId']+')','directioncode':_0x196fea[_0x8045('0x4c')]===_0x8045('0x4a')?![]:!![],'phonecall_activity_parties':_0x2f9fd7},getCustomFields(_0x287b07['Fields'],_0x531bad,_0x287b07[_0x8045('0x43')])),'headers':{'Authorization':_0x8045('0x1e')+_0x17777e,'OData-Version':_0x8045('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x54b388);})[_0x8045('0x1c')](function(_0x488694){var _0x44eb5f=_0x488694['headers'][_0x8045('0x32')];var _0x1c7d68=_0x44eb5f[_0x8045('0x33')](_0x44eb5f[_0x8045('0x34')]('(')+0x1,_0x44eb5f[_0x8045('0x34')](')'));_0x196fea[_0x8045('0x4e')]=_0x1c7d68;_0x23066a(_0x196fea);})[_0x8045('0x18')](function(_0x1b6eaa){_0x514867(_0x1b6eaa['message']);});});}function emit(_0x3661f2,_0x19a3a5,_0x27fdda,_0x1ba81e){var _0x3e8502={'uri':util[_0x8045('0x4f')](_0x8045('0x50'),_0x3661f2,_0x27fdda,_0x1ba81e)};io['to'](util[_0x8045('0x4f')](_0x8045('0x51'),_0x19a3a5))[_0x8045('0x52')](_0x8045('0x53'),_0x3e8502);}exports['cs']=function(_0x519964,_0x9d2e5,_0x3384f9,_0x1d055c,_0x1927ac,_0x8c366f,_0x3d8f9e,_0x5c5794){var _0xd563c1={};_0x8c366f['remoteUri']=_0x8c366f['modernAuthentication']?intUtil[_0x8045('0x54')](_0x8c366f[_0x8045('0xb')][_0x8045('0xc')]):intUtil['stripTrailingSlash'](_0x8c366f[_0x8045('0x13')]);_0x8c366f['serverUrl']=intUtil['stripTrailingSlash'](_0x8c366f['serverUrl']);_0xd563c1['callDirection']=_0x5c5794===_0x8045('0x4a')||_0x5c5794===_0x8045('0x55')?'queue':_0x8045('0x2c');var _0x3cf73d=_0x8c366f['modernAuthentication']?util[_0x8045('0x4f')]('%s/api/data/v9.0/',_0x8c366f[_0x8045('0xb')][_0x8045('0xc')]):util[_0x8045('0x4f')](_0x8045('0x56'),_0x8c366f[_0x8045('0x13')]);var _0x399f1a=util['format'](_0x8045('0x57'),_0x8c366f[_0x8045('0xd')]);var _0x448ab7=util[_0x8045('0x4f')](_0x8045('0x58'),_0x8c366f[_0x8045('0x59')],_0x9d2e5[_0x8045('0x5a')],md5(_0x9d2e5[_0x8045('0x5a')]));if(_0x1927ac&&_0x1927ac[_0x8045('0x5b')]){logger[_0x8045('0x25')](_0x8045('0x5c'),'Recording\x20is\x20enabled!');_0x9d2e5[_0x8045('0x5d')]=_0x448ab7;}else if(_0x3d8f9e&&_0x3d8f9e['recordingFormat']&&_0x3d8f9e[_0x8045('0x5e')]!==_0x8045('0x5f')){logger[_0x8045('0x25')]('[OUTBOUND]',_0x8045('0x60'));_0x9d2e5[_0x8045('0x5d')]=_0x448ab7;}else{_0x9d2e5[_0x8045('0x5d')]='';}return getUser(_0xd563c1,_0x8c366f,_0x1d055c,_0x399f1a,_0x3cf73d,_0x5c5794)[_0x8045('0x1c')](function(_0xbc0cab){logger[_0x8045('0x25')]('['+_0x5c5794[_0x8045('0x28')]()+_0x8045('0x61'),_0xbc0cab[_0x8045('0x27')]);logger[_0x8045('0x25')]('['+_0x5c5794['toUpperCase']()+_0x8045('0x62'),_0xbc0cab[_0x8045('0x2a')]);return getEndUser(_0xbc0cab,_0x8c366f,_0x399f1a,_0x3cf73d,_0x9d2e5,_0x5c5794,_0x3384f9[_0x8045('0x63')],_0x3384f9[_0x8045('0x64')]);})['then'](function(_0x59bbc6){logger[_0x8045('0x25')]('['+_0x5c5794['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x59bbc6[_0x8045('0x35')]);logger[_0x8045('0x25')]('['+_0x5c5794[_0x8045('0x28')]()+_0x8045('0x65'),_0x9d2e5['calleridnum']);return getTicket(_0x59bbc6,_0x8c366f,_0x399f1a,_0x3cf73d,_0x9d2e5,_0x3384f9,_0x5c5794);})[_0x8045('0x1c')](function(_0x5763f2){logger['info'](util[_0x8045('0x4f')]('['+_0x5c5794['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3384f9['ticketType'],_0x5763f2[_0x8045('0x4e')]));logger['info'](util[_0x8045('0x4f')]('['+_0x5c5794[_0x8045('0x28')]()+_0x8045('0x66'),_0x5c5794));if(_0x5c5794!==_0x8045('0x55')&&_0x3384f9['openNewTab']){logger[_0x8045('0x25')]('['+_0x5c5794[_0x8045('0x28')]()+']',_0x8045('0x67'));emit(_0x8c366f[_0x8045('0x13')],_0x1d055c[_0x8045('0x68')],_0x3384f9[_0x8045('0x43')],_0x5763f2[_0x8045('0x4e')]);}})[_0x8045('0x18')](function(_0x4b9e9c){logger[_0x8045('0x19')]('['+_0x5c5794[_0x8045('0x28')]()+_0x8045('0x69'),_0x4b9e9c[_0x8045('0x1b')]);console[_0x8045('0x19')](_0x8045('0x6a'),_0x4b9e9c);});}; \ No newline at end of file +var _0x6f84=['ticketType','incident','incidents','assign','Subjects','getString','/contacts(','Fields','phonecall','callDirection','queue','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','data5','clientId','password','clientSecret','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','validateEmail','email','length','systemuserid','userId','info','userEmail','internalemailaddress','username','catch','outbound','calleridnum','POST','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing','includes','indexOf','content'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x6f84,0x152));var _0x46f8=function(_0x22c25e,_0xe79177){_0x22c25e=_0x22c25e-0x0;var _0x59fcba=_0x6f84[_0x22c25e];return _0x59fcba;};'use strict';var _=require('lodash');var rp=require(_0x46f8('0x0'));var util=require(_0x46f8('0x1'));var intUtil=require(_0x46f8('0x2'));var md5=require(_0x46f8('0x3'));var Redis=require(_0x46f8('0x4'));var logger=require('../../../../config/logger')(_0x46f8('0x5'));var config=require(_0x46f8('0x6'));config[_0x46f8('0x7')]=_[_0x46f8('0x8')](config[_0x46f8('0x7')],{'host':_0x46f8('0x9'),'port':0x18eb});var io=require(_0x46f8('0xa'))(new Redis(config[_0x46f8('0x7')]));function getAuthToken(_0xeed9a1,_0x1bb8db,_0xfc8ab8){if(_0xeed9a1[_0x46f8('0xb')]){_0xeed9a1[_0x46f8('0xc')]=_0xeed9a1[_0x46f8('0xd')][_0x46f8('0xe')];_0xeed9a1['tenantId']=_0xeed9a1[_0x46f8('0xd')][_0x46f8('0xf')];return Promise[_0x46f8('0x10')](_0xeed9a1['CloudProvider'][_0x46f8('0x11')]);}var _0x1e38f1={'method':'POST','uri':_0x1bb8db,'form':{'client_id':_0xeed9a1[_0x46f8('0x12')],'resource':_0xeed9a1[_0x46f8('0xc')],'username':_0xeed9a1['username'],'password':_0xeed9a1[_0x46f8('0x13')],'grant_type':_0x46f8('0x13'),'client_secret':_0xeed9a1[_0x46f8('0x14')]},'json':!![]};return rp(_0x1e38f1)[_0x46f8('0x15')](function(_0x2c456a){return _0x2c456a[_0x46f8('0x16')];})['catch'](function(_0xdfa100){logger['error']('['+[_0xfc8ab8[_0x46f8('0x17')]()]+_0x46f8('0x18'));return _0xdfa100[_0x46f8('0x19')];});}function getUser(_0x2b9efd,_0x47cbe0,_0x39751e,_0x3b5f60,_0x5cb196,_0x284fd9){return new Promise(function(_0xa7e60f,_0x52c919){return getAuthToken(_0x47cbe0,_0x3b5f60,_0x284fd9)[_0x46f8('0x15')](function(_0x480b6d){var _0x3fe0f2={'method':_0x46f8('0x1a'),'uri':_0x5cb196+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x46f8('0x1b')+_0x480b6d,'OData-Version':_0x46f8('0x1c')},'json':!![]};return rp(_0x3fe0f2);})[_0x46f8('0x15')](function(_0x494cf8){var _0x56d5a9=_0x494cf8['value'];var _0x1e3bb9=![];var _0x41c3a6=null;if(!_['isNil'](_0x39751e)){if(intUtil[_0x46f8('0x1d')](_0x39751e['email'])){_0x2b9efd['userEmail']=_0x39751e[_0x46f8('0x1e')];for(_0x41c3a6=0x0;_0x41c3a6<_0x56d5a9[_0x46f8('0x1f')];_0x41c3a6++){if(_0x56d5a9[_0x41c3a6]['internalemailaddress']===_0x39751e[_0x46f8('0x1e')]&&!_0x56d5a9[_0x41c3a6]['isdisabled']){_0x1e3bb9=!![];logger['info']('['+[_0x284fd9[_0x46f8('0x17')]()]+']\x20Agent\x20found\x20'+_0x56d5a9[_0x41c3a6][_0x46f8('0x20')]+'!');_0x2b9efd[_0x46f8('0x21')]=_0x56d5a9[_0x41c3a6][_0x46f8('0x20')];}}}}if(!_0x1e3bb9){logger[_0x46f8('0x22')]('['+[_0x284fd9[_0x46f8('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2b9efd[_0x46f8('0x23')]=_0x47cbe0['username'];for(_0x41c3a6=0x0;_0x41c3a6<_0x56d5a9[_0x46f8('0x1f')];_0x41c3a6++){if(_0x56d5a9[_0x41c3a6][_0x46f8('0x24')]===_0x47cbe0[_0x46f8('0x25')]){_0x2b9efd[_0x46f8('0x21')]=_0x56d5a9[_0x41c3a6]['systemuserid'];}}}_0xa7e60f(_0x2b9efd);})[_0x46f8('0x26')](function(_0x502d5d){_0x52c919(_0x502d5d[_0x46f8('0x19')]);});});}function createEndUser(_0x80bfc6,_0x273098,_0x1207a8,_0x27a85c,_0x1339f4,_0x5a6432,_0x28df64){return new Promise(function(_0x10c3d4,_0x221a88){return getAuthToken(_0x273098,_0x1207a8,_0x5a6432)['then'](function(_0x5c652c){var _0x991a0a=_0x5a6432['toLowerCase']()===_0x46f8('0x27')?_0x1339f4['destcalleridnum']:_0x1339f4[_0x46f8('0x28')];var _0x58161d={'method':_0x46f8('0x29'),'uri':_0x27a85c+'contacts','body':{'fullname':_0x991a0a,'firstname':_0x991a0a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x46f8('0x2a')+_0x80bfc6[_0x46f8('0x21')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x5c652c,'OData-Version':_0x46f8('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x58161d[_0x46f8('0x2b')][_0x28df64]=_0x991a0a;return rp(_0x58161d);})[_0x46f8('0x15')](function(_0x20d2d2){var _0x76bf4b=_0x20d2d2[_0x46f8('0x2c')][_0x46f8('0x2d')];var _0x4c9963=_0x76bf4b[_0x46f8('0x2e')](_0x76bf4b[_0x46f8('0x2f')]('(')+0x1,_0x76bf4b['lastIndexOf'](')'));_0x80bfc6[_0x46f8('0x30')]=_0x4c9963;_0x10c3d4(_0x80bfc6);})[_0x46f8('0x26')](function(_0x5e1c04){_0x221a88(_0x5e1c04[_0x46f8('0x19')]);});});}function getEndUser(_0x316f64,_0x5842a9,_0x42b032,_0x22f511,_0x35fc55,_0x4e8876,_0x5787f2,_0x33e957){var _0x330554=_0x4e8876[_0x46f8('0x31')]()===_0x46f8('0x27')?_0x35fc55['destcalleridnum']:_0x35fc55[_0x46f8('0x28')];return getAuthToken(_0x5842a9,_0x42b032,_0x4e8876)[_0x46f8('0x15')](function(_0xec6f94){_0x33e957=_0x33e957?_0x33e957:_0x46f8('0x32');var _0x4dbf3a={'method':_0x46f8('0x1a'),'uri':_0x22f511+_0x46f8('0x33')+_0x33e957+_0x46f8('0x34')+_0x33e957+_0x46f8('0x35')+_0x330554[_0x46f8('0x36')]('+',_0x46f8('0x37'))+'\x27','headers':{'Authorization':_0x46f8('0x1b')+_0xec6f94,'If-None-Match':null,'OData-Version':_0x46f8('0x1c')},'json':!![]};return rp(_0x4dbf3a);})[_0x46f8('0x15')](function(_0x323ada){var _0x2d8219=![];if(!_0x323ada)return _0x2d8219;var _0x4d7998=_0x323ada[_0x46f8('0x38')];for(var _0x2a2f1b=0x0;_0x2a2f1b<_0x4d7998[_0x46f8('0x1f')];_0x2a2f1b++){if(_0x4d7998[_0x2a2f1b][_0x33e957]===_0x330554){_0x2d8219=!![];_0x316f64[_0x46f8('0x30')]=_0x4d7998[_0x2a2f1b][_0x46f8('0x39')];}}return _0x2d8219;})[_0x46f8('0x15')](function(_0x3ae48d){if(_0x3ae48d)return _0x316f64;if(_0x5787f2===_0x46f8('0x3a')){logger[_0x46f8('0x22')]('['+[_0x4e8876[_0x46f8('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x316f64;}return createEndUser(_0x316f64,_0x5842a9,_0x42b032,_0x22f511,_0x35fc55,_0x4e8876,_0x33e957)[_0x46f8('0x15')](function(_0x4e0e77){logger['info']('['+[_0x4e8876['toUpperCase']()]+']\x20Enduser\x20created!',_0x4e0e77['enduserId']);return _0x4e0e77;});});}function getCustomFields(_0x56adcd,_0x472732,_0x1b6b6a){var _0x490a95={};if(_0x56adcd[_0x46f8('0x1f')]>0x0){_['forEach'](_0x56adcd,function(_0x14a5e2){if(_[_0x46f8('0x3b')](['string','picklist'],_0x14a5e2['type'])&&_0x14a5e2['nameField']&&!_0x14a5e2['customField']){var _0x5c5149=_0x14a5e2['idField'][_0x46f8('0x31')]();var _0x4041ad=_0x5c5149[_0x46f8('0x2e')](0x0,_0x5c5149[_0x46f8('0x3c')]('_'));var _0x3afd16=_0x5c5149[_0x46f8('0x2e')](_0x5c5149[_0x46f8('0x3c')]('_')+0x1);if(_0x4041ad===_0x1b6b6a){_0x490a95[_0x3afd16]=_0x14a5e2[_0x46f8('0x3d')];}}});}return _0x490a95;}function getTicket(_0x4ff095,_0x4db2d9,_0x397861,_0x173b93,_0x18312a,_0x241763,_0x1e1f7f){return new Promise(function(_0x5281ce,_0x5efb3b){var _0x427f4c;return getAuthToken(_0x4db2d9,_0x397861,_0x1e1f7f)[_0x46f8('0x15')](function(_0x270ebf){if(_0x241763[_0x46f8('0x3e')]===_0x46f8('0x3f')){_0x427f4c={'method':_0x46f8('0x29'),'uri':_0x173b93+_0x46f8('0x40'),'body':Object[_0x46f8('0x41')]({},{'title':intUtil['getString'](_0x241763[_0x46f8('0x42')],_0x18312a,'\x20'),'description':intUtil[_0x46f8('0x43')](_0x241763['Descriptions'],_0x18312a,'\x0a'),'customerid_contact@odata.bind':_0x4ff095['enduserId']?_0x46f8('0x44')+_0x4ff095[_0x46f8('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4ff095['userId']+')','caseorigincode':'1'},getCustomFields(_0x241763[_0x46f8('0x45')],_0x18312a,_0x241763[_0x46f8('0x3e')])),'headers':{'Authorization':_0x46f8('0x1b')+_0x270ebf,'OData-Version':_0x46f8('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x241763[_0x46f8('0x3e')]===_0x46f8('0x46')){var _0x56c5d9=_0x4ff095['enduserId']?[{'partyid_systemuser@odata.bind':_0x46f8('0x2a')+_0x4ff095[_0x46f8('0x21')]+')','participationtypemask':_0x4ff095[_0x46f8('0x47')]===_0x46f8('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x46f8('0x44')+_0x4ff095[_0x46f8('0x30')]+')','participationtypemask':_0x4ff095[_0x46f8('0x47')]===_0x46f8('0x48')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4ff095[_0x46f8('0x21')]+')','participationtypemask':_0x4ff095[_0x46f8('0x47')]==='queue'?0x2:0x1}];_0x427f4c={'method':'POST','uri':_0x173b93+'phonecalls','body':Object[_0x46f8('0x41')]({},{'subject':intUtil[_0x46f8('0x43')](_0x241763[_0x46f8('0x42')],_0x18312a,'\x20'),'phonenumber':String(_0x18312a[_0x46f8('0x28')]),'description':intUtil[_0x46f8('0x43')](_0x241763[_0x46f8('0x49')],_0x18312a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4ff095[_0x46f8('0x30')]?'/contacts('+_0x4ff095[_0x46f8('0x30')]+')':undefined,'ownerid@odata.bind':_0x46f8('0x2a')+_0x4ff095[_0x46f8('0x21')]+')','directioncode':_0x4ff095[_0x46f8('0x47')]==='queue'?![]:!![],'phonecall_activity_parties':_0x56c5d9},getCustomFields(_0x241763[_0x46f8('0x45')],_0x18312a,_0x241763[_0x46f8('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x270ebf,'OData-Version':_0x46f8('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x427f4c);})[_0x46f8('0x15')](function(_0x367eaa){var _0x520e79=_0x367eaa[_0x46f8('0x2c')][_0x46f8('0x2d')];var _0x2445ec=_0x520e79['substring'](_0x520e79[_0x46f8('0x2f')]('(')+0x1,_0x520e79[_0x46f8('0x2f')](')'));_0x4ff095[_0x46f8('0x4a')]=_0x2445ec;_0x5281ce(_0x4ff095);})[_0x46f8('0x26')](function(_0x5ac657){_0x5efb3b(_0x5ac657[_0x46f8('0x19')]);});});}function emit(_0x23519e,_0x511dbc,_0x556052,_0x38b09f){var _0x40d8cd={'uri':util[_0x46f8('0x4b')](_0x46f8('0x4c'),_0x23519e,_0x556052,_0x38b09f)};io['to'](util[_0x46f8('0x4b')](_0x46f8('0x4d'),_0x511dbc))['emit']('trigger:browser:url',_0x40d8cd);}exports['cs']=function(_0xd35aad,_0x298b1f,_0x48b150,_0x14bd0b,_0x308cce,_0x2412a2,_0x18c36b,_0x1b7f08){var _0x248ebd={};_0x2412a2[_0x46f8('0xc')]=_0x2412a2['modernAuthentication']?intUtil[_0x46f8('0x4e')](_0x2412a2[_0x46f8('0xd')][_0x46f8('0xe')]):intUtil[_0x46f8('0x4e')](_0x2412a2[_0x46f8('0xc')]);_0x2412a2[_0x46f8('0x4f')]=intUtil['stripTrailingSlash'](_0x2412a2[_0x46f8('0x4f')]);_0x248ebd[_0x46f8('0x47')]=_0x1b7f08===_0x46f8('0x48')||_0x1b7f08===_0x46f8('0x50')?_0x46f8('0x48'):_0x46f8('0x27');var _0x3c8196=_0x2412a2['modernAuthentication']?util[_0x46f8('0x4b')](_0x46f8('0x51'),_0x2412a2['CloudProvider']['data7']):util['format'](_0x46f8('0x51'),_0x2412a2[_0x46f8('0xc')]);var _0x2fe2a8=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x2412a2['tenantId']);var _0x1c37ce=util[_0x46f8('0x4b')](_0x46f8('0x52'),_0x2412a2[_0x46f8('0x4f')],_0x298b1f[_0x46f8('0x53')],md5(_0x298b1f[_0x46f8('0x53')]));if(_0x308cce&&_0x308cce['monitor_format']){logger[_0x46f8('0x22')]('[QUEUE]',_0x46f8('0x54'));_0x298b1f['recordingURL']=_0x1c37ce;}else if(_0x18c36b&&_0x18c36b[_0x46f8('0x55')]&&_0x18c36b[_0x46f8('0x55')]!==_0x46f8('0x56')){logger[_0x46f8('0x22')](_0x46f8('0x57'),_0x46f8('0x54'));_0x298b1f[_0x46f8('0x58')]=_0x1c37ce;}else{_0x298b1f[_0x46f8('0x58')]='';}return getUser(_0x248ebd,_0x2412a2,_0x14bd0b,_0x2fe2a8,_0x3c8196,_0x1b7f08)[_0x46f8('0x15')](function(_0x1acb87){logger['info']('['+_0x1b7f08[_0x46f8('0x17')]()+_0x46f8('0x59'),_0x1acb87['userId']);logger[_0x46f8('0x22')]('['+_0x1b7f08[_0x46f8('0x17')]()+_0x46f8('0x5a'),_0x1acb87['userEmail']);return getEndUser(_0x1acb87,_0x2412a2,_0x2fe2a8,_0x3c8196,_0x298b1f,_0x1b7f08,_0x48b150[_0x46f8('0x5b')],_0x48b150[_0x46f8('0x5c')]);})[_0x46f8('0x15')](function(_0x4e0927){logger['info']('['+_0x1b7f08[_0x46f8('0x17')]()+_0x46f8('0x5d'),_0x4e0927[_0x46f8('0x30')]);logger[_0x46f8('0x22')]('['+_0x1b7f08[_0x46f8('0x17')]()+_0x46f8('0x5e'),_0x298b1f[_0x46f8('0x28')]);return getTicket(_0x4e0927,_0x2412a2,_0x2fe2a8,_0x3c8196,_0x298b1f,_0x48b150,_0x1b7f08);})[_0x46f8('0x15')](function(_0x5a13b2){logger[_0x46f8('0x22')](util['format']('['+_0x1b7f08['toUpperCase']()+_0x46f8('0x5f'),_0x48b150[_0x46f8('0x3e')],_0x5a13b2[_0x46f8('0x4a')]));logger[_0x46f8('0x22')](util[_0x46f8('0x4b')]('['+_0x1b7f08[_0x46f8('0x17')]()+']\x20Call\x20direction:\x20%s',_0x1b7f08));if(_0x1b7f08!==_0x46f8('0x50')&&_0x48b150['openNewTab']){logger[_0x46f8('0x22')]('['+_0x1b7f08[_0x46f8('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2412a2[_0x46f8('0xc')],_0x14bd0b[_0x46f8('0x60')],_0x48b150[_0x46f8('0x3e')],_0x5a13b2[_0x46f8('0x4a')]);}})['catch'](function(_0x18a51e){logger[_0x46f8('0x61')]('['+_0x1b7f08[_0x46f8('0x17')]()+_0x46f8('0x62'),_0x18a51e[_0x46f8('0x19')]);console[_0x46f8('0x61')](_0x46f8('0x63'),_0x18a51e);});}; \ 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 fd31e62..2405a3a 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 _0x9b94=['getString','Subjects','Descriptions','
','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','length','map','forEach','string','type','nameField','toString','picklist','idField','customField','push','content','variable','variableName','customVariable','name','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','trigger:browser:url','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','util','ioredis','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x9b94,0x1c3));var _0x49b9=function(_0x113ef9,_0x38d94e){_0x113ef9=_0x113ef9-0x0;var _0x30b62a=_0x9b94[_0x113ef9];return _0x30b62a;};'use strict';var _=require(_0x49b9('0x0'));var rp=require(_0x49b9('0x1'));var md5=require('md5');var util=require(_0x49b9('0x2'));var Redis=require(_0x49b9('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config['redis']=_['defaults'](config[_0x49b9('0x4')],{'host':_0x49b9('0x5'),'port':0x18eb});var io=require(_0x49b9('0x6'))(new Redis(config[_0x49b9('0x4')]));var headers={'Content-Type':_0x49b9('0x7'),'Accept':_0x49b9('0x7')};function emit(_0x51058d,_0x5466a0,_0x10dc24){io['to'](_0x51058d)[_0x49b9('0x8')](_0x5466a0,_0x10dc24);}function getTicket(_0x31ca6d,_0x14f3a7,_0x480079,_0x4ba138,_0x59f9b4){logger['info'](_0x49b9('0x9'));var _0x517445=_['merge']({'responder_id':_0x14f3a7['id'],'requester_id':_0x480079['id'],'name':util[_0x49b9('0xa')](_0x49b9('0xb'),_0x59f9b4[_0x49b9('0xc')]),'phone':_0x59f9b4[_0x49b9('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x49b9('0xe')](_0x4ba138[_0x49b9('0xf')],_0x59f9b4,'\x20'),'description':intUtil[_0x49b9('0xe')](_0x4ba138[_0x49b9('0x10')],_0x59f9b4,_0x49b9('0x11')),'tags':getTags(_0x4ba138['Tags'],'name')},getCustomFields(_0x4ba138[_0x49b9('0x12')],_0x59f9b4));_0x517445[_0x49b9('0x13')]=_[_0x49b9('0x14')](_[_0x49b9('0x15')](_0x517445[_0x49b9('0x13')],'id'),_0x49b9('0x16'));return request({'uri':util[_0x49b9('0xa')](_0x49b9('0x17'),_0x31ca6d[_0x49b9('0x18')]),'method':_0x49b9('0x19'),'body':_0x517445})[_0x49b9('0x1a')](function(_0x2053ea){logger[_0x49b9('0x1b')](_0x49b9('0x1c'));return _0x2053ea;});}function getUser(_0x22de23,_0x106535){if(intUtil[_0x49b9('0x1d')](_0x106535)){return request({'uri':util[_0x49b9('0xa')](_0x49b9('0x1e'),_0x22de23[_0x49b9('0x18')]),'qs':{'email':_0x106535}})[_0x49b9('0x1a')](function(_0x4289d0){if(_0x4289d0['length']){logger[_0x49b9('0x1b')](_0x49b9('0x1f'));return _[_0x49b9('0x20')](_0x4289d0,function(_0x5f9883){return _0x5f9883[_0x49b9('0x21')][_0x49b9('0x22')]===_0x106535;});}else{logger[_0x49b9('0x1b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x49b9('0xa')](_0x49b9('0x23'),_0x22de23[_0x49b9('0x18')])})[_0x49b9('0x1a')](function(_0x3026cd){logger['info']('Admin\x20account\x20selected.');return _0x3026cd;});}});}else{logger[_0x49b9('0x1b')](_0x49b9('0x24'));return request({'uri':util[_0x49b9('0xa')](_0x49b9('0x23'),_0x22de23['remoteUri'])})['then'](function(_0x2f7f61){logger[_0x49b9('0x1b')](_0x49b9('0x25'));return _0x2f7f61;});}}function getEndUser(_0x202361,_0x3b32c,_0x226952){logger[_0x49b9('0x1b')](_0x49b9('0x26'),_0x226952);return request({'uri':util[_0x49b9('0xa')]('%s/api/v2/contacts',_0x202361['remoteUri']),'qs':{'phone':_0x226952}})[_0x49b9('0x1a')](function(_0x38fbd4){if(_0x38fbd4['length']){logger['info']('Enduser\x20found!');return _[_0x49b9('0x20')](_0x38fbd4,{'phone':_0x226952});}else{logger['info'](_0x49b9('0x27'));return request({'uri':util['format'](_0x49b9('0x28'),_0x202361[_0x49b9('0x18')]),'method':_0x49b9('0x19'),'body':{'name':_0x3b32c,'phone':_0x226952}})[_0x49b9('0x1a')](function(_0x510172){logger[_0x49b9('0x1b')](_0x49b9('0x29'));return _0x510172;});}});}function getAuth(_0x8c2b1b){return util[_0x49b9('0xa')](_0x49b9('0x2a'),new Buffer(_0x8c2b1b[_0x49b9('0x2b')]+':X')['toString'](_0x49b9('0x2c')));}function request(_0x4dbcb7){logger[_0x49b9('0x2d')](_0x49b9('0x2e'),JSON[_0x49b9('0x2f')](_0x4dbcb7));return rp(_['defaults'](_0x4dbcb7,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5f3063,_0x2ff5e7){var _0x40cbb5=[];if(_0x5f3063&&_0x5f3063[_0x49b9('0x30')]>0x0){_0x40cbb5=_[_0x49b9('0x31')](_0x5f3063,_0x2ff5e7);}return _0x40cbb5;}function getCustomFields(_0x5a1898,_0x3b572c){var _0x358561=[];var _0x52c391={'custom_fields':[]};if(_0x5a1898['length']>0x0){_[_0x49b9('0x32')](_0x5a1898,function(_0x169f39){if(_['includes']([_0x49b9('0x33'),'picklist'],_0x169f39[_0x49b9('0x34')])&&_0x169f39[_0x49b9('0x35')]&&!_0x169f39['customField']){_0x52c391[_0x169f39[_0x49b9('0x35')]['toLowerCase']()]=_0x169f39['content'][_0x49b9('0x36')]();}else if(_['includes']([_0x49b9('0x33'),_0x49b9('0x37')],_0x169f39[_0x49b9('0x34')])&&_0x169f39[_0x49b9('0x38')]&&_0x169f39[_0x49b9('0x39')]){_0x52c391[_0x49b9('0x13')][_0x49b9('0x3a')]({'id':_0x169f39['idField'],'value':_0x169f39[_0x49b9('0x3b')][_0x49b9('0x36')]()});}else if(_0x169f39[_0x49b9('0x34')]===_0x49b9('0x3c')&&_0x169f39['variableName']&&_0x169f39[_0x49b9('0x38')]&&_0x169f39[_0x49b9('0x39')]){_0x3b572c[_0x169f39['variableName']]&&_0x52c391[_0x49b9('0x13')]['push']({'id':_0x169f39[_0x49b9('0x38')],'value':_0x3b572c[_0x169f39[_0x49b9('0x3d')]]['toString']()});}else if(_0x169f39[_0x49b9('0x34')]===_0x49b9('0x3e')&&_0x169f39['Variable']&&_0x169f39['Variable'][_0x49b9('0x3f')]&&_0x169f39[_0x49b9('0x38')]&&_0x169f39[_0x49b9('0x39')]){_0x3b572c[_0x169f39[_0x49b9('0x40')][_0x49b9('0x3f')][_0x49b9('0x41')]()]&&_0x52c391['custom_fields'][_0x49b9('0x3a')]({'id':_0x169f39[_0x49b9('0x38')],'value':_0x3b572c[_0x169f39[_0x49b9('0x40')][_0x49b9('0x3f')][_0x49b9('0x41')]()][_0x49b9('0x36')]()});}});}return _0x52c391;}exports[_0x49b9('0x42')]=function(_0x6a9558,_0x584def,_0x11ad5a,_0x44ca82,_0x9ea9e8,_0x4e37f1){var _0x175e8c,_0x1431cf;_0x4e37f1[_0x49b9('0x18')]=intUtil[_0x49b9('0x43')](_0x4e37f1[_0x49b9('0x18')]);_0x4e37f1[_0x49b9('0x44')]=intUtil[_0x49b9('0x43')](_0x4e37f1[_0x49b9('0x44')]);if(_0x9ea9e8&&_0x9ea9e8[_0x49b9('0x45')]){logger['info'](_0x49b9('0x46'),'Recording\x20is\x20enabled!');_0x584def[_0x49b9('0x47')]=util[_0x49b9('0xa')](_0x49b9('0x48'),_0x4e37f1['serverUrl'],_0x584def[_0x49b9('0x49')],md5(_0x584def['uniqueid']));}else{_0x584def[_0x49b9('0x47')]='';}headers[_0x49b9('0x4a')]=getAuth(_0x4e37f1);return getUser(_0x4e37f1,_0x44ca82[_0x49b9('0x22')])[_0x49b9('0x1a')](function(_0x4af4f8){_0x175e8c=_0x4af4f8;logger[_0x49b9('0x1b')](_0x49b9('0x4b'),_0x175e8c['id']);return getEndUser(_0x4e37f1,_0x584def['calleridname'],_0x584def['calleridnum']);})[_0x49b9('0x1a')](function(_0x106984){_0x1431cf=_0x106984;logger[_0x49b9('0x1b')](_0x49b9('0x4c'),_0x1431cf['id']);return getTicket(_0x4e37f1,_0x175e8c,_0x1431cf,_0x11ad5a,_0x584def);})['then'](function(_0x5ae974){if(_0x5ae974&&_0x5ae974['id']){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5ae974['id']);logger[_0x49b9('0x1b')](_0x49b9('0x46'),_0x49b9('0x4d'));emit(util[_0x49b9('0xa')](_0x49b9('0x4e'),_0x44ca82[_0x49b9('0x3f')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x4e37f1[_0x49b9('0x18')],_0x5ae974['id'])});}})[_0x49b9('0x4f')](function(_0xaa9065){logger[_0x49b9('0x50')](_0x49b9('0x46'),JSON[_0x49b9('0x2f')](_0xaa9065));});};exports[_0x49b9('0x51')]=function(_0x45a6b7,_0x58428a,_0x1bb6ea,_0x48ac83,_0x330e4f,_0x32ebfd,_0x4dc1e8){var _0x25b23e,_0x200c9d;_0x32ebfd[_0x49b9('0x18')]=intUtil[_0x49b9('0x43')](_0x32ebfd[_0x49b9('0x18')]);_0x32ebfd[_0x49b9('0x44')]=intUtil['stripTrailingSlash'](_0x32ebfd[_0x49b9('0x44')]);if(_0x4dc1e8&&_0x4dc1e8['recordingFormat']&&_0x4dc1e8[_0x49b9('0x52')]!==_0x49b9('0x53')){logger[_0x49b9('0x1b')](_0x49b9('0x54'),_0x49b9('0x55'));_0x58428a[_0x49b9('0x47')]=util[_0x49b9('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32ebfd[_0x49b9('0x44')],_0x58428a['uniqueid'],md5(_0x58428a[_0x49b9('0x49')]));}headers[_0x49b9('0x4a')]=getAuth(_0x32ebfd);return getUser(_0x32ebfd,_0x48ac83['email'])[_0x49b9('0x1a')](function(_0x3cb8db){_0x25b23e=_0x3cb8db;logger['info'](_0x49b9('0x4b'),_0x25b23e['id']);return getEndUser(_0x32ebfd,_0x58428a['destcalleridname'],_0x58428a[_0x49b9('0x56')]);})[_0x49b9('0x1a')](function(_0x46cc1a){_0x200c9d=_0x46cc1a;logger[_0x49b9('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x200c9d['id']);return getTicket(_0x32ebfd,_0x25b23e,_0x200c9d,_0x1bb6ea,_0x58428a);})[_0x49b9('0x1a')](function(_0x3234c5){if(_0x3234c5&&_0x3234c5['id']){logger['info'](_0x49b9('0x1c'));logger[_0x49b9('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x3234c5['id']);logger[_0x49b9('0x1b')](_0x49b9('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x49b9('0xa')](_0x49b9('0x4e'),_0x48ac83[_0x49b9('0x3f')]),_0x49b9('0x57'),{'uri':util[_0x49b9('0xa')](_0x49b9('0x58'),_0x32ebfd[_0x49b9('0x18')],_0x3234c5['id'])});}})['catch'](function(_0x41982c){logger[_0x49b9('0x50')](_0x49b9('0x54'),JSON[_0x49b9('0x2f')](_0x41982c));});};exports[_0x49b9('0x59')]=function(_0x2258f7,_0xde1c7f,_0x5a5381,_0xb49a68,_0x5f1ca4,_0x50df5d){var _0x2cddc8,_0x2e9443;_0x50df5d[_0x49b9('0x18')]=intUtil[_0x49b9('0x43')](_0x50df5d[_0x49b9('0x18')]);_0x50df5d['serverUrl']=intUtil[_0x49b9('0x43')](_0x50df5d[_0x49b9('0x44')]);if(_0x5f1ca4&&_0x5f1ca4[_0x49b9('0x45')]){logger[_0x49b9('0x1b')]('['+_0xde1c7f[_0x49b9('0x5a')][_0x49b9('0x5b')]()+']',_0x49b9('0x55'));_0xde1c7f[_0x49b9('0x47')]=util[_0x49b9('0xa')](_0x49b9('0x48'),_0x50df5d[_0x49b9('0x44')],_0xde1c7f[_0x49b9('0x49')],md5(_0xde1c7f[_0x49b9('0x49')]));}else{_0xde1c7f[_0x49b9('0x47')]='';}headers[_0x49b9('0x4a')]=getAuth(_0x50df5d);return getUser(_0x50df5d,'')[_0x49b9('0x1a')](function(_0x229c06){_0x2cddc8=_0x229c06;logger[_0x49b9('0x1b')](_0x49b9('0x4b'),_0x2cddc8['id']);return getEndUser(_0x50df5d,_0xde1c7f[_0x49b9('0xc')],_0xde1c7f[_0x49b9('0xd')]);})[_0x49b9('0x1a')](function(_0xfd4cee){_0x2e9443=_0xfd4cee;logger[_0x49b9('0x1b')](_0x49b9('0x4c'),_0x2e9443['id']);return getTicket(_0x50df5d,_0x2cddc8,_0x2e9443,_0x5a5381,_0xde1c7f);})[_0x49b9('0x1a')](function(_0x55713c){if(_0x55713c){logger[_0x49b9('0x1b')]('Ticket\x20created!');logger[_0x49b9('0x1b')](_0x49b9('0x5c'),_0x55713c['id']);}})[_0x49b9('0x4f')](function(_0x12d3e0){logger[_0x49b9('0x50')]('['+_0xde1c7f[_0x49b9('0x5a')]['toUpperCase']()+']',JSON[_0x49b9('0x2f')](_0x12d3e0));});}; \ No newline at end of file +var _0x1c87=['Ticket\x20created!','validateEmail','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','forEach','string','picklist','nameField','customField','toLowerCase','content','type','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','catch','unmanaged','lastevent','The\x20Ticket\x20ID\x20is:','lodash','request-promise','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','then'];(function(_0x2a9b09,_0x10b848){var _0x5da8dc=function(_0x410229){while(--_0x410229){_0x2a9b09['push'](_0x2a9b09['shift']());}};_0x5da8dc(++_0x10b848);}(_0x1c87,0x192));var _0x71c8=function(_0x958912,_0x27cfe0){_0x958912=_0x958912-0x0;var _0x1344f4=_0x1c87[_0x958912];return _0x1344f4;};'use strict';var _=require(_0x71c8('0x0'));var rp=require(_0x71c8('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x71c8('0x2'));var intUtil=require('./util');var config=require(_0x71c8('0x3'));var logger=require(_0x71c8('0x4'))(_0x71c8('0x5'));config[_0x71c8('0x6')]=_[_0x71c8('0x7')](config['redis'],{'host':_0x71c8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x71c8('0x9'),'Accept':_0x71c8('0x9')};function emit(_0x354d39,_0x12355f,_0x1ee5c4){io['to'](_0x354d39)[_0x71c8('0xa')](_0x12355f,_0x1ee5c4);}function getTicket(_0x4f9d6a,_0x6b7c2e,_0x4cd12e,_0x2451fa,_0x217afa){logger[_0x71c8('0xb')]('Creating\x20new\x20ticket...');var _0x2e3b8a=_['merge']({'responder_id':_0x6b7c2e['id'],'requester_id':_0x4cd12e['id'],'name':util[_0x71c8('0xc')](_0x71c8('0xd'),_0x217afa[_0x71c8('0xe')]),'phone':_0x217afa[_0x71c8('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x71c8('0x10')](_0x2451fa[_0x71c8('0x11')],_0x217afa,'\x20'),'description':intUtil[_0x71c8('0x10')](_0x2451fa[_0x71c8('0x12')],_0x217afa,_0x71c8('0x13')),'tags':getTags(_0x2451fa[_0x71c8('0x14')],_0x71c8('0x15'))},getCustomFields(_0x2451fa[_0x71c8('0x16')],_0x217afa));_0x2e3b8a[_0x71c8('0x17')]=_[_0x71c8('0x18')](_['keyBy'](_0x2e3b8a[_0x71c8('0x17')],'id'),'value');return request({'uri':util[_0x71c8('0xc')](_0x71c8('0x19'),_0x4f9d6a[_0x71c8('0x1a')]),'method':'POST','body':_0x2e3b8a})[_0x71c8('0x1b')](function(_0x4d53f4){logger[_0x71c8('0xb')](_0x71c8('0x1c'));return _0x4d53f4;});}function getUser(_0x18deeb,_0x1564a6){if(intUtil[_0x71c8('0x1d')](_0x1564a6)){return request({'uri':util[_0x71c8('0xc')]('%s/api/v2/agents',_0x18deeb[_0x71c8('0x1a')]),'qs':{'email':_0x1564a6}})[_0x71c8('0x1b')](function(_0x32dd7e){if(_0x32dd7e[_0x71c8('0x1e')]){logger[_0x71c8('0xb')](_0x71c8('0x1f'));return _['find'](_0x32dd7e,function(_0x2990c4){return _0x2990c4[_0x71c8('0x20')][_0x71c8('0x21')]===_0x1564a6;});}else{logger[_0x71c8('0xb')](_0x71c8('0x22'));return request({'uri':util[_0x71c8('0xc')]('%s/api/v2/agents/me',_0x18deeb['remoteUri'])})[_0x71c8('0x1b')](function(_0x338291){logger[_0x71c8('0xb')](_0x71c8('0x23'));return _0x338291;});}});}else{logger[_0x71c8('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x71c8('0xc')](_0x71c8('0x24'),_0x18deeb[_0x71c8('0x1a')])})['then'](function(_0x2dfbd1){logger[_0x71c8('0xb')](_0x71c8('0x23'));return _0x2dfbd1;});}}function getEndUser(_0x4a3198,_0x494a59,_0x1c3cfd){logger[_0x71c8('0xb')]('Searching\x20enduser\x20with\x20phone',_0x1c3cfd);return request({'uri':util['format'](_0x71c8('0x25'),_0x4a3198[_0x71c8('0x1a')]),'qs':{'phone':_0x1c3cfd}})[_0x71c8('0x1b')](function(_0x418b95){if(_0x418b95[_0x71c8('0x1e')]){logger[_0x71c8('0xb')](_0x71c8('0x26'));return _['find'](_0x418b95,{'phone':_0x1c3cfd});}else{logger[_0x71c8('0xb')](_0x71c8('0x27'));return request({'uri':util[_0x71c8('0xc')](_0x71c8('0x25'),_0x4a3198[_0x71c8('0x1a')]),'method':_0x71c8('0x28'),'body':{'name':_0x494a59,'phone':_0x1c3cfd}})[_0x71c8('0x1b')](function(_0x1ccb80){logger[_0x71c8('0xb')](_0x71c8('0x29'));return _0x1ccb80;});}});}function getAuth(_0x1d624a){return util[_0x71c8('0xc')](_0x71c8('0x2a'),new Buffer(_0x1d624a['apiKey']+':X')[_0x71c8('0x2b')](_0x71c8('0x2c')));}function request(_0x49e822){logger[_0x71c8('0x2d')](_0x71c8('0x2e'),JSON['stringify'](_0x49e822));return rp(_[_0x71c8('0x7')](_0x49e822,{'method':_0x71c8('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x5539c0,_0x64348c){var _0x185056=[];if(_0x5539c0&&_0x5539c0[_0x71c8('0x1e')]>0x0){_0x185056=_['map'](_0x5539c0,_0x64348c);}return _0x185056;}function getCustomFields(_0x3b9dc7,_0xb4f2e5){var _0x55987c=[];var _0x3375fb={'custom_fields':[]};if(_0x3b9dc7[_0x71c8('0x1e')]>0x0){_[_0x71c8('0x30')](_0x3b9dc7,function(_0x140378){if(_['includes']([_0x71c8('0x31'),_0x71c8('0x32')],_0x140378['type'])&&_0x140378[_0x71c8('0x33')]&&!_0x140378[_0x71c8('0x34')]){_0x3375fb[_0x140378[_0x71c8('0x33')][_0x71c8('0x35')]()]=_0x140378[_0x71c8('0x36')][_0x71c8('0x2b')]();}else if(_['includes'](['string',_0x71c8('0x32')],_0x140378[_0x71c8('0x37')])&&_0x140378['idField']&&_0x140378[_0x71c8('0x34')]){_0x3375fb[_0x71c8('0x17')][_0x71c8('0x38')]({'id':_0x140378[_0x71c8('0x39')],'value':_0x140378['content']['toString']()});}else if(_0x140378['type']===_0x71c8('0x3a')&&_0x140378[_0x71c8('0x3b')]&&_0x140378[_0x71c8('0x39')]&&_0x140378[_0x71c8('0x34')]){_0xb4f2e5[_0x140378[_0x71c8('0x3b')]]&&_0x3375fb[_0x71c8('0x17')][_0x71c8('0x38')]({'id':_0x140378[_0x71c8('0x39')],'value':_0xb4f2e5[_0x140378[_0x71c8('0x3b')]][_0x71c8('0x2b')]()});}else if(_0x140378[_0x71c8('0x37')]===_0x71c8('0x3c')&&_0x140378[_0x71c8('0x3d')]&&_0x140378[_0x71c8('0x3d')]['name']&&_0x140378[_0x71c8('0x39')]&&_0x140378['customField']){_0xb4f2e5[_0x140378[_0x71c8('0x3d')][_0x71c8('0x15')][_0x71c8('0x35')]()]&&_0x3375fb[_0x71c8('0x17')][_0x71c8('0x38')]({'id':_0x140378[_0x71c8('0x39')],'value':_0xb4f2e5[_0x140378[_0x71c8('0x3d')][_0x71c8('0x15')]['toLowerCase']()][_0x71c8('0x2b')]()});}});}return _0x3375fb;}exports['queue']=function(_0x3e2051,_0x266def,_0x55088d,_0x419c90,_0x4f038a,_0xd106a6){var _0x49adde,_0x4676c3;_0xd106a6['remoteUri']=intUtil[_0x71c8('0x3e')](_0xd106a6[_0x71c8('0x1a')]);_0xd106a6[_0x71c8('0x3f')]=intUtil['stripTrailingSlash'](_0xd106a6[_0x71c8('0x3f')]);if(_0x4f038a&&_0x4f038a[_0x71c8('0x40')]){logger[_0x71c8('0xb')](_0x71c8('0x41'),_0x71c8('0x42'));_0x266def[_0x71c8('0x43')]=util[_0x71c8('0xc')](_0x71c8('0x44'),_0xd106a6['serverUrl'],_0x266def[_0x71c8('0x45')],md5(_0x266def['uniqueid']));}else{_0x266def[_0x71c8('0x43')]='';}headers[_0x71c8('0x46')]=getAuth(_0xd106a6);return getUser(_0xd106a6,_0x419c90[_0x71c8('0x21')])['then'](function(_0x529c12){_0x49adde=_0x529c12;logger[_0x71c8('0xb')](_0x71c8('0x47'),_0x49adde['id']);return getEndUser(_0xd106a6,_0x266def[_0x71c8('0xe')],_0x266def[_0x71c8('0xf')]);})['then'](function(_0x330b01){_0x4676c3=_0x330b01;logger[_0x71c8('0xb')](_0x71c8('0x48'),_0x4676c3['id']);return getTicket(_0xd106a6,_0x49adde,_0x4676c3,_0x55088d,_0x266def);})[_0x71c8('0x1b')](function(_0x188869){if(_0x188869&&_0x188869['id']){logger[_0x71c8('0xb')](_0x71c8('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x188869['id']);logger['info'](_0x71c8('0x41'),_0x71c8('0x49'));emit(util[_0x71c8('0xc')]('user:%s',_0x419c90[_0x71c8('0x15')]),_0x71c8('0x4a'),{'uri':util[_0x71c8('0xc')]('%s/helpdesk/tickets/%d',_0xd106a6[_0x71c8('0x1a')],_0x188869['id'])});}})['catch'](function(_0x547164){logger[_0x71c8('0x4b')](_0x71c8('0x41'),JSON[_0x71c8('0x4c')](_0x547164));});};exports[_0x71c8('0x4d')]=function(_0x37d839,_0x49d8a3,_0x19fecd,_0xc21524,_0x1cf3d0,_0x562305,_0xcfbe8d){var _0x37959b,_0x290abe;_0x562305[_0x71c8('0x1a')]=intUtil[_0x71c8('0x3e')](_0x562305[_0x71c8('0x1a')]);_0x562305[_0x71c8('0x3f')]=intUtil[_0x71c8('0x3e')](_0x562305['serverUrl']);if(_0xcfbe8d&&_0xcfbe8d[_0x71c8('0x4e')]&&_0xcfbe8d[_0x71c8('0x4e')]!=='none'){logger['info'](_0x71c8('0x4f'),_0x71c8('0x42'));_0x49d8a3['recordingURL']=util[_0x71c8('0xc')](_0x71c8('0x44'),_0x562305['serverUrl'],_0x49d8a3[_0x71c8('0x45')],md5(_0x49d8a3[_0x71c8('0x45')]));}headers[_0x71c8('0x46')]=getAuth(_0x562305);return getUser(_0x562305,_0xc21524[_0x71c8('0x21')])[_0x71c8('0x1b')](function(_0x426113){_0x37959b=_0x426113;logger[_0x71c8('0xb')](_0x71c8('0x47'),_0x37959b['id']);return getEndUser(_0x562305,_0x49d8a3[_0x71c8('0x50')],_0x49d8a3[_0x71c8('0x51')]);})[_0x71c8('0x1b')](function(_0x46cba4){_0x290abe=_0x46cba4;logger[_0x71c8('0xb')](_0x71c8('0x48'),_0x290abe['id']);return getTicket(_0x562305,_0x37959b,_0x290abe,_0x19fecd,_0x49d8a3);})['then'](function(_0x1fc483){if(_0x1fc483&&_0x1fc483['id']){logger['info'](_0x71c8('0x1c'));logger[_0x71c8('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1fc483['id']);logger[_0x71c8('0xb')](_0x71c8('0x4f'),_0x71c8('0x49'));emit(util[_0x71c8('0xc')]('user:%s',_0xc21524[_0x71c8('0x15')]),_0x71c8('0x4a'),{'uri':util[_0x71c8('0xc')]('%s/helpdesk/tickets/%d',_0x562305[_0x71c8('0x1a')],_0x1fc483['id'])});}})[_0x71c8('0x52')](function(_0x9fa60f){logger[_0x71c8('0x4b')](_0x71c8('0x4f'),JSON[_0x71c8('0x4c')](_0x9fa60f));});};exports[_0x71c8('0x53')]=function(_0x35c04d,_0x4593c5,_0xfa438a,_0x16da0e,_0x500e5e,_0x783c15){var _0x136e3f,_0x19523d;_0x783c15[_0x71c8('0x1a')]=intUtil[_0x71c8('0x3e')](_0x783c15[_0x71c8('0x1a')]);_0x783c15[_0x71c8('0x3f')]=intUtil[_0x71c8('0x3e')](_0x783c15[_0x71c8('0x3f')]);if(_0x500e5e&&_0x500e5e['monitor_format']){logger[_0x71c8('0xb')]('['+_0x4593c5[_0x71c8('0x54')]['toUpperCase']()+']',_0x71c8('0x42'));_0x4593c5['recordingURL']=util[_0x71c8('0xc')](_0x71c8('0x44'),_0x783c15[_0x71c8('0x3f')],_0x4593c5[_0x71c8('0x45')],md5(_0x4593c5[_0x71c8('0x45')]));}else{_0x4593c5['recordingURL']='';}headers[_0x71c8('0x46')]=getAuth(_0x783c15);return getUser(_0x783c15,'')[_0x71c8('0x1b')](function(_0x17cdd1){_0x136e3f=_0x17cdd1;logger[_0x71c8('0xb')](_0x71c8('0x47'),_0x136e3f['id']);return getEndUser(_0x783c15,_0x4593c5['calleridname'],_0x4593c5[_0x71c8('0xf')]);})[_0x71c8('0x1b')](function(_0x37fa1f){_0x19523d=_0x37fa1f;logger[_0x71c8('0xb')](_0x71c8('0x48'),_0x19523d['id']);return getTicket(_0x783c15,_0x136e3f,_0x19523d,_0xfa438a,_0x4593c5);})[_0x71c8('0x1b')](function(_0x3b0cca){if(_0x3b0cca){logger['info'](_0x71c8('0x1c'));logger[_0x71c8('0xb')](_0x71c8('0x55'),_0x3b0cca['id']);}})['catch'](function(_0x488c33){logger[_0x71c8('0x4b')]('['+_0x4593c5[_0x71c8('0x54')]['toUpperCase']()+']',JSON[_0x71c8('0x4c')](_0x488c33));});}; \ 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 84e787f..8b28f5e 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 _0x0d2b=['lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','email','User\x20found:','Admin\x20selected','userId','toUpperCase','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect'];(function(_0x2fae0e,_0x45dfbf){var _0x14c255=function(_0x582382){while(--_0x582382){_0x2fae0e['push'](_0x2fae0e['shift']());}};_0x14c255(++_0x45dfbf);}(_0x0d2b,0x1b3));var _0xb0d2=function(_0x1ac33a,_0x52f6f8){_0x1ac33a=_0x1ac33a-0x0;var _0x3b6b87=_0x0d2b[_0x1ac33a];return _0x3b6b87;};'use strict';var _=require(_0xb0d2('0x0'));var rp=require(_0xb0d2('0x1'));var md5=require(_0xb0d2('0x2'));var util=require(_0xb0d2('0x3'));var moment=require(_0xb0d2('0x4'));var Promise=require('bluebird');var Redis=require(_0xb0d2('0x5'));var intUtil=require(_0xb0d2('0x6'));var config=require(_0xb0d2('0x7'));var logger=require(_0xb0d2('0x8'))(_0xb0d2('0x9'));config[_0xb0d2('0xa')]=_[_0xb0d2('0xb')](config[_0xb0d2('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb0d2('0xa')]));function getAdminId(_0x5ec330,_0x45b1a9,_0x43c0ea,_0x5608e4){return new Promise(function(_0x2d125a,_0x3aaf38){var _0x4086e9=![];var _0x5eba08={'method':_0xb0d2('0xc'),'uri':_0x5608e4+_0xb0d2('0xd'),'json':!![]};_0x5eba08[_0xb0d2('0xe')]=_0x43c0ea;logger[_0xb0d2('0xf')](_0xb0d2('0x10'));return rp(_0x5eba08)[_0xb0d2('0x11')](function(_0x2dd113){if(_0x2dd113){var _0x54f5bd=_0x2dd113[_0xb0d2('0x12')];var _0x97d9a0=null;for(_0x97d9a0=0x0;_0x97d9a0<_0x54f5bd['length'];_0x97d9a0++){if(_0x54f5bd[_0x97d9a0]['email']===_0x5ec330[_0xb0d2('0x13')]){_0x5ec330[_0xb0d2('0x14')]=_0x54f5bd[_0x97d9a0]['id'];_0x4086e9=!![];}}if(_0x4086e9){logger[_0xb0d2('0xf')](_0xb0d2('0x15'),_0x5ec330[_0xb0d2('0x14')]);_0x2d125a(_0x5ec330);}else{_0x3aaf38({'statusCode':0x194,'message':_0xb0d2('0x16')});}}else{_0x3aaf38({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb0d2('0x17')](function(_0x10f502){logger[_0xb0d2('0x18')]('['+[_0x45b1a9['toUpperCase']()]+']',_0x10f502[_0xb0d2('0x19')]);_0x3aaf38(_0x10f502);});});}function getUser(_0x59aecc,_0x247f55,_0x3e1b1d){return function(_0xff4a7d){return new Promise(function(_0x53f95a,_0x4dc077){var _0x547e5f={'method':_0xb0d2('0xc'),'uri':_0x3e1b1d+_0xb0d2('0xd'),'json':!![]};_0x547e5f[_0xb0d2('0xe')]=_0x247f55;logger['info'](_0xb0d2('0x1a'));return rp(_0x547e5f)['then'](function(_0x503b47){if(_0x503b47){var _0x54eed1=_0x503b47['users'];var _0x3f56fc=![];var _0x15ad2f=null;if(_0xff4a7d[_0xb0d2('0x1b')]!==null){logger[_0xb0d2('0xf')](_0xb0d2('0x1c'),_0xff4a7d[_0xb0d2('0x1b')]);_0xff4a7d['userEmail']=_0xff4a7d[_0xb0d2('0x1b')];for(_0x15ad2f=0x0;_0x15ad2f<_0x54eed1[_0xb0d2('0x1d')];_0x15ad2f++){if(_0x54eed1[_0x15ad2f][_0xb0d2('0x1e')]===_0xff4a7d[_0xb0d2('0x1b')]){_0x3f56fc=!![];_0xff4a7d['userId']=_0x54eed1[_0x15ad2f]['id'];logger[_0xb0d2('0xf')](_0xb0d2('0x1f'),_0xff4a7d['userId']);}}}if(!_0x3f56fc){logger[_0xb0d2('0xf')](_0xb0d2('0x20'));_0xff4a7d['userEmail']=_0xff4a7d[_0xb0d2('0x13')];_0xff4a7d[_0xb0d2('0x21')]=_0xff4a7d[_0xb0d2('0x14')];_0x3f56fc=!![];}if(_0x3f56fc){_0x53f95a(_0xff4a7d);}else{_0x4dc077({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4dc077({'statusCode':0x194,'message':_0xb0d2('0x16')});}})['catch'](function(_0x145d73){logger[_0xb0d2('0x18')]('['+[_0x59aecc[_0xb0d2('0x22')]()]+']',_0x145d73['message']);_0x4dc077(_0x145d73);});});};}function searchContact(_0x2bb8c8,_0x1fcb9f,_0x164a60,_0x5cbfd6){return new Promise(function(_0x179f5c,_0xb402c3){var _0x24f3c8={'method':_0xb0d2('0xc'),'headers':_0x1fcb9f,'uri':_0x2bb8c8+'/api/lookup?q='+_0x5cbfd6+_0xb0d2('0x23')+_0x164a60+_0xb0d2('0x24'),'json':!![]};rp(_0x24f3c8)[_0xb0d2('0x11')](function(_0x55de45){var _0x3ea38c=_[_0xb0d2('0x25')](_0x55de45[_0xb0d2('0x26')][_0xb0d2('0x26')],[_0x164a60,_0x5cbfd6]);_0x179f5c(_0x3ea38c);})['catch'](function(_0x17bffd){_0xb402c3(_0x17bffd);});});}function getEndUser(_0x50b41a,_0x20a103,_0x285fcd){return function(_0x3ea8f8){return new Promise(function(_0x5e3842,_0x2f45c9){logger[_0xb0d2('0xf')](util[_0xb0d2('0x27')](_0xb0d2('0x28'),_0x3ea8f8[_0xb0d2('0x29')]));searchContact(_0x285fcd,_0x20a103,_0xb0d2('0x2a'),_0x3ea8f8[_0xb0d2('0x29')])[_0xb0d2('0x11')](function(_0x429d0d){if(_0x429d0d){_0x3ea8f8['endUserId']=_0x429d0d['id'];logger[_0xb0d2('0xf')](_0xb0d2('0x2b'),_0x3ea8f8[_0xb0d2('0x2c')]);return _0x5e3842(_0x3ea8f8);}searchContact(_0x285fcd,_0x20a103,_0xb0d2('0x2d'),_0x3ea8f8[_0xb0d2('0x29')])[_0xb0d2('0x11')](function(_0x2cb691){if(_0x2cb691){_0x3ea8f8[_0xb0d2('0x2c')]=_0x2cb691['id'];logger[_0xb0d2('0xf')](_0xb0d2('0x2e'),_0x3ea8f8['endUserId']);return _0x5e3842(_0x3ea8f8);}createEndUser(_0x3ea8f8,_0x50b41a,_0x20a103,_0x285fcd)['then'](function(_0x48ce53){logger[_0xb0d2('0xf')](_0xb0d2('0x2f'),_0x48ce53[_0xb0d2('0x2c')]);return _0x5e3842(_0x48ce53);});});})['catch'](function(_0x4a4a02){_0x2f45c9(_0x4a4a02);});});};}function createEndUser(_0x27c3d8,_0x4b651f,_0x25f1a6,_0x1bb1da){return new Promise(function(_0x521962,_0xc7cf3d){var _0x2467b5=moment();var _0x307ec9={'method':_0xb0d2('0x30'),'uri':_0x1bb1da+_0xb0d2('0x31'),'body':{'contact':{'last_name':_0x27c3d8[_0xb0d2('0x29')],'work_number':_0x27c3d8['contactNumber'],'mobile_number':_0x27c3d8['contactNumber'],'owner_id':_0x27c3d8[_0xb0d2('0x21')],'created_at':_0x2467b5[_0xb0d2('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x307ec9[_0xb0d2('0xe')]=_0x25f1a6;logger[_0xb0d2('0xf')](_0xb0d2('0x32'));return rp(_0x307ec9)[_0xb0d2('0x11')](function(_0x3f48f1){_0x27c3d8[_0xb0d2('0x2c')]=_0x3f48f1[_0xb0d2('0x33')]['id'];_0x521962(_0x27c3d8);})[_0xb0d2('0x17')](function(_0x284907){logger['error']('['+[_0x4b651f['toUpperCase']()]+']',_0x284907['message']);_0xc7cf3d(_0x284907[_0xb0d2('0x19')]);});});}function getTicket(_0x5ed0bf,_0x17c573,_0x21755c,_0x3a874d,_0x45ab9e){return function(_0x565b8d){logger[_0xb0d2('0xf')](_0xb0d2('0x34'));return new Promise(function(_0x5147a9,_0x2b6071){var _0x33a604=moment();var _0x9c6b9b={'method':_0xb0d2('0x30'),'uri':_0x21755c+_0xb0d2('0x35'),'body':{'title':intUtil[_0xb0d2('0x36')](_0x3a874d[_0xb0d2('0x37')],_0x45ab9e,'\x20'),'description':intUtil['getString'](_0x3a874d[_0xb0d2('0x38')],_0x45ab9e,'\x0a'),'owner_id':_0x565b8d['userId'],'creater_id':_0x565b8d[_0xb0d2('0x14')],'targetable_id':_0x565b8d['endUserId'],'targetable_type':'Contact','created_at':_0x33a604[_0xb0d2('0x27')](_0xb0d2('0x39')),'due_date':_0x33a604['add'](0x1e,'m')[_0xb0d2('0x27')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x9c6b9b[_0xb0d2('0xe')]=_0x17c573;return rp(_0x9c6b9b)[_0xb0d2('0x11')](function(_0x39414e){_0x565b8d[_0xb0d2('0x3a')]=_0x39414e[_0xb0d2('0x3b')]['id'];logger['info'](_0xb0d2('0x3c'),_0x565b8d['ticketId']);_0x5147a9(_0x565b8d);})[_0xb0d2('0x17')](function(_0x349e30){logger['error']('['+[_0x5ed0bf['toUpperCase']()]+']',_0x349e30[_0xb0d2('0x19')]);_0x2b6071(_0x349e30['message']);});});};}function emit(_0x4082c3,_0x46d179,_0x29ce01){var _0x355d38={'uri':_0x4082c3+_0xb0d2('0x3d')+_0x29ce01};io['to'](util[_0xb0d2('0x27')](_0xb0d2('0x3e'),_0x46d179))[_0xb0d2('0x3f')](_0xb0d2('0x40'),_0x355d38);}exports['cs']=function(_0x1a74bd,_0x2e69f1,_0x5169cd,_0x29fd9b,_0x1496d2,_0x46a03d,_0x46cef6,_0x53fb09){var _0x8f0205={};var _0x31bc3f={'Authorization':'Token\x20token='+_0x46a03d[_0xb0d2('0x41')]};_0x46a03d[_0xb0d2('0x42')]=intUtil[_0xb0d2('0x43')](_0x46a03d[_0xb0d2('0x42')]);_0x46a03d['serverUrl']=intUtil['stripTrailingSlash'](_0x46a03d[_0xb0d2('0x44')]);var _0x31271c=_0x46a03d['remoteUri'];_0x8f0205[_0xb0d2('0x13')]=_0x46a03d[_0xb0d2('0x45')];_0x8f0205[_0xb0d2('0x29')]=_0x53fb09[_0xb0d2('0x46')]()===_0xb0d2('0x47')?_0x2e69f1[_0xb0d2('0x48')]:_0x2e69f1['calleridnum'];_0x8f0205[_0xb0d2('0x49')]=_0x53fb09===_0xb0d2('0x4a')||_0x53fb09===_0xb0d2('0x4b')?'queue':_0xb0d2('0x47');if(_0x29fd9b){_0x8f0205['agentEmail']=_0x29fd9b[_0xb0d2('0x1e')];}var _0x208842=util[_0xb0d2('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46a03d[_0xb0d2('0x44')],_0x2e69f1[_0xb0d2('0x4c')],md5(_0x2e69f1[_0xb0d2('0x4c')]));if(_0x1496d2&&_0x1496d2[_0xb0d2('0x4d')]){logger[_0xb0d2('0xf')](_0xb0d2('0x4e'),_0xb0d2('0x4f'));_0x2e69f1[_0xb0d2('0x50')]=_0x208842;}else if(_0x46cef6&&_0x46cef6[_0xb0d2('0x51')]&&_0x46cef6[_0xb0d2('0x51')]!=='none'){logger[_0xb0d2('0xf')](_0xb0d2('0x52'),_0xb0d2('0x4f'));_0x2e69f1[_0xb0d2('0x50')]=_0x208842;}else{_0x2e69f1[_0xb0d2('0x50')]='';}return getAdminId(_0x8f0205,_0x53fb09,_0x31bc3f,_0x31271c)['then'](getUser(_0x53fb09,_0x31bc3f,_0x31271c))[_0xb0d2('0x11')](getEndUser(_0x53fb09,_0x31bc3f,_0x31271c))[_0xb0d2('0x11')](getTicket(_0x53fb09,_0x31bc3f,_0x31271c,_0x5169cd,_0x2e69f1))[_0xb0d2('0x11')](function(_0x24809c){logger[_0xb0d2('0xf')](util['format'](_0xb0d2('0x53'),_0x24809c[_0xb0d2('0x3a')]));if(_0x53fb09!=='unmanaged'){logger[_0xb0d2('0xf')]('['+[_0x53fb09[_0xb0d2('0x22')]()]+']',_0xb0d2('0x54'));emit(_0x31271c,_0x29fd9b[_0xb0d2('0x55')],_0x24809c[_0xb0d2('0x2c')]);}})['catch'](function(_0x2b38c7){logger[_0xb0d2('0x18')]('['+[_0x53fb09[_0xb0d2('0x22')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xb0d2('0x56')](_0x2b38c7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xef49=['YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','Descriptions','Contact','add','Task\x20created:','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','toUpperCase','message','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST'];(function(_0x219e3d,_0x23df64){var _0x162306=function(_0x68991){while(--_0x68991){_0x219e3d['push'](_0x219e3d['shift']());}};_0x162306(++_0x23df64);}(_0xef49,0x115));var _0x9ef4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xef49[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x9ef4('0x0'));var rp=require('request-promise');var md5=require(_0x9ef4('0x1'));var util=require(_0x9ef4('0x2'));var moment=require(_0x9ef4('0x3'));var Promise=require(_0x9ef4('0x4'));var Redis=require(_0x9ef4('0x5'));var intUtil=require('./util');var config=require(_0x9ef4('0x6'));var logger=require(_0x9ef4('0x7'))(_0x9ef4('0x8'));config[_0x9ef4('0x9')]=_['defaults'](config['redis'],{'host':_0x9ef4('0xa'),'port':0x18eb});var io=require(_0x9ef4('0xb'))(new Redis(config['redis']));function getAdminId(_0x2dbe62,_0x562d86,_0xbc1046,_0x352715){return new Promise(function(_0x4abc2d,_0x32a8a4){var _0x76ede0=![];var _0x43797a={'method':_0x9ef4('0xc'),'uri':_0x352715+_0x9ef4('0xd'),'json':!![]};_0x43797a['headers']=_0xbc1046;logger[_0x9ef4('0xe')](_0x9ef4('0xf'));return rp(_0x43797a)[_0x9ef4('0x10')](function(_0x55be32){if(_0x55be32){var _0x946b7d=_0x55be32['users'];var _0x50b01e=null;for(_0x50b01e=0x0;_0x50b01e<_0x946b7d[_0x9ef4('0x11')];_0x50b01e++){if(_0x946b7d[_0x50b01e][_0x9ef4('0x12')]===_0x2dbe62[_0x9ef4('0x13')]){_0x2dbe62[_0x9ef4('0x14')]=_0x946b7d[_0x50b01e]['id'];_0x76ede0=!![];}}if(_0x76ede0){logger[_0x9ef4('0xe')](_0x9ef4('0x15'),_0x2dbe62[_0x9ef4('0x14')]);_0x4abc2d(_0x2dbe62);}else{_0x32a8a4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x32a8a4({'statusCode':0x194,'message':_0x9ef4('0x16')});}})[_0x9ef4('0x17')](function(_0x2b317e){logger[_0x9ef4('0x18')]('['+[_0x562d86['toUpperCase']()]+']',_0x2b317e['message']);_0x32a8a4(_0x2b317e);});});}function getUser(_0x42f749,_0x32ca71,_0x5d7aaa){return function(_0x102bdd){return new Promise(function(_0x3e9d82,_0x12046a){var _0x24547a={'method':_0x9ef4('0xc'),'uri':_0x5d7aaa+_0x9ef4('0xd'),'json':!![]};_0x24547a[_0x9ef4('0x19')]=_0x32ca71;logger[_0x9ef4('0xe')](_0x9ef4('0x1a'));return rp(_0x24547a)[_0x9ef4('0x10')](function(_0x1ab7bf){if(_0x1ab7bf){var _0x3ab749=_0x1ab7bf[_0x9ef4('0x1b')];var _0x170bc6=![];var _0x5cd7e1=null;if(_0x102bdd[_0x9ef4('0x1c')]!==null){logger[_0x9ef4('0xe')](_0x9ef4('0x1d'),_0x102bdd[_0x9ef4('0x1c')]);_0x102bdd[_0x9ef4('0x1e')]=_0x102bdd[_0x9ef4('0x1c')];for(_0x5cd7e1=0x0;_0x5cd7e1<_0x3ab749[_0x9ef4('0x11')];_0x5cd7e1++){if(_0x3ab749[_0x5cd7e1]['email']===_0x102bdd[_0x9ef4('0x1c')]){_0x170bc6=!![];_0x102bdd['userId']=_0x3ab749[_0x5cd7e1]['id'];logger[_0x9ef4('0xe')]('User\x20found:',_0x102bdd[_0x9ef4('0x1f')]);}}}if(!_0x170bc6){logger['info']('Admin\x20selected');_0x102bdd[_0x9ef4('0x1e')]=_0x102bdd[_0x9ef4('0x13')];_0x102bdd[_0x9ef4('0x1f')]=_0x102bdd[_0x9ef4('0x14')];_0x170bc6=!![];}if(_0x170bc6){_0x3e9d82(_0x102bdd);}else{_0x12046a({'statusCode':0x194,'message':_0x9ef4('0x16')});}}else{_0x12046a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9ef4('0x17')](function(_0x449946){logger[_0x9ef4('0x18')]('['+[_0x42f749[_0x9ef4('0x20')]()]+']',_0x449946[_0x9ef4('0x21')]);_0x12046a(_0x449946);});});};}function searchContact(_0x4dc700,_0x4df2b9,_0x3764c5,_0x5e0cec){return new Promise(function(_0x473494,_0x95c46e){var _0x508948={'method':'GET','headers':_0x4df2b9,'uri':_0x4dc700+_0x9ef4('0x22')+_0x5e0cec+_0x9ef4('0x23')+_0x3764c5+'&entities=contact','json':!![]};rp(_0x508948)['then'](function(_0x3e9b23){var _0x18c7b2=_[_0x9ef4('0x24')](_0x3e9b23[_0x9ef4('0x25')][_0x9ef4('0x25')],[_0x3764c5,_0x5e0cec]);_0x473494(_0x18c7b2);})[_0x9ef4('0x17')](function(_0x464ba7){_0x95c46e(_0x464ba7);});});}function getEndUser(_0x904ba7,_0x514228,_0x38d524){return function(_0x445765){return new Promise(function(_0x11b66d,_0x521255){logger[_0x9ef4('0xe')](util[_0x9ef4('0x26')](_0x9ef4('0x27'),_0x445765[_0x9ef4('0x28')]));searchContact(_0x38d524,_0x514228,_0x9ef4('0x29'),_0x445765[_0x9ef4('0x28')])[_0x9ef4('0x10')](function(_0xcb2a95){if(_0xcb2a95){_0x445765['endUserId']=_0xcb2a95['id'];logger[_0x9ef4('0xe')](_0x9ef4('0x2a'),_0x445765[_0x9ef4('0x2b')]);return _0x11b66d(_0x445765);}searchContact(_0x38d524,_0x514228,_0x9ef4('0x2c'),_0x445765[_0x9ef4('0x28')])[_0x9ef4('0x10')](function(_0x567c03){if(_0x567c03){_0x445765[_0x9ef4('0x2b')]=_0x567c03['id'];logger['info'](_0x9ef4('0x2d'),_0x445765[_0x9ef4('0x2b')]);return _0x11b66d(_0x445765);}createEndUser(_0x445765,_0x904ba7,_0x514228,_0x38d524)[_0x9ef4('0x10')](function(_0xa8a396){logger[_0x9ef4('0xe')]('Contact\x20created:',_0xa8a396[_0x9ef4('0x2b')]);return _0x11b66d(_0xa8a396);});});})[_0x9ef4('0x17')](function(_0x1f6985){_0x521255(_0x1f6985);});});};}function createEndUser(_0x2f0a79,_0x3ec4ba,_0x567550,_0x2401da){return new Promise(function(_0x25775e,_0x3e89b8){var _0x44774b=moment();var _0x11ac0b={'method':_0x9ef4('0x2e'),'uri':_0x2401da+'/api/contacts','body':{'contact':{'last_name':_0x2f0a79[_0x9ef4('0x28')],'work_number':_0x2f0a79[_0x9ef4('0x28')],'mobile_number':_0x2f0a79[_0x9ef4('0x28')],'owner_id':_0x2f0a79[_0x9ef4('0x1f')],'created_at':_0x44774b[_0x9ef4('0x26')](_0x9ef4('0x2f'))}},'json':!![]};_0x11ac0b[_0x9ef4('0x19')]=_0x567550;logger[_0x9ef4('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x11ac0b)[_0x9ef4('0x10')](function(_0x2e35ea){_0x2f0a79[_0x9ef4('0x2b')]=_0x2e35ea[_0x9ef4('0x30')]['id'];_0x25775e(_0x2f0a79);})[_0x9ef4('0x17')](function(_0x2b10d5){logger[_0x9ef4('0x18')]('['+[_0x3ec4ba[_0x9ef4('0x20')]()]+']',_0x2b10d5[_0x9ef4('0x21')]);_0x3e89b8(_0x2b10d5[_0x9ef4('0x21')]);});});}function getTicket(_0x48b2df,_0x3cad89,_0x315a47,_0x412b8b,_0x166dc4){return function(_0x436009){logger[_0x9ef4('0xe')](_0x9ef4('0x31'));return new Promise(function(_0x262963,_0x26e448){var _0x15d1ed=moment();var _0x55aeeb={'method':_0x9ef4('0x2e'),'uri':_0x315a47+_0x9ef4('0x32'),'body':{'title':intUtil['getString'](_0x412b8b['Subjects'],_0x166dc4,'\x20'),'description':intUtil['getString'](_0x412b8b[_0x9ef4('0x33')],_0x166dc4,'\x0a'),'owner_id':_0x436009[_0x9ef4('0x1f')],'creater_id':_0x436009[_0x9ef4('0x14')],'targetable_id':_0x436009['endUserId'],'targetable_type':_0x9ef4('0x34'),'created_at':_0x15d1ed[_0x9ef4('0x26')](_0x9ef4('0x2f')),'due_date':_0x15d1ed[_0x9ef4('0x35')](0x1e,'m')[_0x9ef4('0x26')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x55aeeb[_0x9ef4('0x19')]=_0x3cad89;return rp(_0x55aeeb)[_0x9ef4('0x10')](function(_0x6e9d8){_0x436009['ticketId']=_0x6e9d8['task']['id'];logger[_0x9ef4('0xe')](_0x9ef4('0x36'),_0x436009['ticketId']);_0x262963(_0x436009);})[_0x9ef4('0x17')](function(_0x43111d){logger[_0x9ef4('0x18')]('['+[_0x48b2df['toUpperCase']()]+']',_0x43111d[_0x9ef4('0x21')]);_0x26e448(_0x43111d[_0x9ef4('0x21')]);});});};}function emit(_0x5940b9,_0x1bd45a,_0x3c72de){var _0xbc0e6e={'uri':_0x5940b9+_0x9ef4('0x37')+_0x3c72de};io['to'](util[_0x9ef4('0x26')]('user:%s',_0x1bd45a))['emit'](_0x9ef4('0x38'),_0xbc0e6e);}exports['cs']=function(_0x35bbee,_0x5552e7,_0x3efac0,_0x403f8e,_0x1532e6,_0x236028,_0x3a7e07,_0x4d1578){var _0x3123d4={};var _0x575349={'Authorization':_0x9ef4('0x39')+_0x236028[_0x9ef4('0x3a')]};_0x236028[_0x9ef4('0x3b')]=intUtil['stripTrailingSlash'](_0x236028[_0x9ef4('0x3b')]);_0x236028[_0x9ef4('0x3c')]=intUtil['stripTrailingSlash'](_0x236028[_0x9ef4('0x3c')]);var _0x4de554=_0x236028[_0x9ef4('0x3b')];_0x3123d4['adminEmail']=_0x236028[_0x9ef4('0x3d')];_0x3123d4['contactNumber']=_0x4d1578[_0x9ef4('0x3e')]()===_0x9ef4('0x3f')?_0x5552e7[_0x9ef4('0x40')]:_0x5552e7[_0x9ef4('0x41')];_0x3123d4[_0x9ef4('0x42')]=_0x4d1578===_0x9ef4('0x43')||_0x4d1578==='unmanaged'?_0x9ef4('0x43'):'outbound';if(_0x403f8e){_0x3123d4['agentEmail']=_0x403f8e[_0x9ef4('0x12')];}var _0x51479a=util[_0x9ef4('0x26')](_0x9ef4('0x44'),_0x236028[_0x9ef4('0x3c')],_0x5552e7['uniqueid'],md5(_0x5552e7[_0x9ef4('0x45')]));if(_0x1532e6&&_0x1532e6[_0x9ef4('0x46')]){logger[_0x9ef4('0xe')](_0x9ef4('0x47'),_0x9ef4('0x48'));_0x5552e7[_0x9ef4('0x49')]=_0x51479a;}else if(_0x3a7e07&&_0x3a7e07[_0x9ef4('0x4a')]&&_0x3a7e07[_0x9ef4('0x4a')]!==_0x9ef4('0x4b')){logger[_0x9ef4('0xe')](_0x9ef4('0x4c'),_0x9ef4('0x48'));_0x5552e7[_0x9ef4('0x49')]=_0x51479a;}else{_0x5552e7[_0x9ef4('0x49')]='';}return getAdminId(_0x3123d4,_0x4d1578,_0x575349,_0x4de554)[_0x9ef4('0x10')](getUser(_0x4d1578,_0x575349,_0x4de554))[_0x9ef4('0x10')](getEndUser(_0x4d1578,_0x575349,_0x4de554))[_0x9ef4('0x10')](getTicket(_0x4d1578,_0x575349,_0x4de554,_0x3efac0,_0x5552e7))[_0x9ef4('0x10')](function(_0x3f59bd){logger['info'](util[_0x9ef4('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3f59bd['ticketId']));if(_0x4d1578!==_0x9ef4('0x4d')){logger[_0x9ef4('0xe')]('['+[_0x4d1578[_0x9ef4('0x20')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4de554,_0x403f8e[_0x9ef4('0x4e')],_0x3f59bd[_0x9ef4('0x2b')]);}})[_0x9ef4('0x17')](function(_0xadd8d5){logger[_0x9ef4('0x18')]('['+[_0x4d1578['toUpperCase']()]+_0x9ef4('0x4f'),util[_0x9ef4('0x50')](_0xadd8d5,{'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 bfc8bdd..93b2328 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 _0x710f=['error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','exec','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','freshdesk','servicenow','../../../../config/logger'];(function(_0x27fe3d,_0x23625b){var _0x4d629b=function(_0x2280c2){while(--_0x2280c2){_0x27fe3d['push'](_0x27fe3d['shift']());}};_0x4d629b(++_0x23625b);}(_0x710f,0x91));var _0xf710=function(_0x36cb67,_0x489ffe){_0x36cb67=_0x36cb67-0x0;var _0x4ab524=_0x710f[_0x36cb67];return _0x4ab524;};'use strict';var _=require(_0xf710('0x0'));var util=require(_0xf710('0x1'));var zendesk=require(_0xf710('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xf710('0x3'));var freshdesk=require(_0xf710('0x4'));var zoho=require('./zoho');var desk=require(_0xf710('0x5'));var vtiger=require(_0xf710('0x6'));var servicenow=require(_0xf710('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf710('0x8'));var integrations=[_0xf710('0x9'),_0xf710('0xa'),_0xf710('0xb'),'freshdesk','zoho',_0xf710('0xc'),_0xf710('0xd'),_0xf710('0xe'),_0xf710('0xf'),'servicenow'];exports[_0xf710('0x10')]=function(_0x5a0a1a,_0x5d6e58,_0x1c26bb,_0x43fd39,_0x203b2a,_0x207acd){if(_0x1c26bb){if(_['includes'](integrations,_0x5a0a1a[_0xf710('0x11')]['toLowerCase']())){try{var _0x2b86e6=null;var _0x1974b8='';var _0x46d538=_0x1c26bb[_0x5a0a1a['data1'][_0xf710('0x12')]()];if(_0x46d538){var _0x51f28d=_0x46d538[_0x5a0a1a['data2']];if(_0x51f28d){var _0x3896ce=_[_0xf710('0x13')](_0x51f28d[_0xf710('0x14')],{'id':parseInt(_0x5a0a1a[_0xf710('0x15')],0xa)});if(_0x3896ce){if(_0x43fd39){if(_0x203b2a&&_0x5d6e58[_0xf710('0x16')]){_0x1974b8=_0xf710('0x16');}else if(_0x5d6e58[_0xf710('0x17')]){_0x1974b8=_0xf710('0x18');}else{console[_0xf710('0x19')]('EVENT\x20UNKNOWN',_0x5d6e58);}}else{_0x1974b8=_0xf710('0x1a');}switch(_0x5a0a1a[_0xf710('0x11')][_0xf710('0x12')]()){case _0xf710('0x9'):zendesk[_0x1974b8](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd);break;case _0xf710('0xa'):salesforce[_0x1974b8](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd);break;case _0xf710('0xb'):sugarcrm[_0x1974b8](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd);break;case _0xf710('0x1b'):freshdesk[_0x1974b8](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd);break;case'zoho':zoho[_0x1974b8](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd);break;case _0xf710('0xc'):desk[_0x1974b8](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd);break;case _0xf710('0xd'):vtiger[_0x1974b8](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd);break;case'freshsales':freshsales['cs'](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd,_0x1974b8);break;case _0xf710('0x1c'):servicenow['cs'](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd,_0x1974b8);break;case _0xf710('0xe'):dynamics365['cs'](_0x5a0a1a,_0x5d6e58,_0x3896ce,_0x43fd39,_0x203b2a,_0x51f28d,_0x207acd,_0x1974b8);break;default:console[_0xf710('0x19')]('unknown\x20integration');}}else{_0x2b86e6=require(_0xf710('0x1d'))(_0x5a0a1a[_0xf710('0x11')][_0xf710('0x12')]());_0x2b86e6[_0xf710('0x1e')](_0xf710('0x1f'),util[_0xf710('0x20')](_0xf710('0x21'),_0x5a0a1a[_0xf710('0x11')][_0xf710('0x12')](),_0x5a0a1a[_0xf710('0x15')]));}}else{_0x2b86e6=require('../../../../config/logger')(_0x5a0a1a[_0xf710('0x11')][_0xf710('0x12')]());_0x2b86e6[_0xf710('0x1e')](_0xf710('0x1f'),util[_0xf710('0x20')](_0xf710('0x22'),_0x5a0a1a[_0xf710('0x11')][_0xf710('0x12')](),_0x5a0a1a['data2']));}}else{}}catch(_0x44897b){console[_0xf710('0x1e')](_0x44897b);}}}}; \ No newline at end of file +var _0x8546=['desk','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','queue','routeId','outbound','log','unmanaged','vtiger','unknown\x20integration','../../../../config/logger','error','format','data3','[EXEC]','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho'];(function(_0x451191,_0x919a5){var _0xc4e815=function(_0x18fc47){while(--_0x18fc47){_0x451191['push'](_0x451191['shift']());}};_0xc4e815(++_0x919a5);}(_0x8546,0x125));var _0x6854=function(_0xb5a6de,_0x37f3cf){_0xb5a6de=_0xb5a6de-0x0;var _0x44fd5b=_0x8546[_0xb5a6de];return _0x44fd5b;};'use strict';var _=require(_0x6854('0x0'));var util=require(_0x6854('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x6854('0x2'));var sugarcrm=require(_0x6854('0x3'));var freshdesk=require(_0x6854('0x4'));var zoho=require(_0x6854('0x5'));var desk=require('./desk');var vtiger=require(_0x6854('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x6854('0x7'));var integrations=[_0x6854('0x8'),_0x6854('0x9'),_0x6854('0xa'),_0x6854('0xb'),_0x6854('0xc'),_0x6854('0xd'),'vtiger',_0x6854('0xe'),_0x6854('0xf'),_0x6854('0x10')];exports[_0x6854('0x11')]=function(_0x32fd60,_0x32049c,_0x2c63ae,_0x1b755c,_0x544af8,_0xa1b9d5){if(_0x2c63ae){if(_['includes'](integrations,_0x32fd60[_0x6854('0x12')][_0x6854('0x13')]())){try{var _0x59eb25=null;var _0x3ffcf9='';var _0x39d2d4=_0x2c63ae[_0x32fd60[_0x6854('0x12')]['toLowerCase']()];if(_0x39d2d4){var _0x5f4a1a=_0x39d2d4[_0x32fd60[_0x6854('0x14')]];if(_0x5f4a1a){var _0x2546f4=_[_0x6854('0x15')](_0x5f4a1a['Configurations'],{'id':parseInt(_0x32fd60['data3'],0xa)});if(_0x2546f4){if(_0x1b755c){if(_0x544af8&&_0x32049c[_0x6854('0x16')]){_0x3ffcf9=_0x6854('0x16');}else if(_0x32049c[_0x6854('0x17')]){_0x3ffcf9=_0x6854('0x18');}else{console[_0x6854('0x19')]('EVENT\x20UNKNOWN',_0x32049c);}}else{_0x3ffcf9=_0x6854('0x1a');}switch(_0x32fd60[_0x6854('0x12')]['toLowerCase']()){case _0x6854('0x8'):zendesk[_0x3ffcf9](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5);break;case _0x6854('0x9'):salesforce[_0x3ffcf9](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5);break;case'sugarcrm':sugarcrm[_0x3ffcf9](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5);break;case _0x6854('0xb'):freshdesk[_0x3ffcf9](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5);break;case'zoho':zoho[_0x3ffcf9](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5);break;case _0x6854('0xd'):desk[_0x3ffcf9](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5);break;case _0x6854('0x1b'):vtiger[_0x3ffcf9](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5);break;case _0x6854('0xf'):freshsales['cs'](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5,_0x3ffcf9);break;case'servicenow':servicenow['cs'](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5,_0x3ffcf9);break;case _0x6854('0xe'):dynamics365['cs'](_0x32fd60,_0x32049c,_0x2546f4,_0x1b755c,_0x544af8,_0x5f4a1a,_0xa1b9d5,_0x3ffcf9);break;default:console[_0x6854('0x19')](_0x6854('0x1c'));}}else{_0x59eb25=require(_0x6854('0x1d'))(_0x32fd60[_0x6854('0x12')][_0x6854('0x13')]());_0x59eb25[_0x6854('0x1e')]('[EXEC]',util[_0x6854('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x32fd60[_0x6854('0x12')]['toLowerCase'](),_0x32fd60[_0x6854('0x20')]));}}else{_0x59eb25=require(_0x6854('0x1d'))(_0x32fd60['data1']['toLowerCase']());_0x59eb25['error'](_0x6854('0x21'),util[_0x6854('0x1f')]('%s\x20account\x20#%s\x20not\x20found',_0x32fd60['data1'][_0x6854('0x13')](),_0x32fd60[_0x6854('0x14')]));}}else{}}catch(_0x4b5c36){console[_0x6854('0x1e')](_0x4b5c36);}}}}; \ 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 f5e63fa..fedc785 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 _0x38c1=['Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','first','Name','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','LastName','','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','toString','variableName','idField','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','%s/%s/e','instanceUrl','error','outbound','stripTrailingSlash','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','../../../../config/logger','redis','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Email','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','resolve','user_id'];(function(_0x147062,_0x2e9622){var _0xb1ea97=function(_0x366530){while(--_0x366530){_0x147062['push'](_0x147062['shift']());}};_0xb1ea97(++_0x2e9622);}(_0x38c1,0x148));var _0x138c=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x38c1[_0x56756b];return _0xa3002;};'use strict';var _=require(_0x138c('0x0'));var rp=require(_0x138c('0x1'));var moment=require(_0x138c('0x2'));var BPromise=require(_0x138c('0x3'));var md5=require(_0x138c('0x4'));var jsforce=require(_0x138c('0x5'));var util=require(_0x138c('0x6'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x138c('0x7'))('salesforce');config[_0x138c('0x8')]=_['defaults'](config[_0x138c('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x138c('0x8')]));function emit(_0x2a10bc,_0x41f80a,_0x30121e){io['to'](_0x2a10bc)[_0x138c('0x9')](_0x41f80a,_0x30121e);}function getTicket(_0x5c22b2,_0x140bb5,_0x524577,_0x56bb15,_0x57c3ce,_0x5825c3,_0x4b8397,_0x20c2dd){var _0x178e67=Object[_0x138c('0xa')]({},{'OwnerId':_0x140bb5['id'],'Subject':intUtil[_0x138c('0xb')](_0x56bb15[_0x138c('0xc')],_0x57c3ce,'\x20'),'Description':intUtil[_0x138c('0xb')](_0x56bb15[_0x138c('0xd')],_0x57c3ce,'\x0a')},getCustomFields(_0x5825c3,_0x57c3ce));if(_0x524577){if(_0x56bb15['ticketType']===_0x138c('0xe')){_0x178e67[_0x138c('0xf')]=moment[_0x138c('0x10')]();_0x178e67[_0x138c('0x11')]=![];_0x178e67[_0x138c('0x12')]=![];if(_0x524577[_0x138c('0x13')]===_0x138c('0x14')||_0x524577[_0x138c('0x13')]===_0x138c('0x15')){_0x178e67[_0x138c('0x16')]=_0x524577['id'];}else if(_0x524577['endUserType']===_0x138c('0x17')){_0x178e67[_0x138c('0x18')]=_0x524577['id'];}}else if(_0x56bb15[_0x138c('0x19')]==='Case'){if(_0x524577[_0x138c('0x13')]==='contact'){_0x178e67[_0x138c('0x1a')]=_0x524577['id'];}else if(_0x524577[_0x138c('0x13')]==='account'){_0x178e67[_0x138c('0x1b')]=_0x524577['id'];}else if(_0x524577[_0x138c('0x13')]===_0x138c('0x15')&&_0x56bb15[_0x138c('0x1c')]){_0x178e67[_0x56bb15[_0x138c('0x1c')]]=_0x524577['id'];}else{logger[_0x138c('0x1d')](_0x138c('0x1e'));}}}return _0x4b8397[_0x138c('0x1f')](_0x56bb15['ticketType'])[_0x138c('0x20')](_0x178e67);}function getUser(_0x3f6d19,_0x1167ea,_0x23c01d){if(!_[_0x138c('0x21')](_0x1167ea)&&intUtil[_0x138c('0x22')](_0x1167ea)){var _0x2fa4a1={'Email':_0x1167ea};var _0x36186c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x23c01d['sobject'](_0x138c('0x23'))['find'](_0x2fa4a1,_0x36186c)[_0x138c('0x24')]()[_0x138c('0x25')](function(_0x20a581){if(_0x20a581[_0x138c('0x26')]){var _0xf031d0=_[_0x138c('0x27')](_0x20a581,function(_0xa34a77){return _0xa34a77[_0x138c('0x28')]===_0x1167ea;});if(_0xf031d0){logger[_0x138c('0x1d')](_0x138c('0x29'),_0x1167ea);return BPromise['resolve']({'id':_0xf031d0['Id'],'name':_0xf031d0['Name']});}}else{logger[_0x138c('0x1d')](_0x138c('0x2a'),_0x1167ea);return _0x23c01d[_0x138c('0x2b')]()[_0x138c('0x25')](function(_0x21250c){return BPromise['resolve']({'id':_0x21250c['user_id'],'name':_0x21250c[_0x138c('0x2c')]});});}});}else{logger[_0x138c('0x1d')](_0x138c('0x2a'),_0x1167ea);return _0x23c01d[_0x138c('0x2b')]()[_0x138c('0x25')](function(_0x25846f){return BPromise[_0x138c('0x2d')]({'id':_0x25846f[_0x138c('0x2e')],'name':_0x25846f[_0x138c('0x2c')]});});}}function getEndUser(_0x390581,_0x2dba21,_0x13a2b4,_0x1083dc,_0x599822){var _0x38b9c7={'$or':{'Phone':_0x1083dc}};var _0x5e863a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x138c('0x25')](function(){logger[_0x138c('0x1d')](_0x138c('0x2f'),_0x1083dc,_0x2dba21[_0x138c('0x30')]);switch(_0x2dba21['moduleSearch']){case _0x138c('0x31'):var _0x38880d=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21[_0x138c('0x33')]){var _0x49898e={};_0x49898e[_0x2dba21[_0x138c('0x33')]]=_0x1083dc;_[_0x138c('0x34')](_0x38880d[_0x138c('0x35')],_0x49898e);}return _0x599822[_0x138c('0x1f')](_0x138c('0x36'))['find'](_0x38880d,_0x5e863a)[_0x138c('0x24')]()[_0x138c('0x25')](function(_0x40ff4b){if(_0x40ff4b&&_0x40ff4b[_0x138c('0x26')]){return _0x40ff4b;}else{var _0x231ce1=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21[_0x138c('0x37')]){var _0x1e0f80={};_0x1e0f80[_0x2dba21[_0x138c('0x37')]]=_0x1083dc;_[_0x138c('0x34')](_0x231ce1[_0x138c('0x35')],_0x1e0f80);}return _0x599822[_0x138c('0x1f')](_0x138c('0x38'))[_0x138c('0x27')](_0x231ce1,_0x5e863a);}});case'account_contact_lead':var _0x41789e=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21[_0x138c('0x39')]){var _0x49898e={};_0x49898e[_0x2dba21[_0x138c('0x39')]]=_0x1083dc;_[_0x138c('0x34')](_0x41789e[_0x138c('0x35')],_0x49898e);}return _0x599822['sobject']('Account')[_0x138c('0x27')](_0x41789e,_0x5e863a)[_0x138c('0x24')]()['then'](function(_0x366f73){if(_0x366f73&&_0x366f73[_0x138c('0x26')]){return _0x366f73;}else{var _0x3f13a0=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21[_0x138c('0x33')]){var _0x596078={};_0x596078[_0x2dba21[_0x138c('0x33')]]=_0x1083dc;_['merge'](_0x3f13a0[_0x138c('0x35')],_0x596078);}return _0x599822['sobject'](_0x138c('0x36'))['find'](_0x3f13a0,_0x5e863a)[_0x138c('0x25')](function(_0x5d2f05){if(_0x5d2f05&&_0x5d2f05[_0x138c('0x26')]){return _0x5d2f05;}else{var _0x580745=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21['additionalSearchLead']){var _0x591ec1={};_0x591ec1[_0x2dba21[_0x138c('0x37')]]=_0x1083dc;_['merge'](_0x580745[_0x138c('0x35')],_0x591ec1);}return _0x599822[_0x138c('0x1f')]('Lead')['find'](_0x580745,_0x5e863a);}});}});case _0x138c('0x14'):var _0x38880d=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21[_0x138c('0x33')]){var _0x49898e={};_0x49898e[_0x2dba21[_0x138c('0x33')]]=_0x1083dc;_['merge'](_0x38880d['$or'],_0x49898e);}return _0x599822[_0x138c('0x1f')](_0x138c('0x36'))[_0x138c('0x27')](_0x38880d,_0x5e863a)[_0x138c('0x24')]();case _0x138c('0x15'):var _0x3f0d1d=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21[_0x138c('0x37')]){var _0x49898e={};_0x49898e[_0x2dba21['additionalSearchLead']]=_0x1083dc;_[_0x138c('0x34')](_0x3f0d1d[_0x138c('0x35')],_0x49898e);}return _0x599822[_0x138c('0x1f')](_0x138c('0x38'))['find'](_0x3f0d1d,_0x5e863a);case _0x138c('0x17'):var _0x41789e=_[_0x138c('0x32')](_0x38b9c7);if(_0x2dba21[_0x138c('0x39')]){var _0x49898e={};_0x49898e[_0x2dba21[_0x138c('0x39')]]=_0x1083dc;_[_0x138c('0x34')](_0x41789e['$or'],_0x49898e);}return _0x599822[_0x138c('0x1f')](_0x138c('0x3a'))[_0x138c('0x27')](_0x41789e,_0x5e863a);default:return null;}})[_0x138c('0x25')](function(_0x24ced0){if(_0x24ced0&&_0x24ced0[_0x138c('0x26')]){var _0x4928c9=_[_0x138c('0x3b')](_0x24ced0);if(_0x4928c9){return BPromise[_0x138c('0x2d')]({'id':_0x4928c9['Id'],'name':_0x4928c9[_0x138c('0x3c')],'phone':_0x4928c9[_0x138c('0x3d')],'endUserType':_0x4928c9['attributes'][_0x138c('0x3e')][_0x138c('0x3f')]()});}}})[_0x138c('0x25')](function(_0x5400ef){if(_0x5400ef){logger[_0x138c('0x1d')](_0x138c('0x40'),_0x5400ef[_0x138c('0x13')],_0x1083dc);return BPromise[_0x138c('0x2d')](_0x5400ef);}else{logger['info'](_0x138c('0x41'),_0x1083dc);var _0x8882bc={'Phone':_0x1083dc};if(_0x2dba21[_0x138c('0x42')]){if(_0x2dba21[_0x138c('0x42')]===_0x138c('0x14')){logger[_0x138c('0x1d')](_0x138c('0x43'),_0x1083dc,_0x2dba21[_0x138c('0x42')]);_0x8882bc['LastName']=_0x13a2b4!==''?_0x13a2b4:util[_0x138c('0x44')]('Caller\x20-\x20%s',_0x1083dc);}else if(_0x2dba21[_0x138c('0x42')]===_0x138c('0x15')){logger[_0x138c('0x1d')](_0x138c('0x43'),_0x1083dc,_0x2dba21[_0x138c('0x42')]);_0x8882bc[_0x138c('0x45')]=_0x13a2b4!==_0x138c('0x46')?_0x13a2b4:util['format'](_0x138c('0x47'),_0x1083dc);_0x8882bc[_0x138c('0x48')]=_0x138c('0x49');}else if(_0x2dba21[_0x138c('0x42')]===_0x138c('0x17')){logger['info'](_0x138c('0x43'),_0x1083dc,_0x2dba21[_0x138c('0x42')]);_0x8882bc[_0x138c('0x3c')]=_0x13a2b4!==''?_0x13a2b4:util['format'](_0x138c('0x47'),_0x1083dc);}else{return null;}}return _0x599822['sobject'](_[_0x138c('0x4a')](_0x2dba21[_0x138c('0x42')]))[_0x138c('0x20')](_0x8882bc)[_0x138c('0x25')](function(_0x457799){return BPromise['resolve']({'id':_0x457799['id'],'endUserType':_0x2dba21['moduleCreate']});});}});}function getCustomFields(_0x3d6f11,_0x4d51a4){var _0x9958c1={};if(_0x3d6f11[_0x138c('0x26')]>0x0){_['forEach'](_0x3d6f11,function(_0x56eb73){if(_[_0x138c('0x4b')](['string','picklist'],_0x56eb73[_0x138c('0x3e')])&&_0x56eb73['idField']){_0x9958c1[_0x56eb73['idField']]=_0x56eb73['content'][_0x138c('0x4c')]();}else if(_0x56eb73[_0x138c('0x3e')]==='variable'&&_0x56eb73[_0x138c('0x4d')]&&_0x56eb73['idField']){_0x4d51a4[_0x56eb73[_0x138c('0x4d')]]&&(_0x9958c1[_0x56eb73[_0x138c('0x4e')]]=_0x4d51a4[_0x56eb73[_0x138c('0x4d')]][_0x138c('0x4c')]());}else if(_0x56eb73[_0x138c('0x3e')]===_0x138c('0x4f')&&_0x56eb73[_0x138c('0x50')]&&_0x56eb73[_0x138c('0x50')][_0x138c('0x51')]&&_0x56eb73[_0x138c('0x4e')]){_0x4d51a4[_0x56eb73[_0x138c('0x50')][_0x138c('0x51')][_0x138c('0x3f')]()]&&(_0x9958c1[_0x56eb73[_0x138c('0x4e')]]=_0x4d51a4[_0x56eb73[_0x138c('0x50')][_0x138c('0x51')][_0x138c('0x3f')]()][_0x138c('0x4c')]());}});}return _0x9958c1;}function getConnection(_0x44ab96){var _0x5d32e3=_0x44ab96[_0x138c('0x52')][_0x138c('0x53')](_0x44ab96[_0x138c('0x54')]);var _0x2eafd6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x44ab96[_0x138c('0x55')]||_0x138c('0x56'),'clientId':_0x44ab96[_0x138c('0x57')],'clientSecret':_0x44ab96[_0x138c('0x58')]}});return _0x2eafd6[_0x138c('0x59')](_0x44ab96['username'],_0x5d32e3)[_0x138c('0x25')](function(){logger[_0x138c('0x1d')](_0x138c('0x5a'));return _0x2eafd6;});}exports[_0x138c('0x5b')]=function(_0x47334a,_0x718f41,_0x486b9f,_0x20c3e3,_0xfc73dd,_0xf1fccc){var _0x1e3bec,_0x2e1e3a,_0x43c712,_0x4d673b;_0xf1fccc[_0x138c('0x5c')]=intUtil['stripTrailingSlash'](_0xf1fccc['serverUrl']);_0xf1fccc[_0x138c('0x55')]=intUtil['stripTrailingSlash'](_0xf1fccc[_0x138c('0x55')]);if(_0xfc73dd&&_0xfc73dd[_0x138c('0x5d')]){logger[_0x138c('0x1d')](_0x138c('0x5e'),_0x138c('0x5f'));_0x718f41['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf1fccc['serverUrl'],_0x718f41[_0x138c('0x60')],md5(_0x718f41[_0x138c('0x60')]));}else{_0x718f41[_0x138c('0x61')]='';}return getConnection(_0xf1fccc)[_0x138c('0x25')](function(_0x191cc1){_0x4d673b=_0x191cc1;return getUser(_0xf1fccc,_0x20c3e3[_0x138c('0x62')],_0x4d673b);})['then'](function(_0x16d0fa){_0x1e3bec=_0x16d0fa;return getEndUser(_0xf1fccc,_0x486b9f,_0x718f41['calleridname'],_0x718f41[_0x138c('0x63')],_0x4d673b);})[_0x138c('0x25')](function(_0x4c5365){_0x2e1e3a=_0x4c5365;return getTicket(_0xf1fccc,_0x1e3bec,_0x2e1e3a,_0x486b9f,_0x718f41,_0x486b9f[_0x138c('0x64')],_0x4d673b,'queue');})['then'](function(_0x33e16e){_0x43c712=_0x33e16e;logger['info'](_0x138c('0x65'),_0x43c712['id']);logger['info'](_0x138c('0x66'),_0x43c712['id'],_0x20c3e3['name'],_0xf1fccc[_0x138c('0x3e')]);switch(_0xf1fccc[_0x138c('0x3e')]){case _0x138c('0x67'):emit(util['format']('user:%s',_0x20c3e3['name']),_0x138c('0x68'),{'recordId':_0x43c712['id']});break;case'newTab':emit(util[_0x138c('0x44')](_0x138c('0x69'),_0x20c3e3[_0x138c('0x51')]),'trigger:browser:url',{'uri':util[_0x138c('0x44')](_0x138c('0x6a'),_0x4d673b[_0x138c('0x6b')],_0x43c712['id'])});break;default:logger[_0x138c('0x6c')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x58d778){logger[_0x138c('0x6c')](_0x138c('0x5e'),_0x58d778);});};exports[_0x138c('0x6d')]=function(_0x47a0ca,_0x223009,_0x2589a4,_0x467cae,_0x4bb5c8,_0x1669e4,_0x3f61ea){var _0xab0a4f,_0x21b36f,_0x3e5c8c,_0x453d1e;_0x1669e4[_0x138c('0x5c')]=intUtil['stripTrailingSlash'](_0x1669e4[_0x138c('0x5c')]);_0x1669e4[_0x138c('0x55')]=intUtil[_0x138c('0x6e')](_0x1669e4['remoteUri']);if(_0x3f61ea&&_0x3f61ea['recordingFormat']&&_0x3f61ea['recordingFormat']!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x223009[_0x138c('0x61')]=util[_0x138c('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1669e4['serverUrl'],_0x223009[_0x138c('0x60')],md5(_0x223009[_0x138c('0x60')]));}return getConnection(_0x1669e4)['then'](function(_0x1cd18c){_0x453d1e=_0x1cd18c;return getUser(_0x1669e4,_0x467cae[_0x138c('0x62')],_0x453d1e);})[_0x138c('0x25')](function(_0x83f406){_0xab0a4f=_0x83f406;return getEndUser(_0x1669e4,_0x2589a4,_0x223009[_0x138c('0x6f')],_0x223009[_0x138c('0x70')],_0x453d1e);})['then'](function(_0x31e308){_0x21b36f=_0x31e308;return getTicket(_0x1669e4,_0xab0a4f,_0x21b36f,_0x2589a4,_0x223009,_0x2589a4['Fields'],_0x453d1e,_0x138c('0x6d'));})[_0x138c('0x25')](function(_0x4467e0){_0x3e5c8c=_0x4467e0;logger[_0x138c('0x1d')](_0x138c('0x71'),_0x3e5c8c['id']);logger[_0x138c('0x1d')](_0x138c('0x72'),_0x3e5c8c['id'],_0x467cae[_0x138c('0x51')],_0x1669e4[_0x138c('0x3e')]);switch(_0x1669e4[_0x138c('0x3e')]){case _0x138c('0x67'):emit(util[_0x138c('0x44')]('user:%s',_0x467cae[_0x138c('0x51')]),_0x138c('0x68'),{'recordId':_0x3e5c8c['id']});break;case _0x138c('0x73'):emit(util[_0x138c('0x44')](_0x138c('0x69'),_0x467cae[_0x138c('0x51')]),_0x138c('0x74'),{'uri':util['format'](_0x138c('0x6a'),_0x453d1e[_0x138c('0x6b')],_0x3e5c8c['id'])});break;default:logger['error'](_0x138c('0x75'),_0x138c('0x76'));}})[_0x138c('0x77')](function(_0x49cbfa){logger[_0x138c('0x6c')](_0x138c('0x75'),_0x49cbfa);});};exports[_0x138c('0x78')]=function(_0x43ac9d,_0x1d432d,_0x121c2b,_0x267ae0,_0x22f835,_0x406aaf){var _0x11247b,_0xc18c,_0x450249,_0x3f6706;_0x406aaf['serverUrl']=intUtil[_0x138c('0x6e')](_0x406aaf[_0x138c('0x5c')]);_0x406aaf[_0x138c('0x55')]=intUtil[_0x138c('0x6e')](_0x406aaf[_0x138c('0x55')]);if(_0x22f835&&_0x22f835[_0x138c('0x5d')]){logger[_0x138c('0x1d')]('['+_0x1d432d['lastevent'][_0x138c('0x79')]()+']',_0x138c('0x5f'));_0x1d432d[_0x138c('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x406aaf[_0x138c('0x5c')],_0x1d432d[_0x138c('0x60')],md5(_0x1d432d[_0x138c('0x60')]));}else{_0x1d432d[_0x138c('0x61')]='';}return getConnection(_0x406aaf)[_0x138c('0x25')](function(_0x88dd6c){_0x3f6706=_0x88dd6c;if(!_[_0x138c('0x21')](_0x267ae0)){return getUser(_0x406aaf,_0x267ae0['name'],_0x3f6706);}else{return getUser(_0x406aaf,null,_0x3f6706);}})['then'](function(_0x20bcef){_0x11247b=_0x20bcef;return getEndUser(_0x406aaf,_0x121c2b,_0x1d432d['calleridname'],_0x1d432d[_0x138c('0x63')],_0x3f6706);})[_0x138c('0x25')](function(_0x3b73f2){_0xc18c=_0x3b73f2;return getTicket(_0x406aaf,_0x11247b,_0xc18c,_0x121c2b,_0x1d432d,_0x121c2b[_0x138c('0x64')],_0x3f6706);})[_0x138c('0x25')](function(_0x762228){_0x450249=_0x762228;logger['info']('['+_0x1d432d[_0x138c('0x7a')][_0x138c('0x79')]()+_0x138c('0x7b'),_0x450249['id']);logger[_0x138c('0x1d')]('['+_0x1d432d[_0x138c('0x7a')]['toUpperCase']()+_0x138c('0x7c'),_0x406aaf['type']);})[_0x138c('0x77')](function(_0x34b143){logger[_0x138c('0x6c')]('['+_0x1d432d[_0x138c('0x7a')][_0x138c('0x79')]()+']',_0x34b143);});}; \ No newline at end of file +var _0x4869=['salesforce','redis','defaults','emit','assign','getString','Descriptions','Task','ActivityDate','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','find','execute','then','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','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','upperFirst','forEach','includes','string','picklist','idField','toString','variableName','customVariable','Variable','name','securityToken','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','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','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','uniqueid','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x4869,0xfa));var _0x9486=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4869[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x9486('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9486('0x1'));var md5=require(_0x9486('0x2'));var jsforce=require(_0x9486('0x3'));var util=require(_0x9486('0x4'));var Redis=require('ioredis');var intUtil=require(_0x9486('0x5'));var config=require(_0x9486('0x6'));var logger=require(_0x9486('0x7'))(_0x9486('0x8'));config[_0x9486('0x9')]=_[_0x9486('0xa')](config[_0x9486('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9486('0x9')]));function emit(_0x22b4b,_0x5ba1e6,_0x190d75){io['to'](_0x22b4b)[_0x9486('0xb')](_0x5ba1e6,_0x190d75);}function getTicket(_0x53e5f9,_0x32a872,_0x4df2b4,_0xa857e,_0x21c84c,_0x251f6a,_0x177139,_0x14addf){var _0x3be813=Object[_0x9486('0xc')]({},{'OwnerId':_0x32a872['id'],'Subject':intUtil['getString'](_0xa857e['Subjects'],_0x21c84c,'\x20'),'Description':intUtil[_0x9486('0xd')](_0xa857e[_0x9486('0xe')],_0x21c84c,'\x0a')},getCustomFields(_0x251f6a,_0x21c84c));if(_0x4df2b4){if(_0xa857e['ticketType']===_0x9486('0xf')){_0x3be813[_0x9486('0x10')]=moment['utc']();_0x3be813['IsReminderSet']=![];_0x3be813[_0x9486('0x11')]=![];if(_0x4df2b4[_0x9486('0x12')]===_0x9486('0x13')||_0x4df2b4[_0x9486('0x12')]==='lead'){_0x3be813[_0x9486('0x14')]=_0x4df2b4['id'];}else if(_0x4df2b4[_0x9486('0x12')]===_0x9486('0x15')){_0x3be813[_0x9486('0x16')]=_0x4df2b4['id'];}}else if(_0xa857e[_0x9486('0x17')]===_0x9486('0x18')){if(_0x4df2b4['endUserType']===_0x9486('0x13')){_0x3be813[_0x9486('0x19')]=_0x4df2b4['id'];}else if(_0x4df2b4[_0x9486('0x12')]===_0x9486('0x15')){_0x3be813[_0x9486('0x1a')]=_0x4df2b4['id'];}else if(_0x4df2b4[_0x9486('0x12')]===_0x9486('0x1b')&&_0xa857e[_0x9486('0x1c')]){_0x3be813[_0xa857e['leadId']]=_0x4df2b4['id'];}else{logger[_0x9486('0x1d')](_0x9486('0x1e'));}}}return _0x177139[_0x9486('0x1f')](_0xa857e['ticketType'])[_0x9486('0x20')](_0x3be813);}function getUser(_0x41efae,_0x4809d7,_0x126c22){if(!_['isNil'](_0x4809d7)&&intUtil['validateEmail'](_0x4809d7)){var _0x1b5a76={'Email':_0x4809d7};var _0x305f45={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x126c22[_0x9486('0x1f')](_0x9486('0x21'))[_0x9486('0x22')](_0x1b5a76,_0x305f45)[_0x9486('0x23')]()[_0x9486('0x24')](function(_0x3d7bae){if(_0x3d7bae['length']){var _0x47c62f=_[_0x9486('0x22')](_0x3d7bae,function(_0x2b3b98){return _0x2b3b98[_0x9486('0x25')]===_0x4809d7;});if(_0x47c62f){logger[_0x9486('0x1d')](_0x9486('0x26'),_0x4809d7);return BPromise[_0x9486('0x27')]({'id':_0x47c62f['Id'],'name':_0x47c62f[_0x9486('0x28')]});}}else{logger['info'](_0x9486('0x29'),_0x4809d7);return _0x126c22['identity']()[_0x9486('0x24')](function(_0x216183){return BPromise['resolve']({'id':_0x216183[_0x9486('0x2a')],'name':_0x216183[_0x9486('0x2b')]});});}});}else{logger[_0x9486('0x1d')](_0x9486('0x29'),_0x4809d7);return _0x126c22[_0x9486('0x2c')]()[_0x9486('0x24')](function(_0x3612e1){return BPromise['resolve']({'id':_0x3612e1['user_id'],'name':_0x3612e1[_0x9486('0x2b')]});});}}function getEndUser(_0x361c70,_0x3fc178,_0x1b0e64,_0x48ca8b,_0x45e189){var _0x3db53a={'$or':{'Phone':_0x48ca8b}};var _0x2896a3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9486('0x27')]()[_0x9486('0x24')](function(){logger[_0x9486('0x1d')](_0x9486('0x2d'),_0x48ca8b,_0x3fc178[_0x9486('0x2e')]);switch(_0x3fc178[_0x9486('0x2e')]){case _0x9486('0x2f'):var _0x454953=_[_0x9486('0x30')](_0x3db53a);if(_0x3fc178['additionalSearchContact']){var _0x15830d={};_0x15830d[_0x3fc178[_0x9486('0x31')]]=_0x48ca8b;_[_0x9486('0x32')](_0x454953['$or'],_0x15830d);}return _0x45e189[_0x9486('0x1f')](_0x9486('0x33'))[_0x9486('0x22')](_0x454953,_0x2896a3)[_0x9486('0x23')]()['then'](function(_0x3b2f97){if(_0x3b2f97&&_0x3b2f97[_0x9486('0x34')]){return _0x3b2f97;}else{var _0x4f1409=_[_0x9486('0x30')](_0x3db53a);if(_0x3fc178[_0x9486('0x35')]){var _0x2b532e={};_0x2b532e[_0x3fc178['additionalSearchLead']]=_0x48ca8b;_[_0x9486('0x32')](_0x4f1409['$or'],_0x2b532e);}return _0x45e189[_0x9486('0x1f')](_0x9486('0x36'))['find'](_0x4f1409,_0x2896a3);}});case _0x9486('0x37'):var _0xb6e464=_[_0x9486('0x30')](_0x3db53a);if(_0x3fc178[_0x9486('0x38')]){var _0x15830d={};_0x15830d[_0x3fc178[_0x9486('0x38')]]=_0x48ca8b;_[_0x9486('0x32')](_0xb6e464[_0x9486('0x39')],_0x15830d);}return _0x45e189['sobject'](_0x9486('0x3a'))[_0x9486('0x22')](_0xb6e464,_0x2896a3)[_0x9486('0x23')]()[_0x9486('0x24')](function(_0x1914ba){if(_0x1914ba&&_0x1914ba[_0x9486('0x34')]){return _0x1914ba;}else{var _0xc816af=_[_0x9486('0x30')](_0x3db53a);if(_0x3fc178[_0x9486('0x31')]){var _0x48a47d={};_0x48a47d[_0x3fc178[_0x9486('0x31')]]=_0x48ca8b;_[_0x9486('0x32')](_0xc816af['$or'],_0x48a47d);}return _0x45e189['sobject'](_0x9486('0x33'))[_0x9486('0x22')](_0xc816af,_0x2896a3)['then'](function(_0xcd6507){if(_0xcd6507&&_0xcd6507['length']){return _0xcd6507;}else{var _0x5c2577=_['cloneDeep'](_0x3db53a);if(_0x3fc178[_0x9486('0x35')]){var _0xa85349={};_0xa85349[_0x3fc178[_0x9486('0x35')]]=_0x48ca8b;_['merge'](_0x5c2577[_0x9486('0x39')],_0xa85349);}return _0x45e189[_0x9486('0x1f')](_0x9486('0x36'))[_0x9486('0x22')](_0x5c2577,_0x2896a3);}});}});case'contact':var _0x454953=_['cloneDeep'](_0x3db53a);if(_0x3fc178[_0x9486('0x31')]){var _0x15830d={};_0x15830d[_0x3fc178[_0x9486('0x31')]]=_0x48ca8b;_['merge'](_0x454953[_0x9486('0x39')],_0x15830d);}return _0x45e189[_0x9486('0x1f')](_0x9486('0x33'))['find'](_0x454953,_0x2896a3)[_0x9486('0x23')]();case _0x9486('0x1b'):var _0xad0eb1=_[_0x9486('0x30')](_0x3db53a);if(_0x3fc178[_0x9486('0x35')]){var _0x15830d={};_0x15830d[_0x3fc178[_0x9486('0x35')]]=_0x48ca8b;_[_0x9486('0x32')](_0xad0eb1[_0x9486('0x39')],_0x15830d);}return _0x45e189[_0x9486('0x1f')](_0x9486('0x36'))['find'](_0xad0eb1,_0x2896a3);case _0x9486('0x15'):var _0xb6e464=_[_0x9486('0x30')](_0x3db53a);if(_0x3fc178[_0x9486('0x38')]){var _0x15830d={};_0x15830d[_0x3fc178[_0x9486('0x38')]]=_0x48ca8b;_[_0x9486('0x32')](_0xb6e464[_0x9486('0x39')],_0x15830d);}return _0x45e189[_0x9486('0x1f')](_0x9486('0x3a'))['find'](_0xb6e464,_0x2896a3);default:return null;}})[_0x9486('0x24')](function(_0xfec45b){if(_0xfec45b&&_0xfec45b['length']){var _0x28b723=_[_0x9486('0x3b')](_0xfec45b);if(_0x28b723){return BPromise['resolve']({'id':_0x28b723['Id'],'name':_0x28b723[_0x9486('0x28')],'phone':_0x28b723[_0x9486('0x3c')],'endUserType':_0x28b723[_0x9486('0x3d')][_0x9486('0x3e')][_0x9486('0x3f')]()});}}})[_0x9486('0x24')](function(_0x574d7a){if(_0x574d7a){logger[_0x9486('0x1d')](_0x9486('0x40'),_0x574d7a['endUserType'],_0x48ca8b);return BPromise['resolve'](_0x574d7a);}else{logger['info'](_0x9486('0x41'),_0x48ca8b);var _0x3eb9c2={'Phone':_0x48ca8b};if(_0x3fc178[_0x9486('0x42')]){if(_0x3fc178[_0x9486('0x42')]==='contact'){logger[_0x9486('0x1d')](_0x9486('0x43'),_0x48ca8b,_0x3fc178['moduleCreate']);_0x3eb9c2[_0x9486('0x44')]=_0x1b0e64!==''?_0x1b0e64:util[_0x9486('0x45')](_0x9486('0x46'),_0x48ca8b);}else if(_0x3fc178[_0x9486('0x42')]==='lead'){logger[_0x9486('0x1d')](_0x9486('0x43'),_0x48ca8b,_0x3fc178[_0x9486('0x42')]);_0x3eb9c2[_0x9486('0x44')]=_0x1b0e64!==_0x9486('0x47')?_0x1b0e64:util[_0x9486('0x45')](_0x9486('0x46'),_0x48ca8b);_0x3eb9c2[_0x9486('0x48')]='No\x20Company';}else if(_0x3fc178[_0x9486('0x42')]===_0x9486('0x15')){logger['info'](_0x9486('0x43'),_0x48ca8b,_0x3fc178[_0x9486('0x42')]);_0x3eb9c2[_0x9486('0x28')]=_0x1b0e64!==_0x9486('0x47')?_0x1b0e64:util[_0x9486('0x45')](_0x9486('0x46'),_0x48ca8b);}else{return null;}}return _0x45e189[_0x9486('0x1f')](_[_0x9486('0x49')](_0x3fc178[_0x9486('0x42')]))[_0x9486('0x20')](_0x3eb9c2)[_0x9486('0x24')](function(_0x46051d){return BPromise[_0x9486('0x27')]({'id':_0x46051d['id'],'endUserType':_0x3fc178[_0x9486('0x42')]});});}});}function getCustomFields(_0x47c5c7,_0xf324c1){var _0x30bcdc={};if(_0x47c5c7[_0x9486('0x34')]>0x0){_[_0x9486('0x4a')](_0x47c5c7,function(_0x366db3){if(_[_0x9486('0x4b')]([_0x9486('0x4c'),_0x9486('0x4d')],_0x366db3['type'])&&_0x366db3[_0x9486('0x4e')]){_0x30bcdc[_0x366db3[_0x9486('0x4e')]]=_0x366db3['content'][_0x9486('0x4f')]();}else if(_0x366db3[_0x9486('0x3e')]==='variable'&&_0x366db3[_0x9486('0x50')]&&_0x366db3[_0x9486('0x4e')]){_0xf324c1[_0x366db3['variableName']]&&(_0x30bcdc[_0x366db3[_0x9486('0x4e')]]=_0xf324c1[_0x366db3['variableName']]['toString']());}else if(_0x366db3[_0x9486('0x3e')]===_0x9486('0x51')&&_0x366db3[_0x9486('0x52')]&&_0x366db3[_0x9486('0x52')][_0x9486('0x53')]&&_0x366db3[_0x9486('0x4e')]){_0xf324c1[_0x366db3['Variable'][_0x9486('0x53')][_0x9486('0x3f')]()]&&(_0x30bcdc[_0x366db3[_0x9486('0x4e')]]=_0xf324c1[_0x366db3[_0x9486('0x52')]['name'][_0x9486('0x3f')]()][_0x9486('0x4f')]());}});}return _0x30bcdc;}function getConnection(_0x2f3ec4){var _0x59b451=_0x2f3ec4['password']['concat'](_0x2f3ec4[_0x9486('0x54')]);var _0x3ffa5e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2f3ec4[_0x9486('0x55')]||_0x9486('0x56'),'clientId':_0x2f3ec4[_0x9486('0x57')],'clientSecret':_0x2f3ec4['clientSecret']}});return _0x3ffa5e[_0x9486('0x58')](_0x2f3ec4['username'],_0x59b451)['then'](function(){logger[_0x9486('0x1d')](_0x9486('0x59'));return _0x3ffa5e;});}exports['queue']=function(_0x3a0848,_0xcae4c7,_0x2132ce,_0x4eda83,_0x1ccae1,_0x17cba0){var _0x424643,_0x28dc26,_0x57f2c3,_0x24ba7f;_0x17cba0[_0x9486('0x5a')]=intUtil[_0x9486('0x5b')](_0x17cba0[_0x9486('0x5a')]);_0x17cba0[_0x9486('0x55')]=intUtil[_0x9486('0x5b')](_0x17cba0[_0x9486('0x55')]);if(_0x1ccae1&&_0x1ccae1[_0x9486('0x5c')]){logger[_0x9486('0x1d')](_0x9486('0x5d'),_0x9486('0x5e'));_0xcae4c7[_0x9486('0x5f')]=util['format'](_0x9486('0x60'),_0x17cba0[_0x9486('0x5a')],_0xcae4c7['uniqueid'],md5(_0xcae4c7['uniqueid']));}else{_0xcae4c7[_0x9486('0x5f')]='';}return getConnection(_0x17cba0)[_0x9486('0x24')](function(_0x4bffe7){_0x24ba7f=_0x4bffe7;return getUser(_0x17cba0,_0x4eda83['email'],_0x24ba7f);})[_0x9486('0x24')](function(_0xba073f){_0x424643=_0xba073f;return getEndUser(_0x17cba0,_0x2132ce,_0xcae4c7[_0x9486('0x61')],_0xcae4c7[_0x9486('0x62')],_0x24ba7f);})['then'](function(_0x3cdef5){_0x28dc26=_0x3cdef5;return getTicket(_0x17cba0,_0x424643,_0x28dc26,_0x2132ce,_0xcae4c7,_0x2132ce[_0x9486('0x63')],_0x24ba7f,_0x9486('0x64'));})[_0x9486('0x24')](function(_0x1f020d){_0x57f2c3=_0x1f020d;logger[_0x9486('0x1d')](_0x9486('0x65'),_0x57f2c3['id']);logger[_0x9486('0x1d')](_0x9486('0x66'),_0x57f2c3['id'],_0x4eda83[_0x9486('0x53')],_0x17cba0[_0x9486('0x3e')]);switch(_0x17cba0[_0x9486('0x3e')]){case _0x9486('0x67'):emit(util[_0x9486('0x45')](_0x9486('0x68'),_0x4eda83['name']),_0x9486('0x69'),{'recordId':_0x57f2c3['id']});break;case _0x9486('0x6a'):emit(util[_0x9486('0x45')](_0x9486('0x68'),_0x4eda83[_0x9486('0x53')]),_0x9486('0x6b'),{'uri':util[_0x9486('0x45')]('%s/%s/e',_0x24ba7f[_0x9486('0x6c')],_0x57f2c3['id'])});break;default:logger[_0x9486('0x6d')](_0x9486('0x6e'));}})[_0x9486('0x6f')](function(_0xd5ba07){logger[_0x9486('0x6d')]('[QUEUE]',_0xd5ba07);});};exports[_0x9486('0x70')]=function(_0x48d0c1,_0x533e60,_0x4c47fe,_0x4a3252,_0x505000,_0x3121de,_0x4a43d1){var _0x41b25f,_0x289331,_0x3701c3,_0x4fc809;_0x3121de[_0x9486('0x5a')]=intUtil[_0x9486('0x5b')](_0x3121de['serverUrl']);_0x3121de[_0x9486('0x55')]=intUtil[_0x9486('0x5b')](_0x3121de[_0x9486('0x55')]);if(_0x4a43d1&&_0x4a43d1[_0x9486('0x71')]&&_0x4a43d1[_0x9486('0x71')]!=='none'){logger[_0x9486('0x1d')](_0x9486('0x72'),_0x9486('0x5e'));_0x533e60[_0x9486('0x5f')]=util['format'](_0x9486('0x60'),_0x3121de[_0x9486('0x5a')],_0x533e60[_0x9486('0x73')],md5(_0x533e60[_0x9486('0x73')]));}return getConnection(_0x3121de)['then'](function(_0xda0c94){_0x4fc809=_0xda0c94;return getUser(_0x3121de,_0x4a3252[_0x9486('0x74')],_0x4fc809);})[_0x9486('0x24')](function(_0x17537c){_0x41b25f=_0x17537c;return getEndUser(_0x3121de,_0x4c47fe,_0x533e60[_0x9486('0x75')],_0x533e60[_0x9486('0x76')],_0x4fc809);})[_0x9486('0x24')](function(_0x4b0ac5){_0x289331=_0x4b0ac5;return getTicket(_0x3121de,_0x41b25f,_0x289331,_0x4c47fe,_0x533e60,_0x4c47fe[_0x9486('0x63')],_0x4fc809,'outbound');})['then'](function(_0x292298){_0x3701c3=_0x292298;logger['info'](_0x9486('0x77'),_0x3701c3['id']);logger[_0x9486('0x1d')](_0x9486('0x78'),_0x3701c3['id'],_0x4a3252[_0x9486('0x53')],_0x3121de['type']);switch(_0x3121de[_0x9486('0x3e')]){case _0x9486('0x67'):emit(util[_0x9486('0x45')](_0x9486('0x68'),_0x4a3252[_0x9486('0x53')]),'trigger:salesforce:display',{'recordId':_0x3701c3['id']});break;case'newTab':emit(util[_0x9486('0x45')](_0x9486('0x68'),_0x4a3252[_0x9486('0x53')]),'trigger:browser:url',{'uri':util[_0x9486('0x45')](_0x9486('0x79'),_0x4fc809[_0x9486('0x6c')],_0x3701c3['id'])});break;default:logger['error'](_0x9486('0x72'),_0x9486('0x7a'));}})[_0x9486('0x6f')](function(_0x5d2464){logger['error'](_0x9486('0x72'),_0x5d2464);});};exports[_0x9486('0x7b')]=function(_0x5542e3,_0x175161,_0x44e31a,_0x13b462,_0x2aa1b9,_0x2e4180){var _0x449854,_0x4801e4,_0x4f200c,_0x1b8f3c;_0x2e4180['serverUrl']=intUtil[_0x9486('0x5b')](_0x2e4180[_0x9486('0x5a')]);_0x2e4180[_0x9486('0x55')]=intUtil[_0x9486('0x5b')](_0x2e4180[_0x9486('0x55')]);if(_0x2aa1b9&&_0x2aa1b9[_0x9486('0x5c')]){logger[_0x9486('0x1d')]('['+_0x175161[_0x9486('0x7c')][_0x9486('0x7d')]()+']',_0x9486('0x5e'));_0x175161[_0x9486('0x5f')]=util[_0x9486('0x45')](_0x9486('0x60'),_0x2e4180[_0x9486('0x5a')],_0x175161['uniqueid'],md5(_0x175161[_0x9486('0x73')]));}else{_0x175161[_0x9486('0x5f')]='';}return getConnection(_0x2e4180)[_0x9486('0x24')](function(_0x2f28c6){_0x1b8f3c=_0x2f28c6;if(!_[_0x9486('0x7e')](_0x13b462)){return getUser(_0x2e4180,_0x13b462[_0x9486('0x53')],_0x1b8f3c);}else{return getUser(_0x2e4180,null,_0x1b8f3c);}})[_0x9486('0x24')](function(_0x1b5fb5){_0x449854=_0x1b5fb5;return getEndUser(_0x2e4180,_0x44e31a,_0x175161[_0x9486('0x61')],_0x175161[_0x9486('0x62')],_0x1b8f3c);})['then'](function(_0x44bca9){_0x4801e4=_0x44bca9;return getTicket(_0x2e4180,_0x449854,_0x4801e4,_0x44e31a,_0x175161,_0x44e31a[_0x9486('0x63')],_0x1b8f3c);})[_0x9486('0x24')](function(_0x33d830){_0x4f200c=_0x33d830;logger[_0x9486('0x1d')]('['+_0x175161[_0x9486('0x7c')]['toUpperCase']()+_0x9486('0x7f'),_0x4f200c['id']);logger[_0x9486('0x1d')]('['+_0x175161[_0x9486('0x7c')][_0x9486('0x7d')]()+_0x9486('0x80'),_0x2e4180[_0x9486('0x3e')]);})[_0x9486('0x6f')](function(_0x447ae0){logger['error']('['+_0x175161[_0x9486('0x7c')][_0x9486('0x7d')]()+']',_0x447ae0);});}; \ 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 dc96b0f..bc64b98 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 _0xf5ea=['adminEmail','endUserNumber','user','true','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','includes','string','picklist','type','customField','toLowerCase','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','format','user:%s','emit','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','./util','../../../../config/environment','servicenow','localhost','socket.io-emitter','redis','GET','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId',']\x20using\x20admin\x20profile'];(function(_0x2ccc78,_0x345772){var _0x1cd966=function(_0x20da90){while(--_0x20da90){_0x2ccc78['push'](_0x2ccc78['shift']());}};_0x1cd966(++_0x345772);}(_0xf5ea,0x189));var _0xaf5e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf5ea[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xaf5e('0x0'));var Promise=require(_0xaf5e('0x1'));var rp=require(_0xaf5e('0x2'));var util=require('util');var md5=require(_0xaf5e('0x3'));var Redis=require('ioredis');var intUtil=require(_0xaf5e('0x4'));var config=require(_0xaf5e('0x5'));var logger=require('../../../../config/logger')(_0xaf5e('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0xaf5e('0x7'),'port':0x18eb});var io=require(_0xaf5e('0x8'))(new Redis(config[_0xaf5e('0x9')]));function getAdminUser(_0x518ca2,_0x266ab6,_0x97420a,_0x5d7414,_0x1a41ce,_0x4c8d1f){return new Promise(function(_0x2e6284,_0x50338a){var _0x59c70e={'method':_0xaf5e('0xa'),'uri':_0x5d7414+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x1a41ce+'&'+_0x4c8d1f,'auth':_0x266ab6,'json':!![]};return rp(_0x59c70e)[_0xaf5e('0xb')](function(_0x5185ef){if(_0x5185ef[_0xaf5e('0xc')][_0xaf5e('0xd')]>0x0){_0x97420a[_0xaf5e('0xe')]=_0x5185ef['result'][0x0][_0xaf5e('0xf')];}logger[_0xaf5e('0x10')]('['+[_0x518ca2[_0xaf5e('0x11')]()]+_0xaf5e('0x12'),_0x97420a);_0x2e6284(_0x97420a);})[_0xaf5e('0x13')](function(_0x423a18){logger[_0xaf5e('0x14')]('['+[_0x518ca2[_0xaf5e('0x11')]()]+']',_0x423a18[_0xaf5e('0x15')]);_0x50338a(_0x423a18['message']);});});}function getUser(_0x2fec53,_0x11634f,_0x21f4b9,_0x226715,_0x464601){return function(_0x66cb7f){logger[_0xaf5e('0x10')]('['+[_0x2fec53['toUpperCase']()]+_0xaf5e('0x16'),_0x66cb7f);return new Promise(function(_0x2c7c1c,_0x2c4756){if(intUtil[_0xaf5e('0x17')](_0x66cb7f['userEmail'])){var _0x45f34b={'method':_0xaf5e('0xa'),'uri':_0x21f4b9+_0xaf5e('0x18')+_0x66cb7f[_0xaf5e('0x19')]+'&'+_0x226715+'&'+_0x464601,'auth':_0x11634f,'json':!![]};logger['info']('['+[_0x2fec53[_0xaf5e('0x11')]()]+_0xaf5e('0x1a'),_0x45f34b);return rp(_0x45f34b)[_0xaf5e('0xb')](function(_0x380f35){logger['info']('['+[_0x2fec53['toUpperCase']()]+_0xaf5e('0x1b'),_0x380f35);if(_0x380f35['result'][_0xaf5e('0xd')]>0x0&&String(_0x380f35[_0xaf5e('0xc')][0x0][_0xaf5e('0x1c')])==='true'){_0x66cb7f['userId']=_0x380f35[_0xaf5e('0xc')][0x0][_0xaf5e('0xf')];}else{_0x66cb7f[_0xaf5e('0x1d')]=_0x66cb7f['adminId'];_0x66cb7f[_0xaf5e('0x19')]=_0x66cb7f['adminEmail'];}logger['info']('['+[_0x2fec53[_0xaf5e('0x11')]()]+'],\x20getUser\x20crm',_0x66cb7f);_0x2c7c1c(_0x66cb7f);})[_0xaf5e('0x13')](function(_0x1f7d31){logger[_0xaf5e('0x14')]('['+[_0x2fec53[_0xaf5e('0x11')]()]+']',_0x1f7d31[_0xaf5e('0x15')]);_0x2c4756(_0x1f7d31[_0xaf5e('0x15')]);});}else{logger[_0xaf5e('0x10')]('['+[_0x2fec53[_0xaf5e('0x11')]()]+_0xaf5e('0x1e'));_0x66cb7f[_0xaf5e('0x1d')]=_0x66cb7f[_0xaf5e('0xe')];_0x66cb7f[_0xaf5e('0x19')]=_0x66cb7f[_0xaf5e('0x1f')];_0x2c7c1c(_0x66cb7f);}});};}function createEndUser(_0x3c0e39,_0x1d3bd8,_0x2f3c0e,_0x45933d,_0x57cd2a){logger['info']('['+[_0x3c0e39['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x2f3c0e);return new Promise(function(_0x23e550,_0x13ebce){var _0x2c7db8={'method':'POST','uri':_0x45933d+'sys_user?'+_0x57cd2a,'body':{'user_name':_0x2f3c0e[_0xaf5e('0x20')],'roles':_0xaf5e('0x21'),'first_name':_0x2f3c0e[_0xaf5e('0x20')],'active':_0xaf5e('0x22'),'date_format':'System','phone':_0x2f3c0e['endUserNumber']},'auth':_0x1d3bd8,'json':!![]};return rp(_0x2c7db8)['then'](function(_0x29df89){logger[_0xaf5e('0x10')]('['+[_0x3c0e39[_0xaf5e('0x11')]()]+_0xaf5e('0x23'),_0x29df89['result']);_0x2f3c0e['endUserId']=_0x29df89[_0xaf5e('0xc')][_0xaf5e('0xf')];_0x23e550(_0x2f3c0e);})[_0xaf5e('0x13')](function(_0x1b454b){logger[_0xaf5e('0x14')]('['+[_0x3c0e39[_0xaf5e('0x11')]()]+']',_0x1b454b[_0xaf5e('0x15')]);_0x13ebce(_0x1b454b[_0xaf5e('0x15')]);});});}function getEndUser(_0x195428,_0x311054,_0x1c7186,_0x8f1482,_0x2ef5e9){return function(_0x2fe0a2){logger['info']('['+[_0x195428['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x2fe0a2);return new Promise(function(_0x3eb5cc,_0x29b32a){var _0x37dc58={'method':'GET','uri':_0x1c7186+_0xaf5e('0x24')+_0x2fe0a2[_0xaf5e('0x20')]+'&'+_0x8f1482+'&'+_0x2ef5e9,'auth':_0x311054,'json':!![]};return rp(_0x37dc58)[_0xaf5e('0xb')](function(_0x305da2){if(_0x305da2[_0xaf5e('0xc')][_0xaf5e('0xd')]>0x0){_0x2fe0a2[_0xaf5e('0x25')]=_0x305da2[_0xaf5e('0xc')][0x0][_0xaf5e('0xf')];logger[_0xaf5e('0x10')]('['+[_0x195428['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x2fe0a2);_0x3eb5cc(_0x2fe0a2);}else{return createEndUser(_0x195428,_0x311054,_0x2fe0a2,_0x1c7186,_0x8f1482)[_0xaf5e('0xb')](function(_0x17967a){logger['info']('['+[_0x195428[_0xaf5e('0x11')]()]+'],\x20createEndUser\x20crm',_0x17967a);_0x3eb5cc(_0x17967a);});}})[_0xaf5e('0x13')](function(_0x758eb6){logger[_0xaf5e('0x14')]('['+[_0x195428[_0xaf5e('0x11')]()]+']',_0x758eb6[_0xaf5e('0x15')]);_0x29b32a(_0x758eb6[_0xaf5e('0x15')]);});});};}function getCustomFields(_0x18c3c2,_0xb9e55c){var _0x1ee043={};if(_0x18c3c2['length']>0x0){_['forEach'](_0x18c3c2,function(_0x4b8c22){if(_[_0xaf5e('0x26')]([_0xaf5e('0x27'),_0xaf5e('0x28')],_0x4b8c22[_0xaf5e('0x29')])&&_0x4b8c22['nameField']&&!_0x4b8c22[_0xaf5e('0x2a')]){_0x1ee043[_0x4b8c22['nameField'][_0xaf5e('0x2b')]()]=_0x4b8c22['content']['toString']();}else if(_[_0xaf5e('0x26')](['string','picklist'],_0x4b8c22[_0xaf5e('0x29')])&&_0x4b8c22['idField']&&_0x4b8c22[_0xaf5e('0x2a')]){_0x1ee043[_0x4b8c22[_0xaf5e('0x2c')][_0xaf5e('0x2b')]()]=_0x4b8c22['content'][_0xaf5e('0x2d')]();}else if(_0x4b8c22[_0xaf5e('0x29')]===_0xaf5e('0x2e')&&_0x4b8c22[_0xaf5e('0x2f')]&&_0x4b8c22[_0xaf5e('0x2c')]&&_0x4b8c22[_0xaf5e('0x2a')]){_0x1ee043[_0x4b8c22[_0xaf5e('0x2c')][_0xaf5e('0x2b')]()]=_0xb9e55c[_0x4b8c22['variableName']][_0xaf5e('0x2d')]();}else if(_0x4b8c22[_0xaf5e('0x29')]===_0xaf5e('0x30')&&_0x4b8c22[_0xaf5e('0x31')]&&_0x4b8c22[_0xaf5e('0x31')][_0xaf5e('0x32')]&&_0x4b8c22[_0xaf5e('0x2c')]&&_0x4b8c22[_0xaf5e('0x2a')]){_0x1ee043[_0x4b8c22['idField'][_0xaf5e('0x2b')]()]=_0xb9e55c[_0x4b8c22[_0xaf5e('0x31')]['name'][_0xaf5e('0x2b')]()][_0xaf5e('0x2d')]();}});}return _0x1ee043;}function getTicket(_0x2c7e0c,_0x5b19dc,_0x3e382e,_0x224494,_0x33c0cd,_0x2b66f3){return function(_0x392f58){logger['info']('['+[_0x2c7e0c['toUpperCase']()]+_0xaf5e('0x33'),_0x392f58);return new Promise(function(_0x1689e7,_0x59689a){var _0xb72229=_0x2c7e0c[_0xaf5e('0x2b')]()===_0xaf5e('0x34')?_0x392f58['userId']:_0x392f58['endUserId'];var _0x241ee5={'method':_0xaf5e('0x35'),'uri':_0x3e382e+_0xaf5e('0x36')+'?'+_0x2b66f3,'body':Object[_0xaf5e('0x37')]({},{'active':_0xaf5e('0x22'),'caller_id':_0xb72229,'assigned_to':_0x392f58[_0xaf5e('0x1d')],'short_description':intUtil[_0xaf5e('0x38')](_0x224494[_0xaf5e('0x39')],_0x33c0cd,'\x20'),'description':intUtil['getString'](_0x224494[_0xaf5e('0x3a')],_0x33c0cd,'\x0a')},getCustomFields(_0x224494['Fields'],_0x33c0cd)),'auth':_0x5b19dc,'json':!![]};return rp(_0x241ee5)['then'](function(_0x37f9d9){logger[_0xaf5e('0x10')]('['+[_0x2c7e0c[_0xaf5e('0x11')]()]+_0xaf5e('0x3b'),_0x37f9d9['result']);_0x392f58[_0xaf5e('0x3c')]=_0x37f9d9[_0xaf5e('0xc')]['sys_id'];_0x392f58[_0xaf5e('0x3d')]=_0x37f9d9[_0xaf5e('0xc')][_0xaf5e('0x3e')];logger[_0xaf5e('0x10')]('['+[_0x2c7e0c['toUpperCase']()]+_0xaf5e('0x3f'),_0x392f58);_0x1689e7(_0x392f58);})[_0xaf5e('0x13')](function(_0x4d055c){logger['error']('['+[_0x2c7e0c[_0xaf5e('0x11')]()]+']',_0x4d055c['message']);_0x59689a(_0x4d055c[_0xaf5e('0x15')]);});});};}function createRemoteTag(_0x2a9884,_0x15f31c,_0x180f57,_0xbb6fda){return new Promise(function(_0x490c23,_0x1f4d40){var _0x341b72={'method':_0xaf5e('0x35'),'uri':_0x180f57+_0xaf5e('0x40')+'?'+_0xbb6fda,'body':{'short_description':_0x2a9884,'global':!![],'active':!![],'name':_0x2a9884},'auth':_0x15f31c,'json':!![]};return rp(_0x341b72)['then'](function(_0x17b108){var _0x57bd75=_0x17b108['result'][_0xaf5e('0xf')];_0x490c23(_0x57bd75);});});}function getRemoteTag(_0x442ad9,_0x42ad02,_0x1095bc,_0x578e59,_0x2220d3){return new Promise(function(_0x34a7bc,_0x53c9ce){var _0xb2725e={'method':_0xaf5e('0xa'),'uri':_0x1095bc+_0xaf5e('0x40')+_0xaf5e('0x41')+_0x442ad9+'&'+_0x578e59,'auth':_0x42ad02,'json':!![]};return rp(_0xb2725e)['then'](function(_0x2579d0){if(_0x2579d0['result']['length']>0x0){var _0x3975ae=_0x2579d0[_0xaf5e('0xc')][0x0][_0xaf5e('0xf')];_0x34a7bc(_0x3975ae);}else{return createRemoteTag(_0x442ad9,_0x42ad02,_0x1095bc,_0x578e59)[_0xaf5e('0xb')](function(_0x2d2983){_0x34a7bc(_0x2d2983);});}});});}function assignTagToIncident(_0x17f5aa,_0x58fe01,_0x5ece0b,_0x27fe6b,_0x41741e){return new Promise(function(_0x1e3bc6,_0x59fc55){var _0x1e74cd={'method':_0xaf5e('0x35'),'uri':_0x5ece0b+_0xaf5e('0x42')+'?'+_0x41741e,'body':{'label':_0x17f5aa,'table':_0xaf5e('0x36'),'id_type':_0xaf5e('0x43'),'table_key':_0x27fe6b[_0xaf5e('0x3c')],'title':_0xaf5e('0x44')+_0x27fe6b[_0xaf5e('0x3d')],'id_display':_0x27fe6b['ticketNumber']},'auth':_0x58fe01,'json':!![]};return rp(_0x1e74cd)[_0xaf5e('0xb')](function(_0x454150){_0x1e3bc6();})[_0xaf5e('0x13')](function(){_0x1e3bc6();});});}function manageTags(_0x5a4741,_0x4047e8,_0x343e2f,_0x2f34fa,_0x151d70,_0x3ca5a1,_0xfecaa8){return new Promise(function(_0x57c1b4,_0x4ea2a0){var _0x1fb0bb=[];_0x4047e8[_0xaf5e('0x45')](function(_0xf62196){_0x1fb0bb[_0xaf5e('0x46')](getRemoteTag(_0xf62196,_0x343e2f,_0x2f34fa,_0x3ca5a1,_0xfecaa8));});return Promise[_0xaf5e('0x47')](_0x1fb0bb)[_0xaf5e('0xb')](function(_0x5e255d){if(_0x5e255d['length']){logger[_0xaf5e('0x10')]('['+[_0x5a4741[_0xaf5e('0x11')]()]+_0xaf5e('0x48'),_0x5e255d);var _0x42fbf5=[];_0x5e255d[_0xaf5e('0x45')](function(_0xf19924){_0x42fbf5[_0xaf5e('0x46')](assignTagToIncident(_0xf19924,_0x343e2f,_0x2f34fa,_0x151d70,_0x3ca5a1));});return Promise[_0xaf5e('0x47')](_0x42fbf5)['then'](function(){_0x57c1b4();})[_0xaf5e('0x13')](function(){_0x57c1b4();});}else{_0x57c1b4();}});});}function getTags(_0x120952,_0x2fb593,_0x13cc33,_0x2fed54,_0x5abfab,_0x10ce36){return function(_0x17f5d1){return new Promise(function(_0x1c2ebd,_0x291281){var _0x39e045=[];var _0x591c09=_0x2fed54[_0xaf5e('0x49')];if(_0x591c09&&_0x591c09['length']>0x0){_0x39e045=_[_0xaf5e('0x4a')](_0x591c09,_0xaf5e('0x32'));}if(_0x39e045[_0xaf5e('0xd')]>0x0){return manageTags(_0x120952,_0x39e045,_0x2fb593,_0x13cc33,_0x17f5d1,_0x5abfab,_0x10ce36)['then'](function(){_0x1c2ebd(_0x17f5d1);});}else{_0x1c2ebd(_0x17f5d1);}});};}function emit(_0x32272f,_0x4fd8a9,_0xfe548a){var _0x28fec8=_0xaf5e('0x4b')+_0xaf5e('0x4c')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xaf5e('0x4d');var _0xd6691e={'uri':_0x32272f+'/nav_to.do?uri=incident.do?sys_id%3D'+_0xfe548a+_0x28fec8};io['to'](util[_0xaf5e('0x4e')](_0xaf5e('0x4f'),_0x4fd8a9))[_0xaf5e('0x50')]('trigger:browser:url',_0xd6691e);}exports['cs']=function(_0x2ad854,_0x29c3e3,_0x20681d,_0x17f47f,_0x1dcc4c,_0x103bcd,_0xf75e5d,_0x430c5e){var _0xa98d91={};var _0x4eadee={'user':_0x103bcd[_0xaf5e('0x51')],'pass':_0x103bcd['password']};var _0x1d6f3a=_0xaf5e('0x52');var _0xb30124=_0xaf5e('0x53');_0x103bcd[_0xaf5e('0x54')]=intUtil['stripTrailingSlash'](_0x103bcd['remoteUri']);_0x103bcd['serverUrl']=intUtil[_0xaf5e('0x55')](_0x103bcd[_0xaf5e('0x56')]);var _0x3da7f8=util['format'](_0xaf5e('0x57'),_0x103bcd['remoteUri']);_0xa98d91[_0xaf5e('0x19')]=!_[_0xaf5e('0x58')](_0x17f47f)?_0x17f47f['email']:null;_0xa98d91[_0xaf5e('0x1f')]=_0x103bcd['email'];_0xa98d91[_0xaf5e('0x20')]=_0x430c5e[_0xaf5e('0x2b')]()===_0xaf5e('0x34')?_0x29c3e3[_0xaf5e('0x59')]:_0x29c3e3[_0xaf5e('0x5a')];_0xa98d91[_0xaf5e('0x5b')]=_0x430c5e===_0xaf5e('0x5c')||_0x430c5e===_0xaf5e('0x5d')?'queue':'outbound';var _0xdddbf4=util[_0xaf5e('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x103bcd[_0xaf5e('0x56')],_0x29c3e3[_0xaf5e('0x5e')],md5(_0x29c3e3[_0xaf5e('0x5e')]));if(_0x1dcc4c&&_0x1dcc4c[_0xaf5e('0x5f')]){logger[_0xaf5e('0x10')](_0xaf5e('0x60'),'Recording\x20is\x20enabled!');_0x29c3e3[_0xaf5e('0x61')]=_0xdddbf4;}else if(_0xf75e5d&&_0xf75e5d[_0xaf5e('0x62')]&&_0xf75e5d['recordingFormat']!==_0xaf5e('0x63')){logger[_0xaf5e('0x10')]('[OUTBOUND]',_0xaf5e('0x64'));_0x29c3e3[_0xaf5e('0x61')]=_0xdddbf4;}else{_0x29c3e3[_0xaf5e('0x61')]='';}return getAdminUser(_0x430c5e,_0x4eadee,_0xa98d91,_0x3da7f8,_0xb30124,_0x1d6f3a)[_0xaf5e('0xb')](getUser(_0x430c5e,_0x4eadee,_0x3da7f8,_0xb30124,_0x1d6f3a))['then'](getEndUser(_0x430c5e,_0x4eadee,_0x3da7f8,_0xb30124,_0x1d6f3a))[_0xaf5e('0xb')](getTicket(_0x430c5e,_0x4eadee,_0x3da7f8,_0x20681d,_0x29c3e3,_0xb30124))[_0xaf5e('0xb')](function(_0x47dafa){logger[_0xaf5e('0x10')](util['format'](_0xaf5e('0x65'),_0x47dafa[_0xaf5e('0x3c')]));logger[_0xaf5e('0x10')](util['format'](_0xaf5e('0x66'),_0x430c5e));if(_0x430c5e!==_0xaf5e('0x5d')){logger[_0xaf5e('0x10')]('['+[_0x430c5e[_0xaf5e('0x11')]()]+']',_0xaf5e('0x67'));emit(_0x103bcd[_0xaf5e('0x54')],_0x17f47f[_0xaf5e('0x32')],_0x47dafa[_0xaf5e('0x3c')]);}})[_0xaf5e('0x13')](function(_0x4e4d29){logger[_0xaf5e('0x14')]('['+[_0x430c5e['toUpperCase']()]+_0xaf5e('0x68'),util[_0xaf5e('0x69')](_0x4e4d29,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xba90=['Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','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','../../../../config/logger','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','sys_id','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','toString','customField','content','variable','variableName','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','label_entry','Incident','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all'];(function(_0x3917f0,_0xf857f6){var _0x5a2c29=function(_0x2005c7){while(--_0x2005c7){_0x3917f0['push'](_0x3917f0['shift']());}};_0x5a2c29(++_0xf857f6);}(_0xba90,0x9a));var _0x0ba9=function(_0x1139e9,_0x94e74b){_0x1139e9=_0x1139e9-0x0;var _0x223d21=_0xba90[_0x1139e9];return _0x223d21;};'use strict';var _=require('lodash');var Promise=require(_0x0ba9('0x0'));var rp=require(_0x0ba9('0x1'));var util=require(_0x0ba9('0x2'));var md5=require(_0x0ba9('0x3'));var Redis=require(_0x0ba9('0x4'));var intUtil=require(_0x0ba9('0x5'));var config=require(_0x0ba9('0x6'));var logger=require(_0x0ba9('0x7'))('servicenow');config[_0x0ba9('0x8')]=_[_0x0ba9('0x9')](config[_0x0ba9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0ba9('0xa'))(new Redis(config[_0x0ba9('0x8')]));function getAdminUser(_0xedd37a,_0x59de61,_0x3c8e65,_0xa91851,_0x583e22,_0xf320ca){return new Promise(function(_0x4e5c80,_0x27351e){var _0xc20ca8={'method':_0x0ba9('0xb'),'uri':_0xa91851+_0x0ba9('0xc')+'&'+_0x583e22+'&'+_0xf320ca,'auth':_0x59de61,'json':!![]};return rp(_0xc20ca8)[_0x0ba9('0xd')](function(_0x4874e5){if(_0x4874e5[_0x0ba9('0xe')][_0x0ba9('0xf')]>0x0){_0x3c8e65['adminId']=_0x4874e5[_0x0ba9('0xe')][0x0]['sys_id'];}logger['info']('['+[_0xedd37a[_0x0ba9('0x10')]()]+_0x0ba9('0x11'),_0x3c8e65);_0x4e5c80(_0x3c8e65);})[_0x0ba9('0x12')](function(_0x2476c0){logger[_0x0ba9('0x13')]('['+[_0xedd37a[_0x0ba9('0x10')]()]+']',_0x2476c0['message']);_0x27351e(_0x2476c0[_0x0ba9('0x14')]);});});}function getUser(_0x3f8d46,_0x5474de,_0x25fb3e,_0x1c1c91,_0x2a5dea){return function(_0x2a58ff){logger[_0x0ba9('0x15')]('['+[_0x3f8d46[_0x0ba9('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x2a58ff);return new Promise(function(_0x40fddf,_0x236c44){if(intUtil[_0x0ba9('0x16')](_0x2a58ff[_0x0ba9('0x17')])){var _0x1cdc67={'method':_0x0ba9('0xb'),'uri':_0x25fb3e+_0x0ba9('0x18')+_0x2a58ff[_0x0ba9('0x17')]+'&'+_0x1c1c91+'&'+_0x2a5dea,'auth':_0x5474de,'json':!![]};logger['info']('['+[_0x3f8d46['toUpperCase']()]+_0x0ba9('0x19'),_0x1cdc67);return rp(_0x1cdc67)[_0x0ba9('0xd')](function(_0x13223c){logger['info']('['+[_0x3f8d46[_0x0ba9('0x10')]()]+_0x0ba9('0x1a'),_0x13223c);if(_0x13223c['result'][_0x0ba9('0xf')]>0x0&&String(_0x13223c[_0x0ba9('0xe')][0x0]['active'])===_0x0ba9('0x1b')){_0x2a58ff[_0x0ba9('0x1c')]=_0x13223c[_0x0ba9('0xe')][0x0][_0x0ba9('0x1d')];}else{_0x2a58ff['userId']=_0x2a58ff[_0x0ba9('0x1e')];_0x2a58ff[_0x0ba9('0x17')]=_0x2a58ff[_0x0ba9('0x1f')];}logger['info']('['+[_0x3f8d46[_0x0ba9('0x10')]()]+_0x0ba9('0x20'),_0x2a58ff);_0x40fddf(_0x2a58ff);})[_0x0ba9('0x12')](function(_0x440197){logger[_0x0ba9('0x13')]('['+[_0x3f8d46[_0x0ba9('0x10')]()]+']',_0x440197['message']);_0x236c44(_0x440197[_0x0ba9('0x14')]);});}else{logger[_0x0ba9('0x15')]('['+[_0x3f8d46[_0x0ba9('0x10')]()]+_0x0ba9('0x21'));_0x2a58ff[_0x0ba9('0x1c')]=_0x2a58ff[_0x0ba9('0x1e')];_0x2a58ff[_0x0ba9('0x17')]=_0x2a58ff[_0x0ba9('0x1f')];_0x40fddf(_0x2a58ff);}});};}function createEndUser(_0xb4f107,_0x302743,_0x2bb71b,_0x4cae00,_0x2ce888){logger[_0x0ba9('0x15')]('['+[_0xb4f107[_0x0ba9('0x10')]()]+_0x0ba9('0x22'),_0x2bb71b);return new Promise(function(_0x1a8701,_0x20f79f){var _0x21a3c7={'method':'POST','uri':_0x4cae00+_0x0ba9('0x23')+_0x2ce888,'body':{'user_name':_0x2bb71b[_0x0ba9('0x24')],'roles':_0x0ba9('0x25'),'first_name':_0x2bb71b[_0x0ba9('0x24')],'active':_0x0ba9('0x1b'),'date_format':_0x0ba9('0x26'),'phone':_0x2bb71b['endUserNumber']},'auth':_0x302743,'json':!![]};return rp(_0x21a3c7)[_0x0ba9('0xd')](function(_0x3b79d2){logger[_0x0ba9('0x15')]('['+[_0xb4f107[_0x0ba9('0x10')]()]+'],\x20EndUser\x20schema',_0x3b79d2[_0x0ba9('0xe')]);_0x2bb71b[_0x0ba9('0x27')]=_0x3b79d2['result'][_0x0ba9('0x1d')];_0x1a8701(_0x2bb71b);})[_0x0ba9('0x12')](function(_0x1f49a9){logger[_0x0ba9('0x13')]('['+[_0xb4f107[_0x0ba9('0x10')]()]+']',_0x1f49a9[_0x0ba9('0x14')]);_0x20f79f(_0x1f49a9[_0x0ba9('0x14')]);});});}function getEndUser(_0x2d6b93,_0x26883c,_0x27509d,_0x5d3147,_0x5071c8){return function(_0x1a7864){logger['info']('['+[_0x2d6b93[_0x0ba9('0x10')]()]+_0x0ba9('0x28'),_0x1a7864);return new Promise(function(_0xe1b031,_0x106ac8){var _0x1c553c={'method':_0x0ba9('0xb'),'uri':_0x27509d+_0x0ba9('0x29')+_0x1a7864[_0x0ba9('0x24')]+'&'+_0x5d3147+'&'+_0x5071c8,'auth':_0x26883c,'json':!![]};return rp(_0x1c553c)['then'](function(_0x5935dc){if(_0x5935dc[_0x0ba9('0xe')][_0x0ba9('0xf')]>0x0){_0x1a7864[_0x0ba9('0x27')]=_0x5935dc[_0x0ba9('0xe')][0x0][_0x0ba9('0x1d')];logger[_0x0ba9('0x15')]('['+[_0x2d6b93[_0x0ba9('0x10')]()]+_0x0ba9('0x2a'),_0x1a7864);_0xe1b031(_0x1a7864);}else{return createEndUser(_0x2d6b93,_0x26883c,_0x1a7864,_0x27509d,_0x5d3147)['then'](function(_0x599df5){logger['info']('['+[_0x2d6b93[_0x0ba9('0x10')]()]+'],\x20createEndUser\x20crm',_0x599df5);_0xe1b031(_0x599df5);});}})['catch'](function(_0x50aa05){logger['error']('['+[_0x2d6b93[_0x0ba9('0x10')]()]+']',_0x50aa05[_0x0ba9('0x14')]);_0x106ac8(_0x50aa05[_0x0ba9('0x14')]);});});};}function getCustomFields(_0x20a889,_0x3caa0b){var _0x414bce={};if(_0x20a889['length']>0x0){_[_0x0ba9('0x2b')](_0x20a889,function(_0x39f744){if(_[_0x0ba9('0x2c')]([_0x0ba9('0x2d'),_0x0ba9('0x2e')],_0x39f744[_0x0ba9('0x2f')])&&_0x39f744['nameField']&&!_0x39f744['customField']){_0x414bce[_0x39f744[_0x0ba9('0x30')][_0x0ba9('0x31')]()]=_0x39f744['content'][_0x0ba9('0x32')]();}else if(_[_0x0ba9('0x2c')]([_0x0ba9('0x2d'),'picklist'],_0x39f744[_0x0ba9('0x2f')])&&_0x39f744['idField']&&_0x39f744[_0x0ba9('0x33')]){_0x414bce[_0x39f744['idField'][_0x0ba9('0x31')]()]=_0x39f744[_0x0ba9('0x34')][_0x0ba9('0x32')]();}else if(_0x39f744[_0x0ba9('0x2f')]===_0x0ba9('0x35')&&_0x39f744[_0x0ba9('0x36')]&&_0x39f744[_0x0ba9('0x37')]&&_0x39f744['customField']){_0x414bce[_0x39f744['idField'][_0x0ba9('0x31')]()]=_0x3caa0b[_0x39f744[_0x0ba9('0x36')]]['toString']();}else if(_0x39f744[_0x0ba9('0x2f')]===_0x0ba9('0x38')&&_0x39f744[_0x0ba9('0x39')]&&_0x39f744[_0x0ba9('0x39')]['name']&&_0x39f744[_0x0ba9('0x37')]&&_0x39f744[_0x0ba9('0x33')]){_0x414bce[_0x39f744[_0x0ba9('0x37')][_0x0ba9('0x31')]()]=_0x3caa0b[_0x39f744[_0x0ba9('0x39')][_0x0ba9('0x3a')][_0x0ba9('0x31')]()][_0x0ba9('0x32')]();}});}return _0x414bce;}function getTicket(_0x283530,_0x39a0dc,_0x596315,_0x4be3fc,_0x2c5e56,_0x324df3){return function(_0x14f1a8){logger['info']('['+[_0x283530[_0x0ba9('0x10')]()]+_0x0ba9('0x3b'),_0x14f1a8);return new Promise(function(_0x4ba532,_0x17b999){var _0x140bc0=_0x283530[_0x0ba9('0x31')]()===_0x0ba9('0x3c')?_0x14f1a8[_0x0ba9('0x1c')]:_0x14f1a8[_0x0ba9('0x27')];var _0x59193c={'method':_0x0ba9('0x3d'),'uri':_0x596315+_0x0ba9('0x3e')+'?'+_0x324df3,'body':Object[_0x0ba9('0x3f')]({},{'active':_0x0ba9('0x1b'),'caller_id':_0x140bc0,'assigned_to':_0x14f1a8['userId'],'short_description':intUtil['getString'](_0x4be3fc[_0x0ba9('0x40')],_0x2c5e56,'\x20'),'description':intUtil[_0x0ba9('0x41')](_0x4be3fc[_0x0ba9('0x42')],_0x2c5e56,'\x0a')},getCustomFields(_0x4be3fc[_0x0ba9('0x43')],_0x2c5e56)),'auth':_0x39a0dc,'json':!![]};return rp(_0x59193c)[_0x0ba9('0xd')](function(_0x4facd2){logger['info']('['+[_0x283530[_0x0ba9('0x10')]()]+_0x0ba9('0x44'),_0x4facd2['result']);_0x14f1a8[_0x0ba9('0x45')]=_0x4facd2[_0x0ba9('0xe')]['sys_id'];_0x14f1a8[_0x0ba9('0x46')]=_0x4facd2[_0x0ba9('0xe')][_0x0ba9('0x47')];logger[_0x0ba9('0x15')]('['+[_0x283530[_0x0ba9('0x10')]()]+']\x20getTicket\x20crm',_0x14f1a8);_0x4ba532(_0x14f1a8);})['catch'](function(_0x4a329c){logger[_0x0ba9('0x13')]('['+[_0x283530[_0x0ba9('0x10')]()]+']',_0x4a329c[_0x0ba9('0x14')]);_0x17b999(_0x4a329c['message']);});});};}function createRemoteTag(_0x343b10,_0x163900,_0x19b222,_0x2cb099){return new Promise(function(_0x16416a,_0x2fa38f){var _0x2ad101={'method':_0x0ba9('0x3d'),'uri':_0x19b222+'label'+'?'+_0x2cb099,'body':{'short_description':_0x343b10,'global':!![],'active':!![],'name':_0x343b10},'auth':_0x163900,'json':!![]};return rp(_0x2ad101)['then'](function(_0x28519d){var _0x4123ce=_0x28519d[_0x0ba9('0xe')][_0x0ba9('0x1d')];_0x16416a(_0x4123ce);});});}function getRemoteTag(_0x13bf5f,_0x1b2a6b,_0x1f6c00,_0x5e1f0a,_0x1a9d90){return new Promise(function(_0x576dfe,_0x19eb95){var _0x1957f2={'method':_0x0ba9('0xb'),'uri':_0x1f6c00+_0x0ba9('0x48')+'?sysparm_query=name%3D'+_0x13bf5f+'&'+_0x5e1f0a,'auth':_0x1b2a6b,'json':!![]};return rp(_0x1957f2)[_0x0ba9('0xd')](function(_0x41b625){if(_0x41b625['result']['length']>0x0){var _0x1159c3=_0x41b625[_0x0ba9('0xe')][0x0][_0x0ba9('0x1d')];_0x576dfe(_0x1159c3);}else{return createRemoteTag(_0x13bf5f,_0x1b2a6b,_0x1f6c00,_0x5e1f0a)[_0x0ba9('0xd')](function(_0x4f34ef){_0x576dfe(_0x4f34ef);});}});});}function assignTagToIncident(_0xfa663b,_0x405667,_0x58f2ff,_0x143e0b,_0x4418ca){return new Promise(function(_0x100b27,_0xa9fc1f){var _0x3074c4={'method':'POST','uri':_0x58f2ff+_0x0ba9('0x49')+'?'+_0x4418ca,'body':{'label':_0xfa663b,'table':_0x0ba9('0x3e'),'id_type':_0x0ba9('0x4a'),'table_key':_0x143e0b['ticketId'],'title':'Incident\x20-\x20'+_0x143e0b['ticketNumber'],'id_display':_0x143e0b[_0x0ba9('0x46')]},'auth':_0x405667,'json':!![]};return rp(_0x3074c4)['then'](function(_0x4393a5){_0x100b27();})[_0x0ba9('0x12')](function(){_0x100b27();});});}function manageTags(_0x329dc0,_0x1819f8,_0x213b9e,_0x4a1554,_0x74cbd2,_0x36c894,_0x495d6b){return new Promise(function(_0x3ff08d,_0x599ca5){var _0x54b966=[];_0x1819f8[_0x0ba9('0x2b')](function(_0x410668){_0x54b966[_0x0ba9('0x4b')](getRemoteTag(_0x410668,_0x213b9e,_0x4a1554,_0x36c894,_0x495d6b));});return Promise['all'](_0x54b966)[_0x0ba9('0xd')](function(_0x8124f7){if(_0x8124f7[_0x0ba9('0xf')]){logger[_0x0ba9('0x15')]('['+[_0x329dc0[_0x0ba9('0x10')]()]+_0x0ba9('0x4c'),_0x8124f7);var _0x2aced6=[];_0x8124f7['forEach'](function(_0x4e4e06){_0x2aced6[_0x0ba9('0x4b')](assignTagToIncident(_0x4e4e06,_0x213b9e,_0x4a1554,_0x74cbd2,_0x36c894));});return Promise[_0x0ba9('0x4d')](_0x2aced6)[_0x0ba9('0xd')](function(){_0x3ff08d();})[_0x0ba9('0x12')](function(){_0x3ff08d();});}else{_0x3ff08d();}});});}function getTags(_0x8e5903,_0x277868,_0x4c2ee5,_0x36e95c,_0x43d684,_0x525f5c){return function(_0x1e03b4){return new Promise(function(_0x3425fc,_0x4e568c){var _0x13e1b8=[];var _0x216539=_0x36e95c[_0x0ba9('0x4e')];if(_0x216539&&_0x216539[_0x0ba9('0xf')]>0x0){_0x13e1b8=_[_0x0ba9('0x4f')](_0x216539,_0x0ba9('0x3a'));}if(_0x13e1b8[_0x0ba9('0xf')]>0x0){return manageTags(_0x8e5903,_0x13e1b8,_0x277868,_0x4c2ee5,_0x1e03b4,_0x43d684,_0x525f5c)['then'](function(){_0x3425fc(_0x1e03b4);});}else{_0x3425fc(_0x1e03b4);}});};}function emit(_0x1e5b49,_0x443cff,_0x447e9f){var _0x330940=_0x0ba9('0x50')+_0x0ba9('0x51')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x0ba9('0x52');var _0x13227a={'uri':_0x1e5b49+_0x0ba9('0x53')+_0x447e9f+_0x330940};io['to'](util['format'](_0x0ba9('0x54'),_0x443cff))[_0x0ba9('0x55')](_0x0ba9('0x56'),_0x13227a);}exports['cs']=function(_0x37e1be,_0x269636,_0x5cda4e,_0x2ff85a,_0x580f35,_0x566460,_0x2e44bf,_0x1e1cec){var _0x36b475={};var _0x2c7e61={'user':_0x566460[_0x0ba9('0x57')],'pass':_0x566460[_0x0ba9('0x58')]};var _0x5382cc='sysparm_limit=1';var _0x5ca67c=_0x0ba9('0x59');_0x566460['remoteUri']=intUtil[_0x0ba9('0x5a')](_0x566460[_0x0ba9('0x5b')]);_0x566460[_0x0ba9('0x5c')]=intUtil[_0x0ba9('0x5a')](_0x566460[_0x0ba9('0x5c')]);var _0x5404c0=util['format'](_0x0ba9('0x5d'),_0x566460[_0x0ba9('0x5b')]);_0x36b475[_0x0ba9('0x17')]=!_[_0x0ba9('0x5e')](_0x2ff85a)?_0x2ff85a[_0x0ba9('0x5f')]:null;_0x36b475['adminEmail']=_0x566460[_0x0ba9('0x5f')];_0x36b475[_0x0ba9('0x24')]=_0x1e1cec[_0x0ba9('0x31')]()===_0x0ba9('0x3c')?_0x269636[_0x0ba9('0x60')]:_0x269636[_0x0ba9('0x61')];_0x36b475[_0x0ba9('0x62')]=_0x1e1cec===_0x0ba9('0x63')||_0x1e1cec==='unmanaged'?_0x0ba9('0x63'):_0x0ba9('0x3c');var _0x248a7c=util[_0x0ba9('0x64')](_0x0ba9('0x65'),_0x566460[_0x0ba9('0x5c')],_0x269636[_0x0ba9('0x66')],md5(_0x269636[_0x0ba9('0x66')]));if(_0x580f35&&_0x580f35[_0x0ba9('0x67')]){logger[_0x0ba9('0x15')](_0x0ba9('0x68'),_0x0ba9('0x69'));_0x269636['recordingURL']=_0x248a7c;}else if(_0x2e44bf&&_0x2e44bf[_0x0ba9('0x6a')]&&_0x2e44bf[_0x0ba9('0x6a')]!==_0x0ba9('0x6b')){logger[_0x0ba9('0x15')](_0x0ba9('0x6c'),'Recording\x20is\x20enabled!');_0x269636[_0x0ba9('0x6d')]=_0x248a7c;}else{_0x269636[_0x0ba9('0x6d')]='';}return getAdminUser(_0x1e1cec,_0x2c7e61,_0x36b475,_0x5404c0,_0x5ca67c,_0x5382cc)['then'](getUser(_0x1e1cec,_0x2c7e61,_0x5404c0,_0x5ca67c,_0x5382cc))[_0x0ba9('0xd')](getEndUser(_0x1e1cec,_0x2c7e61,_0x5404c0,_0x5ca67c,_0x5382cc))['then'](getTicket(_0x1e1cec,_0x2c7e61,_0x5404c0,_0x5cda4e,_0x269636,_0x5ca67c))[_0x0ba9('0xd')](function(_0x59baa8){logger['info'](util['format'](_0x0ba9('0x6e'),_0x59baa8[_0x0ba9('0x45')]));logger['info'](util[_0x0ba9('0x64')](_0x0ba9('0x6f'),_0x1e1cec));if(_0x1e1cec!==_0x0ba9('0x70')){logger[_0x0ba9('0x15')]('['+[_0x1e1cec[_0x0ba9('0x10')]()]+']',_0x0ba9('0x71'));emit(_0x566460[_0x0ba9('0x5b')],_0x2ff85a['name'],_0x59baa8[_0x0ba9('0x45')]);}})['catch'](function(_0xf30c3c){logger[_0x0ba9('0x13')]('['+[_0x1e1cec[_0x0ba9('0x10')]()]+_0x0ba9('0x72'),util[_0x0ba9('0x73')](_0xf30c3c,{'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 273bc7b..5b79bf2 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 _0x448e=['destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','isNil','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','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','customField','nameField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat'];(function(_0x1de8ad,_0x401abf){var _0x3100a1=function(_0x380b2){while(--_0x380b2){_0x1de8ad['push'](_0x1de8ad['shift']());}};_0x3100a1(++_0x401abf);}(_0x448e,0x174));var _0xe448=function(_0xa7879c,_0x4dc1d9){_0xa7879c=_0xa7879c-0x0;var _0x576d61=_0x448e[_0xa7879c];return _0x576d61;};'use strict';var _=require(_0xe448('0x0'));var rp=require(_0xe448('0x1'));var BPromise=require(_0xe448('0x2'));var md5=require(_0xe448('0x3'));var util=require(_0xe448('0x4'));var Redis=require(_0xe448('0x5'));var intUtil=require(_0xe448('0x6'));var config=require(_0xe448('0x7'));var logger=require('../../../../config/logger')(_0xe448('0x8'));config[_0xe448('0x9')]=_[_0xe448('0xa')](config[_0xe448('0x9')],{'host':_0xe448('0xb'),'port':0x18eb});var io=require(_0xe448('0xc'))(new Redis(config[_0xe448('0x9')]));var def={'method':_0xe448('0xd'),'json':!![]};function emit(_0x1e4f1e,_0x45b24c,_0x413edc){io['to'](_0x1e4f1e)['emit'](_0x45b24c,_0x413edc);}function getTicket(_0x5c0991,_0x1def00,_0x2ce093,_0x56471a,_0x12cfc2,_0x520c83,_0x37c0b9,_0x4bf42e){logger['info'](_0xe448('0xe'));var _0x1e6527=new Date();var _0x20a952=[{'name':_0xe448('0xf'),'value':intUtil[_0xe448('0x10')](_0x56471a['Subjects'],_0x12cfc2,'\x20')},{'name':_0xe448('0x11'),'value':_0x1def00['id']},{'name':'created_by','value':_0x1def00['id']},{'name':_0xe448('0x12'),'value':intUtil[_0xe448('0x10')](_0x56471a['Descriptions'],_0x12cfc2,'\x0a')},{'name':_0xe448('0x13'),'value':_0x1e6527[_0xe448('0x14')]()[_0xe448('0x15')](0x0,0x13)[_0xe448('0x16')]('T','\x20')},{'name':_0xe448('0x17'),'value':'0'},{'name':_0xe448('0x18'),'value':'15'},{'name':_0xe448('0x19'),'value':_0x2ce093['id']},{'name':_0xe448('0x1a'),'value':_0xe448('0x1b')},{'name':'parent_name','value':_0x2ce093['name']},{'name':'direction','value':_0x4bf42e}];if(_0x520c83[_0xe448('0x1c')]){_[_0xe448('0x1d')](_0x520c83,function(_0x597d00){if(_0x12cfc2[_0x597d00[_0xe448('0x1e')]]){_0x20a952[_0xe448('0x1f')]({'name':_0x597d00[_0xe448('0x20')],'value':_0x12cfc2[_0x597d00[_0xe448('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xe448('0x21'),'response_type':'JSON','rest_data':JSON[_0xe448('0x22')]({'session':_0x37c0b9['id'],'module_name':_0xe448('0x23'),'name_value_list':_0x20a952})}});}function getAuth(_0x146f6b){return util[_0xe448('0x24')](_0xe448('0x25'),new Buffer(_0x146f6b['apiKey']+':X')[_0xe448('0x26')]('base64'));}function getServerInfo(_0x435ee5){return request({'form':{'method':_0xe448('0x27'),'input_type':'JSON','response_type':_0xe448('0x21'),'rest_data':JSON['stringify']({'session':_0x435ee5['id']})}});}function getUser(_0x1c1a34,_0x3cefc3,_0x24a043){if(!_[_0xe448('0x28')](_0x3cefc3)){logger[_0xe448('0x29')](_0xe448('0x2a'),_0x3cefc3);return request({'form':{'method':_0xe448('0x2b'),'input_type':_0xe448('0x21'),'response_type':_0xe448('0x21'),'rest_data':JSON['stringify']({'session':_0x24a043['id'],'module_name':_0xe448('0x2c'),'query':util[_0xe448('0x24')](_0xe448('0x2d'),_0x3cefc3),'order_by':'','offset':'0','select_fields':['id','name',_0xe448('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe448('0x2f')](function(_0x180044){if(_0x180044[_0xe448('0x30')]['length']){var _0x462bd5=_[_0xe448('0x31')](_0x180044[_0xe448('0x30')],function(_0x52ae4d){return _0x52ae4d[_0xe448('0x32')][_0xe448('0x2e')][_0xe448('0x33')]===_0x3cefc3;});if(_0x462bd5){logger['info'](_0xe448('0x34'));return BPromise[_0xe448('0x35')]({'id':_0x462bd5[_0xe448('0x32')]['id']['value'],'name':_0x462bd5['name_value_list'][_0xe448('0xf')][_0xe448('0x33')]});}}logger['info'](_0xe448('0x36'));return BPromise[_0xe448('0x35')]({'id':_0x24a043[_0xe448('0x32')][_0xe448('0x37')][_0xe448('0x33')],'name':_0x24a043[_0xe448('0x32')]['user_name']['value']});});}else{logger[_0xe448('0x29')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe448('0x35')]({'id':_0x24a043[_0xe448('0x32')][_0xe448('0x37')][_0xe448('0x33')],'name':_0x24a043[_0xe448('0x32')]['user_name'][_0xe448('0x33')]});}}function getEndUser(_0x177bc3,_0x308229,_0x381bd6,_0x5c9a05){logger[_0xe448('0x29')](_0xe448('0x38'),_0x381bd6);return request({'form':{'method':_0xe448('0x2b'),'input_type':_0xe448('0x21'),'response_type':_0xe448('0x21'),'rest_data':JSON[_0xe448('0x22')]({'session':_0x5c9a05['id'],'module_name':_0xe448('0x1b'),'query':util[_0xe448('0x24')](_0xe448('0x39'),_0x381bd6),'order_by':'','offset':'0','select_fields':['id',_0xe448('0xf'),_0xe448('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe448('0x2f')](function(_0x12b24c){if(_0x12b24c['entry_list'][_0xe448('0x1c')]){var _0x282482=_[_0xe448('0x31')](_0x12b24c[_0xe448('0x30')],function(_0x25848f){return _0x25848f[_0xe448('0x32')][_0xe448('0x3a')]['value']===_0x381bd6;});if(_0x282482){logger['info'](_0xe448('0x3b'));return BPromise[_0xe448('0x35')]({'id':_0x282482['name_value_list']['id'][_0xe448('0x33')],'name':_0x282482[_0xe448('0x32')]['name'][_0xe448('0x33')],'phone':_0x282482[_0xe448('0x32')]['phone_home']['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xe448('0x3c'),'input_type':_0xe448('0x21'),'response_type':_0xe448('0x21'),'rest_data':JSON[_0xe448('0x22')]({'session':_0x5c9a05['id'],'module_name':_0xe448('0x1b'),'name_value_list':[{'name':_0xe448('0x3d'),'value':_0x308229!==_0xe448('0x3e')?_0x308229:util[_0xe448('0x24')]('Caller\x20-\x20%s',_0x381bd6)},{'name':'phone_home','value':_0x381bd6}]})}})[_0xe448('0x2f')](function(_0x268be5){logger[_0xe448('0x29')](_0xe448('0x3f'));return BPromise[_0xe448('0x35')]({'id':_0x268be5['id'],'name':_0x268be5[_0xe448('0x30')][_0xe448('0x3d')][_0xe448('0x33')],'phone':_0x268be5[_0xe448('0x30')][_0xe448('0x3a')][_0xe448('0x33')]});});}});}function request(_0x2d712d){logger[_0xe448('0x40')](_0xe448('0x41'),JSON[_0xe448('0x22')](_0x2d712d));return rp(_[_0xe448('0x42')](def,_0x2d712d));}function getTags(_0xc390ce,_0x3c1af6){var _0x3d1e6a=[];if(_0xc390ce&&_0xc390ce['length']>0x0){_0x3d1e6a=_[_0xe448('0x43')](_0xc390ce,_0x3c1af6);}return _0x3d1e6a;}function getCustomFields(_0x3e46fa,_0xec6079){var _0x2894a2=[];var _0xed3e8e={'custom_fields':[]};if(_0x3e46fa[_0xe448('0x1c')]>0x0){_[_0xe448('0x1d')](_0x3e46fa,function(_0x1f4c9f){if(_0x1f4c9f[_0xe448('0x44')]==='string'&&_0x1f4c9f['nameField']&&!_0x1f4c9f[_0xe448('0x45')]){_0xed3e8e[_0x1f4c9f[_0xe448('0x46')][_0xe448('0x47')]()]=_0x1f4c9f['content'][_0xe448('0x26')]();}else if(_0x1f4c9f['type']==='string'&&_0x1f4c9f['idField']&&_0x1f4c9f[_0xe448('0x45')]){_0xed3e8e[_0xe448('0x48')][_0xe448('0x1f')]({'id':_0x1f4c9f[_0xe448('0x20')],'value':_0x1f4c9f[_0xe448('0x49')][_0xe448('0x26')]()});}else if(_0x1f4c9f[_0xe448('0x44')]===_0xe448('0x4a')&&_0x1f4c9f[_0xe448('0x1e')]&&_0x1f4c9f[_0xe448('0x20')]&&_0x1f4c9f['customField']){_0xec6079[_0x1f4c9f[_0xe448('0x1e')]]&&_0xed3e8e[_0xe448('0x48')]['push']({'id':_0x1f4c9f['idField'],'value':_0xec6079[_0x1f4c9f['variableName']][_0xe448('0x26')]()});}else if(_0x1f4c9f[_0xe448('0x44')]===_0xe448('0x4b')&&_0x1f4c9f['Variable']&&_0x1f4c9f[_0xe448('0x4c')][_0xe448('0xf')]&&_0x1f4c9f['idField']&&_0x1f4c9f[_0xe448('0x45')]){_0xec6079[_0x1f4c9f[_0xe448('0x4c')][_0xe448('0xf')][_0xe448('0x47')]()]&&_0xed3e8e[_0xe448('0x48')][_0xe448('0x1f')]({'id':_0x1f4c9f['idField'],'value':_0xec6079[_0x1f4c9f[_0xe448('0x4c')][_0xe448('0xf')][_0xe448('0x47')]()]['toString']()});}});}return _0xed3e8e;}function getConnection(_0x32f278){return request({'method':_0xe448('0xd'),'form':{'method':_0xe448('0x4d'),'input_type':_0xe448('0x21'),'response_type':_0xe448('0x21'),'rest_data':JSON[_0xe448('0x22')]({'user_auth':{'user_name':_0x32f278[_0xe448('0x4e')],'password':_0x32f278[_0xe448('0x4f')],'encryption':_0xe448('0x50')},'application':_0xe448('0x51')})}})['then'](function(_0x3cea5a){var _0x5286d0=_0x3cea5a;if(_0x5286d0['id']){def['sessionID']=_0x5286d0['id'];return BPromise[_0xe448('0x35')](_0x5286d0);}else{throw new Error(util[_0xe448('0x24')](_0xe448('0x52'),_0x32f278['id']));}});}function setRelationship(_0x441e87,_0x237966,_0x44151d,_0x1cbcc2){return request({'form':{'method':_0xe448('0x53'),'input_type':_0xe448('0x21'),'response_type':_0xe448('0x21'),'rest_data':JSON[_0xe448('0x22')]({'session':_0x441e87['id'],'module_name':'Calls','module_id':_0x44151d['id'],'link_field_name':_0x1cbcc2,'related_ids':[_0x237966['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe448('0x54')]=function(_0xf9ecec,_0x116ca6,_0x7e86d,_0xf44706,_0x467504,_0x285d68){var _0x24bc14,_0x51573b,_0x2a95bc,_0x43795b;_0x285d68['remoteUri']=intUtil['stripTrailingSlash'](_0x285d68[_0xe448('0x55')]);_0x285d68[_0xe448('0x56')]=intUtil[_0xe448('0x57')](_0x285d68[_0xe448('0x56')]);def[_0xe448('0x58')]=util[_0xe448('0x24')](_0xe448('0x59'),_0x285d68[_0xe448('0x55')]);if(_0x467504&&_0x467504['monitor_format']){logger[_0xe448('0x29')](_0xe448('0x5a'),_0xe448('0x5b'));_0x116ca6['recordingURL']=util[_0xe448('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x285d68[_0xe448('0x56')],_0x116ca6[_0xe448('0x5c')],md5(_0x116ca6[_0xe448('0x5c')]));}else{_0x116ca6[_0xe448('0x5d')]='';}return getConnection(_0x285d68)['then'](function(_0x5c2688){_0x43795b=_0x5c2688;return getUser(_0x285d68,_0xf44706[_0xe448('0xf')],_0x43795b);})[_0xe448('0x2f')](function(_0x2cc653){_0x24bc14=_0x2cc653;logger[_0xe448('0x29')](_0xe448('0x5e'),_0x24bc14['id']);return getEndUser(_0x285d68,_0x116ca6[_0xe448('0x5f')],_0x116ca6[_0xe448('0x60')],_0x43795b);})[_0xe448('0x2f')](function(_0x234b10){_0x51573b=_0x234b10;logger['info']('The\x20Enduser\x20ID\x20is:',_0x51573b['id']);return getTicket(_0x285d68,_0x24bc14,_0x51573b,_0x7e86d,_0x116ca6,_0x7e86d[_0xe448('0x61')],_0x43795b,'Inbound');})[_0xe448('0x2f')](function(_0x18fa3d){_0x2a95bc=_0x18fa3d;logger['info'](_0xe448('0x62'));logger['info'](_0xe448('0x63'),_0x2a95bc['id']);return setRelationship(_0x43795b,_0x24bc14,_0x2a95bc,'users');})[_0xe448('0x2f')](function(){return setRelationship(_0x43795b,_0x51573b,_0x2a95bc,'contacts');})[_0xe448('0x2f')](function(){return getServerInfo(_0x43795b);})[_0xe448('0x2f')](function(_0x5468e0){var _0x9f8d8c=parseInt(_0x5468e0[_0xe448('0x64')][_0xe448('0x65')](0x0));var _0x1916b7=util[_0xe448('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x285d68[_0xe448('0x55')],_0x2a95bc['id']);if(_0x9f8d8c>0x6){_0x1916b7=util[_0xe448('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x285d68[_0xe448('0x55')],_0x2a95bc['id']);}logger[_0xe448('0x29')](_0xe448('0x5a'),_0xe448('0x66'));emit(util[_0xe448('0x24')](_0xe448('0x67'),_0xf44706[_0xe448('0xf')]),_0xe448('0x68'),{'uri':_0x1916b7});})[_0xe448('0x69')](function(_0x349b3e){logger[_0xe448('0x6a')](_0xe448('0x5a'),JSON[_0xe448('0x22')](_0x349b3e));});};exports['outbound']=function(_0x524889,_0x3cad1d,_0x5ba9e1,_0xb23877,_0x480dcb,_0x514c53,_0x246ef7){var _0x72a2dd,_0x1aa0b1,_0x2f0e87,_0x21f293;_0x514c53['remoteUri']=intUtil[_0xe448('0x57')](_0x514c53[_0xe448('0x55')]);_0x514c53['serverUrl']=intUtil['stripTrailingSlash'](_0x514c53['serverUrl']);def[_0xe448('0x58')]=util[_0xe448('0x24')]('%s/service/v4_1/rest.php',_0x514c53[_0xe448('0x55')]);if(_0x246ef7&&_0x246ef7['recordingFormat']&&_0x246ef7[_0xe448('0x6b')]!=='none'){logger[_0xe448('0x29')]('[OUTBOUND]',_0xe448('0x5b'));_0x3cad1d[_0xe448('0x5d')]=util[_0xe448('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x514c53[_0xe448('0x56')],_0x3cad1d[_0xe448('0x5c')],md5(_0x3cad1d[_0xe448('0x5c')]));}return getConnection(_0x514c53)[_0xe448('0x2f')](function(_0x110204){_0x21f293=_0x110204;return getUser(_0x514c53,_0xb23877['name'],_0x21f293);})[_0xe448('0x2f')](function(_0x1835cc){_0x72a2dd=_0x1835cc;logger[_0xe448('0x29')](_0xe448('0x5e'),_0x72a2dd['id']);return getEndUser(_0x514c53,_0x3cad1d['destcalleridname'],_0x3cad1d[_0xe448('0x6c')],_0x21f293);})[_0xe448('0x2f')](function(_0x36a7f4){_0x1aa0b1=_0x36a7f4;logger[_0xe448('0x29')](_0xe448('0x6d'),_0x1aa0b1['id']);return getTicket(_0x514c53,_0x72a2dd,_0x1aa0b1,_0x5ba9e1,_0x3cad1d,_0x5ba9e1[_0xe448('0x61')],_0x21f293,_0xe448('0x6e'));})[_0xe448('0x2f')](function(_0x15bcb7){_0x2f0e87=_0x15bcb7;logger['info'](_0xe448('0x62'));logger['info'](_0xe448('0x63'),_0x2f0e87['id']);return setRelationship(_0x21f293,_0x72a2dd,_0x2f0e87,_0xe448('0x6f'));})[_0xe448('0x2f')](function(){return setRelationship(_0x21f293,_0x1aa0b1,_0x2f0e87,_0xe448('0x70'));})['then'](function(){return getServerInfo(_0x21f293);})[_0xe448('0x2f')](function(_0x55d6cc){var _0x30d6e0=parseInt(_0x55d6cc[_0xe448('0x64')][_0xe448('0x65')](0x0));var _0x33d554=util[_0xe448('0x24')](_0xe448('0x71'),_0x514c53[_0xe448('0x55')],_0x2f0e87['id']);if(_0x30d6e0>0x6){_0x33d554=util[_0xe448('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x514c53[_0xe448('0x55')],_0x2f0e87['id']);}logger['info'](_0xe448('0x72'),_0xe448('0x66'));emit(util[_0xe448('0x24')](_0xe448('0x67'),_0xb23877['name']),_0xe448('0x68'),{'uri':_0x33d554});})[_0xe448('0x69')](function(_0x37707a){logger[_0xe448('0x6a')]('[OUTBOUND]',JSON[_0xe448('0x22')](_0x37707a));});};exports[_0xe448('0x73')]=function(_0x5da977,_0x33c3d5,_0x17dc4c,_0x27f5d6,_0x3787f0,_0x43a5f6){var _0x333fc4,_0x3dc83d,_0x4fb065,_0x2f4485;_0x43a5f6[_0xe448('0x55')]=intUtil[_0xe448('0x57')](_0x43a5f6['remoteUri']);_0x43a5f6[_0xe448('0x56')]=intUtil['stripTrailingSlash'](_0x43a5f6[_0xe448('0x56')]);def[_0xe448('0x58')]=util[_0xe448('0x24')](_0xe448('0x59'),_0x43a5f6[_0xe448('0x55')]);if(_0x3787f0&&_0x3787f0[_0xe448('0x74')]){logger[_0xe448('0x29')]('['+_0x33c3d5['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x33c3d5[_0xe448('0x5d')]=util[_0xe448('0x24')](_0xe448('0x75'),_0x43a5f6[_0xe448('0x56')],_0x33c3d5[_0xe448('0x5c')],md5(_0x33c3d5[_0xe448('0x5c')]));}else{_0x33c3d5[_0xe448('0x5d')]='';}return getConnection(_0x43a5f6)[_0xe448('0x2f')](function(_0x220fa4){_0x2f4485=_0x220fa4;if(!_[_0xe448('0x28')](_0x27f5d6)){return getUser(_0x43a5f6,_0x27f5d6[_0xe448('0xf')],_0x2f4485);}else{return getUser(_0x43a5f6,null,_0x2f4485);}})[_0xe448('0x2f')](function(_0x35389a){_0x333fc4=_0x35389a;logger[_0xe448('0x29')](_0xe448('0x5e'),_0x333fc4['id']);return getEndUser(_0x43a5f6,_0x33c3d5[_0xe448('0x5f')],_0x33c3d5[_0xe448('0x60')],_0x2f4485);})[_0xe448('0x2f')](function(_0x509bc5){_0x3dc83d=_0x509bc5;logger[_0xe448('0x29')]('The\x20Enduser\x20ID\x20is:',_0x3dc83d['id']);return getTicket(_0x43a5f6,_0x333fc4,_0x3dc83d,_0x17dc4c,_0x33c3d5,_0x17dc4c[_0xe448('0x61')],_0x2f4485,'Inbound');})['then'](function(_0x223bb5){_0x4fb065=_0x223bb5;logger[_0xe448('0x29')](_0xe448('0x62'));logger[_0xe448('0x29')](_0xe448('0x63'),_0x4fb065['id']);return setRelationship(_0x2f4485,_0x333fc4,_0x4fb065,_0xe448('0x6f'));})[_0xe448('0x2f')](function(){return setRelationship(_0x2f4485,_0x3dc83d,_0x4fb065,_0xe448('0x70'));})[_0xe448('0x2f')](function(){return getServerInfo(_0x2f4485);})[_0xe448('0x69')](function(_0x483ac2){logger['error']('['+_0x33c3d5[_0xe448('0x76')][_0xe448('0x77')]()+']',JSON[_0xe448('0x22')](_0x483ac2));});}; \ No newline at end of file +var _0x736f=['','format','Enduser\x20created.','first_name','debug','merge','nameField','customField','content','string','custom_fields','idField','type','customVariable','Variable','toLowerCase','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','[QUEUE]','outbound','recordingFormat','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','uri','lastevent','calleridname','calleridnum','contacts','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','date_start','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','then','entry_list','length','find','value','info','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x154088,_0x542926){var _0x17b264=function(_0x30de30){while(--_0x30de30){_0x154088['push'](_0x154088['shift']());}};_0x17b264(++_0x542926);}(_0x736f,0xad));var _0xf736=function(_0x1aa444,_0x4d6b5f){_0x1aa444=_0x1aa444-0x0;var _0xb36b20=_0x736f[_0x1aa444];return _0xb36b20;};'use strict';var _=require('lodash');var rp=require(_0xf736('0x0'));var BPromise=require(_0xf736('0x1'));var md5=require(_0xf736('0x2'));var util=require(_0xf736('0x3'));var Redis=require(_0xf736('0x4'));var intUtil=require(_0xf736('0x5'));var config=require(_0xf736('0x6'));var logger=require(_0xf736('0x7'))(_0xf736('0x8'));config[_0xf736('0x9')]=_[_0xf736('0xa')](config['redis'],{'host':_0xf736('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf736('0x9')]));var def={'method':_0xf736('0xc'),'json':!![]};function emit(_0x428824,_0x49ff51,_0x451efb){io['to'](_0x428824)[_0xf736('0xd')](_0x49ff51,_0x451efb);}function getTicket(_0x4e859b,_0x435e8f,_0x25ab93,_0x2a0bcf,_0x4f00d9,_0x3f2bce,_0x25ecc0,_0xdb5119){logger['info'](_0xf736('0xe'));var _0x4a68bb=new Date();var _0xb81d96=[{'name':_0xf736('0xf'),'value':intUtil[_0xf736('0x10')](_0x2a0bcf[_0xf736('0x11')],_0x4f00d9,'\x20')},{'name':_0xf736('0x12'),'value':_0x435e8f['id']},{'name':_0xf736('0x13'),'value':_0x435e8f['id']},{'name':'description','value':intUtil['getString'](_0x2a0bcf['Descriptions'],_0x4f00d9,'\x0a')},{'name':_0xf736('0x14'),'value':_0x4a68bb['toISOString']()['slice'](0x0,0x13)[_0xf736('0x15')]('T','\x20')},{'name':_0xf736('0x16'),'value':'0'},{'name':_0xf736('0x17'),'value':'15'},{'name':_0xf736('0x18'),'value':_0x25ab93['id']},{'name':_0xf736('0x19'),'value':_0xf736('0x1a')},{'name':_0xf736('0x1b'),'value':_0x25ab93[_0xf736('0xf')]},{'name':_0xf736('0x1c'),'value':_0xdb5119}];if(_0x3f2bce['length']){_[_0xf736('0x1d')](_0x3f2bce,function(_0x369631){if(_0x4f00d9[_0x369631[_0xf736('0x1e')]]){_0xb81d96[_0xf736('0x1f')]({'name':_0x369631['idField'],'value':_0x4f00d9[_0x369631['variableName']]});}});}return request({'form':{'method':_0xf736('0x20'),'input_type':_0xf736('0x21'),'response_type':_0xf736('0x21'),'rest_data':JSON[_0xf736('0x22')]({'session':_0x25ecc0['id'],'module_name':_0xf736('0x23'),'name_value_list':_0xb81d96})}});}function getAuth(_0x1ed0fe){return util['format']('Basic\x20%s',new Buffer(_0x1ed0fe[_0xf736('0x24')]+':X')[_0xf736('0x25')](_0xf736('0x26')));}function getServerInfo(_0x4e169b){return request({'form':{'method':_0xf736('0x27'),'input_type':'JSON','response_type':_0xf736('0x21'),'rest_data':JSON['stringify']({'session':_0x4e169b['id']})}});}function getUser(_0x1130e1,_0x13e532,_0x51d302){if(!_[_0xf736('0x28')](_0x13e532)){logger['info'](_0xf736('0x29'),_0x13e532);return request({'form':{'method':'get_entry_list','input_type':_0xf736('0x21'),'response_type':_0xf736('0x21'),'rest_data':JSON[_0xf736('0x22')]({'session':_0x51d302['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x13e532),'order_by':'','offset':'0','select_fields':['id',_0xf736('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf736('0x2a')](function(_0x537f6e){if(_0x537f6e[_0xf736('0x2b')][_0xf736('0x2c')]){var _0x2381c7=_[_0xf736('0x2d')](_0x537f6e[_0xf736('0x2b')],function(_0x1cac8a){return _0x1cac8a['name_value_list']['user_name'][_0xf736('0x2e')]===_0x13e532;});if(_0x2381c7){logger[_0xf736('0x2f')](_0xf736('0x30'));return BPromise[_0xf736('0x31')]({'id':_0x2381c7[_0xf736('0x32')]['id'][_0xf736('0x2e')],'name':_0x2381c7[_0xf736('0x32')]['name'][_0xf736('0x2e')]});}}logger[_0xf736('0x2f')](_0xf736('0x33'));return BPromise[_0xf736('0x31')]({'id':_0x51d302[_0xf736('0x32')][_0xf736('0x34')]['value'],'name':_0x51d302[_0xf736('0x32')][_0xf736('0x35')]['value']});});}else{logger[_0xf736('0x2f')](_0xf736('0x36'));return BPromise[_0xf736('0x31')]({'id':_0x51d302['name_value_list'][_0xf736('0x34')][_0xf736('0x2e')],'name':_0x51d302[_0xf736('0x32')][_0xf736('0x35')][_0xf736('0x2e')]});}}function getEndUser(_0x1e227e,_0xdc2f29,_0x100158,_0x569c9c){logger[_0xf736('0x2f')](_0xf736('0x37'),_0x100158);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xf736('0x21'),'rest_data':JSON['stringify']({'session':_0x569c9c['id'],'module_name':'Contacts','query':util['format'](_0xf736('0x38'),_0x100158),'order_by':'','offset':'0','select_fields':['id','name',_0xf736('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf736('0x2a')](function(_0x26908e){if(_0x26908e[_0xf736('0x2b')][_0xf736('0x2c')]){var _0x445ee8=_['find'](_0x26908e[_0xf736('0x2b')],function(_0x1f1ab5){return _0x1f1ab5['name_value_list'][_0xf736('0x39')][_0xf736('0x2e')]===_0x100158;});if(_0x445ee8){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x445ee8[_0xf736('0x32')]['id']['value'],'name':_0x445ee8[_0xf736('0x32')][_0xf736('0xf')][_0xf736('0x2e')],'phone':_0x445ee8['name_value_list']['phone_home'][_0xf736('0x2e')]});}}else{logger[_0xf736('0x2f')](_0xf736('0x3a'));return request({'form':{'method':'set_entry','input_type':_0xf736('0x21'),'response_type':_0xf736('0x21'),'rest_data':JSON['stringify']({'session':_0x569c9c['id'],'module_name':_0xf736('0x1a'),'name_value_list':[{'name':'first_name','value':_0xdc2f29!==_0xf736('0x3b')?_0xdc2f29:util[_0xf736('0x3c')]('Caller\x20-\x20%s',_0x100158)},{'name':_0xf736('0x39'),'value':_0x100158}]})}})[_0xf736('0x2a')](function(_0x5018c0){logger[_0xf736('0x2f')](_0xf736('0x3d'));return BPromise[_0xf736('0x31')]({'id':_0x5018c0['id'],'name':_0x5018c0[_0xf736('0x2b')][_0xf736('0x3e')]['value'],'phone':_0x5018c0[_0xf736('0x2b')][_0xf736('0x39')][_0xf736('0x2e')]});});}});}function request(_0x36a354){logger[_0xf736('0x3f')]('[HTTP]',JSON[_0xf736('0x22')](_0x36a354));return rp(_[_0xf736('0x40')](def,_0x36a354));}function getTags(_0x20fd47,_0x125cde){var _0x442289=[];if(_0x20fd47&&_0x20fd47[_0xf736('0x2c')]>0x0){_0x442289=_['map'](_0x20fd47,_0x125cde);}return _0x442289;}function getCustomFields(_0x5300a6,_0x4b0b35){var _0x586187=[];var _0x3d989a={'custom_fields':[]};if(_0x5300a6[_0xf736('0x2c')]>0x0){_['forEach'](_0x5300a6,function(_0x1a2423){if(_0x1a2423['type']==='string'&&_0x1a2423[_0xf736('0x41')]&&!_0x1a2423[_0xf736('0x42')]){_0x3d989a[_0x1a2423[_0xf736('0x41')]['toLowerCase']()]=_0x1a2423[_0xf736('0x43')][_0xf736('0x25')]();}else if(_0x1a2423['type']===_0xf736('0x44')&&_0x1a2423['idField']&&_0x1a2423['customField']){_0x3d989a[_0xf736('0x45')][_0xf736('0x1f')]({'id':_0x1a2423[_0xf736('0x46')],'value':_0x1a2423['content'][_0xf736('0x25')]()});}else if(_0x1a2423[_0xf736('0x47')]==='variable'&&_0x1a2423[_0xf736('0x1e')]&&_0x1a2423['idField']&&_0x1a2423[_0xf736('0x42')]){_0x4b0b35[_0x1a2423[_0xf736('0x1e')]]&&_0x3d989a['custom_fields'][_0xf736('0x1f')]({'id':_0x1a2423[_0xf736('0x46')],'value':_0x4b0b35[_0x1a2423[_0xf736('0x1e')]][_0xf736('0x25')]()});}else if(_0x1a2423[_0xf736('0x47')]===_0xf736('0x48')&&_0x1a2423[_0xf736('0x49')]&&_0x1a2423[_0xf736('0x49')][_0xf736('0xf')]&&_0x1a2423[_0xf736('0x46')]&&_0x1a2423['customField']){_0x4b0b35[_0x1a2423[_0xf736('0x49')][_0xf736('0xf')]['toLowerCase']()]&&_0x3d989a[_0xf736('0x45')][_0xf736('0x1f')]({'id':_0x1a2423['idField'],'value':_0x4b0b35[_0x1a2423[_0xf736('0x49')][_0xf736('0xf')][_0xf736('0x4a')]()]['toString']()});}});}return _0x3d989a;}function getConnection(_0x1a8446){return request({'method':_0xf736('0xc'),'form':{'method':_0xf736('0x4b'),'input_type':_0xf736('0x21'),'response_type':_0xf736('0x21'),'rest_data':JSON[_0xf736('0x22')]({'user_auth':{'user_name':_0x1a8446[_0xf736('0x4c')],'password':_0x1a8446['password'],'encryption':'PLAIN'},'application':_0xf736('0x4d')})}})[_0xf736('0x2a')](function(_0x1aef48){var _0x2ee30b=_0x1aef48;if(_0x2ee30b['id']){def[_0xf736('0x4e')]=_0x2ee30b['id'];return BPromise['resolve'](_0x2ee30b);}else{throw new Error(util['format'](_0xf736('0x4f'),_0x1a8446['id']));}});}function setRelationship(_0x45818a,_0x344371,_0x59e167,_0x2b5017){return request({'form':{'method':'set_relationship','input_type':_0xf736('0x21'),'response_type':_0xf736('0x21'),'rest_data':JSON['stringify']({'session':_0x45818a['id'],'module_name':_0xf736('0x23'),'module_id':_0x59e167['id'],'link_field_name':_0x2b5017,'related_ids':[_0x344371['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf736('0x50')]=function(_0x5253fc,_0x4a7b0e,_0x1991da,_0x4feec6,_0x506b68,_0x3a1c4d){var _0x2ae93c,_0x2e2583,_0x149798,_0x19b359;_0x3a1c4d[_0xf736('0x51')]=intUtil['stripTrailingSlash'](_0x3a1c4d[_0xf736('0x51')]);_0x3a1c4d[_0xf736('0x52')]=intUtil[_0xf736('0x53')](_0x3a1c4d[_0xf736('0x52')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x3a1c4d[_0xf736('0x51')]);if(_0x506b68&&_0x506b68[_0xf736('0x54')]){logger[_0xf736('0x2f')]('[QUEUE]',_0xf736('0x55'));_0x4a7b0e[_0xf736('0x56')]=util[_0xf736('0x3c')](_0xf736('0x57'),_0x3a1c4d['serverUrl'],_0x4a7b0e['uniqueid'],md5(_0x4a7b0e[_0xf736('0x58')]));}else{_0x4a7b0e[_0xf736('0x56')]='';}return getConnection(_0x3a1c4d)['then'](function(_0x48d51c){_0x19b359=_0x48d51c;return getUser(_0x3a1c4d,_0x4feec6[_0xf736('0xf')],_0x19b359);})[_0xf736('0x2a')](function(_0x5e0a7a){_0x2ae93c=_0x5e0a7a;logger[_0xf736('0x2f')]('The\x20User\x20ID\x20is:',_0x2ae93c['id']);return getEndUser(_0x3a1c4d,_0x4a7b0e['calleridname'],_0x4a7b0e['calleridnum'],_0x19b359);})[_0xf736('0x2a')](function(_0xa73c91){_0x2e2583=_0xa73c91;logger[_0xf736('0x2f')](_0xf736('0x59'),_0x2e2583['id']);return getTicket(_0x3a1c4d,_0x2ae93c,_0x2e2583,_0x1991da,_0x4a7b0e,_0x1991da[_0xf736('0x5a')],_0x19b359,_0xf736('0x5b'));})[_0xf736('0x2a')](function(_0x1810f3){_0x149798=_0x1810f3;logger[_0xf736('0x2f')](_0xf736('0x5c'));logger[_0xf736('0x2f')](_0xf736('0x5d'),_0x149798['id']);return setRelationship(_0x19b359,_0x2ae93c,_0x149798,_0xf736('0x5e'));})['then'](function(){return setRelationship(_0x19b359,_0x2e2583,_0x149798,'contacts');})[_0xf736('0x2a')](function(){return getServerInfo(_0x19b359);})['then'](function(_0x3b455){var _0x2d19e0=parseInt(_0x3b455[_0xf736('0x5f')][_0xf736('0x60')](0x0));var _0x57c940=util[_0xf736('0x3c')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3a1c4d[_0xf736('0x51')],_0x149798['id']);if(_0x2d19e0>0x6){_0x57c940=util[_0xf736('0x3c')](_0xf736('0x61'),_0x3a1c4d['remoteUri'],_0x149798['id']);}logger[_0xf736('0x2f')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf736('0x3c')](_0xf736('0x62'),_0x4feec6['name']),_0xf736('0x63'),{'uri':_0x57c940});})[_0xf736('0x64')](function(_0x1bbbd1){logger[_0xf736('0x65')](_0xf736('0x66'),JSON[_0xf736('0x22')](_0x1bbbd1));});};exports[_0xf736('0x67')]=function(_0x384315,_0x33c078,_0x4b151c,_0x32b23d,_0x58ee7d,_0x1ff117,_0x46550c){var _0x5e0a22,_0x30c877,_0xee90ae,_0x4590ec;_0x1ff117[_0xf736('0x51')]=intUtil[_0xf736('0x53')](_0x1ff117['remoteUri']);_0x1ff117[_0xf736('0x52')]=intUtil['stripTrailingSlash'](_0x1ff117[_0xf736('0x52')]);def['uri']=util[_0xf736('0x3c')]('%s/service/v4_1/rest.php',_0x1ff117[_0xf736('0x51')]);if(_0x46550c&&_0x46550c[_0xf736('0x68')]&&_0x46550c['recordingFormat']!=='none'){logger[_0xf736('0x2f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x33c078[_0xf736('0x56')]=util['format'](_0xf736('0x57'),_0x1ff117[_0xf736('0x52')],_0x33c078[_0xf736('0x58')],md5(_0x33c078[_0xf736('0x58')]));}return getConnection(_0x1ff117)[_0xf736('0x2a')](function(_0x39fd3d){_0x4590ec=_0x39fd3d;return getUser(_0x1ff117,_0x32b23d[_0xf736('0xf')],_0x4590ec);})[_0xf736('0x2a')](function(_0x1bbfa5){_0x5e0a22=_0x1bbfa5;logger['info'](_0xf736('0x69'),_0x5e0a22['id']);return getEndUser(_0x1ff117,_0x33c078[_0xf736('0x6a')],_0x33c078[_0xf736('0x6b')],_0x4590ec);})[_0xf736('0x2a')](function(_0x332bde){_0x30c877=_0x332bde;logger[_0xf736('0x2f')](_0xf736('0x59'),_0x30c877['id']);return getTicket(_0x1ff117,_0x5e0a22,_0x30c877,_0x4b151c,_0x33c078,_0x4b151c[_0xf736('0x5a')],_0x4590ec,'Outbound');})[_0xf736('0x2a')](function(_0x5b88b9){_0xee90ae=_0x5b88b9;logger['info'](_0xf736('0x5c'));logger[_0xf736('0x2f')](_0xf736('0x5d'),_0xee90ae['id']);return setRelationship(_0x4590ec,_0x5e0a22,_0xee90ae,_0xf736('0x5e'));})[_0xf736('0x2a')](function(){return setRelationship(_0x4590ec,_0x30c877,_0xee90ae,'contacts');})[_0xf736('0x2a')](function(){return getServerInfo(_0x4590ec);})[_0xf736('0x2a')](function(_0x145dfa){var _0x2bf73c=parseInt(_0x145dfa[_0xf736('0x5f')][_0xf736('0x60')](0x0));var _0x33b1fe=util['format'](_0xf736('0x6c'),_0x1ff117['remoteUri'],_0xee90ae['id']);if(_0x2bf73c>0x6){_0x33b1fe=util['format'](_0xf736('0x61'),_0x1ff117['remoteUri'],_0xee90ae['id']);}logger[_0xf736('0x2f')](_0xf736('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf736('0x3c')]('user:%s',_0x32b23d['name']),_0xf736('0x63'),{'uri':_0x33b1fe});})[_0xf736('0x64')](function(_0x3862fb){logger[_0xf736('0x65')](_0xf736('0x6d'),JSON['stringify'](_0x3862fb));});};exports['unmanaged']=function(_0x42c4c8,_0x4307a9,_0x381d6f,_0x1de3d1,_0x3c3a85,_0x1f26f0){var _0x219b07,_0x145b78,_0xaa07d,_0x4cced2;_0x1f26f0[_0xf736('0x51')]=intUtil[_0xf736('0x53')](_0x1f26f0[_0xf736('0x51')]);_0x1f26f0['serverUrl']=intUtil[_0xf736('0x53')](_0x1f26f0[_0xf736('0x52')]);def[_0xf736('0x6e')]=util[_0xf736('0x3c')]('%s/service/v4_1/rest.php',_0x1f26f0[_0xf736('0x51')]);if(_0x3c3a85&&_0x3c3a85['monitor_format']){logger['info']('['+_0x4307a9[_0xf736('0x6f')]['toUpperCase']()+']',_0xf736('0x55'));_0x4307a9['recordingURL']=util[_0xf736('0x3c')](_0xf736('0x57'),_0x1f26f0['serverUrl'],_0x4307a9[_0xf736('0x58')],md5(_0x4307a9['uniqueid']));}else{_0x4307a9[_0xf736('0x56')]='';}return getConnection(_0x1f26f0)['then'](function(_0x508882){_0x4cced2=_0x508882;if(!_['isNil'](_0x1de3d1)){return getUser(_0x1f26f0,_0x1de3d1[_0xf736('0xf')],_0x4cced2);}else{return getUser(_0x1f26f0,null,_0x4cced2);}})['then'](function(_0x569dec){_0x219b07=_0x569dec;logger[_0xf736('0x2f')](_0xf736('0x69'),_0x219b07['id']);return getEndUser(_0x1f26f0,_0x4307a9[_0xf736('0x70')],_0x4307a9[_0xf736('0x71')],_0x4cced2);})['then'](function(_0x50034b){_0x145b78=_0x50034b;logger[_0xf736('0x2f')](_0xf736('0x59'),_0x145b78['id']);return getTicket(_0x1f26f0,_0x219b07,_0x145b78,_0x381d6f,_0x4307a9,_0x381d6f['Fields'],_0x4cced2,_0xf736('0x5b'));})[_0xf736('0x2a')](function(_0x5b7dd3){_0xaa07d=_0x5b7dd3;logger[_0xf736('0x2f')](_0xf736('0x5c'));logger[_0xf736('0x2f')](_0xf736('0x5d'),_0xaa07d['id']);return setRelationship(_0x4cced2,_0x219b07,_0xaa07d,'users');})['then'](function(){return setRelationship(_0x4cced2,_0x145b78,_0xaa07d,_0xf736('0x72'));})[_0xf736('0x2a')](function(){return getServerInfo(_0x4cced2);})[_0xf736('0x64')](function(_0x5b4fed){logger[_0xf736('0x65')]('['+_0x4307a9['lastevent'][_0xf736('0x73')]()+']',JSON[_0xf736('0x22')](_0x5b4fed));});}; \ 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 f47a6b4..7866cbf 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 _0x8d0f=['validateEmail','test','lodash','util','length','sortBy','type','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','lastIndexOf'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8d0f,0xbf));var _0xf8d0=function(_0x17f701,_0x571f1e){_0x17f701=_0x17f701-0x0;var _0xa2d42a=_0x8d0f[_0x17f701];return _0xa2d42a;};'use strict';var _=require(_0xf8d0('0x0'));var util=require(_0xf8d0('0x1'));exports['getString']=function(_0x445f86,_0x5d6b7b,_0x4e7423){var _0x5976f4=[];if(_0x445f86[_0xf8d0('0x2')]>0x0){var _0x109266=_[_0xf8d0('0x3')](_0x445f86,['id']);for(var _0x425926=0x0;_0x425926<_0x109266[_0xf8d0('0x2')];_0x425926++){var _0x43b2df=_0x109266[_0x425926];if(_0x43b2df[_0xf8d0('0x4')]==='string'){_0x5976f4[_0xf8d0('0x5')](_0x43b2df[_0xf8d0('0x6')]);}else if(_0x43b2df[_0xf8d0('0x4')]===_0xf8d0('0x7')&&_0x43b2df[_0xf8d0('0x8')]){_0x5d6b7b[_0x43b2df[_0xf8d0('0x8')]]&&_0x5976f4['push'](_0x5d6b7b[_0x43b2df['variableName']]['toString']());}else if(_0x43b2df[_0xf8d0('0x4')]===_0xf8d0('0x9')&&_0x43b2df[_0xf8d0('0xa')]&&_0x43b2df['Variable'][_0xf8d0('0xb')]){_0x5d6b7b[_0x43b2df[_0xf8d0('0xa')][_0xf8d0('0xb')][_0xf8d0('0xc')]()]&&_0x5976f4[_0xf8d0('0x5')](_0x5d6b7b[_0x43b2df['Variable']['name'][_0xf8d0('0xc')]()][_0xf8d0('0xd')]());}else if(_0x43b2df[_0xf8d0('0x4')]===_0xf8d0('0xe')){if(_0x43b2df[_0xf8d0('0xf')]===_0xf8d0('0x10')&&_0x43b2df[_0xf8d0('0x11')]){_0x5976f4[_0xf8d0('0x5')](util[_0xf8d0('0x12')](_0xf8d0('0x13'),_0x43b2df[_0xf8d0('0x11')],_0x43b2df[_0xf8d0('0x14')]));}else if(_0x43b2df['keyType']===_0xf8d0('0x7')&&_0x43b2df[_0xf8d0('0x8')]&&_0x43b2df[_0xf8d0('0x11')]){_0x5d6b7b[_0x43b2df[_0xf8d0('0x8')]]&&_0x5976f4[_0xf8d0('0x5')](util[_0xf8d0('0x12')](_0xf8d0('0x13'),_0x43b2df[_0xf8d0('0x11')],_0x5d6b7b[_0x43b2df[_0xf8d0('0x8')]]));}else if(_0x43b2df[_0xf8d0('0xf')]==='customVariable'&&_0x43b2df[_0xf8d0('0xa')]&&_0x43b2df['Variable'][_0xf8d0('0xb')]&&_0x43b2df['key']){_0x5d6b7b[_0x43b2df[_0xf8d0('0xa')][_0xf8d0('0xb')][_0xf8d0('0xc')]()]&&_0x5976f4['push'](util['format'](_0xf8d0('0x13'),_0x43b2df[_0xf8d0('0x11')],_0x5d6b7b[_0x43b2df[_0xf8d0('0xa')]['name'][_0xf8d0('0xc')]()]));}}}}return _0x5976f4[_0xf8d0('0x15')](_0x4e7423);};exports[_0xf8d0('0x16')]=function(_0x2dffae){var _0x47c5e0=_0x2dffae['slice'](-0x1);if(_0x47c5e0==='/'){_0x2dffae=_0x2dffae[_0xf8d0('0x17')](0x0,_0x2dffae[_0xf8d0('0x18')](_0x47c5e0));}return _0x2dffae;};exports[_0xf8d0('0x19')]=function(_0x55d0c3){if(!_['isNil'](_0x55d0c3)&&_0x55d0c3!==''){var _0x1838a0=/^(([^<>()\[\]\\.,;:\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 _0x1838a0[_0xf8d0('0x1a')](String(_0x55d0c3)[_0xf8d0('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x5ac1=['toLowerCase','join','slice','substring','lastIndexOf','isNil','test','lodash','sortBy','length','type','string','content','variable','variableName','push','toString','customVariable','Variable','name','keyValue','keyType','key','format','keyContent','%s:\x20%s'];(function(_0x4ff04e,_0xe333a2){var _0x10ef31=function(_0x1891b1){while(--_0x1891b1){_0x4ff04e['push'](_0x4ff04e['shift']());}};_0x10ef31(++_0xe333a2);}(_0x5ac1,0xa3));var _0x15ac=function(_0x47b58b,_0x1a16d8){_0x47b58b=_0x47b58b-0x0;var _0x4289a6=_0x5ac1[_0x47b58b];return _0x4289a6;};'use strict';var _=require(_0x15ac('0x0'));var util=require('util');exports['getString']=function(_0x6ca759,_0x5345d7,_0x1eb763){var _0x41e8d5=[];if(_0x6ca759['length']>0x0){var _0x3e5f80=_[_0x15ac('0x1')](_0x6ca759,['id']);for(var _0x1162d5=0x0;_0x1162d5<_0x3e5f80[_0x15ac('0x2')];_0x1162d5++){var _0x17c99b=_0x3e5f80[_0x1162d5];if(_0x17c99b[_0x15ac('0x3')]===_0x15ac('0x4')){_0x41e8d5['push'](_0x17c99b[_0x15ac('0x5')]);}else if(_0x17c99b[_0x15ac('0x3')]===_0x15ac('0x6')&&_0x17c99b['variableName']){_0x5345d7[_0x17c99b[_0x15ac('0x7')]]&&_0x41e8d5[_0x15ac('0x8')](_0x5345d7[_0x17c99b[_0x15ac('0x7')]][_0x15ac('0x9')]());}else if(_0x17c99b['type']===_0x15ac('0xa')&&_0x17c99b[_0x15ac('0xb')]&&_0x17c99b[_0x15ac('0xb')][_0x15ac('0xc')]){_0x5345d7[_0x17c99b[_0x15ac('0xb')][_0x15ac('0xc')]['toLowerCase']()]&&_0x41e8d5['push'](_0x5345d7[_0x17c99b['Variable']['name']['toLowerCase']()]['toString']());}else if(_0x17c99b[_0x15ac('0x3')]===_0x15ac('0xd')){if(_0x17c99b[_0x15ac('0xe')]===_0x15ac('0x4')&&_0x17c99b[_0x15ac('0xf')]){_0x41e8d5[_0x15ac('0x8')](util[_0x15ac('0x10')]('%s:\x20%s',_0x17c99b['key'],_0x17c99b[_0x15ac('0x11')]));}else if(_0x17c99b['keyType']===_0x15ac('0x6')&&_0x17c99b[_0x15ac('0x7')]&&_0x17c99b[_0x15ac('0xf')]){_0x5345d7[_0x17c99b[_0x15ac('0x7')]]&&_0x41e8d5[_0x15ac('0x8')](util[_0x15ac('0x10')](_0x15ac('0x12'),_0x17c99b[_0x15ac('0xf')],_0x5345d7[_0x17c99b[_0x15ac('0x7')]]));}else if(_0x17c99b[_0x15ac('0xe')]===_0x15ac('0xa')&&_0x17c99b['Variable']&&_0x17c99b[_0x15ac('0xb')][_0x15ac('0xc')]&&_0x17c99b[_0x15ac('0xf')]){_0x5345d7[_0x17c99b[_0x15ac('0xb')]['name'][_0x15ac('0x13')]()]&&_0x41e8d5[_0x15ac('0x8')](util[_0x15ac('0x10')](_0x15ac('0x12'),_0x17c99b[_0x15ac('0xf')],_0x5345d7[_0x17c99b[_0x15ac('0xb')][_0x15ac('0xc')][_0x15ac('0x13')]()]));}}}}return _0x41e8d5[_0x15ac('0x14')](_0x1eb763);};exports['stripTrailingSlash']=function(_0x485dec){var _0x1c3c2f=_0x485dec[_0x15ac('0x15')](-0x1);if(_0x1c3c2f==='/'){_0x485dec=_0x485dec[_0x15ac('0x16')](0x0,_0x485dec[_0x15ac('0x17')](_0x1c3c2f));}return _0x485dec;};exports['validateEmail']=function(_0x3d348b){if(!_[_0x15ac('0x18')](_0x3d348b)&&_0x3d348b!==''){var _0x536595=/^(([^<>()\[\]\\.,;:\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 _0x536595[_0x15ac('0x19')](String(_0x3d348b)['toLowerCase']());}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 c91c40e..91eb0ea 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 5105da8..8ae8336 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 _0x9988=['Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','email','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','Authorization','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','%s/tickets.json','remoteUri','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','toString','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]'];(function(_0x4877d4,_0x4acbf3){var _0x1f27b9=function(_0x5ec2b0){while(--_0x5ec2b0){_0x4877d4['push'](_0x4877d4['shift']());}};_0x1f27b9(++_0x4acbf3);}(_0x9988,0x8d));var _0x8998=function(_0xd2d176,_0x4225f3){_0xd2d176=_0xd2d176-0x0;var _0x8f702c=_0x9988[_0xd2d176];return _0x8f702c;};'use strict';var _=require(_0x8998('0x0'));var rp=require(_0x8998('0x1'));var md5=require('md5');var util=require(_0x8998('0x2'));var Redis=require(_0x8998('0x3'));var intUtil=require(_0x8998('0x4'));var config=require(_0x8998('0x5'));var logger=require(_0x8998('0x6'))(_0x8998('0x7'));config[_0x8998('0x8')]=_[_0x8998('0x9')](config[_0x8998('0x8')],{'host':_0x8998('0xa'),'port':0x18eb});var io=require(_0x8998('0xb'))(new Redis(config['redis']));function emit(_0x1c943e,_0x32b58a,_0x247f73){io['to'](_0x1c943e)[_0x8998('0xc')](_0x32b58a,_0x247f73);}var headers={'Content-Type':_0x8998('0xd'),'Accept':'application/json'};function getTicket(_0x3122bf,_0x3ab315,_0x5e12cb,_0x38a603,_0x4d0f92){logger[_0x8998('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x8998('0xf'),_0x3122bf[_0x8998('0x10')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x5e12cb['id'],'submitter_id':_0x3ab315?_0x3ab315['id']:undefined,'assignee_id':_0x3ab315?_0x3ab315['id']:undefined,'tags':getTags(_0x38a603[_0x8998('0x11')],'name'),'subject':intUtil[_0x8998('0x12')](_0x38a603[_0x8998('0x13')],_0x4d0f92,'\x20'),'description':intUtil[_0x8998('0x12')](_0x38a603[_0x8998('0x14')],_0x4d0f92,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8998('0x12')](_0x38a603[_0x8998('0x14')],_0x4d0f92,'\x0a')}},getCustomFields(_0x38a603[_0x8998('0x15')],_0x4d0f92))}})[_0x8998('0x16')](function(_0x269df0){logger[_0x8998('0xe')](_0x8998('0x17'));return _0x269df0[_0x8998('0x18')];});}function getUser(_0x35844e,_0x34c547){if(intUtil[_0x8998('0x19')](_0x34c547)){logger[_0x8998('0xe')](_0x8998('0x1a'),_0x34c547);return request({'uri':util[_0x8998('0x1b')](_0x8998('0x1c'),_0x35844e[_0x8998('0x10')]),'qs':{'query':util[_0x8998('0x1b')](_0x8998('0x1d'),_0x34c547)}})['then'](function(_0x129762){if(_0x129762[_0x8998('0x1e')]){logger[_0x8998('0xe')](_0x8998('0x1f'));return _['find'](_0x129762[_0x8998('0x20')],{'email':_0x34c547,'role':_0x8998('0x21')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8998('0x1b')](_0x8998('0x22'),_0x35844e[_0x8998('0x10')])})[_0x8998('0x16')](function(_0x5c570c){logger['info'](_0x8998('0x23'));return _0x5c570c[_0x8998('0x24')];});}});}else{logger[_0x8998('0xe')](_0x8998('0x25'));return request({'uri':util['format'](_0x8998('0x22'),_0x35844e['remoteUri'])})['then'](function(_0x3068d3){logger[_0x8998('0xe')](_0x8998('0x23'));return _0x3068d3[_0x8998('0x24')];});}}function getEndUser(_0x105bcd,_0x1aa35b,_0x3a0a8d){logger['info'](_0x8998('0x26'),_0x3a0a8d);return request({'uri':util[_0x8998('0x1b')](_0x8998('0x1c'),_0x105bcd['remoteUri']),'qs':{'query':util[_0x8998('0x1b')](_0x8998('0x27'),_0x3a0a8d)}})[_0x8998('0x16')](function(_0x20fed6){var _0xf17509;if(_0x20fed6['results']['length']){_0x20fed6[_0x8998('0x20')]=_[_0x8998('0x28')](_0x20fed6[_0x8998('0x20')],{'suspended':![],'role':_0x8998('0x29')});if(_0x20fed6[_0x8998('0x20')][_0x8998('0x2a')]){_0xf17509=_['first'](_0x20fed6[_0x8998('0x20')]);}}if(_0xf17509){logger[_0x8998('0xe')](_0x8998('0x2b'));return _0xf17509;}else{logger[_0x8998('0xe')](_0x8998('0x2c'));return request({'uri':util[_0x8998('0x1b')]('%s/users.json',_0x105bcd[_0x8998('0x10')]),'method':_0x8998('0x2d'),'body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x1aa35b||_0x3a0a8d),'phone':_0x3a0a8d}}})[_0x8998('0x16')](function(_0x2b6605){logger[_0x8998('0xe')](_0x8998('0x2e'));return _0x2b6605[_0x8998('0x24')];});}});}function getAuth(_0x7fb9d0){var _0x523b43;if(_0x7fb9d0[_0x8998('0x2f')]===_0x8998('0x30')){_0x523b43=util[_0x8998('0x1b')](_0x8998('0x31'),_0x7fb9d0[_0x8998('0x32')],_0x7fb9d0[_0x8998('0x30')]);}else if(_0x7fb9d0[_0x8998('0x2f')]===_0x8998('0x33')){_0x523b43=util[_0x8998('0x1b')](_0x8998('0x34'),_0x7fb9d0[_0x8998('0x32')],_0x7fb9d0[_0x8998('0x33')]);}return util['format']('Basic\x20%s',new Buffer(_0x523b43)['toString'](_0x8998('0x35')));}function request(_0x1b5e04){logger[_0x8998('0x36')](_0x8998('0x37'),JSON[_0x8998('0x38')](_0x1b5e04));return rp(_[_0x8998('0x9')](_0x1b5e04,{'method':_0x8998('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x34adcd,_0x147959){var _0x1ba8d0=[];if(_0x34adcd&&_0x34adcd['length']>0x0){_0x1ba8d0=_['map'](_0x34adcd,_0x147959);}return _0x1ba8d0;}function getCustomFields(_0x4413a4,_0x270797){var _0x54d950=[];var _0x3d9873={'custom_fields':[]};if(_0x4413a4['length']>0x0){_[_0x8998('0x3a')](_0x4413a4,function(_0x35a9e8){if(_[_0x8998('0x3b')]([_0x8998('0x3c'),_0x8998('0x3d')],_0x35a9e8[_0x8998('0x3e')])&&_0x35a9e8[_0x8998('0x3f')]&&!_0x35a9e8[_0x8998('0x40')]){_0x3d9873[_0x35a9e8['nameField'][_0x8998('0x41')]()]=_0x35a9e8[_0x8998('0x42')]['toString']();}else if(_[_0x8998('0x3b')]([_0x8998('0x3c'),_0x8998('0x3d')],_0x35a9e8[_0x8998('0x3e')])&&_0x35a9e8[_0x8998('0x43')]&&_0x35a9e8['customField']){_0x3d9873[_0x8998('0x44')][_0x8998('0x45')]({'id':_0x35a9e8['idField'],'value':_0x35a9e8['content'][_0x8998('0x46')]()});}else if(_0x35a9e8[_0x8998('0x3e')]===_0x8998('0x47')&&_0x35a9e8[_0x8998('0x48')]&&_0x35a9e8[_0x8998('0x43')]&&_0x35a9e8[_0x8998('0x40')]){_0x270797[_0x35a9e8['variableName']]&&_0x3d9873[_0x8998('0x44')][_0x8998('0x45')]({'id':_0x35a9e8[_0x8998('0x43')],'value':_0x270797[_0x35a9e8[_0x8998('0x48')]]['toString']()});}else if(_0x35a9e8['type']===_0x8998('0x49')&&_0x35a9e8[_0x8998('0x4a')]&&_0x35a9e8[_0x8998('0x4a')][_0x8998('0x4b')]&&_0x35a9e8[_0x8998('0x43')]&&_0x35a9e8['customField']){_0x270797[_0x35a9e8[_0x8998('0x4a')][_0x8998('0x4b')][_0x8998('0x41')]()]&&_0x3d9873[_0x8998('0x44')][_0x8998('0x45')]({'id':_0x35a9e8[_0x8998('0x43')],'value':_0x270797[_0x35a9e8['Variable'][_0x8998('0x4b')][_0x8998('0x41')]()][_0x8998('0x46')]()});}});}return _0x3d9873;}exports[_0x8998('0x4c')]=function(_0x218af0,_0x34502d,_0x37a71d,_0x49d729,_0x2f50af,_0x3f2de2){var _0x283596,_0x3900e3;_0x3f2de2['remoteUri']=intUtil[_0x8998('0x4d')](_0x3f2de2[_0x8998('0x10')]);_0x3f2de2[_0x8998('0x4e')]=intUtil[_0x8998('0x4d')](_0x3f2de2['serverUrl']);if(_0x2f50af&&_0x2f50af[_0x8998('0x4f')]){logger[_0x8998('0xe')]('[QUEUE]',_0x8998('0x50'));_0x34502d[_0x8998('0x51')]=util[_0x8998('0x1b')](_0x8998('0x52'),_0x3f2de2[_0x8998('0x4e')],_0x34502d['uniqueid'],md5(_0x34502d[_0x8998('0x53')]));}else{_0x34502d[_0x8998('0x51')]='';}headers['Authorization']=getAuth(_0x3f2de2);return getUser(_0x3f2de2,_0x49d729['email'])[_0x8998('0x16')](function(_0x45c0ac){_0x283596=_0x45c0ac;logger['info'](_0x8998('0x54'),_0x283596['id']);return getEndUser(_0x3f2de2,_0x34502d[_0x8998('0x55')],_0x34502d[_0x8998('0x56')]);})['then'](function(_0x10b1af){_0x3900e3=_0x10b1af;logger['info'](_0x8998('0x57'),_0x3900e3['id']);return getTicket(_0x3f2de2,_0x283596,_0x3900e3,_0x37a71d,_0x34502d);})['then'](function(_0x34a7e8){if(_0x34a7e8){logger[_0x8998('0xe')](_0x8998('0x58'),_0x34a7e8['id']);switch(_0x3f2de2['type']){case _0x8998('0x59'):logger[_0x8998('0xe')](_0x8998('0x5a'),_0x8998('0x5b'));return request({'uri':util[_0x8998('0x1b')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3f2de2[_0x8998('0x10')],_0x283596['id'],_0x34a7e8['id']),'method':_0x8998('0x2d')});case _0x8998('0x5c'):logger['info'](_0x8998('0x5a'),_0x8998('0x5d'));emit(util['format']('user:%s',_0x49d729[_0x8998('0x4b')]),_0x8998('0x5e'),{'uri':util[_0x8998('0x1b')]('%s/agent/tickets/%s',_0x3f2de2[_0x8998('0x10')][_0x8998('0x5f')]('/api/v2',''),_0x34a7e8['id'])});break;default:logger[_0x8998('0x60')](_0x8998('0x5a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1f08ec){logger['error'](_0x8998('0x61'),util[_0x8998('0x62')](_0x1f08ec,{'showHidden':!![],'depth':null}));});};exports[_0x8998('0x63')]=function(_0x10e88c,_0x3fa8fd,_0x2e778e,_0x3e161d,_0x50506a,_0x1b35a6,_0x364d72){var _0x1f4ea8,_0x1225b1;_0x1b35a6[_0x8998('0x10')]=intUtil[_0x8998('0x4d')](_0x1b35a6['remoteUri']);_0x1b35a6[_0x8998('0x4e')]=intUtil[_0x8998('0x4d')](_0x1b35a6[_0x8998('0x4e')]);if(_0x364d72&&_0x364d72['recordingFormat']&&_0x364d72[_0x8998('0x64')]!=='none'){logger[_0x8998('0xe')](_0x8998('0x65'),_0x8998('0x50'));_0x3fa8fd[_0x8998('0x51')]=util[_0x8998('0x1b')](_0x8998('0x52'),_0x1b35a6[_0x8998('0x4e')],_0x3fa8fd['uniqueid'],md5(_0x3fa8fd[_0x8998('0x53')]));}headers['Authorization']=getAuth(_0x1b35a6);return getUser(_0x1b35a6,_0x3e161d[_0x8998('0x66')])[_0x8998('0x16')](function(_0x1e291b){_0x1f4ea8=_0x1e291b;logger[_0x8998('0xe')]('The\x20User\x20ID\x20is:',_0x1f4ea8['id']);return getEndUser(_0x1b35a6,_0x3fa8fd['destcalleridname'],_0x3fa8fd[_0x8998('0x67')]);})['then'](function(_0x4827bf){_0x1225b1=_0x4827bf;logger[_0x8998('0xe')](_0x8998('0x57'),_0x1225b1['id']);return getTicket(_0x1b35a6,_0x1f4ea8,_0x1225b1,_0x2e778e,_0x3fa8fd);})[_0x8998('0x16')](function(_0x483dd3){if(_0x483dd3){logger[_0x8998('0xe')](_0x8998('0x58'),_0x483dd3['id']);switch(_0x1b35a6[_0x8998('0x3e')]){case _0x8998('0x59'):logger['info'](_0x8998('0x65'),_0x8998('0x5b'));return request({'uri':util[_0x8998('0x1b')](_0x8998('0x68'),_0x1b35a6[_0x8998('0x10')],_0x1f4ea8['id'],_0x483dd3['id']),'method':_0x8998('0x2d')});case _0x8998('0x5c'):logger[_0x8998('0xe')]('[OUTBOUND]',_0x8998('0x5d'));emit(util[_0x8998('0x1b')](_0x8998('0x69'),_0x3e161d['name']),'trigger:browser:url',{'uri':util[_0x8998('0x1b')](_0x8998('0x6a'),_0x1b35a6[_0x8998('0x10')][_0x8998('0x5f')](_0x8998('0x6b'),''),_0x483dd3['id'])});break;default:logger[_0x8998('0x60')]('[OUTBOUND]',_0x8998('0x6c'));}}})[_0x8998('0x6d')](function(_0x58bde4){logger[_0x8998('0x60')](_0x8998('0x6e'),util[_0x8998('0x62')](_0x58bde4,{'showHidden':!![],'depth':null}));});};exports[_0x8998('0x6f')]=function(_0x5dc761,_0x2f347a,_0x332b3b,_0x559a17,_0x3ac300,_0x1b2045){var _0x400c14,_0x55564;_0x1b2045[_0x8998('0x10')]=intUtil[_0x8998('0x4d')](_0x1b2045[_0x8998('0x10')]);_0x1b2045[_0x8998('0x4e')]=intUtil[_0x8998('0x4d')](_0x1b2045['serverUrl']);if(_0x3ac300&&_0x3ac300[_0x8998('0x4f')]){logger[_0x8998('0xe')]('['+_0x2f347a[_0x8998('0x70')]['toUpperCase']()+']',_0x8998('0x50'));_0x2f347a[_0x8998('0x51')]=util[_0x8998('0x1b')](_0x8998('0x52'),_0x1b2045[_0x8998('0x4e')],_0x2f347a[_0x8998('0x53')],md5(_0x2f347a[_0x8998('0x53')]));}else{_0x2f347a['recordingURL']='';}headers[_0x8998('0x71')]=getAuth(_0x1b2045);return getUser(_0x1b2045)[_0x8998('0x16')](function(_0x59dd0b){_0x400c14=_0x59dd0b;logger[_0x8998('0xe')](_0x8998('0x54'),_0x400c14['id']);return getEndUser(_0x1b2045,_0x2f347a['calleridname'],_0x2f347a['calleridnum']);})[_0x8998('0x16')](function(_0x1b50b7){_0x55564=_0x1b50b7;logger[_0x8998('0xe')](_0x8998('0x57'),_0x55564['id']);return getTicket(_0x1b2045,_0x400c14,_0x55564,_0x332b3b,_0x2f347a);})[_0x8998('0x16')](function(_0x3e83a9){if(_0x3e83a9){logger[_0x8998('0xe')](_0x8998('0x58'),_0x3e83a9['id']);}})[_0x8998('0x6d')](function(_0x2222c5){logger[_0x8998('0x60')]('['+_0x2f347a[_0x8998('0x70')][_0x8998('0x72')]()+']'+_0x8998('0x73'),util[_0x8998('0x62')](_0x2222c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf3f2=['Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Enduser\x20created.','authType','password','username','token','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','nameField','toLowerCase','type','idField','push','content','variable','variableName','custom_fields','Variable','customField','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0xc452f0,_0x352d78){var _0x7a9475=function(_0x2daa71){while(--_0x2daa71){_0xc452f0['push'](_0xc452f0['shift']());}};_0x7a9475(++_0x352d78);}(_0xf3f2,0x168));var _0x2f3f=function(_0x5ec583,_0x50ffd5){_0x5ec583=_0x5ec583-0x0;var _0x1100ff=_0xf3f2[_0x5ec583];return _0x1100ff;};'use strict';var _=require(_0x2f3f('0x0'));var rp=require('request-promise');var md5=require(_0x2f3f('0x1'));var util=require(_0x2f3f('0x2'));var Redis=require(_0x2f3f('0x3'));var intUtil=require('./util');var config=require(_0x2f3f('0x4'));var logger=require(_0x2f3f('0x5'))('zendesk');config[_0x2f3f('0x6')]=_[_0x2f3f('0x7')](config[_0x2f3f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2f3f('0x8'))(new Redis(config[_0x2f3f('0x6')]));function emit(_0x232b4b,_0x3a4a7a,_0x463b40){io['to'](_0x232b4b)[_0x2f3f('0x9')](_0x3a4a7a,_0x463b40);}var headers={'Content-Type':_0x2f3f('0xa'),'Accept':_0x2f3f('0xa')};function getTicket(_0x133e54,_0x1b2157,_0x306e29,_0x1e5f32,_0x3f130f){logger[_0x2f3f('0xb')](_0x2f3f('0xc'));return request({'uri':util[_0x2f3f('0xd')](_0x2f3f('0xe'),_0x133e54[_0x2f3f('0xf')]),'method':_0x2f3f('0x10'),'body':{'ticket':_[_0x2f3f('0x11')]({'requester_id':_0x306e29['id'],'submitter_id':_0x1b2157?_0x1b2157['id']:undefined,'assignee_id':_0x1b2157?_0x1b2157['id']:undefined,'tags':getTags(_0x1e5f32[_0x2f3f('0x12')],_0x2f3f('0x13')),'subject':intUtil[_0x2f3f('0x14')](_0x1e5f32[_0x2f3f('0x15')],_0x3f130f,'\x20'),'description':intUtil['getString'](_0x1e5f32['Descriptions'],_0x3f130f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1e5f32[_0x2f3f('0x16')],_0x3f130f,'\x0a')}},getCustomFields(_0x1e5f32[_0x2f3f('0x17')],_0x3f130f))}})[_0x2f3f('0x18')](function(_0x3d8909){logger['info'](_0x2f3f('0x19'));return _0x3d8909[_0x2f3f('0x1a')];});}function getUser(_0x24e2b1,_0x48c7e5){if(intUtil['validateEmail'](_0x48c7e5)){logger[_0x2f3f('0xb')](_0x2f3f('0x1b'),_0x48c7e5);return request({'uri':util[_0x2f3f('0xd')](_0x2f3f('0x1c'),_0x24e2b1[_0x2f3f('0xf')]),'qs':{'query':util[_0x2f3f('0xd')](_0x2f3f('0x1d'),_0x48c7e5)}})['then'](function(_0x41f498){if(_0x41f498[_0x2f3f('0x1e')]){logger[_0x2f3f('0xb')]('Agent\x20found!');return _[_0x2f3f('0x1f')](_0x41f498[_0x2f3f('0x20')],{'email':_0x48c7e5,'role':'agent'});}else{logger[_0x2f3f('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2f3f('0xd')](_0x2f3f('0x21'),_0x24e2b1[_0x2f3f('0xf')])})[_0x2f3f('0x18')](function(_0x1155ec){logger[_0x2f3f('0xb')](_0x2f3f('0x22'));return _0x1155ec[_0x2f3f('0x23')];});}});}else{logger['info'](_0x2f3f('0x24'));return request({'uri':util[_0x2f3f('0xd')](_0x2f3f('0x21'),_0x24e2b1[_0x2f3f('0xf')])})['then'](function(_0x367ff1){logger['info'](_0x2f3f('0x22'));return _0x367ff1['user'];});}}function getEndUser(_0x5270f2,_0x5b67f0,_0x1c80a1){logger[_0x2f3f('0xb')](_0x2f3f('0x25'),_0x1c80a1);return request({'uri':util[_0x2f3f('0xd')](_0x2f3f('0x1c'),_0x5270f2[_0x2f3f('0xf')]),'qs':{'query':util[_0x2f3f('0xd')](_0x2f3f('0x26'),_0x1c80a1)}})['then'](function(_0x35340d){var _0x1a5abc;if(_0x35340d[_0x2f3f('0x20')][_0x2f3f('0x27')]){_0x35340d[_0x2f3f('0x20')]=_[_0x2f3f('0x28')](_0x35340d[_0x2f3f('0x20')],{'suspended':![],'role':'end-user'});if(_0x35340d['results'][_0x2f3f('0x27')]){_0x1a5abc=_['first'](_0x35340d[_0x2f3f('0x20')]);}}if(_0x1a5abc){logger[_0x2f3f('0xb')]('Enduser\x20found!');return _0x1a5abc;}else{logger[_0x2f3f('0xb')](_0x2f3f('0x29'));return request({'uri':util[_0x2f3f('0xd')]('%s/users.json',_0x5270f2[_0x2f3f('0xf')]),'method':_0x2f3f('0x10'),'body':{'user':{'role':_0x2f3f('0x2a'),'name':util[_0x2f3f('0xd')]('Caller\x20-\x20%s',_0x5b67f0||_0x1c80a1),'phone':_0x1c80a1}}})[_0x2f3f('0x18')](function(_0x5953d8){logger[_0x2f3f('0xb')](_0x2f3f('0x2b'));return _0x5953d8[_0x2f3f('0x23')];});}});}function getAuth(_0x491ccc){var _0x132da1;if(_0x491ccc[_0x2f3f('0x2c')]===_0x2f3f('0x2d')){_0x132da1=util[_0x2f3f('0xd')]('%s:%s',_0x491ccc[_0x2f3f('0x2e')],_0x491ccc['password']);}else if(_0x491ccc['authType']===_0x2f3f('0x2f')){_0x132da1=util[_0x2f3f('0xd')]('%s/token:%s',_0x491ccc['username'],_0x491ccc[_0x2f3f('0x2f')]);}return util[_0x2f3f('0xd')]('Basic\x20%s',new Buffer(_0x132da1)[_0x2f3f('0x30')](_0x2f3f('0x31')));}function request(_0x5257f0){logger[_0x2f3f('0x32')](_0x2f3f('0x33'),JSON[_0x2f3f('0x34')](_0x5257f0));return rp(_[_0x2f3f('0x7')](_0x5257f0,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x184203,_0x15d552){var _0x374d63=[];if(_0x184203&&_0x184203[_0x2f3f('0x27')]>0x0){_0x374d63=_[_0x2f3f('0x35')](_0x184203,_0x15d552);}return _0x374d63;}function getCustomFields(_0x36ffe1,_0x16c80f){var _0x35a3d4=[];var _0x46111b={'custom_fields':[]};if(_0x36ffe1[_0x2f3f('0x27')]>0x0){_[_0x2f3f('0x36')](_0x36ffe1,function(_0x194a49){if(_[_0x2f3f('0x37')]([_0x2f3f('0x38'),'picklist'],_0x194a49['type'])&&_0x194a49[_0x2f3f('0x39')]&&!_0x194a49['customField']){_0x46111b[_0x194a49[_0x2f3f('0x39')][_0x2f3f('0x3a')]()]=_0x194a49['content'][_0x2f3f('0x30')]();}else if(_[_0x2f3f('0x37')]([_0x2f3f('0x38'),'picklist'],_0x194a49[_0x2f3f('0x3b')])&&_0x194a49[_0x2f3f('0x3c')]&&_0x194a49['customField']){_0x46111b['custom_fields'][_0x2f3f('0x3d')]({'id':_0x194a49[_0x2f3f('0x3c')],'value':_0x194a49[_0x2f3f('0x3e')]['toString']()});}else if(_0x194a49['type']===_0x2f3f('0x3f')&&_0x194a49[_0x2f3f('0x40')]&&_0x194a49[_0x2f3f('0x3c')]&&_0x194a49['customField']){_0x16c80f[_0x194a49['variableName']]&&_0x46111b[_0x2f3f('0x41')][_0x2f3f('0x3d')]({'id':_0x194a49['idField'],'value':_0x16c80f[_0x194a49[_0x2f3f('0x40')]]['toString']()});}else if(_0x194a49[_0x2f3f('0x3b')]==='customVariable'&&_0x194a49[_0x2f3f('0x42')]&&_0x194a49[_0x2f3f('0x42')][_0x2f3f('0x13')]&&_0x194a49['idField']&&_0x194a49[_0x2f3f('0x43')]){_0x16c80f[_0x194a49[_0x2f3f('0x42')][_0x2f3f('0x13')][_0x2f3f('0x3a')]()]&&_0x46111b[_0x2f3f('0x41')][_0x2f3f('0x3d')]({'id':_0x194a49[_0x2f3f('0x3c')],'value':_0x16c80f[_0x194a49[_0x2f3f('0x42')][_0x2f3f('0x13')][_0x2f3f('0x3a')]()][_0x2f3f('0x30')]()});}});}return _0x46111b;}exports['queue']=function(_0x39be85,_0x14891b,_0x4563a9,_0x23bbbd,_0x241fa6,_0x4a53e2){var _0x1afe16,_0x146997;_0x4a53e2['remoteUri']=intUtil[_0x2f3f('0x44')](_0x4a53e2[_0x2f3f('0xf')]);_0x4a53e2[_0x2f3f('0x45')]=intUtil[_0x2f3f('0x44')](_0x4a53e2['serverUrl']);if(_0x241fa6&&_0x241fa6[_0x2f3f('0x46')]){logger['info'](_0x2f3f('0x47'),_0x2f3f('0x48'));_0x14891b['recordingURL']=util[_0x2f3f('0xd')](_0x2f3f('0x49'),_0x4a53e2[_0x2f3f('0x45')],_0x14891b[_0x2f3f('0x4a')],md5(_0x14891b[_0x2f3f('0x4a')]));}else{_0x14891b[_0x2f3f('0x4b')]='';}headers[_0x2f3f('0x4c')]=getAuth(_0x4a53e2);return getUser(_0x4a53e2,_0x23bbbd[_0x2f3f('0x4d')])[_0x2f3f('0x18')](function(_0x3758b6){_0x1afe16=_0x3758b6;logger['info'](_0x2f3f('0x4e'),_0x1afe16['id']);return getEndUser(_0x4a53e2,_0x14891b[_0x2f3f('0x4f')],_0x14891b[_0x2f3f('0x50')]);})['then'](function(_0x3a6627){_0x146997=_0x3a6627;logger['info'](_0x2f3f('0x51'),_0x146997['id']);return getTicket(_0x4a53e2,_0x1afe16,_0x146997,_0x4563a9,_0x14891b);})[_0x2f3f('0x18')](function(_0xf636db){if(_0xf636db){logger[_0x2f3f('0xb')](_0x2f3f('0x52'),_0xf636db['id']);switch(_0x4a53e2[_0x2f3f('0x3b')]){case _0x2f3f('0x53'):logger[_0x2f3f('0xb')](_0x2f3f('0x47'),_0x2f3f('0x54'));return request({'uri':util[_0x2f3f('0xd')](_0x2f3f('0x55'),_0x4a53e2['remoteUri'],_0x1afe16['id'],_0xf636db['id']),'method':'POST'});case _0x2f3f('0x56'):logger[_0x2f3f('0xb')](_0x2f3f('0x47'),_0x2f3f('0x57'));emit(util['format'](_0x2f3f('0x58'),_0x23bbbd['name']),_0x2f3f('0x59'),{'uri':util[_0x2f3f('0xd')](_0x2f3f('0x5a'),_0x4a53e2['remoteUri'][_0x2f3f('0x5b')](_0x2f3f('0x5c'),''),_0xf636db['id'])});break;default:logger['error']('[QUEUE]',_0x2f3f('0x5d'));}}})[_0x2f3f('0x5e')](function(_0x4a7bda){logger[_0x2f3f('0x5f')](_0x2f3f('0x60'),util[_0x2f3f('0x61')](_0x4a7bda,{'showHidden':!![],'depth':null}));});};exports[_0x2f3f('0x62')]=function(_0x4b2e06,_0x575774,_0x3d4abe,_0x4afaf7,_0x142413,_0x2165a8,_0xae9db2){var _0x271af6,_0xd5ca5;_0x2165a8[_0x2f3f('0xf')]=intUtil[_0x2f3f('0x44')](_0x2165a8[_0x2f3f('0xf')]);_0x2165a8[_0x2f3f('0x45')]=intUtil[_0x2f3f('0x44')](_0x2165a8[_0x2f3f('0x45')]);if(_0xae9db2&&_0xae9db2[_0x2f3f('0x63')]&&_0xae9db2[_0x2f3f('0x63')]!==_0x2f3f('0x64')){logger['info'](_0x2f3f('0x65'),_0x2f3f('0x48'));_0x575774[_0x2f3f('0x4b')]=util[_0x2f3f('0xd')](_0x2f3f('0x49'),_0x2165a8['serverUrl'],_0x575774[_0x2f3f('0x4a')],md5(_0x575774['uniqueid']));}headers['Authorization']=getAuth(_0x2165a8);return getUser(_0x2165a8,_0x4afaf7[_0x2f3f('0x4d')])[_0x2f3f('0x18')](function(_0x3cbdde){_0x271af6=_0x3cbdde;logger[_0x2f3f('0xb')](_0x2f3f('0x4e'),_0x271af6['id']);return getEndUser(_0x2165a8,_0x575774[_0x2f3f('0x66')],_0x575774[_0x2f3f('0x67')]);})[_0x2f3f('0x18')](function(_0x114224){_0xd5ca5=_0x114224;logger[_0x2f3f('0xb')](_0x2f3f('0x51'),_0xd5ca5['id']);return getTicket(_0x2165a8,_0x271af6,_0xd5ca5,_0x3d4abe,_0x575774);})[_0x2f3f('0x18')](function(_0x440cdf){if(_0x440cdf){logger[_0x2f3f('0xb')](_0x2f3f('0x52'),_0x440cdf['id']);switch(_0x2165a8[_0x2f3f('0x3b')]){case _0x2f3f('0x53'):logger[_0x2f3f('0xb')](_0x2f3f('0x65'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x2f3f('0x55'),_0x2165a8[_0x2f3f('0xf')],_0x271af6['id'],_0x440cdf['id']),'method':'POST'});case _0x2f3f('0x56'):logger[_0x2f3f('0xb')](_0x2f3f('0x65'),_0x2f3f('0x57'));emit(util[_0x2f3f('0xd')](_0x2f3f('0x58'),_0x4afaf7['name']),_0x2f3f('0x59'),{'uri':util[_0x2f3f('0xd')](_0x2f3f('0x5a'),_0x2165a8[_0x2f3f('0xf')][_0x2f3f('0x5b')](_0x2f3f('0x5c'),''),_0x440cdf['id'])});break;default:logger[_0x2f3f('0x5f')]('[OUTBOUND]',_0x2f3f('0x5d'));}}})[_0x2f3f('0x5e')](function(_0x9511af){logger[_0x2f3f('0x5f')](_0x2f3f('0x68'),util[_0x2f3f('0x61')](_0x9511af,{'showHidden':!![],'depth':null}));});};exports[_0x2f3f('0x69')]=function(_0x5c40a0,_0x521304,_0x34ec68,_0x7bd93a,_0x39ced3,_0x5d77fa){var _0x390b87,_0x5c8372;_0x5d77fa[_0x2f3f('0xf')]=intUtil[_0x2f3f('0x44')](_0x5d77fa['remoteUri']);_0x5d77fa[_0x2f3f('0x45')]=intUtil['stripTrailingSlash'](_0x5d77fa[_0x2f3f('0x45')]);if(_0x39ced3&&_0x39ced3[_0x2f3f('0x46')]){logger[_0x2f3f('0xb')]('['+_0x521304[_0x2f3f('0x6a')][_0x2f3f('0x6b')]()+']',_0x2f3f('0x48'));_0x521304[_0x2f3f('0x4b')]=util[_0x2f3f('0xd')](_0x2f3f('0x49'),_0x5d77fa[_0x2f3f('0x45')],_0x521304[_0x2f3f('0x4a')],md5(_0x521304[_0x2f3f('0x4a')]));}else{_0x521304[_0x2f3f('0x4b')]='';}headers[_0x2f3f('0x4c')]=getAuth(_0x5d77fa);return getUser(_0x5d77fa)[_0x2f3f('0x18')](function(_0x29e5a7){_0x390b87=_0x29e5a7;logger[_0x2f3f('0xb')]('The\x20User\x20ID\x20is:',_0x390b87['id']);return getEndUser(_0x5d77fa,_0x521304[_0x2f3f('0x4f')],_0x521304[_0x2f3f('0x50')]);})['then'](function(_0xa6f745){_0x5c8372=_0xa6f745;logger[_0x2f3f('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5c8372['id']);return getTicket(_0x5d77fa,_0x390b87,_0x5c8372,_0x34ec68,_0x521304);})['then'](function(_0x498b1c){if(_0x498b1c){logger[_0x2f3f('0xb')]('The\x20Ticket\x20ID\x20is:',_0x498b1c['id']);}})[_0x2f3f('0x5e')](function(_0x3c11d6){logger[_0x2f3f('0x5f')]('['+_0x521304[_0x2f3f('0x6a')][_0x2f3f('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x2f3f('0x61')](_0x3c11d6,{'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 91c7324..1850d9c 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 _0x3313=['Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','data','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','code','err','log','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','stripTrailingSlash','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','stringify','forEach','includes','string','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','add','seconds','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','email'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3313,0x1a3));var _0x3331=function(_0x128e25,_0x4e9e27){_0x128e25=_0x128e25-0x0;var _0x5eb353=_0x3313[_0x128e25];return _0x5eb353;};'use strict';var _=require(_0x3331('0x0'));var rp=require(_0x3331('0x1'));var md5=require(_0x3331('0x2'));var util=require(_0x3331('0x3'));var intUtil=require(_0x3331('0x4'));var moment=require(_0x3331('0x5'));var Redis=require('ioredis');var BPromise=require(_0x3331('0x6'));var config=require(_0x3331('0x7'));var logger=require(_0x3331('0x8'))(_0x3331('0x9'));config[_0x3331('0xa')]=_[_0x3331('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3331('0xc'))(new Redis(config[_0x3331('0xa')]));function emit(_0x2264e4,_0x1256f0,_0x565cd8){io['to'](_0x2264e4)[_0x3331('0xd')](_0x1256f0,_0x565cd8);}function request(_0x20ac4f){logger[_0x3331('0xe')]('[HTTP]',JSON[_0x3331('0xf')](_0x20ac4f));return rp(_0x20ac4f);}function getCustomFields(_0x2492d4,_0x4f36da){var _0x2674a7={};if(_0x2492d4['length']>0x0){_[_0x3331('0x10')](_0x2492d4,function(_0x31738e){if(_[_0x3331('0x11')]([_0x3331('0x12'),_0x3331('0x13')],_0x31738e[_0x3331('0x14')])&&_0x31738e['idField']){_0x2674a7[_0x31738e[_0x3331('0x15')]]=_0x31738e['content'][_0x3331('0x16')]();}else if(_0x31738e['type']===_0x3331('0x17')&&_0x31738e['variableName']&&_0x31738e[_0x3331('0x15')]&&_0x4f36da[_0x31738e[_0x3331('0x18')]]){_0x2674a7[_0x31738e[_0x3331('0x15')]]=_0x4f36da[_0x31738e[_0x3331('0x18')]][_0x3331('0x16')]();}else if(_0x31738e[_0x3331('0x14')]==='customVariable'&&_0x31738e[_0x3331('0x19')]&&_0x31738e[_0x3331('0x19')][_0x3331('0x1a')]&&_0x31738e[_0x3331('0x15')]&&_0x4f36da[_0x31738e['Variable'][_0x3331('0x1a')][_0x3331('0x1b')]()]){_0x2674a7[_0x31738e[_0x3331('0x15')]]=_0x4f36da[_0x31738e['Variable']['name'][_0x3331('0x1b')]()]['toString']();}});}return _0x2674a7;}function getName(_0x4d89df){if(_0x4d89df[_0x3331('0x1c')]('\x20')>0x0){var _0x13d23a=_0x4d89df[_0x3331('0x1d')](/ (.+)/);if(_0x13d23a[0x1]){return _0x13d23a;}}return[_0x4d89df,_0x4d89df];}var accountsTokens={};function getAccessToken(_0x5ed332){return new Promise(function(_0x23e909,_0x3a7b84){if(!_[_0x3331('0x1e')](accountsTokens[_0x5ed332['id']])&&!_[_0x3331('0x1e')](accountsTokens[_0x5ed332['id']][_0x3331('0x1f')])){if(moment()[_0x3331('0x20')](accountsTokens[_0x5ed332['id']][_0x3331('0x21')])){_0x23e909(accountsTokens[_0x5ed332['id']][_0x3331('0x1f')]);}}var _0x12ce78;switch(_0x5ed332[_0x3331('0x22')]){case'US':_0x12ce78='https://accounts.zoho.com';break;case'AU':_0x12ce78='https://accounts.zoho.com.au';break;case'EU':_0x12ce78=_0x3331('0x23');break;case'IN':_0x12ce78=_0x3331('0x24');break;case'CN':_0x12ce78=_0x3331('0x25');break;default:_0x12ce78=_0x3331('0x23');break;}var _0x4d02b3={'method':_0x3331('0x26'),'uri':_0x12ce78+_0x3331('0x27'),'qs':{'refresh_token':_0x5ed332['refreshToken'],'client_id':_0x5ed332['clientId'],'client_secret':_0x5ed332[_0x3331('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4d02b3)['then'](function(_0x14175f){accountsTokens[_0x5ed332['id']]={'access_token':_0x14175f['access_token'],'expires_in':moment()[_0x3331('0x29')](_0x14175f['expires_in'],_0x3331('0x2a'))};_0x23e909(_0x14175f[_0x3331('0x1f')]);})['catch'](function(_0x4e0f23){logger['error']('Failing\x20creating\x20the\x20access_token',_0x4e0f23[_0x3331('0x2b')]);_0x3a7b84(_0x4e0f23);});});}function getUser(_0x5e5bbe,_0x43a31e,_0x51cb0b,_0x4d39d0){logger[_0x3331('0x2c')](_0x3331('0x2d'));return request({'method':_0x3331('0x2e'),'uri':util[_0x3331('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x43a31e),'qs':{'type':_0x3331('0x30')},'headers':{'Authorization':_0x3331('0x31')+_0x5e5bbe},'json':!![]})[_0x3331('0x32')](function(_0x3c233e){if(_0x3c233e['users']){var _0x32b529=-0x1;if(_[_0x3331('0x33')](_0x3c233e[_0x3331('0x34')])){if(!_[_0x3331('0x1e')](_0x4d39d0)){_0x32b529=_[_0x3331('0x35')](_0x3c233e['users'],function(_0x9e6c0a){return _0x9e6c0a[_0x3331('0x36')]===_0x4d39d0;});}if(_0x32b529>=0x0){logger[_0x3331('0x2c')](_0x3331('0x37'));}else{logger['info'](_0x3331('0x38'));_0x32b529=_[_0x3331('0x35')](_0x3c233e[_0x3331('0x34')],function(_0x3af2d1){return _0x3af2d1[_0x3331('0x39')][_0x3331('0x1a')]===_0x3331('0x3a');});}return _0x3c233e[_0x3331('0x34')][_0x32b529];}else{if(_0x3c233e[_0x3331('0x3b')][_0x3331('0x39')][_0x3331('0x1a')]===_0x3331('0x3a')){logger[_0x3331('0x2c')](_0x3331('0x38'));user=_0x3c233e['user'];return user;}else{logger[_0x3331('0x3c')](_0x3331('0x3d'),JSON[_0x3331('0xf')](_0x3c233e));throw new Error(_0x3331('0x3e')+JSON[_0x3331('0xf')](_0x3c233e));}}}else{logger[_0x3331('0x3c')](_0x3331('0x3d'),JSON[_0x3331('0xf')](_0x3c233e));throw new Error(_0x3331('0x3e')+JSON[_0x3331('0xf')](_0x3c233e));}})['catch'](function(_0xa79569){console[_0x3331('0x3c')](_0xa79569);});}function getZohoUser(_0x3754a7,_0x4ea29a){return new BPromise(function(_0x4e8fd7,_0x2be874){request(_0x3754a7)[_0x3331('0x32')](function(_0x258eca){var _0x574f34=null;if(_0x258eca){_0x574f34=_0x258eca['data'][0x0];_0x574f34[_0x3331('0x3f')]=_0x4ea29a;}_0x4e8fd7(_0x574f34);})[_0x3331('0x40')](function(_0x9be66f){_0x2be874(_0x9be66f);});});}function createEndUser(_0x2b36b0,_0x151584,_0x2d321e,_0x5b3457,_0x580f84,_0x1e4690){var _0x2d321e=getName(_0x2d321e);return request({'method':_0x3331('0x26'),'uri':_0x3331('0x41')+_0x151584+_0x3331('0x42')+_[_0x3331('0x43')](_0x1e4690[_0x3331('0x44')])+'s','body':{'data':[{'Last_Name':_0x2d321e[0x1],'First_Name':_0x2d321e[0x0],'Phone':_0x5b3457,'Owner':{'name':!_['isNil'](_0x580f84[_0x3331('0x45')]['name'])?_0x580f84[_0x3331('0x45')][_0x3331('0x1a')]:!_[_0x3331('0x1e')](_0x580f84[_0x3331('0x46')])?_0x580f84[_0x3331('0x46')]+'\x20'+_0x580f84[_0x3331('0x47')]:_0x580f84['last_name'],'id':_0x580f84['id']}}]},'headers':{'Authorization':_0x3331('0x31')+_0x2b36b0},'json':!![]})[_0x3331('0x32')](function(_0x50b925){if(_0x50b925&&_0x50b925['data'][0x0]['code']===_0x3331('0x48')){var _0x45383c=_0x50b925[_0x3331('0x49')][0x0][_0x3331('0x4a')];_0x45383c[_0x3331('0x3f')]=_['startCase'](_0x1e4690[_0x3331('0x44')])+'s';return _0x45383c;}logger['error'](_0x3331('0x3d'),JSON[_0x3331('0xf')](data));throw new Error(_0x3331('0x4b')+JSON[_0x3331('0xf')](data));})[_0x3331('0x40')](function(_0x326c3a){console['log'](_0x3331('0x4c'),_0x326c3a);});}function getEndUser(_0x199aae,_0x385e1b,_0x314909,_0x3d3373,_0x2e02ef,_0x3a5164,_0x4fccff){var _0x1a6ddc={'method':_0x3331('0x2e'),'uri':'','headers':{'Authorization':_0x3331('0x31')+_0x199aae},'json':!![]};switch(_0x4fccff[_0x3331('0x4d')]){case _0x3331('0x4e'):_0x1a6ddc[_0x3331('0x4f')]=_0x3331('0x41')+_0x385e1b+_0x3331('0x50')+_0x2e02ef+'))';return getZohoUser(_0x1a6ddc,_0x3331('0x51'))['then'](function(_0x339a27){if(_0x339a27)return _0x339a27;_0x1a6ddc[_0x3331('0x4f')]=_0x3331('0x41')+_0x385e1b+_0x3331('0x52')+_0x2e02ef+'))';return getZohoUser(_0x1a6ddc,_0x3331('0x53'))[_0x3331('0x32')](function(_0x33dfef){if(_0x33dfef)return _0x33dfef;if(_0x4fccff[_0x3331('0x44')]!='nothing'){return createEndUser(_0x199aae,_0x385e1b,_0x3d3373,_0x2e02ef,_0x3a5164,_0x4fccff);}else{return{};}});});break;case'contact':_0x1a6ddc['uri']=_0x3331('0x41')+_0x385e1b+_0x3331('0x50')+_0x2e02ef+'))';return getZohoUser(_0x1a6ddc,_0x3331('0x51'))[_0x3331('0x32')](function(_0x493af9){if(_0x493af9)return _0x493af9;if(_0x4fccff[_0x3331('0x44')]!=_0x3331('0x54')){return createEndUser(_0x199aae,_0x385e1b,_0x3d3373,_0x2e02ef,_0x3a5164,_0x4fccff);}else{return{};}});break;case _0x3331('0x55'):_0x1a6ddc[_0x3331('0x4f')]='https://www.zohoapis.'+_0x385e1b+_0x3331('0x52')+_0x2e02ef+'))';return getZohoUser(_0x1a6ddc,_0x3331('0x53'))[_0x3331('0x32')](function(_0x1ba9b4){if(_0x1ba9b4)return _0x1ba9b4;if(_0x4fccff[_0x3331('0x44')]!=_0x3331('0x54')){return createEndUser(_0x199aae,_0x385e1b,_0x3d3373,_0x2e02ef,_0x3a5164,_0x4fccff);}else{return{};}});break;}}function getCall(_0x905638,_0x5bac9e,_0xd86f77,_0x1e15db,_0x501269,_0x5e46e5,_0x26dfef,_0x1dbe2d){logger[_0x3331('0x2c')]('Creating\x20new\x20call...');var _0x482166={};_0x482166['Owner']={'name':!_[_0x3331('0x1e')](_0x1e15db[_0x3331('0x45')][_0x3331('0x1a')])&&!_['isNil'](_0x1e15db[_0x3331('0x39')]['name'])&&_0x1e15db[_0x3331('0x39')][_0x3331('0x1a')]===_0x3331('0x56')?_0x1e15db[_0x3331('0x45')][_0x3331('0x1a')]:!_[_0x3331('0x1e')](_0x1e15db[_0x3331('0x46')])?_0x1e15db[_0x3331('0x46')]+'\x20'+_0x1e15db[_0x3331('0x47')]:_0x1e15db[_0x3331('0x47')],'id':_0x1e15db['id']};_0x482166[_0x3331('0x57')]=intUtil[_0x3331('0x58')](_0x5e46e5[_0x3331('0x59')],_0x26dfef,'\x20');_0x482166[_0x3331('0x5a')]=intUtil['getString'](_0x5e46e5[_0x3331('0x5b')],_0x26dfef,'\x0a');if(_0x501269[_0x3331('0x3f')]===_0x3331('0x51')){_0x482166[_0x3331('0x5c')]={'name':!_[_0x3331('0x1e')](_0x501269['Full_Name'])?_0x501269['Full_Name']:!_[_0x3331('0x1e')](_0x501269['First_Name'])?_0x501269[_0x3331('0x5d')]+'\x20'+_0x501269[_0x3331('0x5e')]:_0x501269[_0x3331('0x5e')],'id':_0x501269['id']};}if(_0x501269[_0x3331('0x3f')]==='Leads'){_0x482166[_0x3331('0x5f')]={'name':!_[_0x3331('0x1e')](_0x501269[_0x3331('0x60')])?_0x501269[_0x3331('0x60')]:!_[_0x3331('0x1e')](_0x501269[_0x3331('0x5d')])?_0x501269['First_Name']+'\x20'+_0x501269[_0x3331('0x5e')]:_0x501269['Last_Name'],'id':_0x501269['id']};_0x482166[_0x3331('0x61')]=_[_0x3331('0x43')](_0x501269[_0x3331('0x3f')]);}if(_0x26dfef[_0x3331('0x62')]){_0x482166[_0x3331('0x63')]=moment[_0x3331('0x64')](parseInt(_0x26dfef[_0x3331('0x62')])*0x3e8)[_0x3331('0x2f')](_0x3331('0x65'));}else if(_0x26dfef[_0x3331('0x66')]&&_0x26dfef[_0x3331('0x67')]){_0x482166[_0x3331('0x63')]=moment[_0x3331('0x64')](moment(_0x26dfef['endtime'],_0x3331('0x68'))[_0x3331('0x69')](moment(_0x26dfef[_0x3331('0x6a')],_0x3331('0x68'))))['format'](_0x3331('0x65'));}switch(_0x26dfef['lastevent']){case _0x3331('0x6b'):_0x482166[_0x3331('0x6c')]=_0x3331('0x6d');break;case _0x3331('0x6e'):case _0x3331('0x6f'):_0x482166[_0x3331('0x6c')]=_0x3331('0x70');break;case _0x3331('0x71'):_0x482166[_0x3331('0x6c')]=_0x3331('0x72');break;case _0x3331('0x73'):_0x482166[_0x3331('0x6c')]=_0x3331('0x74');break;case'timeout':_0x482166[_0x3331('0x6c')]=_0x3331('0x75');default:}_0x482166[_0x3331('0x76')]=(_0x1dbe2d==='outbound'?moment(_0x26dfef['starttime'])[_0x3331('0x2f')](_0x3331('0x68')):moment(_0x26dfef[_0x3331('0x77')])[_0x3331('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3331('0x2f')]('YYYY-MM-DDTHH:mm:ss');_0x482166[_0x3331('0x78')]=_0x1dbe2d||'Inbound';_0x482166=_['merge'](_0x482166,getCustomFields(_0x5e46e5[_0x3331('0x79')],_0x26dfef));return request({'method':'POST','uri':_0x3331('0x41')+_0x5bac9e+_0x3331('0x7a'),'headers':{'Authorization':_0x3331('0x31')+_0x905638},'body':{'data':[_0x482166]},'json':!![]})['then'](function(_0x2a801a){if(_0x2a801a&&_0x2a801a[_0x3331('0x49')][0x0][_0x3331('0x7b')]===_0x3331('0x48')){logger[_0x3331('0x2c')]('Call\x20created!');return{'id':_0x2a801a[_0x3331('0x49')][0x0][_0x3331('0x4a')]['id']};}})[_0x3331('0x40')](function(_0x4ce553){logger['info'](_0x3331('0x7c'),_0x4ce553['stack']);console[_0x3331('0x7d')](_0x3331('0x7c'),_0x4ce553);});}exports[_0x3331('0x7e')]=function(_0x1b54be,_0x1d2540,_0x34006a,_0x3f0131,_0x54bae0,_0x43bbd2){var _0x1a08d6,_0xe6f73f,_0x509bcb;_0x43bbd2[_0x3331('0x7f')]=intUtil['stripTrailingSlash'](_0x43bbd2[_0x3331('0x7f')]);_0x43bbd2[_0x3331('0x80')]=intUtil['stripTrailingSlash'](_0x43bbd2[_0x3331('0x80')]);if(_0x54bae0&&_0x54bae0[_0x3331('0x81')]){logger[_0x3331('0x2c')](_0x3331('0x82'),_0x3331('0x83'));_0x1d2540[_0x3331('0x84')]=_0x43bbd2[_0x3331('0x80')]+_0x3331('0x85')+_0x1d2540['uniqueid']+_0x3331('0x86')+md5(_0x1d2540[_0x3331('0x87')]);}else{_0x1d2540['recordingURL']='';}var _0x43627d=_0x43bbd2[_0x3331('0x7f')]===_0x3331('0x88')?'eu':_0x3331('0x89');return getAccessToken(_0x43bbd2)[_0x3331('0x32')](function(_0x12e722){_0x509bcb=_0x12e722;return getUser(_0x509bcb,_0x43627d,_0x43bbd2,_0x3f0131[_0x3331('0x36')]);})[_0x3331('0x32')](function(_0x165ab8){_0x1a08d6=_0x165ab8;logger[_0x3331('0x2c')]('The\x20User\x20ID\x20is:',_0x1a08d6['id']);return getEndUser(_0x509bcb,_0x43627d,_0x43bbd2,_0x1d2540[_0x3331('0x8a')],_0x1d2540[_0x3331('0x8b')],_0x1a08d6,_0x34006a);})[_0x3331('0x32')](function(_0x730e72){_0xe6f73f=_0x730e72;return getCall(_0x509bcb,_0x43627d,_0x43bbd2,_0x1a08d6,_0xe6f73f,_0x34006a,_0x1d2540,_0x3331('0x8c'));})['then'](function(_0xc2d25e){if(_0xc2d25e){logger[_0x3331('0x2c')](_0x3331('0x8d'),_0xc2d25e['id']);logger[_0x3331('0x2c')](_0x3331('0x82'),_0x3331('0x8e'));emit(util[_0x3331('0x2f')](_0x3331('0x8f'),_0x3f0131[_0x3331('0x1a')]),_0x3331('0x90'),{'uri':'https://crm.'+_0x43bbd2[_0x3331('0x7f')]+_0x3331('0x91')+_0xc2d25e['id']});}})[_0x3331('0x40')](function(_0xe4762a){logger[_0x3331('0x3c')](_0x3331('0x82'),JSON['stringify'](_0xe4762a));});};exports[_0x3331('0x92')]=function(_0x571797,_0x70ff18,_0x319dec,_0x4c3e0e,_0x10a9eb,_0x92654,_0x31ac2f){var _0x378c6b,_0x1b3312,_0x4b3a9e;_0x92654[_0x3331('0x7f')]=intUtil['stripTrailingSlash'](_0x92654[_0x3331('0x7f')]);_0x92654[_0x3331('0x80')]=intUtil['stripTrailingSlash'](_0x92654['serverUrl']);if(_0x31ac2f&&_0x31ac2f[_0x3331('0x93')]&&_0x31ac2f[_0x3331('0x93')]!==_0x3331('0x94')){logger[_0x3331('0x2c')](_0x3331('0x95'),_0x3331('0x83'));_0x70ff18[_0x3331('0x84')]=_0x92654[_0x3331('0x80')]+_0x3331('0x85')+_0x70ff18[_0x3331('0x87')]+_0x3331('0x86')+md5(_0x70ff18[_0x3331('0x87')]);}var _0x400d68=_0x92654['host']==='zoho.eu'?'eu':_0x3331('0x89');return getAccessToken(_0x92654)[_0x3331('0x32')](function(_0x73db5e){_0x4b3a9e=_0x73db5e;return getUser(_0x4b3a9e,_0x400d68,_0x92654,_0x4c3e0e['email']);})[_0x3331('0x32')](function(_0x160d87){_0x378c6b=_0x160d87;logger[_0x3331('0x2c')](_0x3331('0x96'),_0x378c6b['id']);return getEndUser(_0x4b3a9e,_0x400d68,_0x92654,_0x70ff18[_0x3331('0x97')],_0x70ff18[_0x3331('0x98')],_0x378c6b,_0x319dec);})['then'](function(_0x1678b5){_0x1b3312=_0x1678b5;return getCall(_0x4b3a9e,_0x400d68,_0x92654,_0x378c6b,_0x1b3312,_0x319dec,_0x70ff18,_0x3331('0x99'));})[_0x3331('0x32')](function(_0x314a27){if(_0x314a27){logger[_0x3331('0x2c')](_0x3331('0x8d'),_0x314a27['id']);logger['info']('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3331('0x8f'),_0x4c3e0e[_0x3331('0x1a')]),_0x3331('0x90'),{'uri':'https://crm.'+_0x92654['host']+_0x3331('0x91')+_0x314a27['id']});}})[_0x3331('0x40')](function(_0xbfd9c4){logger['error'](_0x3331('0x95'),JSON[_0x3331('0xf')](_0xbfd9c4));});};exports[_0x3331('0x9a')]=function(_0x4fc7f3,_0x1f44fc,_0x25ff2b,_0xa64154,_0x393ddf,_0x173f37){var _0x363c1f,_0x569bc3,_0x3c1289;_0x173f37[_0x3331('0x7f')]=intUtil[_0x3331('0x9b')](_0x173f37['host']);_0x173f37[_0x3331('0x80')]=intUtil['stripTrailingSlash'](_0x173f37[_0x3331('0x80')]);if(_0x393ddf&&_0x393ddf[_0x3331('0x81')]){logger[_0x3331('0x2c')]('['+_0x1f44fc[_0x3331('0x9c')][_0x3331('0x9d')]()+']',_0x3331('0x83'));_0x1f44fc[_0x3331('0x84')]=_0x173f37[_0x3331('0x80')]+_0x3331('0x85')+_0x1f44fc[_0x3331('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x1f44fc[_0x3331('0x87')]);}else{_0x1f44fc[_0x3331('0x84')]='';}var _0x501f91=_0x173f37[_0x3331('0x7f')]===_0x3331('0x88')?'eu':_0x3331('0x89');return getAccessToken(_0x173f37)['then'](function(_0x323d9b){_0x3c1289=_0x323d9b;return getUser(_0x3c1289,_0x501f91,_0x173f37);})[_0x3331('0x32')](function(_0x399c38){_0x363c1f=_0x399c38;logger['info'](_0x3331('0x96'),_0x363c1f['id']);return getEndUser(_0x3c1289,_0x501f91,_0x173f37,_0x1f44fc[_0x3331('0x8a')],_0x1f44fc[_0x3331('0x8b')],_0x363c1f,_0x25ff2b);})['then'](function(_0x561c5b){_0x569bc3=_0x561c5b;return getCall(_0x3c1289,_0x501f91,_0x173f37,_0x363c1f,_0x569bc3,_0x25ff2b,_0x1f44fc,_0x3331('0x8c'));})[_0x3331('0x32')](function(_0x16f50d){if(_0x16f50d){logger['info'](_0x3331('0x8d'),_0x16f50d['id']);}})['catch'](function(_0x56ca52){logger['error']('['+_0x1f44fc['lastevent'][_0x3331('0x9d')]()+']',JSON['stringify'](_0x56ca52));});}; \ No newline at end of file +var _0xc4f5=['zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','startCase','log','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','lead','Leads','Owner','administrator','getString','Subjects','Description','Descriptions','Contacts','Full_Name','Last_Name','First_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','mm:ss','lastevent','Called','complete','connect','Answered','Call_Result','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','Fields','Call\x20created!','stack','err','stripTrailingSlash','host','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','zoho.eu','email','Outbound','user:%s','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','isNil','isBefore','access_token'];(function(_0x488ae4,_0x2a75f0){var _0x5708c3=function(_0x33864c){while(--_0x33864c){_0x488ae4['push'](_0x488ae4['shift']());}};_0x5708c3(++_0x2a75f0);}(_0xc4f5,0x75));var _0x5c4f=function(_0x5d2523,_0x14bc7e){_0x5d2523=_0x5d2523-0x0;var _0x4b0e39=_0xc4f5[_0x5d2523];return _0x4b0e39;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x5c4f('0x0'));var util=require('util');var intUtil=require(_0x5c4f('0x1'));var moment=require(_0x5c4f('0x2'));var Redis=require(_0x5c4f('0x3'));var BPromise=require(_0x5c4f('0x4'));var config=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));config[_0x5c4f('0x8')]=_[_0x5c4f('0x9')](config['redis'],{'host':_0x5c4f('0xa'),'port':0x18eb});var io=require(_0x5c4f('0xb'))(new Redis(config['redis']));function emit(_0x342ce7,_0x220b85,_0x29a2a1){io['to'](_0x342ce7)[_0x5c4f('0xc')](_0x220b85,_0x29a2a1);}function request(_0x48d691){logger[_0x5c4f('0xd')](_0x5c4f('0xe'),JSON[_0x5c4f('0xf')](_0x48d691));return rp(_0x48d691);}function getCustomFields(_0x249bb9,_0x147c78){var _0xb4329f={};if(_0x249bb9[_0x5c4f('0x10')]>0x0){_[_0x5c4f('0x11')](_0x249bb9,function(_0x2a4c06){if(_[_0x5c4f('0x12')]([_0x5c4f('0x13'),_0x5c4f('0x14')],_0x2a4c06[_0x5c4f('0x15')])&&_0x2a4c06[_0x5c4f('0x16')]){_0xb4329f[_0x2a4c06['idField']]=_0x2a4c06[_0x5c4f('0x17')][_0x5c4f('0x18')]();}else if(_0x2a4c06[_0x5c4f('0x15')]===_0x5c4f('0x19')&&_0x2a4c06[_0x5c4f('0x1a')]&&_0x2a4c06[_0x5c4f('0x16')]&&_0x147c78[_0x2a4c06[_0x5c4f('0x1a')]]){_0xb4329f[_0x2a4c06[_0x5c4f('0x16')]]=_0x147c78[_0x2a4c06['variableName']][_0x5c4f('0x18')]();}else if(_0x2a4c06[_0x5c4f('0x15')]==='customVariable'&&_0x2a4c06[_0x5c4f('0x1b')]&&_0x2a4c06[_0x5c4f('0x1b')]['name']&&_0x2a4c06['idField']&&_0x147c78[_0x2a4c06['Variable'][_0x5c4f('0x1c')][_0x5c4f('0x1d')]()]){_0xb4329f[_0x2a4c06[_0x5c4f('0x16')]]=_0x147c78[_0x2a4c06[_0x5c4f('0x1b')][_0x5c4f('0x1c')][_0x5c4f('0x1d')]()]['toString']();}});}return _0xb4329f;}function getName(_0x4e18a6){if(_0x4e18a6[_0x5c4f('0x1e')]('\x20')>0x0){var _0x47413e=_0x4e18a6['split'](/ (.+)/);if(_0x47413e[0x1]){return _0x47413e;}}return[_0x4e18a6,_0x4e18a6];}var accountsTokens={};function getAccessToken(_0x1080a7){return new Promise(function(_0x1a855f,_0x18dd88){if(!_[_0x5c4f('0x1f')](accountsTokens[_0x1080a7['id']])&&!_['isNil'](accountsTokens[_0x1080a7['id']]['access_token'])){if(moment()[_0x5c4f('0x20')](accountsTokens[_0x1080a7['id']]['expires_in'])){_0x1a855f(accountsTokens[_0x1080a7['id']][_0x5c4f('0x21')]);}}var _0x532cb2;switch(_0x1080a7[_0x5c4f('0x22')]){case'US':_0x532cb2='https://accounts.zoho.com';break;case'AU':_0x532cb2=_0x5c4f('0x23');break;case'EU':_0x532cb2=_0x5c4f('0x24');break;case'IN':_0x532cb2='https://accounts.zoho.in';break;case'CN':_0x532cb2=_0x5c4f('0x25');break;default:_0x532cb2=_0x5c4f('0x24');break;}var _0x2c4f05={'method':_0x5c4f('0x26'),'uri':_0x532cb2+'/oauth/v2/token','qs':{'refresh_token':_0x1080a7[_0x5c4f('0x27')],'client_id':_0x1080a7[_0x5c4f('0x28')],'client_secret':_0x1080a7[_0x5c4f('0x29')],'grant_type':_0x5c4f('0x2a')},'json':!![]};return rp(_0x2c4f05)[_0x5c4f('0x2b')](function(_0x55e25e){accountsTokens[_0x1080a7['id']]={'access_token':_0x55e25e[_0x5c4f('0x21')],'expires_in':moment()[_0x5c4f('0x2c')](_0x55e25e[_0x5c4f('0x2d')],'seconds')};_0x1a855f(_0x55e25e[_0x5c4f('0x21')]);})[_0x5c4f('0x2e')](function(_0x2fc9b7){logger[_0x5c4f('0x2f')](_0x5c4f('0x30'),_0x2fc9b7['stack']);_0x18dd88(_0x2fc9b7);});});}function getUser(_0x427b83,_0x41748f,_0x8c2d54,_0x34fe39){logger['info'](_0x5c4f('0x31'));return request({'method':'GET','uri':util['format'](_0x5c4f('0x32'),_0x41748f),'qs':{'type':_0x5c4f('0x33')},'headers':{'Authorization':_0x5c4f('0x34')+_0x427b83},'json':!![]})[_0x5c4f('0x2b')](function(_0x524484){if(_0x524484['users']){var _0x330c5c=-0x1;if(_['isArrayLikeObject'](_0x524484[_0x5c4f('0x35')])){if(!_[_0x5c4f('0x1f')](_0x34fe39)){_0x330c5c=_[_0x5c4f('0x36')](_0x524484[_0x5c4f('0x35')],function(_0x87f79e){return _0x87f79e['email']===_0x34fe39;});}if(_0x330c5c>=0x0){logger[_0x5c4f('0x37')](_0x5c4f('0x38'));}else{logger['info'](_0x5c4f('0x39'));_0x330c5c=_[_0x5c4f('0x36')](_0x524484['users'],function(_0x50ab00){return _0x50ab00[_0x5c4f('0x3a')][_0x5c4f('0x1c')]===_0x5c4f('0x3b');});}return _0x524484[_0x5c4f('0x35')][_0x330c5c];}else{if(_0x524484[_0x5c4f('0x3c')][_0x5c4f('0x3a')][_0x5c4f('0x1c')]==='Administrator'){logger[_0x5c4f('0x37')](_0x5c4f('0x39'));user=_0x524484[_0x5c4f('0x3c')];return user;}else{logger[_0x5c4f('0x2f')](_0x5c4f('0x3d'),JSON[_0x5c4f('0xf')](_0x524484));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5c4f('0xf')](_0x524484));}}}else{logger[_0x5c4f('0x2f')](_0x5c4f('0x3d'),JSON[_0x5c4f('0xf')](_0x524484));throw new Error(_0x5c4f('0x3e')+JSON['stringify'](_0x524484));}})[_0x5c4f('0x2e')](function(_0x48752f){console[_0x5c4f('0x2f')](_0x48752f);});}function getZohoUser(_0x99a3aa,_0x568237){return new BPromise(function(_0x40c6c7,_0xc6bec1){request(_0x99a3aa)['then'](function(_0x5e1086){var _0x43b6d3=null;if(_0x5e1086){_0x43b6d3=_0x5e1086[_0x5c4f('0x3f')][0x0];_0x43b6d3['enduserType']=_0x568237;}_0x40c6c7(_0x43b6d3);})[_0x5c4f('0x2e')](function(_0x44c319){_0xc6bec1(_0x44c319);});});}function createEndUser(_0x39d678,_0xe165af,_0x16325d,_0x5e8856,_0x4d5d5d,_0x18f563){var _0x16325d=getName(_0x16325d);return request({'method':_0x5c4f('0x26'),'uri':_0x5c4f('0x40')+_0xe165af+_0x5c4f('0x41')+_['startCase'](_0x18f563[_0x5c4f('0x42')])+'s','body':{'data':[{'Last_Name':_0x16325d[0x1],'First_Name':_0x16325d[0x0],'Phone':_0x5e8856,'Owner':{'name':!_[_0x5c4f('0x1f')](_0x4d5d5d[_0x5c4f('0x43')][_0x5c4f('0x1c')])?_0x4d5d5d[_0x5c4f('0x43')]['name']:!_['isNil'](_0x4d5d5d[_0x5c4f('0x44')])?_0x4d5d5d['first_name']+'\x20'+_0x4d5d5d[_0x5c4f('0x45')]:_0x4d5d5d['last_name'],'id':_0x4d5d5d['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x39d678},'json':!![]})[_0x5c4f('0x2b')](function(_0x36afaa){if(_0x36afaa&&_0x36afaa[_0x5c4f('0x3f')][0x0][_0x5c4f('0x46')]===_0x5c4f('0x47')){var _0xef682c=_0x36afaa['data'][0x0][_0x5c4f('0x48')];_0xef682c[_0x5c4f('0x49')]=_[_0x5c4f('0x4a')](_0x18f563[_0x5c4f('0x42')])+'s';return _0xef682c;}logger[_0x5c4f('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x5c4f('0xf')](data));throw new Error('Error:\x20'+JSON[_0x5c4f('0xf')](data));})['catch'](function(_0x10bdc3){console[_0x5c4f('0x4b')]('CREATE\x20ERROR',_0x10bdc3);});}function getEndUser(_0x3c698e,_0x4fc92d,_0x3f2a1b,_0x3a021a,_0x3f1c90,_0x40d469,_0x5d663f){var _0x2f365c={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3c698e},'json':!![]};switch(_0x5d663f[_0x5c4f('0x4c')]){case _0x5c4f('0x4d'):_0x2f365c['uri']=_0x5c4f('0x40')+_0x4fc92d+_0x5c4f('0x4e')+_0x3f1c90+'))';return getZohoUser(_0x2f365c,'Contacts')['then'](function(_0x32a093){if(_0x32a093)return _0x32a093;_0x2f365c[_0x5c4f('0x4f')]=_0x5c4f('0x40')+_0x4fc92d+_0x5c4f('0x50')+_0x3f1c90+'))';return getZohoUser(_0x2f365c,'Leads')[_0x5c4f('0x2b')](function(_0x2a06a3){if(_0x2a06a3)return _0x2a06a3;if(_0x5d663f[_0x5c4f('0x42')]!=_0x5c4f('0x51')){return createEndUser(_0x3c698e,_0x4fc92d,_0x3a021a,_0x3f1c90,_0x40d469,_0x5d663f);}else{return{};}});});break;case'contact':_0x2f365c[_0x5c4f('0x4f')]='https://www.zohoapis.'+_0x4fc92d+_0x5c4f('0x4e')+_0x3f1c90+'))';return getZohoUser(_0x2f365c,'Contacts')[_0x5c4f('0x2b')](function(_0x3a47e0){if(_0x3a47e0)return _0x3a47e0;if(_0x5d663f[_0x5c4f('0x42')]!=_0x5c4f('0x51')){return createEndUser(_0x3c698e,_0x4fc92d,_0x3a021a,_0x3f1c90,_0x40d469,_0x5d663f);}else{return{};}});break;case _0x5c4f('0x52'):_0x2f365c[_0x5c4f('0x4f')]=_0x5c4f('0x40')+_0x4fc92d+_0x5c4f('0x50')+_0x3f1c90+'))';return getZohoUser(_0x2f365c,_0x5c4f('0x53'))[_0x5c4f('0x2b')](function(_0x53e835){if(_0x53e835)return _0x53e835;if(_0x5d663f[_0x5c4f('0x42')]!=_0x5c4f('0x51')){return createEndUser(_0x3c698e,_0x4fc92d,_0x3a021a,_0x3f1c90,_0x40d469,_0x5d663f);}else{return{};}});break;}}function getCall(_0x82b7ca,_0x396030,_0x5646f2,_0x54e880,_0x2218bc,_0x4f1d5f,_0x5259bc,_0x1f5872){logger[_0x5c4f('0x37')]('Creating\x20new\x20call...');var _0x112927={};_0x112927[_0x5c4f('0x54')]={'name':!_['isNil'](_0x54e880['role']['name'])&&!_[_0x5c4f('0x1f')](_0x54e880[_0x5c4f('0x3a')][_0x5c4f('0x1c')])&&_0x54e880[_0x5c4f('0x3a')]['name']===_0x5c4f('0x55')?_0x54e880[_0x5c4f('0x43')][_0x5c4f('0x1c')]:!_[_0x5c4f('0x1f')](_0x54e880['first_name'])?_0x54e880['first_name']+'\x20'+_0x54e880[_0x5c4f('0x45')]:_0x54e880[_0x5c4f('0x45')],'id':_0x54e880['id']};_0x112927['Subject']=intUtil[_0x5c4f('0x56')](_0x4f1d5f[_0x5c4f('0x57')],_0x5259bc,'\x20');_0x112927[_0x5c4f('0x58')]=intUtil[_0x5c4f('0x56')](_0x4f1d5f[_0x5c4f('0x59')],_0x5259bc,'\x0a');if(_0x2218bc[_0x5c4f('0x49')]===_0x5c4f('0x5a')){_0x112927['Who_Id']={'name':!_[_0x5c4f('0x1f')](_0x2218bc[_0x5c4f('0x5b')])?_0x2218bc[_0x5c4f('0x5b')]:!_[_0x5c4f('0x1f')](_0x2218bc['First_Name'])?_0x2218bc['First_Name']+'\x20'+_0x2218bc[_0x5c4f('0x5c')]:_0x2218bc[_0x5c4f('0x5c')],'id':_0x2218bc['id']};}if(_0x2218bc[_0x5c4f('0x49')]===_0x5c4f('0x53')){_0x112927['What_Id']={'name':!_[_0x5c4f('0x1f')](_0x2218bc[_0x5c4f('0x5b')])?_0x2218bc[_0x5c4f('0x5b')]:!_['isNil'](_0x2218bc[_0x5c4f('0x5d')])?_0x2218bc[_0x5c4f('0x5d')]+'\x20'+_0x2218bc[_0x5c4f('0x5c')]:_0x2218bc[_0x5c4f('0x5c')],'id':_0x2218bc['id']};_0x112927[_0x5c4f('0x5e')]=_[_0x5c4f('0x4a')](_0x2218bc[_0x5c4f('0x49')]);}if(_0x5259bc[_0x5c4f('0x5f')]){_0x112927[_0x5c4f('0x60')]=moment[_0x5c4f('0x61')](parseInt(_0x5259bc[_0x5c4f('0x5f')])*0x3e8)['format']('mm:ss');}else if(_0x5259bc[_0x5c4f('0x62')]&&_0x5259bc[_0x5c4f('0x63')]){_0x112927[_0x5c4f('0x60')]=moment['utc'](moment(_0x5259bc['endtime'],_0x5c4f('0x64'))[_0x5c4f('0x65')](moment(_0x5259bc[_0x5c4f('0x66')],_0x5c4f('0x64'))))[_0x5c4f('0x67')](_0x5c4f('0x68'));}switch(_0x5259bc[_0x5c4f('0x69')]){case'called':_0x112927['Call_Result']=_0x5c4f('0x6a');break;case _0x5c4f('0x6b'):case _0x5c4f('0x6c'):_0x112927['Call_Result']=_0x5c4f('0x6d');break;case'rejected':_0x112927[_0x5c4f('0x6e')]=_0x5c4f('0x6f');break;case _0x5c4f('0x70'):_0x112927[_0x5c4f('0x6e')]=_0x5c4f('0x71');break;case _0x5c4f('0x72'):_0x112927[_0x5c4f('0x6e')]=_0x5c4f('0x73');default:}_0x112927['Call_Start_Time']=(_0x1f5872===_0x5c4f('0x74')?moment(_0x5259bc[_0x5c4f('0x66')])[_0x5c4f('0x67')](_0x5c4f('0x64')):moment(_0x5259bc[_0x5c4f('0x75')])['format'](_0x5c4f('0x64')))||moment()[_0x5c4f('0x67')](_0x5c4f('0x64'));_0x112927[_0x5c4f('0x76')]=_0x1f5872||_0x5c4f('0x77');_0x112927=_['merge'](_0x112927,getCustomFields(_0x4f1d5f[_0x5c4f('0x78')],_0x5259bc));return request({'method':_0x5c4f('0x26'),'uri':'https://www.zohoapis.'+_0x396030+'/crm/v2/Calls','headers':{'Authorization':_0x5c4f('0x34')+_0x82b7ca},'body':{'data':[_0x112927]},'json':!![]})[_0x5c4f('0x2b')](function(_0x32087c){if(_0x32087c&&_0x32087c[_0x5c4f('0x3f')][0x0][_0x5c4f('0x46')]===_0x5c4f('0x47')){logger[_0x5c4f('0x37')](_0x5c4f('0x79'));return{'id':_0x32087c['data'][0x0]['details']['id']};}})[_0x5c4f('0x2e')](function(_0x5d81e0){logger[_0x5c4f('0x37')]('err',_0x5d81e0[_0x5c4f('0x7a')]);console[_0x5c4f('0x4b')](_0x5c4f('0x7b'),_0x5d81e0);});}exports['queue']=function(_0x30e741,_0x55aa06,_0x5c07a9,_0x3bea9f,_0x3d2834,_0x5366d3){var _0x10abc8,_0x22a177,_0x24d035;_0x5366d3['host']=intUtil[_0x5c4f('0x7c')](_0x5366d3[_0x5c4f('0x7d')]);_0x5366d3[_0x5c4f('0x7e')]=intUtil[_0x5c4f('0x7c')](_0x5366d3[_0x5c4f('0x7e')]);if(_0x3d2834&&_0x3d2834['monitor_format']){logger[_0x5c4f('0x37')]('[QUEUE]',_0x5c4f('0x7f'));_0x55aa06[_0x5c4f('0x80')]=_0x5366d3['serverUrl']+_0x5c4f('0x81')+_0x55aa06['uniqueid']+_0x5c4f('0x82')+md5(_0x55aa06[_0x5c4f('0x83')]);}else{_0x55aa06[_0x5c4f('0x80')]='';}var _0x475fad=_0x5366d3[_0x5c4f('0x7d')]==='zoho.eu'?'eu':_0x5c4f('0x84');return getAccessToken(_0x5366d3)[_0x5c4f('0x2b')](function(_0x3910ae){_0x24d035=_0x3910ae;return getUser(_0x24d035,_0x475fad,_0x5366d3,_0x3bea9f['email']);})[_0x5c4f('0x2b')](function(_0x14bb85){_0x10abc8=_0x14bb85;logger[_0x5c4f('0x37')](_0x5c4f('0x85'),_0x10abc8['id']);return getEndUser(_0x24d035,_0x475fad,_0x5366d3,_0x55aa06[_0x5c4f('0x86')],_0x55aa06['calleridnum'],_0x10abc8,_0x5c07a9);})['then'](function(_0x3e6e29){_0x22a177=_0x3e6e29;return getCall(_0x24d035,_0x475fad,_0x5366d3,_0x10abc8,_0x22a177,_0x5c07a9,_0x55aa06,_0x5c4f('0x77'));})[_0x5c4f('0x2b')](function(_0x1b79db){if(_0x1b79db){logger[_0x5c4f('0x37')](_0x5c4f('0x87'),_0x1b79db['id']);logger[_0x5c4f('0x37')](_0x5c4f('0x88'),_0x5c4f('0x89'));emit(util[_0x5c4f('0x67')]('user:%s',_0x3bea9f[_0x5c4f('0x1c')]),_0x5c4f('0x8a'),{'uri':_0x5c4f('0x8b')+_0x5366d3[_0x5c4f('0x7d')]+_0x5c4f('0x8c')+_0x1b79db['id']});}})['catch'](function(_0x3226f7){logger['error'](_0x5c4f('0x88'),JSON['stringify'](_0x3226f7));});};exports[_0x5c4f('0x74')]=function(_0x24bc20,_0x45f911,_0x2a3759,_0x4dbc2f,_0x3dcb3a,_0x487513,_0x22ebed){var _0x1e82bd,_0x58c5e6,_0x41df43;_0x487513['host']=intUtil[_0x5c4f('0x7c')](_0x487513[_0x5c4f('0x7d')]);_0x487513[_0x5c4f('0x7e')]=intUtil['stripTrailingSlash'](_0x487513['serverUrl']);if(_0x22ebed&&_0x22ebed[_0x5c4f('0x8d')]&&_0x22ebed[_0x5c4f('0x8d')]!==_0x5c4f('0x8e')){logger[_0x5c4f('0x37')]('[OUTBOUND]',_0x5c4f('0x7f'));_0x45f911[_0x5c4f('0x80')]=_0x487513[_0x5c4f('0x7e')]+_0x5c4f('0x81')+_0x45f911[_0x5c4f('0x83')]+_0x5c4f('0x82')+md5(_0x45f911['uniqueid']);}var _0x2ad3db=_0x487513['host']===_0x5c4f('0x8f')?'eu':_0x5c4f('0x84');return getAccessToken(_0x487513)['then'](function(_0x369b96){_0x41df43=_0x369b96;return getUser(_0x41df43,_0x2ad3db,_0x487513,_0x4dbc2f[_0x5c4f('0x90')]);})[_0x5c4f('0x2b')](function(_0x3d03b5){_0x1e82bd=_0x3d03b5;logger[_0x5c4f('0x37')](_0x5c4f('0x85'),_0x1e82bd['id']);return getEndUser(_0x41df43,_0x2ad3db,_0x487513,_0x45f911['destcalleridname'],_0x45f911['destcalleridnum'],_0x1e82bd,_0x2a3759);})[_0x5c4f('0x2b')](function(_0x434de5){_0x58c5e6=_0x434de5;return getCall(_0x41df43,_0x2ad3db,_0x487513,_0x1e82bd,_0x58c5e6,_0x2a3759,_0x45f911,_0x5c4f('0x91'));})[_0x5c4f('0x2b')](function(_0x563de4){if(_0x563de4){logger['info'](_0x5c4f('0x87'),_0x563de4['id']);logger[_0x5c4f('0x37')]('[OUTBOUND]',_0x5c4f('0x89'));emit(util[_0x5c4f('0x67')](_0x5c4f('0x92'),_0x4dbc2f['name']),'trigger:browser:url',{'uri':_0x5c4f('0x8b')+_0x487513['host']+_0x5c4f('0x8c')+_0x563de4['id']});}})[_0x5c4f('0x2e')](function(_0x48f82a){logger['error'](_0x5c4f('0x93'),JSON[_0x5c4f('0xf')](_0x48f82a));});};exports[_0x5c4f('0x94')]=function(_0x29a920,_0x4c41de,_0x345aad,_0x2a1df9,_0x378e95,_0x59b21b){var _0x11b1ce,_0x18f8b7,_0x19e50f;_0x59b21b[_0x5c4f('0x7d')]=intUtil['stripTrailingSlash'](_0x59b21b[_0x5c4f('0x7d')]);_0x59b21b[_0x5c4f('0x7e')]=intUtil[_0x5c4f('0x7c')](_0x59b21b[_0x5c4f('0x7e')]);if(_0x378e95&&_0x378e95['monitor_format']){logger[_0x5c4f('0x37')]('['+_0x4c41de[_0x5c4f('0x69')][_0x5c4f('0x95')]()+']',_0x5c4f('0x7f'));_0x4c41de[_0x5c4f('0x80')]=_0x59b21b[_0x5c4f('0x7e')]+_0x5c4f('0x81')+_0x4c41de[_0x5c4f('0x83')]+_0x5c4f('0x82')+md5(_0x4c41de[_0x5c4f('0x83')]);}else{_0x4c41de[_0x5c4f('0x80')]='';}var _0x38b018=_0x59b21b['host']===_0x5c4f('0x8f')?'eu':'com';return getAccessToken(_0x59b21b)[_0x5c4f('0x2b')](function(_0x2b8968){_0x19e50f=_0x2b8968;return getUser(_0x19e50f,_0x38b018,_0x59b21b);})[_0x5c4f('0x2b')](function(_0x5f009f){_0x11b1ce=_0x5f009f;logger[_0x5c4f('0x37')](_0x5c4f('0x85'),_0x11b1ce['id']);return getEndUser(_0x19e50f,_0x38b018,_0x59b21b,_0x4c41de[_0x5c4f('0x86')],_0x4c41de[_0x5c4f('0x96')],_0x11b1ce,_0x345aad);})[_0x5c4f('0x2b')](function(_0x1fb1cb){_0x18f8b7=_0x1fb1cb;return getCall(_0x19e50f,_0x38b018,_0x59b21b,_0x11b1ce,_0x18f8b7,_0x345aad,_0x4c41de,_0x5c4f('0x77'));})[_0x5c4f('0x2b')](function(_0x4001aa){if(_0x4001aa){logger['info']('The\x20Call\x20ID\x20is:',_0x4001aa['id']);}})['catch'](function(_0xa2265a){logger[_0x5c4f('0x2f')]('['+_0x4c41de[_0x5c4f('0x69')][_0x5c4f('0x95')]()+']',JSON[_0x5c4f('0xf')](_0xa2265a));});}; \ 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 c3ffbfa..d30dabd 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 _0xddd5=['../../../../config/logger','trigger','exec','data2','Script','data3','render','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x510310,_0x54c70f){var _0x5b97a6=function(_0x27f7e3){while(--_0x27f7e3){_0x510310['push'](_0x510310['shift']());}};_0x5b97a6(++_0x54c70f);}(_0xddd5,0x17e));var _0x5ddd=function(_0x426030,_0x150c40){_0x426030=_0x426030-0x0;var _0x42ed8b=_0xddd5[_0x426030];return _0x42ed8b;};'use strict';var util=require(_0x5ddd('0x0'));var sh=require(_0x5ddd('0x1'));var Mustache=require('mustache');var logger=require(_0x5ddd('0x2'))(_0x5ddd('0x3'));exports[_0x5ddd('0x4')]=function(_0x286bb8,_0x5ea903){var _0xa26b49=_0x286bb8[_0x5ddd('0x5')]?_0x286bb8[_0x5ddd('0x5')]:_0x5ddd('0x6');var _0x3398cc=_0x286bb8[_0x5ddd('0x7')]?Mustache[_0x5ddd('0x8')](_0x286bb8[_0x5ddd('0x7')],_0x5ea903):_0x5ea903;sh[_0x5ddd('0x4')](_0x3398cc,function(_0x2e259b,_0x26d381,_0x330e84){if(_0x2e259b!==0x0){logger['error'](util['format'](_0x5ddd('0x9'),_0xa26b49,_0x3398cc,_0x2e259b,_0x330e84));}else{logger['info'](util[_0x5ddd('0xa')](_0x5ddd('0xb'),_0xa26b49,_0x3398cc,_0x26d381));}});}; \ No newline at end of file +var _0xb0ec=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','data3','render','error','format'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xb0ec,0x107));var _0xcb0e=function(_0x21ab59,_0x504d58){_0x21ab59=_0x21ab59-0x0;var _0x3c2929=_0xb0ec[_0x21ab59];return _0x3c2929;};'use strict';var util=require(_0xcb0e('0x0'));var sh=require(_0xcb0e('0x1'));var Mustache=require(_0xcb0e('0x2'));var logger=require('../../../../config/logger')(_0xcb0e('0x3'));exports[_0xcb0e('0x4')]=function(_0x4be811,_0x4021ab){var _0xd5487d=_0x4be811[_0xcb0e('0x5')]?_0x4be811[_0xcb0e('0x5')]:'Script';var _0x259d52=_0x4be811[_0xcb0e('0x6')]?Mustache[_0xcb0e('0x7')](_0x4be811[_0xcb0e('0x6')],_0x4021ab):_0x4021ab;sh['exec'](_0x259d52,function(_0x237d6e,_0x5090ed,_0x55f372){if(_0x237d6e!==0x0){logger[_0xcb0e('0x8')](util[_0xcb0e('0x9')](_0xcb0e('0xa'),_0xd5487d,_0x259d52,_0x237d6e,_0x55f372));}else{logger[_0xcb0e('0xb')](util['format'](_0xcb0e('0xc'),_0xd5487d,_0x259d52,_0x5090ed));}});}; \ 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 a1aaebd..350740a 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 _0x2617=['format','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','lodash','mustache','exec','toUpperCase','data2','data5','parse','render','data6','data1','GET','DELETE','POST','body','error','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x2617,0x161));var _0x7261=function(_0x18ed97,_0x3429ae){_0x18ed97=_0x18ed97-0x0;var _0x37610e=_0x2617[_0x18ed97];return _0x37610e;};'use strict';var rp=require(_0x7261('0x0'));var util=require('util');var _=require(_0x7261('0x1'));var Mustache=require(_0x7261('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x7261('0x3')]=function(_0x1c2141,_0x34762a){var _0x22430b,_0x7997cc;var _0x50ad3a={'method':_0x1c2141['data1'][_0x7261('0x4')](),'uri':Mustache['render'](_0x1c2141[_0x7261('0x5')],_0x34762a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1c2141[_0x7261('0x6')])==='number'&&parseInt(_0x1c2141[_0x7261('0x6')])>=0x1&&parseInt(_0x1c2141['data5'])<=0xa?parseInt(_0x1c2141[_0x7261('0x6')])*0x3e8:0x5*0x3e8};try{_0x50ad3a['headers']=_0x1c2141['data6']?JSON[_0x7261('0x7')](Mustache[_0x7261('0x8')](_0x1c2141[_0x7261('0x9')],_0x34762a)):{};}catch(_0x5950ef){logger['error'](_0x5950ef['stack']);}switch(_0x1c2141[_0x7261('0xa')][_0x7261('0x4')]()){case _0x7261('0xb'):case _0x7261('0xc'):_0x22430b=null;_0x50ad3a['qs']=_0x34762a;break;case _0x7261('0xd'):case'PUT':if(_0x1c2141['data7']){try{_0x22430b=JSON[_0x7261('0x7')](Mustache['render'](_0x1c2141['data7'],_0x34762a));_0x50ad3a[_0x7261('0xe')]=_0x22430b;}catch(_0x3af696){logger[_0x7261('0xf')](_0x3af696['stack']);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x22430b=_0x34762a;_0x50ad3a[_0x7261('0xe')]=_0x22430b;}break;}logger[_0x7261('0x10')](util['format'](_0x7261('0x11'),_0x1c2141[_0x7261('0xa')],_0x1c2141[_0x7261('0x5')],JSON[_0x7261('0x12')](_0x50ad3a)));rp(_0x50ad3a)[_0x7261('0x13')](function(_0x5a144e){_0x22430b=!_[_0x7261('0x14')](_0x22430b)?_0x7261('0x15')+_0x22430b:'';_0x7997cc=typeof _0x5a144e[_0x7261('0xe')]==='object'?JSON[_0x7261('0x12')](_0x5a144e[_0x7261('0xe')]):_0x5a144e[_0x7261('0xe')];logger[_0x7261('0x10')](util['format'](_0x7261('0x16'),_0x1c2141[_0x7261('0xa')],_0x1c2141[_0x7261('0x5')],_0x5a144e[_0x7261('0x17')],_0x7997cc));})[_0x7261('0x18')](function(_0x5d2d26){logger[_0x7261('0xf')](util[_0x7261('0x19')](_0x7261('0x1a'),_0x1c2141[_0x7261('0xa')],_0x1c2141[_0x7261('0x5')],_0x5d2d26[_0x7261('0x17')],_0x5d2d26['name'],_0x5d2d26['message']));});}; \ No newline at end of file +var _0x4568=['statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','mustache','exec','data1','toUpperCase','render','data2','number','data5','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0x117721,_0x4b5aaf){var _0x22199c=function(_0x3246b2){while(--_0x3246b2){_0x117721['push'](_0x117721['shift']());}};_0x22199c(++_0x4b5aaf);}(_0x4568,0x198));var _0x8456=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x4568[_0x35da42];return _0x370035;};'use strict';var rp=require('request-promise');var util=require(_0x8456('0x0'));var _=require('lodash');var Mustache=require(_0x8456('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x8456('0x2')]=function(_0x2afc50,_0x560589){var _0x41759a,_0x271272;var _0xf88e71={'method':_0x2afc50[_0x8456('0x3')][_0x8456('0x4')](),'uri':Mustache[_0x8456('0x5')](_0x2afc50[_0x8456('0x6')],_0x560589),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2afc50['data5'])===_0x8456('0x7')&&parseInt(_0x2afc50[_0x8456('0x8')])>=0x1&&parseInt(_0x2afc50[_0x8456('0x8')])<=0xa?parseInt(_0x2afc50['data5'])*0x3e8:0x5*0x3e8};try{_0xf88e71['headers']=_0x2afc50[_0x8456('0x9')]?JSON[_0x8456('0xa')](Mustache[_0x8456('0x5')](_0x2afc50[_0x8456('0x9')],_0x560589)):{};}catch(_0x5d26c7){logger[_0x8456('0xb')](_0x5d26c7[_0x8456('0xc')]);}switch(_0x2afc50[_0x8456('0x3')][_0x8456('0x4')]()){case'GET':case _0x8456('0xd'):_0x41759a=null;_0xf88e71['qs']=_0x560589;break;case _0x8456('0xe'):case _0x8456('0xf'):if(_0x2afc50[_0x8456('0x10')]){try{_0x41759a=JSON[_0x8456('0xa')](Mustache[_0x8456('0x5')](_0x2afc50[_0x8456('0x10')],_0x560589));_0xf88e71[_0x8456('0x11')]=_0x41759a;}catch(_0x54eab4){logger[_0x8456('0xb')](_0x54eab4['stack']);logger[_0x8456('0xb')](_0x8456('0x12'));}}else{_0x41759a=_0x560589;_0xf88e71[_0x8456('0x11')]=_0x41759a;}break;}logger[_0x8456('0x13')](util[_0x8456('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x2afc50['data1'],_0x2afc50[_0x8456('0x6')],JSON['stringify'](_0xf88e71)));rp(_0xf88e71)[_0x8456('0x15')](function(_0x4cc789){_0x41759a=!_['isNil'](_0x41759a)?_0x8456('0x16')+_0x41759a:'';_0x271272=typeof _0x4cc789[_0x8456('0x11')]===_0x8456('0x17')?JSON[_0x8456('0x18')](_0x4cc789[_0x8456('0x11')]):_0x4cc789[_0x8456('0x11')];logger['info'](util['format'](_0x8456('0x19'),_0x2afc50['data1'],_0x2afc50[_0x8456('0x6')],_0x4cc789[_0x8456('0x1a')],_0x271272));})[_0x8456('0x1b')](function(_0x2c2aa8){logger['error'](util['format'](_0x8456('0x1c'),_0x2afc50[_0x8456('0x3')],_0x2afc50[_0x8456('0x6')],_0x2c2aa8[_0x8456('0x1a')],_0x2c2aa8[_0x8456('0x1d')],_0x2c2aa8[_0x8456('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f661a8f..4662989 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 _0x131f=['result','catch','exports','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error','message'];(function(_0x5bdb74,_0x3f95af){var _0x45f2d0=function(_0xf49d90){while(--_0xf49d90){_0x5bdb74['push'](_0x5bdb74['shift']());}};_0x45f2d0(++_0x3f95af);}(_0x131f,0x114));var _0xf131=function(_0x312663,_0x145fc5){_0x312663=_0x312663-0x0;var _0x3a0bea=_0x131f[_0x312663];return _0x3a0bea;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf131('0x0'));var logger=require(_0xf131('0x1'))(_0xf131('0x2'));var client=jayson['client'][_0xf131('0x3')]({'port':0x2329});client[_0xf131('0x4')]=function(_0xe59739,_0x1e916a){return new BPromise(function(_0x504294,_0x2e222a){return client[_0xf131('0x5')](_0xe59739,_0x1e916a)[_0xf131('0x6')](function(_0x4a5e93){logger['debug'](_0xf131('0x7'),'routing',_0xe59739,_0x1e916a,_0x4a5e93);if(_0x4a5e93[_0xf131('0x8')]){logger[_0xf131('0x8')](_0xf131('0x7'),_0xf131('0x2'),_0xe59739,_0x4a5e93[_0xf131('0x8')][_0xf131('0x9')],_0x1e916a);return _0x2e222a(_0x4a5e93['error'][_0xf131('0x9')]);}else{return _0x504294(_0x4a5e93[_0xf131('0xa')]);}})[_0xf131('0xb')](function(_0x592356){logger[_0xf131('0x8')](_0xf131('0x7'),_0xf131('0x2'),_0xe59739,_0x592356,_0x1e916a);return _0x2e222a(_0x592356);});});};module[_0xf131('0xc')]=client; \ No newline at end of file +var _0x79f5=['http','request','then','debug','rpc','error','result','catch','jayson/promise','bluebird','routing'];(function(_0x2663d8,_0x10ce3d){var _0x21265b=function(_0x347bea){while(--_0x347bea){_0x2663d8['push'](_0x2663d8['shift']());}};_0x21265b(++_0x10ce3d);}(_0x79f5,0xce));var _0x579f=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x79f5[_0x1ddedd];return _0xa3e1ac;};'use strict';var jayson=require(_0x579f('0x0'));var BPromise=require(_0x579f('0x1'));var logger=require('../../config/logger')(_0x579f('0x2'));var client=jayson['client'][_0x579f('0x3')]({'port':0x2329});client['Request']=function(_0x2075df,_0x38f015){return new BPromise(function(_0x29bc17,_0x50bb0f){return client[_0x579f('0x4')](_0x2075df,_0x38f015)[_0x579f('0x5')](function(_0x53c39c){logger[_0x579f('0x6')](_0x579f('0x7'),_0x579f('0x2'),_0x2075df,_0x38f015,_0x53c39c);if(_0x53c39c[_0x579f('0x8')]){logger[_0x579f('0x8')](_0x579f('0x7'),'routing',_0x2075df,_0x53c39c['error']['message'],_0x38f015);return _0x50bb0f(_0x53c39c['error']['message']);}else{return _0x29bc17(_0x53c39c[_0x579f('0x9')]);}})[_0x579f('0xa')](function(_0x3bdf07){logger[_0x579f('0x8')](_0x579f('0x7'),_0x579f('0x2'),_0x2075df,_0x3bdf07,_0x38f015);return _0x50bb0f(_0x3bdf07);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e74a11b..29ab569 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 _0xcc87=['initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','email','resolve','getMailAccounts','then'];(function(_0x5019ac,_0x34abba){var _0x14a9f9=function(_0x4e8c04){while(--_0x4e8c04){_0x5019ac['push'](_0x5019ac['shift']());}};_0x14a9f9(++_0x34abba);}(_0xcc87,0x88));var _0x7cc8=function(_0x251568,_0xbdce15){_0x251568=_0x251568-0x0;var _0xa598bf=_0xcc87[_0x251568];return _0xa598bf;};'use strict';var server=require(_0x7cc8('0x0'));var Realtime=require(_0x7cc8('0x1'));var EmailChannel=require(_0x7cc8('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x7cc8('0x3'));var logger=require('../../config/logger')(_0x7cc8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7cc8('0x5')]()['then'](mailAccount[_0x7cc8('0x6')]())[_0x7cc8('0x7')](realtime[_0x7cc8('0x8')]())[_0x7cc8('0x7')](function(){email[_0x7cc8('0x9')](realtime[_0x7cc8('0xa')]);return realtime;});}function main(){return server[_0x7cc8('0xb')](realtime,email)[_0x7cc8('0x7')](function(){return initRealtime();})[_0x7cc8('0x7')](function(){return setting[_0x7cc8('0xc')]();})[_0x7cc8('0x7')](function(_0x322a83){return setInterval(initRealtime,_0x322a83[_0x7cc8('0xd')]*0x3e8);})['catch'](function(_0xd24416){logger[_0x7cc8('0xe')](_0x7cc8('0xf'),_0xd24416);});}main(); \ No newline at end of file +var _0x8e28=['mailAccounts','listen','getSettings','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x204a96,_0x4b762e){var _0x174596=function(_0x455499){while(--_0x455499){_0x204a96['push'](_0x204a96['shift']());}};_0x174596(++_0x4b762e);}(_0x8e28,0x18b));var _0x88e2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x8e28[_0x1a36a5];return _0x746243;};'use strict';var server=require(_0x88e2('0x0'));var Realtime=require(_0x88e2('0x1'));var EmailChannel=require(_0x88e2('0x2'));var mailAccount=require(_0x88e2('0x3'));var setting=require(_0x88e2('0x4'));var logger=require(_0x88e2('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x88e2('0x6')](mailAccount[_0x88e2('0x7')]())[_0x88e2('0x6')](realtime[_0x88e2('0x8')]())['then'](function(){email[_0x88e2('0x9')](realtime[_0x88e2('0xa')]);return realtime;});}function main(){return server[_0x88e2('0xb')](realtime,email)[_0x88e2('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x88e2('0xc')]();})[_0x88e2('0x6')](function(_0x3b9d56){return setInterval(initRealtime,_0x3b9d56['loginMailFrequency']*0x3e8);})[_0x88e2('0xd')](function(_0x173a50){logger[_0x88e2('0xe')]('Email\x20service\x20initialization',_0x173a50);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c268e54..cf61e87 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 _0xb1f9=['email','defaults','socket.io-emitter','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','custom','imapAccounts','box','handleImapBox','bind','handleImapEnd','error','handleImapError','disabled','messages','handleImapEmail','firstName','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','verify','lodash','moment','bluebird','md5','../../../config/environment'];(function(_0x4e06f3,_0x5c35db){var _0x1ed6f1=function(_0x4eda45){while(--_0x4eda45){_0x4e06f3['push'](_0x4e06f3['shift']());}};_0x1ed6f1(++_0x5c35db);}(_0xb1f9,0x193));var _0x9b1f=function(_0x3af55e,_0x3988d1){_0x3af55e=_0x3af55e-0x0;var _0x1f08fc=_0xb1f9[_0x3af55e];return _0x1f08fc;};'use strict';var _=require(_0x9b1f('0x0'));var moment=require(_0x9b1f('0x1'));var BPromise=require(_0x9b1f('0x2'));var md5=require(_0x9b1f('0x3'));var Redis=require('ioredis');var config=require(_0x9b1f('0x4'));var logger=require('../../../config/logger')(_0x9b1f('0x5'));config['redis']=_[_0x9b1f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9b1f('0x7'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x9b1f('0x8'));var md5Accounts={};function EmailChannel(_0x14c0d4){logger[_0x9b1f('0x9')](_0x9b1f('0xa'));this[_0x9b1f('0xb')]=_0x14c0d4[_0x9b1f('0xb')];this['imapAccounts']={};this[_0x9b1f('0xc')]=new EmailSmtp();}EmailChannel[_0x9b1f('0xd')][_0x9b1f('0xe')]=function(_0x317a07){var _0xa473e=this[_0x9b1f('0xb')][_0x317a07];var _0x3cd363={'id':_0xa473e['id'],'name':_0xa473e[_0x9b1f('0xf')],'key':_0xa473e['key'],'active':_0xa473e[_0x9b1f('0x10')],'Imap':{'status':_0xa473e[_0x9b1f('0x11')][_0x9b1f('0x12')],'messageStatus':_0xa473e[_0x9b1f('0x11')][_0x9b1f('0x13')],'total':_0xa473e[_0x9b1f('0x11')][_0x9b1f('0x14')]}};if(_[_0x9b1f('0x15')](md5Accounts[_0x317a07])){md5Accounts[_0x317a07]={};}var _0x11a2f5=md5(JSON[_0x9b1f('0x16')](_0x3cd363));if(md5Accounts[_0x317a07][_0x9b1f('0x3')]!==_0x11a2f5){md5Accounts[_0x317a07]['md5']=_0x11a2f5;io['emit'](_0x9b1f('0x17'),_0x3cd363);}};EmailChannel[_0x9b1f('0xd')][_0x9b1f('0x18')]=function(_0x2720a0){for(var _0x5c7913 in _0x2720a0){if(_0x2720a0[_0x9b1f('0x19')](_0x5c7913)){if(_0x2720a0[_0x5c7913]['Imap']&&_0x2720a0[_0x5c7913]['active']){var _0x55802c=_0x2720a0[_0x5c7913]['Imap'];if(!_0x55802c[_0x9b1f('0x1a')]&&_0x2720a0[_0x5c7913]['provider']!==_0x9b1f('0x1b'))_0x55802c[_0x9b1f('0x1a')]=_0x2720a0[_0x5c7913]['provider'];if(!this['imapAccounts'][_0x9b1f('0x19')](_0x55802c['id'])){this[_0x9b1f('0x1c')][_0x55802c['id']]=new EmailImap(_0x55802c,_0x2720a0[_0x5c7913][_0x9b1f('0x5')]);this['imapAccounts'][_0x55802c['id']]['on'](_0x9b1f('0x1d'),this[_0x9b1f('0x1e')][_0x9b1f('0x1f')](this,_0x5c7913));this['imapAccounts'][_0x55802c['id']]['on'](_0x9b1f('0x5'),this['handleImapEmail'][_0x9b1f('0x1f')](this,_0x5c7913));this[_0x9b1f('0x1c')][_0x55802c['id']]['on']('end',this[_0x9b1f('0x20')]['bind'](this,_0x5c7913));this[_0x9b1f('0x1c')][_0x55802c['id']]['on'](_0x9b1f('0x21'),this[_0x9b1f('0x22')][_0x9b1f('0x1f')](this,_0x5c7913));}}else{if(_[_0x9b1f('0x15')](this[_0x9b1f('0xb')][_0x5c7913][_0x9b1f('0x11')])){this[_0x9b1f('0xb')][_0x5c7913][_0x9b1f('0x11')]={};}this[_0x9b1f('0xb')][_0x5c7913][_0x9b1f('0x11')]['status']=_0x9b1f('0x23');this[_0x9b1f('0xb')][_0x5c7913][_0x9b1f('0x11')]['messageStatus']='';this[_0x9b1f('0xe')](_0x5c7913);}}}};EmailChannel[_0x9b1f('0xd')][_0x9b1f('0x1e')]=function(_0x3199b6,_0x52b4fa){if(this['mailAccounts'][_0x3199b6]){this['mailAccounts'][_0x3199b6]['Imap'][_0x9b1f('0x12')]='connected';this[_0x9b1f('0xb')][_0x3199b6][_0x9b1f('0x11')][_0x9b1f('0x13')]=_0x52b4fa[_0x9b1f('0xf')];if(_0x52b4fa[_0x9b1f('0x24')]){this[_0x9b1f('0xb')][_0x3199b6][_0x9b1f('0x11')][_0x9b1f('0x14')]=_0x52b4fa[_0x9b1f('0x24')][_0x9b1f('0x14')];}return this[_0x9b1f('0xe')](_0x3199b6);}};EmailChannel[_0x9b1f('0xd')][_0x9b1f('0x25')]=function(_0x84fbfb,_0x325624){logger[_0x9b1f('0x9')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x325624[_0x9b1f('0x26')],_0x325624[_0x9b1f('0x27')],_0x325624[_0x9b1f('0x28')],_0x84fbfb);if(this[_0x9b1f('0xb')][_0x84fbfb]){return mailAccount[_0x9b1f('0x29')](_0x84fbfb,_0x325624)['then'](function(_0x463738){if(_0x463738){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x9b1f('0x2a')](function(_0x34d650){logger[_0x9b1f('0x21')](_0x9b1f('0x2b'),JSON[_0x9b1f('0x16')](_0x34d650));});}};EmailChannel[_0x9b1f('0xd')][_0x9b1f('0x20')]=function(_0x57e548){if(this[_0x9b1f('0xb')][_0x57e548]&&this[_0x9b1f('0xb')][_0x57e548]['Imap']){if(this[_0x9b1f('0x1c')][this[_0x9b1f('0xb')][_0x57e548]['Imap']['id']]){delete this[_0x9b1f('0x1c')][this[_0x9b1f('0xb')][_0x57e548][_0x9b1f('0x11')]['id']];}this[_0x9b1f('0xb')][_0x57e548][_0x9b1f('0x11')][_0x9b1f('0x2c')]=moment();this['emit'](_0x57e548);}};EmailChannel[_0x9b1f('0xd')]['handleImapError']=function(_0x2c6c3d,_0x2351e0){if(this[_0x9b1f('0xb')][_0x2c6c3d]){this[_0x9b1f('0xb')][_0x2c6c3d][_0x9b1f('0x11')]['status']=_0x9b1f('0x21');this[_0x9b1f('0xb')][_0x2c6c3d][_0x9b1f('0x11')][_0x9b1f('0x13')]=_0x2351e0;return this[_0x9b1f('0xe')](_0x2c6c3d);}};EmailChannel[_0x9b1f('0xd')][_0x9b1f('0x2d')]=function(_0x5f4214,_0x1d6177){return this[_0x9b1f('0xc')][_0x9b1f('0x2e')](_0x5f4214,_0x1d6177);};EmailChannel['prototype'][_0x9b1f('0x2f')]=function(_0x14b0ec){var _0x303ab5=this;if(this[_0x9b1f('0xb')][_0x14b0ec['id']]){if(_[_0x9b1f('0x15')](this['mailAccounts'][_0x14b0ec['id']][_0x9b1f('0x30')])){this['mailAccounts'][_0x14b0ec['id']][_0x9b1f('0x30')]={};}this['mailAccounts'][_0x14b0ec['id']][_0x9b1f('0x30')][_0x9b1f('0x2c')]=moment();return new BPromise(function(_0x452648,_0x185098){return _0x303ab5['smtp']['verify'](_0x14b0ec)['then'](function(_0x9596a8){_0x303ab5['mailAccounts'][_0x14b0ec['id']]['Smtp'][_0x9b1f('0x12')]=_0x9b1f('0x31');_0x303ab5[_0x9b1f('0xb')][_0x14b0ec['id']]['Smtp'][_0x9b1f('0x13')]='';_0x303ab5[_0x9b1f('0xe')](_0x14b0ec['id']);_0x452648(_0x9596a8);})[_0x9b1f('0x2a')](function(_0x389e62){_0x303ab5[_0x9b1f('0xb')][_0x14b0ec['id']][_0x9b1f('0x30')][_0x9b1f('0x12')]=_0x9b1f('0x21');_0x303ab5[_0x9b1f('0xb')][_0x14b0ec['id']]['Smtp']['messageStatus']=_0x389e62;_0x303ab5[_0x9b1f('0xe')](_0x14b0ec['id']);_0x185098(_0x389e62);});});}return this[_0x9b1f('0xc')][_0x9b1f('0x32')](_0x14b0ec);};module['exports']=EmailChannel; \ No newline at end of file +var _0x3c9b=['total','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','service','provider','custom','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','status','disabled','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','then','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','key','active','Imap','messageStatus'];(function(_0x5b8ef0,_0x26f20c){var _0x92257c=function(_0x31bb31){while(--_0x31bb31){_0x5b8ef0['push'](_0x5b8ef0['shift']());}};_0x92257c(++_0x26f20c);}(_0x3c9b,0x1af));var _0xb3c9=function(_0x21aeaf,_0x2a011e){_0x21aeaf=_0x21aeaf-0x0;var _0x4ef745=_0x3c9b[_0x21aeaf];return _0x4ef745;};'use strict';var _=require(_0xb3c9('0x0'));var moment=require(_0xb3c9('0x1'));var BPromise=require(_0xb3c9('0x2'));var md5=require(_0xb3c9('0x3'));var Redis=require(_0xb3c9('0x4'));var config=require(_0xb3c9('0x5'));var logger=require(_0xb3c9('0x6'))(_0xb3c9('0x7'));config[_0xb3c9('0x8')]=_[_0xb3c9('0x9')](config[_0xb3c9('0x8')],{'host':_0xb3c9('0xa'),'port':0x18eb});var io=require(_0xb3c9('0xb'))(new Redis(config[_0xb3c9('0x8')]));var EmailImap=require(_0xb3c9('0xc'));var EmailSmtp=require(_0xb3c9('0xd'));var mailAccount=require(_0xb3c9('0xe'));var md5Accounts={};function EmailChannel(_0x3c6fd1){logger[_0xb3c9('0xf')](_0xb3c9('0x10'));this['mailAccounts']=_0x3c6fd1[_0xb3c9('0x11')];this[_0xb3c9('0x12')]={};this[_0xb3c9('0x13')]=new EmailSmtp();}EmailChannel['prototype'][_0xb3c9('0x14')]=function(_0x3b2be2){var _0xe8f2b8=this[_0xb3c9('0x11')][_0x3b2be2];var _0x90ad7f={'id':_0xe8f2b8['id'],'name':_0xe8f2b8['name'],'key':_0xe8f2b8[_0xb3c9('0x15')],'active':_0xe8f2b8[_0xb3c9('0x16')],'Imap':{'status':_0xe8f2b8[_0xb3c9('0x17')]['status'],'messageStatus':_0xe8f2b8['Imap'][_0xb3c9('0x18')],'total':_0xe8f2b8[_0xb3c9('0x17')][_0xb3c9('0x19')]}};if(_[_0xb3c9('0x1a')](md5Accounts[_0x3b2be2])){md5Accounts[_0x3b2be2]={};}var _0x29b01c=md5(JSON[_0xb3c9('0x1b')](_0x90ad7f));if(md5Accounts[_0x3b2be2]['md5']!==_0x29b01c){md5Accounts[_0x3b2be2][_0xb3c9('0x3')]=_0x29b01c;io['emit'](_0xb3c9('0x1c'),_0x90ad7f);}};EmailChannel[_0xb3c9('0x1d')]['refresh']=function(_0x20053d){for(var _0x36f210 in _0x20053d){if(_0x20053d[_0xb3c9('0x1e')](_0x36f210)){if(_0x20053d[_0x36f210][_0xb3c9('0x17')]&&_0x20053d[_0x36f210][_0xb3c9('0x16')]){var _0x498521=_0x20053d[_0x36f210][_0xb3c9('0x17')];if(!_0x498521[_0xb3c9('0x1f')]&&_0x20053d[_0x36f210][_0xb3c9('0x20')]!==_0xb3c9('0x21'))_0x498521[_0xb3c9('0x1f')]=_0x20053d[_0x36f210][_0xb3c9('0x20')];if(!this['imapAccounts'][_0xb3c9('0x1e')](_0x498521['id'])){this[_0xb3c9('0x12')][_0x498521['id']]=new EmailImap(_0x498521,_0x20053d[_0x36f210][_0xb3c9('0x7')]);this[_0xb3c9('0x12')][_0x498521['id']]['on']('box',this[_0xb3c9('0x22')][_0xb3c9('0x23')](this,_0x36f210));this[_0xb3c9('0x12')][_0x498521['id']]['on'](_0xb3c9('0x7'),this[_0xb3c9('0x24')][_0xb3c9('0x23')](this,_0x36f210));this[_0xb3c9('0x12')][_0x498521['id']]['on']('end',this[_0xb3c9('0x25')][_0xb3c9('0x23')](this,_0x36f210));this[_0xb3c9('0x12')][_0x498521['id']]['on'](_0xb3c9('0x26'),this[_0xb3c9('0x27')]['bind'](this,_0x36f210));}}else{if(_[_0xb3c9('0x1a')](this[_0xb3c9('0x11')][_0x36f210][_0xb3c9('0x17')])){this[_0xb3c9('0x11')][_0x36f210]['Imap']={};}this[_0xb3c9('0x11')][_0x36f210]['Imap'][_0xb3c9('0x28')]=_0xb3c9('0x29');this[_0xb3c9('0x11')][_0x36f210]['Imap'][_0xb3c9('0x18')]='';this[_0xb3c9('0x14')](_0x36f210);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x506b91,_0x4f54c3){if(this[_0xb3c9('0x11')][_0x506b91]){this['mailAccounts'][_0x506b91][_0xb3c9('0x17')]['status']='connected';this[_0xb3c9('0x11')][_0x506b91][_0xb3c9('0x17')][_0xb3c9('0x18')]=_0x4f54c3[_0xb3c9('0x2a')];if(_0x4f54c3[_0xb3c9('0x2b')]){this['mailAccounts'][_0x506b91][_0xb3c9('0x17')]['total']=_0x4f54c3['messages'][_0xb3c9('0x19')];}return this[_0xb3c9('0x14')](_0x506b91);}};EmailChannel[_0xb3c9('0x1d')]['handleImapEmail']=function(_0xc435c2,_0x2dde6c){logger[_0xb3c9('0xf')](_0xb3c9('0x2c'),_0x2dde6c[_0xb3c9('0x2d')],_0x2dde6c['lastName'],_0x2dde6c[_0xb3c9('0x2e')],_0xc435c2);if(this[_0xb3c9('0x11')][_0xc435c2]){return mailAccount[_0xb3c9('0x2f')](_0xc435c2,_0x2dde6c)['then'](function(_0x19f463){if(_0x19f463){logger[_0xb3c9('0xf')](_0xb3c9('0x30'));}})[_0xb3c9('0x31')](function(_0x562e1c){logger['error'](_0xb3c9('0x32'),JSON[_0xb3c9('0x1b')](_0x562e1c));});}};EmailChannel['prototype'][_0xb3c9('0x25')]=function(_0x21d4de){if(this['mailAccounts'][_0x21d4de]&&this[_0xb3c9('0x11')][_0x21d4de][_0xb3c9('0x17')]){if(this[_0xb3c9('0x12')][this[_0xb3c9('0x11')][_0x21d4de][_0xb3c9('0x17')]['id']]){delete this[_0xb3c9('0x12')][this[_0xb3c9('0x11')][_0x21d4de][_0xb3c9('0x17')]['id']];}this[_0xb3c9('0x11')][_0x21d4de]['Imap'][_0xb3c9('0x33')]=moment();this[_0xb3c9('0x14')](_0x21d4de);}};EmailChannel[_0xb3c9('0x1d')]['handleImapError']=function(_0x87c5f5,_0x5b07f0){if(this[_0xb3c9('0x11')][_0x87c5f5]){this[_0xb3c9('0x11')][_0x87c5f5]['Imap'][_0xb3c9('0x28')]=_0xb3c9('0x26');this[_0xb3c9('0x11')][_0x87c5f5][_0xb3c9('0x17')][_0xb3c9('0x18')]=_0x5b07f0;return this[_0xb3c9('0x14')](_0x87c5f5);}};EmailChannel[_0xb3c9('0x1d')][_0xb3c9('0x34')]=function(_0x2b5468,_0x8d1b88){return this[_0xb3c9('0x13')][_0xb3c9('0x35')](_0x2b5468,_0x8d1b88);};EmailChannel[_0xb3c9('0x1d')]['verifySmtp']=function(_0x585709){var _0x2037a1=this;if(this[_0xb3c9('0x11')][_0x585709['id']]){if(_['isNil'](this[_0xb3c9('0x11')][_0x585709['id']][_0xb3c9('0x36')])){this['mailAccounts'][_0x585709['id']][_0xb3c9('0x36')]={};}this[_0xb3c9('0x11')][_0x585709['id']][_0xb3c9('0x36')][_0xb3c9('0x33')]=moment();return new BPromise(function(_0x119d25,_0x3a4592){return _0x2037a1[_0xb3c9('0x13')][_0xb3c9('0x37')](_0x585709)[_0xb3c9('0x38')](function(_0x43265c){_0x2037a1[_0xb3c9('0x11')][_0x585709['id']]['Smtp']['status']='verified';_0x2037a1[_0xb3c9('0x11')][_0x585709['id']][_0xb3c9('0x36')][_0xb3c9('0x18')]='';_0x2037a1[_0xb3c9('0x14')](_0x585709['id']);_0x119d25(_0x43265c);})[_0xb3c9('0x31')](function(_0x4b373a){_0x2037a1[_0xb3c9('0x11')][_0x585709['id']]['Smtp'][_0xb3c9('0x28')]=_0xb3c9('0x26');_0x2037a1[_0xb3c9('0x11')][_0x585709['id']][_0xb3c9('0x36')][_0xb3c9('0x18')]=_0x4b373a;_0x2037a1['emit'](_0x585709['id']);_0x3a4592(_0x4b373a);});});}return this[_0xb3c9('0x13')]['verify'](_0x585709);};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 164148b..34b2a75 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 _0xfa7a=['search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','inherits','prototype','connTimeout','authTimeout','service','modernAuthentication','generateXOAuth2Token','password','user','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','handleOpenBox','handleError','box','readUnseen'];(function(_0x903e7f,_0x3a8c45){var _0x2411f3=function(_0x4392a0){while(--_0x4392a0){_0x903e7f['push'](_0x903e7f['shift']());}};_0x2411f3(++_0x3a8c45);}(_0xfa7a,0x1ed));var _0xafa7=function(_0x3a6def,_0x19d1a3){_0x3a6def=_0x3a6def-0x0;var _0x57717e=_0xfa7a[_0x3a6def];return _0x57717e;};'use strict';var _=require(_0xafa7('0x0'));var util=require(_0xafa7('0x1'));var Imap=require(_0xafa7('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0xafa7('0x3'))[_0xafa7('0x4')];var EventEmitter=require(_0xafa7('0x5'))[_0xafa7('0x6')];var utils=require('./utils');var logger=require(_0xafa7('0x7'))(_0xafa7('0x8'));function EmailImap(_0xfe2590,_0x53144a){this[_0xafa7('0x9')]=_0xfe2590[_0xafa7('0x9')];this[_0xafa7('0xa')]=this[_0xafa7('0xb')](_0xfe2590,_0x53144a);this['imap']=new Imap(this[_0xafa7('0xa')]);this['imap'][_0xafa7('0xc')](_0xafa7('0xd'),this['handleReady'][_0xafa7('0xe')](this));this[_0xafa7('0x2')][_0xafa7('0xc')](_0xafa7('0xf'),this[_0xafa7('0x10')][_0xafa7('0xe')](this));this[_0xafa7('0x2')]['on'](_0xafa7('0x11'),this['handleError']['bind'](this));this[_0xafa7('0x2')]['connect']();}util[_0xafa7('0x12')](EmailImap,EventEmitter);EmailImap[_0xafa7('0x13')]['getAccount']=function(_0x21a5f7,_0x4b2f8d){var _0x1f0b84={'connTimeout':_0x21a5f7['connTimeout']?_0x21a5f7[_0xafa7('0x14')]*0x3e8:0x2710,'authTimeout':_0x21a5f7[_0xafa7('0x15')]?_0x21a5f7['authTimeout']*0x3e8:0x1388};if(_0x21a5f7[_0xafa7('0x16')]){_0x1f0b84['user']=_0x21a5f7['user'];if(_0x21a5f7[_0xafa7('0x17')]){_0x1f0b84['xoauth2']=utils[_0xafa7('0x18')](_0x21a5f7['CloudProvider']['data5'],_0x21a5f7['user']);}else{_0x1f0b84['password']=_0x21a5f7[_0xafa7('0x19')];}}else{if(_0x21a5f7['authentication']){_0x1f0b84[_0xafa7('0x1a')]=_0x21a5f7[_0xafa7('0x1a')];_0x1f0b84[_0xafa7('0x19')]=_0x21a5f7['password'];}}_0x1f0b84[_0xafa7('0x8')]=_0x4b2f8d||_0x21a5f7['user']||_0xafa7('0x1b');_0x1f0b84['host']=_0x21a5f7[_0xafa7('0x1c')];_0x1f0b84[_0xafa7('0x1d')]=_0x21a5f7[_0xafa7('0x1d')]||0x3e1;if(_0x21a5f7[_0xafa7('0x1e')]){_0x1f0b84['tls']=!![];}else{_0x1f0b84['tls']=![];_0x1f0b84[_0xafa7('0x1f')]=_0xafa7('0x20');}return _0x1f0b84;};EmailImap['prototype'][_0xafa7('0x21')]=function(){this['imap']['openBox'](this[_0xafa7('0x9')],![],this['handleOpenBox'][_0xafa7('0xe')](this));};EmailImap[_0xafa7('0x13')][_0xafa7('0x22')]=function(_0x13d362,_0x470aa5){if(_0x13d362){this[_0xafa7('0x23')](_0x13d362,!![]);}else{this['emit'](_0xafa7('0x24'),_0x470aa5);this[_0xafa7('0x25')]();}};EmailImap[_0xafa7('0x13')]['handleCloseBox']=function(_0x58a0ad){if(_0x58a0ad){this[_0xafa7('0x23')](_0x58a0ad,!![]);}else{this[_0xafa7('0x2')][_0xafa7('0xf')]();}};EmailImap[_0xafa7('0x13')][_0xafa7('0x25')]=function(){this['imap'][_0xafa7('0x26')](['UNSEEN'],this[_0xafa7('0x27')][_0xafa7('0xe')](this));};EmailImap[_0xafa7('0x13')]['handleReadUnseen']=function(_0x202e9d,_0x56c63a){if(_0x202e9d){this[_0xafa7('0x23')](_0x202e9d,!![]);}else{if(_0x56c63a[_0xafa7('0x28')]){try{var _0x3d881c=this['imap'][_0xafa7('0x29')](_0x56c63a,{'bodies':'','markSeen':!![]});_0x3d881c['on'](_0xafa7('0x2a'),this[_0xafa7('0x2b')][_0xafa7('0xe')](this));_0x3d881c['once'](_0xafa7('0x11'),this[_0xafa7('0x2c')][_0xafa7('0xe')](this));_0x3d881c[_0xafa7('0xc')](_0xafa7('0xf'),this[_0xafa7('0x2d')][_0xafa7('0xe')](this));}catch(_0x231425){logger[_0xafa7('0x11')](_0x231425);}}else{this[_0xafa7('0x2')][_0xafa7('0x2e')](!![],this[_0xafa7('0x2f')]['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x2b855c){_0x2b855c['on']('body',this[_0xafa7('0x30')][_0xafa7('0xe')](this));_0x2b855c[_0xafa7('0xc')](_0xafa7('0x31'),this[_0xafa7('0x32')][_0xafa7('0xe')](this));_0x2b855c[_0xafa7('0xc')](_0xafa7('0xf'),this[_0xafa7('0x33')]['bind'](this));};EmailImap[_0xafa7('0x13')][_0xafa7('0x30')]=function(_0x421fc0){simpleParser(_0x421fc0,{'Iconv':Iconv},this['handleSimpleParser'][_0xafa7('0xe')](this));};EmailImap[_0xafa7('0x13')][_0xafa7('0x32')]=function(){};EmailImap[_0xafa7('0x13')][_0xafa7('0x33')]=function(){};EmailImap['prototype'][_0xafa7('0x34')]=function(_0x32bd1c,_0x2d5ccf){if(_0x32bd1c){logger[_0xafa7('0x11')](_0x32bd1c);}else{var _0x5d7234=this;utils[_0xafa7('0x35')](this[_0xafa7('0xa')],_0x2d5ccf,function(_0x29809a){_0x5d7234[_0xafa7('0x36')](_0xafa7('0x8'),_0x29809a);});}};EmailImap['prototype'][_0xafa7('0x2d')]=function(){this[_0xafa7('0x2')][_0xafa7('0x2e')](!![],this[_0xafa7('0x2f')][_0xafa7('0xe')](this));};EmailImap['prototype']['handleFetchError']=function(_0x1ef50b){this[_0xafa7('0x23')](_0x1ef50b);this[_0xafa7('0x2')][_0xafa7('0x2e')](!![],this['handleCloseBox'][_0xafa7('0xe')](this));};EmailImap[_0xafa7('0x13')][_0xafa7('0x10')]=function(){this['emit'](_0xafa7('0xf'));};EmailImap[_0xafa7('0x13')][_0xafa7('0x23')]=function(_0x2871a7,_0x5966fa){logger[_0xafa7('0x11')]('handleError',this[_0xafa7('0xa')][_0xafa7('0x8')],JSON['stringify'](_0x2871a7));var _0x4a81e6='';if(_0x2871a7){if(_0x2871a7['textCode']){_0x4a81e6=_0x2871a7[_0xafa7('0x37')];}else{for(var _0x3b23db in _0x2871a7){if(_0x2871a7[_0xafa7('0x38')](_0x3b23db)){_0x4a81e6+=_[_0xafa7('0x39')](_0x3b23db)+':\x20'+_0x2871a7[_0x3b23db]+'\x0a';}}}}if(_0x5966fa){this[_0xafa7('0x2')][_0xafa7('0xf')]();}else{this[_0xafa7('0x36')](_0xafa7('0x11'),_0x4a81e6);this[_0xafa7('0x36')](_0xafa7('0xf'));}};module[_0xafa7('0x3a')]=EmailImap; \ No newline at end of file +var _0x9cca=['xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','required','prototype','handleReady','openBox','mailbox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','message','handleFetchMessage','closeBox','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','mailparser','simpleParser','iconv','Iconv','./utils','../../../config/logger','email','getAccount','imap','ready','bind','once','end','handleEnd','error','handleError','inherits','connTimeout','authTimeout','service','user','modernAuthentication'];(function(_0xa635cd,_0x3f7187){var _0x4d0383=function(_0x1fab9b){while(--_0x1fab9b){_0xa635cd['push'](_0xa635cd['shift']());}};_0x4d0383(++_0x3f7187);}(_0x9cca,0x1c1));var _0xa9cc=function(_0x30af3c,_0x5028be){_0x30af3c=_0x30af3c-0x0;var _0x38f0c4=_0x9cca[_0x30af3c];return _0x38f0c4;};'use strict';var _=require('lodash');var util=require(_0xa9cc('0x0'));var Imap=require('imap');var simpleParser=require(_0xa9cc('0x1'))[_0xa9cc('0x2')];var Iconv=require(_0xa9cc('0x3'))[_0xa9cc('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xa9cc('0x5'));var logger=require(_0xa9cc('0x6'))(_0xa9cc('0x7'));function EmailImap(_0x121572,_0xaca8a7){this['mailbox']=_0x121572['mailbox'];this['account']=this[_0xa9cc('0x8')](_0x121572,_0xaca8a7);this['imap']=new Imap(this['account']);this[_0xa9cc('0x9')]['once'](_0xa9cc('0xa'),this['handleReady'][_0xa9cc('0xb')](this));this[_0xa9cc('0x9')][_0xa9cc('0xc')](_0xa9cc('0xd'),this[_0xa9cc('0xe')][_0xa9cc('0xb')](this));this[_0xa9cc('0x9')]['on'](_0xa9cc('0xf'),this[_0xa9cc('0x10')]['bind'](this));this[_0xa9cc('0x9')]['connect']();}util[_0xa9cc('0x11')](EmailImap,EventEmitter);EmailImap['prototype'][_0xa9cc('0x8')]=function(_0x25919d,_0x284c38){var _0x8df20e={'connTimeout':_0x25919d[_0xa9cc('0x12')]?_0x25919d[_0xa9cc('0x12')]*0x3e8:0x2710,'authTimeout':_0x25919d[_0xa9cc('0x13')]?_0x25919d[_0xa9cc('0x13')]*0x3e8:0x1388};if(_0x25919d[_0xa9cc('0x14')]){_0x8df20e[_0xa9cc('0x15')]=_0x25919d[_0xa9cc('0x15')];if(_0x25919d[_0xa9cc('0x16')]){_0x8df20e[_0xa9cc('0x17')]=utils[_0xa9cc('0x18')](_0x25919d[_0xa9cc('0x19')]['data5'],_0x25919d[_0xa9cc('0x15')]);}else{_0x8df20e[_0xa9cc('0x1a')]=_0x25919d[_0xa9cc('0x1a')];}}else{if(_0x25919d[_0xa9cc('0x1b')]){_0x8df20e[_0xa9cc('0x15')]=_0x25919d[_0xa9cc('0x15')];_0x8df20e[_0xa9cc('0x1a')]=_0x25919d[_0xa9cc('0x1a')];}}_0x8df20e[_0xa9cc('0x7')]=_0x284c38||_0x25919d[_0xa9cc('0x15')]||_0xa9cc('0x1c');_0x8df20e['host']=_0x25919d[_0xa9cc('0x1d')];_0x8df20e[_0xa9cc('0x1e')]=_0x25919d['port']||0x3e1;if(_0x25919d[_0xa9cc('0x1f')]){_0x8df20e[_0xa9cc('0x1f')]=!![];}else{_0x8df20e['tls']=![];_0x8df20e['autotls']=_0xa9cc('0x20');}return _0x8df20e;};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x22')]=function(){this[_0xa9cc('0x9')][_0xa9cc('0x23')](this[_0xa9cc('0x24')],![],this[_0xa9cc('0x25')][_0xa9cc('0xb')](this));};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x25')]=function(_0x267a8d,_0x4423e4){if(_0x267a8d){this[_0xa9cc('0x10')](_0x267a8d,!![]);}else{this[_0xa9cc('0x26')]('box',_0x4423e4);this[_0xa9cc('0x27')]();}};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x28')]=function(_0x1efb04){if(_0x1efb04){this[_0xa9cc('0x10')](_0x1efb04,!![]);}else{this[_0xa9cc('0x9')]['end']();}};EmailImap[_0xa9cc('0x21')]['readUnseen']=function(){this['imap'][_0xa9cc('0x29')](['UNSEEN'],this[_0xa9cc('0x2a')]['bind'](this));};EmailImap[_0xa9cc('0x21')]['handleReadUnseen']=function(_0x19290f,_0x105b2b){if(_0x19290f){this[_0xa9cc('0x10')](_0x19290f,!![]);}else{if(_0x105b2b['length']){try{var _0x34d00b=this[_0xa9cc('0x9')][_0xa9cc('0x2b')](_0x105b2b,{'bodies':'','markSeen':!![]});_0x34d00b['on'](_0xa9cc('0x2c'),this[_0xa9cc('0x2d')][_0xa9cc('0xb')](this));_0x34d00b[_0xa9cc('0xc')](_0xa9cc('0xf'),this['handleFetchError'][_0xa9cc('0xb')](this));_0x34d00b[_0xa9cc('0xc')](_0xa9cc('0xd'),this['handleFetchEnd'][_0xa9cc('0xb')](this));}catch(_0x5be83a){logger[_0xa9cc('0xf')](_0x5be83a);}}else{this[_0xa9cc('0x9')][_0xa9cc('0x2e')](!![],this[_0xa9cc('0x28')][_0xa9cc('0xb')](this));}}};EmailImap['prototype'][_0xa9cc('0x2d')]=function(_0x5283f4){_0x5283f4['on']('body',this[_0xa9cc('0x2f')][_0xa9cc('0xb')](this));_0x5283f4[_0xa9cc('0xc')]('attributes',this[_0xa9cc('0x30')][_0xa9cc('0xb')](this));_0x5283f4[_0xa9cc('0xc')](_0xa9cc('0xd'),this[_0xa9cc('0x31')][_0xa9cc('0xb')](this));};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x2f')]=function(_0x362d4d){simpleParser(_0x362d4d,{'Iconv':Iconv},this[_0xa9cc('0x32')]['bind'](this));};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x30')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x32')]=function(_0x482324,_0x44578f){if(_0x482324){logger[_0xa9cc('0xf')](_0x482324);}else{var _0x52af85=this;utils[_0xa9cc('0x33')](this[_0xa9cc('0x34')],_0x44578f,function(_0x234a21){_0x52af85[_0xa9cc('0x26')]('email',_0x234a21);});}};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x35')]=function(){this[_0xa9cc('0x9')][_0xa9cc('0x2e')](!![],this[_0xa9cc('0x28')][_0xa9cc('0xb')](this));};EmailImap['prototype']['handleFetchError']=function(_0x3df51e){this[_0xa9cc('0x10')](_0x3df51e);this[_0xa9cc('0x9')][_0xa9cc('0x2e')](!![],this[_0xa9cc('0x28')][_0xa9cc('0xb')](this));};EmailImap[_0xa9cc('0x21')]['handleEnd']=function(){this['emit'](_0xa9cc('0xd'));};EmailImap[_0xa9cc('0x21')][_0xa9cc('0x10')]=function(_0x4e902b,_0xca947a){logger[_0xa9cc('0xf')](_0xa9cc('0x10'),this[_0xa9cc('0x34')][_0xa9cc('0x7')],JSON[_0xa9cc('0x36')](_0x4e902b));var _0x41997e='';if(_0x4e902b){if(_0x4e902b['textCode']){_0x41997e=_0x4e902b[_0xa9cc('0x37')];}else{for(var _0x1a06f8 in _0x4e902b){if(_0x4e902b[_0xa9cc('0x38')](_0x1a06f8)){_0x41997e+=_[_0xa9cc('0x39')](_0x1a06f8)+':\x20'+_0x4e902b[_0x1a06f8]+'\x0a';}}}}if(_0xca947a){this['imap'][_0xa9cc('0xd')]();}else{this[_0xa9cc('0x26')](_0xa9cc('0xf'),_0x41997e);this['emit'](_0xa9cc('0xd'));}};module[_0xa9cc('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8203230..9d50732 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 _0x8b6e=['compile','toString','verify','createTransport','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use'];(function(_0x13a73f,_0x191c23){var _0x37a9f0=function(_0x3b553b){while(--_0x3b553b){_0x13a73f['push'](_0x13a73f['shift']());}};_0x37a9f0(++_0x191c23);}(_0x8b6e,0x73));var _0xe8b6=function(_0xfba805,_0x167bf9){_0xfba805=_0xfba805-0x0;var _0x4b8566=_0x8b6e[_0xfba805];return _0x4b8566;};'use strict';var nodemailer=require(_0xe8b6('0x0'));var inlineBase64=require(_0xe8b6('0x1'));function EmailSmtp(){}EmailSmtp[_0xe8b6('0x2')][_0xe8b6('0x3')]=function(_0x5a6485,_0x26c6c7){return new Promise(function(_0x30a58e,_0x3bb3c4){var _0x5ee3a9=nodemailer['createTransport'](_0x5a6485);_0x5ee3a9[_0xe8b6('0x4')](_0xe8b6('0x5'),inlineBase64());_0x5ee3a9['sendMail'](_0x26c6c7,function(_0x4475c9,_0x5028ae){if(_0x4475c9){_0x3bb3c4(_0x4475c9[_0xe8b6('0x6')]());}else{_0x30a58e(_0x5028ae);}});});};EmailSmtp[_0xe8b6('0x2')][_0xe8b6('0x7')]=function(_0x3e0172){return new Promise(function(_0x1ebb5b,_0x833653){var _0x4b0fc4=nodemailer[_0xe8b6('0x8')](_0x3e0172);_0x4b0fc4[_0xe8b6('0x7')](function(_0x217b99,_0x15f55e){if(_0x217b99){_0x833653(_0x217b99[_0xe8b6('0x6')]());}else{if(_0x15f55e){_0x1ebb5b(_0x15f55e);}else{_0x833653('Not\x20verifired');}}});});};module[_0xe8b6('0x9')]=EmailSmtp; \ No newline at end of file +var _0xf3b9=['verify','createTransport','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','toString'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0xf3b9,0x18a));var _0x9f3b=function(_0x5193ef,_0x5cfccf){_0x5193ef=_0x5193ef-0x0;var _0x1e6f3f=_0xf3b9[_0x5193ef];return _0x1e6f3f;};'use strict';var nodemailer=require(_0x9f3b('0x0'));var inlineBase64=require(_0x9f3b('0x1'));function EmailSmtp(){}EmailSmtp[_0x9f3b('0x2')][_0x9f3b('0x3')]=function(_0x27ed87,_0x1f63a2){return new Promise(function(_0x5a478f,_0x32242e){var _0x3de32d=nodemailer['createTransport'](_0x27ed87);_0x3de32d[_0x9f3b('0x4')]('compile',inlineBase64());_0x3de32d['sendMail'](_0x1f63a2,function(_0x2e8fec,_0x59bf33){if(_0x2e8fec){_0x32242e(_0x2e8fec[_0x9f3b('0x5')]());}else{_0x5a478f(_0x59bf33);}});});};EmailSmtp[_0x9f3b('0x2')][_0x9f3b('0x6')]=function(_0x3bc54c){return new Promise(function(_0x2e0936,_0x38d91a){var _0x2a7561=nodemailer[_0x9f3b('0x7')](_0x3bc54c);_0x2a7561[_0x9f3b('0x6')](function(_0x21bc87,_0x263c8b){if(_0x21bc87){_0x38d91a(_0x21bc87['toString']());}else{if(_0x263c8b){_0x2e0936(_0x263c8b);}else{_0x38d91a(_0x9f3b('0x8'));}}});});};module[_0x9f3b('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2e17061..4828b5d 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 _0xd8ca=['Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','BodyHTML','Attachments','Title','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','path','util','../../../config/logger','email','head','value','address','anonymous','generate','name','substring','indexOf','split','length','join','Anonymous','pop','isEmpty','@xcally.com','html','test','replace','includes','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','originTo','message','originCc','bcc','attachments','attach','type','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef'];(function(_0x58e3c8,_0x333c6f){var _0x406ed7=function(_0x4e04c5){while(--_0x4e04c5){_0x58e3c8['push'](_0x58e3c8['shift']());}};_0x406ed7(++_0x333c6f);}(_0xd8ca,0x1cf));var _0xad8c=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0xd8ca[_0x179b74];return _0x268f76;};'use strict';var _=require(_0xad8c('0x0'));var moment=require(_0xad8c('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xad8c('0x2'));var util=require(_0xad8c('0x3'));var tnef=require('node-tnef');var logger=require(_0xad8c('0x4'))(_0xad8c('0x5'));var config=require('../../../config/environment');function getAddress(_0x55812a){var _0x580e18=_[_0xad8c('0x6')](_0x55812a[_0xad8c('0x7')]);return _0x580e18&&_0x580e18['address']?_0x580e18[_0xad8c('0x8')]:_0xad8c('0x9')+random[_0xad8c('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x95298e){var _0xe64a22=_[_0xad8c('0x6')](_0x95298e[_0xad8c('0x7')]);if(_0xe64a22&&_0xe64a22['name']){if(_0xe64a22['name']==_0xe64a22['address']){return _0xe64a22[_0xad8c('0xb')][_0xad8c('0xc')](0x0,_0xe64a22[_0xad8c('0xb')][_0xad8c('0xd')]('@'));}var _0x1221f9=_0xe64a22[_0xad8c('0xb')][_0xad8c('0xe')](/\s+/);return _0x1221f9[_0xad8c('0xf')]>0x1?_0x1221f9['slice'](0x0,-0x1)[_0xad8c('0x10')]('\x20'):_0xe64a22[_0xad8c('0xb')];}return _0xad8c('0x11');}function getLastName(_0x1b8adf){var _0x56fc37=_['head'](_0x1b8adf[_0xad8c('0x7')]);if(_0x56fc37&&_0x56fc37[_0xad8c('0xb')]){var _0x195eae=_0x56fc37[_0xad8c('0xb')][_0xad8c('0xe')](/\s+/);return _0x195eae['length']>0x1?_0x195eae[_0xad8c('0x12')]():'';}return'';}function getMails(_0x5971d1,_0x3978bb){var _0x2b0f2b='';for(var _0x8adb9=0x0;_0x8adb9<_0x3978bb['value'][_0xad8c('0xf')];_0x8adb9+=0x1){if(_0x3978bb[_0xad8c('0x7')][_0x8adb9][_0xad8c('0x8')]!==_0x5971d1){if(!_[_0xad8c('0x13')](_0x2b0f2b)){_0x2b0f2b+=',';}_0x2b0f2b+=_0x3978bb['value'][_0x8adb9][_0xad8c('0xb')]||_0x3978bb['value'][_0x8adb9][_0xad8c('0x8')]||'';_0x2b0f2b+='\x20<';_0x2b0f2b+=_0x3978bb[_0xad8c('0x7')][_0x8adb9]['address']?_0x3978bb['value'][_0x8adb9][_0xad8c('0x8')]:_0xad8c('0x9')+random[_0xad8c('0xa')](0x6)+_0xad8c('0x14');_0x2b0f2b+='>';}}return _0x2b0f2b;}function parseEmail(_0x29ccf8,_0x5cc285,_0x326844){if(_0x5cc285[_0xad8c('0x15')]){var _0x310b4d=/)<[^<]*)*<\/script>/gi;while(_0x310b4d[_0xad8c('0x16')](_0x5cc285[_0xad8c('0x15')])){_0x5cc285[_0xad8c('0x15')]=_0x5cc285[_0xad8c('0x15')][_0xad8c('0x17')](_0x310b4d,'');}if(_0x5cc285[_0xad8c('0x15')][_0xad8c('0x18')]('{_0x569b35[_0xad8c('0x1a')](_0x5024fb['filename']);});var _0x109763=/]+>/g;var _0x2a31ee=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x50f5f4=_0x5cc285[_0xad8c('0x15')][_0xad8c('0x17')](_0x2a31ee,_0xad8c('0x1b'));var _0x4b3bc4=_0x50f5f4['replace'](_0x109763,_0xad8c('0x1c'));for(let _0x1e18b5=0x0;_0x1e18b5<_0x569b35['length'];_0x1e18b5++){var _0x261843=_0x4b3bc4[_0xad8c('0x17')](_0xad8c('0x1c'),_0xad8c('0x1d')+_0x569b35[_0x1e18b5]+_0xad8c('0x1e'));_0x4b3bc4=_0x261843;}_0x5cc285[_0xad8c('0x15')]=_0x4b3bc4;}_0x326844[_0xad8c('0x1f')]=_0x5cc285[_0xad8c('0x15')];}else{_0x326844['body']=_0x5cc285[_0xad8c('0x20')];}if(_0x326844[_0xad8c('0x1f')]){_0x326844[_0xad8c('0x1f')]=_0x326844[_0xad8c('0x1f')][_0xad8c('0x17')](/0x0){var _0x4dceec=['Auto-Submitted:\x20auto-replied',_0xad8c('0x32'),_0xad8c('0x33')];for(var _0x5143e3=0x0;_0x5143e3<_0x5cc285[_0xad8c('0x31')][_0xad8c('0xf')];_0x5143e3++){var _0x7e0c92=_[_0xad8c('0xd')](_0x4dceec,_0x5cc285[_0xad8c('0x31')][_0x5143e3][_0xad8c('0x34')]);if(_0x7e0c92>=0x0){_0x326844[_0xad8c('0x35')]=!![];}}}return _0x326844;}exports[_0xad8c('0x36')]=function(_0x44ba4e,_0x23e4c5,_0x492dad){var _0x372e4f={'from':getAddress(_0x23e4c5[_0xad8c('0x37')]),'firstName':getFirstName(_0x23e4c5[_0xad8c('0x37')]),'lastName':getLastName(_0x23e4c5[_0xad8c('0x37')]),'mapKey':'email','message':{'from':getMails(_0x44ba4e[_0xad8c('0x5')],_0x23e4c5[_0xad8c('0x37')]),'to':_0x44ba4e[_0xad8c('0x5')],'cc':'','subject':_0x23e4c5[_0xad8c('0x38')]||'','messageId':_0x23e4c5[_0xad8c('0x39')],'inReplyTo':_0x23e4c5['inReplyTo'],'sentAt':moment(_0x23e4c5[_0xad8c('0x3a')])[_0xad8c('0x2a')](_0xad8c('0x3b')),'attach':![],'attachments':[]}};if(!_0x23e4c5['html']&&!_0x23e4c5['textAsHtml']){var _0x54f6fb=_[_0xad8c('0x3c')](_0x23e4c5[_0xad8c('0x25')],{'contentType':_0xad8c('0x3d')});if(_0x54f6fb['length']){logger['info'](util[_0xad8c('0x2a')](_0xad8c('0x3e'),_0x23e4c5['messageId']));tnef[_0xad8c('0x3f')](_[_0xad8c('0x40')](_0x54f6fb)[_0xad8c('0x41')],function(_0x4953bc,_0x435b25){if(_0x435b25){_0x23e4c5[_0xad8c('0x15')]=_0x435b25[_0xad8c('0x42')]||'

Empty\x20message

';if(_0x435b25[_0xad8c('0x43')]){for(var _0x5d9f6f=0x0;_0x5d9f6f<_0x435b25[_0xad8c('0x43')][_0xad8c('0xf')];_0x5d9f6f++){var _0x18f975=_0x435b25[_0xad8c('0x43')][_0x5d9f6f];_0x372e4f[_0xad8c('0x22')][_0xad8c('0x25')][_0xad8c('0x1a')]({'filename':_0x18f975[_0xad8c('0x44')],'content':Buffer[_0xad8c('0x37')](_0x18f975['Data'])});}}}_0x492dad(parseEmail(_0x44ba4e,_0x23e4c5,_0x372e4f));});}else{_0x23e4c5['html']=_0xad8c('0x45');_0x492dad(parseEmail(_0x44ba4e,_0x23e4c5,_0x372e4f));}}else{_0x492dad(parseEmail(_0x44ba4e,_0x23e4c5,_0x372e4f));}};exports[_0xad8c('0x46')]=function(_0x405b69,_0x3353b6){var _0x5d6699=[_0xad8c('0x47')+(_0x3353b6||''),_0xad8c('0x48')+_0x405b69,'',''];return Buffer['from'](_0x5d6699[_0xad8c('0x10')](''),'utf-8')[_0xad8c('0x49')](_0xad8c('0x4a'));}; \ No newline at end of file +var _0x4a18=['attachment','%s-%s','now','root','server/files/attachments/','writeFileSync','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','length','slice','join','Anonymous','split','pop','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x5dc9e3[_0x84a1('0x12')](0x0,-0x1)[_0x84a1('0x13')]('\x20'):_0x322460['name'];}return _0x84a1('0x14');}function getLastName(_0x269978){var _0x1bbc44=_[_0x84a1('0x9')](_0x269978['value']);if(_0x1bbc44&&_0x1bbc44[_0x84a1('0xf')]){var _0x425b22=_0x1bbc44[_0x84a1('0xf')][_0x84a1('0x15')](/\s+/);return _0x425b22[_0x84a1('0x11')]>0x1?_0x425b22[_0x84a1('0x16')]():'';}return'';}function getMails(_0x22e8a8,_0x12afe6){var _0xd0c96f='';for(var _0xe19b2e=0x0;_0xe19b2e<_0x12afe6[_0x84a1('0xa')][_0x84a1('0x11')];_0xe19b2e+=0x1){if(_0x12afe6[_0x84a1('0xa')][_0xe19b2e][_0x84a1('0xb')]!==_0x22e8a8){if(!_['isEmpty'](_0xd0c96f)){_0xd0c96f+=',';}_0xd0c96f+=_0x12afe6[_0x84a1('0xa')][_0xe19b2e][_0x84a1('0xf')]||_0x12afe6[_0x84a1('0xa')][_0xe19b2e]['address']||'';_0xd0c96f+='\x20<';_0xd0c96f+=_0x12afe6[_0x84a1('0xa')][_0xe19b2e]['address']?_0x12afe6[_0x84a1('0xa')][_0xe19b2e][_0x84a1('0xb')]:'anonymous'+random[_0x84a1('0xd')](0x6)+'@xcally.com';_0xd0c96f+='>';}}return _0xd0c96f;}function parseEmail(_0x4811bf,_0x86eccf,_0x178de9){if(_0x86eccf[_0x84a1('0x17')]){var _0x18ba0f=/)<[^<]*)*<\/script>/gi;while(_0x18ba0f[_0x84a1('0x18')](_0x86eccf[_0x84a1('0x17')])){_0x86eccf[_0x84a1('0x17')]=_0x86eccf[_0x84a1('0x17')][_0x84a1('0x19')](_0x18ba0f,'');}if(_0x86eccf[_0x84a1('0x17')][_0x84a1('0x1a')](_0x84a1('0x1b'))){var _0x42eaea=[];_0x86eccf[_0x84a1('0x1c')][_0x84a1('0x1d')](_0x33e350=>{_0x42eaea[_0x84a1('0x1e')](_0x33e350[_0x84a1('0x1f')]);});var _0x4f10a5=/]+>/g;var _0x2d7619=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4c1a8c=_0x86eccf['html']['replace'](_0x2d7619,_0x84a1('0x20'));var _0x1249b2=_0x4c1a8c[_0x84a1('0x19')](_0x4f10a5,_0x84a1('0x21'));for(let _0x134b1c=0x0;_0x134b1c<_0x42eaea[_0x84a1('0x11')];_0x134b1c++){var _0x49f114=_0x1249b2[_0x84a1('0x19')]('_IMG',_0x84a1('0x22')+_0x42eaea[_0x134b1c]+_0x84a1('0x23'));_0x1249b2=_0x49f114;}_0x86eccf[_0x84a1('0x17')]=_0x1249b2;}_0x178de9['body']=_0x86eccf[_0x84a1('0x17')];}else{_0x178de9[_0x84a1('0x24')]=_0x86eccf['textAsHtml'];}if(_0x178de9['body']){_0x178de9['body']=_0x178de9[_0x84a1('0x24')][_0x84a1('0x19')](/0x0){var _0x57bb3e=[_0x84a1('0x32'),_0x84a1('0x33'),_0x84a1('0x34')];for(var _0x1d6374=0x0;_0x1d6374<_0x86eccf[_0x84a1('0x31')][_0x84a1('0x11')];_0x1d6374++){var _0x1b771b=_['indexOf'](_0x57bb3e,_0x86eccf[_0x84a1('0x31')][_0x1d6374][_0x84a1('0x35')]);if(_0x1b771b>=0x0){_0x178de9[_0x84a1('0x36')]=!![];}}}return _0x178de9;}exports[_0x84a1('0x37')]=function(_0x5284a5,_0x360964,_0x4fa3ca){var _0x3bf32d={'from':getAddress(_0x360964[_0x84a1('0x38')]),'firstName':getFirstName(_0x360964[_0x84a1('0x38')]),'lastName':getLastName(_0x360964[_0x84a1('0x38')]),'mapKey':_0x84a1('0x7'),'message':{'from':getMails(_0x5284a5[_0x84a1('0x7')],_0x360964[_0x84a1('0x38')]),'to':_0x5284a5[_0x84a1('0x7')],'cc':'','subject':_0x360964[_0x84a1('0x39')]||'','messageId':_0x360964[_0x84a1('0x3a')],'inReplyTo':_0x360964[_0x84a1('0x3b')],'sentAt':moment(_0x360964[_0x84a1('0x3c')])[_0x84a1('0x3d')](_0x84a1('0x3e')),'attach':![],'attachments':[]}};if(!_0x360964[_0x84a1('0x17')]&&!_0x360964[_0x84a1('0x3f')]){var _0x1b8d60=_[_0x84a1('0x40')](_0x360964[_0x84a1('0x1c')],{'contentType':'application/ms-tnef'});if(_0x1b8d60[_0x84a1('0x11')]){logger[_0x84a1('0x41')](util[_0x84a1('0x3d')](_0x84a1('0x42'),_0x360964['messageId']));tnef[_0x84a1('0x43')](_[_0x84a1('0x44')](_0x1b8d60)['content'],function(_0x150d07,_0x4a32ce){if(_0x4a32ce){_0x360964['html']=_0x4a32ce[_0x84a1('0x45')]||'

Empty\x20message

';if(_0x4a32ce[_0x84a1('0x46')]){for(var _0x4e38e9=0x0;_0x4e38e9<_0x4a32ce[_0x84a1('0x46')][_0x84a1('0x11')];_0x4e38e9++){var _0x587197=_0x4a32ce[_0x84a1('0x46')][_0x4e38e9];_0x3bf32d[_0x84a1('0x26')][_0x84a1('0x1c')][_0x84a1('0x1e')]({'filename':_0x587197['Title'],'content':Buffer[_0x84a1('0x38')](_0x587197[_0x84a1('0x47')])});}}}_0x4fa3ca(parseEmail(_0x5284a5,_0x360964,_0x3bf32d));});}else{_0x360964[_0x84a1('0x17')]=_0x84a1('0x48');_0x4fa3ca(parseEmail(_0x5284a5,_0x360964,_0x3bf32d));}}else{_0x4fa3ca(parseEmail(_0x5284a5,_0x360964,_0x3bf32d));}};exports[_0x84a1('0x49')]=function(_0x564286,_0x2d63c4){var _0xad961b=[_0x84a1('0x4a')+(_0x2d63c4||''),_0x84a1('0x4b')+_0x564286,'',''];return Buffer['from'](_0xad961b[_0x84a1('0x13')](''),_0x84a1('0x4c'))[_0x84a1('0x4d')](_0x84a1('0x4e'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 29cab3b..d928188 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 _0x770f=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x31ed73,_0xf1d9af){var _0xe43ce6=function(_0x285cf8){while(--_0x285cf8){_0x31ed73['push'](_0x31ed73['shift']());}};_0xe43ce6(++_0xf1d9af);}(_0x770f,0x161));var _0xf770=function(_0x13a8cc,_0x45b4fc){_0x13a8cc=_0x13a8cc-0x0;var _0x31b53c=_0x770f[_0x13a8cc];return _0x31b53c;};'use strict';var _=require(_0xf770('0x0'));function MailAccount(_0xd23ffb){this['id']=_0xd23ffb['id']||0x0;this[_0xf770('0x1')]=_0xd23ffb[_0xf770('0x1')]||_0xf770('0x2');this[_0xf770('0x3')]=_0xd23ffb[_0xf770('0x3')]||_0xf770('0x4');this[_0xf770('0x5')]=_0xd23ffb[_0xf770('0x5')]||![];this[_0xf770('0x6')]=_0xd23ffb[_0xf770('0x6')]||[];this[_0xf770('0x7')]=_0xd23ffb[_0xf770('0x7')]||[];}module[_0xf770('0x8')]=MailAccount; \ No newline at end of file +var _0x1e21=['Service','key','active','Smtp','lodash','name'];(function(_0x521582,_0x2e2035){var _0x17ac66=function(_0x312ab3){while(--_0x312ab3){_0x521582['push'](_0x521582['shift']());}};_0x17ac66(++_0x2e2035);}(_0x1e21,0x166));var _0x11e2=function(_0x42db25,_0xd73f2f){_0x42db25=_0x42db25-0x0;var _0x2c1d10=_0x1e21[_0x42db25];return _0x2c1d10;};'use strict';var _=require(_0x11e2('0x0'));function MailAccount(_0xb202f5){this['id']=_0xb202f5['id']||0x0;this[_0x11e2('0x1')]=_0xb202f5['name']||_0x11e2('0x2');this[_0x11e2('0x3')]=_0xb202f5[_0x11e2('0x3')]||'SERV';this[_0x11e2('0x4')]=_0xb202f5[_0x11e2('0x4')]||![];this['Imap']=_0xb202f5['Imap']||[];this[_0x11e2('0x5')]=_0xb202f5[_0x11e2('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index ec066be..11920ab 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 _0x03f9=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','initMailAccounts','length','merge'];(function(_0x55f48e,_0x5f3c56){var _0x18e769=function(_0x222aff){while(--_0x222aff){_0x55f48e['push'](_0x55f48e['shift']());}};_0x18e769(++_0x5f3c56);}(_0x03f9,0x119));var _0x903f=function(_0x5d8987,_0x14d054){_0x5d8987=_0x5d8987-0x0;var _0x2997eb=_0x03f9[_0x5d8987];return _0x2997eb;};'use strict';var _=require(_0x903f('0x0'));var MailAccount=require(_0x903f('0x1'));var Realtime=function(){this[_0x903f('0x2')]={};};function freeIsNotKey(_0x278c85,_0x2ca3b0,_0x17b532){var _0x50c0dd=_[_0x903f('0x3')](_0x278c85,function(_0x3ca2aa,_0x5d89d7){return _0x3ca2aa[_0x17b532];});for(var _0x1c3e88 in _0x2ca3b0){if(_0x2ca3b0['hasOwnProperty'](_0x1c3e88)){if(!_0x50c0dd[_0x1c3e88]){delete _0x2ca3b0[_0x1c3e88];}}}}Realtime[_0x903f('0x4')][_0x903f('0x5')]=function(_0x35142b,_0x77c8cc){for(var _0x1b493b in _0x77c8cc){if(_0x35142b['hasOwnProperty'](_0x1b493b)){_0x35142b[_0x1b493b]=_0x77c8cc[_0x1b493b];}}};Realtime['prototype'][_0x903f('0x6')]=function(){var _0x22024c=this;return function(_0xc5df18){if(_0xc5df18){freeIsNotKey(_0xc5df18,_0x22024c[_0x903f('0x2')],'id');for(var _0x419ba0=0x0,_0x25da42={},_0x94b8df={};_0x419ba0<_0xc5df18[_0x903f('0x7')];_0x419ba0+=0x1){_0x25da42=_0xc5df18[_0x419ba0];if(_['isUndefined'](_0x22024c[_0x903f('0x2')][_0x25da42['id']])){_0x22024c[_0x903f('0x2')][_0x25da42['id']]=new MailAccount(_0x25da42);}else{_[_0x903f('0x8')](_0x22024c[_0x903f('0x2')][_0x25da42['id']],_0x25da42);}}}return _0x22024c[_0x903f('0x2')];};};module[_0x903f('0x9')]=Realtime; \ No newline at end of file +var _0x7585=['length','isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts'];(function(_0x68790a,_0x402987){var _0x4a94de=function(_0x334df0){while(--_0x334df0){_0x68790a['push'](_0x68790a['shift']());}};_0x4a94de(++_0x402987);}(_0x7585,0xd1));var _0x5758=function(_0x2fd06d,_0x58b033){_0x2fd06d=_0x2fd06d-0x0;var _0x200a0b=_0x7585[_0x2fd06d];return _0x200a0b;};'use strict';var _=require(_0x5758('0x0'));var MailAccount=require(_0x5758('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3b7c6d,_0x590b8e,_0x4cc288){var _0x2380e4=_[_0x5758('0x2')](_0x3b7c6d,function(_0x186985,_0x1b8314){return _0x186985[_0x4cc288];});for(var _0x31044b in _0x590b8e){if(_0x590b8e[_0x5758('0x3')](_0x31044b)){if(!_0x2380e4[_0x31044b]){delete _0x590b8e[_0x31044b];}}}}Realtime[_0x5758('0x4')][_0x5758('0x5')]=function(_0x195b88,_0x244327){for(var _0x100978 in _0x244327){if(_0x195b88[_0x5758('0x3')](_0x100978)){_0x195b88[_0x100978]=_0x244327[_0x100978];}}};Realtime['prototype'][_0x5758('0x6')]=function(){var _0x1932e3=this;return function(_0x48b84e){if(_0x48b84e){freeIsNotKey(_0x48b84e,_0x1932e3['mailAccounts'],'id');for(var _0x3fe50d=0x0,_0x4aba63={},_0x296d28={};_0x3fe50d<_0x48b84e[_0x5758('0x7')];_0x3fe50d+=0x1){_0x4aba63=_0x48b84e[_0x3fe50d];if(_[_0x5758('0x8')](_0x1932e3[_0x5758('0x9')][_0x4aba63['id']])){_0x1932e3[_0x5758('0x9')][_0x4aba63['id']]=new MailAccount(_0x4aba63);}else{_[_0x5758('0xa')](_0x1932e3[_0x5758('0x9')][_0x4aba63['id']],_0x4aba63);}}}return _0x1932e3[_0x5758('0x9')];};};module[_0x5758('0xb')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3e0031c..291712d 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 _0xb90a=['type','data5','MailServerOut','Smtp','service','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','key','ListId','Imap','CloudProvider','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb90a,0x12a));var _0xab90=function(_0x281d0c,_0x43f3c1){_0x281d0c=_0x281d0c-0x0;var _0x48c307=_0xb90a[_0x281d0c];return _0x48c307;};'use strict';var client=require(_0xab90('0x0'));exports[_0xab90('0x1')]=function(){return function(){return client['Request'](_0xab90('0x2'),{'options':{'attributes':['id','name','provider','service','email','active',_0xab90('0x3'),_0xab90('0x4'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xab90('0x5'),'include':[{'model':_0xab90('0x6'),'attributes':['id',_0xab90('0x7'),'service',_0xab90('0x8'),_0xab90('0x9')],'as':_0xab90('0x6')}]},{'model':_0xab90('0xa'),'as':_0xab90('0xb'),'include':[{'model':_0xab90('0x6'),'attributes':['id',_0xab90('0x7'),_0xab90('0xc'),'type',_0xab90('0x9')],'as':_0xab90('0x6')}]}]},'log':_0xab90('0xd')});};};exports[_0xab90('0xe')]=function(_0x23b180,_0x5a00c9){return client[_0xab90('0xf')](_0xab90('0x10'),{'account':{'id':_0x23b180},'body':_0x5a00c9,'log':_0xab90('0x10')});}; \ No newline at end of file +var _0xd61c=['name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','MailServerOut','Smtp','data5','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x3ee592,_0x15c3f5){var _0x458ed2=function(_0x1ebd94){while(--_0x1ebd94){_0x3ee592['push'](_0x3ee592['shift']());}};_0x458ed2(++_0x15c3f5);}(_0xd61c,0xb1));var _0xcd61=function(_0x15598c,_0x240e3e){_0x15598c=_0x15598c-0x0;var _0x44e583=_0xd61c[_0x15598c];return _0x44e583;};'use strict';var client=require(_0xcd61('0x0'));exports[_0xcd61('0x1')]=function(){return function(){return client[_0xcd61('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xcd61('0x3'),'provider',_0xcd61('0x4'),_0xcd61('0x5'),_0xcd61('0x6'),_0xcd61('0x7'),_0xcd61('0x8'),_0xcd61('0x9')],'raw':![],'include':[{'model':_0xcd61('0xa'),'as':_0xcd61('0xb'),'include':[{'model':_0xcd61('0xc'),'attributes':['id',_0xcd61('0x3'),'service',_0xcd61('0xd'),'data5'],'as':_0xcd61('0xc')}]},{'model':_0xcd61('0xe'),'as':_0xcd61('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0xcd61('0x3'),_0xcd61('0x4'),_0xcd61('0xd'),_0xcd61('0x10')],'as':_0xcd61('0xc')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x4627e5,_0x22539e){return client[_0xcd61('0x2')]('NotifyMailAccount',{'account':{'id':_0x4627e5},'body':_0x22539e,'log':_0xcd61('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9ee5789..493558a 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 _0xb079=['loginMailFrequency','GetSettings'];(function(_0x36b2c5,_0x5eaf9a){var _0x919462=function(_0x54bbbf){while(--_0x54bbbf){_0x36b2c5['push'](_0x36b2c5['shift']());}};_0x919462(++_0x5eaf9a);}(_0xb079,0x132));var _0x9b07=function(_0xfb813,_0x1634cb){_0xfb813=_0xfb813-0x0;var _0x1266eb=_0xb079[_0xfb813];return _0x1266eb;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9b07('0x0')]},'log':_0x9b07('0x1')});}; \ No newline at end of file +var _0xbe2c=['../client','Request','GetSettings'];(function(_0x28c739,_0x5a77ba){var _0x336f17=function(_0xaf63c7){while(--_0xaf63c7){_0x28c739['push'](_0x28c739['shift']());}};_0x336f17(++_0x5a77ba);}(_0xbe2c,0xf3));var _0xcbe2=function(_0x1d75f3,_0x54243d){_0x1d75f3=_0x1d75f3-0x0;var _0x4e19a5=_0xbe2c[_0x1d75f3];return _0x4e19a5;};'use strict';var client=require(_0xcbe2('0x0'));exports['getSettings']=function(){return client[_0xcbe2('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xcbe2('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 413548a..671762d 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(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 9fc2a63..e2f15c1 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 _0xdba5=['adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','log','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io','websocket','polling','defaults','redis','localhost'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0xdba5,0x1b9));var _0x5dba=function(_0x5c8e8b,_0x56f91a){_0x5c8e8b=_0x5c8e8b-0x0;var _0x195e96=_0xdba5[_0x5c8e8b];return _0x195e96;};'use strict';var _=require(_0x5dba('0x0'));var http=require(_0x5dba('0x1'));var express=require(_0x5dba('0x2'));var sticky=require(_0x5dba('0x3'));var Redis=require(_0x5dba('0x4'));var config=require(_0x5dba('0x5'));var app=express();var server=http['createServer'](app);server[_0x5dba('0x6')]=0xdbba0;if(sticky[_0x5dba('0x7')](server,config[_0x5dba('0x8')])){var socketio=require(_0x5dba('0x9'))(server,{'transports':[_0x5dba('0xa'),_0x5dba('0xb')]});config['redis']=_[_0x5dba('0xc')](config[_0x5dba('0xd')],{'host':_0x5dba('0xe'),'port':0x18eb});socketio[_0x5dba('0xf')](require(_0x5dba('0x10'))({'pubClient':new Redis(config[_0x5dba('0xd')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x5dba('0x11')]();require(_0x5dba('0x12'))[_0x5dba('0x11')](socketio);require(_0x5dba('0x13'))[_0x5dba('0x11')](app);require(_0x5dba('0x14'))['default'](app);}else{server[_0x5dba('0x15')]('listening',function(){console[_0x5dba('0x16')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x5dba('0x8')]);});}exports=module[_0x5dba('0x17')]=app; \ No newline at end of file +var _0xfa40=['default','../../config/express','listening','log','port','lodash','sticky-session','../../config/environment','createServer','timeout','socket.io','polling','defaults','redis','localhost','adapter','../../config/triggers','../../config/socketio'];(function(_0x3f02e6,_0x2e9d4f){var _0x10176f=function(_0x3ccf5b){while(--_0x3ccf5b){_0x3f02e6['push'](_0x3f02e6['shift']());}};_0x10176f(++_0x2e9d4f);}(_0xfa40,0x71));var _0x0fa4=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xfa40[_0x1ed116];return _0x574066;};'use strict';var _=require(_0x0fa4('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x0fa4('0x1'));var Redis=require('ioredis');var config=require(_0x0fa4('0x2'));var app=express();var server=http[_0x0fa4('0x3')](app);server[_0x0fa4('0x4')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0x0fa4('0x5'))(server,{'transports':['websocket',_0x0fa4('0x6')]});config['redis']=_[_0x0fa4('0x7')](config[_0x0fa4('0x8')],{'host':_0x0fa4('0x9'),'port':0x18eb});socketio[_0x0fa4('0xa')](require('socket.io-redis')({'pubClient':new Redis(config[_0x0fa4('0x8')]),'subClient':new Redis(config['redis'])}));require(_0x0fa4('0xb'))['default']();require(_0x0fa4('0xc'))[_0x0fa4('0xd')](socketio);require(_0x0fa4('0xe'))[_0x0fa4('0xd')](app);require('../../routes')[_0x0fa4('0xd')](app);}else{server['once'](_0x0fa4('0xf'),function(){console[_0x0fa4('0x10')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x0fa4('0x11')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7504b5c..73e17fb 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 _0xd848=['Request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http'];(function(_0x44a71d,_0x4c7af6){var _0x5a80ad=function(_0x5a8181){while(--_0x5a8181){_0x44a71d['push'](_0x44a71d['shift']());}};_0x5a80ad(++_0x4c7af6);}(_0xd848,0x113));var _0x8d84=function(_0x486eff,_0x5cb3b0){_0x486eff=_0x486eff-0x0;var _0x95293b=_0xd848[_0x486eff];return _0x95293b;};'use strict';var jayson=require(_0x8d84('0x0'));var BPromise=require(_0x8d84('0x1'));var logger=require(_0x8d84('0x2'))(_0x8d84('0x3'));var client=jayson['client'][_0x8d84('0x4')]({'port':0x2329});client[_0x8d84('0x5')]=function(_0x334d5f,_0xaec6b2){return new BPromise(function(_0x24c40a,_0x44a18c){return client['request'](_0x334d5f,_0xaec6b2)[_0x8d84('0x6')](function(_0x41b03c){logger[_0x8d84('0x7')](_0x8d84('0x8'),_0x8d84('0x3'),_0x334d5f,_0xaec6b2,_0x41b03c);if(_0x41b03c[_0x8d84('0x9')]){logger[_0x8d84('0x9')](_0x8d84('0x8'),_0x8d84('0x3'),_0x334d5f,_0x41b03c['error']['message'],_0xaec6b2);return _0x44a18c(_0x41b03c['error'][_0x8d84('0xa')]);}else{return _0x24c40a(_0x41b03c[_0x8d84('0xb')]);}})[_0x8d84('0xc')](function(_0x1eb71a){logger[_0x8d84('0x9')](_0x8d84('0x8'),_0x8d84('0x3'),_0x334d5f,_0x1eb71a,_0xaec6b2);return _0x44a18c(_0x1eb71a);});});};module[_0x8d84('0xd')]=client; \ No newline at end of file +var _0xb2a8=['jayson/promise','../../config/logger','routing','client','http','Request','then','debug','error','rpc','message','result','catch','exports'];(function(_0x3e330a,_0x11bf04){var _0x451dee=function(_0x1074b7){while(--_0x1074b7){_0x3e330a['push'](_0x3e330a['shift']());}};_0x451dee(++_0x11bf04);}(_0xb2a8,0x134));var _0x8b2a=function(_0x4ce15c,_0x1bbcbd){_0x4ce15c=_0x4ce15c-0x0;var _0x5ee259=_0xb2a8[_0x4ce15c];return _0x5ee259;};'use strict';var jayson=require(_0x8b2a('0x0'));var BPromise=require('bluebird');var logger=require(_0x8b2a('0x1'))(_0x8b2a('0x2'));var client=jayson[_0x8b2a('0x3')][_0x8b2a('0x4')]({'port':0x2329});client[_0x8b2a('0x5')]=function(_0x591fbe,_0x49d83a){return new BPromise(function(_0x4f8bef,_0x2ae6b4){return client['request'](_0x591fbe,_0x49d83a)[_0x8b2a('0x6')](function(_0x33b9c7){logger[_0x8b2a('0x7')]('rpc',_0x8b2a('0x2'),_0x591fbe,_0x49d83a,_0x33b9c7);if(_0x33b9c7[_0x8b2a('0x8')]){logger[_0x8b2a('0x8')](_0x8b2a('0x9'),_0x8b2a('0x2'),_0x591fbe,_0x33b9c7['error'][_0x8b2a('0xa')],_0x49d83a);return _0x2ae6b4(_0x33b9c7['error'][_0x8b2a('0xa')]);}else{return _0x4f8bef(_0x33b9c7[_0x8b2a('0xb')]);}})[_0x8b2a('0xc')](function(_0x13fe5c){logger['error'](_0x8b2a('0x9'),'routing',_0x591fbe,_0x13fe5c,_0x49d83a);return _0x2ae6b4(_0x13fe5c);});});};module[_0x8b2a('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 65b06a7..87c2c91 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 _0x396e=['./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird'];(function(_0xecdbc4,_0x18352d){var _0x54c08f=function(_0x1a4ccf){while(--_0x1a4ccf){_0xecdbc4['push'](_0xecdbc4['shift']());}};_0x54c08f(++_0x18352d);}(_0x396e,0x1db));var _0xe396=function(_0x473538,_0x34e7f6){_0x473538=_0x473538-0x0;var _0x44a2f5=_0x396e[_0x473538];return _0x44a2f5;};'use strict';var BPromise=require(_0xe396('0x0'));var server=require(_0xe396('0x1'));var Realtime=require(_0xe396('0x2'));var user=require(_0xe396('0x3'));var interval=require(_0xe396('0x4'));var openchannelQueue=require(_0xe396('0x5'));var chatQueue=require(_0xe396('0x6'));var smsQueue=require(_0xe396('0x7'));var mailQueue=require(_0xe396('0x8'));var faxQueue=require(_0xe396('0x9'));var whatsappQueue=require(_0xe396('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe396('0xb')]()[_0xe396('0xc')](user[_0xe396('0xd')]())['then'](realtime[_0xe396('0xe')]())[_0xe396('0xc')](interval['getIntervals']())[_0xe396('0xc')](realtime[_0xe396('0xf')]())[_0xe396('0xc')](openchannelQueue['getOpenchannelQueues']())[_0xe396('0xc')](realtime[_0xe396('0x10')]())[_0xe396('0xc')](chatQueue[_0xe396('0x11')]())['then'](realtime[_0xe396('0x12')]())[_0xe396('0xc')](smsQueue[_0xe396('0x13')]())[_0xe396('0xc')](realtime[_0xe396('0x14')]())[_0xe396('0xc')](mailQueue[_0xe396('0x15')]())[_0xe396('0xc')](realtime[_0xe396('0x16')]())[_0xe396('0xc')](faxQueue[_0xe396('0x17')]())[_0xe396('0xc')](realtime[_0xe396('0x18')]())[_0xe396('0xc')](whatsappQueue['getWhatsappQueues']())[_0xe396('0xc')](realtime[_0xe396('0x19')]())[_0xe396('0xc')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x5e001c){return initRealtime();})[_0xe396('0xc')](function(_0x5c7016){return setInterval(initRealtime,0x1388);})[_0xe396('0x1a')](function(_0x580e0d){console[_0xe396('0x1b')](_0x580e0d);});}main(); \ No newline at end of file +var _0x78ed=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user'];(function(_0x111347,_0x430988){var _0x3d6f08=function(_0x3d7598){while(--_0x3d7598){_0x111347['push'](_0x111347['shift']());}};_0x3d6f08(++_0x430988);}(_0x78ed,0x1c9));var _0xd78e=function(_0x2eb8f4,_0x1c3dd3){_0x2eb8f4=_0x2eb8f4-0x0;var _0x4ba07f=_0x78ed[_0x2eb8f4];return _0x4ba07f;};'use strict';var BPromise=require('bluebird');var server=require(_0xd78e('0x0'));var Realtime=require(_0xd78e('0x1'));var user=require(_0xd78e('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xd78e('0x3'));var faxQueue=require(_0xd78e('0x4'));var whatsappQueue=require(_0xd78e('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd78e('0x6')]()[_0xd78e('0x7')](user[_0xd78e('0x8')]())[_0xd78e('0x7')](realtime[_0xd78e('0x9')]())[_0xd78e('0x7')](interval[_0xd78e('0xa')]())[_0xd78e('0x7')](realtime[_0xd78e('0xb')]())['then'](openchannelQueue[_0xd78e('0xc')]())['then'](realtime[_0xd78e('0xd')]())['then'](chatQueue[_0xd78e('0xe')]())[_0xd78e('0x7')](realtime['initChatQueues']())['then'](smsQueue[_0xd78e('0xf')]())[_0xd78e('0x7')](realtime[_0xd78e('0x10')]())[_0xd78e('0x7')](mailQueue['getMailQueues']())[_0xd78e('0x7')](realtime[_0xd78e('0x11')]())['then'](faxQueue['getFaxQueues']())[_0xd78e('0x7')](realtime['initFaxQueues']())['then'](whatsappQueue[_0xd78e('0x12')]())[_0xd78e('0x7')](realtime[_0xd78e('0x13')]())[_0xd78e('0x7')](function(){return realtime;});}function main(){return server[_0xd78e('0x14')](realtime)[_0xd78e('0x7')](function(_0x3ebafb){return initRealtime();})[_0xd78e('0x7')](function(_0x4be535){return setInterval(initRealtime,0x1388);})[_0xd78e('0x15')](function(_0x352702){console[_0xd78e('0x16')](_0x352702);});}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 ce67973..c9d85b6 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x5d0720,_0x238fc5){var _0x2b98b5=function(_0x387cc3){while(--_0x387cc3){_0x5d0720['push'](_0x5d0720['shift']());}};_0x2b98b5(++_0x238fc5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x5fc3[_0x54b283];return _0x2462b3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x27f616,_0xf48a6d){var _0x5ebae0=function(_0x323d0a){while(--_0x323d0a){_0x27f616['push'](_0x27f616['shift']());}};_0x5ebae0(++_0xf48a6d);}(_0x326f,0xd1));var _0xf326=function(_0xa5c248,_0x5e9e74){_0xa5c248=_0xa5c248-0x0;var _0x5bbf50=_0x326f[_0xa5c248];return _0x5bbf50;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 52828f9..c8e2748 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 _0xed32=['bluebird','request','then','error','result','catch','sendMailMessage'];(function(_0x17d601,_0x3e3fab){var _0x5b61b7=function(_0x3eda06){while(--_0x3eda06){_0x17d601['push'](_0x17d601['shift']());}};_0x5b61b7(++_0x3e3fab);}(_0xed32,0xaf));var _0x2ed3=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xed32[_0x3511d3];return _0x5d6321;};'use strict';var BPromise=require(_0x2ed3('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x489587,_0x1c47a6){return new BPromise(function(_0x1e7397,_0x4561cc){return client[_0x2ed3('0x1')](_0x489587,_0x1c47a6)[_0x2ed3('0x2')](function(_0x4a206e){if(_0x4a206e[_0x2ed3('0x3')]){return _0x4561cc(_0x4a206e[_0x2ed3('0x3')]['message']);}else{return _0x1e7397(_0x4a206e[_0x2ed3('0x4')]);}})[_0x2ed3('0x5')](function(_0x5401e7){return _0x4561cc(_0x5401e7);});});}exports[_0x2ed3('0x6')]=function(_0x3858b3,_0x374bf9){return request('SendMail',{'account':_0x3858b3,'message':_0x374bf9});}; \ No newline at end of file +var _0x95d5=['SendMail','jayson/promise','http','request','then','result','catch'];(function(_0x25eaf9,_0x3902c2){var _0x5dc1ca=function(_0x4313fa){while(--_0x4313fa){_0x25eaf9['push'](_0x25eaf9['shift']());}};_0x5dc1ca(++_0x3902c2);}(_0x95d5,0xe1));var _0x595d=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x95d5[_0x28509b];return _0x1e0b6;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x595d('0x0'));var client=jayson['client'][_0x595d('0x1')]({'port':0x232b});function request(_0x1f2981,_0x2f5783){return new BPromise(function(_0x5c03f3,_0x5e7c66){return client[_0x595d('0x2')](_0x1f2981,_0x2f5783)[_0x595d('0x3')](function(_0x1a1754){if(_0x1a1754['error']){return _0x5e7c66(_0x1a1754['error']['message']);}else{return _0x5c03f3(_0x1a1754[_0x595d('0x4')]);}})[_0x595d('0x5')](function(_0x50be6c){return _0x5e7c66(_0x50be6c);});});}exports['sendMailMessage']=function(_0x38f802,_0x42775f){return request(_0x595d('0x6'),{'account':_0x38f802,'message':_0x42775f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c5d6eba..f9c1c37 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 _0xea9d=['name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','Capacity','maxcapacity','working','updateRealtime','mail','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','online','chatStatus','chatStatusTime','mailStatusTime','faxStatus','smsStatusTime','smsCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','stringify','emit','user:routing:update','omit','lodash','md5','moment','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x3f9e34,_0xccf6fe){var _0x1763f8=function(_0x186b19){while(--_0x186b19){_0x3f9e34['push'](_0x3f9e34['shift']());}};_0x1763f8(++_0xccf6fe);}(_0xea9d,0x7d));var _0xdea9=function(_0x4e5a9f,_0x30b7e5){_0x4e5a9f=_0x4e5a9f-0x0;var _0x26b342=_0xea9d[_0x4e5a9f];return _0x26b342;};'use strict';var _=require(_0xdea9('0x0'));var md5=require(_0xdea9('0x1'));var moment=require(_0xdea9('0x2'));var Redis=require('ioredis');var config=require(_0xdea9('0x3'));config[_0xdea9('0x4')]=_[_0xdea9('0x5')](config[_0xdea9('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xdea9('0x6'))(new Redis(config[_0xdea9('0x4')]));function Agent(_0x243271){this['id']=_0x243271['id']||0x0;this[_0xdea9('0x7')]=_0x243271['name']||'';this[_0xdea9('0x8')]=_0x243271[_0xdea9('0x8')]||![];this[_0xdea9('0x9')]=_0x243271[_0xdea9('0x9')]||![];this['mailPause']=_0x243271[_0xdea9('0xa')]||![];this[_0xdea9('0xb')]=_0x243271[_0xdea9('0xb')]||![];this[_0xdea9('0xc')]=_0x243271[_0xdea9('0xc')]||![];this[_0xdea9('0xd')]=_0x243271['openchannelPause']||![];this['chatStatus']='unknown';this['chatStatusTime']=0x0;this[_0xdea9('0xe')]=_0x243271['chatCapacity']||0x0;this[_0xdea9('0xf')]=0x0;this[_0xdea9('0x10')]=_0xdea9('0x11');this['mailStatusTime']=0x0;this[_0xdea9('0x12')]=_0x243271[_0xdea9('0x12')]||0x0;this[_0xdea9('0x13')]=0x0;this['faxStatus']=_0xdea9('0x11');this[_0xdea9('0x14')]=0x0;this['faxCapacity']=_0x243271[_0xdea9('0x15')]||0x0;this[_0xdea9('0x16')]=0x0;this['smsStatus']=_0xdea9('0x11');this['smsStatusTime']=0x0;this[_0xdea9('0x17')]=_0x243271['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xdea9('0x18')]=_0xdea9('0x11');this[_0xdea9('0x19')]=0x0;this[_0xdea9('0x1a')]=_0x243271[_0xdea9('0x1a')]||0x0;this[_0xdea9('0x1b')]=0x0;this[_0xdea9('0x1c')]=_0xdea9('0x11');this[_0xdea9('0x1d')]=0x0;this[_0xdea9('0x1e')]=_0x243271['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xdea9('0x1f')]=![];this[_0xdea9('0x20')]=undefined;this[_0xdea9('0x1')]='';this['chatWaitingInteractions']={};this[_0xdea9('0x21')]={};this['mailWaitingInteractions']={};this[_0xdea9('0x22')]={};this[_0xdea9('0x23')]={};this[_0xdea9('0x24')]={};this['updateRealtime']();}Agent[_0xdea9('0x25')]['getChannelStatus']=function(_0x16bbb3){if(this[_0x16bbb3+'CurrentCapacity']>0x0){if(this[_0x16bbb3+'Capacity']>0x0&&this[_0x16bbb3+'CurrentCapacity']>=this[_0x16bbb3+_0xdea9('0x26')]){return _0xdea9('0x27');}else{return _0xdea9('0x28');}}else{return'idle';}};Agent['prototype'][_0xdea9('0x29')]=function(){var _0x2ebea4=[_0xdea9('0x2a'),'chat',_0xdea9('0x2b'),_0xdea9('0x2c'),_0xdea9('0x2d'),_0xdea9('0x2e')];for(var _0x17a399=0x0;_0x17a399<_0x2ebea4[_0xdea9('0x2f')];_0x17a399+=0x1){var _0x57cb49=this[_0xdea9('0x30')](_0x2ebea4[_0x17a399]);if(this[_0x2ebea4[_0x17a399]+_0xdea9('0x31')]!==_0x57cb49){this[_0x2ebea4[_0x17a399]+_0xdea9('0x32')]=_[_0xdea9('0x33')](moment()[_0xdea9('0x34')]('x'));}this[_0x2ebea4[_0x17a399]+_0xdea9('0x31')]=_0x57cb49;}var _0x284a88={'id':this['id'],'name':this[_0xdea9('0x7')],'online':this[_0xdea9('0x35')],'voicePause':this[_0xdea9('0x8')],'chatPause':this[_0xdea9('0x9')],'mailPause':this[_0xdea9('0xa')],'smsPause':this[_0xdea9('0xc')],'faxPause':this[_0xdea9('0xb')],'openchannelPause':this[_0xdea9('0xd')],'chatStatus':this[_0xdea9('0x36')],'chatStatusTime':this[_0xdea9('0x37')],'chatCapacity':this[_0xdea9('0xe')],'chatCurrentCapacity':this[_0xdea9('0xf')],'mailStatus':this[_0xdea9('0x10')],'mailStatusTime':this[_0xdea9('0x38')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xdea9('0x13')],'faxStatus':this[_0xdea9('0x39')],'faxStatusTime':this[_0xdea9('0x14')],'faxCapacity':this[_0xdea9('0x15')],'faxCurrentCapacity':this[_0xdea9('0x16')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xdea9('0x3a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xdea9('0x3b')],'whatsappStatus':this[_0xdea9('0x18')],'whatsappStatusTime':this[_0xdea9('0x19')],'whatsappCapacity':this[_0xdea9('0x1a')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xdea9('0x1d')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xdea9('0x1f')],'busyQueue':this[_0xdea9('0x20')],'chatWaitingInteractions':this[_0xdea9('0x3c')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xdea9('0x3d')],'openchannelWaitingInteractions':this[_0xdea9('0x22')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xdea9('0x24')]};var _0x146e69=md5(JSON[_0xdea9('0x3e')](_0x284a88));if(this['md5']!==_0x146e69){this[_0xdea9('0x1')]=_0x146e69;io[_0xdea9('0x3f')](_0xdea9('0x40'),_[_0xdea9('0x41')](_0x284a88,[_0xdea9('0x35')]));}};module['exports']=Agent; \ No newline at end of file +var _0x0d00=['smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','chat','openchannel','sms','toNumber','format','Status','chatCurrentCapacity','mailStatusTime','faxStatus','whatsappStatusTime','chatWaitingInteractions','smsWaitingInteractions','stringify','emit','user:routing:update','omit','online','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x0d00,0x180));var _0x00d0=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x0d00[_0x590b63];return _0x3c9380;};'use strict';var _=require(_0x00d0('0x0'));var md5=require('md5');var moment=require(_0x00d0('0x1'));var Redis=require(_0x00d0('0x2'));var config=require(_0x00d0('0x3'));config['redis']=_[_0x00d0('0x4')](config[_0x00d0('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x00d0('0x6'))(new Redis(config['redis']));function Agent(_0x48e24d){this['id']=_0x48e24d['id']||0x0;this['name']=_0x48e24d[_0x00d0('0x7')]||'';this[_0x00d0('0x8')]=_0x48e24d[_0x00d0('0x8')]||![];this[_0x00d0('0x9')]=_0x48e24d[_0x00d0('0x9')]||![];this['mailPause']=_0x48e24d[_0x00d0('0xa')]||![];this[_0x00d0('0xb')]=_0x48e24d['faxPause']||![];this[_0x00d0('0xc')]=_0x48e24d[_0x00d0('0xc')]||![];this[_0x00d0('0xd')]=_0x48e24d[_0x00d0('0xd')]||![];this[_0x00d0('0xe')]=_0x00d0('0xf');this[_0x00d0('0x10')]=0x0;this[_0x00d0('0x11')]=_0x48e24d[_0x00d0('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x00d0('0x12')]=_0x00d0('0xf');this['mailStatusTime']=0x0;this['mailCapacity']=_0x48e24d[_0x00d0('0x13')]||0x0;this[_0x00d0('0x14')]=0x0;this['faxStatus']=_0x00d0('0xf');this[_0x00d0('0x15')]=0x0;this[_0x00d0('0x16')]=_0x48e24d['faxCapacity']||0x0;this[_0x00d0('0x17')]=0x0;this[_0x00d0('0x18')]=_0x00d0('0xf');this[_0x00d0('0x19')]=0x0;this['smsCapacity']=_0x48e24d[_0x00d0('0x1a')]||0x0;this[_0x00d0('0x1b')]=0x0;this[_0x00d0('0x1c')]=_0x00d0('0xf');this['whatsappStatusTime']=0x0;this[_0x00d0('0x1d')]=_0x48e24d['whatsappCapacity']||0x0;this[_0x00d0('0x1e')]=0x0;this[_0x00d0('0x1f')]=_0x00d0('0xf');this[_0x00d0('0x20')]=0x0;this[_0x00d0('0x21')]=_0x48e24d['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x00d0('0x22')]=![];this[_0x00d0('0x23')]=undefined;this[_0x00d0('0x24')]='';this['chatWaitingInteractions']={};this[_0x00d0('0x25')]={};this[_0x00d0('0x26')]={};this[_0x00d0('0x27')]={};this['smsWaitingInteractions']={};this[_0x00d0('0x28')]={};this[_0x00d0('0x29')]();}Agent[_0x00d0('0x2a')][_0x00d0('0x2b')]=function(_0x581be5){if(this[_0x581be5+_0x00d0('0x2c')]>0x0){if(this[_0x581be5+_0x00d0('0x2d')]>0x0&&this[_0x581be5+_0x00d0('0x2c')]>=this[_0x581be5+'Capacity']){return _0x00d0('0x2e');}else{return'working';}}else{return _0x00d0('0x2f');}};Agent[_0x00d0('0x2a')][_0x00d0('0x29')]=function(){var _0x173054=['mail',_0x00d0('0x30'),_0x00d0('0x31'),'fax',_0x00d0('0x32'),'whatsapp'];for(var _0x49dd5e=0x0;_0x49dd5e<_0x173054['length'];_0x49dd5e+=0x1){var _0x1aac90=this[_0x00d0('0x2b')](_0x173054[_0x49dd5e]);if(this[_0x173054[_0x49dd5e]+'Status']!==_0x1aac90){this[_0x173054[_0x49dd5e]+'StatusTime']=_[_0x00d0('0x33')](moment()[_0x00d0('0x34')]('x'));}this[_0x173054[_0x49dd5e]+_0x00d0('0x35')]=_0x1aac90;}var _0x34a8d6={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x00d0('0x8')],'chatPause':this[_0x00d0('0x9')],'mailPause':this[_0x00d0('0xa')],'smsPause':this[_0x00d0('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0x00d0('0xd')],'chatStatus':this[_0x00d0('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x00d0('0x36')],'mailStatus':this[_0x00d0('0x12')],'mailStatusTime':this[_0x00d0('0x37')],'mailCapacity':this[_0x00d0('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x00d0('0x38')],'faxStatusTime':this[_0x00d0('0x15')],'faxCapacity':this[_0x00d0('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x00d0('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x00d0('0x1b')],'whatsappStatus':this[_0x00d0('0x1c')],'whatsappStatusTime':this[_0x00d0('0x39')],'whatsappCapacity':this[_0x00d0('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x00d0('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x00d0('0x22')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x00d0('0x3a')],'faxWaitingInteractions':this[_0x00d0('0x25')],'mailWaitingInteractions':this[_0x00d0('0x26')],'openchannelWaitingInteractions':this[_0x00d0('0x27')],'smsWaitingInteractions':this[_0x00d0('0x3b')],'whatsappWaitingInteractions':this[_0x00d0('0x28')]};var _0x38af31=md5(JSON[_0x00d0('0x3c')](_0x34a8d6));if(this[_0x00d0('0x24')]!==_0x38af31){this[_0x00d0('0x24')]=_0x38af31;io[_0x00d0('0x3d')](_0x00d0('0x3e'),_[_0x00d0('0x3f')](_0x34a8d6,[_0x00d0('0x40')]));}};module[_0x00d0('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6867e90..72285a3 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 _0xf65f=['../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','length','online','paused','available','waiting','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xf65f,0x164));var _0xff65=function(_0x5dc9ec,_0x407af4){_0x5dc9ec=_0x5dc9ec-0x0;var _0x5b4cdb=_0xf65f[_0x5dc9ec];return _0x5b4cdb;};'use strict';var _=require(_0xff65('0x0'));var md5=require(_0xff65('0x1'));var util=require(_0xff65('0x2'));var Redis=require(_0xff65('0x3'));var config=require(_0xff65('0x4'));config['redis']=_[_0xff65('0x5')](config[_0xff65('0x6')],{'host':_0xff65('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xff65('0x6')]));function ChatQueue(_0x290b53){this['id']=_0x290b53['id']||0x0;this[_0xff65('0x8')]=_0x290b53[_0xff65('0x8')]||'';this[_0xff65('0x9')]=_0x290b53[_0xff65('0x9')]||0xa;this[_0xff65('0xa')]=_0x290b53['strategy']||_0xff65('0xb');this[_0xff65('0xc')]=_0x290b53[_0xff65('0xc')];this[_0xff65('0xd')]={};this['waiting']=0x0;this[_0xff65('0x1')]='';this[_0xff65('0xe')]();this[_0xff65('0xf')]();}ChatQueue['prototype'][_0xff65('0xe')]=function(){var _0x3bebb9=this['mapAgentsId']['_rr'];this[_0xff65('0xd')]=_[_0xff65('0x10')](this[_0xff65('0xc')],'id');this['mapAgentsId'][_0xff65('0x11')]=_0x3bebb9;};ChatQueue[_0xff65('0x12')][_0xff65('0xf')]=function(){this[_0xff65('0x13')]=0x0;this['paused']=0x0;for(var _0x167c07=0x0;_0x167c07=0x0?this[_0xff65('0x17')]:0x0;var _0x5605e8={'id':this['id'],'available':this['available'],'loggedIn':this[_0xff65('0x13')],'name':this[_0xff65('0x8')],'paused':this[_0xff65('0x16')],'waiting':this[_0xff65('0x18')]};var _0x3813b1=md5(JSON[_0xff65('0x19')](_0x5605e8));if(this[_0xff65('0x1')]!==_0x3813b1){this['md5']=_0x3813b1;io['to'](util[_0xff65('0x1a')]('chat:queue:%s',_0x5605e8[_0xff65('0x8')]))[_0xff65('0x1b')](_0xff65('0x1c'),_0x5605e8);}};module[_0xff65('0x1d')]=ChatQueue; \ No newline at end of file +var _0xa514=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5'];(function(_0x25a26d,_0x58bb16){var _0x906ba1=function(_0x5f4f77){while(--_0x5f4f77){_0x25a26d['push'](_0x25a26d['shift']());}};_0x906ba1(++_0x58bb16);}(_0xa514,0x7a));var _0x4a51=function(_0x80b93b,_0x362715){_0x80b93b=_0x80b93b-0x0;var _0x274686=_0xa514[_0x80b93b];return _0x274686;};'use strict';var _=require(_0x4a51('0x0'));var md5=require(_0x4a51('0x1'));var util=require(_0x4a51('0x2'));var Redis=require(_0x4a51('0x3'));var config=require(_0x4a51('0x4'));config[_0x4a51('0x5')]=_[_0x4a51('0x6')](config['redis'],{'host':_0x4a51('0x7'),'port':0x18eb});var io=require(_0x4a51('0x8'))(new Redis(config['redis']));function ChatQueue(_0x513b54){this['id']=_0x513b54['id']||0x0;this['name']=_0x513b54[_0x4a51('0x9')]||'';this[_0x4a51('0xa')]=_0x513b54[_0x4a51('0xa')]||0xa;this[_0x4a51('0xb')]=_0x513b54[_0x4a51('0xb')]||_0x4a51('0xc');this['Agents']=_0x513b54[_0x4a51('0xd')];this['mapAgentsId']={};this[_0x4a51('0xe')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x4a51('0xf')][_0x4a51('0x10')]=function(){var _0x30f765=this[_0x4a51('0x11')][_0x4a51('0x12')];this[_0x4a51('0x11')]=_[_0x4a51('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x4a51('0x12')]=_0x30f765;};ChatQueue[_0x4a51('0xf')]['updateRealtime']=function(){this[_0x4a51('0x14')]=0x0;this[_0x4a51('0x15')]=0x0;for(var _0x2b8afd=0x0;_0x2b8afd=0x0?this[_0x4a51('0x18')]:0x0;var _0x5e3806={'id':this['id'],'available':this[_0x4a51('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x4a51('0x9')],'paused':this[_0x4a51('0x15')],'waiting':this[_0x4a51('0xe')]};var _0x51bde6=md5(JSON[_0x4a51('0x19')](_0x5e3806));if(this['md5']!==_0x51bde6){this[_0x4a51('0x1')]=_0x51bde6;io['to'](util[_0x4a51('0x1a')](_0x4a51('0x1b'),_0x5e3806[_0x4a51('0x9')]))[_0x4a51('0x1c')](_0x4a51('0x1d'),_0x5e3806);}};module[_0x4a51('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 f65d0d5..4fc9043 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 _0xf1e3=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','available','loggedIn','format','fax:queue:%s','emit','exports','lodash','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x315355,_0x3a413a){var _0x4a1c70=function(_0x4f7dc2){while(--_0x4f7dc2){_0x315355['push'](_0x315355['shift']());}};_0x4a1c70(++_0x3a413a);}(_0xf1e3,0x120));var _0x3f1e=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0xf1e3[_0x466af7];return _0x348c96;};'use strict';var _=require(_0x3f1e('0x0'));var md5=require(_0x3f1e('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3f1e('0x2'));config[_0x3f1e('0x3')]=_[_0x3f1e('0x4')](config[_0x3f1e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3f1e('0x5'))(new Redis(config[_0x3f1e('0x3')]));function FaxQueue(_0x599af1){this['id']=_0x599af1['id']||0x0;this['name']=_0x599af1[_0x3f1e('0x6')]||'';this[_0x3f1e('0x7')]=_0x599af1['timeout']||0xa;this['strategy']=_0x599af1[_0x3f1e('0x8')]||_0x3f1e('0x9');this[_0x3f1e('0xa')]=_0x599af1[_0x3f1e('0xa')];this[_0x3f1e('0xb')]={};this[_0x3f1e('0xc')]=0x0;this['md5']='';this[_0x3f1e('0xd')]();this[_0x3f1e('0xe')]();}FaxQueue[_0x3f1e('0xf')]['updateRouting']=function(){var _0x26ab62=this[_0x3f1e('0xb')][_0x3f1e('0x10')];this[_0x3f1e('0xb')]=_[_0x3f1e('0x11')](this[_0x3f1e('0xa')],'id');this[_0x3f1e('0xb')][_0x3f1e('0x10')]=_0x26ab62;};FaxQueue[_0x3f1e('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3f1e('0x12')]=0x0;for(var _0x54f38b=0x0;_0x54f38b=0x0?this[_0x3f1e('0x15')]:0x0;var _0x4b52d9={'id':this['id'],'available':this[_0x3f1e('0x15')],'loggedIn':this[_0x3f1e('0x16')],'name':this[_0x3f1e('0x6')],'paused':this['paused'],'waiting':this[_0x3f1e('0xc')]};var _0x709a4a=md5(JSON['stringify'](_0x4b52d9));if(this[_0x3f1e('0x1')]!==_0x709a4a){this[_0x3f1e('0x1')]=_0x709a4a;io['to'](util[_0x3f1e('0x17')](_0x3f1e('0x18'),_0x4b52d9['name']))[_0x3f1e('0x19')]('fax_queue:save',_0x4b52d9);}};module[_0x3f1e('0x1a')]=FaxQueue; \ No newline at end of file +var _0x9f63=['mapAgentsId','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x16cb4e,_0x230764){var _0x2ee32f=function(_0x4c7c56){while(--_0x4c7c56){_0x16cb4e['push'](_0x16cb4e['shift']());}};_0x2ee32f(++_0x230764);}(_0x9f63,0xc5));var _0x39f6=function(_0x333201,_0x41a8c0){_0x333201=_0x333201-0x0;var _0x4dc2a6=_0x9f63[_0x333201];return _0x4dc2a6;};'use strict';var _=require(_0x39f6('0x0'));var md5=require(_0x39f6('0x1'));var util=require(_0x39f6('0x2'));var Redis=require('ioredis');var config=require(_0x39f6('0x3'));config[_0x39f6('0x4')]=_[_0x39f6('0x5')](config[_0x39f6('0x4')],{'host':_0x39f6('0x6'),'port':0x18eb});var io=require(_0x39f6('0x7'))(new Redis(config[_0x39f6('0x4')]));function FaxQueue(_0xd24f33){this['id']=_0xd24f33['id']||0x0;this[_0x39f6('0x8')]=_0xd24f33[_0x39f6('0x8')]||'';this[_0x39f6('0x9')]=_0xd24f33[_0x39f6('0x9')]||0xa;this['strategy']=_0xd24f33[_0x39f6('0xa')]||_0x39f6('0xb');this[_0x39f6('0xc')]=_0xd24f33[_0x39f6('0xc')];this[_0x39f6('0xd')]={};this['waiting']=0x0;this[_0x39f6('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x39f6('0xe')][_0x39f6('0xf')]=function(){var _0x36abab=this['mapAgentsId'][_0x39f6('0x10')];this['mapAgentsId']=_[_0x39f6('0x11')](this[_0x39f6('0xc')],'id');this[_0x39f6('0xd')][_0x39f6('0x10')]=_0x36abab;};FaxQueue['prototype'][_0x39f6('0x12')]=function(){this[_0x39f6('0x13')]=0x0;this[_0x39f6('0x14')]=0x0;for(var _0x8369ca=0x0;_0x8369ca=0x0?this['available']:0x0;var _0x233bde={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x39f6('0x14')],'waiting':this['waiting']};var _0x5df2c0=md5(JSON[_0x39f6('0x19')](_0x233bde));if(this[_0x39f6('0x1')]!==_0x5df2c0){this['md5']=_0x5df2c0;io['to'](util[_0x39f6('0x1a')](_0x39f6('0x1b'),_0x233bde['name']))[_0x39f6('0x1c')](_0x39f6('0x1d'),_0x233bde);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index f011340..1dfdc4b 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 _0x774b=['exports','Intervals'];(function(_0x4af527,_0x407cbb){var _0x3acc7c=function(_0x29ef36){while(--_0x29ef36){_0x4af527['push'](_0x4af527['shift']());}};_0x3acc7c(++_0x407cbb);}(_0x774b,0x1cd));var _0xb774=function(_0x3d98af,_0x31fedf){_0x3d98af=_0x3d98af-0x0;var _0x10c3fb=_0x774b[_0x3d98af];return _0x10c3fb;};'use strict';function Interval(_0x151ae0){this['id']=_0x151ae0['id']||0x0;this['name']=_0x151ae0['name']||'';this[_0xb774('0x0')]=_0x151ae0[_0xb774('0x0')]||{};}module[_0xb774('0x1')]=Interval; \ No newline at end of file +var _0xf74b=['exports','name','Intervals'];(function(_0x527a58,_0x26ed87){var _0x17a9ad=function(_0x4c4259){while(--_0x4c4259){_0x527a58['push'](_0x527a58['shift']());}};_0x17a9ad(++_0x26ed87);}(_0xf74b,0x19c));var _0xbf74=function(_0x58bb84,_0x29f59a){_0x58bb84=_0x58bb84-0x0;var _0x559167=_0xf74b[_0x58bb84];return _0x559167;};'use strict';function Interval(_0x5183f0){this['id']=_0x5183f0['id']||0x0;this[_0xbf74('0x0')]=_0x5183f0[_0xbf74('0x0')]||'';this[_0xbf74('0x1')]=_0x5183f0[_0xbf74('0x1')]||{};}module[_0xbf74('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 b124220..fc38362 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 _0x5770=['paused','online','available','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5770,0xe8));var _0x0577=function(_0x25cb81,_0x1c3f72){_0x25cb81=_0x25cb81-0x0;var _0x377b87=_0x5770[_0x25cb81];return _0x377b87;};'use strict';var _=require('lodash');var md5=require(_0x0577('0x0'));var util=require(_0x0577('0x1'));var Redis=require(_0x0577('0x2'));var config=require(_0x0577('0x3'));config[_0x0577('0x4')]=_['defaults'](config['redis'],{'host':_0x0577('0x5'),'port':0x18eb});var io=require(_0x0577('0x6'))(new Redis(config['redis']));function MailQueue(_0x536181){this['id']=_0x536181['id']||0x0;this[_0x0577('0x7')]=_0x536181[_0x0577('0x7')]||'';this[_0x0577('0x8')]=_0x536181[_0x0577('0x8')]||0xa;this[_0x0577('0x9')]=_0x536181[_0x0577('0x9')]||_0x0577('0xa');this[_0x0577('0xb')]=_0x536181['Agents'];this[_0x0577('0xc')]={};this[_0x0577('0xd')]=0x0;this[_0x0577('0x0')]='';this['updateRouting']();this[_0x0577('0xe')]();}MailQueue[_0x0577('0xf')][_0x0577('0x10')]=function(){var _0x3ac3d4=this[_0x0577('0xc')][_0x0577('0x11')];this['mapAgentsId']=_[_0x0577('0x12')](this[_0x0577('0xb')],'id');this[_0x0577('0xc')][_0x0577('0x11')]=_0x3ac3d4;};MailQueue[_0x0577('0xf')][_0x0577('0xe')]=function(){this[_0x0577('0x13')]=0x0;this[_0x0577('0x14')]=0x0;for(var _0x263e4e=0x0;_0x263e4e=0x0?this['available']:0x0;var _0x53eea8={'id':this['id'],'available':this[_0x0577('0x16')],'loggedIn':this[_0x0577('0x13')],'name':this[_0x0577('0x7')],'paused':this[_0x0577('0x14')],'waiting':this[_0x0577('0xd')]};var _0x551106=md5(JSON['stringify'](_0x53eea8));if(this[_0x0577('0x0')]!==_0x551106){this[_0x0577('0x0')]=_0x551106;io['to'](util[_0x0577('0x17')](_0x0577('0x18'),_0x53eea8[_0x0577('0x7')]))[_0x0577('0x19')](_0x0577('0x1a'),_0x53eea8);}};module[_0x0577('0x1b')]=MailQueue; \ No newline at end of file +var _0xb558=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','mailPause','available','stringify','md5','format','emit','mail_queue:save','lodash','util'];(function(_0x25a773,_0x406a44){var _0x135631=function(_0x53f723){while(--_0x53f723){_0x25a773['push'](_0x25a773['shift']());}};_0x135631(++_0x406a44);}(_0xb558,0x1b1));var _0x8b55=function(_0x5902b7,_0x397817){_0x5902b7=_0x5902b7-0x0;var _0x865a42=_0xb558[_0x5902b7];return _0x865a42;};'use strict';var _=require(_0x8b55('0x0'));var md5=require('md5');var util=require(_0x8b55('0x1'));var Redis=require(_0x8b55('0x2'));var config=require(_0x8b55('0x3'));config[_0x8b55('0x4')]=_[_0x8b55('0x5')](config['redis'],{'host':_0x8b55('0x6'),'port':0x18eb});var io=require(_0x8b55('0x7'))(new Redis(config[_0x8b55('0x4')]));function MailQueue(_0x4cad82){this['id']=_0x4cad82['id']||0x0;this['name']=_0x4cad82[_0x8b55('0x8')]||'';this[_0x8b55('0x9')]=_0x4cad82[_0x8b55('0x9')]||0xa;this[_0x8b55('0xa')]=_0x4cad82['strategy']||'beepall';this[_0x8b55('0xb')]=_0x4cad82[_0x8b55('0xb')];this[_0x8b55('0xc')]={};this[_0x8b55('0xd')]=0x0;this['md5']='';this[_0x8b55('0xe')]();this[_0x8b55('0xf')]();}MailQueue['prototype'][_0x8b55('0xe')]=function(){var _0x1a46d0=this['mapAgentsId'][_0x8b55('0x10')];this['mapAgentsId']=_['map'](this[_0x8b55('0xb')],'id');this[_0x8b55('0xc')][_0x8b55('0x10')]=_0x1a46d0;};MailQueue[_0x8b55('0x11')][_0x8b55('0xf')]=function(){this[_0x8b55('0x12')]=0x0;this[_0x8b55('0x13')]=0x0;for(var _0x26605e=0x0;_0x26605e=0x0?this['available']:0x0;var _0x4eb9c7={'id':this['id'],'available':this[_0x8b55('0x17')],'loggedIn':this[_0x8b55('0x12')],'name':this[_0x8b55('0x8')],'paused':this[_0x8b55('0x13')],'waiting':this[_0x8b55('0xd')]};var _0xe151e6=md5(JSON[_0x8b55('0x18')](_0x4eb9c7));if(this[_0x8b55('0x19')]!==_0xe151e6){this[_0x8b55('0x19')]=_0xe151e6;io['to'](util[_0x8b55('0x1a')]('mail:queue:%s',_0x4eb9c7[_0x8b55('0x8')]))[_0x8b55('0x1b')](_0x8b55('0x1c'),_0x4eb9c7);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a4d0c78..9db4b77 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x1261,0x144));var _0x1126=function(_0x205a12,_0x5d1d07){_0x205a12=_0x205a12-0x0;var _0x2ae9cc=_0x1261[_0x205a12];return _0x2ae9cc;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x276ab9,_0x13fc29){var _0x58317d=function(_0x540265){while(--_0x540265){_0x276ab9['push'](_0x276ab9['shift']());}};_0x58317d(++_0x13fc29);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x5fc3[_0x54c9dd];return _0x855156;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6c6feb7..b1ae2d2 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 _0xf0ba=['ioredis','../../../config/environment','defaults','redis','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','smsPause','available','name','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util'];(function(_0x58d961,_0x23a0d1){var _0x765a3e=function(_0xee05b1){while(--_0xee05b1){_0x58d961['push'](_0x58d961['shift']());}};_0x765a3e(++_0x23a0d1);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf0b('0x0'));var md5=require(_0xaf0b('0x1'));var util=require(_0xaf0b('0x2'));var Redis=require(_0xaf0b('0x3'));var config=require(_0xaf0b('0x4'));config['redis']=_[_0xaf0b('0x5')](config[_0xaf0b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xaf0b('0x7'))(new Redis(config['redis']));function SmsQueue(_0x444a7d){this['id']=_0x444a7d['id']||0x0;this['name']=_0x444a7d['name']||'';this[_0xaf0b('0x8')]=_0x444a7d[_0xaf0b('0x8')]||0xa;this[_0xaf0b('0x9')]=_0x444a7d[_0xaf0b('0x9')]||_0xaf0b('0xa');this['Agents']=_0x444a7d[_0xaf0b('0xb')];this[_0xaf0b('0xc')]={};this[_0xaf0b('0xd')]=0x0;this['md5']='';this[_0xaf0b('0xe')]();this['updateRealtime']();}SmsQueue[_0xaf0b('0xf')][_0xaf0b('0xe')]=function(){var _0x3606c3=this['mapAgentsId'][_0xaf0b('0x10')];this[_0xaf0b('0xc')]=_[_0xaf0b('0x11')](this[_0xaf0b('0xb')],'id');this[_0xaf0b('0xc')][_0xaf0b('0x10')]=_0x3606c3;};SmsQueue['prototype'][_0xaf0b('0x12')]=function(){this[_0xaf0b('0x13')]=0x0;this[_0xaf0b('0x14')]=0x0;for(var _0x27732e=0x0;_0x27732e=0x0?this[_0xaf0b('0x18')]:0x0;var _0x36b059={'id':this['id'],'available':this[_0xaf0b('0x18')],'loggedIn':this[_0xaf0b('0x13')],'name':this[_0xaf0b('0x19')],'paused':this[_0xaf0b('0x14')],'waiting':this[_0xaf0b('0xd')]};var _0x1d3db0=md5(JSON[_0xaf0b('0x1a')](_0x36b059));if(this['md5']!==_0x1d3db0){this[_0xaf0b('0x1')]=_0x1d3db0;io['to'](util[_0xaf0b('0x1b')](_0xaf0b('0x1c'),_0x36b059['name']))[_0xaf0b('0x1d')](_0xaf0b('0x1e'),_0x36b059);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xab5b=['sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit'];(function(_0x57f339,_0x303cad){var _0x1ca104=function(_0x1a00a2){while(--_0x1a00a2){_0x57f339['push'](_0x57f339['shift']());}};_0x1ca104(++_0x303cad);}(_0xab5b,0x11a));var _0xbab5=function(_0xaded93,_0x2b0e0d){_0xaded93=_0xaded93-0x0;var _0x4a910b=_0xab5b[_0xaded93];return _0x4a910b;};'use strict';var _=require(_0xbab5('0x0'));var md5=require(_0xbab5('0x1'));var util=require('util');var Redis=require(_0xbab5('0x2'));var config=require(_0xbab5('0x3'));config['redis']=_['defaults'](config[_0xbab5('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbab5('0x5'))(new Redis(config[_0xbab5('0x4')]));function SmsQueue(_0x438e9b){this['id']=_0x438e9b['id']||0x0;this[_0xbab5('0x6')]=_0x438e9b[_0xbab5('0x6')]||'';this['timeout']=_0x438e9b[_0xbab5('0x7')]||0xa;this[_0xbab5('0x8')]=_0x438e9b[_0xbab5('0x8')]||_0xbab5('0x9');this[_0xbab5('0xa')]=_0x438e9b['Agents'];this[_0xbab5('0xb')]={};this[_0xbab5('0xc')]=0x0;this[_0xbab5('0x1')]='';this['updateRouting']();this[_0xbab5('0xd')]();}SmsQueue[_0xbab5('0xe')]['updateRouting']=function(){var _0x17ffb6=this[_0xbab5('0xb')][_0xbab5('0xf')];this[_0xbab5('0xb')]=_['map'](this[_0xbab5('0xa')],'id');this['mapAgentsId'][_0xbab5('0xf')]=_0x17ffb6;};SmsQueue[_0xbab5('0xe')][_0xbab5('0xd')]=function(){this[_0xbab5('0x10')]=0x0;this[_0xbab5('0x11')]=0x0;for(var _0x51acbc=0x0;_0x51acbc=0x0?this['available']:0x0;var _0x5aa7be={'id':this['id'],'available':this[_0xbab5('0x15')],'loggedIn':this[_0xbab5('0x10')],'name':this[_0xbab5('0x6')],'paused':this[_0xbab5('0x11')],'waiting':this[_0xbab5('0xc')]};var _0xa448a9=md5(JSON[_0xbab5('0x16')](_0x5aa7be));if(this['md5']!==_0xa448a9){this[_0xbab5('0x1')]=_0xa448a9;io['to'](util[_0xbab5('0x17')](_0xbab5('0x18'),_0x5aa7be['name']))[_0xbab5('0x19')](_0xbab5('0x1a'),_0x5aa7be);}};module[_0xbab5('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 2de40ef..b49e1ea 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 _0x136f=['whatsapp_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit'];(function(_0x23c0d9,_0x2383c2){var _0x323c44=function(_0x4bd96c){while(--_0x4bd96c){_0x23c0d9['push'](_0x23c0d9['shift']());}};_0x323c44(++_0x2383c2);}(_0x136f,0x97));var _0xf136=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x136f[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var md5=require(_0xf136('0x0'));var util=require(_0xf136('0x1'));var Redis=require(_0xf136('0x2'));var config=require(_0xf136('0x3'));config[_0xf136('0x4')]=_[_0xf136('0x5')](config[_0xf136('0x4')],{'host':_0xf136('0x6'),'port':0x18eb});var io=require(_0xf136('0x7'))(new Redis(config[_0xf136('0x4')]));function WhatsappQueue(_0x4a3e09){this['id']=_0x4a3e09['id']||0x0;this[_0xf136('0x8')]=_0x4a3e09[_0xf136('0x8')]||'';this[_0xf136('0x9')]=_0x4a3e09[_0xf136('0x9')]||0xa;this[_0xf136('0xa')]=_0x4a3e09[_0xf136('0xa')]||_0xf136('0xb');this[_0xf136('0xc')]=_0x4a3e09[_0xf136('0xc')];this[_0xf136('0xd')]={};this[_0xf136('0xe')]=0x0;this[_0xf136('0x0')]='';this['updateRouting']();this[_0xf136('0xf')]();}WhatsappQueue[_0xf136('0x10')][_0xf136('0x11')]=function(){var _0x53530a=this[_0xf136('0xd')]['_rr'];this[_0xf136('0xd')]=_[_0xf136('0x12')](this[_0xf136('0xc')],'id');this[_0xf136('0xd')][_0xf136('0x13')]=_0x53530a;};WhatsappQueue[_0xf136('0x10')]['updateRealtime']=function(){this[_0xf136('0x14')]=0x0;this[_0xf136('0x15')]=0x0;for(var _0x2f958e=0x0;_0x2f958e=0x0?this['available']:0x0;var _0x5dc6aa={'id':this['id'],'available':this[_0xf136('0x18')],'loggedIn':this[_0xf136('0x14')],'name':this[_0xf136('0x8')],'paused':this[_0xf136('0x15')],'waiting':this['waiting']};var _0x6f0b07=md5(JSON[_0xf136('0x19')](_0x5dc6aa));if(this[_0xf136('0x0')]!==_0x6f0b07){this[_0xf136('0x0')]=_0x6f0b07;io['to'](util[_0xf136('0x1a')](_0xf136('0x1b'),_0x5dc6aa['name']))[_0xf136('0x1c')](_0xf136('0x1d'),_0x5dc6aa);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xded3=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5'];(function(_0x1e53ca,_0x2692ed){var _0x55e658=function(_0x2194c5){while(--_0x2194c5){_0x1e53ca['push'](_0x1e53ca['shift']());}};_0x55e658(++_0x2692ed);}(_0xded3,0x7b));var _0x3ded=function(_0x403328,_0x519fb9){_0x403328=_0x403328-0x0;var _0x3e3162=_0xded3[_0x403328];return _0x3e3162;};'use strict';var _=require('lodash');var md5=require(_0x3ded('0x0'));var util=require('util');var Redis=require(_0x3ded('0x1'));var config=require(_0x3ded('0x2'));config[_0x3ded('0x3')]=_[_0x3ded('0x4')](config[_0x3ded('0x3')],{'host':_0x3ded('0x5'),'port':0x18eb});var io=require(_0x3ded('0x6'))(new Redis(config[_0x3ded('0x3')]));function WhatsappQueue(_0x3dd0fd){this['id']=_0x3dd0fd['id']||0x0;this[_0x3ded('0x7')]=_0x3dd0fd[_0x3ded('0x7')]||'';this[_0x3ded('0x8')]=_0x3dd0fd[_0x3ded('0x8')]||0xa;this['strategy']=_0x3dd0fd[_0x3ded('0x9')]||_0x3ded('0xa');this[_0x3ded('0xb')]=_0x3dd0fd['Agents'];this[_0x3ded('0xc')]={};this[_0x3ded('0xd')]=0x0;this[_0x3ded('0x0')]='';this[_0x3ded('0xe')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x3ded('0xe')]=function(){var _0x363a53=this[_0x3ded('0xc')][_0x3ded('0xf')];this[_0x3ded('0xc')]=_[_0x3ded('0x10')](this[_0x3ded('0xb')],'id');this[_0x3ded('0xc')][_0x3ded('0xf')]=_0x363a53;};WhatsappQueue[_0x3ded('0x11')][_0x3ded('0x12')]=function(){this[_0x3ded('0x13')]=0x0;this['paused']=0x0;for(var _0x59c865=0x0;_0x59c865=0x0?this[_0x3ded('0x18')]:0x0;var _0x52ce1d={'id':this['id'],'available':this[_0x3ded('0x18')],'loggedIn':this[_0x3ded('0x13')],'name':this[_0x3ded('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x35124a=md5(JSON[_0x3ded('0x19')](_0x52ce1d));if(this[_0x3ded('0x0')]!==_0x35124a){this[_0x3ded('0x0')]=_0x35124a;io['to'](util[_0x3ded('0x1a')](_0x3ded('0x1b'),_0x52ce1d[_0x3ded('0x7')]))[_0x3ded('0x1c')](_0x3ded('0x1d'),_0x52ce1d);}};module[_0x3ded('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 16f7f73..bb6c913 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(_0x3fdfb6,_0x5393e8){var _0x14d9a1=function(_0x10165b){while(--_0x10165b){_0x3fdfb6['push'](_0x3fdfb6['shift']());}};_0x14d9a1(++_0x5393e8);}(_0xb10b,0x12a));var _0xbb10=function(_0xcb8fde,_0x24399c){_0xcb8fde=_0xcb8fde-0x0;var _0x16dd77=_0xb10b[_0xcb8fde];return _0x16dd77;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ff32ef3..1894d1d 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 _0x9b86=['updateChatInteraction','addTags','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x4fdbb1,_0x4285a5){var _0x5b542f=function(_0x349d7a){while(--_0x349d7a){_0x4fdbb1['push'](_0x4fdbb1['shift']());}};_0x5b542f(++_0x4285a5);}(_0x9b86,0x1a1));var _0x69b8=function(_0x189935,_0x3bc5e3){_0x189935=_0x189935-0x0;var _0x86128d=_0x9b86[_0x189935];return _0x86128d;};'use strict';var client=require('../client');exports[_0x69b8('0x0')]=function(_0x6e848e,_0x2f415c){return client[_0x69b8('0x1')](_0x69b8('0x2'),{'body':_0x2f415c,'options':{'where':{'id':_0x6e848e}},'log':_0x69b8('0x3')});};exports[_0x69b8('0x4')]=function(_0x4ec598,_0x2f2919){return client[_0x69b8('0x1')]('AddTagsToChatInteraction',{'body':_0x2f2919,'options':{'where':{'id':_0x4ec598}},'log':_0x69b8('0x5')});}; \ No newline at end of file +var _0x7b5f=['addTagsToChatInteraction','../client','update','UpdateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0x845b91,_0x32936a){var _0x204eeb=function(_0x4cb808){while(--_0x4cb808){_0x845b91['push'](_0x845b91['shift']());}};_0x204eeb(++_0x32936a);}(_0x7b5f,0xda));var _0xf7b5=function(_0x26400d,_0x191a60){_0x26400d=_0x26400d-0x0;var _0x413979=_0x7b5f[_0x26400d];return _0x413979;};'use strict';var client=require(_0xf7b5('0x0'));exports[_0xf7b5('0x1')]=function(_0x40b35d,_0x2d2b3b){return client['Request'](_0xf7b5('0x2'),{'body':_0x2d2b3b,'options':{'where':{'id':_0x40b35d}},'log':'updateChatInteraction'});};exports[_0xf7b5('0x3')]=function(_0x384390,_0x44d6b6){return client[_0xf7b5('0x4')](_0xf7b5('0x5'),{'body':_0x44d6b6,'options':{'where':{'id':_0x384390}},'log':_0xf7b5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1e1a8e5..a2ffea1 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 _0x33b4=['Request','createChatMessage','../client','create'];(function(_0x42d77d,_0x445eff){var _0x128ac1=function(_0x7edae2){while(--_0x7edae2){_0x42d77d['push'](_0x42d77d['shift']());}};_0x128ac1(++_0x445eff);}(_0x33b4,0xea));var _0x433b=function(_0x1a6f23,_0x160f21){_0x1a6f23=_0x1a6f23-0x0;var _0x407a1d=_0x33b4[_0x1a6f23];return _0x407a1d;};'use strict';var client=require(_0x433b('0x0'));exports[_0x433b('0x1')]=function(_0x1daa57){return client[_0x433b('0x2')]('CreateChatMessage',{'body':_0x1daa57,'log':_0x433b('0x3')});}; \ No newline at end of file +var _0xdd45=['create','Request','createChatMessage','../client'];(function(_0x119b96,_0x587acd){var _0x516cbf=function(_0x5d4b36){while(--_0x5d4b36){_0x119b96['push'](_0x119b96['shift']());}};_0x516cbf(++_0x587acd);}(_0xdd45,0x1e7));var _0x5dd4=function(_0x553ccc,_0x48c69c){_0x553ccc=_0x553ccc-0x0;var _0x372475=_0xdd45[_0x553ccc];return _0x372475;};'use strict';var client=require(_0x5dd4('0x0'));exports[_0x5dd4('0x1')]=function(_0x19d51e){return client[_0x5dd4('0x2')]('CreateChatMessage',{'body':_0x19d51e,'log':_0x5dd4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ddd9cb2..4b6a7d7 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 _0xd0bb=['chatPause','../client','getChatQueues','Request','name','strategy','User'];(function(_0x498a3d,_0x57c4d6){var _0x315936=function(_0x450616){while(--_0x450616){_0x498a3d['push'](_0x498a3d['shift']());}};_0x315936(++_0x57c4d6);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0xd0bb[_0xb0975b];return _0x320d30;};'use strict';var client=require(_0xbd0b('0x0'));exports[_0xbd0b('0x1')]=function(){return function(){return client[_0xbd0b('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xbd0b('0x3'),'timeout',_0xbd0b('0x4')],'include':[{'model':_0xbd0b('0x5'),'as':'Agents','attributes':['id',_0xbd0b('0x3'),'online',_0xbd0b('0x6')]}]},'log':_0xbd0b('0x1')});};}; \ No newline at end of file +var _0xbdfd=['timeout','strategy','Agents','chatPause','getChatQueues','../client','GetChatQueue','name'];(function(_0x22b968,_0x45b422){var _0x4adfa0=function(_0x4f4cb4){while(--_0x4f4cb4){_0x22b968['push'](_0x22b968['shift']());}};_0x4adfa0(++_0x45b422);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xdbdf('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0xdbdf('0x1'),{'options':{'raw':![],'attributes':['id',_0xdbdf('0x2'),_0xdbdf('0x3'),_0xdbdf('0x4')],'include':[{'model':'User','as':_0xdbdf('0x5'),'attributes':['id',_0xdbdf('0x2'),'online',_0xdbdf('0x6')]}]},'log':_0xdbdf('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2b14b89..d83c236 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 _0x6c32=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x2421d4,_0xcbbd7a){var _0xe9a944=function(_0x50da3a){while(--_0x50da3a){_0x2421d4['push'](_0x2421d4['shift']());}};_0xe9a944(++_0xcbbd7a);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x26c3('0x0'));exports[_0x26c3('0x1')]=function(_0x3049a5){return client[_0x26c3('0x2')](_0x26c3('0x3'),{'body':_0x3049a5,'log':_0x26c3('0x3')});};exports[_0x26c3('0x4')]=function(_0x321cc5,_0x36528a){return client['Request'](_0x26c3('0x5'),{'body':_0x36528a,'options':{'where':{'uniqueid':_0x321cc5},'order':[['id',_0x26c3('0x6')]],'limit':0x1},'log':_0x26c3('0x5')});}; \ No newline at end of file +var _0xbb95=['DESC','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x3821fd,_0x18f3cf){var _0x1fe403=function(_0x50d983){while(--_0x50d983){_0x3821fd['push'](_0x3821fd['shift']());}};_0x1fe403(++_0x18f3cf);}(_0xbb95,0x7f));var _0x5bb9=function(_0x3cdf76,_0x63322b){_0x3cdf76=_0x3cdf76-0x0;var _0x1f1bdb=_0xbb95[_0x3cdf76];return _0x1f1bdb;};'use strict';var client=require(_0x5bb9('0x0'));exports[_0x5bb9('0x1')]=function(_0x4d775a){return client['Request'](_0x5bb9('0x2'),{'body':_0x4d775a,'log':_0x5bb9('0x2')});};exports['update']=function(_0xbb4ae9,_0x572ef3){return client['Request']('UpdateChatQueueReport',{'body':_0x572ef3,'options':{'where':{'uniqueid':_0xbb4ae9},'order':[['id',_0x5bb9('0x3')]],'limit':0x1},'log':_0x5bb9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6b129d2..ff17613 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x3abbf5,_0x34f19c){var _0x3044b2=function(_0x2c2608){while(--_0x2c2608){_0x3abbf5['push'](_0x3abbf5['shift']());}};_0x3044b2(++_0x34f19c);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x7a54,0x106));var _0x47a5=function(_0x188e2a,_0x942fa){_0x188e2a=_0x188e2a-0x0;var _0x2a4309=_0x7a54[_0x188e2a];return _0x2a4309;};'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 7ce6f4f..e60c115 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 _0x1e2d=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0x1e2d,0xbc));var _0xd1e2=function(_0x4b93e1,_0x24d168){_0x4b93e1=_0x4b93e1-0x0;var _0x5a2ec4=_0x1e2d[_0x4b93e1];return _0x5a2ec4;};'use strict';var client=require(_0xd1e2('0x0'));exports[_0xd1e2('0x1')]=function(_0xe76f5c){return client[_0xd1e2('0x2')](_0xd1e2('0x3'),{'body':_0xe76f5c,'log':_0xd1e2('0x4')});}; \ No newline at end of file +var _0xe26c=['createFaxMessage','../client','create','Request'];(function(_0x3c92fc,_0xd4d345){var _0x3f966d=function(_0x2db179){while(--_0x2db179){_0x3c92fc['push'](_0x3c92fc['shift']());}};_0x3f966d(++_0xd4d345);}(_0xe26c,0xf5));var _0xce26=function(_0x23799e,_0x53d979){_0x23799e=_0x23799e-0x0;var _0x4353cd=_0xe26c[_0x23799e];return _0x4353cd;};'use strict';var client=require(_0xce26('0x0'));exports[_0xce26('0x1')]=function(_0x1f3357){return client[_0xce26('0x2')]('CreateFaxMessage',{'body':_0x1f3357,'log':_0xce26('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index fc56d7b..2c3944f 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 _0x1300=['User','Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout','strategy'];(function(_0x4f8a8b,_0x33190f){var _0x172a1a=function(_0x36be87){while(--_0x36be87){_0x4f8a8b['push'](_0x4f8a8b['shift']());}};_0x172a1a(++_0x33190f);}(_0x1300,0x126));var _0x0130=function(_0x261aa1,_0x2938fb){_0x261aa1=_0x261aa1-0x0;var _0x50b381=_0x1300[_0x261aa1];return _0x50b381;};'use strict';var client=require(_0x0130('0x0'));exports[_0x0130('0x1')]=function(){return function(){return client['Request'](_0x0130('0x2'),{'options':{'raw':![],'attributes':['id',_0x0130('0x3'),_0x0130('0x4'),_0x0130('0x5')],'include':[{'model':_0x0130('0x6'),'as':_0x0130('0x7'),'attributes':['id',_0x0130('0x3'),_0x0130('0x8'),_0x0130('0x9')]}]},'log':_0x0130('0x1')});};}; \ No newline at end of file +var _0x8061=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','online','faxPause'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8061,0x6c));var _0x1806=function(_0x279859,_0x152bc5){_0x279859=_0x279859-0x0;var _0x585122=_0x8061[_0x279859];return _0x585122;};'use strict';var client=require(_0x1806('0x0'));exports[_0x1806('0x1')]=function(){return function(){return client[_0x1806('0x2')](_0x1806('0x3'),{'options':{'raw':![],'attributes':['id',_0x1806('0x4'),_0x1806('0x5'),_0x1806('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x1806('0x7'),_0x1806('0x8')]}]},'log':_0x1806('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4c19169..b2635b5 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 _0xce11=['../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x932db6,_0x7b4460){var _0x71fe9f=function(_0x1e4f61){while(--_0x1e4f61){_0x932db6['push'](_0x932db6['shift']());}};_0x71fe9f(++_0x7b4460);}(_0xce11,0xe1));var _0x1ce1=function(_0x459c61,_0x45d8b0){_0x459c61=_0x459c61-0x0;var _0x3761c7=_0xce11[_0x459c61];return _0x3761c7;};'use strict';var client=require(_0x1ce1('0x0'));exports['create']=function(_0x26276b){return client[_0x1ce1('0x1')](_0x1ce1('0x2'),{'body':_0x26276b,'log':_0x1ce1('0x2')});};exports[_0x1ce1('0x3')]=function(_0x495300,_0x52e205){return client[_0x1ce1('0x1')](_0x1ce1('0x4'),{'body':_0x52e205,'options':{'where':{'uniqueid':_0x495300},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x5a38=['UpdateFaxQueueReport','DESC','Request','CreateFaxQueueReport','update'];(function(_0x2ebdb8,_0x26dc49){var _0x5c9936=function(_0x29708f){while(--_0x29708f){_0x2ebdb8['push'](_0x2ebdb8['shift']());}};_0x5c9936(++_0x26dc49);}(_0x5a38,0x16a));var _0x85a3=function(_0x2e41fa,_0x362dec){_0x2e41fa=_0x2e41fa-0x0;var _0x7df79=_0x5a38[_0x2e41fa];return _0x7df79;};'use strict';var client=require('../client');exports['create']=function(_0x2dfdac){return client[_0x85a3('0x0')](_0x85a3('0x1'),{'body':_0x2dfdac,'log':_0x85a3('0x1')});};exports[_0x85a3('0x2')]=function(_0x25186b,_0x47bc8e){return client[_0x85a3('0x0')](_0x85a3('0x3'),{'body':_0x47bc8e,'options':{'where':{'uniqueid':_0x25186b},'order':[['id',_0x85a3('0x4')]],'limit':0x1},'log':_0x85a3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 8db44a0..a6b378b 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 _0x766a=['name','../client','getIntervals','Request','GetInterval'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x766a,0xb0));var _0xa766=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x766a[_0x2718c7];return _0x59d89c;};'use strict';var client=require(_0xa766('0x0'));exports[_0xa766('0x1')]=function(){return function(){return client[_0xa766('0x2')](_0xa766('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xa766('0x4'),'interval']}]},'log':_0xa766('0x1')});};}; \ No newline at end of file +var _0xd2f8=['../client','Request','GetInterval','name','Intervals','interval','getIntervals'];(function(_0x4dbc5d,_0x2d0a51){var _0x45b461=function(_0x3e73ab){while(--_0x3e73ab){_0x4dbc5d['push'](_0x4dbc5d['shift']());}};_0x45b461(++_0x2d0a51);}(_0xd2f8,0x188));var _0x8d2f=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0xd2f8[_0x51b1a5];return _0x15c738;};'use strict';var client=require(_0x8d2f('0x0'));exports['getIntervals']=function(){return function(){return client[_0x8d2f('0x1')](_0x8d2f('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8d2f('0x3')],'include':[{'model':'Interval','as':_0x8d2f('0x4'),'attributes':['id','name',_0x8d2f('0x5')]}]},'log':_0x8d2f('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e30ea4c..e824eea 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 _0xb10b=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','Request'];(function(_0x1c6d59,_0x5a22c1){var _0x30316b=function(_0x42ac71){while(--_0x42ac71){_0x1c6d59['push'](_0x1c6d59['shift']());}};_0x30316b(++_0x5a22c1);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e8b77,_0x5d473c){_0x2e8b77=_0x2e8b77-0x0;var _0xe01d2b=_0xb10b[_0x2e8b77];return _0xe01d2b;};'use strict';var client=require(_0xbb10('0x0'));exports['update']=function(_0x390ae2,_0x35bc5f){return client[_0xbb10('0x1')]('UpdateMailInteraction',{'body':_0x35bc5f,'options':{'where':{'id':_0x390ae2}},'log':_0xbb10('0x2')});};exports[_0xbb10('0x3')]=function(_0x460981,_0x22320e){return client[_0xbb10('0x1')](_0xbb10('0x4'),{'body':_0x22320e,'options':{'where':{'id':_0x460981}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x958a=['../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3b44e9,_0x1497cd){var _0x2669a5=function(_0x3cad84){while(--_0x3cad84){_0x3b44e9['push'](_0x3b44e9['shift']());}};_0x2669a5(++_0x1497cd);}(_0x958a,0x128));var _0xa958=function(_0x5f21c4,_0x29c4f8){_0x5f21c4=_0x5f21c4-0x0;var _0x5b2223=_0x958a[_0x5f21c4];return _0x5b2223;};'use strict';var client=require(_0xa958('0x0'));exports[_0xa958('0x1')]=function(_0x519e66,_0x44a925){return client[_0xa958('0x2')](_0xa958('0x3'),{'body':_0x44a925,'options':{'where':{'id':_0x519e66}},'log':_0xa958('0x4')});};exports[_0xa958('0x5')]=function(_0x5194f8,_0x3424b0){return client['Request'](_0xa958('0x6'),{'body':_0x3424b0,'options':{'where':{'id':_0x5194f8}},'log':_0xa958('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5e417da..0720d9b 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 _0x9c53=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x4abd36,_0x2895e6){var _0x2473e9=function(_0x2c2237){while(--_0x2c2237){_0x4abd36['push'](_0x4abd36['shift']());}};_0x2473e9(++_0x2895e6);}(_0x9c53,0x1ad));var _0x39c5=function(_0x1f6a96,_0x338440){_0x1f6a96=_0x1f6a96-0x0;var _0x37f71d=_0x9c53[_0x1f6a96];return _0x37f71d;};'use strict';var client=require(_0x39c5('0x0'));exports[_0x39c5('0x1')]=function(_0x5db25c){return client[_0x39c5('0x2')](_0x39c5('0x3'),{'body':_0x5db25c,'log':_0x39c5('0x4')});}; \ No newline at end of file +var _0x076e=['../client','create','Request'];(function(_0x23a749,_0x2af650){var _0x7896cb=function(_0x5d2e83){while(--_0x5d2e83){_0x23a749['push'](_0x23a749['shift']());}};_0x7896cb(++_0x2af650);}(_0x076e,0x1e3));var _0xe076=function(_0x2b6e7c,_0xdb7ac4){_0x2b6e7c=_0x2b6e7c-0x0;var _0x29b018=_0x076e[_0x2b6e7c];return _0x29b018;};'use strict';var client=require(_0xe076('0x0'));exports[_0xe076('0x1')]=function(_0xb73560){return client[_0xe076('0x2')]('CreateMailMessage',{'body':_0xb73560,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7e860cd..e38e842 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 _0x5fad=['Agents','online','mailPause','getMailQueues','../client','Request','name','timeout','strategy','User'];(function(_0x330584,_0x4f3687){var _0x42bf51=function(_0x2eb3f0){while(--_0x2eb3f0){_0x330584['push'](_0x330584['shift']());}};_0x42bf51(++_0x4f3687);}(_0x5fad,0x9a));var _0xd5fa=function(_0x4fc11a,_0x2340e2){_0x4fc11a=_0x4fc11a-0x0;var _0x301d6a=_0x5fad[_0x4fc11a];return _0x301d6a;};'use strict';var client=require(_0xd5fa('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xd5fa('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xd5fa('0x2'),_0xd5fa('0x3'),_0xd5fa('0x4')],'include':[{'model':_0xd5fa('0x5'),'as':_0xd5fa('0x6'),'attributes':['id',_0xd5fa('0x2'),_0xd5fa('0x7'),_0xd5fa('0x8')]}]},'log':_0xd5fa('0x9')});};}; \ No newline at end of file +var _0x3aab=['User','Agents','mailPause','../client','name','strategy'];(function(_0x5abb8b,_0x52f49a){var _0x2e1a1d=function(_0x436aa4){while(--_0x436aa4){_0x5abb8b['push'](_0x5abb8b['shift']());}};_0x2e1a1d(++_0x52f49a);}(_0x3aab,0xff));var _0xb3aa=function(_0x49c9e8,_0x28461b){_0x49c9e8=_0x49c9e8-0x0;var _0x19d034=_0x3aab[_0x49c9e8];return _0x19d034;};'use strict';var client=require(_0xb3aa('0x0'));exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xb3aa('0x1'),'timeout',_0xb3aa('0x2')],'include':[{'model':_0xb3aa('0x3'),'as':_0xb3aa('0x4'),'attributes':['id',_0xb3aa('0x1'),'online',_0xb3aa('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 877c107..d9f1c16 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 _0x050e=['UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport','update'];(function(_0x431a2c,_0x41b4d4){var _0x2e35b9=function(_0x106798){while(--_0x106798){_0x431a2c['push'](_0x431a2c['shift']());}};_0x2e35b9(++_0x41b4d4);}(_0x050e,0x1e2));var _0xe050=function(_0x1538db,_0x380120){_0x1538db=_0x1538db-0x0;var _0x46da9c=_0x050e[_0x1538db];return _0x46da9c;};'use strict';var client=require(_0xe050('0x0'));exports['create']=function(_0x670da0){return client[_0xe050('0x1')]('CreateMailQueueReport',{'body':_0x670da0,'log':_0xe050('0x2')});};exports[_0xe050('0x3')]=function(_0x787916,_0x84b824){return client[_0xe050('0x1')](_0xe050('0x4'),{'body':_0x84b824,'options':{'where':{'uniqueid':_0x787916},'order':[['id',_0xe050('0x5')]],'limit':0x1},'log':_0xe050('0x4')});}; \ No newline at end of file +var _0x2a7a=['UpdateMailQueueReport','Request','CreateMailQueueReport','update'];(function(_0x3c3ef4,_0x289eb0){var _0x2f408e=function(_0x24f86c){while(--_0x24f86c){_0x3c3ef4['push'](_0x3c3ef4['shift']());}};_0x2f408e(++_0x289eb0);}(_0x2a7a,0x19d));var _0xa2a7=function(_0x10da85,_0x12ad1f){_0x10da85=_0x10da85-0x0;var _0x5cbf33=_0x2a7a[_0x10da85];return _0x5cbf33;};'use strict';var client=require('../client');exports['create']=function(_0x546b69){return client[_0xa2a7('0x0')](_0xa2a7('0x1'),{'body':_0x546b69,'log':_0xa2a7('0x1')});};exports[_0xa2a7('0x2')]=function(_0x2be6cf,_0x534014){return client[_0xa2a7('0x0')](_0xa2a7('0x3'),{'body':_0x534014,'options':{'where':{'uniqueid':_0x2be6cf},'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 c256f2f..c488c39 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 _0xba38=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0xba38,0xb3));var _0x8ba3=function(_0x365d30,_0x11d372){_0x365d30=_0x365d30-0x0;var _0x5f27b3=_0xba38[_0x365d30];return _0x5f27b3;};'use strict';var client=require(_0x8ba3('0x0'));exports[_0x8ba3('0x1')]=function(_0x5eee74,_0x5bc1fc){return client[_0x8ba3('0x2')]('UpdateOpenchannelInteraction',{'body':_0x5bc1fc,'options':{'where':{'id':_0x5eee74}},'log':_0x8ba3('0x3')});};exports[_0x8ba3('0x4')]=function(_0x1253e8,_0x3a574b){return client[_0x8ba3('0x2')](_0x8ba3('0x5'),{'body':_0x3a574b,'options':{'where':{'id':_0x1253e8}},'log':_0x8ba3('0x6')});}; \ No newline at end of file +var _0xb508=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','../client','update','Request'];(function(_0x32a891,_0x12ca2b){var _0x52e918=function(_0x3790c3){while(--_0x3790c3){_0x32a891['push'](_0x32a891['shift']());}};_0x52e918(++_0x12ca2b);}(_0xb508,0x123));var _0x8b50=function(_0x2e5fb9,_0xe7159e){_0x2e5fb9=_0x2e5fb9-0x0;var _0x3c48c5=_0xb508[_0x2e5fb9];return _0x3c48c5;};'use strict';var client=require(_0x8b50('0x0'));exports[_0x8b50('0x1')]=function(_0x283d75,_0x1eba6d){return client[_0x8b50('0x2')](_0x8b50('0x3'),{'body':_0x1eba6d,'options':{'where':{'id':_0x283d75}},'log':_0x8b50('0x4')});};exports[_0x8b50('0x5')]=function(_0x1c1866,_0x463e38){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x463e38,'options':{'where':{'id':_0x1c1866}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4511d83..94d4b64 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 _0x0e8f=['Request'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0e8f,0x128));var _0xf0e8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x0e8f[_0x24f31b];return _0x488401;};'use strict';var client=require('../client');exports['create']=function(_0x427da6){return client[_0xf0e8('0x0')]('CreateOpenchannelMessage',{'body':_0x427da6,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xb215=['create','createOpenchannelMessage','../client'];(function(_0x3f218c,_0x27c265){var _0x5514d4=function(_0x2dfc00){while(--_0x2dfc00){_0x3f218c['push'](_0x3f218c['shift']());}};_0x5514d4(++_0x27c265);}(_0xb215,0xe0));var _0x5b21=function(_0x3abbcb,_0x31d39a){_0x3abbcb=_0x3abbcb-0x0;var _0x3e67fe=_0xb215[_0x3abbcb];return _0x3e67fe;};'use strict';var client=require(_0x5b21('0x0'));exports[_0x5b21('0x1')]=function(_0x59da56){return client['Request']('CreateOpenchannelMessage',{'body':_0x59da56,'log':_0x5b21('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c95e659..185cc5e 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 _0x5f89=['getOpenchannelQueues','../client','Request','strategy','Agents','name','openchannelPause'];(function(_0x480bbd,_0x2a2f7b){var _0x2e36de=function(_0x192b44){while(--_0x192b44){_0x480bbd['push'](_0x480bbd['shift']());}};_0x2e36de(++_0x2a2f7b);}(_0x5f89,0xc5));var _0x95f8=function(_0x3fd1e3,_0x16ba0d){_0x3fd1e3=_0x3fd1e3-0x0;var _0x116e2e=_0x5f89[_0x3fd1e3];return _0x116e2e;};'use strict';var client=require(_0x95f8('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x95f8('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x95f8('0x2')],'include':[{'model':'User','as':_0x95f8('0x3'),'attributes':['id',_0x95f8('0x4'),'online',_0x95f8('0x5')]}]},'log':_0x95f8('0x6')});};}; \ No newline at end of file +var _0x5e61=['online','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x5e61,0xe2));var _0x15e6=function(_0x954037,_0x402ca0){_0x954037=_0x954037-0x0;var _0xa66b0d=_0x5e61[_0x954037];return _0xa66b0d;};'use strict';var client=require(_0x15e6('0x0'));exports[_0x15e6('0x1')]=function(){return function(){return client['Request'](_0x15e6('0x2'),{'options':{'raw':![],'attributes':['id',_0x15e6('0x3'),_0x15e6('0x4'),_0x15e6('0x5')],'include':[{'model':_0x15e6('0x6'),'as':_0x15e6('0x7'),'attributes':['id',_0x15e6('0x3'),_0x15e6('0x8'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 14e51f5..b46852e 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 _0xd30a=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xd30a,0x19d));var _0xad30=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd30a[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0xad30('0x0'));exports['create']=function(_0x4185fc){return client[_0xad30('0x1')]('CreateOpenchannelQueueReport',{'body':_0x4185fc,'log':_0xad30('0x2')});};exports[_0xad30('0x3')]=function(_0xd50b07,_0x2d33da){return client[_0xad30('0x1')](_0xad30('0x4'),{'body':_0x2d33da,'options':{'where':{'uniqueid':_0xd50b07},'order':[['id',_0xad30('0x5')]],'limit':0x1},'log':_0xad30('0x4')});}; \ No newline at end of file +var _0x49d7=['DESC','UpdateOpenchannelQueueReport','../client','CreateOpenchannelQueueReport','update','Request'];(function(_0xe6dbac,_0x3eded2){var _0xb8081a=function(_0x2189b0){while(--_0x2189b0){_0xe6dbac['push'](_0xe6dbac['shift']());}};_0xb8081a(++_0x3eded2);}(_0x49d7,0xfe));var _0x749d=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x49d7[_0x1488cd];return _0x63fa13;};'use strict';var client=require(_0x749d('0x0'));exports['create']=function(_0x5a7b0d){return client['Request'](_0x749d('0x1'),{'body':_0x5a7b0d,'log':'CreateOpenchannelQueueReport'});};exports[_0x749d('0x2')]=function(_0x348262,_0x1981ac){return client[_0x749d('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x1981ac,'options':{'where':{'uniqueid':_0x348262},'order':[['id',_0x749d('0x4')]],'limit':0x1},'log':_0x749d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e1b06f4..455332a 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 _0x29d4=['updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x329dfd,_0x5eb9b6){var _0x4f4bf1=function(_0x284c1c){while(--_0x284c1c){_0x329dfd['push'](_0x329dfd['shift']());}};_0x4f4bf1(++_0x5eb9b6);}(_0x29d4,0x1a1));var _0x429d=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x29d4[_0x134c2e];return _0x2825db;};'use strict';var client=require(_0x429d('0x0'));exports['update']=function(_0x17f867,_0x40881e){return client[_0x429d('0x1')](_0x429d('0x2'),{'body':_0x40881e,'options':{'where':{'id':_0x17f867}},'log':_0x429d('0x3')});};exports['addTags']=function(_0xc3989d,_0x3f43f5){return client[_0x429d('0x1')](_0x429d('0x4'),{'body':_0x3f43f5,'options':{'where':{'id':_0xc3989d}},'log':_0x429d('0x5')});}; \ No newline at end of file +var _0x7da7=['update','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7da7,0x10d));var _0x77da=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0x7da7[_0x5b3b9b];return _0x47c1d7;};'use strict';var client=require(_0x77da('0x0'));exports[_0x77da('0x1')]=function(_0x16ad6e,_0x571213){return client['Request'](_0x77da('0x2'),{'body':_0x571213,'options':{'where':{'id':_0x16ad6e}},'log':_0x77da('0x3')});};exports['addTags']=function(_0x3a9fa6,_0x37b3d9){return client['Request'](_0x77da('0x4'),{'body':_0x37b3d9,'options':{'where':{'id':_0x3a9fa6}},'log':_0x77da('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 63f8084..15104e5 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 _0x026c=['Request'];(function(_0x7a167c,_0xe0288f){var _0x43a4d0=function(_0x34a341){while(--_0x34a341){_0x7a167c['push'](_0x7a167c['shift']());}};_0x43a4d0(++_0xe0288f);}(_0x026c,0x7b));var _0xc026=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x026c[_0x2300f2];return _0x6bd508;};'use strict';var client=require('../client');exports['create']=function(_0x2e0ec8){return client[_0xc026('0x0')]('CreateSmsMessage',{'body':_0x2e0ec8,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xc9f7=['../client','create','Request','createSmsMessage'];(function(_0x461c98,_0x55573f){var _0x32d371=function(_0x158d21){while(--_0x158d21){_0x461c98['push'](_0x461c98['shift']());}};_0x32d371(++_0x55573f);}(_0xc9f7,0x84));var _0x7c9f=function(_0x2eb8d1,_0x22ca37){_0x2eb8d1=_0x2eb8d1-0x0;var _0x52102b=_0xc9f7[_0x2eb8d1];return _0x52102b;};'use strict';var client=require(_0x7c9f('0x0'));exports[_0x7c9f('0x1')]=function(_0x345d3f){return client[_0x7c9f('0x2')]('CreateSmsMessage',{'body':_0x345d3f,'log':_0x7c9f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 23507e1..d1733c5 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x566fe3,_0x2ce535){var _0x28efa0=function(_0x1b894a){while(--_0x1b894a){_0x566fe3['push'](_0x566fe3['shift']());}};_0x28efa0(++_0x2ce535);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0xe8c80b,_0x4e852f){var _0x250ae0=function(_0x25ed4f){while(--_0x25ed4f){_0xe8c80b['push'](_0xe8c80b['shift']());}};_0x250ae0(++_0x4e852f);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1bc14af..59c6bde 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0xedd9,0xfc));var _0x9edd=function(_0x233b3a,_0x5f4ad9){_0x233b3a=_0x233b3a-0x0;var _0x109870=_0xedd9[_0x233b3a];return _0x109870;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x29379e,_0x34f678){var _0xd938f2=function(_0x1700b3){while(--_0x1700b3){_0x29379e['push'](_0x29379e['shift']());}};_0xd938f2(++_0x34f678);}(_0x55ca,0x126));var _0xa55c=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0x55ca[_0x578275];return _0xf78041;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 9e4f513..02aadb2 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(_0x54224d,_0x1d546f){var _0x2f18dc=function(_0x1c9c67){while(--_0x1c9c67){_0x54224d['push'](_0x54224d['shift']());}};_0x2f18dc(++_0x1d546f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x452a52,_0x5aba2a){var _0x39cd0e=function(_0x40ce7f){while(--_0x40ce7f){_0x452a52['push'](_0x452a52['shift']());}};_0x39cd0e(++_0x5aba2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 1b809d1..8905e5f 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 _0x96fd=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','updateWhatsappInteraction'];(function(_0x3c7815,_0x44264a){var _0x3a23fc=function(_0x3a6782){while(--_0x3a6782){_0x3c7815['push'](_0x3c7815['shift']());}};_0x3a23fc(++_0x44264a);}(_0x96fd,0x1e9));var _0xd96f=function(_0x3c64d7,_0x56c799){_0x3c64d7=_0x3c64d7-0x0;var _0x55c201=_0x96fd[_0x3c64d7];return _0x55c201;};'use strict';var client=require('../client');exports[_0xd96f('0x0')]=function(_0x5334c3,_0x2022bf){return client[_0xd96f('0x1')]('UpdateWhatsappInteraction',{'body':_0x2022bf,'options':{'where':{'id':_0x5334c3}},'log':_0xd96f('0x2')});};exports[_0xd96f('0x3')]=function(_0x44f63c,_0x22b39b){return client['Request'](_0xd96f('0x4'),{'body':_0x22b39b,'options':{'where':{'id':_0x44f63c}},'log':_0xd96f('0x5')});}; \ No newline at end of file +var _0xd9ef=['update','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x553d9b,_0x53892c){var _0x1ecca4=function(_0x57a321){while(--_0x57a321){_0x553d9b['push'](_0x553d9b['shift']());}};_0x1ecca4(++_0x53892c);}(_0xd9ef,0x95));var _0xfd9e=function(_0x24769d,_0x125031){_0x24769d=_0x24769d-0x0;var _0x5b38eb=_0xd9ef[_0x24769d];return _0x5b38eb;};'use strict';var client=require(_0xfd9e('0x0'));exports[_0xfd9e('0x1')]=function(_0x4acfe1,_0x1e4dfc){return client['Request']('UpdateWhatsappInteraction',{'body':_0x1e4dfc,'options':{'where':{'id':_0x4acfe1}},'log':'updateWhatsappInteraction'});};exports[_0xfd9e('0x2')]=function(_0x28cfac,_0xe6990b){return client[_0xfd9e('0x3')](_0xfd9e('0x4'),{'body':_0xe6990b,'options':{'where':{'id':_0x28cfac}},'log':_0xfd9e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d6498a3..90cb8f8 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 _0x2117=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x2117,0x13d));var _0x7211=function(_0x493349,_0x5c0750){_0x493349=_0x493349-0x0;var _0xa196ab=_0x2117[_0x493349];return _0xa196ab;};'use strict';var client=require(_0x7211('0x0'));exports[_0x7211('0x1')]=function(_0x328a90){return client[_0x7211('0x2')](_0x7211('0x3'),{'body':_0x328a90,'log':_0x7211('0x4')});}; \ No newline at end of file +var _0x583b=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x583b,0x193));var _0xb583=function(_0x325821,_0x294d91){_0x325821=_0x325821-0x0;var _0xcf8dad=_0x583b[_0x325821];return _0xcf8dad;};'use strict';var client=require('../client');exports[_0xb583('0x0')]=function(_0x4a6002){return client[_0xb583('0x1')](_0xb583('0x2'),{'body':_0x4a6002,'log':_0xb583('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 21cfadb..72f7f40 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 _0x8506=['name','timeout','strategy','Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue'];(function(_0x3876f8,_0x3f493b){var _0x2c7529=function(_0x24e3dc){while(--_0x24e3dc){_0x3876f8['push'](_0x3876f8['shift']());}};_0x2c7529(++_0x3f493b);}(_0x8506,0x196));var _0x6850=function(_0x211079,_0x1fe139){_0x211079=_0x211079-0x0;var _0x312183=_0x8506[_0x211079];return _0x312183;};'use strict';var client=require('../client');exports[_0x6850('0x0')]=function(){return function(){return client['Request'](_0x6850('0x1'),{'options':{'raw':![],'attributes':['id',_0x6850('0x2'),_0x6850('0x3'),_0x6850('0x4')],'include':[{'model':'User','as':_0x6850('0x5'),'attributes':['id',_0x6850('0x2'),_0x6850('0x6'),_0x6850('0x7')]}]},'log':_0x6850('0x0')});};}; \ No newline at end of file +var _0x4862=['Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','whatsappPause','getWhatsappQueues','../client'];(function(_0x573610,_0x49d5eb){var _0x20a814=function(_0x216d55){while(--_0x216d55){_0x573610['push'](_0x573610['shift']());}};_0x20a814(++_0x49d5eb);}(_0x4862,0x167));var _0x2486=function(_0x16513a,_0x1b528b){_0x16513a=_0x16513a-0x0;var _0x3cbce7=_0x4862[_0x16513a];return _0x3cbce7;};'use strict';var client=require(_0x2486('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x2486('0x1')](_0x2486('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x2486('0x3'),_0x2486('0x4')],'include':[{'model':_0x2486('0x5'),'as':_0x2486('0x6'),'attributes':['id',_0x2486('0x7'),'online',_0x2486('0x8')]}]},'log':_0x2486('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 373b842..55e2bed 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 _0xa1cd=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update','DESC'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xa1cd,0x163));var _0xda1c=function(_0x2c35db,_0x27c434){_0x2c35db=_0x2c35db-0x0;var _0x23aaf4=_0xa1cd[_0x2c35db];return _0x23aaf4;};'use strict';var client=require(_0xda1c('0x0'));exports['create']=function(_0xca12f6){return client[_0xda1c('0x1')]('CreateWhatsappQueueReport',{'body':_0xca12f6,'log':_0xda1c('0x2')});};exports[_0xda1c('0x3')]=function(_0xd0d60,_0x2f739c){return client[_0xda1c('0x1')]('UpdateWhatsappQueueReport',{'body':_0x2f739c,'options':{'where':{'uniqueid':_0xd0d60},'order':[['id',_0xda1c('0x4')]],'limit':0x1},'log':_0xda1c('0x5')});}; \ No newline at end of file +var _0xb1e1=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x21c915,_0x423744){var _0x252fdc=function(_0x2df6cb){while(--_0x2df6cb){_0x21c915['push'](_0x21c915['shift']());}};_0x252fdc(++_0x423744);}(_0xb1e1,0xb4));var _0x1b1e=function(_0x33a85d,_0x4a1ad3){_0x33a85d=_0x33a85d-0x0;var _0x311446=_0xb1e1[_0x33a85d];return _0x311446;};'use strict';var client=require(_0x1b1e('0x0'));exports[_0x1b1e('0x1')]=function(_0x5261fb){return client[_0x1b1e('0x2')](_0x1b1e('0x3'),{'body':_0x5261fb,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x1a4823,_0x5aaf2a){return client['Request'](_0x1b1e('0x4'),{'body':_0x5aaf2a,'options':{'where':{'uniqueid':_0x1a4823},'order':[['id',_0x1b1e('0x5')]],'limit':0x1},'log':_0x1b1e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 0a85af0..d5f5224 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 _0xfe72=['length','error','message','join','find','agents','timeout','createQueue','atimeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][QUEUE]\x20%s','stack','validate','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','name','toLowerCase','consequence'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xfe72,0xba));var _0x2fe7=function(_0x512178,_0x276e75){_0x512178=_0x512178-0x0;var _0x5ee98f=_0xfe72[_0x512178];return _0x5ee98f;};'use strict';var schema=require(_0x2fe7('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x2fe7('0x1'));var logger=require(_0x2fe7('0x2'))(_0x2fe7('0x3'));var strategy=require(_0x2fe7('0x4'));var queue=schema({'name':{'type':_0x2fe7('0x5'),'required':!![],'message':_0x2fe7('0x6')},'timeout':{'type':_0x2fe7('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2f2acc,_0x331eb5,_0x553ef0){return logger['info'](util[_0x2fe7('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2f2acc,_0x331eb5[_0x2fe7('0x9')],_0x553ef0));}function handleFindAgent(_0x4cedf8){return function(_0x34648d){return _0x34648d[_0x2fe7('0x9')][_0x2fe7('0xa')]()===_0x4cedf8[_0x2fe7('0xa')]();};}exports[_0x2fe7('0xb')]=function(_0x38939a,_0x28f4f2,_0x3b9c2e,_0xd1da3){return function(_0x24e865){try{var _0x278058={'name':_0x28f4f2[0x0],'timeout':_0x28f4f2[0x1]};var _0xf1eaf7=queue[_0x2fe7('0x0')](_0x278058,{'typecast':!![]});if(_0xf1eaf7[_0x2fe7('0xc')]){logger[_0x2fe7('0xd')]('[%s][AGENT]\x20%s',_0x38939a,_['map'](_0xf1eaf7,_0x2fe7('0xe'))[_0x2fe7('0xf')](',\x20'));_0x24e865['stop']();}else{var _0x1423f3=_[_0x2fe7('0x10')](_0x3b9c2e[_0x2fe7('0x11')],handleFindAgent(_0x278058[_0x2fe7('0x9')]));if(_0x1423f3){var _0x45eb12=(_0x278058[_0x2fe7('0x12')]||0xa)*0x3e8;var _0x1d3f85,_0x4df0bd;var _0xec2e5=seqqueue[_0x2fe7('0x13')](_0x45eb12);_0xec2e5['id']=_0x38939a;_0xec2e5[_0x2fe7('0x14')]=_0x45eb12;_0xec2e5[_0x2fe7('0x15')]=_0xd1da3['channel'];writeLog(_0x38939a,_0x1423f3,util['format']('START:%s',_0x45eb12));_0x3b9c2e[_0x2fe7('0x16')][_0x38939a]['on'](_0x2fe7('0x17'),function(){logger[_0x2fe7('0x18')](_0x2fe7('0x19'),_0x38939a);clearTimeout(_0x4df0bd);_0x4df0bd=undefined;_0xec2e5[_0x2fe7('0x1a')]();if(_0x3b9c2e[_0x2fe7('0x16')][_0x38939a]){delete _0x3b9c2e[_0x2fe7('0x16')][_0x38939a];}_0x24e865['stop']();});_0x3b9c2e['rules'][_0x38939a]['on'](_0x2fe7('0x1b'),function(){if(_0x3b9c2e[_0x2fe7('0x16')][_0x38939a]){delete _0x3b9c2e[_0x2fe7('0x16')][_0x38939a];}});_0x4df0bd=setTimeout(function(){logger[_0x2fe7('0x18')](_0x2fe7('0x1c'),_0x38939a);clearTimeout(_0x4df0bd);_0xec2e5[_0x2fe7('0x1a')]();_0x24e865[_0x2fe7('0x1d')]();},_0x45eb12);strategy[_0x2fe7('0x1e')](_0xec2e5,_0x1423f3,_0x3b9c2e,_0xd1da3);}else{logger[_0x2fe7('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x38939a,_0x278058[_0x2fe7('0x9')]);_0x24e865['stop']();}}}catch(_0x3ba1c5){console['log'](_0x3ba1c5);logger[_0x2fe7('0xd')](_0x2fe7('0x1f'),_0x38939a,_0x3ba1c5[_0x2fe7('0x20')]);_0x24e865['stop']();}};}; \ No newline at end of file +var _0x4f67=['[%s][QUEUE]\x20%s','lodash','routing','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x4f67,0x16d));var _0x74f6=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x4f67[_0x1aa049];return _0x357f29;};'use strict';var schema=require('validate');var _=require(_0x74f6('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x74f6('0x1'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x74f6('0x2'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x44066a,_0xf2ebaf,_0x4832dc){return logger[_0x74f6('0x3')](util[_0x74f6('0x4')](_0x74f6('0x5'),_0x44066a,_0xf2ebaf[_0x74f6('0x6')],_0x4832dc));}function handleFindAgent(_0x5a9ef9){return function(_0x2a562f){return _0x2a562f[_0x74f6('0x6')][_0x74f6('0x7')]()===_0x5a9ef9[_0x74f6('0x7')]();};}exports[_0x74f6('0x8')]=function(_0x586abc,_0x3fb5d7,_0x32bb68,_0x471bac){return function(_0x5d22ad){try{var _0x51159d={'name':_0x3fb5d7[0x0],'timeout':_0x3fb5d7[0x1]};var _0x5dbaf5=queue[_0x74f6('0x9')](_0x51159d,{'typecast':!![]});if(_0x5dbaf5['length']){logger[_0x74f6('0xa')](_0x74f6('0xb'),_0x586abc,_[_0x74f6('0xc')](_0x5dbaf5,_0x74f6('0xd'))['join'](',\x20'));_0x5d22ad[_0x74f6('0xe')]();}else{var _0xb2328e=_[_0x74f6('0xf')](_0x32bb68[_0x74f6('0x10')],handleFindAgent(_0x51159d[_0x74f6('0x6')]));if(_0xb2328e){var _0x34137f=(_0x51159d['timeout']||0xa)*0x3e8;var _0x212ed4,_0x141293;var _0x3bdf8d=seqqueue['createQueue'](_0x34137f);_0x3bdf8d['id']=_0x586abc;_0x3bdf8d['atimeout']=_0x34137f;_0x3bdf8d[_0x74f6('0x11')]=_0x471bac[_0x74f6('0x11')];writeLog(_0x586abc,_0xb2328e,util['format'](_0x74f6('0x12'),_0x34137f));_0x32bb68['rules'][_0x586abc]['on'](_0x74f6('0x13'),function(){logger['info'](_0x74f6('0x14'),_0x586abc);clearTimeout(_0x141293);_0x141293=undefined;_0x3bdf8d[_0x74f6('0x15')]();if(_0x32bb68[_0x74f6('0x16')][_0x586abc]){delete _0x32bb68[_0x74f6('0x16')][_0x586abc];}_0x5d22ad[_0x74f6('0xe')]();});_0x32bb68['rules'][_0x586abc]['on']('complete',function(){if(_0x32bb68[_0x74f6('0x16')][_0x586abc]){delete _0x32bb68[_0x74f6('0x16')][_0x586abc];}});_0x141293=setTimeout(function(){logger[_0x74f6('0x3')](_0x74f6('0x17'),_0x586abc);clearTimeout(_0x141293);_0x3bdf8d[_0x74f6('0x15')]();_0x5d22ad[_0x74f6('0x18')]();},_0x34137f);strategy[_0x74f6('0x19')](_0x3bdf8d,_0xb2328e,_0x32bb68,_0x471bac);}else{logger['error'](_0x74f6('0x1a'),_0x586abc,_0x51159d[_0x74f6('0x6')]);_0x5d22ad[_0x74f6('0xe')]();}}}catch(_0x448703){console['log'](_0x448703);logger['error'](_0x74f6('0x1b'),_0x586abc,_0x448703['stack']);_0x5d22ad['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 3b29f72..bf7d965 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 _0x09b5=['isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','providerName','amazonlex','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','upperFirst','account','InteractionId','created'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x09b5,0xd9));var _0x509b=function(_0x49017d,_0x524b0e){_0x49017d=_0x49017d-0x0;var _0x558b85=_0x09b5[_0x49017d];return _0x558b85;};'use strict';var _=require(_0x509b('0x0'));var moment=require(_0x509b('0x1'));var AWS=require(_0x509b('0x2'));var utils=require(_0x509b('0x3'));var logger=require(_0x509b('0x4'))('routing');var rpc={'chatMessage':require(_0x509b('0x5')),'openchannelMessage':require(_0x509b('0x6')),'mailMessage':require(_0x509b('0x7')),'smsMessage':require(_0x509b('0x8')),'faxMessage':require(_0x509b('0x9')),'whatsappMessage':require(_0x509b('0xa'))};exports[_0x509b('0xb')]=function(_0x563a23,_0x2e56bb){return function(_0x384201){try{if(!_[_0x509b('0xc')](this[_0x509b('0xd')][_0x509b('0xe')])){logger[_0x509b('0xf')]('[%s][AMAZONLEX]\x20%s',_0x563a23,_0x509b('0x10'));return _0x384201[_0x509b('0x11')]();}var _0x1bfd95={'ContactId':this[_0x509b('0x12')]['id'],'sentAt':moment()['format'](_0x509b('0x13')),'direction':_0x509b('0x14')};if(this[_0x509b('0x15')]===_0x509b('0x16')||this[_0x509b('0x15')]==='whatsapp'){_0x1bfd95[_0x509b('0x17')]=this[_0x509b('0xd')]['phone'];}var _0x24f9f9=this[_0x509b('0x15')];if(_0x24f9f9==='chat'){_0x1bfd95['ChatWebsiteId']=this['account']['id'];}else{_0x1bfd95[_[_0x509b('0x18')](_0x24f9f9)+'AccountId']=this[_0x509b('0x19')]['id'];}_0x1bfd95[_[_0x509b('0x18')](_0x24f9f9)+_0x509b('0x1a')]=this[_0x509b('0xd')]['id'];if(this[_0x509b('0xd')][_0x509b('0x1b')]){var _0xf03ac7=_0x2e56bb[0x4];if(!_[_0x509b('0x1c')](_0xf03ac7)){_0x1bfd95[_0x509b('0x1d')]=utils[_0x509b('0x1e')](_0xf03ac7,this);return rpc[_0x24f9f9+_0x509b('0x1f')][_0x509b('0x20')](_0x1bfd95)[_0x509b('0x21')](function(_0x135e99){logger[_0x509b('0xf')](_0x509b('0x22'),_0x563a23,_0x1bfd95[_0x509b('0x1d')]);})['catch'](function(_0x5ed008){logger[_0x509b('0x23')]('[%s][AMAZONLEX]\x20%s',_0x563a23,JSON[_0x509b('0x24')](_0x5ed008));})['finally'](function(){logger['info'](_0x509b('0x25'),_0x563a23);_0x384201[_0x509b('0x26')]();});}else{logger[_0x509b('0xf')](_0x509b('0x27'),_0x563a23);_0x384201[_0x509b('0x26')]();}}else{var _0x3ef04c=this;var _0x1ea134=new AWS[(_0x509b('0x28'))]({'accessKeyId':_0x2e56bb[0x0],'secretAccessKey':_0x2e56bb[0x1],'region':_0x2e56bb[0x2]});var _0x207947={'botAlias':_0x509b('0x29'),'botName':_0x2e56bb[0x3],'inputText':this[_0x509b('0x2a')][_0x509b('0x1d')],'userId':this[_0x509b('0x15')]+':'+this[_0x509b('0xd')]['id']['toString']()};_0x1ea134[_0x509b('0x2b')](_0x207947,function(_0x2e8cd7,_0x51e3f3){if(_0x2e8cd7){logger[_0x509b('0x23')](_0x509b('0x22'),_0x563a23,_0x2e8cd7[_0x509b('0x2a')]);_0x384201[_0x509b('0x11')]();}else if(_0x51e3f3&&_0x51e3f3[_0x509b('0x2a')]){_0x3ef04c[_0x509b('0x1d')]['amazonlex']=_0x51e3f3;_0x1bfd95[_0x509b('0x1d')]=_0x51e3f3[_0x509b('0x2a')];_0x1bfd95[_0x509b('0x2c')]=_0x509b('0x2d');_0x1bfd95['providerResponse']=JSON[_0x509b('0x24')](_0x51e3f3);return rpc[_0x24f9f9+'Message'][_0x509b('0x20')](_0x1bfd95)['then'](function(_0x18e267){logger[_0x509b('0xf')](_0x509b('0x22'),_0x563a23,_0x1bfd95[_0x509b('0x1d')]);if(_0x51e3f3[_0x509b('0x2e')]==_0x509b('0x2f')){_0x384201[_0x509b('0x11')]();}else{_0x384201[_0x509b('0x26')]();}})[_0x509b('0x30')](function(_0x52ae7e){logger[_0x509b('0x23')](_0x509b('0x22'),_0x563a23,JSON[_0x509b('0x24')](_0x52ae7e));_0x384201[_0x509b('0x11')]();});}else{_0x384201[_0x509b('0x11')]();}});}}catch(_0x44d41e){logger[_0x509b('0x23')](_0x509b('0x22'),_0x563a23,JSON['stringify'](_0x44d41e));_0x384201['stop']();}};}; \ No newline at end of file +var _0xd0ed=['dialogState','Failed','catch','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','then','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','create'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0xd0ed,0x1ed));var _0xdd0e=function(_0x242117,_0x505596){_0x242117=_0x242117-0x0;var _0x51e9df=_0xd0ed[_0x242117];return _0x51e9df;};'use strict';var _=require(_0xdd0e('0x0'));var moment=require('moment');var AWS=require(_0xdd0e('0x1'));var utils=require(_0xdd0e('0x2'));var logger=require(_0xdd0e('0x3'))(_0xdd0e('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdd0e('0x5')),'smsMessage':require(_0xdd0e('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xdd0e('0x7'))};exports[_0xdd0e('0x8')]=function(_0x4c7eaa,_0x526652){return function(_0x2c6eda){try{if(!_[_0xdd0e('0x9')](this[_0xdd0e('0xa')][_0xdd0e('0xb')])){logger[_0xdd0e('0xc')](_0xdd0e('0xd'),_0x4c7eaa,_0xdd0e('0xe'));return _0x2c6eda[_0xdd0e('0xf')]();}var _0x31fe9d={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdd0e('0x10')](_0xdd0e('0x11')),'direction':_0xdd0e('0x12')};if(this[_0xdd0e('0x13')]===_0xdd0e('0x14')||this[_0xdd0e('0x13')]===_0xdd0e('0x15')){_0x31fe9d[_0xdd0e('0x16')]=this[_0xdd0e('0xa')][_0xdd0e('0x16')];}var _0x1bfef1=this['channel'];if(_0x1bfef1===_0xdd0e('0x17')){_0x31fe9d[_0xdd0e('0x18')]=this[_0xdd0e('0x19')]['id'];}else{_0x31fe9d[_[_0xdd0e('0x1a')](_0x1bfef1)+_0xdd0e('0x1b')]=this[_0xdd0e('0x19')]['id'];}_0x31fe9d[_[_0xdd0e('0x1a')](_0x1bfef1)+_0xdd0e('0x1c')]=this[_0xdd0e('0xa')]['id'];if(this[_0xdd0e('0xa')]['created']){var _0x16b5ea=_0x526652[0x4];if(!_[_0xdd0e('0x1d')](_0x16b5ea)){_0x31fe9d[_0xdd0e('0x1e')]=utils[_0xdd0e('0x1f')](_0x16b5ea,this);return rpc[_0x1bfef1+_0xdd0e('0x20')]['create'](_0x31fe9d)[_0xdd0e('0x21')](function(_0x540e20){logger[_0xdd0e('0xc')](_0xdd0e('0xd'),_0x4c7eaa,_0x31fe9d[_0xdd0e('0x1e')]);})['catch'](function(_0x25d1c5){logger[_0xdd0e('0x22')](_0xdd0e('0xd'),_0x4c7eaa,JSON[_0xdd0e('0x23')](_0x25d1c5));})['finally'](function(){logger[_0xdd0e('0xc')](_0xdd0e('0x24'),_0x4c7eaa);_0x2c6eda[_0xdd0e('0x25')]();});}else{logger[_0xdd0e('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4c7eaa);_0x2c6eda['stop']();}}else{var _0x4448ce=this;var _0x36f94b=new AWS['LexRuntime']({'accessKeyId':_0x526652[0x0],'secretAccessKey':_0x526652[0x1],'region':_0x526652[0x2]});var _0x5bd5ce={'botAlias':_0xdd0e('0x26'),'botName':_0x526652[0x3],'inputText':this[_0xdd0e('0x27')][_0xdd0e('0x1e')],'userId':this[_0xdd0e('0x13')]+':'+this[_0xdd0e('0xa')]['id'][_0xdd0e('0x28')]()};_0x36f94b[_0xdd0e('0x29')](_0x5bd5ce,function(_0x43ad64,_0xb79c99){if(_0x43ad64){logger[_0xdd0e('0x22')]('[%s][AMAZONLEX]\x20%s',_0x4c7eaa,_0x43ad64['message']);_0x2c6eda[_0xdd0e('0xf')]();}else if(_0xb79c99&&_0xb79c99['message']){_0x4448ce[_0xdd0e('0x1e')][_0xdd0e('0x2a')]=_0xb79c99;_0x31fe9d[_0xdd0e('0x1e')]=_0xb79c99[_0xdd0e('0x27')];_0x31fe9d[_0xdd0e('0x2b')]='amazonlex';_0x31fe9d[_0xdd0e('0x2c')]=JSON[_0xdd0e('0x23')](_0xb79c99);return rpc[_0x1bfef1+'Message'][_0xdd0e('0x2d')](_0x31fe9d)[_0xdd0e('0x21')](function(_0x1ae606){logger[_0xdd0e('0xc')](_0xdd0e('0xd'),_0x4c7eaa,_0x31fe9d[_0xdd0e('0x1e')]);if(_0xb79c99[_0xdd0e('0x2e')]==_0xdd0e('0x2f')){_0x2c6eda[_0xdd0e('0xf')]();}else{_0x2c6eda[_0xdd0e('0x25')]();}})[_0xdd0e('0x30')](function(_0x4045cb){logger[_0xdd0e('0x22')](_0xdd0e('0xd'),_0x4c7eaa,JSON[_0xdd0e('0x23')](_0x4045cb));_0x2c6eda[_0xdd0e('0xf')]();});}else{_0x2c6eda['next']();}});}}catch(_0x129219){logger[_0xdd0e('0x22')](_0xdd0e('0xd'),_0x4c7eaa,JSON[_0xdd0e('0x23')](_0x129219));_0x2c6eda[_0xdd0e('0x25')]();}};}; \ 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 06340a4..dc8a49f 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 _0x4056=['auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','info','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','phone','read','subject','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','','replace','','headers','auto-replied','All'];(function(_0x5100de,_0x5cb9c2){var _0x4841fb=function(_0x228c32){while(--_0x228c32){_0x5100de['push'](_0x5100de['shift']());}};_0x4841fb(++_0x5cb9c2);}(_0x4056,0x153));var _0x6405=function(_0xaef5ea,_0x3768b8){_0xaef5ea=_0xaef5ea-0x0;var _0x2c0a21=_0x4056[_0xaef5ea];return _0x2c0a21;};'use strict';var _=require(_0x6405('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x6405('0x1'));var rpc={'chatMessage':require(_0x6405('0x2')),'openchannelMessage':require(_0x6405('0x3')),'mailMessage':require(_0x6405('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6405('0x5')),'whatsappMessage':require(_0x6405('0x6')),'chatInteraction':require(_0x6405('0x7')),'openchannelInteraction':require(_0x6405('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x6405('0x9')),'faxInteraction':require(_0x6405('0xa')),'whatsappInteraction':require(_0x6405('0xb'))};var mailRpc=require(_0x6405('0xc'));exports['consequence']=function(_0x1ff56a,_0xd17547,_0x51f658,_0xfc54af){return function(_0x345427){try{var _0x4b4198=this[_0x6405('0xd')];if(_0x4b4198===_0x6405('0xe')&&_0xfc54af[_0x6405('0xf')][_0x6405('0x10')]){logger['info'](_0x6405('0x11'),_0x1ff56a,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x345427[_0x6405('0x12')]();}if(_0xd17547[0x0]==='1'&&(_[_0x6405('0x13')](this[_0x6405('0x14')][_0x6405('0x15')])||!this[_0x6405('0x14')][_0x6405('0x15')])){logger[_0x6405('0x16')](_0x6405('0x11'),_0x1ff56a,'Autoreply\x20already\x20sent');return _0x345427[_0x6405('0x12')]();}if(_0xd17547[0x0]==='2'&&this['interaction'][_0x6405('0x17')]){logger[_0x6405('0x16')](_0x6405('0x18'),_0x1ff56a,_0x6405('0x19'));return _0x345427[_0x6405('0x12')]();}var _0x166be1={'ContactId':this[_0x6405('0x1a')]['id'],'sentAt':moment()[_0x6405('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x6405('0xe')){_0x166be1['body']=utils['getMustacheRender'](_0xd17547[0x2],this);}else{_0x166be1[_0x6405('0xf')]=utils[_0x6405('0x1c')](_0xd17547[0x1],this);}if(this[_0x6405('0x1d')]){_0x166be1['to']=this[_0x6405('0x1d')][_0x6405('0x1e')]||'';if(this[_0x6405('0xd')]===_0x6405('0xe')&&_0xd17547[0x1]==='1'){_0x166be1['cc']=this[_0x6405('0x1d')]['cc']||'';}_0x166be1[_0x6405('0x1e')]=this['message']['to']||'';_0x166be1[_0x6405('0x1f')]=this['message']['phone']||'';_0x166be1[_0x6405('0x20')]=!![];if(this['message']['subject']){_0x166be1[_0x6405('0x21')]='';_0x166be1['subject']+=_['startsWith'](this[_0x6405('0x1d')]['subject'],_0x6405('0x22'))?'':'Re:\x20';_0x166be1[_0x6405('0x21')]+=this[_0x6405('0x1d')][_0x6405('0x21')];}}if(this['channel']===_0x6405('0x23')){_0x166be1[_0x6405('0x24')]=this[_0x6405('0x25')]['id'];}else{_0x166be1[_[_0x6405('0x26')](this[_0x6405('0xd')])+_0x6405('0x27')]=this['account']['id'];}_0x166be1[_[_0x6405('0x26')](this[_0x6405('0xd')])+_0x6405('0x28')]=this[_0x6405('0x14')]['id'];var _0x4aaffa=this[_0x6405('0x14')];if(rpc[this['channel']+_0x6405('0x29')]){if(this[_0x6405('0xd')]===_0x6405('0xe')){_0x166be1['inReplyTo']=this[_0x6405('0x1d')][_0x6405('0x2a')];_0x166be1['html']=_0x6405('0x2b')+_[_0x6405('0x2c')](_0x166be1[_0x6405('0xf')],_0x6405('0x2d'),_0x6405('0x2e'))+_0x6405('0x2f');_0x166be1[_0x6405('0x30')]={'Auto-Submitted':_0x6405('0x31'),'X-Auto-Response-Suppress':_0x6405('0x32'),'Precedence':_0x6405('0x33')};return mailRpc['sendMailMessage'](this[_0x6405('0x25')]['smtpOptions'],_0x166be1)[_0x6405('0x34')](function(_0x3f0b80){logger['info'](_0x6405('0x35'),_0x1ff56a);_0x166be1[_0x6405('0x2a')]=_0x3f0b80[_0x6405('0x1d')][_0x6405('0x2a')];return rpc[_0x4b4198+'Message'][_0x6405('0x36')](_0x166be1);})['then'](function(_0x4dbb25){logger[_0x6405('0x16')](_0x6405('0x11'),_0x1ff56a,JSON[_0x6405('0x37')](_0x4dbb25));})[_0x6405('0x38')](function(_0x3d3b25){logger[_0x6405('0x39')](_0x6405('0x3a'),_0x1ff56a,JSON['stringify'](_0x3d3b25));})[_0x6405('0x3b')](function(){Promise[_0x6405('0x3c')]()[_0x6405('0x34')](function(){if(_0xd17547[0x0]!=='2'||_0x4aaffa[_0x6405('0x17')])return;return rpc[_0x4b4198+_0x6405('0x3d')][_0x6405('0x3e')](_0x4aaffa['id'],{'autoreplyExecuted':!![]})['then'](function(_0x14d02b){logger['info'](_0x6405('0x18'),_0x1ff56a,JSON[_0x6405('0x37')](_0x14d02b));})[_0x6405('0x38')](function(_0x28930f){logger[_0x6405('0x39')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1ff56a,JSON['stringify'](_0x28930f));});})[_0x6405('0x34')](function(){_0x345427['next']();});});}else{return rpc[this['channel']+_0x6405('0x29')][_0x6405('0x36')](_0x166be1)[_0x6405('0x34')](function(){logger[_0x6405('0x16')]('[%s][AUTOREPLY]\x20%s',_0x1ff56a,_0x166be1[_0x6405('0xf')]);})[_0x6405('0x38')](function(_0x21712a){logger[_0x6405('0x39')](_0x6405('0x11'),_0x1ff56a,JSON['stringify'](_0x21712a));})[_0x6405('0x3b')](function(){Promise[_0x6405('0x3c')]()[_0x6405('0x34')](function(){if(_0xd17547[0x0]!=='2'||_0x4aaffa[_0x6405('0x17')])return;return rpc[_0x4b4198+_0x6405('0x3d')][_0x6405('0x3e')](_0x4aaffa['id'],{'autoreplyExecuted':!![]})[_0x6405('0x34')](function(_0x12643a){logger[_0x6405('0x16')](_0x6405('0x18'),_0x1ff56a,JSON['stringify'](_0x12643a));})[_0x6405('0x38')](function(_0x398244){logger[_0x6405('0x39')](_0x6405('0x3f'),_0x1ff56a,JSON[_0x6405('0x37')](_0x398244));});})[_0x6405('0x34')](function(){_0x345427[_0x6405('0x12')]();});});}}}catch(_0x68baaf){logger[_0x6405('0x39')](_0x6405('0x11'),_0x1ff56a,JSON[_0x6405('0x37')](_0x68baaf));_0x345427[_0x6405('0x40')]();}};}; \ No newline at end of file +var _0xd85d=['../../rpc/faxInteraction','../../mailRpc','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','created','Autoreply\x20already\x20sent','interaction','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','AccountId','account','InteractionId','Message','inReplyTo','messageId','replace','','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stringify','resolve','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction'];(function(_0x5addf7,_0x50785e){var _0xb0746a=function(_0x2ee32b){while(--_0x2ee32b){_0x5addf7['push'](_0x5addf7['shift']());}};_0xb0746a(++_0x50785e);}(_0xd85d,0xb0));var _0xdd85=function(_0x2607b0,_0x3d2692){_0x2607b0=_0x2607b0-0x0;var _0x3d164e=_0xd85d[_0x2607b0];return _0x3d164e;};'use strict';var _=require(_0xdd85('0x0'));var moment=require(_0xdd85('0x1'));var utils=require(_0xdd85('0x2'));var logger=require(_0xdd85('0x3'))(_0xdd85('0x4'));var rpc={'chatMessage':require(_0xdd85('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdd85('0x6')),'whatsappMessage':require(_0xdd85('0x7')),'chatInteraction':require(_0xdd85('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xdd85('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xdd85('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xdd85('0xb'));exports['consequence']=function(_0x45d2d4,_0x3cafbf,_0x5d947b,_0x11b474){return function(_0x44c7b7){try{var _0x1717eb=this[_0xdd85('0xc')];if(_0x1717eb===_0xdd85('0xd')&&_0x11b474['body'][_0xdd85('0xe')]){logger[_0xdd85('0xf')](_0xdd85('0x10'),_0x45d2d4,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x44c7b7[_0xdd85('0x11')]();}if(_0x3cafbf[0x0]==='1'&&(_[_0xdd85('0x12')](this['interaction'][_0xdd85('0x13')])||!this['interaction'][_0xdd85('0x13')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x45d2d4,_0xdd85('0x14'));return _0x44c7b7[_0xdd85('0x11')]();}if(_0x3cafbf[0x0]==='2'&&this[_0xdd85('0x15')][_0xdd85('0x16')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x45d2d4,_0xdd85('0x17'));return _0x44c7b7[_0xdd85('0x11')]();}var _0x4af57e={'ContactId':this[_0xdd85('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdd85('0x19')};if(this[_0xdd85('0xc')]===_0xdd85('0xd')){_0x4af57e[_0xdd85('0x1a')]=utils[_0xdd85('0x1b')](_0x3cafbf[0x2],this);}else{_0x4af57e['body']=utils['getMustacheRender'](_0x3cafbf[0x1],this);}if(this[_0xdd85('0x1c')]){_0x4af57e['to']=this['message']['from']||'';if(this[_0xdd85('0xc')]===_0xdd85('0xd')&&_0x3cafbf[0x1]==='1'){_0x4af57e['cc']=this['message']['cc']||'';}_0x4af57e[_0xdd85('0x1d')]=this['message']['to']||'';_0x4af57e[_0xdd85('0x1e')]=this['message'][_0xdd85('0x1e')]||'';_0x4af57e[_0xdd85('0x1f')]=!![];if(this[_0xdd85('0x1c')]['subject']){_0x4af57e[_0xdd85('0x20')]='';_0x4af57e[_0xdd85('0x20')]+=_[_0xdd85('0x21')](this['message'][_0xdd85('0x20')],_0xdd85('0x22'))?'':_0xdd85('0x23');_0x4af57e[_0xdd85('0x20')]+=this[_0xdd85('0x1c')][_0xdd85('0x20')];}}if(this[_0xdd85('0xc')]===_0xdd85('0x24')){_0x4af57e['ChatWebsiteId']=this['account']['id'];}else{_0x4af57e[_[_0xdd85('0x25')](this[_0xdd85('0xc')])+_0xdd85('0x26')]=this[_0xdd85('0x27')]['id'];}_0x4af57e[_[_0xdd85('0x25')](this[_0xdd85('0xc')])+_0xdd85('0x28')]=this['interaction']['id'];var _0x139ca0=this[_0xdd85('0x15')];if(rpc[this['channel']+_0xdd85('0x29')]){if(this['channel']===_0xdd85('0xd')){_0x4af57e[_0xdd85('0x2a')]=this[_0xdd85('0x1c')][_0xdd85('0x2b')];_0x4af57e['html']=''+_[_0xdd85('0x2c')](_0x4af57e[_0xdd85('0x1a')],']+(>|$)/g,''),'priorityTrue':_0x372079[0x1],'priorityFalse':_0x372079[0x2]};var _0x47d04b=gotoif[_0x9018('0x0')](_0x2ce180,{'typecast':!![]});if(_0x47d04b[_0x9018('0xa')]){logger[_0x9018('0xb')]('[%s][GOTOIF]\x20%s',_0x10fc08,_[_0x9018('0xc')](_0x47d04b,_0x9018('0xd'))[_0x9018('0xe')](',\x20'));_0x288473[_0x9018('0xf')]();}else{try{var _0xfe0263=eval('('+_0x2ce180[_0x9018('0x10')]+')');var _0x1691c4=_0xfe0263?_0x2ce180[_0x9018('0x11')]:_0x2ce180[_0x9018('0x12')];logger[_0x9018('0x13')](_0x9018('0x14'),_0x10fc08,_0x2ce180[_0x9018('0x10')],_0xfe0263,_0x1691c4||_0x9018('0x15'));if(_0x1691c4){var _0x2857e9=_[_0x9018('0x16')](_0x288473[_0x9018('0x17')](),{'p':_0x1691c4});if(_0x2857e9>=0x0){logger[_0x9018('0x13')](_0x9018('0x18'),_0x10fc08,_0x1691c4||_0x9018('0x15'),_0x2857e9);_0x288473[_0x9018('0x15')](_0x2857e9);}else{logger[_0x9018('0x13')](_0x9018('0x19'),_0x10fc08,_0x1691c4||_0x9018('0x15'));_0x288473[_0x9018('0xf')]();}}else{_0x288473['next']();}}catch(_0x4e8907){logger[_0x9018('0xb')](_0x9018('0x1a'),_0x10fc08,_0x4e8907['message']);_0x288473['stop']();}}}catch(_0x19d20c){logger[_0x9018('0xb')](_0x9018('0x1b'),_0x10fc08,JSON[_0x9018('0x1c')](_0x19d20c));_0x288473[_0x9018('0xf')]();}};}; \ No newline at end of file +var _0xbb3b=['priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x4d1eb5,_0x7eddcc){var _0x5b6ed5=function(_0x1655d3){while(--_0x1655d3){_0x4d1eb5['push'](_0x4d1eb5['shift']());}};_0x5b6ed5(++_0x7eddcc);}(_0xbb3b,0x167));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xbbb3('0x0'));var _=require(_0xbbb3('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xbbb3('0x2'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xbbb3('0x3')},'priorityTrue':{'type':_0xbbb3('0x4'),'message':_0xbbb3('0x5')},'priorityFalse':{'type':'number','message':_0xbbb3('0x6')}});exports['consequence']=function(_0x27701b,_0x1015ad){return function(_0x25854f){try{var _0x47ae0a={'condition':htmlToText[_0xbbb3('0x7')](utils['getMustacheRender'](_0x1015ad[0x0],this),{'wordwrap':![]})[_0xbbb3('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1015ad[0x1],'priorityFalse':_0x1015ad[0x2]};var _0x594408=gotoif[_0xbbb3('0x0')](_0x47ae0a,{'typecast':!![]});if(_0x594408[_0xbbb3('0x9')]){logger['error'](_0xbbb3('0xa'),_0x27701b,_[_0xbbb3('0xb')](_0x594408,_0xbbb3('0xc'))[_0xbbb3('0xd')](',\x20'));_0x25854f[_0xbbb3('0xe')]();}else{try{var _0x2c1aae=eval('('+_0x47ae0a[_0xbbb3('0xf')]+')');var _0x404ad6=_0x2c1aae?_0x47ae0a[_0xbbb3('0x10')]:_0x47ae0a[_0xbbb3('0x11')];logger[_0xbbb3('0x12')](_0xbbb3('0x13'),_0x27701b,_0x47ae0a[_0xbbb3('0xf')],_0x2c1aae,_0x404ad6||_0xbbb3('0x14'));if(_0x404ad6){var _0x5c89=_[_0xbbb3('0x15')](_0x25854f[_0xbbb3('0x16')](),{'p':_0x404ad6});if(_0x5c89>=0x0){logger['info'](_0xbbb3('0x17'),_0x27701b,_0x404ad6||_0xbbb3('0x14'),_0x5c89);_0x25854f[_0xbbb3('0x14')](_0x5c89);}else{logger[_0xbbb3('0x12')](_0xbbb3('0x18'),_0x27701b,_0x404ad6||_0xbbb3('0x14'));_0x25854f[_0xbbb3('0xe')]();}}else{_0x25854f[_0xbbb3('0x14')]();}}catch(_0x3e6c3b){logger[_0xbbb3('0x19')](_0xbbb3('0x1a'),_0x27701b,_0x3e6c3b[_0xbbb3('0xc')]);_0x25854f[_0xbbb3('0xe')]();}}}catch(_0x3d9813){logger[_0xbbb3('0x19')](_0xbbb3('0xa'),_0x27701b,JSON[_0xbbb3('0x1b')](_0x3d9813));_0x25854f[_0xbbb3('0xe')]();}};}; \ 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 3fb479c..5535646 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 _0x0ea3=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash'];(function(_0x2f6c4f,_0x53d034){var _0x24a282=function(_0x48b376){while(--_0x48b376){_0x2f6c4f['push'](_0x2f6c4f['shift']());}};_0x24a282(++_0x53d034);}(_0x0ea3,0x1b6));var _0x30ea=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x0ea3[_0x4c4037];return _0x357862;};'use strict';var schema=require(_0x30ea('0x0'));var _=require(_0x30ea('0x1'));var logger=require(_0x30ea('0x2'))(_0x30ea('0x3'));var gotop=schema({'priority':{'type':_0x30ea('0x4'),'required':!![],'message':_0x30ea('0x5')}});exports[_0x30ea('0x6')]=function(_0x2db9f6,_0xe7fcfd){return function(_0x169fdb){try{var _0x53c128={'priority':_0xe7fcfd[0x0]};var _0x44fde8=gotop['validate'](_0x53c128,{'typecast':!![]});if(_0x44fde8[_0x30ea('0x7')]){logger[_0x30ea('0x8')](_0x30ea('0x9'),_0x2db9f6,_[_0x30ea('0xa')](_0x44fde8,_0x30ea('0xb'))[_0x30ea('0xc')](',\x20'));_0x169fdb[_0x30ea('0xd')]();}else{logger[_0x30ea('0xe')](_0x30ea('0xf'),_0x2db9f6,_0x53c128[_0x30ea('0x10')]);if(_0x53c128[_0x30ea('0x10')]){var _0x200cc1=_[_0x30ea('0x11')](_0x169fdb[_0x30ea('0x12')](),{'p':_0x53c128[_0x30ea('0x10')]});if(_0x200cc1>=0x0){logger[_0x30ea('0xe')](_0x30ea('0x13'),_0x2db9f6,_0x53c128[_0x30ea('0x10')]||_0x30ea('0x14'),_0x200cc1);_0x169fdb[_0x30ea('0x14')](_0x200cc1);}else{logger[_0x30ea('0xe')](_0x30ea('0x15'),_0x2db9f6,_0x53c128['priority']||_0x30ea('0x14'));_0x169fdb[_0x30ea('0xd')]();}}else{_0x169fdb[_0x30ea('0x14')]();}}}catch(_0x480d1e){logger[_0x30ea('0x8')](_0x30ea('0x9'),_0x2db9f6,JSON['stringify'](_0x480d1e));_0x169fdb[_0x30ea('0xd')]();}};}; \ No newline at end of file +var _0x80d4=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x4148bb,_0x535570){var _0x4da6be=function(_0x2c7096){while(--_0x2c7096){_0x4148bb['push'](_0x4148bb['shift']());}};_0x4da6be(++_0x535570);}(_0x80d4,0xdb));var _0x480d=function(_0x4782ee,_0x40291d){_0x4782ee=_0x4782ee-0x0;var _0x45a1f3=_0x80d4[_0x4782ee];return _0x45a1f3;};'use strict';var schema=require(_0x480d('0x0'));var _=require(_0x480d('0x1'));var logger=require(_0x480d('0x2'))(_0x480d('0x3'));var gotop=schema({'priority':{'type':_0x480d('0x4'),'required':!![],'message':_0x480d('0x5')}});exports['consequence']=function(_0x26fd56,_0x5fe924){return function(_0x2a3c25){try{var _0x343c4e={'priority':_0x5fe924[0x0]};var _0x4a3e23=gotop[_0x480d('0x0')](_0x343c4e,{'typecast':!![]});if(_0x4a3e23[_0x480d('0x6')]){logger[_0x480d('0x7')](_0x480d('0x8'),_0x26fd56,_[_0x480d('0x9')](_0x4a3e23,_0x480d('0xa'))[_0x480d('0xb')](',\x20'));_0x2a3c25[_0x480d('0xc')]();}else{logger[_0x480d('0xd')](_0x480d('0xe'),_0x26fd56,_0x343c4e[_0x480d('0xf')]);if(_0x343c4e[_0x480d('0xf')]){var _0x5e0d70=_[_0x480d('0x10')](_0x2a3c25[_0x480d('0x11')](),{'p':_0x343c4e[_0x480d('0xf')]});if(_0x5e0d70>=0x0){logger[_0x480d('0xd')](_0x480d('0x12'),_0x26fd56,_0x343c4e[_0x480d('0xf')]||_0x480d('0x13'),_0x5e0d70);_0x2a3c25[_0x480d('0x13')](_0x5e0d70);}else{logger[_0x480d('0xd')](_0x480d('0x14'),_0x26fd56,_0x343c4e[_0x480d('0xf')]||_0x480d('0x13'));_0x2a3c25[_0x480d('0xc')]();}}else{_0x2a3c25[_0x480d('0x13')]();}}}catch(_0x19f026){logger[_0x480d('0x7')](_0x480d('0x8'),_0x26fd56,JSON['stringify'](_0x19f026));_0x2a3c25[_0x480d('0xc')]();}};}; \ 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 1b6e882..f87bb31 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 _0x19f6=['account','AccountId','InteractionId','interaction','Message','info','body','next','[%s][MESSAGE]\x20%s','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','ChatWebsiteId'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x19f6,0x1ce));var _0x619f=function(_0x247550,_0x20e5f1){_0x247550=_0x247550-0x0;var _0x17bab3=_0x19f6[_0x247550];return _0x17bab3;};'use strict';var _=require(_0x619f('0x0'));var utils=require(_0x619f('0x1'));var logger=require(_0x619f('0x2'))(_0x619f('0x3'));var rpc={'chatMessage':require(_0x619f('0x4')),'openchannelMessage':require(_0x619f('0x5')),'mailMessage':require(_0x619f('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x619f('0x7')),'whatsappMessage':require(_0x619f('0x8'))};exports['consequence']=function(_0x388937,_0x59b1a6){return function(_0x38b131){try{var _0xcbfda5={'body':utils[_0x619f('0x9')](_0x59b1a6[0x0],this),'ContactId':this[_0x619f('0xa')]['id']};if(this[_0x619f('0xb')]==='chat'){_0xcbfda5[_0x619f('0xc')]=this[_0x619f('0xd')]['id'];}else{_0xcbfda5[_['upperFirst'](this[_0x619f('0xb')])+_0x619f('0xe')]=this[_0x619f('0xd')]['id'];}_0xcbfda5[_['upperFirst'](this[_0x619f('0xb')])+_0x619f('0xf')]=this[_0x619f('0x10')]['id'];if(rpc[this[_0x619f('0xb')]+'Message']){return rpc[this[_0x619f('0xb')]+_0x619f('0x11')]['create'](_0xcbfda5)['then'](function(_0x5753de){logger[_0x619f('0x12')]('[%s][MESSAGE]\x20%s',_0x388937,_0xcbfda5[_0x619f('0x13')]);_0x38b131[_0x619f('0x14')]();})['catch'](function(_0x3d17e8){logger['error'](_0x619f('0x15'),_0x388937,JSON['stringify'](_0x3d17e8));_0x38b131['stop']();});}}catch(_0x2d139a){logger[_0x619f('0x16')]('[%s][MESSAGE]\x20%s',_0x388937,JSON[_0x619f('0x17')](_0x2d139a));_0x38b131[_0x619f('0x18')]();}};}; \ No newline at end of file +var _0x6d0c=['InteractionId','interaction','Message','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x1bc0e1,_0x251148){var _0x5dab6b=function(_0x1a40c6){while(--_0x1a40c6){_0x1bc0e1['push'](_0x1bc0e1['shift']());}};_0x5dab6b(++_0x251148);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x1123e8,_0x10e54d){_0x1123e8=_0x1123e8-0x0;var _0x2cd6e0=_0x6d0c[_0x1123e8];return _0x2cd6e0;};'use strict';var _=require(_0xc6d0('0x0'));var utils=require(_0xc6d0('0x1'));var logger=require(_0xc6d0('0x2'))(_0xc6d0('0x3'));var rpc={'chatMessage':require(_0xc6d0('0x4')),'openchannelMessage':require(_0xc6d0('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc6d0('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc6d0('0x7')]=function(_0x509286,_0x589214){return function(_0xdae4c3){try{var _0x40ba33={'body':utils[_0xc6d0('0x8')](_0x589214[0x0],this),'ContactId':this[_0xc6d0('0x9')]['id']};if(this[_0xc6d0('0xa')]===_0xc6d0('0xb')){_0x40ba33[_0xc6d0('0xc')]=this[_0xc6d0('0xd')]['id'];}else{_0x40ba33[_[_0xc6d0('0xe')](this[_0xc6d0('0xa')])+_0xc6d0('0xf')]=this[_0xc6d0('0xd')]['id'];}_0x40ba33[_[_0xc6d0('0xe')](this[_0xc6d0('0xa')])+_0xc6d0('0x10')]=this[_0xc6d0('0x11')]['id'];if(rpc[this[_0xc6d0('0xa')]+_0xc6d0('0x12')]){return rpc[this[_0xc6d0('0xa')]+'Message']['create'](_0x40ba33)[_0xc6d0('0x13')](function(_0x3b3a05){logger['info'](_0xc6d0('0x14'),_0x509286,_0x40ba33[_0xc6d0('0x15')]);_0xdae4c3[_0xc6d0('0x16')]();})['catch'](function(_0x5c4521){logger[_0xc6d0('0x17')](_0xc6d0('0x14'),_0x509286,JSON[_0xc6d0('0x18')](_0x5c4521));_0xdae4c3['stop']();});}}catch(_0x2e1ba2){logger['error'](_0xc6d0('0x14'),_0x509286,JSON[_0xc6d0('0x18')](_0x2e1ba2));_0xdae4c3[_0xc6d0('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 2d94af4..4a856eb 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 _0xcb16=['consequence','info','[%s][NOOP]\x20%s','error','stringify','stop','./utils'];(function(_0x3259a2,_0x174b02){var _0x314467=function(_0x1551f1){while(--_0x1551f1){_0x3259a2['push'](_0x3259a2['shift']());}};_0x314467(++_0x174b02);}(_0xcb16,0x6f));var _0x6cb1=function(_0x5e9675,_0x2bcd51){_0x5e9675=_0x5e9675-0x0;var _0x3daece=_0xcb16[_0x5e9675];return _0x3daece;};'use strict';var utils=require(_0x6cb1('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x6cb1('0x1')]=function(_0x2cfb9d,_0x50ef4b){return function(_0x5d7fd5){try{logger[_0x6cb1('0x2')](_0x6cb1('0x3'),_0x2cfb9d,utils['getMustacheRender'](_0x50ef4b[0x0],this));_0x5d7fd5['next']();}catch(_0x405be0){logger[_0x6cb1('0x4')](_0x6cb1('0x3'),_0x2cfb9d,JSON[_0x6cb1('0x5')](_0x405be0));_0x5d7fd5[_0x6cb1('0x6')]();}};}; \ No newline at end of file +var _0x323a=['[%s][NOOP]\x20%s','next','error','stringify','./utils','routing','consequence','info'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x323a,0x84));var _0xa323=function(_0x28ee82,_0x5c252f){_0x28ee82=_0x28ee82-0x0;var _0x13cd70=_0x323a[_0x28ee82];return _0x13cd70;};'use strict';var utils=require(_0xa323('0x0'));var logger=require('../../../../config/logger')(_0xa323('0x1'));exports[_0xa323('0x2')]=function(_0xcff7a6,_0x521f00){return function(_0x5ba905){try{logger[_0xa323('0x3')](_0xa323('0x4'),_0xcff7a6,utils['getMustacheRender'](_0x521f00[0x0],this));_0x5ba905[_0xa323('0x5')]();}catch(_0x18b273){logger[_0xa323('0x6')](_0xa323('0x4'),_0xcff7a6,JSON[_0xa323('0x7')](_0x18b273));_0x5ba905['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index fc33fe0..9bdad1a 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 _0x43bf=['create','catch','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','error','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','map','join','find','Queues','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','clone','queue_id','account','push','capitalize','InteractionId','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','info','name','QueueReport'];(function(_0xe67d1c,_0x1b21d1){var _0x11673c=function(_0x119660){while(--_0x119660){_0xe67d1c['push'](_0xe67d1c['shift']());}};_0x11673c(++_0x1b21d1);}(_0x43bf,0x6d));var _0xf43b=function(_0x148455,_0x12059c){_0x148455=_0x148455-0x0;var _0xf99bb9=_0x43bf[_0x148455];return _0xf99bb9;};'use strict';var schema=require('validate');var _=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var seqqueue=require(_0xf43b('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xf43b('0x3'));var logger=require('../../../../config/logger')(_0xf43b('0x4'));var strategy=require(_0xf43b('0x5'));config[_0xf43b('0x6')]=_[_0xf43b('0x7')](config['redis'],{'host':_0xf43b('0x8'),'port':0x18eb});var io=require(_0xf43b('0x9'))(new Redis(config[_0xf43b('0x6')]));var attributes=['id','queue_id','account',_0xf43b('0xa'),_0xf43b('0xb'),_0xf43b('0xc')];function emit(_0x5a5541,_0x1ea1b0,_0xa0f905){io['to'](_0x5a5541)[_0xf43b('0xd')](_0x1ea1b0,_0xa0f905);}function emitChannelQueueInteraction(_0x2c4d8f,_0x9cda7e,_0x361a8b,_0x24de0e,_0x45a7a4,_0x3726cf,_0x35b8d7,_0x16cff5){var _0x2ac363=_[_0xf43b('0xe')](_0x361a8b);_0x2ac363[_0xf43b('0xf')]=_0x16cff5;_0x2ac363[_0xf43b('0xa')]=_0x9cda7e;_0x2ac363[_0xf43b('0x10')]=_0x24de0e;_0x2ac363['id']=_0x45a7a4;if(_0x3726cf){attributes[_0xf43b('0x11')](_[_0xf43b('0x12')](_0x2c4d8f)+_0xf43b('0x13'));_0x35b8d7[util['format']('%sQueuesWaitingInteractions',_0x2c4d8f)][_0x45a7a4]=_[_0xf43b('0x14')](_0x2ac363,attributes);}else{delete _0x35b8d7[util[_0xf43b('0x15')](_0xf43b('0x16'),_0x2c4d8f)][_0x45a7a4];}emit(util[_0xf43b('0x15')](_0xf43b('0x17'),_0x2c4d8f,_0x9cda7e),util[_0xf43b('0x15')](_0xf43b('0x18'),_0x2c4d8f,_0x3726cf?_0xf43b('0x19'):_0xf43b('0x1a')),_[_0xf43b('0x14')](_0x2ac363,attributes));}var rpc={'openchannelQueueReport':require(_0xf43b('0x1b')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xf43b('0x1c')),'faxQueueReport':require(_0xf43b('0x1d')),'whatsappQueueReport':require(_0xf43b('0x1e')),'chatInteraction':require(_0xf43b('0x1f')),'faxInteraction':require(_0xf43b('0x20')),'mailInteraction':require(_0xf43b('0x21')),'openchannelInteraction':require(_0xf43b('0x22')),'smsInteraction':require(_0xf43b('0x23')),'whatsappInteraction':require(_0xf43b('0x24'))};var queue=schema({'name':{'type':_0xf43b('0x25'),'required':!![],'message':_0xf43b('0x26')},'timeout':{'type':_0xf43b('0x27'),'message':_0xf43b('0x28')}});function startRouting(_0x2c32fd,_0x1ae174,_0x38f1c9,_0x3c307e){if(_0x2c32fd&&_0x1ae174&&_0x38f1c9){_0x1ae174[_0xf43b('0x29')]+=0x1;var _0x9d2fd={'uniqueid':_0x2c32fd,'from':_0x38f1c9[_0xf43b('0x2a')]?_0x38f1c9['body'][_0xf43b('0xb')]:'','joinAt':moment()[_0xf43b('0x15')](_0xf43b('0x2b')),'ContactId':_0x38f1c9[_0xf43b('0x2c')]?_0x38f1c9['contact']['id']:null,'ListId':_0x38f1c9[_0xf43b('0x2d')]?_0x38f1c9['list']['id']:null};_0x9d2fd[_[_0xf43b('0x2e')](_0x38f1c9[_0xf43b('0x2f')])+_0xf43b('0x30')]=_0x1ae174['id']||null;_0x9d2fd[_['upperFirst'](_0x38f1c9[_0xf43b('0x2f')])+_0xf43b('0x13')]=_0x38f1c9[_0xf43b('0x31')]?_0x38f1c9[_0xf43b('0x31')]['id']:null;_0x9d2fd[_[_0xf43b('0x2e')](_0x38f1c9[_0xf43b('0x2f')])+_0xf43b('0x32')]=_0x38f1c9['message']?_0x38f1c9[_0xf43b('0x33')]['id']:null;_0x9d2fd[_[_0xf43b('0x2e')](_0x38f1c9[_0xf43b('0x2f')])+(_0x38f1c9['channel']!==_0xf43b('0x34')?_0xf43b('0x35'):'WebsiteId')]=_0x38f1c9[_0xf43b('0x10')]?_0x38f1c9[_0xf43b('0x10')]['id']:null;logger[_0xf43b('0x36')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x2c32fd,_0x1ae174['name']));emitChannelQueueInteraction(_0x38f1c9[_0xf43b('0x2f')],_0x1ae174['name'],_0x9d2fd,_0x38f1c9['account'][_0xf43b('0x37')],_0x38f1c9['message']['id'],!![],_0x3c307e,_0x1ae174['id']);if(rpc[_0x38f1c9[_0xf43b('0x2f')]+_0xf43b('0x38')]){return rpc[_0x38f1c9[_0xf43b('0x2f')]+_0xf43b('0x38')][_0xf43b('0x39')](_0x9d2fd)[_0xf43b('0x3a')](function(_0x2739ba){logger['error'](_0xf43b('0x3b'),_0x2739ba);});}}}function stopRouting(_0x32dbf9,_0x11ab29,_0x3d4534,_0x462b0a){if(_0x32dbf9&&_0x11ab29){_0x11ab29[_0xf43b('0x29')]-=0x1;var _0x57487f={'leaveAt':moment()[_0xf43b('0x15')](_0xf43b('0x2b')),'acceptAt':moment()[_0xf43b('0x15')](_0xf43b('0x2b')),'reason':'accepted'};logger[_0xf43b('0x36')](util[_0xf43b('0x15')](_0xf43b('0x3c'),_0x32dbf9,_0x11ab29[_0xf43b('0x37')]));emitChannelQueueInteraction(_0x3d4534[_0xf43b('0x2f')],_0x11ab29['name'],_0x3d4534[_0xf43b('0x2a')],_0x3d4534[_0xf43b('0x10')][_0xf43b('0x37')],_0x3d4534[_0xf43b('0x33')]['id'],![],_0x462b0a,_0x11ab29['id']);return rpc[_0x3d4534[_0xf43b('0x2f')]+_0xf43b('0x3d')]['update'](_0x3d4534[_0xf43b('0x31')]['id'],{'queueId':_0x11ab29['id']})['then'](function(){if(rpc[_0x3d4534[_0xf43b('0x2f')]+_0xf43b('0x38')]){return rpc[_0x3d4534[_0xf43b('0x2f')]+_0xf43b('0x38')][_0xf43b('0x3e')](_0x32dbf9,_0x57487f)[_0xf43b('0x3a')](function(_0x37f35f){logger[_0xf43b('0x3f')]('update\x20queue\x20report',_0x37f35f);});}});}}function endRouting(_0x485e77,_0x12d850,_0x515ec6,_0x4b2203){if(_0x485e77&&_0x12d850){_0x12d850[_0xf43b('0x29')]-=0x1;var _0x406213={'leaveAt':moment()[_0xf43b('0x15')](_0xf43b('0x2b')),'exitAt':moment()['format'](_0xf43b('0x2b')),'reason':_0xf43b('0x40')};logger['info'](util[_0xf43b('0x15')](_0xf43b('0x41'),_0x485e77,_0x12d850['name']));emitChannelQueueInteraction(_0x515ec6[_0xf43b('0x2f')],_0x12d850[_0xf43b('0x37')],_0x515ec6[_0xf43b('0x2a')],_0x515ec6[_0xf43b('0x10')][_0xf43b('0x37')],_0x515ec6[_0xf43b('0x33')]['id'],![],_0x4b2203);if(rpc[_0x515ec6[_0xf43b('0x2f')]+'QueueReport']){return rpc[_0x515ec6[_0xf43b('0x2f')]+'QueueReport'][_0xf43b('0x3e')](_0x485e77,_0x406213)[_0xf43b('0x3a')](function(_0x7fa44){logger[_0xf43b('0x3f')]('update\x20queue\x20report',_0x7fa44);});}}}function handleFindQueue(_0x681994){return function(_0x5d3706){return _0x5d3706[_0xf43b('0x37')][_0xf43b('0x42')]()===_0x681994[_0xf43b('0x42')]();};}exports[_0xf43b('0x43')]=function(_0xf932ca,_0x2cf5ec,_0x469727,_0x5c8d83){return function(_0x66f1b5){try{var _0x48350a={'name':_0x2cf5ec[0x0],'timeout':_0x2cf5ec[0x1]};var _0x249bca=queue['validate'](_0x48350a,{'typecast':!![]});if(_0x249bca['length']){logger[_0xf43b('0x3f')]('[%s][QUEUE]\x20%s',_0xf932ca,_[_0xf43b('0x44')](_0x249bca,_0xf43b('0x33'))[_0xf43b('0x45')](',\x20'));_0x66f1b5['stop']();}else{var _0x518411=_[_0xf43b('0x46')](_0x469727[_0x5c8d83['channel']+_0xf43b('0x47')],handleFindQueue(_0x48350a[_0xf43b('0x37')]));if(_0x518411){startRouting(_0xf932ca,_0x518411,_0x5c8d83,_0x469727);var _0x5462fc=(_0x518411[_0xf43b('0x40')]||0xa)*0x3e8;var _0xbcb94a=(_0x48350a['timeout']||0x14)*0x3e8;var _0x28a06c;if(_0x5462fc>_0xbcb94a){_0xbcb94a=_0x5462fc;}var _0x10f272=seqqueue['createQueue'](_0x5462fc);_0x10f272['id']=_0xf932ca;_0x10f272[_0xf43b('0x48')]=_0x5462fc;_0x10f272['qtimeout']=_0xbcb94a;_0x10f272['channel']=_0x5c8d83[_0xf43b('0x2f')];_0x469727[_0xf43b('0x49')][_0xf932ca]['on'](_0xf43b('0x4a'),function(){logger['info'](_0xf43b('0x4b'),_0xf932ca);stopRouting(_0xf932ca,_0x518411,_0x5c8d83,_0x469727);clearTimeout(_0x28a06c);_0x28a06c=undefined;_0x10f272[_0xf43b('0x4c')](!![]);if(_0x469727['rules'][_0xf932ca]){delete _0x469727[_0xf43b('0x49')][_0xf932ca];}_0x66f1b5[_0xf43b('0x4d')]();});_0x469727['rules'][_0xf932ca]['on'](_0xf43b('0x4e'),function(){if(_0x469727[_0xf43b('0x49')][_0xf932ca]){delete _0x469727[_0xf43b('0x49')][_0xf932ca];}});_0x28a06c=setTimeout(function(){logger['info'](_0xf43b('0x4f'),_0xf932ca);endRouting(_0xf932ca,_0x518411,_0x5c8d83,_0x469727);clearTimeout(_0x28a06c);_0x10f272['close'](!![]);_0x66f1b5['next']();},_0xbcb94a);switch(_0x518411[_0xf43b('0x50')]){case'rrmemory':strategy['rrmemory'](_0x10f272,_0x518411,_0x469727,_0x5c8d83);break;default:strategy['beepall'](_0x10f272,_0x518411,_0x469727,_0x5c8d83);}}else{logger[_0xf43b('0x3f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xf932ca,_0x48350a['name']);_0x66f1b5[_0xf43b('0x4d')]();}}}catch(_0x3e1509){logger[_0xf43b('0x3f')](_0xf43b('0x51'),_0xf932ca,_0x3e1509[_0xf43b('0x52')]);_0x66f1b5[_0xf43b('0x4d')]();}};}; \ No newline at end of file +var _0x7eba=['consequence','validate','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','error','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','lodash','util','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','account','queue','clone','queue_id','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','then','update\x20queue\x20report','timeout','update','toLowerCase'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x7eba,0x67));var _0xa7eb=function(_0x107c2d,_0x513116){_0x107c2d=_0x107c2d-0x0;var _0x1d2473=_0x7eba[_0x107c2d];return _0x1d2473;};'use strict';var schema=require('validate');var _=require(_0xa7eb('0x0'));var util=require(_0xa7eb('0x1'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa7eb('0x2'));var config=require('../../../../config/environment');var logger=require(_0xa7eb('0x3'))(_0xa7eb('0x4'));var strategy=require(_0xa7eb('0x5'));config[_0xa7eb('0x6')]=_['defaults'](config[_0xa7eb('0x6')],{'host':_0xa7eb('0x7'),'port':0x18eb});var io=require(_0xa7eb('0x8'))(new Redis(config['redis']));var attributes=['id','queue_id',_0xa7eb('0x9'),_0xa7eb('0xa'),'from','joinAt'];function emit(_0x5ad454,_0x164736,_0x9c09c9){io['to'](_0x5ad454)['emit'](_0x164736,_0x9c09c9);}function emitChannelQueueInteraction(_0x446898,_0x3f103c,_0x412d06,_0x21c8c0,_0x49020d,_0x281287,_0x3cacd9,_0x364c7e){var _0x3d79e1=_[_0xa7eb('0xb')](_0x412d06);_0x3d79e1[_0xa7eb('0xc')]=_0x364c7e;_0x3d79e1[_0xa7eb('0xa')]=_0x3f103c;_0x3d79e1[_0xa7eb('0x9')]=_0x21c8c0;_0x3d79e1['id']=_0x49020d;if(_0x281287){attributes['push'](_[_0xa7eb('0xd')](_0x446898)+'InteractionId');_0x3cacd9[util[_0xa7eb('0xe')](_0xa7eb('0xf'),_0x446898)][_0x49020d]=_[_0xa7eb('0x10')](_0x3d79e1,attributes);}else{delete _0x3cacd9[util['format'](_0xa7eb('0xf'),_0x446898)][_0x49020d];}emit(util[_0xa7eb('0xe')](_0xa7eb('0x11'),_0x446898,_0x3f103c),util[_0xa7eb('0xe')](_0xa7eb('0x12'),_0x446898,_0x281287?_0xa7eb('0x13'):'remove'),_['pick'](_0x3d79e1,attributes));}var rpc={'openchannelQueueReport':require(_0xa7eb('0x14')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xa7eb('0x15')),'smsQueueReport':require(_0xa7eb('0x16')),'faxQueueReport':require(_0xa7eb('0x17')),'whatsappQueueReport':require(_0xa7eb('0x18')),'chatInteraction':require(_0xa7eb('0x19')),'faxInteraction':require(_0xa7eb('0x1a')),'mailInteraction':require(_0xa7eb('0x1b')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa7eb('0x1c')),'whatsappInteraction':require(_0xa7eb('0x1d'))};var queue=schema({'name':{'type':_0xa7eb('0x1e'),'required':!![],'message':_0xa7eb('0x1f')},'timeout':{'type':_0xa7eb('0x20'),'message':_0xa7eb('0x21')}});function startRouting(_0x3a71ed,_0x5afa68,_0xa9aef8,_0x8a8f81){if(_0x3a71ed&&_0x5afa68&&_0xa9aef8){_0x5afa68[_0xa7eb('0x22')]+=0x1;var _0x47ce51={'uniqueid':_0x3a71ed,'from':_0xa9aef8[_0xa7eb('0x23')]?_0xa9aef8[_0xa7eb('0x23')]['from']:'','joinAt':moment()['format'](_0xa7eb('0x24')),'ContactId':_0xa9aef8[_0xa7eb('0x25')]?_0xa9aef8[_0xa7eb('0x25')]['id']:null,'ListId':_0xa9aef8[_0xa7eb('0x26')]?_0xa9aef8[_0xa7eb('0x26')]['id']:null};_0x47ce51[_[_0xa7eb('0x27')](_0xa9aef8[_0xa7eb('0x28')])+'QueueId']=_0x5afa68['id']||null;_0x47ce51[_['upperFirst'](_0xa9aef8[_0xa7eb('0x28')])+_0xa7eb('0x29')]=_0xa9aef8[_0xa7eb('0x2a')]?_0xa9aef8[_0xa7eb('0x2a')]['id']:null;_0x47ce51[_[_0xa7eb('0x27')](_0xa9aef8['channel'])+'MessageId']=_0xa9aef8[_0xa7eb('0x2b')]?_0xa9aef8[_0xa7eb('0x2b')]['id']:null;_0x47ce51[_[_0xa7eb('0x27')](_0xa9aef8[_0xa7eb('0x28')])+(_0xa9aef8[_0xa7eb('0x28')]!==_0xa7eb('0x2c')?'AccountId':_0xa7eb('0x2d'))]=_0xa9aef8['account']?_0xa9aef8['account']['id']:null;logger[_0xa7eb('0x2e')](util[_0xa7eb('0xe')](_0xa7eb('0x2f'),_0x3a71ed,_0x5afa68[_0xa7eb('0x30')]));emitChannelQueueInteraction(_0xa9aef8[_0xa7eb('0x28')],_0x5afa68[_0xa7eb('0x30')],_0x47ce51,_0xa9aef8[_0xa7eb('0x9')]['name'],_0xa9aef8[_0xa7eb('0x2b')]['id'],!![],_0x8a8f81,_0x5afa68['id']);if(rpc[_0xa9aef8['channel']+'QueueReport']){return rpc[_0xa9aef8[_0xa7eb('0x28')]+_0xa7eb('0x31')][_0xa7eb('0x32')](_0x47ce51)[_0xa7eb('0x33')](function(_0x5ae821){logger['error'](_0xa7eb('0x34'),_0x5ae821);});}}}function stopRouting(_0x568459,_0xe46996,_0x50a580,_0x815215){if(_0x568459&&_0xe46996){_0xe46996[_0xa7eb('0x22')]-=0x1;var _0x3c8f13={'leaveAt':moment()[_0xa7eb('0xe')](_0xa7eb('0x24')),'acceptAt':moment()['format'](_0xa7eb('0x24')),'reason':'accepted'};logger['info'](util[_0xa7eb('0xe')](_0xa7eb('0x35'),_0x568459,_0xe46996['name']));emitChannelQueueInteraction(_0x50a580[_0xa7eb('0x28')],_0xe46996[_0xa7eb('0x30')],_0x50a580[_0xa7eb('0x23')],_0x50a580[_0xa7eb('0x9')][_0xa7eb('0x30')],_0x50a580[_0xa7eb('0x2b')]['id'],![],_0x815215,_0xe46996['id']);return rpc[_0x50a580[_0xa7eb('0x28')]+'Interaction']['update'](_0x50a580[_0xa7eb('0x2a')]['id'],{'queueId':_0xe46996['id']})[_0xa7eb('0x36')](function(){if(rpc[_0x50a580[_0xa7eb('0x28')]+_0xa7eb('0x31')]){return rpc[_0x50a580['channel']+_0xa7eb('0x31')]['update'](_0x568459,_0x3c8f13)[_0xa7eb('0x33')](function(_0xaa1269){logger['error'](_0xa7eb('0x37'),_0xaa1269);});}});}}function endRouting(_0x5482e5,_0x2e8af8,_0x203e82,_0xbe858f){if(_0x5482e5&&_0x2e8af8){_0x2e8af8[_0xa7eb('0x22')]-=0x1;var _0x4632b8={'leaveAt':moment()['format'](_0xa7eb('0x24')),'exitAt':moment()[_0xa7eb('0xe')](_0xa7eb('0x24')),'reason':_0xa7eb('0x38')};logger['info'](util[_0xa7eb('0xe')]('[%s][END:QUEUE][NAME:%s]',_0x5482e5,_0x2e8af8[_0xa7eb('0x30')]));emitChannelQueueInteraction(_0x203e82['channel'],_0x2e8af8['name'],_0x203e82[_0xa7eb('0x23')],_0x203e82[_0xa7eb('0x9')]['name'],_0x203e82['message']['id'],![],_0xbe858f);if(rpc[_0x203e82['channel']+_0xa7eb('0x31')]){return rpc[_0x203e82['channel']+_0xa7eb('0x31')][_0xa7eb('0x39')](_0x5482e5,_0x4632b8)[_0xa7eb('0x33')](function(_0x208ffe){logger['error']('update\x20queue\x20report',_0x208ffe);});}}}function handleFindQueue(_0x49d3eb){return function(_0x2f30f1){return _0x2f30f1['name'][_0xa7eb('0x3a')]()===_0x49d3eb[_0xa7eb('0x3a')]();};}exports[_0xa7eb('0x3b')]=function(_0x52b26b,_0x560493,_0x508ee7,_0x568cee){return function(_0x114857){try{var _0x25913b={'name':_0x560493[0x0],'timeout':_0x560493[0x1]};var _0x5c1197=queue[_0xa7eb('0x3c')](_0x25913b,{'typecast':!![]});if(_0x5c1197['length']){logger['error'](_0xa7eb('0x3d'),_0x52b26b,_[_0xa7eb('0x3e')](_0x5c1197,'message')[_0xa7eb('0x3f')](',\x20'));_0x114857[_0xa7eb('0x40')]();}else{var _0x33fa88=_[_0xa7eb('0x41')](_0x508ee7[_0x568cee[_0xa7eb('0x28')]+_0xa7eb('0x42')],handleFindQueue(_0x25913b[_0xa7eb('0x30')]));if(_0x33fa88){startRouting(_0x52b26b,_0x33fa88,_0x568cee,_0x508ee7);var _0x3b79bc=(_0x33fa88[_0xa7eb('0x38')]||0xa)*0x3e8;var _0x1b6f7e=(_0x25913b[_0xa7eb('0x38')]||0x14)*0x3e8;var _0x50dbb3;if(_0x3b79bc>_0x1b6f7e){_0x1b6f7e=_0x3b79bc;}var _0x5dec75=seqqueue[_0xa7eb('0x43')](_0x3b79bc);_0x5dec75['id']=_0x52b26b;_0x5dec75[_0xa7eb('0x44')]=_0x3b79bc;_0x5dec75[_0xa7eb('0x45')]=_0x1b6f7e;_0x5dec75[_0xa7eb('0x28')]=_0x568cee[_0xa7eb('0x28')];_0x508ee7[_0xa7eb('0x46')][_0x52b26b]['on'](_0xa7eb('0x47'),function(){logger[_0xa7eb('0x2e')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x52b26b);stopRouting(_0x52b26b,_0x33fa88,_0x568cee,_0x508ee7);clearTimeout(_0x50dbb3);_0x50dbb3=undefined;_0x5dec75[_0xa7eb('0x48')](!![]);if(_0x508ee7[_0xa7eb('0x46')][_0x52b26b]){delete _0x508ee7['rules'][_0x52b26b];}_0x114857[_0xa7eb('0x40')]();});_0x508ee7[_0xa7eb('0x46')][_0x52b26b]['on'](_0xa7eb('0x49'),function(){if(_0x508ee7[_0xa7eb('0x46')][_0x52b26b]){delete _0x508ee7['rules'][_0x52b26b];}});_0x50dbb3=setTimeout(function(){logger[_0xa7eb('0x2e')](_0xa7eb('0x4a'),_0x52b26b);endRouting(_0x52b26b,_0x33fa88,_0x568cee,_0x508ee7);clearTimeout(_0x50dbb3);_0x5dec75[_0xa7eb('0x48')](!![]);_0x114857[_0xa7eb('0x4b')]();},_0x1b6f7e);switch(_0x33fa88[_0xa7eb('0x4c')]){case _0xa7eb('0x4d'):strategy['rrmemory'](_0x5dec75,_0x33fa88,_0x508ee7,_0x568cee);break;default:strategy[_0xa7eb('0x4e')](_0x5dec75,_0x33fa88,_0x508ee7,_0x568cee);}}else{logger[_0xa7eb('0x4f')](_0xa7eb('0x50'),_0x52b26b,_0x25913b[_0xa7eb('0x30')]);_0x114857[_0xa7eb('0x40')]();}}}catch(_0x1861db){logger[_0xa7eb('0x4f')](_0xa7eb('0x3d'),_0x52b26b,_0x1861db['stack']);_0x114857[_0xa7eb('0x40')]();}};}; \ 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 3b6f706..d301174 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 _0x2d17=['routing','notificationId','agent','squeue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','forcedOwnership','channel','busy','saveWaitingNotification','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger'];(function(_0x2cc52e,_0x1fd216){var _0x2c5429=function(_0x4cd55a){while(--_0x4cd55a){_0x2cc52e['push'](_0x2cc52e['shift']());}};_0x2c5429(++_0x1fd216);}(_0x2d17,0x17e));var _0x72d1=function(_0x5b3947,_0xd0c610){_0x5b3947=_0x5b3947-0x0;var _0x1ada13=_0x2d17[_0x5b3947];return _0x1ada13;};'use strict';var _=require(_0x72d1('0x0'));var uuid=require(_0x72d1('0x1'));var util=require('./util');var logger=require(_0x72d1('0x2'))(_0x72d1('0x3'));var Agent=function(_0x531f4e,_0x3687bc,_0x38fec7,_0x55b722){this[_0x72d1('0x4')]=uuid['v4']();this['squeue']=_0x531f4e;this[_0x72d1('0x5')]=_0x3687bc;this['realtime']=_0x38fec7;this[_0x72d1('0x3')]=_0x55b722;this[_0x72d1('0x6')]['push'](this[_0x72d1('0x7')][_0x72d1('0x8')](this),this[_0x72d1('0x9')]['bind'](this));this[_0x72d1('0x6')]['on'](_0x72d1('0xa'),this[_0x72d1('0x9')]['bind'](this));this[_0x72d1('0x6')]['on'](_0x72d1('0xb'),this[_0x72d1('0xc')][_0x72d1('0x8')](this));};Agent[_0x72d1('0xd')][_0x72d1('0xe')]=function(){this[_0x72d1('0x6')][_0x72d1('0xe')](this[_0x72d1('0x7')][_0x72d1('0x8')](this),this['handleTimeout'][_0x72d1('0x8')](this));};Agent[_0x72d1('0xd')][_0x72d1('0xc')]=function(){this[_0x72d1('0x9')](!![]);};Agent[_0x72d1('0xd')][_0x72d1('0x7')]=function(){logger[_0x72d1('0xf')](_0x72d1('0x10'),this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);if(_[_0x72d1('0x11')](this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']])){logger[_0x72d1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);setTimeout(this['push'][_0x72d1('0x8')](this),0x3e8);}else{if(this[_0x72d1('0x3')][_0x72d1('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x72d1('0x12')][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],this[_0x72d1('0x6')][_0x72d1('0x15')],![])){this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']][_0x72d1('0x16')]=!![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x72d1('0x17')](this[_0x72d1('0x12')],this['routing'],this[_0x72d1('0x5')],this[_0x72d1('0x6')][_0x72d1('0x15')]);util[_0x72d1('0x18')](this[_0x72d1('0x4')],this['squeue']['id'],this['realtime'][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],null,this[_0x72d1('0x3')]);util[_0x72d1('0x19')](this[_0x72d1('0x6')]['id'],this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']],'RINGING'+(this[_0x72d1('0x3')]['forcedOwnership']?_0x72d1('0x1a'):''));}else{logger[_0x72d1('0xf')](_0x72d1('0x1b'),this['squeue']['id'],this[_0x72d1('0x5')]['id']);setTimeout(this['push'][_0x72d1('0x8')](this),0x3e8);}}};Agent[_0x72d1('0xd')][_0x72d1('0x9')]=function(_0x2cc0c8){if(_['isNil'](this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']])){return logger[_0x72d1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);}else{logger[_0x72d1('0xf')](_0x72d1('0x1c'),this[_0x72d1('0x6')]['id'],this['agent']['id']);util[_0x72d1('0x1d')](this[_0x72d1('0x4')],this[_0x72d1('0x6')]['id'],this['realtime'][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],null,this['routing']);this[_0x72d1('0x12')][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']]['busy']=![];this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']][_0x72d1('0x1e')]=undefined;util[_0x72d1('0x1f')](this[_0x72d1('0x12')],this[_0x72d1('0x3')],this[_0x72d1('0x5')],this[_0x72d1('0x6')][_0x72d1('0x15')]);util[_0x72d1('0x19')](this[_0x72d1('0x6')]['id'],this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']],_0x2cc0c8?_0x72d1('0x20'):_0x72d1('0x21'));}if(!_0x2cc0c8){setTimeout(this[_0x72d1('0xe')]['bind'](this),0x3e8);}};function agent(_0x3eb3da,_0x3ae025,_0x2783bb,_0x4fb07b){return new Agent(_0x3eb3da,_0x3ae025,_0x2783bb,_0x4fb07b);}module[_0x72d1('0x22')]=agent; \ No newline at end of file +var _0x008c=['routing','notificationId','squeue','agent','realtime','handleRun','handleTimeout','timeout','handleDrained','bind','push','debug','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busyQueue','saveWaitingNotification','channel','agents','RINGING','prototype','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x008c,0x188));var _0xc008=function(_0x1b9629,_0x5554b4){_0x1b9629=_0x1b9629-0x0;var _0x4ade3a=_0x008c[_0x1b9629];return _0x4ade3a;};'use strict';var _=require(_0xc008('0x0'));var uuid=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var logger=require(_0xc008('0x3'))(_0xc008('0x4'));var Agent=function(_0x544fdf,_0x3641af,_0x47063f,_0x10b33c){this[_0xc008('0x5')]=uuid['v4']();this[_0xc008('0x6')]=_0x544fdf;this[_0xc008('0x7')]=_0x3641af;this[_0xc008('0x8')]=_0x47063f;this[_0xc008('0x4')]=_0x10b33c;this[_0xc008('0x6')]['push'](this[_0xc008('0x9')]['bind'](this),this[_0xc008('0xa')]['bind'](this));this['squeue']['on'](_0xc008('0xb'),this[_0xc008('0xa')]['bind'](this));this['squeue']['on']('drained',this[_0xc008('0xc')][_0xc008('0xd')](this));};Agent['prototype'][_0xc008('0xe')]=function(){this[_0xc008('0x6')][_0xc008('0xe')](this[_0xc008('0x9')][_0xc008('0xd')](this),this[_0xc008('0xa')][_0xc008('0xd')](this));};Agent['prototype']['handleDrained']=function(){this[_0xc008('0xa')](!![]);};Agent['prototype'][_0xc008('0x9')]=function(){logger[_0xc008('0xf')](_0xc008('0x10'),this[_0xc008('0x6')]['id'],this[_0xc008('0x7')]['id']);if(_['isNil'](this['realtime']['agents'][this[_0xc008('0x7')]['id']])){logger[_0xc008('0xf')](_0xc008('0x11'),this[_0xc008('0x6')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xc008('0x12')]||util[_0xc008('0x13')](this['squeue']['id'],this[_0xc008('0x8')]['agents'][this['agent']['id']],this['squeue']['channel'],![])){this[_0xc008('0x8')]['agents'][this['agent']['id']]['busy']=!![];this['realtime']['agents'][this[_0xc008('0x7')]['id']][_0xc008('0x14')]=undefined;util[_0xc008('0x15')](this[_0xc008('0x8')],this[_0xc008('0x4')],this[_0xc008('0x7')],this['squeue'][_0xc008('0x16')]);util['showNotification'](this['notificationId'],this[_0xc008('0x6')]['id'],this[_0xc008('0x8')][_0xc008('0x17')][this[_0xc008('0x7')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this[_0xc008('0x8')][_0xc008('0x17')][this[_0xc008('0x7')]['id']],_0xc008('0x18')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xc008('0x6')]['id'],this[_0xc008('0x7')]['id']);setTimeout(this[_0xc008('0xe')]['bind'](this),0x3e8);}}};Agent[_0xc008('0x19')][_0xc008('0xa')]=function(_0x209591){if(_[_0xc008('0x1a')](this['realtime'][_0xc008('0x17')][this[_0xc008('0x7')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xc008('0x7')]['id']);}else{logger[_0xc008('0xf')](_0xc008('0x1b'),this[_0xc008('0x6')]['id'],this[_0xc008('0x7')]['id']);util[_0xc008('0x1c')](this[_0xc008('0x5')],this[_0xc008('0x6')]['id'],this[_0xc008('0x8')][_0xc008('0x17')][this[_0xc008('0x7')]['id']],null,this[_0xc008('0x4')]);this['realtime'][_0xc008('0x17')][this[_0xc008('0x7')]['id']]['busy']=![];this[_0xc008('0x8')][_0xc008('0x17')][this[_0xc008('0x7')]['id']][_0xc008('0x14')]=undefined;util[_0xc008('0x1d')](this[_0xc008('0x8')],this[_0xc008('0x4')],this[_0xc008('0x7')],this[_0xc008('0x6')]['channel']);util[_0xc008('0x1e')](this[_0xc008('0x6')]['id'],this[_0xc008('0x8')][_0xc008('0x17')][this[_0xc008('0x7')]['id']],_0x209591?_0xc008('0x1f'):_0xc008('0x20'));}if(!_0x209591){setTimeout(this['push'][_0xc008('0xd')](this),0x3e8);}};function agent(_0x21763f,_0x50e1d4,_0x399b64,_0x15453c){return new Agent(_0x21763f,_0x50e1d4,_0x399b64,_0x15453c);}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 b134a23..e932b22 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 _0x3dce=['lodash','uuid','./util','routing','queue','realtime','squeue','push','handleRun','timeout','handleTimeout','bind','drained','prototype','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','agents','RINGING','busy','busyQueue','name','notificationId','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','removeWaitingNotification'];(function(_0x201b94,_0x5cada6){var _0x49da82=function(_0x503bea){while(--_0x503bea){_0x201b94['push'](_0x201b94['shift']());}};_0x49da82(++_0x5cada6);}(_0x3dce,0x1ce));var _0xe3dc=function(_0x41d42f,_0x3d1ff4){_0x41d42f=_0x41d42f-0x0;var _0x1160d7=_0x3dce[_0x41d42f];return _0x1160d7;};'use strict';var _=require(_0xe3dc('0x0'));var uuid=require(_0xe3dc('0x1'));var util=require(_0xe3dc('0x2'));var logger=require('../../../../../config/logger')(_0xe3dc('0x3'));var Beepall=function(_0x485fe9,_0x412bed,_0x74d96a,_0x54a8cd){this['notificationId']=uuid['v4']();this['squeue']=_0x485fe9;this[_0xe3dc('0x4')]=_0x412bed;this[_0xe3dc('0x5')]=_0x74d96a;this[_0xe3dc('0x3')]=_0x54a8cd;this[_0xe3dc('0x6')][_0xe3dc('0x7')](this[_0xe3dc('0x8')]['bind'](this),this['handleTimeout']['bind'](this));this[_0xe3dc('0x6')]['on'](_0xe3dc('0x9'),this[_0xe3dc('0xa')][_0xe3dc('0xb')](this));this[_0xe3dc('0x6')]['on'](_0xe3dc('0xc'),this['handleDrained'][_0xe3dc('0xb')](this));};Beepall[_0xe3dc('0xd')][_0xe3dc('0x7')]=function(){this[_0xe3dc('0x6')][_0xe3dc('0x7')](this[_0xe3dc('0x8')][_0xe3dc('0xb')](this),this[_0xe3dc('0xa')]['bind'](this));};Beepall[_0xe3dc('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0xe3dc('0xd')][_0xe3dc('0x8')]=function(){var _0x2fd010=!![];if(!_[_0xe3dc('0xe')](this['queue'])&&!_[_0xe3dc('0xe')](this['queue'][_0xe3dc('0xf')])&&this[_0xe3dc('0x4')]['Agents'][_0xe3dc('0x10')]>0x0){for(var _0x249613=0x0,_0x317a21;_0x2496130x0){for(var _0x2285b5=0x0,_0x78f484;_0x2285b50x0&&_0xded538[_0x3b3022+'CurrentCapacity']>=_0xded538[_0x3b3022+_0xfe5a('0x23')]){writeLog(_0x1c6ba7,_0xded538,_0x3b3022[_0xfe5a('0x24')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xfe5a('0x25')]=function(_0x3a4f3c,_0x31cc60,_0x2b4f1c,_0x4a0a6e,_0x42136e){return sendNotification(!![],_0x3a4f3c,_0x31cc60,_0x2b4f1c,_0x4a0a6e,_0x42136e);};exports[_0xfe5a('0x26')]=function(_0x24481f,_0x1cd531,_0x36bf20,_0x222490,_0xdbf1e0){return sendNotification(![],_0x24481f,_0x1cd531,_0x36bf20,_0x222490,_0xdbf1e0);};exports[_0xfe5a('0x27')]=function(_0x55d89e,_0x4df546,_0x712b44){var _0x485f9d=_0x4df546[_0xfe5a('0x28')][_0xfe5a('0x29')];if(!_0x485f9d&&_0x712b44){_0x485f9d=_0x712b44['id'];}var _0x11bf97=_['some'](_0x55d89e[_0x4df546['channel']+'QueuesWaitingInteractions'],function(_0x32d31e){var _0x582f2d=_['capitalize'](_0x4df546['channel'])+_0xfe5a('0x2a');return _0x32d31e[_0x582f2d]===_0x4df546[_0xfe5a('0x28')]['id'];});if(!_0x11bf97&&_0x485f9d&&_0x55d89e[_0xfe5a('0x2b')][_0x485f9d]){_0x11bf97=_[_0xfe5a('0x2c')](_0x55d89e[_0xfe5a('0x2b')][_0x485f9d][_0x4df546[_0xfe5a('0x2d')]+_0xfe5a('0x2e')],function(_0x15dbc4){return _0x15dbc4['id']===_0x4df546[_0xfe5a('0x28')]['id'];});}return _0x11bf97;};exports[_0xfe5a('0x2f')]=function(_0x14f080,_0x517969,_0x1f0c86,_0x33a8b1){if(_0x1f0c86&&_0x1f0c86['id']&&_0x14f080['agents']&&_0x14f080[_0xfe5a('0x2b')][_0x1f0c86['id']]){_0x14f080[_0xfe5a('0x2b')][_0x1f0c86['id']][_0x33a8b1+_0xfe5a('0x2e')][_0x517969[_0xfe5a('0x16')]['id']]={'id':_0x517969[_0xfe5a('0x28')]['id']};}};exports['removeWaitingNotification']=function(_0x4fefad,_0x30529d,_0x4c8b6e,_0x30fd4b){if(_0x4c8b6e&&_0x4c8b6e['id']&&_0x4fefad[_0xfe5a('0x2b')]&&_0x4fefad[_0xfe5a('0x2b')][_0x4c8b6e['id']]){delete _0x4fefad[_0xfe5a('0x2b')][_0x4c8b6e['id']][_0x30fd4b+'WaitingInteractions'][_0x30529d[_0xfe5a('0x16')]['id']];}};exports[_0xfe5a('0x30')]=writeLog; \ No newline at end of file +var _0x3a26=['hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','UserId','some','channel','QueuesWaitingInteractions','capitalize','agents','WaitingInteractions','interaction','removeWaitingNotification','lodash','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','split','\x20interaction','name','account','body','queue','msg','getMustacheRender','error','format','message','user:%s','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','Pause','PAUSE','Capacity'];(function(_0x37e262,_0x4b45ac){var _0x16f9f8=function(_0x14f237){while(--_0x14f237){_0x37e262['push'](_0x37e262['shift']());}};_0x16f9f8(++_0x4b45ac);}(_0x3a26,0x129));var _0x63a2=function(_0x261ec0,_0x57a9bd){_0x261ec0=_0x261ec0-0x0;var _0x4610f5=_0x3a26[_0x261ec0];return _0x4610f5;};'use strict';var _=require(_0x63a2('0x0'));var util=require('util');var utils=require('../utils');var Redis=require(_0x63a2('0x1'));var config=require(_0x63a2('0x2'));var logger=require(_0x63a2('0x3'))(_0x63a2('0x4'));config[_0x63a2('0x5')]=_['defaults'](config[_0x63a2('0x5')],{'host':_0x63a2('0x6'),'port':0x18eb});var io=require(_0x63a2('0x7'))(new Redis(config['redis']));function sendNotification(_0x47023e,_0xd6eecd,_0x11aa50,_0x4af218,_0x21e2b5,_0x291950){var _0x2dc9c8=_0x291950||{};var _0x325279=_0x11aa50[_0x63a2('0x8')]('.');var _0x1a5484={'uniqueid':_0xd6eecd,'channel':_0x325279[0x0],'id':_0x325279[0x1],'title':_0x325279[0x0]+_0x63a2('0x9'),'interactionId':_0x325279[0x2],'queue':_0x21e2b5?_0x21e2b5[_0x63a2('0xa')]:null,'sound':_0x2dc9c8[_0x63a2('0xb')]['notificationSound'],'shake':_0x2dc9c8['account']['notificationShake']};try{if(!_0x2dc9c8[_0x63a2('0xc')]){_0x2dc9c8[_0x63a2('0xc')]={};}if(_0x21e2b5){_0x2dc9c8[_0x63a2('0xc')][_0x63a2('0xd')]=_0x21e2b5;}else if(_0x2dc9c8['body'][_0x63a2('0xd')]){delete _0x2dc9c8[_0x63a2('0xc')][_0x63a2('0xd')];}_0x1a5484[_0x63a2('0xe')]=utils[_0x63a2('0xf')](_0x2dc9c8[_0x63a2('0xb')]['notificationTemplate'],_0x2dc9c8);}catch(_0x2b5881){_0x1a5484[_0x63a2('0xe')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x63a2('0x10')](util[_0x63a2('0x11')]('[%s][QUEUE]\x20%s',_0xd6eecd,_0x2b5881[_0x63a2('0x12')]));}io['to'](util[_0x63a2('0x11')](_0x63a2('0x13'),_0x4af218[_0x63a2('0xa')]))[_0x63a2('0x14')](util[_0x63a2('0x11')](_0x63a2('0x15'),_0x47023e?_0x63a2('0x16'):_0x63a2('0x17')),_0x1a5484);}function writeLog(_0x230224,_0x498946,_0x35f5fe){return logger[_0x63a2('0x18')](util[_0x63a2('0x11')](_0x63a2('0x19'),_0x230224,_0x498946['name'],_0x35f5fe));}exports[_0x63a2('0x1a')]=function(_0x7c6c20,_0x4edb82,_0x1d33bc,_0x57594b){if(_0x4edb82['busy']){writeLog(_0x7c6c20,_0x4edb82,_0x63a2('0x1b'));return![];}if(!_0x4edb82[_0x63a2('0x1c')]){writeLog(_0x7c6c20,_0x4edb82,'OFFLINE');return![];}if(_0x4edb82[_0x1d33bc+_0x63a2('0x1d')]){writeLog(_0x7c6c20,_0x4edb82,_0x63a2('0x1e'));return![];}if(_0x57594b&&_0x4edb82['hasOwnProperty'](_0x1d33bc+_0x63a2('0x1f'))&&_0x4edb82[_0x63a2('0x20')](_0x1d33bc+_0x63a2('0x21'))){if(_0x4edb82[_0x1d33bc+_0x63a2('0x1f')]>0x0&&_0x4edb82[_0x1d33bc+_0x63a2('0x21')]>=_0x4edb82[_0x1d33bc+_0x63a2('0x1f')]){writeLog(_0x7c6c20,_0x4edb82,_0x1d33bc[_0x63a2('0x22')]()+_0x63a2('0x23'));return![];}}return!![];};exports[_0x63a2('0x24')]=function(_0xec0a63,_0x249cc2,_0x40aa42,_0x2e6407,_0x43a439){return sendNotification(!![],_0xec0a63,_0x249cc2,_0x40aa42,_0x2e6407,_0x43a439);};exports[_0x63a2('0x25')]=function(_0x4199e9,_0x23c20a,_0x44054e,_0x403cae,_0x110da0){return sendNotification(![],_0x4199e9,_0x23c20a,_0x44054e,_0x403cae,_0x110da0);};exports['checkWaitingNotifications']=function(_0x4c0a22,_0x3ff0a9,_0x4f7bee){var _0x3db325=_0x3ff0a9['interaction'][_0x63a2('0x26')];if(!_0x3db325&&_0x4f7bee){_0x3db325=_0x4f7bee['id'];}var _0x2b548e=_[_0x63a2('0x27')](_0x4c0a22[_0x3ff0a9[_0x63a2('0x28')]+_0x63a2('0x29')],function(_0x118465){var _0x5e25da=_[_0x63a2('0x2a')](_0x3ff0a9[_0x63a2('0x28')])+'InteractionId';return _0x118465[_0x5e25da]===_0x3ff0a9['interaction']['id'];});if(!_0x2b548e&&_0x3db325&&_0x4c0a22[_0x63a2('0x2b')][_0x3db325]){_0x2b548e=_[_0x63a2('0x27')](_0x4c0a22['agents'][_0x3db325][_0x3ff0a9[_0x63a2('0x28')]+_0x63a2('0x2c')],function(_0x58bf6c){return _0x58bf6c['id']===_0x3ff0a9[_0x63a2('0x2d')]['id'];});}return _0x2b548e;};exports['saveWaitingNotification']=function(_0x15003e,_0x10a225,_0x322cea,_0x17e128){if(_0x322cea&&_0x322cea['id']&&_0x15003e[_0x63a2('0x2b')]&&_0x15003e[_0x63a2('0x2b')][_0x322cea['id']]){_0x15003e['agents'][_0x322cea['id']][_0x17e128+_0x63a2('0x2c')][_0x10a225[_0x63a2('0x12')]['id']]={'id':_0x10a225['interaction']['id']};}};exports[_0x63a2('0x2e')]=function(_0x24537f,_0x40191a,_0x3a1407,_0x44f4bf){if(_0x3a1407&&_0x3a1407['id']&&_0x24537f['agents']&&_0x24537f['agents'][_0x3a1407['id']]){delete _0x24537f[_0x63a2('0x2b')][_0x3a1407['id']][_0x44f4bf+_0x63a2('0x2c')][_0x40191a[_0x63a2('0x12')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index ddb845b..e576331 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 _0x982c=['stringify','shelljs','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x3793bb,_0x39dfdd){var _0x380006=function(_0x4d30ba){while(--_0x4d30ba){_0x3793bb['push'](_0x3793bb['shift']());}};_0x380006(++_0x39dfdd);}(_0x982c,0xd9));var _0xc982=function(_0xea2e4d,_0x1a9629){_0xea2e4d=_0xea2e4d-0x0;var _0x11a4f8=_0x982c[_0xea2e4d];return _0x11a4f8;};'use strict';var schema=require('validate');var sh=require(_0xc982('0x0'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xc982('0x1'))(_0xc982('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0xc982('0x3')}});exports[_0xc982('0x4')]=function(_0x2be21b,_0x52bf5d){return function(_0x42e462){try{var _0x56b56f={'command':_0x52bf5d[0x0]};var _0x5ad398=system[_0xc982('0x5')](_0x56b56f,{'typecast':!![]});if(_0x5ad398[_0xc982('0x6')]){logger[_0xc982('0x7')](_0xc982('0x8'),_0x2be21b,_['map'](_0x5ad398,_0xc982('0x9'))[_0xc982('0xa')](',\x20'));logger[_0xc982('0xb')](_0xc982('0xc'),_0x2be21b);_0x42e462[_0xc982('0xd')]();}else{var _0x44237d=this;var _0x5ad870=utils[_0xc982('0xe')](_0x52bf5d[0x0],this);logger[_0xc982('0xb')](_0xc982('0xf'),_0x2be21b,_0x5ad870);sh['exec'](_['trim'](_0x5ad870),function(_0x302c5f,_0xa14be9){logger['info'](_0xc982('0x10'),_0x2be21b,_0x302c5f);if(_0x302c5f==0x0){var _0x198359=_0xa14be9[_0xc982('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x52bf5d[0x1])||_[_0xc982('0x12')](_0x52bf5d[0x1])){logger['info'](_0xc982('0x13'),_0x2be21b);_0x44237d[_0xc982('0x14')][_0x52bf5d[0x1]]=_0x198359;}else{logger[_0xc982('0xb')](_0xc982('0x15'),_0x2be21b,_0x52bf5d[0x1],_0x198359);_0x44237d[_0xc982('0x14')][_0x52bf5d[0x1]]=_0x198359;}}_0x42e462[_0xc982('0xd')]();});}}catch(_0x54ee37){logger[_0xc982('0x7')](_0xc982('0x8'),_0x2be21b,_[_0xc982('0x16')](_0x54ee37)?JSON[_0xc982('0x17')](_0x54ee37):_0x54ee37);logger[_0xc982('0xb')](_0xc982('0xc'),_0x2be21b);_0x42e462[_0xc982('0xd')]();}};}; \ No newline at end of file +var _0xcaa7=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','next','validate','shelljs','./utils','../../../../config/logger','routing','string','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x4d69a6,_0x44cbe8){var _0x56739a=function(_0x50cc2c){while(--_0x50cc2c){_0x4d69a6['push'](_0x4d69a6['shift']());}};_0x56739a(++_0x44cbe8);}(_0xcaa7,0x1a5));var _0x7caa=function(_0x1383a4,_0x3dcb6e){_0x1383a4=_0x1383a4-0x0;var _0x2ac8ba=_0xcaa7[_0x1383a4];return _0x2ac8ba;};'use strict';var schema=require(_0x7caa('0x0'));var sh=require(_0x7caa('0x1'));var _=require('lodash');var utils=require(_0x7caa('0x2'));var logger=require(_0x7caa('0x3'))(_0x7caa('0x4'));var system=schema({'command':{'type':_0x7caa('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x7caa('0x6')]=function(_0x4fa4ef,_0x40a68c){return function(_0x828576){try{var _0x3900ae={'command':_0x40a68c[0x0]};var _0x6ab9f3=system[_0x7caa('0x0')](_0x3900ae,{'typecast':!![]});if(_0x6ab9f3[_0x7caa('0x7')]){logger['error'](_0x7caa('0x8'),_0x4fa4ef,_[_0x7caa('0x9')](_0x6ab9f3,_0x7caa('0xa'))[_0x7caa('0xb')](',\x20'));logger[_0x7caa('0xc')](_0x7caa('0xd'),_0x4fa4ef);_0x828576['next']();}else{var _0x194384=this;var _0x2e890c=utils['getMustacheRender'](_0x40a68c[0x0],this);logger[_0x7caa('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4fa4ef,_0x2e890c);sh[_0x7caa('0xe')](_[_0x7caa('0xf')](_0x2e890c),function(_0x7ab5b0,_0x4ee311){logger[_0x7caa('0xc')](_0x7caa('0x10'),_0x4fa4ef,_0x7ab5b0);if(_0x7ab5b0==0x0){var _0x4e69c1=_0x4ee311[_0x7caa('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x40a68c[0x1])||_[_0x7caa('0x12')](_0x40a68c[0x1])){logger[_0x7caa('0xc')](_0x7caa('0x13'),_0x4fa4ef);_0x194384[_0x7caa('0x14')][_0x40a68c[0x1]]=_0x4e69c1;}else{logger[_0x7caa('0xc')](_0x7caa('0x15'),_0x4fa4ef,_0x40a68c[0x1],_0x4e69c1);_0x194384[_0x7caa('0x14')][_0x40a68c[0x1]]=_0x4e69c1;}}_0x828576['next']();});}}catch(_0x2b184d){logger[_0x7caa('0x16')](_0x7caa('0x8'),_0x4fa4ef,_[_0x7caa('0x17')](_0x2b184d)?JSON[_0x7caa('0x18')](_0x2b184d):_0x2b184d);logger['info'](_0x7caa('0xd'),_0x4fa4ef);_0x828576[_0x7caa('0x19')]();}};}; \ 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 274c21a..cc08d66 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 _0x200e=['next','error','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x200e,0x1c5));var _0xe200=function(_0x4dc5a5,_0x2a4c10){_0x4dc5a5=_0x4dc5a5-0x0;var _0x2c748e=_0x200e[_0x4dc5a5];return _0x2c748e;};'use strict';var schema=require('validate');var _=require(_0xe200('0x0'));var rpc={'chatInteraction':require(_0xe200('0x1')),'openchannelInteraction':require(_0xe200('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xe200('0x3')),'faxInteraction':require(_0xe200('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xe200('0x5'))(_0xe200('0x6'));var tag=schema({'tag':{'type':_0xe200('0x7'),'required':!![],'message':_0xe200('0x8')}});exports['consequence']=function(_0x1854ad,_0xbdad27,_0x2b3d55,_0x11b9ff){return function(_0x398189){try{var _0x1e4643={'tag':_0xbdad27[0x0]};var _0x4b8b8f=tag['validate'](_0x1e4643,{'typecast':!![]});if(_0x4b8b8f['length']){logger['error'](_0xe200('0x9'),_0x1854ad,_[_0xe200('0xa')](_0x4b8b8f,_0xe200('0xb'))[_0xe200('0xc')](',\x20'));logger[_0xe200('0xd')](_0xe200('0xe'),_0x1854ad);_0x398189['next']();}else{var _0x5ae7f8={'ids':[_0xbdad27[0x0]]};if(rpc[_0x11b9ff[_0xe200('0xf')]+'Interaction']){rpc[_0x11b9ff[_0xe200('0xf')]+_0xe200('0x10')][_0xe200('0x11')](_0x11b9ff['interaction']['id'],_0x5ae7f8)[_0xe200('0x12')](function(_0x1613cf){logger[_0xe200('0xd')](_0xe200('0x13'),_0x1854ad,_0xbdad27[0x1],_0x11b9ff['channel'],_0x11b9ff['interaction']['id']);})[_0xe200('0x14')](function(_0x238875){logger['error']('[%s][TAG]\x20%s',_0x1854ad,JSON['stringify'](_0x238875));logger['info'](_0xe200('0xe'),_0x1854ad);})[_0xe200('0x15')](function(){_0x398189[_0xe200('0x16')]();});}}}catch(_0x49db02){logger[_0xe200('0x17')](_0xe200('0x9'),_0x1854ad,_[_0xe200('0x18')](_0x49db02)?JSON['stringify'](_0x49db02):_0x49db02);logger[_0xe200('0xd')](_0xe200('0xe'),_0x1854ad);_0x398189[_0xe200('0x16')]();}};}; \ No newline at end of file +var _0xd2bb=['../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x1fa10c,_0x5197dd){var _0x569caf=function(_0x1056f7){while(--_0x1056f7){_0x1fa10c['push'](_0x1fa10c['shift']());}};_0x569caf(++_0x5197dd);}(_0xd2bb,0xd1));var _0xbd2b=function(_0x5f7dfc,_0x3d6a09){_0x5f7dfc=_0x5f7dfc-0x0;var _0x3df70e=_0xd2bb[_0x5f7dfc];return _0x3df70e;};'use strict';var schema=require('validate');var _=require(_0xbd2b('0x0'));var rpc={'chatInteraction':require(_0xbd2b('0x1')),'openchannelInteraction':require(_0xbd2b('0x2')),'smsInteraction':require(_0xbd2b('0x3')),'mailInteraction':require(_0xbd2b('0x4')),'faxInteraction':require(_0xbd2b('0x5')),'whatsappInteraction':require(_0xbd2b('0x6'))};var logger=require(_0xbd2b('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0xbd2b('0x8')}});exports[_0xbd2b('0x9')]=function(_0xb2dfdb,_0x23e90b,_0x2a4269,_0x8f6488){return function(_0x4012bc){try{var _0x5e9928={'tag':_0x23e90b[0x0]};var _0xff1e90=tag[_0xbd2b('0xa')](_0x5e9928,{'typecast':!![]});if(_0xff1e90[_0xbd2b('0xb')]){logger[_0xbd2b('0xc')]('[%s][TAG]\x20%s',_0xb2dfdb,_[_0xbd2b('0xd')](_0xff1e90,'message')['join'](',\x20'));logger[_0xbd2b('0xe')](_0xbd2b('0xf'),_0xb2dfdb);_0x4012bc[_0xbd2b('0x10')]();}else{var _0xe7c079={'ids':[_0x23e90b[0x0]]};if(rpc[_0x8f6488[_0xbd2b('0x11')]+'Interaction']){rpc[_0x8f6488[_0xbd2b('0x11')]+_0xbd2b('0x12')][_0xbd2b('0x13')](_0x8f6488['interaction']['id'],_0xe7c079)[_0xbd2b('0x14')](function(_0x43f7f4){logger[_0xbd2b('0xe')](_0xbd2b('0x15'),_0xb2dfdb,_0x23e90b[0x1],_0x8f6488[_0xbd2b('0x11')],_0x8f6488[_0xbd2b('0x16')]['id']);})[_0xbd2b('0x17')](function(_0x194ba3){logger[_0xbd2b('0xc')](_0xbd2b('0x18'),_0xb2dfdb,JSON[_0xbd2b('0x19')](_0x194ba3));logger[_0xbd2b('0xe')](_0xbd2b('0xf'),_0xb2dfdb);})['finally'](function(){_0x4012bc[_0xbd2b('0x10')]();});}}}catch(_0x5f13d1){logger[_0xbd2b('0xc')](_0xbd2b('0x18'),_0xb2dfdb,_[_0xbd2b('0x1a')](_0x5f13d1)?JSON['stringify'](_0x5f13d1):_0x5f13d1);logger['info'](_0xbd2b('0xf'),_0xb2dfdb);_0x4012bc[_0xbd2b('0x10')]();}};}; \ 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 d0477b5..6c98f50 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 _0x71c3=['&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','consequence','\x20-\x20','replace','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','push','params','stringify','POST','application/json-rpc','then','parse','channelId='];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71c3,0x17f));var _0x371c=function(_0x4634d6,_0x387904){_0x4634d6=_0x4634d6-0x0;var _0x4ba644=_0x71c3[_0x4634d6];return _0x4ba644;};'use strict';var rp=require('request-promise');var logger=require(_0x371c('0x0'))(_0x371c('0x1'));var _=require('lodash');var arr=[];exports[_0x371c('0x2')]=function(_0x3c78dd,_0x4376cb){return function(_0x364f56){var _0x54fcfc=_0x4376cb[0xa];var _0x6a2c4a=_0x4376cb[0xb];var _0x1f03a7=_0x4376cb[0xc];var _0x9dc4f4=_0x4376cb[0xd];var _0x12ffab=_0x4376cb[0xe];var _0x5eccce=_0x4376cb[0xf]['replace'](/\n/g,_0x371c('0x3'));var _0x503528=_0x4376cb[0x10][_0x371c('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x6a2c4a)){arr['push'](_0x6a2c4a);var _0x15d4c0=_0x4376cb[0x3];var _0x188d8c=_0x4376cb[0x4];var _0x5796d6=_0x4376cb[0x1];var _0x336514=_0x4376cb[0x0];var _0x5b7a5e={};_0x5b7a5e[_0x371c('0x5')]=_0x4376cb[0x8]+_0x371c('0x6')+_0x1f03a7+'|'+_0x54fcfc+'|'+_0x9dc4f4+'|'+_0x6a2c4a+'|'+_0x12ffab;_0x5b7a5e['urlOnRing']=_0x4376cb[0x7]+'?params='+_0x1f03a7+'|'+_0x54fcfc+'|'+_0x9dc4f4+'|'+_0x6a2c4a+'|'+_0x12ffab+'|'+_0x5eccce+'|'+_0x503528;_0x5b7a5e[_0x371c('0x7')]=_0x4376cb[0x9];var _0x12e307={};_0x12e307[_0x371c('0x8')]=_0x371c('0x9');_0x12e307[_0x371c('0xa')]=_0x371c('0xb');var _0xd4afbb=[];_0xd4afbb[_0x371c('0xc')](_0x4376cb[0x2]);_0xd4afbb[_0x371c('0xc')](_0x4376cb[0x5]);_0xd4afbb['push'](_0x4376cb[0x6]);_0x12e307[_0x371c('0xd')]=_0xd4afbb;_0x12e307['id']=0x1;var _0x5bafa8=JSON[_0x371c('0xe')](_0x12e307);var _0x1953a6={'encoding':'utf8','method':_0x371c('0xf'),'timeout':0x2710,'url':_0x15d4c0,'headers':{'Content-Type':_0x371c('0x10')},'body':_0x5bafa8};return rp(_0x1953a6)[_0x371c('0x11')](function(_0x58a9c7){const _0x419281=JSON[_0x371c('0x12')](_0x58a9c7);if(!_0x419281['result']['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x16647d=_0x6a2c4a;var _0x3ddb86=_0x371c('0x13')+_0x5796d6+'&serviceId='+_0x336514+_0x371c('0x14')+_0x16647d+_0x371c('0x15')+JSON[_0x371c('0xe')](_0x5b7a5e);var _0x200fbe=_0x188d8c+'?'+_0x3ddb86;return rp(_0x200fbe);})[_0x371c('0x11')](function(_0x29c504){logger[_0x371c('0x16')](_0x371c('0x17'),_0x3c78dd,_0x29c504);_0x364f56[_0x371c('0x18')]();})[_0x371c('0x19')](function(_0x209030){logger[_0x371c('0x1a')](_0x371c('0x1b'),_0x3c78dd,_[_0x371c('0x1c')](_0x209030)?JSON[_0x371c('0xe')](_0x209030):_0x209030);_0x364f56['stop']();});}else{logger['info'](_0x371c('0x1d'),_0x3c78dd);_0x364f56[_0x371c('0x1e')]();}};}; \ No newline at end of file +var _0x9906=['urlOnRing','?params=','title','jsonrpc','login','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&data=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer'];(function(_0x4a6154,_0x207aaa){var _0x2f49d3=function(_0x51e8b3){while(--_0x51e8b3){_0x4a6154['push'](_0x4a6154['shift']());}};_0x2f49d3(++_0x207aaa);}(_0x9906,0x1b8));var _0x6990=function(_0x15e76d,_0xd86626){_0x15e76d=_0x15e76d-0x0;var _0x23e3c8=_0x9906[_0x15e76d];return _0x23e3c8;};'use strict';var rp=require(_0x6990('0x0'));var logger=require(_0x6990('0x1'))(_0x6990('0x2'));var _=require(_0x6990('0x3'));var arr=[];exports[_0x6990('0x4')]=function(_0x3bfa06,_0xa38f4e){return function(_0x380650){var _0x4e604b=_0xa38f4e[0xa];var _0x5d331e=_0xa38f4e[0xb];var _0x4019b4=_0xa38f4e[0xc];var _0x218981=_0xa38f4e[0xd];var _0x54f297=_0xa38f4e[0xe];var _0x3e6afe=_0xa38f4e[0xf][_0x6990('0x5')](/\n/g,_0x6990('0x6'));var _0x28959b=_0xa38f4e[0x10][_0x6990('0x5')](/\n/g,'\x20');if(!arr[_0x6990('0x7')](_0x5d331e)){arr[_0x6990('0x8')](_0x5d331e);var _0x23218d=_0xa38f4e[0x3];var _0x47e596=_0xa38f4e[0x4];var _0x2c9143=_0xa38f4e[0x1];var _0x4d5af1=_0xa38f4e[0x0];var _0x5e3dcb={};_0x5e3dcb[_0x6990('0x9')]=_0xa38f4e[0x8]+'?params='+_0x4019b4+'|'+_0x4e604b+'|'+_0x218981+'|'+_0x5d331e+'|'+_0x54f297;_0x5e3dcb[_0x6990('0xa')]=_0xa38f4e[0x7]+_0x6990('0xb')+_0x4019b4+'|'+_0x4e604b+'|'+_0x218981+'|'+_0x5d331e+'|'+_0x54f297+'|'+_0x3e6afe+'|'+_0x28959b;_0x5e3dcb[_0x6990('0xc')]=_0xa38f4e[0x9];var _0x34bc61={};_0x34bc61[_0x6990('0xd')]='2.0';_0x34bc61['method']=_0x6990('0xe');var _0x97efba=[];_0x97efba[_0x6990('0x8')](_0xa38f4e[0x2]);_0x97efba[_0x6990('0x8')](_0xa38f4e[0x5]);_0x97efba[_0x6990('0x8')](_0xa38f4e[0x6]);_0x34bc61['params']=_0x97efba;_0x34bc61['id']=0x1;var _0x2fde03=JSON['stringify'](_0x34bc61);var _0x23a12d={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x23218d,'headers':{'Content-Type':_0x6990('0xf')},'body':_0x2fde03};return rp(_0x23a12d)[_0x6990('0x10')](function(_0xa94d0a){const _0x535c71=JSON[_0x6990('0x11')](_0xa94d0a);if(!_0x535c71[_0x6990('0x12')][_0x6990('0x13')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x4cce5f=_0x5d331e;var _0x1e4cd0=_0x6990('0x14')+_0x2c9143+_0x6990('0x15')+_0x4d5af1+'&sessionId='+_0x4cce5f+_0x6990('0x16')+JSON[_0x6990('0x17')](_0x5e3dcb);var _0x323b7a=_0x47e596+'?'+_0x1e4cd0;return rp(_0x323b7a);})[_0x6990('0x10')](function(_0x41321d){logger['info'](_0x6990('0x18'),_0x3bfa06,_0x41321d);_0x380650[_0x6990('0x19')]();})[_0x6990('0x1a')](function(_0x4fb458){logger['error'](_0x6990('0x1b'),_0x3bfa06,_['isObject'](_0x4fb458)?JSON[_0x6990('0x17')](_0x4fb458):_0x4fb458);_0x380650[_0x6990('0x19')]();});}else{logger[_0x6990('0x1c')](_0x6990('0x1d'),_0x3bfa06);_0x380650['next']();}};}; \ 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 7fcef07..1c2c19d 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2ac4c4,_0x794e84){var _0x178b1b=function(_0x4239ff){while(--_0x4239ff){_0x2ac4c4['push'](_0x2ac4c4['shift']());}};_0x178b1b(++_0x794e84);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x18536c,_0x5965ce){var _0x560887=function(_0x236cac){while(--_0x236cac){_0x18536c['push'](_0x18536c['shift']());}};_0x560887(++_0x5965ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7cd97ae..0265671 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 _0xc2c7=['routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','./applications/','consequence','priority','Push\x20new\x20rule','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','matchPath','complete','info','Skipped\x20routing\x20for\x20%s','error','stack','routing\x20is\x20empty','agents','agent','busyQueue','emit','end','QueueReport','update','message\x20is\x20empty','busy','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2c7,0x134));var _0x7c2c=function(_0x350b6c,_0xad70c8){_0x350b6c=_0x350b6c-0x0;var _0x3d58ac=_0xc2c7[_0x350b6c];return _0x3d58ac;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var fs=require('fs');var jayson=require(_0x7c2c('0x2'));var BPromise=require(_0x7c2c('0x3'));var utils=require(_0x7c2c('0x4'));var sUtils=require(_0x7c2c('0x5'));var logger=require(_0x7c2c('0x6'))(_0x7c2c('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x7c2c('0x8')),'smsQueueReport':require(_0x7c2c('0x9')),'faxQueueReport':require(_0x7c2c('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x5a1027,_0x2274cd,_0x29638d){return util[_0x7c2c('0xb')](_0x7c2c('0xc'),_0x5a1027,_0x2274cd||0x0,_0x29638d||0x0);}function getIntervals(_0x279cff,_0x57b107){var _0x3093d2=[];if(!_[_0x7c2c('0xd')](_0x57b107[_0x7c2c('0xe')])&&!_[_0x7c2c('0xd')](_0x279cff[_0x57b107[_0x7c2c('0xe')]])&&!_[_0x7c2c('0xd')](_0x279cff[_0x57b107[_0x7c2c('0xe')]][_0x7c2c('0xf')])){_0x3093d2=_[_0x7c2c('0x10')](_0x279cff[_0x57b107[_0x7c2c('0xe')]][_0x7c2c('0xf')],_0x7c2c('0x11'));}else if(!_[_0x7c2c('0xd')](_0x57b107[_0x7c2c('0x11')])){_0x3093d2=[_0x57b107[_0x7c2c('0x11')]];}return _0x3093d2;}exports[_0x7c2c('0x12')]=function(_0x4c4aaf){_0x4c4aaf['rules']={};return new BPromise(function(_0x102778,_0xd1a3db){var _0x4678a8={'Start':function(_0x5ae94f){var _0x11424c=this;return new Promise(function(_0x206ecd,_0x5e55e0){if(_0x5ae94f){try{var _0x88f54b=[];var _0x5a5fe2=getId(_0x5ae94f[_0x7c2c('0x13')],_0x5ae94f['message']?_0x5ae94f[_0x7c2c('0x14')]['id']:0x0,_0x5ae94f[_0x7c2c('0x15')]?_0x5ae94f[_0x7c2c('0x15')]['id']:0x0);var _0x2a9539=sUtils[_0x7c2c('0x16')](_0x4c4aaf,_0x5ae94f);if(_0x5ae94f[_0x7c2c('0x17')]||!_0x2a9539&&_0x5ae94f[_0x7c2c('0x18')]&&_[_0x7c2c('0x19')](_0x5ae94f[_0x7c2c('0x18')])&&_0x5ae94f[_0x7c2c('0x18')][_0x7c2c('0x1a')]){for(var _0x2381b4=0x0;_0x2381b4<_0x5ae94f['applications'][_0x7c2c('0x1a')];_0x2381b4+=0x1){var _0x4adb62=_0x5ae94f['applications'][_0x2381b4];if(fs[_0x7c2c('0x1b')](path[_0x7c2c('0x1c')](__dirname,_0x7c2c('0x18'),_0x4adb62[_0x7c2c('0x1d')]+_0x7c2c('0x1e')))){var _0x1883b5=[];switch(_0x4adb62[_0x7c2c('0x1d')]['toLowerCase']()){case _0x7c2c('0x1f'):var _0x4dedd8=_0x4adb62[_0x7c2c('0x20')]['split'](',');if(_0x5ae94f[_0x7c2c('0x13')]===_0x7c2c('0x21')){_0x1883b5[_0x7c2c('0x22')](_0x4dedd8[0x0]);_0x1883b5['push'](_0x4dedd8[0x1]);_0x1883b5['push'](_0x4dedd8[_0x7c2c('0x23')](0x2,_0x4dedd8[_0x7c2c('0x1a')])[_0x7c2c('0x1c')](','));}else{_0x1883b5[_0x7c2c('0x22')](_0x4dedd8[0x0]);_0x1883b5[_0x7c2c('0x22')](_0x4dedd8[_0x7c2c('0x23')](0x1,_0x4dedd8[_0x7c2c('0x1a')])['join'](','));}break;case _0x7c2c('0x24'):var _0xf39941=_0x4adb62[_0x7c2c('0x20')][_0x7c2c('0x25')](',');_0x1883b5[_0x7c2c('0x22')](_0xf39941[0x0]);_0x1883b5[_0x7c2c('0x22')](_0xf39941[0x1]);_0x1883b5[_0x7c2c('0x22')](_0xf39941[_0x7c2c('0x23')](0x2,_0xf39941[_0x7c2c('0x1a')])['join'](','));break;case _0x7c2c('0x26'):var _0x3a3730=_0x4adb62[_0x7c2c('0x20')][_0x7c2c('0x25')](',');_0x1883b5['push'](_0x3a3730[0x0]);_0x1883b5[_0x7c2c('0x22')](_0x3a3730[0x1]);_0x1883b5[_0x7c2c('0x22')](_0x3a3730[0x2]);_0x1883b5[_0x7c2c('0x22')](_0x3a3730[0x3]);_0x1883b5[_0x7c2c('0x22')](_0x3a3730[_0x7c2c('0x23')](0x4,_0x3a3730[_0x7c2c('0x1a')])[_0x7c2c('0x1c')](','));break;case'amazonlex':var _0x1969f4=_0x4adb62[_0x7c2c('0x20')][_0x7c2c('0x25')](',');_0x1883b5[_0x7c2c('0x22')](_0x1969f4[0x0]);_0x1883b5[_0x7c2c('0x22')](_0x1969f4[0x1]);_0x1883b5['push'](_0x1969f4[0x2]);_0x1883b5['push'](_0x1969f4[0x3]);_0x1883b5[_0x7c2c('0x22')](_0x1969f4['slice'](0x4,_0x1969f4['length'])[_0x7c2c('0x1c')](','));break;case _0x7c2c('0x14'):_0x1883b5[_0x7c2c('0x22')](_0x4adb62[_0x7c2c('0x20')]);break;case'tag':_0x1883b5[_0x7c2c('0x22')](_0x4adb62[_0x7c2c('0x27')]);_0x1883b5[_0x7c2c('0x22')](_0x4adb62[_0x7c2c('0x20')]);break;case _0x7c2c('0x28'):var _0x6ef8c4=utils[_0x7c2c('0x29')](_0x5ae94f[_0x7c2c('0x2a')][_0x7c2c('0x2b')],_0x5ae94f);var _0x40c415=_0x4adb62[_0x7c2c('0x20')][_0x7c2c('0x25')](',');_0x1883b5[_0x7c2c('0x22')](_0x40c415[0x0]);_0x1883b5['push'](_0x40c415[0x1]);_0x1883b5['push'](_0x40c415[0x2]);_0x1883b5[_0x7c2c('0x22')](_0x40c415[0x3]);_0x1883b5['push'](_0x40c415[0x4]);_0x1883b5['push'](_0x40c415[0x5]);_0x1883b5['push'](_0x40c415[0x6]);_0x1883b5[_0x7c2c('0x22')](_0x40c415[0x7]);_0x1883b5[_0x7c2c('0x22')](_0x40c415[0x8]);_0x1883b5[_0x7c2c('0x22')](_0x40c415[0x9]);_0x1883b5[_0x7c2c('0x22')](_0x40c415[0xa]);_0x1883b5[_0x7c2c('0x22')](_0x5ae94f[_0x7c2c('0x15')]['id']);_0x1883b5[_0x7c2c('0x22')](_0x5ae94f[_0x7c2c('0x14')]['id']);_0x1883b5[_0x7c2c('0x22')](_0x4adb62[_0x7c2c('0x2c')]);_0x1883b5[_0x7c2c('0x22')](_0x5ae94f['interaction']['ContactId']);_0x1883b5[_0x7c2c('0x22')](_0x5ae94f[_0x7c2c('0x2d')][_0x7c2c('0x2d')]);_0x1883b5[_0x7c2c('0x22')](_0x6ef8c4);break;default:_0x1883b5=_['isNil'](_0x4adb62[_0x7c2c('0x20')])?[]:_0x4adb62[_0x7c2c('0x20')][_0x7c2c('0x25')](',');}var _0x45fddf={'id':util[_0x7c2c('0xb')](_0x7c2c('0x2e'),_0x5a5fe2,_0x4adb62['id'],_0x4adb62[_0x7c2c('0x1d')]),'condition':require(_0x7c2c('0x2f'))[_0x7c2c('0x30')](_0x5a5fe2,getIntervals(_0x4c4aaf['intervals'],_0x4adb62),_0x4c4aaf),'consequence':require(_0x7c2c('0x31')+_0x4adb62['app'])[_0x7c2c('0x32')](_0x5a5fe2,_0x1883b5,_0x4c4aaf,_0x5ae94f),'p':_0x4adb62[_0x7c2c('0x33')]||0x0};logger['info'](_0x7c2c('0x34'),_0x45fddf['id'],'on\x20interval',getIntervals(_0x4c4aaf[_0x7c2c('0x35')],_0x4adb62)[_0x7c2c('0x1c')](_0x7c2c('0x36')));_0x88f54b[_0x7c2c('0x22')](_0x45fddf);}else{logger['error'](_0x7c2c('0x37'),path['join'](__dirname,'applications',_0x4adb62[_0x7c2c('0x1d')]+_0x7c2c('0x1e')));}}_0x4c4aaf[_0x7c2c('0x38')][_0x5a5fe2]=new RuleEngine(_0x88f54b);_0x4c4aaf['rules'][_0x5a5fe2][_0x7c2c('0x39')](_0x5ae94f,function(_0x75c0ab){logger['info'](_0x7c2c('0x3a'),JSON['stringify'](_0x75c0ab[_0x7c2c('0x3b')]));if(_0x4c4aaf[_0x7c2c('0x38')][_0x5a5fe2]){_0x4c4aaf['rules'][_0x5a5fe2]['emit'](_0x7c2c('0x3c'));}});return _0x206ecd({'code':0xc8,'message':_0x5ae94f});}else{if(_0x2a9539){logger[_0x7c2c('0x3d')](util['format'](_0x7c2c('0x3e'),_0x5a5fe2));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x206ecd({'code':0xc8,'message':_0x5ae94f});}}catch(_0x1e3e31){logger[_0x7c2c('0x3f')](_0x1e3e31[_0x7c2c('0x40')]);return _0x5e55e0(_0x11424c[_0x7c2c('0x3f')](0x1f4,_0x1e3e31));}}return _0x5e55e0(_0x7c2c('0x41'));});},'AcceptMessage':function(_0x23121f){var _0x2b0781=this;return new Promise(function(_0x20f7d9,_0x1fb22a){if(_0x23121f['agent']&&_0x23121f['agent']['id']){if(_0x4c4aaf[_0x7c2c('0x42')][_0x23121f[_0x7c2c('0x43')]['id']]){_0x4c4aaf[_0x7c2c('0x42')][_0x23121f['agent']['id']]['busy']=![];_0x4c4aaf[_0x7c2c('0x42')][_0x23121f[_0x7c2c('0x43')]['id']][_0x7c2c('0x44')]=undefined;}}if(_0x23121f[_0x7c2c('0x14')]&&_0x23121f['message']['id']){try{var _0x4f958d=getId(_0x23121f['channel'],_0x23121f[_0x7c2c('0x14')]?_0x23121f[_0x7c2c('0x14')]['id']:0x0,_0x23121f[_0x7c2c('0x15')]?_0x23121f[_0x7c2c('0x15')]['id']:0x0);if(_0x4c4aaf[_0x7c2c('0x38')][_0x4f958d]){_0x4c4aaf['rules'][_0x4f958d][_0x7c2c('0x45')](_0x7c2c('0x46'));if(rpc[_0x23121f['channel']+_0x7c2c('0x47')]){rpc[_0x23121f['channel']+_0x7c2c('0x47')][_0x7c2c('0x48')](_0x4f958d,{'UserId':_0x23121f[_0x7c2c('0x14')]['UserId']})['catch'](function(){logger[_0x7c2c('0x3f')]('error\x20update\x20queue\x20report');});}}return _0x20f7d9({'code':0xc8,'message':_0x23121f});}catch(_0x13e0bf){logger[_0x7c2c('0x3f')](_0x13e0bf['stack']);return _0x1fb22a(_0x2b0781[_0x7c2c('0x3f')](0x1f4,_0x13e0bf));}}logger[_0x7c2c('0x3f')]('message\x20is\x20empty');return _0x1fb22a(_0x2b0781[_0x7c2c('0x3f')](0x1f4,_0x7c2c('0x49')));});},'RejectMessage':function(_0x5b242c){var _0x37fcc3=this;return new Promise(function(_0x2b5fef,_0x2901a5){if(_0x5b242c['agent']&&_0x5b242c[_0x7c2c('0x43')]['id']){try{if(_0x4c4aaf['agents'][_0x5b242c[_0x7c2c('0x43')]['id']]){_0x4c4aaf[_0x7c2c('0x42')][_0x5b242c['agent']['id']][_0x7c2c('0x4a')]=![];_0x4c4aaf[_0x7c2c('0x42')][_0x5b242c[_0x7c2c('0x43')]['id']][_0x7c2c('0x44')]=undefined;}return _0x2b5fef({'code':0xc8,'message':_0x5b242c});}catch(_0x481b9e){logger[_0x7c2c('0x3f')](_0x481b9e[_0x7c2c('0x40')]);return _0x2901a5(_0x37fcc3['error'](0x1f4,_0x481b9e));}}logger[_0x7c2c('0x3f')]('message\x20is\x20empty');return _0x2901a5(_0x37fcc3[_0x7c2c('0x3f')](0x1f4,_0x7c2c('0x49')));});},'AbandonInteraction':function(_0x26b557){var _0x375247=this;return new Promise(function(_0x35fcba,_0x529a1e){if(_0x26b557[_0x7c2c('0x13')]&&_0x26b557[_0x7c2c('0x15')]&&_0x26b557['interaction']['id']){try{var _0x53025a=getId(_0x26b557['channel'],_0x26b557[_0x7c2c('0x14')]?_0x26b557['message']['id']:0x0,_0x26b557[_0x7c2c('0x15')]?_0x26b557['interaction']['id']:0x0);if(_0x4c4aaf[_0x7c2c('0x38')][_0x53025a]){_0x4c4aaf[_0x7c2c('0x38')][_0x53025a][_0x7c2c('0x45')](_0x7c2c('0x46'));}return _0x35fcba({'code':0xc8,'message':_0x26b557});}catch(_0x3c14af){logger[_0x7c2c('0x3f')](_0x3c14af[_0x7c2c('0x40')]);return _0x529a1e(_0x375247[_0x7c2c('0x3f')](0x1f4,_0x3c14af));}}logger['error']('message\x20is\x20empty');return _0x529a1e(_0x375247['error'](0x1f4,_0x7c2c('0x49')));});},'AgentCapacity':function(_0xf8fd9b){var _0x233e9c=this;return new Promise(function(_0x299c15,_0x44602a){if(_0x4c4aaf[_0x7c2c('0x42')][_0x7c2c('0x4b')](_0xf8fd9b['id'])){for(var _0xaf61f8 in _0xf8fd9b['capacity']){if(_0xf8fd9b['capacity'][_0x7c2c('0x4b')](_0xaf61f8)){if(_0x4c4aaf[_0x7c2c('0x42')][_0xf8fd9b['id']]['hasOwnProperty'](_0xaf61f8+_0x7c2c('0x4c'))){_0x4c4aaf['agents'][_0xf8fd9b['id']][_0xaf61f8+'CurrentCapacity']=parseInt(_0xf8fd9b[_0x7c2c('0x4d')][_0xaf61f8],0xa);}}}_0x4c4aaf[_0x7c2c('0x42')][_0xf8fd9b['id']][_0x7c2c('0x4e')]();return _0x299c15({'code':0xc8,'message':_0x4c4aaf[_0x7c2c('0x42')][_0xf8fd9b['id']]});}else{return _0x44602a(_0x233e9c[_0x7c2c('0x3f')](0x1f4,_0x7c2c('0x4f')));}});},'Agents':function(_0x2d4459){return new Promise(function(_0x2a4de1){var _0xf06cd1=_[_0x7c2c('0x50')](_0x4c4aaf[_0x7c2c('0x42')]);if(_0x2d4459&&_0x2d4459['id']){var _0x43949a=_[_0x7c2c('0x51')](_0xf06cd1,function(_0x3d44f8){return _0x3d44f8['id']===_0x2d4459['id'];});_0x2a4de1(_0x43949a);}else{_0x2a4de1({'count':_0xf06cd1['length'],'rows':_0xf06cd1});}});},'ChatQueues':function(){return new Promise(function(_0x1af153){var _0x5404ec=[];for(var _0x489f2c in _0x4c4aaf['chatQueues']){if(_0x4c4aaf['chatQueues'][_0x7c2c('0x4b')](_0x489f2c)){var _0x34984b=_0x4c4aaf[_0x7c2c('0x52')][_0x489f2c];var _0x1ecc24={'id':_0x34984b['id'],'available':_0x34984b[_0x7c2c('0x53')],'loggedIn':_0x34984b[_0x7c2c('0x54')],'name':_0x34984b['name'],'paused':_0x34984b[_0x7c2c('0x55')],'waiting':_0x34984b[_0x7c2c('0x56')]};_0x5404ec[_0x7c2c('0x22')](_0x1ecc24);}}_0x1af153({'count':_0x5404ec[_0x7c2c('0x1a')],'rows':_0x5404ec});});},'MailQueues':function(){return new Promise(function(_0x19661d){var _0x43abd8=[];for(var _0x49f520 in _0x4c4aaf[_0x7c2c('0x57')]){if(_0x4c4aaf[_0x7c2c('0x57')]['hasOwnProperty'](_0x49f520)){var _0x39d319=_0x4c4aaf[_0x7c2c('0x57')][_0x49f520];var _0x53e81e={'id':_0x39d319['id'],'available':_0x39d319[_0x7c2c('0x53')],'loggedIn':_0x39d319[_0x7c2c('0x54')],'name':_0x39d319['name'],'paused':_0x39d319['paused'],'waiting':_0x39d319[_0x7c2c('0x56')]};_0x43abd8['push'](_0x53e81e);}}_0x19661d({'count':_0x43abd8[_0x7c2c('0x1a')],'rows':_0x43abd8});});},'OpenchannelQueues':function(){return new Promise(function(_0x4ee3ad){var _0x9cf4c4=[];for(var _0x1e099f in _0x4c4aaf['openchannelQueues']){if(_0x4c4aaf[_0x7c2c('0x58')]['hasOwnProperty'](_0x1e099f)){var _0x1fe241=_0x4c4aaf[_0x7c2c('0x58')][_0x1e099f];var _0x20eb63={'id':_0x1fe241['id'],'available':_0x1fe241['available'],'loggedIn':_0x1fe241[_0x7c2c('0x54')],'name':_0x1fe241[_0x7c2c('0x59')],'paused':_0x1fe241[_0x7c2c('0x55')],'waiting':_0x1fe241[_0x7c2c('0x56')]};_0x9cf4c4['push'](_0x20eb63);}}_0x4ee3ad({'count':_0x9cf4c4[_0x7c2c('0x1a')],'rows':_0x9cf4c4});});},'SmsQueues':function(){return new Promise(function(_0x1e711e){var _0x3e6d51=[];for(var _0x1d75ba in _0x4c4aaf[_0x7c2c('0x5a')]){if(_0x4c4aaf[_0x7c2c('0x5a')][_0x7c2c('0x4b')](_0x1d75ba)){var _0x3c89d1=_0x4c4aaf[_0x7c2c('0x5a')][_0x1d75ba];var _0x5300a1={'id':_0x3c89d1['id'],'available':_0x3c89d1[_0x7c2c('0x53')],'loggedIn':_0x3c89d1[_0x7c2c('0x54')],'name':_0x3c89d1['name'],'paused':_0x3c89d1[_0x7c2c('0x55')],'waiting':_0x3c89d1['waiting']};_0x3e6d51['push'](_0x5300a1);}}_0x1e711e({'count':_0x3e6d51[_0x7c2c('0x1a')],'rows':_0x3e6d51});});},'FaxQueues':function(){return new Promise(function(_0x40fc73){var _0x17a721=[];for(var _0x5561d0 in _0x4c4aaf[_0x7c2c('0x5b')]){if(_0x4c4aaf[_0x7c2c('0x5b')][_0x7c2c('0x4b')](_0x5561d0)){var _0x497825=_0x4c4aaf[_0x7c2c('0x5b')][_0x5561d0];var _0x25613b={'id':_0x497825['id'],'available':_0x497825[_0x7c2c('0x53')],'loggedIn':_0x497825[_0x7c2c('0x54')],'name':_0x497825['name'],'paused':_0x497825[_0x7c2c('0x55')],'waiting':_0x497825['waiting']};_0x17a721[_0x7c2c('0x22')](_0x25613b);}}_0x40fc73({'count':_0x17a721['length'],'rows':_0x17a721});});},'WhatsappQueues':function(){return new Promise(function(_0x1db594){var _0x2bde1a=[];for(var _0xefe398 in _0x4c4aaf[_0x7c2c('0x5c')]){if(_0x4c4aaf[_0x7c2c('0x5c')][_0x7c2c('0x4b')](_0xefe398)){var _0x1c5326=_0x4c4aaf['whatsappQueues'][_0xefe398];var _0x2f7756={'id':_0x1c5326['id'],'available':_0x1c5326[_0x7c2c('0x53')],'loggedIn':_0x1c5326[_0x7c2c('0x54')],'name':_0x1c5326[_0x7c2c('0x59')],'paused':_0x1c5326[_0x7c2c('0x55')],'waiting':_0x1c5326[_0x7c2c('0x56')]};_0x2bde1a[_0x7c2c('0x22')](_0x2f7756);}}_0x1db594({'count':_0x2bde1a[_0x7c2c('0x1a')],'rows':_0x2bde1a});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x58f018){var _0x2d75b8=_[_0x7c2c('0x50')](_0x4c4aaf[_0x7c2c('0x5d')]);_0x58f018({'count':_0x2d75b8[_0x7c2c('0x1a')],'rows':_0x2d75b8});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x11e00d){var _0x59931c=_[_0x7c2c('0x50')](_0x4c4aaf[_0x7c2c('0x5e')]);_0x11e00d({'count':_0x59931c['length'],'rows':_0x59931c});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x188339){var _0x40f2c3=_['values'](_0x4c4aaf[_0x7c2c('0x5f')]);_0x188339({'count':_0x40f2c3['length'],'rows':_0x40f2c3});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x197cac){var _0x303da4=_[_0x7c2c('0x50')](_0x4c4aaf[_0x7c2c('0x60')]);_0x197cac({'count':_0x303da4[_0x7c2c('0x1a')],'rows':_0x303da4});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x15297d){var _0x3fe323=_['values'](_0x4c4aaf[_0x7c2c('0x61')]);_0x15297d({'count':_0x3fe323[_0x7c2c('0x1a')],'rows':_0x3fe323});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x53c18a){var _0x33b491=_[_0x7c2c('0x50')](_0x4c4aaf[_0x7c2c('0x62')]);_0x53c18a({'count':_0x33b491[_0x7c2c('0x1a')],'rows':_0x33b491});});}};var _0x1289c6=jayson[_0x7c2c('0x63')](_0x4678a8)[_0x7c2c('0x64')]();_0x1289c6['on'](_0x7c2c('0x3f'),function(_0x14fcb5){logger[_0x7c2c('0x3f')](JSON[_0x7c2c('0x65')](_0x14fcb5));return _0xd1a3db(_0x14fcb5);});_0x1289c6[_0x7c2c('0x12')](0x232c,_0x7c2c('0x66'),function(){console[_0x7c2c('0x67')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x102778(_0x7c2c('0x68')+0x232c);});});}; \ No newline at end of file +var _0x63d4=['push','slice','dialogflow','appdata','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','busy','agents','busyQueue','QueueReport','update','error','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','stringify','log','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','split'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63d4,0x117));var _0x463d=function(_0x248d29,_0x1c8e46){_0x248d29=_0x248d29-0x0;var _0xf8a46a=_0x63d4[_0x248d29];return _0xf8a46a;};'use strict';var _=require(_0x463d('0x0'));var util=require(_0x463d('0x1'));var path=require(_0x463d('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x463d('0x3'));var utils=require(_0x463d('0x4'));var sUtils=require(_0x463d('0x5'));var logger=require(_0x463d('0x6'))(_0x463d('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x463d('0x8')),'chatQueueReport':require(_0x463d('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x463d('0xa')),'whatsappQueueReport':require(_0x463d('0xb'))};var RuleEngine=require(_0x463d('0xc'));function getId(_0x41dc01,_0x218286,_0x4d32fb){return util[_0x463d('0xd')]('%s.%s.%s',_0x41dc01,_0x218286||0x0,_0x4d32fb||0x0);}function getIntervals(_0x42b27e,_0x2d714b){var _0x1f5d4a=[];if(!_[_0x463d('0xe')](_0x2d714b['IntervalId'])&&!_['isNil'](_0x42b27e[_0x2d714b[_0x463d('0xf')]])&&!_['isNil'](_0x42b27e[_0x2d714b[_0x463d('0xf')]][_0x463d('0x10')])){_0x1f5d4a=_[_0x463d('0x11')](_0x42b27e[_0x2d714b[_0x463d('0xf')]][_0x463d('0x10')],_0x463d('0x12'));}else if(!_[_0x463d('0xe')](_0x2d714b['interval'])){_0x1f5d4a=[_0x2d714b[_0x463d('0x12')]];}return _0x1f5d4a;}exports[_0x463d('0x13')]=function(_0x436dba){_0x436dba['rules']={};return new BPromise(function(_0x8956d3,_0xea6080){var _0x10f5f7={'Start':function(_0x1932e6){var _0x37b3f6=this;return new Promise(function(_0x46896c,_0x53c8c6){if(_0x1932e6){try{var _0x1372ff=[];var _0x48c1e1=getId(_0x1932e6[_0x463d('0x14')],_0x1932e6[_0x463d('0x15')]?_0x1932e6[_0x463d('0x15')]['id']:0x0,_0x1932e6[_0x463d('0x16')]?_0x1932e6[_0x463d('0x16')]['id']:0x0);var _0x36ea11=sUtils['checkWaitingNotifications'](_0x436dba,_0x1932e6);if(_0x1932e6[_0x463d('0x17')]||!_0x36ea11&&_0x1932e6[_0x463d('0x18')]&&_[_0x463d('0x19')](_0x1932e6[_0x463d('0x18')])&&_0x1932e6[_0x463d('0x18')][_0x463d('0x1a')]){for(var _0x945ea0=0x0;_0x945ea0<_0x1932e6[_0x463d('0x18')][_0x463d('0x1a')];_0x945ea0+=0x1){var _0x622b48=_0x1932e6[_0x463d('0x18')][_0x945ea0];if(fs[_0x463d('0x1b')](path[_0x463d('0x1c')](__dirname,_0x463d('0x18'),_0x622b48[_0x463d('0x1d')]+'.js'))){var _0x19e3eb=[];switch(_0x622b48['app'][_0x463d('0x1e')]()){case _0x463d('0x1f'):var _0x541aa9=_0x622b48['appdata'][_0x463d('0x20')](',');if(_0x1932e6[_0x463d('0x14')]==='mail'){_0x19e3eb[_0x463d('0x21')](_0x541aa9[0x0]);_0x19e3eb['push'](_0x541aa9[0x1]);_0x19e3eb[_0x463d('0x21')](_0x541aa9[_0x463d('0x22')](0x2,_0x541aa9[_0x463d('0x1a')])['join'](','));}else{_0x19e3eb[_0x463d('0x21')](_0x541aa9[0x0]);_0x19e3eb[_0x463d('0x21')](_0x541aa9[_0x463d('0x22')](0x1,_0x541aa9[_0x463d('0x1a')])[_0x463d('0x1c')](','));}break;case _0x463d('0x23'):var _0xbff8e0=_0x622b48['appdata']['split'](',');_0x19e3eb[_0x463d('0x21')](_0xbff8e0[0x0]);_0x19e3eb['push'](_0xbff8e0[0x1]);_0x19e3eb[_0x463d('0x21')](_0xbff8e0[_0x463d('0x22')](0x2,_0xbff8e0[_0x463d('0x1a')])[_0x463d('0x1c')](','));break;case'dialogflowv2':var _0x169f60=_0x622b48[_0x463d('0x24')][_0x463d('0x20')](',');_0x19e3eb[_0x463d('0x21')](_0x169f60[0x0]);_0x19e3eb[_0x463d('0x21')](_0x169f60[0x1]);_0x19e3eb['push'](_0x169f60[0x2]);_0x19e3eb[_0x463d('0x21')](_0x169f60[0x3]);_0x19e3eb[_0x463d('0x21')](_0x169f60['slice'](0x4,_0x169f60[_0x463d('0x1a')])['join'](','));break;case _0x463d('0x25'):var _0x295283=_0x622b48[_0x463d('0x24')][_0x463d('0x20')](',');_0x19e3eb[_0x463d('0x21')](_0x295283[0x0]);_0x19e3eb['push'](_0x295283[0x1]);_0x19e3eb[_0x463d('0x21')](_0x295283[0x2]);_0x19e3eb[_0x463d('0x21')](_0x295283[0x3]);_0x19e3eb[_0x463d('0x21')](_0x295283[_0x463d('0x22')](0x4,_0x295283[_0x463d('0x1a')])[_0x463d('0x1c')](','));break;case _0x463d('0x15'):_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x24')]);break;case _0x463d('0x26'):_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x27')]);_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x24')]);break;case _0x463d('0x28'):var _0x5d2624=utils[_0x463d('0x29')](_0x1932e6[_0x463d('0x2a')][_0x463d('0x2b')],_0x1932e6);var _0x3b1225=_0x622b48[_0x463d('0x24')][_0x463d('0x20')](',');_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x0]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x1]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x2]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x3]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x4]);_0x19e3eb['push'](_0x3b1225[0x5]);_0x19e3eb['push'](_0x3b1225[0x6]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x7]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x8]);_0x19e3eb['push'](_0x3b1225[0x9]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0xa]);_0x19e3eb['push'](_0x1932e6['interaction']['id']);_0x19e3eb[_0x463d('0x21')](_0x1932e6['message']['id']);_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x2c')]);_0x19e3eb['push'](_0x1932e6[_0x463d('0x16')][_0x463d('0x2d')]);_0x19e3eb[_0x463d('0x21')](_0x1932e6[_0x463d('0x2e')][_0x463d('0x2e')]);_0x19e3eb[_0x463d('0x21')](_0x5d2624);break;default:_0x19e3eb=_[_0x463d('0xe')](_0x622b48['appdata'])?[]:_0x622b48['appdata'][_0x463d('0x20')](',');}var _0x1a262f={'id':util[_0x463d('0xd')]('%s:%s:%s',_0x48c1e1,_0x622b48['id'],_0x622b48['app']),'condition':require(_0x463d('0x2f'))['condition'](_0x48c1e1,getIntervals(_0x436dba[_0x463d('0x30')],_0x622b48),_0x436dba),'consequence':require(_0x463d('0x31')+_0x622b48[_0x463d('0x1d')])[_0x463d('0x32')](_0x48c1e1,_0x19e3eb,_0x436dba,_0x1932e6),'p':_0x622b48[_0x463d('0x33')]||0x0};logger[_0x463d('0x34')]('Push\x20new\x20rule',_0x1a262f['id'],_0x463d('0x35'),getIntervals(_0x436dba['intervals'],_0x622b48)[_0x463d('0x1c')](_0x463d('0x36')));_0x1372ff['push'](_0x1a262f);}else{logger['error'](_0x463d('0x37'),path[_0x463d('0x1c')](__dirname,'applications',_0x622b48['app']+_0x463d('0x38')));}}_0x436dba['rules'][_0x48c1e1]=new RuleEngine(_0x1372ff);_0x436dba[_0x463d('0x39')][_0x48c1e1][_0x463d('0x3a')](_0x1932e6,function(_0xf1113d){logger[_0x463d('0x34')](_0x463d('0x3b'),JSON['stringify'](_0xf1113d[_0x463d('0x3c')]));if(_0x436dba[_0x463d('0x39')][_0x48c1e1]){_0x436dba[_0x463d('0x39')][_0x48c1e1][_0x463d('0x3d')](_0x463d('0x3e'));}});return _0x46896c({'code':0xc8,'message':_0x1932e6});}else{if(_0x36ea11){logger[_0x463d('0x34')](util[_0x463d('0xd')](_0x463d('0x3f'),_0x48c1e1));}else{logger['info'](_0x463d('0x40'));}return _0x46896c({'code':0xc8,'message':_0x1932e6});}}catch(_0x5a7469){logger['error'](_0x5a7469['stack']);return _0x53c8c6(_0x37b3f6['error'](0x1f4,_0x5a7469));}}return _0x53c8c6(_0x463d('0x41'));});},'AcceptMessage':function(_0x1739e8){var _0x3a9208=this;return new Promise(function(_0x2c50df,_0x19e45f){if(_0x1739e8[_0x463d('0x42')]&&_0x1739e8[_0x463d('0x42')]['id']){if(_0x436dba['agents'][_0x1739e8[_0x463d('0x42')]['id']]){_0x436dba['agents'][_0x1739e8[_0x463d('0x42')]['id']][_0x463d('0x43')]=![];_0x436dba[_0x463d('0x44')][_0x1739e8[_0x463d('0x42')]['id']][_0x463d('0x45')]=undefined;}}if(_0x1739e8[_0x463d('0x15')]&&_0x1739e8[_0x463d('0x15')]['id']){try{var _0x212a78=getId(_0x1739e8[_0x463d('0x14')],_0x1739e8['message']?_0x1739e8[_0x463d('0x15')]['id']:0x0,_0x1739e8[_0x463d('0x16')]?_0x1739e8[_0x463d('0x16')]['id']:0x0);if(_0x436dba['rules'][_0x212a78]){_0x436dba['rules'][_0x212a78][_0x463d('0x3d')]('end');if(rpc[_0x1739e8[_0x463d('0x14')]+_0x463d('0x46')]){rpc[_0x1739e8[_0x463d('0x14')]+'QueueReport'][_0x463d('0x47')](_0x212a78,{'UserId':_0x1739e8[_0x463d('0x15')]['UserId']})['catch'](function(){logger[_0x463d('0x48')](_0x463d('0x49'));});}}return _0x2c50df({'code':0xc8,'message':_0x1739e8});}catch(_0x217e9c){logger[_0x463d('0x48')](_0x217e9c[_0x463d('0x4a')]);return _0x19e45f(_0x3a9208[_0x463d('0x48')](0x1f4,_0x217e9c));}}logger[_0x463d('0x48')](_0x463d('0x4b'));return _0x19e45f(_0x3a9208[_0x463d('0x48')](0x1f4,_0x463d('0x4b')));});},'RejectMessage':function(_0x519726){var _0x52dc25=this;return new Promise(function(_0x2c8d1e,_0x5df723){if(_0x519726['agent']&&_0x519726['agent']['id']){try{if(_0x436dba[_0x463d('0x44')][_0x519726[_0x463d('0x42')]['id']]){_0x436dba[_0x463d('0x44')][_0x519726['agent']['id']][_0x463d('0x43')]=![];_0x436dba[_0x463d('0x44')][_0x519726['agent']['id']][_0x463d('0x45')]=undefined;}return _0x2c8d1e({'code':0xc8,'message':_0x519726});}catch(_0x841eed){logger['error'](_0x841eed[_0x463d('0x4a')]);return _0x5df723(_0x52dc25[_0x463d('0x48')](0x1f4,_0x841eed));}}logger[_0x463d('0x48')]('message\x20is\x20empty');return _0x5df723(_0x52dc25['error'](0x1f4,_0x463d('0x4b')));});},'AbandonInteraction':function(_0x12b840){var _0x46aa8a=this;return new Promise(function(_0x3a3b97,_0x1c87c4){if(_0x12b840['channel']&&_0x12b840[_0x463d('0x16')]&&_0x12b840[_0x463d('0x16')]['id']){try{var _0x2acb3a=getId(_0x12b840[_0x463d('0x14')],_0x12b840[_0x463d('0x15')]?_0x12b840[_0x463d('0x15')]['id']:0x0,_0x12b840['interaction']?_0x12b840[_0x463d('0x16')]['id']:0x0);if(_0x436dba['rules'][_0x2acb3a]){_0x436dba[_0x463d('0x39')][_0x2acb3a]['emit'](_0x463d('0x4c'));}return _0x3a3b97({'code':0xc8,'message':_0x12b840});}catch(_0x49796f){logger['error'](_0x49796f[_0x463d('0x4a')]);return _0x1c87c4(_0x46aa8a[_0x463d('0x48')](0x1f4,_0x49796f));}}logger['error'](_0x463d('0x4b'));return _0x1c87c4(_0x46aa8a[_0x463d('0x48')](0x1f4,_0x463d('0x4b')));});},'AgentCapacity':function(_0x4fe704){var _0x41dd68=this;return new Promise(function(_0x522261,_0x12b1a7){if(_0x436dba['agents'][_0x463d('0x4d')](_0x4fe704['id'])){for(var _0x159855 in _0x4fe704[_0x463d('0x4e')]){if(_0x4fe704['capacity']['hasOwnProperty'](_0x159855)){if(_0x436dba['agents'][_0x4fe704['id']]['hasOwnProperty'](_0x159855+'CurrentCapacity')){_0x436dba['agents'][_0x4fe704['id']][_0x159855+_0x463d('0x4f')]=parseInt(_0x4fe704['capacity'][_0x159855],0xa);}}}_0x436dba[_0x463d('0x44')][_0x4fe704['id']][_0x463d('0x50')]();return _0x522261({'code':0xc8,'message':_0x436dba[_0x463d('0x44')][_0x4fe704['id']]});}else{return _0x12b1a7(_0x41dd68['error'](0x1f4,_0x463d('0x51')));}});},'Agents':function(_0x1e22ab){return new Promise(function(_0x2c02b4){var _0x2c6a27=_[_0x463d('0x52')](_0x436dba[_0x463d('0x44')]);if(_0x1e22ab&&_0x1e22ab['id']){var _0xdbee4c=_[_0x463d('0x53')](_0x2c6a27,function(_0x53a0a7){return _0x53a0a7['id']===_0x1e22ab['id'];});_0x2c02b4(_0xdbee4c);}else{_0x2c02b4({'count':_0x2c6a27['length'],'rows':_0x2c6a27});}});},'ChatQueues':function(){return new Promise(function(_0x461962){var _0x24f773=[];for(var _0x104085 in _0x436dba['chatQueues']){if(_0x436dba[_0x463d('0x54')][_0x463d('0x4d')](_0x104085)){var _0x4dfd9a=_0x436dba[_0x463d('0x54')][_0x104085];var _0xb60bc4={'id':_0x4dfd9a['id'],'available':_0x4dfd9a['available'],'loggedIn':_0x4dfd9a[_0x463d('0x55')],'name':_0x4dfd9a[_0x463d('0x56')],'paused':_0x4dfd9a[_0x463d('0x57')],'waiting':_0x4dfd9a[_0x463d('0x58')]};_0x24f773[_0x463d('0x21')](_0xb60bc4);}}_0x461962({'count':_0x24f773[_0x463d('0x1a')],'rows':_0x24f773});});},'MailQueues':function(){return new Promise(function(_0x3bf69d){var _0x1704ad=[];for(var _0x39a157 in _0x436dba[_0x463d('0x59')]){if(_0x436dba[_0x463d('0x59')][_0x463d('0x4d')](_0x39a157)){var _0xd222cc=_0x436dba[_0x463d('0x59')][_0x39a157];var _0x4d52fb={'id':_0xd222cc['id'],'available':_0xd222cc[_0x463d('0x5a')],'loggedIn':_0xd222cc[_0x463d('0x55')],'name':_0xd222cc[_0x463d('0x56')],'paused':_0xd222cc['paused'],'waiting':_0xd222cc[_0x463d('0x58')]};_0x1704ad[_0x463d('0x21')](_0x4d52fb);}}_0x3bf69d({'count':_0x1704ad[_0x463d('0x1a')],'rows':_0x1704ad});});},'OpenchannelQueues':function(){return new Promise(function(_0x55967e){var _0x37c906=[];for(var _0x530f24 in _0x436dba[_0x463d('0x5b')]){if(_0x436dba['openchannelQueues'][_0x463d('0x4d')](_0x530f24)){var _0x1e803=_0x436dba['openchannelQueues'][_0x530f24];var _0x4c0c3b={'id':_0x1e803['id'],'available':_0x1e803['available'],'loggedIn':_0x1e803[_0x463d('0x55')],'name':_0x1e803['name'],'paused':_0x1e803['paused'],'waiting':_0x1e803['waiting']};_0x37c906[_0x463d('0x21')](_0x4c0c3b);}}_0x55967e({'count':_0x37c906[_0x463d('0x1a')],'rows':_0x37c906});});},'SmsQueues':function(){return new Promise(function(_0x569b70){var _0x3a836e=[];for(var _0x1dc89c in _0x436dba['smsQueues']){if(_0x436dba[_0x463d('0x5c')]['hasOwnProperty'](_0x1dc89c)){var _0x56e860=_0x436dba[_0x463d('0x5c')][_0x1dc89c];var _0x1e4dd4={'id':_0x56e860['id'],'available':_0x56e860['available'],'loggedIn':_0x56e860['loggedIn'],'name':_0x56e860['name'],'paused':_0x56e860[_0x463d('0x57')],'waiting':_0x56e860['waiting']};_0x3a836e[_0x463d('0x21')](_0x1e4dd4);}}_0x569b70({'count':_0x3a836e[_0x463d('0x1a')],'rows':_0x3a836e});});},'FaxQueues':function(){return new Promise(function(_0x2718df){var _0x1a6198=[];for(var _0x8ff96c in _0x436dba[_0x463d('0x5d')]){if(_0x436dba['faxQueues'][_0x463d('0x4d')](_0x8ff96c)){var _0x51f792=_0x436dba[_0x463d('0x5d')][_0x8ff96c];var _0x52d478={'id':_0x51f792['id'],'available':_0x51f792[_0x463d('0x5a')],'loggedIn':_0x51f792[_0x463d('0x55')],'name':_0x51f792['name'],'paused':_0x51f792[_0x463d('0x57')],'waiting':_0x51f792[_0x463d('0x58')]};_0x1a6198[_0x463d('0x21')](_0x52d478);}}_0x2718df({'count':_0x1a6198[_0x463d('0x1a')],'rows':_0x1a6198});});},'WhatsappQueues':function(){return new Promise(function(_0x447af1){var _0x4a4fa0=[];for(var _0x1b4bd7 in _0x436dba[_0x463d('0x5e')]){if(_0x436dba[_0x463d('0x5e')][_0x463d('0x4d')](_0x1b4bd7)){var _0x528543=_0x436dba[_0x463d('0x5e')][_0x1b4bd7];var _0x2cd216={'id':_0x528543['id'],'available':_0x528543[_0x463d('0x5a')],'loggedIn':_0x528543['loggedIn'],'name':_0x528543[_0x463d('0x56')],'paused':_0x528543[_0x463d('0x57')],'waiting':_0x528543[_0x463d('0x58')]};_0x4a4fa0[_0x463d('0x21')](_0x2cd216);}}_0x447af1({'count':_0x4a4fa0[_0x463d('0x1a')],'rows':_0x4a4fa0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x572af3){var _0x4ac764=_[_0x463d('0x52')](_0x436dba[_0x463d('0x5f')]);_0x572af3({'count':_0x4ac764['length'],'rows':_0x4ac764});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x13df4b){var _0x37e2ee=_['values'](_0x436dba[_0x463d('0x60')]);_0x13df4b({'count':_0x37e2ee[_0x463d('0x1a')],'rows':_0x37e2ee});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4b1d27){var _0x3cf9a5=_[_0x463d('0x52')](_0x436dba[_0x463d('0x61')]);_0x4b1d27({'count':_0x3cf9a5[_0x463d('0x1a')],'rows':_0x3cf9a5});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x52bf5e){var _0x481d86=_['values'](_0x436dba[_0x463d('0x62')]);_0x52bf5e({'count':_0x481d86['length'],'rows':_0x481d86});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2e9bef){var _0x45eeff=_[_0x463d('0x52')](_0x436dba[_0x463d('0x63')]);_0x2e9bef({'count':_0x45eeff['length'],'rows':_0x45eeff});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4c825b){var _0x47f519=_['values'](_0x436dba[_0x463d('0x64')]);_0x4c825b({'count':_0x47f519[_0x463d('0x1a')],'rows':_0x47f519});});}};var _0x28afb3=jayson['server'](_0x10f5f7)['http']();_0x28afb3['on'](_0x463d('0x48'),function(_0x139e5c){logger[_0x463d('0x48')](JSON[_0x463d('0x65')](_0x139e5c));return _0xea6080(_0x139e5c);});_0x28afb3[_0x463d('0x13')](0x232c,'127.0.0.1',function(){console[_0x463d('0x66')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x8956d3(_0x463d('0x67')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index b82bd0f..22f53f4 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 _0x3a0c=['routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','../../../utils/iftime','iftime','../../../config/logger'];(function(_0x54c72c,_0x4a6360){var _0x5e961a=function(_0x51cc86){while(--_0x51cc86){_0x54c72c['push'](_0x54c72c['shift']());}};_0x5e961a(++_0x4a6360);}(_0x3a0c,0x1cc));var _0xc3a0=function(_0x1b4d0c,_0x5f1350){_0x1b4d0c=_0x1b4d0c-0x0;var _0x30d5b7=_0x3a0c[_0x1b4d0c];return _0x30d5b7;};'use strict';var _=require(_0xc3a0('0x0'));var iftime=require(_0xc3a0('0x1'))[_0xc3a0('0x2')];var logger=require(_0xc3a0('0x3'))(_0xc3a0('0x4'));exports[_0xc3a0('0x5')]=function(_0x44c972,_0x2d2bc3,_0x24e0f8){return function(_0x543835){if(_0x24e0f8[_0xc3a0('0x6')]&&!_0x24e0f8[_0xc3a0('0x6')][_0x44c972]){logger[_0xc3a0('0x7')](_0xc3a0('0x8'),_0x44c972);return _0x543835[_0xc3a0('0x9')]();}var _0x20c912=_0x2d2bc3[_0xc3a0('0xa')](function(_0x38f399){return iftime(_0x38f399);});var _0x30459b=_[_0xc3a0('0xb')](_0x20c912);if(_0x30459b){logger['info'](_0xc3a0('0xc'),_0x44c972,_0x2d2bc3['join'](_0xc3a0('0xd')),_0x30459b);_0x543835[_0xc3a0('0xe')](_0x30459b);}else{logger[_0xc3a0('0x7')](_0xc3a0('0xf'),_0x44c972,_0x2d2bc3['join'](_0xc3a0('0xd')));_0x543835[_0xc3a0('0x9')]();}};}; \ No newline at end of file +var _0x0f8c=['../../../utils/iftime','iftime','routing','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','info','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0f8c,0xdf));var _0xc0f8=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x0f8c[_0xf04c6d];return _0x4a804e;};'use strict';var _=require(_0xc0f8('0x0'));var iftime=require(_0xc0f8('0x1'))[_0xc0f8('0x2')];var logger=require('../../../config/logger')(_0xc0f8('0x3'));exports[_0xc0f8('0x4')]=function(_0x17c771,_0x2e8187,_0x4adc4d){return function(_0x41fc57){if(_0x4adc4d[_0xc0f8('0x5')]&&!_0x4adc4d['rules'][_0x17c771]){logger['info'](_0xc0f8('0x6'),_0x17c771);return _0x41fc57[_0xc0f8('0x7')]();}var _0x35b9a3=_0x2e8187[_0xc0f8('0x8')](function(_0x21d0e9){return iftime(_0x21d0e9);});var _0x3884e=_['some'](_0x35b9a3);if(_0x3884e){logger[_0xc0f8('0x9')](_0xc0f8('0xa'),_0x17c771,_0x2e8187[_0xc0f8('0xb')](_0xc0f8('0xc')),_0x3884e);_0x41fc57[_0xc0f8('0xd')](_0x3884e);}else{logger[_0xc0f8('0x9')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x17c771,_0x2e8187['join'](_0xc0f8('0xc')));_0x41fc57[_0xc0f8('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7664610..daeba05 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 _0xac4a=['now','lastevent','called','connectedlinename','format','membername','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','calleridnum','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','uniqueid','channel','queue','interface','connectedlinenum','getVoiceQueueByName','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x50d540,_0x51eb3b){var _0x58e6a6=function(_0x2504b3){while(--_0x2504b3){_0x50d540['push'](_0x50d540['shift']());}};_0x58e6a6(++_0x51eb3b);}(_0xac4a,0x13f));var _0xaac4=function(_0x1e97e9,_0x3dcb75){_0x1e97e9=_0x1e97e9-0x0;var _0x3074a1=_0xac4a[_0x1e97e9];return _0x3074a1;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var utils=require(_0xaac4('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x132fc3,_0x38f4f4){utils[_0xaac4('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x132fc3[_0xaac4('0x4')],_0x132fc3[_0xaac4('0x5')],_0x132fc3[_0xaac4('0x6')],_0x132fc3['membername'],_0x132fc3[_0xaac4('0x7')],_0x132fc3['calleridnum'],_0x132fc3[_0xaac4('0x8')],_0x132fc3['lastevent']));if(_0x132fc3[_0xaac4('0x6')]){utils[_0xaac4('0x9')](_0x132fc3['queue'])['then'](function(_0x349671){if(_0x349671){_0x132fc3['type']=_0x349671[_0xaac4('0xa')];_0x132fc3['agentacw']=_0x132fc3['agentcomplete']?_0x349671[_0xaac4('0xb')]:![];_0x132fc3[_0xaac4('0xc')]=_0x132fc3[_0xaac4('0xd')]?_0x349671[_0xaac4('0xe')]:0x0;}utils[_0xaac4('0xf')]('CreateVoiceAgentReport',_0x132fc3);});}else{utils['request'](_0xaac4('0x10'),_0x132fc3);}if(_0x38f4f4){delete transfers[_0x132fc3[_0xaac4('0x4')]];}else{delete agents[_0x132fc3[_0xaac4('0x11')]];}}exports['agentcalled']=function(_0x6a808d){try{utils[_0xaac4('0x12')](util['format'](_0xaac4('0x13'),_0x6a808d[_0xaac4('0x4')]),_0x6a808d);agents[_0x6a808d[_0xaac4('0x11')]]=_0x6a808d;agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x14')]=utils[_0xaac4('0x15')]();agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x16')]=_0xaac4('0x17');agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x8')]=null;agents[_0x6a808d[_0xaac4('0x11')]][_0xaac4('0x18')]=null;utils['info'](util[_0xaac4('0x19')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x6a808d[_0xaac4('0x4')],agents[_0x6a808d['destuniqueid']][_0xaac4('0x1a')],_0x6a808d[_0xaac4('0x11')]));}catch(_0xa22b76){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x13'),_0x6a808d[_0xaac4('0x4')]),_0xa22b76);}};exports[_0xaac4('0x1c')]=function(_0x4166ee){try{if(!_['isNil'](agents[_0x4166ee[_0xaac4('0x11')]])){utils['debug'](util[_0xaac4('0x19')](_0xaac4('0x1d'),_0x4166ee[_0xaac4('0x4')]),_0x4166ee);utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x1e'),_0x4166ee['uniqueid'],agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1a')],_0x4166ee[_0xaac4('0x11')]));agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1c')]=!![];agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x1f')]=utils['now']();agents[_0x4166ee[_0xaac4('0x11')]]['lastevent']='timeout';agents[_0x4166ee['destuniqueid']]['reason']=_0xaac4('0x20');agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x21')]=_0x4166ee[_0xaac4('0x22')]?parseInt(_0x4166ee[_0xaac4('0x22')])/0x3e8:0x0;agents[_0x4166ee[_0xaac4('0x11')]][_0xaac4('0x23')]=0x0;unanswered[_0xaac4('0x24')](_0x4166ee[_0xaac4('0x11')]);}}catch(_0x386c9b){utils['error'](util[_0xaac4('0x19')](_0xaac4('0x1d'),_0x4166ee[_0xaac4('0x4')]),_0x386c9b);}};exports[_0xaac4('0x25')]=function(_0x669b34){try{_[_0xaac4('0x26')](agents,function(_0x5e469a,_0xcf6c1){if(_0x5e469a['uniqueid']==_0x669b34[_0xaac4('0x4')]&&!_[_0xaac4('0x27')](unanswered,_0x5e469a[_0xaac4('0x11')])){utils[_0xaac4('0x12')](util['format']('[%s][agents][queuecallerabandon]',_0x669b34['uniqueid']),_0x669b34);utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x28'),_0x669b34[_0xaac4('0x4')],_0x5e469a[_0xaac4('0x1a')],_0x5e469a[_0xaac4('0x11')]));_0x5e469a[_0xaac4('0x1c')]=!![];_0x5e469a[_0xaac4('0x1f')]=utils[_0xaac4('0x15')]();_0x5e469a[_0xaac4('0x16')]=_0xaac4('0x29');_0x5e469a[_0xaac4('0x2a')]=_0xaac4('0x29');_0x5e469a[_0xaac4('0x21')]=_0x669b34[_0xaac4('0x21')];_0x5e469a['talktime']=0x0;writeDB(_0x5e469a);}});}catch(_0x5bad9f){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x2b'),_0x669b34['uniqueid']),_0x5bad9f);}};exports[_0xaac4('0x2c')]=function(_0x16fae8){try{if(agents[_0x16fae8[_0xaac4('0x11')]]){utils[_0xaac4('0x12')](util[_0xaac4('0x19')](_0xaac4('0x2d'),_0x16fae8[_0xaac4('0x4')]),_0x16fae8);utils['info'](util[_0xaac4('0x19')](_0xaac4('0x2e'),_0x16fae8[_0xaac4('0x4')],agents[_0x16fae8['destuniqueid']][_0xaac4('0x1a')],_0x16fae8['destuniqueid']));agents[_0x16fae8['destuniqueid']][_0xaac4('0x2f')]=utils[_0xaac4('0x15')]();agents[_0x16fae8[_0xaac4('0x11')]]['connectedlinenum']=_0x16fae8['connectedlinenum'];agents[_0x16fae8[_0xaac4('0x11')]][_0xaac4('0x18')]=_0x16fae8[_0xaac4('0x18')];agents[_0x16fae8[_0xaac4('0x11')]][_0xaac4('0x21')]=_0x16fae8[_0xaac4('0x22')];agents[_0x16fae8['destuniqueid']]['lastevent']=_0xaac4('0x30');_[_0xaac4('0x26')](agents,function(_0x5371b4,_0x416a5b){if(_0x5371b4[_0xaac4('0x11')]!=_0x16fae8[_0xaac4('0x11')]&&_0x5371b4['uniqueid']==_0x16fae8[_0xaac4('0x4')]){_0x5371b4[_0xaac4('0x23')]=0x0;_0x5371b4[_0xaac4('0x21')]=_0x16fae8['ringtime'];_0x5371b4[_0xaac4('0x1c')]=!![];_0x5371b4[_0xaac4('0x1f')]=utils[_0xaac4('0x15')]();_0x5371b4[_0xaac4('0x16')]='answered_elsewhere';_0x5371b4[_0xaac4('0x2a')]='answered_elsewhere';_0x5371b4['answeredelsewheredestinationuniqueid']=_0x16fae8[_0xaac4('0x11')];_0x5371b4[_0xaac4('0x31')]=_0x16fae8[_0xaac4('0x1a')];writeDB(_0x5371b4);}});}}catch(_0x40c007){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x2d'),_0x16fae8[_0xaac4('0x4')]),_0x40c007);}};exports['agentcomplete']=function(_0x15191a){try{if(!_[_0xaac4('0x32')](agents[_0x15191a[_0xaac4('0x11')]])){utils[_0xaac4('0x12')](util['format'](_0xaac4('0x33'),_0x15191a[_0xaac4('0x4')]),_0x15191a);utils[_0xaac4('0x3')](util['format'](_0xaac4('0x34'),_0x15191a[_0xaac4('0x4')],agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x1a')],_0x15191a['destuniqueid']));agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x35')]=!![];agents[_0x15191a[_0xaac4('0x11')]]['agentcompleteAt']=utils[_0xaac4('0x15')]();agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x37')],agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x2f')]);agents[_0x15191a[_0xaac4('0x11')]]['reason']=_0x15191a[_0xaac4('0x2a')];agents[_0x15191a[_0xaac4('0x11')]][_0xaac4('0x16')]=_0xaac4('0x38');writeDB(agents[_0x15191a[_0xaac4('0x11')]]);}}catch(_0x5dca5c){utils['error'](util[_0xaac4('0x19')](_0xaac4('0x33'),_0x15191a[_0xaac4('0x4')]),_0x5dca5c);}};exports[_0xaac4('0x39')]=function(_0x5f33ea){try{if(!_[_0xaac4('0x32')](agents[_0x5f33ea['transfereruniqueid']])){utils[_0xaac4('0x12')](util[_0xaac4('0x19')]('[%s][agents][blindtransfer]',_0x5f33ea[_0xaac4('0x4')]),_0x5f33ea);utils[_0xaac4('0x3')](util[_0xaac4('0x19')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5f33ea['uniqueid'],agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x1a')],agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x4')]));agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x3b')]=!![];agents[_0x5f33ea['transfereruniqueid']][_0xaac4('0x3c')]=_0xaac4('0x3d');agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x3e')]=_0x5f33ea['extension'];agents[_0x5f33ea[_0xaac4('0x3a')]]['transferuniqueid']=agents[_0x5f33ea[_0xaac4('0x3a')]][_0xaac4('0x4')];}}catch(_0x460252){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x3f'),_0x5f33ea[_0xaac4('0x4')]),_0x460252);}};exports[_0xaac4('0x40')]=function(_0x28aed5){try{utils[_0xaac4('0x12')](util[_0xaac4('0x19')](_0xaac4('0x41'),_0x28aed5[_0xaac4('0x42')]),_0x28aed5);if(_0x28aed5[_0xaac4('0x42')]==_0x28aed5['origtransfererlinkedid']){if(!_[_0xaac4('0x32')](agents[_0x28aed5[_0xaac4('0x43')]])){utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x44'),_0x28aed5[_0xaac4('0x42')],agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x1a')]));agents[_0x28aed5['secondtransfereruniqueid']][_0xaac4('0x3b')]=!![];agents[_0x28aed5['secondtransfereruniqueid']][_0xaac4('0x3c')]='ATTENDED';agents[_0x28aed5[_0xaac4('0x43')]]['transferexten']=_0x28aed5['origtransfererexten'];agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x45')]=_0x28aed5['origtransfereruniqueid'];}if(_0x28aed5[_0xaac4('0x46')]&&agents[_0x28aed5[_0xaac4('0x46')]]){agents[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x47')]=0x1;transfers[_0x28aed5[_0xaac4('0x46')]]=_[_0xaac4('0x48')](agents[_0x28aed5['transfereeuniqueid']]);transfers[_0x28aed5[_0xaac4('0x46')]]['calleridnum']=agents[_0x28aed5[_0xaac4('0x43')]]['calleridnum'];transfers[_0x28aed5['transfereeuniqueid']]['calleridname']=agents[_0x28aed5[_0xaac4('0x43')]][_0xaac4('0x49')];transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x14')]=utils['now']();transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x2f')]=utils[_0xaac4('0x15')]();transfers[_0x28aed5['transfereeuniqueid']][_0xaac4('0x21')]=0x0;transfers[_0x28aed5[_0xaac4('0x46')]][_0xaac4('0x47')]=0x2;}}else if(_0x28aed5[_0xaac4('0x43')]==_0x28aed5[_0xaac4('0x4a')]){if(!_[_0xaac4('0x32')](agents[_0x28aed5[_0xaac4('0x42')]])){utils['info'](util['format'](_0xaac4('0x44'),_0x28aed5['origtransfereruniqueid'],agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x1a')]));agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x3b')]=!![];agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x3c')]=_0xaac4('0x4b');agents[_0x28aed5['origtransfereruniqueid']]['transferexten']=_0x28aed5['secondtransfererexten'];agents[_0x28aed5['origtransfereruniqueid']][_0xaac4('0x45')]=_0x28aed5[_0xaac4('0x43')];}if(_0x28aed5[_0xaac4('0x4c')]&&agents[_0x28aed5[_0xaac4('0x4c')]]){agents[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x47')]=0x1;transfers[_0x28aed5[_0xaac4('0x4c')]]=_[_0xaac4('0x48')](agents[_0x28aed5[_0xaac4('0x4c')]]);transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x4d')]=agents[_0x28aed5[_0xaac4('0x42')]][_0xaac4('0x4d')];transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x49')]=agents[_0x28aed5[_0xaac4('0x42')]]['calleridname'];transfers[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x14')]=utils['now']();transfers[_0x28aed5['transfertargetuniqueid']][_0xaac4('0x2f')]=utils['now']();transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x21')]=0x0;transfers[_0x28aed5[_0xaac4('0x4c')]][_0xaac4('0x47')]=0x2;}}}catch(_0x50eeee){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')](_0xaac4('0x41'),_0x28aed5[_0xaac4('0x42')]),_0x50eeee);}};exports[_0xaac4('0x4e')]=function(_0x3a1b41){try{utils['debug'](util[_0xaac4('0x19')](_0xaac4('0x4f'),_0x3a1b41['uniqueid']),_0x3a1b41);if(agents[_0x3a1b41[_0xaac4('0x4')]]&&agents[_0x3a1b41[_0xaac4('0x4')]]['reason']==='timeout'){if(_0x3a1b41[_0xaac4('0x50')]==='21'){agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')]=_0xaac4('0x51');agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x16')]=_0xaac4('0x51');}utils[_0xaac4('0x3')](util['format'](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x1a')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x16')]));writeDB(agents[_0x3a1b41[_0xaac4('0x4')]]);var _0x53059b=unanswered['indexOf'](_0x3a1b41['uniqueid']);if(_0x53059b>-0x1){unanswered[_0xaac4('0x53')](_0x53059b,0x1);}}if(transfers[_0x3a1b41['uniqueid']]){transfers[_0x3a1b41['uniqueid']]['agentcomplete']=!![];transfers[_0x3a1b41['uniqueid']]['agentcompleteAt']=utils[_0xaac4('0x15')]();transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](transfers[_0x3a1b41['uniqueid']][_0xaac4('0x37')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]);transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')]=_0xaac4('0x54');transfers[_0x3a1b41[_0xaac4('0x4')]]['lastevent']=_0xaac4('0x38');utils['info'](util['format'](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x1a')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2a')],transfers[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x16')]));writeDB(transfers[_0x3a1b41[_0xaac4('0x4')]],!![]);}if(agents[_0x3a1b41[_0xaac4('0x4')]]&&agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]){agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x35')]=!![];agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x37')]=utils[_0xaac4('0x15')]();agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x23')]=utils[_0xaac4('0x36')](agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x37')],agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x2f')]);agents[_0x3a1b41[_0xaac4('0x4')]]['reason']=agents[_0x3a1b41[_0xaac4('0x4')]][_0xaac4('0x3b')]?_0xaac4('0x3b'):_0xaac4('0x54');agents[_0x3a1b41[_0xaac4('0x4')]]['lastevent']=_0xaac4('0x38');utils[_0xaac4('0x3')](util[_0xaac4('0x19')](_0xaac4('0x52'),_0x3a1b41[_0xaac4('0x4')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x1a')],agents[_0x3a1b41['uniqueid']][_0xaac4('0x2a')],agents[_0x3a1b41[_0xaac4('0x4')]]['lastevent']));writeDB(agents[_0x3a1b41[_0xaac4('0x4')]]);}}catch(_0x55cf3c){utils[_0xaac4('0x1b')](util[_0xaac4('0x19')]('[%s][agents][hangup]',_0x3a1b41[_0xaac4('0x4')]),_0x55cf3c);}}; \ No newline at end of file +var _0xaa88=['push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','ATTENDED','transferuniqueid','transfertargetuniqueid','agententerreason','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','request','CreateVoiceAgentReport','destuniqueid','debug','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime'];(function(_0x4be45f,_0xedd46d){var _0x20f884=function(_0x490164){while(--_0x490164){_0x4be45f['push'](_0x4be45f['shift']());}};_0x20f884(++_0xedd46d);}(_0xaa88,0x137));var _0x8aa8=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0xaa88[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var utils=require(_0x8aa8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x51c79b,_0x4aee38){utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x5'),_0x51c79b[_0x8aa8('0x6')],_0x51c79b[_0x8aa8('0x7')],_0x51c79b[_0x8aa8('0x8')],_0x51c79b['membername'],_0x51c79b['interface'],_0x51c79b[_0x8aa8('0x9')],_0x51c79b['connectedlinenum'],_0x51c79b[_0x8aa8('0xa')]));if(_0x51c79b[_0x8aa8('0x8')]){utils[_0x8aa8('0xb')](_0x51c79b[_0x8aa8('0x8')])['then'](function(_0x123b7f){if(_0x123b7f){_0x51c79b[_0x8aa8('0xc')]=_0x123b7f[_0x8aa8('0xc')];_0x51c79b['agentacw']=_0x51c79b[_0x8aa8('0xd')]?_0x123b7f[_0x8aa8('0xe')]:![];_0x51c79b[_0x8aa8('0xf')]=_0x51c79b[_0x8aa8('0x10')]?_0x123b7f['acwTimeout']:0x0;}utils[_0x8aa8('0x11')](_0x8aa8('0x12'),_0x51c79b);});}else{utils['request'](_0x8aa8('0x12'),_0x51c79b);}if(_0x4aee38){delete transfers[_0x51c79b[_0x8aa8('0x6')]];}else{delete agents[_0x51c79b[_0x8aa8('0x13')]];}}exports['agentcalled']=function(_0x3b9f74){try{utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][agentcalled]',_0x3b9f74[_0x8aa8('0x6')]),_0x3b9f74);agents[_0x3b9f74['destuniqueid']]=_0x3b9f74;agents[_0x3b9f74['destuniqueid']][_0x8aa8('0x15')]=utils[_0x8aa8('0x16')]();agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0xa')]=_0x8aa8('0x17');agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0x18')]=null;agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0x19')]=null;utils['info'](util['format'](_0x8aa8('0x1a'),_0x3b9f74['uniqueid'],agents[_0x3b9f74['destuniqueid']][_0x8aa8('0x1b')],_0x3b9f74['destuniqueid']));}catch(_0x438198){utils[_0x8aa8('0x1c')](util[_0x8aa8('0x4')](_0x8aa8('0x1d'),_0x3b9f74['uniqueid']),_0x438198);}};exports[_0x8aa8('0x1e')]=function(_0x36c445){try{if(!_[_0x8aa8('0x1f')](agents[_0x36c445[_0x8aa8('0x13')]])){utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][agentringnoanswer]',_0x36c445[_0x8aa8('0x6')]),_0x36c445);utils['info'](util[_0x8aa8('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x36c445[_0x8aa8('0x6')],agents[_0x36c445['destuniqueid']][_0x8aa8('0x1b')],_0x36c445[_0x8aa8('0x13')]));agents[_0x36c445[_0x8aa8('0x13')]]['agentringnoanswer']=!![];agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();agents[_0x36c445['destuniqueid']]['lastevent']=_0x8aa8('0x21');agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x22')]=_0x8aa8('0x21');agents[_0x36c445[_0x8aa8('0x13')]]['holdtime']=_0x36c445[_0x8aa8('0x23')]?parseInt(_0x36c445['ringtime'])/0x3e8:0x0;agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x24')]=0x0;unanswered[_0x8aa8('0x25')](_0x36c445['destuniqueid']);}}catch(_0x4c5c5c){utils[_0x8aa8('0x1c')](util['format'](_0x8aa8('0x26'),_0x36c445[_0x8aa8('0x6')]),_0x4c5c5c);}};exports[_0x8aa8('0x27')]=function(_0x240203){try{_[_0x8aa8('0x28')](agents,function(_0x4d5c2e,_0x267f4c){if(_0x4d5c2e[_0x8aa8('0x6')]==_0x240203['uniqueid']&&!_[_0x8aa8('0x29')](unanswered,_0x4d5c2e[_0x8aa8('0x13')])){utils[_0x8aa8('0x14')](util['format'](_0x8aa8('0x2a'),_0x240203[_0x8aa8('0x6')]),_0x240203);utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x2b'),_0x240203[_0x8aa8('0x6')],_0x4d5c2e[_0x8aa8('0x1b')],_0x4d5c2e[_0x8aa8('0x13')]));_0x4d5c2e[_0x8aa8('0x1e')]=!![];_0x4d5c2e[_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();_0x4d5c2e['lastevent']='abandoned';_0x4d5c2e[_0x8aa8('0x22')]=_0x8aa8('0x2c');_0x4d5c2e[_0x8aa8('0x2d')]=_0x240203[_0x8aa8('0x2d')];_0x4d5c2e[_0x8aa8('0x24')]=0x0;writeDB(_0x4d5c2e);}});}catch(_0x2f27cd){utils['error'](util['format'](_0x8aa8('0x2a'),_0x240203['uniqueid']),_0x2f27cd);}};exports[_0x8aa8('0x2e')]=function(_0x2c5c84){try{if(agents[_0x2c5c84[_0x8aa8('0x13')]]){utils['debug'](util[_0x8aa8('0x4')](_0x8aa8('0x2f'),_0x2c5c84[_0x8aa8('0x6')]),_0x2c5c84);utils['info'](util['format'](_0x8aa8('0x30'),_0x2c5c84[_0x8aa8('0x6')],agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x1b')],_0x2c5c84[_0x8aa8('0x13')]));agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x31')]=utils['now']();agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x18')]=_0x2c5c84['connectedlinenum'];agents[_0x2c5c84[_0x8aa8('0x13')]][_0x8aa8('0x19')]=_0x2c5c84[_0x8aa8('0x19')];agents[_0x2c5c84[_0x8aa8('0x13')]]['holdtime']=_0x2c5c84[_0x8aa8('0x23')];agents[_0x2c5c84[_0x8aa8('0x13')]]['lastevent']=_0x8aa8('0x32');_[_0x8aa8('0x28')](agents,function(_0x5ea57a,_0x351ddc){if(_0x5ea57a[_0x8aa8('0x13')]!=_0x2c5c84[_0x8aa8('0x13')]&&_0x5ea57a[_0x8aa8('0x6')]==_0x2c5c84[_0x8aa8('0x6')]){_0x5ea57a[_0x8aa8('0x24')]=0x0;_0x5ea57a[_0x8aa8('0x2d')]=_0x2c5c84[_0x8aa8('0x23')];_0x5ea57a[_0x8aa8('0x1e')]=!![];_0x5ea57a[_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();_0x5ea57a[_0x8aa8('0xa')]=_0x8aa8('0x33');_0x5ea57a[_0x8aa8('0x22')]=_0x8aa8('0x33');_0x5ea57a[_0x8aa8('0x34')]=_0x2c5c84['destuniqueid'];_0x5ea57a[_0x8aa8('0x35')]=_0x2c5c84['membername'];writeDB(_0x5ea57a);}});}}catch(_0x4833c0){utils['error'](util[_0x8aa8('0x4')]('[%s][agents][agentconnect]',_0x2c5c84['uniqueid']),_0x4833c0);}};exports[_0x8aa8('0xd')]=function(_0x4da4d8){try{if(!_[_0x8aa8('0x1f')](agents[_0x4da4d8['destuniqueid']])){utils['debug'](util[_0x8aa8('0x4')](_0x8aa8('0x36'),_0x4da4d8[_0x8aa8('0x6')]),_0x4da4d8);utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x37'),_0x4da4d8[_0x8aa8('0x6')],agents[_0x4da4d8['destuniqueid']][_0x8aa8('0x1b')],_0x4da4d8['destuniqueid']));agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0xd')]=!![];agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x38')]=utils[_0x8aa8('0x16')]();agents[_0x4da4d8[_0x8aa8('0x13')]]['talktime']=utils['diffTime'](agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x38')],agents[_0x4da4d8['destuniqueid']][_0x8aa8('0x31')]);agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x22')]=_0x4da4d8['reason'];agents[_0x4da4d8['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x4da4d8[_0x8aa8('0x13')]]);}}catch(_0x43bdb4){utils['error'](util[_0x8aa8('0x4')](_0x8aa8('0x36'),_0x4da4d8[_0x8aa8('0x6')]),_0x43bdb4);}};exports[_0x8aa8('0x39')]=function(_0x20384a){try{if(!_[_0x8aa8('0x1f')](agents[_0x20384a['transfereruniqueid']])){utils['debug'](util[_0x8aa8('0x4')]('[%s][agents][blindtransfer]',_0x20384a[_0x8aa8('0x6')]),_0x20384a);utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x3a'),_0x20384a[_0x8aa8('0x6')],agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x1b')],agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x6')]));agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x3c')]=!![];agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x3d')]=_0x8aa8('0x3e');agents[_0x20384a['transfereruniqueid']][_0x8aa8('0x3f')]=_0x20384a['extension'];agents[_0x20384a['transfereruniqueid']]['transferuniqueid']=agents[_0x20384a[_0x8aa8('0x3b')]]['uniqueid'];}}catch(_0x1de402){utils[_0x8aa8('0x1c')](util[_0x8aa8('0x4')]('[%s][agents][blindtransfer]',_0x20384a[_0x8aa8('0x6')]),_0x1de402);}};exports[_0x8aa8('0x40')]=function(_0x23612a){try{utils[_0x8aa8('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x23612a[_0x8aa8('0x41')]),_0x23612a);if(_0x23612a[_0x8aa8('0x41')]==_0x23612a[_0x8aa8('0x42')]){if(!_[_0x8aa8('0x1f')](agents[_0x23612a['secondtransfereruniqueid']])){utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x43'),_0x23612a[_0x8aa8('0x41')],agents[_0x23612a['secondtransfereruniqueid']][_0x8aa8('0x1b')]));agents[_0x23612a[_0x8aa8('0x44')]]['transfer']=!![];agents[_0x23612a['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x23612a[_0x8aa8('0x44')]]['transferexten']=_0x23612a[_0x8aa8('0x45')];agents[_0x23612a[_0x8aa8('0x44')]]['transferuniqueid']=_0x23612a['origtransfereruniqueid'];}if(_0x23612a[_0x8aa8('0x46')]&&agents[_0x23612a[_0x8aa8('0x46')]]){agents[_0x23612a['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x23612a['transfereeuniqueid']]=_[_0x8aa8('0x47')](agents[_0x23612a[_0x8aa8('0x46')]]);transfers[_0x23612a['transfereeuniqueid']]['calleridnum']=agents[_0x23612a[_0x8aa8('0x44')]][_0x8aa8('0x9')];transfers[_0x23612a['transfereeuniqueid']][_0x8aa8('0x48')]=agents[_0x23612a[_0x8aa8('0x44')]]['calleridname'];transfers[_0x23612a[_0x8aa8('0x46')]]['agentcalledAt']=utils[_0x8aa8('0x16')]();transfers[_0x23612a['transfereeuniqueid']][_0x8aa8('0x31')]=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x46')]][_0x8aa8('0x2d')]=0x0;transfers[_0x23612a[_0x8aa8('0x46')]]['agententerreason']=0x2;}}else if(_0x23612a[_0x8aa8('0x44')]==_0x23612a[_0x8aa8('0x49')]){if(!_[_0x8aa8('0x1f')](agents[_0x23612a[_0x8aa8('0x41')]])){utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x43'),_0x23612a['origtransfereruniqueid'],agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x1b')]));agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x3c')]=!![];agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x3d')]=_0x8aa8('0x4a');agents[_0x23612a['origtransfereruniqueid']]['transferexten']=_0x23612a['secondtransfererexten'];agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x4b')]=_0x23612a[_0x8aa8('0x44')];}if(_0x23612a[_0x8aa8('0x4c')]&&agents[_0x23612a[_0x8aa8('0x4c')]]){agents[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x4d')]=0x1;transfers[_0x23612a[_0x8aa8('0x4c')]]=_[_0x8aa8('0x47')](agents[_0x23612a[_0x8aa8('0x4c')]]);transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x9')]=agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x9')];transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x48')]=agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x48')];transfers[_0x23612a[_0x8aa8('0x4c')]]['agentcalledAt']=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x31')]=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x2d')]=0x0;transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x4d')]=0x2;}}}catch(_0x37520b){utils['error'](util[_0x8aa8('0x4')](_0x8aa8('0x4e'),_0x23612a['origtransfereruniqueid']),_0x37520b);}};exports[_0x8aa8('0x4f')]=function(_0x5d72d0){try{utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][hangup]',_0x5d72d0[_0x8aa8('0x6')]),_0x5d72d0);if(agents[_0x5d72d0[_0x8aa8('0x6')]]&&agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')]===_0x8aa8('0x21')){if(_0x5d72d0[_0x8aa8('0x50')]==='21'){agents[_0x5d72d0[_0x8aa8('0x6')]]['reason']=_0x8aa8('0x51');agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]=_0x8aa8('0x51');}utils['info'](util['format'](_0x8aa8('0x52'),_0x5d72d0[_0x8aa8('0x6')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],agents[_0x5d72d0['uniqueid']]['reason'],agents[_0x5d72d0['uniqueid']][_0x8aa8('0xa')]));writeDB(agents[_0x5d72d0[_0x8aa8('0x6')]]);var _0x1b7baa=unanswered[_0x8aa8('0x53')](_0x5d72d0[_0x8aa8('0x6')]);if(_0x1b7baa>-0x1){unanswered[_0x8aa8('0x54')](_0x1b7baa,0x1);}}if(transfers[_0x5d72d0[_0x8aa8('0x6')]]){transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xd')]=!![];transfers[_0x5d72d0['uniqueid']][_0x8aa8('0x38')]=utils['now']();transfers[_0x5d72d0['uniqueid']][_0x8aa8('0x24')]=utils[_0x8aa8('0x55')](transfers[_0x5d72d0[_0x8aa8('0x6')]]['agentcompleteAt'],transfers[_0x5d72d0[_0x8aa8('0x6')]]['agentconnectAt']);transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')]=_0x8aa8('0x56');transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]='complete';utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x52'),_0x5d72d0[_0x8aa8('0x6')],transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')],transfers[_0x5d72d0[_0x8aa8('0x6')]]['lastevent']));writeDB(transfers[_0x5d72d0[_0x8aa8('0x6')]],!![]);}if(agents[_0x5d72d0[_0x8aa8('0x6')]]&&agents[_0x5d72d0['uniqueid']]['agentconnectAt']){agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xd')]=!![];agents[_0x5d72d0['uniqueid']][_0x8aa8('0x38')]=utils[_0x8aa8('0x16')]();agents[_0x5d72d0[_0x8aa8('0x6')]]['talktime']=utils['diffTime'](agents[_0x5d72d0['uniqueid']][_0x8aa8('0x38')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x31')]);agents[_0x5d72d0[_0x8aa8('0x6')]]['reason']=agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x3c')]?_0x8aa8('0x3c'):_0x8aa8('0x56');agents[_0x5d72d0['uniqueid']][_0x8aa8('0xa')]='complete';utils['info'](util[_0x8aa8('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5d72d0[_0x8aa8('0x6')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],agents[_0x5d72d0['uniqueid']][_0x8aa8('0x22')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]));writeDB(agents[_0x5d72d0[_0x8aa8('0x6')]]);}}catch(_0x20260e){utils[_0x8aa8('0x1c')](util['format']('[%s][agents][hangup]',_0x5d72d0[_0x8aa8('0x6')]),_0x20260e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 0b801ad..ba5eebb 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 _0x0134=['variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','set','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','format','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','DOCUMENTATION','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','now','transfer','linkedid','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','diffTime','endtime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0134,0xf8));var _0x4013=function(_0x113fe4,_0x5ebae1){_0x113fe4=_0x113fe4-0x0;var _0x25a898=_0x0134[_0x113fe4];return _0x25a898;};'use strict';var _=require('lodash');var util=require(_0x4013('0x0'));var utils=require(_0x4013('0x1'));var dispositions=[_0x4013('0x2'),_0x4013('0x3'),'FAILED',_0x4013('0x2'),_0x4013('0x2'),_0x4013('0x2'),_0x4013('0x4'),'BUSY',_0x4013('0x3'),_0x4013('0x3'),_0x4013('0x3')];var channels={};function writeDB(_0x33d7ab){utils[_0x4013('0x5')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x33d7ab['uniqueid'],_0x33d7ab['channel'],_0x33d7ab[_0x4013('0x6')],_0x33d7ab[_0x4013('0x7')],_0x33d7ab[_0x4013('0x8')],_0x33d7ab[_0x4013('0x9')],_0x33d7ab[_0x4013('0xa')],_0x33d7ab[_0x4013('0xb')]));if(_0x33d7ab[_0x4013('0xc')]){utils[_0x4013('0xd')](_0x33d7ab[_0x4013('0xc')])['then'](function(_0x452553){if(_0x452553){_0x33d7ab[_0x4013('0xe')]=_0x452553['id'];}utils[_0x4013('0xf')]('CreateVoiceCallReport',_0x33d7ab);});}else{utils[_0x4013('0xf')](_0x4013('0x10'),_0x33d7ab);}if(channels[_0x33d7ab['uniqueid']]){delete channels[_0x33d7ab[_0x4013('0x11')]];}}exports[_0x4013('0x12')]=function(_0x515908){try{utils['debug'](util[_0x4013('0x13')](_0x4013('0x14'),_0x515908['uniqueid']),_0x515908);if(_0x515908[_0x4013('0x11')]==_0x515908['linkedid']&&_0x515908['channel']!=_0x4013('0x15')){utils['info'](util[_0x4013('0x13')](_0x4013('0x16'),_0x515908[_0x4013('0x11')],_0x515908['context'],_0x515908[_0x4013('0x17')]));channels[_0x515908[_0x4013('0x11')]]={'uniqueid':_0x515908['uniqueid'],'accountcode':_0x515908['accountcode'],'source':_0x515908['calleridnum'],'destination':_0x515908[_0x4013('0x17')],'destinationcontext':_0x515908[_0x4013('0x18')],'channel':_0x515908[_0x4013('0x19')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4013('0x2'),'amaflags':_0x4013('0x1a')};}}catch(_0x587708){utils['error'](util[_0x4013('0x13')](_0x4013('0x14'),_0x515908[_0x4013('0x11')]),_0x587708);}};exports['newstate']=function(_0x19fc1b){try{utils[_0x4013('0x1b')](util[_0x4013('0x13')](_0x4013('0x1c'),_0x19fc1b[_0x4013('0x11')]),_0x19fc1b);if(!_[_0x4013('0x1d')](channels[_0x19fc1b['uniqueid']])&&_0x19fc1b[_0x4013('0x1e')]==0x6){utils[_0x4013('0x5')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x19fc1b[_0x4013('0x11')],_0x19fc1b['context'],_0x19fc1b[_0x4013('0x19')]));if(_[_0x4013('0x1d')](channels[_0x19fc1b[_0x4013('0x11')]][_0x4013('0x1f')])){channels[_0x19fc1b[_0x4013('0x11')]][_0x4013('0x1f')]=utils[_0x4013('0x20')]();}}else if(!_[_0x4013('0x1d')](channels[_0x19fc1b['linkedid']])&&_0x19fc1b[_0x4013('0x1e')]==0x6&&_0x19fc1b[_0x4013('0x18')]!=_0x4013('0x21')){utils[_0x4013('0x5')](util[_0x4013('0x13')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x19fc1b['uniqueid'],_0x19fc1b[_0x4013('0x22')],_0x19fc1b[_0x4013('0x18')],_0x19fc1b['channel']));channels[_0x19fc1b[_0x4013('0x22')]][_0x4013('0xc')]=_0x19fc1b['accountcode'];channels[_0x19fc1b[_0x4013('0x22')]][_0x4013('0x23')]=_0x19fc1b[_0x4013('0x19')];if(_[_0x4013('0x1d')](channels[_0x19fc1b[_0x4013('0x22')]][_0x4013('0x24')])){channels[_0x19fc1b[_0x4013('0x22')]][_0x4013('0x24')]=utils[_0x4013('0x20')]();}channels[_0x19fc1b[_0x4013('0x22')]][_0x4013('0x25')]=dispositions[_[_0x4013('0x26')](_0x19fc1b[_0x4013('0x1e')])]||_0x4013('0x4');}}catch(_0x2113d4){utils[_0x4013('0x27')](util[_0x4013('0x13')](_0x4013('0x1c'),_0x19fc1b['uniqueid']),_0x2113d4);}};exports[_0x4013('0x28')]=function(_0x150003){try{if(!_[_0x4013('0x1d')](channels[_0x150003[_0x4013('0x11')]])){utils[_0x4013('0x1b')](util['format'](_0x4013('0x29'),_0x150003[_0x4013('0x11')]),_0x150003);if(_['isNil'](channels[_0x150003[_0x4013('0x11')]][_0x4013('0x2a')])){channels[_0x150003[_0x4013('0x11')]][_0x4013('0x2a')]=_0x150003[_0x4013('0x2b')]+'\x20<'+_0x150003[_0x4013('0x9')]+'>';}utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x2c'),_0x150003[_0x4013('0x11')],channels[_0x150003['uniqueid']]['callerid'],_0x150003['cause-txt']));channels[_0x150003['uniqueid']]['endtime']=utils[_0x4013('0x20')]();channels[_0x150003[_0x4013('0x11')]]['duration']=utils[_0x4013('0x2d')](channels[_0x150003[_0x4013('0x11')]][_0x4013('0x2e')],channels[_0x150003['uniqueid']][_0x4013('0x2f')]);channels[_0x150003['uniqueid']][_0x4013('0x30')]=channels[_0x150003[_0x4013('0x11')]][_0x4013('0x24')]?utils[_0x4013('0x2d')](channels[_0x150003[_0x4013('0x11')]]['endtime'],channels[_0x150003[_0x4013('0x11')]][_0x4013('0x24')]):0x0;writeDB(channels[_0x150003[_0x4013('0x11')]]);}}catch(_0x25ed69){utils[_0x4013('0x27')](util[_0x4013('0x13')]('[%s][calls][hangup]',_0x150003[_0x4013('0x11')]),_0x25ed69);}};exports['attendedtransfer']=function(_0x142429){try{if(!_[_0x4013('0x1d')](channels[_0x142429[_0x4013('0x31')]])){utils[_0x4013('0x1b')](util[_0x4013('0x13')](_0x4013('0x32'),_0x142429[_0x4013('0x33')]),_0x142429);if(channels[_0x142429[_0x4013('0x31')]][_0x4013('0x19')]==_0x142429['transfereechannel']){utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x34'),_0x142429[_0x4013('0x33')],_0x142429[_0x4013('0x31')],_0x142429['secondtransfererchannel']));channels[_0x142429[_0x4013('0x31')]]['destinationchannel']=_0x142429['secondtransfererchannel'];channels[_0x142429[_0x4013('0x31')]][_0x4013('0x35')]='_attended';}else if(channels[_0x142429[_0x4013('0x31')]]['channel']=_0x142429[_0x4013('0x36')]){utils[_0x4013('0x5')](util['format'](_0x4013('0x34'),_0x142429['origtransfereruniqueid'],_0x142429[_0x4013('0x31')],_0x142429[_0x4013('0x37')]));channels[_0x142429['localtwolinkedid']]['destinationchannel']=_0x142429['origtransfererchannel'];channels[_0x142429[_0x4013('0x31')]][_0x4013('0x35')]='_attended';}}}catch(_0x14c8b0){utils[_0x4013('0x27')](util[_0x4013('0x13')](_0x4013('0x32'),_0x142429['origtransfereruniqueid']),_0x14c8b0);}};exports[_0x4013('0x38')]=function(_0x55f8c2){try{if(!_[_0x4013('0x1d')](channels[_0x55f8c2[_0x4013('0x11')]])){utils['debug'](util[_0x4013('0x13')](_0x4013('0x39'),_0x55f8c2['uniqueid']),_0x55f8c2);channels[_0x55f8c2['uniqueid']][_0x4013('0x3a')]=utils[_0x4013('0x20')]();utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x3b'),_0x55f8c2[_0x4013('0x11')],channels[_0x55f8c2[_0x4013('0x11')]][_0x4013('0x3a')]));}}catch(_0x51f8a1){utils[_0x4013('0x27')](util['format']('[%s][calls][musiconholdstart]',_0x55f8c2[_0x4013('0x11')]),_0x51f8a1);}};exports[_0x4013('0x3c')]=function(_0xab57de){try{if(!_['isNil'](channels[_0xab57de[_0x4013('0x11')]])){utils['debug'](util[_0x4013('0x13')]('[%s][calls][musiconholdstop]',_0xab57de[_0x4013('0x11')]),_0xab57de);if(!_[_0x4013('0x1d')](channels[_0xab57de[_0x4013('0x11')]]['musiconholdstartAt'])){channels[_0xab57de[_0x4013('0x11')]][_0x4013('0x3d')]+=utils[_0x4013('0x2d')](utils[_0x4013('0x20')](),channels[_0xab57de[_0x4013('0x11')]]['musiconholdstartAt']);utils['info'](util[_0x4013('0x13')](_0x4013('0x3e'),_0xab57de[_0x4013('0x11')],channels[_0xab57de[_0x4013('0x11')]][_0x4013('0x3d')]));delete channels[_0xab57de[_0x4013('0x11')]]['musiconholdstartAt'];}}}catch(_0x466ba8){utils[_0x4013('0x27')](util[_0x4013('0x13')](_0x4013('0x3f'),_0xab57de[_0x4013('0x11')]),_0x466ba8);}};exports[_0x4013('0x40')]=function(_0x3805da){try{if(!_[_0x4013('0x1d')](channels[_0x3805da[_0x4013('0x11')]])){utils['debug'](util[_0x4013('0x13')](_0x4013('0x41'),_0x3805da[_0x4013('0x11')]),_0x3805da);if(!_[_0x4013('0x1d')](_0x3805da['variable'][_0x4013('0x42')])){utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x43'),_0x3805da[_0x4013('0x11')],_0x3805da[_0x4013('0x44')]));channels[_0x3805da[_0x4013('0x11')]][_0x4013('0x45')]=_0x3805da[_0x4013('0x44')];}if(!_[_0x4013('0x1d')](_0x3805da[_0x4013('0x46')][_0x4013('0x47')])){utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x48'),_0x3805da['uniqueid'],_0x3805da[_0x4013('0x44')]));channels[_0x3805da[_0x4013('0x11')]][_0x4013('0x49')]=_0x3805da[_0x4013('0x44')];channels[_0x3805da['uniqueid']]['callerid']='\x22'+_0x3805da[_0x4013('0x44')]+'\x22\x20<'+_0x3805da[_0x4013('0x44')]+'>';}if(!_[_0x4013('0x1d')](_0x3805da['variable']['xmd-callerid-preview'])||!_[_0x4013('0x1d')](_0x3805da['variable'][_0x4013('0x4a')])){utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x4b'),_0x3805da[_0x4013('0x11')],!_[_0x4013('0x1d')](_0x3805da[_0x4013('0x46')][_0x4013('0x4c')])?_0x4013('0x4c'):_0x4013('0x4a'),_0x3805da[_0x4013('0x44')]));channels[_0x3805da[_0x4013('0x11')]]['callerid']=_0x3805da[_0x4013('0x44')];}if(!_[_0x4013('0x1d')](_0x3805da[_0x4013('0x46')][_0x4013('0x4d')])||!_[_0x4013('0x1d')](_0x3805da[_0x4013('0x46')][_0x4013('0x4e')])){utils[_0x4013('0x5')](util[_0x4013('0x13')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3805da['uniqueid'],!_['isNil'](_0x3805da[_0x4013('0x46')][_0x4013('0x4d')])?_0x4013('0x4d'):'xmcs-queue',_0x3805da[_0x4013('0x44')]));channels[_0x3805da['uniqueid']][_0x4013('0x4f')]=_0x4013('0x50');channels[_0x3805da[_0x4013('0x11')]][_0x4013('0x51')]=_0x3805da[_0x4013('0x44')];channels[_0x3805da[_0x4013('0x11')]][_0x4013('0x6')]=!![];}if(!_['isNil'](_0x3805da['variable'][_0x4013('0x52')])){utils['info'](util[_0x4013('0x13')](_0x4013('0x53'),_0x3805da[_0x4013('0x11')],_0x3805da[_0x4013('0x44')]));channels[_0x3805da['uniqueid']][_0x4013('0x54')]=_0x3805da['value'];}if(!_[_0x4013('0x1d')](_0x3805da[_0x4013('0x46')][_0x4013('0x55')])){utils[_0x4013('0x5')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3805da['uniqueid'],_0x3805da[_0x4013('0x44')]));channels[_0x3805da[_0x4013('0x11')]]['type']=_0x3805da[_0x4013('0x44')];}if(!_[_0x4013('0x1d')](_0x3805da[_0x4013('0x46')][_0x4013('0x56')])){utils[_0x4013('0x5')](util['format'](_0x4013('0x57'),_0x3805da[_0x4013('0x11')],_0x3805da[_0x4013('0x44')]));channels[_0x3805da[_0x4013('0x11')]][_0x4013('0x58')]=_0x3805da[_0x4013('0x44')];}if(!_[_0x4013('0x1d')](_0x3805da['variable'][_0x4013('0x59')])){utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x5a'),_0x3805da['uniqueid'],_0x3805da['value']));channels[_0x3805da[_0x4013('0x11')]][_0x4013('0x59')]=_0x3805da['value'];}}}catch(_0x2fe3db){utils[_0x4013('0x27')](util[_0x4013('0x13')]('[%s][calls][varset]',_0x3805da[_0x4013('0x11')]),_0x2fe3db);}};exports[_0x4013('0x5b')]=function(_0x2c0f41){try{if(!_[_0x4013('0x1d')](channels[_0x2c0f41[_0x4013('0x11')]])){utils[_0x4013('0x1b')](util['format'](_0x4013('0x5c'),_0x2c0f41[_0x4013('0x11')]),_0x2c0f41);utils[_0x4013('0x5')](util[_0x4013('0x13')](_0x4013('0x5d'),_0x2c0f41[_0x4013('0x11')],_0x2c0f41['application'],_0x2c0f41['appdata']));if(_0x2c0f41[_0x4013('0x5e')][_0x4013('0x5f')]()=='set'&&_[_0x4013('0x60')](_0x2c0f41[_0x4013('0x61')][_0x4013('0x5f')](),_0x4013('0x62'))){var _0x2a19de=_0x2c0f41[_0x4013('0x61')][_0x4013('0x63')]('=');var _0x1800d3=_0x2a19de[0x0][_0x4013('0x64')](_0x2a19de[0x0][_0x4013('0x65')]('(')+0x1,_0x2a19de[0x0][_0x4013('0x65')](')'));var _0x4ff3bc=_0x2a19de[0x1];channels[_0x2c0f41[_0x4013('0x11')]][_0x1800d3]=_0x4ff3bc;}if(!_[_0x4013('0x66')]([_0x4013('0x28'),_0x4013('0x67'),_0x4013('0x68'),_0x4013('0x69'),'gotoif'],_0x2c0f41[_0x4013('0x5e')][_0x4013('0x5f')]())){channels[_0x2c0f41[_0x4013('0x11')]][_0x4013('0x4f')]=_0x2c0f41[_0x4013('0x5e')];channels[_0x2c0f41['uniqueid']]['lastdata']=_0x2c0f41[_0x4013('0x61')];}}}catch(_0x193588){utils[_0x4013('0x27')](util[_0x4013('0x13')](_0x4013('0x5c'),_0x2c0f41[_0x4013('0x11')]),_0x193588);}}; \ No newline at end of file +var _0x47b2=['billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','\x22\x20<','xmd-callerid-preview','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','includes','noop','gotoif','lastdata','[%s][calls][newexten]','lodash','NO\x20ANSWER','FAILED','ANSWERED','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime'];(function(_0x5b8483,_0x50dd70){var _0x12a54e=function(_0x5e39cd){while(--_0x5e39cd){_0x5b8483['push'](_0x5b8483['shift']());}};_0x12a54e(++_0x50dd70);}(_0x47b2,0x171));var _0x247b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x247b('0x0'));var util=require('util');var utils=require('./utils');var dispositions=[_0x247b('0x1'),_0x247b('0x2'),'FAILED',_0x247b('0x1'),_0x247b('0x1'),'NO\x20ANSWER',_0x247b('0x3'),'BUSY',_0x247b('0x2'),_0x247b('0x2'),_0x247b('0x2')];var channels={};function writeDB(_0x1b60f2){utils[_0x247b('0x4')](util[_0x247b('0x5')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1b60f2[_0x247b('0x6')],_0x1b60f2[_0x247b('0x7')],_0x1b60f2[_0x247b('0x8')],_0x1b60f2[_0x247b('0x9')],_0x1b60f2[_0x247b('0xa')],_0x1b60f2[_0x247b('0xb')],_0x1b60f2[_0x247b('0xc')],_0x1b60f2['lastevent']));if(_0x1b60f2[_0x247b('0xd')]){utils[_0x247b('0xe')](_0x1b60f2[_0x247b('0xd')])[_0x247b('0xf')](function(_0x2f5f57){if(_0x2f5f57){_0x1b60f2[_0x247b('0x10')]=_0x2f5f57['id'];}utils[_0x247b('0x11')](_0x247b('0x12'),_0x1b60f2);});}else{utils[_0x247b('0x11')](_0x247b('0x12'),_0x1b60f2);}if(channels[_0x1b60f2[_0x247b('0x6')]]){delete channels[_0x1b60f2[_0x247b('0x6')]];}}exports['newchannel']=function(_0x5b6d2c){try{utils[_0x247b('0x13')](util[_0x247b('0x5')]('[%s][calls][newchannel]',_0x5b6d2c[_0x247b('0x6')]),_0x5b6d2c);if(_0x5b6d2c['uniqueid']==_0x5b6d2c['linkedid']&&_0x5b6d2c[_0x247b('0x7')]!=_0x247b('0x14')){utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x15'),_0x5b6d2c[_0x247b('0x6')],_0x5b6d2c['context'],_0x5b6d2c[_0x247b('0x16')]));channels[_0x5b6d2c[_0x247b('0x6')]]={'uniqueid':_0x5b6d2c['uniqueid'],'accountcode':_0x5b6d2c[_0x247b('0xd')],'source':_0x5b6d2c[_0x247b('0xb')],'destination':_0x5b6d2c[_0x247b('0x16')],'destinationcontext':_0x5b6d2c['context'],'channel':_0x5b6d2c[_0x247b('0x7')],'starttime':utils[_0x247b('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x247b('0x1'),'amaflags':_0x247b('0x18')};}}catch(_0x5209ef){utils[_0x247b('0x19')](util[_0x247b('0x5')](_0x247b('0x1a'),_0x5b6d2c['uniqueid']),_0x5209ef);}};exports[_0x247b('0x1b')]=function(_0x559c9b){try{utils[_0x247b('0x13')](util['format'](_0x247b('0x1c'),_0x559c9b['uniqueid']),_0x559c9b);if(!_[_0x247b('0x1d')](channels[_0x559c9b[_0x247b('0x6')]])&&_0x559c9b[_0x247b('0x1e')]==0x6){utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x1f'),_0x559c9b[_0x247b('0x6')],_0x559c9b[_0x247b('0x20')],_0x559c9b[_0x247b('0x7')]));if(_[_0x247b('0x1d')](channels[_0x559c9b[_0x247b('0x6')]]['systemanswertime'])){channels[_0x559c9b[_0x247b('0x6')]][_0x247b('0x21')]=utils[_0x247b('0x17')]();}}else if(!_[_0x247b('0x1d')](channels[_0x559c9b[_0x247b('0x22')]])&&_0x559c9b[_0x247b('0x1e')]==0x6&&_0x559c9b[_0x247b('0x20')]!='transfer'){utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x23'),_0x559c9b[_0x247b('0x6')],_0x559c9b[_0x247b('0x22')],_0x559c9b[_0x247b('0x20')],_0x559c9b[_0x247b('0x7')]));channels[_0x559c9b['linkedid']][_0x247b('0xd')]=_0x559c9b['accountcode'];channels[_0x559c9b[_0x247b('0x22')]]['destinationchannel']=_0x559c9b['channel'];if(_['isNil'](channels[_0x559c9b[_0x247b('0x22')]][_0x247b('0x24')])){channels[_0x559c9b['linkedid']]['answertime']=utils[_0x247b('0x17')]();}channels[_0x559c9b[_0x247b('0x22')]][_0x247b('0x25')]=dispositions[_[_0x247b('0x26')](_0x559c9b[_0x247b('0x1e')])]||_0x247b('0x3');}}catch(_0x41ff40){utils[_0x247b('0x19')](util[_0x247b('0x5')]('[%s][calls][newstate]',_0x559c9b[_0x247b('0x6')]),_0x41ff40);}};exports[_0x247b('0x27')]=function(_0xb1bdbe){try{if(!_[_0x247b('0x1d')](channels[_0xb1bdbe[_0x247b('0x6')]])){utils['debug'](util[_0x247b('0x5')](_0x247b('0x28'),_0xb1bdbe[_0x247b('0x6')]),_0xb1bdbe);if(_[_0x247b('0x1d')](channels[_0xb1bdbe[_0x247b('0x6')]]['callerid'])){channels[_0xb1bdbe['uniqueid']][_0x247b('0x29')]=_0xb1bdbe['calleridname']+'\x20<'+_0xb1bdbe[_0x247b('0xb')]+'>';}utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x2a'),_0xb1bdbe[_0x247b('0x6')],channels[_0xb1bdbe[_0x247b('0x6')]][_0x247b('0x29')],_0xb1bdbe['cause-txt']));channels[_0xb1bdbe[_0x247b('0x6')]][_0x247b('0x2b')]=utils[_0x247b('0x17')]();channels[_0xb1bdbe['uniqueid']][_0x247b('0x2c')]=utils[_0x247b('0x2d')](channels[_0xb1bdbe[_0x247b('0x6')]]['endtime'],channels[_0xb1bdbe[_0x247b('0x6')]][_0x247b('0x2e')]);channels[_0xb1bdbe[_0x247b('0x6')]][_0x247b('0x2f')]=channels[_0xb1bdbe[_0x247b('0x6')]][_0x247b('0x24')]?utils['diffTime'](channels[_0xb1bdbe[_0x247b('0x6')]]['endtime'],channels[_0xb1bdbe[_0x247b('0x6')]][_0x247b('0x24')]):0x0;writeDB(channels[_0xb1bdbe[_0x247b('0x6')]]);}}catch(_0x283ebe){utils[_0x247b('0x19')](util[_0x247b('0x5')](_0x247b('0x28'),_0xb1bdbe[_0x247b('0x6')]),_0x283ebe);}};exports[_0x247b('0x30')]=function(_0x292545){try{if(!_[_0x247b('0x1d')](channels[_0x292545[_0x247b('0x31')]])){utils[_0x247b('0x13')](util[_0x247b('0x5')](_0x247b('0x32'),_0x292545[_0x247b('0x33')]),_0x292545);if(channels[_0x292545[_0x247b('0x31')]][_0x247b('0x7')]==_0x292545['transfereechannel']){utils[_0x247b('0x4')](util['format'](_0x247b('0x34'),_0x292545[_0x247b('0x33')],_0x292545[_0x247b('0x31')],_0x292545[_0x247b('0x35')]));channels[_0x292545[_0x247b('0x31')]][_0x247b('0x36')]=_0x292545[_0x247b('0x35')];channels[_0x292545['localtwolinkedid']][_0x247b('0x37')]='_attended';}else if(channels[_0x292545[_0x247b('0x31')]][_0x247b('0x7')]=_0x292545[_0x247b('0x38')]){utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x34'),_0x292545[_0x247b('0x33')],_0x292545[_0x247b('0x31')],_0x292545[_0x247b('0x39')]));channels[_0x292545[_0x247b('0x31')]][_0x247b('0x36')]=_0x292545['origtransfererchannel'];channels[_0x292545[_0x247b('0x31')]]['userfield']=_0x247b('0x3a');}}}catch(_0x285292){utils[_0x247b('0x19')](util[_0x247b('0x5')]('[%s][calls][attendedtransfer]',_0x292545[_0x247b('0x33')]),_0x285292);}};exports[_0x247b('0x3b')]=function(_0x18044c){try{if(!_[_0x247b('0x1d')](channels[_0x18044c[_0x247b('0x6')]])){utils[_0x247b('0x13')](util[_0x247b('0x5')]('[%s][calls][musiconholdstart]',_0x18044c[_0x247b('0x6')]),_0x18044c);channels[_0x18044c[_0x247b('0x6')]][_0x247b('0x3c')]=utils[_0x247b('0x17')]();utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x3d'),_0x18044c['uniqueid'],channels[_0x18044c[_0x247b('0x6')]]['musiconholdstartAt']));}}catch(_0x27b436){utils[_0x247b('0x19')](util[_0x247b('0x5')](_0x247b('0x3e'),_0x18044c[_0x247b('0x6')]),_0x27b436);}};exports['musiconholdstop']=function(_0x265414){try{if(!_[_0x247b('0x1d')](channels[_0x265414['uniqueid']])){utils[_0x247b('0x13')](util[_0x247b('0x5')](_0x247b('0x3f'),_0x265414[_0x247b('0x6')]),_0x265414);if(!_['isNil'](channels[_0x265414[_0x247b('0x6')]]['musiconholdstartAt'])){channels[_0x265414['uniqueid']]['mohtime']+=utils[_0x247b('0x2d')](utils[_0x247b('0x17')](),channels[_0x265414[_0x247b('0x6')]][_0x247b('0x3c')]);utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x40'),_0x265414[_0x247b('0x6')],channels[_0x265414['uniqueid']][_0x247b('0x41')]));delete channels[_0x265414[_0x247b('0x6')]][_0x247b('0x3c')];}}}catch(_0x10562a){utils[_0x247b('0x19')](util[_0x247b('0x5')]('[%s][calls][musiconholdstop]',_0x265414[_0x247b('0x6')]),_0x10562a);}};exports[_0x247b('0x42')]=function(_0x41820c){try{if(!_[_0x247b('0x1d')](channels[_0x41820c[_0x247b('0x6')]])){utils[_0x247b('0x13')](util['format'](_0x247b('0x43'),_0x41820c[_0x247b('0x6')]),_0x41820c);if(!_[_0x247b('0x1d')](_0x41820c['variable'][_0x247b('0x44')])){utils['info'](util[_0x247b('0x5')](_0x247b('0x45'),_0x41820c['uniqueid'],_0x41820c[_0x247b('0x46')]));channels[_0x41820c['uniqueid']]['source']=_0x41820c[_0x247b('0x46')];}if(!_[_0x247b('0x1d')](_0x41820c['variable'][_0x247b('0x47')])){utils[_0x247b('0x4')](util[_0x247b('0x5')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x41820c['uniqueid'],_0x41820c['value']));channels[_0x41820c['uniqueid']]['destination']=_0x41820c[_0x247b('0x46')];channels[_0x41820c['uniqueid']][_0x247b('0x29')]='\x22'+_0x41820c[_0x247b('0x46')]+_0x247b('0x48')+_0x41820c[_0x247b('0x46')]+'>';}if(!_[_0x247b('0x1d')](_0x41820c['variable'][_0x247b('0x49')])||!_[_0x247b('0x1d')](_0x41820c[_0x247b('0x4a')][_0x247b('0x4b')])){utils[_0x247b('0x4')](util['format'](_0x247b('0x4c'),_0x41820c['uniqueid'],!_[_0x247b('0x1d')](_0x41820c[_0x247b('0x4a')]['xmd-callerid-preview'])?_0x247b('0x49'):_0x247b('0x4b'),_0x41820c[_0x247b('0x46')]));channels[_0x41820c[_0x247b('0x6')]][_0x247b('0x29')]=_0x41820c['value'];}if(!_[_0x247b('0x1d')](_0x41820c[_0x247b('0x4a')]['xmd-queue'])||!_[_0x247b('0x1d')](_0x41820c[_0x247b('0x4a')][_0x247b('0x4d')])){utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x4c'),_0x41820c[_0x247b('0x6')],!_[_0x247b('0x1d')](_0x41820c[_0x247b('0x4a')]['xmd-queue'])?_0x247b('0x4e'):'xmcs-queue',_0x41820c[_0x247b('0x46')]));channels[_0x41820c[_0x247b('0x6')]][_0x247b('0x4f')]=_0x247b('0x50');channels[_0x41820c['uniqueid']]['lastdata']=_0x41820c[_0x247b('0x46')];channels[_0x41820c[_0x247b('0x6')]][_0x247b('0x8')]=!![];}if(!_[_0x247b('0x1d')](_0x41820c[_0x247b('0x4a')][_0x247b('0x51')])){utils['info'](util['format'](_0x247b('0x52'),_0x41820c[_0x247b('0x6')],_0x41820c['value']));channels[_0x41820c[_0x247b('0x6')]][_0x247b('0x53')]=_0x41820c['value'];}if(!_[_0x247b('0x1d')](_0x41820c[_0x247b('0x4a')][_0x247b('0x54')])){utils['info'](util[_0x247b('0x5')](_0x247b('0x55'),_0x41820c[_0x247b('0x6')],_0x41820c[_0x247b('0x46')]));channels[_0x41820c['uniqueid']][_0x247b('0x56')]=_0x41820c[_0x247b('0x46')];}if(!_[_0x247b('0x1d')](_0x41820c['variable'][_0x247b('0x57')])){utils[_0x247b('0x4')](util[_0x247b('0x5')](_0x247b('0x58'),_0x41820c[_0x247b('0x6')],_0x41820c[_0x247b('0x46')]));channels[_0x41820c['uniqueid']][_0x247b('0x59')]=_0x41820c[_0x247b('0x46')];}if(!_['isNil'](_0x41820c[_0x247b('0x4a')][_0x247b('0x5a')])){utils['info'](util[_0x247b('0x5')](_0x247b('0x5b'),_0x41820c[_0x247b('0x6')],_0x41820c['value']));channels[_0x41820c[_0x247b('0x6')]]['sipcallid']=_0x41820c[_0x247b('0x46')];}}}catch(_0x1f631b){utils['error'](util[_0x247b('0x5')]('[%s][calls][varset]',_0x41820c['uniqueid']),_0x1f631b);}};exports['newexten']=function(_0x567e47){try{if(!_[_0x247b('0x1d')](channels[_0x567e47[_0x247b('0x6')]])){utils[_0x247b('0x13')](util['format']('[%s][calls][newexten]',_0x567e47[_0x247b('0x6')]),_0x567e47);utils['info'](util[_0x247b('0x5')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x567e47['uniqueid'],_0x567e47[_0x247b('0x5c')],_0x567e47[_0x247b('0x5d')]));if(_0x567e47['application'][_0x247b('0x5e')]()=='set'&&_[_0x247b('0x5f')](_0x567e47[_0x247b('0x5d')]['toLowerCase'](),'cdr')){var _0x36b900=_0x567e47[_0x247b('0x5d')][_0x247b('0x60')]('=');var _0x15f617=_0x36b900[0x0][_0x247b('0x61')](_0x36b900[0x0][_0x247b('0x62')]('(')+0x1,_0x36b900[0x0][_0x247b('0x62')](')'));var _0x391bf8=_0x36b900[0x1];channels[_0x567e47['uniqueid']][_0x15f617]=_0x391bf8;}if(!_[_0x247b('0x63')](['hangup',_0x247b('0x64'),'execif','set',_0x247b('0x65')],_0x567e47[_0x247b('0x5c')]['toLowerCase']())){channels[_0x567e47[_0x247b('0x6')]][_0x247b('0x4f')]=_0x567e47['application'];channels[_0x567e47[_0x247b('0x6')]][_0x247b('0x66')]=_0x567e47[_0x247b('0x5d')];}}}catch(_0x52bc3a){utils[_0x247b('0x19')](util[_0x247b('0x5')](_0x247b('0x67'),_0x567e47[_0x247b('0x6')]),_0x52bc3a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 321fd78..9694838 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 _0x1c72=['[core]\x20error','close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1c72,0x12f));var _0x21c7=function(_0x2cc36d,_0x1aa1e5){_0x2cc36d=_0x2cc36d-0x0;var _0x519fe7=_0x1c72[_0x2cc36d];return _0x519fe7;};'use strict';var utils=require('./utils');exports[_0x21c7('0x0')]=function(){utils[_0x21c7('0x1')](_0x21c7('0x2'));};exports['shutdown']=function(){utils['info'](_0x21c7('0x3'));};exports[_0x21c7('0x4')]=function(){utils[_0x21c7('0x1')](_0x21c7('0x5'));};exports[_0x21c7('0x6')]=function(_0x5872cd){utils[_0x21c7('0x6')](_0x21c7('0x7'),_0x5872cd);};exports[_0x21c7('0x8')]=function(){utils[_0x21c7('0x1')]('[core]\x20close');};exports[_0x21c7('0x9')]=function(_0xb6c66b){}; \ No newline at end of file +var _0xe0c5=['[core]\x20shutdown','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils','shutdown','info'];(function(_0x39bc2d,_0x3693ae){var _0x4e74da=function(_0x3d52a3){while(--_0x3d52a3){_0x39bc2d['push'](_0x39bc2d['shift']());}};_0x4e74da(++_0x3693ae);}(_0xe0c5,0x14a));var _0x5e0c=function(_0x31e03e,_0x28d6fd){_0x31e03e=_0x31e03e-0x0;var _0x2b82db=_0xe0c5[_0x31e03e];return _0x2b82db;};'use strict';var utils=require(_0x5e0c('0x0'));exports['connect']=function(){utils['info']('[core]\x20connected');};exports[_0x5e0c('0x1')]=function(){utils[_0x5e0c('0x2')](_0x5e0c('0x3'));};exports['fullybooted']=function(){utils[_0x5e0c('0x2')](_0x5e0c('0x4'));};exports['error']=function(_0x444a90){utils['error'](_0x5e0c('0x5'),_0x444a90);};exports[_0x5e0c('0x6')]=function(){utils[_0x5e0c('0x2')](_0x5e0c('0x7'));};exports[_0x5e0c('0x8')]=function(_0x48a050){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 6ba9a5b..a5d47fc 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 _0xd058=['application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','debug','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','[%s][dials][hangup]','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd058,0xf0));var _0x8d05=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0xd058[_0x466af7];return _0x348c96;};'use strict';var _=require(_0x8d05('0x0'));var util=require('util');var utils=require(_0x8d05('0x1'));var dials={};function writeDB(_0x4e080a){utils[_0x8d05('0x2')](util['format'](_0x8d05('0x3'),_0x4e080a[_0x8d05('0x4')],_0x4e080a[_0x8d05('0x5')],_0x4e080a[_0x8d05('0x6')],_0x4e080a[_0x8d05('0x7')],_0x4e080a[_0x8d05('0x8')],_0x4e080a[_0x8d05('0x9')]));utils[_0x8d05('0xa')]('CreateVoiceDialReport',_0x4e080a);delete dials[_0x4e080a[_0x8d05('0x4')]];}exports[_0x8d05('0xb')]=function(_0x4c4da4){try{utils['debug'](util[_0x8d05('0xc')](_0x8d05('0xd'),_0x4c4da4[_0x8d05('0x4')]),_0x4c4da4);utils[_0x8d05('0x2')](util['format'](_0x8d05('0xe'),_0x4c4da4[_0x8d05('0x4')],_0x4c4da4[_0x8d05('0xf')],_0x4c4da4[_0x8d05('0x10')]));if(_0x4c4da4[_0x8d05('0xf')][_0x8d05('0x11')]()=='set'&&_[_0x8d05('0x12')](_0x4c4da4[_0x8d05('0x10')][_0x8d05('0x11')](),_0x8d05('0x13'))){var _0x4d8c62=_0x4c4da4[_0x8d05('0x10')][_0x8d05('0x14')]('=');dials[_0x4c4da4[_0x8d05('0x4')]]={'routeId':_0x4d8c62[0x1]};}}catch(_0x58fb1c){utils[_0x8d05('0x15')](util[_0x8d05('0xc')]('[%s][dials][newexten]',_0x4c4da4[_0x8d05('0x4')]),_0x58fb1c);}};exports[_0x8d05('0x16')]=function(_0x2e3f85){try{utils[_0x8d05('0x17')](util['format']('[%s][dials][varset]',_0x2e3f85[_0x8d05('0x4')]),_0x2e3f85);if(!_['isNil'](_0x2e3f85[_0x8d05('0x18')]['outboundrouteid'])){utils[_0x8d05('0x2')](util[_0x8d05('0xc')](_0x8d05('0x19'),_0x2e3f85['uniqueid'],_0x2e3f85[_0x8d05('0x1a')]));dials[_0x2e3f85[_0x8d05('0x4')]]={'routeId':_0x2e3f85[_0x8d05('0x1a')]};}}catch(_0x2ee132){utils['error'](util[_0x8d05('0xc')](_0x8d05('0x1b'),_0x2e3f85[_0x8d05('0x4')]),_0x2ee132);}};exports[_0x8d05('0x1c')]=function(_0x2a3d34){try{if(!_[_0x8d05('0x1d')](dials[_0x2a3d34[_0x8d05('0x4')]])){utils[_0x8d05('0x17')](util[_0x8d05('0xc')](_0x8d05('0x1e'),_0x2a3d34[_0x8d05('0x4')]),_0x2a3d34);dials[_0x2a3d34['uniqueid']]=_[_0x8d05('0x1f')](dials[_0x2a3d34['uniqueid']],_0x2a3d34);dials[_0x2a3d34[_0x8d05('0x4')]][_0x8d05('0x20')]=utils[_0x8d05('0x21')]();dials[_0x2a3d34[_0x8d05('0x4')]][_0x8d05('0x22')]=_0x8d05('0x23');utils[_0x8d05('0x2')](util[_0x8d05('0xc')](_0x8d05('0x24'),_0x2a3d34[_0x8d05('0x4')],dials[_0x2a3d34[_0x8d05('0x4')]][_0x8d05('0x20')]));}}catch(_0x79ca4f){utils[_0x8d05('0x15')](util[_0x8d05('0xc')](_0x8d05('0x1e'),_0x2a3d34[_0x8d05('0x4')]),_0x79ca4f);}};exports[_0x8d05('0x25')]=function(_0x1ce212){try{if(!_[_0x8d05('0x1d')](dials[_0x1ce212[_0x8d05('0x4')]])){utils[_0x8d05('0x17')](util[_0x8d05('0xc')](_0x8d05('0x26'),_0x1ce212[_0x8d05('0x4')]),_0x1ce212);dials[_0x1ce212['uniqueid']][_0x8d05('0x9')]=_0x1ce212[_0x8d05('0x9')];if(_0x1ce212['dialstatus']==_0x8d05('0x27')){dials[_0x1ce212[_0x8d05('0x4')]]=_['assign'](dials[_0x1ce212[_0x8d05('0x4')]],_0x1ce212);dials[_0x1ce212[_0x8d05('0x4')]]['answertime']=utils[_0x8d05('0x21')]();dials[_0x1ce212[_0x8d05('0x4')]]['lastevent']='connect';utils['info'](util['format'](_0x8d05('0x28'),_0x1ce212[_0x8d05('0x4')],_0x1ce212[_0x8d05('0x9')],dials[_0x1ce212['uniqueid']][_0x8d05('0x29')]));}else{utils[_0x8d05('0x2')](util[_0x8d05('0xc')]('[%s][dials][dialend]\x20dialstatus:%s',_0x1ce212[_0x8d05('0x4')],_0x1ce212[_0x8d05('0x9')]));}}}catch(_0x5a85a8){utils['error'](util[_0x8d05('0xc')](_0x8d05('0x26'),_0x1ce212[_0x8d05('0x4')]),_0x5a85a8);}};exports[_0x8d05('0x2a')]=function(_0x248567){try{if(!_[_0x8d05('0x1d')](dials[_0x248567[_0x8d05('0x4')]])){utils[_0x8d05('0x17')](util['format']('[%s][dials][hangup]',_0x248567[_0x8d05('0x4')]),_0x248567);utils['info'](util['format'](_0x8d05('0x2b'),_0x248567['uniqueid'],_0x248567[_0x8d05('0x7')],_0x248567[_0x8d05('0x2c')],_0x248567[_0x8d05('0x2d')]));dials[_0x248567[_0x8d05('0x4')]]=_[_0x8d05('0x1f')](dials[_0x248567[_0x8d05('0x4')]],{'endtime':utils[_0x8d05('0x21')](),'lastevent':_0x8d05('0x2e')});dials[_0x248567[_0x8d05('0x4')]][_0x8d05('0x2f')]=utils[_0x8d05('0x30')](dials[_0x248567['uniqueid']][_0x8d05('0x31')],dials[_0x248567['uniqueid']][_0x8d05('0x20')]);dials[_0x248567[_0x8d05('0x4')]]['holdtime']=utils[_0x8d05('0x30')](dials[_0x248567[_0x8d05('0x4')]][_0x8d05('0x29')]||dials[_0x248567[_0x8d05('0x4')]][_0x8d05('0x31')],dials[_0x248567[_0x8d05('0x4')]]['starttime']);dials[_0x248567['uniqueid']]['billableseconds']=dials[_0x248567[_0x8d05('0x4')]][_0x8d05('0x29')]?utils[_0x8d05('0x30')](dials[_0x248567[_0x8d05('0x4')]][_0x8d05('0x31')],dials[_0x248567[_0x8d05('0x4')]][_0x8d05('0x29')]):0x0;writeDB(dials[_0x248567[_0x8d05('0x4')]]);}}catch(_0x5ca905){utils[_0x8d05('0x15')](util[_0x8d05('0xc')](_0x8d05('0x32'),_0x248567[_0x8d05('0x4')]),_0x5ca905);}}; \ No newline at end of file +var _0xd0d2=['[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','isNil','variable','value','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','diffTime','endtime','holdtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0xd0d2,0x189));var _0x2d0d=function(_0x160661,_0x33ffa0){_0x160661=_0x160661-0x0;var _0x2bd307=_0xd0d2[_0x160661];return _0x2bd307;};'use strict';var _=require(_0x2d0d('0x0'));var util=require(_0x2d0d('0x1'));var utils=require(_0x2d0d('0x2'));var dials={};function writeDB(_0x140439){utils[_0x2d0d('0x3')](util['format'](_0x2d0d('0x4'),_0x140439[_0x2d0d('0x5')],_0x140439[_0x2d0d('0x6')],_0x140439[_0x2d0d('0x7')],_0x140439['calleridnum'],_0x140439[_0x2d0d('0x8')],_0x140439[_0x2d0d('0x9')]));utils['request'](_0x2d0d('0xa'),_0x140439);delete dials[_0x140439['uniqueid']];}exports[_0x2d0d('0xb')]=function(_0x5bd625){try{utils[_0x2d0d('0xc')](util[_0x2d0d('0xd')](_0x2d0d('0xe'),_0x5bd625[_0x2d0d('0x5')]),_0x5bd625);utils['info'](util[_0x2d0d('0xd')](_0x2d0d('0xf'),_0x5bd625[_0x2d0d('0x5')],_0x5bd625[_0x2d0d('0x10')],_0x5bd625[_0x2d0d('0x11')]));if(_0x5bd625['application'][_0x2d0d('0x12')]()==_0x2d0d('0x13')&&_[_0x2d0d('0x14')](_0x5bd625[_0x2d0d('0x11')][_0x2d0d('0x12')](),_0x2d0d('0x15'))){var _0x1614fc=_0x5bd625[_0x2d0d('0x11')][_0x2d0d('0x16')]('=');dials[_0x5bd625[_0x2d0d('0x5')]]={'routeId':_0x1614fc[0x1]};}}catch(_0x36cbe9){utils[_0x2d0d('0x17')](util[_0x2d0d('0xd')]('[%s][dials][newexten]',_0x5bd625[_0x2d0d('0x5')]),_0x36cbe9);}};exports[_0x2d0d('0x18')]=function(_0x261d70){try{utils[_0x2d0d('0xc')](util[_0x2d0d('0xd')]('[%s][dials][varset]',_0x261d70[_0x2d0d('0x5')]),_0x261d70);if(!_[_0x2d0d('0x19')](_0x261d70[_0x2d0d('0x1a')]['outboundrouteid'])){utils[_0x2d0d('0x3')](util[_0x2d0d('0xd')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x261d70[_0x2d0d('0x5')],_0x261d70[_0x2d0d('0x1b')]));dials[_0x261d70[_0x2d0d('0x5')]]={'routeId':_0x261d70[_0x2d0d('0x1b')]};}}catch(_0x4c8b6e){utils[_0x2d0d('0x17')](util[_0x2d0d('0xd')]('[%s][dials][varset]',_0x261d70[_0x2d0d('0x5')]),_0x4c8b6e);}};exports['dialbegin']=function(_0x1de5bc){try{if(!_[_0x2d0d('0x19')](dials[_0x1de5bc['uniqueid']])){utils[_0x2d0d('0xc')](util[_0x2d0d('0xd')]('[%s][dials][dialbegin]',_0x1de5bc[_0x2d0d('0x5')]),_0x1de5bc);dials[_0x1de5bc[_0x2d0d('0x5')]]=_[_0x2d0d('0x1c')](dials[_0x1de5bc[_0x2d0d('0x5')]],_0x1de5bc);dials[_0x1de5bc[_0x2d0d('0x5')]][_0x2d0d('0x1d')]=utils[_0x2d0d('0x1e')]();dials[_0x1de5bc[_0x2d0d('0x5')]]['lastevent']=_0x2d0d('0x1f');utils['info'](util['format'](_0x2d0d('0x20'),_0x1de5bc[_0x2d0d('0x5')],dials[_0x1de5bc[_0x2d0d('0x5')]][_0x2d0d('0x1d')]));}}catch(_0x1b0820){utils['error'](util['format'](_0x2d0d('0x21'),_0x1de5bc['uniqueid']),_0x1b0820);}};exports[_0x2d0d('0x22')]=function(_0xafe48d){try{if(!_[_0x2d0d('0x19')](dials[_0xafe48d['uniqueid']])){utils[_0x2d0d('0xc')](util[_0x2d0d('0xd')](_0x2d0d('0x23'),_0xafe48d['uniqueid']),_0xafe48d);dials[_0xafe48d['uniqueid']][_0x2d0d('0x9')]=_0xafe48d['dialstatus'];if(_0xafe48d[_0x2d0d('0x9')]==_0x2d0d('0x24')){dials[_0xafe48d[_0x2d0d('0x5')]]=_[_0x2d0d('0x1c')](dials[_0xafe48d[_0x2d0d('0x5')]],_0xafe48d);dials[_0xafe48d[_0x2d0d('0x5')]][_0x2d0d('0x25')]=utils['now']();dials[_0xafe48d[_0x2d0d('0x5')]][_0x2d0d('0x26')]=_0x2d0d('0x27');utils[_0x2d0d('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0xafe48d['uniqueid'],_0xafe48d[_0x2d0d('0x9')],dials[_0xafe48d['uniqueid']][_0x2d0d('0x25')]));}else{utils[_0x2d0d('0x3')](util[_0x2d0d('0xd')](_0x2d0d('0x28'),_0xafe48d[_0x2d0d('0x5')],_0xafe48d[_0x2d0d('0x9')]));}}}catch(_0x507b0b){utils[_0x2d0d('0x17')](util['format'](_0x2d0d('0x23'),_0xafe48d[_0x2d0d('0x5')]),_0x507b0b);}};exports[_0x2d0d('0x29')]=function(_0x285cbd){try{if(!_[_0x2d0d('0x19')](dials[_0x285cbd['uniqueid']])){utils[_0x2d0d('0xc')](util[_0x2d0d('0xd')](_0x2d0d('0x2a'),_0x285cbd[_0x2d0d('0x5')]),_0x285cbd);utils[_0x2d0d('0x3')](util[_0x2d0d('0xd')](_0x2d0d('0x2b'),_0x285cbd[_0x2d0d('0x5')],_0x285cbd[_0x2d0d('0x2c')],_0x285cbd[_0x2d0d('0x2d')],_0x285cbd[_0x2d0d('0x2e')]));dials[_0x285cbd[_0x2d0d('0x5')]]=_[_0x2d0d('0x1c')](dials[_0x285cbd['uniqueid']],{'endtime':utils[_0x2d0d('0x1e')](),'lastevent':'complete'});dials[_0x285cbd[_0x2d0d('0x5')]][_0x2d0d('0x2f')]=utils[_0x2d0d('0x30')](dials[_0x285cbd[_0x2d0d('0x5')]][_0x2d0d('0x31')],dials[_0x285cbd['uniqueid']][_0x2d0d('0x1d')]);dials[_0x285cbd[_0x2d0d('0x5')]][_0x2d0d('0x32')]=utils['diffTime'](dials[_0x285cbd[_0x2d0d('0x5')]][_0x2d0d('0x25')]||dials[_0x285cbd[_0x2d0d('0x5')]][_0x2d0d('0x31')],dials[_0x285cbd[_0x2d0d('0x5')]]['starttime']);dials[_0x285cbd['uniqueid']]['billableseconds']=dials[_0x285cbd[_0x2d0d('0x5')]]['answertime']?utils[_0x2d0d('0x30')](dials[_0x285cbd[_0x2d0d('0x5')]][_0x2d0d('0x31')],dials[_0x285cbd[_0x2d0d('0x5')]][_0x2d0d('0x25')]):0x0;writeDB(dials[_0x285cbd[_0x2d0d('0x5')]]);}}catch(_0x241564){utils[_0x2d0d('0x17')](util['format'](_0x2d0d('0x2a'),_0x285cbd[_0x2d0d('0x5')]),_0x241564);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 128412b..99d776d 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 _0x524b=['asterisk','port','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local'];(function(_0x333604,_0x402816){var _0x10258d=function(_0x6196f5){while(--_0x6196f5){_0x333604['push'](_0x333604['shift']());}};_0x10258d(++_0x402816);}(_0x524b,0xca));var _0xb524=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x524b[_0x1589dd];return _0x1bddd1;};var AsteriskManager=require(_0xb524('0x0'));var config=require(_0xb524('0x1'));var utils=require(_0xb524('0x2'));var util=require('util');var isXDREnabled=config['xdr']&&config[_0xb524('0x3')][_0xb524('0x4')]?!config[_0xb524('0x3')][_0xb524('0x4')]:!![];var isProduction=config[_0xb524('0x5')]===_0xb524('0x6')||![];var isLocalAsterisk=config[_0xb524('0x3')]&&config[_0xb524('0x3')][_0xb524('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xb524('0x8')][_0xb524('0x9')],config['asterisk']['ip'],config[_0xb524('0x8')]['username'],config['asterisk']['password'],!![]);ami[_0xb524('0xa')]();if(!isXDREnabled){utils[_0xb524('0xb')](_0xb524('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xb524('0xd'));}else{var agents=require(_0xb524('0xe'));var calls=require(_0xb524('0xf'));var queues=require(_0xb524('0x10'));var recordings=require(_0xb524('0x11'));var members=require(_0xb524('0x12'));var dials=require(_0xb524('0x13'));var transfers=require(_0xb524('0x14'));var core=require('./core.controller');ami['on'](_0xb524('0x15'),core[_0xb524('0x15')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xb524('0x16'),core['fullybooted']);ami['on'](_0xb524('0x17'),core[_0xb524('0x17')]);ami['on'](_0xb524('0x18'),core['close']);ami['on'](_0xb524('0x19'),core[_0xb524('0x19')]);ami['on'](_0xb524('0x1a'),function(_0x229417){try{utils[_0xb524('0x1b')](util['format'](_0xb524('0x1c'),_0x229417[_0xb524('0x1d')]),_0x229417);members[_0xb524('0x1a')](_0x229417);}catch(_0x17b9ec){utils[_0xb524('0x17')](util['format'](_0xb524('0x1c'),_0x229417[_0xb524('0x1d')]),_0x17b9ec);}});ami['on'](_0xb524('0x1e'),function(_0x26aeeb){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x20'),_0x26aeeb[_0xb524('0x21')]),_0x26aeeb);agents['agentcalled'](_0x26aeeb);}catch(_0xa636df){utils[_0xb524('0x17')](util['format'](_0xb524('0x20'),_0x26aeeb[_0xb524('0x21')]),_0xa636df);}});ami['on'](_0xb524('0x22'),function(_0x150dc5){try{utils['debug'](util[_0xb524('0x1f')]('[%s][index][agentringnoanswer]',_0x150dc5[_0xb524('0x21')]),_0x150dc5);agents['agentringnoanswer'](_0x150dc5);}catch(_0xff39b2){utils[_0xb524('0x17')](util[_0xb524('0x1f')](_0xb524('0x23'),_0x150dc5[_0xb524('0x21')]),_0xff39b2);}});ami['on'](_0xb524('0x24'),function(_0x25c9b6){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x25'),_0x25c9b6[_0xb524('0x21')]),_0x25c9b6);agents[_0xb524('0x24')](_0x25c9b6);queues[_0xb524('0x24')](_0x25c9b6);}catch(_0x5d56bd){utils[_0xb524('0x17')](util['format'](_0xb524('0x25'),_0x25c9b6[_0xb524('0x21')]),_0x5d56bd);}});ami['on'](_0xb524('0x26'),function(_0x511831){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x27'),_0x511831['uniqueid']),_0x511831);agents[_0xb524('0x26')](_0x511831);queues['agentcomplete'](_0x511831);members['agentcomplete'](_0x511831);}catch(_0x52ce55){utils['error'](util[_0xb524('0x1f')](_0xb524('0x27'),_0x511831[_0xb524('0x21')]),_0x52ce55);}});ami['on'](_0xb524('0x28'),function(_0x293cd8){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x29'),_0x293cd8['uniqueid']),_0x293cd8);agents[_0xb524('0x28')](_0x293cd8);queues[_0xb524('0x28')](_0x293cd8);}catch(_0x5a01a0){utils[_0xb524('0x17')](util['format']('[%s][index][queuecallerabandon]',_0x293cd8[_0xb524('0x21')]),_0x5a01a0);}});ami['on'](_0xb524('0x2a'),function(_0x4fcd57){try{utils['debug'](util[_0xb524('0x1f')]('[%s][index][queuecallerjoin]',_0x4fcd57[_0xb524('0x21')]),_0x4fcd57);queues[_0xb524('0x2a')](_0x4fcd57);recordings[_0xb524('0x2a')](_0x4fcd57);}catch(_0x3af4e4){utils['error'](util['format'](_0xb524('0x2b'),_0x4fcd57[_0xb524('0x21')]),_0x3af4e4);}});ami['on'](_0xb524('0x2c'),function(_0x35d56c){try{utils[_0xb524('0x1b')](util['format'](_0xb524('0x2d'),_0x35d56c[_0xb524('0x21')]),_0x35d56c);queues[_0xb524('0x2c')](_0x35d56c);}catch(_0x48acf4){utils[_0xb524('0x17')](util['format'](_0xb524('0x2d'),_0x35d56c['uniqueid']),_0x48acf4);}});ami['on'](_0xb524('0x2e'),function(_0x21c0bc){try{utils[_0xb524('0x1b')](util['format'](_0xb524('0x2f'),_0x21c0bc['uniqueid']),_0x21c0bc);queues['musiconholdstart'](_0x21c0bc);calls[_0xb524('0x2e')](_0x21c0bc);}catch(_0x597a2d){utils[_0xb524('0x17')](util[_0xb524('0x1f')](_0xb524('0x2f'),_0x21c0bc['uniqueid']),_0x597a2d);}});ami['on'](_0xb524('0x30'),function(_0x58576b){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')]('[%s][index][musiconholdstop]',_0x58576b[_0xb524('0x21')]),_0x58576b);queues[_0xb524('0x30')](_0x58576b);calls[_0xb524('0x30')](_0x58576b);}catch(_0x46ca38){utils[_0xb524('0x17')](util[_0xb524('0x1f')]('[%s][index][musiconholdstop]',_0x58576b['uniqueid']),_0x46ca38);}});ami['on'](_0xb524('0x31'),function(_0x1b4582){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x32'),_0x1b4582[_0xb524('0x21')]),_0x1b4582);calls[_0xb524('0x31')](_0x1b4582);recordings['newstate'](_0x1b4582);}catch(_0x50e0fa){utils[_0xb524('0x17')](util[_0xb524('0x1f')](_0xb524('0x32'),_0x1b4582[_0xb524('0x21')]),_0x50e0fa);}});ami['on'](_0xb524('0x33'),function(_0x9b1f03){try{utils['debug'](util[_0xb524('0x1f')](_0xb524('0x34'),_0x9b1f03['uniqueid']),_0x9b1f03);calls['hangup'](_0x9b1f03);recordings[_0xb524('0x33')](_0x9b1f03);dials[_0xb524('0x33')](_0x9b1f03);agents[_0xb524('0x33')](_0x9b1f03);queues[_0xb524('0x33')](_0x9b1f03);}catch(_0x4494ce){utils[_0xb524('0x17')](util[_0xb524('0x1f')](_0xb524('0x34'),_0x9b1f03[_0xb524('0x21')]),_0x4494ce);}});ami['on'](_0xb524('0x35'),function(_0x64224d){try{utils[_0xb524('0x1b')](util['format'](_0xb524('0x36'),_0x64224d[_0xb524('0x21')]),_0x64224d);members[_0xb524('0x35')](_0x64224d);}catch(_0x5ece8b){utils['error'](util[_0xb524('0x1f')](_0xb524('0x36'),_0x64224d['uniqueid']),_0x5ece8b);}});ami['on']('blindtransfer',function(_0x353ccc){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x37'),_0x353ccc[_0xb524('0x21')]),_0x353ccc);queues[_0xb524('0x38')](_0x353ccc);agents[_0xb524('0x38')](_0x353ccc);transfers[_0xb524('0x38')](_0x353ccc);}catch(_0x1d5f7d){utils[_0xb524('0x17')](util[_0xb524('0x1f')](_0xb524('0x37'),_0x353ccc[_0xb524('0x21')]),_0x1d5f7d);}});ami['on'](_0xb524('0x39'),function(_0x393a90){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x3a'),_0x393a90[_0xb524('0x3b')]),_0x393a90);queues[_0xb524('0x39')](_0x393a90);transfers[_0xb524('0x39')](_0x393a90);agents[_0xb524('0x39')](_0x393a90);calls[_0xb524('0x39')](_0x393a90);}catch(_0x57782d){utils['error'](util[_0xb524('0x1f')](_0xb524('0x3a'),_0x393a90[_0xb524('0x3b')]),_0x57782d);}});ami['on'](_0xb524('0x3c'),function(_0x44b81c){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x3d'),_0x44b81c[_0xb524('0x21')]),_0x44b81c);queues[_0xb524('0x3c')](_0x44b81c);recordings[_0xb524('0x3c')](_0x44b81c);calls['varset'](_0x44b81c);dials[_0xb524('0x3c')](_0x44b81c);}catch(_0x2bf0ce){utils[_0xb524('0x17')](util['format'](_0xb524('0x3d'),_0x44b81c[_0xb524('0x21')]),_0x2bf0ce);}});ami['on'](_0xb524('0x3e'),function(_0x5689e5){try{utils['debug'](util['format'](_0xb524('0x3f'),_0x5689e5['uniqueid']),_0x5689e5);calls[_0xb524('0x3e')](_0x5689e5);recordings[_0xb524('0x3e')](_0x5689e5);dials['newexten'](_0x5689e5);}catch(_0x9e8fb7){utils['error'](util[_0xb524('0x1f')](_0xb524('0x3f'),_0x5689e5[_0xb524('0x21')]),_0x9e8fb7);}});ami['on'](_0xb524('0x40'),function(_0x4928ae){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x41'),_0x4928ae[_0xb524('0x21')]),_0x4928ae);calls[_0xb524('0x40')](_0x4928ae);recordings[_0xb524('0x40')](_0x4928ae);}catch(_0xd8c6f2){utils['error'](util[_0xb524('0x1f')](_0xb524('0x41'),_0x4928ae[_0xb524('0x21')]),_0xd8c6f2);}});ami['on'](_0xb524('0x42'),function(_0x4dd1a0){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')](_0xb524('0x43'),_0x4dd1a0[_0xb524('0x21')]),_0x4dd1a0);dials['dialbegin'](_0x4dd1a0);}catch(_0x1d5411){utils[_0xb524('0x17')](util['format'](_0xb524('0x44'),_0x4dd1a0[_0xb524('0x21')]),_0x1d5411);}});ami['on'](_0xb524('0x45'),function(_0x521155){try{utils[_0xb524('0x1b')](util[_0xb524('0x1f')]('[%s][index][dialend]',_0x521155['uniqueid']),_0x521155);dials[_0xb524('0x45')](_0x521155);}catch(_0x4964df){utils[_0xb524('0x17')](util['format']('[%s][index][dialend]',_0x521155[_0xb524('0x21')]),_0x4964df);}});} \ No newline at end of file +var _0x5d26=['[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','port','asterisk','username','password','keepConnected','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer'];(function(_0x5388d7,_0x5d2309){var _0x180af8=function(_0x276269){while(--_0x276269){_0x5388d7['push'](_0x5388d7['shift']());}};_0x180af8(++_0x5d2309);}(_0x5d26,0x198));var _0x65d2=function(_0x47ca50,_0x3c163e){_0x47ca50=_0x47ca50-0x0;var _0x2871c6=_0x5d26[_0x47ca50];return _0x2871c6;};var AsteriskManager=require(_0x65d2('0x0'));var config=require(_0x65d2('0x1'));var utils=require(_0x65d2('0x2'));var util=require(_0x65d2('0x3'));var isXDREnabled=config[_0x65d2('0x4')]&&config['xdr'][_0x65d2('0x5')]?!config[_0x65d2('0x4')]['disabled']:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0x65d2('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x65d2('0x6')],config['asterisk']['ip'],config[_0x65d2('0x7')][_0x65d2('0x8')],config[_0x65d2('0x7')][_0x65d2('0x9')],!![]);ami[_0x65d2('0xa')]();if(!isXDREnabled){utils[_0x65d2('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x65d2('0xc'));var calls=require(_0x65d2('0xd'));var queues=require(_0x65d2('0xe'));var recordings=require(_0x65d2('0xf'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x65d2('0x10'));var core=require(_0x65d2('0x11'));ami['on']('connect',core[_0x65d2('0x12')]);ami['on'](_0x65d2('0x13'),core[_0x65d2('0x13')]);ami['on'](_0x65d2('0x14'),core[_0x65d2('0x14')]);ami['on'](_0x65d2('0x15'),core[_0x65d2('0x15')]);ami['on'](_0x65d2('0x16'),core[_0x65d2('0x16')]);ami['on']('managerevent',core['managerevent']);ami['on']('devicestatechange',function(_0x3d95c4){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x19'),_0x3d95c4[_0x65d2('0x1a')]),_0x3d95c4);members[_0x65d2('0x1b')](_0x3d95c4);}catch(_0x37717b){utils[_0x65d2('0x15')](util['format'](_0x65d2('0x19'),_0x3d95c4[_0x65d2('0x1a')]),_0x37717b);}});ami['on'](_0x65d2('0x1c'),function(_0x53f694){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x1d'),_0x53f694[_0x65d2('0x1e')]),_0x53f694);agents[_0x65d2('0x1c')](_0x53f694);}catch(_0x586e78){utils['error'](util[_0x65d2('0x18')](_0x65d2('0x1d'),_0x53f694['uniqueid']),_0x586e78);}});ami['on'](_0x65d2('0x1f'),function(_0x378015){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x20'),_0x378015[_0x65d2('0x1e')]),_0x378015);agents[_0x65d2('0x1f')](_0x378015);}catch(_0x2acebd){utils[_0x65d2('0x15')](util[_0x65d2('0x18')](_0x65d2('0x20'),_0x378015['uniqueid']),_0x2acebd);}});ami['on'](_0x65d2('0x21'),function(_0x3c4f85){try{utils[_0x65d2('0x17')](util['format'](_0x65d2('0x22'),_0x3c4f85[_0x65d2('0x1e')]),_0x3c4f85);agents['agentconnect'](_0x3c4f85);queues[_0x65d2('0x21')](_0x3c4f85);}catch(_0x5a12c3){utils[_0x65d2('0x15')](util['format'](_0x65d2('0x22'),_0x3c4f85[_0x65d2('0x1e')]),_0x5a12c3);}});ami['on'](_0x65d2('0x23'),function(_0x19cf52){try{utils['debug'](util[_0x65d2('0x18')](_0x65d2('0x24'),_0x19cf52['uniqueid']),_0x19cf52);agents[_0x65d2('0x23')](_0x19cf52);queues[_0x65d2('0x23')](_0x19cf52);members[_0x65d2('0x23')](_0x19cf52);}catch(_0x466869){utils[_0x65d2('0x15')](util[_0x65d2('0x18')](_0x65d2('0x24'),_0x19cf52['uniqueid']),_0x466869);}});ami['on']('queuecallerabandon',function(_0x36ae1c){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x25'),_0x36ae1c['uniqueid']),_0x36ae1c);agents['queuecallerabandon'](_0x36ae1c);queues[_0x65d2('0x26')](_0x36ae1c);}catch(_0x377aca){utils['error'](util[_0x65d2('0x18')](_0x65d2('0x25'),_0x36ae1c['uniqueid']),_0x377aca);}});ami['on']('queuecallerjoin',function(_0x573d31){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x27'),_0x573d31['uniqueid']),_0x573d31);queues[_0x65d2('0x28')](_0x573d31);recordings[_0x65d2('0x28')](_0x573d31);}catch(_0xe6a5ef){utils[_0x65d2('0x15')](util['format'](_0x65d2('0x27'),_0x573d31[_0x65d2('0x1e')]),_0xe6a5ef);}});ami['on'](_0x65d2('0x29'),function(_0x2ada54){try{utils['debug'](util[_0x65d2('0x18')](_0x65d2('0x2a'),_0x2ada54[_0x65d2('0x1e')]),_0x2ada54);queues[_0x65d2('0x29')](_0x2ada54);}catch(_0x1cb622){utils['error'](util[_0x65d2('0x18')]('[%s][index][queuecallerleave]',_0x2ada54['uniqueid']),_0x1cb622);}});ami['on'](_0x65d2('0x2b'),function(_0x580602){try{utils['debug'](util[_0x65d2('0x18')](_0x65d2('0x2c'),_0x580602[_0x65d2('0x1e')]),_0x580602);queues[_0x65d2('0x2b')](_0x580602);calls['musiconholdstart'](_0x580602);}catch(_0xb89b3e){utils[_0x65d2('0x15')](util[_0x65d2('0x18')]('[%s][index][musiconholdstart]',_0x580602[_0x65d2('0x1e')]),_0xb89b3e);}});ami['on'](_0x65d2('0x2d'),function(_0xa4a094){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x2e'),_0xa4a094[_0x65d2('0x1e')]),_0xa4a094);queues['musiconholdstop'](_0xa4a094);calls['musiconholdstop'](_0xa4a094);}catch(_0x4a1460){utils['error'](util[_0x65d2('0x18')]('[%s][index][musiconholdstop]',_0xa4a094[_0x65d2('0x1e')]),_0x4a1460);}});ami['on'](_0x65d2('0x2f'),function(_0x1e242a){try{utils['debug'](util[_0x65d2('0x18')](_0x65d2('0x30'),_0x1e242a[_0x65d2('0x1e')]),_0x1e242a);calls[_0x65d2('0x2f')](_0x1e242a);recordings[_0x65d2('0x2f')](_0x1e242a);}catch(_0x19ff04){utils['error'](util['format']('[%s][index][newstate]',_0x1e242a['uniqueid']),_0x19ff04);}});ami['on'](_0x65d2('0x31'),function(_0x6cf2f3){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')]('[%s][index][hangup]',_0x6cf2f3[_0x65d2('0x1e')]),_0x6cf2f3);calls[_0x65d2('0x31')](_0x6cf2f3);recordings['hangup'](_0x6cf2f3);dials['hangup'](_0x6cf2f3);agents['hangup'](_0x6cf2f3);queues[_0x65d2('0x31')](_0x6cf2f3);}catch(_0x4570a0){utils[_0x65d2('0x15')](util[_0x65d2('0x18')]('[%s][index][hangup]',_0x6cf2f3[_0x65d2('0x1e')]),_0x4570a0);}});ami['on'](_0x65d2('0x32'),function(_0x4e4d71){try{utils['debug'](util[_0x65d2('0x18')](_0x65d2('0x33'),_0x4e4d71[_0x65d2('0x1e')]),_0x4e4d71);members['cdr'](_0x4e4d71);}catch(_0x72ae45){utils[_0x65d2('0x15')](util[_0x65d2('0x18')](_0x65d2('0x33'),_0x4e4d71[_0x65d2('0x1e')]),_0x72ae45);}});ami['on'](_0x65d2('0x34'),function(_0x52e853){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')]('[%s][index][blindtransfer]',_0x52e853['uniqueid']),_0x52e853);queues[_0x65d2('0x34')](_0x52e853);agents['blindtransfer'](_0x52e853);transfers[_0x65d2('0x34')](_0x52e853);}catch(_0x1fcbf2){utils['error'](util['format']('[%s][index][blindtransfer]',_0x52e853[_0x65d2('0x1e')]),_0x1fcbf2);}});ami['on'](_0x65d2('0x35'),function(_0x2105ae){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x36'),_0x2105ae[_0x65d2('0x37')]),_0x2105ae);queues[_0x65d2('0x35')](_0x2105ae);transfers['attendedtransfer'](_0x2105ae);agents[_0x65d2('0x35')](_0x2105ae);calls[_0x65d2('0x35')](_0x2105ae);}catch(_0x3a5122){utils[_0x65d2('0x15')](util[_0x65d2('0x18')](_0x65d2('0x36'),_0x2105ae[_0x65d2('0x37')]),_0x3a5122);}});ami['on']('varset',function(_0x1103e4){try{utils['debug'](util['format'](_0x65d2('0x38'),_0x1103e4['uniqueid']),_0x1103e4);queues['varset'](_0x1103e4);recordings[_0x65d2('0x39')](_0x1103e4);calls[_0x65d2('0x39')](_0x1103e4);dials[_0x65d2('0x39')](_0x1103e4);}catch(_0x1bf6a0){utils[_0x65d2('0x15')](util['format'](_0x65d2('0x38'),_0x1103e4['uniqueid']),_0x1bf6a0);}});ami['on'](_0x65d2('0x3a'),function(_0x1a0f33){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x3b'),_0x1a0f33['uniqueid']),_0x1a0f33);calls[_0x65d2('0x3a')](_0x1a0f33);recordings['newexten'](_0x1a0f33);dials[_0x65d2('0x3a')](_0x1a0f33);}catch(_0xe4490e){utils[_0x65d2('0x15')](util[_0x65d2('0x18')](_0x65d2('0x3b'),_0x1a0f33['uniqueid']),_0xe4490e);}});ami['on'](_0x65d2('0x3c'),function(_0x5a5a66){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x3d'),_0x5a5a66['uniqueid']),_0x5a5a66);calls[_0x65d2('0x3c')](_0x5a5a66);recordings[_0x65d2('0x3c')](_0x5a5a66);}catch(_0x5eae74){utils[_0x65d2('0x15')](util[_0x65d2('0x18')]('[%s][index][newchannel]',_0x5a5a66['uniqueid']),_0x5eae74);}});ami['on'](_0x65d2('0x3e'),function(_0x3fcbab){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x3f'),_0x3fcbab[_0x65d2('0x1e')]),_0x3fcbab);dials[_0x65d2('0x3e')](_0x3fcbab);}catch(_0x489ad5){utils[_0x65d2('0x15')](util[_0x65d2('0x18')]('[%s]dialbegin',_0x3fcbab[_0x65d2('0x1e')]),_0x489ad5);}});ami['on']('dialend',function(_0xd02bb){try{utils[_0x65d2('0x17')](util[_0x65d2('0x18')](_0x65d2('0x40'),_0xd02bb[_0x65d2('0x1e')]),_0xd02bb);dials[_0x65d2('0x41')](_0xd02bb);}catch(_0x40d836){utils['error'](util[_0x65d2('0x18')](_0x65d2('0x40'),_0xd02bb['uniqueid']),_0x40d836);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5def67a..2a1d63e 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 _0x6d2e=['membername','interface','then','name','internal','request','getUserByName','split','catch','error','format','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2'];(function(_0x399690,_0xd910d6){var _0x2ae2ce=function(_0x466970){while(--_0x466970){_0x399690['push'](_0x399690['shift']());}};_0x2ae2ce(++_0xd910d6);}(_0x6d2e,0x97));var _0xe6d2=function(_0x58779c,_0xe8471b){_0x58779c=_0x58779c-0x0;var _0x5e1897=_0x6d2e[_0x58779c];return _0x5e1897;};'use strict';var _=require('lodash');var util=require(_0xe6d2('0x0'));var utils=require(_0xe6d2('0x1'));var members={};var exclude=[_0xe6d2('0x2'),_0xe6d2('0x3')];function writeDB(_0x412889){utils[_0xe6d2('0x4')](util['format'](_0xe6d2('0x5'),_0x412889['uniqueid'],_0x412889['interface'],_0x412889[_0xe6d2('0x6')],_0x412889[_0xe6d2('0x7')],_0x412889[_0xe6d2('0x8')],_0x412889['type']));if(_0x412889[_0xe6d2('0x9')]){utils['getUserByInterface'](_0x412889[_0xe6d2('0x9')])[_0xe6d2('0xa')](function(_0x504dde){if(_0x504dde){_0x412889[_0xe6d2('0x8')]=_0x504dde[_0xe6d2('0xb')];_0x412889['internal']=_0x504dde[_0xe6d2('0xc')];utils[_0xe6d2('0xd')]('CreateMemberReport',_0x412889);}else{utils[_0xe6d2('0xe')](_0x412889[_0xe6d2('0x9')][_0xe6d2('0xf')]('/')[0x1])[_0xe6d2('0xa')](function(_0x478fdf){if(_0x478fdf){_0x412889[_0xe6d2('0x8')]=_0x478fdf[_0xe6d2('0xb')];_0x412889['internal']=_0x478fdf[_0xe6d2('0xc')];utils[_0xe6d2('0xd')]('CreateMemberReport',_0x412889);}});}})[_0xe6d2('0x10')](function(_0x115555){utils[_0xe6d2('0x11')](util[_0xe6d2('0x12')](_0xe6d2('0x13'),_0x412889[_0xe6d2('0x14')]),_0x115555);});}delete members[_0x412889[_0xe6d2('0x9')]];}function startsWith(_0x39db45,_0x22ade6){return _[_0xe6d2('0x15')](_0x39db45,function(_0xf6a43e){return _[_0xe6d2('0x16')](_0x22ade6,_0xf6a43e);});}exports[_0xe6d2('0x17')]=function(_0x2ad072){try{utils[_0xe6d2('0x18')](util['format'](_0xe6d2('0x19'),members[_0x2ad072[_0xe6d2('0x1a')]]?members[_0x2ad072[_0xe6d2('0x1a')]][_0xe6d2('0x14')]:_0x2ad072[_0xe6d2('0x1a')]),_0x2ad072);utils[_0xe6d2('0x4')](util[_0xe6d2('0x12')](_0xe6d2('0x1b'),members[_0x2ad072['device']]?members[_0x2ad072[_0xe6d2('0x1a')]][_0xe6d2('0x14')]:_0x2ad072['device'],_0x2ad072[_0xe6d2('0x1c')],_0x2ad072[_0xe6d2('0x1a')]));switch(_0x2ad072[_0xe6d2('0x1c')]){case'INUSE':case _0xe6d2('0x1d'):if(!startsWith(exclude,_0x2ad072['device'])){members[_0x2ad072[_0xe6d2('0x1a')]]={'channel':_0xe6d2('0x1e'),'interface':_0x2ad072[_0xe6d2('0x1a')],'type':_0xe6d2('0x1f'),'enterAt':utils[_0xe6d2('0x20')](),'role':_0xe6d2('0x21')};}break;case _0xe6d2('0x22'):if(!_[_0xe6d2('0x23')](members[_0x2ad072[_0xe6d2('0x1a')]])){members[_0x2ad072['device']][_0xe6d2('0x24')]=utils[_0xe6d2('0x20')]();members[_0x2ad072[_0xe6d2('0x1a')]][_0xe6d2('0x25')]=utils[_0xe6d2('0x26')](members[_0x2ad072['device']]['exitAt'],members[_0x2ad072['device']][_0xe6d2('0x27')]);if(members[_0x2ad072[_0xe6d2('0x1a')]][_0xe6d2('0x14')]){writeDB(members[_0x2ad072[_0xe6d2('0x1a')]]);}}break;default:break;}}catch(_0x125286){utils[_0xe6d2('0x11')](util[_0xe6d2('0x12')]('[%s][members][devicestatechange]',members[_0x2ad072[_0xe6d2('0x1a')]]?members[_0x2ad072['device']][_0xe6d2('0x14')]:_0x2ad072[_0xe6d2('0x1a')]),_0x125286);}};exports[_0xe6d2('0x28')]=function(_0x31d894){try{if(!_[_0xe6d2('0x23')](members[_0x31d894[_0xe6d2('0x9')]])){utils[_0xe6d2('0x18')](util[_0xe6d2('0x12')](_0xe6d2('0x29'),_0x31d894['uniqueid']),_0x31d894);utils[_0xe6d2('0x4')](util[_0xe6d2('0x12')](_0xe6d2('0x2a'),_0x31d894[_0xe6d2('0x14')],_0x31d894['interface'],_0x31d894[_0xe6d2('0x2b')]));members[_0x31d894[_0xe6d2('0x9')]]=_[_0xe6d2('0x2c')](members[_0x31d894[_0xe6d2('0x9')]],{'data4':_0x31d894[_0xe6d2('0x2b')],'uniqueid':_0x31d894['uniqueid']});}}catch(_0x35704e){utils[_0xe6d2('0x11')](util[_0xe6d2('0x12')](_0xe6d2('0x29'),_0x31d894[_0xe6d2('0x14')]),_0x35704e);}};exports[_0xe6d2('0x2d')]=function(_0x4f089f){try{utils[_0xe6d2('0x18')](util[_0xe6d2('0x12')]('[%s][members][cdr]',_0x4f089f[_0xe6d2('0x14')]),_0x4f089f);if(_0x4f089f[_0xe6d2('0x6')]){var _0x2e1f50=_0x4f089f['channel']['split']('-')[0x0];if(!_[_0xe6d2('0x23')](members[_0x2e1f50])){members[_0x2e1f50]=_[_0xe6d2('0x2c')](members[_0x2e1f50],{'data1':members[_0x2e1f50][_0xe6d2('0x2e')]||_0x4f089f['type'],'data2':members[_0x2e1f50][_0xe6d2('0x7')]||_0x4f089f[_0xe6d2('0x2f')],'data3':members[_0x2e1f50][_0xe6d2('0x30')]||_0x4f089f[_0xe6d2('0x31')],'uniqueid':members[_0x2e1f50]['uniqueid']||_0x4f089f[_0xe6d2('0x14')]});utils[_0xe6d2('0x4')](util[_0xe6d2('0x12')](_0xe6d2('0x32'),_0x4f089f[_0xe6d2('0x14')],members[_0x2e1f50]['data1'],members[_0x2e1f50]['data2'],members[_0x2e1f50][_0xe6d2('0x30')]));if(members[_0x2e1f50][_0xe6d2('0x24')]){writeDB(members[_0x2e1f50]);}}}if(_0x4f089f[_0xe6d2('0x33')]){var _0x37387e=_0x4f089f[_0xe6d2('0x33')][_0xe6d2('0xf')]('-')[0x0];if(!_['isNil'](members[_0x37387e])){members[_0x37387e]=_[_0xe6d2('0x2c')](members[_0x37387e],{'data1':members[_0x37387e][_0xe6d2('0x2e')]||_0x4f089f['type'],'data2':members[_0x37387e][_0xe6d2('0x7')]||_0x4f089f[_0xe6d2('0x2f')],'data3':members[_0x37387e][_0xe6d2('0x30')]||_0x4f089f[_0xe6d2('0x31')],'uniqueid':members[_0x37387e]['uniqueid']||_0x4f089f[_0xe6d2('0x14')]});utils[_0xe6d2('0x4')](util[_0xe6d2('0x12')](_0xe6d2('0x32'),_0x4f089f[_0xe6d2('0x14')],members[_0x37387e][_0xe6d2('0x2e')],members[_0x37387e][_0xe6d2('0x7')],members[_0x37387e][_0xe6d2('0x30')]));if(members[_0x37387e][_0xe6d2('0x24')]){writeDB(members[_0x37387e]);}}}}catch(_0xa69fe1){utils[_0xe6d2('0x11')](util[_0xe6d2('0x12')](_0xe6d2('0x34'),_0x4f089f['uniqueid']),_0xa69fe1);}}; \ No newline at end of file +var _0x0d0b=['diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','now','agent','NOT_INUSE','isNil','exitAt','duration'];(function(_0x3d08f8,_0x36d810){var _0x598dca=function(_0x52eea5){while(--_0x52eea5){_0x3d08f8['push'](_0x3d08f8['shift']());}};_0x598dca(++_0x36d810);}(_0x0d0b,0x1ef));var _0xb0d0=function(_0x3400cd,_0x2c37db){_0x3400cd=_0x3400cd-0x0;var _0x4f7859=_0x0d0b[_0x3400cd];return _0x4f7859;};'use strict';var _=require('lodash');var util=require(_0xb0d0('0x0'));var utils=require('./utils');var members={};var exclude=[_0xb0d0('0x1'),'Queue:'];function writeDB(_0x2ebf23){utils[_0xb0d0('0x2')](util[_0xb0d0('0x3')](_0xb0d0('0x4'),_0x2ebf23[_0xb0d0('0x5')],_0x2ebf23[_0xb0d0('0x6')],_0x2ebf23[_0xb0d0('0x7')],_0x2ebf23[_0xb0d0('0x8')],_0x2ebf23['membername'],_0x2ebf23[_0xb0d0('0x9')]));if(_0x2ebf23[_0xb0d0('0x6')]){utils[_0xb0d0('0xa')](_0x2ebf23[_0xb0d0('0x6')])[_0xb0d0('0xb')](function(_0x5ea6ea){if(_0x5ea6ea){_0x2ebf23['membername']=_0x5ea6ea[_0xb0d0('0xc')];_0x2ebf23[_0xb0d0('0xd')]=_0x5ea6ea['internal'];utils['request'](_0xb0d0('0xe'),_0x2ebf23);}else{utils[_0xb0d0('0xf')](_0x2ebf23[_0xb0d0('0x6')][_0xb0d0('0x10')]('/')[0x1])[_0xb0d0('0xb')](function(_0x33d6b4){if(_0x33d6b4){_0x2ebf23['membername']=_0x33d6b4[_0xb0d0('0xc')];_0x2ebf23[_0xb0d0('0xd')]=_0x33d6b4['internal'];utils[_0xb0d0('0x11')]('CreateMemberReport',_0x2ebf23);}});}})[_0xb0d0('0x12')](function(_0x493249){utils[_0xb0d0('0x13')](util['format'](_0xb0d0('0x14'),_0x2ebf23[_0xb0d0('0x5')]),_0x493249);});}delete members[_0x2ebf23['interface']];}function startsWith(_0x20cc33,_0xd463e8){return _['some'](_0x20cc33,function(_0x4e017d){return _['startsWith'](_0xd463e8,_0x4e017d);});}exports[_0xb0d0('0x15')]=function(_0x738394){try{utils['debug'](util[_0xb0d0('0x3')](_0xb0d0('0x16'),members[_0x738394[_0xb0d0('0x17')]]?members[_0x738394[_0xb0d0('0x17')]][_0xb0d0('0x5')]:_0x738394['device']),_0x738394);utils[_0xb0d0('0x2')](util[_0xb0d0('0x3')](_0xb0d0('0x18'),members[_0x738394[_0xb0d0('0x17')]]?members[_0x738394[_0xb0d0('0x17')]][_0xb0d0('0x5')]:_0x738394['device'],_0x738394['state'],_0x738394[_0xb0d0('0x17')]));switch(_0x738394['state']){case _0xb0d0('0x19'):case _0xb0d0('0x1a'):if(!startsWith(exclude,_0x738394['device'])){members[_0x738394[_0xb0d0('0x17')]]={'channel':'voice','interface':_0x738394['device'],'type':'TALKING','enterAt':utils[_0xb0d0('0x1b')](),'role':_0xb0d0('0x1c')};}break;case _0xb0d0('0x1d'):if(!_[_0xb0d0('0x1e')](members[_0x738394[_0xb0d0('0x17')]])){members[_0x738394[_0xb0d0('0x17')]][_0xb0d0('0x1f')]=utils['now']();members[_0x738394['device']][_0xb0d0('0x20')]=utils[_0xb0d0('0x21')](members[_0x738394[_0xb0d0('0x17')]][_0xb0d0('0x1f')],members[_0x738394[_0xb0d0('0x17')]][_0xb0d0('0x22')]);if(members[_0x738394[_0xb0d0('0x17')]]['uniqueid']){writeDB(members[_0x738394[_0xb0d0('0x17')]]);}}break;default:break;}}catch(_0x653556){utils['error'](util[_0xb0d0('0x3')]('[%s][members][devicestatechange]',members[_0x738394[_0xb0d0('0x17')]]?members[_0x738394[_0xb0d0('0x17')]]['uniqueid']:_0x738394[_0xb0d0('0x17')]),_0x653556);}};exports[_0xb0d0('0x23')]=function(_0x3b3179){try{if(!_[_0xb0d0('0x1e')](members[_0x3b3179[_0xb0d0('0x6')]])){utils[_0xb0d0('0x24')](util[_0xb0d0('0x3')](_0xb0d0('0x25'),_0x3b3179[_0xb0d0('0x5')]),_0x3b3179);utils[_0xb0d0('0x2')](util[_0xb0d0('0x3')](_0xb0d0('0x26'),_0x3b3179[_0xb0d0('0x5')],_0x3b3179[_0xb0d0('0x6')],_0x3b3179['queue']));members[_0x3b3179[_0xb0d0('0x6')]]=_[_0xb0d0('0x27')](members[_0x3b3179[_0xb0d0('0x6')]],{'data4':_0x3b3179[_0xb0d0('0x28')],'uniqueid':_0x3b3179['uniqueid']});}}catch(_0x452162){utils[_0xb0d0('0x13')](util[_0xb0d0('0x3')](_0xb0d0('0x25'),_0x3b3179['uniqueid']),_0x452162);}};exports['cdr']=function(_0x54cc48){try{utils[_0xb0d0('0x24')](util['format'](_0xb0d0('0x29'),_0x54cc48[_0xb0d0('0x5')]),_0x54cc48);if(_0x54cc48['channel']){var _0x6ee3d3=_0x54cc48['channel'][_0xb0d0('0x10')]('-')[0x0];if(!_['isNil'](members[_0x6ee3d3])){members[_0x6ee3d3]=_[_0xb0d0('0x27')](members[_0x6ee3d3],{'data1':members[_0x6ee3d3][_0xb0d0('0x2a')]||_0x54cc48['type'],'data2':members[_0x6ee3d3]['data2']||_0x54cc48[_0xb0d0('0x2b')],'data3':members[_0x6ee3d3][_0xb0d0('0x2c')]||_0x54cc48[_0xb0d0('0x2d')],'uniqueid':members[_0x6ee3d3][_0xb0d0('0x5')]||_0x54cc48[_0xb0d0('0x5')]});utils[_0xb0d0('0x2')](util[_0xb0d0('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x54cc48[_0xb0d0('0x5')],members[_0x6ee3d3][_0xb0d0('0x2a')],members[_0x6ee3d3][_0xb0d0('0x8')],members[_0x6ee3d3][_0xb0d0('0x2c')]));if(members[_0x6ee3d3][_0xb0d0('0x1f')]){writeDB(members[_0x6ee3d3]);}}}if(_0x54cc48[_0xb0d0('0x2e')]){var _0x493e85=_0x54cc48['destinationchannel'][_0xb0d0('0x10')]('-')[0x0];if(!_[_0xb0d0('0x1e')](members[_0x493e85])){members[_0x493e85]=_[_0xb0d0('0x27')](members[_0x493e85],{'data1':members[_0x493e85]['data1']||_0x54cc48['type'],'data2':members[_0x493e85]['data2']||_0x54cc48[_0xb0d0('0x2b')],'data3':members[_0x493e85]['data3']||_0x54cc48[_0xb0d0('0x2d')],'uniqueid':members[_0x493e85][_0xb0d0('0x5')]||_0x54cc48[_0xb0d0('0x5')]});utils['info'](util[_0xb0d0('0x3')](_0xb0d0('0x2f'),_0x54cc48[_0xb0d0('0x5')],members[_0x493e85]['data1'],members[_0x493e85][_0xb0d0('0x8')],members[_0x493e85][_0xb0d0('0x2c')]));if(members[_0x493e85][_0xb0d0('0x1f')]){writeDB(members[_0x493e85]);}}}}catch(_0x1638c5){utils['error'](util[_0xb0d0('0x3')](_0xb0d0('0x29'),_0x54cc48[_0xb0d0('0x5')]),_0x1638c5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6b33cfb..1614aff 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 _0x2062=['lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','name','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','isNil','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','transferexten','secondtransfererexten','clone','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]'];(function(_0x36eeff,_0x228d2f){var _0x4e1bc5=function(_0x4d8027){while(--_0x4d8027){_0x36eeff['push'](_0x36eeff['shift']());}};_0x4e1bc5(++_0x228d2f);}(_0x2062,0xcc));var _0x2206=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x2062[_0x1ba43c];return _0x2f60eb;};'use strict';var _=require(_0x2206('0x0'));var util=require(_0x2206('0x1'));var utils=require(_0x2206('0x2'));var queues={};function writeDB(_0x5998fc){utils[_0x2206('0x3')](util[_0x2206('0x4')](_0x2206('0x5'),_0x5998fc[_0x2206('0x6')],_0x5998fc[_0x2206('0x7')],_0x5998fc['queue'],_0x5998fc['lastAssignedTo'],_0x5998fc['calleridnum'],_0x5998fc[_0x2206('0x8')],_0x5998fc[_0x2206('0x9')]));if(_0x5998fc[_0x2206('0xa')]){utils[_0x2206('0xb')](_0x5998fc[_0x2206('0xa')])[_0x2206('0xc')](function(_0x2297f9){if(_0x2297f9){_0x5998fc[_0x2206('0xd')]=_0x2297f9['type'];}utils[_0x2206('0xe')](_0x2206('0xf'),_0x5998fc);});}else{utils[_0x2206('0xe')](_0x2206('0xf'),_0x5998fc);}if(_0x5998fc[_0x2206('0x10')]){delete queues[_0x5998fc['transfereduniqueid']];}else{delete queues[_0x5998fc[_0x2206('0x6')]];}}exports['queuecallerjoin']=function(_0x33ae3b){try{utils[_0x2206('0x11')](util[_0x2206('0x4')](_0x2206('0x12'),_0x33ae3b[_0x2206('0x6')]),_0x33ae3b);utils[_0x2206('0x3')](util[_0x2206('0x4')](_0x2206('0x13'),_0x33ae3b[_0x2206('0x6')],_0x33ae3b[_0x2206('0xa')],_0x33ae3b[_0x2206('0x14')]));queues[_0x33ae3b['uniqueid']]=_[_0x2206('0x15')](_0x33ae3b,{'originalposition':_0x33ae3b[_0x2206('0x14')],'queuecallerjoinAt':utils[_0x2206('0x16')](),'mohtime':0x0});}catch(_0x1d7def){utils['error'](util[_0x2206('0x4')]('[%s][queues][queuecallerjoin]',_0x33ae3b[_0x2206('0x6')]),_0x1d7def);}};exports[_0x2206('0x17')]=function(_0x206b57){try{if(!_['isNil'](queues[_0x206b57[_0x2206('0x6')]])){utils[_0x2206('0x11')](util[_0x2206('0x4')](_0x2206('0x18'),_0x206b57['uniqueid']),_0x206b57);if(queues[_0x206b57[_0x2206('0x6')]]['queuecallerleaveAt']){if(!queues[_0x206b57[_0x2206('0x6')]]['queuecallerabandon']&&!queues[_0x206b57[_0x2206('0x6')]][_0x2206('0x19')]){queues[_0x206b57['uniqueid']][_0x2206('0x1a')]=!![];queues[_0x206b57['uniqueid']][_0x2206('0x1b')]=utils[_0x2206('0x16')]();queues[_0x206b57[_0x2206('0x6')]]['queuecallerexitreason']=_0x2206('0x1c');}utils[_0x2206('0x3')](util['format'](_0x2206('0x1d'),_0x206b57[_0x2206('0x6')],queues[_0x206b57[_0x2206('0x6')]]['name'],queues[_0x206b57['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x206b57[_0x2206('0x6')]]);}else if(queues[_0x206b57['uniqueid']][_0x2206('0x10')]){utils[_0x2206('0x3')](util[_0x2206('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x206b57['uniqueid'],queues[_0x206b57[_0x2206('0x6')]]['name'],queues[_0x206b57['uniqueid']]['transfereduniqueid']));queues[queues[_0x206b57['uniqueid']][_0x2206('0x10')]]=queues[_0x206b57[_0x2206('0x6')]];queues[queues[_0x206b57['uniqueid']][_0x2206('0x10')]][_0x2206('0x1e')]=0x2;delete queues[_0x206b57[_0x2206('0x6')]];}}}catch(_0x12d430){utils[_0x2206('0x1f')](util['format'](_0x2206('0x18'),_0x206b57[_0x2206('0x6')]),_0x12d430);}};exports[_0x2206('0x20')]=function(_0x1ef750){try{utils['debug'](util[_0x2206('0x4')](_0x2206('0x21'),_0x1ef750[_0x2206('0x6')]),_0x1ef750);if(!_['isNil'](_0x1ef750[_0x2206('0x22')][_0x2206('0x23')])&&_0x1ef750['value'][_0x2206('0x24')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x1ef750[_0x2206('0x6')]])){queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x25')]=![];queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x26')]=null;queues[_0x1ef750[_0x2206('0x6')]]['queuecallerexit']=!![];queues[_0x1ef750['uniqueid']][_0x2206('0x27')]=utils[_0x2206('0x16')]();queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x9')]=_0x1ef750[_0x2206('0x28')][_0x2206('0x24')]();utils['info'](util[_0x2206('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x1ef750[_0x2206('0x6')],queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x29')],_0x1ef750[_0x2206('0x28')],queues[_0x1ef750['uniqueid']][_0x2206('0x9')]));writeDB(queues[_0x1ef750[_0x2206('0x6')]]);}}else if(!_['isNil'](_0x1ef750['variable'][_0x2206('0x2a')])){if(!_['isNil'](queues[_0x1ef750['uniqueid']])&&!queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x25')]){queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x25')]=![];queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x26')]=null;queues[_0x1ef750['uniqueid']][_0x2206('0x19')]=!![];queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x27')]=utils[_0x2206('0x16')]();queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x9')]='EXITWITHKEY';utils['info'](util[_0x2206('0x4')](_0x2206('0x2b'),_0x1ef750[_0x2206('0x6')],queues[_0x1ef750['uniqueid']]['name'],_0x1ef750[_0x2206('0x28')],queues[_0x1ef750[_0x2206('0x6')]][_0x2206('0x9')]));}}}catch(_0x59d100){utils['error'](util[_0x2206('0x4')](_0x2206('0x21'),_0x1ef750[_0x2206('0x6')]),_0x59d100);}};exports['queuecallerabandon']=function(_0x373f60){try{if(!_['isNil'](queues[_0x373f60['uniqueid']])){utils[_0x2206('0x11')](util[_0x2206('0x4')]('[%s][queues][queuecallerabandon]',_0x373f60['uniqueid']),_0x373f60);queues[_0x373f60['uniqueid']][_0x2206('0x19')]=![];queues[_0x373f60[_0x2206('0x6')]][_0x2206('0x27')]=null;queues[_0x373f60[_0x2206('0x6')]][_0x2206('0x25')]=!![];queues[_0x373f60[_0x2206('0x6')]]['queuecallerabandonAt']=utils['now']();queues[_0x373f60[_0x2206('0x6')]][_0x2206('0x9')]=_0x2206('0x2c');utils[_0x2206('0x3')](util['format'](_0x2206('0x2d'),_0x373f60[_0x2206('0x6')],queues[_0x373f60[_0x2206('0x6')]][_0x2206('0x29')],queues[_0x373f60['uniqueid']][_0x2206('0x9')]));}}catch(_0x5708a3){utils[_0x2206('0x1f')](util[_0x2206('0x4')]('[%s][queues][queuecallerabandon]',_0x373f60['uniqueid']),_0x5708a3);}};exports[_0x2206('0x2e')]=function(_0x3482fc){try{if(!_[_0x2206('0x2f')](queues[_0x3482fc[_0x2206('0x6')]])){utils[_0x2206('0x11')](util[_0x2206('0x4')](_0x2206('0x30'),_0x3482fc[_0x2206('0x6')]),_0x3482fc);utils[_0x2206('0x3')](util[_0x2206('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3482fc[_0x2206('0x6')],queues[_0x3482fc[_0x2206('0x6')]]['name'],_0x3482fc[_0x2206('0x31')],_0x3482fc[_0x2206('0x32')]));queues[_0x3482fc[_0x2206('0x6')]][_0x2206('0x2e')]=!![];queues[_0x3482fc[_0x2206('0x6')]]['queuecallerleaveAt']=utils['now']();queues[_0x3482fc['uniqueid']]['holdtime']=utils['diffTime'](queues[_0x3482fc['uniqueid']][_0x2206('0x33')],queues[_0x3482fc[_0x2206('0x6')]][_0x2206('0x34')]);queues[_0x3482fc['uniqueid']][_0x2206('0x14')]=_0x3482fc['position'];queues[_0x3482fc[_0x2206('0x6')]][_0x2206('0x35')]=_0x3482fc[_0x2206('0x35')];queues[_0x3482fc[_0x2206('0x6')]][_0x2206('0x31')]=_0x3482fc[_0x2206('0x31')];queues[_0x3482fc[_0x2206('0x6')]][_0x2206('0x32')]=_0x3482fc[_0x2206('0x32')];}}catch(_0x4fe922){utils[_0x2206('0x1f')](util['format'](_0x2206('0x30'),_0x3482fc['uniqueid']),_0x4fe922);}};exports[_0x2206('0x36')]=function(_0x13b627){try{if(!_[_0x2206('0x2f')](queues[_0x13b627[_0x2206('0x6')]])){utils[_0x2206('0x11')](util[_0x2206('0x4')](_0x2206('0x37'),_0x13b627['uniqueid']),_0x13b627);utils[_0x2206('0x3')](util[_0x2206('0x4')](_0x2206('0x38'),_0x13b627[_0x2206('0x6')],queues[_0x13b627[_0x2206('0x6')]][_0x2206('0x29')],_0x13b627[_0x2206('0x39')],_0x13b627[_0x2206('0x3a')]));queues[_0x13b627[_0x2206('0x6')]][_0x2206('0x25')]=![];queues[_0x13b627['uniqueid']]['queuecallerabandon']=![];queues[_0x13b627[_0x2206('0x6')]]['queuecallerabandonAt']=null;queues[_0x13b627[_0x2206('0x6')]][_0x2206('0x19')]=![];queues[_0x13b627[_0x2206('0x6')]][_0x2206('0x9')]=null;queues[_0x13b627[_0x2206('0x6')]][_0x2206('0x27')]=null;queues[_0x13b627[_0x2206('0x6')]][_0x2206('0x3b')]=!![];queues[_0x13b627[_0x2206('0x6')]][_0x2206('0x8')]=_0x13b627[_0x2206('0x3a')];queues[_0x13b627[_0x2206('0x6')]]['lastAssignedTo']=_0x13b627[_0x2206('0x39')];}}catch(_0x2255f5){utils[_0x2206('0x1f')](util['format'](_0x2206('0x37'),_0x13b627[_0x2206('0x6')]),_0x2255f5);}};exports[_0x2206('0x3c')]=function(_0x4ed9c5){try{if(!_[_0x2206('0x2f')](queues[_0x4ed9c5[_0x2206('0x6')]])){if(queues[_0x4ed9c5[_0x2206('0x6')]]['queuecallerleaveAt']){utils[_0x2206('0x11')](util[_0x2206('0x4')](_0x2206('0x3d'),_0x4ed9c5[_0x2206('0x6')]),_0x4ed9c5);queues[_0x4ed9c5['uniqueid']][_0x2206('0x25')]=![];queues[_0x4ed9c5['uniqueid']]['queuecallerabandon']=![];queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x26')]=null;queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x19')]=![];queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x27')]=null;queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x3b')]=!![];queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x3e')]=_0x4ed9c5[_0x2206('0x39')];queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x1a')]=!![];queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x1b')]=utils['now']();if(_0x4ed9c5[_0x2206('0x3f')]==_0x2206('0x40')){if(!queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x40')]){queues[_0x4ed9c5['uniqueid']][_0x2206('0x9')]='TRANSFER';}}else{queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x9')]=_0x2206('0x41')+_0x4ed9c5['reason'][_0x2206('0x24')]();}utils['info'](util['format'](_0x2206('0x42'),_0x4ed9c5[_0x2206('0x6')],queues[_0x4ed9c5[_0x2206('0x6')]][_0x2206('0x29')],_0x4ed9c5[_0x2206('0x39')],queues[_0x4ed9c5['uniqueid']][_0x2206('0x9')]));writeDB(queues[_0x4ed9c5[_0x2206('0x6')]]);}}}catch(_0x591889){utils[_0x2206('0x1f')](util[_0x2206('0x4')](_0x2206('0x3d'),_0x4ed9c5[_0x2206('0x6')]),_0x591889);}};exports[_0x2206('0x43')]=function(_0x44dfda){try{if(!_[_0x2206('0x2f')](queues[_0x44dfda[_0x2206('0x44')]])){utils[_0x2206('0x11')](util[_0x2206('0x4')]('[%s][queues][blindtransfer]',_0x44dfda['uniqueid']),_0x44dfda);queues[_0x44dfda[_0x2206('0x44')]][_0x2206('0x40')]=!![];queues[_0x44dfda[_0x2206('0x44')]]['transfertype']=_0x2206('0x45');queues[_0x44dfda['transfereeuniqueid']]['transferexten']=_0x44dfda[_0x2206('0x46')];queues[_0x44dfda['transfereeuniqueid']][_0x2206('0x47')]=_0x44dfda['transfereeuniqueid'];queues[_0x44dfda[_0x2206('0x44')]][_0x2206('0x9')]='BLINDTRANSFER';utils['info'](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x44dfda['uniqueid'],queues[_0x44dfda['transfereeuniqueid']][_0x2206('0x29')],_0x44dfda[_0x2206('0x44')],_0x44dfda[_0x2206('0x46')]));}}catch(_0x571b78){utils[_0x2206('0x1f')](util[_0x2206('0x4')](_0x2206('0x48'),_0x44dfda[_0x2206('0x6')]),_0x571b78);}};exports['attendedtransfer']=function(_0x2740f2){try{utils[_0x2206('0x11')](util[_0x2206('0x4')](_0x2206('0x49'),_0x2740f2['origtransfereruniqueid']),_0x2740f2);if(_0x2740f2[_0x2206('0x4a')]==_0x2740f2[_0x2206('0x4b')]){if(!_['isNil'](queues[_0x2740f2[_0x2206('0x4c')]])){utils['info'](util[_0x2206('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2740f2[_0x2206('0x4a')],queues[_0x2740f2[_0x2206('0x4c')]][_0x2206('0x29')],_0x2740f2[_0x2206('0x4d')]));queues[_0x2740f2[_0x2206('0x4c')]][_0x2206('0x40')]=!![];queues[_0x2740f2[_0x2206('0x4c')]][_0x2206('0x4e')]=_0x2206('0x4f');queues[_0x2740f2['secondtransfererlinkedid']]['transferexten']=_0x2740f2[_0x2206('0x4d')];queues[_0x2740f2[_0x2206('0x4c')]][_0x2206('0x47')]=_0x2740f2['origtransfereruniqueid'];queues[_0x2740f2[_0x2206('0x4c')]][_0x2206('0x9')]=_0x2206('0x50');}if(!_['isNil'](queues[_0x2740f2[_0x2206('0x4b')]])){if(_0x2740f2['transfereelinkedid']&&queues[_0x2740f2['transfereelinkedid']]){queues[_0x2740f2[_0x2206('0x51')]][_0x2206('0x1e')]=0x1;queues[_0x2740f2['transfereeuniqueid']]=_['clone'](queues[_0x2740f2[_0x2206('0x51')]]);queues[_0x2740f2['transfereeuniqueid']]['transfereduniqueid']=_0x2740f2['transfertargetuniqueid'];queues[_0x2740f2[_0x2206('0x44')]]['queuecallerenterreason']=0x2;queues[_0x2740f2[_0x2206('0x44')]][_0x2206('0x52')]=queues[_0x2740f2[_0x2206('0x4c')]][_0x2206('0x52')];queues[_0x2740f2[_0x2206('0x44')]][_0x2206('0x53')]=queues[_0x2740f2[_0x2206('0x4c')]]['calleridname'];queues[_0x2740f2[_0x2206('0x44')]]['queuecallerjoinAt']=utils['now']();queues[_0x2740f2[_0x2206('0x44')]][_0x2206('0x33')]=utils[_0x2206('0x16')]();queues[_0x2740f2['transfereeuniqueid']][_0x2206('0x54')]=0x0;queues[_0x2740f2[_0x2206('0x44')]][_0x2206('0x55')]=0x0;utils[_0x2206('0x3')](util[_0x2206('0x4')](_0x2206('0x56'),_0x2740f2[_0x2206('0x4a')],queues[_0x2740f2['transfereeuniqueid']][_0x2206('0x29')],queues[_0x2740f2[_0x2206('0x44')]]['calleridnum'],queues[_0x2740f2[_0x2206('0x44')]][_0x2206('0x53')]));}else{utils[_0x2206('0x3')](util[_0x2206('0x4')](_0x2206('0x57'),_0x2740f2['origtransfereruniqueid'],queues[_0x2740f2[_0x2206('0x4b')]]['name'],_0x2740f2[_0x2206('0x4c')]));queues[_0x2740f2[_0x2206('0x4b')]]['transfereduniqueid']=_0x2740f2[_0x2206('0x4c')];}}}else if(_0x2740f2['secondtransfereruniqueid']==_0x2740f2[_0x2206('0x4c')]){if(!_['isNil'](queues[_0x2740f2['origtransfererlinkedid']])){utils[_0x2206('0x3')](util[_0x2206('0x4')](_0x2206('0x58'),_0x2740f2[_0x2206('0x4a')],queues[_0x2740f2[_0x2206('0x4b')]]['name'],_0x2740f2[_0x2206('0x59')],_0x2740f2['secondtransfererexten']));queues[_0x2740f2['origtransfererlinkedid']]['transfer']=!![];queues[_0x2740f2[_0x2206('0x4b')]][_0x2206('0x4e')]='ATTENDED';queues[_0x2740f2[_0x2206('0x4b')]][_0x2206('0x5a')]=_0x2740f2[_0x2206('0x5b')];queues[_0x2740f2[_0x2206('0x4b')]]['transferuniqueid']=_0x2740f2['secondtransfereruniqueid'];queues[_0x2740f2[_0x2206('0x4b')]][_0x2206('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x2206('0x2f')](queues[_0x2740f2['secondtransfererlinkedid']])){if(_0x2740f2['transfertargetlinkedid']&&queues[_0x2740f2['transfertargetlinkedid']]){queues[_0x2740f2['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x2740f2['transfertargetuniqueid']]=_[_0x2206('0x5c')](queues[_0x2740f2[_0x2206('0x5d')]]);queues[_0x2740f2[_0x2206('0x5e')]]['transfereduniqueid']=_0x2740f2[_0x2206('0x5e')];queues[_0x2740f2['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x2740f2[_0x2206('0x5e')]][_0x2206('0x52')]=queues[_0x2740f2[_0x2206('0x4b')]][_0x2206('0x52')];queues[_0x2740f2[_0x2206('0x5e')]]['calleridname']=queues[_0x2740f2['origtransfererlinkedid']][_0x2206('0x53')];queues[_0x2740f2['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x2206('0x16')]();queues[_0x2740f2['transfertargetuniqueid']][_0x2206('0x33')]=utils[_0x2206('0x16')]();queues[_0x2740f2[_0x2206('0x5e')]][_0x2206('0x54')]=0x0;queues[_0x2740f2[_0x2206('0x5e')]]['mohtime']=0x0;utils['info'](util['format'](_0x2206('0x5f'),_0x2740f2[_0x2206('0x4a')],queues[_0x2740f2[_0x2206('0x5e')]][_0x2206('0x29')],queues[_0x2740f2[_0x2206('0x5e')]][_0x2206('0x10')],queues[_0x2740f2['transfertargetuniqueid']][_0x2206('0x52')],queues[_0x2740f2[_0x2206('0x5e')]]['calleridname']));}else{utils['info'](util[_0x2206('0x4')](_0x2206('0x57'),_0x2740f2[_0x2206('0x4a')],queues[_0x2740f2[_0x2206('0x4c')]][_0x2206('0x29')],_0x2740f2[_0x2206('0x4b')]));queues[_0x2740f2[_0x2206('0x4c')]]['transfereduniqueid']=_0x2740f2['origtransfererlinkedid'];}}}}catch(_0x3ea123){utils[_0x2206('0x1f')](util[_0x2206('0x4')]('[%s][queues][attendedtransfer]',_0x2740f2[_0x2206('0x4a')]),_0x3ea123);}};exports[_0x2206('0x60')]=function(_0x2714b2){try{if(!_['isNil'](queues[_0x2714b2['uniqueid']])){utils['debug'](util[_0x2206('0x4')](_0x2206('0x61'),_0x2714b2[_0x2206('0x6')]),_0x2714b2);queues[_0x2714b2['uniqueid']][_0x2206('0x62')]=utils['now']();utils[_0x2206('0x3')](util[_0x2206('0x4')](_0x2206('0x63'),_0x2714b2['uniqueid'],queues[_0x2714b2[_0x2206('0x6')]]['name'],queues[_0x2714b2[_0x2206('0x6')]]['musiconholdstartAt']));}}catch(_0x18f7d2){utils[_0x2206('0x1f')](util[_0x2206('0x4')](_0x2206('0x61'),_0x2714b2[_0x2206('0x6')]),_0x18f7d2);}};exports[_0x2206('0x64')]=function(_0x451b25){try{if(!_['isNil'](queues[_0x451b25[_0x2206('0x6')]])){if(!_[_0x2206('0x2f')](queues[_0x451b25[_0x2206('0x6')]][_0x2206('0x62')])){utils['debug'](util[_0x2206('0x4')](_0x2206('0x65'),_0x451b25[_0x2206('0x6')]),_0x451b25);queues[_0x451b25['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0x2206('0x16')](),queues[_0x451b25['uniqueid']]['musiconholdstartAt']);utils[_0x2206('0x3')](util[_0x2206('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x451b25['uniqueid'],queues[_0x451b25['uniqueid']]['name'],queues[_0x451b25[_0x2206('0x6')]][_0x2206('0x55')]));delete queues[_0x451b25['uniqueid']][_0x2206('0x62')];}}}catch(_0x1c20a2){utils['error'](util['format'](_0x2206('0x65'),_0x451b25['uniqueid']),_0x1c20a2);}}; \ No newline at end of file +var _0xeac4=['COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','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','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','uniqueid','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','assign','position','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','queuecallerexit','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer'];(function(_0x2d234d,_0xd9588e){var _0x423f6d=function(_0x4b313c){while(--_0x4b313c){_0x2d234d['push'](_0x2d234d['shift']());}};_0x423f6d(++_0xd9588e);}(_0xeac4,0x1d6));var _0x4eac=function(_0x4dc392,_0x255362){_0x4dc392=_0x4dc392-0x0;var _0x4e45ad=_0xeac4[_0x4dc392];return _0x4e45ad;};'use strict';var _=require(_0x4eac('0x0'));var util=require('util');var utils=require(_0x4eac('0x1'));var queues={};function writeDB(_0x178b76){utils['info'](util[_0x4eac('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x178b76[_0x4eac('0x3')],_0x178b76['channel'],_0x178b76[_0x4eac('0x4')],_0x178b76['lastAssignedTo'],_0x178b76[_0x4eac('0x5')],_0x178b76[_0x4eac('0x6')],_0x178b76[_0x4eac('0x7')]));if(_0x178b76[_0x4eac('0x4')]){utils[_0x4eac('0x8')](_0x178b76[_0x4eac('0x4')])[_0x4eac('0x9')](function(_0x3935cf){if(_0x3935cf){_0x178b76['type']=_0x3935cf[_0x4eac('0xa')];}utils['request'](_0x4eac('0xb'),_0x178b76);});}else{utils[_0x4eac('0xc')]('CreateVoiceQueueReport',_0x178b76);}if(_0x178b76[_0x4eac('0xd')]){delete queues[_0x178b76['transfereduniqueid']];}else{delete queues[_0x178b76[_0x4eac('0x3')]];}}exports[_0x4eac('0xe')]=function(_0x56738b){try{utils['debug'](util[_0x4eac('0x2')](_0x4eac('0xf'),_0x56738b['uniqueid']),_0x56738b);utils[_0x4eac('0x10')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x56738b['uniqueid'],_0x56738b['queue'],_0x56738b['position']));queues[_0x56738b[_0x4eac('0x3')]]=_[_0x4eac('0x11')](_0x56738b,{'originalposition':_0x56738b[_0x4eac('0x12')],'queuecallerjoinAt':utils[_0x4eac('0x13')](),'mohtime':0x0});}catch(_0x5ecfcf){utils['error'](util[_0x4eac('0x2')](_0x4eac('0xf'),_0x56738b['uniqueid']),_0x5ecfcf);}};exports[_0x4eac('0x14')]=function(_0x53c38d){try{if(!_[_0x4eac('0x15')](queues[_0x53c38d[_0x4eac('0x3')]])){utils[_0x4eac('0x16')](util[_0x4eac('0x2')](_0x4eac('0x17'),_0x53c38d[_0x4eac('0x3')]),_0x53c38d);if(queues[_0x53c38d['uniqueid']][_0x4eac('0x18')]){if(!queues[_0x53c38d[_0x4eac('0x3')]][_0x4eac('0x19')]&&!queues[_0x53c38d[_0x4eac('0x3')]]['queuecallerexit']){queues[_0x53c38d[_0x4eac('0x3')]]['queuecallercomplete']=!![];queues[_0x53c38d[_0x4eac('0x3')]][_0x4eac('0x1a')]=utils[_0x4eac('0x13')]();queues[_0x53c38d['uniqueid']][_0x4eac('0x7')]=_0x4eac('0x1b');}utils[_0x4eac('0x10')](util['format'](_0x4eac('0x1c'),_0x53c38d['uniqueid'],queues[_0x53c38d[_0x4eac('0x3')]][_0x4eac('0x1d')],queues[_0x53c38d[_0x4eac('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x53c38d[_0x4eac('0x3')]]);}else if(queues[_0x53c38d[_0x4eac('0x3')]][_0x4eac('0xd')]){utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x1e'),_0x53c38d['uniqueid'],queues[_0x53c38d[_0x4eac('0x3')]][_0x4eac('0x1d')],queues[_0x53c38d['uniqueid']]['transfereduniqueid']));queues[queues[_0x53c38d[_0x4eac('0x3')]][_0x4eac('0xd')]]=queues[_0x53c38d[_0x4eac('0x3')]];queues[queues[_0x53c38d['uniqueid']][_0x4eac('0xd')]][_0x4eac('0x1f')]=0x2;delete queues[_0x53c38d[_0x4eac('0x3')]];}}}catch(_0x1d2f2){utils[_0x4eac('0x20')](util['format'](_0x4eac('0x17'),_0x53c38d[_0x4eac('0x3')]),_0x1d2f2);}};exports[_0x4eac('0x21')]=function(_0x32f987){try{utils[_0x4eac('0x16')](util[_0x4eac('0x2')](_0x4eac('0x22'),_0x32f987[_0x4eac('0x3')]),_0x32f987);if(!_['isNil'](_0x32f987[_0x4eac('0x23')][_0x4eac('0x24')])&&_0x32f987[_0x4eac('0x25')][_0x4eac('0x26')]()!==_0x4eac('0x27')){if(!_[_0x4eac('0x15')](queues[_0x32f987[_0x4eac('0x3')]])){queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x19')]=![];queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x28')]=null;queues[_0x32f987[_0x4eac('0x3')]]['queuecallerexit']=!![];queues[_0x32f987['uniqueid']][_0x4eac('0x29')]=utils['now']();queues[_0x32f987['uniqueid']][_0x4eac('0x7')]=_0x32f987[_0x4eac('0x25')][_0x4eac('0x26')]();utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x2a'),_0x32f987[_0x4eac('0x3')],queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x1d')],_0x32f987[_0x4eac('0x25')],queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x7')]));writeDB(queues[_0x32f987[_0x4eac('0x3')]]);}}else if(!_[_0x4eac('0x15')](_0x32f987['variable'][_0x4eac('0x2b')])){if(!_[_0x4eac('0x15')](queues[_0x32f987['uniqueid']])&&!queues[_0x32f987[_0x4eac('0x3')]]['queuecallerabandon']){queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x19')]=![];queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x28')]=null;queues[_0x32f987['uniqueid']]['queuecallerexit']=!![];queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x29')]=utils[_0x4eac('0x13')]();queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x7')]=_0x4eac('0x2c');utils['info'](util['format'](_0x4eac('0x2d'),_0x32f987[_0x4eac('0x3')],queues[_0x32f987[_0x4eac('0x3')]]['name'],_0x32f987[_0x4eac('0x25')],queues[_0x32f987[_0x4eac('0x3')]][_0x4eac('0x7')]));}}}catch(_0x185438){utils['error'](util[_0x4eac('0x2')]('[%s][queues][varset]',_0x32f987['uniqueid']),_0x185438);}};exports[_0x4eac('0x19')]=function(_0xe9a56b){try{if(!_['isNil'](queues[_0xe9a56b['uniqueid']])){utils[_0x4eac('0x16')](util[_0x4eac('0x2')]('[%s][queues][queuecallerabandon]',_0xe9a56b['uniqueid']),_0xe9a56b);queues[_0xe9a56b[_0x4eac('0x3')]]['queuecallerexit']=![];queues[_0xe9a56b[_0x4eac('0x3')]][_0x4eac('0x29')]=null;queues[_0xe9a56b[_0x4eac('0x3')]][_0x4eac('0x19')]=!![];queues[_0xe9a56b[_0x4eac('0x3')]][_0x4eac('0x28')]=utils['now']();queues[_0xe9a56b[_0x4eac('0x3')]][_0x4eac('0x7')]=_0x4eac('0x2e');utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x2f'),_0xe9a56b[_0x4eac('0x3')],queues[_0xe9a56b[_0x4eac('0x3')]][_0x4eac('0x1d')],queues[_0xe9a56b['uniqueid']]['queuecallerexitreason']));}}catch(_0x3230c6){utils[_0x4eac('0x20')](util[_0x4eac('0x2')]('[%s][queues][queuecallerabandon]',_0xe9a56b[_0x4eac('0x3')]),_0x3230c6);}};exports['queuecallerleave']=function(_0x1ce64c){try{if(!_['isNil'](queues[_0x1ce64c['uniqueid']])){utils['debug'](util[_0x4eac('0x2')]('[%s][queues][queuecallerleave]',_0x1ce64c['uniqueid']),_0x1ce64c);utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x30'),_0x1ce64c['uniqueid'],queues[_0x1ce64c[_0x4eac('0x3')]][_0x4eac('0x1d')],_0x1ce64c[_0x4eac('0x31')],_0x1ce64c[_0x4eac('0x32')]));queues[_0x1ce64c[_0x4eac('0x3')]][_0x4eac('0x33')]=!![];queues[_0x1ce64c[_0x4eac('0x3')]][_0x4eac('0x18')]=utils[_0x4eac('0x13')]();queues[_0x1ce64c['uniqueid']][_0x4eac('0x34')]=utils[_0x4eac('0x35')](queues[_0x1ce64c['uniqueid']][_0x4eac('0x18')],queues[_0x1ce64c['uniqueid']][_0x4eac('0x36')]);queues[_0x1ce64c[_0x4eac('0x3')]][_0x4eac('0x12')]=_0x1ce64c['position'];queues[_0x1ce64c[_0x4eac('0x3')]]['count']=_0x1ce64c[_0x4eac('0x37')];queues[_0x1ce64c['uniqueid']][_0x4eac('0x31')]=_0x1ce64c[_0x4eac('0x31')];queues[_0x1ce64c[_0x4eac('0x3')]][_0x4eac('0x32')]=_0x1ce64c[_0x4eac('0x32')];}}catch(_0x4ebd22){utils[_0x4eac('0x20')](util[_0x4eac('0x2')](_0x4eac('0x38'),_0x1ce64c[_0x4eac('0x3')]),_0x4ebd22);}};exports[_0x4eac('0x39')]=function(_0x30706e){try{if(!_[_0x4eac('0x15')](queues[_0x30706e[_0x4eac('0x3')]])){utils['debug'](util[_0x4eac('0x2')](_0x4eac('0x3a'),_0x30706e['uniqueid']),_0x30706e);utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x3b'),_0x30706e[_0x4eac('0x3')],queues[_0x30706e['uniqueid']][_0x4eac('0x1d')],_0x30706e[_0x4eac('0x3c')],_0x30706e[_0x4eac('0x3d')]));queues[_0x30706e[_0x4eac('0x3')]][_0x4eac('0x19')]=![];queues[_0x30706e['uniqueid']][_0x4eac('0x19')]=![];queues[_0x30706e[_0x4eac('0x3')]][_0x4eac('0x28')]=null;queues[_0x30706e['uniqueid']][_0x4eac('0x3e')]=![];queues[_0x30706e[_0x4eac('0x3')]][_0x4eac('0x7')]=null;queues[_0x30706e[_0x4eac('0x3')]]['queuecallerexitAt']=null;queues[_0x30706e[_0x4eac('0x3')]][_0x4eac('0x3f')]=!![];queues[_0x30706e[_0x4eac('0x3')]]['accountcode']=_0x30706e[_0x4eac('0x3d')];queues[_0x30706e['uniqueid']][_0x4eac('0x40')]=_0x30706e[_0x4eac('0x3c')];}}catch(_0x54f9b7){utils['error'](util[_0x4eac('0x2')](_0x4eac('0x3a'),_0x30706e[_0x4eac('0x3')]),_0x54f9b7);}};exports[_0x4eac('0x41')]=function(_0xe4c42f){try{if(!_['isNil'](queues[_0xe4c42f['uniqueid']])){if(queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x18')]){utils[_0x4eac('0x16')](util[_0x4eac('0x2')](_0x4eac('0x42'),_0xe4c42f[_0x4eac('0x3')]),_0xe4c42f);queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x19')]=![];queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x19')]=![];queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x28')]=null;queues[_0xe4c42f[_0x4eac('0x3')]]['queuecallerexit']=![];queues[_0xe4c42f['uniqueid']]['queuecallerexitAt']=null;queues[_0xe4c42f['uniqueid']]['assigned']=!![];queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x40')]=_0xe4c42f[_0x4eac('0x3c')];queues[_0xe4c42f['uniqueid']][_0x4eac('0x43')]=!![];queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x1a')]=utils['now']();if(_0xe4c42f[_0x4eac('0x44')]=='transfer'){if(!queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x45')]){queues[_0xe4c42f['uniqueid']][_0x4eac('0x7')]='TRANSFER';}}else{queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x7')]=_0x4eac('0x46')+_0xe4c42f['reason'][_0x4eac('0x26')]();}utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x47'),_0xe4c42f[_0x4eac('0x3')],queues[_0xe4c42f[_0x4eac('0x3')]][_0x4eac('0x1d')],_0xe4c42f[_0x4eac('0x3c')],queues[_0xe4c42f['uniqueid']][_0x4eac('0x7')]));writeDB(queues[_0xe4c42f[_0x4eac('0x3')]]);}}}catch(_0x1cf828){utils[_0x4eac('0x20')](util[_0x4eac('0x2')](_0x4eac('0x42'),_0xe4c42f[_0x4eac('0x3')]),_0x1cf828);}};exports[_0x4eac('0x48')]=function(_0xc6d0e){try{if(!_[_0x4eac('0x15')](queues[_0xc6d0e[_0x4eac('0x49')]])){utils[_0x4eac('0x16')](util[_0x4eac('0x2')](_0x4eac('0x4a'),_0xc6d0e['uniqueid']),_0xc6d0e);queues[_0xc6d0e[_0x4eac('0x49')]]['transfer']=!![];queues[_0xc6d0e[_0x4eac('0x49')]][_0x4eac('0x4b')]='BLIND';queues[_0xc6d0e['transfereeuniqueid']][_0x4eac('0x4c')]=_0xc6d0e[_0x4eac('0x4d')];queues[_0xc6d0e[_0x4eac('0x49')]][_0x4eac('0x4e')]=_0xc6d0e[_0x4eac('0x49')];queues[_0xc6d0e['transfereeuniqueid']][_0x4eac('0x7')]=_0x4eac('0x4f');utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x50'),_0xc6d0e[_0x4eac('0x3')],queues[_0xc6d0e[_0x4eac('0x49')]][_0x4eac('0x1d')],_0xc6d0e[_0x4eac('0x49')],_0xc6d0e[_0x4eac('0x4d')]));}}catch(_0x1823ab){utils[_0x4eac('0x20')](util['format']('[%s][queues][blindtransfer]',_0xc6d0e[_0x4eac('0x3')]),_0x1823ab);}};exports[_0x4eac('0x51')]=function(_0xcf28d){try{utils[_0x4eac('0x16')](util[_0x4eac('0x2')](_0x4eac('0x52'),_0xcf28d['origtransfereruniqueid']),_0xcf28d);if(_0xcf28d[_0x4eac('0x53')]==_0xcf28d['origtransfererlinkedid']){if(!_[_0x4eac('0x15')](queues[_0xcf28d[_0x4eac('0x54')]])){utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x55'),_0xcf28d['origtransfereruniqueid'],queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x1d')],_0xcf28d['origtransfererexten']));queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x45')]=!![];queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x4b')]=_0x4eac('0x56');queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x4c')]=_0xcf28d['origtransfererexten'];queues[_0xcf28d['secondtransfererlinkedid']][_0x4eac('0x4e')]=_0xcf28d[_0x4eac('0x53')];queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x7')]=_0x4eac('0x57');}if(!_[_0x4eac('0x15')](queues[_0xcf28d['origtransfererlinkedid']])){if(_0xcf28d[_0x4eac('0x58')]&&queues[_0xcf28d[_0x4eac('0x58')]]){queues[_0xcf28d[_0x4eac('0x58')]][_0x4eac('0x1f')]=0x1;queues[_0xcf28d['transfereeuniqueid']]=_[_0x4eac('0x59')](queues[_0xcf28d['transfereelinkedid']]);queues[_0xcf28d['transfereeuniqueid']][_0x4eac('0xd')]=_0xcf28d[_0x4eac('0x5a')];queues[_0xcf28d[_0x4eac('0x49')]][_0x4eac('0x1f')]=0x2;queues[_0xcf28d[_0x4eac('0x49')]]['calleridnum']=queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x5')];queues[_0xcf28d[_0x4eac('0x49')]][_0x4eac('0x5b')]=queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x5b')];queues[_0xcf28d[_0x4eac('0x49')]][_0x4eac('0x36')]=utils[_0x4eac('0x13')]();queues[_0xcf28d[_0x4eac('0x49')]][_0x4eac('0x18')]=utils[_0x4eac('0x13')]();queues[_0xcf28d[_0x4eac('0x49')]][_0x4eac('0x34')]=0x0;queues[_0xcf28d[_0x4eac('0x49')]][_0x4eac('0x5c')]=0x0;utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x5d'),_0xcf28d[_0x4eac('0x53')],queues[_0xcf28d['transfereeuniqueid']][_0x4eac('0x1d')],queues[_0xcf28d[_0x4eac('0x49')]][_0x4eac('0x5')],queues[_0xcf28d[_0x4eac('0x49')]]['calleridname']));}else{utils['info'](util[_0x4eac('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xcf28d[_0x4eac('0x53')],queues[_0xcf28d[_0x4eac('0x5e')]][_0x4eac('0x1d')],_0xcf28d[_0x4eac('0x54')]));queues[_0xcf28d[_0x4eac('0x5e')]][_0x4eac('0xd')]=_0xcf28d[_0x4eac('0x54')];}}}else if(_0xcf28d[_0x4eac('0x5f')]==_0xcf28d[_0x4eac('0x54')]){if(!_['isNil'](queues[_0xcf28d[_0x4eac('0x5e')]])){utils[_0x4eac('0x10')](util['format'](_0x4eac('0x60'),_0xcf28d[_0x4eac('0x53')],queues[_0xcf28d[_0x4eac('0x5e')]][_0x4eac('0x1d')],_0xcf28d[_0x4eac('0x5f')],_0xcf28d[_0x4eac('0x61')]));queues[_0xcf28d[_0x4eac('0x5e')]]['transfer']=!![];queues[_0xcf28d['origtransfererlinkedid']]['transfertype']=_0x4eac('0x56');queues[_0xcf28d['origtransfererlinkedid']][_0x4eac('0x4c')]=_0xcf28d['secondtransfererexten'];queues[_0xcf28d['origtransfererlinkedid']][_0x4eac('0x4e')]=_0xcf28d[_0x4eac('0x5f')];queues[_0xcf28d[_0x4eac('0x5e')]]['queuecallerexitreason']=_0x4eac('0x57');}if(!_[_0x4eac('0x15')](queues[_0xcf28d['secondtransfererlinkedid']])){if(_0xcf28d[_0x4eac('0x62')]&&queues[_0xcf28d[_0x4eac('0x62')]]){queues[_0xcf28d[_0x4eac('0x62')]][_0x4eac('0x1f')]=0x1;queues[_0xcf28d[_0x4eac('0x5a')]]=_[_0x4eac('0x59')](queues[_0xcf28d[_0x4eac('0x62')]]);queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0xd')]=_0xcf28d[_0x4eac('0x5a')];queues[_0xcf28d[_0x4eac('0x5a')]]['queuecallerenterreason']=0x2;queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0x5')]=queues[_0xcf28d[_0x4eac('0x5e')]][_0x4eac('0x5')];queues[_0xcf28d['transfertargetuniqueid']][_0x4eac('0x5b')]=queues[_0xcf28d[_0x4eac('0x5e')]][_0x4eac('0x5b')];queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0x36')]=utils[_0x4eac('0x13')]();queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0x18')]=utils[_0x4eac('0x13')]();queues[_0xcf28d['transfertargetuniqueid']][_0x4eac('0x34')]=0x0;queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0x5c')]=0x0;utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x63'),_0xcf28d[_0x4eac('0x53')],queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0x1d')],queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0xd')],queues[_0xcf28d['transfertargetuniqueid']][_0x4eac('0x5')],queues[_0xcf28d[_0x4eac('0x5a')]][_0x4eac('0x5b')]));}else{utils[_0x4eac('0x10')](util[_0x4eac('0x2')](_0x4eac('0x64'),_0xcf28d[_0x4eac('0x53')],queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0x1d')],_0xcf28d['origtransfererlinkedid']));queues[_0xcf28d[_0x4eac('0x54')]][_0x4eac('0xd')]=_0xcf28d[_0x4eac('0x5e')];}}}}catch(_0x191b22){utils[_0x4eac('0x20')](util['format']('[%s][queues][attendedtransfer]',_0xcf28d[_0x4eac('0x53')]),_0x191b22);}};exports[_0x4eac('0x65')]=function(_0x2418d5){try{if(!_[_0x4eac('0x15')](queues[_0x2418d5[_0x4eac('0x3')]])){utils[_0x4eac('0x16')](util[_0x4eac('0x2')]('[%s][queues][musiconholdstart]',_0x2418d5['uniqueid']),_0x2418d5);queues[_0x2418d5[_0x4eac('0x3')]][_0x4eac('0x66')]=utils[_0x4eac('0x13')]();utils['info'](util[_0x4eac('0x2')](_0x4eac('0x67'),_0x2418d5[_0x4eac('0x3')],queues[_0x2418d5[_0x4eac('0x3')]][_0x4eac('0x1d')],queues[_0x2418d5[_0x4eac('0x3')]][_0x4eac('0x66')]));}}catch(_0x50e48f){utils[_0x4eac('0x20')](util[_0x4eac('0x2')](_0x4eac('0x68'),_0x2418d5['uniqueid']),_0x50e48f);}};exports[_0x4eac('0x69')]=function(_0x1381e0){try{if(!_[_0x4eac('0x15')](queues[_0x1381e0[_0x4eac('0x3')]])){if(!_[_0x4eac('0x15')](queues[_0x1381e0['uniqueid']][_0x4eac('0x66')])){utils[_0x4eac('0x16')](util[_0x4eac('0x2')](_0x4eac('0x6a'),_0x1381e0[_0x4eac('0x3')]),_0x1381e0);queues[_0x1381e0['uniqueid']]['mohtime']+=utils[_0x4eac('0x35')](utils[_0x4eac('0x13')](),queues[_0x1381e0[_0x4eac('0x3')]][_0x4eac('0x66')]);utils[_0x4eac('0x10')](util['format'](_0x4eac('0x6b'),_0x1381e0[_0x4eac('0x3')],queues[_0x1381e0[_0x4eac('0x3')]][_0x4eac('0x1d')],queues[_0x1381e0[_0x4eac('0x3')]][_0x4eac('0x5c')]));delete queues[_0x1381e0[_0x4eac('0x3')]][_0x4eac('0x66')];}}}catch(_0x285fc3){utils['error'](util[_0x4eac('0x2')]('[%s][queues][musiconholdstop]',_0x1381e0[_0x4eac('0x3')]),_0x285fc3);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index bc3ee0a..6a41a80 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 _0xef5a=['variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','clone','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel'];(function(_0x1554e6,_0x28607d){var _0x4cafbf=function(_0x478aaf){while(--_0x478aaf){_0x1554e6['push'](_0x1554e6['shift']());}};_0x4cafbf(++_0x28607d);}(_0xef5a,0x14d));var _0xaef5=function(_0x34da82,_0x45a76f){_0x34da82=_0x34da82-0x0;var _0x34e621=_0xef5a[_0x34da82];return _0x34e621;};'use strict';var _=require(_0xaef5('0x0'));var util=require(_0xaef5('0x1'));var utils=require(_0xaef5('0x2'));var recordings={};function writeDB(_0x185598){utils[_0xaef5('0x3')](util[_0xaef5('0x4')](_0xaef5('0x5'),_0x185598[_0xaef5('0x6')]));if(_0x185598[_0xaef5('0x7')]){utils['getUserByInternal'](_0x185598['accountcode'])[_0xaef5('0x8')](function(_0x21efd9){if(_0x21efd9){_0x185598[_0xaef5('0x9')]=_0x21efd9[_0xaef5('0xa')];_0x185598[_0xaef5('0xb')]=_0x21efd9['id'];}utils[_0xaef5('0xc')]('CreateVoiceRecording',_0x185598);});}else{utils[_0xaef5('0xc')]('CreateVoiceRecording',_0x185598);}}exports[_0xaef5('0xd')]=function(_0x2192de){try{utils['debug'](util['format'](_0xaef5('0xe'),_0x2192de['uniqueid']),_0x2192de);if(_0x2192de['uniqueid']==_0x2192de[_0xaef5('0xf')]){utils['info'](util['format'](_0xaef5('0x10'),_0x2192de[_0xaef5('0x6')],_0x2192de[_0xaef5('0x11')],_0x2192de[_0xaef5('0x12')]));recordings[_0x2192de[_0xaef5('0x6')]]={'uniqueid':_0x2192de['uniqueid'],'accountcode':_0x2192de[_0xaef5('0x7')],'exten':_0x2192de['exten'],'context':_0x2192de[_0xaef5('0x11')],'channel':_0x2192de['channel'],'monitors':[]};}}catch(_0x53bd03){utils[_0xaef5('0x13')](util[_0xaef5('0x4')](_0xaef5('0xe'),_0x2192de[_0xaef5('0x6')]),_0x53bd03);}};exports[_0xaef5('0x14')]=function(_0x310150){try{utils[_0xaef5('0x15')](util[_0xaef5('0x4')](_0xaef5('0x16'),_0x310150[_0xaef5('0x6')]),_0x310150);if(!_[_0xaef5('0x17')](recordings[_0x310150[_0xaef5('0x6')]])&&_0x310150[_0xaef5('0x18')]==0x6){utils['info'](util[_0xaef5('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x310150['uniqueid'],_0x310150['context'],_0x310150['channel']));}else if(!_['isNil'](recordings[_0x310150[_0xaef5('0xf')]])&&_0x310150['channelstate']==0x6&&_0x310150[_0xaef5('0x11')]!='transfer'){utils[_0xaef5('0x3')](util['format'](_0xaef5('0x19'),_0x310150['uniqueid'],_0x310150[_0xaef5('0xf')],_0x310150[_0xaef5('0x11')],_0x310150[_0xaef5('0x1a')]));recordings[_0x310150[_0xaef5('0xf')]]['accountcode']=_0x310150[_0xaef5('0x7')];}}catch(_0x8ce007){utils[_0xaef5('0x13')](util[_0xaef5('0x4')]('[%s][recordings][newstate]',_0x310150['uniqueid']),_0x8ce007);}};exports['varset']=function(_0x26826b){try{if(!_['isNil'](_0x26826b[_0xaef5('0x1b')])&&!_[_0xaef5('0x17')](_0x26826b[_0xaef5('0x1b')][_0xaef5('0x1c')])){utils[_0xaef5('0x15')](util[_0xaef5('0x4')](_0xaef5('0x1d'),_0x26826b[_0xaef5('0x6')]),_0x26826b);utils['info'](util[_0xaef5('0x4')](_0xaef5('0x1e'),_0x26826b[_0xaef5('0x6')],_0x26826b[_0xaef5('0x1b')],_0x26826b[_0xaef5('0x1f')]));if(_[_0xaef5('0x20')](_0x26826b[_0xaef5('0x1f')],_0xaef5('0x21'))){_0x26826b[_0xaef5('0x1f')]=_0x26826b[_0xaef5('0x1f')]['replace'](_0xaef5('0x21'),_0xaef5('0x22'));}if(recordings[_0x26826b['linkedid']]){var _0x582d7f=_[_0xaef5('0x23')](recordings[_0x26826b[_0xaef5('0xf')]]['monitors'],{'value':_0x26826b['value']});if(_[_0xaef5('0x17')](_0x582d7f)){recordings[_0x26826b[_0xaef5('0xf')]][_0xaef5('0x24')][_0xaef5('0x25')]({'value':_0x26826b[_0xaef5('0x1f')]});}}}}catch(_0x1cbe57){utils['error'](util[_0xaef5('0x4')]('[%s][recordings][varset]',_0x26826b[_0xaef5('0x6')]),_0x1cbe57);}};exports['hangup']=function(_0x456484){try{if(!_[_0xaef5('0x17')](recordings[_0x456484['uniqueid']])){utils[_0xaef5('0x15')](util[_0xaef5('0x4')](_0xaef5('0x26'),_0x456484['uniqueid']),_0x456484);utils[_0xaef5('0x3')](util[_0xaef5('0x4')](_0xaef5('0x27'),_0x456484[_0xaef5('0x6')],_0x456484[_0xaef5('0x28')],_0x456484['calleridname'],_0x456484[_0xaef5('0x29')]));recordings[_0x456484['uniqueid']][_0xaef5('0x28')]=_0x456484[_0xaef5('0x28')];recordings[_0x456484['uniqueid']][_0xaef5('0x2a')]=_0x456484[_0xaef5('0x2a')];recordings[_0x456484[_0xaef5('0x6')]][_0xaef5('0x2b')]=_0x456484[_0xaef5('0x2b')];recordings[_0x456484['uniqueid']][_0xaef5('0x2c')]=_0x456484[_0xaef5('0x2c')];if(recordings[_0x456484[_0xaef5('0x6')]][_0xaef5('0x2d')]=='outbound'&&recordings[_0x456484['uniqueid']][_0xaef5('0x7')]){recordings[_0x456484[_0xaef5('0x6')]]['connectedlinenum']=recordings[_0x456484[_0xaef5('0x6')]][_0xaef5('0x7')];recordings[_0x456484[_0xaef5('0x6')]]['connectedlinename']='';}recordings[_0x456484['uniqueid']][_0xaef5('0x24')]['forEach'](function(_0x440c96){var _0x3f7f51=_[_0xaef5('0x2e')](recordings[_0x456484[_0xaef5('0x6')]]);_0x3f7f51['value']=_0x440c96[_0xaef5('0x1f')];writeDB(_0x3f7f51);});delete recordings[_0x456484[_0xaef5('0x6')]];}}catch(_0x33b1fb){utils[_0xaef5('0x13')](util['format'](_0xaef5('0x26'),_0x456484[_0xaef5('0x6')]),_0x33b1fb);}};exports['newexten']=function(_0x3b703d){try{if(!_['isNil'](recordings[_0x3b703d['uniqueid']])){utils[_0xaef5('0x15')](util[_0xaef5('0x4')](_0xaef5('0x2f'),_0x3b703d[_0xaef5('0x6')]),_0x3b703d);utils[_0xaef5('0x3')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3b703d[_0xaef5('0x6')],_0x3b703d[_0xaef5('0x30')],_0x3b703d[_0xaef5('0x31')]));if(_0x3b703d['application'][_0xaef5('0x32')]()==_0xaef5('0x33')&&_[_0xaef5('0x34')](_0x3b703d[_0xaef5('0x31')]['toLowerCase'](),_0xaef5('0x35'))){var _0x5d1de8=_0x3b703d[_0xaef5('0x31')][_0xaef5('0x36')]('=');var _0x379687=_0x5d1de8[0x0][_0xaef5('0x37')](_0x5d1de8[0x0][_0xaef5('0x38')]('(')+0x1,_0x5d1de8[0x0][_0xaef5('0x38')](')'));var _0x4d216b=_0x5d1de8[0x1];recordings[_0x3b703d[_0xaef5('0x6')]][_0x379687]=_0x4d216b;}}}catch(_0x469e39){utils[_0xaef5('0x13')](util[_0xaef5('0x4')](_0xaef5('0x2f'),_0x3b703d[_0xaef5('0x6')]),_0x469e39);}};exports['queuecallerjoin']=function(_0x53a26e){try{if(!_[_0xaef5('0x17')](recordings[_0x53a26e[_0xaef5('0x6')]])){utils[_0xaef5('0x15')](util['format'](_0xaef5('0x39'),_0x53a26e[_0xaef5('0x6')]),_0x53a26e);utils['info'](util[_0xaef5('0x4')](_0xaef5('0x3a'),_0x53a26e[_0xaef5('0x6')],_0x53a26e['queue']));recordings[_0x53a26e[_0xaef5('0x6')]][_0xaef5('0x3b')]=_0x53a26e[_0xaef5('0x3b')];}}catch(_0x1205fc){utils[_0xaef5('0x13')](util[_0xaef5('0x4')]('[%s][recordings][queuecallerjoin]',_0x53a26e[_0xaef5('0x6')]),_0x1205fc);}}; \ No newline at end of file +var _0x0c43=['isNil','channelstate','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]'];(function(_0x773b2e,_0x1c67b9){var _0x3959b6=function(_0x567635){while(--_0x567635){_0x773b2e['push'](_0x773b2e['shift']());}};_0x3959b6(++_0x1c67b9);}(_0x0c43,0x67));var _0x30c4=function(_0x3ac6a3,_0x529c13){_0x3ac6a3=_0x3ac6a3-0x0;var _0x32e084=_0x0c43[_0x3ac6a3];return _0x32e084;};'use strict';var _=require(_0x30c4('0x0'));var util=require(_0x30c4('0x1'));var utils=require(_0x30c4('0x2'));var recordings={};function writeDB(_0x3029ec){utils[_0x30c4('0x3')](util[_0x30c4('0x4')](_0x30c4('0x5'),_0x3029ec['uniqueid']));if(_0x3029ec[_0x30c4('0x6')]){utils['getUserByInternal'](_0x3029ec[_0x30c4('0x6')])['then'](function(_0x2d4e02){if(_0x2d4e02){_0x3029ec[_0x30c4('0x7')]=_0x2d4e02[_0x30c4('0x8')];_0x3029ec[_0x30c4('0x9')]=_0x2d4e02['id'];}utils[_0x30c4('0xa')](_0x30c4('0xb'),_0x3029ec);});}else{utils['request'](_0x30c4('0xb'),_0x3029ec);}}exports[_0x30c4('0xc')]=function(_0x2a4176){try{utils[_0x30c4('0xd')](util[_0x30c4('0x4')](_0x30c4('0xe'),_0x2a4176[_0x30c4('0xf')]),_0x2a4176);if(_0x2a4176[_0x30c4('0xf')]==_0x2a4176['linkedid']){utils[_0x30c4('0x3')](util[_0x30c4('0x4')](_0x30c4('0x10'),_0x2a4176[_0x30c4('0xf')],_0x2a4176[_0x30c4('0x11')],_0x2a4176['exten']));recordings[_0x2a4176[_0x30c4('0xf')]]={'uniqueid':_0x2a4176['uniqueid'],'accountcode':_0x2a4176['accountcode'],'exten':_0x2a4176[_0x30c4('0x12')],'context':_0x2a4176[_0x30c4('0x11')],'channel':_0x2a4176[_0x30c4('0x13')],'monitors':[]};}}catch(_0x3b54fa){utils[_0x30c4('0x14')](util['format'](_0x30c4('0xe'),_0x2a4176[_0x30c4('0xf')]),_0x3b54fa);}};exports[_0x30c4('0x15')]=function(_0x342a4a){try{utils[_0x30c4('0xd')](util[_0x30c4('0x4')](_0x30c4('0x16'),_0x342a4a['uniqueid']),_0x342a4a);if(!_[_0x30c4('0x17')](recordings[_0x342a4a[_0x30c4('0xf')]])&&_0x342a4a[_0x30c4('0x18')]==0x6){utils[_0x30c4('0x3')](util[_0x30c4('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x342a4a['uniqueid'],_0x342a4a[_0x30c4('0x11')],_0x342a4a[_0x30c4('0x13')]));}else if(!_[_0x30c4('0x17')](recordings[_0x342a4a[_0x30c4('0x19')]])&&_0x342a4a['channelstate']==0x6&&_0x342a4a[_0x30c4('0x11')]!=_0x30c4('0x1a')){utils[_0x30c4('0x3')](util[_0x30c4('0x4')](_0x30c4('0x1b'),_0x342a4a['uniqueid'],_0x342a4a[_0x30c4('0x19')],_0x342a4a[_0x30c4('0x11')],_0x342a4a['channel']));recordings[_0x342a4a[_0x30c4('0x19')]][_0x30c4('0x6')]=_0x342a4a[_0x30c4('0x6')];}}catch(_0x1f6039){utils[_0x30c4('0x14')](util[_0x30c4('0x4')]('[%s][recordings][newstate]',_0x342a4a[_0x30c4('0xf')]),_0x1f6039);}};exports[_0x30c4('0x1c')]=function(_0x1241df){try{if(!_[_0x30c4('0x17')](_0x1241df[_0x30c4('0x1d')])&&!_['isNil'](_0x1241df[_0x30c4('0x1d')][_0x30c4('0x1e')])){utils[_0x30c4('0xd')](util[_0x30c4('0x4')](_0x30c4('0x1f'),_0x1241df[_0x30c4('0xf')]),_0x1241df);utils[_0x30c4('0x3')](util['format'](_0x30c4('0x20'),_0x1241df[_0x30c4('0xf')],_0x1241df['variable'],_0x1241df['value']));if(_[_0x30c4('0x21')](_0x1241df[_0x30c4('0x22')],_0x30c4('0x23'))){_0x1241df['value']=_0x1241df['value']['replace'](_0x30c4('0x23'),'.WAV');}if(recordings[_0x1241df[_0x30c4('0x19')]]){var _0x34bc4d=_['find'](recordings[_0x1241df[_0x30c4('0x19')]][_0x30c4('0x24')],{'value':_0x1241df[_0x30c4('0x22')]});if(_[_0x30c4('0x17')](_0x34bc4d)){recordings[_0x1241df[_0x30c4('0x19')]]['monitors']['push']({'value':_0x1241df['value']});}}}}catch(_0x3da851){utils[_0x30c4('0x14')](util['format'](_0x30c4('0x1f'),_0x1241df[_0x30c4('0xf')]),_0x3da851);}};exports[_0x30c4('0x25')]=function(_0x2836f9){try{if(!_['isNil'](recordings[_0x2836f9[_0x30c4('0xf')]])){utils[_0x30c4('0xd')](util[_0x30c4('0x4')](_0x30c4('0x26'),_0x2836f9[_0x30c4('0xf')]),_0x2836f9);utils[_0x30c4('0x3')](util[_0x30c4('0x4')](_0x30c4('0x27'),_0x2836f9[_0x30c4('0xf')],_0x2836f9[_0x30c4('0x28')],_0x2836f9[_0x30c4('0x29')],_0x2836f9[_0x30c4('0x2a')]));recordings[_0x2836f9['uniqueid']][_0x30c4('0x28')]=_0x2836f9['calleridnum'];recordings[_0x2836f9[_0x30c4('0xf')]]['calleridname']=_0x2836f9['calleridname'];recordings[_0x2836f9[_0x30c4('0xf')]][_0x30c4('0x2b')]=_0x2836f9[_0x30c4('0x2b')];recordings[_0x2836f9['uniqueid']][_0x30c4('0x2c')]=_0x2836f9['connectedlinename'];if(recordings[_0x2836f9['uniqueid']][_0x30c4('0x2d')]==_0x30c4('0x2e')&&recordings[_0x2836f9[_0x30c4('0xf')]][_0x30c4('0x6')]){recordings[_0x2836f9[_0x30c4('0xf')]]['connectedlinenum']=recordings[_0x2836f9[_0x30c4('0xf')]][_0x30c4('0x6')];recordings[_0x2836f9[_0x30c4('0xf')]][_0x30c4('0x2c')]='';}recordings[_0x2836f9[_0x30c4('0xf')]][_0x30c4('0x24')][_0x30c4('0x2f')](function(_0x1c09d2){var _0x59e282=_[_0x30c4('0x30')](recordings[_0x2836f9['uniqueid']]);_0x59e282[_0x30c4('0x22')]=_0x1c09d2[_0x30c4('0x22')];writeDB(_0x59e282);});delete recordings[_0x2836f9[_0x30c4('0xf')]];}}catch(_0x413a22){utils[_0x30c4('0x14')](util[_0x30c4('0x4')]('[%s][recordings][hangup]',_0x2836f9[_0x30c4('0xf')]),_0x413a22);}};exports[_0x30c4('0x31')]=function(_0x2b8c1f){try{if(!_['isNil'](recordings[_0x2b8c1f[_0x30c4('0xf')]])){utils[_0x30c4('0xd')](util[_0x30c4('0x4')](_0x30c4('0x32'),_0x2b8c1f[_0x30c4('0xf')]),_0x2b8c1f);utils['info'](util[_0x30c4('0x4')](_0x30c4('0x33'),_0x2b8c1f['uniqueid'],_0x2b8c1f[_0x30c4('0x34')],_0x2b8c1f[_0x30c4('0x35')]));if(_0x2b8c1f[_0x30c4('0x34')]['toLowerCase']()=='set'&&_[_0x30c4('0x36')](_0x2b8c1f[_0x30c4('0x35')][_0x30c4('0x37')](),_0x30c4('0x38'))){var _0x5311e8=_0x2b8c1f['appdata']['split']('=');var _0x28f7fc=_0x5311e8[0x0][_0x30c4('0x39')](_0x5311e8[0x0]['lastIndexOf']('(')+0x1,_0x5311e8[0x0][_0x30c4('0x3a')](')'));var _0x3dcacd=_0x5311e8[0x1];recordings[_0x2b8c1f[_0x30c4('0xf')]][_0x28f7fc]=_0x3dcacd;}}}catch(_0x17043f){utils[_0x30c4('0x14')](util['format'](_0x30c4('0x32'),_0x2b8c1f[_0x30c4('0xf')]),_0x17043f);}};exports[_0x30c4('0x3b')]=function(_0x529066){try{if(!_[_0x30c4('0x17')](recordings[_0x529066[_0x30c4('0xf')]])){utils[_0x30c4('0xd')](util[_0x30c4('0x4')](_0x30c4('0x3c'),_0x529066['uniqueid']),_0x529066);utils[_0x30c4('0x3')](util[_0x30c4('0x4')](_0x30c4('0x3d'),_0x529066[_0x30c4('0xf')],_0x529066[_0x30c4('0x3e')]));recordings[_0x529066[_0x30c4('0xf')]][_0x30c4('0x3e')]=_0x529066[_0x30c4('0x3e')];}}catch(_0x5dad11){utils[_0x30c4('0x14')](util['format'](_0x30c4('0x3c'),_0x529066[_0x30c4('0xf')]),_0x5dad11);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9a45c9c..b7fea28 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 _0x74e7=['attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x74e7,0x68));var _0x774e=function(_0x26bfbc,_0x383a7e){_0x26bfbc=_0x26bfbc-0x0;var _0x2dde55=_0x74e7[_0x26bfbc];return _0x2dde55;};'use strict';var _=require(_0x774e('0x0'));var util=require(_0x774e('0x1'));var utils=require(_0x774e('0x2'));function writeDB(_0x311a83){utils[_0x774e('0x3')](util[_0x774e('0x4')](_0x774e('0x5'),_0x311a83[_0x774e('0x6')]==='attended'?_0x311a83['origtransfereruniqueid']:_0x311a83[_0x774e('0x7')],_0x311a83[_0x774e('0x6')]));utils[_0x774e('0x8')](_0x774e('0x9'),_0x311a83);}exports[_0x774e('0xa')]=function(_0x2c5c6e){try{utils[_0x774e('0xb')](util['format']('[%s][transfers][blindtransfer]',_0x2c5c6e[_0x774e('0x7')]),_0x2c5c6e);utils[_0x774e('0x3')](util[_0x774e('0x4')](_0x774e('0xc'),_0x2c5c6e[_0x774e('0x7')],_0x2c5c6e[_0x774e('0xd')],_0x2c5c6e[_0x774e('0xe')],_0x2c5c6e[_0x774e('0xf')],_0x2c5c6e['transfereecalleridname']));_0x2c5c6e['type']=_0x774e('0x10');writeDB(_0x2c5c6e);}catch(_0xa34b9b){utils[_0x774e('0x11')](util['format'](_0x774e('0x12'),_0x2c5c6e[_0x774e('0x7')]),_0xa34b9b);}};exports[_0x774e('0x13')]=function(_0x1c3f06){try{utils[_0x774e('0xb')](util['format'](_0x774e('0x14'),_0x1c3f06[_0x774e('0x15')]),_0x1c3f06);utils[_0x774e('0x3')](util[_0x774e('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1c3f06[_0x774e('0x15')],_0x1c3f06[_0x774e('0x16')],_0x1c3f06[_0x774e('0x17')],_0x1c3f06['transfertargetcalleridnum'],_0x1c3f06[_0x774e('0x18')]));_0x1c3f06=_[_0x774e('0x19')](_0x1c3f06,{'transfererchannel':_0x1c3f06['origtransfererchannel'],'transferercalleridnum':_0x1c3f06[_0x774e('0x16')],'transferercalleridname':_0x1c3f06['origtransferercalleridname'],'transfererconnectedlinenum':_0x1c3f06[_0x774e('0x1a')],'transfererconnectedlinename':_0x1c3f06[_0x774e('0x1b')],'transfereraccountcode':_0x1c3f06[_0x774e('0x1c')],'transferercontext':_0x1c3f06[_0x774e('0x1d')],'transfererexten':_0x1c3f06[_0x774e('0x1e')],'transfererlinkedid':_0x1c3f06['origtransfererlinkedid'],'context':_0x1c3f06[_0x774e('0x1f')],'extension':_0x1c3f06[_0x774e('0x20')],'type':_0x774e('0x21')});if(_[_0x774e('0x22')](_0x1c3f06['transfereechannel'])){_0x1c3f06=_[_0x774e('0x19')](_0x1c3f06,{'transfereechannel':_0x1c3f06['transfertargetchannel'],'transfereecalleridnum':_0x1c3f06[_0x774e('0x23')],'transfereecalleridname':_0x1c3f06[_0x774e('0x18')],'transfereeconnectedlinenum':_0x1c3f06[_0x774e('0x24')],'transfereeconnectedlinename':_0x1c3f06[_0x774e('0x25')],'transfereeaccountcode':_0x1c3f06[_0x774e('0x26')],'transfereecontext':_0x1c3f06[_0x774e('0x27')],'transfereeexten':_0x1c3f06['transfertargetexten'],'transfereelinkedid':_0x1c3f06[_0x774e('0x28')]});}writeDB(_0x1c3f06);}catch(_0x98f7cf){utils[_0x774e('0x11')](util[_0x774e('0x4')](_0x774e('0x14'),_0x1c3f06[_0x774e('0x15')]),_0x98f7cf);}}; \ No newline at end of file +var _0x749f=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','[%s][transfers][attendedtransfer]','util','./utils','info','format','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x749f,0xbb));var _0xf749=function(_0x44e7b9,_0xf7f5cc){_0x44e7b9=_0x44e7b9-0x0;var _0x1de7ac=_0x749f[_0x44e7b9];return _0x1de7ac;};'use strict';var _=require('lodash');var util=require(_0xf749('0x0'));var utils=require(_0xf749('0x1'));function writeDB(_0x1203c9){utils[_0xf749('0x2')](util[_0xf749('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x1203c9[_0xf749('0x4')]===_0xf749('0x5')?_0x1203c9['origtransfereruniqueid']:_0x1203c9[_0xf749('0x6')],_0x1203c9['type']));utils[_0xf749('0x7')](_0xf749('0x8'),_0x1203c9);}exports[_0xf749('0x9')]=function(_0x201c1b){try{utils[_0xf749('0xa')](util[_0xf749('0x3')](_0xf749('0xb'),_0x201c1b[_0xf749('0x6')]),_0x201c1b);utils[_0xf749('0x2')](util[_0xf749('0x3')](_0xf749('0xc'),_0x201c1b['uniqueid'],_0x201c1b[_0xf749('0xd')],_0x201c1b['transferercalleridname'],_0x201c1b[_0xf749('0xe')],_0x201c1b[_0xf749('0xf')]));_0x201c1b['type']=_0xf749('0x10');writeDB(_0x201c1b);}catch(_0x21229d){utils['error'](util[_0xf749('0x3')]('[%s][transfers][blindtransfer]',_0x201c1b[_0xf749('0x6')]),_0x21229d);}};exports[_0xf749('0x11')]=function(_0x3464d7){try{utils[_0xf749('0xa')](util['format']('[%s][transfers][attendedtransfer]',_0x3464d7['origtransfereruniqueid']),_0x3464d7);utils['info'](util[_0xf749('0x3')](_0xf749('0x12'),_0x3464d7[_0xf749('0x13')],_0x3464d7[_0xf749('0x14')],_0x3464d7[_0xf749('0x15')],_0x3464d7[_0xf749('0x16')],_0x3464d7[_0xf749('0x17')]));_0x3464d7=_[_0xf749('0x18')](_0x3464d7,{'transfererchannel':_0x3464d7[_0xf749('0x19')],'transferercalleridnum':_0x3464d7[_0xf749('0x14')],'transferercalleridname':_0x3464d7[_0xf749('0x15')],'transfererconnectedlinenum':_0x3464d7[_0xf749('0x1a')],'transfererconnectedlinename':_0x3464d7[_0xf749('0x1b')],'transfereraccountcode':_0x3464d7[_0xf749('0x1c')],'transferercontext':_0x3464d7[_0xf749('0x1d')],'transfererexten':_0x3464d7[_0xf749('0x1e')],'transfererlinkedid':_0x3464d7['origtransfererlinkedid'],'context':_0x3464d7[_0xf749('0x1f')],'extension':_0x3464d7[_0xf749('0x20')],'type':_0xf749('0x5')});if(_['isNil'](_0x3464d7[_0xf749('0x21')])){_0x3464d7=_[_0xf749('0x18')](_0x3464d7,{'transfereechannel':_0x3464d7[_0xf749('0x22')],'transfereecalleridnum':_0x3464d7[_0xf749('0x16')],'transfereecalleridname':_0x3464d7[_0xf749('0x17')],'transfereeconnectedlinenum':_0x3464d7[_0xf749('0x23')],'transfereeconnectedlinename':_0x3464d7[_0xf749('0x24')],'transfereeaccountcode':_0x3464d7[_0xf749('0x25')],'transfereecontext':_0x3464d7[_0xf749('0x26')],'transfereeexten':_0x3464d7[_0xf749('0x27')],'transfereelinkedid':_0x3464d7['transfertargetlinkedid']});}writeDB(_0x3464d7);}catch(_0xa948e7){utils[_0xf749('0x28')](util[_0xf749('0x3')](_0xf749('0x29'),_0x3464d7['origtransfereruniqueid']),_0xa948e7);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9e006ed..32f4a64 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 _0x655f=['moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','format','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x655f,0xc6));var _0xf655=function(_0x481a55,_0x1b8157){_0x481a55=_0x481a55-0x0;var _0x2c914e=_0x655f[_0x481a55];return _0x2c914e;};'use strict';var BPromise=require(_0xf655('0x0'));var jayson=require(_0xf655('0x1'));var moment=require(_0xf655('0x2'));var util=require(_0xf655('0x3'));var client=jayson[_0xf655('0x4')]['http']({'port':0x2329});var logger=require(_0xf655('0x5'))(_0xf655('0x6'));exports[_0xf655('0x7')]=function(_0x49f8f2,_0x1bd587){logger[_0xf655('0x7')](_0x49f8f2,_0x1bd587?util[_0xf655('0x8')](_0x1bd587,{'showHidden':![],'depth':null}):'');};exports[_0xf655('0x9')]=function(_0x2ceb7f,_0x159ef0){logger[_0xf655('0x9')](_0x2ceb7f,_0x159ef0?util[_0xf655('0x8')](_0x159ef0,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x23567a,_0x59f643){logger[_0xf655('0xa')](_0x23567a,_0x59f643?util[_0xf655('0x8')](_0x59f643,{'showHidden':![],'depth':null}):'');};exports[_0xf655('0xb')]=function(_0x2016ee,_0x128d2d){return client[_0xf655('0xb')](_0x2016ee,{'body':_0x128d2d})[_0xf655('0xc')](function(_0x33c1cd){logger[_0xf655('0x9')](_0xf655('0xd'),_0x2016ee,_0x33c1cd?util['inspect'](_0x33c1cd,{'showHidden':![],'depth':null}):'');})[_0xf655('0xe')](function(_0x4ddeb7){logger[_0xf655('0xa')]('[utils][request]\x20name:%s',_0x2016ee,_0x4ddeb7?util['inspect'](_0x4ddeb7,{'showHidden':![],'depth':null}):'');});};function getUser(_0xaacf75){return client[_0xf655('0xb')](_0xf655('0xf'),{'options':{'raw':!![],'attributes':['id','internal',_0xf655('0x10'),_0xf655('0x11')],'where':_0xaacf75,'limit':0x1}})['then'](function(_0xa713c0){logger[_0xf655('0x9')](_0xf655('0x12'),JSON[_0xf655('0x13')](_0xaacf75),_0xa713c0?util[_0xf655('0x8')](_0xa713c0,{'showHidden':![],'depth':null}):'');return _0xa713c0[_0xf655('0x14')][_0xf655('0x15')]?_0xa713c0[_0xf655('0x14')][0x0]:null;});}exports[_0xf655('0x16')]=function(_0x285119){return new BPromise(function(_0x14fd84,_0x3e46f8){if(_0x285119){return getUser({'internal':_0x285119})[_0xf655('0xc')](function(_0x43096f){logger[_0xf655('0x7')](_0xf655('0x17'),_0x285119,_0x43096f?'found':_0xf655('0x18'));return _0x14fd84(_0x43096f);})[_0xf655('0xe')](function(_0x3e97a7){logger[_0xf655('0xa')](_0xf655('0x19'),_0x3e97a7?util['inspect'](_0x3e97a7,{'showHidden':![],'depth':null}):'');return _0x14fd84(null);});}return _0x14fd84(null);});};exports['getUserByInterface']=function(_0x286e37){return new BPromise(function(_0x4299da,_0x1e45bb){if(_0x286e37){return getUser({'interface':_0x286e37})[_0xf655('0xc')](function(_0x5c422e){logger['info'](_0xf655('0x1a'),_0x286e37,_0x5c422e?_0xf655('0x1b'):'notfound');return _0x4299da(_0x5c422e);})['catch'](function(_0x210636){logger[_0xf655('0xa')](_0xf655('0x1c'),_0x210636?util[_0xf655('0x8')](_0x210636,{'showHidden':![],'depth':null}):'');return _0x4299da(null);});}return _0x4299da(null);});};exports[_0xf655('0x1d')]=function(_0x609c97){return new BPromise(function(_0x2e1429,_0x500f35){if(_0x609c97){return getUser({'name':_0x609c97})['then'](function(_0x20a739){logger[_0xf655('0x7')](_0xf655('0x1e'),_0x609c97,_0x20a739?'found':_0xf655('0x18'));return _0x2e1429(_0x20a739);})[_0xf655('0xe')](function(_0xd87394){logger[_0xf655('0xa')](_0xf655('0x1f'),_0xd87394?util[_0xf655('0x8')](_0xd87394,{'showHidden':![],'depth':null}):'');return _0x2e1429(null);});}return _0x2e1429(null);});};exports[_0xf655('0x20')]=function(_0x11e580){return new BPromise(function(_0x5803b4,_0x24e293){if(_0x11e580){return client[_0xf655('0xb')](_0xf655('0x21'),{'options':{'raw':!![],'attributes':['id','name',_0xf655('0x22'),_0xf655('0x23'),_0xf655('0x24')],'where':{'name':_0x11e580},'limit':0x1}})[_0xf655('0xc')](function(_0x3abbfb){logger[_0xf655('0x9')](_0xf655('0x25'),_0x11e580,_0x3abbfb?util[_0xf655('0x8')](_0x3abbfb,{'showHidden':![],'depth':null}):'');logger[_0xf655('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x11e580,_0x3abbfb?_0xf655('0x1b'):_0xf655('0x18'));return _0x5803b4(_0x3abbfb[_0xf655('0x14')][_0xf655('0x15')]?_0x3abbfb[_0xf655('0x14')][0x0]:null);})[_0xf655('0xe')](function(_0x3f67f3){logger['error']('[utils][getVoiceQueueByName]',_0x3f67f3?util['inspect'](_0x3f67f3,{'showHidden':![],'depth':null}):'');return _0x5803b4(null);});}return _0x5803b4(null);});};exports[_0xf655('0x26')]=function(_0x577956,_0xe4bbec){return moment(_0x577956)['add'](_0xe4bbec,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf655('0x27')]=function(_0x157596,_0x1e6cd2){return moment(_0x157596)[_0xf655('0x28')](_0x1e6cd2,_0xf655('0x29'))['format'](_0xf655('0x2a'));};exports[_0xf655('0x2b')]=function(_0x346ea9,_0x4f46bb){return moment(_0x346ea9)[_0xf655('0x2c')](moment(_0x4f46bb),_0xf655('0x29'));};exports[_0xf655('0x2d')]=function(_0x3ad279,_0x1f7f49){return parseInt(_0x3ad279,0xa)+parseInt(_0x1f7f49,0xa);};exports[_0xf655('0x2e')]=function(){return moment()[_0xf655('0x2f')](_0xf655('0x2a'));};exports[_0xf655('0x30')]=function(_0x431ae8,_0x620e67){if(_0x620e67){return moment(_0x431ae8)[_0xf655('0x30')](_0x620e67);}return!![];};exports['isBefore']=function(_0x2b346b,_0x41e322){if(_0x41e322){return moment(_0x2b346b)[_0xf655('0x31')](_0x41e322);}else if(_0x2b346b){return!![];}return![];}; \ No newline at end of file +var _0x63b1=['subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','xdr','info','inspect','debug','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','found','error','[utils][getUserByInternal]','getUserByInterface','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime'];(function(_0x2f8bc5,_0x12e3d1){var _0x2e4207=function(_0x217405){while(--_0x217405){_0x2f8bc5['push'](_0x2f8bc5['shift']());}};_0x2e4207(++_0x12e3d1);}(_0x63b1,0x177));var _0x163b=function(_0x472ba0,_0x4f8652){_0x472ba0=_0x472ba0-0x0;var _0x4c755a=_0x63b1[_0x472ba0];return _0x4c755a;};'use strict';var BPromise=require(_0x163b('0x0'));var jayson=require(_0x163b('0x1'));var moment=require(_0x163b('0x2'));var util=require(_0x163b('0x3'));var client=jayson['client'][_0x163b('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x163b('0x5'));exports[_0x163b('0x6')]=function(_0xe7c2d8,_0xb7ef57){logger[_0x163b('0x6')](_0xe7c2d8,_0xb7ef57?util[_0x163b('0x7')](_0xb7ef57,{'showHidden':![],'depth':null}):'');};exports[_0x163b('0x8')]=function(_0x3da92d,_0x272651){logger[_0x163b('0x8')](_0x3da92d,_0x272651?util[_0x163b('0x7')](_0x272651,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x298f67,_0x30025b){logger['error'](_0x298f67,_0x30025b?util[_0x163b('0x7')](_0x30025b,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x508031,_0x17a7ed){return client[_0x163b('0x9')](_0x508031,{'body':_0x17a7ed})[_0x163b('0xa')](function(_0x5b8252){logger[_0x163b('0x8')](_0x163b('0xb'),_0x508031,_0x5b8252?util[_0x163b('0x7')](_0x5b8252,{'showHidden':![],'depth':null}):'');})[_0x163b('0xc')](function(_0x849931){logger['error'](_0x163b('0xb'),_0x508031,_0x849931?util[_0x163b('0x7')](_0x849931,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1d415a){return client[_0x163b('0x9')](_0x163b('0xd'),{'options':{'raw':!![],'attributes':['id',_0x163b('0xe'),_0x163b('0xf'),_0x163b('0x10')],'where':_0x1d415a,'limit':0x1}})[_0x163b('0xa')](function(_0x13529a){logger['debug'](_0x163b('0x11'),JSON['stringify'](_0x1d415a),_0x13529a?util[_0x163b('0x7')](_0x13529a,{'showHidden':![],'depth':null}):'');return _0x13529a[_0x163b('0x12')][_0x163b('0x13')]?_0x13529a[_0x163b('0x12')][0x0]:null;});}exports[_0x163b('0x14')]=function(_0xd8eb03){return new BPromise(function(_0x373550,_0x5b65d5){if(_0xd8eb03){return getUser({'internal':_0xd8eb03})[_0x163b('0xa')](function(_0x38b41d){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xd8eb03,_0x38b41d?_0x163b('0x15'):'notfound');return _0x373550(_0x38b41d);})[_0x163b('0xc')](function(_0x556855){logger[_0x163b('0x16')](_0x163b('0x17'),_0x556855?util[_0x163b('0x7')](_0x556855,{'showHidden':![],'depth':null}):'');return _0x373550(null);});}return _0x373550(null);});};exports[_0x163b('0x18')]=function(_0x56df4e){return new BPromise(function(_0x512f3e,_0x5d7f7a){if(_0x56df4e){return getUser({'interface':_0x56df4e})[_0x163b('0xa')](function(_0xa18a7f){logger[_0x163b('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x56df4e,_0xa18a7f?_0x163b('0x15'):_0x163b('0x19'));return _0x512f3e(_0xa18a7f);})[_0x163b('0xc')](function(_0x317623){logger[_0x163b('0x16')](_0x163b('0x1a'),_0x317623?util[_0x163b('0x7')](_0x317623,{'showHidden':![],'depth':null}):'');return _0x512f3e(null);});}return _0x512f3e(null);});};exports[_0x163b('0x1b')]=function(_0x2a73ad){return new BPromise(function(_0x220fd2,_0x168286){if(_0x2a73ad){return getUser({'name':_0x2a73ad})[_0x163b('0xa')](function(_0x1a79ca){logger[_0x163b('0x6')](_0x163b('0x1c'),_0x2a73ad,_0x1a79ca?_0x163b('0x15'):_0x163b('0x19'));return _0x220fd2(_0x1a79ca);})['catch'](function(_0x44997c){logger['error']('[utils][getUserByName]',_0x44997c?util[_0x163b('0x7')](_0x44997c,{'showHidden':![],'depth':null}):'');return _0x220fd2(null);});}return _0x220fd2(null);});};exports['getVoiceQueueByName']=function(_0x44ba65){return new BPromise(function(_0x23c606,_0x304612){if(_0x44ba65){return client[_0x163b('0x9')](_0x163b('0x1d'),{'options':{'raw':!![],'attributes':['id','name','type','acw',_0x163b('0x1e')],'where':{'name':_0x44ba65},'limit':0x1}})[_0x163b('0xa')](function(_0x1aefae){logger[_0x163b('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x44ba65,_0x1aefae?util['inspect'](_0x1aefae,{'showHidden':![],'depth':null}):'');logger['info'](_0x163b('0x1f'),_0x44ba65,_0x1aefae?_0x163b('0x15'):_0x163b('0x19'));return _0x23c606(_0x1aefae[_0x163b('0x12')]['length']?_0x1aefae['result'][0x0]:null);})[_0x163b('0xc')](function(_0x3f480d){logger[_0x163b('0x16')](_0x163b('0x20'),_0x3f480d?util[_0x163b('0x7')](_0x3f480d,{'showHidden':![],'depth':null}):'');return _0x23c606(null);});}return _0x23c606(null);});};exports[_0x163b('0x21')]=function(_0x3ab98f,_0x2ce99c){return moment(_0x3ab98f)[_0x163b('0x22')](_0x2ce99c,_0x163b('0x23'))[_0x163b('0x24')](_0x163b('0x25'));};exports[_0x163b('0x26')]=function(_0x1182af,_0x2537df){return moment(_0x1182af)[_0x163b('0x27')](_0x2537df,_0x163b('0x23'))[_0x163b('0x24')](_0x163b('0x25'));};exports[_0x163b('0x28')]=function(_0x1633a5,_0x47f49c){return moment(_0x1633a5)[_0x163b('0x29')](moment(_0x47f49c),'seconds');};exports[_0x163b('0x2a')]=function(_0x5db377,_0x7f45f1){return parseInt(_0x5db377,0xa)+parseInt(_0x7f45f1,0xa);};exports[_0x163b('0x2b')]=function(){return moment()[_0x163b('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x163b('0x2c')]=function(_0x339cce,_0x21f865){if(_0x21f865){return moment(_0x339cce)[_0x163b('0x2c')](_0x21f865);}return!![];};exports[_0x163b('0x2d')]=function(_0x45064c,_0x323203){if(_0x323203){return moment(_0x45064c)[_0x163b('0x2d')](_0x323203);}else if(_0x45064c){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 18cfefd..4ca66ac 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 _0x879d=['method','remoteAddress','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','catch','then','user','no-user','data','timestamp','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','x-forwarded-for','headers','connection','url','statusCode','responseTime','inspect','device','agent_id','format'];(function(_0x5c3d56,_0x41c8e6){var _0x2c802b=function(_0x3bff41){while(--_0x3bff41){_0x5c3d56['push'](_0x5c3d56['shift']());}};_0x2c802b(++_0x41c8e6);}(_0x879d,0x68));var _0xd879=function(_0x4dfb65,_0x455784){_0x4dfb65=_0x4dfb65-0x0;var _0x1c7674=_0x879d[_0x4dfb65];return _0x1c7674;};var fs=require(_0xd879('0x0'));var _=require(_0xd879('0x1'));var ewinston=require(_0xd879('0x2'));var path=require(_0xd879('0x3'));var util=require(_0xd879('0x4'));var fileLogger=require(_0xd879('0x5'))[_0xd879('0x6')];var safeTemplate=require(_0xd879('0x7'))[_0xd879('0x8')];var maskSensitiveData=require(_0xd879('0x9'))['maskSensitiveData'];function ClientSideLogger(){function _0x5eb7ef(_0x50bf2e){var _0x214887=path[_0xd879('0xa')](_0xd879('0xb'),_0xd879('0xc'),_0xd879('0xd'));var _0x9e4f93=path[_0xd879('0xa')](_0xd879('0xe'),_0x50bf2e[_0xd879('0xf')]+'-'+_0x50bf2e[_0xd879('0x10')]);return fs[_0xd879('0x11')](path[_0xd879('0xa')](_0x214887,_0x9e4f93))['then'](function(){var _0x45f654=fileLogger(_0xd879('0xe'),path['join'](_0x214887,_0x9e4f93));return _0x45f654;})[_0xd879('0x12')](function(_0x23197c){throw _0x23197c;});}this[_0xd879('0xc')]=function(_0x22b13f,_0x44f76e,_0x45353b,_0x14d9b9){return _0x5eb7ef(_0x22b13f['user'])[_0xd879('0x13')](function(_0x2e5ca7){var _0x227d3b=_0x2e5ca7[_0x44f76e];return _0x227d3b;})[_0xd879('0x13')](function(_0x39c99d){var _0x40bd55=_0x22b13f[_0xd879('0x14')]?_0x22b13f['user']['id']:_0xd879('0x15');var _0x483355=_0x14d9b9[_0xd879('0x16')];var _0x389c65=_0x14d9b9[_0xd879('0x17')];var _0x55723f=new Date(Number(_0x389c65));return _0x39c99d(_0x40bd55,_0x55723f,_0x45353b,_0x483355);})[_0xd879('0x12')](function(_0x2c1c96){fileLogger('client')['error'](_0x2c1c96);});};}function setupLoggers(_0x355446){return new Promise(function(_0x747914){var _0x59a4ab=new ClientSideLogger();var _0x3a3ea6=fileLogger('api');var _0x37a123=fileLogger(_0xd879('0x18'));_0x355446[_0xd879('0x19')](_0xd879('0x1a'),_0x59a4ab);_0x355446[_0xd879('0x1b')](ewinston[_0xd879('0x1c')]({'winstonInstance':_0x3a3ea6,'meta':![],'statusLevels':!![],'msg':function(_0x459ede,_0x2d5257){var _0x17c24b=_0xd879('0x1d');if(!_[_0xd879('0x1e')](_0x459ede[_0xd879('0x1f')])){_0x17c24b+=_0xd879('0x20');var _0x6fb55c=_0x459ede[_0xd879('0x1f')];maskSensitiveData(_0x6fb55c);}return safeTemplate(util['format'](_0x17c24b,_0x459ede['method'],_0x459ede['headers'][_0xd879('0x21')]?_0x459ede[_0xd879('0x22')]['x-forwarded-for']:_0x459ede[_0xd879('0x23')]['remoteAddress']||_0x459ede['ip'],_0x459ede[_0xd879('0x24')],_0x2d5257[_0xd879('0x25')],_0x2d5257[_0xd879('0x26')],_0x459ede[_0xd879('0x14')]?_0x459ede[_0xd879('0x14')]['id']:null,_0x459ede[_0xd879('0x14')]?_0x459ede['user'][_0xd879('0x10')]:null,_0x459ede[_0xd879('0x14')]?_0x459ede[_0xd879('0x14')]['role']:null,_0x6fb55c?util[_0xd879('0x27')](_0x6fb55c,![],null):''));}}));_0x355446[_0xd879('0x1b')](ewinston[_0xd879('0x1c')]({'winstonInstance':_0x37a123,'meta':![],'statusLevels':!![],'msg':function(_0x3caf6a,_0x3b1910){var _0x2354d7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x3caf6a[_0xd879('0x1f')]&&_0x3caf6a['body'][_0xd879('0x28')]&&_0x3caf6a[_0xd879('0x1f')][_0xd879('0x29')]){_0x2354d7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xd879('0x2a')](_0x2354d7,_0x3caf6a[_0xd879('0x2b')],_0x3caf6a[_0xd879('0x22')][_0xd879('0x21')]?_0x3caf6a[_0xd879('0x22')][_0xd879('0x21')]:_0x3caf6a[_0xd879('0x23')][_0xd879('0x2c')]||_0x3caf6a['ip'],_0x3caf6a[_0xd879('0x24')],_0x3b1910[_0xd879('0x25')],_0x3b1910[_0xd879('0x26')],_0x3caf6a[_0xd879('0x14')]?_0x3caf6a[_0xd879('0x14')]['id']:null,_0x3caf6a[_0xd879('0x14')]?_0x3caf6a['user'][_0xd879('0x10')]:null,_0x3caf6a[_0xd879('0x14')]?_0x3caf6a[_0xd879('0x14')][_0xd879('0xf')]:null,_0x3caf6a[_0xd879('0x1f')]&&_0x3caf6a['body'][_0xd879('0x28')]?_0x3caf6a[_0xd879('0x1f')]['device']:_0xd879('0x2d'),_0x3caf6a[_0xd879('0x1f')]&&_0x3caf6a['body']['agent_id']?_0x3caf6a[_0xd879('0x1f')][_0xd879('0x29')]:'',_0x3caf6a[_0xd879('0x1f')]&&_0x3caf6a[_0xd879('0x1f')]['agent_name']?_0x3caf6a['body'][_0xd879('0x2e')]:'');},'ignoreRoute':function(_0x4c5784){var _0x2d7198=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2d7198[_0xd879('0x2f')](_0x4c5784['url']);}}));return _0x747914();});}exports[_0xd879('0x30')]=setupLoggers; \ No newline at end of file +var _0x46d7=['fs-extra','lodash','express-winston','path','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','/var','log','join','client','role','ensureDir','then','catch','user','no-user','data','error','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','name','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_id','agent_name','setupLoggers'];(function(_0x22b98f,_0x4e88cc){var _0x430c0c=function(_0x133dd2){while(--_0x133dd2){_0x22b98f['push'](_0x22b98f['shift']());}};_0x430c0c(++_0x4e88cc);}(_0x46d7,0xc0));var _0x746d=function(_0x453018,_0x3d3ae3){_0x453018=_0x453018-0x0;var _0x506a16=_0x46d7[_0x453018];return _0x506a16;};var fs=require(_0x746d('0x0'));var _=require(_0x746d('0x1'));var ewinston=require(_0x746d('0x2'));var path=require(_0x746d('0x3'));var util=require('util');var fileLogger=require(_0x746d('0x4'))[_0x746d('0x5')];var safeTemplate=require('./safe-template')[_0x746d('0x6')];var maskSensitiveData=require(_0x746d('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x3545ff(_0x203140){var _0x3dfa38=path['join'](_0x746d('0x8'),_0x746d('0x9'),'xcally');var _0x2d6b67=path[_0x746d('0xa')](_0x746d('0xb'),_0x203140[_0x746d('0xc')]+'-'+_0x203140['name']);return fs[_0x746d('0xd')](path['join'](_0x3dfa38,_0x2d6b67))[_0x746d('0xe')](function(){var _0x15a177=fileLogger(_0x746d('0xb'),path['join'](_0x3dfa38,_0x2d6b67));return _0x15a177;})[_0x746d('0xf')](function(_0x4ecf6a){throw _0x4ecf6a;});}this[_0x746d('0x9')]=function(_0x447100,_0xa62e3b,_0xe6f65d,_0x29195f){return _0x3545ff(_0x447100['user'])[_0x746d('0xe')](function(_0x4ed8e7){var _0x5f318f=_0x4ed8e7[_0xa62e3b];return _0x5f318f;})[_0x746d('0xe')](function(_0x1d281e){var _0x46fc6d=_0x447100[_0x746d('0x10')]?_0x447100[_0x746d('0x10')]['id']:_0x746d('0x11');var _0xe8558b=_0x29195f[_0x746d('0x12')];var _0x4d335a=_0x29195f['timestamp'];var _0x350aa4=new Date(Number(_0x4d335a));return _0x1d281e(_0x46fc6d,_0x350aa4,_0xe6f65d,_0xe8558b);})[_0x746d('0xf')](function(_0x4ff412){fileLogger('client')[_0x746d('0x13')](_0x4ff412);});};}function setupLoggers(_0x2690f2){return new Promise(function(_0x383592){var _0x3c15bc=new ClientSideLogger();var _0x368191=fileLogger(_0x746d('0x14'));var _0x438eb9=fileLogger(_0x746d('0x15'));_0x2690f2[_0x746d('0x16')](_0x746d('0x17'),_0x3c15bc);_0x2690f2['use'](ewinston[_0x746d('0x18')]({'winstonInstance':_0x368191,'meta':![],'statusLevels':!![],'msg':function(_0x3d9678,_0x57238a){var _0x14c9e2=_0x746d('0x19');if(!_[_0x746d('0x1a')](_0x3d9678['body'])){_0x14c9e2+=_0x746d('0x1b');var _0x111605=_0x3d9678[_0x746d('0x1c')];maskSensitiveData(_0x111605);}return safeTemplate(util[_0x746d('0x1d')](_0x14c9e2,_0x3d9678[_0x746d('0x1e')],_0x3d9678[_0x746d('0x1f')]['x-forwarded-for']?_0x3d9678[_0x746d('0x1f')][_0x746d('0x20')]:_0x3d9678[_0x746d('0x21')][_0x746d('0x22')]||_0x3d9678['ip'],_0x3d9678[_0x746d('0x23')],_0x57238a[_0x746d('0x24')],_0x57238a['responseTime'],_0x3d9678[_0x746d('0x10')]?_0x3d9678[_0x746d('0x10')]['id']:null,_0x3d9678[_0x746d('0x10')]?_0x3d9678[_0x746d('0x10')][_0x746d('0x25')]:null,_0x3d9678[_0x746d('0x10')]?_0x3d9678[_0x746d('0x10')][_0x746d('0xc')]:null,_0x111605?util[_0x746d('0x26')](_0x111605,![],null):''));}}));_0x2690f2[_0x746d('0x27')](ewinston[_0x746d('0x18')]({'winstonInstance':_0x438eb9,'meta':![],'statusLevels':!![],'msg':function(_0x3a901b,_0xed78e7){var _0x3bf5c7=_0x746d('0x28');if(_0x3a901b[_0x746d('0x1c')]&&_0x3a901b[_0x746d('0x1c')][_0x746d('0x29')]&&_0x3a901b['body']['agent_id']){_0x3bf5c7=_0x746d('0x2a');}return util[_0x746d('0x1d')](_0x3bf5c7,_0x3a901b[_0x746d('0x1e')],_0x3a901b['headers'][_0x746d('0x20')]?_0x3a901b[_0x746d('0x1f')][_0x746d('0x20')]:_0x3a901b[_0x746d('0x21')][_0x746d('0x22')]||_0x3a901b['ip'],_0x3a901b[_0x746d('0x23')],_0xed78e7[_0x746d('0x24')],_0xed78e7[_0x746d('0x2b')],_0x3a901b[_0x746d('0x10')]?_0x3a901b[_0x746d('0x10')]['id']:null,_0x3a901b[_0x746d('0x10')]?_0x3a901b[_0x746d('0x10')][_0x746d('0x25')]:null,_0x3a901b[_0x746d('0x10')]?_0x3a901b[_0x746d('0x10')][_0x746d('0xc')]:null,_0x3a901b[_0x746d('0x1c')]&&_0x3a901b[_0x746d('0x1c')][_0x746d('0x29')]?_0x3a901b[_0x746d('0x1c')][_0x746d('0x29')]:_0x746d('0x2c'),_0x3a901b[_0x746d('0x1c')]&&_0x3a901b['body'][_0x746d('0x2d')]?_0x3a901b[_0x746d('0x1c')][_0x746d('0x2d')]:'',_0x3a901b['body']&&_0x3a901b[_0x746d('0x1c')][_0x746d('0x2e')]?_0x3a901b[_0x746d('0x1c')][_0x746d('0x2e')]:'');},'ignoreRoute':function(_0x536f42){var _0x1917af=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1917af['test'](_0x536f42['url']);}}));return _0x383592();});}exports[_0x746d('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index ba8cb10..febe7bb 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdeb=['toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','min','max','domCompare','MMM','monthCompare','guess','test','isMoment','split','padStart','length','iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map','locale','weekdaysShort'];(function(_0x32d5dd,_0xa261ac){var _0x4f9490=function(_0x5f2e78){while(--_0x5f2e78){_0x32d5dd['push'](_0x32d5dd['shift']());}};_0x4f9490(++_0xa261ac);}(_0xbdeb,0x11d));var _0xbbde=function(_0x216bdd,_0x22e02b){_0x216bdd=_0x216bdd-0x0;var _0x3422b0=_0xbdeb[_0x216bdd];return _0x3422b0;};var _=require('lodash');var moment=require(_0xbbde('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x2ec9e9){return _0x2ec9e9[_0xbbde('0x1')];})[_0xbbde('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xbbde('0x3');var EINVALID_DATE=_0xbbde('0x4');function throwIfDateNotValid(_0x558ff0){if(!_0x558ff0[_0xbbde('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4ad94f){var _0x4c02a1=_0x4ad94f['split'](':')[_0xbbde('0x6')](function(_0x3d96b6){return parseInt(_0x3d96b6,0xa);});var _0xcb94e2=_0x4c02a1[0x0];var _0x545fa6=_0x4c02a1[0x1];if(_0xcb94e2<0x0||_0xcb94e2>0x17||_0x545fa6<0x0||_0x545fa6>0x3b){throw new Error(EINVALID_DATE);}return[_0xcb94e2,_0x545fa6];}function circularDoWInterval(_0x1a2ad1,_0x4278fd){if(_0x1a2ad1===_0x4278fd){return[_0x1a2ad1];}else{var _0xacfa2a=moment[_0xbbde('0x7')]();moment[_0xbbde('0x7')]('en');var _0x146731=moment[_0xbbde('0x8')]()[_0xbbde('0x6')](function(_0x25eab4){return _0x25eab4[_0xbbde('0x9')]();});moment[_0xbbde('0x7')](_0xacfa2a);var _0x3296fd=_0x146731[_0xbbde('0xa')](_0x1a2ad1);var _0x3a70f5=_0x146731['indexOf'](_0x4278fd);if(_0x3a70f5>_0x3296fd){return _0x146731[_0xbbde('0xb')](_0x3296fd,_0x3a70f5+0x1);}else{var _0x4f3967=_0x146731['slice'](0x0,_0x3a70f5+0x1);var _0x347798=_0x146731[_0xbbde('0xb')](_0x3296fd);return _0x347798[_0xbbde('0xc')](_0x4f3967);}}}module[_0xbbde('0xd')][_0xbbde('0xe')]=circularDoWInterval;function circularMonthInterval(_0x137f7d,_0x15570c){if(_0x137f7d===_0x15570c){return[_0x137f7d];}else{var _0x5b67bc=moment['locale']();moment[_0xbbde('0x7')]('en');var _0x4e06c5=moment[_0xbbde('0xf')]()['map'](function(_0x4ccf07){return _0x4ccf07['toLowerCase']();});moment[_0xbbde('0x7')](_0x5b67bc);var _0x33ab84=_0x4e06c5[_0xbbde('0xa')](_0x137f7d);var _0x181a32=_0x4e06c5[_0xbbde('0xa')](_0x15570c);if(_0x181a32>_0x33ab84){return _0x4e06c5['slice'](_0x33ab84,_0x181a32+0x1);}else{var _0x28358a=_0x4e06c5[_0xbbde('0xb')](0x0,_0x181a32+0x1);var _0x550b99=_0x4e06c5[_0xbbde('0xb')](_0x33ab84);return _0x550b99['concat'](_0x28358a);}}}module['exports'][_0xbbde('0x10')]=circularMonthInterval;function parseDom(_0x17a34f){var _0x309122=parseInt(_0x17a34f,0xa);if(_0x309122<0x1||_0x309122>0x1f){throw new Error(EINVALID_DATE);}return _0x309122;}function timeCompare(_0x3dc835,_0x455e6a,_0x398739){var _0x27ff74=_0x3dc835['clone']();var _0x33e941=extractTime(_0x455e6a);var _0x21652d=_0x33e941[0x0];var _0xc4dfd8=_0x33e941[0x1];var _0x5143a8=_0x3dc835[_0xbbde('0x11')]()[_0xbbde('0x12')](_0x21652d)['minutes'](_0xc4dfd8);throwIfDateNotValid(_0x5143a8);var _0x4085fb=extractTime(_0x398739);var _0x3711f8=_0x4085fb[0x0];var _0x290d15=_0x4085fb[0x1];var _0x229b64=_0x3dc835[_0xbbde('0x11')]()[_0xbbde('0x12')](_0x3711f8)['minutes'](_0x290d15);throwIfDateNotValid(_0x229b64);if(_0x229b64[_0xbbde('0x13')](_0x5143a8)){var _0x80bc2e=_0x27ff74[_0xbbde('0x11')]()[_0xbbde('0x14')](_0xbbde('0x15'));var _0x1af502=_0x27ff74[_0xbbde('0x11')]()[_0xbbde('0x16')](_0xbbde('0x15'));return _0x27ff74[_0xbbde('0x17')](_0x5143a8,_0x1af502,undefined,'[]')||_0x27ff74[_0xbbde('0x17')](_0x80bc2e,_0x229b64,undefined,'[]');}else{return _0x27ff74[_0xbbde('0x17')](_0x5143a8,_0x229b64,undefined,'[]');}}module[_0xbbde('0xd')][_0xbbde('0x18')]=timeCompare;function dowCompare(_0x38eefe,_0x40f5c4,_0x8076d3){var _0x99f7d9=_0x38eefe['locale']('en')[_0xbbde('0x19')](_0xbbde('0x1a'))[_0xbbde('0x9')]();return circularDoWInterval(_0x40f5c4,_0x8076d3)[_0xbbde('0x1b')](_0x99f7d9);}module[_0xbbde('0xd')]['dowCompare']=dowCompare;function domCompare(_0x3e7914,_0x4c6724,_0x59ebbe){var _0x334d87=_0x3e7914[_0xbbde('0x1c')]();if(_0x4c6724===_0x59ebbe){return _0x334d87===_0x4c6724;}else{var _0x336678=_0x3e7914[_0xbbde('0x1d')]();var _0x455beb=_0x4c6724<_0x59ebbe;let _0x194574=![];var _0x567304=0x0;var _0x4a1f93=0x0;if(_0x455beb){_0x567304=Math['max'](0x1,_0x4c6724);_0x4a1f93=Math[_0xbbde('0x1e')](_0x59ebbe,_0x336678);_0x194574=_0x334d87>=_0x567304&&_0x334d87<=_0x4a1f93;}else{_0x567304=Math[_0xbbde('0x1e')](_0x4c6724,_0x336678);_0x4a1f93=Math[_0xbbde('0x1f')](0x1,_0x59ebbe);_0x194574=_0x334d87>=_0x567304||_0x334d87<=_0x4a1f93;}return _0x194574;}}module[_0xbbde('0xd')][_0xbbde('0x20')]=domCompare;function monthCompare(_0x553a20,_0x851108,_0x314b1){var _0x1e8ea0=_0x553a20[_0xbbde('0x7')]('en')[_0xbbde('0x19')](_0xbbde('0x21'))[_0xbbde('0x9')]();return circularMonthInterval(_0x851108,_0x314b1)[_0xbbde('0x1b')](_0x1e8ea0);}module['exports'][_0xbbde('0x22')]=monthCompare;function iftime(_0x3763cb,_0x325ea6=moment['tz'][_0xbbde('0x23')](),_0x41b456=moment()){if(!validateRx[_0xbbde('0x24')](_0x3763cb)){throw new Error(EINVALID_STRING);}else{var _0x2aab8a=(moment[_0xbbde('0x25')](_0x41b456)?_0x41b456[_0xbbde('0x11')]():moment(_0x41b456))['tz'](_0x325ea6)[_0xbbde('0x7')]('en');throwIfDateNotValid(_0x2aab8a);var _0x1d0524=_0x3763cb['split'](',');var _0x1b9903=_0x1d0524[0x0];var _0x46d097=_0x1d0524[0x1];var _0x42675f=_0x1d0524[0x2];var _0x44e924=_0x1d0524[0x3];let _0x5c6e0d=!![];if(_0x1b9903!=='*'){var _0x4e1bf0=_0x1b9903[_0xbbde('0x26')]('-');var _0x315488=_['padStart'](_0x4e1bf0[0x0],0x5,'0');var _0x11e9d5=_0x4e1bf0['length']===0x2?_[_0xbbde('0x27')](_0x4e1bf0[0x1],0x5,'0'):_0x315488;_0x5c6e0d=timeCompare(_0x2aab8a,_0x315488,_0x11e9d5);}let _0x25f973=!![];if(_0x46d097!=='*'){var _0x37fbf8=_0x46d097['split']('-');var _0x41970e=_0x37fbf8[0x0];var _0x50cb3e=_0x37fbf8[_0xbbde('0x28')]===0x2?_0x37fbf8[0x1]:_0x41970e;_0x25f973=dowCompare(_0x2aab8a,_0x41970e,_0x50cb3e);}let _0x14a042=!![];if(_0x42675f!=='*'){var _0x51d437=_0x42675f[_0xbbde('0x26')]('-');var _0x11f1da=parseDom(_0x51d437[0x0]);var _0x2af443=_0x51d437[_0xbbde('0x28')]===0x2?parseDom(_0x51d437[0x1]):_0x11f1da;_0x14a042=domCompare(_0x2aab8a,_0x11f1da,_0x2af443);}let _0x238bcf=!![];if(_0x44e924!=='*'){var _0x1e69e2=_0x44e924[_0xbbde('0x26')]('-');var _0x465a3a=_0x1e69e2[0x0];var _0x560792=_0x1e69e2[_0xbbde('0x28')]===0x2?_0x1e69e2[0x1]:_0x1e69e2[0x0];_0x238bcf=monthCompare(_0x2aab8a,_0x465a3a,_0x560792);}return _0x5c6e0d&&_0x25f973&&_0x14a042&&_0x238bcf;}}module[_0xbbde('0xd')][_0xbbde('0x29')]=iftime; \ No newline at end of file +var _0xddec=['domCompare','MMM','monthCompare','guess','test','isMoment','length','iftime','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','monthsShort','concat','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','min','max','exports'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xddec,0x170));var _0xcdde=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xddec[_0x3947c9];return _0x2e7871;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xcdde('0x0')](function(_0x41f930){return _0x41f930[_0xcdde('0x1')];})[_0xcdde('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcdde('0x3');var EINVALID_DATE=_0xcdde('0x4');function throwIfDateNotValid(_0x6ff384){if(!_0x6ff384[_0xcdde('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2f8d4e){var _0x5d01a9=_0x2f8d4e[_0xcdde('0x6')](':')[_0xcdde('0x0')](function(_0x239910){return parseInt(_0x239910,0xa);});var _0x2d356e=_0x5d01a9[0x0];var _0xc5ada4=_0x5d01a9[0x1];if(_0x2d356e<0x0||_0x2d356e>0x17||_0xc5ada4<0x0||_0xc5ada4>0x3b){throw new Error(EINVALID_DATE);}return[_0x2d356e,_0xc5ada4];}function circularDoWInterval(_0xcac7ae,_0x30e037){if(_0xcac7ae===_0x30e037){return[_0xcac7ae];}else{var _0x466ac6=moment[_0xcdde('0x7')]();moment[_0xcdde('0x7')]('en');var _0x5eaab6=moment[_0xcdde('0x8')]()[_0xcdde('0x0')](function(_0x488aa9){return _0x488aa9[_0xcdde('0x9')]();});moment[_0xcdde('0x7')](_0x466ac6);var _0x4d6a3f=_0x5eaab6[_0xcdde('0xa')](_0xcac7ae);var _0x351f1d=_0x5eaab6[_0xcdde('0xa')](_0x30e037);if(_0x351f1d>_0x4d6a3f){return _0x5eaab6[_0xcdde('0xb')](_0x4d6a3f,_0x351f1d+0x1);}else{var _0x3f5372=_0x5eaab6['slice'](0x0,_0x351f1d+0x1);var _0x256d74=_0x5eaab6[_0xcdde('0xb')](_0x4d6a3f);return _0x256d74['concat'](_0x3f5372);}}}module['exports'][_0xcdde('0xc')]=circularDoWInterval;function circularMonthInterval(_0x242716,_0x3c36ae){if(_0x242716===_0x3c36ae){return[_0x242716];}else{var _0x32e598=moment[_0xcdde('0x7')]();moment[_0xcdde('0x7')]('en');var _0x1a200d=moment[_0xcdde('0xd')]()[_0xcdde('0x0')](function(_0x3b7db9){return _0x3b7db9[_0xcdde('0x9')]();});moment[_0xcdde('0x7')](_0x32e598);var _0x4fe63b=_0x1a200d[_0xcdde('0xa')](_0x242716);var _0x2adbbc=_0x1a200d[_0xcdde('0xa')](_0x3c36ae);if(_0x2adbbc>_0x4fe63b){return _0x1a200d['slice'](_0x4fe63b,_0x2adbbc+0x1);}else{var _0x3354e2=_0x1a200d[_0xcdde('0xb')](0x0,_0x2adbbc+0x1);var _0x125291=_0x1a200d[_0xcdde('0xb')](_0x4fe63b);return _0x125291[_0xcdde('0xe')](_0x3354e2);}}}module['exports'][_0xcdde('0xf')]=circularMonthInterval;function parseDom(_0x4c294c){var _0x31299a=parseInt(_0x4c294c,0xa);if(_0x31299a<0x1||_0x31299a>0x1f){throw new Error(EINVALID_DATE);}return _0x31299a;}function timeCompare(_0x407b61,_0x323675,_0x1cee84){var _0xd1cea1=_0x407b61[_0xcdde('0x10')]();var _0x326e7e=extractTime(_0x323675);var _0x5473f5=_0x326e7e[0x0];var _0x30ff9e=_0x326e7e[0x1];var _0x5d293a=_0x407b61[_0xcdde('0x10')]()['hours'](_0x5473f5)[_0xcdde('0x11')](_0x30ff9e);throwIfDateNotValid(_0x5d293a);var _0x431a5a=extractTime(_0x1cee84);var _0xfdc07f=_0x431a5a[0x0];var _0x5b89a1=_0x431a5a[0x1];var _0x5796bd=_0x407b61[_0xcdde('0x10')]()[_0xcdde('0x12')](_0xfdc07f)[_0xcdde('0x11')](_0x5b89a1);throwIfDateNotValid(_0x5796bd);if(_0x5796bd[_0xcdde('0x13')](_0x5d293a)){var _0x4d0b93=_0xd1cea1[_0xcdde('0x10')]()[_0xcdde('0x14')](_0xcdde('0x15'));var _0x32dfe1=_0xd1cea1[_0xcdde('0x10')]()['endOf'](_0xcdde('0x15'));return _0xd1cea1[_0xcdde('0x16')](_0x5d293a,_0x32dfe1,undefined,'[]')||_0xd1cea1['isBetween'](_0x4d0b93,_0x5796bd,undefined,'[]');}else{return _0xd1cea1[_0xcdde('0x16')](_0x5d293a,_0x5796bd,undefined,'[]');}}module['exports'][_0xcdde('0x17')]=timeCompare;function dowCompare(_0x4e52bd,_0x67755b,_0x1906e6){var _0x2fd45d=_0x4e52bd[_0xcdde('0x7')]('en')[_0xcdde('0x18')](_0xcdde('0x19'))['toLowerCase']();return circularDoWInterval(_0x67755b,_0x1906e6)[_0xcdde('0x1a')](_0x2fd45d);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x302014,_0xff631,_0x4e292d){var _0x3fded8=_0x302014[_0xcdde('0x1b')]();if(_0xff631===_0x4e292d){return _0x3fded8===_0xff631;}else{var _0x58527a=_0x302014[_0xcdde('0x1c')]();var _0x163ebf=_0xff631<_0x4e292d;let _0x47f022=![];var _0x2de33f=0x0;var _0x5dd6f4=0x0;if(_0x163ebf){_0x2de33f=Math['max'](0x1,_0xff631);_0x5dd6f4=Math[_0xcdde('0x1d')](_0x4e292d,_0x58527a);_0x47f022=_0x3fded8>=_0x2de33f&&_0x3fded8<=_0x5dd6f4;}else{_0x2de33f=Math['min'](_0xff631,_0x58527a);_0x5dd6f4=Math[_0xcdde('0x1e')](0x1,_0x4e292d);_0x47f022=_0x3fded8>=_0x2de33f||_0x3fded8<=_0x5dd6f4;}return _0x47f022;}}module[_0xcdde('0x1f')][_0xcdde('0x20')]=domCompare;function monthCompare(_0x38bfaa,_0x385be9,_0x49a93f){var _0x531929=_0x38bfaa[_0xcdde('0x7')]('en')[_0xcdde('0x18')](_0xcdde('0x21'))[_0xcdde('0x9')]();return circularMonthInterval(_0x385be9,_0x49a93f)[_0xcdde('0x1a')](_0x531929);}module[_0xcdde('0x1f')][_0xcdde('0x22')]=monthCompare;function iftime(_0x34ab5c,_0x4adc05=moment['tz'][_0xcdde('0x23')](),_0x228d29=moment()){if(!validateRx[_0xcdde('0x24')](_0x34ab5c)){throw new Error(EINVALID_STRING);}else{var _0x3ba327=(moment[_0xcdde('0x25')](_0x228d29)?_0x228d29['clone']():moment(_0x228d29))['tz'](_0x4adc05)[_0xcdde('0x7')]('en');throwIfDateNotValid(_0x3ba327);var _0x1734de=_0x34ab5c[_0xcdde('0x6')](',');var _0x144f82=_0x1734de[0x0];var _0x5b2ec2=_0x1734de[0x1];var _0x4e9613=_0x1734de[0x2];var _0x1cdf05=_0x1734de[0x3];let _0x1b3141=!![];if(_0x144f82!=='*'){var _0x3185fa=_0x144f82['split']('-');var _0x5ad91a=_['padStart'](_0x3185fa[0x0],0x5,'0');var _0x5c5d94=_0x3185fa[_0xcdde('0x26')]===0x2?_['padStart'](_0x3185fa[0x1],0x5,'0'):_0x5ad91a;_0x1b3141=timeCompare(_0x3ba327,_0x5ad91a,_0x5c5d94);}let _0x58f73e=!![];if(_0x5b2ec2!=='*'){var _0x1905d8=_0x5b2ec2[_0xcdde('0x6')]('-');var _0x4b21de=_0x1905d8[0x0];var _0x38d61e=_0x1905d8[_0xcdde('0x26')]===0x2?_0x1905d8[0x1]:_0x4b21de;_0x58f73e=dowCompare(_0x3ba327,_0x4b21de,_0x38d61e);}let _0x32b84b=!![];if(_0x4e9613!=='*'){var _0xaa9713=_0x4e9613['split']('-');var _0xcba33e=parseDom(_0xaa9713[0x0]);var _0x2dd910=_0xaa9713[_0xcdde('0x26')]===0x2?parseDom(_0xaa9713[0x1]):_0xcba33e;_0x32b84b=domCompare(_0x3ba327,_0xcba33e,_0x2dd910);}let _0xd067a8=!![];if(_0x1cdf05!=='*'){var _0x58824a=_0x1cdf05[_0xcdde('0x6')]('-');var _0x10faed=_0x58824a[0x0];var _0xe3e6c7=_0x58824a[_0xcdde('0x26')]===0x2?_0x58824a[0x1]:_0x58824a[0x0];_0xd067a8=monthCompare(_0x3ba327,_0x10faed,_0xe3e6c7);}return _0x1b3141&&_0x58f73e&&_0x32b84b&&_0xd067a8;}}module[_0xcdde('0x1f')][_0xcdde('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index adf2055..2c028a1 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x542c=['format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','stringify','transports','Logger','File','%s-%s','error','Console','warn','path','moment','winston','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','%s-%s.log','message','replace','{{{','}}}'];(function(_0x469393,_0x247969){var _0x5f720d=function(_0x40aeb3){while(--_0x40aeb3){_0x469393['push'](_0x469393['shift']());}};_0x5f720d(++_0x247969);}(_0x542c,0x19a));var _0xc542=function(_0x21d692,_0x487ac6){_0x21d692=_0x21d692-0x0;var _0x54f860=_0x542c[_0x21d692];return _0x54f860;};'use strict';var path=require(_0xc542('0x0'));var util=require('util');var moment=require(_0xc542('0x1'));var winston=require(_0xc542('0x2'));var config=require(_0xc542('0x3'));var debugLevel=config[_0xc542('0x4')]?config[_0xc542('0x4')][_0xc542('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xc542('0x6'),'warn':_0xc542('0x7'),'info':_0xc542('0x8'),'print':_0xc542('0x9'),'success':_0xc542('0xa'),'http':_0xc542('0xb'),'verbose':_0xc542('0xc'),'debug':_0xc542('0xd'),'silly':_0xc542('0xe')};winston[_0xc542('0xf')](XC_LOG_COLORS);function getLogFileName(_0x2d6c45,_0x25ed74,_0x19f717){var _0x539826=_0x2d6c45||_0xc542('0x10');return path['join'](_0x539826,util['format'](_0xc542('0x11'),_0x25ed74,_0x19f717));}function formatter(_0x33ee25,_0x12e383){_0x12e383[_0xc542('0x12')]=_0x12e383[_0xc542('0x12')][_0xc542('0x13')](/@@{/g,_0xc542('0x14'))['replace'](/}@@/g,_0xc542('0x15'))[_0xc542('0x13')](/@{/g,'{{')[_0xc542('0x13')](/}@/g,'}}');return util[_0xc542('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xc542('0x16')](_0xc542('0x17')),_0x12e383[_0xc542('0x18')][_0xc542('0x19')](),_0x33ee25,_0x12e383[_0xc542('0x12')]);}function fileFormat(_0x282ddf,_0x4e6d82){_0x4e6d82[_0xc542('0x12')]=_0x4e6d82[_0xc542('0x12')]['replace'](/@@{/g,_0xc542('0x14'))['replace'](/}@@/g,_0xc542('0x15'))[_0xc542('0x13')](/@{/g,'{{')[_0xc542('0x13')](/}@/g,'}}');var _0x5592b3=_0x4e6d82[_0xc542('0x1a')]&&Object[_0xc542('0x1b')](_0x4e6d82[_0xc542('0x1a')])['length']?'\x0a\x09'+JSON[_0xc542('0x1c')](_0x4e6d82[_0xc542('0x1a')]):'';return util[_0xc542('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0xc542('0x17')),_0x4e6d82['level'][_0xc542('0x19')](),_0x282ddf,_0x4e6d82[_0xc542('0x12')],_0x5592b3);}function consoleLogger(){var _0x2c8156=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc542('0x1d'))]['Console']({'level':'warn','json':![],'formatter':function(_0x5c5b57){return formatter('',_0x5c5b57);}})]});return _0x2c8156;}function fileLogger(_0x2a0f0e,_0x23ea6f){var _0x370e0b=new winston[(_0xc542('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc542('0x1d'))][(_0xc542('0x1f'))]({'name':util[_0xc542('0x16')](_0xc542('0x20'),_0x2a0f0e,_0xc542('0x21')),'filename':getLogFileName(_0x23ea6f,_0x2a0f0e,_0xc542('0x21')),'level':_0xc542('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x252a45){return fileFormat(_0x2a0f0e,_0x252a45);}}),new winston[(_0xc542('0x1d'))][(_0xc542('0x1f'))]({'name':util['format'](_0xc542('0x20'),_0x2a0f0e,debugLevel),'filename':getLogFileName(_0x23ea6f,_0x2a0f0e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x282130){return fileFormat(_0x2a0f0e,_0x282130);}}),new winston[(_0xc542('0x1d'))][(_0xc542('0x22'))]({'level':_0xc542('0x23'),'json':![],'formatter':function(_0x111dbb){return fileFormat(_0x2a0f0e,_0x111dbb);}})]});return _0x370e0b;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xd0fb=['{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','Console','warn','%s-%s','error','File','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xd0fb,0x167));var _0xbd0f=function(_0x2d9840,_0x8057e6){_0x2d9840=_0x2d9840-0x0;var _0x1c8f44=_0xd0fb[_0x2d9840];return _0x1c8f44;};'use strict';var path=require(_0xbd0f('0x0'));var util=require(_0xbd0f('0x1'));var moment=require(_0xbd0f('0x2'));var winston=require(_0xbd0f('0x3'));var config=require(_0xbd0f('0x4'));var debugLevel=config[_0xbd0f('0x5')]?config[_0xbd0f('0x5')][_0xbd0f('0x6')]():'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':_0xbd0f('0x7'),'error':_0xbd0f('0x8'),'warn':'bold\x20yellow','info':_0xbd0f('0x9'),'print':_0xbd0f('0xa'),'success':_0xbd0f('0xb'),'http':_0xbd0f('0xc'),'verbose':_0xbd0f('0xd'),'debug':_0xbd0f('0xe'),'silly':_0xbd0f('0xf')};winston[_0xbd0f('0x10')](XC_LOG_COLORS);function getLogFileName(_0x1592ad,_0x70bc11,_0x259190){var _0xaeeeea=_0x1592ad||_0xbd0f('0x11');return path[_0xbd0f('0x12')](_0xaeeeea,util[_0xbd0f('0x13')]('%s-%s.log',_0x70bc11,_0x259190));}function formatter(_0x5dca70,_0x3d383){_0x3d383[_0xbd0f('0x14')]=_0x3d383[_0xbd0f('0x14')]['replace'](/@@{/g,_0xbd0f('0x15'))[_0xbd0f('0x16')](/}@@/g,'}}}')[_0xbd0f('0x16')](/@{/g,'{{')[_0xbd0f('0x16')](/}@/g,'}}');return util[_0xbd0f('0x13')](_0xbd0f('0x17'),moment()[_0xbd0f('0x13')](_0xbd0f('0x18')),_0x3d383['level']['toUpperCase'](),_0x5dca70,_0x3d383[_0xbd0f('0x14')]);}function fileFormat(_0x248099,_0x3fb29a){_0x3fb29a[_0xbd0f('0x14')]=_0x3fb29a[_0xbd0f('0x14')]['replace'](/@@{/g,_0xbd0f('0x15'))[_0xbd0f('0x16')](/}@@/g,'}}}')[_0xbd0f('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x27156f=_0x3fb29a[_0xbd0f('0x19')]&&Object['keys'](_0x3fb29a['meta'])[_0xbd0f('0x1a')]?'\x0a\x09'+JSON[_0xbd0f('0x1b')](_0x3fb29a['meta']):'';return util[_0xbd0f('0x13')](_0xbd0f('0x1c'),moment()[_0xbd0f('0x13')](_0xbd0f('0x18')),_0x3fb29a[_0xbd0f('0x1d')]['toUpperCase'](),_0x248099,_0x3fb29a[_0xbd0f('0x14')],_0x27156f);}function consoleLogger(){var _0x14e780=new winston[(_0xbd0f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd0f('0x1f'))][(_0xbd0f('0x20'))]({'level':_0xbd0f('0x21'),'json':![],'formatter':function(_0x4922c0){return formatter('',_0x4922c0);}})]});return _0x14e780;}function fileLogger(_0x1366ed,_0x440d5f){var _0x32613d=new winston[(_0xbd0f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util['format'](_0xbd0f('0x22'),_0x1366ed,_0xbd0f('0x23')),'filename':getLogFileName(_0x440d5f,_0x1366ed,_0xbd0f('0x23')),'level':_0xbd0f('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x545680){return fileFormat(_0x1366ed,_0x545680);}}),new winston[(_0xbd0f('0x1f'))][(_0xbd0f('0x24'))]({'name':util['format']('%s-%s',_0x1366ed,debugLevel),'filename':getLogFileName(_0x440d5f,_0x1366ed,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3af8f9){return fileFormat(_0x1366ed,_0x3af8f9);}}),new winston[(_0xbd0f('0x1f'))][(_0xbd0f('0x20'))]({'level':_0xbd0f('0x21'),'json':![],'formatter':function(_0x2620e3){return fileFormat(_0x1366ed,_0x2620e3);}})]});return _0x32613d;}exports['consoleLogger']=consoleLogger;exports[_0xbd0f('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 25014e5..faf6a0c 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x4f398d,_0x56ba57){var _0x137284=function(_0x17a0b0){while(--_0x17a0b0){_0x4f398d['push'](_0x4f398d['shift']());}};_0x137284(++_0x56ba57);}(_0xda2d,0x102));var _0xdda2=function(_0x4591c0,_0x13d51d){_0x4591c0=_0x4591c0-0x0;var _0x14c150=_0xda2d[_0x4591c0];return _0x14c150;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file +var _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(_0x13d048,_0x361fc8){var _0x35b544=function(_0x425c5b){while(--_0x425c5b){_0x13d048['push'](_0x13d048['shift']());}};_0x35b544(++_0x361fc8);}(_0x1261,0x144));var _0x1126=function(_0x306626,_0x425e93){_0x306626=_0x306626-0x0;var _0x466728=_0x1261[_0x306626];return _0x466728;};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 diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3d0f00c..32a778f 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 _0xea28=['isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x9af67e,_0x5569d6){var _0x589a44=function(_0x3e2a14){while(--_0x3e2a14){_0x9af67e['push'](_0x9af67e['shift']());}};_0x589a44(++_0x5569d6);}(_0xea28,0x13a));var _0x8ea2=function(_0x2dd53b,_0x730934){_0x2dd53b=_0x2dd53b-0x0;var _0x4ae50a=_0xea28[_0x2dd53b];return _0x4ae50a;};var _=require(_0x8ea2('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2e031a){return _0x2e031a==='{{'?_0x8ea2('0x1'):_0x8ea2('0x2');}function safeTemplate(_0x459c4e){var _0x25e47e=_0x459c4e;if(typeof _0x459c4e===_0x8ea2('0x3')){_0x25e47e=_0x459c4e[_0x8ea2('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x459c4e)){_0x25e47e=_0x459c4e[_0x8ea2('0x5')](function(_0x23aaf1){return safeTemplate(_0x23aaf1);});}else if(_[_0x8ea2('0x6')](_0x459c4e)){_0x25e47e=Object['keys'](_0x459c4e)[_0x8ea2('0x7')](function(_0x435d78,_0xb7f278){_0x435d78[_0xb7f278]=safeTemplate(_0x459c4e[_0xb7f278]);return _0x435d78;},{});}return _0x25e47e;}module[_0x8ea2('0x8')][_0x8ea2('0x9')]=safeTemplate; \ No newline at end of file +var _0x5f66=['\x20}\x20}','string','replace','map','isPlainObject','keys','exports','safeTemplate'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x61c60c){return _0x61c60c==='{{'?'{\x20{\x20':_0x65f6('0x0');}function safeTemplate(_0x2f06ae){var _0x3461cd=_0x2f06ae;if(typeof _0x2f06ae===_0x65f6('0x1')){_0x3461cd=_0x2f06ae[_0x65f6('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2f06ae)){_0x3461cd=_0x2f06ae[_0x65f6('0x3')](function(_0x5150c8){return safeTemplate(_0x5150c8);});}else if(_[_0x65f6('0x4')](_0x2f06ae)){_0x3461cd=Object[_0x65f6('0x5')](_0x2f06ae)['reduce'](function(_0x4ed98f,_0x1c0e12){_0x4ed98f[_0x1c0e12]=safeTemplate(_0x2f06ae[_0x1c0e12]);return _0x4ed98f;},{});}return _0x3461cd;}module[_0x65f6('0x6')][_0x65f6('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 495b78f..efa8651 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2fe=['fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','env','NODE_PATH','string','pathExists','then','readJSON','writeJSON','exports'];(function(_0xefb4e,_0xe56689){var _0x36c78c=function(_0x158fe3){while(--_0x158fe3){_0xefb4e['push'](_0xefb4e['shift']());}};_0x36c78c(++_0xe56689);}(_0xf2fe,0xf7));var _0xef2f=function(_0x10a689,_0x44b9e8){_0x10a689=_0x10a689-0x0;var _0x236012=_0xf2fe[_0x10a689];return _0x236012;};var fs=require(_0xef2f('0x0'));var path=require(_0xef2f('0x1'));var config=require(_0xef2f('0x2'));var root=config[_0xef2f('0x3')];var APP_JSON_PATH=path[_0xef2f('0x4')](root,_0xef2f('0x5'));var NODEPATH=path['resolve'](root,_0xef2f('0x6'));function setLegacyLibsNodeEnvPath(_0xe55b77){let _0x3cb926=![];if(Array[_0xef2f('0x7')](_0xe55b77['apps'])){var _0x1bab07=_0xe55b77[_0xef2f('0x8')][_0xef2f('0x9')](function(_0x25d6a8){return _0x25d6a8[_0xef2f('0xa')]==='motion2';});if(_0x1bab07>-0x1){var _0x3c7a5d=_0xe55b77['apps'][_0x1bab07];if(typeof _0x3c7a5d[_0xef2f('0xb')][_0xef2f('0xc')]!==_0xef2f('0xd')){_0x3c7a5d[_0xef2f('0xb')][_0xef2f('0xc')]=NODEPATH;_0x3cb926=!![];}}return{'appConfig':_0xe55b77,'updated':_0x3cb926};}}function updateAppConfig(_0x4432f6){return fs[_0xef2f('0xe')](APP_JSON_PATH)[_0xef2f('0xf')](function(_0x264c9b){if(_0x264c9b){return fs[_0xef2f('0x10')](APP_JSON_PATH)[_0xef2f('0xf')](function(_0x43ffa9){var _0x59ce12=setLegacyLibsNodeEnvPath(_0x43ffa9);if(_0x59ce12['updated']){_0x4432f6['info']('Updating\x20app.json');return fs[_0xef2f('0x11')](APP_JSON_PATH,_0x43ffa9,{'spaces':0x2});}else{return Promise[_0xef2f('0x4')]();}});}else{return Promise[_0xef2f('0x4')]();}});}module[_0xef2f('0x12')]=updateAppConfig; \ No newline at end of file +var _0x041d=['string','then','readJSON','info','Updating\x20app.json','writeJSON','exports','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','findIndex','name','motion2','NODE_PATH'];(function(_0x976c42,_0x260cd9){var _0x428344=function(_0x20258f){while(--_0x20258f){_0x976c42['push'](_0x976c42['shift']());}};_0x428344(++_0x260cd9);}(_0x041d,0x1c1));var _0xd041=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x041d[_0x178e48];return _0x440d7e;};var fs=require('fs-extra');var path=require('path');var config=require(_0xd041('0x0'));var root=config[_0xd041('0x1')];var APP_JSON_PATH=path[_0xd041('0x2')](root,_0xd041('0x3'));var NODEPATH=path[_0xd041('0x2')](root,_0xd041('0x4'));function setLegacyLibsNodeEnvPath(_0xa794ad){let _0x5c4362=![];if(Array[_0xd041('0x5')](_0xa794ad['apps'])){var _0x1268ce=_0xa794ad['apps'][_0xd041('0x6')](function(_0x4ed818){return _0x4ed818[_0xd041('0x7')]===_0xd041('0x8');});if(_0x1268ce>-0x1){var _0x592ac3=_0xa794ad['apps'][_0x1268ce];if(typeof _0x592ac3['env'][_0xd041('0x9')]!==_0xd041('0xa')){_0x592ac3['env'][_0xd041('0x9')]=NODEPATH;_0x5c4362=!![];}}return{'appConfig':_0xa794ad,'updated':_0x5c4362};}}function updateAppConfig(_0x3d0637){return fs['pathExists'](APP_JSON_PATH)[_0xd041('0xb')](function(_0x4e7c76){if(_0x4e7c76){return fs[_0xd041('0xc')](APP_JSON_PATH)[_0xd041('0xb')](function(_0x558995){var _0x35a3a1=setLegacyLibsNodeEnvPath(_0x558995);if(_0x35a3a1['updated']){_0x3d0637[_0xd041('0xd')](_0xd041('0xe'));return fs[_0xd041('0xf')](APP_JSON_PATH,_0x558995,{'spaces':0x2});}else{return Promise[_0xd041('0x2')]();}});}else{return Promise[_0xd041('0x2')]();}});}module[_0xd041('0x10')]=updateAppConfig; \ No newline at end of file